diff --git a/.c3i/authorized_users.yml b/.c3i/authorized_users.yml index 6ed3839630c5d..b3ffb224879e9 100644 --- a/.c3i/authorized_users.yml +++ b/.c3i/authorized_users.yml @@ -7,7 +7,6 @@ authorized_users: - Croydon - Johnnyxy - solvingj -- ericLemanissier - tru - sztomi - theodelrieu @@ -45,7 +44,6 @@ authorized_users: - datalogics-robb - PinkySan - keysight-daryl -- gunmetal313 - rdeterre - Hopobcn - rikdev @@ -56,7 +54,6 @@ authorized_users: - ledocc - fpelliccioni - PierreRamoin -- yipdw - soporide - detwiler - hrantzsch @@ -82,7 +79,6 @@ authorized_users: - BlueSolei - AndWass - SpaceIm -- prsolucoes - yssource - dheater - GavinNL @@ -109,20 +105,16 @@ authorized_users: - mbodmer - feragon - claremacrae -- nicolastagliani - samuelpmish - Garcia6l20 -- RemySphere - pleroux0 - qchateau - datalogics-kam - tt4g - akshit-sharma -- jargonzombies - xqp - alnkpa - prince-chrismc -- bk2221 - igl42 - casabre - Nipheris @@ -135,7 +127,6 @@ authorized_users: - zod - Twon - miketsukerman -- mgoldshteyn - dab0bby - atilag - floriansimon1 @@ -144,7 +135,6 @@ authorized_users: - mapau - igor-sadchenko - fulara -- BNL-Corp - pyrige - ZaMaZaN4iK - rudolfheszele @@ -189,7 +179,6 @@ authorized_users: - pavanbadugu - isnullxbh - Michanne -- markusgod - syoliver - daravi - museghost @@ -234,7 +223,6 @@ authorized_users: - yelu - bibermann - baltendorf -- Mahe-Thomas - Eremiell - d70-t - ufkesba @@ -272,7 +260,6 @@ authorized_users: - greeng3 - mattgodbolt - mathbunnyru -- ngerke - TheLavaBlock - greeng3 - ItsBasi @@ -289,7 +276,6 @@ authorized_users: - mjvankampen - ivan-kulikov-dev - ntagliani -- bnlcorp - Alberto-Izquierdo - an-tao - p-ranav @@ -381,10 +367,8 @@ authorized_users: - ubnt-kannan - taoyouh - skannan89 -- paulo-coutinho - AndreyMlashkin - AndyMender -- triangulumlabs - Woazim - shubhamck - Lukas-Heiligenbrunner @@ -402,11 +386,9 @@ authorized_users: - Jonathan-Eid - ihsandemir - Marks101 -- whuji - jiangdawhy - MichelleHetzel - Pro -- anton-dirac - petiaccja - Expander - kdsx @@ -421,7 +403,6 @@ authorized_users: - TheSalvator - fcelda - toge -- maksim-0 - blackencino - lukaszlaszko - pichi-router @@ -547,7 +528,6 @@ authorized_users: - AshleyRoll - inparallel - vcampmany -- 3d4m-vladimir - thesummer - NolanC33 - Chnossos @@ -589,7 +569,6 @@ authorized_users: - claudius-kienle - choll - erikzenker -- dannftk - Jairard - Nicky-D - pgeler @@ -638,7 +617,6 @@ authorized_users: - woidpointer - dkruempe - ehds -- sase-cs - idealvin - seemk - chausner @@ -673,7 +651,6 @@ authorized_users: - gjasny - eirikb - wpalfi -- vkes - wouterz - szigetics - kovdan01 @@ -740,7 +717,6 @@ authorized_users: - jt416 - Pollux42 - gracicot -- Siviuze - ggulgulia - ondrej-benus - RubyNova @@ -750,7 +726,6 @@ authorized_users: - eerimoq - bb010g - paulocoutinhox -- WilliamBehrens - greg7mdp - ruurdadema - steromano87 @@ -809,14 +784,12 @@ authorized_users: - luizgabriel - kshehata - dietssa -- simoncent - staskau - Iswenzz - DAP-IT-Aachen - VladyslavUsenko - vdsbenoit - Macfly -- hesham-essam - mkviatkovskii - sgoth - hellozee @@ -868,7 +841,6 @@ authorized_users: - EstebanDugueperoux2 - suhasHere - Tradias -- NeXuS4Developer - jellespijker - bshoshany - Chrismarsh @@ -994,7 +966,7 @@ authorized_users: - kletoz - agilemapper - ZXfkSIE -- RubenRBS +- AbrilRBS - Alex-PLACET - antekone - ambroff @@ -1009,3 +981,473 @@ authorized_users: - ashley-b - psmitsu - Viatorus +- 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 +- PodnimatelPingvinov +- tmilnthorp +- IronTony-Stark +- edisonhello +- billyzheli +- xuzhenbao +- SunYu2004 +- Thibb1 +- achim-k +- JoelLefkowitz +- schuetzle-vector +- thejohnfreeman +- dimi309 +- valgur +- jakobrieke +- witte +- liarokapisv +- kielby +- mayeut +- CedricSchmeits +- mwerminski +- Kasurus +- barynton +- Daparrag +- roalter +- jsallay +- lmife +- granger35 +- bjoernrennfanz +- tylerjw +- fong7x7 +- zillemarco +- vlebourl +- akeles85 +- joakimono +- hkk2023 +- agagniere +- DuncanChisholm +- dariusarnold +- robbert-ef +- tobiashienzsch +- maikelvdh +- cmannett85 +- edahlseng +- yatagarasu25 +- elejke +- spnda +- forthib +- cprieto +- zhuoqiang +- bigcat26 +- KozhinovAlexander +- sykhro +- kuroneko +- swebb2066 +- grabowski-d +- pezy +- holger-detering +- carterian8 +- jdoubleu +- poretga99 +- sebsnyk +- mercierd +- Tobulus +- fklassen +- Geertien +- weatherhead99 +- OleksandrKvl +- bariscelik +- mralexlupu +- danicriss +- voronaam +- MatusKysel +- Sfletche132 +- stefanpantic-pdftools +- silvergasp +- doocman +- gouarin +- gegles +- jusito +- pwqbot +- ilya-lavrenov +- aubreynicoll +- j-carl +- jeffgarrett +- Maaown +- Knapock +- kaveish +- kwach +- BrettDong +- mtudan +- kontrybutor +- ThomasKes +- wbehrens-on-gh +- raulcd +- bwhitchurch +- jhunold +- Corallo +- JGatley +- christapley +- mpimenov +- ashvardanian +- 7bitcoder +- samuaz +- zajo +- bruchar1 +- pskoko +- marcus-sonestedt +- amrox +- tristanpenman +- schmidjo82 +- hiiizxf +- ftena +- tkhyn +- Hagartinger +- perseoGI +- krabbstek +- fcorso2016 +- seboste +- Sa3eedove +- cjbradfield +- ssrobins +- Ohjurot +- nbukuli +- ffabiomar +- 3d4m-volodymyr +- keyboardspecialist +- LvdStokker +- k-wasniowski +- ChrisThrasher +- ViktarHasiul231862 +- Becheler +- jalapenopuzzle +- HalfSweet +- CJCombrink +- nayyden +- wAuner +- m00z +- trns1997 +- GenuineAster +- Nachicle +- TrimbleAg +- ylatuya +- jabbas +- whaliendev +- AleksandraVolosevich-tomtom +- owenkellogg +- AndreaFinazzi +- klausholstjacobsen +- xahon +- jeremy-rifkin +- Christian-Prather +- Siarh199 +- liquiddaniel +- seppeon +- SavenkovIgor +- aliaksei135 +- ibosnic00 +- Xav83 +- matthewT53 +- sjlamerton +- marxin +- Arkokat +- adattatri +- jwfallawuiuc +- tgurriet +- mgfernan +- chrisc66 +- KevDi +- XVilka +- DoomHammer +- cschreib +- AleksandraVolosevich-TomTom +- p-groarke +- Kalixio +- temap +- vient +- bryce-cahill +- alfred-sa +- leducp +- mrjoel +- Nerixyz +- irieger +- Slashcash +- CJaccarino +- gagoi +- tux3 +- jan-grimo +- petermbauer +- Rdk-T +- fixstars-sonali +- FranzPoize +- SoShiny +- tamaskenezlego +- luizfeldmann +- ma30002000 +- thbeu +- HypoYoung +- technoyes +- Subash-Lamichhane +- rezvee6 +- SpiffGreen +- hegyizs +- kkloberdanz +- martin-olivier +- lucaskdc +- fnadeau +- '0x5ea1ed' +- Kischy +- MangaD +- fabiorossetto +- Bronek +- agdavydov81 +- sizeak +- johannes-wolf +- cyberflashguru +- OndrejSlamecka +- correaa +- jakeheke75 +- NelDav +- utelle +- har-bw +- abedra +- bennettgoble +- juansblanco +- jmalopoy +- mlutken +- hoyhoy +- stevenhartley +- RMZeroFour +- rymut +- MartyMcFlyInTheSky +- piliugin-anton +- Drllap +- i-curve +- Mi-La +- gureedo +- cbaecker +- ErixenCruz +- OrianeGourdyStilla +- nikitasinys +- pgrossomoreira +- wu-vincent +- Inujel +- keszegrobert +- tomasz-wezyk +- RaguzovaTatyana +- st9007a +- TheClockTwister +- Taepper +- anthonyliot +- obnyis +- johningve +- stefansli +- wgtmac +- kevinAlbs +- adamws +- rob-baily +- crhowell3 +- Jak-o-Shadows +- MelamudMichael +- Rodarin +- philippun1 +- Kaaml +- AlexanderBabansky +- matthiasbuhl +- cnicolaescu +- mmomtchev +- ChristianHeinigk +- metalMajor +- joergbrech +- dagon666 +- elvisdukaj +- vok1980 +- camm73 +- crstzh +- gagoi +- dbolduc +- jgaa +- tbsuht +- Greendogo +- iso8859-1 +- spiderkeys +- lspintzyk +- js-nano +- matheusgomes28 +- jsinge +- karlworks-dev +- PJBoy +- Ruwei-Liu +- msparapa +- pzheltov +- igadmg +- eljonny +- VladimirShaleev +- phwissmann +- ybogo +- ujos +- nclindroos +- es20490446e +- victimsnino +- dmpriso +- darakelian +- sivachandran +- oteffahi +- Ruwei +- TibiIius +- MattBelanger321 +- X1aomu +- datalogics-rgailiunas +- yhsng +- omdxp +- pierricgimmig +- laci-aura +- BenBudr +- PLeVasseur +- datalogics-staylor +- soroosh-sdi +- TheHugeManatee +- FannoFlow1 +- nayakche +- psi-func +- deniskovalchuk +- zarvox +- ErniGH +- culhatsker +- lubomirjurukov +- jmdaly +- inPhraZ +- nikolay-pv +- Julianiolo +- ErikHons +- enzo-pellegrini +- BLumia +- ydcpp +- tttapa +- zeeshancs07 +- jll63 +- Jie-Cheng +- jjardina +- soonick +- Mercotui +- sunbubble +- praetorian20 +- phbasler +- gsantner +- qihao727 +- qmfrederik +- NukeBird +- vijaiaeroastro +- xoorath +- mike919192 +- ScarletEmanu +- josephbirkner +- glywk +- aniederl +- SvenRoederer +- MridulS +- leemaguire +- RobinQu +- MatthewRasa +- jan-kelemen +- xiadnoring +- FeignClaims +- husitawi +- fpoirotte +- cuppajoeman +- vsbogd +- Nevermore1994 +- maciejjablonsky +- luc-c +- willprice +- pasbi +- liuzicheng1987 +- guyutongxue +- ciclark +- John-LittleBearLabs +- jasal82 +- philipp-m-w +- nine +- OMGtechy +- sabapathi20 +- seekstar +- dcoburnMEDITECH +- mattangus +- arnaudmathias +- hankhsu1996 +- stephematician +- awest03 +- sun-mir +- fhamonic +- simbahebinbo +- alessiosacco +- Blackflame576 +- Bakul-Gaur +- itsmejoeeey +- JustCallMeRay +- shun2wang +- czheng-bt +- jorgen +- simshi +- alatarum +- joda01 +- raplonu +- mattkretz +- DannyLihard +- stevenwdv +- smessmer +- fischjo3SICKAG +- jrosiek +- Thiesius +- xakod +- FWiesner +- aasmune +- sicheste +- Alan5142 +- mefff +- HazyMrf +- danniesim +- witcherofthorns +- amerry +- kulkarniamit +- hypengw +- Deishelon +- mosys +- asutic +- x93008 +- filipjaremczak +- braindigitalis +- vasama +- nonovv diff --git a/.c3i/config_v1.yml b/.c3i/config_v1.yml deleted file mode 100644 index e13f5eb8f935a..0000000000000 --- a/.c3i/config_v1.yml +++ /dev/null @@ -1,194 +0,0 @@ ---- -# Configuration for `https://github.com/conan-io/conan-center-index` repository -id: 'conan-io/conan-center-index' - -conan: - version: 1.54.0 - -artifactory: - url: "https://c3i.jfrog.io/c3i" - main_repo: "conan-center" - pull-request_repo_prefix: "c3i_PR" - pull-request_permission: "c3i-pr" - logs_repo: "misc" - cache_repo: "cache" - -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 - ceredential_errors_url: SLACK_FAILURE_WEBHOOK_URL - -# Things related to Jenkins jobs -tasks: - conan_v2_run_export: false - write_comments: true - detailed_status_checks: true - update_labels: true - 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 - cci_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 - -# Profile configurations to build packages -configurations: - - id: linux-gcc - epochs: [0] - hrname: "Linux, GCC" - content: - - os: [ "Linux" ] - arch: [ "x86_64" ] - compiler: - - "gcc": - compiler.libcxx: [ "libstdc++11", "libstdc++" ] - compiler.version: [ "5", "7", "8", "9", "10" ] - build_type: [ "Release", "Debug" ] - - id: linux-gcc - epochs: [20211221, 20220120] - hrname: "Linux, GCC" - content: - - os: ["Linux"] - arch: ["x86_64"] - compiler: - - "gcc": - compiler.libcxx: ["libstdc++11", "libstdc++"] - compiler.version: ["5", "7", "8", "9", "10", "11"] - build_type: ["Release", "Debug"] - - id: linux-clang - epochs: [0] - hrname: "Linux, Clang" - content: - - os: [ "Linux" ] - arch: [ "x86_64" ] - compiler: - - "clang": - compiler.libcxx: [ "libstdc++", "libc++" ] - compiler.version: [ "11" ] - build_type: [ "Release", "Debug" ] - - id: linux-clang - epochs: [20211221, 20220120] - hrname: "Linux, Clang" - content: - - os: ["Linux"] - arch: ["x86_64"] - compiler: - - "clang": - compiler.libcxx: ["libstdc++", "libc++"] - compiler.version: ["11", "12", "13"] - build_type: ["Release", "Debug"] - - id: configs/macos-clang - epochs: [0, 20211221] - hrname: "macOS, Clang" - content: - - os: [ "Macos" ] - arch: [ "x86_64" ] - compiler: - - "apple-clang": - compiler.version: [ "11.0", "12.0" ] - compiler.libcxx: [ "libc++" ] - build_type: [ "Release", "Debug" ] - - id: configs/macos-clang - epochs: [20220120] - hrname: "macOS, Clang" - content: - - os: [ "Macos" ] - arch: [ "x86_64" ] - compiler: - - "apple-clang": - compiler.version: [ "11.0", "12.0", "13.0"] - compiler.libcxx: [ "libc++" ] - build_type: [ "Release", "Debug" ] - - id: configs/macos-m1-clang - epochs: [0, 20211221] - hrname: "macOS, Clang (M1/arm64)" - build_profile: - os: "Macos" - arch: "x86_64" - content: - - os: [ "Macos" ] - arch: [ "armv8" ] - compiler: - - "apple-clang": - compiler.version: [ "12.0" ] - compiler.libcxx: [ "libc++" ] - build_type: [ "Release", "Debug" ] - - id: configs/macos-m1-clang - epochs: [20220120] - hrname: "macOS, Clang (M1/arm64)" - build_profile: - os: "Macos" - arch: "x86_64" - content: - - os: [ "Macos" ] - arch: [ "armv8" ] - compiler: - - "apple-clang": - compiler.version: [ "12.0", "13.0" ] - compiler.libcxx: [ "libc++" ] - build_type: [ "Release", "Debug" ] - - id: configs/windows-visual_studio - epochs: [0, 20211221, 20220120] - hrname: "Windows, Visual Studio" - content: - - os: [ "Windows" ] - arch: [ "x86_64" ] - compiler: - - "Visual Studio": - compiler.version: [ "15", "16" ] - build_type: - - "Release": - compiler.runtime: [ "MT", "MD" ] - - "Debug": - compiler.runtime: [ "MTd", "MDd" ] - -jenkins: - url: "http://mb-jenkins-my-bloody-jenkins:8080" - -node_labels: - Windows: - x86_64: - "Visual Studio": - default: "windows20221212" - Macos: - x86_64: - "apple-clang": - default: "mac_apple_clang_${compiler.version}" - armv8: - "apple-clang": - default: "mac_apple_clang_${compiler.version}" - Linux: - x86_64: - "gcc": - default: "linux_gcc_${compiler.version}" - "11": "linux_gcc_${compiler.version}_ubuntu16.04" - "clang": - default: "linux_clang_${compiler.version}_ubuntu16.04" - "11": "linux_clang_${compiler.version}" - -pod_size: - # Map with references that need special memory resources to compile. - # - Can be only by name or by name/version. - # - name/version notation takes preference over the name only one - # - Both notations can be combined for the same reference name - large: - - "pcl" - - "duckdb" - - "cppfront" - xlarge: - - "llvm" - - "opengv" diff --git a/.c3i/config_v2.yml b/.c3i/config_v2.yml deleted file mode 100644 index 08b2375a3d678..0000000000000 --- a/.c3i/config_v2.yml +++ /dev/null @@ -1,104 +0,0 @@ ---- -# Configuration for `https://github.com/conan-io/conan-center-index-staging` repository (using Conan v2) -id: 'conan-io/conan-center-index-staging-v2' - -conan: - version: 2.0.0-pre - -artifactory: - url: "https://c3i.jfrog.io/c3i" - main_repo: "conan-center-v2" - pull-request_repo_prefix: "c3i_PR-v2" - pull-request_permission: "c3i-pr" - logs_repo: "misc-v2" - # cache_repo: "cache" - -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: - feedback_title: "Conan v2 pipeline (informative, not required for merge)" - 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 - -configurations: - - id: linux-gcc - epochs: [20220628] - hrname: "Linux, GCC" - build_profile: - os: "Linux" - content: - - os: ["Linux"] - arch: ["x86_64"] - compiler: - - "gcc": - compiler.libcxx: ["libstdc++11"] - compiler.version: ["11"] - build_type: ["Release"] - - id: configs/macos-clang - epochs: [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/windows-msvc - epochs: [20220628] - hrname: "Windows, MSVC" - build_profile: - os: "Windows" - content: - - os: [ "Windows" ] - arch: [ "x86_64" ] - compiler: - - "msvc": - compiler.version: [ "192" ] - build_type: - - "Release": - compiler.runtime: [ "static", "dynamic" ] - compiler.runtime_type: [ "Release" ] - -jenkins: - url: "http://mb-jenkins-my-bloody-jenkins:8080" - -node_labels: - Windows: - x86_64: - "msvc": - default: "windows20221212" - Macos: - x86_64: - "apple-clang": - default: "mac_apple_clang_${compiler.version}" - armv8: - "apple-clang": - default: "mac_apple_clang_${compiler.version}" - Linux: - x86_64: - "gcc": - default: "linux_gcc_${compiler.version}_ubuntu16.04" - "clang": - default: "linux_clang_${compiler.version}_ubuntu16.04" diff --git a/.c3i/reviewers.yml b/.c3i/reviewers.yml index e722f8b159e06..e877828a1a9a3 100644 --- a/.c3i/reviewers.yml +++ b/.c3i/reviewers.yml @@ -9,21 +9,45 @@ reviewers: - user: "lasote" type: "team" request_reviews: false - - user: "jgsogo" - type: "community" - request_reviews: false - user: "czoido" type: "team" request_reviews: false - user: "memsharded" type: "team" request_reviews: false - - user: "SSE4" - type: "community" - request_reviews: true - user: "uilianries" type: "team" request_reviews: true + - user: "jcar87" + type: "team" + request_reviews: true + - user: "franramirez688" + type: "team" + request_reviews: true + - user: "AbrilRBS" + type: "team" + request_reviews: true + - user: "davidsanfal" + type: "team" + request_reviews: false + - user: "juansblanco" + type: "team" + request_reviews: false + - user: "perseoGI" + type: "team" + request_reviews: false + - user: "ErniGH" + type: "team" + request_reviews: false + ######## + ### Begin community reviewers + ######## + - user: "jgsogo" + type: "community" + request_reviews: false + - user: "SSE4" + type: "community" + request_reviews: false - user: "madebr" type: "community" request_reviews: false @@ -33,11 +57,8 @@ reviewers: - user: "theirix" type: "community" request_reviews: false - - user: "ericLemanissier" - type: "community" - request_reviews: false - user: "prince-chrismc" - type: "team" + type: "community" request_reviews: false - user: "Croydon" type: "community" @@ -57,18 +78,21 @@ reviewers: - user: "MartinDelille" type: "community" request_reviews: false - - user: "jcar87" - type: "team" - request_reviews: true - - user: "franramirez688" - type: "team" - request_reviews: true - user: "paulocoutinhox" type: "community" request_reviews: false - user: "jwillikers" type: "community" request_reviews: false - - user: "RubenRBS" - type: "team" + - user: "System-Arch" + type: "community" + request_reviews: false + - user: "samuel-emrys" + type: "community" + request_reviews: false + - user: "StellaSmith" + type: "community" + request_reviews: false + - user: "valgur" + type: "community" request_reviews: false diff --git a/.c3i/v1.jenkins b/.c3i/v1.jenkins deleted file mode 100644 index 68f3504079ef2..0000000000000 --- a/.c3i/v1.jenkins +++ /dev/null @@ -1,6 +0,0 @@ -#!groovy - -@Library('c3i') _ - -String configurationFile = '.c3i/config_v1.yml' -cci.runBuild(this, configurationFile) diff --git a/.c3i/v2.jenkins b/.c3i/v2.jenkins deleted file mode 100644 index 865f167f1dcf0..0000000000000 --- a/.c3i/v2.jenkins +++ /dev/null @@ -1,6 +0,0 @@ -#!groovy - -@Library('c3i') _ - -String configurationFile = '.c3i/config_v2.yml' -cci.runBuild(this, configurationFile) 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/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 0d794fd004dd6..80d0ac7cd4153 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,11 +1,15 @@ -Specify library name and version: **lib/1.0** - +### Summary +Changes to recipe: **lib/[version]** +#### Motivation + + +#### Details + ---- -- [ ] I've read the [contributing guidelines](https://github.com/conan-io/conan-center-index/blob/master/CONTRIBUTING.md). -- [ ] 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 tried at least one configuration locally with the [conan-center hook](https://github.com/conan-io/hooks.git) activated. +--- +- [ ] Read the [contributing guidelines](https://github.com/conan-io/conan-center-index/blob/master/CONTRIBUTING.md) +- [ ] Checked that this PR is not a duplicate: [list of PRs by recipe](https://github.com/conan-io/conan-center-index/discussions/24240) +- [ ] Tested locally with at least one configuration using a recent version of Conan diff --git a/.github/actions/pr_changed_files/action.yml b/.github/actions/pr_changed_files/action.yml deleted file mode 100644 index 4dc73a981748b..0000000000000 --- a/.github/actions/pr_changed_files/action.yml +++ /dev/null @@ -1,49 +0,0 @@ -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): - 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/stale.yml b/.github/stale.yml deleted file mode 100644 index f3a08a0c9f04e..0000000000000 --- a/.github/stale.yml +++ /dev/null @@ -1,61 +0,0 @@ -# Configuration for probot-stale - https://github.com/probot/stale - -# Number of days of inactivity before an Issue or Pull Request becomes stale -daysUntilStale: 30 - -# Number of days of inactivity before an Issue or Pull Request with the stale label is closed. -# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale. -daysUntilClose: 30 - -# Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled) -onlyLabels: [] - -# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable -exemptLabels: - - blocked - - infrastructure - -# Set to true to ignore issues in a project (defaults to false) -exemptProjects: false - -# Set to true to ignore issues in a milestone (defaults to false) -exemptMilestones: false - -# Set to true to ignore issues with an assignee (defaults to false) -exemptAssignees: false - -# Label to use when marking as stale -staleLabel: stale - -# Comment to post when marking as stale. Set to `false` to disable -markComment: > - This pull request has been automatically marked as stale because it has not had - recent activity. It will be closed if no further activity occurs. Thank you - for your contributions. - -# Comment to post when removing the stale label. -# unmarkComment: > -# Your comment here. - -# Comment to post when closing a stale Issue or Pull Request. -closeComment: > - This pull request has been automatically closed because it has not had - recent activity. Thank you for your contributions. - -# Limit the number of actions per hour, from 1-30. Default is 30 -limitPerRun: 30 - -# Limit to only `issues` or `pulls` -only: pulls - -# Optionally, specify configuration settings that are specific to just 'issues' or 'pulls': -# pulls: -# daysUntilStale: 30 -# markComment: > -# This pull request has been automatically marked as stale because it has not had -# recent activity. It will be closed if no further activity occurs. Thank you -# for your contributions. - -# issues: -# exemptLabels: -# - confirmed diff --git a/.github/workflows/hooks-warnings.yml b/.github/workflows/hooks-warnings.yml deleted file mode 100644 index 6c9b113b88126..0000000000000 --- a/.github/workflows/hooks-warnings.yml +++ /dev/null @@ -1,84 +0,0 @@ -name: hooks warnings - -on: - issue_comment: - types: [created] - -jobs: - comment: - if: ${{ github.event.issue.pull_request && github.event.sender.login == 'conan-center-bot' }} - runs-on: ubuntu-latest - steps: - - uses: actions/github-script@v7 - with: - script: | - warnings_map = new Map() - const link_regex = /\[All logs\]\((?https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*))\)/g; - for (const match of context.payload.comment.body.matchAll(link_regex)) - { - prefix = "https://c3i.jfrog.io/c3i/misc/summary.html?json=" - if(!match.groups.url.startsWith(prefix)) - continue; - url = match.groups.url.slice(prefix.length) - try { - result = await github.request({ - url: url, - }); - } catch(err) { - core.warning(`error ${err.status} for url ${err.request.url}`) - continue - } - for (const job of result.data) - { - if (job.build == null) - continue; - try { - log = await github.request({ - baseUrl: "https://c3i.jfrog.io/c3i/misc/", - url: job.build, - }); - } catch(err) { - core.warning(`error ${err.status} for url ${err.request.url}`) - continue - } - prefix = "[HOOK - conan-center.py] " - warnings = log.data.split("\n").filter(line => line.startsWith(prefix) && line.includes(" WARN: ")) - if(warnings.length == 0) - continue - if(!warnings_map.has(job.reference)) - warnings_map.set(job.reference, new Set()) - for(const warning of warnings) - { - msg = warning.slice(prefix.length) - warnings_map.get(job.reference).add(msg) - core.warning(msg) - } - } - } - if(warnings_map.size > 0) - { - comment = "
\n" - comment += "Hooks produced the following warnings" - const shaRegex = /(All green|Failure) in build \d+ \(`(?(\d|[a-z])+)`\):/g; - const shaMatch = shaRegex.exec(context.payload.comment.body) - if(shaMatch) - { - comment += " for commit " + shaMatch.groups.sha - } - comment += "\n\n" - for (const [ref, warnings] of warnings_map) - { - comment += "
\n" - comment += "" + ref + "\n\n```\n" - for(const warning of warnings) - comment += warning + "\n" - comment += "```\n
\n" - } - comment += "
\n" - github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: comment - }) - } diff --git a/.github/workflows/linter-conan-v2.yml b/.github/workflows/linter-conan-v2.yml deleted file mode 100644 index 9e633c4629d4d..0000000000000 --- a/.github/workflows/linter-conan-v2.yml +++ /dev/null @@ -1,143 +0,0 @@ -name: "[linter] Conan v2 migration" - -on: - pull_request: - -env: - PYTHONPATH: ${{github.workspace}} - PYVER: "3.8" - SCORE_THRESHOLD: "9.5" - REQUIREMENTS: "pylint==2.14" - -jobs: - test_linter: - name: Test linter changes (v2 migration) - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Get changed files - uses: ./.github/actions/pr_changed_files - id: changed_files - with: - files: | - linter/** - - 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@v5 - 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: | - pip install ${{ env.REQUIREMENTS }} conan==${{ steps.parse_conan_v1_version.outputs.result }} - - - name: Execute linter over all recipes in the repository - 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 }} - - - 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@v4 - 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 - - conanfile_recipe: - name: Lint changed conanfile.py (v2 migration) - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Get changed files - id: changed-files - uses: ./.github/actions/pr_changed_files - with: - files: | - recipes/*/*/conanfile.py - - 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@v5 - 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 ${{ env.REQUIREMENTS }} conan==${{ steps.parse_conan_v1_version.outputs.result }} - - name: Run linter - if: steps.changed-files.outputs.any_changed == 'true' - run: | - echo "::add-matcher::linter/recipe_linter.json" - for file in ${{ steps.changed-files.outputs.all_changed_files }}; do - pylint --rcfile=linter/pylintrc_recipe --output-format=parseable ${file} - done - - conanfile_test_package: - name: Lint changed test_package/conanfile.py (v2 migration) - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Get changed files - id: changed-files - uses: ./.github/actions/pr_changed_files - with: - files: | - recipes/*/*/test_*/conanfile.py - - 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@v5 - 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 ${{ env.REQUIREMENTS }} conan==${{ steps.parse_conan_v1_version.outputs.result }} - - name: Run linter - if: steps.changed-files.outputs.any_changed == 'true' - run: | - echo "::add-matcher::linter/recipe_linter.json" - for file in ${{ steps.changed-files.outputs.all_changed_files }}; do - pylint --rcfile=linter/pylintrc_testpackage --ignore-paths="recipes/[^/]*/[^/]*/test_v1[^/]*/conanfile.py" --output-format=parseable ${file} - done diff --git a/.github/workflows/linter-yaml.yml b/.github/workflows/linter-yaml.yml deleted file mode 100644 index 800894c21f01a..0000000000000 --- a/.github/workflows/linter-yaml.yml +++ /dev/null @@ -1,125 +0,0 @@ -name: "[linter] YAML files" - -on: - pull_request: - -env: - PYTHONPATH: ${{github.workspace}} - PYVER: "3.8" - CONFIG_FILES_PATH: "recipes/*/config.yml" - CONANDATA_FILES_PATH: "recipes/*/*/conandata.yml" - -jobs: - test_linter: - # A job to run when the linter changes. We want to know in advance how many files will be broken - name: Test linter changes (YAML files) - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Get changed files - uses: ./.github/actions/pr_changed_files - id: changed_files - with: - files: | - linter/** - - - uses: actions/setup-python@v5 - 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 strictyaml argparse - - - name: Run linter (config.yml) - if: steps.changed_files.outputs.any_changed == 'true' && always() - 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: | - 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: | - err=0 - for file in ${{ env.CONANDATA_FILES_PATH }}; do - python3 linter/conandata_yaml_linter.py ${file} || err=1 - done - if [[ $err == 1 ]]; then - exit 1 - fi - - lint_pr_files: - # Lint files modified in the pull_request - name: Lint changed files (YAML files) - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: ${{ env.PYVER }} - - - name: Install dependencies - run: pip install yamllint strictyaml argparse - - ## Work on config.yml files - - name: Get changed files (config) - id: changed_files_config - if: always() - 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 -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: ./.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 - python3 linter/conandata_yaml_linter.py ${file} || err=1 - done - if [[ $err == 1 ]]; then - exit 1 - fi diff --git a/.github/workflows/markdown-links.yml b/.github/workflows/markdown-links.yml deleted file mode 100644 index 28dc6aa33e333..0000000000000 --- a/.github/workflows/markdown-links.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: "[linter] Markdown links" - -on: - pull_request: - paths: - - '**.md' - -jobs: - markdown-link-check-pr: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - 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 deleted file mode 100644 index d16005bb86641..0000000000000 --- a/.github/workflows/mlc_config.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "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 deleted file mode 100644 index d7a06f6c2ef5f..0000000000000 --- a/.github/workflows/on-push-do-doco.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: docs_markdown_toc -on: - workflow_dispatch: - inputs: {} - push: - branches: - - master - paths: - - 'docs/**' - -jobs: - docs_markdown_toc: - runs-on: windows-latest - steps: - - uses: actions/checkout@v4 - - name: Run MarkdownSnippets - run: | - dotnet tool install --global MarkdownSnippets.Tool - mdsnippets ${GITHUB_WORKSPACE} \ - --convention InPlaceOverwrite \ - --exclude-directories 'recipes' \ - --toc-level 5 - shell: bash - - name: Create Pull Request - uses: peter-evans/create-pull-request@v7 - with: - branch: bot/action-doc-toc - commit-message: "[docs] Regenerate tables of contents" - title: "[docs] Regenerate tables of contents" - body: "Automatic update of the documentation TOCs." diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 0000000000000..5e391a2d5e860 --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,63 @@ +# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time. +# +# You can adjust the behavior by modifying this file. +# For more information, see: +# https://github.com/actions/stale +name: Mark stale pull requests + + +on: + schedule: + - cron: '34 6 * * *' + +jobs: + stale: + if: github.repository == 'conan-io/conan-center-index' + + runs-on: ubuntu-latest + permissions: + pull-requests: write + issues: read + + + steps: + - uses: actions/stale@v9 + with: + # Do not make issues as stale + days-before-issue-stale: -1 + # Number of days before stale PRs are closed + days-before-pr-stale: 30 + + + # Do not close issues automatically + days-before-issue-close: -1 + # Idle number of days before closing stale PRs + days-before-pr-close: 30 + + # process older PRs first + ascending: true + + # Labels on PRs exempted from stale + exempt-pr-labels: blocked,infrastructure + + # Label to apply on staled PRs + stale-pr-label: 'stale' + + # Skip issues when having stale state + remove-issue-stale-when-updated: false + ignore-issue-updates: true + + + # Comment on the staled PRs + stale-pr-message: > + This pull request has been automatically marked as stale because it has not had + recent activity. It will be closed if no further activity occurs. Thank you + for your contributions. + + # Comment on the staled PRs while closed + close-pr-message: > + This pull request has been automatically closed because it has not had + recent activity. Thank you for your contributions. + + # Max number of operations per run + operations-per-run: 30 diff --git a/.gitignore b/.gitignore index e9c7fe3589289..366db2f4800f6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,15 @@ # Conan specific **/test_package/build/ +**/test_package/build-*/ **/test_package/test_output/ conan.lock +conanbuildinfo.cmake conanbuildinfo.txt conaninfo.txt graph_info.json build/ +.conanrunner/ +.conanrc # CMake CMakeUserPresets.json diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e3e7f52de2da8..e947909b42988 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -23,7 +23,7 @@ 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 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). +2. Make sure to [request access](docs/adding_packages/README.md#request-access) and be aware there is a [contributor licenses agreement](https://cla-assistant.io/conan-io/conan-center-index). 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 @@ -32,7 +32,7 @@ To contribute follow the next steps: 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 Community works hard to review all the pull requests and provided assistance where need. +The Conan Community works hard to review all the pull requests and provide assistance where need. The [Review Process](docs/review_process.md) is partially automated with the help of @conan-center-index-bot :rocket: ## Issues diff --git a/README.md b/README.md index 516167a9ba258..54cfaefe6c2cc 100644 --- a/README.md +++ b/README.md @@ -7,26 +7,44 @@ Conan Center Index is the source index of recipes of the [ConanCenter](https://c This repository includes a Continuous Integration system that will build automatically the Conan packages for the recipes submitted via [Pull Request](https://github.com/conan-io/conan-center-index/pulls). -### Add ConanCenter remote +### Server Status -ConanCenter remote is configured by default in any Conan client installation. If, for any reason, you need to add it manually, just execute: +The current Conan Center Index CI status can be found on https://status.conan.io/ + +Any maintenance, outage or important event related to the CI will be informed there. + + +### Configure the Conan Center remote + +> [!IMPORTANT] +> The Conan Center remote URL changed for **Conan 2** on November 2024 - the new URL is the default on new installations of Conan since version 2.9.2. +> +> New recipe updates are only published to this remote and are only guaranteed to be compatible with recent versions of Conan 2. +> +> All previously published recipes and packages known to be compatible with Conan 2 are also served by this remote. + +To update an existing Conan 2 installation: ``` -conan remote add conancenter https://center.conan.io +conan remote update conancenter --url https://center2.conan.io ``` +#### Conan Center legacy remote + +The legacy remote at `https://center.conan.io` stopped receiving updates on 4 November 2024 and is frozen and will no longer received updates. +It is kept in this state to avoid breaking any existing Conan 1.x installations. + + ### How to consume recipes Starting to use recipes from this repository is as easy as running one simple command after installing Conan: ``` -conan install name/version@ [-g ] +conan install --require=name/version [-g ] ``` -Of course, we really encourage you to use a `conanfile.txt` or `conanfile.py` -to list all the requirements or your project and install them all together -(Conan will build a single graph and ensure congruency). +For further details, please see the [Conan documentation](https://docs.conan.io/2/tutorial/consuming_packages.html). :warning: It is very important to notice that recipes will evolve over time and, while they are fixing some issues, they might introduce new features and @@ -43,10 +61,8 @@ This is a list of shortcuts to some interesting topics: * :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). * :world_map: There are various community lead initiatives which are outlined in [docs/community_resources.md](docs/community_resources.md). -* :magic_wand: To start preparing your recipes for **Conan 2.0**, please check [docs/v2_migration.md](docs/v2_migration.md). ### Reporting Issues @@ -58,7 +74,7 @@ You can open issues in the [issue tracker](https://github.com/conan-io/conan-cen - Specify the name and version (`zlib/1.2.11`) and any relevant details about the fail configuration: Applied profile, building machine... * :bulb: Request a **new library** to be added: - - Use the `[request]` label to search the library in the issue tracker in case the it was already requested. + - Use the `[request]` label to search the library in the issue tracker in case it was already requested. - If not, use the same `[request]` tag in the title of the issue to help identifying them. - Indicate the name and the version of the library you would like to have in the repository. Also links to the project's website, source download/repository and in general any relevant information that helps creating a recipe for it. diff --git a/docs/CONTRIBUTOR_LICENSE_AGREEMENT.md b/docs/CONTRIBUTOR_LICENSE_AGREEMENT.md deleted file mode 100644 index 39acf20a7aebd..0000000000000 --- a/docs/CONTRIBUTOR_LICENSE_AGREEMENT.md +++ /dev/null @@ -1,23 +0,0 @@ -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 0c06266cf5f35..3305d7c06b030 100644 --- a/docs/README.md +++ b/docs/README.md @@ -13,11 +13,8 @@ When pull requests are merged, the CI will upload the generated packages to the + [Contributing to Conan Center Index](../CONTRIBUTING.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) + + [Bumping versions to existing packages](bump_version.md) + [Review Process](review_process.md) - + [Labels](labels.md) - + [Supported platforms and configurations](supported_platforms_and_configurations.md) + [Consuming Recipes](consuming_recipes.md) :information_source: Learn how to limit the impact of recipe changes + [Community Resources](community_resources.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 index 36cc2c528956c..a4d6c0e3a5b4f 100644 --- a/docs/adding_packages/README.md +++ b/docs/adding_packages/README.md @@ -3,180 +3,94 @@ 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. +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 write a good recipe](#how-to-provide-a-good-recipe) section. You can follow the three steps (:one: :two: :three:) described below! :tada: ## Contents + * [:one: First time contributors](#one-first-time-contributors) + * [:two: Creating a package](#two-creating-a-package) + * [How to write a good recipe](#how-to-provide-a-good-recipe) + * [:three: Submitting a Package](#three-submitting-a-package) + * [The Build Service](#the-build-service) - * [Request access](#request-access) - * [Inactivity and user removal](#inactivity-and-user-removal) - * [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) - * [Test Folders](#test-folders) - * [Test the recipe locally](#test-the-recipe-locally) - * [Hooks](#hooks) - * [Linters](#linters) +## :one: First time contributors -## Request access +When submitting a pull request for the first time, you will be prompted to sign the [CLA](https://cla-assistant.io/conan-io/conan-center-index) for your +code contributions. You can view your signed CLA's by going to and signing in. -: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 community. +## :two: Creating a package -This process helps ConanCenter against spam and malicious code. The process is not not automated on purpose and the requests are generally approved -on a weekly basis. +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. -> **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. +Make sure you have: -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. +* 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. -## Inactivity and user removal +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. -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. -In case you are interested in coming back, please, ask again to be included in the issue [#4](https://github.com/conan-io/conan-center-index/issues/4), the process will be precise like for newcomers. +Quickly, there's a few items to look at: -## Submitting a Package +* 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... -: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. +In ConanCenter, our belief is recipes should always match upstream, in other words, what the original author(s) intended. -The specific steps to add new packages are: +* 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. -* Fork the [conan-center-index](https://github.com/conan-io/conan-center-index) git repository, and then clone it locally. -* Copy a template from [package_templates](../package_templates) folder in the recipes/ folder and rename it to the project name (it should be lower-case). Read templates [documentation](../package_templates/README.md) to find more information. -* 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. +### How to write a good recipe -: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. +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. -### The Build Service +> **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. -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. +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. -> âš ï¸ **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. +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. -- 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. +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) -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. +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! -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@`. +## :three: Submitting a Package -## Recipe files structure +To contribute a package, you can submit a [Pull Request](https://github.com/conan-io/conan-center-index/pulls) to this GitHub +repository . -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. +The specific steps to submitting changes are: -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: +* 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). -``` -. -+-- recipes -| +-- library_name/ -| +-- config.yml -| +-- all/ -| +-- conanfile.py -| +-- conandata.yml -| +-- patches/ -| +-- add-missing-string-header-2.0.0.patch -| +-- test_package/ -| +-- conanfile.py -| +-- CMakeLists.txt -| +-- test_package.cpp -| +-- test_v1_package/ -| +-- conanfile.py -| +-- CMakeLists.txt -``` +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. -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. +## The Build Service -### `config.yml` +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 30 binary packages. -This file lists the versions and the folders where they are located: +> **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. -```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, patch files, 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 export_sources(self): - export_conandata_patches(self) - -def source(self): - files.get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - -def build(self): - files.apply_conandata_patches(self) - [...] -``` - -### 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 targeting -different versions in different folders. For maintenance 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, -... all these files will usually be listed in `exports_sources` 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. - -### Test Folders - -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). - -Learn more about the ConanCenterIndex requirements in the [test packages](test_packages.md) document. - -## Test the recipe locally - -### Hooks - -The system will use the [conan-center hook](https://github.com/conan-io/hooks) to perform some quality checks. These are required for the -the CI to merge any pull request. - -Follow the [Developing Recipes Locally](../developing_recipes_locally.md#installing-the-conancenter-hooks) guide for instructions. - -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 the [troubleshooting](https://docs.conan.io/en/latest/faq/troubleshooting.html) section. - -### Linters - -Linters are always executed by Github actions to validate parts of your recipe, for instance, if it uses migrated Conan tools imports. -All executed linters are documented in [linters.md](../linters.md). -Check the [Developing Recipes](../developing_recipes_locally.md#running-the-python-linters) page for running them locally. +- The CI system will report the build logs in the Checks tab, in the pull-request. +- Linter and Hooks are automatically displayed in the Checks tab as well. diff --git a/docs/adding_packages/build_and_package.md b/docs/adding_packages/build_and_package.md index d243fd84c9ecb..0235be181c3e4 100644 --- a/docs/adding_packages/build_and_package.md +++ b/docs/adding_packages/build_and_package.md @@ -17,29 +17,15 @@ Both methods often use build helpers to build binaries and install them into the ## 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. - -* Except for CMake and a working build toolchain (compiler, linker, archiver, etc.), 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()`. - -* 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). - -* These env vars from profile should be honored and properly propagated to underlying build system during the build: `CC`, `CXX`, `CFLAGS`, `CXXFLAGS`, `LDFLAGS`. +For the `build()` method, the general scope used to build artifacts. Please, read +the official reference to the [build()](https://docs.conan.io/2/reference/conanfile/methods/build.html) method and the +[Build packages: the build() method](https://docs.conan.io/2/tutorial/creating_packages/build_packages.html). ## Package Method -* CMake config files must be removed (they will be generated for consumers by `cmake_find_package`, `cmake_find_package_multi`, or `CMakeDeps` generators). Use `rmdir(self, os.path.join(self.package_folder, "lib", "cmake"))` or `rm(self, "*.cmake", os.path.join(self.package_folder, "lib"))`. - -* pkg-config files must be removed (they will be generated for consumers by `pkg_config` or `PkgConfigDeps` generators). Use `rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))` or `rm(self, "*.pc", os.path.join(self.package_folder, "lib"))`. - -* 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. +The `package()` method is used to copy the artifacts to the `package_folder`. Please, read the official reference to the +[package()](https://docs.conan.io/2/reference/conanfile/methods/package.html) method and the +[Package files: the package() method](https://docs.conan.io/2/tutorial/creating_packages/package_method.html). ## Build System Examples @@ -50,31 +36,28 @@ General patterns about how they can be used for OSS in ConanCenterIndex can be f ### 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). +Also, Conan Docs have a section about [how to package header-only libraries](https://docs.conan.io/2/tutorial/creating_packages/other_types_of_packages/header_only_packages.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. +For cases where a project only offers source files but does not provide a build script, you can add CMake support. +However, it is essential to first contact the upstream maintainers and open a pull request (PR) offering building support. +If your PR is rejected because the author does not want any kind of build script, or if the project is abandoned, Conan Center Index (CCI) will consider accepting your build script based on the effort required to maintain it, as we aim to avoid adding scripts that may require significant ongoing maintenance. +Take a look at [Bzip2](https://github.com/conan-io/conan-center-index/blob/master/recipes/bzip2/all/CMakeLists.txt) as example. ### 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, +The [package_manager](https://docs.conan.io/2/reference/tools/system/package_manager.html#conan-tools-system-package-manager) 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. +As example there is [xorg](https://github.com/conan-io/conan-center-index/blob/master/recipes/xorg/all/conanfile.py). \ No newline at end of file diff --git a/docs/adding_packages/conandata_yml_format.md b/docs/adding_packages/conandata_yml_format.md index 84338094c3568..943af159a6485 100644 --- a/docs/adding_packages/conandata_yml_format.md +++ b/docs/adding_packages/conandata_yml_format.md @@ -1,6 +1,6 @@ # conandata.yml -[conandata.yml](https://docs.conan.io/en/latest/reference/config_files/conandata.yml.html) is a [YAML](https://yaml.org/) +[conandata.yml](https://docs.conan.io/2/tutorial/creating_packages/handle_sources_in_packages.html#using-the-conandata-yml-file) 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. @@ -30,8 +30,7 @@ next sections with more detail: * [portability](#portability) * [conan](#conan) * [bugfix](#bugfix) - * [patch_source](#patch_source) - * [base_path](#base_path) + * [patch_source](#patch_source) ## sources @@ -114,7 +113,7 @@ sources: sha256: "f5d48c4b0d558c5d71e8bf6fcdf135b0943210c1ff91f8191dfc447419a6b12e" ``` -This approach requires a special code within [build](https://docs.conan.io/en/latest/reference/conanfile/methods.html#build) method to handle. +This approach requires a special code within [build](https://docs.conan.io/2/reference/conanfile/methods/build.html) method to handle. ### Sources fields @@ -126,8 +125,9 @@ Usually, `url` has a [https](https://tools.ietf.org/html/rfc2660) scheme, but ot #### 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)). +You may use an [online service](https://hash.online-convert.com/sha256-generator) to compute `sha256` sum for the given file located at `url`. + +If you're using linux you can run `wget -q -O - url | sha256sum` to get the hash which uses the [sha256sum](https://linux.die.net/man/1/sha256sum) command ([windows](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/get-filehash?view=powershell-7.4) you can use PowerShell). ## patches @@ -172,7 +172,7 @@ An example of a full patch description could be: `port to Android: update config #### patch_type -_Required_ +_Recommended_ The `patch_type` field specifies the type of the patch. In ConanCenterIndex we currently accept only several kind of patches: @@ -219,7 +219,6 @@ Usually, the following kind of problems are good candidates for backports: * 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 @@ -235,9 +234,3 @@ _Recommended_ 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 index c420841db7d01..f4b962c9c85e1 100644 --- a/docs/adding_packages/conanfile_attributes.md +++ b/docs/adding_packages/conanfile_attributes.md @@ -6,36 +6,84 @@ 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) - * [License Attribute](#license-attribute) * [Settings](#settings) * [Options](#options) * [Recommended Names](#recommended-names) * [Predefined Options and Known Defaults](#predefined-options-and-known-defaults) * [Options to Avoid](#options-to-avoid) -## Order of methods and attributes +## Attributes -Prefer the following order of documented methods in python code (`conanfile.py`, `test_package/conanfile.py`): +These are a [key feature](https://docs.conan.io/2/reference/conanfile/attributes.html) which allows 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. + +### 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) +* [naming forks](../faqs.md##what-is-the-policy-for-naming-forks) +* [space and symbols](../faqs.md#should-reference-names-use---or-_) + +### Version + +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. + +There are two cases to consider: + +* The library has not had any previous releases/tags. In this case, the version should be of the form + `0.0.0.cci.`. For example, `0.0.0.cci.20240402`. When/if a version of the library is ever released. + this will allow version ranges to properly identify the release as a newer version. +* The library has had previous releases/tags. In this case, the version should be of the form + `...cci.`. For example, `1.2.0.cci.20240402`. + This will allow version ranges to properly identify the release as a newer version. + +In order to create reproducible builds, we also "commit-lock" to the latest commit on that day, so the sources should point +to the commit hash of that day. Otherwise, users would get inconsistent results over time when rebuilding the package. -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: +### License Attribute -- deploy -- test +The license attribute is a mandatory field which provides the legal information that summarizes the contents saved in the package. These follow the +[SPDX license](https://spdx.org/licenses/) as a standard. This is for consumers, in particular in the enterprise sector, that do rely on SDPX compliant identifiers so that they can flag this as a custom license text. -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`. +* If the library has a license that has a SPDX identifier, use the [short Identifiers](https://spdx.dev/ids/). +* If the library has a license text that does not match a SPDX identifier, including custom wording disclaiming copyright or dedicating the words to the ["public domain"](https://fairuse.stanford.edu/overview/public-domain/welcome/), use the [SPDX License Expressions](https://spdx.github.io/spdx-spec/v2-draft/SPDX-license-expressions/), this can follow: + * `LicenseRef-` as a prefix, followed by the name of the library. For example:`LicenseRef-libfoo-public-domain` + * If the license is extracted from a specific document, prepend `DocumentRef--` to the license name. For example: `DocumentRef-README.md-LicenseRef-libfoo-public-domain` +* If the library makes no mention of a license and the terms of use - it **shall not be accepted in ConanCenter** , even if the code is publicly available in GitHub or any other platforms. -## License Attribute +In case the license changes in a new release, the recipe should update the license attribute accordingly: -The mandatory license attribute of each recipe **should** be a [SPDX license](https://spdx.org/licenses/) [short Identifiers](https://spdx.dev/ids/) when applicable. +```python +class LibfooConan(ConanFile): + license = "MIT" -Where the SPDX guidelines do not apply, packages should do the following: + def configure (self): + # INFO: Version < 2.0 the license was MIT, but changed to BSD-3-Clause now. + if Version(self.version) >= "2.0.0": + self.license = "BSD-3-Clause" +``` + +## Order of methods and attributes -- 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 fall 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). +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/2/reference/commands/create.html#methods-execution-order). ## Settings @@ -69,9 +117,9 @@ in this direction. However, there are a couple of options that have a special me 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_ +* enable_ / disable_ +* with_ / without_ +* use_ The actual recipe code then may look like: @@ -94,54 +142,47 @@ Having the same naming conventions for the options helps consumers. It allows us ### 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. +By default recipes should use `*/*:shared=False` with `*/*:fPIC=True`. If supported, `&: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. + This option does not make sense on all the support configurations, so using `implements` is recommended: ```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") + implements = ["auto_shared_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 + Recipes with such options should include the following in their `implements` attribute: ```python - def package_id(self): - if self.options.header_only: - self.info.clear() + implements = ["auto_header_only"] ``` - 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: + Instead, use Conan config [skip_test](https://docs.conan.io/2/reference/config_files/global_conf.html#user-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/2/reference/tools/cmake/cmake.html) and [Meson](https://docs.conan.io/2/reference/tools/meson/meson.html). + + ### Removing from `package_id` - 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). + By default, options are included in the calculation for the `package_id` ([docs](https://docs.conan.io/2/reference/binary_model/package_id.html)). + 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 index ec2c265059824..998e6a22f1648 100644 --- a/docs/adding_packages/dependencies.md +++ b/docs/adding_packages/dependencies.md @@ -5,89 +5,24 @@ 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) + * [Handling Requirement's Options](#handling-requirements-options) * [Adherence to Build Service](#adherence-to-build-service) * [Version Ranges](#version-ranges) + * [Adding Version Ranges](#adding-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 +## 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. +You need to use the [`validate()`](https://docs.conan.io/2/reference/conanfile/methods/validate.html) 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 +accessing the [`options`](https://docs.conan.io/2/reference/conanfile/methods/generate.html#dependencies-interface) field of the dependency. ```py @@ -99,68 +34,6 @@ the dependency. 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 @@ -168,26 +41,54 @@ for consumer, we do impose some limits on Conan features to provide a smoother f > **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. +* [Version ranges](https://docs.conan.io/2/tutorial/versioning/version_ranges.html#range-expressions) are generally not allowed ([see below](https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/dependencies.md#version-ranges) for exemptions). +* Specify explicit [RREV](https://docs.conan.io/2/tutorial/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. +* [`python_requires`](https://docs.conan.io/2/reference/extensions/python_requires.html) 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. +Version ranges are a useful Conan feature, [documentation here](https://docs.conan.io/2/tutorial/versioning/version_ranges.html). +With the introduction of Conan 2.0, we are currently working to allow the use of version ranges and are allowing this for a handful of dependencies. + +Version ranges are being progressively introduced by Conan team maintainers and are being rolled out in phases, and we do not intend +to do it all at once. + +Version ranges for the following dependencies will be accepted in pull requests: + +* OpenSSL: `[>=1.1 <4]` for libraries known to be compatible with OpenSSL 1.x and 3.x +* CMake: `[>3.XX <4]`, where `3.XX` is the minimum version of CMake required by the relevant build scripts. Note that CCI recipes assume 3.15 is installed in the system, so add this +version range only when a requirement for a newer version is needed. +* doxygen: `[>=1.8 <2]` +* Libcurl: `[>=7.78 <9]` +* Zlib: `[>=1.2.11 <2]` +* Libpng: `[>=1.6 <2]` +* Expat: `[>=2.6.2 <3]` +* Libxml2: `[>=2.12.5 <3]` +* Libuv: `[>=1 <2]` +* qt5: `[~5.15]`, if your library depends on qt5, only the 5.15 minor version is allowed +* qt6: `[>=6.x <7]`, where 6.x is the lower bound of your needed qt6 version +* c-ares: `[>=1.27 <2]` +* zstd: `[~1.5]` it's equivalent to `[>=1.5 <1.6]` +* ninja: `[>=1.10.2 <2]` +* meson: `[>=1.2.3 <2]` +* pkgconf: `[>=2.2 <3]` +* xz_utils: `[>=5.4.5 <6]` + +Conan maintainers may introduce this for other dependencies over time. Outside of the cases outlined above, version ranges are not allowed in ConanCenter recipes. + +### Adding Version Ranges + +You might also see version ranges being added in pull requests by Conan maintainers, that +are not in the list above. These are being introduced on a case-by-case basis, and are being rolled out +in phases to ensure that they do not cause problems to users. Note that version ranges can +only be used for libraries and tools that have strong compatibility guarantees - and may not +be suitable in all cases. + +Please do not open PRs that exclusively add version ranges to dependencies, unless they are solving +current conflicts, in which case we welcome them and they will be prioritized. ## 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. +Vendoring in library source code should be removed (in a best effort basis) 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..4e9d94ec5889a --- /dev/null +++ b/docs/adding_packages/folders_and_files.md @@ -0,0 +1,119 @@ +# 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) + * [`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: + +```txt +. ++-- recipes +| +-- library_name/ +| +-- config.yml +| +-- all/ +| +-- conanfile.py +| +-- conandata.yml +| +-- patches/ +| +-- 2.1.0-0001-add-missing-string-header-.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 Conandata is officially documented in [using the conandata.yml](https://docs.conan.io/2/tutorial/creating_packages/handle_sources_in_packages.html#using-the-conandata-yml-file). + +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 through the [self.conan_data](https://docs.conan.io/2/reference/conanfile/attributes.html#conan-data) attribute. + +#### `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/2/tutorial/creating_packages/test_conan_packages.html#testing-conan-packages). + +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 + +When providing a test package, please: + +* Create a minimal usage for the target project here +* Avoid upstream full examples, or code bigger than 15 lines +* Avoid networking connections +* Avoid background apps or servers +* Avoid GUI apps +* Avoid extra files like images, sounds and other binaries +* The propose is testing the generated artifacts ONLY + +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 index 5032bc50a5949..a57c7355f6978 100644 --- a/docs/adding_packages/sources_and_patches.md +++ b/docs/adding_packages/sources_and_patches.md @@ -14,10 +14,7 @@ These are a very important aspects and it helps us to establish the quality of t * [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) + * [Policy on patches](#policy-on-patches) ## Picking the Sources @@ -33,9 +30,8 @@ Where ever possible, downloading source files and compiling is mandated. Downloa 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. +The sources stored under `self.source_folder` should not apply patches or modifications in the `source()` method conditional to options or settings. +Patches should be applied in the `source()` method - taking special care that the patches are platform agnostic. Patches in the `build()` method can be considered where this is not possible, provided that `no_copy_source` is **not** set to `True`. ### Sources not accessible @@ -53,7 +49,9 @@ as a system recipe (`/system`) and making those binaries availabl 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: +We welcome the latest release version for its new features and improvements. However, we recommend exercising caution with fresh releases, as upstream may soon release patches or hotfixes to address any unforeseen issues. We usually wait until releases are a few days old to merge them. + +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). @@ -62,18 +60,20 @@ more chances of failing because of unexpected errors). 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) +* for the latest major release, at least two versions should be available (latest two 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. +Removed versions should not affect other recipes available in the repository. If a recipe depends on a removed version, it should be updated to +depend on the latest available version. + 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). +We usually don't add old versions unless there is a specific and well-motivated request for it. Adding versions that are not actively used by the 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). @@ -87,8 +87,7 @@ reading the changelog of the library, the documentation, or any statement by the 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). +file and exported together with the recipe. Patches should include the required [patch fields](conandata_yml_format.md#patches-fields). Patches must be located in the recipe folder in a `patches/` sub-directory. @@ -101,99 +100,14 @@ There are a few recommendations about naming patches: 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. + +### Policy on patches + +Conan Center is a package repository, and the aim of the service is to provide the recipes to build libraries from the sources as provided by the library authors, and to provide binaries for Conan Center’s supported platforms and configurations. + +In general, patches to source code should be avoided and only done as a last resort. In situations where it is strictly necessary, the aim should be that the patches could be eventually merged upstream so that in the future they are no longer necessary. + +Pull Requests that introduce patches will be carefully reviewed by the Conan Team. We recognize that in some instances, patches are necessary in the build system/build scripts. +Patches that affect C and C++ code are strongly discouraged and will only be accepted at the discretion of the Conan Team, after a strict validation process. Patches are more likely to be accepted if they are first reported and acknowledged by the library authors. + +For scenarios that require patching source code, we greatly encourage raising a new issue explaining the need and motivation, reproducible steps and complete logs, behind the patch. Please note that for issues that strictly affect C and C++ source code, it is very unlikely that a patch will be accepted if an issue is not first raised with the original library authors, or if the patches are not addressing a known security advisory. diff --git a/docs/adding_packages/test_packages.md b/docs/adding_packages/test_packages.md deleted file mode 100644 index c37f824816aba..0000000000000 --- a/docs/adding_packages/test_packages.md +++ /dev/null @@ -1,111 +0,0 @@ -# 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/bump_version.md b/docs/bump_version.md new file mode 100644 index 0000000000000..895576989afa9 --- /dev/null +++ b/docs/bump_version.md @@ -0,0 +1,47 @@ +# How to bump a package version for an existing recipe in ConanCenterIndex? + +Once a recipe is approved and merged to ConanCenterIndex, it may need to be updated with new versions released by the upstream. +When someone needs a new package version that is not available in ConanCenterIndex, that person can open an issue [resquesting a new version](https://github.com/conan-io/conan-center-index/issues/new?assignees=&labels=upstream+update&template=package_upstream_update.yml&title=%5Brequest%5D+%3CLIBRARY-NAME%3E%2F%3CLIBRARY-VERSION%3E). +Or, by opening a pull request changing and adding that needed version, this is called a `bump version`. +The [build service](adding_packages/README.md#the-build-service) bumping process is limited to pull requests which **only** adds a new package version and nothing more. Removing older versions, or updating +the recipe will disqualify a pull request from the `Bump version` [review process](review_process.md) + +## Choosing which version should be updated + +The first step is checking the version which should be added from the upstream. Please, avoid adding multiple versions which you do not +need. Adding a new version will increase the building time and storage for each new package configuration. + +Once you detect which version should be updated, please, first check if the project `license` keeps the same. + +> In case you need to update attributes, dependencies versions, patches, or anything besides the package version in `conandata.yml` and `config.yml`, + then your pull request will not be classified as bump version. + +## What should be modified when bumping a version? + +Only the `config.yml` and `conandata.yml` should be updated with that new version: + +```yaml +# config.yml +versions: + "1.1.0": <-- New version added. It should be protected by quotes + folder: all <-- Folder name where conandata.yml is installed + "1.0.0": + folder: all +``` + +```yaml +# all/conandata.yml +sources: + "1.1.0": <-- New version added + url: "https://example.com/repo/exameple-1.1.0.tar.gz" + sha256: "b3a24de97a8fdbc835b9833169501030b8977031bcb54b3b3ac13740f846ab30" + "1.0.0": + url: "https://example.com/repo/exameple-1.0.0.tar.gz" + sha256: "91844808532e5ce316b3c010929493c0244f3d37593afd6de04f71821d5136d9" +``` + +In case a patch should be re-used, it should be present in `conandata.yml` to the specific version as well. + +## Reviewing and merging + +Bumping version PRs follow the same regular [review process](review_process.md). \ No newline at end of file diff --git a/docs/changelog.md b/docs/changelog.md index 6fbd36cb107fb..6ee15d19c592c 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,5 +1,239 @@ # Changelog +### 04-Nov-2024 - 09:15 CET + +- [feature] Conan 1.x end of support and Conan 2.x as default version in the CI +- [feature] New CI infrastructure for Conan 2.x only + +### 12-Sep-2024 - 09:23 CEST + +- [feature] Add support for Conan 2.7.1 in the CI +- [feature] Add support for Conan 1.65.0 in the CI + +### 10-Jul-2024 - 13:22 CEST + +- [feature] Add support for Conan 2.5.0 in the CI +- [fix] Invalid configuration from tool requirement in Conan 1.x + +### 22-May-2024 - 12:04 CEST + +- [feature] Add support for Conan 2.3.1 in the CI +- [feature] Add support for Conan 1.64.1 in the CI + +### 03-April-2024 - 13:53 CEST + +- [feature] Add support for Conan 2.2.2 in the CI +- [feature] Add support for Conan 1.63.0 in the CI + +### 20-March-2024 - 11:13 CET + +- [fix] Changing Version Ranges in dependencies is now bump dependencies +- [fix] Static library package type should be built with both all static and all shared dependencies + +### 13-March-2024 - 11:08 CET + +- [feature] Build with both */*:shared=True/False option when package type is declared as ``shared-library``. +- [fix] Fix ValidateInfra python version check to be aligned with the latest Jenkins version. + +### 07-February-2024 - 15:43 CET + +- [feature] Add waiting list for new collaborators that are not found in access request issue. +- [feature] Skip building bump dependencies PRs by default. It will require manual CI trigger. + +### 24-January-2024 - 12:13 CET + +- [feature] Update Conan 1.x branch to version 1.62.0 +- [feature] Update Conan 2.x branch to version 2.0.16 +- [feature] Require review from maintainers for Bump version and Bump requirements +- [fix] Show header-only option in the build CI summary table +- [fix] Use build/host profile conf also in test package +- [fix] Use only string to handle Github labels + +### 05-December-2023 - 16:23 CET + +- [fix] Use the correct profile to test a tool_require. +- [feature] Add armv8 extra flag in profile arch when building in Macos M1. +- [fix] Prioritization of non-shared builds. +- [fix] Do not raise an exception in case slack fails. +- [fix] Remove epochs. +- [fix] Remove some dead code. + +### 26-Oct-2023 - 12:13 CEST + +- [feature] Allow X.Y semver for version bumps +- [feature] Add assert message for parent commit checks on PR checkout +- [feature] JobRelauncher restarts both Conan v1 and v2 pipelines. +- [fix] Do not close the report issue of the recipe export check + +### 11-Oct-2023 - 12:17 CEST + +- [feature] Update Conan 2.x to the version 2.0.12 in the CI +- [feature] Update Conan 1.x to the version 1.61.0 in the CI + +### 06-Oct-2023 - 10:15 CEST + +- [feature] Label PRs with version conflict properly +- [feature] Add motivation message when under maintenance +- [feature] Wait for sibling job in master right before promote +- [fix] No longer run Conan v2 export step +- [fix] Ensure build order follows only static first +- [fix] Disable quiet period for all jobs except CCI multibranch + +### 25-Sep-2023 - 14:33 CEST + +- [feature] Label PRs that have missing dependencies. +- [feature] Remove check regression for Conan v2 pipeline. +- [feature] Start deprecating epochs support in profile configurations. +- [fix] Run TapaholesRepo job only once per week. +- [fix] Run ListPackages job only once per week. + +### 01-Sep-2023 - 19:58 CEST + +- [fix] Use Unix separators for Windows folder path when creating CI workspace. + +### 31-August-2023 - 12:57 CEST + +- [feature] Support specific PR number for Automatic Merge. +- [feature] Use temporary folder for build workspace. +- [fix] Rename BuildSingleReference folder to bsr to overcome Windows long path. +- [fix] Remove graph info from logs to avoid long loading. +- [fix] Remove deprecated search index for Conan Center. + +### 17-August-2023 - 11:42 CEST + +- [fix] Fix type error when catching generic exceptions in Jenkins +- [fix] Bump dependencies no longer allow version range +- [feature] Show recipe revision on the pull-request summary table + +### 04-August-2023 - 10:26 CEST + +- [feature] Enable Conan 2.0.8 +- [feature] Enable Conan 1.60.2 +- [feature] Update Jenkins server version +- [hotfix] Better error management when having CI build timeout + +### 19-July-2023 - 09:45 CEST + +- [fix] Fix message processing if no message is passed. +- [fix] Fix automatic merge priority to follow the correct PR order. +- [fix] Waiting for Conan 2.x result after building Conan 1.x. +- [fix] Bump version should not be tagged when removing old versions. +- [feature] Improve internal logs to get more information about epochs. +- [feature] Add an option to disable some jobs. +- [feature] Disable branch indexing job runs on cci multibranch job. +- [feature] Enable Conan 2.0.8 + +### 04-May-2023 - 16:05 CEST + +- [bugfix] Fix cppstd issues when selecting the value to use in profiles. +- [feature] Add support for raising `InvalidConfiguration` in `validate_build()` method in recipes. +- [feature] Update library requirements for Conan client 2.0.4 +- [feature] Inform users when Conan v2 CI build is mandatory for merging. +- [feature] Implement different "under maintenance" levels: OFF, MINOR, MAJOR, CRITICAL. +- [feature] ValidateInfrastrucure: Check Artifactory repos exist. +- [feature] Move variables to new folder properties approach. + +### 12-April-2023 - 16:18 CEST + +- [feature] Add ListPackages job the posibility to update a list via PR +- [feature] Add c3i-conan2-ready label when modifying .c3i/conan_v2_ready_references.yml +- [hotfix] Use Conan helpers to update Conan Center page +- [hotfix] Automatic Merge reduces the number of requests for each execution + +### 03-April-2023 - 10:26 CEST + +- [fix] Remove options usage from build profile. +- [fix] Fix promotion of recipe/packages when artifacts already exist in target repo. +- [feature] Make master branch promotion job wait for sibling jobs (to avoid recipe promotion race condition). +- [feature] Improve request of reviews and remove timeout. + +### 24-March-2023 - 12:00 CET + +- [feature] Install Conan command extensions for Conan v2 +- [feature] Reduce Github requests number to execute Automatic Merge CI job +- [hotfix] Improve Promote Package CI job logging for better debug + +### 10-March-2023 - 19:55 CET + +- [feature] Add priority to pull requests +- [hotfix] Avoid extra http requests to run automatic merge faster + +### 10-March-2023 - 13:15 CET + +- [hotfix] No longer update conan_v2_ready_references.yml automatically +- [bugfix] Validate Green and clean PRs first when executing automatic merge CI job + +### 07-March-2023 - 17:05 CET + +- [hotfix] Automatic merge skips git conflicts +- [hotfix] config label for "v2 ready" depends on PR author + +### 03-March-2023 - 11:05 CET + +- [feature] Update ready_v2_references.yml file automatically +- [fix] Do not reuse the same build folder to avoid busy files + +### 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`). diff --git a/docs/community_resources.md b/docs/community_resources.md index 265ae610b3327..f2806f9377afb 100644 --- a/docs/community_resources.md +++ b/docs/community_resources.md @@ -6,8 +6,7 @@ This is a curated list of various bots and helpful tools that aim to making appr ## Contents * [Social Media and More](#social-media-and-more) - * [Bots](#bots) - * [Tools](#tools) + * [Bots](#bots) ## Social Media and More @@ -19,18 +18,6 @@ If you are looking to stay up to date with the last Conan news, follow us on Twi - [Updatable Recipes](https://github.com/qchateau/conan-center-bot): Automatically scans available recipes and checked for new upstream releases and tests one configuration - The results can be found here: https://qchateau.github.io/conan-center-bot/#/updatable -- [Conflicting Pull Requests](https://github.com/ericLemanissier/conan-center-conflicting-prs): Checks all the open pull requests for those which edit the same -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/ - [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/ - -## Tools - -- [FreeBSD Testing](https://github.com/ericLemanissier/conan-center-index/tree/freebsd): Detects pull requests with `FreeBSD` in the description and runs a test for -one configuration on that platform - - The results can be found here: https://github.com/ericLemanissier/conan-center-index/actions?query=workflow%3ACI -- [Bincrafters Conventions](https://github.com/bincrafters/bincrafters-conventions): Automatically updates Conan recipes to the latest conventions and rules diff --git a/docs/consuming_recipes.md b/docs/consuming_recipes.md index ee80883fc7130..b898282302020 100644 --- a/docs/consuming_recipes.md +++ b/docs/consuming_recipes.md @@ -23,15 +23,14 @@ There can be several causes if a recipe (a new revision) might stopped to work i If your Conan client is not new enough, Conan will fail to parse the recipe and will raise a cryptic Python syntax error. -- **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 Conan Version**: Conan keeps evolving and adding new features, and ConanCenter is committed in this + 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. -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. +This use case is covered by the [`required_conan_version`](https://docs.conan.io/2/reference/conanfile/attributes.html#required-conan-version) feature. +It will substitute the syntax error by one nicer error provided by Conan client. 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). @@ -44,23 +43,19 @@ Conan is very flexible; you can add your own remote or modify your client’s co Here are a few choices: -- [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 +- [Cache recipes in your own ArtifactoryCE](https://docs.conan.io/2/devops/devops_local_recipes_index.html) - recommended for production environments 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 +[cloud provided solution](https://jfrog.com/start-free) for **trial**. +Your project should [use only this remote](https://docs.conan.io/2/reference/commands/remote.html#conan-remote-add) and new recipe revisions are only pushed to your Artifactory after they have been validated in your project. -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: +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 the following: -- [recipe revision (RREV)](https://docs.conan.io/en/latest/versioning/revisions.html) can be added to each requirement. +- [recipe revision (RREV)](https://docs.conan.io/2/tutorial/versioning/revisions.html#using-revisions) 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. - -> **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. +- [Lockfiles](https://docs.conan.io/2/tutorial/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/2/tutorial/consuming_packages/intro_to_versioning.html#lockfiles) for more information. 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 index a9af9f6502351..3a028a8c6ff61 100644 --- a/docs/developing_recipes_locally.md +++ b/docs/developing_recipes_locally.md @@ -2,15 +2,13 @@ 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. +This file is intended to provide all the commands you need to run in order to be an expert ConanCenterIndex 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) @@ -20,9 +18,7 @@ This file is intended to provide all the commands you need to run in order to be * [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) + * [Docker build images used by ConanCenterIndex](#docker-build-images-used-by-conancenterindex) ## Clone your fork @@ -32,51 +28,21 @@ This file is intended to provide all the commands you need to run in order to be ## 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! +2. [Install the Conan client](https://docs.conan.io/2/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` +The [entire workflow of a recipe](https://docs.conan.io/2/tutorial/creating_packages.html) can be executed with the [`conan create`](https://docs.conan.io/2/reference/commands/create.html). This should look like: -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. +* `conan create all/conanfile.py --version=0.1.0` ### Try it yourself @@ -84,110 +50,29 @@ For instance you can create packages for `fmt` in various supported configuratio ```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 +conan create all/conanfile.py --version=9.0.0 +conan create all/conanfile.py --version=9.0.0 -o "&:header_only=True" +conan create all/conanfile.py --version=9.0.0 -s build_type=Debug -o "*/*:shared=True" ``` ## 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. +Some common errors related to Conan can be found on [troubleshooting](https://docs.conan.io/2/knowledge/faq.html#troubleshooting) section. -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/fmt/all/conanfile.py - - # Lint the test_package (same command) - yamllint --config-file linter/yamllint_rules.yml -f standard recipes/fmt/all/test_package/conanfile.py - ``` - -### Yamlschema +[patch policy](adding_packages/sources_and_patches.md#policy-about-patching). You are encouraged first to submit pull requests upstream. -* (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` +## Testing 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 +conan test recipes/fmt/all/test_package/conanfile.py fmt/9.0.0 ``` ## Testing more environments @@ -202,73 +87,12 @@ Assuming you've already tested it locally and it's been successfully exported to * 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" -``` +Please, read [how to create Conan package using a Docker runner](https://docs.conan.io/2/examples/runners/docker/basic.html). > **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 +#### Docker build images used by ConanCenterIndex -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 -``` +The Conan Center Index uses [Conan Docker Tools](https://github.com/conan-io/conan-docker-tools/) to build packages in a variety of environments. All images are hosted in [Docker Hub](https://hub.docker.com/u/conanio). \ No newline at end of file diff --git a/docs/error_knowledge_base.md b/docs/error_knowledge_base.md deleted file mode 100644 index 655573acf72d8..0000000000000 --- a/docs/error_knowledge_base.md +++ /dev/null @@ -1,489 +0,0 @@ -# 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`. - -#### **#KB-H002: "REFERENCE LOWERCASE"** - -The package names in conan-center have to be [lowercase](https://github.com/conan-io/tribe/blob/main/design/017-lowercase-references.md). e.g: ``zlib/1.2.8``. - -#### **#KB-H003: "RECIPE METADATA"** - -The recipe has to declare the following attributes: - -- [url](https://docs.conan.io/en/latest/reference/conanfile/attributes.html#url) -- [license](https://docs.conan.io/en/latest/reference/conanfile/attributes.html#license) -- [description](https://docs.conan.io/en/latest/reference/conanfile/attributes.html#description) -- [homepage](https://docs.conan.io/en/latest/reference/conanfile/attributes.html#homepage). - -Also we recommend adding [topics](https://docs.conan.io/en/latest/reference/conanfile/attributes.html#topics) attribute. - -#### **#KB-H005: "HEADER_ONLY, NO COPY SOURCE"** - -If the recipe calls [self.info.header_only()](https://docs.conan.io/en/latest/howtos/header_only.html) in the [package_id()](https://docs.conan.io/en/latest/reference/conanfile/methods.html#package-id) method and doesn't declare settings, it should use the [no_copy_source](https://docs.conan.io/en/latest/reference/conanfile/attributes.html#no-copy-source) attribute to avoid unnecessary copies of the source code. - -#### **#KB-H006: "FPIC OPTION"** - -The recipe is not for a header-only library and should have an `fPIC` option: - -```python -class SomeRecipe(ConanFile): - ... - - options = {"fPIC": [True, False]} - default_options = {"fPIC": True} -``` - -#### **#KB-H007: "FPIC MANAGEMENT"** - -The recipe declares `fPIC` but doesn't remove the option for Windows (where it doesn't make sense). - -```python -class SomeRecipe(ConanFile): - ... - - def config_options(self): - if self.settings.os == "Windows": - del self.options.fPIC -``` - -Or, a package is built as `shared` library and `fPIC` is declared. The option `fPIC` should be removed: - -```python -class SomeRecipe(ConanFile): - ... - - def configure(self): - if self.options.shared: - del self.options.fPIC -``` - -Here we use [configure()](https://docs.conan.io/en/latest/reference/conanfile/methods.html#configure-config-options) method, because user options are loaded after [config_options()](https://docs.conan.io/en/latest/reference/conanfile/methods.html#configure-config-options) only. - -#### **#KB-H008: "VERSION RANGES"** - -See [Dependencies Version Ranges](adding_packages/dependencies.md#version-ranges) for details. - -#### **#KB-H009: "RECIPE FOLDER SIZE"** - -The recipe folder (including the `test_package` folder) cannot exceed 256KB. - -#### **#KB-H010: "IMMUTABLE SOURCES"** - -Create a file [conandata.yml](https://docs.conan.io/en/latest/reference/config_files/conandata.yml.html) in the recipe folder containing the source code origins: - -**_recipes/lib/1.2.0/conandata.yml_**: - -```yaml -sources: - 1.2.0: - url: "http://downloads.sourceforge.net/project/mylib/1.2.0/sources.tar.gz" - sha256: "36658cb768a54c1d4dec43c3116c27ed893e88b02ecfcb44f2166f9c0b7f2a0d" -``` - -Then in the recipe, you can access the data to download the URL and validate the checksum doing: - -```python -class SomeRecipe(ConanFile): - ... - - def source(self): - tools.get(**self.conan_data["sources"][self.version]) -``` - -#### **#KB-H011: "LIBCXX MANAGEMENT"** - -If the library is detected as a pure C library (sources doesn't conatain any file with the following extensions: ["cc", "cpp", "cxx", "c++m", "cppm", "cxxm", "h++", "hh", "hxx", "hpp"]) then it has to remove the [compiler.libcxx](https://docs.conan.io/en/latest/reference/config_files/settings.yml.html#c-standard-libraries-aka-compiler-libcxx) subsetting, because the cpp standard library shouldn't affect the binary ID: - -```python -class SomeRecipe(ConanFile): - ... - - def configure(self): - del self.settings.compiler.libcxx -``` - -#### **#KB-H012: "PACKAGE LICENSE"** - -The binary packages should contain a folder named `licenses` containing the contents (library, tool, etc) license/s. - -#### **#KB-H013: "DEFAULT PACKAGE LAYOUT"** - -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"** - -The binary package contains some file that not corresponds to the configuration of the package, for example, binary libraries for a header-only library, a DLL file when the `settings.os != Windows` and so on. The error message will contain information about the offending file. - -#### **#KB-H015: "SHARED ARTIFACTS"** - -The binary package is shared (self.options.shared == True) but there is no `dll`, `so` or `dylib` files inside the package. - -#### **#KB-H016: "CMAKE-MODULES-CONFIG-FILES"** - -The binary package cannot contain module or config CMake files ("Find\*.cmake", "\*Config.cmake", "\*-config.cmake"). -The package shouldn't contain specific build-system files to inform to the consumers how to link with it. -In order to make sure that the package will be consumed with any build-system, conan-center repository encourages to declare a [def package_info(self)](https://docs.conan.io/en/latest/reference/conanfile/methods.html#package-info) method with all the needed information about the package. - -The consumers of the package will be able to consume the packages using a specific [generators](https://docs.conan.io/en/latest/using_packages/conanfile_txt.html#generators) for the build system they use. - -See also: [Why are CMake find/config files and pkg-config files not packaged?](faqs.md#why-are-cmake-findconfig-files-and-pkg-config-files-not-packaged). - -#### **#KB-H017: "PDB FILES NOT ALLOWED"** - -Because of the big size of the [PDB](https://github.com/Microsoft/microsoft-pdb) files (Program Databse, a debug information format) and the issues using them changing the original folders, the PDB files are not allowed to be packaged. - -See also: [Why PDB files are not allowed?](faqs.md#why-pdb-files-are-not-allowed). - -#### **#KB-H018: "LIBTOOL FILES PRESENCE"** - -Packaging [libtool files](https://www.linuxfromscratch.org/blfs/view/svn/introduction/la-files.html) (\*.la) instead of library files (\*.a) is not allowed. - -#### **#KB-H019: "CMAKE FILE NOT IN BUILD FOLDERS"** - -Some file with `*.cmake` extension has been found in a folder not declared in [cpp_info.builddirs](https://docs.conan.io/en/latest/reference/conanfile/attributes.html#cpp-info). -It is only allowed to put build files in `builddirs` because the generators might be able to include them when needed, but only if they are located in well known paths. - -#### **#KB-H020: "PC-FILES"** - -For the same reasons explained at [KB-H016](#KB-H016) it is not allowed to package `*.pc` files. - -See also: [Why are CMake find/config files and pkg-config files not packaged?](faqs.md#why-are-cmake-findconfig-files-and-pkg-config-files-not-packaged). - -#### **#KB-H021: "MS RUNTIME FILES"** - -For the legal reasons, and in order to reduce the size of packages, it's not allowed to package Microsoft Visual Studio runtime libraries, such as `msvcr80.dll`, `msvcp80.dll`, `vcruntime140.dll` and so on. - -#### **#KB-H022: "CPPSTD MANAGEMENT"** - -If the library is detected as a pure C library (sources doesn't conatain any file with the following extensions: ["cc", "cpp", "cxx", "c++m", "cppm", "cxxm", "h++", "hh", "hxx", "hpp"]) then it has to remove the [compiler.cppstd](https://docs.conan.io/en/latest/howtos/manage_cpp_standard.html) subsetting, because the cpp standard library shouldn't affect the binary ID: - -```python -class SomeRecipe(ConanFile): - ... - - def configure(self): - del self.settings.compiler.cppstd -``` - -#### **#KB-H023: "EXPORT LICENSE"** - -A recipe should not export any license file, as all recipes are under the same license type (in the root of this repo). - -```python -class SomeRecipe(ConanFile): - ... - - exports = "LICENSE.md" # not allowed -``` - -There is a complete explanation in the [FAQ](faqs.md#should-recipes-export-a-recipes-license). - -#### **#KB-H024: "TEST PACKAGE FOLDER"** - -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 -. test_package - |- conanfile.py -``` - -#### **#KB-H025: "META LINES"** - -The following metadata lines (and similiar) are not allowed in recipes: - -- [Shebang](https://en.wikipedia.org/wiki/Shebang_(Unix)) to specify Python version: - -```python -#!/usr/bin/env python # not allowed -#!/usr/local/bin/python # not allowed - -class SomeRecipe(ConanFile): - ... -``` - -- [Vim](https://www.vim.org/) configuration: - -```python -# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 # not allowed - -class SomeRecipe(ConanFile): - ... -``` - -- [Encoding](https://www.python.org/dev/peps/pep-0263/): - -```python -# -*- coding: utf-8 -*- # not allowed -# coding=utf-16 # not allowed - -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 - -#### **#KB-H028: "CMAKE MINIMUM VERSION"** - -All CMake files added to recipe package should contain a [minimal version](https://cmake.org/cmake/help/latest/command/cmake_minimum_required.html) (Not necessarily 2.8.11, it can be any version) available in the file: - -```cmake -# CMakeLists.txt -cmake_minimum_required(VERSION 2.8.11) -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. - -```python -# test_package/conanfile.py -class TestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - - def test(self): - self.run("bin/test", run_environment=True) -``` - -#### **#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](adding_packages/conandata_yml_format.md). - -#### **#KB-H031: "CONANDATA.YML REDUCE"** - -This [hook](https://docs.conan.io/en/latest/extending/hooks.html) re-creates the information of the [conandata.yml](https://docs.conan.io/en/latest/reference/config_files/conandata.yml.html) file, discarding the fields not relevant to the version of the package exported. This avoids creating new recipe revisions for every new change introduced in the file. -Any additional field in the YAML file will raise an error. - -#### **#KB-H032: "SYSTEM REQUIREMENTS"** - -[System requirements](https://docs.conan.io/en/latest/reference/conanfile/methods.html#systempackagetool) can be used as an option when a Conan package is not available ,the same package can be installed by system package manager. However, it can cause reproducibility problems, since the package may vary according the distribution or OS. Conan is not able to track its metadata, so that, installing system packages by recipe is not allowed. - -See also: [Can I install packages from the system package manager?](faqs.md#can-i-install-packages-from-the-system-package-manager). - -#### **#KB-H034: "TEST PACKAGE - NO IMPORTS()"** - -The method [imports](https://docs.conan.io/en/latest/reference/conanfile/methods.html#imports) helps the test package stage copying all dynamic libraries and special resources. However, the [run_environment](https://docs.conan.io/en/latest/reference/conanfile/other.html#running-commands) parameter, used when running commands, is able to solve all paths to the dynamic libraries installed in your cache. - -#### **#KB-H037: "NO AUTHOR"** - -Since the entire community is maintaining all CCI recipes, putting just one name in a recipe is unfair, putting all names is unmanageable. All authors can be found in the Git logs. - -#### **#KB-H040: "NO TARGET NAME"** - -According the Conan issue [#6269](https://github.com/conan-io/conan/issues/6269), the attribute `cpp_info.name` should be avoided for Conan Center Index in favor of `cpp_info.names["cmake_find_package"]` and `cpp_info.names["cmake_find_package_multi"]`. - -See also: [Migrating legacy cpp_info attributes to set_property()](https://docs.conan.io/en/latest/migrating_to_2.0/properties.html). - -#### **#KB-H041: "NO FINAL ENDLINE"** - -Source files should end with a final endline. -This avoids potential warnings/errors like `no new line at the end of file`. - -#### **#KB-H044: "NO REQUIRES.ADD()"** - -Both `self.requires.add()` and `self.build_requires.add()` have been deprecated in favor of [self.requires()](https://docs.conan.io/en/latest/reference/conanfile/methods.html#requirements) and [self.build_requires()](https://docs.conan.io/en/latest/reference/conanfile/methods.html#build-requirements) which were introduced on Conan 1.x. Both `add()` were introduced during Conan 0.x and since Conan 1.23 they no longer follow the original behavior. - -#### **#KB-H045: "DELETE OPTIONS"** - -The method `self.options.remove()` was introduced in Conan 0.x, however, Conan 1.x brings a more pythonic way for removing options from your recipe: `del self.options.` - -See also: [configure(), config_options()](https://docs.conan.io/en/latest/reference/conanfile/methods.html#configure-config-options). - -#### **#KB-H046: "CMAKE VERBOSE MAKEFILE"** - -The CMake definition [CMAKE_VERBOSE_MAKEFILE](https://cmake.org/cmake/help/latest/variable/CMAKE_VERBOSE_MAKEFILE.html) helps for debugging when developing, however, for regular CI build, it increases the log size and it's only required when problems occur and need to be verified. - -#### **#KB-H048: "CMAKE VERSION REQUIRED"** - -The file test_package/CMakeLists.txt should require CMake 3.1 by default: [cmake_minimum_required(VERSION 3.1)](https://cmake.org/cmake/help/latest/command/cmake_minimum_required.html). The CMake wrapper file can require CMake 2.8, because Conan recipe and the test package are totally separated. However, if [CMAKE_CXX_STANDARD](https://cmake.org/cmake/help/latest/variable/CMAKE_CXX_STANDARD.html) or [CXX_STANDARD](https://cmake.org/cmake/help/latest/prop_tgt/CXX_STANDARD.html#prop_tgt:CXX_STANDARD) is explicit, CMake 3.1 is mandatory. - -#### **#KB-H049: "CMAKE WINDOWS EXPORT ALL SYMBOLS"** - -The CMakeLists.txt definitions [CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS](https://cmake.org/cmake/help/v3.4/variable/CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS.html) and [WINDOWS_EXPORT_ALL_SYMBOLS](https://cmake.org/cmake/help/v3.4/prop_tgt/WINDOWS_EXPORT_ALL_SYMBOLS.html) are available since CMake 3.4 only. Any previous version will ignore it. - -#### **#KB-H050: "DEFAULT SHARED OPTION VALUE"** - -By default, all packages should be built as static library (the option ``shared`` is ``False`` in ``default_options``). However, some projects can be restricted to shared library only, for those cases, open a new [issue](https://github.com/conan-io/hooks/issues) to include the package name in the allowlist. - -#### **#KB-H051: "DEFAULT OPTIONS AS DICTIONARY"** - -The attribue [default_options](https://docs.conan.io/en/latest/reference/conanfile/attributes.html#default-options) should be a dictionary, for example `default_options = {'shared': False, 'fPIC': True}`. - -#### **#KB-H052: "CONFIG.YML HAS NEW VERSION"** - -It's important to have new library version defined in both [config.yml](adding_packages/README.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. - -#### **#KB-H053: "PRIVATE IMPORTS"** - -The recipe imports private Conan API, this is strongly discouraged - private imports are subjects to breaking changes. Avoid usage of private APIs, -request to publicly expose needed methods, if necessary. - -#### **#KB-H054: "LIBRARY DOES NOT EXIST"** - -Libraries which are listed on [Components](https://docs.conan.io/en/latest/creating_packages/package_information.html#package-information-components) must be present in [libdirs](https://docs.conan.io/en/latest/reference/conanfile/attributes.html#cpp-info). Check if the library name is correct, or if a library is only generated for a specific platform. - -#### **#KB-H055: "SINGLE REQUIRES"** - -Do not use [requirements()](https://docs.conan.io/en/latest/reference/conanfile/methods.html#requirements) method and [self.requires](https://docs.conan.io/en/latest/reference/conanfile/attributes.html#requires) attribute together in the same recipe. -The duality creates a heterogeneous way of solving dependencies, making it difficult to review and susceptible to prone errors. - -#### **#KB-H056: "LICENSE PUBLIC DOMAIN"** - -See [License Attribute](adding_packages/conanfile_attributes.md#license-attribute) for details. - -#### **#KB-H057: "TOOLS RENAME"** - -The [rename()](https://docs.conan.io/en/latest/reference/conanfile/tools/files.html#conan-tools-rename) method will be the standard for Conan 2.0, and -also, it uses [robocopy](https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/robocopy), which is safer on Windows. - -#### **#KB-H058: "ILLEGAL CHARACTERS"** - -Windows [naming conventions](https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#naming-conventions) and [reserved](https://en.wikipedia.org/wiki/Filename#Reserved_characters_and_words) characters must be avoided for file naming, otherwise the will not be supported on Windows. - -#### **#KB-H059: "CLASS NAME"** - -Generic class names can cause review confusion. To keep a better naming, it should use `Conan`. - -#### **#KB-H060: "NO CRLF"** - -Files with [CRLF](https://en.wikipedia.org/wiki/Newline) as endline can cause CI errors when building a package, due the conversion to LF and false detection from CI as changed file. -The [.gitattributes](https://git-scm.com/docs/gitattributes) file lists which files should be converted to LF when commit. However, if you want to enforce it in your local copy, you may run: - - > git config --local core.autocrlf false - > git config --local core.eol lf - -The [core.autocrlf](https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration) disabled means that git will not convert from CRLF to LF on commit. The [core.eol](https://git-scm.com/docs/git-config) sets the specific line ending to be used for every commit. - -#### **#KB-H062: "TOOLS CROSS BUILDING"** - -Replace all occurrences of `tools.cross_building(self.settings)` with [tools.cross_building(self)](https://docs.conan.io/en/latest/reference/tools.html#tools-cross-building). -When cross building, conan needs to compare [self.settings](https://docs.conan.io/en/latest/reference/conanfile/attributes.html#settings) and [self.settings_build](https://docs.conan.io/en/latest/systems_cross_building/cross_building.html), which are attributes of `self`. - -#### **#KB-H064: "INVALID TOPICS"** - -An invalid [topic](https://docs.conan.io/en/latest/reference/conanfile/attributes.html#topics) has been detected. Remove or rename it. -Right now, topic `conan` is considered redundant and it's not needed to explicitly list it within recipe. - -#### **#KB-H065: "NO REQUIRED_CONAN_VERSION"** - -The recipe misses [required_conan_version](https://docs.conan.io/en/latest/reference/conanfile/other.html#requiring-a-conan-version-for-the-recipe) attribute. -It may happen due to the usage of new features within recipe (such as `strip_root` parameter of the [tools.get](https://docs.conan.io/en/latest/reference/conanfile/tools/files/downloads.html#conan-tools-files-get) helper). -The policy of Conan Center Index to support only the latest version of the Conan Client, so it's safe to put the version Conan Center Index currently runs into the recipe. -Otherwise, it's not an easy task on its own to determine the minimal version that has to be specified: checking the Conan Client [Changelog](https://docs.conan.io/en/latest/changelog.html), one has to know in which Conan Client releases all the attributes, methods, build helpers, etc. used by the recipe were first introduced, and then select the most recent of them. -Consider adding the following code: - -```python -required_conan_version = ">=1.43.0" # use the version that Conan Center Index runs - -class SomeRecipe(ConanFile): - ... - -``` - -See also: [Submitting a Package](adding_packages/README.md#submitting-a-package). - -#### **#KB-H066: "SHORT_PATHS USAGE"** - -The recipe missess [short_paths](https://docs.conan.io/en/latest/reference/conanfile/attributes.html#short-paths) attribute. -It may happen due to the very long paths within source, build or package directories during the package creating. -Consider adding the following code: - -```python -class SomeRecipe(ConanFile): - ... - - short_paths = True -``` - -See also: [Maximum Path Length Limitation](https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=cmd). - -#### **#KB-H068: "TEST_TYPE MANAGEMENT"** - -In Conan 2.0, see [migration guide](https://docs.conan.io/en/latest/migrating_to_2.0/recipes.html#changes-in-the-test-package-recipe), -the `test_package/conanfile.py` needs to declare the requirement being tested explicitly. To be prepared you -have to set the attribute `test_type="explicit"` (this will be ignored in 2.0) to make Conan activate the explicit -mode, then declaring the requirement using the `self.tested_reference_str` that contains the reference being tested. - -#### **#KB-H069: "TEST PACKAGE - NO DEFAULT OPTIONS"** - -This is to ensure the exact package that is built and uploaded is tested against. When `options` of `default_options` are modified in a -`test_package` it can possibly result in the graph being modified. The objective is to enforce quality of the packages and to avoid confusing -"missing packages" errors. - -#### **#KB-H070: "MANDATORY SETTINGS"** - -> :information_source: This rule was put in place as it was deemed safe for evaluation however there is room for improvement - -ConanCenter operates is profiles with a predefined list of settings, all of these much be present in the recipe to ensure `package_id`s are -computed correctly. Some libraries, for instance header-only, do not require all the settings and those should be deleted from the `package_id`. -This approach ensure consistency and reduces the learning curve. - -Recipes should include: - -```python -class SomeRecipe(ConanFile): - ... - - settings = "os", "compiler", "build_type", "arch" -``` - -- For header-only recipes ([example](https://github.com/conan-io/conan-center-index/blob/3a773e2d69ada3bd931252c43a48daf636ddfe87/recipes/eigen/all/conanfile.py#L35-L36)): - - ```python - def package_id(self): - self.info.header_only() - ``` - -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. - -- @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): - del self.info.settings.compiler - ``` - -#### **#KB-H071: "INCLUDE PATH DOES NOT EXIST"** - -It's erroneous to leave the default `include` directory when it's not present. Consider adding: - -```python -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. - -## Deprecated errors - -The following errors from the hooks are deprecated and no longer reported: - -### **#KB-H047: "NO ASCII CHARACTERS"** - -According to PEP [263](https://www.python.org/dev/peps/pep-0263/), Unicode literals should only appear in Python code if the encoding is declared on one of the first two lines of the source file. Without such a declaration, any Unicode literal will cause a syntax error for Python 2 interpreters. diff --git a/docs/faqs.md b/docs/faqs.md index 6b255f700113e..d9f87971f7113 100644 --- a/docs/faqs.md +++ b/docs/faqs.md @@ -6,10 +6,10 @@ This section gathers the most common questions from the community related to pac ## Contents * [What is the policy on recipe name collisions?](#what-is-the-policy-on-recipe-name-collisions) + * [What is the policy for naming forks?](#what-is-the-policy-for-naming-forks) * [What is the policy on creating packages from pre-compiled binaries?](#what-is-the-policy-on-creating-packages-from-pre-compiled-binaries) * [Should reference names use `-` or `_`?](#should-reference-names-use---or-_) * [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) @@ -23,10 +23,10 @@ This section gathers the most common questions from the community related to pac * [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) + * [Should recipes export a recipe's license?](#should-recipes-export-a-recipes-license) * [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) * [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) @@ -35,13 +35,12 @@ This section gathers the most common questions from the community related to pac * [What is the policy for supported python versions?](#what-is-the-policy-for-supported-python-versions) * [How to package libraries that depend on proprietary closed-source libraries?](#how-to-package-libraries-that-depend-on-proprietary-closed-source-libraries) * [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) + * [What's the policy on version ranges?](#whats-the-policy-on-version-ranges) * [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) - * [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 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? @@ -53,6 +52,15 @@ However, if it is not possible and there is the case of a new recipe producing a For example, `GSL` is the name of `Guidelines Support Library` from Microsoft and `GNU Scientific Library` from GNU. Both libraries are commonly known as `gsl`, however, to disambiguate (if there is already a `gsl` package in this repo) we could use `ms-gsl` in the first case or `gnu-gsl` in the second. +## What is the policy for naming forks? + +When submitting recipes, it's important to pick names which clearly identify the source. For projects which are forks of existing but diverge significantly enough +to be unique (subject to opinion), they should be prefixed with the author or organization such as `author-name`. A good example is the [crow](https://github.com/ipkn/crow) +which was forked [crowcpp-crow](https://github.com/CrowCpp/Crow). The original project maintains the `crow` name where as the more featured and advanced fork is `crowcpp-crow`. + +Forks are acceptable submissions given they have significantly divergent from the upstream. This can include adding new features, updating compiler or standard support, and actively being maintained. Changes which are not sufficient are build scripts, small bug fixes, "conan-ization" - all of these can be +[applied as patches to the original](adding_packages/sources_and_patches.md). + ## 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](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. @@ -71,7 +79,7 @@ For libraries with a too generic name, like `variant`, the name of the organizat We know that using `find_package()` and relying on the CMake behavior to find the dependencies is something that should be avoided in favor of the information provided by the package manager. -Conan has an abstraction over the packages build system and description by using [generators](https://docs.conan.io/en/latest/reference/generators.html). Those generators translate the information of the dependency graph and create a suitable file that can be consumed by your build system. +Conan has an abstraction over the packages build system and description by using generators. Those generators translate the information of the dependency graph and create a suitable file that can be consumed by your build system. 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: @@ -81,27 +89,21 @@ In the past, we have found that the logic of some of the CMake's find/config or - Hardcoded versions of dependencies as well as build options that make overriding dependencies from the consumer not possible. We believe that the package manager should be the one responsible to handle this information in order to achieve a deterministic and controlled behavior. -Regarding the integration with CMake, Conan already provides ways to consume those packages in the same way by using generators like [cmake_find_package](https://docs.conan.io/en/latest/reference/generators/cmake_find_package.html)* or [cmake_find_package_multi](https://docs.conan.io/en/latest/reference/generators/cmake_find_package.html) and features like [components](https://docs.conan.io/en/latest/creating_packages/package_information.html#using-components) to define internal libraries of a package and generate proper CMake targets or [build_modules](https://docs.conan.io/en/latest/reference/conanfile/attributes.html) to package build system utilities like CMake macros. +Regarding the integration with CMake, Conan already provides ways to consume those packages in the same way by using generators like [CmakeDeps](https://docs.conan.io/2/reference/tools/cmake/cmakedeps.html) to define internal libraries of a package and generate proper CMake targets or [cmake_build_modules](https://docs.conan.io/2/examples/graph/tool_requires/use_cmake_modules.html) to package build system utilities like CMake macros. -Defining the package information in the recipe is also useful in order to consume those packages from a different build system, for example using pkg-config with the [pkg_config generator](https://docs.conan.io/en/latest/reference/generators/pkg_config.html). +Defining the package information in the recipe is also useful in order to consume those packages from a different build system, for example using pkg-config with the [PkgConfigDeps](https://docs.conan.io/2/reference/tools/gnu/pkgconfigdeps.html). Finally, by not allowing these files we make packages agnostic to the consumer as the logic of those files is not in the package but in the way the consumer wants the information. If you really think this is an issue and there is something missing to cover the use case of a library you want to contribute to ConanCenter, please do not hesitate to open an issue and we will be happy to hear your feedback. -\* Take a look at the integrations section to learn more: https://docs.conan.io/en/latest/integrations/build_system/cmake/cmake_find_package_generator.html - -## Should recipes export a recipe's license? - -No, recipes do not need to export a recipe license. Recipes and all files contributed to this repository are licensed under the license in the root of the repository. Using any recipe from this repository or directly from conan-center implies the same licensing. - ## Why recipes that use build tools (like CMake) that have packages in Conan Center do not use it as a build require by default? 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: ``` [tool_requires] -cmake/3.17.2 +cmake/[>=3.15 <4] ``` 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. @@ -112,9 +114,9 @@ The C++ ecosystem has a lot of rare, unique and obscure build systems. Some of t 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 +In Conan 2.x is possible to use [custom generatros](https://docs.conan.io/2/reference/extensions/custom_generators.html). But this feature is not allowed in conan-center-index. -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 +For quality assurance the build service is expected to be green and the 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`? @@ -123,7 +125,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 (use UTC+00). 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 [conandata.yml](https://github.com/conan-io/conan-center-index/blob/master/recipes/rapidjson/all/conandata.yml#L5). 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? @@ -131,12 +134,12 @@ Currently, the Jenkins orchestration library for this build service is not avail ## Why not x86 binaries? -As described in the [Supported platforms and configurations](supported_platforms_and_configurations.md), only the x86_64 architecture is available for download, the rest must be built from sources. The reasons behind this decision are: +Only the x86_64 architecture is available for download, the rest must be built from sources. The reasons behind this decision are: * Few users need different pre-built packages that are not x86_64 packages, this number is less than 10% of total users (data obtained through the download counter from Bintray), and tends to decrease over the years; * Some OS are putting the x86 as obsolete, examples [macOS](https://developer.apple.com/documentation/macos-release-notes/macos-catalina-10_15-release-notes) and Ubuntu 20.04; * For security reasons, most companies build their own packages from sources, even if they already have a pre-built version available, which further reduces the need for extra configurations; -* Each recipe results in around 130 packages, and this is only for x86_64, but not all packages are used, some settings remain with zero downloads throughout their life. So, imagine adding more settings that will rarely be used, but that will consume more resources as time and storage, this leaves us in an impractical situation. +* Each recipe results in several packages, and this is only for x86_64, but not all packages are used, some settings remain with zero downloads throughout their life. So, imagine adding more settings that will rarely be used, but that will consume more resources as time and storage, this leaves us in an impractical situation. ### But if there are no packages available, what will the x86 validation look like? @@ -152,7 +155,7 @@ Yes! You can learn more about default options in [Packaging Policy](adding_packa 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. -However, there are ways to get around this, one of them is through the [/Z7](https://docs.microsoft.com/en-us/cpp/build/reference/z7-zi-zi-debug-information-format) compilation flag, which can be passed through [environment variables](https://docs.microsoft.com/en-us/cpp/build/reference/cl-environment-variables). You can use your [profile](https://docs.conan.io/en/latest/reference/profiles.html#package-settings-and-env-vars) to customize your compiler command line. +However, there are ways to get around this, one of them is through the [/Z7](https://docs.microsoft.com/en-us/cpp/build/reference/z7-zi-zi-debug-information-format) compilation flag, which can be passed through [environment variables](https://docs.microsoft.com/en-us/cpp/build/reference/cl-environment-variables). You can use your [profile](https://docs.conan.io/2/reference/config_files/profiles.html) to customize your compiler command line. ### Why is there no option for PDB, as there is for fPIC? @@ -179,7 +182,7 @@ default_options = {"foobar": "deprecated"} def configure(self): if self.options.foobar != "deprecated": - self.output.warn("foobar option is deprecated, do not use anymore.") + self.output.warning("foobar option is deprecated, do not use anymore.") def package_id(self): del self.info.options.foobar @@ -194,7 +197,11 @@ After one month, we will welcome a PR removing the option that was deprecated. ## Can I split a project into an installer and library package? -No. Some projects provide more than a simple library, but also applications. For those projects, both libraries and executables should be kept together under the same Conan package. In the past, we tried to separate popular projects, like Protobuf, and it proved to be a complex and hard task to be maintained, requiring custom patches to disable parts of the building. Also, with the [context](https://docs.conan.io/en/latest/systems_cross_building/cross_building.html#conan-v1-24-and-newer) feature, we can use the same package as build requirement, for the same build platform, and as a regular requirement, for the host platform, when cross-building. It's recommended using 2 profiles in that case, one for build platform (where the compilation tools are being executed) and one for host platform (where the generated binaries will run). +No. Some projects provide more than a simple library, but also applications. For those projects, both libraries and executables should be kept together under the same Conan package. In the past, we tried to separate popular projects, like Protobuf, and it proved to be a complex and hard task to be maintained, requiring custom patches to disable parts of the building. Also, with the [context](https://docs.conan.io/2/reference/commands/install.html#reference-commands-install-composition) feature, we can use the same package as build requirement, for the same build platform, and as a regular requirement, for the host platform, when cross-building. It's recommended using 2 profiles in that case, one for build platform (where the compilation tools are being executed) and one for host platform (where the generated binaries will run). + +## Should recipes export a recipe's license? + +No, recipes do not need to export a recipe license. Recipes and all files contributed to this repository are licensed under the license in the root of the repository. Using any recipe from this repository or directly from conan-center implies the same licensing. ## What license should I use for Public Domain? @@ -210,35 +217,17 @@ Regardless of why, if the recipe detects a problem where binaries might not be g 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.") +raise ConanInvalidConfiguration(f"The project {self.ref} requires liba.enable_feature=True. See ") ``` -You should not be using the `self.output.warn` and it is not enough to alter consumers or stop the build service. +You should not be using the `self.output.warning` and it is not enough to alter consumers or stop the build service. -## Why is a `build.check_min_cppstd` call not enough? +Also, need to point upstream's issue/PR related to the same problem. In case it's a limitation in the recipe, the same should be clear and be merged without full support: -Very often C++ projects require a minimum standard version, such as 14 or 17, in order to compile. Conan offers tools which enable checking the relevant setting is enabled and above this support for a certain version is present. Otherwise, it uses the compiler's default. - -```python -def configure(self): - build.check_min_cppstd(self, 14) 👈 Wrong! -``` - -This fails to cover the vast number of use cases for the following reasons: - -1. `cppstd` is not configured in the `--detect`ed profiles generated by Conan, the majority of users simply do not have this setting. -2. A shocking number of projects override this setting within their respective build scripts, this setting does not get applied in those cases. -3. Conan-Center-Index does **not** manage the `cppstd` setting for the compilers it supports to generate binaries. - -```python -def validate(self): - # 👇 Correct - if self.settings.compiler.cppstd: - build.check_min_cppstd(self, 14) +```py +raise ConanInvalidConfiguration(f"{self.ref} Conan recipe does not support Windows. Contributions are welcome!") ``` -As a result, all calls to `build.check_min_cppstd` must be guarded by a check for the setting and the only way to ensure the C++ standard is to check the compiler's version to know if it offers sufficient support. An example of this can be found [here](https://github.com/conan-io/conan/issues/8002). - ## What is the policy for adding older versions of a package? See [Adding older versions](adding_packages/sources_and_patches.md#adding-old-versions) for details. @@ -250,10 +239,8 @@ See [Removing older versions](adding_packages/sources_and_patches.md#removing-ol ## Can I install packages from the system package manager? It depends. You can not mix both regular projects with system packages, but you can provide package wrappers for system packages. However, Conan can not track system packages, like their version and options, which creates a fragile situation where affects libraries and binaries built in your package but can not be totally reproduced. -Also, system package managers require administrator permission to install packages, which is not always possible and may break limited users. Moreover, more than one Conan package may require the same system package and there is no way to track their mutual usage. -The hook [KB-H032](error_knowledge_base.md#KB-H032) does not allow `system_requirement` nor `SystemPackageTool` in recipes, to avoid mixing both regular projects with -system packages at same recipe. +Also, system package managers require administrator permission to install packages, which is not always possible and may break limited users. Moreover, more than one Conan package may require the same system package and there is no way to track their mutual usage. 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](adding_packages/build_and_package.md#system-packages) for more. @@ -344,7 +331,7 @@ Since these references will be never available in ConanCenter, they will be deac If consumers activate the option explicitly (`with_intel_mkl=True`), Conan will fail because of the unknown reference. -Consumers may use an [override](https://docs.conan.io/en/latest/using_packages/conanfile_txt.html#overriding-requirements) facility in order to use their own private references for Intel MKL, IPP or DNN libraries. +Consumers may use an [override](https://docs.conan.io/2/reference/conanfile/methods/requirements.html#override) facility in order to use their own private references for Intel MKL, IPP or DNN libraries. For instance, if you have a private reference `intel-mkl/2021@mycompany/stable`, then you may use the following override in your `conanfile.txt`: @@ -357,7 +344,7 @@ intel-mkl/2021@mycompany/stable 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)). +([Conan client changelog](https://docs.conan.io/2/changelog.html)). You should expect that latest revision of recipes can introduce breaking changes and new features that will be broken unless you also upgrade Conan client (and sometimes you will @@ -366,65 +353,38 @@ need to modify your project if the recipe changes the binaries, flags,... it pro 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? +## What's the policy on version ranges? -See [Dependencies Version Ranges](adding_packages/dependencies.md#version-ranges) for details. +Version ranges are currently allowed on a handful of dependencies, but not for general use. +See [Dependencies Version Ranges](adding_packages/dependencies.md#version-ranges) for additional details. ## How to consume a graph of shared libraries? -When the CI builds packages with `shared=True`, it applies the option only to the package being created, but not to -the requirements. As the default value for the `shared` option is usually `False`, you can expect that the dynamic -library that has just being generated has linked all its requirements as static libraries. - -It is important to remark the default [package id mode](https://docs.conan.io/en/latest/creating_packages/define_abi_compatibility.html#versioning-schema) -used by Conan (which is the same default used by ConanCenter): `semver_direct_mode`. With this default only the major -version of the requirements is encoded in the package ID. +When the CI builds packages with the option `*/*:shared=True`, this option is applied not only to the package being created but also to its requirements. +Since the default value for the shared option is typically `False`, you can generally expect that the dependency graph will consist of static libraries, +except for packages specifically defined with `package_type = "shared-library"`. -The two previous behaviors together can lead to unexpected results for a user that want to consume a graph of -dependencies as shared libraries from ConanCenter. They might think that using `*:shared=True` in their profile is -enough, and indeed Conan will retrieve from ConanCenter all the dynamic libraries for all the graph of dependencies, but -**all of them will contain the logic of their respective requirements embedded in the dynamic library**, and this -logic is embedded at the time of building, so it might not match the version of the requirements that was resolved -by Conan, and for sure, the other dynamic libraries won't be used, only the ones linked directly by the consumer -project. See a more detailed [example here](https://github.com/conan-io/conan/issues/9712). +To work with a graph that includes only shared libraries, you must explicitly set the `-o */*:shared=True` option in your conan install command. +This ensures that the necessary shared libraries are included in your build environment. -In order to consume all those libraries as shared ones, building from sources is needed. This can be -easily achievable using `*:shared=True` in the _host_ profile and `--build` in the install command. With these inputs, -Conan will build from sources all the packages and use the shared libraries when linking. - -> **Note**: If you are hosting your own recipes, the proper solution for recipes would be to use something like -> [`shared_library_package_id`](https://docs.conan.io/en/latest/reference/conanfile/methods.html?highlight=shared_library_package_id#self-info-shared-library-package-id), -> that will encode this information in the package ID and ensure that any change in the static libraries that are -> embedded into a shared one is taken into account when computing the package ID. -> -> In this repository we are not using it, because it will lead to many missing packages, making it impossible -> for the CI to actually build consumers in PRs. - -## How to watch only specific recipes? - -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. - -## 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. +## Can we add package which are parts of bigger projects like Boost? -## How long can I be inactive before being removed from the authorized users list? +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. -Please, read [Inactivity and user removal section](adding_packages/README.md#inactivity-and-user-removal). +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 we add package which are parts of bigger projects like Boost? +### Can I add my project which I will submit to 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. +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. -There is one main "boost" recipe with many versions maintained. +**NOTE**: In case you have no intention to submit to Boost, then you can use the project name as is (e.g `boost-foobar`). -There are good arguments for permitting some boost libraries but we feel doing so is not fair to the rest. +## Can I add options that do not affect `package_id` or the package contents -### Can I add my project which I will submit to Boost? +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. -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. +Doing so requires [deleting the option from the `package_id`](adding_packages/conanfile_attributes.md#removing-from-package_id). diff --git a/docs/labels.md b/docs/labels.md deleted file mode 100644 index 270b6b157a75a..0000000000000 --- a/docs/labels.md +++ /dev/null @@ -1,85 +0,0 @@ -# Labels - -We use [GitHub labels](https://github.com/conan-io/conan-center-index/labels) to signal the status -of pull-requests and issues. Here you can find more information about the ones that have some -special meaning: - - -## Contents - - * [Bump dependencies](#bump-dependencies) - * [Bump version](#bump-version) - * [Infrastructure](#infrastructure) - * [Stale](#stale) - * [Unexpected Error](#unexpected-error) - * [User-approval pending](#user-approval-pending) - * [Library Request](#library-request) - * [Question](#question) - * [Upstream Update](#upstream-update) - * [conan.io/center](#conaniocenter) - -## Bump dependencies - -Label [`Bump dependencies`](https://github.com/conan-io/conan-center-index/pulls?q=is%3Aopen+is%3Apr+label%3A%22Bump+dependencies%22+) -is assigned by the bot to pull-requests that are just upgrading the version of the requirements that were already in the -recipe. - -> These pull-requests will be merged right away without requiring any approval (CI and CLA checks must have passed). - -If the pull request modifies anything else, the label won't be assigned, we need to be very careful about false positives. - -## Bump version - -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. -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). - -If the pull request modifies anything else, the label won't be assigned, we need to be very careful about false positives. - -## Infrastructure - -Label [`infrastructure`](https://github.com/conan-io/conan-center-index/pulls?q=is%3Aopen+is%3Apr+label%3Ainfrastructure) is -manually assigned to pull requests that are waiting for something on the infrastructure side. Usually they are blocked and -cannot succeed because they need some tools, more memory,... these pull requests won't be marked as `stale`. - -## Stale - -Label [`stale`](https://github.com/conan-io/conan-center-index/pulls?q=is%3Aopen+is%3Apr+label%3Astale) is assigned to -pull requests without any activity during a long period of time. These pull requests will be closed if they don't get -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. -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 deleted file mode 100644 index b93f645337264..0000000000000 --- a/docs/linters.md +++ /dev/null @@ -1,160 +0,0 @@ -# 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 index 76d696e57b0a0..1ea369a63a8ee 100644 --- a/docs/package_templates/README.md +++ b/docs/package_templates/README.md @@ -12,7 +12,7 @@ It's listed under [cmake_package](cmake_package) folder. It fits projects which #### 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. +It's listed under [header_only](header_only) folder. It fits projects which only copy header and have the same package ID always. Please note that if the library in question does have a build system (e.g. CMake, Meson, Autotools) that contains install logic - that should be the preferred starting point for the recipe. Copying files directly into the package folder should be reserved for header only libraries where the upstream project does not provide this functionality. #### MSBuild package diff --git a/docs/package_templates/autotools_package/all/conandata.yml b/docs/package_templates/autotools_package/all/conandata.yml index 629a5640adc16..e11d72dbcdc2b 100644 --- a/docs/package_templates/autotools_package/all/conandata.yml +++ b/docs/package_templates/autotools_package/all/conandata.yml @@ -1,17 +1,13 @@ 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": - url: - - "https://mirror1.net/package-1.1.0.tar.gz" - - "https://mirror2.net/package-1.1.0.tar.gz" + url: "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" diff --git a/docs/package_templates/autotools_package/all/conanfile.py b/docs/package_templates/autotools_package/all/conanfile.py index 819b60ea8dd63..db295ffc21b40 100644 --- a/docs/package_templates/autotools_package/all/conanfile.py +++ b/docs/package_templates/autotools_package/all/conanfile.py @@ -2,15 +2,15 @@ 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.env import Environment, VirtualBuildEnv, VirtualRunEnv +from conan.tools.env import Environment, 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.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain, PkgConfigDeps from conan.tools.layout import basic_layout from conan.tools.microsoft import is_msvc, unix_path import os -required_conan_version = ">=1.53.0" +required_conan_version = ">=2.0.9" # # INFO: Please, remove all comments before pushing your PR! @@ -21,12 +21,14 @@ 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-" + # In case not listed there, use "DocumentRef-: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") + # package_type should usually be "library", "shared-library" or "static-library" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -38,81 +40,77 @@ class PackageConan(ConanFile): "fPIC": True, "with_foobar": 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) + # In case having config_options() or configure() method, the logic should be moved to the specific methods. + implements = ["auto_shared_fpic"] # 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): + # Keep this logic only in case configure() is needed e.g pure-c project. + # Otherwise remove configure() and auto_shared_fpic will manage it. if self.options.shared: self.options.rm_safe("fPIC") - # for plain C projects only - self.settings.rm_safe("compiler.libcxx") + # for plain C projects only. Otherwise, remove this method. self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") 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 + # Prefer self.requirements() method instead of self.requires attribute. self.requires("dependency/0.8.1") if self.options.with_foobar: + # INFO: used in foo/baz.hpp:34 self.requires("foobar/0.1.0") + # Some dependencies on CCI are allowed to use version ranges. + # See https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/dependencies.md#version-ranges + self.requires("openssl/[>=1.1 <4]") def validate(self): # validate the minimum cpp standard supported. Only for C++ projects - if self.settings.compiler.get_safe("cppstd"): - check_min_cppstd(self, 11) - if self.settings.os not in ["Linux", "FreeBSD", "MacOS"]: + check_min_cppstd(self, 14) + + # Always comment the reason including the upstream issue. + # INFO: Upstream only support Unix systems. See + 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) + # if a tool other 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") # only if upstream configure.ac relies on PKG_CHECK_MODULES macro - if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): - self.tool_requires("pkgconf/x.y.z") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/[>=2.2 <3]") # required to suppport windows as a build machine - if self._settings_build.os == "Windows": + if self.settings_build.os == "Windows": self.win_bash = True - if not self.conf.get("tools.microsoft.bash:path", default=False, check_type=str): + 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], strip_root=True) + # apply patches listed in conandata.yml + # Using patches is always the last resort to fix issues. If possible, try to fix the issue in the upstream project. + apply_conandata_patches(self) def generate(self): - # 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 + # inject required env vars into the 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 + VirtualRunEnv(self).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) # autotools usually uses 'yes' and 'no' to enable/disable options - yes_no = lambda v: "yes" if v else "no" + def yes_no(v): return "yes" if v else "no" tc.configure_args.extend([ f"--with-foobar={yes_no(self.options.with_foobar)}", "--enable-tools=no", @@ -123,8 +121,10 @@ def generate(self): tc = PkgConfigDeps(self) tc.generate() # generate dependencies for autotools - tc = AutotoolsDeps(self) - tc.generate() + # some recipes might require a workaround for MSVC (https://github.com/conan-io/conan/issues/12784): + # https://github.com/conan-io/conan-center-index/blob/00ce907b910d0d772f1c73bb699971c141c423c1/recipes/xapian-core/all/conanfile.py#L106-L135 + deps = AutotoolsDeps(self) + deps.generate() # If Visual Studio is supported if is_msvc(self): @@ -132,12 +132,13 @@ def generate(self): # 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 - compile_wrapper = unix_path(self, self._user_info_build["automake"].compile) - ar_wrapper = unix_path(self, self._user_info_build["automake"].ar_lib) + 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("AR", f"{ar_wrapper} lib") env.define("NM", "dumpbin -symbols") env.define("OBJDUMP", ":") env.define("RANLIB", ":") @@ -145,8 +146,7 @@ def generate(self): env.vars(self).save_script("conanbuild_msvc") def build(self): - # apply patches listed in conandata.yml - apply_conandata_patches(self) + autotools = Autotools(self) # (optional) run autoreconf to regenerate configure file (libtool should be in tool_requires) autotools.autoreconf() @@ -155,13 +155,13 @@ def build(self): autotools.make() def package(self): - copy(self, pattern="LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) autotools = Autotools(self) - # TODO: replace by autotools.install() once Conan 1.54 is available in CCI - autotools.install(args=[f"DESTDIR={unix_path(self, self.package_folder)}"]) + autotools.install() - # some files extensions and folders are not allowed. Please, read the FAQs to get informed. + # Some files extensions and folders are not allowed. Please, read the FAQs to get informed. rm(self, "*.la", os.path.join(self.package_folder, "lib")) + # Consider disabling these at first to verify that the package_info() output matches the info exported by the project. rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) rmdir(self, os.path.join(self.package_folder, "share")) @@ -171,7 +171,7 @@ def package(self): def package_info(self): self.cpp_info.libs = ["package_lib"] - # if package provides a pkgconfig file (package.pc, usually installed in /lib/pkgconfig/) + # 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 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 d5f12b4376cdb..c16ec6d748476 100644 --- a/docs/package_templates/autotools_package/all/test_package/CMakeLists.txt +++ b/docs/package_templates/autotools_package/all/test_package/CMakeLists.txt @@ -1,11 +1,7 @@ -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++ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) find_package(package REQUIRED CONFIG) -add_executable(${PROJECT_NAME} test_package.c) -# don't link to ${CONAN_LIBS} or CONAN_PKG::package +add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE package::package) -# In case the target project need a specific C++ standard -# target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) 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 48499fa0989d9..2e77b4246fa81 100644 --- a/docs/package_templates/autotools_package/all/test_package/conanfile.py +++ b/docs/package_templates/autotools_package/all/test_package/conanfile.py @@ -4,11 +4,9 @@ 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" + generators = "CMakeDeps", "CMakeToolchain" def layout(self): cmake_layout(self) @@ -23,5 +21,5 @@ def build(self): def test(self): if can_run(self): - bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + bin_path = os.path.join(self.cpp.build.bindir, "test_package") self.run(bin_path, env="conanrun") diff --git a/docs/package_templates/autotools_package/all/test_package/test_package.c b/docs/package_templates/autotools_package/all/test_package/test_package.c deleted file mode 100644 index f949b7f4a20f4..0000000000000 --- a/docs/package_templates/autotools_package/all/test_package/test_package.c +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include -#include "package/foobar.h" // Make sure includes work as expected - - -int main(void) { - printf("Create a minimal usage for the target project here.\n"); - printf("Avoid big examples, bigger than 100 lines\n"); - printf("Avoid networking connections.\n"); - printf("Avoid background apps or servers.\n"); - printf("The propose is testing the generated artifacts only.\n"); - - foobar_print_version(); // Make sure to call something that will require linkage for compiled libraries - - return EXIT_SUCCESS; -} diff --git a/docs/package_templates/autotools_package/all/test_package/test_package.cpp b/docs/package_templates/autotools_package/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..2746a345c92f8 --- /dev/null +++ b/docs/package_templates/autotools_package/all/test_package/test_package.cpp @@ -0,0 +1,21 @@ +#include +#include "package/foobar.h" + + +int main(void) { + /* + * TODO: Remove this comment before pushing the testing code; + * + * Create a minimal usage for the target project here; + * Avoid upstream full examples, or code bigger than 15 lines; + * Avoid networking connections; + * Avoid background apps or servers; + * Avoid GUI apps; + * Avoid extra files like images, sounds and other binaries; + * The propose is testing the generated artifacts ONLY; + */ + + foobar_print_version(); // Make sure to call something that will require linkage for compiled libraries + + return EXIT_SUCCESS; +} 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 deleted file mode 100644 index e4a742eca89e3..0000000000000 --- a/docs/package_templates/autotools_package/all/test_v1_package/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -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) - -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 629a5640adc16..dacc527595b61 100644 --- a/docs/package_templates/cmake_package/all/conandata.yml +++ b/docs/package_templates/cmake_package/all/conandata.yml @@ -1,17 +1,13 @@ 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": - 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" 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" diff --git a/docs/package_templates/cmake_package/all/conanfile.py b/docs/package_templates/cmake_package/all/conanfile.py index ee4c716b4e9d7..50a593703f186 100644 --- a/docs/package_templates/cmake_package/all/conanfile.py +++ b/docs/package_templates/cmake_package/all/conanfile.py @@ -1,15 +1,13 @@ 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 +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.53.0" +required_conan_version = ">=2.0.9" # # INFO: Please, remove all comments before pushing your PR! @@ -20,12 +18,14 @@ 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-" + # In case not listed there, use "DocumentRef-: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") + # package_type should usually be "library", "shared-library" or "static-library" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -35,115 +35,88 @@ class PackageConan(ConanFile): "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", - } + # In case having config_options() or configure() method, the logic should be moved to the specific methods. + implements = ["auto_shared_fpic"] # 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): + # Keep this logic only in case configure() is needed e.g pure-c project. + # Otherwise remove configure() and auto_shared_fpic will manage it. 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") + self.settings.rm_safe("compiler.libcxx") def layout(self): - # src_folder must use the same source folder name the project cmake_layout(self, src_folder="src") def requirements(self): - # prefer self.requires method instead of requires attribute + # Always prefer self.requirements() method instead of self.requires attribute. self.requires("dependency/0.8.1") + if self.options.with_foobar: + # INFO: used in foo/baz.hpp:34 + self.requires("foobar/0.1.0", transitive_headers=True, transitive_libs=True) + # Some dependencies on CCI are allowed to use version ranges. + # See https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/dependencies.md#version-ranges + self.requires("openssl/[>=1.1 <4]") def validate(self): - # validate the minimum cpp standard supported. For C++ projects only - 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 + # validate the minimum cpp standard supported. For C++ projects only. + check_min_cppstd(self, 14) + # in case it does not work in another configuration, it should be validated here. Always comment the reason including the upstream issue. + # INFO: Upstream does not support DLL: See 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) + # if a tool other than the compiler or CMake newer than 3.15 is required to build the project (pkgconf, bison, flex etc) def build_requirements(self): - self.tool_requires("tool/x.y.z") + self.tool_requires("cmake/[>=3.16 <4]") def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) + # Using patches is always the last resort to fix issues. If possible, try to fix the issue in the upstream project. + apply_conandata_patches(self) def generate(self): - # BUILD_SHARED_LIBS and POSITION_INDEPENDENT_CODE are automatically parsed when self.options.shared or self.options.fPIC exist + # BUILD_SHARED_LIBS and POSITION_INDEPENDENT_CODE are set automatically as tc.variables when self.options.shared or self.options.fPIC exist tc = CMakeToolchain(self) # Boolean values are preferred instead of "ON"/"OFF" - tc.variables["PACKAGE_CUSTOM_DEFINITION"] = True + tc.cache_variables["PACKAGE_BUILD_TESTS"] = False if is_msvc(self): - # don't use self.settings.compiler.runtime - 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.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) + tc.cache_variables["USE_MSVC_RUNTIME_LIBRARY_DLL"] = not is_msvc_static_runtime(self) tc.generate() - # In case there are dependencies listed on build_requirements, VirtualBuildEnv should be used - tc = VirtualBuildEnv(self) - tc.generate(scope="build") - 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"), "...", "") + # In case there are dependencies listed under requirements, CMakeDeps should be used + deps = CMakeDeps(self) + # You can override the CMake package and target names if they don't match the names used in the project + deps.set_property("fontconfig", "cmake_file_name", "Fontconfig") + deps.set_property("fontconfig", "cmake_target_name", "Fontconfig::Fontconfig") + deps.generate() def build(self): - 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): - copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) cmake = CMake(self) cmake.install() - # some files extensions and folders are not allowed. Please, read the FAQs to get informed. + # Some files extensions and folders are not allowed. Please, read the FAQs to get informed. + # Consider disabling these at first to verify that the package_info() output matches the info exported by the project. 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")) + rm(self, "*.pdb", self.package_folder, recursive=True) def package_info(self): + # library name to be packaged self.cpp_info.libs = ["package_lib"] - # if 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") @@ -159,9 +132,3 @@ def package_info(self): 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"] = "PACKAGE" - self.cpp_info.filenames["cmake_find_package_multi"] = "package" - self.cpp_info.names["cmake_find_package"] = "PACKAGE" - self.cpp_info.names["cmake_find_package_multi"] = "package" 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 bf37e23371cba..c16ec6d748476 100644 --- a/docs/package_templates/cmake_package/all/test_package/CMakeLists.txt +++ b/docs/package_templates/cmake_package/all/test_package/CMakeLists.txt @@ -1,12 +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++ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) find_package(package REQUIRED CONFIG) add_executable(${PROJECT_NAME} 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 need a specific C++ standard -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/docs/package_templates/cmake_package/all/test_package/conanfile.py b/docs/package_templates/cmake_package/all/test_package/conanfile.py index 1111583fea732..2e77b4246fa81 100644 --- a/docs/package_templates/cmake_package/all/test_package/conanfile.py +++ b/docs/package_templates/cmake_package/all/test_package/conanfile.py @@ -4,18 +4,16 @@ 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) + generators = "CMakeDeps", "CMakeToolchain" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() @@ -23,5 +21,5 @@ def build(self): def test(self): if can_run(self): - bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + bin_path = os.path.join(self.cpp.build.bindir, "test_package") self.run(bin_path, env="conanrun") diff --git a/docs/package_templates/cmake_package/all/test_package/config.yml b/docs/package_templates/cmake_package/all/test_package/config.yml new file mode 100644 index 0000000000000..d07c95e596619 --- /dev/null +++ b/docs/package_templates/cmake_package/all/test_package/config.yml @@ -0,0 +1,5 @@ +versions: + "1.2.0": + folder: all + "1.1.0": + folder: all diff --git a/docs/package_templates/cmake_package/all/test_package/test_package.cpp b/docs/package_templates/cmake_package/all/test_package/test_package.cpp index 8e653f30a5476..7480c357a3b18 100644 --- a/docs/package_templates/cmake_package/all/test_package/test_package.cpp +++ b/docs/package_templates/cmake_package/all/test_package/test_package.cpp @@ -1,14 +1,19 @@ #include -#include #include "package/foobar.hpp" int main(void) { - std::cout << "Create a minimal usage for the target project here." << std::endl; - std::cout << "Avoid big examples, bigger than 100 lines" << std::endl; - std::cout << "Avoid networking connections." << std::endl; - std::cout << "Avoid background apps or servers." << std::endl; - std::cout << "The propose is testing the generated artifacts only." << std::endl; + /* + * TODO: Remove this comment before pushing the testing code; + * + * Create a minimal usage for the target project here; + * Avoid upstream full examples, or code bigger than 15 lines; + * Avoid networking connections; + * Avoid background apps or servers; + * Avoid GUI apps; + * Avoid extra files like images, sounds and other binaries; + * The propose is testing the generated artifacts ONLY; + */ foobar.print_version(); diff --git a/docs/package_templates/cmake_package/config.yml b/docs/package_templates/cmake_package/config.yml index a885cbf942a74..d07c95e596619 100644 --- a/docs/package_templates/cmake_package/config.yml +++ b/docs/package_templates/cmake_package/config.yml @@ -1,5 +1,4 @@ versions: - # Newer versions at the top "1.2.0": folder: all "1.1.0": diff --git a/docs/package_templates/header_only/all/conandata.yml b/docs/package_templates/header_only/all/conandata.yml index 629a5640adc16..e11d72dbcdc2b 100644 --- a/docs/package_templates/header_only/all/conandata.yml +++ b/docs/package_templates/header_only/all/conandata.yml @@ -1,17 +1,13 @@ 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": - url: - - "https://mirror1.net/package-1.1.0.tar.gz" - - "https://mirror2.net/package-1.1.0.tar.gz" + url: "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" diff --git a/docs/package_templates/header_only/all/conanfile.py b/docs/package_templates/header_only/all/conanfile.py index b268d9251b28e..6615ea677d66a 100644 --- a/docs/package_templates/header_only/all/conanfile.py +++ b/docs/package_templates/header_only/all/conanfile.py @@ -1,102 +1,75 @@ 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.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.52.0" +required_conan_version = ">=2.0" class PackageConan(ConanFile): name = "package" description = "short description" # Use short name only, conform to SPDX License List: https://spdx.org/licenses/ - # In case it's not listed there, use "LicenseRef-" + # In case it's not listed there, use "DocumentRef-:LicenseRef-" license = "" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/project/package" # Do not put "conan" nor the project name in topics. Use topics from the upstream listed on GH - # Keep 'header-only' as topic + # Include 'header-only' as a topic topics = ("topic1", "topic2", "topic3", "header-only") - # Keep these or explain why it's not required for this particular case + package_type = "header-library" 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 _min_cppstd(self): - return 14 - - # In case the project requires C++14/17/20/... the minimum compiler version should be listed - @property - def _compilers_minimum_version(self): - return { - "Visual Studio": "15", - "msvc": "14.1", - "gcc": "5", - "clang": "5", - "apple-clang": "5.1", - } - # 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): export_conandata_patches(self) def layout(self): - # 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 # 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) + self.requires("dependency/0.8.1") + # Some dependencies on CCI are allowed to use version ranges. + # See https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/dependencies.md#version-ranges + self.requires("openssl/[>=1.1 <4]") # same package ID for any package def package_id(self): self.info.clear() def validate(self): - 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 + # Validate the minimum cpp standard supported when installing the package. For C++ projects only + check_min_cppstd(self, 14) + # in case it does not work in another configuration, it should be validated here. Always comment the reason including the upstream issue. + # INFO: Upstream does not support DLL: See if self.settings.os == "Windows": raise ConanInvalidConfiguration(f"{self.ref} can not be used on Windows.") def source(self): # 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 - def build(self): # The attribute no_copy_source should not be used when applying patches in build + # Using patches is always the last resort to fix issues. If possible, try to fix the issue in the upstream project. apply_conandata_patches(self) + # Suppress warning message about missing build() method when running Conan + def build(self): + pass + # 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, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + # Prefer CMake.install() or similar in case the upstream offers an official method to install the headers. + copy(self, "*.h", os.path.join(self.source_folder, "include"), os.path.join(self.package_folder, "include")) def package_info(self): - # Folders not used for header-only - self.cpp_info.bindirs = [] - self.cpp_info.libdirs = [] - # 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... @@ -110,12 +83,10 @@ def package_info(self): # (package.pc, usually installed in /lib/pkgconfig/) self.cpp_info.set_property("pkg_config_name", "package") + # Folders not used for header-only + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + # Add m, pthread and dl if needed in Linux/FreeBSD if self.settings.os in ["Linux", "FreeBSD"]: 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" - self.cpp_info.filenames["cmake_find_package_multi"] = "package" - self.cpp_info.names["cmake_find_package"] = "PACKAGE" - self.cpp_info.names["cmake_find_package_multi"] = "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 bf8eccb9b5b0a..c16ec6d748476 100644 --- a/docs/package_templates/header_only/all/test_package/CMakeLists.txt +++ b/docs/package_templates/header_only/all/test_package/CMakeLists.txt @@ -1,11 +1,7 @@ -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++ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) find_package(package REQUIRED CONFIG) add_executable(${PROJECT_NAME} 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 need a specific C++ standard -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) 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 48499fa0989d9..2e77b4246fa81 100644 --- a/docs/package_templates/header_only/all/test_package/conanfile.py +++ b/docs/package_templates/header_only/all/test_package/conanfile.py @@ -4,11 +4,9 @@ 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" + generators = "CMakeDeps", "CMakeToolchain" def layout(self): cmake_layout(self) @@ -23,5 +21,5 @@ def build(self): def test(self): if can_run(self): - bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + bin_path = os.path.join(self.cpp.build.bindir, "test_package") self.run(bin_path, env="conanrun") diff --git a/docs/package_templates/header_only/all/test_package/test_package.cpp b/docs/package_templates/header_only/all/test_package/test_package.cpp index 8e653f30a5476..7480c357a3b18 100644 --- a/docs/package_templates/header_only/all/test_package/test_package.cpp +++ b/docs/package_templates/header_only/all/test_package/test_package.cpp @@ -1,14 +1,19 @@ #include -#include #include "package/foobar.hpp" int main(void) { - std::cout << "Create a minimal usage for the target project here." << std::endl; - std::cout << "Avoid big examples, bigger than 100 lines" << std::endl; - std::cout << "Avoid networking connections." << std::endl; - std::cout << "Avoid background apps or servers." << std::endl; - std::cout << "The propose is testing the generated artifacts only." << std::endl; + /* + * TODO: Remove this comment before pushing the testing code; + * + * Create a minimal usage for the target project here; + * Avoid upstream full examples, or code bigger than 15 lines; + * Avoid networking connections; + * Avoid background apps or servers; + * Avoid GUI apps; + * Avoid extra files like images, sounds and other binaries; + * The propose is testing the generated artifacts ONLY; + */ foobar.print_version(); 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 deleted file mode 100644 index 0aeb3e1d92584..0000000000000 --- a/docs/package_templates/header_only/all/test_v1_package/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -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/docs/package_templates/header_only/config.yml b/docs/package_templates/header_only/config.yml index a885cbf942a74..d07c95e596619 100644 --- a/docs/package_templates/header_only/config.yml +++ b/docs/package_templates/header_only/config.yml @@ -1,5 +1,4 @@ versions: - # Newer versions at the top "1.2.0": folder: all "1.1.0": diff --git a/docs/package_templates/meson_package/all/conandata.yml b/docs/package_templates/meson_package/all/conandata.yml index f73df4b4f1645..e11d72dbcdc2b 100644 --- a/docs/package_templates/meson_package/all/conandata.yml +++ b/docs/package_templates/meson_package/all/conandata.yml @@ -1,16 +1,13 @@ 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", + - "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", + url: "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" diff --git a/docs/package_templates/meson_package/all/conanfile.py b/docs/package_templates/meson_package/all/conanfile.py index 32a498ac2564b..adb9f19600283 100644 --- a/docs/package_templates/meson_package/all/conanfile.py +++ b/docs/package_templates/meson_package/all/conanfile.py @@ -2,17 +2,15 @@ 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.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir from conan.tools.gnu import PkgConfigDeps from conan.tools.layout import basic_layout -from conan.tools.meson import Meson, MesonToolchain, MesonDeps -from conan.tools.microsoft import check_min_vs, is_msvc -from conan.tools.scm import Version +from conan.tools.meson import Meson, MesonToolchain +from conan.tools.microsoft import is_msvc import os -required_conan_version = ">=1.53.0" +required_conan_version = ">=2.0" # # INFO: Please, remove all comments before pushing your PR! @@ -23,125 +21,111 @@ 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-" + # In case not listed there, use "DocumentRef-: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") + # package_type should usually be "library", "shared-library" or "static-library" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], + "feature": [True, False], } default_options = { "shared": False, "fPIC": True, + "feature": 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", - } + # In case having config_options() or configure() method, the logic should be moved to the specific methods. + implements = ["auto_shared_fpic"] # 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): + # Keep this logic only in case configure() is needed e.g pure-c project. + # Otherwise remove configure() and auto_shared_fpic will manage it. if self.options.shared: self.options.rm_safe("fPIC") - # for plain C projects only - self.settings.rm_safe("compiler.libcxx") + # for plain C projects only. Otherwise, remove this method. self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") 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 + # Prefer self.requirements() method instead of self.requires attribute. self.requires("dependency/0.8.1") + if self.options.with_foobar: + # INFO: used in foo/baz.hpp:34 + self.requires("foobar/0.1.0") + # Some dependencies on CCI are allowed to use version ranges. + # See https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/dependencies.md#version-ranges + self.requires("openssl/[>=1.1 <4]") 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 + check_min_cppstd(self, 14) + # in case it does not work in another configuration, it should be validated here too + # Always comment the reason including the upstream issue. + # INFO: Upstream does not support DLL: See 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") + self.tool_requires("meson/[>=1.2.3 <2]") # 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") + self.tool_requires("pkgconf/[>=2.2 <3]") def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) + # apply patches listed in conandata.yml + # Using patches is always the last resort to fix issues. If possible, try to fix the issue in the upstream project. + apply_conandata_patches(self) def generate(self): - # default_library and b_staticpic are automatically parsed when self.options.shared and self.options.fpic exist + # Meson feature options must be set to "enabled" or "disabled" + def feature(v): return "enabled" if v else "disabled" + # default_library and static and fpic 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 features are typically enabled automatically when possible. + # The default behavior can be changed to disable all features by setting "auto_features" to "disabled". + tc.project_options["auto_features"] = "disabled" + tc.project_options["feature"] = feature(self.options.get_safe("feature")) # 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() - # Sometimes, when PkgConfigDeps is not enough to find requirements, MesonDeps should solve it - tc = MesonDeps(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"), "...", "") + # In case there are dependencies listed under requirements, PkgConfigDeps should be used + deps = PkgConfigDeps(self) + deps.generate() 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) + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) meson = Meson(self) meson.install() - # some files extensions and folders are not allowed. Please, read the FAQs to get informed. + # Some files extensions and folders are not allowed. Please, read the FAQs to get informed. + # Consider disabling these at first to verify that the package_info() output matches the info exported by the project. + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) 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")) + rm(self, "*.pdb", self.package_folder, recursive=True) # 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) diff --git a/docs/package_templates/meson_package/all/test_package/conanfile.py b/docs/package_templates/meson_package/all/test_package/conanfile.py index 287ce44d8a78e..577771653eaef 100644 --- a/docs/package_templates/meson_package/all/test_package/conanfile.py +++ b/docs/package_templates/meson_package/all/test_package/conanfile.py @@ -5,11 +5,9 @@ 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" + generators = "PkgConfigDeps", "MesonToolchain" def layout(self): basic_layout(self) @@ -18,9 +16,9 @@ def requirements(self): self.requires(self.tested_reference_str) def build_requirements(self): - self.tool_requires("meson/0.63.3") + self.tool_requires("meson/[>=1.2.3 <2]") if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): - self.tool_requires("pkgconf/1.9.3") + self.tool_requires("pkgconf/[>=2.2 <3]") def build(self): meson = Meson(self) @@ -29,5 +27,5 @@ def build(self): def test(self): if can_run(self): - bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + bin_path = os.path.join(self.cpp.build.bindir, "test_package") self.run(bin_path, env="conanrun") 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 index 315875d954777..7480c357a3b18 100644 --- a/docs/package_templates/meson_package/all/test_package/test_package.cpp +++ b/docs/package_templates/meson_package/all/test_package/test_package.cpp @@ -1,16 +1,19 @@ #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. - */ + * TODO: Remove this comment before pushing the testing code; + * + * Create a minimal usage for the target project here; + * Avoid upstream full examples, or code bigger than 15 lines; + * Avoid networking connections; + * Avoid background apps or servers; + * Avoid GUI apps; + * Avoid extra files like images, sounds and other binaries; + * The propose is testing the generated artifacts ONLY; + */ foobar.print_version(); 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 deleted file mode 100644 index c5b074313827d..0000000000000 --- a/docs/package_templates/meson_package/all/test_v1_package/conanfile.py +++ /dev/null @@ -1,23 +0,0 @@ -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 index a885cbf942a74..d07c95e596619 100644 --- a/docs/package_templates/meson_package/config.yml +++ b/docs/package_templates/meson_package/config.yml @@ -1,5 +1,4 @@ versions: - # Newer versions at the top "1.2.0": folder: all "1.1.0": diff --git a/docs/package_templates/msbuild_package/all/conandata.yml b/docs/package_templates/msbuild_package/all/conandata.yml index 629a5640adc16..5f2e653489b97 100644 --- a/docs/package_templates/msbuild_package/all/conandata.yml +++ b/docs/package_templates/msbuild_package/all/conandata.yml @@ -1,5 +1,4 @@ sources: - # Newer versions at the top "1.2.0": url: - "https://mirror1.net/package-1.2.0.tar.gz" @@ -11,7 +10,6 @@ sources: - "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" diff --git a/docs/package_templates/msbuild_package/all/conanfile.py b/docs/package_templates/msbuild_package/all/conanfile.py index c3e9ab3384c1c..9b7ee02a4107c 100644 --- a/docs/package_templates/msbuild_package/all/conanfile.py +++ b/docs/package_templates/msbuild_package/all/conanfile.py @@ -1,58 +1,60 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.microsoft import is_msvc, vs_layout, MSBuildDeps, MSBuildToolchain, MSBuild, VCVars -from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rm, replace_in_file +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 MSBuild, MSBuildDeps, MSBuildToolchain, is_msvc import os -required_conan_version = ">=1.53.0" +required_conan_version = ">=2.0" 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-" + # In case not listed there, use "DocumentRef-: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") + # package_type should usually be "library", "shared-library" or "static-library" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], - "fPIC": [True, False], } default_options = { "shared": False, - "fPIC": True, } # 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") + # for plain C projects only. Otherwise, this method is not needed self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): - vs_layout(self) + basic_layout(self, src_folder="src") def requirements(self): - # prefer self.requires method instead of requires attribute + # Prefer self.requirements() method instead of self.requires attribute. self.requires("dependency/0.8.1") + if self.options.with_foobar: + # used in foo/baz.hpp:34 + self.requires("foobar/0.1.0") + # A small number of dependencies on CCI are allowed to use version ranges. + # See https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/dependencies.md#version-ranges + self.requires("openssl/[>=1.1 <4]") def validate(self): - # in case it does not work in another configuration, it should validated here too + # in case it does not work in another configuration, it should be validated here too + # Always comment the reason including the upstream issue. + # INFO: Upstream does not support DLL: See if not is_msvc(self): raise ConanInvalidConfiguration(f"{self.ref} can be built only by Visual Studio and msvc.") @@ -62,45 +64,43 @@ def build_requirements(self): def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) + # apply patches listed in conandata.yml + # Using patches is always the last resort to fix issues. If possible, try to fix the issue in the upstream project. + apply_conandata_patches(self) + + @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.generate() - tc = MSBuildDeps(self) - tc.generate() - tc = VCVars(self) + tc.configuration = self._msbuild_configuration 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, "CMakeLists.txt"), "...", "") + # If there are requirements + deps = MSBuildDeps(self) + deps.configuration = self._msbuild_configuration + deps.generate() def build(self): - 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", self.source_folder, os.path.join(self.package_folder, "licenses")) + copy(self, "*.lib", self.source_folder, os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, "*.dll", self.source_folder, os.path.join(self.package_folder, "bin"), keep_path=False) + copy(self, "*.h", os.path.join(self.source_folder, "include"), 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_package/CMakeLists.txt b/docs/package_templates/msbuild_package/all/test_package/CMakeLists.txt index b8db27ff53d5e..c16ec6d748476 100644 --- a/docs/package_templates/msbuild_package/all/test_package/CMakeLists.txt +++ b/docs/package_templates/msbuild_package/all/test_package/CMakeLists.txt @@ -1,10 +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++ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) find_package(package REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -# don't link to ${CONAN_LIBS} or CONAN_PKG::package target_link_libraries(${PROJECT_NAME} PRIVATE package::package) diff --git a/docs/package_templates/msbuild_package/all/test_package/conanfile.py b/docs/package_templates/msbuild_package/all/test_package/conanfile.py index 1111583fea732..2e77b4246fa81 100644 --- a/docs/package_templates/msbuild_package/all/test_package/conanfile.py +++ b/docs/package_templates/msbuild_package/all/test_package/conanfile.py @@ -4,18 +4,16 @@ 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) + generators = "CMakeDeps", "CMakeToolchain" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() @@ -23,5 +21,5 @@ def build(self): def test(self): if can_run(self): - bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + bin_path = os.path.join(self.cpp.build.bindir, "test_package") self.run(bin_path, env="conanrun") diff --git a/docs/package_templates/msbuild_package/all/test_package/test_package.cpp b/docs/package_templates/msbuild_package/all/test_package/test_package.cpp index 8e653f30a5476..7480c357a3b18 100644 --- a/docs/package_templates/msbuild_package/all/test_package/test_package.cpp +++ b/docs/package_templates/msbuild_package/all/test_package/test_package.cpp @@ -1,14 +1,19 @@ #include -#include #include "package/foobar.hpp" int main(void) { - std::cout << "Create a minimal usage for the target project here." << std::endl; - std::cout << "Avoid big examples, bigger than 100 lines" << std::endl; - std::cout << "Avoid networking connections." << std::endl; - std::cout << "Avoid background apps or servers." << std::endl; - std::cout << "The propose is testing the generated artifacts only." << std::endl; + /* + * TODO: Remove this comment before pushing the testing code; + * + * Create a minimal usage for the target project here; + * Avoid upstream full examples, or code bigger than 15 lines; + * Avoid networking connections; + * Avoid background apps or servers; + * Avoid GUI apps; + * Avoid extra files like images, sounds and other binaries; + * The propose is testing the generated artifacts ONLY; + */ foobar.print_version(); 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 deleted file mode 100644 index 983c9e84f7828..0000000000000 --- a/docs/package_templates/msbuild_package/all/test_v1_package/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -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++ - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(package REQUIRED CONFIG) - -add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ - ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/docs/package_templates/msbuild_package/config.yml b/docs/package_templates/msbuild_package/config.yml index a885cbf942a74..d07c95e596619 100644 --- a/docs/package_templates/msbuild_package/config.yml +++ b/docs/package_templates/msbuild_package/config.yml @@ -1,5 +1,4 @@ versions: - # Newer versions at the top "1.2.0": folder: all "1.1.0": diff --git a/docs/package_templates/prebuilt_tool_package/all/conandata.yml b/docs/package_templates/prebuilt_tool_package/all/conandata.yml index efcc89654623a..b9d6d85ec79e3 100644 --- a/docs/package_templates/prebuilt_tool_package/all/conandata.yml +++ b/docs/package_templates/prebuilt_tool_package/all/conandata.yml @@ -1,5 +1,4 @@ sources: - # Newer versions at the top "1.2.0": "Windows": "x86_64": diff --git a/docs/package_templates/prebuilt_tool_package/all/conanfile.py b/docs/package_templates/prebuilt_tool_package/all/conanfile.py index f632b6094174c..eb1d1e11e7805 100644 --- a/docs/package_templates/prebuilt_tool_package/all/conanfile.py +++ b/docs/package_templates/prebuilt_tool_package/all/conanfile.py @@ -1,11 +1,11 @@ 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.files import copy, get +from conan.tools.scm import Version import os -required_conan_version = ">=1.47.0" +required_conan_version = ">=2.0" class PackageConan(ConanFile): @@ -16,9 +16,10 @@ class PackageConan(ConanFile): homepage = "https://github.com/project/package" # no "conan" and project name in topics. Use "pre-built" for tooling packages topics = ("topic1", "topic2", "topic3", "pre-built") + package_type = "application" settings = "os", "arch", "compiler", "build_type" # even for pre-built executables - # not needed but supress warning message from conan commands + # not needed but suppress warning message from conan commands def layout(self): pass @@ -36,7 +37,7 @@ def validate(self): def source(self): pass - # download the source here, than copy to package folder + # download the source here, then copy to package folder def build(self): get( self, @@ -47,9 +48,9 @@ def build(self): # copy all needed files to the package folder def package(self): # a license file is always mandatory - copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) - copy(self, pattern="*.exe", dst=os.path.join(self.package_folder, "bin"), src=self.source_folder) - copy(self, pattern="foo", dst=os.path.join(self.package_folder, "bin"), src=self.source_folder) + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + copy(self, "*.exe", self.source_folder, os.path.join(self.package_folder, "bin")) + copy(self, "foo", self.source_folder, os.path.join(self.package_folder, "bin")) def package_info(self): # folders not used for pre-built binaries @@ -57,7 +58,3 @@ def package_info(self): 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/docs/package_templates/prebuilt_tool_package/all/test_package/conanfile.py b/docs/package_templates/prebuilt_tool_package/all/test_package/conanfile.py index b3a58664b7d6b..0358d4cb99039 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 @@ -1,12 +1,12 @@ from conan import ConanFile -from conan.tools.build import can_run +from conan.tools.layout import basic_layout -# It will become the standard on Conan 2.x 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) diff --git a/docs/package_templates/prebuilt_tool_package/all/test_v1_package/conanfile.py b/docs/package_templates/prebuilt_tool_package/all/test_v1_package/conanfile.py deleted file mode 100644 index 36fd085b2d6b7..0000000000000 --- a/docs/package_templates/prebuilt_tool_package/all/test_v1_package/conanfile.py +++ /dev/null @@ -1,13 +0,0 @@ -from conans 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 checks the command exit code - # the tool must be available on PATH, which is configured by self.env_info.PATH - self.run("tool --version", run_environment=True) diff --git a/docs/package_templates/prebuilt_tool_package/config.yml b/docs/package_templates/prebuilt_tool_package/config.yml index a885cbf942a74..d07c95e596619 100644 --- a/docs/package_templates/prebuilt_tool_package/config.yml +++ b/docs/package_templates/prebuilt_tool_package/config.yml @@ -1,5 +1,4 @@ versions: - # Newer versions at the top "1.2.0": folder: all "1.1.0": diff --git a/docs/review_process.md b/docs/review_process.md index 55eadf1bd0738..bae426df1eaf6 100644 --- a/docs/review_process.md +++ b/docs/review_process.md @@ -1,134 +1,69 @@ # Review process Behind the scenes of conan-center-index, there is a heavily automated process to test and merge pull requests. -As there is a lot of activity from many users and various bots (e.g. bumping versions or updating conventions), many PRs are opened every day. +As there is a lot of activity from many users and many PRs are opened every day. conan-center-index tries to make the process as smooth and simple as possible for the contributors, providing feedback in PRs. In this document will explain the review process in detail. ## Contents - * [conan-center-bot](#conan-center-bot) * [Green build](#green-build) * [Unexpected error](#unexpected-error) * [Avoiding conflicts](#avoiding-conflicts) - * [Draft](#draft) * [Getting your pull request reviewed](#getting-your-pull-request-reviewed) * [Rule of 2 reviews](#rule-of-2-reviews) * [Reviews from others](#reviews-from-others) * [Addressing review comments](#addressing-review-comments) - * [Automatic Merges](#automatic-merges) - * [Merge](#merge) - * [Package available to consume](#package-available-to-consume) - * [Updating web front end](#updating-web-front-end) + * [Package available to consume](#package-available-to-consume) + * [Updating web front end](#updating-web-front-end) * [Stale PRs](#stale-prs) -## [conan-center-bot](https://github.com/conan-center-bot) - -In general, reviews are driven by the automated [bot](https://github.com/conan-center-bot). The bot is responsible for: - -- Adding or removing labels (such as [Bump version](https://github.com/conan-io/conan-center-index/pulls?q=is%3Apr+is%3Aopen+label%3A%22Bump+version%22) or [Docs](https://github.com/conan-io/conan-center-index/pulls?q=is%3Apr+is%3Aopen+label%3ADocs)). -- Writing comments (most of the time, it's a build status, either failure with logs or success). -- Merging pull requests. -- Closing issues (after merging pull requests with GitHub keywords). -- Starting CI builds. -- Assigning CI status (running/failed/successful). - ## Green build The first important prerequisite is ensuring your PR is green (build is successful). It requires a bit of patience, because there are many PRs running and we're building a lot of configurations for a numerous versions of libraries. -Keep attention to the error messages from the bot, and address all the build failures. -The bot tries to provide all the helpful information needed to understand and reproduce an issue, such as: - -- The profile that failed (in other words, the configuration: architecture, operation system, compiler, etc.) -- Failed command line (it might have failed on early stages, like recipe syntax errors, hook errors or later stages, like build or test). -- Logs containing the actual output of the build process (note that some logs like *configure.log* or *CMakeError.log* are not captured, only stdout/stderr). +Keep attention to the error messages from the check tab on your PR, and address all the build failures. +The checks tries to provide all the helpful information needed to understand and reproduce an issue. -If you struggle to fix build errors yourself, you may want to ask for help from other users by mentioning (`@`) individual users in the pull request comments. +If you struggle to fix build errors yourself, you may want to ask for help from other users by mentioning (`@conan-io/barbarians`) group in the pull request comments. ### 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. - -To learn more, checkout the [label definition](labels.md#unexpected-error). +Sometimes, build fails with an unexpected error (e.g Pre-Checks hangs forever). This indicates an infrastructure problem, and usually it's unrelated to the changes within PR itself. When this occurs, please, ping `@conan-io/barbarians` in your PR describing your situation. ## Avoiding conflicts -Right now, neither GitHub itself nor conan-center-bot notify about merge conflicts, so it's the contributor's responsibility to periodically check for the conflicts. Pull Requests that have merge conflicts can't be merged, and all the conflicts have to be resolved first. - -Please [synchronize your branch](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork) to take into account the latest changes in the main branch. This is important for ConanCenter to ensure it is building the correct recipe revision, see [this comment](https://github.com/conan-io/conan-center-index/pull/8797#discussion_r781993233) for details. One trick is to look out for comments from the [Community's Conflict PR Bot](https://github.com/prince-chrismc/conan-center-index/blob/patch-41/docs/community_resources.md#bots) which can anticipate possible problems. +Right now, the check `Related Pull Requests` shows other PRs that are affecting the recipe and may result in conflicts, so it's the contributor's responsibility to periodically check for the conflicts. Pull Requests that have merge conflicts can't be merged, and all the conflicts have to be resolved first. -## Draft +In case a PR that affects your recipe is merged first, then, you have to [synchronize your branch](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork) to take into account the latest changes in the main branch. This is important for ConanCenter to ensure it is building the correct recipe revision. -Draft pull requests are also never merged, and they won't likely be reviewed. -Once you're done with your changes, remember to convert from "Draft" to "Normal" pull request. +One trick is to look the [List of open pull requests broken down by recipe](https://github.com/conan-io/conan-center-index/discussions/24240) which can anticipate possible problems. ## Getting your pull request reviewed -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: 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 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. +Each PR must be reviewed before it will be merged. Extra reviews are welcome and appreciated, but the Conan team reviews are required. ### Rule of 2 reviews -At least 2 approving reviews are required, and at least one of them has to be from the official reviewers. -So, it might be 1 official + 1 community, or 2 official, but it couldn't be just 2 community reviews. -Approvals are only counted if they are associated with the latest commit in the PR, while "Change requested" ones (from the Conan team) will persist even if there are new commits. Don't hesitate to dismiss old reviews if the issues have already been addressed. +At least 2 approving reviews are required from maintainers are mandatory to merge a PR. -> **Note** Pull requests labelled as [`Bump version`](https://github.com/conan-io/conan-center-index/pulls?q=is%3Aopen+is%3Apr+label%3A%22Bump+version%22) -> or [`Bump dependencies`](https://github.com/conan-io/conan-center-index/pulls?q=is%3Aopen+is%3Apr+label%3A%22Bump+dependencies%22+) are merged by -> the bot without requiring any approval. +Approvals are only counted if they are associated with the latest commit in the PR, while "Change requested" ones (from the Conan team) will persist even if there are new commits. -### Reviews from others +### Reviews from community -All reviews are still valuable and very helpful. Even if you're not listed as an official or community reviewer, **your reviews are very welcome**, so please do not hesitate to provide them. +All reviews are still valuable and very helpful. ### Addressing review comments Please ensure to address the review comments and respond to them in order to get your PR approved and finally merged. -It doesn't always mean accepting all the suggestions, but at least providing a response, so people can understand your position. - -## Automatic Merges - -The bot runs Automatic Merges every 20 minutes. Currently, it can only merge a single PR in this timeframe, so there is a theoretical limit of ~70 PRs merged per day (in practice, it's even less for reasons listed below). -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 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. -- PR has approved reviews (as described above). -- PR does not have any [official reviewers](#official-reviewers) requesting changes -- Master build is not running already (see below) - -If these conditions are fulfilled, the PR is merged (associated issues are automatically closed), and then the build of `master` is launched. - -The conan-center-bot will perform a [squash and merge](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/about-pull-request-merges#squash-and-merge-your-pull-request-commits). You don't need to rebase -your pull request, we ask you not to do it because it will dismiss any reviews and the reviewer will need to restart. - -### Merge - -After merging a pull request, if an actual merge happened (for instance, the recipe changed in PR was already updated in `master` by the time PR merged), -it will introduce a new recipe revision. Therefore, the build should be run one more time, so the `master` build is launched. -In reality this could happen frequently enough if there are multiple PRs aiming to update the same recipe (even if they touch different files in the same recipe). -Such builds can take hours for big packages (like boost), blocking other merges for a while. -So we really appreciate it if changes in `master` to the same recipe are already merged into the proposed PR. +Be polite and open to suggestions. Also, please, read the [code of conduct](code_of_conduct.md) to understand the expected behavior in the community. -### Package available to consume +## Package available to consume -New packages are promoted from the internal repository to ConanCenter. This process is an internal Artifactory promotion that is quite -fast, nevertheless there are some caches and CDNs that need to be invalidated and propagated before the package is finally available for consumption. -The process can take several minutes, so please, consider a *grace period* and understand that the package won't be available immediately. +New packages are promoted from the internal repository to ConanCenter. +The process can take few minutes, so please, consider a *grace period* and understand that the package won't be available immediately. -### Updating web front end +## Updating web front end [ConanCenter](https://conan.io/center/) doesn't directly pull the information from conan-center-index repository. Instead, it's updated by the conan center CI job as its own step. The metadata from the conan repository is @@ -137,4 +72,4 @@ That may explain the fact there are moments when the information showed in the f ## Stale PRs -Conan Center Index uses [stale bot](https://github.com/probot/stale) to close abandoned pull requests. It's configured by [stale.yml](../.github/stale.yml). When a pull request gets stale, we encourage anyone to take ownership of the PR (even submit changes to the author's branch if possible) so existing work doesn't get lost when the pull request is closed without merging. +Conan Center Index uses [stale bot](https://github.com/probot/stale) to close abandoned pull requests. It's configured by [stale.yml](../.github/workflows/stale.yml). When a pull request gets stale, we encourage anyone to take ownership of the PR (even submit changes to the author's branch if possible) so existing work doesn't get lost when the pull request is closed without merging. diff --git a/docs/supported_platforms_and_configurations.md b/docs/supported_platforms_and_configurations.md index 9fd2c1ecd19c8..d04d4186e6d13 100644 --- a/docs/supported_platforms_and_configurations.md +++ b/docs/supported_platforms_and_configurations.md @@ -4,7 +4,7 @@ ## Contents * [Introduction](#introduction) - * [Build Images](#build-images) + * [Future Steps](#future-steps) * [Windows](#windows) * [Linux](#linux) * [MacOS](#macos) @@ -13,26 +13,28 @@ The pipeline iterates a fixed list of profiles for every Conan reference, it computes the packageID for each profile and discard duplicates. Then it -builds the packages for the remaining profiles and upload them to +builds the packages for the remaining profiles and promoted them to [JFrog ConanCenter](https://conan.io/center/) once the pull-request is merged. -Because duplicated packageIDs are discarded, the pipeline iterates the -profiles always in the same order and the profiles selected to build when -there is a duplicate follow some rules: +Currently, given the following supported platforms and configurations we +are generating **30 different binary packages for a C++ library**. - * Static linkage (option `shared=False`) is preferred over dynamic linking. - * On Windows, `MT/MTd` runtime linkage goes before `MD/MDd` linkage. - * Optimized binaries (`build_type=Release`) are preferred over its _debug_ counterpart. - * Older compiler versions are considered first. - * In Linux, GCC is iterated before Clang. -Currently, given the following supported platforms and configurations we -are generating **136 different binary packages for a C++ library** -and **88 for a C library**. +### Future Steps -### Build Images +With the introduction of our new, more flexible pipeline, +we will be implementing several enhancements to improve our build capabilities and support +a wider range of development environments. The following steps will be taken: -For more information see [conan-io/conan-docker-tools](https://github.com/conan-io/conan-docker-tools) +- Incorporate additional modern GCC versions for Linux builds: + - By adding the latest versions of GCC, we aim to ensure compatibility with the newest C++ standards and features, allowing developers to leverage the latest advancements in the language. +- Integrate more recent Clang versions for Linux builds: + - Clang is known for its fast compilation times and excellent diagnostics. By including more modern versions, we will provide developers with improved performance and better error reporting, enhancing the overall development experience. +- Include updated Apple-Clang versions for macOS builds: + - As macOS continues to evolve, it is crucial to support the latest Apple-Clang versions. This will ensure that our builds are optimized for the latest macOS features and provide a seamless experience for developers working in the Apple ecosystem. +- Add support for Android builds to the pipeline: + - Expanding our pipeline to include Android builds will enable developers to create and test applications for mobile platforms more efficiently. + This addition will help streamline the development process and ensure that our tools are versatile and adaptable to various environments. ## Windows @@ -42,46 +44,39 @@ For more information see [conan-io/conan-docker-tools](https://github.com/conan- > 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.30147) - -- Release (MT/MD) and Debug (MTd, MDd) + - 2019 (19.29.30148) + - Architectures: x86_64 -- Build types: Release, Debug -- Runtimes: MT/MD (Release), MTd/MDd (Debug) +- Build types: Release +- Runtime: dynamic (MD) - Options: - - Shared, Static (option `"shared": [True, False]` in the recipe when available) - - Header Only (option `"header_only": [True, False]` if available) - -> :warning: The profile with the option `shared=True` and runtime `MT/MTd` is not built. + - Shared, Static (option `"*/*:shared": [True, False]` in the recipe when available) + - Header Only (option `"&:header_only": [True, False]` is only added with the value True) ## Linux -- Python: 3.7.13 -- CMake: 3.15.7, 3.18.2 (same version expected after all use [new docker images](https://github.com/conan-io/conan-docker-tools/tree/master/modern)) +- Python: 3.7.17 +- CMake: 3.15.7, 3.18.6 (same version expected after all use [new docker images](https://github.com/conan-io/conan-docker-tools/tree/master/images)) - Compilers: - - GCC versions: 5, 7, 8, 9, 10, 11 - - Clang versions: 11, 12, 13 + - GCC versions: 11 - C++ Standard Library (`libcxx`): - - GCC compiler: `libstdc++`, `libstdc++11` - - Clang compiler: `libstdc++`, `libc++` + - GCC compiler: `libstdc++11` - Architectures: x86_64 -- Build types: Release, Debug +- Build types: Release - Options: - - Shared, Static (option `"shared": [True, False]` in the recipe when available) - - Header Only (option `"header_only": [True, False]` is only added with the value True) + - Shared, Static (option `"*/*:shared": [True, False]` in the recipe when available) + - Header Only (option `"&:header_only": [True, False]` is only added with the value True) ## MacOS - 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 +- Compilers: Apple-clang versions 13.0.0 +- Macos SDK versions (for each apple-clang version respectively): 11.3 - Macos deployment target (`minos`): 11.0 - C++ Standard Library (`libcxx`): `libc++` -- Architectures: x86_64, armv8 -- Build types: Release, Debug +- Architectures: armv8 +- Build types: Release - Options: - - Shared, Static (option ``"shared": [True, False]`` in the recipe when available) - - Header Only (option `"header_only": [True, False]` is only added with the value True) + - Shared, Static (option `"*/*:shared": [True, False]` in the recipe when available) + - Header Only (option `"&:header_only": [True, False]` is only added with the value True) diff --git a/docs/v2_linter.md b/docs/v2_linter.md deleted file mode 100644 index a2358f657f524..0000000000000 --- a/docs/v2_linter.md +++ /dev/null @@ -1,71 +0,0 @@ -# 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 -raise some warnings and errors that should be addressed in order to migrate the -recipes to Conan v2. - -It is important to note that these rules are targeting Conan v2 compatibility layer, their -purpose is to fail for v1 syntax that will be no longer available in v2. Even if the syntax -if perfectly valid in Conan v1, the recipe might fail here because it is not v2-compliant. - -> **Note** Some of the errored checks might be just plain Python syntax errors, while -> others might be related to the custom rules added by us. - -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 -module `conan`: - -```python -from conan import ConanFile -``` - -## Import tools from `conan` - -All v2-compatible tools are available in module `conan.tools` under different submodules. Recipes -should start to import their tools from this new module. Some of the new tools accept new -argument, please, check the [Conan documentation](https://docs.conan.io/en/latest/reference/conanfile/tools.html). - -Here is a list of different imports and their new equivalent (note that the interface for most of this functions changed, see their respective link to the documentation): - -| **Conan v1** | **Conan v2** | **Required Conan Version** | -|---|---|---| -| conans.tools.get | [conan.tools.files.get](https://docs.conan.io/en/latest/reference/conanfile/tools/files/downloads.html#conan-tools-files-get) | 1.41.0 | -| conans.tools.download | [conan.tools.files.download](https://docs.conan.io/en/latest/reference/conanfile/tools/files/downloads.html#conan-tools-files-download) | 1.41.0 | -| conans.tools.rmdir | [conan.tools.files.rmdir](https://docs.conan.io/en/latest/reference/conanfile/tools/files/basic.html#conan-tools-files-rmdir) | 1.47.0 | -| conans.tools.patch | [conan.tools.files.patch](https://docs.conan.io/en/latest/reference/tools.html#tools-patch) | 1.35.0 | -| conans.tools.remove_files_by_mask | [conan.tools.files.rm](https://docs.conan.io/en/latest/reference/conanfile/tools/files/basic.html#conan-tools-files-rm) | 1.50.0 | -| conans.copy | [conan.tools.files.copy](https://docs.conan.io/en/latest/reference/conanfile/tools/files/basic.html#conan-tools-files-copy) | 1.46.0 | -| conans.tools.load | [conan.tools.files.load](https://docs.conan.io/en/latest/reference/conanfile/tools/files/basic.html#conan-tools-files-load) | 1.35.0 | -| conans.tools.save | [conan.tools.files.save](https://docs.conan.io/en/latest/reference/conanfile/tools/files/basic.html#conan-tools-files-save) | 1.35.0 | -| conans.tools.rename | [conan.tools.files.rename](https://docs.conan.io/en/latest/reference/conanfile/tools/files/basic.html#conan-tools-files-rename) | 1.37.0 | -| conans.tools.replace_in_file | [conan.tools.files.replace_in_file](https://docs.conan.io/en/latest/reference/conanfile/tools/files/basic.html#conan-tools-files-replace-in-file) | 1.46.0 | -| conans.tools.mkdir | [conan.tools.files.mkdir](https://docs.conan.io/en/latest/reference/conanfile/tools/files/basic.html#conan-tools-files-mkdir) | 1.35.0 | -| conans.tools.chdir | [conan.tools.files.chdir](https://docs.conan.io/en/latest/reference/conanfile/tools/files/basic.html#conan-tools-files-chdir) | 1.40.0 | -| conans.tools.unzip | [conan.tools.files.unzip](https://docs.conan.io/en/latest/reference/conanfile/tools/files/basic.html#conan-tools-files-unzip) | 1.46.0 | -| conans.tools.collect_libs | [conan.tools.files.collect_libs](https://docs.conan.io/en/latest/reference/conanfile/tools/files/basic.html#conan-tools-files-collect-libs) | 1.46.0 | -| conans.tools.Version | [conan.tools.scm.Version](https://docs.conan.io/en/latest/reference/conanfile/tools/scm/other.html#version) | 1.46.0 | -| conans.tools.sha256sum | [conan.tools.files.check_sha256](https://docs.conan.io/en/latest/reference/conanfile/tools/files/checksum.html#conan-tools-files-check-sha256) | 1.46.0 | -| conans.tools.unix_path | [conan.tools.microsoft.unix_path](https://docs.conan.io/en/latest/reference/conanfile/tools/microsoft.html#conan-tools-microsoft-unix-path) | 1.47.0 | -| conans.tools.is_apple_os | [conan.tools.apple.is_apple_os](https://docs.conan.io/en/latest/reference/conanfile/tools/apple.html#is-apple-os) | 1.51.3 | -| conans.tools.cpu_count | [conan.tools.build.build_jobs](https://docs.conan.io/en/latest/reference/conanfile/tools/build.html#conan-tools-build-build-jobs) | 1.43.0 | -| conans.tools.check_min_cppstd | [conan.tools.build.check_min_cppstd](https://docs.conan.io/en/latest/reference/conanfile/tools/build.html#conan-tools-build-check-min-cppstd) | 1.50.0 | -| conans.tools.cross_building | [conan.tools.build.cross_building](https://docs.conan.io/en/latest/reference/conanfile/tools/build.html#conan-tools-build-cross-building) | 1.46.0 | -| 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 | - ---- diff --git a/docs/v2_migration.md b/docs/v2_migration.md deleted file mode 100644 index 3a8ebff66e879..0000000000000 --- a/docs/v2_migration.md +++ /dev/null @@ -1,509 +0,0 @@ -# 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) - * [Translating .names information to cmake_target_name, cmake_module_target_name and cmake_file_name](#translating-names-information-to-cmake_target_name-cmake_module_target_name-and-cmake_file_name) - * [Translating .filenames information to cmake_file_name, cmake_module_file_name and cmake_find_mode](#translating-filenames-information-to-cmake_file_name-cmake_module_file_name-and-cmake_find_mode) - * [Understanding some workarounds with the .names attribute model in recipes](#understanding-some-workarounds-with-the-names-attribute-model-in-recipes) - * [Translating .build_modules to cmake_build_modules](#translating-build_modules-to-cmake_build_modules) - * [PkgConfigDeps](#pkgconfigdeps) - -> **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 -changes and improvements, you can read about them in the -[Conan documentation](https://docs.conan.io/en/latest/conan_v2.html). - -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 -[CMakeDeps](https://docs.conan.io/en/latest/reference/conanfile/tools/cmake/cmakedeps.html) -and -[PkgConfigDeps](https://docs.conan.io/en/latest/reference/conanfile/tools/gnu/pkgconfigdeps.html), -don't listen to *cpp_info* ``.names``, ``.filenames`` or ``.build_modules`` attributes. -There is a new way of setting the *cpp_info* information with these -generators using the ``set_property(property_name, value)`` method. - -All the information in the recipes, already set with the current model, should be -translated to the new model. These two models **will live together in recipes** to make -recipes compatible **with both new and current generators** for some time. After a stable -Conan 2.0 version is released, and when the moment arrives that we don't support the -current generators anymore in Conan Center Index, those attributes (``.names``, -``.filenames`` etc.) will disappear from recipes, and only ``set_property`` methods will -stay. - -We will cover some cases of porting all the information set with the current model to the -new one. To read more about the properties available for each generator and how the -properties model work, please check the [Conan documentation](https://docs.conan.io/en/latest/conan_v2.html#editables-don-t-use-external-templates-any-more-new-layout-model). - -> **Note**: Please, remember that the **new** ``set_property`` and the **current** attributes -> model are *completely independent since Conan 1.43*. Setting ``set_property`` in recipes will -> not affect current CMake 1.X generators (``cmake``, ``cmake_multi``, ``cmake_find_package`` and -> ``cmake_find_package_multi``) at all. - -### CMakeDeps - -### Update required_conan_version to ">=1.43.0" - -If you set the property ``cmake_target_name`` in the recipe, the Conan minimum -required version should be updated to 1.43. - -```python - -required_conan_version = ">=1.43.0" - -class GdalConan(ConanFile): - name = "gdal" - ... -``` - -The reason for this change is that in Conan versions previous to 1.43 the -``cmake_target_name`` values were not the final CMake target names. Those values were -completed by Conan, adding namespaces automatically the final target names. After 1.43 -``cmake_target_name`` sets the **complete target name** that is added to the ``.cmake`` -files generated by Conan. Let's see an example: - -```python -class GdalConan(ConanFile): - name = "gdal" - ... - def package_info(self): - # Before 1.43 -> Conan adds GDAL:: namespace -> Creates target with name GDAL::GDAL - # self.cpp_info.set_property("cmake_target_name", "GDAL") - - # After 1.43 -> Conan creates target with name GDAL::GDAL - self.cpp_info.set_property("cmake_target_name", "GDAL::GDAL") -``` - -### Translating .names information to cmake_target_name, cmake_module_target_name and cmake_file_name - -To translate the ``.names`` information to the new model there are some important things to -take into account: - -* The value of the ``.names`` attribute value in recipes is just a part of the final - target name for CMake generators. Conan will complete the rest of the target name by - pre-pending a namespace (with ``::`` separator) to the ``.names`` value. This namespace takes - the same value as the ``.names`` value. Let's see an example: - -```python -class SomePkgConan(ConanFile): - name = "somepkg" - ... - def package_info(self): - self.cpp_info.names["cmake_find_package"] = "some-pkg" - self.cpp_info.names["cmake_find_package_multi"] = "some-pkg" - ... -``` - -This recipe generates the target ``some-pkg::some-pkg`` for both the -``cmake_find_package`` and the ``cmake_find_package_multi`` generators. Also, please -remember that if no ``.names`` attribute were set, Conan would create the target -``somepkg::somepkg`` for both generators by default. - -As we explained before, the ``cmake_target_name`` sets the **complete target name**, so, -to translate this information to the new model we should add the following lines: - -```python -class SomePkgConan(ConanFile): - name = "somepkg" - ... - def package_info(self): - self.cpp_info.names["cmake_find_package"] = "some-pkg" - self.cpp_info.names["cmake_find_package_multi"] = "some-pkg" - # CMakeDeps does NOT add any namespace automatically - self.cpp_info.set_property("cmake_target_name", "some-pkg::some-pkg") - ... -``` - -* If ``.filenames`` attribute is not set, it will fall back on the ``.names`` value to - generate the files. Both the ``Find.cmake`` and ``-config.cmake`` files that - store the dependencies will take the ``.names`` value to create the complete filename. - For the previous example, to translate all the information from the current model to the - new one, we should have added one more line setting the ``cmake_file_name`` value. - -```python -class SomePkgConan(ConanFile): - name = "somepkg" - ... - def package_info(self): - # These generators fallback the filenames for the .cmake files - # in the .names attribute value and generate - self.cpp_info.names["cmake_find_package"] = "some-pkg" # generates module file Findsome-pkg.cmake - self.cpp_info.names["cmake_find_package_multi"] = "some-pkg" # generates config file some-pkg-config.cmake - - self.cpp_info.set_property("cmake_target_name", "some-pkg::some-pkg") - self.cpp_info.set_property("cmake_file_name", "some-pkg") # generates config file some-pkg-config.cmake - ... -``` - -Please note that if we hadn't set the ``cmake_file_name`` property, the ``CMakeDeps`` -generator would have taken the package name to generate the filename for the config file -and the generated filename would have resulted ``somepkg-config.cmake`` instead of -``some-pkg-config.cmake``. - -* Some recipes in Conan Center Index define different ``.names`` values for ``cmake_find_package`` - and ``cmake_find_package_multi``. For these cases, besides ``cmake_target_name`` you should also set - the ``cmake_module_target_name`` and ``cmake_find_mode`` properties. Let's see an example: - -```python -class ExpatConan(ConanFile): - name = "expat" - ... - def package_info(self): - # creates EXPAT::EXPAT target for module files FindEXPAT.cmake - self.cpp_info.names["cmake_find_package"] = "EXPAT" - # creates expat::expat target for config files expat-config.cmake - self.cpp_info.names["cmake_find_package_multi"] = "expat" - ... -``` - -Should translate to the code above. Please note we have added the ``cmake_find_mode`` -property for the -[CMakeDeps](https://docs.conan.io/en/latest/reference/conanfile/tools/cmake/cmakedeps.html#properties) -generator with value ``both``. - -```python -class ExpatConan(ConanFile): - name = "expat" - ... - def package_info(self): - self.cpp_info.names["cmake_find_package"] = "EXPAT" - self.cpp_info.names["cmake_find_package_multi"] = "expat" - - # creates EXPAT::EXPAT target for module files FindEXPAT.cmake - self.cpp_info.set_property("cmake_target_name", "EXPAT::EXPAT") - # creates expat::expat target for config files expat-config.cmake - self.cpp_info.set_property("cmake_module_target_name", "expat::expat") - - # generates module file FindEXPAT.cmake - self.cpp_info.set_property("cmake_file_name", "EXPAT") - # generates config file expat-config.cmake - self.cpp_info.set_property("cmake_module_file_name", "expat") - - # config is the default for CMakeDeps - # we set cmake_find_mode to both to generate both module and config files - self.cpp_info.set_property("cmake_find_mode", "both") - ... -``` - -> *Note**: There are more cases in which you probably want to set the -> ``cmake_find_mode`` property to ``both``. For example, for the libraries which [find -> modules files are included in the CMake -> distribution](https://cmake.org/cmake/help/latest/manual/cmake-modules.7.html#find-modules). - -### Translating .filenames information to cmake_file_name, cmake_module_file_name and cmake_find_mode - -Like in the ``.names`` case, there are some cases in Conan Center Index of recipes that -set different filenames for ``cmake_find_package`` and ``cmake_find_package_multi`` -generators. To translate that information to the ``set_property`` model we have to set the -``cmake_file_name`` and ``cmake_find_mode`` properties. Let's see an example: - -```python -class GlewConan(ConanFile): - name = "glew" - ... - def package_info(self): - self.cpp_info.names["cmake_find_package"] = "GLEW" - self.cpp_info.names["cmake_find_package_multi"] = "GLEW" - self.cpp_info.filenames["cmake_find_package"] = "GLEW" # generates FindGLEW.cmake - self.cpp_info.filenames["cmake_find_package_multi"] = "glew" # generates glew-config.cmake - ... -``` - -In this case we have to set the ``cmake_find_mode`` property for the -[CMakeDeps](https://docs.conan.io/en/latest/reference/conanfile/tools/cmake/cmakedeps.html#properties) -generator with value ``both``. That will make CMakeDeps generator create both module and -config files for consumers (by default it generates just config files). - -```python -class GlewConan(ConanFile): - name = "glew" - ... - def package_info(self): - self.cpp_info.names["cmake_find_package"] = "GLEW" - self.cpp_info.names["cmake_find_package_multi"] = "GLEW" - self.cpp_info.filenames["cmake_find_package"] = "GLEW" - self.cpp_info.filenames["cmake_find_package_multi"] = "glew" - - self.cpp_info.set_property("cmake_target_name", "GLEW::GLEW") - - self.cpp_info.set_property("cmake_file_name", "GLEW") # generates FindGLEW.cmake - self.cpp_info.set_property("cmake_module_file_name", "glew") # generates glew-config.cmake - - # generate both modules and config files - self.cpp_info.set_property("cmake_find_mode", "both") - ... -``` - -### Understanding some workarounds with the .names attribute model in recipes - -The ``.names`` model has some limitations. Because of this, there are some recurrent -workarounds in recipes to achieve things like setting absolute names for targets (without -the ``::`` namespace), or for setting a custom namespace. These workarounds can now be -undone with the ``set_property`` model because it allows setting arbitrary names for CMake -targets. Let's see some examples of these workarounds in recipes: - -* **Use of components to get arbitrary target names in recipes**. Some recipes add a component - whose only role is to get a target name that is not limited by the namespaces added by - the current generators automatically. For example, the [ktx - recipe](https://github.com/conan-io/conan-center-index/blob/5753f954027d9d04b6d05e326f2757ab6b1ac69c/recipes/ktx/all/conanfile.py) - uses this workaround to get a target with name ``KTX::ktx``. - -```python -class KtxConan(ConanFile): - name = "ktx" - ... - - def package_info(self): - # changes namespace to KTX:: - self.cpp_info.names["cmake_find_package"] = "KTX" - ... - # the target inherits the KTX:: namespace and sets the target KTX::ktx - self.cpp_info.components["libktx"].names["cmake_find_package"] = "ktx" - ... - # all the information is set via this "fake root" component - self.cpp_info.components["libktx"].libs = ["ktx"] - self.cpp_info.components["libktx"].defines = [ - "KTX_FEATURE_KTX1", "KTX_FEATURE_KTX2", "KTX_FEATURE_WRITE" - ] - ... -``` - -In these cases, the recommendation is to add the ``cmake_target_name`` property for both -the root and component ``cpp_info``. In the end the target that the consumer will get is -the one created for the component, but it will avoid creating an "unwanted" target if we -add the property just to the component or to the root ``cpp_info``. Please note that when -the migration to Conan 2.0 is done, there will be no need for that component anymore and -it should dissapear. At that moment, the information from the component will be set in the -root ``cpp_info`` and the ``self.cpp_info.components[]`` lines removed. - -```python -class KtxConan(ConanFile): - name = "ktx" - ... - - def package_info(self): - self.cpp_info.names["cmake_find_package"] = "KTX" - ... - # FIXME: Remove the libktx component in Conan 2.0, this is just needed for - # compatibility with current generators - self.cpp_info.components["libktx"].names["cmake_find_package"] = "ktx" - ... - self.cpp_info.components["libktx"].libs = ["ktx"] - self.cpp_info.components["libktx"].defines = [ - "KTX_FEATURE_KTX1", "KTX_FEATURE_KTX2", "KTX_FEATURE_WRITE" - ] - - # Set the root cpp_info target name as KTX::ktx for the root and the component - # In Conan 2.0 the component should be removed - # and those properties should be added to the root cpp_info instead - self.cpp_info.set_property("cmake_target_name", "KTX::ktx") - self.cpp_info.components["libktx"].set_property("cmake_target_name", "KTX::ktx") - ... -``` - -* **Use build modules to create aliases with arbitray names for targets**. Similar to the - previous example, some recipes use a build module with an alias to set an arbitrary - target name. Let's see the example of the [tensorflow-lite - recipe](https://github.com/conan-io/conan-center-index/blob/03b24bf128cbf15d23ed988b8d8ca0c0ba87d307/recipes/tensorflow-lite/all/conanfile.py), - that uses this workaround to define a ``tensorflow::tensorflowlite`` target. - -```python -class TensorflowLiteConan(ConanFile): - name = "tensorflow-lite" - ... - - def package_info(self): - # generate the target tensorflowlite::tensorflowlite - self.cpp_info.names["cmake_find_package"] = "tensorflowlite" - self.cpp_info.filenames["cmake_find_package"] = "tensorflowlite" - # this build module defines an alias tensorflow::tensorflowlite to the tensorflowlite::tensorflowlite generated target - self.cpp_info.build_modules["cmake_find_package"] = [os.path.join(self._module_subfolder, self._module_file)] - ... -``` - -To translate this information to the new model, just check which aliases are defined in the -build modules and define those for the new model. In this case it should be enough with -adding the ``tensorflow::tensorflowlite`` target with ``cmake_target_name`` to the root -cpp_info (besides the ``cmake_file_name``property). - -```python -class TensorflowLiteConan(ConanFile): - name = "tensorflow-lite" - ... - - def package_info(self): - self.cpp_info.names["cmake_find_package"] = "tensorflowlite" - self.cpp_info.filenames["cmake_find_package"] = "tensorflowlite" - self.cpp_info.build_modules["cmake_find_package"] = [os.path.join(self._module_subfolder, self._module_file)] - - # set the tensorflowlite::tensorflowlite target name directly for CMakeDeps with no need for aliases - self.cpp_info.set_property("cmake_target_name", "tensorflow::tensorflowlite") - self.cpp_info.set_property("cmake_file_name", "tensorflowlite") - ... -``` - -### Translating .build_modules to cmake_build_modules - -Previously we saw that some recipes use a build module with an alias to set an arbitrary target name. -But sometimes the declared ".build_modules" come from the original package that declares useful CMake functions, variables -etc. We need to use the property `cmake_build_modules` to declare a list of cmake files instead of using `cpp_info.build_modules`: - -```python -class PyBind11Conan(ConanFile): - name = "pybind11" - ... - - def package_info(self): - ... - for generator in ["cmake_find_package", "cmake_find_package_multi"]: - self.cpp_info.components["main"].build_modules[generator].append(os.path.join("lib", "cmake", "pybind11", "pybind11Common.cmake")) - ... - -``` - -To translate this information to the new model we declare the `cmake_build_modules` property in the `root cpp_info` object: - -```python -class PyBind11Conan(ConanFile): - name = "pybind11" - ... - - def package_info(self): - ... - self.cpp_info.set_property("cmake_build_modules", [os.path.join("lib", "cmake", "pybind11", "pybind11Common.cmake")]) - ... - -``` - -### PkgConfigDeps - -The case of ``PkgConfigDeps`` is much more straight forward than the ``CMakeDeps`` case. -This is because the current -[pkg_config](https://docs.conan.io/en/latest/reference/generators/pkg_config.html) -generator suports the new ``set_property`` model for most of the properties. Then, the current -model can be translated to the new one without having to leave the old attributes in the -recipes. Let's see an example: - -```python -class AprConan(ConanFile): - name = "apr" - ... - def package_info(self): - self.cpp_info.names["pkg_config"] = "apr-1" - ... -``` - -In this case, you can remove the ``.names`` attribute and just leave: - -```python -class AprConan(ConanFile): - name = "apr" - ... - def package_info(self): - self.cpp_info.set_property("pkg_config_name", "apr-1") - ... -``` - -For more information about properties supported by ``PkgConfigDeps`` generator, please check the [Conan -documentation](https://docs.conan.io/en/latest/reference/conanfile/tools/gnu/pkgconfigdeps.html#properties). diff --git a/docs/v2_roadmap.md b/docs/v2_roadmap.md deleted file mode 100644 index 99e93b1464007..0000000000000 --- a/docs/v2_roadmap.md +++ /dev/null @@ -1,144 +0,0 @@ -# Road to Conan v2 - - -## Contents - - * [Short term](#short-term) - * [Prepare the CI infrastructure](#prepare-the-ci-infrastructure) - * [Export recipes using Conan v2 (warning)](#export-recipes-using-conan-v2-warning) - * [Prepare a syntax linter (CCI specific)](#prepare-a-syntax-linter-cci-specific) - * [Run an scheduled job exporting all recipes](#run-an-scheduled-job-exporting-all-recipes) - * [Mid term](#mid-term) - * [Add CI running Conan v2 (hidden)](#add-ci-running-conan-v2-hidden) - * [Show CI results to contributors (info)](#show-ci-results-to-contributors-info) - * [Linter - turn more warnings to errors](#linter---turn-more-warnings-to-errors) - * [Export using Conan v2 becomes an error](#export-using-conan-v2-becomes-an-error) - * [Long term](#long-term) - * [CI running v2 is reported (and required)](#ci-running-v2-is-reported-and-required) - * [Conan v2 remote](#conan-v2-remote) - * [Webpage with v2 information](#webpage-with-v2-information) - * [Future](#future) - -> **Note** This document is not a [guide about how to migrate recipes to Conan v2](v2_migration.md). - -> **Note** This is a working document that will be updated as we walk -> this path. There are no dates intentionally, and if any they should be -> considered as an estimation, there are still some unknowns to provide -> certain steps and dates. - -Conan v2 is under heavy development and it will be released in the -following months. It comes with many improvements that will benefit -recipes and users, and we are willing to adopt it. - -It is a new major version that will come with many breaking changes. Lot -of the features and syntax that we were used to in Conan v1 will no longer -be available and will be supersedes by improved alternatives. All these -alternatives should be backported to v1.x releases, so **there will be a -subset of features that will work using Conan v1 and v2**. - -**Our main goal in ConanCenter during this migration process is to ensure -that recipes work with v1 and v2** and to make the transition as smooth as -possible for contributors and users. In the end we will be providing -working recipes and binaries for both versions. - -This process will require a lot of work also in the internals, we will keep -communicating those changes and the relevant updates in the -[changelog](changelog.md). Here there are the main steps that we are -planning for the following months. - -## Short term - -### Prepare the CI infrastructure - -Workers for Conan v2 will be ready for Windows, Macos and Linux alternatives. -[Modern docker images](https://github.com/conan-io/conan-docker-tools/tree/master/modern) with Conan v2 are already -available to use, for example `conanio/gcc11-ubuntu16.04:2.0.0-pre`. -Note that we will be using tag name `2.0.0-pre` until there is an -actual Conan v2 release, this tag will use the latest pre-release -available (alpha, beta or release candidate). - -### Export recipes using Conan v2 (warning) - -We will start to run `conan export` using Conan v2 and the result will be -added to the comments by the bot. Failing this command won't make the -pull-request fail at this moment, but we expect contributors to start -gaining awareness about changes in Conan v2. - -### Prepare a syntax linter (CCI specific) - -We want to provide a Conan recipe's linter in this repository. We will add -warnings and errors to it following the pace dictated by the community. -The purpose is that this linter will fail pull-requests if there is any -error and, this way, we can start to migrate small (and easy) bits of -recipes... and ensure that future pull-requests don't introduce -regressions. - -This linter can (and surely will) implement some of the checks that are -being currently done by [hooks](https://github.com/conan-io/hooks), but -the purpose is not replace them: - -* hooks are really useful from the CLI, and are easier to install and run. -* linter provides much better output in GitHub interface. - -### Run an scheduled job exporting all recipes - -The same way we [export all the recipes every night using Conan v1](https://github.com/conan-io/conan-center-index/issues/2232), we will -run something similar using Conan v2 and report the results to an issue in -this repository. - -It will help us to know how many recipes are fixed at a given time and -think about efforts and impact of next steps. - -## Mid term - -### Add CI running Conan v2 (hidden) - -We will start working on a CI running Conan v2. Once recipes start to be -exported successfully, next step is to start building the packages. - -We are going to prepare the CI and start running it behind the scenes -(sorry, at this moment hidden to users) in order to understand and -experiment ourself some challenges that will come with Conan v2: syntax, -configuration defaults,... - -### Show CI results to contributors (info) - -Once the errors start to make sense, we will start to provide these outputs -in pull-requests (although successful builds using v2 won't be required to -merge). Again, we expect some contributors to be aware of these errors, -maybe try to fix those builds, and for sure report feedback. - -### Linter - turn more warnings to errors - -During all this time, the plan is to move linter warnings to errors, one -by one and taking into account the effort required to fix them. With the -help of the linter more recipes should start to work (just `conan export`) -using Conan v2. - -### Export using Conan v2 becomes an error - -When a significant number (TBD) of recipes start to be exported -successfully, we will turn those export warnings into actual errors and -they will be become required to merge the pull-requests - -## Long term - -### CI running v2 is reported (and required) - -Next step is to start running and reporting the results of the builds using -v2 for all the configurations, like we do for Conan v1. At this time all -pull-requests need to work with v1 and v2 to be merged. - -### Conan v2 remote - -TBD. Packages built using Conan v2 will become available for users - -### Webpage with v2 information - -ConanCenter webpage will start to show relevant information related to v2 -packages and, eventually, v2 information will be the only available. - -## Future - -After this process in completed, we will consider the deprecation and -decommission of the infrastructure to generate v1 packages. diff --git a/linter/check_import_conanfile.py b/linter/check_import_conanfile.py deleted file mode 100644 index bd5a90391b096..0000000000000 --- a/linter/check_import_conanfile.py +++ /dev/null @@ -1,28 +0,0 @@ - -from pylint.checkers import BaseChecker -from pylint.interfaces import IAstroidChecker -from astroid import nodes, Const, AssignName - - -class ImportConanFile(BaseChecker): - """ - Import ConanFile from new 'conan' module - """ - - __implements__ = IAstroidChecker - - name = "conan-import-conanfile" - msgs = { - "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.", - ), - } - - def visit_importfrom(self, node: nodes.ImportFrom) -> None: - basename = node.modname - if basename == 'conans': - names = [name for name, _ in node.names] - if 'ConanFile' in names: - self.add_message("conan-import-conanfile", node=node) diff --git a/linter/check_import_errors.py b/linter/check_import_errors.py deleted file mode 100644 index b6a0ac1aa9973..0000000000000 --- a/linter/check_import_errors.py +++ /dev/null @@ -1,77 +0,0 @@ - -from pylint.checkers import BaseChecker -from pylint.interfaces import IAstroidChecker -from astroid import nodes, Const, AssignName - - -class ImportErrors(BaseChecker): - """ - Import errors from new 'conan' module - """ - - __implements__ = IAstroidChecker - - name = "conan-import-errors" - msgs = { - "E9008": ( - "Import errors from new module: `from conan import errors`. Old import is deprecated in Conan v2.", - "conan-import-errors", - "Import errors from new module: `from conan import errors`. Old import is deprecated in Conan v2.", - ), - } - - def visit_importfrom(self, node: nodes.ImportFrom) -> None: - basename = node.modname - if basename == 'conans': - names = [name for name, _ in node.names] - if 'errors' in names: - self.add_message("conan-import-errors", node=node) - - -class ImportErrorsConanException(BaseChecker): - """ - Import errors from new 'conan' module - """ - - __implements__ = IAstroidChecker - - name = "conan-import-error-conanexception" - msgs = { - "E9009": ( - "Import ConanException from new module: `from conan.errors import ConanException`. Old import is deprecated in Conan v2.", - "conan-import-error-conanexception", - "Import ConanException from new module: `from conan.errors import ConanException`. Old import is deprecated in Conan v2.", - ), - } - - def visit_importfrom(self, node: nodes.ImportFrom) -> None: - basename = node.modname - if basename == 'conans.errors': - names = [name for name, _ in node.names] - if 'ConanException' in names: - self.add_message("conan-import-error-conanexception", node=node) - - -class ImportErrorsConanInvalidConfiguration(BaseChecker): - """ - Import errors from new 'conan' module - """ - - __implements__ = IAstroidChecker - - name = "conan-import-error-conaninvalidconfiguration" - msgs = { - "E9010": ( - "Import ConanInvalidConfiguration from new module: `from conan.errors import ConanInvalidConfiguration`. Old import is deprecated in Conan v2.", - "conan-import-error-conaninvalidconfiguration", - "Import ConanInvalidConfiguration from new module: `from conan.errors import ConanInvalidConfiguration`. Old import is deprecated in Conan v2.", - ), - } - - def visit_importfrom(self, node: nodes.ImportFrom) -> None: - basename = node.modname - if basename == 'conans.errors': - names = [name for name, _ in node.names] - if 'ConanInvalidConfiguration' in names: - self.add_message("conan-import-error-conaninvalidconfiguration", node=node) - diff --git a/linter/check_import_tools.py b/linter/check_import_tools.py deleted file mode 100644 index 1621c7b3dfd2a..0000000000000 --- a/linter/check_import_tools.py +++ /dev/null @@ -1,30 +0,0 @@ -import re -from email.mime import base -from pylint.checkers import BaseChecker -from pylint.interfaces import IAstroidChecker -from astroid import nodes, Const, AssignName - - -class ImportTools(BaseChecker): - """ - Import tools following pattern 'from conan.tools.xxxx import yyyyy' - """ - - __implements__ = IAstroidChecker - - name = "conan-import-tools" - msgs = { - "E9011": ( - "Import tools following pattern 'from conan.tools.xxxx import yyyyy' (https://docs.conan.io/en/latest/reference/conanfile/tools.html).", - "conan-import-tools", - "Import tools following pattern 'from conan.tools.xxxx import yyyyy' (https://docs.conan.io/en/latest/reference/conanfile/tools.html).", - ), - } - - def visit_importfrom(self, node: nodes.ImportFrom) -> None: - basename = node.modname - names = [name for name, _ in node.names] - if basename == 'conan' and 'tools' in names: - self.add_message("conan-import-tools", node=node) - elif re.match(r'conan\.tools\.[^.]+\..+', basename): - self.add_message("conan-import-tools", node=node) diff --git a/linter/check_layout_src_folder.py b/linter/check_layout_src_folder.py deleted file mode 100644 index 592565dae0b44..0000000000000 --- a/linter/check_layout_src_folder.py +++ /dev/null @@ -1,44 +0,0 @@ -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", "vs_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/check_no_test_package_name.py b/linter/check_no_test_package_name.py deleted file mode 100644 index 6a927475b4bb9..0000000000000 --- a/linter/check_no_test_package_name.py +++ /dev/null @@ -1,30 +0,0 @@ -from pylint.checkers import BaseChecker -from pylint.interfaces import IAstroidChecker -from astroid import nodes, Const, AssignName - - -class NoPackageName(BaseChecker): - """ - Conanfile used for testing a package should NOT provide a name - """ - - __implements__ = IAstroidChecker - - name = "conan-test-package-name" - msgs = { - "E9007": ( - "No 'name' attribute in test_package conanfile", - "conan-test-no-name", - "No 'name' attribute in test_package conanfile." - ) - } - - def visit_classdef(self, node: nodes) -> None: - if node.basenames == ['ConanFile']: - for attr in node.body: - children = list(attr.get_children()) - if len(children) == 2 and \ - isinstance(children[0], AssignName) and \ - children[0].name == "name" and \ - isinstance(children[1], Const): - self.add_message("conan-test-no-name", node=attr, line=attr.lineno) diff --git a/linter/check_package_name.py b/linter/check_package_name.py deleted file mode 100644 index d2901a6144fd1..0000000000000 --- a/linter/check_package_name.py +++ /dev/null @@ -1,39 +0,0 @@ -from pylint.checkers import BaseChecker -from pylint.interfaces import IAstroidChecker -from astroid import nodes, Const, AssignName - - -class PackageName(BaseChecker): - """ - All packages must have a lower-case name - """ - - __implements__ = IAstroidChecker - - name = "conan-package-name" - msgs = { - "E9004": ( - "Reference name should be all lowercase", - "conan-bad-name", - "Use only lower-case on the package name: `name = 'foobar'`." - ), - "E9005": ( - "Missing name attribute", - "conan-missing-name", - "The member attribute `name` must be declared: `name = 'foobar'`." - ) - } - - def visit_classdef(self, node: nodes) -> None: - if node.basenames == ['ConanFile']: - for attr in node.body: - children = list(attr.get_children()) - if len(children) == 2 and \ - isinstance(children[0], AssignName) and \ - children[0].name == "name" and \ - isinstance(children[1], Const): - value = children[1].as_string() - if value.lower() != value: - self.add_message("conan-bad-name", node=attr, line=attr.lineno) - return - self.add_message("conan-missing-name", node=node) diff --git a/linter/conandata_yaml_linter.py b/linter/conandata_yaml_linter.py deleted file mode 100644 index e55abd40a32c1..0000000000000 --- a/linter/conandata_yaml_linter.py +++ /dev/null @@ -1,114 +0,0 @@ -import argparse -import sys -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) - sys.exit(1) - except BaseException as error: - pretty_print_yaml_validate_error(args, error) - sys.exit(1) - - exit_code = 0 - if "patches" in parsed: - for version in parsed["patches"]: - patches = parsed["patches"][version] - 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_error(args, error) - exit_code = 1 - 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)" - ) - - sys.exit(exit_code) - - -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" - ) - - -if __name__ == "__main__": - main() diff --git a/linter/conanv2_test_transition.py b/linter/conanv2_test_transition.py deleted file mode 100644 index 105891a947bd0..0000000000000 --- a/linter/conanv2_test_transition.py +++ /dev/null @@ -1,20 +0,0 @@ -""" - -Pylint plugin/rules for test_package folder in Conan Center Index - -""" - -from pylint.lint import PyLinter -from linter.check_import_conanfile import ImportConanFile -from linter.check_no_test_package_name import NoPackageName -from linter.check_import_errors import ImportErrorsConanException, ImportErrorsConanInvalidConfiguration, ImportErrors -from linter.check_import_tools import ImportTools - - -def register(linter: PyLinter) -> None: - linter.register_checker(NoPackageName(linter)) - linter.register_checker(ImportConanFile(linter)) - linter.register_checker(ImportErrors(linter)) - linter.register_checker(ImportErrorsConanException(linter)) - linter.register_checker(ImportErrorsConanInvalidConfiguration(linter)) - linter.register_checker(ImportTools(linter)) diff --git a/linter/conanv2_transition.py b/linter/conanv2_transition.py deleted file mode 100644 index 32f3a3b0924b0..0000000000000 --- a/linter/conanv2_transition.py +++ /dev/null @@ -1,22 +0,0 @@ -""" - -Pylint plugin/rules for conanfiles in Conan Center Index - -""" - -from pylint.lint import PyLinter -from linter.check_package_name import PackageName -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: - linter.register_checker(PackageName(linter)) - linter.register_checker(ImportConanFile(linter)) - linter.register_checker(ImportErrors(linter)) - 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 deleted file mode 100644 index 29807e6ce3b99..0000000000000 --- a/linter/config_yaml_linter.py +++ /dev/null @@ -1,37 +0,0 @@ -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/pylintrc_recipe b/linter/pylintrc_recipe deleted file mode 100644 index a6a0c3e21aea7..0000000000000 --- a/linter/pylintrc_recipe +++ /dev/null @@ -1,30 +0,0 @@ -[MASTER] -load-plugins=linter.conanv2_transition, - linter.transform_conanfile, - linter.transform_imports - -py-version=3.6 -recursive=no -suggestion-mode=yes -unsafe-load-any-extension=no - -[MESSAGES CONTROL] -disable=fixme, - line-too-long, - missing-module-docstring, - missing-function-docstring, - missing-class-docstring, - invalid-name, - wrong-import-order, # TODO: Remove - import-outside-toplevel # TODO: Remove - -enable=conan-bad-name, - conan-missing-name, - conan-import-conanfile - -[REPORTS] -evaluation=max(0, 0 if fatal else 10.0 - ((float(5 * error) / statement) * 10)) -output-format=text -reports=no -score=no - diff --git a/linter/pylintrc_testpackage b/linter/pylintrc_testpackage deleted file mode 100644 index 70d2a6ad14864..0000000000000 --- a/linter/pylintrc_testpackage +++ /dev/null @@ -1,27 +0,0 @@ -[MASTER] -load-plugins=linter.conanv2_test_transition, - linter.transform_conanfile, - linter.transform_imports -py-version=3.6 -recursive=no -suggestion-mode=yes -unsafe-load-any-extension=no - -[MESSAGES CONTROL] -disable=fixme, - line-too-long, - missing-module-docstring, - missing-function-docstring, - missing-class-docstring, - invalid-name, - wrong-import-order, # TODO: Remove - import-outside-toplevel # TODO: Remove - -enable=conan-test-no-name, - conan-import-conanfile - -[REPORTS] -evaluation=max(0, 0 if fatal else 10.0 - ((float(5 * error) / statement) * 10)) -output-format=text -reports=no -score=no diff --git a/linter/recipe_linter.json b/linter/recipe_linter.json deleted file mode 100644 index 0b9ff4566b051..0000000000000 --- a/linter/recipe_linter.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "problemMatcher": [ - { - "owner": "recipe_linter_fatals", - "severity": "error", - "pattern": [ - { - "regexp": "(\\S+):(\\d+): \\[(F\\d+\\(\\S+\\)),\\s(.+?)?\\](.+)", - "file": 1, - "line": 2, - "message": 5, - "code": 3 - } - ] - }, - { - "owner": "recipe_linter_errors", - "severity": "error", - "pattern": [ - { - "regexp": "(\\S+):(\\d+): \\[(E\\d+\\(\\S+\\)),\\s(.+?)?\\](.+)", - "file": 1, - "line": 2, - "message": 5, - "code": 3 - } - ] - }, - { - "owner": "recipe_linter_warnings", - "severity": "warning", - "pattern": [ - { - "regexp": "(\\S+):(\\d+): \\[(W\\d+\\(\\S+\\)),\\s(.+?)?\\](.+)", - "file": 1, - "line": 2, - "message": 5, - "code": 3 - } - ] - } - ] -} diff --git a/linter/transform_conanfile.py b/linter/transform_conanfile.py deleted file mode 100644 index 8e33d368643b1..0000000000000 --- a/linter/transform_conanfile.py +++ /dev/null @@ -1,74 +0,0 @@ - -# Class ConanFile doesn't declare all the valid members and functions, -# some are injected by Conan dynamically to the class. - -import textwrap -import astroid -from astroid.builder import AstroidBuilder -from astroid.manager import AstroidManager - - -def _settings_transform(): - module = AstroidBuilder(AstroidManager()).string_build( - textwrap.dedent(""" - class Settings(object): - os = None - arch = None - compiler = None - build_type = None - """) - ) - return module['Settings'] - -def _user_info_build_transform(): - module = AstroidBuilder(AstroidManager()).string_build( - textwrap.dedent(""" - class UserInfoBuild(defaultdict): - pass - """) - ) - return module['UserInfoBuild'] - - -def register(_): - pass - -def transform_conanfile(node): - """Transform definition of ConanFile class so dynamic fields are visible to pylint""" - - str_class = astroid.builtin_lookup("str") - dict_class = astroid.builtin_lookup("dict") - info_class = astroid.MANAGER.ast_from_module_name("conans.model.info").lookup( - "ConanInfo") - build_requires_class = astroid.MANAGER.ast_from_module_name( - "conans.client.graph.graph_manager").lookup("_RecipeBuildRequires") - file_copier_class = astroid.MANAGER.ast_from_module_name( - "conans.client.file_copier").lookup("FileCopier") - file_importer_class = astroid.MANAGER.ast_from_module_name( - "conans.client.importer").lookup("_FileImporter") - python_requires_class = astroid.MANAGER.ast_from_module_name( - "conans.client.graph.python_requires").lookup("PyRequires") - - dynamic_fields = { - "conan_data": str_class, - "build_requires": build_requires_class, - "tool_requires": build_requires_class, - "info_build": info_class, - "user_info_build": [_user_info_build_transform()], - "info": info_class, - "copy": file_copier_class, - "copy_deps": file_importer_class, - "python_requires": [str_class, python_requires_class], - "recipe_folder": str_class, - "settings_build": [_settings_transform()], - "settings_target": [_settings_transform()], - "conf": dict_class, - } - - for f, t in dynamic_fields.items(): - node.locals[f] = [i for i in t] - - -astroid.MANAGER.register_transform( - astroid.ClassDef, transform_conanfile, - lambda node: node.qname() == "conans.model.conan_file.ConanFile") diff --git a/linter/transform_imports.py b/linter/transform_imports.py deleted file mode 100644 index 78b72e4b16880..0000000000000 --- a/linter/transform_imports.py +++ /dev/null @@ -1,46 +0,0 @@ - -import astroid -from pylint.lint import PyLinter - -""" -Here we are transforming the imports to mimic future Conan v2 release. With -these changes, built-in checks in Pylint will raise with different errors, so -we are modifying the messages to point users in the right direction. -""" - - -def register(linter: PyLinter): - msge1101 = linter.msgs_store._messages_definitions["E1101"] - msge1101.msg += ". Please, check https://github.com/conan-io/conan-center-index/blob/master/docs/v2_linter.md" - linter.msgs_store.register_message(msge1101) - - msge0611 = linter.msgs_store._messages_definitions["E0611"] - msge0611.msg += ". Please, check https://github.com/conan-io/conan-center-index/blob/master/docs/v2_linter.md" - linter.msgs_store.register_message(msge0611) - -def transform_tools(module): - """ Transform import module """ - if 'get' in module.locals: - del module.locals['get'] - if 'cross_building' in module.locals: - del module.locals['cross_building'] - if 'rmdir' in module.locals: - del module.locals['rmdir'] - if 'Version' in module.locals: - del module.locals['Version'] - -def transform_errors(module): - pass - #if 'ConanInvalidConfiguration' in module.locals: - # del module.locals['ConanInvalidConfiguration'] - #if 'ConanException' in module.locals: - # del module.locals['ConanException'] - - -astroid.MANAGER.register_transform( - astroid.Module, transform_tools, - lambda node: node.qname() == "conans.tools") - -astroid.MANAGER.register_transform( - astroid.Module, transform_errors, - lambda node: node.qname() == "conans.errors") diff --git a/linter/yaml_linting.py b/linter/yaml_linting.py deleted file mode 100644 index 8b61d99ba39f9..0000000000000 --- a/linter/yaml_linting.py +++ /dev/null @@ -1,9 +0,0 @@ -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 deleted file mode 100644 index 42a3ef93b5956..0000000000000 --- a/linter/yamllint_matcher.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "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/linter/yamllint_rules.yml b/linter/yamllint_rules.yml deleted file mode 100644 index 7c0ce102ddc36..0000000000000 --- a/linter/yamllint_rules.yml +++ /dev/null @@ -1,26 +0,0 @@ -extends: default -rules: - document-start: - level: error - present: false - document-end: - level: error - present: false - empty-values: - forbid-in-block-mappings: true - forbid-in-flow-mappings: true - line-length: disable - indentation: - level: error - new-line-at-end-of-file: - level: error - trailing-spaces: - level: error - comments: - level: error - comments-indentation: - level: error - new-lines: - type: unix - key-duplicates: - level: error diff --git a/recipes/7bitconf/all/conandata.yml b/recipes/7bitconf/all/conandata.yml new file mode 100644 index 0000000000000..4ddfe60caee6d --- /dev/null +++ b/recipes/7bitconf/all/conandata.yml @@ -0,0 +1,15 @@ +sources: + "1.2.0": + url: "https://github.com/7bitCoder/7bitConf/archive/refs/tags/v1.2.0.tar.gz" + sha256: "c2cc19618dc6616e463dbd7cc72da1fdd5b6df1b4f5d4bf8317455658ac63f0e" + "1.1.0": + url: "https://github.com/7bitCoder/7bitConf/archive/refs/tags/v1.1.0.tar.gz" + sha256: "07e5bff366d66c276032021c9a9ca5cdb1d8f097b29c032d07ee6ae1a10885a2" + "1.0.0": + url: "https://github.com/7bitCoder/7bitConf/archive/refs/tags/v1.0.0.tar.gz" + sha256: "48a02d331f4281c8ff691d55c54abe744228637e9ad3af500daf526f4c77696d" +patches: + "1.2.0": + - patch_file: "patches/1.2.0-0001-fix-package-name.patch" + patch_description: "fix taocpp-json's package name" + patch_type: "conan" diff --git a/recipes/7bitconf/all/conanfile.py b/recipes/7bitconf/all/conanfile.py new file mode 100644 index 0000000000000..af6c2dd2e898f --- /dev/null +++ b/recipes/7bitconf/all/conanfile.py @@ -0,0 +1,143 @@ +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, apply_conandata_patches, copy, export_conandata_patches +from conan.tools.scm import Version +import os + +required_conan_version = ">=1.53.0" + + +class SevenBitConfConan(ConanFile): + name = "7bitconf" + homepage = "https://github.com/7bitCoder/7bitConf" + description = "7bitConf is a simple C++17 centralized configuration provider library." + topics = ("cpp17", "configuration", "provider", "configuration-files") + url = "https://github.com/conan-io/conan-center-index" + license = "MIT" + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "header_only": [True, False], + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "header_only": False, + "shared": False, + "fPIC": True, + } + + @property + def _min_cppstd(self): + return 17 + + @property + def _minimum_compilers_version(self): + return { + "Visual Studio": "14", + "msvc": "192", + "gcc": "8", + "clang": "7", + "apple-clang": "10", + } + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + self.options.rm_safe("fPIC") + + def configure(self): + if self.options.get_safe("shared") or self.options.header_only: + self.options.rm_safe("fPIC") + if self.options.header_only: + self.options.rm_safe("shared") + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires("taocpp-json/1.0.0-beta.14", transitive_headers=True) + + def package_id(self): + if self.info.options.header_only: + self.info.clear() + + def validate(self): + compiler = self.settings.compiler + compiler_name = str(compiler) + + if compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + + minimum_version = self._minimum_compilers_version.get(compiler_name, False) + if minimum_version and Version(compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"Requires compiler {compiler_name} minimum version: {minimum_version} with C++17 support." + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + apply_conandata_patches(self) + if not self.options.header_only: + tc = CMakeToolchain(self) + tc.variables["_7BIT_CONF_BUILD_EXAMPLES"] = False + tc.variables["_7BIT_CONF_BUILD_TESTS"] = False + tc.variables["_7BIT_CONF_BUILD_SINGLE_HEADER"] = False + tc.variables["_7BIT_CONF_INSTALL"] = True + tc.variables["_7BIT_CONF_LIBRARY_TYPE"] = self.getSevenBitConfLibraryType() + tc.generate() + cmake_deps = CMakeDeps(self) + cmake_deps.generate() + + def getSevenBitConfLibraryType(self): + if self.options.header_only: + return "HeaderOnly" + if self.options.shared: + return "Shared" + return "Static" + + def build(self): + if not self.options.header_only: + 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, + ) + if self.options.header_only: + copy( + self, + src=os.path.join(self.source_folder, "Include"), + pattern="*.hpp", + dst=os.path.join(self.package_folder, "include"), + ) + else: + 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", "7bitConf") + self.cpp_info.set_property("cmake_target_name", "7bitConf::7bitConf") + self.cpp_info.requires = ["taocpp-json::taocpp-json"] + + if self.options.header_only: + self.cpp_info.libs = [] + self.cpp_info.bindirs = [] + else: + suffix = "d" if self.settings.build_type == "Debug" else "" + self.cpp_info.libs = ["7bitConf" + suffix] + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") diff --git a/recipes/7bitconf/all/patches/1.2.0-0001-fix-package-name.patch b/recipes/7bitconf/all/patches/1.2.0-0001-fix-package-name.patch new file mode 100644 index 0000000000000..1d71939004139 --- /dev/null +++ b/recipes/7bitconf/all/patches/1.2.0-0001-fix-package-name.patch @@ -0,0 +1,16 @@ +diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt +index 6cdab6c..04c9c4f 100644 +--- a/Source/CMakeLists.txt ++++ b/Source/CMakeLists.txt +@@ -27,9 +27,9 @@ elseif (_7BIT_CONF_HEADER_ONLY_LIB) + endif () + + if (_7BIT_CONF_HEADER_ONLY_LIB) +- target_link_libraries(7bitConf INTERFACE taocpp-json) ++ target_link_libraries(7bitConf INTERFACE taocpp::json) + else () +- target_link_libraries(7bitConf taocpp-json) ++ target_link_libraries(7bitConf taocpp::json) + endif () + + add_library(7bitConf::7bitConf ALIAS 7bitConf) diff --git a/recipes/7bitconf/all/test_package/CMakeLists.txt b/recipes/7bitconf/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..c27c6a95e062c --- /dev/null +++ b/recipes/7bitconf/all/test_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(7bitConf REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) + +target_link_libraries(${PROJECT_NAME} PUBLIC 7bitConf::7bitConf) + +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/7bitconf/all/test_package/conanfile.py b/recipes/7bitconf/all/test_package/conanfile.py new file mode 100644 index 0000000000000..49854c6d47088 --- /dev/null +++ b/recipes/7bitconf/all/test_package/conanfile.py @@ -0,0 +1,28 @@ +import os +from conan import ConanFile +from conan.tools.cmake import CMake +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 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/7bitconf/all/test_package/test_package.cpp b/recipes/7bitconf/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..a1d4cb2de73d8 --- /dev/null +++ b/recipes/7bitconf/all/test_package/test_package.cpp @@ -0,0 +1,17 @@ +#include +#include + +int main(int argc, char **argv) { + + auto configuration = sb::cf::ConfigurationBuilder{} + .addAppSettings() + .addCommandLine(argc, argv) + .addJson({{"setting", "value"}}) + .build(); + + std::cout << "7bitconf version: " << _7BIT_CONF_VERSION << std::endl + << "Configuration json: " << std::endl + << *configuration << std::endl; + + return 0; +} diff --git a/recipes/7bitconf/config.yml b/recipes/7bitconf/config.yml new file mode 100644 index 0000000000000..03495144e3920 --- /dev/null +++ b/recipes/7bitconf/config.yml @@ -0,0 +1,7 @@ +versions: + "1.2.0": + folder: all + "1.1.0": + folder: all + "1.0.0": + folder: all diff --git a/recipes/7bitdi/all/conandata.yml b/recipes/7bitdi/all/conandata.yml new file mode 100644 index 0000000000000..ad96c33d43330 --- /dev/null +++ b/recipes/7bitdi/all/conandata.yml @@ -0,0 +1,25 @@ +sources: + "3.4.0": + url: "https://github.com/7bitcoder/7bitDI/archive/refs/tags/v3.4.0.tar.gz" + sha256: "8381102f5966a5d83cf590b8fa45904d055d74ec90822628240786ab100fb929" + "3.3.0": + url: "https://github.com/7bitcoder/7bitDI/archive/refs/tags/v3.3.0.tar.gz" + sha256: "b9ddb2fc263c79cb414544e97d44dcc8cd1e1a91b38129d96b7051728a4583b9" + "3.2.0": + url: "https://github.com/7bitcoder/7bitDI/archive/refs/tags/v3.2.0.tar.gz" + sha256: "4549b651a28b309a31cb3b879b7f31069cbca041cfb9ffad82ccc26f78b8e5e0" + "3.1.0": + url: "https://github.com/7bitcoder/7bitDI/archive/refs/tags/v3.1.0.tar.gz" + sha256: "345bf91e2a33cfe98628cac98c75488ddd55232b8c4bcfeba9b5001fec8d4f7c" + "3.0.0": + url: "https://github.com/7bitcoder/7bitDI/archive/refs/tags/v3.0.0.tar.gz" + sha256: "aabb8e907c0cafb8e4b7c8367ed5dbb3cba2d83af090bdef9a7f855c0778c8f3" + "2.1.0": + url: "https://github.com/7bitcoder/7bitDI/archive/refs/tags/v2.1.0.tar.gz" + sha256: "54edceb4f90bf652126310ca0b78150d05a02d7081cef3c9ccaba5f4dd112935" + "2.0.0": + url: "https://github.com/7bitcoder/7bitDI/archive/refs/tags/v2.0.0.tar.gz" + sha256: "ae6d01c677b928a9c0979b9b2395692f9a3d876e07189d9b191e7b55c13d9ef4" + "1.0.0": + url: "https://github.com/7bitcoder/7bitDI/archive/refs/tags/v1.0.0.tar.gz" + sha256: "4a5bfc541bf98b9943a54003c7ad1f8a2a3f879143022be805aaa343852d8279" diff --git a/recipes/7bitdi/all/conanfile.py b/recipes/7bitdi/all/conanfile.py new file mode 100644 index 0000000000000..6709e44476413 --- /dev/null +++ b/recipes/7bitdi/all/conanfile.py @@ -0,0 +1,137 @@ +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 get, copy, rmdir +from conan.tools.scm import Version +import os + +required_conan_version = ">=1.53.0" + +class SevenBitDIConan(ConanFile): + name = "7bitdi" + description = "a simple C++ dependency injection library." + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/7bitcoder/7bitDI" + topics = ("cpp17", "dependency-injector", "injector", "header-only") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "header_only": [True, False], + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "header_only": False, + "shared": False, + "fPIC": True, + } + + @property + def _min_cppstd(self): + return 17 + + @property + def _minimum_compilers_version(self): + return { + "Visual Studio": "14", + "msvc": "192", + "gcc": "6", + "clang": "6", + "apple-clang": "10", + } + + def config_options(self): + if self.settings.os == "Windows": + self.options.rm_safe("fPIC") + + def configure(self): + if self.options.get_safe("shared") or self.options.header_only: + self.options.rm_safe("fPIC") + if self.options.header_only: + self.options.rm_safe("shared") + + def layout(self): + cmake_layout(self, src_folder="src") + + def package_id(self): + if self.info.options.header_only: + self.info.clear() + + def validate(self): + compiler = self.settings.compiler + compiler_name = str(compiler) + + if compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + minimum_version = self._minimum_compilers_version.get(compiler_name, False) + if minimum_version and Version(compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires compiler {compiler_name} minimum version: {minimum_version} with C++{self._min_cppstd} support." + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + if not self.options.header_only: + tc = CMakeToolchain(self) + tc.variables["_7BIT_DI_BUILD_EXAMPLES"] = False + tc.variables["_7BIT_DI_BUILD_TESTS"] = False + tc.variables["_7BIT_DI_BUILD_DOC"] = False + tc.variables["_7BIT_DI_BUILD_SINGLE_HEADER"] = False + tc.variables["_7BIT_DI_INSTALL"] = True + tc.variables["_7BIT_DI_LIBRARY_TYPE"] = self.getSevenBitDILibraryType() + tc.generate() + + def getSevenBitDILibraryType(self): + if self.options.header_only: + return "HeaderOnly" + elif self.options.shared: + return "Shared" + else: + return "Static" + + def build(self): + if not self.options.header_only: + 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, + ) + if self.options.header_only: + copy( + self, + src=os.path.join(self.source_folder, "Include"), + pattern="*.hpp", + dst=os.path.join(self.package_folder, "include"), + ) + else: + 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", "7bitDI") + self.cpp_info.set_property("cmake_target_name", "7bitDI::7bitDI") + + if self.options.header_only: + self.cpp_info.libs = [] + self.cpp_info.bindirs = [] + else: + suffix = "d" if self.settings.build_type == "Debug" else "" + self.cpp_info.libs = ["7bitDI" + suffix] + + 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"] = "7bitDI" + self.cpp_info.names["cmake_find_package_multi"] = "7bitDI" diff --git a/recipes/7bitdi/all/test_package/CMakeLists.txt b/recipes/7bitdi/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..f0038de83701f --- /dev/null +++ b/recipes/7bitdi/all/test_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(7bitDI REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) + +target_link_libraries(${PROJECT_NAME} PUBLIC 7bitDI::7bitDI) + +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/7bitdi/all/test_package/conanfile.py b/recipes/7bitdi/all/test_package/conanfile.py new file mode 100644 index 0000000000000..543315cd0fbb8 --- /dev/null +++ b/recipes/7bitdi/all/test_package/conanfile.py @@ -0,0 +1,31 @@ +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 = "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/7bitdi/all/test_package/test_package.cpp b/recipes/7bitdi/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..91eeefedff48d --- /dev/null +++ b/recipes/7bitdi/all/test_package/test_package.cpp @@ -0,0 +1,7 @@ +#include +#include + +int main() { + std::cout << "7bitdi version: " << _7BIT_DI_VERSION; + return 0; +} diff --git a/recipes/boost/all/test_v1_package/CMakeLists.txt b/recipes/7bitdi/all/test_v1_package/CMakeLists.txt similarity index 100% rename from recipes/boost/all/test_v1_package/CMakeLists.txt rename to recipes/7bitdi/all/test_v1_package/CMakeLists.txt diff --git a/recipes/7bitdi/all/test_v1_package/conanfile.py b/recipes/7bitdi/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..0f735b51a2642 --- /dev/null +++ b/recipes/7bitdi/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/7bitdi/config.yml b/recipes/7bitdi/config.yml new file mode 100644 index 0000000000000..3fbfbf1ec3bc5 --- /dev/null +++ b/recipes/7bitdi/config.yml @@ -0,0 +1,17 @@ +versions: + "3.4.0": + folder: all + "3.3.0": + folder: all + "3.2.0": + folder: all + "3.1.0": + folder: all + "3.0.0": + folder: all + "2.1.0": + folder: all + "2.0.0": + folder: all + "1.0.0": + folder: all diff --git a/recipes/7zip/19.00/conandata.yml b/recipes/7zip/19.00/conandata.yml deleted file mode 100644 index 0d36819b4de39..0000000000000 --- a/recipes/7zip/19.00/conandata.yml +++ /dev/null @@ -1,4 +0,0 @@ -sources: - "19.00": - url: https://www.7-zip.org/a/7z1900-src.7z - sha256: "9ba70a5e8485cf9061b30a2a84fe741de5aeb8dd271aab8889da0e9b3bf1868e" diff --git a/recipes/7zip/19.00/conanfile.py b/recipes/7zip/19.00/conanfile.py deleted file mode 100644 index d18ee2242a6e7..0000000000000 --- a/recipes/7zip/19.00/conanfile.py +++ /dev/null @@ -1,101 +0,0 @@ -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.47.0" - - -class SevenZipConan(ConanFile): - name = "7zip" - url = "https://github.com/conan-io/conan-center-index" - description = "7-Zip is a file archiver with a high compression ratio" - license = ("LGPL-2.1", "BSD-3-Clause", "Unrar") - homepage = "https://www.7-zip.org" - topics = ("7zip", "zip", "compression", "decompression") - settings = "os", "arch", "compiler" - - @property - def _settings_build(self): - return getattr(self, "settings_build", self.settings) - - def validate(self): - if self.settings.os != "Windows": - raise ConanInvalidConfiguration("Only Windows supported") - if self.settings.arch not in ("x86", "x86_64"): - raise ConanInvalidConfiguration("Unsupported architecture") - - 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.3") - - def package_id(self): - del self.info.settings.compiler - - def _uncompress_7z(self, 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"] - download(self, url, filename, sha256) - self._uncompress_7z(filename) - os.unlink(filename) - - @property - def _msvc_platform(self): - return { - "x86_64": "x64", - "x86": "x86", - }[str(self.settings.arch)] - - def _build_msvc(self): - with tools.vcvars(self.settings): - 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 - autotools = AutoToolsBuildEnvironment(self) - extra_env = {} - if self.settings.os == "Windows" and self.settings.compiler == "gcc": - extra_env["IS_MINGW"] = "1" - with tools.environment_append(extra_env): - 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) - 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() - if self.settings.compiler == "Visual Studio": - self._build_msvc() - else: - self._build_autotools() - - def package(self): - self.copy("DOC/License.txt", src="", dst="licenses") - self.copy("DOC/unRarLicense.txt", src="", dst="licenses") - if self.settings.os == "Windows": - self.copy("*.exe", src="CPP/7zip", dst="bin", keep_path=False) - self.copy("*.dll", src="CPP/7zip", dst="bin", keep_path=False) - - # TODO: Package the libraries: binaries and headers (add the rest of settings) - - 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/7zip/19.00/test_package/conanfile.py b/recipes/7zip/19.00/test_package/conanfile.py deleted file mode 100644 index f6a6ccb388a8e..0000000000000 --- a/recipes/7zip/19.00/test_package/conanfile.py +++ /dev/null @@ -1,9 +0,0 @@ -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("7z.exe") diff --git a/recipes/7zip/all/conandata.yml b/recipes/7zip/all/conandata.yml new file mode 100644 index 0000000000000..e62dc40aa34ed --- /dev/null +++ b/recipes/7zip/all/conandata.yml @@ -0,0 +1,16 @@ +sources: + "23.01": + url: + - https://www.7-zip.org/a/7z2301-src.tar.xz + - https://sourceforge.net/projects/sevenzip/files/7-Zip/23.01/7z2301-src.tar.xz + sha256: "356071007360e5a1824d9904993e8b2480b51b570e8c9faf7c0f58ebe4bf9f74" + "22.01": + url: + - https://www.7-zip.org/a/7z2201-src.tar.xz + - https://sourceforge.net/projects/sevenzip/files/7-Zip/22.01/7z2201-src.tar.xz + sha256: "393098730c70042392af808917e765945dc2437dee7aae3cfcc4966eb920fbc5" + "19.00": + url: + - https://www.7-zip.org/a/7z1900-src.7z + - https://sourceforge.net/projects/sevenzip/files/7-Zip/19.00/7z1900-src.7z + sha256: "9ba70a5e8485cf9061b30a2a84fe741de5aeb8dd271aab8889da0e9b3bf1868e" diff --git a/recipes/7zip/all/conanfile.py b/recipes/7zip/all/conanfile.py new file mode 100644 index 0000000000000..91093cc791c52 --- /dev/null +++ b/recipes/7zip/all/conanfile.py @@ -0,0 +1,123 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import copy, chdir, download, get, replace_in_file +from conan.tools.gnu import Autotools, AutotoolsDeps, 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.55.0" + + +class SevenZipConan(ConanFile): + name = "7zip" + url = "https://github.com/conan-io/conan-center-index" + description = "7-Zip is a file archiver with a high compression ratio" + license = ("LGPL-2.1-or-later", "BSD-3-Clause", "Unrar") + homepage = "https://www.7-zip.org" + topics = ("archive", "compression", "decompression", "zip") + package_type = "application" + settings = "os", "arch", "compiler", "build_type" + + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) + + def validate(self): + if self.settings.os != "Windows": + raise ConanInvalidConfiguration("Only Windows supported") + if self.settings.arch not in ("x86", "x86_64"): + raise ConanInvalidConfiguration("Unsupported architecture") + + def layout(self): + basic_layout(self, src_folder="src") + + def build_requirements(self): + if Version(self.version) < "22": + self.build_requires("lzma_sdk/9.20") + + if not is_msvc(self) and self._settings_build.os == "Windows" and "make" not in os.environ.get("CONAN_MAKE_PROGRAM", ""): + self.build_requires("make/4.3") + + def package_id(self): + del self.info.settings.build_type + del self.info.settings.compiler + + def source(self): + if Version(self.version) < "22": + item = self.conan_data["sources"][self.version] + filename = "7z-source.7z" + download(self, **item, filename=filename) + sevenzip = os.path.join(self.dependencies.build["lzma_sdk"].package_folder, "bin", "7zr.exe") + self.run(f"{sevenzip} x {filename}") + os.unlink(filename) + else: + get(self, **self.conan_data["sources"][self.version]) + + def generate(self): + if is_msvc(self): + tc = NMakeToolchain(self) + tc.generate() + else: + tc = AutotoolsToolchain(self) + env = None + if self.settings.os == "Windows" and self.settings.compiler == "gcc": + env = tc.environment() + env.define("IS_MINGW", "1") + tc.generate(env=env) + deps = AutotoolsDeps(self) + deps.generate() + + @property + def _msvc_platform(self): + return { + "x86_64": "x64", + "x86": "x86", + }[str(self.settings.arch)] + + def _build_msvc(self): + self.run(f"nmake /f makefile PLATFORM={self._msvc_platform}", cwd=os.path.join(self.source_folder, "CPP", "7zip")) + + def _build_autotools(self): + # TODO: Enable non-Windows methods in configure + autotools = Autotools(self) + with chdir(self, os.path.join(self.source_folder, "CPP", "7zip", "Bundles", "LzmaCon")): + autotools.make(args=["-f", "makefile.gcc"], target="all") + + def _patch_sources(self): + if is_msvc(self): + fn = os.path.join(self.source_folder, "CPP", "Build.mak") + os.chmod(fn, 0o644) + replace_in_file(self, fn, "-MT", f"-{self.settings.compiler.runtime}") + replace_in_file(self, fn, "-MD", f"-{self.settings.compiler.runtime}") + if self.version < Version("23.01"): + replace_in_file(self, fn, "-WX", "") + + pfc = os.path.join(self.source_folder, "CPP", "7zip", "UI", "FileManager", "PanelFolderChange.cpp") + os.chmod(pfc, 0o644) + replace_in_file(self, pfc, r'L"\\"', r'static_cast(L"\\")') + + def build(self): + self._patch_sources() + if is_msvc(self): + self._build_msvc() + else: + self._build_autotools() + + def package(self): + copy(self, "License.txt", dst=os.path.join(self.package_folder, "licenses"), src=os.path.join(self.source_folder, "DOC")) + copy(self, "unRarLicense.txt", dst=os.path.join(self.package_folder, "licenses"), src=os.path.join(self.source_folder, "DOC")) + if self.settings.os == "Windows": + copy(self, "*.exe", dst=os.path.join(self.package_folder, "bin"), src=os.path.join(self.source_folder, "CPP", "7zip"), keep_path=False) + copy(self, "*.dll", dst=os.path.join(self.package_folder, "bin"), src=os.path.join(self.source_folder, "CPP", "7zip"), keep_path=False) + # TODO: Package the libraries: binaries and headers (add the rest of settings) + + 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/7zip/all/test_package/conanfile.py b/recipes/7zip/all/test_package/conanfile.py new file mode 100644 index 0000000000000..19851f5658605 --- /dev/null +++ b/recipes/7zip/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 = "VirtualBuildEnv" + test_type = "explicit" + + def build_requirements(self): + self.tool_requires(self.tested_reference_str) + + def test(self): + if can_run(self): + self.run("7z.exe") diff --git a/recipes/7zip/all/test_v1_package/conanfile.py b/recipes/7zip/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..e5371836902a7 --- /dev/null +++ b/recipes/7zip/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("7z.exe", run_environment=True) diff --git a/recipes/7zip/config.yml b/recipes/7zip/config.yml index 46489517ceb78..9e03b0cc48e12 100644 --- a/recipes/7zip/config.yml +++ b/recipes/7zip/config.yml @@ -1,3 +1,7 @@ versions: + "23.01": + folder: "all" + "22.01": + folder: "all" "19.00": - folder: "19.00" + folder: "all" 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..471ea8132e2ce 100644 --- a/recipes/aaf/all/conanfile.py +++ b/recipes/aaf/all/conanfile.py @@ -1,20 +1,26 @@ -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 +from conan.tools.microsoft import is_msvc 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" + package_type = "static-library" + + settings = "os", "arch", "compiler", "build_type" options = { "structured_storage": [True, False], } @@ -22,69 +28,70 @@ 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.6.2 <3]") + 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") + self.requires("util-linux-libuuid/2.39") 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): + tc = CMakeToolchain(self) + if is_apple_os(self): + tc.cache_variables["PLATFORM"] = "apple-clang" + elif is_msvc(self): + 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: + 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() def build(self): apply_conandata_patches(self) - cmake = CMake(self) - - if tools.is_apple_os(self.settings.os): - cmake.definitions["PLATFORM"] = "apple-clang" - elif self.settings.compiler == "Visual Studio": - cmake.definitions["PLATFORM"] = "vc" - else: - cmake.definitions["PLATFORM"] = self.settings.os - - 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) + 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}"] + # The static library loads a DLL at runtime, on Windows it needs to be able + # to find it in PATH, see https://aaf.sourceforge.net/AAFProjectFAQ.html + self.runenv_info.prepend_path("PATH", os.path.join(self.package_folder, "bin")) else: - self.cpp_info.libs = ["aaflib", "aafiid", "com-api"] + self.cpp_info.libs = ["aaflib", "aafiid"] 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/flecs/all/test_v1_package/CMakeLists.txt b/recipes/aaf/all/test_v1_package/CMakeLists.txt similarity index 100% rename from recipes/flecs/all/test_v1_package/CMakeLists.txt rename to recipes/aaf/all/test_v1_package/CMakeLists.txt diff --git a/recipes/aws-c-common/all/test_v1_package/conanfile.py b/recipes/aaf/all/test_v1_package/conanfile.py similarity index 100% rename from recipes/aws-c-common/all/test_v1_package/conanfile.py rename to recipes/aaf/all/test_v1_package/conanfile.py diff --git a/recipes/aaplus/all/conandata.yml b/recipes/aaplus/all/conandata.yml index f1c7c0805bfae..4e0f826f773b4 100644 --- a/recipes/aaplus/all/conandata.yml +++ b/recipes/aaplus/all/conandata.yml @@ -1,7 +1,12 @@ sources: + "2.53": + url: "http://www.naughter.com/download/aaplus_v2.53.zip" + sha256: "8b06f597535c1750dba71186e991561adb6c5e2d9678e258a3f7d6bdd0e4fda6" "2.41": url: "http://www.naughter.com/download/aaplus_v2.41.zip" sha256: "7aede2802f3542c91eeefa0cdd4419911c7547073c84a6faa4bf31f6b6f172da" patches: + "2.53": + - patch_file: "patches/0001-fix-cmake.patch" "2.41": - patch_file: "patches/0001-fix-cmake.patch" diff --git a/recipes/aaplus/all/conanfile.py b/recipes/aaplus/all/conanfile.py index 82bc050c7cb95..22ad9d6440ddc 100644 --- a/recipes/aaplus/all/conanfile.py +++ b/recipes/aaplus/all/conanfile.py @@ -20,6 +20,7 @@ class Aaplusconan(ConanFile): homepage = "http://www.naughter.com/aa.html" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -59,23 +60,23 @@ def layout(self): cmake_layout(self, src_folder="src") def validate(self): - if self.info.settings.compiler.get_safe("cppstd"): + if self.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: + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + compiler_version = Version(self.settings.compiler.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 does not support.", ) - if self.info.settings.compiler == "clang" and (compiler_version >= "10" and compiler_version < "12"): + if self.settings.compiler == "clang" and (compiler_version >= "10" and compiler_version < "12"): raise ConanInvalidConfiguration( "AA+ cannot handle clang 10 and 11 due to filesystem being under experimental namespace" ) 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/aaplus/config.yml b/recipes/aaplus/config.yml index 9e92b3b5d3553..c2d9de5dda8c1 100644 --- a/recipes/aaplus/config.yml +++ b/recipes/aaplus/config.yml @@ -1,3 +1,5 @@ versions: + "2.53": + folder: all "2.41": folder: all diff --git a/recipes/abseil/all/conandata.yml b/recipes/abseil/all/conandata.yml index 854838a18a2e8..fa078f9fc7138 100644 --- a/recipes/abseil/all/conandata.yml +++ b/recipes/abseil/all/conandata.yml @@ -1,45 +1,79 @@ sources: + "20240722.0": + url: "https://github.com/abseil/abseil-cpp/archive/20240722.0.tar.gz" + sha256: "f50e5ac311a81382da7fa75b97310e4b9006474f9560ac46f54a9967f07d4ae3" + "20240116.2": + url: "https://github.com/abseil/abseil-cpp/archive/20240116.2.tar.gz" + sha256: "733726b8c3a6d39a4120d7e45ea8b41a434cdacde401cba500f14236c49b39dc" + "20240116.1": + url: "https://github.com/abseil/abseil-cpp/archive/20240116.1.tar.gz" + sha256: "3c743204df78366ad2eaf236d6631d83f6bc928d1705dd0000b872e53b73dc6a" + "20230802.1": + url: "https://github.com/abseil/abseil-cpp/archive/20230802.1.tar.gz" + sha256: "987ce98f02eefbaf930d6e38ab16aa05737234d7afbab2d5c4ea7adbe50c28ed" + "20230125.3": + url: "https://github.com/abseil/abseil-cpp/archive/20230125.3.tar.gz" + sha256: "5366D7E7FA7BA0D915014D387B66D0D002C03236448E1BA9EF98122C13B35C36" "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" "20211102.0": url: "https://github.com/abseil/abseil-cpp/archive/20211102.0.tar.gz" sha256: "dcf71b9cba8dc0ca9940c4b316a0c796be8fab42b070bb6b7cab62b48f0e66c4" - "20210324.2": - url: "https://github.com/abseil/abseil-cpp/archive/20210324.2.tar.gz" - sha256: "59b862f50e710277f8ede96f083a5bb8d7c9595376146838b9580be90374ee1f" - "20200923.3": - url: "https://github.com/abseil/abseil-cpp/archive/20200923.3.tar.gz" - sha256: "ebe2ad1480d27383e4bf4211e2ca2ef312d5e6a09eba869fd2e8a5c5d553ded2" - "20200225.3": - url: "https://github.com/abseil/abseil-cpp/archive/20200225.3.tar.gz" - sha256: "66d4d009050f39c104b03f79bdca9d930c4964016f74bf24867a43fbdbd00d23" patches: - "20220623.1": + "20240722.0": + - patch_file: "patches/0003-absl-string-libm-20240116.patch" + patch_description: "link libm to absl string" + patch_type: "portability" + patch_source: "https://github.com/abseil/abseil-cpp/issues/1100" + "20240116.2": + - patch_file: "patches/0003-absl-string-libm-20240116.patch" + patch_description: "link libm to absl string" + patch_type: "portability" + patch_source: "https://github.com/abseil/abseil-cpp/issues/1100" + - patch_file: "patches/20240116.1-0001-fix-filesystem-include.patch" + patch_description: "Fix GCC 7 including in C++17 mode when it is not available (until GCC 8)" + patch_type: "portability" + patch_source: "https://github.com/abseil/abseil-cpp/commit/bb83aceacb554e79e7cd2404856f0be30bd00303" + - patch_file: "patches/0004-test-allocator-testonly.patch" + patch_description: "Do not build test_allocator target when tests are disabled" + patch_type: "portability" + patch_source: "https://github.com/abseil/abseil-cpp/commit/779a3565ac6c5b69dd1ab9183e500a27633117d5" + "20240116.1": + - patch_file: "patches/0003-absl-string-libm-20240116.patch" + patch_description: "link libm to absl string" + patch_type: "portability" + patch_source: "https://github.com/abseil/abseil-cpp/issues/1100" + - patch_file: "patches/20240116.1-0001-fix-filesystem-include.patch" + patch_description: "Fix GCC 7 including in C++17 mode when it is not available (until GCC 8)" + patch_type: "portability" + patch_source: "https://github.com/abseil/abseil-cpp/commit/bb83aceacb554e79e7cd2404856f0be30bd00303" + - patch_file: "patches/0004-test-allocator-testonly.patch" + patch_description: "Do not build test_allocator target when tests are disabled" + patch_type: "portability" + patch_source: "https://github.com/abseil/abseil-cpp/commit/779a3565ac6c5b69dd1ab9183e500a27633117d5" + "20230802.1": + - patch_file: "patches/0003-absl-string-libm-20230802.patch" + patch_description: "link libm to absl string" + patch_type: "portability" + patch_source: "https://github.com/abseil/abseil-cpp/issues/1100" + - patch_file: "patches/20230802.1-0001-fix-mingw.patch" + patch_description: "Fix build with MinGW" + patch_type: "portability" + patch_source: "https://github.com/abseil/abseil-cpp/commit/2f77684e8dc473a48dbc19167ffe69c40ce8ada4" + "20230125.3": - 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_description: "link libm to absl string" patch_type: "portability" - "20220623.0": + "20220623.1": - patch_file: "patches/0003-absl-string-libm.patch" + patch_description: "link libm to absl string" + patch_type: "portability" - 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" "20211102.0": - patch_file: "patches/0003-absl-string-libm.patch" - "20210324.2": - - patch_file: "patches/0003-absl-string-libm.patch" - - patch_file: "patches/0004-cpp-standard-20210324.patch" - "20200923.3": - - patch_file: "patches/0003-absl-string-libm.patch" - - patch_file: "patches/0004-cpp-standard-20200923.patch" - "20200225.3": - - patch_file: "patches/0001-cmake-install.patch" - - patch_file: "patches/0002-missing-numeric_limits.h.patch" - - patch_file: "patches/0003-absl-string-libm.patch" - - patch_file: "patches/0004-cpp-standard-20200225.patch" + patch_description: "link libm to absl string" + patch_type: "portability" diff --git a/recipes/abseil/all/conanfile.py b/recipes/abseil/all/conanfile.py index 28ebfb4eb5aa3..55ae607eb9d58 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" @@ -21,6 +21,7 @@ class AbseilConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" license = "Apache-2.0" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -30,13 +31,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 +59,31 @@ 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) and Version(self.version) < "20230802.1": # 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, please use version 20230802.1 or newer") + + def build_requirements(self): + # https://github.com/abseil/abseil-cpp/blob/20240722.0/CMakeLists.txt#L19 + if Version(self.version) >= "20240722.0": + self.tool_requires("cmake/[>=3.16 <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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -78,7 +103,7 @@ def _patch_sources(self): # In case of cross-build, set CMAKE_SYSTEM_PROCESSOR if not set by toolchain or user if cross_building(self): toolchain_file = os.path.join(self.generators_folder, "conan_toolchain.cmake") - cmake_system_processor_block = textwrap.dedent("""\ + cmake_system_processor_block = textwrap.dedent(""" if(NOT CMAKE_SYSTEM_PROCESSOR) set(CMAKE_SYSTEM_PROCESSOR {}) endif() @@ -125,6 +150,9 @@ def _load_components_from_cmake_target_file(self, absl_target_file_path): abs_target_content = load(self, absl_target_file_path) + # Replace the line endings to support building with MSys2 on Windows + abs_target_content = abs_target_content.replace("\r\n", "\n") + cmake_functions = re.findall(r"(?Padd_library|set_target_properties)[\n|\s]*\([\n|\s]*(?P[^)]*)\)", abs_target_content) for (cmake_function_name, cmake_function_args) in cmake_functions: cmake_function_args = re.split(r"[\s|\n]+", cmake_function_args, maxsplit=2) @@ -138,7 +166,7 @@ def _load_components_from_cmake_target_file(self, absl_target_file_path): if cmake_function_name == "add_library": cmake_imported_target_type = cmake_function_args[1] if cmake_imported_target_type in ["STATIC", "SHARED"]: - components[potential_lib_name]["libs"] = [potential_lib_name] if cmake_target_nonamespace != "abseil_dll" else [] + components[potential_lib_name]["libs"] = [potential_lib_name] if cmake_target_nonamespace != "abseil_dll" else ['abseil_dll'] elif cmake_function_name == "set_target_properties": target_properties = re.findall(r"(?PINTERFACE_COMPILE_DEFINITIONS|INTERFACE_INCLUDE_DIRECTORIES|INTERFACE_LINK_LIBRARIES)[\n|\s]+(?P.+)", cmake_function_args[2]) for target_property in target_properties: @@ -167,7 +195,11 @@ def _load_components_from_cmake_target_file(self, absl_target_file_path): elif property_type == "INTERFACE_COMPILE_DEFINITIONS": values_list = target_property[1].replace('"', "").split(";") for definition in values_list: - components[potential_lib_name].setdefault("defines", []).append(definition) + if definition == r"\$<\$:_LINUX_SOURCE_COMPAT>": + if self.settings.os == "AIX": + components[potential_lib_name].setdefault("defines", []).append("_LINUX_SOURCE_COMPAT") + else: + components[potential_lib_name].setdefault("defines", []).append(definition) return components @@ -205,11 +237,6 @@ def package_info(self): self.cpp_info.components[pkgconfig_name].system_libs = values.get("system_libs", []) self.cpp_info.components[pkgconfig_name].frameworks = values.get("frameworks", []) self.cpp_info.components[pkgconfig_name].requires = values.get("requires", []) - if is_msvc(self) and self.settings.compiler.get_safe("cppstd") == "20": - self.cpp_info.components[pkgconfig_name].defines.extend([ - "_HAS_DEPRECATED_RESULT_OF", - "_SILENCE_CXX17_RESULT_OF_DEPRECATION_WARNING", - ]) self.cpp_info.components[pkgconfig_name].names["cmake_find_package"] = cmake_target self.cpp_info.components[pkgconfig_name].names["cmake_find_package_multi"] = cmake_target diff --git a/recipes/abseil/all/patches/0001-cmake-install.patch b/recipes/abseil/all/patches/0001-cmake-install.patch deleted file mode 100644 index a3b8fb54c4699..0000000000000 --- a/recipes/abseil/all/patches/0001-cmake-install.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -41,9 +41,9 @@ - # when absl is included as subproject (i.e. using add_subdirectory(abseil-cpp)) - # in the source tree of a project that uses it, install rules are disabled. - if(NOT "^${CMAKE_SOURCE_DIR}$" STREQUAL "^${PROJECT_SOURCE_DIR}$") -- set(ABSL_ENABLE_INSTALL FALSE) -+ option(ABSL_ENABLE_INSTALL "Enable install rule" OFF) - else() -- set(ABSL_ENABLE_INSTALL TRUE) -+ option(ABSL_ENABLE_INSTALL "Enable install rule" ON) - endif() - - list(APPEND CMAKE_MODULE_PATH diff --git a/recipes/abseil/all/patches/0002-missing-numeric_limits.h.patch b/recipes/abseil/all/patches/0002-missing-numeric_limits.h.patch deleted file mode 100644 index b21d60b80ba1b..0000000000000 --- a/recipes/abseil/all/patches/0002-missing-numeric_limits.h.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- absl/synchronization/internal/graphcycles.cc -+++ absl/synchronization/internal/graphcycles.cc -@@ -34,7 +34,7 @@ - #ifndef ABSL_LOW_LEVEL_ALLOC_MISSING - - #include "absl/synchronization/internal/graphcycles.h" -- -+#include - #include - #include - #include "absl/base/internal/hide_ptr.h" diff --git a/recipes/abseil/all/patches/0003-absl-string-libm-20230802.patch b/recipes/abseil/all/patches/0003-absl-string-libm-20230802.patch new file mode 100644 index 0000000000000..22d29acea39d9 --- /dev/null +++ b/recipes/abseil/all/patches/0003-absl-string-libm-20230802.patch @@ -0,0 +1,15 @@ +--- a/absl/strings/CMakeLists.txt ++++ b/absl/strings/CMakeLists.txt +@@ -31,9 +31,12 @@ + PUBLIC + ) + ++find_library(LIBM m) + absl_cc_library( + NAME + strings ++ LINKOPTS ++ $<$:-lm> + HDRS + "ascii.h" + "charconv.h" diff --git a/recipes/abseil/all/patches/0003-absl-string-libm-20240116.patch b/recipes/abseil/all/patches/0003-absl-string-libm-20240116.patch new file mode 100644 index 0000000000000..640ce8d7b642d --- /dev/null +++ b/recipes/abseil/all/patches/0003-absl-string-libm-20240116.patch @@ -0,0 +1,15 @@ +--- a/absl/strings/CMakeLists.txt ++++ b/absl/strings/CMakeLists.txt +@@ -32,9 +32,12 @@ + PUBLIC + ) + ++find_library(LIBM m) + absl_cc_library( + NAME + strings ++ LINKOPTS ++ $<$:-lm> + HDRS + "ascii.h" + "charconv.h" diff --git a/recipes/abseil/all/patches/0004-cpp-standard-20200225.patch b/recipes/abseil/all/patches/0004-cpp-standard-20200225.patch deleted file mode 100644 index 00042089d1476..0000000000000 --- a/recipes/abseil/all/patches/0004-cpp-standard-20200225.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- a/CMake/AbseilHelpers.cmake -+++ b/CMake/AbseilHelpers.cmake -@@ -204,8 +204,12 @@ function(absl_cc_library) - endif() - - # INTERFACE libraries can't have the CXX_STANDARD property set -+ if(ABSL_PROPAGATE_CXX_STD) -+ target_compile_features(${_NAME} PUBLIC cxx_std_11) -+ else() - set_property(TARGET ${_NAME} PROPERTY CXX_STANDARD ${ABSL_CXX_STANDARD}) - set_property(TARGET ${_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) -+ endif() - - # When being installed, we lose the absl_ prefix. We want to put it back - # to have properly named lib files. This is a no-op when we are not being diff --git a/recipes/abseil/all/patches/0004-cpp-standard-20200923.patch b/recipes/abseil/all/patches/0004-cpp-standard-20200923.patch deleted file mode 100644 index cabbdbc8eaa57..0000000000000 --- a/recipes/abseil/all/patches/0004-cpp-standard-20200923.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- a/CMake/AbseilHelpers.cmake -+++ b/CMake/AbseilHelpers.cmake -@@ -206,8 +206,12 @@ function(absl_cc_library) - endif() - - # INTERFACE libraries can't have the CXX_STANDARD property set -+ if(ABSL_PROPAGATE_CXX_STD) -+ target_compile_features(${_NAME} PUBLIC cxx_std_11) -+ else() - set_property(TARGET ${_NAME} PROPERTY CXX_STANDARD ${ABSL_CXX_STANDARD}) - set_property(TARGET ${_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) -+ endif() - - # When being installed, we lose the absl_ prefix. We want to put it back - # to have properly named lib files. This is a no-op when we are not being diff --git a/recipes/abseil/all/patches/0004-cpp-standard-20210324.patch b/recipes/abseil/all/patches/0004-cpp-standard-20210324.patch deleted file mode 100644 index fab934c4ee8b8..0000000000000 --- a/recipes/abseil/all/patches/0004-cpp-standard-20210324.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- a/CMake/AbseilHelpers.cmake -+++ b/CMake/AbseilHelpers.cmake -@@ -254,8 +254,12 @@ Cflags: -I\${includedir}${PC_CFLAGS}\n") - endif() - - # INTERFACE libraries can't have the CXX_STANDARD property set -+ if(ABSL_PROPAGATE_CXX_STD) -+ target_compile_features(${_NAME} PUBLIC cxx_std_11) -+ else() - set_property(TARGET ${_NAME} PROPERTY CXX_STANDARD ${ABSL_CXX_STANDARD}) - set_property(TARGET ${_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) -+ endif() - - # When being installed, we lose the absl_ prefix. We want to put it back - # to have properly named lib files. This is a no-op when we are not being diff --git a/recipes/abseil/all/patches/0004-test-allocator-testonly.patch b/recipes/abseil/all/patches/0004-test-allocator-testonly.patch new file mode 100644 index 0000000000000..909c1f791c488 --- /dev/null +++ b/recipes/abseil/all/patches/0004-test-allocator-testonly.patch @@ -0,0 +1,10 @@ +--- a/absl/container/CMakeLists.txt ++++ b/absl/container/CMakeLists.txt +@@ -213,6 +213,7 @@ absl_cc_library( + DEPS + absl::config + GTest::gmock ++ TESTONLY + ) + + absl_cc_test( diff --git a/recipes/abseil/all/patches/20230802.1-0001-fix-mingw.patch b/recipes/abseil/all/patches/20230802.1-0001-fix-mingw.patch new file mode 100644 index 0000000000000..fcb5987e76570 --- /dev/null +++ b/recipes/abseil/all/patches/20230802.1-0001-fix-mingw.patch @@ -0,0 +1,40 @@ +--- a/absl/synchronization/internal/pthread_waiter.h ++++ b/absl/synchronization/internal/pthread_waiter.h +@@ -16,7 +16,7 @@ + #ifndef ABSL_SYNCHRONIZATION_INTERNAL_PTHREAD_WAITER_H_ + #define ABSL_SYNCHRONIZATION_INTERNAL_PTHREAD_WAITER_H_ + +-#ifndef _WIN32 ++#if !defined(_WIN32) && !defined(__MINGW32__) + #include + + #include "absl/base/config.h" +@@ -55,6 +55,6 @@ class PthreadWaiter : public WaiterCrtp { + ABSL_NAMESPACE_END + } // namespace absl + +-#endif // ndef _WIN32 ++#endif // !defined(_WIN32) && !defined(__MINGW32__) + + #endif // ABSL_SYNCHRONIZATION_INTERNAL_PTHREAD_WAITER_H_ +--- a/absl/synchronization/internal/win32_waiter.h ++++ b/absl/synchronization/internal/win32_waiter.h +@@ -20,7 +20,8 @@ + #include + #endif + +-#if defined(_WIN32) && _WIN32_WINNT >= _WIN32_WINNT_VISTA ++#if defined(_WIN32) && !defined(__MINGW32__) && \ ++ _WIN32_WINNT >= _WIN32_WINNT_VISTA + + #include "absl/base/config.h" + #include "absl/synchronization/internal/kernel_timeout.h" +@@ -65,6 +66,7 @@ class Win32Waiter : public WaiterCrtp { + ABSL_NAMESPACE_END + } // namespace absl + +-#endif // defined(_WIN32) && _WIN32_WINNT >= _WIN32_WINNT_VISTA ++#endif // defined(_WIN32) && !defined(__MINGW32__) && ++ // _WIN32_WINNT >= _WIN32_WINNT_VISTA + + #endif // ABSL_SYNCHRONIZATION_INTERNAL_WIN32_WAITER_H_ diff --git a/recipes/abseil/all/patches/20240116.1-0001-fix-filesystem-include.patch b/recipes/abseil/all/patches/20240116.1-0001-fix-filesystem-include.patch new file mode 100644 index 0000000000000..f29ce6195fad0 --- /dev/null +++ b/recipes/abseil/all/patches/20240116.1-0001-fix-filesystem-include.patch @@ -0,0 +1,53 @@ +From bb83aceacb554e79e7cd2404856f0be30bd00303 Mon Sep 17 00:00:00 2001 +From: Derek Mauro +Date: Tue, 12 Mar 2024 08:33:40 -0700 +Subject: [PATCH] Fix GCC7 C++17 build + +GCC did not support until GCC8. + +Fixes #1635 + +PiperOrigin-RevId: 615051227 +Change-Id: If7cd5802ead40805b1ff1c3bdfc10ba6d2858ef0 +--- + absl/hash/hash_test.cc | 2 +- + absl/hash/internal/hash.h | 12 ++++++++++-- + 2 files changed, 11 insertions(+), 3 deletions(-) + +diff --git a/absl/hash/internal/hash.h b/absl/hash/internal/hash.h +index f4a94f9129f..b7d89b01807 100644 +--- a/absl/hash/internal/hash.h ++++ b/absl/hash/internal/hash.h +@@ -24,6 +24,15 @@ + #include + #endif + ++#include "absl/base/config.h" ++ ++// For feature testing and determining which headers can be included. ++#if ABSL_INTERNAL_CPLUSPLUS_LANG >= 202002L ++#include ++#else ++#include ++#endif ++ + #include + #include + #include +@@ -47,7 +56,6 @@ + #include + #include + +-#include "absl/base/config.h" + #include "absl/base/internal/unaligned_access.h" + #include "absl/base/port.h" + #include "absl/container/fixed_array.h" +@@ -61,7 +69,7 @@ + #include "absl/types/variant.h" + #include "absl/utility/utility.h" + +-#if ABSL_INTERNAL_CPLUSPLUS_LANG >= 201703L && \ ++#if defined(__cpp_lib_filesystem) && __cpp_lib_filesystem >= 201703L && \ + !defined(_LIBCPP_HAS_NO_FILESYSTEM_LIBRARY) + #include // NOLINT + #endif 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/config.yml b/recipes/abseil/config.yml index 450d16d77019e..d29c717557868 100644 --- a/recipes/abseil/config.yml +++ b/recipes/abseil/config.yml @@ -1,13 +1,15 @@ versions: - "20220623.1": + "20240722.0": folder: all - "20220623.0": + "20240116.2": folder: all - "20211102.0": + "20240116.1": folder: all - "20210324.2": + "20230802.1": folder: all - "20200923.3": + "20230125.3": folder: all - "20200225.3": + "20220623.1": + folder: all + "20211102.0": folder: all diff --git a/recipes/absent/all/conanfile.py b/recipes/absent/all/conanfile.py index bdc5f5e18836b..89db056b9c57b 100644 --- a/recipes/absent/all/conanfile.py +++ b/recipes/absent/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.microsoft import check_min_vs, is_msvc +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.43.0" +required_conan_version = ">=1.53.0" class AbsentConan(ConanFile): @@ -15,13 +21,13 @@ class AbsentConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" license = "MIT" topics = ("nullable-types", "composition", "monadic-interface", "declarative-programming") + package_type = "header-library" no_copy_source = True settings = "os", "arch", "compiler", "build_type" - generators = "cmake" @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 17 @property def _compilers_minimum_version(self): @@ -29,47 +35,49 @@ def _compilers_minimum_version(self): "gcc": "7", "clang": "5", "apple-clang": "10", - "Visual Studio": "15.7", } - def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, "17") - - 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] + def layout(self): + cmake_layout(self, src_folder="src") - 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 C++17, which your compiler does not support.".format(self.name) - ) + def validate(self): + 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." + ) 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 generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTS"] = False + tc.generate() - def _configure_cmake(self): + def build(self): cmake = CMake(self) - cmake.definitions["BUILD_TESTS"] = "OFF" - cmake.configure(source_folder=self._source_subfolder) - return cmake + cmake.configure() + # header_only - no 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", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "absent") self.cpp_info.set_property("cmake_target_name", "rvarago::absent") + self.cpp_info.components["absentlib"].set_property("cmake_target_name", "rvarago::absent") + # TODO: back to global scope in conan v2 once cmake_find_package_* generators removed self.cpp_info.components["absentlib"].bindirs = [] self.cpp_info.components["absentlib"].frameworkdirs = [] @@ -83,4 +91,3 @@ def package_info(self): self.cpp_info.names["cmake_find_package_multi"] = "rvarago" self.cpp_info.components["absentlib"].names["cmake_find_package"] = "absent" self.cpp_info.components["absentlib"].names["cmake_find_package_multi"] = "absent" - self.cpp_info.components["absentlib"].set_property("cmake_target_name", "rvarago::absent") diff --git a/recipes/absent/all/test_package/CMakeLists.txt b/recipes/absent/all/test_package/CMakeLists.txt index fe998526125cb..a092e06169aaf 100644 --- a/recipes/absent/all/test_package/CMakeLists.txt +++ b/recipes/absent/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ cmake_minimum_required(VERSION 3.8) project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(absent REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/absent/all/test_package/conanfile.py b/recipes/absent/all/test_package/conanfile.py index 38f4483872d47..02eb5ce439fb4 100644 --- a/recipes/absent/all/test_package/conanfile.py +++ b/recipes/absent/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,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/absent/all/test_v1_package/CMakeLists.txt b/recipes/absent/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..fb3acbf709bdb --- /dev/null +++ b/recipes/absent/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(absent REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +target_link_libraries(${PROJECT_NAME} rvarago::absent) diff --git a/recipes/byte-lite/all/test_v1_package/conanfile.py b/recipes/absent/all/test_v1_package/conanfile.py similarity index 100% rename from recipes/byte-lite/all/test_v1_package/conanfile.py rename to recipes/absent/all/test_v1_package/conanfile.py diff --git a/recipes/acado/all/CMakeLists.txt b/recipes/acado/all/CMakeLists.txt deleted file mode 100644 index bdffdd1faa9c7..0000000000000 --- a/recipes/acado/all/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -cmake_minimum_required(VERSION 3.10) -project(cmake_wrapper) - -set(CMAKE_CXX_STANDARD 11) - -list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder/cmake") - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/acado/all/cmake/qpoases.cmake b/recipes/acado/all/cmake/qpoases.cmake index d944291553890..c37969b71a13d 100644 --- a/recipes/acado/all/cmake/qpoases.cmake +++ b/recipes/acado/all/cmake/qpoases.cmake @@ -1,16 +1,16 @@ -SET( ACADO_QPOASES_EMBEDDED_SOURCES +SET( ACADO_QPOASES_EMBEDDED_SOURCES ${CMAKE_CURRENT_LIST_DIR}/qpoases/SRC/Bounds.cpp - ${CMAKE_CURRENT_LIST_DIR}/qpoases/SRC/CyclingManager.cpp + ${CMAKE_CURRENT_LIST_DIR}/qpoases/SRC/CyclingManager.cpp ${CMAKE_CURRENT_LIST_DIR}/qpoases/SRC/MessageHandling.cpp ${CMAKE_CURRENT_LIST_DIR}/qpoases/SRC/QProblem.cpp ${CMAKE_CURRENT_LIST_DIR}/qpoases/SRC/Utils.cpp ${CMAKE_CURRENT_LIST_DIR}/qpoases/SRC/Constraints.cpp - ${CMAKE_CURRENT_LIST_DIR}/qpoases/SRC/Indexlist.cpp + ${CMAKE_CURRENT_LIST_DIR}/qpoases/SRC/Indexlist.cpp ${CMAKE_CURRENT_LIST_DIR}/qpoases/SRC/QProblemB.cpp ${CMAKE_CURRENT_LIST_DIR}/qpoases/SRC/SubjectTo.cpp ${CMAKE_CURRENT_LIST_DIR}/qpoases/SRC/EXTRAS/SolutionAnalysis.cpp ) -SET( ACADO_QPOASES_EMBEDDED_INC_DIRS +SET( ACADO_QPOASES_EMBEDDED_INC_DIRS ${CMAKE_CURRENT_LIST_DIR}/qpoases/ ${CMAKE_CURRENT_LIST_DIR}/qpoases/INCLUDE ${CMAKE_CURRENT_LIST_DIR}/qpoases/SRC diff --git a/recipes/acado/all/conandata.yml b/recipes/acado/all/conandata.yml index b0f501df26562..648b840430e1f 100644 --- a/recipes/acado/all/conandata.yml +++ b/recipes/acado/all/conandata.yml @@ -4,7 +4,10 @@ sources: sha256: "cf0779e64dd5d20989e97340c04ecccf542fe8d993c96b53e5c465693cb354b7" patches: "1.2.2-beta": - - base_path: "source_subfolder" - patch_file: "patches/0001-binding-temp-object.patch" - - base_path: "source_subfolder" - patch_file: "patches/0002-read-template-path-from-env.patch" + - patch_file: "patches/0001-binding-temp-object.patch" + - patch_file: "patches/0002-read-template-path-from-env.patch" + patch_description: "Get TEMPLATE_PATHS from envvar instead of hard-coding" + patch_type: "conan" + - patch_file: "patches/0003-unvendor-qpoases3.patch" + patch_description: "Replace vendored qpOASES-3 with Conan version" + patch_type: "conan" diff --git a/recipes/acado/all/conanfile.py b/recipes/acado/all/conanfile.py index d9e09e4b5548b..96a368dbfe81f 100644 --- a/recipes/acado/all/conanfile.py +++ b/recipes/acado/all/conanfile.py @@ -1,19 +1,24 @@ import os -import glob -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.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 + +required_conan_version = ">=1.53.0" class AcadoConan(ConanFile): name = "acado" - description = "ACADO Toolkit is a software environment and algorithm collection for automatic control and dynamic optimization." + description = ("ACADO Toolkit is a software environment and algorithm " + "collection for automatic control and dynamic optimization.") license = "LGPL-3.0" - topics = ("conan", "acado", "control", "optimization", "mpc") - homepage = "https://github.com/acado/acado" url = "https://github.com/conan-io/conan-center-index" - exports_sources = ["CMakeLists.txt", "cmake/qpoases.cmake", "patches/**"] - generators = "cmake" + homepage = "https://github.com/acado/acado" + topics = ("control", "optimization", "mpc") + + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -25,12 +30,11 @@ class AcadoConan(ConanFile): "fPIC": True, "codegen_only": True, } + short_paths = True - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + export_conandata_patches(self) + copy(self, "cmake/qpoases.cmake", src=self.recipe_folder, dst=self.export_sources_folder) def config_options(self): if self.settings.os == "Windows": @@ -38,93 +42,120 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - - def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = glob.glob("acado-*/")[0] - os.rename(extracted_dir, self._source_subfolder) + self.options.rm_safe("fPIC") - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) + def layout(self): + cmake_layout(self, src_folder="src") - self._cmake.definitions["ACADO_BUILD_SHARED"] = self.options.shared - self._cmake.definitions["ACADO_BUILD_STATIC"] = not self.options.shared + def requirements(self): + # Note: ACADO also separately vendors and exports qpOASES v1.3 for code generation. + self.requires("qpoases/3.2.1") - self._cmake.definitions["ACADO_WITH_EXAMPLES"] = False - self._cmake.definitions["ACADO_WITH_TESTING"] = False - self._cmake.definitions["ACADO_DEVELOPER"] = False - self._cmake.definitions["ACADO_INTERNAL"] = False - self._cmake.definitions["ACADO_BUILD_CGT_ONLY"] = self.options.codegen_only - - # ACADO logs 170.000 lines of warnings, so we disable them - self._cmake.definitions["CMAKE_C_FLAGS"] = "-w" - self._cmake.definitions["CMAKE_CXX_FLAGS"] = "-w" + def validate(self): + if is_msvc(self) and self.options.shared: + # https://github.com/acado/acado/blob/b4e28f3131f79cadfd1a001e9fff061f361d3a0f/CMakeLists.txt#L77-L80 + raise ConanInvalidConfiguration("Acado does not support shared builds on Windows.") + if self.settings.compiler == "apple-clang": + raise ConanInvalidConfiguration("apple-clang not supported") + if self.settings.compiler == "clang" and self.settings.compiler.version == "9": + raise ConanInvalidConfiguration("acado can not be built by Clang 9.") + if conan_version.major < 2 and self.settings.compiler in ["clang", "gcc"] and self.settings.compiler.libcxx != "libstdc++11": + raise ConanInvalidConfiguration("libstdc++11 required") - self._cmake.configure() - return self._cmake + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["ACADO_BUILD_SHARED"] = self.options.shared + tc.cache_variables["ACADO_BUILD_STATIC"] = not self.options.shared + tc.cache_variables["ACADO_BUILD_CGT_ONLY"] = self.options.codegen_only + tc.cache_variables["ACADO_WITH_EXAMPLES"] = False + tc.cache_variables["ACADO_WITH_TESTING"] = False + tc.cache_variables["ACADO_DEVELOPER"] = False + tc.cache_variables["ACADO_INTERNAL"] = False + # The build logs 170,000 lines of warnings otherwise + tc.variables["CMAKE_C_FLAGS"] = "-w" + tc.variables["CMAKE_CXX_FLAGS"] = "-w" + tc.variables["CMAKE_CXX_STANDARD"] = 11 + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def _patch_sources(self): - for patch in self.conan_data["patches"][self.version]: - tools.patch(**patch) + apply_conandata_patches(self) + # TODO: Use Eigen from Conan. Failed with static assert errors even if using matching eigen/3.2.0 version for some reason. + # rmdir(self, os.path.join(self.source_folder, "external_packages", "eigen3")) + # replace_in_file(self, os.path.join(self.source_folder, "acado/matrix_vector/matrix_vector_tools.hpp"), + # "external_packages/eigen3/", "") def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() @property def _qpoases_sources(self): - return os.path.join("lib", "cmake", "qpoases") + return os.path.join(self.package_folder, "lib", "cmake", "qpoases") def package(self): - self.copy("LICENSE.txt", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() - cmake.install() + copy(self, "LICENSE.txt", + src=self.source_folder, + dst=os.path.join(self.package_folder, "licenses")) - self.copy("*", src="lib", dst="lib") - self.copy("qpoases.cmake", src="cmake", dst="lib/cmake") - qpoases_sources_from = os.path.join(self.package_folder, "share", "acado", "external_packages", "qpoases") - self.copy("*", src=qpoases_sources_from, dst=self._qpoases_sources) + cmake = CMake(self) + cmake.install() - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.remove_files_by_mask(self.package_folder, "*.pdb") + if not self.options.shared: + # Copy internal static acado_casadi lib + copy(self, "*acado_casadi*", + src=os.path.join(self.build_folder, "lib"), + dst=os.path.join(self.package_folder, "lib"), + keep_path=False) + + # Copy embedded qpOASES v1.3 sources for code generation + copy(self, "qpoases.cmake", + src=os.path.join(self.export_sources_folder, "cmake"), + dst=os.path.join(self.package_folder, "lib", "cmake")) + copy(self, "*", + src=os.path.join(self.package_folder, "share", "acado", "external_packages", "qpoases"), + dst=self._qpoases_sources) + + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "*.pdb", self.package_folder, recursive=True) + rm(self, "*.exp", self.package_folder, recursive=True) def package_info(self): - acado_template_paths = os.path.join(self.package_folder, "include", "acado", "code_generation", "templates") - self.output.info("Setting ACADO_TEMPLATE_PATHS environment variable: {}".format(acado_template_paths)) - self.env_info.ACADO_TEMPLATE_PATHS = acado_template_paths + self.cpp_info.set_property("cmake_file_name", "ACADO") + self.cpp_info.set_property("cmake_target_name", "ACADO::ACADO") if self.options.shared: - self.cpp_info.libs = ["acado_toolkit_s", "acado_casadi"] + self.cpp_info.libs = ["acado_toolkit_s"] else: self.cpp_info.libs = ["acado_toolkit", "acado_casadi"] - self.cpp_info.names["cmake_find_package"] = "ACADO" - self.cpp_info.names["cmake_find_package_multi"] = "ACADO" + self.cpp_info.includedirs.append(os.path.join("include", "acado")) - self.cpp_info.builddirs.append(os.path.join("lib", "cmake")) - self.cpp_info.build_modules.append(os.path.join("lib", "cmake", "qpoases.cmake")) + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") - self.cpp_info.includedirs.append(os.path.join("include", "acado")) - self.cpp_info.includedirs.append(self._qpoases_sources) - self.cpp_info.includedirs.append(os.path.join(self._qpoases_sources, "INCLUDE")) - self.cpp_info.includedirs.append(os.path.join(self._qpoases_sources, "SRC")) + self.cpp_info.builddirs.append(os.path.join("lib", "cmake")) + self.cpp_info.set_property("cmake_build_modules", [os.path.join("lib", "cmake", "qpoases.cmake")]) + self.cpp_info.includedirs += [ + self._qpoases_sources, + os.path.join(self._qpoases_sources, "INCLUDE"), + os.path.join(self._qpoases_sources, "SRC"), + ] - def validate(self): - if self.settings.compiler == "Visual Studio" and self.options.shared: - # https://github.com/acado/acado/blob/b4e28f3131f79cadfd1a001e9fff061f361d3a0f/CMakeLists.txt#L77-L80 - raise ConanInvalidConfiguration("Acado does not support shared builds on Windows.") - if self.settings.compiler == "apple-clang": - raise ConanInvalidConfiguration("apple-clang not supported") - if self.settings.compiler == "clang" and self.settings.compiler.version == "9": - raise ConanInvalidConfiguration("acado can not be built by Clang 9.") + acado_template_paths = os.path.join(self.package_folder, "include", "acado", "code_generation", "templates") + self.conf_info.define("user.acado:template_paths", acado_template_paths) + self.buildenv_info.define_path("ACADO_TEMPLATE_PATHS", acado_template_paths) - # acado requires libstdc++11 for shared builds - # https://github.com/conan-io/conan-center-index/pull/3967#issuecomment-752985640 - if self.options.shared and self.settings.compiler == "clang" and self.settings.compiler.libcxx != "libstdc++11": - raise ConanInvalidConfiguration("libstdc++11 required") - if self.options.shared and self.settings.compiler == "gcc" and self.settings.compiler.libcxx != "libstdc++11": - raise ConanInvalidConfiguration("libstdc++11 required") + # TODO: to remove in conan v2 + self.env_info.ACADO_TEMPLATE_PATHS = acado_template_paths + self.cpp_info.names["cmake_find_package"] = "ACADO" + self.cpp_info.names["cmake_find_package_multi"] = "ACADO" + self.cpp_info.build_modules["cmake_find_package"].append(os.path.join("lib", "cmake", "qpoases.cmake")) + self.cpp_info.build_modules["cmake_find_package_multi"].append(os.path.join("lib", "cmake", "qpoases.cmake")) diff --git a/recipes/acado/all/patches/0003-unvendor-qpoases3.patch b/recipes/acado/all/patches/0003-unvendor-qpoases3.patch new file mode 100644 index 0000000000000..fd5828c4a2a61 --- /dev/null +++ b/recipes/acado/all/patches/0003-unvendor-qpoases3.patch @@ -0,0 +1,40 @@ +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -25,7 +25,7 @@ + # + # Minimum required version of cmake + # +-CMAKE_MINIMUM_REQUIRED( VERSION 2.8 ) ++CMAKE_MINIMUM_REQUIRED( VERSION 3.15 ) + + # + # Project name and programming languages used +@@ -179,7 +179,6 @@ + ${PROJECT_SOURCE_DIR} + ${PROJECT_SOURCE_DIR}/acado + ${PROJECT_SOURCE_DIR}/external_packages +- ${PROJECT_SOURCE_DIR}/external_packages/qpOASES-3.2.0/include + ${PROJECT_BINARY_DIR} + ) + +@@ -198,11 +197,6 @@ + ################################################################################ + + IF (NOT ACADO_BUILD_CGT_ONLY) +- # +- # Build qpOASES library +- # +- ADD_SUBDIRECTORY( ./external_packages/qpOASES-3.2.0 ) +- + # + # Build csparse library + # +@@ -378,7 +344,6 @@ + ${PROJECT_SOURCE_DIR} + ${PROJECT_SOURCE_DIR}/acado + ${PROJECT_SOURCE_DIR}/external_packages +- ${PROJECT_SOURCE_DIR}/external_packages/qpOASES-3.2.0/include + ${PROJECT_BINARY_DIR} + ) + + CONFIGURE_FILE( diff --git a/recipes/acado/all/test_package/CMakeLists.txt b/recipes/acado/all/test_package/CMakeLists.txt index 29d9de3546c79..4aa2d543607d9 100644 --- a/recipes/acado/all/test_package/CMakeLists.txt +++ b/recipes/acado/all/test_package/CMakeLists.txt @@ -1,12 +1,13 @@ -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.15) project(test_package CXX C) -set(CMAKE_CXX_STANDARD 11) +if(NOT DEFINED ENV{ACADO_TEMPLATE_PATHS}) + message(FATAL_ERROR "ACADO_TEMPLATE_PATHS environment variable not set") +endif() -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup(TARGETS) +set(CMAKE_CXX_STANDARD 11) -find_package(ACADO REQUIRED) +find_package(ACADO REQUIRED CONFIG) add_executable(codegen codegen.cpp) target_link_libraries(codegen PRIVATE ACADO::ACADO) @@ -30,10 +31,7 @@ add_custom_command( DEPENDS codegen) add_library(mpc_codegen STATIC ${codegen_GENERATED_FILES} ${ACADO_QPOASES_EMBEDDED_SOURCES}) -target_include_directories(mpc_codegen - SYSTEM PUBLIC - ${CODEGEN_DIR} - ${ACADO_QPOASES_EMBEDDED_INC_DIRS}) +target_include_directories(mpc_codegen PUBLIC ${CODEGEN_DIR} ${ACADO_QPOASES_EMBEDDED_INC_DIRS}) add_executable(test_package test_package.cpp) target_link_libraries(test_package PRIVATE mpc_codegen) diff --git a/recipes/acado/all/test_package/conanfile.py b/recipes/acado/all/test_package/conanfile.py index 3cdacb96b0c8c..7019a80802df9 100644 --- a/recipes/acado/all/test_package/conanfile.py +++ b/recipes/acado/all/test_package/conanfile.py @@ -1,19 +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", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv", "VirtualBuildEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) - # FIXME: CCI infrastructure should provide cpu count input to avoid errors - cmake.parallel = False 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/acado/all/test_v1_package/CMakeLists.txt b/recipes/acado/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/acado/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/acado/all/test_v1_package/conanfile.py b/recipes/acado/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..e34dbc52de848 --- /dev/null +++ b/recipes/acado/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", "VirtualBuildEnv" + + def build(self): + cmake = CMake(self) + # FIXME: CCI infrastructure should provide cpu count input to avoid errors + cmake.parallel = False + 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/accellera-uvm-systemc/all/conanfile.py b/recipes/accellera-uvm-systemc/all/conanfile.py index 98ed0d0f6aa37..edae984b0d813 100644 --- a/recipes/accellera-uvm-systemc/all/conanfile.py +++ b/recipes/accellera-uvm-systemc/all/conanfile.py @@ -1,72 +1,80 @@ +import os + from conan import ConanFile -from conans import AutoToolsBuildEnvironment -from conan.tools.files import get, rmdir, rm, copy, rename -from conan.tools.scm import Version -from conan.tools.build import check_min_cppstd from conan.errors import ConanInvalidConfiguration -import os +from conan.tools.apple import is_apple_os +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, rmdir, rm, copy, rename, replace_in_file +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" -required_conan_version = ">=1.50.0" class UvmSystemC(ConanFile): name = "accellera-uvm-systemc" - description = """Universal Verification Methodology for SystemC""" - homepage = "https://systemc.org/about/systemc-verification/uvm-systemc-faq" - url = "https://github.com/conan-io/conan-center-index" + description = "Universal Verification Methodology for SystemC" license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://systemc.org/overview/uvm-systemc-faq" topics = ("systemc", "verification", "tlm", "uvm") - settings = "os", "compiler", "build_type", "arch" + + package_type = "library" + 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" - - def build_requirements(self): - self.tool_requires("cmake/3.24.0") - self.tool_requires("systemc/2.3.3") - 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("systemc/2.3.4", transitive_headers=True, transitive_libs=True) + def validate(self): - if self.settings.os == "Macos": - raise ConanInvalidConfiguration("Macos build not supported") - if self.settings.os == "Windows": - raise ConanInvalidConfiguration("Windows build not yet supported") + if self.settings.os == "Windows" or is_apple_os(self): + raise ConanInvalidConfiguration(f"{self.settings.os} build not supported") if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, 11) if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "7": raise ConanInvalidConfiguration("GCC < version 7 is not supported") 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) + + def generate(self): + tc = AutotoolsToolchain(self) + systemc_root = self.dependencies["systemc"].package_folder + tc.configure_args.append(f"--with-systemc={systemc_root}") + tc.generate() def build(self): - autotools = AutoToolsBuildEnvironment(self) - args = [f"--with-systemc={self.deps_cpp_info['systemc'].rootpath}"] - if self.options.shared: - args.extend(["--enable-shared", "--disable-static"]) - else: - args.extend(["--enable-static", "--disable-shared"]) - autotools.configure(configure_dir=self._source_subfolder, args=args) + autotools = Autotools(self) + autotools.configure() + # Replace lib-linux64/ with lib/ for the systemc dependency + replace_in_file(self, os.path.join(self.build_folder, "src", "uvmsc", "Makefile"), + "-linux64", "") autotools.make() def package(self): - copy(self, "LICENSE", src=os.path.join(self.build_folder, self._source_subfolder), dst=os.path.join(self.package_folder, "licenses")) - copy(self, "NOTICE", src=os.path.join(self.build_folder, self._source_subfolder), dst=os.path.join(self.package_folder, "licenses")) - copy(self, "COPYING", src=os.path.join(self.build_folder, self._source_subfolder), dst=os.path.join(self.package_folder, "licenses")) - autotools = AutoToolsBuildEnvironment(self) + for license in ["LICENSE", "NOTICE", "COPYING"]: + 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, "docs")) rmdir(self, os.path.join(self.package_folder, "examples")) rm(self, "AUTHORS", self.package_folder) @@ -78,7 +86,9 @@ def package(self): rm(self, "RELEASENOTES", self.package_folder) rm(self, "README", self.package_folder) rm(self, "INSTALL", self.package_folder) - rename(self, os.path.join(self.package_folder, "lib-linux64"), os.path.join(self.package_folder, "lib")) + rename(self, + os.path.join(self.package_folder, "lib-linux64"), + os.path.join(self.package_folder, "lib")) rm(self, "libuvm-systemc.la", os.path.join(self.package_folder, "lib")) rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) diff --git a/recipes/accellera-uvm-systemc/all/test_package/CMakeLists.txt b/recipes/accellera-uvm-systemc/all/test_package/CMakeLists.txt index 29a5f29bd6062..0dbdd7f01d340 100644 --- a/recipes/accellera-uvm-systemc/all/test_package/CMakeLists.txt +++ b/recipes/accellera-uvm-systemc/all/test_package/CMakeLists.txt @@ -1,10 +1,8 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(accellera-uvm-systemc REQUIRED CONFIG) add_executable(${PROJECT_NAME} example.cpp) target_link_libraries(${PROJECT_NAME} accellera-uvm-systemc::accellera-uvm-systemc) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/accellera-uvm-systemc/all/test_package/conanfile.py b/recipes/accellera-uvm-systemc/all/test_package/conanfile.py index 7c46504cf008f..ef5d7042163ec 100644 --- a/recipes/accellera-uvm-systemc/all/test_package/conanfile.py +++ b/recipes/accellera-uvm-systemc/all/test_package/conanfile.py @@ -1,18 +1,26 @@ +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 -from conan.tools.build import cross_building -class UvmSystemcTestConan(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) 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/accellera-uvm-systemc/all/test_package/example.cpp b/recipes/accellera-uvm-systemc/all/test_package/example.cpp index db58543c27400..47640ade3dcac 100644 --- a/recipes/accellera-uvm-systemc/all/test_package/example.cpp +++ b/recipes/accellera-uvm-systemc/all/test_package/example.cpp @@ -1,12 +1,17 @@ #include "uvmsc/base/uvm_version.h" +#include "systemc" #include using namespace uvm; +// Required for linking with SystemC +int sc_main(int, char*[]) +{ + return 0; +} + int main(int, char*[]) { std::cout << "uvm-systemc version " << uvm_revision_string() << " loaded successfully."; - return 0; } - diff --git a/recipes/accellera-uvm-systemc/all/test_v1_package/CMakeLists.txt b/recipes/accellera-uvm-systemc/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/accellera-uvm-systemc/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/accellera-uvm-systemc/all/test_v1_package/conanfile.py b/recipes/accellera-uvm-systemc/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..7c46504cf008f --- /dev/null +++ b/recipes/accellera-uvm-systemc/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +import os + +from conans import ConanFile, CMake +from conan.tools.build import cross_building + +class UvmSystemcTestConan(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/access_private/all/conanfile.py b/recipes/access_private/all/conanfile.py index da35dc6ea7e6e..f7bfa16e97f6c 100644 --- a/recipes/access_private/all/conanfile.py +++ b/recipes/access_private/all/conanfile.py @@ -11,12 +11,17 @@ class AccessPrivateConan(ConanFile): name = "access_private" description = "Access private members and statics of a C++ class" license = "MIT" - topics = ("access", "private", "header-only") - homepage = "https://github.com/martong/access_private" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/martong/access_private" + topics = ("access", "private", "header-only") + + package_type = "header-library" 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,12 +29,8 @@ 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def build(self): pass diff --git a/recipes/access_private/all/test_v1_package/CMakeLists.txt b/recipes/access_private/all/test_v1_package/CMakeLists.txt index 01b3a8050e773..91630d79f4abb 100644 --- a/recipes/access_private/all/test_v1_package/CMakeLists.txt +++ b/recipes/access_private/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.15) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(access_private REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE access_private::access_private) -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/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/giflib/5.2.x/test_v1_package/CMakeLists.txt b/recipes/acl/all/test_v1_package/CMakeLists.txt similarity index 100% rename from recipes/giflib/5.2.x/test_v1_package/CMakeLists.txt rename to recipes/acl/all/test_v1_package/CMakeLists.txt diff --git a/recipes/cpp-httplib/all/test_v1_package/conanfile.py b/recipes/acl/all/test_v1_package/conanfile.py similarity index 100% rename from recipes/cpp-httplib/all/test_v1_package/conanfile.py rename to recipes/acl/all/test_v1_package/conanfile.py diff --git a/recipes/ada/all/conandata.yml b/recipes/ada/all/conandata.yml new file mode 100644 index 0000000000000..d02f03916e176 --- /dev/null +++ b/recipes/ada/all/conandata.yml @@ -0,0 +1,22 @@ +sources: + "2.9.2": + url: "https://github.com/ada-url/ada/archive/v2.9.2.tar.gz" + sha256: "f41575ad7eec833afd9f6a0d6101ee7dc2f947fdf19ae8f1b54a71d59f4ba5ec" + "2.9.1": + url: "https://github.com/ada-url/ada/archive/v2.9.1.tar.gz" + sha256: "64eb3d91db941645d1b68ac8d1cbb7b534fbe446b66c1da11e384e17fca975e7" + "2.9.0": + url: "https://github.com/ada-url/ada/archive/v2.9.0.tar.gz" + sha256: "8b992f0ce9134cb4eafb74b164d2ce2cb3af1900902162713b0e0c5ab0b6acd8" + "2.8.0": + url: "https://github.com/ada-url/ada/archive/v2.8.0.tar.gz" + sha256: "83b77fb53d1a9eea22b1484472cea0215c50478c9ea2b4b44b0ba3b52e07c139" + "2.7.8": + url: "https://github.com/ada-url/ada/archive/v2.7.8.tar.gz" + sha256: "8de067b7cb3da1808bf5439279aee6048d761ba246bf8a854c2af73b16b41c75" + "2.6.10": + url: "https://github.com/ada-url/ada/archive/v2.6.10.tar.gz" + sha256: "a43e1ea0bcdd7585edf538afffe1fc3303b936752e18bac545fa11729de088bc" + "2.5.1": + url: "https://github.com/ada-url/ada/archive/v2.5.1.tar.gz" + sha256: "a7591d771822c3f16e6665311b0c6b4de7dd7615333183f35d89c7573be7f7fa" diff --git a/recipes/ada/all/conanfile.py b/recipes/ada/all/conanfile.py new file mode 100644 index 0000000000000..68040e8519671 --- /dev/null +++ b/recipes/ada/all/conanfile.py @@ -0,0 +1,104 @@ +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.53.0" + +class AdaConan(ConanFile): + name = "ada" + description = "WHATWG-compliant URL parser written in modern C++" + license = ("Apache-2.0", "MIT") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/ada-url/ada" + topics = ("url", "parser", "WHATWG") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "fPIC": [True, False], + "shared": [True, False], + } + default_options = { + "fPIC": True, + "shared": False, + } + + @property + def _min_cppstd(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "9", + "clang": "10", + "apple-clang": "12", + "Visual Studio": "16", + "msvc": "192", + } + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.get_safe("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." + ) + + if self.settings.compiler == "clang" and Version(self.settings.compiler.version) < "12.0.0" and self.settings.compiler.libcxx != "libc++": + raise ConanInvalidConfiguration( + f"{self.ref} requires , please use libc++ or upgrade compiler." + ) + + def build_requirements(self): + self.tool_requires("cmake/[>=3.16 <4]") + + 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.variables["ADA_TOOLS"] = False + tc.generate() + + deps = CMakeDeps(self) + deps.generate() + + def _patch_sources(self): + # solve APPLE RELOCATABLE SHARED LIBS (KB-H077) + if Version(self.version) < "2.6.10": + replace_in_file(self, os.path.join(self.source_folder, "cmake", "ada-flags.cmake"), "set(CMAKE_MACOSX_RPATH OFF)", "") + + def build(self): + self._patch_sources() + 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 = ["ada"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") diff --git a/recipes/ada/all/test_package/CMakeLists.txt b/recipes/ada/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..524bc69392b7b --- /dev/null +++ b/recipes/ada/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package LANGUAGES CXX) + +find_package(ada REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE ada::ada) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/ada/all/test_package/conanfile.py b/recipes/ada/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fbb7f543162 --- /dev/null +++ b/recipes/ada/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/ada/all/test_package/test_package.cpp b/recipes/ada/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..e326ebf6d12c0 --- /dev/null +++ b/recipes/ada/all/test_package/test_package.cpp @@ -0,0 +1,14 @@ +#include + +#include "ada.h" + +int main() { + ada::result url = ada::parse("https://www.google.com"); + if(!url) { + return 1; + } + + std::cout << url->get_host() << std::endl; + + return 0; +} diff --git a/docs/package_templates/cmake_package/all/test_v1_package/CMakeLists.txt b/recipes/ada/all/test_v1_package/CMakeLists.txt similarity index 100% rename from docs/package_templates/cmake_package/all/test_v1_package/CMakeLists.txt rename to recipes/ada/all/test_v1_package/CMakeLists.txt diff --git a/recipes/arrow/all/test_v1_package/conanfile.py b/recipes/ada/all/test_v1_package/conanfile.py similarity index 100% rename from recipes/arrow/all/test_v1_package/conanfile.py rename to recipes/ada/all/test_v1_package/conanfile.py diff --git a/recipes/ada/config.yml b/recipes/ada/config.yml new file mode 100644 index 0000000000000..29ab8232ac483 --- /dev/null +++ b/recipes/ada/config.yml @@ -0,0 +1,15 @@ +versions: + "2.9.2": + folder: all + "2.9.1": + folder: all + "2.9.0": + folder: all + "2.8.0": + folder: all + "2.7.8": + folder: all + "2.6.10": + folder: all + "2.5.1": + folder: all diff --git a/recipes/ade/all/conandata.yml b/recipes/ade/all/conandata.yml index 954c10dfe2c1d..0ce2795d9939c 100644 --- a/recipes/ade/all/conandata.yml +++ b/recipes/ade/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "0.1.2d": + url: "https://github.com/opencv/ade/archive/refs/tags/v0.1.2d.tar.gz" + sha256: "edefba61a33d6cd4b78a9976cb3309c95212610a81ba6dade09882d1794198ff" + "0.1.2c": + url: "https://github.com/opencv/ade/archive/refs/tags/v0.1.2c.tar.gz" + sha256: "1387891c707c6e5c76448ea09e2df2e8bce1645c11f262c10b3f3ebec88749c2" "0.1.2a": url: "https://github.com/opencv/ade/archive/refs/tags/v0.1.2a.tar.gz" sha256: "c022a688b0554017e46e1cbdeb0105e625ca090fc3755c15df8c4451a304e084" diff --git a/recipes/ade/all/conanfile.py b/recipes/ade/all/conanfile.py index 7a3013131f30c..2e4dc8aa99a3a 100644 --- a/recipes/ade/all/conanfile.py +++ b/recipes/ade/all/conanfile.py @@ -16,6 +16,7 @@ class AdeConan(ConanFile): description = "Graph construction, manipulation, and processing framework" topics = ("graphs", "opencv") + package_type = "static-library" settings = "os", "arch", "compiler", "build_type" options = { "fPIC": [True, False], @@ -28,16 +29,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..91630d79f4abb 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.15) +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 cbf2f373fb630..922bcf0946745 100644 --- a/recipes/ade/config.yml +++ b/recipes/ade/config.yml @@ -1,4 +1,8 @@ versions: + "0.1.2d": + folder: "all" + "0.1.2c": + folder: "all" "0.1.2a": folder: "all" "0.1.1f": 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..c3ee6521cf6a5 100644 --- a/recipes/aeron/all/conandata.yml +++ b/recipes/aeron/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.41.4": + url: "https://github.com/real-logic/aeron/archive/1.41.4.tar.gz" + sha256: "681e2a045ca04672612b6edeb7a09c0d574e12c6875cfe26f677b12772d71ad5" "1.35.1": url: "https://github.com/real-logic/aeron/archive/1.35.1.tar.gz" sha256: "19b0f27c2cbc27b422e26a533e4a04a60592217e1c70fdbdd48a92a7b932cccb" @@ -11,6 +14,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..813ca895247cd 100644 --- a/recipes/aeron/all/conanfile.py +++ b/recipes/aeron/all/conanfile.py @@ -1,141 +1,152 @@ -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" + homepage = "https://github.com/real-logic/aeron" license = "Apache-2.0" - exports_sources = "CMakeLists.txt", + + package_type = "library" 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': + 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 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.19") - 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 + # The finite-math-only optimization has no effect and can cause linking errors + # when linked against glibc >= 2.31 + tc.blocks["cmake_flags_init"].template += ( + 'string(APPEND CMAKE_CXX_FLAGS_INIT " -fno-finite-math-only")\n' + 'string(APPEND CMAKE_C_FLAGS_INIT " -fno-finite-math-only")\n' + ) + 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..91630d79f4abb --- /dev/null +++ b/recipes/aeron/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/flecs/all/test_v1_package/conanfile.py b/recipes/aeron/all/test_v1_package/conanfile.py similarity index 100% rename from recipes/flecs/all/test_v1_package/conanfile.py rename to recipes/aeron/all/test_v1_package/conanfile.py diff --git a/recipes/aeron/config.yml b/recipes/aeron/config.yml index 33785dfd3b513..9f6aea7a8f54b 100644 --- a/recipes/aeron/config.yml +++ b/recipes/aeron/config.yml @@ -1,4 +1,6 @@ versions: + "1.41.4": + folder: all "1.35.1": folder: all "1.34.0": @@ -7,5 +9,3 @@ versions: folder: all "1.32.0": folder: all - "1.31.2": - folder: all diff --git a/recipes/aggeom-agg/all/conandata.yml b/recipes/aggeom-agg/all/conandata.yml new file mode 100644 index 0000000000000..9203b7fc5e424 --- /dev/null +++ b/recipes/aggeom-agg/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "2.6.1": + url: "https://github.com/aggeom/agg-2.6/archive/refs/tags/agg-2.6.1.tar.gz" + sha256: 685966f880f1c2aae19479b60525fafba8cbd88e4c62d1947767780df8f6a3d0 + "2.7.1": + url: "https://github.com/aggeom/agg-2.6/archive/refs/tags/agg-2.7.1.tar.gz" + sha256: 2174e55d7169502293e86f728d8698b5198dc7e42fbbda39e4d34c1411d1ac7a diff --git a/recipes/aggeom-agg/all/conanfile.py b/recipes/aggeom-agg/all/conanfile.py new file mode 100644 index 0000000000000..de0179059224e --- /dev/null +++ b/recipes/aggeom-agg/all/conanfile.py @@ -0,0 +1,138 @@ +import os + +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, rmdir + +required_conan_version = ">=1.53.0" + +class AggConan(ConanFile): + name = "aggeom-agg" + description = "AGG Anti-Grain Geometry Library" + license = "BSD-3-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/aggeom" + topics = ("graphics",) + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_gpc": [True, False], + "with_freetype": [True, False], + "with_agg2d": [True, False], + "with_agg2d_freetype": [True, False], + "with_platform": [True, False], + "with_controls": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_gpc": True, + "with_freetype": True, + "with_agg2d": True, + "with_agg2d_freetype": True, + "with_platform": True, + "with_controls": True, + } + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + if self.options.with_freetype: + self.requires("freetype/2.13.2") + if self.options.with_platform and self.settings.os in ["Linux"]: + self.requires("xorg/system") + + def validate(self): + if self.settings.os not in ("Windows", "Linux"): + raise ConanInvalidConfiguration("OS is not supported") + if self.options.shared: + raise ConanInvalidConfiguration("Invalid configuration") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["agg_USE_EXPAT"] = False + tc.variables["agg_USE_SDL_PLATFORM"] = False + tc.variables["agg_BUILD_DEMO"] = False + tc.variables["agg_BUILD_EXAMPLES"] = False + + tc.variables["agg_USE_GPC"] = self.options.with_gpc + tc.variables["agg_USE_FREETYPE"] = self.options.with_freetype + tc.variables["agg_USE_AGG2D"] = self.options.with_agg2d + tc.variables["agg_USE_AGG2D_FREETYPE"] = self.options.with_agg2d_freetype + tc.variables["agg_BUILD_PLATFORM"] = self.options.with_platform + tc.variables["agg_BUILD_CONTROLS"] = self.options.with_controls + + tc.generate() + + deps = CMakeDeps(self) + deps.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.configure() + cmake.install() + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "agg") + self.cpp_info.filenames["cmake_find_package"] = "agg" + self.cpp_info.filenames["cmake_find_package_multi"] = "agg" + self.cpp_info.names["cmake_find_package"] = "agg" + self.cpp_info.names["cmake_find_package_multi"] = "agg" + + self.cpp_info.components["agg"].set_property("cmake_target_name", "agg::agg") + self.cpp_info.components["agg"].libs = ["agg"] + self.cpp_info.components["agg"].includedirs = [os.path.join("include", "agg")] + + if self.options.with_freetype: + self.cpp_info.components["fontfreetype"].set_property("cmake_target_name", "agg::fontfreetype") + self.cpp_info.components["fontfreetype"].libs = ["aggfontfreetype"] + self.cpp_info.components["fontfreetype"].includedirs = [os.path.join("include", "agg", "fontfreetype")] + self.cpp_info.components["fontfreetype"].requires = ["agg", "freetype::freetype"] + + if self.options.with_gpc: + self.cpp_info.components["gpc"].set_property("cmake_target_name", "agg::gpc") + self.cpp_info.components["gpc"].libs = ["agggpc"] + self.cpp_info.components["gpc"].includedirs = [os.path.join("include", "agg", "gpc")] + + if self.options.with_agg2d: + self.cpp_info.components["2d"].set_property("cmake_target_name", "agg::2d") + self.cpp_info.components["2d"].libs = ["agg2d"] + self.cpp_info.components["2d"].includedirs = [os.path.join("include", "agg", "2d")] + self.cpp_info.components["2d"].requires = ["agg"] + if self.options.with_agg2d_freetype: + self.cpp_info.components["2d"].requires = ["agg", "fontfreetype"] + + if self.options.with_platform: + self.cpp_info.components["platform"].set_property("cmake_target_name", "agg::platform") + self.cpp_info.components["platform"].libs = ["aggplatform"] + self.cpp_info.components["platform"].includedirs = [os.path.join("include", "agg", "platform")] + if self.settings.os in ["Linux"]: + self.cpp_info.components["platform"].requires = ["xorg::xorg", "agg"] + + if self.options.with_controls: + self.cpp_info.components["controls"].set_property("cmake_target_name", "agg::controls") + self.cpp_info.components["controls"].libs = ["aggctrl"] + self.cpp_info.components["controls"].includedirs = [os.path.join("include", "agg", "ctrl")] + self.cpp_info.components["controls"].requires = ["agg"] diff --git a/recipes/aggeom-agg/all/test_package/CMakeLists.txt b/recipes/aggeom-agg/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..5c9ab68de09d8 --- /dev/null +++ b/recipes/aggeom-agg/all/test_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES CXX) + +find_package(agg REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE agg::agg agg::platform ) + +set_target_properties(${PROJECT_NAME} PROPERTIES WIN32_EXECUTABLE TRUE) +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17) diff --git a/recipes/aggeom-agg/all/test_package/conanfile.py b/recipes/aggeom-agg/all/test_package/conanfile.py new file mode 100644 index 0000000000000..6d529581ba2f5 --- /dev/null +++ b/recipes/aggeom-agg/all/test_package/conanfile.py @@ -0,0 +1,29 @@ +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" + + 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/aggeom-agg/all/test_package/test_package.cpp b/recipes/aggeom-agg/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..8fd51b67e8648 --- /dev/null +++ b/recipes/aggeom-agg/all/test_package/test_package.cpp @@ -0,0 +1,10 @@ +#include +#include +enum flip_y_e { flip_y = true }; + +int agg_main(int argc, char* argv[]) { + agg::platform_support app(agg::pix_format_bgr24, flip_y); + app.caption("AGG Example. Anti-Aliasing Demo"); + + return 0; +} diff --git a/recipes/aggeom-agg/all/test_v1_package/CMakeLists.txt b/recipes/aggeom-agg/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/aggeom-agg/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/fontconfig/meson/test_v1_package/conanfile.py b/recipes/aggeom-agg/all/test_v1_package/conanfile.py similarity index 100% rename from recipes/fontconfig/meson/test_v1_package/conanfile.py rename to recipes/aggeom-agg/all/test_v1_package/conanfile.py diff --git a/recipes/aggeom-agg/config.yml b/recipes/aggeom-agg/config.yml new file mode 100644 index 0000000000000..54947af157488 --- /dev/null +++ b/recipes/aggeom-agg/config.yml @@ -0,0 +1,5 @@ +versions: + "2.6.1": + folder: "all" + "2.7.1": + folder: "all" diff --git a/recipes/ags/all/conandata.yml b/recipes/ags/all/conandata.yml index 80c23a11369cc..85726b0fe607b 100644 --- a/recipes/ags/all/conandata.yml +++ b/recipes/ags/all/conandata.yml @@ -2,9 +2,12 @@ sources: "5.4.1": url: https://github.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/archive/v5.4.1.tar.gz sha256: d72766152bc83fe75c12a26db02fcf01dcff269817994dc337c7eca52d69a669 - "6.0": - url: https://github.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/archive/v6.0.tar.gz - sha256: 3278ae381b1169f2f70be4412e351a427686cca9728dd6870fbb0c26d8d33b5b "6.0.1": url: https://github.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/archive/v6.0.1.tar.gz sha256: 7827e3c48b09a216b539c70d861e49580d57ae5fb6808f34dcf97067281c2a52 + "6.1.0": + url: https://github.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/archive/v6.1.0.tar.gz + sha256: 718c2ca4a6b5b7b0d35d6cdba2ae38bea4be7c01039a9093a5b13dd87c3fb8fd + "6.2.0": + url: https://github.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/archive/refs/tags/v6.2.0.tar.gz + sha256: 7fe211ff3856bb806da24d7988ddbf9dcb5d3395a1795ca68d510f7c29fe43cb diff --git a/recipes/ags/all/conanfile.py b/recipes/ags/all/conanfile.py index ce3253516ac16..40fbf18e98b65 100644 --- a/recipes/ags/all/conanfile.py +++ b/recipes/ags/all/conanfile.py @@ -1,22 +1,30 @@ 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 copy, get +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, msvc_runtime_flag, check_min_vs +from conan.tools.scm import Version -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" class AGSConan(ConanFile): name = "ags" - description = "The AMD GPU Services (AGS) library provides software developers with the ability to query AMD GPU " \ - "software and hardware state information that is not normally available through standard operating " \ - "systems or graphics APIs." - homepage = "https://github.com/GPUOpen-LibrariesAndSDKs/AGS_SDK" - topics = ("conan", "amd", "gpu") + description = ( + "The AMD GPU Services (AGS) library provides software developers with the ability to query AMD GPU " + "software and hardware state information that is not normally available through standard operating " + "systems or graphics APIs." + ) + license = "MIT" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/GPUOpen-LibrariesAndSDKs/AGS_SDK" + topics = ("amd", "gpu", "pre-built") + + package_type = "library" settings = "os", "arch", "compiler", "build_type" - license = "MIT" - no_copy_source = True options = { "shared": [True, False], } @@ -24,66 +32,73 @@ class AGSConan(ConanFile): "shared": False, } - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _supported_msvc_versions(self): - return ["14", "15", "16"] + def layout(self): + basic_layout(self, src_folder="src") @property def _supported_archs(self): return ["x86_64", "x86"] - def configure(self): - if self.settings.os != "Windows": - raise ConanInvalidConfiguration("ags doesn't support OS: {}.".format(self.settings.os)) - if self.settings.compiler != "Visual Studio": - raise ConanInvalidConfiguration("ags doesn't support compiler: {} on OS: {}.". - format(self.settings.compiler, self.settings.os)) - - if self.settings.compiler == "Visual Studio": - if self.settings.compiler.version not in self._supported_msvc_versions: - raise ConanInvalidConfiguration("ags doesn't support MSVC version: {}".format(self.settings.compiler.version)) - if self.settings.arch not in self._supported_archs: - raise ConanInvalidConfiguration("ags doesn't support arch: {}".format(self.settings.arch)) + def validate(self): + if not is_msvc(self): + raise ConanInvalidConfiguration("AGS SDK only supports MSVC and Windows") + check_min_vs(self, 190) + if Version(self.version) < "6.1.0" and check_min_vs(self, 193, raise_invalid=False): + raise ConanInvalidConfiguration(f"Visual Studio 2019 or older is required for v{self.version}") + if self.settings.arch not in self._supported_archs: + raise ConanInvalidConfiguration(f"AGS SDK doesn't support arch: {self.settings.arch}") + 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 _convert_msvc_version_to_vs_version(self, msvc_version): - vs_versions = { - "14": "2015", - "15": "2017", - "16": "2019", - } - return vs_versions.get(str(msvc_version), None) + @property + def _vs_ide_year(self): + compiler_version = str(self.settings.compiler.version) + if str(self.settings.compiler) == "Visual Studio": + return { + "14": "2015", + "15": "2017", + "16": "2019", + "17": "2022", + }[compiler_version] + else: + return { + "190": "2015", + "191": "2017", + "192": "2019", + "193": "2022", + }[compiler_version] - def _convert_arch_to_win_arch(self, msvc_version): - vs_versions = { + @property + def _win_arch(self): + return { "x86_64": "x64", "x86": "x86", - } - return vs_versions.get(str(msvc_version), None) + }[str(self.settings.arch)] - def package(self): - ags_lib_path = os.path.join(self.source_folder, self._source_subfolder, "ags_lib") - self.copy("LICENSE.txt", dst="licenses", src=ags_lib_path) - self.copy("*.h", dst="include", src=os.path.join(ags_lib_path, "inc")) + @property + def _lib_name(self): + if self.options.shared: + return f"amd_ags_{self._win_arch}" + return f"amd_ags_{self._win_arch}_{self._vs_ide_year}_{msvc_runtime_flag(self)}" - if self.settings.compiler == "Visual Studio": - win_arch = self._convert_arch_to_win_arch(self.settings.arch) - if self.options.shared: - shared_lib = "amd_ags_{arch}.dll".format(arch=win_arch) - symbol_lib = "amd_ags_{arch}.lib".format(arch=win_arch) - self.copy(shared_lib, dst="bin", src=os.path.join(ags_lib_path, "lib")) - self.copy(symbol_lib, dst="lib", src=os.path.join(ags_lib_path, "lib")) - else: - vs_version = self._convert_msvc_version_to_vs_version(self.settings.compiler.version) - static_lib = "amd_ags_{arch}_{vs_version}_{runtime}.lib".format(arch=win_arch, vs_version=vs_version, runtime=self.settings.compiler.runtime) - self.copy(static_lib, dst="lib", src=os.path.join(ags_lib_path, "lib")) + def package(self): + ags_lib_path = os.path.join(self.source_folder, "ags_lib") + copy(self, "LICENSE.txt", + dst=os.path.join(self.package_folder, "licenses"), + src=ags_lib_path) + copy(self, "*.h", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(ags_lib_path, "inc")) + copy(self, f"{self._lib_name}.lib", + dst=os.path.join(self.package_folder, "lib"), + src=os.path.join(ags_lib_path, "lib")) + if self.options.shared: + copy(self, f"{self._lib_name}.dll", + dst=os.path.join(self.package_folder, "bin"), + src=os.path.join(ags_lib_path, "lib")) def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = [self._lib_name] diff --git a/recipes/ags/all/test_package/CMakeLists.txt b/recipes/ags/all/test_package/CMakeLists.txt index 523fab4f02b6a..1a7621b5c42d8 100644 --- a/recipes/ags/all/test_package/CMakeLists.txt +++ b/recipes/ags/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +find_package(ags REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} CONAN_PKG::ags) +target_link_libraries(${PROJECT_NAME} PRIVATE ags::ags) set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 11) diff --git a/recipes/ags/all/test_package/conanfile.py b/recipes/ags/all/test_package/conanfile.py index c08206c505563..ef5d7042163ec 100644 --- a/recipes/ags/all/test_package/conanfile.py +++ b/recipes/ags/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" + 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", "test_package"), 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/ags/all/test_v1_package/CMakeLists.txt b/recipes/ags/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/ags/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/ags/all/test_v1_package/conanfile.py b/recipes/ags/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..d026b4c142f4c --- /dev/null +++ b/recipes/ags/all/test_v1_package/conanfile.py @@ -0,0 +1,16 @@ +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.settings): + self.run(os.path.join("bin", "test_package"), run_environment=True) diff --git a/recipes/ags/config.yml b/recipes/ags/config.yml index a799261020b31..df03f21bccdc5 100644 --- a/recipes/ags/config.yml +++ b/recipes/ags/config.yml @@ -1,7 +1,9 @@ versions: "5.4.1": folder: all - "6.0": - folder: all "6.0.1": folder: all + "6.1.0": + folder: all + "6.2.0": + folder: all diff --git a/recipes/alac/all/conanfile.py b/recipes/alac/all/conanfile.py index 03e8814c8b1fd..852e6b7782c8e 100644 --- a/recipes/alac/all/conanfile.py +++ b/recipes/alac/all/conanfile.py @@ -1,10 +1,9 @@ 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" +required_conan_version = ">=1.53.0" class AlacConan(ConanFile): @@ -12,10 +11,11 @@ class AlacConan(ConanFile): description = "The Apple Lossless Audio Codec (ALAC) is a lossless audio " \ "codec developed by Apple and deployed on all of its platforms and devices." license = "Apache-2.0" - topics = ("alac", "audio-codec") - homepage = "https://macosforge.github.io/alac" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://macosforge.github.io/alac" + topics = ("audio-codec") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -28,7 +28,8 @@ class AlacConan(ConanFile): "utility": True, } - exports_sources = "CMakeLists.txt" + 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": @@ -36,17 +37,13 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + 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) @@ -67,5 +64,8 @@ def package(self): def package_info(self): self.cpp_info.libs = ["alac"] - if Version(conan_version).major < 2 and self.options.utility: + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") + + if 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_v1_package/CMakeLists.txt b/recipes/alac/all/test_v1_package/CMakeLists.txt index 6e042a1c74181..91630d79f4abb 100644 --- a/recipes/alac/all/test_v1_package/CMakeLists.txt +++ b/recipes/alac/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.15) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(alac REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE alac::alac) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) 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..cc8bcf0f12467 100644 --- a/recipes/alembic/all/conandata.yml +++ b/recipes/alembic/all/conandata.yml @@ -1,14 +1,30 @@ sources: + "1.8.6": + url: "https://github.com/alembic/alembic/archive/refs/tags/1.8.6.tar.gz" + sha256: "c572ebdea3a5f0ce13774dd1fceb5b5815265cd1b29d142cf8c144b03c131c8c" + "1.8.5": + url: "https://github.com/alembic/alembic/archive/refs/tags/1.8.5.tar.gz" + sha256: "180a12f08d391cd89f021f279dbe3b5423b1db751a9898540c8059a45825c2e9" "1.8.3": - url: "https://github.com/alembic/alembic/archive/1.8.3.tar.gz" + url: "https://github.com/alembic/alembic/archive/refs/tags/1.8.3.tar.gz" sha256: "b0bc74833bff118a869e81e6acb810a58797e77ef63143954b2f8e817c7f65cb" "1.8.2": url: "https://github.com/alembic/alembic/archive/refs/tags/1.8.2.tar.gz" sha256: "3f1c466ee1600578689b32b1f2587066d3259704ec7ed1fcf80c324d01274f48" patches: + "1.8.6": + - patch_file: "patches/1.8.5-0001-fix-cmake.patch" + patch_description: "CMake: fix install layout, don't link directly to zlib if hdf5, relocatable shared lib for macOS" + patch_type: "conan" + "1.8.5": + - patch_file: "patches/1.8.5-0001-fix-cmake.patch" + patch_description: "CMake: fix install layout, don't link directly to zlib if hdf5, relocatable shared lib for macOS" + patch_type: "conan" "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" + patch_description: "CMake: fix install layout, don't link directly to zlib if hdf5, relocatable shared lib for macOS" + patch_type: "conan" "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" + patch_description: "CMake: fix install layout, don't link directly to zlib if hdf5, relocatable shared lib for macOS" + patch_type: "conan" diff --git a/recipes/alembic/all/conanfile.py b/recipes/alembic/all/conanfile.py index e03670713f2da..b0e76d94370d0 100644 --- a/recipes/alembic/all/conanfile.py +++ b/recipes/alembic/all/conanfile.py @@ -1,17 +1,22 @@ -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.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") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -24,21 +29,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 +38,63 @@ 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.9", transitive_headers=True) if self.options.with_hdf5: - self.requires("hdf5/1.12.0") + self.requires("hdf5/1.14.3") 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" + if Version(self.version) >= "1.8.4": + tc.variables["ALEMBIC_DEBUG_WARNINGS_AS_ERRORS"] = False + 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/1.8.5-0001-fix-cmake.patch b/recipes/alembic/all/patches/1.8.5-0001-fix-cmake.patch new file mode 100644 index 0000000000000..c048ccd304a2e --- /dev/null +++ b/recipes/alembic/all/patches/1.8.5-0001-fix-cmake.patch @@ -0,0 +1,56 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -100,9 +100,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() + + SET(LINUX FALSE) +@@ -212,7 +209,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 +@@ -68,28 +68,26 @@ IF (ALEMBIC_SHARED_LIBS) + + if (ALEMBIC_USING_IMATH_3) + if (APPLE OR UNIX) +- set_target_properties(Alembic PROPERTIES INSTALL_RPATH "$") + endif () + endif () + 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 STRING "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..b21cc49efde95 --- /dev/null +++ b/recipes/alembic/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/glfw/all/test_v1_package/conanfile.py b/recipes/alembic/all/test_v1_package/conanfile.py similarity index 100% rename from recipes/glfw/all/test_v1_package/conanfile.py rename to recipes/alembic/all/test_v1_package/conanfile.py diff --git a/recipes/alembic/config.yml b/recipes/alembic/config.yml index 68197c279a4ee..079098b5ad92b 100644 --- a/recipes/alembic/config.yml +++ b/recipes/alembic/config.yml @@ -1,4 +1,8 @@ versions: + "1.8.6": + folder: all + "1.8.5": + folder: all "1.8.3": folder: all "1.8.2": diff --git a/recipes/alpaca/all/conanfile.py b/recipes/alpaca/all/conanfile.py index a7227d4427d29..02d46c1a923f7 100644 --- a/recipes/alpaca/all/conanfile.py +++ b/recipes/alpaca/all/conanfile.py @@ -7,17 +7,21 @@ 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" + 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") + + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -51,7 +55,7 @@ def validate(self): ) 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 package(self): copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) diff --git a/recipes/alpaca/all/test_package/test_package.cpp b/recipes/alpaca/all/test_package/test_package.cpp index 0134e1d6e0d2d..c1126e0786194 100644 --- a/recipes/alpaca/all/test_package/test_package.cpp +++ b/recipes/alpaca/all/test_package/test_package.cpp @@ -1,11 +1,11 @@ #include struct Config { - std::string device; - std::pair resolution; - std::array K_matrix; - std::vector distortion_coeffients; - std::map> parameters; + std::string device; + std::pair resolution; + std::array K_matrix; + std::vector distortion_coeffients; + std::map> parameters; }; int main() { @@ -32,4 +32,3 @@ int main() { } return 0; } - diff --git a/recipes/alpaca/all/test_v1_package/CMakeLists.txt b/recipes/alpaca/all/test_v1_package/CMakeLists.txt index 0aeb3e1d92584..91630d79f4abb 100644 --- a/recipes/alpaca/all/test_v1_package/CMakeLists.txt +++ b/recipes/alpaca/all/test_v1_package/CMakeLists.txt @@ -1,6 +1,5 @@ -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++ +cmake_minimum_required(VERSION 3.15) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) diff --git a/recipes/amgcl/all/conandata.yml b/recipes/amgcl/all/conandata.yml index 97da314dcfe0d..2059663ce0b33 100644 --- a/recipes/amgcl/all/conandata.yml +++ b/recipes/amgcl/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.4.4": + url: "https://github.com/ddemidov/amgcl/archive/1.4.4.tar.gz" + sha256: "02fd5418e14d669422f65fc739ce72bf9516ced2d8942574d4b8caa05dda9d8c" "1.4.3": url: "https://github.com/ddemidov/amgcl/archive/1.4.3.tar.gz" sha256: "e920d5767814ce697d707d1f359a16c9b9eb79eba28fe19e14c18c2a505fe0ad" @@ -7,4 +10,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..e04106ab75c2b 100644 --- a/recipes/amgcl/all/conanfile.py +++ b/recipes/amgcl/all/conanfile.py @@ -1,34 +1,57 @@ -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 +from conan.tools.scm import Version 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")] + options = { 'with_boost': [True, False] } + default_options = { 'with_boost': True } + + def config_options(self): + if Version(self.version) < "1.4.4": + del self.options.with_boost + + def layout(self): + basic_layout(self, src_folder="src") - @property - def _source_subfolder(self): - return "source_subfolder" + def requirements(self): + if self.options.get_safe("with_boost"): + self.requires("boost/1.85.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 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/glfw/all/test_v1_package/CMakeLists.txt b/recipes/amgcl/all/test_v1_package/CMakeLists.txt similarity index 100% rename from recipes/glfw/all/test_v1_package/CMakeLists.txt rename to recipes/amgcl/all/test_v1_package/CMakeLists.txt diff --git a/recipes/libgit2/0.27.x/test_package/conanfile.py b/recipes/amgcl/all/test_v1_package/conanfile.py similarity index 100% rename from recipes/libgit2/0.27.x/test_package/conanfile.py rename to recipes/amgcl/all/test_v1_package/conanfile.py diff --git a/recipes/amgcl/config.yml b/recipes/amgcl/config.yml index 1d12970eb4fba..02bed7da76340 100644 --- a/recipes/amgcl/config.yml +++ b/recipes/amgcl/config.yml @@ -1,4 +1,6 @@ versions: + "1.4.4": + folder: all "1.4.3": folder: all "1.4.2": 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 2543d0dc3e3ba..d9636b6750c96 100644 --- a/recipes/amqp-cpp/all/conandata.yml +++ b/recipes/amqp-cpp/all/conandata.yml @@ -1,50 +1,54 @@ 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" - "4.3.11": - url: "https://github.com/CopernicaMarketingSoftware/AMQP-CPP/archive/v4.3.11.tar.gz" - sha256: "be2b11ada1020f77b859857310be54bd073c3a4f579d99a5e251a738576ca28c" - "4.3.10": - url: "https://github.com/CopernicaMarketingSoftware/AMQP-CPP/archive/v4.3.10.tar.gz" - sha256: "4fa1e9650f7a08ae7217899431a3b3f0a173ad826dd819f0b8c760e4e2a65298" + "4.3.26": + url: "https://github.com/CopernicaMarketingSoftware/AMQP-CPP/archive/v4.3.26.tar.gz" + sha256: "2baaab702f3fd9cce40563dc1e23f433cceee7ec3553bd529a98b1d3d7f7911c" + "4.3.24": + url: "https://github.com/CopernicaMarketingSoftware/AMQP-CPP/archive/v4.3.24.tar.gz" + sha256: "c3312f8af813cacabf6c257dfaf41bf9e66606bbf7d62d085a9b7da695355245" "4.2.1": url: "https://github.com/CopernicaMarketingSoftware/AMQP-CPP/archive/v4.2.1.tar.gz" sha256: "33306d6cdb60554998afb304cdc3e3120a71ea539b4be187812065b1b9e59c2f" "4.1.7": url: "https://github.com/CopernicaMarketingSoftware/AMQP-CPP/archive/v4.1.7.tar.gz" sha256: "71b504f21f62b69c76b371fe7044e0dfc6d42650a15c267431c5084badb0ade7" - "4.1.6": - url: "https://github.com/CopernicaMarketingSoftware/AMQP-CPP/archive/v4.1.6.tar.gz" - sha256: "48832068dc1e25a5313dd9e96fb33ba954c19f9dc04eeca8f7b2c6cecde3afc9" - "4.1.5": - 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" - base_path: "source_subfolder" - "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.3.26": + - patch_file: "patches/4.3.24-0001-cmake-link-openssl.patch" + - patch_file: "patches/4.3.24-0002-cmake-install-dll-export-msvc.patch" + patch_description: "windows: Fix install directory of DLL and export symbols if msvc" + patch_type: "portability" + patch_source: "https://github.com/CopernicaMarketingSoftware/AMQP-CPP/pull/515" + - patch_file: "patches/4.3.24-0003-cmake-link-ws2_32.patch" + patch_description: "Link to ws2_32 if windows" + patch_type: "portability" + patch_source: "https://github.com/CopernicaMarketingSoftware/AMQP-CPP/pull/514" + "4.3.24": + - patch_file: "patches/4.3.24-0001-cmake-link-openssl.patch" + - patch_file: "patches/4.3.24-0002-cmake-install-dll-export-msvc.patch" + patch_description: "windows: Fix install directory of DLL and export symbols if msvc" + patch_type: "portability" + patch_source: "https://github.com/CopernicaMarketingSoftware/AMQP-CPP/pull/515" + - patch_file: "patches/4.3.24-0003-cmake-link-ws2_32.patch" + patch_description: "Link to ws2_32 if windows" + patch_type: "portability" + patch_source: "https://github.com/CopernicaMarketingSoftware/AMQP-CPP/pull/514" "4.2.1": - - patch_file: "patches/0001-cmake-openssl-install-directories.patch" - base_path: "source_subfolder" + - patch_file: "patches/4.1.7-0001-cmake-link-openssl.patch" + - patch_file: "patches/4.1.7-0002-cmake-install-dll-export-msvc.patch" + patch_description: "windows: Fix install directory of DLL and export symbols if msvc" + patch_type: "portability" + patch_source: "https://github.com/CopernicaMarketingSoftware/AMQP-CPP/pull/515" + - patch_file: "patches/4.1.7-0003-cmake-link-ws2_32.patch" + patch_description: "Link to ws2_32 if windows" + patch_type: "portability" + patch_source: "https://github.com/CopernicaMarketingSoftware/AMQP-CPP/pull/514" "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" + - patch_file: "patches/4.1.7-0001-cmake-link-openssl.patch" + - patch_file: "patches/4.1.7-0002-cmake-install-dll-export-msvc.patch" + patch_description: "windows: Fix install directory of DLL and export symbols if msvc" + patch_type: "portability" + patch_source: "https://github.com/CopernicaMarketingSoftware/AMQP-CPP/pull/515" + - patch_file: "patches/4.1.7-0003-cmake-link-ws2_32.patch" + patch_description: "windows: Link to ws2_32" + patch_type: "portability" + patch_source: "https://github.com/CopernicaMarketingSoftware/AMQP-CPP/pull/514" diff --git a/recipes/amqp-cpp/all/conanfile.py b/recipes/amqp-cpp/all/conanfile.py index 6b5d9c2631df0..3e26ef28cb261 100644 --- a/recipes/amqp-cpp/all/conanfile.py +++ b/recipes/amqp-cpp/all/conanfile.py @@ -1,8 +1,13 @@ -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 +from conan.tools.scm import Version +from conan.tools.build import check_min_cppstd +from conan.errors import ConanInvalidConfiguration import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class AmqpcppConan(ConanFile): @@ -12,7 +17,7 @@ class AmqpcppConan(ConanFile): topics = ("amqp", "network", "queue") license = "Apache-2.0" description = "C++ library for asynchronous non-blocking communication with RabbitMQ" - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -25,21 +30,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 +40,71 @@ 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 <4]") + + @property + def _min_cppstd(self): + return "11" if Version(self.version) < "4.3.20" else "17" + + @property + def _compilers_minimum_version(self): + return { + "17": { + "gcc": "7.4", + "Visual Studio": "15.7", + "msvc": "191", + "clang": "6", + "apple-clang": "10", + }, + }.get(self._min_cppstd, {}) + + 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], - 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.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 +112,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 +133,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 deleted file mode 100644 index 31d848a28a771..0000000000000 --- a/recipes/amqp-cpp/all/patches/0001-cmake-openssl-install-directories.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -88,7 +88,9 @@ - #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) -+endif() - # install rules - # ------------------------------------------------------------------------------------------------------ - -@@ -97,7 +99,7 @@ - install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}Config - ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib -- RUNTIME DESTINATION lib -+ RUNTIME DESTINATION bin - ) - else() - # copy static lib diff --git a/recipes/amqp-cpp/all/patches/4.1.7-0001-cmake-link-openssl.patch b/recipes/amqp-cpp/all/patches/4.1.7-0001-cmake-link-openssl.patch new file mode 100644 index 0000000000000..4fd90bf502649 --- /dev/null +++ b/recipes/amqp-cpp/all/patches/4.1.7-0001-cmake-link-openssl.patch @@ -0,0 +1,9 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -129,4 +129,6 @@ target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC + + if(AMQP-CPP_LINUX_TCP) + target_link_libraries(${PROJECT_NAME} ${CMAKE_DL_LIBS}) ++ find_package(OpenSSL REQUIRED) ++ target_link_libraries(${PROJECT_NAME} OpenSSL::SSL) + endif() diff --git a/recipes/amqp-cpp/all/patches/4.1.7-0002-cmake-install-dll-export-msvc.patch b/recipes/amqp-cpp/all/patches/4.1.7-0002-cmake-install-dll-export-msvc.patch new file mode 100644 index 0000000000000..a27f553a66fa5 --- /dev/null +++ b/recipes/amqp-cpp/all/patches/4.1.7-0002-cmake-install-dll-export-msvc.patch @@ -0,0 +1,20 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -82,7 +82,7 @@ if(AMQP-CPP_BUILD_SHARED) + #add_library(${PROJECT_NAME} SHARED ${SRCS}) + add_library(${PROJECT_NAME} SHARED ${src_MAIN} ${src_LINUX_TCP}) + # set shared lib version +- set_target_properties(${PROJECT_NAME} PROPERTIES SOVERSION ${SO_VERSION}) ++ set_target_properties(${PROJECT_NAME} PROPERTIES SOVERSION ${SO_VERSION} WINDOWS_EXPORT_ALL_SYMBOLS ON) + else() + # create static lib + #add_library(${PROJECT_NAME} STATIC ${SRCS}) +@@ -97,7 +97,7 @@ if(AMQP-CPP_BUILD_SHARED) + install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}Config + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib +- RUNTIME DESTINATION lib ++ RUNTIME DESTINATION bin + ) + else() + # copy static lib diff --git a/recipes/amqp-cpp/all/patches/4.1.7-0003-cmake-link-ws2_32.patch b/recipes/amqp-cpp/all/patches/4.1.7-0003-cmake-link-ws2_32.patch new file mode 100644 index 0000000000000..935f6704ae4e7 --- /dev/null +++ b/recipes/amqp-cpp/all/patches/4.1.7-0003-cmake-link-ws2_32.patch @@ -0,0 +1,12 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -88,6 +88,9 @@ else() + #add_library(${PROJECT_NAME} STATIC ${SRCS}) + add_library(${PROJECT_NAME} STATIC ${src_MAIN} ${src_LINUX_TCP}) + endif() ++if(WIN32) ++ target_link_libraries(${PROJECT_NAME} PUBLIC ws2_32) ++endif() + + # install rules + # ------------------------------------------------------------------------------------------------------ diff --git a/recipes/amqp-cpp/all/patches/4.3.24-0001-cmake-link-openssl.patch b/recipes/amqp-cpp/all/patches/4.3.24-0001-cmake-link-openssl.patch new file mode 100644 index 0000000000000..69dd45f821f96 --- /dev/null +++ b/recipes/amqp-cpp/all/patches/4.3.24-0001-cmake-link-openssl.patch @@ -0,0 +1,8 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -135,4 +135,5 @@ if(AMQP-CPP_LINUX_TCP) + # Find OpenSSL and provide include dirs + find_package(OpenSSL REQUIRED) + target_include_directories(${PROJECT_NAME} PRIVATE ${OPENSSL_INCLUDE_DIR}) ++ target_link_libraries(${PROJECT_NAME} OpenSSL::SSL) + endif() diff --git a/recipes/amqp-cpp/all/patches/4.3.24-0002-cmake-install-dll-export-msvc.patch b/recipes/amqp-cpp/all/patches/4.3.24-0002-cmake-install-dll-export-msvc.patch new file mode 100644 index 0000000000000..1e75ea7e91ac0 --- /dev/null +++ b/recipes/amqp-cpp/all/patches/4.3.24-0002-cmake-install-dll-export-msvc.patch @@ -0,0 +1,20 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -85,7 +85,7 @@ if(AMQP-CPP_BUILD_SHARED) + #add_library(${PROJECT_NAME} SHARED ${SRCS}) + add_library(${PROJECT_NAME} SHARED ${src_MAIN} ${src_LINUX_TCP}) + # set shared lib version +- set_target_properties(${PROJECT_NAME} PROPERTIES SOVERSION ${SO_VERSION}) ++ set_target_properties(${PROJECT_NAME} PROPERTIES SOVERSION ${SO_VERSION} WINDOWS_EXPORT_ALL_SYMBOLS ON) + else() + # create static lib + #add_library(${PROJECT_NAME} STATIC ${SRCS}) +@@ -100,7 +100,7 @@ if(AMQP-CPP_BUILD_SHARED) + install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}Config + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib +- RUNTIME DESTINATION lib ++ RUNTIME DESTINATION bin + ) + else() + # copy static lib diff --git a/recipes/amqp-cpp/all/patches/4.3.24-0003-cmake-link-ws2_32.patch b/recipes/amqp-cpp/all/patches/4.3.24-0003-cmake-link-ws2_32.patch new file mode 100644 index 0000000000000..98c5524cc4932 --- /dev/null +++ b/recipes/amqp-cpp/all/patches/4.3.24-0003-cmake-link-ws2_32.patch @@ -0,0 +1,12 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -91,6 +91,9 @@ else() + #add_library(${PROJECT_NAME} STATIC ${SRCS}) + add_library(${PROJECT_NAME} STATIC ${src_MAIN} ${src_LINUX_TCP}) + endif() ++if(WIN32) ++ target_link_libraries(${PROJECT_NAME} PUBLIC ws2_32) ++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..dcd602f230785 100644 --- a/recipes/amqp-cpp/all/test_package/CMakeLists.txt +++ b/recipes/amqp-cpp/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(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) +if(amqpcpp_VERSION VERSION_LESS "4.3.20") +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +else() +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +endif() 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/glib/all/test_v1_package/CMakeLists.txt b/recipes/amqp-cpp/all/test_v1_package/CMakeLists.txt similarity index 100% rename from recipes/glib/all/test_v1_package/CMakeLists.txt rename to recipes/amqp-cpp/all/test_v1_package/CMakeLists.txt diff --git a/recipes/libgit2/0.28.x/test_package/conanfile.py b/recipes/amqp-cpp/all/test_v1_package/conanfile.py similarity index 100% rename from recipes/libgit2/0.28.x/test_package/conanfile.py rename to recipes/amqp-cpp/all/test_v1_package/conanfile.py diff --git a/recipes/amqp-cpp/config.yml b/recipes/amqp-cpp/config.yml index 81db570a6cd83..3cdf4ddfdb5a3 100644 --- a/recipes/amqp-cpp/config.yml +++ b/recipes/amqp-cpp/config.yml @@ -1,17 +1,9 @@ versions: - "4.3.18": + "4.3.26": folder: all - "4.3.16": - folder: all - "4.3.11": - folder: all - "4.3.10": + "4.3.24": folder: all "4.2.1": folder: all "4.1.7": folder: all - "4.1.6": - folder: all - "4.1.5": - folder: all diff --git a/recipes/andreasbuhr-cppcoro/all/CMakeLists.txt b/recipes/andreasbuhr-cppcoro/all/CMakeLists.txt deleted file mode 100644 index fe06f4e0b9505..0000000000000 --- a/recipes/andreasbuhr-cppcoro/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper CXX) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/andreasbuhr-cppcoro/all/conandata.yml b/recipes/andreasbuhr-cppcoro/all/conandata.yml index 8db5685072de7..be3ba151d034d 100644 --- a/recipes/andreasbuhr-cppcoro/all/conandata.yml +++ b/recipes/andreasbuhr-cppcoro/all/conandata.yml @@ -1,4 +1,4 @@ sources: - "cci.20210113": - url: "https://github.com/andreasbuhr/cppcoro/archive/7cc9433436fe8f2482138019cfaafce8e1d7a896.zip" - sha256: "5edc72bb19616ae5b794c7d83f9a5d4973f32c966f1966ab81779d3a38b36a2c" + "cci.20230629": + url: "https://github.com/andreasbuhr/cppcoro/archive/a3082f56ba135a659f7386b00ff797ba441207ba.zip" + sha256: "8c3283dd7587cdd18b871b290fda9394f262110140685e6de3760ede3b505736" diff --git a/recipes/andreasbuhr-cppcoro/all/conanfile.py b/recipes/andreasbuhr-cppcoro/all/conanfile.py index 2acc06b34e08b..ecc6306553632 100644 --- a/recipes/andreasbuhr-cppcoro/all/conanfile.py +++ b/recipes/andreasbuhr-cppcoro/all/conanfile.py @@ -1,21 +1,24 @@ import os -from conans import ConanFile, tools, CMake -from conans.errors import ConanInvalidConfiguration +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 rmdir, get, copy +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class AndreasbuhrCppCoroConan(ConanFile): name = "andreasbuhr-cppcoro" description = "A library of C++ coroutine abstractions for the coroutines TS" - topics = ("conan", "cpp", "async", "coroutines") + topics = ("cpp", "async", "coroutines") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/andreasbuhr/cppcoro" license = "MIT" settings = "os", "compiler", "build_type", "arch" provides = "cppcoro" - - exports_sources = "CMakeLists.txt" - generators = "cmake" + package_type = "library" options = { "shared": [True, False], @@ -26,87 +29,111 @@ class AndreasbuhrCppCoroConan(ConanFile): "fPIC": True, } - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _minimum_compilers_version(self): return { "Visual Studio": "15", + "msvc": "191", "gcc": "10", "clang": "8", "apple-clang": "10", } + @property + def _min_cppstd(self): + # Clang with libstdc++ always requires C++20 + # Clang 17+ always requires C++20 + # Otherwise, require C++17 + compiler = self.settings.compiler + requires_cpp20 = compiler == "clang" and ("libstdc++" in compiler.get_safe("libcxx", "") or compiler.version >= Version("17")) + return 20 if requires_cpp20 else 17 + + def layout(self): + cmake_layout(self, src_folder="src") + def config_options(self): if self.settings.os == "Windows": - del self.options.fPIC + self.options.rm_safe("fPIC") def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + # We can't simply check for C++20, because clang and MSVC support the coroutine TS despite not having labeled (__cplusplus macro) C++20 support 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(f"{self.name} recipe lacks information about the {self.settings.compiler} compiler support.") else: - if tools.Version(self.settings.compiler.version) < min_version: - raise ConanInvalidConfiguration("{} requires coroutine TS support. The current compiler {} {} does not support it.".format( - self.name, self.settings.compiler, self.settings.compiler.version)) - - # Currently clang expects coroutine to be implemented in a certain way (under std::experiemental::), while libstdc++ puts them under std:: - # There are also other inconsistencies, see https://bugs.llvm.org/show_bug.cgi?id=48172 - # This should be removed after both gcc and clang implements the final coroutine TS - if self.settings.compiler == "clang" and self.settings.compiler.get_safe("libcxx") == "libstdc++": - raise ConanInvalidConfiguration("{} does not support clang with libstdc++. Use libc++ instead.".format(self.name)) + if Version(self.settings.compiler.version) < min_version: + raise ConanInvalidConfiguration( + f"{self.name} requires coroutine TS support. The current compiler {self.settings.compiler} {self.settings.compiler.version} does not support it." + ) + + # Older versions of clang expects coroutine to be put under std::experimental::, while libstdc++ puts them under std::, + # See https://bugs.llvm.org/show_bug.cgi?id=48172 for more context. + if self.settings.compiler == "clang" and "libstdc++" in self.settings.compiler.get_safe("libcxx", ""): + if self.settings.compiler.version < Version("14"): + raise ConanInvalidConfiguration("{self.name} does not support clang<14 with libstdc++. Use libc++ or upgrade to clang 14+ instead.") + if self.settings.compiler.version == Version("14"): + self.output.warning("This build may fail if using libstdc++13 or greater") 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - def _configure_cmake(self): - if not self._cmake: - self._cmake = CMake(self) - if self.settings.os == "Windows" and self.options.shared: - self._cmake.definitions["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = "ON" - self._cmake.configure() - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = "ON" + tc.generate() def build(self): - 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", 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.filenames["cmake_find_package"] = "cppcoro" - self.cpp_info.filenames["cmake_find_package_multi"] = "cppcoro" - self.cpp_info.names["cmake_find_package"] = "cppcoro" - self.cpp_info.names["cmake_find_package_multi"] = "cppcoro" + @property + def _needs_fcoroutines_ts_flag(self): + version = Version(self.settings.compiler.version) + if self.settings.compiler == "clang": + # clang 5: Coroutines support added + # somewhere between clang 5 and 11: the requirement to add -fcoroutines-ts was dropped, at least in the context of this recipe. + return version < 11 + elif self.settings.compiler == "apple-clang": + # At some point before apple-clang 13, in the context of this recipe, the requirement for this flag was dropped. + return version < 13 + else: + return False - comp = self.cpp_info.components["cppcoro"] - comp.names["cmake_find_package"] = "cppcoro" - comp.names["cmake_find_package_multi"] = "cppcoro" - comp.libs = ["cppcoro"] + def package_info(self): + self.cpp_info.libs = ["cppcoro"] - if self.settings.os == "Linux" and self.options.shared: - comp.system_libs = ["pthread"] + if self.settings.os in ["Linux", "FreeBSD"] and self.options.shared: + self.cpp_info.system_libs = ["pthread", "m"] if self.settings.os == "Windows": - comp.system_libs = ["synchronization"] + self.cpp_info.system_libs = ["synchronization", "ws2_32", "mswsock"] - if self.settings.compiler == "Visual Studio": - comp.cxxflags.append("/await") + if is_msvc(self): + self.cpp_info.cxxflags.append("/await") elif self.settings.compiler == "gcc": - comp.cxxflags.append("-fcoroutines") - comp.defines.append("CPPCORO_COMPILER_SUPPORTS_SYMMETRIC_TRANSFER=1") - elif self.settings.compiler == "clang" or self.settings.compiler == "apple-clang": - comp.cxxflags.append("-fcoroutines-ts") + self.cpp_info.cxxflags.append("-fcoroutines") + self.cpp_info.defines.append("CPPCORO_COMPILER_SUPPORTS_SYMMETRIC_TRANSFER=1") + elif self._needs_fcoroutines_ts_flag: + self.cpp_info.cxxflags.append("-fcoroutines-ts") + + self.cpp_info.set_property("cmake_file_name", "cppcoro") + self.cpp_info.set_property("cmake_target_name", "cppcoro::cppcoro") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "cppcoro" + self.cpp_info.filenames["cmake_find_package_multi"] = "cppcoro" + self.cpp_info.names["cmake_find_package"] = "cppcoro" + self.cpp_info.names["cmake_find_package_multi"] = "cppcoro" diff --git a/recipes/andreasbuhr-cppcoro/all/test_package/CMakeLists.txt b/recipes/andreasbuhr-cppcoro/all/test_package/CMakeLists.txt index 7c6a625130a35..656a3690c2777 100644 --- a/recipes/andreasbuhr-cppcoro/all/test_package/CMakeLists.txt +++ b/recipes/andreasbuhr-cppcoro/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() - find_package(cppcoro CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/andreasbuhr-cppcoro/all/test_package/conanfile.py b/recipes/andreasbuhr-cppcoro/all/test_package/conanfile.py index 910ae60d10438..0a6bc68712d90 100644 --- a/recipes/andreasbuhr-cppcoro/all/test_package/conanfile.py +++ b/recipes/andreasbuhr-cppcoro/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 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.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/mongo-c-driver/all/test_v1_package/CMakeLists.txt b/recipes/andreasbuhr-cppcoro/all/test_v1_package/CMakeLists.txt similarity index 100% rename from recipes/mongo-c-driver/all/test_v1_package/CMakeLists.txt rename to recipes/andreasbuhr-cppcoro/all/test_v1_package/CMakeLists.txt diff --git a/recipes/libyuv/all/test_v1_package/conanfile.py b/recipes/andreasbuhr-cppcoro/all/test_v1_package/conanfile.py similarity index 100% rename from recipes/libyuv/all/test_v1_package/conanfile.py rename to recipes/andreasbuhr-cppcoro/all/test_v1_package/conanfile.py diff --git a/recipes/andreasbuhr-cppcoro/config.yml b/recipes/andreasbuhr-cppcoro/config.yml index 1ae5eab0b9b8f..1b221bd98d9e3 100644 --- a/recipes/andreasbuhr-cppcoro/config.yml +++ b/recipes/andreasbuhr-cppcoro/config.yml @@ -1,3 +1,3 @@ versions: - "cci.20210113": + "cci.20230629": folder: "all" diff --git a/recipes/android-ndk/all/conandata.yml b/recipes/android-ndk/all/conandata.yml index 8bc387caae19b..2e3e6776d51e1 100644 --- a/recipes/android-ndk/all/conandata.yml +++ b/recipes/android-ndk/all/conandata.yml @@ -1,4 +1,108 @@ sources: + "r27c": + "Windows": + "x86_64": + url: "https://dl.google.com/android/repository/android-ndk-r27c-windows.zip" + sha256: "27e49f11e0cee5800983d8af8f4acd5bf09987aa6f790d4439dda9f3643d2494" + "Linux": + "x86_64": + url: "https://dl.google.com/android/repository/android-ndk-r27c-linux.zip" + sha256: "59c2f6dc96743b5daf5d1626684640b20a6bd2b1d85b13156b90333741bad5cc" + "Macos": + "x86_64": + url: "https://dl.google.com/android/repository/android-ndk-r27c-darwin.zip" + sha256: "8c5685457c58a88527367d46d3f14e8c727d962c39f85344cff0c0768a73c3b7" + "r27": + "Windows": + "x86_64": + url: "https://dl.google.com/android/repository/android-ndk-r27-windows.zip" + sha256: "342ceafd7581ae26a0bd650a5e0bbcd0aa2ee15eadfd7508b3dedeb1372d7596" + "Linux": + "x86_64": + url: "https://dl.google.com/android/repository/android-ndk-r27-linux.zip" + sha256: "2f17eb8bcbfdc40201c0b36e9a70826fcd2524ab7a2a235e2c71186c302da1dc" + "Macos": + "x86_64": + url: "https://dl.google.com/android/repository/android-ndk-r27-darwin.zip" + sha256: "2f2ef00b22fe22c1c9c78fda1b38ea7ffa6528e25eac0b70a92f8cb0093143be" + "r26d": + "Windows": + "x86_64": + url: "https://dl.google.com/android/repository/android-ndk-r26d-windows.zip" + sha256: "9b285da57a36818cb65ea5b93ec74f8138f48a40182ff2994f6aade4580ed597" + "Linux": + "x86_64": + url: "https://dl.google.com/android/repository/android-ndk-r26d-linux.zip" + sha256: "eefeafe7ccf177de7cc57158da585e7af119bb7504a63604ad719e4b2a328b54" + "Macos": + "x86_64": + url: "https://dl.google.com/android/repository/android-ndk-r26d-darwin.zip" + sha256: "ee2d0531685a69164fc0a66705d3a30109223f6fc01f1008ca5d8bc3a32d628d" + "r26c": + "Windows": + "x86_64": + url: "https://dl.google.com/android/repository/android-ndk-r26c-windows.zip" + sha256: "67d0c7e4ba853e9168584e8640a562af431dcf086c08efef3ec23ee827139303" + "Linux": + "x86_64": + url: "https://dl.google.com/android/repository/android-ndk-r26c-linux.zip" + sha256: "6d6e659834d28bb24ba7ae66148ad05115ebbad7dabed1af9b3265674774fcf6" + "Macos": + "x86_64": + url: "https://dl.google.com/android/repository/android-ndk-r26c-darwin.zip" + sha256: "312756dfcbdbf389d35d651e17ca98683bd36cb83cc7bf7ad51cac5c06bd064b" + "r26b": + "Windows": + "x86_64": + url: "https://dl.google.com/android/repository/android-ndk-r26b-windows.zip" + sha256: "a478d43d4a45d0d345cda6be50d79642b92fb175868d9dc0dfc86181d80f691e" + "Linux": + "x86_64": + url: "https://dl.google.com/android/repository/android-ndk-r26b-linux.zip" + sha256: "ad73c0370f0b0a87d1671ed2fd5a9ac9acfd1eb5c43a7fbfbd330f85d19dd632" + "Macos": + "x86_64": + url: "https://dl.google.com/android/repository/android-ndk-r26b-darwin.zip" + sha256: "4b0ea6148a9a2337e62a0c0c7ac59ff1edc38d69b81d9c58251897d23f7fa321" + "r26": + "Windows": + "x86_64": + url: "https://dl.google.com/android/repository/android-ndk-r26-windows.zip" + sha256: "a748c6634b96991e15cb8902ffa4a498bba2ec6aa8028526de3c4c9dfcf00663" + "Linux": + "x86_64": + url: "https://dl.google.com/android/repository/android-ndk-r26-linux.zip" + sha256: "1505c2297a5b7a04ed20b5d44da5665e91bac2b7c0fbcd3ae99b6ccc3a61289a" + "Macos": + "x86_64": + url: "https://dl.google.com/android/repository/android-ndk-r26-darwin.zip" + sha256: "b2ab2fd17f71e2d2994c8c0ba2e48e99377806e05bf7477093344c26ab71dec0" + "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": @@ -116,3 +220,29 @@ sources: "x86_64": url: "https://dl.google.com/android/repository/android-ndk-r21d-darwin-x86_64.zip" sha256: "5851115c6fc4cce26bc320295b52da240665d7ff89bda2f5d5af1887582f5c48" + "r20b": + "Windows": + "x86_64": + url: "https://dl.google.com/android/repository/android-ndk-r20b-windows-x86_64.zip" + sha256: "b9dd083aae7a29c887876ffb3840d4b192dee1a05ad9dbf545f2facd00b4e821" + "Linux": + "x86_64": + url: "https://dl.google.com/android/repository/android-ndk-r20b-linux-x86_64.zip" + sha256: "8381c440fe61fcbb01e209211ac01b519cd6adf51ab1c2281d5daad6ca4c8c8c" + "Macos": + "x86_64": + url: "https://dl.google.com/android/repository/android-ndk-r20b-darwin-x86_64.zip" + sha256: "4d760db479de1b6e54f5da2fe894a35f120ad4d6ccf4b989254940183ca00c08" + "r19c": + "Windows": + "x86_64": + url: "https://dl.google.com/android/repository/android-ndk-r19c-windows-x86_64.zip" + sha256: "0faf708c9837a921cae5262745f5857162614bb9689a0d188780d12ea93a2c18" + "Linux": + "x86_64": + url: "https://dl.google.com/android/repository/android-ndk-r19c-linux-x86_64.zip" + sha256: "4c62514ec9c2309315fd84da6d52465651cdb68605058f231f1e480fcf2692e1" + "Macos": + "x86_64": + url: "https://dl.google.com/android/repository/android-ndk-r19c-darwin-x86_64.zip" + sha256: "4eeaddcb4bb58b2a10a9712f9b8e84ea83889786a88923879e973058f59281cf" diff --git a/recipes/android-ndk/all/conanfile.py b/recipes/android-ndk/all/conanfile.py index bd8d13791737c..76b9a2ead193a 100644 --- a/recipes/android-ndk/all/conanfile.py +++ b/recipes/android-ndk/all/conanfile.py @@ -1,8 +1,7 @@ from conan import ConanFile, conan_version from conan.errors import ConanInvalidConfiguration -from conan.tools.files import get, download, unzip, load, copy +from conan.tools.files import get, download, unzip, load, copy, rm from conan.tools.layout import basic_layout -from conan.tools.scm import Version import os import re import shutil @@ -12,24 +11,28 @@ class AndroidNDKConan(ConanFile): name = "android-ndk" - description = "The Android NDK is a toolset that lets you implement parts of your app in native code, using languages such as C and C++" + description = ( + "The Android NDK is a toolset that lets you implement parts of your app " + "in native code, using languages such as C and C++" + ) + license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://developer.android.com/ndk/" topics = ("android", "ndk", "toolchain", "compiler") - license = "Apache-2.0" - - settings = "os", "arch", "build_type", "compiler" + package_type = "application" + settings = "os", "arch", "compiler", "build_type" 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): @@ -39,11 +42,15 @@ 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 export_sources(self): + copy(self, "cmake-wrapper.cmd", src=self.recipe_folder, dst=self.export_sources_folder) + copy(self, "cmake-wrapper", src=self.recipe_folder, dst=self.export_sources_folder) + 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 @@ -58,7 +65,8 @@ 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: @@ -73,6 +81,10 @@ def package(self): 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() + # Remove module and config CMake files, see https://github.com/conan-io/conan-center-index/blob/master/docs/error_knowledge_base.md#kb-h016-cmake-modules-config-files + rm(self, "*Config.cmake", os.path.join(self.package_folder, "bin"), recursive=True) + rm(self, "*-config.cmake", os.path.join(self.package_folder, "bin"), recursive=True) + rm(self, "Find*.cmake", os.path.join(self.package_folder, "bin"), recursive=True) # from here on, everything is assumed to run in 2 profile mode, using this android-ndk recipe as a build requirement @@ -219,7 +231,7 @@ def _cmake_system_processor(self): cmake_system_processor = "armv5te" return cmake_system_processor - def _define_tool_var(self, name, value, bare = False): + def _define_tool_var(self, name, value, bare=False): ndk_bin = os.path.join(self._ndk_root, "bin") path = os.path.join(ndk_bin, self._tool_name(value, bare)) if not os.path.isfile(path): @@ -262,7 +274,7 @@ 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")) @@ -288,12 +300,13 @@ def package_info(self): 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("AS", compiler_executables["c"]) + self.buildenv_info.define_path("LD", compiler_executables["cpp"]) # Versions greater than 23 had the naming convention # changed to no longer include the triplet. bare = self._ndk_version_major >= 23 self.buildenv_info.define_path("AR", self._define_tool_var("AR", "ar", bare)) - self.buildenv_info.define_path("AS", self._define_tool_var("AS", "as", bare)) self.buildenv_info.define_path("RANLIB", self._define_tool_var("RANLIB", "ranlib", bare)) self.buildenv_info.define_path("STRIP", self._define_tool_var("STRIP", "strip", bare)) self.buildenv_info.define_path("ADDR2LINE", self._define_tool_var("ADDR2LINE", "addr2line", bare)) @@ -305,12 +318,6 @@ def package_info(self): if self._ndk_version_major < 23: self.buildenv_info.define_path("ELFEDIT", self._define_tool_var("ELFEDIT", "elfedit", bare)) - # The `ld` tool changed naming conventions earlier than others - if self._ndk_version_major >= 22: - self.buildenv_info.define_path("LD", self._define_tool_var_naked("LD", "ld")) - else: - self.buildenv_info.define_path("LD", self._define_tool_var("LD", "ld")) - self.buildenv_info.define("ANDROID_PLATFORM", f"android-{self.settings_target.os.api_level}") self.buildenv_info.define("ANDROID_TOOLCHAIN", "clang") self.buildenv_info.define("ANDROID_ABI", self._android_abi) @@ -318,7 +325,7 @@ def package_info(self): self.buildenv_info.define("ANDROID_STL", libcxx_str if libcxx_str.startswith("c++_") else "c++_shared") # TODO: conan v1 stuff to remove later - if Version(conan_version).major < 2: + if 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") @@ -326,7 +333,7 @@ def package_info(self): 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.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 diff --git a/recipes/android-ndk/all/test_package/conanfile.py b/recipes/android-ndk/all/test_package/conanfile.py index db186fc2c369f..1c03586bc651b 100644 --- a/recipes/android-ndk/all/test_package/conanfile.py +++ b/recipes/android-ndk/all/test_package/conanfile.py @@ -1,6 +1,8 @@ from conan import ConanFile from conan.tools.cmake import CMake, cmake_layout +from conan.tools.scm import Version import os +import platform class TestPackgeConan(ConanFile): @@ -22,10 +24,14 @@ def build(self): cmake.build() def test(self): - if self.settings.os == "Windows": - self.run("ndk-build.cmd --version") + ndk_build = "ndk-build.cmd" if self.settings.os == "Windows" else "ndk-build" + ndk_version = Version(self.tested_reference_str.split('/')[1]) + skip_run = platform.system() == "Darwin" and "arm" in platform.processor() and ndk_version < "r23c" + if not skip_run: + self.run(f"{ndk_build} --version", env="conanbuild") else: - self.run("ndk-build --version") + self.output.warning("Skipped running ndk-build on macOS Apple Silicon in arm64 mode, please use a newer" + " version of the Android NDK") # INFO: Run the project that was built using Android NDK if self.settings.os == "Android": diff --git a/recipes/android-ndk/all/test_v1_package/CMakeLists.txt b/recipes/android-ndk/all/test_v1_package/CMakeLists.txt deleted file mode 100644 index f7c5ddc942cf1..0000000000000 --- a/recipes/android-ndk/all/test_v1_package/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) diff --git a/recipes/android-ndk/all/test_v1_package/conanfile.py b/recipes/android-ndk/all/test_v1_package/conanfile.py deleted file mode 100644 index e7a2d6060ddc7..0000000000000 --- a/recipes/android-ndk/all/test_v1_package/conanfile.py +++ /dev/null @@ -1,32 +0,0 @@ -import os -from conan import ConanFile -from conans import CMake -from conan.tools.build import cross_building - - -class TestPackgeConan(ConanFile): - settings = "os", "arch", "compiler", "build_type" - test_type = "explicit" - generators = "cmake" - - def build_requirements(self): - self.build_requires(self.tested_reference_str) - - def build(self): - # It only makes sense to build a library, if the target os is Android - if self.settings.os == "Android": - cmake = CMake(self) - cmake.configure() - cmake.build() - - def test(self): - if not cross_building(self): - if self.settings.os == "Windows": - self.run("ndk-build.cmd --version", run_environment=True) - else: - self.run("ndk-build --version", run_environment=True) - - # Run the project that was built using Android NDK - if self.settings.os == "Android": - test_file = os.path.join("bin", "test_package") - assert os.path.exists(test_file) diff --git a/recipes/android-ndk/config.yml b/recipes/android-ndk/config.yml index b2fc5196cfcfc..ccbdced0686a8 100644 --- a/recipes/android-ndk/config.yml +++ b/recipes/android-ndk/config.yml @@ -1,4 +1,20 @@ versions: + "r27c": + folder: all + "r27": + folder: all + "r26d": + folder: all + "r26c": + folder: all + "r26b": + folder: all + "r26": + folder: all + "r25c": + folder: all + "r25b": + folder: all "r25": folder: all "r24": @@ -17,3 +33,7 @@ versions: folder: all "r21d": folder: all + "r20b": + folder: all + "r19c": + folder: all diff --git a/recipes/angelscript/all/conandata.yml b/recipes/angelscript/all/conandata.yml index 1dec7ac1d3e71..a5590460838fe 100644 --- a/recipes/angelscript/all/conandata.yml +++ b/recipes/angelscript/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "2.37.0": + url: "https://www.angelcode.com/angelscript/sdk/files/angelscript_2.37.0.zip" + sha256: "0c52d1688016a0b2484e9ca549471c4e295df060770c57840144c64815f54f10" + "2.36.1": + url: "https://www.angelcode.com/angelscript/sdk/files/angelscript_2.36.1.zip" + sha256: "58bb749af9c7e386304705f4e6e627ae41dfe03e0b6a73c3d0d2e017c4fc948f" "2.36.0": url: "https://www.angelcode.com/angelscript/sdk/files/angelscript_2.36.0.zip" sha256: "33f95f7597bc0d88b097d35e7b1320d15419ffc5779851d9d2a6cccec57811b3" diff --git a/recipes/angelscript/all/conanfile.py b/recipes/angelscript/all/conanfile.py index 174e1d9732354..0a17df3020929 100644 --- a/recipes/angelscript/all/conanfile.py +++ b/recipes/angelscript/all/conanfile.py @@ -5,20 +5,21 @@ from conan.tools.microsoft import is_msvc import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class AngelScriptConan(ConanFile): name = "angelscript" - license = "Zlib" - homepage = "http://www.angelcode.com/angelscript" - url = "https://github.com/conan-io/conan-center-index" description = ( "An extremely flexible cross-platform scripting library designed to " "allow applications to extend their functionality through external scripts." ) + license = "Zlib" + url = "https://github.com/conan-io/conan-center-index" + homepage = "http://www.angelcode.com/angelscript" topics = ("angelcode", "embedded", "scripting", "language", "compiler", "interpreter") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [False, True], @@ -42,10 +43,7 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") @@ -92,7 +90,7 @@ def package_info(self): # TODO: back to global scope in conan v2 once cmake_find_package* generators removed 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") + self.cpp_info.components["_angelscript"].system_libs.extend(["m", "pthread"]) # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.names["cmake_find_package"] = "Angelscript" diff --git a/recipes/angelscript/all/test_v1_package/CMakeLists.txt b/recipes/angelscript/all/test_v1_package/CMakeLists.txt index 0d20897301b68..91630d79f4abb 100644 --- a/recipes/angelscript/all/test_v1_package/CMakeLists.txt +++ b/recipes/angelscript/all/test_v1_package/CMakeLists.txt @@ -1,8 +1,8 @@ -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) -add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package - ${CMAKE_CURRENT_BINARY_DIR}/test_package) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/angelscript/config.yml b/recipes/angelscript/config.yml index 22190418b16a2..621b347e7a383 100644 --- a/recipes/angelscript/config.yml +++ b/recipes/angelscript/config.yml @@ -1,4 +1,8 @@ versions: + "2.37.0": + folder: all + "2.36.1": + folder: all "2.36.0": folder: all "2.35.1": diff --git a/recipes/ann/all/CMakeLists.txt b/recipes/ann/all/CMakeLists.txt new file mode 100644 index 0000000000000..869e7fed035ec --- /dev/null +++ b/recipes/ann/all/CMakeLists.txt @@ -0,0 +1,29 @@ +cmake_minimum_required(VERSION 3.15) +project(ANN LANGUAGES CXX) + +include(GNUInstallDirs) + +file(GLOB ANN_SRC_FILES ${ANN_SRC_DIR}/src/*.cpp) + +add_library(ANN ${ANN_SRC_FILES}) +target_include_directories(ANN PUBLIC ${ANN_SRC_DIR}/include) + +if(WIN32) + if(BUILD_SHARED_LIBS) + set_target_properties(ANN PROPERTIES + CXX_VISIBILITY_PRESET hidden + VISIBILITY_INLINES_HIDDEN TRUE + ) + target_compile_definitions(ANN PRIVATE DLL_EXPORTS) + else() + target_compile_definitions(ANN PUBLIC ANN_STATIC) + endif() +endif() + +install(DIRECTORY ${ANN_SRC_DIR}/include/ANN DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +install( + TARGETS ANN + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) diff --git a/recipes/ann/all/conandata.yml b/recipes/ann/all/conandata.yml new file mode 100644 index 0000000000000..664adc9ca8f3c --- /dev/null +++ b/recipes/ann/all/conandata.yml @@ -0,0 +1,12 @@ +sources: + "1.1.2": + url: "https://www.cs.umd.edu/~mount/ANN/Files/1.1.2/ann_1.1.2.tar.gz" + sha256: "eea03f2e224b66813226d775053316675375dcec45bd263674c052d9324a49a5" +patches: + "1.1.2": + - patch_file: "patches/1.1.2-0001-fix-windows-static.patch" + patch_description: "Fix windows static" + patch_type: "portability" + - patch_file: "patches/1.1.2-0002-fix-cppstd17+-register-keyword.patch" + patch_description: "Fix compilation with C++17 (or above) standard, by removing register keyword" + patch_type: "portability" diff --git a/recipes/ann/all/conanfile.py b/recipes/ann/all/conanfile.py new file mode 100644 index 0000000000000..01aac4245f259 --- /dev/null +++ b/recipes/ann/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 +import os + +required_conan_version = ">=1.53.0" + + +class AnnConan(ConanFile): + name = "ann" + description = ( + "ANN is a library written in C++, which supports data structures and " + "algorithms for both exact and approximate nearest neighbor searching " + "in arbitrarily high dimensions." + ) + license = "LGPL-2.1-or-later" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://www.cs.umd.edu/~mount/ANN" + topics = ("nns", "nearest-neighbor-search") + 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): + 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): + 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["ANN_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.generate() + + def build(self): + 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): + for license_file in ("Copyright.txt", "License.txt"): + copy(self, license_file, 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 = ["ANN"] + if self.settings.os == "Windows" and not self.options.shared: + self.cpp_info.defines.append("ANN_STATIC") + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") diff --git a/recipes/ann/all/patches/1.1.2-0001-fix-windows-static.patch b/recipes/ann/all/patches/1.1.2-0001-fix-windows-static.patch new file mode 100644 index 0000000000000..7e027ada50bbb --- /dev/null +++ b/recipes/ann/all/patches/1.1.2-0001-fix-windows-static.patch @@ -0,0 +1,11 @@ +--- a/include/ANN/ANN.h ++++ b/include/ANN/ANN.h +@@ -59,7 +59,7 @@ + #ifndef ANN_H + #define ANN_H + +-#ifdef WIN32 ++#if defined(_WIN32) && !defined(ANN_STATIC) + //---------------------------------------------------------------------- + // For Microsoft Visual C++, externally accessible symbols must be + // explicitly indicated with DLL_API, which is somewhat like "extern." diff --git a/recipes/ann/all/patches/1.1.2-0002-fix-cppstd17+-register-keyword.patch b/recipes/ann/all/patches/1.1.2-0002-fix-cppstd17+-register-keyword.patch new file mode 100644 index 0000000000000..b7ccbe07fc3a4 --- /dev/null +++ b/recipes/ann/all/patches/1.1.2-0002-fix-cppstd17+-register-keyword.patch @@ -0,0 +1,141 @@ +--- a/src/ANN.cpp ++++ b/src/ANN.cpp +@@ -48,9 +48,9 @@ ANNdist annDist( // interpoint squared distance + ANNpoint p, + ANNpoint q) + { +- register int d; +- register ANNcoord diff; +- register ANNcoord dist; ++ int d; ++ ANNcoord diff; ++ ANNcoord dist; + + dist = 0; + for (d = 0; d < dim; d++) { +--- a/src/kd_fix_rad_search.cpp ++++ b/src/kd_fix_rad_search.cpp +@@ -147,11 +147,11 @@ void ANNkd_split::ann_FR_search(ANNdist box_dist) + + void ANNkd_leaf::ann_FR_search(ANNdist box_dist) + { +- register ANNdist dist; // distance to data point +- register ANNcoord* pp; // data coordinate pointer +- register ANNcoord* qq; // query coordinate pointer +- register ANNcoord t; +- register int d; ++ ANNdist dist; // distance to data point ++ ANNcoord* pp; // data coordinate pointer ++ ANNcoord* qq; // query coordinate pointer ++ ANNcoord t; ++ int d; + + for (int i = 0; i < n_pts; i++) { // check points in bucket + +--- a/src/kd_pr_search.cpp ++++ b/src/kd_pr_search.cpp +@@ -180,12 +180,12 @@ void ANNkd_split::ann_pri_search(ANNdist box_dist) + + void ANNkd_leaf::ann_pri_search(ANNdist box_dist) + { +- register ANNdist dist; // distance to data point +- register ANNcoord* pp; // data coordinate pointer +- register ANNcoord* qq; // query coordinate pointer +- register ANNdist min_dist; // distance to k-th closest point +- register ANNcoord t; +- register int d; ++ ANNdist dist; // distance to data point ++ ANNcoord* pp; // data coordinate pointer ++ ANNcoord* qq; // query coordinate pointer ++ ANNdist min_dist; // distance to k-th closest point ++ ANNcoord t; ++ int d; + + min_dist = ANNprPointMK->max_key(); // k-th smallest distance so far + +--- a/src/kd_search.cpp ++++ b/src/kd_search.cpp +@@ -171,12 +171,12 @@ void ANNkd_split::ann_search(ANNdist box_dist) + + void ANNkd_leaf::ann_search(ANNdist box_dist) + { +- register ANNdist dist; // distance to data point +- register ANNcoord* pp; // data coordinate pointer +- register ANNcoord* qq; // query coordinate pointer +- register ANNdist min_dist; // distance to k-th closest point +- register ANNcoord t; +- register int d; ++ ANNdist dist; // distance to data point ++ ANNcoord* pp; // data coordinate pointer ++ ANNcoord* qq; // query coordinate pointer ++ ANNdist min_dist; // distance to k-th closest point ++ ANNcoord t; ++ int d; + + min_dist = ANNkdPointMK->max_key(); // k-th smallest distance so far + +--- a/src/kd_util.cpp ++++ b/src/kd_util.cpp +@@ -127,10 +127,10 @@ ANNdist annBoxDistance( // compute distance from point to box + const ANNpoint hi, // high point of box + int dim) // dimension of space + { +- register ANNdist dist = 0.0; // sum of squared distances +- register ANNdist t; ++ ANNdist dist = 0.0; // sum of squared distances ++ ANNdist t; + +- for (register int d = 0; d < dim; d++) { ++ for (int d = 0; d < dim; d++) { + if (q[d] < lo[d]) { // q is left of box + t = ANNdist(lo[d]) - ANNdist(q[d]); + dist = ANN_SUM(dist, ANN_POW(t)); +@@ -238,8 +238,8 @@ void annMedianSplit( + int l = 0; // left end of current subarray + int r = n-1; // right end of current subarray + while (l < r) { +- register int i = (r+l)/2; // select middle as pivot +- register int k; ++ int i = (r+l)/2; // select middle as pivot ++ int k; + + if (PA(i,d) > PA(r,d)) // make sure last > pivot + PASWAP(i,r) +--- a/src/pr_queue.h ++++ b/src/pr_queue.h +@@ -86,9 +86,9 @@ public: + PQinfo inf) // item info + { + if (++n > max_size) annError("Priority queue overflow.", ANNabort); +- register int r = n; ++ int r = n; + while (r > 1) { // sift up new item +- register int p = r/2; ++ int p = r/2; + ANN_FLOP(1) // increment floating ops + if (pq[p].key <= kv) // in proper order + break; +@@ -105,9 +105,9 @@ public: + { + kv = pq[1].key; // key of min item + inf = pq[1].info; // information of min item +- register PQkey kn = pq[n--].key;// last item in queue +- register int p = 1; // p points to item out of position +- register int r = p<<1; // left child of p ++ PQkey kn = pq[n--].key;// last item in queue ++ int p = 1; // p points to item out of position ++ int r = p<<1; // left child of p + while (r <= n) { // while r is still within the heap + ANN_FLOP(2) // increment floating ops + // set r to smaller child of p +--- a/src/pr_queue_k.h ++++ b/src/pr_queue_k.h +@@ -100,7 +100,7 @@ public: + PQKkey kv, // key value + PQKinfo inf) // item info + { +- register int i; ++ int i; + // slide larger values up + for (i = n; i > 0; i--) { + if (mk[i-1].key > kv) diff --git a/recipes/ann/all/test_package/CMakeLists.txt b/recipes/ann/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..fe5808fbfdff7 --- /dev/null +++ b/recipes/ann/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(ann REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE ann::ann) diff --git a/recipes/ann/all/test_package/conanfile.py b/recipes/ann/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0a6bc68712d90 --- /dev/null +++ b/recipes/ann/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/ann/all/test_package/test_package.cpp b/recipes/ann/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..8a2ab526c32b2 --- /dev/null +++ b/recipes/ann/all/test_package/test_package.cpp @@ -0,0 +1,6 @@ +#include + +int main() { + ANNpoint queryPt = annAllocPt(2); + return 0; +} diff --git a/recipes/ann/config.yml b/recipes/ann/config.yml new file mode 100644 index 0000000000000..8d13aefb6b4fb --- /dev/null +++ b/recipes/ann/config.yml @@ -0,0 +1,3 @@ +versions: + "1.1.2": + folder: all diff --git a/recipes/annoy/all/conandata.yml b/recipes/annoy/all/conandata.yml new file mode 100644 index 0000000000000..540727dc55607 --- /dev/null +++ b/recipes/annoy/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.17.3": + url: "https://github.com/spotify/annoy/archive/refs/tags/v1.17.3.tar.gz" + sha256: "c121d38cacd98f5103b24ca4e94ca097f18179eed3037e9eb93ad70ec1e6356e" diff --git a/recipes/annoy/all/conanfile.py b/recipes/annoy/all/conanfile.py new file mode 100644 index 0000000000000..a583978167f26 --- /dev/null +++ b/recipes/annoy/all/conanfile.py @@ -0,0 +1,44 @@ +import os + +from conan import ConanFile +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout + +required_conan_version = ">=1.53.0" + +class AnnoyConan(ConanFile): + name = "annoy" + description = "Approximate Nearest Neighbors optimized for memory usage and loading/saving to disk" + license = "Apache-2.0" + homepage = "https://github.com/spotify/annoy" + url = "https://github.com/conan-io/conan-center-index" + topics = ("approximate-nearest-neighbors", "machine-learning", "nearest-neighbors", "header-only") + + package_type = "header-library" + 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], strip_root=True) + + def package(self): + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + for header in ["annoylib.h", "kissrandom.h", "mman.h"]: + copy(self, header, os.path.join(self.source_folder, "src"), os.path.join(self.package_folder, "include", "annoy")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "Annoy") + self.cpp_info.set_property("cmake_target_name", "Annoy::Annoy") + + 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"] = "Annoy" + self.cpp_info.names["cmake_find_package_multi"] = "Annoy" diff --git a/recipes/annoy/all/test_package/CMakeLists.txt b/recipes/annoy/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..33d34348b2425 --- /dev/null +++ b/recipes/annoy/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(Annoy REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE Annoy::Annoy) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/annoy/all/test_package/conanfile.py b/recipes/annoy/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/annoy/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/annoy/all/test_package/test_package.cpp b/recipes/annoy/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..ee5f4538042ea --- /dev/null +++ b/recipes/annoy/all/test_package/test_package.cpp @@ -0,0 +1,27 @@ +#include +#include + +#include +#include + +int main() { + const int n = 3; + Annoy::AnnoyIndex index(n); + + double x[3][3] = {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}; + double needle[3] = {0.1, 0.1, 0.8}; + + for (int i = 0; i < n; i++) { + index.add_item(i, x[i]); + } + index.build(-1); + + std::vector result; + index.get_nns_by_vector(needle, 1, -1, &result, nullptr); + std::cout << "Nearest neighbor to vector [1.0, 0.5, 0.5]: "; + for (int i : result) { + std::cout << i << " "; + } + std::cout << std::endl; + return 0; +} diff --git a/recipes/annoy/config.yml b/recipes/annoy/config.yml new file mode 100644 index 0000000000000..a138b582eaf2e --- /dev/null +++ b/recipes/annoy/config.yml @@ -0,0 +1,3 @@ +versions: + "1.17.3": + folder: all diff --git a/recipes/antlr4-cppruntime/all/conandata.yml b/recipes/antlr4-cppruntime/all/conandata.yml index 2605966cb79dc..f6974e320b559 100644 --- a/recipes/antlr4-cppruntime/all/conandata.yml +++ b/recipes/antlr4-cppruntime/all/conandata.yml @@ -1,39 +1,48 @@ sources: - "4.9.3": - url: "https://github.com/antlr/antlr4/archive/refs/tags/4.9.3.tar.gz" - sha256: "efe4057d75ab48145d4683100fec7f77d7f87fa258707330cadd1f8e6f7eecae" - "4.10.1": - url: "https://github.com/antlr/antlr4/archive/refs/tags/4.10.1.tar.gz" - sha256: "a320568b738e42735946bebc5d9d333170e14a251c5734e8b852ad1502efa8a2" + "4.13.1": + url: "https://github.com/antlr/antlr4/archive/refs/tags/4.13.1.tar.gz" + sha256: "da20d487524d7f0a8b13f73a8dc326de7fc2e5775f5a49693c0a4e59c6b1410c" + "4.13.0": + url: "https://github.com/antlr/antlr4/archive/refs/tags/4.13.0.tar.gz" + sha256: "b7082b539256e6de5137a7d57afe89493dce234a3ce686dbae709ef6cf2d2c81" + "4.12.0": + url: "https://github.com/antlr/antlr4/archive/refs/tags/4.12.0.tar.gz" + sha256: "8b6050a2111a6bb6405cc5e9e7bca80c136548ac930e4b2c27566d1eb32f8aed" "4.11.1": url: "https://github.com/antlr/antlr4/archive/refs/tags/4.11.1.tar.gz" sha256: "81f87f03bb83b48da62e4fc8bfdaf447efb9fb3b7f19eb5cbc37f64e171218cf" -patches: + "4.10.1": + url: "https://github.com/antlr/antlr4/archive/refs/tags/4.10.1.tar.gz" + sha256: "a320568b738e42735946bebc5d9d333170e14a251c5734e8b852ad1502efa8a2" "4.9.3": - - patch_file: "patches/0001-update-cmakelist.patch" - - patch_file: "patches/0004-update-DropLibuuid-4.9.3-1.patch" + url: "https://github.com/antlr/antlr4/archive/refs/tags/4.9.3.tar.gz" + sha256: "efe4057d75ab48145d4683100fec7f77d7f87fa258707330cadd1f8e6f7eecae" +patches: + "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" + "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.9.3-2.patch" + - 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.10.1": - - patch_file: "patches/0004-update-DropLibuuid-4.10.x-1.patch" + "4.9.3": + - patch_file: "patches/0001-update-cmakelist.patch" + - 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.10.x-2.patch" + - 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.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 e47c4f36aca6b..3aaea8c41d7d7 100644 --- a/recipes/antlr4-cppruntime/all/conanfile.py +++ b/recipes/antlr4-cppruntime/all/conanfile.py @@ -1,4 +1,5 @@ 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 @@ -8,17 +9,19 @@ import os import textwrap -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class Antlr4CppRuntimeConan(ConanFile): name = "antlr4-cppruntime" - homepage = "https://github.com/antlr/antlr4/tree/master/runtime/Cpp" description = "C++ runtime support for ANTLR (ANother Tool for Language Recognition)" - topics = ("antlr", "parser", "runtime") - url = "https://github.com/conan-io/conan-center-index" license = "BSD-3-Clause" - settings = "os", "compiler", "build_type", "arch" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/antlr/antlr4/tree/master/runtime/Cpp" + topics = ("antlr", "parser", "runtime") + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -30,23 +33,19 @@ class Antlr4CppRuntimeConan(ConanFile): short_paths = True @property - def _minimum_cpp_standard(self): + 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 + return "17" if Version(self.version) >= "4.10" else "11" @property - def _minimum_compiler_versions_cpp17(self): + def _compilers_minimum_version(self): return { - "gcc": "7", - "clang": "5", - "apple-clang": "9.1" - } - - def _check_minimum_compiler_version_cpp17(self): - compiler = self.info.settings.compiler - min_compiler_version = self._minimum_compiler_versions_cpp17.get(str(compiler), False) - if min_compiler_version and Version(compiler.version) < min_compiler_version: - raise ConanInvalidConfiguration(f"{self.ref} requires C++17, which your compiler does not support.") + "17": { + "gcc": "7", + "clang": "5", + "apple-clang": "9.1", + }, + }.get(self._min_cppstd, {}) def export_sources(self): export_conandata_patches(self) @@ -57,20 +56,22 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + 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) + # 1. As of 4.10, antlr4-cppruntime no longer requires `utfcpp`. + # Reference: [C++] Implement standalone Unicode encoding and decoding handling + # Link: https://github.com/antlr/antlr4/pull/3398 + # 2. As of 4.11, antlr4-cppruntime no longer requires `libuuid`. + # Reference: [C++] Remove libuuid dependency + # Link: 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 Version(self.version) < "4.10": + self.requires("utfcpp/3.2.3") def validate(self): # Compilation of this library on version 15 claims C2668 Error. @@ -78,16 +79,17 @@ def validate(self): # Guard: The minimum MSVC version is 16 or 1920 (which already supports C++17) check_min_vs(self, "192") - # Check the minimum C++ standard - min_cppstd = self._minimum_cpp_standard - if self.info.settings.compiler.cppstd: - check_min_cppstd(self, min_cppstd) - # Check the minimum compiler version - if min_cppstd == 17: - self._check_minimum_compiler_version_cpp17() + 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], 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,6 +99,12 @@ def generate(self): if is_msvc(self): tc.cache_variables["WITH_STATIC_CRT"] = is_msvc_static_runtime(self) tc.variables["WITH_DEMO"] = False + # As of ANTLR 4.12.0, one can choose to build the shared/static library only instead of both of them + # Related Issue: https://github.com/antlr/antlr4/issues/3993 + # Related PR: https://github.com/antlr/antlr4/pull/3996 + if Version(self.version) >= "4.12": + tc.variables["ANTLR_BUILD_SHARED"] = self.options.shared + tc.variables["ANTLR_BUILD_STATIC"] = not self.options.shared tc.generate() tc = CMakeDeps(self) tc.generate() @@ -126,6 +134,8 @@ def package(self): # This cmake config script is needed to provide the cmake function `antlr4_generate` 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( os.path.join(self.package_folder, self._module_file_rel_path), @@ -158,7 +168,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/test_package/CMakeLists.txt b/recipes/antlr4-cppruntime/all/test_package/CMakeLists.txt index e1a9346912d37..e4aff6ceb5ae4 100644 --- a/recipes/antlr4-cppruntime/all/test_package/CMakeLists.txt +++ b/recipes/antlr4-cppruntime/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(antlr4-runtime REQUIRED CONFIG) diff --git a/recipes/antlr4-cppruntime/all/test_v1_package/CMakeLists.txt b/recipes/antlr4-cppruntime/all/test_v1_package/CMakeLists.txt index b9ee4c6f88e3f..91630d79f4abb 100644 --- a/recipes/antlr4-cppruntime/all/test_v1_package/CMakeLists.txt +++ b/recipes/antlr4-cppruntime/all/test_v1_package/CMakeLists.txt @@ -1,15 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package CXX) +cmake_minimum_required(VERSION 3.15) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(antlr4-runtime REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -if(TARGET antlr4_shared) - target_link_libraries(${PROJECT_NAME} PRIVATE antlr4_shared) -else() - target_link_libraries(${PROJECT_NAME} PRIVATE antlr4_static) -endif() -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/antlr4-cppruntime/config.yml b/recipes/antlr4-cppruntime/config.yml index fd8294e924d85..05c77e20051f9 100644 --- a/recipes/antlr4-cppruntime/config.yml +++ b/recipes/antlr4-cppruntime/config.yml @@ -1,7 +1,13 @@ versions: - "4.9.3": + "4.13.1": folder: all - "4.10.1": + "4.13.0": + folder: all + "4.12.0": folder: all "4.11.1": folder: all + "4.10.1": + folder: all + "4.9.3": + folder: all diff --git a/recipes/antlr4/all/conandata.yml b/recipes/antlr4/all/conandata.yml new file mode 100644 index 0000000000000..bb6d82645f9fb --- /dev/null +++ b/recipes/antlr4/all/conandata.yml @@ -0,0 +1,8 @@ +sources: + "4.13.1": + jar: + url: "https://www.antlr.org/download/antlr-4.13.1-complete.jar" + sha256: "bc13a9c57a8dd7d5196888211e5ede657cb64a3ce968608697e4f668251a8487" + license: + url: "https://raw.githubusercontent.com/antlr/antlr4/4.13.1/LICENSE.txt" + sha256: "3db1fb3ee79a4b4f9918fc4d0f6133bf18a3cf787f126cd22f8aa9b862281c0c" diff --git a/recipes/antlr4/all/conanfile.py b/recipes/antlr4/all/conanfile.py new file mode 100644 index 0000000000000..b0a45cf87f544 --- /dev/null +++ b/recipes/antlr4/all/conanfile.py @@ -0,0 +1,75 @@ +from conan import ConanFile +from conan.tools.files import copy, download, save +import os +import stat + + +required_conan_version = ">=1.47.0" + + +class Antlr4Conan(ConanFile): + name = "antlr4" + description = "powerful parser generator for reading, processing, executing, or translating structured text or binary files." + license = "BSD-3-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/antlr/antlr4" + topics = ("parser", "generator") + package_type = "application" + settings = "os", "arch", "compiler", "build_type" + + def layout(self): + pass + + def requirements(self): + self.requires("openjdk/21.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): + v = self.conan_data["sources"][self.version] + download( + self, + url=v["jar"]["url"], + filename=os.path.join(self.source_folder, "antlr-complete.jar"), + sha256=v["jar"]["sha256"], + ) + download( + self, + url=v["license"]["url"], + filename=os.path.join(self.source_folder, "LICENSE.txt"), + sha256=v["license"]["sha256"], + ) + + def package(self): + copy(self, pattern="LICENSE.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, pattern="antlr-complete.jar", dst=os.path.join(self.package_folder, "res"), src=self.source_folder) + if self.settings.os == "Windows": + save(self, + path=os.path.join(self.package_folder, "bin", "antlr4.bat"), + content="""\ + java -classpath %CLASSPATH% org.antlr.v4.Tool %* + """ + ) + else: + bin_path = os.path.join(self.package_folder, "bin", "antlr4") + save(self, + path=bin_path, + content="""\ + #!/bin/bash + java -classpath $CLASSPATH org.antlr.v4.Tool $@ + """ + ) + st = os.stat(bin_path) + os.chmod(bin_path, st.st_mode | stat.S_IEXEC) + + def package_info(self): + self.cpp_info.frameworkdirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] + self.cpp_info.includedirs = [] + + jar = os.path.join(self.package_folder, "res", "antlr-complete.jar") + self.runenv_info.prepend_path("CLASSPATH", jar) diff --git a/recipes/antlr4/all/test_package/conanfile.py b/recipes/antlr4/all/test_package/conanfile.py new file mode 100644 index 0000000000000..07c30b7476b74 --- /dev/null +++ b/recipes/antlr4/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 = "VirtualBuildEnv" + test_type = "explicit" + + def build_requirements(self): + self.tool_requires(self.tested_reference_str) + + def test(self): + if can_run(self): + self.run("antlr4") diff --git a/recipes/antlr4/config.yml b/recipes/antlr4/config.yml new file mode 100644 index 0000000000000..641cda5e6add7 --- /dev/null +++ b/recipes/antlr4/config.yml @@ -0,0 +1,3 @@ +versions: + "4.13.1": + folder: all diff --git a/recipes/any-lite/all/conanfile.py b/recipes/any-lite/all/conanfile.py index 19f65824ca091..ed35a82c05d84 100644 --- a/recipes/any-lite/all/conanfile.py +++ b/recipes/any-lite/all/conanfile.py @@ -8,24 +8,27 @@ class AnyLiteConan(ConanFile): name = "any-lite" + description = ( + "any lite - A C++17-like any, a type-safe container for single values of " + "any type for C++98, C++11 and later in a single-file header-only library" + ) + license = "BSL-1.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/martinmoene/any-lite" - description = ("any lite - A C++17-like any, a type-safe container for single values of \ - any type for C++98, C++11 and later in a single-file header-only library") - topics = ("cpp11", "cpp14", "cpp17", "any", "any-implementations") - license = "BSL-1.0" + topics = ("cpp11", "cpp14", "cpp17", "any", "any-implementations", "header-only") + + package_type = "header-library" 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 diff --git a/recipes/any-lite/all/test_v1_package/CMakeLists.txt b/recipes/any-lite/all/test_v1_package/CMakeLists.txt index 3d223cfc63eee..91630d79f4abb 100644 --- a/recipes/any-lite/all/test_v1_package/CMakeLists.txt +++ b/recipes/any-lite/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.15) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(any-lite REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE nonstd::any-lite) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/anyrpc/all/conandata.yml b/recipes/anyrpc/all/conandata.yml index 26dc592b0ce1b..11c9a8b3eb434 100644 --- a/recipes/anyrpc/all/conandata.yml +++ b/recipes/anyrpc/all/conandata.yml @@ -6,11 +6,11 @@ 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: backport + 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: backport + 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" diff --git a/recipes/anyrpc/all/conanfile.py b/recipes/anyrpc/all/conanfile.py index 79bf90cb74d72..068094058cb31 100644 --- a/recipes/anyrpc/all/conanfile.py +++ b/recipes/anyrpc/all/conanfile.py @@ -1,12 +1,11 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -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.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.52.0" +required_conan_version = ">=1.53.0" class AnyRPCConan(ConanFile): @@ -15,7 +14,9 @@ class AnyRPCConan(ConanFile): license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/sgieseking/anyrpc" - topics = ("rpc") + topics = ("rpc",) + + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -41,7 +42,7 @@ class AnyRPCConan(ConanFile): } @property - def _minimum_cpp_standard(self): + def _min_cppstd(self): return 11 def export_sources(self): @@ -53,10 +54,7 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") @@ -66,14 +64,17 @@ def requirements(self): self.requires("log4cplus/2.0.7") def validate(self): - if self.info.settings.compiler.cppstd: - check_min_cppstd(self, self._minimum_cpp_standard) + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) - if self.info.options.with_log4cplus and self.info.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") + 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], destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -81,25 +82,22 @@ def generate(self): 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 _patch_sources(self): - apply_conandata_patches(self) - def build(self): - self._patch_sources() + apply_conandata_patches(self) cmake = CMake(self) cmake.configure() cmake.build() @@ -109,19 +107,9 @@ def package(self): 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 = ["anyrpc"] - if not self.options.shared and self.settings.os == "Windows": - self.cpp_info.system_libs.append("ws2_32") - + self.cpp_info.system_libs.append("ws2_32") 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.extend(["m", "pthread"]) diff --git a/recipes/anyrpc/all/test_v1_package/CMakeLists.txt b/recipes/anyrpc/all/test_v1_package/CMakeLists.txt index 8272097b5b3da..91630d79f4abb 100644 --- a/recipes/anyrpc/all/test_v1_package/CMakeLists.txt +++ b/recipes/anyrpc/all/test_v1_package/CMakeLists.txt @@ -1,6 +1,8 @@ -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) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/approvaltests.cpp/all/conandata.yml b/recipes/approvaltests.cpp/all/conandata.yml index abc3968a22f1d..f5f47fc15d2ea 100644 --- a/recipes/approvaltests.cpp/all/conandata.yml +++ b/recipes/approvaltests.cpp/all/conandata.yml @@ -1,41 +1,46 @@ sources: - 8.9.2: - - url: https://github.com/approvals/ApprovalTests.cpp/releases/download/v.8.9.2/ApprovalTests.v.8.9.2.hpp - sha256: e743f1b83afb045cb9bdee310e438a3ed610a549240e4b4c4c995e548c773da5 - - url: "https://raw.githubusercontent.com/approvals/ApprovalTests.cpp/v.8.9.2/LICENSE" + "10.13.0": + - url: https://github.com/approvals/ApprovalTests.cpp/releases/download/v.10.13.0/ApprovalTests.v.10.13.0.hpp + sha256: c00f6390b81d9924dc646e9d32b61e1e09abda106c13704f714ac349241bb9ff + - url: "https://raw.githubusercontent.com/approvals/ApprovalTests.cpp/v.10.13.0/LICENSE" sha256: c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4 - 9.0.0: - - url: https://github.com/approvals/ApprovalTests.cpp/releases/download/v.9.0.0/ApprovalTests.v.9.0.0.hpp - sha256: cae3599dc29bd50c2cf48967e209c854e7b867ecdc8a5aec143b6fb4a7dcc739 - - url: "https://raw.githubusercontent.com/approvals/ApprovalTests.cpp/v.9.0.0/LICENSE" + "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 - 10.9.1: - - url: https://github.com/approvals/ApprovalTests.cpp/releases/download/v.10.9.1/ApprovalTests.v.10.9.1.hpp - sha256: 65aa9ab1afa1b9c2df5890274010eed0f8c2f57b08a81c5cb719b71a0ad9d14c - - url: "https://raw.githubusercontent.com/approvals/ApprovalTests.cpp/v.10.9.1/LICENSE" + "10.12.1": + - url: https://github.com/approvals/ApprovalTests.cpp/releases/download/v.10.12.1/ApprovalTests.v.10.12.1.hpp + sha256: 5e87f2e4b39f027676c9259c3edd4a4a8078c0814cdfb371718ef0eb685477c2 + - url: "https://raw.githubusercontent.com/approvals/ApprovalTests.cpp/v.10.12.1/LICENSE" sha256: c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4 - 10.10.0: - - url: https://github.com/approvals/ApprovalTests.cpp/releases/download/v.10.10.0/ApprovalTests.v.10.10.0.hpp - sha256: e8fbe19011adad46d8a6309b1e2112fb9de729dddaa12f5fd9dfd6adb44dba2e - - url: "https://raw.githubusercontent.com/approvals/ApprovalTests.cpp/v.10.10.0/LICENSE" + "10.12.0": + - url: https://github.com/approvals/ApprovalTests.cpp/releases/download/v.10.12.0/ApprovalTests.v.10.12.0.hpp + sha256: 5084ad71b8cc73ea9d753685b652d8828842335a59ab93a2199ceac879a4b292 + - url: "https://raw.githubusercontent.com/approvals/ApprovalTests.cpp/v.10.12.0/LICENSE" sha256: c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4 - 10.11.0: + "10.11.0": - url: https://github.com/approvals/ApprovalTests.cpp/releases/download/v.10.11.0/ApprovalTests.v.10.11.0.hpp sha256: 7f4efb835d59b2f31c3dc8a6f35335ad621da538ccb09abf2037d29d4f13f0b2 - url: "https://raw.githubusercontent.com/approvals/ApprovalTests.cpp/v.10.11.0/LICENSE" sha256: c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4 - 10.12.0: - - url: https://github.com/approvals/ApprovalTests.cpp/releases/download/v.10.12.0/ApprovalTests.v.10.12.0.hpp - sha256: 5084ad71b8cc73ea9d753685b652d8828842335a59ab93a2199ceac879a4b292 - - url: "https://raw.githubusercontent.com/approvals/ApprovalTests.cpp/v.10.12.0/LICENSE" + "10.10.0": + - url: https://github.com/approvals/ApprovalTests.cpp/releases/download/v.10.10.0/ApprovalTests.v.10.10.0.hpp + sha256: e8fbe19011adad46d8a6309b1e2112fb9de729dddaa12f5fd9dfd6adb44dba2e + - url: "https://raw.githubusercontent.com/approvals/ApprovalTests.cpp/v.10.10.0/LICENSE" sha256: c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4 - 10.12.1: - - url: https://github.com/approvals/ApprovalTests.cpp/releases/download/v.10.12.1/ApprovalTests.v.10.12.1.hpp - sha256: 5e87f2e4b39f027676c9259c3edd4a4a8078c0814cdfb371718ef0eb685477c2 - - url: "https://raw.githubusercontent.com/approvals/ApprovalTests.cpp/v.10.12.1/LICENSE" + "10.9.1": + - url: https://github.com/approvals/ApprovalTests.cpp/releases/download/v.10.9.1/ApprovalTests.v.10.9.1.hpp + sha256: 65aa9ab1afa1b9c2df5890274010eed0f8c2f57b08a81c5cb719b71a0ad9d14c + - url: "https://raw.githubusercontent.com/approvals/ApprovalTests.cpp/v.10.9.1/LICENSE" sha256: c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4 - 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" + "9.0.0": + - url: https://github.com/approvals/ApprovalTests.cpp/releases/download/v.9.0.0/ApprovalTests.v.9.0.0.hpp + sha256: cae3599dc29bd50c2cf48967e209c854e7b867ecdc8a5aec143b6fb4a7dcc739 + - url: "https://raw.githubusercontent.com/approvals/ApprovalTests.cpp/v.9.0.0/LICENSE" + sha256: c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4 + "8.9.2": + - url: https://github.com/approvals/ApprovalTests.cpp/releases/download/v.8.9.2/ApprovalTests.v.8.9.2.hpp + sha256: e743f1b83afb045cb9bdee310e438a3ed610a549240e4b4c4c995e548c773da5 + - url: "https://raw.githubusercontent.com/approvals/ApprovalTests.cpp/v.8.9.2/LICENSE" sha256: c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4 diff --git a/recipes/approvaltests.cpp/all/conanfile.py b/recipes/approvaltests.cpp/all/conanfile.py index c21feb556bea3..1bfdff95cf245 100644 --- a/recipes/approvaltests.cpp/all/conanfile.py +++ b/recipes/approvaltests.cpp/all/conanfile.py @@ -1,9 +1,12 @@ -from conans import ConanFile, tools -from conans.tools import Version, 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, download, rename +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.53" class ApprovalTestsCppConan(ConanFile): @@ -15,6 +18,8 @@ class ApprovalTestsCppConan(ConanFile): "(such as a file) in one operation as opposed to writing " \ "test assertions for each element." topics = ("testing", "unit-testing", "header-only") + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" options = { "with_boosttest": [True, False], "with_catch2": [True, False], @@ -30,67 +35,63 @@ class ApprovalTestsCppConan(ConanFile): "with_cpputest": False, } no_copy_source = True - settings = "compiler", "os", "build_type", "arch" @property def _header_file(self): return "ApprovalTests.hpp" + + @property + def _min_cppstd(self): + return 11 - def configure(self): - if not self._boost_test_supported(): - del self.options.with_boosttest - if not self._cpputest_supported(): + def config_options(self): + if Version(self.version) < "10.4.0": del self.options.with_cpputest - def validate(self): - self._validate_compiler_settings() + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - if self.options.get_safe("with_boosttest"): - self.requires("boost/1.72.0") + if self.options.with_boosttest: + self.requires("boost/1.83.0") if self.options.with_catch2: - self.requires("catch2/2.13.7") + self.requires("catch2/3.5.0") if self.options.with_gtest: - self.requires("gtest/1.10.0") + self.requires("gtest/1.14.0") if self.options.with_doctest: - self.requires("doctest/2.4.6") + self.requires("doctest/2.4.11") if self.options.get_safe("with_cpputest"): self.requires("cpputest/4.0") def package_id(self): - self.info.header_only() + self.info.clear() + + def validate(self): + if self.settings.get_safe("compiler.cppstd"): + check_min_cppstd(self, self._min_cppstd) + + if Version(self.version) >= "10.2.0": + if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "5": + raise ConanInvalidConfiguration(f"{self.ref} with compiler gcc requires at least compiler version 5") def source(self): for source in self.conan_data["sources"][self.version]: url = source["url"] filename = url[url.rfind("/") + 1:] - tools.download(url, filename) - tools.check_sha256(filename, source["sha256"]) - rename(self, "ApprovalTests.v.{}.hpp".format(self.version), self._header_file) + download(self, url, filename, sha256=source["sha256"]) + rename(self, src=os.path.join(self.source_folder, f"ApprovalTests.v.{self.version}.hpp"), + dst=os.path.join(self.source_folder, self._header_file)) def package(self): - self.copy(self._header_file, dst="include") - self.copy("LICENSE", dst="licenses") + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, self._header_file, src=self.source_folder, dst=os.path.join(self.package_folder, "include")) def package_info(self): + self.cpp_info.set_property("cmake_file_name", "ApprovalTests") + self.cpp_info.set_property("cmake_target_name", "ApprovalTests::ApprovalTests") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + # TODO: to remove in conan v2 self.cpp_info.names["cmake_find_package"] = "ApprovalTests" self.cpp_info.names["cmake_find_package_multi"] = "ApprovalTests" - - def _boost_test_supported(self): - return Version(self.version) >= "8.6.0" - - def _cpputest_supported(self): - return Version(self.version) >= "10.4.0" - - def _std_puttime_required(self): - return Version(self.version) >= "10.2.0" - - def _validate_compiler_settings(self): - if self._std_puttime_required(): - self._require_at_least_compiler_version("gcc", 5) - - def _require_at_least_compiler_version(self, compiler, compiler_version): - if self.settings.compiler == compiler and tools.Version(self.settings.compiler.version) < compiler_version: - raise ConanInvalidConfiguration( - "{}/{} with compiler {} requires at least compiler version {}". - format(self.name, self.version, compiler, compiler_version)) diff --git a/recipes/approvaltests.cpp/all/test_package/.gitignore b/recipes/approvaltests.cpp/all/test_package/.gitignore deleted file mode 100644 index fcfd5c9143f07..0000000000000 --- a/recipes/approvaltests.cpp/all/test_package/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.received.txt diff --git a/recipes/approvaltests.cpp/all/test_package/CMakeLists.txt b/recipes/approvaltests.cpp/all/test_package/CMakeLists.txt index d603257402203..6037353a3dc3d 100644 --- a/recipes/approvaltests.cpp/all/test_package/CMakeLists.txt +++ b/recipes/approvaltests.cpp/all/test_package/CMakeLists.txt @@ -1,35 +1,42 @@ -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) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS OFF) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -CONAN_BASIC_SETUP(TARGETS) +enable_testing() find_package(ApprovalTests REQUIRED CONFIG) if(WITH_BOOSTTEST) - ADD_EXECUTABLE(test_package_boosttest test_boosttest.cpp) - target_link_libraries(test_package_boosttest ApprovalTests::ApprovalTests) + add_executable(test_package_boosttest test_boosttest.cpp) + target_link_libraries(test_package_boosttest PRIVATE ApprovalTests::ApprovalTests) + target_compile_features(test_package_boosttest PRIVATE cxx_std_11) + add_test(NAME test_package_boosttest COMMAND test_package_boosttest) endif() if(WITH_CATCH) - ADD_EXECUTABLE(test_package_catch test_catch.cpp) - target_link_libraries(test_package_catch ApprovalTests::ApprovalTests) + add_executable(test_package_catch test_catch.cpp) + target_link_libraries(test_package_catch PRIVATE ApprovalTests::ApprovalTests) + target_compile_features(test_package_catch PRIVATE cxx_std_11) + add_test(NAME test_package_catch COMMAND test_package_catch) endif() if(WITH_GTEST) - ADD_EXECUTABLE(test_package_gtest test_gtest.cpp) - target_link_libraries(test_package_gtest ApprovalTests::ApprovalTests) + add_executable(test_package_gtest test_gtest.cpp) + target_link_libraries(test_package_gtest PRIVATE ApprovalTests::ApprovalTests) + target_compile_features(test_package_gtest PRIVATE cxx_std_11) + add_test(NAME test_package_gtest COMMAND test_package_gtest) endif() if(WITH_DOCTEST) - ADD_EXECUTABLE(test_package_doctest test_doctest.cpp) - target_link_libraries(test_package_doctest ApprovalTests::ApprovalTests) + add_executable(test_package_doctest test_doctest.cpp) + target_link_libraries(test_package_doctest PRIVATE ApprovalTests::ApprovalTests) + target_compile_features(test_package_doctest PRIVATE cxx_std_11) + add_test(NAME test_package_doctest COMMAND test_package_doctest) endif() if(WITH_CPPUTEST) - ADD_EXECUTABLE(test_package_cpputest test_cpputest.cpp) - target_link_libraries(test_package_cpputest ApprovalTests::ApprovalTests) + add_executable(test_package_cpputest test_cpputest.cpp) + target_link_libraries(test_package_cpputest PRIVATE ApprovalTests::ApprovalTests) + target_compile_features(test_package_cpputest PRIVATE cxx_std_11) + add_test(NAME test_package_cpputest COMMAND test_package_cpputest) endif() -ADD_EXECUTABLE(test_package test_package.cpp) -target_link_libraries(test_package ApprovalTests::ApprovalTests) +add_executable(test_package test_package.cpp) +target_link_libraries(test_package PRIVATE ApprovalTests::ApprovalTests) +target_compile_features(test_package PRIVATE cxx_std_11) +add_test(NAME test_package COMMAND test_package) diff --git a/recipes/approvaltests.cpp/all/test_package/conanfile.py b/recipes/approvaltests.cpp/all/test_package/conanfile.py index 819202453d307..50f4e26c4fdc7 100644 --- a/recipes/approvaltests.cpp/all/test_package/conanfile.py +++ b/recipes/approvaltests.cpp/all/test_package/conanfile.py @@ -1,55 +1,33 @@ -import os -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 class TestPackageConan(ConanFile): - settings = "os", "compiler", "arch", "build_type" - 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 build(self): - cmake = CMake(self) + def requirements(self): + self.requires(self.tested_reference_str) - if self._boost_test_supported() and self.options["approvaltests.cpp"].with_boosttest: - cmake.definitions["WITH_BOOSTTEST"] = True - if self.options["approvaltests.cpp"].with_catch2: - cmake.definitions["WITH_CATCH"] = True - if self.options["approvaltests.cpp"].with_gtest: - cmake.definitions["WITH_GTEST"] = True - if self.options["approvaltests.cpp"].with_doctest: - cmake.definitions["WITH_DOCTEST"] = True - if self._cpputest_supported() and self.options["approvaltests.cpp"].with_cpputest: - cmake.definitions["WITH_CPPUTEST"] = True + def generate(self): + tc = CMakeToolchain(self) + tc.variables["WITH_BOOSTTEST"] = self.dependencies["approvaltests.cpp"].options.get_safe("with_boosttest", False) + tc.variables["WITH_CATCH"] = self.dependencies["approvaltests.cpp"].options.with_catch2 + tc.variables["WITH_GTEST"] = self.dependencies["approvaltests.cpp"].options.with_gtest + tc.variables["WITH_DOCTEST"] = self.dependencies["approvaltests.cpp"].options.with_doctest + tc.variables["WITH_CPPUTEST"] = self.dependencies["approvaltests.cpp"].options.get_safe("with_cpputest", False) + tc.generate() + def build(self): + cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if tools.cross_building(self): - self.output.warn("Skipping run cross built package") - return - - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) - if self._boost_test_supported() and self.options["approvaltests.cpp"].with_boosttest: - print("Running Boost") - self.run(bin_path + "_boosttest", run_environment=True) - if self.options["approvaltests.cpp"].with_catch2: - print("Running Catch2") - self.run(bin_path + "_catch", run_environment=True) - if self.options["approvaltests.cpp"].with_gtest: - print("Running GTest") - self.run(bin_path + "_gtest", run_environment=True) - if self.options["approvaltests.cpp"].with_doctest: - print("Running DocTest") - self.run(bin_path + "_doctest", run_environment=True) - if self._cpputest_supported() and self.options["approvaltests.cpp"].with_cpputest: - print("Running CppUTest") - self.run(bin_path + "_cpputest", run_environment=True) - - def _boost_test_supported(self): - return Version(self.deps_cpp_info["approvaltests.cpp"].version) >= "8.6.0" - - def _cpputest_supported(self): - return Version(self.deps_cpp_info["approvaltests.cpp"].version) >= "10.4.0" + if can_run(self): + self.run(f"ctest --output-on-failure -C {self.settings.build_type}", env="conanrun") diff --git a/recipes/approvaltests.cpp/all/test_v1_package/CMakeLists.txt b/recipes/approvaltests.cpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..8ce0e08c3c918 --- /dev/null +++ b/recipes/approvaltests.cpp/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.8) +project(test_v1_package LANGUAGES CXX) + +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/approvaltests.cpp/all/test_v1_package/conanfile.py b/recipes/approvaltests.cpp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..8a49736d0c6b2 --- /dev/null +++ b/recipes/approvaltests.cpp/all/test_v1_package/conanfile.py @@ -0,0 +1,27 @@ +from conans import ConanFile, CMake, tools +from conans.errors import ConanException + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def _approvaltests_option(self, name, default): + try: + return getattr(self.options["approvaltests.cpp"], name, default) + except (AttributeError, ConanException): + return default + + def build(self): + cmake = CMake(self) + cmake.definitions["WITH_BOOSTTEST"] = self._approvaltests_option("with_boosttest", False) + cmake.definitions["WITH_CATCH"] = self.options["approvaltests.cpp"].with_catch2 + cmake.definitions["WITH_GTEST"] = self.options["approvaltests.cpp"].with_gtest + cmake.definitions["WITH_DOCTEST"] = self.options["approvaltests.cpp"].with_doctest + cmake.definitions["WITH_CPPUTEST"] = self._approvaltests_option("with_cpputest", 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}", run_environment=True) diff --git a/recipes/approvaltests.cpp/config.yml b/recipes/approvaltests.cpp/config.yml index e0b0401ce3f13..6e7a92b2ed85a 100644 --- a/recipes/approvaltests.cpp/config.yml +++ b/recipes/approvaltests.cpp/config.yml @@ -1,17 +1,19 @@ versions: - 8.9.2: + "10.13.0": folder: all - 9.0.0: + "10.12.2": folder: all - 10.9.1: + "10.12.1": folder: all - 10.10.0: + "10.12.0": folder: all - 10.11.0: + "10.11.0": folder: all - 10.12.0: + "10.10.0": folder: all - 10.12.1: + "10.9.1": folder: all - 10.12.2: + "9.0.0": + folder: all + "8.9.2": folder: all diff --git a/recipes/apr-util/all/CMakeLists.txt b/recipes/apr-util/all/CMakeLists.txt deleted file mode 100644 index 2a122ebfa3606..0000000000000 --- a/recipes/apr-util/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/apr-util/all/conandata.yml b/recipes/apr-util/all/conandata.yml index 5d5dde4a587d8..a6e26f0be8aa7 100644 --- a/recipes/apr-util/all/conandata.yml +++ b/recipes/apr-util/all/conandata.yml @@ -1,12 +1,10 @@ sources: "1.6.1": - url: "https://downloads.apache.org/apr/apr-util-1.6.1.tar.gz" + 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" sha256: "b65e40713da57d004123b6319828be7f1273fbc6490e145874ee1177e112c459" patches: "1.6.1": - - base_path: "source_subfolder" - patch_file: "patches/0001-cmake-build-only-shared-static.patch" - - base_path: "source_subfolder" - patch_file: "patches/0002-apu-config-prefix-env.patch" - - base_path: "source_subfolder" - patch_file: "patches/0003-disable-check-APR_LIBRARIES.patch" + - patch_file: "patches/0001-fix-cmake.patch" + - patch_file: "patches/0002-apu-config-prefix-env.patch" diff --git a/recipes/apr-util/all/conanfile.py b/recipes/apr-util/all/conanfile.py index f7c03746e3c19..92e0be4b1f040 100644 --- a/recipes/apr-util/all/conanfile.py +++ b/recipes/apr-util/all/conanfile.py @@ -1,20 +1,30 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, CMake, 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.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +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, AutotoolsDeps, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc import os - -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.54.0" class AprUtilConan(ConanFile): name = "apr-util" - 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 = ("apr-util", "apache", "platform", "library") + topics = ("apache", "platform", "library") homepage = "https://apr.apache.org/" url = "https://github.com/conan-io/conan-center-index" - exports_sources = "CMakeLists.txt", "patches/**" - generators = "cmake", "cmake_find_package" + + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -45,8 +55,8 @@ class AprUtilConan(ConanFile): "with_ldap": False, } - _autotools = None - _cmake = None + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -54,153 +64,158 @@ 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") + self.options["apr"].shared = self.options.shared - if not self.options.with_expat: - raise ConanInvalidConfiguration("expat cannot be disabled (at this time) (check back later)") - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + def layout(self): + if self.settings.os == "Windows": + cmake_layout(self, src_folder="src") + else: + basic_layout(self, src_folder="src") def requirements(self): - self.requires("apr/1.7.0") + self.requires("apr/1.7.4", transitive_headers=True) if self.settings.os != "Windows": #cmake build doesn't allow injection of iconv yet - self.requires("libiconv/1.16") + # https://github.com/conan-io/conan-center-index/pull/16142#issuecomment-1494282164 + # transitive_libs needs to be set because some sys-frameworks on the old mac images for c3i + # are pulling it in - discovered in https://github.com/conan-io/conan-center-index/pull/16266 + self.requires("libiconv/1.17", transitive_libs=True) if self.options.with_openssl: - self.requires("openssl/1.1.1k") + self.requires("openssl/[>=1.1 <4]") + if self.options.with_mysql: + self.requires("libmysqlclient/8.1.0") + if self.options.with_sqlite3: + self.requires("sqlite3/3.45.0") + if self.options.with_expat: + self.requires("expat/[>=2.6.2 <3]") + if self.options.with_postgresql: + self.requires("libpq/15.4") + + def validate(self): + if not self.options.with_expat: + raise ConanInvalidConfiguration("expat cannot be disabled (at this time) (check back later)") + if self.options.shared != self.dependencies["apr"].options.shared: + raise ConanInvalidConfiguration("apr-util must be built with same shared option as apr") if self.options.with_nss: - # self.requires("nss/x.y.z") raise ConanInvalidConfiguration("CCI has no nss recipe (yet)") if self.options.with_commoncrypto: - # self.requires("commoncrypto/x.y.z") raise ConanInvalidConfiguration("CCI has no commoncrypto recipe (yet)") if self.options.dbm == "gdbm": - # self.requires("gdbm/x.y.z") raise ConanInvalidConfiguration("CCI has no gdbm recipe (yet)") elif self.options.dbm == "ndbm": - # self.requires("ndbm/x.y.z") raise ConanInvalidConfiguration("CCI has no ndbm recipe (yet)") elif self.options.dbm == "db": - # self.requires("libdb/x.y.z") raise ConanInvalidConfiguration("CCI has no libdb recipe (yet)") if self.options.with_lber: - # self.requires("lber/x.y.z") raise ConanInvalidConfiguration("CCI has no lber recipe (yet)") if self.options.with_ldap: - # self.requires("ldap/x.y.z") raise ConanInvalidConfiguration("CCI has no ldap recipe (yet)") - if self.options.with_mysql: - self.requires("libmysqlclient/8.0.25") - if self.options.with_sqlite3: - self.requires("sqlite3/3.35.5") - if self.options.with_expat: - self.requires("expat/2.4.1") - if self.options.with_postgresql: - self.requires("libpq/13.2") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def validate(self): - if self.options.shared != self.options["apr"].shared: - raise ConanInvalidConfiguration("apr-util must be built with same shared option as apr") - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["APR_INCLUDE_DIR"] = ";".join(self.deps_cpp_info["apr"].include_paths) - self._cmake.definitions["INSTALL_PDB"] = False - self._cmake.definitions["APU_HAVE_CRYPTO"] = self._with_crypto - self._cmake.definitions["APR_HAS_LDAP"] = self.options.with_ldap - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + get(self, **self.conan_data["sources"][self.version], strip_root=True) @property def _with_crypto(self): return self.options.with_openssl or self.options.with_nss or self.options.with_commoncrypto - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self) - self._autotools.libs = [] - self._autotools.include_paths = [] - if self._with_crypto: - if self.settings.os == "Linux": - self._autotools.libs.append("dl") - conf_args = [ - "--with-apr={}".format(tools.unix_path(self.deps_cpp_info["apr"].rootpath)), - "--with-crypto" if self._with_crypto else "--without-crypto", - "--with-iconv={}".format(tools.unix_path(self.deps_cpp_info["libiconv"].rootpath)), - "--with-openssl={}".format(tools.unix_path(self.deps_cpp_info["openssl"].rootpath)) if self.options.with_openssl else "--without-openssl", - "--with-expat={}".format(tools.unix_path(self.deps_cpp_info["expat"].rootpath)) if self.options.with_expat else "--without-expat", - "--with-mysql={}".format(tools.unix_path(self.deps_cpp_info["libmysqlclient"].rootpath)) if self.options.with_mysql else "--without-mysql", - "--with-pgsql={}".format(tools.unix_path(self.deps_cpp_info["libpq"].rootpath)) if self.options.with_postgresql else "--without-pgsql", - "--with-sqlite3={}".format(tools.unix_path(self.deps_cpp_info["sqlite3"].rootpath)) if self.options.with_sqlite3 else "--without-sqlite3", - "--with-ldap={}".format(tools.unix_path(self.deps_cpp_info["ldap"].rootpath)) if self.options.with_ldap else "--without-ldap", - "--with-berkeley-db={}".format(tools.unix_path(self.deps_cpp_info["libdb"].rootpath)) if self.options.dbm == "db" else "--without-berkeley-db", - "--with-gdbm={}".format(tools.unix_path(self.deps_cpp_info["gdbm"].rootpath)) if self.options.dbm == "gdbm" else "--without-gdbm", - "--with-ndbm={}".format(tools.unix_path(self.deps_cpp_info["ndbm"].rootpath)) if self.options.dbm == "ndbm" else "--without-ndbm", - ] - if self.options.dbm: - conf_args.append("--with-dbm={}".format(self.options.dbm)) - self._autotools.configure(args=conf_args, configure_dir=self._source_subfolder) - return self._autotools - - def _patch_sources(self): - for patch in self.conan_data["patches"][self.version]: - tools.patch(**patch) + def generate(self): + if self.settings.os == "Windows": + tc = CMakeToolchain(self) + tc.variables["INSTALL_PDB"] = False + tc.variables["APU_HAVE_CRYPTO"] = self._with_crypto + tc.variables["APR_HAS_LDAP"] = self.options.with_ldap + tc.generate() + deps = CMakeDeps(self) + deps.generate() + else: + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") + + tc = AutotoolsToolchain(self) + yes_no = lambda v: "yes" if v else "no" + rootpath_no = lambda v, req: self.dependencies[req].package_folder if v else "no" + tc.configure_args.extend([ + f"--with-apr={rootpath_no(True, 'apr')}", + f"--with-crypto={yes_no(self._with_crypto)}", + f"--with-iconv={rootpath_no(True, 'libiconv')}", + f"--with-openssl={rootpath_no(self.options.with_openssl, 'openssl')}", + f"--with-expat={rootpath_no(self.options.with_expat, 'expat')}", + f"--with-mysql={rootpath_no(self.options.with_mysql, 'libmysqlclient')}", + f"--with-pgsql={rootpath_no(self.options.with_postgresql, 'libpq')}", + f"--with-sqlite3={rootpath_no(self.options.with_sqlite3, 'sqlite3')}", + f"--with-ldap={rootpath_no(self.options.with_ldap, 'ldap')}", + f"--with-berkeley-db={rootpath_no(self.options.dbm == 'db', 'libdb')}", + f"--with-gdbm={rootpath_no(self.options.dbm == 'gdbm', 'gdbm')}", + f"--with-ndbm={rootpath_no(self.options.dbm == 'ndbm', 'ndbm')}", + ]) + if self.options.dbm: + tc.configure_args.append(f"--with-dbm={self.options.dbm}") + if self._with_crypto and self.settings.os in ["Linux", "FreeBSD"]: + tc.extra_ldflags.append("-ldl") + env = tc.environment() + env.define_path("APR_ROOT", self.dependencies["apr"].package_folder) + env.define_path("_APR_BUILDDIR", os.path.join(self.dependencies["apr"].package_folder, "res", "build-1")) + tc.generate(env) + + deps = AutotoolsDeps(self) + deps.generate() def build(self): - self._patch_sources() + apply_conandata_patches(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", 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: - autotools = self._configure_autotools() + autotools = Autotools(self) autotools.install() - - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib", "apr-util-1"), "*.la") - os.unlink(os.path.join(self.package_folder, "lib", "libaprutil-1.la")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.la", os.path.join(self.package_folder, "lib"), 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.names["pkg_config"] = "apr-util-1" - self.cpp_info.libs = ["libaprutil-1" if self.settings.os == "Windows" and self.options.shared else "aprutil-1"] + self.cpp_info.set_property("pkg_config_name", "apr-util-1") + if self.settings.os == "Windows": + self.cpp_info.libs = ["apr_dbd_odbc-1"] + if self._with_crypto: + self.cpp_info.libs.append("apr_crypto_openssl-1") + if self.options.with_ldap: + self.cpp_info.libs.append("apr_ldap-1") + prefix = "lib" if self.options.shared else "" + self.cpp_info.libs.append(f"{prefix}aprutil-1") + else: + self.cpp_info.libs = ["aprutil-1"] self.cpp_info.libdirs.append(os.path.join("lib", "apr-util-1")) if not self.options.shared: self.cpp_info.defines = ["APU_DECLARE_STATIC"] - if self.settings.os == "Linux": - self.cpp_info.system_libs = ["dl", "pthread", "rt"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs = ["crypt", "dl", "pthread", "rt"] elif self.settings.os == "Windows": - self.cpp_info.system_libs = ["mswsock", "rpcrt4", "ws2_32"] + self.cpp_info.system_libs = ["mswsock", "odbc32", "rpcrt4", "ws2_32"] - binpath = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH env var : {}".format(binpath)) - self.env_info.PATH.append(binpath) + self.runenv_info.define_path("APR_UTIL_ROOT", self.package_folder) - apr_util_root = tools.unix_path(self.package_folder) - self.output.info("Settings APR_UTIL_ROOT environment var: {}".format(apr_util_root)) - self.env_info.APR_UTIL_ROOT = apr_util_root + deps = [dep for dep in reversed(self.dependencies.host.topological_sort.values())] + libdirs = [p for dep in deps for p in dep.cpp_info.aggregated_components().libdirs] + aprutil_ldflags = " ".join([f"-L{p}" for p in libdirs]) + self.runenv_info.define("APRUTIL_LDFLAGS", aprutil_ldflags) - if self.settings.compiler != "Visual Studio": - self.env_info.APRUTIL_LDFLAGS = " ".join(tools.unix_path("-L{}".format(l)) for l in self.deps_cpp_info.lib_paths) + # TODO: to remove in conan v2 + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) + self.env_info.APR_UTIL_ROOT = self.package_folder + if not is_msvc(self): + self.env_info.APRUTIL_LDFLAGS = aprutil_ldflags diff --git a/recipes/apr-util/all/patches/0001-cmake-build-only-shared-static.patch b/recipes/apr-util/all/patches/0001-cmake-build-only-shared-static.patch deleted file mode 100644 index f1ea7fe873eeb..0000000000000 --- a/recipes/apr-util/all/patches/0001-cmake-build-only-shared-static.patch +++ /dev/null @@ -1,49 +0,0 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -227,24 +227,24 @@ SET(install_bin_pdb) - SET(dbd_drivers) - - # Note: The WINNT definition on some targets is used only by libaprutil.rc. -- -+if(BUILD_SHARED_LIBS) - # libaprutil-1 is shared, aprutil-1 is static - ADD_LIBRARY(libaprutil-1 SHARED ${APR_SOURCES} ${APR_PUBLIC_HEADERS_GENERATED} libaprutil.rc) - SET(install_targets ${install_targets} libaprutil-1) - SET(install_bin_pdb ${install_bin_pdb} ${PROJECT_BINARY_DIR}/libaprutil-1.pdb) - TARGET_LINK_LIBRARIES(libaprutil-1 ${APR_LIBRARIES} ${XMLLIB_LIBRARIES}) - SET_TARGET_PROPERTIES(libaprutil-1 PROPERTIES COMPILE_DEFINITIONS "APU_DECLARE_EXPORT;APR_DECLARE_EXPORT;XML_STATIC;WINNT") -- -+else() - ADD_LIBRARY(aprutil-1 STATIC ${APR_SOURCES} ${APR_PUBLIC_HEADERS_GENERATED}) - SET(install_targets ${install_targets} aprutil-1) - TARGET_LINK_LIBRARIES(aprutil-1 ${APR_LIBRARIES} ${XMLLIB_LIBRARIES}) - SET_TARGET_PROPERTIES(aprutil-1 PROPERTIES COMPILE_DEFINITIONS "APU_DECLARE_STATIC;APR_DECLARE_STATIC;APU_DSO_MODULE_BUILD;XML_STATIC") -- -+endif() - IF(APU_HAVE_CRYPTO) - IF(NOT OPENSSL_FOUND) - MESSAGE(FATAL_ERROR "Only OpenSSL-based crypto is currently implemented in the cmake build") - ENDIF() -- ADD_LIBRARY(apr_crypto_openssl-1 SHARED crypto/apr_crypto_openssl.c libaprutil.rc) -+ ADD_LIBRARY(apr_crypto_openssl-1 crypto/apr_crypto_openssl.c libaprutil.rc) - SET(install_targets ${install_targets} apr_crypto_openssl-1) - SET(install_bin_pdb ${install_bin_pdb} ${PROJECT_BINARY_DIR}/apr_crypto_openssl-1.pdb) - SET_TARGET_PROPERTIES(apr_crypto_openssl-1 PROPERTIES INCLUDE_DIRECTORIES "${APR_INCLUDE_DIRECTORIES};${OPENSSL_INCLUDE_DIR}") -@@ -254,7 +254,7 @@ IF(APU_HAVE_CRYPTO) - ENDIF() - - IF(APU_HAVE_ODBC) -- ADD_LIBRARY(apr_dbd_odbc-1 SHARED dbd/apr_dbd_odbc.c libaprutil.rc) -+ ADD_LIBRARY(apr_dbd_odbc-1 dbd/apr_dbd_odbc.c libaprutil.rc) - SET(install_targets ${install_targets} apr_dbd_odbc-1) - SET(install_bin_pdb ${install_bin_pdb} ${PROJECT_BINARY_DIR}/apr_dbd_odbc-1.pdb) - SET(dbd_drivers ${dbd_drivers} odbc) -@@ -265,7 +265,7 @@ IF(APU_HAVE_ODBC) - ENDIF() - - IF(APR_HAS_LDAP) -- ADD_LIBRARY(apr_ldap-1 SHARED ldap/apr_ldap_init.c ldap/apr_ldap_option.c -+ ADD_LIBRARY(apr_ldap-1 ldap/apr_ldap_init.c ldap/apr_ldap_option.c - ldap/apr_ldap_rebind.c libaprutil.rc) - SET(install_targets ${install_targets} apr_ldap-1) - SET(install_bin_pdb ${install_bin_pdb} ${PROJECT_BINARY_DIR}/apr_ldap-1.pdb) diff --git a/recipes/apr-util/all/patches/0001-fix-cmake.patch b/recipes/apr-util/all/patches/0001-fix-cmake.patch new file mode 100644 index 0000000000000..0083d495d06dc --- /dev/null +++ b/recipes/apr-util/all/patches/0001-fix-cmake.patch @@ -0,0 +1,89 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -15,13 +15,13 @@ + # + # Read README.cmake before using this. + ++CMAKE_MINIMUM_REQUIRED(VERSION 3.1) + PROJECT(APR-Util C) + +-CMAKE_MINIMUM_REQUIRED(VERSION 2.8) + + FIND_PACKAGE(OpenSSL) + +-FIND_PACKAGE(expat) ++FIND_PACKAGE(EXPAT MODULE) + + OPTION(APU_HAVE_CRYPTO "Crypto support" OFF) + OPTION(APU_HAVE_ODBC "Build ODBC DBD driver" ON) +@@ -29,17 +29,14 @@ OPTION(APR_HAS_LDAP "LDAP support" ON) + OPTION(INSTALL_PDB "Install .pdb files (if generated)" ON) + OPTION(APR_BUILD_TESTAPR "Build the test suite" OFF) + OPTION(TEST_STATIC_LIBS "Test programs use APR static libraries instead of shared libraries?" OFF) +-SET(APR_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE STRING "Directory with APR include files") +-SET(APR_LIBRARIES "${CMAKE_INSTALL_PREFIX}/lib/libapr-1.lib" CACHE STRING "APR library to link with") ++find_package(apr REQUIRED CONFIG) ++if(NOT DEFINED APR_INCLUDE_DIR) ++ set(APR_INCLUDE_DIR apr_INCLUDE_DIRS) ++endif() ++if(NOT DEFINED APR_LIBRARIES) ++ set(APR_LIBRARIES apr::apr) ++endif() + +-IF(NOT EXISTS "${APR_INCLUDE_DIR}/apr.h") +- MESSAGE(FATAL_ERROR "APR include directory ${APR_INCLUDE_DIR} is not correct.") +-ENDIF() +-FOREACH(onelib ${APR_LIBRARIES}) +- IF(NOT EXISTS ${onelib}) +- MESSAGE(FATAL_ERROR "APR library ${onelib} was not found.") +- ENDIF() +-ENDFOREACH() + + IF(APU_HAVE_CRYPTO) + IF(NOT OPENSSL_FOUND) +@@ -228,23 +225,26 @@ SET(dbd_drivers) + + # Note: The WINNT definition on some targets is used only by libaprutil.rc. + ++if(BUILD_SHARED_LIBS) + # libaprutil-1 is shared, aprutil-1 is static + ADD_LIBRARY(libaprutil-1 SHARED ${APR_SOURCES} ${APR_PUBLIC_HEADERS_GENERATED} libaprutil.rc) + SET(install_targets ${install_targets} libaprutil-1) + SET(install_bin_pdb ${install_bin_pdb} ${PROJECT_BINARY_DIR}/libaprutil-1.pdb) + TARGET_LINK_LIBRARIES(libaprutil-1 ${APR_LIBRARIES} ${XMLLIB_LIBRARIES}) + SET_TARGET_PROPERTIES(libaprutil-1 PROPERTIES COMPILE_DEFINITIONS "APU_DECLARE_EXPORT;APR_DECLARE_EXPORT;XML_STATIC;WINNT") ++else() + + ADD_LIBRARY(aprutil-1 STATIC ${APR_SOURCES} ${APR_PUBLIC_HEADERS_GENERATED}) + SET(install_targets ${install_targets} aprutil-1) + TARGET_LINK_LIBRARIES(aprutil-1 ${APR_LIBRARIES} ${XMLLIB_LIBRARIES}) + SET_TARGET_PROPERTIES(aprutil-1 PROPERTIES COMPILE_DEFINITIONS "APU_DECLARE_STATIC;APR_DECLARE_STATIC;APU_DSO_MODULE_BUILD;XML_STATIC") ++endif() + + IF(APU_HAVE_CRYPTO) + IF(NOT OPENSSL_FOUND) + MESSAGE(FATAL_ERROR "Only OpenSSL-based crypto is currently implemented in the cmake build") + ENDIF() +- ADD_LIBRARY(apr_crypto_openssl-1 SHARED crypto/apr_crypto_openssl.c libaprutil.rc) ++ ADD_LIBRARY(apr_crypto_openssl-1 crypto/apr_crypto_openssl.c libaprutil.rc) + SET(install_targets ${install_targets} apr_crypto_openssl-1) + SET(install_bin_pdb ${install_bin_pdb} ${PROJECT_BINARY_DIR}/apr_crypto_openssl-1.pdb) + SET_TARGET_PROPERTIES(apr_crypto_openssl-1 PROPERTIES INCLUDE_DIRECTORIES "${APR_INCLUDE_DIRECTORIES};${OPENSSL_INCLUDE_DIR}") +@@ -254,7 +254,7 @@ IF(APU_HAVE_CRYPTO) + ENDIF() + + IF(APU_HAVE_ODBC) +- ADD_LIBRARY(apr_dbd_odbc-1 SHARED dbd/apr_dbd_odbc.c libaprutil.rc) ++ ADD_LIBRARY(apr_dbd_odbc-1 dbd/apr_dbd_odbc.c libaprutil.rc) + SET(install_targets ${install_targets} apr_dbd_odbc-1) + SET(install_bin_pdb ${install_bin_pdb} ${PROJECT_BINARY_DIR}/apr_dbd_odbc-1.pdb) + SET(dbd_drivers ${dbd_drivers} odbc) +@@ -265,7 +265,7 @@ IF(APU_HAVE_ODBC) + ENDIF() + + IF(APR_HAS_LDAP) +- ADD_LIBRARY(apr_ldap-1 SHARED ldap/apr_ldap_init.c ldap/apr_ldap_option.c ++ ADD_LIBRARY(apr_ldap-1 ldap/apr_ldap_init.c ldap/apr_ldap_option.c + ldap/apr_ldap_rebind.c libaprutil.rc) + SET(install_targets ${install_targets} apr_ldap-1) + SET(install_bin_pdb ${install_bin_pdb} ${PROJECT_BINARY_DIR}/apr_ldap-1.pdb) diff --git a/recipes/apr-util/all/patches/0003-disable-check-APR_LIBRARIES.patch b/recipes/apr-util/all/patches/0003-disable-check-APR_LIBRARIES.patch deleted file mode 100644 index 384b64b2544a7..0000000000000 --- a/recipes/apr-util/all/patches/0003-disable-check-APR_LIBRARIES.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -35,11 +35,11 @@ - IF(NOT EXISTS "${APR_INCLUDE_DIR}/apr.h") - MESSAGE(FATAL_ERROR "APR include directory ${APR_INCLUDE_DIR} is not correct.") - ENDIF() --FOREACH(onelib ${APR_LIBRARIES}) -- IF(NOT EXISTS ${onelib}) -- MESSAGE(FATAL_ERROR "APR library ${onelib} was not found.") -- ENDIF() --ENDFOREACH() -+SET(APR_LIBRARIES "${CONAN_LIBS_APR};mswsock;rpcrt4;ws2_32") #FOREACH(onelib ${APR_LIBRARIES}) -+# IF(NOT EXISTS ${onelib}) -+# MESSAGE(FATAL_ERROR "APR library ${onelib} was not found.") -+# ENDIF() -+#ENDFOREACH() - - IF(APU_HAVE_CRYPTO) - IF(NOT OPENSSL_FOUND) diff --git a/recipes/apr-util/all/test_package/CMakeLists.txt b/recipes/apr-util/all/test_package/CMakeLists.txt index f8b971e2db377..c273ab3463a77 100644 --- a/recipes/apr-util/all/test_package/CMakeLists.txt +++ b/recipes/apr-util/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-util REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE apr-util::apr-util) diff --git a/recipes/apr-util/all/test_package/conanfile.py b/recipes/apr-util/all/test_package/conanfile.py index 9952431a15adf..0a6bc68712d90 100644 --- a/recipes/apr-util/all/test_package/conanfile.py +++ b/recipes/apr-util/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" + 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,9 +21,6 @@ def build(self): cmake.build() def test(self): - if self.settings.compiler != "Visual Studio": - self.run("apu-1-config --ldflags", win_bash=tools.os_info.is_windows) - - 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/reactiveplusplus/all/test_v1_package/CMakeLists.txt b/recipes/apr-util/all/test_v1_package/CMakeLists.txt similarity index 100% rename from recipes/reactiveplusplus/all/test_v1_package/CMakeLists.txt rename to recipes/apr-util/all/test_v1_package/CMakeLists.txt diff --git a/recipes/mongo-c-driver/all/test_v1_package/conanfile.py b/recipes/apr-util/all/test_v1_package/conanfile.py similarity index 100% rename from recipes/mongo-c-driver/all/test_v1_package/conanfile.py rename to recipes/apr-util/all/test_v1_package/conanfile.py diff --git a/recipes/apr/all/conandata.yml b/recipes/apr/all/conandata.yml index 857d29070602e..6ce547b4ee2f4 100644 --- a/recipes/apr/all/conandata.yml +++ b/recipes/apr/all/conandata.yml @@ -1,13 +1,32 @@ sources: + "1.7.4": + url: "https://archive.apache.org/dist/apr/apr-1.7.4.tar.bz2" + sha256: "fc648de983f3a2a6c9e78dea1f180639bd2fad6c06d556d4367a701fe5c35577" "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.4": + - patch_file: "patches/1.7.4-0001-cmake-build-only-shared-static.patch" + patch_type: "conan" + patch_description: "Use BUILD_SHARED_LIBS to conditionally build static/dynamic libs" + - patch_file: "patches/1.7.0-0002-apr-config-prefix-env.patch" + patch_type: "conan" + patch_description: "Allow downtream recipes to detect some helpr build files of apr in a relocatalbe context" + - patch_file: "patches/1.7.0-0006-sys_siglist-fix.patch" + patch_type: "bugfix" + patch_description: "Replace deprecated sys_siglist[] with strsignal()" "1.7.0": - - 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" + - patch_file: "patches/1.7.0-0001-cmake-build-only-shared-static.patch" + patch_type: "conan" + patch_description: "Use BUILD_SHARED_LIBS to conditionally build static/dynamic libs" + - patch_file: "patches/1.7.0-0002-apr-config-prefix-env.patch" + patch_type: "conan" + patch_description: "Allow downtream recipes to detect some helpr build files of apr in a relocatalbe context" + - patch_file: "patches/1.7.0-0003-cmake-gen_test_char-use-target.patch" + - patch_file: "patches/1.7.0-0004-autotools-mingw.patch" + - patch_file: "patches/1.7.0-0005-clang12-apple.patch" + - patch_file: "patches/1.7.0-0006-sys_siglist-fix.patch" + patch_type: "bugfix" + patch_description: "Replace deprecated sys_siglist[] with strsignal()" + - patch_file: "patches/1.7.0-0007-cmake-minimum-required.patch" diff --git a/recipes/apr/all/conanfile.py b/recipes/apr/all/conanfile.py index ce8e901f10380..2f5b13dc054ed 100644 --- a/recipes/apr/all/conanfile.py +++ b/recipes/apr/all/conanfile.py @@ -1,3 +1,6 @@ +import os +import re + from conan import ConanFile from conan.errors import ConanException, ConanInvalidConfiguration from conan.tools.apple import fix_apple_shared_install_name @@ -7,12 +10,10 @@ 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 +from conan.tools.microsoft import is_msvc from conan.tools.scm import Version -import os -import re -required_conan_version = ">=1.53.0" +required_conan_version = ">=1.54.0" class AprConan(ConanFile): @@ -25,7 +26,7 @@ class AprConan(ConanFile): topics = ("apache", "platform", "library") homepage = "https://apr.apache.org/" url = "https://github.com/conan-io/conan-center-index" - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -67,9 +68,22 @@ def layout(self): else: basic_layout(self, src_folder="src") - def validate(self): - if hasattr(self, "settings_build") and cross_building(self): - raise ConanInvalidConfiguration("apr recipe doesn't support cross-build yet due to runtime checks") + def validate_build(self): + if cross_building(self) and not is_msvc(self): + msg = ("apr recipe doesn't support cross-build for all the platforms" + " due to runtime checks in autoconf. You can provide" + " a pre-built cached file as an user Conan conf variable to try it.\n\n" + "Via host profile:\n" + "[conf]\nuser.apr:cache_file=/path/to/cache_file\n\n" + "Via CLI: \n" + "-c \"user.apr:cache_file='/path/to/cache_file'\"") + # Cross-building for apr < 1.7.4 is not supported without a pre-built cached file + if Version(self.version) < "1.7.4" and self.conf.get("user.apr:cache_file") is None: + raise ConanInvalidConfiguration(msg) + # Conan provides for apr >= 1.7.4 and Linux some configuration flags to avoid + # entering a pre-built cached file + if self.settings.os != "Linux" and self.conf.get("user.apr:cache_file") is None: + raise ConanInvalidConfiguration(msg) def build_requirements(self): if not is_msvc(self): @@ -81,8 +95,48 @@ def build_requirements(self): self.tool_requires("msys2/cci.latest") 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 _get_cross_building_configure_args(self): + """ + The vast majority of projects that use autotools and make use of the AC_TRY_RUN macro, + do provide a default fallback when cross-compiling, as per the documentation here: + + * https://ftp.gnu.org/old-gnu/Manuals/autoconf-2.53/html_node/Test-Programs.html + + In that regard, APR cannot be cross-compiled by traditional means, and the only fallback + is to use a cache file. Indeed, the only way to cross-compile that is documented by upstream + is by pre-empting the configuration checks with a cache file that needs to be generated on + the target system: + + ./configure --cache-file={gnu_host_triplet}.cache + + The generated cache file can be repeatedly used to cross-compile to the targeted host system + by including it with the recipe data. + + This recipe is reading this custom user conf variable: + + [conf] + user.apr:cache_file=/path/to/{gnu_host_triplet}.cache + + So you can use it to cross-compile on your system. + """ + configure_args = [] + user_cache_file = self.conf.get("user.apr:cache_file", check_type=str) + if user_cache_file: + configure_args.append(f"--cache-file={user_cache_file}") + return configure_args + + self.output.warning("Trying to set some configuration arguments, but it" + " could fail. The best approach is to provide a" + " pre-built cached file.") + if self.settings.os == "Linux": + # Mandatory cross-building configuration flags (tested on Linux ARM and Intel) + configure_args.extend(["apr_cv_mutex_robust_shared=yes", + "ac_cv_file__dev_zero=yes", + "apr_cv_process_shared_works=yes", + "apr_cv_tcp_nodelay_with_cork=yes"]) + return configure_args def generate(self): if is_msvc(self): @@ -96,7 +150,7 @@ def generate(self): 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.configure_args.extend(self._get_cross_building_configure_args()) tc.generate() def _patch_sources(self): @@ -125,8 +179,7 @@ def package(self): cmake.install() else: 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)}"]) + 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")) diff --git a/recipes/apr/all/patches/0001-cmake-build-only-shared-static.patch b/recipes/apr/all/patches/1.7.0-0001-cmake-build-only-shared-static.patch similarity index 100% rename from recipes/apr/all/patches/0001-cmake-build-only-shared-static.patch rename to recipes/apr/all/patches/1.7.0-0001-cmake-build-only-shared-static.patch diff --git a/recipes/apr/all/patches/0002-apr-config-prefix-env.patch b/recipes/apr/all/patches/1.7.0-0002-apr-config-prefix-env.patch similarity index 100% rename from recipes/apr/all/patches/0002-apr-config-prefix-env.patch rename to recipes/apr/all/patches/1.7.0-0002-apr-config-prefix-env.patch diff --git a/recipes/apr/all/patches/0003-cmake-gen_test_char-use-target.patch b/recipes/apr/all/patches/1.7.0-0003-cmake-gen_test_char-use-target.patch similarity index 100% rename from recipes/apr/all/patches/0003-cmake-gen_test_char-use-target.patch rename to recipes/apr/all/patches/1.7.0-0003-cmake-gen_test_char-use-target.patch diff --git a/recipes/apr/all/patches/0004-autotools-mingw.patch b/recipes/apr/all/patches/1.7.0-0004-autotools-mingw.patch similarity index 100% rename from recipes/apr/all/patches/0004-autotools-mingw.patch rename to recipes/apr/all/patches/1.7.0-0004-autotools-mingw.patch diff --git a/recipes/apr/all/patches/0005-clang12-apple.patch b/recipes/apr/all/patches/1.7.0-0005-clang12-apple.patch similarity index 100% rename from recipes/apr/all/patches/0005-clang12-apple.patch rename to recipes/apr/all/patches/1.7.0-0005-clang12-apple.patch diff --git a/recipes/apr/all/patches/0006-sys_siglist-fix.patch b/recipes/apr/all/patches/1.7.0-0006-sys_siglist-fix.patch similarity index 100% rename from recipes/apr/all/patches/0006-sys_siglist-fix.patch rename to recipes/apr/all/patches/1.7.0-0006-sys_siglist-fix.patch diff --git a/recipes/apr/all/patches/0007-cmake-minimum-required.patch b/recipes/apr/all/patches/1.7.0-0007-cmake-minimum-required.patch similarity index 100% rename from recipes/apr/all/patches/0007-cmake-minimum-required.patch rename to recipes/apr/all/patches/1.7.0-0007-cmake-minimum-required.patch diff --git a/recipes/apr/all/patches/1.7.4-0001-cmake-build-only-shared-static.patch b/recipes/apr/all/patches/1.7.4-0001-cmake-build-only-shared-static.patch new file mode 100644 index 0000000000000..ea5a43d70f982 --- /dev/null +++ b/recipes/apr/all/patches/1.7.4-0001-cmake-build-only-shared-static.patch @@ -0,0 +1,33 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -261,26 +261,25 @@ SET(install_targets) + SET(install_bin_pdb) + + # libapr-1 is shared, apr-1 is static ++IF(BUILD_SHARED_LIBS) + ADD_LIBRARY(libapr-1 SHARED ${APR_SOURCES} ${APR_PUBLIC_HEADERS_GENERATED} libapr.rc) + SET(install_targets ${install_targets} libapr-1) + SET(install_bin_pdb ${install_bin_pdb} ${PROJECT_BINARY_DIR}/libapr-1.pdb) + TARGET_LINK_LIBRARIES(libapr-1 ${APR_SYSTEM_LIBS}) + SET_TARGET_PROPERTIES(libapr-1 PROPERTIES COMPILE_DEFINITIONS "APR_DECLARE_EXPORT;WINNT") + ADD_DEPENDENCIES(libapr-1 test_char_header) +- ++ELSE() + ADD_LIBRARY(apr-1 STATIC ${APR_SOURCES} ${APR_PUBLIC_HEADERS_GENERATED}) + SET(install_targets ${install_targets} apr-1) + TARGET_LINK_LIBRARIES(apr-1 ${APR_SYSTEM_LIBS}) + SET_TARGET_PROPERTIES(apr-1 PROPERTIES COMPILE_DEFINITIONS "APR_DECLARE_STATIC;WINNT") + ADD_DEPENDENCIES(apr-1 test_char_header) +- ++ENDIF() + # libaprapp-1 and aprapp-1 are static + ADD_LIBRARY(libaprapp-1 STATIC misc/win32/apr_app.c misc/win32/internal.c ${APR_PUBLIC_HEADERS_GENERATED}) +-SET(install_targets ${install_targets} libaprapp-1) + SET_TARGET_PROPERTIES(libaprapp-1 PROPERTIES COMPILE_DEFINITIONS "APR_APP;WINNT") + + ADD_LIBRARY(aprapp-1 STATIC misc/win32/apr_app.c misc/win32/internal.c ${APR_PUBLIC_HEADERS_GENERATED}) +-SET(install_targets ${install_targets} aprapp-1) + SET_TARGET_PROPERTIES(aprapp-1 PROPERTIES COMPILE_DEFINITIONS "APR_DECLARE_STATIC;APR_APP;WINNT") + + IF(APR_BUILD_TESTAPR) + diff --git a/recipes/apr/config.yml b/recipes/apr/config.yml index 0f57b11de8fb0..87d6549199fa1 100644 --- a/recipes/apr/config.yml +++ b/recipes/apr/config.yml @@ -1,3 +1,5 @@ versions: + "1.7.4": + folder: all "1.7.0": folder: all diff --git a/recipes/apriltag/all/CMakeLists.txt b/recipes/apriltag/all/CMakeLists.txt deleted file mode 100644 index 274835e74cb84..0000000000000 --- a/recipes/apriltag/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/apriltag/all/conandata.yml b/recipes/apriltag/all/conandata.yml index 9defb865f3be5..cdf1bd2eb180f 100644 --- a/recipes/apriltag/all/conandata.yml +++ b/recipes/apriltag/all/conandata.yml @@ -1,20 +1,13 @@ sources: + "3.4.2": + url: "https://github.com/AprilRobotics/apriltag/archive/refs/tags/v3.4.2.tar.gz" + sha256: "7e021bab89f136aa3cf736f772a635aaa353f93f6f8859495f4bd8c519be4805" "3.1.4": url: "https://github.com/AprilRobotics/apriltag/archive/refs/tags/v3.1.4.tar.gz" sha256: "ad2888d432e9ddcad2f639f243479934a4cd677ed5d2f8dee3b3418617b64f5d" - "3.1.2": - url: "https://github.com/AprilRobotics/apriltag/archive/3.1.2.tar.gz" - sha256: "2759b044ff1dc9ef725e7c456b49283399ef78deee24754bc3617cbe369584f1" - "3.1.1": - url: "https://github.com/AprilRobotics/apriltag/archive/3.1.1.tar.gz" - sha256: "7349e1fcc8b2979230b46c0d62ccf2ba2bbd611d87ef80cfd37ffe74425f5efb" patches: "3.1.4": - - patch_file: "patches/fix-cmake-3.1.4.patch" - base_path: "source_subfolder" - "3.1.2": - - patch_file: "patches/fix-cmake-3.1.2.patch" - base_path: "source_subfolder" - "3.1.1": - - patch_file: "patches/fix-cmake-3.1.1.patch" - base_path: "source_subfolder" + - patch_file: "patches/3.1.4-0001-disable-examples.patch" + patch_type: "conan" + patch_description: "Disable building of examples" + - patch_file: "patches/3.1.4-0002-fix-cmake.patch" diff --git a/recipes/apriltag/all/conanfile.py b/recipes/apriltag/all/conanfile.py index 27b7916fdd4a2..8c9220521508c 100644 --- a/recipes/apriltag/all/conanfile.py +++ b/recipes/apriltag/all/conanfile.py @@ -1,16 +1,24 @@ -from conans import ConanFile, tools, CMake -from conans.errors import ConanInvalidConfiguration +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, export_conandata_patches, get, rmdir +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version import os +required_conan_version = ">=1.54.0" + class ApriltagConan(ConanFile): name = "apriltag" - description = ("AprilTag is a visual fiducial system, useful for a wide variety of tasks \ - including augmented reality, robotics, and camera calibration") + description = ("AprilTag is a visual fiducial system, useful for a wide variety of tasks" + " including augmented reality, robotics, and camera calibration") homepage = "https://april.eecs.umich.edu/software/apriltag" - topics = ("conan", "apriltag", "robotics") + topics = ("robotics", "computer-vision", "augmented-reality", "camera-calibration") license = "BSD-2-Clause" 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], @@ -19,16 +27,9 @@ class ApriltagConan(ConanFile): "shared": False, "fPIC": True, } - settings = "os", "arch", "compiler", "build_type" - - generators = "cmake" - exports_sources = "CMakeLists.txt", "patches/*" - - _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,45 +37,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 + 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 Version(self.version) < "3.3.0": + self.requires("pthreads4w/3.0.0", transitive_headers=True) - def validate(self): - if self.settings.os != "Linux": - raise ConanInvalidConfiguration("Apriltag officially supported only on Linux") + def build_requirements(self): + if Version(self.version) >= "3.4.0": + self.tool_requires("cmake/[>=3.16 <4]") 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 _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.configure() - return self._cmake + def generate(self): + VirtualBuildEnv(self).generate() + tc = CMakeToolchain(self) + tc.cache_variables["BUILD_EXAMPLES"] = False + tc.variables["BUILD_PYTHON_WRAPPER"] = False + if Version(self.version) < "3.4.0": + # Newer versions set it in the project CMakelists.txt + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + if self.settings.os == "Windows": + tc.preprocessor_definitions["NOMINMAX"] = "" + tc.generate() + if is_msvc(self) and Version(self.version) < "3.3.0": + 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", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, "LICENSE.md", self.source_folder, 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, "bin")) + 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["cmake_find_package"] = "apriltag" - self.cpp_info.names["cmake_find_package_multi"] = "apriltag" - - self.cpp_info.libs = ["apriltag"] - if self.settings.os == "Linux": + self.cpp_info.set_property("cmake_file_name", "apriltag") + self.cpp_info.set_property("cmake_target_name", "apriltag::apriltag") + self.cpp_info.set_property("pkg_config_name", "apriltag") + suffix = "" + if self.settings.build_type == "Debug" and Version(self.version) >= "3.2.0": + suffix = "d" + self.cpp_info.libs = ["apriltag" + suffix] + self.cpp_info.includedirs.append(os.path.join("include", "apriltag")) + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["m", "pthread"] - self.cpp_info.includedirs.append(os.path.join("include","apriltag")) + elif self.settings.os == "Windows": + self.cpp_info.system_libs = ["winmm"] + self.cpp_info.defines.append("NOMINMAX") diff --git a/recipes/apriltag/all/patches/3.1.4-0001-disable-examples.patch b/recipes/apriltag/all/patches/3.1.4-0001-disable-examples.patch new file mode 100644 index 0000000000000..a3696589cece2 --- /dev/null +++ b/recipes/apriltag/all/patches/3.1.4-0001-disable-examples.patch @@ -0,0 +1,15 @@ +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -101,6 +101,7 @@ + + + # Examples ++if(BUILD_EXAMPLES) + # apriltag_demo + add_executable(apriltag_demo example/apriltag_demo.c) + target_link_libraries(apriltag_demo apriltag) +@@ -115,3 +116,4 @@ + + # install example programs + install(TARGETS apriltag_demo RUNTIME DESTINATION bin) ++endif() diff --git a/recipes/apriltag/all/patches/3.1.4-0002-fix-cmake.patch b/recipes/apriltag/all/patches/3.1.4-0002-fix-cmake.patch new file mode 100644 index 0000000000000..7baec487b4ea0 --- /dev/null +++ b/recipes/apriltag/all/patches/3.1.4-0002-fix-cmake.patch @@ -0,0 +1,50 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,26 +1,31 @@ +-cmake_minimum_required(VERSION 3.1) +-project(apriltag) ++cmake_minimum_required(VERSION 3.15) ++project(apriltag LANGUAGES C) + +-find_package(OpenCV QUIET) + + include_directories(.) + aux_source_directory(common COMMON_SRC) + set(APRILTAG_SRCS apriltag.c apriltag_pose.c apriltag_quad_thresh.c) + +-set(CMAKE_BUILD_TYPE Release) + + # Library + file(GLOB TAG_FILES ${PROJECT_SOURCE_DIR}/tag*.c) + set_source_files_properties(SOURCE ${TAG_FILES} PROPERTIES COMPILE_FLAGS -O0) +-add_library(${PROJECT_NAME} SHARED ${APRILTAG_SRCS} ${COMMON_SRC} ${TAG_FILES}) ++add_library(${PROJECT_NAME} ${APRILTAG_SRCS} ${COMMON_SRC} ${TAG_FILES}) ++target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) + if (MSVC) + # FindThreads will not find pthread.h with MSVC + # winmm is necessary for __imp_timeGetTime +- find_library(PTHREAD_LIBRARIES NAMES pthreads) +- target_link_libraries(${PROJECT_NAME} ${PTHREAD_LIBRARIES} winmm) ++ find_package(pthreads4w REQUIRED CONFIG) ++ target_link_libraries(${PROJECT_NAME} pthreads4w::pthreads4w winmm) ++ target_compile_definitions(${PROJECT_NAME} PRIVATE _CRT_SECURE_NO_WARNINGS) + else() + find_package(Threads REQUIRED) +- target_link_libraries(${PROJECT_NAME} PUBLIC Threads::Threads m) ++ target_link_libraries(${PROJECT_NAME} Threads::Threads) ++ include(CheckFunctionExists) ++ check_function_exists(pow HAVE_MATH_SYSTEM) ++ if(NOT HAVE_MATH_SYSTEM) ++ target_link_libraries(${PROJECT_NAME} m) ++ endif() + endif() + + set_target_properties(${PROJECT_NAME} PROPERTIES SOVERSION 3 VERSION 3.1.0) +@@ -35,6 +30,7 @@ + install(TARGETS ${PROJECT_NAME} EXPORT apriltagTargets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ) + + # install header file hierarchy diff --git a/recipes/apriltag/all/patches/fix-cmake-3.1.1.patch b/recipes/apriltag/all/patches/fix-cmake-3.1.1.patch deleted file mode 100644 index 7936b47c2a56a..0000000000000 --- a/recipes/apriltag/all/patches/fix-cmake-3.1.1.patch +++ /dev/null @@ -1,57 +0,0 @@ ---- CMakeLists.txt 2019-06-13 20:21:58.000000000 -0300 -+++ CMakeLists_fix.txt 2020-07-08 17:02:58.847505066 -0300 -@@ -1,8 +1,6 @@ - cmake_minimum_required(VERSION 3.1) - project(apriltag) - --find_package(OpenCV QUIET) -- - include_directories(.) - aux_source_directory(common COMMON_SRC) - aux_source_directory(. APRILTAG_SRCS) -@@ -10,7 +8,8 @@ --set(CMAKE_BUILD_TYPE Release) -+#set(CMAKE_BUILD_TYPE Release) - - # Library --add_library(${PROJECT_NAME} SHARED ${APRILTAG_SRCS} ${COMMON_SRC}) -+add_library(${PROJECT_NAME} ${APRILTAG_SRCS} ${COMMON_SRC}) -+set_target_properties(${PROJECT_NAME} PROPERTIES C_STANDARD 99) - if (MSVC) - # FindThreads will not find pthread.h with MSVC - # winmm is necessary for __imp_timeGetTime -@@ -34,7 +33,7 @@ - LIBRARY_OUTPUT_DIRECTORY ${CMAKE_INSTALL_LIBDIR} - ) - --file(GLOB TAG_FILES ${CMAKE_SOURCE_DIR}/tag*.c) -+file(GLOB TAG_FILES ${CMAKE_CURRENT_SOURCE_DIR}/tag*.c) - set_source_files_properties(SOURCE ${TAG_FILES} PROPERTIES COMPILE_FLAGS -O0) - - # install library -@@ -44,7 +43,7 @@ - ) - - # install header file hierarchy --file(GLOB_RECURSE HEADER_FILES RELATIVE ${CMAKE_SOURCE_DIR} *.h) -+file(GLOB_RECURSE HEADER_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.h) - foreach(HEADER ${HEADER_FILES}) - string(REGEX MATCH "(.*)[/\\]" DIR ${HEADER}) - install(FILES ${HEADER} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}/${DIR}) -@@ -64,15 +63,9 @@ - # Examples - # apriltag_demo - add_executable(apriltag_demo example/apriltag_demo.c) -+set_target_properties(apriltag_demo PROPERTIES C_STANDARD 99) - target_link_libraries(apriltag_demo apriltag) - --# opencv_demo --if(OpenCV_FOUND) -- add_executable(opencv_demo example/opencv_demo.cc) -- target_link_libraries(opencv_demo apriltag ${OpenCV_LIBRARIES}) -- install(TARGETS opencv_demo RUNTIME DESTINATION bin) --endif(OpenCV_FOUND) -- - # install example programs - install(TARGETS apriltag_demo RUNTIME DESTINATION bin) - diff --git a/recipes/apriltag/all/patches/fix-cmake-3.1.2.patch b/recipes/apriltag/all/patches/fix-cmake-3.1.2.patch deleted file mode 100644 index 15f084446a276..0000000000000 --- a/recipes/apriltag/all/patches/fix-cmake-3.1.2.patch +++ /dev/null @@ -1,54 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index c733c6c..540c38e 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -1,8 +1,6 @@ - cmake_minimum_required(VERSION 3.1) - project(apriltag) - --find_package(OpenCV QUIET) -- - include_directories(.) - aux_source_directory(common COMMON_SRC) - set(APRILTAG_SRCS apriltag.c apriltag_pose.c apriltag_quad_thresh.c) -@@ -10,9 +8,10 @@ set(APRILTAG_SRCS apriltag.c apriltag_pose.c apriltag_quad_thresh.c) --set(CMAKE_BUILD_TYPE Release) -+#set(CMAKE_BUILD_TYPE Release) - - # Library --file(GLOB TAG_FILES ${CMAKE_SOURCE_DIR}/tag*.c) -+file(GLOB TAG_FILES ${CMAKE_CURRENT_SOURCE_DIR}/tag*.c) - set_source_files_properties(SOURCE ${TAG_FILES} PROPERTIES COMPILE_FLAGS -O0) --add_library(${PROJECT_NAME} SHARED ${APRILTAG_SRCS} ${COMMON_SRC} ${TAG_FILES}) -+add_library(${PROJECT_NAME} ${APRILTAG_SRCS} ${COMMON_SRC} ${TAG_FILES}) -+set_target_properties(${PROJECT_NAME} PROPERTIES C_STANDARD 99) - if (MSVC) - # FindThreads will not find pthread.h with MSVC - # winmm is necessary for __imp_timeGetTime -@@ -44,7 +43,7 @@ install(TARGETS ${PROJECT_NAME} EXPORT apriltag - ) - - # install header file hierarchy --file(GLOB_RECURSE HEADER_FILES RELATIVE ${CMAKE_SOURCE_DIR} *.h) -+file(GLOB_RECURSE HEADER_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.h) - foreach(HEADER ${HEADER_FILES}) - string(REGEX MATCH "(.*)[/\\]" DIR ${HEADER}) - install(FILES ${HEADER} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}/${DIR}) -@@ -100,16 +99,9 @@ endif (NOT Python3_NOT_FOUND AND NOT Numpy_NOT_FOUND AND PYTHONLIBS_FOUND) - # Examples - # apriltag_demo - add_executable(apriltag_demo example/apriltag_demo.c) -+set_target_properties(apriltag_demo PROPERTIES C_STANDARD 99) - target_link_libraries(apriltag_demo apriltag) - --# opencv_demo --if(OpenCV_FOUND) -- add_executable(opencv_demo example/opencv_demo.cc) -- target_link_libraries(opencv_demo apriltag ${OpenCV_LIBRARIES}) -- set_target_properties(opencv_demo PROPERTIES CXX_STANDARD 11) -- install(TARGETS opencv_demo RUNTIME DESTINATION bin) --endif(OpenCV_FOUND) -- - # install example programs - install(TARGETS apriltag_demo RUNTIME DESTINATION bin) - diff --git a/recipes/apriltag/all/patches/fix-cmake-3.1.4.patch b/recipes/apriltag/all/patches/fix-cmake-3.1.4.patch deleted file mode 100644 index 9a916a9d74403..0000000000000 --- a/recipes/apriltag/all/patches/fix-cmake-3.1.4.patch +++ /dev/null @@ -1,43 +0,0 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -1,7 +1,7 @@ - cmake_minimum_required(VERSION 3.1) - project(apriltag) - --find_package(OpenCV QUIET) -+#find_package(OpenCV QUIET) - - include_directories(.) - aux_source_directory(common COMMON_SRC) -@@ -10,9 +10,9 @@ --set(CMAKE_BUILD_TYPE Release) -+#set(CMAKE_BUILD_TYPE Release) -- - # Library - file(GLOB TAG_FILES ${PROJECT_SOURCE_DIR}/tag*.c) - set_source_files_properties(SOURCE ${TAG_FILES} PROPERTIES COMPILE_FLAGS -O0) --add_library(${PROJECT_NAME} SHARED ${APRILTAG_SRCS} ${COMMON_SRC} ${TAG_FILES}) -+add_library(${PROJECT_NAME} ${APRILTAG_SRCS} ${COMMON_SRC} ${TAG_FILES}) -+set_target_properties(${PROJECT_NAME} PROPERTIES C_STANDARD 99) - if (MSVC) - # FindThreads will not find pthread.h with MSVC - # winmm is necessary for __imp_timeGetTime -@@ -103,4 +103,4 @@ - # Examples --# apriltag_demo - add_executable(apriltag_demo example/apriltag_demo.c) -+set_target_properties(apriltag_demo PROPERTIES C_STANDARD 99) - target_link_libraries(apriltag_demo apriltag) -@@ -108,10 +108,10 @@ --# opencv_demo -+if(0) - if(OpenCV_FOUND) - add_executable(opencv_demo example/opencv_demo.cc) - target_link_libraries(opencv_demo apriltag ${OpenCV_LIBRARIES}) - set_target_properties(opencv_demo PROPERTIES CXX_STANDARD 11) - install(TARGETS opencv_demo RUNTIME DESTINATION bin) - endif(OpenCV_FOUND) -- -+endif() - # install example programs - install(TARGETS apriltag_demo RUNTIME DESTINATION bin) diff --git a/recipes/apriltag/all/test_package/CMakeLists.txt b/recipes/apriltag/all/test_package/CMakeLists.txt index bb399b07277ef..61df950dde2ef 100644 --- a/recipes/apriltag/all/test_package/CMakeLists.txt +++ b/recipes/apriltag/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package CXX) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +find_package(apriltag REQUIRED CONFIG) -find_package(apriltag REQUIRED MODULE) - -add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} apriltag::apriltag) +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE apriltag::apriltag) diff --git a/recipes/apriltag/all/test_package/conanfile.py b/recipes/apriltag/all/test_package/conanfile.py index abcc73138d2ae..98ab55852ad56 100644 --- a/recipes/apriltag/all/test_package/conanfile.py +++ b/recipes/apriltag/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 apriltagTestConan(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 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/apriltag/all/test_package/test_package.c b/recipes/apriltag/all/test_package/test_package.c new file mode 100644 index 0000000000000..78f28e3f94542 --- /dev/null +++ b/recipes/apriltag/all/test_package/test_package.c @@ -0,0 +1,19 @@ +#include +#include +#include + +#include + +int main(int argc, char *argv[]) +{ + apriltag_detector_t *td = apriltag_detector_create(); + apriltag_family_t *tf = tagStandard41h12_create(); + apriltag_detector_add_family(td, tf); + + apriltag_detector_destroy(td); + tagStandard41h12_destroy(tf); + + printf("Apriltag test_package ran successfully\n"); + + return 0; +} diff --git a/recipes/apriltag/all/test_package/test_package.cpp b/recipes/apriltag/all/test_package/test_package.cpp deleted file mode 100644 index 97ea9336f6361..0000000000000 --- a/recipes/apriltag/all/test_package/test_package.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include -#include "apriltag.h" -#include "tagStandard41h12.h" -#include "common/image_u8.h" - -int main(int argc, char *argv[]) -{ - apriltag_detector_t *td = apriltag_detector_create(); - apriltag_family_t *tf = tagStandard41h12_create(); - apriltag_detector_add_family(td, tf); - - tagStandard41h12_destroy(tf); - apriltag_detector_destroy(td); - - std::cout << "Apriltag test_package ran successfully" << std::endl; - - return 0; -} diff --git a/recipes/spdlog/all/test_v1_package/CMakeLists.txt b/recipes/apriltag/all/test_v1_package/CMakeLists.txt similarity index 100% rename from recipes/spdlog/all/test_v1_package/CMakeLists.txt rename to recipes/apriltag/all/test_v1_package/CMakeLists.txt diff --git a/recipes/oatpp-openssl/all/test_v1_package/conanfile.py b/recipes/apriltag/all/test_v1_package/conanfile.py similarity index 100% rename from recipes/oatpp-openssl/all/test_v1_package/conanfile.py rename to recipes/apriltag/all/test_v1_package/conanfile.py diff --git a/recipes/apriltag/config.yml b/recipes/apriltag/config.yml index 6aa1925bfcd8e..0471f5090e86a 100644 --- a/recipes/apriltag/config.yml +++ b/recipes/apriltag/config.yml @@ -1,7 +1,5 @@ versions: - "3.1.4": - folder: all - "3.1.2": + "3.4.2": folder: all - "3.1.1": + "3.1.4": folder: all diff --git a/recipes/aravis/all/conandata.yml b/recipes/aravis/all/conandata.yml index 3dad42682b77d..07eea0a5354b4 100644 --- a/recipes/aravis/all/conandata.yml +++ b/recipes/aravis/all/conandata.yml @@ -1,8 +1,26 @@ sources: - "0.8.20": - url: "https://github.com/AravisProject/aravis/releases/download/0.8.20/aravis-0.8.20.tar.xz" - sha256: "0c0eb5a76109f29180c09c7e6a23fd403633bf22bbe8468a0ae44995c4449f46" + "0.8.33": + url: "https://github.com/AravisProject/aravis/releases/download/0.8.33/aravis-0.8.33.tar.xz" + sha256: "3c4409a12ea70bba4de25e5b08c777112de854bc801896594f2cb6f8c2bd6fbc" + "0.8.30": + url: "https://github.com/AravisProject/aravis/releases/download/0.8.30/aravis-0.8.30.tar.xz" + sha256: "40380f06fa04524a7875bd456e5a5ea78b2c058fa84b5598bc6e0642fcef00b0" + "0.8.29": + url: "https://github.com/AravisProject/aravis/releases/download/0.8.29/aravis-0.8.29.tar.xz" + sha256: "12e5f2f0e1a966c3a6dce0a42d96b2f24497f42ae6051d6f026811124e986963" + "0.8.25": # latest version that supports GenDC data format (supported by U3V 1.1) + url: "https://github.com/AravisProject/aravis/releases/download/0.8.25/aravis-0.8.25.tar.xz" + sha256: "3ba18f941ae4e2c898fed1f63c4ce67ea41a800a902ee5684eef4ffdb87f1c09" patches: - "0.8.20": - - patch_file: "patches/0.8.19-gst-shared-lib.patch" - base_path: "source_subfolder" + "0.8.30": + - patch_file: "patches/0.8.29-gst-shared-lib.patch" + patch_description: "remove forcing of shared library built for gst-plugins" + patch_type: conan + "0.8.29": + - patch_file: "patches/0.8.29-gst-shared-lib.patch" + patch_description: "remove forcing of shared library built for gst-plugins" + patch_type: conan + "0.8.25": + - patch_file: "patches/0.8.25-gst-shared-lib.patch" + patch_description: "remove forcing of shared library built for gst-plugins" + patch_type: conan diff --git a/recipes/aravis/all/conanfile.py b/recipes/aravis/all/conanfile.py index 3e8bc058b7f3a..1b412478f26e7 100644 --- a/recipes/aravis/all/conanfile.py +++ b/recipes/aravis/all/conanfile.py @@ -1,21 +1,30 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.files import get, export_conandata_patches, apply_conandata_patches, rename, chdir, rm, rmdir -from conan.tools.microsoft import is_msvc -from conans import Meson, RunEnvironment, tools +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, 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.52.0" +required_conan_version = ">=1.56.0 <2 || >=2.0.6" + class AravisConan(ConanFile): name = "aravis" + description = "A vision library for genicam based cameras." license = "LGPL-2.1-or-later" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/AravisProject/aravis" - description = "A vision library for genicam based cameras." topics = ("usb", "camera") - settings = "os", "compiler", "build_type", "arch" + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -23,7 +32,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, @@ -32,88 +41,92 @@ 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]) + 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": + if self.settings.os not in ["Linux", "FreeBSD"]: del self.options.packet_socket def configure(self): if self.options.shared: - del self.options.fPIC - self.options["glib"].shared = True - - def validate(self): - if is_msvc(self) 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.63.3") - self.build_requires("pkgconf/1.9.3") - if self.options.introspection: - self.build_requires("gobject-introspection/1.72.0") + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - self.requires("glib/2.74.0") - self.requires("libxml2/2.9.14") - self.requires("zlib/1.2.12") + # glib-object.h and gio/gio.h are used in several public headers + self.requires("glib/2.78.3", transitive_headers=True) + self.requires("libxml2/[>=2.12.5 <3]") + self.requires("zlib/[>=1.2.11 <2]") + if self.options.usb: self.requires("libusb/1.0.26") if self.options.gst_plugin: - self.requires("gstreamer/1.19.2") + self.requires("gstreamer/1.22.3") self.requires("gst-plugins-base/1.19.2") - def export_sources(self): - export_conandata_patches(self) + 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 is_apple_os(self) 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): + #windows build: meson/1.2.1 works, meson/1.2.2 breaks for some reason! + self.tool_requires("meson/1.4.0") + self.tool_requires("glib/") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/2.1.0") + if self.options.introspection: + self.tool_requires("gobject-introspection/1.72.0") def source(self): - get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) - - 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" + tc.project_options["fast-heartbeat"] = False 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): apply_conandata_patches(self) - with tools.environment_append(RunEnvironment(self).vars): - meson = self._configure_meson() - meson.build() + meson = Meson(self) + meson.configure() + meson.build() def _fix_library_names(self, path): # https://github.com/mesonbuild/meson/issues/1412 @@ -125,11 +138,9 @@ def _fix_library_names(self, path): 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")) @@ -137,28 +148,24 @@ def package(self): rm(self, "*.pdb", self.package_folder, recursive=True) if not self.options.tools: rm(self, "arv-*", os.path.join(self.package_folder, "bin")) - - 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() + fix_apple_shared_install_name(self) def package_info(self): - aravis_name = f"aravis-{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(f"Appending PATH environment variable: {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(f"Appending GST_PLUGIN_PATH env var: {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/patches/0.8.19-gst-shared-lib.patch b/recipes/aravis/all/patches/0.8.19-gst-shared-lib.patch deleted file mode 100644 index fec845831e656..0000000000000 --- a/recipes/aravis/all/patches/0.8.19-gst-shared-lib.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/gst/meson.build -+++ b/gst/meson.build -@@ -15,7 +15,7 @@ gst_c_args = [ - - gst_plugin_filename = 'gstaravis.@0@'.format (aravis_api_version) - --gst_plugin = shared_library (gst_plugin_filename, -+gst_plugin = library (gst_plugin_filename, - gst_sources, gst_headers, - name_suffix: [], - link_with: aravis_library, diff --git a/recipes/aravis/all/patches/0.8.25-gst-shared-lib.patch b/recipes/aravis/all/patches/0.8.25-gst-shared-lib.patch new file mode 100644 index 0000000000000..c4bdecffb39f1 --- /dev/null +++ b/recipes/aravis/all/patches/0.8.25-gst-shared-lib.patch @@ -0,0 +1,11 @@ +--- a/gst/meson.build 2023-10-03 14:55:30.481822400 -0700 ++++ b/gst/meson.build 2023-10-03 14:56:40.939480100 -0700 +@@ -17,7 +17,7 @@ + + gst_plugin_filename = 'gstaravis.@0@'.format (aravis_api_version) + +-gst_plugin = shared_library (gst_plugin_filename, ++gst_plugin = library (gst_plugin_filename, + gst_sources, gst_headers, + name_suffix: [], + link_with: aravis_library, diff --git a/recipes/aravis/all/patches/0.8.29-gst-shared-lib.patch b/recipes/aravis/all/patches/0.8.29-gst-shared-lib.patch new file mode 100644 index 0000000000000..3b6fa48c98a4e --- /dev/null +++ b/recipes/aravis/all/patches/0.8.29-gst-shared-lib.patch @@ -0,0 +1,13 @@ +Index: src/gst/meson.build +=================================================================== +--- a/gst/meson.build 2023-10-04 20:46:34.452887470 +0100 ++++ b/gst/meson.build 2023-10-04 20:46:34.441887164 +0100 +@@ -17,7 +17,7 @@ + + gst_plugin_filename = 'gstaravis.@0@'.format (aravis_api_version) + +-gst_plugin = shared_library (gst_plugin_filename, ++gst_plugin = library (gst_plugin_filename, + gst_sources, gst_headers, + name_suffix: [], + link_with: aravis_library, diff --git a/recipes/aravis/all/test_package/CMakeLists.txt b/recipes/aravis/all/test_package/CMakeLists.txt index f6a87ca17276f..f8a36c47767ce 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) +cmake_minimum_required(VERSION 3.15) 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_package/test_package.c b/recipes/aravis/all/test_package/test_package.c index 9a63b9ea3a864..762afa0db71a7 100644 --- a/recipes/aravis/all/test_package/test_package.c +++ b/recipes/aravis/all/test_package/test_package.c @@ -1,9 +1,8 @@ #include -#include #include +#include -int main(int argc, char **argv) -{ +int main() { printf("Enumerating Aravis interfaces:\n"); unsigned int if_count = arv_get_n_interfaces(); for (unsigned int if_index = 0; if_index < if_count; if_index++) { 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..91630d79f4abb --- /dev/null +++ b/recipes/aravis/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/objectbox/all/test_package/conanfile.py b/recipes/aravis/all/test_v1_package/conanfile.py similarity index 100% rename from recipes/objectbox/all/test_package/conanfile.py rename to recipes/aravis/all/test_v1_package/conanfile.py diff --git a/recipes/aravis/config.yml b/recipes/aravis/config.yml index a7431a882c8d4..456a2949d4232 100644 --- a/recipes/aravis/config.yml +++ b/recipes/aravis/config.yml @@ -1,3 +1,10 @@ versions: - "0.8.20": + "0.8.33": + folder: all + "0.8.30": + folder: all + "0.8.29": + folder: all + # 0.8.25 is the last version to support GenDC data format + "0.8.25": folder: all 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..2cdfa85c58927 --- /dev/null +++ b/recipes/archicad-apidevkit/all/conanfile.py @@ -0,0 +1,71 @@ +from conan import ConanFile +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout +from conan.tools.microsoft import check_min_vs, is_msvc +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" + topics = ("api", "archicad", "development", "pre-built") + + package_type = "application" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + 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 + + 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.") + + 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/conandata.yml b/recipes/arcus/all/conandata.yml index beb6b4ed8bb02..688b758b7cf3c 100644 --- a/recipes/arcus/all/conandata.yml +++ b/recipes/arcus/all/conandata.yml @@ -5,3 +5,6 @@ sources: 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 10256ef37f251..38ae3416bb350 100644 --- a/recipes/arcus/all/conanfile.py +++ b/recipes/arcus/all/conanfile.py @@ -6,7 +6,7 @@ import os import textwrap -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class ArcusConan(ConanFile): @@ -15,15 +15,15 @@ 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 = ("protobuf", "socket", "cura") - homepage = "https://github.com/Ultimaker/libArcus" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/Ultimaker/libArcus" + topics = ("protobuf", "socket", "cura") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], - } default_options = { "shared": False, @@ -39,24 +39,20 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + 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.12") def validate(self): - if self.info.settings.compiler.get_safe("cppstd"): + 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) @@ -107,7 +103,7 @@ def package_info(self): 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") 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_v1_package/CMakeLists.txt b/recipes/arcus/all/test_v1_package/CMakeLists.txt index 5b257f71e6bdc..91630d79f4abb 100644 --- a/recipes/arcus/all/test_v1_package/CMakeLists.txt +++ b/recipes/arcus/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.15) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(Arcus REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE Arcus) -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/arduinojson/all/conandata.yml b/recipes/arduinojson/all/conandata.yml index a9b0f2df8490a..83b7c3024a58d 100644 --- a/recipes/arduinojson/all/conandata.yml +++ b/recipes/arduinojson/all/conandata.yml @@ -1,13 +1,19 @@ sources: + "7.0.1": + url: "https://github.com/bblanchon/ArduinoJson/archive/refs/tags/v7.0.1.tar.gz" + sha256: "85fd778a6aae9b1a249b4c090c6f8621c9c8ceaf9479a3cb07e3033325bf2ae2" + "6.21.4": + url: "https://github.com/bblanchon/ArduinoJson/releases/download/v6.21.4/ArduinoJson-v6.21.4.zip" + sha256: "60a5c4cd28d97047f63a1f9c9e8bd36a72c8b4c86809babcc2bd4b00e0502b9b" + "6.20.1": + url: "https://github.com/bblanchon/ArduinoJson/releases/download/v6.20.1/ArduinoJson-v6.20.1.zip" + sha256: "3dc53f55dcb6913b9a097263852ddc7c030f6d93c8cf00efb5d0eff3dd4bd8b9" "6.19.4": - url: "https://github.com/bblanchon/ArduinoJson/archive/v6.19.4.tar.gz" - sha256: "d8ceaf89b290b8109aa8eb200cf7e377c076241b25c4e9d1a601ecd74a37395b" + url: "https://github.com/bblanchon/ArduinoJson/releases/download/v6.19.4/ArduinoJson-v6.19.4.zip" + sha256: "5d1d778a438efd298d9e378e086e1ccf7b01903315ffc8a68ec31b98d6cb3039" "6.18.5": - url: "https://github.com/bblanchon/ArduinoJson/archive/v6.18.5.tar.gz" - sha256: "57125b93c03c343055dbdcff874c8bfc78beb4a124097b37b69ec49120a5f359" - "6.18.0": - url: "https://github.com/bblanchon/ArduinoJson/releases/download/v6.18.0/ArduinoJson-v6.18.0.zip" - sha256: "2ade6a0097845d6bc0292a7f9ffa58cbd7e11a34a26616ac9e40a7754a18f1a9" + url: "https://github.com/bblanchon/ArduinoJson/releases/download/v6.18.5/ArduinoJson-v6.18.5.zip" + sha256: "f10a904fa1f6372ee069ed2a5eff50530a29e9c10958a5bd24ce62eda7f7d74e" "6.16.1": url: "https://github.com/bblanchon/ArduinoJson/releases/download/v6.16.1/ArduinoJson-v6.16.1.zip" sha256: "d8cab18d50a9487766e195c68c14a552403994ecae3e5051d509e62914444ecd" diff --git a/recipes/arduinojson/all/conanfile.py b/recipes/arduinojson/all/conanfile.py index 65c63794d59f1..ea98680d446ff 100644 --- a/recipes/arduinojson/all/conanfile.py +++ b/recipes/arduinojson/all/conanfile.py @@ -1,6 +1,8 @@ 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 +from conan.tools.scm import Version import os import textwrap @@ -11,21 +13,30 @@ class ArduinojsonConan(ConanFile): name = "arduinojson" description = "C++ JSON library for IoT. Simple and efficient." homepage = "https://github.com/bblanchon/ArduinoJson" - topics = ("json", "arduino", "iot", "embedded", "esp8266") + topics = ("json", "msgpack", "message-pack", "arduino", "iot", "embedded", "esp8266") license = "MIT" url = "https://github.com/conan-io/conan-center-index" + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True - def package_id(self): - self.info.clear() + @property + def _min_cppstd(self): + return "98" if Version(self.version) < "6.21.0" else "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) + has_arduinojson_root = not ("6.18.2" <= Version(self.version) < "7.0") + get(self, **self.conan_data["sources"][self.version], strip_root=has_arduinojson_root) def build(self): pass @@ -60,9 +71,7 @@ def package_info(self): self.cpp_info.set_property("cmake_file_name", "ArduinoJson") self.cpp_info.set_property("cmake_target_name", "ArduinoJson") 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"] = "ArduinoJson" diff --git a/recipes/arduinojson/all/test_package/CMakeLists.txt b/recipes/arduinojson/all/test_package/CMakeLists.txt index d206236f0971b..759822ccd5496 100644 --- a/recipes/arduinojson/all/test_package/CMakeLists.txt +++ b/recipes/arduinojson/all/test_package/CMakeLists.txt @@ -1,7 +1,10 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.8) project(test_package LANGUAGES CXX) find_package(ArduinoJson REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE ArduinoJson) +if(ArduinoJson_VERSION VERSION_GREATER_EQUAL "6.21.0") + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +endif() diff --git a/recipes/arduinojson/all/test_package/conanfile.py b/recipes/arduinojson/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/arduinojson/all/test_package/conanfile.py +++ b/recipes/arduinojson/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/arduinojson/all/test_package/test_package.cpp b/recipes/arduinojson/all/test_package/test_package.cpp index 6f3e5bade6926..240a2c8d2ba60 100644 --- a/recipes/arduinojson/all/test_package/test_package.cpp +++ b/recipes/arduinojson/all/test_package/test_package.cpp @@ -9,7 +9,7 @@ int main(void) deserializeJson(doc, json); - const char* sensor = doc["sensor"].as(); + const char* sensor = doc["sensor"].as(); int time = doc["time"].as(); double latitude = doc["data"][0].as(); double longitude = doc["data"][1].as(); diff --git a/recipes/arduinojson/all/test_v1_package/CMakeLists.txt b/recipes/arduinojson/all/test_v1_package/CMakeLists.txt index 7e433826ed298..0d20897301b68 100644 --- a/recipes/arduinojson/all/test_v1_package/CMakeLists.txt +++ b/recipes/arduinojson/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(ArduinoJson REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE ArduinoJson) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/arduinojson/config.yml b/recipes/arduinojson/config.yml index 7b1d7418387a3..b6153cf1cddb2 100644 --- a/recipes/arduinojson/config.yml +++ b/recipes/arduinojson/config.yml @@ -1,10 +1,14 @@ versions: + "7.0.1": + folder: all + "6.21.4": + folder: all + "6.20.1": + folder: all "6.19.4": folder: all "6.18.5": folder: all - "6.18.0": - folder: all "6.16.1": folder: all "6.15.2": diff --git a/recipes/arg_router/all/conandata.yml b/recipes/arg_router/all/conandata.yml new file mode 100644 index 0000000000000..6908e33d995b8 --- /dev/null +++ b/recipes/arg_router/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.3.0": + url: "https://github.com/cmannett85/arg_router/archive/refs/tags/v1.3.0.tar.gz" + sha256: "4ef2ec923046c26d65b19f06630b3180a81189362d8920a68113c7d921ca968b" diff --git a/recipes/arg_router/all/conanfile.py b/recipes/arg_router/all/conanfile.py new file mode 100644 index 0000000000000..54aaba2c90442 --- /dev/null +++ b/recipes/arg_router/all/conanfile.py @@ -0,0 +1,57 @@ +import os + +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, rmdir +from conan.tools.cmake import CMake, cmake_layout + + +class arg_routerRecipe(ConanFile): + name = "arg_router" + license = "BSL-1.0" + homepage = "https://github.com/cmannett85/arg_router" + url = "https://github.com/conan-io/conan-center-index" + description = "C++ command line argument parsing and routing." + topics = ("cpp", "command-line", "argument-parser", "header-only") + + # CMake >= 3.18 is required https://github.com/cmannett85/arg_router/blob/449567723d6c0e9db0a4c89277066c9a53b299fa/CMakeLists.txt#L5 + tool_requires = "cmake/3.25.3" + requires = "boost/1.81.0", "span-lite/0.10.3" + + settings = "os", "arch", "compiler", "build_type" + package_type = "header-library" + generators = "CMakeDeps", "CMakeToolchain" + no_copy_source = True + + def validate(self): + check_min_cppstd(self, 17) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def layout(self): + cmake_layout(self, src_folder="src") + + def build(self): + cmake = CMake(self) + cmake.configure(variables={"INSTALLATION_ONLY": True}) + cmake.build() + + def package(self): + cmake = CMake(self) + cmake.install() + + rmdir(self, os.path.join(self.package_folder, "share")) + + def package_info(self): + # Folders not used for header-only + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + self.cpp_info.set_property("cmake_file_name", "arg_router") + self.cpp_info.set_property( + "cmake_target_name", "arg_router::arg_router") + + def package_id(self): + # build_type and compiler are needed for the Conan's CMake tools but are not actually used + self.info.clear() diff --git a/recipes/arg_router/all/test_package/CMakeLists.txt b/recipes/arg_router/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..39ee9fb7862e2 --- /dev/null +++ b/recipes/arg_router/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.15) + +project(conan_test_project + LANGUAGES CXX) + +find_package(arg_router REQUIRED) + +add_executable(conan_test_project "main.cpp") +target_link_libraries(conan_test_project PUBLIC arg_router::arg_router) diff --git a/recipes/arg_router/all/test_package/conanfile.py b/recipes/arg_router/all/test_package/conanfile.py new file mode 100644 index 0000000000000..900fcbc977e1b --- /dev/null +++ b/recipes/arg_router/all/test_package/conanfile.py @@ -0,0 +1,27 @@ +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 = "CMakeDeps", "CMakeToolchain" + + 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 can_run(self): + cmd = os.path.join(self.cpp.build.bindir, + "conan_test_project") + " --help" + self.run(cmd, env="conanrun") diff --git a/recipes/arg_router/all/test_package/main.cpp b/recipes/arg_router/all/test_package/main.cpp new file mode 100644 index 0000000000000..21d89bdc8696a --- /dev/null +++ b/recipes/arg_router/all/test_package/main.cpp @@ -0,0 +1,61 @@ +#include + +namespace ar = arg_router; +namespace arp = ar::policy; + +#if (__cplusplus >= 202002L) +using namespace ar::literals; + +int main(int argc, char *argv[]) { + ar::root( + arp::validation::default_validator, + ar::help("help"_S, "h"_S, "Display this help and exit"_S, + arp::program_name_t{"just-cats"_S}, + arp::program_intro_t{"Prints cats!"_S}, + arp::program_addendum_t{"An example program for arg_router."_S}), + ar::flag("cat"_S, "English cat"_S, + arp::router{[](bool) { std::cout << "cat" << std::endl; }}), + ar::flag("猫"_S, // + arp::description_t{"日本語ã®çŒ«"_S}, + arp::router{[](bool) { std::cout << "猫" << std::endl; }}), + ar::flag("ðŸ±"_S, // + arp::description_t{"Emoji cat"_S}, + arp::router{[](bool) { std::cout << "ðŸ±" << std::endl; }}), + ar::flag("à¹à¸¡à¸§"_S, // + "à¹à¸¡à¸§à¹„ทย"_S, + arp::router{[](bool) { std::cout << "à¹à¸¡à¸§" << std::endl; }}), + ar::flag("кіт"_S, // + "українÑький кіт"_S, + arp::router{[](bool) { std::cout << "кіт" << std::endl; }})) + .parse(argc, argv); + + return EXIT_SUCCESS; +} +#else +int main(int argc, char *argv[]) { + ar::root( + arp::validation::default_validator, + ar::help(S_("help"){}, S_('h'){}, S_("Display this help and exit"){}, + arp::program_name, + arp::program_intro, + arp::program_addendum), + ar::flag(S_("cat"){}, // + S_("English cat"){}, + arp::router{[](bool) { std::cout << "cat" << std::endl; }}), + ar::flag(S_("猫"){}, // + arp::description, + arp::router{[](bool) { std::cout << "猫" << std::endl; }}), + ar::flag(S_("ðŸ±"){}, // + arp::description, + arp::router{[](bool) { std::cout << "ðŸ±" << std::endl; }}), + ar::flag(S_("à¹à¸¡à¸§"){}, // + S_("à¹à¸¡à¸§à¹„ทย"){}, + arp::router{[](bool) { std::cout << "à¹à¸¡à¸§" << std::endl; }}), + ar::flag(S_("кіт"){}, // + S_("українÑький кіт"){}, + arp::router{[](bool) { std::cout << "кіт" << std::endl; }})) + .parse(argc, argv); + + return EXIT_SUCCESS; +} +#endif diff --git a/recipes/arg_router/all/test_v1_package/CMakeLists.txt b/recipes/arg_router/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..8689ccd828863 --- /dev/null +++ b/recipes/arg_router/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/arg_router/all/test_v1_package/conanfile.py b/recipes/arg_router/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..ea5b012df89c5 --- /dev/null +++ b/recipes/arg_router/all/test_v1_package/conanfile.py @@ -0,0 +1,23 @@ +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", "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 cross_building(self): + cmd = os.path.join(self.cpp.build.bindir, + "conan_test_project") + " --help" + self.run(cmd, env="conanrun") diff --git a/recipes/arg_router/config.yml b/recipes/arg_router/config.yml new file mode 100644 index 0000000000000..a1e000ca33c5b --- /dev/null +++ b/recipes/arg_router/config.yml @@ -0,0 +1,4 @@ +versions: + # Newer versions at the top + "1.3.0": + folder: all diff --git a/recipes/argh/all/conanfile.py b/recipes/argh/all/conanfile.py index f6f6a44814ca4..855db0a2a7110 100644 --- a/recipes/argh/all/conanfile.py +++ b/recipes/argh/all/conanfile.py @@ -10,14 +10,19 @@ class ArgparseConan(ConanFile): name = "argh" + description = "Frustration-free command line processing" + license = "BSD-3" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/adishavit/argh" - topics = ("argh", "argument", "parsing") - license = "BSD-3" - description = "Frustration-free command line processing" + topics = ("argument", "parsing", "header-only") + + package_type = "header-library" 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() @@ -25,12 +30,8 @@ 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def build(self): pass diff --git a/recipes/argh/all/test_v1_package/CMakeLists.txt b/recipes/argh/all/test_v1_package/CMakeLists.txt index 65e0578c4c0f6..91630d79f4abb 100644 --- a/recipes/argh/all/test_v1_package/CMakeLists.txt +++ b/recipes/argh/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.15) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(argh REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE argh) -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/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/vulkan-loader/all/test_v1_package/CMakeLists.txt b/recipes/argon2/all/test_v1_package/CMakeLists.txt similarity index 100% rename from recipes/vulkan-loader/all/test_v1_package/CMakeLists.txt rename to recipes/argon2/all/test_v1_package/CMakeLists.txt diff --git a/recipes/openjpeg/all/test_v1_package/conanfile.py b/recipes/argon2/all/test_v1_package/conanfile.py similarity index 100% rename from recipes/openjpeg/all/test_v1_package/conanfile.py rename to recipes/argon2/all/test_v1_package/conanfile.py diff --git a/recipes/argparse/all/conandata.yml b/recipes/argparse/all/conandata.yml index 18f4555649896..db1ee3caae6a8 100644 --- a/recipes/argparse/all/conandata.yml +++ b/recipes/argparse/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "3.1": + url: "https://github.com/p-ranav/argparse/archive/v3.1.tar.gz" + sha256: "d01733552ca4a18ab501ae8b8be878131baa32e89090fafdeef018ebfa4c6e46" + "3.0": + url: "https://github.com/p-ranav/argparse/archive/v3.0.tar.gz" + sha256: "ba7b465759bb01069d57302855eaf4d1f7d677f21ad7b0b00b92939645c30f47" "2.9": url: "https://github.com/p-ranav/argparse/archive/v2.9.tar.gz" sha256: "cd563293580b9dc592254df35b49cf8a19b4870ff5f611c7584cf967d9e6031e" diff --git a/recipes/argparse/all/conanfile.py b/recipes/argparse/all/conanfile.py index e7e9de237fe52..cae941dd0cc89 100644 --- a/recipes/argparse/all/conanfile.py +++ b/recipes/argparse/all/conanfile.py @@ -11,12 +11,15 @@ class ArgparseConan(ConanFile): name = "argparse" + description = "Argument Parser for Modern C++" + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/p-ranav/argparse" - topics = ("argparse", "argument", "parsing") - license = "MIT" - description = "Argument Parser for Modern C++" + topics = ("argument", "parsing", "header-only") + + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" + no_copy_source = True @property def _min_cppstd(self): @@ -39,6 +42,9 @@ 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() @@ -54,12 +60,8 @@ def validate(self): if Version(self.version) > "2.1" and self.settings.compiler == "clang" and self.settings.compiler.libcxx == "libstdc++": raise ConanInvalidConfiguration("This recipe does not permit >2.1 with clang and stdlibc++. There may be an infrastructure issue in CCI.") - 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): apply_conandata_patches(self) @@ -73,12 +75,11 @@ def package(self): copy(self, "*.hpp", src=os.path.join(self.source_folder, "include"), dst=include_dst) def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.set_property("cmake_file_name", "argparse") self.cpp_info.set_property("cmake_target_name", "argparse::argparse") self.cpp_info.set_property("pkg_config_name", "argparse") if Version(self.version) <= "2.1": self.cpp_info.includedirs.append(os.path.join("include", "argparse")) - self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] - self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] diff --git a/recipes/argparse/all/test_package/CMakeLists.txt b/recipes/argparse/all/test_package/CMakeLists.txt index e8794b9790e15..cc806a824f8c4 100644 --- a/recipes/argparse/all/test_package/CMakeLists.txt +++ b/recipes/argparse/all/test_package/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) find_package(argparse REQUIRED CONFIG) diff --git a/recipes/argparse/all/test_v1_package/CMakeLists.txt b/recipes/argparse/all/test_v1_package/CMakeLists.txt index 59cfa3b376305..91630d79f4abb 100644 --- a/recipes/argparse/all/test_v1_package/CMakeLists.txt +++ b/recipes/argparse/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.15) project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(argparse REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE argparse::argparse) -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/argparse/config.yml b/recipes/argparse/config.yml index 5a743e89da3ef..7a2d6d99b91e4 100644 --- a/recipes/argparse/config.yml +++ b/recipes/argparse/config.yml @@ -1,4 +1,8 @@ versions: + "3.1": + folder: all + "3.0": + folder: all "2.9": folder: all "2.6": diff --git a/recipes/args-parser/all/conandata.yml b/recipes/args-parser/all/conandata.yml index 787c510a62b53..5a22686895e16 100644 --- a/recipes/args-parser/all/conandata.yml +++ b/recipes/args-parser/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "6.3.4": + url: "https://github.com/igormironchik/args-parser/archive/refs/tags/6.3.4.tar.gz" + sha256: "874be94baac622e16045b958539e91347f18fc0803356fb500757c0060222aa2" + "6.3.3": + url: "https://github.com/igormironchik/args-parser/archive/refs/tags/6.3.3.tar.gz" + sha256: "67867d7ab624a8c2f391230c54c37830e6127f7f5c716ff634165f674d876b64" "6.3.2": url: "https://github.com/igormironchik/args-parser/archive/refs/tags/6.3.2.tar.gz" sha256: "cd89549a9f5b5cfd16db2f8b9c93fd164cea334147c58890d5322365789e05e5" diff --git a/recipes/args-parser/all/conanfile.py b/recipes/args-parser/all/conanfile.py index 6203a42e03b3a..45b750c9e57c9 100644 --- a/recipes/args-parser/all/conanfile.py +++ b/recipes/args-parser/all/conanfile.py @@ -15,7 +15,8 @@ class ArgsParserConan(ConanFile): homepage = "https://github.com/igormironchik/args-parser" license = "MIT" description = "Small C++ header-only library for parsing command line arguments." - topics = ("args-parser", "argument", "parsing") + topics = ("argument", "parsing") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -33,6 +34,9 @@ def _compilers_minimum_version(self): "apple-clang": "10", } + def layout(self): + basic_layout(self, src_folder="src") + def package_id(self): self.info.clear() @@ -45,18 +49,17 @@ def validate(self): 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def build(self): pass def package(self): - copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + if Version(self.version) <= "6.3.3": + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + else: + copy(self, "MIT.txt", src=os.path.join(self.source_folder, "LICENSES"), dst=os.path.join(self.package_folder, "licenses")) copy(self, "*.hpp", src=os.path.join(self.source_folder, "args-parser"), dst=os.path.join(self.package_folder, "include", "args-parser")) def package_info(self): @@ -64,6 +67,4 @@ def package_info(self): self.cpp_info.set_property("cmake_target_name", "args-parser::args-parser") self.cpp_info.includedirs.append(os.path.join("include", "args-parser")) self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] diff --git a/recipes/args-parser/all/test_package/conanfile.py b/recipes/args-parser/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/args-parser/all/test_package/conanfile.py +++ b/recipes/args-parser/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/args-parser/all/test_v1_package/CMakeLists.txt b/recipes/args-parser/all/test_v1_package/CMakeLists.txt index 135995b086884..0d20897301b68 100644 --- a/recipes/args-parser/all/test_v1_package/CMakeLists.txt +++ b/recipes/args-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(args-parser REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE args-parser::args-parser) -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/args-parser/config.yml b/recipes/args-parser/config.yml index 08a70490fa0ab..9b0a8042dbf5e 100644 --- a/recipes/args-parser/config.yml +++ b/recipes/args-parser/config.yml @@ -1,4 +1,8 @@ versions: + "6.3.4": + folder: all + "6.3.3": + folder: all "6.3.2": folder: all "6.3.1": 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..8c8e33cf028bd 100644 --- a/recipes/argtable2/all/conanfile.py +++ b/recipes/argtable2/all/conanfile.py @@ -1,17 +1,24 @@ -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") license = "LGPL-2.0+" - homepage = "http://argtable.sourceforge.net/" url = "https://github.com/conan-io/conan-center-index" + homepage = "http://argtable.sourceforge.net/" + topics = ("argument", "parsing", "getopt") + + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -22,105 +29,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..91630d79f4abb --- /dev/null +++ b/recipes/argtable2/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/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..86aef097f8805 100644 --- a/recipes/argtable3/all/conanfile.py +++ b/recipes/argtable3/all/conanfile.py @@ -1,17 +1,22 @@ -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 = ("command", "line", "argument", "parse", "parsing", "getopt") + + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -22,14 +27,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 +36,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 +93,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..7d615d10f2ea9 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) +cmake_minimum_required(VERSION 3.15) +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..83621776fedfc 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.bindir, "test_package") + self.run(f"{bin_path} --help", env="conanrun") 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..91630d79f4abb --- /dev/null +++ b/recipes/argtable3/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/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/argz/all/conandata.yml b/recipes/argz/all/conandata.yml new file mode 100644 index 0000000000000..a8b111b9078ce --- /dev/null +++ b/recipes/argz/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.2.1": + url: "https://github.com/stephenberry/argz/archive/refs/tags/v0.2.1.tar.gz" + sha256: "1a9d85ef7e4722f81ce426c2cf8ceaa0a10cc42e7762cdf2465ae6484ece9c7e" diff --git a/recipes/argz/all/conanfile.py b/recipes/argz/all/conanfile.py new file mode 100644 index 0000000000000..1d0b4e30fd7e6 --- /dev/null +++ b/recipes/argz/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.scm import Version +import os + + +required_conan_version = ">=1.52.0" + + +class ArgzConan(ConanFile): + name = "argz" + description = "A light weight C++ in memory argument parser" + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/stephenberry/argz" + topics = ("argument", "parser", "header-only") + package_type = "header-library" + 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": "14", + "Visual Studio": "16", + "msvc": "192", + } + + 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, "LICENSE", 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_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + self.cpp_info.set_property("cmake_file_name", "argz") + self.cpp_info.set_property("cmake_target_name", "argz::argz") diff --git a/recipes/argz/all/test_package/CMakeLists.txt b/recipes/argz/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..8904da5a62a1d --- /dev/null +++ b/recipes/argz/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(argz REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE argz::argz) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) diff --git a/recipes/argz/all/test_package/conanfile.py b/recipes/argz/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/argz/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/argz/all/test_package/test_package.cpp b/recipes/argz/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..8e6558ac798fa --- /dev/null +++ b/recipes/argz/all/test_package/test_package.cpp @@ -0,0 +1,28 @@ +#include + +int main(int argc, char* argv[]) { + constexpr std::string_view version = "1.2.3"; + argz::about about{ "My program description", version }; + + std::string input{}; + std::string study{}; + int number = 123; + bool boolean = true; + std::optional number_opt{}; + argz::options opts{ + { { "input", 'i' }, input, "the input file"}, + { { "study", 's' }, study, "a study file"}, + { { "number" }, number, "input an int"}, + { { "boolean" }, boolean, "a boolean" }, + { { "number_opt" }, number_opt, "input an int"} + }; + + try { + argz::parse(about, opts, argc, argv); + } + catch (const std::exception& e) { + std::cerr << e.what() << '\n'; + } + + return 0; +} diff --git a/recipes/argz/config.yml b/recipes/argz/config.yml new file mode 100644 index 0000000000000..f975c1e3261f7 --- /dev/null +++ b/recipes/argz/config.yml @@ -0,0 +1,3 @@ +versions: + "0.2.1": + folder: all 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..fafd7b841d70b 100644 --- a/recipes/armadillo/all/conandata.yml +++ b/recipes/armadillo/all/conandata.yml @@ -3,13 +3,36 @@ 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" + "12.2.0": + url: "https://sourceforge.net/projects/arma/files/armadillo-12.2.0.tar.xz" + sha256: "b0dce042297e865add3351dad77f78c2c7638d6632f58357b015e50edcbd2186" + "12.6.4": + url: "https://sourceforge.net/projects/arma/files/armadillo-12.6.4.tar.xz" + sha256: "eb7f243ffc32f18324bc7fa978d0358637e7357ca7836bec55b4eb56e9749380" 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" + "12.2.0": + - patch_file: "patches/0003-Guard-dependency-discovery-12.2.x.patch" + patch_description: "Add find_package statements to inject conan dependencies" + patch_type: "conan" + "12.6.4": + - patch_file: "patches/0004-Guard-dependency-discovery-12.6.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..4735e4fcda303 100644 --- a/recipes/armadillo/all/conanfile.py +++ b/recipes/armadillo/all/conanfile.py @@ -1,6 +1,14 @@ -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, save +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.build import cross_building +from conan.errors import ConanInvalidConfiguration import os +import textwrap + +required_conan_version = ">=1.55.0" class ArmadilloConan(ConanFile): @@ -21,6 +29,7 @@ class ArmadilloConan(ConanFile): "hdf5", ) settings = "os", "compiler", "build_type", "arch" + package_type = "library" options = { "shared": [True, False], "fPIC": [True, False], @@ -50,7 +59,7 @@ class ArmadilloConan(ConanFile): "shared": False, "fPIC": True, "use_blas": "openblas", - "use_lapack": False, + "use_lapack": "openblas", "use_hdf5": True, "use_superlu": False, "use_extern_rng": False, @@ -68,20 +77,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 +100,16 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + if self.options.use_blas == "openblas": + self.options["openblas"].build_lapack = ( + self.options.use_lapack == "openblas" + ) 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" @@ -113,6 +119,11 @@ def validate(self): "framework_accelerate can only be used on Macos" ) + if self.options.use_hdf5 and Version(self.version) > "12" and cross_building(self): + raise ConanInvalidConfiguration( + "Armadillo does not support cross building with hdf5. Set use_hdf5=False and try again." + ) + for value, options in self._co_dependencies.items(): options_without_value = [ x for x in options if getattr(self.options, x) != value @@ -149,7 +160,7 @@ def validate(self): ) for opt in deprecated_opts: - self.output.warn( + self.output.warning( f"DEPRECATION NOTICE: Value {opt} uses armadillo's default dependency search and will be replaced when this package becomes available in ConanCenter" ) @@ -159,6 +170,9 @@ def validate(self): "The wrapper requires the use of an external RNG. Set use_extern_rng=True and try again." ) + if not self.options.shared and self.options.use_wrapper: + raise ConanInvalidConfiguration("Building the armadillo run-time wrapper library requires armadillo/*:shared=True") + def requirements(self): # Optional requirements # TODO: "atlas/3.10.3" # Pending https://github.com/conan-io/conan-center-index/issues/6757 @@ -166,118 +180,146 @@ def requirements(self): # TODO: "arpack/1.0" # Pending https://github.com/conan-io/conan-center-index/issues/6755 # TODO: "flexiblas/3.0.4" # Pending https://github.com/conan-io/conan-center-index/issues/6827 - if self.options.use_hdf5: + # The armadillo library no longer takes any responsibility for linking hdf5 as of v12.x. This means + # it will have to be linked manually by consumers if desired. + # See https://gitlab.com/conradsnicta/armadillo-code/-/issues/227 for more information. + if self.options.use_hdf5 and Version(self.version) < "12": # Use the conan dependency if the system lib isn't being used - self.requires("hdf5/1.12.0") + # Libraries not required to be propagated transitively when the armadillo run-time wrapper is used + self.requires("hdf5/1.14.3", transitive_headers=True, transitive_libs=not self.options.use_wrapper) if self.options.use_blas == "openblas": - self.requires("openblas/0.3.15") - # Note that if you're relying on this to build LAPACK, you _must_ have - # a fortran compiler installed. If you don't, OpenBLAS will build successfully but - # without LAPACK support, which isn't obvious. - # This can be achieved by setting the FC environment variable in your conan profile - self.options["openblas"].build_lapack = ( - self.options.use_lapack == "openblas" - ) + # Libraries not required to be propagated transitively when the armadillo run-time wrapper is used + self.requires("openblas/0.3.25", transitive_libs=not self.options.use_wrapper) if ( 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" ): - self.output.warn( + self.output.warning( "The intel-mkl package does not exist in CCI. To use an Intel MKL package, override this requirement with your own recipe." ) 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() + @property + def _get_arma_version_name(self): + version_file = os.path.join(self.source_folder, "include", "armadillo_bits", "arma_version.hpp") + with open(version_file, "r") as f: + for line in f: + if "ARMA_VERSION_NAME" in line: + return line.split("\"")[-2].strip() + return "" + + @property + def _module_vars_rel_path(self): + return os.path.join("lib", "cmake", f"conan-official-{self.name}-variables.cmake") + + def _create_cmake_module_variables(self, module_file): + content = textwrap.dedent(f"""\ + set(ARMADILLO_FOUND TRUE) + if(DEFINED Armadillo_INCLUDE_DIRS) + set(ARMADILLO_INCLUDE_DIRS ${{Armadillo_INCLUDE_DIRS}}) + endif() + if(DEFINED Armadillo_LIBRARIES) + set(ARMADILLO_LIBRARIES ${{Armadillo_LIBRARIES}}) + endif() + set(ARMADILLO_VERSION_MAJOR "{Version(self.version).major}") + set(ARMADILLO_VERSION_MINOR "{Version(self.version).minor}") + set(ARMADILLO_VERSION_PATCH "{Version(self.version).patch}") + if(DEFINED Armadillo_VERSION_STRING) + set(ARMADILLO_VERSION_STRING ${{Armadillo_VERSION_STRING}}) + else() + set(ARMADILLO_VERSION_STRING "${{ARMADILLO_VERSION_MAJOR}}.${{ARMADILLO_VERSION_MINOR}}.${{ARMADILLO_VERSION_PATCH}}") + endif() + set(ARMADILLO_VERSION_NAME "{self._get_arma_version_name}") + """) + save(self, module_file, content) + 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")) + self._create_cmake_module_variables(os.path.join(self.package_folder, self._module_vars_rel_path)) + def package_info(self): self.cpp_info.libs = ["armadillo"] + self.cpp_info.set_property("pkg_config_name", "armadillo") + self.cpp_info.set_property("cmake_find_mode", "both") + self.cpp_info.set_property("cmake_file_name", "Armadillo") + self.cpp_info.set_property("cmake_target_name", "Armadillo::Armadillo") + self.cpp_info.set_property("cmake_target_aliases", ["armadillo", "armadillo::armadillo"]) + self.cpp_info.set_property("cmake_build_modules", [self._module_vars_rel_path]) + + # Remove when cmake_find_package and pkg_config generators are no + # longer supported self.cpp_info.names["pkg_config"] = "armadillo" + self.cpp_info.names["cmake_find_package"] = "Armadillo" + self.cpp_info.names["cmake_find_package_multi"] = "Armadillo" + self.cpp_info.build_modules["cmake_find_package"] = [self._module_vars_rel_path] + self.cpp_info.build_modules["cmake_find_package_multi"] = [self._module_vars_rel_path] if self.options.get_safe("use_extern_rng"): self.cpp_info.defines.append("ARMA_USE_EXTERN_RNG") diff --git a/recipes/armadillo/all/patches/0001-Guard-dependency-discovery-10.7.x.patch b/recipes/armadillo/all/patches/0001-Guard-dependency-discovery-10.7.x.patch index 89386d2e8686f..5736e2db0a819 100644 --- a/recipes/armadillo/all/patches/0001-Guard-dependency-discovery-10.7.x.patch +++ b/recipes/armadillo/all/patches/0001-Guard-dependency-discovery-10.7.x.patch @@ -1,15 +1,3 @@ -From 48a5162899ebeb0ba3ca3141b587a53d2eda4223 Mon Sep 17 00:00:00 2001 -From: Samuel Dowling -Date: Thu, 30 Sep 2021 23:51:35 +0930 -Subject: [PATCH] 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 | 72 ++++++++++++++++++++----- - include/armadillo_bits/config.hpp.cmake | 2 +- - 2 files changed, 60 insertions(+), 14 deletions(-) - diff --git a/CMakeLists.txt b/CMakeLists.txt index 7857f8c..5f87f7e 100644 --- a/CMakeLists.txt 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..26001d6f2f096 --- /dev/null +++ b/recipes/armadillo/all/patches/0002-Guard-dependency-discovery-11.4.x.patch @@ -0,0 +1,143 @@ +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/patches/0003-Guard-dependency-discovery-12.2.x.patch b/recipes/armadillo/all/patches/0003-Guard-dependency-discovery-12.2.x.patch new file mode 100644 index 0000000000000..7c8079d507a32 --- /dev/null +++ b/recipes/armadillo/all/patches/0003-Guard-dependency-discovery-12.2.x.patch @@ -0,0 +1,121 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 7d21cf2..2669b17 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -270,7 +270,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,") +@@ -285,8 +289,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 "") +@@ -325,19 +337,45 @@ if(APPLE) + + else() + +- if(ALLOW_FLEXIBLAS_LINUX AND (${CMAKE_SYSTEM_NAME} MATCHES "Linux")) +- include(ARMA_FindFlexiBLAS) ++ if(USE_MKL) ++ find_package(MKL) + else() +- set(FlexiBLAS_FOUND false) ++ 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() + +- include(ARMA_FindMKL) +- include(ARMA_FindOpenBLAS) +- include(ARMA_FindATLAS) # TODO: remove support for ATLAS in next major version +- include(ARMA_FindBLAS) +- include(ARMA_FindLAPACK) +- +- message(STATUS "FlexiBLAS_FOUND = ${FlexiBLAS_FOUND}" ) ++ if(ALLOW_FLEXIBLAS_LINUX AND (${CMAKE_SYSTEM_NAME} MATCHES "Linux")) ++ if(USE_SYSTEM_FLEXIBLAS) ++ include(ARMA_FindFlexiBLAS) ++ else() ++ set(FlexiBLAS_FOUND NO) ++ endif() ++ endif() ++ ++ message(STATUS "FlexiBLAS_FOUND = ${FlexiBLAS_FOUND}" ) + message(STATUS " MKL_FOUND = ${MKL_FOUND}" ) + message(STATUS " OpenBLAS_FOUND = ${OpenBLAS_FOUND}" ) + message(STATUS " ATLAS_FOUND = ${ATLAS_FOUND}" ) +@@ -449,7 +487,11 @@ else() + 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) +@@ -457,7 +499,11 @@ 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) +-- +2.41.0 + diff --git a/recipes/armadillo/all/patches/0004-Guard-dependency-discovery-12.6.x.patch b/recipes/armadillo/all/patches/0004-Guard-dependency-discovery-12.6.x.patch new file mode 100644 index 0000000000000..f374782089ebf --- /dev/null +++ b/recipes/armadillo/all/patches/0004-Guard-dependency-discovery-12.6.x.patch @@ -0,0 +1,121 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index a67ef80..91ef979 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -259,7 +259,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,") +@@ -274,8 +278,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 "") +@@ -314,19 +326,45 @@ if(APPLE) + + else() + +- if(ALLOW_FLEXIBLAS_LINUX AND (${CMAKE_SYSTEM_NAME} MATCHES "Linux")) +- include(ARMA_FindFlexiBLAS) ++ if(USE_MKL) ++ find_package(MKL) + else() +- set(FlexiBLAS_FOUND false) ++ 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() + +- include(ARMA_FindMKL) +- include(ARMA_FindOpenBLAS) +- include(ARMA_FindATLAS) # TODO: remove support for ATLAS in next major version +- include(ARMA_FindBLAS) +- include(ARMA_FindLAPACK) +- +- message(STATUS "FlexiBLAS_FOUND = ${FlexiBLAS_FOUND}" ) ++ if(ALLOW_FLEXIBLAS_LINUX AND (${CMAKE_SYSTEM_NAME} MATCHES "Linux")) ++ if(USE_SYSTEM_FLEXIBLAS) ++ include(ARMA_FindFlexiBLAS) ++ else() ++ set(FlexiBLAS_FOUND NO) ++ endif() ++ endif() ++ ++ message(STATUS "FlexiBLAS_FOUND = ${FlexiBLAS_FOUND}" ) + message(STATUS " MKL_FOUND = ${MKL_FOUND}" ) + message(STATUS " OpenBLAS_FOUND = ${OpenBLAS_FOUND}" ) + message(STATUS " ATLAS_FOUND = ${ATLAS_FOUND}" ) +@@ -438,7 +476,11 @@ else() + 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) +@@ -446,7 +488,11 @@ 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) +-- +2.42.0 + diff --git a/recipes/armadillo/all/test_package/CMakeLists.txt b/recipes/armadillo/all/test_package/CMakeLists.txt index 708a6618b6043..7f0a114a2e9e8 100644 --- a/recipes/armadillo/all/test_package/CMakeLists.txt +++ b/recipes/armadillo/all/test_package/CMakeLists.txt @@ -1,11 +1,32 @@ -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) +if (LINK_HDF5) + find_package(HDF5) + set(HDF5_TARGETS HDF5::HDF5) +endif() -find_package(armadillo REQUIRED) - -add_executable(example example.cpp) -target_link_libraries(example armadillo::armadillo) +add_executable(example src/example.cpp) +target_link_libraries(example Armadillo::Armadillo ${HDF5_TARGETS}) set_property(TARGET example PROPERTY CXX_STANDARD 11) + +# Test whether variables from https://cmake.org/cmake/help/latest/module/FindArmadillo.html are properly defined + +set(_custom_vars + ARMADILLO_FOUND + ARMADILLO_INCLUDE_DIRS + ARMADILLO_LIBRARIES + ARMADILLO_VERSION_MAJOR + ARMADILLO_VERSION_MINOR + ARMADILLO_VERSION_PATCH + ARMADILLO_VERSION_STRING + ARMADILLO_VERSION_NAME +) +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/armadillo/all/test_package/conanfile.py b/recipes/armadillo/all/test_package/conanfile.py index 5eba7cbe1bb9c..2c5aab901d0bf 100644 --- a/recipes/armadillo/all/test_package/conanfile.py +++ b/recipes/armadillo/all/test_package/conanfile.py @@ -1,18 +1,42 @@ import os -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, cmake_layout, CMakeToolchain +from conan.tools.build import cross_building +from conan.tools.scm import Version -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", "VirtualBuildEnv", "VirtualRunEnv" + apply_env = False + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + tested_version = self.tested_reference_str.split('/')[1].split('@')[0] + # using armadillo > 12.x requires the consumer to explicitly depend on hdf5 + if Version(tested_version) > "12": + self.requires("hdf5/1.14.0") + + def generate(self): + tc = CMakeToolchain(self) + # using armadillo > 12.x requires explicit consumer linkage against hdf5 + explicit_link_condition = Version(self.dependencies["armadillo"].ref.version) > "12" + tc.variables["LINK_HDF5"] = explicit_link_condition + tc.generate() 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..30cc31a24a3d1 --- /dev/null +++ b/recipes/armadillo/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,31 @@ +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) + +# Test whether variables from https://cmake.org/cmake/help/latest/module/FindArmadillo.html are properly defined + +set(_custom_vars + ARMADILLO_FOUND + ARMADILLO_INCLUDE_DIRS + ARMADILLO_LIBRARIES + ARMADILLO_VERSION_MAJOR + ARMADILLO_VERSION_MINOR + ARMADILLO_VERSION_PATCH + ARMADILLO_VERSION_STRING + ARMADILLO_VERSION_NAME +) +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/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..7dfcb07b6f44b 100644 --- a/recipes/armadillo/config.yml +++ b/recipes/armadillo/config.yml @@ -3,3 +3,9 @@ versions: folder: all "10.7.3": folder: all + "11.4.3": + folder: all + "12.2.0": + folder: all + "12.6.4": + folder: all diff --git a/recipes/arrow/all/conan_cmake_project_include.cmake b/recipes/arrow/all/conan_cmake_project_include.cmake new file mode 100644 index 0000000000000..1bf900def3e56 --- /dev/null +++ b/recipes/arrow/all/conan_cmake_project_include.cmake @@ -0,0 +1,13 @@ +if(ARROW_S3) + find_package(AWSSDK REQUIRED) + # Fix issue where scripts expect a variable called "AWSSDK_LINK_LIBRARIES" + # which is not defined by the generated AWSSDKConfig.cmake + if(NOT DEFINED AWSSDK_LINK_LIBRARIES) + set(AWSSDK_LINK_LIBRARIES "${AWSSDK_LIBRARIES}") + endif() + + # Causes logic used for generated .pc file to not run + # avoiding instropection of target `aws-cpp-sdk::aws-cpp-sdk` + # This is fine because the generated .pc file is not of use + set(AWSSDK_SOURCE "conan") +endif() diff --git a/recipes/arrow/all/conandata.yml b/recipes/arrow/all/conandata.yml index dd9d6a4aeec6c..f979a4480c4a3 100644 --- a/recipes/arrow/all/conandata.yml +++ b/recipes/arrow/all/conandata.yml @@ -1,83 +1,45 @@ sources: - "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://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://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://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://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://www.apache.org/dyn/closer.lua/arrow/arrow-1.0.0/apache-arrow-1.0.0.tar.gz?action=download" - sha256: "86ddb9feb48203a5aaf9cc4f2827525e20a2ca4d7239e492af17e74532ccf243" + "18.1.0": + url: "https://www.apache.org/dyn/closer.lua/arrow/arrow-18.1.0/apache-arrow-18.1.0.tar.gz?action=download" + sha256: "2dc8da5f8796afe213ecc5e5aba85bb82d91520eff3cf315784a52d0fa61d7fc" + "18.0.0": + url: "https://www.apache.org/dyn/closer.lua/arrow/arrow-18.0.0/apache-arrow-18.0.0.tar.gz?action=download" + sha256: "abcf1934cd0cdddd33664e9f2d9a251d6c55239d1122ad0ed223b13a583c82a9" + "17.0.0": + url: "https://www.apache.org/dyn/closer.lua/arrow/arrow-17.0.0/apache-arrow-17.0.0.tar.gz?action=download" + sha256: "9d280d8042e7cf526f8c28d170d93bfab65e50f94569f6a790982a878d8d898d" + "16.1.0": + url: "https://www.apache.org/dyn/closer.lua/arrow/arrow-16.1.0/apache-arrow-16.1.0.tar.gz?action=download" + sha256: "c9e60c7e87e59383d21b20dc874b17153729ee153264af6d21654b7dff2c60d7" + "15.0.0": + url: "https://www.apache.org/dyn/closer.lua/arrow/arrow-15.0.0/apache-arrow-15.0.0.tar.gz?action=download" + sha256: "01dd3f70e85d9b5b933ec92c0db8a4ef504a5105f78d2d8622e84279fb45c25d" + "14.0.2": + url: "https://www.apache.org/dyn/closer.lua/arrow/arrow-14.0.2/apache-arrow-14.0.2.tar.gz?action=download" + sha256: "1304dedb41896008b89fe0738c71a95d9b81752efc77fa70f264cb1da15d9bc2" patches: - "10.0.0": - - patch_file: "patches/10.0.0-0001-mallctl-takes-size_t.patch" - patch_description: "use size_t instead of ssize_t" - patch_type: "backport" - - patch_file: "patches/10.0.0-0002-fix-cmake.patch" + "18.1.0": + - patch_file: "patches/18.0.0-0001-fix-cmake.patch" patch_description: "use cci package" patch_type: "conan" - "8.0.1": - - patch_file: "patches/8.0.0-0003-mallctl-takes-size_t.patch" - patch_description: "use size_t instead of ssize_t" - patch_type: "backport" - - 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" + "18.0.0": + - patch_file: "patches/18.0.0-0001-fix-cmake.patch" patch_description: "use cci package" patch_type: "conan" - "8.0.0": - - patch_file: "patches/8.0.0-0003-mallctl-takes-size_t.patch" - patch_description: "use size_t instead of ssize_t" - patch_type: "backport" - - 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" + "17.0.0": + - patch_file: "patches/16.0.0-0001-fix-cmake.patch" patch_description: "use cci package" patch_type: "conan" - "7.0.0": - - patch_file: "patches/7.0.0-0003-mallctl-takes-size_t.patch" - patch_description: "use size_t instead of ssize_t" - patch_type: "backport" - - 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" + "16.1.0": + - patch_file: "patches/16.0.0-0001-fix-cmake.patch" patch_description: "use cci package" patch_type: "conan" - "2.0.0": - - patch_file: "patches/2.0.0-0003-fix-shared-msvc.patch" - patch_description: "make shared enabled in msvc" - patch_type: "backport" - - patch_file: "patches/1.0.0-0004-mallctl-takes-size_t.patch" - patch_description: "use size_t instead of ssize_t" - patch_type: "backport" - - patch_file: "patches/2.0.0-0005-gandiva-engine.patch" - patch_description: "fix grandiva compilation error" - patch_type: "backport" - - patch_file: "patches/2.0.0-0008-fix-cmake.patch" + "15.0.0": + - patch_file: "patches/11.0.0-0001-fix-cmake.patch" patch_description: "use cci package" patch_type: "conan" - "1.0.0": - - patch_file: "patches/1.0.0-0003-fix-shared-msvc.patch" - patch_description: "make shared enabled in msvc" - patch_type: "backport" - - patch_file: "patches/1.0.0-0004-mallctl-takes-size_t.patch" - patch_description: "use size_t instead of ssize_t" - patch_type: "backport" - - patch_file: "patches/1.0.0-0005-fix-make12-namespace.patch" - patch_description: "fix ambiguous `make12` function between std and date" - patch_type: "backport" - - patch_file: "patches/1.0.0-0006-fix-cmake.patch" + "14.0.2": + - patch_file: "patches/11.0.0-0001-fix-cmake.patch" patch_description: "use cci package" patch_type: "conan" + \ No newline at end of file diff --git a/recipes/arrow/all/conanfile.py b/recipes/arrow/all/conanfile.py index 3985eb3a0a200..be8bacf5a73f6 100644 --- a/recipes/arrow/all/conanfile.py +++ b/recipes/arrow/all/conanfile.py @@ -1,15 +1,15 @@ 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.errors import ConanInvalidConfiguration, ConanException 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 +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 glob -required_conan_version = ">=1.53.0" +required_conan_version = ">=2.1.0" class ArrowConan(ConanFile): name = "arrow" @@ -17,7 +17,8 @@ class ArrowConan(ConanFile): license = ("Apache-2.0",) url = "https://github.com/conan-io/conan-center-index" homepage = "https://arrow.apache.org/" - topics = ("memory", "gandiva", "parquet", "skyhook", "plasma", "hdfs", "csv", "cuda", "gcs", "json", "hive", "s3", "grpc") + topics = ("memory", "gandiva", "parquet", "skyhook", "acero", "hdfs", "csv", "cuda", "gcs", "json", "hive", "s3", "grpc") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -26,7 +27,7 @@ class ArrowConan(ConanFile): "parquet": ["auto", True, False], "substrait": [True, False], "skyhook": [True, False], - "plasma": [True, False], + "acero": [True, False], "cli": [True, False], "compute": ["auto", True, False], "dataset_modules": ["auto", True, False], @@ -34,6 +35,7 @@ class ArrowConan(ConanFile): "encryption": [True, False], "filesystem_layer": [True, False], "hdfs_bridgs": [True, False], + "plasma": [True, False, "deprecated"], "simd_level": [None, "default", "sse4_2", "avx2", "avx512", "neon", ], "runtime_simd_level": [None, "sse4_2", "avx2", "avx512", "max"], "with_backtrace": [True, False], @@ -47,8 +49,9 @@ class ArrowConan(ConanFile): "with_glog": ["auto", True, False], "with_grpc": ["auto", True, False], "with_jemalloc": ["auto", True, False], - "with_mimalloc": ["auto", True, False], + "with_mimalloc": [True, False], "with_json": [True, False], + "with_thrift": ["auto", True, False], "with_llvm": ["auto", True, False], "with_openssl": ["auto", True, False], "with_opentelemetry": [True, False], @@ -68,335 +71,218 @@ class ArrowConan(ConanFile): "shared": False, "fPIC": True, "gandiva": False, - "parquet": "auto", + "parquet": True, "skyhook": False, "substrait": False, - "plasma": False, + "acero": False, "cli": False, - "compute": "auto", - "dataset_modules": "auto", + "compute": False, + "dataset_modules": False, "deprecated": True, "encryption": False, "filesystem_layer": False, "hdfs_bridgs": False, + "plasma": "deprecated", "simd_level": "default", "runtime_simd_level": "max", "with_backtrace": False, - "with_boost": "auto", + "with_boost": True, "with_brotli": False, "with_bz2": False, "with_csv": False, "with_cuda": False, - "with_flight_rpc": "auto", + "with_flight_rpc": False, "with_flight_sql": False, "with_gcs": False, - "with_gflags": "auto", - "with_jemalloc": "auto", + "with_gflags": False, + "with_jemalloc": False, "with_mimalloc": False, - "with_glog": "auto", - "with_grpc": "auto", + "with_glog": False, + "with_grpc": False, "with_json": False, - "with_llvm": "auto", - "with_openssl": "auto", + "with_thrift": True, + "with_llvm": False, + "with_openssl": False, "with_opentelemetry": False, "with_orc": False, - "with_protobuf": "auto", - "with_re2": "auto", + "with_protobuf": False, + "with_re2": False, "with_s3": False, - "with_utf8proc": "auto", + "with_utf8proc": False, "with_lz4": False, "with_snappy": False, - "with_zlib": False, + "with_zlib": True, "with_zstd": False, } short_paths = True @property - def _minimum_cpp_standard(self): + def _min_cppstd(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 _compilers_minimum_version(self): - return { - "gcc": "8", - "clang": "7", - "apple-clang": "10", - } + return "11" if Version(self.version) < "10.0.0" else "17" def export_sources(self): export_conandata_patches(self) + copy(self, "conan_cmake_project_include.cmake", self.recipe_folder, os.path.join(self.export_sources_folder, "src")) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - if Version(self.version) < "2.0.0": - del self.options.simd_level - del self.options.runtime_simd_level - elif Version(self.version) < "6.0.0": - self.options.simd_level = "sse4_2" - if Version(self.version) < "6.0.0": - del self.options.with_gcs - if Version(self.version) < "7.0.0": - del self.options.skyhook - del self.options.with_flight_sql - del self.options.with_opentelemetry if Version(self.version) < "8.0.0": del self.options.substrait + if is_msvc(self): + self.options.with_boost = True def configure(self): 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._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 - if self.options.compute == False and not self._compute(True): - raise ConanInvalidConfiguration("compute options is required (or choose auto)") - if self.options.parquet == False and self._parquet(True): - raise ConanInvalidConfiguration("parquet options is required (or choose auto)") - if self.options.dataset_modules == False and self._dataset_modules(True): - raise ConanInvalidConfiguration("dataset_modules options is required (or choose auto)") - if self.options.get_safe("skyhook", False): - raise ConanInvalidConfiguration("CCI has no librados recipe (yet)") - if self.options.with_jemalloc == False and self._with_jemalloc(True): - raise ConanInvalidConfiguration("with_jemalloc option is required (or choose auto)") - if self.options.with_re2 == False and self._with_re2(True): - raise ConanInvalidConfiguration("with_re2 option is required (or choose auto)") - if self.options.with_protobuf == False and self._with_protobuf(True): - raise ConanInvalidConfiguration("with_protobuf option is required (or choose auto)") - if self.options.with_gflags == False and self._with_gflags(True): - raise ConanInvalidConfiguration("with_gflags options is required (or choose auto)") - if self.options.with_flight_rpc == False and self._with_flight_rpc(True): - raise ConanInvalidConfiguration("with_flight_rpc options is required (or choose auto)") - if self.options.with_grpc == False and self._with_grpc(True): - raise ConanInvalidConfiguration("with_grpc options is required (or choose auto)") - if self.options.with_boost == False and self._with_boost(True): - raise ConanInvalidConfiguration("with_boost options is required (or choose auto)") - 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_llvm options is required (or choose auto)") - if self.options.with_cuda: - raise ConanInvalidConfiguration("CCI has no cuda 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: - raise ConanInvalidConfiguration("arrow:with_s3 requires aws-sdk-cpp:config is True.") - - if self.options.shared and self._with_jemalloc(): - if self.options["jemalloc"].enable_cxx: - raise ConanInvalidConfiguration("jemmalloc.enable_cxx of a static jemalloc must be disabled") - - 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._parquet() or self._dataset_modules()) or bool(self.options.get_safe("substrait", False)) - else: - return bool(self.options.compute) - - def _parquet(self, required=False): - if required or self.options.parquet == "auto": - return bool(self.options.get_safe("substrait", False)) - else: - return bool(self.options.parquet) - - def _dataset_modules(self, required=False): - if required or self.options.dataset_modules == "auto": - return bool(self.options.get_safe("substrait", False)) - else: - return bool(self.options.dataset_modules) - - def _with_jemalloc(self, required=False): - if required or self.options.with_jemalloc == "auto": - return bool("BSD" in str(self.settings.os)) - else: - return bool(self.options.with_jemalloc) - - def _with_re2(self, required=False): - if required or self.options.with_re2 == "auto": - 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) - - def _with_protobuf(self, required=False): - if required or self.options.with_protobuf == "auto": - return bool(self.options.gandiva or self._with_flight_rpc() or self.options.with_orc or self.options.get_safe("substrait", False)) - else: - return bool(self.options.with_protobuf) - - def _with_flight_rpc(self, required=False): - if required or self.options.with_flight_rpc == "auto": - return bool(self.options.get_safe("with_flight_sql", False)) - else: - return bool(self.options.with_flight_rpc) - - def _with_gflags(self, required=False): - if required or self.options.with_gflags == "auto": - return bool(self.options.plasma or self._with_glog() or self._with_grpc()) - else: - return bool(self.options.with_gflags) - - def _with_glog(self, required=False): - if required or self.options.with_glog == "auto": - return False - else: - return bool(self.options.with_glog) - - def _with_grpc(self, required=False): - if required or self.options.with_grpc == "auto": - return self._with_flight_rpc() - else: - return bool(self.options.with_grpc) - - def _with_boost(self, required=False): - if required or self.options.with_boost == "auto": - if self.options.gandiva: - return True - version = Version(self.version) - if version.major == "1": - if self._parquet() and self.settings.compiler == "gcc" and self.settings.compiler.version < Version("4.9"): - return True - elif version.major >= "2": - if is_msvc(self): - return True - return False - else: - return bool(self.options.with_boost) - - def _with_thrift(self, required=False): - # No self.options.with_thift exists - return bool(required or self._parquet()) - - def _with_utf8proc(self, required=False): - if required or self.options.with_utf8proc == "auto": - return bool(self._compute() or self.options.gandiva) - else: - return bool(self.options.with_utf8proc) - - def _with_llvm(self, required=False): - if required or self.options.with_llvm == "auto": - return bool(self.options.gandiva) - else: - return bool(self.options.with_llvm) - - def _with_openssl(self, required=False): - if required or self.options.with_openssl == "auto": - return bool(self.options.encryption or self._with_flight_rpc() or self.options.with_s3) - 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 _requires_rapidjson(self): + return self.options.with_json or self.options.encryption def requirements(self): - if self._with_thrift(): - self.requires("thrift/0.17.0") - if self._with_protobuf(): - self.requires("protobuf/3.21.4") - if self._with_jemalloc(): + if self.options.with_thrift: + self.requires("thrift/0.20.0") + if self.options.with_protobuf: + self.requires("protobuf/3.21.12") + if self.options.with_jemalloc: 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.80.0") - if self._with_gflags(): + if self.options.with_boost: + self.requires("boost/1.85.0") + if self.options.with_gflags: self.requires("gflags/2.2.2") - if self._with_glog(): + if self.options.with_glog: self.requires("glog/0.6.0") if self.options.get_safe("with_gcs"): self.requires("google-cloud-cpp/1.40.1") - if self._with_grpc(): + if self.options.with_grpc: self.requires("grpc/1.50.0") - if self._with_rapidjson(): + if self._requires_rapidjson(): self.requires("rapidjson/1.1.0") - if self._with_llvm(): + if self.options.with_llvm: self.requires("llvm-core/13.0.0") - if self._with_openssl(): + if self.options.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.1s") + self.requires("openssl/1.1.1w") else: - self.requires("openssl/1.1.1s") + self.requires("openssl/[>=1.1 <4]") if self.options.get_safe("with_opentelemetry"): 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: - self.requires("brotli/1.0.9") + self.requires("brotli/1.1.0") if self.options.with_bz2: self.requires("bzip2/1.0.8") if self.options.with_lz4: self.requires("lz4/1.9.4") if self.options.with_snappy: self.requires("snappy/1.1.9") - 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/9.0.1") + if self.options.get_safe("simd_level") != None or \ + self.options.get_safe("runtime_simd_level") != None: + if Version(self.version) < 8: + self.requires("xsimd/9.0.1") + else: + self.requires("xsimd/13.0.0") if self.options.with_zlib: - self.requires("zlib/1.2.13") + self.requires("zlib/[>=1.2.11 <2]") if self.options.with_zstd: - self.requires("zstd/1.5.2") - if self._with_re2(): - self.requires("re2/20220601") - if self._with_utf8proc(): + self.requires("zstd/[>=1.5 <1.6]") + if self.options.with_re2: + self.requires("re2/20230301") + if self.options.with_utf8proc: self.requires("utf8proc/2.8.0") if self.options.with_backtrace: self.requires("libbacktrace/cci.20210118") + if self.options.with_orc: + self.requires("orc/2.0.0") + + def validate(self): + # Do not allow options with 'auto' value + # TODO: Remove "auto" from the possible values for these options + auto_options = [option for option, value in self.options.items() if value == "auto"] + if auto_options: + raise ConanException("Options with value 'auto' are deprecated. Please set them true/false or use its default value." + f" Please change the following options: {auto_options}") + + # From https://github.com/conan-io/conan-center-index/pull/23163#issuecomment-2039808851 + if self.options.gandiva: + if not self.options.with_re2: + raise ConanException("'with_re2' option should be True when 'gandiva=True'") + if not self.options.with_boost: + raise ConanException("'with_boost' option should be True when 'gandiva=True'") + if not self.options.with_utf8proc: + raise ConanException("'with_utf8proc' option should be True when 'gandiva=True'") + if self.options.with_thrift and not self.options.with_boost: + raise ConanException("'with_boost' option should be True when 'thrift=True'") + if self.options.parquet: + if not self.options.with_thrift: + raise ConanException("'with_thrift' option should be True when 'parquet=True'") + if self.options.with_flight_rpc and not self.options.with_protobuf: + raise ConanException("'with_protobuf' option should be True when 'with_flight_rpc=True'") + + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + + if ( + Version(self.version) < "10.0.0" + and self.settings.compiler == "clang" + and Version(self.settings.compiler.version) < "3.9" + ): + raise ConanInvalidConfiguration( + f"{self.ref} requires C++11, which needs at least clang-3.9" + ) + + if self.options.get_safe("skyhook", False): + raise ConanInvalidConfiguration("CCI has no librados recipe (yet)") + if self.options.with_cuda: + raise ConanInvalidConfiguration("CCI has no cuda recipe (yet)") + if self.options.with_s3 and not self.dependencies["aws-sdk-cpp"].options.config: + raise ConanInvalidConfiguration("arrow:with_s3 requires aws-sdk-cpp:config is True.") + + if self.options.shared and self.options.with_jemalloc: + if self.dependencies["jemalloc"].options.enable_cxx: + raise ConanInvalidConfiguration("jemmalloc.enable_cxx of a static jemalloc must be disabled") + + if self.options.with_thrift and not self.options.with_zlib: + raise ConanInvalidConfiguration("arrow:with_thrift requires arrow:with_zlib") + + if self.options.parquet and not self.options.with_thrift: + raise ConanInvalidConfiguration("arrow:parquet requires arrow:with_thrift") + + def build_requirements(self): + if Version(self.version) >= "13.0.0": + self.tool_requires("cmake/[>=3.16 <4]") def source(self): get(self, **self.conan_data["sources"][self.version], - filename=f"apache-arrow-{self.version}.tar.gz", destination=self.source_folder, strip_root=True) + filename=f"apache-arrow-{self.version}.tar.gz", 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)) - 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_PARQUET"] = self.options.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_ACERO"] = bool(self.options.acero) + tc.variables["ARROW_DATASET"] = self.options.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) @@ -404,93 +290,96 @@ def generate(self): 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"] = self.options.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_COMPUTE"] = bool(self.options.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["ARROW_JEMALLOC"] = self.options.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(): - tc.variables["ARROW_PROTOBUF_USE_SHARED"] = bool(self.options["protobuf"].shared) + if self.options.with_protobuf: + tc.variables["ARROW_PROTOBUF_USE_SHARED"] = bool(self.dependencies["protobuf"].options.shared) tc.variables["gRPC_SOURCE"] = "SYSTEM" - if self._with_grpc(): - tc.variables["ARROW_GRPC_USE_SHARED"] = bool(self.options["grpc"].shared) + if self.options.with_grpc: + tc.variables["ARROW_GRPC_USE_SHARED"] = bool(self.dependencies["grpc"].options.shared) - tc.variables["ARROW_USE_GLOG"] = self._with_glog() + tc.variables["ARROW_USE_GLOG"] = self.options.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["ARROW_WITH_RE2"] = bool(self.options.with_re2) tc.variables["brotli_SOURCE"] = "SYSTEM" if self.options.with_brotli: - tc.variables["ARROW_BROTLI_USE_SHARED"] = bool(self.options["brotli"].shared) + tc.variables["ARROW_BROTLI_USE_SHARED"] = bool(self.dependencies["brotli"].options.shared) tc.variables["gflags_SOURCE"] = "SYSTEM" - if self._with_gflags(): - tc.variables["ARROW_GFLAGS_USE_SHARED"] = bool(self.options["gflags"].shared) + if self.options.with_gflags: + tc.variables["ARROW_GFLAGS_USE_SHARED"] = bool(self.dependencies["gflags"].options.shared) tc.variables["ARROW_WITH_BZ2"] = bool(self.options.with_bz2) tc.variables["BZip2_SOURCE"] = "SYSTEM" if self.options.with_bz2: - tc.variables["ARROW_BZ2_USE_SHARED"] = bool(self.options["bzip2"].shared) + tc.variables["ARROW_BZ2_USE_SHARED"] = bool(self.dependencies["bzip2"].options.shared) tc.variables["ARROW_WITH_LZ4"] = bool(self.options.with_lz4) tc.variables["lz4_SOURCE"] = "SYSTEM" if self.options.with_lz4: - tc.variables["ARROW_LZ4_USE_SHARED"] = bool(self.options["lz4"].shared) + tc.variables["ARROW_LZ4_USE_SHARED"] = bool(self.dependencies["lz4"].options.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: - tc.variables["ARROW_SNAPPY_USE_SHARED"] = bool(self.options["snappy"].shared) + tc.variables["ARROW_SNAPPY_USE_SHARED"] = bool(self.dependencies["snappy"].options.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: - tc.variables["ZSTD_SOURCE"] = "SYSTEM" + 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() if self.options.with_zstd: - tc.variables["ARROW_ZSTD_USE_SHARED"] = bool(self.options["zstd"].shared) + tc.variables["ARROW_ZSTD_USE_SHARED"] = bool(self.dependencies["zstd"].options.shared) tc.variables["ORC_SOURCE"] = "SYSTEM" - tc.variables["ARROW_WITH_THRIFT"] = self._with_thrift() + tc.variables["ARROW_WITH_THRIFT"] = bool(self.options.with_thrift) + tc.variables["ARROW_THRIFT"] = bool(self.options.with_thrift) tc.variables["Thrift_SOURCE"] = "SYSTEM" - if self._with_thrift(): - 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(): - 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(): + if self.options.with_thrift: + tc.variables["ARROW_THRIFT"] = True + tc.variables["THRIFT_VERSION"] = bool(self.dependencies["thrift"].ref.version) # a recent thrift does not require boost + tc.variables["ARROW_THRIFT_USE_SHARED"] = bool(self.dependencies["thrift"].options.shared) + tc.variables["ARROW_USE_OPENSSL"] = self.options.with_openssl + if self.options.with_openssl: + tc.variables["OPENSSL_ROOT_DIR"] = self.dependencies["openssl"].package_folder.replace("\\", "/") + tc.variables["ARROW_OPENSSL_USE_SHARED"] = bool(self.dependencies["openssl"].options.shared) + if self.options.with_boost: tc.variables["ARROW_USE_BOOST"] = True - tc.variables["ARROW_BOOST_USE_SHARED"] = bool(self.options["boost"].shared) + tc.variables["ARROW_BOOST_USE_SHARED"] = bool(self.dependencies["boost"].options.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"] = 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["ARROW_WITH_UTF8PROC"] = self.options.with_utf8proc + tc.variables["ARROW_BOOST_REQUIRED"] = self.options.with_boost tc.variables["utf8proc_SOURCE"] = "SYSTEM" - if self._with_utf8proc(): - tc.variables["ARROW_UTF8PROC_USE_SHARED"] = bool(self.options["utf8proc"].shared) + if self.options.with_utf8proc: + tc.variables["ARROW_UTF8PROC_USE_SHARED"] = bool(self.dependencies["utf8proc"].options.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(): - tc.variables["LLVM_DIR"] = self.deps_cpp_info["llvm-core"].rootpath.replace("\\", "/") + tc.variables["ARROW_USE_STATIC_CRT"] = is_msvc_static_runtime(self) + if self.options.with_llvm: + tc.variables["LLVM_DIR"] = self.dependencies["llvm-core"].package_folder.replace("\\", "/") + + tc.cache_variables["CMAKE_PROJECT_arrow_INCLUDE"] = os.path.join(self.source_folder, "conan_cmake_project_include.cmake") tc.generate() deps = CMakeDeps(self) @@ -498,10 +387,11 @@ def generate(self): def _patch_sources(self): apply_conandata_patches(self) - if Version(self.version) >= "7.0.0": + if 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", + "FindArrowAcero.cmake", "FindArrowCUDA.cmake", "FindArrowDataset.cmake", "FindArrowFlight.cmake", @@ -513,145 +403,164 @@ def _patch_sources(self): "FindArrowTesting.cmake", "FindGandiva.cmake", "FindParquet.cmake", - "FindPlasma.cmake", ]: os.remove(filename) def build(self): self._patch_sources() - cmake =CMake(self) + cmake = CMake(self) cmake.configure(build_script_folder=os.path.join(self.source_folder, "cpp")) cmake.build() def package(self): 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 = 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 _lib_name(self, name): - 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_gflags = self._with_gflags() - self.info.options.with_protobuf = self._with_protobuf() - self.info.options.with_re2 = self._with_re2() - self.info.options.with_jemalloc = self._with_jemalloc() - self.info.options.with_openssl = self._with_openssl() - self.info.options.with_boost = self._with_boost() - self.info.options.with_glog = self._with_glog() - self.info.options.with_grpc = self._with_grpc() + cmake_suffix = "shared" if self.options.shared else "static" + + alias_map = { f"Arrow::arrow_{cmake_suffix}": f"arrow::arrow_{cmake_suffix}" } + + if self.options.parquet: + alias_map[f"Parquet::parquet_{cmake_suffix}"] = f"arrow::parquet_{cmake_suffix}" + + if self.options.get_safe("substrait"): + alias_map[f"Arrow::arrow_substrait_{cmake_suffix}"] = f"arrow::arrow_substrait_{cmake_suffix}" + + if self.options.acero: + alias_map[f"Arrow::arrow_acero_{cmake_suffix}"] = f"arrow::arrow_acero_{cmake_suffix}" + + if self.options.gandiva: + alias_map[f"Gandiva::gandiva_{cmake_suffix}"] = f"arrow::gandiva_{cmake_suffix}" + + if self.options.with_flight_rpc: + alias_map[f"ArrowFlight::arrow_flight_sql_{cmake_suffix}"] = f"arrow::arrow_flight_sql_{cmake_suffix}" + + @property + def _module_subfolder(self): + return os.path.join("lib", "cmake") def package_info(self): - self.cpp_info.filenames["cmake_find_package"] = "Arrow" - self.cpp_info.filenames["cmake_find_package_multi"] = "Arrow" - self.cpp_info.components["libarrow"].libs = [self._lib_name("arrow")] - self.cpp_info.components["libarrow"].names["cmake_find_package"] = "arrow" - self.cpp_info.components["libarrow"].names["cmake_find_package_multi"] = "arrow" - self.cpp_info.components["libarrow"].names["pkg_config"] = "arrow" + # FIXME: fix CMake targets of components + + self.cpp_info.set_property("cmake_file_name", "Arrow") + + suffix = "_static" if is_msvc(self) and not self.options.shared else "" + cmake_suffix = "shared" if self.options.shared else "static" + + self.cpp_info.components["libarrow"].set_property("pkg_config_name", "arrow") + self.cpp_info.components["libarrow"].set_property("cmake_target_name", f"Arrow::arrow_{cmake_suffix}") + self.cpp_info.components["libarrow"].libs = [f"arrow{suffix}"] if not self.options.shared: self.cpp_info.components["libarrow"].defines = ["ARROW_STATIC"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["libarrow"].system_libs = ["pthread", "m", "dl", "rt"] - if self._parquet(): - self.cpp_info.components["libparquet"].libs = [self._lib_name("parquet")] - self.cpp_info.components["libparquet"].names["cmake_find_package"] = "parquet" - self.cpp_info.components["libparquet"].names["cmake_find_package_multi"] = "parquet" - self.cpp_info.components["libparquet"].names["pkg_config"] = "parquet" + if self.options.parquet: + self.cpp_info.components["libparquet"].set_property("pkg_config_name", "parquet") + self.cpp_info.components["libparquet"].set_property("cmake_target_name", f"Parquet::parquet_{cmake_suffix}") + self.cpp_info.components["libparquet"].libs = [f"parquet{suffix}"] self.cpp_info.components["libparquet"].requires = ["libarrow"] if not self.options.shared: - self.cpp_info.components["libparquet"].defines = ["PARQUET_STATIC"] + 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")] - self.cpp_info.components["libarrow_substrait"].names["cmake_find_package"] = "arrow_substrait" - self.cpp_info.components["libarrow_substrait"].names["cmake_find_package_multi"] = "arrow_substrait" - self.cpp_info.components["libarrow_substrait"].names["pkg_config"] = "arrow_substrait" + if self.options.get_safe("substrait"): + self.cpp_info.components["libarrow_substrait"].set_property("pkg_config_name", "arrow_substrait") + self.cpp_info.components["libarrow_substrait"].set_property("cmake_target_name", f"Arrow::arrow_substrait_{cmake_suffix}") + self.cpp_info.components["libarrow_substrait"].libs = [f"arrow_substrait{suffix}"] self.cpp_info.components["libarrow_substrait"].requires = ["libparquet", "dataset"] - if self.options.plasma: - self.cpp_info.components["libplasma"].libs = [self._lib_name("plasma")] - self.cpp_info.components["libplasma"].names["cmake_find_package"] = "plasma" - self.cpp_info.components["libplasma"].names["cmake_find_package_multi"] = "plasma" - self.cpp_info.components["libplasma"].names["pkg_config"] = "plasma" - self.cpp_info.components["libplasma"].requires = ["libarrow"] + # Plasma was deprecated in Arrow 12.0.0 + del self.options.plasma + + if self.options.acero: + self.cpp_info.components["libacero"].set_property("pkg_config_name", "acero") + self.cpp_info.components["libacero"].set_property("cmake_target_name", f"Acero::arrow_acero_{cmake_suffix}") + self.cpp_info.components["libacero"].libs = [f"arrow_acero{suffix}"] + self.cpp_info.components["libacero"].names["cmake_find_package"] = "acero" + self.cpp_info.components["libacero"].names["cmake_find_package_multi"] = "acero" + self.cpp_info.components["libacero"].names["pkg_config"] = "acero" + self.cpp_info.components["libacero"].requires = ["libarrow"] if self.options.gandiva: - self.cpp_info.components["libgandiva"].libs = [self._lib_name("gandiva")] - self.cpp_info.components["libgandiva"].names["cmake_find_package"] = "gandiva" - 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"].set_property("pkg_config_name", "gandiva") + self.cpp_info.components["libgandiva"].set_property("cmake_target_name", f"Gandiva::gandiva_{cmake_suffix}") + self.cpp_info.components["libgandiva"].libs = [f"gandiva{suffix}"] self.cpp_info.components["libgandiva"].requires = ["libarrow"] if not self.options.shared: - self.cpp_info.components["libgandiva"].defines = ["GANDIVA_STATIC"] + 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")] - self.cpp_info.components["libarrow_flight"].names["cmake_find_package"] = "flight_rpc" - self.cpp_info.components["libarrow_flight"].names["cmake_find_package_multi"] = "flight_rpc" - self.cpp_info.components["libarrow_flight"].names["pkg_config"] = "flight_rpc" + if self.options.with_flight_rpc: + self.cpp_info.components["libarrow_flight"].set_property("pkg_config_name", "flight_rpc") + self.cpp_info.components["libarrow_flight"].set_property("cmake_target_name", f"ArrowFlight::arrow_flight_{cmake_suffix}") + self.cpp_info.components["libarrow_flight"].libs = [f"arrow_flight{suffix}"] self.cpp_info.components["libarrow_flight"].requires = ["libarrow"] + # https://github.com/apache/arrow/pull/43137#pullrequestreview-2267476893 + if Version(self.version) >= "18.0.0" and self.options.with_openssl: + self.cpp_info.components["libarrow_flight"].requires.append("openssl::openssl") if self.options.get_safe("with_flight_sql"): - self.cpp_info.components["libarrow_flight_sql"].libs = [self._lib_name("arrow_flight_sql")] - self.cpp_info.components["libarrow_flight_sql"].names["cmake_find_package"] = "flight_sql" - self.cpp_info.components["libarrow_flight_sql"].names["cmake_find_package_multi"] = "flight_sql" - self.cpp_info.components["libarrow_flight_sql"].names["pkg_config"] = "flight_sql" + self.cpp_info.components["libarrow_flight_sql"].set_property("pkg_config_name", "flight_sql") + self.cpp_info.components["libarrow_flight_sql"].set_property("cmake_target_name", f"ArrowFlightSql::arrow_flight_sql_{cmake_suffix}") + self.cpp_info.components["libarrow_flight_sql"].libs = [f"arrow_flight_sql{suffix}"] self.cpp_info.components["libarrow_flight_sql"].requires = ["libarrow", "libarrow_flight"] - if self._dataset_modules(): + if self.options.dataset_modules: self.cpp_info.components["dataset"].libs = ["arrow_dataset"] + if self.options.parquet: + self.cpp_info.components["dataset"].requires = ["libparquet"] - if (self.options.cli and (self.options.with_cuda or self._with_flight_rpc() or self._parquet())) or self.options.plasma: + if self.options.cli and (self.options.with_cuda or self.options.with_flight_rpc or self.options.parquet): binpath = os.path.join(self.package_folder, "bin") self.output.info(f"Appending PATH env var: {binpath}") self.env_info.PATH.append(binpath) - if self._with_boost(): + if self.options.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 < Version("4.9"): + if self.options.parquet and self.settings.compiler == "gcc" and self.settings.compiler.version < Version("4.9"): self.cpp_info.components["libparquet"].requires.append("boost::boost") - 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(): + # FIXME: only headers components is used + self.cpp_info.components["libarrow"].requires.append("boost::boost") + if self.options.with_openssl: self.cpp_info.components["libarrow"].requires.append("openssl::openssl") - if self._with_gflags(): + if self.options.with_gflags: self.cpp_info.components["libarrow"].requires.append("gflags::gflags") - if self._with_glog(): + if self.options.with_glog: self.cpp_info.components["libarrow"].requires.append("glog::glog") - if self._with_jemalloc(): + if self.options.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._with_llvm(): + if self.options.with_re2: + if self.options.gandiva: + self.cpp_info.components["libgandiva"].requires.append("re2::re2") + if self.options.parquet: + self.cpp_info.components["libparquet"].requires.append("re2::re2") + self.cpp_info.components["libarrow"].requires.append("re2::re2") + if self.options.with_llvm: self.cpp_info.components["libgandiva"].requires.append("llvm-core::llvm-core") - if self._with_protobuf(): + if self.options.with_protobuf: self.cpp_info.components["libarrow"].requires.append("protobuf::protobuf") - if self._with_utf8proc(): + if self.options.with_utf8proc: self.cpp_info.components["libarrow"].requires.append("utf8proc::utf8proc") - if self._with_thrift(): + if self.options.with_thrift: self.cpp_info.components["libarrow"].requires.append("thrift::thrift") if self.options.with_backtrace: 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._with_rapidjson(): + if self._requires_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") + # https://github.com/apache/arrow/blob/6b268f62a8a172249ef35f093009c740c32e1f36/cpp/src/arrow/CMakeLists.txt#L98 + self.cpp_info.components["libarrow"].requires.extend([f"aws-sdk-cpp::{x}" for x in ["cognito-identity", "core", "identity-management", "s3", "sts"]]) if self.options.get_safe("with_gcs"): self.cpp_info.components["libarrow"].requires.append("google-cloud-cpp::storage") if self.options.with_orc: @@ -672,9 +581,7 @@ 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(): + if self.options.with_grpc: self.cpp_info.components["libarrow"].requires.append("grpc::grpc") - if self._with_flight_rpc(): + if self.options.with_flight_rpc: self.cpp_info.components["libarrow_flight"].requires.append("protobuf::protobuf") diff --git a/recipes/arrow/all/patches/1.0.0-0003-fix-shared-msvc.patch b/recipes/arrow/all/patches/1.0.0-0003-fix-shared-msvc.patch deleted file mode 100644 index 3c7e86d5ff279..0000000000000 --- a/recipes/arrow/all/patches/1.0.0-0003-fix-shared-msvc.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- cpp/src/arrow/CMakeLists.txt -+++ cpp/src/arrow/CMakeLists.txt -@@ -490,6 +490,10 @@ - target_compile_definitions(arrow_static PUBLIC ARROW_STATIC) - endif() - -+if(ARROW_BUILD_SHARED AND WIN32) -+target_compile_definitions(arrow_shared PRIVATE ARROW_EXPORTING) -+endif() -+ - if(ARROW_WITH_BACKTRACE) - find_package(Backtrace) - 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 deleted file mode 100644 index 5f0f6f4c52d5c..0000000000000 --- a/recipes/arrow/all/patches/1.0.0-0005-fix-make12-namespace.patch +++ /dev/null @@ -1,22 +0,0 @@ -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 deleted file mode 100644 index eb6816262214b..0000000000000 --- a/recipes/arrow/all/patches/1.0.0-0006-fix-cmake.patch +++ /dev/null @@ -1,333 +0,0 @@ -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/10.0.0-0001-mallctl-takes-size_t.patch b/recipes/arrow/all/patches/10.0.0-0001-mallctl-takes-size_t.patch deleted file mode 100644 index e16b57925f4b1..0000000000000 --- a/recipes/arrow/all/patches/10.0.0-0001-mallctl-takes-size_t.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/cpp/src/arrow/memory_pool_jemalloc.cc b/cpp/src/arrow/memory_pool_jemalloc.cc -index c7d73c8..34c7c63 100644 ---- a/cpp/src/arrow/memory_pool_jemalloc.cc -+++ b/cpp/src/arrow/memory_pool_jemalloc.cc -@@ -140,7 +140,7 @@ void JemallocAllocator::ReleaseUnused() { - } while (0) - - Status jemalloc_set_decay_ms(int ms) { -- 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/10.0.0-0002-fix-cmake.patch b/recipes/arrow/all/patches/10.0.0-0002-fix-cmake.patch deleted file mode 100644 index 62ee1a4570d30..0000000000000 --- a/recipes/arrow/all/patches/10.0.0-0002-fix-cmake.patch +++ /dev/null @@ -1,311 +0,0 @@ -diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt -index 029f13f..3518a23 100644 ---- a/cpp/CMakeLists.txt -+++ b/cpp/CMakeLists.txt -@@ -659,7 +659,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_SHARED_LINK_LIBS ${ARROW_BROTLI_LIBS}) - list(APPEND ARROW_STATIC_LINK_LIBS ${ARROW_BROTLI_LIBS}) - if(Brotli_SOURCE STREQUAL "SYSTEM") -@@ -675,14 +675,21 @@ if(ARROW_WITH_BZ2) - endif() - - if(ARROW_WITH_LZ4) -- list(APPEND ARROW_STATIC_LINK_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) -+ 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_TARGET}) -+ list(APPEND ARROW_STATIC_LINK_LIBS Snappy::snappy) - if(Snappy_SOURCE STREQUAL "SYSTEM") - list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS ${Snappy_TARGET}) - endif() -diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake -index b7cd31f..78f3df3 100644 ---- a/cpp/cmake_modules/ThirdpartyToolchain.cmake -+++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake -@@ -1162,10 +1162,12 @@ endmacro() - - if(ARROW_WITH_SNAPPY) - resolve_dependency(Snappy -- HAVE_ALT -+ USE_CONFIG - TRUE - PC_PACKAGE_NAMES - snappy) -+ -+ if(0) - if(${Snappy_SOURCE} STREQUAL "SYSTEM" AND NOT snappy_PC_FOUND) - get_target_property(SNAPPY_TYPE ${Snappy_TARGET} TYPE) - if(NOT SNAPPY_TYPE STREQUAL "INTERFACE_LIBRARY") -@@ -1180,6 +1182,9 @@ if(ARROW_WITH_SNAPPY) - string(APPEND ARROW_PC_LIBS_PRIVATE " ${SNAPPY_LIB}") - endif() - endif() -+ else() -+ string(APPEND ARROW_PC_LIBS_PRIVATE " ${Snappy_LIBRARIES}") -+ endif() - endif() - - # ---------------------------------------------------------------------- -@@ -1242,7 +1247,7 @@ macro(build_brotli) - endmacro() - - if(ARROW_WITH_BROTLI) -- resolve_dependency(Brotli PC_PACKAGE_NAMES libbrotlidec libbrotlienc) -+ resolve_dependency(brotli PC_PACKAGE_NAMES libbrotlidec libbrotlienc) - endif() - - if(PARQUET_REQUIRE_ENCRYPTION AND NOT ARROW_PARQUET) -@@ -1256,7 +1261,7 @@ if(PARQUET_REQUIRE_ENCRYPTION - OR ARROW_GANDIVA) - set(OpenSSL_SOURCE "SYSTEM") - resolve_dependency(OpenSSL -- HAVE_ALT -+ USE_CONFIG - TRUE - REQUIRED_VERSION - ${ARROW_OPENSSL_REQUIRED_VERSION}) -@@ -1399,22 +1404,14 @@ 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) - -- if(NOT TARGET ${GFLAGS_LIBRARIES}) -- if(TARGET gflags::gflags_shared) -- set(GFLAGS_LIBRARIES gflags::gflags_shared) -- elseif(TARGET gflags-shared) -- set(GFLAGS_LIBRARIES gflags-shared) -- elseif(TARGET gflags_shared) -- set(GFLAGS_LIBRARIES gflags_shared) -- endif() -- endif() -+ set(GFLAGS_LIBRARIES gflags::gflags) - endif() - - # ---------------------------------------------------------------------- -@@ -1638,7 +1635,7 @@ if(ARROW_WITH_PROTOBUF) - set(ARROW_PROTOBUF_REQUIRED_VERSION "2.6.1") - endif() - resolve_dependency(Protobuf -- HAVE_ALT -+ USE_CONFIG - TRUE - REQUIRED_VERSION - ${ARROW_PROTOBUF_REQUIRED_VERSION} -@@ -1770,7 +1767,7 @@ 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) -@@ -1781,6 +1778,8 @@ macro(build_substrait) - list(APPEND ARROW_BUNDLED_STATIC_LIBS substrait) - endmacro() - -+set(CMAKE_VERBOSE_MAKEFILE ON) -+ - if(ARROW_SUBSTRAIT) - # Currently, we can only build Substrait from source. - set(Substrait_SOURCE "BUNDLED") -@@ -1866,7 +1865,10 @@ macro(build_jemalloc) - endmacro() - - if(ARROW_JEMALLOC) -- resolve_dependency(jemalloc) -+ #resolve_dependency(jemalloc) -+ find_package(jemalloc REQUIRED CONFIG) -+ include_directories(SYSTEM "${jemalloc_INCLUDE_DIR}") -+ list(APPEND ARROW_BUNDLED_STATIC_LIBS ${jemalloc_LIBRARIES_TARGETS}) - endif() - - # ---------------------------------------------------------------------- -@@ -2186,7 +2188,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} -@@ -2334,19 +2336,29 @@ macro(build_lz4) - BUILD_BYPRODUCTS ${LZ4_STATIC_LIB}) - - file(MAKE_DIRECTORY "${LZ4_PREFIX}/include") -- add_library(LZ4::lz4 STATIC IMPORTED) -- set_target_properties(LZ4::lz4 -- PROPERTIES IMPORTED_LOCATION "${LZ4_STATIC_LIB}" -- INTERFACE_INCLUDE_DIRECTORIES "${LZ4_PREFIX}/include") -- add_dependencies(toolchain lz4_ep) -- add_dependencies(LZ4::lz4 lz4_ep) -- -- list(APPEND ARROW_BUNDLED_STATIC_LIBS LZ4::lz4) -+ if (TARGET LZ4::lz4_static) -+ add_library(LZ4::lz4_static STATIC IMPORTED) -+ set_target_properties(LZ4::lz4_static -+ PROPERTIES IMPORTED_LOCATION "${LZ4_STATIC_LIB}" -+ INTERFACE_INCLUDE_DIRECTORIES "${LZ4_PREFIX}/include") -+ add_dependencies(toolchain lz4_ep) -+ add_dependencies(LZ4::lz4_static lz4_ep) -+ list(APPEND ARROW_BUNDLED_STATIC_LIBS LZ4::lz4_static) -+ else() -+ add_library(LZ4::lz4_shared STATIC IMPORTED) -+ set_target_properties(LZ4::lz4_shared -+ PROPERTIES IMPORTED_LOCATION "${LZ4_SHARED_LIB}" -+ INTERFACE_INCLUDE_DIRECTORIES "${LZ4_PREFIX}/include") -+ add_dependencies(toolchain lz4_ep) -+ add_dependencies(LZ4::lz4_shared lz4_ep) -+ list(APPEND ARROW_BUNDLED_STATIC_LIBS LZ4::lz4_shared) -+ endif() -+ - endmacro() - - if(ARROW_WITH_LZ4) - resolve_dependency(lz4 -- HAVE_ALT -+ USE_CONFIG - TRUE - PC_PACKAGE_NAMES - liblz4) -@@ -2415,7 +2427,7 @@ endmacro() - if(ARROW_WITH_ZSTD) - # ARROW-13384: ZSTD_minCLevel was added in v1.4.0, required by ARROW-13091 - resolve_dependency(zstd -- HAVE_ALT -+ USE_CONFIG - TRUE - PC_PACKAGE_NAMES - libzstd -@@ -2477,7 +2489,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_TYPE re2::re2 TYPE) - if(NOT RE2_TYPE STREQUAL "INTERFACE_LIBRARY") -@@ -3922,7 +3934,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} -@@ -3939,9 +3951,9 @@ if(ARROW_WITH_GRPC) - get_target_property(GRPC_INCLUDE_DIR gRPC::grpc++ INTERFACE_INCLUDE_DIRECTORIES) - if(GRPC_INCLUDE_DIR MATCHES "^\\$<" - OR # generator expression -- EXISTS "${GRPC_INCLUDE_DIR}/grpcpp/impl/codegen/config_protobuf.h") -+ 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}") -@@ -4282,8 +4294,11 @@ macro(build_orc) - get_target_property(ORC_SNAPPY_INCLUDE_DIR ${Snappy_TARGET} - INTERFACE_INCLUDE_DIRECTORIES) - get_filename_component(ORC_SNAPPY_ROOT "${ORC_SNAPPY_INCLUDE_DIR}" DIRECTORY) -- -- get_target_property(ORC_LZ4_ROOT LZ4::lz4 INTERFACE_INCLUDE_DIRECTORIES) -+ if (TARGET LZ4::lz4_static) -+ get_target_property(ORC_LZ4_ROOT LZ4::lz4_static INTERFACE_INCLUDE_DIRECTORIES) -+ else() -+ get_target_property(ORC_LZ4_ROOT LZ4::lz4_shared INTERFACE_INCLUDE_DIRECTORIES) -+ endif() - get_filename_component(ORC_LZ4_ROOT "${ORC_LZ4_ROOT}" DIRECTORY) - - get_target_property(ORC_ZSTD_ROOT ${ARROW_ZSTD_LIBZSTD} INTERFACE_INCLUDE_DIRECTORIES) -@@ -4321,16 +4336,29 @@ macro(build_orc) - # Work around CMake bug - file(MAKE_DIRECTORY ${ORC_INCLUDE_DIR}) - -- externalproject_add(orc_ep -- URL ${ORC_SOURCE_URL} -- URL_HASH "SHA256=${ARROW_ORC_BUILD_SHA256_CHECKSUM}" -- BUILD_BYPRODUCTS ${ORC_STATIC_LIB} -- CMAKE_ARGS ${ORC_CMAKE_ARGS} ${EP_LOG_OPTIONS} -- DEPENDS ${ARROW_PROTOBUF_LIBPROTOBUF} -- ${ARROW_ZSTD_LIBZSTD} -- ${Snappy_TARGET} -- LZ4::lz4 -- ZLIB::ZLIB) -+ if (TARGET LZ4::lz4_static) -+ externalproject_add(orc_ep -+ URL ${ORC_SOURCE_URL} -+ URL_HASH "SHA256=${ARROW_ORC_BUILD_SHA256_CHECKSUM}" -+ BUILD_BYPRODUCTS ${ORC_STATIC_LIB} -+ CMAKE_ARGS ${ORC_CMAKE_ARGS} ${EP_LOG_OPTIONS} -+ DEPENDS ${ARROW_PROTOBUF_LIBPROTOBUF} -+ ${ARROW_ZSTD_LIBZSTD} -+ ${Snappy_TARGET} -+ LZ4::lz4_static -+ ZLIB::ZLIB) -+ else() -+ externalproject_add(orc_ep -+ URL ${ORC_SOURCE_URL} -+ URL_HASH "SHA256=${ARROW_ORC_BUILD_SHA256_CHECKSUM}" -+ BUILD_BYPRODUCTS ${ORC_STATIC_LIB} -+ CMAKE_ARGS ${ORC_CMAKE_ARGS} ${EP_LOG_OPTIONS} -+ DEPENDS ${ARROW_PROTOBUF_LIBPROTOBUF} -+ ${ARROW_ZSTD_LIBZSTD} -+ ${Snappy_TARGET} -+ LZ4::lz4_shared -+ ZLIB::ZLIB) -+ endif() - - set(ORC_VENDORED 1) - -@@ -4338,7 +4366,11 @@ macro(build_orc) - set_target_properties(orc::liborc - PROPERTIES IMPORTED_LOCATION "${ORC_STATIC_LIB}" - INTERFACE_INCLUDE_DIRECTORIES "${ORC_INCLUDE_DIR}") -- set(ORC_LINK_LIBRARIES LZ4::lz4 ZLIB::ZLIB ${ARROW_ZSTD_LIBZSTD} ${Snappy_TARGET}) -+ if (TARGET LZ4::lz4_static) -+ set(ORC_LINK_LIBRARIES LZ4::lz4_static ZLIB::ZLIB ${ARROW_ZSTD_LIBZSTD} ${Snappy_TARGET}) -+ else() -+ set(ORC_LINK_LIBRARIES LZ4::lz4_shared ZLIB::ZLIB ${ARROW_ZSTD_LIBZSTD} ${Snappy_TARGET}) -+ endif() - if(NOT MSVC) - if(NOT APPLE) - list(APPEND ORC_LINK_LIBRARIES Threads::Threads) -@@ -4765,7 +4797,7 @@ macro(build_awssdk) - endmacro() - - if(ARROW_S3) -- resolve_dependency(AWSSDK HAVE_ALT TRUE) -+ resolve_dependency(AWSSDK USE_CONFIG TRUE) - - message(STATUS "Found AWS SDK headers: ${AWSSDK_INCLUDE_DIR}") - message(STATUS "Found AWS SDK libraries: ${AWSSDK_LINK_LIBRARIES}") diff --git a/recipes/arrow/all/patches/11.0.0-0001-fix-cmake.patch b/recipes/arrow/all/patches/11.0.0-0001-fix-cmake.patch new file mode 100644 index 0000000000000..1d5a752548ee2 --- /dev/null +++ b/recipes/arrow/all/patches/11.0.0-0001-fix-cmake.patch @@ -0,0 +1,42 @@ +diff --git a/cpp/cmake_modules/FindThriftAlt.cmake b/cpp/cmake_modules/FindThriftAlt.cmake +index f3e49021d..95177c2a6 100644 +--- a/cpp/cmake_modules/FindThriftAlt.cmake ++++ b/cpp/cmake_modules/FindThriftAlt.cmake +@@ -45,22 +45,21 @@ endif() + # * https://github.com/apache/thrift/pull/2725 + # * https://github.com/apache/thrift/pull/2726 + # * https://github.com/conda-forge/thrift-cpp-feedstock/issues/68 +-if(NOT WIN32) +- set(find_package_args "") +- if(ThriftAlt_FIND_VERSION) +- list(APPEND find_package_args ${ThriftAlt_FIND_VERSION}) +- endif() +- if(ThriftAlt_FIND_QUIETLY) +- list(APPEND find_package_args QUIET) +- endif() +- find_package(Thrift ${find_package_args}) +- if(Thrift_FOUND) +- set(ThriftAlt_FOUND TRUE) +- add_executable(thrift::compiler IMPORTED) +- set_target_properties(thrift::compiler PROPERTIES IMPORTED_LOCATION +- "${THRIFT_COMPILER}") +- return() +- endif() ++ ++set(find_package_args "") ++if(ThriftAlt_FIND_VERSION) ++ list(APPEND find_package_args ${ThriftAlt_FIND_VERSION}) ++endif() ++if(ThriftAlt_FIND_QUIETLY) ++ list(APPEND find_package_args QUIET) ++endif() ++find_package(Thrift ${find_package_args}) ++if(Thrift_FOUND) ++ set(ThriftAlt_FOUND TRUE) ++ add_executable(thrift::compiler IMPORTED) ++ set_target_properties(thrift::compiler PROPERTIES IMPORTED_LOCATION ++ "${THRIFT_COMPILER}") ++ return() + endif() + + function(extract_thrift_version) diff --git a/recipes/arrow/all/patches/16.0.0-0001-fix-cmake.patch b/recipes/arrow/all/patches/16.0.0-0001-fix-cmake.patch new file mode 100644 index 0000000000000..8c11ce258bb15 --- /dev/null +++ b/recipes/arrow/all/patches/16.0.0-0001-fix-cmake.patch @@ -0,0 +1,62 @@ +diff --git a/cpp/cmake_modules/FindThriftAlt.cmake b/cpp/cmake_modules/FindThriftAlt.cmake +index f3e49021d..3e63f1edf 100644 +--- a/cpp/cmake_modules/FindThriftAlt.cmake ++++ b/cpp/cmake_modules/FindThriftAlt.cmake +@@ -45,23 +45,23 @@ endif() + # * https://github.com/apache/thrift/pull/2725 + # * https://github.com/apache/thrift/pull/2726 + # * https://github.com/conda-forge/thrift-cpp-feedstock/issues/68 +-if(NOT WIN32) +- set(find_package_args "") +- if(ThriftAlt_FIND_VERSION) +- list(APPEND find_package_args ${ThriftAlt_FIND_VERSION}) +- endif() +- if(ThriftAlt_FIND_QUIETLY) +- list(APPEND find_package_args QUIET) +- endif() +- find_package(Thrift ${find_package_args}) +- if(Thrift_FOUND) +- set(ThriftAlt_FOUND TRUE) +- add_executable(thrift::compiler IMPORTED) +- set_target_properties(thrift::compiler PROPERTIES IMPORTED_LOCATION +- "${THRIFT_COMPILER}") +- return() +- endif() ++ ++set(find_package_args "") ++if(ThriftAlt_FIND_VERSION) ++ list(APPEND find_package_args ${ThriftAlt_FIND_VERSION}) ++endif() ++if(ThriftAlt_FIND_QUIETLY) ++ list(APPEND find_package_args QUIET) + endif() ++find_package(Thrift ${find_package_args}) ++if(Thrift_FOUND) ++ set(ThriftAlt_FOUND TRUE) ++ add_executable(thrift::compiler IMPORTED) ++ set_target_properties(thrift::compiler PROPERTIES IMPORTED_LOCATION ++ "${THRIFT_COMPILER}") ++ return() ++endif() ++ + + function(extract_thrift_version) + if(ThriftAlt_INCLUDE_DIR) +diff --git a/cpp/src/parquet/CMakeLists.txt b/cpp/src/parquet/CMakeLists.txt +index 93f2e72d8..e00f73f7d 100644 +--- a/cpp/src/parquet/CMakeLists.txt ++++ b/cpp/src/parquet/CMakeLists.txt +@@ -262,11 +262,11 @@ if(NOT PARQUET_MINIMAL_DEPENDENCY) + + # These are libraries that we will link privately with parquet_shared (as they + # do not need to be linked transitively by other linkers) +- list(APPEND PARQUET_SHARED_PRIVATE_LINK_LIBS thrift::thrift) ++ list(APPEND PARQUET_SHARED_PRIVATE_LINK_LIBS Boost::headers thrift::thrift) + + # Link publicly with parquet_static (because internal users need to + # transitively link all dependencies) +- list(APPEND PARQUET_STATIC_LINK_LIBS thrift::thrift) ++ list(APPEND PARQUET_STATIC_LINK_LIBS Boost::headers thrift::thrift) + if(NOT THRIFT_VENDORED) + list(APPEND PARQUET_STATIC_INSTALL_INTERFACE_LIBS thrift::thrift) + endif() diff --git a/recipes/arrow/all/patches/18.0.0-0001-fix-cmake.patch b/recipes/arrow/all/patches/18.0.0-0001-fix-cmake.patch new file mode 100644 index 0000000000000..1000d42f4af61 --- /dev/null +++ b/recipes/arrow/all/patches/18.0.0-0001-fix-cmake.patch @@ -0,0 +1,59 @@ +diff --git a/cpp/cmake_modules/FindThriftAlt.cmake b/cpp/cmake_modules/FindThriftAlt.cmake +index 98a706d..edf195e 100644 +--- a/cpp/cmake_modules/FindThriftAlt.cmake ++++ b/cpp/cmake_modules/FindThriftAlt.cmake +@@ -45,22 +45,20 @@ endif() + # * https://github.com/apache/thrift/pull/2725 + # * https://github.com/apache/thrift/pull/2726 + # * https://github.com/conda-forge/thrift-cpp-feedstock/issues/68 +-if(NOT WIN32) +- set(find_package_args "") +- if(ThriftAlt_FIND_VERSION) +- list(APPEND find_package_args ${ThriftAlt_FIND_VERSION}) +- endif() +- if(ThriftAlt_FIND_QUIETLY) +- list(APPEND find_package_args QUIET) +- endif() +- find_package(Thrift ${find_package_args}) +- if(Thrift_FOUND) +- set(ThriftAlt_FOUND TRUE) +- add_executable(thrift::compiler IMPORTED) +- set_target_properties(thrift::compiler PROPERTIES IMPORTED_LOCATION +- "${THRIFT_COMPILER}") +- return() +- endif() ++set(find_package_args "") ++if(ThriftAlt_FIND_VERSION) ++ list(APPEND find_package_args ${ThriftAlt_FIND_VERSION}) ++endif() ++if(ThriftAlt_FIND_QUIETLY) ++ list(APPEND find_package_args QUIET) ++endif() ++find_package(Thrift ${find_package_args}) ++if(Thrift_FOUND) ++ set(ThriftAlt_FOUND TRUE) ++ add_executable(thrift::compiler IMPORTED) ++ set_target_properties(thrift::compiler PROPERTIES IMPORTED_LOCATION ++ "${THRIFT_COMPILER}") ++ return() + endif() + + function(extract_thrift_version) +diff --git a/cpp/src/parquet/CMakeLists.txt b/cpp/src/parquet/CMakeLists.txt +index b984ef7..429fc6d 100644 +--- a/cpp/src/parquet/CMakeLists.txt ++++ b/cpp/src/parquet/CMakeLists.txt +@@ -263,11 +263,11 @@ if(NOT PARQUET_MINIMAL_DEPENDENCY) + + # These are libraries that we will link privately with parquet_shared (as they + # do not need to be linked transitively by other linkers) +- list(APPEND PARQUET_SHARED_PRIVATE_LINK_LIBS thrift::thrift) ++ list(APPEND PARQUET_SHARED_PRIVATE_LINK_LIBS Boost::headers thrift::thrift) + + # Link publicly with parquet_static (because internal users need to + # transitively link all dependencies) +- list(APPEND PARQUET_STATIC_LINK_LIBS thrift::thrift) ++ list(APPEND PARQUET_STATIC_LINK_LIBS Boost::headers thrift::thrift) + if(NOT THRIFT_VENDORED) + list(APPEND PARQUET_STATIC_INSTALL_INTERFACE_LIBS thrift::thrift) + endif() diff --git a/recipes/arrow/all/patches/2.0.0-0003-fix-shared-msvc.patch b/recipes/arrow/all/patches/2.0.0-0003-fix-shared-msvc.patch deleted file mode 100644 index f3268abf74e2c..0000000000000 --- a/recipes/arrow/all/patches/2.0.0-0003-fix-shared-msvc.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- cpp/src/arrow/CMakeLists.txt -+++ cpp/src/arrow/CMakeLists.txt -@@ -504,6 +504,10 @@ - target_compile_definitions(arrow_static PUBLIC ARROW_STATIC) - endif() - -+if(ARROW_BUILD_SHARED AND WIN32) -+target_compile_definitions(arrow_shared PRIVATE ARROW_EXPORTING) -+endif() -+ - if(ARROW_WITH_BACKTRACE) - find_package(Backtrace) - diff --git a/recipes/arrow/all/patches/2.0.0-0005-gandiva-engine.patch b/recipes/arrow/all/patches/2.0.0-0005-gandiva-engine.patch deleted file mode 100644 index 9fcc4b1a36a8a..0000000000000 --- a/recipes/arrow/all/patches/2.0.0-0005-gandiva-engine.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- cpp/src/gandiva/engine.cc -+++ cpp/src/gandiva/engine.cc -@@ -64,6 +64,10 @@ - #include - #include - -+#if GANDIVA_LLVM_VERSION >= 11 -+#include -+#endif -+ - #if defined(_MSC_VER) - #pragma warning(pop) - #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 deleted file mode 100644 index 7153d641e0c61..0000000000000 --- a/recipes/arrow/all/patches/2.0.0-0008-fix-cmake.patch +++ /dev/null @@ -1,273 +0,0 @@ -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-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-0006-install-utils.patch b/recipes/arrow/all/patches/7.0.0-0006-install-utils.patch deleted file mode 100644 index 468fe3a6a6ab5..0000000000000 --- a/recipes/arrow/all/patches/7.0.0-0006-install-utils.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/cpp/src/arrow/ipc/CMakeLists.txt b/cpp/src/arrow/ipc/CMakeLists.txt -index 495018e..f6cee6f 100644 ---- a/cpp/src/arrow/ipc/CMakeLists.txt -+++ b/cpp/src/arrow/ipc/CMakeLists.txt -@@ -61,8 +61,12 @@ endif() - if(ARROW_BUILD_UTILITIES OR ARROW_BUILD_INTEGRATION) - add_executable(arrow-file-to-stream file_to_stream.cc) - target_link_libraries(arrow-file-to-stream ${ARROW_UTIL_LIB}) -+ install(TARGETS arrow-file-to-stream ${INSTALL_IS_OPTIONAL} -+ DESTINATION ${CMAKE_INSTALL_BINDIR}) - add_executable(arrow-stream-to-file stream_to_file.cc) - target_link_libraries(arrow-stream-to-file ${ARROW_UTIL_LIB}) -+ install(TARGETS arrow-stream-to-file ${INSTALL_IS_OPTIONAL} -+ DESTINATION ${CMAKE_INSTALL_BINDIR}) - - if(ARROW_BUILD_INTEGRATION) - add_dependencies(arrow-integration arrow-file-to-stream) 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 deleted file mode 100644 index 8b4d5d5518dcc..0000000000000 --- a/recipes/arrow/all/patches/7.0.0-0007-fix-cmake.patch +++ /dev/null @@ -1,347 +0,0 @@ -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-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-0005-install-utils.patch b/recipes/arrow/all/patches/8.0.0-0005-install-utils.patch deleted file mode 100644 index 397c4b1d043c7..0000000000000 --- a/recipes/arrow/all/patches/8.0.0-0005-install-utils.patch +++ /dev/null @@ -1,43 +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/src/arrow/ipc/CMakeLists.txt b/cpp/src/arrow/ipc/CMakeLists.txt -index 495018e..3dcb35d 100644 ---- a/cpp/src/arrow/ipc/CMakeLists.txt -+++ b/cpp/src/arrow/ipc/CMakeLists.txt -@@ -61,9 +61,13 @@ endif() - if(ARROW_BUILD_UTILITIES OR ARROW_BUILD_INTEGRATION) - add_executable(arrow-file-to-stream file_to_stream.cc) - target_link_libraries(arrow-file-to-stream ${ARROW_UTIL_LIB}) -+ install(TARGETS arrow-file-to-stream ${INSTALL_IS_OPTIONAL} -+ DESTINATION ${CMAKE_INSTALL_BINDIR}) - add_executable(arrow-stream-to-file stream_to_file.cc) - target_link_libraries(arrow-stream-to-file ${ARROW_UTIL_LIB}) -- -+ install(TARGETS arrow-stream-to-file ${INSTALL_IS_OPTIONAL} -+ DESTINATION ${CMAKE_INSTALL_BINDIR}) -+ - if(ARROW_BUILD_INTEGRATION) - add_dependencies(arrow-integration arrow-file-to-stream) - add_dependencies(arrow-integration arrow-stream-to-file) 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 deleted file mode 100644 index eb60d6e795ad5..0000000000000 --- a/recipes/arrow/all/patches/8.0.0-0006-fix-cmake.patch +++ /dev/null @@ -1,425 +0,0 @@ -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 9b721bbe6a17c..bd890a4dd57e5 100644 --- a/recipes/arrow/all/test_package/CMakeLists.txt +++ b/recipes/arrow/all/test_package/CMakeLists.txt @@ -4,7 +4,13 @@ project(test_package LANGUAGES CXX) find_package(Arrow REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE arrow::arrow) + +if (TARGET Arrow::arrow_shared) + target_link_libraries(${PROJECT_NAME} PRIVATE Arrow::arrow_shared) +else() + target_link_libraries(${PROJECT_NAME} PRIVATE Arrow::arrow_static) +endif() + if (${Arrow_VERSION} VERSION_LESS "10.0.0") target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) else() diff --git a/recipes/arrow/all/test_package/conanfile.py b/recipes/arrow/all/test_package/conanfile.py index 1111583fea732..a9fb96656f203 100644 --- a/recipes/arrow/all/test_package/conanfile.py +++ b/recipes/arrow/all/test_package/conanfile.py @@ -4,7 +4,6 @@ import os -# It will become the standard on Conan 2.x class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" diff --git a/recipes/arrow/all/test_v1_package/CMakeLists.txt b/recipes/arrow/all/test_v1_package/CMakeLists.txt deleted file mode 100644 index 2a9b48732268c..0000000000000 --- a/recipes/arrow/all/test_v1_package/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 3.1) - -project(test_package) - -include(${CMAKE_BINARY_DIR}/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/config.yml b/recipes/arrow/config.yml index 2b8b263889ae5..243d0f929268c 100644 --- a/recipes/arrow/config.yml +++ b/recipes/arrow/config.yml @@ -1,13 +1,13 @@ versions: - "10.0.0": + "18.1.0": folder: all - "8.0.1": + "18.0.0": folder: all - "8.0.0": + "17.0.0": folder: all - "7.0.0": + "16.1.0": folder: all - "2.0.0": - folder: all - "1.0.0": + "15.0.0": folder: all + "14.0.2": + folder: all \ No newline at end of file diff --git a/recipes/arsenalgear/all/conandata.yml b/recipes/arsenalgear/all/conandata.yml index b30bf921ec7e0..b4fd8ef5a1604 100644 --- a/recipes/arsenalgear/all/conandata.yml +++ b/recipes/arsenalgear/all/conandata.yml @@ -1,7 +1,23 @@ sources: + "2.1.1": + url: "https://github.com/JustWhit3/arsenalgear-cpp/archive/refs/tags/v2.1.1.tar.gz" + sha256: "5bcad6f0a2dfa3c271a532d60bfd7e45dd150fdd3c12503354718ff2b62ce967" + "2.1.0": + url: "https://github.com/JustWhit3/arsenalgear-cpp/archive/refs/tags/v2.1.0.tar.gz" + sha256: "2548a0452f3c290f4912ccc3511ae70be62ef4cd8e5d372e27423184d72785f9" "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" +patches: + "2.1.1": + - patch_file: "patches/2.1.1-0001-fix-cmake.patch" + patch_description: "disable cppcheck" + patch_type: "conan" + "2.1.0": + - patch_file: "patches/2.1.0-0001-fix-cmake.patch" + patch_description: "CMake: allow shared, honor compiler.cppstd, avoid to download and build doctest" + patch_type: "conan" + patch_source: "https://github.com/JustWhit3/arsenalgear-cpp/pull/4" diff --git a/recipes/arsenalgear/all/conanfile.py b/recipes/arsenalgear/all/conanfile.py index 5a83b05e8d8a5..b33bbef5afbfc 100644 --- a/recipes/arsenalgear/all/conanfile.py +++ b/recipes/arsenalgear/all/conanfile.py @@ -1,14 +1,14 @@ 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.build import check_min_cppstd -from conan.tools.scm import Version 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.52.0" +required_conan_version = ">=1.53.0" class ArsenalgearConan(ConanFile): name = "arsenalgear" @@ -17,6 +17,7 @@ class ArsenalgearConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/JustWhit3/arsenalgear-cpp" topics = ("constants", "math", "operators", "stream") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -28,20 +29,23 @@ class ArsenalgearConan(ConanFile): } @property - def _minimum_cpp_standard(self): + 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.0", + "apple-clang": "12", } def export_sources(self): - copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder) + export_conandata_patches(self) + if Version(self.version) < "2.1.0": + copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder) def config_options(self): if self.settings.os == "Windows": @@ -49,46 +53,50 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") def requirements(self): if Version(self.version) < "2.0.0": - self.requires("boost/1.80.0") + self.requires("boost/1.83.0") if self.settings.os in ["Linux", "Macos"]: - self.requires("exprtk/0.0.1") + # exprtk is used in public header of arsenalgear + # https://github.com/JustWhit3/arsenalgear-cpp/blob/v1.2.2/include/math.hpp + self.requires("exprtk/0.0.2", transitive_headers=True) def validate(self): - # arsenalgear doesn't support Visual Studio(yet). - if is_msvc(self): - raise ConanInvalidConfiguration(f"{self.ref} doesn't support Visual Studio(yet)") + if Version(self.version) < "2.1.0" and is_msvc(self): + raise ConanInvalidConfiguration(f"{self.ref} doesn't support Visual Studio.") - 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) + 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) - tc.variables["ARSENALGEAR_VERSION"] = str(self.version) - tc.variables["ARSENALGEAR_SRC_DIR"] = self.source_folder.replace("\\", "/") + if Version(self.version) < "2.1.0": + tc.variables["ARSENALGEAR_VERSION"] = str(self.version) + tc.variables["ARSENALGEAR_SRC_DIR"] = self.source_folder.replace("\\", "/") + else: + tc.variables["ARSENALGEAR_TESTS"] = False tc.generate() deps = CMakeDeps(self) deps.generate() def build(self): + apply_conandata_patches(self) cmake = CMake(self) - cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) + if Version(self.version) < "2.1.0": + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) + else: + cmake.configure() cmake.build() def package(self): @@ -96,7 +104,11 @@ def package(self): 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", "arsenalgear") + self.cpp_info.set_property("cmake_target_name", "arsenalgear::arsenalgear") self.cpp_info.libs = ["arsenalgear"] if self.settings.os in ["Linux", "FreeBSD"]: diff --git a/recipes/arsenalgear/all/patches/2.1.0-0001-fix-cmake.patch b/recipes/arsenalgear/all/patches/2.1.0-0001-fix-cmake.patch new file mode 100644 index 0000000000000..a54dc4ff14828 --- /dev/null +++ b/recipes/arsenalgear/all/patches/2.1.0-0001-fix-cmake.patch @@ -0,0 +1,45 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -16,27 +16,26 @@ if( EXISTS "${LOC_PATH}" ) + endif() + + # Set c++ standard options +-set( CMAKE_CXX_STANDARD 17 ) +-set( CMAKE_CXX_STANDARD_REQUIRED ON ) +-set( CMAKE_CXX_EXTENSIONS OFF ) + + # Fetching dependencies +-add_subdirectory( deps ) + + # Include directories + include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/include ) + + # Create static library +-add_library( arsenalgear STATIC ++add_library( arsenalgear + src/stream.cpp + src/system.cpp + src/utils.cpp + ) ++set_target_properties(arsenalgear PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON) ++target_compile_features(arsenalgear PUBLIC cxx_std_17) + add_library( arsenalgear::arsenalgear ALIAS arsenalgear ) + + # Compile tests + option( ARSENALGEAR_TESTS "Enable / disable tests." ON ) + if( ARSENALGEAR_TESTS ) ++ add_subdirectory( deps ) + add_subdirectory( test ) + else() + message( STATUS "Skipping tests." ) +@@ -57,7 +56,9 @@ install( + install( + TARGETS arsenalgear + EXPORT arsenalgearTargets +- DESTINATION lib ++ ARCHIVE DESTINATION lib ++ LIBRARY DESTINATION lib ++ RUNTIME DESTINATION bin + ) + + install( diff --git a/recipes/arsenalgear/all/patches/2.1.1-0001-fix-cmake.patch b/recipes/arsenalgear/all/patches/2.1.1-0001-fix-cmake.patch new file mode 100644 index 0000000000000..b982bc01e9479 --- /dev/null +++ b/recipes/arsenalgear/all/patches/2.1.1-0001-fix-cmake.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index e5a01e7..17fb0e5 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -47,7 +47,7 @@ endif() + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMPILE_FLAGS}" ) + + # Adding cppcheck properties +-if( CMAKE_BUILD_TYPE STREQUAL "Debug" ) ++if(0) + set( cppcheck cppcheck "--enable=warning" "--inconclusive" "--force" "--inline-suppr" ) + set_target_properties( arsenalgear PROPERTIES CXX_CPPCHECK ${cppcheck}) + endif() diff --git a/recipes/arsenalgear/all/test_package/CMakeLists.txt b/recipes/arsenalgear/all/test_package/CMakeLists.txt index e3d45800d41b0..3ff34ca782123 100644 --- a/recipes/arsenalgear/all/test_package/CMakeLists.txt +++ b/recipes/arsenalgear/all/test_package/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.8) -project(test_package CXX) +project(test_package LANGUAGES CXX) find_package(arsenalgear REQUIRED CONFIG) diff --git a/recipes/arsenalgear/all/test_v1_package/CMakeLists.txt b/recipes/arsenalgear/all/test_v1_package/CMakeLists.txt index 2340ca5c12b92..bc541ea90b512 100644 --- a/recipes/arsenalgear/all/test_v1_package/CMakeLists.txt +++ b/recipes/arsenalgear/all/test_v1_package/CMakeLists.txt @@ -1,12 +1,9 @@ cmake_minimum_required(VERSION 3.8) -project(test_package CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(arsenalgear REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE arsenalgear::arsenalgear) -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/arsenalgear/config.yml b/recipes/arsenalgear/config.yml index 6d0bf30afb485..2fc28a2652c51 100644 --- a/recipes/arsenalgear/config.yml +++ b/recipes/arsenalgear/config.yml @@ -1,4 +1,8 @@ versions: + "2.1.1": + folder: all + "2.1.0": + folder: all "2.0.1": folder: all "1.2.2": diff --git a/recipes/artery-font-format/all/conandata.yml b/recipes/artery-font-format/all/conandata.yml index b248576ab34a5..d7128685d341e 100644 --- a/recipes/artery-font-format/all/conandata.yml +++ b/recipes/artery-font-format/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.1": + url: "https://github.com/Chlumsky/artery-font-format/archive/v1.1.tar.gz" + sha256: "cd8eb58590d85069312b831ce5bc6eba21778ef2fa8ca8ac06e1ecf8eca53a7c" "1.0.1": url: "https://github.com/Chlumsky/artery-font-format/archive/v1.0.1.tar.gz" sha256: "23dc9450d2364c9f1a67fcb0ae8f2bef365fabc5a3f4af55d9a646f8fbcdc537" diff --git a/recipes/artery-font-format/all/conanfile.py b/recipes/artery-font-format/all/conanfile.py index a477d0ff0e98a..ec8583e598e0b 100644 --- a/recipes/artery-font-format/all/conanfile.py +++ b/recipes/artery-font-format/all/conanfile.py @@ -1,27 +1,51 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy +import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" class ArteryFontFormatConan(ConanFile): name = "artery-font-format" + description = "Artery Atlas Font format library" license = "MIT" - homepage = "https://github.com/Chlumsky/artery-font-format" url = "https://github.com/conan-io/conan-center-index" - description = "Artery Atlas Font format library" - topics = ("artery", "font", "atlas") - + homepage = "https://github.com/Chlumsky/artery-font-format" + topics = ("artery", "font", "atlas", "header-only") + package_type = "header-library" + 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 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], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): - self.copy("LICENSE.txt", src=self._source_subfolder, dst="licenses") - self.copy("*.h", src=self._source_subfolder, dst="include") - self.copy("*.hpp", src=self._source_subfolder, dst="include") + copy(self, pattern="LICENSE.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=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 = [] diff --git a/recipes/artery-font-format/all/test_package/CMakeLists.txt b/recipes/artery-font-format/all/test_package/CMakeLists.txt index 454c47bb2cbab..d7b8e200d1115 100644 --- a/recipes/artery-font-format/all/test_package/CMakeLists.txt +++ b/recipes/artery-font-format/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(artery-font-format 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 artery-font-format::artery-font-format) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/artery-font-format/all/test_package/conanfile.py b/recipes/artery-font-format/all/test_package/conanfile.py index c53028872776c..3a91c9439218e 100644 --- a/recipes/artery-font-format/all/test_package/conanfile.py +++ b/recipes/artery-font-format/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,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") - arfont = os.path.join(self.source_folder, "example.arfont") - self.run("{} {}".format(bin_path, arfont), 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/artery-font-format/all/test_package/example.arfont b/recipes/artery-font-format/all/test_package/example.arfont deleted file mode 100644 index a1530434762b6..0000000000000 Binary files a/recipes/artery-font-format/all/test_package/example.arfont and /dev/null differ diff --git a/recipes/artery-font-format/all/test_package/test_package.cpp b/recipes/artery-font-format/all/test_package/test_package.cpp index 8e85c6f96e501..ff1d420aff0b0 100644 --- a/recipes/artery-font-format/all/test_package/test_package.cpp +++ b/recipes/artery-font-format/all/test_package/test_package.cpp @@ -1,32 +1,9 @@ -#include -#include #include #include -#include int main(int argc, char *argv[]) { - if (argc < 2) { - std::cerr << "usage: test_package \n"; - return EXIT_FAILURE; - } - - FILE *const font_file = fopen(argv[1], "rb"); - if (font_file == nullptr) { - std::cerr << "couldn't open font file" << std::endl; - return EXIT_FAILURE; - } - - artery_font::StdArteryFont font; - if (!artery_font::read(font, font_file)) { - std::cerr << "couldn't read artery font" << std::endl; - return EXIT_FAILURE; - } - - if (fclose(font_file) != 0) { - std::cerr << "an error occured when closing font file" << std::endl; - return EXIT_FAILURE; - } - - return EXIT_SUCCESS; + auto list = artery_font::StdList(5); + std::cout << "There are " << list.length() << " elements in the list" << std::endl; + return EXIT_SUCCESS; } diff --git a/recipes/artery-font-format/config.yml b/recipes/artery-font-format/config.yml index 7b06dd8bf61ea..3c69caf4158b5 100644 --- a/recipes/artery-font-format/config.yml +++ b/recipes/artery-font-format/config.yml @@ -1,4 +1,6 @@ versions: + "1.1": + folder: all "1.0.1": folder: all "1.0": 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/conandata.yml b/recipes/aruco/3.x.x/conandata.yml index eb3415158ea14..ac03e59367f66 100644 --- a/recipes/aruco/3.x.x/conandata.yml +++ b/recipes/aruco/3.x.x/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.1.15": + url: "https://downloads.sourceforge.net/project/aruco/3.1.15/3.1.15.zip" + sha256: "8408ad1621b92c885b0740641ab98ec022705d48a08deb6f071ffebf455cc8b2" "3.1.12": url: "https://downloads.sourceforge.net/project/aruco/3.1.12/aruco-3.1.12.zip" sha256: "70b9ec8aa8eac6fe3f622201747a3e32c77bbb5f015e28a95c1c7c91f8ee8a09" diff --git a/recipes/aruco/3.x.x/conanfile.py b/recipes/aruco/3.x.x/conanfile.py index 22aa76a34e69a..2e12e936c956e 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, replace_in_file 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,55 @@ 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") + # Header used in public markerdetector.h + # cv::FileStorage::FileStorage used by aruco::CameraParameters::saveToFile + self.requires("opencv/4.9.0", transitive_headers=True, transitive_libs=True) + # Header used in levmarq.h + self.requires("eigen/3.4.0", transitive_headers=False) 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.set_property("eigen", "cmake_additional_variables_prefixes", ["Eigen3"]) + 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_package/test_package.cpp b/recipes/aruco/3.x.x/test_package/test_package.cpp index 4632ed7b42bd6..6a6b41f258933 100644 --- a/recipes/aruco/3.x.x/test_package/test_package.cpp +++ b/recipes/aruco/3.x.x/test_package/test_package.cpp @@ -1,10 +1,10 @@ -#include -#include +#include #include #include -#include +#include +#include int main() { cv::Mat image = cv::Mat::zeros(600,600,CV_8UC3); 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/polylabel/all/test_v1_package/conanfile.py b/recipes/aruco/3.x.x/test_v1_package/conanfile.py similarity index 100% rename from recipes/polylabel/all/test_v1_package/conanfile.py rename to recipes/aruco/3.x.x/test_v1_package/conanfile.py diff --git a/recipes/aruco/config.yml b/recipes/aruco/config.yml index 243128b45c736..84539a1974a56 100644 --- a/recipes/aruco/config.yml +++ b/recipes/aruco/config.yml @@ -1,3 +1,5 @@ versions: + "3.1.15": + folder: 3.x.x "3.1.12": folder: 3.x.x diff --git a/recipes/asio-grpc/all/conandata.yml b/recipes/asio-grpc/all/conandata.yml index d44cb9f84670e..fceefbebebc47 100644 --- a/recipes/asio-grpc/all/conandata.yml +++ b/recipes/asio-grpc/all/conandata.yml @@ -1,4 +1,19 @@ sources: + "2.9.2": + url: "https://github.com/Tradias/asio-grpc/archive/refs/tags/v2.9.2.tar.gz" + sha256: "a025587278b3332f4c5dd0464b3d5313fbecb89fc58a6ec1d611f693d6b51ef2" + "2.7.0": + url: "https://github.com/Tradias/asio-grpc/archive/refs/tags/v2.7.0.tar.gz" + sha256: "a4a3deeabbdef37a8e7238e25b6f26b63071151c4b49e1f2f86c528da54eed79" + "2.6.0": + url: "https://github.com/Tradias/asio-grpc/archive/refs/tags/v2.6.0.tar.gz" + sha256: "9f17f1dfe390667c71d8e0645937afa36f1a0e146f60f6036c7b4e12b09ed14e" + "2.5.1": + url: "https://github.com/Tradias/asio-grpc/archive/refs/tags/v2.5.1.tar.gz" + sha256: "571779a25be6eed77a345088e3ded2cccf880c16800ee0075ece57116f14fc35" + "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" diff --git a/recipes/asio-grpc/all/conanfile.py b/recipes/asio-grpc/all/conanfile.py index d5f2c6fe82df8..c686e567d9288 100644 --- a/recipes/asio-grpc/all/conanfile.py +++ b/recipes/asio-grpc/all/conanfile.py @@ -11,21 +11,23 @@ class AsioGrpcConan(ConanFile): name = "asio-grpc" - description = ("Asynchronous gRPC with Asio/unified executors") - homepage = "https://github.com/Tradias/asio-grpc" - url = "https://github.com/conan-io/conan-center-index" + description = "Asynchronous gRPC with Asio/unified executors" license = "Apache-2.0" - topics = ("cpp", "asynchronous", "grpc", "asio", "asynchronous-programming", "cpp17", "coroutine", "cpp20", "executors") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/Tradias/asio-grpc" + topics = ("cpp", "asynchronous", "grpc", "asio", "asynchronous-programming", "cpp17", "coroutine", "cpp20", "executors", "header-only") + + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" - 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", } + no_copy_source = True @property def _min_cppstd(self): @@ -36,50 +38,65 @@ def _compilers_minimum_version(self): return { "gcc": "7", "Visual Studio": "15.7", + "msvc": "191", "clang": "6", "apple-clang": "11", } - 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: - 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 = Version(self.settings.compiler.version) - self.options.use_boost_container = libcxx and str(libcxx) == "libc++" or \ + 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.50.0") - if self.options.use_boost_container or self.options.backend == "boost": - self.requires("boost/1.80.0") + self.requires("grpc/1.54.3", transitive_libs=True) + if self._local_allocator_option == "boost_container" or self.options.backend == "boost": + self.requires("boost/1.83.0", transitive_headers=True) if self.options.backend == "asio": - self.requires("asio/1.24.0") + self.requires("asio/1.29.0", transitive_headers=True) if self.options.backend == "unifex": - self.requires("libunifex/cci.20220430") + self.requires("libunifex/0.4.0") def package_id(self): self.info.clear() - self.info.options.use_boost_container = self.options.use_boost_container + self.info.options.local_allocator = self._local_allocator_option 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) + compiler_version = Version(self.settings.compiler.version) + 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( + f"{self.name} requires C++{self._min_cppstd}, which your compiler does not support." + ) + else: + self.output.warning( + f"{self.name} requires C++{self._min_cppstd}. Your compiler is unknown. Assuming it supports" + f" C++{self._min_cppstd}." + ) + if Version(self.version) == "2.7.0" and self.settings.compiler == "gcc" and compiler_version.major == "11" and \ + compiler_version < "11.3": + raise ConanInvalidConfiguration(f"{self.ref} does not support gcc 11.0-11.2") + def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) - tc.variables["ASIO_GRPC_USE_BOOST_CONTAINER"] = self.options.use_boost_container + 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): @@ -93,8 +110,11 @@ def package(self): rm(self, "asio-grpc*", os.path.join(self.package_folder, "lib", "cmake", "asio-grpc")) def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + build_modules = [os.path.join("lib", "cmake", "asio-grpc", "AsioGrpcProtobufGenerator.cmake")] - + self.cpp_info.requires = ["grpc::grpc++_unsecure"] if self.options.backend == "boost": self.cpp_info.defines = ["AGRPC_BOOST_ASIO"] @@ -106,7 +126,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_v1_package/CMakeLists.txt b/recipes/asio-grpc/all/test_v1_package/CMakeLists.txt index e68b2def0d618..91630d79f4abb 100644 --- a/recipes/asio-grpc/all/test_v1_package/CMakeLists.txt +++ b/recipes/asio-grpc/all/test_v1_package/CMakeLists.txt @@ -1,34 +1,8 @@ -cmake_minimum_required(VERSION 3.14) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.15) +project(test_package) 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() +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/asio-grpc/config.yml b/recipes/asio-grpc/config.yml index 9c1d421048692..b9f64d2363051 100644 --- a/recipes/asio-grpc/config.yml +++ b/recipes/asio-grpc/config.yml @@ -1,4 +1,14 @@ versions: + "2.9.2": + folder: all + "2.7.0": + folder: all + "2.6.0": + folder: all + "2.5.1": + folder: all + "2.4.0": + folder: all "2.3.0": folder: all "2.2.0": diff --git a/recipes/asio/all/conandata.yml b/recipes/asio/all/conandata.yml index 7fac1b2c26c22..001d8ff55af6f 100644 --- a/recipes/asio/all/conandata.yml +++ b/recipes/asio/all/conandata.yml @@ -1,58 +1,30 @@ sources: - "1.24.0": - url: "https://github.com/chriskohlhoff/asio/archive/asio-1-24-0.tar.gz" - sha256: "cbcaaba0f66722787b1a7c33afe1befb3a012b5af3ad7da7ff0f6b8c9b7a8a5b" - "1.23.0": - url: "https://github.com/chriskohlhoff/asio/archive/asio-1-23-0.tar.gz" - sha256: "facae7627ce6c716add3f328eee3d78c2e6e133a46ac5ecb80897b37ebacf05e" - "1.22.1": - url: "https://github.com/chriskohlhoff/asio/archive/asio-1-22-1.tar.gz" - sha256: "30cb54a5de5e465d10ec0c2026d6b5917f5e89fffabdbabeb1475846fc9a2cf0" - "1.22.0": - url: "https://github.com/chriskohlhoff/asio/archive/asio-1-22-0.tar.gz" - sha256: "17bfd506f6d55c85a33603277a256b42ca5883bf290930040489ffeeed23724a" - "1.21.0": - url: "https://github.com/chriskohlhoff/asio/archive/asio-1-21-0.tar.gz" - sha256: "5d2d2dcb7bfb39bff941cabbfc8c27ee322a495470bf0f3a7c5238648cf5e6a9" - "1.20.0": - url: "https://github.com/chriskohlhoff/asio/archive/asio-1-20-0.tar.gz" - sha256: "34a8f07be6f54e3753874d46ecfa9b7ab7051c4e3f67103c52a33dfddaea48e6" - "1.19.2": - url: "https://github.com/chriskohlhoff/asio/archive/asio-1-19-2.tar.gz" - sha256: "5ee191aee825dfb1325cbacf643d599b186de057c88464ea98f1bae5ba4ff47a" - "1.19.1": - url: "https://github.com/chriskohlhoff/asio/archive/refs/tags/asio-1-19-1.tar.gz" - sha256: "2555e0a29256de5c77d6a34b14faefd28c76555e094ba0371acb0b91d483520e" - "1.19.0": - url: "https://github.com/chriskohlhoff/asio/archive/asio-1-19-0.tar.gz" - sha256: "11bc0e22fcdfb3f0b77574ac33760a3592c0dac7e7eece7668b823c158243629" - "1.18.2": - url: "https://github.com/chriskohlhoff/asio/archive/asio-1-18-2.tar.gz" - sha256: "8d67133b89e0f8b212e9f82fdcf1c7b21a978d453811e2cd941c680e72c2ca32" + "1.32.0": + url: "https://github.com/chriskohlhoff/asio/archive/asio-1-32-0.tar.gz" + sha256: "f1b94b80eeb00bb63a3c8cef5047d4e409df4d8a3fe502305976965827d95672" + "1.31.0": + url: "https://github.com/chriskohlhoff/asio/archive/asio-1-31-0.tar.gz" + sha256: "530540f973498c2d297771af1bc852f69b27509bbb56bc7ac3309c928373286f" + "1.30.2": + url: "https://github.com/chriskohlhoff/asio/archive/asio-1-30-2.tar.gz" + sha256: "755bd7f85a4b269c67ae0ea254907c078d408cce8e1a352ad2ed664d233780e8" + # keep 1.29.0 for crowcpp-crow, restinio, fast-dds, asio-grpc + "1.29.0": + url: "https://github.com/chriskohlhoff/asio/archive/asio-1-29-0.tar.gz" + sha256: "44305859b4e6664dbbf853c1ef8ca0259d694f033753ae309fcb2534ca20f721" + # keep 1.28.1 for openscenegraph, restinio, simple-websocket-server, websocketpp + "1.28.1": + url: "https://github.com/chriskohlhoff/asio/archive/asio-1-28-1.tar.gz" + sha256: "5ff6111ec8cbe73a168d997c547f562713aa7bd004c5c02326f0e9d579a5f2ce" + # keep 1.27.0 for cppserver + "1.27.0": + url: "https://github.com/chriskohlhoff/asio/archive/asio-1-27-0.tar.gz" + sha256: "b31c63867daaba0e460ee2c85dc508a52c81db0a7318e0d2147f444b26f80ed7" + # keep 1.18.1 for packio "1.18.1": url: "https://github.com/chriskohlhoff/asio/archive/asio-1-18-1.tar.gz" sha256: "39c721b987b7a0d2fe2aee64310bd128cd8cc10f43481604d18cb2d8b342fd40" - "1.18.0": - sha256: 820688d1e0387ff55194ae20036cbae0fb3c7d11b7c3f46492369723c01df96f - url: https://github.com/chriskohlhoff/asio/archive/asio-1-18-0.tar.gz - "1.17.0": - sha256: 46406a830f8334b3789e7352ed7309a39c7c30b685b0499d289eda4fd4ae2067 - url: https://github.com/chriskohlhoff/asio/archive/asio-1-17-0.tar.gz + # keep 1.16.1 for simple-websocket-server "1.16.1": sha256: e40bbd531530f08318b7c7d7e84e457176d8eae6f5ad2e3714dc27b9131ecd35 url: https://github.com/chriskohlhoff/asio/archive/asio-1-16-1.tar.gz - "1.16.0": - sha256: c87410ea62de6245aa239b9ed2057edf01d7f66acc3f5e50add9a29343c87512 - url: https://github.com/chriskohlhoff/asio/archive/asio-1-16-0.tar.gz - "1.14.1": - sha256: 5b12ce2cdb658025e67785f954f74b052709cfc9b5941b8fb889c049b0955e1d - url: https://github.com/chriskohlhoff/asio/archive/asio-1-14-1.tar.gz - "1.14.0": - sha256: bdb01a649c24d73ca4a836662e7af442d935313ed6deef6b07f17f3bc5f78d7a - url: https://github.com/chriskohlhoff/asio/archive/asio-1-14-0.tar.gz - "1.13.0": - sha256: 54a1208d20f2104dbd6b7a04a9262f5ab649f4b7a9faf7eac4c2294e9e104c06 - url: https://github.com/chriskohlhoff/asio/archive/asio-1-13-0.tar.gz - "1.12.2": - sha256: 1de23266b956674e766cd0b6c929a11259f2284ea8e96b765cc8c67b1689e0fd - url: https://github.com/chriskohlhoff/asio/archive/asio-1-12-2.tar.gz diff --git a/recipes/asio/all/conanfile.py b/recipes/asio/all/conanfile.py index b96eb6fa96e4a..301282db06249 100644 --- a/recipes/asio/all/conanfile.py +++ b/recipes/asio/all/conanfile.py @@ -8,23 +8,24 @@ class Asio(ConanFile): name = "asio" - url = "https://github.com/conan-io/conan-center-index" - homepage = "http://think-async.com/Asio" description = "Asio is a cross-platform C++ library for network and low-level I/O" - topics = ("asio", "network", "io", "low-level") license = "BSL-1.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "http://think-async.com/Asio" + topics = ("network", "io", "low-level", "header-only") + + package_type = "header-library" 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 diff --git a/recipes/asio/all/test_v1_package/CMakeLists.txt b/recipes/asio/all/test_v1_package/CMakeLists.txt index 0308114c0432b..91630d79f4abb 100644 --- a/recipes/asio/all/test_v1_package/CMakeLists.txt +++ b/recipes/asio/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.15) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(asio REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE asio::asio) -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/asio/config.yml b/recipes/asio/config.yml index bc4dfc6aa34d4..b6ec3bff0f46c 100644 --- a/recipes/asio/config.yml +++ b/recipes/asio/config.yml @@ -1,39 +1,17 @@ versions: - "1.24.0": + "1.32.0": folder: all - "1.23.0": + "1.31.0": folder: all - "1.22.1": + "1.30.2": folder: all - "1.22.0": + "1.29.0": folder: all - "1.21.0": + "1.28.1": folder: all - "1.20.0": - folder: all - "1.19.2": - folder: all - "1.19.1": - folder: all - "1.19.0": - folder: all - "1.18.2": + "1.27.0": folder: all "1.18.1": folder: all - "1.18.0": - folder: all - "1.17.0": - folder: all "1.16.1": folder: all - "1.16.0": - folder: all - "1.14.1": - folder: all - "1.14.0": - folder: all - "1.13.0": - folder: all - "1.12.2": - folder: all diff --git a/recipes/asmjit/all/conandata.yml b/recipes/asmjit/all/conandata.yml index a7cfd40faef87..0e6689d1ee9fc 100644 --- a/recipes/asmjit/all/conandata.yml +++ b/recipes/asmjit/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "cci.20240531": + url: "https://github.com/asmjit/asmjit/archive/d6c5be2212b9a50ba56ec6d1e9b68693c62136c1.zip" + sha256: "678549712d4708d0513fb0017d03211df415387aea4c031923d4dd5c07b43db6" + "cci.20230325": + url: "https://github.com/asmjit/asmjit/archive/51b10b19b6631434d3f9ad536a6fb140944a36d2.zip" + sha256: "4f62b1b6247864417fb50a2928d541ccf8e9273b0c3ce36ccd443c9d6ca7bc9a" "cci.20221111": url: "https://github.com/asmjit/asmjit/archive/0c03ed2f7497441ac0de232bda2e6b8cc041b2dc.zip" sha256: "85d8f3edabd708658b63d8a9bc2e7ccb72edd1d14b668fa681b5f7fa529601a4" diff --git a/recipes/asmjit/all/conanfile.py b/recipes/asmjit/all/conanfile.py index 7b366fceb161a..5461e75517fb2 100644 --- a/recipes/asmjit/all/conanfile.py +++ b/recipes/asmjit/all/conanfile.py @@ -2,20 +2,21 @@ 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.scm import Version +from conan.errors import ConanInvalidConfiguration import os required_conan_version = ">=1.53.0" - class AsmjitConan(ConanFile): name = "asmjit" description = "AsmJit is a lightweight library for machine code " \ "generation written in C++ language." license = "Zlib" topics = ("asmjit", "compiler", "assembler", "jit") - homepage = "https://asmjit.com" url = "https://github.com/conan-io/conan-center-index" - + homepage = "https://asmjit.com" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -26,6 +27,16 @@ class AsmjitConan(ConanFile): "fPIC": True, } + @property + def _min_cppstd(self): + return 11 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "7", + } + def config_options(self): if self.settings.os == "Windows": del self.options.fPIC @@ -34,16 +45,22 @@ def configure(self): if self.options.shared: self.options.rm_safe("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, self._min_cppstd) + + if self.version >= "cci.20240531": + 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} does not support {self.settings.compiler}/{self.settings.compiler.version}." + ) + 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/asmjit/all/test_package/CMakeLists.txt b/recipes/asmjit/all/test_package/CMakeLists.txt index 39640d23a5929..f8fba8f71f0a1 100644 --- a/recipes/asmjit/all/test_package/CMakeLists.txt +++ b/recipes/asmjit/all/test_package/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.15) project(test_package LANGUAGES CXX) find_package(asmjit REQUIRED CONFIG) 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_package/test_package.cpp b/recipes/asmjit/all/test_package/test_package.cpp index 4b85962e0942d..f6d920ca6d627 100644 --- a/recipes/asmjit/all/test_package/test_package.cpp +++ b/recipes/asmjit/all/test_package/test_package.cpp @@ -1,27 +1,16 @@ -#include +#include -#include - -typedef int (*Func)(void); +#include "asmjit/asmjit.h" int main(int argc, char* argv[]) { asmjit::JitRuntime rt; - asmjit::CodeHolder code; code.init(rt.environment()); - asmjit::x86::Assembler a(&code); - a.mov(asmjit::x86::eax, 1); - a.ret(); - - Func fn; - asmjit::Error err = rt.add(&fn, &code); - if (err) return 1; - - int result = fn(); - printf("%d\n", result); - - rt.release(fn); + std::cout << + unsigned((ASMJIT_LIBRARY_VERSION >> 16)) << "." << + unsigned((ASMJIT_LIBRARY_VERSION >> 8) & 0xFF) << "." << + unsigned((ASMJIT_LIBRARY_VERSION ) & 0xFF) << "\n"; return 0; } diff --git a/recipes/asmjit/config.yml b/recipes/asmjit/config.yml index aaa7d13798678..03449364f4128 100644 --- a/recipes/asmjit/config.yml +++ b/recipes/asmjit/config.yml @@ -1,4 +1,8 @@ versions: + "cci.20240531": + folder: all + "cci.20230325": + folder: all "cci.20221111": folder: all "cci.20220210": diff --git a/recipes/asmtk/all/conandata.yml b/recipes/asmtk/all/conandata.yml new file mode 100644 index 0000000000000..0305fe3116b8e --- /dev/null +++ b/recipes/asmtk/all/conandata.yml @@ -0,0 +1,9 @@ +sources: + "0.0.0.cci.20230718": + url: "https://github.com/asmjit/asmtk/archive/e2752c85d39da4b0c5c729737a6faa25286b8e0c.zip" + sha256: "8cce0edf5f83df44853469c58037c59ae51b3630ed48be7c2370473f89d0986d" +patches: + "0.0.0.cci.20230718": + - patch_file: "patches/0001-update-cmakelist.patch" + patch_description: "Simple update to CMakeLists.txt to let asmtk link conan asmjit::asmjit instead of trying to do some magic" + patch_type: "conan" diff --git a/recipes/asmtk/all/conanfile.py b/recipes/asmtk/all/conanfile.py new file mode 100644 index 0000000000000..4897022fb9ed0 --- /dev/null +++ b/recipes/asmtk/all/conanfile.py @@ -0,0 +1,74 @@ +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, rmdir, apply_conandata_patches, export_conandata_patches +import os + +required_conan_version = ">=2.1" + +class AsmjitConan(ConanFile): + name = "asmtk" + description = "AsmTK provides concepts that are useful mostly in AOT code-generation." + license = "Zlib" + topics = ("asmjit", "compiler", "assembler", "jit", "asmtk") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://asmjit.com" + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + implements = ["auto_shared_fpic"] + + def requirements(self): + # INFO: asmtk/globals.h: #include + # INFO asmtk consumes asmjit directly + self.requires("asmjit/cci.20240531", transitive_headers=True) + + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + check_min_cppstd(self, 11) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["ASMTK_EMBED"] = False + tc.cache_variables["ASMTK_STATIC"] = not self.options.shared + tc.cache_variables["ASMTK_TEST"] = False + tc.cache_variables["ASMJIT_EXTERNAL"] = 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", 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", "asmtk") + self.cpp_info.set_property("cmake_target_name", "asmjit::asmtk") + + self.cpp_info.libs = ["asmtk"] + if not self.options.shared: + self.cpp_info.defines = ["ASMTK_STATIC"] diff --git a/recipes/asmtk/all/patches/0001-update-cmakelist.patch b/recipes/asmtk/all/patches/0001-update-cmakelist.patch new file mode 100644 index 0000000000000..e471e79ea5a7b --- /dev/null +++ b/recipes/asmtk/all/patches/0001-update-cmakelist.patch @@ -0,0 +1,11 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -171,7 +171,7 @@ if (NOT ASMTK_EMBED) + $<$:${ASMTK_PRIVATE_CFLAGS_DBG}> + $<$>:${ASMTK_PRIVATE_CFLAGS_REL}>) + +- if(ASMJIT_EXTERNAL) ++ if(NOT ASMJIT_EXTERNAL) + target_link_libraries(asmtk PUBLIC ${ASMJIT_LIBRARY}) + find_path(ASMJIT_INCLUDE_DIR NAMES asmjit/asmjit.h) + target_include_directories(asmtk PRIVATE ${ASMJIT_INCLUDE_DIR}) \ No newline at end of file diff --git a/recipes/asmtk/all/test_package/CMakeLists.txt b/recipes/asmtk/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..2b6a3fb962b42 --- /dev/null +++ b/recipes/asmtk/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(asmtk REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE asmjit::asmtk asmjit::asmjit) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/asmtk/all/test_package/conanfile.py b/recipes/asmtk/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9e627ca89b29 --- /dev/null +++ b/recipes/asmtk/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 layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + self.requires("asmjit/[*]") # whichever version was already resolved + + 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/asmtk/all/test_package/test_package.cpp b/recipes/asmtk/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..32cd848e0803c --- /dev/null +++ b/recipes/asmtk/all/test_package/test_package.cpp @@ -0,0 +1,19 @@ +#include + +#include +#include + + +int main(void) { + asmjit::Environment env(asmjit::Arch::kX64); + asmjit::CodeHolder code; + code.init(env); + + asmjit::x86::Assembler assembler(&code); + asmtk::AsmParser parser(&assembler); + parser.parse( + "mov rax, rbx\n" + "vaddpd zmm0, zmm1, [rax + 128]\n"); + + return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/recipes/asmtk/config.yml b/recipes/asmtk/config.yml new file mode 100644 index 0000000000000..ec4883f2dc46a --- /dev/null +++ b/recipes/asmtk/config.yml @@ -0,0 +1,3 @@ +versions: + "0.0.0.cci.20230718": + folder: all diff --git a/recipes/asn1c/all/conanfile.py b/recipes/asn1c/all/conanfile.py index 83429575a7f31..c7d26af9b8d79 100644 --- a/recipes/asn1c/all/conanfile.py +++ b/recipes/asn1c/all/conanfile.py @@ -1,82 +1,101 @@ -from conans import AutoToolsBuildEnvironment, tools +import os + from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.files import get, rmdir, chdir -import os +from conan.tools.build import cross_building +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import copy, get, rmdir, chdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.53.0" class Asn1cConan(ConanFile): name = "asn1c" description = "The ASN.1 Compiler" license = "BSD-2-Clause" - topics = ("asn.1", "compiler") - homepage = "https://lionet.info/asn1c" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://lionet.info/asn1c" + topics = ("asn.1", "compiler") + package_type = "application" settings = "os", "arch", "compiler", "build_type" - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" - @property - def _datarootdir(self): - return os.path.join(self.package_folder, "res") + def _settings_build(self): + return getattr(self, "settings_build", self.settings) 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 layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + del self.info.settings.compiler def build_requirements(self): - self.tool_requires("bison/3.7.6") - self.tool_requires("flex/2.6.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") + self.tool_requires("winflexbison/2.5.24") + else: + self.tool_requires("bison/3.8.2") + self.tool_requires("flex/2.6.4") self.tool_requires("libtool/2.4.7") def validate(self): - if self.settings.compiler == "Visual Studio": + if is_msvc(self): raise ConanInvalidConfiguration("Visual Studio is not supported") - def package_id(self): - del self.info.settings.compiler - def source(self): - get(self, **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 = [ - "--datarootdir={}".format(tools.unix_path(self._datarootdir)), - ] - 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): + env = VirtualBuildEnv(self) + env.generate() + + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") + + tc = AutotoolsToolchain(self) + tc.configure_args += ["--datarootdir=${prefix}/res"] + tc.generate() def build(self): - with chdir(self, self._source_subfolder): - self.run("{} -fiv".format(tools.get_env("AUTORECONF")), win_bash=tools.os_info.is_windows) - autotools = self._configure_autotools() - autotools.make() + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.autoreconf() + autotools.configure() + autotools.make() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - autotools = self._configure_autotools() - autotools.install() + copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.install() rmdir(self, os.path.join(self.package_folder, "res", "doc")) rmdir(self, os.path.join(self.package_folder, "res", "man")) 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.includedirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.frameworkdirs = [] + self.cpp_info.resdirs = ["res"] # asn1c cannot use environment variables to specify support files path # so `SUPPORT_PATH` should be propagated to command line invocation to `-S` argument - self.env_info.SUPPORT_PATH = os.path.join(self.package_folder, "res/asn1c") + support_path = os.path.join(self.package_folder, "res", "asn1c") + self.buildenv_info.define_path("SUPPORT_PATH", support_path) - self.cpp_info.includedirs = [] + # TODO: to remove in conan v2 + bin_path = os.path.join(self.package_folder, "bin") + self.env_info.PATH.append(bin_path) + self.env_info.SUPPORT_PATH = support_path diff --git a/recipes/asn1c/all/test_package/CMakeLists.txt b/recipes/asn1c/all/test_package/CMakeLists.txt index 72f86ddd2bed5..e24e73ab351bc 100644 --- a/recipes/asn1c/all/test_package/CMakeLists.txt +++ b/recipes/asn1c/all/test_package/CMakeLists.txt @@ -1,8 +1,9 @@ -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) +if (NOT DEFINED ENV{SUPPORT_PATH}) + message(FATAL_ERROR "SUPPORT_PATH environment variable not defined") +endif() set(STANDARD_ASN1_FILES BIT_STRING.c @@ -39,7 +40,7 @@ set(GENERATED_FILES add_custom_command( OUTPUT ${GENERATED_FILES} ${STANDARD_ASN1_FILES} - COMMAND asn1c -S ${SUPPORT_PATH} MyModule.asn1 + COMMAND asn1c -S "$ENV{SUPPORT_PATH}" MyModule.asn1 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} DEPENDS MyModule.asn1 ) diff --git a/recipes/asn1c/all/test_package/conanfile.py b/recipes/asn1c/all/test_package/conanfile.py index 534923606ca41..ed96bb307a88d 100644 --- a/recipes/asn1c/all/test_package/conanfile.py +++ b/recipes/asn1c/all/test_package/conanfile.py @@ -1,27 +1,30 @@ -from conans import CMake +import os + from conan import ConanFile +from conan.tools.build import can_run, cross_building +from conan.tools.cmake import cmake_layout, CMake from conan.tools.files import copy -from conan.tools.build import cross_building -import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - - generators = "cmake" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv", "VirtualBuildEnv" + test_type = "explicit" def build_requirements(self): - self.tool_requires(str(self.requires["asn1c"])) + self.tool_requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): if not cross_building(self): copy(self, "MyModule.asn1", src=self.source_folder, dst=self.build_folder) cmake = CMake(self) - cmake.definitions["SUPPORT_PATH"] = self.deps_env_info["asn1c"].SUPPORT_PATH 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/assimp/5.x/conan_deps.cmake b/recipes/assimp/5.x/conan_deps.cmake new file mode 100644 index 0000000000000..ed063a23fb273 --- /dev/null +++ b/recipes/assimp/5.x/conan_deps.cmake @@ -0,0 +1,42 @@ +find_package(minizip REQUIRED CONFIG) +link_libraries(minizip::minizip) + +find_package(pugixml REQUIRED CONFIG) +link_libraries(pugixml::pugixml) + +find_package(utf8cpp REQUIRED CONFIG) +link_libraries(utf8cpp::utf8cpp) + +find_package(ZLIB REQUIRED CONFIG) +link_libraries(ZLIB::ZLIB) + +if(WITH_CLIPPER) + find_package(clipper REQUIRED CONFIG) + link_libraries(clipper::clipper) +endif() +if(WITH_DRACO) + find_package(draco REQUIRED CONFIG) + link_libraries(draco::draco) +endif() +if(WITH_KUBAZIP) + find_package(zip REQUIRED CONFIG) + link_libraries(zip::zip) +endif() +if(WITH_OPENDDL) + find_package(openddlparser REQUIRED CONFIG) + link_libraries(openddlparser::openddlparser) +endif() +if(WITH_POLY2TRI) + find_package(poly2tri REQUIRED CONFIG) + link_libraries(poly2tri::poly2tri) +endif() +if(WITH_PUGIXML) +endif() +if(WITH_RAPIDJSON) + find_package(RapidJSON REQUIRED CONFIG) + link_libraries(rapidjson::rapidjson) +endif() +if(WITH_STB) + find_package(stb REQUIRED CONFIG) + link_libraries(stb::stb) +endif() diff --git a/recipes/assimp/5.x/conandata.yml b/recipes/assimp/5.x/conandata.yml index c99892ad1d8a8..677866f0307dc 100644 --- a/recipes/assimp/5.x/conandata.yml +++ b/recipes/assimp/5.x/conandata.yml @@ -1,31 +1,22 @@ sources: - "5.2.2": - url: "https://github.com/assimp/assimp/archive/refs/tags/v5.2.2.tar.gz" - sha256: "ad76c5d86c380af65a9d9f64e8fc57af692ffd80a90f613dfc6bd945d0b80bb4" + "5.4.3": + url: "https://github.com/assimp/assimp/archive/refs/tags/v5.4.3.tar.gz" + sha256: "66dfbaee288f2bc43172440a55d0235dfc7bf885dda6435c038e8000e79582cb" + "5.4.2": + url: "https://github.com/assimp/assimp/archive/refs/tags/v5.4.2.tar.gz" + sha256: "7414861a7b038e407b510e8b8c9e58d5bf8ca76c9dfe07a01d20af388ec5086a" + "5.4.1": + url: "https://github.com/assimp/assimp/archive/refs/tags/v5.4.1.tar.gz" + sha256: "a1bf71c4eb851ca336bba301730cd072b366403e98e3739d6a024f6313b8f954" + "5.3.1": + url: "https://github.com/assimp/assimp/archive/refs/tags/v5.3.1.tar.gz" + sha256: "a07666be71afe1ad4bc008c2336b7c688aca391271188eb9108d0c6db1be53f1" + "5.2.5": + url: "https://github.com/assimp/assimp/archive/refs/tags/v5.2.5.tar.gz" + sha256: "b5219e63ae31d895d60d98001ee5bb809fb2c7b2de1e7f78ceeb600063641e1a" "5.1.6": url: "https://github.com/assimp/assimp/archive/refs/tags/v5.1.6.tar.gz" sha256: "52ad3a3776ce320c8add531dbcb2d3b93f2e1f10fcff5ac30178b09ba934d084" - "5.1.0": - url: "https://github.com/assimp/assimp/archive/refs/tags/v5.1.0.tar.gz" - sha256: "b96f609bca45cc4747bf8ea4b696816ada484aed2812e60ea4d16aae18360b0b" - "5.0.1": - url: "https://github.com/assimp/assimp/archive/refs/tags/v5.0.1.tar.gz" - sha256: "11310ec1f2ad2cd46b95ba88faca8f7aaa1efe9aa12605c55e3de2b977b3dbfc" - "5.0.0": - url: "https://github.com/assimp/assimp/archive/refs/tags/v5.0.0.tar.gz" - sha256: "b0110a91650d6bb4000e3d5c2185bf77b0ff0a2e7a284bc2c4af81b33988b63c" patches: - "5.2.2": - - patch_file: "patches/0005-fix-unzip.patch" - - patch_file: "patches/0006-unvendor-deps-5.2.x.patch" "5.1.6": - - patch_file: "patches/0004-unvendor-deps-5.1.6.patch" - patch_file: "patches/0005-fix-unzip.patch" - "5.1.0": - - patch_file: "patches/0003-unvendor-deps-5.1.x.patch" - "5.0.1": - - patch_file: "patches/0001-unvendor-deps-5.0.x.patch" - - patch_file: "patches/0002-fix-all-exporters-disabled.patch" - "5.0.0": - - patch_file: "patches/0001-unvendor-deps-5.0.x.patch" - - patch_file: "patches/0002-fix-all-exporters-disabled.patch" diff --git a/recipes/assimp/5.x/conanfile.py b/recipes/assimp/5.x/conanfile.py index 3a8d091687f9d..f06d14969a98f 100644 --- a/recipes/assimp/5.x/conanfile.py +++ b/recipes/assimp/5.x/conanfile.py @@ -1,13 +1,14 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration +from conan.tools.build import stdcpp_library, 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, rmdir -from conan.tools.microsoft import is_msvc +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, collect_libs, 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 -from conans import tools as tools_legacy import os -required_conan_version = ">=1.53.0" +required_conan_version = ">=1.54.0" class AssimpConan(ConanFile): @@ -20,7 +21,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], @@ -103,8 +105,29 @@ class AssimpConan(ConanFile): options.update(dict.fromkeys(_format_option_map, [True, False])) default_options.update(dict.fromkeys(_format_option_map, True)) + short_paths = True + + @property + def _min_cppstd(self): + if Version(self.version) < "5.2.0": + return 11 + return 17 + + @property + def _compilers_minimum_version(self): + if Version(self.version) < "5.2.0": + return {} + return { + "gcc": "7", + "clang": "6", + "apple-clang": "10", + "msvc": "191", + "Visual Studio": "15", + } + def export_sources(self): export_conandata_patches(self) + copy(self, "conan_deps.cmake", self.recipe_folder, os.path.join(self.export_sources_folder, "src")) def config_options(self): if self.settings.os == "Windows": @@ -135,8 +158,6 @@ def _depends_on_rapidjson(self): @property def _depends_on_draco(self): - if Version(self.version) < "5.1.0": - return False return self.options.with_gltf or self.options.with_gltf_exporter @property @@ -145,115 +166,171 @@ def _depends_on_clipper(self): @property def _depends_on_stb(self): - if Version(self.version) < "5.1.0": - return False return self.options.with_m3d or self.options.with_m3d_exporter or \ self.options.with_pbrt_exporter - @property - def _depends_on_zlib(self): - return self.options.with_assbin or self.options.with_assbin_exporter or \ - self.options.with_assxml_exporter or self.options.with_blend or self.options.with_fbx or \ - self.options.with_q3bsp or self.options.with_x or self.options.with_xgl - @property def _depends_on_openddlparser(self): - if Version(self.version) < "5.1.0": - return False return self.options.with_opengex def requirements(self): # TODO: unvendor others libs: # - Open3DGC self.requires("minizip/1.2.13") - self.requires("utfcpp/3.2.1") - if Version(self.version) < "5.1.0": - self.requires("irrxml/1.2") - else: - self.requires("pugixml/1.12.1") + self.requires("pugixml/1.14") + self.requires("utfcpp/4.0.1") + self.requires("zlib/[>=1.2.11 <2]") if self._depends_on_kuba_zip: - self.requires("kuba-zip/0.2.6") + self.requires("kuba-zip/0.3.0") if self._depends_on_poly2tri: self.requires("poly2tri/cci.20130502") if self._depends_on_rapidjson: - self.requires("rapidjson/cci.20220822") - if self._depends_on_zlib: - self.requires("zlib/1.2.13") + self.requires("rapidjson/cci.20230929") if self._depends_on_draco: - self.requires("draco/1.5.5") + self.requires("draco/1.5.6") if self._depends_on_clipper: - self.requires("clipper/4.10.0") # Only 4.x supported + if Version(self.version) >= "5.3.0": + self.requires("clipper/6.4.2") + else: + self.requires("clipper/4.10.0") if self._depends_on_stb: - self.requires("stb/cci.20210910") + self.requires("stb/cci.20230920") if self._depends_on_openddlparser: - self.requires("openddl-parser/0.5.0") + self.requires("openddl-parser/0.5.1") def validate(self): - if self._depends_on_clipper and Version(self.dependencies["clipper"].ref.version).major != "4": + 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 Version(self.version) < "5.3.0" and self._depends_on_clipper and Version(self.dependencies["clipper"].ref.version).major != "4": raise ConanInvalidConfiguration("Only 'clipper/4.x' is supported") + def build_requirements(self): + if Version(self.version) >= "5.4.0": + self.tool_requires("cmake/[>=3.22 <4]") + 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) - if Version(self.version) >= "5.1.0": - tc.variables["ASSIMP_HUNTER_ENABLED"] = False - tc.variables["ASSIMP_IGNORE_GIT_HASH"] = True - tc.variables["ASSIMP_RAPIDJSON_NO_MEMBER_ITERATOR"] = False - else: - tc.variables["HUNTER_ENABLED"] = False - tc.variables["IGNORE_GIT_HASH"] = True - tc.variables["SYSTEM_IRRXML"] = True tc.variables["ASSIMP_ANDROID_JNIIOSYSTEM"] = False tc.variables["ASSIMP_BUILD_ALL_IMPORTERS_BY_DEFAULT"] = False tc.variables["ASSIMP_BUILD_ALL_EXPORTERS_BY_DEFAULT"] = False tc.variables["ASSIMP_BUILD_ASSIMP_TOOLS"] = False + tc.variables["ASSIMP_BUILD_DOCS"] = False + tc.variables["ASSIMP_BUILD_DRACO"] = False + tc.variables["ASSIMP_BUILD_FRAMEWORK"] = False + tc.variables["ASSIMP_BUILD_MINIZIP"] = False tc.variables["ASSIMP_BUILD_SAMPLES"] = False tc.variables["ASSIMP_BUILD_TESTS"] = False + tc.variables["ASSIMP_BUILD_ZLIB"] = False tc.variables["ASSIMP_DOUBLE_PRECISION"] = self.options.double_precision + tc.variables["ASSIMP_HUNTER_ENABLED"] = False + tc.variables["ASSIMP_IGNORE_GIT_HASH"] = True + tc.variables["ASSIMP_INJECT_DEBUG_POSTFIX"] = False + tc.variables["ASSIMP_INSTALL"] = True tc.variables["ASSIMP_INSTALL_PDB"] = False tc.variables["ASSIMP_NO_EXPORT"] = False - tc.variables["ASSIMP_BUILD_MINIZIP"] = False + tc.variables["ASSIMP_OPT_BUILD_PACKAGES"] = False + tc.variables["ASSIMP_RAPIDJSON_NO_MEMBER_ITERATOR"] = False + tc.variables["ASSIMP_UBSAN"] = False + tc.variables["ASSIMP_WARNINGS_AS_ERRORS"] = False + tc.variables["USE_STATIC_CRT"] = is_msvc_static_runtime(self) + tc.variables["ASSIMP_BUILD_USE_CCACHE"] = False + for option, (definition, _) in self._format_option_map.items(): value = self.options.get_safe(option) if value is not None: tc.variables[definition] = value if self.settings.os == "Windows": tc.preprocessor_definitions["NOMINMAX"] = 1 - tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" # to avoid warnings + if Version(self.version) < "5.4.0": + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + + tc.cache_variables["CMAKE_PROJECT_Assimp_INCLUDE"] = "conan_deps.cmake" + tc.cache_variables["WITH_CLIPPER"] = self._depends_on_clipper + tc.cache_variables["WITH_DRACO"] = self._depends_on_draco + tc.cache_variables["WITH_KUBAZIP"] = self._depends_on_kuba_zip + tc.cache_variables["WITH_OPENDDL"] = self._depends_on_openddlparser + tc.cache_variables["WITH_POLY2TRI"] = self._depends_on_poly2tri + tc.cache_variables["WITH_RAPIDJSON"] = self._depends_on_rapidjson + tc.cache_variables["WITH_STB"] = self._depends_on_stb tc.generate() cd = CMakeDeps(self) + cd.set_property("rapidjson", "cmake_target_name", "rapidjson::rapidjson") + cd.set_property("utfcpp", "cmake_target_name", "utf8cpp::utf8cpp") cd.generate() + venv = VirtualBuildEnv(self) + venv.generate() + def _patch_sources(self): apply_conandata_patches(self) # Don't force several compiler and linker flags - replace_mapping = [ - ("-fPIC", ""), - ("-g ", ""), - ("SET(CMAKE_POSITION_INDEPENDENT_CODE ON)", ""), - ('SET(CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /MDd /Ob2 /DEBUG:FULL /Zi")', ""), - ('SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /D_DEBUG /Zi /Od")', ""), - ('SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi")', ""), - ('SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG:FULL /PDBALTPATH:%_PDB% /OPT:REF /OPT:ICF")', ""), - ("/WX", "") - ] - - for before, after in replace_mapping: - replace_in_file(self, os.path.join( - self.source_folder, "CMakeLists.txt"), before, after, strict=False) - # Take care to not use these vendored libs - vendors = ["poly2tri", "rapidjson", "utf8cpp", "zip", "unzip", "stb", "zlib", "clipper"] - if Version(self.version) < "5.1.0": - vendors.append("irrXML") - else: - vendors.extend(["pugixml", "draco", "openddlparser"]) - for vendor in vendors: - rmdir(self, os.path.join(self.source_folder, "contrib", vendor)) + for pattern in [ + "-fPIC", + "-g ", + "SET(CMAKE_POSITION_INDEPENDENT_CODE ON)", + 'SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /D_DEBUG /Zi /Od")', + 'SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG:FULL /PDBALTPATH:%_PDB% /OPT:REF /OPT:ICF")', + ]: + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), pattern, "") + + for pattern in ["-Werror", "/WX"]: + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), pattern, "") + replace_in_file(self, os.path.join(self.source_folder, "code", "CMakeLists.txt"), pattern, "") + + # Make sure vendored libs are not used by accident by removing their subdirs + allow_vendored = ["Open3DGC"] + for contrib_dir in self.source_path.joinpath("contrib").iterdir(): + if contrib_dir.is_dir() and contrib_dir.name not in allow_vendored: + rmdir(self, contrib_dir) + + # Do not include add vendored library sources to the build + # https://github.com/assimp/assimp/blob/v5.3.1/code/CMakeLists.txt#L1151-L1159 + code_cmakelists = self.source_path.joinpath("code", "CMakeLists.txt") + content = code_cmakelists.read_text(encoding="utf-8") + for vendored_lib in [ + "unzip_compile", + "Poly2Tri", + "Clipper", + "openddl_parser", + # "open3dgc", + "ziplib", + "Pugixml", + "stb", + ]: + content = content.replace("${%s_SRCS}" % vendored_lib, "") + code_cmakelists.write_text(content, encoding="utf-8") + + # Make vendored headers redirect to external ones. + for contrib_header, include in [ + (os.path.join("clipper", "clipper.hpp"), "polyclipping/clipper.hpp"), + (os.path.join("poly2tri", "poly2tri", "poly2tri.h"), "poly2tri/poly2tri.h"), + (os.path.join("stb", "stb_image.h"), "stb_image.h"), + (os.path.join("utf8cpp", "source", "utf8.h"), "utf8.h"), + (os.path.join("zip", "src", "zip.h"), "zip/zip.h"), + ]: + save(self, os.path.join(self.source_folder, "contrib", contrib_header), + f"#include <{include}>\n") + if Version(self.version) >= "5.4.0": + rmdir(self, self.source_path.joinpath("contrib", "utf8cpp")) + + # minizip is provided via conan_deps.cmake, no need to use pkgconfig + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "use_pkgconfig(UNZIP minizip)", "set(UNZIP_FOUND TRUE)") + + # ZLIB is unvendored, no need to install it + # https://github.com/assimp/assimp/blob/v5.3.1/CMakeLists.txt#L483-L487 + # https://github.com/assimp/assimp/blob/v5.1.6/CMakeLists.txt#L463-L466 + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "INSTALL( TARGETS zlib", "set(_ #") def build(self): self._patch_sources() @@ -278,6 +355,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) + 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 deleted file mode 100644 index 1445d96a11b7c..0000000000000 --- a/recipes/assimp/5.x/patches/0001-unvendor-deps-5.0.x.patch +++ /dev/null @@ -1,278 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -437,7 +437,12 @@ IF(HUNTER_ENABLED) - set(ASSIMP_BUILD_MINIZIP TRUE) - ELSE(HUNTER_ENABLED) - IF ( NOT ASSIMP_BUILD_ZLIB ) -- FIND_PACKAGE(ZLIB) -+ if(ASSIMP_BUILD_ASSBIN_IMPORTER OR ASSIMP_BUILD_ASSBIN_EXPORTER OR ASSIMP_BUILD_ASSXML_EXPORTER OR -+ ASSIMP_BUILD_BLEND_IMPORTER OR ASSIMP_BUILD_FBX_IMPORTER OR ASSIMP_BUILD_Q3BSP_IMPORTER OR -+ ASSIMP_BUILD_X_IMPORTER OR ASSIMP_BUILD_XGL_IMPORTER) -+ find_package(ZLIB REQUIRED) -+ endif() -+ set(ZLIB_FOUND TRUE) - ENDIF( NOT ASSIMP_BUILD_ZLIB ) - - IF( NOT ZLIB_FOUND ) -@@ -470,14 +475,14 @@ ENDIF(HUNTER_ENABLED) - - IF( NOT IOS ) - IF( NOT ASSIMP_BUILD_MINIZIP ) -- use_pkgconfig(UNZIP minizip) -+ find_package(minizip REQUIRED CONFIG) -+ set(UNZIP_FOUND TRUE) - ENDIF( NOT ASSIMP_BUILD_MINIZIP ) - ELSE ( NOT IOS ) -- IF( NOT BUILD_SHARED_LIBS ) - IF( NOT ASSIMP_BUILD_MINIZIP ) -- use_pkgconfig(UNZIP minizip) -+ find_package(minizip REQUIRED CONFIG) -+ set(UNZIP_FOUND TRUE) - ENDIF( NOT ASSIMP_BUILD_MINIZIP ) -- ENDIF ( NOT BUILD_SHARED_LIBS ) - ENDIF ( NOT IOS ) - - IF ( ASSIMP_NO_EXPORT ) ---- a/code/3MF/D3MFExporter.cpp -+++ b/code/3MF/D3MFExporter.cpp -@@ -58,7 +58,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - #ifdef ASSIMP_USE_HUNTER - # include - #else --# include -+# include - #endif - - namespace Assimp { ---- a/code/Blender/BlenderTessellator.h -+++ b/code/Blender/BlenderTessellator.h -@@ -147,7 +147,7 @@ namespace Assimp - #ifdef ASSIMP_USE_HUNTER - # include - #else --# include "../contrib/poly2tri/poly2tri/poly2tri.h" -+# include - #endif - - namespace Assimp ---- a/code/CMakeLists.txt -+++ b/code/CMakeLists.txt -@@ -866,6 +866,7 @@ IF(HUNTER_ENABLED) - hunter_add_package(irrXML) - find_package(irrXML CONFIG REQUIRED) - ELSE(HUNTER_ENABLED) -+ find_package(irrxml REQUIRED CONFIG) - # irrXML already included in contrib directory by parent CMakeLists.txt. - ENDIF(HUNTER_ENABLED) - -@@ -874,6 +875,7 @@ IF(HUNTER_ENABLED) - hunter_add_package(utf8) - find_package(utf8 CONFIG REQUIRED) - ELSE(HUNTER_ENABLED) -+ find_package(utf8cpp REQUIRED CONFIG) - # utf8 is header-only, so Assimp doesn't need to do anything. - ENDIF(HUNTER_ENABLED) - -@@ -882,6 +884,9 @@ IF(HUNTER_ENABLED) - hunter_add_package(polyclipping) - find_package(polyclipping CONFIG REQUIRED) - ELSE(HUNTER_ENABLED) -+ if(ASSIMP_BUILD_IFC_IMPORTER) -+ find_package(clipper REQUIRED CONFIG) -+ endif() - SET( Clipper_SRCS - ../contrib/clipper/clipper.hpp - ../contrib/clipper/clipper.cpp -@@ -894,6 +899,9 @@ IF(HUNTER_ENABLED) - hunter_add_package(poly2tri) - find_package(poly2tri CONFIG REQUIRED) - ELSE(HUNTER_ENABLED) -+ if(ASSIMP_BUILD_BLEND_IMPORTER OR ASSIMP_BUILD_IFC_IMPORTER) -+ find_package(poly2tri REQUIRED CONFIG) -+ endif() - SET( Poly2Tri_SRCS - ../contrib/poly2tri/poly2tri/common/shapes.cc - ../contrib/poly2tri/poly2tri/common/shapes.h -@@ -930,6 +938,9 @@ IF(HUNTER_ENABLED) - hunter_add_package(zip) - find_package(zip CONFIG REQUIRED) - ELSE(HUNTER_ENABLED) -+ if(ASSIMP_BUILD_3MF_EXPORTER) -+ find_package(zip REQUIRED CONFIG) -+ endif() - SET( ziplib_SRCS - ../contrib/zip/src/miniz.h - ../contrib/zip/src/zip.c -@@ -1025,8 +1036,9 @@ IF(HUNTER_ENABLED) - hunter_add_package(RapidJSON) - find_package(RapidJSON CONFIG REQUIRED) - ELSE(HUNTER_ENABLED) -- INCLUDE_DIRECTORIES( "../contrib/rapidjson/include" ) -- INCLUDE_DIRECTORIES( "../contrib" ) -+ if(ASSIMP_BUILD_GLTF_IMPORTER OR ASSIMP_BUILD_GLTF_EXPORTER) -+ find_package(RapidJSON REQUIRED CONFIG) -+ endif() - ENDIF(HUNTER_ENABLED) - - # VC2010 fixes -@@ -1076,13 +1088,8 @@ SET( assimp_src - ${ASSIMP_EXPORTER_SRCS} - - # Third-party libraries -- ${IrrXML_SRCS} -- ${unzip_compile_SRCS} -- ${Poly2Tri_SRCS} -- ${Clipper_SRCS} - ${openddl_parser_SRCS} - ${open3dgc_SRCS} -- ${ziplib_SRCS} - # Necessary to show the headers in the project when using the VC++ generator: - - ${PUBLIC_HEADERS} -@@ -1094,6 +1101,7 @@ IF(NOT HUNTER_ENABLED) - INCLUDE_DIRECTORIES( - ${IRRXML_INCLUDE_DIR} - ../contrib/openddlparser/include -+ ../contrib # for Open3DGC - ) - ENDIF(NOT HUNTER_ENABLED) - -@@ -1125,7 +1133,24 @@ IF(HUNTER_ENABLED) - zip::zip - ) - ELSE(HUNTER_ENABLED) -- TARGET_LINK_LIBRARIES(assimp ${ZLIB_LIBRARIES} ${OPENDDL_PARSER_LIBRARIES} ${IRRXML_LIBRARY} ) -+ target_link_libraries(assimp irrxml::irrxml utf8cpp) -+ if(ASSIMP_BUILD_ASSBIN_IMPORTER OR ASSIMP_BUILD_ASSBIN_EXPORTER OR ASSIMP_BUILD_ASSXML_EXPORTER OR -+ ASSIMP_BUILD_BLEND_IMPORTER OR ASSIMP_BUILD_FBX_IMPORTER OR ASSIMP_BUILD_Q3BSP_IMPORTER OR -+ ASSIMP_BUILD_X_IMPORTER OR ASSIMP_BUILD_XGL_IMPORTER) -+ target_link_libraries(assimp ZLIB::ZLIB) -+ endif() -+ if(ASSIMP_BUILD_IFC_IMPORTER) -+ target_link_libraries(assimp clipper::clipper) -+ endif() -+ if(ASSIMP_BUILD_BLEND_IMPORTER OR ASSIMP_BUILD_IFC_IMPORTER) -+ target_link_libraries(assimp poly2tri::poly2tri) -+ endif() -+ if(ASSIMP_BUILD_3MF_EXPORTER) -+ target_link_libraries(assimp zip::zip) -+ endif() -+ if(ASSIMP_BUILD_GLTF_IMPORTER OR ASSIMP_BUILD_GLTF_EXPORTER) -+ target_link_libraries(assimp rapidjson) -+ endif() - ENDIF(HUNTER_ENABLED) - - if(ASSIMP_ANDROID_JNIIOSYSTEM) -@@ -1210,8 +1235,7 @@ ENDIF(APPLE) - # assimp can #include "unzip.h" - IF(NOT HUNTER_ENABLED) - if (UNZIP_FOUND) -- INCLUDE_DIRECTORIES(${UNZIP_INCLUDE_DIRS}) -- TARGET_LINK_LIBRARIES(assimp ${UNZIP_LIBRARIES}) -+ target_link_libraries(assimp minizip::minizip) - else (UNZIP_FOUND) - INCLUDE_DIRECTORIES("../") - endif (UNZIP_FOUND) ---- a/code/Common/BaseImporter.cpp -+++ b/code/Common/BaseImporter.cpp -@@ -344,7 +344,7 @@ std::string BaseImporter::GetExtension( const std::string& file ) { - #ifdef ASSIMP_USE_HUNTER - # include - #else --# include "../contrib/utf8cpp/source/utf8.h" -+# include - #endif - - // ------------------------------------------------------------------------------------------------ ---- a/code/Common/ZipArchiveIOSystem.cpp -+++ b/code/Common/ZipArchiveIOSystem.cpp -@@ -55,7 +55,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - #ifdef ASSIMP_USE_HUNTER - # include - #else --# include -+# include - #endif - - namespace Assimp { ---- a/code/Importer/IFC/IFCGeometry.cpp -+++ b/code/Importer/IFC/IFCGeometry.cpp -@@ -53,8 +53,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - # include - # include - #else --# include "../contrib/poly2tri/poly2tri/poly2tri.h" --# include "../contrib/clipper/clipper.hpp" -+# include -+# include - #endif - - #include ---- a/code/Importer/IFC/IFCLoader.cpp -+++ b/code/Importer/IFC/IFCLoader.cpp -@@ -55,7 +55,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - # ifdef ASSIMP_USE_HUNTER - # include - # else --# include -+# include - # endif - #endif - ---- a/code/Importer/IFC/IFCOpenings.cpp -+++ b/code/Importer/IFC/IFCOpenings.cpp -@@ -53,8 +53,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - # include - # include - #else --# include "../contrib/poly2tri/poly2tri/poly2tri.h" --# include "../contrib/clipper/clipper.hpp" -+# include -+# include - #endif - - #include ---- a/code/Importer/STEPParser/STEPFileEncoding.cpp -+++ b/code/Importer/STEPParser/STEPFileEncoding.cpp -@@ -48,7 +48,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - #ifdef ASSIMP_USE_HUNTER - # include - #else --# include -+# include - #endif - - #include ---- a/code/MMD/MMDPmxParser.cpp -+++ b/code/MMD/MMDPmxParser.cpp -@@ -45,7 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - #ifdef ASSIMP_USE_HUNTER - # include - #else --# include "../contrib/utf8cpp/source/utf8.h" -+# include - #endif - #include - ---- a/code/SIB/SIBImporter.cpp -+++ b/code/SIB/SIBImporter.cpp -@@ -63,7 +63,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - # include - #else - //# include "../contrib/ConvertUTF/ConvertUTF.h" --# include "../contrib/utf8cpp/source/utf8.h" -+# include - #endif - #include - #include ---- a/code/X3D/FIReader.cpp -+++ b/code/X3D/FIReader.cpp -@@ -63,7 +63,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - #ifdef ASSIMP_USE_HUNTER - # include - #else --# include "../contrib/utf8cpp/source/utf8.h" -+# include - #endif - #include - #include diff --git a/recipes/assimp/5.x/patches/0002-fix-all-exporters-disabled.patch b/recipes/assimp/5.x/patches/0002-fix-all-exporters-disabled.patch deleted file mode 100644 index 2e71d7e86ff86..0000000000000 --- a/recipes/assimp/5.x/patches/0002-fix-all-exporters-disabled.patch +++ /dev/null @@ -1,253 +0,0 @@ -patch from https://github.com/assimp/assimp/pull/2759 - ---- a/code/Common/Exporter.cpp -+++ b/code/Common/Exporter.cpp -@@ -105,90 +105,88 @@ void ExportScene3MF( const char*, IOSystem*, const aiScene*, const ExportPropert - void ExportAssimp2Json(const char* , IOSystem*, const aiScene* , const Assimp::ExportProperties*); - - // ------------------------------------------------------------------------------------------------ --// global array of all export formats which Assimp supports in its current build --Exporter::ExportFormatEntry gExporters[] = -+static void setupExporterArray(std::vector &exporters) - { - #ifndef ASSIMP_BUILD_NO_COLLADA_EXPORTER -- Exporter::ExportFormatEntry( "collada", "COLLADA - Digital Asset Exchange Schema", "dae", &ExportSceneCollada ), -+ exporters.push_back(Exporter::ExportFormatEntry( "collada", "COLLADA - Digital Asset Exchange Schema", "dae", &ExportSceneCollada )); - #endif - - #ifndef ASSIMP_BUILD_NO_X_EXPORTER -- Exporter::ExportFormatEntry( "x", "X Files", "x", &ExportSceneXFile, -- aiProcess_MakeLeftHanded | aiProcess_FlipWindingOrder | aiProcess_FlipUVs ), -+ exporters.push_back(Exporter::ExportFormatEntry( "x", "X Files", "x", &ExportSceneXFile, -+ aiProcess_MakeLeftHanded | aiProcess_FlipWindingOrder | aiProcess_FlipUVs )); - #endif - - #ifndef ASSIMP_BUILD_NO_STEP_EXPORTER -- Exporter::ExportFormatEntry( "stp", "Step Files", "stp", &ExportSceneStep, 0 ), -+ exporters.push_back(Exporter::ExportFormatEntry( "stp", "Step Files", "stp", &ExportSceneStep, 0 )); - #endif - - #ifndef ASSIMP_BUILD_NO_OBJ_EXPORTER -- Exporter::ExportFormatEntry( "obj", "Wavefront OBJ format", "obj", &ExportSceneObj, -- aiProcess_GenSmoothNormals /*| aiProcess_PreTransformVertices */ ), -- Exporter::ExportFormatEntry( "objnomtl", "Wavefront OBJ format without material file", "obj", &ExportSceneObjNoMtl, -- aiProcess_GenSmoothNormals /*| aiProcess_PreTransformVertices */ ), -+ exporters.push_back(Exporter::ExportFormatEntry( "obj", "Wavefront OBJ format", "obj", &ExportSceneObj, -+ aiProcess_GenSmoothNormals /*| aiProcess_PreTransformVertices */ )); -+ exporters.push_back(Exporter::ExportFormatEntry( "objnomtl", "Wavefront OBJ format without material file", "obj", &ExportSceneObjNoMtl, -+ aiProcess_GenSmoothNormals /*| aiProcess_PreTransformVertices */ )); - #endif - - #ifndef ASSIMP_BUILD_NO_STL_EXPORTER -- Exporter::ExportFormatEntry( "stl", "Stereolithography", "stl" , &ExportSceneSTL, -+ exporters.push_back(Exporter::ExportFormatEntry( "stl", "Stereolithography", "stl" , &ExportSceneSTL, - aiProcess_Triangulate | aiProcess_GenNormals | aiProcess_PreTransformVertices -- ), -- Exporter::ExportFormatEntry( "stlb", "Stereolithography (binary)", "stl" , &ExportSceneSTLBinary, -+ )); -+ exporters.push_back(Exporter::ExportFormatEntry( "stlb", "Stereolithography (binary)", "stl" , &ExportSceneSTLBinary, - aiProcess_Triangulate | aiProcess_GenNormals | aiProcess_PreTransformVertices -- ), -+ )); - #endif - - #ifndef ASSIMP_BUILD_NO_PLY_EXPORTER -- Exporter::ExportFormatEntry( "ply", "Stanford Polygon Library", "ply" , &ExportScenePly, -+ exporters.push_back(Exporter::ExportFormatEntry( "ply", "Stanford Polygon Library", "ply" , &ExportScenePly, - aiProcess_PreTransformVertices -- ), -- Exporter::ExportFormatEntry( "plyb", "Stanford Polygon Library (binary)", "ply", &ExportScenePlyBinary, -+ )); -+ exporters.push_back(Exporter::ExportFormatEntry( "plyb", "Stanford Polygon Library (binary)", "ply", &ExportScenePlyBinary, - aiProcess_PreTransformVertices -- ), -+ )); - #endif - - #ifndef ASSIMP_BUILD_NO_3DS_EXPORTER -- Exporter::ExportFormatEntry( "3ds", "Autodesk 3DS (legacy)", "3ds" , &ExportScene3DS, -- aiProcess_Triangulate | aiProcess_SortByPType | aiProcess_JoinIdenticalVertices ), -+ exporters.push_back(Exporter::ExportFormatEntry( "3ds", "Autodesk 3DS (legacy)", "3ds" , &ExportScene3DS, -+ aiProcess_Triangulate | aiProcess_SortByPType | aiProcess_JoinIdenticalVertices )); - #endif - - #ifndef ASSIMP_BUILD_NO_GLTF_EXPORTER -- Exporter::ExportFormatEntry( "gltf2", "GL Transmission Format v. 2", "gltf", &ExportSceneGLTF2, -- aiProcess_JoinIdenticalVertices | aiProcess_Triangulate | aiProcess_SortByPType ), -- Exporter::ExportFormatEntry( "glb2", "GL Transmission Format v. 2 (binary)", "glb", &ExportSceneGLB2, -- aiProcess_JoinIdenticalVertices | aiProcess_Triangulate | aiProcess_SortByPType ), -- Exporter::ExportFormatEntry( "gltf", "GL Transmission Format", "gltf", &ExportSceneGLTF, -- aiProcess_JoinIdenticalVertices | aiProcess_Triangulate | aiProcess_SortByPType ), -- Exporter::ExportFormatEntry( "glb", "GL Transmission Format (binary)", "glb", &ExportSceneGLB, -- aiProcess_JoinIdenticalVertices | aiProcess_Triangulate | aiProcess_SortByPType ), -+ exporters.push_back(Exporter::ExportFormatEntry( "gltf2", "GL Transmission Format v. 2", "gltf", &ExportSceneGLTF2, -+ aiProcess_JoinIdenticalVertices | aiProcess_Triangulate | aiProcess_SortByPType )); -+ exporters.push_back(Exporter::ExportFormatEntry( "glb2", "GL Transmission Format v. 2 (binary)", "glb", &ExportSceneGLB2, -+ aiProcess_JoinIdenticalVertices | aiProcess_Triangulate | aiProcess_SortByPType )); -+ exporters.push_back(Exporter::ExportFormatEntry( "gltf", "GL Transmission Format", "gltf", &ExportSceneGLTF, -+ aiProcess_JoinIdenticalVertices | aiProcess_Triangulate | aiProcess_SortByPType )); -+ exporters.push_back(Exporter::ExportFormatEntry( "glb", "GL Transmission Format (binary)", "glb", &ExportSceneGLB, -+ aiProcess_JoinIdenticalVertices | aiProcess_Triangulate | aiProcess_SortByPType )); - #endif - - #ifndef ASSIMP_BUILD_NO_ASSBIN_EXPORTER -- Exporter::ExportFormatEntry( "assbin", "Assimp Binary File", "assbin" , &ExportSceneAssbin, 0 ), -+ exporters.push_back(Exporter::ExportFormatEntry( "assbin", "Assimp Binary File", "assbin" , &ExportSceneAssbin, 0 )); - #endif - - #ifndef ASSIMP_BUILD_NO_ASSXML_EXPORTER -- Exporter::ExportFormatEntry( "assxml", "Assimp XML Document", "assxml" , &ExportSceneAssxml, 0 ), -+ exporters.push_back(Exporter::ExportFormatEntry( "assxml", "Assimp XML Document", "assxml" , &ExportSceneAssxml, 0 )); - #endif - - #ifndef ASSIMP_BUILD_NO_X3D_EXPORTER -- Exporter::ExportFormatEntry( "x3d", "Extensible 3D", "x3d" , &ExportSceneX3D, 0 ), -+ exporters.push_back(Exporter::ExportFormatEntry( "x3d", "Extensible 3D", "x3d" , &ExportSceneX3D, 0 )); - #endif - - #ifndef ASSIMP_BUILD_NO_FBX_EXPORTER -- Exporter::ExportFormatEntry( "fbx", "Autodesk FBX (binary)", "fbx", &ExportSceneFBX, 0 ), -- Exporter::ExportFormatEntry( "fbxa", "Autodesk FBX (ascii)", "fbx", &ExportSceneFBXA, 0 ), -+ exporters.push_back(Exporter::ExportFormatEntry( "fbx", "Autodesk FBX (binary)", "fbx", &ExportSceneFBX, 0 )); -+ exporters.push_back(Exporter::ExportFormatEntry( "fbxa", "Autodesk FBX (ascii)", "fbx", &ExportSceneFBXA, 0 )); - #endif - - #ifndef ASSIMP_BUILD_NO_3MF_EXPORTER -- Exporter::ExportFormatEntry( "3mf", "The 3MF-File-Format", "3mf", &ExportScene3MF, 0 ), -+ exporters.push_back(Exporter::ExportFormatEntry( "3mf", "The 3MF-File-Format", "3mf", &ExportScene3MF, 0 )); - #endif - - #ifndef ASSIMP_BUILD_NO_ASSJSON_EXPORTER -- Exporter::ExportFormatEntry( "assjson", "Assimp JSON Document", "json", &ExportAssimp2Json, 0) -+ exporters.push_back(Exporter::ExportFormatEntry( "assjson", "Assimp JSON Document", "json", &ExportAssimp2Json, 0)); - #endif --}; -+} - --#define ASSIMP_NUM_EXPORTERS (sizeof(gExporters)/sizeof(gExporters[0])) - - - class ExporterPimpl { -@@ -205,10 +203,7 @@ public: - GetPostProcessingStepInstanceList(mPostProcessingSteps); - - // grab all built-in exporters -- if ( 0 != ( ASSIMP_NUM_EXPORTERS ) ) { -- mExporters.resize( ASSIMP_NUM_EXPORTERS ); -- std::copy( gExporters, gExporters + ASSIMP_NUM_EXPORTERS, mExporters.begin() ); -- } -+ setupExporterArray(mExporters); - } - - ~ExporterPimpl() { -@@ -252,23 +247,27 @@ Exporter :: Exporter() - - // ------------------------------------------------------------------------------------------------ - Exporter::~Exporter() { -+ ai_assert(nullptr != pimpl); - FreeBlob(); - delete pimpl; - } - - // ------------------------------------------------------------------------------------------------ - void Exporter::SetIOHandler( IOSystem* pIOHandler) { -+ ai_assert(nullptr != pimpl); - pimpl->mIsDefaultIOHandler = !pIOHandler; - pimpl->mIOSystem.reset(pIOHandler); - } - - // ------------------------------------------------------------------------------------------------ - IOSystem* Exporter::GetIOHandler() const { -+ ai_assert(nullptr != pimpl); - return pimpl->mIOSystem.get(); - } - - // ------------------------------------------------------------------------------------------------ - bool Exporter::IsDefaultIOHandler() const { -+ ai_assert(nullptr != pimpl); - return pimpl->mIsDefaultIOHandler; - } - -@@ -295,6 +294,7 @@ void Exporter::SetProgressHandler(ProgressHandler* pHandler) { - // ------------------------------------------------------------------------------------------------ - const aiExportDataBlob* Exporter::ExportToBlob( const aiScene* pScene, const char* pFormatId, - unsigned int pPreprocessing, const ExportProperties* pProperties) { -+ ai_assert(nullptr != pimpl); - if (pimpl->blob) { - delete pimpl->blob; - pimpl->blob = nullptr; -@@ -319,6 +319,7 @@ const aiExportDataBlob* Exporter::ExportToBlob( const aiScene* pScene, const cha - aiReturn Exporter::Export( const aiScene* pScene, const char* pFormatId, const char* pPath, - unsigned int pPreprocessing, const ExportProperties* pProperties) { - ASSIMP_BEGIN_EXCEPTION_REGION(); -+ ai_assert(nullptr != pimpl); - - // when they create scenes from scratch, users will likely create them not in verbose - // format. They will likely not be aware that there is a flag in the scene to indicate -@@ -466,11 +467,13 @@ aiReturn Exporter::Export( const aiScene* pScene, const char* pFormatId, const c - - // ------------------------------------------------------------------------------------------------ - const char* Exporter::GetErrorString() const { -+ ai_assert(nullptr != pimpl); - return pimpl->mError.c_str(); - } - - // ------------------------------------------------------------------------------------------------ - void Exporter::FreeBlob() { -+ ai_assert(nullptr != pimpl); - delete pimpl->blob; - pimpl->blob = nullptr; - -@@ -479,11 +482,13 @@ void Exporter::FreeBlob() { - - // ------------------------------------------------------------------------------------------------ - const aiExportDataBlob* Exporter::GetBlob() const { -+ ai_assert(nullptr != pimpl); - return pimpl->blob; - } - - // ------------------------------------------------------------------------------------------------ - const aiExportDataBlob* Exporter::GetOrphanedBlob() const { -+ ai_assert(nullptr != pimpl); - const aiExportDataBlob* tmp = pimpl->blob; - pimpl->blob = nullptr; - return tmp; -@@ -491,18 +496,20 @@ const aiExportDataBlob* Exporter::GetOrphanedBlob() const { - - // ------------------------------------------------------------------------------------------------ - size_t Exporter::GetExportFormatCount() const { -+ ai_assert(nullptr != pimpl); - return pimpl->mExporters.size(); - } - - // ------------------------------------------------------------------------------------------------ - const aiExportFormatDesc* Exporter::GetExportFormatDescription( size_t index ) const { -+ ai_assert(nullptr != pimpl); - if (index >= GetExportFormatCount()) { - return nullptr; - } - - // Return from static storage if the requested index is built-in. -- if (index < sizeof(gExporters) / sizeof(gExporters[0])) { -- return &gExporters[index].mDescription; -+ if (index < pimpl->mExporters.size()) { -+ return &pimpl->mExporters[index].mDescription; - } - - return &pimpl->mExporters[index].mDescription; -@@ -510,6 +517,7 @@ const aiExportFormatDesc* Exporter::GetExportFormatDescription( size_t index ) c - - // ------------------------------------------------------------------------------------------------ - aiReturn Exporter::RegisterExporter(const ExportFormatEntry& desc) { -+ ai_assert(nullptr != pimpl); - for(const ExportFormatEntry& e : pimpl->mExporters) { - if (!strcmp(e.mDescription.id,desc.mDescription.id)) { - return aiReturn_FAILURE; -@@ -522,6 +530,7 @@ aiReturn Exporter::RegisterExporter(const ExportFormatEntry& desc) { - - // ------------------------------------------------------------------------------------------------ - void Exporter::UnregisterExporter(const char* id) { -+ ai_assert(nullptr != pimpl); - for(std::vector::iterator it = pimpl->mExporters.begin(); - it != pimpl->mExporters.end(); ++it) { - if (!strcmp((*it).mDescription.id,id)) { 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 deleted file mode 100644 index fdd67862ddb24..0000000000000 --- a/recipes/assimp/5.x/patches/0003-unvendor-deps-5.1.x.patch +++ /dev/null @@ -1,354 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -465,7 +465,12 @@ ELSE() - ENDIF() - - IF ( NOT ASSIMP_BUILD_ZLIB ) -- FIND_PACKAGE(ZLIB) -+ if(ASSIMP_BUILD_ASSBIN_IMPORTER OR ASSIMP_BUILD_ASSBIN_EXPORTER OR ASSIMP_BUILD_ASSXML_EXPORTER OR -+ ASSIMP_BUILD_BLEND_IMPORTER OR ASSIMP_BUILD_FBX_IMPORTER OR ASSIMP_BUILD_Q3BSP_IMPORTER OR -+ ASSIMP_BUILD_X_IMPORTER OR ASSIMP_BUILD_XGL_IMPORTER) -+ find_package(ZLIB REQUIRED) -+ endif() -+ set(ZLIB_FOUND TRUE) - ENDIF() - - IF( NOT ZLIB_FOUND ) -@@ -498,12 +503,14 @@ ENDIF() - - IF( NOT IOS ) - IF( NOT ASSIMP_BUILD_MINIZIP ) -- use_pkgconfig(UNZIP minizip) -+ find_package(minizip REQUIRED CONFIG) -+ set(UNZIP_FOUND TRUE) - ENDIF() - ELSE () - IF( NOT BUILD_SHARED_LIBS ) - IF( NOT ASSIMP_BUILD_MINIZIP ) -- use_pkgconfig(UNZIP minizip) -+ find_package(minizip REQUIRED CONFIG) -+ set(UNZIP_FOUND TRUE) - ENDIF() - ENDIF () - ENDIF () ---- a/code/AssetLib/3MF/D3MFExporter.cpp -+++ b/code/AssetLib/3MF/D3MFExporter.cpp -@@ -57,7 +57,7 @@ - #ifdef ASSIMP_USE_HUNTER - #include - #else --#include -+#include - #endif - - namespace Assimp { ---- a/code/AssetLib/Blender/BlenderTessellator.h -+++ b/code/AssetLib/Blender/BlenderTessellator.h -@@ -147,7 +147,7 @@ - #ifdef ASSIMP_USE_HUNTER - # include - #else --# include "../contrib/poly2tri/poly2tri/poly2tri.h" -+# include - #endif - - namespace Assimp ---- a/code/AssetLib/IFC/IFCGeometry.cpp -+++ b/code/AssetLib/IFC/IFCGeometry.cpp -@@ -53,8 +53,8 @@ - # include - # include - #else --# include "../contrib/poly2tri/poly2tri/poly2tri.h" --# include "../contrib/clipper/clipper.hpp" -+# include -+# include - #endif - - #include ---- a/code/AssetLib/IFC/IFCLoader.cpp -+++ b/code/AssetLib/IFC/IFCLoader.cpp -@@ -54,7 +54,7 @@ - #ifdef ASSIMP_USE_HUNTER - #include - #else --#include -+#include - #endif - #endif - ---- a/code/AssetLib/IFC/IFCOpenings.cpp -+++ b/code/AssetLib/IFC/IFCOpenings.cpp -@@ -53,8 +53,8 @@ - # include - # include - #else --# include "../contrib/poly2tri/poly2tri/poly2tri.h" --# include "../contrib/clipper/clipper.hpp" -+# include -+# include - #endif - - #include ---- a/code/AssetLib/M3D/M3DWrapper.hpp -+++ b/code/AssetLib/M3D/M3DWrapper.h -@@ -59,7 +59,7 @@ - - // Share stb_image's PNG loader with other importers/exporters instead of bringing our own copy. - #define STBI_ONLY_PNG --#include -+#include - - #include "m3d.h" - ---- a/code/AssetLib/MMD/MMDPmxParser.cpp -+++ b/code/AssetLib/MMD/MMDPmxParser.cpp -@@ -45,7 +45,7 @@ - #ifdef ASSIMP_USE_HUNTER - # include - #else --# include "../contrib/utf8cpp/source/utf8.h" -+# include - #endif - #include - ---- a/code/AssetLib/SIB/SIBImporter.cpp -+++ b/code/AssetLib/SIB/SIBImporter.cpp -@@ -62,7 +62,7 @@ - #include - #else - //# include "../contrib/ConvertUTF/ConvertUTF.h" --#include "../contrib/utf8cpp/source/utf8.h" -+#include - #endif - #include - #include ---- a/code/AssetLib/STEPParser/STEPFileEncoding.cpp -+++ b/code/AssetLib/STEPParser/STEPFileEncoding.cpp -@@ -48,7 +48,7 @@ - #ifdef ASSIMP_USE_HUNTER - # include - #else --# include -+# include - #endif - - #include ---- a/code/CMakeLists.txt -+++ b/code/CMakeLists.txt -@@ -887,6 +887,7 @@ IF(ASSIMP_HUNTER_ENABLED) - hunter_add_package(pugixml) - find_package(pugixml CONFIG REQUIRED) - ELSE() -+ find_package(pugixml REQUIRED CONFIG) - SET( Pugixml_SRCS - ../contrib/pugixml/src/pugiconfig.hpp - ../contrib/pugixml/src/pugixml.hpp -@@ -900,6 +901,7 @@ IF(ASSIMP_HUNTER_ENABLED) - hunter_add_package(utf8) - find_package(utf8cpp CONFIG REQUIRED) - ELSE() -+ find_package(utf8cpp REQUIRED CONFIG) - # utf8 is header-only, so Assimp doesn't need to do anything. - ENDIF() - -@@ -908,6 +910,9 @@ IF(ASSIMP_HUNTER_ENABLED) - hunter_add_package(polyclipping) - find_package(polyclipping CONFIG REQUIRED) - ELSE() -+ if(ASSIMP_BUILD_IFC_IMPORTER) -+ find_package(clipper REQUIRED CONFIG) -+ endif() - SET( Clipper_SRCS - ../contrib/clipper/clipper.hpp - ../contrib/clipper/clipper.cpp -@@ -920,6 +925,9 @@ IF(ASSIMP_HUNTER_ENABLED) - hunter_add_package(poly2tri) - find_package(poly2tri CONFIG REQUIRED) - ELSE() -+ if(ASSIMP_BUILD_BLEND_IMPORTER OR ASSIMP_BUILD_IFC_IMPORTER) -+ find_package(poly2tri REQUIRED CONFIG) -+ endif() - SET( Poly2Tri_SRCS - ../contrib/poly2tri/poly2tri/common/shapes.cc - ../contrib/poly2tri/poly2tri/common/shapes.h -@@ -957,6 +965,9 @@ IF(ASSIMP_HUNTER_ENABLED) - hunter_add_package(zip) - find_package(zip CONFIG REQUIRED) - ELSE() -+ if(ASSIMP_BUILD_3MF_EXPORTER) -+ find_package(zip REQUIRED CONFIG) -+ endif() - SET( ziplib_SRCS - ../contrib/zip/src/miniz.h - ../contrib/zip/src/zip.c -@@ -978,6 +989,9 @@ IF(ASSIMP_HUNTER_ENABLED) - hunter_add_package(openddlparser) - find_package(openddlparser CONFIG REQUIRED) - ELSE() -+ if(ASSIMP_BUILD_OPENGEX_IMPORTER) -+ find_package(openddlparser REQUIRED CONFIG) -+ endif() - SET ( openddl_parser_SRCS - ../contrib/openddlparser/code/OpenDDLParser.cpp - ../contrib/openddlparser/code/DDLNode.cpp -@@ -1052,7 +1066,9 @@ IF(ASSIMP_HUNTER_ENABLED) - hunter_add_package(RapidJSON) - find_package(RapidJSON CONFIG REQUIRED) - ELSE() -- INCLUDE_DIRECTORIES("../contrib/rapidjson/include") -+ if(ASSIMP_BUILD_GLTF_IMPORTER OR ASSIMP_BUILD_GLTF_EXPORTER) -+ 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 ) - if(ASSIMP_RAPIDJSON_NO_MEMBER_ITERATOR) -@@ -1065,10 +1081,12 @@ IF(ASSIMP_HUNTER_ENABLED) - hunter_add_package(stb) - find_package(stb CONFIG REQUIRED) - ELSE() -+ if(ASSIMP_BUILD_M3D_IMPORTER OR ASSIMP_BUILD_M3D_EXPORTER OR ASSIMP_BUILD_PBRT_EXPORTER) -+ find_package(stb REQUIRED CONFIG) -+ endif() - SET( stb_SRCS - ../contrib/stb/stb_image.h - ) -- INCLUDE_DIRECTORIES("../contrib") - SOURCE_GROUP( Contrib\\stb FILES ${stb_SRCS}) - ENDIF() - -@@ -1123,14 +1141,7 @@ SET( assimp_src - ${ASSIMP_EXPORTER_SRCS} - - # Third-party libraries -- ${unzip_compile_SRCS} -- ${Poly2Tri_SRCS} -- ${Clipper_SRCS} -- ${openddl_parser_SRCS} - ${open3dgc_SRCS} -- ${ziplib_SRCS} -- ${Pugixml_SRCS} -- ${stb_SRCS} - # Necessary to show the headers in the project when using the VC++ generator: - - ${PUBLIC_HEADERS} -@@ -1141,7 +1152,7 @@ ADD_DEFINITIONS( -DOPENDDLPARSER_BUILD ) - IF(NOT ASSIMP_HUNTER_ENABLED) - INCLUDE_DIRECTORIES( - ${IRRXML_INCLUDE_DIR} -- ../contrib/openddlparser/include -+ ../contrib # for Open3DGC - ) - ENDIF() - -@@ -1150,8 +1161,8 @@ IF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER) - INCLUDE_DIRECTORIES(${C4D_INCLUDES}) - ENDIF () - --IF (ASSIMP_BUILD_DRACO) -- INCLUDE_DIRECTORIES(${draco_INCLUDE_DIRS}) -+if(ASSIMP_BUILD_GLTF_IMPORTER OR ASSIMP_BUILD_GLTF_EXPORTER) -+ find_package(draco REQUIRED CONFIG) - ADD_DEFINITIONS( -DASSIMP_ENABLE_DRACO ) - ENDIF() - -@@ -1162,9 +1173,7 @@ TARGET_USE_COMMON_OUTPUT_DIRECTORY(assimp) - - # enable warnings as errors ######################################## - IF (MSVC) -- TARGET_COMPILE_OPTIONS(assimp PRIVATE /WX) - ELSE() -- TARGET_COMPILE_OPTIONS(assimp PRIVATE -Werror) - ENDIF() - - # adds C_FLAGS required to compile zip.c on old GCC 4.x compiler -@@ -1195,9 +1204,32 @@ IF(ASSIMP_HUNTER_ENABLED) - target_link_libraries(assimp PUBLIC ${draco_LIBRARIES}) - endif() - ELSE() -- TARGET_LINK_LIBRARIES(assimp ${ZLIB_LIBRARIES} ${OPENDDL_PARSER_LIBRARIES}) -- if (ASSIMP_BUILD_DRACO) -- target_link_libraries(assimp ${draco_LIBRARIES}) -+ target_link_libraries(assimp pugixml::pugixml utf8cpp) -+ if(ASSIMP_BUILD_ASSBIN_IMPORTER OR ASSIMP_BUILD_ASSBIN_EXPORTER OR ASSIMP_BUILD_ASSXML_EXPORTER OR -+ ASSIMP_BUILD_BLEND_IMPORTER OR ASSIMP_BUILD_FBX_IMPORTER OR ASSIMP_BUILD_Q3BSP_IMPORTER OR -+ ASSIMP_BUILD_X_IMPORTER OR ASSIMP_BUILD_XGL_IMPORTER) -+ target_link_libraries(assimp ZLIB::ZLIB) -+ endif() -+ if(ASSIMP_BUILD_IFC_IMPORTER) -+ target_link_libraries(assimp clipper::clipper) -+ endif() -+ if(ASSIMP_BUILD_BLEND_IMPORTER OR ASSIMP_BUILD_IFC_IMPORTER) -+ target_link_libraries(assimp poly2tri::poly2tri) -+ endif() -+ if(ASSIMP_BUILD_3MF_EXPORTER) -+ target_link_libraries(assimp zip::zip) -+ endif() -+ if(ASSIMP_BUILD_OPENGEX_IMPORTER) -+ target_link_libraries(assimp openddlparser::openddlparser) -+ endif() -+ if(ASSIMP_BUILD_GLTF_IMPORTER OR ASSIMP_BUILD_GLTF_EXPORTER) -+ 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) -+ endif() -+ if(ASSIMP_BUILD_GLTF_IMPORTER OR ASSIMP_BUILD_GLTF_EXPORTER) -+ target_link_libraries(assimp draco::draco) - endif() - ENDIF() - -@@ -1279,8 +1311,7 @@ ENDIF() - # assimp can #include "unzip.h" - IF(NOT ASSIMP_HUNTER_ENABLED) - if (UNZIP_FOUND) -- INCLUDE_DIRECTORIES(${UNZIP_INCLUDE_DIRS}) -- TARGET_LINK_LIBRARIES(assimp ${UNZIP_LIBRARIES}) -+ target_link_libraries(assimp minizip::minizip) - else () - INCLUDE_DIRECTORIES("../") - endif () ---- a/code/Common/Assimp.cpp -+++ b/code/Common/Assimp.cpp -@@ -1290,7 +1290,7 @@ - # endif - - # define STB_IMAGE_IMPLEMENTATION --# include "stb/stb_image.h" -+# include "stb_image.h" - - # if _MSC_VER - # pragma warning(pop) ---- a/code/Common/BaseImporter.cpp -+++ b/code/Common/BaseImporter.cpp -@@ -330,7 +330,7 @@ - #ifdef ASSIMP_USE_HUNTER - #include - #else --#include "../contrib/utf8cpp/source/utf8.h" -+#include - #endif - - // ------------------------------------------------------------------------------------------------ ---- a/code/Common/ZipArchiveIOSystem.cpp -+++ b/code/Common/ZipArchiveIOSystem.cpp -@@ -54,7 +54,7 @@ - #ifdef ASSIMP_USE_HUNTER - # include - #else --# include -+# include - #endif - - namespace Assimp { ---- a/code/Pbrt/PbrtExporter.cpp -+++ b/code/Pbrt/PbrtExporter.cpp -@@ -83,7 +83,7 @@ - #include - #include - --#include "stb/stb_image.h" -+#include "stb_image.h" - - using namespace Assimp; - 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 deleted file mode 100644 index 67d2f67fd3661..0000000000000 --- a/recipes/assimp/5.x/patches/0004-unvendor-deps-5.1.6.patch +++ /dev/null @@ -1,330 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -466,7 +466,12 @@ ELSE() - ENDIF() - - IF ( NOT ASSIMP_BUILD_ZLIB ) -- FIND_PACKAGE(ZLIB) -+ if(ASSIMP_BUILD_ASSBIN_IMPORTER OR ASSIMP_BUILD_ASSBIN_EXPORTER OR ASSIMP_BUILD_ASSXML_EXPORTER OR -+ ASSIMP_BUILD_BLEND_IMPORTER OR ASSIMP_BUILD_FBX_IMPORTER OR ASSIMP_BUILD_Q3BSP_IMPORTER OR -+ ASSIMP_BUILD_X_IMPORTER OR ASSIMP_BUILD_XGL_IMPORTER) -+ find_package(ZLIB REQUIRED) -+ endif() -+ set(ZLIB_FOUND TRUE) - ENDIF() - - IF( NOT ZLIB_FOUND ) -@@ -499,12 +504,14 @@ ENDIF() - - IF( NOT IOS ) - IF( NOT ASSIMP_BUILD_MINIZIP ) -- use_pkgconfig(UNZIP minizip) -+ find_package(minizip REQUIRED CONFIG) -+ set(UNZIP_FOUND TRUE) - ENDIF() - ELSE () - IF( NOT BUILD_SHARED_LIBS ) - IF( NOT ASSIMP_BUILD_MINIZIP ) -- use_pkgconfig(UNZIP minizip) -+ find_package(minizip REQUIRED CONFIG) -+ set(UNZIP_FOUND TRUE) - ENDIF() - ENDIF () - ENDIF () ---- a/code/AssetLib/3MF/D3MFExporter.cpp -+++ b/code/AssetLib/3MF/D3MFExporter.cpp -@@ -57,7 +57,7 @@ - #ifdef ASSIMP_USE_HUNTER - #include - #else --#include -+#include - #endif - - namespace Assimp { ---- a/code/AssetLib/Blender/BlenderTessellator.h -+++ b/code/AssetLib/Blender/BlenderTessellator.h -@@ -147,7 +147,7 @@ - #ifdef ASSIMP_USE_HUNTER - # include - #else --# include "../contrib/poly2tri/poly2tri/poly2tri.h" -+# include - #endif - - namespace Assimp ---- a/code/AssetLib/IFC/IFCGeometry.cpp -+++ b/code/AssetLib/IFC/IFCGeometry.cpp -@@ -53,8 +53,8 @@ - # include - # include - #else --# include "../contrib/poly2tri/poly2tri/poly2tri.h" --# include "../contrib/clipper/clipper.hpp" -+# include -+# include - #endif - - #include ---- a/code/AssetLib/IFC/IFCOpenings.cpp -+++ b/code/AssetLib/IFC/IFCOpenings.cpp -@@ -53,8 +53,8 @@ - # include - # include - #else --# include "../contrib/poly2tri/poly2tri/poly2tri.h" --# include "../contrib/clipper/clipper.hpp" -+# include -+# include - #endif - - #include ---- a/code/AssetLib/M3D/M3DWrapper.h -+++ b/code/AssetLib/M3D/M3DWrapper.h -@@ -59,7 +59,7 @@ - - // Share stb_image's PNG loader with other importers/exporters instead of bringing our own copy. - #define STBI_ONLY_PNG --#include -+#include - - #include "m3d.h" - ---- a/code/AssetLib/MMD/MMDPmxParser.cpp -+++ b/code/AssetLib/MMD/MMDPmxParser.cpp -@@ -45,7 +45,7 @@ - #ifdef ASSIMP_USE_HUNTER - # include - #else --# include "../contrib/utf8cpp/source/utf8.h" -+# include - #endif - #include - ---- a/code/AssetLib/SIB/SIBImporter.cpp -+++ b/code/AssetLib/SIB/SIBImporter.cpp -@@ -62,7 +62,7 @@ - #include - #else - //# include "../contrib/ConvertUTF/ConvertUTF.h" --#include "../contrib/utf8cpp/source/utf8.h" -+#include - #endif - #include - #include ---- a/code/AssetLib/STEPParser/STEPFileEncoding.cpp -+++ b/code/AssetLib/STEPParser/STEPFileEncoding.cpp -@@ -48,7 +48,7 @@ - #ifdef ASSIMP_USE_HUNTER - # include - #else --# include -+# include - #endif - - #include ---- a/code/CMakeLists.txt -+++ b/code/CMakeLists.txt -@@ -888,6 +888,7 @@ IF(ASSIMP_HUNTER_ENABLED) - hunter_add_package(pugixml) - find_package(pugixml CONFIG REQUIRED) - ELSE() -+ find_package(pugixml REQUIRED CONFIG) - SET( Pugixml_SRCS - ../contrib/pugixml/src/pugiconfig.hpp - ../contrib/pugixml/src/pugixml.hpp -@@ -901,6 +902,7 @@ IF(ASSIMP_HUNTER_ENABLED) - hunter_add_package(utf8) - find_package(utf8cpp CONFIG REQUIRED) - ELSE() -+ find_package(utf8cpp REQUIRED CONFIG) - # utf8 is header-only, so Assimp doesn't need to do anything. - ENDIF() - -@@ -909,6 +911,9 @@ IF(ASSIMP_HUNTER_ENABLED) - hunter_add_package(polyclipping) - find_package(polyclipping CONFIG REQUIRED) - ELSE() -+ if(ASSIMP_BUILD_IFC_IMPORTER) -+ find_package(clipper REQUIRED CONFIG) -+ endif() - SET( Clipper_SRCS - ../contrib/clipper/clipper.hpp - ../contrib/clipper/clipper.cpp -@@ -921,6 +926,9 @@ IF(ASSIMP_HUNTER_ENABLED) - hunter_add_package(poly2tri) - find_package(poly2tri CONFIG REQUIRED) - ELSE() -+ if(ASSIMP_BUILD_BLEND_IMPORTER OR ASSIMP_BUILD_IFC_IMPORTER) -+ find_package(poly2tri REQUIRED CONFIG) -+ endif() - SET( Poly2Tri_SRCS - ../contrib/poly2tri/poly2tri/common/shapes.cc - ../contrib/poly2tri/poly2tri/common/shapes.h -@@ -960,6 +968,7 @@ IF(3MF IN_LIST ASSIMP_EXPORTERS_LIST) - hunter_add_package(zip) - find_package(zip CONFIG REQUIRED) - ELSE() -+ find_package(zip REQUIRED CONFIG) - SET( ziplib_SRCS - ../contrib/zip/src/miniz.h - ../contrib/zip/src/zip.c -@@ -982,6 +991,9 @@ IF(ASSIMP_HUNTER_ENABLED) - hunter_add_package(openddlparser) - find_package(openddlparser CONFIG REQUIRED) - ELSE() -+ if(ASSIMP_BUILD_OPENGEX_IMPORTER) -+ find_package(openddlparser REQUIRED CONFIG) -+ endif() - SET ( openddl_parser_SRCS - ../contrib/openddlparser/code/OpenDDLParser.cpp - ../contrib/openddlparser/code/DDLNode.cpp -@@ -1056,7 +1068,9 @@ IF(ASSIMP_HUNTER_ENABLED) - hunter_add_package(RapidJSON) - find_package(RapidJSON CONFIG REQUIRED) - ELSE() -- INCLUDE_DIRECTORIES("../contrib/rapidjson/include") -+ if(ASSIMP_BUILD_GLTF_IMPORTER OR ASSIMP_BUILD_GLTF_EXPORTER) -+ 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 ) - if(ASSIMP_RAPIDJSON_NO_MEMBER_ITERATOR) -@@ -1069,10 +1083,12 @@ IF(ASSIMP_HUNTER_ENABLED) - hunter_add_package(stb) - find_package(stb CONFIG REQUIRED) - ELSE() -+ if(ASSIMP_BUILD_M3D_IMPORTER OR ASSIMP_BUILD_M3D_EXPORTER OR ASSIMP_BUILD_PBRT_EXPORTER) -+ find_package(stb REQUIRED CONFIG) -+ endif() - SET( stb_SRCS - ../contrib/stb/stb_image.h - ) -- INCLUDE_DIRECTORIES("../contrib") - SOURCE_GROUP( Contrib\\stb FILES ${stb_SRCS}) - ENDIF() - -@@ -1127,14 +1143,7 @@ SET( assimp_src - ${ASSIMP_EXPORTER_SRCS} - - # Third-party libraries -- ${unzip_compile_SRCS} -- ${Poly2Tri_SRCS} -- ${Clipper_SRCS} -- ${openddl_parser_SRCS} - ${open3dgc_SRCS} -- ${ziplib_SRCS} -- ${Pugixml_SRCS} -- ${stb_SRCS} - # Necessary to show the headers in the project when using the VC++ generator: - - ${PUBLIC_HEADERS} -@@ -1145,7 +1154,7 @@ ADD_DEFINITIONS( -DOPENDDLPARSER_BUILD ) - IF(NOT ASSIMP_HUNTER_ENABLED) - INCLUDE_DIRECTORIES( - ${IRRXML_INCLUDE_DIR} -- ../contrib/openddlparser/include -+ ../contrib # for Open3DGC - ) - ENDIF() - -@@ -1154,8 +1163,8 @@ IF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER) - INCLUDE_DIRECTORIES(${C4D_INCLUDES}) - ENDIF () - --IF (ASSIMP_BUILD_DRACO) -- INCLUDE_DIRECTORIES(${draco_INCLUDE_DIRS}) -+if(ASSIMP_BUILD_GLTF_IMPORTER OR ASSIMP_BUILD_GLTF_EXPORTER) -+ find_package(draco REQUIRED CONFIG) - ADD_DEFINITIONS( -DASSIMP_ENABLE_DRACO ) - ENDIF() - -@@ -1166,9 +1175,7 @@ TARGET_USE_COMMON_OUTPUT_DIRECTORY(assimp) - - # enable warnings as errors ######################################## - IF (MSVC) -- TARGET_COMPILE_OPTIONS(assimp PRIVATE /WX) - ELSE() -- TARGET_COMPILE_OPTIONS(assimp PRIVATE -Werror) - ENDIF() - - # adds C_FLAGS required to compile zip.c on old GCC 4.x compiler -@@ -1201,9 +1208,32 @@ IF(ASSIMP_HUNTER_ENABLED) - target_link_libraries(assimp PUBLIC ${draco_LIBRARIES}) - endif() - ELSE() -- TARGET_LINK_LIBRARIES(assimp ${ZLIB_LIBRARIES} ${OPENDDL_PARSER_LIBRARIES}) -- if (ASSIMP_BUILD_DRACO) -- target_link_libraries(assimp ${draco_LIBRARIES}) -+ target_link_libraries(assimp pugixml::pugixml utf8cpp) -+ if(ASSIMP_BUILD_ASSBIN_IMPORTER OR ASSIMP_BUILD_ASSBIN_EXPORTER OR ASSIMP_BUILD_ASSXML_EXPORTER OR -+ ASSIMP_BUILD_BLEND_IMPORTER OR ASSIMP_BUILD_FBX_IMPORTER OR ASSIMP_BUILD_Q3BSP_IMPORTER OR -+ ASSIMP_BUILD_X_IMPORTER OR ASSIMP_BUILD_XGL_IMPORTER) -+ target_link_libraries(assimp ZLIB::ZLIB) -+ endif() -+ if(ASSIMP_BUILD_IFC_IMPORTER) -+ target_link_libraries(assimp clipper::clipper) -+ endif() -+ if(ASSIMP_BUILD_BLEND_IMPORTER OR ASSIMP_BUILD_IFC_IMPORTER) -+ target_link_libraries(assimp poly2tri::poly2tri) -+ endif() -+ if(ASSIMP_BUILD_3MF_EXPORTER) -+ target_link_libraries(assimp zip::zip) -+ endif() -+ if(ASSIMP_BUILD_OPENGEX_IMPORTER) -+ target_link_libraries(assimp openddlparser::openddlparser) -+ endif() -+ if(ASSIMP_BUILD_GLTF_IMPORTER OR ASSIMP_BUILD_GLTF_EXPORTER) -+ 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) -+ endif() -+ if(ASSIMP_BUILD_GLTF_IMPORTER OR ASSIMP_BUILD_GLTF_EXPORTER) -+ target_link_libraries(assimp draco::draco) - endif() - ENDIF() - -@@ -1291,8 +1321,7 @@ ENDIF() - # assimp can #include "unzip.h" - IF(NOT ASSIMP_HUNTER_ENABLED) - if (UNZIP_FOUND) -- INCLUDE_DIRECTORIES(${UNZIP_INCLUDE_DIRS}) -- TARGET_LINK_LIBRARIES(assimp ${UNZIP_LIBRARIES}) -+ target_link_libraries(assimp minizip::minizip) - else () - INCLUDE_DIRECTORIES("../") - endif () ---- a/code/Common/Assimp.cpp -+++ b/code/Common/Assimp.cpp -@@ -1290,7 +1290,7 @@ - # endif - - # define STB_IMAGE_IMPLEMENTATION --# include "stb/stb_image.h" -+# include "stb_image.h" - - # if _MSC_VER - # pragma warning(pop) ---- a/code/Common/BaseImporter.cpp -+++ b/code/Common/BaseImporter.cpp -@@ -331,7 +331,7 @@ - #ifdef ASSIMP_USE_HUNTER - #include - #else --#include "../contrib/utf8cpp/source/utf8.h" -+#include - #endif - - // ------------------------------------------------------------------------------------------------ ---- a/code/Pbrt/PbrtExporter.cpp -+++ b/code/Pbrt/PbrtExporter.cpp -@@ -83,7 +83,7 @@ - #include - #include - --#include "stb/stb_image.h" -+#include "stb_image.h" - - using namespace Assimp; - 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 deleted file mode 100644 index 2a1e7bc39e620..0000000000000 --- a/recipes/assimp/5.x/patches/0006-unvendor-deps-5.2.x.patch +++ /dev/null @@ -1,330 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -488,7 +488,12 @@ ELSE() - ENDIF() - - IF ( NOT ASSIMP_BUILD_ZLIB ) -- FIND_PACKAGE(ZLIB) -+ if(ASSIMP_BUILD_ASSBIN_IMPORTER OR ASSIMP_BUILD_ASSBIN_EXPORTER OR ASSIMP_BUILD_ASSXML_EXPORTER OR -+ ASSIMP_BUILD_BLEND_IMPORTER OR ASSIMP_BUILD_FBX_IMPORTER OR ASSIMP_BUILD_Q3BSP_IMPORTER OR -+ ASSIMP_BUILD_X_IMPORTER OR ASSIMP_BUILD_XGL_IMPORTER) -+ find_package(ZLIB REQUIRED) -+ endif() -+ set(ZLIB_FOUND TRUE) - ENDIF() - - IF( NOT ZLIB_FOUND ) -@@ -521,12 +526,14 @@ ENDIF() - - IF( NOT IOS ) - IF( NOT ASSIMP_BUILD_MINIZIP ) -- use_pkgconfig(UNZIP minizip) -+ find_package(minizip REQUIRED CONFIG) -+ set(UNZIP_FOUND TRUE) - ENDIF() - ELSE () - IF( NOT BUILD_SHARED_LIBS ) - IF( NOT ASSIMP_BUILD_MINIZIP ) -- use_pkgconfig(UNZIP minizip) -+ find_package(minizip REQUIRED CONFIG) -+ set(UNZIP_FOUND TRUE) - ENDIF() - ENDIF () - ENDIF () ---- a/code/AssetLib/3MF/D3MFExporter.cpp -+++ b/code/AssetLib/3MF/D3MFExporter.cpp -@@ -57,7 +57,7 @@ - #ifdef ASSIMP_USE_HUNTER - #include - #else --#include -+#include - #endif - - namespace Assimp { ---- a/code/AssetLib/Blender/BlenderTessellator.h -+++ b/code/AssetLib/Blender/BlenderTessellator.h -@@ -147,7 +147,7 @@ - #ifdef ASSIMP_USE_HUNTER - # include - #else --# include "../contrib/poly2tri/poly2tri/poly2tri.h" -+# include - #endif - - namespace Assimp ---- a/code/AssetLib/IFC/IFCGeometry.cpp -+++ b/code/AssetLib/IFC/IFCGeometry.cpp -@@ -53,8 +53,8 @@ - # include - # include - #else --# include "../contrib/poly2tri/poly2tri/poly2tri.h" --# include "../contrib/clipper/clipper.hpp" -+# include -+# include - #endif - - #include ---- a/code/AssetLib/IFC/IFCOpenings.cpp -+++ b/code/AssetLib/IFC/IFCOpenings.cpp -@@ -53,8 +53,8 @@ - # include - # include - #else --# include "../contrib/poly2tri/poly2tri/poly2tri.h" --# include "../contrib/clipper/clipper.hpp" -+# include -+# include - #endif - - #include ---- a/code/AssetLib/M3D/M3DWrapper.h -+++ b/code/AssetLib/M3D/M3DWrapper.h -@@ -59,7 +59,7 @@ - - // Share stb_image's PNG loader with other importers/exporters instead of bringing our own copy. - #define STBI_ONLY_PNG --#include -+#include - - #include "m3d.h" - ---- a/code/AssetLib/MMD/MMDPmxParser.cpp -+++ b/code/AssetLib/MMD/MMDPmxParser.cpp -@@ -45,7 +45,7 @@ - #ifdef ASSIMP_USE_HUNTER - # include - #else --# include "../contrib/utf8cpp/source/utf8.h" -+# include - #endif - #include - ---- a/code/AssetLib/SIB/SIBImporter.cpp -+++ b/code/AssetLib/SIB/SIBImporter.cpp -@@ -59,7 +59,7 @@ - #ifdef ASSIMP_USE_HUNTER - #include - #else --#include "../contrib/utf8cpp/source/utf8.h" -+#include - #endif - #include - #include ---- a/code/AssetLib/STEPParser/STEPFileEncoding.cpp -+++ b/code/AssetLib/STEPParser/STEPFileEncoding.cpp -@@ -48,7 +48,7 @@ - #ifdef ASSIMP_USE_HUNTER - # include - #else --# include -+# include - #endif - - #include ---- a/code/CMakeLists.txt -+++ b/code/CMakeLists.txt -@@ -899,6 +899,7 @@ IF(ASSIMP_HUNTER_ENABLED) - hunter_add_package(pugixml) - find_package(pugixml CONFIG REQUIRED) - ELSE() -+ find_package(pugixml REQUIRED CONFIG) - SET( Pugixml_SRCS - ../contrib/pugixml/src/pugiconfig.hpp - ../contrib/pugixml/src/pugixml.hpp -@@ -912,6 +913,7 @@ IF(ASSIMP_HUNTER_ENABLED) - hunter_add_package(utf8) - find_package(utf8cpp CONFIG REQUIRED) - ELSE() -+ find_package(utf8cpp REQUIRED CONFIG) - # utf8 is header-only, so Assimp doesn't need to do anything. - ENDIF() - -@@ -920,6 +922,9 @@ IF(ASSIMP_HUNTER_ENABLED) - hunter_add_package(polyclipping) - find_package(polyclipping CONFIG REQUIRED) - ELSE() -+ if(ASSIMP_BUILD_IFC_IMPORTER) -+ find_package(clipper REQUIRED CONFIG) -+ endif() - SET( Clipper_SRCS - ../contrib/clipper/clipper.hpp - ../contrib/clipper/clipper.cpp -@@ -932,6 +937,9 @@ IF(ASSIMP_HUNTER_ENABLED) - hunter_add_package(poly2tri) - find_package(poly2tri CONFIG REQUIRED) - ELSE() -+ if(ASSIMP_BUILD_BLEND_IMPORTER OR ASSIMP_BUILD_IFC_IMPORTER) -+ find_package(poly2tri REQUIRED CONFIG) -+ endif() - SET( Poly2Tri_SRCS - ../contrib/poly2tri/poly2tri/common/shapes.cc - ../contrib/poly2tri/poly2tri/common/shapes.h -@@ -971,6 +979,7 @@ IF(3MF IN_LIST ASSIMP_EXPORTERS_LIST) - hunter_add_package(zip) - find_package(zip CONFIG REQUIRED) - ELSE() -+ find_package(zip REQUIRED CONFIG) - SET( ziplib_SRCS - ../contrib/zip/src/miniz.h - ../contrib/zip/src/zip.c -@@ -993,6 +1002,9 @@ IF(ASSIMP_HUNTER_ENABLED) - hunter_add_package(openddlparser) - find_package(openddlparser CONFIG REQUIRED) - ELSE() -+ if(ASSIMP_BUILD_OPENGEX_IMPORTER) -+ find_package(openddlparser REQUIRED CONFIG) -+ endif() - SET ( openddl_parser_SRCS - ../contrib/openddlparser/code/OpenDDLParser.cpp - ../contrib/openddlparser/code/DDLNode.cpp -@@ -1067,7 +1079,9 @@ IF(ASSIMP_HUNTER_ENABLED) - hunter_add_package(RapidJSON) - find_package(RapidJSON CONFIG REQUIRED) - ELSE() -- INCLUDE_DIRECTORIES("../contrib/rapidjson/include") -+ if(ASSIMP_BUILD_GLTF_IMPORTER OR ASSIMP_BUILD_GLTF_EXPORTER) -+ 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 ) - if(ASSIMP_RAPIDJSON_NO_MEMBER_ITERATOR) -@@ -1080,10 +1094,12 @@ IF(ASSIMP_HUNTER_ENABLED) - hunter_add_package(stb) - find_package(stb CONFIG REQUIRED) - ELSE() -+ if(ASSIMP_BUILD_M3D_IMPORTER OR ASSIMP_BUILD_M3D_EXPORTER OR ASSIMP_BUILD_PBRT_EXPORTER) -+ find_package(stb REQUIRED CONFIG) -+ endif() - SET( stb_SRCS - ../contrib/stb/stb_image.h - ) -- INCLUDE_DIRECTORIES("../contrib") - SOURCE_GROUP( Contrib\\stb FILES ${stb_SRCS}) - ENDIF() - -@@ -1138,14 +1154,7 @@ SET( assimp_src - ${ASSIMP_EXPORTER_SRCS} - - # Third-party libraries -- ${unzip_compile_SRCS} -- ${Poly2Tri_SRCS} -- ${Clipper_SRCS} -- ${openddl_parser_SRCS} - ${open3dgc_SRCS} -- ${ziplib_SRCS} -- ${Pugixml_SRCS} -- ${stb_SRCS} - # Necessary to show the headers in the project when using the VC++ generator: - - ${PUBLIC_HEADERS} -@@ -1156,7 +1165,7 @@ ADD_DEFINITIONS( -DOPENDDLPARSER_BUILD ) - IF(NOT ASSIMP_HUNTER_ENABLED) - INCLUDE_DIRECTORIES( - ${IRRXML_INCLUDE_DIR} -- ../contrib/openddlparser/include -+ ../contrib # for Open3DGC - ) - ENDIF() - -@@ -1165,8 +1174,8 @@ IF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER) - INCLUDE_DIRECTORIES(${C4D_INCLUDES}) - ENDIF () - --IF (ASSIMP_BUILD_DRACO) -- INCLUDE_DIRECTORIES(${draco_INCLUDE_DIRS}) -+if(ASSIMP_BUILD_GLTF_IMPORTER OR ASSIMP_BUILD_GLTF_EXPORTER) -+ find_package(draco REQUIRED CONFIG) - ADD_DEFINITIONS( -DASSIMP_ENABLE_DRACO ) - ENDIF() - -@@ -1177,9 +1186,7 @@ TARGET_USE_COMMON_OUTPUT_DIRECTORY(assimp) - - # enable warnings as errors ######################################## - IF (MSVC) -- TARGET_COMPILE_OPTIONS(assimp PRIVATE /WX) - ELSE() -- TARGET_COMPILE_OPTIONS(assimp PRIVATE -Werror) - ENDIF() - - # adds C_FLAGS required to compile zip.c on old GCC 4.x compiler -@@ -1212,9 +1219,32 @@ IF(ASSIMP_HUNTER_ENABLED) - target_link_libraries(assimp PUBLIC ${draco_LIBRARIES}) - endif() - ELSE() -- TARGET_LINK_LIBRARIES(assimp ${ZLIB_LIBRARIES} ${OPENDDL_PARSER_LIBRARIES}) -- if (ASSIMP_BUILD_DRACO) -- target_link_libraries(assimp ${draco_LIBRARIES}) -+ target_link_libraries(assimp pugixml::pugixml utf8cpp) -+ if(ASSIMP_BUILD_ASSBIN_IMPORTER OR ASSIMP_BUILD_ASSBIN_EXPORTER OR ASSIMP_BUILD_ASSXML_EXPORTER OR -+ ASSIMP_BUILD_BLEND_IMPORTER OR ASSIMP_BUILD_FBX_IMPORTER OR ASSIMP_BUILD_Q3BSP_IMPORTER OR -+ ASSIMP_BUILD_X_IMPORTER OR ASSIMP_BUILD_XGL_IMPORTER) -+ target_link_libraries(assimp ZLIB::ZLIB) -+ endif() -+ if(ASSIMP_BUILD_IFC_IMPORTER) -+ target_link_libraries(assimp clipper::clipper) -+ endif() -+ if(ASSIMP_BUILD_BLEND_IMPORTER OR ASSIMP_BUILD_IFC_IMPORTER) -+ target_link_libraries(assimp poly2tri::poly2tri) -+ endif() -+ if(ASSIMP_BUILD_3MF_EXPORTER) -+ target_link_libraries(assimp zip::zip) -+ endif() -+ if(ASSIMP_BUILD_OPENGEX_IMPORTER) -+ target_link_libraries(assimp openddlparser::openddlparser) -+ endif() -+ if(ASSIMP_BUILD_GLTF_IMPORTER OR ASSIMP_BUILD_GLTF_EXPORTER) -+ 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) -+ endif() -+ if(ASSIMP_BUILD_GLTF_IMPORTER OR ASSIMP_BUILD_GLTF_EXPORTER) -+ target_link_libraries(assimp draco::draco) - endif() - ENDIF() - -@@ -1302,8 +1332,7 @@ ENDIF() - # assimp can #include "unzip.h" - IF(NOT ASSIMP_HUNTER_ENABLED) - if (UNZIP_FOUND) -- INCLUDE_DIRECTORIES(${UNZIP_INCLUDE_DIRS}) -- TARGET_LINK_LIBRARIES(assimp ${UNZIP_LIBRARIES}) -+ target_link_libraries(assimp minizip::minizip) - else () - INCLUDE_DIRECTORIES("../") - endif () ---- a/code/Common/Assimp.cpp -+++ b/code/Common/Assimp.cpp -@@ -1290,7 +1290,7 @@ - # endif - - # define STB_IMAGE_IMPLEMENTATION --# include "stb/stb_image.h" -+# include "stb_image.h" - - # if _MSC_VER - # pragma warning(pop) ---- a/code/Common/BaseImporter.cpp -+++ b/code/Common/BaseImporter.cpp -@@ -332,7 +332,7 @@ - #ifdef ASSIMP_USE_HUNTER - #include - #else --#include "../contrib/utf8cpp/source/utf8.h" -+#include - #endif - - // ------------------------------------------------------------------------------------------------ ---- a/code/Pbrt/PbrtExporter.cpp -+++ b/code/Pbrt/PbrtExporter.cpp -@@ -83,7 +83,7 @@ - #include - #include - --#include "stb/stb_image.h" -+#include "stb_image.h" - - using namespace Assimp; - diff --git a/recipes/assimp/config.yml b/recipes/assimp/config.yml index 2542b27436840..51044970f061a 100644 --- a/recipes/assimp/config.yml +++ b/recipes/assimp/config.yml @@ -1,11 +1,13 @@ versions: - "5.2.2": + "5.4.3": folder: "5.x" - "5.1.6": + "5.4.2": + folder: "5.x" + "5.4.1": folder: "5.x" - "5.1.0": + "5.3.1": folder: "5.x" - "5.0.1": + "5.2.5": folder: "5.x" - "5.0.0": + "5.1.6": folder: "5.x" 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..2fab4a9810372 100644 --- a/recipes/astc-codec/all/conanfile.py +++ b/recipes/astc-codec/all/conanfile.py @@ -1,73 +1,72 @@ +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): name = "astc-codec" - description = " A software ASTC decoder implementation which supports the ASTC LDR profile" + description = "A software ASTC decoder implementation which supports the ASTC LDR profile" 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") + + package_type = "library" + 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/atlas_small_4x4.astc b/recipes/astc-codec/all/test_package/atlas_small_4x4.astc deleted file mode 100644 index 0dd080b12d23f..0000000000000 Binary files a/recipes/astc-codec/all/test_package/atlas_small_4x4.astc and /dev/null differ diff --git a/recipes/astc-codec/all/test_package/conanfile.py b/recipes/astc-codec/all/test_package/conanfile.py index 0616bc5a57142..98ab55852ad56 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,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - bees = os.path.join(self.source_folder, "atlas_small_4x4.astc") - self.run("{} {} 256 256".format(bin_path, bees), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/astc-codec/all/test_package/test_package.cpp b/recipes/astc-codec/all/test_package/test_package.cpp index ec0a2e3ad6195..266f4473a5391 100644 --- a/recipes/astc-codec/all/test_package/test_package.cpp +++ b/recipes/astc-codec/all/test_package/test_package.cpp @@ -8,21 +8,13 @@ int main(int argc, char **argv) { - if (argc < 4) { - std::cerr << "Need at least three argument\n"; - } - std::ifstream stream(argv[1], std::ios::in | std::ios::binary); + std::ifstream stream("fake-file.astc", std::ios::in | std::ios::binary); std::vector astc_data((std::istreambuf_iterator(stream)), std::istreambuf_iterator()); - const size_t width = std::stoi(argv[2]); - const size_t height = std::stoi(argv[3]); - - std::vector result; - result.resize(width * height * 4); - bool success = astc_codec::ASTCDecompressToRGBA( - astc_data.data(), astc_data.size(), width, height, astc_codec::FootprintType::k4x4, - result.data(), result.size(), /* stride */ width * 4); + astc_data.data(), 100, 100, 100, astc_codec::FootprintType::k4x4, NULL, 100, 100); + + std::cout << "Test: " << success << std::endl; stream.close(); 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..91630d79f4abb --- /dev/null +++ b/recipes/astc-codec/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/qxlsx/all/test_v1_package/conanfile.py b/recipes/astc-codec/all/test_v1_package/conanfile.py similarity index 100% rename from recipes/qxlsx/all/test_v1_package/conanfile.py rename to recipes/astc-codec/all/test_v1_package/conanfile.py diff --git a/recipes/astro-informatics-so3/all/CMakeLists.txt b/recipes/astro-informatics-so3/all/CMakeLists.txt deleted file mode 100644 index 0496b29838549..0000000000000 --- a/recipes/astro-informatics-so3/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/astro-informatics-so3/all/conandata.yml b/recipes/astro-informatics-so3/all/conandata.yml index 044d46996e9be..7fd6407fb8411 100644 --- a/recipes/astro-informatics-so3/all/conandata.yml +++ b/recipes/astro-informatics-so3/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.3.6": + url: "https://github.com/astro-informatics/so3/archive/v1.3.6.tar.gz" + sha256: "9a8536b9998d54e7b61313548df01e989f07e15116ad49b471d7e321999f5f35" "1.3.4": url: "https://github.com/astro-informatics/so3/archive/refs/tags/v1.3.4.zip" sha256: "383431c3078faa073c3017ceb3e0108885ab7628e81af13488f9aa021b95bbc7" diff --git a/recipes/astro-informatics-so3/all/conanfile.py b/recipes/astro-informatics-so3/all/conanfile.py index 24be830f3db99..a00f6ada8c83c 100644 --- a/recipes/astro-informatics-so3/all/conanfile.py +++ b/recipes/astro-informatics-so3/all/conanfile.py @@ -1,69 +1,74 @@ -from conans import CMake, ConanFile, 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.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get +from conan.tools.microsoft import is_msvc + +required_conan_version = ">=1.53.0" class AstroInformaticsSO3(ConanFile): name = "astro-informatics-so3" + description = "Fast and accurate Wigner transforms" license = "GPL-3.0-or-later" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/astro-informatics/so3" - description = "Fast and accurate Wigner transforms" - settings = "os", "arch", "compiler", "build_type" topics = ("physics", "astrophysics", "radio interferometry") - options = {"fPIC": [True, False]} - default_options = {"fPIC": True} - - generators = "cmake", "cmake_find_package" - exports_sources = ["CMakeLists.txt"] - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + package_type = "static-library" + settings = "os", "arch", "compiler", "build_type" + options = { + "fPIC": [True, False], + } + default_options = { + "fPIC": True, + } 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 + 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("fftw/3.3.9") - self.requires("ssht/1.3.7") + self.requires("ssht/1.5.2", transitive_headers=True, transitive_libs=True) + self.requires("fftw/3.3.10") def validate(self): - if self.settings.compiler == "Visual Studio": + if is_msvc(self): raise ConanInvalidConfiguration( "Visual Studio not supported, since SO3 requires C99 support for complex numbers" ) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - @property - def cmake(self): - if not hasattr(self, "_cmake"): - self._cmake = CMake(self) - self._cmake.definitions["conan_deps"] = False - self._cmake.definitions["BUILD_TESTING"] = False - 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["conan_deps"] = False + tc.variables["CONAN_EXPORTED"] = True + tc.variables["BUILD_TESTING"] = False + tc.generate() + deps = CMakeDeps(self) + deps.set_property("fftw", "cmake_target_name", "FFTW3::FFTW3") + deps.generate() def build(self): - self.cmake.build() + cmake = CMake(self) + cmake.configure() + cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.cmake.install() + 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 = ["astro-informatics-so3"] diff --git a/recipes/astro-informatics-so3/all/test_package/CMakeLists.txt b/recipes/astro-informatics-so3/all/test_package/CMakeLists.txt index aecca63b59f68..6e7e3d57dba81 100644 --- a/recipes/astro-informatics-so3/all/test_package/CMakeLists.txt +++ b/recipes/astro-informatics-so3/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ -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() - -find_package(astro-informatics-so3 REQUIRED NO_MODULE) +find_package(astro-informatics-so3 REQUIRED CONFIG) add_executable(${PROJECT_NAME} example.c) target_compile_features(${PROJECT_NAME} PUBLIC c_std_99) diff --git a/recipes/astro-informatics-so3/all/test_package/conanfile.py b/recipes/astro-informatics-so3/all/test_package/conanfile.py index abcaeed3f89b6..ef5d7042163ec 100644 --- a/recipes/astro-informatics-so3/all/test_package/conanfile.py +++ b/recipes/astro-informatics-so3/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.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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/astro-informatics-so3/all/test_v1_package/CMakeLists.txt b/recipes/astro-informatics-so3/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/astro-informatics-so3/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/astro-informatics-so3/all/test_v1_package/conanfile.py b/recipes/astro-informatics-so3/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..abcaeed3f89b6 --- /dev/null +++ b/recipes/astro-informatics-so3/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.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/astro-informatics-so3/config.yml b/recipes/astro-informatics-so3/config.yml index a81e52666d075..f8568797580a5 100644 --- a/recipes/astro-informatics-so3/config.yml +++ b/recipes/astro-informatics-so3/config.yml @@ -1,3 +1,5 @@ versions: + "1.3.6": + folder: all "1.3.4": folder: all diff --git a/recipes/async_simple/all/conandata.yml b/recipes/async_simple/all/conandata.yml new file mode 100644 index 0000000000000..4befe3006ae91 --- /dev/null +++ b/recipes/async_simple/all/conandata.yml @@ -0,0 +1,16 @@ +sources: + "1.3": + url: "https://github.com/alibaba/async_simple/archive/refs/tags/v1.3.tar.gz" + sha256: "0BA0DC3397882611B538D04B8EE6668B1A04CE046128599205184C598B718743" + "1.2": + url: "https://github.com/alibaba/async_simple/archive/refs/tags/1.2.tar.gz" + sha256: "a59a2674ac2b0a3997b90873b2bf0fbe4d96fdedbe6a2628c16c92a65a3fa39a" + "1.0.0": + url: "https://github.com/alibaba/async_simple/archive/refs/tags/1.0.tar.gz" + sha256: "b243fb7af5d61b534fe18b662d16498392bbce1deffdc68e58829aa31db7badf" +patches: + "1.0.0": + - patch_file: "patches/disable-asan-1.0.patch" + patch_description: "Add option for disabling address sanitizer in root CMakeLists" + patch_type: "portability" + patch_source: "https://github.com/alibaba/async_simple/commit/ccb760356b9d7481ca73f0c58d15928bf8b0aa0b" diff --git a/recipes/async_simple/all/conanfile.py b/recipes/async_simple/all/conanfile.py new file mode 100644 index 0000000000000..f0da3ed24785b --- /dev/null +++ b/recipes/async_simple/all/conanfile.py @@ -0,0 +1,158 @@ +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, export_conandata_patches, get, copy, rename, replace_in_file +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 AsyncSimpleConan(ConanFile): + name = "async_simple" + description = "Simple, light-weight and easy-to-use asynchronous components" + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/alibaba/async_simple" + topics = ("modules", "asynchronous", "coroutines", "cpp20", "header-only") + + package_type = "library" + 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": True + } + + @property + def _min_cppstd(self): + return 20 + + @property + def _compilers_minimum_version(self): + return { + "Visual Studio": "17", + "msvc": "193", + "gcc": "10.3", + "clang": "13", + "apple-clang": "14", + } + + 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.header_only: + self.options.rm_safe("fPIC") + self.options.rm_safe("shared") + elif self.options.shared: + 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: + self.info.clear() + + def validate(self): + if self.settings.get_safe("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 not self.options.header_only and self.settings.os == "Windows": + raise ConanInvalidConfiguration(f'{self.ref} cannot use uthread on Windows, and therefore it\'s only supported as a header-only library in this configuration with "{self.name}/*:header_only=True"') + + def source(self): + 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["ASYNC_SIMPLE_BUILD_DEMO_EXAMPLE"] = False + tc.cache_variables["ASYNC_SIMPLE_ENABLE_TESTS"] = False + tc.cache_variables["ASYNC_SIMPLE_ENABLE_ASAN"] = False + #libaio is only used in SimpleIOExecutor which is only used in executor tests and not meant for end users + tc.cache_variables["ASYNC_SIMPLE_DISABLE_AIO"] = True + tc.generate() + + def build(self): + apply_conandata_patches(self) + if not self.options.header_only: + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), '-D_GLIBCXX_USE_CXX11_ABI=1', '') + 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: + hCopyExcludes = ("test", "uthread", "executors") + if not self.options.header_only: + hCopyExcludes = ("test", "executors") + if self.options.shared: + if self.settings.os == "Macos": + sharedLibExt = "*.dylib*" + else: + sharedLibExt = "*.so*" + copy(self, pattern=sharedLibExt, + dst=os.path.join(self.package_folder, "lib"), + src=os.path.join(self.build_folder, "async_simple") + ) + else: + copy(self, pattern="*.a", + dst=os.path.join(self.package_folder, "lib"), + src=os.path.join(self.build_folder, "async_simple") + ) + libTarget = os.path.join(self.package_folder, "lib", "libasync_simple.a") + if not os.path.isfile(libTarget): + rename(self, os.path.join(self.package_folder, "lib", "libasync_simple_static.a"), + libTarget) + + copy(self, pattern="*.h", + dst=os.path.join(self.package_folder, "include/async_simple"), + src=os.path.join(self.source_folder, "async_simple"), + excludes=hCopyExcludes + ) + + def package_info(self): + if not self.options.header_only: + self.cpp_info.libs = ["async_simple"] + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs = ["m", "pthread"] + + self.cpp_info.set_property("cmake_file_name", "async_simple") + if self.options.header_only: + self.cpp_info.set_property("cmake_target_name", "async_simple::async_simple_header_only") + + self.cpp_info.components["_async_simple"].names["cmake_find_package"] = "async_simple_header_only" + self.cpp_info.components["_async_simple"].names["cmake_find_package_multi"] = "async_simple_header_only" + self.cpp_info.components["_async_simple"].set_property("cmake_target_name", "async_simple::async_simple_header_only") + else: + self.cpp_info.set_property("cmake_target_name", "async_simple::async_simple") + + self.cpp_info.components["_async_simple"].names["cmake_find_package"] = "async_simple" + self.cpp_info.components["_async_simple"].names["cmake_find_package_multi"] = "async_simple" + self.cpp_info.components["_async_simple"].set_property("cmake_target_name", "async_simple::async_simple") + + self.cpp_info.filenames["cmake_find_package"] = "async_simple" + self.cpp_info.filenames["cmake_find_package_multi"] = "async_simple" + self.cpp_info.names["cmake_find_package"] = "async_simple" + self.cpp_info.names["cmake_find_package_multi"] = "async_simple" diff --git a/recipes/async_simple/all/patches/disable-asan-1.0.patch b/recipes/async_simple/all/patches/disable-asan-1.0.patch new file mode 100644 index 0000000000000..ce18632f1b35d --- /dev/null +++ b/recipes/async_simple/all/patches/disable-asan-1.0.patch @@ -0,0 +1,21 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -106,11 +106,13 @@ + #list(APPEND deplibs "-m64") + endif() + endif() +- +-if(NOT CMAKE_CXX_COMPILER_ID MATCHES "MSVC") +- if (CMAKE_BUILD_TYPE STREQUAL "Debug") +- message("-- Use flag -fsanitize=address") +- list(APPEND CXX_FLAGS "-fsanitize=address") ++option(ASYNC_SIMPLE_ENABLE_ASAN "enable asan in debug when compiler is not msvc" ON) ++if (ASYNC_SIMPLE_ENABLE_ASAN) ++ if(NOT CMAKE_CXX_COMPILER_ID MATCHES "MSVC") ++ if (CMAKE_BUILD_TYPE STREQUAL "Debug") ++ message("-- Use flag -fsanitize=address") ++ list(APPEND CXX_FLAGS "-fsanitize=address") ++ endif() + endif() + endif() + diff --git a/recipes/async_simple/all/test_package/CMakeLists.txt b/recipes/async_simple/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..ccb7b85dadd81 --- /dev/null +++ b/recipes/async_simple/all/test_package/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package CXX) + +set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +find_package(async_simple REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +if(ASYNC_SIMPLE_HEADER_ONLY) + target_link_libraries(test_package PRIVATE async_simple::async_simple_header_only) +else() + target_link_libraries(test_package PRIVATE async_simple::async_simple) +endif() diff --git a/recipes/async_simple/all/test_package/conanfile.py b/recipes/async_simple/all/test_package/conanfile.py new file mode 100644 index 0000000000000..be622ed71cf62 --- /dev/null +++ b/recipes/async_simple/all/test_package/conanfile.py @@ -0,0 +1,32 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +import os + + +# It will become the standard on Conan 2.x +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.variables["ASYNC_SIMPLE_HEADER_ONLY"] = self.dependencies[self.tested_reference_str].options.header_only + 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/async_simple/all/test_package/test_package.cpp b/recipes/async_simple/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..2d1008ad4581c --- /dev/null +++ b/recipes/async_simple/all/test_package/test_package.cpp @@ -0,0 +1,20 @@ +#include +#include +#include "async_simple/coro/Lazy.h" +#include "async_simple/coro/SyncAwait.h" +using namespace async_simple::coro; + +Lazy foo() { + co_return 1; +} + +int main(void) { + std::cout << "test async_simple" << std::endl; + auto lazy_task = foo(); + auto ret = syncAwait(lazy_task); + if (ret != 1) { + std::cout << "ERROR: " << ret << std::endl; + std::cout << EXIT_FAILURE; + } + return EXIT_SUCCESS; +} diff --git a/recipes/async_simple/all/test_v1_package/CMakeLists.txt b/recipes/async_simple/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/async_simple/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/docs/package_templates/autotools_package/all/test_v1_package/conanfile.py b/recipes/async_simple/all/test_v1_package/conanfile.py similarity index 100% rename from docs/package_templates/autotools_package/all/test_v1_package/conanfile.py rename to recipes/async_simple/all/test_v1_package/conanfile.py diff --git a/recipes/async_simple/config.yml b/recipes/async_simple/config.yml new file mode 100644 index 0000000000000..e526b1e8db52a --- /dev/null +++ b/recipes/async_simple/config.yml @@ -0,0 +1,8 @@ +versions: + # Newer versions at the top + "1.3": + folder: all + "1.2": + folder: all + "1.0.0": + folder: all diff --git a/recipes/asyncly/all/conandata.yml b/recipes/asyncly/all/conandata.yml new file mode 100644 index 0000000000000..e12604057e984 --- /dev/null +++ b/recipes/asyncly/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "cci.20230420": + url: "https://github.com/goto-opensource/asyncly/archive/e50ce7cf227a86ee0558a89a55f43e34f63e9316.zip" + sha256: "b5d9fcf6baddba48ad5ed5ed6e6ff50ad2ac6340e29c344fe621046e09072357" diff --git a/recipes/asyncly/all/conanfile.py b/recipes/asyncly/all/conanfile.py new file mode 100644 index 0000000000000..35a484db0a6f6 --- /dev/null +++ b/recipes/asyncly/all/conanfile.py @@ -0,0 +1,113 @@ +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 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 PackageConan(ConanFile): + name = "asyncly" + description = "High level concurrency primitives for C++" + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/goto-opensource/asyncly" + topics = ("c++", "asynchronous", "communication") + package_type = "library" + 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 20 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "11", + "clang": "13", + "apple-clang": "13", + } + + 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("boost/1.83.0", transitive_headers=True) + self.requires("function2/4.2.4", transitive_headers=True) + self.requires("prometheus-cpp/1.1.0", transitive_headers=True) + + 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." + ) + 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 generate(self): + tc = CMakeToolchain(self) + tc.variables["ENABLE_TESTING"] = False + if is_msvc(self): + tc.variables["USE_MSVC_RUNTIME_LIBRARY_DLL"] = not is_msvc_static_runtime(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", 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")) + 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 = ["asyncly"] + self.cpp_info.requires = ["boost::headers", "function2::function2", "prometheus-cpp::prometheus-cpp-core"] + + self.cpp_info.set_property("cmake_file_name", "asyncly") + self.cpp_info.set_property("cmake_target_name", "asyncly::asyncly") + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("pthread") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "asyncly" + self.cpp_info.filenames["cmake_find_package_multi"] = "asyncly" + self.cpp_info.names["cmake_find_package"] = "asyncly" + self.cpp_info.names["cmake_find_package_multi"] = "asyncly" diff --git a/recipes/asyncly/all/test_package/CMakeLists.txt b/recipes/asyncly/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..e1381e7ef86e9 --- /dev/null +++ b/recipes/asyncly/all/test_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.15) + +project(test_package CXX) + +find_package(asyncly REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE asyncly::asyncly) +target_compile_definitions(${PROJECT_NAME} PRIVATE WIN32_LEAN_AND_MEAN) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) diff --git a/recipes/asyncly/all/test_package/conanfile.py b/recipes/asyncly/all/test_package/conanfile.py new file mode 100644 index 0000000000000..ef5d7042163ec --- /dev/null +++ b/recipes/asyncly/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/asyncly/all/test_package/test_package.cpp b/recipes/asyncly/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..b5674382d1ec9 --- /dev/null +++ b/recipes/asyncly/all/test_package/test_package.cpp @@ -0,0 +1,16 @@ +#include "asyncly/executor/AsioExecutorController.h" +#include "asyncly/executor/MetricsWrapper.h" +#include "asyncly/executor/ThreadPoolExecutorController.h" + +static void task() +{ +} + +int main() +{ + auto threadPool = asyncly::ThreadPoolExecutorController::create(2); + + threadPool->get_executor()->post([]() { task(); }); + + return 0; +} diff --git a/recipes/asyncly/config.yml b/recipes/asyncly/config.yml new file mode 100644 index 0000000000000..7c6ba2bb8da04 --- /dev/null +++ b/recipes/asyncly/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20230420": + folder: all diff --git a/recipes/asyncplusplus/all/conandata.yml b/recipes/asyncplusplus/all/conandata.yml index 6e8a1f4ce6c53..44d6673d4265c 100644 --- a/recipes/asyncplusplus/all/conandata.yml +++ b/recipes/asyncplusplus/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.2": + url: "https://github.com/Amanieu/asyncplusplus/archive/v1.2.tar.gz" + sha256: "0711c8db231bf3eb1066400f49ed73b5c3211a10eb3b8c3e64da3d5fdee8a4bf" "1.1": url: "https://github.com/Amanieu/asyncplusplus/archive/v1.1.tar.gz" sha256: "d160d3a433a1e08f51c785742843182c2b81a7bc872766f57bf5f3108377b858" diff --git a/recipes/asyncplusplus/all/conanfile.py b/recipes/asyncplusplus/all/conanfile.py index 3a587ac42b02e..e0b83a2a00e4a 100644 --- a/recipes/asyncplusplus/all/conanfile.py +++ b/recipes/asyncplusplus/all/conanfile.py @@ -2,20 +2,23 @@ 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, save +from conan.tools.microsoft import is_msvc, check_min_vs +from conan.tools.scm import Version import os import textwrap -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class AsyncplusplusConan(ConanFile): name = "asyncplusplus" description = "Async++ concurrency framework for C++11" license = "MIT" - topics = ("async", "parallel", "task", "scheduler") - homepage = "https://github.com/Amanieu/asyncplusplus" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/Amanieu/asyncplusplus" + topics = ("async", "parallel", "task", "scheduler") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -32,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) @@ -69,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", "Async++") @@ -89,6 +91,9 @@ def package_info(self): self.cpp_info.defines = ["LIBASYNC_STATIC"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["pthread"] + + if Version(self.version) >= "1.2" and is_msvc(self) and check_min_vs(self, 191): + self.cpp_info.cxxflags.extend(["/Zc:__cplusplus"]) # TODO: to remove in conan v2 once cmake_find_package* & pkg_config generators removed self.cpp_info.names["cmake_find_package"] = "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/asyncplusplus/config.yml b/recipes/asyncplusplus/config.yml index 3f8a45fae5832..03361fccd564f 100644 --- a/recipes/asyncplusplus/config.yml +++ b/recipes/asyncplusplus/config.yml @@ -1,3 +1,5 @@ versions: + "1.2": + folder: all "1.1": folder: all diff --git a/recipes/asyncpp/all/conandata.yml b/recipes/asyncpp/all/conandata.yml new file mode 100644 index 0000000000000..4b083e872c16b --- /dev/null +++ b/recipes/asyncpp/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.2.4": + url: "https://github.com/petiaccja/asyncpp/archive/refs/tags/v0.2.4.tar.gz" + sha256: "58138FF5801D3A547EAAD9ADC2C30FE7A0D506C0E41DC56071CEAAD5747210B5" diff --git a/recipes/asyncpp/all/conanfile.py b/recipes/asyncpp/all/conanfile.py new file mode 100644 index 0000000000000..b93928908c5e6 --- /dev/null +++ b/recipes/asyncpp/all/conanfile.py @@ -0,0 +1,100 @@ +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 copy, get, rm, rmdir +from conan.tools.scm import Version +import os + + +required_conan_version = ">=1.53.0" + + +class AsyncppRecipe(ConanFile): + name = "asyncpp" + description = "A C++20 coroutine library for asynchronous and parallel programming." + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/petiaccja/asyncpp/" + topics = ("coroutine", "c++20", "async", "parallel", "concurrency") + + package_type = "library" + 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 20 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "13", + "clang": "17", + "msvc": "193", + "Visual Studio": "17", + } + + 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) + 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.compiler == "apple-clang": + # As per https://en.cppreference.com/w/cpp/compiler_support, apple-clang 14.0.0 partially supports C++20 but not jthread + raise ConanInvalidConfiguration(f"{self.ref} does not support apple-clang compiler, as it lacks jthread support.") + + def build_requirements(self): + self.tool_requires("cmake/[>=3.25 <4]") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["ASYNCPP_BUILD_TESTS"] = "OFF" + tc.variables["ASYNCPP_BUILD_BENCHMARKS"] = "OFF" + tc.generate() + venv = VirtualBuildEnv(self) + venv.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE.md", self.source_folder, os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + + def package_info(self): + self.cpp_info.libs = ["asyncpp"] + if self.settings.os == "Windows" and self.options.shared: + self.cpp_info.bindirs = ["libs"] + + if self.settings.os in ("Linux", "FreeBSD"): + self.cpp_info.system_libs = ["pthread"] diff --git a/recipes/asyncpp/all/test_package/CMakeLists.txt b/recipes/asyncpp/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..74c5adfc3219b --- /dev/null +++ b/recipes/asyncpp/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(TestPackage LANGUAGES CXX) + +find_package(asyncpp CONFIG REQUIRED) + +add_executable(test_package test_package.cpp) +target_link_libraries(test_package asyncpp::asyncpp) +target_compile_features(test_package PUBLIC cxx_std_20) diff --git a/recipes/asyncpp/all/test_package/conanfile.py b/recipes/asyncpp/all/test_package/conanfile.py new file mode 100644 index 0000000000000..224348be46988 --- /dev/null +++ b/recipes/asyncpp/all/test_package/conanfile.py @@ -0,0 +1,27 @@ +import os + +from conan import ConanFile +from conan.tools.cmake import CMake, cmake_layout +from conan.tools.build import can_run + + +class AsyncppTestConan(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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/asyncpp/all/test_package/test_package.cpp b/recipes/asyncpp/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..070acd2fe6b83 --- /dev/null +++ b/recipes/asyncpp/all/test_package/test_package.cpp @@ -0,0 +1,18 @@ +#include +#include + +#include +#include + +using namespace asyncpp; + + +task message() { + co_return std::string("async++ installation works."); +} + + +int main() { + std::cout << join(message()) << std::endl; + return 0; +} diff --git a/recipes/asyncpp/config.yml b/recipes/asyncpp/config.yml new file mode 100644 index 0000000000000..a718e51b057ea --- /dev/null +++ b/recipes/asyncpp/config.yml @@ -0,0 +1,3 @@ +versions: + "0.2.4": + folder: all diff --git a/recipes/at-spi2-atk/all/conanfile.py b/recipes/at-spi2-atk/all/conanfile.py index 2fc37026d8c0f..e8f187953a737 100644 --- a/recipes/at-spi2-atk/all/conanfile.py +++ b/recipes/at-spi2-atk/all/conanfile.py @@ -1,5 +1,8 @@ -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, rmdir + +from conans import Meson import os required_conan_version = ">=1.33.0" @@ -21,6 +24,7 @@ class AtSPI2AtkConan(ConanFile): "shared": False, "fPIC": True, } + deprecated = "at-spi2-core" _meson = None @@ -48,25 +52,21 @@ def configure(self): del self.options.fPIC del self.settings.compiler.libcxx del self.settings.compiler.cppstd - if self.options.shared: - self.options["at-spi2-core"].shared = True - self.options["atk"].shared = True - self.options["glib"].shared = True def build_requirements(self): - self.build_requires("meson/0.62.2") - self.build_requires('pkgconf/1.7.4') + self.build_requires("meson/1.1.1") + self.build_requires('pkgconf/1.9.3') def requirements(self): self.requires("at-spi2-core/2.44.1") self.requires("atk/2.38.0") - self.requires("glib/2.73.0") - self.requires("libxml2/2.9.14") + self.requires("glib/2.76.3") + self.requires("libxml2/2.11.4") 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 _configure_meson(self): if self._meson: @@ -85,14 +85,9 @@ def package(self): self.copy(pattern="COPYING", dst="licenses", src=self._source_subfolder) meson = self._configure_meson() 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.libs = tools.collect_libs(self) + self.cpp_info.libs = ['atk-bridge-2.0'] self.cpp_info.includedirs = [os.path.join('include', 'at-spi2-atk', '2.0')] self.cpp_info.names['pkg_config'] = 'atk-bridge-2.0' - - def package_id(self): - self.info.requires["at-spi2-core"].full_package_mode() - self.info.requires["atk"].full_package_mode() - self.info.requires["glib"].full_package_mode() diff --git a/recipes/at-spi2-core/all/conanfile.py b/recipes/at-spi2-core/all/conanfile.py index e6ca0e2427585..32d98e739d744 100644 --- a/recipes/at-spi2-core/all/conanfile.py +++ b/recipes/at-spi2-core/all/conanfile.py @@ -1,5 +1,9 @@ -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 apply_conandata_patches, export_conandata_patches, get, replace_in_file,rmdir +from conan.tools.scm import Version + +from conans import Meson import os @@ -11,6 +15,7 @@ class AtSpi2CoreConan(ConanFile): homepage = "https://gitlab.gnome.org/GNOME/at-spi2-core/" license = "LGPL-2.1-or-later" generators = "pkg_config" + deprecated = "Consumers should migrate to at-spi2-core/[>=2.45.1], which includes atk and at-spi2-atk" settings = "os", "arch", "compiler", "build_type" options = { @@ -35,26 +40,23 @@ def _build_subfolder(self): _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 - 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.build_requires("meson/1.1.1") + self.build_requires("pkgconf/1.9.3") def requirements(self): - self.requires("glib/2.73.0") + self.requires("glib/2.76.3") 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: @@ -65,7 +67,7 @@ def validate(self): raise ConanInvalidConfiguration("only linux is supported by this recipe") 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): @@ -84,10 +86,9 @@ def _configure_meson(self): return self._meson def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - if tools.Version(self.version) >= "2.42.0": - tools.replace_in_file(os.path.join(self._source_subfolder, "bus", "meson.build"), + apply_conandata_patches(self) + if Version(self.version) >= "2.42.0": + replace_in_file(self, os.path.join(self._source_subfolder, "bus", "meson.build"), "if x11_dep.found()", "if x11_option == 'yes'") meson = self._configure_meson() @@ -97,14 +98,11 @@ def package(self): self.copy(pattern="COPYING", dst="licenses", src=self._source_subfolder) meson = self._configure_meson() 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.libs = tools.collect_libs(self) + self.cpp_info.libs = ['atspi'] self.cpp_info.includedirs = ["include/at-spi-2.0"] self.cpp_info.names["pkg_config"] = "atspi-2" - - def package_id(self): - self.info.requires["glib"].full_package_mode() diff --git a/recipes/at-spi2-core/config.yml b/recipes/at-spi2-core/config.yml index 75bf09030a311..c890631d2ad5f 100644 --- a/recipes/at-spi2-core/config.yml +++ b/recipes/at-spi2-core/config.yml @@ -11,9 +11,19 @@ versions: folder: all "2.44.1": folder: all - "2.45.1": + "2.46.0": folder: new - "2.45.90": + "2.47.1": folder: new - "2.46.0": + "2.48.0": + folder: new + "2.48.3": + folder: new + "2.49.1": + folder: new + "2.50.0": + folder: new + "2.51.0": + folder: new + "2.53.1": folder: new diff --git a/recipes/at-spi2-core/new/conandata.yml b/recipes/at-spi2-core/new/conandata.yml index 4ea30e6fd2d79..225eb1193882e 100644 --- a/recipes/at-spi2-core/new/conandata.yml +++ b/recipes/at-spi2-core/new/conandata.yml @@ -1,20 +1,25 @@ sources: + "2.53.1": + url: "https://ftp.gnome.org/pub/gnome/sources/at-spi2-core/2.53/at-spi2-core-2.53.1.tar.xz" + sha256: "2affe2c88dae3defcd754c2c2bcecfb2e52b9541edf2e469f94b3a0bb1307cf4" + "2.51.0": + url: "https://ftp.gnome.org/pub/gnome/sources/at-spi2-core/2.51/at-spi2-core-2.51.0.tar.xz" + sha256: "8dd07c6160e3115f4f77e2205963449def6822a3dc85d495c5db389f56663037" + "2.50.0": + url: "https://ftp.gnome.org/pub/gnome/sources/at-spi2-core/2.50/at-spi2-core-2.50.0.tar.xz" + sha256: "e9f5a8c8235c9dd963b2171de9120301129c677dde933955e1df618b949c4adc" + "2.49.1": + url: "https://ftp.gnome.org/pub/gnome/sources/at-spi2-core/2.49/at-spi2-core-2.49.1.tar.xz" + sha256: "53ed9eb77e4c48b3bf6ac4afb5689391e0d7d0f44f7ca4443d8b13c7dd26119c" + "2.48.3": + url: "https://ftp.gnome.org/pub/gnome/sources/at-spi2-core/2.48/at-spi2-core-2.48.3.tar.xz" + sha256: "37316df43ca9989ce539d54cf429a768c28bb38a0b34950beadd0421827edf55" + "2.48.0": + url: "https://ftp.gnome.org/pub/gnome/sources/at-spi2-core/2.48/at-spi2-core-2.48.0.tar.xz" + sha256: "905a5b6f1790b68ee803bffa9f5fab4ceb591fb4fae0b2f8c612c54f1d4e8a30" + "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" - "2.45.1": - 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.46.0": - - base_path: "source_subfolder" - patch_file: "patches/93.patch" - "2.45.90": - - base_path: "source_subfolder" - patch_file: "patches/93.patch" - "2.45.1": - - base_path: "source_subfolder" - 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..e12168d36a06f 100644 --- a/recipes/at-spi2-core/new/conanfile.py +++ b/recipes/at-spi2-core/new/conanfile.py @@ -1,8 +1,17 @@ -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, 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.scm import Version import os +required_conan_version = ">=1.60.0 <2.0 || >=2.0.5" + 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,119 +19,144 @@ 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" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], "with_x11": [True, False], - } + } default_options = { "shared": False, "fPIC": True, - "with_x11": False, - } - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - - _meson = None + "with_x11": 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 configure(self): - if self.options.shared: + def config_options(self): + if self.settings.os == "Windows": del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + if self.settings.os not in ["Linux", "FreeBSD"]: + del self.options.with_x11 + + def configure(self): if self.options.shared: - self.options["glib"].shared = True + 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.2") - self.build_requires("pkgconf/1.7.4") + self.tool_requires("meson/1.3.1") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/2.1.0") + self.tool_requires("glib/") def requirements(self): - self.requires("glib/2.73.0") - if self.options.with_x11: + self.requires("glib/2.78.3") + if self.settings.os in ["Linux", "FreeBSD"]: + self.requires("dbus/1.15.8") + if self.options.get_safe("with_x11"): self.requires("xorg/system") - self.requires("dbus/1.12.20") 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." ) - if self.settings.os != "Linux": - raise ConanInvalidConfiguration("only linux is supported by this recipe") + if Version(self.version) < "2.49.1" and self.settings.os == "Windows": + raise ConanInvalidConfiguration("Windows is not supported before version 2.49.1") + if Version(self.version) < "2.50.0" and is_apple_os(self): + raise ConanInvalidConfiguration("macOS is not supported before version 2.50.0") + + 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.get_safe("with_x11") else "disabled" + else: + tc.project_options["introspection"] = "no" + tc.project_options["x11"] = "yes" if self.options.get_safe("with_x11") else "no" + if self.settings.os != "Linux": + tc.project_options["atk_only"] = "true" + + 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")) + 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["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" - + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["atspi"].set_property("pkg_config_name", "atspi-2") + 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-2.0", "glib::gobject-2.0"] + if self.options.with_x11: + self.cpp_info.components["atspi"].requires.extend(["xorg::x11", "xorg::xtst", "xorg::xi"]) + + self.cpp_info.components["atk"].set_property("pkg_config_name", "atk") 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-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' - - def package_id(self): - self.info.requires["glib"].full_package_mode() + self.cpp_info.components["atk"].includedirs = ["include/atk-1.0"] + self.cpp_info.components["atk"].requires = ["glib::glib-2.0", "glib::gobject-2.0"] + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["atk-bridge"].set_property("pkg_config_name", "atk-bridge-2.0") + 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 = ["atspi", "atk", "glib::gmodule-2.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/at-spi2-core/new/patches/93.patch b/recipes/at-spi2-core/new/patches/93.patch deleted file mode 100644 index 7ff4a19473df8..0000000000000 --- a/recipes/at-spi2-core/new/patches/93.patch +++ /dev/null @@ -1,521 +0,0 @@ -From 99a88f23978d668802f63470c7f75ba3886166e1 Mon Sep 17 00:00:00 2001 -From: ericLemanissier -Date: Tue, 5 Jul 2022 10:13:54 +0000 -Subject: [PATCH] add license file - -fixes GNOME/at-spi2-core#78 ---- - COPYING | 502 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 502 insertions(+) - create mode 100644 COPYING - -diff --git a/COPYING b/COPYING -new file mode 100644 -index 00000000..4362b491 ---- /dev/null -+++ b/COPYING -@@ -0,0 +1,502 @@ -+ GNU LESSER GENERAL PUBLIC LICENSE -+ Version 2.1, February 1999 -+ -+ Copyright (C) 1991, 1999 Free Software Foundation, Inc. -+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ Everyone is permitted to copy and distribute verbatim copies -+ of this license document, but changing it is not allowed. -+ -+[This is the first released version of the Lesser GPL. It also counts -+ as the successor of the GNU Library Public License, version 2, hence -+ the version number 2.1.] -+ -+ Preamble -+ -+ The licenses for most software are designed to take away your -+freedom to share and change it. By contrast, the GNU General Public -+Licenses are intended to guarantee your freedom to share and change -+free software--to make sure the software is free for all its users. -+ -+ This license, the Lesser General Public License, applies to some -+specially designated software packages--typically libraries--of the -+Free Software Foundation and other authors who decide to use it. You -+can use it too, but we suggest you first think carefully about whether -+this license or the ordinary General Public License is the better -+strategy to use in any particular case, based on the explanations below. -+ -+ When we speak of free software, we are referring to freedom of use, -+not price. Our General Public Licenses are designed to make sure that -+you have the freedom to distribute copies of free software (and charge -+for this service if you wish); that you receive source code or can get -+it if you want it; that you can change the software and use pieces of -+it in new free programs; and that you are informed that you can do -+these things. -+ -+ To protect your rights, we need to make restrictions that forbid -+distributors to deny you these rights or to ask you to surrender these -+rights. These restrictions translate to certain responsibilities for -+you if you distribute copies of the library or if you modify it. -+ -+ For example, if you distribute copies of the library, whether gratis -+or for a fee, you must give the recipients all the rights that we gave -+you. You must make sure that they, too, receive or can get the source -+code. If you link other code with the library, you must provide -+complete object files to the recipients, so that they can relink them -+with the library after making changes to the library and recompiling -+it. And you must show them these terms so they know their rights. -+ -+ We protect your rights with a two-step method: (1) we copyright the -+library, and (2) we offer you this license, which gives you legal -+permission to copy, distribute and/or modify the library. -+ -+ To protect each distributor, we want to make it very clear that -+there is no warranty for the free library. Also, if the library is -+modified by someone else and passed on, the recipients should know -+that what they have is not the original version, so that the original -+author's reputation will not be affected by problems that might be -+introduced by others. -+ -+ Finally, software patents pose a constant threat to the existence of -+any free program. We wish to make sure that a company cannot -+effectively restrict the users of a free program by obtaining a -+restrictive license from a patent holder. Therefore, we insist that -+any patent license obtained for a version of the library must be -+consistent with the full freedom of use specified in this license. -+ -+ Most GNU software, including some libraries, is covered by the -+ordinary GNU General Public License. This license, the GNU Lesser -+General Public License, applies to certain designated libraries, and -+is quite different from the ordinary General Public License. We use -+this license for certain libraries in order to permit linking those -+libraries into non-free programs. -+ -+ When a program is linked with a library, whether statically or using -+a shared library, the combination of the two is legally speaking a -+combined work, a derivative of the original library. The ordinary -+General Public License therefore permits such linking only if the -+entire combination fits its criteria of freedom. The Lesser General -+Public License permits more lax criteria for linking other code with -+the library. -+ -+ We call this license the "Lesser" General Public License because it -+does Less to protect the user's freedom than the ordinary General -+Public License. It also provides other free software developers Less -+of an advantage over competing non-free programs. These disadvantages -+are the reason we use the ordinary General Public License for many -+libraries. However, the Lesser license provides advantages in certain -+special circumstances. -+ -+ For example, on rare occasions, there may be a special need to -+encourage the widest possible use of a certain library, so that it becomes -+a de-facto standard. To achieve this, non-free programs must be -+allowed to use the library. A more frequent case is that a free -+library does the same job as widely used non-free libraries. In this -+case, there is little to gain by limiting the free library to free -+software only, so we use the Lesser General Public License. -+ -+ In other cases, permission to use a particular library in non-free -+programs enables a greater number of people to use a large body of -+free software. For example, permission to use the GNU C Library in -+non-free programs enables many more people to use the whole GNU -+operating system, as well as its variant, the GNU/Linux operating -+system. -+ -+ Although the Lesser General Public License is Less protective of the -+users' freedom, it does ensure that the user of a program that is -+linked with the Library has the freedom and the wherewithal to run -+that program using a modified version of the Library. -+ -+ The precise terms and conditions for copying, distribution and -+modification follow. Pay close attention to the difference between a -+"work based on the library" and a "work that uses the library". The -+former contains code derived from the library, whereas the latter must -+be combined with the library in order to run. -+ -+ GNU LESSER GENERAL PUBLIC LICENSE -+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION -+ -+ 0. This License Agreement applies to any software library or other -+program which contains a notice placed by the copyright holder or -+other authorized party saying it may be distributed under the terms of -+this Lesser General Public License (also called "this License"). -+Each licensee is addressed as "you". -+ -+ A "library" means a collection of software functions and/or data -+prepared so as to be conveniently linked with application programs -+(which use some of those functions and data) to form executables. -+ -+ The "Library", below, refers to any such software library or work -+which has been distributed under these terms. A "work based on the -+Library" means either the Library or any derivative work under -+copyright law: that is to say, a work containing the Library or a -+portion of it, either verbatim or with modifications and/or translated -+straightforwardly into another language. (Hereinafter, translation is -+included without limitation in the term "modification".) -+ -+ "Source code" for a work means the preferred form of the work for -+making modifications to it. For a library, complete source code means -+all the source code for all modules it contains, plus any associated -+interface definition files, plus the scripts used to control compilation -+and installation of the library. -+ -+ Activities other than copying, distribution and modification are not -+covered by this License; they are outside its scope. The act of -+running a program using the Library is not restricted, and output from -+such a program is covered only if its contents constitute a work based -+on the Library (independent of the use of the Library in a tool for -+writing it). Whether that is true depends on what the Library does -+and what the program that uses the Library does. -+ -+ 1. You may copy and distribute verbatim copies of the Library's -+complete source code as you receive it, in any medium, provided that -+you conspicuously and appropriately publish on each copy an -+appropriate copyright notice and disclaimer of warranty; keep intact -+all the notices that refer to this License and to the absence of any -+warranty; and distribute a copy of this License along with the -+Library. -+ -+ You may charge a fee for the physical act of transferring a copy, -+and you may at your option offer warranty protection in exchange for a -+fee. -+ -+ 2. You may modify your copy or copies of the Library or any portion -+of it, thus forming a work based on the Library, and copy and -+distribute such modifications or work under the terms of Section 1 -+above, provided that you also meet all of these conditions: -+ -+ a) The modified work must itself be a software library. -+ -+ b) You must cause the files modified to carry prominent notices -+ stating that you changed the files and the date of any change. -+ -+ c) You must cause the whole of the work to be licensed at no -+ charge to all third parties under the terms of this License. -+ -+ d) If a facility in the modified Library refers to a function or a -+ table of data to be supplied by an application program that uses -+ the facility, other than as an argument passed when the facility -+ is invoked, then you must make a good faith effort to ensure that, -+ in the event an application does not supply such function or -+ table, the facility still operates, and performs whatever part of -+ its purpose remains meaningful. -+ -+ (For example, a function in a library to compute square roots has -+ a purpose that is entirely well-defined independent of the -+ application. Therefore, Subsection 2d requires that any -+ application-supplied function or table used by this function must -+ be optional: if the application does not supply it, the square -+ root function must still compute square roots.) -+ -+These requirements apply to the modified work as a whole. If -+identifiable sections of that work are not derived from the Library, -+and can be reasonably considered independent and separate works in -+themselves, then this License, and its terms, do not apply to those -+sections when you distribute them as separate works. But when you -+distribute the same sections as part of a whole which is a work based -+on the Library, the distribution of the whole must be on the terms of -+this License, whose permissions for other licensees extend to the -+entire whole, and thus to each and every part regardless of who wrote -+it. -+ -+Thus, it is not the intent of this section to claim rights or contest -+your rights to work written entirely by you; rather, the intent is to -+exercise the right to control the distribution of derivative or -+collective works based on the Library. -+ -+In addition, mere aggregation of another work not based on the Library -+with the Library (or with a work based on the Library) on a volume of -+a storage or distribution medium does not bring the other work under -+the scope of this License. -+ -+ 3. You may opt to apply the terms of the ordinary GNU General Public -+License instead of this License to a given copy of the Library. To do -+this, you must alter all the notices that refer to this License, so -+that they refer to the ordinary GNU General Public License, version 2, -+instead of to this License. (If a newer version than version 2 of the -+ordinary GNU General Public License has appeared, then you can specify -+that version instead if you wish.) Do not make any other change in -+these notices. -+ -+ Once this change is made in a given copy, it is irreversible for -+that copy, so the ordinary GNU General Public License applies to all -+subsequent copies and derivative works made from that copy. -+ -+ This option is useful when you wish to copy part of the code of -+the Library into a program that is not a library. -+ -+ 4. You may copy and distribute the Library (or a portion or -+derivative of it, under Section 2) in object code or executable form -+under the terms of Sections 1 and 2 above provided that you accompany -+it with the complete corresponding machine-readable source code, which -+must be distributed under the terms of Sections 1 and 2 above on a -+medium customarily used for software interchange. -+ -+ If distribution of object code is made by offering access to copy -+from a designated place, then offering equivalent access to copy the -+source code from the same place satisfies the requirement to -+distribute the source code, even though third parties are not -+compelled to copy the source along with the object code. -+ -+ 5. A program that contains no derivative of any portion of the -+Library, but is designed to work with the Library by being compiled or -+linked with it, is called a "work that uses the Library". Such a -+work, in isolation, is not a derivative work of the Library, and -+therefore falls outside the scope of this License. -+ -+ However, linking a "work that uses the Library" with the Library -+creates an executable that is a derivative of the Library (because it -+contains portions of the Library), rather than a "work that uses the -+library". The executable is therefore covered by this License. -+Section 6 states terms for distribution of such executables. -+ -+ When a "work that uses the Library" uses material from a header file -+that is part of the Library, the object code for the work may be a -+derivative work of the Library even though the source code is not. -+Whether this is true is especially significant if the work can be -+linked without the Library, or if the work is itself a library. The -+threshold for this to be true is not precisely defined by law. -+ -+ If such an object file uses only numerical parameters, data -+structure layouts and accessors, and small macros and small inline -+functions (ten lines or less in length), then the use of the object -+file is unrestricted, regardless of whether it is legally a derivative -+work. (Executables containing this object code plus portions of the -+Library will still fall under Section 6.) -+ -+ Otherwise, if the work is a derivative of the Library, you may -+distribute the object code for the work under the terms of Section 6. -+Any executables containing that work also fall under Section 6, -+whether or not they are linked directly with the Library itself. -+ -+ 6. As an exception to the Sections above, you may also combine or -+link a "work that uses the Library" with the Library to produce a -+work containing portions of the Library, and distribute that work -+under terms of your choice, provided that the terms permit -+modification of the work for the customer's own use and reverse -+engineering for debugging such modifications. -+ -+ You must give prominent notice with each copy of the work that the -+Library is used in it and that the Library and its use are covered by -+this License. You must supply a copy of this License. If the work -+during execution displays copyright notices, you must include the -+copyright notice for the Library among them, as well as a reference -+directing the user to the copy of this License. Also, you must do one -+of these things: -+ -+ a) Accompany the work with the complete corresponding -+ machine-readable source code for the Library including whatever -+ changes were used in the work (which must be distributed under -+ Sections 1 and 2 above); and, if the work is an executable linked -+ with the Library, with the complete machine-readable "work that -+ uses the Library", as object code and/or source code, so that the -+ user can modify the Library and then relink to produce a modified -+ executable containing the modified Library. (It is understood -+ that the user who changes the contents of definitions files in the -+ Library will not necessarily be able to recompile the application -+ to use the modified definitions.) -+ -+ b) Use a suitable shared library mechanism for linking with the -+ Library. A suitable mechanism is one that (1) uses at run time a -+ copy of the library already present on the user's computer system, -+ rather than copying library functions into the executable, and (2) -+ will operate properly with a modified version of the library, if -+ the user installs one, as long as the modified version is -+ interface-compatible with the version that the work was made with. -+ -+ c) Accompany the work with a written offer, valid for at -+ least three years, to give the same user the materials -+ specified in Subsection 6a, above, for a charge no more -+ than the cost of performing this distribution. -+ -+ d) If distribution of the work is made by offering access to copy -+ from a designated place, offer equivalent access to copy the above -+ specified materials from the same place. -+ -+ e) Verify that the user has already received a copy of these -+ materials or that you have already sent this user a copy. -+ -+ For an executable, the required form of the "work that uses the -+Library" must include any data and utility programs needed for -+reproducing the executable from it. However, as a special exception, -+the materials to be distributed need not include anything that is -+normally distributed (in either source or binary form) with the major -+components (compiler, kernel, and so on) of the operating system on -+which the executable runs, unless that component itself accompanies -+the executable. -+ -+ It may happen that this requirement contradicts the license -+restrictions of other proprietary libraries that do not normally -+accompany the operating system. Such a contradiction means you cannot -+use both them and the Library together in an executable that you -+distribute. -+ -+ 7. You may place library facilities that are a work based on the -+Library side-by-side in a single library together with other library -+facilities not covered by this License, and distribute such a combined -+library, provided that the separate distribution of the work based on -+the Library and of the other library facilities is otherwise -+permitted, and provided that you do these two things: -+ -+ a) Accompany the combined library with a copy of the same work -+ based on the Library, uncombined with any other library -+ facilities. This must be distributed under the terms of the -+ Sections above. -+ -+ b) Give prominent notice with the combined library of the fact -+ that part of it is a work based on the Library, and explaining -+ where to find the accompanying uncombined form of the same work. -+ -+ 8. You may not copy, modify, sublicense, link with, or distribute -+the Library except as expressly provided under this License. Any -+attempt otherwise to copy, modify, sublicense, link with, or -+distribute the Library is void, and will automatically terminate your -+rights under this License. However, parties who have received copies, -+or rights, from you under this License will not have their licenses -+terminated so long as such parties remain in full compliance. -+ -+ 9. You are not required to accept this License, since you have not -+signed it. However, nothing else grants you permission to modify or -+distribute the Library or its derivative works. These actions are -+prohibited by law if you do not accept this License. Therefore, by -+modifying or distributing the Library (or any work based on the -+Library), you indicate your acceptance of this License to do so, and -+all its terms and conditions for copying, distributing or modifying -+the Library or works based on it. -+ -+ 10. Each time you redistribute the Library (or any work based on the -+Library), the recipient automatically receives a license from the -+original licensor to copy, distribute, link with or modify the Library -+subject to these terms and conditions. You may not impose any further -+restrictions on the recipients' exercise of the rights granted herein. -+You are not responsible for enforcing compliance by third parties with -+this License. -+ -+ 11. If, as a consequence of a court judgment or allegation of patent -+infringement or for any other reason (not limited to patent issues), -+conditions are imposed on you (whether by court order, agreement or -+otherwise) that contradict the conditions of this License, they do not -+excuse you from the conditions of this License. If you cannot -+distribute so as to satisfy simultaneously your obligations under this -+License and any other pertinent obligations, then as a consequence you -+may not distribute the Library at all. For example, if a patent -+license would not permit royalty-free redistribution of the Library by -+all those who receive copies directly or indirectly through you, then -+the only way you could satisfy both it and this License would be to -+refrain entirely from distribution of the Library. -+ -+If any portion of this section is held invalid or unenforceable under any -+particular circumstance, the balance of the section is intended to apply, -+and the section as a whole is intended to apply in other circumstances. -+ -+It is not the purpose of this section to induce you to infringe any -+patents or other property right claims or to contest validity of any -+such claims; this section has the sole purpose of protecting the -+integrity of the free software distribution system which is -+implemented by public license practices. Many people have made -+generous contributions to the wide range of software distributed -+through that system in reliance on consistent application of that -+system; it is up to the author/donor to decide if he or she is willing -+to distribute software through any other system and a licensee cannot -+impose that choice. -+ -+This section is intended to make thoroughly clear what is believed to -+be a consequence of the rest of this License. -+ -+ 12. If the distribution and/or use of the Library is restricted in -+certain countries either by patents or by copyrighted interfaces, the -+original copyright holder who places the Library under this License may add -+an explicit geographical distribution limitation excluding those countries, -+so that distribution is permitted only in or among countries not thus -+excluded. In such case, this License incorporates the limitation as if -+written in the body of this License. -+ -+ 13. The Free Software Foundation may publish revised and/or new -+versions of the Lesser General Public License from time to time. -+Such new versions will be similar in spirit to the present version, -+but may differ in detail to address new problems or concerns. -+ -+Each version is given a distinguishing version number. If the Library -+specifies a version number of this License which applies to it and -+"any later version", you have the option of following the terms and -+conditions either of that version or of any later version published by -+the Free Software Foundation. If the Library does not specify a -+license version number, you may choose any version ever published by -+the Free Software Foundation. -+ -+ 14. If you wish to incorporate parts of the Library into other free -+programs whose distribution conditions are incompatible with these, -+write to the author to ask for permission. For software which is -+copyrighted by the Free Software Foundation, write to the Free -+Software Foundation; we sometimes make exceptions for this. Our -+decision will be guided by the two goals of preserving the free status -+of all derivatives of our free software and of promoting the sharing -+and reuse of software generally. -+ -+ NO WARRANTY -+ -+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. -+ -+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -+DAMAGES. -+ -+ END OF TERMS AND CONDITIONS -+ -+ How to Apply These Terms to Your New Libraries -+ -+ If you develop a new library, and you want it to be of the greatest -+possible use to the public, we recommend making it free software that -+everyone can redistribute and change. You can do so by permitting -+redistribution under these terms (or, alternatively, under the terms of the -+ordinary General Public License). -+ -+ To apply these terms, attach the following notices to the library. It is -+safest to attach them to the start of each source file to most effectively -+convey the exclusion of warranty; and each file should have at least the -+"copyright" line and a pointer to where the full notice is found. -+ -+ -+ Copyright (C) -+ -+ This library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ This library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with this library; if not, write to the Free Software -+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ -+Also add information on how to contact you by electronic and paper mail. -+ -+You should also get your employer (if you work as a programmer) or your -+school, if any, to sign a "copyright disclaimer" for the library, if -+necessary. Here is a sample; alter the names: -+ -+ Yoyodyne, Inc., hereby disclaims all copyright interest in the -+ library `Frob' (a library for tweaking knobs) written by James Random Hacker. -+ -+ , 1 April 1990 -+ Ty Coon, President of Vice -+ -+That's all there is to it! --- -GitLab diff --git a/recipes/at-spi2-core/new/test_package/CMakeLists.txt b/recipes/at-spi2-core/new/test_package/CMakeLists.txt deleted file mode 100644 index afa2476357074..0000000000000 --- a/recipes/at-spi2-core/new/test_package/CMakeLists.txt +++ /dev/null @@ -1,9 +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.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) diff --git a/recipes/at-spi2-core/new/test_package/conanfile.py b/recipes/at-spi2-core/new/test_package/conanfile.py index d4128b0450777..45e2b8f908a8f 100644 --- a/recipes/at-spi2-core/new/test_package/conanfile.py +++ b/recipes/at-spi2-core/new/test_package/conanfile.py @@ -1,17 +1,32 @@ -from conans import ConanFile, CMake, tools +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): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + 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/1.3.1") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/2.1.0") def build(self): - cmake = CMake(self) - cmake.configure() - cmake.build() + meson = Meson(self) + meson.configure() + meson.build() 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/at-spi2-core/new/test_package/meson.build b/recipes/at-spi2-core/new/test_package/meson.build new file mode 100644 index 0000000000000..896df27207865 --- /dev/null +++ b/recipes/at-spi2-core/new/test_package/meson.build @@ -0,0 +1,5 @@ +project('test_package', 'c') +package_dep = dependency('atk') +executable('test_package', + sources : ['test_package.c'], + dependencies : [package_dep]) diff --git a/recipes/at-spi2-core/new/test_package/test_package.c b/recipes/at-spi2-core/new/test_package/test_package.c index c155308c155ba..284086622ab26 100644 --- a/recipes/at-spi2-core/new/test_package/test_package.c +++ b/recipes/at-spi2-core/new/test_package/test_package.c @@ -1,9 +1,10 @@ -#include "atspi/atspi.h" -#include "assert.h" +#include +#include int main() { - atspi_init (); - assert(atspi_get_desktop_count() > 0); - return atspi_exit(); + printf("ATK version %d.%d.%d\n",atk_get_major_version(), atk_get_minor_version(), atk_get_micro_version()); + printf("binary age %d\n", atk_get_binary_age()); + printf("interface age %d\n", atk_get_interface_age()); + return 0; } 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..40a2f9c42d3e3 100644 --- a/recipes/atk/all/conanfile.py +++ b/recipes/atk/all/conanfile.py @@ -1,102 +1,126 @@ -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" + deprecated = "at-spi2-core" 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 - if self.options.shared: - self.options["glib"].shared = True + 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("glib/2.76.3") 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.1.1") + 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.76.3") + + 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/reactiveplusplus/all/test_v1_package/conanfile.py b/recipes/atk/all/test_v1_package/conanfile.py similarity index 100% rename from recipes/reactiveplusplus/all/test_v1_package/conanfile.py rename to recipes/atk/all/test_v1_package/conanfile.py diff --git a/recipes/atomic_queue/all/conandata.yml b/recipes/atomic_queue/all/conandata.yml new file mode 100644 index 0000000000000..f19fe2ba05117 --- /dev/null +++ b/recipes/atomic_queue/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.6.3": + url: "https://github.com/max0x7ba/atomic_queue/archive/refs/tags/v1.6.3.tar.gz" + sha256: "0ad6e0203d90367f6a4e496449dfd9ad65b80168fadafef4eac08820c6bda79c" diff --git a/recipes/atomic_queue/all/conanfile.py b/recipes/atomic_queue/all/conanfile.py new file mode 100644 index 0000000000000..8e73409204f38 --- /dev/null +++ b/recipes/atomic_queue/all/conanfile.py @@ -0,0 +1,46 @@ +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 CxxOptsConan(ConanFile): + name = "atomic_queue" + homepage = "https://github.com/max0x7ba/atomic_queue" + url = "https://github.com/conan-io/conan-center-index" + description = "Multiple-producer-multiple-consumer lock-free queues based on circular buffer and std::atomic." + license = "MIT" + topics = ("queue", "lockfree", "atomic") + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _min_cppstd(self): + return 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 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, pattern="*", 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/atomic_queue/all/test_package/CMakeLists.txt b/recipes/atomic_queue/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..2935185362d0c --- /dev/null +++ b/recipes/atomic_queue/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(atomic_queue REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE atomic_queue::atomic_queue) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/atomic_queue/all/test_package/conanfile.py b/recipes/atomic_queue/all/test_package/conanfile.py new file mode 100644 index 0000000000000..081c97abefb38 --- /dev/null +++ b/recipes/atomic_queue/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 + +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/atomic_queue/all/test_package/test_package.cpp b/recipes/atomic_queue/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..bdfe611442b89 --- /dev/null +++ b/recipes/atomic_queue/all/test_package/test_package.cpp @@ -0,0 +1,13 @@ +#include + +int main(int argc, char* argv[]) +{ + atomic_queue::AtomicQueue q; + + const int iPush = 42; + q.push(iPush); + + const int iPop = q.pop(); + + return (iPush - iPop); +} diff --git a/recipes/atomic_queue/config.yml b/recipes/atomic_queue/config.yml new file mode 100644 index 0000000000000..6a0b843662fca --- /dev/null +++ b/recipes/atomic_queue/config.yml @@ -0,0 +1,3 @@ +versions: + "1.6.3": + folder: "all" diff --git a/recipes/au/all/conandata.yml b/recipes/au/all/conandata.yml new file mode 100644 index 0000000000000..bce186970361a --- /dev/null +++ b/recipes/au/all/conandata.yml @@ -0,0 +1,9 @@ +sources: + "0.3.5": + url: "https://github.com/aurora-opensource/au/archive/refs/tags/0.3.5.tar.gz" + sha256: "7ec826dc42968dc1633de56e4f9d06e70de73e820d2ac4788e8453343a622c9b" +patches: + "0.3.5": + - patch_file: "patches/0001-v0.3.5-disable-gtest.patch" + patch_description: "Remove GTest dependency and disable tests build" + patch_type: "conan" diff --git a/recipes/au/all/conanfile.py b/recipes/au/all/conanfile.py new file mode 100644 index 0000000000000..a6d9acc2f5311 --- /dev/null +++ b/recipes/au/all/conanfile.py @@ -0,0 +1,90 @@ +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, rm, rmdir +from conan.tools.scm import Version +import os + + +required_conan_version = ">=1.53.0" + +class PackageConan(ConanFile): + name = "au" + description = "A C++14-compatible physical units library" + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/aurora-opensource/au" + topics = ("units", "C++14") + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + + @property + def _min_cppstd(self): + return 14 + + @property + def _compilers_minimum_version(self): + return { + "apple-clang": "10", + "clang": "7", + "gcc": "7", + "msvc": "191", + "Visual Studio": "15", + } + + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + cmake_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._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 build_requirements(self): + self.tool_requires("cmake/[>=3.24 <4]") + + 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): + cmake = CMake(self) + cmake.install() + + copy(self, "LICENSE.txt", self.source_folder, os.path.join(self.package_folder, "licenses")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "Au") + self.cpp_info.set_property("cmake_target_name", "Au::au") + + 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"] = "Au" + self.cpp_info.filenames["cmake_find_package_multi"] = "Au" + self.cpp_info.names["cmake_find_package"] = "Au::au" + self.cpp_info.names["cmake_find_package_multi"] = "Au::au" diff --git a/recipes/au/all/patches/0001-v0.3.5-disable-gtest.patch b/recipes/au/all/patches/0001-v0.3.5-disable-gtest.patch new file mode 100644 index 0000000000000..1fb8b92d19f4d --- /dev/null +++ b/recipes/au/all/patches/0001-v0.3.5-disable-gtest.patch @@ -0,0 +1,58 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index b18407f..dbd35af 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -37,23 +37,23 @@ set(AU_EXPORT_SET_NAME AuHeaders) + + enable_testing() + +-# Bring in GoogleTest so we can build and run the tests. +-include(FetchContent) +-FetchContent_Declare( +- googletest +- GIT_REPOSITORY https://github.com/google/googletest.git +- GIT_TAG 58d77fa8070e8cec2dc1ed015d66b454c8d78850 # Release 1.12.1 +- FIND_PACKAGE_ARGS +- 1.12.1 +- NAMES GTest +-) +- +-# https://google.github.io/googletest/quickstart-cmake.html +-# For Windows: Prevent overriding the parent project's compiler/linker settings +-set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) +- +-FetchContent_MakeAvailable(googletest) +-include(GoogleTest) ++## Bring in GoogleTest so we can build and run the tests. ++#include(FetchContent) ++#FetchContent_Declare( ++# googletest ++# GIT_REPOSITORY https://github.com/google/googletest.git ++# GIT_TAG 58d77fa8070e8cec2dc1ed015d66b454c8d78850 # Release 1.12.1 ++# FIND_PACKAGE_ARGS ++# 1.12.1 ++# NAMES GTest ++#) ++# ++## https://google.github.io/googletest/quickstart-cmake.html ++## For Windows: Prevent overriding the parent project's compiler/linker settings ++#set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) ++# ++#FetchContent_MakeAvailable(googletest) ++#include(GoogleTest) + + add_subdirectory(au) + +diff --git a/cmake/HeaderOnlyLibrary.cmake b/cmake/HeaderOnlyLibrary.cmake +index 28daf00..fbf0fab 100644 +--- a/cmake/HeaderOnlyLibrary.cmake ++++ b/cmake/HeaderOnlyLibrary.cmake +@@ -75,7 +75,7 @@ function(header_only_library) + ) + + # Add the test, if requested. +- if (DEFINED ARG_GTEST_SRCS) ++ if (OFF) + add_executable("${ARG_NAME}_test") + target_sources("${ARG_NAME}_test" PRIVATE ${ARG_GTEST_SRCS}) + target_link_libraries( diff --git a/recipes/au/all/test_package/CMakeLists.txt b/recipes/au/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..1c8798b44ab97 --- /dev/null +++ b/recipes/au/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.15) + +project(test_package LANGUAGES CXX) + +find_package(Au REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE Au::au) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/au/all/test_package/conanfile.py b/recipes/au/all/test_package/conanfile.py new file mode 100644 index 0000000000000..02eb5ce439fb4 --- /dev/null +++ b/recipes/au/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/au/all/test_package/test_package.cpp b/recipes/au/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..35bad3194d8e4 --- /dev/null +++ b/recipes/au/all/test_package/test_package.cpp @@ -0,0 +1,15 @@ +#include + +#include "au/au.hh" +#include "au/io.hh" +#include "au/units/meters.hh" + +using namespace au; + +int main(void) { + constexpr auto length = meters(100.0); + + std::cout << length << " == " << length.in(kilo(meters)) <<" km" << std::endl; + + return EXIT_SUCCESS; +} diff --git a/recipes/au/config.yml b/recipes/au/config.yml new file mode 100644 index 0000000000000..ef7972c36ec69 --- /dev/null +++ b/recipes/au/config.yml @@ -0,0 +1,3 @@ +versions: + "0.3.5": + folder: all diff --git a/recipes/audiofile/all/conandata.yml b/recipes/audiofile/all/conandata.yml index 042cc12d06dd1..8d041f83a5614 100644 --- a/recipes/audiofile/all/conandata.yml +++ b/recipes/audiofile/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "1.1.2": + url: "https://github.com/adamstark/AudioFile/archive/1.1.2.tar.gz" + sha256: "d090282207421e27be57c3df1199a9893e0321ea7c971585361a3fc862bb8c16" + "1.1.1": + url: "https://github.com/adamstark/AudioFile/archive/1.1.1.tar.gz" + sha256: "664f9d5fbbf1ff6c603ae054a35224f12e9856a1d8680be567909015ccaac328" "1.1.0": url: "https://github.com/adamstark/AudioFile/archive/1.1.0.tar.gz" sha256: "7546e39ca17ac09c653f46bfecce4a9936fae3784209ad53094915c78792a327" diff --git a/recipes/audiofile/all/conanfile.py b/recipes/audiofile/all/conanfile.py index 0d083108cea08..c9bd8f69c8aa3 100644 --- a/recipes/audiofile/all/conanfile.py +++ b/recipes/audiofile/all/conanfile.py @@ -1,4 +1,5 @@ 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 @@ -11,34 +12,60 @@ class AudiofileConan(ConanFile): name = "audiofile" description = "A simple C++11 library for reading and writing audio files." - topics = ("audiofile", "audio", "file-format", "wav", "aif") license = "MIT" - homepage = "https://github.com/adamstark/AudioFile" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/adamstark/AudioFile" + topics = ("audio", "file-format", "wav", "aif", "header-only") + + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True + @property + def _min_cppstd(self): + # v1.1.1 uses is_signed_v + return 11 if Version(self.version) < "1.1.1" else 17 + + @property + def _compilers_minimum_version(self): + return { + "Visual Studio": "16", + "msvc": "192", + "gcc": "7", + "clang": "6", + "apple-clang": "10", + } + def configure(self): if Version(self.version) < "1.1.0": self.license = "GPL-3.0-or-later" + 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 layout(self): - basic_layout(self, src_folder="src") + check_min_cppstd(self, self._min_cppstd) + if self._min_cppstd > 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): - copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) - copy(self, "AudioFile.h", src=self.source_folder, dst=os.path.join(self.package_folder, "include")) + copy(self, "LICENSE", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder) + copy(self, "AudioFile.h", + dst=os.path.join(self.package_folder, "include"), + src=self.source_folder) def package_info(self): self.cpp_info.bindirs = [] diff --git a/recipes/audiofile/all/test_package/CMakeLists.txt b/recipes/audiofile/all/test_package/CMakeLists.txt index 6f7178f4a8927..fab8ac8a0b20c 100644 --- a/recipes/audiofile/all/test_package/CMakeLists.txt +++ b/recipes/audiofile/all/test_package/CMakeLists.txt @@ -5,4 +5,9 @@ find_package(audiofile REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE audiofile::audiofile) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) + +if (audiofile_VERSION VERSION_GREATER_EQUAL "1.1.1") + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +else() + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +endif() diff --git a/recipes/audiofile/all/test_package/conanfile.py b/recipes/audiofile/all/test_package/conanfile.py index fb1d035fc5b12..d120a992c06a6 100644 --- a/recipes/audiofile/all/test_package/conanfile.py +++ b/recipes/audiofile/all/test_package/conanfile.py @@ -22,5 +22,4 @@ def build(self): def test(self): if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") - wav_path = os.path.join(self.source_folder, "sine.wav") - self.run(f"{bin_path} {wav_path}", env="conanrun") + self.run(bin_path, env="conanrun") diff --git a/recipes/audiofile/all/test_package/sine.wav b/recipes/audiofile/all/test_package/sine.wav deleted file mode 100644 index a3225d12bf297..0000000000000 Binary files a/recipes/audiofile/all/test_package/sine.wav and /dev/null differ diff --git a/recipes/audiofile/all/test_package/test_package.cpp b/recipes/audiofile/all/test_package/test_package.cpp index 6943fcec35d57..906aa9efa0327 100644 --- a/recipes/audiofile/all/test_package/test_package.cpp +++ b/recipes/audiofile/all/test_package/test_package.cpp @@ -1,15 +1,15 @@ +// workaround for a missing include in v1.0.9 and earlier +#include +#include +#include #include -#include + int main(int argc, char **argv) { - if (argc < 2) { - std::cerr << "Need at least one argument" << std::endl; - return 1; - } AudioFile audioFile; - audioFile.load(argv[1]); + audioFile.load("fake-file.wav"); audioFile.printSummary(); return 0; } diff --git a/recipes/audiofile/all/test_v1_package/CMakeLists.txt b/recipes/audiofile/all/test_v1_package/CMakeLists.txt index 60fb00c9f3f14..91630d79f4abb 100644 --- a/recipes/audiofile/all/test_v1_package/CMakeLists.txt +++ b/recipes/audiofile/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.15) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(audiofile REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE audiofile::audiofile) -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/audiofile/all/test_v1_package/conanfile.py b/recipes/audiofile/all/test_v1_package/conanfile.py index 21642db6ce1ba..38f4483872d47 100644 --- a/recipes/audiofile/all/test_v1_package/conanfile.py +++ b/recipes/audiofile/all/test_v1_package/conanfile.py @@ -14,5 +14,4 @@ def build(self): def test(self): if not tools.cross_building(self): bin_path = os.path.join("bin", "test_package") - wav_path = os.path.join(self.source_folder, os.pardir, "test_package", "sine.wav") - self.run(f"{bin_path} {wav_path}", run_environment=True) + self.run(bin_path, run_environment=True) diff --git a/recipes/audiofile/config.yml b/recipes/audiofile/config.yml index 5fc24e2e9c188..0189cfcafca9b 100644 --- a/recipes/audiofile/config.yml +++ b/recipes/audiofile/config.yml @@ -1,4 +1,8 @@ versions: + "1.1.2": + folder: all + "1.1.1": + folder: all "1.1.0": folder: all "1.0.9": diff --git a/recipes/audiowaveform/all/conandata.yml b/recipes/audiowaveform/all/conandata.yml new file mode 100644 index 0000000000000..2e2ba28ceca12 --- /dev/null +++ b/recipes/audiowaveform/all/conandata.yml @@ -0,0 +1,15 @@ +sources: + "1.10.1": + url: "https://github.com/bbc/audiowaveform/archive/refs/tags/1.10.1.tar.gz" + sha256: "bd283d84dc84fda84f4090fddde9a5bef924c588dd7bf6acaa8f7b946efb42a4" +patches: + "1.10.1": + - patch_file: "patches/0001-1.10.1_find_packages.patch" + patch_description: "Inject thirdparties from conan" + patch_type: "conan" + - patch_file: "patches/0002-1.10.1_remove_flags.patch" + patch_description: "Remove custom compile flags" + patch_type: "conan" + - patch_file: "patches/0003-1.10.1_remove_documentation.patch" + patch_description: "Remove documenation" + patch_type: "conan" diff --git a/recipes/audiowaveform/all/conanfile.py b/recipes/audiowaveform/all/conanfile.py new file mode 100644 index 0000000000000..4d5e42ee98a02 --- /dev/null +++ b/recipes/audiowaveform/all/conanfile.py @@ -0,0 +1,94 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd, valid_min_cppstd +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rm, rmdir +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.microsoft import is_msvc +import os + + +required_conan_version = ">=1.53.0" + + +class AudiowaveformConan(ConanFile): + name = "audiowaveform" + description = "C++ program to generate waveform data and render waveform images from audio files" + license = "GPL-3.0-or-later" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://waveform.prototyping.bbc.co.uk/" + topics = ("audio", "c-plus-plus") + package_type = "application" + settings = "os", "arch", "compiler", "build_type" + + @property + def _min_cppstd(self): + return 11 + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + pass + + def configure(self): + pass + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires("libgd/2.3.3") + self.requires("libid3tag/0.15.1b") + self.requires("libmad/0.15.1b") + self.requires("libsndfile/1.2.2") + self.requires("boost/1.85.0") + + def package_id(self): + del self.info.settings.compiler + + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + if is_msvc(self): + raise ConanInvalidConfiguration(f"{self.ref} can not be built on Visual Studio and msvc.") + + def build_requirements(self): + pass + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["ENABLE_TESTS"] = False + if not valid_min_cppstd(self, self._min_cppstd): + tc.variables["CMAKE_CXX_STANDARD"] = self._min_cppstd + tc.generate() + tc = CMakeDeps(self) + tc.generate() + + 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 = 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() + rmdir(self, os.path.join(self.package_folder, "share")) + + 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/audiowaveform/all/patches/0001-1.10.1_find_packages.patch b/recipes/audiowaveform/all/patches/0001-1.10.1_find_packages.patch new file mode 100644 index 0000000000000..e4f3afcf4da27 --- /dev/null +++ b/recipes/audiowaveform/all/patches/0001-1.10.1_find_packages.patch @@ -0,0 +1,66 @@ +Use packages that are provided by conan +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -88,40 +88,11 @@ if(BUILD_STATIC) + endif() + endif(BUILD_STATIC) + +-find_package(LibGD REQUIRED) +-if(LIBGD_FOUND) +- message(STATUS "LIBGD_INCLUDE_DIRS='${LIBGD_INCLUDE_DIRS}'") +- message(STATUS "LIBGD_LIBRARIES=${LIBGD_LIBRARIES}") +- include_directories(${LIBGD_INCLUDE_DIRS}) +-endif(LIBGD_FOUND) +- +-find_package(LibSndFile REQUIRED) +-if(LIBSNDFILE_FOUND) +- message(STATUS "LIBSNDFILE_INCLUDE_DIRS='${LIBSNDFILE_INCLUDE_DIRS}'") +- message(STATUS "LIBSNDFILE_LIBRARIES=${LIBSNDFILE_LIBRARIES}") +- include_directories(${LIBSNDFILE_INCLUDE_DIRS}) +-endif(LIBSNDFILE_FOUND) +- +-find_package(LibMad REQUIRED) +-if(LIBMAD_FOUND) +- message(STATUS "LIBMAD_INCLUDE_DIRS='${LIBMAD_INCLUDE_DIRS}'") +- message(STATUS "LIBMAD_LIBRARIES=${LIBMAD_LIBRARIES}") +- include_directories(${LIBMAD_INCLUDE_DIRS}) +-endif(LIBMAD_FOUND) +- +-find_package(LibId3Tag REQUIRED) +-if(LIBID3TAG_FOUND) +- message(STATUS "LIBID3TAG_INCLUDE_DIRS='${LIBID3TAG_INCLUDE_DIRS}'") +- message(STATUS "LIBID3TAG_LIBRARIES=${LIBID3TAG_LIBRARIES}") +- include_directories(${LIBID3TAG_INCLUDE_DIRS}) +-endif(LIBID3TAG_FOUND) +- +-find_package(Boost 1.46.0 COMPONENTS program_options filesystem regex system REQUIRED) +-if(Boost_FOUND) +- message(STATUS "Boost_INCLUDE_DIRS='${Boost_INCLUDE_DIRS}'") +- message(STATUS "Boost_LIBRARIES='${Boost_LIBRARIES}'") +- include_directories(${Boost_INCLUDE_DIRS}) +-endif(Boost_FOUND) ++find_package(libgd REQUIRED CONFIG) ++find_package(SndFile REQUIRED CONFIG) ++find_package(libmad REQUIRED CONFIG) ++find_package(libid3tag REQUIRED CONFIG) ++find_package(Boost COMPONENTS program_options filesystem regex REQUIRED) + + #------------------------------------------------------------------------------- + # +@@ -278,11 +249,11 @@ add_executable(audiowaveform ${SRCS}) + + # Specify libraries to link against. + set(LIBS +- ${LIBSNDFILE_LIBRARIES} +- ${LIBGD_LIBRARIES} +- ${LIBMAD_LIBRARIES} +- ${LIBID3TAG_LIBRARIES} +- ${Boost_LIBRARIES} ++ SndFile::sndfile ++ libgd::libgd ++ libmad::libmad ++ libid3tag::libid3tag ++ Boost::program_options Boost::filesystem Boost::regex + ) + + target_link_libraries(audiowaveform ${LIBS}) diff --git a/recipes/audiowaveform/all/patches/0002-1.10.1_remove_flags.patch b/recipes/audiowaveform/all/patches/0002-1.10.1_remove_flags.patch new file mode 100644 index 0000000000000..ac2bac6bbfe1a --- /dev/null +++ b/recipes/audiowaveform/all/patches/0002-1.10.1_remove_flags.patch @@ -0,0 +1,19 @@ +Remove custom compile flags +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -162,6 +162,7 @@ if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.6.3") + message(FATAL_ERROR "g++ 4.6.3 or later required") + endif() + ++if(0) + if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "4.7") + set(CMAKE_CXX_FLAGS "-std=c++11") + else() +@@ -178,6 +179,7 @@ if(APPLE AND BUILD_STATIC) + set(CMAKE_CXX_FLAGS "-stdlib=libc++ ${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden") + endif() ++endif() + + message(STATUS "CMAKE_CXX_COMPILER_VERSION='${CMAKE_CXX_COMPILER_VERSION}'") + message(STATUS "CMAKE_CXX_FLAGS='${CMAKE_CXX_FLAGS}'") diff --git a/recipes/audiowaveform/all/patches/0003-1.10.1_remove_documentation.patch b/recipes/audiowaveform/all/patches/0003-1.10.1_remove_documentation.patch new file mode 100644 index 0000000000000..c8cc66eaa8a38 --- /dev/null +++ b/recipes/audiowaveform/all/patches/0003-1.10.1_remove_documentation.patch @@ -0,0 +1,34 @@ +Remove documentation target +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -314,6 +314,7 @@ endif() + # + #------------------------------------------------------------------------------- + ++if(0) + file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/doc) + + add_custom_command( +@@ -334,6 +335,7 @@ add_custom_target(doc + ) + + add_dependencies(audiowaveform doc) ++endif() + + #------------------------------------------------------------------------------- + # +@@ -347,6 +349,7 @@ message(STATUS "CMAKE_INSTALL_PREFIX='${CMAKE_INSTALL_PREFIX}'") + install(TARGETS audiowaveform DESTINATION bin) + + # Install man pages ++if(0) + install( + FILES ${PROJECT_BINARY_DIR}/doc/audiowaveform.1.gz + DESTINATION share/man/man1 +@@ -356,5 +359,6 @@ install( + FILES ${PROJECT_BINARY_DIR}/doc/audiowaveform.5.gz + DESTINATION share/man/man5 + ) ++endif() + + #------------------------------------------------------------------------------- diff --git a/recipes/audiowaveform/all/test_package/conanfile.py b/recipes/audiowaveform/all/test_package/conanfile.py new file mode 100644 index 0000000000000..5b8eaa02f81b6 --- /dev/null +++ b/recipes/audiowaveform/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("audiowaveform --version") diff --git a/recipes/audiowaveform/config.yml b/recipes/audiowaveform/config.yml new file mode 100644 index 0000000000000..5492c2a9aab5c --- /dev/null +++ b/recipes/audiowaveform/config.yml @@ -0,0 +1,3 @@ +versions: + "1.10.1": + folder: all diff --git a/recipes/autoconf-archive/all/conandata.yml b/recipes/autoconf-archive/all/conandata.yml index 528425d762278..763c0b5a2581e 100644 --- a/recipes/autoconf-archive/all/conandata.yml +++ b/recipes/autoconf-archive/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "2023.02.20": + url: "https://ftpmirror.gnu.org/autoconf-archive/autoconf-archive-2023.02.20.tar.xz" + sha256: "71d4048479ae28f1f5794619c3d72df9c01df49b1c628ef85fde37596dc31a33" + "2022.09.03": + url: "https://ftpmirror.gnu.org/autoconf-archive/autoconf-archive-2022.09.03.tar.xz" + sha256: "e07454f00d8cae7907bed42d0747798927809947684d94c37207a4d63a32f423" "2021.02.19": url: "https://ftpmirror.gnu.org/autoconf-archive/autoconf-archive-2021.02.19.tar.xz" sha256: "e8a6eb9d28ddcba8ffef3fa211653239e9bf239aba6a01a6b7cfc7ceaec69cbd" 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..8168c2f450f36 100644 --- a/recipes/autoconf-archive/config.yml +++ b/recipes/autoconf-archive/config.yml @@ -1,3 +1,7 @@ versions: + "2023.02.20": + folder: all + "2022.09.03": + folder: all "2021.02.19": folder: all diff --git a/recipes/autoconf/all/conandata.yml b/recipes/autoconf/all/conandata.yml index 97adbd2afcde0..9d182df49e442 100644 --- a/recipes/autoconf/all/conandata.yml +++ b/recipes/autoconf/all/conandata.yml @@ -1,20 +1,32 @@ sources: + "2.72": + url: + - "https://ftpmirror.gnu.org/autoconf/autoconf-2.72.tar.xz" + - "https://ftp.gnu.org/gnu/autoconf/autoconf-2.72.tar.xz" + sha256: "ba885c1319578d6c94d46e9b0dceb4014caafe2490e437a0dbca3f270a223f5a" "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" + url: + - "https://ftpmirror.gnu.org/autoconf/autoconf-2.71.tar.xz" + - "https://ftp.gnu.org/gnu/autoconf/autoconf-2.71.tar.xz" + sha256: "f14c83cfebcc9427f2c3cea7258bd90df972d92eb26752da4ddad81c87a0faa4" patches: + "2.72": + - patch_file: "patches/2.72-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" + patch_description: "Avoid build machine's perl path to be embedded the generated files" + patch_type: "conan" + - patch_file: "patches/2.72-0003-disable-man-regeneration.patch" + patch_description: "Disable man regeneration" + patch_type: "conan" "2.71": - - patch_file: "patches/2.71-0001-autom4te-relocatable.patch" + - 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" - - patch_file: "patches/2.71-0003-uppercase-autom4te_perllibdir.patch" - - patch_file: "patches/2.71-0004-no-embedded-m4-paths.patch" - - patch_file: "patches/2.71-0005-disable-man-regeneration.patch" - - patch_file: "patches/2.71-0006-autoconf-no-embedded-trailer_m4-path.patch" - "2.69": - - patch_file: "patches/2.69-0001-autom4te-relocatable.patch" - - patch_file: "patches/2.69-0002-no-perl-path-in-shebang.patch" - - patch_file: "patches/2.69-0003-uppercase-autom4te_perllibdir.patch" - - patch_file: "patches/2.69-0004-no-embedded-m4-paths.patch" + 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 ceb06b4b4a4be..048942c07adfc 100644 --- a/recipes/autoconf/all/conanfile.py +++ b/recipes/autoconf/all/conanfile.py @@ -4,10 +4,9 @@ from conan.tools.gnu import Autotools, AutotoolsToolchain from conan.tools.layout import basic_layout from conan.tools.microsoft import unix_path, is_msvc -from conans import tools as tools_legacy import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.54.0" class AutoconfConan(ConanFile): @@ -19,7 +18,9 @@ class AutoconfConan(ConanFile): 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/" - topics = ("autoconf", "configure", "build") + topics = ("configure", "build") + + package_type = "application" settings = "os", "arch", "compiler", "build_type" @property @@ -34,7 +35,7 @@ def layout(self): basic_layout(self, src_folder="src") def requirements(self): - self.requires("m4/1.4.19") + self.requires("m4/1.4.19") # Needed at runtime by downstream clients as well def package_id(self): self.info.clear() @@ -47,8 +48,7 @@ def build_requirements(self): self.tool_requires("msys2/cci.latest") 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) @@ -80,6 +80,10 @@ 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_sources() @@ -89,50 +93,27 @@ def build(self): def package(self): autotools = Autotools(self) - # TODO: can be replaced by autotools.install() if required_conan_version = ">=1.54.0" - autotools.install(args=[f"DESTDIR={unix_path(self, self.package_folder)}"]) + 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.frameworkdirs = [] self.cpp_info.libdirs = [] self.cpp_info.includedirs = [] self.cpp_info.resdirs = ["res"] - # TODO: use legacy unix_path for the moment (see https://github.com/conan-io/conan/issues/12499) - - dataroot_path = tools_legacy.unix_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) - - self.output.info(f"Defining AUTOM4TE_PERLLIBDIR environment variable: {dataroot_path}") - self.buildenv_info.define_path("AUTOM4TE_PERLLIBDIR", dataroot_path) - bin_path = os.path.join(self.package_folder, "bin") - - autoconf_bin = tools_legacy.unix_path(os.path.join(bin_path, "autoconf")) - self.output.info(f"Defining AUTOCONF environment variable: {autoconf_bin}") - self.buildenv_info.define_path("AUTOCONF", autoconf_bin) - - autoreconf_bin = tools_legacy.unix_path(os.path.join(bin_path, "autoreconf")) - self.output.info(f"Defining AUTORECONF environment variable: {autoreconf_bin}") - self.buildenv_info.define_path("AUTORECONF", autoreconf_bin) - - autoheader_bin = tools_legacy.unix_path(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_bin = tools_legacy.unix_path(os.path.join(bin_path, "autom4te")) - self.output.info(f"Defining AUTOM4TE environment variable: {autom4te_bin}") - self.buildenv_info.define_path("AUTOM4TE", autom4te_bin) + self.buildenv_info.define_path("AUTOCONF", os.path.join(bin_path, "autoconf")) + self.buildenv_info.define_path("AUTORECONF", os.path.join(bin_path, "autoreconf")) + self.buildenv_info.define_path("AUTOHEADER", os.path.join(bin_path, "autoheader")) + self.buildenv_info.define_path("AUTOM4TE", os.path.join(bin_path, "autom4te")) # TODO: to remove in conan v2 self.env_info.PATH.append(bin_path) - self.env_info.AC_MACRODIR = dataroot_path - self.env_info.AUTOM4TE_PERLLIBDIR = dataroot_path - self.env_info.AUTOCONF = autoconf_bin - self.env_info.AUTORECONF = autoreconf_bin - self.env_info.AUTOHEADER = autoheader_bin - self.env_info.AUTOM4TE = autom4te_bin + 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/patches/2.72-0001-relocatable-autoconf.patch b/recipes/autoconf/all/patches/2.72-0001-relocatable-autoconf.patch new file mode 100644 index 0000000000000..a7ebbaa6c17bf --- /dev/null +++ b/recipes/autoconf/all/patches/2.72-0001-relocatable-autoconf.patch @@ -0,0 +1,262 @@ +diff --git a/Makefile.in b/Makefile.in +--- a/Makefile.in ++++ b/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/bin/autoconf.in b/bin/autoconf.in +--- a/bin/autoconf.in ++++ b/bin/autoconf.in +@@ -26,10 +26,14 @@ + 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"; ++ $ENV{'trailer_m4'} ||= "$pkgdatadir/autoconf/trailer.m4"; + unshift @INC, $pkgdatadir; + + # Override SHELL. On DJGPP SHELL may not be set to a shell +diff --git a/bin/autoheader.in b/bin/autoheader.in +--- a/bin/autoheader.in ++++ b/bin/autoheader.in +@@ -29,10 +29,13 @@ + 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 @@ + 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 +--- a/bin/autom4te.in ++++ b/bin/autom4te.in +@@ -25,10 +25,13 @@ + 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::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 $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"; +@@ -321,6 +325,12 @@ + 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 +--- a/bin/autoreconf.in ++++ b/bin/autoreconf.in +@@ -28,11 +28,14 @@ + 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'; +@@ -116,9 +119,10 @@ + "; + + # 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 +--- a/bin/autoscan.in ++++ b/bin/autoscan.in +@@ -27,10 +27,13 @@ + 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 $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 +--- a/bin/autoupdate.in ++++ b/bin/autoupdate.in +@@ -28,10 +28,13 @@ + 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::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 +--- a/bin/ifnames.in ++++ b/bin/ifnames.in +@@ -32,10 +32,13 @@ + 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 +--- a/lib/autom4te.in ++++ b/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.72-0003-disable-man-regeneration.patch b/recipes/autoconf/all/patches/2.72-0003-disable-man-regeneration.patch new file mode 100644 index 0000000000000..af2e738435ff6 --- /dev/null +++ b/recipes/autoconf/all/patches/2.72-0003-disable-man-regeneration.patch @@ -0,0 +1,12 @@ +--- Makefile.in ++++ Makefile.in +@@ -2171,9 +2171,2 @@ + .PHONY: install-data-hook install-data-hook-make-aux-scripts-executable + +-man/autoconf.1: $(common_dep) man/autoconf.w man/autoconf.x $(binsrcdir)/autoconf.in +-man/autoheader.1: $(common_dep) man/autoheader.w man/autoheader.x $(binsrcdir)/autoheader.in +-man/autom4te.1: $(common_dep) man/autom4te.w man/autom4te.x $(binsrcdir)/autom4te.in +-man/autoreconf.1: $(common_dep) man/autoreconf.w man/autoreconf.x $(binsrcdir)/autoreconf.in +-man/autoscan.1: $(common_dep) man/autoscan.w man/autoscan.x $(binsrcdir)/autoscan.in +-man/autoupdate.1: $(common_dep) man/autoupdate.w man/autoupdate.x $(binsrcdir)/autoupdate.in +-man/ifnames.1: $(common_dep) man/ifnames.w man/ifnames.x $(binsrcdir)/ifnames.in diff --git a/recipes/autoconf/all/test_package/conanfile.py b/recipes/autoconf/all/test_package/conanfile.py index bb22349ed9696..540a389d38f89 100644 --- a/recipes/autoconf/all/test_package/conanfile.py +++ b/recipes/autoconf/all/test_package/conanfile.py @@ -29,6 +29,9 @@ def generate(self): env = VirtualBuildEnv(self) env.generate() tc = AutotoolsToolchain(self) + if is_msvc(self): + tc.extra_cflags.append("-FS") + tc.extra_cxxflags.append("-FS") tc.generate() if is_msvc(self): env = Environment() diff --git a/recipes/autoconf/all/test_package/test_package_cpp.cpp b/recipes/autoconf/all/test_package/test_package_cpp.cpp index e31a5ee3cfefa..01bf15d96515c 100644 --- a/recipes/autoconf/all/test_package/test_package_cpp.cpp +++ b/recipes/autoconf/all/test_package/test_package_cpp.cpp @@ -3,14 +3,14 @@ #include extern "C" { - int hello_from_c(void); +int hello_from_c(void); } void hello_from_cxx() { std::cout << "Hello world (" PACKAGE_NAME ") from c++!\n"; } -int main(int argc, char** argv) { +int main() { hello_from_cxx(); hello_from_c(); return 0; diff --git a/recipes/autoconf/all/test_v1_package/conanfile.py b/recipes/autoconf/all/test_v1_package/conanfile.py index 422d5f44c10cf..7098a4c30759b 100644 --- a/recipes/autoconf/all/test_v1_package/conanfile.py +++ b/recipes/autoconf/all/test_v1_package/conanfile.py @@ -34,6 +34,8 @@ def build(self): 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) + if is_msvc(self): + autotools.flags.append("-FS") with self._build_context(): autotools.configure() autotools.make() diff --git a/recipes/autoconf/config.yml b/recipes/autoconf/config.yml index 7eafcfb17c54f..946e15e5dab08 100644 --- a/recipes/autoconf/config.yml +++ b/recipes/autoconf/config.yml @@ -1,5 +1,5 @@ versions: - "2.71": + "2.72": folder: all - "2.69": + "2.71": 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..1d44aec491a20 100644 --- a/recipes/automake/all/conanfile.py +++ b/recipes/automake/all/conanfile.py @@ -1,101 +1,107 @@ -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" + description = ( + "Automake is a tool for automatically generating Makefile.in files" + " compliant with the GNU Coding Standards." + ) + 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/automake/" - description = "Automake is a tool for automatically generating Makefile.in files compliant with the GNU Coding Standards." - topics = ("conan", "automake", "configure", "build") - license = ("GPL-2.0-or-later", "GPL-3.0-or-later") - settings = "os", "arch", "compiler", "build_type" - - exports_sources = "patches/*" - - _autotools = None + topics = ("autotools", "configure", "build") - @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) + package_type = "application" + 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.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 +110,24 @@ 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.frameworkdirs = [] + 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..26fd488e0e853 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..ec5b5ab958cbb --- /dev/null +++ b/recipes/automake/all/test_package/src/test_package.cpp @@ -0,0 +1,9 @@ +#include "config.h" + +#include +#include + +int main() { + 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_package/test_package.cpp b/recipes/automake/all/test_package/test_package.cpp index cd8c2f27c3587..ec5b5ab958cbb 100644 --- a/recipes/automake/all/test_package/test_package.cpp +++ b/recipes/automake/all/test_package/test_package.cpp @@ -3,7 +3,7 @@ #include #include -int main(int argc, char** argv) { +int main() { std::cout << "test_package.cpp: " << "hello world from " PACKAGE_NAME "!\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/conandata.yml b/recipes/avahi/all/conandata.yml index 49b6c0881959d..6cf843ad984a8 100644 --- a/recipes/avahi/all/conandata.yml +++ b/recipes/avahi/all/conandata.yml @@ -2,3 +2,8 @@ sources: "0.8": url: "https://github.com/lathiat/avahi/releases/download/v0.8/avahi-0.8.tar.gz" sha256: "060309d7a333d38d951bc27598c677af1796934dbd98e1024e7ad8de798fedda" +patches: + "0.8": + - patch_file: "patches/0.8-0001-Avoid-conflicting-definition-with-strlcpy-in-glibc.patch" + patch_description: "Avoid conflicting definition with glibc strlcpy" + patch_type: "conan" diff --git a/recipes/avahi/all/conanfile.py b/recipes/avahi/all/conanfile.py index a622c2efdd891..2920eabb9e448 100644 --- a/recipes/avahi/all/conanfile.py +++ b/recipes/avahi/all/conanfile.py @@ -1,7 +1,9 @@ import os from conan import ConanFile -from conan.tools.files import copy, get, rmdir, rm +from conan.tools.build import can_run +from conan.tools.env import Environment, VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, rm from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain, PkgConfigDeps from conan.tools.layout import basic_layout from conan.errors import ConanInvalidConfiguration @@ -18,55 +20,78 @@ class AvahiConan(ConanFile): 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" + 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, } + def export_sources(self): + export_conandata_patches(self) + + 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): - self.requires("glib/2.75.0") - self.requires("expat/2.5.0") + self.requires("glib/2.78.3") + self.requires("expat/[>=2.6.2 <3]") self.requires("libdaemon/0.14") - self.requires("dbus/1.15.2") - self.requires("gdbm/1.19") + self.requires("dbus/1.15.8") + self.requires("gdbm/1.23") self.requires("libevent/2.1.12") def validate(self): - if self.info.settings.os != "Linux": + if self.settings.os not in ["Linux", "FreeBSD"]: raise ConanInvalidConfiguration(f"{self.ref} only supports Linux.") - 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 build_requirements(self): + self.tool_requires("glib/") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/2.1.0") def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): + virtual_build_env = VirtualBuildEnv(self) + virtual_build_env.generate() + if can_run(self): + VirtualRunEnv(self).generate(scope="build") + tc = AutotoolsToolchain(self) tc.configure_args.append("--enable-compat-libdns_sd") + tc.configure_args.append("--enable-introspection=no") 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.configure_args.append("--with-distro=none") + tc.configure_args.append("ac_cv_func_strlcpy=no") + tc.configure_args.append("ac_cv_func_setproctitle=no") 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): + apply_conandata_patches(self) autotools = Autotools(self) autotools.configure() autotools.make() @@ -84,11 +109,11 @@ def package(self): def package_info(self): for lib in ("client", "common", "core", "glib", "gobject", "libevent", "compat-libdns_sd"): avahi_lib = f"avahi-{lib}" + self.cpp_info.components[lib].set_property("pkg_config_name", 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 self.cpp_info.components[lib].libs = [avahi_lib] - self.cpp_info.components[lib].includedirs = [os.path.join("include", avahi_lib)] + self.cpp_info.components[lib].includedirs = ["include", os.path.join("include", avahi_lib)] self.cpp_info.components["compat-libdns_sd"].libs = ["dns_sd"] self.cpp_info.components["client"].requires = ["common", "dbus::dbus"] @@ -101,9 +126,9 @@ def package_info(self): for app in ("autoipd", "browse", "daemon", "dnsconfd", "publish", "resolve", "set-host-name"): avahi_app = f"avahi-{app}" + self.cpp_info.components[app].set_property("pkg_config_name", 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 self.cpp_info.components["autoipd"].requires = ["libdaemon::libdaemon"] self.cpp_info.components["browse"].requires = ["client", "gdbm::gdbm"] @@ -113,6 +138,7 @@ def package_info(self): self.cpp_info.components["resolve"].requires = ["client"] self.cpp_info.components["set-host-name"].requires = ["client"] + # TODO: Remove after dropping Conan 1.x support 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/avahi/all/patches/0.8-0001-Avoid-conflicting-definition-with-strlcpy-in-glibc.patch b/recipes/avahi/all/patches/0.8-0001-Avoid-conflicting-definition-with-strlcpy-in-glibc.patch new file mode 100644 index 0000000000000..3a595ccc1cb70 --- /dev/null +++ b/recipes/avahi/all/patches/0.8-0001-Avoid-conflicting-definition-with-strlcpy-in-glibc.patch @@ -0,0 +1,79 @@ +From 495f8868f4cdad235608c7ac732ade17d3d49b17 Mon Sep 17 00:00:00 2001 +From: Jordan Williams +Date: Wed, 6 Mar 2024 09:44:33 -0600 +Subject: [PATCH] Avoid conflicting definition with strlcpy in glibc + +--- + avahi-common/domain.c | 8 ++------ + avahi-compat-howl/text.c | 8 ++------ + 2 files changed, 4 insertions(+), 12 deletions(-) + +diff --git a/avahi-common/domain.c b/avahi-common/domain.c +index 3b1ab68..555aeb3 100644 +--- a/avahi-common/domain.c ++++ b/avahi-common/domain.c +@@ -477,9 +477,7 @@ int avahi_service_name_join(char *p, size_t size, const char *name, const char * + return AVAHI_OK; + } + +-#ifndef HAVE_STRLCPY +- +-static size_t strlcpy(char *dest, const char *src, size_t n) { ++static size_t avahi_strlcpy(char *dest, const char *src, size_t n) { + assert(dest); + assert(src); + +@@ -491,8 +489,6 @@ static size_t strlcpy(char *dest, const char *src, size_t n) { + return strlen(src); + } + +-#endif +- + int avahi_service_name_split(const char *p, char *name, size_t name_size, char *type, size_t type_size, char *domain, size_t domain_size) { + enum { + NAME, +@@ -524,7 +520,7 @@ int avahi_service_name_split(const char *p, char *name, size_t name_size, char * + + switch (state) { + case NAME: +- strlcpy(name, buf, name_size); ++ avahi_strlcpy(name, buf, name_size); + state = TYPE; + break; + +diff --git a/avahi-compat-howl/text.c b/avahi-compat-howl/text.c +index 7ef4df3..45f43ae 100644 +--- a/avahi-compat-howl/text.c ++++ b/avahi-compat-howl/text.c +@@ -37,9 +37,7 @@ struct _sw_text_record { + int buffer_valid; + }; + +-#ifndef HAVE_STRLCPY +- +-static size_t strlcpy(char *dest, const char *src, size_t n) { ++static size_t avahi_strlcpy(char *dest, const char *src, size_t n) { + assert(dest); + assert(src); + +@@ -51,8 +49,6 @@ static size_t strlcpy(char *dest, const char *src, size_t n) { + return strlen(src); + } + +-#endif +- + sw_result sw_text_record_init(sw_text_record *self) { + assert(self); + +@@ -244,7 +240,7 @@ sw_result sw_text_record_iterator_next( + if (avahi_string_list_get_pair(self->index, &mkey, &mvalue, &msize) < 0) + return SW_E_UNKNOWN; + +- strlcpy(key, mkey, SW_TEXT_RECORD_MAX_LEN); ++ avahi_strlcpy(key, mkey, SW_TEXT_RECORD_MAX_LEN); + memset(val, 0, SW_TEXT_RECORD_MAX_LEN); + memcpy(val, mvalue, msize); + *val_len = msize; +-- +2.44.0 + diff --git a/recipes/avahi/all/test_package/CMakeLists.txt b/recipes/avahi/all/test_package/CMakeLists.txt index fce015c3405a9..595c0faefb42e 100644 --- a/recipes/avahi/all/test_package/CMakeLists.txt +++ b/recipes/avahi/all/test_package/CMakeLists.txt @@ -1,7 +1,7 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package LANGUAGES C) find_package(Avahi CONFIG REQUIRED) - + add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE avahi::compat-libdns_sd) +target_link_libraries(${PROJECT_NAME} PRIVATE avahi::compat-libdns_sd avahi::core) diff --git a/recipes/avahi/all/test_package/test_package.c b/recipes/avahi/all/test_package/test_package.c index bae1467c7d687..0b5b2dd52d5e2 100644 --- a/recipes/avahi/all/test_package/test_package.c +++ b/recipes/avahi/all/test_package/test_package.c @@ -1,18 +1,20 @@ -#include -#include +#include -int main() -{ +#include "dns_sd.h" +#include "avahi-core/log.h" + + +int main(void) { DNSServiceRef sdRef; DNSServiceErrorType err = DNSServiceBrowse(&sdRef, 0, 0, "_example._tcp", NULL, NULL, NULL); if (err == kDNSServiceErr_NoError) { - printf("DNSServiceBrowse succeeded\n"); + avahi_log_error("DNSServiceBrowse succeeded\n"); DNSServiceRefDeallocate(sdRef); } else { - printf("DNSServiceBrowse failed: %d\n", err); + avahi_log_info("DNSServiceBrowse failed: %d\n", err); } - return 0; + return EXIT_SUCCESS; } diff --git a/recipes/avahi/all/test_v1_package/CMakeLists.txt b/recipes/avahi/all/test_v1_package/CMakeLists.txt index 925ecbe19e448..91630d79f4abb 100644 --- a/recipes/avahi/all/test_v1_package/CMakeLists.txt +++ b/recipes/avahi/all/test_v1_package/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) diff --git a/recipes/avcpp/all/conandata.yml b/recipes/avcpp/all/conandata.yml index 1ba5e69f511c2..88c010aba2113 100644 --- a/recipes/avcpp/all/conandata.yml +++ b/recipes/avcpp/all/conandata.yml @@ -1,17 +1,30 @@ sources: + "2.4.0": + url: "https://github.com/h4tr3d/avcpp/archive/refs/tags/v2.4.0.tar.gz" + sha256: "47e044c10fa232f0d12d80351e675d5a5ef1480f81a93f288f33f8d03e94ae17" + "2.3.2": + url: "https://github.com/h4tr3d/avcpp/archive/refs/tags/v2.3.2.tar.gz" + sha256: "ce1a7296e6b1bf808ad4f9f486723c88e4cd12d80a96e226635ce3316ca73733" + "2.3.0": + url: "https://github.com/h4tr3d/avcpp/archive/refs/tags/v2.3.0.tar.gz" + sha256: "8ecb98caa9640a21772562c326f7c1f6ad99cd7f15d7ea40fe37d114fabbe2b5" "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" + "2.4.0": + - patch_file: "patches/2.3.0-fix-ffmpeg.patch" + patch_description: "fix ffmpeg package name and remove ffmpeg from install targets" + patch_type: "conan" + "2.3.2": + - patch_file: "patches/2.3.0-fix-ffmpeg.patch" patch_description: "fix ffmpeg package name and remove ffmpeg from install targets" patch_type: "conan" - "cci.20220301": - - patch_file: "patches/cci.20220301-fix-ffmpeg.patch" + "2.3.0": + - patch_file: "patches/2.3.0-fix-ffmpeg.patch" + patch_description: "fix ffmpeg package name and remove ffmpeg from install targets" + patch_type: "conan" + "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" diff --git a/recipes/avcpp/all/conanfile.py b/recipes/avcpp/all/conanfile.py index 7585987f38a75..dfef33000726b 100644 --- a/recipes/avcpp/all/conanfile.py +++ b/recipes/avcpp/all/conanfile.py @@ -1,13 +1,13 @@ 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 +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.52.0" +required_conan_version = ">=1.53.0" + class AvcppConan(ConanFile): name = "avcpp" @@ -16,6 +16,7 @@ class AvcppConan(ConanFile): 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], @@ -27,8 +28,8 @@ class AvcppConan(ConanFile): } @property - def _minimum_cpp_standard(self): - return 17 + def _min_cppstd(self): + return "17" @property def _compilers_minimum_version(self): @@ -36,6 +37,8 @@ def _compilers_minimum_version(self): "gcc": "8", "clang": "7", "apple-clang": "12.0", + "Visual Studio": "15", + "msvc": "191", } def export_sources(self): @@ -47,27 +50,30 @@ 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, 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." - ) + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("ffmpeg/5.0") + self.requires("ffmpeg/6.1", transitive_headers=True) + + 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 build_requirements(self): + if Version(self.version) >= "2.2.0": + self.tool_requires("cmake/[>=3.19 <4]") 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/avcpp/all/patches/2.3.0-fix-ffmpeg.patch b/recipes/avcpp/all/patches/2.3.0-fix-ffmpeg.patch new file mode 100644 index 0000000000000..e316cd9d624ba --- /dev/null +++ b/recipes/avcpp/all/patches/2.3.0-fix-ffmpeg.patch @@ -0,0 +1,46 @@ +diff --git CMakeLists.txt CMakeLists.txt +index b086352..91d3165 100644 +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -9,8 +9,6 @@ endif() + + project(AvCpp LANGUAGES CXX VERSION ${AVCPP_VERSION}) + +-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)") +@@ -31,8 +29,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 src/CMakeLists.txt src/CMakeLists.txt +index 3c00150..c3818cf 100644 +--- src/CMakeLists.txt ++++ src/CMakeLists.txt +@@ -29,7 +29,7 @@ foreach(TARGET ${AV_TARGETS}) + + target_compile_options(${TARGET} PRIVATE ${AVCPP_WARNING_OPTIONS}) + target_compile_definitions(${TARGET} PUBLIC __STDC_CONSTANT_MACROS) +- 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 + $ +@@ -58,7 +58,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/cci.20220301-fix-ffmpeg.patch b/recipes/avcpp/all/patches/cci.20220301-fix-ffmpeg.patch deleted file mode 100644 index 3207ead4b4610..0000000000000 --- a/recipes/avcpp/all/patches/cci.20220301-fix-ffmpeg.patch +++ /dev/null @@ -1,46 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index a5fed05..d077b96 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -6,7 +6,7 @@ endif() - - project(AvCpp LANGUAGES CXX VERSION 2.0.99) - --set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH}) -+# 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)") -@@ -28,8 +28,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 80c6faa..262c16c 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/test_v1_package/CMakeLists.txt b/recipes/avcpp/all/test_v1_package/CMakeLists.txt index 053bba6e952b4..0d20897301b68 100644 --- a/recipes/avcpp/all/test_v1_package/CMakeLists.txt +++ b/recipes/avcpp/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(avcpp REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -if (TARGET avcpp::avcpp) - target_link_libraries(${PROJECT_NAME} PRIVATE avcpp::avcpp) -else() - target_link_libraries(${PROJECT_NAME} PRIVATE avcpp::avcpp-static) -endif() -target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_17) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/avcpp/config.yml b/recipes/avcpp/config.yml index deb0eb011c7ea..ceaa4af535269 100644 --- a/recipes/avcpp/config.yml +++ b/recipes/avcpp/config.yml @@ -1,5 +1,9 @@ versions: - "2.1.0": + "2.4.0": + folder: all + "2.3.2": folder: all - "cci.20220301": + "2.3.0": + folder: all + "2.1.0": folder: all diff --git a/recipes/avir/all/conanfile.py b/recipes/avir/all/conanfile.py index 61093399842d4..d6b7ebc73045e 100644 --- a/recipes/avir/all/conanfile.py +++ b/recipes/avir/all/conanfile.py @@ -8,23 +8,24 @@ class AVIRConan(ConanFile): name = "avir" + description = "High-quality pro image resizing / scaling C++ library, image resize" license = "MIT" url = "https://github.com/conan-io/conan-center-index" - description = "High-quality pro image resizing / scaling C++ library, image resize" - topics = ("image-processing", "image-resizer", "lanczos", ) homepage = "https://github.com/avaneev/avir" + topics = ("image-processing", "image-resizer", "lanczos", "header-only") + + package_type = "header-library" 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 diff --git a/recipes/avir/all/test_package/CMakeLists.txt b/recipes/avir/all/test_package/CMakeLists.txt index 51fd0e87ec014..b82b306c393cb 100644 --- a/recipes/avir/all/test_package/CMakeLists.txt +++ b/recipes/avir/all/test_package/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package LANGUAGES CXX) find_package(avir CONFIG REQUIRED) diff --git a/recipes/avir/all/test_v1_package/CMakeLists.txt b/recipes/avir/all/test_v1_package/CMakeLists.txt index b53aff65d290e..91630d79f4abb 100644 --- a/recipes/avir/all/test_v1_package/CMakeLists.txt +++ b/recipes/avir/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.15) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(avir CONFIG REQUIRED) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE avir::avir) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/aws-c-auth/all/conandata.yml b/recipes/aws-c-auth/all/conandata.yml index 3f6bee7b4b086..be2876a831b62 100644 --- a/recipes/aws-c-auth/all/conandata.yml +++ b/recipes/aws-c-auth/all/conandata.yml @@ -1,16 +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" - "0.6.8": - url: "https://github.com/awslabs/aws-c-auth/archive/v0.6.8.tar.gz" - sha256: "48b1c0008265ea8e7d7b653b34640ce8111e00d6e0e3f4855f3fba71e1ac5704" + "0.7.16": + url: "https://github.com/awslabs/aws-c-auth/archive/v0.7.16.tar.gz" + sha256: "7ee5afe05482f750dd0406b8b5b55dafb446fc21288f98c0b4118d62795003ba" "0.6.4": url: "https://github.com/awslabs/aws-c-auth/archive/v0.6.4.tar.gz" sha256: "119cec67e85b01af8c01b11d962c610d8e9b183cde96fee77db669cccaa19ac9" - "0.6.0": - url: "https://github.com/awslabs/aws-c-auth/archive/v0.6.0.tar.gz" - sha256: "5f5fff63110c3e8f619385ca563f77886bc101d3e054987eecbb87586e27b651" diff --git a/recipes/aws-c-auth/all/conanfile.py b/recipes/aws-c-auth/all/conanfile.py index 98d3c8c463737..924a52fe64d4d 100644 --- a/recipes/aws-c-auth/all/conanfile.py +++ b/recipes/aws-c-auth/all/conanfile.py @@ -1,19 +1,25 @@ 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 +from conan.tools.files import get, copy, rmdir, save, export_conandata_patches, apply_conandata_patches +from conan.tools.scm import Version import os +import textwrap + +required_conan_version = ">=1.53.0" -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." - license = "Apache-2.0", + description = ( + "C99 library implementation of AWS client-side authentication: " + "standard credentials providers and signing." + ) + license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/awslabs/aws-c-auth" topics = ("aws", "amazon", "cloud", "authentication", "credentials", "providers", "signing") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -24,42 +30,37 @@ class AwsCAuth(ConanFile): "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: - 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 + 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("aws-c-common/0.8.2") - self.requires("aws-c-cal/0.5.13") - 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") + if self.version == "0.7.16": + self.requires("aws-c-common/0.9.15", transitive_headers=True, transitive_libs=True) + self.requires("aws-c-cal/0.6.14") + self.requires("aws-c-io/0.14.7", transitive_headers=True, transitive_libs=True) + self.requires("aws-c-http/0.8.1", transitive_headers=True) + self.requires("aws-c-sdkutils/0.1.15", transitive_headers=True) + if self.version == "0.6.4": + self.requires("aws-c-common/0.6.11", transitive_headers=True, transitive_libs=True) + self.requires("aws-c-cal/0.5.12") + self.requires("aws-c-io/0.10.9", transitive_headers=True, transitive_libs=True) + self.requires("aws-c-http/0.6.7", transitive_headers=True) 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) @@ -70,6 +71,7 @@ def generate(self): deps.generate() def build(self): + apply_conandata_patches(self) cmake = CMake(self) cmake.configure() cmake.build() @@ -80,26 +82,34 @@ def package(self): cmake.install() rmdir(self, os.path.join(self.package_folder, "lib", "aws-c-auth")) + # 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), + {"AWS::aws-c-auth": "aws-c-auth::aws-c-auth"} + ) + + 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", "aws-c-auth") self.cpp_info.set_property("cmake_target_name", "AWS::aws-c-auth") + self.cpp_info.libs = ["aws-c-auth"] + if self.options.shared: + self.cpp_info.defines.append("AWS_AUTH_USE_IMPORT_EXPORT") - 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") - - self.cpp_info.components["aws-c-auth-lib"].libs = ["aws-c-auth"] - self.cpp_info.components["aws-c-auth-lib"].requires = [ - "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", - ] - 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" + # 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/aws-c-auth/all/test_v1_package/CMakeLists.txt b/recipes/aws-c-auth/all/test_v1_package/CMakeLists.txt index 606180fec87bd..c23ed5cfe6d98 100644 --- a/recipes/aws-c-auth/all/test_v1_package/CMakeLists.txt +++ b/recipes/aws-c-auth/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,10 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_v1_package) + +enable_testing() 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) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/aws-c-auth/config.yml b/recipes/aws-c-auth/config.yml index 503ab418198f1..485e385b44014 100644 --- a/recipes/aws-c-auth/config.yml +++ b/recipes/aws-c-auth/config.yml @@ -1,11 +1,5 @@ versions: - "0.6.17": - folder: all - "0.6.11": - folder: all - "0.6.8": + "0.7.16": folder: all "0.6.4": folder: all - "0.6.0": - folder: all diff --git a/recipes/aws-c-cal/all/conandata.yml b/recipes/aws-c-cal/all/conandata.yml index e1b848e4dfa2d..e4a0abfc8c668 100644 --- a/recipes/aws-c-cal/all/conandata.yml +++ b/recipes/aws-c-cal/all/conandata.yml @@ -1,52 +1,14 @@ 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" - "0.5.13": - url: "https://github.com/awslabs/aws-c-cal/archive/v0.5.13.tar.gz" - sha256: "3aba3954877ea5271ce68361f3bd9c155b422b1149eed403874f6493285ca04d" + "0.6.14": + url: "https://github.com/awslabs/aws-c-cal/archive/v0.6.14.tar.gz" + sha256: "2326304b15bec45b212f6b738020c21afa41f9da295936687e103f9f2efb7b5e" "0.5.12": url: "https://github.com/awslabs/aws-c-cal/archive/v0.5.12.tar.gz" sha256: "350c29a288d5d498bd6574fca659cffc9453bf62691fbde5788399716c2bd132" - "0.5.11": - 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.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.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 3ed5c70f492e6..c0ea74e4902c8 100644 --- a/recipes/aws-c-cal/all/conanfile.py +++ b/recipes/aws-c-cal/all/conanfile.py @@ -1,11 +1,12 @@ 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, save from conan.tools.scm import Version import os +import textwrap -required_conan_version = ">=1.51.3" +required_conan_version = ">=1.53.0" class AwsCCal(ConanFile): @@ -14,7 +15,8 @@ class AwsCCal(ConanFile): topics = ("aws", "amazon", "cloud", "cal", "crypt", ) url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/awslabs/aws-c-cal" - license = "Apache-2.0", + license = "Apache-2.0" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -27,11 +29,10 @@ class AwsCCal(ConanFile): @property def _needs_openssl(self): - return self.settings.os != "Windows" and not is_apple_os(self) + return not (self.settings.os == "Windows" or is_apple_os(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": @@ -39,30 +40,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 requirements(self): - if Version(self.version) <= "0.5.11": - self.requires("aws-c-common/0.6.11") - else: - self.requires("aws-c-common/0.8.2") + if self.version == "0.6.14": + self.requires("aws-c-common/0.9.15", transitive_headers=True, transitive_libs=True) + if self.version == "0.5.12": + self.requires("aws-c-common/0.6.11", transitive_headers=True, transitive_libs=True) if self._needs_openssl: - self.requires("openssl/1.1.1s") + self.requires("openssl/[>=1.1 <4]") 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,30 +78,43 @@ def package(self): cmake.install() rmdir(self, os.path.join(self.package_folder, "lib", "aws-c-cal")) + # 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), + {"AWS::aws-c-cal": "aws-c-cal::aws-c-cal"} + ) + + 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", "aws-c-cal") self.cpp_info.set_property("cmake_target_name", "AWS::aws-c-cal") - - self.cpp_info.filenames["cmake_find_package"] = "aws-c-cal" - self.cpp_info.filenames["cmake_find_package_multi"] = "aws-c-cal" - self.cpp_info.names["cmake_find_package"] = "AWS" - self.cpp_info.names["cmake_find_package_multi"] = "AWS" - self.cpp_info.components["aws-c-cal-lib"].names["cmake_find_package"] = "aws-c-cal" - self.cpp_info.components["aws-c-cal-lib"].names["cmake_find_package_multi"] = "aws-c-cal" - self.cpp_info.components["aws-c-cal-lib"].set_property("cmake_target_name", "AWS::aws-c-cal") - - self.cpp_info.components["aws-c-cal-lib"].libs = ["aws-c-cal"] - self.cpp_info.components["aws-c-cal-lib"].requires = ["aws-c-common::aws-c-common-lib"] + self.cpp_info.libs = ["aws-c-cal"] + self.cpp_info.requires = ["aws-c-common::aws-c-common"] + if self.options.shared: + self.cpp_info.defines.append("AWS_CAL_USE_IMPORT_EXPORT") if self.settings.os == "Windows": - self.cpp_info.components["aws-c-cal-lib"].system_libs.append("ncrypt") + self.cpp_info.system_libs.append("ncrypt") elif is_apple_os(self): - self.cpp_info.components["aws-c-cal-lib"].frameworks.extend(["CoreFoundation", "Security"]) + self.cpp_info.frameworks.extend(["CoreFoundation", "Security"]) elif self.settings.os in ("FreeBSD", "Linux"): - self.cpp_info.components["aws-c-cal-lib"].system_libs.append("dl") + self.cpp_info.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") + self.cpp_info.requires.append("openssl::crypto") 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. @@ -124,5 +131,9 @@ def package_info(self): "HMAC_CTX_init", "HMAC_CTX_cleanup", "HMAC_CTX_reset", ]) crypto_link_flags = "-Wl," + ",".join(f"-u{symbol}" for symbol in crypto_symbols) - self.cpp_info.components["aws-c-cal-lib"].exelinkflags.append(crypto_link_flags) - self.cpp_info.components["aws-c-cal-lib"].sharedlinkflags.append(crypto_link_flags) + self.cpp_info.exelinkflags.append(crypto_link_flags) + self.cpp_info.sharedlinkflags.append(crypto_link_flags) + + # 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/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 deleted file mode 100644 index 422624b80de7e..0000000000000 --- a/recipes/aws-c-cal/all/patches/0002-apple-corefoundation-0.5.13.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- 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 7ed07f4d9b8e6..a98182dc5ef67 100644 --- a/recipes/aws-c-cal/all/test_package/CMakeLists.txt +++ b/recipes/aws-c-cal/all/test_package/CMakeLists.txt @@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.1) project(test_package LANGUAGES C) find_package(aws-c-cal REQUIRED CONFIG) +find_package(aws-c-common REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-c-cal) +target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-c-cal AWS::aws-c-common) diff --git a/recipes/aws-c-cal/all/test_package/conanfile.py b/recipes/aws-c-cal/all/test_package/conanfile.py index 1b3c18ef08ac1..fb5c5c0c1d8f0 100644 --- a/recipes/aws-c-cal/all/test_package/conanfile.py +++ b/recipes/aws-c-cal/all/test_package/conanfile.py @@ -1,4 +1,5 @@ from conan import ConanFile +from conan.tools.apple import is_apple_os from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -10,6 +11,10 @@ class TestPackageConan(ConanFile): generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" test_type = "explicit" + @property + def _needs_openssl(self): + return not (self.settings.os == "Windows" or is_apple_os(self)) + def layout(self): cmake_layout(self) @@ -25,7 +30,7 @@ def test(self): if can_run(self): stream = io.StringIO() bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") - self.run(bin_path, env="conanrun", output=stream) + self.run(bin_path, stream, env="conanrun") self.output.info(stream.getvalue()) - if self.deps_user_info["aws-c-cal"].with_openssl == "True": + if self._needs_openssl: 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 index 8a88842ed46e6..0d20897301b68 100644 --- a/recipes/aws-c-cal/all/test_v1_package/CMakeLists.txt +++ b/recipes/aws-c-cal/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-cal REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-c-cal) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/aws-c-cal/all/test_v1_package/conanfile.py b/recipes/aws-c-cal/all/test_v1_package/conanfile.py index ff0f4e1acbd6f..e27da49632915 100644 --- a/recipes/aws-c-cal/all/test_v1_package/conanfile.py +++ b/recipes/aws-c-cal/all/test_v1_package/conanfile.py @@ -1,4 +1,5 @@ from conans import ConanFile, CMake, tools +from conan.tools.apple import is_apple_os import os import io @@ -7,6 +8,10 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "cmake", "cmake_find_package_multi" + @property + def _needs_openssl(self): + return not (self.settings.os == "Windows" or is_apple_os(self)) + def build(self): cmake = CMake(self) cmake.configure() @@ -16,7 +21,7 @@ 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.run(bin_path, stream, run_environment=True) self.output.info(stream.getvalue()) - if self.deps_user_info["aws-c-cal"].with_openssl == "True": + if self._needs_openssl: assert "found static libcrypto" in stream.getvalue() diff --git a/recipes/aws-c-cal/config.yml b/recipes/aws-c-cal/config.yml index f969df4acc583..05b13d1c5771c 100644 --- a/recipes/aws-c-cal/config.yml +++ b/recipes/aws-c-cal/config.yml @@ -1,13 +1,5 @@ versions: - "0.5.20": - folder: all - "0.5.19": - folder: all - "0.5.17": - folder: all - "0.5.13": + "0.6.14": folder: all "0.5.12": folder: all - "0.5.11": - folder: all diff --git a/recipes/aws-c-common/all/conandata.yml b/recipes/aws-c-common/all/conandata.yml index 773702bbe2c98..615dbce394f02 100644 --- a/recipes/aws-c-common/all/conandata.yml +++ b/recipes/aws-c-common/all/conandata.yml @@ -1,56 +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" - "0.7.4": - url: "https://github.com/awslabs/aws-c-common/archive/v0.7.4.tar.gz" - sha256: "e9462a141b5db30006704f537d19b92357a59be38d590272e6118976b0356ccd" - "0.7.3": - url: "https://github.com/awslabs/aws-c-common/archive/v0.7.3.tar.gz" - sha256: "e4b80d368668814d9b76989fd2e3cd0fcf0be160bbb8bfeedf1f652e27f9c08c" - "0.7.2": - url: "https://github.com/awslabs/aws-c-common/archive/v0.7.2.tar.gz" - sha256: "455aed7447ed58eb7d5d3e8c952ed59f77c71dfed4115883e900f36d95f06dab" - "0.7.1": - url: "https://github.com/awslabs/aws-c-common/archive/v0.7.1.tar.gz" - sha256: "75c444a337e446e82d4f71c127118981656234b25cbdfd5913b8de713354fb43" - "0.7.0": - url: "https://github.com/awslabs/aws-c-common/archive/v0.7.0.tar.gz" - sha256: "a4e94d2c1d045a27467c9dfae51382f851a5223c3a0ecc15a96d1dba94f85ad6" - "0.6.20": - url: "https://github.com/awslabs/aws-c-common/archive/v0.6.20.tar.gz" - sha256: "6eb0b806c78b36a32eec9bcba8d2833e3973491a29d46fe3d11edc3f8d3e7f73" - "0.6.19": - url: "https://github.com/awslabs/aws-c-common/archive/v0.6.19.tar.gz" - sha256: "91cb2b809687be19fce8d6ca03ddc00c78723854ead30dcb58bdc4172cb1796c" - "0.6.17": - url: "https://github.com/awslabs/aws-c-common/archive/v0.6.17.tar.gz" - sha256: "441156ecfabb84e41601d7173a7f88267f099899f0ae6091c3b745d9e02211f6" - "0.6.15": - url: "https://github.com/awslabs/aws-c-common/archive/v0.6.15.tar.gz" - sha256: "eb3ead3fb7a1f09c046393f776a96a0f50ae5f38c70d462273084280383669f1" - "0.6.14": - url: "https://github.com/awslabs/aws-c-common/archive/v0.6.14.tar.gz" - sha256: "1691c9dad5a0d236c2a0e351cc972231b176947e454c61d1c4b3ea4ab42f32e7" + "0.9.15": + url: "https://github.com/awslabs/aws-c-common/archive/v0.9.15.tar.gz" + sha256: "8f36c7a6a5d2e17365759d15591f800d3e76dcaa34a226389b92647cbd92393a" "0.6.11": url: "https://github.com/awslabs/aws-c-common/archive/v0.6.11.tar.gz" sha256: "86159bd1128eee2813f705c275d319e14d1b77017fab46f6ca5dafcc66edaea9" - "0.6.9": - url: "https://github.com/awslabs/aws-c-common/archive/v0.6.9.tar.gz" - sha256: "928a3e36f24d1ee46f9eec360ec5cebfe8b9b8994fe39d4fa74ff51aebb12717" - "0.6.8": - url: "https://github.com/awslabs/aws-c-common/archive/v0.6.8.tar.gz" - sha256: "2997e851ed690a614507a43f4c393f45a198614d94da1660ecdf9b5a729535fc" - "0.6.7": - url: "https://github.com/awslabs/aws-c-common/archive/v0.6.7.tar.gz" - sha256: "643b35c62f948367f484f3a436bc37b5799538f47b08aa72deb3818b8bcdc631" - "0.4.25": - url: "https://github.com/awslabs/aws-c-common/archive/v0.4.25.tar.gz" - sha256: "f85a8f74e42bd983a4615654457f8037876bc6b8dbf890e368bb516cbc2e9844" -patches: - "0.4.25": - - patch_file: "patches/0001-disable-fPIC.patch" - - patch_file: "patches/0002-no-warnings-as-errors.patch" diff --git a/recipes/aws-c-common/all/conanfile.py b/recipes/aws-c-common/all/conanfile.py index 53aa924766140..f3f589547f059 100644 --- a/recipes/aws-c-common/all/conanfile.py +++ b/recipes/aws-c-common/all/conanfile.py @@ -2,12 +2,13 @@ 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, 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.51.3" +required_conan_version = ">=1.53.0" class AwsCCommon(ConanFile): @@ -19,8 +20,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,44 +36,33 @@ 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": del self.options.fPIC - if Version(self.version) < "0.6.11": - del self.options.cpu_extensions 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) tc.variables["BUILD_TESTING"] = False tc.variables["AWS_ENABLE_LTO"] = False - if Version(self.version) >= "0.6.0": - tc.variables["AWS_WARNINGS_ARE_ERRORS"] = False + tc.variables["AWS_WARNINGS_ARE_ERRORS"] = False if is_msvc(self): tc.variables["STATIC_CRT"] = is_msvc_static_runtime(self) tc.variables["USE_CPU_EXTENSIONS"] = self.options.get_safe("cpu_extensions", False) @@ -89,26 +80,44 @@ def package(self): cmake.install() rmdir(self, os.path.join(self.package_folder, "lib", "aws-c-common")) + # 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), + {"AWS::aws-c-common": "aws-c-common::aws-c-common"} + ) + + 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", "aws-c-common") self.cpp_info.set_property("cmake_target_name", "AWS::aws-c-common") - - self.cpp_info.filenames["cmake_find_package"] = "aws-c-common" - self.cpp_info.filenames["cmake_find_package_multi"] = "aws-c-common" - self.cpp_info.names["cmake_find_package"] = "AWS" - self.cpp_info.names["cmake_find_package_multi"] = "AWS" - self.cpp_info.components["aws-c-common-lib"].set_property("cmake_target_name", "AWS::aws-c-common") - self.cpp_info.components["aws-c-common-lib"].names["cmake_find_package"] = "aws-c-common" - self.cpp_info.components["aws-c-common-lib"].names["cmake_find_package_multi"] = "aws-c-common" - - self.cpp_info.components["aws-c-common-lib"].libs = ["aws-c-common"] + self.cpp_info.libs = ["aws-c-common"] + if self.options.shared: + self.cpp_info.defines.append("AWS_COMMON_USE_IMPORT_EXPORT") if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.components["aws-c-common-lib"].system_libs = ["dl", "m", "pthread", "rt"] + self.cpp_info.system_libs = ["dl", "m", "pthread", "rt"] elif self.settings.os == "Windows": - self.cpp_info.components["aws-c-common-lib"].system_libs = ["bcrypt", "ws2_32"] + self.cpp_info.system_libs = ["bcrypt", "ws2_32"] if Version(self.version) >= "0.6.13": - self.cpp_info.components["aws-c-common-lib"].system_libs.append("shlwapi") + self.cpp_info.system_libs.append("shlwapi") if not self.options.shared: if is_apple_os(self): - self.cpp_info.components["aws-c-common-lib"].frameworks = ["CoreFoundation"] - self.cpp_info.components["aws-c-common-lib"].builddirs.append(os.path.join("lib", "cmake")) + self.cpp_info.frameworks = ["CoreFoundation"] + 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.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/aws-c-common/all/patches/0001-disable-fPIC.patch b/recipes/aws-c-common/all/patches/0001-disable-fPIC.patch deleted file mode 100644 index 1c3c5cada4202..0000000000000 --- a/recipes/aws-c-common/all/patches/0001-disable-fPIC.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- cmake/AwsCFlags.cmake -+++ cmake/AwsCFlags.cmake -@@ -62,8 +62,8 @@ - # Warning disables always go last to avoid future flags re-enabling them - list(APPEND AWS_C_FLAGS -Wno-long-long) - -- # Always enable position independent code, since this code will always end up in a shared lib -- list(APPEND AWS_C_FLAGS -fPIC) -+ # Don't always set fPIC as conan will handle position independent code. -+ # list(APPEND AWS_C_FLAGS -fPIC) - - if (LEGACY_COMPILER_SUPPORT) - list(APPEND AWS_C_FLAGS -Wno-strict-aliasing) diff --git a/recipes/aws-c-common/all/patches/0002-no-warnings-as-errors.patch b/recipes/aws-c-common/all/patches/0002-no-warnings-as-errors.patch deleted file mode 100644 index 8abe45bd0a3d6..0000000000000 --- a/recipes/aws-c-common/all/patches/0002-no-warnings-as-errors.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/cmake/AwsCFlags.cmake -+++ b/cmake/AwsCFlags.cmake -@@ -34,7 +34,7 @@ function(aws_set_common_properties target) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" PARENT_SCOPE) - endif() - -- list(APPEND AWS_C_FLAGS /W4 /WX /MP) -+ list(APPEND AWS_C_FLAGS /W4 /MP) - # /volatile:iso relaxes some implicit memory barriers that MSVC normally applies for volatile accesses - # Since we want to be compatible with user builds using /volatile:iso, use it for the tests. - list(APPEND AWS_C_FLAGS /volatile:iso) -@@ -49,7 +49,7 @@ function(aws_set_common_properties target) - list(APPEND AWS_C_FLAGS "${_FLAGS}") - - else() -- list(APPEND AWS_C_FLAGS -Wall -Werror -Wstrict-prototypes) -+ list(APPEND AWS_C_FLAGS -Wall -Wstrict-prototypes) - - if(NOT SET_PROPERTIES_NO_WEXTRA) - list(APPEND AWS_C_FLAGS -Wextra) 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 deleted file mode 100644 index 089f7544e3394..0000000000000 --- a/recipes/aws-c-common/all/test_v1_package/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -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-common REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-c-common) diff --git a/recipes/aws-c-common/config.yml b/recipes/aws-c-common/config.yml index 5a8e794412c2f..e7b9215f4c431 100644 --- a/recipes/aws-c-common/config.yml +++ b/recipes/aws-c-common/config.yml @@ -1,35 +1,5 @@ versions: - "0.8.2": - folder: all - "0.7.5": - folder: all - "0.7.4": - folder: all - "0.7.3": - folder: all - "0.7.2": - folder: all - "0.7.1": - folder: all - "0.7.0": - folder: all - "0.6.20": - folder: all - "0.6.19": - folder: all - "0.6.17": - folder: all - "0.6.15": - folder: all - "0.6.14": + "0.9.15": folder: all "0.6.11": folder: all - "0.6.9": - folder: all - "0.6.8": - folder: all - "0.6.7": - folder: all - "0.4.25": - folder: all diff --git a/recipes/aws-c-compression/all/conandata.yml b/recipes/aws-c-compression/all/conandata.yml index 1baf0be5b106a..1bbf0a0f551fb 100644 --- a/recipes/aws-c-compression/all/conandata.yml +++ b/recipes/aws-c-compression/all/conandata.yml @@ -1,10 +1,7 @@ sources: - "0.2.15": - url: "https://github.com/awslabs/aws-c-compression/archive/v0.2.15.tar.gz" - sha256: "11d58a229e2961b2b36493155a981dea2c8a0bc0d113b0073deb8c3189cfa04e" + "0.2.18": + url: "https://github.com/awslabs/aws-c-compression/archive/v0.2.18.tar.gz" + sha256: "517c361f3b7fffca08efd5ad251a20489794f056eab0dfffacc6d5b341df8e86" "0.2.14": url: "https://github.com/awslabs/aws-c-compression/archive/v0.2.14.tar.gz" sha256: "8737863ced57d92f5a0bdde554bf0fe70eaa76aae118fec09a6c361dfc55d0d5" - "0.2.13": - url: "https://github.com/awslabs/aws-c-compression/archive/v0.2.13.tar.gz" - sha256: "6b6ebb223408b48a8b2c74ba7042ff61e5333dc900acd67c40ca1cd4b382c137" diff --git a/recipes/aws-c-compression/all/conanfile.py b/recipes/aws-c-compression/all/conanfile.py index 635a3e71fc9b4..eda11edf4e93e 100644 --- a/recipes/aws-c-compression/all/conanfile.py +++ b/recipes/aws-c-compression/all/conanfile.py @@ -1,9 +1,11 @@ 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.files import copy, get, rmdir, save +from conan.tools.scm import Version import os +import textwrap -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.53.0" class AwsCCompression(ConanFile): @@ -12,8 +14,8 @@ class AwsCCompression(ConanFile): topics = ("aws", "amazon", "cloud", "compression", "huffman", ) url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/awslabs/aws-c-compression" - license = "Apache-2.0", - + license = "Apache-2.0" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -30,28 +32,21 @@ def config_options(self): 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 + 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("aws-c-common/0.8.2") + if self.version == "0.2.18": + self.requires("aws-c-common/0.9.15", transitive_headers=True, transitive_libs=True) + if self.version == "0.2.14": + self.requires("aws-c-common/0.6.11", transitive_headers=True, transitive_libs=True) 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) @@ -71,18 +66,34 @@ def package(self): cmake.install() rmdir(self, os.path.join(self.package_folder, "lib", "aws-c-compression")) + # 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), + {"AWS::aws-c-compression": "aws-c-compression::aws-c-compression"} + ) + + 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", "aws-c-compression") self.cpp_info.set_property("cmake_target_name", "AWS::aws-c-compression") - # TODO: back to global scope in conan v2 once cmake_find_package* generators removed - self.cpp_info.components["aws-c-compression-lib"].libs = ["aws-c-compression"] + self.cpp_info.libs = ["aws-c-compression"] + if self.options.shared: + self.cpp_info.defines.append("AWS_COMPRESSION_USE_IMPORT_EXPORT") # TODO: to remove in conan v2 once cmake_find_package* generators removed - self.cpp_info.filenames["cmake_find_package"] = "aws-c-compression" - self.cpp_info.filenames["cmake_find_package_multi"] = "aws-c-compression" - self.cpp_info.names["cmake_find_package"] = "AWS" - self.cpp_info.names["cmake_find_package_multi"] = "AWS" - self.cpp_info.components["aws-c-compression-lib"].names["cmake_find_package"] = "aws-c-compression" - self.cpp_info.components["aws-c-compression-lib"].names["cmake_find_package_multi"] = "aws-c-compression" - self.cpp_info.components["aws-c-compression-lib"].set_property("cmake_target_name", "AWS::aws-c-compression") - self.cpp_info.components["aws-c-compression-lib"].requires = ["aws-c-common::aws-c-common-lib"] + 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/aws-c-compression/all/test_v1_package/CMakeLists.txt b/recipes/aws-c-compression/all/test_v1_package/CMakeLists.txt index e3ad5964d2a88..0d20897301b68 100644 --- a/recipes/aws-c-compression/all/test_v1_package/CMakeLists.txt +++ b/recipes/aws-c-compression/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-compression REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-c-compression) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/aws-c-compression/config.yml b/recipes/aws-c-compression/config.yml index 5a381bb0e6674..ddebab3901e18 100644 --- a/recipes/aws-c-compression/config.yml +++ b/recipes/aws-c-compression/config.yml @@ -1,7 +1,5 @@ versions: - "0.2.15": + "0.2.18": folder: all "0.2.14": folder: all - "0.2.13": - folder: all diff --git a/recipes/aws-c-event-stream/all/conandata.yml b/recipes/aws-c-event-stream/all/conandata.yml index 61428e916296b..63e6c5f58778f 100644 --- a/recipes/aws-c-event-stream/all/conandata.yml +++ b/recipes/aws-c-event-stream/all/conandata.yml @@ -1,20 +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" - "0.2.11": - url: "https://github.com/awslabs/aws-c-event-stream/archive/v0.2.11.tar.gz" - sha256: "4818b8d3fe02016fcfdd033c1e9d8f6be07ccaeb38664fe8c31c0fd153ea56e6" + "0.4.2": + url: "https://github.com/awslabs/aws-c-event-stream/archive/v0.4.2.tar.gz" + sha256: "c98b8fa05c2ca10aacfce7327b92a84669c2da95ccb8e7d7b3e3285fcec8beee" "0.2.7": url: "https://github.com/awslabs/aws-c-event-stream/archive/v0.2.7.tar.gz" sha256: "bb5c94cdff70c1985fb0b5f30d81756cedb5a3c3075d37f7e1e2b34e2a33c8c0" - "0.1.5": - url: "https://github.com/awslabs/aws-c-event-stream/archive/v0.1.5.tar.gz" - sha256: "f1b423a487b5d6dca118bfc0d0c6cc596dc476b282258a3228e73a8f730422d4" -patches: - "0.1.5": - - 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 25bb2fd989f0a..7fc076d11b4af 100644 --- a/recipes/aws-c-event-stream/all/conanfile.py +++ b/recipes/aws-c-event-stream/all/conanfile.py @@ -1,18 +1,21 @@ 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 +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir, save +from conan.tools.scm import Version import os +import textwrap + +required_conan_version = ">=1.53.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" - license = "Apache-2.0", + license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/awslabs/aws-c-event-stream" topics = ("aws", "eventstream", "content", ) + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -32,34 +35,25 @@ def config_options(self): 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 + 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("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") + if self.version == "0.4.2": + self.requires("aws-c-common/0.9.15", transitive_headers=True, transitive_libs=True) + self.requires("aws-checksums/0.1.18") + self.requires("aws-c-io/0.14.7") + if self.version == "0.2.7": + self.requires("aws-c-common/0.6.11", transitive_headers=True, transitive_libs=True) + self.requires("aws-checksums/0.1.12") + self.requires("aws-c-io/0.10.9") 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) @@ -80,21 +74,36 @@ 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", "aws-c-event-stream")) + # 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), + {"AWS::aws-c-event-stream": "aws-c-event-stream::aws-c-event-stream"} + ) + + 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", "aws-c-event-stream") self.cpp_info.set_property("cmake_target_name", "AWS::aws-c-event-stream") - 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 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" + self.cpp_info.libs = ["aws-c-event-stream"] + if self.options.shared: + self.cpp_info.defines.append("AWS_EVENT_STREAM_USE_IMPORT_EXPORT") + + # 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/aws-c-event-stream/all/patches/0001-disable-tests-bin.patch b/recipes/aws-c-event-stream/all/patches/0001-disable-tests-bin.patch deleted file mode 100644 index 21eae44486c93..0000000000000 --- a/recipes/aws-c-event-stream/all/patches/0001-disable-tests-bin.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -112,14 +112,18 @@ - install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}-config.cmake" - DESTINATION "${LIBRARY_DIRECTORY}/${CMAKE_PROJECT_NAME}/cmake/" - COMPONENT Development) - - --include(CTest) --enable_testing() --add_subdirectory(tests) -+if(BUILD_TESTING) -+ include(CTest) -+ enable_testing() -+ add_subdirectory(tests) -+endif() - - if(NOT MSVC) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) - endif() - --add_subdirectory(bin) -+if(BUILD_BINARIES) -+ add_subdirectory(bin) -+endif() diff --git a/recipes/aws-c-event-stream/all/patches/0002-use-PROJECT_SOURCE_DIR.patch b/recipes/aws-c-event-stream/all/patches/0002-use-PROJECT_SOURCE_DIR.patch deleted file mode 100644 index f2b60bb0f9a1d..0000000000000 --- a/recipes/aws-c-event-stream/all/patches/0002-use-PROJECT_SOURCE_DIR.patch +++ /dev/null @@ -1,61 +0,0 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -70,25 +70,25 @@ - ${AWS_EVENT_STREAM_SRC} - ) - --add_library(${CMAKE_PROJECT_NAME} ${EVENT_STREAM_SRC}) --aws_set_common_properties(${CMAKE_PROJECT_NAME}) --aws_add_sanitizers(${CMAKE_PROJECT_NAME}) --aws_prepare_symbol_visibility_args(${CMAKE_PROJECT_NAME} "AWS_EVENT_STREAM") -+add_library(${PROJECT_NAME} ${EVENT_STREAM_SRC}) -+aws_set_common_properties(${PROJECT_NAME}) -+aws_add_sanitizers(${PROJECT_NAME}) -+aws_prepare_symbol_visibility_args(${PROJECT_NAME} "AWS_EVENT_STREAM") - --target_include_directories(${CMAKE_PROJECT_NAME} PUBLIC -+target_include_directories(${PROJECT_NAME} PUBLIC - $ - $) - - --set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES VERSION 1.0.0) --set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES SOVERSION 0unstable) -+set_target_properties(${PROJECT_NAME} PROPERTIES VERSION 1.0.0) -+set_target_properties(${PROJECT_NAME} PROPERTIES SOVERSION 0unstable) - - find_package(aws-c-common REQUIRED) - find_package(aws-checksums REQUIRED) - --target_link_libraries(${CMAKE_PROJECT_NAME} PUBLIC AWS::aws-c-common AWS::aws-checksums) -+target_link_libraries(${PROJECT_NAME} PUBLIC AWS::aws-c-common AWS::aws-checksums) - --aws_prepare_shared_lib_exports(${CMAKE_PROJECT_NAME}) -+aws_prepare_shared_lib_exports(${PROJECT_NAME}) - - install(FILES ${AWS_EVENT_STREAM_HEADERS} - DESTINATION "include/aws/event-stream" -@@ -100,17 +100,17 @@ - set (TARGET_DIR "static") - endif() - --install(EXPORT "${CMAKE_PROJECT_NAME}-targets" -- DESTINATION "${LIBRARY_DIRECTORY}/${CMAKE_PROJECT_NAME}/cmake/${TARGET_DIR}/" -+install(EXPORT "${PROJECT_NAME}-targets" -+ DESTINATION "${LIBRARY_DIRECTORY}/${PROJECT_NAME}/cmake/${TARGET_DIR}/" - NAMESPACE AWS:: - COMPONENT Development) - --configure_file("cmake/${CMAKE_PROJECT_NAME}-config.cmake" -- "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}-config.cmake" -+configure_file("cmake/${PROJECT_NAME}-config.cmake" -+ "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake" - @ONLY) - --install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}-config.cmake" -- DESTINATION "${LIBRARY_DIRECTORY}/${CMAKE_PROJECT_NAME}/cmake/" -+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake" -+ DESTINATION "${LIBRARY_DIRECTORY}/${PROJECT_NAME}/cmake/" - COMPONENT Development) - - diff --git a/recipes/aws-c-event-stream/all/test_package/test_package.c b/recipes/aws-c-event-stream/all/test_package/test_package.c index 1b923438da34f..2cb953a451bf1 100644 --- a/recipes/aws-c-event-stream/all/test_package/test_package.c +++ b/recipes/aws-c-event-stream/all/test_package/test_package.c @@ -15,7 +15,7 @@ int main() { int res = aws_event_stream_message_init(&message, allocator, NULL, NULL); if (res != 0) { - fprintf(stderr, "Failed to init messag\n"); + fprintf(stderr, "Failed to init message\n"); } if (sizeof(expected_data) != aws_event_stream_message_total_length(&message)) { @@ -31,5 +31,7 @@ int main() { } } + aws_event_stream_message_clean_up(&message); + return EXIT_SUCCESS; } 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 index 674dc4a319004..0d20897301b68 100644 --- a/recipes/aws-c-event-stream/all/test_v1_package/CMakeLists.txt +++ b/recipes/aws-c-event-stream/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.8) - -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(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) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/aws-c-event-stream/config.yml b/recipes/aws-c-event-stream/config.yml index 96ac653286f12..015334b5552b6 100644 --- a/recipes/aws-c-event-stream/config.yml +++ b/recipes/aws-c-event-stream/config.yml @@ -1,11 +1,5 @@ versions: - "0.2.15": - folder: all - "0.2.12": - folder: all - "0.2.11": + "0.4.2": folder: all "0.2.7": folder: all - "0.1.5": - folder: all diff --git a/recipes/aws-c-http/all/conandata.yml b/recipes/aws-c-http/all/conandata.yml index 09a36b1a86c13..515176a226691 100644 --- a/recipes/aws-c-http/all/conandata.yml +++ b/recipes/aws-c-http/all/conandata.yml @@ -1,16 +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" - "0.6.10": - url: "https://github.com/awslabs/aws-c-http/archive/v0.6.10.tar.gz" - sha256: "4413faf2b8f6a83c898bb535cf83542fa548d7ecc1acf681dc79b7959a07231a" + "0.8.1": + url: "https://github.com/awslabs/aws-c-http/archive/v0.8.1.tar.gz" + sha256: "83fb47e2d7956469bb328f16dea96663e96f8f20dc60dc4e9676b82804588530" "0.6.7": url: "https://github.com/awslabs/aws-c-http/archive/v0.6.7.tar.gz" sha256: "2244d1e26ce5b5f40f96e570b1c4332a07c645ef744644d5b90b089d3695ec3b" - "0.6.5": - url: "https://github.com/awslabs/aws-c-http/archive/v0.6.5.tar.gz" - sha256: "9cb82f1cfe1342f4bbd58f51b74beaeb6a544fb6792c48f9b0d3967619b33221" diff --git a/recipes/aws-c-http/all/conanfile.py b/recipes/aws-c-http/all/conanfile.py index 5f4b5242c4dbe..2c2aed337ab03 100644 --- a/recipes/aws-c-http/all/conanfile.py +++ b/recipes/aws-c-http/all/conanfile.py @@ -1,18 +1,21 @@ 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 +from conan.tools.files import get, copy, rmdir, save +from conan.tools.scm import Version import os +import textwrap + +required_conan_version = ">=1.53.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" - license = "Apache-2.0", + license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/awslabs/aws-c-http" topics = ("aws", "amazon", "cloud", "http", "http2", ) + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -29,33 +32,26 @@ def config_options(self): 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 + 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("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") + if self.version == "0.8.1": + self.requires("aws-c-common/0.9.15", transitive_headers=True, transitive_libs=True) + self.requires("aws-c-compression/0.2.18") + self.requires("aws-c-cal/0.6.14") + self.requires("aws-c-io/0.14.7", transitive_headers=True, transitive_libs=True) + if self.version == "0.6.7": + self.requires("aws-c-common/0.6.11", transitive_headers=True, transitive_libs=True) + self.requires("aws-c-compression/0.2.14") + self.requires("aws-c-io/0.10.9", transitive_headers=True, transitive_libs=True) 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,21 +72,34 @@ def package(self): cmake.install() rmdir(self, os.path.join(self.package_folder, "lib", "aws-c-http")) + # 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), + {"AWS::aws-c-http": "aws-c-http::aws-c-http"} + ) + + 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", "aws-c-http") self.cpp_info.set_property("cmake_target_name", "AWS::aws-c-http") + self.cpp_info.libs = ["aws-c-http"] + if self.options.shared: + self.cpp_info.defines.append("AWS_HTTP_USE_IMPORT_EXPORT") - self.cpp_info.filenames["cmake_find_package"] = "aws-c-http" - self.cpp_info.filenames["cmake_find_package_multi"] = "aws-c-http" - self.cpp_info.names["cmake_find_package"] = "AWS" - self.cpp_info.names["cmake_find_package_multi"] = "AWS" - - self.cpp_info.components["aws-c-http-lib"].set_property("cmake_target_name", "AWS::aws-c-http") - self.cpp_info.components["aws-c-http-lib"].names["cmake_find_package"] = "aws-c-http" - self.cpp_info.components["aws-c-http-lib"].names["cmake_find_package_multi"] = "aws-c-http" - self.cpp_info.components["aws-c-http-lib"].libs = ["aws-c-http"] - self.cpp_info.components["aws-c-http-lib"].requires = [ - "aws-c-common::aws-c-common-lib", - "aws-c-compression::aws-c-compression-lib", - "aws-c-io::aws-c-io-lib" - ] + # 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/aws-c-http/all/test_v1_package/CMakeLists.txt b/recipes/aws-c-http/all/test_v1_package/CMakeLists.txt index b3195e120b0b2..0d20897301b68 100644 --- a/recipes/aws-c-http/all/test_v1_package/CMakeLists.txt +++ b/recipes/aws-c-http/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.1) - -project(test_package C) +project(test_package) 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) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/aws-c-http/config.yml b/recipes/aws-c-http/config.yml index ab4b9f0488086..b4cfbdf31c4fc 100644 --- a/recipes/aws-c-http/config.yml +++ b/recipes/aws-c-http/config.yml @@ -1,11 +1,5 @@ versions: - "0.6.22": - folder: all - "0.6.13": - folder: all - "0.6.10": + "0.8.1": folder: all "0.6.7": folder: all - "0.6.5": - folder: all diff --git a/recipes/aws-c-io/all/conandata.yml b/recipes/aws-c-io/all/conandata.yml index 4a9102a6ede26..60d48a7600965 100644 --- a/recipes/aws-c-io/all/conandata.yml +++ b/recipes/aws-c-io/all/conandata.yml @@ -1,19 +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" - "0.10.20": - url: "https://github.com/awslabs/aws-c-io/archive/v0.10.20.tar.gz" - sha256: "293248ef96166826370223865bff2537bea5e08f6913919884c53add8238ba97" - "0.10.13": - url: "https://github.com/awslabs/aws-c-io/archive/v0.10.13.tar.gz" - sha256: "ee34a93190e35a5c372ba73661dd69c48986e051a4b26dedb62bc5aa78f1660f" + "0.14.7": + url: "https://github.com/awslabs/aws-c-io/archive/v0.14.7.tar.gz" + sha256: "ecf1f660d7d43913aa8a416be6a2027101ce87c3b241344342d608335b4df7d4" "0.10.9": url: "https://github.com/awslabs/aws-c-io/archive/v0.10.9.tar.gz" sha256: "c64464152abe8b7e23f10bc026ed54a15eaf0ec0aae625d28e2caf4489090327" - "0.10.5": - url: "https://github.com/awslabs/aws-c-io/archive/v0.10.5.tar.gz" - sha256: "59abd4606661790cc0b777807938f3134cce77c03383015781498cfbfd191811" diff --git a/recipes/aws-c-io/all/conanfile.py b/recipes/aws-c-io/all/conanfile.py index 84b513c37e69f..3bc22662e6f6c 100644 --- a/recipes/aws-c-io/all/conanfile.py +++ b/recipes/aws-c-io/all/conanfile.py @@ -1,18 +1,20 @@ 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 +from conan.tools.files import get, copy, rmdir, save import os +import textwrap + +required_conan_version = ">=1.53.0" -required_conan_version = ">=1.52.0" class AwsCIO(ConanFile): name = "aws-c-io" description = "IO and TLS for application protocols" - license = "Apache-2.0", + license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/awslabs/aws-c-io" topics = ("aws", "amazon", "cloud", "io", "tls",) + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -29,38 +31,29 @@ def config_options(self): 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 + 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): - # 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 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.8.2") - self.requires("aws-c-cal/0.5.13") - - if self.settings.os in ["Linux", "FreeBSD", "Android"]: - self.requires("s2n/1.3.15") + # These versions come from aws-sdl-cpp prefetch_crt_dependency.sh file, + # dont bump them independently, check the file and update all the dependencies at once + if self.version == "0.14.7": + self.requires("aws-c-common/0.9.15", transitive_headers=True, transitive_libs=True) + self.requires("aws-c-cal/0.6.14") + if self.settings.os in ["Linux", "FreeBSD", "Android"]: + self.requires("s2n/1.4.16") # 1.4.11 not available, using next available version + if self.version == "0.10.9": + self.requires("aws-c-common/0.6.11", transitive_headers=True, transitive_libs=True) + self.requires("aws-c-cal/0.5.12") + if self.settings.os in ["Linux", "FreeBSD", "Android"]: + self.requires("s2n/1.3.15") 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) @@ -81,24 +74,38 @@ def package(self): cmake.install() rmdir(self, os.path.join(self.package_folder, "lib", "aws-c-io")) + # 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), + {"AWS::aws-c-io": "aws-c-io::aws-c-io"} + ) + + 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", "aws-c-io") self.cpp_info.set_property("cmake_target_name", "AWS::aws-c-io") - # TODO: back to global scope in conan v2 once cmake_find_package* generators removed - self.cpp_info.components["aws-c-io-lib"].libs = ["aws-c-io"] + self.cpp_info.libs = ["aws-c-io"] + if self.options.shared: + self.cpp_info.defines.append("AWS_IO_USE_IMPORT_EXPORT") if self.settings.os == "Macos": - self.cpp_info.components["aws-c-io-lib"].frameworks.append("Security") + self.cpp_info.frameworks.append("Security") if self.settings.os == "Windows": - self.cpp_info.components["aws-c-io-lib"].system_libs = ["crypt32", "secur32", "shlwapi"] + self.cpp_info.system_libs = ["crypt32", "secur32", "shlwapi"] # TODO: to remove in conan v2 once cmake_find_package* generators removed - self.cpp_info.filenames["cmake_find_package"] = "aws-c-io" - self.cpp_info.filenames["cmake_find_package_multi"] = "aws-c-io" - self.cpp_info.names["cmake_find_package"] = "AWS" - self.cpp_info.names["cmake_find_package_multi"] = "AWS" - self.cpp_info.components["aws-c-io-lib"].names["cmake_find_package"] = "aws-c-io" - self.cpp_info.components["aws-c-io-lib"].names["cmake_find_package_multi"] = "aws-c-io" - self.cpp_info.components["aws-c-io-lib"].set_property("cmake_target_name", "AWS::aws-c-io") - self.cpp_info.components["aws-c-io-lib"].requires = ["aws-c-cal::aws-c-cal-lib", "aws-c-common::aws-c-common-lib"] - if self.settings.os in ["Linux", "FreeBSD", "Android"]: - self.cpp_info.components["aws-c-io-lib"].requires.append("s2n::s2n-lib") + 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/aws-c-io/config.yml b/recipes/aws-c-io/config.yml index 6dca88e3f0554..659ff80091e7d 100644 --- a/recipes/aws-c-io/config.yml +++ b/recipes/aws-c-io/config.yml @@ -1,13 +1,5 @@ versions: - "0.13.4": - folder: all - "0.11.2": - folder: all - "0.10.20": - folder: all - "0.10.13": + "0.14.7": folder: all "0.10.9": folder: all - "0.10.5": - folder: all diff --git a/recipes/aws-c-mqtt/all/conandata.yml b/recipes/aws-c-mqtt/all/conandata.yml index 6240cf10ee0f5..d212e8cf3426a 100644 --- a/recipes/aws-c-mqtt/all/conandata.yml +++ b/recipes/aws-c-mqtt/all/conandata.yml @@ -1,13 +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" - "0.7.9": - url: "https://github.com/awslabs/aws-c-mqtt/archive/v0.7.9.tar.gz" - sha256: "8556ae7c2b30ebb4ccb61becb120a848ea33315f7cf85436ebe5f21b75ab09c4" - "0.7.6": - url: "https://github.com/awslabs/aws-c-mqtt/archive/v0.7.6.tar.gz" - sha256: "a02c0525f7ddcdc058cd9f507b2f3a8be0383fc946920ed32c9d780cc29703ac" + "0.10.3": + url: "https://github.com/awslabs/aws-c-mqtt/archive/v0.10.3.tar.gz" + sha256: "bb938d794b0757d669b5877526363dc6f6f0e43869ca19fc196ffd0f7a35f5b9" + "0.7.8": + url: "https://github.com/awslabs/aws-c-mqtt/archive/v0.7.8.tar.gz" + sha256: "bf5ed63706f3f1aed86a878462fac78e5f045dfc34567bfb86c38f8b9d9d51ef" diff --git a/recipes/aws-c-mqtt/all/conanfile.py b/recipes/aws-c-mqtt/all/conanfile.py index 4edb02ac94d9f..1405aeca68d5a 100644 --- a/recipes/aws-c-mqtt/all/conanfile.py +++ b/recipes/aws-c-mqtt/all/conanfile.py @@ -1,20 +1,22 @@ 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 +from conan.tools.files import get, copy, rmdir, save +from conan.tools.scm import Version import os +import textwrap -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.53.0" class AwsCMQTT(ConanFile): name = "aws-c-mqtt" description = "C99 implementation of the MQTT 3.1.1 specification." - license = "Apache-2.0", + license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/awslabs/aws-c-mqtt" topics = ("aws", "amazon", "cloud", "mqtt") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -31,34 +33,27 @@ def config_options(self): 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("aws-c-common/0.8.2") - self.requires("aws-c-cal/0.5.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") + 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.version == "0.10.3": + self.requires("aws-c-common/0.9.15", transitive_headers=True, transitive_libs=True) + self.requires("aws-c-cal/0.6.14") + self.requires("aws-c-io/0.14.7", transitive_headers=True) + self.requires("aws-c-http/0.8.1") + if self.version == "0.7.8": + self.requires("aws-c-common/0.6.11", transitive_headers=True, transitive_libs=True) + self.requires("aws-c-cal/0.5.12") + self.requires("aws-c-io/0.10.9", transitive_headers=True) + self.requires("aws-c-http/0.6.7") + 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) @@ -79,22 +74,34 @@ def package(self): cmake.install() rmdir(self, os.path.join(self.package_folder, "lib", "aws-c-mqtt")) + # 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), + {"AWS::aws-c-mqtt": "aws-c-mqtt::aws-c-mqtt"} + ) + + 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", "aws-c-mqtt") self.cpp_info.set_property("cmake_target_name", "AWS::aws-c-mqtt") + self.cpp_info.libs = ["aws-c-mqtt"] + if self.options.shared: + self.cpp_info.defines.append("AWS_MQTT_USE_IMPORT_EXPORT") - self.cpp_info.filenames["cmake_find_package"] = "aws-c-mqtt" - self.cpp_info.filenames["cmake_find_package_multi"] = "aws-c-mqtt" - self.cpp_info.names["cmake_find_package"] = "AWS" - self.cpp_info.names["cmake_find_package_multi"] = "AWS" - self.cpp_info.components["aws-c-mqtt-lib"].names["cmake_find_package"] = "aws-c-mqtt" - self.cpp_info.components["aws-c-mqtt-lib"].names["cmake_find_package_multi"] = "aws-c-mqtt" - self.cpp_info.components["aws-c-mqtt-lib"].set_property("cmake_target_name", "AWS::aws-c-mqtt") - - self.cpp_info.components["aws-c-mqtt-lib"].libs = ["aws-c-mqtt"] - self.cpp_info.components["aws-c-mqtt-lib"].requires = [ - "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" - ] + # 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/aws-c-mqtt/all/test_v1_package/CMakeLists.txt b/recipes/aws-c-mqtt/all/test_v1_package/CMakeLists.txt index 610e2350e6503..0d20897301b68 100644 --- a/recipes/aws-c-mqtt/all/test_v1_package/CMakeLists.txt +++ b/recipes/aws-c-mqtt/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-mqtt REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-c-mqtt) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/aws-c-mqtt/config.yml b/recipes/aws-c-mqtt/config.yml index edbab7e67d700..a54bded63fa25 100644 --- a/recipes/aws-c-mqtt/config.yml +++ b/recipes/aws-c-mqtt/config.yml @@ -1,9 +1,5 @@ versions: - "0.7.12": + "0.10.3": folder: all - "0.7.10": - folder: all - "0.7.9": - folder: all - "0.7.6": + "0.7.8": folder: all diff --git a/recipes/aws-c-s3/all/conandata.yml b/recipes/aws-c-s3/all/conandata.yml index af6e82a742aa6..bacf4d1932974 100644 --- a/recipes/aws-c-s3/all/conandata.yml +++ b/recipes/aws-c-s3/all/conandata.yml @@ -1,16 +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" - "0.1.29": - url: "https://github.com/awslabs/aws-c-s3/archive/v0.1.29.tar.gz" - sha256: "bcbc38d091ad994fec2789bffd1d99e157c5e29a60685e836f028006e531bc60" - "0.1.27": - url: "https://github.com/awslabs/aws-c-s3/archive/v0.1.27.tar.gz" - sha256: "8fccbf967c3b29f0feaa1ba3de158b7ead805c3b4302c45b7cad3429f045920c" - "0.1.19": - url: "https://github.com/awslabs/aws-c-s3/archive/v0.1.19.tar.gz" - sha256: "30e17e31eed18e8d621cd3d3978b2e6eeeee5557bfc3a9d701d0d3e1c4a8a74d" + "0.5.5": + url: "https://github.com/awslabs/aws-c-s3/archive/v0.5.5.tar.gz" + sha256: "81d3913826953cb634ef1183a0c241d5e117419a877b625d69d7e1e54bbe5219" + "0.1.26": + url: "https://github.com/awslabs/aws-c-s3/archive/v0.1.26.tar.gz" + sha256: "68467095ce2c523caa9ecac27453cd83f4c195c33c6ab8c8b0fa6534565d19bf" diff --git a/recipes/aws-c-s3/all/conanfile.py b/recipes/aws-c-s3/all/conanfile.py index 131627214ba79..957de6e997292 100644 --- a/recipes/aws-c-s3/all/conanfile.py +++ b/recipes/aws-c-s3/all/conanfile.py @@ -1,18 +1,21 @@ 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 +from conan.tools.files import get, copy, rmdir, save +from conan.tools.scm import Version import os +import textwrap + +required_conan_version = ">=1.53.0" -required_conan_version = ">=1.47.0" class AwsCS3(ConanFile): name = "aws-c-s3" description = "C99 implementation of the S3 client" - license = "Apache-2.0", + license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/awslabs/aws-c-s3" topics = ("aws", "amazon", "cloud", "s3") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -29,37 +32,30 @@ def config_options(self): 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 + 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("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") + if self.version == "0.5.5": + self.requires("aws-c-common/0.9.15", transitive_headers=True, transitive_libs=True) + self.requires("aws-c-cal/0.6.14") + self.requires("aws-c-auth/0.7.16", transitive_headers=True) + self.requires("aws-c-http/0.8.1") + self.requires("aws-c-io/0.14.7", transitive_headers=True) + self.requires("aws-checksums/0.1.18") + if self.version == "0.1.26": + self.requires("aws-c-common/0.6.11", transitive_headers=True, transitive_libs=True) + self.requires("aws-c-cal/0.5.12") + self.requires("aws-c-auth/0.6.4", transitive_headers=True) + self.requires("aws-c-http/0.6.7") + self.requires("aws-c-io/0.10.9", transitive_headers=True) 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) @@ -80,24 +76,34 @@ def package(self): cmake.install() rmdir(self, os.path.join(self.package_folder, "lib", "aws-c-s3")) + # 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), + {"AWS::aws-c-s3": "aws-c-s3::aws-c-s3"} + ) + + 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", "aws-c-s3") self.cpp_info.set_property("cmake_target_name", "AWS::aws-c-s3") + self.cpp_info.libs = ["aws-c-s3"] + if self.options.shared: + self.cpp_info.defines.append("AWS_S3_USE_IMPORT_EXPORT") - self.cpp_info.filenames["cmake_find_package"] = "aws-c-s3" - self.cpp_info.filenames["cmake_find_package_multi"] = "aws-c-s3" - self.cpp_info.names["cmake_find_package"] = "AWS" - self.cpp_info.names["cmake_find_package_multi"] = "AWS" - self.cpp_info.components["aws-c-s3-lib"].names["cmake_find_package"] = "aws-c-s3" - self.cpp_info.components["aws-c-s3-lib"].names["cmake_find_package_multi"] = "aws-c-s3" - self.cpp_info.components["aws-c-s3-lib"].set_property("cmake_target_name", "AWS::aws-c-s3") - - self.cpp_info.components["aws-c-s3-lib"].libs = ["aws-c-s3"] - self.cpp_info.components["aws-c-s3-lib"].requires = [ - "aws-c-common::aws-c-common-lib", - "aws-c-io::aws-c-io-lib", - "aws-c-http::aws-c-http-lib", - "aws-c-auth::aws-c-auth-lib" - ] - if Version(self.version) >= "0.1.36": - self.cpp_info.components["aws-c-s3-lib"].requires.append("aws-checksums::aws-checksums-lib") + # 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/aws-c-s3/all/test_v1_package/CMakeLists.txt b/recipes/aws-c-s3/all/test_v1_package/CMakeLists.txt index 0778b2e2c7246..0d20897301b68 100644 --- a/recipes/aws-c-s3/all/test_v1_package/CMakeLists.txt +++ b/recipes/aws-c-s3/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-s3 REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-c-s3) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/aws-c-s3/config.yml b/recipes/aws-c-s3/config.yml index 182095498622b..31b0a063a88bd 100644 --- a/recipes/aws-c-s3/config.yml +++ b/recipes/aws-c-s3/config.yml @@ -1,11 +1,5 @@ versions: - "0.1.49": + "0.5.5": folder: all - "0.1.37": - folder: all - "0.1.29": - folder: all - "0.1.27": - folder: all - "0.1.19": + "0.1.26": folder: all diff --git a/recipes/aws-c-sdkutils/all/conandata.yml b/recipes/aws-c-sdkutils/all/conandata.yml index 7ec4906cf9a7f..36557b2156d5c 100644 --- a/recipes/aws-c-sdkutils/all/conandata.yml +++ b/recipes/aws-c-sdkutils/all/conandata.yml @@ -1,10 +1,4 @@ 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" - "0.1.1": - url: "https://github.com/awslabs/aws-c-sdkutils/archive/refs/tags/v0.1.1.tar.gz" - sha256: "201a5f694c912c952f50abab54fa0e576db75ddf6e8710c589896038ff9673f7" + "0.1.15": + url: "https://github.com/awslabs/aws-c-sdkutils/archive/v0.1.15.tar.gz" + sha256: "15fa30b8b0a357128388f2f40ab0ba3df63742fd333cc2f89cb91a9169f03bdc" diff --git a/recipes/aws-c-sdkutils/all/conanfile.py b/recipes/aws-c-sdkutils/all/conanfile.py index 43b3b4f755411..1aca7b380c09d 100644 --- a/recipes/aws-c-sdkutils/all/conanfile.py +++ b/recipes/aws-c-sdkutils/all/conanfile.py @@ -1,17 +1,21 @@ from conan import ConanFile -from conan.tools.files import get, copy, rmdir from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import get, copy, rmdir, save +from conan.tools.scm import Version import os +import textwrap + +required_conan_version = ">=1.53.0" -required_conan_version = ">=1.52.0" class AwsCSDKUtils(ConanFile): name = "aws-c-sdkutils" description = "C99 library implementing AWS SDK specific utilities. Includes utilities for ARN parsing, reading AWS profiles, etc..." - license = "Apache-2.0", + license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/awslabs/aws-c-sdkutils" topics = ("aws", "amazon", "cloud", "utility", "ARN") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -28,28 +32,19 @@ def config_options(self): 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 + 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("aws-c-common/0.8.2") + if self.version == "0.1.15": + self.requires("aws-c-common/0.9.15", transitive_headers=True, transitive_libs=True) 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 +64,34 @@ def package(self): cmake.install() rmdir(self, os.path.join(self.package_folder, "lib", "aws-c-sdkutils")) + # 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), + {"AWS::aws-c-sdkutils": "aws-c-sdkutils::aws-c-sdkutils"} + ) + + 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", "aws-c-sdkutils") self.cpp_info.set_property("cmake_target_name", "AWS::aws-c-sdkutils") + self.cpp_info.libs = ["aws-c-sdkutils"] + if self.options.shared: + self.cpp_info.defines.append("AWS_SDKUTILS_USE_IMPORT_EXPORT") - self.cpp_info.filenames["cmake_find_package"] = "aws-c-sdkutils" - self.cpp_info.filenames["cmake_find_package_multi"] = "aws-c-sdkutils" - self.cpp_info.names["cmake_find_package"] = "AWS" - self.cpp_info.names["cmake_find_package_multi"] = "AWS" - self.cpp_info.components["aws-c-sdkutils-lib"].names["cmake_find_package"] = "aws-c-sdkutils" - self.cpp_info.components["aws-c-sdkutils-lib"].names["cmake_find_package_multi"] = "aws-c-sdkutils" - self.cpp_info.components["aws-c-sdkutils-lib"].set_property("cmake_target_name", "AWS::aws-c-sdkutils") - - 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"] + # 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/aws-c-sdkutils/all/test_v1_package/CMakeLists.txt b/recipes/aws-c-sdkutils/all/test_v1_package/CMakeLists.txt index 6e620de3b4bc3..0d20897301b68 100644 --- a/recipes/aws-c-sdkutils/all/test_v1_package/CMakeLists.txt +++ b/recipes/aws-c-sdkutils/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.1) - -project(test_package C) +project(test_package) 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) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/aws-c-sdkutils/config.yml b/recipes/aws-c-sdkutils/config.yml index b2ced6f0d7ab7..d90a2c03c7832 100644 --- a/recipes/aws-c-sdkutils/config.yml +++ b/recipes/aws-c-sdkutils/config.yml @@ -1,7 +1,3 @@ versions: - "0.1.3": - folder: all - "0.1.2": - folder: all - "0.1.1": + "0.1.15": folder: all diff --git a/recipes/aws-checksums/all/conandata.yml b/recipes/aws-checksums/all/conandata.yml index ddf66e3fcf5ae..19b138c8eb788 100644 --- a/recipes/aws-checksums/all/conandata.yml +++ b/recipes/aws-checksums/all/conandata.yml @@ -1,18 +1,7 @@ sources: - "0.1.13": - url: "https://github.com/awslabs/aws-checksums/archive/v0.1.13.tar.gz" - sha256: "0f897686f1963253c5069a0e495b85c31635ba146cd3ac38cc2ea31eaf54694d" + "0.1.18": + url: "https://github.com/awslabs/aws-checksums/archive/v0.1.18.tar.gz" + sha256: "bdba9d0a8b8330a89c6b8cbc00b9aa14f403d3449b37ff2e0d96d62a7301b2ee" "0.1.12": url: "https://github.com/awslabs/aws-checksums/archive/v0.1.12.tar.gz" sha256: "394723034b81cc7cd528401775bc7aca2b12c7471c92350c80a0e2fb9d2909fe" - "0.1.11": - url: "https://github.com/awslabs/aws-checksums/archive/v0.1.11.tar.gz" - sha256: "9312e305428655bcea1f81524c3a8f617ce5299b903187047078929e850fb6d4" - "0.1.5": - url: "https://github.com/awslabs/aws-checksums/archive/v0.1.5.tar.gz" - sha256: "6e6bed6f75cf54006b6bafb01b3b96df19605572131a2260fddaf0e87949ced0" -patches: - "0.1.5": - - 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 d3412c3a07b16..135cd94267f12 100644 --- a/recipes/aws-checksums/all/conanfile.py +++ b/recipes/aws-checksums/all/conanfile.py @@ -1,9 +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, copy, get, rmdir +from conan.tools.files import apply_conandata_patches, export_conandata_patches, copy, get, rmdir, save +from conan.tools.scm import Version import os +import textwrap + +required_conan_version = ">=1.53.0" -required_conan_version = ">=1.52.0" class AwsChecksums(ConanFile): name = "aws-checksums" @@ -11,10 +14,11 @@ 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." ) - license = "Apache-2.0", + license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/awslabs/aws-checksums" topics = ("aws", "checksum", ) + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -34,28 +38,21 @@ def config_options(self): 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 + 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("aws-c-common/0.8.2") + if self.version == "0.1.18": + self.requires("aws-c-common/0.9.15", transitive_headers=True) + if self.version == "0.1.12": + self.requires("aws-c-common/0.6.11", transitive_headers=True) 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) @@ -65,7 +62,6 @@ def generate(self): deps.generate() def build(self): - apply_conandata_patches(self) cmake = CMake(self) cmake.configure() cmake.build() @@ -76,18 +72,34 @@ def package(self): cmake.install() rmdir(self, os.path.join(self.package_folder, "lib", "aws-checksums")) + # 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), + {"AWS::aws-checksums": "aws-checksums::aws-checksums"} + ) + + 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", "aws-checksums") self.cpp_info.set_property("cmake_target_name", "AWS::aws-checksums") - # TODO: back to global scope in conan v2 once cmake_find_package* generators removed - self.cpp_info.components["aws-checksums-lib"].libs = ["aws-checksums"] + self.cpp_info.libs = ["aws-checksums"] + if self.options.shared: + self.cpp_info.defines.append("AWS_CHECKSUMS_USE_IMPORT_EXPORT") # TODO: to remove in conan v2 once cmake_find_package* generators removed - self.cpp_info.filenames["cmake_find_package"] = "aws-checksums" - self.cpp_info.filenames["cmake_find_package_multi"] = "aws-checksums" - self.cpp_info.names["cmake_find_package"] = "AWS" - self.cpp_info.names["cmake_find_package_multi"] = "AWS" - self.cpp_info.components["aws-checksums-lib"].names["cmake_find_package"] = "aws-checksums" - self.cpp_info.components["aws-checksums-lib"].names["cmake_find_package_multi"] = "aws-checksums" - self.cpp_info.components["aws-checksums-lib"].set_property("cmake_target_name", "AWS::aws-checksums") - self.cpp_info.components["aws-checksums-lib"].requires = ["aws-c-common::aws-c-common-lib"] + 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/aws-checksums/all/patches/0001-use-PROJECT_SOURCE_DIR.patch b/recipes/aws-checksums/all/patches/0001-use-PROJECT_SOURCE_DIR.patch deleted file mode 100644 index 9a309a9f74658..0000000000000 --- a/recipes/aws-checksums/all/patches/0001-use-PROJECT_SOURCE_DIR.patch +++ /dev/null @@ -1,41 +0,0 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -98,7 +98,7 @@ - target_compile_definitions(aws-checksums PRIVATE "-DDEBUG_BUILD") - endif() - --target_include_directories(${CMAKE_PROJECT_NAME} PUBLIC -+target_include_directories(${PROJECT_NAME} PUBLIC - $ - $) - -@@ -129,7 +129,7 @@ - endif() - - install(FILES ${AWS_CHECKSUMS_HEADERS} DESTINATION "include/aws/checksums") --aws_prepare_shared_lib_exports(${CMAKE_PROJECT_NAME}) -+aws_prepare_shared_lib_exports(${PROJECT_NAME}) - - if (BUILD_SHARED_LIBS) - set (TARGET_DIR "shared") -@@ -137,14 +137,14 @@ - set (TARGET_DIR "static") - endif() - --install(EXPORT "${CMAKE_PROJECT_NAME}-targets" -- DESTINATION "${LIBRARY_DIRECTORY}/${CMAKE_PROJECT_NAME}/cmake/${TARGET_DIR}/" -+install(EXPORT "${PROJECT_NAME}-targets" -+ DESTINATION "${LIBRARY_DIRECTORY}/${PROJECT_NAME}/cmake/${TARGET_DIR}/" - NAMESPACE AWS::) - --configure_file("cmake/${CMAKE_PROJECT_NAME}-config.cmake" -- "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}-config.cmake" -+configure_file("cmake/${PROJECT_NAME}-config.cmake" -+ "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake" - @ONLY) - --install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}-config.cmake" -- DESTINATION "${LIBRARY_DIRECTORY}/${CMAKE_PROJECT_NAME}/cmake/") -+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake" -+ DESTINATION "${LIBRARY_DIRECTORY}/${PROJECT_NAME}/cmake/") - diff --git a/recipes/aws-checksums/all/patches/0002-disable-overriding-fPIC.patch b/recipes/aws-checksums/all/patches/0002-disable-overriding-fPIC.patch deleted file mode 100644 index 31249bcf0671b..0000000000000 --- a/recipes/aws-checksums/all/patches/0002-disable-overriding-fPIC.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -83,9 +83,9 @@ - target_compile_definitions(aws-checksums PRIVATE "-DAWS_CHECKSUMS_EXPORTS") - endif() - --if(NOT MSVC) -- target_compile_options(aws-checksums PRIVATE -fPIC) --endif() -+#if(NOT MSVC) -+# target_compile_options(aws-checksums PRIVATE -fPIC) -+#endif() - - if(BUILD_JNI_BINDINGS) - find_package(JNI) diff --git a/recipes/aws-checksums/all/patches/0003-disable-building-tests.patch b/recipes/aws-checksums/all/patches/0003-disable-building-tests.patch deleted file mode 100644 index f62f7e4733e64..0000000000000 --- a/recipes/aws-checksums/all/patches/0003-disable-building-tests.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -109,7 +109,7 @@ - file(GLOB TESTS ${TEST_HDRS} ${TEST_SRC}) - - include_directories(${CMAKE_CURRENT_SOURCE_DIR}/tests) --add_executable(aws-checksums-tests ${TESTS}) -+add_executable(aws-checksums-tests EXCLUDE_FROM_ALL ${TESTS}) - target_compile_options(aws-checksums-tests PRIVATE ${_FLAGS}) - target_link_libraries(aws-checksums-tests aws-checksums) - set_target_properties(aws-checksums-tests PROPERTIES LINKER_LANGUAGE C) diff --git a/recipes/aws-checksums/all/test_v1_package/CMakeLists.txt b/recipes/aws-checksums/all/test_v1_package/CMakeLists.txt index 915af9f83a60f..0d20897301b68 100644 --- a/recipes/aws-checksums/all/test_v1_package/CMakeLists.txt +++ b/recipes/aws-checksums/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-checksums REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-checksums) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/aws-checksums/config.yml b/recipes/aws-checksums/config.yml index 55fedf4c307f5..932ab94596844 100644 --- a/recipes/aws-checksums/config.yml +++ b/recipes/aws-checksums/config.yml @@ -1,9 +1,5 @@ versions: - "0.1.13": + "0.1.18": folder: all "0.1.12": folder: all - "0.1.11": - folder: all - "0.1.5": - folder: all diff --git a/recipes/aws-crt-cpp/all/conandata.yml b/recipes/aws-crt-cpp/all/conandata.yml index 5615e65f10a0b..a6902dfc92a08 100644 --- a/recipes/aws-crt-cpp/all/conandata.yml +++ b/recipes/aws-crt-cpp/all/conandata.yml @@ -1,26 +1,13 @@ 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" - "0.17.12": - url: "https://github.com/awslabs/aws-crt-cpp/archive/v0.17.12.tar.gz" - sha256: "acdd8b83198c5a471f92702bc4101828fe55361005764143704c39acd6f80ffc" - "0.14.3": - url: "https://github.com/awslabs/aws-crt-cpp/archive/v0.14.3.tar.gz" - sha256: "3ea16c43e691bab0c373ba1ad072f6535390c516ebda658dfaf4d074d920e0fb" + "0.26.9": + url: "https://github.com/awslabs/aws-crt-cpp/archive/v0.26.9.tar.gz" + sha256: "5b5760d34fbbfcc971f561296e828de4c788750472fd9bd3ac20068a083620f2" + "0.17.1a": + url: "https://github.com/awslabs/aws-crt-cpp/archive/v0.17.1a.tar.gz" + sha256: "64053c8237e350cfbec24984a3696aaf914bfa64e6200ef19bebe9cf5bb0692b" 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": - - patch_file: "patches/0.17.23-fix-cast-error.patch" - patch_description: "fix const cast error" - patch_type: "portability" - "0.17.12": - - patch_file: "patches/0.17.12-fix-cast-error.patch" - patch_description: "fix const cast error" - patch_type: "portability" + "0.17.1a": + - patch_file: "patches/0.17.23-fix-cpp20-windows.patch" + patch_description: "Fixes cpp 20 builds for windows." + patch_type: "bugfix" + patch_source: "https://github.com/awslabs/aws-crt-cpp/pull/364" diff --git a/recipes/aws-crt-cpp/all/conanfile.py b/recipes/aws-crt-cpp/all/conanfile.py index c70a676efc102..92652a3ebbf87 100644 --- a/recipes/aws-crt-cpp/all/conanfile.py +++ b/recipes/aws-crt-cpp/all/conanfile.py @@ -1,12 +1,15 @@ from conan import ConanFile -from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir +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.microsoft import is_msvc, is_msvc_static_runtime from conan.tools.scm import Version from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os +import textwrap + +required_conan_version = ">=1.53.0" -required_conan_version = ">=1.52.0" class AwsCrtCpp(ConanFile): name = "aws-crt-cpp" @@ -15,6 +18,7 @@ class AwsCrtCpp(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/awslabs/aws-crt-cpp" topics = ("aws", "amazon", "cloud", "wrapper") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -26,8 +30,8 @@ class AwsCrtCpp(ConanFile): } @property - def _minimum_cpp_standard(self): - return 11 + def _min_cppstd(self): + return "11" def export_sources(self): export_conandata_patches(self) @@ -38,43 +42,51 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - 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") + if self.version == "0.26.9": + # From add_subdirectory() calls in https://github.com/awslabs/aws-crt-cpp/blob/v0.26.9/CMakeLists.txt + self.requires("aws-c-common/0.9.15") + self.requires("aws-c-sdkutils/0.1.15") + self.requires("aws-c-io/0.14.7", transitive_headers=True) + self.requires("aws-c-cal/0.6.14") + self.requires("aws-c-compression/0.2.18") + self.requires("aws-c-http/0.8.1", transitive_headers=True) + self.requires("aws-c-auth/0.7.16", transitive_headers=True) + self.requires("aws-c-mqtt/0.10.3", transitive_headers=True) + self.requires("aws-checksums/0.1.18") + self.requires("aws-c-event-stream/0.4.2") + self.requires("aws-c-s3/0.5.5") + if self.version == "0.17.1a": + # From add_subdirectory() calls in https://github.com/awslabs/aws-crt-cpp/blob/v0.17.1a/CMakeLists.txt#L95 + self.requires("aws-c-http/0.6.7", transitive_headers=True) + self.requires("aws-c-mqtt/0.7.8", transitive_headers=True) + self.requires("aws-c-cal/0.5.12") + self.requires("aws-c-compression/0.2.14") + self.requires("aws-c-auth/0.6.4", transitive_headers=True) + self.requires("aws-c-common/0.6.11") + self.requires("aws-c-io/0.10.9", transitive_headers=True) + self.requires("aws-checksums/0.1.12") 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") + self.requires("aws-c-s3/0.1.26") def validate(self): - if self.info.settings.compiler.cppstd: - check_min_cppstd(self, self._minimum_cpp_standard) + 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) + if is_msvc(self): + tc.variables["AWS_STATIC_MSVC_RUNTIME_LIBRARY"] = is_msvc_static_runtime(self) tc.variables["BUILD_TESTING"] = False - tc.variables["BUILD_DEPS"] = False + tc.cache_variables["BUILD_DEPS"] = False tc.generate() deps = CMakeDeps(self) @@ -92,26 +104,34 @@ def package(self): cmake.install() rmdir(self, os.path.join(self.package_folder, "lib", "aws-crt-cpp")) + # 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), + {"AWS::aws-crt-cpp": "aws-crt-cpp::aws-crt-cpp"} + ) + + 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", "aws-crt-cpp") self.cpp_info.set_property("cmake_target_name", "AWS::aws-crt-cpp") - - 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"] - self.cpp_info.components["aws-crt-cpp-lib"].requires = [ - "aws-c-event-stream::aws-c-event-stream-lib", - "aws-c-common::aws-c-common-lib", - "aws-c-io::aws-c-io-lib", - "aws-c-http::aws-c-http-lib", - "aws-c-auth::aws-c-auth-lib", - "aws-c-mqtt::aws-c-mqtt-lib", - "aws-c-s3::aws-c-s3-lib", - "aws-checksums::aws-checksums-lib" - ] + self.cpp_info.libs = ["aws-crt-cpp"] + if self.options.shared: + self.cpp_info.defines.append("AWS_CRT_CPP_USE_IMPORT_EXPORT") # 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" + 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/aws-crt-cpp/all/patches/0.17.12-fix-cast-error.patch b/recipes/aws-crt-cpp/all/patches/0.17.12-fix-cast-error.patch deleted file mode 100644 index be886c030a52c..0000000000000 --- a/recipes/aws-crt-cpp/all/patches/0.17.12-fix-cast-error.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/source/io/TlsOptions.cpp b/source/io/TlsOptions.cpp -index 9f9f8cf..e9913ef 100644 ---- a/source/io/TlsOptions.cpp -+++ b/source/io/TlsOptions.cpp -@@ -216,7 +216,7 @@ namespace Aws - - if (m_slotId) - { -- options.slot_id = &(*m_slotId); -+ options.slot_id = const_cast(&(*m_slotId)); - } - - if (m_userPin) diff --git a/recipes/aws-crt-cpp/all/patches/0.17.23-fix-cast-error.patch b/recipes/aws-crt-cpp/all/patches/0.17.23-fix-cast-error.patch deleted file mode 100644 index 676d3a87fbac2..0000000000000 --- a/recipes/aws-crt-cpp/all/patches/0.17.23-fix-cast-error.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/source/io/TlsOptions.cpp b/source/io/TlsOptions.cpp -index 3018e4c..eb5e129 100644 ---- a/source/io/TlsOptions.cpp -+++ b/source/io/TlsOptions.cpp -@@ -213,7 +213,7 @@ namespace Aws - - if (m_slotId) - { -- options.slot_id = &(*m_slotId); -+ options.slot_id = const_cast(&(*m_slotId)); - } - - if (m_userPin) diff --git a/recipes/aws-crt-cpp/all/patches/0.17.23-fix-cpp20-windows.patch b/recipes/aws-crt-cpp/all/patches/0.17.23-fix-cpp20-windows.patch new file mode 100644 index 0000000000000..9f32e19e32b8b --- /dev/null +++ b/recipes/aws-crt-cpp/all/patches/0.17.23-fix-cpp20-windows.patch @@ -0,0 +1,28 @@ +From 3216ce53fa7f276ae4407a450cafafa9e809fea1 Mon Sep 17 00:00:00 2001 +From: Sam Bisciglia +Date: Tue, 12 Apr 2022 14:42:26 -0400 +Subject: [PATCH] Fixes cpp 20 builds for windows. (#364) + +--- +diff --git a/include/aws/crt/StringView.h b/include/aws/crt/StringView.h +index a0fec83..dc2f05b 100644 +--- a/include/aws/crt/StringView.h ++++ b/include/aws/crt/StringView.h +@@ -15,7 +15,7 @@ + #include + #include + +-#if __cplusplus >= 201703L || (defined(_MSC_LANG) && _MSC_LANG >= 201703L) ++#if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) + # include + #endif + +@@ -53,7 +53,7 @@ namespace Aws + + basic_string_view &operator=(const basic_string_view &) noexcept = default; + +-#if __cplusplus >= 201703L || (defined(_MSC_LANG) && _MSC_LANG >= 201703L) ++#if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) + constexpr basic_string_view(const std::basic_string_view &other) noexcept + : m_size(other.size()), m_data(other.data()) + { diff --git a/recipes/aws-crt-cpp/all/test_v1_package/CMakeLists.txt b/recipes/aws-crt-cpp/all/test_v1_package/CMakeLists.txt index 31592420f8acc..0d20897301b68 100644 --- a/recipes/aws-crt-cpp/all/test_v1_package/CMakeLists.txt +++ b/recipes/aws-crt-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(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) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/aws-crt-cpp/config.yml b/recipes/aws-crt-cpp/config.yml index a2a8f6922a602..b1a11f4753b30 100644 --- a/recipes/aws-crt-cpp/config.yml +++ b/recipes/aws-crt-cpp/config.yml @@ -1,9 +1,5 @@ versions: - "0.18.8": + "0.26.9": folder: all - "0.17.23": - folder: all - "0.17.12": - folder: all - "0.14.3": + "0.17.1a": folder: all diff --git a/recipes/aws-kvs-pic/all/CMakeLists.txt b/recipes/aws-kvs-pic/all/CMakeLists.txt deleted file mode 100644 index 6abb33ac667b0..0000000000000 --- a/recipes/aws-kvs-pic/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper LANGUAGES C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/aws-kvs-pic/all/conandata.yml b/recipes/aws-kvs-pic/all/conandata.yml index 3e715c5477031..5e5052a1a9680 100644 --- a/recipes/aws-kvs-pic/all/conandata.yml +++ b/recipes/aws-kvs-pic/all/conandata.yml @@ -1,8 +1,10 @@ sources: + "1.1.0": + url: "https://github.com/awslabs/amazon-kinesis-video-streams-pic/archive/refs/tags/v1.1.0.tar.gz" + sha256: "ef45723cd439f855bae2304d9488b68cd6d1e0dc3203c97ebd1cbb26197edb55" + "1.0.1": + url: "https://github.com/awslabs/amazon-kinesis-video-streams-pic/archive/refs/tags/v1.0.1.tar.gz" + sha256: "d04732217c74687c5498665b353cb089d725ca7f5b5da61a3f984f7fbefb2ac9" "cci.20210812": url: "https://github.com/awslabs/amazon-kinesis-video-streams-pic/archive/bbf0e4ba749a6c045fc3958951c1c3a61a808dd0.tar.gz" sha256: "5a6d8da62af766ec86423ead2a45d9ff00cd80ddea679ce228ff9696a490fae5" -patches: - "cci.20210812": - - base_path: "source_subfolder" - patch_file: "patches/0001-do-not-enforce-fpic.patch" diff --git a/recipes/aws-kvs-pic/all/conanfile.py b/recipes/aws-kvs-pic/all/conanfile.py index 3cdebbedda863..e8a1073232807 100644 --- a/recipes/aws-kvs-pic/all/conanfile.py +++ b/recipes/aws-kvs-pic/all/conanfile.py @@ -1,37 +1,32 @@ import os -from conans import ConanFile, tools, CMake -from conans.errors import ConanInvalidConfiguration -required_conan_version = ">=1.33.0" +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, replace_in_file +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" + class awskvspicConan(ConanFile): name = "aws-kvs-pic" + description = "Platform Independent Code for Amazon Kinesis Video Streams" license = "Apache-2.0" - homepage = "https://github.com/awslabs/amazon-kinesis-video-streams-pic" url = "https://github.com/conan-io/conan-center-index" - description = ("Platform Independent Code for Amazon Kinesis Video Streams") - settings = "os", "arch", "compiler", "build_type" - options = {"shared": [True, False], "fPIC": [True, False]} - default_options = {'shared': False, "fPIC": True} - generators = "cmake" + homepage = "https://github.com/awslabs/amazon-kinesis-video-streams-pic" topics = ("aws", "kvs", "kinesis", "video", "stream") - exports_sources = ["CMakeLists.txt", "patches/*"] - _cmake = None - @property - def _source_subfolder(self): - return "source_subfolder" - - def _configure_cmake(self): - if not self._cmake: - self._cmake = CMake(self) - self._cmake.definitions["BUILD_DEPENDENCIES"] = False - self._cmake.configure() - return self._cmake - - def validate(self): - if (self.settings.os != "Linux" and self.options.shared): - raise ConanInvalidConfiguration("This library can only be built shared on Linux") + 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": @@ -39,38 +34,57 @@ 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 validate(self): + if self.settings.os not in ["Linux", "FreeBSD"] and self.options.shared: + raise ConanInvalidConfiguration("This library can only be built shared on Linux") 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_DEPENDENCIES"] = False + tc.generate() + + def _patch_sources(self): + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), " -fPIC", "") 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, "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.components["kvspic"].libs = ["kvspic"] - self.cpp_info.components["kvspic"].names["pkg_config"] = "libkvspic" + self.cpp_info.components["kvspic"].set_property("pkg_config_name", "libkvspic") if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["kvspic"].system_libs = ["dl", "rt", "pthread"] + + if Version(self.version) >= "1.1.0": + if self.settings.build_type == "Debug": + self.cpp_info.components["kvspic"].defines = ["DEBUG_BUILD"] self.cpp_info.components["kvspicClient"].libs = ["kvspicClient"] - self.cpp_info.components["kvspicClient"].names["pkg_config"] = "libkvspicClient" + self.cpp_info.components["kvspicClient"].set_property("pkg_config_name", "libkvspicClient") self.cpp_info.components["kvspicState"].libs = ["kvspicState"] - self.cpp_info.components["kvspicState"].names["pkg_config"] = "libkvspicState" + self.cpp_info.components["kvspicState"].set_property("pkg_config_name", "libkvspicState") self.cpp_info.components["kvspicUtils"].libs = ["kvspicUtils"] - self.cpp_info.components["kvspicUtils"].names["pkg_config"] = "libkvspicUtils" + self.cpp_info.components["kvspicUtils"].set_property("pkg_config_name", "libkvspicUtils") if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["kvspicUtils"].system_libs = ["dl", "rt", "pthread"] diff --git a/recipes/aws-kvs-pic/all/patches/0001-do-not-enforce-fpic.patch b/recipes/aws-kvs-pic/all/patches/0001-do-not-enforce-fpic.patch deleted file mode 100644 index 0286a964caa2c..0000000000000 --- a/recipes/aws-kvs-pic/all/patches/0001-do-not-enforce-fpic.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/CMakeLists.txt 2021-08-06 17:10:31.808434572 -0300 -+++ b/CMakeLists.txt 2021-08-06 17:10:31.888434646 -0300 -@@ -79,7 +79,7 @@ - set(THREADS_PREFER_PTHREAD_FLAG ON) - find_package(Threads) - --set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") -+ - - if(MSVC) - add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING) diff --git a/recipes/aws-kvs-pic/all/test_package/CMakeLists.txt b/recipes/aws-kvs-pic/all/test_package/CMakeLists.txt index dbfb3fd9c7861..33561c82ed591 100644 --- a/recipes/aws-kvs-pic/all/test_package/CMakeLists.txt +++ b/recipes/aws-kvs-pic/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(PkgConfig REQUIRED) pkg_check_modules(LIBKVSPIC REQUIRED IMPORTED_TARGET libkvspic) diff --git a/recipes/aws-kvs-pic/all/test_package/conanfile.py b/recipes/aws-kvs-pic/all/test_package/conanfile.py index 6fdab74d20c22..e8fb9d03fc8a5 100644 --- a/recipes/aws-kvs-pic/all/test_package/conanfile.py +++ b/recipes/aws-kvs-pic/all/test_package/conanfile.py @@ -1,12 +1,23 @@ import os -from conans import ConanFile, CMake, tools -class TestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "pkg_config" +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 = "PkgConfigDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) def build_requirements(self): - self.build_requires("pkgconf/1.7.4") + self.tool_requires("pkgconf/2.0.3") + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -14,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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/aws-kvs-pic/all/test_package/test_package.c b/recipes/aws-kvs-pic/all/test_package/test_package.c index fe89810597779..08c9a0b45013e 100644 --- a/recipes/aws-kvs-pic/all/test_package/test_package.c +++ b/recipes/aws-kvs-pic/all/test_package/test_package.c @@ -1,6 +1,7 @@ -#include #include "com/amazonaws/kinesis/video/client/Include.h" +#include + int main(int argc, char *argv[]) { diff --git a/recipes/aws-kvs-pic/all/test_v1_package/CMakeLists.txt b/recipes/aws-kvs-pic/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/aws-kvs-pic/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/aws-kvs-pic/all/test_v1_package/conanfile.py b/recipes/aws-kvs-pic/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..cba2c258bb2b4 --- /dev/null +++ b/recipes/aws-kvs-pic/all/test_v1_package/conanfile.py @@ -0,0 +1,19 @@ +import os +from conans import ConanFile, CMake, tools + +class TestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "pkg_config" + + def build_requirements(self): + self.build_requires("pkgconf/2.0.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/aws-kvs-pic/config.yml b/recipes/aws-kvs-pic/config.yml index e6b575a028845..f7630e1054b00 100644 --- a/recipes/aws-kvs-pic/config.yml +++ b/recipes/aws-kvs-pic/config.yml @@ -1,3 +1,7 @@ versions: + "1.1.0": + folder: all + "1.0.1": + folder: all "cci.20210812": folder: all diff --git a/recipes/aws-lambda-cpp/all/conandata.yml b/recipes/aws-lambda-cpp/all/conandata.yml new file mode 100644 index 0000000000000..22a060a14124f --- /dev/null +++ b/recipes/aws-lambda-cpp/all/conandata.yml @@ -0,0 +1,10 @@ +sources: + "0.2.10": + url: "https://github.com/awslabs/aws-lambda-cpp/archive/refs/tags/v0.2.10.tar.gz" + sha256: "fee8e465ac63efaa6252aa2a108183ef174cbc5ed3e56e4de4986846f89a76ee" + "0.2.9": + url: "https://github.com/awslabs/aws-lambda-cpp/archive/refs/tags/0.2.9.tar.gz" + sha256: "4fb98483248adf0a2b251cb1b06df8b19bbd40e7f015dccfc32b7eaae6a294e7" + "0.2.8": + url: "https://github.com/awslabs/aws-lambda-cpp/archive/refs/tags/v0.2.8.tar.gz" + sha256: "a236516331804a0a6e2ef2273042a583e55a135bb6478308829c51e7c425acdb" diff --git a/recipes/aws-lambda-cpp/all/conanfile.py b/recipes/aws-lambda-cpp/all/conanfile.py new file mode 100644 index 0000000000000..849efb9333447 --- /dev/null +++ b/recipes/aws-lambda-cpp/all/conanfile.py @@ -0,0 +1,100 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration, ConanException +from conan.tools.files import get, copy, rmdir, load, save, rename +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 AwsLambdaRuntimeConan(ConanFile): + name = "aws-lambda-cpp" + description = "C++ implementation of the AWS Lambda runtime" + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/awslabs/aws-lambda-cpp" + topics = ("aws", "lambda") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_backtrace": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_backtrace": False, + } + + @property + def _min_cppstd(self): + return 11 + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + if Version(self.version) < "0.2.9": + del self.options.with_backtrace + + 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.78.0 <9]") + if self.options.get_safe("with_backtrace", True): + self.requires("libbacktrace/cci.20210118") + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + + if self.settings.os != "Linux": + raise ConanInvalidConfiguration(f"{self.ref} supports Linux only.") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.generate() + dpes = CMakeDeps(self) + dpes.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def _extract_cmake_module(self): + cmake_module = load(self, os.path.join(self.source_folder, "cmake", "aws-lambda-runtime-config.cmake")) + start = "set(AWS_LAMBDA_PACKAGING_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/packager)" + start_index = cmake_module.find(start) + if start_index == -1: + raise ConanException("Could not extract aws_lambda_package_target from aws-lambda-runtime-config.cmake file.") + return cmake_module[start_index:] + + def package(self): + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) + cmake.install() + + save(self, os.path.join(self.package_folder, "lib", "cmake", "aws_lambda_package_target.cmake"), self._extract_cmake_module()) + rename(self, os.path.join(self.package_folder, "lib", "aws-lambda-runtime", "cmake", "packager"), os.path.join(self.package_folder, "lib", "cmake", "packager")) + rmdir(self, os.path.join(self.package_folder, "lib", "aws-lambda-runtime")) + + def package_info(self): + self.cpp_info.libs = ["aws-lambda-runtime"] + self.cpp_info.builddirs.append(os.path.join("lib", "cmake")) + + self.cpp_info.set_property("cmake_file_name", "aws-lambda-runtime") + self.cpp_info.set_property("cmake_target_name", "AWS::aws-lambda-runtime") + self.cpp_info.set_property("cmake_build_modules", [os.path.join("lib", "cmake", "aws_lambda_package_target.cmake")]) + + self.cpp_info.system_libs.append("m") diff --git a/recipes/aws-lambda-cpp/all/test_package/CMakeLists.txt b/recipes/aws-lambda-cpp/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..1821ed75da1ec --- /dev/null +++ b/recipes/aws-lambda-cpp/all/test_package/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(aws-lambda-runtime REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-lambda-runtime) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) + +if(NOT COMMAND aws_lambda_package_target) + message(FATAL_ERROR "aws_lambda_package_target should have been defined as part of find_package(aws-lambda-runtime)") +endif() diff --git a/recipes/aws-lambda-cpp/all/test_package/conanfile.py b/recipes/aws-lambda-cpp/all/test_package/conanfile.py new file mode 100644 index 0000000000000..ef5d7042163ec --- /dev/null +++ b/recipes/aws-lambda-cpp/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/aws-lambda-cpp/all/test_package/test_package.cpp b/recipes/aws-lambda-cpp/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..ae80b44bdeccb --- /dev/null +++ b/recipes/aws-lambda-cpp/all/test_package/test_package.cpp @@ -0,0 +1,9 @@ +#include +#include "aws/lambda-runtime/version.h" + +int main() +{ + std::cout << aws::lambda_runtime::get_version() << '\n'; + + return 0; +} diff --git a/recipes/aws-lambda-cpp/config.yml b/recipes/aws-lambda-cpp/config.yml new file mode 100644 index 0000000000000..6cead73879d2a --- /dev/null +++ b/recipes/aws-lambda-cpp/config.yml @@ -0,0 +1,7 @@ +versions: + "0.2.10": + folder: all + "0.2.9": + folder: all + "0.2.8": + folder: all diff --git a/recipes/aws-libfabric/all/conanfile.py b/recipes/aws-libfabric/all/conanfile.py index 134b19e72fb91..cdf0ee0dd3198 100644 --- a/recipes/aws-libfabric/all/conanfile.py +++ b/recipes/aws-libfabric/all/conanfile.py @@ -1,33 +1,44 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, tools -from conans.errors import ConanInvalidConfiguration import os -required_conan_version = ">=1.35.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.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import chdir, collect_libs, copy, get, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import unix_path + +required_conan_version = ">=1.53.0" + class LibfabricConan(ConanFile): name = "aws-libfabric" description = "AWS Libfabric" - topics = ("fabric", "communication", "framework", "service") + license = ("BSD-2-Clause", "GPL-2.0-or-later") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/aws/libfabric" - license = "BSD-2-Clause", "GPL-2.0-or-later" + topics = ("fabric", "communication", "framework", "service") + + package_type = "library" settings = "os", "arch", "compiler", "build_type" _providers = ["gni", "psm", "psm2", "sockets", "rxm", "tcp", "udp", "usnic", "verbs", "bgq", "shm", "efa", "rxd", "mrail", "rstream", "perf", "hook_debug"] options = { + "shared": [True, False], + "fPIC": [True, False], **{ p: [True, False, "shared"] for p in _providers }, **{ - "shared": [True, False], - "fPIC": [True, False], "with_libnl": [True, False], "bgq_progress": ["auto", "manual"], "bgq_mr": ["basic", "scalable"] } } default_options = { + "shared": False, + "fPIC": True, **{ p: False for p in _providers }, **{ - "shared": False, - "fPIC": True, "tcp": True, "with_libnl": False, "bgq_progress": "manual", @@ -35,15 +46,6 @@ class LibfabricConan(ConanFile): } } - @property - def _source_subfolder(self): - return "source_subfolder" - - _autotools = None - - def build_requirements(self): - self.build_requires("libtool/2.4.6") - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC @@ -52,9 +54,12 @@ 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.options.with_libnl: @@ -64,52 +69,56 @@ def validate(self): if self.settings.os == "Windows": raise ConanInvalidConfiguration("The libfabric package cannot be built on Windows.") - 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) - with tools.chdir(self._source_subfolder): - self.run("{} -fiv".format(tools.get_env("AUTORECONF")), win_bash=tools.os_info.is_windows) + def build_requirements(self): + self.tool_requires("libtool/2.4.7") + 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") yes_no_dl = lambda v: {"True": "yes", "False": "no", "shared": "dl"}[str(v)] - 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 = AutotoolsToolchain(self) + tc.configure_args += [ "--with-bgq-progress={}".format(self.options.bgq_progress), "--with-bgq-mr={}".format(self.options.bgq_mr), ] for p in self._providers: - args.append("--enable-{}={}".format(p, yes_no_dl(getattr(self.options, p)))) + tc.configure_args.append("--enable-{}={}".format(p, yes_no_dl(getattr(self.options, p)))) if self.options.with_libnl: - args.append("--with-libnl={}".format(tools.unix_path(self.deps_cpp_info["libnl"].rootpath))), + tc.configure_args.append("--with-libnl={}".format(unix_path(self, self.dependencies["libnl"].package_folder))) else: - args.append("--with-libnl=no") + tc.configure_args.append("--with-libnl=no") if self.settings.build_type == "Debug": - args.append("--enable-debug") - self._autotools.configure(args=args, configure_dir=self._source_subfolder) - return self._autotools + tc.configure_args.append("--enable-debug") + tc.generate() + tc = AutotoolsDeps(self) + tc.generate() def build(self): - autotools = self._configure_autotools() - autotools.make() + with chdir(self, self.source_folder): + 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, "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, pattern="COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + 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", self.package_folder, recursive=True) + fix_apple_shared_install_name(self) def package_info(self): - self.cpp_info.names["pkg_config"] = "libfabric" - self.cpp_info.libs = self.collect_libs() + self.cpp_info.set_property("pkg_config_name", "libfabric") + self.cpp_info.libs = collect_libs(self) if self.settings.os in ("FreeBSD", "Linux"): self.cpp_info.system_libs = ["pthread", "m"] if not self.options.shared: diff --git a/recipes/aws-libfabric/all/test_package/CMakeLists.txt b/recipes/aws-libfabric/all/test_package/CMakeLists.txt index 34af13462f44f..1af9ab7c6f511 100644 --- a/recipes/aws-libfabric/all/test_package/CMakeLists.txt +++ b/recipes/aws-libfabric/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 C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(aws-libfabric REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE aws-libfabric::aws-libfabric) diff --git a/recipes/aws-libfabric/all/test_package/conanfile.py b/recipes/aws-libfabric/all/test_package/conanfile.py index d4128b0450777..ef5d7042163ec 100644 --- a/recipes/aws-libfabric/all/test_package/conanfile.py +++ b/recipes/aws-libfabric/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): - bin_path = os.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/aws-libfabric/all/test_v1_package/CMakeLists.txt b/recipes/aws-libfabric/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/aws-libfabric/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/lyra/all/test_v1_package/conanfile.py b/recipes/aws-libfabric/all/test_v1_package/conanfile.py similarity index 100% rename from recipes/lyra/all/test_v1_package/conanfile.py rename to recipes/aws-libfabric/all/test_v1_package/conanfile.py diff --git a/recipes/aws-sdk-cpp/all/CMakeLists.txt b/recipes/aws-sdk-cpp/all/CMakeLists.txt deleted file mode 100644 index d19ff91050d95..0000000000000 --- a/recipes/aws-sdk-cpp/all/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -cmake_minimum_required(VERSION 3.5) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -if(MSVC) - add_definitions(-D_SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING) -endif() - -add_subdirectory(source_subfolder) diff --git a/recipes/aws-sdk-cpp/all/conandata.yml b/recipes/aws-sdk-cpp/all/conandata.yml index 8abd96ad2e0be..36f76d76bbf97 100644 --- a/recipes/aws-sdk-cpp/all/conandata.yml +++ b/recipes/aws-sdk-cpp/all/conandata.yml @@ -1,38 +1,19 @@ sources: + "1.11.352": + url: "https://github.com/aws/aws-sdk-cpp/archive/1.11.352.tar.gz" + sha256: "999583df108a5363ff33563f86ea23a528761ebea3577348867932ba7eeacae2" "1.9.234": url: "https://github.com/aws/aws-sdk-cpp/archive/1.9.234.tar.gz" sha256: "52e36cf568fe0b2a0fc82a9333c0b31ba843db16670f4ccbb7b9fd142f1b00a5" - "1.9.100": - url: "https://github.com/aws/aws-sdk-cpp/archive/1.9.100.tar.gz" - sha256: "f0930d14ec92b9ddf1e3c966d9a3fe70d2a01b80e79e3e76da78d108bb81e5c4" - "1.8.130": - url: "https://github.com/aws/aws-sdk-cpp/archive/1.8.130.tar.gz" - sha256: "5dd09baa28d3f6f4fb03fbba1a4269724d79bcca3d47752cd3e15caf97276bda" patches: + "1.11.352": + - patch_file: patches/1.11.352-0001-pulseaudio.patch + patch_description: Use pulseaudio from conan + patch_type: conan + - patch_file: patches/1.11.352-0002-disable-sort-links.patch + - patch_file: patches/1.9.100-0002-aws-plugin-conf.patch "1.9.234": - - base_path: source_subfolder - patch_file: patches/1.9.234-0001-issue-1816.patch - - base_path: source_subfolder - patch_file: patches/1.9.234-0002-disable-sort-links.patch - - base_path: source_subfolder - patch_file: patches/1.9.100-0002-aws-plugin-conf.patch - "1.9.100": - - base_path: source_subfolder - patch_file: patches/1.9.100-0001-disable-sort-links.patch - - base_path: source_subfolder - patch_file: patches/1.9.100-0002-aws-plugin-conf.patch - - base_path: source_subfolder - patch_file: patches/1.9.100-0003-issue-1816.patch - "1.8.130": - - base_path: source_subfolder - patch_file: patches/1.8.130-0001-disable-sort-links.patch - - base_path: source_subfolder - patch_file: patches/1.8.130-0002-force-archive-directory-to-library-directory.patch - - base_path: source_subfolder - patch_file: patches/1.8.130-0003-disable-cmake-install-rpath-use-link-path.patch - - base_path: source_subfolder - patch_file: patches/1.8.130-0004-improve-pulseaudio-detection.patch - - base_path: source_subfolder - patch_file: patches/1.8.130-0005-aws-plugin-conf.patch - - base_path: source_subfolder - patch_file: patches/1.8.130-0006-issue-1816.patch + - patch_file: patches/1.9.234-0001-issue-1816.patch + - patch_file: patches/1.9.234-0002-disable-sort-links.patch + - patch_file: patches/1.9.100-0002-aws-plugin-conf.patch + - patch_file: patches/1.8.130-0004-improve-pulseaudio-detection.patch diff --git a/recipes/aws-sdk-cpp/all/conanfile.py b/recipes/aws-sdk-cpp/all/conanfile.py index 91c2066868882..b200f12fd1ce4 100644 --- a/recipes/aws-sdk-cpp/all/conanfile.py +++ b/recipes/aws-sdk-cpp/all/conanfile.py @@ -1,11 +1,14 @@ import os -from conan.tools.files import rename -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.build import cross_building, 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, rename, replace_in_file, rm, rmdir +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +from conan.tools.scm import Version -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.54.0" class AwsSdkCppConan(ConanFile): @@ -15,276 +18,410 @@ class AwsSdkCppConan(ConanFile): homepage = "https://github.com/aws/aws-sdk-cpp" description = "AWS SDK for C++" topics = ("aws", "cpp", "cross-platform", "amazon", "cloud") - + package_type = "library" settings = "os", "arch", "compiler", "build_type" + # This list comes from tools/code-generation/api-description, which then generates the sdk sources + # To generate for a new one, run the build once and check src/generated/src inside your build_folder, remove the common aws-sdk-cpp prefix + # and that's the list of sdks. The join it to the below one _sdks = ( - "access-management", - "accessanalyzer", - "acm", - "acm-pca", - "alexaforbusiness", - "amp", - "amplify", - "amplifybackend", - "apigateway", - "apigatewaymanagementapi", - "apigatewayv2", - "appconfig", - "appflow", - "appintegrations", - "application-autoscaling", - "application-insights", - "appmesh", - "appstream", - "appsync", - "athena", - "auditmanager", - "autoscaling", - "autoscaling-plans", - "awstransfer", - "backup", - "batch", - "braket", - "budgets", - "ce", - "chime", - "cloud9", - "clouddirectory", - "cloudformation", - "cloudfront", - "cloudhsm", - "cloudhsmv2", - "cloudsearch", - "cloudsearchdomain", - "cloudtrail", - "codeartifact", - "codebuild", - "codecommit", - "codedeploy", - "codeguru-reviewer", - "codeguruprofiler", - "codepipeline", - "codestar", - "codestar-connections", - "codestar-notifications", - "cognito-identity", - "cognito-idp", - "cognito-sync", - "comprehend", - "comprehendmedical", - "compute-optimizer", - "config", - "connect", - "connect-contact-lens", - "connectparticipant", - "cur", - "customer-profiles", - "databrew", - "dataexchange", - "datapipeline", - "datasync", - "dax", - "detective", - "devicefarm", - "devops-guru", - "directconnect", - "discovery", - "dlm", - "dms", - "docdb", - "ds", - "dynamodb", - "dynamodbstreams", - "ebs", - "ec2", - "ec2-instance-connect", - "ecr", - "ecr-public", - "ecs", - "eks", - "elastic-inference", - "elasticache", - "elasticbeanstalk", - "elasticfilesystem", - "elasticloadbalancing", - "elasticloadbalancingv2", - "elasticmapreduce", - "elastictranscoder", - "email", - "emr-containers", - "es", - "eventbridge", - "events", - "firehose", - "fms", - "forecast", - "forecastquery", - "frauddetector", - "fsx", - "gamelift", - "glacier", - "globalaccelerator", - "glue", - "greengrass", - "greengrassv2", - "groundstation", - "guardduty", - "health", - "healthlake", - "honeycode", - "iam", - "identity-management", - "identitystore", - "imagebuilder", - "importexport", - "inspector", - "iot", - "iot-data", - "iot-jobs-data", - "iot1click-devices", - "iot1click-projects", - "iotanalytics", - "iotdeviceadvisor", - "iotevents", - "iotevents-data", - "iotfleethub", - "iotsecuretunneling", - "iotsitewise", - "iotthingsgraph", - "iotwireless", - "ivs", - "kafka", - "kendra", - "kinesis", - "kinesis-video-archived-media", - "kinesis-video-media", - "kinesis-video-signaling", - "kinesisanalytics", - "kinesisanalyticsv2", - "kinesisvideo", - "kms", - "lakeformation", - "lambda", - "lex", - "lex-models", - "lexv2-models", - "lexv2-runtime", - "license-manager", - "lightsail", - "location", - "logs", - "lookoutvision", - "machinelearning", - "macie", - "macie2", - "managedblockchain", - "marketplace-catalog", - "marketplace-entitlement", - "marketplacecommerceanalytics", - "mediaconnect", - "mediaconvert", - "medialive", - "mediapackage", - "mediapackage-vod", - "mediastore", - "mediastore-data", - "mediatailor", - "meteringmarketplace", - "migrationhub-config", - "mobile", - "mobileanalytics", - "monitoring", - "mq", - "mturk-requester", - "mwaa", - "neptune", - "network-firewall", - "networkmanager", - "opsworks", - "opsworkscm", - "organizations", - "outposts", - "personalize", - "personalize-events", - "personalize-runtime", - "pi", - "pinpoint", - "pinpoint-email", - "polly", - "polly-sample", - "pricing", - "qldb", - "qldb-session", - "queues", - "quicksight", - "ram", - "rds", - "rds-data", - "redshift", - "redshift-data", - "rekognition", - "resource-groups", - "resourcegroupstaggingapi", - "robomaker", - "route53", - "route53domains", - "route53resolver", - "s3", - "s3-crt", - "s3-encryption", - "s3control", - "s3outposts", - "sagemaker", - "sagemaker-a2i-runtime", - "sagemaker-edge", - "sagemaker-featurestore-runtime", - "sagemaker-runtime", - "savingsplans", - "schemas", - "sdb", - "secretsmanager", - "securityhub", - "serverlessrepo", - "service-quotas", - "servicecatalog", - "servicecatalog-appregistry", - "servicediscovery", - "sesv2", - "shield", - "signer", - "sms", - "sms-voice", - "snowball", - "sns", - "sqs", - "ssm", - "sso", - "sso-admin", - "sso-oidc", - "states", - "storagegateway", - "sts", - "support", - "swf", - "synthetics", - "text-to-speech", - "textract", - "timestream-query", - "timestream-write", - "transcribe", - "transcribestreaming", - "transfer", - "translate", - "waf", - "waf-regional", - "wafv2", - "wellarchitected", - "workdocs", - "worklink", - "workmail", - "workmailmessageflow", - "workspaces", - "xray", + ('AWSMigrationHub', ['1.11.352']), + ('access-management', ['1.9.234', '1.11.352']), + ('accessanalyzer', ['1.9.234', '1.11.352']), + ('account', ['1.11.352']), + ('acm', ['1.9.234', '1.11.352']), + ('acm-pca', ['1.9.234', '1.11.352']), + ('alexaforbusiness', ['1.9.234']), + ('amp', ['1.9.234', '1.11.352']), + ('amplify', ['1.9.234', '1.11.352']), + ('amplifybackend', ['1.9.234', '1.11.352']), + ('amplifyuibuilder', ['1.11.352']), + ('apigateway', ['1.9.234', '1.11.352']), + ('apigatewaymanagementapi', ['1.9.234', '1.11.352']), + ('apigatewayv2', ['1.9.234', '1.11.352']), + ('appconfig', ['1.9.234', '1.11.352']), + ('appconfigdata', ['1.11.352']), + ('appfabric', ['1.11.352']), + ('appflow', ['1.9.234', '1.11.352']), + ('appintegrations', ['1.9.234', '1.11.352']), + ('application-autoscaling', ['1.9.234', '1.11.352']), + ('application-insights', ['1.9.234', '1.11.352']), + ('application-signals', ['1.11.352']), + ('applicationcostprofiler', ['1.11.352']), + ('appmesh', ['1.9.234', '1.11.352']), + ('apprunner', ['1.11.352']), + ('appstream', ['1.9.234', '1.11.352']), + ('appsync', ['1.9.234', '1.11.352']), + ('apptest', ['1.11.352']), + ('arc-zonal-shift', ['1.11.352']), + ('artifact', ['1.11.352']), + ('athena', ['1.9.234', '1.11.352']), + ('auditmanager', ['1.9.234', '1.11.352']), + ('autoscaling', ['1.9.234', '1.11.352']), + ('autoscaling-plans', ['1.9.234', '1.11.352']), + ('awstransfer', ['1.9.234', '1.11.352']), + ('b2bi', ['1.11.352']), + ('backup', ['1.9.234', '1.11.352']), + ('backup-gateway', ['1.11.352']), + ('batch', ['1.9.234', '1.11.352']), + ('bcm-data-exports', ['1.11.352']), + ('bedrock', ['1.11.352']), + ('bedrock-agent', ['1.11.352']), + ('bedrock-agent-runtime', ['1.11.352']), + ('bedrock-runtime', ['1.11.352']), + ('billingconductor', ['1.11.352']), + ('braket', ['1.9.234', '1.11.352']), + ('budgets', ['1.9.234', '1.11.352']), + ('ce', ['1.9.234', '1.11.352']), + ('chatbot', ['1.11.352']), + ('chime', ['1.9.234', '1.11.352']), + ('chime-sdk-identity', ['1.11.352']), + ('chime-sdk-media-pipelines', ['1.11.352']), + ('chime-sdk-meetings', ['1.11.352']), + ('chime-sdk-messaging', ['1.11.352']), + ('chime-sdk-voice', ['1.11.352']), + ('cleanrooms', ['1.11.352']), + ('cleanroomsml', ['1.11.352']), + ('cloud9', ['1.9.234', '1.11.352']), + ('cloudcontrol', ['1.11.352']), + ('clouddirectory', ['1.9.234', '1.11.352']), + ('cloudformation', ['1.9.234', '1.11.352']), + ('cloudfront', ['1.9.234', '1.11.352']), + ('cloudfront-keyvaluestore', ['1.11.352']), + ('cloudhsm', ['1.9.234', '1.11.352']), + ('cloudhsmv2', ['1.9.234', '1.11.352']), + ('cloudsearch', ['1.9.234', '1.11.352']), + ('cloudsearchdomain', ['1.9.234', '1.11.352']), + ('cloudtrail', ['1.9.234', '1.11.352']), + ('cloudtrail-data', ['1.11.352']), + ('codeartifact', ['1.9.234', '1.11.352']), + ('codebuild', ['1.9.234', '1.11.352']), + ('codecatalyst', ['1.11.352']), + ('codecommit', ['1.9.234', '1.11.352']), + ('codeconnections', ['1.11.352']), + ('codedeploy', ['1.9.234', '1.11.352']), + ('codeguru-reviewer', ['1.9.234', '1.11.352']), + ('codeguru-security', ['1.11.352']), + ('codeguruprofiler', ['1.9.234', '1.11.352']), + ('codepipeline', ['1.9.234', '1.11.352']), + ('codestar', ['1.9.234', '1.11.352']), + ('codestar-connections', ['1.9.234', '1.11.352']), + ('codestar-notifications', ['1.9.234', '1.11.352']), + ('cognito-identity', ['1.9.234', '1.11.352']), + ('cognito-idp', ['1.9.234', '1.11.352']), + ('cognito-sync', ['1.9.234', '1.11.352']), + ('comprehend', ['1.9.234', '1.11.352']), + ('comprehendmedical', ['1.9.234', '1.11.352']), + ('compute-optimizer', ['1.9.234', '1.11.352']), + ('config', ['1.9.234', '1.11.352']), + ('connect', ['1.9.234', '1.11.352']), + ('connect-contact-lens', ['1.9.234', '1.11.352']), + ('connectcampaigns', ['1.11.352']), + ('connectcases', ['1.11.352']), + ('connectparticipant', ['1.9.234', '1.11.352']), + ('controlcatalog', ['1.11.352']), + ('controltower', ['1.11.352']), + ('cost-optimization-hub', ['1.11.352']), + ('cur', ['1.9.234', '1.11.352']), + ('customer-profiles', ['1.9.234', '1.11.352']), + ('databrew', ['1.9.234', '1.11.352']), + ('dataexchange', ['1.9.234', '1.11.352']), + ('datapipeline', ['1.9.234', '1.11.352']), + ('datasync', ['1.9.234', '1.11.352']), + ('datazone', ['1.11.352']), + ('dax', ['1.9.234', '1.11.352']), + ('deadline', ['1.11.352']), + ('detective', ['1.9.234', '1.11.352']), + ('devicefarm', ['1.9.234', '1.11.352']), + ('devops-guru', ['1.9.234', '1.11.352']), + ('directconnect', ['1.9.234', '1.11.352']), + ('discovery', ['1.9.234', '1.11.352']), + ('dlm', ['1.9.234', '1.11.352']), + ('dms', ['1.9.234', '1.11.352']), + ('docdb', ['1.9.234', '1.11.352']), + ('docdb-elastic', ['1.11.352']), + ('drs', ['1.11.352']), + ('ds', ['1.9.234', '1.11.352']), + ('dynamodb', ['1.9.234', '1.11.352']), + ('dynamodbstreams', ['1.9.234', '1.11.352']), + ('ebs', ['1.9.234', '1.11.352']), + ('ec2', ['1.9.234', '1.11.352']), + ('ec2-instance-connect', ['1.9.234', '1.11.352']), + ('ecr', ['1.9.234', '1.11.352']), + ('ecr-public', ['1.9.234', '1.11.352']), + ('ecs', ['1.9.234', '1.11.352']), + ('eks', ['1.9.234', '1.11.352']), + ('eks-auth', ['1.11.352']), + ('elastic-inference', ['1.9.234', '1.11.352']), + ('elasticache', ['1.9.234', '1.11.352']), + ('elasticbeanstalk', ['1.9.234', '1.11.352']), + ('elasticfilesystem', ['1.9.234', '1.11.352']), + ('elasticloadbalancing', ['1.9.234', '1.11.352']), + ('elasticloadbalancingv2', ['1.9.234', '1.11.352']), + ('elasticmapreduce', ['1.9.234', '1.11.352']), + ('elastictranscoder', ['1.9.234', '1.11.352']), + ('email', ['1.9.234', '1.11.352']), + ('emr-containers', ['1.9.234', '1.11.352']), + ('emr-serverless', ['1.11.352']), + ('entityresolution', ['1.11.352']), + ('es', ['1.9.234', '1.11.352']), + ('eventbridge', ['1.9.234', '1.11.352']), + ('events', ['1.9.234', '1.11.352']), + ('evidently', ['1.11.352']), + ('finspace', ['1.11.352']), + ('finspace-data', ['1.11.352']), + ('firehose', ['1.9.234', '1.11.352']), + ('fis', ['1.11.352']), + ('fms', ['1.9.234', '1.11.352']), + ('forecast', ['1.9.234', '1.11.352']), + ('forecastquery', ['1.9.234', '1.11.352']), + ('frauddetector', ['1.9.234', '1.11.352']), + ('freetier', ['1.11.352']), + ('fsx', ['1.9.234', '1.11.352']), + ('gamelift', ['1.9.234', '1.11.352']), + ('glacier', ['1.9.234', '1.11.352']), + ('globalaccelerator', ['1.9.234', '1.11.352']), + ('glue', ['1.9.234', '1.11.352']), + ('grafana', ['1.11.352']), + ('greengrass', ['1.9.234', '1.11.352']), + ('greengrassv2', ['1.9.234', '1.11.352']), + ('groundstation', ['1.9.234', '1.11.352']), + ('guardduty', ['1.9.234', '1.11.352']), + ('health', ['1.9.234', '1.11.352']), + ('healthlake', ['1.9.234', '1.11.352']), + ('honeycode', ['1.9.234']), + ('iam', ['1.9.234', '1.11.352']), + ('identity-management', ['1.9.234', '1.11.352']), + ('identitystore', ['1.9.234', '1.11.352']), + ('imagebuilder', ['1.9.234', '1.11.352']), + ('importexport', ['1.9.234', '1.11.352']), + ('inspector', ['1.9.234', '1.11.352']), + ('inspector-scan', ['1.11.352']), + ('inspector2', ['1.11.352']), + ('internetmonitor', ['1.11.352']), + ('iot', ['1.9.234', '1.11.352']), + ('iot-data', ['1.9.234', '1.11.352']), + ('iot-jobs-data', ['1.9.234', '1.11.352']), + ('iot1click-devices', ['1.9.234', '1.11.352']), + ('iot1click-projects', ['1.9.234', '1.11.352']), + ('iotanalytics', ['1.9.234', '1.11.352']), + ('iotdeviceadvisor', ['1.9.234', '1.11.352']), + ('iotevents', ['1.9.234', '1.11.352']), + ('iotevents-data', ['1.9.234', '1.11.352']), + ('iotfleethub', ['1.9.234', '1.11.352']), + ('iotfleetwise', ['1.11.352']), + ('iotsecuretunneling', ['1.9.234', '1.11.352']), + ('iotsitewise', ['1.9.234', '1.11.352']), + ('iotthingsgraph', ['1.9.234', '1.11.352']), + ('iottwinmaker', ['1.11.352']), + ('iotwireless', ['1.9.234', '1.11.352']), + ('ivs', ['1.9.234', '1.11.352']), + ('ivs-realtime', ['1.11.352']), + ('ivschat', ['1.11.352']), + ('kafka', ['1.9.234', '1.11.352']), + ('kafkaconnect', ['1.11.352']), + ('kendra', ['1.9.234', '1.11.352']), + ('kendra-ranking', ['1.11.352']), + ('keyspaces', ['1.11.352']), + ('kinesis', ['1.9.234', '1.11.352']), + ('kinesis-video-archived-media', ['1.9.234', '1.11.352']), + ('kinesis-video-media', ['1.9.234', '1.11.352']), + ('kinesis-video-signaling', ['1.9.234', '1.11.352']), + ('kinesis-video-webrtc-storage', ['1.11.352']), + ('kinesisanalytics', ['1.9.234', '1.11.352']), + ('kinesisanalyticsv2', ['1.9.234', '1.11.352']), + ('kinesisvideo', ['1.9.234', '1.11.352']), + ('kms', ['1.9.234', '1.11.352']), + ('lakeformation', ['1.9.234', '1.11.352']), + ('lambda', ['1.9.234', '1.11.352']), + ('launch-wizard', ['1.11.352']), + ('lex', ['1.9.234', '1.11.352']), + ('lex-models', ['1.9.234', '1.11.352']), + ('lexv2-models', ['1.9.234', '1.11.352']), + ('lexv2-runtime', ['1.9.234', '1.11.352']), + ('license-manager', ['1.9.234', '1.11.352']), + ('license-manager-linux-subscriptions', ['1.11.352']), + ('license-manager-user-subscriptions', ['1.11.352']), + ('lightsail', ['1.9.234', '1.11.352']), + ('location', ['1.9.234', '1.11.352']), + ('logs', ['1.9.234', '1.11.352']), + ('lookoutequipment', ['1.11.352']), + ('lookoutmetrics', ['1.11.352']), + ('lookoutvision', ['1.9.234', '1.11.352']), + ('m2', ['1.11.352']), + ('machinelearning', ['1.9.234', '1.11.352']), + ('macie', ['1.9.234']), + ('macie2', ['1.9.234', '1.11.352']), + ('mailmanager', ['1.11.352']), + ('managedblockchain', ['1.9.234', '1.11.352']), + ('managedblockchain-query', ['1.11.352']), + ('marketplace-agreement', ['1.11.352']), + ('marketplace-catalog', ['1.9.234', '1.11.352']), + ('marketplace-deployment', ['1.11.352']), + ('marketplace-entitlement', ['1.9.234', '1.11.352']), + ('marketplacecommerceanalytics', ['1.9.234', '1.11.352']), + ('mediaconnect', ['1.9.234', '1.11.352']), + ('mediaconvert', ['1.9.234', '1.11.352']), + ('medialive', ['1.9.234', '1.11.352']), + ('mediapackage', ['1.9.234', '1.11.352']), + ('mediapackage-vod', ['1.9.234', '1.11.352']), + ('mediapackagev2', ['1.11.352']), + ('mediastore', ['1.9.234', '1.11.352']), + ('mediastore-data', ['1.9.234', '1.11.352']), + ('mediatailor', ['1.9.234', '1.11.352']), + ('medical-imaging', ['1.11.352']), + ('memorydb', ['1.11.352']), + ('meteringmarketplace', ['1.9.234', '1.11.352']), + ('mgn', ['1.11.352']), + ('migration-hub-refactor-spaces', ['1.11.352']), + ('migrationhub-config', ['1.9.234', '1.11.352']), + ('migrationhuborchestrator', ['1.11.352']), + ('migrationhubstrategy', ['1.11.352']), + ('mobile', ['1.9.234', '1.11.352']), + ('mobileanalytics', ['1.9.234']), + ('monitoring', ['1.9.234', '1.11.352']), + ('mq', ['1.9.234', '1.11.352']), + ('mturk-requester', ['1.9.234', '1.11.352']), + ('mwaa', ['1.9.234', '1.11.352']), + ('neptune', ['1.9.234', '1.11.352']), + ('neptune-graph', ['1.11.352']), + ('neptunedata', ['1.11.352']), + ('network-firewall', ['1.9.234', '1.11.352']), + ('networkmanager', ['1.9.234', '1.11.352']), + ('networkmonitor', ['1.11.352']), + ('nimble', ['1.11.352']), + ('oam', ['1.11.352']), + ('omics', ['1.11.352']), + ('opensearch', ['1.11.352']), + ('opensearchserverless', ['1.11.352']), + ('opsworks', ['1.9.234', '1.11.352']), + ('opsworkscm', ['1.9.234', '1.11.352']), + ('organizations', ['1.9.234', '1.11.352']), + ('osis', ['1.11.352']), + ('outposts', ['1.9.234', '1.11.352']), + ('panorama', ['1.11.352']), + ('payment-cryptography', ['1.11.352']), + ('payment-cryptography-data', ['1.11.352']), + ('pca-connector-ad', ['1.11.352']), + ('pca-connector-scep', ['1.11.352']), + ('personalize', ['1.9.234', '1.11.352']), + ('personalize-events', ['1.9.234', '1.11.352']), + ('personalize-runtime', ['1.9.234', '1.11.352']), + ('pi', ['1.9.234', '1.11.352']), + ('pinpoint', ['1.9.234', '1.11.352']), + ('pinpoint-email', ['1.9.234', '1.11.352']), + ('pinpoint-sms-voice-v2', ['1.11.352']), + ('pipes', ['1.11.352']), + ('polly', ['1.9.234', '1.11.352']), + # ('polly-sample', ['1.9.234']), # This gets generated, but is only sample code + ('pricing', ['1.9.234', '1.11.352']), + ('privatenetworks', ['1.11.352']), + ('proton', ['1.11.352']), + ('qbusiness', ['1.11.352']), + ('qconnect', ['1.11.352']), + ('qldb', ['1.9.234', '1.11.352']), + ('qldb-session', ['1.9.234', '1.11.352']), + ('queues', ['1.9.234', '1.11.352']), + ('quicksight', ['1.9.234', '1.11.352']), + ('ram', ['1.9.234', '1.11.352']), + ('rbin', ['1.11.352']), + ('rds', ['1.9.234', '1.11.352']), + ('rds-data', ['1.9.234', '1.11.352']), + ('redshift', ['1.9.234', '1.11.352']), + ('redshift-data', ['1.9.234', '1.11.352']), + ('redshift-serverless', ['1.11.352']), + ('rekognition', ['1.9.234', '1.11.352']), + ('repostspace', ['1.11.352']), + ('resiliencehub', ['1.11.352']), + ('resource-explorer-2', ['1.11.352']), + ('resource-groups', ['1.9.234', '1.11.352']), + ('resourcegroupstaggingapi', ['1.9.234', '1.11.352']), + ('robomaker', ['1.9.234', '1.11.352']), + ('rolesanywhere', ['1.11.352']), + ('route53', ['1.9.234', '1.11.352']), + ('route53-recovery-cluster', ['1.11.352']), + ('route53-recovery-control-config', ['1.11.352']), + ('route53-recovery-readiness', ['1.11.352']), + ('route53domains', ['1.9.234', '1.11.352']), + ('route53profiles', ['1.11.352']), + ('route53resolver', ['1.9.234', '1.11.352']), + ('rum', ['1.11.352']), + ('s3', ['1.9.234', '1.11.352']), + ('s3-crt', ['1.9.234', '1.11.352']), + ('s3-encryption', ['1.9.234', '1.11.352']), + ('s3control', ['1.9.234', '1.11.352']), + ('s3outposts', ['1.9.234', '1.11.352']), + ('sagemaker', ['1.9.234', '1.11.352']), + ('sagemaker-a2i-runtime', ['1.9.234', '1.11.352']), + ('sagemaker-edge', ['1.9.234', '1.11.352']), + ('sagemaker-featurestore-runtime', ['1.9.234', '1.11.352']), + ('sagemaker-geospatial', ['1.11.352']), + ('sagemaker-metrics', ['1.11.352']), + ('sagemaker-runtime', ['1.9.234', '1.11.352']), + ('savingsplans', ['1.9.234', '1.11.352']), + ('scheduler', ['1.11.352']), + ('schemas', ['1.9.234', '1.11.352']), + ('sdb', ['1.9.234', '1.11.352']), + ('secretsmanager', ['1.9.234', '1.11.352']), + ('securityhub', ['1.9.234', '1.11.352']), + ('securitylake', ['1.11.352']), + ('serverlessrepo', ['1.9.234', '1.11.352']), + ('service-quotas', ['1.9.234', '1.11.352']), + ('servicecatalog', ['1.9.234', '1.11.352']), + ('servicecatalog-appregistry', ['1.9.234', '1.11.352']), + ('servicediscovery', ['1.9.234', '1.11.352']), + ('sesv2', ['1.9.234', '1.11.352']), + ('shield', ['1.9.234', '1.11.352']), + ('signer', ['1.9.234', '1.11.352']), + ('simspaceweaver', ['1.11.352']), + ('sms', ['1.9.234', '1.11.352']), + ('sms-voice', ['1.9.234', '1.11.352']), + ('snow-device-management', ['1.11.352']), + ('snowball', ['1.9.234', '1.11.352']), + ('sns', ['1.9.234', '1.11.352']), + ('sqs', ['1.9.234', '1.11.352']), + ('ssm', ['1.9.234', '1.11.352']), + ('ssm-contacts', ['1.11.352']), + ('ssm-incidents', ['1.11.352']), + ('ssm-sap', ['1.11.352']), + ('sso', ['1.9.234', '1.11.352']), + ('sso-admin', ['1.9.234', '1.11.352']), + ('sso-oidc', ['1.9.234', '1.11.352']), + ('states', ['1.9.234', '1.11.352']), + ('storagegateway', ['1.9.234', '1.11.352']), + ('sts', ['1.9.234', '1.11.352']), + ('supplychain', ['1.11.352']), + ('support', ['1.9.234', '1.11.352']), + ('support-app', ['1.11.352']), + ('swf', ['1.9.234', '1.11.352']), + ('synthetics', ['1.9.234', '1.11.352']), + ('taxsettings', ['1.11.352']), + ('text-to-speech', ['1.9.234', '1.11.352']), + ('textract', ['1.9.234', '1.11.352']), + ('timestream-influxdb', ['1.11.352']), + ('timestream-query', ['1.9.234', '1.11.352']), + ('timestream-write', ['1.9.234', '1.11.352']), + ('tnb', ['1.11.352']), + ('transcribe', ['1.9.234', '1.11.352']), + ('transcribestreaming', ['1.9.234', '1.11.352']), + ('transfer', ['1.9.234', '1.11.352']), + ('translate', ['1.9.234', '1.11.352']), + ('trustedadvisor', ['1.11.352']), + ('verifiedpermissions', ['1.11.352']), + ('voice-id', ['1.11.352']), + ('vpc-lattice', ['1.11.352']), + ('waf', ['1.9.234', '1.11.352']), + ('waf-regional', ['1.9.234', '1.11.352']), + ('wafv2', ['1.9.234', '1.11.352']), + ('wellarchitected', ['1.9.234', '1.11.352']), + ('wisdom', ['1.11.352']), + ('workdocs', ['1.9.234', '1.11.352']), + ('worklink', ['1.9.234', '1.11.352']), + ('workmail', ['1.9.234', '1.11.352']), + ('workmailmessageflow', ['1.9.234', '1.11.352']), + ('workspaces', ['1.9.234', '1.11.352']), + ('workspaces-thin-client', ['1.11.352']), + ('workspaces-web', ['1.11.352']), + ('xray', ['1.9.234', '1.11.352']) ) options = { **{ @@ -292,32 +429,24 @@ class AwsSdkCppConan(ConanFile): "fPIC": [True, False], "min_size": [True, False], }, - **{ x: [True, False] for x in _sdks}, + **{sdk_name: [None, True, False] for sdk_name, _ in _sdks}, + } + default_options = { + **{ + "shared": False, + "fPIC": True, + "min_size": False + }, + **{sdk_name: None for sdk_name, _ in _sdks}, + # Overrides + "monitoring": True # TODO: Clarify why monitoring is True by default } - default_options = {key: False for key in options.keys()} - default_options["fPIC"] = True - default_options["access-management"] = True - default_options["identity-management"] = True - default_options["monitoring"] = True - default_options["queues"] = True - default_options["s3-encryption"] = True - default_options["transfer"] = True - default_options["text-to-speech"] = True - - generators = "cmake", "cmake_find_package" - short_paths = True - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] + short_paths = True @property def _internal_requirements(self): + # These modules and dependencies come from https://github.com/aws/aws-sdk-cpp/blob/1.11.352/cmake/sdksCommon.cmake#L147 and below return { "access-management": ["iam", "cognito-identity"], "identity-management": ["cognito-identity", "sts"], @@ -327,111 +456,183 @@ def _internal_requirements(self): "transfer": ["s3"], } - @property - def _use_aws_crt_cpp(self): - return tools.Version(self.version) >= "1.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": del self.options.fPIC - if tools.Version(self.version) < "1.9": - delattr(self.options, "s3-crt") + + # Main modules are true by default, but the user can set them to false + for module in self._internal_requirements: + setattr(self.options, module, True) + + # Remove all sdk options not belonging to the current version + for sdk_name, sdk_versions in self._sdks: + if self.version not in sdk_versions: + self.options.rm_safe(sdk_name) def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + # If the user does not specify a value for a specific sdk: + # - Set it to True if it's a dependency of a main module that is set to True + for module, dependencies in self._internal_requirements.items(): + if self.options.get_safe(module): + for dependency in dependencies: + # Don't listen to the linter, get_safe should be compared like this to None + # TODO: Remove str comparison when Conan 1 is disabled + if str(self.options.get_safe(dependency)) == "None": + setattr(self.options, dependency, True) + + # - Otherwise set it to False + # This way there are no None options past this method, and we can control default values + # of the dependencies of the main modules but still give the user control over them + for sdk_name, sdk_versions in self._sdks: + # == None is true for both "was deleted" and "was not set by the user", + # ensure we only try to set the value to false for the latter + if self.version in sdk_versions and self.options.get_safe(sdk_name) == None: + setattr(self.options, sdk_name, False) + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("aws-c-common/0.6.19") - if self._use_aws_crt_cpp: - self.requires("aws-c-cal/0.5.13") - self.requires("aws-c-http/0.6.13") - self.requires("aws-c-io/0.10.20") - self.requires("aws-crt-cpp/0.17.23") - else: + # These versions come from prefetch_crt_dependency.sh, + # dont bump them independently, check the file + if self.version == "1.11.352": + self.requires("aws-crt-cpp/0.26.9", transitive_headers=True) + self.requires("aws-c-auth/0.7.16") + self.requires("aws-c-cal/0.6.14") + self.requires("aws-c-common/0.9.15") + self.requires("aws-c-compression/0.2.18") # No mention of this in the code + self.requires("aws-c-event-stream/0.4.2") + self.requires("aws-c-http/0.8.1") + self.requires("aws-c-io/0.14.7") + self.requires("aws-c-mqtt/0.10.3") + if self.options.get_safe("s3-crt"): + self.requires("aws-c-s3/0.5.5") + self.requires("aws-c-sdkutils/0.1.15") # No mention of this in the code + self.requires("aws-checksums/0.1.18") + # missing aws-lc, but only needed as openssl replacement if USE_OPENSSL is OFF + if self.settings.os in ["Linux", "FreeBSD", "Android"]: + self.requires("s2n/1.4.16") # No mention of this in the code, we might be overlinking + if self.version == "1.9.234": + self.requires("aws-crt-cpp/0.17.1a", transitive_headers=True) + self.requires("aws-c-auth/0.6.4") + self.requires("aws-c-cal/0.5.12") + self.requires("aws-c-common/0.6.11") + self.requires("aws-c-compression/0.2.14") self.requires("aws-c-event-stream/0.2.7") + self.requires("aws-c-http/0.6.7") + self.requires("aws-c-io/0.10.9") + self.requires("aws-c-mqtt/0.7.8") + if self.options.get_safe("s3-crt"): + self.requires("aws-c-s3/0.1.26") + self.requires("aws-checksums/0.1.12") + if self.settings.os in ["Linux", "FreeBSD", "Android"]: + self.requires("s2n/1.3.15") # No mention of this in the code, we might be overlinking if self.settings.os != "Windows": - self.requires("openssl/1.1.1n") - self.requires("libcurl/7.80.0") - if self.settings.os in ["Linux", "FreeBSD"]: + # Used transitively in core/utils/crypto/openssl/CryptoImpl.h public header + self.requires("openssl/[>=1.1 <4]", transitive_headers=True) + # Used transitively in core/http/curl/CurlHandleContainer.h public header + self.requires("libcurl/[>=7.78.0 <9]", transitive_headers=True) + if self.settings.os == "Linux": + # Pulseaudio -> libcap, libalsa only support linux, don't use pulseaudio on other platforms if self.options.get_safe("text-to-speech"): - self.requires("pulseaudio/14.2") + # Used transitively in text-to-speech/PulseAudioPCMOutputDriver.h public header + self.requires("pulseaudio/14.2", transitive_headers=True, transitive_libs=True) + # zlib is used if ENABLE_ZLIB_REQUEST_COMPRESSION is enabled, set ot ON by default + self.requires("zlib/[>=1.2.11 <2]") + + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) + + def validate_build(self): + if self._settings_build.os == "Windows" and self.settings.os == "Android": + raise ConanInvalidConfiguration("Cross-building from Windows to Android is not supported") - def validate(self): if (self.options.shared - and self.settings.compiler == "gcc" - and tools.Version(self.settings.compiler.version) < "6.0"): + and self.settings.compiler == "gcc" + and Version(self.settings.compiler.version) < "6.0"): raise ConanInvalidConfiguration( "Doesn't support gcc5 / shared. " "See https://github.com/conan-io/conan-center-index/pull/4401#issuecomment-802631744" ) - if (tools.Version(self.version) < "1.9.234" - and self.settings.compiler == "gcc" - and tools.Version(self.settings.compiler.version) >= "11.0" - and self.settings.build_type == "Release"): - raise ConanInvalidConfiguration( - "Versions prior to 1.9.234 don't support release builds on >= gcc 11 " - "See https://github.com/aws/aws-sdk-cpp/issues/1505" - ) - if self._use_aws_crt_cpp: - if self._is_msvc and "MT" in msvc_runtime_flag(self): - raise ConanInvalidConfiguration("Static runtime is not working for more recent releases") - else: - if self.settings.os == "Macos" and self.settings.arch == "armv8": - raise ConanInvalidConfiguration( - "This version doesn't support arm8. " - "See https://github.com/aws/aws-sdk-cpp/issues/1542" - ) - - def package_id(self): - for hl_comp in self._internal_requirements.keys(): - if getattr(self.options, hl_comp): - for internal_requirement in self._internal_requirements[hl_comp]: - setattr(self.info.options, internal_requirement, True) - def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + def validate(self): + if is_msvc(self) and is_msvc_static_runtime(self): + raise ConanInvalidConfiguration("Static runtime is not working for more recent releases") + if (is_msvc(self) and self.options.shared + and not self.dependencies["aws-c-common"].options.shared): + raise ConanInvalidConfiguration(f"{self.ref} with shared is not supported with aws-c-common static") + + # If the user has explicitly set a main module dependency to False, + # error out if the main module itself is not also disabled + for main_module, dependencies in self._internal_requirements.items(): + if self.options.get_safe(main_module): + for internal_requirement in dependencies: + if not self.options.get_safe(internal_requirement): + raise ConanInvalidConfiguration(f"-o={self.ref}:{main_module}=True requires -o={self.ref}:{internal_requirement}=True") - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) - build_only = ["core"] + def _enabled_sdks(self): for sdk in self._sdks: - if self.options.get_safe(sdk): - build_only.append(sdk) - self._cmake.definitions["BUILD_ONLY"] = ";".join(build_only) - - self._cmake.definitions["ENABLE_UNITY_BUILD"] = True - self._cmake.definitions["ENABLE_TESTING"] = False - self._cmake.definitions["AUTORUN_UNIT_TESTS"] = False - self._cmake.definitions["BUILD_DEPS"] = False - if self.settings.os != "Windows": - self._cmake.definitions["ENABLE_OPENSSL_ENCRYPTION"] = True + if self.options.get_safe(sdk[0]): + yield sdk - self._cmake.definitions["MINIMIZE_SIZE"] = self.options.min_size - if self._is_msvc and not self._use_aws_crt_cpp: - self._cmake.definitions["FORCE_SHARED_CRT"] = "MD" in msvc_runtime_flag(self) + def generate(self): + tc = CMakeToolchain(self) + # All option() are defined before project() in upstream CMakeLists, + # therefore we must use cache_variables - if tools.cross_building(self): - self._cmake.definitions["CURL_HAS_H2_EXITCODE"] = "0" - self._cmake.definitions["CURL_HAS_H2_EXITCODE__TRYRUN_OUTPUT"] = "" - self._cmake.definitions["CURL_HAS_TLS_PROXY_EXITCODE"] = "0" - self._cmake.definitions["CURL_HAS_TLS_PROXY_EXITCODE__TRYRUN_OUTPUT"] = "" - self._cmake.configure() - return self._cmake + build_only = ["core"] + for sdk_name, _ in self._enabled_sdks(): + build_only.append(sdk_name) + tc.cache_variables["BUILD_ONLY"] = ";".join(build_only) + + tc.cache_variables["ENABLE_UNITY_BUILD"] = True + tc.cache_variables["ENABLE_TESTING"] = False + tc.cache_variables["AUTORUN_UNIT_TESTS"] = False + tc.cache_variables["BUILD_DEPS"] = False + if self.settings.os != "Windows": + tc.cache_variables["USE_OPENSSL"] = True + tc.cache_variables["ENABLE_OPENSSL_ENCRYPTION"] = True + + tc.cache_variables["MINIMIZE_SIZE"] = self.options.min_size + if is_msvc(self): + tc.cache_variables["FORCE_SHARED_CRT"] = not is_msvc_static_runtime(self) + + if cross_building(self): + tc.cache_variables["CURL_HAS_H2_EXITCODE"] = "0" + tc.cache_variables["CURL_HAS_H2_EXITCODE__TRYRUN_OUTPUT"] = "" + tc.cache_variables["CURL_HAS_TLS_PROXY_EXITCODE"] = "0" + tc.cache_variables["CURL_HAS_TLS_PROXY_EXITCODE__TRYRUN_OUTPUT"] = "" + if is_msvc(self): + tc.preprocessor_definitions["_SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING"] = "1" + tc.cache_variables["BUILD_SHARED_LIBS"] = self.options.shared + tc.generate() + + deps = CMakeDeps(self) + deps.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + # Disable warnings as errors + if self.version == "1.9.234": + replace_in_file( + self, os.path.join(self.source_folder, "cmake", "compiler_settings.cmake"), + 'list(APPEND AWS_COMPILER_WARNINGS "-Wall" "-Werror" "-pedantic" "-Wextra")', "", + ) 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() @property @@ -440,68 +641,85 @@ def _res_folder(self): def _create_project_cmake_module(self): # package files needed to build other components (e.g. aws-cdi-sdk) with this SDK - for file in [ + dependant_files = [ "cmake/compiler_settings.cmake", "cmake/initialize_project_version.cmake", "cmake/utilities.cmake", "cmake/sdk_plugin_conf.cmake", "toolchains/cmakeProjectConfig.cmake", - "toolchains/pkg-config.pc.in", - "aws-cpp-sdk-core/include/aws/core/VersionConfig.h" - ]: - self.copy(file, src=self._source_subfolder, dst=self._res_folder) - tools.replace_in_file(os.path.join(self.package_folder, self._res_folder, file), "CMAKE_CURRENT_SOURCE_DIR", "AWS_NATIVE_SDK_ROOT", strict=False) + "toolchains/pkg-config.pc.in" + ] + if Version(self.version) >= "1.11.352": + dependant_files.append("src/aws-cpp-sdk-core/include/aws/core/VersionConfig.h") + else: + dependant_files.append("aws-cpp-sdk-core/include/aws/core/VersionConfig.h") + for file in dependant_files: + copy(self, file, src=self.source_folder, dst=os.path.join(self.package_folder, self._res_folder)) + replace_in_file( + self, os.path.join(self.package_folder, self._res_folder, file), + "CMAKE_CURRENT_SOURCE_DIR", "AWS_NATIVE_SDK_ROOT", + strict=False, + ) # avoid getting error from hook - with tools.chdir(os.path.join(self.package_folder, self._res_folder)): - rename(self, os.path.join("toolchains", "cmakeProjectConfig.cmake"), os.path.join("toolchains", "cmakeProjectConf.cmake")) - tools.replace_in_file(os.path.join("cmake", "utilities.cmake"), "cmakeProjectConfig.cmake", "cmakeProjectConf.cmake") + rename(self, os.path.join(self.package_folder, self._res_folder, "toolchains", "cmakeProjectConfig.cmake"), + os.path.join(self.package_folder, self._res_folder, "toolchains", "cmakeProjectConf.cmake")) + replace_in_file( + self, os.path.join(self.package_folder, self._res_folder, "cmake", "utilities.cmake"), + "cmakeProjectConfig.cmake", "cmakeProjectConf.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() - if self._is_msvc: - self.copy(pattern="*.lib", dst="lib", keep_path=False) - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), "*.lib") + if is_msvc(self): + copy(self, "*.lib", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + rm(self, "*.lib", os.path.join(self.package_folder, "bin")) - 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")) self._create_project_cmake_module() def package_info(self): self.cpp_info.set_property("cmake_file_name", "AWSSDK") + sdk_plugin_conf = os.path.join(self._res_folder, "cmake", "sdk_plugin_conf.cmake") + self.cpp_info.set_property("cmake_build_modules", [sdk_plugin_conf]) + # core component self.cpp_info.components["core"].set_property("cmake_target_name", "AWS::aws-sdk-cpp-core") self.cpp_info.components["core"].set_property("pkg_config_name", "aws-sdk-cpp-core") self.cpp_info.components["core"].libs = ["aws-cpp-sdk-core"] - self.cpp_info.components["core"].requires = ["aws-c-common::aws-c-common-lib"] - if self._use_aws_crt_cpp: + self.cpp_info.components["core"].requires = [ + "aws-crt-cpp::aws-crt-cpp", + "aws-c-auth::aws-c-auth", + "aws-c-cal::aws-c-cal", + "aws-c-common::aws-c-common", + "aws-c-compression::aws-c-compression", + "aws-c-event-stream::aws-c-event-stream", + "aws-c-http::aws-c-http", + "aws-c-io::aws-c-io", + "aws-c-mqtt::aws-c-mqtt", + "aws-checksums::aws-checksums", + "zlib::zlib" + ] + + if self.settings.os in ["Linux", "FreeBSD", "Android"]: + self.cpp_info.components["core"].requires.append("s2n::s2n") + + if Version(self.version) >= "1.11.352": self.cpp_info.components["core"].requires.extend([ - "aws-c-cal::aws-c-cal-lib", - "aws-c-http::aws-c-http-lib", - "aws-c-io::aws-c-io-lib", - "aws-crt-cpp::aws-crt-cpp-lib", + "aws-c-sdkutils::aws-c-sdkutils", ]) - else: - self.cpp_info.components["core"].requires.append("aws-c-event-stream::aws-c-event-stream-lib") - - # other components - enabled_sdks = [sdk for sdk in self._sdks if self.options.get_safe(sdk)] - for hl_comp in self._internal_requirements.keys(): - if getattr(self.options, hl_comp): - for internal_requirement in self._internal_requirements[hl_comp]: - if internal_requirement not in enabled_sdks: - enabled_sdks.append(internal_requirement) - for sdk in enabled_sdks: + for sdk, _ in self._enabled_sdks(): # TODO: there is no way to properly emulate COMPONENTS names for # find_package(AWSSDK COMPONENTS ) in set_property() # right now: see https://github.com/conan-io/conan/issues/10258 - self.cpp_info.components[sdk].set_property("cmake_target_name", "AWS::aws-sdk-cpp-{}".format(sdk)) - self.cpp_info.components[sdk].set_property("pkg_config_name", "aws-sdk-cpp-{}".format(sdk)) + self.cpp_info.components[sdk].set_property("cmake_target_name", f"AWS::aws-sdk-cpp-{sdk}") + self.cpp_info.components[sdk].set_property("pkg_config_name", f"aws-sdk-cpp-{sdk}") self.cpp_info.components[sdk].requires = ["core"] if sdk in self._internal_requirements: self.cpp_info.components[sdk].requires.extend(self._internal_requirements[sdk]) @@ -510,7 +728,7 @@ def package_info(self): # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.components[sdk].names["cmake_find_package"] = "aws-sdk-cpp-" + sdk self.cpp_info.components[sdk].names["cmake_find_package_multi"] = "aws-sdk-cpp-" + sdk - component_alias = "aws-sdk-cpp-{}_alias".format(sdk) # to emulate COMPONENTS names for find_package() + component_alias = f"aws-sdk-cpp-{sdk}_alias" # to emulate COMPONENTS names for find_package() self.cpp_info.components[component_alias].names["cmake_find_package"] = sdk self.cpp_info.components[component_alias].names["cmake_find_package_multi"] = sdk self.cpp_info.components[component_alias].requires = [sdk] @@ -525,18 +743,28 @@ def package_info(self): else: self.cpp_info.components["core"].requires.extend(["libcurl::curl", "openssl::openssl"]) - if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.components["core"].system_libs.append("atomic") + if self.settings.os == "Linux": if self.options.get_safe("text-to-speech"): self.cpp_info.components["text-to-speech"].requires.append("pulseaudio::pulseaudio") + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["core"].system_libs.append("atomic") + + if self.options.get_safe("s3-crt"): + self.cpp_info.components["s3-crt"].requires.append("aws-c-s3::aws-c-s3") + if self.settings.os == "Macos": if self.options.get_safe("text-to-speech"): - self.cpp_info.components["text-to-speech"].frameworks.append("CoreAudio") + self.cpp_info.components["text-to-speech"].frameworks.extend(["CoreAudio", "AudioToolbox"]) - lib_stdcpp = tools.stdcpp_library(self) - if lib_stdcpp: - self.cpp_info.components["core"].system_libs.append(lib_stdcpp) + libcxx = stdcpp_library(self) + if libcxx: + self.cpp_info.components["core"].system_libs.append(libcxx) + + self.cpp_info.components["plugin_scripts"].requires = ["core"] + self.cpp_info.components["plugin_scripts"].builddirs.extend([ + os.path.join(self._res_folder, "cmake"), + os.path.join(self._res_folder, "toolchains")]) # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.filenames["cmake_find_package"] = "AWSSDK" @@ -545,9 +773,5 @@ def package_info(self): self.cpp_info.names["cmake_find_package_multi"] = "AWS" self.cpp_info.components["core"].names["cmake_find_package"] = "aws-sdk-cpp-core" self.cpp_info.components["core"].names["cmake_find_package_multi"] = "aws-sdk-cpp-core" - - self.cpp_info.components["plugin_scripts"].requires = ["core"] - self.cpp_info.components["plugin_scripts"].builddirs.extend([ - os.path.join(self._res_folder, "cmake"), - os.path.join(self._res_folder, "toolchains")]) - self.cpp_info.components["plugin_scripts"].build_modules.append(os.path.join(self._res_folder, "cmake", "sdk_plugin_conf.cmake")) + self.cpp_info.components["plugin_scripts"].build_modules["cmake_find_package"] = [sdk_plugin_conf] + self.cpp_info.components["plugin_scripts"].build_modules["cmake_find_package_multi"] = [sdk_plugin_conf] diff --git a/recipes/aws-sdk-cpp/all/patches/1.11.352-0001-pulseaudio.patch b/recipes/aws-sdk-cpp/all/patches/1.11.352-0001-pulseaudio.patch new file mode 100644 index 0000000000000..c2a64d3dd0446 --- /dev/null +++ b/recipes/aws-sdk-cpp/all/patches/1.11.352-0001-pulseaudio.patch @@ -0,0 +1,32 @@ +diff --git a/src/aws-cpp-sdk-text-to-speech/CMakeLists.txt b/src/aws-cpp-sdk-text-to-speech/CMakeLists.txt +index 5a40f1906..4136a4690 100644 +--- a/src/aws-cpp-sdk-text-to-speech/CMakeLists.txt ++++ b/src/aws-cpp-sdk-text-to-speech/CMakeLists.txt +@@ -9,8 +9,6 @@ file( GLOB TEXT_TO_SPEECH_HEADERS "include/aws/text-to-speech/*.h" ) + + set(PLATFORM_LIBS "") + +-check_include_files("pulse/simple.h" HAVE_PULSE) +- + if(PLATFORM_WINDOWS) + file( GLOB TEXT_TO_SPEECH_PLATFORM_HEADERS "include/aws/text-to-speech/windows/*.h" ) + file( GLOB TEXT_TO_SPEECH_PLATFORM_SOURCE "source/text-to-speech/windows/*.cpp" ) +@@ -19,14 +17,15 @@ if(PLATFORM_WINDOWS) + set(PLATFORM_LIBS ${PLATFORM_LIBS} Winmm) + endif() + +-if (PLATFORM_LINUX) +- if(HAVE_PULSE) ++if (CMAKE_SYSTEM_NAME STREQUAL "Linux") ++ find_package(pulseaudio) ++ if(pulseaudio_FOUND) + file( GLOB TEXT_TO_SPEECH_PLATFORM_HEADERS "include/aws/text-to-speech/linux/*.h" ) + file( GLOB TEXT_TO_SPEECH_PLATFORM_SOURCE "source/text-to-speech/linux/*.cpp" ) + + message(STATUS "Pulse audio header files have been detected, included pulse audio as a possible sound driver implementation.") + add_definitions("-DPULSE") +- set(PLATFORM_LIBS ${PLATFORM_LIBS} pulse pulse-simple) ++ set(PLATFORM_LIBS ${PLATFORM_LIBS} "pulseaudio::pulseaudio") + else() + message(WARNING "We've detected that you are building on linux, but the header files for pulseaudio are not available.\ + If you are providing your own audio implementation or you will not be using the text-to-speech library, this is fine.\ diff --git a/recipes/aws-sdk-cpp/all/patches/1.11.352-0002-disable-sort-links.patch b/recipes/aws-sdk-cpp/all/patches/1.11.352-0002-disable-sort-links.patch new file mode 100644 index 0000000000000..9ba1170c20c17 --- /dev/null +++ b/recipes/aws-sdk-cpp/all/patches/1.11.352-0002-disable-sort-links.patch @@ -0,0 +1,13 @@ +diff --git a/cmake/sdks.cmake b/cmake/sdks.cmake +index 1b1ada7fc..606f5db18 100644 +--- a/cmake/sdks.cmake ++++ b/cmake/sdks.cmake +@@ -271,7 +271,7 @@ function(add_sdks) + + # the catch-all config needs to list all the targets in a dependency-sorted order + include(dependencies) +- sort_links(EXPORTS) ++ #sort_links(EXPORTS) + + # make an everything config by just including all the individual configs + file(WRITE ${CMAKE_BINARY_DIR}/aws-sdk-cpp-config.cmake "") \ No newline at end of file diff --git a/recipes/aws-sdk-cpp/all/patches/1.8.130-0001-disable-sort-links.patch b/recipes/aws-sdk-cpp/all/patches/1.8.130-0001-disable-sort-links.patch deleted file mode 100644 index bd8fbce5589dc..0000000000000 --- a/recipes/aws-sdk-cpp/all/patches/1.8.130-0001-disable-sort-links.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/cmake/sdks.cmake b/cmake/sdks.cmake -index 975281faaa..ebedbcc6e5 100644 ---- a/cmake/sdks.cmake -+++ b/cmake/sdks.cmake -@@ -236,7 +236,7 @@ function(add_sdks) - - # the catch-all config needs to list all the targets in a dependency-sorted order - include(dependencies) -- sort_links(EXPORTS) -+ # sort_links(EXPORTS) - - # make an everything config by just including all the individual configs - file(WRITE ${CMAKE_BINARY_DIR}/aws-sdk-cpp-config.cmake "") diff --git a/recipes/aws-sdk-cpp/all/patches/1.8.130-0002-force-archive-directory-to-library-directory.patch b/recipes/aws-sdk-cpp/all/patches/1.8.130-0002-force-archive-directory-to-library-directory.patch deleted file mode 100644 index ae9310e5bb684..0000000000000 --- a/recipes/aws-sdk-cpp/all/patches/1.8.130-0002-force-archive-directory-to-library-directory.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index a653e38628..6761052856 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -295,11 +295,7 @@ if (CMAKE_INSTALL_INCLUDEDIR) - set(INCLUDE_DIRECTORY "${CMAKE_INSTALL_INCLUDEDIR}") - endif() - --if(BUILD_SHARED_LIBS) -- set(ARCHIVE_DIRECTORY "${BINARY_DIRECTORY}") --else() -- set(ARCHIVE_DIRECTORY "${LIBRARY_DIRECTORY}") --endif() -+set(ARCHIVE_DIRECTORY "${LIBRARY_DIRECTORY}") - - if (ENABLE_ADDRESS_SANITIZER) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -g -fno-omit-frame-pointer") diff --git a/recipes/aws-sdk-cpp/all/patches/1.8.130-0003-disable-cmake-install-rpath-use-link-path.patch b/recipes/aws-sdk-cpp/all/patches/1.8.130-0003-disable-cmake-install-rpath-use-link-path.patch deleted file mode 100644 index 6f85ba392127f..0000000000000 --- a/recipes/aws-sdk-cpp/all/patches/1.8.130-0003-disable-cmake-install-rpath-use-link-path.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index a653e38628..4aac800fde 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -142,7 +142,7 @@ else() - endif() - - # Add Linker search paths to RPATH so as to fix the problem where some linkers can't find cross-compiled dependent libraries in customer paths when linking executables. --set(CMAKE_INSTALL_RPATH_USE_LINK_PATH true) -+# set(CMAKE_INSTALL_RPATH_USE_LINK_PATH true) - - # build third-party targets - if (BUILD_DEPS) diff --git a/recipes/aws-sdk-cpp/all/patches/1.8.130-0004-improve-pulseaudio-detection.patch b/recipes/aws-sdk-cpp/all/patches/1.8.130-0004-improve-pulseaudio-detection.patch index 5a47717a4552a..84537aa466936 100644 --- a/recipes/aws-sdk-cpp/all/patches/1.8.130-0004-improve-pulseaudio-detection.patch +++ b/recipes/aws-sdk-cpp/all/patches/1.8.130-0004-improve-pulseaudio-detection.patch @@ -1,5 +1,5 @@ diff --git a/aws-cpp-sdk-text-to-speech/CMakeLists.txt b/aws-cpp-sdk-text-to-speech/CMakeLists.txt -index b1054515d5..d1a34ddfc5 100644 +index b105451..7de9367 100644 --- a/aws-cpp-sdk-text-to-speech/CMakeLists.txt +++ b/aws-cpp-sdk-text-to-speech/CMakeLists.txt @@ -9,8 +9,6 @@ file( GLOB TEXT_TO_SPEECH_HEADERS "include/aws/text-to-speech/*.h" ) @@ -11,20 +11,22 @@ index b1054515d5..d1a34ddfc5 100644 if(PLATFORM_WINDOWS) file( GLOB TEXT_TO_SPEECH_PLATFORM_HEADERS "include/aws/text-to-speech/windows/*.h" ) file( GLOB TEXT_TO_SPEECH_PLATFORM_SOURCE "source/text-to-speech/windows/*.cpp" ) -@@ -20,13 +18,14 @@ if(PLATFORM_WINDOWS) +@@ -19,14 +17,15 @@ if(PLATFORM_WINDOWS) + set(PLATFORM_LIBS ${PLATFORM_LIBS} Winmm) endif() - if (PLATFORM_LINUX) +-if (PLATFORM_LINUX) - if(HAVE_PULSE) ++if (CMAKE_SYSTEM_NAME STREQUAL "Linux") + find_package(pulseaudio) -+ if (1) ++ if (pulseaudio_FOUND) file( GLOB TEXT_TO_SPEECH_PLATFORM_HEADERS "include/aws/text-to-speech/linux/*.h" ) file( GLOB TEXT_TO_SPEECH_PLATFORM_SOURCE "source/text-to-speech/linux/*.cpp" ) message(STATUS "Pulse audio header files have been detected, included pulse audio as a possible sound driver implementation.") add_definitions("-DPULSE") - set(PLATFORM_LIBS ${PLATFORM_LIBS} pulse pulse-simple) -+ set(PLATFORM_LIBS ${PLATFORM_LIBS} "CONAN_PKG::pulseaudio") ++ set(PLATFORM_LIBS ${PLATFORM_LIBS} "pulseaudio::pulseaudio") else() message(WARNING "We've detected that you are building on linux, but the header files for pulseaudio are not available.\ If you are providing your own audio implementation or you will not be using the text-to-speech library, this is fine.\ diff --git a/recipes/aws-sdk-cpp/all/patches/1.8.130-0005-aws-plugin-conf.patch b/recipes/aws-sdk-cpp/all/patches/1.8.130-0005-aws-plugin-conf.patch deleted file mode 100644 index b3eccfe69cc45..0000000000000 --- a/recipes/aws-sdk-cpp/all/patches/1.8.130-0005-aws-plugin-conf.patch +++ /dev/null @@ -1,44 +0,0 @@ -commit 1179cb040d6b9292d30eb7d444298cd286f9f574 -Author: dvirtz -Date: Tue Nov 16 21:38:45 2021 +0200 - - add a file to configure SDK plugins - -diff --git a/cmake/sdk_plugin_conf.cmake b/cmake/sdk_plugin_conf.cmake -new file mode 100644 -index 0000000000..474ead75bd ---- /dev/null -+++ b/cmake/sdk_plugin_conf.cmake -@@ -0,0 +1,32 @@ -+get_filename_component(AWS_NATIVE_SDK_ROOT ${CMAKE_CURRENT_LIST_DIR} DIRECTORY) -+set(SIMPLE_INSTALL TRUE) -+ -+if (CMAKE_INSTALL_BINDIR) -+ set(BINARY_DIRECTORY "${CMAKE_INSTALL_BINDIR}") -+endif() -+ -+if (CMAKE_INSTALL_LIBDIR) -+ set(LIBRARY_DIRECTORY "${CMAKE_INSTALL_LIBDIR}") -+endif() -+ -+if (CMAKE_INSTALL_INCLUDEDIR) -+ set(INCLUDE_DIRECTORY "${CMAKE_INSTALL_INCLUDEDIR}") -+endif() -+ -+if(BUILD_SHARED_LIBS) -+ set(ARCHIVE_DIRECTORY "${BINARY_DIRECTORY}") -+else() -+ set(ARCHIVE_DIRECTORY "${LIBRARY_DIRECTORY}") -+endif() -+ -+if(DEFINED CMAKE_CXX_STANDARD) -+ set(STANDARD_DEFAULT ${CMAKE_CXX_STANDARD}) -+else() -+ set(STANDARD_DEFAULT "11") -+endif() -+set(CPP_STANDARD ${STANDARD_DEFAULT} CACHE STRING "Flag to upgrade the C++ standard used. The default is 11. The minimum is 11.") -+ -+include(CMakePackageConfigHelpers) -+include(initialize_project_version) -+include(utilities) -+include(compiler_settings) diff --git a/recipes/aws-sdk-cpp/all/patches/1.8.130-0006-issue-1816.patch b/recipes/aws-sdk-cpp/all/patches/1.8.130-0006-issue-1816.patch deleted file mode 100644 index 6abce1b705a47..0000000000000 --- a/recipes/aws-sdk-cpp/all/patches/1.8.130-0006-issue-1816.patch +++ /dev/null @@ -1,20 +0,0 @@ -diff --git aws-cpp-sdk-text-to-speech/source/text-to-speech/TextToSpeechManager.cpp aws-cpp-sdk-text-to-speech/source/text-to-speech/TextToSpeechManager.cpp -index c633f3fabe..abb1ab7332 100644 ---- aws-cpp-sdk-text-to-speech/source/text-to-speech/TextToSpeechManager.cpp -+++ aws-cpp-sdk-text-to-speech/source/text-to-speech/TextToSpeechManager.cpp -@@ -146,7 +146,6 @@ namespace Aws - AWS_LOGSTREAM_TRACE(CLASS_TAG, "Audio retrieved from Polly. " << result.GetContentType() << " with " - << result.GetRequestCharacters() << " characters syntesized"); - -- std::streamsize amountRead(0); - unsigned char buffer[BUFF_SIZE]; - - std::lock_guard m(m_driverLock); -@@ -159,7 +158,6 @@ namespace Aws - AWS_LOGSTREAM_TRACE(CLASS_TAG, "Writing " << read << " bytes to device."); - - successfullyPlayed = m_activeDriver->WriteBufferToDevice(buffer, (std::size_t)read); -- amountRead += read; - played = successfullyPlayed; - } - diff --git a/recipes/aws-sdk-cpp/all/patches/1.9.100-0001-disable-sort-links.patch b/recipes/aws-sdk-cpp/all/patches/1.9.100-0001-disable-sort-links.patch deleted file mode 100644 index 6e93f7675b327..0000000000000 --- a/recipes/aws-sdk-cpp/all/patches/1.9.100-0001-disable-sort-links.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/cmake/sdks.cmake b/cmake/sdks.cmake -index 0ec9981ddf..d86a9f4874 100644 ---- a/cmake/sdks.cmake -+++ b/cmake/sdks.cmake -@@ -250,7 +250,7 @@ function(add_sdks) - - # the catch-all config needs to list all the targets in a dependency-sorted order - include(dependencies) -- sort_links(EXPORTS) -+ #sort_links(EXPORTS) - - # make an everything config by just including all the individual configs - file(WRITE ${CMAKE_BINARY_DIR}/aws-sdk-cpp-config.cmake "") diff --git a/recipes/aws-sdk-cpp/all/patches/1.9.100-0003-issue-1816.patch b/recipes/aws-sdk-cpp/all/patches/1.9.100-0003-issue-1816.patch deleted file mode 100644 index 6abce1b705a47..0000000000000 --- a/recipes/aws-sdk-cpp/all/patches/1.9.100-0003-issue-1816.patch +++ /dev/null @@ -1,20 +0,0 @@ -diff --git aws-cpp-sdk-text-to-speech/source/text-to-speech/TextToSpeechManager.cpp aws-cpp-sdk-text-to-speech/source/text-to-speech/TextToSpeechManager.cpp -index c633f3fabe..abb1ab7332 100644 ---- aws-cpp-sdk-text-to-speech/source/text-to-speech/TextToSpeechManager.cpp -+++ aws-cpp-sdk-text-to-speech/source/text-to-speech/TextToSpeechManager.cpp -@@ -146,7 +146,6 @@ namespace Aws - AWS_LOGSTREAM_TRACE(CLASS_TAG, "Audio retrieved from Polly. " << result.GetContentType() << " with " - << result.GetRequestCharacters() << " characters syntesized"); - -- std::streamsize amountRead(0); - unsigned char buffer[BUFF_SIZE]; - - std::lock_guard m(m_driverLock); -@@ -159,7 +158,6 @@ namespace Aws - AWS_LOGSTREAM_TRACE(CLASS_TAG, "Writing " << read << " bytes to device."); - - successfullyPlayed = m_activeDriver->WriteBufferToDevice(buffer, (std::size_t)read); -- amountRead += read; - played = successfullyPlayed; - } - diff --git a/recipes/aws-sdk-cpp/all/test_package/CMakeLists.txt b/recipes/aws-sdk-cpp/all/test_package/CMakeLists.txt index efb9a3d957583..dda85fd047b73 100644 --- a/recipes/aws-sdk-cpp/all/test_package/CMakeLists.txt +++ b/recipes/aws-sdk-cpp/all/test_package/CMakeLists.txt @@ -1,13 +1,10 @@ -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(AWSSDK REQUIRED CONFIG) add_subdirectory(aws-sdk-cpp-plugin) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} aws-sdk-cpp-plugin) -set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE aws-sdk-cpp-plugin) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/aws-sdk-cpp/all/test_package/aws-sdk-cpp-plugin/CMakeLists.txt b/recipes/aws-sdk-cpp/all/test_package/aws-sdk-cpp-plugin/CMakeLists.txt index dddf745d2e408..37d0edc6941d9 100644 --- a/recipes/aws-sdk-cpp/all/test_package/aws-sdk-cpp-plugin/CMakeLists.txt +++ b/recipes/aws-sdk-cpp/all/test_package/aws-sdk-cpp-plugin/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.8) add_project(aws-sdk-cpp-plugin "C++ AWS SDK plugin" AWS::aws-sdk-cpp-s3) @@ -8,7 +8,7 @@ include(GenerateExportHeader) generate_export_header(${PROJECT_NAME} BASE_NAME aws_sdk_cpp_plugin) target_include_directories(${PROJECT_NAME} PUBLIC $ $) target_link_libraries(${PROJECT_NAME} PUBLIC ${PROJECT_LIBS}) -set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 11) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) setup_install() diff --git a/recipes/aws-sdk-cpp/all/test_package/conanfile.py b/recipes/aws-sdk-cpp/all/test_package/conanfile.py index 38f4483872d47..e845ae751a301 100644 --- a/recipes/aws-sdk-cpp/all/test_package/conanfile.py +++ b/recipes/aws-sdk-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 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-sdk-cpp/all/test_v1_package/CMakeLists.txt b/recipes/aws-sdk-cpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/aws-sdk-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/rxcpp/all/test_v1_package/conanfile.py b/recipes/aws-sdk-cpp/all/test_v1_package/conanfile.py similarity index 100% rename from recipes/rxcpp/all/test_v1_package/conanfile.py rename to recipes/aws-sdk-cpp/all/test_v1_package/conanfile.py diff --git a/recipes/aws-sdk-cpp/config.yml b/recipes/aws-sdk-cpp/config.yml index 3af57130465e4..15dd4365a90bb 100644 --- a/recipes/aws-sdk-cpp/config.yml +++ b/recipes/aws-sdk-cpp/config.yml @@ -1,7 +1,5 @@ versions: - "1.9.234": - folder: "all" - "1.9.100": + "1.11.352": folder: "all" - "1.8.130": + "1.9.234": folder: "all" diff --git a/recipes/azure-sdk-for-cpp/all/CMakeLists.txt b/recipes/azure-sdk-for-cpp/all/CMakeLists.txt new file mode 100644 index 0000000000000..46e5bc05a5d70 --- /dev/null +++ b/recipes/azure-sdk-for-cpp/all/CMakeLists.txt @@ -0,0 +1,18 @@ +cmake_minimum_required(VERSION 3.15) +project(cmake_wrapper) + +# The cmake_wrapper allows users to build only modules they want and not the entire sdk, +# the CMakeLists.txt from source does not provide this modularity to users (it's all or nothing). + +foreach(sdk ${BUILD_LIST}) + if(${sdk} STREQUAL azure-core) + # Always build Core + add_subdirectory("src/sdk/core") + elseif(${sdk} STREQUAL azure-storage-common) + add_subdirectory("src/sdk/storage/azure-storage-common") + elseif(${sdk} STREQUAL azure-storage-blobs) + add_subdirectory("src/sdk/storage/azure-storage-blobs") + elseif(${sdk} STREQUAL azure-storage-files-shares) + add_subdirectory("src/sdk/storage/azure-storage-files-shares") + endif() +endforeach() diff --git a/recipes/azure-sdk-for-cpp/all/conandata.yml b/recipes/azure-sdk-for-cpp/all/conandata.yml new file mode 100644 index 0000000000000..62ba6f53644b1 --- /dev/null +++ b/recipes/azure-sdk-for-cpp/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.11.3": + url: "https://github.com/Azure/azure-sdk-for-cpp/archive/refs/tags/azure-core_1.11.3.tar.gz" + sha256: "c67e42622bf1ebafee29aa09f333e41adc24712b0c993ada5dd97c9265b444cc" diff --git a/recipes/azure-sdk-for-cpp/all/conanfile.py b/recipes/azure-sdk-for-cpp/all/conanfile.py new file mode 100644 index 0000000000000..48f2abf1a5de9 --- /dev/null +++ b/recipes/azure-sdk-for-cpp/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 CMakeToolchain, CMake, CMakeDeps, cmake_layout +from conan.tools.files import get, copy, rmdir +from conan.tools.scm import Version +import os + +required_conan_version = ">=1.54.0" + +AZURE_SDK_MODULES = ( + "azure-storage-common", + "azure-storage-blobs", + "azure-storage-files-shares" +) + +class AzureSDKForCppConan(ConanFile): + name = "azure-sdk-for-cpp" + description = "Microsoft Azure Storage Client Library for C++" + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/Azure/azure-sdk-for-cpp" + topics = ("azure", "cpp", "cross-platform", "microsoft", "cloud") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = {"shared": [True, False], "fPIC": [True, False]} + options.update({_name: [True, False] for _name in AZURE_SDK_MODULES}) + default_options = {"shared": False, "fPIC": True} + default_options.update({_name: True for _name in AZURE_SDK_MODULES}) # Build all modules by default, let users pick what they do not want + + def export_sources(self): + copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def configure(self): + if self.options.get_safe("shared"): + self.options.rm_safe("fPIC") + + def requirements(self): + self.requires("openssl/[>=1.1 <4]") + self.requires("libcurl/[>=7.78 <9]") + self.requires("libxml2/[>=2.12.5 <3]") + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 14) + + # Open to contributions for windows and apple + if self.settings.os != "Linux": + raise ConanInvalidConfiguration( + f"{self.ref} Conan recipe in ConanCenter still does not support {self.settings.os}, contributions to the recipe welcome.") + + if self.settings.compiler != "gcc": + raise ConanInvalidConfiguration( + f"{self.ref} Conan recipe in ConanCenter still does not support {self.settings.compiler}, contributions to the recipe welcome.") + + if self.settings.compiler == 'gcc' and Version(self.settings.compiler.version) < "6": + raise ConanInvalidConfiguration("Building requires GCC >= 6") + + def generate(self): + tc = CMakeToolchain(self) + + build_list = ["azure-core"] + for sdk in AZURE_SDK_MODULES: + if self.options.get_safe(sdk): + build_list.append(sdk) + tc.cache_variables["BUILD_LIST"] = ";".join(build_list) + + tc.variables["AZ_ALL_LIBRARIES"] = "ON" + tc.variables["FETCH_SOURCE_DEPS"] = "OFF" + tc.cache_variables["BUILD_TESTING"] = "OFF" + tc.cache_variables["BUILD_WINDOWS_UWP"] = "ON" + tc.cache_variables["DISABLE_AZURE_CORE_OPENTELEMETRY"] = "ON" + tc.cache_variables["BUILD_TRANSPORT_CURL"] = "ON" + tc.generate() + + deps = CMakeDeps(self) + deps.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "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")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "AzureSDK") + + # core component + self.cpp_info.components["azure-core"].set_property("cmake_target_name", "Azure::azure-core") + self.cpp_info.components["azure-core"].libs = ["azure-core"] + self.cpp_info.components["azure-core"].requires.extend(["openssl::openssl", "libcurl::curl", "libxml2::libxml2"]) + + enabled_sdks = [sdk for sdk in AZURE_SDK_MODULES if self.options.get_safe(sdk)] + for sdk in enabled_sdks: + self.cpp_info.components[sdk].set_property("cmake_target_name", f"Azure::{sdk}") + self.cpp_info.components[sdk].libs = [sdk] diff --git a/recipes/azure-sdk-for-cpp/all/test_package/CMakeLists.txt b/recipes/azure-sdk-for-cpp/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..8347b50cbb47d --- /dev/null +++ b/recipes/azure-sdk-for-cpp/all/test_package/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package LANGUAGES CXX) + +find_package(AzureSDK CONFIG REQUIRED) + +add_executable(test_azure-core test_azure-core.cc) +target_link_libraries(test_azure-core PRIVATE Azure::azure-core) + +add_executable(test_azure-storage-common test_azure-storage-common.cc) +target_link_libraries(test_azure-storage-common PRIVATE Azure::azure-core Azure::azure-storage-common) + +add_executable(test_azure-storage-blobs test_azure-storage-blobs.cc) +target_link_libraries(test_azure-storage-blobs PRIVATE Azure::azure-core Azure::azure-storage-common Azure::azure-storage-blobs) + +add_executable(test_azure-storage-files-shares test_azure-storage-files-shares.cc) +target_link_libraries(test_azure-storage-files-shares PRIVATE Azure::azure-core Azure::azure-storage-common Azure::azure-storage-files-shares) diff --git a/recipes/azure-sdk-for-cpp/all/test_package/conanfile.py b/recipes/azure-sdk-for-cpp/all/test_package/conanfile.py new file mode 100644 index 0000000000000..2dfe88d001d05 --- /dev/null +++ b/recipes/azure-sdk-for-cpp/all/test_package/conanfile.py @@ -0,0 +1,33 @@ +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" + + @property + def _tested_modules(self): + return ["azure-core", + "azure-storage-common", + "azure-storage-blobs", + "azure-storage-files-shares"] + + 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): + for module in self._tested_modules: + bin_path = os.path.join(self.cpp.build.bindirs[0], f"test_{module}") + self.run(bin_path, env="conanrun") diff --git a/recipes/azure-sdk-for-cpp/all/test_package/test_azure-core.cc b/recipes/azure-sdk-for-cpp/all/test_package/test_azure-core.cc new file mode 100644 index 0000000000000..bfd5501b81141 --- /dev/null +++ b/recipes/azure-sdk-for-cpp/all/test_package/test_azure-core.cc @@ -0,0 +1,10 @@ +#include +#include + +int main() +{ + std::vector data = {1, 2, 3, 4}; + Azure::Core::IO::MemoryBodyStream stream(data); + + return 0; +} diff --git a/recipes/azure-sdk-for-cpp/all/test_package/test_azure-storage-blobs.cc b/recipes/azure-sdk-for-cpp/all/test_package/test_azure-storage-blobs.cc new file mode 100644 index 0000000000000..23cc6b485edbc --- /dev/null +++ b/recipes/azure-sdk-for-cpp/all/test_package/test_azure-storage-blobs.cc @@ -0,0 +1,10 @@ +#include + +using namespace Azure::Storage::Blobs; + +int main() +{ + BlobAudience audience{"TEST"}; + + return 0; +} diff --git a/recipes/azure-sdk-for-cpp/all/test_package/test_azure-storage-common.cc b/recipes/azure-sdk-for-cpp/all/test_package/test_azure-storage-common.cc new file mode 100644 index 0000000000000..5fdbe6d99f6dc --- /dev/null +++ b/recipes/azure-sdk-for-cpp/all/test_package/test_azure-storage-common.cc @@ -0,0 +1,10 @@ +#include + +using namespace Azure::Storage; + +int main() +{ + ContentHash contentHash{}; + + return 0; +} diff --git a/recipes/azure-sdk-for-cpp/all/test_package/test_azure-storage-files-shares.cc b/recipes/azure-sdk-for-cpp/all/test_package/test_azure-storage-files-shares.cc new file mode 100644 index 0000000000000..00034be2a0119 --- /dev/null +++ b/recipes/azure-sdk-for-cpp/all/test_package/test_azure-storage-files-shares.cc @@ -0,0 +1,10 @@ +#include + +using namespace Azure::Storage::Files::Shares; + +int main() +{ + SetSharePropertiesOptions options; + + return 0; +} diff --git a/recipes/azure-sdk-for-cpp/config.yml b/recipes/azure-sdk-for-cpp/config.yml new file mode 100644 index 0000000000000..dc736edb41043 --- /dev/null +++ b/recipes/azure-sdk-for-cpp/config.yml @@ -0,0 +1,3 @@ +versions: + "1.11.3": + folder: "all" diff --git a/recipes/azure-storage-cpp/all/CMakeLists.txt b/recipes/azure-storage-cpp/all/CMakeLists.txt index 82ba25e8c2576..3d130cd5365bf 100644 --- a/recipes/azure-storage-cpp/all/CMakeLists.txt +++ b/recipes/azure-storage-cpp/all/CMakeLists.txt @@ -1,7 +1,16 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.15) project(cmake_wrapper) -include(conanbuildinfo.cmake) -conan_basic_setup() +find_package(cpprestsdk REQUIRED) +find_package(OpenSSL REQUIRED) +find_package(LibXml2 REQUIRED) +find_package(UUID QUIET) -add_subdirectory("source_subfolder/Microsoft.WindowsAzure.Storage") +add_subdirectory(src/Microsoft.WindowsAzure.Storage) + +target_link_libraries(azurestorage + cpprestsdk::cpprestsdk + OpenSSL::SSL + LibXml2::LibXml2 + $ +) diff --git a/recipes/azure-storage-cpp/all/conandata.yml b/recipes/azure-storage-cpp/all/conandata.yml index ccef8ba8c5bd6..5ce9572d0f722 100644 --- a/recipes/azure-storage-cpp/all/conandata.yml +++ b/recipes/azure-storage-cpp/all/conandata.yml @@ -4,5 +4,7 @@ sources: sha256: "446a821d115949f6511b7eb01e6a0e4f014b17bfeba0f3dc33a51750a9d5eca5" patches: "7.5.0": - - base_path: source_subfolder - patch_file: patches/0001-cmake-fixes.patch + - patch_file: "patches/fix-cpp17-incompatibility.patch" + patch_description: "Fix a minor C++17 incompatibility in util.cpp" + patch_type: "portability" + patch_source: "https://patch-diff.githubusercontent.com/raw/Azure/azure-storage-cpp/pull/366" diff --git a/recipes/azure-storage-cpp/all/conanfile.py b/recipes/azure-storage-cpp/all/conanfile.py index 692bc2ab703fe..b86e79067f57c 100644 --- a/recipes/azure-storage-cpp/all/conanfile.py +++ b/recipes/azure-storage-cpp/all/conanfile.py @@ -1,19 +1,27 @@ -from conans import ConanFile, CMake, 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 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 copy, get, replace_in_file, export_conandata_patches, apply_conandata_patches +from conan.tools.microsoft import check_min_vs, is_msvc_static_runtime, is_msvc +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" + class AzureStorageCppConan(ConanFile): name = "azure-storage-cpp" + description = "Microsoft Azure Storage Client Library for C++" license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/Azure/azure-storage-cpp" - description = "Microsoft Azure Storage Client Library for C++" topics = ("azure", "cpp", "cross-platform", "microsoft", "cloud") - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" - exports_sources = ["CMakeLists.txt", "patches/**"] + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -22,16 +30,10 @@ class AzureStorageCppConan(ConanFile): "shared": False, "fPIC": True, } - short_paths = True - _cmake = None - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + # Use azure-sdk-for-cpp::azure-storage-blobs-cpp instead + # https://github.com/Azure/azure-sdk-for-cpp/blob/main/sdk/storage/MigrationGuide.md + deprecated = "azure-sdk-for-cpp" @property def _minimum_cpp_standard(self): @@ -40,41 +42,16 @@ def _minimum_cpp_standard(self): @property def _minimum_compiler_version(self): return { - "gcc": "5", + "gcc": "6", "Visual Studio": "14", + "msvc": "190", "clang": "3.4", "apple-clang": "5.1", } - def requirements(self): - self.requires("cpprestsdk/2.10.18") - if self.settings.os != "Windows": - self.requires("boost/1.76.0") - self.requires("libxml2/2.9.10") - self.requires("libuuid/1.0.3") - if self.settings.os == "Macos": - self.requires("libgettext/0.20.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["CMAKE_FIND_FRAMEWORK"] = "LAST" - self._cmake.definitions["BUILD_TESTS"] = False - self._cmake.definitions["BUILD_SAMPLES"] = False - if not self.settings.compiler.cppstd: - self._cmake.definitions["CMAKE_CXX_STANDARD"] = self._minimum_cpp_standard - - if self.settings.os == "Macos": - self._cmake.definitions["GETTEXT_LIB_DIR"] = self.deps_cpp_info["libgettext"].lib_paths[0] - - self._cmake.configure(build_folder=self._build_subfolder) - 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": @@ -82,42 +59,100 @@ 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("cpprestsdk/2.10.19", transitive_headers=True, transitive_libs=True) + self.requires("libxml2/[>=2.12.5 <3]", transitive_headers=True, transitive_libs=True) + if self.settings.os != "Windows": + # Boost.Asio is used in a public header here: + # https://github.com/Azure/azure-storage-cpp/blob/v7.5.0/Microsoft.WindowsAzure.Storage/includes/wascore/timer_handler.h#L27 + self.requires("boost/1.83.0", transitive_headers=True, transitive_libs=True) + self.requires("util-linux-libuuid/2.39.2", transitive_headers=True, transitive_libs=True) + self.requires("openssl/[>=1.1 <4]") + if is_apple_os(self): + self.requires("libgettext/0.22") def validate(self): if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, self._minimum_cpp_standard) + check_min_cppstd(self, self._minimum_cpp_standard) min_version = self._minimum_compiler_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( + f"{self.name} recipe lacks information about the {self.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, self._minimum_cpp_standard, self.settings.compiler, self.settings.compiler.version)) + if Version(self.settings.compiler.version) < min_version: + raise ConanInvalidConfiguration( + f"{self.name} requires C++{self._minimum_cpp_standard} support. The current compiler" + f" {self.settings.compiler} {self.settings.compiler.version} does not support it." + ) # FIXME: Visual Studio 2015 & 2017 are supported but CI of CCI lacks several Win SDK components # https://github.com/conan-io/conan-center-index/issues/4195 - if self.settings.compiler == "Visual Studio" and tools.Version(self.settings.compiler.version) < "16": + if not check_min_vs(self, 192, raise_invalid=False): raise ConanInvalidConfiguration("Visual Studio < 2019 not yet supported in this recipe") - if self.settings.compiler == "Visual Studio" and self.options.shared and "MT" in self.settings.compiler.runtime: + if self.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): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CMAKE_FIND_FRAMEWORK"] = "LAST" + tc.variables["BUILD_TESTS"] = False + tc.variables["BUILD_SAMPLES"] = False + if is_apple_os(self): + tc.variables["GETTEXT_LIB_DIR"] = self.dependencies["libgettext"].cpp_info.libdir + if not valid_min_cppstd(self, self._minimum_cpp_standard): + tc.variables["CMAKE_CXX_STANDARD"] = self._minimum_cpp_standard + # Allow non-cache_variables to be used + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + # Relocatable shared libs on macOS + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" + tc.generate() + + deps = CMakeDeps(self) + deps.set_property("util-linux-libuuid", "cmake_file_name", "UUID") + deps.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + cmakelists_path = os.path.join(self.source_folder, "Microsoft.WindowsAzure.Storage", "CMakeLists.txt") + # Do not force C++11 and libc++ + replace_in_file(self, cmakelists_path, "-std=c++11", "") + replace_in_file(self, cmakelists_path, "-stdlib=libc++", "") + # Let Conan handle the Boost defines + replace_in_file(self, cmakelists_path, "add_definitions(-DBOOST_LOG_DYN_LINK)", "") + 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=self.source_path.parent) 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() def package_info(self): - - self.cpp_info.libs = tools.collect_libs(self) if self.settings.os == "Windows": + # https://github.com/Azure/azure-storage-cpp/blob/v7.5.0/Microsoft.WindowsAzure.Storage/src/CMakeLists.txt#L100 + self.cpp_info.libs = ["wastorage"] + # https://github.com/Azure/azure-storage-cpp/blob/v7.5.0/Microsoft.WindowsAzure.Storage/src/CMakeLists.txt#L90 self.cpp_info.system_libs = ["ws2_32", "rpcrt4", "xmllite", "bcrypt"] - if not self.options.shared: - self.cpp_info.defines = ["_NO_WASTORAGE_API"] + if is_msvc(self): + # https://github.com/Azure/azure-storage-cpp/blob/v7.5.0/Microsoft.WindowsAzure.Storage/CMakeLists.txt#L116-L120 + if self.options.shared: + self.cpp_info.defines = ["WASTORAGE_DLL", "_USRDLL"] + else: + self.cpp_info.defines = ["_NO_WASTORAGE_API"] + else: + self.cpp_info.libs = ["azurestorage"] diff --git a/recipes/azure-storage-cpp/all/patches/0001-cmake-fixes.patch b/recipes/azure-storage-cpp/all/patches/0001-cmake-fixes.patch deleted file mode 100644 index c775329eb84fe..0000000000000 --- a/recipes/azure-storage-cpp/all/patches/0001-cmake-fixes.patch +++ /dev/null @@ -1,72 +0,0 @@ -diff --git a/Microsoft.WindowsAzure.Storage/CMakeLists.txt b/Microsoft.WindowsAzure.Storage/CMakeLists.txt -index ac9e65d..f5988f6 100644 ---- a/Microsoft.WindowsAzure.Storage/CMakeLists.txt -+++ b/Microsoft.WindowsAzure.Storage/CMakeLists.txt -@@ -46,9 +46,9 @@ if(UNIX) - find_package(OpenSSL 1.0.0 REQUIRED) - - -- find_package(UUID REQUIRED) -- find_package(Casablanca REQUIRED) -- find_package(LibXML2 REQUIRED) -+ find_package(libuuid REQUIRED) -+ find_package(cpprestsdk REQUIRED) -+ find_package(LibXml2 REQUIRED) - - if(BUILD_TESTS) - find_package(UnitTest++ REQUIRED) -@@ -57,7 +57,7 @@ if(UNIX) - - elseif(WIN32) - message("-- Setting WIN32 options") -- find_package(Casablanca REQUIRED) -+ find_package(cpprestsdk REQUIRED) - add_definitions(-DUNICODE -D_UNICODE -D_WIN32) - else() - message("-- Unsupported Build Platform.") -@@ -85,13 +85,10 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") - - set(LD_FLAGS "${LD_FLAGS} -Wl,-z,defs") - -- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-strict-aliasing") -+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing") - - set(STRICT_CXX_FLAGS ${WARNINGS} "-Werror -pedantic") - -- if (BUILD_SHARED_LIBS) -- add_definitions(-DBOOST_LOG_DYN_LINK) -- endif() - add_definitions(-D_TURN_OFF_PLATFORM_STRING) - elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") - message("-- Setting clang options") -@@ -100,14 +97,11 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") - set(OSX_SUPPRESSIONS "-Wno-overloaded-virtual -Wno-sign-conversion -Wno-deprecated -Wno-unknown-pragmas -Wno-reorder -Wno-char-subscripts -Wno-switch -Wno-unused-parameter -Wno-unused-variable -Wno-deprecated -Wno-unused-value -Wno-unknown-warning-option -Wno-return-type-c-linkage -Wno-unused-function -Wno-sign-compare -Wno-shorten-64-to-32 -Wno-reorder -Wno-unused-local-typedefs") - set(WARNINGS "${WARNINGS} ${OSX_SUPPRESSIONS}") - -- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -Wno-return-type-c-linkage -Wno-unneeded-internal-declaration") -+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-return-type-c-linkage -Wno-unneeded-internal-declaration") - set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++") - set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11") - -- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-strict-aliasing") -- if (BUILD_SHARED_LIBS) -- add_definitions(-DBOOST_LOG_DYN_LINK) -- endif() -+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing") - add_definitions(-D_TURN_OFF_PLATFORM_STRING) - elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") - message("-- Setting MSVC options") -@@ -142,11 +136,11 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/Binaries) - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/Binaries) - - set(AZURESTORAGE_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/includes) --set(AZURESTORAGE_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/includes ${CASABLANCA_INCLUDE_DIR} ${Boost_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIRS} ${UUID_INCLUDE_DIRS} ${LibXML2_INCLUDE_DIR}) -+set(AZURESTORAGE_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/includes ${cpprestsdk_INCLUDE_DIR} ${Boost_INCLUDE_DIRS} ${OpenSSL_INCLUDE_DIRS} ${libuuid_INCLUDE_DIRS} ${LibXml2_INCLUDE_DIR}) - - - set(AZURESTORAGE_LIBRARY azurestorage) --set(AZURESTORAGE_LIBRARIES ${AZURESTORAGE_LIBRARY} ${CASABLANCA_LIBRARY} ${Boost_LIBRARIES} ${Boost_FRAMEWORK} ${OPENSSL_LIBRARIES} ${UUID_LIBRARIES} ${LibXML2_LIBRARY} ${CMAKE_THREAD_LIBS_INIT}) -+set(AZURESTORAGE_LIBRARIES ${AZURESTORAGE_LIBRARY} ${cpprestsdk_LIBRARIES} ${Boost_LIBRARIES} ${OpenSSL_LIBRARIES} ${libuuid_LIBRARIES} ${LibXml2_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) - - # Set version numbers centralized - set (AZURESTORAGE_VERSION_MAJOR 7) diff --git a/recipes/azure-storage-cpp/all/patches/fix-cpp17-incompatibility.patch b/recipes/azure-storage-cpp/all/patches/fix-cpp17-incompatibility.patch new file mode 100644 index 0000000000000..23af9f8243be8 --- /dev/null +++ b/recipes/azure-storage-cpp/all/patches/fix-cpp17-incompatibility.patch @@ -0,0 +1,51 @@ +From b81d6349d3f6c05741978bab9b07372150c85137 Mon Sep 17 00:00:00 2001 +From: Adam Mensel +Date: Mon, 31 Aug 2020 19:44:24 -0600 +Subject: [PATCH 1/2] Use lambdas instead of std::fun_ptr, to get free C++17 + compatibility. + +--- + Microsoft.WindowsAzure.Storage/src/util.cpp | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/Microsoft.WindowsAzure.Storage/src/util.cpp b/Microsoft.WindowsAzure.Storage/src/util.cpp +index cf0a3116..2d0d540c 100644 +--- a/Microsoft.WindowsAzure.Storage/src/util.cpp ++++ b/Microsoft.WindowsAzure.Storage/src/util.cpp +@@ -334,8 +334,8 @@ namespace azure { namespace storage { namespace core { + + utility::string_t str_trim_starting_trailing_whitespaces(const utility::string_t& str) + { +- auto non_space_begin = std::find_if(str.begin(), str.end(), std::not1(std::ptr_fun(isspace))); +- auto non_space_end = std::find_if(str.rbegin(), str.rend(), std::not1(std::ptr_fun(isspace))).base(); ++ auto non_space_begin = std::find_if(str.begin(), str.end(), [](char c) { return !std::isspace(c); }); ++ auto non_space_end = std::find_if(str.rbegin(), str.rend(), [](char c) { return !std::isspace(c); }).base(); + return utility::string_t(non_space_begin, non_space_end); + } + + +From b71db982b9f7065494c950c558f7e30b89026a89 Mon Sep 17 00:00:00 2001 +From: Adam Mensel +Date: Mon, 31 Aug 2020 23:02:29 -0600 +Subject: [PATCH 2/2] Keep the exact same logic as before, but still using a + lambda instead of std::fun_ptr. + +--- + Microsoft.WindowsAzure.Storage/src/util.cpp | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/Microsoft.WindowsAzure.Storage/src/util.cpp b/Microsoft.WindowsAzure.Storage/src/util.cpp +index 2d0d540c..c2a3d7d4 100644 +--- a/Microsoft.WindowsAzure.Storage/src/util.cpp ++++ b/Microsoft.WindowsAzure.Storage/src/util.cpp +@@ -334,8 +334,8 @@ namespace azure { namespace storage { namespace core { + + utility::string_t str_trim_starting_trailing_whitespaces(const utility::string_t& str) + { +- auto non_space_begin = std::find_if(str.begin(), str.end(), [](char c) { return !std::isspace(c); }); +- auto non_space_end = std::find_if(str.rbegin(), str.rend(), [](char c) { return !std::isspace(c); }).base(); ++ auto non_space_begin = std::find_if(str.begin(), str.end(), [](int c) { return !isspace(c); }); ++ auto non_space_end = std::find_if(str.rbegin(), str.rend(), [](int c) { return !isspace(c); }).base(); + return utility::string_t(non_space_begin, non_space_end); + } + diff --git a/recipes/azure-storage-cpp/all/test_package/CMakeLists.txt b/recipes/azure-storage-cpp/all/test_package/CMakeLists.txt index 1c789ba4ceba1..b3dc1a61ac7d2 100644 --- a/recipes/azure-storage-cpp/all/test_package/CMakeLists.txt +++ b/recipes/azure-storage-cpp/all/test_package/CMakeLists.txt @@ -1,12 +1,8 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(PackageTest CXX) -set(CMAKE_CXX_STANDARD 11) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - find_package(azure-storage-cpp REQUIRED CONFIG) add_executable(example example.cpp) target_link_libraries(example azure-storage-cpp::azure-storage-cpp) +target_compile_features(example PRIVATE cxx_std_11) diff --git a/recipes/azure-storage-cpp/all/test_package/conanfile.py b/recipes/azure-storage-cpp/all/test_package/conanfile.py index 33fb4c0ecc216..8d52b7021efe1 100644 --- a/recipes/azure-storage-cpp/all/test_package/conanfile.py +++ b/recipes/azure-storage-cpp/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 AwsSdkCppTestConan(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 +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.bindir, "example") + self.run(bin_path, env="conanrun") diff --git a/recipes/azure-storage-cpp/all/test_v1_package/CMakeLists.txt b/recipes/azure-storage-cpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/azure-storage-cpp/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/azure-storage-cpp/all/test_v1_package/conanfile.py b/recipes/azure-storage-cpp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..33fb4c0ecc216 --- /dev/null +++ b/recipes/azure-storage-cpp/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +import os + +from conans import ConanFile, CMake, tools + + +class AwsSdkCppTestConan(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", "example") + self.run(bin_path, run_environment=True) diff --git a/recipes/b2/config.yml b/recipes/b2/config.yml index 72ab4de1e5c67..0e3bbe203df45 100644 --- a/recipes/b2/config.yml +++ b/recipes/b2/config.yml @@ -1,43 +1,17 @@ versions: - "4.0.0": - folder: standard - "4.0.1": - folder: standard - "4.1.0": - folder: standard - "4.2.0": - folder: standard - "4.3.0": - folder: portable - "4.4.0": - folder: portable - "4.4.1": - folder: portable - "4.4.2": - folder: portable - "4.5.0": - folder: portable - "4.6.0": - folder: portable - "4.6.1": - folder: portable - "4.7.0": - folder: portable - "4.7.1": - folder: portable - "4.7.2": + "4.8.2": folder: portable - "4.8.0": + "4.9.6": folder: portable - "4.8.1": + "4.10.0": folder: portable - "4.8.2": + "4.10.1": folder: portable - "4.9.0": + "5.0.0": folder: portable - "4.9.1": + "5.1.0": folder: portable - "4.9.2": + "5.2.0": folder: portable - "4.9.3": + "5.2.1": folder: portable diff --git a/recipes/b2/portable/conandata.yml b/recipes/b2/portable/conandata.yml index 0ce27c0e93f9c..18e6c7ae29c82 100644 --- a/recipes/b2/portable/conandata.yml +++ b/recipes/b2/portable/conandata.yml @@ -1,52 +1,25 @@ sources: - "4.3.0": - sha256: 138c90b66edb0a28e225705a2cbf897a8cef5f87e68befc748f8e6808e21628a - url: https://github.com/bfgroup/b2/archive/4.3.0.tar.gz - "4.4.0": - sha256: fa4079370644110604895ff08057fe2eff3289bcffdaec55fcdf43ea33ff25a8 - url: https://github.com/bfgroup/b2/archive/4.4.0.tar.gz - "4.4.1": - sha256: 4fb15abd994968a24868c13502f080c4a28b20f59831acf9eabd64a3b257554f - url: https://github.com/bfgroup/b2/archive/4.4.1.tar.gz - "4.4.2": - sha256: 575e59b89191a6a6780d7165cae3222b8a7a1e7d5e8165b3524eefe32fc3de46 - url: https://github.com/bfgroup/b2/archive/4.4.2.tar.gz - "4.5.0": - url: "https://github.com/bfgroup/b2/archive/4.5.0.tar.gz" - sha256: "39c3b51bf9c5f32b1c249d2d405274976b166e1bdca1fc5205b595f1cb5dbac3" - "4.6.0": - url: "https://github.com/bfgroup/b2/archive/4.6.0.tar.gz" - sha256: "3a308e0f79a039d8a9495b375f3292f5163000c19caa79c5687e4cb5b1938b49" - "4.6.1": - url: "https://github.com/bfgroup/b2/archive/4.6.1.tar.gz" - sha256: "a3f3323eaeb2c27d7a3ca86842665c6c3bc3d93cc626ba362ae6d0c5a7bfbe2c" - "4.7.0": - url: "https://github.com/bfgroup/b2/archive/4.7.0.tar.gz" - sha256: "82c2eb92d6ab2bd447646568ac8430c316cbd2a1819c108136224498c0abed84" - "4.7.1": - url: "https://github.com/bfgroup/b2/archive/4.7.1.tar.gz" - sha256: "30844184ded3217c090b76e6e051c3ac663ea63bd19e1b727b05c54411cac867" - "4.7.2": - url: "https://github.com/bfgroup/b2/archive/4.7.2.tar.gz" - sha256: "70883f8ed82efc49f425f1961a82e961cefdbca3a28581cb57b405bd7516677f" - "4.8.0": - url: "https://github.com/bfgroup/b2/archive/4.8.0.tar.gz" - sha256: "2f18951d4cc267a810e44fc483b747d489e30ed42ee6d9e7c5e19de750ee5cd2" - "4.8.1": - url: "https://github.com/bfgroup/b2/archive/4.8.1.tar.gz" - sha256: "8ecff1025df9473d91a0d116af3e32be6fba6e57d4ea962e033ff1678609d668" "4.8.2": url: "https://github.com/bfgroup/b2/archive/4.8.2.tar.gz" sha256: "220edfbd5022394c5dc264dfdd8bf6d3ec53b784db87461026bb23ea9d9ec4bd" - "4.9.0": - url: "https://github.com/bfgroup/b2/archive/4.9.0.tar.gz" - sha256: "7c614e41f10e004c7539c75c60f7b2df26a61fe35058e9021f8fd5049c97a255" - "4.9.1": - url: "https://github.com/bfgroup/b2/archive/4.9.1.tar.gz" - sha256: "81e49dc85e956c3e708bdd02fcfe0b9f406fca8edca54c75c94ebd6c322ed587" - "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.6": + url: "https://github.com/bfgroup/b2/releases/download/4.9.6/b2-4.9.6.tar.bz2" + sha256: "10c1344c751fcf5a1f9ec6f52c02626cfbf78a4806f7817949b115e107bbbc5f" + "4.10.0": + url: "https://github.com/bfgroup/b2/releases/download/4.10.0/b2-4.10.0.tar.bz2" + sha256: "aee0185473141d4acb56e39c78758b1016e66393ea5ca86ef29403bd9258f2e2" + "4.10.1": + url: "https://github.com/bfgroup/b2/releases/download/4.10.1/b2-4.10.1.tar.bz2" + sha256: "d0818276955c3351eac26e4aa1e61046cfded88773232d76f2833c93bb917633" + "5.0.0": + url: "https://github.com/bfgroup/b2/releases/download/5.0.0/b2-5.0.0.tar.bz2" + sha256: "1ef867f7d374345a948baca025ed277dadda05a68439aa383a06aceb9911f7d3" + "5.1.0": + url: "https://github.com/bfgroup/b2/releases/download/5.1.0/b2-5.1.0.tar.bz2" + sha256: "8429a2e7c9c4484f6a4bd7fb18743f0ea1dba41eb024479a9b23381bcb813623" + "5.2.0": + url: "https://github.com/bfgroup/b2/releases/download/5.2.0/b2-5.2.0.tar.bz2" + sha256: "c27adfb4e667d748bb7d3e18657938fa8bcf185b74a29bf091113299f532ed6d" + "5.2.1": + url: "https://github.com/bfgroup/b2/releases/download/5.2.1/b2-5.2.1.tar.bz2" + sha256: "6428edec31731aa479b4e7d8f83898831a0919352ec7d7f9874145abe165a578" diff --git a/recipes/b2/portable/conanfile.py b/recipes/b2/portable/conanfile.py index c4123bff05281..68803d254a16d 100644 --- a/recipes/b2/portable/conanfile.py +++ b/recipes/b2/portable/conanfile.py @@ -1,10 +1,13 @@ -import os -from contextlib import contextmanager -import conan.tools.files -import conan.tools.layout from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from six import StringIO +from conan.tools.build import cross_building +from conan.tools.env import VirtualBuildEnv +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.47.0" @@ -13,11 +16,13 @@ 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" + package_type = "application" + ''' * use_cxx_env: False, True @@ -45,24 +50,35 @@ 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 + + if self._is_macos_intel_or_arm(self.info.settings): + self.info.settings.arch = "x86_64,armv8" + + def validate_build(self): + if hasattr(self, "settings_build") and cross_building(self) and not self._is_macos_intel_or_arm(self.settings): + raise ConanInvalidConfiguration(f"{self.ref} recipe doesn't support cross-build yet") + def validate(self): 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 layout(self): - conan.tools.layout.basic_layout(self, src_folder="root") - def source(self): - conan.tools.files.get( - self, **self.conan_data["sources"][self.version], strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) @property def _b2_dir(self): @@ -76,14 +92,13 @@ def _b2_engine_dir(self): def _b2_output_dir(self): return os.path.join(self.build_folder, "output") - @property - def _pkg_licenses_dir(self): - return os.path.join(self.package_folder, "licenses") - @property def _pkg_bin_dir(self): return os.path.join(self.package_folder, "bin") + def _is_macos_intel_or_arm(self, settings): + return settings.os == "Macos" and settings.arch in ["x86_64", "armv8"] + @contextmanager def _bootstrap_env(self): saved_env = dict(os.environ) @@ -102,6 +117,12 @@ def _bootstrap_env(self): os.environ.clear() os.environ.update(saved_env) + def _write_project_config(self, cxx): + with open(os.path.join(self.source_folder, "project-config.jam"), "w") as f: + f.write( + f"using {self.options.toolset} : : {cxx} ;\n" + ) + 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 @@ -118,10 +139,10 @@ def build(self): # 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 conan.tools.files.chdir(self, self._b2_engine_dir): + with chdir(self, self._b2_engine_dir): with self._bootstrap_env(): buf = StringIO() - self.run('guess_toolset && set', output=buf) + self.run('guess_toolset && set', buf) guess_vars = map( lambda x: x.strip(), buf.getvalue().split("\n")) if "B2_TOOLSET=vcunk" in guess_vars: @@ -132,9 +153,29 @@ def build(self): kv.split('=')[1].strip(), 'Auxiliary', 'Build', 'vcvars32.bat') command += '"'+b2_vcvars+'" && ' command += "build" if use_windows_commands else "./build.sh" + + cxxflags = "" + if self._is_macos_intel_or_arm(self.settings): + cxxflags += " -arch arm64 -arch x86_64" + + if self.options.use_cxx_env: + envvars = VirtualBuildEnv(self).vars() + + cxx_env = envvars.get("CXX") + if cxx_env: + command += f" --cxx={cxx_env}" + self._write_project_config(cxx_env) + + cxxflags_env = envvars.get("CXXFLAGS") + if cxxflags_env: + cxxflags = f"{cxxflags} {cxxflags_env}" + + if cxxflags: + command += f' --cxxflags="{cxxflags}"' + if b2_toolset != 'auto': command += " "+str(b2_toolset) - with conan.tools.files.chdir(self, self._b2_engine_dir): + with chdir(self, self._b2_engine_dir): with self._bootstrap_env(): self.run(command) @@ -144,31 +185,24 @@ def build(self): if b2_toolset not in ["auto", "cxx", "cross-cxx"]: command += " toolset=" + str(b2_toolset) full_command = \ - ("{0} --ignore-site-config " + - "--prefix={1} " + + (f"{command} --ignore-site-config " + + f"--prefix={self._b2_output_dir} " + "--abbreviate-paths " + "install " + - "b2-install-layout=portable").format(command, self._b2_output_dir) - with conan.tools.files.chdir(self, self._b2_dir): + "b2-install-layout=portable") + with chdir(self, self._b2_dir): self.run(full_command) def package(self): - conan.tools.files.copy( - self, "LICENSE.txt", dst=self._pkg_licenses_dir, src=self.source_folder) - conan.tools.files.copy( - self, "*b2", dst=self._pkg_bin_dir, src=self._b2_output_dir) - conan.tools.files.copy( - self, "*b2.exe", dst=self._pkg_bin_dir, src=self._b2_output_dir) - conan.tools.files.copy( - self, "*.jam", dst=self._pkg_bin_dir, src=self._b2_output_dir) + copy(self, "LICENSE.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*.LICENSE", src=self._b2_engine_dir, 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.libdirs = [] - self.cpp_info.bindirs = ["bin"] - self.buildenv_info.prepend_path("PATH", self._pkg_bin_dir) - self.env_info.path = [self._pkg_bin_dir] - 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/.gitignore b/recipes/b2/portable/test_package/.gitignore new file mode 100644 index 0000000000000..c97f963b3da62 --- /dev/null +++ b/recipes/b2/portable/test_package/.gitignore @@ -0,0 +1 @@ +*.sh diff --git a/recipes/b64/all/CMakeLists.txt b/recipes/b64/all/CMakeLists.txt new file mode 100644 index 0000000000000..86ec29f0103b2 --- /dev/null +++ b/recipes/b64/all/CMakeLists.txt @@ -0,0 +1,23 @@ +cmake_minimum_required(VERSION 3.15) +project(b64 LANGUAGES C CXX) + +file(GLOB HEADER_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/include/b64/*.h") +add_library(${PROJECT_NAME} "${CMAKE_CURRENT_SOURCE_DIR}/src/src/cdecode.c" "${CMAKE_CURRENT_SOURCE_DIR}/src/src/cencode.c" ${HEADER_FILES}) +target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/src/include") +set_target_properties(${PROJECT_NAME} PROPERTIES PUBLIC_HEADER "${HEADER_FILES}" WINDOWS_EXPORT_ALL_SYMBOLS TRUE) +install(TARGETS ${PROJECT_NAME} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/b64" +) + +set(BASE64_APP base64) +add_executable(${BASE64_APP} "${CMAKE_CURRENT_SOURCE_DIR}/src/base64/base64.cc" ${HEADER_FILES}) +target_link_libraries(${BASE64_APP} PRIVATE ${PROJECT_NAME}) +target_include_directories(${BASE64_APP} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/src/include") +target_compile_definitions(${BASE64_APP} PRIVATE BUFFERSIZE=16777216) +set_target_properties(${BASE64_APP} PROPERTIES LINKER_LANGUAGE CXX) +install(TARGETS ${BASE64_APP} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) diff --git a/recipes/b64/all/conandata.yml b/recipes/b64/all/conandata.yml new file mode 100644 index 0000000000000..6f62323cd1501 --- /dev/null +++ b/recipes/b64/all/conandata.yml @@ -0,0 +1,20 @@ +sources: + "2.0.0.1": + url: "https://github.com/libb64/libb64/archive/refs/tags/v2.0.0.1.tar.gz" + sha256: "ce8e578a953a591bd4a6f157eec310b9a4c2e6f10ade2fdda6ae6bafaf798b98" +patches: + "2.0.0.1": + - patch_file: "patches/0001-windows-elseif.patch" + patch_description: "Replace elseif definition by elif to make it work on Windows" + patch_type: "portability" + patch_source: "https://github.com/libb64/libb64/commit/b5edeafc89853c48fa41a4c16393a1fdc8638ab6" + - patch_file: "patches/0002-extern-c.patch" + patch_description: "Move extern C from C++ headers to C headers" + patch_type: "portability" + patch_source: "https://github.com/libb64/libb64/pull/6/commits/502573666a61317aa6bee2ff9ab74e65a7c25f63" + - patch_file: "patches/0003-stdlib-exit.patch" + patch_description: "Use cstdlib instead of stdlib.h for exit() - needed for GCC5" + patch_type: "conan" + - patch_file: "patches/0004-include-order.patch" + patch_description: "Include C headers first, than C++ headers, and project headers" + patch_type: "conan" diff --git a/recipes/b64/all/conanfile.py b/recipes/b64/all/conanfile.py new file mode 100755 index 0000000000000..bdc200c525d02 --- /dev/null +++ b/recipes/b64/all/conanfile.py @@ -0,0 +1,65 @@ +from conan import ConanFile +from conan.tools.files import get, copy, export_conandata_patches, apply_conandata_patches +from conan.tools.cmake import cmake_layout, CMakeToolchain, CMake +import os + + +required_conan_version = ">=1.53.0" + + +class B64Conan(ConanFile): + name = "b64" + description = "A library of ANSI C routines for fast encoding/decoding data into and from a base64-encoded format." + license = "CC0-1.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://libb64.sourceforge.net/" + topics = ("base64", "codec", "encoder", "decoder") + 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): + 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): + 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.generate() + + def build(self): + 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): + 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 = ["b64"] + + # TODO: Only for Conan 1.x legacy - Remove after running Conan 2.x only + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/b64/all/patches/0001-windows-elseif.patch b/recipes/b64/all/patches/0001-windows-elseif.patch new file mode 100644 index 0000000000000..ab8677906ac76 --- /dev/null +++ b/recipes/b64/all/patches/0001-windows-elseif.patch @@ -0,0 +1,13 @@ +diff --git a/include/b64/ccommon.h b/include/b64/ccommon.h +index 2b614df..28a9936 100644 +--- a/include/b64/ccommon.h ++++ b/include/b64/ccommon.h +@@ -14,7 +14,7 @@ For details, see http://sourceforge.net/projects/libb64 + #ifndef HAVE_SIZE_T + #ifdef _WIN32 + #include +- #elseif defined (__unix__) || (defined (__APPLE__) && defined (__MACH__)) ++ #elif defined (__unix__) || (defined (__APPLE__) && defined (__MACH__)) + #include + #else + typedef unsigned long size_t; diff --git a/recipes/b64/all/patches/0002-extern-c.patch b/recipes/b64/all/patches/0002-extern-c.patch new file mode 100644 index 0000000000000..ad69b157b0f90 --- /dev/null +++ b/recipes/b64/all/patches/0002-extern-c.patch @@ -0,0 +1,117 @@ +diff --git a/include/b64/cdecode.h b/include/b64/cdecode.h +index d6ff24c..889614f 100644 +--- a/include/b64/cdecode.h ++++ b/include/b64/cdecode.h +@@ -13,6 +13,11 @@ For details, see http://sourceforge.net/projects/libb64 + #define BASE64_CDEC_VER_MAJOR 2 + #define BASE64_CDEC_VER_MINOR 0 + ++#ifdef __cplusplus ++extern "C" ++{ ++#endif ++ + typedef enum + { + step_a, step_b, step_c, step_d +@@ -24,11 +29,15 @@ typedef struct + char plainchar; + } base64_decodestate; + +-extern void base64_init_decodestate(base64_decodestate* state_in); ++void base64_init_decodestate(base64_decodestate* state_in); ++ ++size_t base64_decode_maxlength(size_t encode_len); + +-extern size_t base64_decode_maxlength(size_t encode_len); ++int base64_decode_value(signed char value_in); ++size_t base64_decode_block(const char* code_in, const size_t length_in, void* plaintext_out, base64_decodestate* state_in); + +-extern int base64_decode_value(signed char value_in); +-extern size_t base64_decode_block(const char* code_in, const size_t length_in, void* plaintext_out, base64_decodestate* state_in); ++#ifdef __cplusplus ++} ++#endif + + #endif /* BASE64_CDECODE_H */ +diff --git a/include/b64/cencode.h b/include/b64/cencode.h +index 96b0cdb..9b70877 100644 +--- a/include/b64/cencode.h ++++ b/include/b64/cencode.h +@@ -13,6 +13,11 @@ For details, see http://sourceforge.net/projects/libb64 + #define BASE64_CENC_VER_MAJOR 2 + #define BASE64_CENC_VER_MINOR 0 + ++#ifdef __cplusplus ++extern "C" ++{ ++#endif ++ + typedef enum + { + step_A, step_B, step_C +@@ -31,12 +36,16 @@ typedef struct + char result; + } base64_encodestate; + +-extern void base64_init_encodestate(base64_encodestate* state_in); ++void base64_init_encodestate(base64_encodestate* state_in); ++ ++size_t base64_encode_length(size_t plain_len, base64_encodestate* state_in); + +-extern size_t base64_encode_length(size_t plain_len, base64_encodestate* state_in); ++char base64_encode_value(signed char value_in); ++size_t base64_encode_block(const void* plaintext_in, const size_t length_in, char* code_out, base64_encodestate* state_in); ++size_t base64_encode_blockend(char* code_out, base64_encodestate* state_in); + +-extern char base64_encode_value(signed char value_in); +-extern size_t base64_encode_block(const void* plaintext_in, const size_t length_in, char* code_out, base64_encodestate* state_in); +-extern size_t base64_encode_blockend(char* code_out, base64_encodestate* state_in); ++#ifdef __cplusplus ++} ++#endif + + #endif /* BASE64_CENCODE_H */ +diff --git a/include/b64/decode.h b/include/b64/decode.h +index b2362e5..bfff27c 100644 +--- a/include/b64/decode.h ++++ b/include/b64/decode.h +@@ -12,10 +12,8 @@ For details, see http://sourceforge.net/projects/libb64 + + namespace base64 + { +- extern "C" +- { +- #include "cdecode.h" +- } ++ ++#include "cdecode.h" + + struct decoder + { +@@ -69,4 +67,3 @@ namespace base64 + + + #endif // BASE64_DECODE_H +- +diff --git a/include/b64/encode.h b/include/b64/encode.h +index c1a5f88..c1c2ead 100644 +--- a/include/b64/encode.h ++++ b/include/b64/encode.h +@@ -12,10 +12,8 @@ For details, see http://sourceforge.net/projects/libb64 + + namespace base64 + { +- extern "C" +- { ++ + #include "cencode.h" +- } + + struct encoder + { +@@ -75,4 +73,3 @@ namespace base64 + } // namespace base64 + + #endif // BASE64_ENCODE_H +- diff --git a/recipes/b64/all/patches/0003-stdlib-exit.patch b/recipes/b64/all/patches/0003-stdlib-exit.patch new file mode 100644 index 0000000000000..0ccb585ce887e --- /dev/null +++ b/recipes/b64/all/patches/0003-stdlib-exit.patch @@ -0,0 +1,57 @@ +diff --git a/base64/base64.cc b/base64/base64.cc +index acab416..f952dc6 100644 +--- a/base64/base64.cc ++++ b/base64/base64.cc +@@ -12,7 +12,7 @@ For details, see http://sourceforge.net/projects/libb64 + #include + #include + +-#include ++#include + + // Function which prints the usage of this executable + void usage() +@@ -38,14 +38,14 @@ int main(int argc, char** argv) + if (argc == 1) + { + usage(); +- exit(-1); ++ std::exit(-1); + } + if (argc != 4) + { + usage("Wrong number of arguments!"); +- exit(-1); ++ std::exit(-1); + } +- ++ + // So far so good; try to open the input file + std::string input = argv[2]; + // Note that we have to open the input in binary mode. +@@ -56,9 +56,9 @@ int main(int argc, char** argv) + if (!instream.is_open()) + { + usage("Could not open input file!"); +- exit(-1); ++ std::exit(-1); + } +- ++ + // Now try to open the output file + std::string output = argv[3]; + // Again, note that we have to open the ouput in binary mode. +@@ -68,7 +68,7 @@ int main(int argc, char** argv) + if (!outstream.is_open()) + { + usage("Could not open output file!"); +- exit(-1); ++ std::exit(-1); + } + + // determine whether we need to encode or decode: +@@ -91,4 +91,3 @@ int main(int argc, char** argv) + + return 0; + } +- diff --git a/recipes/b64/all/patches/0004-include-order.patch b/recipes/b64/all/patches/0004-include-order.patch new file mode 100644 index 0000000000000..b509bb64fb543 --- /dev/null +++ b/recipes/b64/all/patches/0004-include-order.patch @@ -0,0 +1,22 @@ +diff --git a/base64/base64.cc b/base64/base64.cc +index f952dc6..e22abd0 100644 +--- a/base64/base64.cc ++++ b/base64/base64.cc +@@ -5,14 +5,14 @@ This is part of the libb64 project, and has been placed in the public domain. + For details, see http://sourceforge.net/projects/libb64 + */ + +-#include +-#include ++#include + + #include + #include + #include + +-#include ++#include ++#include + + // Function which prints the usage of this executable + void usage() diff --git a/recipes/b64/all/test_package/CMakeLists.txt b/recipes/b64/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..21db2d93d4c6c --- /dev/null +++ b/recipes/b64/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) + +project(test_package CXX) + +find_package(b64 REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE b64::b64) diff --git a/recipes/b64/all/test_package/conanfile.py b/recipes/b64/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fb96656f203 --- /dev/null +++ b/recipes/b64/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/b64/all/test_package/test_package.cpp b/recipes/b64/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..32696bbbcfe1a --- /dev/null +++ b/recipes/b64/all/test_package/test_package.cpp @@ -0,0 +1,26 @@ +#include + +extern "C" { + #include "b64/cencode.h" + #include "b64/cdecode.h" +} + +int main() { + const char str[] = "Hello world!"; + const unsigned len = sizeof(str); + char out[len*2] = {0}, rev[len*2] = {0}; + + base64_encodestate E; + base64_init_encodestate(&E); + base64_decodestate D; + base64_init_decodestate(&D); + + const unsigned out_len = base64_encode_block(str, len, out, &E); + base64_decode_block(out, out_len, rev, &D); + + std::cout << "input: " << str << std::endl; + std::cout << "base64: " << out << std::endl; + std::cout << "reversed: " << rev << std::endl; + + return 0; +} diff --git a/recipes/dbus/1.x.x/test_v1_package/CMakeLists.txt b/recipes/b64/all/test_v1_package/CMakeLists.txt similarity index 100% rename from recipes/dbus/1.x.x/test_v1_package/CMakeLists.txt rename to recipes/b64/all/test_v1_package/CMakeLists.txt diff --git a/recipes/base64/all/test_v1_package/conanfile.py b/recipes/b64/all/test_v1_package/conanfile.py similarity index 100% rename from recipes/base64/all/test_v1_package/conanfile.py rename to recipes/b64/all/test_v1_package/conanfile.py diff --git a/recipes/b64/config.yml b/recipes/b64/config.yml new file mode 100644 index 0000000000000..db58b29f8bd29 --- /dev/null +++ b/recipes/b64/config.yml @@ -0,0 +1,3 @@ +versions: + "2.0.0.1": + folder: all diff --git a/recipes/backport-cpp/all/conanfile.py b/recipes/backport-cpp/all/conanfile.py index a114a54bf9ff4..7bd9c00c00321 100644 --- a/recipes/backport-cpp/all/conanfile.py +++ b/recipes/backport-cpp/all/conanfile.py @@ -9,22 +9,22 @@ class BackportCppRecipe(ConanFile): name = "backport-cpp" description = "An ongoing effort to bring modern C++ utilities to be compatible with C++11" - topics = ("backport-cpp", "header-only", "backport") + topics = ("header-only", "backport") homepage = "https://github.com/bitwizeshift/BackportCpp" url = "https://github.com/conan-io/conan-center-index" license = "MIT" + package_type = "header-library" 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 @@ -37,9 +37,7 @@ def package_info(self): self.cpp_info.set_property("cmake_file_name", "Backport") self.cpp_info.set_property("cmake_target_name", "Backport::Backport") 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"] = "Backport" diff --git a/recipes/backward-cpp/all/conanfile.py b/recipes/backward-cpp/all/conanfile.py index 5ca9c317f3d8d..66cfef012cf47 100644 --- a/recipes/backward-cpp/all/conanfile.py +++ b/recipes/backward-cpp/all/conanfile.py @@ -3,10 +3,11 @@ 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.layout import basic_layout from conan.tools.scm import Version import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class BackwardCppConan(ConanFile): @@ -17,14 +18,17 @@ class BackwardCppConan(ConanFile): topics = ("backward-cpp", "stack-trace") license = "MIT" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { + "header_only": [True, False], "shared": [True, False], "fPIC": [True, False], - "stack_walking" : ["unwind", "backtrace"], - "stack_details" : ["dw", "bfd", "dwarf", "backtrace_symbol"], + "stack_walking": ["unwind", "libunwind", "backtrace"], + "stack_details": ["dw", "bfd", "dwarf", "backtrace_symbol"], } default_options = { + "header_only": False, "shared": False, "fPIC": True, "stack_walking": "unwind", @@ -33,16 +37,16 @@ class BackwardCppConan(ConanFile): @property def _supported_os(self): - supported_os = ["Linux", "Macos", "Android"] + supported_os = ["Linux", "FreeBSD", "Android", "Macos"] if Version(self.version) >= "1.5": supported_os.append("Windows") return supported_os - def _has_stack_walking(self, type): - return self.options.stack_walking == type + def _has_stack_walking(self, method): + return self.options.stack_walking == method - def _has_stack_details(self, type): - return False if self.settings.os == "Windows" else self.options.stack_details == type + def _has_stack_details(self, method): + return False if self.settings.os == "Windows" else self.options.stack_details == method def export_sources(self): export_conandata_patches(self) @@ -56,43 +60,59 @@ def config_options(self): self.options.stack_details = "backtrace_symbol" def configure(self): - if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + if self.options.header_only: + self.options.rm_safe("fPIC") + self.options.rm_safe("shared") + if self.options.get_safe("shared"): + self.options.rm_safe("fPIC") def layout(self): - cmake_layout(self, src_folder="src") + 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 requirements(self): - if self.settings.os in ["Linux", "Android"]: + if self.settings.os in ["Linux", "FreeBSD", "Android"]: + if self._has_stack_walking("libunwind"): + self.requires("libunwind/1.7.2", transitive_headers=True) if self._has_stack_details("dwarf"): - self.requires("libdwarf/20191104") + self.requires("libdwarf/20191104", transitive_headers=True, transitive_libs=True) + self.requires("libelf/0.8.13") if self._has_stack_details("dw"): - self.requires("elfutils/0.186") + self.requires("elfutils/0.190", transitive_headers=True) if self._has_stack_details("bfd"): - self.requires("binutils/2.38") + self.requires("binutils/2.41", transitive_headers=True) def validate(self): - 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"): + if self.settings.os not in self._supported_os: + raise ConanInvalidConfiguration(f"{self.ref} is not supported on {self.settings.os}.") + if self.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 self._has_stack_walking("libunwind"): + if Version(self.version) < "1.6": + raise ConanInvalidConfiguration("Support for libunwind is only available as of 1.6.") + if self.settings.os == "Windows": + raise ConanInvalidConfiguration("Support for libunwind is only available on Linux and macOS.") + if self.settings.os == "Macos": + if self.settings.arch == "armv8" and Version(self.version) < "1.6": + raise ConanInvalidConfiguration("Support for Apple Silicon is only available as of 1.6.") if not self._has_stack_details("backtrace_symbol"): - raise ConanInvalidConfiguration("only stack_details=backtrace_symbol" - " is supported on Macos") + raise ConanInvalidConfiguration("Stack details other than backtrace_symbol are not supported on macOS.") 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 self.options.header_only: + return tc = CMakeToolchain(self) tc.variables["STACK_WALKING_UNWIND"] = self._has_stack_walking("unwind") + tc.variables["STACK_WALKING_LIBUNWIND"] = self._has_stack_walking("libunwind") 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") @@ -108,32 +128,44 @@ def generate(self): def build(self): apply_conandata_patches(self) + if self.options.header_only: + return 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", "backward")) + if self.options.header_only: + copy(self, pattern="*.hpp", + src=self.source_folder, + dst=os.path.join(self.package_folder, "include")) + else: + cmake = CMake(self) + cmake.install() + rmdir(self, os.path.join(self.package_folder, "lib", "backward")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "Backward") self.cpp_info.set_property("cmake_target_name", "Backward::Backward") - self.cpp_info.defines.append("BACKWARD_HAS_UNWIND={}".format(int(self._has_stack_walking("unwind")))) - self.cpp_info.defines.append("BACKWARD_HAS_BACKTRACE={}".format(int(self._has_stack_walking("backtrace")))) - - self.cpp_info.defines.append("BACKWARD_HAS_BACKTRACE_SYMBOL={}".format(int(self._has_stack_details("backtrace_symbol")))) - self.cpp_info.defines.append("BACKWARD_HAS_DW={}".format(int(self._has_stack_details("dw")))) - self.cpp_info.defines.append("BACKWARD_HAS_BFD={}".format(int(self._has_stack_details("bfd")))) - 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 = ["backward"] - if self.settings.os == "Linux": - self.cpp_info.system_libs.extend(["dl"]) + self.cpp_info.defines.append(f"BACKWARD_HAS_UNWIND={int(self._has_stack_walking('unwind'))}") + self.cpp_info.defines.append(f"BACKWARD_HAS_LIBUNWIND={int(self._has_stack_walking('libunwind'))}") + self.cpp_info.defines.append(f"BACKWARD_HAS_BACKTRACE={int(self._has_stack_walking('backtrace'))}") + + self.cpp_info.defines.append(f"BACKWARD_HAS_BACKTRACE_SYMBOL={int(self._has_stack_details('backtrace_symbol'))}") + self.cpp_info.defines.append(f"BACKWARD_HAS_DW={int(self._has_stack_details('dw'))}") + self.cpp_info.defines.append(f"BACKWARD_HAS_BFD={int(self._has_stack_details('bfd'))}") + self.cpp_info.defines.append(f"BACKWARD_HAS_DWARF={int(self._has_stack_details('dwarf'))}") + self.cpp_info.defines.append(f"BACKWARD_HAS_PDB_SYMBOL={int(self.settings.os == 'Windows')}") + + if self.options.header_only: + self.cpp_info.libdirs = [] + self.cpp_info.bindirs = [] + else: + self.cpp_info.libs = ["backward"] + if self.settings.os in ["Linux", "FreeBSD", "Android"]: + self.cpp_info.system_libs.extend(["dl", "m"]) if self.settings.os == "Windows": self.cpp_info.system_libs.extend(["psapi", "dbghelp"]) 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 2fa198687d928..7d2e80dfe3661 100644 --- a/recipes/backward-cpp/all/patches/backward-cpp-1.5.patch +++ b/recipes/backward-cpp/all/patches/backward-cpp-1.5.patch @@ -41,11 +41,17 @@ ############################################################################### -@@ -86,6 +86,19 @@ endif() +@@ -86,6 +86,25 @@ 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) ++if(STACK_WALKING_LIBUNWIND) ++ if(NOT APPLE) ++ find_package(libunwind REQUIRED CONFIG) ++ target_link_libraries(backward PUBLIC libunwind::libunwind) ++ endif() ++endif() +if(STACK_DETAILS_DW) + find_package(elfutils REQUIRED CONFIG) + target_link_libraries(backward PUBLIC elfutils::libdw) diff --git a/recipes/bacnet-stack/all/conandata.yml b/recipes/bacnet-stack/all/conandata.yml index d44111989de5e..41d4559c7823d 100644 --- a/recipes/bacnet-stack/all/conandata.yml +++ b/recipes/bacnet-stack/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.3.2": + url: "https://github.com/bacnet-stack/bacnet-stack/archive/refs/tags/bacnet-stack-1.3.2.tar.gz" + sha256: "e38cee9a96485692d5306bcd893ad02244efbecead12be8d2b2e3f3fc50328cb" "1.0.0": url: "https://github.com/bacnet-stack/bacnet-stack/archive/refs/tags/bacnet-stack-1.0.0.tar.gz" sha256: "8dad24decb3870bc8147a1ea5eecd5c6f8c1205ec48d5ae4d454085427122658" diff --git a/recipes/bacnet-stack/config.yml b/recipes/bacnet-stack/config.yml index c7f13630776fb..13d48541c0abc 100644 --- a/recipes/bacnet-stack/config.yml +++ b/recipes/bacnet-stack/config.yml @@ -1,3 +1,5 @@ versions: + "1.3.2": + 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/sol2/3.x.x/test_package/conanfile.py b/recipes/baical-p7/all/test_v1_package/conanfile.py similarity index 100% rename from recipes/sol2/3.x.x/test_package/conanfile.py rename to recipes/baical-p7/all/test_v1_package/conanfile.py diff --git a/recipes/bandit/all/conanfile.py b/recipes/bandit/all/conanfile.py index 31fd2c6978fa4..5bc2e2513915d 100644 --- a/recipes/bandit/all/conanfile.py +++ b/recipes/bandit/all/conanfile.py @@ -1,39 +1,41 @@ from conan import ConanFile -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 import os -required_conan_version = ">=1.51.3" +required_conan_version = ">=1.52.0" class BanditConan(ConanFile): name = "bandit" description = "Human-friendly unit testing for C++11" - topics = ("testing", "header-only") + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/banditcpp/bandit" - license = "MIT" + topics = ("testing", "header-only") + package_type = "header-library" 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 requirements(self): - self.requires("snowhouse/5.0.0") + self.requires("snowhouse/5.0.0", transitive_headers=True) 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 layout(self): - basic_layout(self) + basic_layout(self, src_folder="src") 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")) + copy(self, + pattern="*.h", + dst=os.path.join(self.package_folder, "include", "bandit"), + src=os.path.join(self.source_folder, "bandit")) def package_id(self): self.info.clear() @@ -43,4 +45,3 @@ def package_info(self): self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] self.cpp_info.resdirs = [] - diff --git a/recipes/base64/all/conandata.yml b/recipes/base64/all/conandata.yml index 6ebaff03fb45d..f8a16e7db8b32 100644 --- a/recipes/base64/all/conandata.yml +++ b/recipes/base64/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "0.5.2": + url: "https://github.com/aklomp/base64/archive/v0.5.2.tar.gz" + sha256: "723a0f9f4cf44cf79e97bcc315ec8f85e52eb104c8882942c3f2fba95acc080d" + "0.5.1": + url: "https://github.com/aklomp/base64/archive/v0.5.1.tar.gz" + sha256: "35fd9400ce85ba5fc5455b3f1c8d0078d084ad246bd808315fd01ea8f2876dbf" "0.5.0": url: "https://github.com/aklomp/base64/archive/v0.5.0.tar.gz" sha256: "b21be58a90d31302ba86056db7ef77a481393b9359c505be5337d7d54e8a0559" diff --git a/recipes/base64/all/conanfile.py b/recipes/base64/all/conanfile.py index d56ae8c5bcf10..e01cf8be42f58 100644 --- a/recipes/base64/all/conanfile.py +++ b/recipes/base64/all/conanfile.py @@ -1,8 +1,7 @@ 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.files import copy, get, apply_conandata_patches, chdir, export_conandata_patches, rmdir +from conan.tools.env import Environment from conan.tools.gnu import Autotools, AutotoolsToolchain from conan.tools.layout import basic_layout from conan.tools.microsoft import is_msvc @@ -10,7 +9,8 @@ import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" + class Base64Conan(ConanFile): name = "base64" @@ -18,7 +18,8 @@ class Base64Conan(ConanFile): license = "BSD-2-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/aklomp/base64" - topics = ("base64", "codec", "encoder", "decoder") + topics = ("codec", "encoder", "decoder") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -33,23 +34,17 @@ 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: - 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 + if Version(self.version) < "0.5.0": + del self.options.shared + self.package_type = "static-library" + if self.options.get_safe("shared"): + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): if self._use_cmake: @@ -57,13 +52,8 @@ def layout(self): else: basic_layout(self, src_folder="src") - 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 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 _use_cmake(self): @@ -72,6 +62,10 @@ def _use_cmake(self): def generate(self): if self._use_cmake: tc = CMakeToolchain(self) + tc.variables["BASE64_BUILD_CLI"] = False + tc.variables["BASE64_WERROR"] = False + tc.variables["BASE64_BUILD_TESTS"] = False + tc.variables["BASE64_WITH_OpenMP"] = False tc.generate() else: tc = AutotoolsToolchain(self) @@ -82,10 +76,7 @@ def build(self): if self._use_cmake: cmake = CMake(self) cmake.configure() - if Version(self.version) >= "0.5.0": - cmake.build() - else: - cmake.build(target="base64") + cmake.build() else: env = Environment() if self.settings.arch == "x86" or self.settings.arch == "x86_64": @@ -111,14 +102,14 @@ def package(self): 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.set_property("cmake_file_name", "base64") + self.cpp_info.set_property("cmake_target_name", "aklomp::base64") self.cpp_info.libs = ["base64"] if Version(self.version) >= "0.5.0" and not self.options.shared: diff --git a/recipes/base64/all/patches/0.4.0-0002-cmake.patch b/recipes/base64/all/patches/0.4.0-0002-cmake.patch index 4b833cc2f77c3..27b194373c867 100644 --- a/recipes/base64/all/patches/0.4.0-0002-cmake.patch +++ b/recipes/base64/all/patches/0.4.0-0002-cmake.patch @@ -29,7 +29,7 @@ +# Compilation options +option(BASE64_INSTALL_TARGET "add an install target" ON) +option(BASE64_BUILD_TESTS "add test projects" ON) -+option(BASE64_WITH_OPENMP "use openmp" OFF) ++option(BASE64_WITH_OpenMP "use openmp" OFF) + +if (_TARGET_ARCH STREQUAL "x86" OR _TARGET_ARCH STREQUAL "x64") + option(BASE64_WITH_FAST_UNALIGNED_ACCESS "vectorization: unaligned access enabled" ON) @@ -49,7 +49,7 @@ + +################################################################### +# OpenMP -+if(BASE64_WITH_OPENMP) ++if(BASE64_WITH_OpenMP) + find_package(OpenMP) + if (OPENMP_FOUND) + option(BASE64_USE_OpenMP "Utilize OpenMP to parallelize encoding and decoding." ON) @@ -180,9 +180,9 @@ +# install target +if (BASE64_INSTALL_TARGET) + install(TARGETS base64 EXPORT base64-targets -+ RUNTIME DESTINATION bin/$ -+ LIBRARY DESTINATION lib/$ -+ ARCHIVE DESTINATION lib/$ ++ RUNTIME DESTINATION bin ++ LIBRARY DESTINATION lib ++ ARCHIVE DESTINATION lib + INCLUDES DESTINATION include + ) + install(FILES include/libbase64.h DESTINATION include) diff --git a/recipes/base64/all/test_package/CMakeLists.txt b/recipes/base64/all/test_package/CMakeLists.txt index 195fdf269b250..d13d382a6be8a 100644 --- a/recipes/base64/all/test_package/CMakeLists.txt +++ b/recipes/base64/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) - -project(test_package C) +project(test_package LANGUAGES C) find_package(base64 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE base64::base64) +target_link_libraries(${PROJECT_NAME} PRIVATE aklomp::base64) diff --git a/recipes/base64/all/test_v1_package/CMakeLists.txt b/recipes/base64/all/test_v1_package/CMakeLists.txt deleted file mode 100644 index 6c32de99d28f7..0000000000000 --- a/recipes/base64/all/test_v1_package/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -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/config.yml b/recipes/base64/config.yml index d13fcfd021b7b..7e8cf882c17d0 100644 --- a/recipes/base64/config.yml +++ b/recipes/base64/config.yml @@ -1,4 +1,8 @@ versions: + "0.5.2": + folder: all + "0.5.1": + folder: all "0.5.0": folder: all "0.4.0": diff --git a/recipes/basu/all/conandata.yml b/recipes/basu/all/conandata.yml new file mode 100644 index 0000000000000..3da511b3e486b --- /dev/null +++ b/recipes/basu/all/conandata.yml @@ -0,0 +1,11 @@ +sources: + "0.2.1": + url: "https://git.sr.ht/~emersion/basu/refs/download/v0.2.1/basu-0.2.1.tar.gz" + sha256: "d9b373a9fcb5d5eb5f6c1c56355f76edb7f2f52bc744570e80604e83455a19bd" + +patches: + "0.2.1": + - patch_file: "patches/0001-memfd-util.c-Use-F_ADD_SEALS-definition-from-missing.patch" + patch_description: "add missing header to support old glibc" + patch_type: "portability" + patch_source: "https://lists.sr.ht/~emersion/public-inbox/patches/49899" diff --git a/recipes/basu/all/conanfile.py b/recipes/basu/all/conanfile.py new file mode 100644 index 0000000000000..5fbf09d93352b --- /dev/null +++ b/recipes/basu/all/conanfile.py @@ -0,0 +1,97 @@ +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, rmdir +from conan.tools.gnu import PkgConfigDeps +from conan.tools.layout import basic_layout +from conan.tools.meson import Meson, MesonToolchain +import os + + +required_conan_version = ">=1.53.0" + + +class BasuConan(ConanFile): + name = "basu" + description = "The sd-bus library, extracted from systemd" + license = "LGPL-2.1-or-later" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://git.sr.ht/~emersion/basu" + topics = ("dbus", "sd-bus", "systemd") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_libcap": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_libcap": True, + } + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os != "Linux": + del self.options.with_libcap + + 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_libcap"): + self.requires("libcap/2.69") + + def validate(self): + if self.settings.os not in ["Linux", "FreeBSD"]: + raise ConanInvalidConfiguration( + f"{self.ref} does not support {self.settings.os}") + + def build_requirements(self): + self.tool_requires("meson/1.3.2") + self.tool_requires("gperf/3.1") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/2.1.0") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + feature = lambda option: "enabled" if option else "disabled" + + tc = MesonToolchain(self) + tc.project_options["auto_features"] = "disabled" + tc.project_options["libcap"] = feature(self.options.get_safe("with_libcap")) + tc.generate() + tc = PkgConfigDeps(self) + tc.generate() + tc = VirtualBuildEnv(self) + tc.generate() + + def build(self): + apply_conandata_patches(self) + meson = Meson(self) + meson.configure() + meson.build() + + def package(self): + copy(self, "LICENSE.LGPL2.1", 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")) + + def package_info(self): + self.cpp_info.libs = ["basu"] + self.cpp_info.set_property("pkg_config_name", "basu") + self.cpp_info.system_libs.extend(["m", "pthread", "rt"]) diff --git a/recipes/basu/all/patches/0001-memfd-util.c-Use-F_ADD_SEALS-definition-from-missing.patch b/recipes/basu/all/patches/0001-memfd-util.c-Use-F_ADD_SEALS-definition-from-missing.patch new file mode 100644 index 0000000000000..69e899279f1ae --- /dev/null +++ b/recipes/basu/all/patches/0001-memfd-util.c-Use-F_ADD_SEALS-definition-from-missing.patch @@ -0,0 +1,34 @@ +From 8e4960e8b9d11d9be96e83b02bd3b08178ddce1b Mon Sep 17 00:00:00 2001 +From: Sergey Bobrenok +Date: Wed, 28 Feb 2024 20:42:19 +0300 +Subject: [PATCH basu] memfd-util.c: Use F_ADD_SEALS definition from missing.h + +uClibc and glibc (until version 2.27, 2018) implementations don't +support F_ADD_SEALS and other F_SEAL_xxx flags. +'missing.h' was removed from 'memfd-util.c' in 37dbb2fcb ("Remove +useless includes"). + +Upstream: https://lists.sr.ht/~emersion/public-inbox/patches/49899 + +Signed-off-by: Sergey Bobrenok +--- + src/basic/memfd-util.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/basic/memfd-util.c b/src/basic/memfd-util.c +index 89893ba..7e535c6 100644 +--- a/src/basic/memfd-util.c ++++ b/src/basic/memfd-util.c +@@ -7,6 +7,7 @@ + + #include "alloc-util.h" + #include "memfd-util.h" ++#include "missing.h" + + int memfd_set_sealed(int fd) { + #if defined(__FreeBSD__) && __FreeBSD__ < 13 + +base-commit: 684a41d68cfbb05e38aacb60a8548e21ddfbecdb +-- +2.44.0 + diff --git a/recipes/basu/all/test_package/conanfile.py b/recipes/basu/all/test_package/conanfile.py new file mode 100644 index 0000000000000..cdcf9b281723d --- /dev/null +++ b/recipes/basu/all/test_package/conanfile.py @@ -0,0 +1,32 @@ +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): + 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/1.3.2") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/2.1.0") + + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/basu/all/test_package/meson.build b/recipes/basu/all/test_package/meson.build new file mode 100644 index 0000000000000..adf0ed21b4bcd --- /dev/null +++ b/recipes/basu/all/test_package/meson.build @@ -0,0 +1,5 @@ +project('test_package', 'c') +package_dep = dependency('basu') +executable('test_package', + sources : ['test_package.c'], + dependencies : [package_dep]) diff --git a/recipes/basu/all/test_package/test_package.c b/recipes/basu/all/test_package/test_package.c new file mode 100644 index 0000000000000..9fe70e4d4a1ce --- /dev/null +++ b/recipes/basu/all/test_package/test_package.c @@ -0,0 +1,19 @@ +#include +#include + +#include + +int main(void) { + char *id = NULL; + int ret = 0; + + puts("decode object path"); + ret = sd_bus_path_decode("/foo/bar", "/foo", &id); + free(id); + if (ret > 0) { + puts("ok"); + return EXIT_SUCCESS; + } + puts("failed"); + return EXIT_FAILURE; +} diff --git a/recipes/basu/config.yml b/recipes/basu/config.yml new file mode 100644 index 0000000000000..f975c1e3261f7 --- /dev/null +++ b/recipes/basu/config.yml @@ -0,0 +1,3 @@ +versions: + "0.2.1": + folder: all diff --git a/recipes/battery-embed/all/conandata.yml b/recipes/battery-embed/all/conandata.yml new file mode 100644 index 0000000000000..b94490b90ffc3 --- /dev/null +++ b/recipes/battery-embed/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.2.19": + url: "https://github.com/batterycenter/embed/archive/refs/tags/v1.2.19.tar.gz" + sha256: "d472655b6eec215cd7cd20411f3596f22f597ea6a82fbbc5a5d7271e102b610e" diff --git a/recipes/battery-embed/all/conanfile.py b/recipes/battery-embed/all/conanfile.py new file mode 100644 index 0000000000000..42b1dc0f23c98 --- /dev/null +++ b/recipes/battery-embed/all/conanfile.py @@ -0,0 +1,74 @@ +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.cmake import cmake_layout +from conan.tools.scm import Version +import os + +required_conan_version = ">=1.53.0" + +class BatteryEmbedConan(ConanFile): + name = "battery-embed" + description = "A CMake/C++20 library to embed resource files at compile time" + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/batterycenter/embed" + topics = ("embed") + package_type = "build-scripts" + settings = "os", "arch", "compiler", "build_type" + + @property + def _min_cppstd(self): + return 20 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "11", + "clang": "12", + "apple-clang": "13", + "Visual Studio": "16", + "msvc": "192", + } + + def export_sources(self): + copy(self, "embed.cmake", 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.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 package_id(self): + del self.info.settings.arch + del self.info.settings.compiler + del self.info.settings.build_type + del self.info.settings.os + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def build(self): + copy(self, "embed.cmake", os.path.join(self.source_folder, os.pardir), self.recipe_folder) + + def package(self): + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + copy(self, "embed.cmake", self.recipe_folder, os.path.join(self.package_folder, "lib", "cmake")) + copy(self, "CMakeLists.txt", self.source_folder, os.path.join(self.package_folder, "lib", "cmake", "battery-embed")) + + def package_info(self): + self.cpp_info.libdirs = [] + self.cpp_info.bindirs = [] + self.cpp_info.includedirs = [] + + self.cpp_info.set_property("cmake_target_name", "battery::embed") + self.cpp_info.builddirs.append(os.path.join("lib", "cmake")) + self.cpp_info.set_property("cmake_build_modules", [os.path.join("lib", "cmake", "embed.cmake")]) diff --git a/recipes/battery-embed/all/embed.cmake b/recipes/battery-embed/all/embed.cmake new file mode 100644 index 0000000000000..59fe1f00e55a0 --- /dev/null +++ b/recipes/battery-embed/all/embed.cmake @@ -0,0 +1,4 @@ +# cmake proxy module +cmake_minimum_required(VERSION 3.21) + +add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/battery-embed battery-embed-build) diff --git a/recipes/battery-embed/all/test_package/CMakeLists.txt b/recipes/battery-embed/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..b5eb771902175 --- /dev/null +++ b/recipes/battery-embed/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(battery-embed REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) + +b_embed(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/battery-embed/all/test_package/conanfile.py b/recipes/battery-embed/all/test_package/conanfile.py new file mode 100644 index 0000000000000..065416112515f --- /dev/null +++ b/recipes/battery-embed/all/test_package/conanfile.py @@ -0,0 +1,29 @@ +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_requirements(self): + self.tool_requires("cmake/[>=3.21 <4]") + + 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/battery-embed/all/test_package/test_package.cpp b/recipes/battery-embed/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..feb15d322e7f2 --- /dev/null +++ b/recipes/battery-embed/all/test_package/test_package.cpp @@ -0,0 +1,8 @@ +#include + +#include "battery/embed.hpp" + +int main(void) { + std::cout << b::embed<"test_package.cpp">() << std::endl; + return EXIT_SUCCESS; +} diff --git a/recipes/battery-embed/config.yml b/recipes/battery-embed/config.yml new file mode 100644 index 0000000000000..a18e338f675d9 --- /dev/null +++ b/recipes/battery-embed/config.yml @@ -0,0 +1,3 @@ +versions: + "1.2.19": + folder: all diff --git a/recipes/bazel/all/conandata.yml b/recipes/bazel/all/conandata.yml index 00f7c7d9a52af..554c60438f66f 100644 --- a/recipes/bazel/all/conandata.yml +++ b/recipes/bazel/all/conandata.yml @@ -1,10 +1,170 @@ sources: + "7.2.1": + license: + url: "https://raw.githubusercontent.com/bazelbuild/bazel/7.2.1/LICENSE" + sha256: "cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30" + Macos: + x86_64: + url: "https://github.com/bazelbuild/bazel/releases/download/7.2.1/bazel-7.2.1-darwin-x86_64" + sha256: "2c29176d6ce9ccdd16d5a15e348c756abd6e0005c77d4695b61871219295fa96" + armv8: + url: "https://github.com/bazelbuild/bazel/releases/download/7.2.1/bazel-7.2.1-darwin-arm64" + sha256: "6ac72cd7c0b422e3e8162a6912f963ddee45c645bf7dadb924728a80076c38b2" + Linux: + x86_64: + url: "https://github.com/bazelbuild/bazel/releases/download/7.2.1/bazel-7.2.1-linux-x86_64" + sha256: "80ccd1ecb4b88750fbe5d7622d67072fddcba9da7808f13356555e480bf67875" + armv8: + url: "https://github.com/bazelbuild/bazel/releases/download/7.2.1/bazel-7.2.1-linux-arm64" + sha256: "5a4cc979353671e438b9469b833924c2361e25a580cc278a75877aedc27c1c53" + Windows: + x86_64: + url: "https://github.com/bazelbuild/bazel/releases/download/7.2.1/bazel-7.2.1-windows-x86_64.exe" + sha256: "4926bd3bf580b8b3323e0d09bde5dc6120fdd262d99f753eb61fedfb9a2cfc49" + armv8: + url: "https://github.com/bazelbuild/bazel/releases/download/7.2.1/bazel-7.2.1-windows-arm64.exe" + sha256: "d8b1a0da1c6e9d94a5ac4a2728d344e496c32e68cf27ed6a2c117d38fa994fc8" + + "7.0.0": + license: + url: "https://raw.githubusercontent.com/bazelbuild/bazel/7.0.0/LICENSE" + sha256: "cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30" + Macos: + x86_64: + url: "https://github.com/bazelbuild/bazel/releases/download/7.0.0/bazel-7.0.0-darwin-x86_64" + sha256: "e0b57be60062f36eceed78d672088c6a2e30bd7de8674e2ee4edcd021b131c8c" + armv8: + url: "https://github.com/bazelbuild/bazel/releases/download/7.0.0/bazel-7.0.0-darwin-arm64" + sha256: "b1cf1c5783fa3eac60942bf2ec6169cfccecd2fa5a355587d8d35983bc1e1310" + Linux: + x86_64: + url: "https://github.com/bazelbuild/bazel/releases/download/7.0.0/bazel-7.0.0-linux-x86_64" + sha256: "8b24f70542f9736e0ccbf9cb3335cb9f049b5a6787f1e5997ed1da80b9bbd46e" + armv8: + url: "https://github.com/bazelbuild/bazel/releases/download/7.0.0/bazel-7.0.0-linux-arm64" + sha256: "cae101d31581a348774526b9d11811b04cc212c943762e6363a85a15bccfca54" + Windows: + x86_64: + url: "https://github.com/bazelbuild/bazel/releases/download/7.0.0/bazel-7.0.0-windows-x86_64.exe" + sha256: "bf4adcd2764dbca6332092950f41c5ae435a38032c1c00a5558ef963b32107a1" + armv8: + url: "https://github.com/bazelbuild/bazel/releases/download/7.0.0/bazel-7.0.0-windows-arm64.exe" + sha256: "7846fc1180c7cf1985f7748db40066590f20a62a9e5c56ee5b1f1f127cb978c5" + + "6.5.0": + license: + url: "https://raw.githubusercontent.com/bazelbuild/bazel/6.5.0/LICENSE" + sha256: "cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30" + Macos: + x86_64: + url: "https://github.com/bazelbuild/bazel/releases/download/6.5.0/bazel-6.5.0-darwin-x86_64" + sha256: "bbf9c2c03bac48e0514f46db0295027935535d91f6d8dcd960c53393559eab29" + armv8: + url: "https://github.com/bazelbuild/bazel/releases/download/6.5.0/bazel-6.5.0-darwin-arm64" + sha256: "c6b6dc17efcdf13fba484c6fe0b6c3361b888ae7b9573bc25a2dbe8c502448eb" + Linux: + x86_64: + url: "https://github.com/bazelbuild/bazel/releases/download/6.5.0/bazel-6.5.0-linux-x86_64" + sha256: "a40ac69263440761199fcb8da47ad4e3f328cbe79ffbf4ecc14e5ba252857307" + armv8: + url: "https://github.com/bazelbuild/bazel/releases/download/6.5.0/bazel-6.5.0-linux-arm64" + sha256: "5afe973cadc036496cac66f1414ca9be36881423f576db363d83afc9084c0c2f" + Windows: + x86_64: + url: "https://github.com/bazelbuild/bazel/releases/download/6.5.0/bazel-6.5.0-windows-x86_64.exe" + sha256: "6eae8e7f28e1b68b833503d1a58caf139c11e52de19df0d787d974653a0ea4c6" + armv8: + url: "https://github.com/bazelbuild/bazel/releases/download/6.5.0/bazel-6.5.0-windows-arm64.exe" + sha256: "b40d2ab8aa0b8413b2bdd599ec1c571d09714275f35ba476e89b3fca6857a937" + + "6.2.0": + license: + url: "https://raw.githubusercontent.com/bazelbuild/bazel/6.2.0/LICENSE" + sha256: "cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30" + Macos: + x86_64: + url: "https://github.com/bazelbuild/bazel/releases/download/6.2.0/bazel-6.2.0-darwin-x86_64" + sha256: "d2356012843ce3a2fbba89f88191673a6ad2f7716cc46ad43ec1bcee78d36b44" + armv8: + url: "https://github.com/bazelbuild/bazel/releases/download/6.2.0/bazel-6.2.0-darwin-arm64" + sha256: "482957a15c34eb43b1d1ae5e7623444e4783a04d4c618d7c518fe7b3dbf75512" + Linux: + x86_64: + url: "https://github.com/bazelbuild/bazel/releases/download/6.2.0/bazel-6.2.0-linux-x86_64" + sha256: "3d11c26fb9ba12c833844450bb90165b176e8a19cb5cf5923f3cec855837f17c" + armv8: + url: "https://github.com/bazelbuild/bazel/releases/download/6.2.0/bazel-6.2.0-linux-arm64" + sha256: "16e41fe8fb791ffb9835643435e4828384a1890b0f916fd84b750fa01f783807" + Windows: + x86_64: + url: "https://github.com/bazelbuild/bazel/releases/download/6.2.0/bazel-6.2.0-windows-x86_64.exe" + sha256: "3d119e934ffb26910fcbd44dbc5973761480f58d3a06722cb84a90e16d8c5727" + armv8: + url: "https://github.com/bazelbuild/bazel/releases/download/6.2.0/bazel-6.2.0-windows-arm64.exe" + sha256: "3c23fccd3815933452c859e8482864598b6903d3143f9f18589915bf2c0dd2d4" + + "5.4.1": + license: + url: "https://raw.githubusercontent.com/bazelbuild/bazel/5.4.1/LICENSE" + sha256: "cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30" + Macos: + x86_64: + url: "https://github.com/bazelbuild/bazel/releases/download/5.4.1/bazel-5.4.1-darwin-x86_64" + sha256: "e8f796d67e9e4b54183c465443158dfb38bfe7df3626c1cfa0a6a3d9866047f9" + armv8: + url: "https://github.com/bazelbuild/bazel/releases/download/5.4.1/bazel-5.4.1-darwin-arm64" + sha256: "f2443a2131e832c2f12d448e673be7dad9cd2822066b4e2d4bd2d634bb2495e6" + Linux: + x86_64: + url: "https://github.com/bazelbuild/bazel/releases/download/5.4.1/bazel-5.4.1-linux-x86_64" + sha256: "5d90515f84b5ee1fd6ec22ee9e83103e77ed1a907ee5eec198fef3a5b45abf13" + armv8: + url: "https://github.com/bazelbuild/bazel/releases/download/5.4.1/bazel-5.4.1-linux-arm64" + sha256: "431dfaf5c0bd264b5753ae7a57f262137394c214c5e83651218887a9155dd010" + Windows: + x86_64: + url: "https://github.com/bazelbuild/bazel/releases/download/5.4.1/bazel-5.4.1-windows-x86_64.exe" + sha256: "f44329c91ee0ca2ea8526f9c0fecb65f1aa483e658f9b09831b16a0e70e16b51" + armv8: + url: "https://github.com/bazelbuild/bazel/releases/download/5.4.1/bazel-5.4.1-windows-arm64.exe" + sha256: "1e273c20dfa8493bf21b002614592a6cb3aa9eabe8b30eda96f8a517fca1a619" + + "4.2.4": + license: + url: "https://raw.githubusercontent.com/bazelbuild/bazel/4.2.4/LICENSE" + sha256: "cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30" + Macos: + x86_64: + url: "https://github.com/bazelbuild/bazel/releases/download/4.2.4/bazel-4.2.4-darwin-x86_64" + sha256: "84e5c594ce4c1d4354b68c90f6e81eb3a7d89737f60c3e3f4a689212d984dbc6" + armv8: + url: "https://github.com/bazelbuild/bazel/releases/download/4.2.4/bazel-4.2.4-darwin-arm64" + sha256: "6bc6acf5049f8ac78d083dce9538bade04186e56157e21330b0d565575547759" + Linux: + x86_64: + url: "https://github.com/bazelbuild/bazel/releases/download/4.2.4/bazel-4.2.4-linux-x86_64" + sha256: "29921e744399018efa0038bb770d2d11c77457e9162e5dcb58e6e11ab2bca7d3" + armv8: + url: "https://github.com/bazelbuild/bazel/releases/download/4.2.4/bazel-4.2.4-linux-arm64" + sha256: "1479d683ac64b8b4d8fc07f72da1c58914f4ef1113412beaa421b341b947a3dd" + Windows: + x86_64: + url: "https://github.com/bazelbuild/bazel/releases/download/4.2.4/bazel-4.2.4-windows-x86_64.exe" + sha256: "92103ac197fa53883e0671fbfda77b435619f94279fabf0694ec8623959348f8" + "4.0.0": - - url: "https://raw.githubusercontent.com/bazelbuild/bazel/4.0.0/LICENSE" - sha256: cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30 - - url: "https://github.com/bazelbuild/bazel/releases/download/4.0.0/bazel-4.0.0-darwin-x86_64" - sha256: "349f3c9dd24191369c1073c57cc1386fc3c2d4ad7d44135c3d873c9dc67fae1f" - - url: "https://github.com/bazelbuild/bazel/releases/download/4.0.0/bazel-4.0.0-linux-x86_64" - sha256: "7bee349a626281fc8b8d04a7a0b0358492712377400ab12533aeb39c2eb2b901" - - url: "https://github.com/bazelbuild/bazel/releases/download/4.0.0/bazel-4.0.0-windows-x86_64.exe" - sha256: "43930bbbc8b5d618884ee8145e1ec181760bf9eea42d16217a30381d176e4cf6" + license: + url: "https://raw.githubusercontent.com/bazelbuild/bazel/4.0.0/LICENSE" + sha256: "cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30" + Macos: + x86_64: + url: "https://github.com/bazelbuild/bazel/releases/download/4.0.0/bazel-4.0.0-darwin-x86_64" + sha256: "349f3c9dd24191369c1073c57cc1386fc3c2d4ad7d44135c3d873c9dc67fae1f" + Linux: + x86_64: + url: "https://github.com/bazelbuild/bazel/releases/download/4.0.0/bazel-4.0.0-linux-x86_64" + sha256: "7bee349a626281fc8b8d04a7a0b0358492712377400ab12533aeb39c2eb2b901" + Windows: + x86_64: + url: "https://github.com/bazelbuild/bazel/releases/download/4.0.0/bazel-4.0.0-windows-x86_64.exe" + sha256: "43930bbbc8b5d618884ee8145e1ec181760bf9eea42d16217a30381d176e4cf6" diff --git a/recipes/bazel/all/conanfile.py b/recipes/bazel/all/conanfile.py index 710635dca3f71..f765c4a073f3c 100644 --- a/recipes/bazel/all/conanfile.py +++ b/recipes/bazel/all/conanfile.py @@ -1,53 +1,86 @@ -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration import os +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import copy, rename, download + +required_conan_version = ">=1.47.0" + class BazelConan(ConanFile): name = "bazel" + package_type = "application" description = "Bazel is a fast, scalable, multi-language and extensible build system." license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://bazel.build/" - topics = ("test", "build", "automation") - settings = "os", "arch" - no_copy_source = True + topics = ("test", "build", "automation", "pre-built") + settings = "os", "arch", "compiler", "build_type" - @property - def _program_suffix(self): - return ".exe" if self.settings.os == "Windows" else "" + def layout(self): + pass - def _chmod_plus_x(self, name): - os.chmod(name, os.stat(name).st_mode | 0o111) + def package_id(self): + del self.info.settings.compiler + del self.info.settings.build_type @property - def _bazel_filename(self): - platform = "darwin" if self.settings.os == "Macos" else str(self.settings.os).lower() - return "bazel-{}-{}-{}{}".format(self.version, platform, self.settings.arch, self._program_suffix) + def _binary_info(self): + os = str(self.settings.os) + arch = str(self.settings.arch) + return self.conan_data["sources"][self.version][os].get(arch) def validate(self): - if self.settings.arch != "x86_64": - raise ConanInvalidConfiguration("Only amd64 is supported for this package.") if self.settings.os not in ["Linux", "Macos", "Windows"]: raise ConanInvalidConfiguration("Only Linux, Windows and OSX are supported for this package.") + if self._binary_info is None: + raise ConanInvalidConfiguration( + f"{self.settings.arch} architecture on {self.settings.os} is not supported for this package." + ) + + def source(self): + pass + + @property + def _bazel_filename(self): + return self._binary_info["url"].rsplit("/")[-1] def build(self): - for source in self.conan_data["sources"][self.version]: - url = source["url"] - filename = url[url.rfind("/") + 1:] - if filename in ["LICENSE", self._bazel_filename]: - tools.download(url, filename) - tools.check_sha256(filename, source["sha256"]) + download(self, **self._binary_info, filename=self._bazel_filename) + download(self, **self.conan_data["sources"][self.version]["license"], filename="LICENSE") + + @property + def _program_suffix(self): + return ".exe" if self.settings.os == "Windows" else "" + + @staticmethod + def _chmod_plus_x(name): + os.chmod(name, os.stat(name).st_mode | 0o111) def package(self): - self.copy(pattern="LICENSE", dst="licenses") - self.copy(pattern=self._bazel_filename, dst="bin") + copy( + self, + pattern="LICENSE", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder, + ) + copy( + self, + pattern=self._bazel_filename, + dst=os.path.join(self.package_folder, "bin"), + src=self.source_folder, + ) old_target_filename = os.path.join(self.package_folder, "bin", self._bazel_filename) new_target_filename = os.path.join(self.package_folder, "bin", "bazel" + self._program_suffix) - tools.rename(old_target_filename, new_target_filename) + rename(self, old_target_filename, new_target_filename) self._chmod_plus_x(new_target_filename) def package_info(self): - bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable with : {0}".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 = [] + + # 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/bazel/all/test_package/conanfile.py b/recipes/bazel/all/test_package/conanfile.py index 829753e7fee0f..5375af669ee12 100644 --- a/recipes/bazel/all/test_package/conanfile.py +++ b/recipes/bazel/all/test_package/conanfile.py @@ -1,9 +1,13 @@ -from conans import ConanFile +from conan import ConanFile -class TestPackage(ConanFile): - settings = "os", "arch" +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "VirtualBuildEnv" + test_type = "explicit" - def test(self): - self.run("bazel --version", run_environment=True) + def build_requirements(self): + self.tool_requires(self.tested_reference_str) + def test(self): + self.run("bazel --version") diff --git a/recipes/bazel/config.yml b/recipes/bazel/config.yml index d2be8f453d7c0..51015201a5c54 100644 --- a/recipes/bazel/config.yml +++ b/recipes/bazel/config.yml @@ -1,3 +1,15 @@ versions: + "7.2.1": + folder: all + "7.0.0": + folder: all + "6.5.0": + folder: all + "6.2.0": + folder: all + "5.4.1": + folder: all + "4.2.4": + folder: all "4.0.0": folder: all diff --git a/recipes/bdwgc/all/conandata.yml b/recipes/bdwgc/all/conandata.yml index 97d6a0b86b6e9..3e842ffa56b67 100644 --- a/recipes/bdwgc/all/conandata.yml +++ b/recipes/bdwgc/all/conandata.yml @@ -8,6 +8,15 @@ sources: "8.2.2": url: "https://github.com/ivmai/bdwgc/releases/download/v8.2.2/gc-8.2.2.tar.gz" sha256: "f30107bcb062e0920a790ffffa56d9512348546859364c23a14be264b38836a0" + "8.2.4": + url: "https://github.com/ivmai/bdwgc/releases/download/v8.2.4/gc-8.2.4.tar.gz" + sha256: "3d0d3cdbe077403d3106bb40f0cbb563413d6efdbb2a7e1cd6886595dec48fc2" + "8.2.6": + url: "https://github.com/ivmai/bdwgc/releases/download/v8.2.6/gc-8.2.6.tar.gz" + sha256: "b9183fe49d4c44c7327992f626f8eaa1d8b14de140f243edb1c9dcff7719a7fc" + "8.2.8": + url: "https://github.com/ivmai/bdwgc/releases/download/v8.2.8/gc-8.2.8.tar.gz" + sha256: "7649020621cb26325e1fb5c8742590d92fb48ce5c259b502faf7d9fb5dabb160" patches: "8.0.4": - patch_file: "patches/update-cmake-8_0_4.patch" @@ -15,3 +24,9 @@ patches: - patch_file: "patches/update-cmake-8_0_6.patch" "8.2.2": - patch_file: "patches/update-cmake-8_2_2.patch" + "8.2.4": + - patch_file: "patches/update-cmake-8_2_4.patch" + "8.2.6": + - patch_file: "patches/update-cmake-8_2_6.patch" + "8.2.8": + - patch_file: "patches/update-cmake-8_2_6.patch" diff --git a/recipes/bdwgc/all/conanfile.py b/recipes/bdwgc/all/conanfile.py index 925a47c27595c..d284939f26c40 100644 --- a/recipes/bdwgc/all/conanfile.py +++ b/recipes/bdwgc/all/conanfile.py @@ -1,11 +1,11 @@ from conan import ConanFile +from conan.errors import ConanException from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, save, rmdir, load 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.50.0" +required_conan_version = ">=1.53.0" class BdwGcConan(ConanFile): @@ -57,8 +57,7 @@ class BdwGcConan(ConanFile): default_options[option] = default 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": @@ -66,28 +65,19 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") if Version(self.version) < "8.2.0": del self.options.throw_bad_alloc_library if not self.options.cplusplus: - 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 layout(self): cmake_layout(self, src_folder="src") def requirements(self): if self.settings.os == "Windows": - self.requires("libatomic_ops/7.6.14") + self.requires("libatomic_ops/7.8.2") def source(self): get(self, **self.conan_data["sources"][self.version], diff --git a/recipes/bdwgc/all/patches/update-cmake-8_2_4.patch b/recipes/bdwgc/all/patches/update-cmake-8_2_4.patch new file mode 100644 index 0000000000000..c2ec8ac9747c1 --- /dev/null +++ b/recipes/bdwgc/all/patches/update-cmake-8_2_4.patch @@ -0,0 +1,15 @@ +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -175,6 +175,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-8_2_6.patch b/recipes/bdwgc/all/patches/update-cmake-8_2_6.patch new file mode 100644 index 0000000000000..1ae810763c0db --- /dev/null +++ b/recipes/bdwgc/all/patches/update-cmake-8_2_6.patch @@ -0,0 +1,15 @@ +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -177,6 +177,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/test_package/test_package.c b/recipes/bdwgc/all/test_package/test_package.c index b2df5018e2c03..a65be074b3335 100644 --- a/recipes/bdwgc/all/test_package/test_package.c +++ b/recipes/bdwgc/all/test_package/test_package.c @@ -5,17 +5,8 @@ int main() { - int i; - - GC_INIT(); /* Optional on Linux/X86; see below. */ - for (i = 0; i < 10000000; ++i) - { - int **p = (int **) GC_MALLOC(sizeof(int *)); - int *q = (int *) GC_MALLOC_ATOMIC(sizeof(int)); - assert(*p == 0); - *p = (int *) GC_REALLOC(q, 2 * sizeof(int)); - if (i % 100000 == 0) - printf("Heap size = %u\n", (unsigned) GC_get_heap_size()); - } + GC_INIT(); + printf("BDWGC Version: %d", GC_get_version()); + GC_deinit(); return 0; } diff --git a/recipes/bdwgc/config.yml b/recipes/bdwgc/config.yml index a32355f74df3f..2171a77e5a1a9 100644 --- a/recipes/bdwgc/config.yml +++ b/recipes/bdwgc/config.yml @@ -5,3 +5,9 @@ versions: folder: all "8.2.2": folder: all + "8.2.4": + folder: all + "8.2.6": + folder: all + "8.2.8": + 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/conandata.yml b/recipes/beauty/all/conandata.yml index 67db3d5af7757..42c96b3a5b488 100644 --- a/recipes/beauty/all/conandata.yml +++ b/recipes/beauty/all/conandata.yml @@ -1,7 +1,27 @@ sources: - "1.0.0-rc1": - url: "https://github.com/dfleury2/beauty/archive/refs/tags/1.0.0-rc1.tar.gz" - sha256: "e5c0cdffd9324ed0cbe771a4aaff3a572ec553dc0275bbaf4db754ce043ecf49" + "1.0.4": + url: "https://github.com/dfleury2/beauty/archive/refs/tags/1.0.4.tar.gz" + sha256: "8bfd3718470bdbed05b6b9253543d6ab9b33e21e25028e53fa513c67893a39f3" + "1.0.3": + url: "https://github.com/dfleury2/beauty/archive/refs/tags/1.0.3.tar.gz" + sha256: "1707b0974537cfd8d1d2fd0b5accd5a662c0b408042aa01384cf5840ecc43594" + "1.0.2": + url: "https://github.com/dfleury2/beauty/archive/refs/tags/1.0.2.tar.gz" + sha256: "627294d04a91c85e14d9c29475d539da5172c6d7306a48dca7c72413e47eebd6" patches: - "1.0.0-rc1": - - patch_file: "patches/0001-fix-cmake.patch" + "1.0.4": + - patch_file: "patches/0002-remove-openssl-target.patch" + patch_description: "Avoid defining openssl::openssl target when defined by Conan" + patch_type: "conan" + "1.0.3": + - patch_file: "patches/0002-remove-openssl-target.patch" + patch_description: "Avoid defining openssl::openssl target when defined by Conan" + patch_type: "conan" + "1.0.2": + - patch_file: "patches/0001-apple-compatibility.patch" + patch_description: "Handle pthread_setname_np not being defined on macOS" + patch_type: "portability" + patch_source: "https://github.com/dfleury2/beauty/pull/28" + - patch_file: "patches/0002-remove-openssl-target.patch" + patch_description: "Avoid defining openssl::openssl target when defined by Conan" + patch_type: "conan" diff --git a/recipes/beauty/all/conanfile.py b/recipes/beauty/all/conanfile.py index fe51140196608..f8b9acb4c99ef 100644 --- a/recipes/beauty/all/conanfile.py +++ b/recipes/beauty/all/conanfile.py @@ -1,47 +1,52 @@ 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.env import VirtualBuildEnv +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): name = "beauty" - homepage = "https://github.com/dfleury2/beauty" description = "HTTP Server above Boost.Beast" - topics = ("http", "server", "boost.beast") - url = "https://github.com/conan-io/conan-center-index" license = "MIT" - + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/dfleury2/beauty" + topics = ("http", "server", "boost.beast") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], + "with_openssl": [True, False], } default_options = { "shared": False, "fPIC": True, + "with_openssl": True, } - generators = "CMakeDeps" + @property + def _min_cppstd(self): + return "17" @property def _compilers_minimum_version(self): return { "gcc": "8", - "clang": "11", + "clang": "7", "Visual Studio": "16", "msvc": "192", + "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": @@ -49,40 +54,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): - self.requires("boost/1.79.0"), - self.requires("openssl/1.1.1q") + # beauty public headers include some boost headers. + # For example beauty/application.hpp includes boost/asio.hpp + if Version(self.version) >= "1.0.4": + # https://github.com/dfleury2/beauty/issues/30 + self.requires("boost/1.85.0", transitive_headers=True) + else: + self.requires("boost/1.84.0", transitive_headers=True) + if self.options.with_openssl: + # dependency of asio in boost, exposed in boost/asio/ssl/detail/openssl_types.hpp + self.requires("openssl/[>=1.1 <4]", transitive_headers=True, transitive_libs=True) 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") + raise ConanInvalidConfiguration(f"{self.ref} clang compiler requires -s compiler.libcxx=libc++") if self.settings.compiler == "apple-clang" and self.options.shared: - raise ConanInvalidConfiguration("shared is not supported on apple-clang") + raise ConanInvalidConfiguration(f"The option {self.ref}:shared=True is not supported on Apple Clang. Use static instead.") if is_msvc(self) and self.options.shared: - raise ConanInvalidConfiguration("shared is not supported on Visual Studio") + raise ConanInvalidConfiguration(f"{self.ref} shared=True is not supported with {self.settings.compiler}") - def layout(self): - cmake_layout(self, src_folder="src") + def build_requirements(self): + self.tool_requires("cmake/[>=3.21 <4]") 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): + VirtualBuildEnv(self).generate() tc = CMakeToolchain(self) + tc.variables["CONAN"] = False + tc.variables["BEAUTY_ENABLE_OPENSSL"] = self.options.with_openssl tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): apply_conandata_patches(self) @@ -100,6 +121,12 @@ def package_info(self): self.cpp_info.set_property("cmake_file_name", "beauty") self.cpp_info.set_property("cmake_target_name", "beauty::beauty") self.cpp_info.libs = ["beauty"] - self.cpp_info.requires = ["boost::headers", "openssl::openssl"] + self.cpp_info.requires = ["boost::headers"] + if self.options.with_openssl: + self.cpp_info.requires.append("openssl::ssl") if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.system_libs = ["m"] + self.cpp_info.system_libs = ["m", "pthread"] + elif self.settings.os == "Windows": + self.cpp_info.system_libs = ["crypt32"] + if self.options.with_openssl: + self.cpp_info.defines = ["BEAUTY_ENABLE_OPENSSL"] diff --git a/recipes/beauty/all/patches/0001-apple-compatibility.patch b/recipes/beauty/all/patches/0001-apple-compatibility.patch new file mode 100644 index 0000000000000..8471b95a69d52 --- /dev/null +++ b/recipes/beauty/all/patches/0001-apple-compatibility.patch @@ -0,0 +1,22 @@ +From 3af29b660d623e8d7051e5392395c25712037a6a Mon Sep 17 00:00:00 2001 +From: Martin Valgur +Date: Wed, 17 Jan 2024 13:29:49 +0200 +Subject: [PATCH] Fix handling of pthread_setname_np on macOS + +--- + src/utils.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/utils.cpp b/src/utils.cpp +index eb15b68..72966c2 100644 +--- a/src/utils.cpp ++++ b/src/utils.cpp +@@ -191,7 +191,7 @@ make_uuid() + //--------------------------------------------------------------------------- + void + thread_set_name(const std::string& name) { +-#ifdef LINUX ++#if LINUX && _GNU_SOURCE + constexpr int TASK_COMM_LEN = 16; + + char thread_name[TASK_COMM_LEN] = ""; diff --git a/recipes/beauty/all/patches/0001-fix-cmake.patch b/recipes/beauty/all/patches/0001-fix-cmake.patch deleted file mode 100644 index 6bdf75a96f54e..0000000000000 --- a/recipes/beauty/all/patches/0001-fix-cmake.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -3,6 +3,7 @@ cmake_minimum_required(VERSION 3.15) - project(Beauty) - set(VERSION 0.1-rc) - -+if(0) - if (CONAN_EXPORTED) - else() - if (NOT EXISTS ${CMAKE_BINARY_DIR}/conan_toolchain.cmake) -@@ -20,6 +21,7 @@ else() - endif() - - include(${CMAKE_BINARY_DIR}/conan_toolchain.cmake) -+endif() - - # C++ - set(CMAKE_CXX_STANDARD 20) diff --git a/recipes/beauty/all/patches/0002-remove-openssl-target.patch b/recipes/beauty/all/patches/0002-remove-openssl-target.patch new file mode 100644 index 0000000000000..28cfd66f4489f --- /dev/null +++ b/recipes/beauty/all/patches/0002-remove-openssl-target.patch @@ -0,0 +1,12 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 7cc5bda..12a5e71 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -27,7 +27,6 @@ else() + + if (BEAUTY_ENABLE_OPENSSL) + find_package(OpenSSL REQUIRED) +- add_library(openssl::openssl ALIAS OpenSSL::SSL) + endif() + endif() + diff --git a/recipes/beauty/all/test_package/CMakeLists.txt b/recipes/beauty/all/test_package/CMakeLists.txt index 8673671fd5aab..485e39c140276 100644 --- a/recipes/beauty/all/test_package/CMakeLists.txt +++ b/recipes/beauty/all/test_package/CMakeLists.txt @@ -5,4 +5,4 @@ find_package(beauty REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE beauty::beauty) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) 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/beauty/config.yml b/recipes/beauty/config.yml index ca2cfd0e152c6..55b20570619c0 100644 --- a/recipes/beauty/config.yml +++ b/recipes/beauty/config.yml @@ -1,3 +1,7 @@ versions: - "1.0.0-rc1": + "1.0.4": + folder: all + "1.0.3": + folder: all + "1.0.2": folder: all diff --git a/recipes/behaviortree.cpp/all/conan_deps.cmake b/recipes/behaviortree.cpp/all/conan_deps.cmake new file mode 100644 index 0000000000000..1bfd028b22003 --- /dev/null +++ b/recipes/behaviortree.cpp/all/conan_deps.cmake @@ -0,0 +1,16 @@ +# Inject unvendored dependencies provided by Conan + +if(WITH_LEXY) + find_package(lexy REQUIRED CONFIG) + link_libraries(foonathan::lexy) +endif() + +if(WITH_MINITRACE) + find_package(minitrace REQUIRED CONFIG) + link_libraries(minitrace::minitrace) +endif() + +if(WITH_TINYXML2) + find_package(tinyxml2 REQUIRED CONFIG) + link_libraries(tinyxml2::tinyxml2) +endif() diff --git a/recipes/behaviortree.cpp/all/conandata.yml b/recipes/behaviortree.cpp/all/conandata.yml index 8e188b3097d43..38e09ddf41730 100644 --- a/recipes/behaviortree.cpp/all/conandata.yml +++ b/recipes/behaviortree.cpp/all/conandata.yml @@ -1,28 +1,27 @@ sources: + "4.6.2": + url: "https://github.com/BehaviorTree/BehaviorTree.CPP/archive/refs/tags/4.6.2.tar.gz" + sha256: "b0e7e53b27feae894e2df3f3faadfdd49f2108ebccfb1bd7cc0d405ffc56cecd" + "4.6.1": + url: "https://github.com/BehaviorTree/BehaviorTree.CPP/archive/refs/tags/4.6.1.tar.gz" + sha256: "a4e0dd92b200eedfbc6a16bebe613aeeb84b685416211b68fd097d21254f324b" + "4.6.0": + url: "https://github.com/BehaviorTree/BehaviorTree.CPP/archive/refs/tags/4.6.0.tar.gz" + sha256: "b24fed4f51212ea40bc492f7d4a310b1672bc05df6a83f2341c41ccf233307a9" + "4.5.2": + url: "https://github.com/BehaviorTree/BehaviorTree.CPP/archive/refs/tags/4.5.2.tar.gz" + sha256: "1aaac034fc6a2f03d9347934e3baf3cabd5edc8bb416b9d7f5d944598019aeb9" "4.0.1": url: "https://github.com/BehaviorTree/BehaviorTree.CPP/archive/refs/tags/4.0.1.tar.gz" sha256: "71544f72abea8e8c246b016b7e8d87d96f731c8aa96698058d8e69d40e56f9b9" + "3.8.6": + url: "https://github.com/BehaviorTree/BehaviorTree.CPP/archive/refs/tags/3.8.6.tar.gz" + sha256: "df01713e61aa3b6f4a637dcff31dfd3c96c3c05fac226da8566a873a24ccde27" "3.7.0": url: "https://github.com/BehaviorTree/BehaviorTree.CPP/archive/refs/tags/3.7.0.tar.gz" sha256: "ab0d8ac1a0df4dd43cf45da8a784bab7fdedf711bd0e227f7ed071f79b0c7b5c" - "3.5.6": - 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" - - patch_file: "patches/3.7.0-0002-find-zmq.patch" - - patch_file: "patches/3.7.0-0003-no-werror.patch" - - patch_file: "patches/3.5.6-0005-stdc-format.patch" - "3.5.6": - - patch_file: "patches/3.5.6-0001-remove-fpic.patch" - - patch_file: "patches/3.5.6-0002-find-zmq.patch" - - patch_file: "patches/3.5.6-0003-no-werror.patch" - - patch_file: "patches/3.5.6-0004-win-sigaction.patch" - - patch_file: "patches/3.5.6-0005-stdc-format.patch" + "4.6.2": + - patch_file: "patches/001-minitrace.patch" + patch_description: "Consume minitrace from Conan" + patch_type: "conan" diff --git a/recipes/behaviortree.cpp/all/conanfile.py b/recipes/behaviortree.cpp/all/conanfile.py index 54f5ae5ad8322..df11b679e6fcb 100644 --- a/recipes/behaviortree.cpp/all/conanfile.py +++ b/recipes/behaviortree.cpp/all/conanfile.py @@ -1,10 +1,11 @@ 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.env import VirtualBuildEnv +from conan.tools.files import get, copy, rmdir, replace_in_file, save, rm +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 +from conan.tools.files import export_conandata_patches, apply_conandata_patches import os @@ -17,45 +18,78 @@ class BehaviorTreeCPPConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/BehaviorTree/BehaviorTree.CPP" topics = ("ai", "robotics", "games", "coordination") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], "with_tools": [True, False], "with_coroutines": [True, False], + "enable_groot_interface": [True, False], + "enable_sqlite_logging": [True, False], + "enable_manual_selector": [True, False], + "use_v3_compatible_names": [True, False], } default_options = { "shared": False, "fPIC": True, "with_tools": False, "with_coroutines": False, + "enable_groot_interface": True, + "enable_sqlite_logging": True, + "enable_manual_selector": False, + "use_v3_compatible_names": False, + } + options_description = { + "with_tools": "Build commandline tools", + "with_coroutines": "Enable Boost coroutines", + "enable_groot_interface": "Add Groot2 connection (requires ZeroMQ)", + "enable_sqlite_logging": "Add SQLite logging", + "enable_manual_selector": "Build manual selector node", + "use_v3_compatible_names": "Use v3 compatible names", } @property def _minimum_cppstd_required(self): - return 14 if Version(self.version) < "4.0" else 17 + if Version(self.version) >= "4.0": + return 17 + return 14 @property def _minimum_compilers_version(self): - if Version(self.version) < "4.0": + if Version(self.version) >= "4.0": return { - "gcc": "5", - "clang": "5", + "gcc": "8", + "clang": "7", "apple-clang": "12", + "msvc": "192", + "Visual Studio": "16", } else: return { - "gcc": "8", - "clang": "7", + "gcc": "5", + "clang": "5", "apple-clang": "12", + "msvc": "191", + "Visual Studio": "15", } def export_sources(self): export_conandata_patches(self) + copy(self, "conan_deps.cmake", self.recipe_folder, os.path.join(self.export_sources_folder, "src")) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + if Version(self.version) < "4.0": + del self.options.use_v3_compatible_names + if Version(self.version) >= "4.1.0": + del self.options.with_coroutines + if Version(self.version) >= "4.1.1": + del self.options.enable_manual_selector + else: + del self.options.enable_groot_interface + del self.options.enable_sqlite_logging def configure(self): if self.options.shared: @@ -64,54 +98,153 @@ def configure(self): def layout(self): cmake_layout(self, src_folder="src") + @property + def _with_boost(self): + return self.options.get_safe("with_coroutines", False) + + @property + def _with_lexy(self): + # FIXME: using vendored version temporarily due to a missing CCI binary + # return Version(self.version) >= "4.0.0" + return False + + @property + def _with_minitrace(self): + return Version(self.version) >= "4.3.4" + + @property + def _with_ncurses(self): + return self.options.get_safe("enable_manual_selector", False) + + @property + def _with_sqlite3(self): + return self.options.get_safe("enable_sqlite_logging", False) + + @property + def _with_tinyxml2(self): + return Version(self.version) >= "4.0.0" + + @property + def _with_zeromq(self): + if Version(self.version) >= "4.1.1": + return self.options.enable_groot_interface + return Version(self.version) >= "4.0.0" + def requirements(self): - if self.options.with_coroutines: - self.requires("boost/1.80.0") - self.requires("ncurses/6.3") - self.requires("zeromq/4.3.4") - self.requires("cppzmq/4.9.0") + if self._with_boost: + self.requires("boost/1.83.0") + if self._with_ncurses: + self.requires("ncurses/6.4") + if self._with_lexy: + self.requires("foonathan-lexy/2022.12.1") + if self._with_minitrace: + self.requires("minitrace/cci.20230905") + if self._with_sqlite3: + self.requires("sqlite3/3.44.2") + if self._with_tinyxml2: + self.requires("tinyxml2/10.0.0") + if self._with_zeromq: + self.requires("zeromq/4.3.5") + + # TODO: other vendored dependencies + # - cppzmq is customized and not compatible with Conan version + # - cpp-sqlite + # - minicoro + # - wildcards def validate(self): 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)) + 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}. " + f"Your compiler is unknown. Assuming it supports C++{self._minimum_cppstd_required}.") + elif Version(self.info.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"BehaviorTree.CPP requires C++{self._minimum_cppstd_required}, which your compiler does not support." + ) 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++") + if self.settings.compiler == "apple-clang" and cross_building(self) and self.settings.arch in ["x86", "x86_64"]: + raise ConanInvalidConfiguration(f"Cross-compiling for {self.settings.arch} is not yet supported. Contributions are welcome!") + + def build_requirements(self): + if Version(self.version) >= "4.1.0": + self.tool_requires("cmake/[>=3.16.3 <4]") + def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) def generate(self): + venv = VirtualBuildEnv(self) + venv.generate() + tc = CMakeToolchain(self) + tc.variables["CMAKE_PROJECT_behaviortree_cpp_INCLUDE"] = "conan_deps.cmake" + tc.variables["WITH_LEXY"] = self._with_lexy + tc.variables["WITH_MINITRACE"] = self._with_minitrace + tc.variables["WITH_TINYXML2"] = self._with_tinyxml2 + if not self.options.get_safe("enable_manual_selector"): + # Avoid accidental use of system ncurses + tc.variables["CMAKE_DISABLE_FIND_PACKAGE_Curses"] = True 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 + tc.variables["BUILD_MANUAL_SELECTOR"] = self.options.get_safe("enable_manual_selector", False) 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.variables["BTCPP_ENABLE_COROUTINES"] = self.options.get_safe("with_coroutines", False) + tc.variables["BTCPP_MANUAL_SELECTOR"] = self.options.get_safe("enable_manual_selector", False) + tc.variables["BTCPP_GROOT_INTERFACE"] = self.options.get_safe("enable_groot_interface", False) + tc.variables["BTCPP_SQLITE_LOGGING"] = self.options.get_safe("enable_sqlite_logging", False) + tc.variables["USE_V3_COMPATIBLE_NAMES"] = self.options.use_v3_compatible_names tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" tc.generate() deps = CMakeDeps(self) + if Version(self.version) >= "4.1.0": + deps.set_property("zeromq", "cmake_file_name", "ZeroMQ") + else: + deps.set_property("zeromq", "cmake_file_name", "ZMQ") deps.generate() - def build(self): + def _patch_sources(self): apply_conandata_patches(self) + cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") + # Let Conan handle -fPIC + replace_in_file(self, cmakelists, "set(CMAKE_POSITION_INDEPENDENT_CODE ON)\n", "") + # Unvendor lexy + if self._with_lexy: + rmdir(self, os.path.join(self.source_folder, "3rdparty", "lexy")) + save(self, os.path.join(self.source_folder, "3rdparty", "lexy", "CMakeLists.txt"), "") + # Unvendor minitrace + if self._with_minitrace: + rmdir(self, os.path.join(self.source_folder, "3rdparty", "minitrace")) + if Version(self.version) < "4.6.2": + # INFO: Version 4.6.2 removed minitrace via patch file 001-minitrace.patch + replace_in_file(self, cmakelists, "3rdparty/minitrace/minitrace.cpp", "") + replace_in_file(self, os.path.join(self.source_folder, "src", "loggers", "bt_minitrace_logger.cpp"), + "minitrace/minitrace.h", "minitrace.h") + # Unvendor tinyxml2 + if self._with_tinyxml2: + rmdir(self, os.path.join(self.source_folder, "3rdparty", "tinyxml2")) + replace_in_file(self, cmakelists, "3rdparty/tinyxml2/tinyxml2.cpp", "") + replace_in_file(self, os.path.join(self.source_folder, "src", "xml_parsing.cpp"), + "tinyxml2/tinyxml2.h", "tinyxml2.h") + # Ensure ZeroMQ and other packages are provided by Conan + rm(self, "Find*.cmake", os.path.join(self.source_folder, "cmake")) + + def build(self): + self._patch_sources() cmake = CMake(self) cmake.configure() cmake.build() @@ -125,39 +258,48 @@ def package(self): rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): - if Version(self.version) < "4.0": - self.cpp_info.set_property("cmake_file_name", "BehaviorTreeV3") + if Version(self.version) >= "4.0": + cmake_file_name = "BehaviorTree" + libname = "behaviortree_cpp" else: - self.cpp_info.set_property("cmake_file_name", "BehaviorTree") - - libname = "behaviortree_cpp_v3" if Version(self.version) < "4.0" else "behaviortree_cpp" + cmake_file_name = "BehaviorTreeV3" + libname = "behaviortree_cpp_v3" + self.cpp_info.set_property("cmake_file_name", cmake_file_name) self.cpp_info.set_property("cmake_target_name", f"BT::{libname}") + requires = [] + if self._with_boost: + requires.append("boost::coroutine") + if self._with_lexy: + requires.append("foonathan-lexy::foonathan-lexy") + if self._with_minitrace: + requires.append("minitrace::minitrace") + if self._with_ncurses: + requires.append("ncurses::ncurses") + if self._with_sqlite3: + requires.append("sqlite3::sqlite3") + if self._with_tinyxml2: + requires.append("tinyxml2::tinyxml2") + if self._with_zeromq: + requires.append("zeromq::zeromq") + 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[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[libname].requires.append("boost::coroutine") + self.cpp_info.components[libname].requires = requires if self.settings.os in ("Linux", "FreeBSD"): - self.cpp_info.components[libname].system_libs.append("pthread") + self.cpp_info.components[libname].system_libs.extend(["pthread", "dl"]) 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") - 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 - 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.filenames["cmake_find_package"] = cmake_file_name + self.cpp_info.filenames["cmake_find_package_multi"] = cmake_file_name self.cpp_info.names["cmake_find_package"] = "BT" self.cpp_info.names["cmake_find_package_multi"] = "BT" self.cpp_info.components[libname].names["cmake_find_package"] = libname diff --git a/recipes/behaviortree.cpp/all/patches/001-minitrace.patch b/recipes/behaviortree.cpp/all/patches/001-minitrace.patch new file mode 100644 index 0000000000000..734c4e7f4c8b5 --- /dev/null +++ b/recipes/behaviortree.cpp/all/patches/001-minitrace.patch @@ -0,0 +1,32 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 9b6d1eb..fd0e84f 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -39,6 +39,7 @@ endif() + + #---- Find other packages ---- + find_package(Threads REQUIRED) ++find_package(minitrace REQUIRED) + + + set(BEHAVIOR_TREE_LIBRARY ${PROJECT_NAME}) +@@ -80,10 +81,6 @@ endif() + + add_subdirectory(3rdparty/lexy) + +-add_library(minitrace STATIC 3rdparty/minitrace/minitrace.cpp) +-target_compile_definitions(minitrace PRIVATE MTR_ENABLED=True) +-set_property(TARGET minitrace PROPERTY POSITION_INDEPENDENT_CODE ON) +- + list(APPEND BT_SOURCE + src/action_node.cpp + src/basic_types.cpp +@@ -166,7 +163,7 @@ target_link_libraries(${BTCPP_LIBRARY} + Threads::Threads + ${CMAKE_DL_LIBS} + $ +- minitrace ++ minitrace::minitrace + PUBLIC + ${BTCPP_EXTRA_LIBRARIES} + ) diff --git a/recipes/behaviortree.cpp/all/patches/3.5.6-0001-remove-fpic.patch b/recipes/behaviortree.cpp/all/patches/3.5.6-0001-remove-fpic.patch deleted file mode 100644 index 7cb2daad955aa..0000000000000 --- a/recipes/behaviortree.cpp/all/patches/3.5.6-0001-remove-fpic.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index a390aed..aff91ec 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -36,7 +36,6 @@ if(NOT DEFINED BT_COROUTINES) - add_definitions(-DBT_NO_COROUTINES) - endif() - --set(CMAKE_POSITION_INDEPENDENT_CODE ON) - - #---- project configuration ---- - option(BUILD_EXAMPLES "Build tutorials and examples" ON) diff --git a/recipes/behaviortree.cpp/all/patches/3.5.6-0002-find-zmq.patch b/recipes/behaviortree.cpp/all/patches/3.5.6-0002-find-zmq.patch deleted file mode 100644 index c717020c8e00a..0000000000000 --- a/recipes/behaviortree.cpp/all/patches/3.5.6-0002-find-zmq.patch +++ /dev/null @@ -1,68 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index aff91ec..242c214 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -45,14 +45,14 @@ option(BUILD_SHARED_LIBS "Build shared libraries" ON) - - #---- 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) -@@ -202,8 +202,8 @@ if (WIN32) - add_library(${BEHAVIOR_TREE_LIBRARY} STATIC ${BT_SOURCE} ) - endif() - --if( ZMQ_FOUND ) -- list(APPEND BUILD_TOOL_INCLUDE_DIRS ${ZMQ_INCLUDE_DIRS}) -+if( ZeroMQ_FOUND ) -+ list(APPEND BUILD_TOOL_INCLUDE_DIRS ${ZeroMQ_INCLUDE_DIRS}) - endif() - - target_link_libraries(${BEHAVIOR_TREE_LIBRARY} PUBLIC -@@ -211,7 +211,7 @@ target_link_libraries(${BEHAVIOR_TREE_LIBRARY} PUBLIC - - target_link_libraries(${BEHAVIOR_TREE_LIBRARY} PRIVATE - ${Boost_LIBRARIES} -- ${ZMQ_LIBRARIES}) -+ ${ZeroMQ_LIBRARIES}) - - #get_target_property(my_libs ${BEHAVIOR_TREE_LIBRARY} INTERFACE_LINK_LIBRARIES) - #list(REMOVE_ITEM _libs X) -@@ -227,8 +227,8 @@ target_include_directories(${BEHAVIOR_TREE_LIBRARY} PUBLIC - $ - ${BUILD_TOOL_INCLUDE_DIRS}) - --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 0801850..153b447 100644 ---- a/tools/CMakeLists.txt -+++ b/tools/CMakeLists.txt -@@ -6,9 +6,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/3.5.6-0003-no-werror.patch b/recipes/behaviortree.cpp/all/patches/3.5.6-0003-no-werror.patch deleted file mode 100644 index 4996714060f93..0000000000000 --- a/recipes/behaviortree.cpp/all/patches/3.5.6-0003-no-werror.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 242c214..cb8d77a 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -232,10 +232,10 @@ if( ZeroMQ_FOUND ) - endif() - - if(MSVC) -- target_compile_options(${BEHAVIOR_TREE_LIBRARY} PRIVATE /W3 /WX) -+ target_compile_options(${BEHAVIOR_TREE_LIBRARY} PRIVATE /W3) - else() - target_compile_options(${BEHAVIOR_TREE_LIBRARY} PRIVATE -- -Wall -Wextra -Werror=return-type) -+ -Wall -Wextra) - endif() - - ###################################################### diff --git a/recipes/behaviortree.cpp/all/patches/3.5.6-0004-win-sigaction.patch b/recipes/behaviortree.cpp/all/patches/3.5.6-0004-win-sigaction.patch deleted file mode 100644 index 75f9c74e55e10..0000000000000 --- a/recipes/behaviortree.cpp/all/patches/3.5.6-0004-win-sigaction.patch +++ /dev/null @@ -1,22 +0,0 @@ -diff --git a/tools/bt_recorder.cpp b/tools/bt_recorder.cpp -index 3aa6740..4b36414 100644 ---- a/tools/bt_recorder.cpp -+++ b/tools/bt_recorder.cpp -@@ -16,12 +16,17 @@ static void s_signal_handler(int) - - static void CatchSignals(void) - { -+#ifdef _WIN32 -+ signal(SIGINT, s_signal_handler); -+ signal(SIGTERM, s_signal_handler); -+#else - struct sigaction action; - action.sa_handler = s_signal_handler; - action.sa_flags = 0; - sigemptyset(&action.sa_mask); - sigaction(SIGINT, &action, NULL); - sigaction(SIGTERM, &action, NULL); -+#endif - } - - int main(int argc, char* argv[]) diff --git a/recipes/behaviortree.cpp/all/patches/3.5.6-0005-stdc-format.patch b/recipes/behaviortree.cpp/all/patches/3.5.6-0005-stdc-format.patch deleted file mode 100644 index d1b1b47051f32..0000000000000 --- a/recipes/behaviortree.cpp/all/patches/3.5.6-0005-stdc-format.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/3rdparty/minitrace/minitrace.h b/3rdparty/minitrace/minitrace.h -index c7d5b31..d68dc52 100644 ---- a/3rdparty/minitrace/minitrace.h -+++ b/3rdparty/minitrace/minitrace.h -@@ -21,6 +21,7 @@ - // More: - // http://www.altdevblogaday.com/2012/08/21/using-chrometracing-to-view-your-inline-profiling-data/ - -+#define __STDC_FORMAT_MACROS - #include - - #define MTR_ENABLED diff --git a/recipes/behaviortree.cpp/all/patches/3.7.0-0001-remove-fpic.patch b/recipes/behaviortree.cpp/all/patches/3.7.0-0001-remove-fpic.patch deleted file mode 100644 index b1bd9fd89538c..0000000000000 --- a/recipes/behaviortree.cpp/all/patches/3.7.0-0001-remove-fpic.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index cd490a5..843045e 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(BUILD_EXAMPLES "Build tutorials and examples" ON) - option(BUILD_SAMPLES "Build sample nodes" ON) diff --git a/recipes/behaviortree.cpp/all/patches/3.7.0-0002-find-zmq.patch b/recipes/behaviortree.cpp/all/patches/3.7.0-0002-find-zmq.patch deleted file mode 100644 index 7290476cc8726..0000000000000 --- a/recipes/behaviortree.cpp/all/patches/3.7.0-0002-find-zmq.patch +++ /dev/null @@ -1,68 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 843045e..471c00e 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -54,14 +54,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) -@@ -193,8 +193,8 @@ else() - add_library(${BEHAVIOR_TREE_LIBRARY} STATIC ${BT_SOURCE}) - endif() - --if( ZMQ_FOUND ) -- list(APPEND BUILD_TOOL_INCLUDE_DIRS ${ZMQ_INCLUDE_DIRS}) -+if( ZeroMQ_FOUND ) -+ list(APPEND BUILD_TOOL_INCLUDE_DIRS ${ZeroMQ_INCLUDE_DIRS}) - endif() - - target_link_libraries(${BEHAVIOR_TREE_LIBRARY} PUBLIC -@@ -202,7 +202,7 @@ target_link_libraries(${BEHAVIOR_TREE_LIBRARY} PUBLIC - - target_link_libraries(${BEHAVIOR_TREE_LIBRARY} PRIVATE - ${Boost_LIBRARIES} -- ${ZMQ_LIBRARIES}) -+ ${ZeroMQ_LIBRARIES}) - - #get_target_property(my_libs ${BEHAVIOR_TREE_LIBRARY} INTERFACE_LINK_LIBRARIES) - #list(REMOVE_ITEM _libs X) -@@ -218,8 +218,8 @@ target_include_directories(${BEHAVIOR_TREE_LIBRARY} PUBLIC - $ - ${BUILD_TOOL_INCLUDE_DIRS}) - --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 2ad33b3..2dc969d 100644 ---- a/tools/CMakeLists.txt -+++ b/tools/CMakeLists.txt -@@ -6,9 +6,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/3.7.0-0003-no-werror.patch b/recipes/behaviortree.cpp/all/patches/3.7.0-0003-no-werror.patch deleted file mode 100644 index 5bf8893db1770..0000000000000 --- a/recipes/behaviortree.cpp/all/patches/3.7.0-0003-no-werror.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 471c00e..7245461 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -225,7 +225,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/patches/4.0.1-0001-remove-fpic.patch b/recipes/behaviortree.cpp/all/patches/4.0.1-0001-remove-fpic.patch deleted file mode 100644 index 23931bd446392..0000000000000 --- a/recipes/behaviortree.cpp/all/patches/4.0.1-0001-remove-fpic.patch +++ /dev/null @@ -1,13 +0,0 @@ -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 deleted file mode 100644 index 6753b06f564d0..0000000000000 --- a/recipes/behaviortree.cpp/all/patches/4.0.1-0002-find-zmq.patch +++ /dev/null @@ -1,57 +0,0 @@ -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 deleted file mode 100644 index b69541449eb87..0000000000000 --- a/recipes/behaviortree.cpp/all/patches/4.0.1-0003-no-werror.patch +++ /dev/null @@ -1,13 +0,0 @@ -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/config.yml b/recipes/behaviortree.cpp/config.yml index e1234d5535a8c..12e603c7e2db2 100644 --- a/recipes/behaviortree.cpp/config.yml +++ b/recipes/behaviortree.cpp/config.yml @@ -1,7 +1,15 @@ versions: + "4.6.2": + folder: all + "4.6.1": + folder: all + "4.6.0": + folder: all + "4.5.2": + folder: all "4.0.1": folder: all - "3.7.0": + "3.8.6": folder: all - "3.5.6": + "3.7.0": folder: all diff --git a/recipes/benchmark/all/conandata.yml b/recipes/benchmark/all/conandata.yml index 926ace1d06183..fac51279a430d 100644 --- a/recipes/benchmark/all/conandata.yml +++ b/recipes/benchmark/all/conandata.yml @@ -1,4 +1,26 @@ sources: + "1.9.0": + url: "https://github.com/google/benchmark/archive/refs/tags/v1.9.0.tar.gz" + sha256: "35a77f46cc782b16fac8d3b107fbfbb37dcd645f7c28eee19f3b8e0758b48994" + "1.8.5": + url: "https://github.com/google/benchmark/archive/refs/tags/v1.8.5.tar.gz" + sha256: "d26789a2b46d8808a48a4556ee58ccc7c497fcd4c0af9b90197674a81e04798a" + # keep 1.8.4, the last release for c++11 + "1.8.4": + url: "https://github.com/google/benchmark/archive/refs/tags/v1.8.4.tar.gz" + sha256: "3e7059b6b11fb1bbe28e33e02519398ca94c1818874ebed18e504dc6f709be45" + "1.8.3": + url: "https://github.com/google/benchmark/archive/refs/tags/v1.8.3.tar.gz" + sha256: "6bc180a57d23d4d9515519f92b0c83d61b05b5bab188961f36ac7b06b0d9e9ce" + "1.8.2": + url: "https://github.com/google/benchmark/archive/refs/tags/v1.8.2.tar.gz" + sha256: "2aab2980d0376137f969d92848fbb68216abb07633034534fc8c65cc4e7a0e93" + "1.8.1": + url: "https://github.com/google/benchmark/archive/refs/tags/v1.8.1.tar.gz" + sha256: "e9ff65cecfed4f60c893a1e8a1ba94221fad3b27075f2f80f47eb424b0f8c9bd" + "1.8.0": + url: "https://github.com/google/benchmark/archive/refs/tags/v1.8.0.tar.gz" + sha256: "ea2e94c24ddf6594d15c711c06ccd4486434d9cf3eca954e2af8a20c88f9f172" "1.7.1": url: "https://github.com/google/benchmark/archive/refs/tags/v1.7.1.tar.gz" sha256: "6430e4092653380d9dc4ccb45a1e2dc9259d581f4866dc0759713126056bc1d7" diff --git a/recipes/benchmark/all/conanfile.py b/recipes/benchmark/all/conanfile.py index 04fc858f5c5ba..ff99379d8d400 100644 --- a/recipes/benchmark/all/conanfile.py +++ b/recipes/benchmark/all/conanfile.py @@ -1,9 +1,9 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.build import cross_building +from conan.tools.build import cross_building, 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.files import copy, get, rmdir, replace_in_file +from conan.tools.microsoft import is_msvc, check_min_vs from conan.tools.scm import Version import os @@ -18,23 +18,48 @@ class BenchmarkConan(ConanFile): homepage = "https://github.com/google/benchmark" topics = ("google", "microbenchmark") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], "enable_lto": [True, False], "enable_exceptions": [True, False], + "enable_libpfm": [True, False], } default_options = { "shared": False, "fPIC": True, "enable_lto": False, "enable_exceptions": True, + "enable_libpfm": False, } + @property + def _min_cppstd(self): + if Version(self.version) >= "1.8.5": + return 14 + if is_msvc(self): + return 14 + return 11 + + @property + def _compilers_minimum_version(self): + return { + "14": { + "apple-clang": "10", + "clang": "7", + "gcc": "7", + "msvc": "191", + "Visual Studio": "15", + } + }.get(self._min_cppstd, {}) + def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + if self.settings.os != "Linux" or Version(self.version) < "1.5.4": + del self.options.enable_libpfm def configure(self): if self.options.shared: @@ -44,29 +69,28 @@ def layout(self): cmake_layout(self, src_folder="src") def validate(self): - if self.info.settings.compiler == "Visual Studio" and Version(self.info.settings.compiler.version) <= "12": - raise ConanInvalidConfiguration(f"{self.ref} doesn't support Visual Studio <= 12") - if Version(self.version) < "1.7.0" and is_msvc(self) and self.info.options.shared: + 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." + ) + + 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 requirements(self): + if self.options.get_safe("enable_libpfm"): + self.requires("libpfm4/4.13.0") 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.0") + if Version(self.version) >= "1.7.1": + self.tool_requires("cmake/[>=3.16.3 <4]") 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) @@ -74,6 +98,9 @@ def generate(self): 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 + tc.variables["BENCHMARK_ENABLE_LIBPFM"] = self.options.get_safe("enable_libpfm", False) + if not self.settings.compiler.cppstd: + tc.cache_variables["CMAKE_CXX_STANDARD"] = self._min_cppstd if Version(self.version) >= "1.6.1": tc.variables["BENCHMARK_ENABLE_WERROR"] = False tc.variables["BENCHMARK_FORCE_WERROR"] = False @@ -86,8 +113,17 @@ def generate(self): else: tc.variables["BENCHMARK_USE_LIBCXX"] = False tc.generate() + + def _patch_sources(self): + if Version(self.version) > "1.7.0": + replace_in_file(self, + os.path.join(self.source_folder, "CMakeLists.txt"), + "set(CMAKE_CXX_STANDARD", + "#" + ) def build(self): + self._patch_sources() cmake = CMake(self) cmake.configure() cmake.build() @@ -114,6 +150,8 @@ def package_info(self): self.cpp_info.components["_benchmark"].system_libs.append("shlwapi") elif self.settings.os == "SunOS": self.cpp_info.components["_benchmark"].system_libs.append("kstat") + if self.options.get_safe("enable_libpfm"): + self.cpp_info.components["_benchmark"].requires.append("libpfm4::libpfm4") self.cpp_info.components["benchmark_main"].set_property("cmake_target_name", "benchmark::benchmark_main") self.cpp_info.components["benchmark_main"].libs = ["benchmark_main"] diff --git a/recipes/benchmark/config.yml b/recipes/benchmark/config.yml index c3f78fe6dce87..f5694a4c32d21 100644 --- a/recipes/benchmark/config.yml +++ b/recipes/benchmark/config.yml @@ -1,4 +1,18 @@ versions: + "1.9.0": + folder: all + "1.8.5": + folder: all + "1.8.4": + folder: all + "1.8.3": + folder: all + "1.8.2": + folder: all + "1.8.1": + folder: all + "1.8.0": + folder: all "1.7.1": folder: all "1.7.0": diff --git a/recipes/bertrand/all/conanfile.py b/recipes/bertrand/all/conanfile.py index 3e410daba2d59..1373f8df7a23f 100644 --- a/recipes/bertrand/all/conanfile.py +++ b/recipes/bertrand/all/conanfile.py @@ -15,6 +15,7 @@ class BertrandConan(ConanFile): homepage = "https://github.com/bernedom/bertrand" description = "A C++ header only library providing a trivial implementation for design by contract." topics = ("design by contract", "dbc", "cplusplus-library", "cplusplus-17") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" @property @@ -31,6 +32,9 @@ def _compilers_minimum_version(self): "apple-clang": "10", } + def layout(self): + cmake_layout(self, src_folder="src") + def package_id(self): self.info.clear() @@ -50,12 +54,8 @@ def loose_lt_semver(v1, v2): f"{self.name} {self.version} 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) @@ -78,6 +78,4 @@ def package_info(self): self.cpp_info.set_property("cmake_file_name", "bertrand") self.cpp_info.set_property("cmake_target_name", "bertrand::bertrand") self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] diff --git a/recipes/bezier/all/conandata.yml b/recipes/bezier/all/conandata.yml new file mode 100644 index 0000000000000..4bb4e5cf2851f --- /dev/null +++ b/recipes/bezier/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.2.1": + url: "https://github.com/oysteinmyrmo/bezier/archive/refs/tags/v0.2.1.tar.gz" + sha256: "fce93c766f31ec445f6f48d0d1438c128640f0728d29745ca9e5424d9daf944f" diff --git a/recipes/bezier/all/conanfile.py b/recipes/bezier/all/conanfile.py new file mode 100644 index 0000000000000..b308756aa16cc --- /dev/null +++ b/recipes/bezier/all/conanfile.py @@ -0,0 +1,63 @@ +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 BezierConan(ConanFile): + name = "bezier" + description = "A single header only C++ library for Bezier curve calculations and manipulations." + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/oysteinmyrmo/bezier" + topics = ("curve", "header-only") + package_type = "header-library" + 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, 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.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"), + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/bezier/all/test_package/CMakeLists.txt b/recipes/bezier/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..b5a9211efc1a8 --- /dev/null +++ b/recipes/bezier/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(bezier REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE bezier::bezier) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/bezier/all/test_package/conanfile.py b/recipes/bezier/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/bezier/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/bezier/all/test_package/test_package.cpp b/recipes/bezier/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..72113a98c3ad7 --- /dev/null +++ b/recipes/bezier/all/test_package/test_package.cpp @@ -0,0 +1,9 @@ +#include +#include "bezier/bezier.h" + +int main(void) { + bezier::Bezier<3> cubicBezier({ {120, 160}, {35, 200}, {220, 260}, {220, 40} }); + + bezier::Point p = cubicBezier.valueAt(0.5); + std::cout << p.x << " " << p.y << std::endl; +} diff --git a/recipes/bezier/config.yml b/recipes/bezier/config.yml new file mode 100644 index 0000000000000..f975c1e3261f7 --- /dev/null +++ b/recipes/bezier/config.yml @@ -0,0 +1,3 @@ +versions: + "0.2.1": + folder: all diff --git a/recipes/bgfx/all/conandata.yml b/recipes/bgfx/all/conandata.yml new file mode 100644 index 0000000000000..47606f9539fe5 --- /dev/null +++ b/recipes/bgfx/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "cci.20230216": + url: "https://github.com/bkaradzic/bgfx/archive/9d5b980f5c060e54cc30dec18500a5b54db00405.tar.gz" + sha256: "291739720E369C5C2422273D887AEC590084B29E5C9DC5C9441F5A68869B6736" diff --git a/recipes/bgfx/all/conanfile.py b/recipes/bgfx/all/conanfile.py new file mode 100644 index 0000000000000..7ce8c351c03cf --- /dev/null +++ b/recipes/bgfx/all/conanfile.py @@ -0,0 +1,321 @@ +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.apple import fix_apple_shared_install_name, is_apple_os +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 bgfxConan(ConanFile): + name = "bgfx" + license = "BSD-2-Clause" + homepage = "https://github.com/bkaradzic/bgfx" + url = "https://github.com/conan-io/conan-center-index" + description = "Cross-platform, graphics API agnostic, \"Bring Your Own Engine/Framework\" style rendering library." + topics = ("rendering", "graphics") + settings = "os", "compiler", "arch", "build_type" + options = {"shared": [True, False], "tools": [True, False]} + default_options = {"shared": False, "tools": False} + + @property + def _bx_folder(self): + return "bx" + + @property + def _bimg_folder(self): + return "bimg" + + @property + def _bgfx_folder(self): + return "bgfx" + + @property + def _bgfx_path(self): + return os.path.join(self.source_folder, self._bgfx_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.shared: + genie_extra += " --with-shared-lib" + 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 _shaderc_target_prefix(self): + if self.settings.os == "Windows": + return "shaderc\\" + else: + return "" + + @property + def _projs(self): + if self.options.shared: + projs = [f"{self._lib_target_prefix}bgfx-shared-lib"] + else: + projs = [f"{self._lib_target_prefix}bgfx"] + if self.options.tools: + projs.extend([f"{self._tool_target_prefix}{self._shaderc_target_prefix}shaderc", + f"{self._tool_target_prefix}texturev", + f"{self._tool_target_prefix}geometryc", + f"{self._tool_target_prefix}geometryv"]) + return projs + + @property + def _compiler_required(self): + return { + "gcc": "8", + "clang": "3.3", + "apple-clang": "12", #to keep CCI compiling on osx 11.0 or higher, for now + "msvc": "191", + "Visual Studio": "15" #TODO remove with conan 2.0 + } + + @property + def _bx_version(self): #mapping of bgfx version to required/used bx version + return {"cci.20230216": "cci.20221116"} + + @property + def _bimg_version(self): #mapping of bgfx version to required/used bimg version + return {"cci.20230216": "cci.20230114"} + + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + # bgfx's C99 API absolutely requires a header from bx so we need those to be transitive + self.requires(f"bx/{self._bx_version[self.version]}", transitive_headers=True) + self.requires(f"bimg/{self._bimg_version[self.version]}") + self.requires("opengl/system") + + 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._bgfx_folder)) + # bgfx's genie project, and the projects generated by it, expect bx and bimg source to be present on the same relative root as bimg's in order to build + # usins a pre-built bx and bimg 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)) + get(self, **self.dependencies["bimg"].conan_data["sources"][self._bimg_version[self.version]], strip_root=True, + destination=os.path.join(self.source_folder, self._bimg_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", + "194": "2022", "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._bgfx_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._bgfx_path, ".build", "projects", genie_VS, "bgfx.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._bgfx_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._bgfx_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": + if self.options.shared: + lib_pat = "*bgfx-shared-lib*.lib" + else: + lib_pat = "*bgfx*.lib" + package_lib_prefix = "" + elif self.settings.os in ["Linux", "FreeBSD"]: + if self.options.shared: + lib_pat = "*bgfx*.so" + else: + lib_pat = "*bgfx*.a" + package_lib_prefix = "lib" + elif self.settings.os in ["Macos", "iOS"]: + if self.options.shared: + lib_pat = "*bgfx*.dylib" + else: + lib_pat = "*bgfx*.a" + package_lib_prefix = "lib" + + # Get build bin folder + for bimg_out_dir in os.listdir(os.path.join(self._bgfx_path, ".build")): + if not bimg_out_dir=="projects": + build_bin = os.path.join(self._bgfx_path, ".build", bimg_out_dir, "bin") + break + + # Copy license + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self._bgfx_path) + # Copy includes + copy(self, pattern="*.h", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self._bgfx_path, "include")) + # Copy libs + copy(self, pattern=lib_pat, dst=os.path.join(self.package_folder, "lib"), src=build_bin, keep_path=False) + if self.options.shared: + copy(self, pattern="*.dll", dst=os.path.join(self.package_folder, "bin"), src=build_bin, keep_path=False) + + # Copy tools + if self.options.tools: + copy(self, pattern="shaderc*", dst=os.path.join(self.package_folder, "bin"), src=build_bin, keep_path=False) + copy(self, pattern="texturev*", dst=os.path.join(self.package_folder, "bin"), src=build_bin, keep_path=False) + copy(self, pattern="geometryc*", dst=os.path.join(self.package_folder, "bin"), src=build_bin, keep_path=False) + copy(self, pattern="geometryv*", dst=os.path.join(self.package_folder, "bin"), src=build_bin, keep_path=False) + + # Rename for consistency across platforms and configs + if not (is_apple_os(self) and self.options.shared): #Apparently apple dylibs break if renamed + for bgfx_file in Path(os.path.join(self.package_folder, "lib")).glob("*bgfx*"): + rename(self, os.path.join(self.package_folder, "lib", bgfx_file.name), + os.path.join(self.package_folder, "lib", f"{package_lib_prefix}bgfx{bgfx_file.suffix}")) + if self.options.tools: + for bgfx_file in Path(os.path.join(self.package_folder, "bin")).glob("*shaderc*"): + rename(self, os.path.join(self.package_folder, "bin", bgfx_file.name), + os.path.join(self.package_folder, "bin", f"shaderc{bgfx_file.suffix}")) + for bgfx_file in Path(os.path.join(self.package_folder, "bin")).glob("*texturev*"): + rename(self, os.path.join(self.package_folder, "bin", bgfx_file.name), + os.path.join(self.package_folder, "bin", f"texturev{bgfx_file.suffix}")) + for bgfx_file in Path(os.path.join(self.package_folder, "bin")).glob("*geometryc*"): + rename(self, os.path.join(self.package_folder, "bin", bgfx_file.name), + os.path.join(self.package_folder, "bin", f"geometryc{bgfx_file.suffix}")) + for bgfx_file in Path(os.path.join(self.package_folder, "bin")).glob("*geometryv*"): + rename(self, os.path.join(self.package_folder, "bin", bgfx_file.name), + os.path.join(self.package_folder, "bin", f"geometryv{bgfx_file.suffix}")) + + # Maybe this helps + if is_apple_os(self): + fix_apple_shared_install_name(self) + + def package_info(self): + self.cpp_info.includedirs = ["include"] + if self.options.shared and self.settings.os in ["Macos", "iOS"]: + self.cpp_info.libs = [f"bgfx-shared-lib{self.settings.build_type}"] + else: + self.cpp_info.libs = ["bgfx"] + + if self.options.shared: + self.cpp_info.defines.extend(["BGFX_SHARED_LIB_USE=1"]) + + if self.settings.os == "Windows": + self.cpp_info.system_libs.extend(["gdi32"]) + if not is_msvc(self): + self.cpp_info.system_libs.extend(["comdlg32"]) + elif self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["X11", "GL"]) + elif self.settings.os in ["Macos", "iOS"]: + self.cpp_info.frameworks.extend(["CoreFoundation", "AppKit", "IOKit", "QuartzCore", "Metal"]) + if self.settings.os in ["Macos"]: + self.cpp_info.frameworks.extend(["OpenGL"]) + else: + self.cpp_info.frameworks.extend(["OpenGLES", "UIKit"]) + elif self.settings.os in ["Android"]: + self.cpp_info.system_libs.extend(["EGL", "GLESv2"]) + + self.cpp_info.set_property("cmake_file_name", "bgfx") + self.cpp_info.set_property("cmake_target_name", "bgfx::bgfx") + self.cpp_info.set_property("pkg_config_name", "bgfx") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "bgfx" + self.cpp_info.filenames["cmake_find_package_multi"] = "bgfx" + self.cpp_info.names["cmake_find_package"] = "bgfx" + self.cpp_info.names["cmake_find_package_multi"] = "bgfx" diff --git a/recipes/bgfx/all/test_package/CMakeLists.txt b/recipes/bgfx/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..2c968e2dda718 --- /dev/null +++ b/recipes/bgfx/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package LANGUAGES CXX) + +find_package(bgfx REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) +target_link_libraries(${PROJECT_NAME} bgfx::bgfx) diff --git a/recipes/bgfx/all/test_package/conanfile.py b/recipes/bgfx/all/test_package/conanfile.py new file mode 100644 index 0000000000000..4e578144a798a --- /dev/null +++ b/recipes/bgfx/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 = "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/bgfx/all/test_package/test_package.cpp b/recipes/bgfx/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..630c14bc99ec9 --- /dev/null +++ b/recipes/bgfx/all/test_package/test_package.cpp @@ -0,0 +1,36 @@ +//Important: bgfx shared on windows only works with the C99 API, the C++ API is not exported +#include + +#if BGFX_SHARED_LIB_USE && (BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT) +#include +#else +#include +#endif + +int main() { +#if BGFX_SHARED_LIB_USE && (BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT) + bgfx_init_t init; + bgfx_init_ctor(&init); + init.type = bgfx_renderer_type::BGFX_RENDERER_TYPE_NOOP; + init.vendorId = BGFX_PCI_ID_NONE; + init.platformData.nwh = nullptr; + init.platformData.ndt = nullptr; + init.resolution.width = 0; + init.resolution.height = 0; + init.resolution.reset = BGFX_RESET_NONE; + bgfx_init(&init); + bgfx_shutdown(); + return 0; +#else + bgfx::Init init; + init.type = bgfx::RendererType::Noop; + init.vendorId = BGFX_PCI_ID_NONE; + init.platformData.nwh = nullptr; + init.platformData.ndt = nullptr; + init.resolution.width = 0; + init.resolution.height = 0; + init.resolution.reset = BGFX_RESET_NONE; + bgfx::init(init); + bgfx::shutdown(); +#endif +} diff --git a/recipes/bgfx/all/test_v1_package/CMakeLists.txt b/recipes/bgfx/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..667976629550a --- /dev/null +++ b/recipes/bgfx/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/bgfx/all/test_v1_package/conanfile.py b/recipes/bgfx/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..056e75eddb91c --- /dev/null +++ b/recipes/bgfx/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/bgfx/config.yml b/recipes/bgfx/config.yml new file mode 100644 index 0000000000000..0fa69d015c844 --- /dev/null +++ b/recipes/bgfx/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20230216": + 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..e261d422055f7 --- /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", + "194": "2022", "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..17cae79880122 --- /dev/null +++ b/recipes/bimg/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 = "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 b7a4dea94feef..f0dd0d5db997f 100644 --- a/recipes/binutils/all/conandata.yml +++ b/recipes/binutils/all/conandata.yml @@ -1,10 +1,16 @@ sources: - "2.38": # 2022-02-09 - url: "https://ftp.gnu.org/gnu/binutils/binutils-2.38.tar.gz" - sha256: "b3f1dc5b17e75328f19bd88250bee2ef9f91fc8cbb7bd48bdb31390338636052" - "2.37": - url: "https://ftp.gnu.org/gnu/binutils/binutils-2.37.tar.gz" - sha256: "c44968b97cd86499efbc4b4ab7d98471f673e5414c554ef54afa930062dbbfcb" + "2.42": + url: "https://ftp.gnu.org/gnu/binutils/binutils-2.42.tar.xz" + sha256: "f6e4d41fd5fc778b06b7891457b3620da5ecea1006c6a4a41ae998109f85a800" + "2.41": + url: "https://ftp.gnu.org/gnu/binutils/binutils-2.41.tar.xz" + sha256: "ae9a5789e23459e59606e6714723f2d3ffc31c03174191ef0d015bdf06007450" patches: - "2.38": - - patch_file: "patches/2.38-0001-no-texinfo.patch" + "2.42": + - patch_file: "patches/2.42-0001-no-texinfo.patch" + patch_type: "conan" + patch_description: "disable texinfo" + "2.41": + - patch_file: "patches/2.41-0001-no-texinfo.patch" + patch_type: "conan" + patch_description: "disable texinfo" diff --git a/recipes/binutils/all/conanfile.py b/recipes/binutils/all/conanfile.py index 524749a89efb5..09d66fc511d1f 100644 --- a/recipes/binutils/all/conanfile.py +++ b/recipes/binutils/all/conanfile.py @@ -1,18 +1,17 @@ -from conan import ConanFile -from conan.tools.gnu import Autotools, AutotoolsToolchain -from conan.tools.files import get, rmdir, rm, copy, apply_conandata_patches, export_conandata_patches -from conan.errors import ConanInvalidConfiguration -from conan.tools.microsoft import is_msvc -from conan.tools.layout import basic_layout - 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.52.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` @@ -21,30 +20,29 @@ 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}) } def layout(self): @@ -61,31 +59,33 @@ def _settings_target(self): def export_sources(self): export_conandata_patches(self) - def config_options(self): - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx - 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}") @@ -101,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)) @@ -128,27 +128,33 @@ 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 self.conf.get("tools.microsoft.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") + self.tool_requires("bison/3.8.2") + self.tool_requires("flex/2.6.4") def requirements(self): - self.requires("zlib/1.2.13") + self.requires("zlib/[>=1.2.11 <2]") def source(self): - get(self, **self.conan_data["sources"][self.version], - strip_root=True, destination=self.source_folder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) @property def _exec_prefix(self): return os.path.join("bin", "exec_prefix") def generate(self): - yes_no = lambda tf : "yes" if tf else "no" + 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={self.deps_cpp_info['zlib'].rootpath}") + 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() @@ -188,13 +194,20 @@ def package_info(self): 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) + # Add recipe path to enable running the self test in the test package. # Don't use this property in production code. It's unsupported. self.user_info.recipe_path = os.path.realpath(__file__) - + self.cpp_info.resdirs = ["etc"] + self.buildenv_info.define("GPROFNG_SYSCONFDIR", os.path.join(self.package_folder, "etc")) + if self.settings.os in ("FreeBSD", "Linux"): + self.cpp_info.system_libs = ["dl", "rt"] 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 {} @@ -303,7 +316,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: @@ -328,7 +341,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/patches/2.38-0001-no-texinfo.patch b/recipes/binutils/all/patches/2.38-0001-no-texinfo.patch deleted file mode 100644 index 1e0698965c0de..0000000000000 --- a/recipes/binutils/all/patches/2.38-0001-no-texinfo.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- gas/Makefile.in -+++ gas/Makefile.in -@@ -1778,7 +1778,7 @@ - check-am: all-am - $(MAKE) $(AM_MAKEFLAGS) check-DEJAGNU - check: check-recursive --all-am: Makefile $(INFO_DEPS) $(PROGRAMS) $(SCRIPTS) $(MANS) config.h -+all-am: Makefile $(PROGRAMS) $(SCRIPTS) $(MANS) config.h - installdirs: installdirs-recursive - installdirs-am: - for dir in "$(DESTDIR)$(infodir)" "$(DESTDIR)$(man1dir)"; do \ -@@ -1854,7 +1854,7 @@ info: info-recursive - - info-am: $(INFO_DEPS) info-local - --install-data-am: install-data-local install-info-am install-man -+install-data-am: install-man - - install-dvi: install-dvi-recursive - diff --git a/recipes/binutils/all/patches/2.41-0001-no-texinfo.patch b/recipes/binutils/all/patches/2.41-0001-no-texinfo.patch new file mode 100644 index 0000000000000..f6d719e75f24e --- /dev/null +++ b/recipes/binutils/all/patches/2.41-0001-no-texinfo.patch @@ -0,0 +1,57 @@ +diff --git a/bfd/Makefile.in b/bfd/Makefile.in +index 4edfedee..47c7de53 100644 +--- a/bfd/Makefile.in ++++ b/bfd/Makefile.in +@@ -253,7 +253,7 @@ am__v_texidevnull_ = $(am__v_texidevnull_@AM_DEFAULT_V@) + am__v_texidevnull_0 = > /dev/null + am__v_texidevnull_1 = + am__dirstamp = $(am__leading_dot)dirstamp +-INFO_DEPS = doc/bfd.info ++INFO_DEPS = + am__TEXINFO_TEX_DIR = $(srcdir) + DVIS = doc/bfd.dvi + PDFS = doc/bfd.pdf +@@ -2022,7 +2022,7 @@ distclean-tags: + check-am: all-am + check: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) check-recursive +-all-am: Makefile $(INFO_DEPS) $(LTLIBRARIES) $(HEADERS) config.h ++all-am: Makefile $(LTLIBRARIES) $(HEADERS) config.h + installdirs: installdirs-recursive + installdirs-am: + for dir in "$(DESTDIR)$(bfdlibdir)" "$(DESTDIR)$(infodir)" "$(DESTDIR)$(bfdincludedir)"; do \ +@@ -2089,8 +2089,7 @@ info: info-recursive + + info-am: $(INFO_DEPS) + +-install-data-am: install-bfdincludeHEADERS install-bfdlibLTLIBRARIES \ +- install-info-am ++install-data-am: install-bfdincludeHEADERS install-bfdlibLTLIBRARIES + + install-dvi: install-dvi-recursive + +diff --git a/gas/Makefile.in b/gas/Makefile.in +index 427f42df..535ad3f3 100644 +--- a/gas/Makefile.in ++++ b/gas/Makefile.in +@@ -1793,7 +1793,7 @@ distclean-DEJAGNU: + check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) check-DEJAGNU + check: check-recursive +-all-am: Makefile $(INFO_DEPS) $(PROGRAMS) $(SCRIPTS) $(MANS) config.h ++all-am: Makefile $(PROGRAMS) $(SCRIPTS) $(MANS) config.h + installdirs: installdirs-recursive + installdirs-am: + for dir in "$(DESTDIR)$(infodir)" "$(DESTDIR)$(man1dir)"; do \ +@@ -1869,7 +1869,7 @@ info: info-recursive + + info-am: $(INFO_DEPS) info-local + +-install-data-am: install-info-am install-man ++install-data-am: install-man + + install-dvi: install-dvi-recursive + +-- +2.34.1 + diff --git a/recipes/binutils/all/patches/2.42-0001-no-texinfo.patch b/recipes/binutils/all/patches/2.42-0001-no-texinfo.patch new file mode 100644 index 0000000000000..231668a13cce4 --- /dev/null +++ b/recipes/binutils/all/patches/2.42-0001-no-texinfo.patch @@ -0,0 +1,51 @@ +--- bfd/Makefile.in ++++ bfd/Makefile.in +@@ -259,7 +259,7 @@ + am__v_texidevnull_0 = > /dev/null + am__v_texidevnull_1 = + am__dirstamp = $(am__leading_dot)dirstamp +-INFO_DEPS = doc/bfd.info ++INFO_DEPS = + am__TEXINFO_TEX_DIR = $(srcdir) + DVIS = doc/bfd.dvi + PDFS = doc/bfd.pdf +@@ -2050,7 +2050,7 @@ + check-am: all-am + check: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) check-recursive +-all-am: Makefile $(INFO_DEPS) $(LTLIBRARIES) $(HEADERS) config.h ++all-am: Makefile $(LTLIBRARIES) $(HEADERS) config.h + installdirs: installdirs-recursive + installdirs-am: + for dir in "$(DESTDIR)$(bfdlibdir)" "$(DESTDIR)$(infodir)" "$(DESTDIR)$(bfdincludedir)"; do \ +@@ -2117,8 +2117,7 @@ + + info-am: $(INFO_DEPS) + +-install-data-am: install-bfdincludeHEADERS install-bfdlibLTLIBRARIES \ +- install-info-am ++install-data-am: install-bfdincludeHEADERS install-bfdlibLTLIBRARIES + + install-dvi: install-dvi-recursive + + +--- gas/Makefile.in ++++ gas/Makefile.in +@@ -1825,7 +1825,7 @@ + check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) check-DEJAGNU + check: check-recursive +-all-am: Makefile $(INFO_DEPS) $(PROGRAMS) $(SCRIPTS) $(MANS) config.h ++all-am: Makefile $(PROGRAMS) $(SCRIPTS) $(MANS) config.h + installdirs: installdirs-recursive + installdirs-am: + for dir in "$(DESTDIR)$(infodir)" "$(DESTDIR)$(man1dir)"; do \ +@@ -1901,7 +1901,7 @@ + + info-am: $(INFO_DEPS) info-local + +-install-data-am: install-info-am install-man ++install-data-am: install-man + + install-dvi: install-dvi-recursive + diff --git a/recipes/binutils/all/test_package/conanfile.py b/recipes/binutils/all/test_package/conanfile.py index 6b7ddeed01c09..79dfa71fb4157 100644 --- a/recipes/binutils/all/test_package/conanfile.py +++ b/recipes/binutils/all/test_package/conanfile.py @@ -1,113 +1,36 @@ -from conans import ConanFile, tools -from io import StringIO -import os +from conan import ConanFile +from conan.tools.layout import basic_layout 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 - - 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") + return self._settings_build.os not in ("Macos",) - 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 + def layout(self): + basic_layout(self) - 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 + def test(self): + 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/binutils/config.yml b/recipes/binutils/config.yml index f7cce7c207880..58766488a2584 100644 --- a/recipes/binutils/config.yml +++ b/recipes/binutils/config.yml @@ -1,5 +1,5 @@ versions: - "2.38": + "2.42": folder: all - "2.37": + "2.41": folder: all diff --git a/recipes/bison/all/conandata.yml b/recipes/bison/all/conandata.yml index 67b0780a7f658..5b0419bb8cd0b 100644 --- a/recipes/bison/all/conandata.yml +++ b/recipes/bison/all/conandata.yml @@ -14,35 +14,50 @@ sources: patches: "3.8.2": - patch_file: "patches/0001-3.8-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.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 86d0e584d5c46..98dd943f37017 100644 --- a/recipes/bison/all/conanfile.py +++ b/recipes/bison/all/conanfile.py @@ -1,11 +1,13 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.files import get, apply_conandata_patches, replace_in_file -from conans import AutoToolsBuildEnvironment, tools -import contextlib +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.47.0" +required_conan_version = ">=1.54.0" class BisonConan(ConanFile): @@ -23,151 +25,144 @@ 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) + 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 self.settings.compiler == "Visual Studio" and self.version == "3.8.2": - raise ConanInvalidConfiguration("bison/3.8.2 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") + 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.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") + 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): - 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".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): + 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") + env.define("NM", "dumpbin -symbols") + env.define("OBJDUMP", ":") + env.define("RANLIB", ":") + env.define("STRIP", ":") + tc.generate(env) def _patch_sources(self): 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 - replace_in_file(self, os.path.join(self._source_subfolder, "Makefile.in"), + replace_in_file(self, makefile, "echo '#define BINDIR \"$(bindir)\"';", "echo '#define BINDIR \"$(shell cygpath -m \"$(bindir)\")\"';") - replace_in_file(self, os.path.join(self._source_subfolder, "Makefile.in"), + replace_in_file(self, makefile, "echo '#define PKGDATADIR \"$(pkgdatadir)\"';", "echo '#define PKGDATADIR \"$(shell cygpath -m \"$(pkgdatadir)\")\"';") - replace_in_file(self, os.path.join(self._source_subfolder, "Makefile.in"), + replace_in_file(self, makefile, "echo '#define DATADIR \"$(datadir)\"';", "echo '#define DATADIR \"$(shell cygpath -m \"$(datadir)\")\"';") - replace_in_file(self, os.path.join(self._source_subfolder, "Makefile.in"), + replace_in_file(self, makefile, "echo '#define DATAROOTDIR \"$(datarootdir)\"';", "echo '#define DATAROOTDIR \"$(shell cygpath -m \"$(datarootdir)\")\"';") - replace_in_file(self, os.path.join(self._source_subfolder, "Makefile.in"), + replace_in_file(self, makefile, "dist_man_MANS = $(top_srcdir)/doc/bison.1", "dist_man_MANS =") - replace_in_file(self, os.path.join(self._source_subfolder, "src", "yacc.in"), - "@prefix@", - "${}_ROOT".format(self.name.upper())) - replace_in_file(self, 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/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/bit-lite/all/conanfile.py b/recipes/bit-lite/all/conanfile.py index b0529cb7abe9a..9057f4c627521 100644 --- a/recipes/bit-lite/all/conanfile.py +++ b/recipes/bit-lite/all/conanfile.py @@ -14,18 +14,18 @@ class BitLiteConan(ConanFile): in a single-file header-only library.") topics = ("bit-lite", "bit", "manipulation", ) license = "BSL-1.0" + package_type = "header-library" 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 @@ -38,9 +38,7 @@ def package_info(self): self.cpp_info.set_property("cmake_file_name", "bit-lite") self.cpp_info.set_property("cmake_target_name", "nonstd::bit-lite") 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"] = "bit-lite" diff --git a/recipes/bitflags/all/conanfile.py b/recipes/bitflags/all/conanfile.py index c9f1d462a3694..dc6d3239bb416 100644 --- a/recipes/bitflags/all/conanfile.py +++ b/recipes/bitflags/all/conanfile.py @@ -17,35 +17,42 @@ class BitFlags(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/m-peko/bitflags" license = "MIT" + package_type = "header-library" 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"} + def _min_cppstd(self): + return "11" @property - def _minimum_cpp_standard(self): - return 11 + def _compilers_minimum_version(self): + return { + "apple-clang": "5", + "clang": "5", + "gcc": "7", + "Visual Studio": "14", + "msvc": "190", + } def layout(self): - basic_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) - 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.") + 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, - destination=self.source_folder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): copy(self, pattern="LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) @@ -56,4 +63,3 @@ def package_info(self): 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_v1_package/CMakeLists.txt b/recipes/bitflags/all/test_v1_package/CMakeLists.txt index 789568c184c15..0d20897301b68 100644 --- a/recipes/bitflags/all/test_v1_package/CMakeLists.txt +++ b/recipes/bitflags/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") +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) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/bitmagic/all/conandata.yml b/recipes/bitmagic/all/conandata.yml index be5ff4fa07b8e..eef7267c67af3 100644 --- a/recipes/bitmagic/all/conandata.yml +++ b/recipes/bitmagic/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "7.13.4": + url: "https://github.com/tlk00/BitMagic/archive/refs/tags/v7.13.4.tar.gz" + sha256: "3a45e2f11396b09f963573af299d9ce03b6d100357d317c817cd91cca4ba84c4" "7.12.3": url: "https://github.com/tlk00/BitMagic/archive/refs/tags/v7.12.3.tar.gz" sha256: "5e59507a01a8295bb57aebcf557a4a25b992244736f7924300cdb9635f1b2780" diff --git a/recipes/bitmagic/all/conanfile.py b/recipes/bitmagic/all/conanfile.py index 8a5d321f046d1..298aa1209d5d7 100644 --- a/recipes/bitmagic/all/conanfile.py +++ b/recipes/bitmagic/all/conanfile.py @@ -19,10 +19,15 @@ class BitmagicConan(ConanFile): homepage = "http://bitmagic.io" topics = ("information-retrieval", "algorithm", "bit-manipulation", "integer-compression", "sparse-vector", "sparse-matrix", "bit-array", - "bit-vector", "indexing-engine", "adjacency-matrix", "associative-array") + "bit-vector", "indexing-engine", "adjacency-matrix", "associative-array", "header-only") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True + @property + def _min_cppstd(self): + return 17 + @property def _minimum_compilers_version(self): return { @@ -38,7 +43,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) 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.name} requires C++17, which your compiler does not support.") @@ -47,8 +52,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 @@ -59,6 +63,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/bitmagic/all/test_package/conanfile.py b/recipes/bitmagic/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/bitmagic/all/test_package/conanfile.py +++ b/recipes/bitmagic/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/bitmagic/all/test_v1_package/CMakeLists.txt b/recipes/bitmagic/all/test_v1_package/CMakeLists.txt index a1f535ce8930b..be00a8c7f57c7 100644 --- a/recipes/bitmagic/all/test_v1_package/CMakeLists.txt +++ b/recipes/bitmagic/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(bitmagic REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE bitmagic::bitmagic) -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/bitmagic/config.yml b/recipes/bitmagic/config.yml index 34c9a540c22c6..f5ee671fc8132 100644 --- a/recipes/bitmagic/config.yml +++ b/recipes/bitmagic/config.yml @@ -1,4 +1,6 @@ versions: + "7.13.4": + folder: all "7.12.3": folder: all "7.11.2": diff --git a/recipes/bitserializer/all/conandata.yml b/recipes/bitserializer/all/conandata.yml index 10234ee527ae7..26d9d94803f91 100644 --- a/recipes/bitserializer/all/conandata.yml +++ b/recipes/bitserializer/all/conandata.yml @@ -1,7 +1,16 @@ sources: + "0.70": + url: "https://github.com/PavelKisliak/BitSerializer/archive/v0.70.tar.gz" + sha256: "094b12c729b35bf2cede8b55e8193db7793482646f0307c17bcc736de6cce7c9" + "0.65": + url: "https://github.com/PavelKisliak/BitSerializer/archive/v0.65.tar.gz" + sha256: "b4d90f13dd424faebe3ee57ee0cb86ff304e893990afd259c6a29d1f8533b2ef" + "0.50": + url: "https://github.com/PavelKisliak/BitSerializer/archive/0.50.tar.gz" + sha256: "0ba9d57f1546b9c9245a97ced0ed05ec9fb969e0542093da3a8bf9dcfe7f7a6d" "0.44": - url: "https://bitbucket.com/Pavel_Kisliak/BitSerializer/get/0.44.tar.gz" - sha256: "39ee0b038c9f38a012f96913c9738a68514d2e923431fbd83ddf3f454e02bc6c" + url: "https://github.com/PavelKisliak/BitSerializer/archive/0.44.tar.gz" + sha256: "ab0f74914d8120ee5e7a8ed10b0e9d83ed8135cd9e3356b5d0dcefc1cc88e47f" "0.10": - url: "https://bitbucket.com/Pavel_Kisliak/BitSerializer/get/0.10.tar.gz" - sha256: "d5ae211aead17acb91d9fb7df7e72a30202f39412159dd0b46fe0e5046b29f94" + url: "https://github.com/PavelKisliak/BitSerializer/archive/0.10.tar.gz" + sha256: "e9b898e453c66742a3c9d762c3e9f64f478fdb79680792b8725f953342fcc348" diff --git a/recipes/bitserializer/all/conanfile.py b/recipes/bitserializer/all/conanfile.py index cf88fcf1ae05c..0f0a334d614b2 100644 --- a/recipes/bitserializer/all/conanfile.py +++ b/recipes/bitserializer/all/conanfile.py @@ -1,36 +1,43 @@ 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.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, rmdir, replace_in_file 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.51.1" 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, MsgPack)" + topics = ("serialization", "json", "xml", "yaml", "csv", "msgpack") url = "https://github.com/conan-io/conan-center-index" homepage = "https://bitbucket.org/Pavel_Kisliak/bitserializer" license = "MIT" - + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" options = { + "fPIC": [True, False], "with_cpprestsdk": [True, False], "with_rapidjson": [True, False], "with_pugixml": [True, False], + "with_rapidyaml": [True, False], + "with_csv": [True, False], + "with_msgpack": [True, False], } default_options = { + "fPIC": True, "with_cpprestsdk": False, "with_rapidjson": False, "with_pugixml": False, + "with_rapidyaml": False, + "with_csv": False, + "with_msgpack": False, } - no_copy_source = True - @property def _min_cppstd(self): return "17" @@ -45,19 +52,47 @@ def _compilers_minimum_version(self): "apple-clang": "12", } + def _is_header_only(self, info=False): + if Version(self.version) < "0.50": + return True + # All components of library are header-only except csv-archive and msgpack-archive + options = self.info.options if info else self.options + return not (options.with_csv or options.get_safe("with_msgpack")) + + def config_options(self): + if self.settings.os == "Windows" or Version(self.version) < "0.50": + del self.options.fPIC + if Version(self.version) < "0.50": + del self.options.with_rapidyaml + del self.options.with_csv + if Version(self.version) < "0.70": + del self.options.with_msgpack + + def configure(self): + if self._is_header_only(): + self.options.rm_safe("fPIC") + else: + self.package_type = "static-library" + def layout(self): - basic_layout(self, src_folder="src") + if self._is_header_only(): + basic_layout(self, src_folder="src") + else: + cmake_layout(self, src_folder="src") def requirements(self): if self.options.with_cpprestsdk: - self.requires("cpprestsdk/2.10.18", transitive_headers=True, transitive_libs=True) + self.requires("cpprestsdk/2.10.19", transitive_headers=True, transitive_libs=True) if self.options.with_rapidjson: - self.requires("rapidjson/cci.20220514", transitive_headers=True, transitive_libs=True) + self.requires("rapidjson/1.1.0", transitive_headers=True, transitive_libs=True) if self.options.with_pugixml: - self.requires("pugixml/1.13", transitive_headers=True, transitive_libs=True) + self.requires("pugixml/1.14", transitive_headers=True, transitive_libs=True) + if self.options.get_safe("with_rapidyaml"): + self.requires("rapidyaml/0.5.0", transitive_headers=True, transitive_libs=True) def package_id(self): - self.info.clear() + if self._is_header_only(info=True): + self.info.clear() def validate(self): if self.settings.compiler.get_safe("cppstd"): @@ -78,17 +113,50 @@ def validate(self): ' or "compiler.libcxx=libc++"') 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._is_header_only(): + tc = CMakeToolchain(self) + tc.variables["BUILD_CPPRESTJSON_ARCHIVE"] = self.options.with_cpprestsdk + tc.variables["BUILD_RAPIDJSON_ARCHIVE"] = self.options.with_rapidjson + tc.variables["BUILD_PUGIXML_ARCHIVE"] = self.options.with_pugixml + tc.variables["BUILD_RAPIDYAML_ARCHIVE"] = self.options.with_rapidyaml + tc.variables["BUILD_CSV_ARCHIVE"] = self.options.with_csv + tc.variables["BUILD_MSGPACK_ARCHIVE"] = self.options.get_safe("with_msgpack") + tc.generate() + deps = CMakeDeps(self) + deps.generate() + + def _patch_sources(self): + if Version(self.version) >= "0.50": + # 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> + $<$:BitSerializer::msgpack-archive> +) target_compile_definitions(${PROJECT_NAME} PRIVATE $<$:"WITH_CPPRESTSDK"> $<$:"WITH_RAPIDJSON"> - $<$:"WITH_PUGIXML">) + $<$:"WITH_PUGIXML"> + $<$:"WITH_RAPIDYAML"> + $<$:"WITH_CSV"> + $<$:"WITH_MSGPACK"> +) diff --git a/recipes/bitserializer/all/test_package/conanfile.py b/recipes/bitserializer/all/test_package/conanfile.py index 4076e2a9b6b6d..86588bf359b36 100644 --- a/recipes/bitserializer/all/test_package/conanfile.py +++ b/recipes/bitserializer/all/test_package/conanfile.py @@ -17,9 +17,13 @@ def requirements(self): def generate(self): tc = CMakeToolchain(self) - tc.variables["WITH_CPPRESTSDK"] = self.dependencies["bitserializer"].options.with_cpprestsdk - tc.variables["WITH_RAPIDJSON"] = self.dependencies["bitserializer"].options.with_rapidjson - tc.variables["WITH_PUGIXML"] = self.dependencies["bitserializer"].options.with_pugixml + 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.get_safe("with_rapidyaml", False) + tc.variables["WITH_CSV"] = bitserializerOptions.get_safe("with_csv", False) + tc.variables["WITH_MSGPACK"] = bitserializerOptions.get_safe("with_msgpack", False) tc.generate() def build(self): diff --git a/recipes/bitserializer/all/test_package/test_package.cpp b/recipes/bitserializer/all/test_package/test_package.cpp index 643c308b932d2..e3fd28d5e32b4 100644 --- a/recipes/bitserializer/all/test_package/test_package.cpp +++ b/recipes/bitserializer/all/test_package/test_package.cpp @@ -12,6 +12,15 @@ #ifdef WITH_PUGIXML #include #endif +#ifdef WITH_RAPIDYAML +#include +#endif +#ifdef WITH_CSV +#include +#endif +#ifdef WITH_MSGPACK +#include +#endif #include #include @@ -27,12 +36,28 @@ class CTest template void Serialize(TArchive& archive) { +#if BITSERIALIZER_VERSION >= 7000 + archive << BitSerializer::KeyValue("Message", mMessage); +#else archive << BitSerializer::MakeAutoKeyValue("Message", mMessage); +#endif } std::string mMessage; }; +std::string PrintAsHexString(const std::string& data) +{ + constexpr char hexChars[] = "0123456789ABCDEF"; + std::string result; + for (const char ch : data) + { + if (!result.empty()) result.push_back(' '); + result.append({ hexChars[(ch & 0xF0) >> 4], hexChars[(ch & 0x0F) >> 0] }); + } + return result; +} + template void TestArchive(const std::string& message) { @@ -41,21 +66,34 @@ 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; +#if BITSERIALIZER_VERSION >= 7000 + const std::string result = TArchive::is_binary ? PrintAsHexString(outputStream.str()) : outputStream.str(); +#else + const std::string result = outputStream.str(); +#endif + std::cout << result<< std::endl; } int main() { std::cout << "BitSerializer version: " +#ifdef BITSERIALIZER_VERSION + << BitSerializer::Convert::To(BITSERIALIZER_VERSION_MAJOR) << "." + << BitSerializer::Convert::To(BITSERIALIZER_VERSION_MINOR) << "." + << BitSerializer::Convert::To(BITSERIALIZER_VERSION_PATCH) +#else << BitSerializer::Convert::To(BitSerializer::Version::Major) << "." << BitSerializer::Convert::To(BitSerializer::Version::Minor) << "." << BitSerializer::Convert::To(BitSerializer::Version::Maintenance) +#endif << std::endl; +#if !defined BITSERIALIZER_VERSION || BITSERIALIZER_HAS_FILESYSTEM // Some compilers does not link filesystem automatically std::cout << "Testing the link of C++17 filesystem: " << std::filesystem::temp_directory_path() << std::endl; +#endif #ifdef WITH_CPPRESTSDK TestArchive("Implementation based on cpprestsdk"); @@ -66,4 +104,13 @@ 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 +#ifdef WITH_MSGPACK + TestArchive("MsgPack archive (built-in implementation)"); +#endif } diff --git a/recipes/bitserializer/all/test_v1_package/conanfile.py b/recipes/bitserializer/all/test_v1_package/conanfile.py index 2aef261cc5712..cc693be1ab4b9 100644 --- a/recipes/bitserializer/all/test_v1_package/conanfile.py +++ b/recipes/bitserializer/all/test_v1_package/conanfile.py @@ -1,4 +1,5 @@ from conans import ConanFile, CMake, tools +from conans.errors import ConanException import os @@ -6,11 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "cmake", "cmake_find_package_multi" + def _bitserializer_option(self, name, default=None): + try: + return getattr(self.options["bitserializer"], name, default) + except (AttributeError, ConanException): + return default + 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._bitserializer_option("with_rapidyaml", False) + cmake.definitions["WITH_CSV"] = self._bitserializer_option("with_csv", False) + cmake.definitions["WITH_MSGPACK"] = self._bitserializer_option("with_msgpack", False) cmake.configure() cmake.build() diff --git a/recipes/bitserializer/config.yml b/recipes/bitserializer/config.yml index 3b57b2ed72ef1..a645049195724 100644 --- a/recipes/bitserializer/config.yml +++ b/recipes/bitserializer/config.yml @@ -1,4 +1,10 @@ versions: + "0.70": + folder: "all" + "0.65": + folder: "all" + "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 6d53e1633d5bf..fd5e93d076949 100644 --- a/recipes/bitsery/all/conandata.yml +++ b/recipes/bitsery/all/conandata.yml @@ -1,16 +1,10 @@ sources: + "5.2.4": + url: "https://github.com/fraillt/bitsery/archive/v5.2.4.tar.gz" + sha256: "ff741a3fee5420b31af31c7a8cefbcc3aaaf6f7f8c3ac49aa020f99b21d96020" "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" - "5.2.1": - url: "https://github.com/fraillt/bitsery/archive/v5.2.1.tar.gz" - sha256: "1e2ee66827c55ef82eaf6ef4c87a2c5b3a010dfe6c770eb0feeb3f0c35254d00" - "5.2.0": - url: "https://github.com/fraillt/bitsery/archive/v5.2.0.tar.gz" - sha256: "99f47bca227abb6b9e8030703dcc402ab930ff3bf0a87c89c3f0fb9536cad448" - "5.1.0": - url: "https://github.com/fraillt/bitsery/archive/v5.1.0.tar.gz" - sha256: "8f46667db5d0b62fdaab33612108498bcbcbe9cfa48d2cd220b2129734440a8d" diff --git a/recipes/bitsery/all/conanfile.py b/recipes/bitsery/all/conanfile.py index dd2f676b3757f..26bcf9c123505 100644 --- a/recipes/bitsery/all/conanfile.py +++ b/recipes/bitsery/all/conanfile.py @@ -13,13 +13,17 @@ class BitseryConan(ConanFile): "Header only C++ binary serialization library. It is designed around " "the networking requirements for real-time data delivery, especially for games." ) - topics = ("serialization", "binary", "header-only") + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/fraillt/bitsery" - license = "MIT" + topics = ("serialization", "binary", "header-only") + package_type = "header-library" 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() @@ -27,12 +31,8 @@ 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def build(self): pass @@ -44,11 +44,8 @@ def package(self): def package_info(self): self.cpp_info.set_property("cmake_file_name", "Bitsery") self.cpp_info.set_property("cmake_target_name", "Bitsery::bitsery") - # TODO: back to global scope in conan v2 once cmake_find_package_* generators removed - self.cpp_info.components["bitserylib"].bindirs = [] - self.cpp_info.components["bitserylib"].frameworkdirs = [] - self.cpp_info.components["bitserylib"].libdirs = [] - self.cpp_info.components["bitserylib"].resdirs = [] + 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"] = "Bitsery" @@ -56,3 +53,5 @@ def package_info(self): self.cpp_info.components["bitserylib"].names["cmake_find_package"] = "bitsery" self.cpp_info.components["bitserylib"].names["cmake_find_package_multi"] = "bitsery" self.cpp_info.components["bitserylib"].set_property("cmake_target_name", "Bitsery::bitsery") + self.cpp_info.components["bitserylib"].bindirs = [] + self.cpp_info.components["bitserylib"].libdirs = [] diff --git a/recipes/bitsery/config.yml b/recipes/bitsery/config.yml index 07e67c2710fe5..ef54c243e956f 100644 --- a/recipes/bitsery/config.yml +++ b/recipes/bitsery/config.yml @@ -1,11 +1,7 @@ versions: + "5.2.4": + folder: all "5.2.3": folder: all "5.2.2": folder: all - "5.2.1": - folder: all - "5.2.0": - folder: all - "5.1.0": - folder: all diff --git a/recipes/blaze/all/conandata.yml b/recipes/blaze/all/conandata.yml index a6e5a6aa09753..65e6063976941 100644 --- a/recipes/blaze/all/conandata.yml +++ b/recipes/blaze/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.8.2": + url: "https://bitbucket.org/blaze-lib/blaze/downloads/blaze-3.8.2.tar.gz" + sha256: "4c4e1915971efbedab95790e4c5cf017d8448057fa8f8c62c46e1643bf72cbb1" "3.8": url: "https://bitbucket.org/blaze-lib/blaze/downloads/blaze-3.8.tar.gz" sha256: "dfaae1a3a9fea0b3cc92e78c9858dcc6c93301d59f67de5d388a3a41c8a629ae" diff --git a/recipes/blaze/all/conanfile.py b/recipes/blaze/all/conanfile.py index a5d62edf842a5..576d457372823 100644 --- a/recipes/blaze/all/conanfile.py +++ b/recipes/blaze/all/conanfile.py @@ -12,11 +12,15 @@ class BlazeConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://bitbucket.org/blaze-lib/blaze" description = "open-source, high-performance C++ math library for dense and sparse arithmetic" - topics = ("blaze", "math", "algebra", "linear algebra", "high-performance") + topics = ("math", "algebra", "linear algebra", "high-performance") license = "BSD-3-Clause" + package_type = "header-library" 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 +28,6 @@ def validate(self): if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, 14) - def layout(self): - basic_layout(self, src_folder="src") - def source(self): base_source_dir = os.path.join(self.source_folder, os.pardir) get(self, **self.conan_data["sources"][self.version], @@ -46,6 +47,4 @@ def package_info(self): self.cpp_info.set_property("cmake_file_name", "blaze") self.cpp_info.set_property("cmake_target_name", "blaze::blaze") self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] diff --git a/recipes/blaze/config.yml b/recipes/blaze/config.yml index df754600895a3..7b9eb7695fc4e 100644 --- a/recipes/blaze/config.yml +++ b/recipes/blaze/config.yml @@ -1,4 +1,6 @@ versions: + "3.8.2": + folder: all "3.8": folder: all "3.7": diff --git a/recipes/blend2d/all/conandata.yml b/recipes/blend2d/all/conandata.yml index 6da900cdfb3fd..54dc0ba094e18 100644 --- a/recipes/blend2d/all/conandata.yml +++ b/recipes/blend2d/all/conandata.yml @@ -1,15 +1,55 @@ sources: - "0.0.18": - url: "https://blend2d.com/download/blend2d-beta18.zip" - sha256: "02d23b185183705215241d7b161937bbda5b427c54cc5aa4c03238ef8dd1e60b" - "0.0.17": - url: "https://blend2d.com/download/blend2d-beta17.zip" - sha256: "06ee8fb0bea281d09291e498900093139426501a1a7f09dba0ec801dd340635e" - + "0.11.4": + url: "https://blend2d.com/download/blend2d-0.11.4.tar.gz" + sha256: "07f7d99d2ebb7b42a707a4f0035745b781faf9083933f944084f66e6246bb01c" + "0.11.3": + url: "https://blend2d.com/download/blend2d-0.11.3.tar.gz" + sha256: "6dfb2c0260073f2af6c3dfe6c30a31da637e6facf7802f6b2836cc3c4e74fdd8" + "0.11.1": + url: "https://blend2d.com/download/blend2d-0.11.1.tar.gz" + sha256: "f46d61b6aa477fea1a353a41f5906d4e861817ae059ed22fc6ecdd50ff859dd2" + # When upstream will have new release, tarball may be deleted. + # Use following url: https://github.com/blend2d/blend2d/archive/a7f947677e85441abe1769586d3bb935b4086a07.tar.gz + "0.10.6": + url: "https://github.com/blend2d/blend2d/archive/df124784fd3e9765251c74d412d88c625e3587e9.tar.gz" + sha256: "d8a91745c79beeab29d781357308b49ef51d009237b342ce50304ea618e977ad" + "0.10.5": + url: "https://github.com/blend2d/blend2d/archive/99fc3aa9a1d113e913df67166d40d2a81bef1dcb.tar.gz" + sha256: "cb7426a483156721c02b28cf65969bdeeb13ffed6cf9bc4a9493d7ec4d5de8c3" + "0.10.4": + url: "https://github.com/blend2d/blend2d/archive/d60f62b9d008be096daff329dfe9b8409c344651.tar.gz" + sha256: "ce197422ae8ec0d0310895bebed396091e0144ec09482439d24040196957e740" + "0.10": + url: "https://github.com/blend2d/blend2d/archive/000d55c75994fa88efcb7a31ae32be9ec8435f7d.tar.gz" + sha256: "7a986e14d08d687bfc7510bd762a29f01b1c2449b4e60f85268dd0072c65b698" + "0.9": + url: "https://github.com/blend2d/blend2d/archive/346555924752f085a2a06265858bc63c8987bf98.tar.gz" + sha256: "89639d60320e8d684c3708b849ede9ac660cbd2acc33de6baa846ee7fbed24b8" + "0.8": + url: "https://github.com/blend2d/blend2d/archive/2910c87c5e8ddedcf80bbf4871bb59d70e1170c1.tar.gz" + sha256: "34ff6f0f2dd10b39e1e6a3b07c5f76844b38f780c6849a65a34351e76e36cd3d" patches: - "0.0.18": - - patch_file: "patches/0.0.17-0001-disable-embed-asmjit.patch" - # fix gcc12 compilation error, backport from upstream - - patch_file: "patches/0.0.18-0002-fix-gcc12-compilationerror.patch" - "0.0.17": - - patch_file: "patches/0.0.17-0001-disable-embed-asmjit.patch" + "0.10.6": + - patch_file: "patches/0.10.6-0001-disable-embed-asmjit.patch" + patch_description: "use asmjit cci package" + patch_type: "conan" + "0.10.5": + - patch_file: "patches/0.10-0001-disable-embed-asmjit.patch" + patch_description: "use asmjit cci package" + patch_type: "conan" + "0.10.4": + - patch_file: "patches/0.10-0001-disable-embed-asmjit.patch" + patch_description: "use asmjit cci package" + patch_type: "conan" + "0.10": + - patch_file: "patches/0.10-0001-disable-embed-asmjit.patch" + patch_description: "use asmjit cci package" + patch_type: "conan" + "0.9": + - patch_file: "patches/0.9-0001-disable-embed-asmjit.patch" + patch_description: "use asmjit cci package" + patch_type: "conan" + "0.8": + - patch_file: "patches/0.8-0001-disable-embed-asmjit.patch" + patch_description: "use asmjit cci package" + patch_type: "conan" diff --git a/recipes/blend2d/all/conanfile.py b/recipes/blend2d/all/conanfile.py index e786098393dd3..5663998a64f81 100644 --- a/recipes/blend2d/all/conanfile.py +++ b/recipes/blend2d/all/conanfile.py @@ -2,10 +2,12 @@ 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.scm import Version from conan.tools.microsoft import check_min_vs +from conan.tools.env import VirtualBuildEnv import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class Blend2dConan(ConanFile): @@ -15,14 +17,17 @@ class Blend2dConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://blend2d.com/" topics = ("2d-graphics", "rasterization", "asmjit", "jit") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], + "with_jit": [True, False], } default_options = { "shared": False, "fPIC": True, + "with_jit": True, } def export_sources(self): @@ -34,27 +39,30 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("asmjit/cci.20221111") + if self.options.with_jit: + self.requires("asmjit/cci.20240531") def validate(self): - if self.info.settings.compiler.get_safe("cppstd"): + if self.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 - check_min_vs(self, 192) + if Version(self.version) < "0.8": + # In Visual Studio < 16, there are compilation error. patch is already provided. + # https://github.com/blend2d/blend2d/commit/63db360c7eb2c1c3ca9cd92a867dbb23dc95ca7d + check_min_vs(self, 192) + + def build_requirements(self): + if Version(self.version) >= "0.11.1": + self.tool_requires("cmake/[>=3.18 <4]") 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,14 +72,17 @@ def generate(self): tc.variables["BLEND2D_STATIC"] = not self.options.shared tc.variables["BLEND2D_NO_STDCXX"] = False tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + tc.variables["BLEND2D_EXTERNAL_ASMJIT"] = True if not valid_min_cppstd(self, 11): tc.variables["CMAKE_CXX_STANDARD"] = 11 if not self.options.shared: tc.preprocessor_definitions["BL_STATIC"] = "1" + tc.variables["BLEND2D_NO_JIT"] = not self.options.with_jit tc.generate() - deps = CMakeDeps(self) deps.generate() + venv = VirtualBuildEnv(self) + venv.generate(scope="build") def build(self): apply_conandata_patches(self) diff --git a/recipes/blend2d/all/patches/0.0.17-0001-disable-embed-asmjit.patch b/recipes/blend2d/all/patches/0.0.17-0001-disable-embed-asmjit.patch deleted file mode 100644 index 6a3ccd1e255b1..0000000000000 --- a/recipes/blend2d/all/patches/0.0.17-0001-disable-embed-asmjit.patch +++ /dev/null @@ -1,19 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 52d295a..b1a78a5 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -398,10 +398,10 @@ if (NOT BLEND2D_NO_JIT) - set(ASMJIT_EMBED TRUE CACHE BOOL "") - endif() - -- include("${ASMJIT_DIR}/CMakeLists.txt") -- list(APPEND BLEND2D_DEPS ${ASMJIT_LIBS}) -- list(APPEND BLEND2D_PRIVATE_CFLAGS ${ASMJIT_CFLAGS}) -- list(APPEND BLEND2D_PRIVATE_CFLAGS -DASMJIT_NO_STDCXX) -+ find_package(asmjit CONFIG REQUIRED) -+ list(APPEND BLEND2D_DEPS asmjit::asmjit) -+ list(APPEND BLEND2D_PRIVATE_CFLAGS ${asmjit_DEFINITIONS_DEBUG}${asmjit_DEFINITIONS_RELEASE}) -+ - - # A possibility to reduce the resulting binary size by disabling asmjit logging. - if (BLEND2D_NO_JIT_LOGGING) diff --git a/recipes/blend2d/all/patches/0.0.18-0002-fix-gcc12-compilationerror.patch b/recipes/blend2d/all/patches/0.0.18-0002-fix-gcc12-compilationerror.patch deleted file mode 100644 index b089c5a2e867f..0000000000000 --- a/recipes/blend2d/all/patches/0.0.18-0002-fix-gcc12-compilationerror.patch +++ /dev/null @@ -1,39 +0,0 @@ -diff --git a/src/blend2d/support/arenaallocator_p.h b/src/blend2d/support/arenaallocator_p.h -index d09b6da..eebd854 100644 ---- a/src/blend2d/support/arenaallocator_p.h -+++ b/src/blend2d/support/arenaallocator_p.h -@@ -445,7 +445,7 @@ public: - template - class BLArenaAllocatorTmp : public BLArenaAllocator { - public: -- BL_NONCOPYABLE(BLArenaAllocatorTmp) -+ BL_NONCOPYABLE(BLArenaAllocatorTmp) - - BL_INLINE explicit BLArenaAllocatorTmp(size_t blockSize, size_t blockAlignment = 1) noexcept - : BLArenaAllocator(blockSize, blockAlignment, _storage.data, N) {} -diff --git a/src/blend2d/support/arenahashmap_p.h b/src/blend2d/support/arenahashmap_p.h -index 29882e1..911d985 100644 ---- a/src/blend2d/support/arenahashmap_p.h -+++ b/src/blend2d/support/arenahashmap_p.h -@@ -185,7 +185,7 @@ public: - template - class BLArenaHashMap : public BLArenaHashMapBase { - public: -- BL_NONCOPYABLE(BLArenaHashMap) -+ BL_NONCOPYABLE(BLArenaHashMap) - - typedef NodeT Node; - -diff --git a/src/blend2d/support/scopedbuffer_p.h b/src/blend2d/support/scopedbuffer_p.h -index e14df50..379f519 100644 ---- a/src/blend2d/support/scopedbuffer_p.h -+++ b/src/blend2d/support/scopedbuffer_p.h -@@ -82,7 +82,7 @@ public: - template - class BLScopedBufferTmp : public BLScopedBuffer { - public: -- BL_NONCOPYABLE(BLScopedBufferTmp) -+ BL_NONCOPYABLE(BLScopedBufferTmp) - - uint8_t _storage[N]; - diff --git a/recipes/blend2d/all/patches/0.10-0001-disable-embed-asmjit.patch b/recipes/blend2d/all/patches/0.10-0001-disable-embed-asmjit.patch new file mode 100644 index 0000000000000..29e6457e6c6f5 --- /dev/null +++ b/recipes/blend2d/all/patches/0.10-0001-disable-embed-asmjit.patch @@ -0,0 +1,27 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 02507bc..8fa7dcf 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -392,7 +392,7 @@ endif() + + # Find asmjit dependency if building with JIT support. + if (NOT BLEND2D_NO_JIT) +- if (NOT DEFINED ASMJIT_DIR) ++ if (0) + foreach(dir "${BLEND2D_DIR}/3rdparty/asmjit" + "${CMAKE_CURRENT_LIST_DIR}/../asmjit") + if (EXISTS ${dir}/CMakeLists.txt) +@@ -410,10 +410,9 @@ if (NOT BLEND2D_NO_JIT) + endif() + + set(ASMJIT_NO_FOREIGN TRUE) +- include("${ASMJIT_DIR}/CMakeLists.txt") +- list(APPEND BLEND2D_DEPS ${ASMJIT_LIBS}) +- list(APPEND BLEND2D_PRIVATE_CFLAGS ${ASMJIT_CFLAGS}) +- list(APPEND BLEND2D_PRIVATE_CFLAGS -DASMJIT_NO_STDCXX) ++ find_package(asmjit CONFIG REQUIRED) ++ list(APPEND BLEND2D_DEPS asmjit::asmjit) ++ list(APPEND BLEND2D_PRIVATE_CFLAGS ${asmjit_DEFINITIONS_DEBUG}${asmjit_DEFINITIONS_RELEASE}) + + # A possibility to reduce the resulting binary size by disabling asmjit logging. + if (BLEND2D_NO_JIT_LOGGING) diff --git a/recipes/blend2d/all/patches/0.10.6-0001-disable-embed-asmjit.patch b/recipes/blend2d/all/patches/0.10.6-0001-disable-embed-asmjit.patch new file mode 100644 index 0000000000000..fb535df020d2b --- /dev/null +++ b/recipes/blend2d/all/patches/0.10.6-0001-disable-embed-asmjit.patch @@ -0,0 +1,29 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index ea49ca0..24532fe 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -392,7 +392,7 @@ endif() + + # Find asmjit dependency if building with JIT support. + if (NOT BLEND2D_NO_JIT) +- if (NOT DEFINED ASMJIT_DIR) ++ if (0) + foreach(dir "${BLEND2D_DIR}/3rdparty/asmjit" + "${CMAKE_CURRENT_LIST_DIR}/../asmjit") + if (EXISTS ${dir}/CMakeLists.txt) +@@ -409,11 +409,10 @@ if (NOT BLEND2D_NO_JIT) + set(ASMJIT_EMBED TRUE CACHE BOOL "") + endif() + +- include("${ASMJIT_DIR}/CMakeLists.txt") +- list(APPEND BLEND2D_DEPS ${ASMJIT_LIBS}) +- list(APPEND BLEND2D_PRIVATE_CFLAGS ${ASMJIT_CFLAGS}) +- list(APPEND BLEND2D_PRIVATE_CFLAGS -DASMJIT_NO_STDCXX -DASMJIT_NO_FOREIGN) +- ++ find_package(asmjit CONFIG REQUIRED) ++ list(APPEND BLEND2D_DEPS asmjit::asmjit) ++ list(APPEND BLEND2D_PRIVATE_CFLAGS ${asmjit_DEFINITIONS_DEBUG}${asmjit_DEFINITIONS_RELEASE}) ++ + # A possibility to reduce the resulting binary size by disabling asmjit logging. + if (BLEND2D_NO_JIT_LOGGING) + message("-- Disabling AsmJit logging functionality (JIT)") diff --git a/recipes/blend2d/all/patches/0.8-0001-disable-embed-asmjit.patch b/recipes/blend2d/all/patches/0.8-0001-disable-embed-asmjit.patch new file mode 100644 index 0000000000000..94ad4abda7f9c --- /dev/null +++ b/recipes/blend2d/all/patches/0.8-0001-disable-embed-asmjit.patch @@ -0,0 +1,27 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 47e4926..98c53f5 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -392,7 +392,7 @@ endif() + + # Find asmjit dependency if building with JIT support. + if (NOT BLEND2D_NO_JIT) +- if (NOT DEFINED ASMJIT_DIR) ++ if (0) + foreach(dir "${BLEND2D_DIR}/3rdparty/asmjit" + "${CMAKE_CURRENT_LIST_DIR}/../asmjit") + if (EXISTS ${dir}/CMakeLists.txt) +@@ -409,10 +409,9 @@ if (NOT BLEND2D_NO_JIT) + set(ASMJIT_EMBED TRUE CACHE BOOL "") + endif() + +- include("${ASMJIT_DIR}/CMakeLists.txt") +- list(APPEND BLEND2D_DEPS ${ASMJIT_LIBS}) +- list(APPEND BLEND2D_PRIVATE_CFLAGS ${ASMJIT_CFLAGS}) +- list(APPEND BLEND2D_PRIVATE_CFLAGS -DASMJIT_NO_STDCXX) ++ find_package(asmjit CONFIG REQUIRED) ++ list(APPEND BLEND2D_DEPS asmjit::asmjit) ++ list(APPEND BLEND2D_PRIVATE_CFLAGS ${asmjit_DEFINITIONS_DEBUG}${asmjit_DEFINITIONS_RELEASE}) + + # A possibility to reduce the resulting binary size by disabling asmjit logging. + if (BLEND2D_NO_JIT_LOGGING) diff --git a/recipes/blend2d/all/patches/0.9-0001-disable-embed-asmjit.patch b/recipes/blend2d/all/patches/0.9-0001-disable-embed-asmjit.patch new file mode 100644 index 0000000000000..71daec98e5e7e --- /dev/null +++ b/recipes/blend2d/all/patches/0.9-0001-disable-embed-asmjit.patch @@ -0,0 +1,27 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 77c74eb..80d7bb0 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -395,7 +395,7 @@ endif() + + # Find asmjit dependency if building with JIT support. + if (NOT BLEND2D_NO_JIT) +- if (NOT DEFINED ASMJIT_DIR) ++ if (0) + foreach(dir "${BLEND2D_DIR}/3rdparty/asmjit" + "${CMAKE_CURRENT_LIST_DIR}/../asmjit") + if (EXISTS ${dir}/CMakeLists.txt) +@@ -413,10 +413,9 @@ if (NOT BLEND2D_NO_JIT) + endif() + + set(ASMJIT_NO_FOREIGN TRUE) +- include("${ASMJIT_DIR}/CMakeLists.txt") +- list(APPEND BLEND2D_DEPS ${ASMJIT_LIBS}) +- list(APPEND BLEND2D_PRIVATE_CFLAGS ${ASMJIT_CFLAGS}) +- list(APPEND BLEND2D_PRIVATE_CFLAGS -DASMJIT_NO_STDCXX) ++ find_package(asmjit CONFIG REQUIRED) ++ list(APPEND BLEND2D_DEPS asmjit::asmjit) ++ list(APPEND BLEND2D_PRIVATE_CFLAGS ${asmjit_DEFINITIONS_DEBUG}${asmjit_DEFINITIONS_RELEASE}) + + # A possibility to reduce the resulting binary size by disabling asmjit logging. + if (BLEND2D_NO_JIT_LOGGING) diff --git a/recipes/blend2d/config.yml b/recipes/blend2d/config.yml index dfbc91823fb6c..b62e83e2e1cd2 100644 --- a/recipes/blend2d/config.yml +++ b/recipes/blend2d/config.yml @@ -1,5 +1,19 @@ versions: - "0.0.18": + "0.11.4": folder: all - "0.0.17": + "0.11.3": + folder: all + "0.11.1": + folder: all + "0.10.6": + folder: all + "0.10.5": + folder: all + "0.10.4": + folder: all + "0.10": + folder: all + "0.9": + folder: all + "0.8": folder: all diff --git a/recipes/bliss/all/CMakeLists.txt b/recipes/bliss/all/CMakeLists.txt deleted file mode 100644 index 8bdaa1e47bfa0..0000000000000 --- a/recipes/bliss/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.5) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/bliss/all/conandata.yml b/recipes/bliss/all/conandata.yml index 9472225934cbd..f309295ccece6 100644 --- a/recipes/bliss/all/conandata.yml +++ b/recipes/bliss/all/conandata.yml @@ -5,6 +5,4 @@ sources: patches: "0.77": - patch_file: "patches/0001-fix-cmake.patch" - base_path: "source_subfolder" - patch_file: "patches/0002-no-assert-non-existent-member-variable.patch" - base_path: "source_subfolder" diff --git a/recipes/bliss/all/conanfile.py b/recipes/bliss/all/conanfile.py index 5a7032f515942..620c98547a190 100644 --- a/recipes/bliss/all/conanfile.py +++ b/recipes/bliss/all/conanfile.py @@ -1,18 +1,22 @@ -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, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get +from conan.tools.microsoft import check_min_vs, is_msvc import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.55.0" class BlissConan(ConanFile): name = "bliss" - description = "bliss is an open source tool for computing automorphism groups and canonical forms of graphs. " - topics = "conan", "bliss", "automorphism", "group", "graph" + description = "bliss is an open source tool for computing automorphism groups and canonical forms of graphs." + topics = ("automorphism", "group", "graph") url = "https://github.com/conan-io/conan-center-index" homepage = "https://users.aalto.fi/~tjunttil/bliss" license = "GPL-3-or-later", "LGPL-3-or-later" - settings = "arch", "os", "compiler", "build_type" + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -23,18 +27,9 @@ class BlissConan(ConanFile): "fPIC": True, "with_exact_int": False, } - 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": @@ -42,54 +37,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): if self.options.with_exact_int == "gmp": - self.requires("gmp/6.2.0") + # gmp is fully transitive through bignum.hh public header of bliss + self.requires("gmp/6.2.1", transitive_headers=True, transitive_libs=True) elif self.options.with_exact_int == "mpir": - self.requires("mpir/3.0.0") + self.requires("mpir/3.0.0", transitive_headers=True, transitive_libs=True) def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) - if self.settings.compiler == "Visual Studio" and tools.Version(self.settings.compiler.version) < "15": - raise ConanInvalidConfiguration("bliss doesn't support Visual Studio < 2017") + check_min_cppstd(self, 11) + check_min_vs(self, "191") 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_GMP"] = self.options.with_exact_int != False - 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["USE_GMP"] = self.options.with_exact_int != False + tc.generate() + if bool(self.options.with_exact_int): + deps = CMakeDeps(self) + deps.set_property(self.options.with_exact_int, "cmake_file_name", "gmp") + deps.set_property(self.options.with_exact_int, "cmake_target_name", "gmp::gmp") + 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) - self.copy("COPYING.LESSER", 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")) + copy(self, "COPYING.LESSER", 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 = ["bliss" if self.options.shared else "bliss_static"] self.cpp_info.includedirs.append(os.path.join("include", "bliss")) - if self.options.with_exact_int != False: + if bool(self.options.with_exact_int): self.cpp_info.defines = ["BLISS_USE_GMP"] - if self.settings.compiler == "Visual Studio": + if is_msvc(self): self.cpp_info.cxxflags.append("/permissive-") + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") - 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/bliss/all/patches/0001-fix-cmake.patch b/recipes/bliss/all/patches/0001-fix-cmake.patch index 2831deda49096..54dd5109f3444 100644 --- a/recipes/bliss/all/patches/0001-fix-cmake.patch +++ b/recipes/bliss/all/patches/0001-fix-cmake.patch @@ -1,6 +1,6 @@ --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -14,17 +14,11 @@ if (MSVC) +@@ -14,17 +14,12 @@ if (MSVC) add_compile_options(/permissive-) else() # Warnings, optimization, no assertions @@ -15,7 +15,8 @@ - else() - add_compile_options(-DBLISS_USE_GMP -I${GMP_INCLUDE_DIR}) - endif() -+ link_libraries(${CONAN_LIBS}) ++ find_package(gmp REQUIRED CONFIG) ++ link_libraries(gmp::gmp) + add_definitions(-DBLISS_USE_GMP) endif(USE_GMP) diff --git a/recipes/bliss/all/test_package/CMakeLists.txt b/recipes/bliss/all/test_package/CMakeLists.txt index 33ae887aa6aea..7ec1e7802e63f 100644 --- a/recipes/bliss/all/test_package/CMakeLists.txt +++ b/recipes/bliss/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(bliss 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 bliss::bliss) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/bliss/all/test_package/conanfile.py b/recipes/bliss/all/test_package/conanfile.py index 0cbaf1abc2c91..ff0f98fff8256 100644 --- a/recipes/bliss/all/test_package/conanfile.py +++ b/recipes/bliss/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, run=can_run(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, skip_x64_x86=True): - self.run("bliss {}".format(os.path.join(self.source_folder, "graph.cnf")), run_environment=True) - - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + cnf_file = os.path.join(self.source_folder, "graph.cnf") + self.run(f"bliss {cnf_file}", env="conanrun") + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/bliss/all/test_v1_package/CMakeLists.txt b/recipes/bliss/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/bliss/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/bliss/all/test_v1_package/conanfile.py b/recipes/bliss/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..44c5939c51bc9 --- /dev/null +++ b/recipes/bliss/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): + cnf_file = os.path.join(self.source_folder, os.pardir, "test_package", "graph.cnf") + self.run(f"bliss {cnf_file}", run_environment=True) + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/bmx/all/conandata.yml b/recipes/bmx/all/conandata.yml new file mode 100644 index 0000000000000..d1ad7a1faab9b --- /dev/null +++ b/recipes/bmx/all/conandata.yml @@ -0,0 +1,20 @@ +sources: + "1.3": + url: "https://github.com/bbc/bmx/releases/download/v1.3/bmx-1.3.tar.gz" + sha256: "c20cd34f201510affe62c079c7f9079a10dce3a44d7f61b21f9faff624fdaeab" + "1.2": + url: "https://github.com/bbc/bmx/archive/refs/tags/v1.2.tar.gz" + sha256: "e64d91b2d27478d6b892d72183e1ecf79c99880b079ce04442432f3caed1e259" +patches: + "1.3": + - patch_file: "patches/1.3-cmake-fixes.patch" + patch_description: "Ensure project builds correctly with Conan (don't pick up disabled dependencies from the system, fix different spelling of libraries)" + patch_type: "conan" + "1.2": + - patch_file: "patches/1.2-cmake-fixes.patch" + patch_description: "Ensure project builds correctly with Conan (don't pick up disabled dependencies from the system, fix different spelling of libraries)" + patch_type: "conan" + - patch_file: "patches/1.2-fix-cpp20.patch" + patch_description: "Fix a compilation problem with C++20" + patch_type: "portability" + patch_source: "https://github.com/bbc/bmx/pull/69" diff --git a/recipes/bmx/all/conanfile.py b/recipes/bmx/all/conanfile.py new file mode 100644 index 0000000000000..2a7415f432502 --- /dev/null +++ b/recipes/bmx/all/conanfile.py @@ -0,0 +1,140 @@ +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, export_conandata_patches, copy, get, rmdir +import os + +required_conan_version = ">=1.53.0" + + +class BmxConan(ConanFile): + name = "bmx" + description = ( + "Library for handling broadcast/production oriented media file formats. " + "Allows reading, modifying and writing media metadata and file essences." + ) + topics = ("vfx", "image", "picture", "video", "multimedia", "mxf") + license = "BSD-3-Clause" + homepage = "https://github.com/bbc/bmx" + url = "https://github.com/conan-io/conan-center-index" + + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_libcurl": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_libcurl": 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): + # Required libraries + self.requires("uriparser/0.9.8") + self.requires("expat/[>=2.6.2 <3]") + + if not (self.settings.os == 'Windows' or self.settings.os == 'Macos'): + self.requires('libuuid/1.0.3') + + # Configuration dependent requirements + if self.options.with_libcurl: + self.requires("libcurl/[>=7.78.0 <9]") + + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, 11) + + # Symbol export is currently not working properly on Windows so shared + # libraries are currently deactivated. This can later be revisited based + # on https://github.com/bbc/bmx/issues/80 + if self.settings.os == "Windows" and self.options.shared: + raise ConanInvalidConfiguration( + "Building as a shared library currently not supported on Windows!" + ) + + 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["BMX_BUILD_WITH_LIBCURL"] = self.options.with_libcurl + tc.generate() + + cd = CMakeDeps(self) + cd.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, "lib", "pkgconfig")) + + @staticmethod + def _conan_comp(name): + return f"bmx_{name.lower()}" + + def _add_component(self, name): + component = self.cpp_info.components[self._conan_comp(name)] + component.set_property("cmake_target_name", f"bmx::{name}") + component.names["cmake_find_package"] = name + component.names["cmake_find_package_multi"] = name + return component + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "bmx") + self.cpp_info.set_property("pkg_config_name", "bmx") + + self.cpp_info.names["cmake_find_package"] = "bmx" + self.cpp_info.names["cmake_find_package_multi"] = "bmx" + + # bbc-bmx::MXF + libmxf = self._add_component("MXF") + libmxf.libs = ["MXF"] + libmxf.requires = [] + if not (self.settings.os == 'Windows' or self.settings.os == 'Macos'): + libmxf.requires.append("libuuid::libuuid") + + # bbc-bmx::MXF++ + libmxfpp = self._add_component("MXF++") + libmxfpp.libs = ["MXF++"] + libmxfpp.requires = [ + "bmx_mxf" + ] + + # bbc-bmx::bmx + libbmx = self._add_component("bmx") + libbmx.libs = ["bmx"] + libbmx.requires = [ + "bmx_mxf", + "bmx_mxf++", + "expat::expat", + "uriparser::uriparser", + ] + if not (self.settings.os == 'Windows' or self.settings.os == 'Macos'): + libbmx.requires.append("libuuid::libuuid") + + if self.options.with_libcurl: + libbmx.requires.append("libcurl::libcurl") diff --git a/recipes/bmx/all/patches/1.2-cmake-fixes.patch b/recipes/bmx/all/patches/1.2-cmake-fixes.patch new file mode 100644 index 0000000000000..29a8742dbedbb --- /dev/null +++ b/recipes/bmx/all/patches/1.2-cmake-fixes.patch @@ -0,0 +1,141 @@ +diff --git CMakeLists.txt CMakeLists.txt +index 6fe9540e7..8b2578852 100644 +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -34,7 +34,7 @@ if(BUILD_SHARED_LIBS OR NOT DEFINED CMAKE_POSITION_INDEPENDENT_CODE) + set(CMAKE_POSITION_INDEPENDENT_CODE ON) + endif() + +-set(CMAKE_CXX_STANDARD 11) ++#set(CMAKE_CXX_STANDARD 11) + + # Set the test samples output directory + if(BMX_TEST_SAMPLES_DIR STREQUAL "") +@@ -75,7 +75,7 @@ if(MSVC) + endforeach() + endif() + else() +- add_compile_options(-W -Wall -O2) ++ add_compile_options(-W -Wall) + + # Enable large file support on 32-bit systems. + add_definitions( +@@ -93,11 +93,25 @@ add_custom_target(bmx_test_data) + + include("${PROJECT_SOURCE_DIR}/cmake/libmxf.cmake") + include("${PROJECT_SOURCE_DIR}/cmake/libmxfpp.cmake") +-include("${PROJECT_SOURCE_DIR}/cmake/ext_uuid.cmake") +-include("${PROJECT_SOURCE_DIR}/cmake/ext_expat.cmake") +-include("${PROJECT_SOURCE_DIR}/cmake/ext_uriparser.cmake") ++#include("${PROJECT_SOURCE_DIR}/cmake/ext_uuid.cmake") ++#include("${PROJECT_SOURCE_DIR}/cmake/ext_expat.cmake") ++#include("${PROJECT_SOURCE_DIR}/cmake/ext_uriparser.cmake") ++#if(BMX_BUILD_WITH_LIBCURL) ++# include("${PROJECT_SOURCE_DIR}/cmake/ext_libcurl.cmake") ++#endif() ++ ++find_package(expat REQUIRED) ++find_package(uriparser REQUIRED) ++if(UNIX AND NOT APPLE) ++ find_package(libuuid REQUIRED) ++ set(uuid_link_lib libuuid::libuuid) ++else() ++ # MSVC: "ole" will already be linked in ++ # APPLE: doesn't require uuid library ++ set(uuid_link_lib) ++endif() + if(BMX_BUILD_WITH_LIBCURL) +- include("${PROJECT_SOURCE_DIR}/cmake/ext_libcurl.cmake") ++ find_package(CURL REQUIRED) + endif() + + configure_file(config.h.in config.h) +diff --git deps/libMXF/CMakeLists.txt deps/libMXF/CMakeLists.txt +index d36fde6c0..6a1af100b 100644 +--- deps/libMXF/CMakeLists.txt ++++ deps/libMXF/CMakeLists.txt +@@ -35,7 +35,7 @@ if(BUILD_SHARED_LIBS OR NOT DEFINED CMAKE_POSITION_INDEPENDENT_CODE) + set(CMAKE_POSITION_INDEPENDENT_CODE ON) + endif() + +-set(CMAKE_CXX_STANDARD 11) ++#set(CMAKE_CXX_STANDARD 11) + + # Set the test samples output directory + if(LIBMXF_TEST_SAMPLES_DIR STREQUAL "") +@@ -76,7 +76,7 @@ if(MSVC) + endforeach() + endif() + else() +- add_compile_options(-W -Wall -O2) ++ add_compile_options(-W -Wall) + + # Enable large file support on 32-bit systems. + add_definitions( +diff --git deps/libMXFpp/CMakeLists.txt deps/libMXFpp/CMakeLists.txt +index 2272a2709..924fdf770 100644 +--- deps/libMXFpp/CMakeLists.txt ++++ deps/libMXFpp/CMakeLists.txt +@@ -35,7 +35,7 @@ if(BUILD_SHARED_LIBS OR NOT DEFINED CMAKE_POSITION_INDEPENDENT_CODE) + set(CMAKE_POSITION_INDEPENDENT_CODE ON) + endif() + +-set(CMAKE_CXX_STANDARD 11) ++#set(CMAKE_CXX_STANDARD 11) + + if(MSVC) + add_compile_options(/W3 /EHsc) +@@ -61,7 +61,7 @@ if(MSVC) + endforeach() + endif() + else() +- add_compile_options(-W -Wall -O2) ++ add_compile_options(-W -Wall) + + # Enable large file support on 32-bit systems. + add_definitions( +diff --git deps/libMXFpp/libMXF++/CMakeLists.txt deps/libMXFpp/libMXF++/CMakeLists.txt +index 94d48c905..e6c6a63f9 100644 +--- deps/libMXFpp/libMXF++/CMakeLists.txt ++++ deps/libMXFpp/libMXF++/CMakeLists.txt +@@ -32,6 +32,8 @@ add_library(MXFpp + ${MXFpp_sources} + ) + ++target_compile_features(MXFpp PUBLIC cxx_std_11) ++ + target_include_directories(MXFpp PUBLIC + ${PROJECT_SOURCE_DIR} + ) +diff --git src/CMakeLists.txt src/CMakeLists.txt +index 1c0824d8a..94f9c00d6 100644 +--- src/CMakeLists.txt ++++ src/CMakeLists.txt +@@ -26,6 +26,8 @@ target_include_directories(bmx PUBLIC + ${PROJECT_SOURCE_DIR}/include + ) + ++target_compile_features(bmx PUBLIC cxx_std_11) ++ + # Add path to header files if not included in MSVC distribution + if(MSVC) + include(CheckIncludeFile) +@@ -65,13 +67,14 @@ target_link_libraries(bmx + ${MXFpp_link_lib} + PRIVATE + ${uuid_link_lib} +- ${expat_link_lib} +- ${uriparser_link_lib} ++ expat::expat ++ uriparser::uriparser + ) + + if(BMX_BUILD_WITH_LIBCURL) +- target_link_libraries(bmx PRIVATE +- ${libcurl_link_lib} ++ # Linking public to see if the shared library for curls dependencies correctly link ++ target_link_libraries(bmx PUBLIC ++ CURL::libcurl + ) + endif() + diff --git a/recipes/bmx/all/patches/1.2-fix-cpp20.patch b/recipes/bmx/all/patches/1.2-fix-cpp20.patch new file mode 100644 index 0000000000000..862806a6a30d2 --- /dev/null +++ b/recipes/bmx/all/patches/1.2-fix-cpp20.patch @@ -0,0 +1,26 @@ +diff --git deps/libMXFpp/libMXF++/MXFVersion.cpp deps/libMXFpp/libMXF++/MXFVersion.cpp +index 333d5871..bb247a32 100644 +--- deps/libMXFpp/libMXF++/MXFVersion.cpp ++++ deps/libMXFpp/libMXF++/MXFVersion.cpp +@@ -33,6 +33,8 @@ + #include "config.h" + #endif + ++#include ++ + #include "git.h" + #include "fallback_git_version.h" + +diff --git src/common/Version.cpp src/common/Version.cpp +index a4f00e14..d51da64a 100644 +--- src/common/Version.cpp ++++ src/common/Version.cpp +@@ -219,7 +219,7 @@ mxfProductVersion bmx::get_bmx_mxf_product_version() + // Set the patch version value to the commit offset from the release tag. + // The commit offset is part of the git describe tag string which has the + // format "--g" +- string describe = bmx_git::DescribeTag(); ++ string describe = std::string(bmx_git::DescribeTag()); + #ifdef PACKAGE_GIT_VERSION_STRING + if (describe.empty() || describe == "unknown") + describe = PACKAGE_GIT_VERSION_STRING; diff --git a/recipes/bmx/all/patches/1.3-cmake-fixes.patch b/recipes/bmx/all/patches/1.3-cmake-fixes.patch new file mode 100644 index 0000000000000..51915e0cc5aa0 --- /dev/null +++ b/recipes/bmx/all/patches/1.3-cmake-fixes.patch @@ -0,0 +1,57 @@ +diff --git CMakeLists.txt CMakeLists.txt +index 3139ef78e..a08fbb589 100644 +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -91,11 +91,26 @@ add_custom_target(bmx_test_data) + + include("${PROJECT_SOURCE_DIR}/cmake/libmxf.cmake") + include("${PROJECT_SOURCE_DIR}/cmake/libmxfpp.cmake") +-include("${PROJECT_SOURCE_DIR}/cmake/ext_uuid.cmake") +-include("${PROJECT_SOURCE_DIR}/cmake/ext_expat.cmake") +-include("${PROJECT_SOURCE_DIR}/cmake/ext_uriparser.cmake") ++#include("${PROJECT_SOURCE_DIR}/cmake/ext_uuid.cmake") ++#include("${PROJECT_SOURCE_DIR}/cmake/ext_expat.cmake") ++#include("${PROJECT_SOURCE_DIR}/cmake/ext_uriparser.cmake") ++#if(BMX_BUILD_WITH_LIBCURL) ++# include("${PROJECT_SOURCE_DIR}/cmake/ext_libcurl.cmake") ++#endif() ++ ++find_package(expat REQUIRED) ++find_package(uriparser REQUIRED) ++if(UNIX AND NOT APPLE) ++ find_package(libuuid REQUIRED) ++ set(uuid_link_lib libuuid::libuuid) ++else() ++ # MSVC: "ole" will already be linked in ++ # APPLE: doesn't require uuid library ++ set(uuid_link_lib) ++endif() + if(BMX_BUILD_WITH_LIBCURL) + include("${PROJECT_SOURCE_DIR}/cmake/ext_libcurl.cmake") ++ find_package(CURL REQUIRED) + endif() + + configure_file(config.h.in config.h) +diff --git src/CMakeLists.txt src/CMakeLists.txt +index 59c94b8b9..94f9c00d6 100644 +--- src/CMakeLists.txt ++++ src/CMakeLists.txt +@@ -67,13 +67,14 @@ target_link_libraries(bmx + ${MXFpp_link_lib} + PRIVATE + ${uuid_link_lib} +- ${expat_link_lib} +- ${uriparser_link_lib} ++ expat::expat ++ uriparser::uriparser + ) + + if(BMX_BUILD_WITH_LIBCURL) +- target_link_libraries(bmx PRIVATE +- ${libcurl_link_lib} ++ # Linking public to see if the shared library for curls dependencies correctly link ++ target_link_libraries(bmx PUBLIC ++ CURL::libcurl + ) + endif() + diff --git a/recipes/bmx/all/test_package/CMakeLists.txt b/recipes/bmx/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..e178912ec45f8 --- /dev/null +++ b/recipes/bmx/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(bmx REQUIRED) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_11) +target_link_libraries(${PROJECT_NAME} PRIVATE bmx::bmx) diff --git a/recipes/bmx/all/test_package/conanfile.py b/recipes/bmx/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fb96656f203 --- /dev/null +++ b/recipes/bmx/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/bmx/all/test_package/test_package.cpp b/recipes/bmx/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..708a858acfc27 --- /dev/null +++ b/recipes/bmx/all/test_package/test_package.cpp @@ -0,0 +1,14 @@ +#include +#include + +#include + +int main() { + std::cout << bmx::get_bmx_library_name() << " library version " << bmx::get_bmx_version_string() << std::endl; + + const auto mxf_version = mxf_get_version(); + std::cout << "MXF library version " + << mxf_version->major << '.' << mxf_version->minor << '.' << mxf_version->patch << std::endl; + + return 0; +} diff --git a/recipes/bmx/config.yml b/recipes/bmx/config.yml new file mode 100644 index 0000000000000..81d0457bb64a7 --- /dev/null +++ b/recipes/bmx/config.yml @@ -0,0 +1,5 @@ +versions: + "1.3": + folder: all + "1.2": + folder: all diff --git a/recipes/boolean-lite/all/conanfile.py b/recipes/boolean-lite/all/conanfile.py index 312d87af87164..d7d42e0dd8b35 100644 --- a/recipes/boolean-lite/all/conanfile.py +++ b/recipes/boolean-lite/all/conanfile.py @@ -11,20 +11,20 @@ class BooleanLiteConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/martinmoene/boolean-lite" description = "boolean lite - A strong boolean type for C++98 and later in a single-file header-only library" - topics = ("boolean-lite", "strong bool", "cpp98/11/17") + topics = ("strong bool", "cpp98/11/17") license = "BSL-1.0" + package_type = "header-library" 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 @@ -37,9 +37,7 @@ def package_info(self): self.cpp_info.set_property("cmake_file_name", "boolean-lite") self.cpp_info.set_property("cmake_target_name", "nonstd::boolean-lite") 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"] = "boolean-lite" @@ -49,3 +47,5 @@ def package_info(self): self.cpp_info.components["booleanlite"].names["cmake_find_package"] = "boolean-lite" self.cpp_info.components["booleanlite"].names["cmake_find_package_multi"] = "boolean-lite" self.cpp_info.components["booleanlite"].set_property("cmake_target_name", "nonstd::boolean-lite") + self.cpp_info.components["booleanlite"].bindirs = [] + self.cpp_info.components["booleanlite"].libdirs = [] diff --git a/recipes/boolinq/all/conanfile.py b/recipes/boolinq/all/conanfile.py index b9eaad3c63e47..6aee6c7437722 100644 --- a/recipes/boolinq/all/conanfile.py +++ b/recipes/boolinq/all/conanfile.py @@ -10,13 +10,17 @@ class BoolinqConan(ConanFile): name = "boolinq" description = "Super tiny C++11 single-file header-only LINQ template library" - topics = ("boolinq", "linq", "header-only") + topics = ("linq", "header-only") license = "MIT" homepage = "https://github.com/k06a/boolinq" url = "https://github.com/conan-io/conan-center-index" + package_type = "header-library" 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,12 +28,8 @@ 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def build(self): pass @@ -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/boost-ext-ut/all/conandata.yml b/recipes/boost-ext-ut/all/conandata.yml index 81ce02efd2b42..81761a3dd0a75 100644 --- a/recipes/boost-ext-ut/all/conandata.yml +++ b/recipes/boost-ext-ut/all/conandata.yml @@ -1,12 +1,21 @@ sources: - "1.1.8": - url: "https://github.com/boost-ext/ut/archive/v1.1.8.tar.gz" - sha256: "3cc426dcf38397637e889efd9567b06d55dd23fb4e65cc0381eb8103a411d104" + "2.1.0": + url: "https://github.com/boost-ext/ut/archive/v2.1.0.tar.gz" + sha256: "1c9c35c039ad3a9795a278447db6da0a4ec1a1d223bf7d64687ad28f673b7ae8" + "2.0.1": + url: "https://github.com/boost-ext/ut/archive/v2.0.1.tar.gz" + sha256: "1e43be17045a881c95cedc843d72fe9c1e53239b02ed179c1e39e041ebcd7dad" + "2.0.0": + url: "https://github.com/boost-ext/ut/archive/v2.0.0.tar.gz" + sha256: "8b5b11197d1308dfc1fe20efd6a656e0c833dbec2807e2292967f6e2f7c0420f" "1.1.9": url: "https://github.com/boost-ext/ut/archive/v1.1.9.tar.gz" sha256: "1a666513157905aa0e53a13fac602b5673dcafb04a869100a85cd3f000c2ed0d" -patches: "1.1.8": - - patch_file: "patches/license.patch" + url: "https://github.com/boost-ext/ut/archive/v1.1.8.tar.gz" + sha256: "3cc426dcf38397637e889efd9567b06d55dd23fb4e65cc0381eb8103a411d104" +patches: "1.1.9": - patch_file: "patches/1.1.9_cmake_project_version.patch" + "1.1.8": + - patch_file: "patches/license.patch" diff --git a/recipes/boost-ext-ut/all/conanfile.py b/recipes/boost-ext-ut/all/conanfile.py index bce6579a06de7..87082efe83c5e 100644 --- a/recipes/boost-ext-ut/all/conanfile.py +++ b/recipes/boost-ext-ut/all/conanfile.py @@ -3,8 +3,9 @@ from conan import ConanFile from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, cmake_layout, CMakeToolchain +from conan.tools.env import VirtualBuildEnv 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.microsoft import is_msvc from conan.tools.scm import Version from conan.errors import ConanInvalidConfiguration @@ -31,9 +32,11 @@ def _minimum_cpp_standard(self): @property def _minimum_compilers_version(self): return { - "apple-clang": "11" if Version(self.version) < "1.1.8" else "12", - "clang": "9", - "gcc": "9", + "apple-clang": "12" if Version(self.version) < "2.0.0" else "14", + "clang": "9" if Version(self.version) < "2.0.0" else "10", + "gcc": "9" if Version(self.version) < "2.0.0" else "10", + "msvc": "192", + "Visual Studio": "14", } def export_sources(self): @@ -49,14 +52,23 @@ def layout(self): cmake_layout(self, src_folder="src") def validate(self): + if (Version(self.version) == "2.1.0" and self.settings.os == "Linux" and self.settings.compiler == "clang" and + 12 <= Version(self.settings.compiler.version) <= 16 and "libstdc++" in self.settings.compiler.libcxx): + # https://github.com/boost-ext/ut/issues/637 + raise ConanInvalidConfiguration(f"{self.ref} does support Clang + libstdc++. Use -s compiler.libcxx=libc++ or Clang >16.") + 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.ref} may not be built with MSVC. " "Please use at least version 1.1.9 with MSVC.") + 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 at least version {minimum_version} of the {self.settings.compiler} compiler." + ) if is_msvc(self): - check_min_vs(self, "192") if not self.options.get_safe("disable_module", True): self.output.warn("The 'disable_module' option must be enabled when using MSVC.") if not is_msvc(self): @@ -71,6 +83,10 @@ def validate(self): 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 build_requirements(self): + if Version(self.version) >= "2.0.0": + self.tool_requires("cmake/[>=3.21 <4]") + def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) @@ -84,7 +100,9 @@ def generate(self): if disable_module: tc.cache_variables["BOOST_UT_DISABLE_MODULE"] = disable_module tc.generate() - + virtual_build_env = VirtualBuildEnv(self) + virtual_build_env.generate() + def build(self): apply_conandata_patches(self) cmake = CMake(self) diff --git a/recipes/boost-ext-ut/config.yml b/recipes/boost-ext-ut/config.yml index 968159344a038..61e709f7dc6a2 100644 --- a/recipes/boost-ext-ut/config.yml +++ b/recipes/boost-ext-ut/config.yml @@ -1,5 +1,11 @@ versions: - "1.1.8": + "2.1.0": + folder: "all" + "2.0.1": + folder: "all" + "2.0.0": folder: "all" "1.1.9": folder: "all" + "1.1.8": + folder: "all" diff --git a/recipes/boost-leaf/all/conandata.yml b/recipes/boost-leaf/all/conandata.yml index 42c2ccab24961..593e982ab983b 100644 --- a/recipes/boost-leaf/all/conandata.yml +++ b/recipes/boost-leaf/all/conandata.yml @@ -2,3 +2,9 @@ sources: "1.81.0": url: "https://github.com/boostorg/leaf/archive/refs/tags/1.81.0.tar.gz" sha256: "6a2bfa8727891e844f1f95c9c68af192f4c5f53b1707acce54290932118b48c0" + "1.82.0": + url: "https://github.com/boostorg/leaf/archive/refs/tags/boost-1.82.0.tar.gz" + sha256: "0917b22b60a2980bf5e33a393a8545dc6a4a7006c8ca8b78280d1cdb965d75f3" + "1.83.0": + url: "https://github.com/boostorg/leaf/archive/refs/tags/boost-1.83.0.tar.gz" + sha256: "559b16ac2cd287885104f6d2b93cc777f136d98e89e3b9915013561d893f5128" diff --git a/recipes/boost-leaf/all/conanfile.py b/recipes/boost-leaf/all/conanfile.py index b119ea7a5c58a..e655329412639 100644 --- a/recipes/boost-leaf/all/conanfile.py +++ b/recipes/boost-leaf/all/conanfile.py @@ -19,10 +19,7 @@ class BoostLEAFConan(ConanFile): "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") + deprecated = "boost" def package_id(self): self.info.clear() @@ -63,11 +60,10 @@ def lazy_lt_semver(v1, v2): f"{self.name} {self.version} requires C++{self._min_cppstd}, which your compiler ({compiler}-{version}) does not support") def layout(self): - basic_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 package(self): copy(self, "LICENSE_1_0.txt", dst=os.path.join( diff --git a/recipes/boost-leaf/config.yml b/recipes/boost-leaf/config.yml index 80eea4560f825..7468e5b299833 100644 --- a/recipes/boost-leaf/config.yml +++ b/recipes/boost-leaf/config.yml @@ -1,3 +1,7 @@ versions: "1.81.0": folder: "all" + "1.82.0": + folder: "all" + "1.83.0": + folder: "all" diff --git a/recipes/boost/all/conandata.yml b/recipes/boost/all/conandata.yml index 429c6cd2f589d..c7a797f162a96 100644 --- a/recipes/boost/all/conandata.yml +++ b/recipes/boost/all/conandata.yml @@ -1,4 +1,29 @@ sources: + "1.86.0": + url: + - "https://boostorg.jfrog.io/artifactory/main/release/1.86.0/source/boost_1_86_0.tar.bz2" + - "https://sourceforge.net/projects/boost/files/boost/1.86.0/boost_1_86_0.tar.bz2" + sha256: "1bed88e40401b2cb7a1f76d4bab499e352fa4d0c5f31c0dbae64e24d34d7513b" + "1.85.0": + url: + - "https://boostorg.jfrog.io/artifactory/main/release/1.85.0/source/boost_1_85_0.tar.bz2" + - "https://sourceforge.net/projects/boost/files/boost/1.85.0/boost_1_85_0.tar.bz2" + sha256: "7009fe1faa1697476bdc7027703a2badb84e849b7b0baad5086b087b971f8617" + "1.84.0": + url: + - "https://boostorg.jfrog.io/artifactory/main/release/1.84.0/source/boost_1_84_0.tar.bz2" + - "https://sourceforge.net/projects/boost/files/boost/1.84.0/boost_1_84_0.tar.bz2" + sha256: "cc4b893acf645c9d4b698e9a0f08ca8846aa5d6c68275c14c3e7949c24109454" + "1.83.0": + url: + - "https://boostorg.jfrog.io/artifactory/main/release/1.83.0/source/boost_1_83_0.tar.bz2" + - "https://sourceforge.net/projects/boost/files/boost/1.83.0/boost_1_83_0.tar.bz2" + sha256: "6478edfe2f3305127cffe8caf73ea0176c53769f4bf1585be237eb30798c3b8e" + "1.82.0": + url: + - "https://boostorg.jfrog.io/artifactory/main/release/1.82.0/source/boost_1_82_0.tar.bz2" + - "https://sourceforge.net/projects/boost/files/boost/1.82.0/boost_1_82_0.tar.bz2" + sha256: "a6e1ab9b0860e6a2881dd7b21fe9f737a095e5f33a3a874afc6a345228597ee6" "1.81.0": url: - "https://boostorg.jfrog.io/artifactory/main/release/1.81.0/source/boost_1_81_0.tar.bz2" @@ -19,45 +44,39 @@ sources: - "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.86.0": + - patch_file: "patches/1.82.0-locale-iconv-library-option.patch" + patch_description: "Optional flag to specify iconv from either libc of libiconv" + patch_type: "conan" + "1.85.0": + - patch_file: "patches/1.82.0-locale-iconv-library-option.patch" + patch_description: "Optional flag to specify iconv from either libc of libiconv" + patch_type: "conan" + - patch_file: "patches/1.85.0-container-aliasing-violation-fix.patch" + patch_description: "Fix aliasing violation in boost::container" + patch_type: "official" + patch_source: "https://github.com/boostorg/container/commit/20ad12f20e661978e90dc7f36d8ab8ac05e5a5a9" + "1.84.0": + - patch_file: "patches/1.82.0-locale-iconv-library-option.patch" + patch_description: "Optional flag to specify iconv from either libc of libiconv" + patch_type: "conan" + - patch_file: "patches/1.84.0-reimplement-string_set-as-any-string.patch" + patch_description: "Fix compilation with cppstd=20 on libcxx platforms (e.g. MacOS)" + patch_type: "official" + patch_source: "https://github.com/boostorg/locale/commit/c5e8f02c903696a213fc4b710f6740ccd1f07f4e" + "1.83.0": + - patch_file: "patches/1.82.0-locale-iconv-library-option.patch" + patch_description: "Optional flag to specify iconv from either libc of libiconv" + patch_type: "conan" + - patch_file: "patches/1.83.0-locale-msvc.patch" + patch_description: "Fix compilation on windows when NOMINMAX is not defined" + patch_type: "official" + patch_source: "https://github.com/boostorg/locale/pull/189" + "1.82.0": + - patch_file: "patches/1.82.0-locale-iconv-library-option.patch" + patch_description: "Optional flag to specify iconv from either libc of libiconv" + patch_type: "conan" "1.81.0": - patch_file: "patches/boost_1_77_mpi_check.patch" patch_description: "Fails the build when mpi is not configured" @@ -88,6 +107,14 @@ patches: 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" + - patch_file: "patches/1.80.0-0005-config-libcpp15.patch" + patch_description: "Support for libcpp15 which removes std::unary_function and std::binary_function." + patch_type: "portability" + patch_source: "https://www.boost.org/patches/1_80_0/0005-config-libcpp15.patch" + - patch_file: "patches/1.80.0-0006-unordered-msvc-rtcc.patch" + patch_description: "Fix MSVC /RTCc build runtime failures." + patch_type: "official" + patch_source: "https://www.boost.org/patches/1_80_0/0006-unordered-msvc-rtcc.patch" "1.79.0": - patch_file: "patches/boost_locale_fail_on_missing_backend.patch" patch_description: "Fails the build when there is no iconv backend" @@ -132,227 +159,3 @@ patches: 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" - 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-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" - 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" - 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" - 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" - patch_description: "" - patch_type: "conan" - - patch_file: "patches/python_base_prefix.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" - 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" - 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.72.0": - - patch_file: "patches/bcp_namespace_issues_1_72.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/0001-revert-cease-dependence-on-range.patch" - patch_description: "" - patch_type: "conan" - - patch_file: "patches/boost_log_filesystem_no_deprecated_1_72.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" - 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" - 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.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" - 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" - 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-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" - 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" - 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" - 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.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" - 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-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" - 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" - 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" - 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 629e7ce2ebdf0..abf0ecf6f2554 100644 --- a/recipes/boost/all/conanfile.py +++ b/recipes/boost/all/conanfile.py @@ -1,7 +1,7 @@ from conan import ConanFile from conan.errors import ConanException, ConanInvalidConfiguration 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.build import build_jobs, cross_building, valid_min_cppstd, supported_cppstd from conan.tools.env import VirtualBuildEnv from conan.tools.files import ( apply_conandata_patches, chdir, collect_libs, copy, export_conandata_patches, @@ -23,12 +23,13 @@ required_conan_version = ">=1.53.0" - # When adding (or removing) an option, also add this option to the list in # `rebuild-dependencies.yml` and re-run that script. CONFIGURE_OPTIONS = ( "atomic", + "charconv", "chrono", + "cobalt", "container", "context", "contract", @@ -46,6 +47,7 @@ "math", "mpi", "nowide", + "process", "program_options", "python", "random", @@ -57,6 +59,7 @@ "thread", "timer", "type_erasure", + "url", "wave", ) @@ -80,7 +83,7 @@ class BoostConan(ConanFile): "filesystem_no_deprecated": [True, False], "filesystem_use_std_fs": [True, False], "filesystem_version": [None, "3", "4"], - "layout": ["system", "versioned", "tagged", "b2-default"], + "layout": ["system", "versioned", "tagged"], "magic_autolink": [True, False], # enables BOOST_ALL_NO_LIB "diagnostic_definitions": [True, False], # enables BOOST_LIB_DIAGNOSTIC "python_executable": [None, "ANY"], # system default python installation is used, if None @@ -159,24 +162,167 @@ def export(self): def export_sources(self): export_conandata_patches(self) + def _cppstd_flag(self, compiler_cppstd=None): + """Return the flag for the given C++ standard and compiler""" + # TODO: Replace it by Conan tool when available: https://github.com/conan-io/conan/issues/12603 + compiler = self.settings.get_safe("compiler") + compiler_version = self.settings.get_safe("compiler.version") + cppstd = self.settings.get_safe("compiler.cppstd") or compiler_cppstd + if not compiler or not compiler_version or not cppstd: + return "" + + def _cppstd_gcc(gcc_version, cppstd): + """Return the flag for the given C++ standard and GCC version""" + cppstd_flags = {} + cppstd_flags.setdefault("98", "98" if gcc_version >= "3.4" else None) + cppstd_flags.setdefault("11", "11" if gcc_version >= "4.7" else "0x" if gcc_version >= "4.3" else None) + cppstd_flags.setdefault("14", "14" if gcc_version >= "4.9" else "1y" if gcc_version >= "4.8" else None) + cppstd_flags.setdefault("17", "17" if gcc_version >= "5.2" else "1z" if gcc_version >= "5" else None) + cppstd_flags.setdefault("20", "2a" if gcc_version >= "8" else "20" if gcc_version >= "12" else None) + cppstd_flags.setdefault("23", "2b" if gcc_version >= "11" else None) + return cppstd_flags.get(cppstd.lstrip("gnu")) + + def _cppstd_clang(clang_version, cppstd): + """Return the flag for the given C++ standard and Clang version""" + cppstd_flags = {} + cppstd_flags.setdefault("98", "98" if clang_version >= "2.1" else None) + cppstd_flags.setdefault("11", "11" if clang_version >= "3.1" else "0x" if clang_version >= "2.1" else None) + cppstd_flags.setdefault("14", "14" if clang_version >= "3.5" else "1y" if clang_version >= "3.4" else None) + cppstd_flags.setdefault("17", "17" if clang_version >= "5" else "1z" if clang_version >= "3.5" else None) + cppstd_flags.setdefault("20", "2a" if clang_version >= "6" else "20" if clang_version >= "12" else None) + cppstd_flags.setdefault("23", "2b" if clang_version >= "13" else "23" if clang_version >= "17" else None) + return cppstd_flags.get(cppstd.lstrip("gnu")) + + + def _cppstd_apple_clang(clang_version, cppstd): + """Return the flag for the given C++ standard and Apple Clang version""" + cppstd_flags = {} + cppstd_flags.setdefault("98", "98" if clang_version >= "4.0" else None) + cppstd_flags.setdefault("11", "11" if clang_version >= "4.0" else None) + cppstd_flags.setdefault("14", "14" if clang_version >= "6.1" else "1y" if clang_version >= "5.1" else None) + cppstd_flags.setdefault("17", "17" if clang_version >= "9.1" else "1z" if clang_version >= "6.1" else None) + cppstd_flags.setdefault("20", "20" if clang_version >= "13.0" else "2a" if clang_version >= "10.0" else None) + cppstd_flags.setdefault("23", "2b" if clang_version >= "13.0" else None) + return cppstd_flags.get(cppstd.lstrip("gnu")) + + def _cppstd_msvc(visual_version, cppstd): + """Return the flag for the given C++ standard and MSVC version""" + cppstd_flags = {} + cppstd_flags.setdefault("98", "98") + cppstd_flags.setdefault("11", "11") + cppstd_flags.setdefault("14", "14" if visual_version >= "190" else None) + cppstd_flags.setdefault("17", "17" if visual_version >= "191" else "latest" if visual_version >= "190" else None) + cppstd_flags.setdefault("20", "20" if visual_version >= "192" else "latest" if visual_version >= "191" else None) + cppstd_flags.setdefault("23", "latest" if visual_version >= "193" else None) + return cppstd_flags.get(cppstd) + + func = {"gcc": _cppstd_gcc, "clang": _cppstd_clang, "apple-clang": _cppstd_apple_clang, "msvc": _cppstd_msvc}.get(compiler) + flag = cppstd + if func: + flag = func(Version(compiler_version), str(cppstd)) + return flag + @property def _min_compiler_version_default_cxx11(self): - # Minimum compiler version having c++ standard >= 11 - if self.settings.compiler == "apple-clang": - # For now, assume apple-clang will enable c++11 in the distant future - return 99 + """ Minimum compiler version having c++ standard >= 11 + """ return { "gcc": 6, "clang": 6, + "apple-clang": 99, # still uses C++98 by default. XCode does not reflect apple-clang "Visual Studio": 14, # guess "msvc": 190, # guess }.get(str(self.settings.compiler)) + @property + def _min_compiler_version_default_cxx14(self): + """ Minimum compiler version having c++ standard >= 14 + https://gcc.gnu.org/gcc-6/changes.html + https://releases.llvm.org/6.0.0/tools/clang/docs/ReleaseNotes.html#id9 + https://learn.microsoft.com/en-us/cpp/build/reference/std-specify-language-standard-version?view=msvc-150#remarks + """ + return { + "gcc": 6, + "clang": 6, + "apple-clang": 99, # still uses C++98 by default. XCode does not reflect apple-clang + "Visual Studio": 15, # guess + "msvc": 191, # guess + }.get(str(self.settings.compiler)) + + @property + def _min_compiler_version_default_cxx20(self): + return { + "gcc": 99, + "clang": 99, + "apple-clang": 99, + "Visual Studio": 99, + "msvc": 999, + }.get(str(self.settings.compiler)) + + @property + def _has_cppstd_11_supported(self): + cppstd = self.settings.compiler.get_safe("cppstd") + if cppstd: + return valid_min_cppstd(self, 11) + compiler_version = self._min_compiler_version_default_cxx11 + if compiler_version: + return (Version(self.settings.compiler.version) >= compiler_version) or "11" in supported_cppstd(self) + + @property + def _has_cppstd_14_supported(self): + cppstd = self.settings.compiler.get_safe("cppstd") + if cppstd: + return valid_min_cppstd(self, 14) + required_compiler_version = self._min_compiler_version_default_cxx14 + if required_compiler_version: + msvc_versions = {14: 190, 15: 191, 16: 192, 17: 193} + compiler_version = Version(self.settings.compiler.version) + is_visual_studio = str(self.settings.compiler) == "Visual Studio" + # supported_cppstd only supports msvc, but not Visual Studio as compiler + supported_cxx14 = "14" in supported_cppstd(self, "msvc", msvc_versions.get(compiler_version)) if is_visual_studio else "14" in supported_cppstd(self) + # supported_cppstd: lists GCC 5 due partial support for C++14, but not enough for Boost + return (compiler_version >= required_compiler_version) and supported_cxx14 + + @property + def _has_cppstd_20_supported(self): + cppstd = self.settings.compiler.get_safe("cppstd") + if cppstd: + return valid_min_cppstd(self, 20) + required_compiler_version = self._min_compiler_version_default_cxx20 + if required_compiler_version: + msvc_versions = {14: 190, 15: 191, 16: 192, 17: 193} + compiler_version = Version(self.settings.compiler.version) + is_visual_studio = str(self.settings.compiler) == "Visual Studio" + # supported_cppstd only supports msvc, but not Visual Studio as compiler + supported_cxx20 = "20" in supported_cppstd(self, "msvc", msvc_versions.get(compiler_version)) if is_visual_studio else "20" in supported_cppstd(self) + # We still dont have a compiler using C++20 by default + return (compiler_version >= required_compiler_version) or supported_cxx20 + + @property + def _has_coroutine_supported(self): + cppstd = self.settings.compiler.get_safe("cppstd") + cppstd_20_supported = True + if cppstd: + cppstd_20_supported = valid_min_cppstd(self, 20) + # https://en.cppreference.com/w/cpp/compiler_support#cpp20 + # https://releases.llvm.org/14.0.0/tools/clang/docs/ReleaseNotes.html#clang-format: before is experimental header + # https://gcc.gnu.org/gcc-10/changes.html: requires -fcoroutines + min_compiler_versions = { + "apple-clang": "12", + "clang": "14", + "gcc": "10", + "msvc": "192", + "Visual Studio": "16",} + required_compiler_version = min_compiler_versions.get(str(self.settings.compiler)) + if not required_compiler_version: + return cppstd_20_supported + return cppstd_20_supported and Version(self.settings.compiler.version) >= required_compiler_version + @property def _min_compiler_version_nowide(self): # Nowide needs c++11 + swappable std::fstream return { - "gcc": 5, + "gcc": 4.8, "clang": 5, "Visual Studio": 14, # guess "msvc": 190, # guess @@ -234,10 +380,6 @@ def _settings_build(self): 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): """ @@ -275,17 +417,24 @@ def config_options(self): 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: - if Version(self.settings.compiler.version) < version_cxx11_standard_json: + if not self._has_cppstd_11_supported: 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 + if Version(self.version) >= "1.85.0" and not self._has_cppstd_14_supported: + self.options.without_math = True + if Version(self.version) >= "1.86.0" and not self._has_cppstd_14_supported: + self.options.without_graph = True # iconv is off by default on Windows and Solaris if self._is_windows_platform or self.settings.os == "SunOS": @@ -303,27 +452,36 @@ def config_options(self): if dep_name not in self._configure_options: delattr(self.options, f"without_{dep_name}") - if Version(self.version) >= "1.76.0": - # Starting from 1.76.0, Boost.Math requires a c++11 capable compiler - # ==> disable it by default for older compilers or c++ standards - - def disable_math(): - super_modules = self._all_super_modules("math") - 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_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") - elif Version(self.settings.compiler.version) < min_compiler_version: - disable_math() + def disable_math(): + super_modules = self._all_super_modules("math") + for smod in super_modules: + try: + setattr(self.options, f"without_{smod}", True) + except ConanException: + pass + + def disable_graph(): + super_modules = self._all_super_modules("graph") + for smod in super_modules: + try: + setattr(self.options, f"without_{smod}", True) + except ConanException: + pass + + # Starting from 1.76.0, Boost.Math requires a c++11 capable compiler + # ==> disable it by default for older compilers or c++ standards + 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.warning("Assuming the compiler supports c++11 by default") + elif not self._has_cppstd_11_supported: + disable_math() + # Boost.Math is not built when the compiler is GCC < 5 and uses C++11 + elif self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "5": + disable_math() if Version(self.version) >= "1.79.0": # Starting from 1.79.0, Boost.Wave requires a c++11 capable compiler @@ -343,8 +501,11 @@ def 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") - elif Version(self.settings.compiler.version) < min_compiler_version: + self.output.warning("Assuming the compiler supports c++11 by default") + elif not self._has_cppstd_11_supported: + disable_wave() + # Boost.Wave is not built when the compiler is GCC < 5 and uses C++11 + elif self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "5": disable_wave() if Version(self.version) >= "1.81.0": @@ -365,10 +526,79 @@ def disable_locale(): 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") - elif Version(self.settings.compiler.version) < min_compiler_version: + self.output.warning("Assuming the compiler supports c++11 by default") + elif not self._has_cppstd_11_supported: + disable_locale() + # Boost.Locale is not built when the compiler is GCC < 5 and uses C++11 + elif self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "5": disable_locale() + if Version(self.version) >= "1.84.0": + # Starting from 1.84.0, Boost.Cobalt requires a c++20 capable compiler + # ==> disable it by default for older compilers or c++ standards + + def disable_cobalt(): + super_modules = self._all_super_modules("cobalt") + for smod in super_modules: + try: + setattr(self.options, f"without_{smod}", True) + except ConanException: + pass + + if not self._has_coroutine_supported: + disable_cobalt() + elif self.settings.compiler.get_safe("cppstd"): + if not valid_min_cppstd(self, 20): + disable_cobalt() + else: + min_compiler_version = self._min_compiler_version_default_cxx20 + if min_compiler_version is None: + self.output.warning("Assuming the compiler supports c++20 by default") + elif Version(self.settings.compiler.version) < min_compiler_version: + disable_cobalt() + + # FIXME: Compilation errors on msvc shared build for boost.fiber https://github.com/boostorg/fiber/issues/314 + if is_msvc(self): + self.options.without_fiber = True + + if Version(self.version) >= "1.85.0": + # Starting from 1.85.0, Boost.Math requires a c++14 capable compiler + # https://github.com/boostorg/math/blob/boost-1.85.0/README.md + # ==> disable it by default for older compilers or c++ standards + if self.settings.compiler.get_safe("cppstd"): + if not valid_min_cppstd(self, 14): + disable_math() + else: + min_compiler_version = self._min_compiler_version_default_cxx14 + if min_compiler_version is None: + self.output.warning("Assuming the compiler supports c++14 by default") + elif not self._has_cppstd_14_supported: + disable_math() + + if Version(self.version) >= "1.86.0": + # Boost 1.86.0 updated more components that require C++14 and C++17 + # https://www.boost.org/users/history/version_1_86_0.html + if self.settings.compiler.get_safe("cppstd"): + if not valid_min_cppstd(self, 14): + disable_graph() + else: + min_compiler_version = self._min_compiler_version_default_cxx14 + if min_compiler_version is None: + self.output.warning("Assuming the compiler supports c++14 by default") + elif not self._has_cppstd_14_supported: + disable_graph() + + if self.settings.os == "iOS": + # the process library doesn't build (and doesn't even make sense) on iOS + self.options.without_process = True + + # TODO: Revisit on Boost 1.87.0 + # It's not possible to disable process only when having shared parsed already. + # https://github.com/boostorg/process/issues/408 + # https://github.com/boostorg/process/pull/409 + if Version(self.version) == "1.86.0" and is_msvc(self): + setattr(self.options, "without_process", True) + @property def _configure_options(self): return self._dependencies["configure_options"] @@ -388,6 +618,15 @@ def _stacktrace_addr2line_available(self): return False return not self.options.header_only and not self.options.without_stacktrace and self.settings.os != "Windows" + @property + def _stacktrace_from_exception_available(self): + if Version(self.version) == "1.85.0": + # https://github.com/boostorg/stacktrace/blob/boost-1.85.0/build/Jamfile.v2#L143 + return not self.options.header_only and not self.options.without_stacktrace and self.settings.os != "Windows" + elif Version(self.version) >= "1.86.0": + # https://github.com/boostorg/stacktrace/blob/boost-1.86.0/build/Jamfile.v2#L148 + return not self.options.header_only and not self.options.without_stacktrace and self._b2_architecture == "x86" + def configure(self): if self.options.header_only: self.options.rm_safe("shared") @@ -396,7 +635,7 @@ def configure(self): 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 @@ -423,26 +662,55 @@ def configure(self): if self.options.get_safe("without_stacktrace", True): 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: self.options.rm_safe("numa") + # Use verbosity from [conf] if specified + verbosity = self.conf.get("tools.build:verbosity", default="quiet") + if verbosity == "verbose" and int(self.options.debug_level) < 2: + self.options.debug_level.value = 2 + def layout(self): basic_layout(self, src_folder="src") @property def _cxx11_boost_libraries(self): - libraries = ["fiber", "json", "nowide"] - if Version(self.version) >= "1.76.0": - libraries.append("math") + libraries = ["fiber", "json", "nowide", "url"] + libraries.append("math") if Version(self.version) >= "1.79.0": libraries.append("wave") if Version(self.version) >= "1.81.0": libraries.append("locale") + if Version(self.version) >= "1.84.0": + libraries.append("atomic") + libraries.append("filesystem") + libraries.append("log") + libraries.append("random") + libraries.append("stacktrace") + libraries.append("test") + libraries.append("thread") + if Version(self.version) >= "1.85.0": + libraries.append("system") + libraries.sort() + return list(filter(lambda library: f"without_{library}" in self.options, libraries)) + + @property + def _cxx14_boost_libraries(self): + libraries = [] + if Version(self.version) >= "1.85.0": + # https://github.com/boostorg/math/blob/develop/README.md#boost-math-library + libraries.append("math") + libraries.sort() + return list(filter(lambda library: f"without_{library}" in self.options, libraries)) + + @property + def _cxx20_boost_libraries(self): + libraries = [] + if Version(self.version) >= "1.84.0": + # https://github.com/boostorg/cobalt/blob/boost-1.84.0/build/Jamfile#L54 + libraries.append("cobalt") libraries.sort() - return filter(lambda library: f"without_{library}" in self.options, libraries) + return list(filter(lambda library: f"without_{library}" in self.options, libraries)) def validate(self): if not self.options.multithreading: @@ -457,6 +725,10 @@ def validate(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.") + # FIXME: In 1.84.0, there are compilation errors on msvc shared build for boost.fiber. https://github.com/boostorg/fiber/issues/314 + if Version(self.version) >= "1.84.0" and is_msvc(self) and self._shared and not self.options.without_fiber: + raise ConanInvalidConfiguration("Boost.fiber can not be built as shared library on MSVC.") + if not self.options.without_locale and self.options.i18n_backend_iconv == "off" and \ not self.options.i18n_backend_icu and not self._is_windows_platform: raise ConanInvalidConfiguration( @@ -480,16 +752,24 @@ def validate(self): if mincompiler_version and Version(self.settings.compiler.version) < mincompiler_version: raise ConanInvalidConfiguration("This compiler is too old to build Boost.nowide.") - 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 and Version(self.settings.compiler.version) < version_cxx11_standard: + for cxx_standard, boost_libraries, has_cppstd_supported in [ + (11, self._cxx11_boost_libraries, self._has_cppstd_11_supported), + (14, self._cxx14_boost_libraries, self._has_cppstd_14_supported), + (20, self._cxx20_boost_libraries, self._has_cppstd_20_supported)]: + if any([not self.options.get_safe(f"without_{library}", True) for library in boost_libraries]): + if (self.settings.compiler.get_safe("cppstd") and not valid_min_cppstd(self, cxx_standard)) or \ + not has_cppstd_supported: raise ConanInvalidConfiguration( - f"Boost.{{{','.join(self._cxx11_boost_libraries)}}} requires a c++11 compiler " - "(please set compiler.cppstd or use a newer compiler)" + f"Boost libraries {', '.join(boost_libraries)} requires a C++{cxx_standard} compiler. " + "Please, set compiler.cppstd or use a newer compiler version or disable from building." ) + if not self.options.get_safe("without_cobalt", True) and not self._has_coroutine_supported: + raise ConanInvalidConfiguration("Boost.Cobalt requires a C++20 capable compiler. " + "Please, set compiler.cppstd and use a newer compiler version, or disable from building.") + + # TODO: Revisit on Boost 1.87.0. Remove in case Process is fixed. + if Version(self.version) == "1.86.0" and is_msvc(self) and self.options.get_safe("shared") and self.options.get_safe("without_process", None) == False: + raise ConanInvalidConfiguration(f"{self.ref} Boost.Process will fail to be consumed as shared library on MSVC. See https://github.com/boostorg/process/issues/408.") def _with_dependency(self, dependency): """ @@ -531,18 +811,18 @@ def _with_stacktrace_backtrace(self): def requirements(self): if self._with_zlib: - self.requires("zlib/1.2.13") + self.requires("zlib/[>=1.2.11 <2]") if self._with_bzip2: self.requires("bzip2/1.0.8") if self._with_lzma: - self.requires("xz_utils/5.2.5") + self.requires("xz_utils/[>=5.4.5 <6]") if self._with_zstd: - self.requires("zstd/1.5.2") + self.requires("zstd/[>=1.5 <1.6]") 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/72.1") + self.requires("icu/74.2") if self._with_iconv: self.requires("libiconv/1.17") @@ -558,12 +838,10 @@ def package_id(self): del self.info.options.python_executable # PATH to the interpreter is not important, only version matters 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.tool_requires("b2/4.9.2") + self.tool_requires("b2/[>=5.2 <6]") def source(self): get(self, **self.conan_data["sources"][self.version], @@ -589,7 +867,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 @@ -641,7 +919,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): @@ -723,9 +1001,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: @@ -770,17 +1049,17 @@ def _clean(self): ] 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 self._settings_build == "Windows" else "b2" + return "b2" @property def _bcp_exe(self): folder = os.path.join(self.source_folder, "dist", "bin") - return os.path.join(folder, "bcp.exe" if self._settings_build == "Windows" else "bcp") + return os.path.join(folder, "bcp") @property def _use_bcp(self): @@ -795,7 +1074,7 @@ def _build_bcp(self): 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.warn(command) + self.output.warning(command) self.run(command) def _run_bcp(self): @@ -813,15 +1092,23 @@ def _run_bcp(self): libraries.add(d) libraries = " ".join(libraries) command = f"{self._bcp_exe} {namespace} {alias} {boostdir} {libraries} {self._bcp_dir}" - self.output.warn(command) + 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, "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, "boost", "stacktrace", "detail", "libbacktrace_impls.hpp"), "/* thread_local */", "thread_local", strict=False) @@ -844,9 +1131,16 @@ def build(self): " @numa", " shared:.//boost_fiber : @numa", strict=False) + if self.settings.os == "Android": + # force versionless soname from boostorg/boost#206 + # this can be applied to all versions and it's easier with a replace + replace_in_file(self, os.path.join(self.source_folder, "boostcpp.jam"), + "! [ $(property-set).get ] in windows cygwin darwin aix &&", + "! [ $(property-set).get ] in windows cygwin darwin aix android &&", + 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() @@ -855,7 +1149,6 @@ 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 @@ -864,7 +1157,7 @@ def build(self): # -d2 is to print more debug info and avoid travis timing out without output 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. @@ -890,7 +1183,7 @@ def _b2_os(self): @property def _b2_address_model(self): - if self.settings.arch in ("x86_64", "ppc64", "ppc64le", "mips64", "armv8", "armv8.3", "sparcv9"): + if self.settings.arch in ("x86_64", "ppc64", "ppc64le", "mips64", "armv8", "armv8.3", "sparcv9", "s390x"): return "64" return "32" @@ -1002,7 +1295,7 @@ def _build_flags(self): flags.append("--disable-iconv") def add_defines(library): - for define in self.dependencies[library].cpp_info.defines: + for define in self.dependencies[library].cpp_info.aggregated_components().defines: flags.append(f"define={define}") if self._with_zlib: @@ -1014,6 +1307,9 @@ def add_defines(library): if self._with_zstd: add_defines("zstd") + for define in self.conf.get("tools.build:defines", default=[], check_type=list): + flags.append(f"define={define}") + 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'}") @@ -1034,9 +1330,18 @@ def add_defines(library): flags.append(f"toolset={self._toolset}") - if self.settings.get_safe("compiler.cppstd"): - cppstd_flag = AutotoolsToolchain(self).cppstd - flags.append(f"cxxflags={cppstd_flag}") + safe_cppstd = self.settings.get_safe("compiler.cppstd") + if safe_cppstd: + cppstd_version = self._cppstd_flag(safe_cppstd) + flags.append(f"cxxstd={cppstd_version}") + if "gnu" in safe_cppstd: + flags.append("cxxstd-dialect=gnu") + elif Version(self.version) >= "1.85.0" and self._has_cppstd_14_supported: + cppstd_version = self._cppstd_flag("14") + flags.append(f"cxxstd={cppstd_version}") + elif self._has_cppstd_11_supported: + cppstd_version = self._cppstd_flag("11") + flags.append(f"cxxstd={cppstd_version}") # LDFLAGS link_flags = [] @@ -1101,17 +1406,23 @@ def add_defines(library): 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._stacktrace_from_exception_available and "x86" not in str(self.settings.arch): + # https://github.com/boostorg/stacktrace/blob/boost-1.85.0/src/from_exception.cpp#L29 + # This feature is guarded by BOOST_STACKTRACE_ALWAYS_STORE_IN_PADDING, but that is only enabled on x86. + flags.append("define=BOOST_STACKTRACE_LIBCXX_RUNTIME_MAY_CAUSE_MEMORY_LEAK=1") if self._with_iconv: flags.append(f"-sICONV_PATH={self.dependencies['libiconv'].package_folder}") if self._with_icu: 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. + 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 self.dependencies["icu"].cpp_info.system_libs) + icu_ldflags = " ".join(f"{l}.lib" for l in icu_system_libs) else: - icu_ldflags = " ".join(f"-l{l}" for l in self.dependencies["icu"].cpp_info.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)}"' @@ -1120,6 +1431,10 @@ def add_defines(library): if self.options.get_safe("addr2line_location"): cxx_flags.append(f"-DBOOST_STACKTRACE_ADDR2LINE_LOCATION={self.options.addr2line_location}") + if not self.options.get_safe('without_cobalt', True) and \ + (self.settings.compiler == "gcc" and Version(self.settings.compiler.version) == "10"): + cxx_flags.append("-fcoroutines") + cxx_flags = f'cxxflags="{" ".join(cxx_flags)}"' flags.append(cxx_flags) @@ -1160,14 +1475,14 @@ 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): - ar = self.buildenv.vars(self).get("AR") + ar = VirtualBuildEnv(self).vars().get("AR") if ar: return ar if is_apple_os(self) and self.settings.compiler == "apple-clang": @@ -1176,7 +1491,7 @@ def _ar(self): @property def _ranlib(self): - ranlib = self.buildenv.vars(self).get("RANLIB") + ranlib = VirtualBuildEnv(self).vars().get("RANLIB") if ranlib: return ranlib if is_apple_os(self) and self.settings.compiler == "apple-clang": @@ -1185,7 +1500,8 @@ def _ranlib(self): @property def _cxx(self): - cxx = self.buildenv.vars(self).get("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": @@ -1199,32 +1515,34 @@ def _cxx(self): 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() + if len(aggregated_cpp_info.libs) == 0: + return "" + + 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 = self.dependencies[deps_name].cpp_info.includedirs[0].replace("\\", "/") - includedir = f"\"{includedir}\"" - libdir = self.dependencies[deps_name].cpp_info.libdirs[0].replace("\\", "/") - libdir = f"\"{libdir}\"" - lib = self.dependencies[deps_name].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._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,10 +1556,8 @@ def create_library_config(deps_name, name): contents += f'\nusing "{self._toolset}" : {self._toolset_version} : ' cxx_fwd_slahes = self._cxx.replace("\\", "/") - if is_msvc(self): - 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": @@ -1258,13 +1574,22 @@ def create_library_config(deps_name, name): contents += f'"{ranlib_path}" ' cxxflags = " ".join(self.conf.get("tools.build:cxxflags", default=[], check_type=list)) + " " cflags = " ".join(self.conf.get("tools.build:cflags", default=[], check_type=list)) + " " - cppflags = self.buildenv.vars(self).get("CPPFLAGS", "") + " " + buildenv_vars = VirtualBuildEnv(self).vars() + cppflags = buildenv_vars.get("CPPFLAGS", "") + " " ldflags = " ".join(self.conf.get("tools.build:sharedlinkflags", default=[], check_type=list)) + " " - asflags = self.buildenv.vars(self).get("ASFLAGS", "") + " " + asflags = buildenv_vars.get("ASFLAGS", "") + " " + + sysroot = self.conf.get("tools.build:sysroot") + if sysroot and not is_msvc(self): + sysroot = sysroot.replace("\\", "/") + sysroot = f'"{sysroot}"' if ' ' in sysroot else sysroot + cppflags += f"--sysroot={sysroot} " + ldflags += f"--sysroot={sysroot} " if self._with_stacktrace_backtrace: - cppflags += " ".join(f"-I{p}" for p in self.dependencies["libbacktrace"].cpp_info.includedirs) + " " - ldflags += " ".join(f"-L{p}" for p in self.dependencies["libbacktrace"].cpp_info.libdirs) + " " + 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()}" ' @@ -1282,7 +1607,7 @@ def create_library_config(deps_name, name): contents += " ;" - self.output.warn(contents) + self.output.warning(contents) filename = f"{folder}/user-config.jam" save(self, filename, contents) @@ -1313,7 +1638,7 @@ def _toolset(self): return str(self.settings.compiler) if self.settings.compiler == "sun-cc": return "sunpro" - if self.settings.compiler == "intel": + if "intel" in str(self.settings.compiler): return { "Macos": "intel-darwin", "Windows": "intel-win", @@ -1392,7 +1717,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"): @@ -1422,6 +1747,7 @@ def package_info(self): # - Use '_libboost' component to attach extra system_libs, ... self.cpp_info.components["headers"].libs = [] + self.cpp_info.components["headers"].libdirs = [] self.cpp_info.components["headers"].set_property("cmake_target_name", "Boost::headers") self.cpp_info.components["headers"].names["cmake_find_package"] = "headers" self.cpp_info.components["headers"].names["cmake_find_package_multi"] = "headers" @@ -1468,6 +1794,8 @@ def package_info(self): self.cpp_info.components["_boost_cmake"].set_property("cmake_target_name", "Boost::boost") self.cpp_info.components["_boost_cmake"].names["cmake_find_package"] = "boost" self.cpp_info.components["_boost_cmake"].names["cmake_find_package_multi"] = "boost" + if self.options.header_only: + self.cpp_info.components["_boost_cmake"].libdirs = [] if not self.options.header_only: self.cpp_info.components["_libboost"].requires = ["headers"] @@ -1566,7 +1894,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,6 +1916,8 @@ def add_libprefix(n): libprefix = "" if is_msvc(self) and (not self._shared or n in self._dependencies["static_only"]): libprefix = "lib" + elif self._toolset == "clang-win": + libprefix = "lib" return libprefix + n all_detected_libraries = set(l[:-4] if l.endswith(".dll") else l for l in collect_libs(self)) @@ -1598,7 +1929,11 @@ def filter_transform_module_libraries(names): for name in names: if name in ("boost_stacktrace_windbg", "boost_stacktrace_windbg_cached") and self.settings.os != "Windows": continue - if name in ("boost_stacktrace_addr2line", "boost_stacktrace_backtrace", "boost_stacktrace_basic",) and self.settings.os == "Windows": + if name in ("boost_math_c99l", "boost_math_tr1l") and str(self.settings.arch).startswith("ppc"): + continue + if name in ("boost_stacktrace_addr2line", "boost_stacktrace_backtrace", "boost_stacktrace_basic") and self.settings.os == "Windows": + continue + if name == "boost_stacktrace_from_exception" and not self._stacktrace_from_exception_available: continue if name == "boost_stacktrace_addr2line" and not self._stacktrace_addr2line_available: continue @@ -1647,11 +1982,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: @@ -1661,7 +2000,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: @@ -1678,6 +2017,8 @@ def filter_transform_module_libraries(names): self.cpp_info.components["stacktrace_addr2line"].system_libs.append("dl") if self._with_stacktrace_backtrace: self.cpp_info.components["stacktrace_backtrace"].system_libs.append("dl") + if self._stacktrace_from_exception_available: + self.cpp_info.components["stacktrace_from_exception"].system_libs.append("dl") if self._stacktrace_addr2line_available: self.cpp_info.components["stacktrace_addr2line"].defines.extend([ @@ -1707,6 +2048,13 @@ def filter_transform_module_libraries(names): self.cpp_info.components[f"numpy{pyversion.major}{pyversion.minor}"].requires = ["numpy"] + if not self.options.get_safe("without_process"): + if self.settings.os == "Windows": + self.cpp_info.components["process"].system_libs.extend(["ntdll", "shell32", "advapi32", "user32"]) + if self._shared: + self.cpp_info.components["process"].defines.append("BOOST_PROCESS_DYN_LINK") + + 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") @@ -1736,4 +2084,11 @@ 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"]) + + if not self.options.get_safe('without_cobalt', True) and \ + (self.settings.compiler == "gcc" and Version(self.settings.compiler.version) == "10"): + self.cpp_info.components["cobalt"].cxxflags.append("-fcoroutines") + + #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.70.0.yml b/recipes/boost/all/dependencies/dependencies-1.70.0.yml deleted file mode 100644 index f09a3e59357cc..0000000000000 --- a/recipes/boost/all/dependencies/dependencies-1.70.0.yml +++ /dev/null @@ -1,270 +0,0 @@ -configure_options: -- atomic -- chrono -- container -- context -- contract -- coroutine -- date_time -- exception -- fiber -- filesystem -- graph -- graph_parallel -- iostreams -- locale -- log -- math -- mpi -- program_options -- python -- random -- regex -- serialization -- stacktrace -- system -- test -- thread -- timer -- type_erasure -- wave -dependencies: - atomic: [] - chrono: - - system - container: [] - context: - - thread - contract: - - exception - - thread - coroutine: - - context - - exception - - system - - thread - date_time: - - serialization - exception: [] - fiber: - - context - - filesystem - fiber_numa: - - fiber - filesystem: - - system - graph: - - math - - random - - regex - - serialization - - test - graph_parallel: - - filesystem - - graph - - mpi - - random - - serialization - iostreams: - - random - - regex - locale: - - thread - log: - - atomic - - container - - date_time - - exception - - filesystem - - locale - - random - - regex - - system - - thread - log_setup: - - log - math: - - atomic - 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 - numpy: - - python - prg_exec_monitor: - - test - program_options: [] - python: [] - random: - - math - - 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 - 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 - 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.70.0 diff --git a/recipes/boost/all/dependencies/dependencies-1.71.0.yml b/recipes/boost/all/dependencies/dependencies-1.71.0.yml deleted file mode 100644 index 9c2d0a8c22410..0000000000000 --- a/recipes/boost/all/dependencies/dependencies-1.71.0.yml +++ /dev/null @@ -1,269 +0,0 @@ -configure_options: -- atomic -- chrono -- container -- context -- contract -- coroutine -- date_time -- exception -- fiber -- filesystem -- graph -- graph_parallel -- iostreams -- locale -- log -- math -- mpi -- program_options -- python -- random -- regex -- serialization -- stacktrace -- system -- test -- thread -- timer -- type_erasure -- wave -dependencies: - atomic: [] - chrono: - - system - container: [] - context: - - thread - contract: - - exception - - thread - coroutine: - - context - - exception - - system - - thread - date_time: - - serialization - exception: [] - fiber: - - context - - filesystem - fiber_numa: - - fiber - filesystem: - - system - graph: - - math - - random - - regex - - serialization - graph_parallel: - - filesystem - - graph - - mpi - - random - - serialization - iostreams: - - random - - regex - locale: - - thread - log: - - atomic - - container - - date_time - - exception - - filesystem - - locale - - random - - regex - - system - - thread - log_setup: - - log - math: - - atomic - 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 - numpy: - - python - prg_exec_monitor: - - test - program_options: [] - python: [] - random: - - math - - 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 - 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 - 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.71.0 diff --git a/recipes/boost/all/dependencies/dependencies-1.72.0.yml b/recipes/boost/all/dependencies/dependencies-1.72.0.yml deleted file mode 100644 index f0213a24374bb..0000000000000 --- a/recipes/boost/all/dependencies/dependencies-1.72.0.yml +++ /dev/null @@ -1,270 +0,0 @@ -configure_options: -- atomic -- chrono -- container -- context -- contract -- coroutine -- date_time -- exception -- fiber -- filesystem -- graph -- graph_parallel -- iostreams -- locale -- log -- math -- mpi -- program_options -- python -- random -- regex -- serialization -- stacktrace -- system -- test -- thread -- timer -- type_erasure -- wave -dependencies: - atomic: [] - chrono: - - system - container: [] - context: - - thread - contract: - - exception - - thread - coroutine: - - context - - exception - - system - - thread - date_time: - - serialization - exception: [] - fiber: - - context - - filesystem - fiber_numa: - - fiber - filesystem: - - system - graph: - - math - - random - - regex - - serialization - graph_parallel: - - filesystem - - graph - - mpi - - random - - serialization - iostreams: - - random - - regex - locale: - - thread - log: - - atomic - - container - - date_time - - exception - - filesystem - - locale - - random - - regex - - system - - thread - log_setup: - - log - math: - - atomic - - chrono - 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 - numpy: - - python - prg_exec_monitor: - - test - program_options: [] - python: [] - random: - - math - - 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 - 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 - 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.72.0 diff --git a/recipes/boost/all/dependencies/dependencies-1.73.0.yml b/recipes/boost/all/dependencies/dependencies-1.73.0.yml deleted file mode 100644 index d26d67c9c338d..0000000000000 --- a/recipes/boost/all/dependencies/dependencies-1.73.0.yml +++ /dev/null @@ -1,274 +0,0 @@ -configure_options: -- atomic -- chrono -- container -- context -- contract -- coroutine -- date_time -- exception -- fiber -- filesystem -- graph -- graph_parallel -- iostreams -- 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: - - thread - contract: - - exception - - thread - coroutine: - - context - - exception - - system - - thread - date_time: - - serialization - exception: [] - fiber: - - context - - filesystem - fiber_numa: - - fiber - filesystem: - - system - graph: - - math - - random - - regex - - serialization - graph_parallel: - - filesystem - - graph - - mpi - - random - - serialization - iostreams: - - random - - regex - locale: - - thread - log: - - atomic - - container - - date_time - - exception - - filesystem - - locale - - random - - regex - - system - - thread - log_setup: - - log - math: - - atomic - 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: - - math - - 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 - 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.73.0 diff --git a/recipes/boost/all/dependencies/dependencies-1.74.0.yml b/recipes/boost/all/dependencies/dependencies-1.74.0.yml deleted file mode 100644 index 679e8d616f324..0000000000000 --- a/recipes/boost/all/dependencies/dependencies-1.74.0.yml +++ /dev/null @@ -1,273 +0,0 @@ -configure_options: -- atomic -- chrono -- container -- context -- contract -- coroutine -- date_time -- exception -- fiber -- filesystem -- graph -- graph_parallel -- iostreams -- 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: - - thread - contract: - - exception - - thread - coroutine: - - context - - exception - - system - - thread - date_time: [] - exception: [] - fiber: - - context - - filesystem - fiber_numa: - - fiber - filesystem: - - system - graph: - - math - - random - - regex - - serialization - graph_parallel: - - filesystem - - graph - - mpi - - random - - serialization - iostreams: - - random - - regex - locale: - - thread - log: - - atomic - - container - - date_time - - exception - - filesystem - - locale - - random - - regex - - system - - thread - log_setup: - - log - math: - - atomic - 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: - - math - - 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 - 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.74.0 diff --git a/recipes/boost/all/dependencies/dependencies-1.75.0.yml b/recipes/boost/all/dependencies/dependencies-1.75.0.yml deleted file mode 100644 index 4d24ca98d6337..0000000000000 --- a/recipes/boost/all/dependencies/dependencies-1.75.0.yml +++ /dev/null @@ -1,280 +0,0 @@ -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: - - thread - contract: - - exception - - thread - coroutine: - - context - - exception - - system - - thread - date_time: [] - exception: [] - fiber: - - context - - filesystem - fiber_numa: - - fiber - filesystem: - - system - graph: - - math - - random - - regex - - serialization - graph_parallel: - - filesystem - - graph - - mpi - - random - - serialization - iostreams: - - random - - regex - json: - - container - - exception - - system - locale: - - thread - log: - - atomic - - container - - date_time - - exception - - filesystem - - locale - - random - - regex - - system - - thread - log_setup: - - log - math: - - atomic - 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: - - math - - 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.75.0 diff --git a/recipes/boost/all/dependencies/dependencies-1.76.0.yml b/recipes/boost/all/dependencies/dependencies-1.76.0.yml deleted file mode 100644 index b404c36315ae1..0000000000000 --- a/recipes/boost/all/dependencies/dependencies-1.76.0.yml +++ /dev/null @@ -1,279 +0,0 @@ -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: - - thread - contract: - - exception - - thread - coroutine: - - context - - exception - - system - - thread - date_time: [] - exception: [] - fiber: - - context - - filesystem - fiber_numa: - - fiber - filesystem: - - system - graph: - - math - - random - - regex - - serialization - graph_parallel: - - filesystem - - graph - - mpi - - random - - serialization - iostreams: - - random - - regex - json: - - container - - exception - - system - locale: - - thread - log: - - atomic - - container - - date_time - - exception - - filesystem - - locale - - random - - regex - - system - - thread - log_setup: - - log - math: - - atomic - 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.76.0 diff --git a/recipes/boost/all/dependencies/dependencies-1.77.0.yml b/recipes/boost/all/dependencies/dependencies-1.77.0.yml deleted file mode 100644 index 921d8f4f45b12..0000000000000 --- a/recipes/boost/all/dependencies/dependencies-1.77.0.yml +++ /dev/null @@ -1,277 +0,0 @@ -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 - - thread - 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 - - exception - - 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.77.0 diff --git a/recipes/boost/all/dependencies/dependencies-1.81.0.yml b/recipes/boost/all/dependencies/dependencies-1.81.0.yml index 16982d7c5bc84..838c68bc7e432 100644 --- a/recipes/boost/all/dependencies/dependencies-1.81.0.yml +++ b/recipes/boost/all/dependencies/dependencies-1.81.0.yml @@ -29,6 +29,7 @@ configure_options: - thread - timer - type_erasure +- url - wave dependencies: atomic: [] @@ -149,6 +150,8 @@ dependencies: - prg_exec_monitor - test - test_exec_monitor + url: + - system wave: - filesystem - serialization @@ -250,6 +253,8 @@ libs: - boost_type_erasure unit_test_framework: - boost_unit_test_framework + url: + - boost_url wave: - boost_wave wserialization: diff --git a/recipes/boost/all/dependencies/dependencies-1.82.0.yml b/recipes/boost/all/dependencies/dependencies-1.82.0.yml new file mode 100644 index 0000000000000..02d6958cfca28 --- /dev/null +++ b/recipes/boost/all/dependencies/dependencies-1.82.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.82.0 diff --git a/recipes/boost/all/dependencies/dependencies-1.83.0.yml b/recipes/boost/all/dependencies/dependencies-1.83.0.yml new file mode 100644 index 0000000000000..7200adb04009d --- /dev/null +++ b/recipes/boost/all/dependencies/dependencies-1.83.0.yml @@ -0,0 +1,278 @@ +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: [] + 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.83.0 diff --git a/recipes/boost/all/dependencies/dependencies-1.84.0.yml b/recipes/boost/all/dependencies/dependencies-1.84.0.yml new file mode 100644 index 0000000000000..064fb7bca5d2a --- /dev/null +++ b/recipes/boost/all/dependencies/dependencies-1.84.0.yml @@ -0,0 +1,283 @@ +configure_options: +- atomic +- chrono +- cobalt +- 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 + cobalt: + - container + - 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 + - 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: [] + 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 + cobalt: + - boost_cobalt + 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.84.0 diff --git a/recipes/boost/all/dependencies/dependencies-1.85.0.yml b/recipes/boost/all/dependencies/dependencies-1.85.0.yml new file mode 100644 index 0000000000000..2306346f43372 --- /dev/null +++ b/recipes/boost/all/dependencies/dependencies-1.85.0.yml @@ -0,0 +1,291 @@ +configure_options: +- atomic +- charconv +- chrono +- cobalt +- 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: [] + charconv: [] + chrono: + - system + cobalt: + - container + - 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 + - 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_from_exception: + - 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: [] + type_erasure: + - thread + unit_test_framework: + - prg_exec_monitor + - test + - test_exec_monitor + url: + - system + wave: + - filesystem + - serialization + wserialization: + - serialization +libs: + atomic: + - boost_atomic + charconv: + - boost_charconv + chrono: + - boost_chrono + cobalt: + - boost_cobalt + 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_from_exception: + - boost_stacktrace_from_exception + 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.85.0 diff --git a/recipes/boost/all/dependencies/dependencies-1.86.0.yml b/recipes/boost/all/dependencies/dependencies-1.86.0.yml new file mode 100644 index 0000000000000..ae5b6de30e121 --- /dev/null +++ b/recipes/boost/all/dependencies/dependencies-1.86.0.yml @@ -0,0 +1,298 @@ +configure_options: +- atomic +- charconv +- chrono +- cobalt +- container +- context +- contract +- coroutine +- date_time +- exception +- fiber +- filesystem +- graph +- graph_parallel +- iostreams +- json +- locale +- log +- math +- mpi +- nowide +- process +- program_options +- python +- random +- regex +- serialization +- stacktrace +- system +- test +- thread +- timer +- type_erasure +- url +- wave +dependencies: + atomic: [] + charconv: [] + chrono: + - system + cobalt: + - container + - context + - 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 + - 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 + process: + - filesystem + - system + program_options: [] + python: [] + random: + - system + regex: [] + serialization: [] + stacktrace: [] + stacktrace_addr2line: + - stacktrace + stacktrace_backtrace: + - stacktrace + stacktrace_basic: + - stacktrace + stacktrace_from_exception: + - 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: [] + type_erasure: + - thread + unit_test_framework: + - prg_exec_monitor + - test + - test_exec_monitor + url: + - system + wave: + - filesystem + - serialization + wserialization: + - serialization +libs: + atomic: + - boost_atomic + charconv: + - boost_charconv + chrono: + - boost_chrono + cobalt: + - boost_cobalt + 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 + process: + - boost_process + 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_from_exception: + - boost_stacktrace_from_exception + 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.86.0 diff --git a/recipes/boost/all/patches/0001-beast-fix-moved-from-executor.patch b/recipes/boost/all/patches/0001-beast-fix-moved-from-executor.patch deleted file mode 100644 index 4ceb88f6e3d75..0000000000000 --- a/recipes/boost/all/patches/0001-beast-fix-moved-from-executor.patch +++ /dev/null @@ -1,89 +0,0 @@ -diff -Naur a/boost/beast/websocket/impl/ping.hpp b/boost/beast/websocket/impl/ping.hpp ---- a/boost/beast/websocket/impl/ping.hpp 2019-05-06 22:01:43.435117251 -0400 -+++ b/boost/beast/websocket/impl/ping.hpp 2019-05-06 22:02:37.949433556 -0400 -@@ -176,7 +176,8 @@ - impl.op_idle_ping.emplace(std::move(*this)); - impl.wr_block.lock(this); - BOOST_ASIO_CORO_YIELD -- net::post(this->get(), std::move(*this)); -+ net::post( -+ this->get_executor(), std::move(*this)); - BOOST_ASSERT(impl.wr_block.is_locked(this)); - } - if(impl.check_stop_now(ec)) -diff -Naur a/libs/beast/CHANGELOG.md b/libs/beast/CHANGELOG.md ---- a/libs/beast/CHANGELOG.md 2019-05-06 22:02:54.332528615 -0400 -+++ b/libs/beast/CHANGELOG.md 2019-05-06 22:03:05.896595711 -0400 -@@ -1,3 +1,10 @@ -+Version 248-hf1: -+ -+* Add idle ping suspend test -+* Fix moved-from executor in idle ping timeout -+ -+-------------------------------------------------------------------------------- -+ - Version 248: - - * Don't use a moved-from handler -diff -Naur a/libs/beast/test/beast/websocket/ping.cpp b/libs/beast/test/beast/websocket/ping.cpp ---- a/libs/beast/test/beast/websocket/ping.cpp 2019-05-06 22:02:54.342528673 -0400 -+++ b/libs/beast/test/beast/websocket/ping.cpp 2019-05-06 22:03:05.908595781 -0400 -@@ -10,8 +10,11 @@ - // Test that header file is self-contained. - #include - -+#include -+ - #include "test.hpp" - -+#include - #include - #include - -@@ -366,6 +369,46 @@ - BEAST_EXPECT(count == 3); - }); - -+ // suspend idle ping -+ { -+ using socket_type = -+ net::basic_stream_socket< -+ net::ip::tcp, -+ net::executor>; -+ net::io_context ioc; -+ stream ws1(ioc); -+ stream ws2(ioc); -+ ws1.set_option(stream_base::timeout{ -+ stream_base::none(), -+ std::chrono::seconds(0), -+ true}); -+ test::connect( -+ ws1.next_layer(), -+ ws2.next_layer()); -+ ws1.async_handshake("localhost", "/", -+ [](error_code){}); -+ ws2.async_accept([](error_code){}); -+ ioc.run(); -+ ioc.restart(); -+ flat_buffer b1; -+ auto mb = b1.prepare(65536); -+ std::memset(mb.data(), 0, mb.size()); -+ b1.commit(65536); -+ ws1.async_write(b1.data(), -+ [&](error_code, std::size_t){}); -+ BEAST_EXPECT( -+ ws1.impl_->wr_block.is_locked()); -+ ws1.async_read_some(net::mutable_buffer{}, -+ [&](error_code, std::size_t){}); -+ ioc.run(); -+ ioc.restart(); -+ flat_buffer b2; -+ ws2.async_read(b2, -+ [&](error_code, std::size_t){}); -+ ioc.run(); -+ } -+ //); -+ - { - echo_server es{log, kind::async}; - net::io_context ioc; diff --git a/recipes/boost/all/patches/0001-revert-cease-dependence-on-range.patch b/recipes/boost/all/patches/0001-revert-cease-dependence-on-range.patch deleted file mode 100644 index fd069197a95a0..0000000000000 --- a/recipes/boost/all/patches/0001-revert-cease-dependence-on-range.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 188eac4acf37313fcec27d7b266c6517b99ed23d Mon Sep 17 00:00:00 2001 -From: Oliver Kowalke -Date: Sun, 1 Dec 2019 20:40:28 +0100 -Subject: [PATCH] Revert "Cease dependence on Range" - -This reverts commit 0c556bb59241e682bbcd3f572815149c5a9b17db. - -see #44 (One test fails to compile after boostorg/coroutine submodule updated) ---- - boost/coroutine/asymmetric_coroutine.hpp | 12 +++--------- - 1 file changed, 3 insertions(+), 9 deletions(-) - -diff --git a/boost/coroutine/asymmetric_coroutine.hpp b/boost/coroutine/asymmetric_coroutine.hpp -index f2ae16f..78b1842 100644 ---- a/boost/coroutine/asymmetric_coroutine.hpp -+++ b/boost/coroutine/asymmetric_coroutine.hpp -@@ -14,6 +14,7 @@ - #include - #include - #include -+#include - #include - #include - -@@ -2390,19 +2391,12 @@ end( push_coroutine< R > & c) - - } - --// forward declaration of Boost.Range traits to break dependency on it --template --struct range_mutable_iterator; -- --template --struct range_const_iterator; -- - template< typename Arg > --struct range_mutable_iterator< coroutines::push_coroutine< Arg >, void > -+struct range_mutable_iterator< coroutines::push_coroutine< Arg > > - { typedef typename coroutines::push_coroutine< Arg >::iterator type; }; - - template< typename R > --struct range_mutable_iterator< coroutines::pull_coroutine< R >, void > -+struct range_mutable_iterator< coroutines::pull_coroutine< R > > - { typedef typename coroutines::pull_coroutine< R >::iterator type; }; - - } --- -2.21.0 - diff --git a/recipes/boost/all/patches/1.69.0-contract-no-system.patch b/recipes/boost/all/patches/1.69.0-contract-no-system.patch deleted file mode 100644 index d98fe7b2f7e3e..0000000000000 --- a/recipes/boost/all/patches/1.69.0-contract-no-system.patch +++ /dev/null @@ -1,11 +0,0 @@ -This library links to boost_system, even though that library is header-only. ---- libs/contract/build/Jamfile.v2 -+++ libs/contract/build/Jamfile.v2 -@@ -18,5 +18,5 @@ - ; - - # If lib as header-only, none of following will be used. --lib boost_contract : contract.cpp : shared /boost//system ; --lib boost_contract : contract.cpp : static /boost//system ; -+lib boost_contract : contract.cpp : shared ; -+lib boost_contract : contract.cpp : static ; diff --git a/recipes/boost/all/patches/1.69.0-random-no-system.patch b/recipes/boost/all/patches/1.69.0-random-no-system.patch deleted file mode 100644 index ad03e39931654..0000000000000 --- a/recipes/boost/all/patches/1.69.0-random-no-system.patch +++ /dev/null @@ -1,11 +0,0 @@ -This library links to boost_system, even though that library is header-only. ---- libs/random/build/Jamfile.v2 -+++ libs/random/build/Jamfile.v2 -@@ -13,6 +13,6 @@ - : usage-requirements shared:BOOST_RANDOM_DYN_LINK - ; - --lib boost_random : [ glob *.cpp ] /boost//system ; -+lib boost_random : [ glob *.cpp ] ; - - boost-install boost_random ; diff --git a/recipes/boost/all/patches/1.69.0-type_erasure-no-system.patch b/recipes/boost/all/patches/1.69.0-type_erasure-no-system.patch deleted file mode 100644 index c3b7cde662175..0000000000000 --- a/recipes/boost/all/patches/1.69.0-type_erasure-no-system.patch +++ /dev/null @@ -1,9 +0,0 @@ -This library links to boost_system, even though that library is header-only. ---- libs/type_erasure/build/Jamfile.v2 -+++ libs/type_erasure/build/Jamfile.v2 -@@ -12,4 +12,4 @@ - : usage-requirements shared:BOOST_TYPE_ERASURE_DYN_LINK - ; - --lib boost_type_erasure : dynamic_binding.cpp /boost//thread /boost//system ; -+lib boost_type_erasure : dynamic_binding.cpp /boost//thread ; diff --git a/recipes/boost/all/patches/1.70.0-boost_build-with-newer-b2.patch b/recipes/boost/all/patches/1.70.0-boost_build-with-newer-b2.patch deleted file mode 100644 index 11edf1b516dfb..0000000000000 --- a/recipes/boost/all/patches/1.70.0-boost_build-with-newer-b2.patch +++ /dev/null @@ -1,51 +0,0 @@ ---- tools/build/src/build/configure.jam.orig 2019-04-09 15:36:57.000000000 -0400 -+++ tools/build/src/build/configure.jam 2022-01-28 20:51:10.924240100 -0500 -@@ -452,7 +452,7 @@ - return [ find-builds-raw $(p) : $(ps) : $(what) : - $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) : - $(10) : $(11) : $(12) : $(13) : $(14) : $(15) : -- $(16) : $(17) : $(18) : $(19) ] ; -+ $(16) : $(17) : $(18) ] ; - } - - -@@ -510,7 +510,7 @@ - rule __init__ ( message : * ) - { - self.message = $(message) ; -- for i in 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 -+ for i in 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 - { - local name = [ CALC $(i) - 1 ] ; - self.targets.$(name) = $($(i)[1]) ; -@@ -527,7 +527,7 @@ - } - rule all-properties ( ) - { -- local i = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 ; -+ local i = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 ; - return $(self.props.$(i)) ; - } - rule check ( properties * ) -@@ -549,9 +549,7 @@ - : $(self.targets.14) $(self.what.14) - : $(self.targets.15) $(self.what.15) - : $(self.targets.16) $(self.what.16) -- : $(self.targets.17) $(self.what.17) -- : $(self.targets.18) $(self.what.18) -- : $(self.targets.19) $(self.what.19) ] ; -+ : $(self.targets.17) $(self.what.17) ] ; - if $(self.props.$(i)) - { - return [ property.evaluate-conditionals-in-context $(self.props.$(i)) : $(properties) ] ; ---- tools/build/src/util/indirect.jam.orig 2020-12-03 00:02:49.000000000 -0500 -+++ tools/build/src/util/indirect.jam 2022-01-28 20:32:41.249509200 -0500 -@@ -102,7 +102,7 @@ - { - return [ modules.call-in [ get-module $(r) ] : [ get-rule $(r) ] $(args) : - $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) : $(10) : $(11) : -- $(12) : $(13) : $(14) : $(15) : $(16) : $(17) : $(18) : $(19) ] ; -+ $(12) : $(13) : $(14) : $(15) : $(16) : $(17) : $(18) ] ; - } - - diff --git a/recipes/boost/all/patches/1.75.0-boost_build-with-newer-b2.patch b/recipes/boost/all/patches/1.75.0-boost_build-with-newer-b2.patch deleted file mode 100644 index 4c22c748fe894..0000000000000 --- a/recipes/boost/all/patches/1.75.0-boost_build-with-newer-b2.patch +++ /dev/null @@ -1,51 +0,0 @@ ---- tools/build/src/build/configure.jam.orig 2020-12-03 00:02:49.000000000 -0500 -+++ tools/build/src/build/configure.jam 2022-01-28 20:32:41.260634800 -0500 -@@ -454,7 +454,7 @@ - return [ find-builds-raw $(p) : $(ps) : $(what) : - $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) : - $(10) : $(11) : $(12) : $(13) : $(14) : $(15) : -- $(16) : $(17) : $(18) : $(19) ] ; -+ $(16) : $(17) : $(18) ] ; - } - - -@@ -518,7 +518,7 @@ - { - local project = [ project.current ] ; - self.message = $(message) ; -- for i in 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 -+ for i in 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 - { - local name = [ CALC $(i) - 1 ] ; - self.targets.$(name) = $($(i)[1]) ; -@@ -537,7 +537,7 @@ - } - rule all-properties ( ) - { -- local i = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 ; -+ local i = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 ; - return $(self.props.$(i)) ; - } - rule check ( properties * ) -@@ -559,9 +559,7 @@ - : $(self.targets.14) $(self.what.14) - : $(self.targets.15) $(self.what.15) - : $(self.targets.16) $(self.what.16) -- : $(self.targets.17) $(self.what.17) -- : $(self.targets.18) $(self.what.18) -- : $(self.targets.19) $(self.what.19) ] ; -+ : $(self.targets.17) $(self.what.17) ] ; - if $(self.props.$(i)) - { - return [ property.evaluate-conditionals-in-context $(self.props.$(i)) : $(properties) ] ; ---- tools/build/src/util/indirect.jam.orig 2020-12-03 00:02:49.000000000 -0500 -+++ tools/build/src/util/indirect.jam 2022-01-28 20:32:41.249509200 -0500 -@@ -102,7 +102,7 @@ - { - return [ modules.call-in [ get-module $(r) ] : [ get-rule $(r) ] $(args) : - $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) : $(10) : $(11) : -- $(12) : $(13) : $(14) : $(15) : $(16) : $(17) : $(18) : $(19) ] ; -+ $(12) : $(13) : $(14) : $(15) : $(16) : $(17) : $(18) ] ; - } - - diff --git a/recipes/boost/all/patches/1.77.0-boost_build-with-newer-b2.patch b/recipes/boost/all/patches/1.77.0-boost_build-with-newer-b2.patch deleted file mode 100644 index bdc7476f27137..0000000000000 --- a/recipes/boost/all/patches/1.77.0-boost_build-with-newer-b2.patch +++ /dev/null @@ -1,51 +0,0 @@ ---- tools/build/src/build/configure.jam.orig 2021-08-05 05:42:46.000000000 -0400 -+++ tools/build/src/build/configure.jam 2022-01-28 19:55:37.960877600 -0500 -@@ -467,7 +467,7 @@ - return [ find-builds-raw $(p) : $(ps) : $(what) : - $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) : - $(10) : $(11) : $(12) : $(13) : $(14) : $(15) : -- $(16) : $(17) : $(18) : $(19) ] ; -+ $(16) : $(17) : $(18) ] ; - } - - -@@ -531,7 +531,7 @@ - { - local project = [ project.current ] ; - self.message = $(message) ; -- for i in 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 -+ for i in 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 - { - local name = [ CALC $(i) - 1 ] ; - self.targets.$(name) = $($(i)[1]) ; -@@ -550,7 +550,7 @@ - } - rule all-properties ( ) - { -- local i = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 ; -+ local i = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 ; - return $(self.props.$(i)) ; - } - rule check ( properties * ) -@@ -572,9 +572,7 @@ - : $(self.targets.14) $(self.what.14) - : $(self.targets.15) $(self.what.15) - : $(self.targets.16) $(self.what.16) -- : $(self.targets.17) $(self.what.17) -- : $(self.targets.18) $(self.what.18) -- : $(self.targets.19) $(self.what.19) ] ; -+ : $(self.targets.17) $(self.what.17) ] ; - if $(self.props.$(i)) - { - return [ property.evaluate-conditionals-in-context $(self.props.$(i)) : $(properties) ] ; ---- tools/build/src/util/indirect.jam.orig 2021-08-05 05:42:46.000000000 -0400 -+++ tools/build/src/util/indirect.jam 2021-12-02 01:48:03.000000000 -0500 -@@ -102,7 +102,7 @@ - { - return [ modules.call-in [ get-module $(r) ] : [ get-rule $(r) ] $(args) : - $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) : $(10) : $(11) : -- $(12) : $(13) : $(14) : $(15) : $(16) : $(17) : $(18) : $(19) ] ; -+ $(12) : $(13) : $(14) : $(15) : $(16) : $(17) : $(18) ] ; - } - - .parts_regex = "^([^@]*)@" "([^%]*)%" "([^%]+)$" ; diff --git a/recipes/boost/all/patches/1.80.0-0005-config-libcpp15.patch b/recipes/boost/all/patches/1.80.0-0005-config-libcpp15.patch new file mode 100644 index 0000000000000..1e84702f8b06b --- /dev/null +++ b/recipes/boost/all/patches/1.80.0-0005-config-libcpp15.patch @@ -0,0 +1,16 @@ +--- a/boost/config/stdlib/libcpp.hpp 2022-08-03 22:47:07.000000000 -0400 ++++ b/boost/config/stdlib/libcpp.hpp 2022-09-16 22:16:17.044119011 -0400 +@@ -168,4 +168,13 @@ + # define BOOST_NO_CXX14_HDR_SHARED_MUTEX + #endif + ++#if _LIBCPP_VERSION >= 15000 ++// ++// Unary function is now deprecated in C++11 and later: ++// ++#if __cplusplus >= 201103L ++#define BOOST_NO_CXX98_FUNCTION_BASE ++#endif ++#endif ++ + // --- end --- diff --git a/recipes/boost/all/patches/1.80.0-0006-unordered-msvc-rtcc.patch b/recipes/boost/all/patches/1.80.0-0006-unordered-msvc-rtcc.patch new file mode 100644 index 0000000000000..ff133016a2022 --- /dev/null +++ b/recipes/boost/all/patches/1.80.0-0006-unordered-msvc-rtcc.patch @@ -0,0 +1,18 @@ +--- a/boost/unordered/detail/prime_fmod.hpp 2022-08-03 22:47:16.000000000 -0400 ++++ b/boost/unordered/detail/prime_fmod.hpp 2022-12-14 01:45:27.368620146 -0500 +@@ -117,9 +117,15 @@ + #if defined(BOOST_UNORDERED_FCA_HAS_64B_SIZE_T) + std::size_t sizes_under_32bit = inv_sizes32_len; + if (BOOST_LIKELY(size_index < sizes_under_32bit)) { ++#if defined(__MSVC_RUNTIME_CHECKS) ++ return fast_modulo( ++ boost::uint32_t(hash & 0xffffffffu) + boost::uint32_t(hash >> 32), ++ inv_sizes32[size_index], boost::uint32_t(sizes[size_index])); ++#else + return fast_modulo( + boost::uint32_t(hash) + boost::uint32_t(hash >> 32), + inv_sizes32[size_index], boost::uint32_t(sizes[size_index])); ++#endif + } else { + return positions[size_index - sizes_under_32bit](hash); + } diff --git a/recipes/boost/all/patches/1.82.0-locale-iconv-library-option.patch b/recipes/boost/all/patches/1.82.0-locale-iconv-library-option.patch new file mode 100644 index 0000000000000..80b22dd54b0e1 --- /dev/null +++ b/recipes/boost/all/patches/1.82.0-locale-iconv-library-option.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/patches/1.83.0-locale-msvc.patch b/recipes/boost/all/patches/1.83.0-locale-msvc.patch new file mode 100644 index 0000000000000..acb9510e6eb2f --- /dev/null +++ b/recipes/boost/all/patches/1.83.0-locale-msvc.patch @@ -0,0 +1,22 @@ +From 0552ffc29ff11e4fe130b7143ea6ac2bee7b15c6 Mon Sep 17 00:00:00 2001 +From: wevsty +Date: Sat, 12 Aug 2023 22:13:48 +0800 +Subject: [PATCH] fix build error on MSVC + +--- + boost/locale/util/string.hpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/boost/locale/util/string.hpp b/boost/locale/util/string.hpp +index 9ab9521c..ba066bd4 100644 +--- a/boost/locale/util/string.hpp ++++ b/boost/locale/util/string.hpp +@@ -38,7 +38,7 @@ namespace boost { namespace locale { namespace util { + /// Cast an unsigned char to a (possibly signed) char avoiding implementation defined behavior + constexpr char to_char(unsigned char c) + { +- return static_cast((c - std::numeric_limits::min()) + std::numeric_limits::min()); ++ return static_cast((c - (std::numeric_limits::min)()) + (std::numeric_limits::min)()); + } + + }}} // namespace boost::locale::util diff --git a/recipes/boost/all/patches/1.84.0-reimplement-string_set-as-any-string.patch b/recipes/boost/all/patches/1.84.0-reimplement-string_set-as-any-string.patch new file mode 100644 index 0000000000000..15393721de8ee --- /dev/null +++ b/recipes/boost/all/patches/1.84.0-reimplement-string_set-as-any-string.patch @@ -0,0 +1,337 @@ +Fixes compilation with cppstd=20 on MacOS + +From c5e8f02c903696a213fc4b710f6740ccd1f07f4e Mon Sep 17 00:00:00 2001 +From: Alexander Grund +Date: Sun, 3 Dec 2023 20:06:27 +0100 +Subject: [PATCH] Reimplement `string_set` as `any_string` + +Use a better name for a type-erased string implemented using +`dynamic_cast` instead of storing&comparing the `typeid` of the char +type used. +This is a workaround for missing typeinfo for `char8_t` on e.g. libc++ +on FreeBSD 13.1. +It also simplifies memory management size calc/copy implementation. +--- + boost/locale/detail/any_string.hpp | 71 ++++++++++++++++++++++ + boost/locale/formatting.hpp | 51 ++-------------- + libs/locale/src/boost/locale/formatting.cpp | 45 -------------- + libs/locale/test/test_ios_info.cpp | 64 +++++++++++++++---- + 4 files changed, 127 insertions(+), 104 deletions(-) + create mode 100644 boost/locale/detail/any_string.hpp + +diff --git a/boost/locale/detail/any_string.hpp b/boost/locale/detail/any_string.hpp +new file mode 100644 +index 00000000..c0cc7ffb +--- /dev/null ++++ b/boost/locale/detail/any_string.hpp +@@ -0,0 +1,71 @@ ++// ++// Copyright (c) 2023 Alexander Grund ++// ++// Distributed under the Boost Software License, Version 1.0. ++// https://www.boost.org/LICENSE_1_0.txt ++ ++#ifndef BOOST_LOCALE_DETAIL_ANY_STRING_HPP_INCLUDED ++#define BOOST_LOCALE_DETAIL_ANY_STRING_HPP_INCLUDED ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++/// \cond INTERNAL ++namespace boost { namespace locale { namespace detail { ++ /// Type-erased std::basic_string ++ class any_string { ++ struct BOOST_SYMBOL_VISIBLE base { ++ virtual ~base() = default; ++ virtual base* clone() const = 0; ++ ++ protected: ++ base() = default; ++ base(const base&) = default; ++ base(base&&) = delete; ++ base& operator=(const base&) = default; ++ base& operator=(base&&) = delete; ++ }; ++ template ++ struct BOOST_SYMBOL_VISIBLE impl : base { ++ explicit impl(const boost::basic_string_view value) : s(value) {} ++ impl* clone() const override { return new impl(*this); } ++ std::basic_string s; ++ }; ++ ++ std::unique_ptr s_; ++ ++ public: ++ any_string() = default; ++ any_string(const any_string& other) : s_(other.s_ ? other.s_->clone() : nullptr) {} ++ any_string(any_string&&) = default; ++ any_string& operator=(any_string other) // Covers the copy and move assignment ++ { ++ s_.swap(other.s_); ++ return *this; ++ } ++ ++ template ++ void set(const boost::basic_string_view s) ++ { ++ BOOST_ASSERT(!s.empty()); ++ s_.reset(new impl(s)); ++ } ++ ++ template ++ std::basic_string get() const ++ { ++ if(!s_) ++ throw std::bad_cast(); ++ return dynamic_cast&>(*s_).s; ++ } ++ }; ++ ++}}} // namespace boost::locale::detail ++ ++/// \endcond ++ ++#endif +diff --git a/boost/locale/formatting.hpp b/boost/locale/formatting.hpp +index d14e6f69..e3c8619e 100644 +--- a/boost/locale/formatting.hpp ++++ b/boost/locale/formatting.hpp +@@ -8,15 +8,13 @@ + #ifndef BOOST_LOCALE_FORMATTING_HPP_INCLUDED + #define BOOST_LOCALE_FORMATTING_HPP_INCLUDED + ++#include + #include +-#include +-#include + #include + #include + #include + #include + #include +-#include + + #ifdef BOOST_MSVC + # pragma warning(push) +@@ -130,13 +128,13 @@ namespace boost { namespace locale { + template + void date_time_pattern(const std::basic_string& str) + { +- date_time_pattern_set().set(str); ++ datetime_.set(str); + } + /// Get date/time pattern (strftime like) + template + std::basic_string date_time_pattern() const + { +- return date_time_pattern_set().get(); ++ return datetime_.get(); + } + + /// \cond INTERNAL +@@ -144,51 +142,10 @@ namespace boost { namespace locale { + /// \endcond + + private: +- class string_set; +- +- const string_set& date_time_pattern_set() const; +- string_set& date_time_pattern_set(); +- +- class BOOST_LOCALE_DECL string_set { +- public: +- string_set(); +- ~string_set(); +- string_set(const string_set& other); +- string_set& operator=(string_set other); +- void swap(string_set& other); +- +- template +- void set(const boost::basic_string_view s) +- { +- BOOST_ASSERT(!s.empty()); +- delete[] ptr; +- ptr = nullptr; +- type = &typeid(Char); +- size = sizeof(Char) * s.size(); +- ptr = size ? new char[size] : nullptr; +- memcpy(ptr, s.data(), size); +- } +- +- template +- std::basic_string get() const +- { +- if(type == nullptr || *type != typeid(Char)) +- throw std::bad_cast(); +- std::basic_string result(size / sizeof(Char), Char(0)); +- memcpy(&result.front(), ptr, size); +- return result; +- } +- +- private: +- const std::type_info* type; +- size_t size; +- char* ptr; +- }; +- + uint64_t flags_; + int domain_id_; + std::string time_zone_; +- string_set datetime_; ++ detail::any_string datetime_; + }; + + /// \brief This namespace includes all manipulators that can be used on IO streams +diff --git a/src/boost/locale/shared/formatting.cpp b/src/boost/locale/shared/formatting.cpp +index 489d1fd5..457ba782 100644 +--- a/libs/locale/src/boost/locale/shared/formatting.cpp ++++ b/libs/locale/src/boost/locale/shared/formatting.cpp +@@ -7,43 +7,8 @@ + #include + #include + #include "boost/locale/shared/ios_prop.hpp" +-#include +-#include + + namespace boost { namespace locale { +- +- ios_info::string_set::string_set() : type(nullptr), size(0), ptr(nullptr) {} +- ios_info::string_set::~string_set() +- { +- delete[] ptr; +- } +- ios_info::string_set::string_set(const string_set& other) +- { +- if(other.ptr != nullptr) { +- ptr = new char[other.size]; +- size = other.size; +- type = other.type; +- memcpy(ptr, other.ptr, size); +- } else { +- ptr = nullptr; +- size = 0; +- type = nullptr; +- } +- } +- +- void ios_info::string_set::swap(string_set& other) +- { +- std::swap(type, other.type); +- std::swap(size, other.size); +- std::swap(ptr, other.ptr); +- } +- +- ios_info::string_set& ios_info::string_set::operator=(string_set other) +- { +- swap(other); +- return *this; +- } +- + ios_info::ios_info() : flags_(0), domain_id_(0), time_zone_(time_zone::global()) {} + + ios_info::~ios_info() = default; +@@ -105,16 +70,6 @@ namespace boost { namespace locale { + return time_zone_; + } + +- const ios_info::string_set& ios_info::date_time_pattern_set() const +- { +- return datetime_; +- } +- +- ios_info::string_set& ios_info::date_time_pattern_set() +- { +- return datetime_; +- } +- + ios_info& ios_info::get(std::ios_base& ios) + { + return impl::ios_prop::get(ios); +diff --git a/libs/locale/test/test_ios_info.cpp b/libs/locale/test/test_ios_info.cpp +index 9b63aaed..79179a8f 100644 +--- a/libs/locale/test/test_ios_info.cpp ++++ b/libs/locale/test/test_ios_info.cpp +@@ -105,18 +105,6 @@ void test_member_methods() + + info.date_time_pattern(std::string("Pattern")); + TEST_EQ(info.date_time_pattern(), "Pattern"); +- +- info.date_time_pattern(ascii_to("WChar Pattern")); +- TEST_EQ(info.date_time_pattern(), ascii_to("WChar Pattern")); +- TEST_THROWS(info.date_time_pattern(), std::bad_cast); +- +- info.date_time_pattern(ascii_to("Char16 Pattern")); +- TEST_THROWS(info.date_time_pattern(), std::bad_cast); +- TEST_EQ(info.date_time_pattern(), ascii_to("Char16 Pattern")); +- +- info.date_time_pattern(ascii_to("Char32 Pattern")); +- TEST_THROWS(info.date_time_pattern(), std::bad_cast); +- TEST_EQ(info.date_time_pattern(), ascii_to("Char32 Pattern")); + } + } + +@@ -212,8 +200,60 @@ void test_manipulators() + TEST_EQ(info2.date_time_pattern(), L"My TZ"); + } + ++void test_any_string() ++{ ++ boost::locale::detail::any_string s; ++ TEST_THROWS(s.get(), std::bad_cast); ++ TEST_THROWS(s.get(), std::bad_cast); ++ ++ s.set("Char Pattern"); ++ TEST_EQ(s.get(), "Char Pattern"); ++ TEST_THROWS(s.get(), std::bad_cast); ++ ++ s.set(ascii_to("WChar Pattern")); ++ TEST_EQ(s.get(), ascii_to("WChar Pattern")); ++ TEST_THROWS(s.get(), std::bad_cast); ++ ++ s.set(ascii_to("Char16 Pattern")); ++ TEST_EQ(s.get(), ascii_to("Char16 Pattern")); ++ TEST_THROWS(s.get(), std::bad_cast); ++ ++ s.set(ascii_to("Char32 Pattern")); ++ TEST_EQ(s.get(), ascii_to("Char32 Pattern")); ++ TEST_THROWS(s.get(), std::bad_cast); ++ ++#ifndef BOOST_LOCALE_NO_CXX20_STRING8 ++ s.set(ascii_to("Char8 Pattern")); ++ TEST_EQ(s.get(), ascii_to("Char8 Pattern")); ++ TEST_THROWS(s.get(), std::bad_cast); ++#endif ++ ++ boost::locale::detail::any_string s1, s2, empty; ++ s1.set("Char"); ++ s2.set(ascii_to("WChar")); ++ // Copy ctor ++ boost::locale::detail::any_string s3(s1); ++ TEST_EQ(s3.get(), "Char"); ++ TEST_EQ(s1.get(), "Char"); ++ // Ensure deep copy ++ s3.set("Foo"); ++ TEST_EQ(s3.get(), "Foo"); ++ TEST_EQ(s1.get(), "Char"); ++ // Copy assign ++ s3 = s2; ++ TEST_EQ(s3.get(), ascii_to("WChar")); ++ TEST_EQ(s2.get(), ascii_to("WChar")); ++ // Move assign ++ s3 = std::move(s1); ++ TEST_EQ(s3.get(), "Char"); ++ // From empty ++ s3 = empty; ++ TEST_THROWS(s3.get(), std::bad_cast); ++} ++ + void test_main(int /*argc*/, char** /*argv*/) + { ++ test_any_string(); + test_member_methods(); + test_manipulators(); + } diff --git a/recipes/boost/all/patches/1.85.0-container-aliasing-violation-fix.patch b/recipes/boost/all/patches/1.85.0-container-aliasing-violation-fix.patch new file mode 100644 index 0000000000000..aa3c821fde524 --- /dev/null +++ b/recipes/boost/all/patches/1.85.0-container-aliasing-violation-fix.patch @@ -0,0 +1,417 @@ +From a92131b34b78f7f010881750ecb8b4ce274511d2 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= +Date: Sun, 28 Apr 2024 23:29:59 +0200 +Subject: [PATCH 1/1] Remove UB in flat_map implementation when the + implementation has a movable std::pair + +--- + boost/container/allocator_traits.hpp | 144 +++++++++++++++++- + boost/container/detail/construct_in_place.hpp | 36 ++++- + boost/container/flat_map.hpp | 67 ++++++-- + 3 files changed, 229 insertions(+), 18 deletions(-) + +diff --git a/boost/container/allocator_traits.hpp b/boost/container/allocator_traits.hpp +index cdb6683e8..8e2fafa7f 100644 +--- a/boost/container/allocator_traits.hpp ++++ b/boost/container/allocator_traits.hpp +@@ -32,6 +32,8 @@ + #include + #include //is_empty + #include ++#include ++#include + #ifndef BOOST_CONTAINER_DETAIL_STD_FWD_HPP + #include + #endif +@@ -81,6 +83,144 @@ + + namespace boost { + namespace container { ++namespace dtl { ++ ++#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) ++ ++template ++BOOST_CONTAINER_FORCEINLINE void construct_type(T *p, BOOST_FWD_REF(Args) ...args) ++{ ++ ::new((void*)p, boost_container_new_t()) T(::boost::forward(args)...); ++} ++ ++template < class Pair, class KeyType, class ... Args> ++typename dtl::enable_if< dtl::is_pair, void >::type ++construct_type ++ (Pair* p, try_emplace_t, BOOST_FWD_REF(KeyType) k, BOOST_FWD_REF(Args) ...args) ++{ ++ construct_type(dtl::addressof(p->first), ::boost::forward(k)); ++ BOOST_CONTAINER_TRY{ ++ construct_type(dtl::addressof(p->second), ::boost::forward(args)...); ++ } ++ BOOST_CONTAINER_CATCH(...) { ++ typedef typename Pair::first_type first_type; ++ dtl::addressof(p->first)->~first_type(); ++ BOOST_CONTAINER_RETHROW ++ } ++ BOOST_CONTAINER_CATCH_END ++} ++ ++#else ++ ++#define BOOST_CONTAINER_ALLOCATOR_TRAITS_CONSTRUCT_TYPEJ(N) \ ++template\ ++BOOST_CONTAINER_FORCEINLINE \ ++ typename dtl::disable_if_c::value, void >::type \ ++construct_type(T *p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ ++{\ ++ ::new((void*)p, boost_container_new_t()) T( BOOST_MOVE_FWD##N );\ ++}\ ++// ++BOOST_MOVE_ITERATE_0TO8(BOOST_CONTAINER_ALLOCATOR_TRAITS_CONSTRUCT_TYPEJ) ++#undef BOOST_CONTAINER_ALLOCATOR_TRAITS_CONSTRUCT_TYPEJ ++ ++#define BOOST_CONTAINER_ALLOCATOR_TRAITS_CONSTRUCT_TYPE(N) \ ++template < class Pair, class KeyType BOOST_MOVE_I##N BOOST_MOVE_CLASS##N>\ ++typename dtl::enable_if< dtl::is_pair, void >::type construct_type\ ++ (Pair* p, try_emplace_t, BOOST_FWD_REF(KeyType) k BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ ++{\ ++ construct_type(dtl::addressof(p->first), ::boost::forward(k));\ ++ BOOST_CONTAINER_TRY{\ ++ construct_type(dtl::addressof(p->second) BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\ ++ }\ ++ BOOST_CONTAINER_CATCH(...) {\ ++ typedef typename Pair::first_type first_type;\ ++ dtl::addressof(p->first)->~first_type();\ ++ BOOST_CONTAINER_RETHROW\ ++ }\ ++ BOOST_CONTAINER_CATCH_END\ ++}\ ++// ++BOOST_MOVE_ITERATE_0TO8(BOOST_CONTAINER_ALLOCATOR_TRAITS_CONSTRUCT_TYPE) ++#undef BOOST_CONTAINER_ALLOCATOR_TRAITS_CONSTRUCT_TYPE ++ ++#endif ++ ++template ++inline ++typename dtl::enable_if, void >::type ++construct_type(T* p) ++{ ++ dtl::construct_type(dtl::addressof(p->first)); ++ BOOST_CONTAINER_TRY{ ++ dtl::construct_type(dtl::addressof(p->second)); ++ } ++ BOOST_CONTAINER_CATCH(...) { ++ typedef typename T::first_type first_type; ++ dtl::addressof(p->first)->~first_type(); ++ BOOST_CONTAINER_RETHROW ++ } ++ BOOST_CONTAINER_CATCH_END ++} ++ ++ ++template ++inline ++typename dtl::enable_if_c ++ < dtl::is_pair::value ++ , void >::type ++construct_type(T* p, U &u) ++{ ++ dtl::construct_type(dtl::addressof(p->first), u.first); ++ BOOST_CONTAINER_TRY{ ++ dtl::construct_type(dtl::addressof(p->second), u.second); ++ } ++ BOOST_CONTAINER_CATCH(...) { ++ typedef typename T::first_type first_type; ++ dtl::addressof(p->first)->~first_type(); ++ BOOST_CONTAINER_RETHROW ++ } ++ BOOST_CONTAINER_CATCH_END ++} ++ ++template ++inline ++typename dtl::enable_if_c ++ < dtl::is_pair::type>::value && ++ !boost::move_detail::is_reference::value //This is needed for MSVC10 and ambiguous overloads ++ , void >::type ++construct_type(T* p, BOOST_RV_REF(U) u) ++{ ++ dtl::construct_type(dtl::addressof(p->first), ::boost::move(u.first)); ++ BOOST_CONTAINER_TRY{ ++ dtl::construct_type(dtl::addressof(p->second), ::boost::move(u.second)); ++ } ++ BOOST_CONTAINER_CATCH(...) { ++ typedef typename T::first_type first_type; ++ dtl::addressof(p->first)->~first_type(); ++ BOOST_CONTAINER_RETHROW ++ } ++ BOOST_CONTAINER_CATCH_END ++} ++ ++template ++inline ++typename dtl::enable_if, void >::type ++construct_type(T* p, BOOST_FWD_REF(U) x, BOOST_FWD_REF(V) y) ++{ ++ dtl::construct_type(dtl::addressof(p->first), ::boost::forward(x)); ++ BOOST_CONTAINER_TRY{ ++ dtl::construct_type(dtl::addressof(p->second), ::boost::forward(y)); ++ } ++ BOOST_CONTAINER_CATCH(...) { ++ typedef typename T::first_type first_type; ++ dtl::addressof(p->first)->~first_type(); ++ BOOST_CONTAINER_RETHROW ++ } ++ BOOST_CONTAINER_CATCH_END ++} ++ ++} //namespace dtl + + #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED + +@@ -419,7 +559,7 @@ struct allocator_traits + + template + inline static void priv_construct(dtl::false_type, Allocator &, T *p, BOOST_FWD_REF(Args) ...args) +- { ::new((void*)p, boost_container_new_t()) T(::boost::forward(args)...); } ++ { dtl::construct_type(p, ::boost::forward(args)...); } + #else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + public: + +@@ -450,7 +590,7 @@ struct allocator_traits + \ + template\ + inline static void priv_construct(dtl::false_type, Allocator &, T *p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ +- { ::new((void*)p, boost_container_new_t()) T(BOOST_MOVE_FWD##N); }\ ++ { dtl::construct_type(p BOOST_MOVE_I##N BOOST_MOVE_FWD##N); }\ + // + BOOST_MOVE_ITERATE_0TO8(BOOST_CONTAINER_ALLOCATOR_TRAITS_PRIV_CONSTRUCT_IMPL) + #undef BOOST_CONTAINER_ALLOCATOR_TRAITS_PRIV_CONSTRUCT_IMPL +diff --git a/boost/container/detail/construct_in_place.hpp b/boost/container/detail/construct_in_place.hpp +index d824d814a..bfdf05c2e 100644 +--- a/boost/container/detail/construct_in_place.hpp ++++ b/boost/container/detail/construct_in_place.hpp +@@ -24,6 +24,7 @@ + #include + #include + #include ++#include + + namespace boost { + namespace container { +@@ -62,9 +63,42 @@ BOOST_CONTAINER_FORCEINLINE void construct_in_place(Allocator &a, T *dest, empla + + //Assignment + ++template ++BOOST_CONTAINER_FORCEINLINE ++ typename dtl::disable_if_c ++ < dtl::is_pair::type>::value ++ && dtl::is_pair::type>::value ++ , void>::type ++assign_in_place_ref(T &t, BOOST_FWD_REF(U) u) ++{ t = ::boost::forward(u); } ++ ++template ++BOOST_CONTAINER_FORCEINLINE ++ typename dtl::enable_if_c ++ < dtl::is_pair::type>::value ++ && dtl::is_pair::type>::value ++ , void>::type ++assign_in_place_ref(T &t, const U &u) ++{ ++ assign_in_place_ref(t.first, u.first); ++ assign_in_place_ref(t.second, u.second); ++} ++ ++template ++BOOST_CONTAINER_FORCEINLINE ++ typename dtl::enable_if_c ++ < dtl::is_pair::type>::value ++ && dtl::is_pair::type>::value ++ , void>::type ++assign_in_place_ref(T &t, BOOST_RV_REF(U) u) ++{ ++ assign_in_place_ref(t.first, ::boost::move(u.first)); ++ assign_in_place_ref(t.second, ::boost::move(u.second)); ++} ++ + template + BOOST_CONTAINER_FORCEINLINE void assign_in_place(DstIt dest, InpIt source) +-{ *dest = *source; } ++{ assign_in_place_ref(*dest, *source); } + + template + BOOST_CONTAINER_FORCEINLINE void assign_in_place(DstIt dest, value_init_construct_iterator) +diff --git a/boost/container/flat_map.hpp b/boost/container/flat_map.hpp +index b092fb212..e4843f566 100644 +--- a/boost/container/flat_map.hpp ++++ b/boost/container/flat_map.hpp +@@ -48,6 +48,11 @@ + #include + #endif + ++#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) ++#define BOOST_CONTAINER_STD_PAIR_IS_MOVABLE ++#endif ++ ++ + namespace boost { + namespace container { + +@@ -58,21 +63,37 @@ class flat_multimap; + + namespace dtl{ + ++#if defined(BOOST_CONTAINER_STD_PAIR_IS_MOVABLE) + template + BOOST_CONTAINER_FORCEINLINE static D &force(S &s) +-{ return *move_detail::force_ptr(&s); } ++{ return s; } + + template + BOOST_CONTAINER_FORCEINLINE static const D &force(const S &s) +-{ return *move_detail::force_ptr(&s); } ++{ return s; } ++ ++template ++BOOST_CONTAINER_FORCEINLINE static D force_copy(D s) ++{ return s; } ++ ++#else //!BOOST_CONTAINER_DOXYGEN_INVOKED ++ ++template ++BOOST_CONTAINER_FORCEINLINE static D &force(S &s) ++{ return *move_detail::launder_cast(&s); } ++ ++template ++BOOST_CONTAINER_FORCEINLINE static const D &force(const S &s) ++{ return *move_detail::launder_cast(&s); } + + template + BOOST_CONTAINER_FORCEINLINE static D force_copy(const S &s) + { +- const D *const vp = move_detail::force_ptr(&s); ++ const D *const vp = move_detail::launder_cast(&s); + D ret_val(*vp); + return ret_val; + } ++#endif //BOOST_CONTAINER_DOXYGEN_INVOKED + + } //namespace dtl{ + +@@ -118,18 +139,27 @@ class flat_map + private: + BOOST_COPYABLE_AND_MOVABLE(flat_map) + //This is the tree that we should store if pair was movable ++ typedef std::pair std_pair_t; + typedef dtl::flat_tree< +- std::pair, ++ std_pair_t, + dtl::select1st, + Compare, + AllocatorOrContainer> tree_t; + + //This is the real tree stored here. It's based on a movable pair ++ typedef dtl::pair dtl_pair_t; ++ ++ #ifdef BOOST_CONTAINER_STD_PAIR_IS_MOVABLE ++ typedef std_pair_t impl_pair_t; ++ #else ++ typedef dtl_pair_t impl_pair_t; ++ #endif ++ + typedef dtl::flat_tree< +- dtl::pair, ++ impl_pair_t, + dtl::select1st, + Compare, +- typename dtl::container_or_allocator_rebind >::type ++ typename dtl::container_or_allocator_rebind::type + > impl_tree_t; + impl_tree_t m_flat_tree; // flat tree representing flat_map + +@@ -851,7 +881,7 @@ class flat_map + //! @copydoc ::boost::container::flat_set::nth(size_type) const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline + const_iterator nth(size_type n) const BOOST_NOEXCEPT_OR_NOTHROW +- { return dtl::force_copy(m_flat_tree.nth(n)); } ++ { return dtl::force_copy(m_flat_tree.nth(n)); } + + //! @copydoc ::boost::container::flat_set::index_of(iterator) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline +@@ -1099,7 +1129,7 @@ class flat_map + template + inline BOOST_CONTAINER_DOC1ST + ( std::pair +- , typename dtl::enable_if_c::value ++ , typename dtl::enable_if_c::value + BOOST_MOVE_I std::pair >::type) + insert(BOOST_FWD_REF(Pair) x) + { +@@ -1153,7 +1183,7 @@ class flat_map + template + inline BOOST_CONTAINER_DOC1ST + ( iterator +- , typename dtl::enable_if_c::value ++ , typename dtl::enable_if_c::value + BOOST_MOVE_I iterator>::type) + insert(const_iterator p, BOOST_FWD_REF(Pair) x) + { +@@ -1777,17 +1807,24 @@ class flat_multimap + #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED + private: + BOOST_COPYABLE_AND_MOVABLE(flat_multimap) ++ typedef std::pair std_pair_t; + typedef dtl::flat_tree< +- std::pair, ++ std_pair_t, + dtl::select1st, + Compare, + AllocatorOrContainer> tree_t; + //This is the real tree stored here. It's based on a movable pair ++ typedef dtl::pair dtl_pair_t; ++ #ifdef BOOST_CONTAINER_STD_PAIR_IS_MOVABLE ++ typedef std_pair_t impl_pair_t; ++ #else ++ typedef dtl_pair_t impl_pair_t; ++ #endif + typedef dtl::flat_tree< +- dtl::pair, ++ impl_pair_t, + dtl::select1st, + Compare, +- typename dtl::container_or_allocator_rebind >::type ++ typename dtl::container_or_allocator_rebind::type + > impl_tree_t; + impl_tree_t m_flat_tree; // flat tree representing flat_map + +@@ -2388,7 +2425,7 @@ class flat_multimap + //! @copydoc ::boost::container::flat_set::nth(size_type) const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline + const_iterator nth(size_type n) const BOOST_NOEXCEPT_OR_NOTHROW +- { return dtl::force_copy(m_flat_tree.nth(n)); } ++ { return dtl::force_copy(m_flat_tree.nth(n)); } + + //! @copydoc ::boost::container::flat_set::index_of(iterator) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline +@@ -2477,7 +2514,7 @@ class flat_multimap + template + inline BOOST_CONTAINER_DOC1ST + ( iterator +- , typename dtl::enable_if_c::value ++ , typename dtl::enable_if_c::value + BOOST_MOVE_I iterator >::type) + insert(BOOST_FWD_REF(Pair) x) + { return dtl::force_copy(m_flat_tree.emplace_equal(boost::forward(x))); } +@@ -2514,7 +2551,7 @@ class flat_multimap + template + inline BOOST_CONTAINER_DOC1ST + ( iterator +- , typename dtl::enable_if_c::value ++ , typename dtl::enable_if_c::value + BOOST_MOVE_I iterator>::type) + insert(const_iterator p, BOOST_FWD_REF(Pair) x) + { +-- +2.31.1 + diff --git a/recipes/boost/all/patches/bcp_namespace_issues_1_70.patch b/recipes/boost/all/patches/bcp_namespace_issues_1_70.patch deleted file mode 100644 index 024a19f8a5ee2..0000000000000 --- a/recipes/boost/all/patches/bcp_namespace_issues_1_70.patch +++ /dev/null @@ -1,33 +0,0 @@ -From d0586e88122f41cd5ac9666db70c37d6f0fc7480 Mon Sep 17 00:00:00 2001 -From: Peter Dimov -Date: Sun, 26 May 2019 18:49:12 +0300 -Subject: [PATCH] Fix `bcp --namespace` issues - ---- - Jamroot | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/Jamroot b/Jamroot -index e0d7c90f51d..4e913c2b3f3 100644 ---- a/Jamroot -+++ b/Jamroot -@@ -140,7 +140,8 @@ import "class" : new ; - import property-set ; - import threadapi-feature ; - import option ; --import tools/boost_install/boost-install ; -+# Backslash because of `bcp --namespace` -+import tools/boost\_install/boost-install ; - - path-constant BOOST_ROOT : . ; - constant BOOST_VERSION : 1.70.0 ; -@@ -311,8 +312,8 @@ rule boost-install ( libraries * ) - # stage and install targets via boost-install, above. - rule boost-lib ( name : sources * : requirements * : default-build * : usage-requirements * ) - { -+ autolink = shared:BOOST_$(name:U)_DYN_LINK=1 ; - name = boost_$(name) ; -- autolink = shared:$(name:U)_DYN_LINK=1 ; - lib $(name) - : $(sources) - : $(requirements) $(autolink) diff --git a/recipes/boost/all/patches/bcp_namespace_issues_1_71.patch b/recipes/boost/all/patches/bcp_namespace_issues_1_71.patch deleted file mode 100644 index 94e748ef55f4b..0000000000000 --- a/recipes/boost/all/patches/bcp_namespace_issues_1_71.patch +++ /dev/null @@ -1,33 +0,0 @@ -From d0586e88122f41cd5ac9666db70c37d6f0fc7480 Mon Sep 17 00:00:00 2001 -From: Peter Dimov -Date: Sun, 26 May 2019 18:49:12 +0300 -Subject: [PATCH] Fix `bcp --namespace` issues - ---- - Jamroot | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/Jamroot b/Jamroot -index e0d7c90f51d..4e913c2b3f3 100644 ---- a/Jamroot -+++ b/Jamroot -@@ -140,7 +140,8 @@ import "class" : new ; - import property-set ; - import threadapi-feature ; - import option ; --import tools/boost_install/boost-install ; -+# Backslash because of `bcp --namespace` -+import tools/boost\_install/boost-install ; - - path-constant BOOST_ROOT : . ; - constant BOOST_VERSION : 1.71.0 ; -@@ -311,8 +312,8 @@ rule boost-install ( libraries * ) - # stage and install targets via boost-install, above. - rule boost-lib ( name : sources * : requirements * : default-build * : usage-requirements * ) - { -+ autolink = shared:BOOST_$(name:U)_DYN_LINK=1 ; - name = boost_$(name) ; -- autolink = shared:$(name:U)_DYN_LINK=1 ; - lib $(name) - : $(sources) - : $(requirements) $(autolink) diff --git a/recipes/boost/all/patches/bcp_namespace_issues_1_72.patch b/recipes/boost/all/patches/bcp_namespace_issues_1_72.patch deleted file mode 100644 index 5ffe1ec157b19..0000000000000 --- a/recipes/boost/all/patches/bcp_namespace_issues_1_72.patch +++ /dev/null @@ -1,33 +0,0 @@ -From d0586e88122f41cd5ac9666db70c37d6f0fc7480 Mon Sep 17 00:00:00 2001 -From: Peter Dimov -Date: Sun, 26 May 2019 18:49:12 +0300 -Subject: [PATCH] Fix `bcp --namespace` issues - ---- - Jamroot | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/Jamroot b/Jamroot -index e0d7c90f51d..4e913c2b3f3 100644 ---- a/Jamroot -+++ b/Jamroot -@@ -140,7 +140,8 @@ import "class" : new ; - import property-set ; - import threadapi-feature ; - import option ; --import tools/boost_install/boost-install ; -+# Backslash because of `bcp --namespace` -+import tools/boost\_install/boost-install ; - - path-constant BOOST_ROOT : . ; - constant BOOST_VERSION : 1.72.0 ; -@@ -311,8 +312,8 @@ rule boost-install ( libraries * ) - # stage and install targets via boost-install, above. - rule boost-lib ( name : sources * : requirements * : default-build * : usage-requirements * ) - { -+ autolink = shared:BOOST_$(name:U)_DYN_LINK=1 ; - name = boost_$(name) ; -- autolink = shared:$(name:U)_DYN_LINK=1 ; - lib $(name) - : $(sources) - : $(requirements) $(autolink) diff --git a/recipes/boost/all/patches/boost_build_qcc_fix_debug_build_parameter.patch b/recipes/boost/all/patches/boost_build_qcc_fix_debug_build_parameter.patch deleted file mode 100644 index 5e6c660ee96c2..0000000000000 --- a/recipes/boost/all/patches/boost_build_qcc_fix_debug_build_parameter.patch +++ /dev/null @@ -1,22 +0,0 @@ -diff --git a/tools/build/src/tools/qcc.jam b/tools/build/src/tools/qcc.jam -index 155b1ac3..64274e65 100644 ---- a/tools/build/src/tools/qcc.jam -+++ b/tools/build/src/tools/qcc.jam -@@ -48,7 +48,7 @@ generators.register-c-compiler qcc.compile.asm : ASM : OBJ : qcc ; - - - # Declare flags for compilation. --toolset.flags qcc.compile OPTIONS on : -gstabs+ ; -+toolset.flags qcc.compile OPTIONS on : -g ; - - # Declare flags and action for compilation. - toolset.flags qcc.compile OPTIONS off : -O0 ; -@@ -164,7 +164,7 @@ generators.override qcc.searched-lib-generator : searched-lib-generator ; - - # Declare flags for linking. - # First, the common flags. --toolset.flags qcc.link OPTIONS on : -gstabs+ ; -+toolset.flags qcc.link OPTIONS on : -g ; - toolset.flags qcc.link OPTIONS on : -p ; - toolset.flags qcc.link OPTIONS ; - toolset.flags qcc.link LINKPATH ; diff --git a/recipes/boost/all/patches/boost_build_qcc_fix_debug_build_parameter_since_1_74.patch b/recipes/boost/all/patches/boost_build_qcc_fix_debug_build_parameter_since_1_74.patch deleted file mode 100644 index 29b744e9667d3..0000000000000 --- a/recipes/boost/all/patches/boost_build_qcc_fix_debug_build_parameter_since_1_74.patch +++ /dev/null @@ -1,22 +0,0 @@ -diff --git a/tools/build/src/tools/qcc.jam b/tools/build/src/tools/qcc.jam -index 740e907..b0653f1 100644 ---- a/tools/build/src/tools/qcc.jam -+++ b/tools/build/src/tools/qcc.jam -@@ -86,7 +86,7 @@ local rule check-target-platform - } - - # Declare flags for compilation. --toolset.flags qcc.compile OPTIONS on : -gstabs+ ; -+toolset.flags qcc.compile OPTIONS on : -g ; - - # Declare flags and action for compilation. - toolset.flags qcc.compile OPTIONS off : -O0 ; -@@ -216,7 +216,7 @@ generators.override qcc.searched-lib-generator : searched-lib-generator ; - - # Declare flags for linking. - # First, the common flags. --toolset.flags qcc.link OPTIONS on : -gstabs+ ; -+toolset.flags qcc.link OPTIONS on : -g ; - toolset.flags qcc.link OPTIONS on : -p ; - toolset.flags qcc.link OPTIONS ; - toolset.flags qcc.link LINKPATH ; diff --git a/recipes/boost/all/patches/boost_core_qnx_cxx_provide___cxa_get_globals.patch b/recipes/boost/all/patches/boost_core_qnx_cxx_provide___cxa_get_globals.patch deleted file mode 100644 index dffef671e7992..0000000000000 --- a/recipes/boost/all/patches/boost_core_qnx_cxx_provide___cxa_get_globals.patch +++ /dev/null @@ -1,20 +0,0 @@ -diff --git a/boost/core/uncaught_exceptions.hpp b/boost/core/uncaught_exceptions.hpp -index c39120b..436717f 100644 ---- a/boost/core/uncaught_exceptions.hpp -+++ b/boost/core/uncaught_exceptions.hpp -@@ -56,10 +56,15 @@ - // On Linux with clang and libc++ and on OS X, there is a version of cxxabi.h from libc++abi that doesn't declare __cxa_get_globals, but provides __cxa_uncaught_exceptions. - // The function only appeared in version _LIBCPPABI_VERSION >= 1002 of the library. Unfortunately, there are linking errors about undefined reference to __cxa_uncaught_exceptions - // on Ubuntu Trusty and OS X, so we avoid using it and forward-declare __cxa_get_globals instead. -+// On QNX SDP 7.0 (QCC 5.4.0), there are multiple cxxabi.h, one from glibcxx from gcc and another from libc++abi from LLVM. Which one is included will be determined by the qcc -+// command line arguments (-V and/or -Y; http://www.qnx.com/developers/docs/7.0.0/#com.qnx.doc.neutrino.utilities/topic/q/qcc.html). The LLVM libc++abi is missing the declaration -+// of __cxa_get_globals but it is also patched by QNX developers to not define _LIBCPPABI_VERSION. Older QNX SDP versions, up to and including 6.6, don't provide LLVM and libc++abi. -+// See https://github.com/boostorg/core/issues/59. - #if !defined(__FreeBSD__) && \ - ( \ - (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) < 407) || \ - defined(__OpenBSD__) || \ -+ (defined(__QNXNTO__) && !defined(__GLIBCXX__) && !defined(__GLIBCPP__)) || \ - defined(_LIBCPPABI_VERSION) \ - ) - namespace __cxxabiv1 { diff --git a/recipes/boost/all/patches/boost_log_filesystem_no_deprecated_1_72.patch b/recipes/boost/all/patches/boost_log_filesystem_no_deprecated_1_72.patch deleted file mode 100644 index bb010943f2bde..0000000000000 --- a/recipes/boost/all/patches/boost_log_filesystem_no_deprecated_1_72.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/libs/log/src/text_file_backend.cpp b/libs/log/src/text_file_backend.cpp -index 50cef3b..d5fd02e 100644 ---- a/libs/log/src/text_file_backend.cpp -+++ b/libs/log/src/text_file_backend.cpp -@@ -39,6 +39,8 @@ - #include - #include - #include -+#include -+#include - #include - #include - #include diff --git a/recipes/boost/all/patches/boost_mpi_check.patch b/recipes/boost/all/patches/boost_mpi_check.patch deleted file mode 100644 index af7e45f610510..0000000000000 --- a/recipes/boost/all/patches/boost_mpi_check.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff -ru a/tools/build/src/tools/mpi.jam b/tools/build/src/tools/mpi.jam ---- a/tools/build/src/tools/mpi.jam 2019-12-10 01:20:16.000000000 +0100 -+++ b/tools/build/src/tools/mpi.jam 2020-09-02 13:17:22.942349254 +0200 -@@ -66,6 +66,8 @@ - import type ; - import path ; - -+import errors ; -+ - # Make this module a project - project.initialize $(__name__) ; - project mpi ; -@@ -539,6 +541,11 @@ - # Set up the "mpi" alias - alias mpi : : : : $(options) ; - } -+ -+ if ! $(.configured) -+ { -+ errors.user-error "MPI not configured" ; -+ } - } - - # States whether MPI has bee configured diff --git a/recipes/boost/all/patches/python_base_prefix.patch b/recipes/boost/all/patches/python_base_prefix.patch deleted file mode 100644 index 47371cba773df..0000000000000 --- a/recipes/boost/all/patches/python_base_prefix.patch +++ /dev/null @@ -1,25 +0,0 @@ -diff -ru a/tools/build/src/tools/python.jam b/tools/build/src/tools/python.jam ---- a/tools/build/src/tools/python.jam -+++ b/tools/build/src/tools/python.jam -@@ -746,7 +746,7 @@ local rule configure ( version ? : cmd-or-prefix ? : includes * : libraries ? : - { - # Values to be extracted from python's sys module. These will be set by - # the probe rule, above, using Jam's dynamic scoping. -- local sys-elements = version platform prefix exec_prefix executable ; -+ local sys-elements = version platform base_prefix base_exec_prefix executable ; - local sys.$(sys-elements) ; - - # Compute the string Python's sys.platform needs to match. If not -@@ -786,10 +786,10 @@ local rule configure ( version ? : cmd-or-prefix ? : includes * : libraries ? : - { - debug-message ...requested configuration matched! ; - -- exec-prefix = $(sys.exec_prefix) ; -+ exec-prefix = $(sys.base_exec_prefix) ; - - compute-default-paths $(target-os) : $(sys.version) : -- $(sys.prefix) : $(sys.exec_prefix) ; -+ $(sys.base_prefix) : $(sys.base_exec_prefix) ; - - version = $(sys.version) ; - interpreter-cmd ?= $(cmd) ; diff --git a/recipes/boost/all/patches/python_base_prefix_since_1_74.patch b/recipes/boost/all/patches/python_base_prefix_since_1_74.patch deleted file mode 100644 index 2267fe4762dc8..0000000000000 --- a/recipes/boost/all/patches/python_base_prefix_since_1_74.patch +++ /dev/null @@ -1,26 +0,0 @@ -diff --git a/tools/build/src/tools/python.jam b/tools/build/src/tools/python.jam -index cf8c379..3e3f095 100644 ---- a/tools/build/src/tools/python.jam -+++ b/tools/build/src/tools/python.jam -@@ -749,7 +749,7 @@ local rule configure ( version ? : cmd-or-prefix ? : includes * : libraries ? : - { - # Values to be extracted from python's sys module. These will be set by - # the probe rule, above, using Jam's dynamic scoping. -- local sys-elements = version platform prefix exec_prefix executable ; -+ local sys-elements = version platform base_prefix base_exec_prefix executable ; - local sys.$(sys-elements) ; - - # Compute the string Python's sys.platform needs to match. If not -@@ -789,10 +789,10 @@ local rule configure ( version ? : cmd-or-prefix ? : includes * : libraries ? : - { - debug-message ...requested configuration matched! ; - -- exec-prefix = $(sys.exec_prefix) ; -+ exec-prefix = $(sys.base_exec_prefix) ; - - compute-default-paths $(target-os) : $(sys.version) : -- $(sys.prefix) : $(sys.exec_prefix) ; -+ $(sys.base_prefix) : $(sys.base_exec_prefix) ; - - version = $(sys.version) ; - interpreter-cmd ?= $(cmd) ; diff --git a/recipes/boost/all/patches/solaris_pthread_data.patch b/recipes/boost/all/patches/solaris_pthread_data.patch deleted file mode 100644 index ea5e4d7048d4e..0000000000000 --- a/recipes/boost/all/patches/solaris_pthread_data.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/include/boost/thread/pthread/thread_data.hpp b/include/boost/thread/pthread/thread_data.hpp -index aefbeb4..bc9b136 100644 ---- a/boost/thread/pthread/thread_data.hpp -+++ b/boost/thread/pthread/thread_data.hpp -@@ -57,7 +57,7 @@ namespace boost - #else - std::size_t page_size = ::sysconf( _SC_PAGESIZE); - #endif --#if PTHREAD_STACK_MIN > 0 -+#ifdef PTHREAD_STACK_MIN - if (size Path: @@ -117,16 +121,16 @@ def boost_path(self) -> Path: def do_git_update(self) -> None: if not self.boost_path.exists(): - with tools.chdir(str(self.tmppath)): + with chdir(self, self.tmppath): print("Cloning boost git") subprocess.check_call(["git", "clone", "--", self.git_url, "boost"]) - with tools.chdir(str(self.boost_path)): + with chdir(self, self.boost_path): print("Checking out current master") subprocess.check_call(["git", "checkout", "origin/master"]) print("Removing master branch") subprocess.check_call(["git", "branch", "-D", "master"]) else: - with tools.chdir(str(self.boost_path)): + with chdir(self, self.boost_path): print("Updating git repo") subprocess.check_call(["git", "fetch", "origin"]) print("Removing all local changes to git repo") @@ -135,17 +139,17 @@ def do_git_update(self) -> None: subprocess.check_call(["git", "checkout", "origin/master"]) def do_git_submodule_update(self): - with tools.chdir(str(self.boost_path)): + with chdir(self, self.boost_path): if not self.unsafe: # De-init + init to make sure that boostdep won't detect a new or removed boost library print("De-init git submodules") subprocess.check_call(["git", "submodule", "deinit", "--all", "-f"]) try: - print("Checking out version {}".format(self.boost_version)) - subprocess.check_call(["git", "checkout", "boost-{}".format(self.boost_version)]) + print(f"Checking out version {self.boost_version}") + subprocess.check_call(["git", "checkout", f"boost-{self.boost_version}"]) except subprocess.CalledProcessError: - print("version {} does not exist".format(self.boost_version)) + print(f"version {self.boost_version} does not exist") raise print("Re-init git submodules") @@ -155,15 +159,11 @@ def do_git_submodule_update(self): subprocess.check_call(["git", "clean", "-d", "-f"]) def do_install_boostdep(self): - with tools.chdir(str(self.boost_path)): - print("Installing boostdep/{}".format(self.boostdep_version)) - subprocess.check_call(["conan", "install", "boostdep/{}@".format(self.boostdep_version), "-g", "json"]) - - @property - def _bin_paths(self): - with tools.chdir(str(self.boost_path)): - data = json.loads(open("conanbuildinfo.json").read()) - return data["dependencies"][0]["bin_paths"] + with chdir(self, self.boost_path): + print(f"Installing boostdep/{self.boostdep_version}") + cmd = ["conan", "install", "--tool-requires", f"boostdep/{self.boostdep_version}", "--format", "json", "-vquiet"] + info = json.loads(subprocess.check_output(cmd)) + self._boostdep = Path(info["graph"]["nodes"]["1"]["package_folder"]) / "bin" / "boostdep" _GREP_IGNORE_PREFIX = ("#", "\"") _GREP_IGNORE_PARTS = ("boost", "<", ">") @@ -227,32 +227,29 @@ def _sort_requirements(self, requirements: List[str]) -> Tuple[List[str], Dict[s return list(conan_requirements), system_libs, list(unknown_libs) def do_boostdep_collect(self) -> BoostDependencies: - with tools.chdir(str(self.boost_path)): - with tools.environment_append({"PATH": self._bin_paths}): - buildables = subprocess.check_output(["boostdep", "--list-buildable"], text=True) - buildables = buildables.splitlines() - log.debug("`boostdep --list--buildable` returned these buildables: %s", buildables) - - # modules = subprocess.check_output(["boostdep", "--list-modules"]) - # modules = modules.decode().splitlines() - - dep_modules = buildables - - dependency_tree = {} - buildable_dependencies = subprocess.check_output(["boostdep", "--list-buildable-dependencies"], text=True) - log.debug("boostdep --list-buildable-dependencies returns: %s", buildable_dependencies) - for line in buildable_dependencies.splitlines(): - if re.match(r"^[\s]*#.*", line): - continue - match = re.match(r"([\S]+)\s*=\s*([^;]+)\s*;\s*", line) - if not match: - continue - master = match.group(1) - dependencies = re.split(r"\s+", match.group(2).strip()) - dependency_tree[master] = dependencies - - log.debug("Using `boostdep --track-sources`, the following dependency tree was calculated:") - log.debug(pprint.pformat(dependency_tree)) + with chdir(self, self.boost_path): + buildables = subprocess.check_output([self._boostdep, "--list-buildable"], text=True) + buildables = buildables.splitlines() + log.debug("`boostdep --list--buildable` returned these buildables: %s", buildables) + + # modules = subprocess.check_output([self._boostdep_path, "--list-modules"]) + # modules = modules.decode().splitlines() + + dependency_tree = {} + buildable_dependencies = subprocess.check_output([self._boostdep, "--list-buildable-dependencies"], text=True) + log.debug("boostdep --list-buildable-dependencies returns: %s", buildable_dependencies) + for line in buildable_dependencies.splitlines(): + if re.match(r"^[\s]*#.*", line): + continue + match = re.match(r"([\S]+)\s*=\s*([^;]+)\s*;\s*", line) + if not match: + continue + master = match.group(1) + dependencies = re.split(r"\s+", match.group(2).strip()) + dependency_tree[master] = dependencies + + log.debug("Using `boostdep --track-sources`, the following dependency tree was calculated:") + log.debug(pprint.pformat(dependency_tree)) filtered_dependency_tree = {k: [d for d in v if d in buildables] for k, v in dependency_tree.items() if k in buildables} @@ -329,12 +326,12 @@ def _fix_dependencies(self, deptree: Dict[str, List[str]]) -> Dict[str, List[str remaining_tree = self.detect_cycles(deptree) if remaining_tree: - raise Exception("Dependency cycle detected. Remaining tree: {}".format(remaining_tree)) + raise Exception(f"Dependency cycle detected. Remaining tree: {remaining_tree}") return deptree @staticmethod def _boostify_library(lib: str) -> str: - return "boost_{}".format(lib) + return f"boost_{lib}" def do_create_libraries(self, boost_dependencies: BoostDependencies): libraries = {} @@ -342,14 +339,14 @@ def do_create_libraries(self, boost_dependencies: BoostDependencies): # Look for the names of libraries in Jam build files for buildable in boost_dependencies.buildables: - construct_jam = lambda jam_ext : self.boost_path / "libs" / buildable / "build" / "Jamfile{}".format(jam_ext) + construct_jam = lambda jam_ext : self.boost_path / "libs" / buildable / "build" / f"Jamfile{jam_ext}" try: buildable_jam = next(construct_jam(jam_ext) for jam_ext in ("", ".v2") if construct_jam(jam_ext).is_file()) except StopIteration: - raise Exception("Cannot find jam build file for {}".format(buildable)) + raise Exception(f"Cannot find jam build file for {buildable}") jam_text = buildable_jam.read_text() buildable_libs = re.findall("[ \n](boost-)?lib ([a-zA-Z0-9_]+)[ \n]", jam_text) - buildable_libs = set("boost_{}".format(lib) if lib_prefix else lib for lib_prefix, lib in buildable_libs) + buildable_libs = set(f"boost_{lib}" if lib_prefix else lib for lib_prefix, lib in buildable_libs) buildable_libs = set(l[len("boost_"):] for l in buildable_libs if l.startswith("boost_")) # list(filter(lambda l: l.startswith("boost"), buildable_libs)) if not buildable_libs: @@ -357,17 +354,17 @@ def do_create_libraries(self, boost_dependencies: BoostDependencies): if buildable == "python": buildable_libs.add("python") if not buildable_libs: - raise Exception("Cannot find any library for buildable {}".format(buildable)) + raise Exception(f"Cannot find any library for buildable {buildable}") if buildable in buildable_libs: - libraries[buildable] = ["boost_{}".format(buildable)] + libraries[buildable] = [f"boost_{buildable}"] buildable_libs.remove(buildable) else: libraries[buildable] = [] module_provides_extra[buildable] = buildable_libs for buildable_dep in buildable_libs: boost_dependencies.export.dependencies[buildable_dep] = [buildable] - libraries[buildable_dep] = ["boost_{}".format(buildable_dep)] + libraries[buildable_dep] = [f"boost_{buildable_dep}"] # Boost.Test: unit_test_framework depends on all libraries of Boost.Test if "unit_test_framework" in boost_dependencies.export.dependencies and "test" in module_provides_extra: @@ -393,7 +390,7 @@ def do_create_libraries(self, boost_dependencies: BoostDependencies): @property def _outputpath(self) -> Path: - return self.outputdir / "dependencies-{}.yml".format(self.boost_version) + return self.outputdir / f"dependencies-{self.boost_version}.yml" @classmethod def _sort_item(cls, item): @@ -422,7 +419,7 @@ def do_create_dependency_file(self) -> None: data = self._sort_item(data) - print("Creating {}".format(self.outputdir)) + print(f"Creating {self.outputdir}") with self._outputpath.open("w") as fout: yaml.dump(data, fout) @@ -431,7 +428,7 @@ def main(args=None) -> int: parser = argparse.ArgumentParser() parser.add_argument("--verbose", dest="verbose", action="store_true", help="verbose output") parser.add_argument("-t", dest="tmppath", help="temporary folder where to clone boost (default is system temporary folder)") - parser.add_argument("-d", dest="boostdep_version", default="1.75.0", type=str, help="boostdep version") + parser.add_argument("-d", dest="boostdep_version", default="1.82.0", type=str, help="boostdep version") parser.add_argument("-u", dest="git_url", default=BOOST_GIT_URL, help="boost git url") parser.add_argument("-U", dest="git_update", action="store_true", help="update the git repo") parser.add_argument("-o", dest="outputdir", default=None, type=Path, help="output dependency dir") @@ -448,10 +445,10 @@ def main(args=None) -> int: if not ns.tmppath: ns.tmppath = Path(tempfile.gettempdir()) - print("Temporary folder is {}".format(ns.tmppath)) + print(f"Temporary folder is {ns.tmppath}") if not ns.outputdir: ns.outputdir = Path("dependencies") - print("Dependencies folder is {}".format(ns.outputdir)) + print(f"Dependencies folder is {ns.outputdir}") ns.outputdir.mkdir(exist_ok=True) @@ -464,7 +461,7 @@ def main(args=None) -> int: boost_versions = [ns.boost_version] for boost_version in boost_versions: - print("Starting {}".format(boost_version)) + print(f"Starting {boost_version}") boost_collector = BoostDependencyBuilder( boost_version=boost_version, boostdep_version=ns.boostdep_version, diff --git a/recipes/boost/all/test_package/CMakeLists.txt b/recipes/boost/all/test_package/CMakeLists.txt index e34607eab169d..986f7fbcdf07e 100644 --- a/recipes/boost/all/test_package/CMakeLists.txt +++ b/recipes/boost/all/test_package/CMakeLists.txt @@ -1,6 +1,15 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package LANGUAGES CXX) +if(UNIX AND NOT APPLE) + # use RPATH instead of RUNPATH so that + # transitive dependencies can be located + add_link_options("LINKER:--disable-new-dtags") +endif() + +include(CTest) +enable_testing() + if(BOOST_NAMESPACE) add_definitions("-DBOOST_NAMESPACE=${BOOST_NAMESPACE}") endif() @@ -10,30 +19,39 @@ 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) + set_property(TARGET regex_exe PROPERTY CXX_STANDARD 11) + 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) + set_property(TARGET test_exe PROPERTY CXX_STANDARD 11) + 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) + set_property(TARGET coroutine_exe PROPERTY CXX_STANDARD 11) + 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) + set_property(TARGET chrono_exe PROPERTY CXX_STANDARD 11) + add_test(NAME chrono_test COMMAND chrono_exe) endif() if(WITH_FIBER) @@ -41,6 +59,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) @@ -48,6 +67,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) @@ -55,12 +75,15 @@ 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) + set_property(TARGET locale_exe PROPERTY CXX_STANDARD 11) + add_test(NAME boost_locale COMMAND locale_exe) endif() if(WITH_STACKTRACE_ADDR2LINE) @@ -68,12 +91,16 @@ 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) + set_property(TARGET stacktrace_addr2line_exe PROPERTY CXX_STANDARD 11) + 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) + set_property(TARGET stacktrace_backtrace_exe PROPERTY CXX_STANDARD 11) + add_test(NAME boost_stacktrace_backtrace COMMAND stacktrace_backtrace_exe) endif() if(WITH_STACKTRACE) @@ -82,43 +109,70 @@ 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) + set_property(TARGET stacktrace_noop_exe PROPERTY CXX_STANDARD 11) + 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) + set_property(TARGET stacktrace_windbg_exe PROPERTY CXX_STANDARD 11) + 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) + set_property(TARGET stacktrace_windbg_cached_exe PROPERTY CXX_STANDARD 11) + 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) + set_property(TARGET stacktrace_basic_exe PROPERTY CXX_STANDARD 11) + add_test(NAME boost_stacktrace_basic COMMAND stacktrace_basic_exe) endif() endif() + if (WITH_PROCESS) + find_package(Boost COMPONENTS process REQUIRED) + add_executable(process_exe process.cpp) + target_link_libraries(process_exe PRIVATE Boost::process) + set_property(TARGET process_exe PROPERTY CXX_STANDARD 11) + add_test(NAME boost_process COMMAND process_exe) + endif() + if(WITH_PYTHON) find_package(Boost COMPONENTS python REQUIRED) 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 24064240e3ecc..d9a80224628d4 100644 --- a/recipes/boost/all/test_package/conanfile.py +++ b/recipes/boost/all/test_package/conanfile.py @@ -2,19 +2,17 @@ from conan.errors import ConanException from conan.tools.build import can_run from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.scm import Version -from conans import tools as tools_legacy -import os +from conan.tools.files import chdir class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "CMakeDeps", "VirtualRunEnv" + generators = "CMakeDeps", "VirtualBuildEnv", "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 @@ -26,28 +24,30 @@ def requirements(self): def generate(self): tc = CMakeToolchain(self) - tc.variables["HEADER_ONLY"] = self.dependencies["boost"].options.header_only + tc.cache_variables["HEADER_ONLY"] = self.dependencies["boost"].options.header_only if not self.dependencies["boost"].options.header_only: - tc.variables["Boost_USE_STATIC_LIBS"] = not self.dependencies["boost"].options.shared - tc.variables["WITH_PYTHON"] = not self.dependencies["boost"].options.without_python + 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 = Version(self.dependencies["boost"].options.python_version) - tc.variables["Python_ADDITIONAL_VERSIONS"] = f"{pyversion.major}.{pyversion.minor}" - tc.variables["PYTHON_COMPONENT_SUFFIX"] = f"{pyversion.major}.{pyversion.minor}" - tc.variables["WITH_RANDOM"] = not self.dependencies["boost"].options.without_random - tc.variables["WITH_REGEX"] = not self.dependencies["boost"].options.without_regex - tc.variables["WITH_TEST"] = not self.dependencies["boost"].options.without_test - tc.variables["WITH_COROUTINE"] = not self.dependencies["boost"].options.without_coroutine - tc.variables["WITH_CHRONO"] = not self.dependencies["boost"].options.without_chrono - tc.variables["WITH_FIBER"] = not self.dependencies["boost"].options.without_fiber - tc.variables["WITH_LOCALE"] = not self.dependencies["boost"].options.without_locale - tc.variables["WITH_NOWIDE"] = not self._boost_option("without_nowide", True) - tc.variables["WITH_JSON"] = not self._boost_option("without_json", True) - tc.variables["WITH_STACKTRACE"] = not self.dependencies["boost"].options.without_stacktrace - tc.variables["WITH_STACKTRACE_ADDR2LINE"] = self.deps_user_info["boost"].stacktrace_addr2line_available - tc.variables["WITH_STACKTRACE_BACKTRACE"] = self._boost_option("with_stacktrace_backtrace", False) + 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_PROCESS"] = not self._boost_option("without_process", 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.variables['BOOST_NAMESPACE'] = self.dependencies["boost"].options.namespace + tc.cache_variables['BOOST_NAMESPACE'] = self.dependencies["boost"].options.namespace tc.generate() def build(self): @@ -58,44 +58,15 @@ def build(self): def test(self): if not can_run(self): return - bindir = self.cpp.build.bindirs[0] - self.run(os.path.join(bindir, "lambda_exe"), env="conanrun") - if self.options["boost"].header_only: - return - if not self.options["boost"].without_random: - self.run(os.path.join(bindir, "random_exe"), env="conanrun") - if not self.options["boost"].without_regex: - self.run(os.path.join(bindir, "regex_exe"), env="conanrun") - if not self.options["boost"].without_test: - self.run(os.path.join(bindir, "test_exe"), env="conanrun") - if not self.options["boost"].without_coroutine: - self.run(os.path.join(bindir, "coroutine_exe"), env="conanrun") - if not self.options["boost"].without_chrono: - self.run(os.path.join(bindir, "chrono_exe"), env="conanrun") - if not self.options["boost"].without_fiber: - self.run(os.path.join(bindir, "fiber_exe"), env="conanrun") - if not self.options["boost"].without_locale: - self.run(os.path.join(bindir, "locale_exe"), env="conanrun") - if not self._boost_option("without_nowide", True): - bin_nowide = os.path.join(bindir, "nowide_exe") - conanfile = os.path.join(self.source_folder, "conanfile.py") - self.run(f"{bin_nowide} {conanfile}", env="conanrun") - if not self._boost_option("without_json", True): - self.run(os.path.join(bindir, "json_exe"), env="conanrun") - if not self.options["boost"].without_python: - with tools_legacy.environment_append({"PYTHONPATH": "bin:lib"}): - python_executable = self.options["boost"].python_executable - python_script = os.path.join(self.source_folder, "python.py") - self.run(f"{python_executable} {python_script}", env="conanrun") - self.run(os.path.join(bindir, "numpy_exe"), env="conanrun") - if not self.options["boost"].without_stacktrace: - self.run(os.path.join(bindir, "stacktrace_noop_exe"), env="conanrun") - if str(self.deps_user_info["boost"].stacktrace_addr2line_available) == "True": - self.run(os.path.join(bindir, "stacktrace_addr2line_exe"), env="conanrun") - if self.settings.os == "Windows": - self.run(os.path.join(bindir, "stacktrace_windbg_exe"), env="conanrun") - self.run(os.path.join(bindir, "stacktrace_windbg_cached_exe"), env="conanrun") - else: - self.run(os.path.join(bindir, "stacktrace_basic_exe"), env="conanrun") - if self._boost_option("with_stacktrace_backtrace", False): - self.run(os.path.join(bindir, "stacktrace_backtrace_exe"), env="conanrun") + with chdir(self, self.folders.build_folder): + # When boost and its dependencies are built as shared libraries, + # the test executables need to locate them. Typically the + # `conanrun` env should be enough, but this may cause problems on macOS + # where the CMake installation has dependencies on Apple-provided + # system libraries that are incompatible with Conan-provided ones. + # When `conanrun` is enabled, DYLD_LIBRARY_PATH will also apply + # to ctest itself. Given that CMake already embeds RPATHs by default, + # we can bypass this by using the `conanbuild` environment on + # non-Windows platforms, while still retaining the correct behaviour. + env = "conanrun" if self.settings.os == "Windows" else "conanbuild" + self.run(f"ctest --output-on-failure -C {self.settings.build_type}", env=env) diff --git a/recipes/boost/all/test_package/process.cpp b/recipes/boost/all/test_package/process.cpp new file mode 100644 index 0000000000000..fa89afebea957 --- /dev/null +++ b/recipes/boost/all/test_package/process.cpp @@ -0,0 +1,44 @@ +// Copyright (c) 2022 Klemens Morgenstern +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +// This comes from the following Boost example: +// https://github.com/boostorg/process/blob/boost-1.86.0/example/v2/intro.cpp + +// clang-format: off +#include +#include +// clang-format: on + +#include +#include + +#include +#include + +#if defined(BOOST_NAMESPACE) +namespace boost = BOOST_NAMESPACE; +#endif + +namespace proc = boost::process::v2; +namespace asio = boost::asio; + +int main() +{ + asio::io_context ctx; + asio::readable_pipe p{ctx}; + + const auto exe = proc::environment::find_executable("cmake"); + + proc::process c{ctx, exe, {"--version"}, proc::process_stdio{nullptr, p}}; + + std::string line; + boost::system::error_code ec; + + auto sz = asio::read(p, asio::dynamic_buffer(line), ec); + + std::cout << "CMake version: '" << line << "'" << std::endl; + + c.wait(); +} 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/conanfile.py b/recipes/boost/all/test_v1_package/conanfile.py deleted file mode 100644 index 9888310c2d96f..0000000000000 --- a/recipes/boost/all/test_v1_package/conanfile.py +++ /dev/null @@ -1,89 +0,0 @@ -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_ADDITIONAL_VERSIONS"] = f"{pyversion.major}.{pyversion.minor}" - cmake.definitions["PYTHON_COMPONENT_SUFFIX"] = f"{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() - - def test(self): - if tools.cross_building(self): - return - self.run(os.path.join("bin", "lambda_exe"), run_environment=True) - if self.options["boost"].header_only: - 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): - bin_nowide = os.path.join("bin", "nowide_exe") - conanfile = os.path.join(self.source_folder, "conanfile.py") - self.run(f"{bin_nowide} {conanfile}", 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": "bin:lib"}): - python_executable = self.options["boost"].python_executable - python_script = os.path.join(self.source_folder, os.pardir, "test_package", "python.py") - self.run(f"{python_executable} {python_script}", 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) diff --git a/recipes/boost/config.yml b/recipes/boost/config.yml index 76bc4f6280af1..2e1c34508d9b9 100644 --- a/recipes/boost/config.yml +++ b/recipes/boost/config.yml @@ -1,25 +1,19 @@ versions: - "1.81.0": - folder: all - "1.80.0": + "1.86.0": folder: all - "1.79.0": - folder: all - "1.78.0": + "1.85.0": folder: all - "1.77.0": + "1.84.0": folder: all - "1.76.0": + "1.83.0": folder: all - "1.75.0": + "1.82.0": folder: all - "1.74.0": - folder: all - "1.73.0": + "1.81.0": folder: all - "1.72.0": + "1.80.0": folder: all - "1.71.0": + "1.79.0": folder: all - "1.70.0": + "1.78.0": folder: all diff --git a/recipes/boostdep/all/CMakeLists.txt b/recipes/boostdep/all/CMakeLists.txt deleted file mode 100644 index 5e53cb70bdf38..0000000000000 --- a/recipes/boostdep/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -add_subdirectory(source_subfolder) diff --git a/recipes/boostdep/all/conandata.yml b/recipes/boostdep/all/conandata.yml index 3831a32bc89c9..943785c9b1d4a 100644 --- a/recipes/boostdep/all/conandata.yml +++ b/recipes/boostdep/all/conandata.yml @@ -1,6 +1,11 @@ sources: + 1.82.0: + - url: "https://github.com/boostorg/boostdep/archive/refs/tags/boost-1.82.0.tar.gz" + sha256: "b3bffa292709ad74bf2fa50831890161ad7b9ef33f9f4ffa83d474da4482a452" + - url: "https://www.boost.org/LICENSE_1_0.txt" + sha256: "c9bff75738922193e67fa726fa225535870d2aa1059f91452c411736284ad566" 1.75.0: - url: "https://github.com/boostorg/boostdep/archive/boost-1.75.0.tar.gz" sha256: "7eecd835eb5b0fd602ff3615a6b663b45917689386d11073d961b86710f428af" - - url: "http://www.boost.org/LICENSE_1_0.txt" + - url: "https://www.boost.org/LICENSE_1_0.txt" sha256: "c9bff75738922193e67fa726fa225535870d2aa1059f91452c411736284ad566" diff --git a/recipes/boostdep/all/conanfile.py b/recipes/boostdep/all/conanfile.py index 01a84ccc90d69..bd8dd57eb93dc 100644 --- a/recipes/boostdep/all/conanfile.py +++ b/recipes/boostdep/all/conanfile.py @@ -1,58 +1,68 @@ -from conans import CMake, ConanFile, tools import os +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, download, get + +required_conan_version = ">=1.52.0" + class BoostDepConan(ConanFile): name = "boostdep" - settings = "os", "arch", "compiler", "build_type" description = "A tool to create Boost module dependency reports" + license = "BSL-1.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/boostorg/boostdep" - license = "BSL-1.0" - topics = ("conan", "boostdep", "dependency", "tree") - exports_sources = "CMakeLists.txt" - generators = "cmake", "cmake_find_package" + topics = ("dependency", "tree") - _cmake = None + package_type = "application" + settings = "os", "arch", "compiler", "build_type" - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder) - @property - def _build_subfolder(self): - return "build_subfolder" + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("boost/1.75.0") + self.requires(f"boost/{self.version}") def package_id(self): del self.info.settings.compiler def source(self): - tools.get(**self.conan_data["sources"][self.version][0]) - os.rename("boostdep-boost-{}".format(self.version), self._source_subfolder) - license_info = self.conan_data["sources"][self.version][1] - tools.download(filename=os.path.basename(license_info["url"]), **license_info) - - 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.configure(build_folder=self._build_subfolder) - return self._cmake + sources_info, license_info = self.conan_data["sources"][self.version] + get(self, **sources_info, strip_root=True) + download(self, **license_info, filename=os.path.basename(license_info["url"])) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["Boost_USE_STATIC_LIBS"] = not self.dependencies["boost"].options.shared + tc.generate() + tc = CMakeDeps(self) + tc.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE*", dst="licenses") - cmake = self._configure_cmake() + copy( + self, + "LICENSE*", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder, + ) + cmake = CMake(self) cmake.install() def package_info(self): - bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) - self.deps_env_info.PATH.append(bin_path) + 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/boostdep/all/test_package/conanfile.py b/recipes/boostdep/all/test_package/conanfile.py index 190cc18502e11..2b15ef763d620 100644 --- a/recipes/boostdep/all/test_package/conanfile.py +++ b/recipes/boostdep/all/test_package/conanfile.py @@ -1,17 +1,20 @@ -from conans import ConanFile, tools -import os +from conan import ConanFile +from conan.tools.env import Environment +from conan.tools.files import mkdir, save -class DefaultNameConan(ConanFile): - settings = "os", "compiler", "arch", "build_type" +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "VirtualBuildEnv" + test_type = "explicit" - def build(self): - pass + def build_requirements(self): + self.tool_requires(self.tested_reference_str) def test(self): - if tools.cross_building(self.settings): - return - tools.mkdir("libs") - tools.save("Jamroot", "") - with tools.environment_append({"BOOST_ROOT": self.build_folder}): - self.run("boostdep --list-modules", run_environment=True) + mkdir(self, "libs") + save(self, "Jamroot", "") + env = Environment() + env.define("BOOST_ROOT", self.build_folder) + with env.vars(self).apply(): + self.run("boostdep --list-modules") diff --git a/recipes/boostdep/all/test_v1_package/conanfile.py b/recipes/boostdep/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..190cc18502e11 --- /dev/null +++ b/recipes/boostdep/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, tools +import os + + +class DefaultNameConan(ConanFile): + settings = "os", "compiler", "arch", "build_type" + + def build(self): + pass + + def test(self): + if tools.cross_building(self.settings): + return + tools.mkdir("libs") + tools.save("Jamroot", "") + with tools.environment_append({"BOOST_ROOT": self.build_folder}): + self.run("boostdep --list-modules", run_environment=True) diff --git a/recipes/boostdep/config.yml b/recipes/boostdep/config.yml index 640761587c2ae..1cbe5a69a954f 100644 --- a/recipes/boostdep/config.yml +++ b/recipes/boostdep/config.yml @@ -1,3 +1,5 @@ versions: + "1.82.0": + folder: "all" "1.75.0": folder: "all" diff --git a/recipes/botan/all/conandata.yml b/recipes/botan/all/conandata.yml index b4fd5502f1bd3..e82beb6c7b70e 100644 --- a/recipes/botan/all/conandata.yml +++ b/recipes/botan/all/conandata.yml @@ -1,37 +1,7 @@ sources: - "2.12.1": - url: "https://github.com/randombit/botan/archive/2.12.1.tar.gz" - sha256: "61d27332f053b0b1169659dc0fceb7de7d16cade230df3a14dfaa2c091888b98" - "2.13.0": - url: "https://github.com/randombit/botan/archive/2.13.0.tar.gz" - sha256: "29a57d8efd6ab297eab67cbf489a5a423b06e120e0520aff2583074e8aea151c" - "2.14.0": - url: "https://github.com/randombit/botan/archive/2.14.0.tar.gz" - sha256: "38e34b8ef7652e811382744425b82da1b1a7fb5f14cc281a7d3a18543eaf72f7" - "2.15.0": - url: "https://github.com/randombit/botan/archive/2.15.0.tar.gz" - sha256: "9a86b1a8adbac37fdff9cf5745b3a313020c33579d8fc51cb996c47d3adf5585" - "2.16.0": - url: "https://github.com/randombit/botan/archive/2.16.0.tar.gz" - sha256: "8f448b97120e884d755b946045753876d688b01f48f5e6a1cf37aebd5afecbe5" - "2.17.0": - url: "https://github.com/randombit/botan/archive/2.17.0.tar.gz" - sha256: "32874e4e14bf11428e1bc4919e5ee174a68e2f480d37bc79ed015b2b5ef87fef" - "2.17.1": - url: "https://github.com/randombit/botan/archive/2.17.1.tar.gz" - sha256: "ca562c00e61663c418bd9fdc6c70bdeaedafba8bef328cb6046a1d6390d39a71" - "2.17.2": - url: "https://github.com/randombit/botan/archive/2.17.2.tar.gz" - sha256: "3d99da64573abab6d6e8036a45f8c567a57721c8f23850e05aadd84fc2e0075c" "2.17.3": url: "https://github.com/randombit/botan/archive/2.17.3.tar.gz" sha256: "544c62e43be0c60fff7ac8707ee99fe134c75bef06bded217d04f0a4b333519a" - "2.18.0": - url: "https://github.com/randombit/botan/archive/2.18.0.tar.gz" - sha256: "8556991402f9ecf5f84f1f2c4de20ca3fd14a5ebd775f065ea6676b36646a77d" - "2.18.1": - url: "https://github.com/randombit/botan/archive/2.18.1.tar.gz" - sha256: "4afebf2dbfa2f047d161437dcc544003d5822f47ceac97ada6a24948297bd3ed" "2.18.2": url: "https://github.com/randombit/botan/archive/2.18.2.tar.gz" sha256: "10ded69c4fd4ade9d87527b394787beefa190b4ecb65ed04535bdd00e088cd96" @@ -44,15 +14,57 @@ sources: "2.19.3": url: "https://github.com/randombit/botan/archive/2.19.3.tar.gz" sha256: "8f568bf74c2e476d92ac8a1cfc2ba8407ec038fe9458bd0a11e7da827a9b8199" + "2.19.4": + url: "https://github.com/randombit/botan/archive/2.19.4.tar.gz" + sha256: "5754a6b5ddc3c74b0cb8671531feea69d03a4f3b5bdafa5f75e4c73a1242e5b1" + "2.19.5": + url: "https://github.com/randombit/botan/archive/2.19.5.tar.gz" + sha256: "8d4a3826787f9febbdc225172ad2d39d7d3960346c5721fe46cb27d480d7e1de" + "3.0.0": + url: "https://github.com/randombit/botan/archive/3.0.0.tar.gz" + sha256: "8bafe2e965fa9ccf92ef5741165d735c9fbbe6376c373bbf5702495ad2dfb814" + "3.1.0": + url: "https://github.com/randombit/botan/archive/3.1.0.tar.gz" + sha256: "f3680ab11122e581ac08993f149bf519030c7be13b32f5ac1e6bef0a2e6bb88e" + "3.1.1": + url: "https://github.com/randombit/botan/archive/3.1.1.tar.gz" + sha256: "2d0af0c3a7140572f3f7f1a22865f9c5eadc102a7fa58f03314709b0bee26c11" + "3.2.0": + url: "https://github.com/randombit/botan/archive/3.2.0.tar.gz" + sha256: "95af4935d56973000bb6ff20bb54ae56083f8764d5a2c89826cac26ac6127330" + "3.3.0": + url: "https://github.com/randombit/botan/archive/3.3.0.tar.gz" + sha256: "57fefda7b9ab6f8409329620cdaf26d2d7e962b6a10eb321d331e9ecb796f804" + "3.4.0": + url: "https://github.com/randombit/botan/archive/3.4.0.tar.gz" + sha256: "6ef2a16a0527b1cfc9648a644877f7b95c4d07e8ef237273b030c623418c5e5b" + "3.5.0": + url: "https://github.com/randombit/botan/archive/3.5.0.tar.gz" + sha256: "7d91d3349e6029e1a6929a50ab587f9fd4e29a9af3f3d698553451365564001f" + "3.6.0": + url: "https://github.com/randombit/botan/archive/3.6.0.tar.gz" + sha256: "950199a891fab62dca78780b36e12f89031c37350b2a16a2c35f2e423c041bad" + "3.6.1": + url: "https://github.com/randombit/botan/archive/3.6.1.tar.gz" + sha256: "a6c4e8dcb6c7f4b9b67e2c8b43069d65b548970ca17847e3b1e031d3ffdd874a" patches: - "2.12.1": - - patch_file: "patches/dll-dir.patch" - base_path: "sources" - - patch_file: "patches/fix-unrecognized-linker-flag.patch" - base_path: "sources" - "2.17.2": - - patch_file: "patches/vs2015-install-fix.patch" - base_path: "sources" "2.18.2": - patch_file: "patches/fix-amalgamation-build.patch" - base_path: "sources" + patch_description: "Backport a fix for amalgamation build" + patch_type: "bugfix" + patch_source: "https://github.com/randombit/botan/pull/2835" + "3.0.0": + - patch_file: "patches/backport-getrandom-via-syscall-to-3.0.0.patch" + patch_description: "Backport a fix to support getrandom() with glibc < 2.25" + patch_type: "portability" + patch_source: "https://github.com/randombit/botan/pull/3688" + "3.1.0": + - patch_file: "patches/backport-getrandom-via-syscall-to-3.1.0.patch" + patch_description: "Backport a fix to support getrandom() with glibc < 2.25" + patch_type: "portability" + patch_source: "https://github.com/randombit/botan/pull/3688" + "3.1.1": + - patch_file: "patches/backport-getrandom-via-syscall-to-3.1.0.patch" + patch_description: "Backport a fix to support getrandom() with glibc < 2.25" + patch_type: "portability" + patch_source: "https://github.com/randombit/botan/pull/3688" diff --git a/recipes/botan/all/conanfile.py b/recipes/botan/all/conanfile.py index e8599f32dde75..8ed902567cf53 100644 --- a/recipes/botan/all/conanfile.py +++ b/recipes/botan/all/conanfile.py @@ -1,9 +1,21 @@ -from conan.tools.microsoft import is_msvc, msvc_runtime_flag -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration import os +import shutil +import platform -required_conan_version = ">=1.45.0" +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os, fix_apple_shared_install_name, XCRun +from conan.tools.build import build_jobs, check_min_cppstd +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 AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, msvc_runtime_flag, VCVars, check_min_vs +from conan.tools.microsoft import unix_path +from conan.tools.scm import Version + + +required_conan_version = ">=1.55" class BotanConan(ConanFile): @@ -11,9 +23,10 @@ class BotanConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/randombit/botan" license = "BSD-2-Clause" - description = "Botan is a cryptography library written in C++11." - topics = ("cryptography", "crypto", "C++11", "tls") + description = "Botan is a cryptography library written in modern C++." + topics = ("cryptography", "crypto", "c++11", "c++20", "tls") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -21,7 +34,6 @@ class BotanConan(ConanFile): "amalgamation": [True, False], "with_bzip2": [True, False], "with_openssl": [True, False], - "single_amalgamation": [True, False], "with_sqlite3": [True, False], "with_zlib": [True, False], "with_boost": [True, False], @@ -39,8 +51,11 @@ class BotanConan(ConanFile): "with_neon": [True, False], "with_armv8crypto": [True, False], "with_powercrypto": [True, False], - "enable_modules": "ANY", - "system_cert_bundle": "ANY", + "enable_modules": [None, "ANY"], + "disable_modules": [None, "ANY"], + "enable_experimental_features": [True, False], + "enable_deprecated_features": [True, False], + "system_cert_bundle": [None, "ANY"], "module_policy": [None, "bsi", "modern", "nist"], } default_options = { @@ -49,7 +64,6 @@ class BotanConan(ConanFile): "amalgamation": True, "with_bzip2": False, "with_openssl": False, - "single_amalgamation": False, "with_sqlite3": False, "with_zlib": False, "with_boost": False, @@ -68,10 +82,15 @@ class BotanConan(ConanFile): "with_armv8crypto": True, "with_powercrypto": True, "enable_modules": None, + "disable_modules": None, + "enable_experimental_features": False, + "enable_deprecated_features": True, "system_cert_bundle": None, "module_policy": None, } + _extra_cxxflags = None + @property def _is_x86(self): return str(self.settings.arch) in ['x86', 'x86_64'] @@ -84,14 +103,8 @@ def _is_ppc(self): def _is_arm(self): return 'arm' in str(self.settings.arch) - @property - def _source_subfolder(self): - # Required to build at least 2.12.1 - return "sources" - 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': @@ -115,86 +128,143 @@ def config_options(self): del self.options.with_altivec del self.options.with_powercrypto - # --single-amalgamation option is no longer available - # See also https://github.com/randombit/botan/pull/2246 - if tools.Version(self.version) >= '2.14.0': - del self.options.single_amalgamation + # Support for the OpenSSL provider was removed in 2.19.2 + if Version(self.version) >= '2.19.2': + del self.options.with_openssl def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") def requirements(self): if self.options.with_bzip2: self.requires("bzip2/1.0.8") - if self.options.with_openssl: - self.requires("openssl/1.1.1o") + if self.options.get_safe('with_openssl', False): + self.requires("openssl/[>=1.1 <3]") if self.options.with_zlib: - self.requires("zlib/1.2.12") + self.requires("zlib/[>=1.2.11 <2]") if self.options.with_sqlite3: - self.requires("sqlite3/3.38.5") + self.requires("sqlite3/3.45.1") if self.options.with_boost: - self.requires("boost/1.79.0") + self.requires("boost/1.84.0") @property def _required_boost_components(self): return ['coroutine', 'system'] + @property + def _min_cppstd(self): + # From the same links as below + return 11 if Version(self.version) < "3.0.0" else 20 + + @property + def _compilers_minimum_version(self): + if Version(self.version).major < 3: + # From https://github.com/randombit/botan/blob/2.19.3/doc/support.rst + return { + "gcc": "4.8", + "clang": "3.5", + "Visual Studio": "14", + "msvc": "190", + } + else: + # From https://github.com/randombit/botan/blob/master/doc/support.rst + return { + "gcc": "11.2", + "clang": "14", + "apple-clang": "14", + "Visual Studio": "17", + "msvc": "193", + } + def validate(self): if self.options.with_boost: - 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 self.options['boost'].shared or self.options['boost'].magic_autolink or miss_boost_required_comp: - raise ConanInvalidConfiguration('{0} requires non-header-only static boost, without magic_autolink, and with these components: {1}'.format(self.name, ', '.join(self._required_boost_components))) + boost_opts = self.dependencies['boost'].options + miss_boost_required_comp = any(getattr(boost_opts, 'without_{}'.format(boost_comp), True) for boost_comp in self._required_boost_components) + if boost_opts.header_only or boost_opts.shared or boost_opts.magic_autolink or miss_boost_required_comp: + raise ConanInvalidConfiguration( + f"{self.name} requires non-header-only static boost, " + f"without magic_autolink, and with these components: {', '.join(self._required_boost_components)}") + if self.settings.get_safe("compiler.cppstd"): + check_min_cppstd(self, self._min_cppstd) compiler = self.settings.compiler - version = tools.Version(self.settings.compiler.version) + compiler_name = str(compiler) + compiler_version = Version(compiler.version) - if compiler == 'Visual Studio' and version < '14': - raise ConanInvalidConfiguration("Botan doesn't support MSVC < 14") + check_min_vs(self, self._compilers_minimum_version["msvc"]) + if not is_msvc(self): + minimum_version = self._compilers_minimum_version.get(compiler_name, 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 (minimum {compiler_name} {minimum_version})." + ) + if not minimum_version: + self.output.warning(f"{self.name} recipe lacks information about the {compiler_name} compiler support.") - elif compiler == 'gcc' and version >= '5' and compiler.libcxx != 'libstdc++11': + if self.settings.compiler == 'gcc' and compiler_version >= "5" and self.settings.compiler.libcxx != 'libstdc++11': raise ConanInvalidConfiguration( 'Using Botan with GCC >= 5 on Linux requires "compiler.libcxx=libstdc++11"') - elif compiler == 'clang' and compiler.libcxx not in ['libstdc++11', 'libc++']: + if self.settings.compiler == 'clang' and self.settings.compiler.libcxx not in ['libstdc++11', 'libc++']: raise ConanInvalidConfiguration( 'Using Botan with Clang on Linux requires either "compiler.libcxx=libstdc++11" ' \ 'or "compiler.libcxx=libc++"') # Some older compilers cannot handle the amalgamated build anymore # See also https://github.com/randombit/botan/issues/2328 - if tools.Version(self.version) >= '2.14.0' and self.options.amalgamation: - if (compiler == 'apple-clang' and version < '10') or \ - (compiler == 'gcc' and version < '8') or \ - (compiler == 'clang' and version < '7'): + if self.options.amalgamation: + if (self.settings.compiler == 'apple-clang' and compiler_version < '10') or \ + (self.settings.compiler == 'gcc' and compiler_version < '8') or \ + (self.settings.compiler == 'clang' and compiler_version < '7'): raise ConanInvalidConfiguration( - 'botan amalgamation is not supported for {}/{}'.format(compiler, version)) + f"botan amalgamation is not supported for {compiler}/{compiler_version}") - if self.options.get_safe("single_amalgamation", False) and not self.options.amalgamation: - raise ConanInvalidConfiguration("botan:single_amalgamation=True requires botan:amalgamation=True") + 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) + + @property + def _cxxflags(self): + global_cxxflags = " ".join(self.conf.get("tools.build:cxxflags", default=[], check_type=list)) + env_cxxflags = VirtualBuildEnv(self).vars().get("CXXFLAGS", default="") + cxxflags = f"{env_cxxflags} {global_cxxflags}".strip() + return cxxflags if len(cxxflags) > 1 else None + + def generate(self): + if is_msvc(self): + ms = VCVars(self) + ms.generate() + + # This is to work around botan's configure script that *replaces* its + # standard (platform dependent) flags in presence of an environment + # variable ${CXXFLAGS}. Most notably, this would build botan with + # disabled compiler optimizations. + self._extra_cxxflags = self._cxxflags + self.buildenv.unset('CXXFLAGS') + VirtualBuildEnv(self).generate() def build(self): - for patch in self.conan_data.get('patches', {}).get(self.version, []): - tools.patch(**patch) - with tools.chdir(self._source_subfolder): + apply_conandata_patches(self) + with chdir(self, self.source_folder): self.run(self._configure_cmd) self.run(self._make_cmd) def package(self): - self.copy(pattern='license.txt', dst='licenses', src=self._source_subfolder) - with tools.chdir(self._source_subfolder): + copy(self, "license.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + with chdir(self, self.source_folder): + # Note: this will fail to properly consider the package_folder if a "conan build" followed by a "conan export-pkg" is executed self.run(self._make_install_cmd) + fix_apple_shared_install_name(self) def package_info(self): - major_version = tools.Version(self.version).major + major_version = Version(self.version).major self.cpp_info.set_property("pkg_config_name", f"botan-{major_version}") - self.cpp_info.names["pkg_config"] = f"botan-{major_version}" - self.cpp_info.libs = ["botan" if is_msvc(self) else f"botan-{major_version}"] + self.cpp_info.libs = ["botan" if is_msvc(self) and major_version < 3 else f"botan-{major_version}"] if self.settings.os == 'Linux': - self.cpp_info.system_libs.extend(['dl', 'rt', 'pthread']) + self.cpp_info.system_libs.extend(['dl', 'rt', 'pthread', 'm']) if self.settings.os == 'Macos': self.cpp_info.frameworks = ['Security', 'CoreFoundation'] if self.settings.os == 'Windows': @@ -220,10 +290,10 @@ def _botan_os(self): def _dependency_build_flags(self, dependency): # Since botan has a custom build system, we need to specifically inject # these build parameters so that it picks up the correct dependencies. - dep_cpp_info = self.deps_cpp_info[dependency] + dep_cpp_info = self.dependencies[dependency].cpp_info return \ - ['--with-external-includedir={}'.format(include_path) for include_path in dep_cpp_info.include_paths] + \ - ['--with-external-libdir={}'.format(lib_path) for lib_path in dep_cpp_info.lib_paths] + \ + ['--with-external-includedir={}'.format(include_path) for include_path in dep_cpp_info.includedirs] + \ + ['--with-external-libdir={}'.format(lib_path) for lib_path in dep_cpp_info.libdirs] + \ ['--define-build-macro={}'.format(define) for define in dep_cpp_info.defines] @property @@ -256,48 +326,55 @@ def _configure_cmd(self): elif self.settings.arch in ['x86_64']: botan_abi_flags.append('-arch x86_64') - if self.options.get_safe('fPIC', True): + if self.options.get_safe('fPIC', True) and not is_msvc(self): botan_extra_cxx_flags.append('-fPIC') - if tools.is_apple_os(self.settings.os): + if is_apple_os(self): if self.settings.get_safe('os.version'): # Required, see https://github.com/conan-io/conan-center-index/pull/3456 - macos_min_version = 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')) + macos_min_version = macos_min_version = AutotoolsToolchain(self).apple_min_version_flag botan_extra_cxx_flags.append(macos_min_version) - macos_sdk_path = '-isysroot {}'.format(tools.XCRun(self.settings).sdk_path) + macos_sdk_path = '-isysroot {}'.format(XCRun(self).sdk_path) botan_extra_cxx_flags.append(macos_sdk_path) - # This is to work around botan's configure script that *replaces* its - # standard (platform dependent) flags in presence of an environment - # variable ${CXXFLAGS}. Most notably, this would build botan with - # disabled compiler optimizations. - environment_cxxflags = tools.get_env('CXXFLAGS') - if environment_cxxflags: - del os.environ['CXXFLAGS'] - botan_extra_cxx_flags.append(environment_cxxflags) + if self._extra_cxxflags: + botan_extra_cxx_flags.append(self._extra_cxxflags) + + if Version(self.version) >= '3.4': + # Botan 3.4.0 introduced a 'module life cycle' feature, before that + # the experimental/deprecated feature switches are ignored. + + if self.options.enable_experimental_features: + build_flags.append('--enable-experimental-features') + else: + build_flags.append('--disable-experimental-features') + + if self.options.enable_deprecated_features: + build_flags.append('--enable-deprecated-features') + else: + build_flags.append('--disable-deprecated-features') if self.options.enable_modules: build_flags.append('--minimized-build') build_flags.append('--enable-modules={}'.format(self.options.enable_modules)) + if self.options.disable_modules: + build_flags.append('--disable-modules={}'.format(self.options.disable_modules)) + if self.options.amalgamation: build_flags.append('--amalgamation') - if self.options.get_safe('single_amalgamation'): - build_flags.append('--single-amalgamation-file') - if self.options.system_cert_bundle: build_flags.append('--system-cert-bundle={}'.format(self.options.system_cert_bundle)) + if self.conf.get("tools.build:sysroot"): + build_flags.append(f'--with-sysroot-dir={self.conf.get("tools.build:sysroot")}') + if self.options.with_bzip2: build_flags.append('--with-bzip2') build_flags.extend(self._dependency_build_flags('bzip2')) - if self.options.with_openssl: + if self.options.get_safe('with_openssl', False): build_flags.append('--with-openssl') build_flags.extend(self._dependency_build_flags('openssl')) @@ -375,11 +452,17 @@ def _configure_cmd(self): if is_msvc(self): build_flags.append(f"--msvc-runtime={msvc_runtime_flag(self)}") + if self._is_glibc_older_than_2_25_on_linux and Version(self.version) >= '3.0': + # INFO: Botan 3.0+ requires glibc >= 2.25. Disable features to make it backward compatible + # FIXME: CCI Docker images are running Ubuntu 16.04. Remove it after supporting later version. + self.output.warning("Disabling usage of getentropy(), getrandom(), and explicit_bzero() due to old glibc version") + build_flags.append('--without-os-features=getentropy,getrandom,explicit_bzero') + build_flags.append('--without-pkg-config') call_python = 'python' if self.settings.os == 'Windows' else '' - prefix = tools.unix_path(self.package_folder) if self._is_mingw_windows else self.package_folder + prefix = unix_path(self, self.package_folder) if self._is_mingw_windows else self.package_folder botan_abi = ' '.join(botan_abi_flags) if botan_abi_flags else ' ' botan_cxx_extras = ' '.join(botan_extra_cxx_flags) if botan_extra_cxx_flags else ' ' @@ -392,7 +475,7 @@ def _configure_cmd(self): ' --extra-cxxflags="{cxxflags}"' ' --cc={compiler}' ' --cpu={cpu}' - ' --prefix={prefix}' + ' --prefix="{prefix}"' ' --os={os}' ' {build_flags}').format( python_call=call_python, @@ -413,27 +496,23 @@ def _make_cmd(self): @property def _make_program(self): - return tools.get_env('CONAN_MAKE_PROGRAM', tools.which('make') or tools.which('mingw32-make')) + return self.conf.get("tools.gnu:make_program", os.getenv('CONAN_MAKE_PROGRAM', shutil.which('make') or shutil.which('mingw32-make'))) @property def _gnumake_cmd(self): make_ldflags = 'LDFLAGS=-lc++abi' if self._is_linux_clang_libcxx else '' - make_cmd = ('{ldflags}' ' {make}' ' -j{cpucount}').format( - ldflags=make_ldflags, make=self._make_program, cpucount=tools.cpu_count()) + make_cmd = f"{make_ldflags} {self._make_program} -j{build_jobs(self)}" return make_cmd @property def _nmake_cmd(self): - vcvars = tools.vcvars_command(self.settings) - make_cmd = vcvars + ' && nmake' - return make_cmd + return 'nmake' @property def _make_install_cmd(self): if is_msvc(self): - vcvars = tools.vcvars_command(self.settings) - make_install_cmd = vcvars + ' && nmake install' + make_install_cmd = '{make} install'.format(make=self._nmake_cmd) else: make_install_cmd = '{make} install'.format(make=self._make_program) return make_install_cmd @@ -445,3 +524,21 @@ def _is_linux_clang_libcxx(self): self.settings.compiler == 'clang' and self.settings.compiler.libcxx == 'libc++' ) + + @property + def _is_glibc_older_than_2_25_on_linux(self): + # FIXME: glibc below 2.25 lacks support for certain syscalls that botan assumes + # to be present. Once CCI updated their CI images and provides a newer + # glibc, we can (and should) remove this workaround. + # + # https://github.com/conan-io/conan-center-index/pull/18079#issuecomment-1919206949 + # https://github.com/conan-io/conan-center-index/pull/18079#issuecomment-1919486839 + + if self.settings.os != 'Linux': + return False + libver = platform.libc_ver() + return ( + self.settings.os == 'Linux' and + libver[0] == 'glibc' and + Version(libver[1]) < '2.25' + ) diff --git a/recipes/botan/all/patches/backport-getrandom-via-syscall-to-3.0.0.patch b/recipes/botan/all/patches/backport-getrandom-via-syscall-to-3.0.0.patch new file mode 100644 index 0000000000000..54f8088a3d1e3 --- /dev/null +++ b/recipes/botan/all/patches/backport-getrandom-via-syscall-to-3.0.0.patch @@ -0,0 +1,24 @@ +diff --git a/src/lib/rng/system_rng/system_rng.cpp b/src/lib/rng/system_rng/system_rng.cpp +index 8a24ed9f6..45af0c507 100644 +--- a/src/lib/rng/system_rng/system_rng.cpp ++++ b/src/lib/rng/system_rng/system_rng.cpp +@@ -25,6 +25,7 @@ + #include + #elif defined(BOTAN_TARGET_OS_HAS_GETRANDOM) + #include ++ #include + #include + #elif defined(BOTAN_TARGET_OS_HAS_DEV_RANDOM) + #include +@@ -216,7 +217,11 @@ class System_RNG_Impl final : public RandomNumberGenerator + size_t len = output.size(); + while(len > 0) + { ++#if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ < 25 ++ const ssize_t got = ::syscall(SYS_getrandom, buf, len, flags); ++#else + const ssize_t got = ::getrandom(buf, len, flags); ++#endif + + if(got < 0) + { diff --git a/recipes/botan/all/patches/backport-getrandom-via-syscall-to-3.1.0.patch b/recipes/botan/all/patches/backport-getrandom-via-syscall-to-3.1.0.patch new file mode 100644 index 0000000000000..dd376536584eb --- /dev/null +++ b/recipes/botan/all/patches/backport-getrandom-via-syscall-to-3.1.0.patch @@ -0,0 +1,24 @@ +diff --git a/src/lib/rng/system_rng/system_rng.cpp b/src/lib/rng/system_rng/system_rng.cpp +index b42ea5543..dcff78931 100644 +--- a/src/lib/rng/system_rng/system_rng.cpp ++++ b/src/lib/rng/system_rng/system_rng.cpp +@@ -26,6 +26,7 @@ + #elif defined(BOTAN_TARGET_OS_HAS_GETRANDOM) + #include + #include ++ #include + #elif defined(BOTAN_TARGET_OS_HAS_DEV_RANDOM) + #include + #include +@@ -211,7 +212,11 @@ class System_RNG_Impl final : public RandomNumberGenerator { + uint8_t* buf = output.data(); + size_t len = output.size(); + while(len > 0) { ++ #if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ < 25 ++ const ssize_t got = ::syscall(SYS_getrandom, buf, len, flags); ++ #else + const ssize_t got = ::getrandom(buf, len, flags); ++ #endif + + if(got < 0) { + if(errno == EINTR) { diff --git a/recipes/botan/all/patches/dll-dir.patch b/recipes/botan/all/patches/dll-dir.patch deleted file mode 100644 index d0cda481f6695..0000000000000 --- a/recipes/botan/all/patches/dll-dir.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/src/scripts/install.py b/src/scripts/install.py -index 4cbce5a8e..ed6fe897f 100755 ---- a/src/scripts/install.py -+++ b/src/scripts/install.py -@@ -191,7 +191,7 @@ def main(args): - libname = cfg['libname'] - soname_base = libname + '.dll' - copy_executable(os.path.join(out_dir, soname_base), -- prepend_destdir(os.path.join(lib_dir, soname_base))) -+ prepend_destdir(os.path.join(bin_dir, soname_base))) - else: - soname_patch = cfg['soname_patch'] - soname_abi = cfg['soname_abi'] diff --git a/recipes/botan/all/patches/fix-unrecognized-linker-flag.patch b/recipes/botan/all/patches/fix-unrecognized-linker-flag.patch deleted file mode 100644 index d70cce86690b9..0000000000000 --- a/recipes/botan/all/patches/fix-unrecognized-linker-flag.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/configure.py b/configure.py -index 8b413db57..46331e78c 100755 ---- a/configure.py -+++ b/configure.py -@@ -2147,6 +2147,12 @@ def create_template_vars(source_paths, build_paths, options, modules, cc, arch, - 'mod_list': sorted([m.basename for m in modules]) - } - -+ if cc.basename == 'msvc' and variables['cxx_abi_flags'] != '': -+ # MSVC linker doesn't support/need the ABI options, -+ # just transfer them over to just the compiler invocations -+ variables['cc_compile_flags'] = '%s %s' % (variables['cxx_abi_flags'], variables['cc_compile_flags']) -+ variables['cxx_abi_flags'] = '' -+ - variables['lib_flags'] = cc.gen_lib_flags(options, variables) - variables['cmake_lib_flags'] = cmake_escape(variables['lib_flags']) - diff --git a/recipes/botan/all/patches/vs2015-install-fix.patch b/recipes/botan/all/patches/vs2015-install-fix.patch deleted file mode 100644 index c53e1a6c17844..0000000000000 --- a/recipes/botan/all/patches/vs2015-install-fix.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 42317bbcc7fe715b0a9f066bb52ed3c59dcc257e Mon Sep 17 00:00:00 2001 -From: Hannes Rantzsch -Date: Tue, 1 Dec 2020 09:40:38 +0100 -Subject: [PATCH] Backport a fix for a build issue in VS 2015 - -See https://github.com/randombit/botan/pull/2526 for details ---- - configure.py | 2 +- - src/build-data/makefile.in | 10 +++++----- - 2 files changed, 6 insertions(+), 6 deletions(-) - -diff --git a/configure.py b/configure.py -index 88eeaa575..f7affad72 100755 ---- a/configure.py -+++ b/configure.py -@@ -1994,7 +1994,7 @@ def create_template_vars(source_paths, build_paths, options, modules, cc, arch, - def choose_python_exe(): - exe = sys.executable - -- if exe[1] == ':': # Windows style paths -+ if options.os == 'mingw': # mingw doesn't handle the backslashes in the absolute path well - return exe.replace('\\', '/') - - return exe -diff --git a/src/build-data/makefile.in b/src/build-data/makefile.in -index 4d68ab1ec..b215bebb5 100644 ---- a/src/build-data/makefile.in -+++ b/src/build-data/makefile.in -@@ -48,19 +48,19 @@ docs: %{doc_stamp_file} - %{endif} - - %{doc_stamp_file}: %{doc_dir}/*.rst %{doc_dir}/api_ref/*.rst %{doc_dir}/dev_ref/*.rst -- $(PYTHON_EXE) $(SCRIPTS_DIR)/build_docs.py --build-dir="%{build_dir}" -+ "$(PYTHON_EXE)" "$(SCRIPTS_DIR)/build_docs.py" --build-dir="%{build_dir}" - - clean: -- $(PYTHON_EXE) $(SCRIPTS_DIR)/cleanup.py --build-dir="%{build_dir}" -+ "$(PYTHON_EXE)" "$(SCRIPTS_DIR)/cleanup.py" --build-dir="%{build_dir}" - - distclean: -- $(PYTHON_EXE) $(SCRIPTS_DIR)/cleanup.py --build-dir="%{build_dir}" --distclean -+ "$(PYTHON_EXE)" "$(SCRIPTS_DIR)/cleanup.py" --build-dir="%{build_dir}" --distclean - - install: %{install_targets} -- $(PYTHON_EXE) $(SCRIPTS_DIR)/install.py --prefix="%{prefix}" --build-dir="%{build_dir}" --bindir=%{bindir} --libdir=%{libdir} --docdir=%{docdir} --includedir=%{includedir} -+ "$(PYTHON_EXE)" "$(SCRIPTS_DIR)/install.py" --prefix="%{prefix}" --build-dir="%{build_dir}" --bindir="%{bindir}" --libdir="%{libdir}" --docdir="%{docdir}" --includedir="%{includedir}" - - check: tests -- $(PYTHON_EXE) $(SCRIPTS_DIR)/check.py --build-dir="%{build_dir}" -+ "$(PYTHON_EXE)" "$(SCRIPTS_DIR)/check.py" --build-dir="%{build_dir}" - - # Object Files - LIBOBJS = %{join lib_objs} --- -2.29.2 - diff --git a/recipes/botan/all/test_package/CMakeLists.txt b/recipes/botan/all/test_package/CMakeLists.txt index 5021b4e27691a..65e374a2711cc 100644 --- a/recipes/botan/all/test_package/CMakeLists.txt +++ b/recipes/botan/all/test_package/CMakeLists.txt @@ -1,11 +1,13 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.15) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package CXX) find_package(botan REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} botan::botan) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +if(botan_VERSION_STRING VERSION_LESS "3.0.0") + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +else() + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) +endif() diff --git a/recipes/botan/all/test_package/conanfile.py b/recipes/botan/all/test_package/conanfile.py index f4b0754b85efb..82bdc745af784 100644 --- a/recipes/botan/all/test_package/conanfile.py +++ b/recipes/botan/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_layout, CMake +from conan.tools.microsoft import is_msvc, VCVars 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 generate(self): + if is_msvc(self): + ms = VCVars(self) + ms.generate() def build(self): cmake = CMake(self) @@ -12,6 +27,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.build_folder, self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/botan/all/test_v1_package/CMakeLists.txt b/recipes/botan/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..50dcf4911579b --- /dev/null +++ b/recipes/botan/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(botan REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} botan::botan) +if(botan_VERSION_STRING VERSION_LESS "3.0.0") + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +else() + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) +endif() diff --git a/recipes/openh264/all/test_v1_package/conanfile.py b/recipes/botan/all/test_v1_package/conanfile.py similarity index 100% rename from recipes/openh264/all/test_v1_package/conanfile.py rename to recipes/botan/all/test_v1_package/conanfile.py diff --git a/recipes/botan/all/test_v1_package/test_package.cpp b/recipes/botan/all/test_v1_package/test_package.cpp new file mode 100644 index 0000000000000..d8ace17201cc0 --- /dev/null +++ b/recipes/botan/all/test_v1_package/test_package.cpp @@ -0,0 +1,7 @@ +#include + +int main() +{ + std::vector key = Botan::hex_decode("000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F"); + return 0; +} diff --git a/recipes/botan/config.yml b/recipes/botan/config.yml index 7fdc77ee53c3b..2b65b22fb483e 100644 --- a/recipes/botan/config.yml +++ b/recipes/botan/config.yml @@ -1,31 +1,33 @@ versions: - "2.12.1": + "2.17.3": folder: all - "2.13.0": + "2.18.2": folder: all - "2.14.0": + "2.19.1": folder: all - "2.15.0": + "2.19.2": folder: all - "2.16.0": + "2.19.3": folder: all - "2.17.0": + "2.19.4": folder: all - "2.17.1": + "2.19.5": folder: all - "2.17.2": + "3.0.0": folder: all - "2.17.3": + "3.1.0": folder: all - "2.18.0": + "3.1.1": folder: all - "2.18.1": + "3.2.0": folder: all - "2.18.2": + "3.3.0": folder: all - "2.19.1": + "3.4.0": folder: all - "2.19.2": + "3.5.0": folder: all - "2.19.3": + "3.6.0": + folder: all + "3.6.1": folder: all diff --git a/recipes/box2d/2.4.x/conandata.yml b/recipes/box2d/2.4.x/conandata.yml deleted file mode 100644 index c7372e2a8f037..0000000000000 --- a/recipes/box2d/2.4.x/conandata.yml +++ /dev/null @@ -1,10 +0,0 @@ -sources: - "2.4.0": - url: "https://github.com/erincatto/Box2D/archive/v2.4.0.zip" - sha256: "6aebbc54c93e367c97e382a57ba12546731dcde51526964c2ab97dec2050f8b9" - "2.4.1": - url: "https://github.com/erincatto/box2d/archive/refs/tags/v2.4.1.tar.gz" - sha256: "d6b4650ff897ee1ead27cf77a5933ea197cbeef6705638dd181adc2e816b23c2" -patches: - "2.4.0": - - 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 deleted file mode 100644 index ae09ce435deda..0000000000000 --- a/recipes/box2d/2.4.x/conanfile.py +++ /dev/null @@ -1,71 +0,0 @@ -import os -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.52.0" - - -class Box2dConan(ConanFile): - name = "box2d" - license = "Zlib" - description = "Box2D is a 2D physics engine for games" - homepage = "http://box2d.org/" - url = "https://github.com/conan-io/conan-center-index" - topics = ("physics-engine", "graphic", "2d", "collision") - settings = "os", "compiler", "build_type", "arch" - 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": - try: - del self.options.fPIC - except Exception: - pass - - 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 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["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" - tc.variables["BOX2D_BUILD_TESTBED"] = False - tc.variables["BOX2D_BUILD_UNIT_TESTS"] = False - tc.generate() - - def build(self): - apply_conandata_patches(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.configure() - cmake.install() - 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 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/test_package/CMakeLists.txt b/recipes/box2d/2.4.x/test_package/CMakeLists.txt deleted file mode 100644 index fb4d8d7f5888a..0000000000000 --- a/recipes/box2d/2.4.x/test_package/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -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_package/conanfile.py b/recipes/box2d/2.4.x/test_package/conanfile.py deleted file mode 100644 index d1ce1a2cbc477..0000000000000 --- a/recipes/box2d/2.4.x/test_package/conanfile.py +++ /dev/null @@ -1,26 +0,0 @@ -import os -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 = "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/box2d/2.4.x/test_package/test_package.cpp b/recipes/box2d/2.4.x/test_package/test_package.cpp deleted file mode 100644 index 7dfa813bc1d2e..0000000000000 --- a/recipes/box2d/2.4.x/test_package/test_package.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#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/box2d/2.4.x/test_v1_package/CMakeLists.txt b/recipes/box2d/2.4.x/test_v1_package/CMakeLists.txt deleted file mode 100644 index 373fb5bb61846..0000000000000 --- a/recipes/box2d/2.4.x/test_v1_package/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -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 deleted file mode 100644 index 7513484720425..0000000000000 --- a/recipes/box2d/2.4.x/test_v1_package/conanfile.py +++ /dev/null @@ -1,17 +0,0 @@ -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 deleted file mode 100644 index 7dfa813bc1d2e..0000000000000 --- a/recipes/box2d/2.4.x/test_v1_package/test_package.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#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/box2d/all/conandata.yml b/recipes/box2d/all/conandata.yml index 857c8f5d17268..28c5a38b19b94 100644 --- a/recipes/box2d/all/conandata.yml +++ b/recipes/box2d/all/conandata.yml @@ -1,4 +1,25 @@ sources: - "2.3.1": - url: "https://github.com/erincatto/Box2D/archive/v2.3.1.zip" - sha256: "8ddd947400c59bcf09774bd75787e6253098a0bd337f5c61dae38b91aea678cf" + "3.0.0": + url: "https://github.com/erincatto/box2d/archive/refs/tags/v3.0.0.tar.gz" + sha256: "64ad759006cd2377c99367f51fb36942b57f0e9ad690ed41548dd620e6f6c8b1" + "2.4.2": + url: "https://github.com/erincatto/box2d/archive/refs/tags/v2.4.2.tar.gz" + sha256: "85b9b104d256c985e6e244b4227d447897fac429071cc114e5cc819dae848852" + "2.4.1": + url: "https://github.com/erincatto/box2d/archive/refs/tags/v2.4.1.tar.gz" + sha256: "d6b4650ff897ee1ead27cf77a5933ea197cbeef6705638dd181adc2e816b23c2" + "2.4.0": + url: "https://github.com/erincatto/Box2D/archive/v2.4.0.zip" + sha256: "6aebbc54c93e367c97e382a57ba12546731dcde51526964c2ab97dec2050f8b9" +patches: + "3.0.0": + - patch_file: "patches/3.0.0-0001-fix-cmake.patch" + patch_description: "fix installer" + patch_type: "conan" + - patch_file: "patches/3.0.0-0002-use-cci.patch" + patch_description: "use cci package" + patch_type: "conan" + "2.4.0": + - patch_file: "patches/0001-install-and-allow-shared.patch" + patch_description: "add install, allow shared build" + patch_type: "conan" diff --git a/recipes/box2d/all/conanfile.py b/recipes/box2d/all/conanfile.py index e5adde1f2b06a..085cd30b96269 100644 --- a/recipes/box2d/all/conanfile.py +++ b/recipes/box2d/all/conanfile.py @@ -1,68 +1,117 @@ import os -from conan import ConanFile, tools -from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, rm, rmdir, copy +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version -required_conan_version = ">=1.46.0" +required_conan_version = ">=1.53.0" class Box2dConan(ConanFile): name = "box2d" - license = "Zlib" description = "Box2D is a 2D physics engine for games" - topics = ("physics", "engine", "game development") - homepage = "http://box2d.org/" + license = "Zlib" 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,} + homepage = "http://box2d.org/" + topics = ("physics-engine", "graphic", "2d", "collision") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False] + } + default_options = { + "shared": False, + "fPIC": True + } + + @property + def _compilers_minimum_version(self): + return { + "apple-clang": "10", + "clang": "7", + "gcc": "8", + "msvc": "193", + "Visual Studio": "17", + } + + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") + if Version(self.version) >= "3.0.0": + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): - cmake_layout(self, src_folder="Box2D") + cmake_layout(self, src_folder="src") + + def requirements(self): + if Version(self.version) >= "3.0.0": + self.requires("simde/0.8.2") + + def validate(self): + if Version(self.version) < "3.0.0": + return + + 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 C17, which your compiler does not support." + ) + + def build_requirements(self): + if Version(self.version) >= "3.0.0": + self.tool_requires("cmake/[>=3.22 <4]") def source(self): - tools.files.get(self, - **self.conan_data["sources"][self.version], - strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) - tc.variables["BOX2D_BUILD_SHARED"] = self.options.shared - tc.variables["BOX2D_BUILD_STATIC"] = not self.options.shared - if self.settings.os == "Windows" and self.options.shared: - tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True - tc.variables["BOX2D_BUILD_EXAMPLES"] = False + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.cache_variables["CMAKE_COMPILE_WARNING_AS_ERROR"] = False + if Version(self.version) < "3.0.0": + tc.variables["BOX2D_BUILD_TESTBED"] = False + tc.variables["BOX2D_BUILD_UNIT_TESTS"] = False + else: + tc.variables["BOX2D_SAMPLES"] = False + tc.variables["BOX2D_VALIDATE"] = False + tc.variables["BOX2D_UNIT_TESTS"] = False tc.generate() + if Version(self.version) >= "3.0.0": + deps = CMakeDeps(self) + deps.generate() def build(self): + apply_conandata_patches(self) cmake = CMake(self) - cmake.configure(build_script_folder="Box2D") + cmake.configure() cmake.build() def package(self): - tools.files.copy(self, "License.txt", src=os.path.join(self.source_folder, "Box2D"), dst=os.path.join(self.package_folder,"licenses")) - tools.files.copy(self, os.path.join("Box2D", "*.h"), src=os.path.join(self.source_folder, "Box2D"), dst=os.path.join(self.package_folder, "include")) - tools.files.copy(self, "*.lib", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) - tools.files.copy(self, "*.dll", src=self.build_folder, dst=os.path.join(self.package_folder, "bin"), keep_path=False) - tools.files.copy(self, "*.so*", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) - tools.files.copy(self, "*.dylib", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) - tools.files.copy(self, "*.a", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, "LICENSE", 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", "cmake")) + rm(self, "*.pdb", self.package_folder, recursive=True) def package_info(self): - self.cpp_info.libs = ["Box2D"] - if self.settings.os in ("FreeBSD", "Linux"): - self.cpp_info.system_libs = ["m"] + self.cpp_info.names["cmake_find_package"] = "box2d" + self.cpp_info.names["cmake_find_package_multi"] = "box2d" + self.cpp_info.libs = ["box2d"] + if Version(self.version) >= "3.0.0" and is_msvc(self) and self.options.shared: + self.cpp_info.defines.append("BOX2D_DLL") + elif Version(self.version) >= "2.4.1" and self.options.shared: + self.cpp_info.defines.append("B2_SHARED") + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") diff --git a/recipes/box2d/2.4.x/patches/0001-install-and-allow-shared.patch b/recipes/box2d/all/patches/0001-install-and-allow-shared.patch similarity index 100% rename from recipes/box2d/2.4.x/patches/0001-install-and-allow-shared.patch rename to recipes/box2d/all/patches/0001-install-and-allow-shared.patch diff --git a/recipes/box2d/all/patches/3.0.0-0001-fix-cmake.patch b/recipes/box2d/all/patches/3.0.0-0001-fix-cmake.patch new file mode 100644 index 0000000000000..156dff0943ae2 --- /dev/null +++ b/recipes/box2d/all/patches/3.0.0-0001-fix-cmake.patch @@ -0,0 +1,17 @@ +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 5078d14..7ec17bc 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -180,4 +180,11 @@ endif() + source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}" PREFIX "src" FILES ${BOX2D_SOURCE_FILES}) + source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}/../include" PREFIX "include" FILES ${BOX2D_API_FILES}) + +-install(TARGETS box2d) ++include(GNUInstallDirs) ++ ++install(TARGETS box2d ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++) ++install(FILES ${BOX2D_API_FILES} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/box2d) diff --git a/recipes/box2d/all/patches/3.0.0-0002-use-cci.patch b/recipes/box2d/all/patches/3.0.0-0002-use-cci.patch new file mode 100644 index 0000000000000..b9d850f931bb8 --- /dev/null +++ b/recipes/box2d/all/patches/3.0.0-0002-use-cci.patch @@ -0,0 +1,76 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 8c1390e..d6590d7 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -53,7 +53,7 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON) + set(CMAKE_VERBOSE_MAKEFILE ON) + + # The Box2D library uses simde https://github.com/simd-everywhere/simde +-add_subdirectory(extern/simde) ++# add_subdirectory(extern/simde) + add_subdirectory(src) + + # This hides samples, test, and doxygen from apps that use box2d via FetchContent +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 5078d14..7ec17bc 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -78,7 +78,7 @@ add_library(box2d ${BOX2D_SOURCE_FILES} ${BOX2D_API_FILES}) + # turned this off to make Box2D easier to use without cmake + # include(GenerateExportHeader) + # generate_export_header(box2d) +- ++find_package(simde REQUIRED CONFIG) + target_include_directories(box2d + PUBLIC + $ +@@ -89,7 +89,7 @@ target_include_directories(box2d + ) + + # SIMDE is used to support SIMD math on multiple platforms +-target_link_libraries(box2d PRIVATE simde) ++target_link_libraries(box2d PRIVATE simde::simde) + + # Box2D uses C17 + set_target_properties(box2d PROPERTIES +diff --git a/src/contact_solver.c b/src/contact_solver.c +index b190501..c61e250 100644 +--- a/src/contact_solver.c ++++ b/src/contact_solver.c +@@ -9,8 +9,8 @@ + #include "core.h" + #include "solver_set.h" + #include "world.h" +-#include "x86/avx2.h" +-#include "x86/fma.h" ++#include "simde/x86/avx2.h" ++#include "simde/x86/fma.h" + + // Soft contact constraints with sub-stepping support + // http://mmacklin.com/smallsteps.pdf +diff --git a/src/contact_solver.h b/src/contact_solver.h +index e265e93..dcdc1fb 100644 +--- a/src/contact_solver.h ++++ b/src/contact_solver.h +@@ -4,7 +4,7 @@ + #pragma once + + #include "solver.h" +-#include "x86/avx.h" ++#include "simde/x86/avx.h" + + typedef struct b2ContactSim b2ContactSim; + +diff --git a/src/solver.c b/src/solver.c +index d83a471..a115417 100644 +--- a/src/solver.c ++++ b/src/solver.c +@@ -17,7 +17,7 @@ + #include "world.h" + + // for mm_pause +-#include "x86/sse2.h" ++#include "simde/x86/sse2.h" + + #include + #include diff --git a/recipes/box2d/all/test_package/CMakeLists.txt b/recipes/box2d/all/test_package/CMakeLists.txt index 22c1118333f4f..4648d77c658ec 100644 --- a/recipes/box2d/all/test_package/CMakeLists.txt +++ b/recipes/box2d/all/test_package/CMakeLists.txt @@ -1,7 +1,13 @@ -cmake_minimum_required(VERSION 3.4) -project(test_package) +cmake_minimum_required(VERSION 3.21) +project(test_package LANGUAGES C CXX) -find_package(box2d) +find_package(box2d REQUIRED CONFIG) -add_executable(test_package test_package.cpp) -target_link_libraries(test_package box2d::box2d) +if(box2d_VERSION VERSION_LESS "3.0.0") + add_executable(${PROJECT_NAME} test_package.cpp) + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +else() + add_executable(${PROJECT_NAME} test_package3.c) + target_compile_features(${PROJECT_NAME} PRIVATE c_std_17) +endif() +target_link_libraries(${PROJECT_NAME} PRIVATE box2d::box2d) diff --git a/recipes/box2d/all/test_package/conanfile.py b/recipes/box2d/all/test_package/conanfile.py index a3a0294a68898..3526395bd33d5 100644 --- a/recipes/box2d/all/test_package/conanfile.py +++ b/recipes/box2d/all/test_package/conanfile.py @@ -1,11 +1,13 @@ import os -from conan import ConanFile, 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 class Box2DTestConan(ConanFile): settings = "os", "compiler", "build_type", "arch" generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" def layout(self): cmake_layout(self) @@ -13,12 +15,15 @@ def layout(self): def requirements(self): self.requires(self.tested_reference_str) + def build_requirements(self): + self.tool_requires("cmake/[>=3.21 <4]") + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not tools.build.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/box2d/all/test_package/test_package.cpp b/recipes/box2d/all/test_package/test_package.cpp index 045f0bf063169..31112b0dcea5a 100644 --- a/recipes/box2d/all/test_package/test_package.cpp +++ b/recipes/box2d/all/test_package/test_package.cpp @@ -1,88 +1,15 @@ -#include -#include +#include "box2d/box2d.h" -#include - -// This is a simple example of building and running a simulation -// using Box2D. Here we create a large ground box and a small dynamic -// box. -// There are no graphics for this example. Box2D is meant to be used -// with your rendering engine in your game engine. -int main(int argc, char **argv) -{ - B2_NOT_USED(argc); - B2_NOT_USED(argv); - - // Define the gravity vector. +int main(void) { b2Vec2 gravity(0.0f, -10.0f); - - // Construct a world object, which will hold and simulate the rigid bodies. b2World world(gravity); - // Define the ground body. b2BodyDef groundBodyDef; groundBodyDef.position.Set(0.0f, -10.0f); - // Call the body factory which allocates memory for the ground body - // from a pool and creates the ground box shape (also from a pool). - // The body is also added to the world. - b2Body *groundBody = world.CreateBody(&groundBodyDef); - - // Define the ground box shape. + b2Body* groundBody = world.CreateBody(&groundBodyDef); b2PolygonShape groundBox; - - // The extents are the half-widths of the box. groundBox.SetAsBox(50.0f, 10.0f); - // Add the ground fixture to the ground body. - groundBody->CreateFixture(&groundBox, 0.0f); - - // Define the dynamic body. We set its position and call the body factory. - b2BodyDef bodyDef; - bodyDef.type = b2_dynamicBody; - bodyDef.position.Set(0.0f, 4.0f); - b2Body *body = world.CreateBody(&bodyDef); - - // Define another box shape for our dynamic body. - b2PolygonShape dynamicBox; - dynamicBox.SetAsBox(1.0f, 1.0f); - - // Define the dynamic body fixture. - b2FixtureDef fixtureDef; - fixtureDef.shape = &dynamicBox; - - // Set the box density to be non-zero, so it will be dynamic. - fixtureDef.density = 1.0f; - - // Override the default friction. - fixtureDef.friction = 0.3f; - - // Add the shape to the body. - body->CreateFixture(&fixtureDef); - - // Prepare for simulation. Typically we use a time step of 1/60 of a - // second (60Hz) and 10 iterations. This provides a high quality simulation - // in most game scenarios. - float32 timeStep = 1.0f / 60.0f; - int32 velocityIterations = 6; - int32 positionIterations = 2; - - // This is our little game loop. - for (int32 i = 0; i < 60; ++i) - { - // Instruct the world to perform a single step of simulation. - // It is generally best to keep the time step and iterations fixed. - world.Step(timeStep, velocityIterations, positionIterations); - - // Now print the position and angle of the body. - b2Vec2 position = body->GetPosition(); - float32 angle = body->GetAngle(); - - printf("%4.2f %4.2f %4.2f\n", position.x, position.y, angle); - } - - // When the world destructor is called, all bodies and joints are freed. This can - // create orphaned pointers, so be careful about your world management. - return 0; } diff --git a/recipes/box2d/all/test_package/test_package3.c b/recipes/box2d/all/test_package/test_package3.c new file mode 100644 index 0000000000000..abad79d1a39be --- /dev/null +++ b/recipes/box2d/all/test_package/test_package3.c @@ -0,0 +1,13 @@ +#include "box2d/box2d.h" + +int main() { + b2WorldDef worldDef = b2DefaultWorldDef(); + + worldDef.gravity = (b2Vec2){0.0f, -10.0f}; + b2WorldId worldId = b2CreateWorld(&worldDef); + + b2BodyDef groundBodyDef = b2DefaultBodyDef(); + groundBodyDef.position = (b2Vec2){0.0f, -10.0f}; + + return 0; +} diff --git a/recipes/box2d/all/test_v1_package/CMakeLists.txt b/recipes/box2d/all/test_v1_package/CMakeLists.txt deleted file mode 100644 index 458981ad5eb24..0000000000000 --- a/recipes/box2d/all/test_v1_package/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(test_package) - -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/box2d/all/test_v1_package/conanfile.py b/recipes/box2d/all/test_v1_package/conanfile.py deleted file mode 100644 index 133228fb54665..0000000000000 --- a/recipes/box2d/all/test_v1_package/conanfile.py +++ /dev/null @@ -1,17 +0,0 @@ -import os -from conans import ConanFile, CMake, tools - - -class Box2DTestConan(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/box2d/config.yml b/recipes/box2d/config.yml index 1922ed59d887d..476a7f5aa4a7c 100644 --- a/recipes/box2d/config.yml +++ b/recipes/box2d/config.yml @@ -1,7 +1,9 @@ versions: - "2.3.1": + "3.0.0": + folder: "all" + "2.4.2": folder: "all" - "2.4.0": - folder: "2.4.x" "2.4.1": - folder: "2.4.x" + folder: "all" + "2.4.0": + folder: "all" diff --git a/recipes/breakpad/all/conandata.yml b/recipes/breakpad/all/conandata.yml index ca1b1d96e427d..da051fdc78d51 100644 --- a/recipes/breakpad/all/conandata.yml +++ b/recipes/breakpad/all/conandata.yml @@ -5,6 +5,5 @@ 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" + - patch_file: "patches/0003-Fix-gcc11-compilation.patch" diff --git a/recipes/breakpad/all/conanfile.py b/recipes/breakpad/all/conanfile.py index 369681d6570ec..e9de3c6e8371e 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") + self.requires("linux-syscall-support/cci.20200813", transitive_headers=True) - 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/patches/0003-Fix-gcc11-compilation.patch b/recipes/breakpad/all/patches/0003-Fix-gcc11-compilation.patch new file mode 100644 index 0000000000000..4ce40736676ee --- /dev/null +++ b/recipes/breakpad/all/patches/0003-Fix-gcc11-compilation.patch @@ -0,0 +1,11 @@ +--- a/src/client/linux/handler/exception_handler.cc ++++ b/src/client/linux/handler/exception_handler.cc +@@ -138,7 +138,7 @@ + // SIGSTKSZ may be too small to prevent the signal handlers from overrunning + // the alternative stack. Ensure that the size of the alternative stack is + // large enough. +- static const unsigned kSigStackSize = std::max(16384, SIGSTKSZ); ++ static const unsigned kSigStackSize = std::max(16384, SIGSTKSZ); + + // Only set an alternative stack if there isn't already one, or if the current + // one is too small. 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/bredis/all/conandata.yml b/recipes/bredis/all/conandata.yml new file mode 100644 index 0000000000000..b75947b37ddc5 --- /dev/null +++ b/recipes/bredis/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.12": + url: "https://github.com/basiliscos/cpp-bredis/archive/refs/tags/v0.12.tar.gz" + sha256: "c5a6aa58835d5ef8cd97c4ae7e677f6237ef4ee01ae4a609293e2351c01db6cc" diff --git a/recipes/bredis/all/conanfile.py b/recipes/bredis/all/conanfile.py new file mode 100644 index 0000000000000..c73f99338488a --- /dev/null +++ b/recipes/bredis/all/conanfile.py @@ -0,0 +1,57 @@ +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 BredisConan(ConanFile): + name = "bredis" + description = "Boost::ASIO low-level redis client (connector)" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/basiliscos/cpp-bredis" + topics = ("redis", "network", "asio", "header-only") + package_type = "header-library" + 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("boost/1.85.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) + + 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"), + ) + copy( + self, + pattern="*.ipp", + 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/bredis/all/test_package/CMakeLists.txt b/recipes/bredis/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..ede594d5b149f --- /dev/null +++ b/recipes/bredis/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(bredis REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE bredis::bredis) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/bredis/all/test_package/conanfile.py b/recipes/bredis/all/test_package/conanfile.py new file mode 100644 index 0000000000000..b9d7f11e89dcd --- /dev/null +++ b/recipes/bredis/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 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/bredis/all/test_package/test_package.cpp b/recipes/bredis/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..9a85a98f4bd7f --- /dev/null +++ b/recipes/bredis/all/test_package/test_package.cpp @@ -0,0 +1,12 @@ +#include +#include + +#include "bredis/Connection.hpp" +#include "bredis/MarkerHelpers.hpp" + +int main(int argc, const char **argv) { + // Basic test avoiding any kind of access to network layer + bredis::bredis_category category; + std::cout << category.name() << '\n'; + return 0; +} diff --git a/recipes/bredis/config.yml b/recipes/bredis/config.yml new file mode 100644 index 0000000000000..f30ab3fc58bb9 --- /dev/null +++ b/recipes/bredis/config.yml @@ -0,0 +1,3 @@ +versions: + "0.12": + folder: all diff --git a/recipes/brigand/all/conanfile.py b/recipes/brigand/all/conanfile.py index d205988b4830f..21dde9eb4313f 100644 --- a/recipes/brigand/all/conanfile.py +++ b/recipes/brigand/all/conanfile.py @@ -14,7 +14,7 @@ class BrigandConan(ConanFile): topics = ("meta-programming", "boost", "runtime", "header-only") homepage = "https://github.com/edouarda/brigand" license = "BSL-1.0" - + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" options = { "with_boost": [True, False], @@ -25,9 +25,11 @@ class BrigandConan(ConanFile): no_copy_source = True + def layout(self): + basic_layout(self, src_folder="src") + def requirements(self): if self.options.with_boost: - # TODO: add transitive_headers=True & bump required_conan_version to >=1.52.0 self.requires("boost/1.79.0") def package_id(self): @@ -37,12 +39,8 @@ 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def build(self): pass @@ -55,9 +53,7 @@ def package(self): def package_info(self): self.cpp_info.set_property("pkg_config_name", "libbrigand") self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] if self.options.with_boost: self.cpp_info.requires = ["boost::headers"] else: diff --git a/recipes/brotli/all/conandata.yml b/recipes/brotli/all/conandata.yml index c664dae35678e..35c9587456f43 100644 --- a/recipes/brotli/all/conandata.yml +++ b/recipes/brotli/all/conandata.yml @@ -1,12 +1,23 @@ sources: + "1.1.0": + url: "https://github.com/google/brotli/archive/v1.1.0.tar.gz" + sha256: "e720a6ca29428b803f4ad165371771f5398faba397edf6778837a18599ea13ff" "1.0.9": - url: https://github.com/google/brotli/archive/v1.0.9.tar.gz - sha256: f9e8d81d0405ba66d181529af42a3354f838c939095ff99930da6aa9cdf6fe46 + url: "https://github.com/google/brotli/archive/v1.0.9.tar.gz" + sha256: "f9e8d81d0405ba66d181529af42a3354f838c939095ff99930da6aa9cdf6fe46" "1.0.7": - url: https://github.com/google/brotli/archive/v1.0.7.tar.gz - sha256: 4c61bfb0faca87219ea587326c467b95acb25555b53d1a421ffa3c8a9296ee2c + url: "https://github.com/google/brotli/archive/v1.0.7.tar.gz" + sha256: "4c61bfb0faca87219ea587326c467b95acb25555b53d1a421ffa3c8a9296ee2c" patches: + "1.1.0": + - patch_file: "patches/1.1.0-target-props.patch" + patch_description: "add target properties, disable command build" + patch_type: "conan" "1.0.9": - - patch_file: "patches/0002-target-props.patch" + - patch_file: "patches/1.0.9-target-props.patch" + patch_description: "add target properties, disable command build, separate shared and static build" + patch_type: "conan" "1.0.7": - - patch_file: "patches/0001-target-props.patch" + - patch_file: "patches/1.0.7-target-props.patch" + patch_description: "add target properties, disable command build, separate shared and static build" + patch_type: "conan" diff --git a/recipes/brotli/all/conanfile.py b/recipes/brotli/all/conanfile.py index 1f7e57755d1f4..47e559afcc649 100644 --- a/recipes/brotli/all/conanfile.py +++ b/recipes/brotli/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, 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.53.0" class BrotliConan(ConanFile): name = "brotli" description = "Brotli compression format" - topics = ("brotli", "compression") + license = "MIT", url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/google/brotli" - license = "MIT", - + topics = ("brotli", "compression") + 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) @@ -85,8 +78,9 @@ def generate(self): tc.preprocessor_definitions["BROTLI_DEBUG"] = 1 if self.options.enable_log: tc.preprocessor_definitions["BROTLI_ENABLE_LOG"] = 1 - # To install relocatable shared libs on Macos - tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" + if Version(self.version) < "1.1.0": + # To install relocatable shared libs on Macos + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" tc.generate() def build(self): @@ -132,6 +126,6 @@ def package_info(self): def _get_decorated_lib(self, name): libname = name - if not self.options.shared: + if Version(self.version) < "1.1.0" and not self.options.shared: libname += "-static" return libname diff --git a/recipes/brotli/all/patches/0001-target-props.patch b/recipes/brotli/all/patches/1.0.7-target-props.patch similarity index 100% rename from recipes/brotli/all/patches/0001-target-props.patch rename to recipes/brotli/all/patches/1.0.7-target-props.patch diff --git a/recipes/brotli/all/patches/0002-target-props.patch b/recipes/brotli/all/patches/1.0.9-target-props.patch similarity index 100% rename from recipes/brotli/all/patches/0002-target-props.patch rename to recipes/brotli/all/patches/1.0.9-target-props.patch diff --git a/recipes/brotli/all/patches/1.1.0-target-props.patch b/recipes/brotli/all/patches/1.1.0-target-props.patch new file mode 100644 index 0000000000000..0c9b697569cec --- /dev/null +++ b/recipes/brotli/all/patches/1.1.0-target-props.patch @@ -0,0 +1,26 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -113,7 +113,6 @@ elseif(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") + elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + add_definitions(-DOS_MACOSX) + set(CMAKE_MACOS_RPATH TRUE) +- set(CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib") + endif() + + if(BROTLI_EMSCRIPTEN) +@@ -171,14 +170,10 @@ endif() + # Build the brotli executable + add_executable(brotli c/tools/brotli.c) + target_link_libraries(brotli ${BROTLI_LIBRARIES}) ++set_target_properties(brotli PROPERTIES EXCLUDE_FROM_ALL ON EXCLUDE_FROM_DEFAULT ON) + + # Installation + if(NOT BROTLI_BUNDLED_MODE) +- install( +- TARGETS brotli +- RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" +- ) +- + install( + TARGETS ${BROTLI_LIBRARIES_CORE} + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" diff --git a/recipes/brotli/all/test_package/CMakeLists.txt b/recipes/brotli/all/test_package/CMakeLists.txt index 8339b11b6d1f4..00f09fcd40122 100644 --- a/recipes/brotli/all/test_package/CMakeLists.txt +++ b/recipes/brotli/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(brotli REQUIRED CONFIG) 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/brotli/config.yml b/recipes/brotli/config.yml index 39d54f0009ed0..f4b59633d9f83 100644 --- a/recipes/brotli/config.yml +++ b/recipes/brotli/config.yml @@ -1,4 +1,6 @@ versions: + "1.1.0": + folder: all "1.0.9": folder: all "1.0.7": diff --git a/recipes/brunsli/all/conandata.yml b/recipes/brunsli/all/conandata.yml new file mode 100644 index 0000000000000..8a8c640caa115 --- /dev/null +++ b/recipes/brunsli/all/conandata.yml @@ -0,0 +1,22 @@ +sources: + "cci.20231024": + url: "https://github.com/google/brunsli/archive/0b7bd7b47d1f8fd8682d4818180e0ab42f26d4c3.tar.gz" + sha256: "b4ca17e1bbb3a6cae6b840d78422490b75733b4165e5ba066302154d971ec32e" + "0.1": + url: "https://github.com/google/brunsli/archive/refs/tags/v0.1.tar.gz" + sha256: "62762dc740f9fcc9706449c078f12c2a366416486d2882be50a9f201f99ac0bc" +patches: + "cci.20231024": + - patch_file: "patches/cci.20230730/001-cmake-use-conan-deps.patch" + patch_description: "Use Conan dependencies in CMake" + patch_type: "conan" + - patch_file: "patches/cci.20230730/002-fix-shared-windows-build.patch" + patch_description: "Fix shared Windows build, do not build executables" + patch_type: "conan" + "0.1": + - patch_file: "patches/0.1/001-cmake-use-conan-deps.patch" + patch_description: "Use Conan dependencies in CMake" + patch_type: "conan" + - patch_file: "patches/0.1/002-fix-shared-windows-build.patch" + patch_description: "Fix shared Windows build, do not build executables" + patch_type: "conan" diff --git a/recipes/brunsli/all/conanfile.py b/recipes/brunsli/all/conanfile.py new file mode 100644 index 0000000000000..d437851b72dc5 --- /dev/null +++ b/recipes/brunsli/all/conanfile.py @@ -0,0 +1,100 @@ +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, cmake_layout +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, replace_in_file, save + +required_conan_version = ">=1.53.0" + +class PackageConan(ConanFile): + name = "brunsli" + description = "Practical JPEG Repacker" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/google/brunsli" + topics = ("jpeg", "repacker", "codec", "brotli", "wasm") + + 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") + self.options["brotli"].shared = False + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires("brotli/1.0.9", transitive_libs=True) + + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, 11) + if self.dependencies["brotli"].options.shared: + raise ConanInvalidConfiguration("brotli must be built as a static library") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["BUILD_TESTING"] = False + # TODO: add WASM support + tc.cache_variables["BRUNSLI_EMSCRIPTEN"] = False + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + tc.generate() + + deps = CMakeDeps(self) + deps.set_property("brotli::brotlidec", "cmake_target_name", "brotlidec-static") + deps.set_property("brotli::brotlienc", "cmake_target_name", "brotlienc-static") + deps.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + # Allow Conan to control the linkage type of the output libraries + if not self.options.shared: + replace_in_file(self, os.path.join(self.source_folder, "brunsli.cmake"), " SHARED", "") + save(self, os.path.join(self.source_folder, "brunsli.cmake"), + "\ninstall(TARGETS brunslicommon-static brunslidec-static brunslienc-static)", + append=True) + # Fix DLL installation + replace_in_file(self, os.path.join(self.source_folder, "brunsli.cmake"), + 'LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"', + 'LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ' + 'RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"') + + def build(self): + self._patch_sources() + 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.components["brunslidec-c"].libs = ["brunslidec-c"] + self.cpp_info.components["brunslienc-c"].libs = ["brunslienc-c"] + if not self.options.shared: + self.cpp_info.components["brunslidec-c"].libs += ["brunslicommon-static", "brunslidec-static"] + self.cpp_info.components["brunslienc-c"].libs += ["brunslicommon-static", "brunslienc-static"] diff --git a/recipes/brunsli/all/patches/0.1/001-cmake-use-conan-deps.patch b/recipes/brunsli/all/patches/0.1/001-cmake-use-conan-deps.patch new file mode 100644 index 0000000000000..addcf9825b6ba --- /dev/null +++ b/recipes/brunsli/all/patches/0.1/001-cmake-use-conan-deps.patch @@ -0,0 +1,11 @@ +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -26,7 +26,7 @@ + set(CMAKE_CXX_EXTENSIONS OFF) + set(CMAKE_CXX_STANDARD_REQUIRED YES) + +-add_subdirectory(third_party) ++find_package(Brotli REQUIRED CONFIG) + + # The Brunsli library definition. + include(brunsli.cmake) diff --git a/recipes/brunsli/all/patches/0.1/002-fix-shared-windows-build.patch b/recipes/brunsli/all/patches/0.1/002-fix-shared-windows-build.patch new file mode 100644 index 0000000000000..d0055137f9a83 --- /dev/null +++ b/recipes/brunsli/all/patches/0.1/002-fix-shared-windows-build.patch @@ -0,0 +1,43 @@ +Linked static libraries do not export symbols on Windows, +so build the shared libraries from scratch instead. +--- brunsli.cmake ++++ brunsli.cmake +@@ -74,13 +74,21 @@ + + if(NOT BRUNSLI_EMSCRIPTEN) + add_library(brunslidec-c SHARED ++ ${BRUNSLI_COMMON_SOURCES} ++ ${BRUNSLI_COMMON_HEADERS} ++ ${BRUNSLI_DEC_SOURCES} ++ ${BRUNSLI_DEC_HEADERS} + c/dec/decode.cc + ) +-target_link_libraries(brunslidec-c PRIVATE brunslidec-static) ++target_link_libraries(brunslidec-c PRIVATE brotlidec-static) + add_library(brunslienc-c SHARED ++ ${BRUNSLI_COMMON_SOURCES} ++ ${BRUNSLI_COMMON_HEADERS} ++ ${BRUNSLI_ENC_SOURCES} ++ ${BRUNSLI_ENC_HEADERS} + c/enc/encode.cc + ) +-target_link_libraries(brunslienc-c PRIVATE brunslienc-static) ++target_link_libraries(brunslienc-c PRIVATE brotlienc-static) + list(APPEND BRUNSLI_LIBRARIES brunslidec-c brunslienc-c) + endif() # BRUNSLI_EMSCRIPTEN + +@@ -95,14 +103,6 @@ + endforeach() + + if(NOT BRUNSLI_EMSCRIPTEN) +-add_executable(cbrunsli c/tools/cbrunsli.cc) +-target_link_libraries(cbrunsli PRIVATE +- brunslienc-static +-) +-add_executable(dbrunsli c/tools/dbrunsli.cc) +-target_link_libraries(dbrunsli PRIVATE +- brunslidec-static +-) + else() # BRUNSLI_EMSCRIPTEN + set(WASM_MODULES brunslicodec-wasm brunslidec-wasm brunslienc-wasm) + foreach(module IN LISTS WASM_MODULES) diff --git a/recipes/brunsli/all/patches/cci.20230730/001-cmake-use-conan-deps.patch b/recipes/brunsli/all/patches/cci.20230730/001-cmake-use-conan-deps.patch new file mode 100644 index 0000000000000..b78a5ce662490 --- /dev/null +++ b/recipes/brunsli/all/patches/cci.20230730/001-cmake-use-conan-deps.patch @@ -0,0 +1,31 @@ +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -25,27 +25,7 @@ + set(CMAKE_CXX_EXTENSIONS OFF) + set(CMAKE_CXX_STANDARD_REQUIRED YES) + +-include(FetchContent) +- +-# Add GTest +-FetchContent_Declare( +- GTest +- GIT_REPOSITORY https://github.com/google/googletest +- GIT_TAG e2239ee6043f73722e7aa812a459f54a28552929 # v1.11.0 +-) +-# For Windows: Prevent overriding the parent project's compiler/linker settings +-set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) +-set(BUILD_GMOCK OFF CACHE INTERNAL "") +-FetchContent_MakeAvailable(GTest) +- +-# Add Brotli +-FetchContent_Declare( +- Brotli +- GIT_REPOSITORY https://github.com/google/brotli +- GIT_TAG e61745a6b7add50d380cfd7d3883dd6c62fc2c71 # v1.0.9 +-) +-set(BROTLI_DISABLE_TESTS ON CACHE INTERNAL "") +-FetchContent_MakeAvailable(Brotli) ++find_package(Brotli REQUIRED CONFIG) + + include(CTest) + diff --git a/recipes/brunsli/all/patches/cci.20230730/002-fix-shared-windows-build.patch b/recipes/brunsli/all/patches/cci.20230730/002-fix-shared-windows-build.patch new file mode 100644 index 0000000000000..cec4a0e274d89 --- /dev/null +++ b/recipes/brunsli/all/patches/cci.20230730/002-fix-shared-windows-build.patch @@ -0,0 +1,72 @@ +Linked static libraries do not export symbols on Windows, +so build the shared libraries from scratch instead. +--- brunsli.cmake ++++ brunsli.cmake +@@ -77,13 +77,21 @@ + + if(NOT BRUNSLI_EMSCRIPTEN) + add_library(brunslidec-c SHARED ++ ${BRUNSLI_COMMON_SOURCES} ++ ${BRUNSLI_COMMON_HEADERS} ++ ${BRUNSLI_DEC_SOURCES} ++ ${BRUNSLI_DEC_HEADERS} + c/dec/decode.cc + ) +-target_link_libraries(brunslidec-c PRIVATE brunslidec-static) ++target_link_libraries(brunslidec-c PRIVATE brotlidec-static) + add_library(brunslienc-c SHARED ++ ${BRUNSLI_COMMON_SOURCES} ++ ${BRUNSLI_COMMON_HEADERS} ++ ${BRUNSLI_ENC_SOURCES} ++ ${BRUNSLI_ENC_HEADERS} + c/enc/encode.cc + ) +-target_link_libraries(brunslienc-c PRIVATE brunslienc-static) ++target_link_libraries(brunslienc-c PRIVATE brotlienc-static) + list(APPEND BRUNSLI_LIBRARIES brunslidec-c brunslienc-c) + endif() # BRUNSLI_EMSCRIPTEN + +@@ -95,14 +103,6 @@ + set_property(TARGET ${lib} PROPERTY POSITION_INDEPENDENT_CODE ON) + endforeach() + +-add_executable(cbrunsli c/tools/cbrunsli.cc) +-target_link_libraries(cbrunsli PRIVATE +- brunslienc-static +-) +-add_executable(dbrunsli c/tools/dbrunsli.cc) +-target_link_libraries(dbrunsli PRIVATE +- brunslidec-static +-) + if(BRUNSLI_EMSCRIPTEN) + set(WASM_MODULES brunslicodec-wasm brunslidec-wasm brunslienc-wasm) + foreach(module IN LISTS WASM_MODULES) +@@ -121,14 +121,6 @@ + ${WASM_BASE_FLAGS} \ + -s MODULARIZE=1 \ + -s FILESYSTEM=0 \ +-") +-set_target_properties(cbrunsli PROPERTIES LINK_FLAGS "\ +- ${WASM_BASE_FLAGS} \ +- -s NODERAWFS=1 \ +-") +-set_target_properties(dbrunsli PROPERTIES LINK_FLAGS "\ +- ${WASM_BASE_FLAGS} \ +- -s NODERAWFS=1 \ + ") + set(WASM_COMMON_EXPORT "\"_malloc\",\"_free\"") + set(WASM_DEC_EXPORT "\"_BrunsliToJpeg\",\"_GetJpegData\",\"_GetJpegLength\",\"_FreeJpeg\",\"_BrunsliDecoderInit\",\"_BrunsliDecoderProcess\",\"_BrunsliDecoderCleanup\"") +@@ -163,13 +155,6 @@ + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" + ) + endif() # BRUNSLI_EMSCRIPTEN +- +-# Gather artifacts in a single directory for easier uploading. +-set_target_properties(cbrunsli dbrunsli ${BRUNSLI_LIBRARIES} PROPERTIES +- ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/artifacts" +- LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/artifacts" +- RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/artifacts" +-) + + if (${BUILD_TESTING}) + diff --git a/recipes/brunsli/all/test_package/CMakeLists.txt b/recipes/brunsli/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..f9b1ede7bb029 --- /dev/null +++ b/recipes/brunsli/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.15) + +project(test_package CXX) + +find_package(brunsli REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE brunsli::brunsli) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/brunsli/all/test_package/conanfile.py b/recipes/brunsli/all/test_package/conanfile.py new file mode 100644 index 0000000000000..ef5d7042163ec --- /dev/null +++ b/recipes/brunsli/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/brunsli/all/test_package/test_package.cpp b/recipes/brunsli/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..6be850a9c3ae9 --- /dev/null +++ b/recipes/brunsli/all/test_package/test_package.cpp @@ -0,0 +1,10 @@ +#include +#include +#include + +int main() { + brunsli::JPEGData jpg; + const size_t input_size = 100; + const uint8_t input_data[input_size] = {}; + bool ok = brunsli::ReadJpeg(input_data, input_size, brunsli::JPEG_READ_ALL, &jpg); +} diff --git a/recipes/brunsli/config.yml b/recipes/brunsli/config.yml new file mode 100644 index 0000000000000..579cbcab9768e --- /dev/null +++ b/recipes/brunsli/config.yml @@ -0,0 +1,5 @@ +versions: + "cci.20231024": + folder: all + "0.1": + folder: all diff --git a/recipes/brynet/all/conandata.yml b/recipes/brynet/all/conandata.yml index bee79fc665e46..032ce7485ea1d 100644 --- a/recipes/brynet/all/conandata.yml +++ b/recipes/brynet/all/conandata.yml @@ -1,4 +1,7 @@ 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" diff --git a/recipes/brynet/all/conanfile.py b/recipes/brynet/all/conanfile.py index ece3fff57254f..e7c1a89c1701b 100644 --- a/recipes/brynet/all/conanfile.py +++ b/recipes/brynet/all/conanfile.py @@ -14,7 +14,7 @@ class BrynetConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/IronsDu/brynet" topics = ("networking", "tcp", "websocket") - + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" options = { "with_openssl": [True, False], @@ -30,7 +30,7 @@ def layout(self): def requirements(self): if self.options.with_openssl: - self.requires("openssl/1.1.1s", transitive_headers=True, transitive_libs=True) + self.requires("openssl/[>=1.1 <4]", transitive_headers=True, transitive_libs=True) def package_id(self): self.info.clear() @@ -40,8 +40,7 @@ def validate(self): 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 build(self): pass diff --git a/recipes/brynet/config.yml b/recipes/brynet/config.yml index 37756b0589174..dd64cd4c4992b 100644 --- a/recipes/brynet/config.yml +++ b/recipes/brynet/config.yml @@ -1,4 +1,6 @@ versions: + "1.12.2": + folder: all "1.12.1": folder: all "1.11.1": diff --git a/recipes/bshoshany-thread-pool/all/conandata.yml b/recipes/bshoshany-thread-pool/all/conandata.yml index 7dac950c38bc0..679f32bc31769 100644 --- a/recipes/bshoshany-thread-pool/all/conandata.yml +++ b/recipes/bshoshany-thread-pool/all/conandata.yml @@ -1,4 +1,16 @@ sources: + "4.1.0": + sha256: "be7abecbc420bb87919eeef729b13ff7c29d5ce547bdae284923296c695415bd" + url: "https://github.com/bshoshany/thread-pool/archive/refs/tags/v4.1.0.tar.gz" + "4.0.1": + sha256: "34d25503e17e58198613d9306313f8358cfaaa9320f2b7694dc599b90a1858a7" + url: "https://github.com/bshoshany/thread-pool/archive/refs/tags/v4.0.1.tar.gz" + "3.5.0": + sha256: "d3efd5c434f6e99f4cff7b8219cbb586dc06bc0aeaf17cd174813a2333961306" + url: "https://github.com/bshoshany/thread-pool/archive/refs/tags/v3.5.0.tar.gz" + "3.4.0": + sha256: "b282149693534934d29c3e6eb563a668b04d6abc53ff013bbe608d96741eddb2" + url: "https://github.com/bshoshany/thread-pool/archive/refs/tags/v3.4.0.tar.gz" "3.3.0": sha256: "b76c0103c7ed07c137bd5b1988b9c09da280bbbad37588a096d2954c8d996e0f" url: "https://github.com/bshoshany/thread-pool/archive/refs/tags/v3.3.0.tar.gz" diff --git a/recipes/bshoshany-thread-pool/all/conanfile.py b/recipes/bshoshany-thread-pool/all/conanfile.py index ee5a622fcbc1c..3da6e90d6c057 100644 --- a/recipes/bshoshany-thread-pool/all/conanfile.py +++ b/recipes/bshoshany-thread-pool/all/conanfile.py @@ -1,56 +1,68 @@ 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.errors import ConanInvalidConfiguration required_conan_version = ">=1.43.0" class BShoshanyThreadPoolConan(ConanFile): + name = "bshoshany-thread-pool" description = "BS::thread_pool: a fast, lightweight, and easy-to-use C++17 thread pool library" homepage = "https://github.com/bshoshany/thread-pool" license = "MIT" - name = "bshoshany-thread-pool" - no_copy_source = True - settings = "arch", "build_type", "compiler", "os" topics = ("concurrency", "cpp17", "header-only", "library", "multi-threading", "parallel-computing", "thread-pool", "threads") url = "https://github.com/conan-io/conan-center-index" + package_type = "header-library" + settings = "arch", "build_type", "compiler", "os" + no_copy_source = True @property def _minimum_compilers_version(self): - return {"apple-clang": "10", "clang": "5", "gcc": "8", "Visual Studio": "16"} - - @property - def _minimum_cpp_standard(self): - return 17 + return { + "apple-clang": "10", + "clang": "5", + "gcc": "8", + "Visual Studio": "16", + "msvc": "192", + } @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return "17" - def package(self): - copy(self, "*.hpp", self.source_folder, os.path.join(self.package_folder, "include")) - copy(self, "LICENSE.txt", self.source_folder, os.path.join(self.package_folder, "licenses")) + def layout(self): + basic_layout(self, src_folder="src") def package_id(self): self.info.clear() - def package_info(self): - if self.settings.os == "Linux": - self.cpp_info.system_libs = ["pthread"] - self.cpp_info.names["cmake_find_package"] = "bshoshany-thread-pool" - self.cpp_info.names["cmake_find_package_multi"] = "bshoshany-thread-pool" + def validate(self): + if self.settings.get_safe("compiler.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): - 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 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.name} requires a compiler that supports C++{self._minimum_cpp_standard}. {self.settings.compiler}, {self.settings.compiler.version}") - except KeyError: - self.output.warn("Unknown compiler encountered. Assuming it supports C++17.") + def package(self): + copy(self, "LICENSE.txt", self.source_folder, os.path.join(self.package_folder, "licenses")) + if Version(self.version) < "3.5.0": + copy(self, "*.hpp", self.source_folder, os.path.join(self.package_folder, "include")) + else: + copy(self, "*.hpp", os.path.join(self.source_folder, "include"), 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 = ["pthread"] diff --git a/recipes/bshoshany-thread-pool/all/test_package/CMakeLists.txt b/recipes/bshoshany-thread-pool/all/test_package/CMakeLists.txt index e58c83ea5f16f..28d8252a78110 100644 --- a/recipes/bshoshany-thread-pool/all/test_package/CMakeLists.txt +++ b/recipes/bshoshany-thread-pool/all/test_package/CMakeLists.txt @@ -1,14 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -set(CMAKE_CXX_STANDARD 17) -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.15) +project(test_package LANGUAGES CXX) find_package(bshoshany-thread-pool REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} bshoshany-thread-pool::bshoshany-thread-pool) +target_link_libraries(${PROJECT_NAME} PRIVATE bshoshany-thread-pool::bshoshany-thread-pool) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/bshoshany-thread-pool/all/test_package/conanfile.py b/recipes/bshoshany-thread-pool/all/test_package/conanfile.py index d52de022aa2ac..b16654fc86e82 100644 --- a/recipes/bshoshany-thread-pool/all/test_package/conanfile.py +++ b/recipes/bshoshany-thread-pool/all/test_package/conanfile.py @@ -1,17 +1,27 @@ 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 TestPackageConan(ConanFile): - settings = "arch", "build_type", "compiler", "os" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "compiler", "build_type", "arch" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" def build(self): cmake = CMake(self) cmake.configure() cmake.build() + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + 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/bshoshany-thread-pool/all/test_package/test_package.cpp b/recipes/bshoshany-thread-pool/all/test_package/test_package.cpp index bbde93d5eba55..94a1ee699375b 100644 --- a/recipes/bshoshany-thread-pool/all/test_package/test_package.cpp +++ b/recipes/bshoshany-thread-pool/all/test_package/test_package.cpp @@ -1,59 +1,18 @@ #include "BS_thread_pool.hpp" - -BS::synced_stream sync_out; -BS::thread_pool pool; - -std::condition_variable ID_cv, total_cv; -std::mutex ID_mutex, total_mutex; -BS::concurrency_t count_unique_threads() -{ - const BS::concurrency_t num_tasks = pool.get_thread_count() * 2; - std::vector thread_IDs(num_tasks); - std::unique_lock total_lock(total_mutex); - BS::concurrency_t total_count = 0; - bool ID_release = false; - pool.wait_for_tasks(); - for (std::thread::id& id : thread_IDs) - pool.push_task( - [&total_count, &id, &ID_release] - { - id = std::this_thread::get_id(); - { - const std::scoped_lock total_lock_local(total_mutex); - ++total_count; - } - total_cv.notify_one(); - std::unique_lock ID_lock_local(ID_mutex); - ID_cv.wait(ID_lock_local, [&ID_release] { return ID_release; }); - }); - total_cv.wait(total_lock, [&total_count] { return total_count == pool.get_thread_count(); }); - { - const std::scoped_lock ID_lock(ID_mutex); - ID_release = true; - } - ID_cv.notify_all(); - total_cv.wait(total_lock, [&total_count, &num_tasks] { return total_count == num_tasks; }); - pool.wait_for_tasks(); - std::sort(thread_IDs.begin(), thread_IDs.end()); - return static_cast(std::unique(thread_IDs.begin(), thread_IDs.end()) - thread_IDs.begin()); -} +#include int main() { - const char* line = "------------------------------------------"; - sync_out.println(line); - sync_out.println("Testing thread pool..."); - BS::concurrency_t unique_threads = count_unique_threads(); - if (pool.get_thread_count() == unique_threads) + BS::thread_pool pool; + std::cout << "Testing thread pool...\n"; + if (pool.get_thread_count() == std::thread::hardware_concurrency()) { - sync_out.println("SUCCESS: Created ", unique_threads, " unique threads!"); - sync_out.println(line); + std::cout << "SUCCESS: Created " << pool.get_thread_count() << " unique threads!\n"; return EXIT_SUCCESS; } else { - sync_out.println("ERROR: Failed to create ", unique_threads, " unique threads!"); - sync_out.println(line); + std::cout << "ERROR: Failed to create " << pool.get_thread_count() << " unique threads!\n"; return EXIT_FAILURE; } } diff --git a/recipes/mimalloc/all/test_v1_package/CMakeLists.txt b/recipes/bshoshany-thread-pool/all/test_v1_package/CMakeLists.txt similarity index 100% rename from recipes/mimalloc/all/test_v1_package/CMakeLists.txt rename to recipes/bshoshany-thread-pool/all/test_v1_package/CMakeLists.txt diff --git a/recipes/bshoshany-thread-pool/all/test_v1_package/conanfile.py b/recipes/bshoshany-thread-pool/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..2fc6ad2a6a2ba --- /dev/null +++ b/recipes/bshoshany-thread-pool/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +import os + +from conans import CMake, ConanFile, 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("{0}".format(bin_path), run_environment=True) diff --git a/recipes/bshoshany-thread-pool/config.yml b/recipes/bshoshany-thread-pool/config.yml index 319c05acee4d0..56c2c868cfbdf 100644 --- a/recipes/bshoshany-thread-pool/config.yml +++ b/recipes/bshoshany-thread-pool/config.yml @@ -1,4 +1,12 @@ versions: + "4.1.0": + folder: all + "4.0.1": + folder: all + "3.5.0": + folder: all + "3.4.0": + folder: all "3.3.0": folder: all "3.2.0": diff --git a/recipes/btyacc/all/CMakeLists.txt b/recipes/btyacc/all/CMakeLists.txt deleted file mode 100644 index b598faf845d1a..0000000000000 --- a/recipes/btyacc/all/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -cmake_minimum_required(VERSION 3.2) - -project(btyacc_wrapper C) - -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup(TARGETS KEEP_RPATHS) - -add_subdirectory(source_subfolder) diff --git a/recipes/btyacc/all/conanfile.py b/recipes/btyacc/all/conanfile.py index 392605b08cf53..d34d04d75a89b 100644 --- a/recipes/btyacc/all/conanfile.py +++ b/recipes/btyacc/all/conanfile.py @@ -1,10 +1,11 @@ -import functools import os import textwrap -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, save -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class BtyaccConan(ConanFile): @@ -14,6 +15,7 @@ class BtyaccConan(ConanFile): description = "Backtracking yacc" topics = "yacc", "parser" license = "Unlicense" + package_type = "application" settings = "os", "arch", "compiler", "build_type" options = { "fPIC": [True, False], @@ -21,60 +23,54 @@ class BtyaccConan(ConanFile): default_options = { "fPIC": True, } - generators = "cmake" - exports_sources = "CMakeLists.txt" - no_copy_source = True - - @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.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 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], 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.generate() def build(self): - self._configure_cmake().build() + cmake = CMake(self) + cmake.configure() + cmake.build() @property - def _variables(self): - return os.path.join("bin", "conan-official-btyacc-variables.cmake") + def _cmake_variables(self): + return os.path.join("bin", "cmake", f"conan-official-{self.name}-variables.cmake") def package(self): - self.copy("README", "licenses", self._source_subfolder) - self.copy("README.BYACC", "licenses", self._source_subfolder) - self._configure_cmake().install() - tools.rmdir(os.path.join(self.package_folder, "share")) - variables = os.path.join(self.package_folder, self._variables) + copy(self, "README*", 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")) content = textwrap.dedent("""\ - set(BTYACC_EXECUTABLE "${CMAKE_CURRENT_LIST_DIR}/btyacc") + set(BTYACC_EXECUTABLE "${CMAKE_CURRENT_LIST_DIR}/../btyacc") if(NOT EXISTS "${BTYACC_EXECUTABLE}") - set(BTYACC_EXECUTABLE "${BTYACC_EXECUTABLE}.exe") + set(BTYACC_EXECUTABLE "${BTYACC_EXECUTABLE}.exe") endif() """) - tools.save(variables, content) + save(self, os.path.join(self.package_folder, self._cmake_variables), content) def package_info(self): - bindir = os.path.join(self.package_folder, "bin") - self.output.info(f"Appending PATH environment variable: {bindir}") - self.env_info.PATH.append(bindir) - self.cpp_info.build_modules["cmake"] = [self._variables] - self.cpp_info.build_modules["cmake_find_package"] = [self._variables] - self.cpp_info.build_modules["cmake_find_package_multi"] = \ - [self._variables] - self.cpp_info.builddirs = ["bin"] + self.cpp_info.includedirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.set_property("cmake_build_modules", [self._cmake_variables]) + + # TODO: to remove after conan v2 + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) + self.cpp_info.build_modules["cmake"] = [self._cmake_variables] + self.cpp_info.build_modules["cmake_find_package"] = [self._cmake_variables] + self.cpp_info.build_modules["cmake_find_package_multi"] = [self._cmake_variables] diff --git a/recipes/btyacc/all/test_package/CMakeLists.txt b/recipes/btyacc/all/test_package/CMakeLists.txt index 80f7ff14861ac..d2daa6eb3e652 100644 --- a/recipes/btyacc/all/test_package/CMakeLists.txt +++ b/recipes/btyacc/all/test_package/CMakeLists.txt @@ -1,13 +1,11 @@ cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) -project(test_package C) - -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup(TARGETS KEEP_RPATHS) +enable_testing() find_package(btyacc REQUIRED CONFIG) if(NOT DEFINED BTYACC_EXECUTABLE) - message(FATAL_ERROR "BTYACC_EXECUTABLE is not defined") + message(FATAL_ERROR "BTYACC_EXECUTABLE is not defined") endif() set(bin "${PROJECT_BINARY_DIR}") @@ -24,7 +22,6 @@ add_custom_command( add_executable(test_package "${bin}/main.c") -enable_testing() add_test( NAME main COMMAND "${CMAKE_COMMAND}" -E echo "(())()(())" | test_package diff --git a/recipes/btyacc/all/test_package/conanfile.py b/recipes/btyacc/all/test_package/conanfile.py index 84bba6ad911d3..fe825a55c4c79 100644 --- a/recipes/btyacc/all/test_package/conanfile.py +++ b/recipes/btyacc/all/test_package/conanfile.py @@ -1,23 +1,48 @@ -import functools -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, CMakeDeps, cmake_layout +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + # TODO: Only keep logic under if hasattr(self, "settings_build") after conan v2. + # Indeed, v1 pipeline of c3i uses 1 profile, which can't work with + # build_context_activated & build_context_build_modules of CMakeDeps + + def requirements(self): + if not hasattr(self, "settings_build"): + self.requires(self.tested_reference_str) + + def build_requirements(self): + if hasattr(self, "settings_build"): + self.tool_requires(self.tested_reference_str) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.configure() - return cmake + def generate(self): + if hasattr(self, "settings_build"): + VirtualBuildEnv(self).generate() + deps = CMakeDeps(self) + deps.build_context_activated = ["btyacc"] + deps.build_context_build_modules = ["btyacc"] + deps.generate() + else: + if can_run(self): + VirtualRunEnv(self).generate(scope="build") + deps = CMakeDeps(self) + deps.generate() def build(self): - if not tools.cross_building(self): - self._configure_cmake().build() + if hasattr(self, "settings_build") or can_run(self): + cmake = CMake(self) + cmake.configure() + cmake.build() def test(self): - if not tools.cross_building(self): - self._configure_cmake().test() + if can_run(self): + self.run(f"ctest --output-on-failure -C {self.settings.build_type}", env="conanrun") diff --git a/recipes/btyacc/all/test_v1_package/CMakeLists.txt b/recipes/btyacc/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..c23ed5cfe6d98 --- /dev/null +++ b/recipes/btyacc/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/btyacc/all/test_v1_package/conanfile.py b/recipes/btyacc/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..1b50aeffd40ff --- /dev/null +++ b/recipes/btyacc/all/test_v1_package/conanfile.py @@ -0,0 +1,16 @@ +from conans import ConanFile, CMake, tools + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + if not tools.cross_building(self): + cmake = CMake(self) + 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}", run_environment=True) 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/conanfile.py b/recipes/butteraugli/all/conanfile.py index 129e25bd723ec..113630ce7e2ab 100644 --- a/recipes/butteraugli/all/conanfile.py +++ b/recipes/butteraugli/all/conanfile.py @@ -15,6 +15,7 @@ class ButteraugliConan(ConanFile): homepage = "https://github.com/google/butteraugli" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -44,16 +45,15 @@ def layout(self): def requirements(self): if self.options.tool: - self.requires("libpng/1.6.38") + self.requires("libpng/[>=1.6 <2]") self.requires("libjpeg/9e") def validate(self): - if self.info.settings.compiler.get_safe("cppstd"): + 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/bvdberg-ctest/all/conandata.yml b/recipes/bvdberg-ctest/all/conandata.yml index c756f17b12c18..31bd2b82ba362 100644 --- a/recipes/bvdberg-ctest/all/conandata.yml +++ b/recipes/bvdberg-ctest/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.1.0": + url: "https://github.com/bvdberg/ctest/archive/1.1.0.tar.gz" + sha256: "6792d7a21f62ec9caa64fc5106c8c8eed9201f1d98571917d370d0b5af721f49" "1.0.0": - sha256: 80c5899f529dc57c1eb44113fe452cd90fd69cd1ab3a0431635282f56837205c - url: https://github.com/bvdberg/ctest/archive/1.0.0.tar.gz + url: "https://github.com/bvdberg/ctest/archive/1.0.0.tar.gz" + sha256: "80c5899f529dc57c1eb44113fe452cd90fd69cd1ab3a0431635282f56837205c" diff --git a/recipes/bvdberg-ctest/all/conanfile.py b/recipes/bvdberg-ctest/all/conanfile.py index ac8c63a98f38c..28b74d733c02a 100644 --- a/recipes/bvdberg-ctest/all/conanfile.py +++ b/recipes/bvdberg-ctest/all/conanfile.py @@ -6,33 +6,29 @@ required_conan_version = ">=1.50.0" - class BvdbergCtestConan(ConanFile): name = "bvdberg-ctest" + description = "ctest is a unit test framework for software written in C." license = "Apache-2.0" - homepage = "https://github.com/bvdberg/ctest" url = "https://github.com/conan-io/conan-center-index" - description = "ctest is a unit test framework for software written in C." - topics = ("testing", "testing-framework", "unit-testing") + homepage = "https://github.com/bvdberg/ctest" + topics = ("testing", "testing-framework", "unit-testing", "header-only") + package_type = "header-library" 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 validate(self): if self.settings.os == "Windows": - raise ConanInvalidConfiguration("Windows not supported") - - def layout(self): - basic_layout(self, src_folder="src") + raise ConanInvalidConfiguration(f"{self.ref} does not support Windows.") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) - - def build(self): - pass + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) @@ -40,6 +36,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/bvdberg-ctest/all/test_package/conanfile.py b/recipes/bvdberg-ctest/all/test_package/conanfile.py index d120a992c06a6..8a5bb47f50c4c 100644 --- a/recipes/bvdberg-ctest/all/test_package/conanfile.py +++ b/recipes/bvdberg-ctest/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/bvdberg-ctest/all/test_v1_package/CMakeLists.txt b/recipes/bvdberg-ctest/all/test_v1_package/CMakeLists.txt deleted file mode 100644 index fd0d83ce8ad41..0000000000000 --- a/recipes/bvdberg-ctest/all/test_v1_package/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(bvdberg-ctest REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE bvdberg-ctest::bvdberg-ctest) diff --git a/recipes/bvdberg-ctest/all/test_v1_package/conanfile.py b/recipes/bvdberg-ctest/all/test_v1_package/conanfile.py deleted file mode 100644 index f2243371b7f1d..0000000000000 --- a/recipes/bvdberg-ctest/all/test_v1_package/conanfile.py +++ /dev/null @@ -1,17 +0,0 @@ -from conans import ConanFile, CMake, tools -import os - - -class TestPackageConan(ConanFile): - settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" - - def build(self): - 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/bvdberg-ctest/config.yml b/recipes/bvdberg-ctest/config.yml index c7f13630776fb..fcbfca5b9011e 100644 --- a/recipes/bvdberg-ctest/config.yml +++ b/recipes/bvdberg-ctest/config.yml @@ -1,3 +1,5 @@ versions: + "1.1.0": + folder: "all" "1.0.0": folder: "all" 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..cc80401d96abd 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", + "194": "2022", "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..d3dd545ae68ba 100644 --- a/recipes/bx/all/test_package/conanfile.py +++ b/recipes/bx/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" + 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/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/byte-lite/all/conanfile.py b/recipes/byte-lite/all/conanfile.py index 67d695dbd0333..b53cb06ab6fdb 100644 --- a/recipes/byte-lite/all/conanfile.py +++ b/recipes/byte-lite/all/conanfile.py @@ -14,18 +14,18 @@ class ByteLiteConan(ConanFile): C++98, C++11 and later") topics = ("cpp11", "cpp14", "cpp17", "byte", "byte-implementations") license = "BSL-1.0" + package_type = "header-library" 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 @@ -38,19 +38,4 @@ def package_info(self): self.cpp_info.set_property("cmake_file_name", "byte-lite") self.cpp_info.set_property("cmake_target_name", "nonstd::byte-lite") 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"] = "byte-lite" - self.cpp_info.filenames["cmake_find_package_multi"] = "byte-lite" - self.cpp_info.names["cmake_find_package"] = "nonstd" - self.cpp_info.names["cmake_find_package_multi"] = "nonstd" - self.cpp_info.components["bytelite"].names["cmake_find_package"] = "byte-lite" - self.cpp_info.components["bytelite"].names["cmake_find_package_multi"] = "byte-lite" - self.cpp_info.components["bytelite"].set_property("cmake_target_name", "nonstd::byte-lite") - self.cpp_info.components["bytelite"].bindirs = [] - self.cpp_info.components["bytelite"].frameworkdirs = [] - self.cpp_info.components["bytelite"].libdirs = [] - self.cpp_info.components["bytelite"].resdirs = [] diff --git a/recipes/byte-lite/all/test_package/test_package.cpp b/recipes/byte-lite/all/test_package/test_package.cpp index bf423f8963b2a..62a18e7db80fc 100644 --- a/recipes/byte-lite/all/test_package/test_package.cpp +++ b/recipes/byte-lite/all/test_package/test_package.cpp @@ -1,14 +1,8 @@ #include "nonstd/byte.hpp" -#include - -using namespace nonstd; +#include int main() { - byte b1 = to_byte( 0x5a ); // to_byte() is non-standard, needed for pre-C++17 - byte b2 = to_byte( 0xa5 ); - - byte r1 = b1 ^ b2; if( 0xff != to_integer( r1 ) ) throw std::exception(); // not (yet) standard, needs C++11 - byte r2 = b1 ^ b2; if( 0xff != to_integer( r2 ) ) throw std::exception(); + std::cout << "Byte lite version: " << byte_lite_VERSION << ", Test package successful\n"; } diff --git a/recipes/byte-lite/all/test_v1_package/CMakeLists.txt b/recipes/byte-lite/all/test_v1_package/CMakeLists.txt deleted file mode 100644 index 65ad56138429f..0000000000000 --- a/recipes/byte-lite/all/test_v1_package/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(byte-lite REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE nonstd::byte-lite) diff --git a/recipes/bzip2/all/conanfile.py b/recipes/bzip2/all/conanfile.py index 49ea55c016349..ce77ac1450e7d 100644 --- a/recipes/bzip2/all/conanfile.py +++ b/recipes/bzip2/all/conanfile.py @@ -5,16 +5,17 @@ import os import textwrap -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class Bzip2Conan(ConanFile): name = "bzip2" url = "https://github.com/conan-io/conan-center-index" - homepage = "http://www.bzip.org" - license = "bzip2-1.0.8" + homepage = "https://sourceware.org/bzip2" + license = "bzip2-1.0.6" description = "bzip2 is a free and open-source file compression program that uses the Burrows Wheeler algorithm." topics = ("data-compressor", "file-compression") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -38,25 +39,15 @@ def config_options(self): 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 + 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") 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) @@ -81,21 +72,19 @@ def package(self): ) def _create_cmake_module_variables(self, module_file): - content = textwrap.dedent("""\ + content = textwrap.dedent(f"""\ set(BZIP2_NEED_PREFIX TRUE) set(BZIP2_FOUND TRUE) if(NOT DEFINED BZIP2_INCLUDE_DIRS AND DEFINED BZip2_INCLUDE_DIRS) - set(BZIP2_INCLUDE_DIRS ${BZip2_INCLUDE_DIRS}) + set(BZIP2_INCLUDE_DIRS ${{BZip2_INCLUDE_DIRS}}) endif() if(NOT DEFINED BZIP2_INCLUDE_DIR AND DEFINED BZip2_INCLUDE_DIR) - set(BZIP2_INCLUDE_DIR ${BZip2_INCLUDE_DIR}) + set(BZIP2_INCLUDE_DIR ${{BZip2_INCLUDE_DIR}}) endif() if(NOT DEFINED BZIP2_LIBRARIES AND DEFINED BZip2_LIBRARIES) - set(BZIP2_LIBRARIES ${BZip2_LIBRARIES}) - endif() - if(NOT DEFINED BZIP2_VERSION_STRING AND DEFINED BZip2_VERSION) - set(BZIP2_VERSION_STRING ${BZip2_VERSION}) + set(BZIP2_LIBRARIES ${{BZip2_LIBRARIES}}) endif() + set(BZIP2_VERSION_STRING "{self.version}") """) save(self, module_file, content) diff --git a/recipes/bzip2/all/test_package/CMakeLists.txt b/recipes/bzip2/all/test_package/CMakeLists.txt index 540d39e432a7e..364bed2972661 100644 --- a/recipes/bzip2/all/test_package/CMakeLists.txt +++ b/recipes/bzip2/all/test_package/CMakeLists.txt @@ -16,7 +16,7 @@ set(_custom_vars BZIP2_VERSION_STRING ) foreach(_custom_var ${_custom_vars}) - if(DEFINED _custom_var) + if(DEFINED ${_custom_var}) message(STATUS "${_custom_var}: ${${_custom_var}}") else() message(FATAL_ERROR "${_custom_var} not defined") diff --git a/recipes/bzip3/all/conandata.yml b/recipes/bzip3/all/conandata.yml index 793290248520a..47c1259bdc988 100644 --- a/recipes/bzip3/all/conandata.yml +++ b/recipes/bzip3/all/conandata.yml @@ -1,28 +1,28 @@ sources: + "1.4.0": + url: "https://github.com/kspalaiologos/bzip3/releases/download/1.4.0/bzip3-1.4.0.tar.xz" + sha256: "516489784351abe027dc8b4bcad74d12937c5668d317e27de8c5cebc4d7884dc" + "1.3.2": + url: "https://github.com/kspalaiologos/bzip3/releases/download/1.3.2/bzip3-1.3.2.tar.xz" + sha256: "b1d04b8b1b89a3c490cf2b89ea8cee1281584b07f25276fcfd8d40ec2c488e94" + "1.3.1": + url: "https://github.com/kspalaiologos/bzip3/releases/download/1.3.1/bzip3-1.3.1.tar.xz" + sha256: "b023c261307ff4e0e64935ea32bba0216377fd8fc2fd19ba86509a32cbb8a35a" + "1.3.0": + url: "https://github.com/kspalaiologos/bzip3/releases/download/1.3.0/bzip3-1.3.0.tar.xz" + sha256: "72fca01d9030e9c260e2ff8fe9d2e9f6261ea28e86adabeb6a8af3300ec390ef" + "1.2.3": + url: "https://github.com/kspalaiologos/bzip3/releases/download/1.2.3/bzip3-1.2.3.tar.xz" + sha256: "a6a4fa418bdff6f15be3604e8e85b5b73bf0f20e31de9603d55dc100914a111f" + "1.2.2": + url: "https://github.com/kspalaiologos/bzip3/releases/download/1.2.2/bzip3-1.2.2.tar.xz" + sha256: "2b82d0adcea762ac090cf9e791159894e633a37b34696bcd8c66202b23c4130b" "1.2.1": - url: "https://github.com/kspalaiologos/bzip3/archive/1.2.1.tar.gz" - sha256: "f2fc4c9c7679d3b120e8f44d8c4ecd00f03af9981f53e13dc0f956b5996913c9" + url: "https://github.com/kspalaiologos/bzip3/releases/download/1.2.1/bzip3-1.2.1.tar.xz" + sha256: "4ad3aea9b9c28be102dbfeb3aec89281116784bf41b97331da88aa137bd91a27" "1.2.0": - url: "https://github.com/kspalaiologos/bzip3/archive/1.2.0.tar.gz" - sha256: "6f9bd935ac1e845cb49e64ad23969db914e4760dad7feec0995f5cdbd336c10d" + url: "https://github.com/kspalaiologos/bzip3/releases/download/1.2.0/bzip3-1.2.0.tar.xz" + sha256: "f0441519321070e03708638b37bdeb9105aff8f0a5c838e45aff1b0cbe752572" "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/1.1.4-0001-make-restrict-alias.patch" - - patch_file: "patches/1.1.4-0002-export-symbols.patch" + url: "https://github.com/kspalaiologos/bzip3/releases/download/1.1.8/bzip3-1.1.8.tar.xz" + sha256: "80a226950832df5674e012a38cf5f45efc6405d51a1caceb96f80ec2861a6111" diff --git a/recipes/bzip3/all/conanfile.py b/recipes/bzip3/all/conanfile.py index 118e5fbf34f0c..2102c952e4cf1 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 export_conandata_patches, apply_conandata_patches, copy, get +from conan.tools.files import copy, get import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class BZip3Conan(ConanFile): @@ -13,6 +13,7 @@ class BZip3Conan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/kspalaiologos/bzip3" topics = ("bzip2", "lzma", "compression") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -29,7 +30,6 @@ class BZip3Conan(ConanFile): 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": @@ -42,25 +42,15 @@ def config_options(self): 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 + 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -71,7 +61,6 @@ def generate(self): tc.generate() def build(self): - apply_conandata_patches(self) cmake = CMake(self) cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() diff --git a/recipes/bzip3/all/patches/1.1.4-0001-make-restrict-alias.patch b/recipes/bzip3/all/patches/1.1.4-0001-make-restrict-alias.patch deleted file mode 100644 index 20195b834da7b..0000000000000 --- a/recipes/bzip3/all/patches/1.1.4-0001-make-restrict-alias.patch +++ /dev/null @@ -1,114 +0,0 @@ -diff --git a/src/crc32.c b/src/crc32.c -index 856fcd4..d9fb87a 100644 ---- a/src/crc32.c -+++ b/src/crc32.c -@@ -19,6 +19,14 @@ - - #include "crc32.h" - -+#if defined(__GNUC__) || defined(__clang__) -+ #define RESTRICT __restrict__ -+#elif defined(_MSC_VER) || defined(__INTEL_COMPILER) -+ #define RESTRICT __restrict -+#else -+ #error Your compiler, configuration or platform is not supported. -+#endif -+ - static const u32 crc32Table[256] = { - 0x00000000L, 0xF26B8303L, 0xE13B70F7L, 0x1350F3F4L, 0xC79A971FL, 0x35F1141CL, 0x26A1E7E8L, 0xD4CA64EBL, 0x8AD958CFL, - 0x78B2DBCCL, 0x6BE22838L, 0x9989AB3BL, 0x4D43CFD0L, 0xBF284CD3L, 0xAC78BF27L, 0x5E133C24L, 0x105EC76FL, 0xE235446CL, -@@ -51,7 +59,7 @@ static const u32 crc32Table[256] = { - 0xBE2DA0A5L, 0x4C4623A6L, 0x5F16D052L, 0xAD7D5351L - }; - --u32 crc32sum(u32 crc, u8 * restrict buf, size_t size) { -+u32 crc32sum(u32 crc, u8 * RESTRICT buf, size_t size) { - while (size--) crc = crc32Table[(crc ^ *(buf++)) & 0xff] ^ (crc >> 8); - return crc; - } -diff --git a/src/lzp.c b/src/lzp.c -index c19580d..2206673 100644 ---- a/src/lzp.c -+++ b/src/lzp.c -@@ -11,8 +11,16 @@ - - #define MATCH 0xf2 - --static s32 lzp_encode_block(const u8 * restrict in, const u8 * in_end, u8 * restrict out, u8 * out_end, -- s32 * restrict lut, s32 mask, s32 m_len) { -+#if defined(__GNUC__) || defined(__clang__) -+ #define RESTRICT __restrict__ -+#elif defined(_MSC_VER) || defined(__INTEL_COMPILER) -+ #define RESTRICT __restrict -+#else -+ #error Your compiler, configuration or platform is not supported. -+#endif -+ -+static s32 lzp_encode_block(const u8 * RESTRICT in, const u8 * in_end, u8 * RESTRICT out, u8 * out_end, -+ s32 * RESTRICT lut, s32 mask, s32 m_len) { - const u8 *ins = in, *outs = out; - const u8 * out_eob = out_end - 8; - const u8 * heur = in; -@@ -28,7 +36,7 @@ static s32 lzp_encode_block(const u8 * restrict in, const u8 * in_end, u8 * rest - s32 val = lut[idx]; - lut[idx] = in - ins; - if (val > 0) { -- const u8 * restrict ref = ins + val; -+ const u8 * RESTRICT ref = ins + val; - if (memcmp(in + m_len - 4, ref + m_len - 4, sizeof(u32)) == 0 && memcmp(in, ref, sizeof(u32)) == 0) { - if (heur > in && *(u32 *)heur != *(u32 *)(ref + (heur - in))) goto not_found; - -@@ -85,7 +93,7 @@ static s32 lzp_encode_block(const u8 * restrict in, const u8 * in_end, u8 * rest - return out >= out_eob ? -1 : (s32)(out - outs); - } - --static s32 lzp_decode_block(const u8 * restrict in, const u8 * in_end, s32 * restrict lut, u8 * restrict out, s32 hash, -+static s32 lzp_decode_block(const u8 * RESTRICT in, const u8 * in_end, s32 * RESTRICT lut, u8 * RESTRICT out, s32 hash, - s32 m_len) { - if (in_end - in < 4) return -1; - -@@ -129,7 +137,7 @@ static s32 lzp_decode_block(const u8 * restrict in, const u8 * in_end, s32 * res - return out - outs; - } - --s32 lzp_compress(const u8 * restrict in, u8 * restrict out, s32 n, s32 hash, s32 m_len, s32 * restrict lut) { -+s32 lzp_compress(const u8 * RESTRICT in, u8 * RESTRICT out, s32 n, s32 hash, s32 m_len, s32 * RESTRICT lut) { - if (n - m_len < 32) return -1; - - memset(lut, 0, sizeof(s32) * (1 << hash)); -@@ -137,6 +145,6 @@ s32 lzp_compress(const u8 * restrict in, u8 * restrict out, s32 n, s32 hash, s32 - return lzp_encode_block(in, in + n, out, out + n, lut, (s32)(1 << hash) - 1, m_len); - } - --s32 lzp_decompress(const u8 * restrict in, u8 * restrict out, s32 n, s32 hash, s32 m_len, s32 * restrict lut) { -+s32 lzp_decompress(const u8 * RESTRICT in, u8 * RESTRICT out, s32 n, s32 hash, s32 m_len, s32 * RESTRICT lut) { - return lzp_decode_block(in, in + n, lut, out, hash, m_len); - } -diff --git a/src/rle.c b/src/rle.c -index b1f0340..2cb2e53 100644 ---- a/src/rle.c -+++ b/src/rle.c -@@ -19,6 +19,14 @@ - - #include "rle.h" - -+#if defined(__GNUC__) || defined(__clang__) -+ #define RESTRICT __restrict__ -+#elif defined(_MSC_VER) || defined(__INTEL_COMPILER) -+ #define RESTRICT __restrict -+#else -+ #error Your compiler, configuration or platform is not supported. -+#endif -+ - s32 mrlec(u8 * in, s32 inlen, u8 * out) { - u8 *ip = in, *in_end = in + inlen; - s32 op = 0; -@@ -57,7 +65,7 @@ s32 mrlec(u8 * in, s32 inlen, u8 * out) { - return op; - } - --void mrled(u8 * restrict in, u8 * restrict out, s32 outlen) { -+void mrled(u8 * RESTRICT in, u8 * RESTRICT out, s32 outlen) { - s32 op = 0, ip = 0; - - s32 c, pc = -1; diff --git a/recipes/bzip3/all/patches/1.1.4-0002-export-symbols.patch b/recipes/bzip3/all/patches/1.1.4-0002-export-symbols.patch deleted file mode 100644 index 3bdf13582cc59..0000000000000 --- a/recipes/bzip3/all/patches/1.1.4-0002-export-symbols.patch +++ /dev/null @@ -1,95 +0,0 @@ ---- a/include/common.h -+++ b/include/common.h -@@ -46,10 +46,6 @@ static void write_neutral_s32(u8 * data, s32 value) { - data[3] = (value >> 24) & 0xFF; - } - --#ifdef __MINGW32__ -- #define PUBLIC_API __declspec(dllexport) --#else -- #define PUBLIC_API --#endif -+#define PUBLIC_API - - #endif ---- 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/patches/1.1.5-0002-export-symbols.patch b/recipes/bzip3/all/patches/1.1.5-0002-export-symbols.patch deleted file mode 100644 index e76dc6e0d184e..0000000000000 --- a/recipes/bzip3/all/patches/1.1.5-0002-export-symbols.patch +++ /dev/null @@ -1,83 +0,0 @@ -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_package/conanfile.py b/recipes/bzip3/all/test_package/conanfile.py index d120a992c06a6..8a5bb47f50c4c 100644 --- a/recipes/bzip3/all/test_package/conanfile.py +++ b/recipes/bzip3/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/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 a95d0b82239d8..75a3fe45d3d11 100644 --- a/recipes/bzip3/config.yml +++ b/recipes/bzip3/config.yml @@ -1,15 +1,19 @@ versions: - "1.2.1": + "1.4.0": folder: all - "1.2.0": + "1.3.2": folder: all - "1.1.8": + "1.3.1": + folder: all + "1.3.0": folder: all - "1.1.7": + "1.2.3": folder: all - "1.1.6": + "1.2.2": folder: all - "1.1.5": + "1.2.1": + folder: all + "1.2.0": folder: all - "1.1.4": + "1.1.8": folder: all diff --git a/recipes/c-ares/all/conandata.yml b/recipes/c-ares/all/conandata.yml index 245e6d426beea..09ee1b4f0a111 100644 --- a/recipes/c-ares/all/conandata.yml +++ b/recipes/c-ares/all/conandata.yml @@ -1,29 +1,35 @@ sources: - "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 - "1.17.1": - sha256: 61f7cf09605f5e38d4828f82d0e2ddb9de8e355ecfd6819b740691c644583b8f - url: https://github.com/c-ares/c-ares/archive/cares-1_17_1.tar.gz - "1.16.1": - sha256: 870962cc8f6b352303c404ce848e2ea1f1072f3c0a940042209a72179511c08c - url: https://github.com/c-ares/c-ares/archive/cares-1_16_1.tar.gz - "1.15.0": - sha256: 7deb7872cbd876c29036d5f37e30c4cbc3cc068d59d8b749ef85bb0736649f04 - url: https://github.com/c-ares/c-ares/archive/cares-1_15_0.tar.gz - "1.14.0": - sha256: 62dd12f0557918f89ad6f5b759f0bf4727174ae9979499f5452c02be38d9d3e8 - url: https://github.com/c-ares/c-ares/archive/cares-1_14_0.tar.gz + "1.34.3": + url: "https://github.com/c-ares/c-ares/releases/download/v1.34.3/c-ares-1.34.3.tar.gz" + sha256: "26e1f7771da23e42a18fdf1e58912a396629e53a2ac71b130af93bbcfb90adbe" + "1.34.1": + url: "https://github.com/c-ares/c-ares/releases/download/v1.34.1/c-ares-1.34.1.tar.gz" + sha256: "7e846f1742ab5998aced36d170408557de5292b92ec404fb0f7422f946d60103" + "1.33.1": + url: "https://github.com/c-ares/c-ares/releases/download/v1.33.1/c-ares-1.33.1.tar.gz" + sha256: "06869824094745872fa26efd4c48e622b9bd82a89ef0ce693dc682a23604f415" + "1.33.0": + url: "https://github.com/c-ares/c-ares/releases/download/v1.33.0/c-ares-1.33.0.tar.gz" + sha256: "3e41df2f172041eb4ecb754a464c11ccc5046b2a1c8b1d6a40dac45d3a3b2346" + "1.32.3": + url: "https://github.com/c-ares/c-ares/releases/download/v1.32.3/c-ares-1.32.3.tar.gz" + sha256: "5f02cc809aac3f6cc5edc1fac6c4423fd5616d7406ce47b904c24adf0ff2cd0f" + "1.32.2": + url: "https://github.com/c-ares/c-ares/releases/download/v1.32.2/c-ares-1.32.2.tar.gz" + sha256: "072ff6b30b9682d965b87eb9b77851dc1cd8e6d8090f6821a56bd8fa89595061" + "1.32.1": + url: "https://github.com/c-ares/c-ares/releases/download/v1.32.1/c-ares-1.32.1.tar.gz" + sha256: "63be2c4ee121faa47e9766f735b4cde750fff2c563f81c11e572d3dc6401e5e7" + "1.31.0": + url: "https://github.com/c-ares/c-ares/releases/download/v1.31.0/c-ares-1.31.0.tar.gz" + sha256: "0167a33dba96ca8de29f3f598b1e6cabe531799269fd63d0153aa0e6f5efeabd" + # keep 1.25.0 for libnghttp2, trantor, libcoro + "1.25.0": + url: "https://github.com/c-ares/c-ares/releases/download/cares-1_25_0/c-ares-1.25.0.tar.gz" + sha256: "71832b93a48f5ff579c505f4869120c14e57b783275367207f1a98314aa724e5" patches: - "1.17.1": - - patch_file: "patches/upstream-pr-395-bundle-destination-v16-17.patch" - "1.16.1": - - patch_file: "patches/upstream-pr-395-bundle-destination-v16-17.patch" - "1.15.0": - - patch_file: "patches/upstream-pr-395-bundle-destination-v15.patch" - "1.14.0": - - patch_file: "patches/option-tools.patch" - - patch_file: "patches/upstream-pr-395-bundle-destination-v14.patch" + "1.33.0": + - patch_file: "patches/1.33.0-0001-fix-tcp-fastopen.patch" + patch_description: "fix compilation error for TCP_FASTOPEN_CONNECT" + patch_type: "portability" + patch_source: "https://github.com/c-ares/c-ares/commit/4abdf7de3678d98f474bd2abeedea741f6c50231" diff --git a/recipes/c-ares/all/conanfile.py b/recipes/c-ares/all/conanfile.py index d8b3c1bbab956..e4428917c336f 100644 --- a/recipes/c-ares/all/conanfile.py +++ b/recipes/c-ares/all/conanfile.py @@ -1,21 +1,21 @@ 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 collect_libs, copy, get, rm, rmdir, apply_conandata_patches, export_conandata_patches from conan.tools.scm import Version import os -required_conan_version = ">=1.51.3" +required_conan_version = ">=1.53.0" class CAresConan(ConanFile): name = "c-ares" + description = "A C library for asynchronous DNS requests" license = "MIT" url = "https://github.com/conan-io/conan-center-index" - description = "A C library for asynchronous DNS requests" - topics = ("c-ares", "dns") homepage = "https://c-ares.haxx.se/" - + topics = ("dns", "resolver", "async") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -29,8 +29,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 +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) @@ -90,18 +82,14 @@ def package_info(self): self.cpp_info.components["cares"].defines.append("CARES_STATICLIB") if self.settings.os == "Linux": self.cpp_info.components["cares"].system_libs.append("rt") + if Version(self.version) >= "1.23.0": + self.cpp_info.components["cares"].system_libs.append("pthread") elif self.settings.os == "Windows": self.cpp_info.components["cares"].system_libs.extend(["ws2_32", "advapi32"]) - if Version(self.version) >= "1.18.0": - self.cpp_info.components["cares"].system_libs.append("iphlpapi") + self.cpp_info.components["cares"].system_libs.append("iphlpapi") 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/patches/1.33.0-0001-fix-tcp-fastopen.patch b/recipes/c-ares/all/patches/1.33.0-0001-fix-tcp-fastopen.patch new file mode 100644 index 0000000000000..a5aff6174105f --- /dev/null +++ b/recipes/c-ares/all/patches/1.33.0-0001-fix-tcp-fastopen.patch @@ -0,0 +1,13 @@ +diff --git a/src/lib/ares__socket.c b/src/lib/ares__socket.c +index 2e360ef..86e281f 100644 +--- a/src/lib/ares__socket.c ++++ b/src/lib/ares__socket.c +@@ -56,7 +56,7 @@ + #include + #include + +-#if defined(__linux__) && defined(MSG_FASTOPEN) ++#if defined(__linux__) && defined(TCP_FASTOPEN_CONNECT) + # define TFO_SUPPORTED 1 + # define TFO_SKIP_CONNECT 0 + # define TFO_USE_SENDTO 0 diff --git a/recipes/c-ares/all/patches/option-tools.patch b/recipes/c-ares/all/patches/option-tools.patch deleted file mode 100644 index 650eca0948612..0000000000000 --- a/recipes/c-ares/all/patches/option-tools.patch +++ /dev/null @@ -1,16 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -670,6 +670,8 @@ SET (CARES_FOUND 1 CACHE INTERNAL "CARES LIBRARY FOUND") - SET (CARES_LIBRARIES ${PROJECT_NAME}::cares CACHE INTERNAL "CARES LIBRARIES") - - -+OPTION (CARES_BUILD_TOOLS "Build tools" ON) -+IF(CARES_BUILD_TOOLS) - # Build ahost - ADD_EXECUTABLE (ahost ahost.c ${SAMPLESOURCES}) - TARGET_COMPILE_DEFINITIONS (ahost PRIVATE HAVE_CONFIG_H=1) -@@ -695,3 +697,4 @@ TARGET_LINK_LIBRARIES (acountry PRIVATE ${PROJECT_NAME}) - IF (CARES_INSTALL) - INSTALL (TARGETS acountry ${TARGETS_INST_DEST}) - ENDIF () -+ENDIF() diff --git a/recipes/c-ares/all/patches/upstream-pr-395-bundle-destination-v14.patch b/recipes/c-ares/all/patches/upstream-pr-395-bundle-destination-v14.patch deleted file mode 100644 index 14536414d1c00..0000000000000 --- a/recipes/c-ares/all/patches/upstream-pr-395-bundle-destination-v14.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -65,6 +65,7 @@ SET (PACKAGE_DIRECTORY ${PROJECT_BINARY_DIR}/package) - # Destinations for installing different kinds of targets (pass to install command). - SET (TARGETS_INST_DEST - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} -+ BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} diff --git a/recipes/c-ares/all/patches/upstream-pr-395-bundle-destination-v15.patch b/recipes/c-ares/all/patches/upstream-pr-395-bundle-destination-v15.patch deleted file mode 100644 index 5049967cdd9a6..0000000000000 --- a/recipes/c-ares/all/patches/upstream-pr-395-bundle-destination-v15.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -66,6 +66,7 @@ SET (PACKAGE_DIRECTORY ${PROJECT_BINARY_DIR}/package) - # Destinations for installing different kinds of targets (pass to install command). - SET (TARGETS_INST_DEST - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} -+ BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} diff --git a/recipes/c-ares/all/patches/upstream-pr-395-bundle-destination-v16-17.patch b/recipes/c-ares/all/patches/upstream-pr-395-bundle-destination-v16-17.patch deleted file mode 100644 index ca07d535842b0..0000000000000 --- a/recipes/c-ares/all/patches/upstream-pr-395-bundle-destination-v16-17.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -74,6 +74,7 @@ SET (PACKAGE_DIRECTORY ${PROJECT_BINARY_DIR}/package) - # Destinations for installing different kinds of targets (pass to install command). - SET (TARGETS_INST_DEST - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} -+ BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - ) 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_package/test_package.c b/recipes/c-ares/all/test_package/test_package.c index 0023e9dae2282..0636b1f4dce35 100644 --- a/recipes/c-ares/all/test_package/test_package.c +++ b/recipes/c-ares/all/test_package/test_package.c @@ -103,7 +103,6 @@ main(void) return 1; } - ares_gethostbyname(channel, "google.com", AF_INET, callback, NULL); wait_ares(channel); ares_destroy(channel); ares_library_cleanup(); 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..18797eb3802c4 100644 --- a/recipes/c-ares/config.yml +++ b/recipes/c-ares/config.yml @@ -1,13 +1,19 @@ versions: - "1.18.1": + "1.34.3": folder: all - "1.17.2": + "1.34.1": folder: all - "1.17.1": + "1.33.1": folder: all - "1.16.1": + "1.33.0": folder: all - "1.15.0": + "1.32.3": folder: all - "1.14.0": + "1.32.2": + folder: all + "1.32.1": + folder: all + "1.31.0": + folder: all + "1.25.0": folder: all diff --git a/recipes/c-blosc/all/conandata.yml b/recipes/c-blosc/all/conandata.yml index dfd824d8023f0..a47eb694abb4a 100644 --- a/recipes/c-blosc/all/conandata.yml +++ b/recipes/c-blosc/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "1.21.5": + url: "https://github.com/Blosc/c-blosc/archive/v1.21.5.tar.gz" + sha256: "32e61961bbf81ffea6ff30e9d70fca36c86178afd3e3cfa13376adec8c687509" + "1.21.4": + url: "https://github.com/Blosc/c-blosc/archive/v1.21.4.tar.gz" + sha256: "e72bd03827b8564bbb3dc3ea0d0e689b4863871ce3861d946f2efd7a186ecf3e" + "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,17 +30,43 @@ sources: url: "https://github.com/Blosc/c-blosc/archive/v1.17.1.tar.gz" sha256: "19a6948b579c27e8ac440b4f077f99fc90e7292b1d9cb896bec0fd781d68fba2" patches: + "1.21.5": + - patch_file: "patches/cmake-dependencies-1.21.4+.patch" + patch_description: "use cci package" + patch_type: "conan" + "1.21.4": + - patch_file: "patches/cmake-dependencies-1.21.4+.patch" + patch_description: "use cci package" + patch_type: "conan" + "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" + patch_description: "use cci package" + patch_type: "conan" "1.21.0": - patch_file: "patches/cmake-dependencies-1.20.0+.patch" + patch_description: "use cci package" + patch_type: "conan" "1.20.1": - patch_file: "patches/cmake-dependencies-1.20.0+.patch" + patch_description: "use cci package" + patch_type: "conan" "1.20.0": - patch_file: "patches/cmake-dependencies-1.20.0+.patch" + patch_description: "use cci package" + patch_type: "conan" "1.19.0": - patch_file: "patches/cmake-dependencies-1.19.0.patch" + patch_description: "use cci package" + patch_type: "conan" "1.18.1": - patch_file: "patches/cmake-dependencies-1.18.1-.patch" + patch_description: "use cci package" + patch_type: "conan" "1.17.1": - patch_file: "patches/cmake-dependencies-1.18.1-.patch" + 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 1a0282104d95b..9f604b7efb491 100644 --- a/recipes/c-blosc/all/conanfile.py +++ b/recipes/c-blosc/all/conanfile.py @@ -5,17 +5,17 @@ from conan.tools.scm import Version import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class CbloscConan(ConanFile): name = "c-blosc" description = "An extremely fast, multi-threaded, meta-compressor library." license = "BSD-3-Clause" - topics = ("c-blosc", "blosc", "compression") - homepage = "https://github.com/Blosc/c-blosc" + topics = ("blosc", "compression") url = "https://github.com/conan-io/conan-center-index" - + homepage = "https://github.com/Blosc/c-blosc" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -47,18 +47,9 @@ def config_options(self): 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 + 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") @@ -67,15 +58,14 @@ def requirements(self): if self.options.with_lz4: self.requires("lz4/1.9.4") if self.options.with_snappy: - self.requires("snappy/1.1.9") + self.requires("snappy/1.1.10") if self.options.with_zlib: - self.requires("zlib/1.2.13") + self.requires("zlib/[>=1.2.11 <2]") if self.options.with_zstd: - self.requires("zstd/1.5.2") + self.requires("zstd/1.5.5") 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,4 +120,4 @@ def package_info(self): 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") + self.cpp_info.system_libs.extend(["m", "pthread"]) 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/patches/cmake-dependencies-1.21.4+.patch b/recipes/c-blosc/all/patches/cmake-dependencies-1.21.4+.patch new file mode 100644 index 0000000000000..0b293b6c2c49e --- /dev/null +++ b/recipes/c-blosc/all/patches/cmake-dependencies-1.21.4+.patch @@ -0,0 +1,71 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f726a0a..1dbcdc4 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -140,7 +140,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() +@@ -162,7 +163,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.") +@@ -177,7 +177,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 ceb27b8..36c5777 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_v1_package/CMakeLists.txt b/recipes/c-blosc/all/test_v1_package/CMakeLists.txt index 178f209fe3a3a..de3b75d9538de 100644 --- a/recipes/c-blosc/all/test_v1_package/CMakeLists.txt +++ b/recipes/c-blosc/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(c-blosc REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE c-blosc::c-blosc) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/c-blosc/config.yml b/recipes/c-blosc/config.yml index 600b8bb73358e..cd2301b24b5b4 100644 --- a/recipes/c-blosc/config.yml +++ b/recipes/c-blosc/config.yml @@ -1,4 +1,10 @@ versions: + "1.21.5": + folder: all + "1.21.4": + folder: all + "1.21.3": + folder: all "1.21.1": folder: all "1.21.0": diff --git a/recipes/c-blosc2/all/conandata.yml b/recipes/c-blosc2/all/conandata.yml index 2dea9f28ab028..5b441b6002794 100644 --- a/recipes/c-blosc2/all/conandata.yml +++ b/recipes/c-blosc2/all/conandata.yml @@ -1,45 +1,51 @@ 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" - + "2.15.0": + url: "https://github.com/Blosc/c-blosc2/archive/v2.15.0.tar.gz" + sha256: "1e7d9d099963ad0123ddd76b2b715b5aa1ea4b95c491d3a11508e487ebab7307" + "2.14.4": + url: "https://github.com/Blosc/c-blosc2/archive/v2.14.4.tar.gz" + sha256: "b5533c79aacc9ac152c80760ed1295a6608938780c3e1eecd7e53ea72ad986b0" + "2.13.1": + url: "https://github.com/Blosc/c-blosc2/archive/v2.13.1.tar.gz" + sha256: "6e7f5940269acd54d8dfe87c2102a442ad0407b1a62266a6f916134bae234399" + "2.13.0": + url: "https://github.com/Blosc/c-blosc2/archive/v2.13.0.tar.gz" + sha256: "d886798ff0a63948a4076f2ed60f0dc18be3aa1299ac1aff2cf705419cbe1bea" + "2.12.0": + url: "https://github.com/Blosc/c-blosc2/archive/v2.12.0.tar.gz" + sha256: "b8fa07ab0627c19fb652e08a5ada197eb0939b75e97e2fb76bbee145eaedc6e9" + "2.11.3": + url: "https://github.com/Blosc/c-blosc2/archive/v2.11.3.tar.gz" + sha256: "7273ec3ab42adc247425ab34b0601db86a6e2a6aa1a97a11e29df02e078f5037" + "2.10.5": + url: "https://github.com/Blosc/c-blosc2/archive/v2.10.5.tar.gz" + sha256: "a88f94bf839c1371aab8207a6a43698ceb92c72f65d0d7fe5b6e59f24c138b4d" patches: - "2.6.1": - - patch_file: "patches/2.6.0-0001-fix-cmake.patch" + "2.15.0": + - patch_file: "patches/2.10.5-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" + "2.14.4": + - patch_file: "patches/2.10.5-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" + "2.13.1": + - patch_file: "patches/2.10.5-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" + "2.13.0": + - patch_file: "patches/2.10.5-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" + "2.12.0": + - patch_file: "patches/2.10.5-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" + "2.11.3": + - patch_file: "patches/2.10.5-0001-fix-cmake.patch" + patch_description: "use cci package" + patch_type: "conan" + "2.10.5": + - patch_file: "patches/2.10.5-0001-fix-cmake.patch" 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 5be0280182140..658605c2a4d22 100644 --- a/recipes/c-blosc2/all/conanfile.py +++ b/recipes/c-blosc2/all/conanfile.py @@ -1,13 +1,16 @@ 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.errors import ConanInvalidConfiguration from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import get, copy, rm, rmdir, export_conandata_patches, apply_conandata_patches +from conan.tools.microsoft import is_msvc from conan.tools.scm import Version import os import glob -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" + class CBlosc2Conan(ConanFile): name = "c-blosc2" @@ -15,12 +18,13 @@ class CBlosc2Conan(ConanFile): license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/Blosc/c-blosc2" - topics = ("c-blosc", "blosc", "compression") + topics = ("c-blosc", "blosc", "compression", "cache", "store") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], - "simd_intrinsics": [None, "sse2", "avx2"], + "simd_intrinsics": [None, "sse2", "avx2", "avx512"], "with_lz4": [True, False], "with_zlib": [None, "zlib", "zlib-ng", "zlib-ng-compat"], "with_zstd": [True, False], @@ -47,18 +51,9 @@ def config_options(self): 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 + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") # c-blosc2 uses zlib-ng with zlib compat options. if self.options.with_zlib == "zlib-ng-compat": @@ -73,32 +68,28 @@ def requirements(self): if self.options.with_lz4: self.requires("lz4/1.9.4") if self.options.with_zlib in ["zlib-ng", "zlib-ng-compat"]: - self.requires("zlib-ng/2.0.6") + self.requires("zlib-ng/2.2.0") elif self.options.with_zlib == "zlib": - self.requires("zlib/1.2.13") + self.requires("zlib/[>=1.2.11 <2]") if self.options.with_zstd: - self.requires("zstd/1.5.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 + self.requires("zstd/1.5.5") + + def validate(self): + if Version(self.version) < "2.11.0" \ + and self.info.settings.arch in ["x86", "x86_64"] \ + and self.options.simd_intrinsics == "avx512": + raise ConanInvalidConfiguration(f"{self.ref} doesn't support 'avx512' SIMD intrinsics") 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") + self.tool_requires("cmake/[>=3.16.3 <4]") 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.cache_variables["BLOSC_IS_SUBPROJECT"] = False tc.cache_variables["BLOSC_INSTALL"] = True @@ -109,7 +100,8 @@ def generate(self): tc.cache_variables["BUILD_BENCHMARKS"] = False tc.cache_variables["BUILD_EXAMPLES"] = False simd_intrinsics = self.options.get_safe("simd_intrinsics", False) - tc.cache_variables["DEACTIVATE_AVX2"] = simd_intrinsics != "avx2" + tc.cache_variables["DEACTIVATE_AVX2"] = simd_intrinsics not in ["avx2", "avx512"] + tc.cache_variables["DEACTIVATE_AVX512"] = simd_intrinsics != "avx512" 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 @@ -122,6 +114,13 @@ def generate(self): tc.generate() deps = CMakeDeps(self) + if self.options.with_lz4: + deps.set_property("lz4", "cmake_file_name", "LZ4") + if self.options.with_zlib =="zlib-ng": + deps.set_property("zlib-ng", "cmake_file_name", "ZLIB_NG") + deps.set_property("zlib-ng", "cmake_target_name", "ZLIB_NG::ZLIB_NG") + if self.options.with_zstd: + deps.set_property("zstd", "cmake_file_name", "ZSTD") deps.generate() def _patch_sources(self): @@ -147,6 +146,8 @@ def package(self): 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, "cmake")) # Remove MS runtime files for dll_pattern_to_remove in ["concrt*.dll", "msvcp*.dll", "vcruntime*.dll"]: @@ -156,9 +157,6 @@ 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)] + self.cpp_info.libs = [f"{prefix}blosc2"] if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.system_libs = ["rt", "m", "pthread"] - - # TODO: to remove in conan v2 once pkg_config generator removed - self.cpp_info.names["pkg_config"] = "blosc2" + self.cpp_info.system_libs = ["rt", "m", "pthread", "dl"] diff --git a/recipes/c-blosc2/all/patches/2.10.5-0001-fix-cmake.patch b/recipes/c-blosc2/all/patches/2.10.5-0001-fix-cmake.patch new file mode 100644 index 0000000000000..7b59364e4a949 --- /dev/null +++ b/recipes/c-blosc2/all/patches/2.10.5-0001-fix-cmake.patch @@ -0,0 +1,54 @@ +diff --git a/blosc/CMakeLists.txt b/blosc/CMakeLists.txt +index 8c7cf90..f7efbf5 100644 +--- a/blosc/CMakeLists.txt ++++ b/blosc/CMakeLists.txt +@@ -79,8 +79,8 @@ set(INTERNAL_LIBS ${PROJECT_SOURCE_DIR}/internal-complibs) + # link dependencies + # "link" dependent targets via target_link_libraries (preferred) and + # manually add includes / libs for others +-if(LZ4_FOUND) ++if(lz4_FOUND) + if(BUILD_SHARED) + target_include_directories(blosc2_shared PUBLIC ${LZ4_INCLUDE_DIR}) + endif() + if(BUILD_STATIC) +@@ -138,8 +138,8 @@ if(NOT DEACTIVATE_ZLIB) + endif() + + if(NOT DEACTIVATE_ZSTD) +- if(ZSTD_FOUND) ++ if(zstd_FOUND) + if(BUILD_SHARED) + target_include_directories(blosc2_shared PUBLIC ${ZSTD_INCLUDE_DIR}) + target_link_libraries(blosc2_shared PUBLIC ${ZSTD_LIBRARY}) + endif() +@@ -184,8 +184,8 @@ if(NOT WIN32) + set(LIBS ${LIBS} ${CMAKE_DL_LIBS}) + endif() + +-if(LZ4_FOUND) ++if(lz4_FOUND) + set(LIBS ${LIBS} ${LZ4_LIBRARY}) + else() + file(GLOB LZ4_FILES ${LZ4_LOCAL_DIR}/*.c) + list(APPEND SOURCES ${LZ4_FILES}) +@@ -193,8 +193,8 @@ else() + endif() + + if(NOT DEACTIVATE_ZLIB) +- if(ZLIB_NG_FOUND) ++ if(zlib-ng_FOUND) + set(LIBS ${LIBS} ${ZLIB_NG_LIBRARY}) + elseif(ZLIB_FOUND) + set(LIBS ${LIBS} ${ZLIB_LIBRARIES}) + else() +@@ -206,8 +206,8 @@ if(NOT DEACTIVATE_ZLIB) + endif() + + if(NOT DEACTIVATE_ZSTD) +- if(ZSTD_FOUND) ++ if(zstd_FOUND) + set(LIBS ${LIBS} ${ZSTD_LIBRARY}) + 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.2.0-0001-fix-cmake.patch b/recipes/c-blosc2/all/patches/2.2.0-0001-fix-cmake.patch deleted file mode 100644 index cef3c154b1ab2..0000000000000 --- a/recipes/c-blosc2/all/patches/2.2.0-0001-fix-cmake.patch +++ /dev/null @@ -1,127 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index bd8cb34..9c4cfe0 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -68,7 +68,8 @@ if(NOT WIN32) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99") - endif() - --cmake_minimum_required(VERSION 3.16.3) -+## TODO: dirty fix. -+cmake_minimum_required(VERSION 3.15) - if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_GREATER 3.4) - cmake_policy(SET CMP0063 NEW) - endif() -@@ -144,26 +145,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,7 +185,7 @@ endif() - - if(NOT DEACTIVATE_ZSTD) - if(PREFER_EXTERNAL_ZSTD) -- find_package(ZSTD) -+ find_package(zstd) - 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 deleted file mode 100644 index 565d775f0be52..0000000000000 --- a/recipes/c-blosc2/all/patches/2.4.1-0001-fix-cmake.patch +++ /dev/null @@ -1,119 +0,0 @@ -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 deleted file mode 100644 index 5c30c1a180c48..0000000000000 --- a/recipes/c-blosc2/all/patches/2.6.0-0001-fix-cmake.patch +++ /dev/null @@ -1,122 +0,0 @@ -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/config.yml b/recipes/c-blosc2/config.yml index 8f6cd9ee625a2..7d50a7f518889 100644 --- a/recipes/c-blosc2/config.yml +++ b/recipes/c-blosc2/config.yml @@ -1,13 +1,15 @@ versions: - "2.6.1": + "2.15.0": folder: all - "2.6.0": + "2.14.4": folder: all - "2.4.3": + "2.13.1": folder: all - "2.4.2": + "2.13.0": folder: all - "2.4.1": + "2.12.0": folder: all - "2.2.0": + "2.11.3": + folder: all + "2.10.5": folder: all diff --git a/recipes/c-client/all/conandata.yml b/recipes/c-client/all/conandata.yml index f217549d30957..ada026bf11c4c 100644 --- a/recipes/c-client/all/conandata.yml +++ b/recipes/c-client/all/conandata.yml @@ -1,16 +1,11 @@ sources: "2007f": + url: "https://github.com/uw-imap/imap/archive/cab109466534e206a3652ef1c68fe88101b68bda.zip" sha256: "aaca88c228b7bab9f73b5972e996fd39f770d8e226561b3e107ec19ceaf21570" - url: https://github.com/uw-imap/imap/archive/cab109466534e206a3652ef1c68fe88101b68bda.zip patches: "2007f": - patch_file: patches/0001-fix-yunchan-tempfile.patch - base_path: "" - patch_file: patches/0002-fix-makefile-w2k.patch - base_path: "" - patch_file: patches/0003-fix-env-nt.patch - base_path: "" - patch_file: patches/0004-fix-makefile.patch - base_path: "" - patch_file: patches/2014_openssl1.1.1_sni.patch - base_path: "" diff --git a/recipes/c-client/all/conanfile.py b/recipes/c-client/all/conanfile.py index c88ba1cbbc780..795f25ff9b207 100644 --- a/recipes/c-client/all/conanfile.py +++ b/recipes/c-client/all/conanfile.py @@ -1,10 +1,15 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import apply_conandata_patches, chdir, copy, export_conandata_patches, get, mkdir, replace_in_file +from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, NMakeToolchain +import glob import os +import shutil import stat -from conans import AutoToolsBuildEnvironment, ConanFile, tools -from conans.errors import ConanInvalidConfiguration - -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.55.0" class CclientConan(ConanFile): @@ -21,20 +26,29 @@ class CclientConan(ConanFile): default_options = { "fPIC": True, } - exports_sources = "patches/*" - @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): + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + basic_layout(self, src_folder="src") - @property - def _is_msvc(self): - return self._settings_build.compiler in ("Visual Studio", "msvc") + def requirements(self): + if not is_msvc(self): + self.requires("openssl/[>=1.1 <4]") def validate(self): - if self._settings_build.os == "Windows" and not self._is_msvc: + if self.settings.os == "Windows" and not is_msvc(self): raise ConanInvalidConfiguration( - "c-client is setup to build only with MSVC on Windows" + "c-client is setup to build only with MSVC for Windows" ) # FIXME: need krb5 recipe if self.settings.os == "Macos": @@ -43,40 +57,28 @@ def validate(self): "Conan yet" ) - 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 - - def requirements(self): - if not self._is_msvc: - self.requires("openssl/1.1.1q") - def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True) - - def _patch_msvc(self): - opt_flags = "/O2 /Ob2 /DNDEBUG" - if self.settings.build_type == "Debug": - opt_flags = "/Zi /Ob0 /Od /RTC1" - runtime = f"/{self.settings.compiler.runtime}" - # NOTE: boatloads of warnings for truncation, sign mismatch, - # implicit conversions, just the usual C things - warnings = \ - "/W3 /wd4267 /wd4244 /wd4273 /wd4311 /wd4312 /wd4133 /wd4028" - cflags = f"{runtime} {warnings} /GS {opt_flags}" - search = "EXTRACFLAGS =" - replace = f"EXTRACFLAGS = {cflags}" - tools.replace_in_file(r"src\osdep\nt\makefile.w2k", search, replace) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + if is_msvc(self): + tc = NMakeToolchain(self) + tc.generate() + else: + tc = AutotoolsToolchain(self) + tc.generate() + deps = AutotoolsDeps(self) + deps.generate() def _build_msvc(self): - make = "nmake /nologo /f makefile.w2k" - with tools.vcvars(self): - self.run(f"{make} c-client", run_environment=True) - self.run(make, cwd="c-client", run_environment=True) + # Avoid many warnings + makefile_w2k = os.path.join(self.source_folder, "src", "osdep", "nt", "makefile.w2k") + warnings = "/W3 /wd4267 /wd4244 /wd4273 /wd4311 /wd4312 /wd4133 /wd4028" + replace_in_file(self, makefile_w2k, "EXTRACFLAGS =", f"EXTRACFLAGS = {warnings}") + + nmake = "nmake /f makefile.w2k" + self.run(f"{nmake} c-client", cwd=self.source_folder) + self.run(nmake, cwd=os.path.join(self.source_folder, "c-client")) def _chmod_x(self, path): os.chmod(path, os.stat(path).st_mode | stat.S_IEXEC) @@ -85,18 +87,17 @@ def _touch(self, path): with open(path, "a", encoding=None): pass def _build_unix(self): - self._touch("ip6") - self._chmod_x("tools/an") - self._chmod_x("tools/ua") - unix = "src/osdep/unix" - self._chmod_x(f"{unix}/drivers") - self._chmod_x(f"{unix}/mkauths") - search = "SSLDIR=/usr/local/ssl" - ssldir = self.deps_cpp_info["openssl"].rootpath - tools.replace_in_file(f"{unix}/Makefile", search, f"SSLDIR={ssldir}") + self._touch(os.path.join(self.source_folder, "ip6")) + self._chmod_x(os.path.join(self.source_folder, "tools", "an")) + self._chmod_x(os.path.join(self.source_folder, "tools", "ua")) + unix = os.path.join(self.source_folder, "src", "osdep", "unix") + self._chmod_x(os.path.join(unix, "drivers")) + self._chmod_x(os.path.join(unix, "mkauths")) + ssldir = self.dependencies["openssl"].package_folder + replace_in_file(self, os.path.join(unix, "Makefile"), "SSLDIR=/usr/local/ssl", f"SSLDIR={ssldir}") # This is from the Homebrew Formula - tools.replace_in_file( - "src/osdep/unix/ssl_unix.c", + replace_in_file( + self, os.path.join(unix, "ssl_unix.c"), "#include \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..96423bd2a8bac 100644 --- a/recipes/c-dbg-macro/all/conanfile.py +++ b/recipes/c-dbg-macro/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.files import get, copy +from conan.tools.layout import basic_layout +import os + +required_conan_version = ">=1.50.0" -required_conan_version = ">=1.33.0" class DbgMacroConan(ConanFile): name = "c-dbg-macro" @@ -10,24 +14,31 @@ 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") + package_type = "header-library" settings = ("compiler", "build_type", "os", "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.clear() def validate(self): if self.settings.os == "Windows": raise ConanInvalidConfiguration("This library is not compatible with 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 package(self): - self.copy("include/dbg.h", dst=".", src=self._source_subfolder) - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - - def package_id(self): - self.info.header_only() + 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_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] 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/conandata.yml b/recipes/c4core/all/conandata.yml index 622bb4f50ac3a..8abc810fc0588 100644 --- a/recipes/c4core/all/conandata.yml +++ b/recipes/c4core/all/conandata.yml @@ -1,4 +1,16 @@ sources: + "0.2.2": + url: "https://github.com/biojppm/c4core/releases/download/v0.2.2/c4core-0.2.2-src.tgz" + sha256: "beea43a5bdc64616d897cc0af728f408e35e2d75a8bb6014e6e25e90e0484578" + "0.2.1": + url: "https://github.com/biojppm/c4core/releases/download/v0.2.1/c4core-0.2.1-src.tgz" + sha256: "6447896444c59002af58c8543d0bc64184b9a5c5992c8fc09d6d71935d039f89" + "0.2.0": + url: "https://github.com/biojppm/c4core/releases/download/v0.2.0/c4core-0.2.0-src.tgz" + sha256: "7843e6fb41c200fff69fc71105dbbf56bb410bdbab6b330e02cbe18430fe23bd" + "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" @@ -8,8 +20,23 @@ sources: "0.1.8": url: "https://github.com/biojppm/c4core/releases/download/v0.1.8/c4core-0.1.8-src.tgz" sha256: "95c0663192c6bff7a098b50afcb05d22a34dd0fd8e6be2e1b61edad2b9675fde" - patches: + "0.2.2": + - patch_file: "patches/0.2.2-0001-make-fast_float-external.patch" + patch_description: "use cci's fast_float recipe" + patch_type: "conan" + "0.2.1": + - patch_file: "patches/0.2.0-0001-make-fast_float-external.patch" + patch_description: "use cci's fast_float recipe" + patch_type: "conan" + "0.2.0": + - patch_file: "patches/0.2.0-0001-make-fast_float-external.patch" + patch_description: "use cci's fast_float recipe" + patch_type: "conan" + "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" diff --git a/recipes/c4core/all/conanfile.py b/recipes/c4core/all/conanfile.py index 885a6cf2b70cc..91680b53adcd5 100644 --- a/recipes/c4core/all/conanfile.py +++ b/recipes/c4core/all/conanfile.py @@ -6,7 +6,7 @@ from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class C4CoreConan(ConanFile): name = "c4core" @@ -18,6 +18,7 @@ class C4CoreConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/biojppm/c4core" topics = ("utilities", "low-latency", ) + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -39,17 +40,14 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") def requirements(self): if self.options.with_fast_float: - self.requires("fast_float/3.8.1") + self.requires("fast_float/6.1.0", transitive_headers=True) def validate(self): if self.settings.compiler.get_safe("cppstd"): @@ -57,13 +55,12 @@ def validate(self): ## clang with libc++ is not supported. It is already fixed since 0.1.9. if Version(self.version) <= "0.1.8": - if self.info.settings.compiler in ["clang", "apple-clang"] and \ - self.info.settings.compiler.get_safe("libcxx") == "libc++": + 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): - 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,7 +82,7 @@ def package(self): cmake.install() 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")) + rm(self, "*.natvis", os.path.join(self.package_folder, "include"), recursive=True) def package_info(self): self.cpp_info.libs = ["c4core"] 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.2.0-0001-make-fast_float-external.patch b/recipes/c4core/all/patches/0.2.0-0001-make-fast_float-external.patch new file mode 100644 index 0000000000000..2fbe458a72084 --- /dev/null +++ b/recipes/c4core/all/patches/0.2.0-0001-make-fast_float-external.patch @@ -0,0 +1,38 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f1d62be..cda061c 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -76,7 +76,7 @@ set(C4CORE_SRC_FILES + if(C4CORE_WITH_FASTFLOAT) + list(APPEND C4CORE_SRC_FILES + c4/ext/fast_float.hpp +- c4/ext/fast_float_all.h ++# c4/ext/fast_float_all.h + ) + endif() + set(C4CORE_AMALGAMATED ${C4CORE_SRC_DIR}/../src_singleheader/c4/c4core_all.hpp) +@@ -95,7 +95,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/src/c4/ext/fast_float.hpp b/src/c4/ext/fast_float.hpp +index 77fac4f..db14534 100644 +--- a/src/c4/ext/fast_float.hpp ++++ b/src/c4/ext/fast_float.hpp +@@ -18,7 +18,7 @@ + # pragma GCC diagnostic ignored "-Wold-style-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.2.2-0001-make-fast_float-external.patch b/recipes/c4core/all/patches/0.2.2-0001-make-fast_float-external.patch new file mode 100644 index 0000000000000..159c3bcb4195b --- /dev/null +++ b/recipes/c4core/all/patches/0.2.2-0001-make-fast_float-external.patch @@ -0,0 +1,38 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 79451c5..c93511a 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -76,7 +76,7 @@ set(C4CORE_SRC_FILES + if(C4CORE_WITH_FASTFLOAT) + list(APPEND C4CORE_SRC_FILES + c4/ext/fast_float.hpp +- c4/ext/fast_float_all.h ++# c4/ext/fast_float_all.h + ) + endif() + set(C4CORE_AMALGAMATED ${C4CORE_SRC_DIR}/../src_singleheader/c4/c4core_all.hpp) +@@ -95,7 +95,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/src/c4/ext/fast_float.hpp b/src/c4/ext/fast_float.hpp +index 4bf3c0d..b6a3a77 100644 +--- a/src/c4/ext/fast_float.hpp ++++ b/src/c4/ext/fast_float.hpp +@@ -20,7 +20,7 @@ + # pragma GCC diagnostic ignored "-Wold-style-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 62cfc706469cd..e0b34e28e562b 100644 --- a/recipes/c4core/all/test_package/CMakeLists.txt +++ b/recipes/c4core/all/test_package/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.8) -project(test_package CXX) +project(test_package LANGUAGES CXX) find_package(c4core REQUIRED CONFIG) diff --git a/recipes/c4core/all/test_v1_package/CMakeLists.txt b/recipes/c4core/all/test_v1_package/CMakeLists.txt index bfd5ba0ad4164..bc541ea90b512 100644 --- a/recipes/c4core/all/test_v1_package/CMakeLists.txt +++ b/recipes/c4core/all/test_v1_package/CMakeLists.txt @@ -1,12 +1,9 @@ cmake_minimum_required(VERSION 3.8) -project(test_package CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(c4core REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE c4core::c4core) -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/c4core/config.yml b/recipes/c4core/config.yml index 364da530085a9..6368871bf45ae 100644 --- a/recipes/c4core/config.yml +++ b/recipes/c4core/config.yml @@ -1,4 +1,12 @@ versions: + "0.2.2": + folder: all + "0.2.1": + folder: all + "0.2.0": + folder: all + "0.1.11": + folder: all "0.1.10": folder: all "0.1.9": 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..bc37447b0b44e 100644 --- a/recipes/caf/all/conandata.yml +++ b/recipes/caf/all/conandata.yml @@ -1,22 +1,19 @@ sources: + "1.0.2": + url: "https://github.com/actor-framework/actor-framework/archive/1.0.2.tar.gz" + sha256: "ef4dd00ca7c59cd61dc336b6a8efbd6150ca85c404d213ecb61f6bcee4094ffc" + "1.0.0": + url: "https://github.com/actor-framework/actor-framework/archive/1.0.0.tar.gz" + sha256: "602018239d23a1805d35ebda704fd5c969a0693fc513fcf7459063b628459e5b" + "0.19.4": + url: "https://github.com/actor-framework/actor-framework/archive/0.19.4.tar.gz" + sha256: "114d43e3a7a2305ca1d2106cd0daeff471564f62b90db1e453ba9eb5c47c02f6" "0.18.6": url: "https://github.com/actor-framework/actor-framework/archive/0.18.6.tar.gz" sha256: "c2ead63a0322d992fea8813a7f7d15b4d16cbb8bbe026722f2616a79109b91cc" - "0.18.5": - url: "https://github.com/actor-framework/actor-framework/archive/0.18.5.tar.gz" - sha256: "4c96f896f000218bb65890b4d7175451834add73750d5f33b0c7fe82b7d5a679" - "0.18.2": - url: "https://github.com/actor-framework/actor-framework/archive/0.18.2.tar.gz" - sha256: "03837dbef73a13c3e4cac76c009d018f48d1d97b182277230f204984c9542ccc" - "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" + "0.18.6": + - patch_file: "patches/0001-fix-gcc-13-include.patch" + patch_description: "add missing include to support gcc 13" + patch_type: "bugfix" + patch_source: "https://github.com/actor-framework/actor-framework/commit/c2ee99c" diff --git a/recipes/caf/all/conanfile.py b/recipes/caf/all/conanfile.py index adbfa98e4822c..a3b2de97d78cc 100644 --- a/recipes/caf/all/conanfile.py +++ b/recipes/caf/all/conanfile.py @@ -1,18 +1,23 @@ -from conans import ConanFile, CMake, 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.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, export_conandata_patches, copy, get, rmdir +from conan.tools.scm import Version + +required_conan_version = ">=2.0" class CAFConan(ConanFile): name = "caf" description = "An open source implementation of the Actor Model in C++" + license = "BSD-3-Clause", "BSL-1.0" 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" - license = "BSD-3-Clause", "BSL-1.0" - + topics = ("actor-framework", "actor-model", "pattern-matching", "actors") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -27,21 +32,8 @@ class CAFConan(ConanFile): "with_openssl": 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": @@ -49,46 +41,23 @@ 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 <4]") 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': + check_min_cppstd(self, "17") + + if self.settings.compiler == "clang" and Version(self.settings.compiler.version) < "6": + raise ConanInvalidConfiguration("Link errors with clang 5. " + "See https://github.com/actor-framework/actor-framework/issues/1226") + 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,73 +65,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) + cppstd = str(self.settings.compiler.cppstd).replace("gnu", "") + if Version(self.version) >= "1.0.0": + tc.variables["CAF_CXX_VERSION"] = 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"] = str(self.options.log_level).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() + 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._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 - self.cpp_info.names["cmake_find_package"] = "CAF" - self.cpp_info.names["cmake_find_package_multi"] = "CAF" - self.cpp_info.components["caf_core"].names["cmake_find_package"] = "core" - self.cpp_info.components["caf_core"].names["cmake_find_package_multi"] = "core" - self.cpp_info.components["caf_io"].names["cmake_find_package"] = "io" - self.cpp_info.components["caf_io"].names["cmake_find_package_multi"] = "io" - if self.options.with_openssl: - self.cpp_info.components["caf_openssl"].names["cmake_find_package"] = "openssl" - self.cpp_info.components["caf_openssl"].names["cmake_find_package_multi"] = "openssl" diff --git a/recipes/caf/all/patches/0001-fix-gcc-13-include.patch b/recipes/caf/all/patches/0001-fix-gcc-13-include.patch new file mode 100644 index 0000000000000..3ad9d6d3ba42f --- /dev/null +++ b/recipes/caf/all/patches/0001-fix-gcc-13-include.patch @@ -0,0 +1,21 @@ +--- a/libcaf_core/caf/detail/ripemd_160.hpp ++++ b/libcaf_core/caf/detail/ripemd_160.hpp +@@ -42,6 +42,7 @@ + + #include + #include ++#include + + #include "caf/detail/core_export.hpp" + +--- a/libcaf_core/caf/telemetry/metric_type.hpp ++++ b/libcaf_core/caf/telemetry/metric_type.hpp +@@ -4,6 +4,8 @@ + + #pragma once + ++#include ++ + namespace caf::telemetry { + + enum class metric_type : uint8_t { 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/config.yml b/recipes/caf/config.yml index f96fed142bde9..c4e014dc65945 100644 --- a/recipes/caf/config.yml +++ b/recipes/caf/config.yml @@ -1,11 +1,9 @@ versions: - "0.18.6": - folder: all - "0.18.5": + "1.0.2": folder: all - "0.18.2": + "1.0.0": folder: all - "0.18.0": + "0.19.4": folder: all - "0.17.6": + "0.18.6": folder: all diff --git a/recipes/cairo/all/conandata.yml b/recipes/cairo/all/conandata.yml index e6ad418ca420e..ab830d86cca25 100644 --- a/recipes/cairo/all/conandata.yml +++ b/recipes/cairo/all/conandata.yml @@ -1,26 +1,45 @@ sources: + "1.18.0": + sha256: "abf8fba4d510086a492783c3e0828e90b32734738fd80906595617d229d02bab" + url: "https://gitlab.freedesktop.org/cairo/cairo/-/archive/1.18.0/cairo-1.18.0.tar.bz2" + "1.17.8": + url: "https://gitlab.freedesktop.org/cairo/cairo/-/archive/1.17.8/cairo-1.17.8.tar.bz2" + sha256: "ead4724423eb969f98b456fe1e3ee1e1741fe1c8dfb1a41ca12afa81a6c1665f" + "1.17.6": + url: "https://gitlab.freedesktop.org/cairo/cairo/-/archive/1.17.6/cairo-1.17.6.tar.bz2" + sha256: "90496d135c9ef7612c98f8ee358390cdec0825534573778a896ea021155599d2" "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" - "1.17.2": - sha256: "6b70d4655e2a47a22b101c666f4b29ba746eda4aa8a0f7255b32b2e9408801df" - url: "https://www.cairographics.org/snapshots/cairo-1.17.2.tar.xz" - "1.16.0": - sha256: "5e7b29b3f113ef870d1e3ecf8adf21f923396401604bda16d44be45e66052331" - url: "https://www.cairographics.org/releases/cairo-1.16.0.tar.xz" patches: + "1.18.0": + - patch_file: "patches/1.18.0-msvc-alloca.patch" + patch_type: "backport" + patch_description: "Fix alloca undefined with MSVC" + patch_source: "https://gitlab.freedesktop.org/cairo/cairo/-/merge_requests/520" "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" - "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_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" + 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" + 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" + 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" + 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/all/conanfile.py b/recipes/cairo/all/conanfile.py index 363cd49cb6c52..9b42f6bc4a8e0 100644 --- a/recipes/cairo/all/conanfile.py +++ b/recipes/cairo/all/conanfile.py @@ -1,13 +1,19 @@ +import glob 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 +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 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.50.0" +required_conan_version = ">=1.53.0" class CairoConan(ConanFile): @@ -27,6 +33,12 @@ class CairoConan(ConanFile): "with_xlib_xrender": [True, False], "with_xcb": [True, False], "with_glib": [True, False], + "with_lzo": [True, False], + "with_zlib": [True, False], + "with_png": [True, False], + "with_opengl": [False, "desktop", "gles2", "gles3"], + "with_symbol_lookup": [True, False], + "tee": [True, False], } default_options = { "shared": False, @@ -34,283 +46,306 @@ class CairoConan(ConanFile): "with_freetype": True, "with_fontconfig": True, "with_xlib": True, - "with_xlib_xrender": False, + "with_xlib_xrender": True, "with_xcb": True, "with_glib": True, + "with_lzo": True, + "with_zlib": True, + "with_png": True, + "with_opengl": "desktop", + "with_symbol_lookup": False, + "tee": False, } - - 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): - del self.options.with_freetype - del self.options.with_glib - if self.settings.os != "Linux": + if self.settings.os not in ["Linux", "FreeBSD"]: del self.options.with_xlib del self.options.with_xlib_xrender del self.options.with_xcb + del self.options.with_symbol_lookup + if Version(self.version) >= "1.17.8" or self.settings.os == "Windows" or is_apple_os(self): + del self.options.with_opengl 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") - if self.options.get_safe("with_fontconfig", False): - self.requires("fontconfig/2.13.93") - if self.settings.os == "Linux": + self.requires("pixman/0.43.4") + if self.options.with_zlib and self.options.with_png: + self.requires("expat/[>=2.6.2 <3]") + if self.options.with_lzo: + self.requires("lzo/2.10") + if self.options.with_zlib: + self.requires("zlib/[>=1.2.11 <2]") + if self.options.with_freetype: + self.requires("freetype/2.13.2", transitive_headers=True, transitive_libs=True) + if self.options.with_fontconfig: + self.requires("fontconfig/2.15.0", transitive_headers=True, transitive_libs=True) + if self.options.with_png: + self.requires("libpng/[>=1.6 <2]") + if self.options.with_glib: + self.requires("glib/2.78.3") + if self.settings.os in ["Linux", "FreeBSD"]: 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("pixman/0.40.0") - self.requires("libpng/1.6.37") + self.requires("xorg/system", transitive_headers=True, transitive_libs=True) + if self.options.get_safe("with_opengl") == "desktop": + self.requires("opengl/system", transitive_headers=True, transitive_libs=True) + if self.settings.os == "Windows": + self.requires("glext/cci.20210420") + self.requires("wglext/cci.20200813") + self.requires("khrplatform/cci.20200529") + if self.options.get_safe("with_opengl") and self.settings.os in ["Linux", "FreeBSD"]: + self.requires("egl/system", transitive_headers=True, transitive_libs=True) + + 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.dependencies["glib"].options.shared: + if is_msvc_static_runtime(self): + raise ConanInvalidConfiguration( + "Linking shared glib with the MSVC static runtime is not supported" + ) + elif self.options.shared: + raise ConanInvalidConfiguration( + "Linking a shared library against static glib can cause unexpected behaviour." + ) 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("gtk-doc-stub/cci.20181216") + self.tool_requires("meson/1.4.0") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/2.1.0") 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): + def is_enabled(value): + return "enabled" if value else "disabled" + + env = VirtualBuildEnv(self) + env.generate() + + pkg_deps = PkgConfigDeps(self) + pkg_deps.generate() + + 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 in ["Linux", "FreeBSD"]: + options["xcb"] = is_enabled(self.options.with_xcb) + options["xlib"] = is_enabled(self.options.with_xlib) + else: + options["xcb"] = "disabled" + options["xlib"] = "disabled" + if Version(self.version) < "1.17.8": + if self.options.get_safe("with_opengl") == "desktop": + options["gl-backend"] = "gl" + elif self.options.get_safe("with_opengl") == "gles2": + options["gl-backend"] = "glesv2" + elif self.options.get_safe("with_opengl") == "gles3": + options["gl-backend"] = "glesv3" + else: + 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 + + 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 in ["Linux", "FreeBSD"]: + 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 cross_building(self): + meson.properties["ipc_rmid_deferred_release"] = self.settings.os == "Linux" + + 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) - 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): - 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", - ] - 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() + apply_conandata_patches(self) + + # Dependency freetype2 found: NO found 2.11.0 but need: '>= 9.7.3' + if self.options.with_freetype: + 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) - 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) - 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) - 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")) - else: - autotools = self._configure_autotools() - 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")) + 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"} + base_system_libs = {} + + 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].requires += ["cairo_"] + requirements + base_requirements.update(set(requirements)) + if system_libs is not None: + self.cpp_info.components[component].system_libs += system_libs + 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-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"] - - if self.options.get_safe("with_freetype", True): - self.cpp_info.components["cairo_"].requires.append("freetype::freetype") - if self.settings.os == "Windows": - self.cpp_info.components["cairo_"].system_libs.extend(["gdi32", "msimg32", "user32"]) - if not self.options.shared: - self.cpp_info.components["cairo_"].defines.append("CAIRO_WIN32_STATIC_BUILD=1") - else: - if self.options.with_glib: - self.cpp_info.components["cairo_"].requires.extend(["glib::gobject-2.0", "glib::glib-2.0"]) - if self.options.with_fontconfig: - self.cpp_info.components["cairo_"].requires.append("fontconfig::fontconfig") - - if self.settings.os == "Linux": - self.cpp_info.components["cairo_"].system_libs = ["pthread", "rt"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["cairo_"].system_libs.extend(["m", "dl", "pthread"]) + if self.options.get_safe("with_symbol_lookup"): + self.cpp_info.components["cairo_"].system_libs.append("bfd") self.cpp_info.components["cairo_"].cflags = ["-pthread"] self.cpp_info.components["cairo_"].cxxflags = ["-pthread"] - if self.options.with_xcb: - self.cpp_info.components["cairo_"].requires.extend(["xorg::xcb-shm", "xorg::xcb"]) - if self.options.with_xlib_xrender: - self.cpp_info.components["cairo_"].requires.extend(["xorg::xcb-render"]) - if self.options.with_xlib: - self.cpp_info.components["cairo_"].requires.extend(["xorg::x11", "xorg::xext"]) - if tools.is_apple_os(self.settings.os): - self.cpp_info.components["cairo_"].frameworks.append("CoreGraphics") + if self.options.with_lzo: + self.cpp_info.components["cairo_"].requires.append("lzo::lzo") - 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.with_zlib: + self.cpp_info.components["cairo_"].requires.append("zlib::zlib") - 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 self.options.with_png: + add_component_and_base_requirements("cairo-png", ["libpng::libpng"]) + add_component_and_base_requirements("cairo-svg", ["libpng::libpng"]) + + if self.options.with_fontconfig: + add_component_and_base_requirements("cairo-fc", ["fontconfig::fontconfig"]) + + if self.options.with_freetype: + add_component_and_base_requirements("cairo-ft", ["freetype::freetype"]) + + if self.options.get_safe("with_xlib"): + add_component_and_base_requirements("cairo-xlib", ["xorg::x11", "xorg::xext"]) + + if self.options.get_safe("with_xlib_xrender"): + add_component_and_base_requirements("cairo-xlib-xrender", ["xorg::xrender"]) + + if self.options.get_safe("with_xcb"): + add_component_and_base_requirements("cairo-xcb", ["xorg::xcb", "xorg::xcb-render"]) + add_component_and_base_requirements("cairo-xcb-shm", ["xorg::xcb", "xorg::xcb-shm"]) + + if self.options.get_safe("with_xlib"): + add_component_and_base_requirements("cairo-xlib-xcb", ["xorg::x11-xcb"]) + + 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-image"].set_property("pkg_config_name", "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_"] - def package_id(self): - if self.options.get_safe("with_glib") and not self.options["glib"].shared: - self.info.requires["glib"].full_package_mode() + 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"].requires = ["cairo_"] + + self.cpp_info.components["cairo-win32-font"].set_property("pkg_config_name", "cairo-win32-font") + self.cpp_info.components["cairo-win32-font"].requires = ["cairo_"] + + self.cpp_info.components["cairo_"].system_libs.extend(["gdi32", "msimg32", "user32"]) + + if not self.options.shared: + self.cpp_info.components["cairo_"].defines.append("CAIRO_WIN32_STATIC_BUILD=1") + + if self.options.get_safe("with_opengl"): + if self.options.with_opengl == "desktop": + add_component_and_base_requirements("cairo-gl", ["opengl::opengl"]) + + if self.settings.os in ["Linux", "FreeBSD"]: + add_component_and_base_requirements("cairo-glx", ["opengl::opengl"]) + + if self.settings.os == "Windows": + add_component_and_base_requirements("cairo-wgl", ["glext::glext", "wglext::wglext", "khrplatform::khrplatform"]) + + elif self.options.with_opengl == "gles3": + add_component_and_base_requirements("cairo-glesv3", [], ["GLESv2"]) + elif self.options.with_opengl == "gles2": + add_component_and_base_requirements("cairo-glesv2", [], ["GLESv2"]) + if self.settings.os in ["Linux", "FreeBSD"]: + add_component_and_base_requirements("cairo-egl", ["egl::egl"]) + + if self.options.with_zlib: + add_component_and_base_requirements("cairo-script", ["zlib::zlib"]) + 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"].libs = ["cairo-script-interpreter"] + self.cpp_info.components["cairo-script-interpreter"].requires = ["cairo_"] + + if self.options.with_png: + add_component_and_base_requirements("cairo-xml", ["zlib::zlib"]) + add_component_and_base_requirements("cairo-util_", ["expat::expat"]) + + if self.options.tee: + self.cpp_info.components["cairo-tee"].set_property("pkg_config_name", "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"].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) diff --git a/recipes/cairo/all/patches/0001-msvc-update-build-scripts-to-compile-with-more-featu.patch b/recipes/cairo/all/patches/0001-msvc-update-build-scripts-to-compile-with-more-featu.patch deleted file mode 100644 index 1554d7bb38ba6..0000000000000 --- a/recipes/cairo/all/patches/0001-msvc-update-build-scripts-to-compile-with-more-featu.patch +++ /dev/null @@ -1,155 +0,0 @@ -From 2801a57b7dae8060f4b4c2dede65cf4ce79da62b Mon Sep 17 00:00:00 2001 -From: Ignacio Casal Quinteiro -Date: Tue, 28 Feb 2017 11:10:37 +0100 -Subject: [PATCH] msvc: update build scripts to compile with more features - -This also adds support to build cairo-gobject ---- - build/Makefile.win32.common | 52 +++++++++++++++++++++++++++++++-------- - build/Makefile.win32.features | 13 +++++----- - util/cairo-gobject/Makefile.win32 | 24 ++++++++++++++++++ - 3 files changed, 73 insertions(+), 16 deletions(-) - create mode 100644 util/cairo-gobject/Makefile.win32 - -diff --git a/build/Makefile.win32.common b/build/Makefile.win32.common -index 7d7e973..38063a7 100644 ---- a/build/Makefile.win32.common -+++ b/build/Makefile.win32.common -@@ -23,34 +23,66 @@ CFG_CFLAGS := -MD -O2 - CFG_LDFLAGS := - endif - -+ifeq ($(ARCH),) -+ARCH=Win32 -+endif -+ -+ifeq ($(INSTALL_DIR),) -+INSTALL_DIR=$(top_srcdir)/../../../../gtk/$(ARCH)/$(CFG) -+endif -+ - ifeq ($(PIXMAN_PATH),) --PIXMAN_PATH := $(top_builddir)/../pixman -+PIXMAN_PATH := $(INSTALL_DIR) - endif --PIXMAN_CFLAGS := -I$(PIXMAN_PATH)/pixman/ --PIXMAN_LIBS := $(PIXMAN_PATH)/pixman/$(CFG)/pixman-1.lib -+PIXMAN_CFLAGS := -I$(PIXMAN_PATH)/include/pixman-1 -+PIXMAN_LIBS := $(PIXMAN_PATH)/lib/pixman-1.lib - - CAIRO_LIBS = gdi32.lib msimg32.lib user32.lib - - ifeq ($(CAIRO_HAS_PNG_FUNCTIONS),1) - ifeq ($(LIBPNG_PATH),) --LIBPNG_PATH := $(top_builddir)/../libpng -+LIBPNG_PATH := $(INSTALL_DIR) - endif --LIBPNG_CFLAGS += -I$(LIBPNG_PATH)/ --CAIRO_LIBS += $(LIBPNG_PATH)/libpng.lib -+LIBPNG_CFLAGS += -I$(LIBPNG_PATH)/include -+CAIRO_LIBS += $(LIBPNG_PATH)/lib/libpng16.lib - endif - - ifeq ($(CAIRO_HAS_PS_SURFACE)$(CAIRO_HAS_PDF_SURFACE),00) - else - ifeq ($(ZLIB_PATH),) --ZLIB_PATH := $(top_builddir)/../zlib -+ZLIB_PATH := $(INSTALL_DIR) -+endif -+ZLIB_CFLAGS += -I$(ZLIB_PATH)/include -+CAIRO_LIBS += $(ZLIB_PATH)/lib/zlib1.lib -+endif -+ -+ifeq ($(CAIRO_HAS_FT_FONT),1) -+ifeq ($(FREETYPE_PATH),) -+FREETYPE_PATH := $(INSTALL_DIR) -+endif -+FREETYPE_CFLAGS += -I$(FREETYPE_PATH)/include -+CAIRO_LIBS += $(FREETYPE_PATH)/lib/freetype.lib -+endif -+ -+ifeq ($(CAIRO_HAS_FC_FONT),1) -+ifeq ($(FONTCONFIG_PATH),) -+FONTCONFIG_PATH := $(INSTALL_DIR) -+endif -+FONTCONFIG_CFLAGS += -I$(FONTCONFIG_PATH)/include -+CAIRO_LIBS += $(FONTCONFIG_PATH)/lib/fontconfig.lib -+endif -+ -+ifeq ($(CAIRO_HAS_GOBJECT_FUNCTIONS),1) -+ifeq ($(GOBJECT_PATH),) -+GOBJECT_PATH := $(INSTALL_DIR) - endif --ZLIB_CFLAGS += -I$(ZLIB_PATH)/ --CAIRO_LIBS += $(ZLIB_PATH)/zdll.lib -+GOBJECT_CFLAGS := -I$(GOBJECT_PATH)/include/glib-2.0 -I$(GOBJECT_PATH)/lib/glib-2.0/include -+GOBJECT_LIBS := $(GOBJECT_PATH)/lib/glib-2.0.lib $(GOBJECT_PATH)/lib/gobject-2.0.lib - endif - - DEFAULT_CFLAGS = -nologo $(CFG_CFLAGS) - DEFAULT_CFLAGS += -I. -I$(top_srcdir) -I$(top_srcdir)/src --DEFAULT_CFLAGS += $(PIXMAN_CFLAGS) $(LIBPNG_CFLAGS) $(ZLIB_CFLAGS) -+DEFAULT_CFLAGS += $(PIXMAN_CFLAGS) $(LIBPNG_CFLAGS) $(ZLIB_CFLAGS) $(FREETYPE_CFLAGS) $(FONTCONFIG_CFLAGS) - - CAIRO_CFLAGS = $(DEFAULT_CFLAGS) $(CFLAGS) - -diff --git a/build/Makefile.win32.features b/build/Makefile.win32.features -index 8cb155d..db3f0ac 100644 ---- a/build/Makefile.win32.features -+++ b/build/Makefile.win32.features -@@ -26,16 +26,17 @@ CAIRO_HAS_EGL_FUNCTIONS=0 - CAIRO_HAS_GLX_FUNCTIONS=0 - CAIRO_HAS_WGL_FUNCTIONS=0 - CAIRO_HAS_SCRIPT_SURFACE=1 --CAIRO_HAS_FT_FONT=0 --CAIRO_HAS_FC_FONT=0 -+CAIRO_HAS_FT_FONT=1 -+CAIRO_HAS_FC_FONT=1 - CAIRO_HAS_PS_SURFACE=1 - CAIRO_HAS_PDF_SURFACE=1 - CAIRO_HAS_SVG_SURFACE=1 - CAIRO_HAS_TEST_SURFACES=0 --CAIRO_HAS_TEE_SURFACE=0 --CAIRO_HAS_XML_SURFACE=0 -+CAIRO_HAS_TEE_SURFACE=1 -+CAIRO_HAS_XML_SURFACE=1 - CAIRO_HAS_PTHREAD=0 --CAIRO_HAS_GOBJECT_FUNCTIONS=0 --CAIRO_HAS_TRACE=0 -+CAIRO_HAS_GOBJECT_FUNCTIONS=1 -+CAIRO_HAS_TRACE=1 - CAIRO_HAS_INTERPRETER=1 - CAIRO_HAS_SYMBOL_LOOKUP=0 -+CAIRO_HAS_IMAGE_SURFACE=1 -diff --git a/util/cairo-gobject/Makefile.win32 b/util/cairo-gobject/Makefile.win32 -new file mode 100644 -index 0000000..1f63511 ---- /dev/null -+++ b/util/cairo-gobject/Makefile.win32 -@@ -0,0 +1,24 @@ -+top_srcdir = ../.. -+include $(top_srcdir)/build/Makefile.win32.common -+ -+CAIRO_LIB = $(top_srcdir)/src/$(CFG)/cairo.lib -+SOURCES = \ -+ cairo-gobject-enums.c \ -+ cairo-gobject-structs.c -+ -+OBJECTS = $(patsubst %.c, $(CFG)/%.obj, $(SOURCES)) -+ -+dynamic: inform $(CFG)/cairo-gobject.dll -+ -+$(CFG)/%.obj: %.c $(top_srcdir)/src/cairo-features.h -+ @mkdir -p $(CFG)/`dirname $<` -+ @$(CC) $(CAIRO_CFLAGS) $(GOBJECT_CFLAGS) -c -Fo"$@" $< -+ -+$(CFG)/cairo-gobject.dll: $(OBJECTS) -+ @$(LD) $(CAIRO_LDFLAGS) $(GOBJECT_LDFLAGS) -DLL -OUT:$@ $(CAIRO_LIB) $(GOBJECT_LIBS) $(OBJECTS) -+ -+all: inform $(CFG)/cairo-gobject.dll -+ @echo "Built successfully!" -+ @echo "You should copy the following files to a proper place now:" -+ @echo "" -+ @echo " util/cairo-gobject/$(CFG)/cairo-gobject.dll" --- -2.9.3 - diff --git a/recipes/cairo/all/patches/1.18.0-msvc-alloca.patch b/recipes/cairo/all/patches/1.18.0-msvc-alloca.patch new file mode 100644 index 0000000000000..3be0a4002a73e --- /dev/null +++ b/recipes/cairo/all/patches/1.18.0-msvc-alloca.patch @@ -0,0 +1,28 @@ +From 27cdee5e4cf19e7959b80fe1a39e61188de1b654 Mon Sep 17 00:00:00 2001 +From: Dan Yeaw +Date: Sat, 30 Sep 2023 13:30:51 -0400 +Subject: [PATCH] Fix alloca undefined with MSVC + +Conditionally includes malloc.h when compiling with +MSVC so that alloca is defined. +--- + src/cairo-colr-glyph-render.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/cairo-colr-glyph-render.c b/src/cairo-colr-glyph-render.c +index 28254fd51..a9ad84bbf 100644 +--- a/src/cairo-colr-glyph-render.c ++++ b/src/cairo-colr-glyph-render.c +@@ -43,6 +43,10 @@ + #include + #include + ++#ifdef _MSC_VER ++#include ++#endif ++ + #if HAVE_FT_COLR_V1 + + #include +-- +GitLab diff --git a/recipes/cairo/meson/patches/cairo-1.17.4-encoding-backport.patch b/recipes/cairo/all/patches/cairo-1.17.4-encoding-backport.patch similarity index 100% rename from recipes/cairo/meson/patches/cairo-1.17.4-encoding-backport.patch rename to recipes/cairo/all/patches/cairo-1.17.4-encoding-backport.patch diff --git a/recipes/cairo/meson/patches/cairo-1.17.4-symbol-lookup-backport.patch b/recipes/cairo/all/patches/cairo-1.17.4-symbol-lookup-backport.patch similarity index 100% rename from recipes/cairo/meson/patches/cairo-1.17.4-symbol-lookup-backport.patch rename to recipes/cairo/all/patches/cairo-1.17.4-symbol-lookup-backport.patch diff --git a/recipes/cairo/meson/patches/cairo-1.17.4-trace-cflags-fix.patch b/recipes/cairo/all/patches/cairo-1.17.4-trace-cflags-fix.patch similarity index 100% rename from recipes/cairo/meson/patches/cairo-1.17.4-trace-cflags-fix.patch rename to recipes/cairo/all/patches/cairo-1.17.4-trace-cflags-fix.patch diff --git a/recipes/cairo/meson/patches/cairo-1.17.4-xlib-xrender-option.patch b/recipes/cairo/all/patches/cairo-1.17.4-xlib-xrender-option.patch similarity index 100% rename from recipes/cairo/meson/patches/cairo-1.17.4-xlib-xrender-option.patch rename to recipes/cairo/all/patches/cairo-1.17.4-xlib-xrender-option.patch diff --git a/recipes/cairo/all/test_package/CMakeLists.txt b/recipes/cairo/all/test_package/CMakeLists.txt index bed5cd67420b6..83adc4effa23e 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) +cmake_minimum_required(VERSION 3.15) 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..91630d79f4abb --- /dev/null +++ b/recipes/cairo/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/cairo/meson/test_v1_package/conanfile.py b/recipes/cairo/all/test_v1_package/conanfile.py similarity index 100% rename from recipes/cairo/meson/test_v1_package/conanfile.py rename to recipes/cairo/all/test_v1_package/conanfile.py diff --git a/recipes/cairo/config.yml b/recipes/cairo/config.yml index fcad6cea70952..ec5b451e74c04 100644 --- a/recipes/cairo/config.yml +++ b/recipes/cairo/config.yml @@ -1,7 +1,9 @@ versions: - "1.16.0": + "1.18.0": folder: all - "1.17.2": + "1.17.8": + folder: all + "1.17.6": folder: all "1.17.4": - folder: meson + folder: all diff --git a/recipes/cairo/meson/conandata.yml b/recipes/cairo/meson/conandata.yml deleted file mode 100644 index b5df6a0c87d1c..0000000000000 --- a/recipes/cairo/meson/conandata.yml +++ /dev/null @@ -1,33 +0,0 @@ -sources: - "1.17.4": - 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" - 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" - 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" - 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" - 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" - 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 deleted file mode 100644 index 3871b067363f2..0000000000000 --- a/recipes/cairo/meson/conanfile.py +++ /dev/null @@ -1,366 +0,0 @@ -import glob -import os - -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, - 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.52.0" - - -class CairoConan(ConanFile): - name = "cairo" - description = "Cairo is a 2D graphics library with support for multiple output devices" - topics = ("cairo", "graphics") - url = "https://github.com/conan-io/conan-center-index" - homepage = "https://cairographics.org/" - license = ("LGPL-2.1-only", "MPL-1.1") - settings = "os", "arch", "compiler", "build_type" - options = { - "shared": [True, False], - "fPIC": [True, False], - "with_freetype": [True, False], - "with_fontconfig": [True, False], - "with_xlib": [True, False], - "with_xlib_xrender": [True, False], - "with_xcb": [True, False], - "with_glib": [True, False], - "with_lzo": [True, False], - "with_zlib": [True, False], - "with_png": [True, False], - "with_opengl": [False, "desktop", "gles2", "gles3"], - "with_symbol_lookup": [True, False], - "tee": [True, False], - } - default_options = { - "shared": False, - "fPIC": True, - "with_freetype": True, - "with_fontconfig": True, - "with_xlib": True, - "with_xlib_xrender": True, - "with_xcb": True, - "with_glib": True, - "with_lzo": True, - "with_zlib": True, - "with_png": True, - "with_opengl": "desktop", - "with_symbol_lookup": False, - "tee": True, - } - short_paths = True - - @property - def _settings_build(self): - return getattr(self, "settings_build", self.settings) - - def layout(self): - basic_layout(self, src_folder="src") - - 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 - if self.settings.os != "Linux": - del self.options.with_xlib - del self.options.with_xlib_xrender - del self.options.with_xcb - del self.options.with_symbol_lookup - if self.settings.os in ["Macos", "Windows"]: - del self.options.with_opengl - - def configure(self): - if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx - if self.options.with_glib and self.options.shared: - self.options["glib"].shared = True - - def requirements(self): - self.requires("pixman/0.40.0") - if self.options.with_zlib and self.options.with_png: - self.requires("expat/2.4.9") - if self.options.with_lzo: - self.requires("lzo/2.10") - if self.options.with_zlib: - 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.38") - if self.options.with_glib: - self.requires("glib/2.74.0") - 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_opengl") == "desktop": - self.requires("opengl/system") - if self.settings.os == "Windows": - self.requires("glext/cci.20210420") - self.requires("wglext/cci.20200813") - self.requires("khrplatform/cci.20200529") - 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.3") - self.tool_requires("pkgconf/1.9.3") - - 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 is_msvc_static_runtime(self): - raise ConanInvalidConfiguration( - "Linking shared glib with the MSVC static runtime is not supported" - ) - elif self.options.shared: - raise ConanInvalidConfiguration( - "Linking a shared library against static glib can cause unexpected behaviour." - ) - - def generate(self): - def is_enabled(value): - return "enabled" if value else "disabled" - - pkg_deps = PkgConfigDeps(self) - pkg_deps.generate() - - 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": - options["xcb"] = is_enabled(self.options.with_xcb) - options["xlib"] = is_enabled(self.options.with_xlib) - options["xlib-xrender"] = is_enabled(self.options.with_xlib_xrender) - else: - options["xcb"] = "disabled" - options["xlib"] = "disabled" - if self.options.get_safe("with_opengl") == "desktop": - options["gl-backend"] = "gl" - elif self.options.get_safe("with_opengl") == "gles2": - options["gl-backend"] = "glesv2" - elif self.options.get_safe("with_opengl") == "gles3": - options["gl-backend"] = "glesv3" - else: - 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 - 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 - 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() - - env = VirtualBuildEnv(self) - env.generate() - - 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) - - # Dependency freetype2 found: NO found 2.11.0 but need: '>= 9.7.3' - if self.options.with_freetype: - replace_in_file(self, os.path.join(self.source_folder, "meson.build"), - "freetype_required_version = '>= 9.7.3'", - f"freetype_required_version = '>= {self.deps_cpp_info['freetype'].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): - 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")) - - def package_info(self): - base_requirements = {"pixman::pixman"} - base_system_libs = {} - - 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: - self.cpp_info.components[component].system_libs += system_libs - 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")) - - if self.settings.os == "Linux": - self.cpp_info.components["cairo_"].system_libs.extend(["m", "dl", "pthread"]) - if self.options.get_safe("with_symbol_lookup"): - self.cpp_info.components["cairo_"].system_libs.append("bfd") - self.cpp_info.components["cairo_"].cflags = ["-pthread"] - self.cpp_info.components["cairo_"].cxxflags = ["-pthread"] - - if self.options.with_lzo: - self.cpp_info.components["cairo_"].requires.append("lzo::lzo") - - if self.options.with_zlib: - self.cpp_info.components["cairo_"].requires.append("zlib::zlib") - - if self.options.with_png: - add_component_and_base_requirements("cairo-png", ["libpng::libpng"]) - add_component_and_base_requirements("cairo-svg", ["libpng::libpng"]) - - if self.options.with_fontconfig: - add_component_and_base_requirements("cairo-fc", ["fontconfig::fontconfig"]) - - if self.options.with_freetype: - add_component_and_base_requirements("cairo-ft", ["freetype::freetype"]) - - if self.options.get_safe("with_xlib"): - add_component_and_base_requirements("cairo-xlib", ["xorg::x11", "xorg::xext"]) - - if self.options.get_safe("with_xlib_xrender"): - add_component_and_base_requirements("cairo-xlib-xrender", ["xorg::xrender"]) - - if self.options.get_safe("with_xcb"): - add_component_and_base_requirements("cairo-xcb", ["xorg::xcb", "xorg::xcb-render"]) - add_component_and_base_requirements("cairo-xcb-shm", ["xorg::xcb", "xorg::xcb-shm"]) - - if self.options.get_safe("with_xlib"): - add_component_and_base_requirements("cairo-xlib-xcb", ["xorg::x11-xcb"]) - - 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 += ["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"]) - - if not self.options.shared: - self.cpp_info.components["cairo_"].defines.append("CAIRO_WIN32_STATIC_BUILD=1") - - if self.options.get_safe("with_opengl"): - if self.options.with_opengl == "desktop": - add_component_and_base_requirements("cairo-gl", ["opengl::opengl"]) - - if self.settings.os == "Linux": - add_component_and_base_requirements("cairo-glx", ["opengl::opengl"]) - - if self.settings.os == "Windows": - add_component_and_base_requirements("cairo-wgl", ["glext::glext", "wglext::wglext", "khrplatform::khrplatform"]) - - elif self.options.with_opengl == "gles3": - add_component_and_base_requirements("cairo-glesv3", [], ["GLESv2"]) - elif self.options.with_opengl == "gles2": - add_component_and_base_requirements("cairo-glesv2", [], ["GLESv2"]) - if self.settings.os in ["Linux", "FreeBSD"]: - add_component_and_base_requirements("cairo-egl", ["egl::egl"]) - - if self.options.with_zlib: - add_component_and_base_requirements("cairo-script", ["zlib::zlib"]) - 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_"] - - if self.options.with_png: - add_component_and_base_requirements("cairo-xml", ["zlib::zlib"]) - add_component_and_base_requirements("cairo-util_", ["expat::expat"]) - - 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/patches/binutils-2.34-libbfd-fix.patch b/recipes/cairo/meson/patches/binutils-2.34-libbfd-fix.patch deleted file mode 100644 index 197f3fbc3cad0..0000000000000 --- a/recipes/cairo/meson/patches/binutils-2.34-libbfd-fix.patch +++ /dev/null @@ -1,43 +0,0 @@ -The libbfd issues were fixed in upstream with following commit: - - From e30259f6237571c61992433c110bc6e1ef900244 Mon Sep 17 00:00:00 2001 - From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= - Date: Tue, 23 Feb 2021 11:36:24 +0000 - Subject: cairo-trace: fix build with newer versions of bfd - - https://cgit.freedesktop.org/cairo/commit/?id=e30259f6237571c61992433c110bc6e1ef900244 - -Note that the upstream commit was more comprehensive, but cannot be directly -applied to 1.17.4 version. Any new cairo version beyond 1.17.4 will likely -not need this fix. - ---- lookup-symbol.c.original 2021-08-05 22:21:15.819998378 +0300 -+++ lookup-symbol.c 2021-08-05 22:26:05.212448342 +0300 -@@ -145,14 +145,26 @@ - if (symbol->found) - return; - -+#ifdef bfd_get_section_flags - if ((bfd_get_section_flags (symtab->bfd, section) & SEC_ALLOC) == 0) -+#else -+ if ((bfd_section_flags (section) & SEC_ALLOC) == 0) -+#endif - return; - -+#ifdef bfd_get_section_vma - vma = bfd_get_section_vma (symtab->bfd, section); -+#else -+ vma = bfd_section_vma (section); -+#endif - if (symbol->pc < vma) - return; - -- size = bfd_section_size (symtab->bfd, section); -+#ifdef bfd_get_section_size -+ size = bfd_get_section_size (section); -+#else -+ size = bfd_section_size (section); -+#endif - if (symbol->pc >= vma + size) - return; - diff --git a/recipes/cairo/meson/test_package/CMakeLists.txt b/recipes/cairo/meson/test_package/CMakeLists.txt deleted file mode 100644 index 4f33d55898eb2..0000000000000 --- a/recipes/cairo/meson/test_package/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1.2) -project(test_package C) - -find_package(cairo CONFIG REQUIRED) - -add_executable(${PROJECT_NAME} test_package.c) -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 deleted file mode 100644 index e904c93b97465..0000000000000 --- a/recipes/cairo/meson/test_package/conanfile.py +++ /dev/null @@ -1,26 +0,0 @@ -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 = "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/cairo/meson/test_package/test_package.c b/recipes/cairo/meson/test_package/test_package.c deleted file mode 100644 index 5854291cea177..0000000000000 --- a/recipes/cairo/meson/test_package/test_package.c +++ /dev/null @@ -1,36 +0,0 @@ -#include -#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/meson/test_v1_package/CMakeLists.txt b/recipes/cairo/meson/test_v1_package/CMakeLists.txt deleted file mode 100644 index 692a4909c85a7..0000000000000 --- a/recipes/cairo/meson/test_v1_package/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -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/cairomm/all/conandata.yml b/recipes/cairomm/all/conandata.yml index e9529d1b4235f..9763146e05947 100644 --- a/recipes/cairomm/all/conandata.yml +++ b/recipes/cairomm/all/conandata.yml @@ -1,15 +1,13 @@ sources: - "1.16.1": - url: "https://cairographics.org/releases/cairomm-1.16.1.tar.xz" - sha256: "6f6060d8e98dd4b8acfee2295fddbdd38cf487c07c26aad8d1a83bb9bff4a2c6" - "1.14.3": - url: "https://cairographics.org/releases/cairomm-1.14.3.tar.xz" - sha256: "0d37e067c5c4ca7808b7ceddabfe1932c5bd2a750ad64fb321e1213536297e78" - -patches: - "1.16.1": - - patch_file: "patches/enable_static_lib_1_16_1.patch" - base_path: "source_subfolder" - "1.14.3": - - patch_file: "patches/enable_static_lib_1_14_3.patch" - base_path: "source_subfolder" + "1.18.0": + url: "https://cairographics.org/releases/cairomm-1.18.0.tar.xz" + sha256: "b81255394e3ea8e8aa887276d22afa8985fc8daef60692eb2407d23049f03cfb" + "1.17.1": + url: "https://cairographics.org/releases/cairomm-1.17.1.tar.xz" + sha256: "343e8463ff7dd4d2c90991d6284a2203431e711026575207fd4c313cd323fdbe" + "1.16.2": + url: "https://cairographics.org/releases/cairomm-1.16.2.tar.xz" + sha256: "6a63bf98a97dda2b0f55e34d1b5f3fb909ef8b70f9b8d382cb1ff3978e7dc13f" + "1.14.5": + url: "https://cairographics.org/releases/cairomm-1.14.5.tar.xz" + sha256: "70136203540c884e89ce1c9edfb6369b9953937f6cd596d97c78c9758a5d48db" diff --git a/recipes/cairomm/all/conanfile.py b/recipes/cairomm/all/conanfile.py index 8a403a49b992b..4380e40cd818e 100644 --- a/recipes/cairomm/all/conanfile.py +++ b/recipes/cairomm/all/conanfile.py @@ -1,20 +1,30 @@ -from conans import ConanFile, Meson, tools -from conan.tools.files import rename -from conan.tools.microsoft import is_msvc -from conans.errors import ConanInvalidConfiguration import glob import os import shutil +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 check_min_cppstd, cross_building +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import copy, 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 +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" + class CairommConan(ConanFile): name = "cairomm" - homepage = "https://github.com/freedesktop/cairomm" - url = "https://github.com/conan-io/conan-center-index" - license = "LGPL-2.0" description = "cairomm is a C++ wrapper for the cairo graphics library." + license = "LGPL-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://www.cairographics.org/cairomm/" topics = ["cairo", "wrapper", "graphics"] - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -25,47 +35,13 @@ class CairommConan(ConanFile): "fPIC": True, } - generators = "pkg_config" - exports_sources = "patches/**" - short_paths = True - - def _abi_version(self): - return "1.16" if tools.Version(self.version) >= "1.16.0" else "1.0" - - 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"): - if self._abi_version() == "1.16": - tools.check_min_cppstd(self, 17) - else: - tools.check_min_cppstd(self, 11) - if self.options.shared and not self.options["cairo"].shared: - raise ConanInvalidConfiguration( - "Linking against static cairo would cause shared cairomm to link " - "against static glib which can cause problems." - ) - @property - def _source_subfolder(self): - return "source_subfolder" + def _abi_version(self): + return "1.16" if Version(self.version) >= "1.16.0" else "1.0" @property - def _build_subfolder(self): - return "build_subfolder" - - def _patch_sources(self): - for patch in self.conan_data["patches"][self.version]: - tools.patch(**patch) - if is_msvc(self): - # when using cpp_std=c++11 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 - tools.replace_in_file( - os.path.join(self._source_subfolder, "meson.build"), - "cpp_std=c++", "cpp_std=vc++") + def _min_cppstd(self): + return 17 if self._abi_version == "1.16" else 11 def config_options(self): if self.settings.os == "Windows": @@ -73,122 +49,106 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") if self.options.shared: self.options["cairo"].shared = True - def build_requirements(self): - self.build_requires("meson/0.59.1") - self.build_requires("pkgconf/1.7.4") + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - self.requires("cairo/1.17.4") - - if self._abi_version() == "1.16": - self.requires("libsigcpp/3.0.7") + self.requires("cairo/1.18.0", transitive_headers=True, transitive_libs=True) + self.requires("fontconfig/2.15.0", transitive_headers=True, transitive_libs=True) + if self._abi_version == "1.16": + self.requires("libsigcpp/3.0.7", transitive_headers=True, transitive_libs=True) else: - self.requires("libsigcpp/2.10.8") + self.requires("libsigcpp/2.10.8", transitive_headers=True, transitive_libs=True) - def source(self): - tools.get( - **self.conan_data["sources"][self.version], - strip_root=True, - destination=self._source_subfolder, - ) + def validate(self): + if hasattr(self, "settings_build") and cross_building(self): + raise ConanInvalidConfiguration("Cross-building not implemented") + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + if self.options.shared and not self.dependencies["cairo"].options.shared: + raise ConanInvalidConfiguration( + "Linking against static cairo would cause shared cairomm to link " + "against static glib which can cause problems." + ) - def build(self): - self._patch_sources() - with tools.environment_append(tools.RunEnvironment(self).vars): - meson = self._configure_meson() - meson.build() + def build_requirements(self): + self.tool_requires("meson/1.4.0") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/2.1.0") - def _configure_meson(self): - meson = Meson(self) - defs = { + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + tc = PkgConfigDeps(self) + tc.generate() + tc = MesonToolchain(self) + tc.project_options = { "build-examples": "false", "build-documentation": "false", "build-tests": "false", "msvc14x-parallel-installable": "false", "default_library": "shared" if self.options.shared else "static", + "libdir": "lib", } - meson.configure( - defs=defs, - build_folder=self._build_subfolder, - source_folder=self._source_subfolder, - pkg_config_paths=[self.install_folder], - ) - return meson + if not self.options.shared: + tc.preprocessor_definitions["CAIROMM_STATIC_LIB"] = "1" + tc.generate() + + def _patch_sources(self): + if is_msvc(self): + # when using cpp_std=c++11 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 + replace_in_file(self, os.path.join(self.source_folder, "meson.build"), + "cpp_std=c++", + "cpp_std=vc++") + + def build(self): + self._patch_sources() + meson = Meson(self) + meson.configure() + meson.build() def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - meson = self._configure_meson() + copy(self, "COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + meson = Meson(self) meson.install() if is_msvc(self): - tools.remove_files_by_mask( - os.path.join(self.package_folder, "bin"), "*.pdb") + rm(self, "*.pdb", os.path.join(self.package_folder, "bin"), recursive=True) if not self.options.shared: - rename( - self, - os.path.join( - self.package_folder, - "lib", - f"libcairomm-{self._abi_version()}.a", - ), - os.path.join(self.package_folder, "lib", - f"cairomm-{self._abi_version()}.lib"), - ) + rename(self, + os.path.join(self.package_folder, "lib", f"libcairomm-{self._abi_version}.a"), + os.path.join(self.package_folder, "lib", f"cairomm-{self._abi_version}.lib")) for header_file in glob.glob( - os.path.join( - self.package_folder, - "lib", - f"cairomm-{self._abi_version()}", - "include", - "*.h", - )): + os.path.join(self.package_folder, "lib", f"cairomm-{self._abi_version}", "include", "*.h") + ): shutil.move( header_file, - os.path.join( - self.package_folder, - "include", - f"cairomm-{self._abi_version()}", - os.path.basename(header_file), - ), + os.path.join(self.package_folder, "include", f"cairomm-{self._abi_version}", os.path.basename(header_file)), ) - for dir_to_remove in ["pkgconfig", f"cairomm-{self._abi_version()}"]: - tools.rmdir(os.path.join(self.package_folder, "lib", - dir_to_remove)) + for dir_to_remove in ["pkgconfig", f"cairomm-{self._abi_version}"]: + rmdir(self, os.path.join(self.package_folder, "lib", dir_to_remove)) + + fix_apple_shared_install_name(self) def package_info(self): - if self._abi_version() == "1.16": - self.cpp_info.components["cairomm-1.16"].names[ - "pkg_config"] = "cairomm-1.16" - self.cpp_info.components["cairomm-1.16"].includedirs = [ - os.path.join("include", "cairomm-1.16") - ] - self.cpp_info.components["cairomm-1.16"].libs = ["cairomm-1.16"] - self.cpp_info.components["cairomm-1.16"].requires = [ - "libsigcpp::sigc++", "cairo::cairo_" - ] - if tools.is_apple_os(self.settings.os): - self.cpp_info.components["cairomm-1.16"].frameworks = [ - "CoreFoundation" - ] - else: - self.cpp_info.components["cairomm-1.0"].names[ - "pkg_config"] = "cairomm-1.0" - self.cpp_info.components["cairomm-1.0"].includedirs = [ - os.path.join("include", "cairomm-1.0") - ] - self.cpp_info.components["cairomm-1.0"].libs = ["cairomm-1.0"] - self.cpp_info.components["cairomm-1.0"].requires = [ - "libsigcpp::sigc++-2.0", "cairo::cairo_" - ] - if tools.is_apple_os(self.settings.os): - self.cpp_info.components["cairomm-1.0"].frameworks = [ - "CoreFoundation" - ] - - def package_id(self): - self.info.requires["cairo"].full_package_mode() + name = f"cairomm-{self._abi_version}" + self.cpp_info.components[name].set_property("pkg_config_name", name) + self.cpp_info.components[name].includedirs = [os.path.join("include", name)] + self.cpp_info.components[name].libs = [name] + self.cpp_info.components[name].requires = ["libsigcpp::libsigcpp", "cairo::cairo", "fontconfig::fontconfig"] + if not self.options.shared: + self.cpp_info.components[name].defines = ["CAIROMM_STATIC_LIB"] + if is_apple_os(self): + self.cpp_info.components[name].frameworks = ["CoreFoundation"] diff --git a/recipes/cairomm/all/patches/enable_static_lib_1_14_3.patch b/recipes/cairomm/all/patches/enable_static_lib_1_14_3.patch deleted file mode 100644 index f5fcae443d2f0..0000000000000 --- a/recipes/cairomm/all/patches/enable_static_lib_1_14_3.patch +++ /dev/null @@ -1,37 +0,0 @@ -commit 04b20b02cc0ff18f71da693cf2d89709adabd297 -Author: Hesham Essam -Date: Fri May 6 21:26:01 2022 +0200 - - Enable static builds with msvc - - Cairomm exports dll symbols if the macro CAIROMM_STATIC_LIB is not - defined. This patch defines this macro in case of static builds. - -diff --git a/cairommconfig.h.meson b/cairommconfig.h.meson -index 2988edc..b9e5c21 100644 ---- a/cairommconfig.h.meson -+++ b/cairommconfig.h.meson -@@ -18,6 +18,9 @@ - /* Micro version number of cairomm. */ - #mesondefine CAIROMM_MICRO_VERSION - -+/* Define if cairomm is built as a static library */ -+#mesondefine CAIROMM_STATIC_LIB -+ - /* Enable DLL-specific stuff only when not building a static library */ - #if !defined(__CYGWIN__) && \ - (defined(__MINGW32__) || defined (_MSC_VER)) && \ -diff --git a/meson.build b/meson.build -index e130814..54c8d4f 100644 ---- a/meson.build -+++ b/meson.build -@@ -244,6 +244,9 @@ endif - if build_exceptions_api - mm_conf_data.set('CAIROMM_EXCEPTIONS_ENABLED', 1) - endif -+if get_option('default_library') == 'static' -+ mm_conf_data.set('CAIROMM_STATIC_LIB', 1) -+endif - mm_conf_data.set('CAIROMM_MAJOR_VERSION', cairomm_major_version) - mm_conf_data.set('CAIROMM_MINOR_VERSION', cairomm_minor_version) - mm_conf_data.set('CAIROMM_MICRO_VERSION', cairomm_micro_version) diff --git a/recipes/cairomm/all/patches/enable_static_lib_1_16_1.patch b/recipes/cairomm/all/patches/enable_static_lib_1_16_1.patch deleted file mode 100644 index 5d6cd671de960..0000000000000 --- a/recipes/cairomm/all/patches/enable_static_lib_1_16_1.patch +++ /dev/null @@ -1,38 +0,0 @@ -commit cd43f2e55de6db57e561989e7f6ad3765e1d4971 -Author: Hesham Essam -Date: Fri May 6 21:35:47 2022 +0200 - - Enable static builds with msvc - - Cairomm exports dll symbols if the macro CAIROMM_STATIC_LIB is not - defined. This patch defines this macro in case of static builds. - -diff --git a/cairommconfig.h.meson b/cairommconfig.h.meson -index 2988edc..b9e5c21 100644 ---- a/cairommconfig.h.meson -+++ b/cairommconfig.h.meson -@@ -18,6 +18,9 @@ - /* Micro version number of cairomm. */ - #mesondefine CAIROMM_MICRO_VERSION - -+/* Define if cairomm is built as a static library */ -+#mesondefine CAIROMM_STATIC_LIB -+ - /* Enable DLL-specific stuff only when not building a static library */ - #if !defined(__CYGWIN__) && \ - (defined(__MINGW32__) || defined (_MSC_VER)) && \ -diff --git a/meson.build b/meson.build -index 2c0c8bb..5259409 100644 ---- a/meson.build -+++ b/meson.build -@@ -247,6 +247,10 @@ endif - if build_exceptions_api - mm_conf_data.set('CAIROMM_EXCEPTIONS_ENABLED', 1) - endif -+if get_option('default_library') == 'static' -+ mm_conf_data.set('CAIROMM_STATIC_LIB', 1) -+endif -+ - mm_conf_data.set('CAIROMM_MAJOR_VERSION', cairomm_major_version) - mm_conf_data.set('CAIROMM_MINOR_VERSION', cairomm_minor_version) - mm_conf_data.set('CAIROMM_MICRO_VERSION', cairomm_micro_version) diff --git a/recipes/cairomm/all/test_package/CMakeLists.txt b/recipes/cairomm/all/test_package/CMakeLists.txt index 366e829c2704c..ede33192a05dc 100644 --- a/recipes/cairomm/all/test_package/CMakeLists.txt +++ b/recipes/cairomm/all/test_package/CMakeLists.txt @@ -1,16 +1,14 @@ -cmake_minimum_required(VERSION 3.6) -project(test_package) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGET) +find_package(cairomm REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) find_package(cairomm REQUIRED CONFIG) -if (TARGET cairomm::cairomm-1.16) +target_link_libraries(${PROJECT_NAME} cairomm::cairomm) +if (cairomm_VERSION VERSION_GREATER_EQUAL 1.6) set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17) - target_link_libraries(${PROJECT_NAME} cairomm::cairomm-1.16) else() set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) - target_link_libraries(${PROJECT_NAME} cairomm::cairomm-1.0) endif() diff --git a/recipes/cairomm/all/test_package/conanfile.py b/recipes/cairomm/all/test_package/conanfile.py index a691174f8ed16..ef5d7042163ec 100644 --- a/recipes/cairomm/all/test_package/conanfile.py +++ b/recipes/cairomm/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,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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cairomm/all/test_package/test_package.cpp b/recipes/cairomm/all/test_package/test_package.cpp index d802e56f01bd2..5033103959269 100644 --- a/recipes/cairomm/all/test_package/test_package.cpp +++ b/recipes/cairomm/all/test_package/test_package.cpp @@ -5,9 +5,8 @@ #include int main() { -#if CAIROMM_MINOR_VERSION == 16 - auto surface = - Cairo::ImageSurface::create(Cairo::Surface::Format::ARGB32, 600, 400); +#if CAIROMM_MINOR_VERSION >= 16 + auto surface = Cairo::ImageSurface::create(Cairo::Surface::Format::ARGB32, 600, 400); #else auto surface = Cairo::ImageSurface::create(Cairo::FORMAT_ARGB32, 600, 400); #endif diff --git a/recipes/cairomm/all/test_v1_package/CMakeLists.txt b/recipes/cairomm/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/cairomm/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/cairomm/all/test_v1_package/conanfile.py b/recipes/cairomm/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..a691174f8ed16 --- /dev/null +++ b/recipes/cairomm/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/cairomm/config.yml b/recipes/cairomm/config.yml index cc2573070ee79..debfb8cd30b0a 100644 --- a/recipes/cairomm/config.yml +++ b/recipes/cairomm/config.yml @@ -1,5 +1,9 @@ versions: - "1.16.1": + "1.18.0": folder: "all" - "1.14.3": + "1.17.1": + folder: "all" + "1.16.2": + folder: "all" + "1.14.5": folder: "all" diff --git a/recipes/cajun-jsonapi/all/conanfile.py b/recipes/cajun-jsonapi/all/conanfile.py index 55cd07447203f..4c40bccc4e945 100644 --- a/recipes/cajun-jsonapi/all/conanfile.py +++ b/recipes/cajun-jsonapi/all/conanfile.py @@ -1,34 +1,37 @@ 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.53.0" +required_conan_version = ">=1.50.0" class CajunJsonApiConan(ConanFile): name = "cajun-jsonapi" description = "CAJUN* is a C++ API for the JSON object interchange format." - topics = ("conan", "cajun", "json") + topics = ("cajun", "json") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/cajun-jsonapi/cajun-jsonapi" license = "BSD-3-Clause" + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True - 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 package_id(self): + self.info.clear() def validate(self): if self.settings.get_safe("compiler.cppstd"): check_min_cppstd(self, 11) + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + def _extract_license(self): file_content = load(self, os.path.join(self.source_folder, "test.cpp")) return ( @@ -82,8 +85,7 @@ def package(self): src=self.source_folder, ) - def package_id(self): - self.info.clear() - def package_info(self): + self.cpp_info.bindirs = [] self.cpp_info.includedirs.append(os.path.join("include", "cajun")) + self.cpp_info.libdirs = [] diff --git a/recipes/calceph/all/conandata.yml b/recipes/calceph/all/conandata.yml index f4d850c349cf0..ccee59129b991 100644 --- a/recipes/calceph/all/conandata.yml +++ b/recipes/calceph/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.5.5": + url: "https://www.imcce.fr/content/medias/recherche/equipes/asd/calceph/calceph-3.5.5.tar.gz" + sha256: "f7acf529a9267793126d7fdbdf79d4d26ae33274c99d09a9fc9d6191a3c72aca" "3.5.1": url: "https://www.imcce.fr/content/medias/recherche/equipes/asd/calceph/calceph-3.5.1.tar.gz" sha256: "33cc0be1b8ffb647aff9d3ac1cf025e460451e00144050d3bbc4f13bceb11c1d" diff --git a/recipes/calceph/all/conanfile.py b/recipes/calceph/all/conanfile.py index 2c626e956a387..cd9be15961cb0 100644 --- a/recipes/calceph/all/conanfile.py +++ b/recipes/calceph/all/conanfile.py @@ -1,21 +1,25 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, VisualStudioBuildEnvironment, tools -from conans.errors import ConanInvalidConfiguration -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 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): name = "calceph" 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") + license = ("CECILL-C", "CECILL-B", "CECILL-2.1") + topics = ("ephemeris", "astronomy", "space", "planet") homepage = "https://www.imcce.fr/inpop/calceph" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -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,93 @@ 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 + if self.settings.os == "Windows": + del self.options.shared + self.package_type = "static-library" + if self.options.get_safe("shared"): + 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("calceph doesn't support shared builds with Visual Studio yet") + 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) + 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/calceph/config.yml b/recipes/calceph/config.yml index 8843656f63225..6a2ba2d0468ee 100644 --- a/recipes/calceph/config.yml +++ b/recipes/calceph/config.yml @@ -1,4 +1,6 @@ versions: + "3.5.5": + folder: all "3.5.1": folder: all "3.5.0": diff --git a/recipes/canary/all/conanfile.py b/recipes/canary/all/conanfile.py index 1a102a8feb035..a8399d13089c4 100644 --- a/recipes/canary/all/conanfile.py +++ b/recipes/canary/all/conanfile.py @@ -3,7 +3,7 @@ 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.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout from conan.tools.files import copy, get, rmdir required_conan_version = ">=1.53.0" @@ -16,7 +16,7 @@ class SocketcanCanaryConan(ConanFile): license = "BSL-1.0" homepage = "https://github.com/djarek/canary" topics = ("socketcan", "can-bus", "can") - + package_type = "header-library" settings = "os", "compiler", "build_type", "arch" no_copy_source = True @@ -24,17 +24,23 @@ class SocketcanCanaryConan(ConanFile): def _min_cppstd(self): return 11 + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires("boost/1.74.0") + + def package_id(self): + self.info.clear() + 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -43,19 +49,19 @@ def generate(self): tc.generate() def build(self): - pass + cmake = CMake(self) + cmake.configure() + cmake.build() 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") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/canvas_ity/all/conanfile.py b/recipes/canvas_ity/all/conanfile.py index b4527ac4677c7..9b0e2c5ceee1d 100644 --- a/recipes/canvas_ity/all/conanfile.py +++ b/recipes/canvas_ity/all/conanfile.py @@ -14,6 +14,7 @@ class CanvasItyConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/a-e-k/canvas_ity" topics = ("rasterizer", "canvas", "2d", "header-only") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -24,7 +25,7 @@ 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 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..6ecc4845785b6 100644 --- a/recipes/capnproto/all/conandata.yml +++ b/recipes/capnproto/all/conandata.yml @@ -1,4 +1,19 @@ sources: + "1.0.2": + url: "https://github.com/capnproto/capnproto/archive/v1.0.2.tar.gz" + sha256: "3cfd0ed58080d78b3a3381305489f2175cdaf1ef1cb55425d8fc8246a76bdff3" + "1.0.1": + url: "https://github.com/capnproto/capnproto/archive/v1.0.1.tar.gz" + sha256: "5bdb16f6b389a9e29b04214b9bae1759e8b7fe2b45049d7e3f1f286ba050a200" + "1.0.0": + url: "https://github.com/capnproto/capnproto/archive/v1.0.0.tar.gz" + sha256: "bcd44dde78055313a7786cb6ab020cbef19b9045b53857f90cce101c9453f715" + "0.10.4": + url: "https://github.com/capnproto/capnproto/archive/v0.10.4.tar.gz" + sha256: "c6f25940688c87ddb24e0c4e475c3213d9b044aad2ba305439cc8c224f559da6" + "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" @@ -13,38 +28,79 @@ sources: sha256: "6d8b43a7ec2a764b4dfe4139a7cdd070ad9057f106898050d9f4db3754b98820" "0.7.0": url: "https://github.com/capnproto/capnproto/archive/v0.7.0.tar.gz" - sha256: 76c7114a3d142ad08b7208b3964a26e72a6320ee81331d3f0b87569fc9c47a28 + sha256: "76c7114a3d142ad08b7208b3964a26e72a6320ee81331d3f0b87569fc9c47a28" patches: + "1.0.2": + - patch_file: "patches/0015-disable-tests-for-1.0.0.patch" + patch_description: "disable test build" + patch_type: "conan" + "1.0.1": + - patch_file: "patches/0015-disable-tests-for-1.0.0.patch" + patch_description: "disable test build" + patch_type: "conan" + "1.0.0": + - patch_file: "patches/0015-disable-tests-for-1.0.0.patch" + patch_description: "disable test build" + patch_type: "conan" + "0.10.4": + - patch_file: "patches/0014-disable-tests-for-0.10.1.patch" + patch_description: "disable test build" + patch_type: "conan" + "0.10.3": + - patch_file: "patches/0014-disable-tests-for-0.10.1.patch" + patch_description: "disable test build" + patch_type: "conan" "0.10.1": - - patch_file: patches/0014-disable-tests-for-0.10.1.patch - base_path: source_subfolder + - patch_file: "patches/0014-disable-tests-for-0.10.1.patch" + patch_description: "disable test build" + patch_type: "conan" "0.10.0": - - patch_file: patches/0013-disable-tests-for-0.10.0.patch - base_path: source_subfolder + - patch_file: "patches/0013-disable-tests-for-0.10.0.patch" + patch_description: "disable test build" + patch_type: "conan" "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 + - patch_file: "patches/0010-disable-tests-for-0.9.1.patch" + patch_description: "disable test build" + patch_type: "conan" + - patch_file: "patches/0011-msvc-cpp17-hassubstring-fix-0.9.1.patch" + patch_description: "fix compilation errors on Windows Clang" + patch_type: "portability" + patch_source: "https://github.com/capnproto/capnproto/pull/1344" + - patch_file: "patches/0012-msvc-nogdi-fix-0.9.1.patch" + patch_description: "fix compilation error on Windows" + patch_type: "portability" + patch_source: "https://github.com/capnproto/capnproto/issues/1421" "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 + - patch_file: "patches/0001-disable-tests.patch" + patch_description: "disable test build" + patch_type: "conan" + - patch_file: "patches/0002-cmake-compat-header-install.patch" + patch_description: "fix compilation error for std::copy with list types" + patch_type: "portability" + patch_source: "https://github.com/capnproto/capnproto/pull/895" + - patch_file: "patches/0003-kj-tls-windows.patch" + patch_description: "add kj-tls target" + patch_type: "portability" + patch_source: "https://github.com/capnproto/capnproto/commit/7da6abf233fdf74a4ad4db56b6e98778b162dd7d" + - patch_file: "patches/0004-cmake-module-path.patch" + patch_description: "append cmake module path instead set" + patch_type: "conan" + - patch_file: "patches/0005-msvc-16.7-ice-workaround.patch" + patch_description: "Workaround for internal compiler error with msvc 16.7.x" + patch_type: "portability" + patch_source: "https://github.com/capnproto/capnproto/pull/1058" + - patch_file: "patches/0009-windows-symlink-fix-0.8.0.patch" + patch_description: "orkaround for install step on Windows where symlinks might be not supported." + patch_type: "portability" + patch_source: "https://github.com/capnproto/capnproto/pull/1240" "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 + - patch_file: "patches/0006-symlink.patch" + patch_description: "Fix capnpc extension handling on Windows" + patch_type: "portability" + patch_source: "https://github.com/capnproto/capnproto/pull/804" + - patch_file: "patches/0007-cmake-module-path.patch" + patch_description: "append cmake module path instead set" + patch_type: "conan" + - patch_file: "patches/0008-disable-tests.patch" + patch_description: "disable test build" + patch_type: "conan" diff --git a/recipes/capnproto/all/conanfile.py b/recipes/capnproto/all/conanfile.py index 4d5fd86b03ef9..591f5effa85d6 100644 --- a/recipes/capnproto/all/conanfile.py +++ b/recipes/capnproto/all/conanfile.py @@ -1,22 +1,29 @@ -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" - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -31,114 +38,120 @@ 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", - "gcc": "5", + "msvc": "191", + "gcc": "5" if Version(self.version) < "1.0.0" else "7", "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 <4]") if self.options.get_safe("with_zlib"): - self.requires("zlib/1.2.12") + self.requires("zlib/[>=1.2.11 <2]") 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") + # MSVC Release build is not supported in 1.0.0 + # https://github.com/capnproto/capnproto/issues/1740 + if Version(self.version) == "1.0.0" and is_msvc(self) and self.settings.build_type == "Release": + raise ConanInvalidConfiguration(f"{self.ref} doesn't support MSVC Release build") 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], 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 +159,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,58 +189,58 @@ 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) + @property + def _capnp_components(self): + def libm(): + return ["m"] if self.settings.os in ["Linux", "FreeBSD"] else [] + + def pthread(): + return ["pthread"] if self.settings.os in ["Linux", "FreeBSD"] else [] + + def ws2_32(): + return ["ws2_32"] if self.settings.os == "Windows" else [] + + components = { + "capnp": {"requires": ["kj"]}, + "capnp-json": {"requires": ["capnp", "kj"]}, + "capnp-rpc": {"requires": ["capnp", "kj", "kj-async"]}, + "capnpc": {"requires": ["capnp", "kj"], "system_libs": libm() + pthread()}, + "kj": {"system_libs": libm() + pthread()}, + "kj-async": {"requires": ["kj"], "system_libs": libm() + pthread() + ws2_32()}, + "kj-http": {"requires": ["kj", "kj-async"]}, + "kj-test": {"requires": ["kj"]}, + } + + if self.options.get_safe("with_zlib"): + components.update({"kj-gzip": {"requires": ["kj", "kj-async", "zlib::zlib"]}}) + if Version(self.version) >= "1.0.0": + components["kj-http"].setdefault("requires", []).append("zlib::zlib") + if self.options.with_openssl: + components.update({"kj-tls": {"requires": ["kj", "kj-async", "openssl::openssl"]}}) + if Version(self.version) >= "0.9.0": + components.update({"capnp-websocket": {"requires": ["capnp", "capnp-rpc", "kj-http", "kj-async", "kj"]}}) + + return components + def package_info(self): self.cpp_info.set_property("cmake_file_name", "CapnProto") capnprotomacros = os.path.join(self._cmake_folder, "CapnProtoMacros.cmake") self.cpp_info.set_property("cmake_build_modules", [capnprotomacros]) - components = [ - {"name": "capnp", "requires": ["kj"]}, - {"name": "capnp-json", "requires": ["capnp", "kj"]}, - {"name": "capnp-rpc", "requires": ["capnp", "kj", "kj-async"]}, - {"name": "capnpc", "requires": ["capnp", "kj"]}, - {"name": "kj", "requires": []}, - {"name": "kj-async", "requires": ["kj"]}, - {"name": "kj-http", "requires": ["kj", "kj-async"]}, - {"name": "kj-test", "requires": ["kj"]}, - ] - if self.options.get_safe("with_zlib"): - 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": - components.append({ - "name": "capnp-websocket", - "requires": ["capnp", "capnp-rpc", "kj-http", "kj-async", "kj"], - }) - - for component in components: - self._register_component(component) - - if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.components["capnpc"].system_libs = ["pthread"] - self.cpp_info.components["kj"].system_libs = ["pthread"] - self.cpp_info.components["kj-async"].system_libs = ["pthread"] - 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) + for name, comp_info in self._capnp_components.items(): + 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] + self.cpp_info.components[name].requires = comp_info.get("requires", []) + self.cpp_info.components[name].system_libs = comp_info.get("system_libs", []) # 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] - - 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].builddirs.append(self._cmake_folder) - self.cpp_info.components[name].set_property("pkg_config_name", name) - self.cpp_info.components[name].libs = [name] - self.cpp_info.components[name].requires = component["requires"] + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/capnproto/all/patches/0015-disable-tests-for-1.0.0.patch b/recipes/capnproto/all/patches/0015-disable-tests-for-1.0.0.patch new file mode 100644 index 0000000000000..38c9dd1ee414b --- /dev/null +++ b/recipes/capnproto/all/patches/0015-disable-tests-for-1.0.0.patch @@ -0,0 +1,176 @@ +diff --git a/c++/Makefile.am b/c++/Makefile.am +index 1567491..95ebc4a 100644 +--- a/c++/Makefile.am ++++ b/c++/Makefile.am +@@ -457,171 +457,4 @@ endif LITE_MODE + # src/capnp/benchmark/... + # src/capnp/compiler/... + +-# Tests ============================================================== +- +-test_capnpc_inputs = \ +- src/capnp/test.capnp \ +- src/capnp/test-import.capnp \ +- src/capnp/test-import2.capnp \ +- src/capnp/compat/json-test.capnp +- +-test_capnpc_outputs = \ +- src/capnp/test.capnp.c++ \ +- src/capnp/test.capnp.h \ +- src/capnp/test-import.capnp.c++ \ +- src/capnp/test-import.capnp.h \ +- src/capnp/test-import2.capnp.c++ \ +- src/capnp/test-import2.capnp.h \ +- src/capnp/compat/json-test.capnp.c++ \ +- src/capnp/compat/json-test.capnp.h +- +-if USE_EXTERNAL_CAPNP +- +-test_capnpc_middleman: $(test_capnpc_inputs) +- @$(MKDIR_P) src +- $(CAPNP) compile --src-prefix=$(srcdir)/src -o$(CAPNPC_CXX):src -I$(srcdir)/src $$(for FILE in $(test_capnpc_inputs); do echo $(srcdir)/$$FILE; done) +- touch test_capnpc_middleman + +-else +- +-test_capnpc_middleman: capnp$(EXEEXT) capnpc-c++$(EXEEXT) $(test_capnpc_inputs) +- @$(MKDIR_P) src +- ./capnp$(EXEEXT) compile --src-prefix=$(srcdir)/src -o./capnpc-c++$(EXEEXT):src -I$(srcdir)/src $$(for FILE in $(test_capnpc_inputs); do echo $(srcdir)/$$FILE; done) +- touch test_capnpc_middleman +- +-endif +- +-$(test_capnpc_outputs): test_capnpc_middleman +- +-BUILT_SOURCES = $(test_capnpc_outputs) +- +-check_LIBRARIES = libcapnp-test.a +-libcapnp_test_a_SOURCES = \ +- src/capnp/test-util.c++ \ +- src/capnp/test-util.h +-nodist_libcapnp_test_a_SOURCES = $(test_capnpc_outputs) +- +-if LITE_MODE +- +-check_PROGRAMS = capnp-test +-compiler_tests = +-capnp_test_LDADD = libcapnp-test.a libcapnp.la libkj-test.la libkj.la +- +-else !LITE_MODE +- +-check_PROGRAMS = capnp-test capnp-evolution-test capnp-afl-testcase +-if HAS_FUZZING_ENGINE +- check_PROGRAMS += capnp-llvm-fuzzer-testcase +-endif +-heavy_tests = \ +- src/kj/async-test.c++ \ +- src/kj/async-xthread-test.c++ \ +- src/kj/async-coroutine-test.c++ \ +- src/kj/async-unix-test.c++ \ +- src/kj/async-unix-xthread-test.c++ \ +- src/kj/async-win32-test.c++ \ +- src/kj/async-win32-xthread-test.c++ \ +- src/kj/async-io-test.c++ \ +- src/kj/async-queue-test.c++ \ +- src/kj/parse/common-test.c++ \ +- src/kj/parse/char-test.c++ \ +- src/kj/std/iostream-test.c++ \ +- src/kj/compat/url-test.c++ \ +- src/kj/compat/http-test.c++ \ +- $(MAYBE_KJ_GZIP_TESTS) \ +- $(MAYBE_KJ_TLS_TESTS) \ +- src/capnp/canonicalize-test.c++ \ +- src/capnp/capability-test.c++ \ +- src/capnp/membrane-test.c++ \ +- src/capnp/schema-test.c++ \ +- src/capnp/schema-loader-test.c++ \ +- src/capnp/schema-parser-test.c++ \ +- src/capnp/dynamic-test.c++ \ +- src/capnp/stringify-test.c++ \ +- src/capnp/serialize-async-test.c++ \ +- src/capnp/serialize-text-test.c++ \ +- src/capnp/rpc-test.c++ \ +- src/capnp/rpc-twoparty-test.c++ \ +- src/capnp/ez-rpc-test.c++ \ +- src/capnp/compat/json-test.c++ \ +- src/capnp/compat/websocket-rpc-test.c++ \ +- src/capnp/compiler/lexer-test.c++ \ +- src/capnp/compiler/type-id-test.c++ +-capnp_test_LDADD = \ +- libcapnp-test.a \ +- libcapnpc.la \ +- libcapnp-rpc.la \ +- libcapnp-websocket.la \ +- libcapnp-json.la \ +- libcapnp.la \ +- libkj-http.la \ +- $(MAYBE_KJ_GZIP_LA) \ +- $(MAYBE_KJ_TLS_LA) \ +- libkj-async.la \ +- libkj-test.la \ +- libkj.la \ +- $(ASYNC_LIBS) \ +- $(PTHREAD_LIBS) +- +-endif !LITE_MODE +- +-capnp_test_CPPFLAGS = -Wno-deprecated-declarations +-capnp_test_SOURCES = \ +- src/kj/common-test.c++ \ +- src/kj/memory-test.c++ \ +- src/kj/refcount-test.c++ \ +- src/kj/array-test.c++ \ +- src/kj/list-test.c++ \ +- src/kj/string-test.c++ \ +- src/kj/string-tree-test.c++ \ +- src/kj/table-test.c++ \ +- src/kj/map-test.c++ \ +- src/kj/encoding-test.c++ \ +- src/kj/exception-test.c++ \ +- src/kj/debug-test.c++ \ +- src/kj/arena-test.c++ \ +- src/kj/units-test.c++ \ +- src/kj/tuple-test.c++ \ +- src/kj/one-of-test.c++ \ +- src/kj/function-test.c++ \ +- src/kj/io-test.c++ \ +- src/kj/mutex-test.c++ \ +- src/kj/time-test.c++ \ +- src/kj/threadlocal-test.c++ \ +- src/kj/filesystem-test.c++ \ +- src/kj/filesystem-disk-test.c++ \ +- src/kj/test-test.c++ \ +- src/capnp/common-test.c++ \ +- src/capnp/blob-test.c++ \ +- src/capnp/endian-test.c++ \ +- src/capnp/endian-fallback-test.c++ \ +- src/capnp/endian-reverse-test.c++ \ +- src/capnp/layout-test.c++ \ +- src/capnp/any-test.c++ \ +- src/capnp/message-test.c++ \ +- src/capnp/encoding-test.c++ \ +- src/capnp/orphan-test.c++ \ +- src/capnp/serialize-test.c++ \ +- src/capnp/serialize-packed-test.c++ \ +- src/capnp/fuzz-test.c++ \ +- $(heavy_tests) +- +-if !LITE_MODE +-capnp_evolution_test_LDADD = libcapnpc.la libcapnp.la libkj.la +-capnp_evolution_test_SOURCES = src/capnp/compiler/evolution-test.c++ +- +-capnp_afl_testcase_LDADD = libcapnp-test.a libcapnp-rpc.la libcapnp.la libkj.la libkj-async.la +-capnp_afl_testcase_SOURCES = src/capnp/afl-testcase.c++ +- +-if HAS_FUZZING_ENGINE +- capnp_llvm_fuzzer_testcase_LDADD = libcapnp-test.a libcapnp-rpc.la libcapnp.la libkj.la libkj-async.la +- capnp_llvm_fuzzer_testcase_SOURCES = src/capnp/llvm-fuzzer-testcase.c++ +- capnp_llvm_fuzzer_testcase_LDFLAGS = $(LIB_FUZZING_ENGINE) +-endif +-endif !LITE_MODE +- +-if LITE_MODE +-TESTS = capnp-test +-else !LITE_MODE +-TESTS = capnp-test capnp-evolution-test src/capnp/compiler/capnp-test.sh +-endif !LITE_MODE diff --git a/recipes/capnproto/all/test_package/CMakeLists.txt b/recipes/capnproto/all/test_package/CMakeLists.txt index 44e90440833f5..5e0d93f57dde5 100644 --- a/recipes/capnproto/all/test_package/CMakeLists.txt +++ b/recipes/capnproto/all/test_package/CMakeLists.txt @@ -1,25 +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(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) -capnp_generate_cpp(calculatorSources calculatorHeaders calculator.capnp) -add_library(calculator_protocol STATIC) -target_sources(calculator_protocol PRIVATE ${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) +add_executable(addressbook test_package.c++ ${addressbookSources}) +target_include_directories(addressbook PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) +target_link_libraries(addressbook PRIVATE CapnProto::capnp) +target_compile_features(addressbook PRIVATE cxx_std_14) -add_executable(calculator-client calculator-client.c++) -target_link_libraries(calculator-client PRIVATE calculator_protocol) -add_executable(calculator-server calculator-server.c++) -target_link_libraries(calculator-server PRIVATE calculator_protocol) diff --git a/recipes/capnproto/all/test_package/addressbook.c++ b/recipes/capnproto/all/test_package/addressbook.c++ deleted file mode 100644 index b2bece9472b88..0000000000000 --- a/recipes/capnproto/all/test_package/addressbook.c++ +++ /dev/null @@ -1,288 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// 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. - -// This sample code appears in the documentation for the C++ implementation. -// -// If Cap'n Proto is installed, build the sample like: -// capnp compile -oc++ addressbook.capnp -// c++ -std=c++14 -Wall addressbook.c++ addressbook.capnp.c++ `pkg-config --cflags --libs capnp` -o addressbook -// -// If Cap'n Proto is not installed, but the source is located at $SRC and has been -// compiled in $BUILD (often both are simply ".." from here), you can do: -// $BUILD/capnp compile -I$SRC/src -o$BUILD/capnpc-c++ addressbook.capnp -// c++ -std=c++14 -Wall addressbook.c++ addressbook.capnp.c++ -I$SRC/src -L$BUILD/.libs -lcapnp -lkj -o addressbook -// -// Run like: -// ./addressbook write | ./addressbook read -// Use "dwrite" and "dread" to use dynamic code instead. - -// TODO(test): Needs cleanup. - -#include "addressbook.capnp.h" -#include -#include -#include - -using addressbook::Person; -using addressbook::AddressBook; - -void writeAddressBook(int fd) { - ::capnp::MallocMessageBuilder message; - - AddressBook::Builder addressBook = message.initRoot(); - ::capnp::List::Builder people = addressBook.initPeople(2); - - Person::Builder alice = people[0]; - alice.setId(123); - alice.setName("Alice"); - alice.setEmail("alice@example.com"); - // Type shown for explanation purposes; normally you'd use auto. - ::capnp::List::Builder alicePhones = - alice.initPhones(1); - alicePhones[0].setNumber("555-1212"); - alicePhones[0].setType(Person::PhoneNumber::Type::MOBILE); - alice.getEmployment().setSchool("MIT"); - - Person::Builder bob = people[1]; - bob.setId(456); - bob.setName("Bob"); - bob.setEmail("bob@example.com"); - auto bobPhones = bob.initPhones(2); - bobPhones[0].setNumber("555-4567"); - bobPhones[0].setType(Person::PhoneNumber::Type::HOME); - bobPhones[1].setNumber("555-7654"); - bobPhones[1].setType(Person::PhoneNumber::Type::WORK); - bob.getEmployment().setUnemployed(); - - writePackedMessageToFd(fd, message); -} - -void printAddressBook(int fd) { - ::capnp::PackedFdMessageReader message(fd); - - AddressBook::Reader addressBook = message.getRoot(); - - for (Person::Reader person : addressBook.getPeople()) { - std::cout << person.getName().cStr() << ": " - << person.getEmail().cStr() << std::endl; - for (Person::PhoneNumber::Reader phone: person.getPhones()) { - const char* typeName = "UNKNOWN"; - switch (phone.getType()) { - case Person::PhoneNumber::Type::MOBILE: typeName = "mobile"; break; - case Person::PhoneNumber::Type::HOME: typeName = "home"; break; - case Person::PhoneNumber::Type::WORK: typeName = "work"; break; - } - std::cout << " " << typeName << " phone: " - << phone.getNumber().cStr() << std::endl; - } - Person::Employment::Reader employment = person.getEmployment(); - switch (employment.which()) { - case Person::Employment::UNEMPLOYED: - std::cout << " unemployed" << std::endl; - break; - case Person::Employment::EMPLOYER: - std::cout << " employer: " - << employment.getEmployer().cStr() << std::endl; - break; - case Person::Employment::SCHOOL: - std::cout << " student at: " - << employment.getSchool().cStr() << std::endl; - break; - case Person::Employment::SELF_EMPLOYED: - std::cout << " self-employed" << std::endl; - break; - } - } -} - -#if !CAPNP_LITE - -#include "addressbook.capnp.h" -#include -#include -#include -#include -#include - -using ::capnp::DynamicValue; -using ::capnp::DynamicStruct; -using ::capnp::DynamicEnum; -using ::capnp::DynamicList; -using ::capnp::List; -using ::capnp::Schema; -using ::capnp::StructSchema; -using ::capnp::EnumSchema; - -using ::capnp::Void; -using ::capnp::Text; -using ::capnp::MallocMessageBuilder; -using ::capnp::PackedFdMessageReader; - -void dynamicWriteAddressBook(int fd, StructSchema schema) { - // Write a message using the dynamic API to set each - // field by text name. This isn't something you'd - // normally want to do; it's just for illustration. - - MallocMessageBuilder message; - - // Types shown for explanation purposes; normally you'd - // use auto. - DynamicStruct::Builder addressBook = - message.initRoot(schema); - - DynamicList::Builder people = - addressBook.init("people", 2).as(); - - DynamicStruct::Builder alice = - people[0].as(); - alice.set("id", 123); - alice.set("name", "Alice"); - alice.set("email", "alice@example.com"); - auto alicePhones = alice.init("phones", 1).as(); - auto phone0 = alicePhones[0].as(); - phone0.set("number", "555-1212"); - phone0.set("type", "mobile"); - alice.get("employment").as() - .set("school", "MIT"); - - auto bob = people[1].as(); - bob.set("id", 456); - bob.set("name", "Bob"); - bob.set("email", "bob@example.com"); - - // Some magic: We can convert a dynamic sub-value back to - // the native type with as()! - List::Builder bobPhones = - bob.init("phones", 2).as>(); - bobPhones[0].setNumber("555-4567"); - bobPhones[0].setType(Person::PhoneNumber::Type::HOME); - bobPhones[1].setNumber("555-7654"); - bobPhones[1].setType(Person::PhoneNumber::Type::WORK); - bob.get("employment").as() - .set("unemployed", ::capnp::VOID); - - writePackedMessageToFd(fd, message); -} - -void dynamicPrintValue(DynamicValue::Reader value) { - // Print an arbitrary message via the dynamic API by - // iterating over the schema. Look at the handling - // of STRUCT in particular. - - switch (value.getType()) { - case DynamicValue::VOID: - std::cout << ""; - break; - case DynamicValue::BOOL: - std::cout << (value.as() ? "true" : "false"); - break; - case DynamicValue::INT: - std::cout << value.as(); - break; - case DynamicValue::UINT: - std::cout << value.as(); - break; - case DynamicValue::FLOAT: - std::cout << value.as(); - break; - case DynamicValue::TEXT: - std::cout << '\"' << value.as().cStr() << '\"'; - break; - case DynamicValue::LIST: { - std::cout << "["; - bool first = true; - for (auto element: value.as()) { - if (first) { - first = false; - } else { - std::cout << ", "; - } - dynamicPrintValue(element); - } - std::cout << "]"; - break; - } - case DynamicValue::ENUM: { - auto enumValue = value.as(); - KJ_IF_MAYBE(enumerant, enumValue.getEnumerant()) { - std::cout << - enumerant->getProto().getName().cStr(); - } else { - // Unknown enum value; output raw number. - std::cout << enumValue.getRaw(); - } - break; - } - case DynamicValue::STRUCT: { - std::cout << "("; - auto structValue = value.as(); - bool first = true; - for (auto field: structValue.getSchema().getFields()) { - if (!structValue.has(field)) continue; - if (first) { - first = false; - } else { - std::cout << ", "; - } - std::cout << field.getProto().getName().cStr() - << " = "; - dynamicPrintValue(structValue.get(field)); - } - std::cout << ")"; - break; - } - default: - // There are other types, we aren't handling them. - std::cout << "?"; - break; - } -} - -void dynamicPrintMessage(int fd, StructSchema schema) { - PackedFdMessageReader message(fd); - dynamicPrintValue(message.getRoot(schema)); - std::cout << std::endl; -} - -#endif // !CAPNP_LITE - -int main(int argc, char* argv[]) { - if (argc != 2) { - std::cerr << "Missing arg." << std::endl; - return 1; - } else if (strcmp(argv[1], "write") == 0) { - writeAddressBook(1); - } else if (strcmp(argv[1], "read") == 0) { - printAddressBook(0); -#if !CAPNP_LITE - } else if (strcmp(argv[1], "dwrite") == 0) { - StructSchema schema = Schema::from(); - dynamicWriteAddressBook(1, schema); - } else if (strcmp(argv[1], "dread") == 0) { - StructSchema schema = Schema::from(); - dynamicPrintMessage(0, schema); -#endif - } else { - std::cerr << "Invalid arg: " << argv[1] << std::endl; - return 1; - } - return 0; -} diff --git a/recipes/capnproto/all/test_package/addressbook.capnp b/recipes/capnproto/all/test_package/addressbook.capnp deleted file mode 100644 index 1a6c60937e8af..0000000000000 --- a/recipes/capnproto/all/test_package/addressbook.capnp +++ /dev/null @@ -1,55 +0,0 @@ -# Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -# Licensed under the MIT License: -# -# 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. - -@0x9eb32e19f86ee174; - -using Cxx = import "/capnp/c++.capnp"; -$Cxx.namespace("addressbook"); - -struct Person { - id @0 :UInt32; - name @1 :Text; - email @2 :Text; - phones @3 :List(PhoneNumber); - - struct PhoneNumber { - number @0 :Text; - type @1 :Type; - - enum Type { - mobile @0; - home @1; - work @2; - } - } - - employment :union { - unemployed @4 :Void; - employer @5 :Text; - school @6 :Text; - selfEmployed @7 :Void; - # We assume that a person is only one of these. - } -} - -struct AddressBook { - people @0 :List(Person); -} diff --git a/recipes/capnproto/all/test_package/calculator-client.c++ b/recipes/capnproto/all/test_package/calculator-client.c++ deleted file mode 100644 index 5d8452921cde9..0000000000000 --- a/recipes/capnproto/all/test_package/calculator-client.c++ +++ /dev/null @@ -1,367 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// 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. - -#include "calculator.capnp.h" -#include -#include -#include -#include - -class PowerFunction final: public Calculator::Function::Server { - // An implementation of the Function interface wrapping pow(). Note that - // we're implementing this on the client side and will pass a reference to - // the server. The server will then be able to make calls back to the client. - -public: - kj::Promise call(CallContext context) { - auto params = context.getParams().getParams(); - KJ_REQUIRE(params.size() == 2, "Wrong number of parameters."); - context.getResults().setValue(pow(params[0], params[1])); - return kj::READY_NOW; - } -}; - -int main(int argc, const char* argv[]) { - if (argc != 2) { - std::cerr << "usage: " << argv[0] << " HOST:PORT\n" - "Connects to the Calculator server at the given address and " - "does some RPCs." << std::endl; - return 1; - } - - capnp::EzRpcClient client(argv[1]); - Calculator::Client calculator = client.getMain(); - - // Keep an eye on `waitScope`. Whenever you see it used is a place where we - // stop and wait for the server to respond. If a line of code does not use - // `waitScope`, then it does not block! - auto& waitScope = client.getWaitScope(); - - { - // Make a request that just evaluates the literal value 123. - // - // What's interesting here is that evaluate() returns a "Value", which is - // another interface and therefore points back to an object living on the - // server. We then have to call read() on that object to read it. - // However, even though we are making two RPC's, this block executes in - // *one* network round trip because of promise pipelining: we do not wait - // for the first call to complete before we send the second call to the - // server. - - std::cout << "Evaluating a literal... "; - std::cout.flush(); - - // Set up the request. - auto request = calculator.evaluateRequest(); - request.getExpression().setLiteral(123); - - // Send it, which returns a promise for the result (without blocking). - auto evalPromise = request.send(); - - // Using the promise, create a pipelined request to call read() on the - // returned object, and then send that. - auto readPromise = evalPromise.getValue().readRequest().send(); - - // Now that we've sent all the requests, wait for the response. Until this - // point, we haven't waited at all! - auto response = readPromise.wait(waitScope); - KJ_ASSERT(response.getValue() == 123); - - std::cout << "PASS" << std::endl; - } - - { - // Make a request to evaluate 123 + 45 - 67. - // - // The Calculator interface requires that we first call getOperator() to - // get the addition and subtraction functions, then call evaluate() to use - // them. But, once again, we can get both functions, call evaluate(), and - // then read() the result -- four RPCs -- in the time of *one* network - // round trip, because of promise pipelining. - - std::cout << "Using add and subtract... "; - std::cout.flush(); - - Calculator::Function::Client add = nullptr; - Calculator::Function::Client subtract = nullptr; - - { - // Get the "add" function from the server. - auto request = calculator.getOperatorRequest(); - request.setOp(Calculator::Operator::ADD); - add = request.send().getFunc(); - } - - { - // Get the "subtract" function from the server. - auto request = calculator.getOperatorRequest(); - request.setOp(Calculator::Operator::SUBTRACT); - subtract = request.send().getFunc(); - } - - // Build the request to evaluate 123 + 45 - 67. - auto request = calculator.evaluateRequest(); - - auto subtractCall = request.getExpression().initCall(); - subtractCall.setFunction(subtract); - auto subtractParams = subtractCall.initParams(2); - subtractParams[1].setLiteral(67); - - auto addCall = subtractParams[0].initCall(); - addCall.setFunction(add); - auto addParams = addCall.initParams(2); - addParams[0].setLiteral(123); - addParams[1].setLiteral(45); - - // Send the evaluate() request, read() the result, and wait for read() to - // finish. - auto evalPromise = request.send(); - auto readPromise = evalPromise.getValue().readRequest().send(); - - auto response = readPromise.wait(waitScope); - KJ_ASSERT(response.getValue() == 101); - - std::cout << "PASS" << std::endl; - } - - { - // Make a request to evaluate 4 * 6, then use the result in two more - // requests that add 3 and 5. - // - // Since evaluate() returns its result wrapped in a `Value`, we can pass - // that `Value` back to the server in subsequent requests before the first - // `evaluate()` has actually returned. Thus, this example again does only - // one network round trip. - - std::cout << "Pipelining eval() calls... "; - std::cout.flush(); - - Calculator::Function::Client add = nullptr; - Calculator::Function::Client multiply = nullptr; - - { - // Get the "add" function from the server. - auto request = calculator.getOperatorRequest(); - request.setOp(Calculator::Operator::ADD); - add = request.send().getFunc(); - } - - { - // Get the "multiply" function from the server. - auto request = calculator.getOperatorRequest(); - request.setOp(Calculator::Operator::MULTIPLY); - multiply = request.send().getFunc(); - } - - // Build the request to evaluate 4 * 6 - auto request = calculator.evaluateRequest(); - - auto multiplyCall = request.getExpression().initCall(); - multiplyCall.setFunction(multiply); - auto multiplyParams = multiplyCall.initParams(2); - multiplyParams[0].setLiteral(4); - multiplyParams[1].setLiteral(6); - - auto multiplyResult = request.send().getValue(); - - // Use the result in two calls that add 3 and add 5. - - auto add3Request = calculator.evaluateRequest(); - auto add3Call = add3Request.getExpression().initCall(); - add3Call.setFunction(add); - auto add3Params = add3Call.initParams(2); - add3Params[0].setPreviousResult(multiplyResult); - add3Params[1].setLiteral(3); - auto add3Promise = add3Request.send().getValue().readRequest().send(); - - auto add5Request = calculator.evaluateRequest(); - auto add5Call = add5Request.getExpression().initCall(); - add5Call.setFunction(add); - auto add5Params = add5Call.initParams(2); - add5Params[0].setPreviousResult(multiplyResult); - add5Params[1].setLiteral(5); - auto add5Promise = add5Request.send().getValue().readRequest().send(); - - // Now wait for the results. - KJ_ASSERT(add3Promise.wait(waitScope).getValue() == 27); - KJ_ASSERT(add5Promise.wait(waitScope).getValue() == 29); - - std::cout << "PASS" << std::endl; - } - - { - // Our calculator interface supports defining functions. Here we use it - // to define two functions and then make calls to them as follows: - // - // f(x, y) = x * 100 + y - // g(x) = f(x, x + 1) * 2; - // f(12, 34) - // g(21) - // - // Once again, the whole thing takes only one network round trip. - - std::cout << "Defining functions... "; - std::cout.flush(); - - Calculator::Function::Client add = nullptr; - Calculator::Function::Client multiply = nullptr; - Calculator::Function::Client f = nullptr; - Calculator::Function::Client g = nullptr; - - { - // Get the "add" function from the server. - auto request = calculator.getOperatorRequest(); - request.setOp(Calculator::Operator::ADD); - add = request.send().getFunc(); - } - - { - // Get the "multiply" function from the server. - auto request = calculator.getOperatorRequest(); - request.setOp(Calculator::Operator::MULTIPLY); - multiply = request.send().getFunc(); - } - - { - // Define f. - auto request = calculator.defFunctionRequest(); - request.setParamCount(2); - - { - // Build the function body. - auto addCall = request.getBody().initCall(); - addCall.setFunction(add); - auto addParams = addCall.initParams(2); - addParams[1].setParameter(1); // y - - auto multiplyCall = addParams[0].initCall(); - multiplyCall.setFunction(multiply); - auto multiplyParams = multiplyCall.initParams(2); - multiplyParams[0].setParameter(0); // x - multiplyParams[1].setLiteral(100); - } - - f = request.send().getFunc(); - } - - { - // Define g. - auto request = calculator.defFunctionRequest(); - request.setParamCount(1); - - { - // Build the function body. - auto multiplyCall = request.getBody().initCall(); - multiplyCall.setFunction(multiply); - auto multiplyParams = multiplyCall.initParams(2); - multiplyParams[1].setLiteral(2); - - auto fCall = multiplyParams[0].initCall(); - fCall.setFunction(f); - auto fParams = fCall.initParams(2); - fParams[0].setParameter(0); - - auto addCall = fParams[1].initCall(); - addCall.setFunction(add); - auto addParams = addCall.initParams(2); - addParams[0].setParameter(0); - addParams[1].setLiteral(1); - } - - g = request.send().getFunc(); - } - - // OK, we've defined all our functions. Now create our eval requests. - - // f(12, 34) - auto fEvalRequest = calculator.evaluateRequest(); - auto fCall = fEvalRequest.initExpression().initCall(); - fCall.setFunction(f); - auto fParams = fCall.initParams(2); - fParams[0].setLiteral(12); - fParams[1].setLiteral(34); - auto fEvalPromise = fEvalRequest.send().getValue().readRequest().send(); - - // g(21) - auto gEvalRequest = calculator.evaluateRequest(); - auto gCall = gEvalRequest.initExpression().initCall(); - gCall.setFunction(g); - gCall.initParams(1)[0].setLiteral(21); - auto gEvalPromise = gEvalRequest.send().getValue().readRequest().send(); - - // Wait for the results. - KJ_ASSERT(fEvalPromise.wait(waitScope).getValue() == 1234); - KJ_ASSERT(gEvalPromise.wait(waitScope).getValue() == 4244); - - std::cout << "PASS" << std::endl; - } - - { - // Make a request that will call back to a function defined locally. - // - // Specifically, we will compute 2^(4 + 5). However, exponent is not - // defined by the Calculator server. So, we'll implement the Function - // interface locally and pass it to the server for it to use when - // evaluating the expression. - // - // This example requires two network round trips to complete, because the - // server calls back to the client once before finishing. In this - // particular case, this could potentially be optimized by using a tail - // call on the server side -- see CallContext::tailCall(). However, to - // keep the example simpler, we haven't implemented this optimization in - // the sample server. - - std::cout << "Using a callback... "; - std::cout.flush(); - - Calculator::Function::Client add = nullptr; - - { - // Get the "add" function from the server. - auto request = calculator.getOperatorRequest(); - request.setOp(Calculator::Operator::ADD); - add = request.send().getFunc(); - } - - // Build the eval request for 2^(4+5). - auto request = calculator.evaluateRequest(); - - auto powCall = request.getExpression().initCall(); - powCall.setFunction(kj::heap()); - auto powParams = powCall.initParams(2); - powParams[0].setLiteral(2); - - auto addCall = powParams[1].initCall(); - addCall.setFunction(add); - auto addParams = addCall.initParams(2); - addParams[0].setLiteral(4); - addParams[1].setLiteral(5); - - // Send the request and wait. - auto response = request.send().getValue().readRequest() - .send().wait(waitScope); - KJ_ASSERT(response.getValue() == 512); - - std::cout << "PASS" << std::endl; - } - - return 0; -} diff --git a/recipes/capnproto/all/test_package/calculator-server.c++ b/recipes/capnproto/all/test_package/calculator-server.c++ deleted file mode 100644 index c2593be3a9064..0000000000000 --- a/recipes/capnproto/all/test_package/calculator-server.c++ +++ /dev/null @@ -1,215 +0,0 @@ -// Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -// Licensed under the MIT License: -// -// 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. - -#include "calculator.capnp.h" -#include -#include -#include -#include - -typedef unsigned int uint; - -kj::Promise readValue(Calculator::Value::Client value) { - // Helper function to asynchronously call read() on a Calculator::Value and - // return a promise for the result. (In the future, the generated code might - // include something like this automatically.) - - return value.readRequest().send() - .then([](capnp::Response result) { - return result.getValue(); - }); -} - -kj::Promise evaluateImpl( - Calculator::Expression::Reader expression, - capnp::List::Reader params = capnp::List::Reader()) { - // Implementation of CalculatorImpl::evaluate(), also shared by - // FunctionImpl::call(). In the latter case, `params` are the parameter - // values passed to the function; in the former case, `params` is just an - // empty list. - - switch (expression.which()) { - case Calculator::Expression::LITERAL: - return expression.getLiteral(); - - case Calculator::Expression::PREVIOUS_RESULT: - return readValue(expression.getPreviousResult()); - - case Calculator::Expression::PARAMETER: { - KJ_REQUIRE(expression.getParameter() < params.size(), - "Parameter index out-of-range."); - return params[expression.getParameter()]; - } - - case Calculator::Expression::CALL: { - auto call = expression.getCall(); - auto func = call.getFunction(); - - // Evaluate each parameter. - kj::Array> paramPromises = - KJ_MAP(param, call.getParams()) { - return evaluateImpl(param, params); - }; - - // Join the array of promises into a promise for an array. - kj::Promise> joinedParams = - kj::joinPromises(kj::mv(paramPromises)); - - // When the parameters are complete, call the function. - return joinedParams.then([KJ_CPCAP(func)](kj::Array&& paramValues) mutable { - auto request = func.callRequest(); - request.setParams(paramValues); - return request.send().then( - [](capnp::Response&& result) { - return result.getValue(); - }); - }); - } - - default: - // Throw an exception. - KJ_FAIL_REQUIRE("Unknown expression type."); - } -} - -class ValueImpl final: public Calculator::Value::Server { - // Simple implementation of the Calculator.Value Cap'n Proto interface. - -public: - ValueImpl(double value): value(value) {} - - kj::Promise read(ReadContext context) { - context.getResults().setValue(value); - return kj::READY_NOW; - } - -private: - double value; -}; - -class FunctionImpl final: public Calculator::Function::Server { - // Implementation of the Calculator.Function Cap'n Proto interface, where the - // function is defined by a Calculator.Expression. - -public: - FunctionImpl(uint paramCount, Calculator::Expression::Reader body) - : paramCount(paramCount) { - this->body.setRoot(body); - } - - kj::Promise call(CallContext context) { - auto params = context.getParams().getParams(); - KJ_REQUIRE(params.size() == paramCount, "Wrong number of parameters."); - - return evaluateImpl(body.getRoot(), params) - .then([KJ_CPCAP(context)](double value) mutable { - context.getResults().setValue(value); - }); - } - -private: - uint paramCount; - // The function's arity. - - capnp::MallocMessageBuilder body; - // Stores a permanent copy of the function body. -}; - -class OperatorImpl final: public Calculator::Function::Server { - // Implementation of the Calculator.Function Cap'n Proto interface, wrapping - // basic binary arithmetic operators. - -public: - OperatorImpl(Calculator::Operator op): op(op) {} - - kj::Promise call(CallContext context) { - auto params = context.getParams().getParams(); - KJ_REQUIRE(params.size() == 2, "Wrong number of parameters."); - - double result; - switch (op) { - case Calculator::Operator::ADD: result = params[0] + params[1]; break; - case Calculator::Operator::SUBTRACT:result = params[0] - params[1]; break; - case Calculator::Operator::MULTIPLY:result = params[0] * params[1]; break; - case Calculator::Operator::DIVIDE: result = params[0] / params[1]; break; - default: - KJ_FAIL_REQUIRE("Unknown operator."); - } - - context.getResults().setValue(result); - return kj::READY_NOW; - } - -private: - Calculator::Operator op; -}; - -class CalculatorImpl final: public Calculator::Server { - // Implementation of the Calculator Cap'n Proto interface. - -public: - kj::Promise evaluate(EvaluateContext context) override { - return evaluateImpl(context.getParams().getExpression()) - .then([KJ_CPCAP(context)](double value) mutable { - context.getResults().setValue(kj::heap(value)); - }); - } - - kj::Promise defFunction(DefFunctionContext context) override { - auto params = context.getParams(); - context.getResults().setFunc(kj::heap( - params.getParamCount(), params.getBody())); - return kj::READY_NOW; - } - - kj::Promise getOperator(GetOperatorContext context) override { - context.getResults().setFunc(kj::heap( - context.getParams().getOp())); - return kj::READY_NOW; - } -}; - -int main(int argc, const char* argv[]) { - if (argc != 2) { - std::cerr << "usage: " << argv[0] << " ADDRESS[:PORT]\n" - "Runs the server bound to the given address/port.\n" - "ADDRESS may be '*' to bind to all local addresses.\n" - ":PORT may be omitted to choose a port automatically." << std::endl; - return 1; - } - - // Set up a server. - capnp::EzRpcServer server(kj::heap(), argv[1]); - - // Write the port number to stdout, in case it was chosen automatically. - auto& waitScope = server.getWaitScope(); - uint port = server.getPort().wait(waitScope); - if (port == 0) { - // The address format "unix:/path/to/socket" opens a unix domain socket, - // in which case the port will be zero. - std::cout << "Listening on Unix socket..." << std::endl; - } else { - std::cout << "Listening on port " << port << "..." << std::endl; - } - - // Run forever, accepting connections and handling requests. - kj::NEVER_DONE.wait(waitScope); -} diff --git a/recipes/capnproto/all/test_package/calculator.capnp b/recipes/capnproto/all/test_package/calculator.capnp deleted file mode 100644 index adc8294e57578..0000000000000 --- a/recipes/capnproto/all/test_package/calculator.capnp +++ /dev/null @@ -1,118 +0,0 @@ -# Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors -# Licensed under the MIT License: -# -# 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. - -@0x85150b117366d14b; - -interface Calculator { - # A "simple" mathematical calculator, callable via RPC. - # - # But, to show off Cap'n Proto, we add some twists: - # - # - You can use the result from one call as the input to the next - # without a network round trip. To accomplish this, evaluate() - # returns a `Value` object wrapping the actual numeric value. - # This object may be used in a subsequent expression. With - # promise pipelining, the Value can actually be used before - # the evaluate() call that creates it returns! - # - # - You can define new functions, and then call them. This again - # shows off pipelining, but it also gives the client the - # opportunity to define a function on the client side and have - # the server call back to it. - # - # - The basic arithmetic operators are exposed as Functions, and - # you have to call getOperator() to obtain them from the server. - # This again demonstrates pipelining -- using getOperator() to - # get each operator and then using them in evaluate() still - # only takes one network round trip. - - evaluate @0 (expression :Expression) -> (value :Value); - # Evaluate the given expression and return the result. The - # result is returned wrapped in a Value interface so that you - # may pass it back to the server in a pipelined request. To - # actually get the numeric value, you must call read() on the - # Value -- but again, this can be pipelined so that it incurs - # no additional latency. - - struct Expression { - # A numeric expression. - - union { - literal @0 :Float64; - # A literal numeric value. - - previousResult @1 :Value; - # A value that was (or, will be) returned by a previous - # evaluate(). - - parameter @2 :UInt32; - # A parameter to the function (only valid in function bodies; - # see defFunction). - - call :group { - # Call a function on a list of parameters. - function @3 :Function; - params @4 :List(Expression); - } - } - } - - interface Value { - # Wraps a numeric value in an RPC object. This allows the value - # to be used in subsequent evaluate() requests without the client - # waiting for the evaluate() that returns the Value to finish. - - read @0 () -> (value :Float64); - # Read back the raw numeric value. - } - - defFunction @1 (paramCount :Int32, body :Expression) - -> (func :Function); - # Define a function that takes `paramCount` parameters and returns the - # evaluation of `body` after substituting these parameters. - - interface Function { - # An algebraic function. Can be called directly, or can be used inside - # an Expression. - # - # A client can create a Function that runs on the server side using - # `defFunction()` or `getOperator()`. Alternatively, a client can - # implement a Function on the client side and the server will call back - # to it. However, a function defined on the client side will require a - # network round trip whenever the server needs to call it, whereas - # functions defined on the server and then passed back to it are called - # locally. - - call @0 (params :List(Float64)) -> (value :Float64); - # Call the function on the given parameters. - } - - getOperator @2 (op :Operator) -> (func :Function); - # Get a Function representing an arithmetic operator, which can then be - # used in Expressions. - - enum Operator { - add @0; - subtract @1; - multiply @2; - divide @3; - } -} diff --git a/recipes/capnproto/all/test_package/conanfile.py b/recipes/capnproto/all/test_package/conanfile.py index 10650773f736a..85b7dcba030f5 100644 --- a/recipes/capnproto/all/test_package/conanfile.py +++ b/recipes/capnproto/all/test_package/conanfile.py @@ -1,14 +1,27 @@ -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 build_requirements(self): - if hasattr(self, "settings_build"): - self.build_requires(str(self.requires["capnproto"])) + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str, run=True) + + 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 +29,8 @@ 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.bindir, "addressbook") + self.run(bin_path, env="conanrun") + + self.run("capnp id") diff --git a/recipes/capnproto/all/test_package/test_package.c++ b/recipes/capnproto/all/test_package/test_package.c++ new file mode 100644 index 0000000000000..8ed58079da0b0 --- /dev/null +++ b/recipes/capnproto/all/test_package/test_package.c++ @@ -0,0 +1,9 @@ +#include +#include + + +int main() { + capnp::MallocMessageBuilder message; + std::cout << sizeof(message) << std::endl; + return 0; +} diff --git a/recipes/capnproto/config.yml b/recipes/capnproto/config.yml index b46b8cb89082c..7439163d18050 100644 --- a/recipes/capnproto/config.yml +++ b/recipes/capnproto/config.yml @@ -1,4 +1,14 @@ versions: + "1.0.2": + folder: all + "1.0.1": + folder: all + "1.0.0": + folder: all + "0.10.4": + folder: all + "0.10.3": + folder: all "0.10.1": folder: all "0.10.0": diff --git a/recipes/capstone/all/conandata.yml b/recipes/capstone/all/conandata.yml index 7e93927333e67..b49957e5739d0 100644 --- a/recipes/capstone/all/conandata.yml +++ b/recipes/capstone/all/conandata.yml @@ -1,4 +1,19 @@ sources: + "5.0.1": + url: "https://github.com/capstone-engine/capstone/archive/refs/tags/5.0.1.tar.gz" + sha256: "2b9c66915923fdc42e0e32e2a9d7d83d3534a45bb235e163a70047951890c01a" + "5.0": + url: "https://github.com/capstone-engine/capstone/archive/refs/tags/5.0.tar.gz" + sha256: "df24344407baa7415eeb006f742afc9b92cd33abf2c4c120a6e97cfb376882dc" "4.0.2": url: "https://github.com/capstone-engine/capstone/archive/refs/tags/4.0.2.tar.gz" sha256: "7c81d798022f81e7507f1a60d6817f63aa76e489aa4e7055255f21a22f5e526a" +patches: + "5.0.1": + - patch_file: "patches/5.0-0001-disable-warning-flags.patch" + patch_description: "disable warning flags for older compilers" + patch_type: "portability" + "5.0": + - patch_file: "patches/5.0-0001-disable-warning-flags.patch" + patch_description: "disable warning flags for older compilers" + patch_type: "portability" diff --git a/recipes/capstone/all/conanfile.py b/recipes/capstone/all/conanfile.py index 148a51bb1323b..416470d00874e 100644 --- a/recipes/capstone/all/conanfile.py +++ b/recipes/capstone/all/conanfile.py @@ -1,7 +1,8 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import copy, get +from conan.tools.files import copy, get, rmdir, export_conandata_patches, apply_conandata_patches from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +from conan.tools.scm import Version import os required_conan_version = ">=1.53.0" @@ -9,20 +10,20 @@ class CapstoneConan(ConanFile): name = "capstone" - 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." ) + license = "BSD-3-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "http://www.capstone-engine.org" topics = ( "reverse-engineering", "disassembler", "security", "framework", "arm", "arm64", "x86", "sparc", "powerpc", "mips", "x86-64", "ethereum", "systemz", "webassembly", "m68k", "m0s65xx", "m680x", "tms320c64x", "bpf", "riscv", ) - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -39,6 +40,9 @@ class CapstoneConan(ConanFile): options.update({a: [True, False] for a in _archs}) default_options.update({a: True for a in _archs}) + def export_sources(self): + export_conandata_patches(self) + def config_options(self): if self.settings.os == "Windows": del self.options.fPIC @@ -53,23 +57,27 @@ 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["CAPSTONE_BUILD_STATIC"] = not self.options.shared - tc.variables["CAPSTONE_BUILD_SHARED"] = self.options.shared + if Version(self.version) < "5.0": + 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 + if Version(self.version) < "5.0": + tc.variables["CAPSTONE_USE_SYS_DYN_MEM"] = self.options.use_default_alloc + else: + tc.variables["CAPSTONE_USE_DEFAULT_ALLOC"] = self.options.use_default_alloc for a in self._archs: 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): + apply_conandata_patches(self) cmake = CMake(self) cmake.configure() cmake.build() @@ -78,9 +86,11 @@ 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")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): - suffix = "_dll" if is_msvc(self) and self.options.shared else "" + suffix = "_dll" if is_msvc(self) and self.options.shared and Version(self.version) < "5.0" else "" self.cpp_info.libs = [f"capstone{suffix}"] if self.options.shared: self.cpp_info.defines.append("CAPSTONE_SHARED") diff --git a/recipes/capstone/all/patches/5.0-0001-disable-warning-flags.patch b/recipes/capstone/all/patches/5.0-0001-disable-warning-flags.patch new file mode 100644 index 0000000000000..95cad95e403d9 --- /dev/null +++ b/recipes/capstone/all/patches/5.0-0001-disable-warning-flags.patch @@ -0,0 +1,18 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 7a986a0..3da94ff 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -25,13 +25,6 @@ project(capstone + VERSION 5.0 + ) + +-if (MSVC) +- add_compile_options(/W1 /w14189) +-else() +- add_compile_options(-Wmissing-braces -Wunused-function -Warray-bounds -Wunused-variable -Wparentheses -Wint-in-bool-context) +-endif() +- +- + # to configure the options specify them in in the command line or change them in the cmake UI. + # Don't edit the makefile! + option(BUILD_SHARED_LIBS "Build shared library" OFF) diff --git a/recipes/capstone/config.yml b/recipes/capstone/config.yml index 6ce0808b6e1f0..77f1d8f750fd6 100644 --- a/recipes/capstone/config.yml +++ b/recipes/capstone/config.yml @@ -1,3 +1,7 @@ versions: + "5.0.1": + folder: "all" + "5.0": + folder: "all" "4.0.2": folder: "all" diff --git a/recipes/cargs/all/CMakeLists.txt b/recipes/cargs/all/CMakeLists.txt deleted file mode 100644 index 42d6e7408fb33..0000000000000 --- a/recipes/cargs/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() - -add_subdirectory("source_subfolder") diff --git a/recipes/cargs/all/conandata.yml b/recipes/cargs/all/conandata.yml index 21e38ee9fe720..4947b6c17c0a0 100644 --- a/recipes/cargs/all/conandata.yml +++ b/recipes/cargs/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "1.2.0": + url: "https://github.com/likle/cargs/archive/v1.2.0.tar.gz" + sha256: "0b33379e3d3c8cb3e22f33d3e1a260adcd366970868bc9b7c47237f24188ff25" + "1.1.0": + url: "https://github.com/likle/cargs/archive/v1.1.0.tar.gz" + sha256: "87e7da5b539f574d48529870cb0620ef5a244a5ee2eac73cc7559dedc04128ca" "1.0.3": url: "https://github.com/likle/cargs/archive/v1.0.3.tar.gz" sha256: "ddba25bd35e9c6c75bc706c126001b8ce8e084d40ef37050e6aa6963e836eb8b" diff --git a/recipes/cargs/all/conanfile.py b/recipes/cargs/all/conanfile.py index 6aeeae1d3b488..6de6ac89acce0 100644 --- a/recipes/cargs/all/conanfile.py +++ b/recipes/cargs/all/conanfile.py @@ -1,34 +1,37 @@ import os -from conans import ConanFile, CMake, tools -required_conan_version = ">=1.33.0" +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 + +required_conan_version = ">=1.53.0" class CargsConan(ConanFile): name = "cargs" - description = "A lightweight getopt replacement that works on Linux, " \ - "Windows and macOS. Command line argument parser library" \ - " for C/C++. Can be used to parse argv and argc parameters." - url = "https://github.com/conan-io/conan-center-index" + description = ( + "A lightweight getopt replacement that works on Linux, " + "Windows and macOS. Command line argument parser library" + " for C/C++. Can be used to parse argv and argc parameters." + ) license = "MIT" + url = "https://github.com/conan-io/conan-center-index" homepage = "https://likle.github.io/cargs/" topics = ("cargs", "cross-platform", "windows", "macos", "osx", "linux", "getopt", "getopt-long", "command-line-parser", "command-line", "arguments", "argument-parser") - exports_sources = ["CMakeLists.txt"] - generators = "cmake" + 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" - - @property - def _build_subfolder(self): - return "build_subfolder" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } def config_options(self): if self.settings.os == "Windows": @@ -36,33 +39,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.libcxx") + self.settings.rm_safe("compiler.cppstd") + + 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], - 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_WINDOWS_EXPORT_ALL_SYMBOLS"] = self.options.shared + tc.generate() + tc = CMakeDeps(self) + tc.generate() def build(self): cmake = CMake(self) - cmake.definitions["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = self.options.shared and self.settings.os == "Windows" - cmake.configure(build_folder=self._build_subfolder) + cmake.configure() cmake.build(target="cargs") def package(self): - include_dir = os.path.join(self._source_subfolder, 'include') - lib_dir = os.path.join(self._build_subfolder, "lib") - bin_dir = os.path.join(self._build_subfolder, "bin") - - self.copy("LICENSE.md", dst="licenses", src=self._source_subfolder) - self.copy("cargs.h", dst="include", src=include_dir) - self.copy(pattern="*.a", dst="lib", src=lib_dir, keep_path=False) - self.copy(pattern="*.lib", dst="lib", src=lib_dir, keep_path=False) - self.copy(pattern="*.dylib", dst="lib", src=lib_dir, keep_path=False) - self.copy(pattern="*.so*", dst="lib", src=lib_dir, keep_path=False, - symlinks=True) - self.copy(pattern="*.dll", dst="bin", src=bin_dir, keep_path=False) + copy(self, "LICENSE.md", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder) + copy(self, "cargs.h", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include")) + for pattern in ["*.a", "*.so*", "*.dylib", "*.lib"]: + copy(self, pattern, + dst=os.path.join(self.package_folder, "lib"), + src=self.build_folder, + keep_path=False) + copy(self, "*.dll", + dst=os.path.join(self.package_folder, "bin"), + src=self.build_folder, + keep_path=False) def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = ["cargs"] diff --git a/recipes/cargs/all/test_package/CMakeLists.txt b/recipes/cargs/all/test_package/CMakeLists.txt index f6bb6f79f518f..2d259c06a7d89 100644 --- a/recipes/cargs/all/test_package/CMakeLists.txt +++ b/recipes/cargs/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -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() +find_package(cargs REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE cargs::cargs) set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD 11) diff --git a/recipes/cargs/all/test_package/conanfile.py b/recipes/cargs/all/test_package/conanfile.py index 4903f1a7e8fa0..ef5d7042163ec 100644 --- a/recipes/cargs/all/test_package/conanfile.py +++ b/recipes/cargs/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cargs/all/test_v1_package/CMakeLists.txt b/recipes/cargs/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/cargs/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/cargs/all/test_v1_package/conanfile.py b/recipes/cargs/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..6c9d5dba712c7 --- /dev/null +++ b/recipes/cargs/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_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/cargs/config.yml b/recipes/cargs/config.yml index 63312af6d65c1..f86b56ea8cf6a 100644 --- a/recipes/cargs/config.yml +++ b/recipes/cargs/config.yml @@ -1,4 +1,8 @@ versions: + "1.2.0": + folder: all + "1.1.0": + folder: all "1.0.3": folder: all "1.0.1": diff --git a/recipes/cassandra-cpp-driver/all/CMakeLists.txt b/recipes/cassandra-cpp-driver/all/CMakeLists.txt deleted file mode 100644 index 7f03984bd9149..0000000000000 --- a/recipes/cassandra-cpp-driver/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cassandra C CXX) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/cassandra-cpp-driver/all/conandata.yml b/recipes/cassandra-cpp-driver/all/conandata.yml index 0ca8371b0b30f..169437d0e897c 100644 --- a/recipes/cassandra-cpp-driver/all/conandata.yml +++ b/recipes/cassandra-cpp-driver/all/conandata.yml @@ -1,10 +1,70 @@ sources: + "2.17.1": + url: "https://github.com/datastax/cpp-driver/archive/2.17.1.tar.gz" + sha256: "53b4123aad59b39f2da0eb0ce7fe0e92559f7bba0770b2e958254f17bffcd7cf" + "2.17.0": + url: "https://github.com/datastax/cpp-driver/archive/2.17.0.tar.gz" + sha256: "075af6a6920b0a8b12e37b8e5aa335b0c7919334aa1b451642668e6e37c5372f" + "2.16.2": + url: "https://github.com/datastax/cpp-driver/archive/2.16.2.tar.gz" + sha256: "de60751bd575b5364c2c5a17a24a40f3058264ea2ee6fef19de126ae550febc9" "2.15.3": - url: "https://github.com/datastax/cpp-driver/archive/2.15.3.zip" - sha256: "494b35418f1eaa86d80572a4254b7fae88a1341dcda83788ed038ce4f39117cb" + url: "https://github.com/datastax/cpp-driver/archive/2.15.3.tar.gz" + sha256: "eccb53c5151621c3b647fc83781a542cfb93e76687b4178ebce418fc4c817293" patches: + "2.17.1": + - patch_file: "patches/2.16.2/fix-cmake.patch" + patch_description: "use cci package" + patch_type: "conan" + - patch_file: "patches/2.15.3/fix-rapidjson.patch" + patch_description: "fix include path for cci package" + patch_type: "conan" + - patch_file: "patches/2.15.3/fix-atomic.patch" + patch_description: "Adapt MemoryOrder definition for C++ 20" + patch_type: "portability" + patch_source: "https://github.com/datastax/cpp-driver/pull/533" + - patch_file: "patches/2.15.3/remove-attribute-for-msvc.patch" + patch_description: "remove attribute for msvc" + patch_type: "portability" + "2.17.0": + - patch_file: "patches/2.16.2/fix-cmake.patch" + patch_description: "use cci package" + patch_type: "conan" + - patch_file: "patches/2.15.3/fix-rapidjson.patch" + patch_description: "fix include path for cci package" + patch_type: "conan" + - patch_file: "patches/2.15.3/fix-atomic.patch" + patch_description: "Adapt MemoryOrder definition for C++ 20" + patch_type: "portability" + patch_source: "https://github.com/datastax/cpp-driver/pull/533" + - patch_file: "patches/2.15.3/remove-attribute-for-msvc.patch" + patch_description: "remove attribute for msvc" + patch_type: "portability" + "2.16.2": + - patch_file: "patches/2.16.2/fix-cmake.patch" + patch_description: "use cci package" + patch_type: "conan" + - patch_file: "patches/2.15.3/fix-rapidjson.patch" + patch_description: "fix include path for cci package" + patch_type: "conan" + - patch_file: "patches/2.15.3/fix-atomic.patch" + patch_description: "Adapt MemoryOrder definition for C++ 20" + patch_type: "portability" + patch_source: "https://github.com/datastax/cpp-driver/pull/533" + - patch_file: "patches/2.15.3/remove-attribute-for-msvc.patch" + patch_description: "remove attribute for msvc" + patch_type: "portability" "2.15.3": - - base_path: "source_subfolder" - patch_file: "patches/2.15.3/fix-cmake.patch" - - base_path: "source_subfolder" - patch_file: "patches/2.15.3/fix-rapidjson.patch" + - patch_file: "patches/2.15.3/fix-cmake.patch" + patch_description: "use cci package" + patch_type: "conan" + - patch_file: "patches/2.15.3/fix-rapidjson.patch" + patch_description: "fix include path for cci package" + patch_type: "conan" + - patch_file: "patches/2.15.3/fix-atomic.patch" + patch_description: "Adapt MemoryOrder definition for C++ 20" + patch_type: "portability" + patch_source: "https://github.com/datastax/cpp-driver/pull/533" + - patch_file: "patches/2.15.3/remove-attribute-for-msvc.patch" + patch_description: "remove attribute for msvc" + patch_type: "portability" diff --git a/recipes/cassandra-cpp-driver/all/conanfile.py b/recipes/cassandra-cpp-driver/all/conanfile.py index 76b1d99adf12b..5cfe8683bd139 100644 --- a/recipes/cassandra-cpp-driver/all/conanfile.py +++ b/recipes/cassandra-cpp-driver/all/conanfile.py @@ -1,19 +1,21 @@ -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, replace_in_file, rm +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.build import check_min_cppstd import os -required_conan_version = ">=1.33.0" - +required_conan_version = ">=1.53.0" class CassandraCppDriverConan(ConanFile): name = "cassandra-cpp-driver" + description = "DataStax C/C++ Driver for Apache Cassandra and DataStax Products" license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://docs.datastax.com/en/developer/cpp-driver/" - description = "DataStax C/C++ Driver for Apache Cassandra and DataStax Products" - topics = ("cassandra", "cpp-driver", "database", "conan-recipe") - - settings = "os", "compiler", "build_type", "arch" + topics = ("cassandra", "cpp-driver", "database") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -34,19 +36,14 @@ class CassandraCppDriverConan(ConanFile): "with_kerberos": False, "use_timerfd": True, } - short_paths = True - generators = "cmake" - exports_sources = [ - "CMakeLists.txt", - "patches/*" - ] - - _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": @@ -55,24 +52,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 requirements(self): - self.requires("libuv/1.44.1") + self.requires("libuv/1.46.0") self.requires("http_parser/2.9.4") - self.requires("rapidjson/cci.20211112") + self.requires("rapidjson/cci.20220822") if self.options.with_openssl: - self.requires("openssl/1.1.1q") + self.requires("openssl/[>=1.1 <4]") if self.options.with_zlib: - self.requires("minizip/1.2.12") - self.requires("zlib/1.2.12") + self.requires("minizip/1.2.13") + self.requires("zlib/[>=1.2.11 <2]") if self.options.use_atomic == "boost": - self.requires("boost/1.79.0") + self.requires("boost/1.83.0") def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + if self.options.use_atomic == "boost": # Compilation error on Linux if self.settings.os == "Linux": @@ -84,72 +87,77 @@ def validate(self): "Kerberos is not supported at the moment") 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) - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "\"${CMAKE_CXX_COMPILER_ID}\" STREQUAL \"Clang\"", - "\"${CMAKE_CXX_COMPILER_ID}\" STREQUAL \"Clang\" OR \"${CMAKE_CXX_COMPILER_ID}\" STREQUAL \"AppleClang\"") - - def _configure_cmake(self): - if self._cmake: - return self._cmake - - self._cmake = CMake(self) - self._cmake.definitions["VERSION"] = self.version - self._cmake.definitions["CASS_BUILD_EXAMPLES"] = False - self._cmake.definitions["CASS_BUILD_INTEGRATION_TESTS"] = False - self._cmake.definitions["CASS_BUILD_SHARED"] = self.options.shared - self._cmake.definitions["CASS_BUILD_STATIC"] = not self.options.shared - self._cmake.definitions["CASS_BUILD_TESTS"] = False - self._cmake.definitions["CASS_BUILD_UNIT_TESTS"] = False - self._cmake.definitions["CASS_DEBUG_CUSTOM_ALLOC"] = False - self._cmake.definitions["CASS_INSTALL_HEADER_IN_SUBDIR"] = self.options.install_header_in_subdir - self._cmake.definitions["CASS_INSTALL_PKG_CONFIG"] = False + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["VERSION"] = self.version + tc.variables["CASS_BUILD_EXAMPLES"] = False + tc.variables["CASS_BUILD_INTEGRATION_TESTS"] = False + tc.variables["CASS_BUILD_SHARED"] = self.options.shared + tc.variables["CASS_BUILD_STATIC"] = not self.options.shared + tc.variables["CASS_BUILD_TESTS"] = False + tc.variables["CASS_BUILD_UNIT_TESTS"] = False + tc.variables["CASS_DEBUG_CUSTOM_ALLOC"] = False + tc.variables["CASS_INSTALL_HEADER_IN_SUBDIR"] = self.options.install_header_in_subdir + tc.variables["CASS_INSTALL_PKG_CONFIG"] = False if self.options.use_atomic == "boost": - self._cmake.definitions["CASS_USE_BOOST_ATOMIC"] = True - self._cmake.definitions["CASS_USE_STD_ATOMIC"] = False + tc.variables["CASS_USE_BOOST_ATOMIC"] = True + tc.variables["CASS_USE_STD_ATOMIC"] = False elif self.options.use_atomic == "std": - self._cmake.definitions["CASS_USE_BOOST_ATOMIC"] = False - self._cmake.definitions["CASS_USE_STD_ATOMIC"] = True + tc.variables["CASS_USE_BOOST_ATOMIC"] = False + tc.variables["CASS_USE_STD_ATOMIC"] = True else: - self._cmake.definitions["CASS_USE_BOOST_ATOMIC"] = False - self._cmake.definitions["CASS_USE_STD_ATOMIC"] = False + tc.variables["CASS_USE_BOOST_ATOMIC"] = False + tc.variables["CASS_USE_STD_ATOMIC"] = False - self._cmake.definitions["CASS_USE_OPENSSL"] = self.options.with_openssl - self._cmake.definitions["CASS_USE_STATIC_LIBS"] = False - self._cmake.definitions["CASS_USE_ZLIB"] = self.options.with_zlib - self._cmake.definitions["CASS_USE_LIBSSH2"] = False + tc.variables["CASS_USE_OPENSSL"] = self.options.with_openssl + tc.variables["CASS_USE_STATIC_LIBS"] = False + tc.variables["CASS_USE_ZLIB"] = self.options.with_zlib + tc.variables["CASS_USE_LIBSSH2"] = False # FIXME: To use kerberos, its conan package is needed. Uncomment this when kerberos conan package is ready. - # self._cmake.definitions["CASS_USE_KERBEROS"] = self.options.with_kerberos + # tc.variables["CASS_USE_KERBEROS"] = self.options.with_kerberos if self.settings.os == "Linux": - self._cmake.definitions["CASS_USE_TIMERFD"] = self.options.use_timerfd + tc.variables["CASS_USE_TIMERFD"] = self.options.use_timerfd + # Relocatable shared lib on Macos + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" + tc.generate() - self._cmake.configure() - return self._cmake + deps = CMakeDeps(self) + deps.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "\"${CMAKE_CXX_COMPILER_ID}\" STREQUAL \"Clang\"", + "\"${CMAKE_CXX_COMPILER_ID}\" STREQUAL \"Clang\" OR \"${CMAKE_CXX_COMPILER_ID}\" STREQUAL \"AppleClang\"") + rm(self, "Findlibssh2.cmake", os.path.join(self.source_folder, "cmake")) + rm(self, "Findlibuv.cmake", os.path.join(self.source_folder, "cmake")) + rm(self, "FindOpenSSL.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(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() def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = ["cassandra" if self.options.shared else "cassandra_static"] if self.settings.os == "Windows": self.cpp_info.system_libs.extend(["iphlpapi", "psapi", "wsock32", "crypt32", "ws2_32", "userenv", "version"]) if not self.options.shared: self.cpp_info.defines = ["CASS_STATIC"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs = ["m"] + diff --git a/recipes/cassandra-cpp-driver/all/patches/2.15.3/fix-atomic.patch b/recipes/cassandra-cpp-driver/all/patches/2.15.3/fix-atomic.patch new file mode 100644 index 0000000000000..64a29de126f9f --- /dev/null +++ b/recipes/cassandra-cpp-driver/all/patches/2.15.3/fix-atomic.patch @@ -0,0 +1,28 @@ +diff --git a/src/atomic/atomic_std.hpp b/src/atomic/atomic_std.hpp +index 2ad0103..08418a9 100644 +--- a/src/atomic/atomic_std.hpp ++++ b/src/atomic/atomic_std.hpp +@@ -18,16 +18,17 @@ + #define DATASTAX_INTERNAL_ATOMIC_STD_HPP + + #include ++#include + + namespace datastax { namespace internal { + + enum MemoryOrder { +- MEMORY_ORDER_RELAXED = std::memory_order_relaxed, +- MEMORY_ORDER_CONSUME = std::memory_order_consume, +- MEMORY_ORDER_ACQUIRE = std::memory_order_acquire, +- MEMORY_ORDER_RELEASE = std::memory_order_release, +- MEMORY_ORDER_ACQ_REL = std::memory_order_acq_rel, +- MEMORY_ORDER_SEQ_CST = std::memory_order_seq_cst ++ MEMORY_ORDER_RELAXED = static_cast::type>(std::memory_order_relaxed), ++ MEMORY_ORDER_CONSUME = static_cast::type>(std::memory_order_consume), ++ MEMORY_ORDER_ACQUIRE = static_cast::type>(std::memory_order_acquire), ++ MEMORY_ORDER_RELEASE = static_cast::type>(std::memory_order_release), ++ MEMORY_ORDER_ACQ_REL = static_cast::type>(std::memory_order_acq_rel), ++ MEMORY_ORDER_SEQ_CST = static_cast::type>(std::memory_order_seq_cst) + }; + + template diff --git a/recipes/cassandra-cpp-driver/all/patches/2.15.3/fix-cmake.patch b/recipes/cassandra-cpp-driver/all/patches/2.15.3/fix-cmake.patch index 191d2eb7e8174..9406ccc60d7aa 100644 --- a/recipes/cassandra-cpp-driver/all/patches/2.15.3/fix-cmake.patch +++ b/recipes/cassandra-cpp-driver/all/patches/2.15.3/fix-cmake.patch @@ -1,43 +1,87 @@ - CMakeLists.txt | 4 --- - src/CMakeLists.txt | 84 ++++++++++++++++++++++++++++++++++++------------------ - 2 files changed, 57 insertions(+), 31 deletions(-) - diff --git a/CMakeLists.txt b/CMakeLists.txt -index c6150948b..669eb086e 100644 +index c615094..b10d9c9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -1,6 +1,3 @@ --cmake_minimum_required(VERSION 2.8.12) --project(cassandra C CXX) -- - set(CASS_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}) - set(CASS_SRC_DIR "${CASS_ROOT_DIR}/src") - set(CASS_INCLUDE_DIR "${CASS_ROOT_DIR}/include") -@@ -81,7 +78,6 @@ endif() - # Dependencies - #------------------------ +@@ -164,7 +164,7 @@ endif() + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR + "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + # Enable C++11 support to use std::atomic +- if(CASS_USE_STD_ATOMIC) ++ if(1) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + endif() + +diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake +index 9052472..3f65adb 100644 +--- a/cmake/Dependencies.cmake ++++ b/cmake/Dependencies.cmake +@@ -21,28 +21,28 @@ if(NOT LIBUV_ROOT_DIR) + endif() + + # Ensure libuv was found +-find_package(Libuv "1.0.0") +-if(WIN32 AND NOT LIBUV_FOUND) ++find_package(libuv "1.0.0") ++if(WIN32 AND NOT libuv_FOUND) + message(STATUS "Unable to Locate libuv: Third party build step will be performed") + include(ExternalProject-libuv) +-elseif(NOT LIBUV_FOUND) ++elseif(NOT libuv_FOUND) + message(FATAL_ERROR "Unable to Locate libuv: libuv v1.0.0+ is required") + endif() + +-if(LIBUV_VERSION VERSION_LESS "1.0") +- message(FATAL_ERROR "Libuv version ${LIBUV_VERSION} is not " ++if(libuv_VERSION VERSION_LESS "1.0") ++ message(FATAL_ERROR "libuv version ${libuv_VERSION} is not " + " supported. Please updgrade to libuv version 1.0 or greater in order to " + "utilize the driver.") + endif() --include(Dependencies) - include(ClangFormat) +-if(LIBUV_VERSION VERSION_LESS "1.6") +- message(WARNING "Libuv version ${LIBUV_VERSION} does not support custom " ++if(libuv_VERSION VERSION_LESS "1.6") ++ message(WARNING "libuv version ${libuv_VERSION} does not support custom " + "memory allocators (version 1.6 or greater required)") + endif() + + # Assign libuv include and libraries +-set(CASS_INCLUDES ${CASS_INCLUDES} ${LIBUV_INCLUDE_DIRS}) +-set(CASS_LIBS ${CASS_LIBS} ${LIBUV_LIBRARIES}) ++set(CASS_INCLUDES ${CASS_INCLUDES} ${libuv_INCLUDE_DIRS}) ++set(CASS_LIBS ${CASS_LIBS} ${libuv_LIBRARIES}) + + # libuv and gtests require thread library + if(NOT WIN32) +@@ -192,3 +192,20 @@ if(CASS_USE_BOOST_ATOMIC) + endif() + endif() - #------------------------ ++#------------------------ ++# RapidJSON ++#------------------------ ++find_package(RapidJSON REQUIRED CONFIG) ++set(CASS_LIBS ${CASS_LIBS} rapidjson) ++ ++#------------------------ ++# http_parser ++#------------------------ ++find_package(http_parser REQUIRED CONFIG) ++set(CASS_LIBS ${CASS_LIBS} http_parser::http_parser) ++ ++#------------------------ ++# minizip ++#------------------------ ++find_package(minizip REQUIRED CONFIG) ++set(CASS_LIBS ${CASS_LIBS} minizip::minizip) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 06b84b759..7e81b2a06 100644 +index 06b84b7..41b23f2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt -@@ -1,6 +1,50 @@ +@@ -1,6 +1,41 @@ include(CheckSymbolExists) include(CheckCXXSourceCompiles) -+#------------------------ -+# Windows libraries -+#------------------------ -+ -+if(WIN32) -+ # Assign additional library requirements for Windows -+ set(CASS_LIBS iphlpapi psapi wsock32 crypt32 ws2_32 userenv version) -+endif() -+ +#------------------------ +# Libuv +#------------------------ @@ -76,7 +120,7 @@ index 06b84b759..7e81b2a06 100644 file(GLOB SOURCES *.cpp *.hpp) if(APPLE) -@@ -38,18 +82,14 @@ endif() +@@ -38,18 +73,14 @@ endif() add_subdirectory(third_party/curl) add_subdirectory(third_party/hdr_histogram) @@ -90,16 +134,17 @@ index 06b84b759..7e81b2a06 100644 - third_party/http-parser - third_party/minizip - third_party/mt19937_64 +- third_party/rapidjson/rapidjson +- third_party/sparsehash/src) + third_party/curl # FIXME: Use conan package + third_party/hdr_histogram # FIXME: Use conan package + third_party/mt19937_64 # FIXME: Use conan package -+ third_party/sparsehash/src) # FIXME: Use conan package - third_party/rapidjson/rapidjson -- third_party/sparsehash/src) ++ third_party/sparsehash/src # FIXME: Use conan package ++) list(APPEND INCLUDE_DIRS ${CASS_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) -@@ -69,12 +109,6 @@ if(WIN32) +@@ -69,12 +100,6 @@ if(WIN32) endif() endif() @@ -112,40 +157,27 @@ index 06b84b759..7e81b2a06 100644 #------------------------------ # Build configured header #------------------------------ -@@ -130,11 +164,11 @@ if(CASS_BUILD_SHARED) - add_library(cassandra SHARED +@@ -131,8 +156,7 @@ if(CASS_BUILD_SHARED) ${SOURCES} $ -- $ + $ - $ - $) -+ $) ++ ) target_link_libraries(cassandra ${CASS_LIBS}) -- target_include_directories(cassandra PRIVATE ${INCLUDE_DIRS} ${CASS_INCLUDES}) -+ target_include_directories(cassandra PRIVATE ${INCLUDE_DIRS}) -+ -+ conan_target_link_libraries(cassandra) - - set_target_properties(cassandra PROPERTIES OUTPUT_NAME cassandra) - set_target_properties(cassandra PROPERTIES VERSION ${PROJECT_VERSION_STRING} SOVERSION ${PROJECT_VERSION_MAJOR}) -@@ -167,11 +201,12 @@ if(CASS_BUILD_STATIC) - add_library(cassandra_static STATIC + target_include_directories(cassandra PRIVATE ${INCLUDE_DIRS} ${CASS_INCLUDES}) + +@@ -168,8 +192,7 @@ if(CASS_BUILD_STATIC) ${SOURCES} $ -- $ + $ - $ - $) -+ $) -+ ++ ) target_link_libraries(cassandra_static ${CASS_LIBS}) -- target_include_directories(cassandra_static PRIVATE ${INCLUDE_DIRS} ${CASS_INCLUDES}) -+ target_include_directories(cassandra_static PRIVATE ${INCLUDE_DIRS}) -+ -+ conan_target_link_libraries(cassandra_static) - - set_target_properties(cassandra_static PROPERTIES OUTPUT_NAME cassandra_static) - set_target_properties(cassandra_static PROPERTIES VERSION ${PROJECT_VERSION_STRING} SOVERSION ${PROJECT_VERSION_MAJOR}) -@@ -274,11 +309,6 @@ if(CASS_BUILD_SHARED) + target_include_directories(cassandra_static PRIVATE ${INCLUDE_DIRS} ${CASS_INCLUDES}) + +@@ -274,11 +297,6 @@ if(CASS_BUILD_SHARED) endif() endif() endif() diff --git a/recipes/cassandra-cpp-driver/all/patches/2.15.3/fix-rapidjson.patch b/recipes/cassandra-cpp-driver/all/patches/2.15.3/fix-rapidjson.patch index 7c7b5d16994d7..91811710ffbe4 100644 --- a/recipes/cassandra-cpp-driver/all/patches/2.15.3/fix-rapidjson.patch +++ b/recipes/cassandra-cpp-driver/all/patches/2.15.3/fix-rapidjson.patch @@ -1,21 +1,5 @@ - src/CMakeLists.txt | 1 - - src/json.hpp | 8 ++++---- - 2 files changed, 4 insertions(+), 5 deletions(-) - -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 7e81b2a06..2f3229292 100644 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -89,7 +89,6 @@ list(APPEND INCLUDE_DIRS - third_party/hdr_histogram # FIXME: Use conan package - third_party/mt19937_64 # FIXME: Use conan package - third_party/sparsehash/src) # FIXME: Use conan package -- third_party/rapidjson/rapidjson - - list(APPEND INCLUDE_DIRS ${CASS_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) - diff --git a/src/json.hpp b/src/json.hpp -index 620536e55..6003f2521 100644 +index 620536e..6003f25 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -48,13 +48,13 @@ static void delete_(T* ptr) { diff --git a/recipes/cassandra-cpp-driver/all/patches/2.15.3/remove-attribute-for-msvc.patch b/recipes/cassandra-cpp-driver/all/patches/2.15.3/remove-attribute-for-msvc.patch new file mode 100644 index 0000000000000..216ee8df654e9 --- /dev/null +++ b/recipes/cassandra-cpp-driver/all/patches/2.15.3/remove-attribute-for-msvc.patch @@ -0,0 +1,18 @@ +diff --git a/src/third_party/sparsehash/src/sparsehash/internal/hashtable-common.h b/src/third_party/sparsehash/src/sparsehash/internal/hashtable-common.h +index bac2b88..e802b5c 100644 +--- a/src/third_party/sparsehash/src/sparsehash/internal/hashtable-common.h ++++ b/src/third_party/sparsehash/src/sparsehash/internal/hashtable-common.h +@@ -50,8 +50,13 @@ + _START_GOOGLE_NAMESPACE_ + + template struct SparsehashCompileAssert { }; ++#if defined(_MSC_VER) ++#define SPARSEHASH_COMPILE_ASSERT(expr, msg) \ ++ typedef SparsehashCompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1] ++#else + #define SPARSEHASH_COMPILE_ASSERT(expr, msg) \ + __attribute__((unused)) typedef SparsehashCompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1] ++#endif + + namespace sparsehash_internal { + diff --git a/recipes/cassandra-cpp-driver/all/patches/2.16.2/fix-cmake.patch b/recipes/cassandra-cpp-driver/all/patches/2.16.2/fix-cmake.patch new file mode 100644 index 0000000000000..5a69b0d7d12b1 --- /dev/null +++ b/recipes/cassandra-cpp-driver/all/patches/2.16.2/fix-cmake.patch @@ -0,0 +1,201 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index c615094..b10d9c9 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -164,7 +164,7 @@ endif() + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR + "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + # Enable C++11 support to use std::atomic +- if(CASS_USE_STD_ATOMIC) ++ if(1) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + endif() + +diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake +index 9052472..4701133 100644 +--- a/cmake/Dependencies.cmake ++++ b/cmake/Dependencies.cmake +@@ -21,28 +21,28 @@ if(NOT LIBUV_ROOT_DIR) + endif() + + # Ensure libuv was found +-find_package(Libuv "1.0.0") +-if(WIN32 AND NOT LIBUV_FOUND) ++find_package(libuv "1.0.0") ++if(WIN32 AND NOT libuv_FOUND) + message(STATUS "Unable to Locate libuv: Third party build step will be performed") + include(ExternalProject-libuv) +-elseif(NOT LIBUV_FOUND) ++elseif(NOT libuv_FOUND) + message(FATAL_ERROR "Unable to Locate libuv: libuv v1.0.0+ is required") + endif() + +-if(LIBUV_VERSION VERSION_LESS "1.0") +- message(FATAL_ERROR "Libuv version ${LIBUV_VERSION} is not " ++if(libuv_VERSION VERSION_LESS "1.0") ++ message(FATAL_ERROR "Libuv version ${libuv_VERSION} is not " + " supported. Please updgrade to libuv version 1.0 or greater in order to " + "utilize the driver.") + endif() + +-if(LIBUV_VERSION VERSION_LESS "1.6") +- message(WARNING "Libuv version ${LIBUV_VERSION} does not support custom " ++if(libuv_VERSION VERSION_LESS "1.6") ++ message(WARNING "Libuv version ${libuv_VERSION} does not support custom " + "memory allocators (version 1.6 or greater required)") + endif() + + # Assign libuv include and libraries +-set(CASS_INCLUDES ${CASS_INCLUDES} ${LIBUV_INCLUDE_DIRS}) +-set(CASS_LIBS ${CASS_LIBS} ${LIBUV_LIBRARIES}) ++set(CASS_INCLUDES ${CASS_INCLUDES} ${libuv_INCLUDE_DIRS}) ++set(CASS_LIBS ${CASS_LIBS} ${libuv_LIBRARIES}) + + # libuv and gtests require thread library + if(NOT WIN32) +@@ -192,3 +192,20 @@ if(CASS_USE_BOOST_ATOMIC) + endif() + endif() + ++#------------------------ ++# RapidJSON ++#------------------------ ++find_package(RapidJSON REQUIRED CONFIG) ++set(CASS_LIBS ${CASS_LIBS} rapidjson) ++ ++#------------------------ ++# http_parser ++#------------------------ ++find_package(http_parser REQUIRED CONFIG) ++set(CASS_LIBS ${CASS_LIBS} http_parser::http_parser) ++ ++#------------------------ ++# minizip ++#------------------------ ++find_package(minizip REQUIRED CONFIG) ++set(CASS_LIBS ${CASS_LIBS} minizip::minizip) +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index d662718..088a153 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -1,6 +1,42 @@ + include(CheckSymbolExists) + include(CheckCXXSourceCompiles) + ++#------------------------ ++# Libuv ++#------------------------ ++ ++if(NOT WIN32) ++ set(CMAKE_THREAD_PREFER_PTHREAD 1) ++ set(THREADS_PREFER_PTHREAD_FLAG 1) ++endif() ++ ++find_package(Threads REQUIRED) ++set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_THREAD_LIBS_INIT}") ++set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_THREAD_LIBS_INIT}") ++if(NOT WIN32 AND ${CMAKE_VERSION} VERSION_LESS "3.1.0") ++ # FindThreads in CMake versions < v3.1.0 do not have the THREADS_PREFER_PTHREAD_FLAG to prefer -pthread ++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread") ++ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread") ++endif() ++ ++#------------------------ ++# Boost ++#------------------------ ++ ++if(CASS_USE_BOOST_ATOMIC) ++ # Ensure Boost auto linking is disabled (defaults to auto linking on Windows) ++ if(WIN32) ++ add_definitions(-DBOOST_ALL_NO_LIB) ++ endif() ++ ++ # Determine if additional Boost definitions are required for driver/executables ++ if(NOT WIN32) ++ # Handle explicit initialization warning in atomic/details/casts ++ add_definitions(-Wno-missing-field-initializers) ++ endif() ++endif() ++ ++ + file(GLOB SOURCES *.cpp *.hpp) + + if(APPLE) +@@ -38,18 +74,14 @@ endif() + + add_subdirectory(third_party/curl) + add_subdirectory(third_party/hdr_histogram) +-add_subdirectory(third_party/http-parser) +-add_subdirectory(third_party/minizip) + add_subdirectory(third_party/sparsehash) + + list(APPEND INCLUDE_DIRS +- third_party/curl +- third_party/hdr_histogram +- third_party/http-parser +- third_party/minizip +- third_party/mt19937_64 +- third_party/rapidjson/rapidjson +- third_party/sparsehash/src) ++ third_party/curl # FIXME: Use conan package ++ third_party/hdr_histogram # FIXME: Use conan package ++ third_party/mt19937_64 # FIXME: Use conan package ++ third_party/sparsehash/src # FIXME: Use conan package ++) + + list(APPEND INCLUDE_DIRS ${CASS_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) + +@@ -69,13 +101,6 @@ if(WIN32) + endif() + endif() + +-if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wconversion -Wno-sign-conversion -Wno-shorten-64-to-32 -Wno-undefined-var-template -Werror") +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-implicit-int-float-conversion") +-elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") # To many superfluous warnings generated with GCC when using -Wconversion (see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=40752) +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror") +-endif() +- + #------------------------------ + # Build configured header + #------------------------------ +@@ -122,7 +147,6 @@ configure_file( + ${CASS_ROOT_DIR}/driver_config.hpp.in + ${CMAKE_CURRENT_SOURCE_DIR}/driver_config.hpp) + +- + #------------------------------ + # Targets + #------------------------------ +@@ -132,8 +156,7 @@ if(CASS_BUILD_SHARED) + ${SOURCES} + $ + $ +- $ +- $) ++ ) + target_link_libraries(cassandra ${CASS_LIBS}) + target_include_directories(cassandra PRIVATE ${INCLUDE_DIRS} ${CASS_INCLUDES}) + +@@ -169,8 +192,7 @@ if(CASS_BUILD_STATIC) + ${SOURCES} + $ + $ +- $ +- $) ++ ) + target_link_libraries(cassandra_static ${CASS_LIBS}) + target_include_directories(cassandra_static PRIVATE ${INCLUDE_DIRS} ${CASS_INCLUDES}) + +@@ -275,11 +297,6 @@ if(CASS_BUILD_SHARED) + endif() + endif() + endif() +- if(WIN32) +- install(FILES $ +- DESTINATION "${INSTALL_DLL_EXE_DIR}" +- OPTIONAL) +- endif() + endif() + + if(CASS_BUILD_STATIC) diff --git a/recipes/cassandra-cpp-driver/all/test_package/CMakeLists.txt b/recipes/cassandra-cpp-driver/all/test_package/CMakeLists.txt index 1a95218e3d7a5..4d590e1005c29 100644 --- a/recipes/cassandra-cpp-driver/all/test_package/CMakeLists.txt +++ b/recipes/cassandra-cpp-driver/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(cassandra-cpp-driver REQUIRED CONFIG) -add_executable(${PROJECT_NAME} main.cpp) - -conan_target_link_libraries(${PROJECT_NAME}) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE cassandra-cpp-driver::cassandra-cpp-driver) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/cassandra-cpp-driver/all/test_package/conanfile.py b/recipes/cassandra-cpp-driver/all/test_package/conanfile.py index 0399475aec987..a9fb96656f203 100644 --- a/recipes/cassandra-cpp-driver/all/test_package/conanfile.py +++ b/recipes/cassandra-cpp-driver/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -import os.path -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 CassandraCppDriverTestConan(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", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cassandra-cpp-driver/all/test_package/main.cpp b/recipes/cassandra-cpp-driver/all/test_package/test_package.cpp similarity index 100% rename from recipes/cassandra-cpp-driver/all/test_package/main.cpp rename to recipes/cassandra-cpp-driver/all/test_package/test_package.cpp diff --git a/recipes/duckdb/all/test_v1_package/CMakeLists.txt b/recipes/cassandra-cpp-driver/all/test_v1_package/CMakeLists.txt similarity index 100% rename from recipes/duckdb/all/test_v1_package/CMakeLists.txt rename to recipes/cassandra-cpp-driver/all/test_v1_package/CMakeLists.txt diff --git a/recipes/duckdb/all/test_v1_package/conanfile.py b/recipes/cassandra-cpp-driver/all/test_v1_package/conanfile.py similarity index 100% rename from recipes/duckdb/all/test_v1_package/conanfile.py rename to recipes/cassandra-cpp-driver/all/test_v1_package/conanfile.py diff --git a/recipes/cassandra-cpp-driver/config.yml b/recipes/cassandra-cpp-driver/config.yml index 9792bd17fcc93..c8b1c8ef4703a 100644 --- a/recipes/cassandra-cpp-driver/config.yml +++ b/recipes/cassandra-cpp-driver/config.yml @@ -1,3 +1,9 @@ versions: + "2.17.1": + folder: all + "2.17.0": + folder: all + "2.16.2": + folder: all "2.15.3": folder: all diff --git a/recipes/catch2/2.x.x/conandata.yml b/recipes/catch2/2.x.x/conandata.yml index a0d3adb7f0e99..9e23bc009801d 100644 --- a/recipes/catch2/2.x.x/conandata.yml +++ b/recipes/catch2/2.x.x/conandata.yml @@ -1,16 +1,19 @@ 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.10": + url: "https://github.com/catchorg/Catch2/archive/v2.13.10.tar.gz" + sha256: "d54a712b7b1d7708bc7a819a8e6e47b2fde9536f487b89ccbca295072a7d9943" "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 44ba8e97757aa..15b01852024f5 100644 --- a/recipes/catch2/2.x.x/conanfile.py +++ b/recipes/catch2/2.x.x/conanfile.py @@ -11,7 +11,7 @@ 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" @@ -45,21 +45,21 @@ def configure(self): self.options.rm_safe("fPIC") self.options.rm_safe("with_benchmark") - def package_id(self): - if not self.options.with_main: - self.info.clear() - def layout(self): cmake_layout(self, src_folder="src") + def package_id(self): + if not self.info.options.with_main: + self.info.clear() + def validate(self): 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.info.options.get_safe("with_main") and Version(self.version) < "2.13.4": + 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): - 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/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 56f2fde0dcab5..7cf72543951f1 100644 --- a/recipes/catch2/2.x.x/test_package/CMakeLists.txt +++ b/recipes/catch2/2.x.x/test_package/CMakeLists.txt @@ -1,31 +1,31 @@ cmake_minimum_required(VERSION 3.8) project(test_package LANGUAGES CXX) -find_package(Catch2 REQUIRED CONFIG) +enable_testing() -if(NOT WITH_PREFIX) - add_executable(test_package 000-CatchMain.cpp 100-Fix-Section.cpp) - target_link_libraries(test_package PRIVATE Catch2::Catch2) - target_compile_features(test_package PRIVATE cxx_std_11) +find_package(Catch2 REQUIRED CONFIG) - if(WITH_MAIN) - add_executable(standalone 200-standalone.cpp) - target_link_libraries(standalone PRIVATE Catch2::Catch2WithMain) - target_compile_features(standalone PRIVATE cxx_std_11) - if(WITH_BENCHMARK) - add_executable(benchmark 300-benchmark.cpp) - target_link_libraries(benchmark PRIVATE Catch2::Catch2WithMain) - target_compile_features(benchmark PRIVATE cxx_std_11) - 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) - target_compile_features(test_package PRIVATE cxx_std_11) + 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) - target_compile_features(standalone PRIVATE cxx_std_11) - 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 e5d217bf13ce5..cab6586354346 100644 --- a/recipes/catch2/2.x.x/test_package/conanfile.py +++ b/recipes/catch2/2.x.x/test_package/conanfile.py @@ -1,53 +1,33 @@ 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 -import os -import yaml +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" + settings = "os", "arch", "compiler", "build_type" generators = "CMakeDeps", "VirtualRunEnv" test_type = "explicit" - _tests_todo = [] - - @property - def _todos_filename(self): - return os.path.join(self.recipe_folder, self.folders.generators, "catch2_test_to_do.yml") + def layout(self): + cmake_layout(self) def requirements(self): self.requires(self.tested_reference_str) def generate(self): tc = CMakeToolchain(self) - catch_opts = self.dependencies[self.tested_reference_str].options - tc.variables["WITH_PREFIX"] = catch_opts.with_prefix - tc.variables["WITH_MAIN"] = catch_opts.with_main - tc.variables["WITH_BENCHMARK"] = not catch_opts.with_prefix and catch_opts.with_main and catch_opts.with_benchmark + 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() - # note: this is required as self.dependencies is not available in test() - self._tests_todo.append("test_package") - if catch_opts.with_main: - self._tests_todo.append("standalone") - if not catch_opts.with_prefix and catch_opts.with_main and catch_opts.with_benchmark: - self._tests_todo.append("benchmark") - - 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) cmake.configure() cmake.build() def test(self): - 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") + 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 index ba50d23310806..c23ed5cfe6d98 100644 --- a/recipes/catch2/2.x.x/test_v1_package/CMakeLists.txt +++ b/recipes/catch2/2.x.x/test_v1_package/CMakeLists.txt @@ -1,32 +1,10 @@ -cmake_minimum_required(VERSION 3.5) -project(test_package) +cmake_minimum_required(VERSION 3.1) +project(test_v1_package) -set(CMAKE_CXX_STANDARD 11) -set(CMAKE_CXX_STANDARD_REQUIRED ON) +enable_testing() include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(Catch2 REQUIRED) - -if(NOT WITH_PREFIX) - add_executable(test_package ../test_package/000-CatchMain.cpp ../test_package/100-Fix-Section.cpp) - target_link_libraries(test_package PRIVATE Catch2::Catch2) - - if(WITH_MAIN) - add_executable(standalone ../test_package/200-standalone.cpp) - target_link_libraries(standalone PRIVATE Catch2::Catch2WithMain) - if(WITH_BENCHMARK) - add_executable(benchmark ../test_package/300-benchmark.cpp) - target_link_libraries(benchmark PRIVATE Catch2::Catch2WithMain) - endif() - endif() -else() - add_executable(test_package ../test_package/000-CatchMain.cpp ../test_package/400-with-prefix.cpp) - target_link_libraries(test_package PRIVATE Catch2::Catch2) - - if(WITH_MAIN) - add_executable(standalone ../test_package/400-with-prefix.cpp) - target_link_libraries(standalone PRIVATE Catch2::Catch2WithMain) - endif() -endif() +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 index 26e54f7cba1f5..2ee47800e04e6 100644 --- a/recipes/catch2/2.x.x/test_v1_package/conanfile.py +++ b/recipes/catch2/2.x.x/test_v1_package/conanfile.py @@ -1,11 +1,9 @@ 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" + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" def build(self): cmake = CMake(self) @@ -17,8 +15,4 @@ def build(self): def test(self): if not tools.cross_building(self): - 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) + 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/conandata.yml b/recipes/catch2/3.x.x/conandata.yml index d013064190944..21b5c183917cb 100644 --- a/recipes/catch2/3.x.x/conandata.yml +++ b/recipes/catch2/3.x.x/conandata.yml @@ -1,4 +1,40 @@ sources: + "3.7.1": + url: "https://github.com/catchorg/Catch2/archive/v3.7.1.tar.gz" + sha256: "c991b247a1a0d7bb9c39aa35faf0fe9e19764213f28ffba3109388e62ee0269c" + "3.7.0": + url: "https://github.com/catchorg/Catch2/archive/v3.7.0.tar.gz" + sha256: "5b10cd536fa3818112a82820ce0787bd9f2a906c618429e7c4dea639983c8e88" + "3.6.0": + url: "https://github.com/catchorg/Catch2/archive/v3.6.0.tar.gz" + sha256: "485932259a75c7c6b72d4b874242c489ea5155d17efa345eb8cc72159f49f356" + "3.5.4": + url: "https://github.com/catchorg/Catch2/archive/v3.5.4.tar.gz" + sha256: "b7754b711242c167d8f60b890695347f90a1ebc95949a045385114165d606dbb" + "3.5.3": + url: "https://github.com/catchorg/Catch2/archive/v3.5.3.tar.gz" + sha256: "8d723b0535c94860ef8cf6231580fa47d67a3416757ecb10639e40d748ab6c71" + "3.5.2": + url: "https://github.com/catchorg/Catch2/archive/v3.5.2.tar.gz" + sha256: "269543a49eb76f40b3f93ff231d4c24c27a7e16c90e47d2e45bcc564de470c6e" + "3.5.1": + url: "https://github.com/catchorg/Catch2/archive/v3.5.1.tar.gz" + sha256: "49c3ca7a68f1c8ec71307736bc6ed14fec21631707e1be9af45daf4037e75a08" + "3.5.0": + url: "https://github.com/catchorg/Catch2/archive/v3.5.0.tar.gz" + sha256: "f6d4f8d78a9b59ec72a81d49f58d18eb317372ac07f8d9432710a079e69fd66a" + "3.4.0": + url: "https://github.com/catchorg/Catch2/archive/v3.4.0.tar.gz" + sha256: "122928b814b75717316c71af69bd2b43387643ba076a6ec16e7882bfb2dfacbb" + "3.3.2": + url: "https://github.com/catchorg/Catch2/archive/v3.3.2.tar.gz" + sha256: "8361907f4d9bff3ae7c1edb027f813659f793053c99b67837a0c0375f065bae2" + "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" diff --git a/recipes/catch2/3.x.x/conanfile.py b/recipes/catch2/3.x.x/conanfile.py index 37d159374b11a..5bc8657f4ad30 100644 --- a/recipes/catch2/3.x.x/conanfile.py +++ b/recipes/catch2/3.x.x/conanfile.py @@ -7,16 +7,17 @@ import os import textwrap -required_conan_version = ">=1.53.0" +required_conan_version = ">=1.54.0" class Catch2Conan(ConanFile): name = "catch2" description = "A modern, C++-native, header-only, framework for unit-tests, TDD and BDD" - topics = ("catch2", "unit-test", "tdd", "bdd") license = "BSL-1.0" - homepage = "https://github.com/catchorg/Catch2" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/catchorg/Catch2" + topics = ("catch2", "unit-test", "tdd", "bdd") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -24,6 +25,7 @@ class Catch2Conan(ConanFile): "with_prefix": [True, False], "default_reporter": [None, "ANY"], "console_width": [None, "ANY"], + "no_posix_signals": [True, False], } default_options = { "shared": False, @@ -31,7 +33,11 @@ class Catch2Conan(ConanFile): "with_prefix": False, "default_reporter": None, "console_width": "80", + "no_posix_signals": False, } + # disallow cppstd compatibility, as it affects the ABI in this library + # see https://github.com/conan-io/conan-center-index/issues/19008 + extension_properties = {"compatibility_cppstd": False} @property def _min_cppstd(self): @@ -71,10 +77,10 @@ def layout(self): cmake_layout(self, src_folder="src") def validate(self): - if self.info.settings.compiler.get_safe("cppstd"): + if self.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: + 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 doesn't support", ) @@ -89,7 +95,7 @@ def validate(self): f"got '{self.options.console_width}'") from e 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) @@ -101,6 +107,7 @@ def generate(self): tc.variables["CATCH_CONFIG_CONSOLE_WIDTH"] = self.options.console_width if self.options.default_reporter: tc.variables["CATCH_CONFIG_DEFAULT_REPORTER"] = self._default_reporter_str + tc.variables["CATCH_CONFIG_NO_POSIX_SIGNALS"] = self.options.no_posix_signals tc.generate() def build(self): diff --git a/recipes/catch2/config.yml b/recipes/catch2/config.yml index af0893d76f6a8..0c81c16ccdbcb 100644 --- a/recipes/catch2/config.yml +++ b/recipes/catch2/config.yml @@ -1,4 +1,28 @@ versions: + "3.7.1": + folder: 3.x.x + "3.7.0": + folder: 3.x.x + "3.6.0": + folder: 3.x.x + "3.5.4": + folder: 3.x.x + "3.5.3": + folder: 3.x.x + "3.5.2": + folder: 3.x.x + "3.5.1": + folder: 3.x.x + "3.5.0": + folder: 3.x.x + "3.4.0": + folder: 3.x.x + "3.3.2": + folder: 3.x.x + "3.3.1": + folder: 3.x.x + "3.3.0": + folder: 3.x.x "3.2.1": folder: 3.x.x "3.2.0": @@ -7,6 +31,8 @@ versions: folder: 3.x.x "3.0.1": folder: 3.x.x + "2.13.10": + folder: 2.x.x "2.13.9": folder: 2.x.x "2.13.8": diff --git a/recipes/cc65/all/conandata.yml b/recipes/cc65/all/conandata.yml index 0c7a25432a083..720b04e88ab10 100644 --- a/recipes/cc65/all/conandata.yml +++ b/recipes/cc65/all/conandata.yml @@ -8,11 +8,7 @@ sources: patches: "2.18": - patch_file: "patches/2.18-0001-no-embedded-paths-makefile.patch" - base_path: "source_subfolder" - patch_file: "patches/2.18-0002-libsrc-use-extension.patch" - base_path: "source_subfolder" "2.19": - patch_file: "patches/2.19-0001-no-embedded-paths-makefile.patch" - base_path: "source_subfolder" - patch_file: "patches/2.19-0002-libsrc-use-extension.patch" - base_path: "source_subfolder" diff --git a/recipes/cc65/all/conanfile.py b/recipes/cc65/all/conanfile.py index 242c1cf9eee44..360eeaca72cba 100644 --- a/recipes/cc65/all/conanfile.py +++ b/recipes/cc65/all/conanfile.py @@ -1,163 +1,150 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, MSBuild, tools -from conans.errors import ConanInvalidConfiguration import os +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import can_run +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 MSBuild, is_msvc, msvs_toolset, MSBuildToolchain + +required_conan_version = ">=1.53.0" + class Cc65Conan(ConanFile): name = "cc65" - url = "https://github.com/conan-io/conan-center-index" - homepage = "https://cc65.github.io/" description = "A freeware C compiler for 6502 based systems" license = "Zlib" - topics = ("conan", "cc65", "compiler", "cmos", "6502", "8bit") - exports_sources = "patches/**" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://cc65.github.io/" + topics = ("compiler", "cmos", "6502", "8bit") + package_type = "application" settings = "os", "arch", "compiler", "build_type" - _autotools = None - _source_subfolder = "source_subfolder" + def export_sources(self): + export_conandata_patches(self) def configure(self): - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd - if self.settings.compiler == "Visual Studio": - if self.settings.arch not in ("x86", "x86_64"): - raise ConanInvalidConfiguration("Invalid arch") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + if is_msvc(self.info): + if self.info.settings.arch == "x86_64": + self.info.settings.arch = "x86" + del self.info.settings.compiler + + def validate(self): + if not can_run(self): + raise ConanInvalidConfiguration( + f"Compiling for {self.settings.arch} is not supported. " + "cc65 needs to be able to run the built executables during the build process" + ) + if is_msvc(self): + if self.settings.arch not in ["x86", "x86_64"]: + raise ConanInvalidConfiguration(f"{self.settings.arch} is not supported on MSVC") if self.settings.arch == "x86_64": self.output.info("This recipe will build x86 instead of x86_64 (the binaries are compatible)") def build_requirements(self): - if self.settings.compiler == "Visual Studio" and not tools.which("make"): - self.build_requires("make/4.2.1") + if is_msvc(self): + self.tool_requires("make/4.4") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = self.name + "-" + self.version - os.rename(extracted_dir, self._source_subfolder) - - @property - def _datadir(self): - return os.path.join(self.package_folder, "bin", "share", "cc65") - - @property - def _samplesdir(self): - return os.path.join(self.package_folder, "samples") - - def _build_msvc(self): - msbuild = MSBuild(self) - msvc_platforms = { - "x86": "Win32", - } - arch = str(self.settings.arch) - if arch != "x86": - self.output.warn("{} detected: building x86 instead".format(self.settings.arch)) - arch = "x86" - - msbuild.build(os.path.join(self._source_subfolder, "src", "cc65.sln"), - build_type="Debug" if self.settings.build_type == "Debug" else "Release", - arch=arch, platforms=msvc_platforms) - autotools = self._configure_autotools() - with tools.chdir(os.path.join(self._source_subfolder, "libsrc")): - autotools.make() - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self) - return self._autotools - - @property - def _make_args(self): - datadir = self._datadir - prefix = self.package_folder - samplesdir = self._samplesdir - if tools.os_info.is_windows: - datadir = tools.unix_path(datadir) - prefix = tools.unix_path(prefix) - samplesdir = tools.unix_path(samplesdir) - args = [ - "PREFIX={}".format(prefix), - "datadir={}".format(datadir), - "samplesdir={}".format(samplesdir), + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + if is_msvc(self): + tc = MSBuildToolchain(self) + tc.generate() + tc = AutotoolsToolchain(self) + tc.make_args += [ + "PREFIX=/", + "datadir=/bin/share/cc65", + "samplesdir=/samples", ] if self.settings.os == "Windows": - args.append("EXE_SUFFIX=.exe") - return args - - def _build_autotools(self): - autotools = self._configure_autotools() - with tools.chdir(os.path.join(self._source_subfolder)): - autotools.make(args=self._make_args) + tc.make_args.append("EXE_SUFFIX=.exe") + tc.generate() def _patch_sources(self): - for patch in self.conan_data["patches"][self.version]: - tools.patch(**patch) - if self.settings.compiler == "Visual Studio": - with tools.chdir(os.path.join(self._source_subfolder, "src")): - for fn in os.listdir("."): - if not fn.endswith(".vcxproj"): - continue - tools.replace_in_file(fn, "v141", tools.msvs_toolset(self)) - tools.replace_in_file(fn, "10.0.16299.0", "") + apply_conandata_patches(self) + if is_msvc(self): + for vcxproj in self.source_path.joinpath("src").rglob("*.vcxproj"): + replace_in_file(self, vcxproj, "v141", msvs_toolset(self)) + replace_in_file(self, vcxproj, "10.0.16299.0", "") if self.settings.os == "Windows": # Add ".exe" suffix to calls from cl65 to other utilities - for fn, var in (("cc65", "CC65"), ("ca65", "CA65"), ("co65", "CO65"), ("ld65", "LD65"), ("grc65", "GRC")): - v = "{},".format(var).ljust(5) - tools.replace_in_file(os.path.join(self._source_subfolder, "src", "cl65", "main.c"), - "CmdInit (&{v} CmdPath, \"{n}\");".format(v=v, n=fn), - "CmdInit (&{v} CmdPath, \"{n}.exe\");".format(v=v, n=fn)) + for fn, var in [ + ("cc65", "CC65"), + ("ca65", "CA65"), + ("co65", "CO65"), + ("ld65", "LD65"), + ("grc65", "GRC"), + ]: + v = f"{var},".ljust(5) + replace_in_file(self, os.path.join(self.source_folder, "src", "cl65", "main.c"), + f'CmdInit (&{v} CmdPath, "{fn}");', + f'CmdInit (&{v} CmdPath, "{fn}.exe");') + # Fix mkdir failing on Windows due to -p being unavailable there + # https://github.com/conan-io/conan-center-index/pull/18873#issuecomment-1841989876 + replace_in_file(self, os.path.join(self.source_folder, "libsrc", "Makefile"), + r'MKDIR = mkdir $(subst /,\,$1)', + r'MKDIR = if not exist "$(subst /,\,$1)" mkdir "$(subst /,\,$1)"') def build(self): self._patch_sources() - if self.settings.compiler == "Visual Studio": - self._build_msvc() + if is_msvc(self): + msbuild = MSBuild(self) + msbuild.platform = "Win32" + msbuild.build_type = "Debug" if self.settings.build_type == "Debug" else "Release" + msbuild.build(sln=os.path.join(self.source_folder, "src", "cc65.sln")) + with chdir(self, os.path.join(self.source_folder, "libsrc")): + autotools = Autotools(self) + autotools.make() else: - self._build_autotools() - - def _package_msvc(self): - self.copy("*.exe", src=os.path.join(self._source_subfolder, "bin"), dst=os.path.join(self.package_folder, "bin"), keep_path=False) - for dir in ("asminc", "cfg", "include", "lib", "target"): - self.copy("*", src=os.path.join(self._source_subfolder, dir), dst=os.path.join(self._datadir, dir)) - - def _package_autotools(self): - autotools = self._configure_autotools() - with tools.chdir(os.path.join(self.build_folder, self._source_subfolder)): - autotools.install(args=self._make_args) - - tools.rmdir(self._samplesdir) - tools.rmdir(os.path.join(self.package_folder, "share")) + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.make() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - if self.settings.compiler == "Visual Studio": - self._package_msvc() + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + if is_msvc(self): + copy(self, "*.exe", + dst=os.path.join(self.package_folder, "bin"), + src=os.path.join(self.source_folder, "bin"), + keep_path=False) + for folder in ("asminc", "cfg", "include", "lib", "target"): + copy(self, "*", + dst=os.path.join(self.package_folder, "bin", "share", "cc65", folder), + src=os.path.join(self.source_folder, folder)) else: - self._package_autotools() - - def package_id(self): - del self.info.settings.compiler - if self.settings.compiler == "Visual Studio": - if self.settings.arch == "x86_64": - self.info.settings.arch = "x86" + with chdir(self, os.path.join(self.source_folder)): + autotools = Autotools(self) + autotools.install() + rmdir(self, os.path.join(self.package_path, "samples")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): - bindir = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: %s" % bindir) - self.env_info.PATH.append(bindir) - - self.output.info("Seting CC65_HOME environment variable: %s" % self._datadir) - self.env_info.CC65_HOME = self._datadir + self.cpp_info.frameworkdirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] + self.cpp_info.includedirs = [] bin_ext = ".exe" if self.settings.os == "Windows" else "" + bindir = os.path.join(self.package_folder, "bin") + self.buildenv_info.define_path("CC65_HOME", os.path.join(self.package_folder, "bin", "share", "cc65")) + self.buildenv_info.define_path("CC65", os.path.join(bindir, "cc65" + bin_ext)) + self.buildenv_info.define_path("AS65", os.path.join(bindir, "ca65" + bin_ext)) + self.buildenv_info.define_path("LD65", os.path.join(bindir, "cl65" + bin_ext)) - cc65_cc = os.path.join(bindir, "cc65" + bin_ext) - self.output.info("Seting CC65 environment variable: {}".format(cc65_cc)) - self.env_info.CC65 = cc65_cc - - cc65_as = os.path.join(bindir, "ca65" + bin_ext) - self.output.info("Seting AS65 environment variable: {}".format(cc65_as)) - self.env_info.AS65 = cc65_as - - cc65_ld = os.path.join(bindir, "cl65" + bin_ext) - self.output.info("Seting LD65 environment variable: {}".format(cc65_ld)) - self.env_info.LD65 = cc65_ld + # TODO: Legacy, to be removed on Conan 2.0 + self.env_info.PATH.append(bindir) + self.env_info.CC65_HOME = os.path.join(self.package_folder, "bin", "share", "cc65") + self.env_info.CC65 = os.path.join(bindir, "cc65" + bin_ext) + self.env_info.AS65 = os.path.join(bindir, "ca65" + bin_ext) + self.env_info.LD65 = os.path.join(bindir, "cl65" + bin_ext) diff --git a/recipes/cc65/all/test_package/conanfile.py b/recipes/cc65/all/test_package/conanfile.py index b930a6b2cce7f..d7ddd1a009806 100644 --- a/recipes/cc65/all/test_package/conanfile.py +++ b/recipes/cc65/all/test_package/conanfile.py @@ -1,33 +1,39 @@ -from conans import ConanFile, tools import os import shutil +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.files import mkdir, rm +from conan.tools.layout import basic_layout + class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - - exports_sources = "hello.c", "text.s" + generators = "VirtualRunEnv", "VirtualBuildEnv" + test_type = "explicit" _targets = ("c64", "apple2") + def build_requirements(self): + self.tool_requires(self.tested_reference_str) + + def layout(self): + basic_layout(self) + def build(self): - if not tools.cross_building(self.settings): - for src in self.exports_sources: + if can_run(self): + for src in ["hello.c", "text.s"]: shutil.copy(os.path.join(self.source_folder, src), os.path.join(self.build_folder, src)) for target in self._targets: - output = "hello_{}".format(target) - tools.mkdir(target) - try: - # Try removing the output file to give confidence it is created by cc65 - os.unlink(output) - except FileNotFoundError: - pass - self.run("{p} -O -t {t} hello.c -o {t}/hello.s".format(p=os.environ["CC65"], t=target)) - self.run("{p} -t {t} {t}/hello.s -o {t}/hello.o".format(p=os.environ["AS65"], t=target)) - self.run("{p} -t {t} text.s -o {t}/text.o".format(p=os.environ["AS65"], t=target)) - self.run("{p} -o {o} -t {t} {t}/hello.o {t}/text.o {t}.lib".format(o=output, p=os.environ["LD65"], t=target)) + output = f"hello_{target}" + mkdir(self, target) + rm(self, output, self.build_folder) + self.run(f"cc65 -O -t {target} hello.c -o {target}/hello.s") + self.run(f"ca65 -t {target} {target}/hello.s -o {target}/hello.o") + self.run(f"ca65 -t {target} text.s -o {target}/text.o") + self.run(f"ld65 -o {output} -t {target} {target}/hello.o {target}/text.o {target}.lib") def test(self): - if not tools.cross_building(self.settings): + if can_run(self): for target in self._targets: - assert os.path.isfile("hello_{}".format(target)) + assert os.path.isfile(f"hello_{target}") diff --git a/recipes/ccache/all/CMakeLists.txt b/recipes/ccache/all/CMakeLists.txt deleted file mode 100644 index b71c882d9d33f..0000000000000 --- a/recipes/ccache/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/ccache/all/conandata.yml b/recipes/ccache/all/conandata.yml index ed2c1276132d0..9dd38ae4846da 100644 --- a/recipes/ccache/all/conandata.yml +++ b/recipes/ccache/all/conandata.yml @@ -1,14 +1,13 @@ sources: - "4.6": - url: "https://github.com/ccache/ccache/releases/download/v4.6/ccache-4.6.tar.xz" - sha256: "3d2bb860f4359169e640f60cf7cc11da5fab5fb9aed55230d78141e49c3945e9" - "4.5.1": - url: "https://github.com/ccache/ccache/releases/download/v4.5.1/ccache-4.5.1.tar.xz" - sha256: "51186ebe0326365f4e6131e1caa8911de7da4aa6718efc00680322d63a759517" -patches: - "4.6": - - patch_file: "patches/0001-fix-cmake-4.6.patch" - base_path: "source_subfolder" - "4.5.1": - - patch_file: "patches/0001-fix-cmake-4.5.1.patch" - base_path: "source_subfolder" + "4.10.2": + url: "https://github.com/ccache/ccache/releases/download/v4.10.2/ccache-4.10.2.tar.gz" + sha256: "108100960bb7e64573ea925af2ee7611701241abb36ce0aae3354528403a7d87" + "4.10": + url: "https://github.com/ccache/ccache/releases/download/v4.10/ccache-4.10.tar.gz" + sha256: "16972ba62c8499045edc3ae7d7b8a0b419a961567f5ff0f01bf5a44194204775" + "4.9.1": + url: "https://github.com/ccache/ccache/releases/download/v4.9.1/ccache-4.9.1.tar.xz" + sha256: "4c03bc840699127d16c3f0e6112e3f40ce6a230d5873daa78c60a59c7ef59d25" + "4.8.3": + url: "https://github.com/ccache/ccache/releases/download/v4.8.3/ccache-4.8.3.tar.xz" + sha256: "e47374c810b248cfca3665ee1d86c7c763ffd68d9944bc422d9c1872611f2b11" diff --git a/recipes/ccache/all/conanfile.py b/recipes/ccache/all/conanfile.py index 8da0d74ff87ef..8eb6bcbaa6c38 100644 --- a/recipes/ccache/all/conanfile.py +++ b/recipes/ccache/all/conanfile.py @@ -1,23 +1,27 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -import functools +from conan import ConanFile +from conan.tools.cmake import cmake_layout, CMake, CMakeToolchain, CMakeDeps +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import copy, get +from conan.tools.build import check_min_cppstd +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.55.0" class CcacheConan(ConanFile): name = "ccache" + package_type = "application" description = ( "Ccache (or “ccacheâ€) is a compiler cache. It speeds up recompilation " "by caching previous compilations and detecting when the same " "compilation is being done again." ) license = "GPL-3.0-or-later" - topics = ("ccache", "compiler-cache", "recompilation") + topics = ("compiler-cache", "recompilation", "cache", "compiler") homepage = "https://ccache.dev" url = "https://github.com/conan-io/conan-center-index" - settings = "os", "arch", "compiler", "build_type" options = { "redis_storage_backend": [True, False], @@ -26,88 +30,94 @@ class CcacheConan(ConanFile): "redis_storage_backend": True, } - generators = "cmake", "cmake_find_package_multi" - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - @property def _min_cppstd(self): - return "17" if self._is_msvc else "14" + return "17" @property def _compilers_minimum_version(self): return { - "gcc": "6", - "clang": "6", - "apple-clang": "10", - "Visual Studio": "15.7" if tools.Version(self.version) < "4.6" else "16.2", + "gcc": "8", + "clang": "9", + "apple-clang": "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"]) + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("zstd/1.5.2") + self.requires("zstd/1.5.5") if self.options.redis_storage_backend: - self.requires("hiredis/1.0.2") - - def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, self._min_cppstd) + self.requires("hiredis/1.1.0") - 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] + if Version(self.version) >= "4.10": + self.requires("fmt/10.2.1") + self.requires("xxhash/[~0.8]") - 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( - "{} requires C++{}, which your compiler does not support.".format(self.name, self._min_cppstd) - ) - - def package_id(self): - del self.info.settings.compiler + 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." + ) + if self.settings.compiler== "clang" and Version(self.settings.compiler.version).major == "11" and \ + self.settings.compiler.libcxx == "libstdc++": + raise ConanInvalidConfiguration(f"{self.ref} requires C++ filesystem library, that is not supported by Clang 11 + libstdc++.") + + if self.settings.os == "Windows" and self.settings.arch == "armv8" and Version(self.version) < "4.10": + raise ConanInvalidConfiguration("ccache does not support ARMv8 on Windows before version 4.10") def build_requirements(self): - if hasattr(self, "settings_build") and tools.cross_building(self) and \ - self.settings.os == "Macos" and self.settings.arch == "armv8": - self.build_requires("cmake/3.22.0") + self.tool_requires("cmake/[>=3.15 <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["REDIS_STORAGE_BACKEND"] = self.options.redis_storage_backend + tc.variables["HIREDIS_FROM_INTERNET"] = False + tc.variables["ZSTD_FROM_INTERNET"] = False + tc.variables["ENABLE_DOCUMENTATION"] = False + tc.variables["ENABLE_TESTING"] = False + tc.variables["STATIC_LINK"] = False # Don't link static runtimes and let Conan handle it + tc.generate() + + deps = CMakeDeps(self) + if Version(self.version) >= "4.10": + deps.set_property("fmt", "cmake_file_name", "Fmt") + deps.set_property("fmt", "cmake_find_mode", "module") + deps.set_property("fmt", "cmake_target_name", "dep_fmt") + deps.set_property("zstd", "cmake_file_name", "Zstd") + deps.set_property("zstd", "cmake_target_name", "dep_zstd") + deps.set_property("hiredis", "cmake_file_name", "Hiredis") + deps.set_property("hiredis", "cmake_target_name", "dep_hiredis") + else: + deps.set_property("hiredis", "cmake_target_name", "HIREDIS::HIREDIS") + deps.set_property("zstd", "cmake_target_name", "ZSTD::ZSTD") + deps.set_property("zstd", "cmake_find_mode", "module") + deps.set_property("hiredis", "cmake_find_mode", "module") + deps.generate() - @functools.lru_cache(1) - def _configure_cmake(self): + def build(self): cmake = CMake(self) - cmake.definitions["REDIS_STORAGE_BACKEND"] = self.options.redis_storage_backend - cmake.definitions["ENABLE_DOCUMENTATION"] = False - cmake.definitions["ENABLE_TESTING"] = 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("GPL-*.txt", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "*GPL-*.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.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) diff --git a/recipes/ccache/all/patches/0001-fix-cmake-4.5.1.patch b/recipes/ccache/all/patches/0001-fix-cmake-4.5.1.patch deleted file mode 100644 index ba4c4b6a18286..0000000000000 --- a/recipes/ccache/all/patches/0001-fix-cmake-4.5.1.patch +++ /dev/null @@ -1,63 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -97,12 +97,12 @@ if(MSVC AND NOT CMAKE_TOOLCHAIN_FILE MATCHES "vcpkg|conan") - endif() - - option(ZSTD_FROM_INTERNET "Download and use libzstd from the Internet" ${ZSTD_FROM_INTERNET_DEFAULT}) --find_package(zstd 1.1.2 REQUIRED) -+find_package(zstd REQUIRED CONFIG) - - option(REDIS_STORAGE_BACKEND "Enable Redis secondary storage" ON) - if(REDIS_STORAGE_BACKEND) - option(HIREDIS_FROM_INTERNET "Download and use libhiredis from the Internet" ${HIREDIS_FROM_INTERNET_DEFAULT}) -- find_package(hiredis 0.13.3 REQUIRED) -+ find_package(hiredis REQUIRED CONFIG) - endif() - - # ---- a/cmake/GenerateConfigurationFile.cmake -+++ b/cmake/GenerateConfigurationFile.cmake -@@ -104,5 +104,5 @@ if(HAVE_SYS_MMAN_H AND HAVE_PTHREAD_MUTEXATTR_SETPSHARED) - set(INODE_CACHE_SUPPORTED 1) - endif() - --configure_file(${CMAKE_SOURCE_DIR}/cmake/config.h.in -+configure_file(${PROJECT_SOURCE_DIR}/cmake/config.h.in - ${CMAKE_BINARY_DIR}/config.h @ONLY) ---- a/cmake/GenerateVersionFile.cmake -+++ b/cmake/GenerateVersionFile.cmake -@@ -1,4 +1,4 @@ - configure_file( -- ${CMAKE_SOURCE_DIR}/cmake/version.cpp.in -+ ${PROJECT_SOURCE_DIR}/cmake/version.cpp.in - ${CMAKE_BINARY_DIR}/src/version.cpp - @ONLY) ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -27,7 +27,7 @@ set( - execute.cpp - hashutil.cpp - language.cpp -- version.cpp -+ ${CMAKE_BINARY_DIR}/src/version.cpp - ) - - if(INODE_CACHE_SUPPORTED) -@@ -65,7 +65,7 @@ set(THREADS_PREFER_PTHREAD_FLAG ON) - find_package(Threads REQUIRED) - target_link_libraries( - ccache_framework -- PRIVATE standard_settings standard_warnings ZSTD::ZSTD Threads::Threads third_party -+ PRIVATE standard_settings standard_warnings $,zstd::libzstd_shared,zstd::libzstd_static> Threads::Threads third_party - ) - - target_include_directories(ccache_framework PRIVATE ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) -@@ -74,7 +74,7 @@ if(REDIS_STORAGE_BACKEND) - target_compile_definitions(ccache_framework PRIVATE -DHAVE_REDIS_STORAGE_BACKEND) - target_link_libraries( - ccache_framework -- PUBLIC standard_settings standard_warnings HIREDIS::HIREDIS third_party -+ PUBLIC standard_settings standard_warnings hiredis::hiredis third_party - ) - endif() - diff --git a/recipes/ccache/all/patches/0001-fix-cmake-4.6.patch b/recipes/ccache/all/patches/0001-fix-cmake-4.6.patch deleted file mode 100644 index 3b482d24c1c3b..0000000000000 --- a/recipes/ccache/all/patches/0001-fix-cmake-4.6.patch +++ /dev/null @@ -1,63 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -96,12 +96,12 @@ if(MSVC AND NOT CMAKE_TOOLCHAIN_FILE MATCHES "vcpkg|conan") - endif() - - option(ZSTD_FROM_INTERNET "Download and use libzstd from the Internet" ${ZSTD_FROM_INTERNET_DEFAULT}) --find_package(zstd 1.1.2 REQUIRED) -+find_package(zstd REQUIRED CONFIG) - - option(REDIS_STORAGE_BACKEND "Enable Redis secondary storage" ON) - if(REDIS_STORAGE_BACKEND) - option(HIREDIS_FROM_INTERNET "Download and use libhiredis from the Internet" ${HIREDIS_FROM_INTERNET_DEFAULT}) -- find_package(hiredis 0.13.3 REQUIRED) -+ find_package(hiredis REQUIRED CONFIG) - endif() - - # ---- a/cmake/GenerateConfigurationFile.cmake -+++ b/cmake/GenerateConfigurationFile.cmake -@@ -106,5 +106,5 @@ if(HAVE_SYS_MMAN_H AND HAVE_PTHREAD_MUTEXATTR_SETPSHARED) - set(INODE_CACHE_SUPPORTED 1) - endif() - --configure_file(${CMAKE_SOURCE_DIR}/cmake/config.h.in -+configure_file(${PROJECT_SOURCE_DIR}/cmake/config.h.in - ${CMAKE_BINARY_DIR}/config.h @ONLY) ---- a/cmake/GenerateVersionFile.cmake -+++ b/cmake/GenerateVersionFile.cmake -@@ -1,4 +1,4 @@ - configure_file( -- ${CMAKE_SOURCE_DIR}/cmake/version.cpp.in -+ ${PROJECT_SOURCE_DIR}/cmake/version.cpp.in - ${CMAKE_BINARY_DIR}/src/version.cpp - @ONLY) ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -26,7 +26,7 @@ set( - execute.cpp - hashutil.cpp - language.cpp -- version.cpp -+ ${CMAKE_BINARY_DIR}/src/version.cpp - ) - - if(INODE_CACHE_SUPPORTED) -@@ -64,7 +64,7 @@ set(THREADS_PREFER_PTHREAD_FLAG ON) - find_package(Threads REQUIRED) - target_link_libraries( - ccache_framework -- PRIVATE standard_settings standard_warnings ZSTD::ZSTD Threads::Threads third_party -+ PRIVATE standard_settings standard_warnings $,zstd::libzstd_shared,zstd::libzstd_static> Threads::Threads third_party - ) - - target_include_directories(ccache_framework PRIVATE ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) -@@ -73,7 +73,7 @@ if(REDIS_STORAGE_BACKEND) - target_compile_definitions(ccache_framework PRIVATE -DHAVE_REDIS_STORAGE_BACKEND) - target_link_libraries( - ccache_framework -- PUBLIC standard_settings standard_warnings HIREDIS::HIREDIS third_party -+ PUBLIC standard_settings standard_warnings hiredis::hiredis third_party - ) - endif() - diff --git a/recipes/ccache/all/test_package/conanfile.py b/recipes/ccache/all/test_package/conanfile.py index e357214905abd..2239cf70535aa 100644 --- a/recipes/ccache/all/test_package/conanfile.py +++ b/recipes/ccache/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 = "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("ccache --version", run_environment=True) + if can_run(self): + self.run("ccache --version") diff --git a/recipes/ccache/all/test_v1_package/conanfile.py b/recipes/ccache/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..e357214905abd --- /dev/null +++ b/recipes/ccache/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("ccache --version", run_environment=True) diff --git a/recipes/ccache/config.yml b/recipes/ccache/config.yml index dd431bc687e88..44eb509af69d9 100644 --- a/recipes/ccache/config.yml +++ b/recipes/ccache/config.yml @@ -1,5 +1,9 @@ versions: - "4.6": + "4.10.2": folder: all - "4.5.1": + "4.10": + folder: all + "4.9.1": + folder: all + "4.8.3": folder: all diff --git a/recipes/ccfits/all/conanfile.py b/recipes/ccfits/all/conanfile.py index c9d53caa2f748..ddf9d5732efd3 100644 --- a/recipes/ccfits/all/conanfile.py +++ b/recipes/ccfits/all/conanfile.py @@ -1,21 +1,21 @@ -from conan import ConanFile +from conan import ConanFile, conan_version 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.52.0" +required_conan_version = ">=1.54.0" class CcfitsConan(ConanFile): name = "ccfits" description = "CCfits is an object oriented interface to the cfitsio library." - license = "ISC" - topics = ("ccfits", "fits", "image", "nasa", "astronomy", "astrophysics", "space") + license = "CFITSIO" + topics = ("fits", "image", "nasa", "astronomy", "astrophysics", "space") homepage = "https://heasarc.gsfc.nasa.gov/fitsio/ccfits" url = "https://github.com/conan-io/conan-center-index" - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -35,32 +35,35 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("cfitsio/4.1.0") + # transitive_headers: CCfits/CCfits.h includes fitsio.h + self.requires("cfitsio/4.2.0", transitive_headers=True) def validate_build(self): if Version(self.version) >= "2.6": if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, 11) + else: + if conan_version >= "2": + # FIXME: c3i linter complains, but function is there + # https://docs.conan.io/2.0/reference/tools/build.html?highlight=check_min_cppstd#conan-tools-build-check-max-cppstd + import sys + check_max_cppstd = getattr(sys.modules["conan.tools.build"], "check_max_cppstd") + # C++17 and higher not supported in ccfits < 2.6 due to auto_ptr + check_max_cppstd(self, 14) 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) # 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() diff --git a/recipes/ccfits/all/test_v1_package/CMakeLists.txt b/recipes/ccfits/all/test_v1_package/CMakeLists.txt index 20c81e8e8eb12..0d20897301b68 100644 --- a/recipes/ccfits/all/test_v1_package/CMakeLists.txt +++ b/recipes/ccfits/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(ccfits REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE ccfits::ccfits) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) 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..85f3e81e772c2 100644 --- a/recipes/cctag/all/conandata.yml +++ b/recipes/cctag/all/conandata.yml @@ -1,8 +1,29 @@ sources: + "1.0.4": + url: "https://github.com/alicevision/CCTag/archive/refs/tags/v1.0.4.tar.gz" + sha256: "f4ced6138419f4ad09d62d4373738c172586c91068faff8bf08c2caa5e76d516" + "1.0.3": + url: "https://github.com/alicevision/CCTag/archive/refs/tags/v1.0.3.tar.gz" + sha256: "25396b03c4aa3c1be241a2a8518a29511cb4fff695caa5126203fbba8e8e444d" "1.0.1": url: "https://github.com/alicevision/CCTag/archive/refs/tags/v1.0.1.tar.gz" sha256: "ae8a819bc978eb13bb1061a204c214da835e56c9b7dc775237ed6b2191011dec" patches: + "1.0.3": + - patch_file: "patches/1.0.3-0001-honor-vc-runtime.patch" + patch_description: "Honor vc runtime" + patch_type: "conan" + - patch_file: "patches/1.0.3-0002-fix-boost-deprecated-includes.patch" + patch_description: "Fix deprecated Boost includes" + patch_type: "portability" "1.0.1": - - patch_file: "patches/0001-honor-vc-runtime.patch" - base_path: "source_subfolder" + - patch_file: "patches/1.0.1-0001-honor-vc-runtime.patch" + patch_description: "Honor vc runtime" + patch_type: "conan" + - patch_file: "patches/1.0.3-0002-fix-boost-deprecated-includes.patch" + patch_description: "Fix deprecated Boost includes" + patch_type: "portability" + - patch_file: "patches/1.0.1-0002-fix-missing-define.patch" + patch_description: "Add missing _GNU_SOURCE define" + patch_type: "bugfix" + patch_source: "https://github.com/alicevision/CCTag/commit/b49d710ab6870a865c20c943a65bd6dca906a184" diff --git a/recipes/cctag/all/conanfile.py b/recipes/cctag/all/conanfile.py index f770ba481240f..617a9b8ecd704 100644 --- a/recipes/cctag/all/conanfile.py +++ b/recipes/cctag/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.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 +from conan.tools.scm import Version import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class CCTagConan(ConanFile): @@ -15,6 +19,7 @@ class CCTagConan(ConanFile): homepage = "https://github.com/alicevision/CCTag" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -23,6 +28,7 @@ class CCTagConan(ConanFile): "visual_debug": [True, False], "no_cout": [True, False], "with_cuda": [True, False], + "cuda_cc_list": [None, "ANY"], } default_options = { "shared": False, @@ -31,18 +37,11 @@ class CCTagConan(ConanFile): "visual_debug": False, "no_cout": True, "with_cuda": False, + "cuda_cc_list": None, # e.g. "5.2;7.5;8.2", builds all up to 7.5 by default } - 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,13 +49,25 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def package_id(self): + if not self.info.options.with_cuda: + del self.info.options.cuda_cc_list + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("boost/1.78.0") - self.requires("eigen/3.4.0") - self.requires("onetbb/2020.3") - self.requires("opencv/4.5.5") + # boost/1.85.0 not compatible because of "error: 'numeric' is not a namespace-name" error + boost_version = "1.85.0" if Version(self.version) >= "1.0.4" else "1.84.0" + self.requires(f"boost/{boost_version}", transitive_headers=True, transitive_libs=True) + self.requires("eigen/3.4.0", transitive_headers=True) + if Version(self.version) >= "1.0.3": + self.requires("onetbb/2021.10.0") + else: + self.requires("onetbb/2020.3.3") + self.requires("opencv/4.9.0", transitive_headers=True, transitive_libs=True) @property def _required_boost_components(self): @@ -66,89 +77,109 @@ def _required_boost_components(self): ] 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.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 14) + if is_msvc_static_runtime(self) and not self.options.shared and self.dependencies["onetbb"].options.shared: + raise ConanInvalidConfiguration("this specific configuration is prevented due to internal c3i limitations") - # FIXME: add cuda support - if self.options.with_cuda: - raise ConanInvalidConfiguration("CUDA not supported yet") + 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], 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_BUILD_APPS"] = 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_WITH_CUDA"] = self.options.with_cuda + tc.variables["CCTAG_CUDA_CC_CURRENT_ONLY"] = False + tc.variables["CCTAG_NVCC_WARNINGS"] = False + if self.options.cuda_cc_list: + tc.variables["CCTAG_CUDA_CC_LIST_INIT"] = self.options.cuda_cc_list + 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 + # From https://github.com/alicevision/CCTag/pull/210/files CCTAG_CUDA_CC_LIST_INIT0 variable doesn't exists anymore in favor of a chooseCudaCC() cmake function + if Version(self.version) < "1.0.4": + # Remove very old CUDA compute capabilities + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "set(CCTAG_CUDA_CC_LIST_INIT0 3.5 3.7 5.0 5.2)", + "set(CCTAG_CUDA_CC_LIST_INIT0 5.0 5.2)") 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 = [ - "boost::atomic", "boost::chrono", "boost::date_time", "boost::exception", - "boost::filesystem", "boost::serialization", "boost::system", - "boost::thread", "boost::timer", "boost::math_c99", "eigen::eigen", - "onetbb::onetbb", "opencv::opencv_core", "opencv::opencv_videoio", - "opencv::opencv_imgproc", "opencv::opencv_imgcodecs", + "boost::atomic", + "boost::chrono", + "boost::date_time", + "boost::exception", + "boost::filesystem", + "boost::math_c99", + "boost::serialization", + "boost::system", + "boost::thread", + "boost::timer", + "eigen::eigen", + "onetbb::onetbb", + "opencv::opencv_core", + "opencv::opencv_imgcodecs", + "opencv::opencv_imgproc", + "opencv::opencv_videoio", ] if self.settings.os == "Windows": self.cpp_info.requires.append("boost::stacktrace_windbg") else: self.cpp_info.requires.append("boost::stacktrace_basic") + # CCTag links against shared CUDA runtime by default and does not use it in headers, + # so we don't need to explicitly link against it. + # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.names["cmake_find_package"] = "CCTag" self.cpp_info.names["cmake_find_package_multi"] = "CCTag" diff --git a/recipes/cctag/all/patches/0001-honor-vc-runtime.patch b/recipes/cctag/all/patches/1.0.1-0001-honor-vc-runtime.patch similarity index 100% rename from recipes/cctag/all/patches/0001-honor-vc-runtime.patch rename to recipes/cctag/all/patches/1.0.1-0001-honor-vc-runtime.patch diff --git a/recipes/cctag/all/patches/1.0.1-0002-fix-missing-define.patch b/recipes/cctag/all/patches/1.0.1-0002-fix-missing-define.patch new file mode 100644 index 0000000000000..26658b4f5bbf2 --- /dev/null +++ b/recipes/cctag/all/patches/1.0.1-0002-fix-missing-define.patch @@ -0,0 +1,29 @@ +From b49d710ab6870a865c20c943a65bd6dca906a184 Mon Sep 17 00:00:00 2001 +From: Simone Gasparini +Date: Fri, 7 Oct 2022 23:37:33 +0200 +Subject: [PATCH] [cctag] add osx fix _GNU_SOURCE + +as per +https://github.com/boostorg/stacktrace/issues/88 +--- + src/cctag/utils/Exceptions.hpp | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/src/cctag/utils/Exceptions.hpp b/src/cctag/utils/Exceptions.hpp +index 1e16b9b5..46067cff 100644 +--- a/src/cctag/utils/Exceptions.hpp ++++ b/src/cctag/utils/Exceptions.hpp +@@ -7,6 +7,13 @@ + */ + #ifndef _CCTAG_EXCEPTIONS_HPP_ + #define _CCTAG_EXCEPTIONS_HPP_ ++ ++// This fix is necessary on Apple and on Windows using cygwin to avoid the compilation error ++// #error "Boost.Stacktrace requires `_Unwind_Backtrace` function. ++// see https://github.com/boostorg/stacktrace/issues/88 ++#ifndef _GNU_SOURCE ++#define _GNU_SOURCE ++#endif + + #include + #include diff --git a/recipes/cctag/all/patches/1.0.3-0001-honor-vc-runtime.patch b/recipes/cctag/all/patches/1.0.3-0001-honor-vc-runtime.patch new file mode 100644 index 0000000000000..25d94454a5b93 --- /dev/null +++ b/recipes/cctag/all/patches/1.0.3-0001-honor-vc-runtime.patch @@ -0,0 +1,20 @@ +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -41,7 +41,7 @@ + else() + message(STATUS "Building in ${CMAKE_BUILD_TYPE} configuration") + endif() +- ++if(0) + # ensure the proper linker flags when building the static version on MSVC + if(MSVC AND NOT BUILD_SHARED_LIBS) + foreach(config "DEBUG" "RELEASE" "MINSIZEREL" "RELWITHDEBINFO") +@@ -65,7 +65,7 @@ + endif() + list(APPEND CUDA_NVCC_FLAGS -Xcompiler ${CCTAG_MVSC_LINKER}) + endif() +- ++endif() + set(CCTAG_CXX_STANDARD 14) + set(CMAKE_CXX_STANDARD ${CCTAG_CXX_STANDARD}) + set(CMAKE_CXX_STANDARD_REQUIRED ON) diff --git a/recipes/cctag/all/patches/1.0.3-0002-fix-boost-deprecated-includes.patch b/recipes/cctag/all/patches/1.0.3-0002-fix-boost-deprecated-includes.patch new file mode 100644 index 0000000000000..503defa4a3e7e --- /dev/null +++ b/recipes/cctag/all/patches/1.0.3-0002-fix-boost-deprecated-includes.patch @@ -0,0 +1,16 @@ +Fixes "This header is deprecated. Use instead.", etc. deprecation warnings. +--- src/cctag/CCTagMarkersBank.hpp ++++ src/cctag/CCTagMarkersBank.hpp +@@ -9,9 +9,9 @@ + #define VISION_MARKER_CCTAG_MARKERS_BANK_HPP + + #include +-#include +-#include +-#include ++#include ++#include ++#include + #include + + #include 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/cctag/config.yml b/recipes/cctag/config.yml index 715e55357a17b..20e7cbd11f28a 100644 --- a/recipes/cctag/config.yml +++ b/recipes/cctag/config.yml @@ -1,3 +1,7 @@ versions: + "1.0.4": + folder: all + "1.0.3": + folder: all "1.0.1": folder: all diff --git a/recipes/cctz/all/conandata.yml b/recipes/cctz/all/conandata.yml index 112fd00e61958..79ee8c2ac2c09 100644 --- a/recipes/cctz/all/conandata.yml +++ b/recipes/cctz/all/conandata.yml @@ -1,8 +1,20 @@ sources: + "2.4": + url: "https://github.com/google/cctz/archive/v2.4.tar.gz" + sha256: "e1a00957d472044808a24a26f1ba020f36dc26949a69c214562d96b74093adb3" "2.3": url: "https://github.com/google/cctz/archive/v2.3.tar.gz" sha256: "8615b20d4e33e02a271c3b93a3b208e3d7d5d66880f5f6208b03426e448f32db" patches: + "2.4": + - patch_file: "patches/2.4-0001-fix-installation.patch" + patch_description: "fix install destination" + patch_type: "portability" "2.3": - - patch_file: "patches/0001-fix-installation.patch" - - patch_file: "patches/0002-fix-frameworks-apple.patch" + - patch_file: "patches/2.3-0001-fix-installation.patch" + patch_description: "fix install destination" + patch_type: "portability" + - patch_file: "patches/2.3-0002-fix-frameworks-apple.patch" + patch_description: "link CoreFoundation on macOS" + patch_type: "portability" + patch_source: "https://github.com/google/cctz/pull/97" diff --git a/recipes/cctz/all/conanfile.py b/recipes/cctz/all/conanfile.py index ccf49ac66ee4e..ebb60c3eb62b6 100644 --- a/recipes/cctz/all/conanfile.py +++ b/recipes/cctz/all/conanfile.py @@ -1,22 +1,21 @@ 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 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.51.3" +required_conan_version = ">=1.53.0" class CCTZConan(ConanFile): name = "cctz" - url = "https://github.com/conan-io/conan-center-index" - homepage = "https://github.com/google/cctz" description = "C++ library for translating between absolute and civil times" - topics = ("cctz", "time", "timezones") license = "Apache-2.0" - + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/google/cctz" + topics = ("time", "timezones") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "fPIC": [True, False], @@ -30,8 +29,7 @@ class CCTZConan(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,25 +37,23 @@ 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("CCTZ requires 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) tc.variables["BUILD_TOOLS"] = self.options.build_tools tc.variables["BUILD_EXAMPLES"] = False tc.variables["BUILD_TESTING"] = False + tc.variables["BUILD_BENCHMARK"] = False # For shared msvc tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True # Relocatable shared lib on Macos @@ -80,10 +76,11 @@ def package_info(self): self.cpp_info.set_property("cmake_file_name", "cctz") self.cpp_info.set_property("cmake_target_name", "cctz::cctz") self.cpp_info.libs = ["cctz"] - if is_apple_os(self): + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") + elif is_apple_os(self): self.cpp_info.frameworks.append("CoreFoundation") + # TODO: to remove in conan v2 if self.options.build_tools: - 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")) diff --git a/recipes/cctz/all/patches/0001-fix-installation.patch b/recipes/cctz/all/patches/2.3-0001-fix-installation.patch similarity index 100% rename from recipes/cctz/all/patches/0001-fix-installation.patch rename to recipes/cctz/all/patches/2.3-0001-fix-installation.patch diff --git a/recipes/cctz/all/patches/0002-fix-frameworks-apple.patch b/recipes/cctz/all/patches/2.3-0002-fix-frameworks-apple.patch similarity index 100% rename from recipes/cctz/all/patches/0002-fix-frameworks-apple.patch rename to recipes/cctz/all/patches/2.3-0002-fix-frameworks-apple.patch diff --git a/recipes/cctz/all/patches/2.4-0001-fix-installation.patch b/recipes/cctz/all/patches/2.4-0001-fix-installation.patch new file mode 100644 index 0000000000000..14cc64c0dac26 --- /dev/null +++ b/recipes/cctz/all/patches/2.4-0001-fix-installation.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 472f26f..553876c 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -170,7 +170,7 @@ include(GNUInstallDirs) + install(TARGETS cctz + EXPORT ${PROJECT_NAME}-targets + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/cctz +- RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ) diff --git a/recipes/cctz/all/test_package/conanfile.py b/recipes/cctz/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/cctz/all/test_package/conanfile.py +++ b/recipes/cctz/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/cctz/all/test_v1_package/CMakeLists.txt b/recipes/cctz/all/test_v1_package/CMakeLists.txt index 46aaf8b80ff51..0d20897301b68 100644 --- a/recipes/cctz/all/test_v1_package/CMakeLists.txt +++ b/recipes/cctz/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(cctz REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE cctz::cctz) -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/cctz/config.yml b/recipes/cctz/config.yml index 3b05bfcc11215..fc444f7e23a6d 100644 --- a/recipes/cctz/config.yml +++ b/recipes/cctz/config.yml @@ -1,3 +1,5 @@ versions: + "2.4": + folder: all "2.3": folder: all diff --git a/recipes/cd3-boost-unit-definitions/all/conanfile.py b/recipes/cd3-boost-unit-definitions/all/conanfile.py index 23bdb146d0b4e..2b48b57aef4a1 100644 --- a/recipes/cd3-boost-unit-definitions/all/conanfile.py +++ b/recipes/cd3-boost-unit-definitions/all/conanfile.py @@ -10,13 +10,14 @@ required_conan_version = ">=1.52.0" -class PackageConan(ConanFile): +class Cd3BoostUnitDefinitionsConan(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") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -28,20 +29,17 @@ def _min_cppstd(self): def _compilers_minimum_version(self): return { "Visual Studio": "15", - "msvc": "19.0", + "msvc": "191", "gcc": "5", "clang": "5", "apple-clang": "5.1", } - def export_sources(self): - pass - def layout(self): - basic_layout(self) + basic_layout(self, src_folder="src") def requirements(self): - self.requires("boost/1.80.0", transitive_headers=True) + self.requires("boost/1.80.0") def package_id(self): self.info.clear() diff --git a/recipes/celero/all/conandata.yml b/recipes/celero/all/conandata.yml index 5c189657151ee..854be338c3c4d 100644 --- a/recipes/celero/all/conandata.yml +++ b/recipes/celero/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.9.0": + url: "https://github.com/DigitalInBlue/Celero/archive/v2.9.0.tar.gz" + sha256: "d59df84696e0dd58022d2c42837362c06eba6d1e29bac61f7b3143bc73d779e5" "2.8.2": url: "https://github.com/DigitalInBlue/Celero/archive/v2.8.2.tar.gz" sha256: "7d2131ba27ca5343b31f1e04777ed3e666e2ad7f785e79c960c872fc48cd5f88" @@ -6,11 +9,33 @@ sources: url: "https://github.com/DigitalInBlue/Celero/archive/v2.6.0.tar.gz" sha256: "a5b72da254f81d42369382ba3157229b6b32ebbb670a22b185f80db95535e66e" patches: + "2.9.0": + - patch_file: "patches/0005-2.9.0-drop-runtime.patch" + patch_description: "remove /MT /MD flags" + patch_type: "conan" + - patch_file: "patches/0006-2.9.0-fix-install-target.patch" + patch_description: "fix install target for Windows" + patch_type: "portability" "2.8.2": - patch_file: "patches/0004-2.8.2-missing-include.patch" + patch_description: "include memory header" + patch_type: "portability" + patch_source: "https://github.com/DigitalInBlue/Celero/pull/160" - patch_file: "patches/0005-drop-runtime.patch" + patch_description: "remove /MT /MD flags" + patch_type: "conan" "2.6.0": - patch_file: "patches/0001-cmake-install-pic-cxx-standard-sytem-libs.patch" + patch_description: "disable PIC, remove /std:c++14 flag, fix install path" + patch_type: "conan" - patch_file: "patches/0002-lowercase-include-system-libs-windows.patch" + patch_description: "lowercase include file names" + patch_type: "portability" - patch_file: "patches/0003-typo-declspec.patch" + patch_description: "fix typo declspec" + patch_type: "portability" + patch_source: "https://github.com/DigitalInBlue/Celero/pull/147" - patch_file: "patches/0004-2.6.0-missing-include.patch" + patch_description: "include memory header" + patch_type: "portability" + patch_source: "https://github.com/DigitalInBlue/Celero/pull/160" diff --git a/recipes/celero/all/conanfile.py b/recipes/celero/all/conanfile.py index 69aa65940de12..b3f3afce2b69a 100644 --- a/recipes/celero/all/conanfile.py +++ b/recipes/celero/all/conanfile.py @@ -2,22 +2,22 @@ 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.scm import Version import os import textwrap -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class CeleroConan(ConanFile): name = "celero" description = "C++ Benchmarking Library" license = "Apache-2.0" - topics = ("celero", "benchmark", "benchmark-tests", "measurements", "microbenchmarks") - homepage = "https://github.com/DigitalInBlue/Celero" url = "https://github.com/conan-io/conan-center-index" - + homepage = "https://github.com/DigitalInBlue/Celero" + topics = ("benchmark", "benchmark-tests", "measurements", "microbenchmarks") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -28,18 +28,22 @@ class CeleroConan(ConanFile): "fPIC": True, } + @property + def _min_cppstd(self): + return "14" + @property def _compilers_minimum_version(self): return { "gcc": "6", "Visual Studio": "14", + "msvc": "190", "clang": "3.4", "apple-clang": "5.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": @@ -47,21 +51,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, 14) - 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("celero requires C++14, which your compiler does not support.") + 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 build_requirements(self): + if Version(self.version) >= "2.9.0": + self.tool_requires("cmake/[>=3.22 <4]") + 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,6 +93,7 @@ def package(self): cmake = CMake(self) cmake.install() rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake", "celero")) # TODO: to remove in conan v2 once cmake_find_package_* generators removed self._create_cmake_module_alias_targets( @@ -113,7 +123,7 @@ def package_info(self): if not self.options.shared: self.cpp_info.defines = ["CELERO_STATIC"] if self.settings.os in ("FreeBSD", "Linux"): - self.cpp_info.system_libs = ["pthread"] + self.cpp_info.system_libs = ["pthread", "m"] elif self.settings.os == "Windows": self.cpp_info.system_libs = ["powrprof", "psapi"] diff --git a/recipes/celero/all/patches/0005-2.9.0-drop-runtime.patch b/recipes/celero/all/patches/0005-2.9.0-drop-runtime.patch new file mode 100644 index 0000000000000..8810f2aa3b2d3 --- /dev/null +++ b/recipes/celero/all/patches/0005-2.9.0-drop-runtime.patch @@ -0,0 +1,33 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 3f12ab9..73474a1 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -66,17 +66,17 @@ macro(CeleroSetDefaultCompilerOptions) + target_compile_options(${PROJECT_NAME} PRIVATE /permissive-) + target_compile_options(${PROJECT_NAME} PRIVATE /MP) + +- if (NOT CELERO_COMPILE_DYNAMIC_LIBRARIES) +- if(VCPKG_CRT_LINKAGE) +- if(VCPKG_CRT_LINKAGE STREQUAL "static") +- target_compile_options(${PROJECT_NAME} PRIVATE /MT$<$:d>) +- else() +- target_compile_options(${PROJECT_NAME} PRIVATE /MD$<$:d>) +- endif() +- else() +- target_compile_options(${PROJECT_NAME} PRIVATE /MT$<$:d>) +- endif() +- endif() ++ # if (NOT CELERO_COMPILE_DYNAMIC_LIBRARIES) ++ # if(VCPKG_CRT_LINKAGE) ++ # if(VCPKG_CRT_LINKAGE STREQUAL "static") ++ # target_compile_options(${PROJECT_NAME} PRIVATE /MT$<$:d>) ++ # else() ++ # target_compile_options(${PROJECT_NAME} PRIVATE /MD$<$:d>) ++ # endif() ++ # else() ++ # target_compile_options(${PROJECT_NAME} PRIVATE /MT$<$:d>) ++ # endif() ++ # endif() + + if(CELERO_ENABLE_WARNINGS_AS_ERRORS) + target_compile_options(${PROJECT_NAME} PRIVATE /WX) diff --git a/recipes/celero/all/patches/0006-2.9.0-fix-install-target.patch b/recipes/celero/all/patches/0006-2.9.0-fix-install-target.patch new file mode 100644 index 0000000000000..b8f71eb1f7916 --- /dev/null +++ b/recipes/celero/all/patches/0006-2.9.0-fix-install-target.patch @@ -0,0 +1,16 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 3f12ab9..8c0c2e2 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -274,8 +274,10 @@ install( + ) + install( + TARGETS celero +- DESTINATION ${CMAKE_INSTALL_LIBDIR} + EXPORT celero-targets ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + ) + install( + EXPORT celero-targets diff --git a/recipes/celero/all/test_package/conanfile.py b/recipes/celero/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/celero/all/test_package/conanfile.py +++ b/recipes/celero/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/celero/all/test_v1_package/CMakeLists.txt b/recipes/celero/all/test_v1_package/CMakeLists.txt index 5f83c8c27b4cd..0d20897301b68 100644 --- a/recipes/celero/all/test_v1_package/CMakeLists.txt +++ b/recipes/celero/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(Celero REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE celero) -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/celero/config.yml b/recipes/celero/config.yml index 3f32427faf7d1..0aacb0a653fc9 100644 --- a/recipes/celero/config.yml +++ b/recipes/celero/config.yml @@ -1,4 +1,6 @@ versions: + "2.9.0": + folder: all "2.8.2": folder: all "2.6.0": diff --git a/recipes/cereal/all/conanfile.py b/recipes/cereal/all/conanfile.py index 7523bebc550cf..c0fce5f2a6d25 100644 --- a/recipes/cereal/all/conanfile.py +++ b/recipes/cereal/all/conanfile.py @@ -11,10 +11,10 @@ class CerealConan(ConanFile): name = "cereal" description = "Serialization header-only library for C++11." license = "BSD-3-Clause" - topics = ("cereal", "header-only", "serialization", "cpp11") + topics = ("header-only", "serialization", "cpp11") homepage = "https://github.com/USCiLab/cereal" url = "https://github.com/conan-io/conan-center-index" - + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" options = { "thread_safe": [True, False], @@ -23,15 +23,14 @@ class CerealConan(ConanFile): "thread_safe": False, } - 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -81,9 +80,7 @@ def package_info(self): self.cpp_info.set_property("cmake_target_name", "cereal::cereal") self.cpp_info.set_property("cmake_target_aliases", ["cereal"]) # target before 1.3.1 self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] if self.options.thread_safe: self.cpp_info.defines = ["CEREAL_THREAD_SAFE=1"] if self.settings.os in ["Linux", "FreeBSD"]: diff --git a/recipes/cereal/all/test_package/conanfile.py b/recipes/cereal/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/cereal/all/test_package/conanfile.py +++ b/recipes/cereal/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/ceres-solver/all/CMakeLists.txt b/recipes/ceres-solver/all/CMakeLists.txt deleted file mode 100644 index 61f3d3b039e2b..0000000000000 --- a/recipes/ceres-solver/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/ceres-solver/all/conandata.yml b/recipes/ceres-solver/all/conandata.yml index 6ee161fbdfbf0..7118801d3af54 100644 --- a/recipes/ceres-solver/all/conandata.yml +++ b/recipes/ceres-solver/all/conandata.yml @@ -1,33 +1,43 @@ sources: + "2.2.0": + url: "http://ceres-solver.org/ceres-solver-2.2.0.tar.gz" + sha256: "48b2302a7986ece172898477c3bcd6deb8fb5cf19b3327bc49969aad4cede82d" "2.1.0": - url: https://github.com/ceres-solver/ceres-solver/archive/2.1.0.tar.gz - sha256: ccbd716a93f65d4cb017e3090ae78809e02f5426dce16d0ee2b4f8a4ba2411a8 + url: "http://ceres-solver.org/ceres-solver-2.1.0.tar.gz" + sha256: "f7d74eecde0aed75bfc51ec48c91d01fe16a6bf16bce1987a7073286701e2fc6" "2.0.0": - url: https://github.com/ceres-solver/ceres-solver/archive/2.0.0.tar.gz - sha256: 2ab0348e0f65fdf43bebcd325a1c73f7e8999691ee75e2a2981281931c42e9fa + url: "http://ceres-solver.org/ceres-solver-2.0.0.tar.gz" + sha256: "10298a1d75ca884aa0507d1abb0e0f04800a92871cd400d4c361b56a777a7603" "1.14.0": - url: https://github.com/ceres-solver/ceres-solver/archive/1.14.0.tar.gz - sha256: 1296330fcf1e09e6c2f926301916f64d4a4c5c0ff12d460a9bc5d4c48411518f - "1.13.0": - url: https://github.com/ceres-solver/ceres-solver/archive/1.13.0.tar.gz - sha256: 51ccb201b61ac71501fb6ccef158f078a750bc796ee6a271cd535cfe338202e5 + url: "http://ceres-solver.org/ceres-solver-1.14.0.tar.gz" + sha256: "4744005fc3b902fed886ea418df70690caa8e2ff6b5a90f3dd88a3d291ef8e8e" patches: + "2.2.0": + - patch_file: "patches/2.2.0-0001-find-libraries-conan.patch" + patch_description: "Robust dependencies handling" + patch_type: "conan" + - patch_file: "patches/2.2.0-0002-fix-mingw-build.patch" + patch_description: "Fix MinGW build" + patch_type: "portability" "2.1.0": - - patch_file: "patches/2.0.1-0001-find-glog-conan.patch" - base_path: "source_subfolder" - - patch_file: "patches/2.0.1-0002-find-glags-conan.patch" - base_path: "source_subfolder" - - patch_file: "patches/2.0.1-0003-fix-mingw-build.patch" - base_path: "source_subfolder" + - patch_file: "patches/2.1.0-0001-find-libraries-conan.patch" + patch_description: "Robust dependencies handling" + patch_type: "conan" + - patch_file: "patches/2.1.0-0002-fix-mingw-build.patch" + patch_description: "Fix MinGW build" + patch_type: "portability" "2.0.0": - patch_file: "patches/2.0.0-0001-find-libraries-conan.patch" - base_path: "source_subfolder" - - patch_file: "patches/2.0.0-0002-fix-eigen-version.patch" - base_path: "source_subfolder" - - patch_file: "patches/2.0.0-0003-fix-mingw-build.patch" - base_path: "source_subfolder" + patch_description: "Robust dependencies handling" + patch_type: "conan" + - patch_file: "patches/2.0.0-0002-fix-mingw-build.patch" + patch_description: "Fix MinGW build" + patch_type: "portability" "1.14.0": - patch_file: "patches/1.14.0-0001-find-libraries-conan.patch" - base_path: "source_subfolder" + patch_description: "Robust dependencies handling" + patch_type: "conan" - patch_file: "patches/1.14.0-0002-fix-msvc-c++17.patch" - base_path: "source_subfolder" + patch_description: "Fix compilation with C++17 standard and above" + patch_type: "portability" + patch_source: "https://github.com/ceres-solver/ceres-solver/commit/1e8e9452d0a7dfaf5697b544810798a58e35443e" diff --git a/recipes/ceres-solver/all/conanfile.py b/recipes/ceres-solver/all/conanfile.py index ab45710022fbe..b676ebea4436f 100644 --- a/recipes/ceres-solver/all/conanfile.py +++ b/recipes/ceres-solver/all/conanfile.py @@ -1,13 +1,19 @@ -from conan.tools.microsoft import msvc_runtime_flag -from conans import ConanFile, tools, CMake -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.apple import is_apple_os +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, export_conandata_patches, get, rmdir, save +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +from conan.tools.scm import Version +required_conan_version = ">=1.54.0" -class ceressolverConan(ConanFile): + +class CeressolverConan(ConanFile): name = "ceres-solver" license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" @@ -16,14 +22,15 @@ class ceressolverConan(ConanFile): "Ceres Solver is an open source C++ library for modeling " "and solving large, complicated optimization problems" ) - topics = ("optimization","non-linear least squares") + topics = ("optimization", "non-linear least squares") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], "use_glog": [True, False], #TODO Set to true once gflags with nothreads=False binaries are available. Using MINILOG has a big performance drawback. - "use_gflags": [True, False], + "use_gflags": [True, False, "deprecated"], "use_custom_blas": [True, False], "use_eigen_sparse": [True, False], "use_TBB": [True, False], @@ -35,7 +42,7 @@ class ceressolverConan(ConanFile): "shared": False, "fPIC": True, "use_glog": False, - "use_gflags": False, + "use_gflags": "deprecated", "use_custom_blas": True, "use_eigen_sparse": True, "use_TBB": False, @@ -44,145 +51,189 @@ class ceressolverConan(ConanFile): "use_schur_specializations": True, } - generators = "cmake" - @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + if Version(self.version) >= "2.2.0": + return "17" + if Version(self.version) >= "2.0.0": + return "14" + return "98" @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] + def _compilers_minimum_version(self): + return { + "14": { + "apple-clang": "5", + "clang": "5", + "gcc": "5", + "msvc": "190", + "Visual Studio": "14", + }, + "17": { + "apple-clang": "10", + "clang": "7", + "gcc": "8", + "msvc": "191", + "Visual Studio": "15", + }, + }.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": del self.options.fPIC - if tools.Version(self.version) >= "2.0": + if Version(self.version) >= "2.0": + del self.options.use_TBB del self.options.use_CXX11_threads del self.options.use_CXX11 def configure(self): if self.options.shared: - del self.options.fPIC - if self.options.use_gflags: - self.options["gflags"].nothreads = False + self.options.rm_safe("fPIC") + if self.options.use_gflags != "deprecated": + self.output.warning("use_gflags option is deprecated") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("eigen/3.4.0") + self.requires("eigen/3.4.0", transitive_headers=True) if self.options.use_glog: - self.requires("glog/0.5.0") - if self.options.use_gflags: - self.requires("gflags/2.2.2") - if self.options.use_TBB: + self.requires("glog/0.6.0", transitive_headers=True, transitive_libs=True) + if self.options.get_safe("use_TBB"): self.requires("onetbb/2020.3") - def _check_cxx14_supported(self): - min_compiler_version = { - "gcc": "5", - "Visual Studio": "14", - "clang": "5", - "apple-clang": "5", - }.get(str(self.settings.compiler)) - if not min_compiler_version: - self.output.warn("Unknown compiler. Presuming it supports c++14.") - elif tools.Version(self.settings.compiler.version) < min_compiler_version: - raise ConanInvalidConfiguration("Current compiler version does not support c++14") + def package_id(self): + del self.info.options.use_gflags def validate(self): - if self.settings.build_type == "Debug" and self.options.use_glog: - raise ConanInvalidConfiguration("Ceres-solver only links against the release version of glog") - if self.options.use_glog and not self.options.use_gflags: #At this stage we can't check the value of self.options["glog"].with_gflags so we asume it is true because is the default value - raise ConanInvalidConfiguration("To depend on glog built with gflags (Default behavior) set use_gflags=True, otherwise Ceres may fail to link due to missing gflags symbols.") - if self.options.use_gflags and self.options["gflags"].nothreads: - raise ConanInvalidConfiguration("Ceres-solver requires options gflags:nothreads=False") # This could use a source as to why - if tools.Version(self.version) >= "2.0": - # 1.x uses ceres-solver specific FindXXX.cmake modules - self.generators.append("cmake_find_package") - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 14) - self._check_cxx14_supported() + 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 build_requirements(self): + if Version(self.version) >= "2.2.0": + self.tool_requires("cmake/[>=3.16 <4]") 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) #You can check what these flags do in http://ceres-solver.org/installation.html - cmake.definitions["LIB_SUFFIX"] = "" - cmake.definitions["GFLAGS"] = self.options.use_gflags - cmake.definitions["BUILD_EXAMPLES"] = False #Requires gflags - cmake.definitions["BUILD_TESTING"] = False #Requires gflags - cmake.definitions["BUILD_DOCUMENTATION"] = False #Requires python modules Sphinx and sphinx-rtd-theme - cmake.definitions["CUSTOM_BLAS"] = self.options.use_custom_blas - cmake.definitions["GLOG_PREFER_EXPORTED_GLOG_CMAKE_CONFIGURATION"] = False #Set to false to Force CMake to use the conan-generated dependencies - cmake.definitions["EIGENSPARSE"] = self.options.use_eigen_sparse - cmake.definitions["SUITESPARSE"] = False #Optional. Not supported right now because SuiteSparse is not part of conan-index - cmake.definitions["LAPACK"] = False #Optional. Not supported right now because LAPACK is not part of conan-index - cmake.definitions["CXSPARSE"] = False #Optional. Not supported right now because CXSSPARSE is not part of conan-index - cmake.definitions["MINIGLOG"] = not self.options.use_glog - if not self.options.use_TBB: - cmake.definitions["CMAKE_DISABLE_FIND_PACKAGE_TBB"] = True - if tools.Version(self.version) < "2.0": - cmake.definitions["TBB"] = self.options.use_TBB - cmake.definitions["OPENMP"] = False - cmake.definitions["EIGEN_PREFER_EXPORTED_EIGEN_CMAKE_CONFIGURATION"] = False #Set to false to Force CMake to use the conan-generated dependencies - cmake.definitions["GFLAGS_PREFER_EXPORTED_GFLAGS_CMAKE_CONFIGURATION"] = False #Set to false to Force CMake to use the conan-generated dependencies - cmake.definitions["CXX11_THREADS"] = self.options.use_CXX11_threads - cmake.definitions["CXX11"] = self.options.use_CXX11 - cmake.definitions["SCHUR_SPECIALIZATIONS"] = self.options.use_schur_specializations - if self._is_msvc: - cmake.definitions["MSVC_USE_STATIC_CRT"] = "MT" in msvc_runtime_flag(self) - cmake.configure() - return cmake + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["MINIGLOG"] = not self.options.use_glog + tc.variables["GFLAGS"] = False # useless for the lib itself, gflags is not a direct dependency + tc.variables["SUITESPARSE"] = False + tc.variables["LAPACK"] = False + tc.variables["SCHUR_SPECIALIZATIONS"] = self.options.use_schur_specializations + tc.variables["CUSTOM_BLAS"] = self.options.use_custom_blas + tc.variables["EIGENSPARSE"] = self.options.use_eigen_sparse + tc.variables["BUILD_TESTING"] = False + tc.variables["BUILD_DOCUMENTATION"] = False + tc.variables["BUILD_EXAMPLES"] = False + tc.variables["BUILD_BENCHMARKS"] = False + + ceres_version = Version(self.version) + if ceres_version >= "2.2.0": + tc.variables["USE_CUDA"] = False + elif ceres_version >= "2.1.0": + tc.variables["CUDA"] = False + if ceres_version >= "2.2.0": + tc.variables["EIGENMETIS"] = False + if ceres_version >= "2.0.0": + tc.variables["PROVIDE_UNINSTALL_TARGET"] = False + if is_apple_os(self): + tc.variables["ACCELERATESPARSE"] = True + if ceres_version < "2.2.0": + tc.variables["CXSPARSE"] = False + if is_msvc(self): + tc.variables["MSVC_USE_STATIC_CRT"] = is_msvc_static_runtime(self) + if ceres_version < "2.1.0": + tc.variables["LIB_SUFFIX"] = "" + if ceres_version < "2.0.0": + tc.variables["CXX11"] = self.options.use_CXX11 + tc.variables["OPENMP"] = False + tc.variables["TBB"] = self.options.use_TBB + tc.variables["CXX11_THREADS"] = self.options.use_CXX11_threads + # IOS_DEPLOYMENT_TARGET variable was added to iOS.cmake file in 1.12.0 version + if self.settings.os == "iOS": + tc.variables["IOS_DEPLOYMENT_TARGET"] = self.settings.os.version + tc.generate() + + CMakeDeps(self).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")) - 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")) + self._create_cmake_module_variables(os.path.join(self.package_folder, self._module_variables_file_rel_path)) + + def _create_cmake_module_variables(self, module_file): + # Define several variables of upstream CMake config file which are not + # defined out of the box by CMakeDeps. + # See https://github.com/ceres-solver/ceres-solver/blob/master/cmake/CeresConfig.cmake.in + content = textwrap.dedent(f"""\ + set(CERES_FOUND TRUE) + set(CERES_VERSION {self.version}) + if(NOT DEFINED CERES_LIBRARIES) + set(CERES_LIBRARIES Ceres::ceres) + endif() + """) + save(self, module_file, content) + + @property + def _module_variables_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_file_name", "Ceres") self.cpp_info.set_property("cmake_target_name", "Ceres::ceres") + # see https://github.com/ceres-solver/ceres-solver/blob/2.2.0/cmake/CeresConfig.cmake.in#L334-L340 + self.cpp_info.set_property("cmake_target_aliases", ["ceres"]) + self.cpp_info.set_property("cmake_build_modules", [self._module_variables_file_rel_path]) libsuffix = "" if self.settings.build_type == "Debug": libsuffix = "-debug" # TODO: back to global scope in conan v2 once cmake_find_package* generators removed - self.cpp_info.components["ceres"].libs = ["ceres{}".format(libsuffix)] - self.cpp_info.components["ceres"].includedirs = ["include", os.path.join("include","ceres")] + self.cpp_info.components["ceres"].libs = [f"ceres{libsuffix}"] + self.cpp_info.components["ceres"].includedirs.append(os.path.join("include", "ceres")) if not self.options.use_glog: - self.cpp_info.components["ceres"].includedirs.append(os.path.join("include","ceres", "internal", "miniglog")) + self.cpp_info.components["ceres"].includedirs.append(os.path.join("include", "ceres", "internal", "miniglog")) if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["ceres"].system_libs.append("m") if self.options.get_safe("use_CXX11_threads", True): self.cpp_info.components["ceres"].system_libs.append("pthread") - elif tools.is_apple_os(self.settings.os): - if tools.Version(self.version) >= "2": - self.cpp_info.components["ceres"].frameworks = ["Accelerate"] + elif is_apple_os(self): + if Version(self.version) >= "2": + self.cpp_info.components["ceres"].frameworks.append("Accelerate") self.cpp_info.components["ceres"].requires = ["eigen::eigen"] if self.options.use_glog: self.cpp_info.components["ceres"].requires.append("glog::glog") - if self.options.use_gflags: - self.cpp_info.components["ceres"].requires.append("gflags::gflags") - if self.options.use_TBB: + if self.options.get_safe("use_TBB"): self.cpp_info.components["ceres"].requires.append("onetbb::onetbb") - libcxx = tools.stdcpp_library(self) - if libcxx: - self.cpp_info.components["ceres"].system_libs.append(libcxx) + if not self.options.shared: + libcxx = stdcpp_library(self) + if libcxx: + self.cpp_info.components["ceres"].system_libs.append(libcxx) # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.names["cmake_find_package"] = "Ceres" self.cpp_info.names["cmake_find_package_multi"] = "Ceres" + self.cpp_info.components["ceres"].build_modules["cmake_find_package"] = [self._module_variables_file_rel_path] + self.cpp_info.components["ceres"].build_modules["cmake_find_package_multi"] = [self._module_variables_file_rel_path] + self.cpp_info.components["ceres"].set_property("cmake_target_name", "Ceres::ceres") diff --git a/recipes/ceres-solver/all/patches/1.14.0-0001-find-libraries-conan.patch b/recipes/ceres-solver/all/patches/1.14.0-0001-find-libraries-conan.patch index bfca903ea78d1..6518cb4c5d884 100644 --- a/recipes/ceres-solver/all/patches/1.14.0-0001-find-libraries-conan.patch +++ b/recipes/ceres-solver/all/patches/1.14.0-0001-find-libraries-conan.patch @@ -1,114 +1,148 @@ ---- cmake/FindEigen.cmake -+++ cmake/FindEigen.cmake -@@ -180,12 +180,12 @@ - if (NOT EIGEN_FOUND) - # Search user-installed locations first, so that we prefer user installs - # to system installs where both exist. -- list(APPEND EIGEN_CHECK_INCLUDE_DIRS -- /usr/local/include -- /usr/local/homebrew/include # Mac OS X -- /opt/local/var/macports/software # Mac OS X. -- /opt/local/include -- /usr/include) -+ list(APPEND EIGEN_CHECK_INCLUDE_DIRS ${CMAKE_INCLUDE_PATH}) -+ #/usr/local/include -+ #/usr/local/homebrew/include # Mac OS X -+ #/opt/local/var/macports/software # Mac OS X. -+ #/opt/local/include -+ #/usr/include) - # Additional suffixes to try appending to each search path. - list(APPEND EIGEN_CHECK_PATH_SUFFIXES - eigen3 # Default root directory for Eigen. ---- cmake/FindGflags.cmake -+++ cmake/FindGflags.cmake -@@ -434,21 +434,21 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -209,40 +209,40 @@ endif (IOS) + unset(CERES_COMPILE_OPTIONS) - # Search user-installed locations first, so that we prefer user installs - # to system installs where both exist. -- list(APPEND GFLAGS_CHECK_INCLUDE_DIRS -- /usr/local/include -- /usr/local/homebrew/include # Mac OS X -- /opt/local/var/macports/software # Mac OS X. -- /opt/local/include -- /usr/include) -+ list(APPEND GFLAGS_CHECK_INCLUDE_DIRS ${CMAKE_INCLUDE_PATH}) -+ #/usr/local/include -+ #/usr/local/homebrew/include # Mac OS X -+ #/opt/local/var/macports/software # Mac OS X. -+ #/opt/local/include -+ #/usr/include) - list(APPEND GFLAGS_CHECK_PATH_SUFFIXES - gflags/include # Windows (for C:/Program Files prefix). - gflags/Include ) # Windows (for C:/Program Files prefix). + # Eigen. +-find_package(Eigen REQUIRED) +-if (EIGEN_FOUND) +- message("-- Found Eigen version ${EIGEN_VERSION}: ${EIGEN_INCLUDE_DIRS}") +- if (EIGEN_VERSION VERSION_LESS 3.1.0) ++find_package(Eigen3 REQUIRED CONFIG) ++if (1) ++ message("-- Found Eigen version ${Eigen3_VERSION}: ${Eigen3_INCLUDE_DIRS}") ++ if (Eigen3_VERSION VERSION_LESS 3.1.0) + message(FATAL_ERROR "-- Ceres requires Eigen version >= 3.1.0 in order " + "that Eigen/SparseCore be available, detected version of Eigen is: " +- "${EIGEN_VERSION}") +- endif (EIGEN_VERSION VERSION_LESS 3.1.0) ++ "${Eigen3_VERSION}") ++ endif () -- list(APPEND GFLAGS_CHECK_LIBRARY_DIRS -- /usr/local/lib -- /usr/local/homebrew/lib # Mac OS X. -- /opt/local/lib -- /usr/lib) -+ list(APPEND GFLAGS_CHECK_LIBRARY_DIRS ${CMAKE_LIB_PATH}) -+ #/usr/local/lib -+ #/usr/local/homebrew/lib # Mac OS X. -+ #/opt/local/lib -+ #/usr/lib) - list(APPEND GFLAGS_CHECK_LIBRARY_SUFFIXES - gflags/lib # Windows (for C:/Program Files prefix). - gflags/Lib ) # Windows (for C:/Program Files prefix). -@@ -467,7 +467,7 @@ - endif (NOT GFLAGS_INCLUDE_DIR OR - NOT EXISTS ${GFLAGS_INCLUDE_DIR}) + if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64.*|AARCH64.*)" AND +- EIGEN_VERSION VERSION_LESS 3.3.4) ++ Eigen3_VERSION VERSION_LESS 3.3.4) + # As per issue #289: https://github.com/ceres-solver/ceres-solver/issues/289 + # the bundle_adjustment_test will fail for Eigen < 3.3.4 on aarch64. + message(FATAL_ERROR "-- Ceres requires Eigen version >= 3.3.4 on aarch64. " +- "Detected version of Eigen is: ${EIGEN_VERSION}.") ++ "Detected version of Eigen is: ${Eigen3_VERSION}.") + endif() -- find_library(GFLAGS_LIBRARY NAMES gflags -+ find_library(GFLAGS_LIBRARY NAMES gflags gflags_static - HINTS ${GFLAGS_LIBRARY_DIR_HINTS} - PATHS ${GFLAGS_CHECK_LIBRARY_DIRS} - PATH_SUFFIXES ${GFLAGS_CHECK_LIBRARY_SUFFIXES}) ---- cmake/FindGlog.cmake -+++ cmake/FindGlog.cmake -@@ -228,12 +228,12 @@ + if (EIGENSPARSE) + message("-- Enabling use of Eigen as a sparse linear algebra library.") + list(APPEND CERES_COMPILE_OPTIONS CERES_USE_EIGEN_SPARSE) +- if (EIGEN_VERSION VERSION_LESS 3.2.2) ++ if (Eigen3_VERSION VERSION_LESS 3.2.2) + message(" WARNING:") + message("") +- message(" Your version of Eigen (${EIGEN_VERSION}) is older than ") ++ message(" Your version of Eigen (${Eigen3_VERSION}) is older than ") + message(" version 3.2.2. The performance of SPARSE_NORMAL_CHOLESKY ") + message(" and SPARSE_SCHUR linear solvers will suffer.") +- endif (EIGEN_VERSION VERSION_LESS 3.2.2) ++ endif () + else (EIGENSPARSE) + message("-- Disabling use of Eigen as a sparse linear algebra library.") + message(" This does not affect the covariance estimation algorithm ") + message(" which can still use the EIGEN_SPARSE_QR algorithm.") + add_definitions(-DEIGEN_MPL2_ONLY) + endif (EIGENSPARSE) +-endif (EIGEN_FOUND) ++endif () - # Search user-installed locations first, so that we prefer user installs - # to system installs where both exist. -- list(APPEND GLOG_CHECK_INCLUDE_DIRS -- /usr/local/include -- /usr/local/homebrew/include # Mac OS X -- /opt/local/var/macports/software # Mac OS X. -- /opt/local/include -- /usr/include) -+ list(APPEND GLOG_CHECK_INCLUDE_DIRS ${CMAKE_INCLUDE_PATH}) -+ #/usr/local/include -+ #/usr/local/homebrew/include # Mac OS X -+ #/opt/local/var/macports/software # Mac OS X. -+ #/opt/local/include -+ #/usr/include) - # Windows (for C:/Program Files prefix). - list(APPEND GLOG_CHECK_PATH_SUFFIXES - glog/include -@@ -243,11 +243,11 @@ - google-glog/include # CMake installs with project name prefix. - google-glog/Include) + if (LAPACK) + find_package(LAPACK QUIET) +@@ -376,13 +376,14 @@ else (MINIGLOG) + unset(MINIGLOG_MAX_LOG_LEVEL CACHE) + # Don't search with REQUIRED so that configuration continues if not found and + # we can output an error messages explaining MINIGLOG option. +- find_package(Glog) +- if (NOT GLOG_FOUND) ++ find_package(glog REQUIRED CONFIG) ++ if (0) + message(FATAL_ERROR "Can't find Google Log (glog). Please set either: " + "glog_DIR (newer CMake built versions of glog) or GLOG_INCLUDE_DIR & " + "GLOG_LIBRARY or enable MINIGLOG option to use minimal glog " + "implementation.") +- endif(NOT GLOG_FOUND) ++ endif() ++ if(0) + # By default, assume gflags was found, updating the message if it was not. + set(GLOG_GFLAGS_DEPENDENCY_MESSAGE + " Assuming glog was built with gflags support as gflags was found. " +@@ -395,7 +396,8 @@ else (MINIGLOG) + "Otherwise, Ceres may fail to link due to missing gflags symbols.") + endif(NOT GFLAGS_FOUND) + message("-- Found Google Log (glog)." ${GLOG_GFLAGS_DEPENDENCY_MESSAGE}) +-endif (MINIGLOG) ++ endif() ++endif () -- list(APPEND GLOG_CHECK_LIBRARY_DIRS -- /usr/local/lib -- /usr/local/homebrew/lib # Mac OS X. -- /opt/local/lib -- /usr/lib) -+ list(APPEND GLOG_CHECK_LIBRARY_DIRS ${CMAKE_LIB_PATH}) -+ #/usr/local/lib -+ #/usr/local/homebrew/lib # Mac OS X. -+ #/opt/local/lib -+ #/usr/lib) - # Windows (for C:/Program Files prefix). - list(APPEND GLOG_CHECK_LIBRARY_SUFFIXES - glog/lib ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -336,7 +336,7 @@ - # GFlags. - if (GFLAGS) - # Don't search with REQUIRED as we can continue without gflags. -- find_package(Gflags) -+ find_package(Gflags REQUIRED) - if (GFLAGS_FOUND) - message("-- Found Google Flags header in: ${GFLAGS_INCLUDE_DIRS}, " - "in namespace: ${GFLAGS_NAMESPACE}") + if (NOT SCHUR_SPECIALIZATIONS) + list(APPEND CERES_COMPILE_OPTIONS CERES_RESTRICT_SCHUR_SPECIALIZATION) +@@ -526,7 +528,7 @@ if (CXX11 AND (TBB OR CXX11_THREADS)) + endif() + + if (CXX11 AND TBB) +- find_package(TBB QUIET) ++ find_package(TBB REQUIRED CONFIG) + if (TBB_FOUND) + message("-- Building with TBB (version: ${TBB_VERSION}).") + list(APPEND CERES_COMPILE_OPTIONS CERES_USE_TBB) +--- a/internal/ceres/CMakeLists.txt ++++ b/internal/ceres/CMakeLists.txt +@@ -152,9 +152,10 @@ else (SCHUR_SPECIALIZATIONS) + endif (SCHUR_SPECIALIZATIONS) + + # Build the list of dependencies for Ceres based on the current configuration. +-if (NOT MINIGLOG AND GLOG_FOUND) +- list(APPEND CERES_LIBRARY_PUBLIC_DEPENDENCIES ${GLOG_LIBRARIES}) +- if (GFLAGS_FOUND) ++list(APPEND CERES_LIBRARY_PUBLIC_DEPENDENCIES Eigen3::Eigen) ++if (NOT MINIGLOG) ++ list(APPEND CERES_LIBRARY_PUBLIC_DEPENDENCIES glog::glog) ++ if (0) + # If glog & gflags are both found, we assume that glog was built with + # gflags, as it is awkward to perform a try_compile() to verify this + # when gflags is an imported target (as it is in newer versions). +@@ -162,7 +163,7 @@ if (NOT MINIGLOG AND GLOG_FOUND) + # gflags, it is thus a public dependency for Ceres in this case. + list(APPEND CERES_LIBRARY_PUBLIC_DEPENDENCIES ${GFLAGS_LIBRARIES}) + endif() +-endif (NOT MINIGLOG AND GLOG_FOUND) ++endif () + + if (SUITESPARSE AND SUITESPARSE_FOUND) + # Define version information for use in Solver::FullReport. +@@ -191,7 +192,7 @@ if (OPENMP_FOUND) + endif (OPENMP_FOUND) + + if (TBB_FOUND) +- list(APPEND CERES_LIBRARY_PRIVATE_DEPENDENCIES ${TBB_LIBRARIES}) ++ list(APPEND CERES_LIBRARY_PRIVATE_DEPENDENCIES TBB::tbb) + if (NOT MSVC) + list(APPEND CERES_LIBRARY_PRIVATE_DEPENDENCIES ${CMAKE_THREAD_LIBS_INIT}) + endif (NOT MSVC) +@@ -241,8 +242,8 @@ if (BUILD_SHARED_LIBS) + # When building a shared library, mark all external libraries as + # PRIVATE so they don't show up as a dependency. + target_link_libraries(ceres +- LINK_PUBLIC ${CERES_LIBRARY_PUBLIC_DEPENDENCIES} +- LINK_PRIVATE ${CERES_LIBRARY_PRIVATE_DEPENDENCIES}) ++ PUBLIC ${CERES_LIBRARY_PUBLIC_DEPENDENCIES} ++ PRIVATE ${CERES_LIBRARY_PRIVATE_DEPENDENCIES}) + else (BUILD_SHARED_LIBS) + # When building a static library, all external libraries are + # PUBLIC(default) since the user needs to link to them. +@@ -250,7 +251,9 @@ else (BUILD_SHARED_LIBS) + set(CERES_LIBRARY_DEPENDENCIES + ${CERES_LIBRARY_PUBLIC_DEPENDENCIES} + ${CERES_LIBRARY_PRIVATE_DEPENDENCIES}) +- target_link_libraries(ceres ${CERES_LIBRARY_DEPENDENCIES}) ++ target_link_libraries(ceres ++ PUBLIC ${CERES_LIBRARY_PUBLIC_DEPENDENCIES} ++ PRIVATE ${CERES_LIBRARY_PRIVATE_DEPENDENCIES}) + endif (BUILD_SHARED_LIBS) + + install(TARGETS ceres diff --git a/recipes/ceres-solver/all/patches/2.0.0-0001-find-libraries-conan.patch b/recipes/ceres-solver/all/patches/2.0.0-0001-find-libraries-conan.patch index 27d855d11a1d5..01e9ab9314b97 100644 --- a/recipes/ceres-solver/all/patches/2.0.0-0001-find-libraries-conan.patch +++ b/recipes/ceres-solver/all/patches/2.0.0-0001-find-libraries-conan.patch @@ -1,49 +1,82 @@ ---- cmake/FindGlog.cmake -+++ cmake/FindGlog.cmake -@@ -261,12 +261,12 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -239,14 +239,14 @@ message("-- Building with C++${CMAKE_CXX_STANDARD}") + # Eigen. + # Eigen delivers Eigen3Config.cmake since v3.3.3 + find_package(Eigen3 3.3 REQUIRED) +-if (EIGEN3_FOUND) +- message("-- Found Eigen version ${EIGEN3_VERSION_STRING}: ${EIGEN3_INCLUDE_DIRS}") ++if (1) ++ message("-- Found Eigen version ${Eigen3_VERSION}: ${Eigen3_INCLUDE_DIRS}") + if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64.*|AARCH64.*)" AND +- EIGEN3_VERSION_STRING VERSION_LESS 3.3.4) ++ Eigen3_VERSION VERSION_LESS 3.3.4) + # As per issue #289: https://github.com/ceres-solver/ceres-solver/issues/289 + # the bundle_adjustment_test will fail for Eigen < 3.3.4 on aarch64. + message(FATAL_ERROR "-- Ceres requires Eigen version >= 3.3.4 on aarch64. " +- "Detected version of Eigen is: ${EIGEN3_VERSION_STRING}.") ++ "Detected version of Eigen is: ${Eigen3_VERSION}.") + endif() - # Search user-installed locations first, so that we prefer user installs - # to system installs where both exist. -- list(APPEND GLOG_CHECK_INCLUDE_DIRS -- /usr/local/include -- /usr/local/homebrew/include # Mac OS X -- /opt/local/var/macports/software # Mac OS X. -- /opt/local/include -- /usr/include) -+ list(APPEND GLOG_CHECK_INCLUDE_DIRS ${CMAKE_INCLUDE_PATH}) -+ #/usr/local/include -+ #/usr/local/homebrew/include # Mac OS X -+ #/opt/local/var/macports/software # Mac OS X. -+ #/opt/local/include -+ #/usr/include) - # Windows (for C:/Program Files prefix). - list(APPEND GLOG_CHECK_PATH_SUFFIXES - glog/include -@@ -276,11 +276,11 @@ - google-glog/include # CMake installs with project name prefix. - google-glog/Include) + if (EIGENSPARSE) +@@ -258,7 +258,7 @@ if (EIGEN3_FOUND) + message(" which can still use the EIGEN_SPARSE_QR algorithm.") + add_definitions(-DEIGEN_MPL2_ONLY) + endif (EIGENSPARSE) +-endif (EIGEN3_FOUND) ++endif () -- list(APPEND GLOG_CHECK_LIBRARY_DIRS -- /usr/local/lib -- /usr/local/homebrew/lib # Mac OS X. -- /opt/local/lib -- /usr/lib) -+ list(APPEND GLOG_CHECK_LIBRARY_DIRS ${CMAKE_LIB_PATH}) -+ #/usr/local/lib -+ #/usr/local/homebrew/lib # Mac OS X. -+ #/opt/local/lib -+ #/usr/lib) - # Windows (for C:/Program Files prefix). - list(APPEND GLOG_CHECK_LIBRARY_SUFFIXES - glog/lib ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -389,7 +389,7 @@ - # GFlags. - if (GFLAGS) - # Don't search with REQUIRED as we can continue without gflags. -- find_package(gflags 2.2.0) -+ find_package(gflags 2.2.0 REQUIRED) - if (gflags_FOUND) - if (TARGET gflags) - message("-- Found Google Flags (gflags) version ${gflags_VERSION}: ${gflags_DIR}") + if (LAPACK) + find_package(LAPACK QUIET) +@@ -427,13 +427,14 @@ else (MINIGLOG) + unset(MINIGLOG_MAX_LOG_LEVEL CACHE) + # Don't search with REQUIRED so that configuration continues if not found and + # we can output an error messages explaining MINIGLOG option. +- find_package(Glog) +- if (NOT GLOG_FOUND) ++ find_package(glog REQUIRED CONFIG) ++ if (0) + message(FATAL_ERROR "Can't find Google Log (glog). Please set either: " + "glog_DIR (newer CMake built versions of glog) or GLOG_INCLUDE_DIR & " + "GLOG_LIBRARY or enable MINIGLOG option to use minimal glog " + "implementation.") +- endif(NOT GLOG_FOUND) ++ endif() ++ if(0) + # By default, assume gflags was found, updating the message if it was not. + set(GLOG_GFLAGS_DEPENDENCY_MESSAGE + " Assuming glog was built with gflags support as gflags was found. " +@@ -446,7 +447,8 @@ else (MINIGLOG) + "Otherwise, Ceres may fail to link due to missing gflags symbols.") + endif(NOT gflags_FOUND) + message("-- Found Google Log (glog)." ${GLOG_GFLAGS_DEPENDENCY_MESSAGE}) +-endif (MINIGLOG) ++ endif() ++endif () + + if (NOT SCHUR_SPECIALIZATIONS) + list(APPEND CERES_COMPILE_OPTIONS CERES_RESTRICT_SCHUR_SPECIALIZATION) +--- a/internal/ceres/CMakeLists.txt ++++ b/internal/ceres/CMakeLists.txt +@@ -174,9 +174,9 @@ endif (SCHUR_SPECIALIZATIONS) + find_package(Threads QUIET) + list(APPEND CERES_LIBRARY_PUBLIC_DEPENDENCIES Threads::Threads) + +-if (NOT MINIGLOG AND GLOG_FOUND) +- list(APPEND CERES_LIBRARY_PUBLIC_DEPENDENCIES ${GLOG_LIBRARIES}) +- if (gflags_FOUND) ++if (NOT MINIGLOG) ++ list(APPEND CERES_LIBRARY_PUBLIC_DEPENDENCIES glog::glog) ++ if (0) + # If glog & gflags are both found, we assume that glog was built with + # gflags, as it is awkward to perform a try_compile() to verify this + # when gflags is an imported target (as it is in newer versions). +@@ -184,7 +184,7 @@ if (NOT MINIGLOG AND GLOG_FOUND) + # gflags, it is thus a public dependency for Ceres in this case. + list(APPEND CERES_LIBRARY_PUBLIC_DEPENDENCIES gflags) + endif() +-endif (NOT MINIGLOG AND GLOG_FOUND) ++endif () + + if (SUITESPARSE AND SUITESPARSE_FOUND) + # Define version information for use in Solver::FullReport. diff --git a/recipes/ceres-solver/all/patches/2.0.0-0002-fix-eigen-version.patch b/recipes/ceres-solver/all/patches/2.0.0-0002-fix-eigen-version.patch deleted file mode 100644 index b32392c3d9a3b..0000000000000 --- a/recipes/ceres-solver/all/patches/2.0.0-0002-fix-eigen-version.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index ea7e9b8..203c5d2 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -240,13 +240,13 @@ message("-- Building with C++${CMAKE_CXX_STANDARD}") - # Eigen delivers Eigen3Config.cmake since v3.3.3 - find_package(Eigen3 3.3 REQUIRED) - if (EIGEN3_FOUND) -- message("-- Found Eigen version ${EIGEN3_VERSION_STRING}: ${EIGEN3_INCLUDE_DIRS}") -+ message("-- Found Eigen version ${Eigen3_VERSION}: ${EIGEN3_INCLUDE_DIRS}") - if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64.*|AARCH64.*)" AND -- EIGEN3_VERSION_STRING VERSION_LESS 3.3.4) -+ Eigen3_VERSION VERSION_LESS 3.3.4) - # As per issue #289: https://github.com/ceres-solver/ceres-solver/issues/289 - # the bundle_adjustment_test will fail for Eigen < 3.3.4 on aarch64. - message(FATAL_ERROR "-- Ceres requires Eigen version >= 3.3.4 on aarch64. " -- "Detected version of Eigen is: ${EIGEN3_VERSION_STRING}.") -+ "Detected version of Eigen is: ${Eigen3_VERSION}.") - endif() - - if (EIGENSPARSE) diff --git a/recipes/ceres-solver/all/patches/2.0.0-0002-fix-mingw-build.patch b/recipes/ceres-solver/all/patches/2.0.0-0002-fix-mingw-build.patch new file mode 100644 index 0000000000000..2978c914e5d8d --- /dev/null +++ b/recipes/ceres-solver/all/patches/2.0.0-0002-fix-mingw-build.patch @@ -0,0 +1,12 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -514,6 +514,9 @@ if (MINGW) + "to a MinGW bug: http://eigen.tuxfamily.org/bz/show_bug.cgi?id=556") + string(REPLACE "-O3" "-O2" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") + update_cache_variable(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") ++ # Add the equivalent of /bigobj for MSVC for MinGW to fix 'too many sections' ++ # compile errors due to extensive use of templates. ++ add_compile_options(-Wa,-mbig-obj) + endif (MINGW) + + # After the tweaks for the compile settings, disable some warnings on MSVC. diff --git a/recipes/ceres-solver/all/patches/2.0.0-0003-fix-mingw-build.patch b/recipes/ceres-solver/all/patches/2.0.0-0003-fix-mingw-build.patch deleted file mode 100644 index fc971893376fa..0000000000000 --- a/recipes/ceres-solver/all/patches/2.0.0-0003-fix-mingw-build.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 3828e33..30ef8cb 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -512,6 +512,9 @@ if (MINGW) - "to a MinGW bug: http://eigen.tuxfamily.org/bz/show_bug.cgi?id=556") - string(REPLACE "-O3" "-O2" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") - update_cache_variable(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") -+ # Add the equivalent of /bigobj for MSVC for MinGW to fix 'too many sections' -+ # compile errors due to extensive use of templates. -+ add_compile_options(-Wa,-mbig-obj) - endif (MINGW) - - # After the tweaks for the compile settings, disable some warnings on MSVC. - diff --git a/recipes/ceres-solver/all/patches/2.0.1-0001-find-glog-conan.patch b/recipes/ceres-solver/all/patches/2.0.1-0001-find-glog-conan.patch deleted file mode 100644 index e8474163f4157..0000000000000 --- a/recipes/ceres-solver/all/patches/2.0.1-0001-find-glog-conan.patch +++ /dev/null @@ -1,40 +0,0 @@ -diff --git a/cmake/FindGlog.cmake b/cmake/FindGlog.cmake -index 1a7b6c09..d4bd7f08 100644 ---- a/cmake/FindGlog.cmake -+++ b/cmake/FindGlog.cmake -@@ -261,12 +261,12 @@ if (NOT GLOG_FOUND) - - # Search user-installed locations first, so that we prefer user installs - # to system installs where both exist. -- list(APPEND GLOG_CHECK_INCLUDE_DIRS -- /usr/local/include -- /usr/local/homebrew/include # Mac OS X -- /opt/local/var/macports/software # Mac OS X. -- /opt/local/include -- /usr/include) -+ list(APPEND GLOG_CHECK_INCLUDE_DIRS ${CMAKE_INCLUDE_PATH}) -+ #/usr/local/include -+ #/usr/local/homebrew/include # Mac OS X -+ #/opt/local/var/macports/software # Mac OS X. -+ #/opt/local/include -+ #/usr/include) - # Windows (for C:/Program Files prefix). - list(APPEND GLOG_CHECK_PATH_SUFFIXES - glog/include -@@ -276,11 +276,11 @@ if (NOT GLOG_FOUND) - google-glog/include # CMake installs with project name prefix. - google-glog/Include) - -- list(APPEND GLOG_CHECK_LIBRARY_DIRS -- /usr/local/lib -- /usr/local/homebrew/lib # Mac OS X. -- /opt/local/lib -- /usr/lib) -+ list(APPEND GLOG_CHECK_LIBRARY_DIRS ${CMAKE_LIB_PATH}) -+ #/usr/local/lib -+ #/usr/local/homebrew/lib # Mac OS X. -+ #/opt/local/lib -+ #/usr/lib) - # Windows (for C:/Program Files prefix). - list(APPEND GLOG_CHECK_LIBRARY_SUFFIXES - glog/lib diff --git a/recipes/ceres-solver/all/patches/2.0.1-0002-find-glags-conan.patch b/recipes/ceres-solver/all/patches/2.0.1-0002-find-glags-conan.patch deleted file mode 100644 index ed1fe61607668..0000000000000 --- a/recipes/ceres-solver/all/patches/2.0.1-0002-find-glags-conan.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 7f88fb48..058f4cd9 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -367,7 +367,7 @@ endif() - # GFlags. - if (GFLAGS) - # Don't search with REQUIRED as we can continue without gflags. -- find_package(gflags 2.2.0) -+ find_package(gflags 2.2.0 REQUIRED) - if (gflags_FOUND) - if (TARGET gflags) - message("-- Found Google Flags (gflags) version ${gflags_VERSION}: ${gflags_DIR}") diff --git a/recipes/ceres-solver/all/patches/2.0.1-0003-fix-mingw-build.patch b/recipes/ceres-solver/all/patches/2.0.1-0003-fix-mingw-build.patch deleted file mode 100644 index 77df4bf8d3750..0000000000000 --- a/recipes/ceres-solver/all/patches/2.0.1-0003-fix-mingw-build.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 058f4cd9..58b5ed01 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -486,6 +486,9 @@ if (MINGW) - "to a MinGW bug: http://eigen.tuxfamily.org/bz/show_bug.cgi?id=556") - string(REPLACE "-O3" "-O2" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") - update_cache_variable(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") -+ # Add the equivalent of /bigobj for MSVC for MinGW to fix 'too many sections' -+ # compile errors due to extensive use of templates. -+ add_compile_options(-Wa,-mbig-obj) - endif (MINGW) - - # After the tweaks for the compile settings, disable some warnings on MSVC. diff --git a/recipes/ceres-solver/all/patches/2.1.0-0001-find-libraries-conan.patch b/recipes/ceres-solver/all/patches/2.1.0-0001-find-libraries-conan.patch new file mode 100644 index 0000000000000..e37860d53493e --- /dev/null +++ b/recipes/ceres-solver/all/patches/2.1.0-0001-find-libraries-conan.patch @@ -0,0 +1,54 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -405,13 +405,14 @@ else (MINIGLOG) + unset(MINIGLOG_MAX_LOG_LEVEL CACHE) + # Don't search with REQUIRED so that configuration continues if not found and + # we can output an error messages explaining MINIGLOG option. +- find_package(Glog) +- if (NOT GLOG_FOUND) ++ find_package(glog REQUIRED CONFIG) ++ if (0) + message(FATAL_ERROR "Can't find Google Log (glog). Please set either: " + "glog_DIR (newer CMake built versions of glog) or GLOG_INCLUDE_DIR & " + "GLOG_LIBRARY or enable MINIGLOG option to use minimal glog " + "implementation.") +- endif(NOT GLOG_FOUND) ++ endif() ++ if(0) + # By default, assume gflags was found, updating the message if it was not. + set(GLOG_GFLAGS_DEPENDENCY_MESSAGE + " Assuming glog was built with gflags support as gflags was found. " +@@ -424,7 +425,8 @@ else (MINIGLOG) + "Otherwise, Ceres may fail to link due to missing gflags symbols.") + endif(NOT gflags_FOUND) + message("-- Found Google Log (glog)." ${GLOG_GFLAGS_DEPENDENCY_MESSAGE}) +-endif (MINIGLOG) ++ endif() ++endif () + + if (NOT SCHUR_SPECIALIZATIONS) + list(APPEND CERES_COMPILE_OPTIONS CERES_RESTRICT_SCHUR_SPECIALIZATION) +--- a/internal/ceres/CMakeLists.txt ++++ b/internal/ceres/CMakeLists.txt +@@ -101,9 +101,9 @@ endif() + find_package(Threads QUIET) + list(APPEND CERES_LIBRARY_PUBLIC_DEPENDENCIES Threads::Threads) + +-if (NOT MINIGLOG AND GLOG_FOUND) +- list(APPEND CERES_LIBRARY_PUBLIC_DEPENDENCIES ${GLOG_LIBRARIES}) +- if (gflags_FOUND) ++if (NOT MINIGLOG) ++ list(APPEND CERES_LIBRARY_PUBLIC_DEPENDENCIES glog::glog) ++ if (0) + # If glog & gflags are both found, we assume that glog was built with + # gflags, as it is awkward to perform a try_compile() to verify this + # when gflags is an imported target (as it is in newer versions). +@@ -111,7 +111,7 @@ if (NOT MINIGLOG AND GLOG_FOUND) + # gflags, it is thus a public dependency for Ceres in this case. + list(APPEND CERES_LIBRARY_PUBLIC_DEPENDENCIES gflags) + endif() +-endif (NOT MINIGLOG AND GLOG_FOUND) ++endif () + + if (SUITESPARSE AND SuiteSparse_FOUND) + # Define version information for use in Solver::FullReport. diff --git a/recipes/ceres-solver/all/patches/2.1.0-0002-fix-mingw-build.patch b/recipes/ceres-solver/all/patches/2.1.0-0002-fix-mingw-build.patch new file mode 100644 index 0000000000000..0fb8a2b83b2c4 --- /dev/null +++ b/recipes/ceres-solver/all/patches/2.1.0-0002-fix-mingw-build.patch @@ -0,0 +1,12 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -488,6 +488,9 @@ if (MINGW) + "to a MinGW bug: http://eigen.tuxfamily.org/bz/show_bug.cgi?id=556") + string(REPLACE "-O3" "-O2" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") + update_cache_variable(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") ++ # Add the equivalent of /bigobj for MSVC for MinGW to fix 'too many sections' ++ # compile errors due to extensive use of templates. ++ add_compile_options(-Wa,-mbig-obj) + endif (MINGW) + + # After the tweaks for the compile settings, disable some warnings on MSVC. diff --git a/recipes/ceres-solver/all/patches/2.2.0-0001-find-libraries-conan.patch b/recipes/ceres-solver/all/patches/2.2.0-0001-find-libraries-conan.patch new file mode 100644 index 0000000000000..aabc47a84c955 --- /dev/null +++ b/recipes/ceres-solver/all/patches/2.2.0-0001-find-libraries-conan.patch @@ -0,0 +1,54 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -433,13 +433,14 @@ else (MINIGLOG) + unset(MINIGLOG_MAX_LOG_LEVEL CACHE) + # Don't search with REQUIRED so that configuration continues if not found and + # we can output an error messages explaining MINIGLOG option. +- find_package(Glog) +- if (NOT GLOG_FOUND) ++ find_package(glog REQUIRED CONFIG) ++ if (0) + message(FATAL_ERROR "Can't find Google Log (glog). Please set either: " + "glog_DIR (newer CMake built versions of glog) or GLOG_INCLUDE_DIR & " + "GLOG_LIBRARY or enable MINIGLOG option to use minimal glog " + "implementation.") +- endif(NOT GLOG_FOUND) ++ endif() ++ if(0) + # By default, assume gflags was found, updating the message if it was not. + set(GLOG_GFLAGS_DEPENDENCY_MESSAGE + " Assuming glog was built with gflags support as gflags was found. " +@@ -452,7 +453,8 @@ else (MINIGLOG) + "Otherwise, Ceres may fail to link due to missing gflags symbols.") + endif(NOT gflags_FOUND) + message("-- Found Google Log (glog)." ${GLOG_GFLAGS_DEPENDENCY_MESSAGE}) +-endif (MINIGLOG) ++ endif() ++endif () + + if (NOT SCHUR_SPECIALIZATIONS) + list(APPEND CERES_COMPILE_OPTIONS CERES_RESTRICT_SCHUR_SPECIALIZATION) +--- a/internal/ceres/CMakeLists.txt ++++ b/internal/ceres/CMakeLists.txt +@@ -85,9 +85,9 @@ endif (SCHUR_SPECIALIZATIONS) + set_source_files_properties(${CERES_INTERNAL_SCHUR_FILES} PROPERTIES + SKIP_UNITY_BUILD_INCLUSION ON) + +-if (NOT MINIGLOG AND GLOG_FOUND) +- list(APPEND CERES_LIBRARY_PUBLIC_DEPENDENCIES ${GLOG_LIBRARIES}) +- if (gflags_FOUND) ++if (NOT MINIGLOG) ++ list(APPEND CERES_LIBRARY_PUBLIC_DEPENDENCIES glog::glog) ++ if (0) + # If glog & gflags are both found, we assume that glog was built with + # gflags, as it is awkward to perform a try_compile() to verify this + # when gflags is an imported target (as it is in newer versions). +@@ -95,7 +95,7 @@ if (NOT MINIGLOG AND GLOG_FOUND) + # gflags, it is thus a public dependency for Ceres in this case. + list(APPEND CERES_LIBRARY_PUBLIC_DEPENDENCIES gflags) + endif() +-endif (NOT MINIGLOG AND GLOG_FOUND) ++endif () + + if (SUITESPARSE AND SuiteSparse_FOUND) + # Define version information for use in Solver::FullReport. diff --git a/recipes/ceres-solver/all/patches/2.2.0-0002-fix-mingw-build.patch b/recipes/ceres-solver/all/patches/2.2.0-0002-fix-mingw-build.patch new file mode 100644 index 0000000000000..2978c914e5d8d --- /dev/null +++ b/recipes/ceres-solver/all/patches/2.2.0-0002-fix-mingw-build.patch @@ -0,0 +1,12 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -514,6 +514,9 @@ if (MINGW) + "to a MinGW bug: http://eigen.tuxfamily.org/bz/show_bug.cgi?id=556") + string(REPLACE "-O3" "-O2" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") + update_cache_variable(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") ++ # Add the equivalent of /bigobj for MSVC for MinGW to fix 'too many sections' ++ # compile errors due to extensive use of templates. ++ add_compile_options(-Wa,-mbig-obj) + endif (MINGW) + + # After the tweaks for the compile settings, disable some warnings on MSVC. diff --git a/recipes/ceres-solver/all/test_package/CMakeLists.txt b/recipes/ceres-solver/all/test_package/CMakeLists.txt index de5b6209a38b8..f3987035886ae 100644 --- a/recipes/ceres-solver/all/test_package/CMakeLists.txt +++ b/recipes/ceres-solver/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(Ceres REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} Ceres::ceres) +target_link_libraries(${PROJECT_NAME} PRIVATE Ceres::ceres) diff --git a/recipes/ceres-solver/all/test_package/conanfile.py b/recipes/ceres-solver/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/ceres-solver/all/test_package/conanfile.py +++ b/recipes/ceres-solver/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/ceres-solver/all/test_v1_package/CMakeLists.txt b/recipes/ceres-solver/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/ceres-solver/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/ceres-solver/all/test_v1_package/conanfile.py b/recipes/ceres-solver/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/ceres-solver/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/ceres-solver/config.yml b/recipes/ceres-solver/config.yml index a3c4c3f90c1ea..c6e7e2c924085 100644 --- a/recipes/ceres-solver/config.yml +++ b/recipes/ceres-solver/config.yml @@ -1,9 +1,9 @@ versions: + "2.2.0": + folder: all "2.1.0": folder: all "2.0.0": folder: all "1.14.0": folder: all - "1.13.0": - folder: all diff --git a/recipes/certify/all/conanfile.py b/recipes/certify/all/conanfile.py index 86be0e74f0cf1..e89aca37b04b6 100644 --- a/recipes/certify/all/conanfile.py +++ b/recipes/certify/all/conanfile.py @@ -1,23 +1,29 @@ -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 + +required_conan_version = ">=1.52.0" class CertifyConan(ConanFile): name = "certify" description = "Platform-specific TLS keystore abstraction for use with Boost.ASIO and OpenSSL" - topics = ("boost", "asio", "tls", "ssl", "https") + license = "BSL-1.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/djarek/certify" - license = "BSL-1.0" + topics = ("boost", "asio", "tls", "ssl", "https", "header-only") + + package_type = "header-library" 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): @@ -28,17 +34,19 @@ def _compilers_minimum_version(self): "apple-clang": "11", } - @property - def _min_cppstd(self): - return "17" + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - self.requires("boost/1.79.0") - self.requires("openssl/1.1.1q") + self.requires("boost/[>=1.83.0 <2]") + self.requires("openssl/[>=1.1 <4]") + + 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 lazy_lt_semver(v1, v2): lv1 = [int(v) for v in v1.split(".")] @@ -48,29 +56,45 @@ 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++17. Your compiler is unknown. Assuming it supports C++17.".format(self.name)) + self.output.warning( + f"{self.name} 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("{} requires C++17, which your compiler does not support.".format(self.name)) - - def package_id(self): - self.info.header_only() + raise ConanInvalidConfiguration( + f"{self.name} requires C++17, which your compiler does not support." + ) 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_1_0.txt", dst="licenses", - src=self._source_subfolder) - self.copy(pattern="*", 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="*", + 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", "certify") self.cpp_info.set_property("cmake_target_name", "certify::core") - self.cpp_info.components["_certify"].requires = ["boost::boost", "openssl::openssl"] + component_requirements = [ + "boost::headers", + "boost::filesystem", + "boost::date_time", + "openssl::openssl" + ] + self.cpp_info.requires = component_requirements + self.cpp_info.components["_certify"].requires = component_requirements self.cpp_info.components["_certify"].names["cmake_find_package"] = "core" self.cpp_info.components["_certify"].names["cmake_find_package_multi"] = "core" + self.cpp_info.names["cmake_find_package"] = "certify" self.cpp_info.names["cmake_find_package_multi"] = "certify" diff --git a/recipes/certify/all/test_package/CMakeLists.txt b/recipes/certify/all/test_package/CMakeLists.txt index 37373018e655a..2d5f2ce7457e3 100644 --- a/recipes/certify/all/test_package/CMakeLists.txt +++ b/recipes/certify/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) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) find_package(certify REQUIRED CONFIG) diff --git a/recipes/certify/all/test_package/conanfile.py b/recipes/certify/all/test_package/conanfile.py index 49a3a66ea5bad..ef5d7042163ec 100644 --- a/recipes/certify/all/test_package/conanfile.py +++ b/recipes/certify/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/certify/all/test_package/test_package.cpp b/recipes/certify/all/test_package/test_package.cpp index 28f4c97339bb8..6e95446160938 100644 --- a/recipes/certify/all/test_package/test_package.cpp +++ b/recipes/certify/all/test_package/test_package.cpp @@ -6,15 +6,15 @@ #include int main() { - boost::asio::io_context ioc{1}; - boost::asio::ssl::context context{boost::asio::ssl::context_base::method::tls_client}; - boost::asio::ssl::stream stream(ioc, context); - constexpr auto hostname = "example.com"; + boost::asio::io_context ioc{1}; + boost::asio::ssl::context context{boost::asio::ssl::context_base::method::tls_client}; + boost::asio::ssl::stream stream(ioc, context); + constexpr auto hostname = "example.com"; - BOOST_TEST(boost::certify::sni_hostname(stream).empty()); - boost::certify::sni_hostname(stream, hostname); - BOOST_TEST(boost::certify::sni_hostname(stream) == hostname); - std::cout << boost::report_errors(); + BOOST_TEST(boost::certify::sni_hostname(stream).empty()); + boost::certify::sni_hostname(stream, hostname); + BOOST_TEST(boost::certify::sni_hostname(stream) == hostname); + std::cout << boost::report_errors(); - return 0; + return 0; } diff --git a/recipes/cfgfile/all/conanfile.py b/recipes/cfgfile/all/conanfile.py index 6ce91734444e4..84a0a1cacbb3d 100644 --- a/recipes/cfgfile/all/conanfile.py +++ b/recipes/cfgfile/all/conanfile.py @@ -1,9 +1,10 @@ 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 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.0" @@ -15,7 +16,7 @@ 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." - topics = ("cfgfile", "configuration", "file") + topics = ("configuration", "file") settings = "os", "arch", "compiler", "build_type" @property @@ -32,6 +33,15 @@ def _compilers_minimum_version(self): "apple-clang": "10", } + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + if self.version == "0.2.9.1" or Version(self.version) >= "0.2.10": + self.requires("args-parser/6.2.0.1") + elif self.version == "0.2.9.0": + self.requires("args-parser/6.0.1.0") + def package_id(self): del self.info.settings.compiler @@ -41,33 +51,18 @@ def validate(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.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.", ) - def requirements(self): - 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 = CMake(self) - cmake.configure(build_script_folder=self.source_folder) - cmake.build() - - def layout(self): - cmake_layout(self) + self.tool_requires("cmake/[>=3.19 <4]") 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.cache_variables["BUILD_EXAMPLES"] = False tc.cache_variables["BUILD_TESTS"] = False @@ -77,6 +72,11 @@ def generate(self): deps = CMakeDeps(self) deps.generate() + def build(self): + cmake = CMake(self) + cmake.configure(build_script_folder=self.source_folder) + cmake.build() + def package(self): copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) cmake = CMake(self) @@ -87,6 +87,6 @@ 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) + + # TODO: to remove once conan v1 support dropped + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/cfgfile/all/test_package/conanfile.py b/recipes/cfgfile/all/test_package/conanfile.py index cc0263e38af82..edcafc68a3a25 100644 --- a/recipes/cfgfile/all/test_package/conanfile.py +++ b/recipes/cfgfile/all/test_package/conanfile.py @@ -7,13 +7,17 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def build_requirements(self): - self.tool_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_requirements(self): + self.tool_requires(self.tested_reference_str) + def build(self): if not cross_building(self, skip_x64_x86=True): cmake = CMake(self) diff --git a/recipes/cfitsio/all/CMakeLists.txt b/recipes/cfitsio/all/CMakeLists.txt deleted file mode 100644 index 31bd8dc482596..0000000000000 --- a/recipes/cfitsio/all/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -cmake_minimum_required(VERSION 3.1.2) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS KEEP_RPATHS) -# we also need to inject definitions of dependencies, -# since cfitsio doesn't link to CMake imported targets -conan_global_flags() - -add_subdirectory("source_subfolder") diff --git a/recipes/cfitsio/all/conandata.yml b/recipes/cfitsio/all/conandata.yml index 2439d42db1dbd..136d6931652c7 100644 --- a/recipes/cfitsio/all/conandata.yml +++ b/recipes/cfitsio/all/conandata.yml @@ -1,42 +1,44 @@ sources: + "4.4.0": + url: "https://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/cfitsio-4.4.0.tar.gz" + sha256: "95900cf95ae760839e7cb9678a7b2fad0858d6ac12234f934bd1cb6bfc246ba9" + "4.3.1": + url: "https://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/cfitsio-4.3.1.tar.gz" + sha256: "47a7c8ee05687be1e1d8eeeb94fb88f060fbf3cd8a4df52ccb88d5eb0f5062be" + "4.3.0": + url: "https://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/cfitsio-4.3.0.tar.gz" + sha256: "fdadc01d09cf9f54253802c5ec87eb10de51ce4130411415ae88c30940621b8b" + "4.2.0": + url: "https://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/cfitsio-4.2.0.tar.gz" + sha256: "eba53d1b3f6e345632bb09a7b752ec7ced3d63ec5153a848380f3880c5d61889" "4.1.0": url: "https://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/cfitsio-4.1.0.tar.gz" - sha256: "748994dd1c819b88567e3539ea1f0ec2dd39fc0ed2884c033afa3da66efb5f4e" + sha256: "b367c695d2831958e7166921c3b356d5dfa51b1ecee505b97416ba39d1b6c17a" "4.0.0": url: "https://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/cfitsio-4.0.0.tar.gz" - sha256: "88735b69bb017ee92823b9e7ee14efeae2e57fb6c00503ed3aa2820e850a7b5e" + sha256: "b2a8efba0b9f86d3e1bd619f662a476ec18112b4f27cc441cc680a4e3777425e" "3.490": url: "https://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/cfitsio-3.49.tar.gz" - sha256: "8cc4beddd0ff389fb81bde9c181e0e3c419c15ec8a66df201ff4619a93715558" - "3.480": - url: "https://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/cfitsio-3.48.tar.gz" - sha256: "fc369363616753fa4dbe9bf28fa7e49cc1b057081229d89b52087d85ef303314" - "3.470": - url: "https://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/cfitsio-3.47.tar.gz" - sha256: "985606e058403c073a68d95be74e9696f0ded9414520784457a1d4cba8cca7e2" + sha256: "5b65a20d5c53494ec8f638267fca4a629836b7ac8dd0ef0266834eab270ed4b3" patches: + "4.4.0": + - patch_file: "patches/windows-use-strtok_s.patch" + - patch_file: "patches/fix-cmake-4.2.0.patch" + "4.3.1": + - patch_file: "patches/windows-use-strtok_s.patch" + - patch_file: "patches/fix-cmake-4.2.0.patch" + "4.3.0": + - patch_file: "patches/windows-use-strtok_s.patch" + - patch_file: "patches/fix-cmake-4.2.0.patch" + "4.2.0": + - patch_file: "patches/windows-use-strtok_s.patch" + - patch_file: "patches/fix-cmake-4.2.0.patch" "4.1.0": - patch_file: "patches/windows-use-strtok_s.patch" - base_path: "source_subfolder" - patch_file: "patches/fix-cmake-4.1.0.patch" - base_path: "source_subfolder" "4.0.0": - patch_file: "patches/windows-use-strtok_s.patch" - base_path: "source_subfolder" - patch_file: "patches/fix-cmake-4.0.0.patch" - base_path: "source_subfolder" "3.490": - patch_file: "patches/windows-use-strtok_s.patch" - base_path: "source_subfolder" - patch_file: "patches/fix-cmake-3.490.patch" - base_path: "source_subfolder" - "3.480": - - patch_file: "patches/windows-use-strtok_s.patch" - base_path: "source_subfolder" - - patch_file: "patches/fix-cmake-3.470.patch" - base_path: "source_subfolder" - "3.470": - - patch_file: "patches/windows-use-strtok_s.patch" - base_path: "source_subfolder" - - patch_file: "patches/fix-cmake-3.470.patch" - base_path: "source_subfolder" diff --git a/recipes/cfitsio/all/conanfile.py b/recipes/cfitsio/all/conanfile.py index 806cbca0ccd55..e2f5688059f62 100644 --- a/recipes/cfitsio/all/conanfile.py +++ b/recipes/cfitsio/all/conanfile.py @@ -1,20 +1,24 @@ -from conans import ConanFile, CMake, tools -import functools import glob import os -required_conan_version = ">=1.36.0" +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.scm import Version + +required_conan_version = ">=1.54.0" class CfitsioConan(ConanFile): name = "cfitsio" description = "C library for reading and writing data files in FITS " \ "(Flexible Image Transport System) data format" - license = "ISC" - topics = ("cfitsio", "fits", "image", "nasa", "astronomy", "astrophysics", "space") + license = ("CFITSIO", "NASA-1.3") + topics = ("fits", "image", "nasa", "astronomy", "astrophysics", "space") homepage = "https://heasarc.gsfc.nasa.gov/fitsio/" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -33,95 +37,88 @@ class CfitsioConan(ConanFile): "with_curl": False, } - 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": del self.options.fPIC - del self.options.with_bzip2 del self.options.with_curl if self.settings.arch not in ["x86", "x86_64"]: del self.options.simd_intrinsics 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.11 <2]") if self.options.threadsafe and self.settings.os == "Windows" and \ - (not self.settings.compiler == "gcc" or self.settings.compiler.threads == "win32"): + self.settings.compiler.get_safe("threads") != "posix": self.requires("pthreads4w/3.0.0") - if self.options.get_safe("with_bzip2"): + if self.options.with_bzip2: self.requires("bzip2/1.0.8") if self.options.get_safe("with_curl"): - self.requires("libcurl/7.80.0") + self.requires("libcurl/[>=7.78.0 <9]") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def build(self): - self._patch_sources() - cmake = self._configure_cmake() - cmake.build() + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["USE_PTHREADS"] = self.options.threadsafe + if Version(self.version) >= "4.1.0": + tc.variables["USE_SSE2"] = self.options.get_safe("simd_intrinsics") == "sse2" + tc.variables["USE_SSSE3"] = self.options.get_safe("simd_intrinsics") == "ssse3" + tc.variables["USE_BZIP2"] = self.options.with_bzip2 + else: + tc.variables["CFITSIO_USE_SSE2"] = self.options.get_safe("simd_intrinsics") == "sse2" + tc.variables["CFITSIO_USE_SSSE3"] = self.options.get_safe("simd_intrinsics") == "ssse3" + tc.variables["CFITSIO_USE_BZIP2"] = self.options.with_bzip2 + if Version(self.version) >= "4.0.0": + tc.variables["USE_CURL"] = self.options.get_safe("with_curl", False) + tc.variables["TESTS"] = False + tc.variables["UTILS"] = False + else: + tc.variables["UseCurl"] = self.options.get_safe("with_curl", 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) - if tools.Version(self.version) < "4.0.0": + apply_conandata_patches(self) + if Version(self.version) < "4.0.0": # Remove embedded zlib files - for zlib_file in glob.glob(os.path.join(self._source_subfolder, "zlib", "*")): + for zlib_file in glob.glob(os.path.join(self.source_folder, "zlib", "*")): if not zlib_file.endswith(("zcompress.c", "zuncompress.c")): os.remove(zlib_file) - @functools.lru_cache(1) - def _configure_cmake(self): + def build(self): + self._patch_sources() cmake = CMake(self) - cmake.definitions["USE_PTHREADS"] = self.options.threadsafe - if tools.Version(self.version) >= "4.1.0": - cmake.definitions["USE_SSE2"] = self.options.get_safe("simd_intrinsics") == "sse2" - cmake.definitions["USE_SSSE3"] = self.options.get_safe("simd_intrinsics") == "ssse3" - else: - cmake.definitions["CFITSIO_USE_SSE2"] = self.options.get_safe("simd_intrinsics") == "sse2" - cmake.definitions["CFITSIO_USE_SSSE3"] = self.options.get_safe("simd_intrinsics") == "ssse3" - if self.settings.os != "Windows": - if tools.Version(self.version) >= "4.1.0": - cmake.definitions["USE_BZIP2"] = self.options.with_bzip2 - else: - cmake.definitions["CFITSIO_USE_BZIP2"] = self.options.with_bzip2 - if tools.Version(self.version) >= "4.0.0": - cmake.definitions["USE_CURL"] = self.options.with_curl - else: - cmake.definitions["UseCurl"] = self.options.with_curl - if tools.Version(self.version) >= "4.0.0": - cmake.definitions["TESTS"] = False - cmake.definitions["UTILS"] = False - cmake.configure(build_folder=self._build_subfolder) - return cmake + cmake.configure() + cmake.build() def package(self): - self.copy("License.txt", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + if Version(self.version) >= "4.4.0": + copy(self, "NASA*", src=os.path.join(self.source_folder, "licenses"), + dst=os.path.join(self.package_folder, "licenses")) + else: + 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")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", f"cfitsio-{self.version}")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): + self.cpp_info.set_property("cmake_file_name", "cfitsio") + self.cpp_info.set_property("cmake_target_name", "cfitsio::cfitsio") self.cpp_info.set_property("pkg_config_name", "cfitsio") self.cpp_info.libs = ["cfitsio"] if self.settings.os in ["Linux", "FreeBSD"]: diff --git a/recipes/cfitsio/all/patches/fix-cmake-3.470.patch b/recipes/cfitsio/all/patches/fix-cmake-3.470.patch deleted file mode 100644 index a0359c65d47c9..0000000000000 --- a/recipes/cfitsio/all/patches/fix-cmake-3.470.patch +++ /dev/null @@ -1,226 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -4,7 +4,7 @@ - SET(CMAKE_LEGACY_CYGWIN_WIN32 0) - - PROJECT(CFITSIO) --CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0) -+CMAKE_MINIMUM_REQUIRED(VERSION 3.1) - - # Allow @rpath token in target install name on Macs. - # See "cmake --help-policy CMP0042" for more information. -@@ -12,12 +12,14 @@ IF(POLICY CMP0042) - CMAKE_POLICY(SET CMP0042 NEW) - ENDIF() - --INCLUDE (${CMAKE_ROOT}/Modules/CheckLibraryExists.cmake) --INCLUDE (${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake) -+INCLUDE(CheckSymbolExists) -+INCLUDE(CheckCSourceCompiles) - - # Allow the developer to select if Dynamic or Static libraries are built - OPTION (BUILD_SHARED_LIBS "Build Shared Libraries" ON) - OPTION (USE_PTHREADS "Thread-safe build (using pthreads)" OFF) -+OPTION(CFITSIO_USE_SSE2 "Enable use of instructions in the SSE2 extended instruction set" OFF) -+OPTION(CFITSIO_USE_SSSE3 "Enable use of instructions in the SSSE3 extended instruction set" OFF) - - set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}") - set (LIB_DESTINATION "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}") -@@ -55,11 +57,18 @@ IF (BUILD_SHARED_LIBS) - ENDIF (BUILD_SHARED_LIBS) - - --FILE(GLOB H_FILES "*.h") -+SET(H_FILES fitsio.h fitsio2.h longnam.h) -+SET(LINK_LIBS "") - - IF (USE_PTHREADS) -- FIND_PACKAGE(pthreads REQUIRED) -- INCLUDE_DIRECTORIES(${PTHREADS_INCLUDE_DIR}) -+ SET(CMAKE_THREAD_PREFER_PTHREAD TRUE) -+ SET(THREADS_PREFER_PTHREAD_FLAG TRUE) -+ FIND_PACKAGE(Threads REQUIRED) -+ IF(CMAKE_USE_PTHREADS_INIT) -+ LIST(APPEND LINK_LIBS "Threads::Threads") -+ ELSE() -+ LIST(APPEND LINK_LIBS "CONAN_PKG::pthreads4w") -+ ENDIF() - ADD_DEFINITIONS(-D_REENTRANT) - ENDIF() - -@@ -71,35 +80,36 @@ ELSE() - ENDIF() - - # Support for remote file drivers is not implemented for native Windows: --IF (NOT MSVC) -+IF (NOT WIN32) - # Find library needed for gethostbyname: -- CHECK_FUNCTION_EXISTS("gethostbyname" CMAKE_HAVE_GETHOSTBYNAME) -- IF(NOT CMAKE_HAVE_GETHOSTBYNAME) -- CHECK_LIBRARY_EXISTS("nsl" "gethostbyname" "" CMAKE_HAVE_GETHOSTBYNAME) -- ENDIF() -+ CHECK_SYMBOL_EXISTS(gethostbyname "netdb.h" CMAKE_HAVE_GETHOSTBYNAME) - - # Find library needed for connect: -- CHECK_FUNCTION_EXISTS("connect" CMAKE_HAVE_CONNECT) -- IF(NOT CMAKE_HAVE_CONNECT) -- CHECK_LIBRARY_EXISTS("socket" "connect" "" CMAKE_HAVE_CONNECT) -- ENDIF() -+ CHECK_SYMBOL_EXISTS(connect "sys/types.h;sys/socket.h" CMAKE_HAVE_CONNECT) - - # Define HAVE_NET_SERVICES if gethostbyname & connect were found: - IF (CMAKE_HAVE_GETHOSTBYNAME AND CMAKE_HAVE_CONNECT) - ADD_DEFINITIONS(-DHAVE_NET_SERVICES) -+ CHECK_SYMBOL_EXISTS(fmemopen "stdio.h" HAVE_FMEMOPEN) -+ IF(HAVE_FMEMOPEN) -+ ADD_DEFINITIONS(-DHAVE_FMEMOPEN) -+ ENDIF() - ENDIF () - - # Find curl library, for HTTPS support: -- FIND_PACKAGE(CURL) -- IF (CURL_FOUND) -- INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIR}) -- ADD_DEFINITIONS(-DCFITSIO_HAVE_CURL) -+ OPTION(UseCurl "UseCurl" ON) -+ IF (UseCurl) -+ FIND_PACKAGE(CURL) -+ IF (CURL_FOUND) -+ LIST(APPEND LINK_LIBS "CURL::libcurl") -+ ADD_DEFINITIONS(-DCFITSIO_HAVE_CURL) -+ ENDIF() - ENDIF() - ENDIF() - - SET(SRC_FILES - buffers.c cfileio.c checksum.c -- drvrfile.c drvrmem.c drvrnet.c -+ drvrfile.c drvrmem.c drvrnet.c drvrsmem.c - editcol.c edithdu.c eval_f.c eval_l.c eval_y.c - f77_wrap1.c f77_wrap2.c f77_wrap3.c f77_wrap4.c - fits_hcompress.c fits_hdecompress.c fitscore.c -@@ -123,27 +133,105 @@ SET(SRC_FILES - - # Only include zlib source files if we are building a shared library. - # Users will need to link their executable with zlib independently. --IF (BUILD_SHARED_LIBS) -- set(SRC_FILES ${SRC_FILES} -- zlib/adler32.c zlib/crc32.c zlib/deflate.c zlib/infback.c -- zlib/inffast.c zlib/inflate.c zlib/inftrees.c zlib/trees.c -- zlib/uncompr.c zlib/zutil.c -- ) -+find_package(ZLIB REQUIRED) -+LIST(APPEND LINK_LIBS "ZLIB::ZLIB") -+ -+IF(CFITSIO_USE_SSE2) -+ IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR -+ "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR -+ "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang") -+ ADD_COMPILE_OPTIONS(-msse2) -+ ENDIF() -+ IF(MSVC) -+ ADD_DEFINITIONS(-D__SSE2__=1) -+ ENDIF() -+ENDIF() -+ -+IF(CFITSIO_USE_SSSE3) -+ IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR -+ "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR -+ "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang") -+ ADD_COMPILE_OPTIONS(-mssse3) -+ ENDIF() -+ IF(MSVC) -+ ADD_DEFINITIONS(-D__SSE2__=1 -D__SSSE3__=1) -+ ENDIF() -+ENDIF() -+ -+IF(NOT WIN32) -+ OPTION(CFITSIO_USE_BZIP2 "Enable bzip2 support" OFF) -+ IF(CFITSIO_USE_BZIP2) -+ FIND_PACKAGE(BZip2 REQUIRED) -+ LIST(APPEND LINK_LIBS "BZip2::BZip2") -+ ADD_DEFINITIONS(-DHAVE_BZIP2=1) -+ ENDIF() -+ENDIF() -+ -+# Test for the unix ftruncate function -+CHECK_SYMBOL_EXISTS(ftruncate "unistd.h" HAVE_FTRUNCATE) -+IF(HAVE_FTRUNCATE) -+ ADD_DEFINITIONS(-DHAVE_FTRUNCATE) -+ENDIF() -+ -+# Check is System V IPC is supported on this machine -+CHECK_C_SOURCE_COMPILES(" -+#include -+#include -+#include -+int main() { -+ shmat(0,0,0); -+ shmdt(0); -+ shmget(0, 0, 0); -+ semget(0, 0, 0); -+ return 0; -+}" HAVE_SHMEM_SERVICES) -+IF(HAVE_SHMEM_SERVICES) -+ ADD_DEFINITIONS(-DHAVE_SHMEM_SERVICES) -+ -+ # Some systems define flock_t, for others we have to define it ourselves -+ CHECK_C_SOURCE_COMPILES(" -+ #include -+ int main() { -+ flock_t filler; -+ return 0; -+ }" HAVE_FLOCK_T) -+ IF(HAVE_FLOCK_T) -+ ADD_DEFINITIONS(-DHAVE_FLOCK_T) -+ ENDIF() -+ -+ # Check union semun -+ CHECK_C_SOURCE_COMPILES(" -+ #include -+ #include -+ #include -+ int main() { -+ union semun filler; -+ return 0; -+ }" HAVE_UNION_SEMUN) -+ IF(HAVE_UNION_SEMUN) -+ ADD_DEFINITIONS(-DHAVE_UNION_SEMUN) -+ ENDIF() -+ENDIF() -+ -+IF(WIN32 AND BUILD_SHARED_LIBS) -+ ADD_DEFINITIONS(-Dcfitsio_EXPORTS) - ENDIF() - - ADD_LIBRARY(${LIB_NAME} ${LIB_TYPE} ${H_FILES} ${SRC_FILES}) --TARGET_LINK_LIBRARIES(${LIB_NAME} ${PTHREADS_LIBRARY} ${M_LIB} ${CURL_LIBRARIES}) -+TARGET_LINK_LIBRARIES(${LIB_NAME} ${LINK_LIBS} ${M_LIB}) -+if(CMAKE_C_COMPILER_ID STREQUAL "AppleClang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "12") -+ TARGET_COMPILE_OPTIONS(${LIB_NAME} PRIVATE -Wno-error=implicit-function-declaration) -+endif() - - SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES VERSION ${${PROJECT_NAME}_VERSION} SOVERSION ${${PROJECT_NAME}_MAJOR_VERSION}) --install(TARGETS ${LIB_NAME} DESTINATION ${LIB_DESTINATION}) - install(TARGETS ${LIB_NAME} - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib) - install(FILES ${H_FILES} DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel) - --# Only build test code and executables if building a shared library: --IF (BUILD_SHARED_LIBS) -+# Do not build test code and executables: -+IF (FALSE) - - ENABLE_TESTING() - -@@ -173,7 +261,7 @@ IF (BUILD_SHARED_LIBS) - set_target_properties(FPack Funpack PROPERTIES LINK_FLAGS "setargv.obj") - endif(MSVC) - --ENDIF(BUILD_SHARED_LIBS) -+ENDIF() - - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cfitsio.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/cfitsio.pc @ONLY) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cfitsio.pc DESTINATION lib/pkgconfig/) diff --git a/recipes/cfitsio/all/patches/fix-cmake-3.490.patch b/recipes/cfitsio/all/patches/fix-cmake-3.490.patch index 690a5f19cfee6..534d72e453ee6 100644 --- a/recipes/cfitsio/all/patches/fix-cmake-3.490.patch +++ b/recipes/cfitsio/all/patches/fix-cmake-3.490.patch @@ -1,11 +1,12 @@ --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -4,7 +4,7 @@ +@@ -3,8 +3,8 @@ + # Suppress warning about WIN32 no longer being defined on Cygwin: SET(CMAKE_LEGACY_CYGWIN_WIN32 0) ++CMAKE_MINIMUM_REQUIRED(VERSION 3.1) PROJECT(CFITSIO) -CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0) -+CMAKE_MINIMUM_REQUIRED(VERSION 3.1) # Allow @rpath token in target install name on Macs. # See "cmake --help-policy CMP0042" for more information. @@ -26,7 +27,7 @@ # Allow curl dependency to be disabled using "-DUseCurl=OFF": OPTION(UseCurl "UseCurl" ON) -@@ -58,11 +60,18 @@ IF (BUILD_SHARED_LIBS) +@@ -58,12 +60,19 @@ IF (BUILD_SHARED_LIBS) ENDIF (BUILD_SHARED_LIBS) @@ -37,17 +38,19 @@ IF (USE_PTHREADS) - FIND_PACKAGE(pthreads REQUIRED) - INCLUDE_DIRECTORIES(${PTHREADS_INCLUDE_DIR}) +- ADD_DEFINITIONS(-D_REENTRANT) + SET(CMAKE_THREAD_PREFER_PTHREAD TRUE) + SET(THREADS_PREFER_PTHREAD_FLAG TRUE) + FIND_PACKAGE(Threads REQUIRED) + IF(CMAKE_USE_PTHREADS_INIT) + LIST(APPEND LINK_LIBS "Threads::Threads") + ELSE() -+ LIST(APPEND LINK_LIBS "CONAN_PKG::pthreads4w") ++ find_package(pthreads4w REQUIRED CONFIG) ++ LIST(APPEND LINK_LIBS "pthreads4w::pthreads4w") + ENDIF() - ADD_DEFINITIONS(-D_REENTRANT) ENDIF() + # Math library (not available in MSVC or MINGW) @@ -74,29 +83,27 @@ ELSE() ENDIF() @@ -95,7 +98,7 @@ editcol.c edithdu.c eval_f.c eval_l.c eval_y.c f77_wrap1.c f77_wrap2.c f77_wrap3.c f77_wrap4.c fits_hcompress.c fits_hdecompress.c fitscore.c -@@ -128,30 +135,105 @@ SET(SRC_FILES +@@ -128,30 +135,99 @@ SET(SRC_FILES # Only include zlib source files if we are building a shared library. # Users will need to link their executable with zlib independently. @@ -130,13 +133,11 @@ + ENDIF() +ENDIF() + -+IF(NOT WIN32) -+ OPTION(CFITSIO_USE_BZIP2 "Enable bzip2 support" OFF) -+ IF(CFITSIO_USE_BZIP2) -+ FIND_PACKAGE(BZip2 REQUIRED) -+ LIST(APPEND LINK_LIBS "BZip2::BZip2") -+ ADD_DEFINITIONS(-DHAVE_BZIP2=1) -+ ENDIF() ++OPTION(CFITSIO_USE_BZIP2 "Enable bzip2 support" OFF) ++IF(CFITSIO_USE_BZIP2) ++ FIND_PACKAGE(BZip2 REQUIRED) ++ LIST(APPEND LINK_LIBS "BZip2::BZip2") ++ ADD_DEFINITIONS(-DHAVE_BZIP2=1) +ENDIF() + +# Test for the unix ftruncate function @@ -183,10 +184,6 @@ + IF(HAVE_UNION_SEMUN) + ADD_DEFINITIONS(-DHAVE_UNION_SEMUN) + ENDIF() -+ENDIF() -+ -+IF(WIN32 AND BUILD_SHARED_LIBS) -+ ADD_DEFINITIONS(-Dcfitsio_EXPORTS) ENDIF() ADD_LIBRARY(${LIB_NAME} ${LIB_TYPE} ${H_FILES} ${SRC_FILES}) @@ -214,7 +211,7 @@ ENABLE_TESTING() -@@ -181,7 +263,7 @@ IF (BUILD_SHARED_LIBS) +@@ -181,7 +257,7 @@ IF (BUILD_SHARED_LIBS) set_target_properties(FPack Funpack PROPERTIES LINK_FLAGS "setargv.obj") endif(MSVC) diff --git a/recipes/cfitsio/all/patches/fix-cmake-4.0.0.patch b/recipes/cfitsio/all/patches/fix-cmake-4.0.0.patch index aa6952cfb90bd..11bf2a97188e8 100644 --- a/recipes/cfitsio/all/patches/fix-cmake-4.0.0.patch +++ b/recipes/cfitsio/all/patches/fix-cmake-4.0.0.patch @@ -9,24 +9,22 @@ # Find curl library, for HTTPS support: IF(USE_CURL) FIND_PACKAGE(CURL) -@@ -82,8 +82,14 @@ IF(NOT MSVC) - ENDIF(NOT MSVC) +@@ -79,11 +79,12 @@ IF(NOT MSVC) + ADD_DEFINITIONS(-DCFITSIO_HAVE_CURL) + ENDIF() + ENDIF() +-ENDIF(NOT MSVC) ++ENDIF() IF(USE_PTHREADS) -- FIND_PACKAGE(Threads REQUIRED) ++ SET(CMAKE_THREAD_PREFER_PTHREAD TRUE) ++ SET(THREADS_PREFER_PTHREAD_FLAG TRUE) + FIND_PACKAGE(Threads REQUIRED) - ADD_DEFINITIONS(-D_REENTRANT) -+ SET(CMAKE_THREAD_PREFER_PTHREAD TRUE) -+ SET(THREADS_PREFER_PTHREAD_FLAG TRUE) -+ FIND_PACKAGE(Threads REQUIRED) -+ IF(CMAKE_USE_PTHREADS_INIT) -+ LIST(APPEND LINK_LIBS "Threads::Threads") -+ ELSE() -+ LIST(APPEND LINK_LIBS "CONAN_PKG::pthreads4w") -+ ENDIF() ENDIF(USE_PTHREADS) IF(CFITSIO_USE_BZIP2) -@@ -99,19 +105,13 @@ ELSE() +@@ -99,19 +100,13 @@ ELSE() ENDIF() # Support for remote file drivers is not implemented for native Windows: @@ -49,8 +47,41 @@ # Define HAVE_NET_SERVICES if gethostbyname & connect were found: IF (CMAKE_HAVE_GETHOSTBYNAME AND CMAKE_HAVE_CONNECT) -@@ -275,7 +275,6 @@ IF (BZIP2_FOUND) - ENDIF(BZIP2_FOUND) +@@ -256,26 +251,27 @@ ADD_LIBRARY(${LIB_NAME} ${LIB_TYPE} ${H_FILES} ${SRC_FILES}) + TARGET_LINK_LIBRARIES(${LIB_NAME} ${M_LIB}) + # zlib: + IF (ZLIB_FOUND) +- TARGET_INCLUDE_DIRECTORIES(${LIB_NAME} PUBLIC ${ZLIB_INCLUDE_DIR}) +- TARGET_LINK_LIBRARIES(${LIB_NAME} ${ZLIB_LIBRARIES}) ++ TARGET_LINK_LIBRARIES(${LIB_NAME} ZLIB::ZLIB) + ENDIF(ZLIB_FOUND) + # cURL: +-IF (CURL_FOUND) +- TARGET_INCLUDE_DIRECTORIES(${LIB_NAME} PUBLIC ${CURL_INCLUDE_DIRS}) +- TARGET_LINK_LIBRARIES(${LIB_NAME} ${CURL_LIBRARIES}) +-ENDIF(CURL_FOUND) ++IF (USE_CURL) ++ TARGET_LINK_LIBRARIES(${LIB_NAME} CURL::libcurl) ++ENDIF() + # PThreads: +-IF (THREADS_FOUND) ++IF (USE_PTHREADS) ++ IF(CMAKE_USE_PTHREADS_INIT) + TARGET_LINK_LIBRARIES(${LIB_NAME} Threads::Threads) +-ENDIF(THREADS_FOUND) ++ ELSE() ++ find_package(pthreads4w REQUIRED CONFIG) ++ TARGET_LINK_LIBRARIES(${LIB_NAME} pthreads4w::pthreads4w) ++ ENDIF() ++ENDIF() + # BZip2: +-IF (BZIP2_FOUND) +- TARGET_INCLUDE_DIRECTORIES(${LIB_NAME} PUBLIC ${BZIP2_INCLUDE_DIRS}) +- TARGET_LINK_LIBRARIES(${LIB_NAME} ${BZIP2_LIBRARIES}) +-ENDIF(BZIP2_FOUND) ++IF (CFITSIO_USE_BZIP2) ++ TARGET_LINK_LIBRARIES(${LIB_NAME} BZip2::BZip2) ++ENDIF() SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES VERSION ${${PROJECT_NAME}_VERSION} SOVERSION ${${PROJECT_NAME}_MAJOR_VERSION}) -install(TARGETS ${LIB_NAME} DESTINATION ${LIB_DESTINATION}) diff --git a/recipes/cfitsio/all/patches/fix-cmake-4.1.0.patch b/recipes/cfitsio/all/patches/fix-cmake-4.1.0.patch index c067c25a4a81b..fdb577f16de6d 100644 --- a/recipes/cfitsio/all/patches/fix-cmake-4.1.0.patch +++ b/recipes/cfitsio/all/patches/fix-cmake-4.1.0.patch @@ -1,6 +1,6 @@ --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -82,8 +82,14 @@ IF(NOT WIN32) +@@ -82,8 +82,9 @@ IF(NOT WIN32) ENDIF(NOT WIN32) IF(USE_PTHREADS) @@ -8,15 +8,10 @@ + SET(THREADS_PREFER_PTHREAD_FLAG TRUE) FIND_PACKAGE(Threads REQUIRED) - ADD_DEFINITIONS(-D_REENTRANT) -+ IF(CMAKE_USE_PTHREADS_INIT) -+ LIST(APPEND LINK_LIBS "Threads::Threads") -+ ELSE() -+ LIST(APPEND LINK_LIBS "CONAN_PKG::pthreads4w") -+ ENDIF() ENDIF(USE_PTHREADS) IF(USE_BZIP2) -@@ -99,19 +105,13 @@ ELSE() +@@ -99,19 +100,13 @@ ELSE() ENDIF() # Support for remote file drivers is not implemented for native Windows: @@ -39,3 +34,46 @@ # Define HAVE_NET_SERVICES if gethostbyname & connect were found: IF (CMAKE_HAVE_GETHOSTBYNAME AND CMAKE_HAVE_CONNECT) +@@ -256,28 +251,30 @@ ADD_LIBRARY(${LIB_NAME} ${LIB_TYPE} ${H_FILES} ${SRC_FILES}) + TARGET_LINK_LIBRARIES(${LIB_NAME} ${M_LIB}) + # zlib: + IF (ZLIB_FOUND) +- TARGET_INCLUDE_DIRECTORIES(${LIB_NAME} PUBLIC ${ZLIB_INCLUDE_DIR}) +- TARGET_LINK_LIBRARIES(${LIB_NAME} ${ZLIB_LIBRARIES}) ++ TARGET_LINK_LIBRARIES(${LIB_NAME} ZLIB::ZLIB) + # For cfitsio.pc.cmake: + SET (PKG_CONFIG_LIBS "${PKG_CONFIG_LIBS} -lz") + ENDIF(ZLIB_FOUND) + # cURL: +-IF (CURL_FOUND) +- TARGET_INCLUDE_DIRECTORIES(${LIB_NAME} PUBLIC ${CURL_INCLUDE_DIRS}) +- TARGET_LINK_LIBRARIES(${LIB_NAME} ${CURL_LIBRARIES}) ++IF (USE_CURL) ++ TARGET_LINK_LIBRARIES(${LIB_NAME} CURL::libcurl) + # For cfitsio.pc.cmake: + SET (PKG_CONFIG_LIBS "${PKG_CONFIG_LIBS} -lcurl") +-ENDIF(CURL_FOUND) ++ENDIF() + # PThreads: +-IF (THREADS_FOUND) ++IF (USE_PTHREADS) ++ IF(CMAKE_USE_PTHREADS_INIT) + TARGET_LINK_LIBRARIES(${LIB_NAME} Threads::Threads) +-ENDIF(THREADS_FOUND) ++ ELSE() ++ find_package(pthreads4w REQUIRED CONFIG) ++ TARGET_LINK_LIBRARIES(${LIB_NAME} pthreads4w::pthreads4w) ++ ENDIF() ++ENDIF() + # BZip2: +-IF (BZIP2_FOUND) +- TARGET_INCLUDE_DIRECTORIES(${LIB_NAME} PUBLIC ${BZIP2_INCLUDE_DIRS}) +- TARGET_LINK_LIBRARIES(${LIB_NAME} ${BZIP2_LIBRARIES}) ++IF (USE_BZIP2) ++ TARGET_LINK_LIBRARIES(${LIB_NAME} BZip2::BZip2) + SET (PKG_CONFIG_LIBS "${PKG_CONFIG_LIBS} -lbz2") +-ENDIF(BZIP2_FOUND) ++ENDIF() + + SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES VERSION ${${PROJECT_NAME}_VERSION} SOVERSION ${${PROJECT_NAME}_MAJOR}) + include(GNUInstallDirs) diff --git a/recipes/cfitsio/all/patches/fix-cmake-4.2.0.patch b/recipes/cfitsio/all/patches/fix-cmake-4.2.0.patch new file mode 100644 index 0000000000000..c879f08adda8b --- /dev/null +++ b/recipes/cfitsio/all/patches/fix-cmake-4.2.0.patch @@ -0,0 +1,79 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -82,8 +82,9 @@ IF(NOT WIN32) + ENDIF(NOT WIN32) + + IF(USE_PTHREADS) ++ SET(CMAKE_THREAD_PREFER_PTHREAD TRUE) ++ SET(THREADS_PREFER_PTHREAD_FLAG TRUE) + FIND_PACKAGE(Threads REQUIRED) +- ADD_DEFINITIONS(-D_REENTRANT) + ENDIF(USE_PTHREADS) + + IF(USE_BZIP2) +@@ -99,19 +100,13 @@ ELSE() + ENDIF() + + # Support for remote file drivers is not implemented for native Windows: +-IF (NOT MSVC) ++IF (NOT WIN32) + + # Find library needed for gethostbyname: +- CHECK_FUNCTION_EXISTS("gethostbyname" CMAKE_HAVE_GETHOSTBYNAME) +- IF (NOT CMAKE_HAVE_GETHOSTBYNAME) +- CHECK_LIBRARY_EXISTS("nsl" "gethostbyname" "" CMAKE_HAVE_GETHOSTBYNAME) +- ENDIF () ++ CHECK_SYMBOL_EXISTS(gethostbyname "netdb.h" CMAKE_HAVE_GETHOSTBYNAME) + + # Find library needed for connect: +- CHECK_FUNCTION_EXISTS("connect" CMAKE_HAVE_CONNECT) +- IF (NOT CMAKE_HAVE_CONNECT) +- CHECK_LIBRARY_EXISTS("socket" "connect" "" CMAKE_HAVE_CONNECT) +- ENDIF () ++ CHECK_SYMBOL_EXISTS(connect "sys/types.h;sys/socket.h" CMAKE_HAVE_CONNECT) + + # Define HAVE_NET_SERVICES if gethostbyname & connect were found: + IF (CMAKE_HAVE_GETHOSTBYNAME AND CMAKE_HAVE_CONNECT) +@@ -265,28 +260,30 @@ TARGET_INCLUDE_DIRECTORIES(${LIB_NAME} PUBLIC + TARGET_LINK_LIBRARIES(${LIB_NAME} ${M_LIB}) + # zlib: + IF (ZLIB_FOUND) +- TARGET_INCLUDE_DIRECTORIES(${LIB_NAME} PUBLIC ${ZLIB_INCLUDE_DIR}) +- TARGET_LINK_LIBRARIES(${LIB_NAME} ${ZLIB_LIBRARIES}) ++ TARGET_LINK_LIBRARIES(${LIB_NAME} ZLIB::ZLIB) + # For cfitsio.pc.cmake: + SET (PKG_CONFIG_LIBS "${PKG_CONFIG_LIBS} -lz") + ENDIF(ZLIB_FOUND) + # cURL: +-IF (CURL_FOUND) +- TARGET_INCLUDE_DIRECTORIES(${LIB_NAME} PUBLIC ${CURL_INCLUDE_DIRS}) +- TARGET_LINK_LIBRARIES(${LIB_NAME} ${CURL_LIBRARIES}) ++IF (USE_CURL) ++ TARGET_LINK_LIBRARIES(${LIB_NAME} CURL::libcurl) + # For cfitsio.pc.cmake: + SET (PKG_CONFIG_LIBS "${PKG_CONFIG_LIBS} -lcurl") +-ENDIF(CURL_FOUND) ++ENDIF() + # PThreads: +-IF (THREADS_FOUND) ++IF (USE_PTHREADS) ++ IF(CMAKE_USE_PTHREADS_INIT) + TARGET_LINK_LIBRARIES(${LIB_NAME} Threads::Threads) +-ENDIF(THREADS_FOUND) ++ ELSE() ++ find_package(pthreads4w REQUIRED CONFIG) ++ TARGET_LINK_LIBRARIES(${LIB_NAME} pthreads4w::pthreads4w) ++ ENDIF() ++ENDIF() + # BZip2: +-IF (BZIP2_FOUND) +- TARGET_INCLUDE_DIRECTORIES(${LIB_NAME} PUBLIC ${BZIP2_INCLUDE_DIRS}) +- TARGET_LINK_LIBRARIES(${LIB_NAME} ${BZIP2_LIBRARIES}) ++IF (USE_BZIP2) ++ TARGET_LINK_LIBRARIES(${LIB_NAME} BZip2::BZip2) + SET (PKG_CONFIG_LIBS "${PKG_CONFIG_LIBS} -lbz2") +-ENDIF(BZIP2_FOUND) ++ENDIF() + + SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES VERSION ${${PROJECT_NAME}_VERSION} SOVERSION ${${PROJECT_NAME}_MAJOR}) + diff --git a/recipes/cfitsio/all/test_package/CMakeLists.txt b/recipes/cfitsio/all/test_package/CMakeLists.txt index d376289c5a2fe..15673258662b0 100644 --- a/recipes/cfitsio/all/test_package/CMakeLists.txt +++ b/recipes/cfitsio/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(cfitsio REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} cfitsio::cfitsio) +target_link_libraries(${PROJECT_NAME} PRIVATE cfitsio::cfitsio) diff --git a/recipes/cfitsio/all/test_package/conanfile.py b/recipes/cfitsio/all/test_package/conanfile.py index 5d7487325efa0..7848c0589b0c7 100644 --- a/recipes/cfitsio/all/test_package/conanfile.py +++ b/recipes/cfitsio/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, run=True) 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") fits_name = os.path.join(self.source_folder, "file011.fits") - bin_path = os.path.join("bin", "test_package") - self.run("\"{0}\" \"{1}\"".format(bin_path, fits_name), run_environment=True) + self.run(f"{bin_path} \"{fits_name}\"", env="conanrun") diff --git a/recipes/cfitsio/all/test_v1_package/CMakeLists.txt b/recipes/cfitsio/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/cfitsio/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/cfitsio/all/test_v1_package/conanfile.py b/recipes/cfitsio/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..6fb307c712d29 --- /dev/null +++ b/recipes/cfitsio/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") + fits_name = os.path.join(self.source_folder, os.pardir, "test_package", "file011.fits") + self.run(f"{bin_path} \"{fits_name}\"", run_environment=True) diff --git a/recipes/cfitsio/config.yml b/recipes/cfitsio/config.yml index cc5b885b36e75..bfb174dc329f7 100644 --- a/recipes/cfitsio/config.yml +++ b/recipes/cfitsio/config.yml @@ -1,11 +1,15 @@ versions: + "4.4.0": + folder: all + "4.3.1": + folder: all + "4.3.0": + folder: all + "4.2.0": + folder: all "4.1.0": folder: all "4.0.0": folder: all "3.490": folder: all - "3.480": - folder: all - "3.470": - folder: all diff --git a/recipes/cgal/all/conandata.yml b/recipes/cgal/all/conandata.yml index a9e86a3361343..df69f91fa95f3 100644 --- a/recipes/cgal/all/conandata.yml +++ b/recipes/cgal/all/conandata.yml @@ -1,13 +1,4 @@ sources: - "5.0.4": - sha256: e82096c03ccb31200f02a5b9bd0a5e9ea07840351987dca55aae99a8d5823f59 - url: https://github.com/CGAL/cgal/releases/download/v5.0.4/CGAL-5.0.4.tar.xz - "5.1.5": - sha256: b1bb8a6053aa12baa5981aef20a542cd3e617a86826963fb8fb6852b1a0da97c - url: https://github.com/CGAL/cgal/releases/download/v5.1.5/CGAL-5.1.5.tar.xz - "5.2.4": - sha256: 7f792c59d067e41a073bcee5d615f4276f9ccd2b5e7d359093cc36149fda14c3 - url: https://github.com/CGAL/cgal/releases/download/v5.2.4/CGAL-5.2.4.tar.xz "5.3.2": sha256: af917dbc550388ebcb206f774e610fbdb914d95a4b2932fa952279129103852b url: https://github.com/CGAL/cgal/releases/download/v5.3.2/CGAL-5.3.2.tar.xz @@ -17,3 +8,58 @@ sources: "5.5.1": sha256: 091630def028facdcaf00eb5b68ad79eddac1b855cca6e87eef18a031566edfc url: https://github.com/CGAL/cgal/releases/download/v5.5.1/CGAL-5.5.1.tar.xz + "5.5.2": + sha256: b2b05d5616ecc69facdc24417cce0b04fb4321491d107db45103add520e3d8c3 + url: https://github.com/CGAL/cgal/releases/download/v5.5.2/CGAL-5.5.2.tar.xz + "5.5.3": + sha256: 0a04f662693256328b05babfabb5e3a5b7db2f5a58d52e3c520df9d0828ddd73 + url: https://github.com/CGAL/cgal/releases/download/v5.5.3/CGAL-5.5.3.tar.xz + "5.5.5": + sha256: c74aab989e0fefc98f1e76f96831f6a75a92ade4ea0de7501947dc42e3ec987c + url: https://github.com/CGAL/cgal/releases/download/v5.5.5/CGAL-5.5.5.tar.xz + "5.6": + sha256: dcab9b08a50a06a7cc2cc69a8a12200f8d8f391b9b8013ae476965c10b45161f + url: https://github.com/CGAL/cgal/releases/download/v5.6/CGAL-5.6.tar.xz + "5.6.1": + sha256: cdb15e7ee31e0663589d3107a79988a37b7b1719df3d24f2058545d1bcdd5837 + url: https://github.com/CGAL/cgal/releases/download/v5.6.1/CGAL-5.6.1.tar.xz + "5.6.2": + sha256: 458f60df8e8f1f2fdad93c8f24e1aa8f4b095cc61a14fac81b90680d7306a42e + url: https://github.com/CGAL/cgal/releases/download/v5.6.2/CGAL-5.6.2.tar.xz + "6.0": + sha256: ed53a1498569a22341b482e579c6a3caf9ecbfb6e013f5a90ce780138073b520 + url: https://github.com/CGAL/cgal/releases/download/v6.0/CGAL-6.0-library.tar.xz + "6.0.1": + sha256: c752737f91d1af71fa96038f0e37945ce82a5f1fffb6200172cfcdd77755a356 + url: https://github.com/CGAL/cgal/releases/download/v6.0.1/CGAL-6.0.1-library.tar.xz +patches: + "5.3.2": + - patch_file: "patches/0001-fix-for-conan.patch" + patch_type: bugfix + patch_source: https://github.com/CGAL/cgal/pull/7502 + patch_description: Fix Eigen3 support in CGAL + "5.5": + - patch_file: "patches/0001-fix-for-conan.patch" + patch_type: bugfix + patch_source: https://github.com/CGAL/cgal/pull/7502 + patch_description: Fix Eigen3 support in CGAL + "5.5.1": + - patch_file: "patches/0001-fix-for-conan.patch" + patch_type: bugfix + patch_source: https://github.com/CGAL/cgal/pull/7502 + patch_description: Fix Eigen3 support in CGAL + "5.5.2": + - patch_file: "patches/0001-fix-for-conan.patch" + patch_type: bugfix + patch_source: https://github.com/CGAL/cgal/pull/7502 + patch_description: Fix Eigen3 support in CGAL + "5.5.3": + - patch_file: "patches/0001-fix-for-conan.patch" + patch_type: bugfix + patch_source: https://github.com/CGAL/cgal/pull/7502 + patch_description: Fix Eigen3 support in CGAL + "5.5.5": + - patch_file: "patches/0001-fix-for-conan.patch" + patch_type: bugfix + patch_source: https://github.com/CGAL/cgal/pull/7502 + patch_description: Fix Eigen3 support in CGAL diff --git a/recipes/cgal/all/conanfile.py b/recipes/cgal/all/conanfile.py index 47cc7c6fa95ce..68460d558b139 100644 --- a/recipes/cgal/all/conanfile.py +++ b/recipes/cgal/all/conanfile.py @@ -1,8 +1,11 @@ import os +import textwrap from conan import ConanFile -from conan.tools import files -from conan.tools import scm -from conans import CMake +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import get, replace_in_file, rmdir, rm, copy, save, export_conandata_patches, apply_conandata_patches +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration required_conan_version = ">=1.50.0" @@ -14,63 +17,183 @@ class CgalConan(ConanFile): description = "C++ library that provides easy access to efficient and reliable algorithms"\ " in computational geometry." topics = ("cgal", "geometry", "algorithms") + package_type = "header-library" settings = "os", "compiler", "build_type", "arch" - generators = "cmake" - exports_sources = "CMakeLists.txt" + generators = "CMakeDeps" short_paths = True - _cmake = None + @property + def _requires_cpp17(self): + return Version(self.version) >= "6.0" @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return "17" if self._requires_cpp17 else "14" @property - def _build_subfolder(self): - return "build_subfolder" + def _minimum_compilers_version(self): + return { + "Visual Studio": "15", + "msvc": "191", + "gcc": "7" if self._requires_cpp17 else "5", + "clang": "7" if self._requires_cpp17 else "5", + "apple-clang": "5.1", + } - def _configure_cmake(self): - if not self._cmake: - self._cmake = CMake(self) - self._cmake.definitions["CGAL_HEADER_ONLY"] = "TRUE" - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def export_sources(self): + export_conandata_patches(self) - def _patch_sources(self): - if scm.Version(self.version) < "5.3": - files.replace_in_file(self, os.path.join(self._source_subfolder, "CMakeLists.txt"), - "CMAKE_SOURCE_DIR", "CMAKE_CURRENT_SOURCE_DIR") - else: - files.replace_in_file(self, os.path.join(self._source_subfolder, "CMakeLists.txt"), - "if(NOT PROJECT_NAME)", "if(TRUE)") + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("boost/1.75.0") - self.requires("eigen/3.3.9") - self.requires("mpfr/4.1.0") + self.requires("boost/1.83.0") + self.requires("eigen/3.4.0") + self.requires("mpfr/4.2.1") + self.requires("gmp/6.3.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) + 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 _patch_sources(self): + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "if(NOT PROJECT_NAME)", "if(1)", strict=False) + apply_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], strip_root=True) + + def generate(self): + tc = CMakeToolchain(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("LICENSE*", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + cmake = CMake(self) cmake.install() - files.rmdir(self, os.path.join(self.package_folder, "share")) - files.rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) - files.rmdir(self, os.path.join(self.package_folder, "bin")) + copy(self, "LICENSE*", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "bin")) + rm(self, "*Config*.cmake", os.path.join(self.package_folder, "lib", "cmake", "CGAL")) + rm(self, "Find*.cmake", os.path.join(self.package_folder, "lib", "cmake", "CGAL")) + self._create_cmake_module_variables( + os.path.join(self.package_folder, self._cmake_module_file_rel_path) + ) + + def _create_cmake_module_variables(self, module_file): + ''' + CGAL requires C++14 or C++17, and specific compilers flags to enable the possibility to set FPU rounding modes. + This CMake module, from the upstream CGAL pull-request https://github.com/CGAL/cgal/pull/7512, takes + care of all the known compilers CGAL has ever supported. + ''' + content = "" + if Version(self.version) < "6.0": + content = textwrap.dedent('''\ + function(CGAL_setup_CGAL_flags target) + # CGAL now requires C++14. `decltype(auto)` is used as a marker of + # C++14. + target_compile_features(${target} INTERFACE cxx_decltype_auto) + + if(MSVC) + target_compile_options(${target} INTERFACE + "-D_SCL_SECURE_NO_DEPRECATE;-D_SCL_SECURE_NO_WARNINGS") + if(CMAKE_VERSION VERSION_LESS 3.11) + target_compile_options(${target} INTERFACE + /fp:strict + /fp:except- + /wd4503 # Suppress warnings C4503 about "decorated name length exceeded" + /bigobj # Use /bigobj by default + ) + else() + # The MSVC generator supports `$` since CMake 3.11. + target_compile_options(${target} INTERFACE + $<$:/fp:strict> + $<$:/fp:except-> + $<$:/wd4503> # Suppress warnings C4503 about "decorated name length exceeded" + $<$:/bigobj> # Use /bigobj by default + ) + endif() + elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "AppleClang") + if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 11.0.3) + message(STATUS "Apple Clang version ${CMAKE_CXX_COMPILER_VERSION} compiler detected") + message(STATUS "Boost MP is turned off for all Apple Clang versions below 11.0.3!") + target_compile_options(${target} INTERFACE "-DCGAL_DO_NOT_USE_BOOST_MP") + endif() + elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel") + message( STATUS "Using Intel Compiler. Adding -fp-model strict" ) + if(WIN32) + target_compile_options(${target} INTERFACE "/fp:strict") + else() + target_compile_options(${target} INTERFACE "-fp-model" "strict") + endif() + elseif(CMAKE_CXX_COMPILER_ID MATCHES "SunPro") + message( STATUS "Using SunPro compiler, using STLPort 4." ) + target_compile_options(${target} INTERFACE + "-features=extensions;-library=stlport4;-D_GNU_SOURCE") + target_link_libraries(${target} INTERFACE "-library=stlport4") + elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU") + if ( RUNNING_CGAL_AUTO_TEST OR CGAL_TEST_SUITE ) + target_compile_options(${target} INTERFACE "-Wall") + endif() + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 3) + message( STATUS "Using gcc version 4 or later. Adding -frounding-math" ) + if(CMAKE_VERSION VERSION_LESS 3.3) + target_compile_options(${target} INTERFACE "-frounding-math") + else() + target_compile_options(${target} INTERFACE "$<$:-frounding-math>") + endif() + endif() + if ( "${GCC_VERSION}" MATCHES "^4.2" ) + message( STATUS "Using gcc version 4.2. Adding -fno-strict-aliasing" ) + target_compile_options(${target} INTERFACE "-fno-strict-aliasing" ) + endif() + if ( "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "alpha" ) + message( STATUS "Using gcc on alpha. Adding -mieee -mfp-rounding-mode=d" ) + target_compile_options(${target} INTERFACE "-mieee" "-mfp-rounding-mode=d" ) + endif() + endif() + endfunction() + ''') + + else: + content = textwrap.dedent('''\ + include(${CMAKE_CURRENT_LIST_DIR}/CGAL_SetupCGALDependencies.cmake) + ''') + content += textwrap.dedent('''\ + CGAL_setup_CGAL_flags(CGAL::CGAL) + + # CGAL use may rely on the presence of those two variables + set(CGAL_USE_GMP TRUE CACHE INTERNAL "CGAL library is configured to use GMP") + set(CGAL_USE_MPFR TRUE CACHE INTERNAL "CGAL library is configured to use MPFR") + ''') + save(self, module_file, content) + + @property + def _cmake_module_file_rel_path(self): + return os.path.join("lib", "cmake", "CGAL", f"conan-official-{self.name}-variables.cmake") + + @property + def _module_subfolder(self): + return os.path.join("lib", "cmake", "CGAL") def package_info(self): - self.cpp_info.names["cmake_find_package"] = "CGAL" - self.cpp_info.names["cmake_find_package_multi"] = "CGAL" if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("m") - self.cpp_info.defines.append("CGAL_HEADER_ONLY=1") + self.cpp_info.builddirs.append(self._module_subfolder) + self.cpp_info.set_property("cmake_find_package", "CGAL") + self.cpp_info.set_property("cmake_target_name", "CGAL::CGAL") + self.cpp_info.set_property("cmake_build_modules", [self._cmake_module_file_rel_path]) diff --git a/recipes/cgal/all/patches/0001-fix-for-conan.patch b/recipes/cgal/all/patches/0001-fix-for-conan.patch new file mode 100644 index 0000000000000..36b4eaceca05a --- /dev/null +++ b/recipes/cgal/all/patches/0001-fix-for-conan.patch @@ -0,0 +1,22 @@ +diff --git a/cmake/modules/CGAL_Eigen3_support.cmake b/cmake/modules/CGAL_Eigen3_support.cmake +index cc0df0fad10..bfcf56c7c2f 100644 +--- a/cmake/modules/CGAL_Eigen3_support.cmake ++++ b/cmake/modules/CGAL_Eigen3_support.cmake +@@ -1,9 +1,14 @@ +-if(EIGEN3_FOUND AND NOT TARGET CGAL::Eigen3_support) ++if((EIGEN3_FOUND OR Eigen3_FOUND) AND NOT TARGET CGAL::Eigen3_support) + if(NOT TARGET Threads::Threads) + find_package(Threads REQUIRED) + endif() + add_library(CGAL::Eigen3_support INTERFACE IMPORTED) + set_target_properties(CGAL::Eigen3_support PROPERTIES +- INTERFACE_COMPILE_DEFINITIONS "CGAL_EIGEN3_ENABLED" +- INTERFACE_INCLUDE_DIRECTORIES "${EIGEN3_INCLUDE_DIR}") ++ INTERFACE_COMPILE_DEFINITIONS "CGAL_EIGEN3_ENABLED") ++ if(TARGET Eigen3::Eigen) ++ target_link_libraries(CGAL::Eigen3_support INTERFACE Eigen3::Eigen) ++ else() ++ set_target_properties(CGAL::Eigen3_support PROPERTIES ++ INTERFACE_INCLUDE_DIRECTORIES "${EIGEN3_INCLUDE_DIR}") ++ endif() + endif() diff --git a/recipes/cgal/all/test_package/CMakeLists.txt b/recipes/cgal/all/test_package/CMakeLists.txt index c5080a4f875bc..f704ccdcb3f0e 100644 --- a/recipes/cgal/all/test_package/CMakeLists.txt +++ b/recipes/cgal/all/test_package/CMakeLists.txt @@ -1,9 +1,10 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.10) project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(CGAL REQUIRED) +find_package(Eigen3 REQUIRED) +include(CGAL_Eigen3_support) 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 CGAL::CGAL) +target_link_libraries(${PROJECT_NAME} PRIVATE CGAL::Eigen3_support) diff --git a/recipes/cgal/all/test_package/conanfile.py b/recipes/cgal/all/test_package/conanfile.py index 2b959f9f04238..539dd819448cb 100644 --- a/recipes/cgal/all/test_package/conanfile.py +++ b/recipes/cgal/all/test_package/conanfile.py @@ -1,20 +1,26 @@ import os from conan import ConanFile -from conan.tools import build -from conans import CMake - +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 = "CMakeDeps", "CMakeToolchain" + + def requirements(self): + self.requires("eigen/3.4.0") + 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 build.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + cmd = os.path.join(self.cpp.build.bindir, "test_package") + self.run(cmd, env="conanrun") diff --git a/recipes/cgal/config.yml b/recipes/cgal/config.yml index 72209e170658c..3222dda4bec5c 100644 --- a/recipes/cgal/config.yml +++ b/recipes/cgal/config.yml @@ -1,13 +1,23 @@ versions: - "5.0.4": - folder: all - "5.1.5": - folder: all - "5.2.4": - folder: all "5.3.2": folder: all "5.5": folder: all "5.5.1": folder: all + "5.5.2": + folder: all + "5.5.3": + folder: all + "5.5.5": + folder: all + "5.6": + folder: all + "5.6.1": + folder: all + "5.6.2": + folder: all + "6.0": + folder: all + "6.0.1": + folder: all diff --git a/recipes/cgif/all/conandata.yml b/recipes/cgif/all/conandata.yml new file mode 100644 index 0000000000000..6cfe1b1bc6c90 --- /dev/null +++ b/recipes/cgif/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "0.3.2": + url: "https://github.com/dloebl/cgif/archive/V0.3.2.tar.gz" + sha256: "0abf83b7617f4793d9ab3a4d581f4e8d7548b56a29e3f95b0505f842cbfd7f95" + "0.3.0": + url: "https://github.com/dloebl/cgif/archive/refs/tags/V0.3.0.tar.gz" + sha256: "c4f70bbae4c6afee3a524e65be31ae495201fd26687cb8429d7aded8be96306a" diff --git a/recipes/cgif/all/conanfile.py b/recipes/cgif/all/conanfile.py new file mode 100644 index 0000000000000..0f4eab97dfc4f --- /dev/null +++ b/recipes/cgif/all/conanfile.py @@ -0,0 +1,93 @@ +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, rmdir +from conan.tools.layout import basic_layout +from conan.tools.meson import Meson, MesonToolchain +from conan.tools.microsoft import is_msvc +import os + +required_conan_version = ">=1.53.0" + + +class CgifConan(ConanFile): + name = "cgif" + description = "GIF encoder written in C" + license = "MIT" + topics = ("gif", "encoder", "image") + homepage = "https://github.com/dloebl/cgif" + 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): + basic_layout(self, src_folder="src") + + def validate(self): + if is_msvc(self) and self.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} doesn't support shared build with Visual Studio") + + def build_requirements(self): + self.tool_requires("meson/1.2.1") + + def source(self): + 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["tests"] = "false" + tc.generate() + + def build(self): + meson = Meson(self) + meson.configure() + meson.build() + + def package(self): + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + meson = Meson(self) + meson.install() + 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", "cgif") + self.cpp_info.libs = ["cgif"] + +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/cgif/all/test_package/CMakeLists.txt b/recipes/cgif/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..8bd0525b16741 --- /dev/null +++ b/recipes/cgif/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES C) + +find_package(cgif REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE cgif::cgif) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) diff --git a/recipes/cgif/all/test_package/conanfile.py b/recipes/cgif/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0a6bc68712d90 --- /dev/null +++ b/recipes/cgif/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/cgif/all/test_package/test_package.c b/recipes/cgif/all/test_package/test_package.c new file mode 100644 index 0000000000000..98fcceb5d13b6 --- /dev/null +++ b/recipes/cgif/all/test_package/test_package.c @@ -0,0 +1,53 @@ +#include + +#include +#include +#include + +#define WIDTH 1024 +#define HEIGHT 1024 + +static void initGIFConfig(CGIF_Config *pConfig, char *path, uint16_t width, + uint16_t height, uint8_t *pPalette, + uint16_t numColors) +{ + memset(pConfig, 0, sizeof(CGIF_Config)); + pConfig->width = width; + pConfig->height = height; + pConfig->pGlobalPalette = pPalette; + pConfig->numGlobalPaletteEntries = numColors; + pConfig->path = path; +} + +static void initFrameConfig(CGIF_FrameConfig *pConfig, uint8_t *pImageData) +{ + memset(pConfig, 0, sizeof(CGIF_FrameConfig)); + pConfig->pImageData = pImageData; +} + +int main() +{ + CGIF *pGIF; + CGIF_Config gConfig; + CGIF_FrameConfig fConfig; + uint8_t *pImageData; + uint8_t aPalette[] = {0xFF, 0x00, 0x00, + 0x00, 0xFF, 0x00, + 0x00, 0x00, 0xFF}; + uint16_t numColors = 3; + + initGIFConfig(&gConfig, "example_cgif.gif", WIDTH, HEIGHT, aPalette, numColors); + pGIF = cgif_newgif(&gConfig); + + pImageData = malloc(WIDTH * HEIGHT); + for (int i = 0; i < (WIDTH * HEIGHT); ++i) { + pImageData[i] = (unsigned char)((i % WIDTH) / 4 % numColors); + } + + initFrameConfig(&fConfig, pImageData); + cgif_addframe(pGIF, &fConfig); + free(pImageData); + + cgif_close(pGIF); + return 0; +} diff --git a/recipes/cgif/all/test_v1_package/CMakeLists.txt b/recipes/cgif/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/cgif/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/cgif/all/test_v1_package/conanfile.py b/recipes/cgif/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/cgif/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/cgif/config.yml b/recipes/cgif/config.yml new file mode 100644 index 0000000000000..be2ba90eb4dc7 --- /dev/null +++ b/recipes/cgif/config.yml @@ -0,0 +1,5 @@ +versions: + "0.3.2": + folder: all + "0.3.0": + folder: all diff --git a/recipes/cglm/all/CMakeLists.txt b/recipes/cglm/all/CMakeLists.txt deleted file mode 100644 index 3a14ce35d533b..0000000000000 --- a/recipes/cglm/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -add_subdirectory("source_subfolder") diff --git a/recipes/cglm/all/conandata.yml b/recipes/cglm/all/conandata.yml index d63882c55fca8..59f16765ad5b3 100644 --- a/recipes/cglm/all/conandata.yml +++ b/recipes/cglm/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "0.9.1": + url: "https://github.com/recp/cglm/archive/v0.9.1.tar.gz" + sha256: "ba16ee484c9d5e808ef01e55008a156831e8ff5297f10bbca307adeb827a0913" + "0.8.9": + url: "https://github.com/recp/cglm/archive/refs/tags/v0.8.9.tar.gz" + sha256: "9561c998eb2a86dca5f8596b5cd290d76f56b7735c8a2486c585c43c196ceedd" "0.8.5": url: "https://github.com/recp/cglm/archive/refs/tags/v0.8.5.tar.gz" sha256: "baefa21342d228a83c90708459a745d5aa9b0ebb381555eea42db1f37fdf7a5a" diff --git a/recipes/cglm/all/conanfile.py b/recipes/cglm/all/conanfile.py index 023c54a31f51b..26cabc85e9ca1 100644 --- a/recipes/cglm/all/conanfile.py +++ b/recipes/cglm/all/conanfile.py @@ -1,19 +1,22 @@ -from conans import ConanFile, CMake, tools import os -required_conan_version = ">=1.29.1" +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, rmdir + +required_conan_version = ">=1.53.0" class CglmConan(ConanFile): name = "cglm" description = "Highly Optimized Graphics Math (glm) for C " - topics = ("cglm", "graphics", "opengl", "simd", "vector", "glm") - homepage = "https://github.com/recp/cglm" license = "MIT" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/recp/cglm" + topics = ("graphics", "opengl", "simd", "vector", "glm") + + package_type = "library" settings = "os", "arch", "compiler", "build_type" - exports_sources = ("CMakeLists.txt", ) - generators = "cmake" options = { "shared": [True, False], "fPIC": [True, False], @@ -25,77 +28,58 @@ class CglmConan(ConanFile): "header_only": 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 + if self.options.get_safe("shared") or self.options.header_only: + self.options.rm_safe("fPIC") if self.options.header_only: - del self.settings.arch - del self.settings.build_type - del self.settings.compiler - del self.settings.os + self.options.rm_safe("shared") + self.settings.compiler.rm_safe("libcxx") + self.settings.compiler.rm_safe("cppstd") - 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 package_id(self): + if self.info.options.header_only: + self.info.clear() - self._cmake = CMake(self) - self._cmake.definitions["CGLM_STATIC"] = not self.options.shared - self._cmake.definitions["CGLM_SHARED"] = self.options.shared - self._cmake.definitions["CGLM_USE_TEST"] = False - self._cmake.configure() - return self._cmake + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) - def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + def generate(self): + if not self.options.header_only: + tc = CMakeToolchain(self) + tc.cache_variables["CGLM_STATIC"] = not self.options.shared + tc.cache_variables["CGLM_SHARED"] = self.options.shared + tc.cache_variables["CGLM_USE_TEST"] = False + tc.generate() + def build(self): if not self.options.header_only: - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() 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.options.header_only: - self.copy("*", src=os.path.join(self._source_subfolder, "include"), dst="include") + copy(self, "*", + src=os.path.join(self.source_folder, "include"), + 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", "cglm") - self.cpp_info.set_property("cmake_target_name", "cglm::cglm") self.cpp_info.set_property("pkg_config_name", "cglm") if not self.options.header_only: self.cpp_info.libs = ["cglm"] if self.settings.os in ("Linux", "FreeBSD"): self.cpp_info.system_libs.append("m") - - # backward support of cmake_find_package, cmake_find_package_multi & pkg_config generators - self.cpp_info.names["pkg_config"] = "cglm" - self.cpp_info.names["cmake_find_package"] = "cglm" - self.cpp_info.names["cmake_find_package_multi"] = "cglm" diff --git a/recipes/cglm/all/test_package/CMakeLists.txt b/recipes/cglm/all/test_package/CMakeLists.txt index 511cf63c2b9e2..a77b4ddd27299 100644 --- a/recipes/cglm/all/test_package/CMakeLists.txt +++ b/recipes/cglm/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ -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(cglm REQUIRED) +find_package(cglm REQUIRED CONFIG) add_executable(test_package test_package.c) target_link_libraries(test_package PRIVATE cglm::cglm) diff --git a/recipes/cglm/all/test_package/conanfile.py b/recipes/cglm/all/test_package/conanfile.py index 38f4483872d47..bd5b26ca954ad 100644 --- a/recipes/cglm/all/test_package/conanfile.py +++ b/recipes/cglm/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 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cglm/all/test_v1_package/CMakeLists.txt b/recipes/cglm/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..9735bda16bdf4 --- /dev/null +++ b/recipes/cglm/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +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/opentelemetry-cpp/all/test_v1_package/conanfile.py b/recipes/cglm/all/test_v1_package/conanfile.py similarity index 100% rename from recipes/opentelemetry-cpp/all/test_v1_package/conanfile.py rename to recipes/cglm/all/test_v1_package/conanfile.py diff --git a/recipes/cglm/config.yml b/recipes/cglm/config.yml index dacc103c54543..7b9de138a3994 100644 --- a/recipes/cglm/config.yml +++ b/recipes/cglm/config.yml @@ -1,3 +1,7 @@ versions: + "0.9.1": + folder: all + "0.8.9": + folder: all "0.8.5": folder: all diff --git a/recipes/cgltf/all/CMakeLists.txt b/recipes/cgltf/all/CMakeLists.txt index 083b3a7d15fec..86b1d0c12f541 100644 --- a/recipes/cgltf/all/CMakeLists.txt +++ b/recipes/cgltf/all/CMakeLists.txt @@ -1,16 +1,15 @@ cmake_minimum_required(VERSION 3.4) project(cgltf C) -include(conanbuildinfo.cmake) -conan_basic_setup() +set(SOURCES_DIR ${CMAKE_CURRENT_LIST_DIR}/src) set(SRC_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder/cgltf.c - ${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder/cgltf_write.c + ${SOURCES_DIR}/cgltf.c + ${SOURCES_DIR}/cgltf_write.c ) set(HEADER_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder/cgltf.h - ${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder/cgltf_write.h + ${SOURCES_DIR}/cgltf.h + ${SOURCES_DIR}/cgltf_write.h ) add_library(${PROJECT_NAME} ${SRC_FILES}) @@ -20,10 +19,5 @@ if(MSVC AND BUILD_SHARED_LIBS) endif() include(GNUInstallDirs) -install( - TARGETS ${PROJECT_NAME} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} -) +install(TARGETS ${PROJECT_NAME}) install(FILES ${HEADER_FILES} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) diff --git a/recipes/cgltf/all/conanfile.py b/recipes/cgltf/all/conanfile.py index bc0e435d4c8c5..df487c5e826cd 100644 --- a/recipes/cgltf/all/conanfile.py +++ b/recipes/cgltf/all/conanfile.py @@ -1,26 +1,34 @@ -from conans import ConanFile, CMake, tools import os +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, export_conandata_patches, get, load, replace_in_file, save, rename + +required_conan_version = ">=1.53.0" + class CgltfConan(ConanFile): name = "cgltf" description = "Single-file glTF 2.0 loader and writer written in C99." license = "MIT" - topics = ("conan", "cgltf", "gltf", "header-only") - homepage = "https://github.com/jkuhlmann/cgltf" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/jkuhlmann/cgltf" + topics = ("gltf", "header-only") + package_type = "library" 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 + 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", src=self.recipe_folder, dst=self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -28,62 +36,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]) - os.rename(self.name + "-" + self.version, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def _create_source_files(self): - cgltf_c = ( - "#define CGLTF_IMPLEMENTATION\n" - "#include \"cgltf.h\"\n" - ) - cgltf_write_c = ( - "#define CGLTF_WRITE_IMPLEMENTATION\n" - "#include \"cgltf_write.h\"\n" - ) - tools.save(os.path.join(self.build_folder, self._source_subfolder, "cgltf.c"), cgltf_c) - tools.save(os.path.join(self.build_folder, self._source_subfolder, "cgltf_write.c"), cgltf_write_c) + cgltf_c = '#define CGLTF_IMPLEMENTATION\n#include "cgltf.h"\n' + cgltf_write_c = '#define CGLTF_WRITE_IMPLEMENTATION\n#include "cgltf_write.h"\n' + save(self, os.path.join(self.build_folder, self.source_folder, "cgltf.c"), cgltf_c) + save(self, os.path.join(self.build_folder, self.source_folder, "cgltf_write.c"), cgltf_write_c) - 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): self._create_source_files() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=self.source_path.parent) cmake.build() - def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() - cmake.install() - for header_file in ["cgltf.h", "cgltf_write.h"]: - header_fullpath = os.path.join(self.package_folder, "include", header_file) - self._remove_implementation(header_fullpath) - - @staticmethod - def _remove_implementation(header_fullpath): - header_content = tools.load(header_fullpath) + def _remove_implementation(self, header_fullpath): + header_content = load(self, header_fullpath) begin = header_content.find("/*\n *\n * Stop now, if you are only interested in the API.") end = header_content.find("/* cgltf is distributed under MIT license:", begin) implementation = header_content[begin:end] - tools.replace_in_file( + replace_in_file( + self, header_fullpath, implementation, - ( - "/**\n" - " * Implementation removed by conan during packaging.\n" - " * Don't forget to link libs provided in this package.\n" - " */\n\n" - ) + "/**\n * Implementation removed by conan during packaging.\n * Don't forget to link libs provided in this package.\n */\n\n", ) + def package(self): + copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) + cmake.install() + for header_file in ["cgltf.h", "cgltf_write.h"]: + header_fullpath = os.path.join(self.package_folder, "include", header_file) + self._remove_implementation(header_fullpath) + for dll in (self.package_path / "lib").glob("*.dll"): + rename(self, dll, self.package_path / "bin" / dll.name) + def package_info(self): self.cpp_info.libs = ["cgltf"] diff --git a/recipes/cgltf/all/test_package/CMakeLists.txt b/recipes/cgltf/all/test_package/CMakeLists.txt index 5f056d0a34a03..ca0a3cec6c73e 100644 --- a/recipes/cgltf/all/test_package/CMakeLists.txt +++ b/recipes/cgltf/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 LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(cgltf REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE cgltf::cgltf) if(MSVC) target_compile_definitions(${PROJECT_NAME} PRIVATE _CRT_SECURE_NO_WARNINGS) endif() diff --git a/recipes/cgltf/all/test_package/conanfile.py b/recipes/cgltf/all/test_package/conanfile.py index ea57a464900be..ef5d7042163ec 100644 --- a/recipes/cgltf/all/test_package/conanfile.py +++ b/recipes/cgltf/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" + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cgltf/all/test_v1_package/CMakeLists.txt b/recipes/cgltf/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/cgltf/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/cgltf/all/test_v1_package/conanfile.py b/recipes/cgltf/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..84ee68733e516 --- /dev/null +++ b/recipes/cgltf/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.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/cgns/all/conanfile.py b/recipes/cgns/all/conanfile.py index 137666452ceb7..0f06c2e7f30d9 100644 --- a/recipes/cgns/all/conanfile.py +++ b/recipes/cgns/all/conanfile.py @@ -56,7 +56,7 @@ def layout(self): def requirements(self): if self.options.with_hdf5: - self.requires("hdf5/1.13.1") + self.requires("hdf5/1.14.0") def validate(self): if self.info.options.parallel and not (self.info.options.with_hdf5 and self.dependencies["hdf5"].options.parallel): diff --git a/recipes/chaiscript/all/CMakeLists.txt b/recipes/chaiscript/all/CMakeLists.txt deleted file mode 100644 index a7a84f24be646..0000000000000 --- a/recipes/chaiscript/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(WIN32 AND BUILD_SHARED_LIBS) - -add_subdirectory("source_subfolder") diff --git a/recipes/chaiscript/all/conanfile.py b/recipes/chaiscript/all/conanfile.py index 00f73ebe996c7..84875e933945e 100644 --- a/recipes/chaiscript/all/conanfile.py +++ b/recipes/chaiscript/all/conanfile.py @@ -1,16 +1,24 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import check_min_vs, is_msvc +from conan.tools.files import get, copy, rmdir, 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 +required_conan_version = ">=1.53.0" + + class ChaiScriptConan(ConanFile): name = "chaiscript" homepage = "https://github.com/ChaiScript/ChaiScript" description = "Embedded Scripting Language Designed for C++." - topics = ("conan", "embedded-scripting-language", "language") + topics = ("embedded-scripting-language", "language") url = "https://github.com/conan-io/conan-center-index" license = "BSD-3-Clause" exports_sources = ["CMakeLists.txt"] - generators = "cmake" settings = "os", "compiler", "build_type", "arch" options = {"fPIC": [True, False], "dyn_load": [True, False], "use_std_make_shared": [True, False], "multithread_support": [True, False], @@ -21,60 +29,80 @@ class ChaiScriptConan(ConanFile): "header_only": True} @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 17 @property - def _build_subfolder(self): - return "build_subfolder" - - def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = "ChaiScript-" + self.version - os.rename(extracted_dir, self._source_subfolder) + def _compilers_minimum_version(self): + return { + "gcc": "7", + "clang": "7", + "apple-clang": "10", + "Visual Studio": "15.0", + "msvc": "191", + } def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["BUILD_TESTING"] = False - cmake.definitions["BUILD_SAMPLES"] = False - cmake.definitions["BUILD_MODULES"] = True - cmake.definitions["USE_STD_MAKE_SHARED"] = self.options.use_std_make_shared - cmake.definitions["DYNLOAD_ENABLED"] = self.options.dyn_load - cmake.definitions["MULTITHREAD_SUPPORT_ENABLED"] = self.options.multithread_support - cmake.configure(build_folder=self._build_subfolder) - return cmake + 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, 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." + ) + + 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.variables["BUILD_SAMPLES"] = False + tc.variables["BUILD_MODULES"] = True + tc.variables["USE_STD_MAKE_SHARED"] = self.options.use_std_make_shared + tc.variables["DYNLOAD_ENABLED"] = self.options.dyn_load + tc.variables["MULTITHREAD_SUPPORT_ENABLED"] = self.options.multithread_support + tc.generate() def build(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(pattern="*.hpp", dst="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")) 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")) - 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_id(self): - if self.options.header_only: - self.info.header_only() + if self.info.options.header_only: + self.info.clear() def package_info(self): if not self.options.header_only: - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = collect_libs(self) if self.options.use_std_make_shared: self.cpp_info.defines.append("CHAISCRIPT_USE_STD_MAKE_SHARED") - if self.settings.os == "Linux": - self.cpp_info.system_libs = ["dl"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") + self.cpp_info.system_libs.append("dl") if self.options.multithread_support: self.cpp_info.system_libs.append("pthread") diff --git a/recipes/chaiscript/all/test_package/CMakeLists.txt b/recipes/chaiscript/all/test_package/CMakeLists.txt index 8ff036c8cd891..e3d7046fa8301 100644 --- a/recipes/chaiscript/all/test_package/CMakeLists.txt +++ b/recipes/chaiscript/all/test_package/CMakeLists.txt @@ -1,13 +1,11 @@ -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.15) +project(test_package LANGUAGES CXX) find_package(chaiscript REQUIRED CONFIG) -# TEST_PACKAGE ################################################################# - -add_executable(${CMAKE_PROJECT_NAME} test_package.cpp) -target_link_libraries(${CMAKE_PROJECT_NAME} CONAN_PKG::chaiscript) -set_property(TARGET ${CMAKE_PROJECT_NAME} PROPERTY CXX_STANDARD 14) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} chaiscript::chaiscript) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +if (WIN32 AND CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + target_compile_options(${PROJECT_NAME} PRIVATE /bigobj) +endif() diff --git a/recipes/chaiscript/all/test_package/conanfile.py b/recipes/chaiscript/all/test_package/conanfile.py index 4d0099777a2a9..963c088e08a5c 100644 --- a/recipes/chaiscript/all/test_package/conanfile.py +++ b/recipes/chaiscript/all/test_package/conanfile.py @@ -1,10 +1,19 @@ +from conan import ConanFile +from conan.tools.cmake import cmake_layout, CMake +from conan.tools.build import can_run import os -from conans import ConanFile, CMake class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake_find_package_multi", "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,4 +21,6 @@ def build(self): cmake.build() def test(self): - self.run(os.path.join("bin", "test_package"), 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/charls/all/conandata.yml b/recipes/charls/all/conandata.yml index 0c25d16afadd4..3f80f816193ca 100644 --- a/recipes/charls/all/conandata.yml +++ b/recipes/charls/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "2.4.2": + url: "https://github.com/team-charls/charls/archive/2.4.2.tar.gz" + sha256: "d1c2c35664976f1e43fec7764d72755e6a50a80f38eca70fcc7553cad4fe19d9" + "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..90461d15285bf 100644 --- a/recipes/charls/all/conanfile.py +++ b/recipes/charls/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.scm import Version import os import textwrap -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class CharlsConan(ConanFile): @@ -15,10 +15,11 @@ class CharlsConan(ConanFile): description = "C++ implementation of the JPEG-LS standard for lossless " \ "and near-lossless image compression and decompression." license = "BSD-3-Clause" - topics = ("charls", "jpeg", "JPEG-LS", "compression", "decompression", ) + topics = ("jpeg", "JPEG-LS", "compression", "decompression", ) homepage = "https://github.com/team-charls/charls" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -30,8 +31,7 @@ class CharlsConan(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,32 +39,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.info.settings.compiler.cppstd: + if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, 14) # brace initialization issue for gcc < 5 - if self.info.settings.compiler == "gcc" and Version(self.info.settings.compiler.version) < "5": - raise ConanInvalidConfiguration("CharLS can't be compiled by {0} {1}".format(self.info.settings.compiler, - self.info.settings.compiler.version)) + if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "5": + raise ConanInvalidConfiguration("CharLS can't be compiled by {0} {1}".format(self.settings.compiler, + self.settings.compiler.version)) # name lookup issue for gcc == 5 in charls/2.2.0 - if self.info.settings.compiler == "gcc" and Version(self.info.settings.compiler.version) == "5" and Version(self.version) >= "2.2.0": - raise ConanInvalidConfiguration("CharLS can't be compiled by {0} {1}".format(self.info.settings.compiler, - self.info.settings.compiler.version)) - - def layout(self): - cmake_layout(self, src_folder="src") + if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) == "5" and Version(self.version) >= "2.2.0": + raise ConanInvalidConfiguration("CharLS can't be compiled by {0} {1}".format(self.settings.compiler, + self.settings.compiler.version)) 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["CHARLS_INSTALL"] = True + tc.cache_variables["CHARLS_BUILD_FUZZ_TEST"] = False + tc.cache_variables["CHARLS_BUILD_SAMPLES"] = False + tc.cache_variables["CHARLS_BUILD_TESTS"] = False + tc.cache_variables["CHARLS_INSTALL"] = True tc.generate() def build(self): @@ -76,12 +78,12 @@ def build(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 @@ -108,6 +110,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_package/conanfile.py b/recipes/charls/all/test_package/conanfile.py index 4048086764007..0b0b6a29cc68f 100644 --- a/recipes/charls/all/test_package/conanfile.py +++ b/recipes/charls/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_c_path = os.path.join(self.cpp.build.bindirs[0], "test_package_c") self.run(bin_c_path, env="conanrun") bin_cpp_path = os.path.join(self.cpp.build.bindirs[0], "test_package_cpp") 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..f31161f1acff8 100644 --- a/recipes/charls/config.yml +++ b/recipes/charls/config.yml @@ -1,4 +1,10 @@ versions: + "2.4.2": + folder: all + "2.4.1": + folder: all + "2.4.0": + folder: all "2.3.4": folder: all "2.2.0": diff --git a/recipes/chef-fun/all/conandata.yml b/recipes/chef-fun/all/conandata.yml new file mode 100644 index 0000000000000..9532bc9181c94 --- /dev/null +++ b/recipes/chef-fun/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.0.1": + url: "https://gitlab.com/libchef/chef-fun/-/archive/1.0.1/chef-fun-1.0.1.tar.gz" + sha256: "52a4facb3b1de9f1a8ed4f3314fc5e2190fab1f5564c04c7071361fb08ca837e" diff --git a/recipes/chef-fun/all/conanfile.py b/recipes/chef-fun/all/conanfile.py new file mode 100644 index 0000000000000..8958e9403c1fa --- /dev/null +++ b/recipes/chef-fun/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.scm import Version +import os + + +required_conan_version = ">=1.50.0" + + +class ChefFunConan(ConanFile): + name = "chef-fun" + homepage = "https://gitlab.com/libchef/chef-fun" + description = "C++ Functional programming support library" + topics = ("functional programming", "cpp", "library" ) + url = "https://github.com/conan-io/conan-center-index" + license = "Apache-2.0" + package_type = "header-library" + 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": "9.4.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._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="*.hh", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include"), + ) + copy( + self, + pattern="*.tcc", + 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/chef-fun/all/test_package/CMakeLists.txt b/recipes/chef-fun/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..6b9b67b1de88f --- /dev/null +++ b/recipes/chef-fun/all/test_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(chef-fun REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) + +target_link_libraries(${PROJECT_NAME} PRIVATE chef-fun::chef-fun) + + diff --git a/recipes/chef-fun/all/test_package/conanfile.py b/recipes/chef-fun/all/test_package/conanfile.py new file mode 100644 index 0000000000000..e845ae751a301 --- /dev/null +++ b/recipes/chef-fun/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/chef-fun/all/test_package/test_package.cpp b/recipes/chef-fun/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..62c5785b04be8 --- /dev/null +++ b/recipes/chef-fun/all/test_package/test_package.cpp @@ -0,0 +1,20 @@ +#include +#include +#include "ChefFun/Option.hh" +#include "ChefFun/Either.hh" + +using namespace ChefFun; + +int main() { + Option os = Option::Some( "abc" ); + auto mapped = os.map( []( auto&& n ){ return 2*n.size(); }); + + Either es = Either::Right( "abc" ); + + + auto n = es + .matchRight( []( auto&& ss ) -> int { return ss.size(); } ) + .matchLeft( []( auto&& ii ) -> int { return 2*ii; } ); + + return EXIT_SUCCESS; +} diff --git a/recipes/chef-fun/all/test_v1_package/CMakeLists.txt b/recipes/chef-fun/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..a8d0c7626a3cb --- /dev/null +++ b/recipes/chef-fun/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +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(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/docs/package_templates/cmake_package/all/test_v1_package/conanfile.py b/recipes/chef-fun/all/test_v1_package/conanfile.py similarity index 100% rename from docs/package_templates/cmake_package/all/test_v1_package/conanfile.py rename to recipes/chef-fun/all/test_v1_package/conanfile.py diff --git a/recipes/chef-fun/config.yml b/recipes/chef-fun/config.yml new file mode 100644 index 0000000000000..715e55357a17b --- /dev/null +++ b/recipes/chef-fun/config.yml @@ -0,0 +1,3 @@ +versions: + "1.0.1": + folder: all diff --git a/recipes/chipmunk2d/all/conandata.yml b/recipes/chipmunk2d/all/conandata.yml index 89d52afa0965b..41e39beaf8dc2 100644 --- a/recipes/chipmunk2d/all/conandata.yml +++ b/recipes/chipmunk2d/all/conandata.yml @@ -1,4 +1,11 @@ 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" + +patches: + "7.0.3": + - patch_file: "patches/0001-remove-sysctl-linux-win.patch" + patch_type: bugfix + patch_source: https://github.com/slembcke/Chipmunk2D/pull/175 + patch_description: "Needed to build with glib > 2.30" diff --git a/recipes/chipmunk2d/all/conanfile.py b/recipes/chipmunk2d/all/conanfile.py index 4608d275e2aff..53afb4be1c99c 100644 --- a/recipes/chipmunk2d/all/conanfile.py +++ b/recipes/chipmunk2d/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 copy, get +from conan.tools.files import copy, get, replace_in_file, apply_conandata_patches, export_conandata_patches 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) @@ -58,7 +52,18 @@ def generate(self): tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True tc.generate() + def export_sources(self): + export_conandata_patches(self) + + def _patch_sources(self): + # The finite-math-only optimization has no effect and can cause linking errors + # when linked against glibc >= 2.31 + apply_conandata_patches(self) + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "-ffast-math", "-ffast-math -fno-finite-math-only") + def build(self): + self._patch_sources() cmake = CMake(self) cmake.configure() cmake.build() diff --git a/recipes/chipmunk2d/all/patches/0001-remove-sysctl-linux-win.patch b/recipes/chipmunk2d/all/patches/0001-remove-sysctl-linux-win.patch new file mode 100644 index 0000000000000..8b123a7652b29 --- /dev/null +++ b/recipes/chipmunk2d/all/patches/0001-remove-sysctl-linux-win.patch @@ -0,0 +1,16 @@ +--- a/src/cpHastySpace.c ++++ b/src/cpHastySpace.c +@@ -7,8 +7,12 @@ + //TODO: Move all the thread stuff to another file + + //#include +-#ifndef _WIN32 ++ ++#ifdef __APPLE__ + #include ++#endif ++ ++#ifndef _WIN32 + #include + #else + #ifndef WIN32_LEAN_AND_MEAN 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/choc/all/conandata.yml b/recipes/choc/all/conandata.yml new file mode 100644 index 0000000000000..c9e73e3a7173c --- /dev/null +++ b/recipes/choc/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "cci.20230918": + url: "https://github.com/Tracktion/choc/archive/8572719d3b9085ccc88893cdaf8c2c703fa55adb.tar.gz" + sha256: "f98e4bc8e0be19b416a4c01a2673280a63dec45e444175cca85f06bd29748ac4" diff --git a/recipes/choc/all/conanfile.py b/recipes/choc/all/conanfile.py new file mode 100644 index 0000000000000..c7f6cc492b72b --- /dev/null +++ b/recipes/choc/all/conanfile.py @@ -0,0 +1,49 @@ +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 ChocConan(ConanFile): + name = "choc" + description = "A collection of header only classes, permissively licensed, to provide basic useful tasks with the bare-minimum of dependencies." + license = "ISC" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/Tracktion/choc/" + topics = ("audio", "json", "containers", "header-only") + package_type = "header-library" + 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="*.h", + dst=os.path.join(self.package_folder, "include", "choc"), + src=self.source_folder, + excludes=("tests"), + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/choc/all/test_package/CMakeLists.txt b/recipes/choc/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..3d6e4b5e02fcd --- /dev/null +++ b/recipes/choc/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(choc REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE choc::choc) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/choc/all/test_package/conanfile.py b/recipes/choc/all/test_package/conanfile.py new file mode 100644 index 0000000000000..e845ae751a301 --- /dev/null +++ b/recipes/choc/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/choc/all/test_package/test_package.cpp b/recipes/choc/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..e7b235a639ba2 --- /dev/null +++ b/recipes/choc/all/test_package/test_package.cpp @@ -0,0 +1,9 @@ +#include + +#include "choc/platform/choc_Platform.h" + +int main(void) { + std::cout << CHOC_OPERATING_SYSTEM_NAME << '\n'; + + return EXIT_SUCCESS; +} diff --git a/recipes/choc/config.yml b/recipes/choc/config.yml new file mode 100644 index 0000000000000..55bc2cddc1b4a --- /dev/null +++ b/recipes/choc/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20230918": + folder: all diff --git a/recipes/chunkio/all/conandata.yml b/recipes/chunkio/all/conandata.yml new file mode 100644 index 0000000000000..0996c6fec0b7e --- /dev/null +++ b/recipes/chunkio/all/conandata.yml @@ -0,0 +1,26 @@ +sources: + "1.5.2": + url: "https://github.com/fluent/chunkio/archive/refs/tags/v1.5.2.tar.gz" + sha256: "c73e809215454c34a79ed2a7d38abc6058da99dad8564de85e2919100fb987a5" + "1.1.6": + url: "https://github.com/fluent/chunkio/archive/refs/tags/v1.1.6.tar.gz" + sha256: "755dda0b8ccf6f5ff804b2c1a3caa938bae7b0f37d73afa12c1bf1fab4fd4c86" +patches: + "1.5.2": + - patch_file: "patches/1.5.2-0001-add-installer.patch" + patch_description: "add installer" + patch_type: "conan" + - patch_file: "patches/1.1.6-0003-disable-pic.patch" + patch_description: "disable pic on static build" + patch_type: "portability" + "1.1.6": + - patch_file: "patches/1.1.6-0001-add-installer.patch" + patch_description: "add installer" + patch_type: "conan" + - patch_file: "patches/1.1.6-0002-fix-wrong-target.patch" + patch_description: "fix wrong target" + patch_type: "bugfix" + patch_source: "https://github.com/fluent/chunkio/issues/104" + - patch_file: "patches/1.1.6-0003-disable-pic.patch" + patch_description: "disable pic on static build" + patch_type: "portability" diff --git a/recipes/chunkio/all/conanfile.py b/recipes/chunkio/all/conanfile.py new file mode 100644 index 0000000000000..730b6cde7d240 --- /dev/null +++ b/recipes/chunkio/all/conanfile.py @@ -0,0 +1,75 @@ +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.53.0" + +class ChunkIOConan(ConanFile): + name = "chunkio" + description = "Simple library to manage chunks of data in memory and file system" + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/fluent/chunkio" + topics = ("chunk", "io", "memory", "file") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_filesystem": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_filesystem": 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) + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + tc.variables["CIO_LIB_STATIC"] = not self.options.shared + tc.variables["CIO_LIB_SHARED"] = self.options.shared + tc.variables["CIO_BACKEND_FILESYSTEM"] = self.options.with_filesystem + # Relocatable shared libs on macOS + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + 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 = ["chunkio-shared"] if self.options.shared else ["chunkio-static", "cio-crc32"] + if self.settings.os == "Windows": + self.cpp_info.system_libs.append("shlwapi") + if Version(self.version) >= "1.5.0": + self.cpp_info.system_libs.append("ws2_32") diff --git a/recipes/chunkio/all/patches/1.1.6-0001-add-installer.patch b/recipes/chunkio/all/patches/1.1.6-0001-add-installer.patch new file mode 100644 index 0000000000000..52a5dd664faf7 --- /dev/null +++ b/recipes/chunkio/all/patches/1.1.6-0001-add-installer.patch @@ -0,0 +1,65 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index e6d5dcb..ebf3c4c 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -109,10 +109,15 @@ include_directories( + + add_subdirectory(deps/crc32) + add_subdirectory(src) +-add_subdirectory(tools) ++#add_subdirectory(tools) + + # Tests + if(CIO_TESTS) + enable_testing() + add_subdirectory(tests) + endif() ++ ++include(GNUInstallDirs) ++ ++install(DIRECTORY include/chunkio DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) ++install(DIRECTORY deps/monkey/include/monkey DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +diff --git a/deps/crc32/CMakeLists.txt b/deps/crc32/CMakeLists.txt +index 8ae1823..0b7dba0 100644 +--- a/deps/crc32/CMakeLists.txt ++++ b/deps/crc32/CMakeLists.txt +@@ -3,3 +3,12 @@ set(src + ) + + add_library(cio-crc32 STATIC ${src}) ++ ++if(CIO_LIB_STATIC) ++ include(GNUInstallDirs) ++ install( ++ TARGETS cio-crc32 ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ) ++endif() +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index a4fc2d3..51736bc 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -50,3 +50,22 @@ endif() + if (NOT CIO_LIB_STATIC AND NOT CIO_LIB_SHARED) + message(FATAL_ERROR "What are you doing?, you should build something") + endif() ++ ++include(GNUInstallDirs) ++ ++if(CIO_LIB_STATIC) ++ install( ++ TARGETS chunkio-static ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ) ++endif() ++ ++if(CIO_LIB_SHARED) ++ install( ++ TARGETS chunkio-shared ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ) ++endif() diff --git a/recipes/chunkio/all/patches/1.1.6-0002-fix-wrong-target.patch b/recipes/chunkio/all/patches/1.1.6-0002-fix-wrong-target.patch new file mode 100644 index 0000000000000..3b36da5f199b1 --- /dev/null +++ b/recipes/chunkio/all/patches/1.1.6-0002-fix-wrong-target.patch @@ -0,0 +1,14 @@ +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index a4fc2d3..51736bc 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -41,7 +41,7 @@ endif() + + if (CIO_LIB_SHARED) + add_library(chunkio-shared SHARED ${src}) +- target_link_libraries(chunkio-static ${libs}) ++ target_link_libraries(chunkio-shared ${libs}) + if(CIO_SANITIZE_ADDRESS) + add_sanitizers(chunkio-shared) + endif() + diff --git a/recipes/chunkio/all/patches/1.1.6-0003-disable-pic.patch b/recipes/chunkio/all/patches/1.1.6-0003-disable-pic.patch new file mode 100644 index 0000000000000..02733d0726a39 --- /dev/null +++ b/recipes/chunkio/all/patches/1.1.6-0003-disable-pic.patch @@ -0,0 +1,15 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index ebf3c4c..2db2794 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -7,7 +7,9 @@ set(CIO_VERSION_PATCH 6) + set(CIO_VERSION_STR "${CIO_VERSION_MAJOR}.${CIO_VERSION_MINOR}.${CIO_VERSION_PATCH}") + + # CFLAGS +-set(CMAKE_POSITION_INDEPENDENT_CODE ON) ++if(BUILD_SHARED_LIBS) ++ set(CMAKE_POSITION_INDEPENDENT_CODE ON) ++endif() + if(MSVC) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4 ") + else() diff --git a/recipes/chunkio/all/patches/1.5.2-0001-add-installer.patch b/recipes/chunkio/all/patches/1.5.2-0001-add-installer.patch new file mode 100644 index 0000000000000..6e02f8052fa98 --- /dev/null +++ b/recipes/chunkio/all/patches/1.5.2-0001-add-installer.patch @@ -0,0 +1,65 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index dbc7d48..a3810a5 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -118,10 +118,15 @@ include_directories( + + add_subdirectory(deps/crc32) + add_subdirectory(src) +-add_subdirectory(tools) ++# add_subdirectory(tools) + + # Tests + if(CIO_TESTS) + enable_testing() + add_subdirectory(tests) + endif() ++ ++include(GNUInstallDirs) ++install(FILES ${PROJECT_BINARY_DIR}/include/chunkio/cio_info.h ${PROJECT_BINARY_DIR}/include/chunkio/cio_version.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/chunkio) ++install(DIRECTORY include/chunkio DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} PATTERN "*.in" EXCLUDE) ++install(DIRECTORY deps/monkey/include/monkey DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +diff --git a/deps/crc32/CMakeLists.txt b/deps/crc32/CMakeLists.txt +index 8ae1823..0b7dba0 100644 +--- a/deps/crc32/CMakeLists.txt ++++ b/deps/crc32/CMakeLists.txt +@@ -3,3 +3,12 @@ set(src + ) + + add_library(cio-crc32 STATIC ${src}) ++ ++if(CIO_LIB_STATIC) ++ include(GNUInstallDirs) ++ install( ++ TARGETS cio-crc32 ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ) ++endif() +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index bb52273..b6e37b1 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -51,3 +51,22 @@ endif() + if (NOT CIO_LIB_STATIC AND NOT CIO_LIB_SHARED) + message(FATAL_ERROR "What are you doing?, you should build something") + endif() ++ ++include(GNUInstallDirs) ++ ++if(CIO_LIB_STATIC) ++ install( ++ TARGETS chunkio-static ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ) ++endif() ++ ++if(CIO_LIB_SHARED) ++ install( ++ TARGETS chunkio-shared ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ) ++endif() diff --git a/recipes/chunkio/all/test_package/CMakeLists.txt b/recipes/chunkio/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..b429e0efccdb7 --- /dev/null +++ b/recipes/chunkio/all/test_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) + +find_package(chunkio REQUIRED CONFIG) + +if(chunkio_VERSION VERSION_LESS "1.5.0") + add_executable(${PROJECT_NAME} test_package.c) +else() + add_executable(${PROJECT_NAME} test_package_1_5_0.c) +endif() +target_link_libraries(${PROJECT_NAME} PRIVATE chunkio::chunkio) diff --git a/recipes/chunkio/all/test_package/conanfile.py b/recipes/chunkio/all/test_package/conanfile.py new file mode 100644 index 0000000000000..f5cf204295e19 --- /dev/null +++ b/recipes/chunkio/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/chunkio/all/test_package/test_package.c b/recipes/chunkio/all/test_package/test_package.c new file mode 100644 index 0000000000000..1c8100c442be2 --- /dev/null +++ b/recipes/chunkio/all/test_package/test_package.c @@ -0,0 +1,20 @@ +#include "chunkio/chunkio.h" +#include + +static int log_cb(struct cio_ctx *ctx, int level, const char *file, int line, + char *str) +{ + (void) ctx; + + printf("[cio-test-fs] %-60s => %s:%i\n", str, file, line); + return 0; +} + +int main() { + int flags = CIO_CHECKSUM; + struct cio_ctx *ctx = cio_create(NULL, log_cb, CIO_LOG_INFO, flags); + + cio_destroy(ctx); + + return 0; +} diff --git a/recipes/chunkio/all/test_package/test_package_1_5_0.c b/recipes/chunkio/all/test_package/test_package_1_5_0.c new file mode 100644 index 0000000000000..ebbc2de6796ec --- /dev/null +++ b/recipes/chunkio/all/test_package/test_package_1_5_0.c @@ -0,0 +1,23 @@ +#include "chunkio/chunkio.h" +#include + +static int log_cb(struct cio_ctx *ctx, int level, const char *file, int line, + char *str) +{ + (void) ctx; + + printf("[cio-test-fs] %-60s => %s:%i\n", str, file, line); + return 0; +} + +int main() { + struct cio_options options; + cio_options_init(&options); + options.flags = CIO_CHECKSUM; + options.log_level = CIO_LOG_INFO; + struct cio_ctx *ctx = cio_create(&options); + + cio_destroy(ctx); + + return 0; +} diff --git a/recipes/chunkio/config.yml b/recipes/chunkio/config.yml new file mode 100644 index 0000000000000..2ac2738283086 --- /dev/null +++ b/recipes/chunkio/config.yml @@ -0,0 +1,5 @@ +versions: + "1.5.2": + folder: "all" + "1.1.6": + folder: "all" diff --git a/recipes/cigi-ccl/all/conandata.yml b/recipes/cigi-ccl/all/conandata.yml new file mode 100644 index 0000000000000..f77d32f6993f8 --- /dev/null +++ b/recipes/cigi-ccl/all/conandata.yml @@ -0,0 +1,5 @@ +sources: + "4.0.6a": + url: + - "https://master.dl.sourceforge.net/project/cigi/CIGI%20Class%20Library%20%28CCL%29/CCL%20Version%204.0.6a/ccl_4_0%20rev6a.zip" + sha256: "a55099c0418c663e572109bd62ed2f7b411c51af7b404212988e36360e8a13cc" diff --git a/recipes/cigi-ccl/all/conanfile.py b/recipes/cigi-ccl/all/conanfile.py new file mode 100644 index 0000000000000..5237537049f2f --- /dev/null +++ b/recipes/cigi-ccl/all/conanfile.py @@ -0,0 +1,102 @@ +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 +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +from conan.tools.apple import is_apple_os +import os + +required_conan_version = ">=1.53.0" + +class CigiClConan(ConanFile): + name = "cigi-ccl" + description = "Industry standard communication with compliant image generators" + license = "LGPL-2.1-only" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://cigi.sourceforge.io/product_ccl.php" + topics = ("simulation", "interface engines", "data visualization") + 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") + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + if is_apple_os(self): + # CigiOutgoingMsg.cpp:196:38: error: use of undeclared identifier 'PTHREAD_MUTEX_RECURSIVE_NP' + raise ConanInvalidConfiguration(f"{self.settings.os} Conan recipe is not supported on Apple. Contributions are welcome.") + + def source(self): + get(self, **self.conan_data["sources"][self.version], 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.generate() + + def _patch_sources(self): + cmake_lists_fixes = { + # This old CMakeLists.txt had PROJECT() before CMAKE_MINIMUM_REQUIRED(); this order must be inverted + "CMAKE_MINIMUM_REQUIRED(VERSION 2.4.7)": "", + "PROJECT(ccl)": "CMAKE_MINIMUM_REQUIRED(VERSION 2.4.7)\nPROJECT(ccl)", + # Using backslash for path is being interpreted as invalid escape sequence in newer versions of CMake + "Header Files\\": "Header Files/", + "Source Files\\": "Source Files/", + # Incorrectly tries to install both the static and shared targets + "INSTALL(TARGETS cigicl-static cigicl-shared": f"INSTALL(TARGETS {'cigicl-shared' if self.options.shared else 'cigicl-static'}" + } + + for old, new in cmake_lists_fixes.items(): + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), old, new) + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() + if self.options.shared: + cmake.build(target="cigicl-shared") + else: + cmake.build(target="cigicl-static") + + def package(self): + cmake = CMake(self) + cmake.install() + + copy(self, "license.html", self.source_folder, os.path.join(self.package_folder, "licenses")) + copy(self, "COPYING", 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")) + + def package_info(self): + self.cpp_info.set_property("pkg_config_name", "cigicl") + build_type_suffix = "" + if self.settings.build_type == "Debug" and self.settings.os == "Windows": + build_type_suffix = "D" + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["pthread", "m"]) + + if self.options.shared: + self.cpp_info.libs = ["ccl_dll" + build_type_suffix] + self.cpp_info.defines = ["CCL_DLL"] + else: + self.cpp_info.libs = ["ccl_lib" + build_type_suffix] diff --git a/recipes/cigi-ccl/all/test_package/CMakeLists.txt b/recipes/cigi-ccl/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..9ff9e1c44f12c --- /dev/null +++ b/recipes/cigi-ccl/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.15) + +project(test_package LANGUAGES CXX) + +find_package(cigi-ccl REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) + +target_link_libraries(${PROJECT_NAME} PRIVATE cigi-ccl::cigi-ccl) diff --git a/recipes/cigi-ccl/all/test_package/conanfile.py b/recipes/cigi-ccl/all/test_package/conanfile.py new file mode 100644 index 0000000000000..f5cf204295e19 --- /dev/null +++ b/recipes/cigi-ccl/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cigi-ccl/all/test_package/test_package.cpp b/recipes/cigi-ccl/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..9a4a0a228de16 --- /dev/null +++ b/recipes/cigi-ccl/all/test_package/test_package.cpp @@ -0,0 +1,7 @@ +#include + +int main(void) { + CigiOutgoingMsg message; + message.CreateBuffer(); + return 0; +} diff --git a/recipes/cigi-ccl/config.yml b/recipes/cigi-ccl/config.yml new file mode 100644 index 0000000000000..f73e93e2624ef --- /dev/null +++ b/recipes/cigi-ccl/config.yml @@ -0,0 +1,3 @@ +versions: + "4.0.6a": + folder: all diff --git a/recipes/cimg/all/conandata.yml b/recipes/cimg/all/conandata.yml index 939c703cb331f..96bd683acd199 100644 --- a/recipes/cimg/all/conandata.yml +++ b/recipes/cimg/all/conandata.yml @@ -1,19 +1,19 @@ sources: + "3.3.2": + url: "https://cimg.eu/files/CImg_3.3.2.zip" + sha256: "d49ecd63b46f53ddcee5c7695ddb0fe8b07e033bb81b5ed075cfe352462c5f73" + "3.3.0": + url: "https://cimg.eu/files/CImg_3.3.0.zip" + sha256: "d5eecb3551fc1966a9aac8637dc643bf6049e2b1b1a1f9deec3069e289ee1d65" + "3.2.6": + url: "https://cimg.eu/files/CImg_3.2.6.zip" + sha256: "8da3aa995027231bb18f97bb986e12788ef464b3ab8a34151650bf1217baeda7" "3.0.2": url: "https://cimg.eu/files/CImg_3.0.2.zip" sha256: "ee55a37c33d503a64ff264b53952e502ba7c2887b59ded47c47c86ea52ac5c31" - "3.0.0": - url: "https://cimg.eu/files/CImg_3.0.0.zip" - sha256: "8ec6e9d87459a3cb85bddcd5ae8a4891bc734957ea4aa3089dcf1d234e8d0525" "2.9.9": url: "https://cimg.eu/files/CImg_2.9.9.zip" sha256: "c94412f26800ea318fa79410c58da1cf3df71771d07e515c39b16ee743f68e92" - "2.9.4": - url: "https://cimg.eu/files/CImg_2.9.4.zip" - sha256: "455945dc035d50bbc042450e2dc81b2ca19ea74cd3bc38b46ac623df6997dfff" - "2.9.2": - url: "https://cimg.eu/files/CImg_2.9.2.zip" - sha256: "58ffe77bfc25bd90bb3f8185cd7ed8427e2e4f95ce5b748ae2f6291d026b5e90" "2.8.3": url: "https://cimg.eu/files/CImg_2.8.3.zip" sha256: "8d92e4cc271568c5aeca6e6b1f28f620fcf161ef99ce9d070ed1905d92caec4c" diff --git a/recipes/cimg/all/conanfile.py b/recipes/cimg/all/conanfile.py index 4c4d65c0ab3d8..fa4663a48bbd0 100644 --- a/recipes/cimg/all/conanfile.py +++ b/recipes/cimg/all/conanfile.py @@ -11,11 +11,11 @@ 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 = ("physics", "simulation", "robotics", "kinematics", "engine") license = "CeCILL V2" url = "https://github.com/conan-io/conan-center-index" - + homepage = "http://cimg.eu" + topics = ("physics", "simulation", "robotics", "kinematics", "engine") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" options = { "enable_fftw": [True, False], @@ -64,17 +64,20 @@ def layout(self): def requirements(self): if self.options.enable_fftw: - self.requires("fftw/3.3.9") + self.requires("fftw/3.3.10") if self.options.enable_jpeg: self.requires("libjpeg/9e") if self.options.enable_openexr: - self.requires("openexr/2.5.7") + self.requires("openexr/3.2.1") if self.options.enable_png: - self.requires("libpng/1.6.39") + self.requires("libpng/[>=1.6 <2]") if self.options.enable_tiff: - self.requires("libtiff/4.4.0") + self.requires("libtiff/4.6.0") if self.options.enable_ffmpeg: - self.requires("ffmpeg/5.0") + if self.options.enable_opencv: + self.requires("ffmpeg/4.4") + else: + self.requires("ffmpeg/5.1") if self.options.enable_opencv: self.requires("opencv/4.5.5") if self.options.enable_magick: @@ -93,8 +96,7 @@ def validate(self): raise ConanInvalidConfiguration("xshm not available in CCI yet") 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 diff --git a/recipes/cimg/config.yml b/recipes/cimg/config.yml index 57d368a954f0b..70cd903d901e9 100644 --- a/recipes/cimg/config.yml +++ b/recipes/cimg/config.yml @@ -1,13 +1,13 @@ versions: - "3.0.2": + "3.3.2": folder: all - "3.0.0": + "3.3.0": folder: all - "2.9.9": + "3.2.6": folder: all - "2.9.4": + "3.0.2": folder: all - "2.9.2": + "2.9.9": folder: all "2.8.3": folder: all diff --git a/recipes/circularbuffer/all/conandata.yml b/recipes/circularbuffer/all/conandata.yml index ba45559184f9d..3b5cc436148eb 100644 --- a/recipes/circularbuffer/all/conandata.yml +++ b/recipes/circularbuffer/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.4.0": + url: "https://github.com/rlogiacco/CircularBuffer/archive/refs/tags/1.4.0.tar.gz" + sha256: "e01a837d2fe46fea168e8d36e1a4225d9414a855484d55b5a240f239ab53fc0a" "1.3.3": url: "https://github.com/rlogiacco/CircularBuffer/archive/refs/tags/1.3.3.tar.gz" sha256: "d558029c9ab5012a8bbf9a89bd130eb320bdeb69e3f8bd96851ddc1e5dc24eba" diff --git a/recipes/circularbuffer/all/conanfile.py b/recipes/circularbuffer/all/conanfile.py index c3948bef41ba8..2bdc97e38979c 100644 --- a/recipes/circularbuffer/all/conanfile.py +++ b/recipes/circularbuffer/all/conanfile.py @@ -1,51 +1,39 @@ 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.50.0" class CircularBufferConan(ConanFile): name = "circularbuffer" description = "Arduino circular buffer library" - topics = ("circular buffer", "arduino", "data-structures") license = "LGPL-3.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/rlogiacco/CircularBuffer" + topics = ("circular buffer", "arduino", "data-structures", "header-only") + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - 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 package_id(self): + self.info.clear() + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + def package(self): - copy(self, "LICENSE", dst=os.path.join(self.package_folder, - "licenses"), src=self.source_folder) - copy(self, "CircularBuffer.h", + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + 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") - - # 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" - self.cpp_info.names["cmake_find_package_multi"] = "CircularBuffer" + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/circularbuffer/all/test_package/CMakeLists.txt b/recipes/circularbuffer/all/test_package/CMakeLists.txt index d331e75f3a1ad..95df0ee16539a 100644 --- a/recipes/circularbuffer/all/test_package/CMakeLists.txt +++ b/recipes/circularbuffer/all/test_package/CMakeLists.txt @@ -1,9 +1,12 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) - -find_package(CircularBuffer CONFIG REQUIRED) +find_package(circularbuffer CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE CircularBuffer::CircularBuffer) +target_link_libraries(${PROJECT_NAME} PRIVATE circularbuffer::circularbuffer) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) + +if(circularbuffer_VERSION VERSION_GREATER_EQUAL "1.4.0") + target_compile_definitions(${PROJECT_NAME} PRIVATE CIRCULARBUFFER_1_4_0_LATER) +endif() diff --git a/recipes/circularbuffer/all/test_package/test_package.cpp b/recipes/circularbuffer/all/test_package/test_package.cpp index c9d59e4b258c6..eb914270c4c82 100644 --- a/recipes/circularbuffer/all/test_package/test_package.cpp +++ b/recipes/circularbuffer/all/test_package/test_package.cpp @@ -1,4 +1,8 @@ +#ifdef CIRCULARBUFFER_1_4_0_LATER +#include +#else #include +#endif int main() { CircularBuffer buffer; diff --git a/recipes/circularbuffer/all/test_v1_package/CMakeLists.txt b/recipes/circularbuffer/all/test_v1_package/CMakeLists.txt index 3ddfb18ba1fed..0d20897301b68 100644 --- a/recipes/circularbuffer/all/test_v1_package/CMakeLists.txt +++ b/recipes/circularbuffer/all/test_v1_package/CMakeLists.txt @@ -1,12 +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(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) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/circularbuffer/all/test_v1_package/conanfile.py b/recipes/circularbuffer/all/test_v1_package/conanfile.py index 0a93a273ba575..90eb89e3f2f46 100644 --- a/recipes/circularbuffer/all/test_v1_package/conanfile.py +++ b/recipes/circularbuffer/all/test_v1_package/conanfile.py @@ -2,7 +2,7 @@ from conans import ConanFile, CMake, tools -class TestConan(ConanFile): +class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" generators = "cmake", "cmake_find_package_multi" diff --git a/recipes/circularbuffer/all/test_v1_package/test_package.cpp b/recipes/circularbuffer/all/test_v1_package/test_package.cpp deleted file mode 100644 index c9d59e4b258c6..0000000000000 --- a/recipes/circularbuffer/all/test_v1_package/test_package.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include - -int main() { - CircularBuffer buffer; - - buffer.push(5); - buffer.unshift(1); - - return 0; -} diff --git a/recipes/circularbuffer/config.yml b/recipes/circularbuffer/config.yml index 3abfca40293f6..623dc27ffe730 100644 --- a/recipes/circularbuffer/config.yml +++ b/recipes/circularbuffer/config.yml @@ -1,3 +1,5 @@ versions: + "1.4.0": + folder: all "1.3.3": folder: all diff --git a/recipes/cista/all/conandata.yml b/recipes/cista/all/conandata.yml index dd598e2bd2c5c..02747f36f74ac 100644 --- a/recipes/cista/all/conandata.yml +++ b/recipes/cista/all/conandata.yml @@ -1,4 +1,19 @@ sources: + "0.15": + - url: "https://github.com/felixguendling/cista/releases/download/v0.15/cista.h" + sha256: "45685fde5c5ef576ad821c4db7f01e375eb2668aa6dafd6b9627fe58ce0641eb" + - url: "https://raw.githubusercontent.com/felixguendling/cista/v0.15/LICENSE" + sha256: "fcd47e35fd6dc22feec454c5c1e572ccb7587dedd91d824528ebbb00a7f37c56" + "0.14": + - url: "https://github.com/felixguendling/cista/releases/download/v0.14/cista.h" + sha256: "078933804966439ae105a6a748aa027a2f197351d735712b1efca0453340562d" + - url: "https://raw.githubusercontent.com/felixguendling/cista/v0.14/LICENSE" + sha256: "fcd47e35fd6dc22feec454c5c1e572ccb7587dedd91d824528ebbb00a7f37c56" + "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..98e6da7d482b1 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" @@ -18,24 +18,33 @@ class CistaConan(ConanFile): topics = ("cista", "serialization", "deserialization", "reflection") homepage = "https://github.com/felixguendling/cista" 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 _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" } + 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, 17) + check_min_cppstd(self, self._min_cppstd) def loose_lt_semver(v1, v2): lv1 = [int(v) for v in v1.split(".")] @@ -46,12 +55,9 @@ 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): - basic_layout(self, src_folder="src") - def source(self): for file in self.conan_data["sources"][self.version]: filename = os.path.basename(file["url"]) @@ -64,7 +70,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_package/conanfile.py b/recipes/cista/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/cista/all/test_package/conanfile.py +++ b/recipes/cista/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/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..205c7eaece71d 100644 --- a/recipes/cista/config.yml +++ b/recipes/cista/config.yml @@ -1,4 +1,10 @@ versions: + "0.15": + folder: all + "0.14": + folder: all + "0.11": + folder: all "0.10": folder: all "0.9": diff --git a/recipes/cityhash/all/conandata.yml b/recipes/cityhash/all/conandata.yml index 77c6f2317b0e8..35df63b093df5 100644 --- a/recipes/cityhash/all/conandata.yml +++ b/recipes/cityhash/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.0.1": + url: "https://github.com/google/cityhash/archive/8eded14d8e7cabfcdb10d4be35d521683edc0407.zip" + sha256: "e49f5bdb0f93d303bf18cb72f2f18e10ac3b4f2734da7cc1d708f7f2d2674c7c" "cci.20130801": url: "https://github.com/google/cityhash/archive/8af9b8c2b889d80c22d6bc26ba0df1afb79a30db.zip" sha256: "3524f5ed43143974a29fddeeece29c8b6348f05db08dd180452da01a2837ddce" diff --git a/recipes/cityhash/all/conanfile.py b/recipes/cityhash/all/conanfile.py index 35e373369c7eb..75f708b33af3e 100644 --- a/recipes/cityhash/all/conanfile.py +++ b/recipes/cityhash/all/conanfile.py @@ -1,20 +1,24 @@ -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 check_min_vs, is_msvc, unix_path import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.57.0" class CityhashConan(ConanFile): name = "cityhash" description = "CityHash, a family of hash functions for strings." license = "MIT" - topics = ("cityhash", "hash") + topics = ("hash",) homepage = "https://github.com/google/cityhash" url = "https://github.com/conan-io/conan-center-index" - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -25,91 +29,73 @@ 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) - @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 + 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], strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + + tc = AutotoolsToolchain(self) + 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") + env = tc.environment() + if is_msvc(self): + ar_wrapper = unix_path(self, self.dependencies.build["automake"].conf_info.get("user.automake:lib-wrapper")) + 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"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") 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/cityhash/config.yml b/recipes/cityhash/config.yml index 489bded5765de..6e8b7ecbe183c 100644 --- a/recipes/cityhash/config.yml +++ b/recipes/cityhash/config.yml @@ -1,3 +1,5 @@ versions: + "1.0.1": + folder: all "cci.20130801": folder: all diff --git a/recipes/civetweb/all/conandata.yml b/recipes/civetweb/all/conandata.yml index 695402c1a57a4..a9f81795c04f4 100644 --- a/recipes/civetweb/all/conandata.yml +++ b/recipes/civetweb/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.16": + url: "https://github.com/civetweb/civetweb/archive/v1.16.tar.gz" + sha256: "f0e471c1bf4e7804a6cfb41ea9d13e7d623b2bcc7bc1e2a4dd54951a24d60285" "1.15": url: "https://github.com/civetweb/civetweb/archive/v1.15.tar.gz" sha256: "90a533422944ab327a4fbb9969f0845d0dba05354f9cacce3a5005fa59f593b9" diff --git a/recipes/civetweb/all/conanfile.py b/recipes/civetweb/all/conanfile.py index fd01f187e2af3..d7ccad2b88226 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.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout 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.52.0" +required_conan_version = ">=1.53.0" class CivetwebConan(ConanFile): @@ -16,11 +16,13 @@ class CivetwebConan(ConanFile): description = "Embedded C/C++ web server" topics = ("web-server", "embedded") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "fPIC": [True, False], "shared": [True, False], "ssl_dynamic_loading": [True, False], + "thread_stack_size": [None, "ANY"], "with_caching": [True, False], "with_cgi": [True, False], "with_cxx": [True, False], @@ -38,6 +40,7 @@ class CivetwebConan(ConanFile): "fPIC": True, "shared": False, "ssl_dynamic_loading": False, + "thread_stack_size": None, "with_caching": True, "with_cgi": True, "with_cxx": True, @@ -69,47 +72,45 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") if not self.options.with_cxx: - 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.with_ssl: del self.options.ssl_dynamic_loading + def layout(self): + cmake_layout(self, src_folder="src") + def requirements(self): if self.options.with_ssl: - self.requires("openssl/1.1.1s") + if Version(self.version) < "1.16": + self.requires("openssl/1.1.1w") + else: + self.requires("openssl/[>=1 <4]") if self.options.get_safe("with_zlib"): - self.requires("zlib/1.2.13") + self.requires("zlib/[>=1.2.11 <2]") def validate(self): - if self.options.get_safe("ssl_dynamic_loading") and not self.options["openssl"].shared: + if self.options.get_safe("ssl_dynamic_loading") and not self.dependencies["openssl"].options.shared: raise ConanInvalidConfiguration("ssl_dynamic_loading requires shared openssl") + if self.options.thread_stack_size and not str(self.options.thread_stack_size).isdigit(): + raise ConanInvalidConfiguration("-o='civetweb/*:thread_stack_size' should be a positive integer") def source(self): - get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - - def layout(self): - cmake_layout(self) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) if self.options.with_ssl: - openssl_version = Version(self.dependencies["openssl"].ref.version[:-1]) + openssl_version = Version(self.dependencies["openssl"].ref.version) 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" - tc.variables["CIVETWEB_SSL_OPENSSL_API_1_1"] = openssl_version.minor == "1" + tc.variables["CIVETWEB_SSL_OPENSSL_API_1_0"] = openssl_version.major == "1" and openssl_version.minor == "0" + tc.variables["CIVETWEB_SSL_OPENSSL_API_1_1"] = openssl_version.major == "1" and openssl_version.minor == "1" + if Version(self.version) >= "1.16": + tc.variables["CIVETWEB_SSL_OPENSSL_API_3_0"] = openssl_version.major == "3" tc.variables["CIVETWEB_BUILD_TESTING"] = False tc.variables["CIVETWEB_CXX_ENABLE_LTO"] = False @@ -125,6 +126,8 @@ def generate(self): tc.variables["CIVETWEB_ENABLE_THIRD_PARTY_OUTPUT"] = self.options.with_third_party_output tc.variables["CIVETWEB_ENABLE_WEBSOCKETS"] = self.options.with_websockets tc.variables["CIVETWEB_SERVE_NO_FILES"] = not self.options.with_static_files + if self.options.thread_stack_size: + tc.variables["CIVETWEB_THREAD_STACK_SIZE"] = self.options.thread_stack_size if self._has_zlib_option: tc.variables["CIVETWEB_ENABLE_ZLIB"] = self.options.with_zlib @@ -145,22 +148,22 @@ def package(self): cmake = CMake(self) cmake.configure() 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")) bin_folder = os.path.join(self.package_folder, "bin") for bin_file in os.listdir(bin_folder): if not bin_file.startswith("civetweb"): os.remove(os.path.join(bin_folder, bin_file)) def package_info(self): - self.cpp_info.names["cmake_find_package"] = "civetweb" - self.cpp_info.names["cmake_find_package_multi"] = "civetweb" self.cpp_info.set_property("cmake_file_name", "civetweb") - self.cpp_info.set_property("cmake_target_name", "civetweb::civetweb") - self.cpp_info.components["_civetweb"].names["cmake_find_package"] = "civetweb" - self.cpp_info.components["_civetweb"].names["cmake_find_package_multi"] = "civetweb" + self.cpp_info.set_property("cmake_target_name", "civetweb::civetweb-cpp" if self.options.with_cxx else "civetweb::civetweb") + self.cpp_info.set_property("pkg_config_name", "civetweb") + self.cpp_info.components["_civetweb"].set_property("cmake_target_name", "civetweb::civetweb") self.cpp_info.components["_civetweb"].libs = ["civetweb"] - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["_civetweb"].system_libs.extend(["rt", "pthread"]) if self.options.get_safe("ssl_dynamic_loading"): self.cpp_info.components["_civetweb"].system_libs.append("dl") @@ -170,24 +173,25 @@ def package_info(self): self.cpp_info.components["_civetweb"].system_libs.append("ws2_32") if self.options.shared: self.cpp_info.components["_civetweb"].defines.append("CIVETWEB_DLL_IMPORTS") - if self.options.with_ssl: self.cpp_info.components["_civetweb"].requires.append("openssl::openssl") if self.options.get_safe("with_zlib"): self.cpp_info.components["_civetweb"].requires.append("zlib::zlib") if self.options.with_cxx: - self.cpp_info.components["civetweb-cpp"].names["cmake_find_package"] = "civetweb-cpp" - self.cpp_info.components["civetweb-cpp"].names["cmake_find_package_multi"] = "civetweb-cpp" self.cpp_info.components["civetweb-cpp"].set_property("cmake_target_name", "civetweb::civetweb-cpp") self.cpp_info.components["civetweb-cpp"].libs = ["civetweb-cpp"] self.cpp_info.components["civetweb-cpp"].requires = ["_civetweb"] - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["civetweb-cpp"].system_libs.append("m") elif self.settings.os == "Windows": if self.options.shared: self.cpp_info.components["civetweb-cpp"].defines.append("CIVETWEB_CXX_DLL_IMPORTS") - 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 once conan v1 support dropped + self.cpp_info.components["_civetweb"].names["cmake_find_package"] = "civetweb" + self.cpp_info.components["_civetweb"].names["cmake_find_package_multi"] = "civetweb" + if self.options.with_cxx: + self.cpp_info.components["civetweb-cpp"].names["cmake_find_package"] = "civetweb-cpp" + self.cpp_info.components["civetweb-cpp"].names["cmake_find_package_multi"] = "civetweb-cpp" + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/civetweb/all/test_package/conanfile.py b/recipes/civetweb/all/test_package/conanfile.py index 1a993f797dc27..4e578144a798a 100644 --- a/recipes/civetweb/all/test_package/conanfile.py +++ b/recipes/civetweb/all/test_package/conanfile.py @@ -1,24 +1,25 @@ 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" - - 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/civetweb/all/test_v1_package/CMakeLists.txt b/recipes/civetweb/all/test_v1_package/CMakeLists.txt index b6a8217aa2b62..0d20897301b68 100644 --- a/recipes/civetweb/all/test_v1_package/CMakeLists.txt +++ b/recipes/civetweb/all/test_v1_package/CMakeLists.txt @@ -1,10 +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(civetweb CONFIG REQUIRED) - -add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} civetweb::civetweb) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/civetweb/all/test_v1_package/test_package.cpp b/recipes/civetweb/all/test_v1_package/test_package.cpp deleted file mode 100644 index a8f94d139a8db..0000000000000 --- a/recipes/civetweb/all/test_v1_package/test_package.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "civetweb.h" - -int main(int argc, char *argv[]) -{ - mg_init_library(0); - return 0; -} diff --git a/recipes/civetweb/config.yml b/recipes/civetweb/config.yml index 1d382163182dc..8581197592553 100644 --- a/recipes/civetweb/config.yml +++ b/recipes/civetweb/config.yml @@ -1,4 +1,6 @@ versions: + "1.16": + folder: all "1.15": folder: all "1.14": diff --git a/recipes/cjson/all/conandata.yml b/recipes/cjson/all/conandata.yml index 397bb216165bb..32c4ecff90851 100644 --- a/recipes/cjson/all/conandata.yml +++ b/recipes/cjson/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "1.7.18": + url: "https://github.com/DaveGamble/cJSON/archive/v1.7.18.tar.gz" + sha256: "3aa806844a03442c00769b83e99970be70fbef03735ff898f4811dd03b9f5ee5" + "1.7.17": + url: "https://github.com/DaveGamble/cJSON/archive/v1.7.17.tar.gz" + sha256: "c91d1eeb7175c50d49f6ba2a25e69b46bd05cffb798382c19bfb202e467ec51c" + "1.7.16": + url: "https://github.com/DaveGamble/cJSON/archive/v1.7.16.tar.gz" + sha256: "451131a92c55efc5457276807fc0c4c2c2707c9ee96ef90c47d68852d5384c6c" "1.7.15": url: "https://github.com/DaveGamble/cJSON/archive/v1.7.15.tar.gz" sha256: "5308fd4bd90cef7aa060558514de6a1a4a0819974a26e6ed13973c5f624c24b2" diff --git a/recipes/cjson/all/conanfile.py b/recipes/cjson/all/conanfile.py index 8b410ba909952..84820348d6401 100644 --- a/recipes/cjson/all/conanfile.py +++ b/recipes/cjson/all/conanfile.py @@ -6,18 +6,18 @@ import os import textwrap -required_conan_version = ">=1.53.0" +required_conan_version = ">=1.54.0" class CjsonConan(ConanFile): name = "cjson" description = "Ultralightweight JSON parser in ANSI C." license = "MIT" - topics = ("json", "parser") - homepage = "https://github.com/DaveGamble/cJSON" url = "https://github.com/conan-io/conan-center-index" - + homepage = "https://github.com/DaveGamble/cJSON" + topics = ("json", "parser") settings = "os", "arch", "compiler", "build_type" + package_type = "library" options = { "shared": [True, False], "fPIC": [True, False], @@ -48,12 +48,11 @@ def layout(self): cmake_layout(self, src_folder="src") def validate(self): - 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("shared cjson is not supported with 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) @@ -71,8 +70,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): diff --git a/recipes/cjson/config.yml b/recipes/cjson/config.yml index 894ac0453b1d4..08843263806b5 100644 --- a/recipes/cjson/config.yml +++ b/recipes/cjson/config.yml @@ -1,4 +1,10 @@ versions: + "1.7.18": + folder: all + "1.7.17": + folder: all + "1.7.16": + folder: all "1.7.15": folder: all "1.7.14": diff --git a/recipes/clhep/all/conandata.yml b/recipes/clhep/all/conandata.yml index 2745e50b6c689..0b47cdc0ae08e 100644 --- a/recipes/clhep/all/conandata.yml +++ b/recipes/clhep/all/conandata.yml @@ -1,9 +1,41 @@ sources: + "2.4.7.1": + url: "https://proj-clhep.web.cern.ch/proj-clhep/dist1/clhep-2.4.7.1.tgz" + sha256: "1c8304a7772ac6b99195f1300378c6e3ddf4ad07c85d64a04505652abb8a55f9" + "2.4.6.4": + url: "https://proj-clhep.web.cern.ch/proj-clhep/dist1/clhep-2.4.6.4.tgz" + sha256: "49c89330f1903ef707d3c5d79c16a7c5a6f2c90fc290e2034ee3834809489e57" "2.4.1.3": url: "https://proj-clhep.web.cern.ch/proj-clhep/dist1/clhep-2.4.1.3.tgz" sha256: "27c257934929f4cb1643aa60aeaad6519025d8f0a1c199bc3137ad7368245913" patches: + "2.4.7.1": + - patch_file: "patches/2.4.6.4-0001-fix-cmake.patch" + patch_description: "The CLHEP build system builds BOTH shared and static by default, change that behaviour" + patch_type: "conan" + - patch_file: "patches/2.4.6.4-0002-mingw-support.patch" + patch_description: "allow CLHEP to build and link properly under mingw environments" + patch_type: "portability" + - patch_file: "patches/2.4.1.3-0003-msvc-2015-no-SFINAE.patch" + patch_description: "work around a compiler bug in MSVC 2015" + patch_type: "portability" + "2.4.6.4": + - patch_file: "patches/2.4.6.4-0001-fix-cmake.patch" + patch_description: "The CLHEP build system builds BOTH shared and static by default, change that behaviour" + patch_type: "conan" + - patch_file: "patches/2.4.6.4-0002-mingw-support.patch" + patch_description: "allow CLHEP to build and link properly under mingw environments" + patch_type: "portability" + - patch_file: "patches/2.4.1.3-0003-msvc-2015-no-SFINAE.patch" + patch_description: "work around a compiler bug in MSVC 2015" + patch_type: "portability" "2.4.1.3": - - patch_file: "patches/fix-cmake.patch" - - patch_file: "patches/mingw-support.patch" - - patch_file: "patches/msvc-2015-no-SFINAE.patch" + - patch_file: "patches/2.4.1.3-0001-fix-cmake.patch" + patch_description: "The CLHEP build system builds BOTH shared and static by default, change that behaviour" + patch_type: conan + - patch_file: "patches/2.4.1.3-0002-mingw-support.patch" + patch_description: "allow CLHEP to build and link properly under mingw environments" + patch_type: "portability" + - patch_file: "patches/2.4.1.3-0003-msvc-2015-no-SFINAE.patch" + patch_description: "work around a compiler bug in MSVC 2015" + patch_type: "portability" diff --git a/recipes/clhep/all/conanfile.py b/recipes/clhep/all/conanfile.py index 71922771f6947..693c03e14c222 100644 --- a/recipes/clhep/all/conanfile.py +++ b/recipes/clhep/all/conanfile.py @@ -2,21 +2,22 @@ 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 +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 ClhepConan(ConanFile): name = "clhep" description = "Class Library for High Energy Physics." license = "LGPL-3.0-only" - topics = ("clhep", "cern", "hep", "high energy", "physics", "geometry", "algebra") + topics = ("cern", "hep", "high energy", "physics", "geometry", "algebra") homepage = "http://proj-clhep.web.cern.ch/proj-clhep" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -30,8 +31,7 @@ class ClhepConan(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": @@ -39,20 +39,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.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("CLHEP doesn't properly build its shared libs with 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) diff --git a/recipes/clhep/all/patches/fix-cmake.patch b/recipes/clhep/all/patches/2.4.1.3-0001-fix-cmake.patch similarity index 100% rename from recipes/clhep/all/patches/fix-cmake.patch rename to recipes/clhep/all/patches/2.4.1.3-0001-fix-cmake.patch diff --git a/recipes/clhep/all/patches/mingw-support.patch b/recipes/clhep/all/patches/2.4.1.3-0002-mingw-support.patch similarity index 100% rename from recipes/clhep/all/patches/mingw-support.patch rename to recipes/clhep/all/patches/2.4.1.3-0002-mingw-support.patch diff --git a/recipes/clhep/all/patches/msvc-2015-no-SFINAE.patch b/recipes/clhep/all/patches/2.4.1.3-0003-msvc-2015-no-SFINAE.patch similarity index 100% rename from recipes/clhep/all/patches/msvc-2015-no-SFINAE.patch rename to recipes/clhep/all/patches/2.4.1.3-0003-msvc-2015-no-SFINAE.patch diff --git a/recipes/clhep/all/patches/2.4.6.4-0001-fix-cmake.patch b/recipes/clhep/all/patches/2.4.6.4-0001-fix-cmake.patch new file mode 100644 index 0000000000000..7137344105ea3 --- /dev/null +++ b/recipes/clhep/all/patches/2.4.6.4-0001-fix-cmake.patch @@ -0,0 +1,72 @@ +--- a/CLHEP/CMakeLists.txt ++++ b/CLHEP/CMakeLists.txt +@@ -121,10 +121,8 @@ add_subdirectory(RefCount) + add_subdirectory(Exceptions) + + # libCLHEP.a and libCLHEP.so +-clhep_build_libclhep( ${CLHEP_libraries} ) + + # provide tools for other packages to include CLHEP easily +-clhep_toolchain() + + # - Build docucumentation if required + if(CLHEP_BUILD_DOCS) +@@ -151,4 +149,3 @@ if(CLHEP_BUILD_DOCS) + endif() + + # Custom Packaging +-include(ClhepPackaging) +--- a/CLHEP/cmake/Modules/ClhepBuildTest.cmake ++++ b/CLHEP/cmake/Modules/ClhepBuildTest.cmake +@@ -17,6 +17,8 @@ include(ClhepParseArgs) + + + macro( clhep_test testname ) ++# disable tests ++if(FALSE) + clhep_parse_args( CTST "LIBS;DEPENDS" "SIMPLE;FAIL;NOLIB" ${ARGN}) + + # automake/autoconf variables for ${testname}.sh.in +@@ -68,4 +70,5 @@ macro( clhep_test testname ) + endif() + endif() + ++endif() + endmacro( clhep_test ) +--- a/CLHEP/cmake/Modules/ClhepBuildLibrary.cmake ++++ b/CLHEP/cmake/Modules/ClhepBuildLibrary.cmake +@@ -30,29 +30,24 @@ macro(clhep_build_library package) + endif() + + # Add the libraries and set properties +- ADD_LIBRARY(${package} SHARED ${CLHEP_${package}_SOURCES}) +- ADD_LIBRARY(${package}S STATIC ${CLHEP_${package}_SOURCES}) ++ # Build shared or static, not both, because: ++ # - slower build ++ # - lot of issues because output names are the same + msvc shared is broken ++ ADD_LIBRARY(${package} ${CLHEP_${package}_SOURCES}) + SET_TARGET_PROPERTIES (${package} + PROPERTIES + OUTPUT_NAME CLHEP-${package}-${VERSION} + ) +- SET_TARGET_PROPERTIES(${package}S +- PROPERTIES +- OUTPUT_NAME CLHEP-${package}-${VERSION} +- ) + + # Do not add -Dname_EXPORTS to the command-line when building files in this + # target. Doing so is actively harmful for the modules build because it + # creates extra module variants, and not useful because we don't use these + # macros. + SET_TARGET_PROPERTIES(${package} PROPERTIES DEFINE_SYMBOL "") +- SET_TARGET_PROPERTIES(${package}S PROPERTIES DEFINE_SYMBOL "") +- + target_link_libraries(${package} ${package_library_list} ) +- target_link_libraries(${package}S ${package_library_list_static} ) + + # Install the libraries +- INSTALL (TARGETS ${package} ${package}S ++ INSTALL (TARGETS ${package} + EXPORT CLHEPLibraryDepends + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib${LIB_SUFFIX} diff --git a/recipes/clhep/all/patches/2.4.6.4-0002-mingw-support.patch b/recipes/clhep/all/patches/2.4.6.4-0002-mingw-support.patch new file mode 100644 index 0000000000000..ab753ce5e9b81 --- /dev/null +++ b/recipes/clhep/all/patches/2.4.6.4-0002-mingw-support.patch @@ -0,0 +1,42 @@ +--- a/CLHEP/GenericFunctions/src/AnalyticConvolution.cc ++++ b/CLHEP/GenericFunctions/src/AnalyticConvolution.cc +@@ -5,7 +5,7 @@ + #include "CLHEP/GenericFunctions/Gaussian.hh" + #include "CLHEP/GenericFunctions/Exponential.hh" + #include // for isfinite +-#if (defined _WIN32) ++#ifdef _MSC_VER + #include // Visual C++ _finite + #endif + #include +@@ -81,7 +81,7 @@ double AnalyticConvolution::operator() (double argument) const { + if (_type==SMEARED_NEG_EXP) { + expG = exp((xsigma*xsigma +2*tau*(/*xoffset*/x))/(2.0*tau*tau)) * + erfc((xsigma*xsigma+tau*(/*xoffset*/x))/(sqrtTwo*xsigma*tau))/(2.0*tau); +-#if (defined _WIN32) ++#ifdef _MSC_VER + if (!_finite(expG)) { + expG=0.0; + } +@@ -99,7 +99,7 @@ double AnalyticConvolution::operator() (double argument) const { + + // Both sign distribution=> return smeared exponential: + if (_type==SMEARED_EXP) { +-#if (defined _WIN32) ++#ifdef _MSC_VER + if (!_finite(expG)) { + expG=0.0; + } +--- a/CLHEP/Random/src/DRand48Engine.cc ++++ b/CLHEP/Random/src/DRand48Engine.cc +@@ -38,6 +38,10 @@ + #include // for strcmp + #include // for std::abs(int) + ++#if !defined(HAVE_DRAND48) && defined(__MINGW32__) ++#include "drand48.src" ++#endif ++ + //#define TRACE_IO + + #include diff --git a/recipes/clhep/all/test_package/conanfile.py b/recipes/clhep/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/clhep/all/test_package/conanfile.py +++ b/recipes/clhep/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/clhep/all/test_v1_package/CMakeLists.txt b/recipes/clhep/all/test_v1_package/CMakeLists.txt index d579da155e563..0d20897301b68 100644 --- a/recipes/clhep/all/test_v1_package/CMakeLists.txt +++ b/recipes/clhep/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(CLHEP REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) -if(TARGET CLHEP::CLHEPS) - target_link_libraries(${PROJECT_NAME} PRIVATE CLHEP::CLHEPS) -else() - target_link_libraries(${PROJECT_NAME} PRIVATE CLHEP::CLHEP) -endif() +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/clhep/config.yml b/recipes/clhep/config.yml index e3d64184919ef..87edeeec0d29b 100644 --- a/recipes/clhep/config.yml +++ b/recipes/clhep/config.yml @@ -1,3 +1,7 @@ versions: + "2.4.7.1": + folder: all + "2.4.6.4": + folder: all "2.4.1.3": folder: all diff --git a/recipes/cli/all/conandata.yml b/recipes/cli/all/conandata.yml new file mode 100644 index 0000000000000..ab550920bd481 --- /dev/null +++ b/recipes/cli/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "2.2.0": + url: "https://github.com/daniele77/cli/archive/refs/tags/v2.2.0.tar.gz" + sha256: "67c6329471cd5a98b9ab29da0012f94f61497f0b60591bb0ab714d4c09c4f2b0" + "2.1.0": + url: "https://github.com/daniele77/cli/archive/refs/tags/v2.1.0.tar.gz" + sha256: "dfc9fc7c72a6cdfdf852d89f151699b57460ff49775a8ff27d2a69477649acf9" diff --git a/recipes/cli/all/conanfile.py b/recipes/cli/all/conanfile.py new file mode 100644 index 0000000000000..d36d374460adf --- /dev/null +++ b/recipes/cli/all/conanfile.py @@ -0,0 +1,64 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +import os + +class CLIConan(ConanFile): + name = "cli" + description = "A library for interactive command line interfaces in modern C++" + license = "BSL-1.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/daniele77/cli" + topics = "cli-interface", "cpp14", "no-dependencies", "header-only" + package_type = "header-library" + settings = "os", "compiler", "build_type", "arch" + no_copy_source = True + + @property + def _min_cppstd(self): + return 14 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "7", + "clang": "6", + "Visual Studio": "16", + "msvc": "192", + "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) + 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", 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")) + + 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("pthread") diff --git a/recipes/cli/all/test_package/CMakeLists.txt b/recipes/cli/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..db3334ac223dd --- /dev/null +++ b/recipes/cli/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(cli CONFIG REQUIRED) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE cli::cli) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/cli/all/test_package/conanfile.py b/recipes/cli/all/test_package/conanfile.py new file mode 100644 index 0000000000000..c5ef71ffe76fe --- /dev/null +++ b/recipes/cli/all/test_package/conanfile.py @@ -0,0 +1,30 @@ +import os + +from conan import ConanFile +from conan.tools.cmake import CMake, cmake_layout, CMakeToolchain +from conan.tools.build import can_run + +class cliTestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "CMakeDeps" + test_type = "explicit" + + 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 layout(self): + cmake_layout(self) + + def test(self): + if can_run(self): + cmd = os.path.join(self.cpp.build.bindir, "test_package") + self.run(cmd, env="conanrun") diff --git a/recipes/cli/all/test_package/test_package.cpp b/recipes/cli/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..238aaf7e42157 --- /dev/null +++ b/recipes/cli/all/test_package/test_package.cpp @@ -0,0 +1,22 @@ +#include +#include + +using namespace cli; +using namespace std; + + +int main() +{ + auto rootMenu = make_unique< Menu >( "cli" ); + rootMenu -> Insert( + "hello", + [](std::ostream& out){ out << "Hello, world\n"; }, + "Print hello world" ); + + Cli cli( std::move(rootMenu) ); + cli.ExitAction( [](auto& out){ out << "Goodbye and thanks for all the fish.\n"; } ); + + CliFileSession input(cli); + + return 0; +} diff --git a/recipes/cli/config.yml b/recipes/cli/config.yml new file mode 100644 index 0000000000000..57df2fc911f74 --- /dev/null +++ b/recipes/cli/config.yml @@ -0,0 +1,5 @@ +versions: + "2.2.0": + folder: all + "2.1.0": + folder: all diff --git a/recipes/cli11/all/conandata.yml b/recipes/cli11/all/conandata.yml index 36add26ccbad7..0202c83c31a52 100644 --- a/recipes/cli11/all/conandata.yml +++ b/recipes/cli11/all/conandata.yml @@ -1,4 +1,16 @@ sources: + "2.4.2": + url: "https://github.com/CLIUtils/CLI11/archive/v2.4.2.tar.gz" + sha256: "f2d893a65c3b1324c50d4e682c0cdc021dd0477ae2c048544f39eed6654b699a" + "2.4.1": + url: "https://github.com/CLIUtils/CLI11/archive/v2.4.1.tar.gz" + sha256: "73b7ec52261ce8fe980a29df6b4ceb66243bb0b779451dbd3d014cfec9fdbb58" + "2.4.0": + url: "https://github.com/CLIUtils/CLI11/archive/v2.4.0.tar.gz" + sha256: "d2ce8d5318d2a7a7d1120e2a18caac49cd65423d5d4158cbbc0267e6768af522" + "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" diff --git a/recipes/cli11/all/conanfile.py b/recipes/cli11/all/conanfile.py index 6ccc240eeda4f..227ff9075e44e 100644 --- a/recipes/cli11/all/conanfile.py +++ b/recipes/cli11/all/conanfile.py @@ -2,35 +2,62 @@ 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 +from conan.tools.scm import Version import os 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" - url = "https://github.com/conan-io/conan-center-index" license = "BSD-3-Clause" - settings = "os", "compiler", "build_type", "arch" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/CLIUtils/CLI11" + topics = "cli-parser", "cpp11", "no-dependencies", "cli" + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + options = { + "header_only": [True, False] + } + default_options = { + "header_only": True + } @property def _min_cppstd(self): return "11" - def validate(self): - if self.settings.compiler.get_safe("cppstd"): - check_min_cppstd(self, self._min_cppstd) + @property + def _supports_compilation(self): + return Version(self.version) >= "2.3" + + def configure(self): + if not self._supports_compilation: + # TODO: Back to config_options after Conan 1 freeze + del self.options.header_only + elif not self.options.header_only: + self.package_type = "static-library" def layout(self): cmake_layout(self, src_folder="src") + def package_id(self): + if not self._supports_compilation or self.info.options.header_only: + 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) + if self._supports_compilation: + tc.variables["CLI11_PRECOMPILED"] = not self.options.header_only tc.variables["CLI11_BUILD_EXAMPLES"] = False tc.variables["CLI11_BUILD_TESTS"] = False tc.variables["CLI11_BUILD_DOCS"] = False @@ -50,10 +77,15 @@ def package(self): # since 2.1.1 rmdir(self, os.path.join(self.package_folder, "share")) - def package_id(self): - self.info.clear() - def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + if self._supports_compilation and not self.options.get_safe("header_only"): + self.cpp_info.libdirs = ["lib"] + self.cpp_info.libs = ["CLI11"] + self.cpp_info.defines = ["CLI11_COMPILE"] + 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") diff --git a/recipes/cli11/all/test_package/CMakeLists.txt b/recipes/cli11/all/test_package/CMakeLists.txt index 0b06b681b8997..a5cc1000feeb3 100644 --- a/recipes/cli11/all/test_package/CMakeLists.txt +++ b/recipes/cli11/all/test_package/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package CXX) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) find_package(CLI11 REQUIRED CONFIG) diff --git a/recipes/cli11/config.yml b/recipes/cli11/config.yml index 404e9fa4a9f55..fc84730ec9afc 100644 --- a/recipes/cli11/config.yml +++ b/recipes/cli11/config.yml @@ -1,4 +1,12 @@ versions: + "2.4.2": + folder: all + "2.4.1": + folder: all + "2.4.0": + folder: all + "2.3.2": + folder: all "2.3.1": folder: all "2.3.0": diff --git a/recipes/clickhouse-cpp/all/conandata.yml b/recipes/clickhouse-cpp/all/conandata.yml new file mode 100644 index 0000000000000..16d1b5fbe21b5 --- /dev/null +++ b/recipes/clickhouse-cpp/all/conandata.yml @@ -0,0 +1,10 @@ +sources: + "2.5.1": + url: "https://github.com/ClickHouse/clickhouse-cpp/archive/refs/tags/v2.5.1.tar.gz" + sha256: "8942fc702eca1f656e59c680c7e464205bffea038b62c1a0ad1f794ee01e7266" + "2.5.0": + url: "https://github.com/ClickHouse/clickhouse-cpp/archive/refs/tags/v2.5.0.tar.gz" + sha256: "7eead6beb47a64be9b1f12f2435f0fb6304e8363823ed72178c76faf0d835801" + "2.4.0": + url: "https://github.com/ClickHouse/clickhouse-cpp/archive/refs/tags/v2.4.0.tar.gz" + sha256: "336a1d0b4c4d6bd67bd272afab3bdac51695f8b0e93dd6c85d4d774d6c7df8ad" diff --git a/recipes/clickhouse-cpp/all/conanfile.py b/recipes/clickhouse-cpp/all/conanfile.py new file mode 100644 index 0000000000000..a11bdcb964b24 --- /dev/null +++ b/recipes/clickhouse-cpp/all/conanfile.py @@ -0,0 +1,123 @@ +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain,CMakeDeps, cmake_layout +from conan.tools.files import copy, get +from conan.tools.build import check_min_cppstd +from conan.errors import ConanInvalidConfiguration +from conan.tools.scm import Version +import os + +required_conan_version = ">=1.53.0" + +class ClickHouseCppConan(ConanFile): + name = "clickhouse-cpp" + description = "ClickHouse C++ API" + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/ClickHouse/clickhouse-cpp" + topics = ("database", "db", "clickhouse") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_openssl": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_openssl": False, + } + + @property + def _min_cppstd(self): + return "17" + + @property + def _compilers_minimum_version(self): + return { + "Visual Studio": "15", + "msvc": "191", + "gcc": "7", + "clang": "6", + } + + @property + def _requires_compiler_rt(self): + return self.settings.compiler == "clang" and \ + ((self.settings.compiler.libcxx in ["libstdc++", "libstdc++11"] and not self.options.shared) or \ + self.settings.compiler.libcxx == "libc++") + + 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("lz4/1.9.4") + self.requires("abseil/20230125.3", transitive_headers=True) + self.requires("cityhash/1.0.1") + if self.options.with_openssl: + self.requires("openssl/[>=1.1 <4]") + + 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.") + if self.settings.os == "Windows" and self.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} does not support shared library on Windows.") + # look at https://github.com/ClickHouse/clickhouse-cpp/pull/226 + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["BUILD_SHARED_LIBS"] = self.options.shared + tc.cache_variables["WITH_OPENSSL"] = self.options.with_openssl + tc.cache_variables["WITH_SYSTEM_ABSEIL"] = True + tc.cache_variables["WITH_SYSTEM_LZ4"] = True + tc.cache_variables["WITH_SYSTEM_CITYHASH"] = True + # TODO: enable DEBUG_DEPENDENCIES on >= 2.5.0 + if Version(self.version) >= "2.5.0": + tc.cache_variables["DEBUG_DEPENDENCIES"] = False + tc.generate() + + cd = CMakeDeps(self) + cd.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() + + def package_info(self): + self.cpp_info.libs.append("clickhouse-cpp-lib") + self.cpp_info.set_property("cmake_target_name", "clickhouse-cpp-lib::clickhouse-cpp-lib") + + if self._requires_compiler_rt: + ldflags = ["--rtlib=compiler-rt"] + self.cpp_info.exelinkflags = ldflags + self.cpp_info.sharedlinkflags = ldflags + self.cpp_info.system_libs.append("gcc_s") + + if self.settings.os == 'Windows': + self.cpp_info.system_libs = ['ws2_32', 'wsock32'] + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "clickhouse-cpp" + self.cpp_info.filenames["cmake_find_package_multi"] = "clickhouse-cpp" + self.cpp_info.names["cmake_find_package"] = "clickhouse-cpp-lib" + self.cpp_info.names["cmake_find_package_multi"] = "clickhouse-cpp-lib" diff --git a/recipes/clickhouse-cpp/all/test_package/CMakeLists.txt b/recipes/clickhouse-cpp/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..ede8071f6e744 --- /dev/null +++ b/recipes/clickhouse-cpp/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(clickhouse-cpp REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE clickhouse-cpp-lib::clickhouse-cpp-lib) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/clickhouse-cpp/all/test_package/conanfile.py b/recipes/clickhouse-cpp/all/test_package/conanfile.py new file mode 100644 index 0000000000000..6d529581ba2f5 --- /dev/null +++ b/recipes/clickhouse-cpp/all/test_package/conanfile.py @@ -0,0 +1,29 @@ +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" + + 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/clickhouse-cpp/all/test_package/test_package.cpp b/recipes/clickhouse-cpp/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..475e89847d23f --- /dev/null +++ b/recipes/clickhouse-cpp/all/test_package/test_package.cpp @@ -0,0 +1,28 @@ +#include +#include +#include +#include + +#include +#include +using namespace clickhouse; + +int main() +{ + const auto localHostEndpoint = ClientOptions() + .SetHost( "localhost") + .SetPort(9000) + .SetUser("default") + .SetPassword("") + .SetDefaultDatabase("default"); + + try { + Client client(localHostEndpoint); + } + catch (const std::exception &ex) + { + std::cout << "not connected but works" << std::endl; + } + + return 0; +} diff --git a/recipes/clickhouse-cpp/all/test_v1_package/CMakeLists.txt b/recipes/clickhouse-cpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/clickhouse-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/clickhouse-cpp/all/test_v1_package/conanfile.py b/recipes/clickhouse-cpp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/clickhouse-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/clickhouse-cpp/config.yml b/recipes/clickhouse-cpp/config.yml new file mode 100644 index 0000000000000..b99c6305af105 --- /dev/null +++ b/recipes/clickhouse-cpp/config.yml @@ -0,0 +1,7 @@ +versions: + "2.5.1": + folder: all + "2.5.0": + folder: all + "2.4.0": + folder: all diff --git a/recipes/clipboard_lite/all/conandata.yml b/recipes/clipboard_lite/all/conandata.yml new file mode 100644 index 0000000000000..3299b8b622e6d --- /dev/null +++ b/recipes/clipboard_lite/all/conandata.yml @@ -0,0 +1,10 @@ +sources: + "3.4": + url: "https://github.com/smasherprog/clipboard_lite/archive/refs/tags/3.4.tar.gz" + sha256: "d8206c9c97381645b1a5a6662414d199f46fb4e160d0f914774ed8dcc0369cc4" +patches: + "3.4": + - patch_file: "patches/0001-include-string.patch" + patch_description: "include string header" + patch_type: "portability" + patch_source: "https://github.com/smasherprog/clipboard_lite/pull/3" diff --git a/recipes/clipboard_lite/all/conanfile.py b/recipes/clipboard_lite/all/conanfile.py new file mode 100644 index 0000000000000..28bed6034cb23 --- /dev/null +++ b/recipes/clipboard_lite/all/conanfile.py @@ -0,0 +1,105 @@ +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.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.apple import is_apple_os +import os + +required_conan_version = ">=1.53.0" + +class ClipboardLiteConan(ConanFile): + name = "clipboard_lite" + description = "cross platform clipboard library" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/smasherprog/clipboard_lite" + topics = ("clipboard") + package_type = "library" + 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", + "apple-clang": "10", + "Visual Studio": "15", + "msvc": "191", + } + + 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.settings.os in ["Linux", "FreeBSD"]: + self.requires("xorg/system") + + 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.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() + + def package_info(self): + self.cpp_info.libs = ["clipboard_lite"] + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.requires.extend(["xorg::xcb", "xorg::x11", "xorg::xfixes"]) + self.cpp_info.system_libs.extend(["m", "pthread"]) + elif is_apple_os(self): + self.cpp_info.frameworks = ['Cocoa', 'Carbon', 'CoreFoundation', 'CoreGraphics', 'Foundation', 'AppKit'] + elif self.settings.os == "Windows": + self.cpp_info.system_libs.extend([ + "shlwapi", + "windowscodecs", + ]) diff --git a/recipes/clipboard_lite/all/patches/0001-include-string.patch b/recipes/clipboard_lite/all/patches/0001-include-string.patch new file mode 100644 index 0000000000000..9f99123d7753c --- /dev/null +++ b/recipes/clipboard_lite/all/patches/0001-include-string.patch @@ -0,0 +1,12 @@ +diff --git a/include/Clipboard_Lite.h b/include/Clipboard_Lite.h +index 4f98756..b68e0f4 100644 +--- a/include/Clipboard_Lite.h ++++ b/include/Clipboard_Lite.h +@@ -1,6 +1,7 @@ + #pragma once + #include + #include ++#include + + #if defined(WINDOWS) || defined(WIN32) + #if defined(CLIPBOARD_LITE_DLL) diff --git a/recipes/clipboard_lite/all/test_package/CMakeLists.txt b/recipes/clipboard_lite/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..2d472ecc585a3 --- /dev/null +++ b/recipes/clipboard_lite/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(clipboard_lite REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE clipboard_lite::clipboard_lite) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/clipboard_lite/all/test_package/conanfile.py b/recipes/clipboard_lite/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fb96656f203 --- /dev/null +++ b/recipes/clipboard_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_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/clipboard_lite/all/test_package/test_package.cpp b/recipes/clipboard_lite/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..8244a75adf815 --- /dev/null +++ b/recipes/clipboard_lite/all/test_package/test_package.cpp @@ -0,0 +1,23 @@ +#include +#include "Clipboard_Lite.h" + +// just compile it, don't execute it. +// clipboard_lite execute `assert()` with false when test_package runs in headless environment. +auto create_impl() { + auto clipboard = SL::Clipboard_Lite::CreateClipboard() + ->onText([](const std::string& text) { + std::cout << text << std::endl; + }) + ->onImage([&](const SL::Clipboard_Lite::Image& image) { + std::cout << "onImage Height=" << image.Height << " Width=" << image.Width << std::endl; + }) + ->run(); + + return clipboard; +} + +int main(void) { + auto* create = create_impl; + + return 0; +} diff --git a/recipes/clipboard_lite/config.yml b/recipes/clipboard_lite/config.yml new file mode 100644 index 0000000000000..a020f54c411ba --- /dev/null +++ b/recipes/clipboard_lite/config.yml @@ -0,0 +1,3 @@ +versions: + "3.4": + folder: all diff --git a/recipes/clipp/all/conanfile.py b/recipes/clipp/all/conanfile.py index 2a4b7c31a6543..772d6c4ae0f5d 100644 --- a/recipes/clipp/all/conanfile.py +++ b/recipes/clipp/all/conanfile.py @@ -1,25 +1,50 @@ import os -from conan 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 required_conan_version = ">=1.50.0" + class ClippConan(ConanFile): name = "clipp" - description = """Easy to use, powerful & expressive command line argument parsing for modern C++ / single header / usage & doc generation.""" - topics = ("clipp", "argparse", "cli", "usage", "options", "subcommands") + description = ( + "Easy to use, powerful & expressive command line argument parsing " + "for modern C++ / single header / usage & doc generation." + ) + topics = ("argparse", "cli", "usage", "options", "subcommands") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/muellan/clipp" license = "MIT" + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - def source(self): - tools.files.get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + @property + def _min_cppstd(self): + return "11" - def package(self): - tools.files.copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) - tools.files.copy(self, "*", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) + 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, "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", "clipp") + self.cpp_info.set_property("cmake_target_name", "clipp::clipp") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/clipp/all/test_package/CMakeLists.txt b/recipes/clipp/all/test_package/CMakeLists.txt index 829b5ca81b9ce..a7580c7f51d5d 100644 --- a/recipes/clipp/all/test_package/CMakeLists.txt +++ b/recipes/clipp/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -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() +find_package(clipp 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 clipp::clipp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/clipp/all/test_package/conanfile.py b/recipes/clipp/all/test_package/conanfile.py index 70924c438164e..81d4d29e64c73 100644 --- a/recipes/clipp/all/test_package/conanfile.py +++ b/recipes/clipp/all/test_package/conanfile.py @@ -1,11 +1,17 @@ import os -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, 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) @@ -16,6 +22,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/clipp/all/test_v1_package/CMakeLists.txt b/recipes/clipp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/clipp/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/clipp/all/test_v1_package/conanfile.py b/recipes/clipp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/clipp/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/clipper/all/conanfile.py b/recipes/clipper/all/conanfile.py index 0213fccdf0a34..7b0a2de7fb05b 100644 --- a/recipes/clipper/all/conanfile.py +++ b/recipes/clipper/all/conanfile.py @@ -3,17 +3,16 @@ from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir import os -required_conan_version = ">=1.53.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], @@ -39,7 +38,7 @@ 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) @@ -47,8 +46,6 @@ def generate(self): tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True # To install relocatable shared libs on Macos tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" - # TODO: can be removed if required_conan_version bumped to at least 1.54.0 - tc.variables["BUILD_SHARED_LIBS"] = self.options.shared tc.generate() def build(self): @@ -67,6 +64,9 @@ 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 diff --git a/recipes/clipper2/all/conandata.yml b/recipes/clipper2/all/conandata.yml new file mode 100644 index 0000000000000..5d1e76ef64605 --- /dev/null +++ b/recipes/clipper2/all/conandata.yml @@ -0,0 +1,25 @@ +sources: + "1.4.0": + url: "https://github.com/AngusJohnson/Clipper2/archive/refs/tags/Clipper2_1.4.0.tar.gz" + sha256: "b83f71bb6a338f4f82116089c5ae867dbc43a2d651b5441380970dd966edd959" + "1.3.0": + url: "https://github.com/AngusJohnson/Clipper2/archive/refs/tags/Clipper2_1.3.0.tar.gz" + sha256: "8e537ec320e140afaa8fba1f23120416693cc1d71b0f76ad801d24b88b5e0b3c" + "1.2.4": + url: "https://github.com/AngusJohnson/Clipper2/archive/refs/tags/Clipper2_1.2.4.tar.gz" + sha256: "a013d391c25c5f665cdb5cbd75cdd842dcc28f6e1bd098454beb359f6f212f33" + "1.2.3": + url: "https://github.com/AngusJohnson/Clipper2/archive/refs/tags/Clipper2_1.2.3.tar.gz" + sha256: "d65bd45f50331e9dd2de3c68137c6be069fe25732095bef0128d547c997b1fda" + "1.2.2": + url: "https://github.com/AngusJohnson/Clipper2/files/11071418/Clipper2_1.2.2.zip" + sha256: "ec28bc4e05a86cb0be81a872e8d90a4d575b63882ef3ac78f06662358e410f89" +patches: + "1.2.4": + - patch_file: "patches/1.2.4-0001-remove-macos-suffix.patch" + patch_description: "fix install for windows shared build" + patch_type: "portability" + "1.2.2": + - patch_file: "patches/1.2.2-0001-fix-install.patch" + patch_description: "fix install for windows shared build" + patch_type: "portability" diff --git a/recipes/clipper2/all/conanfile.py b/recipes/clipper2/all/conanfile.py new file mode 100644 index 0000000000000..c01db389a4cf8 --- /dev/null +++ b/recipes/clipper2/all/conanfile.py @@ -0,0 +1,124 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import get, copy, rmdir, export_conandata_patches, apply_conandata_patches, 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 + +required_conan_version = ">=1.53.0" + +class Clipper2Conan(ConanFile): + name = "clipper2" + description = " A Polygon Clipping and Offsetting library in C++" + license = "BSL-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/AngusJohnson/Clipper2" + topics = ("geometry", "polygon", "clipping") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "usingz": ["ON", "OFF", "ONLY"], + "with_max_precision": ["ANY"], + "with_hi_precision": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "usingz": "ON", + "with_max_precision": 8, + "with_hi_precision": False, + } + + @property + def _min_cppstd(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "8", + "clang": "7", + "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 + if Version(self.version) < "1.2.4": + del self.options.with_max_precision + if Version(self.version) < "1.4.0": + del self.options.with_hi_precision + + 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) + 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 = Version(self.version) >= "1.2.3") + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + tc.variables["CLIPPER2_UTILS"] = False + tc.variables["CLIPPER2_EXAMPLES"] = False + tc.variables["CLIPPER2_TESTS"] = False + tc.variables["CLIPPER2_USINGZ"] = self.options.usingz + if "with_hi_precision" in self.options: + tc.variables["CLIPPER2_HI_PRECISION"] = self.options.with_hi_precision + if "with_max_precision" in self.options: + tc.variables["CLIPPER2_MAX_PRECISION"] = self.options.with_max_precision + tc.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + replace_in_file(self, os.path.join(self.source_folder, "CPP", "CMakeLists.txt"), "-Werror", "") + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, "CPP")) + 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, "lib", "cmake")) + + def package_info(self): + if self.options.usingz != "ONLY": + self.cpp_info.components["clipper2"].set_property("cmake_target_name", "Clipper2::clipper2") + self.cpp_info.components["clipper2"].set_property("pkg_config_name", "Clipper2") + self.cpp_info.components["clipper2"].libs = ["Clipper2"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["clipper2"].system_libs.append("m") + + if self.options.usingz != "OFF": + self.cpp_info.components["clipper2z"].set_property("cmake_target_name", "Clipper2::clipper2z") + self.cpp_info.components["clipper2z"].set_property("pkg_config_name", "Clipper2Z") + self.cpp_info.components["clipper2z"].libs = ["Clipper2Z"] + self.cpp_info.components["clipper2z"].defines.append("USINGZ") + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["clipper2z"].system_libs.append("m") diff --git a/recipes/clipper2/all/patches/1.2.2-0001-fix-install.patch b/recipes/clipper2/all/patches/1.2.2-0001-fix-install.patch new file mode 100644 index 0000000000000..4f4848313e076 --- /dev/null +++ b/recipes/clipper2/all/patches/1.2.2-0001-fix-install.patch @@ -0,0 +1,14 @@ +diff --git a/CPP/CMakeLists.txt b/CPP/CMakeLists.txt +index 58b41c2..cd2f96b 100644 +--- a/CPP/CMakeLists.txt ++++ b/CPP/CMakeLists.txt +@@ -245,6 +245,9 @@ endforeach() + + install(TARGETS ${CLIPPER2_LIBS} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/clipper2 ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + ) + install(FILES ${CLIPPER2_PCFILES} DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) + diff --git a/recipes/clipper2/all/patches/1.2.4-0001-remove-macos-suffix.patch b/recipes/clipper2/all/patches/1.2.4-0001-remove-macos-suffix.patch new file mode 100644 index 0000000000000..bdf115e1c468c --- /dev/null +++ b/recipes/clipper2/all/patches/1.2.4-0001-remove-macos-suffix.patch @@ -0,0 +1,13 @@ +diff --git a/CPP/CMakeLists.txt b/CPP/CMakeLists.txt +index 817cf01..cd17e84 100644 +--- a/CPP/CMakeLists.txt ++++ b/CPP/CMakeLists.txt +@@ -19,7 +19,7 @@ set(CLIPPER2_USINGZ "ON" CACHE STRING "Build Clipper2Z, either \"ON\" or \"OFF\" + set(CLIPPER2_MAX_PRECISION 8 CACHE STRING "Maximum precision allowed for double to int64 scaling") + + if (APPLE) +- set(CMAKE_SHARED_LIBRARY_SUFFIX ".so") ++# set(CMAKE_SHARED_LIBRARY_SUFFIX ".so") + endif () + + include(GNUInstallDirs) diff --git a/recipes/clipper2/all/test_package/CMakeLists.txt b/recipes/clipper2/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..6b34466183083 --- /dev/null +++ b/recipes/clipper2/all/test_package/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(clipper2 REQUIRED CONFIG) + +if(TARGET Clipper2::clipper2) + add_executable(${PROJECT_NAME} test_package.cpp) + target_link_libraries(${PROJECT_NAME} PRIVATE Clipper2::clipper2) + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +endif() + +if(TARGET Clipper2::clipper2z) + add_executable(${PROJECT_NAME}_z test_package_z.cpp) + target_link_libraries(${PROJECT_NAME}_z PRIVATE Clipper2::clipper2z) + target_compile_features(${PROJECT_NAME}_z PRIVATE cxx_std_17) +endif() + diff --git a/recipes/clipper2/all/test_package/conanfile.py b/recipes/clipper2/all/test_package/conanfile.py new file mode 100644 index 0000000000000..87531c64cc6a2 --- /dev/null +++ b/recipes/clipper2/all/test_package/conanfile.py @@ -0,0 +1,35 @@ +from conan import ConanFile, conan_version +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): + if conan_version.major >= 2: + usingz = self.dependencies["clipper2"].options.usingz + else: + usingz = self.options["clipper2"].usingz + + if usingz != "ONLY": + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + self.run(bin_path, env="conanrun") + if usingz != "OFF": + bin_path = os.path.join(self.cpp.build.bindir, "test_package_z") + self.run(bin_path, env="conanrun") diff --git a/recipes/clipper2/all/test_package/test_package.cpp b/recipes/clipper2/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..f8b893dade24d --- /dev/null +++ b/recipes/clipper2/all/test_package/test_package.cpp @@ -0,0 +1,45 @@ +#include +#include + +#include "clipper2/clipper.h" + +using namespace Clipper2Lib; + +void DoSimpleTest(bool show_solution_coords = false); +Path64 MakeRandomPoly(int width, int height, unsigned vertCnt); + +int main() +{ + DoSimpleTest(); +} + +inline Path64 MakeStar(const Point64& center, int radius, int points) +{ + if (!(points % 2)) --points; + if (points < 5) points = 5; + Path64 tmp = Ellipse(center, radius, radius, points); + Path64 result; + result.reserve(points); + result.push_back(tmp[0]); + for (int i = points - 1, j = i / 2; j;) + { + result.push_back(tmp[j--]); + result.push_back(tmp[i--]); + } + return result; +} + +void DoSimpleTest(bool show_solution_coords) +{ + Paths64 tmp, solution; + FillRule fr = FillRule::NonZero; + + Paths64 subject, clip; + subject.push_back(MakeStar(Point64(225, 225), 220, 9)); + clip.push_back(Ellipse(Point64(225,225), 150, 150)); + + //Intersect both shapes and then 'inflate' result -10 (ie deflate) + solution = Intersect(subject, clip, fr); + solution = InflatePaths(solution, -10, JoinType::Round, EndType::Polygon); +} + diff --git a/recipes/clipper2/all/test_package/test_package_z.cpp b/recipes/clipper2/all/test_package/test_package_z.cpp new file mode 100644 index 0000000000000..3713bf124619a --- /dev/null +++ b/recipes/clipper2/all/test_package/test_package_z.cpp @@ -0,0 +1,46 @@ +#include +#include "clipper2/clipper.h" + +using namespace std; +using namespace Clipper2Lib; + +void TestingZ_Double(); + +// use the Z callback to flag intersections by setting z = 1; + +class MyClass { +public: + + // Point64 callback - see TestingZ_Int64() + void myZCB(const Point64& e1bot, const Point64& e1top, + const Point64& e2bot, const Point64& e2top, Point64& pt) + { + pt.z = 1; + } + + // PointD callback - see TestingZ_Double() + void myZCBD(const PointD& e1bot, const PointD& e1top, + const PointD& e2bot, const PointD& e2top, PointD& pt) + { + pt.z = 1; + } +}; + +int main(int argc, char* argv[]) +{ + TestingZ_Double(); +} +void TestingZ_Double() +{ + PathsD subject, solution; + MyClass mc; + ClipperD c; + + subject.push_back(MakePathD({ 100, 50, 10, 79, 65, 2, 65, 98, 10, 21 })); + c.AddSubject(subject); + c.SetZCallback( + std::bind(&MyClass::myZCBD, mc, std::placeholders::_1, + std::placeholders::_2, std::placeholders::_3, + std::placeholders::_4, std::placeholders::_5)); + c.Execute(ClipType::Union, FillRule::NonZero, solution); +} diff --git a/recipes/clipper2/config.yml b/recipes/clipper2/config.yml new file mode 100644 index 0000000000000..4c35529540bb1 --- /dev/null +++ b/recipes/clipper2/config.yml @@ -0,0 +1,11 @@ +versions: + "1.4.0": + folder: all + "1.3.0": + folder: all + "1.2.4": + folder: all + "1.2.3": + folder: all + "1.2.2": + folder: all diff --git a/recipes/clove-unit/all/conandata.yml b/recipes/clove-unit/all/conandata.yml index 2c3695d23b94a..132c2a02e4558 100644 --- a/recipes/clove-unit/all/conandata.yml +++ b/recipes/clove-unit/all/conandata.yml @@ -1,10 +1,25 @@ sources: + "2.4.6": + url: "https://github.com/fdefelici/clove-unit/archive/v2.4.6.tar.gz" + sha256: "ecdbd6c4b11bc1eb6e0e5022104f053cb5d1f1ef95e04499a6e29e21289e5063" + "2.4.5": + url: "https://github.com/fdefelici/clove-unit/archive/v2.4.5.tar.gz" + sha256: "e4db72612adf00d7c7c9512cb9990768f5f3e62a72039929b78ba17d5a6f4308" + "2.4.4": + url: "https://github.com/fdefelici/clove-unit/archive/v2.4.4.tar.gz" + sha256: "25e611e1d4286c73d9cce7bbc99f83e00629551602351fec1edcbb669243e047" + "2.4.1": + url: "https://github.com/fdefelici/clove-unit/archive/v2.4.1.tar.gz" + sha256: "ede833e361b5b62052bd0976386307d1d962c7ab20a0e24eb6e970d409c726fe" + "2.4.0": + url: "https://github.com/fdefelici/clove-unit/archive/v2.4.0.tar.gz" + sha256: "d5005854d7b3b6ed1b470c2df353fadd80a2ed5a80bb85efc074b9d55315e78d" "2.3.0": url: "https://github.com/fdefelici/clove-unit/archive/v2.3.0.tar.gz" - sha256: ca94d33643bbe1ff2205f7e6405f3e9c5a95d2f3a076a126814e64b46e3cce8e + sha256: "ca94d33643bbe1ff2205f7e6405f3e9c5a95d2f3a076a126814e64b46e3cce8e" "2.2.4": url: "https://github.com/fdefelici/clove-unit/archive/v2.2.4.tar.gz" - sha256: 0341f13b3e897952f1643eea2ca70cf014c4a086cf83375270980ac05f9d51aa + sha256: "0341f13b3e897952f1643eea2ca70cf014c4a086cf83375270980ac05f9d51aa" "2.2.3": url: "https://github.com/fdefelici/clove-unit/archive/v2.2.3.tar.gz" - sha256: 65f80d600ddec35f7ba70370f10e2df268d68c589e5cddbdcad815b6dbb61dfd + sha256: "65f80d600ddec35f7ba70370f10e2df268d68c589e5cddbdcad815b6dbb61dfd" diff --git a/recipes/clove-unit/all/conanfile.py b/recipes/clove-unit/all/conanfile.py index c29b4d879af19..3e530c191a833 100644 --- a/recipes/clove-unit/all/conanfile.py +++ b/recipes/clove-unit/all/conanfile.py @@ -1,30 +1,38 @@ -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 CloveUnitConan(ConanFile): name = "clove-unit" description = "Single-header Unit Testing framework for C (interoperable with C++) with test autodiscovery feature" - topics = ("clove-unit", "unit-testing", "testing", "unit testing", "test") + license = "MIT" homepage = "https://github.com/fdefelici/clove-unit" url = "https://github.com/conan-io/conan-center-index" - license = "MIT" + topics = ("unit-testing", "testing", "unit testing", "test", "header-only") no_copy_source = True + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + def layout(self): + basic_layout(self, src_folder="src") - @property - def _source_subfolder(self): - return "source_subfolder" + 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(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - self.copy(pattern="clove-unit.h", dst="include", src=self._source_subfolder) + 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, "clove-unit.h", src=self.source_folder, dst=os.path.join(self.package_folder, "include")) def package_info(self): - self.cpp_info.names["cmake_find_package"] = "CloveUnit" - self.cpp_info.names["cmake_find_package_multi"] = "CloveUnit" + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/clove-unit/all/test_package/CMakeLists.txt b/recipes/clove-unit/all/test_package/CMakeLists.txt index fde8b9c97172b..6b669b3ad30d6 100644 --- a/recipes/clove-unit/all/test_package/CMakeLists.txt +++ b/recipes/clove-unit/all/test_package/CMakeLists.txt @@ -1,10 +1,8 @@ -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) - -find_package(CloveUnit CONFIG REQUIRED) +find_package(clove-unit CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} CloveUnit::CloveUnit) +target_link_libraries(${PROJECT_NAME} PRIVATE clove-unit::clove-unit) + diff --git a/recipes/clove-unit/all/test_package/conanfile.py b/recipes/clove-unit/all/test_package/conanfile.py index 1bf1c7e26255d..fb5d7dc241b5a 100644 --- a/recipes/clove-unit/all/test_package/conanfile.py +++ b/recipes/clove-unit/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 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/clove-unit/all/test_v1_package/CMakeLists.txt b/recipes/clove-unit/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..5e4401df6124d --- /dev/null +++ b/recipes/clove-unit/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.15) +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/clove-unit/all/test_v1_package/conanfile.py b/recipes/clove-unit/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..7e264aad8e8ec --- /dev/null +++ b/recipes/clove-unit/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +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/clove-unit/config.yml b/recipes/clove-unit/config.yml index 3c940ec906d09..e49f2ea78422d 100644 --- a/recipes/clove-unit/config.yml +++ b/recipes/clove-unit/config.yml @@ -1,4 +1,14 @@ versions: + "2.4.6": + folder: "all" + "2.4.5": + folder: "all" + "2.4.4": + folder: "all" + "2.4.1": + folder: "all" + "2.4.0": + folder: "all" "2.3.0": folder: "all" "2.2.4": diff --git a/recipes/cmake/3.x.x/conandata.yml b/recipes/cmake/3.x.x/conandata.yml index 6d9ebddf32aad..da33ab402ca26 100644 --- a/recipes/cmake/3.x.x/conandata.yml +++ b/recipes/cmake/3.x.x/conandata.yml @@ -17,6 +17,9 @@ sources: "3.24.3": url: "https://github.com/Kitware/CMake/releases/download/v3.24.3/cmake-3.24.3.tar.gz" sha256: "b53aa10fa82bff84ccdb59065927b72d3bee49f4d86261249fc0984b3b367291" - "3.25.0": - url: "https://github.com/Kitware/CMake/releases/download/v3.25.0/cmake-3.25.0.tar.gz" - sha256: "306463f541555da0942e6f5a0736560f70c487178b9d94a5ae7f34d0538cdd48" + "3.25.2": + url: "https://github.com/Kitware/CMake/releases/download/v3.25.2/cmake-3.25.2.tar.gz" + sha256: "c026f22cb931dd532f648f087d587f07a1843c6e66a3dfca4fb0ea21944ed33c" + "3.26.4": + url: "https://github.com/Kitware/CMake/releases/download/v3.26.4/cmake-3.26.4.tar.gz" + sha256: "313b6880c291bd4fe31c0aa51d6e62659282a521e695f30d5cc0d25abbd5c208" diff --git a/recipes/cmake/3.x.x/conanfile.py b/recipes/cmake/3.x.x/conanfile.py index e0d41c4a94794..042191e304bd0 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 conan.errors import ConanInvalidConfiguration, ConanException +from conan.tools.microsoft import is_msvc +from conan.errors import ConanInvalidConfiguration + +import os +import json -required_conan_version = ">=1.49.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,115 +32,135 @@ class CMakeConan(ConanFile): "bootstrap": False, } - _source_subfolder = "source_subfolder" - _cmake = None - 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.1s") - - def validate(self): - if self.settings.os == "Macos" and self.settings.arch == "x86": - raise ConanInvalidConfiguration("CMake does not support x86 for macOS") + if self.options.get_safe("with_openssl", default=False): + self.requires("openssl/[>=1.1 <4]") + 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) - rmdir(self, os.path.join(self._source_subfolder, "Tests", "RunCMake", "find_package")) + 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"}') + bootstrap_cmake_options.append(f'-DOPENSSL_ROOT_DIR={openssl.package_path}') + 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): - module_version = "{}.{}".format(Version(self.version).major, Version(self.version).minor) + 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", f"cmake-{module_version}", "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 0b0c4858e1c60..df50a01c37d6f 100644 --- a/recipes/cmake/3.x.x/test_package/conanfile.py +++ b/recipes/cmake/3.x.x/test_package/conanfile.py @@ -1,23 +1,24 @@ -import os from six import StringIO from conan import ConanFile -from conan.tools.build import can_run +import re class TestPackageConan(ConanFile): - settings = "os", "arch" - generators = "VirtualRunEnv" + settings = "os", "arch", "compiler", "build_type" + generators = "VirtualBuildEnv" + test_type = "explicit" - def requirements(self): - self.requires(self.tested_reference_str) + def build_requirements(self): + self.tool_requires(self.tested_reference_str) def test(self): - if can_run(self): - output = StringIO() - self.run("cmake --version", env="conanrun", output=output) - 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 index efb629f7d5725..df9415b7cf880 100644 --- a/recipes/cmake/3.x.x/test_v1_package/conanfile.py +++ b/recipes/cmake/3.x.x/test_v1_package/conanfile.py @@ -1,23 +1,23 @@ import os from six import StringIO from conan import ConanFile -from conan.tools.build import can_run +import re class TestPackageConan(ConanFile): - settings = "os", "arch" + settings = "os", "arch", "compiler", "build_type" test_type = "explicit" - def requirements(self): - self.requires(self.tested_reference_str) + def build_requirements(self): + self.tool_requires(self.tested_reference_str) def test(self): - if can_run(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() + 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/binary/conandata.yml b/recipes/cmake/binary/conandata.yml new file mode 100644 index 0000000000000..76d561731c707 --- /dev/null +++ b/recipes/cmake/binary/conandata.yml @@ -0,0 +1,518 @@ +sources: + "3.31.0": + Linux: + armv8: + url: "https://cmake.org/files/v3.31/cmake-3.31.0-linux-aarch64.tar.gz" + sha256: "e0f74862734c2d14ef8ac5a71941691531db0bbebee0a9c20a8e96e8a97390f9" + x86_64: + url: "https://cmake.org/files/v3.31/cmake-3.31.0-linux-x86_64.tar.gz" + sha256: "0fcb338b4515044f9ac77543550ac92c314c58f6f95aafcac5cd36aa75db6924" + Macos: + universal: + url: "https://cmake.org/files/v3.31/cmake-3.31.0-macos10.10-universal.tar.gz" + sha256: "58863bf65412e0fcaacd7dae2fcf0b5f33d78e46d0b84b547c946c59f4d19960" + Windows: + armv8: + url: "https://cmake.org/files/v3.31/cmake-3.31.0-windows-arm64.zip" + sha256: "3bae17886ad47909aadd89e41932a109a8b6a708faef6f28de2d4554c7c08276" + x86_64: + url: "https://cmake.org/files/v3.31/cmake-3.31.0-windows-x86_64.zip" + sha256: "f4b499f71cf44115a1d711d4867da3c6bd2f3f4d7121c213ace979757640385c" + "3.30.5": + Linux: + armv8: + url: "https://cmake.org/files/v3.30/cmake-3.30.5-linux-aarch64.tar.gz" + sha256: "da7dead2c92c1747b40d506d7f7d68590f5bab175316d2e7af73e48a2e417e48" + x86_64: + url: "https://cmake.org/files/v3.30/cmake-3.30.5-linux-x86_64.tar.gz" + sha256: "f747d9b23e1a252a8beafb4ed2bc2ddf78cff7f04a8e4de19f4ff88e9b51dc9d" + Macos: + universal: + url: "https://cmake.org/files/v3.30/cmake-3.30.5-macos10.10-universal.tar.gz" + sha256: "db21c9d92e544b3a47820627fe89bde8191e6bfb49b9e43d726cec5a5ef96ca7" + Windows: + armv8: + url: "https://cmake.org/files/v3.30/cmake-3.30.5-windows-arm64.zip" + sha256: "b5fa431bd569b591717a9a0f77c0ab56b072ef8603f924401227c178ac7072d9" + x86_64: + url: "https://cmake.org/files/v3.30/cmake-3.30.5-windows-x86_64.zip" + sha256: "5ab6e1faf20256ee4f04886597e8b6c3b1bd1297b58a68a58511af013710004b" + "3.30.1": + Linux: + armv8: + url: "https://cmake.org/files/v3.30/cmake-3.30.1-linux-aarch64.tar.gz" + sha256: "ad234996f8750f11d7bd0d17b03f55c434816adf1f1671aab9e8bab21a43286a" + x86_64: + url: "https://cmake.org/files/v3.30/cmake-3.30.1-linux-x86_64.tar.gz" + sha256: "ac31f077ef3378641fa25a3cb980d21b2f083982d3149a8f2eb9154f2b53696b" + Macos: + universal: + url: "https://cmake.org/files/v3.30/cmake-3.30.1-macos10.10-universal.tar.gz" + sha256: "4c1beda2bb2ab830f22fdb29aa6cc844f9b0eb32cca0fb4f01b407688944d181" + Windows: + armv8: + url: "https://cmake.org/files/v3.30/cmake-3.30.1-windows-arm64.zip" + sha256: "02b433f70aa549449be2d53046d0179590bf3b6290d9fda3fbbb23f96a4f2802" + x86_64: + url: "https://cmake.org/files/v3.30/cmake-3.30.1-windows-x86_64.zip" + sha256: "cf7788ff9d92812da194847d4ec874fc576f34079987d0f20c96cd09e2a16220" + "3.30.0": + Linux: + armv8: + url: "https://cmake.org/files/v3.30/cmake-3.30.0-linux-aarch64.tar.gz" + sha256: "3db7f12dadc91be9b30f0e5a71038c51d7f5b7cc03e32625621a052e9996bef0" + x86_64: + url: "https://cmake.org/files/v3.30/cmake-3.30.0-linux-x86_64.tar.gz" + sha256: "09846a3858583f38189b59177586adf125a08c15f3cddcaf7d7d7081ac86969f" + Macos: + universal: + url: "https://cmake.org/files/v3.30/cmake-3.30.0-macos10.10-universal.tar.gz" + sha256: "54f237212362efa3f192508eeb25d98f2150779ed45c46a77fe356597c3d2749" + Windows: + armv8: + url: "https://cmake.org/files/v3.30/cmake-3.30.0-windows-arm64.zip" + sha256: "cb8fb65a8f523daa0ce6c531407ae10fcab8d0eefe18a6ef9fb718c54307d6e3" + x86_64: + url: "https://cmake.org/files/v3.30/cmake-3.30.0-windows-x86_64.zip" + sha256: "f8d2da0eaf3bab9cf065e97bd6d8e1819886f8671d3d4c7bb93cb774123fa448" + "3.29.7": + Linux: + armv8: + url: "https://cmake.org/files/v3.29/cmake-3.29.7-linux-aarch64.tar.gz" + sha256: "ee8cf1ceaef011578ec070c13471c4b26e87f065315155e11177063b0743da68" + x86_64: + url: "https://cmake.org/files/v3.29/cmake-3.29.7-linux-x86_64.tar.gz" + sha256: "fb0837495a3a1d044f5101d0a76d294c825ff85c10a32c42d7167604278344f7" + Macos: + universal: + url: "https://cmake.org/files/v3.29/cmake-3.29.7-macos10.10-universal.tar.gz" + sha256: "3a148e37bf57c419e40817d6208916a33eff8c1757b0947d9991eca902916559" + Windows: + armv8: + url: "https://cmake.org/files/v3.29/cmake-3.29.7-windows-arm64.zip" + sha256: "ae87f2ff173deeb3ae8891d31c8f92ebabab8a4c29a074c5c5d39b38dde706d2" + x86_64: + url: "https://cmake.org/files/v3.29/cmake-3.29.7-windows-x86_64.zip" + sha256: "3d9580b54faa0651f4cb0bccdff222bd123366b35a8b1051ee33a64915384ee4" + "3.29.6": + Linux: + armv8: + url: "https://cmake.org/files/v3.29/cmake-3.29.6-linux-aarch64.tar.gz" + sha256: "4d6b0a551db9da7a034a09372f716cf2094413d7fd8a787051854154b0b3b343" + x86_64: + url: "https://cmake.org/files/v3.29/cmake-3.29.6-linux-x86_64.tar.gz" + sha256: "28fef61e64840b784da6db35218fd3ae179ff8bf0be1c8a9d075d6185a0e4fdc" + Macos: + universal: + url: "https://cmake.org/files/v3.29/cmake-3.29.6-macos10.10-universal.tar.gz" + sha256: "a65f9e66c63bb79f3b6f00e4b67367b6f6c40030ee41cf06580818a74a84b3e9" + Windows: + armv8: + url: "https://cmake.org/files/v3.29/cmake-3.29.6-windows-arm64.zip" + sha256: "8f0df498d8b1a076fc9305dde5a06427262a0476e89d4c670a49147b0bc30761" + x86_64: + url: "https://cmake.org/files/v3.29/cmake-3.29.6-windows-x86_64.zip" + sha256: "5c648eac06c33477e510bae14ce1f969e9abb38992b71f245633b182fccb474d" + "3.29.5": + Linux: + armv8: + url: "https://cmake.org/files/v3.29/cmake-3.29.5-linux-aarch64.tar.gz" + sha256: "6eb655ee89c50611f2370c5a3293bd2fe1920b73dff50b71fb3357d56a9d28d8" + x86_64: + url: "https://cmake.org/files/v3.29/cmake-3.29.5-linux-x86_64.tar.gz" + sha256: "92629f95e15e7c2e88726c57a984ffdc5cf248e354f7ab791bc86d2ad513903e" + Macos: + universal: + url: "https://cmake.org/files/v3.29/cmake-3.29.5-macos10.10-universal.tar.gz" + sha256: "a110d173ab839854fc0b19b9f29f213c1112106e2858c1a1fe7973d4bb13a536" + Windows: + armv8: + url: "https://cmake.org/files/v3.29/cmake-3.29.5-windows-arm64.zip" + sha256: "9c67d16560125ebf1278ef1b3072914a60bff780522b28c0096f364f775a8e55" + x86_64: + url: "https://cmake.org/files/v3.29/cmake-3.29.5-windows-x86_64.zip" + sha256: "f85db8361cb7eb11ceb6b2f1ee42bec7234bb8d9e487ea78c00de64771768d92" + "3.29.4": + Linux: + armv8: + url: "https://cmake.org/files/v3.29/cmake-3.29.4-linux-aarch64.tar.gz" + sha256: "9210619e7907b14858178743d5b7ba70ce846d98a6a65bcdbd83c08b932ba6a5" + x86_64: + url: "https://cmake.org/files/v3.29/cmake-3.29.4-linux-x86_64.tar.gz" + sha256: "64e5473169dd43055fbf2c138cae6e5ec10f30a0606d24f12078e68466320cf4" + Macos: + universal: + url: "https://cmake.org/files/v3.29/cmake-3.29.4-macos10.10-universal.tar.gz" + sha256: "44a59c584122676463bf5bdd2c7dee2ac02944e065a71cc30c57541a20d3465c" + Windows: + armv8: + url: "https://cmake.org/files/v3.29/cmake-3.29.4-windows-arm64.zip" + sha256: "16ce291dd34189a60d7add96b4148adfdbb46b6b2478086cb43abe2e5ff34ad3" + x86_64: + url: "https://cmake.org/files/v3.29/cmake-3.29.4-windows-x86_64.zip" + sha256: "1c8bfbc5537553edccded62f8f03475a161280c1b64f54c887824c6eb4e773ff" + "3.29.3": + Linux: + armv8: + url: "https://cmake.org/files/v3.29/cmake-3.29.3-linux-aarch64.tar.gz" + sha256: "ae61d262b2771ba9cbdf1eeac288e64d6510d2f0417d2d92e27807d269ac90fa" + x86_64: + url: "https://cmake.org/files/v3.29/cmake-3.29.3-linux-x86_64.tar.gz" + sha256: "90b543a30220401db0e08347af067545be158ce89ffb09b7df1516cda8617329" + Macos: + universal: + url: "https://cmake.org/files/v3.29/cmake-3.29.3-macos10.10-universal.tar.gz" + sha256: "1a7ecdd1dc8baaede55d1011f60b5871ff908fa640f7e96ab5520f38ef97bba0" + Windows: + armv8: + url: "https://cmake.org/files/v3.29/cmake-3.29.3-windows-arm64.zip" + sha256: "8d7d65e46a45bdbf8b4416d29ef6ad9a80f0b26afb5d6afab358e34b1b30a556" + x86_64: + url: "https://cmake.org/files/v3.29/cmake-3.29.3-windows-x86_64.zip" + sha256: "6423ed300e6aa1b15c4aeae9a7399157f53fc84a2fb7242ca64c8dfd83e5f8a6" + "3.29.2": + Linux: + armv8: + url: "https://cmake.org/files/v3.29/cmake-3.29.2-linux-aarch64.tar.gz" + sha256: "ca883c6dc3ce9eebd833804f0f940ecbbff603520cfd169ee58916dbbc23c2b8" + x86_64: + url: "https://cmake.org/files/v3.29/cmake-3.29.2-linux-x86_64.tar.gz" + sha256: "0416c70cf88e8f92efcbfe292e181bc09ead7d70e29ab37b697522c01121eab5" + Macos: + universal: + url: "https://cmake.org/files/v3.29/cmake-3.29.2-macos10.10-universal.tar.gz" + sha256: "0b542389345b28d2f73122b72ec9b899947e643fd86cf8f42bae2718884d2ad3" + Windows: + armv8: + url: "https://cmake.org/files/v3.29/cmake-3.29.2-windows-arm64.zip" + sha256: "5b16a0db4966c04582c40131038de49d5b0161fcd950dc9e955753dfab858882" + x86_64: + url: "https://cmake.org/files/v3.29/cmake-3.29.2-windows-x86_64.zip" + sha256: "86b5de51f60a0e9d62be4d8ca76ea467d154083d356fcc9af1409606be341cd8" + "3.29.0": + Linux: + armv8: + url: "https://cmake.org/files/v3.29/cmake-3.29.0-linux-aarch64.tar.gz" + sha256: "2cb768a14b28a4478bb931d917dbc419305b82433bdecc046df98e7c336225fa" + x86_64: + url: "https://cmake.org/files/v3.29/cmake-3.29.0-linux-x86_64.tar.gz" + sha256: "f06258f52c5649752dfb10c4c2e1d8167c760c8826f078c6f5c332fa9d976bf8" + Macos: + universal: + url: "https://cmake.org/files/v3.29/cmake-3.29.0-macos10.10-universal.tar.gz" + sha256: "868f356c56a3c35e8f39f0d4fb7e579cb2eb0ac06c26520d6a203d91bdc7ad09" + Windows: + armv8: + url: "https://cmake.org/files/v3.29/cmake-3.29.0-windows-arm64.zip" + sha256: "e5bea5c45b61f105429fc664364c5280acd40770cc74235b79e7422f608a9849" + x86_64: + url: "https://cmake.org/files/v3.29/cmake-3.29.0-windows-x86_64.zip" + sha256: "9ab28eba1ab7911a0e57ab274f5990a283fffa1d22eb711792d5562e5869f9ef" + "3.28.6": + Linux: + armv8: + url: "https://cmake.org/files/v3.28/cmake-3.28.6-linux-aarch64.tar.gz" + sha256: "7909cc2128ce9442c63ce674a0bfb0e4f4ce04cef667d887e15ad5670d594ba7" + x86_64: + url: "https://cmake.org/files/v3.28/cmake-3.28.6-linux-x86_64.tar.gz" + sha256: "931e3c0d546ee03ca72bb147ccd9b49e3b6252f765f66bf21b9d165519940458" + Macos: + universal: + url: "https://cmake.org/files/v3.28/cmake-3.28.6-macos10.10-universal.tar.gz" + sha256: "cbda8e719b3239e304b339cdd90e946c09dac5ad2d57c93bf1b1d3914685d9a7" + Windows: + armv8: + url: "https://cmake.org/files/v3.28/cmake-3.28.6-windows-arm64.zip" + sha256: "63e4ebd2dadb5ad63faaf4ed38db40d3fec92d1b050d2a4e69011ea3ee699d29" + x86_64: + url: "https://cmake.org/files/v3.28/cmake-3.28.6-windows-x86_64.zip" + sha256: "a8f2e684ead94a64fd3517a38857a5b3f7f8d68d15c49ca1143d18797eaf9cac" + "3.28.5": + Linux: + armv8: + url: "https://cmake.org/files/v3.28/cmake-3.28.5-linux-aarch64.tar.gz" + sha256: "5b4a86b456058266bd4caa9c59187fab4b1ace823acdd9741d2d24fed5a4f50b" + x86_64: + url: "https://cmake.org/files/v3.28/cmake-3.28.5-linux-x86_64.tar.gz" + sha256: "c5460b8a0ecfea7c0ac99d78427e19409ea9133e29a604e1f8c0e6806a8f6934" + Macos: + universal: + url: "https://cmake.org/files/v3.28/cmake-3.28.5-macos10.10-universal.tar.gz" + sha256: "62956bf3c26b396cee20dddf2914d63d882cff4245e13c29c72f7841c03d56e4" + Windows: + armv8: + url: "https://cmake.org/files/v3.28/cmake-3.28.5-windows-arm64.zip" + sha256: "47056df28bc543c528f85f15c46180dbed750e5ebd0180f936a2e3ee22ddea56" + x86_64: + url: "https://cmake.org/files/v3.28/cmake-3.28.5-windows-x86_64.zip" + sha256: "0fbea146a782e4b82a799384a2109e46ce27f3ad70c30d3f8c9ef751e1e28040" + "3.28.1": + Linux: + armv8: + url: "https://cmake.org/files/v3.28/cmake-3.28.1-linux-aarch64.tar.gz" + sha256: "e84d88e46ed8c85fbe259bcd4ca07df7a928df87e84013e0da34d91b01a25d71" + x86_64: + url: "https://cmake.org/files/v3.28/cmake-3.28.1-linux-x86_64.tar.gz" + sha256: "f76398c24362ad87bad1a3d6f1e8f4377632b5b1c360c4ba1fd7cd205fd9d8d4" + Macos: + universal: + url: "https://cmake.org/files/v3.28/cmake-3.28.1-macos10.10-universal.tar.gz" + sha256: "f2d296294921b209d9c7edbc12ce175e00644fcabba362b6a24c32b0a4624a9a" + Windows: + armv8: + url: "https://cmake.org/files/v3.28/cmake-3.28.1-windows-arm64.zip" + sha256: "a839b8d32c11b24f078142b5b8c3361a955ebc65788f0f0353b2121fe2f74e49" + x86_64: + url: "https://cmake.org/files/v3.28/cmake-3.28.1-windows-x86_64.zip" + sha256: "671332249bc7cc7424523d6c2b5edd3e3de90a43b8b82e8782f42da4fe4c562d" + "3.27.9": + Linux: + armv8: + url: "https://cmake.org/files/v3.27/cmake-3.27.9-linux-aarch64.tar.gz" + sha256: "11bf3d30697df465cdf43664a9473a586f010c528376a966fd310a3a22082461" + x86_64: + url: "https://cmake.org/files/v3.27/cmake-3.27.9-linux-x86_64.tar.gz" + sha256: "72b01478eeb312bf1a0136208957784fe55a7b587f8d9f9142a7fc9b0b9e9a28" + Macos: + universal: + url: "https://cmake.org/files/v3.27/cmake-3.27.9-macos10.10-universal.tar.gz" + sha256: "2ced09b99b265d18c5e215984e5898b7e3a0cc7a1293c3f3b45e4bec87a46814" + Windows: + armv8: + url: "https://cmake.org/files/v3.27/cmake-3.27.9-windows-arm64.zip" + sha256: "bca795134956264ede142f79aa513476985f4f410f6501a727d602760e9212dd" + x86_64: + url: "https://cmake.org/files/v3.27/cmake-3.27.9-windows-x86_64.zip" + sha256: "c14e8b5d1c7be0baf0e7936ce8b5a39c5ee3450b14d7e3b32435083eddd9aff7" + "3.27.7": + Linux: + armv8: + url: "https://cmake.org/files/v3.27/cmake-3.27.7-linux-aarch64.tar.gz" + sha256: "f40ec1b7d41e94efd6c79cf0b7fc45ed6068543af0fea47b0c9fbf2b1b1b3fbc" + x86_64: + url: "https://cmake.org/files/v3.27/cmake-3.27.7-linux-x86_64.tar.gz" + sha256: "a8c92ecb139bcc7a1f92a8108179bd1d021bdb158a5ee759cba6d60010b83ae9" + Macos: + universal: + url: "https://cmake.org/files/v3.27/cmake-3.27.7-macos10.10-universal.tar.gz" + sha256: "4a366d07fbe0be7e1efcf0dbd743d09a5dc6609da79035e4036b12296ec679cf" + Windows: + armv8: + url: "https://cmake.org/files/v3.27/cmake-3.27.7-windows-arm64.zip" + sha256: "d9b19fd6830510022156621042759af2374111dc4f431b58c8828a17a68633dc" + x86_64: + url: "https://cmake.org/files/v3.27/cmake-3.27.7-windows-x86_64.zip" + sha256: "5588e50030cda3e6fa96724444d8539916ac808d78d608cda6ae6ff7c4c4c9c8" + "3.27.6": + Linux: + armv8: + url: "https://cmake.org/files/v3.27/cmake-3.27.6-linux-aarch64.tar.gz" + sha256: "811e5040ad7f3fb4924a875373d2a1a174a01400233a81a638a989157438a5e3" + x86_64: + url: "https://cmake.org/files/v3.27/cmake-3.27.6-linux-x86_64.tar.gz" + sha256: "26373a283daa8490d772dc8a179450cd6d391cb2a9db8d4242fe09e361efc42e" + Macos: + universal: + url: "https://cmake.org/files/v3.27/cmake-3.27.6-macos10.10-universal.tar.gz" + sha256: "3977258c8d30f03f6506fdb12dac9b8570db7d5e54f541285ee540de433a9cff" + Windows: + armv8: + url: "https://cmake.org/files/v3.27/cmake-3.27.6-windows-arm64.zip" + sha256: "980b7e532d77bfb4e5814c76403242c503019f1c0699440220cf2d527c8ff350" + x86_64: + url: "https://cmake.org/files/v3.27/cmake-3.27.6-windows-x86_64.zip" + sha256: "f013a0cca091aa953f9a60a99292ec7a20ae3f9ceb05cb5c08ebe164097c526f" + "3.27.5": + Linux: + armv8: + url: "https://cmake.org/files/v3.27/cmake-3.27.5-linux-aarch64.tar.gz" + sha256: "2ffaf176d0f93c332abaffbf3ce82fc8c90e49e0fcee8dc16338bcfbb150ead7" + x86_64: + url: "https://cmake.org/files/v3.27/cmake-3.27.5-linux-x86_64.tar.gz" + sha256: "138c68addae825b16ed78d792dafef5e0960194833f48bd77e7e0429c6bc081c" + Macos: + universal: + url: "https://cmake.org/files/v3.27/cmake-3.27.5-macos10.10-universal.tar.gz" + sha256: "1f776640e6ad35b2b3fe2ab5e39cff363b2c3034ecb56e45597402b7bf010e47" + Windows: + armv8: + url: "https://cmake.org/files/v3.27/cmake-3.27.5-windows-arm64.zip" + sha256: "3fcc84d34e3213b0e4261295eaddfc645685ab366dc570421555e7f3d3080d3a" + x86_64: + url: "https://cmake.org/files/v3.27/cmake-3.27.5-windows-x86_64.zip" + sha256: "1e8e06c8ecf63d5f213019e1cd39ea41a6cf952db5f2c8e69b8e47f5bc302684" + "3.27.4": + Linux: + armv8: + url: "https://cmake.org/files/v3.27/cmake-3.27.4-linux-aarch64.tar.gz" + sha256: "45538d394bd4ef2a423fa78dff5cad16bcf437a4a6dc655e999177170632b039" + x86_64: + url: "https://cmake.org/files/v3.27/cmake-3.27.4-linux-x86_64.tar.gz" + sha256: "186c53121cf6ef4e48b51e88690e6ef84f268611064a42e5a2e829c3d6b2efde" + Macos: + universal: + url: "https://cmake.org/files/v3.27/cmake-3.27.4-macos10.10-universal.tar.gz" + sha256: "1fa092bad6daf9715c6d72ff766813fd3423427696042a74f2208a2b4704ac1c" + Windows: + armv8: + url: "https://cmake.org/files/v3.27/cmake-3.27.4-windows-arm64.zip" + sha256: "6c1df7ad85ed902ad615cd0c05bca0d3c9c3f67b3980ca9dd2e39b0821d50937" + x86_64: + url: "https://cmake.org/files/v3.27/cmake-3.27.4-windows-x86_64.zip" + sha256: "e5e060756444d0b2070328a8821c1ceb62bd6d267aae61bfff06f96c7ec943a6" + "3.26.6": + Linux: + armv8: + url: "https://cmake.org/files/v3.26/cmake-3.26.6-linux-aarch64.tar.gz" + sha256: "7b91a212b9e8ca38c1482ae40ff2d3e33e9d1c7b337b39f74bd4f34fd070bb1d" + x86_64: + url: "https://cmake.org/files/v3.26/cmake-3.26.6-linux-x86_64.tar.gz" + sha256: "2dd48ccd3e3d872ee4cc916f3f4e24812612421007e895f82bf9fc7e49831d62" + Macos: + universal: + url: "https://cmake.org/files/v3.26/cmake-3.26.6-macos10.10-universal.tar.gz" + sha256: "7a4500989351e1319bb86802ead09a13d2394636efeb5da6d78212e12f2cb961" + Windows: + armv8: + url: "https://cmake.org/files/v3.26/cmake-3.26.6-windows-arm64.zip" + sha256: "16cf13c42d3f4d63ad1d61d0333b6101c0e88f893ac39f435ef472b46f50e9b2" + x86_64: + url: "https://cmake.org/files/v3.26/cmake-3.26.6-windows-x86_64.zip" + sha256: "07b1c4cae3182ca1782a4d9775b5e5d164b475eb010e1dd98ce0c206c38fa73d" + "3.26.5": + Linux: + armv8: + url: "https://cmake.org/files/v3.26/cmake-3.26.5-linux-aarch64.tar.gz" + sha256: "737b990dcbc71f060b75193b2ddd5cf9d18c199e7a94c7169c80cf9314fe714a" + x86_64: + url: "https://cmake.org/files/v3.26/cmake-3.26.5-linux-x86_64.tar.gz" + sha256: "130941ae3ffe4a9ee3395514787115a273a8d1ce15cb971494bb45f7e58bb3c3" + Macos: + universal: + url: "https://cmake.org/files/v3.26/cmake-3.26.5-macos10.10-universal.tar.gz" + sha256: "30ff04703b5973414decde82860045afdf88e6da381aca6aeb2d625b05f53f2d" + Windows: + armv8: + url: "https://cmake.org/files/v3.26/cmake-3.26.5-windows-arm64.zip" + sha256: "1d5dd0e8a316290944e3c84bd6950df7ff650c5edde311af8903e88cb6cbc0ae" + x86_64: + url: "https://cmake.org/files/v3.26/cmake-3.26.5-windows-x86_64.zip" + sha256: "b95d6d8113593e001ae64df615358ea47185ad52a79d0c420332e052bd30c283" + "3.25.3": + Linux: + armv8: + url: "https://cmake.org/files/v3.25/cmake-3.25.3-linux-aarch64.tar.gz" + sha256: "cd6e853639f858569e22e6298f009eb24b4702c51c0d5bc1cb36c688f7ce246d" + x86_64: + url: "https://cmake.org/files/v3.25/cmake-3.25.3-linux-x86_64.tar.gz" + sha256: "d4d2ba83301b215857d3b6590cd4434a414fa151c5807693abe587bd6c03581e" + Macos: + universal: + url: "https://cmake.org/files/v3.25/cmake-3.25.3-macos10.10-universal.tar.gz" + sha256: "ea37a83cd329224c38a1938d2cf7b2656ad971dea9cf759238652746213661f8" + Windows: + armv8: + url: "https://cmake.org/files/v3.25/cmake-3.25.3-windows-arm64.zip" + sha256: "3498fea26257eebfbfc89ed17963f3d8d83c19362b90fb23517842de777a522a" + x86_64: + url: "https://cmake.org/files/v3.25/cmake-3.25.3-windows-x86_64.zip" + sha256: "d129425d569140b729210f3383c246dec19c4183f7d0afae1837044942da3b4b" + "3.24.4": + Linux: + armv8: + url: "https://cmake.org/files/v3.24/cmake-3.24.4-linux-aarch64.tar.gz" + sha256: "86f823f2636bf715af89da10e04daa476755a799d451baee66247846e95d7bee" + x86_64: + url: "https://cmake.org/files/v3.24/cmake-3.24.4-linux-x86_64.tar.gz" + sha256: "cac77d28fb8668c179ac02c283b058aeb846fe2133a57d40b503711281ed9f19" + Macos: + universal: + url: "https://cmake.org/files/v3.24/cmake-3.24.4-macos10.10-universal.tar.gz" + sha256: "3cda3995d6ea06a9d05dfaac633006754d6df5d80cd3d08bf4c284507a550496" + Windows: + armv8: + url: "https://cmake.org/files/v3.24/cmake-3.24.4-windows-arm64.zip" + sha256: "55e81f0c95b06a4435b708cdee7d5739e38cc29c909d3d3134c1a3117e09b965" + x86_64: + url: "https://cmake.org/files/v3.24/cmake-3.24.4-windows-x86_64.zip" + sha256: "c135c7ab78143c46e6686b1e9652bc1dd07e0cf71fd4decee777cdca77019c39" + "3.23.5": + Linux: + armv8: + url: "https://cmake.org/files/v3.23/cmake-3.23.5-linux-aarch64.tar.gz" + sha256: "dcf25a81de6bd4e646389a0635b050ed04d0f27e4f07ae22d975391f38f3c4b8" + x86_64: + url: "https://cmake.org/files/v3.23/cmake-3.23.5-linux-x86_64.tar.gz" + sha256: "bbd7ad93d2a14ed3608021a9466ae63db76a24efd1fae7a5f7798c1de7ab9344" + Macos: + universal: + url: "https://cmake.org/files/v3.23/cmake-3.23.5-macos10.10-universal.tar.gz" + sha256: "d3b44c59e72ef9cc13f7a4642de56e69b1b33fc3a6bb003b59b7f2036ace7e03" + Windows: + x86_64: + url: "https://cmake.org/files/v3.23/cmake-3.23.5-windows-x86_64.zip" + sha256: "51c75f93ebfe295701df205e5e78808b1e707996b26b5c26c3f680ab7b543881" + "3.22.6": + Linux: + armv8: + url: "https://cmake.org/files/v3.22/cmake-3.22.6-linux-aarch64.tar.gz" + sha256: "79be85d3e76565faacd60695cee11d030f7e7dd8691476144fa25eb93dbd0397" + x86_64: + url: "https://cmake.org/files/v3.22/cmake-3.22.6-linux-x86_64.tar.gz" + sha256: "09e1b34026c406c5bf4d1b053eadb3a8519cb360e37547ebf4b70ab766d94fbc" + Macos: + universal: + url: "https://cmake.org/files/v3.22/cmake-3.22.6-macos10.10-universal.tar.gz" + sha256: "873d296000b2fbd5cd306a3455fddc254b485cad988c67bf4ee0ba4fd7a1e057" + Windows: + x86_64: + url: "https://cmake.org/files/v3.22/cmake-3.22.6-windows-x86_64.zip" + sha256: "48bcc3e71e918b72e2682f9ca9d44dd6c416379071c1ecb530d0633374f91f15" + "3.21.7": + Linux: + armv8: + url: "https://cmake.org/files/v3.21/cmake-3.21.7-linux-aarch64.tar.gz" + sha256: "fa7e82170391c71dcc958ff57a63e9d6be9742a8b85a8b1386da9e571980474a" + x86_64: + url: "https://cmake.org/files/v3.21/cmake-3.21.7-linux-x86_64.tar.gz" + sha256: "f84e209d903a96e54f398bb8760693969b13fc50bce2f8278a9ee9dca01406b2" + Macos: + universal: + url: "https://cmake.org/files/v3.21/cmake-3.21.7-macos10.10-universal.tar.gz" + sha256: "d79775e35efca40ff1d213155c2d5e2e028d0ce376c5089c97f2fe3c6133af1d" + Windows: + x86_64: + url: "https://cmake.org/files/v3.21/cmake-3.21.7-windows-x86_64.zip" + sha256: "4c4840e2dc2bf82e8a16081ff506bba54f3a228b91ce36317129fed4035ef2e3" + "3.20.6": + Linux: + armv8: + url: "https://cmake.org/files/v3.20/cmake-3.20.6-linux-aarch64.tar.gz" + sha256: "9ac2035174d3c62827c85fb052372d70cf35fb565e8d47b8241fbe451c29b2f2" + x86_64: + url: "https://cmake.org/files/v3.20/cmake-3.20.6-linux-x86_64.tar.gz" + sha256: "458777097903b0f35a0452266b923f0a2f5b62fe331e636e2dcc4b636b768e36" + Macos: + universal: + url: "https://cmake.org/files/v3.20/cmake-3.20.6-macos10.10-universal.tar.gz" + sha256: "e75e95c10089b54fe0a7dfb369a87214e8a0ffb46d0fcf6a9678b38140dba983" + Windows: + x86_64: + url: "https://cmake.org/files/v3.20/cmake-3.20.6-windows-x86_64.zip" + sha256: "f240a38c964712aac474644b3ba21bdc2b4e8d5e31179f67bd2e6f45fa349419" + "3.19.8": + Linux: + armv8: + url: "https://cmake.org/files/v3.19/cmake-3.19.8-Linux-aarch64.tar.gz" + sha256: "807f5afb2a560e00af9640e496d5673afefc2888bf0ed076412884a5ebb547a1" + x86_64: + url: "https://cmake.org/files/v3.19/cmake-3.19.8-Linux-x86_64.tar.gz" + sha256: "db0d7d225150dd6e08ce54995e671f9b4801b8e93e22df1eef52339f6bbbecd9" + Macos: + universal: + url: "https://cmake.org/files/v3.19/cmake-3.19.8-macos10.10-universal.tar.gz" + sha256: "ea82f1a7c77d4d2a09ae6c80cbb5e419560bfe371f40b605d13ff1a861d7d6e1" + Windows: + x86_64: + url: "https://cmake.org/files/v3.19/cmake-3.19.8-win64-x64.zip" + sha256: "2a30877a3d6b50da305b289f4d1c03befdfaeb2edba02a563c681e883d810380" diff --git a/recipes/cmake/binary/conanfile.py b/recipes/cmake/binary/conanfile.py new file mode 100644 index 0000000000000..13c7ebecd34ef --- /dev/null +++ b/recipes/cmake/binary/conanfile.py @@ -0,0 +1,66 @@ +import os + +from conan import ConanFile +from conan.tools.files import get, copy, rmdir +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration + + +required_conan_version = ">=1.51.0" + +class CMakeConan(ConanFile): + name = "cmake" + package_type = "application" + description = "CMake, the cross-platform, open-source build system." + topics = ("build", "installer") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/Kitware/CMake" + license = "BSD-3-Clause" + settings = "os", "arch" + + def validate(self): + if self.settings.arch not in ["x86_64", "armv8"]: + raise ConanInvalidConfiguration("CMake binaries are only provided for x86_64 and armv8 architectures") + + if self.settings.os == "Windows" and self.settings.arch == "armv8" and Version(self.version) < "3.24": + raise ConanInvalidConfiguration("CMake only supports ARM64 binaries on Windows starting from 3.24") + + def build(self): + arch = str(self.settings.arch) if self.settings.os != "Macos" else "universal" + get(self, **self.conan_data["sources"][self.version][str(self.settings.os)][arch], + destination=self.source_folder, strip_root=True) + + def package_id(self): + if self.info.settings.os == "Macos": + del self.info.settings.arch + + def package(self): + copy(self, "*", src=self.build_folder, dst=self.package_folder) + + if self.settings.os == "Macos": + docs_folder = os.path.join(self.build_folder, "CMake.app", "Contents", "doc", "cmake") + else: + docs_folder = os.path.join(self.build_folder, "doc", "cmake") + + copy(self, "Copyright.txt", src=docs_folder, dst=os.path.join(self.package_folder, "licenses"), keep_path=False) + + if self.settings.os != "Macos": + # Remove unneeded folders (also cause long paths on Windows) + # Note: on macOS we don't want to modify the bundle contents + # to preserve signature validation + rmdir(self, os.path.join(self.package_folder, "doc")) + rmdir(self, os.path.join(self.package_folder, "man")) + + def package_info(self): + self.cpp_info.includedirs = [] + self.cpp_info.libdirs = [] + + if self.settings.os == "Macos": + bindir = os.path.join(self.package_folder, "CMake.app", "Contents", "bin") + self.cpp_info.bindirs = [bindir] + else: + bindir = os.path.join(self.package_folder, "bin") + + # Needed for compatibility with v1.x - Remove when 2.0 becomes the default + self.output.info(f"Appending PATH environment variable: {bindir}") + self.env_info.PATH.append(bindir) diff --git a/recipes/cmake/binary/test_package/conanfile.py b/recipes/cmake/binary/test_package/conanfile.py new file mode 100644 index 0000000000000..1c9cda0539d32 --- /dev/null +++ b/recipes/cmake/binary/test_package/conanfile.py @@ -0,0 +1,23 @@ +from six import StringIO +from conan import ConanFile +import re + + +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): + output = StringIO() + 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/binary/test_v1_package/conanfile.py b/recipes/cmake/binary/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..df9415b7cf880 --- /dev/null +++ b/recipes/cmake/binary/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 6075464de552d..2917de8e86dad 100644 --- a/recipes/cmake/config.yml +++ b/recipes/cmake/config.yml @@ -1,15 +1,57 @@ versions: - "3.19.8": - folder: "3.x.x" - "3.20.6": - folder: "3.x.x" - "3.21.7": - folder: "3.x.x" - "3.22.6": - folder: "3.x.x" + "3.31.0": + folder: "binary" + "3.30.5": + folder: "binary" + "3.30.1": + folder: "binary" + "3.30.0": + folder: "binary" + "3.29.7": + folder: "binary" + "3.29.6": + folder: "binary" + "3.29.5": + folder: "binary" + "3.29.4": + folder: "binary" + "3.29.3": + folder: "binary" + "3.29.2": + folder: "binary" + "3.29.0": + folder: "binary" + "3.28.6": + folder: "binary" + "3.28.5": + folder: "binary" + "3.28.1": + folder: "binary" + "3.27.9": + folder: "binary" + "3.27.7": + folder: "binary" + "3.27.6": + folder: "binary" + "3.27.5": + folder: "binary" + "3.27.4": + folder: "binary" + "3.26.6": + folder: "binary" + "3.26.5": + folder: "binary" + "3.25.3": + folder: "binary" + "3.24.4": + folder: "binary" "3.23.5": - folder: "3.x.x" - "3.24.3": - folder: "3.x.x" - "3.25.0": - folder: "3.x.x" + folder: "binary" + "3.22.6": + folder: "binary" + "3.21.7": + folder: "binary" + "3.20.6": + folder: "binary" + "3.19.8": + folder: "binary" diff --git a/recipes/cminpack/all/conanfile.py b/recipes/cminpack/all/conanfile.py index a1da35f69dd6a..e6918dedc922a 100644 --- a/recipes/cminpack/all/conanfile.py +++ b/recipes/cminpack/all/conanfile.py @@ -1,9 +1,9 @@ -from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools import files 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.45.0" +required_conan_version = ">=1.54.0" class CMinpackConan(ConanFile): @@ -14,7 +14,7 @@ class CMinpackConan(ConanFile): topics = ("nonlinear", "solver") homepage = "http://devernay.free.fr/hacks/cminpack/" license = "LicenseRef-CopyrightMINPACK.txt" - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -25,40 +25,27 @@ class CMinpackConan(ConanFile): "fPIC": True, } - def generate(self): - tc = CMakeToolchain(self) - tc.variables["BUILD_EXAMPLES"] = "OFF" - tc.variables["CMINPACK_LIB_INSTALL_DIR"] = "lib" - tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" - tc.generate() - - def layout(self): - cmake_layout(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 - - # cminpack is a c library - 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): - files.get(self, **self.conan_data["sources"][self.version], - strip_root=True, destination=self.source_folder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_EXAMPLES"] = "OFF" + tc.variables["CMINPACK_LIB_INSTALL_DIR"] = "lib" + tc.generate() def build(self): cmake = CMake(self) @@ -66,12 +53,11 @@ def build(self): cmake.build() def package(self): + copy(self, "CopyrightMINPACK.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) cmake = CMake(self) cmake.install() - - files.rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) - files.copy(self, "CopyrightMINPACK.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) - files.rmdir(self, os.path.join(self.package_folder, "share")) # contains cmake config files + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) # contains cmake config files def _library_postfix(self): postfix = "" @@ -92,7 +78,7 @@ def package_info(self): self.cpp_info.components["cminpack-double"].names["cmake_find_package"] = "cminpack" self.cpp_info.components["cminpack-double"].names["cmake_find_package_multi"] = "cminpack" self.cpp_info.components["cminpack-double"].names["pkg_config"] = "cminpack" - + # the single precision version self.cpp_info.components['cminpack-single'].libs = ['cminpacks' + self._library_postfix()] self.cpp_info.components['cminpack-single'].includedirs.append(minpack_include_dir) @@ -102,7 +88,6 @@ def package_info(self): self.cpp_info.components["cminpack-single"].names["cmake_find_package_multi"] = "cminpacks" self.cpp_info.components["cminpack-single"].names["pkg_config"] = "cminpacks" - if self.settings.os != "Windows": self.cpp_info.components['cminpack-double'].system_libs.append("m") self.cpp_info.components['cminpack-single'].system_libs.append("m") diff --git a/recipes/cminpack/all/test_package/CMakeLists.txt b/recipes/cminpack/all/test_package/CMakeLists.txt index fa33c20512fe4..cc33b8b3543ef 100644 --- a/recipes/cminpack/all/test_package/CMakeLists.txt +++ b/recipes/cminpack/all/test_package/CMakeLists.txt @@ -1,7 +1,7 @@ -cmake_minimum_required(VERSION 3.12) -project(CMinPack-Conan-TestPackage C) +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) -find_package(CMinpack REQUIRED) +find_package(CMinpack REQUIRED CONFIG) # This builds one of the original cminpack examples against # both types of the library diff --git a/recipes/cminpack/all/test_package/conanfile.py b/recipes/cminpack/all/test_package/conanfile.py index db7d5f7ac5bc3..434bb3861fb76 100644 --- a/recipes/cminpack/all/test_package/conanfile.py +++ b/recipes/cminpack/all/test_package/conanfile.py @@ -1,17 +1,20 @@ - from conan import ConanFile -from conan.tools.cmake import CMake, 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", "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() diff --git a/recipes/cminpack/all/test_v1_package/CMakeLists.txt b/recipes/cminpack/all/test_v1_package/CMakeLists.txt index 124290cb0ab4b..0d20897301b68 100644 --- a/recipes/cminpack/all/test_v1_package/CMakeLists.txt +++ b/recipes/cminpack/all/test_v1_package/CMakeLists.txt @@ -1,16 +1,8 @@ -cmake_minimum_required(VERSION 3.1.2) -project(CMinPack-ConanV1-TestPackage C) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(CMinpack REQUIRED CONFIG) - -# This builds one of the original cminpack examples against -# both types of the library - -add_executable(cminpack_test_double ../test_package/tchkderc.c) -target_link_libraries(cminpack_test_double PRIVATE cminpack::cminpack) - -add_executable(cminpack_test_float ../test_package/tchkderc.c) -target_link_libraries(cminpack_test_float PRIVATE cminpack::cminpacks) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/cmocka/all/conandata.yml b/recipes/cmocka/all/conandata.yml index d9ca5bcc54526..e378971eb0634 100644 --- a/recipes/cmocka/all/conandata.yml +++ b/recipes/cmocka/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.1.7": + url: "https://cmocka.org/files/1.1/cmocka-1.1.7.tar.xz" + sha256: "810570eb0b8d64804331f82b29ff47c790ce9cd6b163e98d47a4807047ecad82" "1.1.5": url: "https://cmocka.org/files/1.1/cmocka-1.1.5.tar.xz" sha256: "f0ccd8242d55e2fd74b16ba518359151f6f8383ff8aef4976e48393f77bba8b6" diff --git a/recipes/cmocka/all/conanfile.py b/recipes/cmocka/all/conanfile.py index a0184c6e3cfae..3cba1fe3283f8 100644 --- a/recipes/cmocka/all/conanfile.py +++ b/recipes/cmocka/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, 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.47.0" +required_conan_version = ">=1.53.0" class CmockaConan(ConanFile): @@ -15,6 +16,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 +28,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 +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) @@ -102,7 +96,10 @@ def package_info(self): self.cpp_info.set_property("cmake_file_name", "cmocka") self.cpp_info.set_property("pkg_config_name", "cmocka") self.cpp_info.set_property("cmake_build_modules", [self._module_file_rel_path]) - self.cpp_info.libs = ["cmocka{}".format("" if self.options.shared else "-static")] + lib_suffix = "" + if Version(self.version) < "1.1.7" and not self.options.shared: + lib_suffix = "-static" + self.cpp_info.libs = ["cmocka" + lib_suffix] # 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/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/cmocka/config.yml b/recipes/cmocka/config.yml index e48685771bd64..3996fe27c952c 100644 --- a/recipes/cmocka/config.yml +++ b/recipes/cmocka/config.yml @@ -1,3 +1,5 @@ versions: + "1.1.7": + folder: all "1.1.5": folder: all 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/cn-cbor/all/CMakeLists.txt b/recipes/cn-cbor/all/CMakeLists.txt deleted file mode 100644 index 361b35d4c17d9..0000000000000 --- a/recipes/cn-cbor/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/cn-cbor/all/conandata.yml b/recipes/cn-cbor/all/conandata.yml index 4de861bba88a9..617cedf518b2c 100644 --- a/recipes/cn-cbor/all/conandata.yml +++ b/recipes/cn-cbor/all/conandata.yml @@ -1,4 +1,4 @@ sources: "1.0.0": - sha256: eca2bcc15b8400037fd95748724287afbb966e34d4d0275a496b4872bcea9d77 - url: https://github.com/jimsch/cn-cbor/archive/1.0.0.zip + url: "https://github.com/jimsch/cn-cbor/archive/1.0.0.zip" + sha256: "eca2bcc15b8400037fd95748724287afbb966e34d4d0275a496b4872bcea9d77" diff --git a/recipes/cn-cbor/all/conanfile.py b/recipes/cn-cbor/all/conanfile.py index 74e90a06cc919..d10556f9c9031 100644 --- a/recipes/cn-cbor/all/conanfile.py +++ b/recipes/cn-cbor/all/conanfile.py @@ -1,82 +1,84 @@ import os -from conans import CMake, ConanFile, 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 copy, get, rmdir + +required_conan_version = ">=1.53.0" class CnCborStackConan(ConanFile): name = "cn-cbor" + description = "A constrained node implementation of CBOR in C" license = "MIT" - homepage = "https://github.com/jimsch/cn-cbor/" url = "https://github.com/conan-io/conan-center-index" - description = "A constrained node implementation of CBOR in C" - topics = "cbor", "nodes", "messaging" - exports_sources = ['CMakeLists.txt'] - settings = "os", "compiler", "build_type", "arch" + homepage = "https://github.com/jimsch/cn-cbor/" + topics = ("cbor", "nodes", "messaging") + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], } default_options = { "shared": False, - "fPIC": True + "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 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 validate(self): if self.settings.os == "Windows" and self.options.shared: raise ConanInvalidConfiguration("Windows shared builds are not supported right now") 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 _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["fatal_warnings"] = False - self._cmake.definitions["coveralls"] = False - self._cmake.definitions["build_tests"] = False - self._cmake.definitions["build_docs"] = False - - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = self.options.shared + tc.cache_variables["CN_CBOR_FATAL_WARNINGS"] = False + tc.cache_variables["CN_CBOR_COVERALLS"] = False + tc.cache_variables["CN_CBOR_BUILD_TESTS"] = False + tc.cache_variables["CN_CBOR_BUILD_DOCS"] = False + # For v1.0.0 + tc.cache_variables["fatal_warnings"] = False + tc.cache_variables["coveralls"] = False + tc.cache_variables["build_tests"] = False + tc.cache_variables["build_docs"] = 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", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder) + cmake = CMake(self) cmake.install() os.remove(os.path.join(self.package_folder, "README.md")) os.remove(os.path.join(self.package_folder, "LICENSE")) - 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, "lib", "cn-cbor", "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, "lib", "cn-cbor", "cmake")) def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = ["cn-cbor"] if self.settings.os == "Windows": self.cpp_info.system_libs = ["ws2_32"] diff --git a/recipes/cn-cbor/all/test_package/CMakeLists.txt b/recipes/cn-cbor/all/test_package/CMakeLists.txt index 33ae887aa6aea..50e6a7de0b4ea 100644 --- a/recipes/cn-cbor/all/test_package/CMakeLists.txt +++ b/recipes/cn-cbor/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -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() +find_package(cn-cbor REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE cn-cbor::cn-cbor) set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) diff --git a/recipes/cn-cbor/all/test_package/conanfile.py b/recipes/cn-cbor/all/test_package/conanfile.py index 933dbf96533ae..ef5d7042163ec 100644 --- a/recipes/cn-cbor/all/test_package/conanfile.py +++ b/recipes/cn-cbor/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 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.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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cn-cbor/all/test_v1_package/CMakeLists.txt b/recipes/cn-cbor/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/cn-cbor/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/cn-cbor/all/test_v1_package/conanfile.py b/recipes/cn-cbor/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..9de3689208f00 --- /dev/null +++ b/recipes/cn-cbor/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.settings): + bin_path = os.path.join("bin", "test_package") + bin_path = self.run(bin_path, run_environment=True) diff --git a/recipes/cn-cbor/config.yml b/recipes/cn-cbor/config.yml index 8f50af2b049ed..c7f13630776fb 100644 --- a/recipes/cn-cbor/config.yml +++ b/recipes/cn-cbor/config.yml @@ -1,4 +1,3 @@ ---- versions: "1.0.0": folder: "all" diff --git a/recipes/cnats/all/conandata.yml b/recipes/cnats/all/conandata.yml new file mode 100644 index 0000000000000..618c0a55a3965 --- /dev/null +++ b/recipes/cnats/all/conandata.yml @@ -0,0 +1,13 @@ +sources: + "3.8.0": + url: "https://github.com/nats-io/nats.c/archive/refs/tags/v3.8.0.tar.gz" + sha256: "465811380cdc6eab3304e40536d03f99977a69c0e56fcf566000c29dd075e4dd" + "3.8.2": + url: "https://github.com/nats-io/nats.c/archive/refs/tags/v3.8.2.tar.gz" + sha256: "083ee03cf5a413629d56272e88ad3229720c5006c286e8180c9e5b745c10f37d" + "3.8.3": + url: "https://github.com/nats-io/nats.c/archive/refs/tags/v3.8.3.tar.gz" + sha256: "fe7e9ce7636446cc3fe0f47f6a235c4783299e00d5e5c4a1f8689d20707871db" + "3.9.1": + url: "https://github.com/nats-io/nats.c/archive/refs/tags/v3.9.1.tar.gz" + sha256: "56836bb30a2da93eaa6df0dfa27e796e6be0933b5b3d4d83b5c76d3b80304290" diff --git a/recipes/cnats/all/conanfile.py b/recipes/cnats/all/conanfile.py new file mode 100644 index 0000000000000..60f15b3b814f2 --- /dev/null +++ b/recipes/cnats/all/conanfile.py @@ -0,0 +1,110 @@ +from conan import ConanFile +from conan.tools.files import get, copy, rename, mkdir, rmdir +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.scm import Version +import os + + +required_conan_version = ">=1.54.0" + + +class PackageConan(ConanFile): + name = "cnats" + description = "A C client for NATS" + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://nats.io/" + topics = ("messaging", "message-bus", "message-queue", "messaging-library", "nats-client") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_tls": [True, False], + "with_sodium": [True, False], + "enable_streaming": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_tls": True, + "with_sodium": False, + "enable_streaming": 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") + 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_tls: + self.requires("openssl/[>=1.1 <4]") + if self.options.with_sodium: + self.requires("libsodium/cci.20220430") + # FIXME: C3I Jenkins does not have protobuf-c static x shared deps for now + if self.options.enable_streaming: + self.requires("protobuf-c/1.4.1") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["NATS_BUILD_WITH_TLS"] = self.options.with_tls + tc.variables["NATS_BUILD_USE_SODIUM"] = self.options.with_sodium + tc.variables["NATS_BUILD_EXAMPLES"] = False + tc.variables["BUILD_TESTING"] = False + tc.variables["NATS_BUILD_LIB_STATIC"] = not self.options.shared + tc.variables["NATS_BUILD_LIB_SHARED"] = self.options.shared + if self.options.with_tls: + tc.variables["NATS_BUILD_TLS_USE_OPENSSL_1_1_API"] = Version(self.dependencies["openssl"].ref.version) >= "1.1" + tc.variables["NATS_BUILD_STREAMING"] = self.options.enable_streaming + 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() + if self.settings.os == "Windows" and self.options.shared: + mkdir(self, os.path.join(self.package_folder, "bin")) + rename(self, os.path.join(self.package_folder, "lib", f"{self._nats_library_name}.dll"), os.path.join(self.package_folder, "bin", f"{self._nats_library_name}.dll")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + + @property + def _nats_library_name(self): + suffix = "" if self.options.shared else "_static" + debug = "d" if self.settings.build_type == "Debug" else "" + return f"nats{suffix}{debug}" + + def package_info(self): + self.cpp_info.libs = [self._nats_library_name] + self.cpp_info.set_property("cmake_file_name", "cnats") + self.cpp_info.set_property("cmake_target_name", f"cnats::{self._nats_library_name}") + self.cpp_info.set_property("pkg_config_name", "libnats") + + if self.options.enable_streaming: + self.cpp_info.defines.append("NATS_HAS_STREAMING") + if self.settings.os == "Windows" and self.options.shared: + self.cpp_info.defines.append("nats_IMPORTS") + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["pthread", "rt"]) + elif self.settings.os == "Windows": + self.cpp_info.system_libs.append("ws2_32") diff --git a/recipes/cnats/all/test_package/CMakeLists.txt b/recipes/cnats/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..6c0bde85724d3 --- /dev/null +++ b/recipes/cnats/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package CXX) + +find_package(cnats REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE cnats::${CNATS_TARGET}) diff --git a/recipes/cnats/all/test_package/conanfile.py b/recipes/cnats/all/test_package/conanfile.py new file mode 100644 index 0000000000000..6c38f16815ae8 --- /dev/null +++ b/recipes/cnats/all/test_package/conanfile.py @@ -0,0 +1,37 @@ +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", "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) + + @property + def _nats_library_name(self): + suffix = "" if self.dependencies["cnats"].options.shared else "_static" + debug = "d" if self.dependencies["cnats"].settings.build_type == "Debug" else "" + return f"nats{suffix}{debug}" + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CNATS_TARGET"] = self._nats_library_name + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cnats/all/test_package/test_package.cpp b/recipes/cnats/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..e9578180d8c82 --- /dev/null +++ b/recipes/cnats/all/test_package/test_package.cpp @@ -0,0 +1,10 @@ +#include +#include + +#include "nats/nats.h" + + +int main() { + std::cout << "NATS Version: " << nats_GetVersion() << std::endl; + return EXIT_SUCCESS; +} diff --git a/recipes/cnats/config.yml b/recipes/cnats/config.yml new file mode 100644 index 0000000000000..a45c78cde476d --- /dev/null +++ b/recipes/cnats/config.yml @@ -0,0 +1,9 @@ +versions: + "3.8.0": + folder: all + "3.8.2": + folder: all + "3.8.3": + folder: all + "3.9.1": + folder: all diff --git a/recipes/cnpy/all/conanfile.py b/recipes/cnpy/all/conanfile.py index 1ee4b6417368a..f6babc5b8b09b 100644 --- a/recipes/cnpy/all/conanfile.py +++ b/recipes/cnpy/all/conanfile.py @@ -15,6 +15,7 @@ class CnpyConan(ConanFile): homepage = "https://github.com/rogersce/cnpy" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -40,15 +41,14 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("zlib/1.2.13", transitive_headers=True, transitive_libs=True) + self.requires("zlib/[>=1.2.11 <2]", transitive_headers=True, transitive_libs=True) def validate(self): - if self.info.settings.compiler.get_safe("cppstd"): + 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/cocoyaxi/all/conanfile.py b/recipes/cocoyaxi/all/conanfile.py index 217d2d1b7c4e1..1209ab9f83764 100644 --- a/recipes/cocoyaxi/all/conanfile.py +++ b/recipes/cocoyaxi/all/conanfile.py @@ -30,6 +30,7 @@ class CocoyaxiConan(ConanFile): "with_libcurl": False, "with_openssl": False, } + deprecated = "coost" def config_options(self): if self.settings.os == "Windows": @@ -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 requirements(self): if self.options.with_libcurl: - self.requires("libcurl/7.80.0") + self.requires("libcurl/[>=7.78.0 <9]") if self.options.with_libcurl or self.options.with_openssl: - self.requires("openssl/1.1.1q") + self.requires("openssl/[>=1.1 <4]") def validate(self): if self.info.settings.compiler.cppstd: @@ -95,3 +96,7 @@ def package_info(self): 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") + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["co"].system_libs.extend(["pthread", "dl", "m"]) + elif self.settings.os == "Windows": + self.cpp_info.components["co"].system_libs.append("ws2_32") diff --git a/recipes/coin-cgl/all/conandata.yml b/recipes/coin-cgl/all/conandata.yml index d3e1494065212..9cf464447df6f 100644 --- a/recipes/coin-cgl/all/conandata.yml +++ b/recipes/coin-cgl/all/conandata.yml @@ -1,8 +1,17 @@ sources: + "0.60.7": + url: "https://github.com/coin-or/Cgl/archive/releases/0.60.7.tar.gz" + sha256: "93b30a80b5d2880c2e72d5877c64bdeaf4d7c1928b3194ea2f88b1aa4517fb1b" + "0.60.6": + url: "https://github.com/coin-or/Cgl/archive/refs/tags/releases/0.60.6.tar.gz" + sha256: "9e2c51ffad816ab408763d6b931e2a3060482ee4bf1983148969de96d4b2c9ce" "0.60.3": - url: "https://github.com/coin-or/Cgl/archive/releases/0.60.3.tar.gz" + url: "https://github.com/coin-or/Cgl/archive/refs/tags/releases/0.60.3.tar.gz" sha256: "cfeeedd68feab7c0ce377eb9c7b61715120478f12c4dd0064b05ad640e20f3fb" patches: + "0.60.7": + - patch_file: "patches/0.60.6-0001-no-pkg-config-check.patch" + "0.60.6": + - patch_file: "patches/0.60.6-0001-no-pkg-config-check.patch" "0.60.3": - - patch_file: "patches/0001-no-pkg-config-check.patch" - base_path: "source_subfolder" + - patch_file: "patches/0.60.3-0001-no-pkg-config-check.patch" diff --git a/recipes/coin-cgl/all/conanfile.py b/recipes/coin-cgl/all/conanfile.py index 152335302dd9a..df23309955a25 100644 --- a/recipes/coin-cgl/all/conanfile.py +++ b/recipes/coin-cgl/all/conanfile.py @@ -1,14 +1,16 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.files import rename, get, apply_conandata_patches, rmdir +from conan.tools.apple import fix_apple_shared_install_name from conan.tools.build import cross_building -from conan.tools.scm import Version -from conans import AutoToolsBuildEnvironment, tools -from contextlib import contextmanager +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, unix_path import os -import shutil -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.57.0" + class CoinCglConan(ConanFile): name = "coin-cgl" @@ -16,7 +18,8 @@ class CoinCglConan(ConanFile): topics = ("cgl", "simplex", "solver", "linear", "programming") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/coin-or/Cgl" - license = ("EPL-2.0",) + license = "EPL-2.0" + package_type = "library" settings = "os", "arch", "build_type", "compiler" options = { "shared": [True, False], @@ -26,21 +29,13 @@ class CoinCglConan(ConanFile): "shared": False, "fPIC": True, } - generators = "pkg_config" - - _autotools = 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) 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": @@ -48,29 +43,27 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - - def requirements(self): - self.requires("coin-utils/2.11.4") - self.requires("coin-osi/0.108.6") - self.requires("coin-clp/1.17.6") + 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") - @property - def _user_info_build(self): - return getattr(self, "user_info_build", self.deps_user_info) + def requirements(self): + self.requires("coin-utils/2.11.9") + self.requires("coin-osi/0.108.7") + self.requires("coin-clp/1.17.7") def build_requirements(self): - 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.tool_requires("msys2/cci.latest") - if self.settings.compiler == "Visual Studio": + self.tool_requires("gnu-config/cci.20210814") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/2.0.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 validate(self): if self.settings.os == "Windows" and self.options.shared: raise ConanInvalidConfiguration("coin-cgl does not support shared builds on Windows") @@ -79,70 +72,72 @@ def validate(self): raise ConanInvalidConfiguration("coin-cgl shared not supported yet when cross-building") def source(self): - get(self, **self.conan_data["sources"][self.version], - strip_root=True, destination=self._source_subfolder) - - @contextmanager - def _build_context(self): - if self.settings.compiler == "Visual Studio": - 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)), - "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 - - 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)), + 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 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=os.path.join(self.source_folder, self._source_subfolder), args=configure_args) - return self._autotools + ]) + 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): + 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", f"{compile_wrapper} link -nologo") + env.define("AR", f"{ar_wrapper} \"lib -nologo\"") + env.define("NM", "dumpbin -symbols") + env.define("OBJDUMP", ":") + env.define("RANLIB", ":") + env.define("STRIP", ":") + 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() + if not is_msvc(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) + 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() - - os.unlink(os.path.join(self.package_folder, "lib", "libCgl.la")) - - if self.settings.compiler == "Visual Studio": + 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, os.path.join(self.package_folder, "lib", "libCgl.a"), os.path.join(self.package_folder, "lib", "Cgl.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", "cgl") self.cpp_info.libs = ["Cgl"] self.cpp_info.includedirs.append(os.path.join("include", "coin")) - self.cpp_info.names["pkg_config"] = "cgl" diff --git a/recipes/coin-cgl/all/patches/0001-no-pkg-config-check.patch b/recipes/coin-cgl/all/patches/0.60.3-0001-no-pkg-config-check.patch similarity index 100% rename from recipes/coin-cgl/all/patches/0001-no-pkg-config-check.patch rename to recipes/coin-cgl/all/patches/0.60.3-0001-no-pkg-config-check.patch diff --git a/recipes/coin-cgl/all/patches/0.60.6-0001-no-pkg-config-check.patch b/recipes/coin-cgl/all/patches/0.60.6-0001-no-pkg-config-check.patch new file mode 100644 index 0000000000000..4e3b6ea5ea929 --- /dev/null +++ b/recipes/coin-cgl/all/patches/0.60.6-0001-no-pkg-config-check.patch @@ -0,0 +1,13 @@ +--- Cgl/Makefile.in ++++ Cgl/Makefile.in +@@ -894,8 +894,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 cgl > $(addlibsdir)/cgl_addlibs.txt ++@COIN_HAS_PKGCONFIG_TRUE@ #PKG_CONFIG_PATH=@COIN_PKG_CONFIG_PATH@:$(DESTDIR)$(pkgconfiglibdir) \ ++@COIN_HAS_PKGCONFIG_TRUE@ #$(PKG_CONFIG) --libs cgl > $(addlibsdir)/cgl_addlibs.txt + @COIN_CXX_IS_CL_TRUE@@COIN_HAS_PKGCONFIG_FALSE@ echo "-libpath:`$(CYGPATH_W) @abs_lib_dir@` libCgl.lib @CGLLIB_LIBS_INSTALLED@" > $(addlibsdir)/cgl_addlibs.txt + @COIN_CXX_IS_CL_FALSE@@COIN_HAS_PKGCONFIG_FALSE@ echo -L@abs_lib_dir@ -lCgl @CGLLIB_LIBS_INSTALLED@ > $(addlibsdir)/cgl_addlibs.txt + diff --git a/recipes/coin-cgl/all/test_package/CMakeLists.txt b/recipes/coin-cgl/all/test_package/CMakeLists.txt index a0a2ed56424aa..7c4558f1caa45 100644 --- a/recipes/coin-cgl/all/test_package/CMakeLists.txt +++ b/recipes/coin-cgl/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) +cmake_minimum_required(VERSION 3.6) +project(test_package LANGUAGES CXX) +find_package(PkgConfig REQUIRED) pkg_check_modules(Cgl REQUIRED IMPORTED_TARGET cgl) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/coin-cgl/all/test_package/conanfile.py b/recipes/coin-cgl/all/test_package/conanfile.py index 9e09e219fdcb3..7ab87ca07735c 100644 --- a/recipes/coin-cgl/all/test_package/conanfile.py +++ b/recipes/coin-cgl/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/2.0.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-cgl/all/test_v1_package/CMakeLists.txt b/recipes/coin-cgl/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/coin-cgl/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/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-cgl/all/test_v1_package/conanfile.py b/recipes/coin-cgl/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..b3607270e232e --- /dev/null +++ b/recipes/coin-cgl/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/2.0.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-cgl/config.yml b/recipes/coin-cgl/config.yml index f112a543d6350..19787257e6449 100644 --- a/recipes/coin-cgl/config.yml +++ b/recipes/coin-cgl/config.yml @@ -1,3 +1,7 @@ versions: + "0.60.7": + folder: "all" + "0.60.6": + folder: "all" "0.60.3": folder: "all" diff --git a/recipes/coin-clp/all/conandata.yml b/recipes/coin-clp/all/conandata.yml index 4ff9da04eac27..2ffc096e1d90a 100644 --- a/recipes/coin-clp/all/conandata.yml +++ b/recipes/coin-clp/all/conandata.yml @@ -1,8 +1,12 @@ sources: + "1.17.7": + url: "https://github.com/coin-or/Clp/archive/refs/tags/releases/1.17.7.tar.gz" + sha256: "c4c2c0e014220ce8b6294f3be0f3a595a37bef58a14bf9bac406016e9e73b0f5" "1.17.6": - url: "https://github.com/coin-or/Clp/archive/releases/1.17.6.tar.gz" + url: "https://github.com/coin-or/Clp/archive/refs/tags/releases/1.17.6.tar.gz" sha256: "afff465b1620cfcbb7b7c17b5d331d412039650ff471c4160c7eb24ae01284c9" patches: + "1.17.7": + - patch_file: "patches/1.17.7-0001-no-pkg-config-check.patch" "1.17.6": - - patch_file: "patches/0001-no-pkg-config-check.patch" - base_path: "source_subfolder" + - patch_file: "patches/1.17.6-0001-no-pkg-config-check.patch" diff --git a/recipes/coin-clp/all/conanfile.py b/recipes/coin-clp/all/conanfile.py index 39939b551d54c..7d2a72db5923b 100644 --- a/recipes/coin-clp/all/conanfile.py +++ b/recipes/coin-clp/all/conanfile.py @@ -1,14 +1,15 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.files import get, apply_conandata_patches, mkdir, rm, rmdir, rename +from conan.tools.apple import fix_apple_shared_install_name from conan.tools.build import cross_building -from conan.tools.scm import Version -from conans import AutoToolsBuildEnvironment, tools -from contextlib import contextmanager +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, mkdir, 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, unix_path import os -import shutil -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.57.0" class CoinClpConan(ConanFile): @@ -17,7 +18,8 @@ class CoinClpConan(ConanFile): topics = ("clp", "simplex", "solver", "linear", "programming") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/coin-or/Clp" - 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 CoinClpConan(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,11 +43,15 @@ 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("coin-utils/2.11.4") - self.requires("coin-osi/0.108.6") + # Symbols are exposed https://github.com/conan-io/conan-center-index/pull/16053#issuecomment-1512637106 + self.requires("coin-utils/2.11.9", transitive_headers=True, transitive_libs=True) + self.requires("coin-osi/0.108.7", transitive_headers=True) def validate(self): if self.settings.os == "Windows" and self.options.shared: @@ -68,83 +61,86 @@ def validate(self): raise ConanInvalidConfiguration("coin-clp shared not supported yet when cross-building") 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") - if self.settings.compiler == "Visual Studio": - self.build_requires("automake/1.16.4") - 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/2.1.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") + if is_msvc(self): + self.tool_requires("automake/1.16.5") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - @contextmanager - def _build_context(self): - with tools.environment_append({"PKG_CONFIG_PATH": self.install_folder}): - if self.settings.compiler == "Visual Studio": - 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)), - "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 - - 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)), - ] - if self.settings.compiler == "Visual Studio" and Version(self.settings.compiler.version) >= 12: - self._autotools.flags.append("-FS") - self._autotools.configure(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) + if is_msvc(self) and 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): + 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", f"{compile_wrapper} link -nologo") + env.define("AR", f"{ar_wrapper} \"lib -nologo\"") + env.define("NM", "dumpbin -symbols") + env.define("OBJDUMP", ":") + env.define("RANLIB", ":") + env.define("STRIP", ":") + 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() + if not is_msvc(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) + 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")) # Installation script expects include/coin to already exist mkdir(self, os.path.join(self.package_folder, "include", "coin")) - with self._build_context(): - autotools = self._configure_autotools() - autotools.install(args=["-j1"]) # due to configure generated with old autotools version - + 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")) - if self.settings.compiler == "Visual Studio": + fix_apple_shared_install_name(self) + if is_msvc(self): for l in ("Clp", "ClpSolver", "OsiClp"): rename(self, os.path.join(self.package_folder, "lib", f"lib{l}.a"), os.path.join(self.package_folder, "lib", f"{l}.lib")) def package_info(self): + self.cpp_info.components["clp"].set_property("pkg_config_name", "clp") self.cpp_info.components["clp"].libs = ["ClpSolver", "Clp"] self.cpp_info.components["clp"].includedirs.append(os.path.join("include", "coin")) - self.cpp_info.components["clp"].names["pkg_config"] = "clp" self.cpp_info.components["clp"].requires = ["coin-utils::coin-utils"] + self.cpp_info.components["osi-clp"].set_property("pkg_config_name", "osi-clp") self.cpp_info.components["osi-clp"].libs = ["OsiClp"] - self.cpp_info.components["osi-clp"].names["pkg_config"] = "osi-clp" self.cpp_info.components["osi-clp"].requires = ["clp", "coin-osi::coin-osi"] - 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/coin-clp/all/patches/0001-no-pkg-config-check.patch b/recipes/coin-clp/all/patches/1.17.6-0001-no-pkg-config-check.patch similarity index 100% rename from recipes/coin-clp/all/patches/0001-no-pkg-config-check.patch rename to recipes/coin-clp/all/patches/1.17.6-0001-no-pkg-config-check.patch diff --git a/recipes/coin-clp/all/patches/1.17.7-0001-no-pkg-config-check.patch b/recipes/coin-clp/all/patches/1.17.7-0001-no-pkg-config-check.patch new file mode 100644 index 0000000000000..62070411f384d --- /dev/null +++ b/recipes/coin-clp/all/patches/1.17.7-0001-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/all/test_package/CMakeLists.txt b/recipes/coin-clp/all/test_package/CMakeLists.txt index bd05b35f53d79..be407d0b8fd6f 100644 --- a/recipes/coin-clp/all/test_package/CMakeLists.txt +++ b/recipes/coin-clp/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) +cmake_minimum_required(VERSION 3.6) +project(test_package LANGUAGES CXX) +find_package(PkgConfig REQUIRED) pkg_check_modules(OsiClp REQUIRED IMPORTED_TARGET osi-clp) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/coin-clp/all/test_package/conanfile.py b/recipes/coin-clp/all/test_package/conanfile.py index d24de2f0b2690..f085dad93e383 100644 --- a/recipes/coin-clp/all/test_package/conanfile.py +++ b/recipes/coin-clp/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", "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/2.1.0") def build(self): cmake = CMake(self) @@ -15,7 +25,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") mps = os.path.join(self.source_folder, "sample.mps") - self.run("{} {}".format(bin_path, mps), run_environment=True) + self.run(f"{bin_path} {mps}", env="conanrun") diff --git a/recipes/coin-clp/all/test_v1_package/CMakeLists.txt b/recipes/coin-clp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/coin-clp/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/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-clp/all/test_v1_package/conanfile.py b/recipes/coin-clp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..6b31eec8506a4 --- /dev/null +++ b/recipes/coin-clp/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", "pkg_config" + + def build_requirements(self): + self.build_requires("pkgconf/2.1.0") + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + mps = os.path.join(self.source_folder, os.pardir, "test_package", "sample.mps") + self.run(f"{bin_path} {mps}", run_environment=True) diff --git a/recipes/coin-clp/config.yml b/recipes/coin-clp/config.yml index 34a0fb9afc279..0ed5056bc7c44 100644 --- a/recipes/coin-clp/config.yml +++ b/recipes/coin-clp/config.yml @@ -1,3 +1,5 @@ versions: + "1.17.7": + folder: "all" "1.17.6": folder: "all" diff --git a/recipes/coin-lemon/all/conandata.yml b/recipes/coin-lemon/all/conandata.yml index f00f950c896c3..9db91250ca346 100644 --- a/recipes/coin-lemon/all/conandata.yml +++ b/recipes/coin-lemon/all/conandata.yml @@ -4,5 +4,12 @@ sources: sha256: "71b7c725f4c0b4a8ccb92eb87b208701586cf7a96156ebd821ca3ed855bad3c8" patches: "1.3.1": - - patch_file: "patches/cmake-add-runtime-destination_1.3.1.patch" - - patch_file: "patches/0001-remove-register-keyword.patch" + - patch_file: "patches/0001-cmake-add-runtime-destination.patch" + patch_description: "Fix install destination of dll" + patch_type: "conan" + - patch_file: "patches/0002-cpp17-compat-remove-register-keyword.patch" + patch_description: "C++17 compatibility: remove register keyword" + patch_type: "portability" + - patch_file: "patches/0003-cpp20-compat-alloc.patch" + patch_description: "C++20 compatibility: remove usage of std::allocator::construct & destroy" + patch_type: "portability" diff --git a/recipes/coin-lemon/all/conanfile.py b/recipes/coin-lemon/all/conanfile.py index d76140ba95344..2ea80d94c93ce 100644 --- a/recipes/coin-lemon/all/conanfile.py +++ b/recipes/coin-lemon/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, 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): name = "coin-lemon" - license = "Boost 1.0" + license = "BSL-1.0" url = "https://github.com/conan-io/conan-center-index" homepage = "http://lemon.cs.elte.hu" 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) @@ -87,6 +86,8 @@ def package_info(self): self.cpp_info.set_property("pkg_config_name", "lemon") self.cpp_info.libs = ["lemon" if self.settings.os == "Windows" else "emon"] self.cpp_info.defines.append("LEMON_ONLY_TEMPLATES") + 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 self.cpp_info.names["cmake_find_package"] = "LEMON" diff --git a/recipes/coin-lemon/all/patches/cmake-add-runtime-destination_1.3.1.patch b/recipes/coin-lemon/all/patches/0001-cmake-add-runtime-destination.patch similarity index 100% rename from recipes/coin-lemon/all/patches/cmake-add-runtime-destination_1.3.1.patch rename to recipes/coin-lemon/all/patches/0001-cmake-add-runtime-destination.patch diff --git a/recipes/coin-lemon/all/patches/0001-remove-register-keyword.patch b/recipes/coin-lemon/all/patches/0002-cpp17-compat-remove-register-keyword.patch similarity index 100% rename from recipes/coin-lemon/all/patches/0001-remove-register-keyword.patch rename to recipes/coin-lemon/all/patches/0002-cpp17-compat-remove-register-keyword.patch diff --git a/recipes/coin-lemon/all/patches/0003-cpp20-compat-alloc.patch b/recipes/coin-lemon/all/patches/0003-cpp20-compat-alloc.patch new file mode 100644 index 0000000000000..9aa9db47a396b --- /dev/null +++ b/recipes/coin-lemon/all/patches/0003-cpp20-compat-alloc.patch @@ -0,0 +1,199 @@ +--- a/lemon/bits/array_map.h ++++ b/lemon/bits/array_map.h +@@ -88,7 +88,11 @@ namespace lemon { + Item it; + for (nf->first(it); it != INVALID; nf->next(it)) { + int id = nf->id(it);; ++#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) || __cplusplus >= 202002L) ++ std::allocator_traits::construct(allocator, &(values[id]), Value()); ++#else + allocator.construct(&(values[id]), Value()); ++#endif + } + } + +@@ -102,7 +106,11 @@ namespace lemon { + Item it; + for (nf->first(it); it != INVALID; nf->next(it)) { + int id = nf->id(it);; ++#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) || __cplusplus >= 202002L) ++ std::allocator_traits::construct(allocator, &(values[id]), value); ++#else + allocator.construct(&(values[id]), value); ++#endif + } + } + +@@ -121,7 +129,11 @@ namespace lemon { + Item it; + for (nf->first(it); it != INVALID; nf->next(it)) { + int id = nf->id(it);; ++#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) || __cplusplus >= 202002L) ++ std::allocator_traits::construct(allocator, &(values[id]), copy.values[id]); ++#else + allocator.construct(&(values[id]), copy.values[id]); ++#endif + } + } + +@@ -218,15 +230,24 @@ namespace lemon { + for (nf->first(it); it != INVALID; nf->next(it)) { + int jd = nf->id(it);; + if (id != jd) { ++#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) || __cplusplus >= 202002L) ++ std::allocator_traits::construct(allocator, &(new_values[jd]), values[jd]); ++ std::allocator_traits::destroy(allocator, &(values[jd])); ++#else + allocator.construct(&(new_values[jd]), values[jd]); + allocator.destroy(&(values[jd])); ++#endif + } + } + if (capacity != 0) allocator.deallocate(values, capacity); + values = new_values; + capacity = new_capacity; + } ++#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) || __cplusplus >= 202002L) ++ std::allocator_traits::construct(allocator, &(values[id]), Value()); ++#else + allocator.construct(&(values[id]), Value()); ++#endif + } + + // \brief Adds more new keys to the map. +@@ -260,8 +281,13 @@ namespace lemon { + } + } + if (found) continue; ++#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) || __cplusplus >= 202002L) ++ std::allocator_traits::construct(allocator, &(new_values[id]), values[id]); ++ std::allocator_traits::destroy(allocator, &(values[id])); ++#else + allocator.construct(&(new_values[id]), values[id]); + allocator.destroy(&(values[id])); ++#endif + } + if (capacity != 0) allocator.deallocate(values, capacity); + values = new_values; +@@ -269,7 +295,11 @@ namespace lemon { + } + for (int i = 0; i < int(keys.size()); ++i) { + int id = nf->id(keys[i]); ++#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) || __cplusplus >= 202002L) ++ std::allocator_traits::construct(allocator, &(values[id]), Value()); ++#else + allocator.construct(&(values[id]), Value()); ++#endif + } + } + +@@ -279,7 +309,11 @@ namespace lemon { + // and it overrides the erase() member function of the observer base. + virtual void erase(const Key& key) { + int id = Parent::notifier()->id(key); ++#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) || __cplusplus >= 202002L) ++ std::allocator_traits::destroy(allocator, &(values[id])); ++#else + allocator.destroy(&(values[id])); ++#endif + } + + // \brief Erase more keys from the map. +@@ -289,7 +323,11 @@ namespace lemon { + virtual void erase(const std::vector& keys) { + for (int i = 0; i < int(keys.size()); ++i) { + int id = Parent::notifier()->id(keys[i]); ++#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) || __cplusplus >= 202002L) ++ std::allocator_traits::destroy(allocator, &(values[id])); ++#else + allocator.destroy(&(values[id])); ++#endif + } + } + +@@ -303,7 +341,11 @@ namespace lemon { + Item it; + for (nf->first(it); it != INVALID; nf->next(it)) { + int id = nf->id(it);; ++#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) || __cplusplus >= 202002L) ++ std::allocator_traits::construct(allocator, &(values[id]), Value()); ++#else + allocator.construct(&(values[id]), Value()); ++#endif + } + } + +@@ -317,7 +359,11 @@ namespace lemon { + Item it; + for (nf->first(it); it != INVALID; nf->next(it)) { + int id = nf->id(it); ++#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) || __cplusplus >= 202002L) ++ std::allocator_traits::destroy(allocator, &(values[id])); ++#else + allocator.destroy(&(values[id])); ++#endif + } + allocator.deallocate(values, capacity); + capacity = 0; +--- a/lemon/path.h ++++ b/lemon/path.h +@@ -582,7 +582,11 @@ namespace lemon { + void clear() { + while (first != 0) { + last = first->next; ++#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) || __cplusplus >= 202002L) ++ std::allocator_traits>::destroy(alloc, first); ++#else + alloc.destroy(first); ++#endif + alloc.deallocate(first, 1); + first = last; + } +@@ -596,7 +600,11 @@ namespace lemon { + /// \brief Add a new arc before the current path + void addFront(const Arc& arc) { + Node *node = alloc.allocate(1); ++#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) || __cplusplus >= 202002L) ++ std::allocator_traits>::construct(alloc, node, Node()); ++#else + alloc.construct(node, Node()); ++#endif + node->prev = 0; + node->next = first; + node->arc = arc; +@@ -617,7 +625,11 @@ namespace lemon { + } else { + last = 0; + } ++#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) || __cplusplus >= 202002L) ++ std::allocator_traits>::destroy(alloc, node); ++#else + alloc.destroy(node); ++#endif + alloc.deallocate(node, 1); + } + +@@ -629,7 +641,11 @@ namespace lemon { + /// \brief Add a new arc behind the current path. + void addBack(const Arc& arc) { + Node *node = alloc.allocate(1); ++#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) || __cplusplus >= 202002L) ++ std::allocator_traits>::construct(alloc, node, Node()); ++#else + alloc.construct(node, Node()); ++#endif + node->next = 0; + node->prev = last; + node->arc = arc; +@@ -650,7 +666,11 @@ namespace lemon { + } else { + first = 0; + } ++#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) || __cplusplus >= 202002L) ++ std::allocator_traits>::destroy(alloc, node); ++#else + alloc.destroy(node); ++#endif + alloc.deallocate(node, 1); + } + diff --git a/recipes/coin-lemon/all/test_package/CMakeLists.txt b/recipes/coin-lemon/all/test_package/CMakeLists.txt index 5343530b3b283..2230f5888e397 100644 --- a/recipes/coin-lemon/all/test_package/CMakeLists.txt +++ b/recipes/coin-lemon/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.1) project(test_package LANGUAGES CXX) find_package(LEMON CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE LEMON::LEMON) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) 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..0838e4d392f2d 100644 --- a/recipes/coin-osi/all/conandata.yml +++ b/recipes/coin-osi/all/conandata.yml @@ -1,8 +1,20 @@ 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/0.108.6-0001-no-pkg-config-check.patch" + - patch_file: "patches/0.108.6-0002-cpp17-compat.patch" + patch_description: "C++17 compatibility" + patch_type: "portability" + patch_source: "https://github.com/coin-or/Osi/pull/177" "0.108.6": - - patch_file: "patches/0001-no-pkg-config-check.patch" - base_path: "source_subfolder" + - patch_file: "patches/0.108.6-0001-no-pkg-config-check.patch" + - patch_file: "patches/0.108.6-0002-cpp17-compat.patch" + patch_description: "C++17 compatibility" + patch_type: "portability" + patch_source: "https://github.com/coin-or/Osi/pull/177" diff --git a/recipes/coin-osi/all/conanfile.py b/recipes/coin-osi/all/conanfile.py index 798aa130f6fe1..25195bd85f4c6 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.9") 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/2.0.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/patches/0001-no-pkg-config-check.patch b/recipes/coin-osi/all/patches/0.108.6-0001-no-pkg-config-check.patch similarity index 100% rename from recipes/coin-osi/all/patches/0001-no-pkg-config-check.patch rename to recipes/coin-osi/all/patches/0.108.6-0001-no-pkg-config-check.patch diff --git a/recipes/coin-osi/all/patches/0.108.6-0002-cpp17-compat.patch b/recipes/coin-osi/all/patches/0.108.6-0002-cpp17-compat.patch new file mode 100644 index 0000000000000..959cc7915fe50 --- /dev/null +++ b/recipes/coin-osi/all/patches/0.108.6-0002-cpp17-compat.patch @@ -0,0 +1,28 @@ +--- a/Osi/src/OsiCommonTest/OsiSolverInterfaceTest.cpp ++++ b/Osi/src/OsiCommonTest/OsiSolverInterfaceTest.cpp +@@ -1317,8 +1317,9 @@ bool test16SebastianNowozin(OsiSolverInterface *si) + int rows_to_delete_arr[] = { 0 }; + si->deleteRows(1, rows_to_delete_arr); + +- std::transform(objective, objective + 4, objective, +- std::bind2nd(std::plus< double >(), 0.15)); ++ for (int i = 0; i < 4; ++i) { ++ objective[i] += 0.15; ++ } + si->setObjective(objective); + si->resolve(); + OSIUNITTEST_ASSERT_ERROR(si->isProvenOptimal(), return false, *si, "test16SebastianNowozin second resolve"); +--- a/Osi/test/OsiTestSolverInterface.cpp ++++ b/Osi/test/OsiTestSolverInterface.cpp +@@ -464,8 +464,9 @@ OsiTestSolverInterface::resolve() + // Set the dual starting point + VOL_dvector& dsol = volprob_.dsol; + dsol.allocate(dsize); +- std::transform(rowprice_, rowprice_+dsize, dsol.v, +- std::bind2nd(std::multiplies(), objsense_)); ++ for (int i = 0; i < dsize; ++i) { ++ dsol.v[i] = rowprice_[i] * objsense_; ++ } + + // adjust the dual vector (if necessary) to be sure it's feasible + double * dv = dsol.v; 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..7ab87ca07735c 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/2.0.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..b3607270e232e --- /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/2.0.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..b7e4e62e0653d 100644 --- a/recipes/coin-utils/all/conandata.yml +++ b/recipes/coin-utils/all/conandata.yml @@ -1,8 +1,34 @@ sources: + "2.11.10": + url: "https://github.com/coin-or/CoinUtils/archive/releases/2.11.10.tar.gz" + sha256: "80c7c215262df8d6bd2ba171617c5df844445871e9891ec6372df12ccbe5bcfd" + "2.11.9": + url: "https://github.com/coin-or/CoinUtils/archive/releases/2.11.9.tar.gz" + sha256: "15d572ace4cd3b7c8ce117081b65a2bd5b5a4ebaba54fadc99c7a244160f88b8" + "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.10": + - patch_file: "patches/0001-no-check-pkgconfig.patch" + - patch_file: "patches/0003-cpp17-compat.patch" + patch_description: "C++17 compatibility" + patch_type: "portability" + "2.11.9": + - patch_file: "patches/0001-no-check-pkgconfig.patch" + - patch_file: "patches/0003-cpp17-compat.patch" + patch_description: "C++17 compatibility" + patch_type: "portability" + "2.11.6": + - patch_file: "patches/0001-no-check-pkgconfig.patch" + - patch_file: "patches/0002-cpp17-compat.patch" + patch_description: "C++17 compatibility" + patch_type: "portability" "2.11.4": - patch_file: "patches/0001-no-check-pkgconfig.patch" - base_path: "source_subfolder" + - patch_file: "patches/0002-cpp17-compat.patch" + patch_description: "C++17 compatibility" + patch_type: "portability" diff --git a/recipes/coin-utils/all/conanfile.py b/recipes/coin-utils/all/conanfile.py index 43fc93be8d655..78854eb346b37 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,15 @@ 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.11 <2]") + # TODO: add blas and lapack support def validate(self): if self.settings.os == "Windows" and self.options.shared: @@ -70,80 +67,110 @@ 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) - - @contextlib.contextmanager - def _build_context(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 = AutotoolsToolchain(self) + tc.configure_args.append("--without-blas") + tc.configure_args.append("--without-lapack") 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 _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - self._autotools.libs = [] + 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): - 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)), - ] + 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): - configure_args.append(f"--enable-msvc={self.settings.compiler.runtime}") - self._autotools.configure(configure_dir=self._source_subfolder, args=configure_args) - return self._autotools + # 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/patches/0002-cpp17-compat.patch b/recipes/coin-utils/all/patches/0002-cpp17-compat.patch new file mode 100644 index 0000000000000..4e3f9a995048c --- /dev/null +++ b/recipes/coin-utils/all/patches/0002-cpp17-compat.patch @@ -0,0 +1,75 @@ +--- a/CoinUtils/src/CoinOslC.h ++++ b/CoinUtils/src/CoinOslC.h +@@ -34,30 +34,30 @@ + extern "C" { + #endif + +-int c_ekkbtrn(register const EKKfactinfo *fact, ++int c_ekkbtrn(const EKKfactinfo *fact, + double *dwork1, + int *mpt, int first_nonzero); +-int c_ekkbtrn_ipivrw(register const EKKfactinfo *fact, ++int c_ekkbtrn_ipivrw(const EKKfactinfo *fact, + double *dwork1, + int *mpt, int ipivrw, int *spare); + +-int c_ekketsj(register /*const*/ EKKfactinfo *fact, ++int c_ekketsj(/*const*/ EKKfactinfo *fact, + double *dwork1, + int *mpt2, double dalpha, int orig_nincol, + int npivot, int *nuspikp, + const int ipivrw, int *spare); +-int c_ekkftrn(register const EKKfactinfo *fact, ++int c_ekkftrn(const EKKfactinfo *fact, + double *dwork1, + double *dpermu, int *mpt, int numberNonZero); + +-int c_ekkftrn_ft(register EKKfactinfo *fact, ++int c_ekkftrn_ft(EKKfactinfo *fact, + double *dwork1, int *mpt, int *nincolp); +-void c_ekkftrn2(register EKKfactinfo *fact, double *dwork1, ++void c_ekkftrn2(EKKfactinfo *fact, double *dwork1, + double *dpermu1, int *mpt1, int *nincolp, + double *dwork1_ft, int *mpt_ft, int *nincolp_ft); + +-int c_ekklfct(register EKKfactinfo *fact); +-int c_ekkslcf(register const EKKfactinfo *fact); ++int c_ekklfct(EKKfactinfo *fact); ++int c_ekkslcf(const EKKfactinfo *fact); + inline void c_ekkscpy(int n, const int *marr1, int *marr2) + { + CoinMemcpyN(marr1, n, marr2); +--- a/CoinUtils/src/CoinOslFactorization2.cpp ++++ b/CoinUtils/src/CoinOslFactorization2.cpp +@@ -21,9 +21,9 @@ + extern int ets_count; + extern int ets_check; + #endif +-#define COIN_REGISTER register ++#define COIN_REGISTER + #define COIN_REGISTER2 +-#define COIN_REGISTER3 register ++#define COIN_REGISTER3 + #ifdef COIN_USE_RESTRICT + #define COIN_RESTRICT2 __restrict + #else +--- a/CoinUtils/src/CoinOslFactorization3.cpp ++++ b/CoinUtils/src/CoinOslFactorization3.cpp +@@ -1362,7 +1362,7 @@ static void c_ekkmltf(const EKKfactinfo *fact, double *dluval, int *hcoli, + } + } + } /* c_ekkmltf */ +-int c_ekklfct(register EKKfactinfo *fact) ++int c_ekklfct(EKKfactinfo *fact) + { + const int nrow = fact->nrow; + int ninbas = fact->xcsadr[nrow + 1] - 1; +@@ -2591,7 +2591,7 @@ inline void c_ekkclcp2(const int *hcol, const double *dels, const int *mrstrt, + } + } + } /* c_ekkclcp */ +-int c_ekkslcf(register const EKKfactinfo *fact) ++int c_ekkslcf(const EKKfactinfo *fact) + { + int *hrow = fact->xeradr; + int *hcol = fact->xecadr; diff --git a/recipes/coin-utils/all/patches/0003-cpp17-compat.patch b/recipes/coin-utils/all/patches/0003-cpp17-compat.patch new file mode 100644 index 0000000000000..355ff4f097705 --- /dev/null +++ b/recipes/coin-utils/all/patches/0003-cpp17-compat.patch @@ -0,0 +1,55 @@ +--- a/CoinUtils/src/CoinOslC.h ++++ b/CoinUtils/src/CoinOslC.h +@@ -34,30 +34,30 @@ + extern "C" { + #endif + +-int c_ekkbtrn(register const EKKfactinfo *fact, ++int c_ekkbtrn(const EKKfactinfo *fact, + double *dwork1, + int *mpt, int first_nonzero); +-int c_ekkbtrn_ipivrw(register const EKKfactinfo *fact, ++int c_ekkbtrn_ipivrw(const EKKfactinfo *fact, + double *dwork1, + int *mpt, int ipivrw, int *spare); + +-int c_ekketsj(register /*const*/ EKKfactinfo *fact, ++int c_ekketsj(/*const*/ EKKfactinfo *fact, + double *dwork1, + int *mpt2, double dalpha, int orig_nincol, + int npivot, int *nuspikp, + const int ipivrw, int *spare); +-int c_ekkftrn(register const EKKfactinfo *fact, ++int c_ekkftrn(const EKKfactinfo *fact, + double *dwork1, + double *dpermu, int *mpt, int numberNonZero); + +-int c_ekkftrn_ft(register EKKfactinfo *fact, ++int c_ekkftrn_ft(EKKfactinfo *fact, + double *dwork1, int *mpt, int *nincolp); +-void c_ekkftrn2(register EKKfactinfo *fact, double *dwork1, ++void c_ekkftrn2(EKKfactinfo *fact, double *dwork1, + double *dpermu1, int *mpt1, int *nincolp, + double *dwork1_ft, int *mpt_ft, int *nincolp_ft); + +-int c_ekklfct(register EKKfactinfo *fact); +-int c_ekkslcf(register const EKKfactinfo *fact); ++int c_ekklfct(EKKfactinfo *fact); ++int c_ekkslcf(const EKKfactinfo *fact); + inline void c_ekkscpy(int n, const int *marr1, int *marr2) + { + CoinMemcpyN(marr1, n, marr2); +--- a/CoinUtils/src/CoinOslFactorization2.cpp ++++ b/CoinUtils/src/CoinOslFactorization2.cpp +@@ -21,9 +21,9 @@ + extern int ets_count; + extern int ets_check; + #endif +-#define COIN_REGISTER register ++#define COIN_REGISTER + #define COIN_REGISTER2 +-#define COIN_REGISTER3 register ++#define COIN_REGISTER3 + #ifdef COIN_USE_RESTRICT + #define COIN_RESTRICT2 __restrict + #else diff --git a/recipes/coin-utils/all/test_package/CMakeLists.txt b/recipes/coin-utils/all/test_package/CMakeLists.txt index d3a4cd73e4668..843123daf5450 100644 --- a/recipes/coin-utils/all/test_package/CMakeLists.txt +++ b/recipes/coin-utils/all/test_package/CMakeLists.txt @@ -1,12 +1,11 @@ -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}_pkgconfig test_package.cpp) +target_link_libraries(${PROJECT_NAME}_pkgconfig PRIVATE PkgConfig::CoinUtils) -add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE PkgConfig::CoinUtils) +find_package(coin-utils REQUIRED CONFIG) +add_executable(${PROJECT_NAME}_cmake test_package.cpp) +target_link_libraries(${PROJECT_NAME}_cmake PRIVATE coin-utils::coin-utils) diff --git a/recipes/coin-utils/all/test_package/conanfile.py b/recipes/coin-utils/all/test_package/conanfile.py index a76b4ec929926..0a6ce61d2c57d 100644 --- a/recipes/coin-utils/all/test_package/conanfile.py +++ b/recipes/coin-utils/all/test_package/conanfile.py @@ -1,20 +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, 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", "CMakeDeps", "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/2.0.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.bindir, "test_package_pkgconfig") + self.run(bin_path, env="conanrun") + bin_path = os.path.join(self.cpp.build.bindir, "test_package_cmake") + 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..340d3fd656e33 --- /dev/null +++ b/recipes/coin-utils/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", "pkg_config" + + def build_requirements(self): + self.build_requires("pkgconf/2.0.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_pkgconfig") + self.run(bin_path, run_environment=True) + bin_path = os.path.join("bin", "test_package_cmake") + self.run(bin_path, run_environment=True) diff --git a/recipes/coin-utils/config.yml b/recipes/coin-utils/config.yml index 2cbd50d2508a1..3e9050a77e486 100644 --- a/recipes/coin-utils/config.yml +++ b/recipes/coin-utils/config.yml @@ -1,3 +1,9 @@ versions: + "2.11.10": + folder: "all" + "2.11.9": + folder: "all" + "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..157169467da5a --- /dev/null +++ b/recipes/commata/all/conandata.yml @@ -0,0 +1,40 @@ +sources: + "1.0.1": + url: "https://github.com/furfurylic/commata/archive/refs/tags/v1.0.1.tar.gz" + sha256: "b6e91ede0ec8b7c69ced1e243eba204717e05fcd9ae26163a54425ca800124ef" + "1.0.0": + url: "https://github.com/furfurylic/commata/archive/refs/tags/v1.0.0.tar.gz" + sha256: "ecf0a88f6a4616d10770522b4ef4838e4100511759eb640270f6b932e4b7df69" + "0.2.9": + url: "https://github.com/furfurylic/commata/archive/refs/tags/v0.2.9.tar.gz" + sha256: "24c404e90e2f01a2f9e46e55c2f8121a3f146d1f2dfb819b8d7ab5cf13bd6a9f" + "0.2.8": + url: "https://github.com/furfurylic/commata/archive/refs/tags/v0.2.8.tar.gz" + sha256: "a762ec3ef1549aa5aebef78a160a40ee16d396fd976154f1f5c160837d145c8a" + "0.2.7": + url: "https://github.com/furfurylic/commata/archive/refs/tags/v0.2.7.tar.gz" + sha256: "3feeeea8eafa67a0f328382380f193df9a798665e10333e9e5b6db5fe1794283" + "0.2.6-bug1": + url: "https://github.com/furfurylic/commata/archive/refs/tags/v0.2.6-bug1.tar.gz" + sha256: "141eb86f9033a808b6ead22a9367fc4d18a3047f55255ddf67d60e90f46b8f60" + "0.2.6": + url: "https://github.com/furfurylic/commata/archive/refs/tags/v0.2.6.tar.gz" + sha256: "bc91f496cb261e5627fb39d8e79d1aaa924975332d9957de4cb4097db6957815" + "0.2.5": + url: "https://github.com/furfurylic/commata/archive/refs/tags/v0.2.5.tar.gz" + sha256: "d1be1f366267af6c466c29f846f5968f57626a8a6635a2ea9a3de3f6fb88e53b" +patches: + "0.2.9": + - patch_file: "patches/0.2.9-0001-include-set.patch" + patch_description: "include header" + patch_type: "portability" + patch_source: "https://github.com/furfurylic/commata/pull/3" + - patch_file: "patches/0.2.9-0002-additional-missing-includes.patch" + patch_description: "add more missing headers" + patch_type: "portability" + patch_source: "https://github.com/furfurylic/commata/commit/07c6f43f0fae0237569d12420aded35f8ccf792f" + "0.2.7": + - patch_file: "patches/0.2.7-0001-include-optional.patch" + patch_description: "include header" + patch_type: "portability" + patch_source: "https://github.com/furfurylic/commata/pull/2" diff --git a/recipes/commata/all/conanfile.py b/recipes/commata/all/conanfile.py new file mode 100644 index 0000000000000..6ca8695676403 --- /dev/null +++ b/recipes/commata/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 get, copy, export_conandata_patches, apply_conandata_patches +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") + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + + @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 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) + 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): + 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 = [] diff --git a/recipes/commata/all/patches/0.2.7-0001-include-optional.patch b/recipes/commata/all/patches/0.2.7-0001-include-optional.patch new file mode 100644 index 0000000000000..3ad57ce44c1c1 --- /dev/null +++ b/recipes/commata/all/patches/0.2.7-0001-include-optional.patch @@ -0,0 +1,12 @@ +diff --git a/include/commata/typing_aid.hpp b/include/commata/typing_aid.hpp +index adf9c6e..c1365d4 100644 +--- a/include/commata/typing_aid.hpp ++++ b/include/commata/typing_aid.hpp +@@ -10,6 +10,7 @@ + #include + #include + #include ++#include + + namespace commata::detail { + diff --git a/recipes/commata/all/patches/0.2.9-0001-include-set.patch b/recipes/commata/all/patches/0.2.9-0001-include-set.patch new file mode 100644 index 0000000000000..1519e2f79a965 --- /dev/null +++ b/recipes/commata/all/patches/0.2.9-0001-include-set.patch @@ -0,0 +1,12 @@ +diff --git a/include/commata/field_scanners.hpp b/include/commata/field_scanners.hpp +index 9b19b8c..9606732 100644 +--- a/include/commata/field_scanners.hpp ++++ b/include/commata/field_scanners.hpp +@@ -15,6 +15,7 @@ + #include + #include + #include ++#include + + #include "text_error.hpp" + #include "text_value_translation.hpp" diff --git a/recipes/commata/all/patches/0.2.9-0002-additional-missing-includes.patch b/recipes/commata/all/patches/0.2.9-0002-additional-missing-includes.patch new file mode 100644 index 0000000000000..87671798cc1bd --- /dev/null +++ b/recipes/commata/all/patches/0.2.9-0002-additional-missing-includes.patch @@ -0,0 +1,14 @@ +diff --git a/include/commata/field_handling.hpp b/include/commata/field_handling.hpp +index 04ab67e..8b438b6 100644 +--- a/include/commata/field_handling.hpp ++++ b/include/commata/field_handling.hpp +@@ -6,7 +6,9 @@ + #ifndef COMMATA_GUARD_CD40E918_ACCD_4879_BB48_7D9B8B823369 + #define COMMATA_GUARD_CD40E918_ACCD_4879_BB48_7D9B8B823369 + ++#include + #include ++#include + + namespace commata { + diff --git a/recipes/commata/all/test_package/CMakeLists.txt b/recipes/commata/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..71a8908c0e315 --- /dev/null +++ b/recipes/commata/all/test_package/CMakeLists.txt @@ -0,0 +1,12 @@ +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) + +if (commata_VERSION VERSION_LESS "0.2.7") + target_compile_definitions(${PROJECT_NAME} PRIVATE "COMMATA_VERSION_LESS_0_2_7") +endif() 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..bb1415b5814ab --- /dev/null +++ b/recipes/commata/all/test_package/test_package.cpp @@ -0,0 +1,62 @@ +#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); +#ifdef COMMATA_VERSION_LESS_0_2_7 + commata::parse_csv(&buf, collector); +#else + commata::parse_csv(buf, collector); +#endif + + 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/quill/all/test_v1_package/conanfile.py b/recipes/commata/all/test_v1_package/conanfile.py similarity index 100% rename from recipes/quill/all/test_v1_package/conanfile.py rename to recipes/commata/all/test_v1_package/conanfile.py diff --git a/recipes/commata/config.yml b/recipes/commata/config.yml new file mode 100644 index 0000000000000..0cc9df6999a12 --- /dev/null +++ b/recipes/commata/config.yml @@ -0,0 +1,17 @@ +versions: + "1.0.1": + folder: all + "1.0.0": + folder: all + "0.2.9": + folder: all + "0.2.8": + folder: all + "0.2.7": + folder: all + "0.2.6-bug1": + folder: all + "0.2.6": + folder: all + "0.2.5": + folder: all diff --git a/recipes/compute_library/all/conandata.yml b/recipes/compute_library/all/conandata.yml new file mode 100644 index 0000000000000..3b952c4dbb5e0 --- /dev/null +++ b/recipes/compute_library/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "23.08": + url: "https://github.com/ARM-software/ComputeLibrary/archive/refs/tags/v23.08.tar.gz" + sha256: "62f514a555409d4401e5250b290cdf8cf1676e4eb775e5bd61ea6a740a8ce24f" + "23.02.1": + url: "https://github.com/ARM-software/ComputeLibrary/archive/refs/tags/v23.02.1.tar.gz" + sha256: "c3a443e26539f866969242e690cf0651ef629149741ee18732f954c734da6763" diff --git a/recipes/compute_library/all/conanfile.py b/recipes/compute_library/all/conanfile.py new file mode 100644 index 0000000000000..6becfaaa8f1bb --- /dev/null +++ b/recipes/compute_library/all/conanfile.py @@ -0,0 +1,149 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import get, copy, rm, chdir +from conan.tools.build import check_min_cppstd, cross_building, build_jobs +from conan.tools.scm import Version +from conan.tools.env import VirtualBuildEnv +from conan.tools.gnu import AutotoolsDeps, AutotoolsToolchain +from conan.tools.layout import basic_layout +import os + + +required_conan_version = ">=1.53.0" + + +class ComputeLibraryConan(ConanFile): + name = "compute_library" + description = "The Compute Library is a set of computer vision and machine learning functions optimized for both Arm CPUs and GPUs using SIMD technologies" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/ARM-software/ComputeLibrary" + topics = ("android", "linux", "machine-learning", "arm", "computer-vision", "neural-network") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "enable_openmp": [True, False], + "enable_opencl": [True, False], + "enable_neon": [True, False], + "enable_multi_isa": [True, False], + } + default_options = { + "shared": False, + "enable_openmp": False, + "enable_opencl": True, + "enable_neon": True, + "enable_multi_isa": False, + } + + @property + def _min_cppstd(self): + return 14 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "6", + "clang": "5", + "apple-clang": "5.1", + } + + def config_options(self): + # INFO: Neon option is reserved to arm architecture + if "arm" not in str(self.settings.arch): + del self.options.enable_neon + # INFO: OpenMP option only works with g++, according to the documentation + if self.settings.compiler == "clang": + del self.options.enable_openmp + # INFO: OpenCL fails to build with MacOS + if self.settings.os == "Macos": + del self.options.enable_opencl + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + basic_layout(self, src_folder="src") + + def build_requirements(self): + self.tool_requires("scons/4.3.0") + + def requirements(self): + if self.options.get_safe("enable_opencl"): + self.requires("opencl-headers/2023.04.17") + + 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.") + # INFO: https://github.com/ARM-software/ComputeLibrary#supported-systems + supported_os = ["Android", "Linux", "OpenBSD", "Macos", "Tizen", "Windows"] + if str(self.settings.os) not in supported_os: + raise ConanInvalidConfiguration(f"{self.ref} does not support {self.settings.os}. It is only supported on {supported_os}.") + if self.settings.os == "Windows": + if cross_building(self): + # INFO: https://arm-software.github.io/ComputeLibrary/latest/how_to_build.xhtml#S1_6_windows_host + raise ConanInvalidConfiguration(f"Using scons directly from the Windows command line is known to cause problems. Please, try native native build on Windows ARM or cross-build on Linux Ubuntu.") + if "arm" in str(self.settings.arch): + # INFO: https://arm-software.github.io/ComputeLibrary/latest/how_to_build.xhtml#S1_6_3_WoA + self.output.warn("Native builds on Windows are experimental and some features from the library interacting with the OS are missing.") + if "x86" in str(self.settings.arch): + raise ConanInvalidConfiguration(f"{self.ref} does not support native builds on Windows x86/x86_64. It is only supported on Windows ARM.") + if "arm" not in str(self.settings.arch) and "x86" not in str(self.settings.arch): + # INFO: https://github.com/ARM-software/ComputeLibrary#supported-architecturestechnologies + raise ConanInvalidConfiguration(f"{self.ref} does not support {self.settings.arch}. It is only supported on arm and x86.") + if "x86" in str(self.settings.arch) and self.settings.os != "Macos" and not self.options.get_safe("enable_opencl", False): + raise ConanInvalidConfiguration(f"{self.ref} can be built for x86_64 targets only with enable_neon=False and enable_opencl=True.") + if self.settings.os == "Linux" and self.settings.compiler == "clang": + # INFO: https://arm-software.github.io/ComputeLibrary/latest/how_to_build.xhtml#S1_2_linux + raise ConanInvalidConfiguration(f"{self.ref} does not support Linux with clang. It is only supported on Linux with gcc.") + if "armv8" not in str(self.settings.arch) and self.options.enable_multi_isa: + raise ConanInvalidConfiguration(f"{self.ref} does not support multi_isa option for {self.settings.arch}. It is only supported on armv8.") + if self.settings.arch == "armv8" and self.settings_build.arch == "x86_64" and self.settings.os == "Macos" and self.settings.compiler == "apple-clang": + raise ConanInvalidConfiguration(f"Mac Intel is not supported for armv8-a. Please, use Mac M1 as native build.") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = AutotoolsToolchain(self) + tc.generate() + tc = AutotoolsDeps(self) + tc.generate() + tc = VirtualBuildEnv(self) + tc.generate(scope="build") + + def build(self): + # INFO: Using scons to build the library we don't have control over shared/static and install step, it is done all together always + # INFO: https://arm-software.github.io/ComputeLibrary/latest/how_to_build.xhtml + yes_no = lambda v: "1" if v else "0" + debug = yes_no(self.settings.build_type == "Debug") + build_os = str(self.settings.os).lower() + arch = {"armv8": "armv8a", "x86": "x86_32", "armv7": "armv7a", "armv7hf": "armv7a-hf"}.get(str(self.settings.arch), str(self.settings.arch)) + neon = yes_no(self.options.get_safe("enable_neon")) + opencl = yes_no(self.options.get_safe("enable_opencl", False)) + openmp = yes_no(self.options.get_safe("enable_openmp")) + multi_isa = yes_no(self.options.enable_multi_isa) + build = "cross_compile" if cross_building(self) else "native" + with chdir(self, self.source_folder): + self.run(f"scons Werror=0 validation_tests=0 examples=0 gemm_tuner=0 multi_isa={multi_isa} openmp={openmp} debug={debug} neon={neon} opencl={opencl} os={build_os} arch={arch} build={build} build_dir={self.build_folder} install_dir={self.package_folder} -j{build_jobs(self)} toolchain_prefix=''", env="conanbuild") + + def package(self): + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + # INFO: Artifacts are installed during build step, so we just need to remove what we don't want + rm(self, "*.bazel", self.package_folder, recursive=True) + rm(self, "*.cpp", self.package_folder, recursive=True) + if self.options.shared: + rm(self, "*.a", os.path.join(self.package_folder, "lib")) + else: + rm(self, "*.so*", os.path.join(self.package_folder, "lib")) + rm(self, "*.dylib*", os.path.join(self.package_folder, "lib")) + + def package_info(self): + suffix = "" if self.options.shared else "-static" + self.cpp_info.libs = [f"arm_compute{suffix}", f"arm_compute_core{suffix}", f"arm_compute_graph{suffix}"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs = ["m", "pthread"] diff --git a/recipes/compute_library/all/test_package/CMakeLists.txt b/recipes/compute_library/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..4c1184efde1e9 --- /dev/null +++ b/recipes/compute_library/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package CXX) + +find_package(compute_library REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE compute_library::compute_library) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/compute_library/all/test_package/conanfile.py b/recipes/compute_library/all/test_package/conanfile.py new file mode 100644 index 0000000000000..ef5d7042163ec --- /dev/null +++ b/recipes/compute_library/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/compute_library/all/test_package/test_package.cpp b/recipes/compute_library/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..2457b9908b8ac --- /dev/null +++ b/recipes/compute_library/all/test_package/test_package.cpp @@ -0,0 +1,11 @@ +#include +#include +#include "arm_compute/core/Version.h" + + +int main(void) { + std::cout << "ComputeLibrary information:" << std::endl; + std::cout << arm_compute::build_information() << std::endl; + + return EXIT_SUCCESS; +} diff --git a/recipes/compute_library/config.yml b/recipes/compute_library/config.yml new file mode 100644 index 0000000000000..118236bce990b --- /dev/null +++ b/recipes/compute_library/config.yml @@ -0,0 +1,5 @@ +versions: + "23.08": + folder: all + "23.02.1": + folder: all diff --git a/recipes/concurrencpp/all/conandata.yml b/recipes/concurrencpp/all/conandata.yml index 1ea38721cc28a..65da3e9e96d97 100644 --- a/recipes/concurrencpp/all/conandata.yml +++ b/recipes/concurrencpp/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "0.1.7": + url: "https://github.com/David-Haim/concurrencpp/archive/refs/tags/v.0.1.7.tar.gz" + sha256: "049f3e83ad1828e0b8b518652de1a3160d5849fdff03d521d0a5af0167338e89" + "0.1.6": + url: "https://github.com/David-Haim/concurrencpp/archive/refs/tags/v.0.1.6.tar.gz" + sha256: "e7d5c23a73ff1d7199d361d3402ad2a710dfccf7630b622346df94a7532b4221" "0.1.5": url: "https://github.com/David-Haim/concurrencpp/archive/refs/tags/v.0.1.5.tar.gz" sha256: "330150ebe11b3d30ffcb3efdecc184a34cf50a6bd43b68e294a496225d286651" @@ -6,6 +12,12 @@ sources: url: "https://github.com/David-Haim/concurrencpp/archive/refs/tags/v.0.1.4.tar.gz" sha256: "3ad9424f975b766accc6eaedf4acfe1a20b5fdbb57fa3ae71f400e13d471e86f" patches: + "0.1.7": + - patch_file: "patches/cmake-min-version.patch" + - patch_file: "patches/directory-name-0.1.6.patch" + "0.1.6": + - patch_file: "patches/cmake-min-version.patch" + - patch_file: "patches/directory-name-0.1.6.patch" "0.1.5": - patch_file: "patches/cmake-min-version.patch" - patch_file: "patches/directory-name-0.1.5.patch" diff --git a/recipes/concurrencpp/all/conanfile.py b/recipes/concurrencpp/all/conanfile.py index b561687e537bb..63a26ab91e6ec 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,21 @@ 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", + "gcc": "13", + } + 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,48 +50,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 Version(self.version) <= "0.1.5" and 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 Version(self.version) <= "0.1.6" and self.settings.compiler == "gcc": raise ConanInvalidConfiguration("gcc is not supported by concurrencpp") - if Version(self.version) >= "0.1.5" and self.info.settings.compiler == "apple-clang": + 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.6.patch b/recipes/concurrencpp/all/patches/directory-name-0.1.6.patch new file mode 100644 index 0000000000000..8a56c4af6669b --- /dev/null +++ b/recipes/concurrencpp/all/patches/directory-name-0.1.6.patch @@ -0,0 +1,14 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -116,8 +116,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 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 5fafcacd7c8fb..d1f158a132019 100644 --- a/recipes/concurrencpp/config.yml +++ b/recipes/concurrencpp/config.yml @@ -1,4 +1,8 @@ versions: + "0.1.7": + folder: all + "0.1.6": + folder: all "0.1.5": folder: all "0.1.4": diff --git a/recipes/concurrentqueue/all/conandata.yml b/recipes/concurrentqueue/all/conandata.yml index 4a3b84f1e1032..01e2ad199f983 100644 --- a/recipes/concurrentqueue/all/conandata.yml +++ b/recipes/concurrentqueue/all/conandata.yml @@ -1,10 +1,13 @@ sources: + "1.0.4": + url: "https://github.com/cameron314/concurrentqueue/archive/refs/tags/v1.0.4.tar.gz" + sha256: "87fbc9884d60d0d4bf3462c18f4c0ee0a9311d0519341cac7cbd361c885e5281" "1.0.3": - url: https://github.com/cameron314/concurrentqueue/archive/v1.0.3.zip - sha256: 5e9e229a1791e8299dcd4bd73ac1be1953424a903818feb7afd929eb16094ef5 + url: "https://github.com/cameron314/concurrentqueue/archive/refs/tags/v1.0.3.tar.gz" + sha256: "eb37336bf9ae59aca7b954db3350d9b30d1cab24b96c7676f36040aa76e915e8" "1.0.2": - url: https://github.com/cameron314/concurrentqueue/archive/v1.0.2.zip - sha256: 6dc85de0e38a014471fe3c653e3e21dc38a5f069cfc031a90fa59f0a45f7584f + url: "https://github.com/cameron314/concurrentqueue/archive/refs/tags/v1.0.2.tar.gz" + sha256: "c3aeb97c97169f743a53ca33812ea2ab61dd06dfd28319ca3f0a0771372fc7fc" "1.0.1": - url: https://github.com/cameron314/concurrentqueue/archive/v1.0.1.zip - sha256: b31dca11745ef331756109af838e3689462fbbc2c52dda9f7e1c416778f1f35b + url: "https://github.com/cameron314/concurrentqueue/archive/refs/tags/v1.0.1.tar.gz" + sha256: "7e715c793001e01851448320e8a416b80342b2e75db46d4c978e990a506060e6" diff --git a/recipes/concurrentqueue/all/conanfile.py b/recipes/concurrentqueue/all/conanfile.py index 866dbaf480b38..fe58e688dd504 100644 --- a/recipes/concurrentqueue/all/conanfile.py +++ b/recipes/concurrentqueue/all/conanfile.py @@ -9,27 +9,31 @@ class ConcurrentqueueConan(ConanFile): name = "concurrentqueue" + description = "A fast multi-producer, multi-consumer lock-free concurrent queue for C++11" + license = ["BSD-2-Clause", "BSL-1.0"] url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/cameron314/concurrentqueue" - description = "A fast multi-producer, multi-consumer lock-free concurrent queue for C++11" topics = ("cpp11", "cpp14", "cpp17", "queue", "lock-free") - license = ["BSD-2-Clause", "BSL-1.0"] + package_type = "header-library" 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, 11) - - def layout(self): - basic_layout(self, src_folder="src") + 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def build(self): pass @@ -44,8 +48,6 @@ def package_info(self): self.cpp_info.set_property("cmake_target_name", "concurrentqueue::concurrentqueue") self.cpp_info.includedirs.append(os.path.join("include", "moodycamel")) 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"] diff --git a/recipes/concurrentqueue/all/test_package/conanfile.py b/recipes/concurrentqueue/all/test_package/conanfile.py index d120a992c06a6..8a5bb47f50c4c 100644 --- a/recipes/concurrentqueue/all/test_package/conanfile.py +++ b/recipes/concurrentqueue/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/concurrentqueue/config.yml b/recipes/concurrentqueue/config.yml index df27cd90727cc..ba8a25151dfc3 100644 --- a/recipes/concurrentqueue/config.yml +++ b/recipes/concurrentqueue/config.yml @@ -1,4 +1,6 @@ versions: + "1.0.4": + folder: all "1.0.3": folder: all "1.0.2": diff --git a/recipes/confu_json/all/conandata.yml b/recipes/confu_json/all/conandata.yml index a3a9fc5d26fcf..5d78ae9d25a41 100644 --- a/recipes/confu_json/all/conandata.yml +++ b/recipes/confu_json/all/conandata.yml @@ -1,10 +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/v0.0.10.tar.gz" + 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 b07b03aef2ff9..337baede02ad0 100644 --- a/recipes/confu_json/config.yml +++ b/recipes/confu_json/config.yml @@ -1,7 +1,9 @@ versions: - 0.0.5: - folder: all - 0.0.9: + "1.0.0": folder: all "0.0.10": folder: all + "0.0.9": + folder: all + "0.0.5": + folder: all diff --git a/recipes/console_bridge/all/conandata.yml b/recipes/console_bridge/all/conandata.yml new file mode 100644 index 0000000000000..b08e5584e75a4 --- /dev/null +++ b/recipes/console_bridge/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.0.2": + url: "https://github.com/ros/console_bridge/archive/refs/tags/1.0.2.tar.gz" + sha256: "303a619c01a9e14a3c82eb9762b8a428ef5311a6d46353872ab9a904358be4a4" diff --git a/recipes/console_bridge/all/conanfile.py b/recipes/console_bridge/all/conanfile.py new file mode 100644 index 0000000000000..489534f60bd16 --- /dev/null +++ b/recipes/console_bridge/all/conanfile.py @@ -0,0 +1,79 @@ +import os + +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, rmdir + +required_conan_version = ">=1.53.0" + + +class PackageConan(ConanFile): + name = "console_bridge" + description = "A ROS-independent library for logging that seamlessly pipes into rosconsole/rosout for ROS-dependent packages" + license = "BSD-3-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/ros/console_bridge" + topics = ("logging", "ros", "robotics") + package_type = "library" + 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 + + 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): + pass + + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.generate() + CMakeDeps(self).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() + + rm(self, "*.pdb", os.path.join(self.package_folder)) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "console_bridge")) + rmdir(self, os.path.join(self.package_folder, "CMake")) + + def package_info(self): + self.cpp_info.libs = ["console_bridge"] + + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs = ["m"] diff --git a/recipes/console_bridge/all/test_package/CMakeLists.txt b/recipes/console_bridge/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..c15ea1a1502bc --- /dev/null +++ b/recipes/console_bridge/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package CXX) + +find_package(console_bridge REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE console_bridge::console_bridge) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/console_bridge/all/test_package/conanfile.py b/recipes/console_bridge/all/test_package/conanfile.py new file mode 100644 index 0000000000000..ef5d7042163ec --- /dev/null +++ b/recipes/console_bridge/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/console_bridge/all/test_package/test_package.cpp b/recipes/console_bridge/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..1c02a2b52e784 --- /dev/null +++ b/recipes/console_bridge/all/test_package/test_package.cpp @@ -0,0 +1,9 @@ +#include + +#include + +int main() { + console_bridge::setLogLevel(console_bridge::CONSOLE_BRIDGE_LOG_DEBUG); + CONSOLE_BRIDGE_logInform("CONSOLE_BRIDGE_logInform() ran successfully"); + return EXIT_SUCCESS; +} diff --git a/recipes/console_bridge/config.yml b/recipes/console_bridge/config.yml new file mode 100644 index 0000000000000..8457ca9a4a8cd --- /dev/null +++ b/recipes/console_bridge/config.yml @@ -0,0 +1,3 @@ +versions: + "1.0.2": + folder: all diff --git a/recipes/continuable/all/conandata.yml b/recipes/continuable/all/conandata.yml index b1c9fe04e8ebc..15db65fb152ed 100644 --- a/recipes/continuable/all/conandata.yml +++ b/recipes/continuable/all/conandata.yml @@ -1,7 +1,13 @@ sources: + "4.2.2": + url: "https://github.com/Naios/continuable/archive/4.2.2.tar.gz" + sha256: "49bf82a349b26c01194631e4fe5d1dbad080b3b4a347eebc5cf95326ea130fba" + "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" "4.1.0": - sha256: "CBCF50B1B73D8B4EB54734C827D6736CD038960E13F80699958DBB87F1827650" url: "https://github.com/Naios/continuable/archive/4.1.0.tar.gz" + sha256: "CBCF50B1B73D8B4EB54734C827D6736CD038960E13F80699958DBB87F1827650" diff --git a/recipes/continuable/all/conanfile.py b/recipes/continuable/all/conanfile.py index 7a8754a12145a..2713e8d38ceb7 100644 --- a/recipes/continuable/all/conanfile.py +++ b/recipes/continuable/all/conanfile.py @@ -1,35 +1,33 @@ 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 copy, get +from conan.tools.layout import basic_layout +from conan.tools.scm import Version - -required_conan_version = ">=1.28.0" +required_conan_version = ">=1.52.0" class ContinuableConan(ConanFile): name = "continuable" - description = "C++14 asynchronous allocation aware futures (supporting then, exception handling, coroutines and connections)" - topics = "asynchronous", "future", "coroutines", "header-only" + description = ( + "C++14 asynchronous allocation aware futures " + "(supporting then, exception handling, coroutines and connections)" + ) + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/Naios/continuable" - license = "MIT" - settings = "os", "compiler" - no_copy_source = True - requires = ( - "function2/4.1.0", - ) + topics = ("asynchronous", "future", "coroutines", "header-only") + + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" options = { - # Exceptions are disabled and `std::error_condition` is used as error_type. See tutorial-chaining-continuables-fail for details. "no_exceptions": [True, False], - # Exceptions are disabled and the type defined by `CONTINUABLE_WITH_CUSTOM_ERROR_TYPE` is used as error_type. - # See tutorial-chaining-continuables-fail for details. "custom_error_type": [True, False], - # Allows unhandled exceptions in asynchronous call hierarchies. See tutorial-chaining-continuables-fail for details. "unhandled_exceptions": [True, False], - # Allows to customize the final callback which can be used to implement custom unhandled asynchronous exception handlers. "custom_final_callback": [True, False], - # Don"t decorate the used type erasure, which is done to keep type names minimal for better error messages in debug builds. "immediate_types": [True, False], } default_options = { @@ -37,44 +35,84 @@ class ContinuableConan(ConanFile): "custom_error_type": False, "unhandled_exceptions": False, "custom_final_callback": False, - "immediate_types": False + "immediate_types": False, + } + options_description = { + "no_exceptions": ( + "Exceptions are disabled and `std::error_condition` is used as error_type. " + "See tutorial-chaining-continuables-fail for details." + ), + "custom_error_type": ( + "Exceptions are disabled and the type defined by `CONTINUABLE_WITH_CUSTOM_ERROR_TYPE` " + "is used as error_type. See tutorial-chaining-continuables-fail for details." + ), + "unhandled_exceptions": ( + "Allows unhandled exceptions in asynchronous call hierarchies. " + "See tutorial-chaining-continuables-fail for details." + ), + "custom_final_callback": ( + "Allows to customize the final callback which can be used to implement custom unhandled" + " asynchronous exception handlers." + ), + "immediate_types": ( + "Don't decorate the used type erasure, " + "which is done to keep type names minimal for better error messages in debug builds." + ), } + no_copy_source = True @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 14 - def validate(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": "5", "clang": "3.4", "apple-clang": "10", - "Visual Studio": "14" + "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)) + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("function2/4.2.4") + + 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): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = "continuable-" + 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.txt", dst="licenses", src=self._source_subfolder) - self.copy(pattern="*", dst=os.path.join("include", "continuable"), src=os.path.join(self._source_subfolder, "include", "continuable")) + copy( + self, + pattern="LICENSE.txt", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder, + ) + copy( + self, + pattern="*", + dst=os.path.join(self.package_folder, "include", "continuable"), + src=os.path.join(self.source_folder, "include", "continuable"), + ) def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + if self.settings.os == "Linux": self.cpp_info.system_libs.append("pthread") if self.options.no_exceptions: @@ -87,6 +125,3 @@ def package_info(self): self.cpp_info.defines.append("CONTINUABLE_WITH_CUSTOM_FINAL_CALLBACK") if self.options.immediate_types: self.cpp_info.defines.append("CONTINUABLE_WITH_IMMEDIATE_TYPES") - - def package_id(self): - self.info.header_only() diff --git a/recipes/continuable/all/test_package/CMakeLists.txt b/recipes/continuable/all/test_package/CMakeLists.txt index 7dd0ea22e1254..9a7b7e199f5b8 100644 --- a/recipes/continuable/all/test_package/CMakeLists.txt +++ b/recipes/continuable/all/test_package/CMakeLists.txt @@ -1,14 +1,11 @@ -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() +find_package(continuable REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -set_target_properties( - ${PROJECT_NAME} PROPERTIES - - CXX_STANDARD 14 +set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD_REQUIRED ON ) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE continuable::continuable) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/continuable/all/test_package/conanfile.py b/recipes/continuable/all/test_package/conanfile.py index bd7165a553cf4..ef5d7042163ec 100644 --- a/recipes/continuable/all/test_package/conanfile.py +++ b/recipes/continuable/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/continuable/all/test_package/test_package.cpp b/recipes/continuable/all/test_package/test_package.cpp index b26567acd4b10..92cb7db2c14ee 100644 --- a/recipes/continuable/all/test_package/test_package.cpp +++ b/recipes/continuable/all/test_package/test_package.cpp @@ -2,7 +2,7 @@ #include "continuable/continuable.hpp" -int main(int, char**) { +int main() { cti::make_ready_continuable("..."); return 0; diff --git a/recipes/continuable/config.yml b/recipes/continuable/config.yml index 71d2cb6211de6..955cd0773fc58 100644 --- a/recipes/continuable/config.yml +++ b/recipes/continuable/config.yml @@ -1,4 +1,8 @@ versions: + "4.2.2": + folder: all + "4.2.1": + folder: all "4.2.0": folder: all "4.1.0": diff --git a/recipes/coost/all/conandata.yml b/recipes/coost/all/conandata.yml new file mode 100644 index 0000000000000..4e8bd45da11a5 --- /dev/null +++ b/recipes/coost/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "3.0.2": + url: "https://github.com/idealvin/coost/archive/refs/tags/v3.0.2.tar.gz" + sha256: "922ba21fb9a922c84f6a4b3bd568ed3b3463ccb1ae906cd7c49d90c7f0359b24" + "3.0.1": + url: "https://github.com/idealvin/coost/archive/refs/tags/v3.0.1.tar.gz" + sha256: "f2285d59dc8317dd2494d7628a56f10de9b814d90b86aedf93a3305f94c6ae1a" diff --git a/recipes/coost/all/conanfile.py b/recipes/coost/all/conanfile.py new file mode 100644 index 0000000000000..6b2e612afc5c5 --- /dev/null +++ b/recipes/coost/all/conanfile.py @@ -0,0 +1,109 @@ +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.53.0" + +class CoostConan(ConanFile): + name = "coost" + description = "A tiny boost library in C++11." + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/idealvin/coost" + topics = ("coroutine", "cpp11", "boost") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_libcurl": [True, False], + "with_openssl": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_libcurl": False, + "with_openssl": False, + } + + @property + 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 requirements(self): + if self.options.with_libcurl: + self.requires("libcurl/[>=7.78.0 <9]") + if self.options.with_libcurl or self.options.with_openssl: + self.requires("openssl/[>=1.1 <4]") + if self.settings.os == "Linux": + self.requires("libbacktrace/cci.20210118") + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + if Version(self.version) >= "3.0.2" and is_msvc(self) and self.options.shared: + # INFO: src\include\co\thread.h: error C2492: 'g_tid': data with thread storage duration may not have dll interface + raise ConanInvalidConfiguration(f"{self.ref} Conan recipe does not support -o shared=True with Visual Studio. Contributions are welcome.") + if self.info.options.with_libcurl: + if not self.info.options.with_openssl: + raise ConanInvalidConfiguration(f"{self.ref} requires with_openssl=True when using with_libcurl=True") + if self.dependencies["libcurl"].options.with_ssl != "openssl": + raise ConanInvalidConfiguration(f"{self.ref} requires libcurl/*:with_ssl='openssl' to be enabled") + if not self.dependencies["libcurl"].options.with_zlib: + raise ConanInvalidConfiguration(f"{self.ref} requires libcurl/*:with_zlib=True to be enabled") + + 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 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() + deps = CMakeDeps(self) + deps.generate() + + def build(self): + 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, "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.libs = ["co"] + + self.cpp_info.set_property("cmake_file_name", "coost") + self.cpp_info.set_property("cmake_target_name", "coost::co") + self.cpp_info.set_property("pkg_config_name", "coost") + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs = ["pthread", "dl", "m"] + if self.settings.os == "Linux": + self.cpp_info.requires.append("libbacktrace::libbacktrace") + if self.settings.os == "Windows": + self.cpp_info.system_libs = ["ws2_32"] diff --git a/recipes/coost/all/test_package/CMakeLists.txt b/recipes/coost/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..f7ac5b551babf --- /dev/null +++ b/recipes/coost/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(coost REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE coost::co) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/coost/all/test_package/conanfile.py b/recipes/coost/all/test_package/conanfile.py new file mode 100644 index 0000000000000..ef5d7042163ec --- /dev/null +++ b/recipes/coost/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/coost/all/test_package/test_package.cpp b/recipes/coost/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..46b92d23f6830 --- /dev/null +++ b/recipes/coost/all/test_package/test_package.cpp @@ -0,0 +1,7 @@ +#include "co/str.h" +#include + +int main() { + std::cout << str::from(123) << std::endl; + return 0; +} diff --git a/recipes/coost/config.yml b/recipes/coost/config.yml new file mode 100644 index 0000000000000..a300de211104b --- /dev/null +++ b/recipes/coost/config.yml @@ -0,0 +1,5 @@ +versions: + "3.0.2": + folder: all + "3.0.1": + folder: all diff --git a/recipes/copypp/all/conandata.yml b/recipes/copypp/all/conandata.yml new file mode 100644 index 0000000000000..0570d8ac5e9f4 --- /dev/null +++ b/recipes/copypp/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.3.0": + url: "https://github.com/i-curve/copypp/archive/v0.3.0.tar.gz" + sha256: "390dc010597f372015a708d7d37e3d06fdf6a4fe90fb1c0077b45b6da5cb38a2" diff --git a/recipes/copypp/all/conanfile.py b/recipes/copypp/all/conanfile.py new file mode 100644 index 0000000000000..c70109c5ba246 --- /dev/null +++ b/recipes/copypp/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 copy, get +from conan.tools.layout import basic_layout +from conan.tools.scm import Version +import os + + +required_conan_version = ">=1.52.0" + + +class BasicConanfile(ConanFile): + name = "copypp" + homepage = "https://github.com/i-curve/copypp" + description = "support field copy in different c++ struct." + topics = ("copy", "struct", "header-only") + url = "https://github.com/conan-io/conan-center-index" + license = "MIT" + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _min_cppstd(self): + return 20 + + @property + def _compilers_minimum_version(self): + return { + "apple-clang": "15", + "clang": "13", + "gcc": "11", + "msvc": "193", + "Visual Studio": "17", + } + + 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 build(self): + pass + + def package(self): + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + copy(self, "*.hh", os.path.join(self.source_folder, "include"), os.path.join(self.package_folder, "include")) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.set_property("cmake_file_name", "copypp") + self.cpp_info.set_property("cmake_target_name", "icurve::copypp") + self.cpp_info.set_property("pkg_config_name", "copypp") diff --git a/recipes/copypp/all/test_package/CMakeLists.txt b/recipes/copypp/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..3e0159dd016c1 --- /dev/null +++ b/recipes/copypp/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(copypp CONFIG REQUIRED) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE icurve::copypp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) diff --git a/recipes/copypp/all/test_package/conanfile.py b/recipes/copypp/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/copypp/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/copypp/all/test_package/test_package.cpp b/recipes/copypp/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..2cdae31b2fc4b --- /dev/null +++ b/recipes/copypp/all/test_package/test_package.cpp @@ -0,0 +1,38 @@ +#include +#include +#include "icurve/copypp.hh" + +class A { +public: + int id; + std::string name; + bool sex; + +public: + A() = default; + A(int id, std::string name, bool sex) : id(id), name(name), sex(sex) {} +}; + +class B { +public: + int id; + std::string name; + bool sex; + +public: + B() = default; + B(int id, std::string name, bool sex) : id(id), name(name), sex(sex) {} +}; + +COPYPP_FIELDS_NON_INTRUSIVE(B, A, id, name, sex) + +int main(void) { + A a(1, "curve", true); + B b; + icurve::copy(b, a); + assert(a.id == b.id); + assert(a.name == b.name); + assert(a.sex == b.sex); + std::cout << "copypp ok" << std::endl; + return EXIT_SUCCESS; +} diff --git a/recipes/copypp/config.yml b/recipes/copypp/config.yml new file mode 100644 index 0000000000000..d126790212e0c --- /dev/null +++ b/recipes/copypp/config.yml @@ -0,0 +1,3 @@ +versions: + "0.3.0": + folder: all diff --git a/recipes/corrade/all/CMakeLists.txt b/recipes/corrade/all/CMakeLists.txt deleted file mode 100644 index 61f3d3b039e2b..0000000000000 --- a/recipes/corrade/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/corrade/all/conandata.yml b/recipes/corrade/all/conandata.yml index 4b0cd1b7fd3fb..82a5660e74950 100644 --- a/recipes/corrade/all/conandata.yml +++ b/recipes/corrade/all/conandata.yml @@ -7,8 +7,7 @@ sources: url: https://github.com/mosra/corrade/archive/v2019.10.tar.gz patches: "2020.06": - - base_path: "source_subfolder" - patch_file: "patches/2020.06/0001-emscripten-toolchain.patch" - # patch_type: "portability" - # description: "Remove unnecessary dependency on UseEmscripten" - # source: "https://github.com/mosra/corrade/issues/104" + - patch_file: "patches/2020.06/0001-emscripten-toolchain.patch" + patch_type: "portability" + patch_description: "Remove unnecessary dependency on UseEmscripten" + patch_source: "https://github.com/mosra/corrade/issues/104" diff --git a/recipes/corrade/all/conanfile.py b/recipes/corrade/all/conanfile.py index dcff18b711642..347781614d5e3 100644 --- a/recipes/corrade/all/conanfile.py +++ b/recipes/corrade/all/conanfile.py @@ -1,21 +1,24 @@ -from conan.tools.microsoft import is_msvc -from conan.tools.microsoft.visual import vs_ide_version -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -import functools import os -required_conan_version = ">=1.45.0" +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.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir +from conan.tools.microsoft import is_msvc, check_min_vs + +required_conan_version = ">=1.52.0" class CorradeConan(ConanFile): name = "corrade" description = "Corrade is a multiplatform utility library written in C++11/C++14." - topics = ("corrade", "magnum", "filesystem", "console", "environment", "os") + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://magnum.graphics/corrade" - license = "MIT" + topics = ("magnum", "filesystem", "console", "environment", "os") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -38,22 +41,9 @@ class CorradeConan(ConanFile): "with_utility": True, } - generators = "cmake" - short_paths = True - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - self.copy("cmake/*") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + copy(self, "cmake/*", src=self.recipe_folder, dst=self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -61,79 +51,96 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") - def validate(self): - if is_msvc(self) and tools.Version(vs_ide_version(self)) < 14: - raise ConanInvalidConfiguration("Corrade requires Visual Studio version 14 or greater") + def layout(self): + cmake_layout(self, src_folder="src") - if not self.options.with_utility and (self.options.with_testsuite or self.options.with_interconnect or self.options.with_pluginmanager): - raise ConanInvalidConfiguration("Component 'utility' is required for 'test_suite', 'interconnect' and 'plugin_manager'") + def validate(self): + check_min_vs(self, 190) + if not self.options.with_utility and ( + self.options.with_testsuite or self.options.with_interconnect or self.options.with_pluginmanager + ): + raise ConanInvalidConfiguration( + "Component 'utility' is required for 'test_suite', 'interconnect' and 'plugin_manager'" + ) def build_requirements(self): - if hasattr(self, "settings_build") and tools.cross_building(self, skip_x64_x86=True): - self.build_requires("corrade/{}".format(self.version)) + if hasattr(self, "settings_build") and cross_building(self, skip_x64_x86=True): + self.tool_requires(f"corrade/{self.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["BUILD_STATIC"] = not self.options.shared - cmake.definitions["BUILD_STATIC_PIC"] = self.options.get_safe("fPIC", False) + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_STATIC"] = not self.options.shared + tc.variables["BUILD_STATIC_PIC"] = self.options.get_safe("fPIC", False) - cmake.definitions["BUILD_DEPRECATED"] = self.options.build_deprecated - cmake.definitions["WITH_INTERCONNECT"] = self.options.with_interconnect - cmake.definitions["WITH_MAIN"] = self.options.with_main - cmake.definitions["WITH_PLUGINMANAGER"] = self.options.with_pluginmanager - cmake.definitions["WITH_TESTSUITE"] = self.options.with_testsuite - cmake.definitions["WITH_UTILITY"] = self.options.with_utility - cmake.definitions["WITH_RC"] = self.options.with_utility + tc.variables["BUILD_DEPRECATED"] = self.options.build_deprecated + tc.variables["WITH_INTERCONNECT"] = self.options.with_interconnect + tc.variables["WITH_MAIN"] = self.options.with_main + tc.variables["WITH_PLUGINMANAGER"] = self.options.with_pluginmanager + tc.variables["WITH_TESTSUITE"] = self.options.with_testsuite + tc.variables["WITH_UTILITY"] = self.options.with_utility + tc.variables["WITH_RC"] = self.options.with_utility # Corrade uses suffix on the resulting "lib"-folder when running cmake.install() # Set it explicitly to empty, else Corrade might set it implicitly (eg. to "64") - cmake.definitions["LIB_SUFFIX"] = "" + tc.variables["LIB_SUFFIX"] = "" if is_msvc(self): - cmake.definitions["MSVC2015_COMPATIBILITY"] = vs_ide_version(self) == "14" - cmake.definitions["MSVC2017_COMPATIBILITY"] = vs_ide_version(self) == "15" - cmake.definitions["MSVC2019_COMPATIBILITY"] = vs_ide_version(self) == "16" + if check_min_vs(self, 193, raise_invalid=False): + tc.variables["MSVC2019_COMPATIBILITY"] = True + elif check_min_vs(self, 192, raise_invalid=False): + tc.variables["MSVC2017_COMPATIBILITY"] = True + elif check_min_vs(self, 191, raise_invalid=False): + tc.variables["MSVC2015_COMPATIBILITY"] = True - cmake.configure(build_folder=self._build_subfolder) - - return cmake + 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 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() - share_cmake = os.path.join(self.package_folder, "share", "cmake", "Corrade") - self.copy("UseCorrade.cmake", src=share_cmake, dst=os.path.join(self.package_folder, "lib", "cmake")) - self.copy("CorradeLibSuffix.cmake", src=share_cmake, dst=os.path.join(self.package_folder, "lib", "cmake")) - self.copy("*.cmake", src=os.path.join(self.source_folder, "cmake"), dst=os.path.join("lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "share")) + copy(self, "UseCorrade.cmake", + src=share_cmake, + dst=os.path.join(self.package_folder, "lib", "cmake")) + copy(self, "CorradeLibSuffix.cmake", + src=share_cmake, + dst=os.path.join(self.package_folder, "lib", "cmake")) + copy(self, "*.cmake", + src=os.path.join(self.export_sources_folder, "cmake"), + dst=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_find_mode", "both") self.cpp_info.set_property("cmake_file_name", "Corrade") - self.cpp_info.names["cmake_find_package"] = "Corrade" - self.cpp_info.names["cmake_find_package_multi"] = "Corrade" + self.cpp_info.set_property("cmake_target_name", "Corrade::Corrade") suffix = "-d" if self.settings.build_type == "Debug" else "" - # The FindCorrade.cmake file provided by the library populates some extra stuff - self.cpp_info.set_property("cmake_build_modules", [os.path.join("lib", "cmake", "conan-corrade-vars.cmake")]) - self.cpp_info.components["_corrade"].build_modules.append(os.path.join("lib", "cmake", "conan-corrade-vars.cmake")) + cmake_modules = [ + # Reproduces the variables and calls performed by the FindCorrade.cmake provided by the library + os.path.join("lib", "cmake", "conan-corrade-vars.cmake"), + # Autodetects LIB_SUFFIX (either "64" or "") + os.path.join("lib", "cmake", "CorradeLibSuffix.cmake"), + # Exports build flags and macros + os.path.join("lib", "cmake", "UseCorrade.cmake"), + ] + self.cpp_info.set_property("cmake_build_modules", cmake_modules) + self.cpp_info.components["_corrade"].build_modules["cmake_find_package"] = cmake_modules + self.cpp_info.components["_corrade"].build_modules["cmake_find_package_multi"] = cmake_modules if self.options.with_main: self.cpp_info.components["main"].set_property("cmake_target_name", "Corrade::Main") @@ -153,10 +160,10 @@ def package_info(self): self.cpp_info.components["utility"].requires = ["_corrade"] # This one is statically linked into utility - #self.cpp_info.components["containers"].set_property("cmake_target_name", "Corrade::Containers") - #self.cpp_info.components["containers"].names["cmake_find_package"] = "Containers" - #self.cpp_info.components["containers"].names["cmake_find_package_multi"] = "Containers" - #self.cpp_info.components["containers"].libs = ["CorradeContainers" + suffix] + # self.cpp_info.components["containers"].set_property("cmake_target_name", "Corrade::Containers") + # self.cpp_info.components["containers"].names["cmake_find_package"] = "Containers" + # self.cpp_info.components["containers"].names["cmake_find_package_multi"] = "Containers" + # self.cpp_info.components["containers"].libs = ["CorradeContainers" + suffix] if self.options.with_interconnect: self.cpp_info.components["interconnect"].set_property("cmake_target_name", "Corrade::Interconnect") @@ -181,9 +188,12 @@ def package_info(self): if self.options.with_utility: 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) # pkg_config: Add more explicit naming to generated files (avoid filesystem collision). - for key, cmp in self.cpp_info.components.items(): - self.cpp_info.components[key].names["pkg_config"] = "{}_{}".format(self.name, key) + for key, component in self.cpp_info.components.items(): + component.set_property("pkg_config_name", f"{self.name}_{key}") + + self.cpp_info.names["cmake_find_package"] = "Corrade" + self.cpp_info.names["cmake_find_package_multi"] = "Corrade" diff --git a/recipes/corrade/all/test_package/CMakeLists.txt b/recipes/corrade/all/test_package/CMakeLists.txt index e4c1f34b721de..94206f42ad33e 100644 --- a/recipes/corrade/all/test_package/CMakeLists.txt +++ b/recipes/corrade/all/test_package/CMakeLists.txt @@ -1,14 +1,11 @@ -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) - -find_package(Corrade REQUIRED) +find_package(Corrade REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} Corrade::Main) -if(VERSION_2019_10) +if(VERSION_2019_10) target_compile_definitions(${PROJECT_NAME} PRIVATE VERSION_2019_10) endif() if(WITH_UTILITY) diff --git a/recipes/corrade/all/test_package/conanfile.py b/recipes/corrade/all/test_package/conanfile.py index be914f107e121..9c0893a63e85b 100644 --- a/recipes/corrade/all/test_package/conanfile.py +++ b/recipes/corrade/all/test_package/conanfile.py @@ -1,28 +1,37 @@ -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", "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["WITH_UTILITY"] = self.dependencies["corrade"].options.with_utility + if self.dependencies["corrade"].ref.version == "2019.10": + tc.variables["VERSION_2019_10"] = True + tc.generate() def build(self): cmake = CMake(self) - cmake.definitions["WITH_UTILITY"] = self.options["corrade"].with_utility - if self.deps_cpp_info["corrade"].version == "2019.10": - cmake.definitions["VERSION_2019_10"] = 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) - - if self.options["corrade"].with_utility: - # Run corrade-rc - self.run("corrade-rc --help", run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + self.run(bin_path, env="conanrun") if self.settings.os == "Emscripten": - bin_path = os.path.join("bin", "test_package.js") - self.run("node {}".format(bin_path), run_environment=True) + bin_path = os.path.join(self.cpp.build.bindir, "test_package.js") + self.run(f"node {bin_path}", env="conanrun") diff --git a/recipes/corrade/all/test_package/test_package.cpp b/recipes/corrade/all/test_package/test_package.cpp index 8f5dc321a44de..c0e1a6d7932b2 100644 --- a/recipes/corrade/all/test_package/test_package.cpp +++ b/recipes/corrade/all/test_package/test_package.cpp @@ -1,5 +1,4 @@ -#include -#include // Here it is 'nothing' +#include // Here it is 'nothing' #ifndef VERSION_2019_10 #include @@ -9,10 +8,11 @@ #include #endif +#include int main() { std::cout << "Test package for Corrade\n"; - + #ifndef VERSION_2019_10 std::cout << "Corrade " << CORRADE_VERSION_YEAR << "." << CORRADE_VERSION_MONTH << std::endl; #endif diff --git a/recipes/cose-c/all/CMakeLists.txt b/recipes/cose-c/all/CMakeLists.txt deleted file mode 100644 index 6ba47d078b389..0000000000000 --- a/recipes/cose-c/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/cose-c/all/conandata.yml b/recipes/cose-c/all/conandata.yml index 19b29a5db955d..b9c689437dd44 100644 --- a/recipes/cose-c/all/conandata.yml +++ b/recipes/cose-c/all/conandata.yml @@ -2,7 +2,3 @@ sources: "cci.20200430": sha256: fef43742cba828a35640eefba774be11562cab6d7bcbdcfd62613019965f87c3 url: https://github.com/cose-wg/COSE-C/archive/4432ae11f7a9711c46e8b4442fa2b35055c5cf98.zip -patches: - "cci.20200430": - - patch_file: "patches/001-fix-cmake-targets.patch" - base_path: "source_subfolder" diff --git a/recipes/cose-c/all/conanfile.py b/recipes/cose-c/all/conanfile.py index 35e896e14c7d9..a6fffdcbbb029 100644 --- a/recipes/cose-c/all/conanfile.py +++ b/recipes/cose-c/all/conanfile.py @@ -1,38 +1,33 @@ -from conans import CMake, ConanFile, tools -import glob import os +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 collect_libs, copy, get, rmdir, replace_in_file + +required_conan_version = ">=1.53.0" + class CoseCConan(ConanFile): name = "cose-c" + description = "Implementation of COSE in C using cn-cbor and openssl" license = "BSD-3-Clause" - homepage = "https://github.com/cose-wg/COSE-C" url = "https://github.com/conan-io/conan-center-index" - description = """Implementation of COSE in C using cn-cbor and openssl""" - topics = ("cbor") - exports_sources = ["CMakeLists.txt", "patches/**"] - settings = "os", "compiler", "build_type", "arch" + homepage = "https://github.com/cose-wg/COSE-C" + topics = "cbor" + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], - "with_ssl": ["openssl", "mbedtls"] + "with_ssl": ["openssl", "mbedtls"], } default_options = { "shared": False, "fPIC": True, - "with_ssl": "openssl" + "with_ssl": "openssl", } - 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": @@ -40,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") + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, 11) def requirements(self): - self.requires("cn-cbor/1.0.0") + self.requires("cn-cbor/1.0.0", transitive_headers=True) if self.options.with_ssl == "mbedtls": - self.requires("mbedtls/2.23.0") + self.requires("mbedtls/2.16.12", transitive_headers=True) else: - self.requires("openssl/1.1.1h") + self.requires("openssl/[>=1.1 <4]", transitive_headers=True) def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename(glob.glob("COSE-C-*")[0], self._source_subfolder) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["COSE_C_COVERALLS"] = False - self._cmake.definitions["COSE_C_BUILD_TESTS"] = False - self._cmake.definitions["COSE_C_BUILD_DOCS"] = False - self._cmake.definitions["COSE_C_BUILD_DUMPER"] = False - self._cmake.definitions["COSE_C_USE_MBEDTLS"] = self.options.with_ssl == "mbedtls" - self._cmake.definitions["COSE_C_USE_FIND_PACKAGE"] = True - self._cmake.definitions["COSE_C_EXPORT_TARGETS"] = 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.cache_variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + tc.cache_variables["COSE_C_COVERALLS"] = False + tc.cache_variables["COSE_C_BUILD_TESTS"] = False + tc.cache_variables["COSE_C_BUILD_DOCS"] = False + tc.cache_variables["COSE_C_BUILD_DUMPER"] = False + tc.cache_variables["COSE_C_USE_MBEDTLS"] = self.options.with_ssl == "mbedtls" + tc.cache_variables["COSE_C_USE_FIND_PACKAGE"] = True + tc.cache_variables["COSE_C_EXPORT_TARGETS"] = True + tc.generate() + deps = CMakeDeps(self) + deps.set_property("openssl", "cmake_file_name", "OPENSSL") + deps.set_property("mbedtls", "cmake_target_name", "mbedtls") + deps.generate() + + def _patch_sources(self): + # For ${OPENSSL_LIBRARIES} and ${OPENSSL_INCLUDE_DIR} + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "OpenSSL", "OPENSSL") 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", 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, "lib", "cmake")) + 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.libs = collect_libs(self) if self.settings.os == "Windows": self.cpp_info.system_libs.extend(["ws2_32", "secur32", "crypt32", "bcrypt"]) - if self.settings.os == "Macos": + if is_apple_os(self): self.cpp_info.frameworks.extend(["CoreFoundation", "Security"]) if self.options.with_ssl == "mbedtls": self.cpp_info.defines.append("COSE_C_USE_MBEDTLS") diff --git a/recipes/cose-c/all/patches/001-fix-cmake-targets.patch b/recipes/cose-c/all/patches/001-fix-cmake-targets.patch deleted file mode 100644 index 0c13544696d16..0000000000000 --- a/recipes/cose-c/all/patches/001-fix-cmake-targets.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 5522b29..1e9700b 100644 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -62,10 +62,10 @@ target_include_directories( - target_link_libraries(${PROJECT_NAME} PRIVATE cn-cbor::cn-cbor) - - if(COSE_C_USE_MBEDTLS) -- target_link_libraries(${PROJECT_NAME} PRIVATE mbedtls) -+ target_link_libraries(${PROJECT_NAME} PRIVATE CONAN_PKG::mbedtls) - else() - target_include_directories(${PROJECT_NAME} PRIVATE ${OPENSSL_INCLUDE_DIR}) -- target_link_libraries(${PROJECT_NAME} PRIVATE ${OPENSSL_LIBRARIES}) -+ target_link_libraries(${PROJECT_NAME} PRIVATE CONAN_PKG::openssl) - endif() - - if(MSVC) diff --git a/recipes/cose-c/all/test_package/CMakeLists.txt b/recipes/cose-c/all/test_package/CMakeLists.txt index fcda1859bb610..c29edc1ca6a27 100644 --- a/recipes/cose-c/all/test_package/CMakeLists.txt +++ b/recipes/cose-c/all/test_package/CMakeLists.txt @@ -1,10 +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() - -find_package(cose-c REQUIRED) +find_package(cose-c REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} cose-c::cose-c) diff --git a/recipes/cose-c/all/test_package/conanfile.py b/recipes/cose-c/all/test_package/conanfile.py index aab3b289eb8cf..ef5d7042163ec 100644 --- a/recipes/cose-c/all/test_package/conanfile.py +++ b/recipes/cose-c/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 TestConan(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,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") - bin_path = 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/cose-c/all/test_v1_package/CMakeLists.txt b/recipes/cose-c/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/cose-c/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/cose-c/all/test_v1_package/conanfile.py b/recipes/cose-c/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..6dffe66394a26 --- /dev/null +++ b/recipes/cose-c/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.settings): + bin_path = os.path.join("bin", "test_package") + bin_path = self.run(bin_path, run_environment=True) diff --git a/recipes/cose-c/config.yml b/recipes/cose-c/config.yml index 6a4771df04b83..b452f13eb25c1 100644 --- a/recipes/cose-c/config.yml +++ b/recipes/cose-c/config.yml @@ -1,4 +1,3 @@ ---- versions: "cci.20200430": folder: "all" diff --git a/recipes/cotila/all/conanfile.py b/recipes/cotila/all/conanfile.py index eb47a8c74e0c9..cbc8f6be75064 100644 --- a/recipes/cotila/all/conanfile.py +++ b/recipes/cotila/all/conanfile.py @@ -1,66 +1,71 @@ -from conans import ConanFile, 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.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 + +required_conan_version = ">=1.52.0" class CotilaConan(ConanFile): name = "cotila" description = "A compile time linear algebra system" - homepage = "https://github.com/calebzulawski/cotila" - topics = ("c++", "math", "linear algebra", "compile-time") license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" - no_copy_source = True + homepage = "https://github.com/calebzulawski/cotila" + topics = ("c++", "math", "linear algebra", "compile-time", "header-only") - @property - def _source_subfolder(self): - return "source_subfolder" + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True @property def _min_cppstd(self): - return "17" + return 17 @property def _compilers_minimum_version(self): return { "gcc": "7", - "Visual Studio": "15.7", "clang": "6.0", "apple-clang": "10", + "Visual Studio": "15.7", + "msvc": "193", } - def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, "17") + def layout(self): + basic_layout(self, src_folder="src") - 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] + def package_id(self): + self.info.clear() + def validate(self): + if is_msvc(self): + raise ConanInvalidConfiguration("cotila currently does not support MSVC. " + "See https://github.com/calebzulawski/cotila/issues/36.") + 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("{} {} 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 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], 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="include/*", src=self._source_subfolder) + copy(self, "LICENSE", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder) + copy(self, "*", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include")) def package_info(self): - self.cpp_info.names["cmake_find_package"] = "cotila" - self.cpp_info.names["cmake_find_package_multi"] = "cotila" - + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/cotila/all/test_package/CMakeLists.txt b/recipes/cotila/all/test_package/CMakeLists.txt index fb76dc36e1dc6..cf3db6db5cc45 100644 --- a/recipes/cotila/all/test_package/CMakeLists.txt +++ b/recipes/cotila/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.15) project(test_package LANGUAGES CXX) -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup(TARGETS) - -find_package(cotila CONFIG REQUIRED) +find_package(cotila REQUIRED CONFIG) add_executable(test_package test_package.cpp) target_compile_features(test_package PRIVATE cxx_std_17) diff --git a/recipes/cotila/all/test_package/conanfile.py b/recipes/cotila/all/test_package/conanfile.py index e1ab7e3d234d6..ef5d7042163ec 100644 --- a/recipes/cotila/all/test_package/conanfile.py +++ b/recipes/cotila/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 CotilaTestConan(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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cotila/all/test_v1_package/CMakeLists.txt b/recipes/cotila/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/cotila/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/cotila/all/test_v1_package/conanfile.py b/recipes/cotila/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..e1ab7e3d234d6 --- /dev/null +++ b/recipes/cotila/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class CotilaTestConan(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/coz/all/CMakeLists.txt b/recipes/coz/all/CMakeLists.txt deleted file mode 100644 index bd3083b512cb9..0000000000000 --- a/recipes/coz/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/coz/all/conanfile.py b/recipes/coz/all/conanfile.py index 525f92fcfbd9c..b3da8b64ac09e 100644 --- a/recipes/coz/all/conanfile.py +++ b/recipes/coz/all/conanfile.py @@ -1,61 +1,76 @@ import os -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -required_conan_version = ">=1.33.0" +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 get, rmdir +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" class CozConan(ConanFile): name = "coz" - description = """Causal profiler, uses performance experiments - to predict the effect of optimizations""" + description = "Causal profiler, uses performance experiments to predict the effect of optimizations" + license = "BSD-2-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "http://coz-profiler.org" - license = "BSD-2-Clause" - topics = ("conan", "coz", "profiler", "causal") + topics = ("profiler", "causal") + package_type = "shared-library" settings = "os", "arch", "compiler", "build_type" - requires = "libelfin/0.3" - exports_sources = "CMakeLists.txt" - generators = "cmake", "cmake_find_package" + def layout(self): + cmake_layout(self, src_folder="src") + + def package_id(self): + del self.info.settings.compiler + del self.info.settings.build_type - _source_subfolder = "source_subfolder" + def requirements(self): + self.requires("libelfin/0.3") def validate(self): - compiler = self.settings.compiler - compiler_version = tools.Version(self.settings.compiler.version) - if self.settings.os == "Macos" or compiler == "Visual Studio" or ( - compiler == "gcc" and compiler_version < "5.0"): - raise ConanInvalidConfiguration( - "coz doesn't support compiler: {} on OS: {}.".format( - self.settings.compiler, self.settings.os)) if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, "11") + check_min_cppstd(self, 11) + compiler_version = Version(self.settings.compiler.version) + if self.settings.compiler == "gcc" and compiler_version < "5.0": + raise ConanInvalidConfiguration("coz requires GCC >= 5.0") + if is_apple_os(self) or is_msvc(self): + raise ConanInvalidConfiguration(f"coz doesn't support {self.settings.os}.") 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) - _cmake = None - - 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): - 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): + # https://github.com/plasma-umass/coz/#cmake + self.cpp_info.set_property("cmake_file_name", "coz-profiler") + self.cpp_info.set_property("cmake_target_name", "coz::coz") + + self.cpp_info.libs = ["coz"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs = ["m", "dl", "pthread", "rt"] + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.filenames["cmake_find_package"] = "coz-profiler" self.cpp_info.filenames["cmake_find_package_multi"] = "coz-profiler" self.cpp_info.names["cmake_find_package"] = "coz" diff --git a/recipes/coz/all/test_package/CMakeLists.txt b/recipes/coz/all/test_package/CMakeLists.txt index 7b9b613cbb24a..d7ea7e2a51ab7 100644 --- a/recipes/coz/all/test_package/CMakeLists.txt +++ b/recipes/coz/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ -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() +find_package(coz-profiler REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE coz::coz) diff --git a/recipes/coz/all/test_package/conanfile.py b/recipes/coz/all/test_package/conanfile.py index ad479949b486f..fe45f480669f3 100644 --- a/recipes/coz/all/test_package/conanfile.py +++ b/recipes/coz/all/test_package/conanfile.py @@ -1,19 +1,40 @@ -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_layout, CMake +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", "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, build_type="RelWithDebInfo") # To work properly Coz tool requires debug information https://github.com/plasma-umass/coz + cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if tools.cross_building(self.settings): + if self.settings.build_type not in ["Debug", "RelWithDebInfo"]: + self.output.info(f"Skipping coz test because {self.settings.build_type} " + "build type does not contain debug information") return - bin_path = os.path.join("bin", "test_package") - self.run("coz run --- " + bin_path, run_environment=True) - print(open("profile.coz").read()) + if self.settings.os == "Linux": + perf_even_paranoid = int(open("/proc/sys/kernel/perf_event_paranoid").read()) + is_root = os.geteuid() == 0 + if perf_even_paranoid > 2 and not is_root: + self.output.info("Skipping coz test because /proc/sys/kernel/perf_event_paranoid value " + f"must be <= 2 (currently {perf_even_paranoid}) and not running as root") + return + if can_run(self): + with chdir(self, self.cpp.build.bindir): + self.run("coz run --- ./test_package", env="conanrun") + print(open("profile.coz").read()) diff --git a/recipes/cpp-channel/all/conandata.yml b/recipes/cpp-channel/all/conandata.yml new file mode 100644 index 0000000000000..ed231f8fb8014 --- /dev/null +++ b/recipes/cpp-channel/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "0.8.3": + url: "https://github.com/andreiavrammsd/cpp-channel/archive/refs/tags/v0.8.3.tar.gz" + sha256: "49539a9e387797bd91d1713588f7c88beef98d69919bfb7b0712ed060527567a" + "0.8.2": + url: "https://github.com/andreiavrammsd/cpp-channel/archive/refs/tags/v0.8.2.tar.gz" + sha256: "7666ec6ef275029593dc97bf35057761bc049298d71597a640da1e659c39a667" diff --git a/recipes/cpp-channel/all/conanfile.py b/recipes/cpp-channel/all/conanfile.py new file mode 100644 index 0000000000000..2dfc0cff05ee7 --- /dev/null +++ b/recipes/cpp-channel/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 +from conan.tools.layout import basic_layout +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration +import os + +required_conan_version = ">=1.52.0" + +class CppCHannelConan(ConanFile): + name = "cpp-channel" + description = "Thread-safe container for sharing data between threads" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/andreiavrammsd/cpp-channel" + topics = ("channel", "golang", "container", "header-only") + package_type = "header-library" + 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 == "gcc" and Version(self.settings.compiler.version) < "7": + raise ConanInvalidConfiguration(f"{self.ref} doesn't support gcc < 7") + + 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"), + ) + 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.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/cpp-channel/all/test_package/CMakeLists.txt b/recipes/cpp-channel/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..6e53e2494f389 --- /dev/null +++ b/recipes/cpp-channel/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(cpp-channel REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE cpp-channel::cpp-channel) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/cpp-channel/all/test_package/conanfile.py b/recipes/cpp-channel/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/cpp-channel/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cpp-channel/all/test_package/test_package.cpp b/recipes/cpp-channel/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..f0fa8b9f9e593 --- /dev/null +++ b/recipes/cpp-channel/all/test_package/test_package.cpp @@ -0,0 +1,27 @@ +#include + +#include "msd/channel.hpp" + +int main() +{ + msd::channel ch{10}; + + int in{}; + + in = 1; + ch << in; + + in = 2; + ch << in; + + in = 3; + ch << in; + + for (auto out : ch) { + std::cout << out << '\n'; + + if (ch.empty()) { + break; + } + } +} diff --git a/recipes/cpp-channel/config.yml b/recipes/cpp-channel/config.yml new file mode 100644 index 0000000000000..eda9ea75e51a5 --- /dev/null +++ b/recipes/cpp-channel/config.yml @@ -0,0 +1,5 @@ +versions: + "0.8.3": + folder: all + "0.8.2": + folder: all diff --git a/recipes/cpp-dump/all/conandata.yml b/recipes/cpp-dump/all/conandata.yml new file mode 100644 index 0000000000000..adaa64a423425 --- /dev/null +++ b/recipes/cpp-dump/all/conandata.yml @@ -0,0 +1,10 @@ +sources: + "0.7.0": + url: "https://github.com/philip82148/cpp-dump/archive/refs/tags/v0.7.0.tar.gz" + sha256: "b27a0854a405aa10619f341f66e26a6c39dca1ad41a26dd4fa6d86ad6752c4f8" + "0.6.0": + url: "https://github.com/philip82148/cpp-dump/archive/refs/tags/v0.6.0.tar.gz" + sha256: "22bc5fafa22ac7c1e99db8824fdabec4af6baabed0c8b7cc80a0205dfb550414" + "0.5.0": + url: "https://github.com/philip82148/cpp-dump/archive/refs/tags/v0.5.0.tar.gz" + sha256: "31fa8b03c9ee820525137be28f37b36e2abe7fd91df7d67681cb894db2230fe6" diff --git a/recipes/cpp-dump/all/conanfile.py b/recipes/cpp-dump/all/conanfile.py new file mode 100644 index 0000000000000..36c04e6dd12c9 --- /dev/null +++ b/recipes/cpp-dump/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 +import os + + +required_conan_version = ">=1.52.0" + + +class CppDumpConan(ConanFile): + name = "cpp-dump" + description = "An all-round dump function library for C++ that can print any type, even user-defined types." + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/philip82148/cpp-dump" + topics = ("debug", "dump", "header-only") + package_type = "header-library" + 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", + "Visual Studio": "16", + "msvc": "192", + } + + 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) + if Version(self.version) < "0.7.0": + copy( + self, + pattern="dump.hpp", + dst=os.path.join(self.package_folder, "include"), + src=self.source_folder, + ) + copy( + self, + pattern="*.hpp", + dst=os.path.join(self.package_folder, "include", "hpp"), + src=os.path.join(self.source_folder, "hpp"), + ) + else: + copy( + self, + pattern="*dump.hpp", + dst=os.path.join(self.package_folder, "include"), + src=self.source_folder, + ) + copy( + self, + pattern="*.hpp", + dst=os.path.join(self.package_folder, "include", "cpp-dump"), + src=os.path.join(self.source_folder, "cpp-dump"), + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/cpp-dump/all/test_package/CMakeLists.txt b/recipes/cpp-dump/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..79f40a47d7e0c --- /dev/null +++ b/recipes/cpp-dump/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(cpp-dump REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE cpp-dump::cpp-dump) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/cpp-dump/all/test_package/conanfile.py b/recipes/cpp-dump/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/cpp-dump/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cpp-dump/all/test_package/test_package.cpp b/recipes/cpp-dump/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..187dc7393224b --- /dev/null +++ b/recipes/cpp-dump/all/test_package/test_package.cpp @@ -0,0 +1,14 @@ +#include + +#include +#include +#include + +int main() { + std::clog << std::endl; + + std::vector> my_vector{{3, 5, 8, 9, 7}, {9, 3, 2, 3, 8}}; + CPP_DUMP(my_vector); + + std::clog << std::endl; +} diff --git a/recipes/cpp-dump/config.yml b/recipes/cpp-dump/config.yml new file mode 100644 index 0000000000000..d61439bae1bc3 --- /dev/null +++ b/recipes/cpp-dump/config.yml @@ -0,0 +1,7 @@ +versions: + "0.7.0": + folder: all + "0.6.0": + folder: all + "0.5.0": + folder: all diff --git a/recipes/cpp-httplib/all/conandata.yml b/recipes/cpp-httplib/all/conandata.yml index dbdbe18e1b5ac..c5eb35c8bdfe6 100644 --- a/recipes/cpp-httplib/all/conandata.yml +++ b/recipes/cpp-httplib/all/conandata.yml @@ -1,49 +1,32 @@ sources: - "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" - "0.11.0": - url: "https://github.com/yhirose/cpp-httplib/archive/v0.11.0.tar.gz" - sha256: "9f533b0aa67066bd8f049e080eef75ad710a2f3ba3d80edbb13957389a5eeca7" - "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" - "0.8.9": - url: "https://github.com/yhirose/cpp-httplib/archive/v0.8.9.tar.gz" - sha256: "3c5e0d6784d04b0b3d10f60fa2a26ef2a968fb80f434c4d117c2811f9e3a5ed7" - "0.7.18": - url: "https://github.com/yhirose/cpp-httplib/archive/v0.7.18.tar.gz" - sha256: "ed90e670a39fcacfb670f51b619e670dafe419bca74f8a50fb3c31bb46be8b23" - "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" + "0.18.2": + url: "https://github.com/yhirose/cpp-httplib/archive/v0.18.2.tar.gz" + sha256: "7dc9be587e7432b75a892832df33d6819460b5462ccd59fc462ba012fef5bf72" + "0.18.1": + url: "https://github.com/yhirose/cpp-httplib/archive/v0.18.1.tar.gz" + sha256: "405abd8170f2a446fc8612ac635d0db5947c0d2e156e32603403a4496255ff00" + "0.18.0": + url: "https://github.com/yhirose/cpp-httplib/archive/v0.18.0.tar.gz" + sha256: "6ed5894bbbc4a34a0f4c5e962672d0003d2ea099bbadacc66f6dee2b213ff394" + "0.17.3": + url: "https://github.com/yhirose/cpp-httplib/archive/v0.17.3.tar.gz" + sha256: "95bd6dba4241656c59d6f0854d408d14c220f7c71e673319ee27d30aee741aaa" + "0.17.1": + url: "https://github.com/yhirose/cpp-httplib/archive/v0.17.1.tar.gz" + sha256: "044c5a233da242e981d9543dd136a5945e0549c5641a0373934db88bbd192f41" + "0.16.3": + url: "https://github.com/yhirose/cpp-httplib/archive/v0.16.3.tar.gz" + sha256: "c1742fc7179aaae2a67ad9bba0740b7e9ffaf4f5e62feef53101ecdef1478716" + "0.16.0": + url: "https://github.com/yhirose/cpp-httplib/archive/v0.16.0.tar.gz" + sha256: "c125022eb85eaa12235518dc4638be93b62c3216d0f87b655af7b17b71b38851" + "0.15.3": + url: "https://github.com/yhirose/cpp-httplib/archive/v0.15.3.tar.gz" + sha256: "2121bbf38871bb2aafb5f7f2b9b94705366170909f434428352187cb0216124e" + "0.14.3": + url: "https://github.com/yhirose/cpp-httplib/archive/v0.14.3.tar.gz" + sha256: "dcf6486d9030937636d8a4f820ca9531808fd7edb283893dddbaa05f99357e63" + # keep 0.14.1 for enjincppsdk and microservice-essentials + "0.14.1": + url: "https://github.com/yhirose/cpp-httplib/archive/v0.14.1.tar.gz" + sha256: "2d4fb5544da643e5d0a82585555d8b7502b4137eb321a4abbb075e21d2f00e96" diff --git a/recipes/cpp-httplib/all/conanfile.py b/recipes/cpp-httplib/all/conanfile.py index 7129662e2807e..acf164da9f9fc 100644 --- a/recipes/cpp-httplib/all/conanfile.py +++ b/recipes/cpp-httplib/all/conanfile.py @@ -5,59 +5,59 @@ from conan.tools.scm import Version import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=2.1" 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" - + homepage = "https://github.com/yhirose/cpp-httplib" + topics = ("http", "https", "header-only") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" options = { "with_openssl": [True, False], "with_zlib": [True, False], "with_brotli": [True, False], + "use_macos_keychain_certs": [True, False], } default_options = { "with_openssl": False, "with_zlib": False, "with_brotli": False, + "use_macos_keychain_certs": True, } - no_copy_source = True def config_options(self): - if Version(self.version) < "0.7.2": - del self.options.with_brotli + if self.settings.os != "Macos": + del self.options.use_macos_keychain_certs def requirements(self): if self.options.with_openssl: - self.requires("openssl/1.1.1s") + if Version(self.version) < "0.15": + self.requires("openssl/[>=1.1 <4]") + else: + # New version of httplib.h requires OpenSSL 3 + self.requires("openssl/[>=3 <4]") if self.options.with_zlib: - self.requires("zlib/1.2.13") - if self.options.get_safe("with_brotli"): - self.requires("brotli/1.0.9") + self.requires("zlib/[>=1.2.11 <2]") + if self.options.with_brotli: + self.requires("brotli/1.1.0") def package_id(self): self.info.clear() def validate(self): - if self.settings.compiler.get_safe("cppstd"): - check_min_cppstd(self, 11) + 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) - - def build(self): - pass + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) @@ -68,20 +68,17 @@ 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: self.cpp_info.defines.append("CPPHTTPLIB_ZLIB_SUPPORT") - if self.options.get_safe("with_brotli"): + if self.options.with_brotli: self.cpp_info.defines.append("CPPHTTPLIB_BROTLI_SUPPORT") if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["pthread"] elif self.settings.os == "Windows": self.cpp_info.system_libs = ["crypt32", "cryptui", "ws2_32"] - - # TODO: to remove in conan v2 once legacy generators removed - self.cpp_info.names["cmake_find_package"] = "httplib" - self.cpp_info.names["cmake_find_package_multi"] = "httplib" + elif self.settings.os == "Macos" and self.options.with_openssl and self.options.get_safe("use_macos_keychain_certs"): + self.cpp_info.frameworks = ["CoreFoundation", "Security"] + self.cpp_info.defines.append("CPPHTTPLIB_USE_CERTS_FROM_MACOSX_KEYCHAIN") diff --git a/recipes/cpp-httplib/all/test_package/conanfile.py b/recipes/cpp-httplib/all/test_package/conanfile.py index d120a992c06a6..8a5bb47f50c4c 100644 --- a/recipes/cpp-httplib/all/test_package/conanfile.py +++ b/recipes/cpp-httplib/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/cpp-httplib/all/test_package/test_package.cpp b/recipes/cpp-httplib/all/test_package/test_package.cpp index 3e9fe638f7b17..197dc1388d9c9 100644 --- a/recipes/cpp-httplib/all/test_package/test_package.cpp +++ b/recipes/cpp-httplib/all/test_package/test_package.cpp @@ -1,20 +1,6 @@ #include int main() { - httplib::Server svr; - - svr.Get("/hi", [](const httplib::Request& req, httplib::Response& res) { - res.set_content("Hello World!", "text/plain"); - }); - - svr.Get(R"(/numbers/(\d+))", [&](const httplib::Request& req, httplib::Response& res) { - auto numbers = req.matches[1]; - res.set_content(numbers, "text/plain"); - }); - - svr.Get("/stop", [&](const httplib::Request& req, httplib::Response& res) { - svr.stop(); - }); - + httplib::Request request; return 0; } diff --git a/recipes/cpp-httplib/all/test_v1_package/CMakeLists.txt b/recipes/cpp-httplib/all/test_v1_package/CMakeLists.txt deleted file mode 100644 index 72809bb080c2c..0000000000000 --- a/recipes/cpp-httplib/all/test_v1_package/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) - -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) diff --git a/recipes/cpp-httplib/config.yml b/recipes/cpp-httplib/config.yml index 7b7f02579048e..62a26096a9a50 100644 --- a/recipes/cpp-httplib/config.yml +++ b/recipes/cpp-httplib/config.yml @@ -1,33 +1,21 @@ versions: - "0.11.3": + "0.18.2": folder: all - "0.11.2": + "0.18.1": folder: all - "0.11.1": + "0.18.0": folder: all - "0.11.0": + "0.17.3": folder: all - "0.10.9": + "0.17.1": folder: all - "0.10.8": + "0.16.3": folder: all - "0.10.7": + "0.16.0": folder: all - "0.10.6": + "0.15.3": folder: all - "0.10.4": + "0.14.3": folder: all - "0.10.3": - folder: all - "0.10.1": - folder: all - "0.9.10": - folder: all - "0.8.9": - folder: all - "0.7.18": - folder: all - "0.6.6": - folder: all - "0.5.13": + "0.14.1": folder: all diff --git a/recipes/cpp-ipc/all/CMakeLists.txt b/recipes/cpp-ipc/all/CMakeLists.txt deleted file mode 100644 index e17d82eddcc5d..0000000000000 --- a/recipes/cpp-ipc/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() - -add_subdirectory(source_subfolder) diff --git a/recipes/cpp-ipc/all/conandata.yml b/recipes/cpp-ipc/all/conandata.yml index c463e509b6004..d1b80928e2b24 100644 --- a/recipes/cpp-ipc/all/conandata.yml +++ b/recipes/cpp-ipc/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.3.0": + url: "https://github.com/mutouyun/cpp-ipc/archive/refs/tags/v1.3.0.tar.gz" + sha256: "a5ffb67ff451aa28726ab7801509c5c67feb737db49d2be4f7c70a4e9fad2fee" "1.2.0": url: "https://github.com/mutouyun/cpp-ipc/archive/refs/tags/v1.2.0.tar.gz" sha256: "c8df492e08b55e0722eb3e5684163709c1758f3282f05358ff78c694eadb6e60" diff --git a/recipes/cpp-ipc/all/conanfile.py b/recipes/cpp-ipc/all/conanfile.py index b11041af3f594..5baa058938b2b 100644 --- a/recipes/cpp-ipc/all/conanfile.py +++ b/recipes/cpp-ipc/all/conanfile.py @@ -1,17 +1,26 @@ -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.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 +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" -required_conan_version = ">=1.33.0" class CppIPCConan(ConanFile): name = "cpp-ipc" description = "C++ IPC Library: A high-performance inter-process communication using shared memory on Linux/Windows." - topics = ("ipc", "shared memory", ) + license = ("MIT",) url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/mutouyun/cpp-ipc" - license = "MIT", + topics = ("ipc", "shared memory") + + package_type = "library" settings = "os", "arch", "compiler", "build_type" - exports_sources = ["CMakeLists.txt"] options = { "shared": [True, False], "fPIC": [True, False], @@ -21,19 +30,18 @@ class CppIPCConan(ConanFile): "fPIC": True, } - generators = "cmake" - - _compiler_required_cpp17 = { - "Visual Studio": "17", - "gcc": "8", - "clang": "4", - } - - _cmake = None + @property + def _min_cppstd(self): + return 17 @property - def _source_subfolder(self): - return "source_subfolder" + def _compilers_minimum_version(self): + return { + "gcc": "8", + "clang": "4", + "msvc": "193", + "Visual Studio": "17", + } def config_options(self): if self.settings.os == "Windows": @@ -41,47 +49,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.is_apple_os(self.settings.os): - raise ConanInvalidConfiguration("{} does not support Apple platform".format(self.name)) + if is_apple_os(self): + raise ConanInvalidConfiguration(f"{self.name} does not support Apple platform") if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 17) + check_min_cppstd(self, self._min_cppstd) - minimum_version = self._compiler_required_cpp17.get(str(self.settings.compiler), False) + 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("{} requires C++17, which your compiler does not support.".format(self.name)) + 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("{0} requires C++17. Your compiler is unknown. Assuming it supports C++17.".format(self.name)) + self.output.warning(f"{self.name} requires C++{self._min_cppstd}. Your compiler is unknown. " + f"Assuming it supports C++{self._min_cppstd}.") if self.settings.compiler == "clang" and self.settings.compiler.get_safe("libcxx") == "libc++": - raise ConanInvalidConfiguration("{} doesn't support clang with libc++".format(self.name)) + raise ConanInvalidConfiguration(f"{self.name} 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.definitions["LIBIPC_BUILD_SHARED_LIBS"] = self.options.shared - self._cmake.configure() - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["LIBIPC_BUILD_SHARED_LIBS"] = self.options.shared + 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) - cmake = self._configure_cmake() + 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 = ["ipc"] if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.system_libs = ["rt", "pthread"] + self.cpp_info.system_libs = ["rt", "pthread", "m"] diff --git a/recipes/cpp-ipc/all/test_package/CMakeLists.txt b/recipes/cpp-ipc/all/test_package/CMakeLists.txt index c258338b9324e..ad0594de35161 100644 --- a/recipes/cpp-ipc/all/test_package/CMakeLists.txt +++ b/recipes/cpp-ipc/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(cpp-ipc REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/cpp-ipc/all/test_package/conanfile.py b/recipes/cpp-ipc/all/test_package/conanfile.py index 49a3a66ea5bad..fae501d0afb9e 100644 --- a/recipes/cpp-ipc/all/test_package/conanfile.py +++ b/recipes/cpp-ipc/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" + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cpp-ipc/all/test_v1_package/CMakeLists.txt b/recipes/cpp-ipc/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/cpp-ipc/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/ofeli/all/test_package/conanfile.py b/recipes/cpp-ipc/all/test_v1_package/conanfile.py similarity index 100% rename from recipes/ofeli/all/test_package/conanfile.py rename to recipes/cpp-ipc/all/test_v1_package/conanfile.py diff --git a/recipes/cpp-ipc/config.yml b/recipes/cpp-ipc/config.yml index 797b8dd014054..3d3b2788da655 100644 --- a/recipes/cpp-ipc/config.yml +++ b/recipes/cpp-ipc/config.yml @@ -1,4 +1,6 @@ versions: + "1.3.0": + folder: all "1.2.0": folder: all "1.1.1": 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..0fc99db4a9b5a 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.3") + self.requires("openssl/[>=1.1 <4]") + + 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 index 0292874c3773e..84cceb8cee130 100644 --- a/recipes/cpp-lazy/all/conandata.yml +++ b/recipes/cpp-lazy/all/conandata.yml @@ -1,4 +1,7 @@ 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" diff --git a/recipes/cpp-lazy/all/conanfile.py b/recipes/cpp-lazy/all/conanfile.py index e137cb684e6b8..eff5d319df990 100644 --- a/recipes/cpp-lazy/all/conanfile.py +++ b/recipes/cpp-lazy/all/conanfile.py @@ -16,8 +16,8 @@ class CpplazyConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/MarcDirven/cpp-lazy" topics = ("lazy evaluation", "header-only") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" - no_copy_source = True @property def _min_cppstd(self): @@ -40,7 +40,7 @@ def validate(self): raise ConanInvalidConfiguration(f"{self.ref} doesn't support apple-clang < 14.0.") def source(self): - get(self, **self.conan_data["sources"][self.version], destination=self.source_folder) + get(self, **self.conan_data["sources"][self.version]) def build(self): apply_conandata_patches(self) @@ -55,5 +55,7 @@ def package(self): ) def package_info(self): + self.cpp_info.set_property("cmake_file_name", "cpp-lazy") + self.cpp_info.set_property("cmake_target_name", "cpp-lazy::cpp-lazy") self.cpp_info.bindirs = [] self.cpp_info.libdirs = [] diff --git a/recipes/cpp-lazy/config.yml b/recipes/cpp-lazy/config.yml index 77c16e87f7d92..3001babefa7f1 100644 --- a/recipes/cpp-lazy/config.yml +++ b/recipes/cpp-lazy/config.yml @@ -1,3 +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/0.x.x/conanfile.py b/recipes/cpp-peglib/0.x.x/conanfile.py index 1121c3515336e..2264c45db7817 100644 --- a/recipes/cpp-peglib/0.x.x/conanfile.py +++ b/recipes/cpp-peglib/0.x.x/conanfile.py @@ -14,6 +14,7 @@ class CpppeglibConan(ConanFile): topics = ("peg", "parser", "header-only") homepage = "https://github.com/yhirose/cpp-peglib" url = "https://github.com/conan-io/conan-center-index" + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -40,8 +41,6 @@ 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.append("pthread") diff --git a/recipes/cpp-peglib/1.x.x/conandata.yml b/recipes/cpp-peglib/1.x.x/conandata.yml index 08e29671dff3e..dcadbbf685932 100644 --- a/recipes/cpp-peglib/1.x.x/conandata.yml +++ b/recipes/cpp-peglib/1.x.x/conandata.yml @@ -1,4 +1,28 @@ sources: + "1.9.1": + url: "https://github.com/yhirose/cpp-peglib/archive/v1.9.1.tar.gz" + sha256: "f57aa0f14372cbb772af29e3a4549a8033ea07eb25c39949cba6178e0e2ba9cc" + "1.9.0": + url: "https://github.com/yhirose/cpp-peglib/archive/v1.9.0.tar.gz" + sha256: "6f4f0956ea2f44fd1c5882f8adc5782451ba9d227c467d214196390ddedb024c" + "1.8.8": + url: "https://github.com/yhirose/cpp-peglib/archive/v1.8.8.tar.gz" + sha256: "3019d8084a146562fe2fd4c71e3226ac6e3994e8cee21cab27b3cd5a86bcef34" + "1.8.7": + url: "https://github.com/yhirose/cpp-peglib/archive/v1.8.7.tar.gz" + sha256: "400696cc7e721b23aeac28a1ae12ceec235e2671888993da2ce012f6acdf83d4" + "1.8.6": + url: "https://github.com/yhirose/cpp-peglib/archive/v1.8.6.tar.gz" + sha256: "b2ebdc135a66074a386d377b761b38e050088fba6482575ca3028d0e184ecd91" + "1.8.5": + url: "https://github.com/yhirose/cpp-peglib/archive/v1.8.5.tar.gz" + sha256: "2813f7ffdeb570959b879ce2bf3921bf4f2edc0d9f1568c4429eceadff9ab114" + "1.8.4": + url: "https://github.com/yhirose/cpp-peglib/archive/v1.8.4.tar.gz" + sha256: "002cec65f659180ba90c0b04ee30a349ca18f0732fbe00e7638f1ead44aeb701" + "1.8.3": + url: "https://github.com/yhirose/cpp-peglib/archive/v1.8.3.tar.gz" + sha256: "3de8aeb44a262f9c2478e2a7e7bc2bb9426a2bdd176cf0654ff5a3d291c77b73" "1.8.2": url: "https://github.com/yhirose/cpp-peglib/archive/v1.8.2.tar.gz" sha256: "eca5d06dafb940ffee8a99060a57272ada7f2486fc21ed1663e4e49851a70e0c" @@ -17,18 +41,3 @@ sources: "1.5.0": url: "https://github.com/yhirose/cpp-peglib/archive/refs/tags/v1.5.0.tar.gz" sha256: "45a02b749556af6ab0abf78c4c1d1afe02f17705b1c51f5820e957616f453b33" - "1.4.2": - url: "https://github.com/yhirose/cpp-peglib/archive/refs/tags/v1.4.2.tar.gz" - sha256: "28a09c1bee50608733a989cd5b62368a767a66f9e1a39654c0342e9698c479ca" - "1.4.1": - url: "https://github.com/yhirose/cpp-peglib/archive/refs/tags/v1.4.1.tar.gz" - sha256: "3784039727f8317cd5e202c5a2d142584bf48a311910643298dc4ba9083424e7" - "1.3.10": - url: "https://github.com/yhirose/cpp-peglib/archive/refs/tags/v1.3.10.tar.gz" - sha256: "9c79abd8a304d163d176918b74d7ab272e6ab1405af2dd699b6b7ae1b5605b09" - "1.3.9": - url: "https://github.com/yhirose/cpp-peglib/archive/refs/tags/v1.3.9.tar.gz" - sha256: "0d14fcbf7ed4409699fff70867c5776a2219e38547de5bf0bf689ba0d58c0d7f" - "1.3.8": - url: "https://github.com/yhirose/cpp-peglib/archive/refs/tags/v1.3.8.tar.gz" - sha256: "6d266806825ec491f1e3d1eb8a2163114f328a691f7c9fbce7bb3edf2f42074c" diff --git a/recipes/cpp-peglib/1.x.x/conanfile.py b/recipes/cpp-peglib/1.x.x/conanfile.py index 6e5ba98921cbb..7d5fb5e5104a5 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,13 @@ def package(self): def package_info(self): self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] + + # Since 1.8.4, cpp-peglib is named as peglib + if Version(self.version) >= "1.8.4": + self.cpp_info.set_property("cmake_file_name", "peglib") + self.cpp_info.set_property("cmake_target_name", "peglib") + 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/CMakeLists.txt b/recipes/cpp-peglib/1.x.x/test_package/CMakeLists.txt index de79c59d80c35..b4be9dd643afb 100644 --- a/recipes/cpp-peglib/1.x.x/test_package/CMakeLists.txt +++ b/recipes/cpp-peglib/1.x.x/test_package/CMakeLists.txt @@ -1,8 +1,15 @@ cmake_minimum_required(VERSION 3.8) project(test_package LANGUAGES CXX) -find_package(cpp-peglib CONFIG REQUIRED) +find_package(cpp-peglib CONFIG) +if (NOT TARGET cpp-peglib::cpp-peglib) + find_package(peglib REQUIRED CONFIG) +endif() add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE cpp-peglib::cpp-peglib) +if (TARGET cpp-peglib::cpp-peglib) + target_link_libraries(${PROJECT_NAME} PRIVATE cpp-peglib::cpp-peglib) +else() + target_link_libraries(${PROJECT_NAME} PRIVATE peglib) +endif() target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) 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 0c3a84819eed8..2235c38ce3f5b 100644 --- a/recipes/cpp-peglib/config.yml +++ b/recipes/cpp-peglib/config.yml @@ -1,4 +1,20 @@ versions: + "1.9.1": + folder: "1.x.x" + "1.9.0": + folder: "1.x.x" + "1.8.8": + folder: "1.x.x" + "1.8.7": + folder: "1.x.x" + "1.8.6": + folder: "1.x.x" + "1.8.5": + folder: "1.x.x" + "1.8.4": + folder: "1.x.x" + "1.8.3": + folder: "1.x.x" "1.8.2": folder: "1.x.x" "1.8.1": @@ -11,15 +27,5 @@ versions: folder: "1.x.x" "1.5.0": folder: "1.x.x" - "1.4.2": - folder: "1.x.x" - "1.4.1": - folder: "1.x.x" - "1.3.10": - folder: "1.x.x" - "1.3.9": - folder: "1.x.x" - "1.3.8": - folder: "1.x.x" "0.1.13": folder: "0.x.x" diff --git a/recipes/cpp-sort/all/conandata.yml b/recipes/cpp-sort/all/conandata.yml index 75a1298f3e54e..c155d44a961c8 100644 --- a/recipes/cpp-sort/all/conandata.yml +++ b/recipes/cpp-sort/all/conandata.yml @@ -1,40 +1,31 @@ sources: + "1.16.0": + url: "https://github.com/Morwenn/cpp-sort/archive/1.16.0.tar.gz" + sha256: "54eb65de5655ce58719d45616f29e4b9060135b9cc8b526bcfc9f5434975ea8c" + "1.15.0": + url: "https://github.com/Morwenn/cpp-sort/archive/1.15.0.tar.gz" + sha256: "886e813a4b87c6361e9b50c0a66c73b3b812f0ce0b7039ff3991eddce77e0dc7" + "1.14.0": + url: "https://github.com/Morwenn/cpp-sort/archive/1.14.0.tar.gz" + sha256: "3b85cd4580f54ae3f171777d0630b4f7c89c33cf96e9ae24a1dbebbf200c3195" "1.13.2": - sha256: f5384ed9c8abef2f26cb010df2687ac8bba52f0e1726935826a80e83c1347b23 - url: https://github.com/Morwenn/cpp-sort/archive/1.13.2.tar.gz + url: "https://github.com/Morwenn/cpp-sort/archive/1.13.2.tar.gz" + sha256: "f5384ed9c8abef2f26cb010df2687ac8bba52f0e1726935826a80e83c1347b23" "1.13.1": - sha256: 139912c6004df8748bb1cfd3b94f2c6bfc2713885ed4b8e927a783d6b66963a8 - url: https://github.com/Morwenn/cpp-sort/archive/1.13.1.tar.gz + url: "https://github.com/Morwenn/cpp-sort/archive/1.13.1.tar.gz" + sha256: "139912c6004df8748bb1cfd3b94f2c6bfc2713885ed4b8e927a783d6b66963a8" "1.13.0": - sha256: 646eca5c592d20cbde0fbff41c65527940bb6430be68e0224fb5fcbf38b0df92 - url: https://github.com/Morwenn/cpp-sort/archive/1.13.0.tar.gz + url: "https://github.com/Morwenn/cpp-sort/archive/1.13.0.tar.gz" + sha256: "646eca5c592d20cbde0fbff41c65527940bb6430be68e0224fb5fcbf38b0df92" "1.12.1": - sha256: 5b0b6f3b4d9ecc339d6c2204a18479edca49fbc4d487413e0ec747e143569e2a - url: https://github.com/Morwenn/cpp-sort/archive/1.12.1.tar.gz + url: "https://github.com/Morwenn/cpp-sort/archive/1.12.1.tar.gz" + sha256: "5b0b6f3b4d9ecc339d6c2204a18479edca49fbc4d487413e0ec747e143569e2a" "1.12.0": - sha256: 70877c1993fa1e5eb53974ac30aeb713448c206344379f193dec8ee887c23998 - url: https://github.com/Morwenn/cpp-sort/archive/1.12.0.tar.gz + url: "https://github.com/Morwenn/cpp-sort/archive/1.12.0.tar.gz" + sha256: "70877c1993fa1e5eb53974ac30aeb713448c206344379f193dec8ee887c23998" "1.11.0": - sha256: a53b3ea240d6f8d8ea9da0a7e0c8e313cf5e714daedf1617473ab34f111ffeec - url: https://github.com/Morwenn/cpp-sort/archive/1.11.0.tar.gz + url: "https://github.com/Morwenn/cpp-sort/archive/1.11.0.tar.gz" + sha256: "a53b3ea240d6f8d8ea9da0a7e0c8e313cf5e714daedf1617473ab34f111ffeec" "1.10.0": - sha256: 48951cac0051d48fee286c3bc02804975f9d83269d80c10dfc5589e76a542765 - url: https://github.com/Morwenn/cpp-sort/archive/1.10.0.tar.gz - "1.9.0": - sha256: e83f3daad30bd91fed668bdb56ad379c4aeea39d7dc640484fdcc55149b6d0e4 - url: https://github.com/Morwenn/cpp-sort/archive/1.9.0.tar.gz - "1.8.1": - sha256: 04d518dabb422614fcb4a2b4e258c515f31dd01d51c26e9eaaec76e77c4d3d40 - url: https://github.com/Morwenn/cpp-sort/archive/1.8.1.tar.gz - "1.8.0": - sha256: a3de426a66cffbe9f8865feb7518ff4f4d1b3aadf3725161b8e118dcbf6fe9b9 - url: https://github.com/Morwenn/cpp-sort/archive/1.8.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 + url: "https://github.com/Morwenn/cpp-sort/archive/1.10.0.tar.gz" + sha256: "48951cac0051d48fee286c3bc02804975f9d83269d80c10dfc5589e76a542765" diff --git a/recipes/cpp-sort/all/conanfile.py b/recipes/cpp-sort/all/conanfile.py index 881a2c63d61be..8dec2c54472db 100644 --- a/recipes/cpp-sort/all/conanfile.py +++ b/recipes/cpp-sort/all/conanfile.py @@ -1,12 +1,11 @@ -import os.path - 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 check_min_vs, is_msvc +from conan.tools.microsoft import is_msvc from conan.tools.scm import Version +import os required_conan_version = ">=1.50.0" @@ -14,20 +13,23 @@ class CppSortConan(ConanFile): name = "cpp-sort" description = "Additional sorting algorithms & related tools" - topics = "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 = ("sorting", "algorithms", "header-only") + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - settings = "os", "compiler", "build_type", "arch" @property - def _minimum_cpp_standard(self): + def _min_cppstd(self): return 14 @property def _compilers_minimum_version(self): return { + "Visual Studio": "16", + "msvc": "192", "apple-clang": "9.4", "clang": "3.8", "gcc": "5.5" @@ -36,33 +38,30 @@ def _compilers_minimum_version(self): 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"): - check_min_cppstd(self, self._minimum_cpp_standard) + check_min_cppstd(self, self._min_cppstd) - if is_msvc(self): - if Version(self.version) < "1.10.0": - raise ConanInvalidConfiguration("cpp-sort versions older than 1.10.0 do not support MSVC") - check_min_vs(self, 192) - return - - compiler = self.settings.compiler - try: - min_version = self._compilers_minimum_version[str(compiler)] - 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) - 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) + 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] + + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler)) + 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], 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,10 +86,9 @@ def package(self): 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.clear() diff --git a/recipes/cpp-sort/all/test_package/CMakeLists.txt b/recipes/cpp-sort/all/test_package/CMakeLists.txt index fe9c658362ade..da13330ac49af 100644 --- a/recipes/cpp-sort/all/test_package/CMakeLists.txt +++ b/recipes/cpp-sort/all/test_package/CMakeLists.txt @@ -5,5 +5,5 @@ project(test_package LANGUAGES CXX) 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_v1_package/CMakeLists.txt b/recipes/cpp-sort/all/test_v1_package/CMakeLists.txt index 4ebb96b60a293..2a9b48732268c 100644 --- a/recipes/cpp-sort/all/test_v1_package/CMakeLists.txt +++ b/recipes/cpp-sort/all/test_v1_package/CMakeLists.txt @@ -1,12 +1,9 @@ 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-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) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/cpp-sort/all/test_v1_package/cpp-sort-integrity.cpp b/recipes/cpp-sort/all/test_v1_package/cpp-sort-integrity.cpp deleted file mode 100644 index 05f269569147f..0000000000000 --- a/recipes/cpp-sort/all/test_v1_package/cpp-sort-integrity.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2018-2020 Morwenn. - * - * SPDX-License-Identifier: MIT - */ -#include -#include -#include -#include -#include - -int main() -{ - int arr[] = { 5, 8, 3, 2, 9 }; - cppsort::smooth_sort(arr); - assert(std::is_sorted(std::begin(arr), std::end(arr))); - - // should print 2 3 5 8 9 - for (int val: arr) { - std::cout << val << ' '; - } -} diff --git a/recipes/cpp-sort/config.yml b/recipes/cpp-sort/config.yml index 55b2c50d93416..ce014d3a22c71 100644 --- a/recipes/cpp-sort/config.yml +++ b/recipes/cpp-sort/config.yml @@ -1,4 +1,10 @@ versions: + "1.16.0": + folder: all + "1.15.0": + folder: all + "1.14.0": + folder: all "1.13.2": folder: all "1.13.1": @@ -13,15 +19,3 @@ versions: folder: all "1.10.0": folder: all - "1.9.0": - folder: all - "1.8.1": - folder: all - "1.8.0": - folder: all - "1.7.0": - folder: all - "1.6.0": - folder: all - "1.5.1": - folder: all diff --git a/recipes/cpp-validator/all/conandata.yml b/recipes/cpp-validator/all/conandata.yml new file mode 100644 index 0000000000000..77d92b9be932b --- /dev/null +++ b/recipes/cpp-validator/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "2.0.3": + url: "https://github.com/evgeniums/cpp-validator/archive/refs/tags/v2.0.3.tar.gz" + sha256: "0afc607377518edd6adc1612962ed5d5808d96e5b40944d9ce7e91a1aa9ab1d8" diff --git a/recipes/cpp-validator/all/conanfile.py b/recipes/cpp-validator/all/conanfile.py new file mode 100644 index 0000000000000..befec7e45358b --- /dev/null +++ b/recipes/cpp-validator/all/conanfile.py @@ -0,0 +1,89 @@ +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 CPPValidatorConan(ConanFile): + name = "cpp-validator" + description = "C++ header-only library for generic data validation" + license = "BSL-1.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/evgeniums/cpp-validator" + topics = ("validator", "validation", "boost", "hana", "header-only") + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _min_cppstd(self): + # cpp-validator rquires C++17 on MSVC + # https://github.com/evgeniums/cpp-validator/blob/v2.0.3/CMakeLists.txt#L241 + return "17" if is_msvc(self) else "14" + + @property + def _compilers_minimum_version(self): + return { + "14": { + "gcc": "6", + "clang": "5", + "apple-clang": "10", + "Visual Studio": "15", + "msvc": "191", + }, + "17": { + "gcc": "8", + "clang": "7", + "apple-clang": "12", + "Visual Studio": "16", + "msvc": "192", + } + }.get(self._min_cppstd, {}) + + 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 requirements(self): + self.requires("boost/1.83.0") + self.requires("fmt/10.2.1") + + 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="*.hpp", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include"), + ) + copy( + self, + pattern="*.ipp", + 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-validator/all/test_package/CMakeLists.txt b/recipes/cpp-validator/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..aaf79983c7d60 --- /dev/null +++ b/recipes/cpp-validator/all/test_package/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(cpp-validator REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} cpp-validator::cpp-validator) +if(MSVC) + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +else() + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) +endif() diff --git a/recipes/cpp-validator/all/test_package/conanfile.py b/recipes/cpp-validator/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/cpp-validator/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cpp-validator/all/test_package/test_package.cpp b/recipes/cpp-validator/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..9b71de3f6c7ab --- /dev/null +++ b/recipes/cpp-validator/all/test_package/test_package.cpp @@ -0,0 +1,25 @@ +#include + +#include "dracosha/validator/validator.hpp" +#include "dracosha/validator/validate.hpp" +using namespace DRACOSHA_VALIDATOR_NAMESPACE; + +int main() +{ + + // define validator + auto v=validator(gt,100); // value must be greater than 100 + + // validate variables + error err; + + validate(90,v,err); + assert(err); // validation failed, 90 is less than 100 + + validate(200,v,err); + assert(!err); // validation succeeded, 200 is greater than 100 + + std::cout << "Example 1 done" << std::endl; + + return 0; +} diff --git a/recipes/cpp-validator/config.yml b/recipes/cpp-validator/config.yml new file mode 100644 index 0000000000000..7f57148a20478 --- /dev/null +++ b/recipes/cpp-validator/config.yml @@ -0,0 +1,3 @@ +versions: + "2.0.3": + folder: all diff --git a/recipes/cpp-yyjson/all/conandata.yml b/recipes/cpp-yyjson/all/conandata.yml new file mode 100644 index 0000000000000..acb24326f9a42 --- /dev/null +++ b/recipes/cpp-yyjson/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "0.6.0": + url: "https://github.com/yosh-matsuda/cpp-yyjson/archive/refs/tags/v0.6.0.tar.gz" + sha256: "e146e5e2de023a83ffafba52320506bd25512e6ae9d13ee7836110f659253914" + "0.5.0": + url: "https://github.com/yosh-matsuda/cpp-yyjson/archive/refs/tags/v0.5.0.tar.gz" + sha256: "c1d44460c9ca3c21d5cfaea882ffaca83565c24984c5d17322e0b74a84ececfc" diff --git a/recipes/cpp-yyjson/all/conanfile.py b/recipes/cpp-yyjson/all/conanfile.py new file mode 100644 index 0000000000000..1e453082ca159 --- /dev/null +++ b/recipes/cpp-yyjson/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 copy, get +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 CppYyjsonConan(ConanFile): + name = "cpp-yyjson" + description = "Ultra-fast and intuitive C++ JSON reader/writer with yyjson backend" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/yosh-matsuda/cpp-yyjson" + topics = ("json", "reader", "writer", "header-only") + package_type = "header-library" + 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": "15", + "apple-clang": "14", + "Visual Studio": "17", + "msvc": "193", + } + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + if Version(self.version) < "0.6.0": + self.requires("yyjson/0.9.0") + else: + self.requires("yyjson/0.10.0") + self.requires("fmt/10.2.1") + self.requires("nameof/0.10.4") + + 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, "LICENSE", 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_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + if is_msvc(self): + self.cpp_info.cxxflags.append("/Zc:preprocessor") + + self.cpp_info.set_property("cmake_file_name", "cpp_yyjson") + self.cpp_info.set_property("cmake_target_name", "cpp_yyjson::cpp_yyjson") diff --git a/recipes/cpp-yyjson/all/test_package/CMakeLists.txt b/recipes/cpp-yyjson/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..f2fd7795754c4 --- /dev/null +++ b/recipes/cpp-yyjson/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(cpp_yyjson REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE cpp_yyjson::cpp_yyjson) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) diff --git a/recipes/cpp-yyjson/all/test_package/conanfile.py b/recipes/cpp-yyjson/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/cpp-yyjson/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cpp-yyjson/all/test_package/test_package.cpp b/recipes/cpp-yyjson/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..f4345c086ba90 --- /dev/null +++ b/recipes/cpp-yyjson/all/test_package/test_package.cpp @@ -0,0 +1,52 @@ +#include +#include +#include + +#include "cpp_yyjson.hpp" + +using namespace yyjson; + +auto json_str = R"( +{ + "id": 1, + "pi": 3.141592, + "name": "example", + "array": [0, 1, 2, 3, 4], + "currency": { + "USD": 129.66, + "EUR": 140.35, + "GBP": 158.72 + }, + "success": true +})"; + +int main() { + // Read JSON string and cast as an object class + auto obj = *read(json_str).as_object(); + + // Key access to the JSON object class + auto id = *obj["id"].as_int(); + auto pi = *obj["pi"].as_real(); + auto name = *obj["name"].as_string(); + auto success = *obj["success"].as_bool(); + + // JSON array/object classes adapt the range concept + auto list = *obj["array"].as_array(); + for (const auto& v : list) { + // `write` returns JSON read-only string + std::cout << v.write() << std::endl; + } + + // The range value type of object class is a key-value pair + auto dict = *obj["currency"].as_object(); + for (const auto& [k, v] : dict) { + std::cout << "{" << k << ": " << v.write() << "}" << std::endl; + } + + // JSON array/object to container conversion + auto numbers = cast>(list); + auto currency = cast>(dict); + + // Stringify read-only string + std::cout << obj.write() << std::endl; +} diff --git a/recipes/cpp-yyjson/config.yml b/recipes/cpp-yyjson/config.yml new file mode 100644 index 0000000000000..33d7618432d30 --- /dev/null +++ b/recipes/cpp-yyjson/config.yml @@ -0,0 +1,5 @@ +versions: + "0.6.0": + folder: all + "0.5.0": + folder: all diff --git a/recipes/cpp_project_framework/all/conanfile.py b/recipes/cpp_project_framework/all/conanfile.py index 5a2a5fe5679e4..00ce6a88bd921 100644 --- a/recipes/cpp_project_framework/all/conanfile.py +++ b/recipes/cpp_project_framework/all/conanfile.py @@ -1,24 +1,26 @@ +import os + from conan import ConanFile -from conan.tools.files import get +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 conans.errors import ConanInvalidConfiguration -from conans.tools import check_min_cppstd -import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" class CppProjectFrameworkConan(ConanFile): name = "cpp_project_framework" + description = "C++ Project Framework is a framework for creating C++ projects." license = "AGPL-3.0" + url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/sheepgrass/cpp_project_framework" - url = "https://github.com/conan-io/conan-center-index" # Package recipe repository url here, for issues about the package - description = "C++ Project Framework is a framework for creating C++ project." - topics = ("cpp", "project", "framework") - settings = "os", "compiler", "build_type", "arch" + topics = ("cpp", "project", "framework", "header-only") - def package_id(self): - self.info.header_only() + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True @property def _minimum_cpp_standard(self): @@ -28,38 +30,52 @@ def _minimum_cpp_standard(self): def _minimum_compilers_version(self): return { "Visual Studio": "16", + "msvc": "192", "gcc": "7", "clang": "6", "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.os not in ('Linux', 'Windows'): - raise ConanInvalidConfiguration(f"{self.name} is just supported for Linux and Windows") + if self.settings.os not in ("Linux", "FreeBSD", "Windows"): + raise ConanInvalidConfiguration(f"{self.name} is only supported on Linux and Windows") compiler = self.settings.compiler if compiler.get_safe("cppstd"): check_min_cppstd(self, self._minimum_cpp_standard) - if compiler in ('gcc', 'clang'): - if compiler.get_safe("libcxx") != "libstdc++": - raise ConanInvalidConfiguration(f"only supported {compiler} with libstdc++") + if compiler in ("gcc", "clang"): + if not compiler.get_safe("libcxx", "").startswith("libstdc++"): + raise ConanInvalidConfiguration(f"{self.name} is only supported {compiler} with libstdc++") min_version = self._minimum_compilers_version.get(str(compiler)) if not min_version: - self.output.warn(f"{self.name} recipe lacks information about the {compiler} compiler support.") + self.output.warning(f"{self.name} recipe lacks information about the {compiler} compiler support.") else: if Version(compiler.version) < min_version: - raise ConanInvalidConfiguration(f"{self.name} requires C++{self._minimum_cpp_standard} support. The current compiler {compiler} {compiler.version} does not support it.") - - @property - def _source_subfolder(self): - return "source_subfolder" + raise ConanInvalidConfiguration( + f"{self.name} requires C++{self._minimum_cpp_standard} support. " + f"The current compiler {compiler} {compiler.version} does not support it." + ) 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 package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("*.h", dst=os.path.join("include", self.name), src=os.path.join(self._source_subfolder, self.name)) + copy(self, "LICENSE", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder) + copy(self, "*.h", + dst=os.path.join(self.package_folder, "include", self.name), + src=os.path.join(self.source_folder, self.name)) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/cpp_project_framework/all/test_package/CMakeLists.txt b/recipes/cpp_project_framework/all/test_package/CMakeLists.txt index d3c22a987a39d..9edc8bb602af7 100644 --- a/recipes/cpp_project_framework/all/test_package/CMakeLists.txt +++ b/recipes/cpp_project_framework/all/test_package/CMakeLists.txt @@ -1,18 +1,14 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(PackageTest CXX) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED True) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(cpp_project_framework REQUIRED) -find_package(GTest REQUIRED) +find_package(cpp_project_framework REQUIRED CONFIG) +find_package(GTest REQUIRED CONFIG) add_executable(test_package test_package.cpp) +target_link_libraries(test_package PRIVATE cpp_project_framework::cpp_project_framework GTest::gtest GTest::gtest_main) if(UNIX) - target_link_libraries(test_package cpp_project_framework::cpp_project_framework GTest::gtest GTest::gtest_main stdc++fs) -else() - target_link_libraries(test_package cpp_project_framework::cpp_project_framework GTest::gtest GTest::gtest_main) + target_link_libraries(test_package PRIVATE stdc++fs) endif() diff --git a/recipes/cpp_project_framework/all/test_package/conanfile.py b/recipes/cpp_project_framework/all/test_package/conanfile.py index ed8a4e73713c6..c31dc0dd89d14 100644 --- a/recipes/cpp_project_framework/all/test_package/conanfile.py +++ b/recipes/cpp_project_framework/all/test_package/conanfile.py @@ -1,13 +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_layout, CMake import os -class CppProjectFrameworkTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" - requires = "gtest/1.10.0" +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) + self.requires("gtest/1.13.0") + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -15,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/cpp_project_framework/all/test_v1_package/CMakeLists.txt b/recipes/cpp_project_framework/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/cpp_project_framework/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/cpp_project_framework/all/test_v1_package/conanfile.py b/recipes/cpp_project_framework/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..0761aa549fc91 --- /dev/null +++ b/recipes/cpp_project_framework/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 +import os + + +class CppProjectFrameworkTestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + requires = "gtest/1.13.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/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..798d4ebbff0a7 100644 --- a/recipes/cppbenchmark/all/conandata.yml +++ b/recipes/cppbenchmark/all/conandata.yml @@ -1,14 +1,30 @@ -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.4.0": + url: "https://github.com/chronoxor/CppBenchmark/archive/1.0.4.0.tar.gz" + sha256: "44fec3d4264b6654999dfa0f6ceb8a7aeef4eca32db0d229fba70819e11cede0" + "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.4.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.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..cf8688e000658 100644 --- a/recipes/cppbenchmark/all/conanfile.py +++ b/recipes/cppbenchmark/all/conanfile.py @@ -1,33 +1,34 @@ -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 - - @property - def _source_subfolder(self): - return "source_subfolder" + topics = ("utils", "library", "benchmark") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "fPIC": [True, False], + "shared": [True, False], + } + default_options = { + "fPIC": True, + "shared": False, + } @property - def _build_subfolder(self): - return "build_subfolder" + def _min_cppstd(self): + return 17 @property def _compilers_minimum_version(self): @@ -36,23 +37,11 @@ def _compilers_minimum_version(self): "clang": 6, "gcc": 7, "Visual Studio": 16, + "msvc": 192, } - 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 +49,50 @@ 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.6") + self.requires("cpp-optparse/cci.20171104") + + 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: - 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 build(self): - self._patch() + def build_requirements(self): + self.tool_requires("cmake/[>=3.20 <4]") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) - cmake = self._configure_cmake() + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CPPBENCHMARK_MODULE"] = "OFF" + tc.generate() + + 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/imgui/all/test_v1_package/CMakeLists.txt b/recipes/cppbenchmark/all/test_v1_package/CMakeLists.txt similarity index 100% rename from recipes/imgui/all/test_v1_package/CMakeLists.txt rename to recipes/cppbenchmark/all/test_v1_package/CMakeLists.txt diff --git a/recipes/imgui/all/test_v1_package/conanfile.py b/recipes/cppbenchmark/all/test_v1_package/conanfile.py similarity index 100% rename from recipes/imgui/all/test_v1_package/conanfile.py rename to recipes/cppbenchmark/all/test_v1_package/conanfile.py diff --git a/recipes/cppbenchmark/config.yml b/recipes/cppbenchmark/config.yml index d5be188752108..6a65865cd6cb1 100644 --- a/recipes/cppbenchmark/config.yml +++ b/recipes/cppbenchmark/config.yml @@ -1,5 +1,9 @@ versions: - "cci.20201029": + "1.0.4.0": + folder: all + "1.0.3.0": folder: all "1.0.0.0": folder: all + "cci.20201029": + folder: all diff --git a/recipes/cppcheck/all/conandata.yml b/recipes/cppcheck/all/conandata.yml index d97f5c1a31a95..bcd181448f979 100644 --- a/recipes/cppcheck/all/conandata.yml +++ b/recipes/cppcheck/all/conandata.yml @@ -1,15 +1,44 @@ sources: - "2.9.2": - url: "https://github.com/danmar/cppcheck/archive/2.9.2.tar.gz" - sha256: "93920d24d4442856bf7916ee0e3fc31308bc23948e7029b4fd332e01cac63c3e" + "2.16.0": + url: "https://github.com/danmar/cppcheck/archive/2.16.0.tar.gz" + sha256: "f1a97c8cef5ee9d0abb57e9244549d4fe18d4ecac80cf82e250d1fc5f38b1501" + "2.15.0": + url: "https://github.com/danmar/cppcheck/archive/2.15.0.tar.gz" + sha256: "98bcc40ac8062635b492fb096d7815376a176ae26749d6c708083f4637f7c0bb" + "2.14.2": + url: "https://github.com/danmar/cppcheck/archive/2.14.2.tar.gz" + sha256: "9c3acea5f489336bd83a8ea33917a9a04a80c56d874bf270287e7de27acf2d00" + "2.13.4": + url: "https://github.com/danmar/cppcheck/archive/2.13.4.tar.gz" + sha256: "d6ea064ebab76c6aa000795440479767d8d814dd29405918df4c1bbfcd6cb86c" + "2.12.1": + url: "https://github.com/danmar/cppcheck/archive/2.12.1.tar.gz" + sha256: "2a3d4ba1179419612183ab3d6aed6d3b18be75e98cd6f138ea8e2020905dced2" + "2.11.1": + url: "https://github.com/danmar/cppcheck/archive/2.11.1.tar.gz" + sha256: "fef6ef868d562d49136f158e1d0f7a38237e7e1c0a91d9189bdd465f1fe54316" + "2.10.3": + url: "https://github.com/danmar/cppcheck/archive/2.10.3.tar.gz" + sha256: "8aae5e116daeaaf5d19f3efa61b91c06f161cb97412a1d1af6e1e20686e48967" + "2.9.3": + url: "https://github.com/danmar/cppcheck/archive/2.9.3.tar.gz" + sha256: "46319ca73e33e4b2bd91981a76a0d4f184cd3f86b62dc18e8938eabacd3ad2e3" "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" patches: - "2.9.2": + "2.11.1": + - patch_file: "patches/0003-pcre-debuglib-name.patch" + patch_description: "Consider the Debug suffix for Windows" + patch_type: "portability" + "2.10.3": + - 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/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" @@ -29,10 +58,3 @@ patches: - 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" - 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 4427cdebe7d18..5565cc030be41 100644 --- a/recipes/cppcheck/all/conanfile.py +++ b/recipes/cppcheck/all/conanfile.py @@ -1,7 +1,6 @@ from conan import ConanFile -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, rmdir +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get from conan.tools.scm import Version import os @@ -10,43 +9,45 @@ class CppcheckConan(ConanFile): name = "cppcheck" + description = "Cppcheck is an analysis tool for C/C++ code." + license = "GPL-3.0-or-later" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/danmar/cppcheck" topics = ("code quality", "static analyzer", "linter") - description = "Cppcheck is an analysis tool for C/C++ code." - license = "GPL-3.0-or-later" + package_type = "application" settings = "os", "arch", "compiler", "build_type" - options = {"with_z3": [True, False], "have_rules": [True, False]} - default_options = {"with_z3": True, "have_rules": True} - - def layout(self): - cmake_layout(self) + options = { + "have_rules": [True, False], + } + default_options = { + "have_rules": True, + } def export_sources(self): export_conandata_patches(self) - def config_options(self): - if Version(self.version) >= Version("2.8.0"): - del self.options.with_z3 + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - if self.options.get_safe("with_z3", default=False): - self.requires("z3/4.8.8") - if self.options.have_rules: + if self.options.get_safe("have_rules"): self.requires("pcre/8.45") + def package_id(self): + del self.info.settings.compiler + del self.info.settings.build_type + def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) 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["HAVE_RULES"] = self.options.get_safe("have_rules", False) tc.variables["USE_MATCHCOMPILER"] = "Auto" tc.variables["ENABLE_OSS_FUZZ"] = False - if is_apple_os(self): - tc.variables["FILESDIR"] = os.path.join(self.package_folder, "bin", "cfg") + if Version(self.version) >= "2.11.0": + tc.variables["DISABLE_DMAKE"] = True + tc.variables["FILESDIR"] = "bin" tc.generate() deps = CMakeDeps(self) @@ -60,19 +61,17 @@ def build(self): def package(self): copy(self, "COPYING", dst=os.path.join(self.package_folder, "licenses"), src=os.path.join(self.source_folder)) - copy(self, "*", dst=os.path.join(self.package_folder, "bin", "cfg"), src=os.path.join(self.source_folder, "cfg")) 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() - 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.env_info.PATH.append(bin_folder) + 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/0003-pcre-debuglib-name-2.7.patch b/recipes/cppcheck/all/patches/0003-pcre-debuglib-name-2.7.patch deleted file mode 100644 index fa8b46fd1608e..0000000000000 --- a/recipes/cppcheck/all/patches/0003-pcre-debuglib-name-2.7.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- 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/test_package/conanfile.py b/recipes/cppcheck/all/test_package/conanfile.py index f29289a5751d7..a590f2dcaaa60 100644 --- a/recipes/cppcheck/all/test_package/conanfile.py +++ b/recipes/cppcheck/all/test_package/conanfile.py @@ -1,11 +1,9 @@ from conan import ConanFile from conan.tools.build import can_run -import sys class TestPackageConan(ConanFile): settings = "os", "arch" - generators = "VirtualRunEnv" test_type = "explicit" def build_requirements(self): @@ -14,8 +12,8 @@ def build_requirements(self): def test(self): if can_run(self): self.run("cppcheck --enable=warning,style,performance --std=c++11 .", - cwd=self.source_folder, run_environment=True) + cwd=self.source_folder) if self.settings.os == "Windows": - self.run(f"{sys.executable} %CPPCHECK_HTMLREPORT% -h", run_environment=True) + self.run("set CPPCHECK_HTMLREPORT") else: - self.run("cppcheck-htmlreport -h", run_environment=True) + self.run("which cppcheck-htmlreport") diff --git a/recipes/cppcheck/all/test_v1_package/conanfile.py b/recipes/cppcheck/all/test_v1_package/conanfile.py index 14b7ebe1713c7..0102e14ac0191 100644 --- a/recipes/cppcheck/all/test_v1_package/conanfile.py +++ b/recipes/cppcheck/all/test_v1_package/conanfile.py @@ -12,7 +12,6 @@ def test(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/config.yml b/recipes/cppcheck/config.yml index bc6d13a4fc4ca..245176dc92cfa 100644 --- a/recipes/cppcheck/config.yml +++ b/recipes/cppcheck/config.yml @@ -1,7 +1,19 @@ versions: - "2.9.2": + "2.16.0": folder: all - "2.8.2": + "2.15.0": + folder: all + "2.14.2": + folder: all + "2.13.4": + folder: all + "2.12.1": folder: all - "2.7.5": + "2.11.1": + folder: all + "2.10.3": + folder: all + "2.9.3": + folder: all + "2.8.2": folder: all diff --git a/recipes/cppcmd/all/conanfile.py b/recipes/cppcmd/all/conanfile.py index f83b9294d4efa..8e60072bb9375 100644 --- a/recipes/cppcmd/all/conanfile.py +++ b/recipes/cppcmd/all/conanfile.py @@ -1,7 +1,13 @@ +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.scm import Version +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout import os -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -from glob import glob + + +required_conan_version = ">=1.52.0" class CppCmdConan(ConanFile): @@ -11,57 +17,57 @@ class CppCmdConan(ConanFile): homepage = "https://github.com/remysalim/cppcmd" url = "https://github.com/conan-io/conan-center-index" license = "MIT" + package_type = "header-library" settings = "os", "compiler", "arch", "build_type" - generators = "cmake" no_copy_source = True @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - - @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": "15.7", + "msvc": "192", "gcc": "8", "clang": "7", "apple-clang": "10.2", } - def configure(self): - 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 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++17 support. The current compiler {} {} does not support it.".format( - self.name, self.settings.compiler, self.settings.compiler.version)) + 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 package_id(self): + self.info.clear() def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = glob("cppcmd-*")[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.variables["BUILD_TESTS"] = False + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + # header_only - no build 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["BUILD_TESTS"] = "OFF" - cmake.configure(source_folder=self._source_subfolder, - build_folder=self._build_subfolder) cmake.install() - def package_id(self): - self.info.header_only() + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/cppcmd/all/test_package/CMakeLists.txt b/recipes/cppcmd/all/test_package/CMakeLists.txt index 1ecd7e0a81c7b..9c5302dc6f47d 100644 --- a/recipes/cppcmd/all/test_package/CMakeLists.txt +++ b/recipes/cppcmd/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.5) -project(test_package) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(cppcmd REQUIRED CONFIG) add_executable(${PROJECT_NAME} main.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} cppcmd::cppcmd) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/cppcmd/all/test_package/conanfile.py b/recipes/cppcmd/all/test_package/conanfile.py index bd7165a553cf4..3a91c9439218e 100644 --- a/recipes/cppcmd/all/test_package/conanfile.py +++ b/recipes/cppcmd/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cppcmd/all/test_package/main.cpp b/recipes/cppcmd/all/test_package/main.cpp index 186e15bf7de57..94c409d3743fc 100644 --- a/recipes/cppcmd/all/test_package/main.cpp +++ b/recipes/cppcmd/all/test_package/main.cpp @@ -1,5 +1,7 @@ #include +#include +#include #include using namespace cppcmd; diff --git a/recipes/cppcodec/all/conanfile.py b/recipes/cppcodec/all/conanfile.py index 59f96dbe4a59f..abb2abaee1872 100644 --- a/recipes/cppcodec/all/conanfile.py +++ b/recipes/cppcodec/all/conanfile.py @@ -17,6 +17,7 @@ class CppcodecConan(ConanFile): "base32hex and hex (a.k.a. base16) as specified in RFC 4648, plus Crockford's base32" ) topics = ("base64", "cpp11", "codec", "base32") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -31,8 +32,7 @@ def validate(self): 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 build(self): pass @@ -45,4 +45,3 @@ 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/cppcommon/all/CMakeLists.txt b/recipes/cppcommon/all/CMakeLists.txt deleted file mode 100644 index 6ba47d078b389..0000000000000 --- a/recipes/cppcommon/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/cppcommon/all/conandata.yml b/recipes/cppcommon/all/conandata.yml index c69e434893cba..0a74dfd6a553f 100644 --- a/recipes/cppcommon/all/conandata.yml +++ b/recipes/cppcommon/all/conandata.yml @@ -1,43 +1,86 @@ sources: + "1.0.4.0": + url: "https://github.com/chronoxor/CppCommon/archive/1.0.4.0.tar.gz" + sha256: "724865a64309ab24b3e10d29b04dfec821003013635eff84dd2108f98e7a6fc3" + "1.0.3.0": + url: "https://github.com/chronoxor/CppCommon/archive/1.0.3.0.tar.gz" + sha256: "af530d3550a050d4ed73a680b016e043ea6f4f56e11163226f2a6e24d9eae4ca" + "1.0.2.0": + url: "https://github.com/chronoxor/CppCommon/archive/1.0.2.0.tar.gz" + sha256: "1a748159ab5d0eb74a6c7b110606718caa779cdf17b3e91bf0dbd0e297823dec" + "1.0.1.0": + url: "https://github.com/chronoxor/CppCommon/archive/1.0.1.0.tar.gz" + sha256: "974ac65c72bb57bc6cbe825990e595fd40ead8c1e66e00c1206b19f749697878" "1.0.0.0": url: "https://github.com/chronoxor/CppCommon/archive/1.0.0.0.tar.gz" sha256: "d6124dd4cd430e5f10c2942ff02a95636369875b652e66a499b01f1fb3ecfd6d" "cci.20201104": url: "https://github.com/chronoxor/CppCommon/archive/cacfa9554d367467808663d9d5a695933ae566bb.tar.gz" sha256: "d2e717798e1668c831ee977763eaff7413ef48e6e0914a6322c9918016092048" - "1.0.1.0": - url: "https://github.com/chronoxor/CppCommon/archive/1.0.1.0.tar.gz" - sha256: "974ac65c72bb57bc6cbe825990e595fd40ead8c1e66e00c1206b19f749697878" - "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.4.0": + - patch_file: "patches/0001-update-cmakelists-1-0-4-0.patch" + patch_description: "use cci packages" + patch_type: "conan" + - patch_file: "patches/0003-define-win32-winnt-1-0-4-0.patch" + patch_description: "define _WIN32_WINNT" + patch_type: "portability" + "1.0.3.0": + - patch_file: "patches/0001-update-cmakelists-1-0-3-0.patch" + patch_description: "use cci packages" + patch_type: "conan" + - patch_file: "patches/0003-define-win32-winnt-1-0-1-0.patch" + patch_description: "define _WIN32_WINNT" + patch_type: "portability" + - patch_file: "patches/0004-include-cstdint-1-0-0.patch" + patch_description: "include cstdint" + patch_type: "portability" + "1.0.2.0": + - patch_file: "patches/0001-update-cmakelists-1-0-1-0.patch" + patch_description: "use cci packages" + patch_type: "conan" + - patch_file: "patches/0003-define-win32-winnt-1-0-1-0.patch" + patch_description: "define _WIN32_WINNT" + patch_type: "portability" + - patch_file: "patches/0004-include-cstdint-1-0-0.patch" + patch_description: "include cstdint" + patch_type: "portability" + "1.0.1.0": + - patch_file: "patches/0001-update-cmakelists-1-0-1-0.patch" + patch_description: "use cci packages" + patch_type: "conan" + - patch_file: "patches/0003-define-win32-winnt-1-0-1-0.patch" + patch_description: "define _WIN32_WINNT" + patch_type: "portability" + - patch_file: "patches/0004-include-cstdint-1-0-0.patch" + patch_description: "include cstdint" + patch_type: "portability" + - patch_file: "patches/0005-include-mutex-1-0-0.patch" + patch_description: "include cstdint" + patch_type: "portability" "1.0.0.0": - patch_file: "patches/0001-update-cmakelists-1-0-0-0.patch" - base_path: "source_subfolder" + patch_description: "use cci packages" + patch_type: "conan" - patch_file: "patches/0002-fix-cross-platform-issues.patch" - base_path: "source_subfolder" + patch_description: "fix platform problems" + patch_type: "portability" + - patch_file: "patches/0004-include-cstdint-1-0-0.patch" + patch_description: "include cstdint" + patch_type: "portability" + - patch_file: "patches/0005-include-mutex-1-0-0.patch" + patch_description: "include cstdint" + patch_type: "portability" "cci.20201104": - patch_file: "patches/0001-update-cmakelists-1-0-0-0.patch" - base_path: "source_subfolder" + patch_description: "use cci packages" + patch_type: "conan" - patch_file: "patches/0003-define-win32-winnt-cci-20201104.patch" - base_path: "source_subfolder" - "1.0.1.0": - - patch_file: "patches/0001-update-cmakelists-1-0-1-0.patch" - base_path: "source_subfolder" - - patch_file: "patches/0003-define-win32-winnt-1-0-1-0.patch" - base_path: "source_subfolder" - "1.0.2.0": - - patch_file: "patches/0001-update-cmakelists-1-0-1-0.patch" - 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" + patch_description: "define _WIN32_WINNT" + patch_type: "portability" + - patch_file: "patches/0004-include-cstdint-1-0-0.patch" + patch_description: "include cstdint" + patch_type: "portability" + - patch_file: "patches/0005-include-mutex-1-0-0.patch" + patch_description: "include cstdint" + patch_type: "portability" diff --git a/recipes/cppcommon/all/conanfile.py b/recipes/cppcommon/all/conanfile.py index aa3040d536ba0..68efbdbf960e4 100644 --- a/recipes/cppcommon/all/conanfile.py +++ b/recipes/cppcommon/all/conanfile.py @@ -1,33 +1,38 @@ -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 +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 CppCommon(ConanFile): name = "cppcommon" - license = "MIT" - url = "https://github.com/conan-io/conan-center-index" - homepage = "https://github.com/chronoxor/CppCommon" description = "C++ Common Library contains reusable components and patterns" \ " for error and exceptions handling, filesystem manipulations, math," \ " string format and encoding, shared memory, threading, time management" \ " and others." - topics = ("conan", "utils", "library") - settings = "os", "compiler", "build_type", "arch" - options = {"fPIC": [True, False], "shared": [True, False]} - default_options = {"fPIC": True, "shared": False} - exports_sources = ["patches/**", "CMakeLists.txt"] - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/chronoxor/CppCommon" + topics = ("utils", "filesystem", "uuid", "synchronization", "queue") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "fPIC": [True, False], + "shared": [True, False], + } + default_options = { + "fPIC": True, + "shared": False, + } @property - def _build_subfolder(self): - return "build_subfolder" + def _min_cppstd(self): + return 17 @property def _compilers_minimum_version(self): @@ -36,64 +41,74 @@ def _compilers_minimum_version(self): "clang": 6, "gcc": 7, "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.settings.compiler == "Visual Studio" and self.settings.arch == "x86": - raise ConanInvalidConfiguration("Visual Studio x86 builds are not supported.") - if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") - if self.settings.compiler.cppstd: - tools.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: - raise ConanInvalidConfiguration("cppcommon requires C++17, which your compiler does not support.") - else: - self.output.warn("cppcommon requires C++17. Your compiler is unknown. Assuming it supports C++17.") + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("fmt/8.0.0") + if Version(self.version) < "1.0.3" or self.version == "cci.20201104": + self.requires("fmt/8.1.1", transitive_headers=True) + else: + self.requires("fmt/10.2.0", transitive_headers=True) if self.settings.os == "Linux": - self.requires("libuuid/1.0.3") + self.requires("util-linux-libuuid/2.39.2", transitive_headers=True) + + 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." + ) + if is_msvc(self) and self.settings.arch == "x86": + raise ConanInvalidConfiguration("Visual Studio x86 builds are not supported.") + + def build_requirements(self): + self.tool_requires("cmake/[>=3.20 <4]") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = glob.glob("CppCommon-*")[0] - os.rename(extracted_dir, 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.definitions["CPPCOMMON_MODULE"] = "OFF" - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CPPCOMMON_MODULE"] = False + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + 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("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() - 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="*.h", dst=os.path.join("include", "plugins"), src=os.path.join(self._source_subfolder, "plugins")) + 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="*.h", dst=os.path.join(self.package_folder, "include", "plugins"), src=os.path.join(self.source_folder, "plugins")) def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) - self.cpp_info.includedirs.append(os.path.join("include", "plugins")) - if self.settings.os == "Linux": + self.cpp_info.libs = ["cppcommon", "plugin-function", "plugin-interface"] + self.cpp_info.includedirs.append(os.path.join(self.package_folder, "include", "plugins")) + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["pthread", "rt", "dl", "m"] if self.settings.os == "Windows": self.cpp_info.system_libs = ["userenv", "rpcrt4"] diff --git a/recipes/cppcommon/all/patches/0001-update-cmakelists-1-0-0-0.patch b/recipes/cppcommon/all/patches/0001-update-cmakelists-1-0-0-0.patch index 4429b5fee77ed..db56e91ef6951 100644 --- a/recipes/cppcommon/all/patches/0001-update-cmakelists-1-0-0-0.patch +++ b/recipes/cppcommon/all/patches/0001-update-cmakelists-1-0-0-0.patch @@ -1,8 +1,8 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index dcd57785b..2dde9577f 100644 +index dcd5778..160fc09 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -18,13 +18,13 @@ if(DOXYGEN_FOUND) +@@ -18,30 +18,30 @@ if(DOXYGEN_FOUND) endif() # CMake module path @@ -20,8 +20,9 @@ index dcd57785b..2dde9577f 100644 +# include(SystemInformation) # External packages ++find_package(fmt REQUIRED) find_package(Threads REQUIRED) -@@ -32,16 +32,15 @@ if(UNIX AND NOT APPLE AND NOT MSYS) + if(UNIX AND NOT APPLE AND NOT MSYS) find_package(LibBFD) find_package(LibDL) find_package(LibRT) @@ -40,12 +41,12 @@ index dcd57785b..2dde9577f 100644 # Link libraries list(APPEND LINKLIBS Threads::Threads) -@@ -49,17 +48,18 @@ if(UNIX AND NOT APPLE AND NOT MSYS) +@@ -49,17 +49,18 @@ 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) ++ list(APPEND LINKLIBS libuuid::libuuid) endif() if(WIN32 OR MSYS) list(APPEND LINKLIBS ${DBGHELP_LIBRARIES}) @@ -62,7 +63,7 @@ index dcd57785b..2dde9577f 100644 include_directories(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/plugins") # Library -@@ -68,8 +68,9 @@ file(GLOB_RECURSE LIB_INLINE_FILES "include/*.inl") +@@ -68,8 +69,9 @@ file(GLOB_RECURSE LIB_INLINE_FILES "include/*.inl") file(GLOB_RECURSE LIB_SOURCE_FILES "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") @@ -70,11 +71,11 @@ index dcd57785b..2dde9577f 100644 -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) ++target_link_libraries(cppcommon PUBLIC ${LINKLIBS} fmt::fmt) list(APPEND INSTALL_TARGETS cppcommon) list(APPEND LINKLIBS cppcommon) -@@ -91,7 +92,7 @@ if(NOT CPPCOMMON_MODULE) +@@ -91,7 +93,7 @@ if(NOT CPPCOMMON_MODULE) list(APPEND INSTALL_TARGETS_PDB ${PLUGIN_TARGET}) endforeach() @@ -83,7 +84,7 @@ index dcd57785b..2dde9577f 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") -@@ -105,8 +106,8 @@ if(NOT CPPCOMMON_MODULE) +@@ -105,8 +107,8 @@ if(NOT CPPCOMMON_MODULE) list(APPEND INSTALL_TARGETS ${EXAMPLE_TARGET}) list(APPEND INSTALL_TARGETS_PDB ${EXAMPLE_TARGET}) endforeach() @@ -94,7 +95,7 @@ index dcd57785b..2dde9577f 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") -@@ -120,8 +121,8 @@ if(NOT CPPCOMMON_MODULE) +@@ -120,8 +122,8 @@ if(NOT CPPCOMMON_MODULE) list(APPEND INSTALL_TARGETS ${BENCHMARK_TARGET}) list(APPEND INSTALL_TARGETS_PDB ${BENCHMARK_TARGET}) endforeach() @@ -105,7 +106,7 @@ index dcd57785b..2dde9577f 100644 file(GLOB TESTS_HEADER_FILES "tests/*.h") file(GLOB TESTS_INLINE_FILES "tests/*.inl") file(GLOB TESTS_SOURCE_FILES "tests/*.cpp") -@@ -136,15 +137,15 @@ if(NOT CPPCOMMON_MODULE) +@@ -136,15 +138,15 @@ if(NOT CPPCOMMON_MODULE) # CTest enable_testing() add_test(cppcommon-tests cppcommon-tests --durations yes --order lex) diff --git a/recipes/cppcommon/all/patches/0001-update-cmakelists-1-0-1-0.patch b/recipes/cppcommon/all/patches/0001-update-cmakelists-1-0-1-0.patch index c7b2d0bf5679b..650b9b1d05898 100644 --- a/recipes/cppcommon/all/patches/0001-update-cmakelists-1-0-1-0.patch +++ b/recipes/cppcommon/all/patches/0001-update-cmakelists-1-0-1-0.patch @@ -1,17 +1,14 @@ -From 85122652b618951f1b8fe91d8804d92a74d971be Mon Sep 17 00:00:00 2001 -From: Alejandro Colomar -Date: Mon, 7 Jun 2021 10:27:46 +0200 -Subject: [PATCH] update cmakelists - ---- - CMakeLists.txt | 42 +++++++++++++++++++----------------------- - 1 file changed, 19 insertions(+), 23 deletions(-) - diff --git a/CMakeLists.txt b/CMakeLists.txt -index aa5447a8..10a0065b 100644 +index aa5447a..19b3564 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -17,49 +17,36 @@ if(DOXYGEN_FOUND) +@@ -1,4 +1,4 @@ +-cmake_minimum_required(VERSION 3.6) ++cmake_minimum_required(VERSION 3.8) + + # Global properties + set_property(GLOBAL PROPERTY USE_FOLDERS ON) +@@ -17,49 +17,37 @@ if(DOXYGEN_FOUND) endif() endif() @@ -26,6 +23,7 @@ index aa5447a8..10a0065b 100644 - # External packages find_package(Threads REQUIRED) ++find_package(fmt REQUIRED) if(UNIX AND NOT APPLE AND NOT MSYS) find_package(LibBFD) find_package(LibDL) @@ -49,7 +47,7 @@ index aa5447a8..10a0065b 100644 list(APPEND LINKLIBS ${LIBDL_LIBRARIES}) list(APPEND LINKLIBS ${LIBRT_LIBRARIES}) - list(APPEND LINKLIBS ${LIBUUID_LIBRARIES}) -+ list(APPEND LINKLIBS CONAN_PKG::libuuid) ++ list(APPEND LINKLIBS libuuid::libuuid) endif() if(WIN32 OR MSYS) list(APPEND LINKLIBS ${DBGHELP_LIBRARIES}) @@ -65,7 +63,7 @@ index aa5447a8..10a0065b 100644 include_directories(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/plugins") # Library -@@ -68,8 +55,9 @@ file(GLOB_RECURSE LIB_INLINE_FILES "include/*.inl" "source/*.inl") +@@ -68,8 +56,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") @@ -73,11 +71,11 @@ index aa5447a8..10a0065b 100644 -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) ++target_link_libraries(cppcommon PUBLIC ${LINKLIBS} fmt::fmt) list(APPEND INSTALL_TARGETS cppcommon) list(APPEND LINKLIBS cppcommon) -@@ -92,6 +80,7 @@ if(NOT CPPCOMMON_MODULE) +@@ -92,6 +81,7 @@ if(NOT CPPCOMMON_MODULE) endforeach() # Examples @@ -85,7 +83,7 @@ index aa5447a8..10a0065b 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") -@@ -105,8 +94,10 @@ if(NOT CPPCOMMON_MODULE) +@@ -105,8 +95,10 @@ if(NOT CPPCOMMON_MODULE) list(APPEND INSTALL_TARGETS ${EXAMPLE_TARGET}) list(APPEND INSTALL_TARGETS_PDB ${EXAMPLE_TARGET}) endforeach() @@ -96,7 +94,7 @@ index aa5447a8..10a0065b 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") -@@ -120,8 +111,10 @@ if(NOT CPPCOMMON_MODULE) +@@ -120,8 +112,10 @@ if(NOT CPPCOMMON_MODULE) list(APPEND INSTALL_TARGETS ${BENCHMARK_TARGET}) list(APPEND INSTALL_TARGETS_PDB ${BENCHMARK_TARGET}) endforeach() @@ -107,7 +105,7 @@ index aa5447a8..10a0065b 100644 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) +@@ -132,19 +126,22 @@ if(NOT CPPCOMMON_MODULE) target_link_libraries(cppcommon-tests ${LINKLIBS}) list(APPEND INSTALL_TARGETS cppcommon-tests) list(APPEND INSTALL_TARGETS_PDB cppcommon-tests) @@ -134,6 +132,3 @@ index aa5447a8..10a0065b 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/cppcommon/all/patches/0001-update-cmakelists-1-0-3-0.patch b/recipes/cppcommon/all/patches/0001-update-cmakelists-1-0-3-0.patch index 83cb81ebe9a49..6a01d828cbe86 100644 --- 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 @@ -1,14 +1,8 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index aa5447a8..10a0065b 100644 +index 7ce5f63..be39a51 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) +@@ -17,49 +17,37 @@ if(DOXYGEN_FOUND) endif() endif() @@ -23,6 +17,7 @@ index aa5447a8..10a0065b 100644 - # External packages find_package(Threads REQUIRED) ++find_package(fmt REQUIRED) if(UNIX AND NOT APPLE AND NOT MSYS) find_package(LibBFD) find_package(LibDL) @@ -46,7 +41,7 @@ index aa5447a8..10a0065b 100644 list(APPEND LINKLIBS ${LIBDL_LIBRARIES}) list(APPEND LINKLIBS ${LIBRT_LIBRARIES}) - list(APPEND LINKLIBS ${LIBUUID_LIBRARIES}) -+ list(APPEND LINKLIBS CONAN_PKG::libuuid) ++ list(APPEND LINKLIBS libuuid::libuuid) endif() if(WIN32 OR MSYS) list(APPEND LINKLIBS ${DBGHELP_LIBRARIES}) @@ -62,7 +57,7 @@ index aa5447a8..10a0065b 100644 include_directories(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/plugins") # Library -@@ -68,8 +55,9 @@ file(GLOB_RECURSE LIB_INLINE_FILES "include/*.inl" "source/*.inl") +@@ -68,8 +56,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") @@ -70,11 +65,11 @@ index aa5447a8..10a0065b 100644 -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) ++target_link_libraries(cppcommon PUBLIC ${LINKLIBS} fmt::fmt) list(APPEND INSTALL_TARGETS cppcommon) list(APPEND LINKLIBS cppcommon) -@@ -92,6 +80,7 @@ if(NOT CPPCOMMON_MODULE) +@@ -92,6 +81,7 @@ if(NOT CPPCOMMON_MODULE) endforeach() # Examples @@ -82,7 +77,7 @@ index aa5447a8..10a0065b 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") -@@ -105,8 +94,10 @@ if(NOT CPPCOMMON_MODULE) +@@ -105,8 +95,10 @@ if(NOT CPPCOMMON_MODULE) list(APPEND INSTALL_TARGETS ${EXAMPLE_TARGET}) list(APPEND INSTALL_TARGETS_PDB ${EXAMPLE_TARGET}) endforeach() @@ -93,7 +88,7 @@ index aa5447a8..10a0065b 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") -@@ -120,8 +111,10 @@ if(NOT CPPCOMMON_MODULE) +@@ -120,8 +112,10 @@ if(NOT CPPCOMMON_MODULE) list(APPEND INSTALL_TARGETS ${BENCHMARK_TARGET}) list(APPEND INSTALL_TARGETS_PDB ${BENCHMARK_TARGET}) endforeach() @@ -104,7 +99,7 @@ index aa5447a8..10a0065b 100644 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) +@@ -132,19 +126,22 @@ if(NOT CPPCOMMON_MODULE) target_link_libraries(cppcommon-tests ${LINKLIBS}) list(APPEND INSTALL_TARGETS cppcommon-tests) list(APPEND INSTALL_TARGETS_PDB cppcommon-tests) diff --git a/recipes/cppcommon/all/patches/0001-update-cmakelists-1-0-4-0.patch b/recipes/cppcommon/all/patches/0001-update-cmakelists-1-0-4-0.patch new file mode 100644 index 0000000000000..0d4c06013abe8 --- /dev/null +++ b/recipes/cppcommon/all/patches/0001-update-cmakelists-1-0-4-0.patch @@ -0,0 +1,108 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index daa796b..c76bfef 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -18,30 +18,31 @@ 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) ++find_package(fmt 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) ++# find_package(Userenv) + endif() + + # Modules +-add_subdirectory("modules") ++#add_subdirectory("modules") + + # Link libraries + list(APPEND LINKLIBS Threads::Threads) +@@ -49,17 +50,18 @@ 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 libuuid::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}/modules") + include_directories(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/plugins") + + # Library +@@ -68,8 +70,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} fmt::fmt) + list(APPEND INSTALL_TARGETS cppcommon) + list(APPEND LINKLIBS cppcommon) + +@@ -91,6 +94,7 @@ if(NOT CPPCOMMON_MODULE) + list(APPEND INSTALL_TARGETS_PDB ${PLUGIN_TARGET}) + endforeach() + ++ if (0) + # Examples + file(GLOB EXAMPLE_HEADER_FILES "examples/*.h") + file(GLOB EXAMPLE_INLINE_FILES "examples/*.inl") +@@ -136,15 +140,16 @@ if(NOT CPPCOMMON_MODULE) + # CTest + 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/all/patches/0003-define-win32-winnt-1-0-1-0.patch b/recipes/cppcommon/all/patches/0003-define-win32-winnt-1-0-1-0.patch index 3b9099c8f0c45..b85cb3d5f9ed0 100644 --- a/recipes/cppcommon/all/patches/0003-define-win32-winnt-1-0-1-0.patch +++ b/recipes/cppcommon/all/patches/0003-define-win32-winnt-1-0-1-0.patch @@ -17,7 +17,7 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt index 10a0065b..2ed1668c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -61,6 +61,10 @@ target_link_libraries(cppcommon PUBLIC ${LINKLIBS} CONAN_PKG::fmt) +@@ -62,6 +62,10 @@ target_link_libraries(cppcommon PUBLIC ${LINKLIBS} CONAN_PKG::fmt) list(APPEND INSTALL_TARGETS cppcommon) list(APPEND LINKLIBS cppcommon) diff --git a/recipes/cppcommon/all/patches/0003-define-win32-winnt-1-0-4-0.patch b/recipes/cppcommon/all/patches/0003-define-win32-winnt-1-0-4-0.patch new file mode 100644 index 0000000000000..076bc12bf2beb --- /dev/null +++ b/recipes/cppcommon/all/patches/0003-define-win32-winnt-1-0-4-0.patch @@ -0,0 +1,14 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index c76bfef..f57f05b 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -75,6 +75,9 @@ target_compile_features(cppcommon PUBLIC cxx_std_17) + target_link_libraries(cppcommon PUBLIC ${LINKLIBS} fmt::fmt) + list(APPEND INSTALL_TARGETS cppcommon) + list(APPEND LINKLIBS cppcommon) ++if(WIN32 AND NOT MSVC) ++ target_compile_definitions(cppcommon PUBLIC -D_WIN32_WINNT=_WIN32_WINNT_VISTA) ++endif() + + # Additional module components: benchmarks, examples, plugins, tests, tools and install + if(NOT CPPCOMMON_MODULE) diff --git a/recipes/cppcommon/all/patches/0003-define-win32-winnt-cci-20201104.patch b/recipes/cppcommon/all/patches/0003-define-win32-winnt-cci-20201104.patch index 83c8b1f1eb2c9..61af4f0ef8364 100644 --- a/recipes/cppcommon/all/patches/0003-define-win32-winnt-cci-20201104.patch +++ b/recipes/cppcommon/all/patches/0003-define-win32-winnt-cci-20201104.patch @@ -4,11 +4,13 @@ https://github.com/chronoxor/CppCMakeScripts/blob/1.0.0.0/SetPlatformFeatures.cm 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 ad3d53aa8..d4dcbf8b5 100644 +index 160fc09..5eeddd8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -74,6 +74,10 @@ target_link_libraries(cppcommon PUBLIC ${LINKLIBS} CONAN_PKG::fmt) +@@ -75,6 +75,10 @@ target_link_libraries(cppcommon PUBLIC ${LINKLIBS} fmt::fmt) list(APPEND INSTALL_TARGETS cppcommon) list(APPEND LINKLIBS cppcommon) @@ -18,4 +20,4 @@ index ad3d53aa8..d4dcbf8b5 100644 + # Additional module components: benchmarks, examples, plugins, tests, tools and install if(NOT CPPCOMMON_MODULE) - + diff --git a/recipes/cppcommon/all/patches/0004-include-cstdint-1-0-0.patch b/recipes/cppcommon/all/patches/0004-include-cstdint-1-0-0.patch new file mode 100644 index 0000000000000..ac9007806f716 --- /dev/null +++ b/recipes/cppcommon/all/patches/0004-include-cstdint-1-0-0.patch @@ -0,0 +1,49 @@ +diff --git a/include/common/reader.h b/include/common/reader.h +index b3bba38..39f1f87 100644 +--- a/include/common/reader.h ++++ b/include/common/reader.h +@@ -11,6 +11,7 @@ + + #include + #include ++#include + + namespace CppCommon { + +diff --git a/include/string/string_utils.inl b/include/string/string_utils.inl +index 1315e63..1a225c8 100644 +--- a/include/string/string_utils.inl ++++ b/include/string/string_utils.inl +@@ -6,6 +6,8 @@ + \copyright MIT License + */ + ++#include ++ + namespace CppCommon { + + inline bool StringUtils::IsBlank(char ch) +diff --git a/include/system/uuid.h b/include/system/uuid.h +index bc3c2ea..cf768ea 100644 +--- a/include/system/uuid.h ++++ b/include/system/uuid.h +@@ -13,6 +13,7 @@ + + #include + #include ++#include + + namespace CppCommon { + +diff --git a/source/string/encoding.cpp b/source/string/encoding.cpp +index 5a0e633..65dc7e6 100644 +--- a/source/string/encoding.cpp ++++ b/source/string/encoding.cpp +@@ -13,6 +13,7 @@ + #include + #include + #include ++#include + + namespace CppCommon { + diff --git a/recipes/cppcommon/all/patches/0005-include-mutex-1-0-0.patch b/recipes/cppcommon/all/patches/0005-include-mutex-1-0-0.patch new file mode 100644 index 0000000000000..bca5eaf100bb2 --- /dev/null +++ b/recipes/cppcommon/all/patches/0005-include-mutex-1-0-0.patch @@ -0,0 +1,12 @@ +diff --git a/source/cache/filecache.cpp b/source/cache/filecache.cpp +index 0c22f50..2bfb3a1 100644 +--- a/source/cache/filecache.cpp ++++ b/source/cache/filecache.cpp +@@ -7,6 +7,7 @@ + */ + + #include "cache/filecache.h" ++#include + + namespace CppCommon { + diff --git a/recipes/cppcommon/all/test_package/CMakeLists.txt b/recipes/cppcommon/all/test_package/CMakeLists.txt index ba1e21ea8636c..0c4ae375149ae 100644 --- a/recipes/cppcommon/all/test_package/CMakeLists.txt +++ b/recipes/cppcommon/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(cppcommon REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -conan_target_link_libraries(${PROJECT_NAME}) - +target_link_libraries(${PROJECT_NAME} PRIVATE cppcommon::cppcommon) target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_17) diff --git a/recipes/cppcommon/all/test_package/conanfile.py b/recipes/cppcommon/all/test_package/conanfile.py index 4903f1a7e8fa0..ef5d7042163ec 100644 --- a/recipes/cppcommon/all/test_package/conanfile.py +++ b/recipes/cppcommon/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cppcommon/config.yml b/recipes/cppcommon/config.yml index 17d2cd502269e..dfd13b4693a86 100644 --- a/recipes/cppcommon/config.yml +++ b/recipes/cppcommon/config.yml @@ -1,11 +1,13 @@ versions: - "1.0.0.0": + "1.0.4.0": folder: all - "cci.20201104": + "1.0.3.0": + folder: all + "1.0.2.0": folder: all "1.0.1.0": folder: all - "1.0.2.0": + "1.0.0.0": folder: all - "1.0.3.0": + "cci.20201104": folder: all diff --git a/recipes/cppdap/all/conandata.yml b/recipes/cppdap/all/conandata.yml new file mode 100644 index 0000000000000..81a6d395b6748 --- /dev/null +++ b/recipes/cppdap/all/conandata.yml @@ -0,0 +1,10 @@ +sources: + "cci.20230526": + url: "https://github.com/google/cppdap/archive/03cc18678ed2ed8b2424ec99dee7e4655d876db5.tar.gz" + sha256: "b1de5020fdb3ab429973545f3f869cab909c0f81151242e694f6f7c1f9b32d2d" +patches: + "cci.20230526": + - patch_file: "patches/0001-build-cmake-use-min-CMake-version-prior-to-project-c.patch" + patch_description: "correct the order of cmake min and project" + patch_type: "conan" + patch_source: "https://github.com/google/cppdap/pull/112" diff --git a/recipes/cppdap/all/conanfile.py b/recipes/cppdap/all/conanfile.py new file mode 100644 index 0000000000000..01e7b35399573 --- /dev/null +++ b/recipes/cppdap/all/conanfile.py @@ -0,0 +1,99 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +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.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +import os + + +required_conan_version = ">=1.53.0" + + +class PackageConan(ConanFile): + name = "cppdap" + description = "Debug Adapter Protocol SDK" + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/google/cppdap" + topics = ("debug", "adapter", "protocol", "dap") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_json": ["jsoncpp", "nlohmann_json", "rapidjson"], + } + default_options = { + "shared": False, + "fPIC": True, + "with_json": "nlohmann_json", + } + + @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_json == "jsoncpp": + self.requires("jsoncpp/1.9.5") + elif self.options.with_json == "rapidjson": + self.requires("rapidjson/cci.20220822") + elif self.options.with_json == "nlohmann_json": + self.requires("nlohmann_json/3.11.2") + + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + if 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 generate(self): + tc = CMakeToolchain(self) + tc.variables["CPPDAP_USE_EXTERNAL_JSONCPP_PACKAGE"] = self.options.with_json == "jsoncpp" + tc.variables["CPPDAP_USE_EXTERNAL_RAPIDJSON_PACKAGE"] = self.options.with_json == "rapidjson" + tc.variables["CPPDAP_USE_EXTERNAL_NLOHMANN_JSON_PACKAGE"] = self.options.with_json == "nlohmann_json" + tc.generate() + tc = CMakeDeps(self) + 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")) + rm(self, "*.pdb", os.path.join(self.package_folder, "lib")) + + def package_info(self): + self.cpp_info.libs = ["cppdap"] + + self.cpp_info.set_property("cmake_file_name", "cppdap") + self.cpp_info.set_property("cmake_target_name", "cppdap::cppdap") + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("pthread") + if self.settings.os in ["Windows"]: + self.cpp_info.system_libs.append("ws2_32") diff --git a/recipes/cppdap/all/patches/0001-build-cmake-use-min-CMake-version-prior-to-project-c.patch b/recipes/cppdap/all/patches/0001-build-cmake-use-min-CMake-version-prior-to-project-c.patch new file mode 100644 index 0000000000000..4afee12c43400 --- /dev/null +++ b/recipes/cppdap/all/patches/0001-build-cmake-use-min-CMake-version-prior-to-project-c.patch @@ -0,0 +1,33 @@ +From ab76a207761b02e169f3ace39e3beb126b39fe9e Mon Sep 17 00:00:00 2001 +From: Gregor Jasny +Date: Mon, 5 Jun 2023 08:01:43 +0200 +Subject: [PATCH] build(cmake): use min CMake version prior to project call + +The [CMake documentation](https://cmake.org/cmake/help/latest/command/cmake_minimum_required.html) +mandates that `cmake_minimum_required` should be called early +in the `CMakeLists.txt` prior to any `project()` command. +--- + CMakeLists.txt | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f111f1a..717f02e 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -12,11 +12,10 @@ + # See the License for the specific language governing permissions and + # limitations under the License. + +-cmake_policy(SET CMP0048 NEW) +-project(cppdap VERSION 1.59.0 LANGUAGES CXX C) +- + cmake_minimum_required(VERSION 3.13) + ++project(cppdap VERSION 1.59.0 LANGUAGES CXX C) ++ + set (CMAKE_CXX_STANDARD 11) + + include(GNUInstallDirs) +-- +2.40.1 + diff --git a/recipes/cppdap/all/test_package/CMakeLists.txt b/recipes/cppdap/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..4175e2067e663 --- /dev/null +++ b/recipes/cppdap/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) + +project(test_package CXX) + +find_package(cppdap REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE cppdap::cppdap) diff --git a/recipes/cppdap/all/test_package/conanfile.py b/recipes/cppdap/all/test_package/conanfile.py new file mode 100644 index 0000000000000..ef5d7042163ec --- /dev/null +++ b/recipes/cppdap/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cppdap/all/test_package/test_package.cpp b/recipes/cppdap/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..8b914589b185d --- /dev/null +++ b/recipes/cppdap/all/test_package/test_package.cpp @@ -0,0 +1,10 @@ +#include +#include "dap/dap.h" + +int main() { + + dap::initialize(); + dap::terminate(); + + return EXIT_SUCCESS; +} diff --git a/recipes/cppdap/config.yml b/recipes/cppdap/config.yml new file mode 100644 index 0000000000000..4dde24d181aa0 --- /dev/null +++ b/recipes/cppdap/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20230526": + folder: all diff --git a/recipes/cppfront/all/CMakeLists.txt b/recipes/cppfront/all/CMakeLists.txt index 3a5c515464abd..91f9698142088 100644 --- a/recipes/cppfront/all/CMakeLists.txt +++ b/recipes/cppfront/all/CMakeLists.txt @@ -1,8 +1,9 @@ -cmake_minimum_required(VERSION 3.8) -project(cppfront CXX) +cmake_minimum_required(VERSION 3.12) +project(cppfront LANGUAGES CXX) -add_executable(${PROJECT_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/source/cppfront.cpp) +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 index 9256a02f34f3a..41ca7a255f0d2 100644 --- a/recipes/cppfront/all/conandata.yml +++ b/recipes/cppfront/all/conandata.yml @@ -1,7 +1,4 @@ sources: - "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" + "0.8.0": + url: "https://github.com/hsutter/cppfront/archive/refs/tags/v0.8.0.tar.gz" + sha256: "7fb573599960bc0a46a71ed103ff97adbf938d4a0df754dc952a44fdcacfc571" diff --git a/recipes/cppfront/all/conanfile.py b/recipes/cppfront/all/conanfile.py index 92fa383ff535f..63d0fe03c6f48 100644 --- a/recipes/cppfront/all/conanfile.py +++ b/recipes/cppfront/all/conanfile.py @@ -1,100 +1,86 @@ from conan import ConanFile - from conan.errors import ConanInvalidConfiguration -from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout from conan.tools.files import copy, get -from conan.tools.microsoft import check_min_vs, is_msvc - import os -required_conan_version = ">=1.47.0" +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") + license = "CC-BY-NC-ND-4.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/hsutter/cppfront" - license = "CC-BY-NC-ND-4.0" + topics = ("cpp2", "compiler") + package_type = "application" settings = "os", "arch", "compiler", "build_type" @property - def _minimum_cpp_standard(self): - return 20 + def _min_cppstd(self): + return "20" @property def _compilers_minimum_version(self): - return {"gcc": "11", - "Visual Studio": "16.9", - "clang": "12", - "apple-clang": "13", - } - - def layout(self): - cmake_layout(self, src_folder="src") + return { + "gcc": "11", + # cppfront requires constexpr source_location + "Visual Studio": "17", + "msvc": "193", + "clang": "12", + # cppfront requires which is available on apple-clang 14.3 or later.. + "apple-clang": "14.3", + } def export_sources(self): - copy(self, "CMakeLists.txt", self.recipe_folder, os.path.join(self.export_sources_folder, "src")) + copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder) - def source(self): - 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 validate(self): - if self.info.settings.compiler.cppstd: - check_min_cppstd(self, self._minimum_cpp_standard) + if self.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] - check_min_vs(self, "192.9") - if not is_msvc(self): - minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) - if not minimum_version: - self.output.warn(f"{self.name} {self.version} requires C++20. Your compiler is unknown. Assuming it supports C++20.") - elif _lazy_lt_semver(str(self.settings.compiler.version), minimum_version): - raise ConanInvalidConfiguration(f"{self.name} {self.version} requires C++20, which your compiler does not support.") - if self.info.settings.compiler == "clang" and str(self.info.settings.compiler.version) in ("13", "14"): - raise ConanInvalidConfiguration(f"{self.ref} currently does not work with Clang {self.info.settings.compiler.version} on CCI, it enters in an infinite build loop (smells like a compiler bug). Contributions are welcomed!") + 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() + 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")) - copy(self, "cppfront*", src=self.source_folder, dst=os.path.join(self.package_folder, "bin")) - copy(self, pattern="*.h", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) - cmake = CMake(self) cmake.install() - @staticmethod - def _chmod_plus_x(filename): - if os.name == "posix": - os.chmod(filename, os.stat(filename).st_mode | 0o111) - 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) - - bin_ext = ".exe" if self.settings.os == "Windows" else "" - cppfront_bin = os.path.join(self.package_folder, "bin", "cppfront{}".format(bin_ext)).replace("\\", "/") - - self.output.info("Setting CppFront environment variable: {}".format(cppfront_bin)) - self.env_info.cppfront = cppfront_bin - - self.cpp_info.frameworkdirs = [] - self.cpp_info.includedirs = [os.path.join(self.package_folder, "include")] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] + # 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 index 1999bacfd39a7..c71fdc5de19bd 100644 --- a/recipes/cppfront/all/test_package/conanfile.py +++ b/recipes/cppfront/all/test_package/conanfile.py @@ -1,27 +1,23 @@ from conan import ConanFile from conan.tools.files import copy -from conan.tools.build import can_run from conan.tools.layout import basic_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "VirtualBuildEnv" - test_type = "explicit" + generators = "VirtualRunEnv" def layout(self): basic_layout(self) - def build_requirements(self): - self.tool_requires(self.tested_reference_str) + def requirements(self): + self.requires(self.tested_reference_str) def build(self): - if can_run(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")), env="conanbuild") + 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")), env="conanrun") def test(self): - if can_run(self): - self.run("cppfront -h", env="conanbuild") - assert os.path.isfile(os.path.join(self.build_folder, "pure2-hello.cpp")) + self.run("cppfront -h", env="conanrun") + assert os.path.isfile(os.path.join(self.build_folder, "pure2-hello.cpp")) diff --git a/recipes/cppfront/all/test_v1_package/conanfile.py b/recipes/cppfront/all/test_v1_package/conanfile.py index 962a3b9a9704c..13f05370739e6 100644 --- a/recipes/cppfront/all/test_v1_package/conanfile.py +++ b/recipes/cppfront/all/test_v1_package/conanfile.py @@ -1,20 +1,20 @@ -from conans import ConanFile, tools +from conans import ConanFile import os import shutil + class TestPackageV1Conan(ConanFile): settings = "os", "arch", "compiler", "build_type" + test_type = "explicit" - @property - def _cppfront_input_path(self): - return os.path.join(self.build_folder, "pure2-hello.cpp2") + def build_requirements(self): + self.build_requires(self.tested_reference_str) def build(self): - if not tools.cross_building(self): - shutil.copy2(src=os.path.join(self.source_folder, "..", "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")), run_environment=True) + 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): - if not tools.cross_building(self): - self.run("cppfront -h", run_environment=True) - assert os.path.isfile(os.path.join(self.build_folder, "pure2-hello.cpp")) + 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 index 58e5c15a9b457..675f954f2770e 100644 --- a/recipes/cppfront/config.yml +++ b/recipes/cppfront/config.yml @@ -1,5 +1,3 @@ versions: - "cci.20221024": - folder: all - "cci.20220924": + "0.8.0": folder: all diff --git a/recipes/cppitertools/all/conandata.yml b/recipes/cppitertools/all/conandata.yml index b8a68ed038695..0337148504871 100644 --- a/recipes/cppitertools/all/conandata.yml +++ b/recipes/cppitertools/all/conandata.yml @@ -1,4 +1,4 @@ sources: "2.1": - url: https://github.com/ryanhaining/cppitertools/archive/v2.1.tar.gz - sha256: f7bcd4531e37083609bb92c3f0ae03b56e7197002d0dc9c695104dcef445f2ab + url: "https://github.com/ryanhaining/cppitertools/archive/v2.1.tar.gz" + sha256: "f7bcd4531e37083609bb92c3f0ae03b56e7197002d0dc9c695104dcef445f2ab" diff --git a/recipes/cppitertools/all/conanfile.py b/recipes/cppitertools/all/conanfile.py index 585bcc850ce23..d59270a8f393a 100644 --- a/recipes/cppitertools/all/conanfile.py +++ b/recipes/cppitertools/all/conanfile.py @@ -1,65 +1,75 @@ import os -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration +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.32.0" +required_conan_version = ">=1.53.0" class CppItertoolsConan(ConanFile): name = "cppitertools" - url = "https://github.com/conan-io/conan-center-index" - homepage = "https://github.com/ryanhaining/cppitertools" description = "Implementation of python itertools and builtin iteration functions for C++17" - topics = ("cpp17", "iter", "itertools") license = "BSD-2-Clause" - no_copy_source = True - + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/ryanhaining/cppitertools" + topics = ("cpp17", "iter", "itertools", "header-only") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" - options = {'zip_longest': [True, False]} - default_options = {'zip_longest': False} + options = { + 'zip_longest': [True, False], + } + default_options = { + 'zip_longest': False, + } + no_copy_source = True @property - def _source_subfolder(self): - return "source_subfolder" - - 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 validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 17) + def _min_cppstd(self): + return 17 - minimal_version = { + @property + def _compilers_minimum_version(self): + return { "Visual Studio": "15", + "msvc": "191", "gcc": "7", "clang": "5.0", "apple-clang": "9.1" } - compiler = str(self.settings.compiler) - compiler_version = tools.Version(self.settings.compiler.version) - - if compiler not in minimal_version: - self.output.info("{} requires a compiler that supports at least C++17".format(self.name)) - return - # Exclude compilers not supported by cppitertools - if compiler_version < minimal_version[compiler]: - raise ConanInvalidConfiguration("{} requires a compiler that supports at least C++17. {} {} is not".format( - self.name, compiler, tools.Version(self.settings.compiler.version.value))) + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): if self.options.zip_longest: - self.requires('boost/1.75.0') + self.requires('boost/1.83.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) + 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("*.hpp", dst=os.path.join("include", "cppitertools"), src=self._source_subfolder, excludes=('examples/**', 'test/**')) - self.copy("LICENSE.md", dst="licenses", src=self._source_subfolder) + copy(self, "LICENSE.md", 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", "cppitertools"), excludes=('examples/**', 'test/**')) def package_info(self): - self.cpp_info.names["cmake_find_package"] = "cppitertools" - self.cpp_info.names["cmake_find_package_multi"] = "cppitertools" + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + self.cpp_info.set_property("cmake_file_name", "cppitertools") + self.cpp_info.set_property("cmake_target_name", "cppitertools::cppitertools") - def package_id(self): - self.info.header_only() diff --git a/recipes/cppitertools/all/test_package/CMakeLists.txt b/recipes/cppitertools/all/test_package/CMakeLists.txt index 76d1d8411383a..18b263b57ca6f 100644 --- a/recipes/cppitertools/all/test_package/CMakeLists.txt +++ b/recipes/cppitertools/all/test_package/CMakeLists.txt @@ -1,17 +1,14 @@ -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.15) +project(test_package LANGUAGES CXX) find_package(cppitertools REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} cppitertools::cppitertools) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17) +target_link_libraries(${PROJECT_NAME} PRIVATE cppitertools::cppitertools) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) if(ZIP_LONGEST) add_executable(test_zip_longest test_zip_longest.cpp) - target_link_libraries(test_zip_longest cppitertools::cppitertools) - set_property(TARGET test_zip_longest PROPERTY CXX_STANDARD 17) + target_link_libraries(test_zip_longest PRIVATE cppitertools::cppitertools) + target_compile_features(test_zip_longest PRIVATE cxx_std_17) endif() diff --git a/recipes/cppitertools/all/test_package/conanfile.py b/recipes/cppitertools/all/test_package/conanfile.py index 92e1d0d57881c..fac50abb3d577 100644 --- a/recipes/cppitertools/all/test_package/conanfile.py +++ b/recipes/cppitertools/all/test_package/conanfile.py @@ -1,23 +1,38 @@ import os -from conans import ConanFile, CMake, tools + +from conan import ConanFile +from conan.tools.cmake import CMake, cmake_layout, CMakeToolchain, CMakeDeps +from conan.tools.build import can_run class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + test_type = "explicit" + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["ZIP_LONGEST"] = self.dependencies["cppitertools"].options.zip_longest + tc.generate() + deps = CMakeDeps(self) + deps.generate() + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) - if self.options["cppitertools"].zip_longest: - cmake.definitions["ZIP_LONGEST"] = True 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) + def layout(self): + cmake_layout(self) - if self.options["cppitertools"].zip_longest: - bin_path = os.path.join("bin", "test_zip_longest") - self.run(bin_path, run_environment=True) + def test(self): + if can_run(self): + cmd = os.path.join(self.cpp.build.bindir, "test_package") + self.run(cmd, env="conanrun") + # sense if it was built because we don't have access to: + # self.dependencies["cppitertools"].options.zip_longest + cmd = os.path.join(self.cpp.build.bindir, "test_zip_longest") + if os.path.exists(cmd): + self.run(cmd, env="conanrun") diff --git a/recipes/cppkafka/all/conandata.yml b/recipes/cppkafka/all/conandata.yml index 741ef5502bb96..19152c1beae0c 100644 --- a/recipes/cppkafka/all/conandata.yml +++ b/recipes/cppkafka/all/conandata.yml @@ -1,9 +1,15 @@ sources: + "0.4.1": + url: "https://github.com/mfontanini/cppkafka/archive/refs/tags/v0.4.1.tar.gz" + sha256: "45770ae0404cb9ba73d659618c51cd55b574c66ed3c7b148360222fb524b0ff7" "0.4.0": url: "https://github.com/mfontanini/cppkafka/archive/refs/tags/0.4.0.tar.gz" sha256: "f4f05eb7a180a856663b02ec0b777283275ef88e5523f3013fd51c6c4ab63b5a" patches: + "0.4.1": + - patch_file: "patches/0.4.0-0001-no-template-export.patch" + - patch_file: "patches/0.4.1-0003-clean-rpath.patch" "0.4.0": - - patch_file: "patches/0001-no-template-export.patch" - - patch_file: "patches/0002-cppstd.patch" - - patch_file: "patches/0003-clean-rpath.patch" + - patch_file: "patches/0.4.0-0001-no-template-export.patch" + - patch_file: "patches/0.4.0-0002-cppstd.patch" + - patch_file: "patches/0.4.0-0003-clean-rpath.patch" diff --git a/recipes/cppkafka/all/conanfile.py b/recipes/cppkafka/all/conanfile.py index bc32e36950898..1f97490b74bf8 100644 --- a/recipes/cppkafka/all/conanfile.py +++ b/recipes/cppkafka/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, 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.50.0" +required_conan_version = ">=1.53.0" class CppKafkaConan(ConanFile): name = "cppkafka" description = "Modern C++ Apache Kafka client library (wrapper for librdkafka)" - topics = ("librdkafka", "kafka") + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/mfontanini/cppkafka" - license = "MIT" - + topics = ("librdkafka", "kafka") + 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.83.0", transitive_headers=True) + self.requires("librdkafka/2.3.0", transitive_headers=True) 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) @@ -58,7 +57,7 @@ def generate(self): tc.variables["CPPKAFKA_DISABLE_TESTS"] = True tc.variables["CPPKAFKA_DISABLE_EXAMPLES"] = True tc.variables["CPPKAFKA_RDKAFKA_STATIC_LIB"] = False # underlying logic is useless - if self.settings.os == "Windows": + if Version(self.version) < "0.4.1" and self.settings.os == "Windows": tc.preprocessor_definitions["NOMINMAX"] = 1 tc.generate() cd = CMakeDeps(self) diff --git a/recipes/cppkafka/all/patches/0001-no-template-export.patch b/recipes/cppkafka/all/patches/0.4.0-0001-no-template-export.patch similarity index 100% rename from recipes/cppkafka/all/patches/0001-no-template-export.patch rename to recipes/cppkafka/all/patches/0.4.0-0001-no-template-export.patch diff --git a/recipes/cppkafka/all/patches/0002-cppstd.patch b/recipes/cppkafka/all/patches/0.4.0-0002-cppstd.patch similarity index 100% rename from recipes/cppkafka/all/patches/0002-cppstd.patch rename to recipes/cppkafka/all/patches/0.4.0-0002-cppstd.patch diff --git a/recipes/cppkafka/all/patches/0003-clean-rpath.patch b/recipes/cppkafka/all/patches/0.4.0-0003-clean-rpath.patch similarity index 100% rename from recipes/cppkafka/all/patches/0003-clean-rpath.patch rename to recipes/cppkafka/all/patches/0.4.0-0003-clean-rpath.patch diff --git a/recipes/cppkafka/all/patches/0.4.1-0003-clean-rpath.patch b/recipes/cppkafka/all/patches/0.4.1-0003-clean-rpath.patch new file mode 100644 index 0000000000000..86c2d7f5ce27a --- /dev/null +++ b/recipes/cppkafka/all/patches/0.4.1-0003-clean-rpath.patch @@ -0,0 +1,28 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 6c667df..46c5590 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -28,7 +28,7 @@ if (NOT CMAKE_CXX_FLAGS) + add_definitions("-DNOGDI=1") + add_definitions("-DNOMINMAX=1") + else() +- set(CMAKE_CXX_FLAGS "-Wall") ++# set(CMAKE_CXX_FLAGS "-Wall") + endif() + endif() + +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 214ccd4..d2667ce 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -46,8 +46,8 @@ set_target_properties(${TARGET_NAME} PROPERTIES + ARCHIVE_OUTPUT_NAME "${TARGET_NAME}" + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_INSTALL_LIBDIR}" + LIBRARY_OUTPUT_NAME "${TARGET_NAME}" +- INSTALL_RPATH "${CMAKE_INSTALL_LIBDIR}" +- INSTALL_RPATH_USE_LINK_PATH TRUE ++ # INSTALL_RPATH "${CMAKE_INSTALL_LIBDIR}" ++ # INSTALL_RPATH_USE_LINK_PATH TRUE + VERSION ${CPPKAFKA_VERSION} + SOVERSION ${CPPKAFKA_VERSION}) + # In CMake >= 3.15 Boost::boost == Boost::headers 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/cppkafka/config.yml b/recipes/cppkafka/config.yml index da269653d6e6b..bf6438ecd493c 100644 --- a/recipes/cppkafka/config.yml +++ b/recipes/cppkafka/config.yml @@ -1,3 +1,5 @@ versions: + "0.4.1": + folder: "all" "0.4.0": folder: "all" diff --git a/recipes/cpprestsdk/all/conandata.yml b/recipes/cpprestsdk/all/conandata.yml index 5216074c76f9d..632826ffef040 100644 --- a/recipes/cpprestsdk/all/conandata.yml +++ b/recipes/cpprestsdk/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.10.19": + url: "https://github.com/microsoft/cpprestsdk/archive/refs/tags/v2.10.19.tar.gz" + sha256: "4b0d14e5bfe77ce419affd253366e861968ae6ef2c35ae293727c1415bd145c8" "2.10.18": url: "https://github.com/Microsoft/cpprestsdk/archive/2.10.18.tar.gz" sha256: "6bd74a637ff182144b6a4271227ea8b6b3ea92389f88b25b215e6f94fd4d41cb" @@ -12,6 +15,13 @@ sources: url: "https://github.com/Microsoft/cpprestsdk/archive/v2.10.15.tar.gz" sha256: "1c027a53457e87b0b3a475e5c8045b94400c475898c8bd51b0fbd218b99a7f7b" patches: + "2.10.19": + - patch_file: "patches/0003-find-cmake-targets.patch" + patch_type: "conan" + patch_description: "CMake: internal targets" + - patch_file: "patches/0002-remove-wconversion.patch" + patch_type: "conan" + patch_description: "fix warnings" "2.10.18": - patch_file: "patches/0003-find-cmake-targets.patch" patch_type: "conan" diff --git a/recipes/cpprestsdk/all/conanfile.py b/recipes/cpprestsdk/all/conanfile.py index 467c812235f66..c8ac42529d53c 100644 --- a/recipes/cpprestsdk/all/conanfile.py +++ b/recipes/cpprestsdk/all/conanfile.py @@ -1,6 +1,9 @@ from conan import ConanFile -from conan.tools import files 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, rmdir +) import os required_conan_version = ">=1.53.0" @@ -12,9 +15,9 @@ class CppRestSDKConan(ConanFile): "C++ API design" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/Microsoft/cpprestsdk" - topics = ("cpprestsdk", "rest", "client", "http", "https") + topics = ("rest", "client", "http", "https") license = "MIT" - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -36,7 +39,7 @@ class CppRestSDKConan(ConanFile): } def export_sources(self): - files.export_conandata_patches(self) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -50,23 +53,19 @@ 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.80.0") - self.requires("openssl/1.1.1s") + self.requires("boost/1.83.0") + self.requires("openssl/[>=1.1 <4]") if self.options.with_compression: - self.requires("zlib/1.2.13") + self.requires("zlib/[>=1.2.11 <2]") 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): - files.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) @@ -90,22 +89,22 @@ def generate(self): def _patch_clang_libcxx(self): if self.settings.compiler == 'clang' and str(self.settings.compiler.libcxx) in ['libstdc++', 'libstdc++11']: - files.replace_in_file(self, os.path.join(self.source_folder, 'Release', 'CMakeLists.txt'), + replace_in_file(self, os.path.join(self.source_folder, 'Release', 'CMakeLists.txt'), 'libc++', 'libstdc++') def build(self): - files.apply_conandata_patches(self) + apply_conandata_patches(self) self._patch_clang_libcxx() cmake = CMake(self) cmake.configure() cmake.build() def package(self): - files.copy(self, "license.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, "license.txt", 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")) - files.rmdir(self, os.path.join(self.package_folder, "lib", "cpprestsdk")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cpprestsdk")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "cpprestsdk") @@ -113,14 +112,20 @@ def package_info(self): # cpprestsdk_boost_internal self.cpp_info.components["cpprestsdk_boost_internal"].set_property("cmake_target_name", "cpprestsdk::cpprestsdk_boost_internal") self.cpp_info.components["cpprestsdk_boost_internal"].includedirs = [] - self.cpp_info.components["cpprestsdk_boost_internal"].requires = ["boost::boost"] + ## List of Boost components cpprestsdk depends on: + ## see https://github.com/microsoft/cpprestsdk/blob/v2.10.19/Release/cmake/cpprest_find_boost.cmake#L77-L106 + self.cpp_info.components["cpprestsdk_boost_internal"].requires = ["boost::headers", "boost::system"] + if self.settings.os != "Windows": + self.cpp_info.components["cpprestsdk_boost_internal"].requires.extend(["boost::random", "boost::thread", "boost::filesystem", "boost::chrono", "boost::atomic"]) + if self.settings.os != "Android": + self.cpp_info.components["cpprestsdk_boost_internal"].requires.extend(["boost::date_time", "boost::regex"]) # cpprestsdk_openssl_internal self.cpp_info.components["cpprestsdk_openssl_internal"].set_property("cmake_target_name", "cpprestsdk::cpprestsdk_openssl_internal") self.cpp_info.components["cpprestsdk_openssl_internal"].includedirs = [] 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 = files.collect_libs(self) + self.cpp_info.components["cpprest"].libs = 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/test_package/CMakeLists.txt b/recipes/cpprestsdk/all/test_package/CMakeLists.txt index b305f36beee8f..c83f3ebd18fed 100644 --- a/recipes/cpprestsdk/all/test_package/CMakeLists.txt +++ b/recipes/cpprestsdk/all/test_package/CMakeLists.txt @@ -1,8 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(cpprestsdk REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} cpprestsdk::cpprest) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE cpprestsdk::cpprest) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/cpprestsdk/config.yml b/recipes/cpprestsdk/config.yml index d4be51c9a70c3..00ffc5b18bc36 100644 --- a/recipes/cpprestsdk/config.yml +++ b/recipes/cpprestsdk/config.yml @@ -1,4 +1,6 @@ versions: + "2.10.19": + folder: "all" "2.10.18": folder: "all" "2.10.17": 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..785bad0fb6e29 100644 --- a/recipes/cppserver/all/conanfile.py +++ b/recipes/cppserver/all/conanfile.py @@ -1,90 +1,106 @@ -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 + package_type = "library" + 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.27.0") + self.requires("openssl/[>=1.1 <4]") + 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 build_requirements(self): + if Version(self.version) >= "1.0.2.0": + self.tool_requires("cmake/[>=3.20 <4]") 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/soundtouch/all/test_v1_package/conanfile.py b/recipes/cppserver/all/test_v1_package/conanfile.py similarity index 100% rename from recipes/soundtouch/all/test_v1_package/conanfile.py rename to recipes/cppserver/all/test_v1_package/conanfile.py 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/cpptrace/all/conandata.yml b/recipes/cpptrace/all/conandata.yml new file mode 100644 index 0000000000000..f3fa51c73411b --- /dev/null +++ b/recipes/cpptrace/all/conandata.yml @@ -0,0 +1,43 @@ +sources: + "0.7.3": + url: "https://github.com/jeremy-rifkin/cpptrace/archive/refs/tags/v0.7.3.tar.gz" + sha256: "8b83200860db148a7fd0b2594e7affc6a55809da256e132d6f0d5b202b2e26dd" + "0.7.2": + url: "https://github.com/jeremy-rifkin/cpptrace/archive/refs/tags/v0.7.2.tar.gz" + sha256: "62835abfd91a840e4d212c850695b576523fe6f9036bc5c3e52183b6eb9905c5" + "0.7.1": + url: "https://github.com/jeremy-rifkin/cpptrace/archive/refs/tags/v0.7.1.tar.gz" + sha256: "63df54339feb0c68542232229777df057e1848fc8294528613971bbf42889e83" + "0.7.0": + url: "https://github.com/jeremy-rifkin/cpptrace/archive/refs/tags/v0.7.0.tar.gz" + sha256: "b5c1fbd162f32b8995d9b1fefb1b57fac8b1a0e790f897b81cdafe3625d12001" + "0.6.3": + url: "https://github.com/jeremy-rifkin/cpptrace/archive/refs/tags/v0.6.3.tar.gz" + sha256: "665bf76645ec7b9e6d785a934616f0138862c36cdb58b0d1c9dd18dd4c57395a" + "0.6.2": + url: "https://github.com/jeremy-rifkin/cpptrace/archive/refs/tags/v0.6.2.tar.gz" + sha256: "02a0540b5b1be0788565f48b065b456d3eab81ae2323a50e75ed36449a0143ed" + "0.6.1": + url: "https://github.com/jeremy-rifkin/cpptrace/archive/refs/tags/v0.6.1.tar.gz" + sha256: "4bb478eedbe4b2c0093ef7af4f64795304850e03312e658076b25ef8d6019c75" + # 0.6.0 is required by libassert v2 + "0.6.0": + url: "https://github.com/jeremy-rifkin/cpptrace/archive/refs/tags/v0.6.0.tar.gz" + sha256: "7c2996f03d15f61016bc81fe7fa5220b1cc42498333c5c0e699ad2f96b918b96" + # 0.3.1 is required by libassert v1 + "0.3.1": + url: "https://github.com/jeremy-rifkin/cpptrace/archive/refs/tags/v0.3.1.tar.gz" + sha256: "3c4c5b3406c2b598e5cd2a8cb97f9e8e1f54d6df087a0e62564e6fb68fed852d" + # 0.2.1 is required by libassert v1 + "0.2.1": + url: "https://github.com/jeremy-rifkin/cpptrace/archive/refs/tags/v0.2.1.tar.gz" + sha256: "3184f404c61b6b8ba6fe7c64fc40d1c3d6d87df59bcacf1845d846101bc22f9a" +patches: + "0.2.1": + - patch_file: "patches/0.2.1/0001-to_uintptr.patch" + patch_type: "bugfix" + patch_source: "https://github.com/jeremy-rifkin/cpptrace/commit/bda3e2b169796f2e9c7e751b27306aac6b4a7c26" + patch_description: "Fix for to_uintptr" + - patch_file: "patches/0.2.1/0002-conan-libdwarf.patch" + patch_type: "conan" + patch_description: "Tweaks to use libdwarf provided by conan" diff --git a/recipes/cpptrace/all/conanfile.py b/recipes/cpptrace/all/conanfile.py new file mode 100644 index 0000000000000..8b802e49b1649 --- /dev/null +++ b/recipes/cpptrace/all/conanfile.py @@ -0,0 +1,120 @@ +from conan import ConanFile +from conan.tools.microsoft import check_min_vs, is_msvc_static_runtime, is_msvc +from conan.tools.files import get, copy, rmdir +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, export_conandata_patches +from conan.tools.scm import Version +import os + +required_conan_version = ">=1.53.0" + +class CpptraceConan(ConanFile): + name = "cpptrace" + description = "Simple, portable, and self-contained stacktrace library for C++11 and newer " + license = ("MIT", "LGPL-2.1-only", "BSD-2-Clause-Views") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/jeremy-rifkin/cpptrace" + topics = ("stacktrace", "backtrace", "stack-trace", "back-trace", "trace", "utilities", "error-handling") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "unwind": ["default", "libunwind"], + } + default_options = { + "shared": False, + "fPIC": True, + "unwind": "default", + } + + @property + 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 requirements(self): + if Version(self.version) >= "0.4.0": + self.requires("libdwarf/0.9.1") + else: + self.requires("libdwarf/0.8.0") + if self.options.unwind == "libunwind": + self.requires("libunwind/1.8.0", transitive_libs=True) + + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + check_min_vs(self, 191) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def export_sources(self): + export_conandata_patches(self) + + def generate(self): + tc = CMakeToolchain(self) + if is_msvc(self): + tc.variables["USE_MSVC_RUNTIME_LIBRARY_DLL"] = not is_msvc_static_runtime(self) + if Version(self.version) >= "0.3.0": + tc.variables["CPPTRACE_USE_EXTERNAL_LIBDWARF"] = True + tc.variables["CPPTRACE_CONAN"] = True + else: + if not self.options.shared: + tc.variables["CPPTRACE_STATIC"] = True + tc.variables["CPPTRACE_USE_SYSTEM_LIBDWARF"] = True + if self.options.unwind == "libunwind": + tc.variables["CPPTRACE_UNWIND_WITH_LIBUNWIND"] = True + tc.cache_variables["CPPTRACE_POSITION_INDEPENDENT_CODE"] = self.options.get_safe("fPIC", True) + tc.generate() + tc = CMakeDeps(self) + 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() + + if self.settings.os == "Windows" and self.options.shared: + copy(self, "*.dll", src=self.build_folder, dst=os.path.join(self.package_folder, "bin"), keep_path=False) + + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + + def package_info(self): + self.cpp_info.libs = ["cpptrace"] + + self.cpp_info.set_property("cmake_module_file_name", "cpptrace") + self.cpp_info.set_property("cmake_module_target_name", "cpptrace") + + 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") + if self.settings.os == "Windows": + self.cpp_info.system_libs.append("dbghelp") + + if not self.options.shared: + self.cpp_info.defines.append("CPPTRACE_STATIC_DEFINE") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "CPPTRACE" + self.cpp_info.filenames["cmake_find_package_multi"] = "cpptrace" + self.cpp_info.names["cmake_find_package"] = "CPPTRACE" + self.cpp_info.names["cmake_find_package_multi"] = "cpptrace" diff --git a/recipes/cpptrace/all/patches/0.2.1/0001-to_uintptr.patch b/recipes/cpptrace/all/patches/0.2.1/0001-to_uintptr.patch new file mode 100644 index 0000000000000..5268df0edea76 --- /dev/null +++ b/recipes/cpptrace/all/patches/0.2.1/0001-to_uintptr.patch @@ -0,0 +1,13 @@ +diff --git src/platform/utils.hpp src/platform/utils.hpp +index 51395fe..7853960 100644 +--- src/platform/utils.hpp ++++ src/platform/utils.hpp +@@ -334,7 +334,7 @@ namespace detail { + return static_cast(t); + } + template +- unsigned long long to_uintptr(T t) { ++ uintptr_t to_uintptr(T t) { + return static_cast(t); + } + diff --git a/recipes/cpptrace/all/patches/0.2.1/0002-conan-libdwarf.patch b/recipes/cpptrace/all/patches/0.2.1/0002-conan-libdwarf.patch new file mode 100644 index 0000000000000..70f3a48f3de5a --- /dev/null +++ b/recipes/cpptrace/all/patches/0.2.1/0002-conan-libdwarf.patch @@ -0,0 +1,62 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index ce5dbcf..085a1aa 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -218,7 +218,6 @@ + add_library(cpptrace STATIC ${sources} include/cpptrace/cpptrace.hpp) + else() + add_library(cpptrace SHARED ${sources} include/cpptrace/cpptrace.hpp) +- set_property(TARGET cpptrace PROPERTY POSITION_INDEPENDENT_CODE ON) + endif() + + target_include_directories( +@@ -298,7 +298,7 @@ + target_compile_definitions(cpptrace PUBLIC CPPTRACE_GET_SYMBOLS_WITH_LIBDWARF) + if(CPPTRACE_USE_SYSTEM_LIBDWARF) + find_package(libdwarf REQUIRED) +- target_link_libraries(cpptrace PRIVATE libdwarf) ++ target_link_libraries(cpptrace PRIVATE libdwarf::libdwarf) + else() + add_subdirectory(bundled/libdwarf) + target_link_libraries(cpptrace PRIVATE dwarf) +@@ -379,7 +379,7 @@ + include(CMakePackageConfigHelpers) + + if(CPPTRACE_GET_SYMBOLS_WITH_LIBDWARF) +- set(CPPTRACE_STATIC_EXPORT_TARGETS cpptrace dwarf) ++ set(CPPTRACE_STATIC_EXPORT_TARGETS cpptrace) + else() + set(CPPTRACE_STATIC_EXPORT_TARGETS cpptrace) + endif() + +diff --git a/src/symbols/symbols_with_libdwarf.cpp b/src/symbols/symbols_with_libdwarf.cpp +index ce5dbcf..085a1aa 100644 +--- a/src/symbols/symbols_with_libdwarf.cpp ++++ b/src/symbols/symbols_with_libdwarf.cpp +@@ -20,8 +20,8 @@ + #include + #include + +-#include +-#include ++#include ++#include + + // It's been tricky to piece together how to handle all this dwarf stuff. Some resources I've used are + // https://www.prevanders.net/libdwarf.pdf + +diff --git a/src/platform/dwarf.hpp b/src/platform/dwarf.hpp +index ce5dbcf..085a1aa 100644 +--- a/src/platform/dwarf.hpp ++++ b/src/platform/dwarf.hpp +@@ -9,8 +9,8 @@ + #include + #include + +-#include +-#include ++#include ++#include + + namespace cpptrace { + namespace detail { diff --git a/recipes/cpptrace/all/test_package/CMakeLists.txt b/recipes/cpptrace/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..8f30d3137fd43 --- /dev/null +++ b/recipes/cpptrace/all/test_package/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(cpptrace REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE cpptrace::cpptrace) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) + +if(${cpptrace_VERSION} VERSION_GREATER_EQUAL "0.4.0") + target_compile_definitions(${PROJECT_NAME} PRIVATE CTRACE) +endif() diff --git a/recipes/cpptrace/all/test_package/conanfile.py b/recipes/cpptrace/all/test_package/conanfile.py new file mode 100644 index 0000000000000..f5cf204295e19 --- /dev/null +++ b/recipes/cpptrace/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cpptrace/all/test_package/test_package.cpp b/recipes/cpptrace/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..9e8a6c33d9933 --- /dev/null +++ b/recipes/cpptrace/all/test_package/test_package.cpp @@ -0,0 +1,17 @@ +#include +#include +#include +#include +#ifdef CTRACE +#include +#endif + +int main() { + cpptrace::generate_trace().print(); + +#ifdef CTRACE + ctrace_stacktrace c_trace = ctrace_generate_trace(0, SIZE_MAX); +#endif + + return EXIT_SUCCESS; +} diff --git a/recipes/cpptrace/config.yml b/recipes/cpptrace/config.yml new file mode 100644 index 0000000000000..b57a666544e5f --- /dev/null +++ b/recipes/cpptrace/config.yml @@ -0,0 +1,21 @@ +versions: + "0.7.3": + folder: all + "0.7.2": + folder: all + "0.7.1": + folder: all + "0.7.0": + folder: all + "0.6.3": + folder: all + "0.6.2": + folder: all + "0.6.1": + folder: all + "0.6.0": + folder: all + "0.3.1": + folder: all + "0.2.1": + folder: all diff --git a/recipes/cppunit/all/conanfile.py b/recipes/cppunit/all/conanfile.py index b78b323595ebf..37927a939aa12 100644 --- a/recipes/cppunit/all/conanfile.py +++ b/recipes/cppunit/all/conanfile.py @@ -1,15 +1,14 @@ from conan import ConanFile -from conan.tools.apple import fix_apple_shared_install_name -from conan.tools.env import Environment, VirtualBuildEnv +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 is_msvc, unix_path -from conan.tools.scm import Version -from conans import tools as tools_legacy +from conan.tools.microsoft import check_min_vs, is_msvc, unix_path import os -required_conan_version = ">=1.53.0" +required_conan_version = ">=1.57.0" class CppunitConan(ConanFile): @@ -22,6 +21,7 @@ class CppunitConan(ConanFile): 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], @@ -36,10 +36,6 @@ class CppunitConan(ConanFile): 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 @@ -60,8 +56,7 @@ def build_requirements(self): self.tool_requires("automake/1.16.5") 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) @@ -72,10 +67,12 @@ def generate(self): tc.extra_defines.append("CPPUNIT_BUILD_DLL") 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"): + 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" tc.configure_args.extend([ "--enable-debug={}".format(yes_no(self.settings.build_type == "Debug")), @@ -84,12 +81,10 @@ def generate(self): "--enable-werror=no", "--enable-html-docs=no", ]) - tc.generate() - + env = tc.environment() 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) + 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") @@ -98,7 +93,7 @@ def generate(self): env.define("OBJDUMP", ":") env.define("RANLIB", ":") env.define("STRIP", ":") - env.vars(self).save_script("conanbuild_cppunit_msvc") + tc.generate(env) def build(self): autotools = Autotools(self) @@ -108,8 +103,7 @@ def build(self): def package(self): 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)}"]) + 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")) @@ -122,10 +116,10 @@ def package_info(self): self.cpp_info.set_property("pkg_config_name", "cppunit") self.cpp_info.libs = ["cppunit"] if not self.options.shared: - libcxx = tools_legacy.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("dl") + self.cpp_info.system_libs.extend(["dl", "m"]) if self.options.shared and self.settings.os == "Windows": self.cpp_info.defines.append("CPPUNIT_DLL") diff --git a/recipes/cpputest/all/test_package/CMakeLists.txt b/recipes/cpputest/all/test_package/CMakeLists.txt index be713b804677f..d28cda840f45c 100644 --- a/recipes/cpputest/all/test_package/CMakeLists.txt +++ b/recipes/cpputest/all/test_package/CMakeLists.txt @@ -5,8 +5,5 @@ find_package(CppUTest REQUIRED CONFIG) add_executable(test_package test_package.cpp) target_link_libraries(test_package PRIVATE CppUTest) +target_compile_definitions(test_package PRIVATE $<$:WITH_EXTENSIONS>) -if(WITH_EXTENSIONS) - add_executable(test_package_with_extensions test_package_with_extensions.cpp) - 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 f422d1c08f29f..c743b7456a139 100644 --- a/recipes/cpputest/all/test_package/conanfile.py +++ b/recipes/cpputest/all/test_package/conanfile.py @@ -17,7 +17,7 @@ def requirements(self): def generate(self): tc = CMakeToolchain(self) - tc.variables["WITH_EXTENSIONS"] = self.dependencies["cpputest"].options.with_extensions + tc.cache_variables["WITH_EXTENSIONS"] = self.dependencies["cpputest"].options.with_extensions tc.generate() def build(self): @@ -29,6 +29,3 @@ 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") - 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_package/test_package.cpp b/recipes/cpputest/all/test_package/test_package.cpp index 2675c3b7d443a..4ba22fc9a1637 100644 --- a/recipes/cpputest/all/test_package/test_package.cpp +++ b/recipes/cpputest/all/test_package/test_package.cpp @@ -1,6 +1,9 @@ #include #include #include +#if defined(WITH_EXTENSIONS) +#include // Only found if extensions enabled +#endif TEST_GROUP(FirstTestGroup) { diff --git a/recipes/cpputest/all/test_package/test_package_with_extensions.cpp b/recipes/cpputest/all/test_package/test_package_with_extensions.cpp deleted file mode 100644 index df94dae2d50a1..0000000000000 --- a/recipes/cpputest/all/test_package/test_package_with_extensions.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include -#include -#include -#include // Only found if extensions enabled - -TEST_GROUP(FirstTestGroup) -{ -}; - -TEST(FirstTestGroup, FirstTest) -{ - CHECK_TRUE(true); -} - -int main(int argc, const char** argv) -{ - CommandLineTestRunner runner(argc, argv, TestRegistry::getCurrentRegistry()); - return runner.runAllTestsMain(); -} diff --git a/recipes/cpputest/all/test_v1_package/conanfile.py b/recipes/cpputest/all/test_v1_package/conanfile.py index cce86300f1595..32e223569cdb0 100644 --- a/recipes/cpputest/all/test_v1_package/conanfile.py +++ b/recipes/cpputest/all/test_v1_package/conanfile.py @@ -16,6 +16,3 @@ 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 263917af47c65..4bfaa1bc9f316 100644 --- a/recipes/cppzmq/all/conandata.yml +++ b/recipes/cppzmq/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "4.10.0": + url: "https://github.com/zeromq/cppzmq/archive/refs/tags/v4.10.0.tar.gz" + sha256: "c81c81bba8a7644c84932225f018b5088743a22999c6d82a2b5f5cd1e6942b74" "4.9.0": url: "https://github.com/zeromq/cppzmq/archive/v4.9.0.tar.gz" sha256: "3fdf5b100206953f674c94d40599bdb3ea255244dcc42fab0d75855ee3645581" diff --git a/recipes/cppzmq/all/conanfile.py b/recipes/cppzmq/all/conanfile.py index 44e3718dd5de3..5a976b586d2ff 100644 --- a/recipes/cppzmq/all/conanfile.py +++ b/recipes/cppzmq/all/conanfile.py @@ -12,25 +12,23 @@ class CppZmqConan(ConanFile): description = "C++ binding for 0MQ" homepage = "https://github.com/zeromq/cppzmq" license = "MIT" - topics = ("cppzmq", "zmq-cpp", "zmq", "cpp-bind") + topics = ("zmq-cpp", "zmq", "cpp-bind") url = "https://github.com/conan-io/conan-center-index" - + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" - no_copy_source = True def layout(self): basic_layout(self, src_folder="src") def requirements(self): - self.requires("zeromq/4.3.4", transitive_headers=True, transitive_libs=True) + self.requires("zeromq/4.3.5") 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 diff --git a/recipes/cppzmq/config.yml b/recipes/cppzmq/config.yml index a52b8593d6634..e5b938c02e62a 100644 --- a/recipes/cppzmq/config.yml +++ b/recipes/cppzmq/config.yml @@ -1,4 +1,6 @@ versions: + "4.10.0": + folder: all "4.9.0": folder: all "4.8.1": diff --git a/recipes/cpr/all/conandata.yml b/recipes/cpr/all/conandata.yml index ae148b6df8b7d..4b7a365ce6f48 100644 --- a/recipes/cpr/all/conandata.yml +++ b/recipes/cpr/all/conandata.yml @@ -1,36 +1,59 @@ sources: - "1.9.0": - url: "https://github.com/libcpr/cpr/archive/refs/tags/1.9.0.tar.gz" - sha256: "67023cde8979e8371f5ee7d6e586d6d0761af4a3a3a3be6270256353c9bf411f" + "1.11.0": + url: "https://github.com/libcpr/cpr/archive/refs/tags/1.11.0.tar.gz" + sha256: "fdafa3e3a87448b5ddbd9c7a16e7276a78f28bbe84a3fc6edcfef85eca977784" + "1.10.5": + url: "https://github.com/libcpr/cpr/archive/refs/tags/1.10.5.tar.gz" + sha256: "c8590568996cea918d7cf7ec6845d954b9b95ab2c4980b365f582a665dea08d8" + "1.10.4": + url: "https://github.com/libcpr/cpr/archive/refs/tags/1.10.4.tar.gz" + sha256: "88462d059cd3df22c4d39ae04483ed50dfd2c808b3effddb65ac3b9aa60b542d" + "1.9.3": + url: "https://github.com/libcpr/cpr/archive/refs/tags/1.9.3.tar.gz" + sha256: "df53e7213d80fdc24583528521f7d3349099f5bb4ed05ab05206091a678cc53c" "1.8.1": url: "https://github.com/libcpr/cpr/archive/refs/tags/1.8.1.tar.gz" sha256: "9155ec36fcafe8cf8d61c98cde8dc6bd27c146740002069bf990855eecb2b95f" "1.7.2": url: "https://github.com/libcpr/cpr/archive/refs/tags/1.7.2.tar.gz" sha256: "aa38a414fe2ffc49af13a08b6ab34df825fdd2e7a1213d032d835a779e14176f" - "1.6.2": - url: "https://github.com/libcpr/cpr/archive/1.6.2.tar.gz" - sha256: "c45f9c55797380c6ba44060f0c73713fbd7989eeb1147aedb8723aa14f3afaa3" - "1.5.2": - url: "https://github.com/libcpr/cpr/archive/1.5.2.tar.gz" - sha256: "6fc9102dd63b549912d7af1ec95ee41ece1a2fe27f759864306b07f6fcf24fe1" - "1.4.0": - url: "https://github.com/libcpr/cpr/archive/1.4.0.tar.gz" - sha256: "13baffba95445e02291684e31906b04df41d8c6a3020a1a55253047c6756a004" patches: - "1.9.0": - - patch_file: "patches/005-1.9.0-fix-curl-components.patch" + "1.11.0": + - patch_file: "patches/008-1.11.0-remove-warning-flags.patch" + patch_description: "disable warning flags and warning as error" + patch_type: "portability" + "1.10.5": + - patch_file: "patches/008-1.10.0-remove-warning-flags.patch" + patch_description: "disable warning flags and warning as error" + patch_type: "portability" + "1.10.4": + - 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.8.1": - patch_file: "patches/005-1.8.1-fix-curl-components.patch" + patch_description: "use cci package" + patch_type: "conan" - patch_file: "patches/007-fix-dll-install.patch" + 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" + patch_description: "use cci package" + patch_type: "conan" - patch_file: "patches/007-fix-dll-install.patch" - "1.6.2": - - patch_file: "patches/005-1.6.2-fix-curl-components.patch" - "1.5.2": - - patch_file: "patches/005-1.5.2-fix-curl-components.patch" - "1.4.0": - - patch_file: "patches/002-1.4.0-create-install.patch" - - patch_file: "patches/003-1.4.0-curl-use-target.patch" - - patch_file: "patches/004-1.4.0-curl-global-scope.patch" + 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" diff --git a/recipes/cpr/all/conanfile.py b/recipes/cpr/all/conanfile.py index 59e6531931412..a7893dee17926 100644 --- a/recipes/cpr/all/conanfile.py +++ b/recipes/cpr/all/conanfile.py @@ -1,7 +1,7 @@ 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.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 @@ -12,9 +12,6 @@ class CprConan(ConanFile): - _AUTO_SSL = "auto" - _NO_SSL = "off" - name = "cpr" description = "C++ Requests: Curl for People, a spiritual port of Python Requests" license = "MIT" @@ -22,57 +19,44 @@ class CprConan(ConanFile): homepage = "https://docs.libcpr.org/" topics = ("requests", "web", "curl") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], - "with_ssl": ["openssl", "darwinssl", "winssl", _AUTO_SSL, _NO_SSL], + "with_ssl": [False, "openssl", "darwinssl", "winssl"], "signal": [True, False], + "verbose_logging": [True, False], } default_options = { "shared": False, "fPIC": True, - "with_ssl": _AUTO_SSL, + "with_ssl": "openssl", "signal": True, + "verbose_logging": False, } @property - def _supports_openssl(self): - # https://github.com/libcpr/cpr/commit/b036a3279ba62720d1e43362d32202bf412ea152 - # https://github.com/libcpr/cpr/releases/tag/1.5.0 - 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 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 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 - Version(self.version) in ["1.6.0", "1.6.1"] - and is_apple_os(self.settings.os) - ) + def _min_cppstd(self): + return "11" if Version(self.version) < "1.10.0" else "17" @property - def _uses_old_cmake_options(self): - # https://github.com/libcpr/cpr/releases/tag/1.6.0 - return Version(self.version) < "1.6.0" + def _compilers_minimum_version(self): + return { + "17": { + "gcc": "7", + "clang": "7", + "apple-clang": "10", + "Visual Studio": "15", + "msvc": "191", + }, + }.get(self._min_cppstd, {}) @property def _uses_valid_abi_and_compiler(self): # https://github.com/conan-io/conan-center-index/pull/5194#issuecomment-821908385 return not ( - Version(self.version) >= "1.6.0" - and self.settings.compiler == "clang" + self.settings.compiler == "clang" and self.settings.compiler.libcxx == "libstdc++" and Version(self.settings.compiler.version) < "9" ) @@ -83,15 +67,13 @@ def export_sources(self): def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + self.options.with_ssl = "winssl" + + if is_apple_os(self): + self.options.with_ssl = "darwinssl" - ssl_library = str(self.options.get_safe("with_ssl")) - if not self._can_auto_ssl and ssl_library == CprConan._AUTO_SSL: - if self._supports_openssl: - self.output.info("Auto SSL is not available below version 1.6.0. Falling back to openssl") - self.options.with_ssl = "openssl" - else: - 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: @@ -101,100 +83,59 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("libcurl/7.86.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] + self.requires("libcurl/[>=7.78.0 <9]", transitive_headers=True, transitive_libs=True) + if self.options.with_ssl == "openssl": + self.requires("openssl/[>=1.1 <4]") def validate(self): - 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", - "winssl": "WinSSL is only on Windows and on CPR versions >= 1.5.1", - CprConan._AUTO_SSL: "Automatic SSL selection is only available on CPR versions >= 1.6.0 (and only >= 1.6.2 on macOS)" - } + 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." + ) if not self._uses_valid_abi_and_compiler: raise ConanInvalidConfiguration(f"Cannot compile {self.ref} with libstdc++ on clang < 9") - ssl_library = str(self.options.with_ssl) - if not self._supports_ssl_library(ssl_library): - raise ConanInvalidConfiguration( - f"Invalid SSL selection for the given configuration: {SSL_FAILURE_MESSAGES[ssl_library]}" - if ssl_library in SSL_FAILURE_MESSAGES - 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( - f"{self.ref}:with_ssl={self.options.with_ssl} requires libcurl:with_ssl={self.options.with_ssl}" - ) + if self.options.with_ssl: + ssl_library = str(self.options.with_ssl) - if ssl_library == "winssl" and self.options["libcurl"].with_ssl != "schannel": - raise ConanInvalidConfiguration( - f"{self.ref}:with_ssl=winssl requires libcurl:with_ssl=schannel" - ) + if ssl_library == "openssl" and is_apple_os(self): + raise ConanInvalidConfiguration("OpenSSL is not supported on macOS. Use DarwinSSL instead.") + if ssl_library == "darwinssl" and not is_apple_os(self): + raise ConanInvalidConfiguration("DarwinSSL is only supported on macOS") + if ssl_library == "winssl" and self.settings.os != "Windows": + raise ConanInvalidConfiguration("WinSSL is only on Windows") 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 Version(self.version) == "1.9.0" and self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "6": + 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): - 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 = { - "CPR_FORCE_USE_SYSTEM_CURL": "USE_SYSTEM_CURL", - "CPR_BUILD_TESTS": "BUILD_CPR_TESTS", - "CPR_BUILD_TESTS_SSL": "BUILD_CPR_TESTS_SSL", - "CPR_GENERATE_COVERAGE": "GENERATE_COVERAGE", - "CPR_USE_SYSTEM_GTEST": "USE_SYSTEM_GTEST", - "CPR_FORCE_OPENSSL_BACKEND": "USE_OPENSSL", - "CPR_FORCE_WINSSL_BACKEND": "USE_WINSSL", - } - - 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 + get(self, **self.conan_data["sources"][self.version], strip_root=True) 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 + if Version(self.version) >= "1.10.0": + tc.variables["CPR_USE_SYSTEM_CURL"] = True + else: + tc.variables["CPR_FORCE_USE_SYSTEM_CURL"] = True + tc.variables["CPR_BUILD_TESTS"] = False + tc.variables["CPR_GENERATE_COVERAGE"] = False + tc.variables["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", - "CPR_FORCE_OPENSSL_BACKEND": ssl_value == "openssl", - "CPR_FORCE_WINSSL_BACKEND": ssl_value == "winssl", - "CMAKE_USE_OPENSSL": ssl_value == "openssl" - } - for cmake_option, value in SSL_OPTIONS.items(): - 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: - tc.variables["CPR_ENABLE_SSL"] = False + tc.variables["CPR_FORCE_DARWINSSL_BACKEND"] = (self.options.with_ssl == "darwinssl") + tc.variables["CPR_FORCE_OPENSSL_BACKEND"] = (self.options.with_ssl == "openssl") + tc.variables["CPR_FORCE_WINSSL_BACKEND"] = (self.options.with_ssl == "winssl") + tc.variables["CMAKE_USE_OPENSSL"] = (self.options.with_ssl == "openssl") + tc.variables["CPR_ENABLE_SSL"] = bool(self.options.with_ssl) + + 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 @@ -226,3 +167,8 @@ def package_info(self): self.cpp_info.libs = ["cpr"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("m") + + if Version(self.version) >= "1.11.0" and \ + ((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.system_libs = ["stdc++fs"] diff --git a/recipes/cpr/all/patches/002-1.4.0-create-install.patch b/recipes/cpr/all/patches/002-1.4.0-create-install.patch deleted file mode 100644 index 42f7f34ab13fe..0000000000000 --- a/recipes/cpr/all/patches/002-1.4.0-create-install.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- cpr/CMakeLists.txt -+++ cpr/CMakeLists.txt -@@ -46,3 +46,11 @@ - message(STATUS "Using CURL_LIBRARIES: ${CURL_LIBRARIES}.") - target_link_libraries(${CPR_LIBRARIES} - ${CURL_LIBRARIES}) -+ -+include(GNUInstallDirs) -+install(TARGETS cpr -+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" -+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" -+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" -+) -+install(DIRECTORY "${PROJECT_SOURCE_DIR}/include/cpr" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") 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 deleted file mode 100644 index 61ba93886b977..0000000000000 --- a/recipes/cpr/all/patches/003-1.4.0-curl-use-target.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/cpr/CMakeLists.txt b/cpr/CMakeLists.txt -diff --git a/a/cpr/CMakeLists.txt b/b/cpr/CMakeLists.txt -index c4f9b5b..7e2279d 100644 ---- a/a/cpr/CMakeLists.txt -+++ b/b/cpr/CMakeLists.txt -@@ -44,8 +44,7 @@ add_library(${CPR_LIBRARIES} - "${CPR_INCLUDE_DIRS}/cpr/unix_socket.h") - - message(STATUS "Using CURL_LIBRARIES: ${CURL_LIBRARIES}.") --target_link_libraries(${CPR_LIBRARIES} -- ${CURL_LIBRARIES}) -+target_link_libraries(cpr PUBLIC CURL::libcurl) - - include(GNUInstallDirs) - install(TARGETS cpr diff --git a/recipes/cpr/all/patches/004-1.4.0-curl-global-scope.patch b/recipes/cpr/all/patches/004-1.4.0-curl-global-scope.patch deleted file mode 100644 index b4fe11b69536a..0000000000000 --- a/recipes/cpr/all/patches/004-1.4.0-curl-global-scope.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff --git a/a/CMakeLists.txt b/b/CMakeLists.txt -index aa9f35d..86500d9 100644 ---- a/a/CMakeLists.txt -+++ b/b/CMakeLists.txt -@@ -86,7 +86,8 @@ if(BUILD_CPR_TESTS) - enable_testing() - endif() - --add_subdirectory(opt) -+# add_subdirectory(opt) # With Conan, none of this is used -+find_package(CURL) - add_subdirectory(cpr) - if(BUILD_CPR_TESTS) - add_subdirectory(test) diff --git a/recipes/cpr/all/patches/005-1.5.2-fix-curl-components.patch b/recipes/cpr/all/patches/005-1.5.2-fix-curl-components.patch deleted file mode 100644 index fda5c28eafd1d..0000000000000 --- a/recipes/cpr/all/patches/005-1.5.2-fix-curl-components.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index c065227d..c1c19155 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -55,15 +55,7 @@ include(cmake/code_coverage.cmake) - - # Curl configuration - if(USE_SYSTEM_CURL) -- find_package(CURL COMPONENTS PROTOCOLS HTTP HTTPS FEATURES SSL) -- if (CURL_FOUND) -- set(SSL_ENABLED ON CACHE INTERNAL "" FORCE) -- else() -- find_package(CURL COMPONENTS PROTOCOLS HTTP) -- if(CURL_FOUND) -- set(SSL_ENABLED OFF CACHE INTERNAL "" FORCE) -- endif() -- endif() -+ find_package(CURL) - endif() - if(NOT USE_SYSTEM_CURL OR NOT CURL_FOUND) - message(STATUS "Not using system Curl, using built-in curl project instead.") diff --git a/recipes/cpr/all/patches/005-1.6.2-fix-curl-components.patch b/recipes/cpr/all/patches/005-1.6.2-fix-curl-components.patch deleted file mode 100644 index 04da489547e84..0000000000000 --- a/recipes/cpr/all/patches/005-1.6.2-fix-curl-components.patch +++ /dev/null @@ -1,36 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -120,29 +120,11 @@ endif() - - # Curl configuration - if(CPR_FORCE_USE_SYSTEM_CURL) -- if(CPR_ENABLE_SSL) -- find_package(CURL COMPONENTS HTTP HTTPS SSL) -- if(CURL_FOUND) -- message(STATUS "Curl ${CURL_VERSION_STRING} found on this system.") -- # To be able to load certificates under Windows when using OpenSSL: -- if(CMAKE_USE_OPENSSL AND WIN32 AND (NOT (CURL_VERSION_STRING VERSION_GREATER_EQUAL "7.71.0"))) -- message(FATAL_ERROR "Your system curl version (${CURL_VERSION_STRING}) is too old to support OpenSSL on Windows which requires curl >= 7.71.0. Update your curl version, use WinSSL, disable SSL or use the build in version of curl.") -- endif() -- else() -- find_package(CURL COMPONENTS HTTP) -- if(CURL_FOUND) -- message(FATAL_ERROR "Curl found on this system but WITHOUT HTTPS/SSL support. Either disable SSL by setting CPR_ENABLE_SSL to OFF or use the build in version of curl by setting CPR_FORCE_USE_SYSTEM_CURL to OFF.") -- else() -- 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() -+ find_package(CURL REQUIRED) -+ if(CURL_FOUND) -+ message(STATUS "Curl found on this system.") - else() -- find_package(CURL COMPONENTS HTTP) -- if(CURL_FOUND) -- message(STATUS "Curl found on this system.") -- else() -- message(FATAL_ERROR "Curl not found on this system. To use the build in version set CPR_FORCE_USE_SYSTEM_CURL to OFF.") -- endif() -+ message(FATAL_ERROR "Curl not found on this system. To use the build in version set CPR_FORCE_USE_SYSTEM_CURL to OFF.") - endif() - else() - message(STATUS "Configuring build in curl...") diff --git a/recipes/cpr/all/patches/005-1.9.0-fix-curl-components.patch b/recipes/cpr/all/patches/005-1.9.0-fix-curl-components.patch deleted file mode 100644 index f20781e9ef90e..0000000000000 --- a/recipes/cpr/all/patches/005-1.9.0-fix-curl-components.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index cb7c5f0..c6c19e4 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -162,6 +162,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) -@@ -186,6 +188,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/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.11.0-remove-warning-flags.patch b/recipes/cpr/all/patches/008-1.11.0-remove-warning-flags.patch new file mode 100644 index 0000000000000..4a2124c047e5a --- /dev/null +++ b/recipes/cpr/all/patches/008-1.11.0-remove-warning-flags.patch @@ -0,0 +1,27 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 70d3296..eb020b4 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -379,14 +379,14 @@ if(CPR_BUILD_TESTS) + restore_variable(DESTINATION CMAKE_CXX_CLANG_TIDY BACKUP CMAKE_CXX_CLANG_TIDY_BKP) + endif() + +-if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") +-else() +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -Werror") +- if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") +- # Disable C++98 compatibility support in clang: https://github.com/libcpr/cpr/issues/927 +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-nonportable-system-include-path -Wno-exit-time-destructors -Wno-undef -Wno-global-constructors -Wno-switch-enum -Wno-old-style-cast -Wno-covered-switch-default -Wno-undefined-func-template") +- endif() +-endif() ++# if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") ++# else() ++# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -Werror") ++# if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") ++# # Disable C++98 compatibility support in clang: https://github.com/libcpr/cpr/issues/927 ++# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-nonportable-system-include-path -Wno-exit-time-destructors -Wno-undef -Wno-global-constructors -Wno-switch-enum -Wno-old-style-cast -Wno-covered-switch-default -Wno-undefined-func-template") ++# endif() ++# endif() + + add_subdirectory(cpr) + add_subdirectory(include) 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 f6ae64d3c9261..c55b28c7485b9 100644 --- a/recipes/cpr/all/test_package/CMakeLists.txt +++ b/recipes/cpr/all/test_package/CMakeLists.txt @@ -5,4 +5,8 @@ find_package(cpr REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE cpr::cpr) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +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/config.yml b/recipes/cpr/config.yml index 3ceff74829cd9..62dcfd2786e34 100644 --- a/recipes/cpr/config.yml +++ b/recipes/cpr/config.yml @@ -1,13 +1,13 @@ versions: - "1.9.0": + "1.11.0": folder: all - "1.8.1": + "1.10.5": folder: all - "1.7.2": + "1.10.4": folder: all - "1.6.2": + "1.9.3": folder: all - "1.5.2": + "1.8.1": folder: all - "1.4.0": + "1.7.2": folder: all diff --git a/recipes/cprocessing/all/conanfile.py b/recipes/cprocessing/all/conanfile.py index f1d8d20922d76..cfb3a6e0339a8 100644 --- a/recipes/cprocessing/all/conanfile.py +++ b/recipes/cprocessing/all/conanfile.py @@ -1,84 +1,80 @@ -from conans import ConanFile, tools -from conans.tools import ConanInvalidConfiguration import os import re -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, load, replace_in_file, save +from conan.tools.layout import basic_layout +from conan.tools.scm import Version + +required_conan_version = ">=1.52.0" + class CProcessingConan(ConanFile): name = "cprocessing" - description = "Processsing programming for C++ " + description = "Processing programming for C++ " license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/maksmakuta/CProcessing" - topics = ("processing", "opengl", "sketch") + topics = ("processing", "opengl", "sketch", "header-only") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 20 @property def _compilers_minimum_version(self): return { - "gcc": "9", - "Visual Studio": "16.2", - "msvc": "19.22", - "clang": "10", - "apple-clang": "11" + "gcc": "9", + "Visual Studio": "16.2", + "msvc": "192", + "clang": "10", + "apple-clang": "11", } + def layout(self): + basic_layout(self, src_folder="src") + def requirements(self): - self.requires("glfw/3.3.7") + self.requires("glfw/3.3.8") self.requires("glm/0.9.9.8") self.requires("glew/2.2.0") - self.requires("stb/cci.20210910") + self.requires("stb/cci.20220909") self.requires("opengl/system") 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, 20) - - 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_version = str(self.settings.compiler.version) - + 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("{} requires C++20. Your compiler is unknown. Assuming it supports C++20.".format(self.name)) - elif lazy_lt_semver(compiler_version, minimum_version): - raise ConanInvalidConfiguration("{} requires some C++20 features,".format(self.name)) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires some C++{self._min_cppstd} features, which your compiler does not support." + ) 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): - tools.replace_in_file(os.path.join(self._source_subfolder, "lib", "PImage.h"), - "stb/stb_image.h", - "stb_image.h") - - def package(self): - self.copy("*.h", "include", os.path.join(self._source_subfolder, "lib")) + replace_in_file(self, os.path.join(self.source_folder, "lib", "PImage.h"), "stb/stb_image.h", "stb_image.h") + def _extract_license(self): # Extract the License/s from README.md to a file - tmp = tools.load(os.path.join(self._source_subfolder, "README.md")) + tmp = load(self, os.path.join(self.source_folder, "README.md")) license_contents = re.search("(## Author.*)", tmp, re.DOTALL)[1] - tools.save(os.path.join(self.package_folder, "licenses", "LICENSE.md"), license_contents) + save(self, os.path.join(self.package_folder, "licenses", "LICENSE.md"), license_contents) - def package_info(self): - self.cpp_info.set_property("cmake_file_name", "CProcessing") - self.cpp_info.set_property("cmake_target_name", "CProcessing::CProcessing") + def package(self): + self._extract_license() + copy(self, "*.h", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "lib")) - # TODO: to remove in conan v2 once cmake_find_package_* generators removed - self.cpp_info.filenames["cmake_find_package"] = "CProcessing" - self.cpp_info.filenames["cmake_find_package_multi"] = "CProcessing" - self.cpp_info.names["cmake_find_package"] = "CProcessing" - self.cpp_info.names["cmake_find_package_multi"] = "CProcessing" + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/cprocessing/all/test_package/CMakeLists.txt b/recipes/cprocessing/all/test_package/CMakeLists.txt index 05121b9bfe414..81c78689deb64 100644 --- a/recipes/cprocessing/all/test_package/CMakeLists.txt +++ b/recipes/cprocessing/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.12) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(CProcessing REQUIRED CONFIG) +find_package(cprocessing REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} CProcessing::CProcessing) +target_link_libraries(${PROJECT_NAME} cprocessing::cprocessing) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) diff --git a/recipes/cprocessing/all/test_package/conanfile.py b/recipes/cprocessing/all/test_package/conanfile.py index 51cf79f1d6887..ef5d7042163ec 100644 --- a/recipes/cprocessing/all/test_package/conanfile.py +++ b/recipes/cprocessing/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,7 +21,6 @@ def build(self): cmake.build() def test(self): - test_file = os.path.join("bin", "test_package") - if self.settings.os == "Windows": - test_file += ".exe" - assert os.path.exists(test_file) + 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/cprocessing/all/test_package/test_package.cpp b/recipes/cprocessing/all/test_package/test_package.cpp index 479e221b8ea06..e8aaee04efe2b 100644 --- a/recipes/cprocessing/all/test_package/test_package.cpp +++ b/recipes/cprocessing/all/test_package/test_package.cpp @@ -6,67 +6,74 @@ * Part 2: https://youtube.com/shorts/IS6_apBewlI */ +// Disable the main function from from processing.h +// to disable the interactive GUI for the purposes of this test +#define main _main #include +#undef main float speed; -class Star{ +class Star { private: - float x,y,z,pz; + float x, y, z, pz; + public: - Star(){ - this->x = random(-width,width); - this->y = random(-height,height); - this->z = random(width); - this->pz = z; + Star() { + this->x = random(-width, width); + this->y = random(-height, height); + this->z = random(width); + this->pz = z; } - void update(){ - this->z -= speed; - if(this->z < 1.f){ - this->z = width; - this->x = random(-width,width); - this->y = random(-height,height); - this->pz = z; - } + void update() { + this->z -= speed; + if (this->z < 1.f) { + this->z = width; + this->x = random(-width, width); + this->y = random(-height, height); + this->pz = z; + } } - void show(){ - fill(255); + void show() { + fill(255); - float sx = map(this->x / this->z,0,1,0, width); - float sy = map(this->y / this->z,0,1,0,height); + float sx = map(this->x / this->z, 0, 1, 0, width); + float sy = map(this->y / this->z, 0, 1, 0, height); - float r = map(this->z,0,width,16,0); - circle(sx,sy,r); + float r = map(this->z, 0, width, 16, 0); + circle(sx, sy, r); - float zx = map(this->x / this->pz,0,1,0, width); - float zy = map(this->y / this->pz,0,1,0,height); + float zx = map(this->x / this->pz, 0, 1, 0, width); + float zy = map(this->y / this->pz, 0, 1, 0, height); - this->pz = z; + this->pz = z; - stroke(255); - line(zx,zy,sx,sy); + stroke(255); + line(zx, zy, sx, sy); } - }; std::vector stars; -void setup(){ - size(640,480); - for(int a = 0;a < 100;a++) - stars.push_back(Star()); +void setup() { + size(640, 480); + for (int a = 0; a < 100; a++) + stars.push_back(Star()); } -void draw(){ - speed = map(mouseX,0,width,0.f,50.f); - background(0); - translate(width/2,height/2); +void draw() { + speed = map(mouseX, 0, width, 0.f, 50.f); + background(0); + translate(width / 2, height / 2); - for(int a = 0;a < stars.size();a++){ - stars[a].update(); - stars[a].show(); - } + for (int a = 0; a < stars.size(); a++) { + stars[a].update(); + stars[a].show(); + } +} +int main() { + return 0; } diff --git a/recipes/cprocessing/all/test_v1_package/CMakeLists.txt b/recipes/cprocessing/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/cprocessing/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/cprocessing/all/test_v1_package/conanfile.py b/recipes/cprocessing/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/cprocessing/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/cpu_features/all/conandata.yml b/recipes/cpu_features/all/conandata.yml index a6a49730a3d42..b0a209ae1c3e8 100644 --- a/recipes/cpu_features/all/conandata.yml +++ b/recipes/cpu_features/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "0.9.0": + url: "https://github.com/google/cpu_features/archive/refs/tags/v0.9.0.tar.gz" + sha256: "bdb3484de8297c49b59955c3b22dba834401bc2df984ef5cfc17acbe69c5018e" + "0.8.0": + url: "https://github.com/google/cpu_features/archive/refs/tags/v0.8.0.tar.gz" + sha256: "7021729f2db97aa34f218d12727314f23e8b11eaa2d5a907e8426bcb41d7eaac" "0.7.0": url: "https://github.com/google/cpu_features/archive/refs/tags/v0.7.0.tar.gz" sha256: "df80d9439abf741c7d2fdcdfd2d26528b136e6c52976be8bd0cd5e45a27262c0" @@ -6,7 +12,17 @@ sources: url: "https://github.com/google/cpu_features/archive/refs/tags/v0.6.0.tar.gz" sha256: "95a1cf6f24948031df114798a97eea2a71143bd38a4d07d9a758dda3924c1932" patches: + "0.8.0": + - patch_file: "patches/0.8.0-0001-support-aarch64-macos.patch" + patch_description: "support M1 MacOSX" + patch_type: "portability" + patch_source: "https://github.com/google/cpu_features/pull/204" "0.7.0": - patch_file: "patches/0.7.0-0001-support-aarch64-macos.patch" + patch_description: "support M1 MacOSX" + patch_type: "portability" + patch_source: "https://github.com/google/cpu_features/pull/204" "0.6.0": - patch_file: "patches/0.6.0-0001-fix-bundle-install.patch" + patch_description: "add bundle destination to install" + patch_type: "conan" diff --git a/recipes/cpu_features/all/conanfile.py b/recipes/cpu_features/all/conanfile.py index 67333f1731762..704de6e4661e1 100644 --- a/recipes/cpu_features/all/conanfile.py +++ b/recipes/cpu_features/all/conanfile.py @@ -15,7 +15,7 @@ class CpuFeaturesConan(ConanFile): homepage = "https://github.com/google/cpu_features" description = "A cross platform C99 library to get cpu features at runtime." topics = ("cpu", "features", "cpuid") - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -43,8 +43,7 @@ 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/cpu_features/all/patches/0.8.0-0001-support-aarch64-macos.patch b/recipes/cpu_features/all/patches/0.8.0-0001-support-aarch64-macos.patch new file mode 100644 index 0000000000000..e29b90d0379c1 --- /dev/null +++ b/recipes/cpu_features/all/patches/0.8.0-0001-support-aarch64-macos.patch @@ -0,0 +1,257 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index bcc9bb0..c87475c 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -147,7 +147,7 @@ target_link_libraries(cpu_features PUBLIC ${CMAKE_DL_LIBS}) + target_include_directories(cpu_features + PUBLIC $ + ) +-if(PROCESSOR_IS_X86) ++if(PROCESSOR_IS_X86 OR PROCESSOR_IS_AARCH64) + if(APPLE) + target_compile_definitions(cpu_features PRIVATE HAVE_SYSCTLBYNAME) + endif() +diff --git b/include/impl_aarch64__base_implementation.inl b/include/impl_aarch64__base_implementation.inl +new file mode 100644 +index 0000000..ef3629e +--- /dev/null ++++ b/include/impl_aarch64__base_implementation.inl +@@ -0,0 +1,63 @@ ++#include "cpuinfo_aarch64.h" ++ ++//////////////////////////////////////////////////////////////////////////////// ++// Definitions for introspection. ++//////////////////////////////////////////////////////////////////////////////// ++#define INTROSPECTION_TABLE \ ++ LINE(AARCH64_FP, fp, "fp", AARCH64_HWCAP_FP, 0) \ ++ LINE(AARCH64_ASIMD, asimd, "asimd", AARCH64_HWCAP_ASIMD, 0) \ ++ LINE(AARCH64_EVTSTRM, evtstrm, "evtstrm", AARCH64_HWCAP_EVTSTRM, 0) \ ++ LINE(AARCH64_AES, aes, "aes", AARCH64_HWCAP_AES, 0) \ ++ LINE(AARCH64_PMULL, pmull, "pmull", AARCH64_HWCAP_PMULL, 0) \ ++ LINE(AARCH64_SHA1, sha1, "sha1", AARCH64_HWCAP_SHA1, 0) \ ++ LINE(AARCH64_SHA2, sha2, "sha2", AARCH64_HWCAP_SHA2, 0) \ ++ LINE(AARCH64_CRC32, crc32, "crc32", AARCH64_HWCAP_CRC32, 0) \ ++ LINE(AARCH64_ATOMICS, atomics, "atomics", AARCH64_HWCAP_ATOMICS, 0) \ ++ LINE(AARCH64_FPHP, fphp, "fphp", AARCH64_HWCAP_FPHP, 0) \ ++ LINE(AARCH64_ASIMDHP, asimdhp, "asimdhp", AARCH64_HWCAP_ASIMDHP, 0) \ ++ LINE(AARCH64_CPUID, cpuid, "cpuid", AARCH64_HWCAP_CPUID, 0) \ ++ LINE(AARCH64_ASIMDRDM, asimdrdm, "asimdrdm", AARCH64_HWCAP_ASIMDRDM, 0) \ ++ LINE(AARCH64_JSCVT, jscvt, "jscvt", AARCH64_HWCAP_JSCVT, 0) \ ++ LINE(AARCH64_FCMA, fcma, "fcma", AARCH64_HWCAP_FCMA, 0) \ ++ LINE(AARCH64_LRCPC, lrcpc, "lrcpc", AARCH64_HWCAP_LRCPC, 0) \ ++ LINE(AARCH64_DCPOP, dcpop, "dcpop", AARCH64_HWCAP_DCPOP, 0) \ ++ LINE(AARCH64_SHA3, sha3, "sha3", AARCH64_HWCAP_SHA3, 0) \ ++ LINE(AARCH64_SM3, sm3, "sm3", AARCH64_HWCAP_SM3, 0) \ ++ LINE(AARCH64_SM4, sm4, "sm4", AARCH64_HWCAP_SM4, 0) \ ++ LINE(AARCH64_ASIMDDP, asimddp, "asimddp", AARCH64_HWCAP_ASIMDDP, 0) \ ++ LINE(AARCH64_SHA512, sha512, "sha512", AARCH64_HWCAP_SHA512, 0) \ ++ LINE(AARCH64_SVE, sve, "sve", AARCH64_HWCAP_SVE, 0) \ ++ LINE(AARCH64_ASIMDFHM, asimdfhm, "asimdfhm", AARCH64_HWCAP_ASIMDFHM, 0) \ ++ LINE(AARCH64_DIT, dit, "dit", AARCH64_HWCAP_DIT, 0) \ ++ LINE(AARCH64_USCAT, uscat, "uscat", AARCH64_HWCAP_USCAT, 0) \ ++ LINE(AARCH64_ILRCPC, ilrcpc, "ilrcpc", AARCH64_HWCAP_ILRCPC, 0) \ ++ LINE(AARCH64_FLAGM, flagm, "flagm", AARCH64_HWCAP_FLAGM, 0) \ ++ LINE(AARCH64_SSBS, ssbs, "ssbs", AARCH64_HWCAP_SSBS, 0) \ ++ LINE(AARCH64_SB, sb, "sb", AARCH64_HWCAP_SB, 0) \ ++ LINE(AARCH64_PACA, paca, "paca", AARCH64_HWCAP_PACA, 0) \ ++ LINE(AARCH64_PACG, pacg, "pacg", AARCH64_HWCAP_PACG, 0) \ ++ LINE(AARCH64_DCPODP, dcpodp, "dcpodp", 0, AARCH64_HWCAP2_DCPODP) \ ++ LINE(AARCH64_SVE2, sve2, "sve2", 0, AARCH64_HWCAP2_SVE2) \ ++ LINE(AARCH64_SVEAES, sveaes, "sveaes", 0, AARCH64_HWCAP2_SVEAES) \ ++ LINE(AARCH64_SVEPMULL, svepmull, "svepmull", 0, AARCH64_HWCAP2_SVEPMULL) \ ++ LINE(AARCH64_SVEBITPERM, svebitperm, "svebitperm", 0, \ ++ AARCH64_HWCAP2_SVEBITPERM) \ ++ LINE(AARCH64_SVESHA3, svesha3, "svesha3", 0, AARCH64_HWCAP2_SVESHA3) \ ++ LINE(AARCH64_SVESM4, svesm4, "svesm4", 0, AARCH64_HWCAP2_SVESM4) \ ++ LINE(AARCH64_FLAGM2, flagm2, "flagm2", 0, AARCH64_HWCAP2_FLAGM2) \ ++ LINE(AARCH64_FRINT, frint, "frint", 0, AARCH64_HWCAP2_FRINT) \ ++ LINE(AARCH64_SVEI8MM, svei8mm, "svei8mm", 0, AARCH64_HWCAP2_SVEI8MM) \ ++ LINE(AARCH64_SVEF32MM, svef32mm, "svef32mm", 0, AARCH64_HWCAP2_SVEF32MM) \ ++ LINE(AARCH64_SVEF64MM, svef64mm, "svef64mm", 0, AARCH64_HWCAP2_SVEF64MM) \ ++ LINE(AARCH64_SVEBF16, svebf16, "svebf16", 0, AARCH64_HWCAP2_SVEBF16) \ ++ LINE(AARCH64_I8MM, i8mm, "i8mm", 0, AARCH64_HWCAP2_I8MM) \ ++ LINE(AARCH64_BF16, bf16, "bf16", 0, AARCH64_HWCAP2_BF16) \ ++ LINE(AARCH64_DGH, dgh, "dgh", 0, AARCH64_HWCAP2_DGH) \ ++ LINE(AARCH64_RNG, rng, "rng", 0, AARCH64_HWCAP2_RNG) \ ++ LINE(AARCH64_BTI, bti, "bti", 0, AARCH64_HWCAP2_BTI) \ ++ LINE(AARCH64_MTE, mte, "mte", 0, AARCH64_HWCAP2_MTE) \ ++ LINE(AARCH64_ECV, ecv, "ecv", 0, AARCH64_HWCAP2_ECV) \ ++ LINE(AARCH64_AFP, afp, "afp", 0, AARCH64_HWCAP2_AFP) \ ++ LINE(AARCH64_RPRES, rpres, "rpres", 0, AARCH64_HWCAP2_RPRES) ++#define INTROSPECTION_PREFIX Aarch64 ++#define INTROSPECTION_ENUM_PREFIX AARCH64 +diff --git a/src/impl_aarch64_linux_or_android.c b/src/impl_aarch64_linux_or_android.c +index ef923d9..c0a764c 100644 +--- a/src/impl_aarch64_linux_or_android.c ++++ b/src/impl_aarch64_linux_or_android.c +@@ -17,81 +17,7 @@ + #ifdef CPU_FEATURES_ARCH_AARCH64 + #if defined(CPU_FEATURES_OS_LINUX) || defined(CPU_FEATURES_OS_ANDROID) + +-#include "cpuinfo_aarch64.h" +- +-//////////////////////////////////////////////////////////////////////////////// +-// Definitions for introspection. +-//////////////////////////////////////////////////////////////////////////////// +-#define INTROSPECTION_TABLE \ +- LINE(AARCH64_FP, fp, "fp", AARCH64_HWCAP_FP, 0) \ +- LINE(AARCH64_ASIMD, asimd, "asimd", AARCH64_HWCAP_ASIMD, 0) \ +- LINE(AARCH64_EVTSTRM, evtstrm, "evtstrm", AARCH64_HWCAP_EVTSTRM, 0) \ +- LINE(AARCH64_AES, aes, "aes", AARCH64_HWCAP_AES, 0) \ +- LINE(AARCH64_PMULL, pmull, "pmull", AARCH64_HWCAP_PMULL, 0) \ +- LINE(AARCH64_SHA1, sha1, "sha1", AARCH64_HWCAP_SHA1, 0) \ +- LINE(AARCH64_SHA2, sha2, "sha2", AARCH64_HWCAP_SHA2, 0) \ +- LINE(AARCH64_CRC32, crc32, "crc32", AARCH64_HWCAP_CRC32, 0) \ +- LINE(AARCH64_ATOMICS, atomics, "atomics", AARCH64_HWCAP_ATOMICS, 0) \ +- LINE(AARCH64_FPHP, fphp, "fphp", AARCH64_HWCAP_FPHP, 0) \ +- LINE(AARCH64_ASIMDHP, asimdhp, "asimdhp", AARCH64_HWCAP_ASIMDHP, 0) \ +- LINE(AARCH64_CPUID, cpuid, "cpuid", AARCH64_HWCAP_CPUID, 0) \ +- LINE(AARCH64_ASIMDRDM, asimdrdm, "asimdrdm", AARCH64_HWCAP_ASIMDRDM, 0) \ +- LINE(AARCH64_JSCVT, jscvt, "jscvt", AARCH64_HWCAP_JSCVT, 0) \ +- LINE(AARCH64_FCMA, fcma, "fcma", AARCH64_HWCAP_FCMA, 0) \ +- LINE(AARCH64_LRCPC, lrcpc, "lrcpc", AARCH64_HWCAP_LRCPC, 0) \ +- LINE(AARCH64_DCPOP, dcpop, "dcpop", AARCH64_HWCAP_DCPOP, 0) \ +- LINE(AARCH64_SHA3, sha3, "sha3", AARCH64_HWCAP_SHA3, 0) \ +- LINE(AARCH64_SM3, sm3, "sm3", AARCH64_HWCAP_SM3, 0) \ +- LINE(AARCH64_SM4, sm4, "sm4", AARCH64_HWCAP_SM4, 0) \ +- LINE(AARCH64_ASIMDDP, asimddp, "asimddp", AARCH64_HWCAP_ASIMDDP, 0) \ +- LINE(AARCH64_SHA512, sha512, "sha512", AARCH64_HWCAP_SHA512, 0) \ +- LINE(AARCH64_SVE, sve, "sve", AARCH64_HWCAP_SVE, 0) \ +- LINE(AARCH64_ASIMDFHM, asimdfhm, "asimdfhm", AARCH64_HWCAP_ASIMDFHM, 0) \ +- LINE(AARCH64_DIT, dit, "dit", AARCH64_HWCAP_DIT, 0) \ +- LINE(AARCH64_USCAT, uscat, "uscat", AARCH64_HWCAP_USCAT, 0) \ +- LINE(AARCH64_ILRCPC, ilrcpc, "ilrcpc", AARCH64_HWCAP_ILRCPC, 0) \ +- LINE(AARCH64_FLAGM, flagm, "flagm", AARCH64_HWCAP_FLAGM, 0) \ +- LINE(AARCH64_SSBS, ssbs, "ssbs", AARCH64_HWCAP_SSBS, 0) \ +- LINE(AARCH64_SB, sb, "sb", AARCH64_HWCAP_SB, 0) \ +- LINE(AARCH64_PACA, paca, "paca", AARCH64_HWCAP_PACA, 0) \ +- LINE(AARCH64_PACG, pacg, "pacg", AARCH64_HWCAP_PACG, 0) \ +- LINE(AARCH64_DCPODP, dcpodp, "dcpodp", 0, AARCH64_HWCAP2_DCPODP) \ +- LINE(AARCH64_SVE2, sve2, "sve2", 0, AARCH64_HWCAP2_SVE2) \ +- LINE(AARCH64_SVEAES, sveaes, "sveaes", 0, AARCH64_HWCAP2_SVEAES) \ +- LINE(AARCH64_SVEPMULL, svepmull, "svepmull", 0, AARCH64_HWCAP2_SVEPMULL) \ +- LINE(AARCH64_SVEBITPERM, svebitperm, "svebitperm", 0, \ +- AARCH64_HWCAP2_SVEBITPERM) \ +- LINE(AARCH64_SVESHA3, svesha3, "svesha3", 0, AARCH64_HWCAP2_SVESHA3) \ +- LINE(AARCH64_SVESM4, svesm4, "svesm4", 0, AARCH64_HWCAP2_SVESM4) \ +- LINE(AARCH64_FLAGM2, flagm2, "flagm2", 0, AARCH64_HWCAP2_FLAGM2) \ +- LINE(AARCH64_FRINT, frint, "frint", 0, AARCH64_HWCAP2_FRINT) \ +- LINE(AARCH64_SVEI8MM, svei8mm, "svei8mm", 0, AARCH64_HWCAP2_SVEI8MM) \ +- LINE(AARCH64_SVEF32MM, svef32mm, "svef32mm", 0, AARCH64_HWCAP2_SVEF32MM) \ +- LINE(AARCH64_SVEF64MM, svef64mm, "svef64mm", 0, AARCH64_HWCAP2_SVEF64MM) \ +- LINE(AARCH64_SVEBF16, svebf16, "svebf16", 0, AARCH64_HWCAP2_SVEBF16) \ +- LINE(AARCH64_I8MM, i8mm, "i8mm", 0, AARCH64_HWCAP2_I8MM) \ +- LINE(AARCH64_BF16, bf16, "bf16", 0, AARCH64_HWCAP2_BF16) \ +- LINE(AARCH64_DGH, dgh, "dgh", 0, AARCH64_HWCAP2_DGH) \ +- LINE(AARCH64_RNG, rng, "rng", 0, AARCH64_HWCAP2_RNG) \ +- LINE(AARCH64_BTI, bti, "bti", 0, AARCH64_HWCAP2_BTI) \ +- LINE(AARCH64_MTE, mte, "mte", 0, AARCH64_HWCAP2_MTE) \ +- LINE(AARCH64_ECV, ecv, "ecv", 0, AARCH64_HWCAP2_ECV) \ +- LINE(AARCH64_AFP, afp, "afp", 0, AARCH64_HWCAP2_AFP) \ +- LINE(AARCH64_RPRES, rpres, "rpres", 0, AARCH64_HWCAP2_RPRES) +-#define INTROSPECTION_PREFIX Aarch64 +-#define INTROSPECTION_ENUM_PREFIX AARCH64 +-#include "define_introspection_and_hwcaps.inl" +- +-//////////////////////////////////////////////////////////////////////////////// +-// Implementation. +-//////////////////////////////////////////////////////////////////////////////// +- +-#include +- +-#include "internal/bit_utils.h" +-#include "internal/filesystem.h" +-#include "internal/stack_line_reader.h" +-#include "internal/string_view.h" ++#include "impl_aarch64__base_implementation.inl" + + static bool HandleAarch64Line(const LineResult result, + Aarch64Info* const info) { +diff --git b/src/impl_aarch64_macos_or_iphone.c b/src/impl_aarch64_macos_or_iphone.c +new file mode 100644 +index 0000000..4dd1db7 +--- /dev/null ++++ b/src/impl_aarch64_macos_or_iphone.c +@@ -0,0 +1,82 @@ ++// Copyright 2021 Google LLC ++// ++// Licensed 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 "cpu_features_macros.h" ++ ++#ifdef CPU_FEATURES_ARCH_AARCH64 ++#if defined(CPU_FEATURES_OS_MACOS) || defined(CPU_FEATURES_OS_IPHONE) ++ ++#include "impl_aarch64__base_implementation.inl" ++#include "define_introspection_and_hwcaps.inl" ++ ++#if !defined(HAVE_SYSCTLBYNAME) ++#error "Darwin needs support for sysctlbyname" ++#endif ++#include ++ ++#if defined(CPU_FEATURES_MOCK_SYSCTL_AARCH64) ++extern bool GetDarwinSysCtlByName(const char*); ++extern int GetDarwinSysCtlByNameValue(const char* name); ++#else ++static int GetDarwinSysCtlByNameValue(const char* name) { ++ int enabled; ++ size_t enabled_len = sizeof(enabled); ++ const int failure = sysctlbyname(name, &enabled, &enabled_len, NULL, 0); ++ return failure ? 0 : enabled; ++} ++ ++static bool GetDarwinSysCtlByName(const char* name) { ++ return GetDarwinSysCtlByNameValue(name) != 0; ++} ++#endif ++ ++static const Aarch64Info kEmptyAarch64Info; ++ ++Aarch64Info GetAarch64Info(void) { ++ Aarch64Info info = kEmptyAarch64Info; ++ ++ // Handling Darwin platform through sysctlbyname. ++ info.implementer = GetDarwinSysCtlByNameValue("hw.cputype"); ++ info.variant = GetDarwinSysCtlByNameValue("hw.cpusubtype"); ++ info.part = GetDarwinSysCtlByNameValue("hw.cpufamily"); ++ info.revision = GetDarwinSysCtlByNameValue("hw.cpusubfamily"); ++ ++ info.features.fp = GetDarwinSysCtlByName("hw.optional.floatingpoint"); ++ info.features.asimd = GetDarwinSysCtlByName("hw.optional.AdvSIMD"); ++ info.features.aes = GetDarwinSysCtlByName("hw.optional.arm.FEAT_AES"); ++ info.features.pmull = GetDarwinSysCtlByName("hw.optional.arm.FEAT_PMULL"); ++ info.features.sha1 = GetDarwinSysCtlByName("hw.optional.arm.FEAT_SHA1"); ++ info.features.sha2 = GetDarwinSysCtlByName("hw.optional.arm.FEAT_SHA2"); ++ info.features.crc32 = GetDarwinSysCtlByName("hw.optional.armv8_crc32"); ++ info.features.atomics = GetDarwinSysCtlByName("hw.optional.armv8_1_atomics"); ++ info.features.fphp = GetDarwinSysCtlByName("hw.optional.neon_hpfp"); ++ info.features.jscvt = GetDarwinSysCtlByName("hw.optional.arm.FEAT_JSCVT"); ++ info.features.fcma = GetDarwinSysCtlByName("hw.optional.arm.FEAT_FCMA"); ++ info.features.lrcpc = GetDarwinSysCtlByName("hw.optional.arm.FEAT_LRCPC"); ++ info.features.sha3 = GetDarwinSysCtlByName("hw.optional.armv8_2_sha3"); ++ info.features.sha512 = GetDarwinSysCtlByName("hw.optional.armv8_2_sha512"); ++ info.features.asimdfhm = GetDarwinSysCtlByName("hw.optional.armv8_2_fhm"); ++ info.features.flagm = GetDarwinSysCtlByName("hw.optional.arm.FEAT_FLAGM"); ++ info.features.flagm2 = GetDarwinSysCtlByName("hw.optional.arm.FEAT_FLAGM2"); ++ info.features.ssbs = GetDarwinSysCtlByName("hw.optional.arm.FEAT_SSBS"); ++ info.features.sb = GetDarwinSysCtlByName("hw.optional.arm.FEAT_SB"); ++ info.features.i8mm = GetDarwinSysCtlByName("hw.optional.arm.FEAT_I8MM"); ++ info.features.bf16 = GetDarwinSysCtlByName("hw.optional.arm.FEAT_BF16"); ++ info.features.bti = GetDarwinSysCtlByName("hw.optional.arm.FEAT_BTI"); ++ ++ return info; ++} ++ ++#endif // defined(CPU_FEATURES_OS_MACOS) || defined(CPU_FEATURES_OS_IPHONE) ++#endif // CPU_FEATURES_ARCH_AARCH64 diff --git a/recipes/cpu_features/config.yml b/recipes/cpu_features/config.yml index 5af5c000c90f1..7f1513eea2fa9 100644 --- a/recipes/cpu_features/config.yml +++ b/recipes/cpu_features/config.yml @@ -1,4 +1,8 @@ versions: + "0.9.0": + folder: "all" + "0.8.0": + folder: "all" "0.7.0": folder: "all" "0.6.0": diff --git a/recipes/cpuinfo/all/CMakeLists.txt b/recipes/cpuinfo/all/CMakeLists.txt deleted file mode 100644 index e40870cb28701..0000000000000 --- a/recipes/cpuinfo/all/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -if(NOT CMAKE_SYSTEM_PROCESSOR AND CONAN_CPUINFO_SYSTEM_PROCESSOR) - set(CMAKE_SYSTEM_PROCESSOR ${CONAN_CPUINFO_SYSTEM_PROCESSOR}) -endif() - -add_subdirectory(src) diff --git a/recipes/cpuinfo/all/conandata.yml b/recipes/cpuinfo/all/conandata.yml index 6231a9e8c3b97..5d3ebdc36307e 100644 --- a/recipes/cpuinfo/all/conandata.yml +++ b/recipes/cpuinfo/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "cci.20231129": + url: "https://github.com/pytorch/cpuinfo/archive/9d809924011af8ff49dadbda1499dc5193f1659c.tar.gz" + sha256: "0d769b7e3cc7d16205f4cc8988f869910db19f2d274db005c1ed74e961936d34" + "cci.20230118": + url: "https://github.com/pytorch/cpuinfo/archive/3dc310302210c1891ffcfb12ae67b11a3ad3a150.tar.gz" + sha256: "f2f4df6d2b01036f36c5e372954e536881cdd59f5c2461c67aa0a92c6d755c61" + "cci.20220618": + url: "https://github.com/pytorch/cpuinfo/archive/082deffc80ce517f81dc2f3aebe6ba671fcd09c9.tar.gz" + sha256: "4379348ec3127b37e854a0a66f85ea1d3c606e5f3a6dce235dc9c69ce663c026" "cci.20220228": url: "https://github.com/pytorch/cpuinfo/archive/6288930068efc8dff4f3c0b95f062fc5ddceba04.tar.gz" sha256: "9e9e937b3569320d23d8b1c8c26ed3603affe55c3e4a3e49622e8a2c6d6e1696" diff --git a/recipes/cpuinfo/all/conanfile.py b/recipes/cpuinfo/all/conanfile.py index 8c665b04ef10e..58abd3608a84f 100644 --- a/recipes/cpuinfo/all/conanfile.py +++ b/recipes/cpuinfo/all/conanfile.py @@ -1,11 +1,10 @@ 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, replace_in_file, rmdir +from conan.tools.microsoft import is_msvc import os -required_conan_version = ">=1.51.1" +required_conan_version = ">=1.53.0" class CpuinfoConan(ConanFile): @@ -16,7 +15,7 @@ class CpuinfoConan(ConanFile): 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" - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -29,45 +28,33 @@ class CpuinfoConan(ConanFile): "log_level": "default", } - 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 - try: - del self.settings.compiler.cppstd - except Exception: - pass - try: - del self.settings.compiler.libcxx - except Exception: - pass + if is_msvc(self): + # Only static for msvc + # Injecting CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS is not sufficient since there are global symbols + del self.options.shared + self.package_type = "static-library" + if self.options.get_safe("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 validate(self): - if self.info.settings.os == "Windows" and self.info.options.shared: - raise ConanInvalidConfiguration("shared cpuinfo not 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) # cpuinfo tc.cache_variables["CPUINFO_LIBRARY_TYPE"] = "default" tc.cache_variables["CPUINFO_RUNTIME_TYPE"] = "default" - # TODO: remove str cast in conan 1.53.0 (see https://github.com/conan-io/conan/pull/12086) - tc.cache_variables["CPUINFO_LOG_LEVEL"] = str(self.options.log_level) + 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 @@ -76,24 +63,27 @@ def generate(self): 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) - # CMAKE_SYSTEM_PROCESSOR must be manually set if cross-building - if cross_building(self): - cmake_system_processor = { - "armv8": "arm64", - "armv8.3": "arm64", - }.get(str(self.settings.arch), str(self.settings.arch)) - tc.variables["CONAN_CPUINFO_SYSTEM_PROCESSOR"] = cmake_system_processor tc.generate() 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)", - "") + cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") + + # Fix install dir of dll + replace_in_file( + self, + cmakelists, + "LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}", + "LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}", + ) + + if self.version < "cci.20230118": + # Honor fPIC option + replace_in_file(self, cmakelists, "SET_PROPERTY(TARGET clog PROPERTY POSITION_INDEPENDENT_CODE ON)", "") def build(self): self._patch_sources() cmake = CMake(self) - cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) + cmake.configure() cmake.build() def package(self): @@ -101,9 +91,23 @@ def package(self): cmake = CMake(self) cmake.install() 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", "cpuinfo") self.cpp_info.set_property("pkg_config_name", "libcpuinfo") - self.cpp_info.libs = ["cpuinfo", "clog"] + + if self.version < "cci.20230118": + self.cpp_info.components["clog"].libs = ["clog"] + cpuinfo_clog_target = "clog" if self.version < "cci.20220618" else "cpuinfo::clog" + self.cpp_info.components["clog"].set_property("cmake_target_name", cpuinfo_clog_target) + + self.cpp_info.components["cpuinfo"].set_property("cmake_target_name", "cpuinfo::cpuinfo") + self.cpp_info.components["cpuinfo"].libs = ["cpuinfo"] + if self.version < "cci.20230118": + self.cpp_info.components["cpuinfo"].requires = ["clog"] if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.system_libs = ["pthread"] + self.cpp_info.components["cpuinfo"].system_libs.append("pthread") + + if self.settings.os == "Android": + self.cpp_info.components["cpuinfo"].system_libs.append("log") diff --git a/recipes/cpuinfo/all/test_package/CMakeLists.txt b/recipes/cpuinfo/all/test_package/CMakeLists.txt index f7fd88969d977..96ba94c8edef5 100644 --- a/recipes/cpuinfo/all/test_package/CMakeLists.txt +++ b/recipes/cpuinfo/all/test_package/CMakeLists.txt @@ -4,5 +4,11 @@ project(test_package LANGUAGES C) find_package(cpuinfo REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE cpuinfo::cpuinfo) +if ((${CPUINFO_VERSION} GREATER_EQUAL "20220618") AND (${CPUINFO_VERSION} LESS "20230118")) + # in that version range cpuinfo exposed cpuinfo::clog. Check that is available through conan recipe + target_link_libraries(${PROJECT_NAME} PRIVATE cpuinfo::cpuinfo cpuinfo::clog) +else () + target_link_libraries(${PROJECT_NAME} PRIVATE cpuinfo::cpuinfo) +endif() + 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 0a6bc68712d90..2690818e47570 100644 --- a/recipes/cpuinfo/all/test_package/conanfile.py +++ b/recipes/cpuinfo/all/test_package/conanfile.py @@ -1,12 +1,12 @@ from conan import ConanFile from conan.tools.build import can_run -from conan.tools.cmake import CMake, cmake_layout +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + generators = "CMakeDeps", "VirtualRunEnv" test_type = "explicit" def layout(self): @@ -15,6 +15,11 @@ def layout(self): def requirements(self): self.requires(self.tested_reference_str) + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CPUINFO_VERSION"] = str(self.dependencies["cpuinfo"].ref.version).split('.')[1] + tc.generate() + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/cpuinfo/all/test_v1_package/CMakeLists.txt b/recipes/cpuinfo/all/test_v1_package/CMakeLists.txt index 7b06d2e30ef81..0d20897301b68 100644 --- a/recipes/cpuinfo/all/test_v1_package/CMakeLists.txt +++ b/recipes/cpuinfo/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES C) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(cpuinfo REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE cpuinfo::cpuinfo) -target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) +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 index 38f4483872d47..ea57bb8b3a514 100644 --- a/recipes/cpuinfo/all/test_v1_package/conanfile.py +++ b/recipes/cpuinfo/all/test_v1_package/conanfile.py @@ -8,6 +8,7 @@ class TestPackageConan(ConanFile): def build(self): cmake = CMake(self) + cmake.definitions["CPUINFO_VERSION"] = self.deps_cpp_info["cpuinfo"].version.split('.')[1] cmake.configure() cmake.build() diff --git a/recipes/cpuinfo/config.yml b/recipes/cpuinfo/config.yml index a6383a8ac8924..a71ccd412f08d 100644 --- a/recipes/cpuinfo/config.yml +++ b/recipes/cpuinfo/config.yml @@ -1,4 +1,10 @@ versions: + "cci.20231129": + folder: all + "cci.20230118": + folder: all + "cci.20220618": + folder: all "cci.20220228": folder: all "cci.20201217": diff --git a/recipes/cpython/all/conandata.yml b/recipes/cpython/all/conandata.yml index f9fd51067c8b3..3959aff0dc825 100644 --- a/recipes/cpython/all/conandata.yml +++ b/recipes/cpython/all/conandata.yml @@ -1,72 +1,95 @@ sources: - "3.10.0": - url: "https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tgz" - sha256: "c4e0cbad57c90690cb813fb4663ef670b4d0f587d8171e2c42bd4c9245bd2758" - "3.9.7": - url: "https://www.python.org/ftp/python/3.9.7/Python-3.9.7.tgz" - sha256: "a838d3f9360d157040142b715db34f0218e535333696a5569dc6f854604eb9d1" - "3.8.12": - url: "https://www.python.org/ftp/python/3.8.12/Python-3.8.12.tgz" - sha256: "316aa33f3b7707d041e73f246efedb297a70898c4b91f127f66dc8d80c596f1a" - "3.7.12": - url: "https://www.python.org/ftp/python/3.7.12/Python-3.7.12.tgz" - sha256: "33b4daaf831be19219659466d12645f87ecec6eb21d4d9f9711018a7b66cce46" - "2.7.18": - url: "https://www.python.org/ftp/python/2.7.18/Python-2.7.18.tgz" - sha256: "da3080e3b488f648a3d7a4560ddee895284c3380b11d6de75edb986526b9a814" + "3.12.7": + url: "https://www.python.org/ftp/python/3.12.7/Python-3.12.7.tgz" + sha256: "73ac8fe780227bf371add8373c3079f42a0dc62deff8d612cd15a618082ab623" + "3.12.2": + url: "https://www.python.org/ftp/python/3.12.2/Python-3.12.2.tgz" + sha256: "a7c4f6a9dc423d8c328003254ab0c9338b83037bd787d680826a5bf84308116e" + "3.11.9": + url: "https://www.python.org/ftp/python/3.11.9/Python-3.11.9.tgz" + sha256: "e7de3240a8bc2b1e1ba5c81bf943f06861ff494b69fda990ce2722a504c6153d" + "3.10.14": + url: "https://www.python.org/ftp/python/3.10.14/Python-3.10.14.tgz" + sha256: "cefea32d3be89c02436711c95a45c7f8e880105514b78680c14fe76f5709a0f6" + "3.9.19": + url: "https://www.python.org/ftp/python/3.9.19/Python-3.9.19.tgz" + sha256: "f5f9ec8088abca9e399c3b62fd8ef31dbd2e1472c0ccb35070d4d136821aaf71" + "3.8.19": + url: "https://www.python.org/ftp/python/3.8.19/Python-3.8.19.tgz" + sha256: "c7fa55a36e5c7a19ec37d8f90f60a2197548908c9ac8b31e7c0dbffdd470eeac" patches: - "3.10.0": - - patch_file: "patches/3.10.0-0001-msvc.patch" - base_path: "source_subfolder" - - patch_file: "patches/3.9.7-0002-_msi-vcxproj.patch" - base_path: "source_subfolder" - - patch_file: "patches/3.10.0-0003-_ctypes-ffi.patch" - base_path: "source_subfolder" - - patch_file: "patches/3.10.0-0004-setup.py-pass-CFLAGS-CPPFLAGS.patch" - base_path: "source_subfolder" - - patch_file: "patches/3.10.0-0005-disable-macos-tcltk.patch" - base_path: "source_subfolder" + "3.12.7": + - patch_file: "patches/3.9/3.9.7-0002-_msi-vcxproj.patch" + patch_description: "Fix ARM/ARM64 mismatch in project file" + patch_type: "bugfix" + - patch_file: "patches/3.12/3.12.1-0001-_ctypes-ffi.patch" + patch_description: "Support shared libffi" + patch_type: "portability" - patch_file: "patches/3.x-0001-relocatable-python-config.patch" - base_path: "source_subfolder" - "3.9.7": - - patch_file: "patches/3.9.7-0001-msvc.patch" - base_path: "source_subfolder" - - patch_file: "patches/3.9.7-0002-_msi-vcxproj.patch" - base_path: "source_subfolder" - - patch_file: "patches/3.9.7-0003-_ctypes-ffi.patch" - base_path: "source_subfolder" - - patch_file: "patches/3.9.7-0004-setup.py-pass-CFLAGS-CPPFLAGS.patch" - base_path: "source_subfolder" - - patch_file: "patches/3.9.7-0005-disable-macos-tcltk.patch" - base_path: "source_subfolder" + patch_description: "Allow package to be relocatable" + patch_type: "conan" + - patch_file: "patches/3.12/3.12.1-0002-remove-module-deps.patch" + patch_description: "Remove section of solution file forcing projects to be built that might not be used for this recipe" + patch_type: "conan" + "3.12.2": + - patch_file: "patches/3.9/3.9.7-0002-_msi-vcxproj.patch" + patch_description: "Fix ARM/ARM64 mismatch in project file" + patch_type: "bugfix" + - patch_file: "patches/3.12/3.12.1-0001-_ctypes-ffi.patch" + patch_description: "Support shared libffi" + patch_type: "portability" - patch_file: "patches/3.x-0001-relocatable-python-config.patch" - base_path: "source_subfolder" - "3.8.12": - - patch_file: "patches/3.8.12-0001-msvc.patch" - base_path: "source_subfolder" - - patch_file: "patches/3.8.12-0002-_ctypes-ffi.patch" - base_path: "source_subfolder" - - patch_file: "patches/3.8.12-0003-setup.py-pass-CFLAGS-CPPFLAGS.patch" - base_path: "source_subfolder" - - patch_file: "patches/3.8.12-0004-disable-macos-tcltk.patch" - base_path: "source_subfolder" + patch_description: "Allow package to be relocatable" + patch_type: "conan" + - patch_file: "patches/3.12/3.12.1-0002-remove-module-deps.patch" + patch_description: "Remove section of solution file forcing projects to be built that might not be used for this recipe" + patch_type: "conan" + "3.11.9": + - patch_file: "patches/3.9/3.9.7-0002-_msi-vcxproj.patch" + patch_description: "Fix ARM/ARM64 mismatch in project file" + patch_type: "bugfix" + - patch_file: "patches/3.11/3.11.7-0001-_ctypes-ffi.patch" + patch_description: "Support shared libffi" + patch_type: "portability" - patch_file: "patches/3.x-0001-relocatable-python-config.patch" - base_path: "source_subfolder" - "3.7.12": - - patch_file: "patches/3.7.9-0001-msvc.patch" - base_path: "source_subfolder" - - patch_file: "patches/3.7.9-0002-setup.py-pass-CFLAGS-CPPFLAGS.patch" - base_path: "source_subfolder" - - patch_file: "patches/3.7.9-0003-disable-macos-tcltk.patch" - base_path: "source_subfolder" + patch_description: "Allow package to be relocatable" + patch_type: "conan" + - patch_file: "patches/3.x-0002-remove-module-deps.patch" + patch_description: "Remove section of solution file forcing projects to be built that might not be used for this recipe" + patch_type: "conan" + "3.10.14": + - patch_file: "patches/3.9/3.9.7-0002-_msi-vcxproj.patch" + patch_description: "Fix ARM/ARM64 mismatch in project file" + patch_type: "bugfix" + - patch_file: "patches/3.10/3.10.0-0003-_ctypes-ffi.patch" + patch_description: "Remove duplicate libffi symbols and support shared libffi" + patch_type: "portability" - patch_file: "patches/3.x-0001-relocatable-python-config.patch" - base_path: "source_subfolder" - "2.7.18": - - patch_file: "patches/2.7.18-0001-msvc.patch" - base_path: "source_subfolder" - - patch_file: "patches/2.7.18-0002-add-support-msvc-14.patch" - base_path: "source_subfolder" - - patch_file: "patches/2.7.18-0003-msvc-fix-static.patch" - base_path: "source_subfolder" - - patch_file: "patches/2.7.18-0004-disable-macos-tcltk.patch" - base_path: "source_subfolder" + patch_description: "Allow package to be relocatable" + patch_type: "conan" + - patch_file: "patches/3.x-0002-remove-module-deps.patch" + patch_description: "Remove section of solution file forcing projects to be built that might not be used for this recipe" + patch_type: "conan" + "3.9.19": + - patch_file: "patches/3.9/3.9.7-0002-_msi-vcxproj.patch" + patch_description: "Fix ARM/ARM64 mismatch in project file" + patch_type: "bugfix" + - patch_file: "patches/3.9/3.9.7-0003-_ctypes-ffi.patch" + patch_description: "Remove duplicate libffi symbols and support shared libffi" + patch_type: "portability" + - patch_file: "patches/3.x-0001-relocatable-python-config.patch" + patch_description: "Allow package to be relocatable" + patch_type: "conan" + - patch_file: "patches/3.x-0002-remove-module-deps.patch" + patch_description: "Remove section of solution file forcing projects to be built that might not be used for this recipe" + patch_type: "conan" + "3.8.19": + - patch_file: "patches/3.8/3.8.12-0002-_ctypes-ffi.patch" + patch_description: "Remove duplicate libffi symbols and support shared libffi" + patch_type: "portability" + - patch_file: "patches/3.x-0001-relocatable-python-config.patch" + patch_description: "Allow package to be relocatable" + patch_type: "conan" + - patch_file: "patches/3.x-0002-remove-module-deps.patch" + patch_description: "Remove section of solution file forcing projects to be built that might not be used for this recipe" + patch_type: "conan" diff --git a/recipes/cpython/all/conanfile.py b/recipes/cpython/all/conanfile.py index 4fa1d1da6334e..c98c3381c1c65 100644 --- a/recipes/cpython/all/conanfile.py +++ b/recipes/cpython/all/conanfile.py @@ -1,21 +1,29 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, MSBuild, tools -from conans.errors import ConanInvalidConfiguration -from io import StringIO import os import re import textwrap -required_conan_version = ">=1.33.0" +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 VirtualRunEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, load, mkdir, replace_in_file, rm, rmdir, save, unzip +from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps, PkgConfigDeps +from conan.tools.layout import basic_layout +from conan.tools.microsoft import MSBuildDeps, MSBuildToolchain, MSBuild, is_msvc, is_msvc_static_runtime, msvc_runtime_flag, msvs_toolset +from conan.tools.scm import Version + +required_conan_version = ">=1.58.0" class CPythonConan(ConanFile): name = "cpython" + description = "Python is a programming language that lets you work quickly and integrate systems more effectively." + license = "Python-2.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.python.org" - description = "Python is a programming language that lets you work quickly and integrate systems more effectively." topics = ("python", "cpython", "language", "script") - license = ("Python-2.0",) - exports_sources = "patches/**" + + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -30,11 +38,6 @@ class CPythonConan(ConanFile): "with_sqlite3": [True, False], "with_tkinter": [True, False], "with_curses": [True, False], - - # Python 2 options - "unicode": ["ucs2", "ucs4"], - "with_bsddb": [True, False], - # Python 3 options "with_lzma": [True, False], # options that don't change package id @@ -53,286 +56,426 @@ class CPythonConan(ConanFile): "with_sqlite3": True, "with_tkinter": True, "with_curses": True, - - # Python 2 options - "unicode": "ucs2", - "with_bsddb": False, # True, # FIXME: libdb package missing (#5309/#5392) - # Python 3 options "with_lzma": True, # options that don't change package id "env_vars": True, } - - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _version_number_only(self): - return re.match(r"^([0-9.]+)", self.version).group(1) - - @property - def _version_tuple(self): - return tuple(self._version_number_only.split(".")) + short_paths = True @property def _supports_modules(self): - return self.settings.compiler != "Visual Studio" or self.options.shared + return not is_msvc(self) or self.options.shared @property def _version_suffix(self): - if self.settings.compiler == "Visual Studio": - joiner = "" - else: - joiner = "." - return joiner.join(self._version_tuple[:2]) + v = Version(self.version) + joiner = "" if is_msvc(self) else "." + return f"{v.major}{joiner}{v.minor}" - @property - def _is_py3(self): - return tools.Version(self._version_number_only).major == "3" - - @property - def _is_py2(self): - return tools.Version(self._version_number_only).major == "2" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - if self.settings.compiler == "Visual Studio": + if is_msvc(self): del self.options.lto del self.options.docstrings del self.options.pymalloc del self.options.with_curses del self.options.with_gdbm del self.options.with_nis - if self._is_py2: - # Python 2.xx does not support following options - del self.options.with_lzma - elif self._is_py3: - # Python 3.xx does not support following options - del self.options.with_bsddb - del self.options.unicode - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.settings.compiler.rm_safe("libcxx") + self.settings.compiler.rm_safe("cppstd") def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") if not self._supports_modules: - del self.options.with_bz2 - del self.options.with_sqlite3 - del self.options.with_tkinter - - del self.options.with_bsddb - del self.options.with_lzma - if self.settings.compiler == "Visual Studio": - # The msbuild generator only works with Visual Studio - self.generators.append("MSBuildDeps") - - def validate(self): - if self.options.shared: - if self.settings.compiler == "Visual Studio" and "MT" in self.settings.compiler.runtime: - raise ConanInvalidConfiguration("cpython does not support MT(d) runtime when building a shared cpython library") - if self.settings.compiler == "Visual Studio": - if self.options.optimizations: - raise ConanInvalidConfiguration("This recipe does not support optimized MSVC cpython builds (yet)") - # FIXME: should probably throw when cross building - # FIXME: optimizations for Visual Studio, before building the final `build_type`: - # 1. build the MSVC PGInstrument build_type, - # 2. run the instrumented binaries, (PGInstrument should have created a `python.bat` file in the PCbuild folder) - # 3. build the MSVC PGUpdate build_type - if self.settings.build_type == "Debug" and "d" not in self.settings.compiler.runtime: - raise ConanInvalidConfiguration("Building debug cpython requires a debug runtime (Debug cpython requires _CrtReportMode symbol, which only debug runtimes define)") - if self._is_py2: - if self.settings.compiler.version >= tools.Version("14"): - self.output.warn("Visual Studio versions 14 and higher were never officially supported by the CPython developers") - if str(self.settings.arch) not in self._msvc_archs: - raise ConanInvalidConfiguration("Visual Studio does not support this architecture") + self.options.rm_safe("with_bz2") + self.options.rm_safe("with_sqlite3") + self.options.rm_safe("with_tkinter") + self.options.rm_safe("with_lzma") - if not self.options.shared and tools.Version(self._version_number_only) >= "3.10": - raise ConanInvalidConfiguration("Static msvc build disabled (>=3.10) due to \"AttributeError: module 'sys' has no attribute 'winver'\"") - - if self.options.get_safe("with_curses", False) and not self.options["ncurses"].with_widec: - raise ConanInvalidConfiguration("cpython requires ncurses with wide character support") - - def package_id(self): - del self.info.options.env_vars - - 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") - @property - def _with_libffi(self): - # cpython 3.7.x on MSVC uses an ancient libffi 2.00-beta (which is not available at cci, and is API/ABI incompatible with current 3.2+) - return self._supports_modules \ - and (self.settings.compiler != "Visual Studio" or tools.Version(self._version_number_only) >= "3.8") + def build_requirements(self): + if Version(self.version) >= "3.11" and not is_msvc(self) and not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/2.1.0") def requirements(self): - self.requires("zlib/1.2.11") + self.requires("zlib/[>=1.2.11 <2]") if self._supports_modules: - self.requires("openssl/1.1.1l") - self.requires("expat/2.4.1") - if self._with_libffi: - self.requires("libffi/3.2.1") - if tools.Version(self._version_number_only) < "3.8": - self.requires("mpdecimal/2.4.2") - elif tools.Version(self._version_number_only) < "3.10": + self.requires("openssl/[>=1.1 <4]") + self.requires("expat/[>=2.6.2 <3]") + self.requires("libffi/3.4.4") + if Version(self.version) < "3.10" or is_apple_os(self): + # FIXME: mpdecimal > 2.5.0 on MacOS causes the _decimal module to not be importable self.requires("mpdecimal/2.5.0") else: - self.requires("mpdecimal/2.5.0") # FIXME: no 2.5.1 to troubleshoot apple + self.requires("mpdecimal/2.5.1") if self.settings.os != "Windows": - if not tools.is_apple_os(self.settings.os): - self.requires("libuuid/1.0.3") - self.requires("libxcrypt/4.4.25") + if not is_apple_os(self): + self.requires("util-linux-libuuid/2.39.2") + # In <3.9 and lower patch versions of 3.9/10/11, crypt.h was exposed in Python.h + # This was removed in 3.11 and backported: https://github.com/python/cpython/issues/88914 + # For the sake of this recipe, we only have later patch versions, so this version check + # may be slightly inaccurate if a lower patch version is desired. + transitive_crypt = Version(self.version) < "3.9" + self.requires("libxcrypt/4.4.36", transitive_headers=transitive_crypt, transitive_libs=transitive_crypt) if self.options.get_safe("with_bz2"): self.requires("bzip2/1.0.8") if self.options.get_safe("with_gdbm", False): - self.requires("gdbm/1.19") + self.requires("gdbm/1.23") if self.options.get_safe("with_nis", False): # TODO: Add nis when available. raise ConanInvalidConfiguration("nis is not available on CCI (yet)") if self.options.get_safe("with_sqlite3"): - self.requires("sqlite3/3.36.0") + self.requires("sqlite3/3.45.2") if self.options.get_safe("with_tkinter"): self.requires("tk/8.6.10") if self.options.get_safe("with_curses", False): - self.requires("ncurses/6.2") - if self.options.get_safe("with_bsddb", False): - self.requires("libdb/5.3.28") + # Used in a public header + # https://github.com/python/cpython/blob/v3.10.13/Include/py_curses.h#L34 + self.requires("ncurses/6.4", transitive_headers=True, transitive_libs=True) if self.options.get_safe("with_lzma", False): - self.requires("xz_utils/5.2.5") + self.requires("xz_utils/5.4.5") + + def package_id(self): + del self.info.options.env_vars + + def validate(self): + if self.options.shared: + if is_msvc_static_runtime(self): + raise ConanInvalidConfiguration( + "cpython does not support MT(d) runtime when building a shared cpython library" + ) + if is_msvc(self): + if self.options.optimizations: + raise ConanInvalidConfiguration( + "This recipe does not support optimized MSVC cpython builds (yet)" + ) + # FIXME: should probably throw when cross building + # FIXME: optimizations for Visual Studio, before building the final `build_type`: + # 1. build the MSVC PGInstrument build_type, + # 2. run the instrumented binaries, (PGInstrument should have created a `python.bat` file in the PCbuild folder) + # 3. build the MSVC PGUpdate build_type + if self.settings.build_type == "Debug" and "d" not in msvc_runtime_flag(self): + raise ConanInvalidConfiguration( + "Building debug cpython requires a debug runtime (Debug cpython requires _CrtReportMode" + " symbol, which only debug runtimes define)" + ) + if str(self.settings.arch) not in self._msvc_archs: + raise ConanInvalidConfiguration("Visual Studio does not support this architecture") + if not self.options.shared and Version(self.version) >= "3.10": + # Static CPython on Windows is only loosely supported, see https://github.com/python/cpython/issues/110234 + # 3.10 fails during the test, 3.11 fails during the build (missing symbol that seems to be DLL specific: PyWin_DLLhModule) + raise ConanInvalidConfiguration("Static msvc build disabled (>=3.10) due to \"AttributeError: module 'sys' has no attribute 'winver'\"") + + if self.options.get_safe("with_curses", False) and not self.dependencies["ncurses"].options.with_widec: + raise ConanInvalidConfiguration("cpython requires ncurses with wide character support") + + if self._supports_modules: + if Version(self.version) >= "3.9.0": + if self.dependencies["mpdecimal"].ref.version < Version("2.5.0"): + raise ConanInvalidConfiguration("cpython 3.9.0 (and newer) requires (at least) mpdecimal 2.5.0") + + if self.settings.compiler == "gcc" and Version(self.settings.compiler.version).major == 9 and Version(self.version) >= "3.12": + raise ConanInvalidConfiguration("FIXME: GCC 9 produces an internal compiler error locally, and a link error in CCI") + + def source(self): + 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, win_bash=tools.os_info.is_windows) - self._autotools.libs = [] + def _generate_autotools(self): + tc = AutotoolsToolchain(self, prefix=self.package_folder) + # Not necessary, just cleans up the output + tc.update_configure_args({"--enable-static": None, "--disable-static": None}) yes_no = lambda v: "yes" if v else "no" - conf_args = [ - "--enable-shared={}".format(yes_no(self.options.shared)), + tc.configure_args += [ "--with-doc-strings={}".format(yes_no(self.options.docstrings)), "--with-pymalloc={}".format(yes_no(self.options.pymalloc)), "--with-system-expat", - "--with-system-ffi", "--enable-optimizations={}".format(yes_no(self.options.optimizations)), "--with-lto={}".format(yes_no(self.options.lto)), "--with-pydebug={}".format(yes_no(self.settings.build_type == "Debug")), + "--with-system-libmpdec", + "--with-openssl={}".format(self.dependencies["openssl"].package_folder), ] - if self._is_py2: - conf_args.extend([ - "--enable-unicode={}".format(yes_no(self.options.unicode)), - ]) - if self._is_py3: - conf_args.extend([ - "--with-system-libmpdec", - "--with-openssl={}".format(self.deps_cpp_info["openssl"].rootpath), - "--enable-loadable-sqlite-extensions={}".format(yes_no(not self.options["sqlite3"].omit_load_extension)), - ]) - if self.settings.compiler == "intel": - conf_args.extend(["--with-icc"]) - if tools.get_env("CC") or self.settings.compiler != "gcc": - conf_args.append("--without-gcc") - if self.options.with_tkinter: + if Version(self.version) < "3.12": + tc.configure_args.append("--with-system-ffi") + if Version(self.version) >= "3.10": + tc.configure_args.append("--disable-test-modules") + if self.options.get_safe("with_sqlite3"): + tc.configure_args.append("--enable-loadable-sqlite-extensions={}".format( + yes_no(not self.dependencies["sqlite3"].options.omit_load_extension) + )) + if self.options.with_tkinter and Version(self.version) < "3.11": tcltk_includes = [] tcltk_libs = [] # FIXME: collect using some conan util (https://github.com/conan-io/conan/issues/7656) for dep in ("tcl", "tk", "zlib"): - tcltk_includes += ["-I{}".format(d) for d in self.deps_cpp_info[dep].include_paths] - tcltk_libs += ["-l{}".format(lib) for lib in self.deps_cpp_info[dep].libs] - if self.settings.os == "Linux" and not self.options["tk"].shared: + cpp_info = self.dependencies[dep].cpp_info.aggregated_components() + tcltk_includes += [f"-I{d}" for d in cpp_info.includedirs] + tcltk_libs += [f"-L{lib}" for lib in cpp_info.libdirs] + tcltk_libs += [f"-l{lib}" for lib in cpp_info.libs] + if self.settings.os in ["Linux", "FreeBSD"] and not self.dependencies["tk"].options.shared: # FIXME: use info from xorg.components (x11, xscrnsaver) - tcltk_libs.extend(["-l{}".format(lib) for lib in ("X11", "Xss")]) - conf_args.extend([ + tcltk_libs.extend([f"-l{lib}" for lib in ("X11", "Xss")]) + tc.configure_args += [ "--with-tcltk-includes={}".format(" ".join(tcltk_includes)), "--with-tcltk-libs={}".format(" ".join(tcltk_libs)), - ]) - if self.settings.os in ("Linux", "FreeBSD"): - # Building _testembed fails due to missing pthread/rt symbols - self._autotools.link_flags.append("-lpthread") - - build = None - if tools.cross_building(self) and not tools.cross_building(self, skip_x64_x86=True): - # Building from x86_64 to x86 is not a "real" cross build, so set build == host - build = tools.get_gnu_triplet(str(self.settings.os), str(self.settings.arch), str(self.settings.compiler)) - self._autotools.configure(args=conf_args, configure_dir=self._source_subfolder, build=build) - return self._autotools + ] + if not is_apple_os(self): + tc.extra_ldflags.append('-Wl,--as-needed') + + tc.generate() + + deps = AutotoolsDeps(self) + deps.generate() + if Version(self.version) >= "3.11": + pkgdeps = PkgConfigDeps(self) + pkgdeps.generate() + + def generate(self): + VirtualRunEnv(self).generate(scope="build") + + if is_msvc(self): + # The msbuild generator only works with Visual Studio + deps = MSBuildDeps(self) + deps.generate() + # The toolchain.props is not injected yet, but it also generates VCVars + toolchain = MSBuildToolchain(self) + toolchain.properties["IncludeExternals"] = "true" + toolchain.generate() + else: + self._generate_autotools() + + def _msvc_project_path(self, name): + return os.path.join(self.source_folder, "PCBuild", f"{name}.vcxproj") + + def _regex_replace_in_file(self, filename, pattern, replacement): + content = load(self, filename) + content = re.sub(pattern, replacement, content) + save(self, filename, content) + + def _inject_conan_props_file(self, project_basename, dep_name, condition=True): + if condition: + search = '' + replace_in_file(self, + self._msvc_project_path(project_basename), + search, + search + f'') + + def _patch_setup_py(self): + setup_py = os.path.join(self.source_folder, "setup.py") + if Version(self.version) < "3.10": + replace_in_file(self, setup_py, ":libmpdec.so.2", "mpdec") + + if self.options.get_safe("with_curses", False): + libcurses = self.dependencies["ncurses"].cpp_info.components["libcurses"] + tinfo = self.dependencies["ncurses"].cpp_info.components["tinfo"] + libs = libcurses.libs + libcurses.system_libs + tinfo.libs + tinfo.system_libs + replace_in_file(self, setup_py, + "curses_libs = ", + "curses_libs = {} #".format(repr(libs))) + + if self._supports_modules: + openssl = self.dependencies["openssl"].cpp_info.aggregated_components() + zlib = self.dependencies["zlib"].cpp_info.aggregated_components() + if Version(self.version) < "3.11": + replace_in_file(self, setup_py, + "openssl_includes = ", + f"openssl_includes = {openssl.includedirs + zlib.includedirs} #") + replace_in_file(self, setup_py, + "openssl_libdirs = ", + f"openssl_libdirs = {openssl.libdirs + zlib.libdirs} #") + replace_in_file(self, setup_py, + "openssl_libs = ", + f"openssl_libs = {openssl.libs + zlib.libs} #") + + if Version(self.version) < "3.11": + replace_in_file(self, setup_py, "if (MACOS and self.detect_tkinter_darwin())", "if (False)") + + def _patch_msvc_projects(self): + # Don't build vendored bz2 + self._regex_replace_in_file(self._msvc_project_path("_bz2"), r'.*Include=\"\$\(bz2Dir\).*', "") + + if self._supports_modules: + # Don't import vendored libffi + replace_in_file(self, self._msvc_project_path("_ctypes"), '', "") + if Version(self.version) < "3.11": + # Don't add this define, it should be added conditionally by the libffi package + replace_in_file(self, self._msvc_project_path("_ctypes"), "FFI_BUILDING;", "") + + # Don't import vendored openssl + replace_in_file(self, self._msvc_project_path("_hashlib"), '', "") + replace_in_file(self, self._msvc_project_path("_ssl"), '', "") + + # For mpdecimal, we need to remove all headers and all c files *except* the main module file, _decimal.c + self._regex_replace_in_file(self._msvc_project_path("_decimal"), r'.*Include=\"\.\.\\Modules\\_decimal\\.*\.h.*', "") + self._regex_replace_in_file(self._msvc_project_path("_decimal"), r'.*Include=\"\.\.\\Modules\\_decimal\\libmpdec\\.*\.c.*', "") + # There is also an assembly file with a complicated build step as part of the mpdecimal build + replace_in_file(self, self._msvc_project_path("_decimal"), "", "-->") + # Remove extra include directory + replace_in_file(self, self._msvc_project_path("_decimal"), r"..\Modules\_decimal\libmpdec;", "") + + # Don't include vendored sqlite3 + replace_in_file(self, self._msvc_project_path("_sqlite3"), + '', + '') + + # Remove hardcoded reference to lzma library + replace_in_file(self, self._msvc_project_path("_lzma"), "$(OutDir)liblzma$(PyDebugExt).lib;", "") + # Don't include vendored lzma + replace_in_file(self, self._msvc_project_path("_lzma"), + '', + '') + + # Don't include vendored expat project + replace_in_file(self, self._msvc_project_path("pyexpat"), + r"$(PySourcePath)Modules\expat;", + "") + # Remove XML_STATIC, this should conditionally be set by the expat library. + # TODO: Why HAVE_EXPAT_H? (It is at least removed in later versions) + replace_in_file(self, self._msvc_project_path("pyexpat"), ("HAVE_EXPAT_H;" if Version(self.version) < "3.11" else "") + "XML_STATIC;", "") + self._regex_replace_in_file(self._msvc_project_path("pyexpat"), r'.*Include=\"\.\.\\Modules\\expat\\.*" />', "") + + # Don't include vendored expat headers + replace_in_file(self, self._msvc_project_path("_elementtree"), + r"..\Modules\expat;", + "") + # Remove XML_STATIC, this should conditionally be set by the expat library. + replace_in_file(self, self._msvc_project_path("_elementtree"), "XML_STATIC;", "") + # Remove vendored expat + self._regex_replace_in_file(self._msvc_project_path("_elementtree"), r'.*Include=\"\.\.\\Modules\\expat\\.*" />', "") + + if Version(self.version) >= "3.9": + # deflate.c has warning 4244 disabled, need special patching else it breaks the regex below + # Add an extra space to avoid being picked up by the regex + replace_in_file(self, self._msvc_project_path("pythoncore"), + r'', + r'') + # Don't use vendored zlib + self._regex_replace_in_file(self._msvc_project_path("pythoncore"), r'.*Include=\"\$\(zlibDir\).*', "") + + # Don't use vendored tcl/tk include dir + replace_in_file(self, self._msvc_project_path("_tkinter"), "$(tcltkDir)include;", "") + # Don't use hardcoded tcl/tk library + replace_in_file(self, self._msvc_project_path("_tkinter"), "$(tcltkLib);", "") + # TODO: Why? + replace_in_file(self, self._msvc_project_path("_tkinter"), + "", + "") + # Don't use vendored tcl/tk + self._regex_replace_in_file(self._msvc_project_path("_tkinter"), r'.*Include=\"\$\(tcltkdir\).*', "") + + # Disable "ValidateUcrtbase" target (TODO: Why?) + replace_in_file(self, self._msvc_project_path("python"), "$(Configuration) != 'PGInstrument'", "False") + + if Version(self.version) < "3.11": + # TODO: Why? + replace_in_file(self, self._msvc_project_path("_freeze_importlib"), + "', + r'') + + self._inject_conan_props_file("_bz2", "bzip2", self.options.get_safe("with_bz2")) + self._inject_conan_props_file("_elementtree", "expat", self._supports_modules) + self._inject_conan_props_file("pyexpat", "expat", self._supports_modules) + self._inject_conan_props_file("_hashlib", "openssl", self._supports_modules) + self._inject_conan_props_file("_ssl", "openssl", self._supports_modules) + self._inject_conan_props_file("_sqlite3", "sqlite3", self.options.get_safe("with_sqlite3")) + self._inject_conan_props_file("_tkinter", "tk", self.options.get_safe("with_tkinter")) + self._inject_conan_props_file("pythoncore", "zlib") + self._inject_conan_props_file("python", "zlib") + self._inject_conan_props_file("pythonw", "zlib") + self._inject_conan_props_file("_ctypes", "libffi", self._supports_modules) + self._inject_conan_props_file("_decimal", "mpdecimal", self._supports_modules) + self._inject_conan_props_file("_lzma", "xz_utils", self.options.get_safe("with_lzma")) + self._inject_conan_props_file("_bsddb", "libdb", self.options.get_safe("with_bsddb")) def _patch_sources(self): - for patch in self.conan_data.get("patches",{}).get(self.version, []): - tools.patch(**patch) - if self._is_py3 and tools.Version(self._version_number_only) < "3.10": - tools.replace_in_file(os.path.join(self._source_subfolder, "setup.py"), - ":libmpdec.so.2", "mpdec") - if self.settings.compiler == "Visual Studio": + apply_conandata_patches(self) + # <=3.10 requires a lot of manual injection of dependencies through setup.py + # 3.12 removes setup.py completely, and uses pkgconfig dependencies + # 3.11 is an in awkward transition state where some dependencies use pkgconfig, and others use setup.py + if Version(self.version) < "3.12": + self._patch_setup_py() + if Version(self.version) >= "3.11": + replace_in_file(self, os.path.join(self.source_folder, "configure"), + 'OPENSSL_LIBS="-lssl -lcrypto"', + 'OPENSSL_LIBS="-lssl -lcrypto -lz"') + if is_msvc(self): runtime_library = { "MT": "MultiThreaded", "MTd": "MultiThreadedDebug", "MD": "MultiThreadedDLL", "MDd": "MultiThreadedDebugDLL", - }[str(self.settings.compiler.runtime)] + }[msvc_runtime_flag(self)] self.output.info("Patching runtime") - tools.replace_in_file(os.path.join(self._source_subfolder, "PCbuild", "pyproject.props"), - "MultiThreadedDLL", runtime_library) - tools.replace_in_file(os.path.join(self._source_subfolder, "PCbuild", "pyproject.props"), - "MultiThreadedDebugDLL", runtime_library) + replace_in_file(self, os.path.join(self.source_folder, "PCbuild", "pyproject.props"), + "MultiThreadedDLL", runtime_library) + replace_in_file(self, os.path.join(self.source_folder, "PCbuild", "pyproject.props"), + "MultiThreadedDebugDLL", runtime_library) # Remove vendored packages - tools.rmdir(os.path.join(self._source_subfolder, "Modules", "_decimal", "libmpdec")) - tools.rmdir(os.path.join(self._source_subfolder, "Modules", "expat")) + rmdir(self, os.path.join(self.source_folder, "Modules", "_decimal", "libmpdec")) + rmdir(self, os.path.join(self.source_folder, "Modules", "expat")) - if self.options.get_safe("with_curses", False): - # FIXME: this will link to ALL libraries of ncurses. Only need to link to ncurses(w) (+ eventually tinfo) - tools.replace_in_file(os.path.join(self._source_subfolder, "setup.py"), - "curses_libs = ", - "curses_libs = {} #".format(repr(self.deps_cpp_info["ncurses"].libs + self.deps_cpp_info["ncurses"].system_libs))) + if Version(self.version) < "3.12": + replace_in_file(self, os.path.join(self.source_folder, "Makefile.pre.in"), + "$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)'", + "$(RUNSHARED) CC='$(CC) $(CONFIGURE_CFLAGS) $(CONFIGURE_CPPFLAGS)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)'") # Enable static MSVC cpython if not self.options.shared: - tools.replace_in_file(os.path.join(self._source_subfolder, "PCbuild", "pythoncore.vcxproj"), - "","Py_NO_BUILD_SHARED;") - tools.replace_in_file(os.path.join(self._source_subfolder, "PCbuild", "pythoncore.vcxproj"), - "Py_ENABLE_SHARED", "Py_NO_ENABLE_SHARED") - tools.replace_in_file(os.path.join(self._source_subfolder, "PCbuild", "pythoncore.vcxproj"), - "DynamicLibrary", "StaticLibrary") - - tools.replace_in_file(os.path.join(self._source_subfolder, "PCbuild", "python.vcxproj"), - "", "shlwapi.lib;ws2_32.lib;pathcch.lib;version.lib;%(AdditionalDependencies)") - tools.replace_in_file(os.path.join(self._source_subfolder, "PCbuild", "python.vcxproj"), - "", "Py_NO_ENABLE_SHARED;") - - tools.replace_in_file(os.path.join(self._source_subfolder, "PCbuild", "pythonw.vcxproj"), - "", "shlwapi.lib;ws2_32.lib;pathcch.lib;version.lib;%(AdditionalDependencies)") - tools.replace_in_file(os.path.join(self._source_subfolder, "PCbuild", "pythonw.vcxproj"), - "", "Py_NO_ENABLE_SHARED;%(PreprocessorDefinitions)") - - def _upgrade_single_project_file(self, project_file): - """ - `devenv /upgrade ` will upgrade *ALL* projects referenced by the project. - By temporarily moving the solution project, only one project is upgraded - This is needed for static cpython or for disabled optional dependencies (e.g. tkinter=False) - Restore it afterwards because it is needed to build some targets. - """ - tools.rename(os.path.join(self._source_subfolder, "PCbuild", "pcbuild.sln"), - os.path.join(self._source_subfolder, "PCbuild", "pcbuild.sln.bak")) - tools.rename(os.path.join(self._source_subfolder, "PCbuild", "pcbuild.proj"), - os.path.join(self._source_subfolder, "PCbuild", "pcbuild.proj.bak")) - with tools.vcvars(self.settings): - self.run("devenv \"{}\" /upgrade".format(project_file), run_environment=True) - tools.rename(os.path.join(self._source_subfolder, "PCbuild", "pcbuild.sln.bak"), - os.path.join(self._source_subfolder, "PCbuild", "pcbuild.sln")) - tools.rename(os.path.join(self._source_subfolder, "PCbuild", "pcbuild.proj.bak"), - os.path.join(self._source_subfolder, "PCbuild", "pcbuild.proj")) + replace_in_file(self, os.path.join(self.source_folder, "PCbuild", "pythoncore.vcxproj"), + "", + "Py_NO_BUILD_SHARED;") + replace_in_file(self, os.path.join(self.source_folder, "PCbuild", "pythoncore.vcxproj"), + "Py_ENABLE_SHARED", + "Py_NO_ENABLE_SHARED") + replace_in_file(self, os.path.join(self.source_folder, "PCbuild", "pythoncore.vcxproj"), + "DynamicLibrary", + "StaticLibrary") + + replace_in_file(self, os.path.join(self.source_folder, "PCbuild", "python.vcxproj"), + "", + "shlwapi.lib;ws2_32.lib;pathcch.lib;version.lib;%(AdditionalDependencies)") + replace_in_file(self, os.path.join(self.source_folder, "PCbuild", "python.vcxproj"), + "", + "Py_NO_ENABLE_SHARED;") + + replace_in_file(self, os.path.join(self.source_folder, "PCbuild", "pythonw.vcxproj"), + "", + "shlwapi.lib;ws2_32.lib;pathcch.lib;version.lib;%(AdditionalDependencies)") + replace_in_file(self, os.path.join(self.source_folder, "PCbuild", "pythonw.vcxproj"), + "", + "Py_NO_ENABLE_SHARED;%(PreprocessorDefinitions)") + + conantoolchain_props = os.path.join(self.generators_folder, MSBuildToolchain.filename) + replace_in_file( + self, os.path.join(self.source_folder, "PCbuild", "pythoncore.vcxproj"), + '', + f'', + ) + + if is_msvc(self): + self._patch_msvc_projects() @property def _solution_projects(self): if self.options.shared: - solution_path = os.path.join(self._source_subfolder, "PCbuild", "pcbuild.sln") - projects = set(m.group(1) for m in re.finditer("\"([^\"]+)\\.vcxproj\"", open(solution_path).read())) + solution_path = os.path.join(self.source_folder, "PCbuild", "pcbuild.sln") + projects = set(m.group(1) for m in re.finditer('"([^"]+)\\.vcxproj"', open(solution_path).read())) def project_build(name): if os.path.basename(name) in self._msvc_discarded_projects: @@ -341,39 +484,31 @@ def project_build(name): return False return True - def sort_importance(key): - importance = ( - "pythoncore", # The python library MUST be built first. All modules and executables depend on it - "python", # Build the python executable next (for convenience, when debugging) - ) - try: - return importance.index(key) - except ValueError: - return len(importance) - - projects = sorted((p for p in projects if project_build(p)), key=sort_importance) + projects = list(filter(project_build, projects)) return projects else: - return "pythoncore", "python", "pythonw" + return ["pythoncore", "python", "pythonw"] @property def _msvc_discarded_projects(self): - discarded = {"python_uwp", "pythonw_uwp"} + discarded = { + "python_uwp", + "pythonw_uwp", + "_freeze_importlib", + "sqlite3", + "bdist_wininst", + "liblzma", + "openssl", + "xxlimited", + } if not self.options.with_bz2: discarded.add("bz2") if not self.options.with_sqlite3: discarded.add("_sqlite3") if not self.options.with_tkinter: discarded.add("_tkinter") - if self._is_py2: - # Python 2 Visual Studio projects NOT to build - discarded = discarded.union({"bdist_wininst", "libeay", "ssleay", "sqlite3", "tcl", "tk", "tix"}) - if not self.options.with_bsddb: - discarded.add("_bsddb") - elif self._is_py3: - discarded = discarded.union({"bdist_wininst", "liblzma", "openssl", "sqlite3", "xxlimited"}) - if not self.options.with_lzma: - discarded.add("_lzma") + if not self.options.with_lzma: + discarded.add("_lzma") return discarded @property @@ -381,50 +516,31 @@ def _msvc_archs(self): archs = { "x86": "Win32", "x86_64": "x64", + "armv7": "ARM", + "armv8_32": "ARM", + "armv8": "ARM64", } - if tools.Version(self._version_number_only) >= "3.8": - archs.update({ - "armv7": "ARM", - "armv8_32": "ARM", - "armv8": "ARM64", - }) return archs def _msvc_build(self): msbuild = MSBuild(self) - msbuild_properties = { - "IncludeExternals": "true", - } + msbuild.platform = self._msvc_archs[str(self.settings.arch)] + projects = self._solution_projects - self.output.info("Building {} Visual Studio projects: {}".format(len(projects), projects)) + self.output.info(f"Building {len(projects)} Visual Studio projects: {projects}") - with tools.no_op(): - for project_i, project in enumerate(projects, 1): - self.output.info("[{}/{}] Building project '{}'...".format(project_i, len(projects), project)) - project_file = os.path.join(self._source_subfolder, "PCbuild", project + ".vcxproj") - self._upgrade_single_project_file(project_file) - msbuild.build(project_file, upgrade_project=False, build_type="Debug" if self.settings.build_type == "Debug" else "Release", - platforms=self._msvc_archs, properties=msbuild_properties) + sln = os.path.join(self.source_folder, "PCbuild", "pcbuild.sln") + # FIXME: Solution files do not pick up the toolset automatically. + cmd = msbuild.command(sln, targets=projects) + self.run(f"{cmd} /p:PlatformToolset={msvs_toolset(self)}") def build(self): - # FIXME: these checks belong in validate, but the versions of dependencies are not available there yet - if self._supports_modules: - if tools.Version(self._version_number_only) < "3.8.0": - if tools.Version(self.deps_cpp_info["mpdecimal"].version) >= "2.5.0": - raise ConanInvalidConfiguration("cpython versions lesser then 3.8.0 require a mpdecimal lesser then 2.5.0") - elif tools.Version(self._version_number_only) >= "3.9.0": - if tools.Version(self.deps_cpp_info["mpdecimal"].version) < "2.5.0": - raise ConanInvalidConfiguration("cpython 3.9.0 (and newer) requires (at least) mpdecimal 2.5.0") - - if self._with_libffi: - if tools.Version(self.deps_cpp_info["libffi"].version) >= "3.3" and self.settings.compiler == "Visual Studio" and "d" in str(self.settings.compiler.runtime): - raise ConanInvalidConfiguration("libffi versions >= 3.3 cause 'read access violations' when using a debug runtime (MTd/MDd)") - self._patch_sources() - if self.settings.compiler == "Visual Studio": + if is_msvc(self): self._msvc_build() else: - autotools = self._configure_autotools() + autotools = Autotools(self) + autotools.configure() autotools.make() @property @@ -432,44 +548,40 @@ def _msvc_artifacts_path(self): build_subdir_lut = { "x86_64": "amd64", "x86": "win32", + "armv7": "arm32", + "armv8_32": "arm32", + "armv8": "arm64", } - if tools.Version(self._version_number_only) >= "3.8": - build_subdir_lut.update({ - "armv7": "arm32", - "armv8_32": "arm32", - "armv8": "arm64", - }) - return os.path.join(self._source_subfolder, "PCbuild", build_subdir_lut[str(self.settings.arch)]) + return os.path.join(self.source_folder, "PCbuild", build_subdir_lut[str(self.settings.arch)]) @property def _msvc_install_subprefix(self): return "bin" def _copy_essential_dlls(self): - if self.settings.compiler == "Visual Studio": + if is_msvc(self): # Until MSVC builds support cross building, copy dll's of essential (shared) dependencies to python binary location. # These dll's are required when running the layout tool using the newly built python executable. dest_path = os.path.join(self.build_folder, self._msvc_artifacts_path) - if self._with_libffi: - for bin_path in self.deps_cpp_info["libffi"].bin_paths: - self.copy("*.dll", src=bin_path, dst=dest_path) - for bin_path in self.deps_cpp_info["expat"].bin_paths: - self.copy("*.dll", src=bin_path, dst=dest_path) - for bin_path in self.deps_cpp_info["zlib"].bin_paths: - self.copy("*.dll", src=bin_path, dst=dest_path) + for bin_path in self.dependencies["libffi"].cpp_info.bindirs: + copy(self, "*.dll", src=bin_path, dst=dest_path) + for bin_path in self.dependencies["expat"].cpp_info.bindirs: + copy(self, "*.dll", src=bin_path, dst=dest_path) + for bin_path in self.dependencies["zlib"].cpp_info.bindirs: + copy(self, "*.dll", src=bin_path, dst=dest_path) def _msvc_package_layout(self): self._copy_essential_dlls() install_prefix = os.path.join(self.package_folder, self._msvc_install_subprefix) - tools.mkdir(install_prefix) + mkdir(self, install_prefix) build_path = self._msvc_artifacts_path infix = "_d" if self.settings.build_type == "Debug" else "" # FIXME: if cross building, use a build python executable here - python_built = os.path.join(build_path, "python{}.exe".format(infix)) + python_built = os.path.join(build_path, f"python{infix}.exe") layout_args = [ - os.path.join(self._source_subfolder, "PC", "layout", "main.py"), + os.path.join(self.source_folder, "PC", "layout", "main.py"), "-v", - "-s", self._source_subfolder, + "-s", self.source_folder, "-b", build_path, "--copy", install_prefix, "-p", @@ -481,16 +593,12 @@ def _msvc_package_layout(self): layout_args.append("--include-tcltk") if self.settings.build_type == "Debug": layout_args.append("-d") - python_args = " ".join("\"{}\"".format(a) for a in layout_args) - self.run("{} {}".format(python_built, python_args), run_environment=True) + python_args = " ".join(f'"{a}"' for a in layout_args) + self.run(f"{python_built} {python_args}") - tools.rmdir(os.path.join(self.package_folder, "bin", "tcl")) + rmdir(self, os.path.join(self.package_folder, "bin", "tcl")) - for file in os.listdir(install_prefix): - if re.match("vcruntime.*", file): - os.unlink(os.path.join(install_prefix, file)) - continue - os.unlink(os.path.join(install_prefix, "LICENSE.txt")) + rm(self, "LICENSE.txt", install_prefix) for file in os.listdir(os.path.join(install_prefix, "libs")): if not re.match("python.*", file): os.unlink(os.path.join(install_prefix, "libs", file)) @@ -498,45 +606,130 @@ def _msvc_package_layout(self): def _msvc_package_copy(self): build_path = self._msvc_artifacts_path infix = "_d" if self.settings.build_type == "Debug" else "" - self.copy("*.exe", src=build_path, dst=os.path.join(self.package_folder, self._msvc_install_subprefix)) - self.copy("*.dll", src=build_path, dst=os.path.join(self.package_folder, self._msvc_install_subprefix)) - self.copy("*.pyd", src=build_path, dst=os.path.join(self.package_folder, self._msvc_install_subprefix, "DLLs")) - self.copy("python{}{}.lib".format(self._version_suffix, infix), src=build_path, dst=os.path.join(self.package_folder, self._msvc_install_subprefix, "libs")) - self.copy("*", src=os.path.join(self._source_subfolder, "Include"), dst=os.path.join(self.package_folder, self._msvc_install_subprefix, "include")) - self.copy("pyconfig.h", src=os.path.join(self._source_subfolder, "PC"), dst=os.path.join(self.package_folder, self._msvc_install_subprefix, "include")) - self.copy("*.py", src=os.path.join(self._source_subfolder, "lib"), dst=os.path.join(self.package_folder, self._msvc_install_subprefix, "Lib")) - tools.rmdir(os.path.join(self.package_folder, self._msvc_install_subprefix, "Lib", "test")) + copy(self, "*.exe", + src=build_path, + dst=os.path.join(self.package_folder, self._msvc_install_subprefix)) + copy(self, "*.dll", + src=build_path, + dst=os.path.join(self.package_folder, self._msvc_install_subprefix)) + copy(self, "*.pyd", + src=build_path, + dst=os.path.join(self.package_folder, self._msvc_install_subprefix, "DLLs")) + copy(self, f"python{self._version_suffix}{infix}.lib", + src=build_path, + dst=os.path.join(self.package_folder, self._msvc_install_subprefix, "libs")) + copy(self, "*", + src=os.path.join(self.source_folder, "Include"), + dst=os.path.join(self.package_folder, self._msvc_install_subprefix, "include")) + copy(self, "pyconfig.h", + src=os.path.join(self.source_folder, "PC"), + dst=os.path.join(self.package_folder, self._msvc_install_subprefix, "include")) + copy(self, "*.py", + src=os.path.join(self.source_folder, "lib"), + dst=os.path.join(self.package_folder, self._msvc_install_subprefix, "Lib")) + rmdir(self, os.path.join(self.package_folder, self._msvc_install_subprefix, "Lib", "test")) packages = {} get_name_version = lambda fn: fn.split(".", 2)[:2] - whldir = os.path.join(self._source_subfolder, "Lib", "ensurepip", "_bundled") + whldir = os.path.join(self.source_folder, "Lib", "ensurepip", "_bundled") for fn in filter(lambda n: n.endswith(".whl"), os.listdir(whldir)): name, version = get_name_version(fn) add = True if name in packages: pname, pversion = get_name_version(packages[name]) - add = tools.Version(version) > tools.Version(pversion) + add = Version(version) > Version(pversion) if add: packages[name] = fn for fname in packages.values(): - tools.unzip(filename=os.path.join(whldir, fname), destination=os.path.join(self.package_folder, "bin", "Lib", "site-packages")) + unzip(self, filename=os.path.join(whldir, fname), + destination=os.path.join(self.package_folder, "bin", "Lib", "site-packages")) + + interpreter_path = os.path.join(build_path, self._cpython_interpreter_name) + lib_dir_path = os.path.join(self.package_folder, self._msvc_install_subprefix, "Lib").replace("\\", "/") + self.run(f"{interpreter_path} -c \"import compileall; compileall.compile_dir('{lib_dir_path}')\"") + + @property + def _exact_lib_name(self): + prefix = "" if self.settings.os == "Windows" else "lib" + if self.settings.os == "Windows": + extension = "lib" + elif not self.options.shared: + extension = "a" + elif is_apple_os(self): + extension = "dylib" + else: + extension = "so" + return f"{prefix}{self._lib_name}.{extension}" + + @property + def _cmake_module_path(self): + if is_msvc(self): + # On Windows, `lib` is for Python modules, `libs` is for compiled objects. + # Usually CMake modules are packaged with the latter. + return os.path.join(self._msvc_install_subprefix, "libs", "cmake") + else: + return os.path.join("lib", "cmake") + + def _write_cmake_findpython_wrapper_file(self): + template = textwrap.dedent(""" + if (DEFINED Python3_VERSION_STRING) + set(_CONAN_PYTHON_SUFFIX "3") + else() + set(_CONAN_PYTHON_SUFFIX "") + endif() + set(Python${_CONAN_PYTHON_SUFFIX}_EXECUTABLE @PYTHON_EXECUTABLE@) + set(Python${_CONAN_PYTHON_SUFFIX}_LIBRARY @PYTHON_LIBRARY@) + + # Fails if these are set beforehand + unset(Python${_CONAN_PYTHON_SUFFIX}_INCLUDE_DIRS) + unset(Python${_CONAN_PYTHON_SUFFIX}_INCLUDE_DIR) + + include(${CMAKE_ROOT}/Modules/FindPython${_CONAN_PYTHON_SUFFIX}.cmake) + + # Sanity check: The former comes from FindPython(3), the latter comes from the injected find module + if(NOT Python${_CONAN_PYTHON_SUFFIX}_VERSION STREQUAL Python${_CONAN_PYTHON_SUFFIX}_VERSION_STRING) + message(FATAL_ERROR "CMake detected wrong cpython version - this is likely a bug with the cpython Conan package") + endif() + + if (TARGET Python${_CONAN_PYTHON_SUFFIX}::Module) + set_target_properties(Python${_CONAN_PYTHON_SUFFIX}::Module PROPERTIES INTERFACE_LINK_LIBRARIES cpython::python) + endif() + if (TARGET Python${_CONAN_PYTHON_SUFFIX}::SABIModule) + set_target_properties(Python${_CONAN_PYTHON_SUFFIX}::SABIModule PROPERTIES INTERFACE_LINK_LIBRARIES cpython::python) + endif() + if (TARGET Python${_CONAN_PYTHON_SUFFIX}::Python) + set_target_properties(Python${_CONAN_PYTHON_SUFFIX}::Python PROPERTIES INTERFACE_LINK_LIBRARIES cpython::embed) + endif() + """) + + # In order for the package to be relocatable, these variables must be relative to the installed CMake file + if is_msvc(self): + python_exe = "${CMAKE_CURRENT_LIST_DIR}/../../" + self._cpython_interpreter_name + python_library = "${CMAKE_CURRENT_LIST_DIR}/../" + self._exact_lib_name + else: + python_exe = "${CMAKE_CURRENT_LIST_DIR}/../../bin/" + self._cpython_interpreter_name + python_library = "${CMAKE_CURRENT_LIST_DIR}/../" + self._exact_lib_name - self.run("{} -c \"import compileall; compileall.compile_dir('{}')\"".format(os.path.join(build_path, self._cpython_interpreter_name), os.path.join(self.package_folder, self._msvc_install_subprefix, "Lib").replace("\\", "/")), - run_environment=True) + cmake_file = os.path.join(self.package_folder, self._cmake_module_path, "use_conan_python.cmake") + content = template.replace("@PYTHON_EXECUTABLE@", python_exe).replace("@PYTHON_LIBRARY@", python_library) + save(self, cmake_file, content) def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - if self.settings.compiler == "Visual Studio": - if self._is_py2 or not self.options.shared: - self._msvc_package_copy() - else: + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + if is_msvc(self): + if self.options.shared: self._msvc_package_layout() - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), "vcruntime*") + else: + self._msvc_package_copy() + rm(self, "vcruntime*", os.path.join(self.package_folder, "bin"), recursive=True) else: - 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")) + autotools = Autotools(self) + if is_apple_os(self): + # FIXME: See https://github.com/python/cpython/issues/109796, this workaround is mentioned there + autotools.make(target="sharedinstall", args=["DESTDIR="]) + autotools.install(args=["DESTDIR="]) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) # Rewrite shebangs of python scripts for filename in os.listdir(os.path.join(self.package_folder, "bin")): @@ -550,23 +743,25 @@ def package(self): if not(firstline.startswith(b"#!") and b"/python" in firstline and b"/bin/sh" not in firstline): continue text = fn.read() - self.output.info("Rewriting shebang of {}".format(filename)) + self.output.info(f"Rewriting shebang of {filename}") with open(filepath, "wb") as fn: - fn.write(textwrap.dedent("""\ + fn.write(textwrap.dedent(f"""\ #!/bin/sh ''':' __file__="$0" while [ -L "$__file__" ]; do __file__="$(dirname "$__file__")/$(readlink "$__file__")" done - exec "$(dirname "$__file__")/python{}" "$0" "$@" + exec "$(dirname "$__file__")/python{self._version_suffix}" "$0" "$@" ''' - """.format(self._version_suffix)).encode()) + """).encode()) fn.write(text) if not os.path.exists(self._cpython_symlink): - os.symlink("python{}".format(self._version_suffix), self._cpython_symlink) - self._fix_install_name() + os.symlink(f"python{self._version_suffix}", self._cpython_symlink) + fix_apple_shared_install_name(self) + + self._write_cmake_findpython_wrapper_file() @property def _cpython_symlink(self): @@ -577,14 +772,12 @@ def _cpython_symlink(self): @property def _cpython_interpreter_name(self): - if self.settings.compiler == "Visual Studio": - suffix = "" - else: - suffix = self._version_suffix - python = "python{}".format(suffix) - if self.settings.compiler == "Visual Studio": + python = "python" + if is_msvc(self): if self.settings.build_type == "Debug": python += "_d" + else: + python += self._version_suffix if self.settings.os == "Windows": python += ".exe" return python @@ -596,79 +789,71 @@ def _cpython_interpreter_path(self): @property def _abi_suffix(self): res = "" - if self._is_py3: - if self.settings.build_type == "Debug": - res += "d" - if tools.Version(self._version_number_only) < "3.8": - if self.options.get_safe("pymalloc", False): - res += "m" + if self.settings.build_type == "Debug": + res += "d" return res @property def _lib_name(self): - if self.settings.compiler == "Visual Studio": + if is_msvc(self): if self.settings.build_type == "Debug": lib_ext = "_d" else: lib_ext = "" else: - lib_ext = self._abi_suffix + (".dll.a" if self.options.shared and self.settings.os == "Windows" else "") - return "python{}{}".format(self._version_suffix, lib_ext) - - def _fix_install_name(self): - if tools.is_apple_os(self.settings.os) and self.options.shared: - buffer = StringIO() - python = os.path.join(self.package_folder, "bin", "python") - self.run('otool -L "%s"' % python, output=buffer) - lines = buffer.getvalue().strip().split('\n')[1:] - for line in lines: - library = line.split()[0] - if library.startswith(self.package_folder): - new = library.replace(self.package_folder, "@executable_path/..") - self.output.info("patching {}, replace {} with {}".format(python, library, new)) - self.run("install_name_tool -change {} {} {}".format(library, new, python)) + lib_ext = self._abi_suffix + return f"python{self._version_suffix}{lib_ext}" def package_info(self): - # FIXME: conan components Python::Interpreter component, need a target type - # self.cpp_info.names["cmake_find_package"] = "Python" - # self.cpp_info.names["cmake_find_package_multi"] = "Python" - # FIXME: conan components need to generate multiple .pc files (python2, python-27) - - py_version = tools.Version(self._version_number_only) + py_version = Version(self.version) # python component: "Build a C extension for Python" - if self.settings.compiler == "Visual Studio": + if is_msvc(self): self.cpp_info.components["python"].includedirs = [os.path.join(self._msvc_install_subprefix, "include")] libdir = os.path.join(self._msvc_install_subprefix, "libs") else: - self.cpp_info.components["python"].includedirs.append(os.path.join("include", "python{}{}".format(self._version_suffix, self._abi_suffix))) + self.cpp_info.components["python"].includedirs.append( + os.path.join("include", f"python{self._version_suffix}{self._abi_suffix}") + ) libdir = "lib" if self.options.shared: self.cpp_info.components["python"].defines.append("Py_ENABLE_SHARED") else: self.cpp_info.components["python"].defines.append("Py_NO_ENABLE_SHARED") - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["python"].system_libs.extend(["dl", "m", "pthread", "util"]) elif self.settings.os == "Windows": - self.cpp_info.components["python"].system_libs.extend(["pathcch", "shlwapi", "version", "ws2_32"]) + self.cpp_info.components["python"].system_libs.extend( + ["pathcch", "shlwapi", "version", "ws2_32"] + ) self.cpp_info.components["python"].requires = ["zlib::zlib"] if self.settings.os != "Windows": self.cpp_info.components["python"].requires.append("libxcrypt::libxcrypt") - self.cpp_info.components["python"].names["pkg_config"] = "python-{}.{}".format(py_version.major, py_version.minor) + self.cpp_info.components["python"].set_property( + "pkg_config_name", f"python-{py_version.major}.{py_version.minor}" + ) + self.cpp_info.components["python"].set_property( + "pkg_config_aliases", [f"python{py_version.major}"] + ) self.cpp_info.components["python"].libdirs = [] - self.cpp_info.components["_python_copy"].names["pkg_config"] = "python{}".format(py_version.major) - self.cpp_info.components["_python_copy"].requires = ["python"] - self.cpp_info.components["_python_copy"].libdirs = [] - # embed component: "Embed Python into an application" self.cpp_info.components["embed"].libs = [self._lib_name] self.cpp_info.components["embed"].libdirs = [libdir] - self.cpp_info.components["embed"].names["pkg_config"] = "python-{}.{}-embed".format(py_version.major, py_version.minor) + self.cpp_info.components["embed"].includedirs = [] + self.cpp_info.components["embed"].set_property( + "pkg_config_name", f"python-{py_version.major}.{py_version.minor}-embed" + ) + self.cpp_info.components["embed"].set_property( + "pkg_config_aliases", [f"python{py_version.major}-embed"] + ) self.cpp_info.components["embed"].requires = ["python"] - self.cpp_info.components["_embed_copy"].requires = ["embed"] - self.cpp_info.components["_embed_copy"].names["pkg_config"] = ["python{}-embed".format(py_version.major)] - self.cpp_info.components["_embed_copy"].libdirs = [] + # Transparent integration with CMake's FindPython(3) + self.cpp_info.set_property("cmake_file_name", "Python3") + self.cpp_info.set_property("cmake_module_file_name", "Python") + self.cpp_info.set_property("cmake_find_mode", "both") + self.cpp_info.set_property("cmake_build_modules", [os.path.join(self._cmake_module_path, "use_conan_python.cmake")]) + self.cpp_info.builddirs = [self._cmake_module_path] if self._supports_modules: # hidden components: the C extensions of python are built as dynamically loaded shared libraries. @@ -677,12 +862,11 @@ def package_info(self): "openssl::openssl", "expat::expat", "mpdecimal::mpdecimal", + "libffi::libffi", ] - if self._with_libffi: - self.cpp_info.components["_hidden"].requires.append("libffi::libffi") if self.settings.os != "Windows": - if not tools.is_apple_os(self.settings.os): - self.cpp_info.components["_hidden"].requires.append("libuuid::libuuid") + if not is_apple_os(self): + self.cpp_info.components["_hidden"].requires.append("util-linux-libuuid::util-linux-libuuid") self.cpp_info.components["_hidden"].requires.append("libxcrypt::libxcrypt") if self.options.with_bz2: self.cpp_info.components["_hidden"].requires.append("bzip2::bzip2") @@ -692,47 +876,68 @@ def package_info(self): self.cpp_info.components["_hidden"].requires.append("sqlite3::sqlite3") if self.options.get_safe("with_curses", False): self.cpp_info.components["_hidden"].requires.append("ncurses::ncurses") - if self.options.get_safe("with_bsddb"): - self.cpp_info.components["_hidden"].requires.append("libdb::libdb") if self.options.get_safe("with_lzma"): self.cpp_info.components["_hidden"].requires.append("xz_utils::xz_utils") if self.options.get_safe("with_tkinter"): self.cpp_info.components["_hidden"].requires.append("tk::tk") + self.cpp_info.components["_hidden"].includedirs = [] self.cpp_info.components["_hidden"].libdirs = [] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["_hidden"].system_libs.append("nsl") if self.options.env_vars: bindir = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bindir)) + self.runenv_info.append_path("PATH", bindir) + self.buildenv_info.append_path("PATH", bindir) + + # TODO remove once Conan 1.x is no longer supported + self.output.info(f"Appending PATH environment variable: {bindir}") self.env_info.PATH.append(bindir) python = self._cpython_interpreter_path + self.conf_info.define("user.cpython:python", python) self.user_info.python = python if self.options.env_vars: - self.output.info("Setting PYTHON environment variable: {}".format(python)) + self.runenv_info.append_path("PYTHON", python) + self.buildenv_info.append_path("PYTHON", python) + + # TODO remove once Conan 1.x is no longer supported + self.output.info(f"Appending PYTHON environment variable: {python}") self.env_info.PYTHON = python - if self.settings.compiler == "Visual Studio": + if is_msvc(self): pythonhome = os.path.join(self.package_folder, "bin") - elif tools.is_apple_os(self.settings.os): - pythonhome = self.package_folder else: - version = tools.Version(self._version_number_only) - pythonhome = os.path.join(self.package_folder, "lib", "python{}.{}".format(version.major, version.minor)) + pythonhome = self.package_folder + self.conf_info.define("user.cpython:pythonhome", pythonhome) self.user_info.pythonhome = pythonhome - pythonhome_required = self.settings.compiler == "Visual Studio" or tools.is_apple_os(self.settings.os) + pythonhome_required = is_msvc(self) or is_apple_os(self) + self.conf_info.define("user.cpython:module_requires_pythonhome", pythonhome_required) self.user_info.module_requires_pythonhome = pythonhome_required - if self.settings.compiler == "Visual Studio": + if is_msvc(self): if self.options.env_vars: - self.output.info("Setting PYTHONHOME environment variable: {}".format(pythonhome)) + # FIXME: On Windows, defining this breaks the packaged Python executable, but fixes + # separately built executables with an embedded interpreter trying to run standard Python + # modules. However, NOT defining this reverses the situation, normal Python executables + #work, but embedded interpreters break. + # The docs at https://python.readthedocs.io/en/latest/using/cmdline.html#envvar-PYTHONHOME + # seem to not be accurate to Windows (https://discuss.python.org/t/the-document-on-pythonhome-might-be-wrong/19614/5) + #self.runenv_info.append_path("PYTHONHOME", pythonhome) + #self.buildenv_info.append_path("PYTHONHOME", pythonhome) + + # TODO remove once Conan 1.x is no longer supported + self.output.info(f"Setting PYTHONHOME environment variable: {pythonhome}") self.env_info.PYTHONHOME = pythonhome - if self._is_py2: - python_root = "" - else: - python_root = self.package_folder - if self.options.env_vars: - self.output.info("Setting PYTHON_ROOT environment variable: {}".format(python_root)) - self.env_info.PYTHON_ROOT = python_root + python_root = self.package_folder + if self.options.env_vars: + self.runenv_info.append_path("PYTHON_ROOT", python_root) + self.buildenv_info.append_path("PYTHON_ROOT", python_root) + + # TODO remove once Conan 1.x is no longer supported + self.output.info(f"Setting PYTHON_ROOT environment variable: {python_root}") + self.env_info.PYTHON_ROOT = python_root + self.conf_info.define("user.cpython:python_root", python_root) self.user_info.python_root = python_root diff --git a/recipes/cpython/all/patches/2.7.18-0001-msvc.patch b/recipes/cpython/all/patches/2.7.18-0001-msvc.patch deleted file mode 100644 index 2c101049df531..0000000000000 --- a/recipes/cpython/all/patches/2.7.18-0001-msvc.patch +++ /dev/null @@ -1,278 +0,0 @@ ---- PCbuild/_bsddb.vcxproj -+++ PCbuild/_bsddb.vcxproj -@@ -46,7 +46,7 @@ - NotSet - - -- -+ - - .pyd - -@@ -75,7 +75,7 @@ - - - -- -+ - - - ---- PCbuild/_hashlib.vcxproj -+++ PCbuild/_hashlib.vcxproj -@@ -45,7 +45,7 @@ - DynamicLibrary - NotSet - -- -+ - - .pyd - -@@ -64,7 +64,7 @@ - $(opensslIncludeDir);%(AdditionalIncludeDirectories) - - -- ws2_32.lib;$(OutDir)libeay$(PyDebugExt).lib;$(OutDir)ssleay$(PyDebugExt).lib;%(AdditionalDependencies) -+ ws2_32.lib;%(AdditionalDependencies) - - - -@@ -75,14 +75,14 @@ - {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} - false - -- -+ - - - ---- PCbuild/_sqlite3.vcxproj -+++ PCbuild/_sqlite3.vcxproj -@@ -45,7 +45,7 @@ - DynamicLibrary - NotSet - -- -+ - - .pyd - -@@ -96,10 +96,10 @@ - {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} - false - -- -+ - - - ---- PCbuild/_ssl.vcxproj -+++ PCbuild/_ssl.vcxproj -@@ -45,7 +45,7 @@ - DynamicLibrary - NotSet - -- -+ - - .pyd - -@@ -64,7 +64,7 @@ - $(opensslIncludeDir);%(AdditionalIncludeDirectories) - - -- ws2_32.lib;crypt32.lib;$(OutDir)libeay$(PyDebugExt).lib;$(OutDir)ssleay$(PyDebugExt).lib;%(AdditionalDependencies) -+ ws2_32.lib;crypt32.lib;%(AdditionalDependencies) - - - -@@ -75,14 +75,14 @@ - {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} - false - -- -+ - - {86937f53-c189-40ef-8ce8-8759d8e7d480} - false ---- PCbuild/bz2.vcxproj -+++ PCbuild/bz2.vcxproj -@@ -47,7 +47,7 @@ - NotSet - - -- -+ - - .pyd - -@@ -72,13 +72,13 @@ - - - -- -+ - - - ---- PCbuild/_elementtree.vcxproj -+++ PCbuild/_elementtree.vcxproj -@@ -45,7 +45,7 @@ - DynamicLibrary - NotSet - -- -+ - - .pyd - -@@ -61,15 +61,15 @@ - - - -- ..\Modules\expat;%(AdditionalIncludeDirectories) -- _CRT_SECURE_NO_WARNINGS;USE_PYEXPAT_CAPI;XML_STATIC;%(PreprocessorDefinitions) -+ %(AdditionalIncludeDirectories) -+ _CRT_SECURE_NO_WARNINGS;USE_PYEXPAT_CAPI;%(PreprocessorDefinitions) - - - 0x1D100000 - - - -- -+ - - - -- -+ - - - ---- PCbuild/pyexpat.vcxproj -+++ PCbuild/pyexpat.vcxproj -@@ -45,7 +45,7 @@ - DynamicLibrary - NotSet - -- -+ - - .pyd - -@@ -58,19 +58,19 @@ - - - -- $(PySourcePath)Modules\expat;%(AdditionalIncludeDirectories) -- _CRT_SECURE_NO_WARNINGS;PYEXPAT_EXPORTS;XML_STATIC;%(PreprocessorDefinitions) -+ %(AdditionalIncludeDirectories) -+ _CRT_SECURE_NO_WARNINGS;PYEXPAT_EXPORTS;%(PreprocessorDefinitions) - - - -- -- -+ - - - -- -+ - - - ---- PCbuild/_tkinter.vcxproj -+++ PCbuild/_tkinter.vcxproj -@@ -45,7 +45,7 @@ - DynamicLibrary - NotSet - -- -+ - - .pyd - -@@ -61,11 +61,11 @@ - - - -- $(tcltkDir)include;%(AdditionalIncludeDirectories) -+ %(AdditionalIncludeDirectories) - WITH_APPINIT;%(PreprocessorDefinitions) - - -- $(tcltkLib);%(AdditionalDependencies) -+ %(AdditionalDependencies) - - - -@@ -77,12 +77,12 @@ - {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} - false - -- -+ - - - diff --git a/recipes/cpython/all/patches/2.7.18-0002-add-support-msvc-14.patch b/recipes/cpython/all/patches/2.7.18-0002-add-support-msvc-14.patch deleted file mode 100644 index 6034410d3d265..0000000000000 --- a/recipes/cpython/all/patches/2.7.18-0002-add-support-msvc-14.patch +++ /dev/null @@ -1,59 +0,0 @@ -Patches from https://bugs.python.org/issue30742 - ---- Modules/posixmodule.c -+++ Modules/posixmodule.c -@@ -563,7 +563,10 @@ typedef struct { - char osfile; - } my_ioinfo; - -+#if _MSC_VER < 1900 // MSVS2013 and lower (https://bugs.python.org/issue30742) - extern __declspec(dllimport) char * __pioinfo[]; -+#endif -+ - #define IOINFO_L2E 5 - #define IOINFO_ARRAY_ELTS (1 << IOINFO_L2E) - #define IOINFO_ARRAYS 64 -@@ -575,6 +578,7 @@ extern __declspec(dllimport) char * __pioinfo[]; - int - _PyVerify_fd(int fd) - { -+#if _MSC_VER < 1900 // MSVS2013 and lower (https://bugs.python.org/issue30742) - const int i1 = fd >> IOINFO_L2E; - const int i2 = fd & ((1 << IOINFO_L2E) - 1); - -@@ -607,6 +611,13 @@ _PyVerify_fd(int fd) - fail: - errno = EBADF; - return 0; -+#else -+ //a call to _get_osfhandle with invalid fd sets errno to EBADF -+ if (_get_osfhandle(fd) == INVALID_HANDLE_VALUE) -+ return 0; -+ else -+ return 1; -+#endif - } - - /* the special case of checking dup2. The target fd must be in a sensible range */ ---- Modules/timemodule.c -+++ Modules/timemodule.c -@@ -803,7 +803,18 @@ inittimezone(PyObject *m) { - - And I'm lazy and hate C so nyer. - */ --#if defined(HAVE_TZNAME) && !defined(__GLIBC__) && !defined(__CYGWIN__) -+#if defined(HAVE_TZNAME) && (_MSC_VER >= 1900) //MSVS2015+ (https://bugs.python.org/issue30742) -+ tzset(); -+ PyModule_AddIntConstant(m, "timezone", _timezone); -+#ifdef HAVE_ALTZONE -+ PyModule_AddIntConstant(m, "altzone", altzone); -+#else -+ PyModule_AddIntConstant(m, "altzone", _timezone - 3600); -+#endif -+ PyModule_AddIntConstant(m, "daylight", _daylight); -+ PyModule_AddObject(m, "tzname", -+ Py_BuildValue("(zz)", _tzname[0], _tzname[1])); -+#elif defined(HAVE_TZNAME) && !defined(__GLIBC__) && !defined(__CYGWIN__) - tzset(); - #ifdef PYOS_OS2 - PyModule_AddIntConstant(m, "timezone", _timezone); diff --git a/recipes/cpython/all/patches/2.7.18-0003-msvc-fix-static.patch b/recipes/cpython/all/patches/2.7.18-0003-msvc-fix-static.patch deleted file mode 100644 index 9eb079402733d..0000000000000 --- a/recipes/cpython/all/patches/2.7.18-0003-msvc-fix-static.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- PC/dl_nt.c -+++ PC/dl_nt.c -@@ -107,5 +107,7 @@ - } - return TRUE; - } -- -+#else -+ULONG_PTR _Py_ActivateActCtx() { return 0; } -+void _Py_DeactivateActCtx(ULONG_PTR cookie) {} - #endif /* Py_ENABLE_SHARED */ diff --git a/recipes/cpython/all/patches/2.7.18-0004-disable-macos-tcltk.patch b/recipes/cpython/all/patches/2.7.18-0004-disable-macos-tcltk.patch deleted file mode 100644 index 5c61acd74bd5c..0000000000000 --- a/recipes/cpython/all/patches/2.7.18-0004-disable-macos-tcltk.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- setup.py -+++ setup.py -@@ -1928,9 +1928,9 @@ - # Rather than complicate the code below, detecting and building - # AquaTk is a separate method. Only one Tkinter will be built on - # Darwin - either AquaTk, if it is found, or X11 based Tk. -- if (host_platform == 'darwin' and -- self.detect_tkinter_darwin(inc_dirs, lib_dirs)): -- return -+ #if (host_platform == 'darwin' and -+ # self.detect_tkinter_darwin(inc_dirs, lib_dirs)): -+ # return - - # Assume we haven't found any of the libraries or include files - # The versions with dots are used on Unix, and the versions without diff --git a/recipes/cpython/all/patches/3.10.0-0001-msvc.patch b/recipes/cpython/all/patches/3.10.0-0001-msvc.patch deleted file mode 100644 index e9b1faf061f3b..0000000000000 --- a/recipes/cpython/all/patches/3.10.0-0001-msvc.patch +++ /dev/null @@ -1,416 +0,0 @@ ---- PCbuild/pcbuild.sln -+++ PCbuild/pcbuild.sln -@@ -58,2 +58,0 @@ --Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sqlite3", "sqlite3.vcxproj", "{A1A295E5-463C-437F-81CA-1F32367685DA}" --EndProject ---- PCbuild/python.vcxproj -+++ PCbuild/python.vcxproj -@@ -120,1 +120,1 @@ -- -+ ---- PCbuild/_freeze_importlib.vcxproj -+++ PCbuild/_freeze_importlib.vcxproj -@@ -151,1 +151,1 @@ -- -+ --> ---- PCbuild/_bz2.vcxproj -+++ PCbuild/_bz2.vcxproj -@@ -71,7 +71,7 @@ - bz2 - Win32Proj - -- -+ - - - DynamicLibrary -@@ -101,17 +101,17 @@ - - - -- -+ - - -- -- -+ - - - ---- PCbuild/_ctypes.vcxproj -+++ PCbuild/_ctypes.vcxproj -@@ -71,7 +71,7 @@ - _ctypes - Win32Proj - -- -+ - - - DynamicLibrary -@@ -86,7 +86,7 @@ - - - -- -+ - - - -@@ -94,7 +94,7 @@ - - - -- FFI_BUILDING;%(PreprocessorDefinitions) -+ %(PreprocessorDefinitions) - - - /EXPORT:DllGetClassObject,PRIVATE /EXPORT:DllCanUnloadNow,PRIVATE %(AdditionalOptions) ---- PCbuild/_decimal.vcxproj -+++ PCbuild/_decimal.vcxproj -@@ -71,7 +71,7 @@ - _decimal - Win32Proj - -- -+ - - - DynamicLibrary -@@ -98,11 +98,11 @@ - CONFIG_32;ANSI;%(PreprocessorDefinitions) - CONFIG_64;ANSI;%(PreprocessorDefinitions) - CONFIG_64;MASM;%(PreprocessorDefinitions) -- ..\Modules\_decimal;..\Modules\_decimal\libmpdec;%(AdditionalIncludeDirectories) -+ ..\Modules\_decimal;%(AdditionalIncludeDirectories) - - - -- -+ - - - -- -+ - - -- -+ - - - ---- PCbuild/_lzma.vcxproj -+++ PCbuild/_lzma.vcxproj -@@ -71,7 +71,7 @@ - lzma - Win32Proj - -- -+ - - - DynamicLibrary -@@ -94,10 +94,10 @@ - - - $(lzmaDir)src/liblzma/api;%(AdditionalIncludeDirectories) -- WIN32;_FILE_OFFSET_BITS=64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;LZMA_API_STATIC;%(PreprocessorDefinitions) -+ $(ConanPreprocessorDefinitions);WIN32;_FILE_OFFSET_BITS=64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;LZMA_API_STATIC;%(PreprocessorDefinitions) - - -- $(OutDir)liblzma$(PyDebugExt).lib;%(AdditionalDependencies) -+ %(AdditionalDependencies) - - - -@@ -111,10 +111,10 @@ - {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} - false - -- -+ - - - ---- PCbuild/_sqlite3.vcxproj -+++ PCbuild/_sqlite3.vcxproj -@@ -74,1 +74,1 @@ -- -+ -@@ -129,4 +129,4 @@ -- -+ ---- PCbuild/pythoncore.vcxproj -+++ PCbuild/pythoncore.vcxproj -@@ -73,1 +73,1 @@ -- -+ -@@ -302,7 +302,7 @@ - - - -- -+ - - - -@@ -496,7 +496,7 @@ - - - -- -+ - - - ---- PCbuild/_hashlib.vcxproj -+++ PCbuild/_hashlib.vcxproj -@@ -71,7 +71,7 @@ - _hashlib - Win32Proj - -- -+ - - - DynamicLibrary -@@ -86,7 +86,7 @@ - - - -- -+ - - - ---- PCbuild/_ssl.vcxproj -+++ PCbuild/_ssl.vcxproj -@@ -71,7 +71,7 @@ - _ssl - Win32Proj - -- -+ - - - DynamicLibrary -@@ -86,7 +86,7 @@ - - - -- -+ - - - -@@ -99,9 +99,9 @@ - - - -- -+ - - - ---- PCbuild/_elementtree.vcxproj -+++ PCbuild/_elementtree.vcxproj -@@ -71,7 +71,7 @@ - _elementtree - Win32Proj - -- -+ - - - DynamicLibrary -@@ -93,12 +93,12 @@ - - - -- ..\Modules\expat;%(AdditionalIncludeDirectories) -- _CRT_SECURE_NO_WARNINGS;USE_PYEXPAT_CAPI;XML_STATIC;%(PreprocessorDefinitions) -+ %(AdditionalIncludeDirectories) -+ _CRT_SECURE_NO_WARNINGS;USE_PYEXPAT_CAPI;%(PreprocessorDefinitions) - - - -- -+ - - - -- -+ - - - ---- PCbuild/pyexpat.vcxproj -+++ PCbuild/pyexpat.vcxproj -@@ -71,7 +71,7 @@ - {D06B6426-4762-44CC-8BAD-D79052507F2F} - pyexpat - -- -+ - - - DynamicLibrary -@@ -90,19 +90,19 @@ - - - -- $(PySourcePath)Modules\expat;%(AdditionalIncludeDirectories) -- _CRT_SECURE_NO_WARNINGS;PYEXPAT_EXPORTS;HAVE_EXPAT_H;XML_STATIC;%(PreprocessorDefinitions) -+ %(AdditionalIncludeDirectories) -+ _CRT_SECURE_NO_WARNINGS;PYEXPAT_EXPORTS;%(PreprocessorDefinitions) - - - -- -- -+ - - - -- -+ - - - ---- PCbuild/_tkinter.vcxproj -+++ PCbuild/_tkinter.vcxproj -@@ -77,7 +77,7 @@ - DynamicLibrary - NotSet - -- -+ - - .pyd - -@@ -93,12 +93,12 @@ - - - -- $(tcltkDir)include;%(AdditionalIncludeDirectories) -+ %(AdditionalIncludeDirectories) - WITH_APPINIT;%(PreprocessorDefinitions) -- Py_TCLTK_DIR="$(tcltkDir.TrimEnd('\').Replace('\', '\\'))";%(PreprocessorDefinitions) -+ - - -- $(tcltkLib);%(AdditionalDependencies) -+ %(AdditionalDependencies) - - - -@@ -108,10 +108,10 @@ - - - -- -+ - - - {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} ---- PCbuild/pcbuild.sln -+++ PCbuild/pcbuild.sln -@@ -9,9 +9,6 @@ - EndProjectSection - EndProject - Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "python", "python.vcxproj", "{B11D750F-CD1F-4A96-85CE-E69A5C5259F9}" -- ProjectSection(ProjectDependencies) = postProject -- {0E9791DB-593A-465F-98BC-681011311618} = {0E9791DB-593A-465F-98BC-681011311618} -- EndProjectSection - EndProject - Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pythoncore", "pythoncore.vcxproj", "{CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}" - EndProject diff --git a/recipes/cpython/all/patches/3.10.0-0004-setup.py-pass-CFLAGS-CPPFLAGS.patch b/recipes/cpython/all/patches/3.10.0-0004-setup.py-pass-CFLAGS-CPPFLAGS.patch deleted file mode 100644 index 0288bdae92ee9..0000000000000 --- a/recipes/cpython/all/patches/3.10.0-0004-setup.py-pass-CFLAGS-CPPFLAGS.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- Makefile.pre.in -+++ Makefile.pre.in -@@ -627,10 +627,10 @@ - *\ -s*|s*) quiet="-q";; \ - *) quiet="";; \ - esac; \ -- echo "$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ -+ echo "$(RUNSHARED) CC='$(CC) $(CONFIGURE_CFLAGS) $(CONFIGURE_CPPFLAGS)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ - _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \ - $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build"; \ -- $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ -+ $(RUNSHARED) CC='$(CC) $(CONFIGURE_CFLAGS) $(CONFIGURE_CPPFLAGS)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ - _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \ - $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build - diff --git a/recipes/cpython/all/patches/3.10.0-0005-disable-macos-tcltk.patch b/recipes/cpython/all/patches/3.10.0-0005-disable-macos-tcltk.patch deleted file mode 100644 index ec23890e0a717..0000000000000 --- a/recipes/cpython/all/patches/3.10.0-0005-disable-macos-tcltk.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- setup.py -+++ setup.py -@@ -2094,8 +2094,8 @@ - # Rather than complicate the code below, detecting and building - # AquaTk is a separate method. Only one Tkinter will be built on - # Darwin - either AquaTk, if it is found, or X11 based Tk. -- if (MACOS and self.detect_tkinter_darwin()): -- return True -+ #if (MACOS and self.detect_tkinter_darwin()): -+ # return True - - # Assume we haven't found any of the libraries or include files - # The versions with dots are used on Unix, and the versions without diff --git a/recipes/cpython/all/patches/3.10.0-0003-_ctypes-ffi.patch b/recipes/cpython/all/patches/3.10/3.10.0-0003-_ctypes-ffi.patch similarity index 100% rename from recipes/cpython/all/patches/3.10.0-0003-_ctypes-ffi.patch rename to recipes/cpython/all/patches/3.10/3.10.0-0003-_ctypes-ffi.patch diff --git a/recipes/cpython/all/patches/3.11/3.11.7-0001-_ctypes-ffi.patch b/recipes/cpython/all/patches/3.11/3.11.7-0001-_ctypes-ffi.patch new file mode 100644 index 0000000000000..65027b60406fd --- /dev/null +++ b/recipes/cpython/all/patches/3.11/3.11.7-0001-_ctypes-ffi.patch @@ -0,0 +1,37 @@ +diff --git a/Modules/_ctypes/cfield.c b/Modules/_ctypes/cfield.c +index 9bdf1db856..799f99e809 100644 +--- a/Modules/_ctypes/cfield.c ++++ b/Modules/_ctypes/cfield.c +@@ -1473,7 +1473,11 @@ P_get(void *ptr, Py_ssize_t size) + return PyLong_FromVoidPtr(*(void **)ptr); + } + +-static struct fielddesc formattable[] = { ++#define FORMATTABLE_SIZE 30 ++static struct fielddesc formattable[FORMATTABLE_SIZE]; ++ ++static void formattable_init(void) { ++struct fielddesc my_formattable[] = { + { 's', s_set, s_get, NULL}, + { 'b', b_set, b_get, NULL}, + { 'B', B_set, B_get, NULL}, +@@ -1510,6 +1514,11 @@ static struct fielddesc formattable[] = { + { 'O', O_set, O_get, NULL}, + { 0, NULL, NULL, NULL}, + }; ++ size_t nb = 1; ++ for (struct fielddesc *pos = my_formattable; pos->code; ++pos, ++nb); ++ if (FORMATTABLE_SIZE < nb) abort(); ++ memcpy(formattable, my_formattable, nb * sizeof(struct fielddesc)); ++} + + /* + Ideas: Implement VARIANT in this table, using 'V' code. +@@ -1597,6 +1606,7 @@ _ctypes_get_fielddesc(const char *fmt) + + if (!initialized) { + initialized = 1; ++ formattable_init(); + _ctypes_init_fielddesc(); + } + diff --git a/recipes/cpython/all/patches/3.12/3.12.1-0001-_ctypes-ffi.patch b/recipes/cpython/all/patches/3.12/3.12.1-0001-_ctypes-ffi.patch new file mode 100644 index 0000000000000..06bb62c5abd9f --- /dev/null +++ b/recipes/cpython/all/patches/3.12/3.12.1-0001-_ctypes-ffi.patch @@ -0,0 +1,37 @@ +diff --git a/Modules/_ctypes/cfield.c b/Modules/_ctypes/cfield.c +index 128506a9ee..ee9ade67b8 100644 +--- a/Modules/_ctypes/cfield.c ++++ b/Modules/_ctypes/cfield.c +@@ -1448,7 +1448,11 @@ P_get(void *ptr, Py_ssize_t size) + return PyLong_FromVoidPtr(*(void **)ptr); + } + +-static struct fielddesc formattable[] = { ++#define FORMATTABLE_SIZE 30 ++static struct fielddesc formattable[FORMATTABLE_SIZE]; ++ ++static void formattable_init(void) { ++struct fielddesc my_formattable[] = { + { 's', s_set, s_get, NULL}, + { 'b', b_set, b_get, NULL}, + { 'B', B_set, B_get, NULL}, +@@ -1485,6 +1489,11 @@ static struct fielddesc formattable[] = { + { 'O', O_set, O_get, NULL}, + { 0, NULL, NULL, NULL}, + }; ++ size_t nb = 1; ++ for (struct fielddesc *pos = my_formattable; pos->code; ++pos, ++nb); ++ if (FORMATTABLE_SIZE < nb) abort(); ++ memcpy(formattable, my_formattable, nb * sizeof(struct fielddesc)); ++} + + /* + Ideas: Implement VARIANT in this table, using 'V' code. +@@ -1572,6 +1581,7 @@ _ctypes_get_fielddesc(const char *fmt) + + if (!initialized) { + initialized = 1; ++ formattable_init(); + _ctypes_init_fielddesc(); + } + diff --git a/recipes/cpython/all/patches/3.12/3.12.1-0002-remove-module-deps.patch b/recipes/cpython/all/patches/3.12/3.12.1-0002-remove-module-deps.patch new file mode 100644 index 0000000000000..1d9d31f011d72 --- /dev/null +++ b/recipes/cpython/all/patches/3.12/3.12.1-0002-remove-module-deps.patch @@ -0,0 +1,50 @@ +diff --git a/PCbuild/pcbuild.sln b/PCbuild/pcbuild.sln +index bdddec60da..f6a30955bf 100644 +--- a/PCbuild/pcbuild.sln ++++ b/PCbuild/pcbuild.sln +@@ -9,45 +9,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution + EndProjectSection + EndProject + Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "python", "python.vcxproj", "{B11D750F-CD1F-4A96-85CE-E69A5C5259F9}" +- ProjectSection(ProjectDependencies) = postProject +- {9E48B300-37D1-11DD-8C41-005056C00008} = {9E48B300-37D1-11DD-8C41-005056C00008} +- {9EC7190A-249F-4180-A900-548FDCF3055F} = {9EC7190A-249F-4180-A900-548FDCF3055F} +- {78D80A15-BD8C-44E2-B49E-1F05B0A0A687} = {78D80A15-BD8C-44E2-B49E-1F05B0A0A687} +- {6901D91C-6E48-4BB7-9FEC-700C8131DF1D} = {6901D91C-6E48-4BB7-9FEC-700C8131DF1D} +- {54B1431F-B86B-4ACB-B28C-88BCF93191D8} = {54B1431F-B86B-4ACB-B28C-88BCF93191D8} +- {F749B822-B489-4CA5-A3AD-CE078F5F338A} = {F749B822-B489-4CA5-A3AD-CE078F5F338A} +- {D06B6426-4762-44CC-8BAD-D79052507F2F} = {D06B6426-4762-44CC-8BAD-D79052507F2F} +- {36D0C52C-DF4E-45D0-8BC7-E294C3ABC781} = {36D0C52C-DF4E-45D0-8BC7-E294C3ABC781} +- {CB435430-EBB1-478B-8F4E-C256F6838F55} = {CB435430-EBB1-478B-8F4E-C256F6838F55} +- {17E1E049-C309-4D79-843F-AE483C264AEA} = {17E1E049-C309-4D79-843F-AE483C264AEA} +- {384C224A-7474-476E-A01B-750EA7DE918C} = {384C224A-7474-476E-A01B-750EA7DE918C} +- {12728250-16EC-4DC6-94D7-E21DD88947F8} = {12728250-16EC-4DC6-94D7-E21DD88947F8} +- {86937F53-C189-40EF-8CE8-8759D8E7D480} = {86937F53-C189-40EF-8CE8-8759D8E7D480} +- {28B5D777-DDF2-4B6B-B34F-31D938813856} = {28B5D777-DDF2-4B6B-B34F-31D938813856} +- {31FFC478-7B4A-43E8-9954-8D03E2187E9C} = {31FFC478-7B4A-43E8-9954-8D03E2187E9C} +- {F9D71780-F393-11E0-BE50-0800200C9A66} = {F9D71780-F393-11E0-BE50-0800200C9A66} +- {494BAC80-A60C-43A9-99E7-ACB691CE2C4D} = {494BAC80-A60C-43A9-99E7-ACB691CE2C4D} +- {C6E20F84-3247-4AD6-B051-B073268F73BA} = {C6E20F84-3247-4AD6-B051-B073268F73BA} +- {B244E787-C445-441C-BDF4-5A4F1A3A1E51} = {B244E787-C445-441C-BDF4-5A4F1A3A1E51} +- {18CAE28C-B454-46C1-87A0-493D91D97F03} = {18CAE28C-B454-46C1-87A0-493D91D97F03} +- {13CECB97-4119-4316-9D42-8534019A5A44} = {13CECB97-4119-4316-9D42-8534019A5A44} +- {885D4898-D08D-4091-9C40-C700CFE3FC5A} = {885D4898-D08D-4091-9C40-C700CFE3FC5A} +- {447F05A8-F581-4CAC-A466-5AC7936E207E} = {447F05A8-F581-4CAC-A466-5AC7936E207E} +- {ECC7CEAC-A5E5-458E-BB9E-2413CC847881} = {ECC7CEAC-A5E5-458E-BB9E-2413CC847881} +- {4946ECAC-2E69-4BF8-A90A-F5136F5094DF} = {4946ECAC-2E69-4BF8-A90A-F5136F5094DF} +- {FDB84CBB-2FB6-47C8-A2D6-091E0833239D} = {FDB84CBB-2FB6-47C8-A2D6-091E0833239D} +- {73FCD2BD-F133-46B7-8EC1-144CD82A59D5} = {73FCD2BD-F133-46B7-8EC1-144CD82A59D5} +- {2097F1C1-597C-4167-93E3-656A7D6339B2} = {2097F1C1-597C-4167-93E3-656A7D6339B2} +- {A2697BD3-28C1-4AEC-9106-8B748639FD16} = {A2697BD3-28C1-4AEC-9106-8B748639FD16} +- {900342D7-516A-4469-B1AD-59A66E49A25F} = {900342D7-516A-4469-B1AD-59A66E49A25F} +- {6DAC66D9-E703-4624-BE03-49112AB5AA62} = {6DAC66D9-E703-4624-BE03-49112AB5AA62} +- {0E9791DB-593A-465F-98BC-681011311617} = {0E9791DB-593A-465F-98BC-681011311617} +- {0E9791DB-593A-465F-98BC-681011311618} = {0E9791DB-593A-465F-98BC-681011311618} +- {EB6E69DD-04BF-4543-9B92-49FAABCEAC2E} = {EB6E69DD-04BF-4543-9B92-49FAABCEAC2E} +- {16BFE6F0-22EF-40B5-B831-7E937119EF10} = {16BFE6F0-22EF-40B5-B831-7E937119EF10} +- {FCBE1EF2-E0F0-40B1-88B5-00A35D378742} = {FCBE1EF2-E0F0-40B1-88B5-00A35D378742} +- {A840DDFB-ED50-484B-B527-B32E7CF90FD5} = {A840DDFB-ED50-484B-B527-B32E7CF90FD5} +- EndProjectSection + EndProject + Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pythoncore", "pythoncore.vcxproj", "{CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}" + ProjectSection(ProjectDependencies) = postProject diff --git a/recipes/cpython/all/patches/3.7.9-0001-msvc.patch b/recipes/cpython/all/patches/3.7.9-0001-msvc.patch deleted file mode 100644 index 29be01b13f5b5..0000000000000 --- a/recipes/cpython/all/patches/3.7.9-0001-msvc.patch +++ /dev/null @@ -1,416 +0,0 @@ ---- PCbuild/pcbuild.sln -+++ PCbuild/pcbuild.sln -@@ -58,2 +58,0 @@ --Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sqlite3", "sqlite3.vcxproj", "{A1A295E5-463C-437F-81CA-1F32367685DA}" --EndProject ---- PCbuild/python.vcxproj -+++ PCbuild/python.vcxproj -@@ -85,1 +85,1 @@ -- -+ ---- PCbuild/_freeze_importlib.vcxproj -+++ PCbuild/_freeze_importlib.vcxproj -@@ -110,1 +110,1 @@ -- -+ --> ---- PCbuild/_bz2.vcxproj -+++ PCbuild/_bz2.vcxproj -@@ -39,7 +39,7 @@ - bz2 - Win32Proj - -- -+ - - - DynamicLibrary -@@ -69,17 +69,17 @@ - - - -- -+ - - -- -- -+ - - - ---- PCbuild/_decimal.vcxproj -+++ PCbuild/_decimal.vcxproj -@@ -39,7 +39,7 @@ - _decimal - Win32Proj - -- -+ - - - DynamicLibrary -@@ -64,11 +64,11 @@ - _CRT_SECURE_NO_WARNINGS;MASM;%(PreprocessorDefinitions) - CONFIG_32;PPRO;%(PreprocessorDefinitions) - CONFIG_64;%(PreprocessorDefinitions) -- ..\Modules\_decimal;..\Modules\_decimal\libmpdec;%(AdditionalIncludeDirectories) -+ ..\Modules\_decimal;%(AdditionalIncludeDirectories) - - - -- -+ - - - -- -+ - - -- -+ - - - ---- PCbuild/_elementtree.vcxproj -+++ PCbuild/_elementtree.vcxproj -@@ -39,7 +39,7 @@ - _elementtree - Win32Proj - -- -+ - - - DynamicLibrary -@@ -65,8 +65,8 @@ -- _CRT_SECURE_NO_WARNINGS;USE_PYEXPAT_CAPI;XML_STATIC;%(PreprocessorDefinitions) -+ _CRT_SECURE_NO_WARNINGS;USE_PYEXPAT_CAPI;%(PreprocessorDefinitions) - - - -- -+ - - - -- -+ - - - ---- PCbuild/_lzma.vcxproj -+++ PCbuild/_lzma.vcxproj -@@ -39,7 +39,7 @@ - lzma - Win32Proj - -- -+ - - - DynamicLibrary -@@ -62,10 +62,10 @@ - - - $(lzmaDir)src/liblzma/api;%(AdditionalIncludeDirectories) -- WIN32;_FILE_OFFSET_BITS=64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;LZMA_API_STATIC;%(PreprocessorDefinitions) -+ $(ConanPreprocessorDefinitions);WIN32;_FILE_OFFSET_BITS=64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;LZMA_API_STATIC;%(PreprocessorDefinitions) - - -- $(OutDir)liblzma$(PyDebugExt).lib;%(AdditionalDependencies) -+ %(AdditionalDependencies) - - - -@@ -79,10 +79,10 @@ - {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} - false - -- -+ - - - ---- PCbuild/_sqlite3.vcxproj -+++ PCbuild/_sqlite3.vcxproj -@@ -39,7 +39,7 @@ - _sqlite3 - Win32Proj - -- -+ - - - DynamicLibrary -@@ -95,10 +95,10 @@ - {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} - false - -- -+ - - - ---- PCbuild/openssl.vcxproj -+++ PCbuild/openssl.vcxproj -@@ -74,6 +74,6 @@ nmake - - - -- -+ - - - ---- PCbuild/pyexpat.vcxproj -+++ PCbuild/pyexpat.vcxproj -@@ -39,7 +39,7 @@ - {D06B6426-4762-44CC-8BAD-D79052507F2F} - pyexpat - -- -+ - - - DynamicLibrary -@@ -58,19 +58,19 @@ - - - -- $(PySourcePath)Modules\expat;%(AdditionalIncludeDirectories) -- _CRT_SECURE_NO_WARNINGS;PYEXPAT_EXPORTS;HAVE_EXPAT_H;XML_STATIC;%(PreprocessorDefinitions) -+ %(AdditionalIncludeDirectories) -+ _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - - - -- -- -+ - - - -- -+ - - - ---- PCbuild/pythoncore.vcxproj -+++ PCbuild/pythoncore.vcxproj -@@ -38,7 +38,7 @@ - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} - pythoncore - -- -+ - - - DynamicLibrary -@@ -215,7 +215,7 @@ - - - -- -+ - - - -@@ -409,7 +409,7 @@ - - - -- -+ - - - ---- PCbuild/_hashlib.vcxproj -+++ PCbuild/_hashlib.vcxproj -@@ -39,7 +39,7 @@ - _hashlib - Win32Proj - -- -+ - - - DynamicLibrary -@@ -54,7 +54,7 @@ - - - -- -+ - - - ---- PCbuild/_ssl.vcxproj -+++ PCbuild/_ssl.vcxproj -@@ -39,7 +39,7 @@ - _ssl - Win32Proj - -- -+ - - - DynamicLibrary -@@ -54,7 +54,7 @@ - - - -- -+ - - - -@@ -67,9 +67,9 @@ - - - -- -+ - - - ---- PCbuild/_tkinter.vcxproj -+++ PCbuild/_tkinter.vcxproj -@@ -45,7 +45,7 @@ - DynamicLibrary - NotSet - -- -+ - - .pyd - -@@ -61,12 +61,12 @@ - - - -- $(tcltkDir)include;%(AdditionalIncludeDirectories) -+ %(AdditionalIncludeDirectories) - WITH_APPINIT;%(PreprocessorDefinitions) -- Py_TCLTK_DIR="$(tcltkDir.TrimEnd('\').Replace('\', '\\'))";%(PreprocessorDefinitions) -+ - - -- $(tcltkLib);%(AdditionalDependencies) -+ %(AdditionalDependencies) - - - -@@ -76,10 +76,10 @@ - - - -- -+ - - - {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} ---- PCbuild/pcbuild.sln -+++ PCbuild/pcbuild.sln -@@ -9,9 +9,6 @@ - EndProjectSection - EndProject - Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "python", "python.vcxproj", "{B11D750F-CD1F-4A96-85CE-E69A5C5259F9}" -- ProjectSection(ProjectDependencies) = postProject -- {0E9791DB-593A-465F-98BC-681011311618} = {0E9791DB-593A-465F-98BC-681011311618} -- EndProjectSection - EndProject - Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pythoncore", "pythoncore.vcxproj", "{CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}" - EndProject diff --git a/recipes/cpython/all/patches/3.7.9-0002-setup.py-pass-CFLAGS-CPPFLAGS.patch b/recipes/cpython/all/patches/3.7.9-0002-setup.py-pass-CFLAGS-CPPFLAGS.patch deleted file mode 100644 index 92e44c8ea6ee5..0000000000000 --- a/recipes/cpython/all/patches/3.7.9-0002-setup.py-pass-CFLAGS-CPPFLAGS.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- Makefile.pre.in -+++ Makefile.pre.in -@@ -618,10 +618,10 @@ - *\ -s*|s*) quiet="-q";; \ - *) quiet="";; \ - esac; \ -- echo "$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ -+ echo "$(RUNSHARED) CC='$(CC) $(CONFIGURE_CFLAGS) $(CONFIGURE_CPPFLAGS)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ - _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \ - $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build"; \ -- $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ -+ $(RUNSHARED) CC='$(CC) $(CONFIGURE_CFLAGS) $(CONFIGURE_CPPFLAGS)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ - _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \ - $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build - diff --git a/recipes/cpython/all/patches/3.7.9-0003-disable-macos-tcltk.patch b/recipes/cpython/all/patches/3.7.9-0003-disable-macos-tcltk.patch deleted file mode 100644 index f5ffba2f61232..0000000000000 --- a/recipes/cpython/all/patches/3.7.9-0003-disable-macos-tcltk.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- setup.py -+++ setup.py -@@ -1829,9 +1829,9 @@ - # Rather than complicate the code below, detecting and building - # AquaTk is a separate method. Only one Tkinter will be built on - # Darwin - either AquaTk, if it is found, or X11 based Tk. -- if (host_platform == 'darwin' and -- self.detect_tkinter_darwin(inc_dirs, lib_dirs)): -- return -+ #if (host_platform == 'darwin' and -+ # self.detect_tkinter_darwin(inc_dirs, lib_dirs)): -+ # return - - # Assume we haven't found any of the libraries or include files - # The versions with dots are used on Unix, and the versions without diff --git a/recipes/cpython/all/patches/3.8.12-0001-msvc.patch b/recipes/cpython/all/patches/3.8.12-0001-msvc.patch deleted file mode 100644 index 4e390810d2dde..0000000000000 --- a/recipes/cpython/all/patches/3.8.12-0001-msvc.patch +++ /dev/null @@ -1,431 +0,0 @@ ---- PCbuild/pcbuild.sln -+++ PCbuild/pcbuild.sln -@@ -60,2 +60,0 @@ --Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sqlite3", "sqlite3.vcxproj", "{A1A295E5-463C-437F-81CA-1F32367685DA}" --EndProject ---- PCbuild/python.vcxproj -+++ PCbuild/python.vcxproj -@@ -118,1 +118,1 @@ -- -+ ---- PCbuild/_freeze_importlib.vcxproj -+++ PCbuild/_freeze_importlib.vcxproj -@@ -149,1 +149,1 @@ -- -+ --> ---- PCbuild/_bz2.vcxproj -+++ PCbuild/_bz2.vcxproj -@@ -71,7 +71,7 @@ - bz2 - Win32Proj - -- -+ - - - DynamicLibrary -@@ -101,17 +101,17 @@ - - - -- -+ - - -- -- -+ - - - ---- PCbuild/_ctypes.vcxproj -+++ PCbuild/_ctypes.vcxproj -@@ -71,7 +71,7 @@ - _ctypes - Win32Proj - -- -+ - - - DynamicLibrary -@@ -86,7 +86,7 @@ - - - -- -+ - - - -@@ -94,7 +94,7 @@ - - - -- FFI_BUILDING;%(PreprocessorDefinitions) -+ %(PreprocessorDefinitions) - - - /EXPORT:DllGetClassObject,PRIVATE /EXPORT:DllCanUnloadNow,PRIVATE %(AdditionalOptions) ---- PCbuild/_decimal.vcxproj -+++ PCbuild/_decimal.vcxproj -@@ -71,7 +71,7 @@ - _decimal - Win32Proj - -- -+ - - - DynamicLibrary -@@ -98,11 +98,11 @@ - CONFIG_32;ANSI;%(PreprocessorDefinitions) - CONFIG_64;ANSI;%(PreprocessorDefinitions) - CONFIG_64;%(PreprocessorDefinitions) -- ..\Modules\_decimal;..\Modules\_decimal\libmpdec;%(AdditionalIncludeDirectories) -+ ..\Modules\_decimal;%(AdditionalIncludeDirectories) - - - -- -+ - - - -- -+ - - -- -+ - - - ---- PCbuild/_lzma.vcxproj -+++ PCbuild/_lzma.vcxproj -@@ -71,7 +71,7 @@ - lzma - Win32Proj - -- -+ - - - DynamicLibrary -@@ -94,10 +94,10 @@ - - - $(lzmaDir)src/liblzma/api;%(AdditionalIncludeDirectories) -- WIN32;_FILE_OFFSET_BITS=64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;LZMA_API_STATIC;%(PreprocessorDefinitions) -+ $(ConanPreprocessorDefinitions);WIN32;_FILE_OFFSET_BITS=64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;LZMA_API_STATIC;%(PreprocessorDefinitions) - - -- $(OutDir)liblzma$(PyDebugExt).lib;%(AdditionalDependencies) -+ %(AdditionalDependencies) - - - -@@ -111,10 +111,10 @@ - {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} - false - -- -+ - - - ---- PCbuild/_sqlite3.vcxproj -+++ PCbuild/_sqlite3.vcxproj -@@ -71,7 +71,7 @@ - _sqlite3 - Win32Proj - -- -+ - - - DynamicLibrary -@@ -127,10 +127,10 @@ - {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} - false - -- -+ - - - ---- PCbuild/pythoncore.vcxproj -+++ PCbuild/pythoncore.vcxproj -@@ -70,7 +70,7 @@ - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} - pythoncore - -- -+ - - - DynamicLibrary -@@ -272,7 +272,7 @@ - - - -- -+ - - - -@@ -468,7 +468,7 @@ - - - -- -+ - - - ---- PCbuild/_hashlib.vcxproj -+++ PCbuild/_hashlib.vcxproj -@@ -71,7 +71,7 @@ - _hashlib - Win32Proj - -- -+ - - - DynamicLibrary -@@ -86,7 +86,7 @@ - - - -- -+ - - - ---- PCbuild/_ssl.vcxproj -+++ PCbuild/_ssl.vcxproj -@@ -71,7 +71,7 @@ - _ssl - Win32Proj - -- -+ - - - DynamicLibrary -@@ -86,7 +86,7 @@ - - - -- -+ - - - -@@ -99,9 +99,9 @@ - - - -- -+ - - - ---- PCbuild/_elementtree.vcxproj -+++ PCbuild/_elementtree.vcxproj -@@ -71,7 +71,7 @@ - _elementtree - Win32Proj - -- -+ - - - DynamicLibrary -@@ -93,12 +93,12 @@ - - - -- ..\Modules\expat;%(AdditionalIncludeDirectories) -- _CRT_SECURE_NO_WARNINGS;USE_PYEXPAT_CAPI;XML_STATIC;%(PreprocessorDefinitions) -+ %(AdditionalIncludeDirectories) -+ _CRT_SECURE_NO_WARNINGS;USE_PYEXPAT_CAPI;%(PreprocessorDefinitions) - - - -- -+ - - - -- -+ - - - ---- PCbuild/pyexpat.vcxproj -+++ PCbuild/pyexpat.vcxproj -@@ -71,7 +71,7 @@ - {D06B6426-4762-44CC-8BAD-D79052507F2F} - pyexpat - -- -+ - - - DynamicLibrary -@@ -91,18 +91,18 @@ - - - $(PySourcePath)Modules\expat;%(AdditionalIncludeDirectories) -- _CRT_SECURE_NO_WARNINGS;PYEXPAT_EXPORTS;HAVE_EXPAT_H;XML_STATIC;%(PreprocessorDefinitions) -+ _CRT_SECURE_NO_WARNINGS;PYEXPAT_EXPORTS;HAVE_EXPAT_H;%(PreprocessorDefinitions) - - - -- -- -+ - - - -- -+ - - - ---- PCbuild/_tkinter.vcxproj -+++ PCbuild/_tkinter.vcxproj -@@ -77,7 +77,7 @@ - DynamicLibrary - NotSet - -- -+ - - .pyd - -@@ -93,12 +93,12 @@ - - - -- $(tcltkDir)include;%(AdditionalIncludeDirectories) -+ %(AdditionalIncludeDirectories) - WITH_APPINIT;%(PreprocessorDefinitions) -- Py_TCLTK_DIR="$(tcltkDir.TrimEnd('\').Replace('\', '\\'))";%(PreprocessorDefinitions) -+ - - -- $(tcltkLib);%(AdditionalDependencies) -+ %(AdditionalDependencies) - - - -@@ -108,10 +108,10 @@ - - - -- -+ - - - {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} ---- PCbuild/pcbuild.sln -+++ PCbuild/pcbuild.sln -@@ -9,9 +9,6 @@ - EndProjectSection - EndProject - Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "python", "python.vcxproj", "{B11D750F-CD1F-4A96-85CE-E69A5C5259F9}" -- ProjectSection(ProjectDependencies) = postProject -- {0E9791DB-593A-465F-98BC-681011311618} = {0E9791DB-593A-465F-98BC-681011311618} -- EndProjectSection - EndProject - Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pythoncore", "pythoncore.vcxproj", "{CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}" - EndProject diff --git a/recipes/cpython/all/patches/3.8.12-0003-setup.py-pass-CFLAGS-CPPFLAGS.patch b/recipes/cpython/all/patches/3.8.12-0003-setup.py-pass-CFLAGS-CPPFLAGS.patch deleted file mode 100644 index 21527d0ed307f..0000000000000 --- a/recipes/cpython/all/patches/3.8.12-0003-setup.py-pass-CFLAGS-CPPFLAGS.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- Makefile.pre.in -+++ Makefile.pre.in -@@ -606,10 +606,10 @@ - *\ -s*|s*) quiet="-q";; \ - *) quiet="";; \ - esac; \ -- echo "$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ -+ echo "$(RUNSHARED) CC='$(CC) $(CONFIGURE_CFLAGS) $(CONFIGURE_CPPFLAGS)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ - _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \ - $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build"; \ -- $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ -+ $(RUNSHARED) CC='$(CC) $(CONFIGURE_CFLAGS) $(CONFIGURE_CPPFLAGS)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ - _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \ - $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build - diff --git a/recipes/cpython/all/patches/3.8.12-0004-disable-macos-tcltk.patch b/recipes/cpython/all/patches/3.8.12-0004-disable-macos-tcltk.patch deleted file mode 100644 index 90af822b58070..0000000000000 --- a/recipes/cpython/all/patches/3.8.12-0004-disable-macos-tcltk.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- setup.py -+++ setup.py -@@ -1838,8 +1838,8 @@ - # Rather than complicate the code below, detecting and building - # AquaTk is a separate method. Only one Tkinter will be built on - # Darwin - either AquaTk, if it is found, or X11 based Tk. -- if (MACOS and self.detect_tkinter_darwin()): -- return True -+ #if (MACOS and self.detect_tkinter_darwin()): -+ # return True - - # Assume we haven't found any of the libraries or include files - # The versions with dots are used on Unix, and the versions without diff --git a/recipes/cpython/all/patches/3.8.12-0002-_ctypes-ffi.patch b/recipes/cpython/all/patches/3.8/3.8.12-0002-_ctypes-ffi.patch similarity index 100% rename from recipes/cpython/all/patches/3.8.12-0002-_ctypes-ffi.patch rename to recipes/cpython/all/patches/3.8/3.8.12-0002-_ctypes-ffi.patch diff --git a/recipes/cpython/all/patches/3.9.7-0001-msvc.patch b/recipes/cpython/all/patches/3.9.7-0001-msvc.patch deleted file mode 100644 index fac9247123880..0000000000000 --- a/recipes/cpython/all/patches/3.9.7-0001-msvc.patch +++ /dev/null @@ -1,434 +0,0 @@ ---- PCbuild/pcbuild.sln -+++ PCbuild/pcbuild.sln -@@ -60,2 +60,0 @@ --Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sqlite3", "sqlite3.vcxproj", "{A1A295E5-463C-437F-81CA-1F32367685DA}" --EndProject ---- PCbuild/python.vcxproj -+++ PCbuild/python.vcxproj -@@ -118,1 +118,1 @@ -- -+ ---- PCbuild/_freeze_importlib.vcxproj -+++ PCbuild/_freeze_importlib.vcxproj -@@ -149,1 +149,1 @@ -- -+ --> ---- PCbuild/_bz2.vcxproj -+++ PCbuild/_bz2.vcxproj -@@ -71,7 +71,7 @@ - bz2 - Win32Proj - -- -+ - - - DynamicLibrary -@@ -101,17 +101,17 @@ - - - -- -+ - - -- -- -+ - - - ---- PCbuild/_ctypes.vcxproj -+++ PCbuild/_ctypes.vcxproj -@@ -71,7 +71,7 @@ - _ctypes - Win32Proj - -- -+ - - - DynamicLibrary -@@ -86,7 +86,7 @@ - - - -- -+ - - - -@@ -94,7 +94,7 @@ - - - -- FFI_BUILDING;%(PreprocessorDefinitions) -+ %(PreprocessorDefinitions) - - - /EXPORT:DllGetClassObject,PRIVATE /EXPORT:DllCanUnloadNow,PRIVATE %(AdditionalOptions) ---- PCbuild/_decimal.vcxproj -+++ PCbuild/_decimal.vcxproj -@@ -71,7 +71,7 @@ - _decimal - Win32Proj - -- -+ - - - DynamicLibrary -@@ -98,11 +98,11 @@ - CONFIG_32;ANSI;%(PreprocessorDefinitions) - CONFIG_64;ANSI;%(PreprocessorDefinitions) - CONFIG_64;%(PreprocessorDefinitions) -- ..\Modules\_decimal;..\Modules\_decimal\libmpdec;%(AdditionalIncludeDirectories) -+ ..\Modules\_decimal;%(AdditionalIncludeDirectories) - - - -- -+ - - - -- -+ - - -- -+ - - - ---- PCbuild/_lzma.vcxproj -+++ PCbuild/_lzma.vcxproj -@@ -71,7 +71,7 @@ - lzma - Win32Proj - -- -+ - - - DynamicLibrary -@@ -94,10 +94,10 @@ - - - $(lzmaDir)src/liblzma/api;%(AdditionalIncludeDirectories) -- WIN32;_FILE_OFFSET_BITS=64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;LZMA_API_STATIC;%(PreprocessorDefinitions) -+ $(ConanPreprocessorDefinitions);WIN32;_FILE_OFFSET_BITS=64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;LZMA_API_STATIC;%(PreprocessorDefinitions) - - -- $(OutDir)liblzma$(PyDebugExt).lib;%(AdditionalDependencies) -+ %(AdditionalDependencies) - - - -@@ -111,10 +111,10 @@ - {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} - false - -- -+ - - - ---- PCbuild/_sqlite3.vcxproj -+++ PCbuild/_sqlite3.vcxproj -@@ -71,7 +71,7 @@ - _sqlite3 - Win32Proj - -- -+ - - - DynamicLibrary -@@ -127,10 +127,10 @@ - {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} - false - -- -+ - - - ---- PCbuild/pythoncore.vcxproj -+++ PCbuild/pythoncore.vcxproj -@@ -70,7 +70,7 @@ - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} - pythoncore - -- -+ - - - DynamicLibrary -@@ -295,7 +295,7 @@ - - - -- -+ - - - -@@ -497,7 +497,7 @@ - - - -- -+ - - - ---- PCbuild/_hashlib.vcxproj -+++ PCbuild/_hashlib.vcxproj -@@ -71,7 +71,7 @@ - _hashlib - Win32Proj - -- -+ - - - DynamicLibrary -@@ -86,7 +86,7 @@ - - - -- -+ - - - ---- PCbuild/_ssl.vcxproj -+++ PCbuild/_ssl.vcxproj -@@ -71,7 +71,7 @@ - _ssl - Win32Proj - -- -+ - - - DynamicLibrary -@@ -86,7 +86,7 @@ - - - -- -+ - - - -@@ -99,9 +99,9 @@ - - - -- -+ - - - ---- PCbuild/_elementtree.vcxproj -+++ PCbuild/_elementtree.vcxproj -@@ -71,7 +71,7 @@ - _elementtree - Win32Proj - -- -+ - - - DynamicLibrary -@@ -93,12 +93,12 @@ - - - -- ..\Modules\expat;%(AdditionalIncludeDirectories) -- _CRT_SECURE_NO_WARNINGS;USE_PYEXPAT_CAPI;XML_STATIC;%(PreprocessorDefinitions) -+ %(AdditionalIncludeDirectories) -+ _CRT_SECURE_NO_WARNINGS;USE_PYEXPAT_CAPI;%(PreprocessorDefinitions) - - - -- -+ - - - -- -+ - - - ---- PCbuild/pyexpat.vcxproj -+++ PCbuild/pyexpat.vcxproj -@@ -71,7 +71,7 @@ - {D06B6426-4762-44CC-8BAD-D79052507F2F} - pyexpat - -- -+ - - - DynamicLibrary -@@ -90,19 +90,19 @@ - - - -- $(PySourcePath)Modules\expat;%(AdditionalIncludeDirectories) -- _CRT_SECURE_NO_WARNINGS;PYEXPAT_EXPORTS;HAVE_EXPAT_H;XML_STATIC;%(PreprocessorDefinitions) -+ %(AdditionalIncludeDirectories) -+ _CRT_SECURE_NO_WARNINGS;PYEXPAT_EXPORTS;%(PreprocessorDefinitions) - - - -- -- -+ - - - -- -+ - - - ---- PCbuild/_tkinter.vcxproj -+++ PCbuild/_tkinter.vcxproj -@@ -77,7 +77,7 @@ - DynamicLibrary - NotSet - -- -+ - - .pyd - -@@ -93,12 +93,12 @@ - - - -- $(tcltkDir)include;%(AdditionalIncludeDirectories) -+ %(AdditionalIncludeDirectories) - WITH_APPINIT;%(PreprocessorDefinitions) -- Py_TCLTK_DIR="$(tcltkDir.TrimEnd('\').Replace('\', '\\'))";%(PreprocessorDefinitions) -+ - - -- $(tcltkLib);%(AdditionalDependencies) -+ %(AdditionalDependencies) - - - -@@ -108,10 +108,10 @@ - - - -- -+ - - - {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} ---- PCbuild/pcbuild.sln -+++ PCbuild/pcbuild.sln -@@ -9,9 +9,6 @@ - EndProjectSection - EndProject - Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "python", "python.vcxproj", "{B11D750F-CD1F-4A96-85CE-E69A5C5259F9}" -- ProjectSection(ProjectDependencies) = postProject -- {0E9791DB-593A-465F-98BC-681011311618} = {0E9791DB-593A-465F-98BC-681011311618} -- EndProjectSection - EndProject - Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pythoncore", "pythoncore.vcxproj", "{CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}" - EndProject diff --git a/recipes/cpython/all/patches/3.9.7-0004-setup.py-pass-CFLAGS-CPPFLAGS.patch b/recipes/cpython/all/patches/3.9.7-0004-setup.py-pass-CFLAGS-CPPFLAGS.patch deleted file mode 100644 index 0bec735b3653d..0000000000000 --- a/recipes/cpython/all/patches/3.9.7-0004-setup.py-pass-CFLAGS-CPPFLAGS.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- Makefile.pre.in -+++ Makefile.pre.in -@@ -630,10 +630,10 @@ - *\ -s*|s*) quiet="-q";; \ - *) quiet="";; \ - esac; \ -- echo "$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ -+ echo "$(RUNSHARED) CC='$(CC) $(CONFIGURE_CFLAGS) $(CONFIGURE_CPPFLAGS)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ - _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \ - $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build"; \ -- $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ -+ $(RUNSHARED) CC='$(CC) $(CONFIGURE_CFLAGS) $(CONFIGURE_CPPFLAGS)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ - _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \ - $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build - diff --git a/recipes/cpython/all/patches/3.9.7-0005-disable-macos-tcltk.patch b/recipes/cpython/all/patches/3.9.7-0005-disable-macos-tcltk.patch deleted file mode 100644 index 68a48853b3089..0000000000000 --- a/recipes/cpython/all/patches/3.9.7-0005-disable-macos-tcltk.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- setup.py -+++ setup.py -@@ -1986,8 +1986,8 @@ - # Rather than complicate the code below, detecting and building - # AquaTk is a separate method. Only one Tkinter will be built on - # Darwin - either AquaTk, if it is found, or X11 based Tk. -- if (MACOS and self.detect_tkinter_darwin()): -- return True -+ #if (MACOS and self.detect_tkinter_darwin()): -+ # return True - - # Assume we haven't found any of the libraries or include files - # The versions with dots are used on Unix, and the versions without diff --git a/recipes/cpython/all/patches/3.9.7-0002-_msi-vcxproj.patch b/recipes/cpython/all/patches/3.9/3.9.7-0002-_msi-vcxproj.patch similarity index 100% rename from recipes/cpython/all/patches/3.9.7-0002-_msi-vcxproj.patch rename to recipes/cpython/all/patches/3.9/3.9.7-0002-_msi-vcxproj.patch diff --git a/recipes/cpython/all/patches/3.9.7-0003-_ctypes-ffi.patch b/recipes/cpython/all/patches/3.9/3.9.7-0003-_ctypes-ffi.patch similarity index 100% rename from recipes/cpython/all/patches/3.9.7-0003-_ctypes-ffi.patch rename to recipes/cpython/all/patches/3.9/3.9.7-0003-_ctypes-ffi.patch diff --git a/recipes/cpython/all/patches/3.x-0002-remove-module-deps.patch b/recipes/cpython/all/patches/3.x-0002-remove-module-deps.patch new file mode 100644 index 0000000000000..38a642520abb1 --- /dev/null +++ b/recipes/cpython/all/patches/3.x-0002-remove-module-deps.patch @@ -0,0 +1,10 @@ +--- PCbuild/pcbuild.sln ++++ PCbuild/pcbuild.sln +@@ -9,7 +9,4 @@ + EndProjectSection + EndProject + Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "python", "python.vcxproj", "{B11D750F-CD1F-4A96-85CE-E69A5C5259F9}" +- ProjectSection(ProjectDependencies) = postProject +- {0E9791DB-593A-465F-98BC-681011311618} = {0E9791DB-593A-465F-98BC-681011311618} +- EndProjectSection + EndProject diff --git a/recipes/cpython/all/test_package/CMakeLists.txt b/recipes/cpython/all/test_package/CMakeLists.txt index 525329324757f..68886bdf4d074 100644 --- a/recipes/cpython/all/test_package/CMakeLists.txt +++ b/recipes/cpython/all/test_package/CMakeLists.txt @@ -1,100 +1,21 @@ -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() +find_package(Python3 REQUIRED COMPONENTS Interpreter Development.Module Development.Embed) -set(CACHE PY_VERSION_MAJOR "" CACHE STRING "MAJOR version of python") -set(CACHE PY_VERSION_MAJOR_MINOR "" CACHE STRING "MAJOR.MINOR version of python") -set(CACHE PY_VERSION "" CACHE STRING "Required version of python") -set(CACHE PY_VERSION_SUFFIX "" CACHE STRING "Suffix of python") - -set(Python_ADDITIONAL_VERSIONS ${PY_VERSION}${PY_VERSION_SUFFIX} ${PY_VERSION_MAJOR_MINOR}${PY_VERSION_SUFFIX} ${PY_VERSION_MAJOR}${PY_VERSION_SUFFIX} ${PY_VERSION} ${PY_VERSION_MAJOR_MINOR} ${PY_VERSION_MAJOR}) -message("Using Python_ADDITIONAL_VERSIONS: ${Python_ADDITIONAL_VERSIONS}") - -find_package(PythonInterp REQUIRED) -find_package(PythonLibs REQUIRED) - -string(FIND "${PYTHON_EXECUTABLE}" "${CONAN_CPYTHON_ROOT}" ROOT_SUBPOS) -if(ROOT_SUBPOS EQUAL -1) - message(FATAL_ERROR "found wrong python interpreter: ${PYTHON_EXECUTABLE}") -endif() - -message(STATUS "FindPythonInterp:") -message(STATUS "PYTHON_VERSION_STRING: ${PYTHON_VERSION_STRING}") -message(STATUS "PYTHON_VERSION_MAJOR: ${PYTHON_VERSION_MAJOR}") -message(STATUS "PYTHON_VERSION_MINOR: ${PYTHON_VERSION_MINOR}") -message(STATUS "PYTHON_VERSION_PATCH: ${PYTHON_VERSION_PATCH}") -message(STATUS "=============================================") -message(STATUS "FindPythonLibs:") -message(STATUS "PYTHON_LIBRARIES: ${PYTHON_LIBRARIES}") -message(STATUS "PYTHON_INCLUDE_PATH: ${PYTHON_INCLUDE_PATH} (deprecated)") -message(STATUS "PYTHON_INCLUDE_DIRS: ${PYTHON_INCLUDE_DIRS}") -message(STATUS "PYTHON_DEBUG_LIBRARIES: ${PYTHON_DEBUG_LIBRARIES} (deprecated)") -message(STATUS "PYTHONLIBS_VERSION_STRING: ${PYTHONLIBS_VERSION_STRING}") - -if(NOT PYTHON_VERSION_STRING AND NOT PYTHONLIBS_VERSION_STRING) - message(FATAL_ERROR "Version of python interpreter and libraries not found") -endif() - -if(PYTHON_VERSION_STRING) - if(NOT PYTHON_VERSION_STRING VERSION_EQUAL "${PY_VERSION}") - message("PYTHON_VERSION_STRING does not match PY_VERSION") - message(FATAL_ERROR "CMake detected wrong cpython version") - endif() -endif() - -if(PYTHONLIBS_VERSION_STRING) - if(NOT PYTHONLIBS_VERSION_STRING STREQUAL "${PY_FULL_VERSION}") - message("PYTHONLIBS_VERSION_STRING does not match PY_FULL_VERSION") - message(FATAL_ERROR "CMake detected wrong cpython version") - endif() -endif() +message("Python3_EXECUTABLE: ${Python3_EXECUTABLE}") +message("Python3_INTERPRETER_ID: ${Python3_INTERPRETER_ID}") +message("Python3_VERSION: ${Python3_VERSION}") +message("Python3_INCLUDE_DIRS: ${Python3_INCLUDE_DIRS}") +message("Python3_LIBRARIES: ${Python3_LIBRARIES}") option(BUILD_MODULE "Build python module") - if(BUILD_MODULE) - add_library(spam MODULE "py${PY_VERSION_MAJOR}/test_module.c") - target_include_directories(spam - PRIVATE - ${PYTHON_INCLUDE_DIRS} - ) - target_link_libraries(spam PRIVATE - ${PYTHON_LIBRARIES} - ) - set_property(TARGET spam PROPERTY PREFIX "") + python3_add_library(spam "test_module.c") if(MSVC) - if(CONAN_SETTINGS_BUILD_TYPE STREQUAL "Debug") - set(SUFFIX "_d.pyd") - else() - set(SUFFIX ".pyd") - endif() - set_property(TARGET spam PROPERTY SUFFIX "${SUFFIX}") - endif() - - option(USE_FINDPYTHON_X "Use new-style FindPythonX module") - if(USE_FINDPYTHON_X AND NOT (CMAKE_VERSION VERSION_LESS "3.16")) - # Require CMake 3.16 because this version introduces Python${PY_VERSION_MAJOR}_FIND_ABI - find_package(Python${PY_VERSION_MAJOR} REQUIRED COMPONENTS Interpreter Development) - message("Python${PY_VERSION_MAJOR}_EXECUTABLE: ${Python${PY_VERSION_MAJOR}_EXECUTABLE}") - message("Python${PY_VERSION_MAJOR}_INTERPRETER_ID: ${Python${PY_VERSION_MAJOR}_INTERPRETER_ID}") - message("Python${PY_VERSION_MAJOR}_VERSION: ${Python${PY_VERSION_MAJOR}_VERSION}") - message("Python${PY_VERSION_MAJOR}_INCLUDE_DIRS: ${Python${PY_VERSION_MAJOR}_INCLUDE_DIRS}") - message("Python${PY_VERSION_MAJOR}_LIBRARIES: ${Python${PY_VERSION_MAJOR}_LIBRARIES}") - if(NOT Python${PY_VERSION_MAJOR}_VERSION STREQUAL "${PY_VERSION}") - message("Python_ADDITIONAL_VERSIONS does not match PY_VERSION") - message(FATAL_ERROR "CMake detected wrong cpython version") - endif() - - if(PY_VERSION_MAJOR STREQUAL "2") - python2_add_library(spam2 "py${PY_VERSION_MAJOR}/test_module.c") - elseif(PY_VERSION_MAJOR STREQUAL "3") - python3_add_library(spam2 "py${PY_VERSION_MAJOR}/test_module.c") - else() - message(FATAL_ERROR "Unknown PY_VERSION_MAJOR") - endif() + set_target_properties(spam PROPERTIES DEBUG_POSTFIX "_d") endif() endif() -add_executable(${PROJECT_NAME} "py${PY_VERSION_MAJOR}/test_package.c") -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +add_executable(${PROJECT_NAME} "test_package.c") +target_link_libraries(${PROJECT_NAME} PRIVATE Python3::Python) diff --git a/recipes/cpython/all/test_package/conanfile.py b/recipes/cpython/all/test_package/conanfile.py index 8abc18e4492c5..6f20bfa199e7a 100644 --- a/recipes/cpython/all/test_package/conanfile.py +++ b/recipes/cpython/all/test_package/conanfile.py @@ -1,192 +1,185 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, CMake, tools, RunEnvironment -from conans.errors import ConanException -from io import StringIO import os -import re -import shutil +from io import StringIO +from conan import ConanFile, conan_version +from conan.errors import ConanException +from conan.tools.apple import is_apple_os +from conan.tools.build import can_run +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.env import Environment, VirtualRunEnv +from conan.tools.gnu import AutotoolsDeps +from conan.tools.microsoft import is_msvc, VCVars +from conan.tools.scm import Version -class CmakePython3Abi(object): - def __init__(self, debug, pymalloc, unicode): - self.debug, self.pymalloc, self.unicode = debug, pymalloc, unicode +conan2 = conan_version.major >= 2 - _cmake_lut = { - None: "ANY", - True: "ON", - False: "OFF", - } +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + test_type = "explicit" - @property - def suffix(self): - return "{}{}{}".format( - "d" if self.debug else "", - "m" if self.pymalloc else "", - "u" if self.unicode else "", - ) + def requirements(self): + self.requires(self.tested_reference_str) - @property - def cmake_arg(self): - return ";".join(self._cmake_lut[a] for a in (self.debug, self.pymalloc, self.unicode)) + def build_requirements(self): + # The main recipe does not require CMake, but we test with it. + # The interesting problem that arises here is if you have CMake installed + # with your global pip, then it will fail to run in this test package. + # To avoid that, just add a requirement on CMake. + self.tool_requires("cmake/[>=3.16 <4]") - -class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + def layout(self): + cmake_layout(self) @property - def _py_version(self): - return re.match(r"^([0-9.]+)", self.deps_cpp_info["cpython"].version).group(1) + def _python(self): + if conan2: + return self.dependencies["cpython"].conf_info.get("user.cpython:python", check_type=str) + else: + return self.deps_user_info["cpython"].python - @property - def _pymalloc(self): - return bool("pymalloc" in self.options["cpython"] and self.options["cpython"].pymalloc) + def _cpython_option(self, name): + if conan2: + return self.dependencies["cpython"].options.get_safe(name, False) + else: + try: + return getattr(self.options["cpython"], name, False) + except ConanException: + return False @property - def _cmake_abi(self): - if self._py_version < tools.Version("3.8"): - return CmakePython3Abi( - debug=self.settings.build_type == "Debug", - pymalloc=self._pymalloc, - unicode=False, - ) + def _py_version(self): + if conan2: + return Version(self.dependencies["cpython"].ref.version) else: - return CmakePython3Abi( - debug=self.settings.build_type == "Debug", - pymalloc=False, - unicode=False, - ) + return Version(self.deps_cpp_info["cpython"].version) @property - def _cmake_try_FindPythonX(self): - if self.settings.compiler == "Visual Studio" and self.settings.build_type == "Debug": - return False - return True + def _test_setuptools(self): + # TODO Should we still try to test this? + # https://github.com/python/cpython/pull/101039 + return can_run(self) and self._supports_modules and self._py_version < "3.12" @property def _supports_modules(self): - return self.settings.compiler != "Visual Studio" or self.options["cpython"].shared + return not is_msvc(self) or self._cpython_option("shared") - def build(self): - if not tools.cross_building(self, skip_x64_x86=True): - command = "{} --version".format(self.deps_user_info["cpython"].python) - buffer = StringIO() - self.run(command, output=buffer, ignore_errors=True, run_environment=True) - self.output.info("output: %s" % buffer.getvalue()) - self.run(command, run_environment=True) + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["BUILD_MODULE"] = self._supports_modules + tc.generate() + + deps = CMakeDeps(self) + deps.generate() + + try: + # CMakeToolchain might generate VCVars, but we need it + # unconditionally for the setuptools build. + VCVars(self).generate() + except ConanException: + pass + + # The build also needs access to the run environment to run the python executable + VirtualRunEnv(self).generate(scope="run") + VirtualRunEnv(self).generate(scope="build") + if self._test_setuptools: + # Just for the distutils build + AutotoolsDeps(self).generate(scope="build") + + def build(self): cmake = CMake(self) - py_major = self.deps_cpp_info["cpython"].version.split(".")[0] - cmake.definitions["BUILD_MODULE"] = self._supports_modules - cmake.definitions["PY_VERSION_MAJOR"] = py_major - cmake.definitions["PY_VERSION_MAJOR_MINOR"] = ".".join(self._py_version.split(".")[:2]) - cmake.definitions["PY_FULL_VERSION"] = self.deps_cpp_info["cpython"].version - cmake.definitions["PY_VERSION"] = self._py_version - cmake.definitions["PY_VERSION_SUFFIX"] = self._cmake_abi.suffix - cmake.definitions["PYTHON_EXECUTABLE"] = self.deps_user_info["cpython"].python - cmake.definitions["USE_FINDPYTHON_X".format(py_major)] = self._cmake_try_FindPythonX - cmake.definitions["Python{}_EXECUTABLE".format(py_major)] = self.deps_user_info["cpython"].python - cmake.definitions["Python{}_ROOT_DIR".format(py_major)] = self.deps_cpp_info["cpython"].rootpath - cmake.definitions["Python{}_USE_STATIC_LIBS".format(py_major)] = not self.options["cpython"].shared - cmake.definitions["Python{}_FIND_FRAMEWORK".format(py_major)] = "NEVER" - cmake.definitions["Python{}_FIND_REGISTRY".format(py_major)] = "NEVER" - cmake.definitions["Python{}_FIND_IMPLEMENTATIONS".format(py_major)] = "CPython" - cmake.definitions["Python{}_FIND_STRATEGY".format(py_major)] = "LOCATION" - - if self.settings.compiler != "Visual Studio": - if tools.Version(self._py_version) < tools.Version("3.8"): - cmake.definitions["Python{}_FIND_ABI".format(py_major)] = self._cmake_abi.cmake_arg - - with tools.environment_append(RunEnvironment(self).vars): - cmake.configure() + cmake.configure() cmake.build() - if not tools.cross_building(self, skip_x64_x86=True): - if self._supports_modules: - with tools.vcvars(self.settings) if self.settings.compiler == "Visual Studio" else tools.no_op(): - modsrcfolder = "py2" if tools.Version(self.deps_cpp_info["cpython"].version).major < "3" else "py3" - tools.mkdir(os.path.join(self.build_folder, modsrcfolder)) - for fn in os.listdir(os.path.join(self.source_folder, modsrcfolder)): - shutil.copy(os.path.join(self.source_folder, modsrcfolder, fn), os.path.join(self.build_folder, modsrcfolder, fn)) - shutil.copy(os.path.join(self.source_folder, "setup.py"), os.path.join(self.build_folder, "setup.py")) - env = { - "DISTUTILS_USE_SDK": "1", - "MSSdk": "1" - } - env.update(**AutoToolsBuildEnvironment(self).vars) - with tools.environment_append(env): - setup_args = [ - "{}/setup.py".format(self.source_folder), - # "conan", - # "--install-folder", self.build_folder, - "build", - "--build-base", self.build_folder, - "--build-platlib", os.path.join(self.build_folder, "lib_setuptools"), - ] - if self.settings.build_type == "Debug": - setup_args.append("--debug") - self.run("{} {}".format(self.deps_user_info["cpython"].python, " ".join("\"{}\"".format(a) for a in setup_args)), run_environment=True) + if self._test_setuptools: + os.environ["DISTUTILS_USE_SDK"] = "1" + os.environ["MSSdk"] = "1" + setup_args = [ + os.path.join(self.source_folder, "setup.py"), + "build", + "--build-base", self.build_folder, + "--build-platlib", os.path.join(self.build_folder, "lib_setuptools"), + # Bandaid fix: setuptools places temporary files in a subdirectory of the build folder where the + # entirety of the absolute path up to this folder is appended (with seemingly no way to stop this), + # essentially doubling the path length. This may run into Windows max path lengths, so we give ourselves + # a little bit of wiggle room by making this directory name as short as possible. One of the directory + # names goes from (for example) "temp.win-amd64-3.10-pydebug" to "t", saving us roughly 25 characters. + "--build-temp", "t", + ] + if self.settings.build_type == "Debug": + setup_args.append("--debug") + args = " ".join(f'"{a}"' for a in setup_args) + self.run(f"{self._python} {args}") def _test_module(self, module, should_work): try: - self.run("{} {}/test_package.py -b {} -t {} ".format( - self.deps_user_info["cpython"].python, self.source_folder, self.build_folder, module), run_environment=True) - works = True - except ConanException as e: - works = False - exception = e - if should_work == works: - self.output.info("Result of test was expected.") - else: - if works: - raise ConanException("Module '{}' works, but should not have worked".format(module)) - else: - self.output.warn("Module '{}' does not work, but should have worked".format(module)) - raise exception - - def _cpython_option(self, name): - try: - return getattr(self.options["cpython"], name, False) + self.run(f"{self._python} \"{self.source_folder}/test_package.py\" -b \"{self.build_folder}\" -t {module}", env="conanrun") except ConanException: - return False + if should_work: + self.output.warning(f"Module '{module}' does not work, but should have worked") + raise + self.output.info("Module failed as expected") + return + if not should_work: + raise ConanException(f"Module '{module}' works, but should not have worked") + self.output.info("Module worked as expected") def test(self): - if not tools.cross_building(self, skip_x64_x86=True): - self.run("{} -c \"print('hello world')\"".format(self.deps_user_info["cpython"].python), run_environment=True) + if can_run(self): + self.run(f"{self._python} --version", env="conanrun") + + self.run(f"{self._python} -c \"print('hello world')\"", env="conanrun") buffer = StringIO() - self.run("{} -c \"import sys; print('.'.join(str(s) for s in sys.version_info[:3]))\"".format(self.deps_user_info["cpython"].python), run_environment=True, output=buffer) + self.run(f"{self._python} -c \"import sys; print('.'.join(str(s) for s in sys.version_info[:3]))\"", buffer, env="conanrun") self.output.info(buffer.getvalue()) version_detected = buffer.getvalue().splitlines()[-1].strip() if self._py_version != version_detected: - raise ConanException("python reported wrong version. Expected {exp}. Got {res}.".format(exp=self._py_version, res=version_detected)) + raise ConanException( + f"python reported wrong version. Expected {self._py_version}. Got {version_detected}." + ) if self._supports_modules: self._test_module("gdbm", self._cpython_option("with_gdbm")) self._test_module("bz2", self._cpython_option("with_bz2")) - self._test_module("bsddb", self._cpython_option("with_bsddb")) self._test_module("lzma", self._cpython_option("with_lzma")) self._test_module("tkinter", self._cpython_option("with_tkinter")) - with tools.environment_append({"TERM": "ansi"}): - self._test_module("curses", self._cpython_option("with_curses")) - + os.environ["TERM"] = "ansi" + self._test_module("curses", self._cpython_option("with_curses")) self._test_module("expat", True) - self._test_module("sqlite3", True) + self._test_module("sqlite3", self._cpython_option("with_sqlite3")) self._test_module("decimal", True) self._test_module("ctypes", True) - - if tools.is_apple_os(self.settings.os) and not self.options["cpython"].shared: - self.output.info("Not testing the module, because these seem not to work on apple when cpython is built as a static library") + env = Environment() + if self.settings.os != "Windows": + env.define_path("OPENSSL_CONF", os.path.join(os.sep, "dev", "null")) + with env.vars(self).apply(): + self._test_module("ssl", True) + + if is_apple_os(self) and not self._cpython_option("shared"): + self.output.info( + "Not testing the module, because these seem not to work on apple when cpython is built as" + " a static library" + ) # FIXME: find out why cpython on apple does not allow to use modules linked against a static python else: if self._supports_modules: - with tools.environment_append({"PYTHONPATH": [os.path.join(self.build_folder, "lib")]}): - self.output.info("Testing module (spam) using cmake built module") - self._test_module("spam", True) + os.environ["PYTHONPATH"] = os.path.join(self.build_folder, self.cpp.build.libdirs[0]) + self.output.info("Testing module (spam) using cmake built module") + self._test_module("spam", True) - with tools.environment_append({"PYTHONPATH": [os.path.join(self.build_folder, "lib_setuptools")]}): + if self._test_setuptools: + os.environ["PYTHONPATH"] = os.path.join(self.build_folder, "lib_setuptools") self.output.info("Testing module (spam) using setup.py built module") self._test_module("spam", True) - # MSVC builds need PYTHONHOME set. - with tools.environment_append({"PYTHONHOME": self.deps_user_info["cpython"].pythonhome}) if self.deps_user_info["cpython"].module_requires_pythonhome == "True" else tools.no_op(): - self.run(os.path.join("bin", "test_package"), run_environment=True) + del os.environ["PYTHONPATH"] + + # MSVC builds need PYTHONHOME set. Linux and Mac don't require it to be set if tested after building, + # but if the package is relocated then it needs to be set. + if conan2: + os.environ["PYTHONHOME"] = self.dependencies["cpython"].conf_info.get("user.cpython:pythonhome", check_type=str) + else: + os.environ["PYTHONHOME"] = self.deps_user_info["cpython"].pythonhome + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cpython/all/test_package/py2/test_module.c b/recipes/cpython/all/test_package/py2/test_module.c deleted file mode 100644 index 9c5af39ab391b..0000000000000 --- a/recipes/cpython/all/test_package/py2/test_module.c +++ /dev/null @@ -1,42 +0,0 @@ -#include - -#include - -static PyObject *SpamError; - -static PyObject * -spam_system(PyObject *self, PyObject *args) -{ - const char *command; - int sts; - - if (!PyArg_ParseTuple(args, "s", &command)) - return NULL; - sts = system(command); - if (sts < 0) { - PyErr_SetString(SpamError, "System command failed"); - return NULL; - } - return PyLong_FromLong(sts); -} - -const char spam_doc[] = "This is an example spam doc."; - -static PyMethodDef SpamMethods[] = { - {"system", spam_system, METH_VARARGS, "Execute a shell command."}, - {NULL, NULL, 0, NULL} /* Sentinel */ -}; - -PyMODINIT_FUNC -initspam(void) -{ - PyObject *m; - - m = Py_InitModule("spam", SpamMethods); - if (m == NULL) - return; - PyModule_AddStringConstant(m, "__doc__", spam_doc); - SpamError = PyErr_NewException("spam.error", NULL, NULL); - Py_INCREF(SpamError); - PyModule_AddObject(m, "error", SpamError); -} diff --git a/recipes/cpython/all/test_package/py2/test_package.c b/recipes/cpython/all/test_package/py2/test_package.c deleted file mode 100644 index 5e5d839b5a6a1..0000000000000 --- a/recipes/cpython/all/test_package/py2/test_package.c +++ /dev/null @@ -1,12 +0,0 @@ -#include - -int -main(int argc, char *argv[]) -{ - Py_SetProgramName(argv[0]); /* optional but recommended */ - Py_Initialize(); - PyRun_SimpleString("from time import time,ctime\n" - "print 'Today is',ctime(time())\n"); - Py_Finalize(); - return 0; -} diff --git a/recipes/cpython/all/test_package/py3/test_package.c b/recipes/cpython/all/test_package/py3/test_package.c deleted file mode 100644 index f5dfe41cd757c..0000000000000 --- a/recipes/cpython/all/test_package/py3/test_package.c +++ /dev/null @@ -1,21 +0,0 @@ -#define PY_SSIZE_T_CLEAN -#include - -int -main(int argc, char *argv[]) -{ - wchar_t *program = Py_DecodeLocale(argv[0], NULL); - if (program == NULL) { - fprintf(stderr, "Fatal error: cannot decode argv[0]\n"); - exit(1); - } - Py_SetProgramName(program); /* optional but recommended */ - Py_Initialize(); - PyRun_SimpleString("from time import time, ctime\n" - "print('Today is', ctime(time()))\n"); - if (Py_FinalizeEx() < 0) { - exit(120); - } - PyMem_RawFree(program); - return 0; -} diff --git a/recipes/cpython/all/test_package/setup.py b/recipes/cpython/all/test_package/setup.py index cd1754cef8131..2cf4febef6264 100644 --- a/recipes/cpython/all/test_package/setup.py +++ b/recipes/cpython/all/test_package/setup.py @@ -1,5 +1,4 @@ import os -import sys # Hack to work around Python 3.8+ secure dll loading: # see https://docs.python.org/3/whatsnew/3.8.html#bpo-36085-whatsnew @@ -8,24 +7,14 @@ if os.path.isdir(directory): os.add_dll_directory(directory) -PY2 = (2, 0) <= sys.version_info < (3, 0) -PY3 = (3, 0) <= sys.version_info < (4, 0) - -if PY2: - subdir = "py2" - from distutils.core import setup, Extension -elif PY3: - subdir = "py3" - from setuptools import setup, Extension -else: - raise Exception +from setuptools import setup, Extension +script_dir = os.path.dirname(os.path.realpath(__file__)) setup( name="test_package", version="1.0", - use_2to3=True, ext_modules=[ - Extension("spam", [os.path.join(subdir, "test_module.c")]), + Extension("spam", [os.path.join(script_dir, "test_module.c")]), ], ) diff --git a/recipes/cpython/all/test_package/py3/test_module.c b/recipes/cpython/all/test_package/test_module.c similarity index 100% rename from recipes/cpython/all/test_package/py3/test_module.c rename to recipes/cpython/all/test_package/test_module.c diff --git a/recipes/cpython/all/test_package/test_package.c b/recipes/cpython/all/test_package/test_package.c new file mode 100644 index 0000000000000..cf1688e39502a --- /dev/null +++ b/recipes/cpython/all/test_package/test_package.c @@ -0,0 +1,20 @@ +#define PY_SSIZE_T_CLEAN +#include + +int +main(int argc, char *argv[]) +{ + wchar_t *program = Py_DecodeLocale(argv[0], NULL); + if (program == NULL) { + fprintf(stderr, "Fatal error: cannot decode argv[0]\n"); + exit(1); + } + Py_Initialize(); + PyRun_SimpleString("from time import time, ctime\n" + "print('Today is', ctime(time()))\n"); + if (Py_FinalizeEx() < 0) { + exit(120); + } + PyMem_RawFree(program); + return 0; +} diff --git a/recipes/cpython/all/test_package/test_package.py b/recipes/cpython/all/test_package/test_package.py index f77d2837c6376..bed43fac74c62 100644 --- a/recipes/cpython/all/test_package/test_package.py +++ b/recipes/cpython/all/test_package/test_package.py @@ -14,12 +14,13 @@ def add_test(fn): global ALL_TESTS - name = fn.__name__[fn.__name__.find("_")+1:] + name = fn.__name__[fn.__name__.find("_") + 1 :] def inner_fn(): print("testing {}".format(name)) sys.stdout.flush() fn() + ALL_TESTS[name] = inner_fn return fn @@ -30,13 +31,13 @@ def test_expat(): # 3 handler functions def start_element(name, attrs): - print('Start element:', name, attrs) + print("Start element:", name, attrs) def end_element(name): - print('End element:', name) + print("End element:", name) def char_data(data): - print('Character data:', repr(data)) + print("Character data:", repr(data)) p = xml.parsers.expat.ParserCreate() @@ -44,18 +45,18 @@ def char_data(data): p.EndElementHandler = end_element p.CharacterDataHandler = char_data - p.Parse(""" + p.Parse( + """ Text goes here More text - """, 1) + """, + 1, + ) @add_test def test_gdbm(): - if sys.version_info < (3, 0): - import gdbm - else: - import dbm.gnu as gdbm + import dbm.gnu as gdbm dbfile = "gdbm.db" @@ -85,10 +86,8 @@ def test_spam(): if "This is an example spam doc." not in spam.__doc__: raise Exception("spam.__doc__ does not contain the expected text") - cmd = { - "Windows": "dir", - }.get(platform.system(), "ls") - print("About to run spam.system(\"{}\")".format(cmd)) + cmd = {"Windows": "dir"}.get(platform.system(), "ls") + print('About to run spam.system("{}")'.format(cmd)) sys.stdout.flush() spam.system(cmd) @@ -103,24 +102,6 @@ def test_bz2(): raise Exception("bz2.compress returned no data") -@add_test -def test_bsddb(): - import bsddb - - db = bsddb.btopen("bsddb.db", "c") - db["key1"] = "value1" - db["key2"] = "value2" - db.close() - - db = bsddb.btopen("bsddb.db", "r") - if len(db) != 2: - raise Exception("Wrong length") - if db["key1"] != "value1": - raise Exception("value1 incorrect {}".format(db["key1"])) - if db["key2"] != "value2": - raise Exception("value2 incorrect {}".format(db["key2"])) - - @add_test def test_lzma(): import lzma @@ -133,6 +114,7 @@ def test_lzma(): @add_test def test_sqlite3(): import sqlite3 + conn = sqlite3.connect("sqlite3.db") c = conn.cursor() @@ -141,16 +123,16 @@ def test_sqlite3(): c.execute("INSERT INTO stocks VALUES ('2006-01-05','BUY','RHAT',100,35.14)") conn.commit() - t = ('RHAT',) - c.execute('SELECT * FROM stocks WHERE symbol=?', t) + t = ("RHAT",) + c.execute("SELECT * FROM stocks WHERE symbol=?", t) # Larger example that inserts many records at a time purchases = [ - ('2006-03-28', 'BUY', 'IBM', 1000, 45.00), - ('2006-04-05', 'BUY', 'MSFT', 1000, 72.00), - ('2006-04-06', 'SELL', 'IBM', 500, 53.00), + ("2006-03-28", "BUY", "IBM", 1000, 45.00), + ("2006-04-05", "BUY", "MSFT", 1000, 72.00), + ("2006-04-06", "SELL", "IBM", 500, 53.00), ] - c.executemany('INSERT INTO stocks VALUES (?,?,?,?,?)', purchases) + c.executemany("INSERT INTO stocks VALUES (?,?,?,?,?)", purchases) conn.commit() conn.close() conn = sqlite3.connect("sqlite3.db") @@ -161,15 +143,15 @@ def test_sqlite3(): raise Exception("Need 4 stocks") print(data) conn.close() + # Remove the file so subsequent tests don't fail + os.remove("sqlite3.db") @add_test def test_decimal(): - if sys.version_info >= (3, ): - # Check whether the _decimal package was built successfully - import _decimal as decimal - else: - import decimal + # Check whether the _decimal package was built successfully + import _decimal as decimal + decimal.getcontext().prec = 6 print("1/7 =", decimal.Decimal(1) / decimal.Decimal(7)) decimal.getcontext().prec = 40 @@ -199,6 +181,14 @@ def test_tkinter(): print("tk version: {}".format(_tkinter.TK_VERSION)) +@add_test +def test_ssl(): + import ssl + + default_context = ssl.create_default_context() + print("default_context.options={}".format(default_context.options)) + + def main(): parser = argparse.ArgumentParser() parser.add_argument("-b", dest="build_folder", help="build_folder", required=True) diff --git a/recipes/cpython/all/test_v1_package/CMakeLists.txt b/recipes/cpython/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..6014dcdd6efcb --- /dev/null +++ b/recipes/cpython/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,96 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package C) + +include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") +conan_basic_setup() + +set(CACHE PY_VERSION_MAJOR "" CACHE STRING "MAJOR version of python") +set(CACHE PY_VERSION_MAJOR_MINOR "" CACHE STRING "MAJOR.MINOR version of python") +set(CACHE PY_VERSION "" CACHE STRING "Required version of python") +set(CACHE PY_VERSION_SUFFIX "" CACHE STRING "Suffix of python") + +set(Python_ADDITIONAL_VERSIONS ${PY_VERSION}${PY_VERSION_SUFFIX} ${PY_VERSION_MAJOR_MINOR}${PY_VERSION_SUFFIX} 3${PY_VERSION_SUFFIX} ${PY_VERSION} ${PY_VERSION_MAJOR_MINOR} 3) +message("Using Python_ADDITIONAL_VERSIONS: ${Python_ADDITIONAL_VERSIONS}") + +find_package(PythonInterp REQUIRED) +find_package(PythonLibs REQUIRED) + +string(FIND "${PYTHON_EXECUTABLE}" "${CONAN_CPYTHON_ROOT}" ROOT_SUBPOS) +if(ROOT_SUBPOS EQUAL -1) + message(FATAL_ERROR "found wrong python interpreter: ${PYTHON_EXECUTABLE}") +endif() + +message(STATUS "FindPythonInterp:") +message(STATUS "PYTHON_VERSION_STRING: ${PYTHON_VERSION_STRING}") +message(STATUS "PYTHON_VERSION_MAJOR: ${PYTHON_VERSION_MAJOR}") +message(STATUS "PYTHON_VERSION_MINOR: ${PYTHON_VERSION_MINOR}") +message(STATUS "PYTHON_VERSION_PATCH: ${PYTHON_VERSION_PATCH}") +message(STATUS "=============================================") +message(STATUS "FindPythonLibs:") +message(STATUS "PYTHON_LIBRARIES: ${PYTHON_LIBRARIES}") +message(STATUS "PYTHON_INCLUDE_PATH: ${PYTHON_INCLUDE_PATH} (deprecated)") +message(STATUS "PYTHON_INCLUDE_DIRS: ${PYTHON_INCLUDE_DIRS}") +message(STATUS "PYTHON_DEBUG_LIBRARIES: ${PYTHON_DEBUG_LIBRARIES} (deprecated)") +message(STATUS "PYTHONLIBS_VERSION_STRING: ${PYTHONLIBS_VERSION_STRING}") + +if(NOT PYTHON_VERSION_STRING AND NOT PYTHONLIBS_VERSION_STRING) + message(FATAL_ERROR "Version of python interpreter and libraries not found") +endif() + +if(PYTHON_VERSION_STRING) + if(NOT PYTHON_VERSION_STRING VERSION_EQUAL "${PY_VERSION}") + message("PYTHON_VERSION_STRING does not match PY_VERSION") + message(FATAL_ERROR "CMake detected wrong cpython version") + endif() +endif() + +if(PYTHONLIBS_VERSION_STRING) + if(NOT PYTHONLIBS_VERSION_STRING STREQUAL "${PY_FULL_VERSION}") + message("PYTHONLIBS_VERSION_STRING does not match PY_FULL_VERSION") + message(FATAL_ERROR "CMake detected wrong cpython version") + endif() +endif() + +option(BUILD_MODULE "Build python module") + +set(SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../test_package") + +if(BUILD_MODULE) + add_library(spam MODULE "${SOURCE_DIR}/test_module.c") + target_include_directories(spam + PRIVATE + ${PYTHON_INCLUDE_DIRS} + ) + target_link_libraries(spam PRIVATE + ${PYTHON_LIBRARIES} + ) + set_property(TARGET spam PROPERTY PREFIX "") + if(MSVC) + if(CONAN_SETTINGS_BUILD_TYPE STREQUAL "Debug") + set(SUFFIX "_d.pyd") + else() + set(SUFFIX ".pyd") + endif() + set_property(TARGET spam PROPERTY SUFFIX "${SUFFIX}") + endif() + + option(USE_FINDPYTHON_X "Use new-style FindPythonX module") + if(USE_FINDPYTHON_X AND NOT (CMAKE_VERSION VERSION_LESS "3.16")) + # Require CMake 3.16 because this version introduces Python3_FIND_ABI + find_package(Python3 REQUIRED COMPONENTS Interpreter Development) + message("Python3_EXECUTABLE: ${Python3_EXECUTABLE}") + message("Python3_INTERPRETER_ID: ${Python3_INTERPRETER_ID}") + message("Python3_VERSION: ${Python3_VERSION}") + message("Python3_INCLUDE_DIRS: ${Python3_INCLUDE_DIRS}") + message("Python3_LIBRARIES: ${Python3_LIBRARIES}") + if(NOT Python3_VERSION STREQUAL "${PY_VERSION}") + message("Python_ADDITIONAL_VERSIONS does not match PY_VERSION") + message(FATAL_ERROR "CMake detected wrong cpython version") + endif() + + python3_add_library(spam2 "${SOURCE_DIR}/test_module.c") + endif() +endif() + +add_executable(${PROJECT_NAME} "${SOURCE_DIR}/test_package.c") +target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) diff --git a/recipes/cpython/all/test_v1_package/conanfile.py b/recipes/cpython/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..2fdcf049eb972 --- /dev/null +++ b/recipes/cpython/all/test_v1_package/conanfile.py @@ -0,0 +1,160 @@ +from conans import AutoToolsBuildEnvironment, ConanFile, CMake, tools, RunEnvironment +from conans.errors import ConanException +from conan.tools.env import VirtualRunEnv +from io import StringIO +import os +import re + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake" + + @property + def _py_version(self): + return re.match(r"^([0-9.]+)", self.deps_cpp_info["cpython"].version).group(1) + + @property + def _test_setuptools(self): + # TODO Should we still try to test this? + # https://github.com/python/cpython/pull/101039 + return not tools.cross_building(self, skip_x64_x86=True) and self._supports_modules and self._py_version < tools.Version("3.12") + + @property + def _cmake_try_FindPythonX(self): + if self.settings.compiler == "Visual Studio" and self.settings.build_type == "Debug": + return False + return True + + @property + def _supports_modules(self): + return self.settings.compiler != "Visual Studio" or self.options["cpython"].shared + + def generate(self): + # The build also needs access to the run environment to run the python executable + VirtualRunEnv(self).generate(scope="run") + VirtualRunEnv(self).generate(scope="build") + + def build_requirements(self): + # The main recipe does not require CMake, but we test with it. + # The interesting problem that arises here is if you have CMake installed + # with your global pip, then it will fail to run in this test package. + # To avoid that, just add a requirement on CMake. + self.tool_requires("cmake/[>=3.15 <4]") + + def build(self): + if not tools.cross_building(self, skip_x64_x86=True): + command = "{} --version".format(self.deps_user_info["cpython"].python) + buffer = StringIO() + self.run(command, output=buffer, ignore_errors=True, run_environment=True) + self.output.info("output: %s" % buffer.getvalue()) + self.run(command, run_environment=True) + + cmake = CMake(self) + cmake.definitions["BUILD_MODULE"] = self._supports_modules + cmake.definitions["PY_VERSION_MAJOR_MINOR"] = ".".join(self._py_version.split(".")[:2]) + cmake.definitions["PY_FULL_VERSION"] = self.deps_cpp_info["cpython"].version + cmake.definitions["PY_VERSION"] = self._py_version + cmake.definitions["PY_VERSION_SUFFIX"] = "d" if self.settings.build_type == "Debug" else "" + cmake.definitions["PYTHON_EXECUTABLE"] = self.deps_user_info["cpython"].python + cmake.definitions["USE_FINDPYTHON_X"] = self._cmake_try_FindPythonX + cmake.definitions["Python3_EXECUTABLE"] = self.deps_user_info["cpython"].python + cmake.definitions["Python3_ROOT_DIR"] = self.deps_cpp_info["cpython"].rootpath + cmake.definitions["Python3_USE_STATIC_LIBS"] = not self.options["cpython"].shared + cmake.definitions["Python3_FIND_FRAMEWORK"] = "NEVER" + cmake.definitions["Python3_FIND_REGISTRY"] = "NEVER" + cmake.definitions["Python3_FIND_IMPLEMENTATIONS"] = "CPython" + cmake.definitions["Python3_FIND_STRATEGY"] = "LOCATION" + + with tools.environment_append(RunEnvironment(self).vars): + cmake.configure() + cmake.build() + + if self._test_setuptools: + with tools.vcvars(self.settings) if self.settings.compiler == "Visual Studio" else tools.no_op(): + env = { + "DISTUTILS_USE_SDK": "1", + "MSSdk": "1" + } + env.update(**AutoToolsBuildEnvironment(self).vars) + with tools.environment_append(env): + setup_args = [ + os.path.join(self.source_folder, "..", "test_package", "setup.py"), + "build", + "--build-base", self.build_folder, + "--build-platlib", os.path.join(self.build_folder, "lib_setuptools"), + # Bandaid fix: setuptools places temporary files in a subdirectory of the build folder where the + # entirety of the absolute path up to this folder is appended (with seemingly no way to stop this), + # essentially doubling the path length. This may run into Windows max path lengths, so we give ourselves + # a little bit of wiggle room by making this directory name as short as possible. One of the directory + # names goes from (for example) "temp.win-amd64-3.10-pydebug" to "t", saving us roughly 25 characters. + "--build-temp", "t", + ] + if self.settings.build_type == "Debug": + setup_args.append("--debug") + self.run("{} {}".format(self.deps_user_info["cpython"].python, " ".join("\"{}\"".format(a) for a in setup_args)), run_environment=True) + + def _test_module(self, module, should_work): + try: + self.run("{} \"{}/../test_package/test_package.py\" -b \"{}\" -t {} ".format( + self.deps_user_info["cpython"].python, self.source_folder, self.build_folder, module), run_environment=True) + works = True + except ConanException as e: + works = False + exception = e + if should_work == works: + self.output.info("Result of test was expected.") + else: + if works: + raise ConanException("Module '{}' works, but should not have worked".format(module)) + else: + self.output.warn("Module '{}' does not work, but should have worked".format(module)) + raise exception + + def _cpython_option(self, name): + try: + return getattr(self.options["cpython"], name, False) + except ConanException: + return False + + def test(self): + if not tools.cross_building(self, skip_x64_x86=True): + self.run("{} -c \"print('hello world')\"".format(self.deps_user_info["cpython"].python), run_environment=True) + + buffer = StringIO() + self.run("{} -c \"import sys; print('.'.join(str(s) for s in sys.version_info[:3]))\"".format(self.deps_user_info["cpython"].python), run_environment=True, output=buffer) + self.output.info(buffer.getvalue()) + version_detected = buffer.getvalue().splitlines()[-1].strip() + if self._py_version != version_detected: + raise ConanException("python reported wrong version. Expected {exp}. Got {res}.".format(exp=self._py_version, res=version_detected)) + + if self._supports_modules: + self._test_module("gdbm", self._cpython_option("with_gdbm")) + self._test_module("bz2", self._cpython_option("with_bz2")) + self._test_module("lzma", self._cpython_option("with_lzma")) + self._test_module("tkinter", self._cpython_option("with_tkinter")) + with tools.environment_append({"TERM": "ansi"}): + self._test_module("curses", self._cpython_option("with_curses")) + + self._test_module("expat", True) + self._test_module("sqlite3", True) + self._test_module("decimal", True) + self._test_module("ctypes", True) + + if tools.is_apple_os(self.settings.os) and not self.options["cpython"].shared: + self.output.info("Not testing the module, because these seem not to work on apple when cpython is built as a static library") + # FIXME: find out why cpython on apple does not allow to use modules linked against a static python + else: + if self._supports_modules: + with tools.environment_append({"PYTHONPATH": [os.path.join(self.build_folder, "lib")]}): + self.output.info("Testing module (spam) using cmake built module") + self._test_module("spam", True) + + if self._test_setuptools: + with tools.environment_append({"PYTHONPATH": [os.path.join(self.build_folder, "lib_setuptools")]}): + self.output.info("Testing module (spam) using setup.py built module") + self._test_module("spam", True) + + # MSVC builds need PYTHONHOME set. Linux and Mac don't require it to be set if tested after building, + # but if the package is relocated then it needs to be set. + with tools.environment_append({"PYTHONHOME": self.deps_user_info["cpython"].pythonhome}): + self.run(os.path.join("bin", "test_package"), run_environment=True) diff --git a/recipes/cpython/config.yml b/recipes/cpython/config.yml index e3abf3ec8acb2..a2b9627fa470b 100644 --- a/recipes/cpython/config.yml +++ b/recipes/cpython/config.yml @@ -1,11 +1,13 @@ versions: - "3.10.0": + "3.12.7": folder: "all" - "3.9.7": + "3.12.2": folder: "all" - "3.8.12": + "3.11.9": folder: "all" - "3.7.12": + "3.10.14": folder: "all" - "2.7.18": + "3.9.19": + folder: "all" + "3.8.19": folder: "all" 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/cr/all/conandata.yml b/recipes/cr/all/conandata.yml new file mode 100644 index 0000000000000..caacd3f558624 --- /dev/null +++ b/recipes/cr/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "cci.20221105": + url: "https://github.com/fungos/cr/archive/0e7fef63555cf73c70e4d9ae42f8a6e9cefb8e69.zip" + sha256: "43c076800b19cb9f994ee7e77020e79ea2a01257f221d2f6d80e656f2507069e" diff --git a/recipes/cr/all/conanfile.py b/recipes/cr/all/conanfile.py new file mode 100644 index 0000000000000..b6dc7c42f14b8 --- /dev/null +++ b/recipes/cr/all/conanfile.py @@ -0,0 +1,70 @@ +import os + +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.files import copy, get +from conan.tools.layout import basic_layout +from conan.tools.scm import Version + +required_conan_version = ">=1.52.0" + + +class CrConan(ConanFile): + name = "cr" + description = "cr.h: A Simple C Hot Reload Header-only Library" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/fungos/cr" + topics = ("hot-reload", "hot-swapping", "live-coding", "gamedev", "header-only") + + package_type = "header-library" + 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", + "Visual Studio": "15", + "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 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): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def package(self): + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + copy(self, "cr.h", self.source_folder, 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.extend(["pthread", "dl", "rt"]) + elif is_apple_os(self): + self.cpp_info.system_libs.append("dl") + elif self.settings.os == "Windows": + self.cpp_info.system_libs.append("dbghelp") diff --git a/recipes/cr/all/test_package/CMakeLists.txt b/recipes/cr/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..420798776cd30 --- /dev/null +++ b/recipes/cr/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(cr REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE cr::cr) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/cr/all/test_package/conanfile.py b/recipes/cr/all/test_package/conanfile.py new file mode 100644 index 0000000000000..ef5d7042163ec --- /dev/null +++ b/recipes/cr/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cr/all/test_package/test_package.cpp b/recipes/cr/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..3be840e09fd11 --- /dev/null +++ b/recipes/cr/all/test_package/test_package.cpp @@ -0,0 +1,11 @@ +#define CR_HOST +#include + +void dummy() { + cr_plugin ctx; + cr_plugin_open(ctx, "xyz.dll"); + cr_plugin_update(ctx); + cr_plugin_close(ctx); +} + +int main() {} diff --git a/recipes/cr/config.yml b/recipes/cr/config.yml new file mode 100644 index 0000000000000..35012be65fa98 --- /dev/null +++ b/recipes/cr/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20221105": + folder: all diff --git a/recipes/crashpad/all/conandata.yml b/recipes/crashpad/all/conandata.yml index 78196c9e613a3..309c5ff4f2de1 100644 --- a/recipes/crashpad/all/conandata.yml +++ b/recipes/crashpad/all/conandata.yml @@ -1,11 +1,4 @@ sources: - "cci.20210507": - crashpad: - url: "https://github.com/chromium/crashpad/archive/d9bc7cf06aef74e928f9afc3dee33b60121b9c73.tar.gz" - sha256: "49f4b10f1de9b6d33743eccecace6b0fc9d7fe92e5e550ba5e099e6db9a11f0f" - mini_chromium: - url: "https://github.com/chromium/mini_chromium/archive/ccb198907cecf072d8f5b2543d4d348e834a298a.tar.gz" - sha256: "f40a77a4580cd1cb9af71602917a0e85b62bf0f74641b6ed81dd9fb2f2012ea9" "cci.20220219": crashpad: url: "https://github.com/chromium/crashpad/archive/e9937cb36cd12f24d73a07c4b91168cf1885b5db.tar.gz" @@ -14,36 +7,13 @@ sources: url: "https://github.com/chromium/mini_chromium/archive/822fada4a9972e3e2f36a981da770539025beb0a.tar.gz" sha256: "2c3bf30d324fcb60eeef84dd6aaf7fb75b70e37bdb3716ab3ea10cda51c4b05c" patches: - "cci.20210507": - - patch_file: "patches/cci.20210507-0001-fix-openssl-link-order.patch" - base_path: "source_subfolder" - - patch_file: "patches/cci.20210507-0002-remove-fPIC-Werror-LTO.patch" - base_path: "source_subfolder" - - patch_file: "patches/cci.20210507-0003-compilers-from-env.patch" - base_path: "source_subfolder" - - patch_file: "patches/cci.20210507-0004-use-conan-linux-syscall-support-package.patch" - base_path: "source_subfolder" - - patch_file: "patches/cci.20210507-0005-allow-all-archs.patch" - base_path: "source_subfolder" - - patch_file: "patches/cci.20210507-0006-mini_chromium-win_helper-py3.patch" - base_path: "source_subfolder" - - patch_file: "patches/cci.20210507-0007-use-system-zlib.patch" - base_path: "source_subfolder" "cci.20220219": - patch_file: "patches/cci.20220219-0001-fix-openssl-link-order.patch" - base_path: "source_subfolder" - patch_file: "patches/cci.20220219-0002-remove-fPIC-Werror-LTO.patch" - base_path: "source_subfolder" - patch_file: "patches/cci.20220219-0003-compilers-from-env.patch" - base_path: "source_subfolder" - patch_file: "patches/cci.20220219-0004-use-conan-linux-syscall-support-package.patch" - base_path: "source_subfolder" - patch_file: "patches/cci.20220219-0005-allow-all-archs.patch" - base_path: "source_subfolder" - patch_file: "patches/cci.20220219-0006-mini_chromium-win_helper-py3.patch" - base_path: "source_subfolder" - # reused patch from cci.20210507 + # reused patch from cci.20210507 - patch_file: "patches/cci.20210507-0007-use-system-zlib.patch" - base_path: "source_subfolder" - patch_file: "patches/cci.20220219-0007-static-lib-tool_support.patch" - base_path: "source_subfolder" diff --git a/recipes/crashpad/all/conanfile.py b/recipes/crashpad/all/conanfile.py index 42d603abefb4c..7b7d6c74f963c 100644 --- a/recipes/crashpad/all/conanfile.py +++ b/recipes/crashpad/all/conanfile.py @@ -1,21 +1,30 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, tools -from conans.errors import ConanInvalidConfiguration -from contextlib import contextmanager +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rename, replace_in_file, rm, save, chdir +from conan.tools.scm import Version +from conan.tools.build import check_min_cppstd +from conan.tools.apple import XCRun, is_apple_os +from conan.tools.env import Environment, VirtualBuildEnv, VirtualRunEnv +from conan.tools.microsoft import VCVars, is_msvc +from conan.tools.gnu import AutotoolsDeps, AutotoolsToolchain + + import os import textwrap -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.64.0" class CrashpadConan(ConanFile): name = "crashpad" description = "Crashpad is a crash-reporting system." url = "https://github.com/conan-io/conan-center-index" - topics = ("conan", "crashpad", "crash", "error", "stacktrace", "collecting", "reporting") + topics = ("crashpad", "crash", "error", "stacktrace", "collecting", "reporting") license = "Apache-2.0" homepage = "https://chromium.googlesource.com/crashpad/crashpad/+/master/README.md" - provides = "crashpad", "mini_chromium" + provides = "mini_chromium" settings = "os", "arch", "compiler", "build_type" + package_type = "static-library" options = { "fPIC": [True, False], "http_transport": ["libcurl", "socket", None], @@ -26,17 +35,16 @@ class CrashpadConan(ConanFile): "http_transport": None, "with_tls": "openssl", } - exports_sources = "patches/*" - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + export_conandata_patches(self) def _minimum_compiler_cxx14(self): return { "apple-clang": 10, "gcc": 5, "clang": "3.9", + "msvc": "190", "Visual Studio": 14, }.get(str(self.settings.compiler)) @@ -49,46 +57,46 @@ def config_options(self): self.options.http_transport = "socket" def build_requirements(self): - self.build_requires("ninja/1.10.2") - self.build_requires("gn/cci.20210429") + self.tool_requires("ninja/1.10.2") + self.tool_requires("gn/cci.20210429") def requirements(self): # FIXME: use mini_chromium conan package instead of embedded package (if possible) - self.requires("zlib/1.2.12") + self.requires("zlib/[>=1.2.12 <2]") if self.settings.os in ("Linux", "FreeBSD"): self.requires("linux-syscall-support/cci.20200813") if self.options.http_transport != "socket": del self.options.with_tls if self.options.http_transport == "libcurl": - self.requires("libcurl/7.82.0") + self.requires("libcurl/[>=7.78 <9]") if self.options.get_safe("with_tls") == "openssl": - self.requires("openssl/1.1.1o") + self.requires("openssl/[>=1.1 <4]") def validate(self): - if self.settings.compiler == "Visual Studio": + if is_msvc(self): if self.options.http_transport in ("libcurl", "socket"): raise ConanInvalidConfiguration("http_transport={} is not valid when building with Visual Studio".format(self.options.http_transport)) if self.options.http_transport == "libcurl": - if not self.options["libcurl"].shared: + if not self.dependencies["libcurl"].options.shared: # FIXME: is this true? - self.output.warn("crashpad needs a shared libcurl library") + self.output.warning("crashpad needs a shared libcurl library") min_compiler_version = self._minimum_compiler_cxx14() if min_compiler_version: - if tools.Version(self.settings.compiler.version) < min_compiler_version: + if Version(self.settings.compiler.version) < min_compiler_version: raise ConanInvalidConfiguration("crashpad needs a c++14 capable compiler, version >= {}".format(min_compiler_version)) else: - self.output.warn("This recipe does not know about the current compiler and assumes it has sufficient c++14 supports.") + self.output.warning("This recipe does not know about the current compiler and assumes it has sufficient c++14 supports.") if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 14) + check_min_cppstd(self, 14) def source(self): - tools.get(**self.conan_data["sources"][self.version]["crashpad"], destination=self._source_subfolder, strip_root=True) - tools.get(**self.conan_data["sources"][self.version]["mini_chromium"], - destination=os.path.join(self._source_subfolder, "third_party", "mini_chromium", "mini_chromium"), strip_root=True) + get(self, **self.conan_data["sources"][self.version]["crashpad"], destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version]["mini_chromium"], + destination=os.path.join(self.source_folder, "third_party", "mini_chromium", "mini_chromium"), strip_root=True) @property def _gn_os(self): - if tools.is_apple_os(self.settings.os): + if is_apple_os(self): if self.settings.os == "Macos": return "mac" else: @@ -105,31 +113,18 @@ def _gn_arch(self): "x86": "x86", }.get(str(self.settings.arch), str(self.settings.arch)) - @contextmanager - def _build_context(self): - if self.settings.compiler == "Visual Studio": - with tools.vcvars(self.settings): - yield - else: - env_defaults = {} - if self.settings.compiler == "gcc": - env_defaults.update({ - "CC": "gcc", - "CXX": "g++", - "LD": "g++", - }) - elif self.settings.compiler in ("clang", "apple-clang"): - env_defaults.update({ - "CC": "clang", - "CXX": "clang++", - "LD": "clang++", - }) - env = {} - for key, value in env_defaults.items(): - if not tools.get_env(key): - env[key] = value - with tools.environment_append(env): - yield + def generate(self): + VCVars(self).generate() + env = Environment() + if self.settings.compiler == "gcc": + env.define("CC", "gcc") + env.define("CXX", "g++") + env.define("LD", "g++") + elif str(self.settings.compiler) in ("clang", "apple-clang"): + env.define("CC", "clang") + env.define("CXX", "clang++") + env.define("LD", "clang++") + env.vars(self).save_script("conanbuild_gn") @property def _http_transport_impl(self): @@ -138,40 +133,31 @@ def _http_transport_impl(self): else: return str(self.options.http_transport) - def _version_greater_equal_to_cci_20220219(self): - return self.version >= "cci.20220219" - - def _has_separate_util_net_lib(self): - return self._version_greater_equal_to_cci_20220219() - - def _needs_to_link_tool_support(self): - return self._version_greater_equal_to_cci_20220219() - def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) - if self.settings.compiler == "Visual Studio": - tools.replace_in_file(os.path.join(self._source_subfolder, "third_party", "zlib", "BUILD.gn"), + if is_msvc(self): + replace_in_file(self, os.path.join(self.source_folder, "third_party", "zlib", "BUILD.gn"), "libs = [ \"z\" ]", - "libs = [ {} ]".format(", ".join("\"{}.lib\"".format(l) for l in self.deps_cpp_info["zlib"].libs))) + "libs = [ \"zlib.lib\" ]") if self.settings.compiler == "gcc": - toolchain_path = os.path.join(self._source_subfolder, "third_party", "mini_chromium", "mini_chromium", "build", "config", "BUILD.gn") + toolchain_path = os.path.join(self.source_folder, "third_party", "mini_chromium", "mini_chromium", "build", "config", "BUILD.gn") # Remove gcc-incompatible compiler arguments for comp_arg in ("-Wheader-hygiene", "-Wnewline-eof", "-Wstring-conversion", "-Wexit-time-destructors", "-fobjc-call-cxx-cdtors", "-Wextra-semi", "-Wimplicit-fallthrough"): - tools.replace_in_file(toolchain_path, - "\"{}\"".format(comp_arg), "\"\"") + replace_in_file(self, toolchain_path, "\"{}\"".format(comp_arg), "\"\"") + + deps = AutotoolsDeps(self).vars() + tc = AutotoolsToolchain(self).vars() + def _get_flags(name): + return [f for f in filter(None, [tc.get(name), deps.get(name)])] - autotools = AutoToolsBuildEnvironment(self) - extra_cflags = autotools.flags + ["-D{}".format(d) for d in autotools.defines] + extra_cflags = _get_flags("CPPFLAGS") extra_cflags_c = [] - extra_cflags_cc = autotools.cxx_flags - extra_ldflags = autotools.link_flags + extra_cflags_cc = _get_flags("CXXFLAGS") + extra_ldflags = _get_flags("LDFLAGS") + _get_flags("LIBS") if self.options.get_safe("fPIC"): extra_cflags.append("-fPIC") - extra_cflags.extend("-I {}".format(inc) for inc in autotools.include_paths) - extra_ldflags.extend("-{}{}".format("LIBPATH:" if self.settings.compiler == "Visual Studio" else "L ", libdir) for libdir in autotools.library_paths) if self.settings.compiler == "clang": if self.settings.compiler.get_safe("libcxx"): stdlib = { @@ -190,47 +176,46 @@ def build(self): "extra_cflags_cc=\\\"{}\\\"".format(" ".join(extra_cflags_cc)), "extra_ldflags=\\\"{}\\\"".format(" ".join(extra_ldflags)), ] - with tools.chdir(self._source_subfolder): - with self._build_context(): - self.run("gn gen out/Default --args=\"{}\"".format(" ".join(gn_args)), run_environment=True) - targets = ["client", "minidump", "crashpad_handler", "snapshot"] - if self.settings.os == "Windows": - targets.append("crashpad_handler_com") - self.run("ninja -C out/Default {targets} -j{parallel}".format( - targets=" ".join(targets), - parallel=tools.cpu_count()), run_environment=True) + with chdir(self, self.source_folder): + self.run("gn gen out/Default --args=\"{}\"".format(" ".join(gn_args))) + targets = ["client", "minidump", "crashpad_handler", "snapshot"] + if self.settings.os == "Windows": + targets.append("crashpad_handler_com") + self.run("ninja -C out/Default {targets} -j{parallel}".format( + targets=" ".join(targets), + parallel=os.cpu_count())) def lib_filename(name): - prefix, suffix = ("", ".lib") if self.settings.compiler == "Visual Studio" else ("lib", ".a") + prefix, suffix = ("", ".lib") if is_msvc(self) else ("lib", ".a") return "{}{}{}".format(prefix, name, suffix) - tools.rename(os.path.join(self._source_subfolder, "out", "Default", "obj", "client", lib_filename("common")), - os.path.join(self._source_subfolder, "out", "Default", "obj", "client", lib_filename("client_common"))) - tools.rename(os.path.join(self._source_subfolder, "out", "Default", "obj", "handler", lib_filename("common")), - os.path.join(self._source_subfolder, "out", "Default", "obj", "handler", lib_filename("handler_common"))) + rename(self, os.path.join(self.source_folder, "out", "Default", "obj", "client", lib_filename("common")), + os.path.join(self.source_folder, "out", "Default", "obj", "client", lib_filename("client_common"))) + rename(self, os.path.join(self.source_folder, "out", "Default", "obj", "handler", lib_filename("common")), + os.path.join(self.source_folder, "out", "Default", "obj", "handler", lib_filename("handler_common"))) 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")) - self.copy("*.h", src=os.path.join(self._source_subfolder, "client"), dst=os.path.join("include", "client")) - self.copy("*.h", src=os.path.join(self._source_subfolder, "util"), dst=os.path.join("include", "util")) - self.copy("*.h", src=os.path.join(self._source_subfolder, "third_party", "mini_chromium", "mini_chromium", "base"), dst=os.path.join("include", "base")) - self.copy("*.h", src=os.path.join(self._source_subfolder, "third_party", "mini_chromium", "mini_chromium", "build"), dst=os.path.join("include", "build")) - self.copy("*.h", src=os.path.join(self._source_subfolder, "out", "Default", "gen", "build"), dst=os.path.join("include", "build")) + copy(self, "*.h", src=os.path.join(self.source_folder, "client"), dst=os.path.join(self.package_folder, "include", "client")) + copy(self, "*.h", src=os.path.join(self.source_folder, "util"), dst=os.path.join(self.package_folder, "include", "util")) + copy(self, "*.h", src=os.path.join(self.source_folder, "third_party", "mini_chromium", "mini_chromium", "base"), dst=os.path.join(self.package_folder, "include", "base")) + copy(self, "*.h", src=os.path.join(self.source_folder, "third_party", "mini_chromium", "mini_chromium", "build"), dst=os.path.join(self.package_folder, "include", "build")) + copy(self, "*.h", src=os.path.join(self.source_folder, "out", "Default", "gen", "build"), dst=os.path.join(self.package_folder, "include", "build")) - self.copy("*.a", src=os.path.join(self._source_subfolder, "out", "Default"), dst="lib", keep_path=False) + copy(self, "*.a", src=os.path.join(self.source_folder, "out", "Default"), dst=os.path.join(self.package_folder, "lib"), keep_path=False) - self.copy("*.lib", src=os.path.join(self._source_subfolder, "out", "Default"), dst="lib", keep_path=False) - self.copy("crashpad_handler", src=os.path.join(self._source_subfolder, "out", "Default"), dst="bin", keep_path=False) - self.copy("crashpad_handler.exe", src=os.path.join(self._source_subfolder, "out", "Default"), dst="bin", keep_path=False) - self.copy("crashpad_handler_com.com", src=os.path.join(self._source_subfolder, "out", "Default"), dst="bin", keep_path=False) + copy(self, "*.lib", src=os.path.join(self.source_folder, "out", "Default"), dst=os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, "crashpad_handler", src=os.path.join(self.source_folder, "out", "Default"), dst=os.path.join(self.package_folder, "bin"), keep_path=False) + copy(self, "crashpad_handler.exe", src=os.path.join(self.source_folder, "out", "Default"), dst=os.path.join(self.package_folder, "bin"), keep_path=False) + copy(self, "crashpad_handler_com.com", src=os.path.join(self.source_folder, "out", "Default"), dst=os.path.join(self.package_folder, "bin"), keep_path=False) if self.settings.os == "Windows": - tools.rename(os.path.join(self.package_folder, "bin", "crashpad_handler_com.com"), + rename(self, os.path.join(self.package_folder, "bin", "crashpad_handler_com.com"), os.path.join(self.package_folder, "bin", "crashpad_handler.com")) # Remove accidentally copied libraries. These are used by the executables, not by the libraries. - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*getopt*") + rm(self, "*getopt*", os.path.join(self.package_folder, "lib"), recursive=True) - tools.save(os.path.join(self.package_folder, "lib", "cmake", "crashpad-cxx.cmake"), + save(self, os.path.join(self.package_folder, "lib", "cmake", "crashpad-cxx.cmake"), textwrap.dedent("""\ if(TARGET crashpad::mini_chromium_base) target_compile_features(crashpad::mini_chromium_base INTERFACE cxx_std_14) @@ -239,9 +224,9 @@ def package(self): def package_info(self): self.cpp_info.components["mini_chromium_base"].libs = ["base"] - self.cpp_info.components["mini_chromium_base"].build_modules = [os.path.join(self.package_folder, "lib", "cmake", "crashpad-cxx.cmake")] + self.cpp_info.set_property("cmake_build_modules", [os.path.join(self.package_folder, "lib", "cmake", "crashpad-cxx.cmake")]) self.cpp_info.components["mini_chromium_base"].builddirs = [os.path.join("lib", "cmake")] - if tools.is_apple_os(self.settings.os): + if is_apple_os(self): if self.settings.os == "Macos": self.cpp_info.components["mini_chromium_base"].frameworks = ["ApplicationServices", "CoreFoundation", "Foundation", "IOKit", "Security"] else: # iOS @@ -249,7 +234,7 @@ def package_info(self): self.cpp_info.components["util"].libs = ["util"] self.cpp_info.components["util"].requires = ["mini_chromium_base", "zlib::zlib"] - if tools.is_apple_os(self.settings.os): + if is_apple_os(self): self.cpp_info.components["util"].libs.append("mig_output") if self.settings.os in ("Linux", "FreeBSD"): self.cpp_info.components["util"].libs.append("compat") @@ -277,7 +262,7 @@ def package_info(self): self.cpp_info.components["snapshot"].libs = ["snapshot"] self.cpp_info.components["snapshot"].requires = ["context", "client_common", "mini_chromium_base", "util"] - if tools.is_apple_os(self.settings.os): + if is_apple_os(self): self.cpp_info.components["snapshot"].frameworks.extend(["OpenCL"]) self.cpp_info.components["format"].libs = ["format"] @@ -286,15 +271,11 @@ def package_info(self): self.cpp_info.components["minidump"].libs = ["minidump"] self.cpp_info.components["minidump"].requires = ["snapshot", "mini_chromium_base", "util"] - extra_handler_common_req = [] - if self._has_separate_util_net_lib(): - self.cpp_info.components["net"].libs = ["net"] - extra_handler_common_req = ["net"] + self.cpp_info.components["net"].libs = ["net"] + extra_handler_common_req = ["net"] - extra_handler_req = [] - if self._needs_to_link_tool_support(): - self.cpp_info.components["tool_support"].libs = ["tool_support"] - extra_handler_req = ["tool_support"] + self.cpp_info.components["tool_support"].libs = ["tool_support"] + extra_handler_req = ["tool_support"] self.cpp_info.components["handler_common"].libs = ["handler_common"] self.cpp_info.components["handler_common"].requires = ["client_common", "snapshot", "util"] + extra_handler_common_req @@ -303,5 +284,4 @@ def package_info(self): self.cpp_info.components["handler"].requires = ["client", "util", "handler_common", "minidump", "snapshot"] + extra_handler_req 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/crashpad/all/patches/cci.20210507-0001-fix-openssl-link-order.patch b/recipes/crashpad/all/patches/cci.20210507-0001-fix-openssl-link-order.patch deleted file mode 100644 index fa25c29585519..0000000000000 --- a/recipes/crashpad/all/patches/cci.20210507-0001-fix-openssl-link-order.patch +++ /dev/null @@ -1,23 +0,0 @@ -Order of ssl and crypto is wrong (first ssl, then crypto) ---- util/BUILD.gn -+++ util/BUILD.gn -@@ -402,8 +402,8 @@ - deps += [ "//third_party/boringssl" ] - } else { - libs = [ -- "crypto", - "ssl", -+ "crypto", - ] - } - } -@@ -670,8 +670,8 @@ - deps += [ "//third_party/boringssl" ] - } else { - libs = [ -- "crypto", - "ssl", -+ "crypto", - ] - } - } diff --git a/recipes/crashpad/all/patches/cci.20210507-0002-remove-fPIC-Werror-LTO.patch b/recipes/crashpad/all/patches/cci.20210507-0002-remove-fPIC-Werror-LTO.patch deleted file mode 100644 index dbe02c56b50c4..0000000000000 --- a/recipes/crashpad/all/patches/cci.20210507-0002-remove-fPIC-Werror-LTO.patch +++ /dev/null @@ -1,70 +0,0 @@ ---- third_party/mini_chromium/mini_chromium/build/config/BUILD.gn -+++ third_party/mini_chromium/mini_chromium/build/config/BUILD.gn -@@ -103,7 +103,7 @@ - } - } else if (mini_chromium_is_win) { - cflags = [ -- "/GL", # LTCG. -+ # LTCG. - "/O2", - "/Ob2", # Both explicit and auto inlining. - "/Oy-", # Disable omitting frame pointers, must be after /O2. -@@ -113,9 +113,9 @@ - ldflags = [ - "/OPT:ICF", - "/OPT:REF", -- "/LTCG", -+ - ] -- arflags = [ "/LTCG" ] -+ arflags = [ ] - } - } - -@@ -128,7 +128,7 @@ - cflags = [ - "-Wall", - "-Wendif-labels", -- "-Werror", -+ - "-Wextra", - "-Wextra-semi", - "-Wheader-hygiene", -@@ -239,7 +239,7 @@ - "/D_UNICODE", - "/FS", - "/W4", -- "/WX", -+ - "/Zi", - "/bigobj", # Support larger number of sections in obj file. - "/wd4100", # Unreferenced formal parameter. -@@ -319,7 +319,7 @@ - - if ((mini_chromium_is_posix && !mini_chromium_is_mac && - !mini_chromium_is_ios) || mini_chromium_is_fuchsia) { -- cflags += [ "-fPIC" ] -+ - ldflags += [ - # This must follow Fuchsia’s fdio library above. - "-Wl,--as-needed", ---- third_party/mini_chromium/mini_chromium/build/common.gypi -+++ third_party/mini_chromium/mini_chromium/build/common.gypi -@@ -124,7 +124,7 @@ - - ['OS=="linux" or OS=="android"', { - 'cflags': [ -- '-fPIC', -+ - '-fno-exceptions', - '-fno-strict-aliasing', # See http://crbug.com/32204 - '-fstack-protector-all', # Implies -fstack-protector -@@ -148,7 +148,7 @@ - '_FILE_OFFSET_BITS=64', - ], - 'ldflags': [ -- '-fPIC', -+ - '-pthread', - '-Wl,--as-needed', - '-Wl,-z,noexecstack', diff --git a/recipes/crashpad/all/patches/cci.20210507-0003-compilers-from-env.patch b/recipes/crashpad/all/patches/cci.20210507-0003-compilers-from-env.patch deleted file mode 100644 index 3d2fca3db7ec9..0000000000000 --- a/recipes/crashpad/all/patches/cci.20210507-0003-compilers-from-env.patch +++ /dev/null @@ -1,14 +0,0 @@ -Allow compiling crashpad with gcc (fetch compiler from environment variables) ---- third_party/mini_chromium/mini_chromium/build/config/BUILD.gn -+++ third_party/mini_chromium/mini_chromium/build/config/BUILD.gn -@@ -393,8 +393,8 @@ - ar = rebase_path(clang_path, root_build_dir) + "/bin/llvm-ar" - ld = cxx - } else { -- cc = "clang" -- cxx = "clang++" -+ cc = getenv("CC") -+ cxx = getenv("CXX") - asm = cxx - ld = cxx - diff --git a/recipes/crashpad/all/patches/cci.20210507-0004-use-conan-linux-syscall-support-package.patch b/recipes/crashpad/all/patches/cci.20210507-0004-use-conan-linux-syscall-support-package.patch deleted file mode 100644 index 849ed17734c92..0000000000000 --- a/recipes/crashpad/all/patches/cci.20210507-0004-use-conan-linux-syscall-support-package.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- third_party/lss/lss.h -+++ third_party/lss/lss.h -@@ -16,9 +16,9 @@ - #define CRASHPAD_THIRD_PARTY_LSS_LSS_H_ - - #if defined(CRASHPAD_LSS_SOURCE_EXTERNAL) --#include "third_party/lss/linux_syscall_support.h" -+#include - #elif defined(CRASHPAD_LSS_SOURCE_EMBEDDED) --#include "third_party/lss/lss/linux_syscall_support.h" -+#include - #else - #error Unknown lss source - #endif diff --git a/recipes/crashpad/all/patches/cci.20210507-0005-allow-all-archs.patch b/recipes/crashpad/all/patches/cci.20210507-0005-allow-all-archs.patch deleted file mode 100644 index ae7425fb742f1..0000000000000 --- a/recipes/crashpad/all/patches/cci.20210507-0005-allow-all-archs.patch +++ /dev/null @@ -1,40 +0,0 @@ ---- third_party/mini_chromium/mini_chromium/build/config/BUILD.gn -+++ third_party/mini_chromium/mini_chromium/build/config/BUILD.gn -@@ -193,7 +193,7 @@ - "arm64", - ] - } else { -- assert(false, "Unsupported architecture") -+ print("Unknown architecture -> assume conan knows how to handle it") - } - } - -@@ -268,7 +268,7 @@ - "-m64", - ] - } else { -- assert(false, "Unsupported architecture") -+ print("Unknown architecture -> assume conan knows how to handle it") - } - - # This is currently required by the clang toolchain build that DEPS uses -@@ -302,7 +302,7 @@ - } else if (target_cpu == "x64") { - common_flags += [ "--target=x86_64-fuchsia" ] - } else { -- assert(false, "Unsupported architecture") -+ print("Unknown architecture -> assume conan knows how to handle it") - } - - # fdio is listed in ldflags instead of libs because it’s important for it to ---- util/BUILD.gn -+++ util/BUILD.gn -@@ -145,7 +145,7 @@ if (crashpad_is_mac || crashpad_is_ios) { - "arm64", - ] - } else { -- assert(false, "Unsupported architecture") -+ print("Unknown architecture -> assume conan knows how to handle it") - } - } - diff --git a/recipes/crashpad/all/patches/cci.20210507-0006-mini_chromium-win_helper-py3.patch b/recipes/crashpad/all/patches/cci.20210507-0006-mini_chromium-win_helper-py3.patch deleted file mode 100644 index be8423bbda8e1..0000000000000 --- a/recipes/crashpad/all/patches/cci.20210507-0006-mini_chromium-win_helper-py3.patch +++ /dev/null @@ -1,96 +0,0 @@ ---- third_party/mini_chromium/mini_chromium/build/win_helper.py -+++ third_party/mini_chromium/mini_chromium/build/win_helper.py -@@ -4,7 +4,10 @@ - # Use of this source code is governed by a BSD-style license that can be - # found in the LICENSE file. - --import _winreg -+try: -+ import _winreg -+except ImportError: -+ import winreg as _winreg - import os - import re - import subprocess -@@ -62,7 +65,7 @@ - CreateProcess() documentation for more details.""" - block = '' - nul = '\0' -- for key, value in envvar_dict.iteritems(): -+ for key, value in envvar_dict.items(): - block += key + '=' + value + nul - block += nul - return block -@@ -81,7 +84,7 @@ - archs = ('x86', 'amd64', 'arm64') - result = [] - for arch in archs: -- # Extract environment variables for subprocesses. -+ sys.stderr.write("install_dir {} script_path {}".format(install_dir, script_path)) - args = [os.path.join(install_dir, script_path)] - script_arch_name = arch - if script_path.endswith('SetEnv.cmd') and arch == 'amd64': -@@ -94,12 +97,12 @@ - variables, _ = popen.communicate() - if popen.returncode != 0: - raise Exception('"%s" failed with error %d' % (args, popen.returncode)) -- env = _ExtractImportantEnvironment(variables) -+ env = _ExtractImportantEnvironment(variables.decode()) - - env_block = _FormatAsEnvironmentBlock(env) - basename = 'environment.' + arch - with open(os.path.join(out_dir, basename), 'wb') as f: -- f.write(env_block) -+ f.write(env_block.encode()) - result.append(basename) - return result - -@@ -139,10 +142,10 @@ - link = subprocess.Popen(args, env=env, shell=True, stdout=subprocess.PIPE) - out, _ = link.communicate() - for line in out.splitlines(): -- if (not line.startswith(' Creating library ') and -- not line.startswith('Generating code') and -- not line.startswith('Finished generating code')): -- print line -+ if (not line.startswith(b' Creating library ') and -+ not line.startswith(b'Generating code') and -+ not line.startswith(b'Finished generating code')): -+ print(line) - return link.returncode - - def ExecAsmWrapper(self, arch, *args): -@@ -152,11 +155,11 @@ - stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - out, _ = popen.communicate() - for line in out.splitlines(): -- if (not line.startswith('Copyright (C) Microsoft Corporation') and -- not line.startswith('Microsoft (R) Macro Assembler') and -- not line.startswith(' Assembling: ') and -+ if (not line.startswith(b'Copyright (C) Microsoft Corporation') and -+ not line.startswith(b'Microsoft (R) Macro Assembler') and -+ not line.startswith(b' Assembling: ') and - line): -- print line -+ print(line) - return popen.returncode - - def ExecGetVisualStudioData(self, outdir, toolchain_path): -@@ -178,7 +181,7 @@ - 'Microsoft Visual Studio', 'Installer', 'vswhere.exe') - if os.path.exists(vswhere_path): - installation_path = subprocess.check_output( -- [vswhere_path, '-latest', '-property', 'installationPath']).strip() -+ [vswhere_path, '-latest', '-property', 'installationPath']).strip().decode() - if installation_path: - return (installation_path, - os.path.join('VC', 'Auxiliary', 'Build', 'vcvarsall.bat')) -@@ -207,7 +210,7 @@ - x86_environment_file = "%s" - x64_environment_file = "%s" - arm64_environment_file = "%s"''' % (install_dir, x86_file, x64_file, arm64_file) -- print result -+ print(result) - return 0 - - def ExecStamp(self, path): diff --git a/recipes/crashpad/all/test_package/CMakeLists.txt b/recipes/crashpad/all/test_package/CMakeLists.txt index 6c1d84c7e3d82..371eb858142f4 100644 --- a/recipes/crashpad/all/test_package/CMakeLists.txt +++ b/recipes/crashpad/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -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() +find_package(crashpad REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE crashpad::crashpad) set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17) diff --git a/recipes/crashpad/all/test_package/conanfile.py b/recipes/crashpad/all/test_package/conanfile.py index a0d87c14b0333..46a8950cd70ed 100644 --- a/recipes/crashpad/all/test_package/conanfile.py +++ b/recipes/crashpad/all/test_package/conanfile.py @@ -1,10 +1,24 @@ -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, save, load 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 generate(self): + save(self, os.path.join(self.generators_folder, "bindir"), + os.path.join(self.dependencies["crashpad"].package_folder, "bin")) def build(self): cmake = CMake(self) @@ -12,14 +26,14 @@ 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") - handler_exe = "crashpad_handler.exe" if self.settings.os == "Windows" else "crashpad_handler" - handler_bin_path = os.path.join(self.deps_cpp_info["crashpad"].rootpath, "bin", handler_exe) - self.run("%s %s/db %s" % (bin_path, test_env_dir, handler_bin_path), run_environment=True) + mkdir(self, test_env_dir) + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + bindir = load(self, os.path.join(self.generators_folder, "bindir")) + handler_exe = "crashpad_handler" + (".exe" if self.settings.os == "Windows" else "") + handler_bin_path = os.path.join(bindir, handler_exe) + self.run(f"{bin_path} {test_env_dir}/db {handler_bin_path}", env="conanrun") if self.settings.os == "Windows": - handler_exe = "crashpad_handler.com" - handler_bin_path = os.path.join(self.deps_cpp_info["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(bindir, "crashpad_handler.com") + self.run(f"{bin_path} {test_env_dir}/db {handler_bin_path}", env="conanrun") diff --git a/recipes/crashpad/config.yml b/recipes/crashpad/config.yml index 104465b6c7315..63942e1b1104b 100644 --- a/recipes/crashpad/config.yml +++ b/recipes/crashpad/config.yml @@ -1,5 +1,3 @@ versions: - "cci.20210507": - folder: all "cci.20220219": folder: all diff --git a/recipes/crc32c/all/conanfile.py b/recipes/crc32c/all/conanfile.py index 2ffae46055537..826861fd301fd 100644 --- a/recipes/crc32c/all/conanfile.py +++ b/recipes/crc32c/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 crc32cConan(ConanFile): @@ -15,6 +15,7 @@ class crc32cConan(ConanFile): homepage = "https://github.com/google/crc32c" license = "BSD-3-Clause" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -25,29 +26,32 @@ class crc32cConan(ConanFile): "fPIC": True, } + @property + 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: - 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, self._min_cppstd) + 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) - if not valid_min_cppstd(self, 11): - tc.variables["CMAKE_CXX_STANDARD"] = 11 + if not valid_min_cppstd(self, self._min_cppstd): + tc.variables["CMAKE_CXX_STANDARD"] = self._min_cppstd tc.variables["CRC32C_BUILD_TESTS"] = False tc.variables["CRC32C_BUILD_BENCHMARKS"] = False tc.variables["CRC32C_INSTALL"] = True diff --git a/recipes/crc32c/all/test_package/conanfile.py b/recipes/crc32c/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/crc32c/all/test_package/conanfile.py +++ b/recipes/crc32c/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/crc32c/all/test_v1_package/CMakeLists.txt b/recipes/crc32c/all/test_v1_package/CMakeLists.txt index 4a774c8062feb..0d20897301b68 100644 --- a/recipes/crc32c/all/test_v1_package/CMakeLists.txt +++ b/recipes/crc32c/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(Crc32c CONFIG REQUIRED) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE Crc32c::crc32c) -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/crc_cpp/all/conandata.yml b/recipes/crc_cpp/all/conandata.yml index 5080c58c69521..ae324a0321c62 100644 --- a/recipes/crc_cpp/all/conandata.yml +++ b/recipes/crc_cpp/all/conandata.yml @@ -1,10 +1,13 @@ sources: - "1.0.0": - url: "https://github.com/AshleyRoll/crc_cpp/archive/refs/tags/v1.0.0.tar.gz" - sha256: "035ed616e0662eddbe7db7c920faaef99bbeb8953ebf98c3bb76cb81a2c4de2b" - "1.0.1": - url: "https://github.com/AshleyRoll/crc_cpp/archive/refs/tags/v1.0.1.tar.gz" - sha256: "865a0e110bf7e94061ceef1683947a7788b54f932c7ce3848edc89d36e1aea26" + "1.2.0": + url: "https://github.com/AshleyRoll/crc_cpp/archive/refs/tags/v1.2.0.tar.gz" + sha256: "508a609d9ef12c3088ed17a8ed820c965161a36dd90738c7358333fbfbe96af5" "1.1.0": url: "https://github.com/AshleyRoll/crc_cpp/archive/refs/tags/v1.1.0.tar.gz" sha256: "50e46e3c44eb39809f6697b253f7b36c089642d7b7f2ebe2f75adf23c50676be" + "1.0.1": + url: "https://github.com/AshleyRoll/crc_cpp/archive/refs/tags/v1.0.1.tar.gz" + sha256: "865a0e110bf7e94061ceef1683947a7788b54f932c7ce3848edc89d36e1aea26" + "1.0.0": + url: "https://github.com/AshleyRoll/crc_cpp/archive/refs/tags/v1.0.0.tar.gz" + sha256: "035ed616e0662eddbe7db7c920faaef99bbeb8953ebf98c3bb76cb81a2c4de2b" diff --git a/recipes/crc_cpp/all/conanfile.py b/recipes/crc_cpp/all/conanfile.py index 4ccb993ef97a2..c77936e91ebea 100644 --- a/recipes/crc_cpp/all/conanfile.py +++ b/recipes/crc_cpp/all/conanfile.py @@ -1,6 +1,9 @@ -from conan import ConanFile, tools -from conan.tools.scm 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.50.0" @@ -9,45 +12,51 @@ class Crc_CppConan(ConanFile): name = "crc_cpp" description = "A header only constexpr / compile time small-table based CRC library for C++17 and newer" - topics = "crc_cpp", "crc", "constexpr", "cpp17", "cpp20", "header-only" - settings = "compiler", "os" + topics = ("crc", "constexpr", "cpp17", "cpp20", "header-only") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/AshleyRoll/crc_cpp" license = "MIT" + package_type = "header-library" + 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 _supported_compiler(self): - compiler = str(self.settings.compiler) - version = Version(self.settings.compiler.version) - if compiler == "Visual Studio" and version >= "15": - return True - elif compiler == "gcc" and version >= "9": - return True - elif compiler == "clang" and version >= "5": - return True - elif compiler == "apple-clang" and version >= "10": - return True - else: - self.output.warn("{} recipe lacks information about the {} compiler standard version support".format(self.name, compiler)) - return False + def _compilers_minimum_version(self): + return { + "gcc": "9", + "clang": "5", + "apple-clang": "10", + "Visual Studio": "15", + "msvc": "191", + } + + 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.build.check_min_cppstd(self, "17") - if not self._supported_compiler: - raise ConanInvalidConfiguration("crc_cpp: Unsupported compiler: {}-{} " - "Minimum C++17 constexpr features required.".format(self.settings.compiler, self.settings.compiler.version)) + 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.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 package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - self.copy(pattern="*", 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_id(self): - self.info.header_only() + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/crc_cpp/all/test_package/CMakeLists.txt b/recipes/crc_cpp/all/test_package/CMakeLists.txt index d41bc6dd30265..ba67401c34bcc 100644 --- a/recipes/crc_cpp/all/test_package/CMakeLists.txt +++ b/recipes/crc_cpp/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) project(test_package LANGUAGES CXX) -set(CMAKE_CXX_STANDARD 17) -set(CMAKE_CXX_STANDARD_REQUIRED ON) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(crc_cpp REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE crc_cpp::crc_cpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/crc_cpp/all/test_package/conanfile.py b/recipes/crc_cpp/all/test_package/conanfile.py index 34a0bcae95438..0a6bc68712d90 100644 --- a/recipes/crc_cpp/all/test_package/conanfile.py +++ b/recipes/crc_cpp/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", "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 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/crc_cpp/all/test_v1_package/CMakeLists.txt b/recipes/crc_cpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/crc_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/crc_cpp/all/test_v1_package/conanfile.py b/recipes/crc_cpp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/crc_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/crc_cpp/config.yml b/recipes/crc_cpp/config.yml index f0842436f445a..de59a653e157c 100644 --- a/recipes/crc_cpp/config.yml +++ b/recipes/crc_cpp/config.yml @@ -1,7 +1,9 @@ versions: - "1.0.0": + "1.2.0": + folder: "all" + "1.1.0": folder: "all" "1.0.1": folder: "all" - "1.1.0": + "1.0.0": folder: "all" diff --git a/recipes/crcpp/all/conandata.yml b/recipes/crcpp/all/conandata.yml new file mode 100644 index 0000000000000..f414dda91410c --- /dev/null +++ b/recipes/crcpp/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.2.0.0": + url: "https://github.com/d-bahr/CRCpp/archive/refs/tags/release-1.2.0.0.tar.gz" + sha256: "382d399b939207d81537a874ec4b05abc7f59772be58425a0dd048711d43db14" diff --git a/recipes/crcpp/all/conanfile.py b/recipes/crcpp/all/conanfile.py new file mode 100644 index 0000000000000..3315a073a6447 --- /dev/null +++ b/recipes/crcpp/all/conanfile.py @@ -0,0 +1,51 @@ +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 CRCPPConan(ConanFile): + name = "crcpp" + description = "Easy to use and fast C++ CRC library." + license = "BSD-3-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/d-bahr/CRCpp/" + topics = ("crc", "header-only") + package_type = "header-library" + 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, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + copy( + self, + "*.h", + os.path.join(self.source_folder, "inc"), + os.path.join(self.package_folder, "include"), + ) + + def package_info(self): + # Folders not used for header-only + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/crcpp/all/test_package/CMakeLists.txt b/recipes/crcpp/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..365caf83cf9bb --- /dev/null +++ b/recipes/crcpp/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(crcpp REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE crcpp::crcpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/crcpp/all/test_package/conanfile.py b/recipes/crcpp/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/crcpp/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/crcpp/all/test_package/test_package.cpp b/recipes/crcpp/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..4546a70d708c2 --- /dev/null +++ b/recipes/crcpp/all/test_package/test_package.cpp @@ -0,0 +1,14 @@ +#include +#include +#include "CRC.h" + + +int main(void) { + const char myString[] = { 'H', 'E', 'L', 'L', 'O', ' ', 'W', 'O', 'R', 'L', 'D' }; + + std::uint32_t crc = CRC::Calculate(myString, sizeof(myString), CRC::CRC_32()); + + std::cout << std::hex << crc; + + return 0; +} diff --git a/recipes/crcpp/config.yml b/recipes/crcpp/config.yml new file mode 100644 index 0000000000000..f3be59d8c2e85 --- /dev/null +++ b/recipes/crcpp/config.yml @@ -0,0 +1,3 @@ +versions: + "1.2.0.0": + folder: all diff --git a/recipes/create-dmg/all/conandata.yml b/recipes/create-dmg/all/conandata.yml index 3bee38ab2012d..ee05f9df79b21 100644 --- a/recipes/create-dmg/all/conandata.yml +++ b/recipes/create-dmg/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.2.1": + url: "https://github.com/create-dmg/create-dmg/archive/refs/tags/v1.2.1.tar.gz" + sha256: "434746a84ed7e4a04b1d1977503e2a23ff79dac480cb86b24aae7b112e3b7524" "1.1.0": url: "https://github.com/create-dmg/create-dmg/archive/refs/tags/v1.1.0.tar.gz" sha256: "d50e14a00b73a3f040732b4cfa11361f5786521719059ce2dfcccd9088d3bf32" @@ -6,7 +9,11 @@ sources: url: "https://github.com/create-dmg/create-dmg/archive/refs/tags/v1.0.10.tar.gz" sha256: "8fd43498988f6d334d483faf4e4a330a25228784995d72c57e4565967d09e6ab" patches: - "1.1.0": - - patch_file: "patches/0001-change-share-to-res.patch" + "1.2.1": + - patch_file: "patches/1.2.1-0001-change-share-to-res.patch" + patch_description: "Change share folder to res" patch_type: "conan" + "1.1.0": + - patch_file: "patches/1.1.0-0001-change-share-to-res.patch" patch_description: "Change share folder to res" + patch_type: "conan" diff --git a/recipes/create-dmg/all/conanfile.py b/recipes/create-dmg/all/conanfile.py index 52e6fe840c8e2..e4d468f0643af 100644 --- a/recipes/create-dmg/all/conanfile.py +++ b/recipes/create-dmg/all/conanfile.py @@ -11,9 +11,10 @@ class CreateDmgConan(ConanFile): name = "create-dmg" description = "A shell script to build fancy DMGs" license = "MIT" - topics = "command-line", "dmg" - homepage = "https://github.com/create-dmg/create-dmg" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/create-dmg/create-dmg" + topics = ("command-line", "dmg") + package_type = "application" settings = "os", "arch", "compiler", "build_type" def export_sources(self): @@ -30,8 +31,7 @@ def validate(self): 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def build(self): apply_conandata_patches(self) @@ -39,7 +39,7 @@ def build(self): def package(self): 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")) + copy(self, pattern="*", dst=os.path.join(self.package_folder, "res"), src=os.path.join(self.source_folder, "support")) rmdir(self, os.path.join(self.package_folder, "share")) diff --git a/recipes/create-dmg/all/patches/0001-change-share-to-res.patch b/recipes/create-dmg/all/patches/1.1.0-0001-change-share-to-res.patch similarity index 100% rename from recipes/create-dmg/all/patches/0001-change-share-to-res.patch rename to recipes/create-dmg/all/patches/1.1.0-0001-change-share-to-res.patch diff --git a/recipes/create-dmg/all/patches/1.2.1-0001-change-share-to-res.patch b/recipes/create-dmg/all/patches/1.2.1-0001-change-share-to-res.patch new file mode 100644 index 0000000000000..8befadff184bc --- /dev/null +++ b/recipes/create-dmg/all/patches/1.2.1-0001-change-share-to-res.patch @@ -0,0 +1,13 @@ +diff --git a/create-dmg b/create-dmg +index d2039bd..dc35068 100755 +--- a/create-dmg ++++ b/create-dmg +@@ -320,7 +320,7 @@ else + # We're running inside an installed location + bin_dir="$SCRIPT_DIR" + prefix_dir=$(dirname "$bin_dir") +- CDMG_SUPPORT_DIR="$prefix_dir/share/create-dmg/support" ++ CDMG_SUPPORT_DIR="$prefix_dir/res" + fi + + if [[ -z "$VOLUME_NAME" ]]; then diff --git a/recipes/create-dmg/config.yml b/recipes/create-dmg/config.yml index d8aafe5a32208..cc3bbf3e41e1f 100644 --- a/recipes/create-dmg/config.yml +++ b/recipes/create-dmg/config.yml @@ -1,4 +1,6 @@ versions: + "1.2.1": + folder: all "1.1.0": folder: all "1.0.10": diff --git a/recipes/croncpp/all/CMakeLists.txt b/recipes/croncpp/all/CMakeLists.txt deleted file mode 100644 index 46247ce0c956e..0000000000000 --- a/recipes/croncpp/all/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(conan_wrapper CXX) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -set(CMAKE_CXX_STANDARD 11) - -add_subdirectory(source_subfolder) diff --git a/recipes/croncpp/all/conandata.yml b/recipes/croncpp/all/conandata.yml index 7f25de8a50772..30cf4b9d03ad4 100644 --- a/recipes/croncpp/all/conandata.yml +++ b/recipes/croncpp/all/conandata.yml @@ -1,4 +1,4 @@ sources: - "cci.20220503": - url: "https://github.com/mariusbancila/croncpp/archive/5c28f410db1af9507ef8469c9796a7070e5e8e2e.tar.gz" - sha256: "cabc480c78ebf12b11bd9fcd705a7ecb1c85ac88a8c9debe8de67f30abd808a8" + "2023.03.30": + url: "https://github.com/mariusbancila/croncpp/archive/refs/tags/v2023.03.30.tar.gz" + sha256: "0731b7f900a670c009585eb5e9639722aeff6531dbbd5bfc9ce895459733837e" diff --git a/recipes/croncpp/all/conanfile.py b/recipes/croncpp/all/conanfile.py index cecf595a5a249..7c51f39f65111 100644 --- a/recipes/croncpp/all/conanfile.py +++ b/recipes/croncpp/all/conanfile.py @@ -1,45 +1,53 @@ +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 -import functools -from conans import ConanFile, CMake, tools -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" + class CroncppConan(ConanFile): name = "croncpp" description = "A C++11/14/17 header-only cross-platform library for handling CRON expressions" - topics = ("cron", "header-only") license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/mariusbancila/croncpp/" + topics = ("cron", "header-only") + + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" - generators = "cmake", + no_copy_source = True @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 11 - def export_sources(self): - self.copy("CMakeLists.txt") + 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"): - 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) - - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.configure() - return cmake + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): - self.copy("LICENSE*", "licenses", self._source_subfolder) - cmake = self._configure_cmake() - cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + copy( + self, + "*.h", + os.path.join(self.source_folder, "include"), + os.path.join(self.package_folder, "include"), + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + self.cpp_info.set_property("cmake_file_name", "croncpp") + self.cpp_info.set_property("cmake_target_name","croncpp::croncpp") diff --git a/recipes/croncpp/all/test_package/CMakeLists.txt b/recipes/croncpp/all/test_package/CMakeLists.txt index 1bb4c146bf257..0377a66e57597 100644 --- a/recipes/croncpp/all/test_package/CMakeLists.txt +++ b/recipes/croncpp/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(croncpp REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/croncpp/all/test_package/conanfile.py b/recipes/croncpp/all/test_package/conanfile.py index 6cae150e6701a..fae501d0afb9e 100644 --- a/recipes/croncpp/all/test_package/conanfile.py +++ b/recipes/croncpp/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 CroncppConan(ConanFile): + +class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain" + 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/croncpp/config.yml b/recipes/croncpp/config.yml index 162ec03638ac6..858a21517c5cd 100644 --- a/recipes/croncpp/config.yml +++ b/recipes/croncpp/config.yml @@ -1,3 +1,3 @@ versions: - "cci.20220503": + "2023.03.30": folder: "all" diff --git a/recipes/crossdb/all/conandata.yml b/recipes/crossdb/all/conandata.yml new file mode 100644 index 0000000000000..37ed5c22fe039 --- /dev/null +++ b/recipes/crossdb/all/conandata.yml @@ -0,0 +1,10 @@ +sources: + "0.11.0": + url: "https://github.com/crossdb-org/crossdb/archive/refs/tags/0.11.0.tar.gz" + sha256: "ca72397cfe14317b3774988fe1747bfd3daa8b6dfa8e151fa84d2e58987ab5c2" + "0.10.0": + url: "https://github.com/crossdb-org/crossdb/archive/refs/tags/0.10.0.tar.gz" + sha256: "8b4ed2063f508bc3353d6346a7d9bf78bb04fe05ddfe6e86f1f33cc44f71b2d4" + "0.9.0": + url: "https://github.com/crossdb-org/crossdb/archive/refs/tags/0.9.0.tar.gz" + sha256: "04defc43f0b5102cc6a341ba9e328302416982c04cc4c59bc16aef19cc1b020c" diff --git a/recipes/crossdb/all/conanfile.py b/recipes/crossdb/all/conanfile.py new file mode 100644 index 0000000000000..4af53a29f2db7 --- /dev/null +++ b/recipes/crossdb/all/conanfile.py @@ -0,0 +1,55 @@ +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 +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.scm import Version +import os + +required_conan_version = ">=1.53.0" + +class CrossDBConan(ConanFile): + name = "crossdb" + description = "Ultra High-performance Lightweight Embedded and Server OLTP RDBMS" + license = "MPL-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/crossdb-org/crossdb" + topics = ("database", "oltp", "embedded") + package_type = "shared-library" + settings = "os", "arch", "compiler", "build_type" + + def configure(self): + 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 is_msvc(self): + raise ConanInvalidConfiguration(f"${self.ref} does not support MSVC") + + 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, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + fix_apple_shared_install_name(self) + + def package_info(self): + self.cpp_info.libs = ["crossdb"] + + if Version(self.version) >= "0.10.0" and self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("pthread") diff --git a/recipes/crossdb/all/test_package/CMakeLists.txt b/recipes/crossdb/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..f725ff69c516e --- /dev/null +++ b/recipes/crossdb/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) + +find_package(crossdb REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE crossdb::crossdb) diff --git a/recipes/crossdb/all/test_package/conanfile.py b/recipes/crossdb/all/test_package/conanfile.py new file mode 100644 index 0000000000000..ef5d7042163ec --- /dev/null +++ b/recipes/crossdb/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/crossdb/all/test_package/test_package.c b/recipes/crossdb/all/test_package/test_package.c new file mode 100644 index 0000000000000..37adfa21e3091 --- /dev/null +++ b/recipes/crossdb/all/test_package/test_package.c @@ -0,0 +1,9 @@ +#include +#include + +#include + +int main () { + printf("Cross DB Version: %s\n", xdb_version()); + return EXIT_SUCCESS; +} diff --git a/recipes/crossdb/config.yml b/recipes/crossdb/config.yml new file mode 100644 index 0000000000000..f474fc5aafc7f --- /dev/null +++ b/recipes/crossdb/config.yml @@ -0,0 +1,7 @@ +versions: + "0.11.0": + folder: all + "0.10.0": + folder: all + "0.9.0": + folder: all diff --git a/recipes/crossguid/all/conandata.yml b/recipes/crossguid/all/conandata.yml new file mode 100644 index 0000000000000..2fdb90ed9775b --- /dev/null +++ b/recipes/crossguid/all/conandata.yml @@ -0,0 +1,9 @@ +sources: + "0.2.2": + url: "https://github.com/graeme-hill/crossguid/archive/refs/tags/v0.2.2.tar.gz" + sha256: "48321928473c682b0cdc7e17bbd3390f79f4b98ab22fef3b81a852dda81fd195" +patches: + "0.2.2": + - patch_file: "patches/0001-add-installer.patch" + patch_description: "add installer definition" + patch_type: "conan" diff --git a/recipes/crossguid/all/conanfile.py b/recipes/crossguid/all/conanfile.py new file mode 100644 index 0000000000000..562232c007b4a --- /dev/null +++ b/recipes/crossguid/all/conanfile.py @@ -0,0 +1,84 @@ +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, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.apple import is_apple_os +import os + +required_conan_version = ">=1.53.0" + +class CrossGUIDConan(ConanFile): + name = "crossguid" + description = "Lightweight cross platform C++ GUID/UUID library" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/graeme-hill/crossguid" + topics = ("guid", "uuid") + package_type = "library" + 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): + if not (self.settings.os in ["Windows", "Android"] or is_apple_os(self)): + self.requires("util-linux-libuuid/2.39.2") + + 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 generate(self): + tc = CMakeToolchain(self) + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + tc.variables["XG_TESTS"] = False + 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 = ["xg"] + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") + if self.settings.os == "Android": + self.cpp_info.defines.append("GUID_ANDROID") + if is_apple_os(self): + self.cpp_info.frameworks.append("CoreFoundation") diff --git a/recipes/crossguid/all/patches/0001-add-installer.patch b/recipes/crossguid/all/patches/0001-add-installer.patch new file mode 100644 index 0000000000000..c3a387902568c --- /dev/null +++ b/recipes/crossguid/all/patches/0001-add-installer.patch @@ -0,0 +1,41 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 761dbc6..b5ddd74 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -27,13 +27,32 @@ elseif(APPLE) + elseif(ANDROID) + target_compile_definitions(xg PRIVATE GUID_ANDROID) + else() +- find_package(Libuuid REQUIRED) +- if (NOT LIBUUID_FOUND) ++ find_package(libuuid REQUIRED) ++ if (NOT libuuid_FOUND) + message(FATAL_ERROR + "You might need to run 'sudo apt-get install uuid-dev' or similar") + endif() +- include_directories(${LIBUUID_INCLUDE_DIR}) +- target_link_libraries(xg ${LIBUUID_LIBRARY}) ++ # include_directories(${LIBUUID_INCLUDE_DIR}) ++ target_link_libraries(xg libuuid::libuuid) + add_definitions(-DGUID_LIBUUID) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic") + endif() ++ ++include(GNUInstallDirs) ++ ++set(CROSSGUID_INC_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}") ++set(CROSSGUID_RUNTIME_INSTALL_DIR "${CMAKE_INSTALL_BINDIR}") ++set(CROSSGUID_LIBRARY_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}") ++set(CROSSGUID_ARCHIVE_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}") ++set(CROSSGUID_FRAMEWORK_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}") ++ ++# Install target ++install(TARGETS xg EXPORT crossguidTargets ++ RUNTIME DESTINATION ${CROSSGUID_RUNTIME_INSTALL_DIR} ++ LIBRARY DESTINATION ${CROSSGUID_LIBRARY_INSTALL_DIR} ++ ARCHIVE DESTINATION ${CROSSGUID_ARCHIVE_INSTALL_DIR} ++ FRAMEWORK DESTINATION ${CROSSGUID_FRAMEWORK_INSTALL_DIR}) ++ ++# Install headers ++install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/Guid.hpp" ++ DESTINATION ${CROSSGUID_INC_INSTALL_DIR}) diff --git a/recipes/crossguid/all/test_package/CMakeLists.txt b/recipes/crossguid/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..d114028593025 --- /dev/null +++ b/recipes/crossguid/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(crossguid REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE crossguid::crossguid) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/crossguid/all/test_package/conanfile.py b/recipes/crossguid/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fb96656f203 --- /dev/null +++ b/recipes/crossguid/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/crossguid/all/test_package/test_package.cpp b/recipes/crossguid/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..1fcc33b8fd5e8 --- /dev/null +++ b/recipes/crossguid/all/test_package/test_package.cpp @@ -0,0 +1,11 @@ +#include + +#include "Guid.hpp" + +int main(void) { + auto const g = xg::newGuid(); + + std::cout << "Here is a guid: " << g << std::endl; + + return 0; +} diff --git a/recipes/crossguid/config.yml b/recipes/crossguid/config.yml new file mode 100644 index 0000000000000..cd4b8da537c38 --- /dev/null +++ b/recipes/crossguid/config.yml @@ -0,0 +1,3 @@ +versions: + "0.2.2": + folder: all diff --git a/recipes/crowcpp-crow/all/conandata.yml b/recipes/crowcpp-crow/all/conandata.yml index 3aed5442c57ab..91575e2322dc2 100644 --- a/recipes/crowcpp-crow/all/conandata.yml +++ b/recipes/crowcpp-crow/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "1.2.0": + url: "https://github.com/CrowCpp/crow/archive/refs/tags/v1.2.0.tar.gz" + sha256: "c80d0b23c6a20f8aa6fe776669dc8a9fb984046891d2f70bfc0539d16998164b" + "1.1.0": + url: "https://github.com/CrowCpp/crow/archive/refs/tags/v1.1.0.tar.gz" + sha256: "f4281c3f25769dbc82437dd4199a8ba07b2a6e8a2f42e36a6fd805c493aae5ca" + "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" @@ -14,20 +23,3 @@ sources: "0.3+2": 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" - sha256: "95538db88fba73c0bc87bbc40b62dcf488012c133a895634ade015009ebb4f25" - "0.2": - url: "https://github.com/CrowCpp/crow/archive/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_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" diff --git a/recipes/crowcpp-crow/all/conanfile.py b/recipes/crowcpp-crow/all/conanfile.py index ac9c4ed132538..5e2434c0c17d3 100644 --- a/recipes/crowcpp-crow/all/conanfile.py +++ b/recipes/crowcpp-crow/all/conanfile.py @@ -1,82 +1,132 @@ -from conans import ConanFile, tools, CMake +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 +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") + package_type = "header-library" 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 configure(self): + if Version(self.version) < "1.0": + del self.options.with_ssl + del self.options.with_compression - def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("boost/1.77.0") - if self.version == "0.2": - self.requires("openssl/1.1.1l") + if Version(self.version) < "1.1.0": + self.requires("boost/1.83.0") + else: + self.requires("asio/1.29.0", transitive_headers=True) + if Version(self.version) >= "1.0": + if self.options.with_ssl: + self.requires("openssl/[>=1.1 <3]") + if self.options.with_compression: + self.requires("zlib/[>=1.2.11 <2]") + + 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 build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + 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): 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 = [] + + if Version(self.version) < "1.1.0": + self.cpp_info.requires.append("boost::headers") + else: + self.cpp_info.requires.append("asio::asio") if self.settings.os in ("FreeBSD", "Linux"): self.cpp_info.system_libs = ["pthread"] + if self.settings.os == "Windows": + self.cpp_info.system_libs = ["wsock32", "ws2_32"] + + 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") diff --git a/recipes/crowcpp-crow/all/patches/0.2/0001-normalize-buildsystem.patch b/recipes/crowcpp-crow/all/patches/0.2/0001-normalize-buildsystem.patch deleted file mode 100644 index 67c9be1d0235b..0000000000000 --- a/recipes/crowcpp-crow/all/patches/0.2/0001-normalize-buildsystem.patch +++ /dev/null @@ -1,31 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index f00e9a9..61961da 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -1,6 +1,7 @@ - cmake_minimum_required(VERSION 3.15) - project (crow_all) - -+if(BUILD_TESTING) - set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/") - - find_package(Tcmalloc) -@@ -43,15 +44,17 @@ include_directories("${PROJECT_INCLUDE_DIR}") - include_directories("${PROJECT_SOURCE_DIR}") - - add_subdirectory(examples) -+endif() - - if (MSVC) - else() -+ if (BUILD_TESTING) - add_subdirectory(tests) - - enable_testing() - add_test(NAME crow_test COMMAND ${CMAKE_CURRENT_BINARY_DIR}/tests/unittest) - add_test(NAME template_test COMMAND ${CMAKE_CURRENT_BINARY_DIR}/tests/template/test.py WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/tests/template) -- -+ endif() - - add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/crow_all.h - COMMAND python ${PROJECT_SOURCE_DIR}/scripts/merge_all.py diff --git a/recipes/crowcpp-crow/all/patches/0.2/0002-replace-uint.patch b/recipes/crowcpp-crow/all/patches/0.2/0002-replace-uint.patch deleted file mode 100644 index c6f95ea173f09..0000000000000 --- a/recipes/crowcpp-crow/all/patches/0.2/0002-replace-uint.patch +++ /dev/null @@ -1,26 +0,0 @@ -diff --git a/include/crow/http_connection.h b/include/crow/http_connection.h -index 2216687..04a992d 100644 ---- a/include/crow/http_connection.h -+++ b/include/crow/http_connection.h -@@ -627,7 +627,7 @@ namespace crow - - boost::array buffer_; - -- const uint res_stream_threshold_ = 1048576; -+ const unsigned res_stream_threshold_ = 1048576; - - HTTPParser parser_; - request req_; -diff --git a/include/crow/multipart.h b/include/crow/multipart.h -index 7deb8d4..7b63c20 100644 ---- a/include/crow/multipart.h -+++ b/include/crow/multipart.h -@@ -48,7 +48,7 @@ namespace crow - std::stringstream str; - std::string delimiter = dd + boundary; - -- for (uint i=0 ; i -+#include -+#include -+#include - - #include - #include --- a/pem_common.h +++ b/pem_common.h @@ -10,9 +10,10 @@ @@ -54,119 +37,3 @@ #include "pem.h" #include ---- a/pem_read.cpp -+++ b/pem_read.cpp -@@ -10,27 +10,27 @@ - #include - #include - --#include "cryptlib.h" --#include "secblock.h" --#include "nbtheory.h" --#include "gfpcrypt.h" --#include "camellia.h" --#include "smartptr.h" --#include "filters.h" --#include "base64.h" --#include "queue.h" --#include "modes.h" --#include "asn.h" --#include "aes.h" --#include "idea.h" --#include "hex.h" -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include - - #include "pem.h" - #include "pem_common.h" - - #define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1 --#include "des.h" --#include "md5.h" -+#include -+#include - - ////////////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////////////// ---- a/pem_test.cxx -+++ b/pem_test.cxx -@@ -4,13 +4,14 @@ - #include - #include - --#include "cryptlib.h" --#include "integer.h" --#include "eccrypto.h" --#include "osrng.h" --#include "files.h" --#include "rsa.h" --#include "dsa.h" -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ - #include "pem.h" - - int main(int argc, char* argv[]) ---- a/pem_write.cpp -+++ b/pem_write.cpp -@@ -10,27 +10,27 @@ - #include - #include - --#include "cryptlib.h" --#include "secblock.h" --#include "camellia.h" --#include "smartptr.h" --#include "filters.h" --#include "base64.h" --#include "files.h" --#include "queue.h" --#include "modes.h" --#include "osrng.h" --#include "asn.h" --#include "aes.h" --#include "idea.h" --#include "hex.h" -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include - - #include "pem.h" - #include "pem_common.h" - - #define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1 --#include "des.h" --#include "md5.h" -+#include -+#include - - ////////////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////////////// diff --git a/recipes/cryptopp-pem/all/test_package/CMakeLists.txt b/recipes/cryptopp-pem/all/test_package/CMakeLists.txt index f9ceeed7804cb..fdb362acfd0cf 100644 --- a/recipes/cryptopp-pem/all/test_package/CMakeLists.txt +++ b/recipes/cryptopp-pem/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) +find_package(cryptopp-pem REQUIRED CONFIG) find_package(cryptopp-pem) diff --git a/recipes/cryptopp-pem/all/test_package/conanfile.py b/recipes/cryptopp-pem/all/test_package/conanfile.py index 19e6a0c06e3d8..ef5d7042163ec 100644 --- a/recipes/cryptopp-pem/all/test_package/conanfile.py +++ b/recipes/cryptopp-pem/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cryptopp-pem/all/test_v1_package/CMakeLists.txt b/recipes/cryptopp-pem/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/cryptopp-pem/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/cryptopp-pem/all/test_v1_package/conanfile.py b/recipes/cryptopp-pem/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/cryptopp-pem/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/cryptopp/all/conandata.yml b/recipes/cryptopp/all/conandata.yml index b34682e4296a3..86f5bef002754 100644 --- a/recipes/cryptopp/all/conandata.yml +++ b/recipes/cryptopp/all/conandata.yml @@ -1,11 +1,25 @@ sources: + "8.9.0": + source: + url: "https://github.com/weidai11/cryptopp/archive/CRYPTOPP_8_9_0.tar.gz" + sha256: "ab5174b9b5c6236588e15a1aa1aaecb6658cdbe09501c7981ac8db276a24d9ab" + cmake: + url: "https://github.com/abdes/cryptopp-cmake/archive/CRYPTOPP_8_9_0.tar.gz" + sha256: "191d69061c56602de1610ebf03b44dcf75636006e7e60ef8105bee6472ec0caf" + "8.8.0": + source: + url: "https://github.com/weidai11/cryptopp/archive/CRYPTOPP_8_8_0.tar.gz" + sha256: "f8b8f632533b279ee297694e651e9204824bba6022ce66e60ebebb08b551fe7a" + cmake: + url: "https://github.com/abdes/cryptopp-cmake/archive/CRYPTOPP_8_8_0.tar.gz" + sha256: "a10068ab47fb46785dfe43ebe45369008855b03f6711ac7d1af6f45aa9238290" "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" + url: "https://github.com/abdes/cryptopp-cmake/archive/CRYPTOPP_8_7_0_1.tar.gz" + sha256: "49800456bec6432eff4a798d37f6c7760b887adc9f8928e66f44bcb8bf81f157" "8.6.0": source: url: "https://github.com/weidai11/cryptopp/archive/CRYPTOPP_8_6_0.tar.gz" @@ -20,24 +34,20 @@ sources: cmake: url: "https://github.com/noloader/cryptopp-cmake/archive/CRYPTOPP_8_5_0.tar.gz" sha256: "10685209405e676993873fcf638ade5f8f99d7949afa6b2045289ce9cc6d90ac" - "8.4.0": - source: - url: "https://github.com/weidai11/cryptopp/archive/CRYPTOPP_8_4_0.tar.gz" - sha256: "6687dfc1e33b084aeab48c35a8550b239ee5f73a099a3b6a0918d70b8a89e654" - cmake: - url: "https://github.com/noloader/cryptopp-cmake/archive/CRYPTOPP_8_4_0.tar.gz" - sha256: "b850070141f6724fce640e4e2cfde433ec5b2d99d4386d29ba9255167bc4b4f0" - "8.2.0": - source: - url: "https://github.com/weidai11/cryptopp/archive/CRYPTOPP_8_2_0.tar.gz" - sha256: "e3bcd48a62739ad179ad8064b523346abb53767bcbefc01fe37303412292343e" - cmake: - url: "https://github.com/noloader/cryptopp-cmake/archive/CRYPTOPP_8_2_0.tar.gz" - sha256: "f41f6a32b1177c094c3ef97423916713c902d0ac26cbee30ec70b1e8ab0e6fba" patches: + "8.9.0": + - patch_file: "patches/8.9.0-0001-cve-2023-50980.patch" + patch_description: "Validate PolynomialMod2 coefficients (CVE-2023-50980)" + patch_type: "vulnerability" + patch_source: "https://github.com/weidai11/cryptopp/issues/1248" "8.7.0": - - patch_file: "patches/0001-fix-msvc-arm64-8.7.0.patch" + - patch_file: "patches/8.7.0-0001-fix-msvc-arm64.patch" "8.6.0": - - patch_file: "patches/0001-fix-cmake-8.6.0.patch" - "8.2.0": - - patch_file: "patches/0001-fix-cmake-8.2.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" \ No newline at end of file diff --git a/recipes/cryptopp/all/conanfile.py b/recipes/cryptopp/all/conanfile.py index 7c5dae06bd13b..039ed175e5ca4 100644 --- a/recipes/cryptopp/all/conanfile.py +++ b/recipes/cryptopp/all/conanfile.py @@ -1,13 +1,18 @@ 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.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 import os import textwrap -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.53.0" class CryptoPPConan(ConanFile): @@ -16,45 +21,51 @@ 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], "fPIC": [True, False], + "use_openmp": [True, False], } default_options = { "shared": False, "fPIC": True, + "use_openmp": False, } 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 build_requirements(self): - if Version(self.version) >= "8.7.0": - self.tool_requires("cmake/3.24.0") - - 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 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_build(self): + if is_apple_os(self) and cross_building(self) and Version(self.version) <= "8.6.0": + # See https://github.com/abdes/cryptopp-cmake/pull/38 + raise ConanInvalidConfiguration("cryptopp 8.6.0 and lower do not support cross-building on Apple platforms") + + 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 build_requirements(self): + if Version(self.version) >= "8.7.0": + self.tool_requires("cmake/[>=3.20 <4]") + def source(self): # Get cryptopp sources - get(self, **self.conan_data["sources"][self.version]["source"], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version]["source"], strip_root=True) if Version(self.version) < "8.7.0": # Get CMakeLists @@ -89,12 +100,14 @@ def generate(self): # Relocatable shared libs on macOS tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" else: - tc.cache_variables["CRYPTOPP_SOURCES"] = self.source_folder + 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.cache_variables["CRYPTOPP_USE_OPENMP"] = self.options.use_openmp + tc.cache_variables["CMAKE_DISABLE_FIND_PACKAGE_Git"] = True tc.generate() def _patch_sources(self): @@ -161,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_aliases", [legacy_cmake_target]) self.cpp_info.set_property("pkg_config_name", "libcryptopp") # TODO: back to global scope once cmake_find_package* generators removed @@ -173,13 +187,19 @@ 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"] + + if not self.options.shared and self.options.use_openmp: + if self.settings.compiler in ("gcc", "clang"): + openmp_flag = ["-fopenmp"] + self.cpp_info.components["libcryptopp"].sharedlinkflags = openmp_flag + self.cpp_info.components["libcryptopp"].exelinkflags = openmp_flag # 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/0001-fix-msvc-arm64-8.7.0.patch b/recipes/cryptopp/all/patches/8.7.0-0001-fix-msvc-arm64.patch similarity index 100% rename from recipes/cryptopp/all/patches/0001-fix-msvc-arm64-8.7.0.patch rename to recipes/cryptopp/all/patches/8.7.0-0001-fix-msvc-arm64.patch diff --git a/recipes/cryptopp/all/patches/8.9.0-0001-cve-2023-50980.patch b/recipes/cryptopp/all/patches/8.9.0-0001-cve-2023-50980.patch new file mode 100644 index 0000000000000..6406e30851781 --- /dev/null +++ b/recipes/cryptopp/all/patches/8.9.0-0001-cve-2023-50980.patch @@ -0,0 +1,78 @@ +https://github.com/weidai11/cryptopp/issues/1248 +https://github.com/weidai11/cryptopp/commit/eb383b8e1622 +https://github.com/weidai11/cryptopp/commit/641ae35258de +https://github.com/weidai11/cryptopp/commit/93208e83937a +--- a/gf2n.cpp ++++ b/gf2n.cpp +@@ -135,6 +135,14 @@ PolynomialMod2 PolynomialMod2::Monomial(size_t i) + + PolynomialMod2 PolynomialMod2::Trinomial(size_t t0, size_t t1, size_t t2) + { ++ // Asserts and checks due to Bing Shi ++ CRYPTOPP_ASSERT(t0 > t1); ++ CRYPTOPP_ASSERT(t1 > t2); ++ ++ // The test is relaxed because of ECIES. The high order exponent is t0, but the other exponents are not in descending order. ++ if (t1 > t0 || t2 > t0) ++ throw InvalidArgument("PolynomialMod2: exponents must be in descending order"); ++ + PolynomialMod2 r((word)0, t0+1); + r.SetBit(t0); + r.SetBit(t1); +@@ -144,6 +152,16 @@ PolynomialMod2 PolynomialMod2::Trinomial(size_t t0, size_t t1, size_t t2) + + PolynomialMod2 PolynomialMod2::Pentanomial(size_t t0, size_t t1, size_t t2, size_t t3, size_t t4) + { ++ // Asserts and checks due to Bing Shi ++ CRYPTOPP_ASSERT(t0 > t1); ++ CRYPTOPP_ASSERT(t1 > t2); ++ CRYPTOPP_ASSERT(t2 > t3); ++ CRYPTOPP_ASSERT(t3 > t4); ++ ++ // The test is relaxed because of ECIES. The high order exponent is t0, but the other exponents are not in descending order. ++ if (t1 > t0 || t2 > t0 || t3 > t0 || t4 > t0) ++ throw InvalidArgument("PolynomialMod2: exponents must be in descending order"); ++ + PolynomialMod2 r((word)0, t0+1); + r.SetBit(t0); + r.SetBit(t1); +@@ -655,7 +673,12 @@ GF2NT::GF2NT(unsigned int c0, unsigned int c1, unsigned int c2) + , t0(c0), t1(c1) + , result((word)0, m) + { ++ // Asserts and checks due to Bing Shi + CRYPTOPP_ASSERT(c0 > c1 && c1 > c2 && c2==0); ++ ++ // The test is relaxed because of ECIES. The high order exponent is t0, but the other exponents are not in descending order. ++ if (c1 > c0 || c2 > c0) ++ throw InvalidArgument("GF2NT: exponents must be in descending order"); + } + + const GF2NT::Element& GF2NT::MultiplicativeInverse(const Element &a) const +@@ -964,7 +987,12 @@ GF2NP * BERDecodeGF2NP(BufferedTransformation &bt) + GF2NT233::GF2NT233(unsigned int c0, unsigned int c1, unsigned int c2) + : GF2NT(c0, c1, c2) + { ++ // Asserts and checks due to Bing Shi + CRYPTOPP_ASSERT(c0 > c1 && c1 > c2 && c2==0); ++ ++ // The test is relaxed because of ECIES. The high order exponent is t0, but the other exponents are not in descending order. ++ if (c1 > c0 || c2 > c0) ++ throw InvalidArgument("GF2NT233: exponents must be in descending order"); + } + + const GF2NT::Element& GF2NT233::Multiply(const Element &a, const Element &b) const +--- a/gf2n.h ++++ b/gf2n.h +@@ -69,9 +69,11 @@ public: + static PolynomialMod2 CRYPTOPP_API Monomial(size_t i); + /// \brief Provides x^t0 + x^t1 + x^t2 + /// \return x^t0 + x^t1 + x^t2 ++ /// \pre The coefficients should be provided in descending order. That is,
t0 > t1 > t2
.
+ 		static PolynomialMod2 CRYPTOPP_API Trinomial(size_t t0, size_t t1, size_t t2);
+ 		/// \brief Provides x^t0 + x^t1 + x^t2 + x^t3 + x^t4
+ 		/// \return x^t0 + x^t1 + x^t2 + x^t3 + x^t4
++		/// \pre The coefficients should be provided in descending order. That is, 
t0 > t1 > t2 > t3 > t4
.
+ 		static PolynomialMod2 CRYPTOPP_API Pentanomial(size_t t0, size_t t1, size_t t2, size_t t3, size_t t4);
+ 		/// \brief Provides x^(n-1) + ... + x + 1
+ 		/// \return x^(n-1) + ... + x + 1
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_package/test_package.cpp b/recipes/cryptopp/all/test_package/test_package.cpp
index 2460e01097c84..da386a7df8d69 100644
--- a/recipes/cryptopp/all/test_package/test_package.cpp
+++ b/recipes/cryptopp/all/test_package/test_package.cpp
@@ -1,13 +1,8 @@
-#include "cryptopp/cryptlib.h"
-#include "cryptopp/osrng.h" // AutoSeededRandomPool
-
-#include 
+#include 
+#include 
 
 int main() {
-  printf("CryptoPP version: %d\n", CRYPTOPP_VERSION);
-
-  CryptoPP::AutoSeededRandomPool rng;
-  printf("This is a random number from CryptoPP: %d\n", rng.GenerateByte());
-
+  std::cout << "CryptoPP LibraryVersion() = " << CryptoPP::LibraryVersion() << std::endl;
+  std::cout << "CryptoPP HeaderVersion() = " << CryptoPP::HeaderVersion() << std::endl;
   return 0;
 }
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 0cf6dab66b6c7..d6ae70c1dd554 100644
--- a/recipes/cryptopp/config.yml
+++ b/recipes/cryptopp/config.yml
@@ -1,11 +1,11 @@
 versions:
+  "8.9.0":
+    folder: "all"
+  "8.8.0":
+    folder: "all"
   "8.7.0":
     folder: "all"
   "8.6.0":
     folder: "all"
   "8.5.0":
     folder: "all"
-  "8.4.0":
-    folder: "all"
-  "8.2.0":
-    folder: "all"
diff --git a/recipes/cs_libguarded/all/conandata.yml b/recipes/cs_libguarded/all/conandata.yml
index 9814b7bca2929..da0b7dc222888 100644
--- a/recipes/cs_libguarded/all/conandata.yml
+++ b/recipes/cs_libguarded/all/conandata.yml
@@ -1,4 +1,10 @@
 sources:
+  "1.4.1":
+    url: "https://github.com/copperspice/cs_libguarded/archive/libguarded-1.4.1.tar.gz"
+    sha256: "e91235d4f5e5edb4a479fccfcd1bdc2a411dd3e3344f5c973ce5870edbab13b0"
+  "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"
diff --git a/recipes/cs_libguarded/all/conanfile.py b/recipes/cs_libguarded/all/conanfile.py
index 39578ddadb423..7a321e4ffe729 100644
--- a/recipes/cs_libguarded/all/conanfile.py
+++ b/recipes/cs_libguarded/all/conanfile.py
@@ -15,6 +15,7 @@ class CsLibguardedConan(ConanFile):
     url = "https://github.com/conan-io/conan-center-index"
     homepage = "https://github.com/copperspice/libguarded"
     topics = ("multithreading", "templates", "cpp14", "mutexes", "header-only")
+    package_type = "header-library"
     settings = "os", "arch", "compiler", "build_type"
     no_copy_source = True
 
@@ -66,7 +67,7 @@ def loose_lt_semver(v1, v2):
                 f"{self.ref} requires C++{self._min_cppstd}, which your compiler ({compiler}-{version}) 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 package(self):
         copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder)
diff --git a/recipes/cs_libguarded/config.yml b/recipes/cs_libguarded/config.yml
index fcb4297f98984..e039584f8837c 100644
--- a/recipes/cs_libguarded/config.yml
+++ b/recipes/cs_libguarded/config.yml
@@ -1,4 +1,8 @@
 versions:
+  "1.4.1":
+    folder: all
+  "1.4.0":
+    folder: all
   "1.3.0":
     folder: all
   "1.1.0":
diff --git a/recipes/csm/all/CMakeLists.txt b/recipes/csm/all/CMakeLists.txt
new file mode 100644
index 0000000000000..757e60e4da746
--- /dev/null
+++ b/recipes/csm/all/CMakeLists.txt
@@ -0,0 +1,33 @@
+cmake_minimum_required(VERSION 3.1)
+project(csm LANGUAGES CXX)
+
+find_package(Threads REQUIRED)
+include(CheckFunctionExists)
+check_function_exists(pow HAVE_MATH_SYSTEM)
+
+file(GLOB CSM_SRCS ${CSM_SRC_DIR}/*.cpp)
+add_library(csmapi SHARED ${CSM_SRCS})
+target_include_directories(csmapi PRIVATE ${CSM_SRC_DIR})
+target_link_libraries(csmapi PRIVATE Threads::Threads ${CMAKE_DL_LIBS})
+if(NOT HAVE_MATH_SYSTEM)
+    target_link_libraries(csmapi PRIVATE m)
+endif()
+set_target_properties(csmapi PROPERTIES
+    CXX_VISIBILITY_PRESET hidden
+    VISIBILITY_INLINES_HIDDEN TRUE
+    VERSION ${CSM_VERSION}
+    SOVERSION ${CSM_MAJOR_VERSION}
+)
+if(NOT WIN32)
+    set_target_properties(csmapi PROPERTIES DEFINE_SYMBOL LINUX_BUILD)
+endif()
+
+include(GNUInstallDirs)
+file(GLOB CSM_HEADERS ${CSM_SRC_DIR}/*.h)
+install(FILES ${CSM_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/csm)
+install(
+    TARGETS csmapi
+    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+    ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+)
diff --git a/recipes/csm/all/conandata.yml b/recipes/csm/all/conandata.yml
new file mode 100644
index 0000000000000..80cde8337f258
--- /dev/null
+++ b/recipes/csm/all/conandata.yml
@@ -0,0 +1,4 @@
+sources:
+  "3.0.4":
+    url: "https://github.com/ngageoint/csm/archive/refs/tags/v3.0.4.tar.gz"
+    sha256: "1f4d95af1ecc4fbdcf832d796c8da766c696927bd9d9691016d73a956d3e22bb"
diff --git a/recipes/csm/all/conanfile.py b/recipes/csm/all/conanfile.py
new file mode 100644
index 0000000000000..7253fb0bd7a4b
--- /dev/null
+++ b/recipes/csm/all/conanfile.py
@@ -0,0 +1,46 @@
+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.51.2"
+
+
+class CsmConan(ConanFile):
+    name = "csm"
+    description = "Community Sensor Model base interface library"
+    license = "Unlicense"
+    topics = ("sensor", "camera", "camera-model", "geospatial", "planetary", "planetary-data")
+    homepage = "https://github.com/ngageoint/csm"
+    url = "https://github.com/conan-io/conan-center-index"
+    package_type = "shared-library"
+    settings = "os", "arch", "compiler", "build_type"
+
+    exports_sources = "CMakeLists.txt"
+
+    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["CSM_SRC_DIR"] = self.source_folder.replace("\\", "/")
+        tc.variables["CSM_VERSION"] = self.version
+        tc.variables["CSM_MAJOR_VERSION"] = str(Version(self.version).major)
+        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 = ["csmapi"]
diff --git a/recipes/csm/all/test_package/CMakeLists.txt b/recipes/csm/all/test_package/CMakeLists.txt
new file mode 100644
index 0000000000000..3d1c614448318
--- /dev/null
+++ b/recipes/csm/all/test_package/CMakeLists.txt
@@ -0,0 +1,7 @@
+cmake_minimum_required(VERSION 3.1)
+project(test_package LANGUAGES CXX)
+
+find_package(csm REQUIRED CONFIG)
+
+add_executable(${PROJECT_NAME} test_package.cpp)
+target_link_libraries(${PROJECT_NAME} PRIVATE csm::csm)
diff --git a/recipes/csm/all/test_package/conanfile.py b/recipes/csm/all/test_package/conanfile.py
new file mode 100644
index 0000000000000..0a6bc68712d90
--- /dev/null
+++ b/recipes/csm/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/csm/all/test_package/test_package.cpp b/recipes/csm/all/test_package/test_package.cpp
new file mode 100644
index 0000000000000..4262df6c3ccb1
--- /dev/null
+++ b/recipes/csm/all/test_package/test_package.cpp
@@ -0,0 +1,6 @@
+#include 
+
+int main() {
+    csm::Ellipsoid ellipsoid;
+    return 0;
+}
diff --git a/recipes/csm/all/test_v1_package/CMakeLists.txt b/recipes/csm/all/test_v1_package/CMakeLists.txt
new file mode 100644
index 0000000000000..0d20897301b68
--- /dev/null
+++ b/recipes/csm/all/test_v1_package/CMakeLists.txt
@@ -0,0 +1,8 @@
+cmake_minimum_required(VERSION 3.1)
+project(test_package)
+
+include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
+conan_basic_setup(TARGETS)
+
+add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package
+                 ${CMAKE_CURRENT_BINARY_DIR}/test_package)
diff --git a/recipes/csm/all/test_v1_package/conanfile.py b/recipes/csm/all/test_v1_package/conanfile.py
new file mode 100644
index 0000000000000..38f4483872d47
--- /dev/null
+++ b/recipes/csm/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/csm/config.yml b/recipes/csm/config.yml
new file mode 100644
index 0000000000000..72c13bca7df04
--- /dev/null
+++ b/recipes/csm/config.yml
@@ -0,0 +1,3 @@
+versions:
+  "3.0.4":
+    folder: all
diff --git a/recipes/cspice/all/CMakeLists.txt b/recipes/cspice/all/CMakeLists.txt
index 8630af1db4d4a..4e032190639fa 100644
--- a/recipes/cspice/all/CMakeLists.txt
+++ b/recipes/cspice/all/CMakeLists.txt
@@ -40,8 +40,10 @@ elseif(UNIX)
   target_compile_options(cspice PRIVATE -ansi)
 endif()
 
-if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
-  target_link_libraries(cspice PRIVATE m)
+include(CheckFunctionExists)
+check_function_exists(pow HAVE_MATH_SYSTEM)
+if(NOT HAVE_MATH_SYSTEM)
+    target_link_libraries(cspice PRIVATE m)
 endif()
 
 install(
@@ -63,7 +65,7 @@ if(CSPICE_BUILD_UTILITIES)
   file(GLOB CSPICE_UTILITIES_SUBDIRS RELATIVE ${SRC_DIR} "${SRC_DIR}/*_c")
   list(REMOVE_ITEM CSPICE_UTILITIES_SUBDIRS "cook_c")
   foreach(CSPICE_SUBDIR ${CSPICE_UTILITIES_SUBDIRS})
-    set(UTILITY_SRC_DIR "${SRC_DIR}/${CSPICE_SUBDIR}")
+    get_filename_component(UTILITY_SRC_DIR "${SRC_DIR}/${CSPICE_SUBDIR}" ABSOLUTE)
 
     # Each .pgm file is the entry point of an executable
     file(GLOB PGM_FILES "${UTILITY_SRC_DIR}/*.pgm")
@@ -120,7 +122,7 @@ if(CSPICE_BUILD_UTILITIES)
       if(TARGET ${CSPICE_SUBDIR}_commonlib)
         target_link_libraries(${CSPICE_UTILITY} PRIVATE ${CSPICE_SUBDIR}_commonlib)
       endif()
-      if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+      if(NOT HAVE_MATH_SYSTEM)
         target_link_libraries(${CSPICE_UTILITY} PRIVATE m)
       endif()
       install(TARGETS ${CSPICE_UTILITY} DESTINATION ${CMAKE_INSTALL_BINDIR})
diff --git a/recipes/cspice/all/conanfile.py b/recipes/cspice/all/conanfile.py
index 4d9de47239cb0..e2b42c62f365f 100644
--- a/recipes/cspice/all/conanfile.py
+++ b/recipes/cspice/all/conanfile.py
@@ -1,10 +1,13 @@
 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, chdir, copy, download, get, load, rename, rmdir, save
+from conan.tools.files import (
+    apply_conandata_patches, chdir, copy, download, export_conandata_patches,
+    get, load, rename, rmdir, save
+)
 import os
 
-required_conan_version = ">=1.47.0"
+required_conan_version = ">=1.53.0"
 
 
 class CspiceConan(ConanFile):
@@ -15,6 +18,7 @@ class CspiceConan(ConanFile):
     homepage = "https://naif.jpl.nasa.gov/naif/toolkit.html"
     url = "https://github.com/conan-io/conan-center-index"
 
+    package_type = "library"
     settings = "os", "arch", "compiler", "build_type"
     options = {
         "shared": [True, False],
@@ -29,8 +33,7 @@ class CspiceConan(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,15 +41,12 @@ 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):
         sources_url_per_triplet = self.conan_data["sources"][self.version]
@@ -55,27 +55,24 @@ def validate(self):
             raise ConanInvalidConfiguration(
                 f"cspice N{self.version} does not support {host_os}",
             )
-        compiler = str(self.info.settings.compiler)
+        compiler = str(self.settings.compiler)
         if compiler not in sources_url_per_triplet[host_os]:
             raise ConanInvalidConfiguration(
                 f"cspice N{self.version} does not support {compiler} on {host_os}",
             )
-        arch = str(self.info.settings.arch)
+        arch = str(self.settings.arch)
         if arch not in sources_url_per_triplet[host_os][compiler]:
             raise ConanInvalidConfiguration(
                 f"cspice N{self.version} does not support {compiler} on {host_os} {arch}",
             )
 
     def _get_os_or_subsystem(self):
-        if self.settings.os == "Windows" and self.settings.os.subsystem != "None":
+        if self.settings.os == "Windows" and self.settings.get_safe("os.subsystem"):
             os_or_subsystem = str(self.settings.os.subsystem)
         else:
             os_or_subsystem = str(self.settings.os)
         return os_or_subsystem
 
-    def layout(self):
-        cmake_layout(self, src_folder="src")
-
     def source(self):
         pass
 
@@ -129,7 +126,6 @@ def package_info(self):
         if self.settings.os == "Linux":
             self.cpp_info.system_libs.append("m")
 
+        # TODO: to remove in conan v2
         if self.options.utilities:
-            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"))
diff --git a/recipes/cspice/all/test_package/conanfile.py b/recipes/cspice/all/test_package/conanfile.py
index d120a992c06a6..0a6bc68712d90 100644
--- a/recipes/cspice/all/test_package/conanfile.py
+++ b/recipes/cspice/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/cspice/all/test_v1_package/CMakeLists.txt b/recipes/cspice/all/test_v1_package/CMakeLists.txt
index a8e7e9f7503eb..0d20897301b68 100644
--- a/recipes/cspice/all/test_v1_package/CMakeLists.txt
+++ b/recipes/cspice/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(cspice REQUIRED CONFIG)
-
-add_executable(${PROJECT_NAME} ../test_package/test_package.c)
-target_link_libraries(${PROJECT_NAME} PRIVATE cspice::cspice)
+add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package
+                 ${CMAKE_CURRENT_BINARY_DIR}/test_package)
diff --git a/recipes/csvmonkey/all/conanfile.py b/recipes/csvmonkey/all/conanfile.py
index 70c4748ec7036..821a19ed46096 100644
--- a/recipes/csvmonkey/all/conanfile.py
+++ b/recipes/csvmonkey/all/conanfile.py
@@ -1,56 +1,79 @@
-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", "header-only")
+    package_type = "header-library"
+    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.83.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/quill/all/test_v1_package/CMakeLists.txt b/recipes/csvmonkey/all/test_v1_package/CMakeLists.txt
similarity index 100%
rename from recipes/quill/all/test_v1_package/CMakeLists.txt
rename to recipes/csvmonkey/all/test_v1_package/CMakeLists.txt
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/cthash/all/conandata.yml b/recipes/cthash/all/conandata.yml
new file mode 100644
index 0000000000000..49dc0097b55ed
--- /dev/null
+++ b/recipes/cthash/all/conandata.yml
@@ -0,0 +1,4 @@
+sources:
+  "cci.20231025":
+    url: "https://github.com/hanickadot/cthash/archive/21d581e0a6bd7040c282af1e43faab9d44f47744.tar.gz"
+    sha256: "03bf073f0c8a362d26186dab39482418aaf59a1bc17d92ec6b49053147c0fba0"
diff --git a/recipes/cthash/all/conanfile.py b/recipes/cthash/all/conanfile.py
new file mode 100644
index 0000000000000..3cf7e23d7eec7
--- /dev/null
+++ b/recipes/cthash/all/conanfile.py
@@ -0,0 +1,75 @@
+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
+import os
+
+
+required_conan_version = ">=1.53.0"
+
+
+class CtHashConan(ConanFile):
+    name = "cthash"
+    description = "constexpr implementation of SHA-2 and SHA-3 family of hashes"
+    license = "Apache-2.0"
+    url = "https://github.com/conan-io/conan-center-index"
+    homepage = "https://github.com/hanickadot/cthash/"
+    topics = ("constexpr", "xxhash", "sha", "header-only")
+    package_type = "header-library"
+    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": "12.2",
+            "clang": "15.0.7",
+            "apple-clang": "14",
+        }
+
+    def layout(self):
+        basic_layout(self, src_folder="src")
+
+    def package_id(self):
+        self.info.clear()
+
+    def validate(self):
+        if is_msvc(self):
+            raise ConanInvalidConfiguration(f"{self.ref} doesn't support MSVC.")
+
+        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 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/cthash/all/test_package/CMakeLists.txt b/recipes/cthash/all/test_package/CMakeLists.txt
new file mode 100644
index 0000000000000..0fedcbfdc5199
--- /dev/null
+++ b/recipes/cthash/all/test_package/CMakeLists.txt
@@ -0,0 +1,8 @@
+cmake_minimum_required(VERSION 3.15)
+project(test_package LANGUAGES CXX)
+
+find_package(cthash REQUIRED CONFIG)
+
+add_executable(${PROJECT_NAME} test_package.cpp)
+target_link_libraries(${PROJECT_NAME} PRIVATE cthash::cthash)
+target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20)
diff --git a/recipes/cthash/all/test_package/conanfile.py b/recipes/cthash/all/test_package/conanfile.py
new file mode 100644
index 0000000000000..e845ae751a301
--- /dev/null
+++ b/recipes/cthash/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/cthash/all/test_package/test_package.cpp b/recipes/cthash/all/test_package/test_package.cpp
new file mode 100644
index 0000000000000..561e9a5d45e57
--- /dev/null
+++ b/recipes/cthash/all/test_package/test_package.cpp
@@ -0,0 +1,12 @@
+#include 
+#include "cthash/cthash.hpp"
+
+using namespace cthash::literals;
+
+int main(void) {
+    constexpr auto my_hash = cthash::sha3_256{}.update("hello there!").final();
+
+    std::cout << my_hash << std::endl;
+
+    return 0;
+}
diff --git a/recipes/cthash/config.yml b/recipes/cthash/config.yml
new file mode 100644
index 0000000000000..52ddbe7872fd0
--- /dev/null
+++ b/recipes/cthash/config.yml
@@ -0,0 +1,3 @@
+versions:
+  "cci.20231025":
+    folder: all
diff --git a/recipes/ctml/all/conanfile.py b/recipes/ctml/all/conanfile.py
index b5c3dd7c38f7d..bb07e06f8fb0b 100644
--- a/recipes/ctml/all/conanfile.py
+++ b/recipes/ctml/all/conanfile.py
@@ -1,7 +1,12 @@
 import os
-from conans import ConanFile, tools
 
-required_conan_version = ">=1.43.0"
+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
+
+required_conan_version = ">=1.52.0"
+
 
 class CtmlLibrariesConan(ConanFile):
     name = "ctml"
@@ -9,33 +14,41 @@ class CtmlLibrariesConan(ConanFile):
     license = "MIT"
     url = "https://github.com/conan-io/conan-center-index"
     homepage = "https://github.com/tinfoilboy/CTML"
-    topics = ("generator", "html", )
-    settings = "os", "arch", "compiler", "build_type",
-    generators = "cmake",
+    topics = ("generator", "html", "header-only")
+
+    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.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], strip_root=True)
 
     def package(self):
-        self.copy("LICENSE*", "licenses", self._source_subfolder)
-        self.copy("ctml.hpp", "include", os.path.join(self._source_subfolder, "include"))
+        copy(self, "LICENSE*",
+             dst=os.path.join(self.package_folder, "licenses"),
+             src=self.source_folder)
+        copy(self, "ctml.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", "CTML")
         self.cpp_info.set_property("cmake_target_name", "CTML::CTML")
 
+        # TODO: to remove in conan v2 once cmake_find_package_* generators removed
         self.cpp_info.filenames["cmake_find_package"] = "CTML"
         self.cpp_info.filenames["cmake_find_package_multi"] = "CTML"
         self.cpp_info.names["cmake_find_package"] = "CTML"
diff --git a/recipes/ctml/all/test_package/CMakeLists.txt b/recipes/ctml/all/test_package/CMakeLists.txt
index 1df60de830867..d4e16fb2704c6 100644
--- a/recipes/ctml/all/test_package/CMakeLists.txt
+++ b/recipes/ctml/all/test_package/CMakeLists.txt
@@ -1,9 +1,6 @@
-cmake_minimum_required(VERSION 3.8)
+cmake_minimum_required(VERSION 3.15)
 project(test_package CXX)
 
-include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
-conan_basic_setup(TARGETS)
-
 find_package(CTML CONFIG REQUIRED)
 
 add_executable(${PROJECT_NAME} test_package.cpp)
diff --git a/recipes/ctml/all/test_package/conanfile.py b/recipes/ctml/all/test_package/conanfile.py
index 270a1ae971491..fae501d0afb9e 100644
--- a/recipes/ctml/all/test_package/conanfile.py
+++ b/recipes/ctml/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 TestWrapperConan(ConanFile):
+
+class TestPackageConan(ConanFile):
     settings = "os", "arch", "compiler", "build_type"
-    generators = "cmake", "cmake_find_package_multi"
+    generators = "CMakeDeps", "CMakeToolchain"
+    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/ctpg/all/conandata.yml b/recipes/ctpg/all/conandata.yml
index e352628a7b1dd..35ba92c0e0475 100644
--- a/recipes/ctpg/all/conandata.yml
+++ b/recipes/ctpg/all/conandata.yml
@@ -2,9 +2,3 @@ sources:
   "1.3.7":
     url: "https://github.com/peter-winter/ctpg/archive/refs/tags/v1.3.7.tar.gz"
     sha256: "6cc7c34de4983e21070599fd5693b65ef08cd5c8f42612e43b47eda723623429"
-  "1.3.6":
-    url: "https://github.com/peter-winter/ctpg/archive/refs/tags/v1.3.6.tar.gz"
-    sha256: "8ad5e06ab551fe30ff10faf6b53b85c862a873e3827505d5f5b63aae2b836ba2"
-  "1.3.5":
-    url: "https://github.com/peter-winter/ctpg/archive/refs/tags/v1.3.5.tar.gz"
-    sha256: "6874e71aecace33a07dd202c5c6c53277653d54daa13b460f4e1eb5b0c902d42"
diff --git a/recipes/ctpg/all/conanfile.py b/recipes/ctpg/all/conanfile.py
index bd69eefe8c5a2..6e511a34160b5 100644
--- a/recipes/ctpg/all/conanfile.py
+++ b/recipes/ctpg/all/conanfile.py
@@ -1,59 +1,73 @@
-from conans.errors import ConanInvalidConfiguration
-from conans import ConanFile, tools
 import os
 
-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.files import copy, get
+from conan.tools.layout import basic_layout
+from conan.tools.microsoft import is_msvc
+from conan.tools.scm import Version
+
+required_conan_version = ">=1.52.0"
+
 
 class CTPGConan(ConanFile):
     name = "ctpg"
-    license = "MIT"
     description = (
         "Compile Time Parser Generator is a C++ single header library which takes a language description as a C++ code "
         "and turns it into a LR1 table parser with a deterministic finite automaton lexical analyzer, all in compile time."
     )
-    topics = ("regex", "parser", "grammar", "compile-time")
+    license = "MIT"
     url = "https://github.com/conan-io/conan-center-index"
     homepage = "https://github.com/peter-winter/ctpg"
-    settings = "compiler",
+    topics = ("regex", "parser", "grammar", "compile-time", "header-only")
+
+    package_type = "header-library"
+    settings = "os", "arch", "compiler", "build_type"
     no_copy_source = True
 
-    _compiler_required_cpp17 = {
-        "Visual Studio": "16",
-        "gcc": "8",
-        "clang": "12",
-        "apple-clang": "12.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",
+            "apple-clang": "12.0",
+            "msvc": "192",
+            "Visual Studio": "16",
+        }
 
-    def validate(self):
-        ## TODO: In ctpg<=1.3.5, Visual Studio C++ failed to compile ctpg with "error MSB6006: "CL.exe" exited with code -1073741571."
-        if self.settings.compiler == "Visual Studio":
-            raise ConanInvalidConfiguration("{} does not support Visual Studio currently.".format(self.name))
+    def layout(self):
+        basic_layout(self, src_folder="src")
 
-        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("{} 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._min_cppstd)
 
-    def package_id(self):
-        self.info.header_only()
+        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 package(self):
-        self.copy("LICENSE*", "licenses", self._source_subfolder)
-        if tools.Version(self.version) >= "1.3.7":
-            self.copy("ctpg.hpp",
-                os.path.join("include", "ctpg"), 
-                os.path.join(self._source_subfolder, "include", "ctpg"))
-        else:
-            self.copy("ctpg.hpp", "include", os.path.join(self._source_subfolder, "include"))
+        copy(self, "LICENSE*",
+             dst=os.path.join(self.package_folder, "licenses"),
+             src=self.source_folder)
+        include_dir = os.path.join("include", "ctpg")
+        copy(self, "ctpg.hpp",
+             dst=os.path.join(self.package_folder, include_dir),
+             src=os.path.join(self.source_folder, include_dir))
+
+    def package_info(self):
+        self.cpp_info.bindirs = []
+        self.cpp_info.libdirs = []
diff --git a/recipes/ctpg/all/test_package/CMakeLists.txt b/recipes/ctpg/all/test_package/CMakeLists.txt
index b09bb90b2f88d..72fdf15fd58d7 100644
--- a/recipes/ctpg/all/test_package/CMakeLists.txt
+++ b/recipes/ctpg/all/test_package/CMakeLists.txt
@@ -1,17 +1,11 @@
-cmake_minimum_required(VERSION 3.1)
+cmake_minimum_required(VERSION 3.15)
 project(test_package CXX)
 
-include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
-conan_basic_setup(TARGETS)
-
 find_package(ctpg CONFIG REQUIRED)
 
 add_executable(${PROJECT_NAME} test_package.cpp)
 target_link_libraries(${PROJECT_NAME} ctpg::ctpg)
 set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17)
-if(CTPG_PLACED_CPTG_FOLDER)
-    target_compile_definitions(${PROJECT_NAME} PUBLIC CTPG_PLACED_CPTG_FOLDER)
-endif()
 
 if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
     target_compile_options(${PROJECT_NAME} PUBLIC -constexpr:depth3000000)
diff --git a/recipes/ctpg/all/test_package/conanfile.py b/recipes/ctpg/all/test_package/conanfile.py
index 34c01340114ef..c5591f2deebdb 100644
--- a/recipes/ctpg/all/test_package/conanfile.py
+++ b/recipes/ctpg/all/test_package/conanfile.py
@@ -1,18 +1,32 @@
+from conan import ConanFile
+from conan.tools.build import can_run
+from conan.tools.cmake import cmake_layout, CMake, CMakeToolchain, CMakeDeps
+from conan.tools.scm import Version
 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"
+    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()
+        tc = CMakeDeps(self)
+        tc.generate()
 
     def build(self):
         cmake = CMake(self)
-        cmake.definitions["CTPG_PLACED_CPTG_FOLDER"] = tools.Version(self.deps_cpp_info["ctpg"].version) >= "1.3.7"
         cmake.configure()
         cmake.build()
 
     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/ctpg/all/test_package/test_package.cpp b/recipes/ctpg/all/test_package/test_package.cpp
index bcd377f23cbd8..0d99b97395ccd 100644
--- a/recipes/ctpg/all/test_package/test_package.cpp
+++ b/recipes/ctpg/all/test_package/test_package.cpp
@@ -1,8 +1,4 @@
-#ifdef CTPG_PLACED_CPTG_FOLDER
-#  include "ctpg/ctpg.hpp"
-#else
-#  include "ctpg.hpp"
-#endif
+#include "ctpg/ctpg.hpp"
 
 #include 
 
@@ -28,7 +24,7 @@ constexpr ctpg::parser p(
     )
 );
 
-int main(int argc, char* argv[]) {
+int main() {
     auto res = p.parse(ctpg::buffers::string_buffer("10, 20, 30"), std::cerr);
     bool success = res.has_value();
     if (success)
diff --git a/recipes/ctpg/all/test_v1_package/CMakeLists.txt b/recipes/ctpg/all/test_v1_package/CMakeLists.txt
new file mode 100644
index 0000000000000..91630d79f4abb
--- /dev/null
+++ b/recipes/ctpg/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/ctpg/all/test_v1_package/conanfile.py b/recipes/ctpg/all/test_v1_package/conanfile.py
new file mode 100644
index 0000000000000..90eb89e3f2f46
--- /dev/null
+++ b/recipes/ctpg/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/ctpg/config.yml b/recipes/ctpg/config.yml
index 3da45bc778250..fba76735a9013 100644
--- a/recipes/ctpg/config.yml
+++ b/recipes/ctpg/config.yml
@@ -1,7 +1,3 @@
 versions:
   "1.3.7":
     folder: all
-  "1.3.6":
-    folder: all
-  "1.3.5":
-    folder: all
diff --git a/recipes/ctrack/all/conandata.yml b/recipes/ctrack/all/conandata.yml
new file mode 100644
index 0000000000000..f43d2b2b61b59
--- /dev/null
+++ b/recipes/ctrack/all/conandata.yml
@@ -0,0 +1,4 @@
+sources:
+  "1.0.2":
+    url: "https://github.com/Compaile/ctrack/releases/download/v1.0.2/ctrack-main.zip"
+    sha256: "1a41a831c28977504b49b6966c46e65939271eca90fbe297e248a3e0bf05ac5a"
diff --git a/recipes/ctrack/all/conanfile.py b/recipes/ctrack/all/conanfile.py
new file mode 100644
index 0000000000000..439699d0f2442
--- /dev/null
+++ b/recipes/ctrack/all/conanfile.py
@@ -0,0 +1,68 @@
+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.52.0"
+
+class CtrackConan(ConanFile):
+    name = "ctrack"
+    description = "A lightweight, high-performance C++ benchmarking and tracking library for effortless function profiling in both development and production environments."
+    license = "MIT"
+    url = "https://github.com/conan-io/conan-center-index"
+    homepage = "https://github.com/Compaile/ctrack"
+    topics = ("benchmark", "tracking", "profiling", "header-only")
+    package_type = "header-library"
+    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",
+            "Visual Studio": "16",
+            "msvc": "192",
+        }
+
+    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, "LICENSE", 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_info(self):
+        self.cpp_info.bindirs = []
+        self.cpp_info.libdirs = []
+
+        self.cpp_info.set_property("cmake_file_name", "ctrack")
+        self.cpp_info.set_property("cmake_target_name", "ctrack::ctrack")
diff --git a/recipes/ctrack/all/test_package/CMakeLists.txt b/recipes/ctrack/all/test_package/CMakeLists.txt
new file mode 100644
index 0000000000000..c5cbaf058679d
--- /dev/null
+++ b/recipes/ctrack/all/test_package/CMakeLists.txt
@@ -0,0 +1,8 @@
+cmake_minimum_required(VERSION 3.15)
+project(test_package LANGUAGES CXX)
+
+find_package(ctrack REQUIRED CONFIG)
+
+add_executable(${PROJECT_NAME} test_package.cpp)
+target_link_libraries(${PROJECT_NAME} PRIVATE ctrack::ctrack)
+target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)
diff --git a/recipes/ctrack/all/test_package/conanfile.py b/recipes/ctrack/all/test_package/conanfile.py
new file mode 100644
index 0000000000000..3a91c9439218e
--- /dev/null
+++ b/recipes/ctrack/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.bindir, "test_package")
+            self.run(bin_path, env="conanrun")
diff --git a/recipes/ctrack/all/test_package/test_package.cpp b/recipes/ctrack/all/test_package/test_package.cpp
new file mode 100644
index 0000000000000..a7b05d6ea6f7c
--- /dev/null
+++ b/recipes/ctrack/all/test_package/test_package.cpp
@@ -0,0 +1,25 @@
+// In older gcc,  header requires tbb library.
+// adding following line  to fix compilation error due to this
+#define  CTRACK_DISABLE_EXECUTION_POLICY
+#include "ctrack.hpp"
+#include 
+
+void expensiveOperation() {
+    CTRACK;
+    // Simulating some work
+    for (int i = 0; i < 5; ++i) {
+        std::cout << i << " ";
+    }
+    std::cout << std::endl;
+}
+
+int main() {
+    for (int i = 0; i < 2; ++i) {
+        expensiveOperation();
+    }
+
+    // Print results to console
+    ctrack::result_print();
+
+    return 0;
+}
diff --git a/recipes/ctrack/config.yml b/recipes/ctrack/config.yml
new file mode 100644
index 0000000000000..8457ca9a4a8cd
--- /dev/null
+++ b/recipes/ctrack/config.yml
@@ -0,0 +1,3 @@
+versions:
+  "1.0.2":
+    folder: all
diff --git a/recipes/ctre/all/conandata.yml b/recipes/ctre/all/conandata.yml
index b82c82a8db15a..14d4398b08a9b 100644
--- a/recipes/ctre/all/conandata.yml
+++ b/recipes/ctre/all/conandata.yml
@@ -1,37 +1,40 @@
 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":
-    url: "https://github.com/hanickadot/compile-time-regular-expressions/archive/v3.7.tar.gz"
-    sha256: "12be2a37f7fe39c489f646d3faee534f965871fd998258162962f36a19a455ef"
+  "3.9.0":
+    url: "https://github.com/hanickadot/compile-time-regular-expressions/archive/v3.9.0.tar.gz"
+    sha256: "55778712968d4f3ad00e9d20fc4d2149d14d96b4ff3dab086613797cd2ccd2b2"
+  "3.8.1":
+    url: "https://github.com/hanickadot/compile-time-regular-expressions/archive/v3.8.1.tar.gz"
+    sha256: "0ce8760d43b3b97b43364cd32ee663e5c8b8b4bfd58e7890042eff6ac52db605"
+  "3.8":
+    url: "https://github.com/hanickadot/compile-time-regular-expressions/archive/v3.8.tar.gz"
+    sha256: "6462ee41fa6aa12075f6b9d13f42358091d32963087443a6669d2c94232eea04"
+  "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..7170bf3ad6425 100644
--- a/recipes/ctre/all/conanfile.py
+++ b/recipes/ctre/all/conanfile.py
@@ -1,57 +1,68 @@
 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")
+    package_type = "header-library"
+    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))
-        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 gcc < {min_gcc}")
+        elif compiler == "clang":
+            if compiler_version < "6.0":
+                raise ConanInvalidConfiguration(f"{self.ref} doesn't support clang < 6.0")
+            if ctre_version == "3.4.1" and compiler_version >= "12.0" and not self.settings.compiler.get_safe("cppstd"):
+                raise ConanInvalidConfiguration(f"{self.ref} doesn't support clang >= 12.0 without cppstd. Please set cppstd.")
         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],  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 6b59866d3b987..218ac700f6381 100644
--- a/recipes/ctre/config.yml
+++ b/recipes/ctre/config.yml
@@ -1,25 +1,27 @@
 versions:
-  "2.8.4":
+  "3.9.0":
     folder: all
-  "2.9.2":
+  "3.8.1":
     folder: all
-  "2.10":
+  "3.8":
     folder: all
-  "3.0.1":
+  "3.7.2":
     folder: all
-  "3.1":
+  "3.7.1":
     folder: all
-  "3.2":
+  "3.7":
     folder: all
-  "3.3.4":
+  "3.6":
+    folder: all
+  "3.5":
     folder: all
   "3.4.1":
     folder: all
-  "3.5":
+  "3.3.4":
     folder: all
-  "3.6":
+  "3.2":
     folder: all
-  "3.7":
+  "3.1":
     folder: all
-  "3.7.1":
+  "2.10":
     folder: all
diff --git a/recipes/ctrl-c/all/CMakeLists.txt b/recipes/ctrl-c/all/CMakeLists.txt
new file mode 100644
index 0000000000000..405a4c3952405
--- /dev/null
+++ b/recipes/ctrl-c/all/CMakeLists.txt
@@ -0,0 +1,17 @@
+cmake_minimum_required(VERSION 3.15)
+project(ctrl-c LANGUAGES CXX)
+
+add_library(ctrl-c ${CTRL_C_SRC_DIR}/src/ctrl-c.cpp)
+set_target_properties(ctrl-c PROPERTIES
+    PUBLIC_HEADER ${CTRL_C_SRC_DIR}/src/ctrl-c.h
+)
+target_compile_features(ctrl-c PUBLIC cxx_std_11)
+
+include(GNUInstallDirs)
+install(
+    TARGETS ctrl-c
+    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/ctrl-c/all/conandata.yml b/recipes/ctrl-c/all/conandata.yml
new file mode 100644
index 0000000000000..e988e2cde6c0a
--- /dev/null
+++ b/recipes/ctrl-c/all/conandata.yml
@@ -0,0 +1,4 @@
+sources:
+  "1.0.0":
+    url: "https://github.com/evgenykislov/ctrl-c/archive/refs/tags/v1.0.0.tar.gz"
+    sha256: "9f63ff2e02ac62a19e30208af746d5a2655ecf040773b6c7d1e27e85be45ee1a"
diff --git a/recipes/ctrl-c/all/conanfile.py b/recipes/ctrl-c/all/conanfile.py
new file mode 100644
index 0000000000000..6ef4188f79f42
--- /dev/null
+++ b/recipes/ctrl-c/all/conanfile.py
@@ -0,0 +1,75 @@
+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
+from conan.tools.microsoft import is_msvc
+import os
+
+
+required_conan_version = ">=1.53.0"
+
+
+class CtrlCConan(ConanFile):
+    name = "ctrl-c"
+    description = "Crossplatform code to handle Ctrl+C signal"
+    license = "MIT"
+    url = "https://github.com/conan-io/conan-center-index"
+    homepage = "https://github.com/evgenykislov/ctrl-c/"
+    topics = ("crossplatform", "signal", "sigint")
+    package_type = "library"
+    settings = "os", "arch", "compiler", "build_type"
+    options = {
+        "shared": [True, False],
+        "fPIC": [True, False],
+    }
+    default_options = {
+        "shared": False,
+        "fPIC": True,
+    }
+    exports_sources = ["CMakeLists.txt"]
+
+    @property
+    def _min_cppstd(self):
+        return 11
+
+    def config_options(self):
+        if self.settings.os == "Windows":
+            del self.options.fPIC
+
+    def configure(self):
+        if is_msvc(self):
+            del self.options.shared
+            self.package_type = "static-library"
+        if self.options.get_safe("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):
+        get(self, **self.conan_data["sources"][self.version], strip_root=True)
+
+    def generate(self):
+        tc = CMakeToolchain(self)
+        tc.variables["CTRL_C_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", self.source_folder, os.path.join(self.package_folder, "licenses"))
+        cmake = CMake(self)
+        cmake.install()
+
+    def package_info(self):
+        self.cpp_info.libs = ["ctrl-c"]
+
+        if self.settings.os in ["Linux", "FreeBSD"]:
+            self.cpp_info.system_libs.append("m")
diff --git a/recipes/ctrl-c/all/test_package/CMakeLists.txt b/recipes/ctrl-c/all/test_package/CMakeLists.txt
new file mode 100644
index 0000000000000..6e5e89641e866
--- /dev/null
+++ b/recipes/ctrl-c/all/test_package/CMakeLists.txt
@@ -0,0 +1,8 @@
+cmake_minimum_required(VERSION 3.15)
+project(test_package LANGUAGES CXX)
+
+find_package(ctrl-c REQUIRED CONFIG)
+
+add_executable(${PROJECT_NAME} test_package.cpp)
+target_link_libraries(${PROJECT_NAME} PRIVATE ctrl-c::ctrl-c)
+target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11)
diff --git a/recipes/ctrl-c/all/test_package/conanfile.py b/recipes/ctrl-c/all/test_package/conanfile.py
new file mode 100644
index 0000000000000..ef5d7042163ec
--- /dev/null
+++ b/recipes/ctrl-c/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.bindir, "test_package")
+            self.run(bin_path, env="conanrun")
diff --git a/recipes/ctrl-c/all/test_package/test_package.cpp b/recipes/ctrl-c/all/test_package/test_package.cpp
new file mode 100644
index 0000000000000..a36109950fc83
--- /dev/null
+++ b/recipes/ctrl-c/all/test_package/test_package.cpp
@@ -0,0 +1,8 @@
+#include "ctrl-c.h"
+
+int main(void) {
+    auto id = CtrlCLibrary::SetCtrlCHandler([](CtrlCLibrary::CtrlSignal signal){ return true;});
+    CtrlCLibrary::ResetCtrlCHandler(id);
+
+    return 0;
+}
diff --git a/recipes/ctrl-c/config.yml b/recipes/ctrl-c/config.yml
new file mode 100644
index 0000000000000..40341aa3db6cd
--- /dev/null
+++ b/recipes/ctrl-c/config.yml
@@ -0,0 +1,3 @@
+versions:
+  "1.0.0":
+    folder: all
diff --git a/recipes/cub/all/conandata.yml b/recipes/cub/all/conandata.yml
new file mode 100644
index 0000000000000..b266ef302799f
--- /dev/null
+++ b/recipes/cub/all/conandata.yml
@@ -0,0 +1,4 @@
+sources:
+  "1.17.2":
+    url: "https://github.com/NVIDIA/cub/archive/refs/tags/1.17.2.tar.gz"
+    sha256: "1013a595794548c359f22c07e1f8c620b97e3a577f7e8496d9407f74566a3e2a"
diff --git a/recipes/cub/all/conanfile.py b/recipes/cub/all/conanfile.py
new file mode 100644
index 0000000000000..c19b0eb6a8902
--- /dev/null
+++ b/recipes/cub/all/conanfile.py
@@ -0,0 +1,80 @@
+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.52.0"
+
+
+class CubConan(ConanFile):
+    name = "cub"
+    description = "Cooperative primitives for CUDA C++"
+    license = "BSD 3-Clause"
+    url = "https://github.com/conan-io/conan-center-index"
+    homepage = "https://github.com/NVIDIA/cub"
+    topics = ("algorithms", "cuda", "gpu", "nvidia", "nvidia-hpc-sdk", "header-only")
+
+    package_type = "header-library"
+    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": "191",
+            "gcc": "5",
+            "clang": "5",
+            "apple-clang": "5.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"):
+            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, "LICENSE.TXT",
+             dst=os.path.join(self.package_folder, "licenses"),
+             src=self.source_folder)
+        copy(self, "*.cuh",
+             dst=os.path.join(self.package_folder, "include", "cub"),
+             src=os.path.join(self.source_folder, "cub"))
+
+    def package_info(self):
+        self.cpp_info.bindirs = []
+        self.cpp_info.frameworkdirs = []
+        self.cpp_info.libdirs = []
+        self.cpp_info.resdirs = []
+
+        # Follows the naming conventions of the official CMake config file:
+        # https://github.com/NVIDIA/cub/blob/main/cub/cmake/cub-config.cmake
+        self.cpp_info.set_property("cmake_file_name", "cub")
+        self.cpp_info.set_property("cmake_target_name", "CUB::CUB")
+
+        # TODO: to remove in conan v2 once cmake_find_package_* generators removed
+        self.cpp_info.filenames["cmake_find_package"] = "cub"
+        self.cpp_info.filenames["cmake_find_package_multi"] = "cub"
+        self.cpp_info.names["cmake_find_package"] = "CUB"
+        self.cpp_info.names["cmake_find_package_multi"] = "CUB"
diff --git a/recipes/cub/all/test_package/CMakeLists.txt b/recipes/cub/all/test_package/CMakeLists.txt
new file mode 100644
index 0000000000000..da40597464dd4
--- /dev/null
+++ b/recipes/cub/all/test_package/CMakeLists.txt
@@ -0,0 +1,8 @@
+cmake_minimum_required(VERSION 3.15)
+project(test_package LANGUAGES CXX)
+
+find_package(cub REQUIRED CONFIG)
+
+add_executable(${PROJECT_NAME} test_package.cpp)
+target_link_libraries(${PROJECT_NAME} PRIVATE CUB::CUB)
+target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14)
diff --git a/recipes/cub/all/test_package/conanfile.py b/recipes/cub/all/test_package/conanfile.py
new file mode 100644
index 0000000000000..3a91c9439218e
--- /dev/null
+++ b/recipes/cub/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.bindir, "test_package")
+            self.run(bin_path, env="conanrun")
diff --git a/recipes/cub/all/test_package/test_package.cpp b/recipes/cub/all/test_package/test_package.cpp
new file mode 100644
index 0000000000000..60b6a6e4b6475
--- /dev/null
+++ b/recipes/cub/all/test_package/test_package.cpp
@@ -0,0 +1,9 @@
+#include 
+#include 
+#include 
+
+int main() {
+    std::cout << "CUB version: " <<
+        CUB_MAJOR_VERSION << "." << CUB_MINOR_VERSION << "." << CUB_SUBMINOR_VERSION << std::endl;
+    return EXIT_SUCCESS;
+}
diff --git a/recipes/cub/config.yml b/recipes/cub/config.yml
new file mode 100644
index 0000000000000..bcae7d8610bb8
--- /dev/null
+++ b/recipes/cub/config.yml
@@ -0,0 +1,3 @@
+versions:
+  "1.17.2":
+    folder: all
diff --git a/recipes/cubicinterpolation/all/CMakeLists.txt b/recipes/cubicinterpolation/all/CMakeLists.txt
deleted file mode 100644
index 0ed622c3eb5d7..0000000000000
--- a/recipes/cubicinterpolation/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_RPATH)
-
-add_subdirectory("source_subfolder")
diff --git a/recipes/cubicinterpolation/all/conandata.yml b/recipes/cubicinterpolation/all/conandata.yml
index 21963599ee1f4..7a7f4164cb542 100644
--- a/recipes/cubicinterpolation/all/conandata.yml
+++ b/recipes/cubicinterpolation/all/conandata.yml
@@ -1,17 +1,21 @@
 sources:
   "0.1.5":
-    url: "https://github.com/MaxSac/cubic_interpolation/archive/v0.1.5.tar.gz"
+    url: "https://github.com/tudo-astroparticlephysics/cubic_interpolation/archive/v0.1.5.tar.gz"
     sha256: "fc34de15c9dd9e651728c9e0eee5528ee9636e41a3d8aa6f41735018810afd59"
   "0.1.4":
-    url: "https://github.com/MaxSac/cubic_interpolation/archive/v0.1.4.tar.gz"
+    url: "https://github.com/tudo-astroparticlephysics/cubic_interpolation/archive/v0.1.4.tar.gz"
     sha256: "38bb8fe46b19b135bfcba79e098c5d90284f0bc02f42f86118aefcb63aed7668"
   "0.1.3":
-    url: "https://github.com/MaxSac/cubic_interpolation/archive/v0.1.3.tar.gz"
+    url: "https://github.com/tudo-astroparticlephysics/cubic_interpolation/archive/v0.1.3.tar.gz"
     sha256: "3151d99ecbbddd4e57605ff1919bdf234d08336b47d369b9dc562acff780aaf7"
 patches:
   "0.1.4":
-    - patch_file: "patches/patch_conanbuildinfo.txt"
-      base_path: "source_subfolder"
+    - patch_file: "patches/patch_conanbuildinfo.diff"
+      patch_type: "conan"
+    - patch_file: "patches/rm_conan_basic_setup.diff"
+      patch_type: "conan"
   "0.1.3":
-    - patch_file: "patches/patch_conanbuildinfo.txt"
-      base_path: "source_subfolder"
+    - patch_file: "patches/patch_conanbuildinfo.diff"
+      patch_type: "conan"
+    - patch_file: "patches/rm_conan_basic_setup.diff"
+      patch_type: "conan"
diff --git a/recipes/cubicinterpolation/all/conanfile.py b/recipes/cubicinterpolation/all/conanfile.py
index 5ab5b03d47a69..bc39a02e7855c 100644
--- a/recipes/cubicinterpolation/all/conanfile.py
+++ b/recipes/cubicinterpolation/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.build import check_min_cppstd
+from conan.tools.files import get, copy, rmdir, apply_conandata_patches, export_conandata_patches
+from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
+from conan.tools.microsoft import is_msvc, check_min_vs
 import os
 
-required_conan_version = ">=1.43.0"
+required_conan_version = ">=1.57.0"
 
 
 class CubicInterpolationConan(ConanFile):
     name = "cubicinterpolation"
-    homepage = "https://github.com/MaxSac/cubic_interpolation"
+    description = "Leightweight interpolation library based on boost and eigen."
     license = "MIT"
+    homepage = "https://github.com/MaxSac/cubic_interpolation"
     url = "https://github.com/conan-io/conan-center-index"
-    description = "Leightweight interpolation library based on boost and eigen."
     topics = ("interpolation", "splines", "cubic", "bicubic", "boost", "eigen3")
-    exports_sources = ["CMakeLists.txt", "patches/**"]
+    package_type = "library"
     settings = "os", "arch", "compiler", "build_type"
     options = {
         "shared": [True, False],
@@ -23,91 +27,69 @@ class CubicInterpolationConan(ConanFile):
         "fPIC": 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):
+        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):
-        # TODO: update boost dependency as soon as issue #11207 is fixed
-        self.requires("boost/1.75.0")
-        self.requires("eigen/3.3.9")
+    def layout(self):
+        cmake_layout(self, src_folder="src")
 
-    @property
-    def _minimum_compilers_version(self):
-        return {
-            "Visual Studio": "16",
-            "gcc": "5",
-            "clang": "5",
-            "apple-clang": "5.1",
-        }
+    def requirements(self):
+        self.requires("boost/1.85.0")
+        self.requires("eigen/3.4.0")
 
     @property
     def _required_boost_components(self):
         return ["filesystem", "math", "serialization"]
 
     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:
-            raise ConanInvalidConfiguration("{0} requires non header-only boost with these components: {1}".format(self.name, ", ".join(self._required_boost_components)))
-
-        if self.settings.compiler.get_safe("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(
-                "CubicInterpolation requires C++14. Your compiler is unknown. Assuming it supports C++14."
-            )
-        elif tools.Version(self.settings.compiler.version) < minimum_version:
+        miss_boost_required_comp = any(getattr(self.dependencies["boost"].options, 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(
-                "CubicInterpolation requires C++14, which your compiler does not support."
+                f"{self.ref} requires non header-only boost with these components: "
+                f"{', '.join(self._required_boost_components)}",
             )
 
-        if self._is_msvc and self.options.shared:
-            raise ConanInvalidConfiguration("cubicinterpolation shared is not supported with Visual Studio")
+        if self.settings.compiler.get_safe("cppstd"):
+            check_min_cppstd(self, "14")
+
+        if not check_min_vs(self, 192, raise_invalid=False):
+            raise ConanInvalidConfiguration(f"{self.ref} currently Visual Studio < 2019 not yet supported in this recipe. Contributions are welcome")
+
+        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)
-
-    def _configure_cmake(self):
-        if self._cmake:
-            return self._cmake
-        self._cmake = CMake(self)
-        self._cmake.definitions["BUILD_EXAMPLE"] = False
-        self._cmake.definitions["BUILD_DOCUMENTATION"] = False
-        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_EXAMPLE"] = False
+        tc.variables["BUILD_DOCUMENTATION"] = 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)
 
-        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", "CubicInterpolation")
diff --git a/recipes/cubicinterpolation/all/patches/patch_conanbuildinfo.diff b/recipes/cubicinterpolation/all/patches/patch_conanbuildinfo.diff
new file mode 100644
index 0000000000000..a97479b5d1290
--- /dev/null
+++ b/recipes/cubicinterpolation/all/patches/patch_conanbuildinfo.diff
@@ -0,0 +1,24 @@
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 0199a76..b7cd42c 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -11,8 +11,10 @@ add_subdirectory(CubicInterpolation)
+ add_subdirectory(detail)
+ 
+ target_link_libraries(CubicInterpolation
+-    CONAN_PKG::eigen
+-    CONAN_PKG::boost
++    Eigen3::Eigen
++    Boost::boost
++    Boost::filesystem
++    Boost::serialization
+     )
+ 
+ target_include_directories(CubicInterpolation PUBLIC
+@@ -46,6 +48,3 @@ configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/CubicInterpolationConfig.cmake
+     DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/CubicInterpolation
+     )
+-
+-install(FILES "${PROJECT_BINARY_DIR}/conanbuildinfo.cmake"
+-    DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/CubicInterpolation)
diff --git a/recipes/cubicinterpolation/all/patches/patch_conanbuildinfo.txt b/recipes/cubicinterpolation/all/patches/patch_conanbuildinfo.txt
deleted file mode 100644
index 614a14be9b7ed..0000000000000
--- a/recipes/cubicinterpolation/all/patches/patch_conanbuildinfo.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
-index 0199a76..1b0a2b4 100644
---- a/src/CMakeLists.txt
-+++ b/src/CMakeLists.txt
-@@ -46,6 +46,3 @@ configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/CubicInterpolationConfig.cmake
-     DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/CubicInterpolation
-     )
--
--install(FILES "${PROJECT_BINARY_DIR}/conanbuildinfo.cmake"
--    DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/CubicInterpolation)
diff --git a/recipes/cubicinterpolation/all/patches/rm_conan_basic_setup.diff b/recipes/cubicinterpolation/all/patches/rm_conan_basic_setup.diff
new file mode 100644
index 0000000000000..6bc1808f2d777
--- /dev/null
+++ b/recipes/cubicinterpolation/all/patches/rm_conan_basic_setup.diff
@@ -0,0 +1,15 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index db6eb04..b319d33 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -9,8 +9,8 @@ set(CubicInterpolation_VERSION ${CubicInterpolation_VERSION_MAJOR}.${CubicInterp
+ 
+ set(CMAKE_CXX_STANDARD 14)
+ 
+-include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
+-conan_basic_setup(TARGETS)
++find_package(Eigen3 REQUIRED)
++find_package(Boost COMPONENTS filesystem serialization REQUIRED)
+ 
+ add_subdirectory(src)
+ 
diff --git a/recipes/cubicinterpolation/all/test_package/CMakeLists.txt b/recipes/cubicinterpolation/all/test_package/CMakeLists.txt
index f0da4436b7927..0ce4681457d9e 100644
--- a/recipes/cubicinterpolation/all/test_package/CMakeLists.txt
+++ b/recipes/cubicinterpolation/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(CubicInterpolation REQUIRED CONFIG)
 
 add_executable(${PROJECT_NAME} test_package.cpp)
-target_link_libraries(${PROJECT_NAME} CubicInterpolation::CubicInterpolation)
-set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14)
+target_link_libraries(${PROJECT_NAME} PRIVATE CubicInterpolation::CubicInterpolation)
+target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14)
diff --git a/recipes/cubicinterpolation/all/test_package/conanfile.py b/recipes/cubicinterpolation/all/test_package/conanfile.py
index 38f4483872d47..0a6bc68712d90 100644
--- a/recipes/cubicinterpolation/all/test_package/conanfile.py
+++ b/recipes/cubicinterpolation/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/cubicinterpolation/all/test_v1_package/CMakeLists.txt b/recipes/cubicinterpolation/all/test_v1_package/CMakeLists.txt
new file mode 100644
index 0000000000000..7ea0378c83fe1
--- /dev/null
+++ b/recipes/cubicinterpolation/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/cubicinterpolation/all/test_v1_package/conanfile.py b/recipes/cubicinterpolation/all/test_v1_package/conanfile.py
new file mode 100644
index 0000000000000..38f4483872d47
--- /dev/null
+++ b/recipes/cubicinterpolation/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/cubicinterpolation/config.yml b/recipes/cubicinterpolation/config.yml
index 5185d65a2df90..5c83127c63d75 100644
--- a/recipes/cubicinterpolation/config.yml
+++ b/recipes/cubicinterpolation/config.yml
@@ -1,6 +1,6 @@
 versions:
   "0.1.5":
-    folder: all  
+    folder: all
   "0.1.4":
     folder: all
   "0.1.3":
diff --git a/recipes/cuda-api-wrappers/all/conandata.yml b/recipes/cuda-api-wrappers/all/conandata.yml
new file mode 100644
index 0000000000000..a2ea7cff0b936
--- /dev/null
+++ b/recipes/cuda-api-wrappers/all/conandata.yml
@@ -0,0 +1,13 @@
+sources:
+  "0.7.0-b2":
+    url: "https://github.com/eyalroz/cuda-api-wrappers/archive/refs/tags/v0.7.0-b2.tar.gz"
+    sha256: "9439cb2250dd3045a05d43c4ca66b5d49535eeba123b05a2e49169354fdb3123"
+  "0.7-b1":
+    url: "https://github.com/eyalroz/cuda-api-wrappers/archive/0.7b1.tar.gz"
+    sha256: "1ed5912d8f602ccd176865b824de17f462cb57142eb2a685d7cc034831e54a71"
+  "0.6.8":
+    url: "https://github.com/eyalroz/cuda-api-wrappers/archive/refs/tags/v0.6.8.tar.gz"
+    sha256: "a0d1b062dbe41c99d06df4ae7885a053c2ae3815d6fe12df0458bc5277d08ed7"
+  "0.6.3":
+    url: "https://github.com/eyalroz/cuda-api-wrappers/archive/refs/tags/v0.6.3.tar.gz"
+    sha256: "45d896136dbb4df6c75c36071899b9fe47df9a03629c95208c2d5bda979d109e"
diff --git a/recipes/cuda-api-wrappers/all/conanfile.py b/recipes/cuda-api-wrappers/all/conanfile.py
new file mode 100644
index 0000000000000..bca11c0ee8633
--- /dev/null
+++ b/recipes/cuda-api-wrappers/all/conanfile.py
@@ -0,0 +1,49 @@
+import os
+
+from conan import ConanFile
+from conan.tools.files import get, copy
+from conan.tools.layout import basic_layout
+
+required_conan_version = ">=1.52.0"
+
+
+class CudaApiWrappersConan(ConanFile):
+    name = "cuda-api-wrappers"
+    description = "Thin, unified, C++-flavored wrappers for the CUDA APIs"
+    license = "BSD-3-Clause"
+    url = "https://github.com/conan-io/conan-center-index"
+    homepage = "https://github.com/eyalroz/cuda-api-wrappers"
+    topics = ("gpgpu", "cuda", "header-only")
+    package_type = "header-library"
+    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], 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="*",
+            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 = []
+
+        if self.settings.os in ["Linux", "FreeBSD"]:
+            self.cpp_info.system_libs = ["pthread"]
diff --git a/recipes/cuda-api-wrappers/all/test_package/CMakeLists.txt b/recipes/cuda-api-wrappers/all/test_package/CMakeLists.txt
new file mode 100644
index 0000000000000..60f8a4074a3bc
--- /dev/null
+++ b/recipes/cuda-api-wrappers/all/test_package/CMakeLists.txt
@@ -0,0 +1,10 @@
+cmake_minimum_required(VERSION 3.15)
+project(test_package LANGUAGES CXX)
+
+find_package(cuda-api-wrappers REQUIRED CONFIG)
+
+add_executable(${PROJECT_NAME} test_package.cpp)
+target_link_libraries(${PROJECT_NAME} PRIVATE cuda-api-wrappers::cuda-api-wrappers)
+target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11)
+target_compile_definitions(${PROJECT_NAME} PRIVATE
+    CUDA_API_WRAPPERS_VERSION=\"${cuda-api-wrappers_VERSION_STRING}\")
diff --git a/recipes/cuda-api-wrappers/all/test_package/conanfile.py b/recipes/cuda-api-wrappers/all/test_package/conanfile.py
new file mode 100644
index 0000000000000..3a91c9439218e
--- /dev/null
+++ b/recipes/cuda-api-wrappers/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.bindir, "test_package")
+            self.run(bin_path, env="conanrun")
diff --git a/recipes/cuda-api-wrappers/all/test_package/test_package.cpp b/recipes/cuda-api-wrappers/all/test_package/test_package.cpp
new file mode 100644
index 0000000000000..b0369aaadec26
--- /dev/null
+++ b/recipes/cuda-api-wrappers/all/test_package/test_package.cpp
@@ -0,0 +1,11 @@
+#include 
+#include 
+
+CUDA_FH void test() {
+    std::cout << "cuda-api-wrappers v" << CUDA_API_WRAPPERS_VERSION << std::endl;
+}
+
+int main() {
+    test();
+    return 0;
+}
diff --git a/recipes/cuda-api-wrappers/config.yml b/recipes/cuda-api-wrappers/config.yml
new file mode 100644
index 0000000000000..60cce1aaafb6b
--- /dev/null
+++ b/recipes/cuda-api-wrappers/config.yml
@@ -0,0 +1,9 @@
+versions:
+  "0.7.0-b2":
+    folder: all
+  "0.7-b1":
+    folder: all
+  "0.6.8":
+    folder: all
+  "0.6.3":
+    folder: all
diff --git a/recipes/cuda-kat/all/conanfile.py b/recipes/cuda-kat/all/conanfile.py
index dfc221ba485b8..127039e3f143a 100644
--- a/recipes/cuda-kat/all/conanfile.py
+++ b/recipes/cuda-kat/all/conanfile.py
@@ -1,26 +1,30 @@
-from conans import ConanFile, 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.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
+
+required_conan_version = ">=1.52.0"
+
 
 class CudaKatConan(ConanFile):
     name = "cuda-kat"
-    homepage = "https://github.com/eyalroz/cuda-kat"
     description = "CUDA kernel author's tools"
-    topics = ("gpgpu", "cuda", "cuda-kat", "header-only")
-    url = "https://github.com/conan-io/conan-center-index"
-    no_copy_source = True
     license = "BSD-3-Clause"
-
+    url = "https://github.com/conan-io/conan-center-index"
+    homepage = "https://github.com/eyalroz/cuda-kat"
+    topics = ("gpgpu", "cuda", "header-only")
+    package_type = "header-library"
     settings = "os", "arch", "compiler", "build_type"
+    no_copy_source = True
 
     @property
-    def _source_subfolder(self):
-        return "source_subfolder"
-
-    def package_id(self):
-        self.info.header_only()
+    def _min_cppstd(self):
+        return 17
 
     @property
     def _compilers_minimum_version(self):
@@ -29,26 +33,47 @@ def _compilers_minimum_version(self):
             "Visual Studio": "15",
             "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 self.settings.os == "Windows":
-            raise ConanInvalidConfiguration("CUDA-kat library are not compatible on Windows")
         if self.settings.compiler.get_safe("cppstd"):
-            tools.check_min_cppstd(self, 17)
+            check_min_cppstd(self, self._min_cppstd)
+        check_min_vs(self, 191)
         minimum_version = self._compilers_minimum_version.get(str(self.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 tools.Version(self.settings.compiler.version) < minimum_version:
-            raise ConanInvalidConfiguration(f"{self.name} 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)
+        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("*", src=os.path.join(self._source_subfolder, "src"), dst="include")
+        copy(
+            self,
+            pattern="LICENSE",
+            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, "src"),
+        )
 
     def package_info(self):
-        self.cpp_info.names["cmake_find_package"] = "cuda-kat"
-        self.cpp_info.names["cmake_find_package_multi"] = "cuda-kat"
+        self.cpp_info.bindirs = []
+        self.cpp_info.libdirs = []
+
+        if is_msvc(self):
+            # Required for C++ version checks to work at
+            # https://github.com/eyalroz/cuda-kat/blob/44d381b/src/kat/detail/constexpr_by_cpp_version.hpp
+            # Otherwise MSVC will always report __cplusplus as 199711L
+            self.cpp_info.cxxflags.append("/Zc:__cplusplus")
diff --git a/recipes/cuda-kat/all/test_package/CMakeLists.txt b/recipes/cuda-kat/all/test_package/CMakeLists.txt
index a6fd14216f176..85ab0da0a3d69 100644
--- a/recipes/cuda-kat/all/test_package/CMakeLists.txt
+++ b/recipes/cuda-kat/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.15)
+project(test_package LANGUAGES CXX)
 
 find_package(cuda-kat REQUIRED CONFIG)
 
 add_executable(${PROJECT_NAME} test_package.cpp)
-target_link_libraries(${PROJECT_NAME} cuda-kat::cuda-kat)
-set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 17)
+target_link_libraries(${PROJECT_NAME} PRIVATE cuda-kat::cuda-kat)
+target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)
diff --git a/recipes/cuda-kat/all/test_package/conanfile.py b/recipes/cuda-kat/all/test_package/conanfile.py
index 49a3a66ea5bad..3a91c9439218e 100644
--- a/recipes/cuda-kat/all/test_package/conanfile.py
+++ b/recipes/cuda-kat/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.bindir, "test_package")
+            self.run(bin_path, env="conanrun")
diff --git a/recipes/cuda-samples/all/conandata.yml b/recipes/cuda-samples/all/conandata.yml
new file mode 100644
index 0000000000000..0fc2e78f080c8
--- /dev/null
+++ b/recipes/cuda-samples/all/conandata.yml
@@ -0,0 +1,10 @@
+sources:
+  "12.2":
+    url: "https://github.com/NVIDIA/cuda-samples/archive/refs/tags/v12.2.tar.gz"
+    sha256: "c9fbdee420fd4567edb1239420e2a5c93d9652b4ccf3a828fcb3e0de3152e466"
+  "11.8":
+    url: "https://github.com/NVIDIA/cuda-samples/archive/refs/tags/v11.8.tar.gz"
+    sha256: "1bc02c0ca42a323f3c7a05b5682eae703681a91e95b135bfe81f848b2d6a2c51"
+  "10.2":
+    url: "https://github.com/NVIDIA/cuda-samples/archive/refs/tags/v10.2.tar.gz"
+    sha256: "f3d224dcc7028d055617360b481947c27346d87dd1ccfbdd134ab24648c084e8"
diff --git a/recipes/cuda-samples/all/conanfile.py b/recipes/cuda-samples/all/conanfile.py
new file mode 100644
index 0000000000000..aa2ee3b794d8a
--- /dev/null
+++ b/recipes/cuda-samples/all/conanfile.py
@@ -0,0 +1,51 @@
+import os
+
+from conan import ConanFile
+from conan.tools.files import copy, get, rmdir
+from conan.tools.layout import basic_layout
+
+required_conan_version = ">=1.52.0"
+
+
+class CudaSamplesConan(ConanFile):
+    name = "cuda-samples"
+    description = ("Common headers from NVIDIA CUDA Samples - "
+                   "samples for CUDA developers which demonstrate features in CUDA Toolkit")
+    license = "BSD-3-Clause"
+    url = "https://github.com/conan-io/conan-center-index"
+    homepage = "https://github.com/NVIDIA/cuda-samples"
+    topics = ("cuda", "cuda-kernels", "cuda-driver-api", "cuda-opengl", "nvcudasamples")
+
+    package_type = "header-library"
+    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], strip_root=True)
+        # Package only headers under Common/ folder
+        rmdir(self, os.path.join(self.source_folder, "Samples"))
+        rmdir(self, os.path.join(self.source_folder, "bin"))
+        # Skip GL headers and precompiled libs, since these should be provided by separate Conan packages
+        rmdir(self, os.path.join(self.source_folder, "Common", "GL"))
+        rmdir(self, os.path.join(self.source_folder, "Common", "lib"))
+        rmdir(self, os.path.join(self.source_folder, "Common", "data"))
+
+    def build(self):
+        pass
+
+    def package(self):
+        copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder)
+        copy(self, "*",
+             dst=os.path.join(self.package_folder, "include", "Common"),
+             src=os.path.join(self.source_folder, "Common"))
+
+    def package_info(self):
+        self.cpp_info.bindirs = []
+        self.cpp_info.libdirs = []
+        self.cpp_info.includedirs.append(os.path.join("include", "Common"))
diff --git a/recipes/cuda-samples/all/test_package/CMakeLists.txt b/recipes/cuda-samples/all/test_package/CMakeLists.txt
new file mode 100644
index 0000000000000..fc3bd6fda4c9c
--- /dev/null
+++ b/recipes/cuda-samples/all/test_package/CMakeLists.txt
@@ -0,0 +1,7 @@
+cmake_minimum_required(VERSION 3.15)
+project(test_package LANGUAGES CXX)
+
+find_package(cuda-samples REQUIRED CONFIG)
+
+add_executable(${PROJECT_NAME} test_package.cpp)
+target_link_libraries(${PROJECT_NAME} PRIVATE cuda-samples::cuda-samples)
diff --git a/recipes/cuda-samples/all/test_package/conanfile.py b/recipes/cuda-samples/all/test_package/conanfile.py
new file mode 100644
index 0000000000000..3a91c9439218e
--- /dev/null
+++ b/recipes/cuda-samples/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.bindir, "test_package")
+            self.run(bin_path, env="conanrun")
diff --git a/recipes/cuda-samples/all/test_package/test_package.cpp b/recipes/cuda-samples/all/test_package/test_package.cpp
new file mode 100644
index 0000000000000..041e701c086ac
--- /dev/null
+++ b/recipes/cuda-samples/all/test_package/test_package.cpp
@@ -0,0 +1,16 @@
+#include 
+#include 
+
+// One of the few non-CUDA-specific headers in the CUDA Samples.
+#include "helper_string.h"
+
+
+int main() {
+    char file[] = "hello_world.jpg";
+    char *ext = NULL;
+    getFileExtension(file, &ext);
+
+    std::cout << "getFileExtension(\"" << file << "\") returned \"" << ext << "\"." << std::endl;
+
+    return EXIT_SUCCESS;
+}
diff --git a/recipes/cuda-samples/config.yml b/recipes/cuda-samples/config.yml
new file mode 100644
index 0000000000000..0cc56090a313f
--- /dev/null
+++ b/recipes/cuda-samples/config.yml
@@ -0,0 +1,7 @@
+versions:
+  "12.2":
+    folder: all
+  "11.8":
+    folder: all
+  "10.2":
+    folder: all
diff --git a/recipes/cunit/all/conandata.yml b/recipes/cunit/all/conandata.yml
index dc0e653a838f3..ab63da567e039 100644
--- a/recipes/cunit/all/conandata.yml
+++ b/recipes/cunit/all/conandata.yml
@@ -5,6 +5,11 @@ sources:
 patches:
   "2.1-3":
     - patch_file: "patches/0001-configure-in-msvc-shortcuts.patch"
-      base_path: "source_subfolder"
+      patch_description: "configure snprintf for msvc"
+      patch_type: "conan"
     - patch_file: "patches/0002-snprintf-msvc.patch"
-      base_path: "source_subfolder"
+      patch_description: "only set snprintf for older VS compiler"
+      patch_type: "conan"
+    - patch_file: "patches/0003-fix-copy-docs.patch"
+      patch_description: "use correct docs dir for install docs"
+      patch_type: "conan"
diff --git a/recipes/cunit/all/conanfile.py b/recipes/cunit/all/conanfile.py
index a7c3f16aa1cdc..ee93d94bc50b0 100644
--- a/recipes/cunit/all/conanfile.py
+++ b/recipes/cunit/all/conanfile.py
@@ -1,9 +1,16 @@
-from conans import AutoToolsBuildEnvironment, ConanFile, tools
-from contextlib import contextmanager
+from pathlib import Path
+
+from conan import ConanFile
+from conan.tools.microsoft import is_msvc, unix_path, check_min_vs
+from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, chdir, rename, rm
+from conan.tools.gnu import Autotools, AutotoolsToolchain
+from conan.tools.env import VirtualBuildEnv
+from conan.errors import ConanInvalidConfiguration
 import glob
 import os
+from conan.tools.layout import basic_layout
 
-required_conan_version = ">=1.33.0"
+required_conan_version = ">=1.57.0"
 
 
 class CunitConan(ConanFile):
@@ -13,7 +20,7 @@ class CunitConan(ConanFile):
     url = "https://github.com/conan-io/conan-center-index"
     homepage = "http://cunit.sourceforge.net/"
     license = "BSD-3-Clause"
-    settings = "os", "compiler", "build_type", "arch"
+    settings = "os", "arch", "compiler", "build_type"
     options = {
         "shared": [True, False],
         "fPIC": [True, False],
@@ -30,116 +37,112 @@ class CunitConan(ConanFile):
         "enable_console": True,
         "with_curses": False,
     }
-    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
 
     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):
+        basic_layout(self, src_folder="src")
 
     def requirements(self):
         if self.options.with_curses == "ncurses":
-            self.requires("ncurses/6.2")
+            self.requires("ncurses/6.4")
+
+    def validate(self):
+        if self.options.shared and not self.options.with_curses:
+            # For shared builds we always need to depend on ncurses, since otherwise we get undefined
+            # symbols, like:
+            # /usr/bin/ld: package/9333ccd2ec7e28099e1c04b315e2384b012b7a19/lib/libcunit.so: undefined reference to `echo'
+            # /usr/bin/ld: package/9333ccd2ec7e28099e1c04b315e2384b012b7a19/lib/libcunit.so: undefined reference to `wattr_on'
+            # /usr/bin/ld: package/9333ccd2ec7e28099e1c04b315e2384b012b7a19/lib/libcunit.so: undefined reference to `acs_map'
+            # /usr/bin/ld: package/9333ccd2ec7e28099e1c04b315e2384b012b7a19/lib/libcunit.so: undefined reference to `cbreak'
+            raise ConanInvalidConfiguration("cunit package is built with shared, which requires "
+                                            "cunit:with_curses=ncurses option")
 
     @property
     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", 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)
-        with tools.chdir(self._source_subfolder):
+        get(self, **self.conan_data["sources"][self.version], strip_root=True)
+        with chdir(self, self.source_folder):
             for f in glob.glob("*.c"):
                 os.chmod(f, 0o644)
 
-    @property
-    def _user_info_build(self):
-        return getattr(self, "user_info_build", self.deps_user_info)
-
-    @contextmanager
-    def _build_context(self):
-        env = {}
-        if self.settings.compiler == "Visual Studio":
-            with tools.vcvars(self.settings):
-                env.update({
-                    "AR": "{} lib".format(tools.unix_path(self._user_info_build["automake"].ar_lib)),
-                    "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)),
-                    "NM": "dumpbin -symbols",
-                    "OBJDUMP": ":",
-                    "RANLIB": ":",
-                    "STRIP": ":",
-                })
-                with tools.environment_append(env):
-                    yield
-        else:
-            with tools.environment_append(env):
-                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 = []
-        host, build = None, None
-        if self.settings.compiler == "Visual Studio":
-            self._autotools.flags.append("-FS")
-            # MSVC canonical names aren't understood
-            host, build = False, False
-        conf_args = [
-            "--datarootdir={}".format(os.path.join(self.package_folder, "bin", "share").replace("\\", "/")),
-            "--enable-debug" if self.settings.build_type == "Debug" else "--disable-debug",
-            "--enable-automated" if self.options.enable_automated else "--disable-automated",
-            "--enable-basic" if self.options.enable_basic else "--disable-basic",
-            "--enable-console" if self.options.enable_console else "--disable-console",
-            "--enable-curses" if self.options.with_curses != False else "--disable-curses",
-        ]
-        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, host=host, build=build)
-        return self._autotools
+    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.configure_args.append("--datarootdir=${prefix}/bin/share")
+        tc.configure_args.append("--enable-debug" if self.settings.build_type == "Debug" else "--disable-debug")
+        tc.configure_args.append("--enable-automated" if self.options.enable_automated else "--disable-automated")
+        tc.configure_args.append("--enable-basic" if self.options.enable_basic else "--disable-basic")
+        tc.configure_args.append("--enable-console" if self.options.enable_console else "--disable-console")
+        tc.configure_args.append("--disable-curses" if not self.options.with_curses else
+                                 "--enable-curses")
+
+        env = tc.environment()
+
+        if is_msvc(self):
+            automake_info = self.dependencies.build["automake"].conf_info
+            env.append("CC", f'{unix_path(self, automake_info.get("user.automake:compile-wrapper", check_type=str))} cl -nologo')
+            env.append("CXX", f'{unix_path(self, automake_info.get("user.automake:compile-wrapper", check_type=str))} cl -nologo')
+            env.append("AR", f'{unix_path(self, automake_info.get("user.automake:lib-wrapper", check_type=str))} lib')
+            env.define("LD", "link -nologo")
+            env.append("NM", "dumpbin -symbols")
+            env.append("OBJDUMP", ":")
+            env.append("RANLIB", ":")
+            env.append("STRIP", ":")
+        tc.generate(env)
 
     def build(self):
-        for patch in self.conan_data.get("patches", {}).get(self.version, []):
-            tools.patch(**patch)
-        with self._build_context():
-            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()
+        apply_conandata_patches(self)
+
+        # Clean up makefiles from source folder
+        os.unlink(Path(self.source_folder) / "config.status")
+        os.unlink(Path(self.source_folder) / "config.log")
+        os.unlink(Path(self.source_folder) / "Makefile")
+
+        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():
-            with tools.chdir(self._source_subfolder):
-                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", "cunit.dll.lib"),
-                         os.path.join(self.package_folder, "lib", "cunit.lib"))
-
-        tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la")
-        tools.rmdir(os.path.join(self.package_folder, "bin", "share", "man"))
-        tools.rmdir(os.path.join(self.package_folder, "doc"))
-        tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig"))
+        copy(self, "COPYING", self.source_folder, 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", "cunit.dll.lib"),
+                   os.path.join(self.package_folder, "lib", "cunit.lib"))
+
+        rm(self, "*.la", os.path.join(self.package_folder, "lib"))
+        rmdir(self, os.path.join(self.package_folder, "bin", "share", "man"))
+        rmdir(self, os.path.join(self.package_folder, "doc"))
+        rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))
 
     def package_info(self):
         self.cpp_info.names["cmake_find_package"] = "CUnit"
diff --git a/recipes/cunit/all/patches/0001-configure-in-msvc-shortcuts.patch b/recipes/cunit/all/patches/0001-configure-in-msvc-shortcuts.patch
index f934c96f0e8b0..60ee6889637dd 100644
--- a/recipes/cunit/all/patches/0001-configure-in-msvc-shortcuts.patch
+++ b/recipes/cunit/all/patches/0001-configure-in-msvc-shortcuts.patch
@@ -1,22 +1,39 @@
 --- configure.in
 +++ configure.in
-@@ -26,7 +26,7 @@
- 
+@@ -2,6 +2,7 @@
+
+ AC_INIT(CUnit, 2.1-3)
+ AM_INIT_AUTOMAKE(CUnit, 2.1-3)
++LT_INIT
+
+ dnl Package version information
+ PACKAGE=CUnit
+@@ -26,7 +27,7 @@
+
  TOPDIR=`pwd`
- 
+
 -CFLAGS="$CFLAGS -DRELEASE=@RELEASE@ -Wall -W -pedantic -Wshadow -ansi -I${PWD}/CUnit/Headers -std=c99"
 +CFLAGS="$CFLAGS -DRELEASE=@RELEASE@ -pedantic -ansi -I${PWD}/CUnit/Headers -std=c99"
  LDFLAGS="$LDFLAGS -L${PWD}/CUnit/Sources"
- 
+
  AC_ARG_ENABLE(debug,
-@@ -186,13 +186,13 @@
+@@ -158,7 +159,7 @@
+ AC_PROG_CC
+ AC_PROG_INSTALL
+ AC_PROG_MAKE_SET
+-AC_PROG_LIBTOOL
++#AC_PROG_LIBTOOL
+
+ dnl Check for libraries
+ AC_CHECK_LIB(c, main)
+@@ -186,13 +187,13 @@
  AC_CHECK_FUNC(calloc, [], [echo calloc not found; exit 1])
  AC_CHECK_FUNC(realloc, [], [echo realloc not found; exit 1])
- 
+
 -AC_CHECK_FUNC(strcpy, [], [echo strcpy not found; exit 1])
 +dnl AC_CHECK_FUNC(strcpy, [], [echo strcpy not found; exit 1])
  AC_CHECK_FUNC(strerror, [], [echo strerror not found; exit 1])
- 
+
  AC_CHECK_FUNC(fopen, [], [echo fopen not found; exit 1])
  AC_CHECK_FUNC(fclose, [], [echo fclose not found; exit 1])
 -AC_CHECK_FUNC(fprintf, [], [echo fprintf not found; exit 1])
@@ -24,7 +41,7 @@
 +dnl AC_CHECK_FUNC(fprintf, [], [echo fprintf not found; exit 1])
 +dnl AC_CHECK_FUNC(snprintf, [], [echo snprintf not found; exit 1])
  AC_CHECK_FUNC(setvbuf, [], [echo setvbuf not found; exit 1])
- 
+
  AC_CHECK_FUNC(time, [], [echo time not found; exit 1])
 --- CUnit/Sources/Makefile.am
 +++ CUnit/Sources/Makefile.am
diff --git a/recipes/cunit/all/patches/0003-fix-copy-docs.patch b/recipes/cunit/all/patches/0003-fix-copy-docs.patch
new file mode 100644
index 0000000000000..6dc9a36c9301d
--- /dev/null
+++ b/recipes/cunit/all/patches/0003-fix-copy-docs.patch
@@ -0,0 +1,9 @@
+--- doc/headers/Makefile.am
++++ doc/headers/Makefile.am
+@@ -23,5 +23,6 @@
+ 
+ copy_headers:
+ 	cp -f $(top_srcdir)/CUnit/Headers/*.h .
++	cp -f $(top_builddir)/CUnit/Headers/*.h .
+ 	cp -f $(top_srcdir)/CUnit/Sources/Win/Win.h .
+ 
diff --git a/recipes/cunit/all/test_package/CMakeLists.txt b/recipes/cunit/all/test_package/CMakeLists.txt
index 34af13462f44f..b32c10a586ed8 100644
--- a/recipes/cunit/all/test_package/CMakeLists.txt
+++ b/recipes/cunit/all/test_package/CMakeLists.txt
@@ -1,8 +1,7 @@
 cmake_minimum_required(VERSION 3.1)
 project(test_package)
 
-include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
-conan_basic_setup()
+find_package(cunit CONFIG REQUIRED)
 
 add_executable(${PROJECT_NAME} test_package.c)
-target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS})
+target_link_libraries(${PROJECT_NAME} cunit::cunit)
diff --git a/recipes/cunit/all/test_package/conanfile.py b/recipes/cunit/all/test_package/conanfile.py
index d4128b0450777..7c46f27b018cf 100644
--- a/recipes/cunit/all/test_package/conanfile.py
+++ b/recipes/cunit/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", "VirtualBuildEnv"
+    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.bindir, "test_package")
+            self.run(bin_path, env="conanrun")
diff --git a/recipes/curlpp/all/conandata.yml b/recipes/curlpp/all/conandata.yml
new file mode 100644
index 0000000000000..81a27c2d764c6
--- /dev/null
+++ b/recipes/curlpp/all/conandata.yml
@@ -0,0 +1,15 @@
+sources:
+  "0.8.1.cci.20240530":
+    url: "https://github.com/jpbarrette/curlpp/archive/8840ec806a75a6def9ed07845a620f6d170e5821.tar.gz"
+    sha256: "1260326d966ec75a50feccb5411268f9aeca667d97f8132973bdb0783ecceb3c"
+patches:
+  "0.8.1.cci.20240530":
+    - patch_file: "patches/0001-disable-static-on-shared.patch"
+      patch_description: "disable building static library on shared=True"
+      patch_type: "conan"
+    - patch_file: "patches/0002-disable-cpp11.patch"
+      patch_description: "disable specifying C++11"
+      patch_type: "conan"
+    - patch_file: "patches/0003-replace-project-declaration.patch"
+      patch_description: "switch positions between project() and cmake_minimum_required()"
+      patch_type: "conan"
diff --git a/recipes/curlpp/all/conanfile.py b/recipes/curlpp/all/conanfile.py
new file mode 100644
index 0000000000000..706675da9ba61
--- /dev/null
+++ b/recipes/curlpp/all/conanfile.py
@@ -0,0 +1,90 @@
+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, rm
+from conan.tools.scm import Version
+from conan.tools.microsoft import is_msvc
+import os
+
+required_conan_version = ">=1.53.0"
+
+class CurlppConan(ConanFile):
+    name = "curlpp"
+    description = "C++ wrapper around libcURL"
+    license = "MIT"
+    url = "https://github.com/conan-io/conan-center-index"
+    homepage = "https://github.com/jpbarrette/curlpp"
+    topics = ("curl", "libcurl")
+    package_type = "library"
+    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):
+        # As it's a wrapper, it includes curl symbols in its public headers
+        self.requires("libcurl/8.9.1", transitive_headers=True, transitive_libs=True)
+
+    def validate(self):
+        if self.settings.compiler.get_safe("cppstd"):
+            check_min_cppstd(self, self._min_cppstd)
+        else:
+            if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "6":
+                raise ConanInvalidConfiguration("${self.ref} requires C++11. Please set 'compiler.cppstd=11'.")
+            if self.settings.compiler == "apple-clang" and Version(self.settings.compiler.version) < "14":
+                raise ConanInvalidConfiguration("${self.ref} requires C++11. Please set 'compiler.cppstd=11'.")
+
+    def source(self):
+        get(self, **self.conan_data["sources"][self.version], strip_root=True)
+
+    def generate(self):
+        tc = CMakeToolchain(self)
+        tc.variables["CURLPP_BUILD_SHARED_LIBS"] = self.options.shared
+        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", os.path.join(self.source_folder, "doc"), os.path.join(self.package_folder, "licenses"))
+        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"))
+        rm(self, "curlpp-config", os.path.join(self.package_folder, "bin"))
+
+    def package_info(self):
+        self.cpp_info.libs = ["libcurlpp" if is_msvc(self) and not self.options.shared else "curlpp"]
+
+        self.cpp_info.set_property("cmake_file_name", "curlpp")
+        self.cpp_info.set_property("cmake_target_name", "curlpp::curlpp")
diff --git a/recipes/curlpp/all/patches/0001-disable-static-on-shared.patch b/recipes/curlpp/all/patches/0001-disable-static-on-shared.patch
new file mode 100644
index 0000000000000..4660e359d71c2
--- /dev/null
+++ b/recipes/curlpp/all/patches/0001-disable-static-on-shared.patch
@@ -0,0 +1,34 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 4f550b5..ca97e64 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -108,7 +108,7 @@ if(CURLPP_BUILD_SHARED_LIBS)
+    target_include_directories(${PROJECT_NAME} PUBLIC $)
+    target_link_libraries(${PROJECT_NAME} PUBLIC CURL::libcurl ${CONAN_LIBS})
+    set_target_properties(${PROJECT_NAME} PROPERTIES SOVERSION 1 VERSION 1.0.0)
+-endif()
++else()
+ 
+ add_library(${PROJECT_NAME}_static STATIC ${HeaderFileList} ${SourceFileList})
+ add_library(${PROJECT_NAME}::${PROJECT_NAME}_static ALIAS ${PROJECT_NAME}_static)
+@@ -126,16 +126,16 @@ SET_TARGET_PROPERTIES(${PROJECT_NAME}_static PROPERTIES OUTPUT_NAME ${PROJECT_NA
+ # so we add a "lib" prefix (which is default on other platforms anyway):
+ SET_TARGET_PROPERTIES(${PROJECT_NAME}_static PROPERTIES PREFIX "lib")
+-target_link_libraries(${PROJECT_NAME}_static ${CURL_LIBRARIES} ${CONAN_LIBS})
+-
++target_link_libraries(${PROJECT_NAME}_static CURL::libcurl ${CONAN_LIBS})
++endif()
+ # install headers
+ install(FILES "${PROJECT_SOURCE_DIR}/cmake/curlppConfig.cmake" DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/curlpp")
+ install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
+ 
+ if(CURLPP_BUILD_SHARED_LIBS)
+   install(TARGETS curlpp EXPORT curlppTargets INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
+-endif()
++else()
+   install(TARGETS curlpp_static EXPORT curlppTargets INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
+-  
++endif()
+ install(
+     EXPORT curlppTargets
+     DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/curlpp"
diff --git a/recipes/curlpp/all/patches/0002-disable-cpp11.patch b/recipes/curlpp/all/patches/0002-disable-cpp11.patch
new file mode 100644
index 0000000000000..972db13b339f7
--- /dev/null
+++ b/recipes/curlpp/all/patches/0002-disable-cpp11.patch
@@ -0,0 +1,26 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index ca97e64..bdb257e 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -22,7 +22,7 @@ if(WIN32)
+     cmake_minimum_required(VERSION 3.4)
+ 
+     # c++ 11 support from cmake 3.4 or newer
+-    set(CMAKE_CXX_STANDARD 11) # C++11...
++    # set(CMAKE_CXX_STANDARD 11) # C++11...
+     set(CMAKE_CXX_STANDARD_REQUIRED ON) #...is required...
+     set(CMAKE_CXX_EXTENSIONS OFF) #...without compiler extensions like gnu++11
+ 
+@@ -43,10 +43,10 @@ if(WIN32)
+         #
+         # for non-windows platform we try to keep cmake 2.8 support
+         # since entreprise distribution tends to have 2.8 version.
+-        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
++        # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
+     else()
+         # c++ 11 support from cmake 3.1 or newer
+-        set(CMAKE_CXX_STANDARD 11) # C++11...
++        # set(CMAKE_CXX_STANDARD 11) # C++11...
+         set(CMAKE_CXX_STANDARD_REQUIRED ON) #...is required...
+         set(CMAKE_CXX_EXTENSIONS OFF) #...without compiler extensions like gnu++11
+     endif()
diff --git a/recipes/curlpp/all/patches/0003-replace-project-declaration.patch b/recipes/curlpp/all/patches/0003-replace-project-declaration.patch
new file mode 100644
index 0000000000000..d5aa092f726ef
--- /dev/null
+++ b/recipes/curlpp/all/patches/0003-replace-project-declaration.patch
@@ -0,0 +1,19 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index bfba06b..7f4c6fd 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -1,6 +1,3 @@
+-project(curlpp)
+-
+-
+ # In response to CMake 3.0 generating warnings regarding policy CMP0042,
+ # the OSX RPATH settings have been updated per recommendations found
+ # in the CMake Wiki:
+@@ -52,6 +49,7 @@ if(WIN32)
+     endif()
+ endif()
+ 
++project(curlpp)
+ 
+ # Conan.io integration
+ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/conanbuildinfo.cmake)
diff --git a/recipes/curlpp/all/test_package/CMakeLists.txt b/recipes/curlpp/all/test_package/CMakeLists.txt
new file mode 100644
index 0000000000000..b5fa1057f20ec
--- /dev/null
+++ b/recipes/curlpp/all/test_package/CMakeLists.txt
@@ -0,0 +1,8 @@
+cmake_minimum_required(VERSION 3.15)
+project(test_package LANGUAGES CXX)
+
+find_package(curlpp REQUIRED CONFIG)
+
+add_executable(${PROJECT_NAME} test_package.cpp)
+target_link_libraries(${PROJECT_NAME} PRIVATE curlpp::curlpp)
+target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11)
diff --git a/recipes/curlpp/all/test_package/conanfile.py b/recipes/curlpp/all/test_package/conanfile.py
new file mode 100644
index 0000000000000..ef5d7042163ec
--- /dev/null
+++ b/recipes/curlpp/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.bindir, "test_package")
+            self.run(bin_path, env="conanrun")
diff --git a/recipes/curlpp/all/test_package/test_package.cpp b/recipes/curlpp/all/test_package/test_package.cpp
new file mode 100644
index 0000000000000..a1ad47c5108eb
--- /dev/null
+++ b/recipes/curlpp/all/test_package/test_package.cpp
@@ -0,0 +1,11 @@
+
+#include 
+#include 
+#include 
+
+using namespace curlpp::options;
+
+int main(int, char **) {
+    curlpp::Easy myRequest;
+	myRequest.setOpt("http://example.com");
+}
diff --git a/recipes/curlpp/config.yml b/recipes/curlpp/config.yml
new file mode 100644
index 0000000000000..1925bfdc53ee3
--- /dev/null
+++ b/recipes/curlpp/config.yml
@@ -0,0 +1,3 @@
+versions:
+  "0.8.1.cci.20240530":
+    folder: all
diff --git a/recipes/cute_headers/all/conanfile.py b/recipes/cute_headers/all/conanfile.py
index 2aeb5719c6df9..5845ff0bcc925 100644
--- a/recipes/cute_headers/all/conanfile.py
+++ b/recipes/cute_headers/all/conanfile.py
@@ -1,39 +1,46 @@
-from conans import ConanFile, tools
+from conan import ConanFile
+from conan.tools.files import get, copy, load, save
+from conan.tools.layout import basic_layout
 import os
-import glob
+
+
+required_conan_version = ">=1.52.0"
 
 
 class CuteHeadersConan(ConanFile):
     name = "cute_headers"
     description = "Various single-file cross-platform C/C++ headers implementing self-contained libraries."
-    topics = ("conan", "various", "pure-c")
+    topics = ("various", "pure-c")
     url = "https://github.com/conan-io/conan-center-index"
     homepage = "https://github.com/RandyGaul/cute_headers"
     license = "Unlicense"
+    package_type = "header-library"
     no_copy_source = True
 
     def _extract_license(self):
-        file = os.path.join(self.package_folder, "include/cute_math2d.h")
-        file_content = tools.load(file)
+        file = os.path.join(self.package_folder, "include", "cute_math2d.h")
+        file_content = load(self, file)
         return file_content[file_content.rfind('/*'):]
 
-    @property
-    def _source_subfolder(self):
-        return "source_subfolder"
+    def layout(self):
+        basic_layout(self, src_folder="src")
 
     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 package(self):
-        self.copy(
+        copy(
+            self,
             pattern="*.h",
-            dst="include",
-            src=self._source_subfolder,
+            dst=os.path.join(self.package_folder, "include"),
+            src=self.source_folder,
             excludes=("examples_cute_*", "test_cute_*")
         )
-        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())
 
     def package_id(self):
-        self.info.header_only()
+        self.info.clear()
+
+    def package_info(self):
+        self.cpp_info.bindirs = []
+        self.cpp_info.libdirs = []
diff --git a/recipes/cute_headers/all/test_package/CMakeLists.txt b/recipes/cute_headers/all/test_package/CMakeLists.txt
index b9be759ce7016..766b80640f9c1 100644
--- a/recipes/cute_headers/all/test_package/CMakeLists.txt
+++ b/recipes/cute_headers/all/test_package/CMakeLists.txt
@@ -1,11 +1,7 @@
-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()
+find_package(cute_headers REQUIRED CONFIG)
 
 add_executable(${PROJECT_NAME} test_package.c)
-target_link_libraries(
-  ${PROJECT_NAME}
-  ${CONAN_LIBS}
-)
+target_link_libraries(${PROJECT_NAME} PRIVATE cute_headers::cute_headers)
diff --git a/recipes/cute_headers/all/test_package/conanfile.py b/recipes/cute_headers/all/test_package/conanfile.py
index b63178709d69f..9be22ab3d97f8 100644
--- a/recipes/cute_headers/all/test_package/conanfile.py
+++ b/recipes/cute_headers/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 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.bindir, "test_package")
+            self.run(bin_path, env="conanrun")
diff --git a/recipes/cutlass/all/conandata.yml b/recipes/cutlass/all/conandata.yml
new file mode 100644
index 0000000000000..523f2fccdef91
--- /dev/null
+++ b/recipes/cutlass/all/conandata.yml
@@ -0,0 +1,7 @@
+sources:
+  "3.5.1":
+    url: "https://github.com/NVIDIA/cutlass/archive/refs/tags/v3.5.1.tar.gz"
+    sha256: "20b7247cda2d257cbf8ba59ba3ca40a9211c4da61a9c9913e32b33a2c5883a36"
+  "3.5.0":
+    url: "https://github.com/NVIDIA/cutlass/archive/refs/tags/v3.5.0.tar.gz"
+    sha256: "ef6af8526e3ad04f9827f35ee57eec555d09447f70a0ad0cf684a2e426ccbcb6"
diff --git a/recipes/cutlass/all/conanfile.py b/recipes/cutlass/all/conanfile.py
new file mode 100644
index 0000000000000..b134b6034bae1
--- /dev/null
+++ b/recipes/cutlass/all/conanfile.py
@@ -0,0 +1,106 @@
+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, CMakeToolchain, cmake_layout
+from conan.tools.env import VirtualBuildEnv
+from conan.tools.files import copy, get, rmdir, replace_in_file
+from conan.tools.scm import Version
+
+required_conan_version = ">=1.52.0"
+
+
+class CutlassConan(ConanFile):
+    name = "cutlass"
+    description = "CUTLASS: CUDA Templates for Linear Algebra Subroutines"
+    license = "BSD-3-Clause"
+    url = "https://github.com/conan-io/conan-center-index"
+    homepage = "https://github.com/NVIDIA/cutlass"
+    topics = ("linear-algebra", "gpu", "cuda", "deep-learning", "nvidia", "header-only")
+
+    package_type = "header-library"
+    settings = "os", "arch", "compiler", "build_type"
+    short_paths = True
+    # TODO: add header_only=False option
+
+    @property
+    def _min_cppstd(self):
+        return 17
+
+    @property
+    def _compilers_minimum_version(self):
+        return {
+            "gcc": "7",
+            "clang": "7",
+            "apple-clang": "7",
+            "msvc": "192",
+            "Visual Studio": "16",
+        }
+
+    def layout(self):
+        cmake_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 build_requirements(self):
+        self.tool_requires("cmake/[>=3.19 <4]")
+
+    def source(self):
+        get(self, **self.conan_data["sources"][self.version], strip_root=True)
+
+    def generate(self):
+        # Install via CMake to ensure headers are configured correctly
+        tc = CMakeToolchain(self)
+        tc.cache_variables["CMAKE_SUPPRESS_REGENERATION"] = True
+        tc.cache_variables["CUTLASS_REVISION"]=f"v{self.version}"
+        tc.cache_variables["CUTLASS_NATIVE_CUDA"] = False
+        tc.cache_variables["CUTLASS_ENABLE_HEADERS_ONLY"] = True
+        tc.cache_variables["CUTLASS_ENABLE_TOOLS"] = False
+        tc.cache_variables["CUTLASS_ENABLE_LIBRARY"] = False
+        tc.cache_variables["CUTLASS_ENABLE_PROFILER"] = False
+        tc.cache_variables["CUTLASS_ENABLE_PERFORMANCE"] = False
+        tc.cache_variables["CUTLASS_ENABLE_TESTS"] = False
+        tc.cache_variables["CUTLASS_ENABLE_GTEST_UNIT_TESTS"] = False
+        tc.cache_variables["CUTLASS_ENABLE_CUBLAS"] = False
+        tc.cache_variables["CUTLASS_ENABLE_CUDNN"] = False
+        tc.generate()
+        VirtualBuildEnv(self).generate()
+
+    def _patch_sources(self):
+        # Don't look for CUDA, we're only installing the headers
+        replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "include(${CMAKE_CURRENT_SOURCE_DIR}/CUDA.cmake)",
+                                                                                 """
+                                                                                 if(NOT CUTLASS_ENABLE_HEADERS_ONLY)
+                                                                                 include(${CMAKE_CURRENT_SOURCE_DIR}/CUDA.cmake)
+                                                                                 endif()""")
+
+    def build(self):
+        self._patch_sources()
+        cmake = CMake(self)
+        cmake.configure()
+        cmake.build()
+
+    def package(self):
+        copy(self, "LICENSE.txt", self.source_folder, os.path.join(self.package_folder, "licenses"))
+        cmake = CMake(self)
+        cmake.install()
+        rmdir(self, os.path.join(self.package_folder, "lib"))
+        rmdir(self, os.path.join(self.package_folder, "test"))
+
+
+    def package_info(self):
+        self.cpp_info.set_property("cmake_file_name", "NvidiaCutlass")
+        self.cpp_info.set_property("cmake_target_name", "nvidia::cutlass::cutlass")
+        self.cpp_info.bindirs = []
+        self.cpp_info.libdirs = []
diff --git a/recipes/cutlass/all/test_package/CMakeLists.txt b/recipes/cutlass/all/test_package/CMakeLists.txt
new file mode 100644
index 0000000000000..a4872b3ed37c7
--- /dev/null
+++ b/recipes/cutlass/all/test_package/CMakeLists.txt
@@ -0,0 +1,8 @@
+cmake_minimum_required(VERSION 3.15)
+project(test_package LANGUAGES CXX)
+
+find_package(NvidiaCutlass REQUIRED CONFIG)
+
+add_executable(${PROJECT_NAME} test_package.cpp)
+target_link_libraries(${PROJECT_NAME} PRIVATE nvidia::cutlass::cutlass)
+target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)
diff --git a/recipes/cutlass/all/test_package/conanfile.py b/recipes/cutlass/all/test_package/conanfile.py
new file mode 100644
index 0000000000000..3a91c9439218e
--- /dev/null
+++ b/recipes/cutlass/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.bindir, "test_package")
+            self.run(bin_path, env="conanrun")
diff --git a/recipes/cutlass/all/test_package/test_package.cpp b/recipes/cutlass/all/test_package/test_package.cpp
new file mode 100644
index 0000000000000..9e74847cbedd3
--- /dev/null
+++ b/recipes/cutlass/all/test_package/test_package.cpp
@@ -0,0 +1,10 @@
+#include 
+
+#include 
+
+int main() {
+    std::cout << "CUTLASS version: " <<
+        cutlass::getVersionMajor() << "." <<
+        cutlass::getVersionMinor() << "." <<
+        cutlass::getVersionPatch() << std::endl;
+}
diff --git a/recipes/cutlass/config.yml b/recipes/cutlass/config.yml
new file mode 100644
index 0000000000000..d6d6471b30fef
--- /dev/null
+++ b/recipes/cutlass/config.yml
@@ -0,0 +1,5 @@
+versions:
+  "3.5.1":
+    folder: all
+  "3.5.0":
+    folder: all
diff --git a/recipes/cvplot/all/conanfile.py b/recipes/cvplot/all/conanfile.py
index 49ceaeafa285e..4984563ed0526 100644
--- a/recipes/cvplot/all/conanfile.py
+++ b/recipes/cvplot/all/conanfile.py
@@ -1,35 +1,59 @@
-from conans import ConanFile, tools
 import os
 
-required_conan_version = ">=1.43.0"
+from conan import ConanFile
+from conan.tools.files import copy, get
+from conan.tools.layout import basic_layout
+
+required_conan_version = ">=1.52.0"
 
 
 class CvPlotConan(ConanFile):
     name = "cvplot"
-    description = "fast modular opencv plotting library"
+    description = "Fast modular OpenCV plotting library"
     license = "MIT"
-    topics = ("plot", "opencv", "diagram", "plotting")
-    homepage = "https://github.com/Profactor/cv-plot"
     url = "https://github.com/conan-io/conan-center-index"
-    requires = "opencv/4.5.3"
+    homepage = "https://github.com/Profactor/cv-plot"
+    topics = ("plot", "opencv", "diagram", "plotting", "header-only")
+
+    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 requirements(self):
+        self.requires("opencv/4.5.5")
+
+    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(self):
-        self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder)
-        self.copy(pattern="*", dst="include", src=os.path.join(self._source_subfolder, "CvPlot", "inc"))
-        
-    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="*",
+            dst=os.path.join(self.package_folder, "include"),
+            src=os.path.join(self.source_folder, "CvPlot", "inc"),
+        )
+
     def package_info(self):
+        self.cpp_info.bindirs = []
+        self.cpp_info.libdirs = []
+
+        self.cpp_info.set_property("cmake_file_name", "CvPlot")
+        self.cpp_info.set_property("cmake_target_name", "CvPlot::CvPlot")
+        self.cpp_info.set_property("cmake_find_mode", "both")
+
         self.cpp_info.defines.append("CVPLOT_HEADER_ONLY")
-        self.cpp_info.set_property("cmake_find_mode", "both") 
+
         self.cpp_info.names["cmake_find_package"] = "CvPlot"
         self.cpp_info.names["cmake_find_package_multi"] = "CvPlot"
diff --git a/recipes/cvplot/all/test_package/CMakeLists.txt b/recipes/cvplot/all/test_package/CMakeLists.txt
index b75c35da97dea..209693284dcea 100644
--- a/recipes/cvplot/all/test_package/CMakeLists.txt
+++ b/recipes/cvplot/all/test_package/CMakeLists.txt
@@ -1,9 +1,6 @@
-cmake_minimum_required(VERSION 3.1)
+cmake_minimum_required(VERSION 3.15)
 project(test_package CXX)
 
-include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
-conan_basic_setup(TARGETS)
-
 find_package(CvPlot CONFIG REQUIRED)
 
 add_executable(${PROJECT_NAME} test_package.cpp)
diff --git a/recipes/cvplot/all/test_package/conanfile.py b/recipes/cvplot/all/test_package/conanfile.py
index 49a3a66ea5bad..ef5d7042163ec 100644
--- a/recipes/cvplot/all/test_package/conanfile.py
+++ b/recipes/cvplot/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.bindir, "test_package")
+            self.run(bin_path, env="conanrun")
diff --git a/recipes/cvplot/all/test_package/test_package.cpp b/recipes/cvplot/all/test_package/test_package.cpp
index 0592129b4a676..da5278d1f8f60 100644
--- a/recipes/cvplot/all/test_package/test_package.cpp
+++ b/recipes/cvplot/all/test_package/test_package.cpp
@@ -3,7 +3,7 @@
 using namespace CvPlot;
 
 int main() {
-	Axes axes = plot(std::vector{ 3, 3, 4, 6, 4, 3 }, "-o");
-	cv::Mat mat = axes.render(400, 600);
+    Axes axes = plot(std::vector{3, 3, 4, 6, 4, 3}, "-o");
+    cv::Mat mat = axes.render(400, 600);
     return 0;
 }
diff --git a/recipes/cwalk/all/conandata.yml b/recipes/cwalk/all/conandata.yml
index 89588e33be62f..0ae84f70cd58a 100644
--- a/recipes/cwalk/all/conandata.yml
+++ b/recipes/cwalk/all/conandata.yml
@@ -1,4 +1,7 @@
 sources:
+  "1.2.8":
+    url: "https://github.com/likle/cwalk/archive/v1.2.8.tar.gz"
+    sha256: "48b99bd46f0b9ce027ca882b003e44a5db0369dec6fd9898fd5420aa282d780f"
   "1.2.7":
     url: "https://github.com/likle/cwalk/archive/v1.2.7.tar.gz"
     sha256: "ae424ec30830c970412e34d9092eaa6131d91af289cdad0ad66a7b1c58e768e7"
@@ -18,15 +21,31 @@ sources:
     url: "https://github.com/likle/cwalk/archive/v1.0.0.zip"
     sha256: "9ff6d85f88e7fe4877698afb40745d301491c1d3fca96f08d1622f5fe3494182"
 patches:
+  "1.2.8":
+    - patch_file: "patches/0001-fix-cmake-1.2.8.patch"
+      patch_description: "disable warnings"
+      patch_type: "conan"
   "1.2.7":
     - patch_file: "patches/0001-fix-cmake-1.2.5.patch"
+      patch_description: "disable warnings"
+      patch_type: "conan"
   "1.2.6":
     - patch_file: "patches/0001-fix-cmake-1.2.5.patch"
+      patch_description: "disable warnings"
+      patch_type: "conan"
   "1.2.5":
     - patch_file: "patches/0001-fix-cmake-1.2.5.patch"
+      patch_description: "disable warnings"
+      patch_type: "conan"
   "1.2.2":
     - patch_file: "patches/0001-fix-cmake-1.2.2.patch"
+      patch_description: "add installer, disable test"
+      patch_type: "conan"
   "1.1.0":
     - patch_file: "patches/0001-fix-cmake-1.1.0.patch"
+      patch_description: "add installer, disable test"
+      patch_type: "conan"
   "1.0.0":
     - patch_file: "patches/0001-fix-cmake-1.0.0.patch"
+      patch_description: "add installer, disable test"
+      patch_type: "conan"
diff --git a/recipes/cwalk/all/conanfile.py b/recipes/cwalk/all/conanfile.py
index fa74a668f51fa..dc9e4e2bd3639 100644
--- a/recipes/cwalk/all/conanfile.py
+++ b/recipes/cwalk/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.47.0"
+required_conan_version = ">=1.53.0"
 
 
 class CwalkConan(ConanFile):
@@ -13,13 +13,13 @@ class CwalkConan(ConanFile):
     description = "Path library for C/C++. Cross-Platform for Windows, " \
                   "MacOS and Linux. Supports UNIX and Windows path styles " \
                   "on those platforms."
-    url = "https://github.com/conan-io/conan-center-index"
     license = "MIT"
+    url = "https://github.com/conan-io/conan-center-index"
     homepage = "https://likle.github.io/cwalk/"
-    topics = ("cwalk", "cross-platform", "windows", "macos", "osx", "linux",
+    topics = ("cross-platform", "windows", "macos", "osx", "linux",
               "path-manipulation", "path", "directory", "file", "file-system",
               "unc", "path-parsing", "file-path")
-
+    package_type = "library"
     settings = "os", "arch", "compiler", "build_type"
     options = {
         "shared": [True, False],
@@ -31,8 +31,7 @@ class CwalkConan(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,22 +39,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)
@@ -72,6 +64,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"))
 
         # TODO: to remove in conan v2 once cmake_find_package_* generators removed
         self._create_cmake_module_alias_targets(
@@ -100,6 +93,8 @@ def package_info(self):
         self.cpp_info.libs = ["cwalk"]
         if self.options.shared and Version(self.version) >= "1.2.5":
             self.cpp_info.defines.append("CWK_SHARED")
+        if Version(self.version) >= "1.2.8":
+            self.cpp_info.set_property("pkg_config_name", "cwalk")
 
         # TODO: to remove in conan v2 once cmake_find_package_* generators removed
         self.cpp_info.filenames["cmake_find_package"] = "Cwalk"
diff --git a/recipes/cwalk/all/patches/0001-fix-cmake-1.2.8.patch b/recipes/cwalk/all/patches/0001-fix-cmake-1.2.8.patch
new file mode 100644
index 0000000000000..fb90bad966d4c
--- /dev/null
+++ b/recipes/cwalk/all/patches/0001-fix-cmake-1.2.8.patch
@@ -0,0 +1,13 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index ed38852..9d4ec62 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -41,7 +41,7 @@ endif()
+ add_library(cwalk
+   "${INCLUDE_DIRECTORY}/cwalk.h"
+   "${SOURCE_DIRECTORY}/cwalk.c")
+-enable_warnings(cwalk)
++# enable_warnings(cwalk)
+ target_include_directories(cwalk PUBLIC
+   $
+   $
diff --git a/recipes/cwalk/all/test_package/conanfile.py b/recipes/cwalk/all/test_package/conanfile.py
index 3a8c6c5442b33..0a6bc68712d90 100644
--- a/recipes/cwalk/all/test_package/conanfile.py
+++ b/recipes/cwalk/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/cwalk/all/test_v1_package/CMakeLists.txt b/recipes/cwalk/all/test_v1_package/CMakeLists.txt
index 9e3af2e4fad4c..0d20897301b68 100644
--- a/recipes/cwalk/all/test_v1_package/CMakeLists.txt
+++ b/recipes/cwalk/all/test_v1_package/CMakeLists.txt
@@ -1,11 +1,8 @@
-cmake_minimum_required(VERSION 3.8)
-project(test_package LANGUAGES C)
+cmake_minimum_required(VERSION 3.1)
+project(test_package)
 
 include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
 conan_basic_setup(TARGETS)
 
-find_package(Cwalk REQUIRED CONFIG)
-
-add_executable(${PROJECT_NAME} ../test_package/test_package.c)
-target_link_libraries(${PROJECT_NAME} PRIVATE cwalk)
-target_compile_features(${PROJECT_NAME} PRIVATE c_std_11)
+add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package
+                 ${CMAKE_CURRENT_BINARY_DIR}/test_package)
diff --git a/recipes/cwalk/config.yml b/recipes/cwalk/config.yml
index 3a4a484ff7332..42be9164c47b3 100644
--- a/recipes/cwalk/config.yml
+++ b/recipes/cwalk/config.yml
@@ -1,4 +1,6 @@
 versions:
+  "1.2.8":
+    folder: all
   "1.2.7":
     folder: all
   "1.2.6":
diff --git a/recipes/cxxgraph/all/conandata.yml b/recipes/cxxgraph/all/conandata.yml
new file mode 100644
index 0000000000000..3b4bdb95b9d3a
--- /dev/null
+++ b/recipes/cxxgraph/all/conandata.yml
@@ -0,0 +1,7 @@
+sources:
+  "4.1.0":
+    url: "https://github.com/ZigRazor/CXXGraph/archive/refs/tags/v4.1.0.tar.gz"
+    sha256: "1f6601abfcb692f35bfe14f2a34b2302f70213a257b0f7d541a110d6bd460040"
+  "3.1.0":
+    url: "https://github.com/ZigRazor/CXXGraph/archive/refs/tags/v3.1.0.tar.gz"
+    sha256: "54838d0d35a6f2685cf45e50e888146aef3c1a10fbbdddb939b3985c7953087a"
diff --git a/recipes/cxxgraph/all/conanfile.py b/recipes/cxxgraph/all/conanfile.py
new file mode 100644
index 0000000000000..9765a25c1f6eb
--- /dev/null
+++ b/recipes/cxxgraph/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
+from conan.tools.scm import Version
+from conan.tools.microsoft import is_msvc
+import os
+
+
+required_conan_version = ">=1.52.0"
+
+
+class CxxgraphConan(ConanFile):
+    name = "cxxgraph"
+    description = "Header-Only C++ Library for Graph Representation and Algorithms"
+    license = "MPL-2.0"
+    url = "https://github.com/conan-io/conan-center-index"
+    homepage = "https://github.com/ZigRazor/CXXGraph/"
+    topics = ("graph", "partitioning-algorithms", "dijkstra-algorithm", "graph-theory-algorithms", "header-only")
+    package_type = "header-library"
+    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",
+            "Visual Studio": "17",
+            "msvc": "193",
+        }
+
+    def configure(self):
+        if Version(self.version) < "4.0.0":
+            self.license = "AGPL-3.0-later"
+
+    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."
+            )
+
+        # TODO: remove this check once the bug is fixed
+        # https://github.com/ZigRazor/CXXGraph/pull/416
+        # https://github.com/ZigRazor/CXXGraph/pull/417
+        if is_msvc(self):
+            raise ConanInvalidConfiguration(f"{self.ref} doesn't support Visual Studio due to fold expression bug")
+
+    def source(self):
+        get(self, **self.conan_data["sources"][self.version], strip_root=True)
+
+    def package(self):
+        copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses"))
+        copy(
+            self,
+            "*.h",
+            os.path.join(self.source_folder, "include"),
+            os.path.join(self.package_folder, "include"),
+        )
+        copy(
+            self,
+            "*.hpp",
+            os.path.join(self.source_folder, "include"),
+            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.extend(["pthread"])
diff --git a/recipes/cxxgraph/all/test_package/CMakeLists.txt b/recipes/cxxgraph/all/test_package/CMakeLists.txt
new file mode 100644
index 0000000000000..833f2dae3436f
--- /dev/null
+++ b/recipes/cxxgraph/all/test_package/CMakeLists.txt
@@ -0,0 +1,8 @@
+cmake_minimum_required(VERSION 3.15)
+project(test_package LANGUAGES CXX)
+
+find_package(cxxgraph REQUIRED CONFIG)
+
+add_executable(${PROJECT_NAME} test_package.cpp)
+target_link_libraries(${PROJECT_NAME} PRIVATE cxxgraph::cxxgraph)
+target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)
diff --git a/recipes/cxxgraph/all/test_package/conanfile.py b/recipes/cxxgraph/all/test_package/conanfile.py
new file mode 100644
index 0000000000000..3a91c9439218e
--- /dev/null
+++ b/recipes/cxxgraph/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.bindir, "test_package")
+            self.run(bin_path, env="conanrun")
diff --git a/recipes/cxxgraph/all/test_package/test_package.cpp b/recipes/cxxgraph/all/test_package/test_package.cpp
new file mode 100644
index 0000000000000..f651fa10d2f1e
--- /dev/null
+++ b/recipes/cxxgraph/all/test_package/test_package.cpp
@@ -0,0 +1,34 @@
+#include 
+
+#include "CXXGraph/CXXGraph.hpp"
+
+int main() {
+  CXXGraph::Node node0("0", 0);
+  CXXGraph::Node node1("1", 1);
+  CXXGraph::Node node2("2", 2);
+  CXXGraph::Node node3("3", 3);
+
+  CXXGraph::UndirectedWeightedEdge edge1(1, node1, node2, 2.0);
+  CXXGraph::UndirectedWeightedEdge edge2(2, node2, node3, 2.0);
+  CXXGraph::UndirectedWeightedEdge edge3(3, node0, node1, 2.0);
+  CXXGraph::UndirectedWeightedEdge edge4(4, node0, node3, 1.0);
+
+  CXXGraph::T_EdgeSet edgeSet;
+  edgeSet.insert(std::make_shared>(edge1));
+  edgeSet.insert(std::make_shared>(edge2));
+  edgeSet.insert(std::make_shared>(edge3));
+  edgeSet.insert(std::make_shared>(edge4));
+
+  // Can print out the edges for debugging
+  std::cout << edge1 << "\n";
+  std::cout << edge2 << "\n";
+  std::cout << edge3 << "\n";
+  std::cout << edge4 << "\n";
+
+  CXXGraph::Graph graph(edgeSet);
+  auto res = graph.dijkstra(node0, node2);
+
+  std::cout << "Dijkstra Result: " << res.result << "\n";
+
+  return 0;
+}
diff --git a/recipes/cxxgraph/config.yml b/recipes/cxxgraph/config.yml
new file mode 100644
index 0000000000000..e92b5abf9b97b
--- /dev/null
+++ b/recipes/cxxgraph/config.yml
@@ -0,0 +1,5 @@
+versions:
+  "4.1.0":
+    folder: all
+  "3.1.0":
+    folder: all
diff --git a/recipes/cxxopts/all/conandata.yml b/recipes/cxxopts/all/conandata.yml
index 80d718f14d1a0..607b321614b3b 100644
--- a/recipes/cxxopts/all/conandata.yml
+++ b/recipes/cxxopts/all/conandata.yml
@@ -1,4 +1,10 @@
 sources:
+  "3.2.0":
+    url: "https://github.com/jarro2783/cxxopts/archive/refs/tags/v3.2.0.tar.gz"
+    sha256: "9f43fa972532e5df6c5fd5ad0f5bac606cdec541ccaf1732463d8070bbb7f03b"
+  "3.1.1":
+    url: "https://github.com/jarro2783/cxxopts/archive/refs/tags/v3.1.1.tar.gz"
+    sha256: "523175f792eb0ff04f9e653c90746c12655f10cb70f1d5e6d6d9491420298a08"
   "3.0.0":
     url: "https://github.com/jarro2783/cxxopts/archive/refs/tags/v3.0.0.tar.gz"
     sha256: "36f41fa2a46b3c1466613b63f3fa73dc24d912bc90d667147f1e43215a8c6d00"
@@ -8,6 +14,3 @@ sources:
   "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 c9aafdc057393..face2572c75dd 100644
--- a/recipes/cxxopts/all/conanfile.py
+++ b/recipes/cxxopts/all/conanfile.py
@@ -3,7 +3,6 @@
 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.51.1"
@@ -16,7 +15,7 @@ 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")
-
+    package_type = "header-library"
     settings = "os", "arch", "compiler", "build_type"
     options = {
         "unicode": [True, False],
@@ -34,7 +33,8 @@ def _min_cppstd(self):
     def _minimum_compilers_version(self):
         return {
             "Visual Studio": "14",
-            "gcc": "5",
+            "msvc": "190",
+            "gcc": "4.9",
             "clang": "3.9",
             "apple-clang": "8",
         }
@@ -44,7 +44,7 @@ def layout(self):
 
     def requirements(self):
         if self.options.unicode:
-            self.requires("icu/71.1")
+            self.requires("icu/74.1")
 
     def package_id(self):
         self.info.clear()
@@ -52,15 +52,21 @@ def package_id(self):
     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:
+
+        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 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],
-            destination=self.source_folder, strip_root=True)
+        get(self, **self.conan_data["sources"][self.version], strip_root=True)
 
     def build(self):
         pass
diff --git a/recipes/cxxopts/all/test_package/CMakeLists.txt b/recipes/cxxopts/all/test_package/CMakeLists.txt
index 6f5decb20d62e..00a1aead37e8f 100644
--- a/recipes/cxxopts/all/test_package/CMakeLists.txt
+++ b/recipes/cxxopts/all/test_package/CMakeLists.txt
@@ -1,8 +1,20 @@
 cmake_minimum_required(VERSION 3.8)
 project(test_package LANGUAGES CXX)
 
+enable_testing()
+
 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)
+
+if(cxxopts_VERSION VERSION_LESS "3.1.0")
+    target_compile_definitions(${PROJECT_NAME} PRIVATE CXXOPTS_OLD_EXCEPTIONS)
+endif()
+
+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 284c7dbfedbea..1e91d7e0cc26d 100644
--- a/recipes/cxxopts/all/test_package/conanfile.py
+++ b/recipes/cxxopts/all/test_package/conanfile.py
@@ -1,13 +1,12 @@
 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
+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 = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv"
+    generators = "CMakeDeps", "VirtualRunEnv"
     test_type = "explicit"
 
     def layout(self):
@@ -16,6 +15,11 @@ def 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)
         cmake.configure()
@@ -23,14 +27,5 @@ def build(self):
 
     def test(self):
         if can_run(self):
-            output = StringIO()
-            bin_path = os.path.join(self.cpp.build.bindirs[0], "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}", env="conanrun", 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))
+            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/test_package.cpp b/recipes/cxxopts/all/test_package/test_package.cpp
index b70cd83b77455..df1a81785c0ff 100644
--- a/recipes/cxxopts/all/test_package/test_package.cpp
+++ b/recipes/cxxopts/all/test_package/test_package.cpp
@@ -47,10 +47,18 @@ int main(int argc, char* argv[])
 			std::cout << "qux:" << result["qux"].as() << std::endl;
 		}
 	#endif
-	} catch (const cxxopts::OptionException& e) {
+	}
+	#ifdef CXXOPTS_OLD_EXCEPTIONS
+	catch (const cxxopts::OptionException& e) {
+		std::cout << "error parsing options: " << e.what() << std::endl;
+		return 1;
+	}
+	#else
+	catch (const cxxopts::exceptions::exception& e) {
 		std::cout << "error parsing options: " << e.what() << std::endl;
 		return 1;
 	}
+	#endif
 
 	return 0;
 }
diff --git a/recipes/cxxopts/config.yml b/recipes/cxxopts/config.yml
index 69689683a4346..eeafb07402ec8 100644
--- a/recipes/cxxopts/config.yml
+++ b/recipes/cxxopts/config.yml
@@ -1,9 +1,11 @@
 versions:
+  "3.2.0":
+    folder: all
+  "3.1.1":
+    folder: all
   "3.0.0":
     folder: all
   "2.2.1":
     folder: all
   "2.2.0":
     folder: all
-  "1.4.4":
-    folder: all
diff --git a/recipes/cyclonedds-cxx/all/cmake/Generate.cmake b/recipes/cyclonedds-cxx/all/cmake/Generate.cmake
new file mode 100644
index 0000000000000..a399ac1aa2efe
--- /dev/null
+++ b/recipes/cyclonedds-cxx/all/cmake/Generate.cmake
@@ -0,0 +1,64 @@
+#
+# Copyright(c) 2020 to 2022 ZettaScale Technology and others
+#
+# This program and the accompanying materials are made available under the
+# terms of the Eclipse Public License v. 2.0 which is available at
+# http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
+# v. 1.0 which is available at
+# http://www.eclipse.org/org/documents/edl-v10.php.
+#
+# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
+#
+
+# NOTE: This function was leveraged from the upstream cyclonedds-cxx project
+# and modified to find the direct path to the cycloneddsidlcxx library as
+# opposed to leveraging the native CycloneDDS-CXX::idlcxx cmake target.
+# Because Conan redeclares its own targets using INTERFACE libs, the upstream
+# version of this function was incompatible. If the upstream implementation of
+# this functionality changes, a modification to this file may be required.
+# See: https://github.com/eclipse-cyclonedds/cyclonedds-cxx/blob/master/src/idlcxx/Generate.cmake
+
+find_package(CycloneDDS REQUIRED)
+
+# find idlcxx shared library
+set(CMAKE_FIND_LIBRARY_SUFFIXES .dll ${CMAKE_FIND_LIBRARY_SUFFIXES})
+if(CMAKE_CROSSCOMPILING)
+  find_library(_idlcxx_shared_lib cycloneddsidlcxx NO_CMAKE_FIND_ROOT_PATH REQUIRED)
+else()
+  find_library(_idlcxx_shared_lib
+    NAMES cycloneddsidlcxx
+    PATHS ${CMAKE_CURRENT_LIST_DIR}/../../bin/
+          ${CMAKE_CURRENT_LIST_DIR}/../../lib/
+    NO_DEFAULT_PATH)
+endif()
+
+if(_idlcxx_shared_lib)
+  set(_idlcxx_depends "")
+else()
+  message(FATAL_ERROR "Cannot find idlcxx shared library")
+endif()
+
+function(IDLCXX_GENERATE)
+  set(one_value_keywords TARGET DEFAULT_EXTENSIBILITY BASE_DIR OUTPUT_DIR)
+  set(multi_value_keywords FILES FEATURES INCLUDES WARNINGS)
+  cmake_parse_arguments(
+    IDLCXX "" "${one_value_keywords}" "${multi_value_keywords}" "" ${ARGN})
+
+  idlc_generate_generic(TARGET ${IDLCXX_TARGET}
+    BACKEND ${_idlcxx_shared_lib}
+    BASE_DIR ${IDLCXX_BASE_DIR}
+    FILES ${IDLCXX_FILES}
+    FEATURES ${IDLCXX_FEATURES}
+    INCLUDES ${IDLCXX_INCLUDES}
+    WARNINGS ${IDLCXX_WARNINGS}
+    DEFAULT_EXTENSIBILITY ${IDLCXX_DEFAULT_EXTENSIBILITY}
+    SUFFIXES .hpp .cpp
+    OUTPUT_DIR ${IDLCXX_OUTPUT_DIR}
+    DEPENDS ${_idlcxx_depends}
+  )
+  if(CYCLONEDDS_CXX_ENABLE_LEGACY)
+      target_include_directories(${IDLCXX_TARGET}
+          INTERFACE ${Boost_INCLUDE_DIR}
+      )
+  endif()
+endfunction()
diff --git a/recipes/cyclonedds-cxx/all/conandata.yml b/recipes/cyclonedds-cxx/all/conandata.yml
new file mode 100644
index 0000000000000..46c0203bb55c2
--- /dev/null
+++ b/recipes/cyclonedds-cxx/all/conandata.yml
@@ -0,0 +1,4 @@
+sources:
+  "0.10.4":
+    url: "https://github.com/eclipse-cyclonedds/cyclonedds-cxx/archive/refs/tags/0.10.4.tar.gz"
+    sha256: "ca09d738b150a7dc1fa63dcb5ad211a4ba516c92710ebff7b9fe817c7c5a257e"
diff --git a/recipes/cyclonedds-cxx/all/conanfile.py b/recipes/cyclonedds-cxx/all/conanfile.py
new file mode 100644
index 0000000000000..f2c688b39a594
--- /dev/null
+++ b/recipes/cyclonedds-cxx/all/conanfile.py
@@ -0,0 +1,164 @@
+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 copy, get, rm, rmdir, replace_in_file
+from conan.tools.scm import Version
+import os
+
+required_conan_version = ">=1.61.0"
+
+class CycloneDDSCXXConan(ConanFile):
+    name = "cyclonedds-cxx"
+    license = "EPL-2.0"
+    homepage = "https://cyclonedds.io/"
+    url = "https://github.com/conan-io/conan-center-index"
+    description = "Eclipse Cyclone DDS C++ Binding- 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],
+    }
+    default_options = {
+        "shared": False,
+        "fPIC": True,
+    }
+
+    @property
+    def _min_cppstd(self):
+        return "17"
+
+    @property
+    def _compilers_minimum_version(self):
+        return {
+            "gcc": "7",
+            "Visual Studio": "16",
+            "msvc": "192",
+            "clang": "7",
+            "apple-clang": "10",
+        }
+
+    def _has_idlc(self, info=False):
+        # don't build idllib when it makes little sense or not supported
+        host_os = self.info.settings.os if info else self.settings.os
+        return host_os not in ["Android", "iOS", "watchOS", "tvOS", "Neutrino"]
+
+    def export_sources(self):
+        copy(self, os.path.join("cmake", "Generate.cmake"), 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:
+            self.options.rm_safe("fPIC")
+
+    def layout(self):
+        cmake_layout(self, src_folder="src")
+
+    def requirements(self):
+        # Use the corresponding version of cyclonedds with transitive headers
+        #INFO:  is used in several public headers including:
+        #      :29
+        #      :31
+        #      :26
+        #      :34
+        self.requires("cyclonedds/{}".format(self.version), transitive_headers=True)
+
+    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 build_requirements(self):
+        self.tool_requires("cmake/[>=3.16 <4]")
+
+    def source(self):
+        get(self, **self.conan_data["sources"][self.version], strip_root=True)
+
+    def generate(self):
+        tc = CMakeToolchain(self)
+        tc.variables["BUILD_DDSLIB"] = True
+        tc.variables["BUILD_IDLLIB"] = self._has_idlc()
+        tc.variables["BUILD_DOCS"] = False
+        tc.variables["BUILD_TESTING"] = False
+        tc.variables["BUILD_EXAMPLES"] = False
+        # variables which effects build
+        tc.variables["ENABLE_LEGACY"] = False
+        tc.variables["ENABLE_SHM"] = self.dependencies["cyclonedds"].options.with_shm
+        tc.variables["ENABLE_TYPE_DISCOVERY"] = self.dependencies["cyclonedds"].options.enable_discovery
+        tc.variables["ENABLE_TOPIC_DISCOVERY"] = self.dependencies["cyclonedds"].options.enable_discovery
+        tc.variables["ENABLE_COVERAGE"] = False
+        tc.generate()
+        cd = CMakeDeps(self)
+        cd.generate()
+
+    def _patch_sources(self):
+        cmakelists = os.path.join(self.source_folder, "CMakeLists.txt")
+        replace_in_file(self, cmakelists,
+                        "get_target_property(cyclonedds_has_shm CycloneDDS::ddsc SHM_SUPPORT_IS_AVAILABLE)",
+                        "set(cyclonedds_has_shm {})".format(self.dependencies["cyclonedds"].options.with_shm))
+        replace_in_file(self, cmakelists,
+                        "get_target_property(cyclonedds_has_type_discovery CycloneDDS::ddsc TYPE_DISCOVERY_IS_AVAILABLE)",
+                        "set(cyclonedds_has_type_discovery {})".format(self.dependencies["cyclonedds"].options.enable_discovery))
+        replace_in_file(self, cmakelists,
+                        "get_target_property(cyclonedds_has_topic_discovery CycloneDDS::ddsc TOPIC_DISCOVERY_IS_AVAILABLE)",
+                        "set(cyclonedds_has_topic_discovery {})".format(self.dependencies["cyclonedds"].options.enable_discovery))
+
+    def build(self):
+        self._patch_sources()
+        cmake = CMake(self)
+        cmake.configure()
+        cmake.build()
+
+    def package(self):
+        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", "CycloneDDS-CXX"))
+        copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses"))
+        copy(self, "Generate.cmake",
+                   src=os.path.join(self.source_folder, os.pardir, "cmake"),
+                   dst=os.path.join(self.package_folder, self._module_path))
+        if self.settings.os == "Windows":
+            for p in ("*.pdb", "concrt*.dll", "msvcp*.dll", "vcruntime*.dll"):
+                rm(self, p, os.path.join(self.package_folder, "bin"))
+
+    @property
+    def _module_path(self):
+        return os.path.join("lib", "cmake")
+
+    def package_info(self):
+        self.cpp_info.set_property("cmake_find_mode", "both")
+        self.cpp_info.set_property("cmake_module_file_name", "CycloneDDS-CXX")
+        self.cpp_info.set_property("cmake_file_name", "CycloneDDS-CXX")
+        self.cpp_info.set_property("cmake_target_name", "CycloneDDS-CXX::CycloneDDS-CXX")
+        self.cpp_info.set_property("pkg_config_name", "CycloneDDS-CXX")
+        build_modules = [
+            os.path.join(self._module_path, "Generate.cmake"),
+        ]
+        self.cpp_info.set_property("cmake_build_modules", build_modules)
+        self.cpp_info.includedirs = ["include/ddscxx"]
+        self.cpp_info.builddirs = [self._module_path]
+        self.cpp_info.components["ddscxx"].libs = ["ddscxx"]
+        self.cpp_info.components["ddscxx"].includedirs = [os.path.join("include", "ddscxx")]
+        self.cpp_info.components["ddscxx"].set_property("cmake_target_name", "CycloneDDS-CXX::ddscxx")
+        self.cpp_info.components["ddscxx"].set_property("pkg_config_name", "CycloneDDS-CXX")
+        self.cpp_info.components["ddscxx"].requires = ["cyclonedds::CycloneDDS"]
+        if self.settings.os in ["Linux", "FreeBSD"]:
+            self.cpp_info.components["ddscxx"].system_libs = ["m"]
+        self.cpp_info.components["idlcxx"].libs = ["cycloneddsidlcxx"]
+        self.cpp_info.components["idlcxx"].set_property("cmake_target_name", "CycloneDDS-CXX::idlcxx")
+        self.cpp_info.components["idlcxx"].requires = ["cyclonedds::idl"]
+        self.env_info.PATH.append(os.path.join(self.package_folder, "bin"))
+        self.buildenv_info.append_path("PATH", os.path.join(self.package_folder, "bin"))
+        self.runenv_info.append_path("PATH", os.path.join(self.package_folder, "bin"))
diff --git a/recipes/cyclonedds-cxx/all/test_package/CMakeLists.txt b/recipes/cyclonedds-cxx/all/test_package/CMakeLists.txt
new file mode 100644
index 0000000000000..f43c4dca3ca61
--- /dev/null
+++ b/recipes/cyclonedds-cxx/all/test_package/CMakeLists.txt
@@ -0,0 +1,15 @@
+cmake_minimum_required(VERSION 3.8)
+project(test_package CXX)
+set(CMAKE_CXX_STANDARD 17)
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+set(CMAKE_CXX_EXTENSIONS OFF)
+find_package(CycloneDDS-CXX REQUIRED)
+
+add_executable(test_package test_package.cpp)
+target_link_libraries(test_package PRIVATE CycloneDDS-CXX::ddscxx)
+
+if(NOT CMAKE_CROSSCOMPILING)
+  IDLCXX_GENERATE(TARGET MessageLib FILES Message.idl)
+  add_executable(test_message test_message.cpp)
+  target_link_libraries(test_message PRIVATE MessageLib CycloneDDS-CXX::ddscxx)
+endif()
diff --git a/recipes/cyclonedds-cxx/all/test_package/Message.idl b/recipes/cyclonedds-cxx/all/test_package/Message.idl
new file mode 100644
index 0000000000000..46b201f63a878
--- /dev/null
+++ b/recipes/cyclonedds-cxx/all/test_package/Message.idl
@@ -0,0 +1,6 @@
+module conan {
+  struct Message {
+    sequence payload;
+  };
+  #pragma keylist Message
+};
diff --git a/recipes/cyclonedds-cxx/all/test_package/conanfile.py b/recipes/cyclonedds-cxx/all/test_package/conanfile.py
new file mode 100644
index 0000000000000..50b7ececfcd17
--- /dev/null
+++ b/recipes/cyclonedds-cxx/all/test_package/conanfile.py
@@ -0,0 +1,27 @@
+import os
+from conan import ConanFile
+from conan.tools.cmake import CMake, cmake_layout
+from conan.tools.build import can_run
+
+class CycloneDDSCXXTestConan(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")
+            bin_path = os.path.join(self.cpp.build.bindirs[0], "test_message")
+            self.run(bin_path, env="conanrun")
diff --git a/recipes/cyclonedds-cxx/all/test_package/test_message.cpp b/recipes/cyclonedds-cxx/all/test_package/test_message.cpp
new file mode 100644
index 0000000000000..2bc38e32ae1ab
--- /dev/null
+++ b/recipes/cyclonedds-cxx/all/test_package/test_message.cpp
@@ -0,0 +1,12 @@
+#include 
+#include "dds/dds.hpp"
+#include "Message.hpp"
+
+int main() {
+  dds::domain::DomainParticipant domain_(0);
+
+  conan::Message message;
+  std::vector payload;
+  message.payload(std::move(payload));
+  return 0;
+}
diff --git a/recipes/cyclonedds-cxx/all/test_package/test_package.cpp b/recipes/cyclonedds-cxx/all/test_package/test_package.cpp
new file mode 100644
index 0000000000000..b4cf37cb3f9e2
--- /dev/null
+++ b/recipes/cyclonedds-cxx/all/test_package/test_package.cpp
@@ -0,0 +1,11 @@
+#include 
+#include "dds/dds.hpp"
+
+int main() {
+
+  dds::domain::DomainParticipant participant(0);
+  dds::topic::PublicationBuiltinTopicData topic;
+  dds::sub::Subscriber subscriber(participant);
+
+  return 0;
+}
diff --git a/recipes/cyclonedds-cxx/config.yml b/recipes/cyclonedds-cxx/config.yml
new file mode 100644
index 0000000000000..87e6038632c05
--- /dev/null
+++ b/recipes/cyclonedds-cxx/config.yml
@@ -0,0 +1,3 @@
+versions:
+  "0.10.4":
+    folder: all
diff --git a/recipes/cyclonedds/all/cmake/CycloneDDS_idlc.cmake b/recipes/cyclonedds/all/cmake/CycloneDDS_idlc.cmake
new file mode 100644
index 0000000000000..19242c4dfa87c
--- /dev/null
+++ b/recipes/cyclonedds/all/cmake/CycloneDDS_idlc.cmake
@@ -0,0 +1,21 @@
+if(NOT TARGET CycloneDDS::idlc)
+    if(CMAKE_CROSSCOMPILING)
+        find_program(_idlc_executable
+            NAMES idlc
+            PATHS ENV PATH
+            NO_DEFAULT_PATH
+        )
+    else()
+        find_program(_idlc_executable
+            NAMES idlc
+            PATHS "${CMAKE_CURRENT_LIST_DIR}/../../../bin/"
+            NO_DEFAULT_PATH
+        )
+    endif()
+
+    if(_idlc_executable)
+        get_filename_component(_idlc_executable "${_idlc_executable}" ABSOLUTE)
+        add_executable(CycloneDDS::idlc IMPORTED)
+        set_property(TARGET CycloneDDS::idlc PROPERTY IMPORTED_LOCATION ${_idlc_executable})
+    endif()
+endif()
diff --git a/recipes/cyclonedds/all/conandata.yml b/recipes/cyclonedds/all/conandata.yml
index 3842a2285af2b..8d9fa515082f8 100644
--- a/recipes/cyclonedds/all/conandata.yml
+++ b/recipes/cyclonedds/all/conandata.yml
@@ -1,8 +1,22 @@
 sources:
+  "0.10.4":
+    url: "https://github.com/eclipse-cyclonedds/cyclonedds/archive/0.10.4.tar.gz"
+    sha256: "fe7bb5a4348e31656a935f72dec909a7d2b0fcf10840614fb552f08eb2da8484"
+  "0.10.3":
+    url: "https://github.com/eclipse-cyclonedds/cyclonedds/archive/refs/tags/0.10.3.tar.gz"
+    sha256: "bc79696209febfe66d97e7af6b11e92f9db663caf608a922b6c201b1d6a5eb62"
   "0.10.2":
     url: "https://github.com/eclipse-cyclonedds/cyclonedds/archive/refs/tags/0.10.2.tar.gz"
-    sha256: "BC84E137E0C8A055B8CD97FBEAFEC94E36DE1B0C2E88800896A82384FD867AE5"
+    sha256: "bc84e137e0c8a055b8cd97fbeafec94e36de1b0c2e88800896a82384fd867ae5"
 patches:
+  "0.10.4":
+    - patch_file: "patches/0.10.2-0001-fix-find-iceoryx.patch"
+      patch_description: "Fix cmake find for iceoryx package"
+      patch_type: "conan"
+  "0.10.3":
+    - patch_file: "patches/0.10.2-0001-fix-find-iceoryx.patch"
+      patch_description: "Fix cmake find for iceoryx package"
+      patch_type: "conan"
   "0.10.2":
     - patch_file: "patches/0.10.2-0001-fix-find-iceoryx.patch"
       patch_description: "Fix cmake find for iceoryx package"
diff --git a/recipes/cyclonedds/all/conanfile.py b/recipes/cyclonedds/all/conanfile.py
index 039c8d5f7e45d..18f0542a85ec8 100644
--- a/recipes/cyclonedds/all/conanfile.py
+++ b/recipes/cyclonedds/all/conanfile.py
@@ -1,11 +1,13 @@
-import os
 from conan import ConanFile
 from conan.errors import ConanInvalidConfiguration
-from conan.tools import files, build, scm
-from conan.tools.microsoft import is_msvc
+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"
 
-required_conan_version = ">=1.51.3"
 
 class CycloneDDSConan(ConanFile):
     name = "cyclonedds"
@@ -16,48 +18,49 @@ class CycloneDDSConan(ConanFile):
                   " 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]
+        "enable_security" : [True, False],
+        "enable_discovery" : [True, False],
     }
     default_options = {
         "shared": False,
         "fPIC": True,
         "with_ssl": False,
         "with_shm": False,
-        "enable_security": False
+        "enable_security": False,
+        "enable_discovery": True,
     }
 
     short_paths = True
 
     @property
-    def _bin_package_folder(self):
-        return os.path.join(self.package_folder,"bin")
-
-    @property
-    def _tmp_folder(self):
-        return os.path.join(self.package_folder,"tmp")        
-
-    @property
-    def _license_folder(self):
-        return os.path.join(self.package_folder,"licenses")
+    def _min_cppstd(self):
+        return "14"
 
     @property
     def _compilers_minimum_version(self):
         return {
             "gcc": "7",
-            "Visual Studio": "16.0",
+            "Visual Studio": "16",
+            "msvc": "192",
             "clang": "7",
             "apple-clang": "10",
         }
 
+    def _has_idlc(self, info=False):
+        # don't build idlc when it makes little sense or not supported
+        host_os = self.info.settings.os if info else self.settings.os
+        return host_os not in ["Android", "iOS", "watchOS", "tvOS", "Neutrino"]
+
     def export_sources(self):
-        for patch in self.conan_data.get("patches", {}).get(self.version, []):
-            files.copy(self,patch["patch_file"],self.recipe_folder, self.export_sources_folder)
+        copy(self, os.path.join("cmake", "CycloneDDS_idlc.cmake"), self.recipe_folder, self.export_sources_folder)
+        export_conandata_patches(self)
 
     def config_options(self):
         if self.settings.os == "Windows":
@@ -65,68 +68,58 @@ def config_options(self):
 
     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
+            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.0")
+            self.requires("iceoryx/2.0.5")
         if self.options.with_ssl:
-            self.requires("openssl/1.1.1q")
-
-    def build_requirements(self):
-        self.tool_requires("cmake/3.21.7")
+            self.requires("openssl/[>=1.1 <4]")
 
     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.info.settings.compiler.cppstd:
-            build.check_min_cppstd(self, 14)
-        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} is just tested with minimal version "\
-                f"{minimum_version} of compiler {self.info.settings.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(
+                f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support."
+            )
 
-    def source(self):
-        files.get(self,**self.conan_data["sources"][self.version], strip_root=True,
-                 destination=self.source_folder)
+    def build_requirements(self):
+        self.tool_requires("cmake/[>=3.16 <4]")
 
-    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)
         # 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
+        tc.variables["BUILD_IDLC"] = self._has_idlc()
+        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.variables["ENABLE_SSL"] = self.options.with_ssl
+        tc.variables["ENABLE_SHM"] = self.options.with_shm
+        tc.variables["ENABLE_SECURITY"] = self.options.enable_security
+        tc.variables["ENABLE_TYPE_DISCOVERY"] = self.options.enable_discovery
+        tc.variables["ENABLE_TOPIC_DISCOVERY"] = self.options.enable_discovery
         tc.generate()
 
         cd = CMakeDeps(self)
         cd.generate()
 
     def build(self):
-        files.apply_conandata_patches(self)
+        apply_conandata_patches(self)
         cmake = CMake(self)
         cmake.configure()
         cmake.build()
@@ -134,34 +127,23 @@ def build(self):
     def package(self):
         cmake = CMake(self)
         cmake.install()
-        files.copy(self, "LICENSE", self.source_folder, self._license_folder)
-        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"))
-        
-        # cyclonedds copies multiple windows dlls to bin folder
-        # these must be removed and just keep ddsc.dll  
+        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"))
+        rm(self, "*.cmake", os.path.join(self.package_folder, "lib", "cmake", "CycloneDDS"))
+        copy(self, "CycloneDDS_idlc.cmake",
+                   src=os.path.join(self.source_folder, os.pardir, "cmake"),
+                   dst=os.path.join(self.package_folder, "lib", "cmake", "CycloneDDS"))
         if self.settings.os == "Windows":
-            if self.options.shared:
-                files.mkdir(self, self._tmp_folder)
-                files.copy(self, "ddsc.dll", self._bin_package_folder, self._tmp_folder)
-            files.rmdir(self, self._bin_package_folder)
-            if self.options.shared:
-                files.mkdir(self,self._bin_package_folder)
-                files.copy(self,"ddsc.dll",self._tmp_folder,self._bin_package_folder)
-                files.rmdir(self, self._tmp_folder)
+            for p in ("*.pdb", "concrt*.dll", "msvcp*.dll", "vcruntime*.dll"):
+                rm(self, p, os.path.join(self.package_folder, "bin"))
 
     def package_info(self):
-        self.cpp_info.set_property("cmake_file_name", "cyclonedds")
-        self.cpp_info.filenames["cmake_find_package"] = "cyclonedds"
-        self.cpp_info.filenames["cmake_find_package_multi"] = "cyclonedds"
-        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.set_property("cmake_file_name", "CycloneDDS")
+        self.cpp_info.set_property("cmake_target_name", "CycloneDDS::CycloneDDS")
+        self.cpp_info.set_property("pkg_config_name", "CycloneDDS")
+        # TODO: back to global scope in conan v2
         self.cpp_info.components["CycloneDDS"].libs = ["ddsc"]
-        self.cpp_info.components["CycloneDDS"].set_property("cmake_target_name",
-                    "CycloneDDS::ddsc")
         requires = []
         if self.options.with_shm:
             requires.append("iceoryx::iceoryx_binding_c")
@@ -169,11 +151,40 @@ def package_info(self):
             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 = ["pthread"]
+            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"
+                "ws2_32",
+                "dbghelp",
+                "bcrypt",
+                "iphlpapi"
             ]
+
+        build_modules = [
+            os.path.join("lib", "cmake", "CycloneDDS", "CycloneDDS_idlc.cmake"),
+            os.path.join("lib", "cmake", "CycloneDDS", "idlc", "Generate.cmake"),
+        ]
+        self.cpp_info.set_property("cmake_build_modules", build_modules)
+        build_dirs = [
+            os.path.join(self.package_folder, "lib", "cmake", "CycloneDDS"),
+            os.path.join(self.package_folder, "lib", "cmake", "CycloneDDS", "idlc"),
+        ]
+        self.cpp_info.builddirs = build_dirs
+
+        # 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")
+        if self._has_idlc():
+            self.env_info.PATH.append(os.path.join(self.package_folder, "bin"))
+            self.buildenv_info.append_path("PATH", os.path.join(self.package_folder, "bin"))
+            self.runenv_info.append_path("PATH", os.path.join(self.package_folder, "bin"))
+            self.cpp_info.components["idl"].libs = ["cycloneddsidl"]
+            self.cpp_info.components["idl"].names["cmake_find_package"] = "idl"
+            self.cpp_info.components["idl"].names["cmake_find_package_multi"] = "idl"
+            self.cpp_info.components["idl"].set_property("cmake_target_name", "CycloneDDS::idl")
+            self.cpp_info.components["idl"].build_modules["cmake_find_package"] = build_modules
+            self.cpp_info.components["idl"].build_modules["cmake_find_package_multi"] = build_modules
diff --git a/recipes/cyclonedds/all/test_package/CMakeLists.txt b/recipes/cyclonedds/all/test_package/CMakeLists.txt
index 9653148f924fa..c780bdda5e0ab 100644
--- a/recipes/cyclonedds/all/test_package/CMakeLists.txt
+++ b/recipes/cyclonedds/all/test_package/CMakeLists.txt
@@ -1,8 +1,14 @@
 cmake_minimum_required(VERSION 3.8)
-project(test_package CXX)
+project(test_package C CXX)
 
-find_package(cyclonedds REQUIRED CONFIG)
+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)
+
+if(NOT CMAKE_CROSSCOMPILING)
+  IDLC_GENERATE(TARGET test_message FILES test_message.idl)
+  add_executable(test_idl test_idl.c)
+  target_link_libraries(test_idl PRIVATE test_message CycloneDDS::ddsc CycloneDDS::idl)
+endif()
diff --git a/recipes/cyclonedds/all/test_package/conanfile.py b/recipes/cyclonedds/all/test_package/conanfile.py
index 422a7d5c03da2..913d902444f12 100644
--- a/recipes/cyclonedds/all/test_package/conanfile.py
+++ b/recipes/cyclonedds/all/test_package/conanfile.py
@@ -23,3 +23,5 @@ 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")
+            bin_path = os.path.join(self.cpp.build.bindirs[0], "test_idl")
+            self.run(bin_path, env="conanrun")
diff --git a/recipes/cyclonedds/all/test_package/test_idl.c b/recipes/cyclonedds/all/test_package/test_idl.c
new file mode 100644
index 0000000000000..74667e344bd06
--- /dev/null
+++ b/recipes/cyclonedds/all/test_package/test_idl.c
@@ -0,0 +1,20 @@
+#include 
+#include "dds/dds.h"
+#include "test_message.h"
+#include "idl/string.h"
+
+int main() {
+  dds_entity_t participant;
+  participant = dds_create_participant (DDS_DOMAIN_DEFAULT, NULL, NULL);
+  if (participant < 0)
+    DDS_FATAL("dds_create_participant: %s\n", dds_strretcode(-participant));
+
+  conan_test_message msg;
+  msg.payload._length = 0;
+  unsigned int val = idl_isalnum('1');
+
+  if(!val)
+    return EXIT_FAILURE;
+
+  return EXIT_SUCCESS;
+}
diff --git a/recipes/cyclonedds/all/test_package/test_message.idl b/recipes/cyclonedds/all/test_package/test_message.idl
new file mode 100644
index 0000000000000..9aceea2e838b4
--- /dev/null
+++ b/recipes/cyclonedds/all/test_package/test_message.idl
@@ -0,0 +1,6 @@
+module conan {
+  @final
+  struct test_message {
+    sequence payload;
+  };
+};
diff --git a/recipes/cyclonedds/all/test_v1_package/CMakeLists.txt b/recipes/cyclonedds/all/test_v1_package/CMakeLists.txt
index aa258f41398f0..0d20897301b68 100644
--- a/recipes/cyclonedds/all/test_v1_package/CMakeLists.txt
+++ b/recipes/cyclonedds/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(cyclonedds CONFIG REQUIRED)
-
-add_executable(${PROJECT_NAME} ../test_package/test_package.cpp)
-target_link_libraries(${PROJECT_NAME} PRIVATE CycloneDDS::ddsc)
-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/cyclonedds/all/test_v1_package/conanfile.py b/recipes/cyclonedds/all/test_v1_package/conanfile.py
index f7bf754d5a675..1a9e66f7126fc 100644
--- a/recipes/cyclonedds/all/test_v1_package/conanfile.py
+++ b/recipes/cyclonedds/all/test_v1_package/conanfile.py
@@ -2,7 +2,7 @@
 from conans import ConanFile, CMake
 from conan.tools import build
 
-class CycloneDDSTestConan(ConanFile):
+class TestPackageConan(ConanFile):
     settings = "os", "compiler", "build_type", "arch"
     generators = ["cmake", "cmake_find_package_multi"]
 
diff --git a/recipes/cyclonedds/config.yml b/recipes/cyclonedds/config.yml
index 6c8041d964ef5..b770b06071265 100644
--- a/recipes/cyclonedds/config.yml
+++ b/recipes/cyclonedds/config.yml
@@ -1,3 +1,7 @@
 versions:
+  "0.10.4":
+    folder: all
+  "0.10.3":
+    folder: all
   "0.10.2":
     folder: all
diff --git a/recipes/cyrus-sasl/all/conandata.yml b/recipes/cyrus-sasl/all/conandata.yml
index 0fe894820dcdf..d24e3377974b4 100644
--- a/recipes/cyrus-sasl/all/conandata.yml
+++ b/recipes/cyrus-sasl/all/conandata.yml
@@ -1,4 +1,7 @@
 sources:
+  "2.1.28":
+    url: "https://github.com/cyrusimap/cyrus-sasl/releases/download/cyrus-sasl-2.1.28/cyrus-sasl-2.1.28.tar.gz"
+    sha256: "7ccfc6abd01ed67c1a0924b353e526f1b766b21f42d4562ee635a8ebfc5bb38c"
   "2.1.27":
     url: "https://github.com/cyrusimap/cyrus-sasl/releases/download/cyrus-sasl-2.1.27/cyrus-sasl-2.1.27.tar.gz"
     sha256: "26866b1549b00ffd020f188a43c258017fa1c382b3ddadd8201536f72efb05d5"
diff --git a/recipes/cyrus-sasl/all/conanfile.py b/recipes/cyrus-sasl/all/conanfile.py
index 03e66247f9633..78ec1f2f5f46a 100644
--- a/recipes/cyrus-sasl/all/conanfile.py
+++ b/recipes/cyrus-sasl/all/conanfile.py
@@ -1,14 +1,15 @@
 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, rm, rmdir
+from conan.tools.files import copy, get, rm, rmdir, replace_in_file
 from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain
 from conan.tools.layout import basic_layout
-from conan.tools.microsoft import unix_path
+from conan.tools.microsoft import unix_path, is_msvc, MSBuildDeps, MSBuildToolchain, MSBuild
 import os
 
-required_conan_version = ">=1.53.0"
+required_conan_version = ">=1.54.0"
 
 
 class CyrusSaslConan(ConanFile):
@@ -23,6 +24,7 @@ class CyrusSaslConan(ConanFile):
     )
     topics = ("sasl", "authentication", "authorization")
 
+    package_type = "library"
     settings = "os", "arch", "compiler", "build_type"
     options = {
         "shared": [True, False],
@@ -39,6 +41,7 @@ class CyrusSaslConan(ConanFile):
         "with_postgresql": [True, False],
         "with_mysql": [True, False],
         "with_sqlite3": [True, False],
+        "with_saslauthd": [True, False],
     }
     default_options = {
         "shared": False,
@@ -55,6 +58,7 @@ class CyrusSaslConan(ConanFile):
         "with_postgresql": False,
         "with_mysql": False,
         "with_sqlite3": False,
+        "with_saslauthd": True,
     }
 
     @property
@@ -64,6 +68,16 @@ def _settings_build(self):
     def config_options(self):
         if self.settings.os == "Windows":
             del self.options.fPIC
+            # saslauthd doesn't compile on Windows
+            # https://www.cyrusimap.org/sasl/sasl/windows.html#install-windows
+            del self.options.with_saslauthd
+        if is_msvc(self):
+            # always required
+            del self.options.with_openssl
+            # not used
+            del self.options.with_postgresql
+            del self.options.with_mysql
+            del self.options.with_sqlite3
 
     def configure(self):
         if self.options.shared:
@@ -75,39 +89,36 @@ def layout(self):
         basic_layout(self, src_folder="src")
 
     def requirements(self):
-        if self.options.with_openssl:
-            self.requires("openssl/1.1.1s")
-        if self.options.with_postgresql:
-            self.requires("libpq/14.5")
-        if self.options.with_mysql:
-            self.requires("libmysqlclient/8.0.30")
-        if self.options.with_sqlite3:
-            self.requires("sqlite3/3.39.4")
+        if is_msvc(self) or self.options.with_openssl:
+            self.requires("openssl/[>=1.1 <4]")
+        if self.options.get_safe("with_postgresql"):
+            self.requires("libpq/15.4")
+        if self.options.get_safe("with_mysql"):
+            self.requires("libmysqlclient/8.1.0")
+        if self.options.get_safe("with_sqlite3"):
+            self.requires("sqlite3/3.44.2")
 
     def validate(self):
-        if self.info.settings.os == "Windows":
-            raise ConanInvalidConfiguration(
-                "Cyrus SASL package is not compatible with Windows yet."
-            )
+        if is_msvc(self) and not self.options.shared:
+            raise ConanInvalidConfiguration("Static library output is not supported when building with MSVC")
         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.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")
+        if not is_msvc(self):
+            self.tool_requires("gnu-config/cci.20210814")
 
     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):
+    def _generate_autotools(self):
         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"
@@ -131,6 +142,7 @@ def generate(self):
             "--with-mysql={}".format(rootpath_no(self.options.with_mysql, "libmysqlclient")),
             "--without-sqlite",
             "--with-sqlite3={}".format(rootpath_no(self.options.with_sqlite3, "sqlite3")),
+            "--with-saslauthd={}".format(yes_no(self.options.with_saslauthd)),
         ])
         if self.options.with_gssapi:
             tc.configure_args.append("--with-gss_impl=mit")
@@ -138,42 +150,109 @@ def generate(self):
 
         deps = AutotoolsDeps(self)
         deps.generate()
-        if not cross_building(self):
-            env = VirtualRunEnv(self)
-            env.generate(scope="build")
 
-    def _patch_sources(self):
+    def _patch_sources_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, "config"))
-        # relocatable executable & shared libs on macOS
-        replace_in_file(self, os.path.join(self.source_folder, "configure"), "-install_name \\$rpath/", "-install_name @rpath/")
+                     src=os.path.dirname(gnu_config),
+                     dst=os.path.join(self.source_folder, "config"))
 
-    def build(self):
-        self._patch_sources()
+    def _build_autotools(self):
+        self._patch_sources_autotools()
         autotools = Autotools(self)
         autotools.configure()
         autotools.make()
 
+    @property
+    def _msbuild_configuration(self):
+        return "Debug" if self.settings.build_type == "Debug" else "Release"
+
+    def _generate_msvc(self):
+        tc = MSBuildToolchain(self)
+        tc.configuration = self._msbuild_configuration
+        # disable OpenSSL 3 warnings, which get raised as errors
+        tc.cxxflags.append("/wo4996")
+        tc.generate()
+
+        deps = MSBuildDeps(self)
+        deps.configuration = self._msbuild_configuration
+        deps.generate()
+
+    def _patch_sources_msvc(self):
+        # TODO: to remove once https://github.com/conan-io/conan/pull/12817 available in conan client
+        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 self.source_path.joinpath("win32").glob("*.vcxproj"):
+            replace_in_file(self, vcxproj_file,
+                            "v140",
+                            f"{platform_toolset}")
+            replace_in_file(self, vcxproj_file, "8.1", "")
+            if props_path:
+                replace_in_file(self, vcxproj_file,
+                                '',
+                                f'{import_conan_generators}')
+        replace_in_file(self, os.path.join(self.source_folder, "win32", "openssl.props"),
+                        "libeay32.lib;", "")
+        # https://github.com/cyrusimap/cyrus-sasl/issues/730
+        copy(self, "md5global.h",
+             src=os.path.join(self.source_folder, "win32", "include"),
+             dst=os.path.join(self.source_folder, "include"))
+
+    def _build_msvc(self):
+        self._patch_sources_msvc()
+        msbuild = MSBuild(self)
+        msbuild.build_type = self._msbuild_configuration
+        msbuild.build(sln=os.path.join(self.source_folder, "win32", "cyrus-sasl-common.sln"))
+        msbuild.build(sln=os.path.join(self.source_folder, "win32", "cyrus-sasl-core.sln"))
+        # TODO: add sasldb support
+        # msbuild.build(sln=os.path.join(self.source_folder, "win32", "cyrus-sasl-sasldb.sln"))
+        if self.options.with_gssapi:
+            msbuild.build(sln=os.path.join(self.source_folder, "win32", "cyrus-sasl-gssapiv2.sln"))
+
+    def generate(self):
+        if is_msvc(self):
+            self._generate_msvc()
+        else:
+            self._generate_autotools()
+
+    def build(self):
+        if is_msvc(self):
+            self._build_msvc()
+        else:
+            self._build_autotools()
+
     def package(self):
         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 is_msvc(self):
+            copy(self, "*/sasl2.lib", os.path.join(self.source_folder, "win32"), os.path.join(self.package_folder, "lib"), keep_path=False)
+            copy(self, "*/sasl2.dll", os.path.join(self.source_folder, "win32"), os.path.join(self.package_folder, "bin"), keep_path=False)
+            copy(self, "*.h", os.path.join(self.source_folder, "include"), os.path.join(self.package_folder, "include", "sasl"))
+        else:
+            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"), recursive=True)
+        fix_apple_shared_install_name(self)
 
     def package_info(self):
         self.cpp_info.set_property("pkg_config_name", "libsasl2")
         self.cpp_info.libs = ["sasl2"]
 
+        if self.settings.os in ["Linux", "FreeBSD"]:
+            self.cpp_info.system_libs = ["resolv"]
+            if self.options.with_saslauthd:
+                self.cpp_info.system_libs.append("crypt")
+        elif is_msvc(self):
+            self.cpp_info.system_libs = ["ws2_32"]
+
         # TODO: to remove in conan v2
-        bindir = os.path.join(self.package_folder, "bin")
-        self.output.info(f"Appending PATH environment variable: {bindir}")
-        self.env_info.PATH.append(bindir)
+        self.env_info.PATH.append(os.path.join(self.package_folder, "bin"))
diff --git a/recipes/cyrus-sasl/config.yml b/recipes/cyrus-sasl/config.yml
index d7a18807b4494..85cdd658d0407 100644
--- a/recipes/cyrus-sasl/config.yml
+++ b/recipes/cyrus-sasl/config.yml
@@ -1,3 +1,5 @@
 versions:
+  "2.1.28":
+    folder: "all"
   "2.1.27":
     folder: "all"
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..7b0ce0b66f5a1 100644
--- a/recipes/czmq/all/conanfile.py
+++ b/recipes/czmq/all/conanfile.py
@@ -1,125 +1,144 @@
-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")
+    package_type = "library"
     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")
+        self.requires("zeromq/4.3.5", transitive_headers=True)
+        if self.options.get_safe("with_libmicrohttpd"):
+            self.requires("libmicrohttpd/0.9.75")
+        if self.options.get_safe("with_libcurl"):
+            self.requires("libcurl/[>=7.78.0 <9]")
         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")
+            self.requires("util-linux-libuuid/2.39.2")
+        if self.options.get_safe("with_systemd"):
+            self.requires("libsystemd/253.10")
+
+    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 +148,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
index daa1ee060995e..4c3c17aeedcf5 100644
--- a/recipes/dacap-clip/all/conandata.yml
+++ b/recipes/dacap-clip/all/conandata.yml
@@ -1,4 +1,16 @@
 sources:
+  "1.9":
+    url: "https://github.com/dacap/clip/archive/refs/tags/v1.9.tar.gz"
+    sha256: "e8af414c720784a6005419afb087786c05602e998ec52b2efe9e3112b7535d30"
+  "1.8":
+    url: "https://github.com/dacap/clip/archive/refs/tags/v1.8.tar.gz"
+    sha256: "a54d243451fb483590ffd9239a3c55f8d8e672d44df63dc2b81da01a229074bc"
+  "1.7":
+    url: "https://github.com/dacap/clip/archive/refs/tags/v1.7.tar.gz"
+    sha256: "f494d306f3425e984368cbd94ffb213e0a3b3d44c3ab169e5134788d3342535c"
+  "1.6":
+    url: "https://github.com/dacap/clip/archive/refs/tags/v1.6.tar.gz"
+    sha256: "fc37319775ec1b6a75475b46696f5014418d90676359b96b894f646241dcbb7e"
   "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
index e2bd672a9b3d1..9c743f68fab4e 100644
--- a/recipes/dacap-clip/all/conanfile.py
+++ b/recipes/dacap-clip/all/conanfile.py
@@ -7,8 +7,9 @@
 from conan.tools.microsoft import is_msvc
 from conan.tools.apple import is_apple_os
 from conan.tools.build import check_min_cppstd
+from conan.tools.scm import Version
 
-required_conan_version = ">=1.51.3"
+required_conan_version = ">=1.53.0"
 
 class DacapClipConan(ConanFile):
     name = "dacap-clip"
@@ -17,57 +18,61 @@ class DacapClipConan(ConanFile):
     url = "https://github.com/conan-io/conan-center-index"
     homepage = "https://github.com/dacap/clip/"
     topics = ("clipboard", "copy", "paste")
+    package_type = "library"
     settings = "os", "arch", "compiler", "build_type"
     options = {
         "shared": [True, False],
         "fPIC": [True, False],
         "with_png": [True, False],
+        "with_image": [True, False],
     }
     default_options = {
         "shared": False,
         "fPIC": True,
         "with_png": True,
+        "with_image": True,
     }
 
-    def export_sources(self):
-        copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder)
+    @property
+    def _min_cppstd(self):
+        return 11
 
     def config_options(self):
         if self.settings.os == "Windows":
             del self.options.fPIC
+        if self.settings.os not in ["Linux", "FreeBSD"]:
+            del self.options.with_png
+        if Version(self.version) < "1.8":
+            del self.options.with_image
 
     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
+            self.options.rm_safe("fPIC")
 
     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")
+            self.requires("libpng/[>=1.6 <2]")
         if self.settings.os == "Linux":
             self.requires("xorg/system")
 
     def validate(self):
         if self.info.settings.compiler.cppstd:
-            check_min_cppstd(self, 11)
+            check_min_cppstd(self, self._min_cppstd)
         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)
+        get(self, **self.conan_data["sources"][self.version], strip_root=True)
 
     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)
+        toolchain.variables["CLIP_ENABLE_IMAGE"] = self.options.get_safe("with_image", False)
         if is_msvc(self):
             toolchain.cache_variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = bool(self.options.shared)
         toolchain.generate()
@@ -94,6 +99,8 @@ def package_info(self):
 
         if self.options.get_safe("with_png", False):
             self.cpp_info.requires.append("libpng::libpng")
+        if self.options.get_safe("with_image", False):
+            self.cpp_info.defines.append("CLIP_ENABLE_IMAGE=1")
 
         if self.settings.os in ["Linux", "FreeBSD"]:
             self.cpp_info.requires.append("xorg::xcb")
@@ -109,6 +116,6 @@ def package_info(self):
         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
+    # 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
index 63e11b22a301b..3913723472269 100644
--- a/recipes/dacap-clip/all/test_package/CMakeLists.txt
+++ b/recipes/dacap-clip/all/test_package/CMakeLists.txt
@@ -1,8 +1,8 @@
 cmake_minimum_required(VERSION 3.8)
-project(test_package CXX)
+project(test_package LANGUAGES CXX)
 
 find_package(clip REQUIRED CONFIG)
 
 add_executable(${PROJECT_NAME} test_package.cpp)
-target_link_libraries(${PROJECT_NAME} clip::clip)
+target_link_libraries(${PROJECT_NAME} PRIVATE clip::clip)
 target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11)
diff --git a/recipes/dacap-clip/config.yml b/recipes/dacap-clip/config.yml
index 84f49b2850870..baafafbfe03c1 100644
--- a/recipes/dacap-clip/config.yml
+++ b/recipes/dacap-clip/config.yml
@@ -1,3 +1,11 @@
 versions:
+  "1.9":
+    folder: "all"
+  "1.8":
+    folder: "all"
+  "1.7":
+    folder: "all"
+  "1.6":
+    folder: "all"
   "1.5":
     folder: "all"
diff --git a/recipes/darknet/all/conandata.yml b/recipes/darknet/all/conandata.yml
index f7382d7a3ec4c..f0ab72430d98e 100644
--- a/recipes/darknet/all/conandata.yml
+++ b/recipes/darknet/all/conandata.yml
@@ -5,4 +5,3 @@ sources:
 patches:
   cci.20180914:
     - patch_file: "patches/include_conan_flags.patch"
-      base_path: "source_subfolder"
diff --git a/recipes/darknet/all/conanfile.py b/recipes/darknet/all/conanfile.py
index 5e49bf67b81ff..11a96d6b05dda 100644
--- a/recipes/darknet/all/conanfile.py
+++ b/recipes/darknet/all/conanfile.py
@@ -1,32 +1,39 @@
 import os
-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 stdcpp_library
+from conan.tools.files import (
+    apply_conandata_patches,
+    chdir,
+    copy,
+    export_conandata_patches,
+    get,
+    replace_in_file,
+)
+from conan.tools.gnu import Autotools, AutotoolsToolchain, PkgConfigDeps
+from conan.tools.layout import basic_layout
 
 
 class DarknetConan(ConanFile):
     name = "darknet"
+    description = "Darknet is a neural network frameworks written in C"
     license = "YOLO"
     url = "https://github.com/conan-io/conan-center-index"
     homepage = "http://pjreddie.com/darknet/"
-    description = "Darknet is a neural network frameworks written in C"
-    topics = ("darknet", "neural network", "deep learning")
+    topics = ("neural network", "deep learning")
     settings = "os", "compiler", "build_type", "arch"
     options = {
         "shared": [True, False],
         "fPIC": [True, False],
-        "with_opencv": [True, False]
+        "with_opencv": [True, False],
     }
     default_options = {
         "shared": False,
         "fPIC": True,
         "with_opencv": False,
     }
-    exports_sources = ['patches/*']
-    generators = "pkg_config"
-
-    @property
-    def _source_subfolder(self):
-        return "source_subfolder"
 
     @property
     def _lib_to_compile(self):
@@ -43,56 +50,87 @@ def _shared_lib_extension(self):
             return ".so"
 
     def _patch_sources(self):
-        for patch in self.conan_data["patches"].get(self.version, []):
-            tools.patch(**patch)
-        tools.replace_in_file(
-            os.path.join(self._source_subfolder, "Makefile"),
+        apply_conandata_patches(self)
+        replace_in_file(
+            self,
+            os.path.join(self.source_folder, "Makefile"),
             "SLIB=libdarknet.so",
-            "SLIB=libdarknet" + self._shared_lib_extension
+            f"SLIB=libdarknet{self._shared_lib_extension}",
         )
-        tools.replace_in_file(
-            os.path.join(self._source_subfolder, "Makefile"),
+        replace_in_file(
+            self,
+            os.path.join(self.source_folder, "Makefile"),
             "all: obj backup results $(SLIB) $(ALIB) $(EXEC)",
-            "all: obj backup results " + self._lib_to_compile
+            f"all: obj backup results {self._lib_to_compile}",
         )
 
+    def export_sources(self):
+        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")
 
-    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 requirements(self):
         if self.options.with_opencv:
+            # Requires OpenCV 2.x
             self.requires("opencv/2.4.13.7")
 
+    def validate(self):
+        if self.settings.os == "Windows":
+            raise ConanInvalidConfiguration("This library is not compatible with 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 generate(self):
+        tc = AutotoolsToolchain(self)
+        tc.fpic = self.options.get_safe("fPIC", True)
+        tc.make_args = ["OPENCV={}".format("1" if self.options.with_opencv else "0")]
+        tc.generate()
+        tc = PkgConfigDeps(self)
+        tc.generate()
 
     def build(self):
-        self._patch_sources()
-        with tools.chdir(self._source_subfolder):
-            with tools.environment_append({"PKG_CONFIG_PATH": self.build_folder}):
-                args = ["OPENCV={}".format("1" if self.options.with_opencv else "0")]
-                env_build = AutoToolsBuildEnvironment(self)
-                env_build.fpic = self.options.get_safe("fPIC", True)
-                env_build.make(args=args)
+        with chdir(self, self.source_folder):
+            self._patch_sources()
+            autotools = Autotools(self)
+            autotools.make()
 
     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"))
-        self.copy("*.so", dst="lib", keep_path=False)
-        self.copy("*.dylib", dst="lib", keep_path=False)
-        self.copy("*.a", dst="lib", keep_path=False)
+        copy(
+            self,
+            "LICENSE*",
+            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"),
+        )
+        for pattern in ["*.so", "*.dylib", "*.a"]:
+            copy(
+                self,
+                pattern,
+                src=self.source_folder,
+                dst=os.path.join(self.package_folder, "lib"),
+                keep_path=False,
+            )
+        fix_apple_shared_install_name(self)
 
     def package_info(self):
         self.cpp_info.libs = ["darknet"]
-        if self.settings.os == "Linux":
+        if self.options.with_opencv:
+            # For https://github.com/pjreddie/darknet/blob/61c9d02ec461e30d55762ec7669d6a1d3c356fb2/include/darknet.h#L757
+            self.cpp_info.defines.append("OPENCV=1")
+        if self.settings.os in ["Linux", "FreeBSD"]:
             self.cpp_info.system_libs = ["m", "pthread"]
-        if tools.stdcpp_library(self):
-            self.cpp_info.system_libs.append(tools.stdcpp_library(self))
+        if stdcpp_library(self):
+            self.cpp_info.system_libs.append(stdcpp_library(self))
diff --git a/recipes/darknet/all/test_package/CMakeLists.txt b/recipes/darknet/all/test_package/CMakeLists.txt
index e651ebaf233a3..7e2c525014053 100644
--- a/recipes/darknet/all/test_package/CMakeLists.txt
+++ b/recipes/darknet/all/test_package/CMakeLists.txt
@@ -1,9 +1,6 @@
-cmake_minimum_required(VERSION 3.1)
+cmake_minimum_required(VERSION 3.15)
 project(test_package CXX)
 
-include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
-conan_basic_setup(TARGETS)
-
 find_package(darknet CONFIG REQUIRED)
 
 add_executable(${PROJECT_NAME} example.cpp)
diff --git a/recipes/darknet/all/test_package/conanfile.py b/recipes/darknet/all/test_package/conanfile.py
index ffafc9bf4fa15..ef5d7042163ec 100644
--- a/recipes/darknet/all/test_package/conanfile.py
+++ b/recipes/darknet/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 DarknetTestConan(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)
@@ -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.bindir, "test_package")
+            self.run(bin_path, env="conanrun")
diff --git a/recipes/dataframe/all/conandata.yml b/recipes/dataframe/all/conandata.yml
index 91566611b6db3..5505b9c55bd20 100644
--- a/recipes/dataframe/all/conandata.yml
+++ b/recipes/dataframe/all/conandata.yml
@@ -1,39 +1,34 @@
 sources:
-  "1.21.0":
-    url: "https://github.com/hosseinmoein/DataFrame/archive/refs/tags/1.21.0.tar.gz"
-    sha256: "a6b07eaaf628225a34e4402c1a6e311430e8431455669ac03691d92f44081172"
-  "1.20.0":
-    url: "https://github.com/hosseinmoein/DataFrame/archive/refs/tags/1.20.0.tar.gz"
-    sha256: "5c241c71823c6975251f49316e03724f06cd3a288892f5a76dd504fe08700b6d"
-  "1.19.0":
-    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
-  "1.17.0":
-    sha256: 669e9663de358330b15eacaa783ccf42fe16db27b9556fdcd18f1114c0335557
-    url: https://github.com/hosseinmoein/DataFrame/archive/1.17.0.tar.gz
-  "1.16.0":
-    sha256: a5a24ec07fb4761a294a291d7bed7c72e82e2dde8bba8bfc1ca2f68e07afd7fc
-    url: https://github.com/hosseinmoein/DataFrame/archive/1.16.0.tar.gz
-  "1.15.0":
-    sha256: 68eb3fca66dff3f8473722d561e9391800957a09c2c6d4dde5f9ad37cbf88954
-    url: https://github.com/hosseinmoein/DataFrame/archive/1.15.0.tar.gz
-  "1.14.0":
-    sha256: 45991cc16e478b24641d0548aab24fd59ad534ada30fca8776fd9990e1914ac7
-    url: https://github.com/hosseinmoein/DataFrame/archive/1.14.0.tar.gz
-  "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
+  "3.3.0":
+    url: "https://github.com/hosseinmoein/DataFrame/archive/refs/tags/3.3.0.tar.gz"
+    sha256: "57a722592a29ee8fca902983411c78e7f4179c402a8b0b905f96916c9694672a"
+  "3.2.0":
+    url: "https://github.com/hosseinmoein/DataFrame/archive/refs/tags/3.2.0.tar.gz"
+    sha256: "44c513ef7956976738c2ca37384a220c5383e95fc363ad933541c6f3eef9d294"
+  "3.1.0":
+    url: "https://github.com/hosseinmoein/DataFrame/archive/refs/tags/3.1.0.tar.gz"
+    sha256: "09280a81f17d87d171062210c904c1acd94b1cdcf4c040eaa16cc9d224d526d4"
+  "3.0.0":
+    url: "https://github.com/hosseinmoein/DataFrame/archive/refs/tags/3.0.0.tar.gz"
+    sha256: "9266fb85c518a251a5440e490c81615601791f2de2fad8755aa09f13a0c541f9"
+  "2.3.0":
+    url: "https://github.com/hosseinmoein/DataFrame/archive/refs/tags/v2.3.0.tar.gz"
+    sha256: "d671a3d47c2ef250cadddbae545b1b7bee51f9411836b627b7860e187c868a72"
+  "2.2.0":
+    url: "https://github.com/hosseinmoein/DataFrame/archive/refs/tags/2.2.0.tar.gz"
+    sha256: "289e8f86c9d468ee62508167c202c34d662915922582af73b9d31691feb2b0af"
+  "2.1.0":
+    url: "https://github.com/hosseinmoein/DataFrame/archive/refs/tags/2.1.0.tar.gz"
+    sha256: "7f131c608dccd14599e5765e1a919550f08f5c334764f0e20ec181e7e8cbddae"
+  "2.0.0":
+    url: "https://github.com/hosseinmoein/DataFrame/archive/refs/tags/2.0.0.tar.gz"
+    sha256: "df46ab60153f75ef0a1ab269e6b107ec34fdc467993c3984029d7deb5e0fab6c"
 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"
+  "2.0.0":
+    - patch_file: "patches/2.0.0-0001-use-abs.patch"
+      patch_description: "use std::abs instead fabsf/fabsl"
+      patch_type: "portability"
+    - patch_file: "patches/2.0.0-0002-no-export-templates.patch"
+      patch_description: "Do not export symbols which are templates"
+      patch_type: "portability"
+      patch_source: "https://github.com/hosseinmoein/DataFrame/pull/235"
diff --git a/recipes/dataframe/all/conanfile.py b/recipes/dataframe/all/conanfile.py
index 33492673970a7..6d7b9ebefe575 100644
--- a/recipes/dataframe/all/conanfile.py
+++ b/recipes/dataframe/all/conanfile.py
@@ -2,24 +2,24 @@
 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):
     name = "dataframe"
-    license = "BSD-3-Clause"
-    url = "https://github.com/conan-io/conan-center-index"
-    homepage = "https://github.com/hosseinmoein/DataFrame"
     description = (
         "C++ DataFrame for statistical, Financial, and ML analysis -- in modern C++ "
         "using native types, continuous memory storage, and no pointers are involved"
     )
+    license = "BSD-3-Clause"
+    url = "https://github.com/conan-io/conan-center-index"
+    homepage = "https://github.com/hosseinmoein/DataFrame"
     topics = (
         "dataframe",
         "data-science",
@@ -37,7 +37,7 @@ class DataFrameConan(ConanFile):
         "financial-engineering",
         "large-data",
     )
-
+    package_type = "library"
     settings = "os", "arch", "compiler", "build_type"
     options = {
         "shared": [True, False],
@@ -48,18 +48,43 @@ class DataFrameConan(ConanFile):
         "fPIC": True,
     }
 
+    @property
+    def _min_cppstd(self):
+        if Version(self.version) < "2.1.0":
+            return "17"
+        elif Version(self.version) <= "2.2.0":
+            return "20"
+        else:
+            return "23"
+
     @property
     def _minimum_compilers_version(self):
         return {
-            "Visual Studio": "15",
-            "gcc": "7",
-            "clang": "6",
-            "apple-clang": "10.0" if Version(self.version) >= "1.12.0" else "9.0",
-        }
+            "17": {
+                "Visual Studio": "15",
+                "msvc": "191",
+                "gcc": "7",
+                "clang": "6",
+                "apple-clang": "10.0",
+            },
+            "20": {
+                "Visual Studio": "16",
+                "msvc": "192",
+                "gcc": "11",
+                "clang": "12",
+                "apple-clang": "13",
+            },
+            "23": {
+                "Visual Studio": "17",
+                "msvc": "192",
+                "gcc": "13",
+                "clang": "15",
+                "apple-clang": "15",
+            },
+        }.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":
@@ -67,59 +92,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 is_msvc(self) and self.info.options.shared and Version(self.version) < "1.20.0":
+        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(
-                "dataframe {} doesn't support shared lib with Visual Studio".format(self.version)
+                f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support."
             )
 
-        if self.info.settings.compiler.cppstd:
-            check_min_cppstd(self, "17")
-
-        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:
-            raise ConanInvalidConfiguration(
-                "{} requires C++17, which your compiler does not support.".format(self.name)
-            )
+        if Version(self.version) >= "2.2.0":
+            if (self.settings.compiler == "clang" and Version(self.settings.compiler.version) < "13.0.0" and \
+                self.settings.compiler.libcxx == "libc++"):
+                raise ConanInvalidConfiguration(f"{self.ref} doesn't support clang < 13.0.0 with libc++.")
+            if self.settings.compiler == "apple-clang" and Version(self.settings.compiler.version) < "14.0.0":
+                raise ConanInvalidConfiguration(f"{self.ref} doesn't support apple-clang < 14.0.0.")
 
-    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)
-        if Version(self.version) >= "1.20.0":
-            tc.variables["HMDF_TESTING"] = False
-            tc.variables["HMDF_EXAMPLES"] = False
-            tc.variables["HMDF_BENCHMARKS"] = False
-        elif Version(self.version) >= "1.14.0":
-            tc.variables["ENABLE_TESTING"] = False
+        tc.variables["HMDF_TESTING"] = False
+        tc.variables["HMDF_EXAMPLES"] = False
+        tc.variables["HMDF_BENCHMARKS"] = False
         tc.generate()
 
-    def _patch_sources(self):
-        apply_conandata_patches(self)
-        # Don't pollute RPATH
-        if Version(self.version) < "1.20.0":
-            replace_in_file(
-                self,
-                os.path.join(self.source_folder, "CMakeLists.txt"),
-                textwrap.dedent("""\
-                    include(AddInstallRPATHSupport)
-                    add_install_rpath_support(BIN_DIRS "${CMAKE_INSTALL_FULL_LIBDIR}"
-                                              LIB_DIRS "${CMAKE_INSTALL_FULL_BINDIR}"
-                                              INSTALL_NAME_DIR "${CMAKE_INSTALL_FULL_LIBDIR}"
-                                              USE_LINK_PATH)
-                """),
-                "",
-            )
-
     def build(self):
-        self._patch_sources()
+        apply_conandata_patches(self)
         cmake = CMake(self)
         cmake.configure()
         cmake.build()
@@ -144,16 +150,12 @@ 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:
-                # weird but required in those versions of dataframe
-                self.cpp_info.defines.append("LIBRARY_EXPORTS")
-        if Version(self.version) >= "1.20.0" and self.options.shared:
+        if self.options.shared:
             self.cpp_info.defines.append("HMDF_SHARED")
 
         # 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/patches/2.0.0-0001-use-abs.patch b/recipes/dataframe/all/patches/2.0.0-0001-use-abs.patch
new file mode 100644
index 0000000000000..3ff303f97959a
--- /dev/null
+++ b/recipes/dataframe/all/patches/2.0.0-0001-use-abs.patch
@@ -0,0 +1,37 @@
+diff --git b/cmake-add_runtime_destination.patch b/cmake-add_runtime_destination.patch
+new file mode 100644
+index 0000000..e69de29
+diff --git a/include/DataFrame/Utils/Utils.h b/include/DataFrame/Utils/Utils.h
+index 9f1f1f9..3bb3fde 100644
+--- a/include/DataFrame/Utils/Utils.h
++++ b/include/DataFrame/Utils/Utils.h
+@@ -234,17 +234,29 @@ template<>
+ inline auto
+ abs__(const long long &val)  { return (std::llabs(val)); }
+ 
++#ifdef __GNUC__
++template<>
++inline auto
++abs__(const float &val)  { return (std::abs(val)); }
++#else
+ template<>
+ inline auto
+ abs__(const float &val)  { return (std::fabsf(val)); }
++#endif
+ 
+ template<>
+ inline auto
+ abs__(const double &val)  { return (std::fabs(val)); }
+ 
++#ifdef __GNUC__
++template<>
++inline auto
++abs__(const long double &val)  { return (std::abs(val)); }
++#else
+ template<>
+ inline auto
+ abs__(const long double &val)  { return (std::fabsl(val)); }
++#endif
+ 
+ // ----------------------------------------------------------------------------
+ 
diff --git a/recipes/dataframe/all/patches/2.0.0-0002-no-export-templates.patch b/recipes/dataframe/all/patches/2.0.0-0002-no-export-templates.patch
new file mode 100644
index 0000000000000..df182770bdb56
--- /dev/null
+++ b/recipes/dataframe/all/patches/2.0.0-0002-no-export-templates.patch
@@ -0,0 +1,223 @@
+--- a/include/DataFrame/Vectors/HeteroConstPtrView.h
++++ b/include/DataFrame/Vectors/HeteroConstPtrView.h
+@@ -30,7 +30,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ #pragma once
+ 
+ #include 
+-#include 
+ 
+ #include 
+ #include 
+@@ -49,7 +48,7 @@ struct  HeteroConstPtrView {
+ 
+     using size_type = size_t;
+ 
+-    HMDF_API HeteroConstPtrView();
++    HeteroConstPtrView();
+     template
+     HeteroConstPtrView(const T *begin_ptr, const T *end_ptr);
+ 
+@@ -69,13 +68,13 @@ struct  HeteroConstPtrView {
+     HeteroConstPtrView(VectorConstPtrView &vec);
+     template
+     HeteroConstPtrView(VectorConstPtrView &&vec);
+-    HMDF_API HeteroConstPtrView(const HeteroConstPtrView &that);
+-    HMDF_API HeteroConstPtrView(HeteroConstPtrView &&that);
++    HeteroConstPtrView(const HeteroConstPtrView &that);
++    HeteroConstPtrView(HeteroConstPtrView &&that);
+ 
+     ~HeteroConstPtrView() { clear(); }
+ 
+-    HMDF_API HeteroConstPtrView &operator= (const HeteroConstPtrView &rhs);
+-    HMDF_API HeteroConstPtrView &operator= (HeteroConstPtrView &&rhs);
++    HeteroConstPtrView &operator= (const HeteroConstPtrView &rhs);
++    HeteroConstPtrView &operator= (HeteroConstPtrView &&rhs);
+ 
+     template
+     VectorConstPtrView &get_vector();
+@@ -86,7 +85,7 @@ struct  HeteroConstPtrView {
+     typename VectorConstPtrView::size_type
+     size () const { return (get_vector().size()); }
+ 
+-    HMDF_API void clear();
++    void clear();
+ 
+     template
+     bool empty() const noexcept;
+--- a/include/DataFrame/Vectors/HeteroConstView.h
++++ b/include/DataFrame/Vectors/HeteroConstView.h
+@@ -30,7 +30,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ #pragma once
+ 
+ #include 
+-#include 
+ 
+ #include 
+ #include 
+@@ -48,7 +47,7 @@ struct HeteroConstView  {
+ 
+     using size_type = size_t;
+ 
+-    HMDF_API HeteroConstView();
++    HeteroConstView();
+     template
+     HeteroConstView(const T *begin_ptr, const T *end_ptr);
+ 
+@@ -65,13 +64,13 @@ struct HeteroConstView  {
+     template
+     void set_begin_end_special(const T *bp, const T *ep_1);
+ 
+-    HMDF_API HeteroConstView(const HeteroConstView &that);
+-    HMDF_API HeteroConstView(HeteroConstView &&that);
++    HeteroConstView(const HeteroConstView &that);
++    HeteroConstView(HeteroConstView &&that);
+ 
+     ~HeteroConstView() { clear(); }
+ 
+-    HMDF_API HeteroConstView &operator= (const HeteroConstView &rhs);
+-    HMDF_API HeteroConstView &operator= (HeteroConstView &&rhs);
++    HeteroConstView &operator= (const HeteroConstView &rhs);
++    HeteroConstView &operator= (HeteroConstView &&rhs);
+ 
+     template
+     VectorConstView &get_vector();
+@@ -82,7 +81,7 @@ struct HeteroConstView  {
+     typename VectorConstView::size_type
+     size () const { return (get_vector().size()); }
+ 
+-    HMDF_API void clear();
++    void clear();
+ 
+     template
+     bool empty() const noexcept;
+--- a/include/DataFrame/Vectors/HeteroPtrView.h
++++ b/include/DataFrame/Vectors/HeteroPtrView.h
+@@ -30,7 +30,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ #pragma once
+ 
+ #include 
+-#include 
+ 
+ #include 
+ #include 
+@@ -49,7 +48,7 @@ struct HeteroPtrView {
+ 
+     using size_type = size_t;
+ 
+-    HMDF_API HeteroPtrView();
++    HeteroPtrView();
+     template
+     HeteroPtrView(T *begin_ptr, T *end_ptr);
+ 
+@@ -69,13 +68,13 @@ struct HeteroPtrView {
+     HeteroPtrView(VectorPtrView &vec);
+     template
+     HeteroPtrView(VectorPtrView &&vec);
+-    HMDF_API HeteroPtrView(const HeteroPtrView &that);
+-    HMDF_API HeteroPtrView(HeteroPtrView &&that);
++    HeteroPtrView(const HeteroPtrView &that);
++    HeteroPtrView(HeteroPtrView &&that);
+ 
+     ~HeteroPtrView() { clear(); }
+ 
+-    HMDF_API HeteroPtrView &operator= (const HeteroPtrView &rhs);
+-    HMDF_API HeteroPtrView &operator= (HeteroPtrView &&rhs);
++    HeteroPtrView &operator= (const HeteroPtrView &rhs);
++    HeteroPtrView &operator= (HeteroPtrView &&rhs);
+ 
+     template
+     VectorPtrView &get_vector();
+@@ -91,7 +90,7 @@ struct HeteroPtrView {
+     typename VectorPtrView::
+     size_type size () const { return (get_vector().size()); }
+ 
+-    HMDF_API void clear();
++    void clear();
+ 
+     template
+     bool empty() const noexcept;
+--- a/include/DataFrame/Vectors/HeteroVector.h
++++ b/include/DataFrame/Vectors/HeteroVector.h
+@@ -29,7 +29,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ 
+ #pragma once
+ 
+-#include 
+ #include 
+ #include 
+ #include 
+@@ -58,14 +57,14 @@ struct HeteroVector  {
+ 
+     using size_type = size_t;
+ 
+-    HMDF_API HeteroVector();
+-    HMDF_API HeteroVector(const HeteroVector &that);
+-    HMDF_API HeteroVector(HeteroVector &&that);
++    HeteroVector();
++    HeteroVector(const HeteroVector &that);
++    HeteroVector(HeteroVector &&that);
+ 
+     ~HeteroVector() { clear(); }
+ 
+-    HMDF_API HeteroVector &operator= (const HeteroVector &rhs);
+-    HMDF_API HeteroVector &operator= (HeteroVector &&rhs);
++    HeteroVector &operator= (const HeteroVector &rhs);
++    HeteroVector &operator= (HeteroVector &&rhs);
+ 
+     template
+     std::vector::type> &get_vector();
+@@ -104,7 +103,7 @@ struct HeteroVector  {
+     template
+     size_type size () const { return (get_vector().size()); }
+ 
+-    HMDF_API void clear();
++    void clear();
+ 
+     template
+     void erase(size_type pos);
+--- a/include/DataFrame/Vectors/HeteroView.h
++++ b/include/DataFrame/Vectors/HeteroView.h
+@@ -30,7 +30,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ #pragma once
+ 
+ #include 
+-#include 
+ 
+ #include 
+ #include 
+@@ -49,7 +48,7 @@ struct HeteroView  {
+ 
+     using size_type = size_t;
+ 
+-    HMDF_API HeteroView();
++    HeteroView();
+     template
+     HeteroView(T *begin_ptr, T *end_ptr);
+ 
+@@ -65,13 +64,13 @@ struct HeteroView  {
+     template
+     void set_begin_end_special(T *bp, T *ep_1);
+ 
+-    HMDF_API HeteroView(const HeteroView &that);
+-    HMDF_API HeteroView(HeteroView &&that);
++    HeteroView(const HeteroView &that);
++    HeteroView(HeteroView &&that);
+ 
+     ~HeteroView() { clear(); }
+ 
+-    HMDF_API HeteroView &operator= (const HeteroView &rhs);
+-    HMDF_API HeteroView &operator= (HeteroView &&rhs);
++    HeteroView &operator= (const HeteroView &rhs);
++    HeteroView &operator= (HeteroView &&rhs);
+ 
+     template
+     VectorView &get_vector();
+@@ -82,7 +81,7 @@ struct HeteroView  {
+     typename VectorView::
+     size_type size () const { return (get_vector().size()); }
+ 
+-    HMDF_API void clear();
++    void clear();
+ 
+     template
+     bool empty() const noexcept;
diff --git a/recipes/dataframe/all/test_package/CMakeLists.txt b/recipes/dataframe/all/test_package/CMakeLists.txt
index 4c82a6b1a8874..74034b149b7c0 100644
--- a/recipes/dataframe/all/test_package/CMakeLists.txt
+++ b/recipes/dataframe/all/test_package/CMakeLists.txt
@@ -1,8 +1,14 @@
-cmake_minimum_required(VERSION 3.8)
+cmake_minimum_required(VERSION 3.12)
 project(test_package LANGUAGES CXX)
 
 find_package(DataFrame REQUIRED CONFIG)
 
 add_executable(${PROJECT_NAME} test_package.cpp)
 target_link_libraries(${PROJECT_NAME} PRIVATE DataFrame::DataFrame)
-target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)
+if(DataFrame_VERSION VERSION_GREATER_EQUAL "2.3.0")
+    target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_23)
+elseif(DataFrame_VERSION VERSION_GREATER_EQUAL "2.1.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/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..7ac485fbb17f1 100644
--- a/recipes/dataframe/config.yml
+++ b/recipes/dataframe/config.yml
@@ -1,23 +1,19 @@
 versions:
-  "1.21.0":
+  "3.3.0":
     folder: all
-  "1.20.0":
+  "3.2.0":
     folder: all
-  "1.19.0":
+  "3.1.0":
     folder: all
-  "1.18.0":
+  "3.0.0":
     folder: all
-  "1.17.0":
+  "2.3.0":
     folder: all
-  "1.16.0":
+  # last version for C++20
+  "2.2.0":
     folder: all
-  "1.15.0":
+  "2.1.0":
     folder: all
-  "1.14.0":
-    folder: all
-  "1.12.0":
-    folder: all
-  "1.8.0":
-    folder: all
-  "1.7.0":
+  # last version for C++17
+  "2.0.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..94e4bf0b1e51f 100644
--- a/recipes/date/all/conandata.yml
+++ b/recipes/date/all/conandata.yml
@@ -1,24 +1,35 @@
 sources:
-  "2.4.1":
-    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
+  "3.0.3":
+    url: "https://github.com/HowardHinnant/date/archive/refs/tags/v3.0.3.tar.gz"
+    sha256: "30de45a34a2605cca33a993a9ea54e8f140f23b1caf1acf3c2fd436c42c7d942"
+  "3.0.2":
+    url: "https://github.com/HowardHinnant/date/archive/refs/tags/v3.0.2.tar.gz"
+    sha256: "0449667ea85c5b411c28d08a53f1e420c73416caa5b693c249dac9763eb97b7c"
   "3.0.1":
-    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
+    url: "https://github.com/HowardHinnant/date/archive/refs/tags/v3.0.1.tar.gz"
+    sha256: "7a390f200f0ccd207e8cff6757e04817c1a0aec3e327b006b7eb451c57ee3538"
   "3.0.0":
-    - base_path: source_subfolder
-      patch_file: patches/cmake-3.0.0.patch
+    url: "https://github.com/HowardHinnant/date/archive/refs/tags/v3.0.0.tar.gz"
+    sha256: "87bba2eaf0ebc7ec539e5e62fc317cb80671a337c1fb1b84cb9e4d42c6dbebe3"
+  "2.4.1":
+    url: "https://github.com/HowardHinnant/date/archive/refs/tags/v2.4.1.tar.gz"
+    sha256: "98907d243397483bd7ad889bf6c66746db0d7d2a39cc9aacc041834c40b65b98"
+patches:
   "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"
+  "3.0.0":
+    - patch_file: "patches/cmake-3.0.0.patch"
+      patch_description: "Disable string view to workaround clang 5 not having it"
+      patch_type: "portability"
+  "2.4.1":
+    - 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"
diff --git a/recipes/date/all/conanfile.py b/recipes/date/all/conanfile.py
index c6c05647b84c5..8db1625fd6096 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.build import check_min_cppstd
+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.scm import Version
+
 import os
 
-required_conan_version = ">=1.33.0"
+required_conan_version = ">=1.53.0"
 
 
 class DateConan(ConanFile):
@@ -9,10 +14,9 @@ class DateConan(ConanFile):
     url = "https://github.com/conan-io/conan-center-index"
     homepage = "https://github.com/HowardHinnant/date"
     description = "A date and time library based on the C++11/14/17  header"
-    topics = ("date", "datetime", "timezone",
-              "calendar", "time", "iana-database")
+    topics = ("datetime", "timezone", "calendar", "time", "iana-database")
     license = "MIT"
-
+    package_type = "library"
     settings = "os", "arch", "compiler", "build_type"
     options = {
         "shared": [True, False],
@@ -29,104 +33,94 @@ 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":
             del self.options.fPIC
-        if self.settings.os in ["iOS", "tvOS", "watchOS"]:
+        if self.settings.os in ["iOS", "tvOS", "watchOS", "Android"]:
             self.options.use_system_tz_db = True
 
     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
+            self.package_type = "header-library"
+
+    def layout(self):
+        cmake_layout(self, src_folder="src")
 
     def requirements(self):
         if not self.options.header_only and not self.options.use_system_tz_db:
-            self.requires("libcurl/7.78.0")
-
-    def validate(self):
-        if self.settings.compiler.cppstd:
-            tools.check_min_cppstd(self, "11")
+            self.requires("libcurl/[>=7.78 <9]")
 
     def package_id(self):
-        if self.options.header_only:
-            self.info.header_only()
+        if self.info.options.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)
-
-    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
-        # 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()
-
-        self._cmake = cmake
-        return self._cmake
+        get(self, **self.conan_data["sources"][self.version], strip_root=True)
+
+    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 gcc 7 and clang 5 not having string_view
+        if Version(self.version) >= "3.0.0" and \
+            ((self.settings.compiler == "gcc" and Version(self.settings.compiler.version) <= "7.0") or \
+             (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()
 
     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)
-        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)
-        else:
-            cmake = self._configure_cmake()
+        copy(self, "LICENSE.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder)
+        if not self.options.header_only:
+            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"))
+        copy(self, "*.h", dst=os.path.join(self.package_folder, "include", "date"),
+                src=os.path.join(self.source_folder, "include", "date"))
 
     def package_info(self):
-        self.cpp_info.names["cmake_find_package"] = "date"
-        self.cpp_info.names["cmake_find_package_multi"] = "date"
+        self.cpp_info.set_property("cmake_file_name", "date")
+        self.cpp_info.set_property("cmake_target_name", "date::date")
 
         # date-tz
-        if not self.options.header_only:
-            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 "")
+        if self.options.header_only:
+            self.cpp_info.bindirs = []
+            self.cpp_info.defines.append("DATE_HEADER_ONLY")
+            self.cpp_info.libdirs = []
+        else:
+            self.cpp_info.components["date-tz"].set_property("cmake_target_name", "date::date-tz")
+            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")
+            if self.settings.os in ["Linux", "FreeBSD"]:
+                self.cpp_info.components["date-tz"].system_libs.extend(["m", "pthread"])
 
             if not self.options.use_system_tz_db:
                 self.cpp_info.components["date-tz"].requires.append("libcurl::libcurl")
 
-            if self.options.use_system_tz_db and not self.settings.os == "Windows":
-                use_os_tzdb = 1
-            else:
-                use_os_tzdb = 0
-
-            defines = ["USE_OS_TZDB={}".format(use_os_tzdb)]
+            use_os_tzdb = 1 if self.options.use_system_tz_db and not self.settings.os == "Windows" else 0
+            defines = [f"USE_OS_TZDB={use_os_tzdb}"]
             if self.settings.os == "Windows" and self.options.shared:
                 defines.append("DATE_USE_DLL=1")
 
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..7a4b3fe1c9b08 100644
--- a/recipes/date/all/test_package/CMakeLists.txt
+++ b/recipes/date/all/test_package/CMakeLists.txt
@@ -1,12 +1,11 @@
-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()
+find_package(date REQUIRED)
 
 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 date::date)
+target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11)
 if(DATE_HEADER_ONLY)
-  target_compile_definitions(${PROJECT_NAME} PRIVATE DATE_HEADER_ONLY)
+    target_compile_definitions(${PROJECT_NAME} PRIVATE DATE_HEADER_ONLY)
 endif()
diff --git a/recipes/date/all/test_package/conanfile.py b/recipes/date/all/test_package/conanfile.py
index d153c8c1a4bbe..d75ac2f1b24f1 100644
--- a/recipes/date/all/test_package/conanfile.py
+++ b/recipes/date/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"
+    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["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 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/date/all/test_package/test_package.cpp b/recipes/date/all/test_package/test_package.cpp
index 8dcac9f656989..4ccf632e8e904 100644
--- a/recipes/date/all/test_package/test_package.cpp
+++ b/recipes/date/all/test_package/test_package.cpp
@@ -1,60 +1,16 @@
 #include "date/date.h"
 #include "date/tz.h"
-
-#include 
-#include 
 #include 
-#include 
-
-class ZoneOffset {
-public:
-    explicit ZoneOffset(std::chrono::minutes offset)
-        : _offset(offset) {}
-
-    template 
-    auto to_local(date::sys_time tp) const
-        -> date::local_time::type> {
-        using namespace date;
-        using namespace std::chrono;
-        using LT = local_time::type>;
-        return LT{(tp + _offset).time_since_epoch()};
-    }
-
-    template 
-    auto to_sys(date::local_time tp) const
-        -> date::sys_time::type> {
-        using namespace date;
-        using namespace std::chrono;
-        using ST = sys_time::type>;
-        return ST{(tp - _offset).time_since_epoch()};
-    }
-
-private:
-    std::chrono::minutes _offset;
-};
 
 int main() {
-    using namespace std::chrono;
-    using namespace date;
-
-    auto date1 = 2015_y/March/22;
-    std::cout << date1 << '\n';
-    auto date2 = March/22/2015;
-    std::cout << date2 << '\n';
-    auto date3 = 22_d/March/2015;
-    std::cout << date3 << '\n';
-
-    ZoneOffset p3_45{hours{3} + minutes{45}};
-    zoned_time zt{&p3_45, floor(system_clock::now())};
-    std::cout << zt.get_sys_time() << " (sys time)\n";
-    std::cout << zt.get_local_time() << " (local time)\n";
+    const date::year_month_day conan_two(date::year(2023), date::month(2), date::day(22));
+    std::cout << "Conan was released on: " << conan_two << std::endl;
 
 #ifndef DATE_HEADER_ONLY
     try {
-        auto tz = date::current_zone()->name();
-        std::cout << "timezone: " << tz << std::endl;
-    } catch (const std::exception & e) {
-         std::cout << "exception caught " << e.what() << std::endl;
+        const date::time_zone* tz = date::current_zone();
+    }
+    catch (const std::exception & e) {
     }
 #endif
 
diff --git a/recipes/date/config.yml b/recipes/date/config.yml
index 8da6f34991031..7fe264ed2099a 100644
--- a/recipes/date/config.yml
+++ b/recipes/date/config.yml
@@ -1,8 +1,11 @@
----
 versions:
-  "2.4.1":
+  "3.0.3":
     folder: all
-  "3.0.0":
+  "3.0.2":
     folder: all
   "3.0.1":
     folder: all
+  "3.0.0":
+    folder: all
+  "2.4.1":
+    folder: all
diff --git a/recipes/dav1d/all/conandata.yml b/recipes/dav1d/all/conandata.yml
index 91f4fe2083735..be4e7f8263cbc 100644
--- a/recipes/dav1d/all/conandata.yml
+++ b/recipes/dav1d/all/conandata.yml
@@ -1,10 +1,13 @@
 sources:
-  "1.0.0":
-    url: "https://code.videolan.org/videolan/dav1d/-/archive/1.0.0/dav1d-1.0.0.tar.gz"
-    sha256: "047b8229511a82b5718a1d34c86c067b078efd02f602986d2ed09b23182ec136"
-  "0.9.1":
-    url: "https://code.videolan.org/videolan/dav1d/-/archive/0.9.1/dav1d-0.9.1.tar.gz"
-    sha256: "097db6f370b88bf09fec62919c0d3af64e07d58210c665ec461d63f4ec79f6a2"
-  "0.8.1":
-    url: "https://code.videolan.org/videolan/dav1d/-/archive/0.8.1/dav1d-0.8.1.tar.gz"
-    sha256: "39f52cccc31180c7180ebe8f223de6d12351c0407de0dfac087e8a9cc3feb8da"
+  "1.4.3":
+    url: "http://ftp.videolan.org/pub/videolan/dav1d/1.4.3/dav1d-1.4.3.tar.xz"
+    sha256: "42fe524bcc82ea3a830057178faace22923a79bad3d819a4962d8cfc54c36f19"
+  "1.4.1":
+    url: "http://ftp.videolan.org/pub/videolan/dav1d/1.4.1/dav1d-1.4.1.tar.xz"
+    sha256: "8d407dd5fe7986413c937b14e67f36aebd06e1fa5cfec679d10e548476f2d5f8"
+  "1.3.0":
+    url: "http://ftp.videolan.org/pub/videolan/dav1d/1.3.0/dav1d-1.3.0.tar.xz"
+    sha256: "6d8be2741c505c47f8f1ced3c9cc427759243436553d01d1acce201f87b39e71"
+  "1.2.1":
+    url: "http://ftp.videolan.org/pub/videolan/dav1d/1.2.1/dav1d-1.2.1.tar.xz"
+    sha256: "4e33eb61ec54c768a16da0cf8fa0928b4c4593f5f804a3c887d4a21c318340b2"
diff --git a/recipes/dav1d/all/conanfile.py b/recipes/dav1d/all/conanfile.py
index 58cc7327c8da1..08d0c4d8be0f5 100644
--- a/recipes/dav1d/all/conanfile.py
+++ b/recipes/dav1d/all/conanfile.py
@@ -5,10 +5,9 @@
 from conan.tools.layout import basic_layout
 from conan.tools.meson import Meson, MesonToolchain
 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 Dav1dConan(ConanFile):
@@ -18,7 +17,7 @@ class Dav1dConan(ConanFile):
     topics = ("av1", "codec", "video", "decoding")
     license = "BSD-2-Clause"
     url = "https://github.com/conan-io/conan-center-index"
-
+    package_type = "library"
     settings = "os", "arch", "compiler", "build_type"
     options = {
         "shared": [True, False],
@@ -26,7 +25,7 @@ class Dav1dConan(ConanFile):
         "bit_depth": ["all", 8, 16],
         "with_tools": [True, False],
         "assembly": [True, False],
-        "with_avx512": [True, False],
+        "with_avx512": ["deprecated", True, False],
     }
     default_options = {
         "shared": False,
@@ -34,7 +33,7 @@ class Dav1dConan(ConanFile):
         "bit_depth": "all",
         "with_tools": True,
         "assembly": True,
-        "with_avx512": False,
+        "with_avx512": "deprecated",
     }
 
     def config_options(self):
@@ -43,54 +42,45 @@ def config_options(self):
         if is_msvc(self) and self.settings.build_type == "Debug":
             # debug builds with assembly often causes linker hangs or LNK1000
             self.options.assembly = False
-        if Version(self.version) < "1.0.0":
-            del self.options.with_avx512
 
     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
-        if not self.options.assembly:
-            del self.options.with_avx512
-
-    def build_requirements(self):
-        self.tool_requires("meson/0.63.1")
-        if self.options.assembly:
-            self.tool_requires("nasm/2.15.05")
+            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 package_id(self):
+        del self.info.options.with_avx512
+
+    def validate(self):
+        if self.options.with_avx512 != "deprecated":
+            self.output.warning("The 'with_avx512' option is deprecated and has no effect")
+
+    def build_requirements(self):
+        self.tool_requires("meson/1.4.0")
+        if self.options.assembly:
+            self.tool_requires("nasm/2.16.01")
+
     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
-        if Version(self.version) < "1.0.0":
-            tc.project_options["enable_avx512"] = self.options.get_safe("with_avx512", False)
         tc.project_options["enable_tools"] = self.options.with_tools
         if self.options.bit_depth == "all":
             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/dav1d/config.yml b/recipes/dav1d/config.yml
index d99137151015c..d5bc79ec13e97 100644
--- a/recipes/dav1d/config.yml
+++ b/recipes/dav1d/config.yml
@@ -1,7 +1,9 @@
 versions:
-  "1.0.0":
+  "1.4.3":
     folder: "all"
-  "0.9.1":
+  "1.4.1":
     folder: "all"
-  "0.8.1":
+  "1.3.0":
+    folder: "all"
+  "1.2.1":
     folder: "all"
diff --git a/recipes/daw_header_libraries/all/conandata.yml b/recipes/daw_header_libraries/all/conandata.yml
index 5d3fc84d353b8..7e7d062b09499 100644
--- a/recipes/daw_header_libraries/all/conandata.yml
+++ b/recipes/daw_header_libraries/all/conandata.yml
@@ -1,31 +1,34 @@
 sources:
-  "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"
-  "1.29.7":
-    url: "https://github.com/beached/header_libraries/archive/refs/tags/v1.29.7.tar.gz"
-    sha256: "524c34f3f5d2af498e7bcaff7802b914ba42acde29f7e3ecce41a035db0bf5bd"
+  "2.118.0":
+    url: "https://github.com/beached/header_libraries/archive/v2.118.0.tar.gz"
+    sha256: "2a3e093c2f69db979e7672d33b97f7f24cda23ff753fafe90a3aaf25ac965a70"
+  "2.114.0":
+    url: "https://github.com/beached/header_libraries/archive/v2.114.0.tar.gz"
+    sha256: "c36229424bd68ee8936ad688127303aee69ecd5400a905df75138ed95cbfef53"
+  "2.110.0":
+    url: "https://github.com/beached/header_libraries/archive/v2.110.0.tar.gz"
+    sha256: "6515bb7a130656adff9f1f17d6be69dbd7c40dbcebbe418e9d0cf15bbc71bffc"
+  "2.107.0":
+    url: "https://github.com/beached/header_libraries/archive/v2.107.0.tar.gz"
+    sha256: "b84f7666d004da466d0035e9f475797395e90b6e8f23e000816b45aa13d4fc35"
+  "2.106.2":
+    url: "https://github.com/beached/header_libraries/archive/v2.106.2.tar.gz"
+    sha256: "33609d83aec5a6081efebf871627b7a8bddc2b7f0eb8d4ac14756d403d29d089"
+  "2.106.1":
+    url: "https://github.com/beached/header_libraries/archive/v2.106.1.tar.gz"
+    sha256: "393815fbf249ca1220a216899cae3d2672ca193f9db228a0b99925a9b0f90854"
+  "2.106.0":
+    url: "https://github.com/beached/header_libraries/archive/v2.106.0.tar.gz"
+    sha256: "7838ada09afa69e7a42d742991c4b24b32ba27681e7b4dadf7b1e45c168937b5"
+  "2.101.0":
+    url: "https://github.com/beached/header_libraries/archive/v2.101.0.tar.gz"
+    sha256: "468b3a40b90295f1da8eb79ae5723909269c020e7e8bf3d93d3f4fac7c35195b"
+  "2.98.5":
+    url: "https://github.com/beached/header_libraries/archive/v2.98.5.tar.gz"
+    sha256: "2d548a6f7a860917e2f743ee75e82733cbf0d3720b7296da023c5a17a9010c9a"
+  "2.97.0":
+    url: "https://github.com/beached/header_libraries/archive/v2.97.0.tar.gz"
+    sha256: "993cda7ff505e80f54322ce544b8a7b02bfef9673d980e43dafcbd3a9a3228d3"
+  "2.96.1":
+    url: "https://github.com/beached/header_libraries/archive/v2.96.1.tar.gz"
+    sha256: "2a9a5c33baa9e3adc1d82fa13a56522638af13cc39372a0c1c8f5c5d984f1464"
diff --git a/recipes/daw_header_libraries/all/conanfile.py b/recipes/daw_header_libraries/all/conanfile.py
index 50f3611d7a2d8..98257810d2c5a 100644
--- a/recipes/daw_header_libraries/all/conanfile.py
+++ b/recipes/daw_header_libraries/all/conanfile.py
@@ -1,26 +1,32 @@
 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.files import get, copy
 from conan.tools.layout import basic_layout
+from conan.tools.scm import Version
 
 import os
 
 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"
     homepage = "https://github.com/beached/header_libraries"
-    topics = ("algorithms", "helpers", "data-structures")
+    topics = ("algorithms", "helpers", "data-structures", "header-only")
+    package_type = "header-library"
     settings = "os", "arch", "compiler", "build_type"
     no_copy_source = True
 
     @property
-    def _compiler_required_cpp17(self):
+    def _min_cppstd(self):
+        return "17"
+
+    @property
+    def _compilers_minimum_version(self):
         return {
             "Visual Studio": "16",
             "msvc": "192",
@@ -37,26 +43,24 @@ def package_id(self):
 
     def validate(self):
         if self.settings.get_safe("compiler.cppstd"):
-            check_min_cppstd(self, "17")
-
-        minimum_version = self._compiler_required_cpp17.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 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(f"{self.ref} requires C++17. Your compiler is unknown. Assuming it supports C++17.")
+            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
+        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="*.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("cmake_file_name", "daw-header-libraries")
         self.cpp_info.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 817fb2a992dc4..2474980662644 100644
--- a/recipes/daw_header_libraries/all/test_package/CMakeLists.txt
+++ b/recipes/daw_header_libraries/all/test_package/CMakeLists.txt
@@ -4,6 +4,10 @@ project(test_package LANGUAGES CXX)
 
 find_package(daw-header-libraries REQUIRED CONFIG)
 
-add_executable(${PROJECT_NAME} test_package.cpp)
+if(daw-header-libraries_VERSION VERSION_LESS "2.109.0")
+    add_executable(${PROJECT_NAME} test_package_old.cpp)
+else()
+    add_executable(${PROJECT_NAME} test_package.cpp)
+endif()
 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/test_package.cpp b/recipes/daw_header_libraries/all/test_package/test_package.cpp
index 7b47a51d28ef5..63fa16b601f2d 100644
--- a/recipes/daw_header_libraries/all/test_package/test_package.cpp
+++ b/recipes/daw_header_libraries/all/test_package/test_package.cpp
@@ -1,7 +1,7 @@
-#include "daw/daw_carray.h"
+#include "daw/daw_bounded_array.h"
 
 int main() {
-    daw::carray t = { 1, 2, 3, 4, 5, 6 };
+    daw::array t = { 1, 2, 3, 4, 5, 6 };
 
     auto val = t[3];
 
diff --git a/recipes/daw_header_libraries/all/test_package/test_package_old.cpp b/recipes/daw_header_libraries/all/test_package/test_package_old.cpp
new file mode 100644
index 0000000000000..7b47a51d28ef5
--- /dev/null
+++ b/recipes/daw_header_libraries/all/test_package/test_package_old.cpp
@@ -0,0 +1,9 @@
+#include "daw/daw_carray.h"
+
+int main() {
+    daw::carray t = { 1, 2, 3, 4, 5, 6 };
+
+    auto val = t[3];
+
+    return 0;
+}
diff --git a/recipes/daw_header_libraries/config.yml b/recipes/daw_header_libraries/config.yml
index cfc27ab8efedc..155232f2792e6 100644
--- a/recipes/daw_header_libraries/config.yml
+++ b/recipes/daw_header_libraries/config.yml
@@ -1,21 +1,23 @@
 versions:
-  "2.79.0":
+  "2.118.0":
     folder: all
-  "2.76.3":
+  "2.114.0":
     folder: all
-  "2.76.2":
+  "2.110.0":
     folder: all
-  "2.74.2":
+  "2.107.0":
     folder: all
-  "2.73.1":
+  "2.106.2":
     folder: all
-  "2.72.0":
+  "2.106.1":
     folder: all
-  "2.71.0":
+  "2.106.0":
     folder: all
-  "2.68.3":
+  "2.101.0":
     folder: all
-  "2.68.1":
+  "2.98.5":
     folder: all
-  "1.29.7":
+  "2.97.0":
+    folder: all
+  "2.96.1":
     folder: all
diff --git a/recipes/daw_json_link/all/conandata.yml b/recipes/daw_json_link/all/conandata.yml
index 9aef5d14cf616..4226c99f417b1 100644
--- a/recipes/daw_json_link/all/conandata.yml
+++ b/recipes/daw_json_link/all/conandata.yml
@@ -1,37 +1,59 @@
 sources:
-  "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"
-  "3.1.0":
-    url: "https://github.com/beached/daw_json_link/archive/v3.1.0.tar.gz"
-    sha256: "c1134fed24794cda598306d23d23c393a0df8ee13d0019cae6ed46b939dad190"
-  "3.0.5":
-    url: "https://github.com/beached/daw_json_link/archive/v3.0.5.tar.gz"
-    sha256: "77abe2ca525083d59a1e4e8e9aa1d2633e5382d98a0d5d838cd2379eaf8d7edf"
-  "2.15.3":
-    url: "https://github.com/beached/daw_json_link/archive/v2.15.3.tar.gz"
-    sha256: "ec0457a5682a76c5aec709f2d6959ef7bafa0b54c5e7740f911d97991188ee84"
-  "2.14.0":
-    url: "https://github.com/beached/daw_json_link/archive/v2.14.0.tar.gz"
-    sha256: "811d0c5ab9ed9c79c84fc5837c8e7ef48f1f45177b7931bc849363c48a62261b"
+  "3.29.2":
+    url: "https://github.com/beached/daw_json_link/archive/refs/tags/v3.29.2.tar.gz"
+    sha256: "a0450a2d724d83a600d48d503eb11094039a7a4b607fa59b1d7ce83483b1f8b4"
+  "3.28.3":
+    url: "https://github.com/beached/daw_json_link/archive/refs/tags/v3.28.3.tar.gz"
+    sha256: "c9973e8da74c4a6eb84fbd1f86f8048a697068af7dec6aee602e08e9f4df39db"
+  "3.24.1":
+    url: "https://github.com/beached/daw_json_link/archive/refs/tags/v3.24.1.tar.gz"
+    sha256: "439b4678377950f165e3d49d472c0676f0ef2fae3c5e6e7febddd5633f6e4f39"
+  "3.23.2":
+    url: "https://github.com/beached/daw_json_link/archive/refs/tags/v3.23.2.tar.gz"
+    sha256: "fd1234a14c126c79076e0b6e6eceae42afd465c419dc7a7393c69c28aa7f53d4"
+  "3.23.0":
+    url: "https://github.com/beached/daw_json_link/archive/refs/tags/v3.23.0.tar.gz"
+    sha256: "a01e9a3a48784a47dbb60bd21ecbe7e05a7d30cec75ea6d55b1789f6aefe5f05"
+  "3.20.1":
+    url: "https://github.com/beached/daw_json_link/archive/refs/tags/v3.20.1.tar.gz"
+    sha256: "046638bc4437d138cc8bdc882027d318ca3e267f33d1b419c5bdecb45b595a47"
+  "3.19.0":
+    url: "https://github.com/beached/daw_json_link/archive/refs/tags/v3.19.0.tar.gz"
+    sha256: "85c2f6a84878925eb692c53b321b9b237481969c8caa3a9324b78540096a3559"
+  "3.17.2":
+    url: "https://github.com/beached/daw_json_link/archive/refs/tags/v3.17.2.tar.gz"
+    sha256: "6f74d386c842d83f32798f4e4cf812da9872cf4fe3565393443fc3be1a06a8ae"
+  "3.17.1":
+    url: "https://github.com/beached/daw_json_link/archive/refs/tags/v3.17.1.tar.gz"
+    sha256: "a29c6bcb7856ac0217fa36873af007f619fd467097488746f29a6a332616a829"
+  "3.16.0":
+    url: "https://github.com/beached/daw_json_link/archive/refs/tags/v3.16.0.tar.gz"
+    sha256: "48eae5db76e72a481ba4830900974178c49fb8c7c89909405381bd1775cbc84c"
+  "3.15.0":
+    url: "https://github.com/beached/daw_json_link/archive/refs/tags/v3.15.0.tar.gz"
+    sha256: "6f72c69944e33f56823d941b09c8d17ece44b224e802ae0a3416c32f2bdbec40"
+# When updating this, ensure that the versions are consistent across the rest of the daw libraries
+daw_headers_mapping:
+  "3.29.2": "2.110.0"
+  "3.28.3": "2.110.0"
+  "3.24.1": "2.110.0"
+  "3.23.2": "2.101.0"
+  "3.23.0": "2.97.0"
+  "3.20.1": "2.97.0"
+  "3.19.0": "2.97.0"
+  "3.17.2": "2.97.0"
+  "3.17.1": "2.97.0"
+  "3.16.0": "2.97.0"
+  "3.15.0": "2.97.0"
+daw_utf_mapping:
+  "3.29.2": "2.2.5"
+  "3.28.3": "2.2.5"
+  "3.24.1": "2.2.5"
+  "3.23.2": "2.2.4"
+  "3.23.0": "2.2.3"
+  "3.20.1": "2.2.3"
+  "3.19.0": "2.2.3"
+  "3.17.2": "2.2.3"
+  "3.17.1": "2.2.3"
+  "3.16.0": "2.2.3"
+  "3.15.0": "2.2.3"
diff --git a/recipes/daw_json_link/all/conanfile.py b/recipes/daw_json_link/all/conanfile.py
index c31ac48f8445e..eeaf0710c5e7a 100644
--- a/recipes/daw_json_link/all/conanfile.py
+++ b/recipes/daw_json_link/all/conanfile.py
@@ -4,7 +4,6 @@
 from conan.tools.files import get, copy, rmdir
 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
 
 import os
 
@@ -17,6 +16,7 @@ class DawJsonLinkConan(ConanFile):
     url = "https://github.com/conan-io/conan-center-index"
     homepage = "https://github.com/beached/daw_json_link"
     topics = ("json", "parse", "json-parser", "serialization", "constexpr", "header-only")
+    package_type = "header-library"
     settings = "os", "arch", "compiler", "build_type"
     no_copy_source = True
     short_paths = True
@@ -28,6 +28,8 @@ def _minimum_cpp_standard(self):
     @property
     def _compilers_minimum_version(self):
         return {
+            "Visual Studio": "16",
+            "msvc": "192",
             "gcc": "8",
             "clang": "7",
             "apple-clang": "12",
@@ -37,8 +39,10 @@ def layout(self):
         cmake_layout(self, src_folder="src")
 
     def requirements(self):
-        self.requires("daw_header_libraries/2.76.3")
-        self.requires("daw_utf_range/2.2.3")
+        corresponding_daw_header_version = self.conan_data["daw_headers_mapping"][self.version]
+        self.requires(f"daw_header_libraries/{corresponding_daw_header_version}")
+        corresponding_daw_utf_version = self.conan_data["daw_utf_mapping"][self.version]
+        self.requires(f"daw_utf_range/{corresponding_daw_utf_version}")
 
     def package_id(self):
         self.info.clear()
@@ -46,16 +50,14 @@ def package_id(self):
     def validate(self):
         if self.settings.compiler.get_safe("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.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."
-                )
+        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)
+        get(self, **self.conan_data["sources"][self.version], strip_root=True)
 
     def generate(self):
         tc = CMakeToolchain(self)
diff --git a/recipes/daw_json_link/config.yml b/recipes/daw_json_link/config.yml
index b61c457f393af..d7ebeba1581e3 100644
--- a/recipes/daw_json_link/config.yml
+++ b/recipes/daw_json_link/config.yml
@@ -1,25 +1,23 @@
 versions:
-  "3.12.0":
+  "3.29.2":
     folder: "all"
-  "3.11.1":
+  "3.28.3":
     folder: "all"
-  "3.10.0":
+  "3.24.1":
     folder: "all"
-  "3.8.1":
+  "3.23.2":
     folder: "all"
-  "3.5.0":
+  "3.23.0":
     folder: "all"
-  "3.4.1":
+  "3.20.1":
     folder: "all"
-  "3.3.0":
+  "3.19.0":
     folder: "all"
-  "3.1.1":
+  "3.17.2":
     folder: "all"
-  "3.1.0":
+  "3.17.1":
     folder: "all"
-  "3.0.5":
+  "3.16.0":
     folder: "all"
-  "2.15.3":
-    folder: "all"
-  "2.14.0":
+  "3.15.0":
     folder: "all"
diff --git a/recipes/daw_utf_range/all/conandata.yml b/recipes/daw_utf_range/all/conandata.yml
index 179be6adbbd6e..ee9d8569fa27c 100644
--- a/recipes/daw_utf_range/all/conandata.yml
+++ b/recipes/daw_utf_range/all/conandata.yml
@@ -1,10 +1,22 @@
 sources:
+  "2.2.5":
+    url: "https://github.com/beached/utf_range/archive/v2.2.5.tar.gz"
+    sha256: "18cc142c319c817da86ed037813cd50a16ff1af8e041a22b8af11beaef30ca32"
+  "2.2.4":
+    url: "https://github.com/beached/utf_range/archive/v2.2.4.tar.gz"
+    sha256: "e6df85d6da445c16507e738d70c6313df2a70e64b739a05d6437b06a5f83b8b1"
   "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"
+    url: "https://github.com/beached/utf_range/archive/v2.2.2.tar.gz"
     sha256: "5380ade7c7eb5c82a748211896fc7385eaec00d3215af1374aec8f0e326f91fd"
   "2.2.0":
-    url: "https://github.com/beached/utf_range/archive/refs/tags/v2.2.0.tar.gz"
+    url: "https://github.com/beached/utf_range/archive/v2.2.0.tar.gz"
     sha256: "00f60360736062403c8a7a94dd07c750366958f20d1864578faecf2e09d84265"
+daw_headers_mapping:
+  "2.2.5": "2.110.0"
+  "2.2.4": "2.101.0"
+  "2.2.3": "2.97.0"
+  "2.2.2": "2.97.0"
+  "2.2.0": "2.97.0"
diff --git a/recipes/daw_utf_range/all/conanfile.py b/recipes/daw_utf_range/all/conanfile.py
index b3e630fee1e5a..bb05e8ba48169 100644
--- a/recipes/daw_utf_range/all/conanfile.py
+++ b/recipes/daw_utf_range/all/conanfile.py
@@ -1,6 +1,5 @@
 from conan import ConanFile
 from conan.errors import ConanInvalidConfiguration
-from conan.tools.microsoft import check_min_vs, is_msvc
 from conan.tools.files import get, copy, rmdir
 from conan.tools.build import check_min_cppstd
 from conan.tools.scm import Version
@@ -16,7 +15,8 @@ class DawUtfRangeConan(ConanFile):
     license = "BSL-1.0"
     url = "https://github.com/conan-io/conan-center-index"
     homepage = "https://github.com/beached/utf_range/"
-    topics = ("utf", "validator", "iterator")
+    topics = ("utf", "validator", "iterator", "header-only")
+    package_type = "header-library"
     settings = "os", "arch", "compiler", "build_type"
     no_copy_source = True
 
@@ -27,16 +27,19 @@ def _minimum_cpp_standard(self):
     @property
     def _compilers_minimum_version(self):
         return {
+            "Visual Studio": "16",
+            "msvc": "192",
             "gcc": "8",
             "clang": "7",
-            "apple-clang": "12.0",
+            "apple-clang": "12",
         }
 
     def layout(self):
         cmake_layout(self, src_folder="src")
 
     def requirements(self):
-        self.requires("daw_header_libraries/2.76.3")
+        corresponding_daw_header_version = self.conan_data["daw_headers_mapping"][self.version]
+        self.requires(f"daw_header_libraries/{corresponding_daw_header_version}")
 
     def package_id(self):
         self.info.clear()
@@ -44,16 +47,14 @@ def package_id(self):
     def validate(self):
         if self.settings.get_safe("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."
-                )
+        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"][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/daw_utf_range/all/test_v1_package/CMakeLists.txt b/recipes/daw_utf_range/all/test_v1_package/CMakeLists.txt
index ab1c8bbe0a5e1..be00a8c7f57c7 100644
--- a/recipes/daw_utf_range/all/test_v1_package/CMakeLists.txt
+++ b/recipes/daw_utf_range/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(daw-utf-range REQUIRED CONFIG)
-
-add_executable(${PROJECT_NAME} ../test_package/test_package.cpp)
-target_link_libraries(${PROJECT_NAME} PRIVATE daw::daw-utf-range)
-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/daw_utf_range/config.yml b/recipes/daw_utf_range/config.yml
index 20edb7543cf05..86bdc8b77e0d5 100644
--- a/recipes/daw_utf_range/config.yml
+++ b/recipes/daw_utf_range/config.yml
@@ -1,4 +1,8 @@
 versions:
+  "2.2.5":
+    folder: "all"
+  "2.2.4":
+    folder: "all"
   "2.2.3":
     folder: "all"
   "2.2.2":
diff --git a/recipes/dbcppp/all/conanfile.py b/recipes/dbcppp/all/conanfile.py
index 3a0d9d2ce43eb..2c148eca60aad 100644
--- a/recipes/dbcppp/all/conanfile.py
+++ b/recipes/dbcppp/all/conanfile.py
@@ -1,6 +1,6 @@
 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.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
@@ -16,14 +16,13 @@ class DBCpppConan(ConanFile):
     url = "https://github.com/conan-io/conan-center-index"
     homepage = "https://github.com/xR3b0rn/dbcppp"
     topics = ("can", "dbc", "network")
+    package_type = "static-library"
     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,
     }
@@ -48,12 +47,11 @@ def config_options(self):
             del self.options.fPIC
 
     def configure(self):
-        if self.options.shared:
+        if self.options.get_safe("shared"):
             self.options.rm_safe("fPIC")
-        self.options["boost"].header_only = True
 
     def layout(self):
-        cmake_layout(self)
+        cmake_layout(self, src_folder="src")
 
     def requirements(self):
         if self.options.with_tools:
@@ -61,9 +59,6 @@ def requirements(self):
         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)
@@ -75,12 +70,10 @@ def validate(self):
                 )
 
     def source(self):
-        get(self, **self.conan_data["sources"][str(self.version)],destination=self.source_folder, strip_root=True)
+        get(self, **self.conan_data["sources"][str(self.version)], 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
@@ -108,4 +101,5 @@ def package(self):
 
     def package_info(self):
         self.cpp_info.libs = ["libdbcppp"]
-        self.env_info.path.append(os.path.join(self.package_folder, "bin"))
+        if self.options.with_tools:
+            self.env_info.path.append(os.path.join(self.package_folder, "bin"))
diff --git a/recipes/dbg-macro/all/conandata.yml b/recipes/dbg-macro/all/conandata.yml
index 695393e722d3f..3c855c0c75125 100644
--- a/recipes/dbg-macro/all/conandata.yml
+++ b/recipes/dbg-macro/all/conandata.yml
@@ -1,4 +1,10 @@
 sources:
+  "0.5.1":
+    url: "https://github.com/sharkdp/dbg-macro/archive/v0.5.1.tar.gz"
+    sha256: "fffea75f067c69995853dc790626887788e2c4c9eb0a5a0014a4501d2b6b9909"
+  "0.5.0":
+    url: "https://github.com/sharkdp/dbg-macro/archive/v0.5.0.tar.gz"
+    sha256: "dac4907aadf39dbd9eac279a214c59ad30af6c0c3d585688242f73cb1a9ce243"
   "0.4.0":
-    sha256: e44a1206fbfd1d3dc8ad649f387df479d288b08c80cf2f1239ccb4e26148d781
-    url: https://github.com/sharkdp/dbg-macro/archive/v0.4.0.tar.gz
+    url: "https://github.com/sharkdp/dbg-macro/archive/v0.4.0.tar.gz"
+    sha256: "e44a1206fbfd1d3dc8ad649f387df479d288b08c80cf2f1239ccb4e26148d781"
diff --git a/recipes/dbg-macro/all/conanfile.py b/recipes/dbg-macro/all/conanfile.py
index 49d4fa65df8ac..c4b00757159da 100644
--- a/recipes/dbg-macro/all/conanfile.py
+++ b/recipes/dbg-macro/all/conanfile.py
@@ -1,43 +1,58 @@
 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 copy, get
+from conan.tools.layout import basic_layout
+from conan.tools.scm import Version
+
+required_conan_version = ">=1.52.0"
 
 class DbgMacroConan(ConanFile):
     name = "dbg-macro"
+    description = "A dbg(...) macro for C++"
+    license = "MIT"
     url = "https://github.com/conan-io/conan-center-index"
     homepage = "https://github.com/sharkdp/dbg-macro"
-    license = "MIT"
-    description = "A dbg(...) macro for C++"
-    topics = ("conan", "debugging", "macro", "pretty-printing", "header-only")
-    settings = ("compiler", )
+    topics = ("debugging", "macro", "pretty-printing", "header-only")
+    package_type = "header-library"
+    settings = "os", "arch", "compiler", "build_type"
     no_copy_source = True
 
     @property
-    def _source_subfolder(self):
-        return "source_subfolder"
+    def _min_cppstd(self):
+        return 17
 
-    def source(self):
-        tools.get(**self.conan_data["sources"][self.version])
-        extracted_dir = self.name + "-" + self.version
-        os.rename(extracted_dir, self._source_subfolder)
+    @property
+    def _compilers_minimum_version(self):
+        return {
+            "gcc": "8",
+        }
+    
+    def layout(self):
+        basic_layout(self, src_folder="src")
+
+    def package_id(self):
+        self.info.clear()
 
-    def configure(self):
-        minimal_cpp_standard = "11"
-        if self.settings.get_safe("compiler.cppstd"):
-            tools.check_min_cppstd(self, minimal_cpp_standard)
+    def validate(self):
+        if self.settings.compiler.get_safe('cppstd'):
+            check_min_cppstd(self, self._min_cppstd)
 
-        if self.settings.compiler == "gcc" and tools.Version(self.settings.compiler.version) < "5":
+        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(
-                "dbg-mcro can't be used by {0} {1}".format(
-                    self.settings.compiler,
-                    self.settings.compiler.version
-                )
+                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("dbg.h", dst="include", src=self._source_subfolder)
-        self.copy("LICENSE", dst="licenses", src=self._source_subfolder)
+        copy(self, "dbg.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 = []
diff --git a/recipes/dbg-macro/all/test_package/CMakeLists.txt b/recipes/dbg-macro/all/test_package/CMakeLists.txt
index 33ae887aa6aea..535b1e583d6c5 100644
--- a/recipes/dbg-macro/all/test_package/CMakeLists.txt
+++ b/recipes/dbg-macro/all/test_package/CMakeLists.txt
@@ -1,9 +1,8 @@
-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()
+find_package(dbg-macro 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 dbg-macro::dbg-macro)
+target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)
diff --git a/recipes/dbg-macro/all/test_package/conanfile.py b/recipes/dbg-macro/all/test_package/conanfile.py
index a1606e05e0271..2ee2f747a7393 100644
--- a/recipes/dbg-macro/all/test_package/conanfile.py
+++ b/recipes/dbg-macro/all/test_package/conanfile.py
@@ -1,18 +1,26 @@
 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 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 build(self):
         cmake = CMake(self)
         cmake.configure()
         cmake.build()
 
+    def layout(self):
+        cmake_layout(self)
+
     def test(self):
-        if not tools.cross_building(self.settings):
-            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/dbg-macro/all/test_v1_package/CMakeLists.txt b/recipes/dbg-macro/all/test_v1_package/CMakeLists.txt
new file mode 100644
index 0000000000000..91630d79f4abb
--- /dev/null
+++ b/recipes/dbg-macro/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/dbg-macro/all/test_v1_package/conanfile.py b/recipes/dbg-macro/all/test_v1_package/conanfile.py
new file mode 100644
index 0000000000000..e9e25c6e641af
--- /dev/null
+++ b/recipes/dbg-macro/all/test_v1_package/conanfile.py
@@ -0,0 +1,18 @@
+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.settings):
+            tools.mkdir("logs/")
+            bin_path = os.path.join("bin", "test_package")
+            self.run(bin_path, run_environment=True)
diff --git a/recipes/dbg-macro/config.yml b/recipes/dbg-macro/config.yml
index da269653d6e6b..e820923f0c236 100644
--- a/recipes/dbg-macro/config.yml
+++ b/recipes/dbg-macro/config.yml
@@ -1,3 +1,7 @@
 versions:
+  "0.5.1":
+    folder: "all"
+  "0.5.0":
+    folder: "all"
   "0.4.0":
     folder: "all"
diff --git a/recipes/dbus/1.x.x/conandata.yml b/recipes/dbus/1.x.x/conandata.yml
deleted file mode 100644
index 20ee5e48052c8..0000000000000
--- a/recipes/dbus/1.x.x/conandata.yml
+++ /dev/null
@@ -1,30 +0,0 @@
-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.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_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
deleted file mode 100644
index 58568ed049ff7..0000000000000
--- a/recipes/dbus/1.x.x/conanfile.py
+++ /dev/null
@@ -1,219 +0,0 @@
-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
-
-required_conan_version = ">=1.53.0"
-
-
-class DbusConan(ConanFile):
-    name = "dbus"
-    license = ("AFL-2.1", "GPL-2.0-or-later")
-    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 = "bus", "interprocess", "message"
-    settings = "os", "arch", "compiler", "build_type"
-    short_paths = True
-    options = {
-        "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",
-    }
-
-    @property
-    def _meson_available(self):
-        return Version(self.version) >= "1.15.0"
-
-    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):
-        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/0.64.1")
-            self.tool_requires("pkgconf/1.9.3")
-
-    def requirements(self):
-        self.requires("expat/2.5.0")
-        if self.options.with_glib:
-            self.requires("glib/2.75.0")
-        if self.options.get_safe("with_systemd"):
-            self.requires("libsystemd/251.4")
-        if self.options.with_selinux:
-            self.requires("libselinux/3.3")
-        if self.options.get_safe("with_x11"):
-            self.requires("xorg/system")
-
-    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.")
-
-        if not self._meson_available and self.info.settings.os == "Windows":
-            raise ConanInvalidConfiguration(f"{self.ref} does not support Windows. Contributions welcome.")
-
-    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.
-            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)
-
-            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)
-        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):
-        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"]:
-            rename(self, os.path.join(self.package_folder, i), os.path.join(self.package_folder, "res", i))
-
-        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"))
-
-        # 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),
-            {"dbus-1": "dbus-1::dbus-1"}
-        )
-
-    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", "DBus1")
-        self.cpp_info.set_property("cmake_target_name", "dbus-1")
-        self.cpp_info.set_property("pkg_config_name", "dbus-1")
-        self.cpp_info.includedirs.extend([
-            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")
-        if self.settings.os == "Windows":
-            self.cpp_info.system_libs.extend(["iphlpapi", "ws2_32"])
-        else:
-            self.cpp_info.system_libs.append("pthread")
-
-        # TODO: to remove in conan v2 once cmake_find_package_* & pkg_config generators removed
-        self.cpp_info.filenames["cmake_find_package"] = "DBus1"
-        self.cpp_info.filenames["cmake_find_package_multi"] = "DBus1"
-        self.cpp_info.names["cmake_find_package"] = "dbus-1"
-        self.cpp_info.names["cmake_find_package_multi"] = "dbus-1"
-        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"] = "dbus-1"
diff --git a/recipes/dbus/1.x.x/patches/0001-cmake-project.patch b/recipes/dbus/1.x.x/patches/0001-cmake-project.patch
deleted file mode 100644
index 2d00f57d33527..0000000000000
--- a/recipes/dbus/1.x.x/patches/0001-cmake-project.patch
+++ /dev/null
@@ -1,23 +0,0 @@
---- 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/0002-cmake_configure_checks_list_separator.patch b/recipes/dbus/1.x.x/patches/0002-cmake_configure_checks_list_separator.patch
deleted file mode 100644
index 7c60bf52d5ec2..0000000000000
--- a/recipes/dbus/1.x.x/patches/0002-cmake_configure_checks_list_separator.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-diff --git a/cmake/ConfigureChecks.cmake b/cmake/ConfigureChecks.cmake
-index a9a5fc90..1a59461a 100644
---- a/cmake/ConfigureChecks.cmake
-+++ b/cmake/ConfigureChecks.cmake
-@@ -43,7 +43,7 @@ check_symbol_exists(backtrace    "execinfo.h"       HAVE_BACKTRACE)          #
- check_symbol_exists(getgrouplist "grp.h"            HAVE_GETGROUPLIST)       #  dbus-sysdeps.c
- check_symbol_exists(getpeerucred "ucred.h"          HAVE_GETPEERUCRED)       #  dbus-sysdeps.c, dbus-sysdeps-win.c
- check_symbol_exists(nanosleep    "time.h"           HAVE_NANOSLEEP)          #  dbus-sysdeps.c
--check_symbol_exists(getpwnam_r   "errno.h pwd.h"    HAVE_POSIX_GETPWNAM_R)   #  dbus-sysdeps-util-unix.c
-+check_symbol_exists(getpwnam_r   "errno.h;pwd.h"    HAVE_POSIX_GETPWNAM_R)   #  dbus-sysdeps-util-unix.c
- check_symbol_exists(setenv       "stdlib.h"         HAVE_SETENV)             #  dbus-sysdeps.c
- check_symbol_exists(unsetenv     "stdlib.h"         HAVE_UNSETENV)           #  dbus-sysdeps.c
- check_symbol_exists(clearenv     "stdlib.h"         HAVE_CLEARENV)           #  dbus-sysdeps.c
-@@ -66,7 +66,7 @@ check_symbol_exists(getrlimit    "sys/resource.h;sys/time.h" HAVE_GETRLIMIT)
- check_symbol_exists(prlimit      "sys/resource.h;sys/time.h" HAVE_PRLIMIT)
- check_symbol_exists(setrlimit    "sys/resource.h;sys/time.h" HAVE_SETRLIMIT)
- 
--check_struct_member(cmsgcred cmcred_pid "sys/types.h sys/socket.h" HAVE_CMSGCRED)   #  dbus-sysdeps.c
-+check_struct_member(cmsgcred cmcred_pid "sys/types.h;sys/socket.h" HAVE_CMSGCRED)   #  dbus-sysdeps.c
- 
- # missing:
- # DBUS_HAVE_GCC33_GCOV
diff --git a/recipes/dbus/1.x.x/test_package/conanfile.py b/recipes/dbus/1.x.x/test_package/conanfile.py
deleted file mode 100644
index 3cb242daa016f..0000000000000
--- a/recipes/dbus/1.x.x/test_package/conanfile.py
+++ /dev/null
@@ -1,27 +0,0 @@
-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):
-            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/all/conandata.yml b/recipes/dbus/all/conandata.yml
new file mode 100644
index 0000000000000..691acef617739
--- /dev/null
+++ b/recipes/dbus/all/conandata.yml
@@ -0,0 +1,29 @@
+sources:
+  "1.15.8":
+    url: "https://dbus.freedesktop.org/releases/dbus/dbus-1.15.8.tar.xz"
+    sha256: "84fc597e6ec82f05dc18a7d12c17046f95bad7be99fc03c15bc254c4701ed204"
+  "1.15.6":
+    url: "https://dbus.freedesktop.org/releases/dbus/dbus-1.15.6.tar.xz"
+    sha256: "f97f5845f9c4a5a1fb3df67dfa9e16b5a3fd545d348d6dc850cb7ccc9942bd8c"
+  "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"
+patches:
+  "1.15.8":
+    - patch_file: "patches/0001-meson-Use-check_header-to-confirm-headers-work.patch"
+      patch_type: "portability"
+      patch_description: "Fix build with Visual Studio 2022"
+      patch_source: "https://gitlab.freedesktop.org/dbus/dbus/-/merge_requests/454"
+  "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_description: "Fix detection of necessary monotonic clock functions in pthread"
+      patch_source: "https://gitlab.freedesktop.org/dbus/dbus/-/merge_requests/352"
diff --git a/recipes/dbus/all/conanfile.py b/recipes/dbus/all/conanfile.py
new file mode 100644
index 0000000000000..b8c7c6cfea6f9
--- /dev/null
+++ b/recipes/dbus/all/conanfile.py
@@ -0,0 +1,224 @@
+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, rename, replace_in_file, 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
+
+required_conan_version = ">=1.64.0 <2 || >=2.2.0"
+
+
+class DbusConan(ConanFile):
+    name = "dbus"
+    # license is AFL-2.1 OR GPL-2.0-or-later with several other compatible licenses for smaller sections of code
+    license = "(AFL-2.1 OR GPL-2.0-or-later) AND DocumentRef-COPYING"
+    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 = "bus", "interprocess", "message"
+    package_type = "library"
+    settings = "os", "arch", "compiler", "build_type"
+    short_paths = True
+    options = {
+        "shared": [True, False],
+        "fPIC": [True, False],
+        "dbus_user": [None, "ANY"],
+        "message_bus": [True, False],
+        "system_socket": [None, "ANY"],
+        "system_pid_file": [None, "ANY"],
+        "with_x11": [True, False],
+        "with_systemd": [True, False],
+        "with_selinux": [True, False],
+        "session_socket_dir": [None, "ANY"],
+    }
+    default_options = {
+        "shared": False,
+        "fPIC": True,
+        "dbus_user": "messagebus",
+        "message_bus": False,
+        "system_socket": None,
+        "system_pid_file": None,
+        "with_x11": False,
+        "with_systemd": False,
+        "with_selinux": False,
+        "session_socket_dir": "/tmp",
+    }
+
+    @property
+    def _has_message_bus_option(self):
+        return Version(self.version) > "1.15.2"
+
+    def export_sources(self):
+        export_conandata_patches(self)
+
+    def config_options(self):
+        if self.settings.os not in ["Linux", "FreeBSD"]:
+            del self.options.with_systemd
+            del self.options.with_x11
+            del self.options.with_selinux
+        if self.settings.os == "Windows":
+            del self.options.fPIC
+        if not self._has_message_bus_option:
+            self.options.rm_safe("message_bus")
+
+    def configure(self):
+        self.settings.rm_safe("compiler.cppstd")
+        self.settings.rm_safe("compiler.libcxx")
+        if self.options.shared:
+            self.options.rm_safe("fPIC")
+        if not self.options.get_safe("message_bus"):
+            self.options.rm_safe("dbus_user")
+
+    def layout(self):
+        basic_layout(self, src_folder="src")
+
+    def requirements(self):
+        self.requires("expat/[>=2.6.2 <3]")
+        if self.options.get_safe("with_systemd"):
+            self.requires("libsystemd/253.6")
+        if self.options.get_safe("with_selinux"):
+            self.requires("libselinux/3.6")
+        if self.options.get_safe("with_x11"):
+            # X11 is only linked into an executable and should not be propagated as a library dependency.
+            # It should still be provided in a VirtualRunEnv context, though,
+            # but Conan as of v2.2 does not yet provide a fine-grained enough control over this.
+            self.requires("xorg/system", visible=False)
+
+    def package_id(self):
+        # The dbus_user option only effects the installation of dbus during the package method.
+        # Otherwise, it only appears in the system.conf file in the package.
+        self.info.options.rm_safe("dbus_user")
+
+    def validate(self):
+        if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < 7:
+            raise ConanInvalidConfiguration(f"{self.ref} requires at least gcc 7.")
+
+    def build_requirements(self):
+        self.tool_requires("meson/1.4.0")
+        if not self.conf.get("tools.gnu:pkg_config",check_type=str):
+            self.tool_requires("pkgconf/2.1.0")
+
+    def source(self):
+        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["asserts"] = not is_apple_os(self)
+        tc.project_options["checks"] = False
+        tc.project_options["datadir"] = os.path.join("res", "share")
+        tc.project_options["sysconfdir"] = os.path.join("res", "etc")
+        tc.project_options["doxygen_docs"] = "disabled"
+        tc.project_options["ducktype_docs"] = "disabled"
+        tc.project_options["qt_help"] = "disabled"
+        tc.project_options["modular_tests"] = "disabled"
+        tc.project_options["selinux"] = "enabled" if self.options.get_safe("with_selinux") else "disabled"
+        if self.options.session_socket_dir:
+            tc.project_options["session_socket_dir"] = str(self.options.session_socket_dir)
+        tc.project_options["systemd"] = "enabled" if self.options.get_safe("with_systemd") else "disabled"
+        if self.options.get_safe("with_systemd"):
+            tc.project_options["systemd_system_unitdir"] = "/res/lib/systemd/system"
+            tc.project_options["systemd_user_unitdir"] = "/res/usr/lib/systemd/system"
+        if self._has_message_bus_option:
+            tc.project_options["message_bus"] = bool(self.options.message_bus)
+        if self.options.get_safe("dbus_user"):
+            tc.project_options["dbus_user"] = str(self.options.dbus_user)
+        if self.options.system_pid_file:
+            tc.project_options["system_pid_file"] = str(self.options.system_pid_file)
+        if self.options.system_socket:
+            tc.project_options["system_socket"] = str(self.options.system_socket)
+        if is_apple_os(self):
+            tc.project_options["launchd_agent_dir"] = os.path.join("res", "LaunchAgents")
+        tc.project_options["x11_autolaunch"] = "enabled" if self.options.get_safe("with_x11") else "disabled"
+        tc.project_options["xml_docs"] = "disabled"
+        tc.generate()
+        deps = PkgConfigDeps(self)
+        deps.generate()
+
+    def _patch_sources(self):
+        apply_conandata_patches(self)
+        replace_in_file(self, os.path.join(self.source_folder, "meson.build"),
+                        "subdir('test')", "# subdir('test')")
+
+    def build(self):
+        self._patch_sources()
+        meson = Meson(self)
+        meson.configure()
+        meson.build()
+
+    def package(self):
+        copy(self, "COPYING", self.source_folder, os.path.join(self.package_folder, "licenses"))
+        copy(self, "*", os.path.join(self.source_folder, "LICENSES"), 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, "res", "share", "doc"))
+
+        rmdir(self, os.path.join(self.package_folder, "lib", "cmake"))
+        rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))
+        fix_apple_shared_install_name(self)
+        if self.settings.os == "Windows" and not self.options.shared:
+            rename(self, os.path.join(self.package_folder, "lib", "libdbus-1.a"), os.path.join(self.package_folder, "lib", "dbus-1.lib"))
+
+        # 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),
+            {"dbus-1": "dbus-1::dbus-1"}
+        )
+
+    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", "DBus1")
+        self.cpp_info.set_property("cmake_target_name", "dbus-1")
+        self.cpp_info.set_property("pkg_config_name", "dbus-1")
+        self.cpp_info.includedirs.extend([
+            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")
+        if self.settings.os == "Windows":
+            self.cpp_info.system_libs.extend(["iphlpapi", "ws2_32"])
+        else:
+            self.cpp_info.system_libs.append("pthread")
+
+        if not self.options.shared:
+            self.cpp_info.defines.append("DBUS_STATIC_BUILD")
+
+        self.cpp_info.requires.append("expat::expat")
+        if self.options.get_safe("with_systemd"):
+            self.cpp_info.requires.append("libsystemd::libsystemd")
+        if self.options.get_safe("with_selinux"):
+            self.cpp_info.requires.append("libselinux::selinux")
+
+        # TODO: to remove in conan v2 once cmake_find_package_* & pkg_config generators removed
+        self.cpp_info.filenames["cmake_find_package"] = "DBus1"
+        self.cpp_info.filenames["cmake_find_package_multi"] = "DBus1"
+        self.cpp_info.names["cmake_find_package"] = "dbus-1"
+        self.cpp_info.names["cmake_find_package_multi"] = "dbus-1"
+        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"] = "dbus-1"
diff --git a/recipes/dbus/all/patches/0001-meson-Use-check_header-to-confirm-headers-work.patch b/recipes/dbus/all/patches/0001-meson-Use-check_header-to-confirm-headers-work.patch
new file mode 100755
index 0000000000000..6c048934702b3
--- /dev/null
+++ b/recipes/dbus/all/patches/0001-meson-Use-check_header-to-confirm-headers-work.patch
@@ -0,0 +1,46 @@
+From e52ccaf7c3abf9d0adccfd001c1417ce08a7f335 Mon Sep 17 00:00:00 2001
+From: Thomas Sondergaard 
+Date: Thu, 4 Jan 2024 17:45:46 +0100
+Subject: [PATCH] meson: Use check_header to confirm headers work
+
+instead of using has_header use check_header to confirm the header
+works. This is necessary to get the meson build to work with Visual
+Studio 2022. It has  but it does not actually work when
+compiling a C program. A minimal C program that include 
+fails with the following errors:
+
+    C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.38.33130\include\vcruntime_c11_stdatomic.h(36): error C2061: syntax error: identifier 'atomic_bool'
+    C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.38.33130\include\vcruntime_c11_stdatomic.h(36): error C2059: syntax error: ';'
+    C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.38.33130\include\vcruntime_c11_stdatomic.h(37): error C2061: syntax error: identifier 'atomic_char'
+    C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.38.33130\include\vcruntime_c11_stdatomic.h(37): error C2059: syntax error: ';'
+    ...
+    ...
+
+check_header is consistent with CMake's
+
+    check_include_file(stdatomic.h  HAVE_STDATOMIC_H)
+
+which is why the CMake-based build of dbus works with Visual Studio
+2022, while the meson build doesn't.
+
+Fixes #494
+---
+ meson.build | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/meson.build b/meson.build
+index 17b2a837..19b41cd9 100644
+--- a/meson.build
++++ b/meson.build
+@@ -705,7 +705,7 @@ check_headers = [
+ 
+ foreach header : check_headers
+     macro = 'HAVE_' + header.underscorify().to_upper()
+-    config.set(macro, cc.has_header(header, args: compile_args_c) ? 1 : false)
++    config.set(macro, cc.check_header(header, args: compile_args_c) ? 1 : false)
+ endforeach
+ 
+ execinfo = cc.find_library('execinfo', required: false)
+-- 
+2.43.0.windows.1
+
diff --git a/recipes/dbus/1.x.x/patches/0003-meson-monotonic-clock-check.patch b/recipes/dbus/all/patches/0003-meson-monotonic-clock-check.patch
similarity index 100%
rename from recipes/dbus/1.x.x/patches/0003-meson-monotonic-clock-check.patch
rename to recipes/dbus/all/patches/0003-meson-monotonic-clock-check.patch
diff --git a/recipes/dbus/1.x.x/test_package/CMakeLists.txt b/recipes/dbus/all/test_package/CMakeLists.txt
similarity index 100%
rename from recipes/dbus/1.x.x/test_package/CMakeLists.txt
rename to recipes/dbus/all/test_package/CMakeLists.txt
diff --git a/recipes/dbus/all/test_package/conanfile.py b/recipes/dbus/all/test_package/conanfile.py
new file mode 100644
index 0000000000000..da65c0176861b
--- /dev/null
+++ b/recipes/dbus/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, run=True)
+
+    def build(self):
+        cmake = CMake(self)
+        cmake.configure()
+        cmake.build()
+
+    def test(self):
+        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_package/test_package.c b/recipes/dbus/all/test_package/test_package.c
similarity index 100%
rename from recipes/dbus/1.x.x/test_package/test_package.c
rename to recipes/dbus/all/test_package/test_package.c
diff --git a/recipes/soundtouch/all/test_v1_package/CMakeLists.txt b/recipes/dbus/all/test_v1_package/CMakeLists.txt
similarity index 100%
rename from recipes/soundtouch/all/test_v1_package/CMakeLists.txt
rename to recipes/dbus/all/test_v1_package/CMakeLists.txt
diff --git a/recipes/dbus/1.x.x/test_v1_package/conanfile.py b/recipes/dbus/all/test_v1_package/conanfile.py
similarity index 100%
rename from recipes/dbus/1.x.x/test_v1_package/conanfile.py
rename to recipes/dbus/all/test_v1_package/conanfile.py
diff --git a/recipes/dbus/config.yml b/recipes/dbus/config.yml
index cc866e2f4cf3b..e3b8080de35a7 100644
--- a/recipes/dbus/config.yml
+++ b/recipes/dbus/config.yml
@@ -1,9 +1,9 @@
 versions:
+  "1.15.8":
+    folder: all
+  "1.15.6":
+    folder: all
   "1.15.2":
-    folder: 1.x.x
+    folder: all
   "1.15.0":
-    folder: 1.x.x
-  "1.14.0":
-    folder: 1.x.x
-  "1.12.20":
-    folder: 1.x.x
+    folder: all
diff --git a/recipes/dcmtk/all/CMakeLists.txt b/recipes/dcmtk/all/CMakeLists.txt
deleted file mode 100644
index 56b7606e716f9..0000000000000
--- a/recipes/dcmtk/all/CMakeLists.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-cmake_minimum_required(VERSION 3.0)
-project(cmake_wrapper)
-
-include(conanbuildinfo.cmake)
-conan_basic_setup(TARGETS KEEP_RPATHS)
-
-add_subdirectory(source_subfolder)
diff --git a/recipes/dcmtk/all/conandata.yml b/recipes/dcmtk/all/conandata.yml
index 3d3f43928861f..db05530c82900 100644
--- a/recipes/dcmtk/all/conandata.yml
+++ b/recipes/dcmtk/all/conandata.yml
@@ -1,14 +1,38 @@
 sources:
-  "3.6.6":
-    url: "https://dicom.offis.de/download/dcmtk/dcmtk366/dcmtk-3.6.6.tar.gz"
-    sha256: "6859c62b290ee55677093cccfd6029c04186d91cf99c7642ae43627387f3458e"
-  "3.6.5":
-    url: "https://dicom.offis.de/download/dcmtk/dcmtk365/dcmtk-3.6.5.tar.gz"
-    sha256: "a05178665f21896dbb0974106dba1ad144975414abd760b4cf8f5cc979f9beb9"
+  "3.6.8":
+    url: "https://dicom.offis.de/download/dcmtk/dcmtk368/dcmtk-3.6.8.tar.gz"
+    sha256: "232076655503138debf2f624109f1799e539354f186ce4e04b27cf82a9d8720f"
+  "3.6.7":
+    url: "https://dicom.offis.de/download/dcmtk/dcmtk367/dcmtk-3.6.7.tar.gz"
+    sha256: "7c58298e3e8d60232ee6fc8408cfadd14463cc11a3c4ca4c59af5988c7e9710a"
 patches:
-  "3.6.6":
-    - patch_file: "patches/0002-cmake-use-conan-packages.patch"
-      base_path: "source_subfolder"
-  "3.6.5":
-    - patch_file: "patches/0001-cmake-use-conan-packages.patch"
-      base_path: "source_subfolder"
+  "3.6.8":
+    - patch_file: "patches/3.6.8-0001-cmake-robust-deps-handling.patch"
+      patch_description: "CMake: robust discovery with find_package() and use imported targets"
+      patch_type: conan
+    - patch_file: "patches/3.6.8-0002-cmake-check-openssl-symbol.patch"
+      patch_description: "CMake: fix OpenSSL compatibility checks"
+      patch_type: conan
+    - patch_file: "patches/3.6.8-0003-fix-two-segmentation-faults.patch"
+      patch_description: "Fix CVE-2024-34508 and CVE-2024-34509 (SEGFAULT from malformed C-Store request)"
+      patch_type: vulnerability
+      patch_source: "https://github.com/DCMTK/dcmtk/commit/c78e434c0c5f9d932874f0b17a8b4ce305ca01f5"
+    - patch_file: "patches/3.6.8-0004-disable-oficonv-passthrough.patch"
+      patch_description: "Fix data corruption in UTF8-to-UTF8 conversion"
+      patch_type: bugfix
+      patch_source: "https://github.com/DCMTK/dcmtk/commit/8ccfd5a07024e50b160da0231524da535c745b79"
+  "3.6.7":
+    - patch_file: "patches/3.6.7-0001-cmake-robust-deps-handling.patch"
+      patch_description: "CMake: robust discovery with find_package() and use imported targets"
+      patch_type: conan
+    - patch_file: "patches/3.6.7-0002-cmake-check-openssl-symbol.patch"
+      patch_description: "CMake: fix OpenSSL compatibility checks"
+      patch_type: conan
+    - patch_file: "patches/3.6.7-0003-ambiguous-overload-operator-equal.patch"
+      patch_description: "C++20: Fix ambiguous overload for operator== between DB_SerializedTagKey and DcmTagKey"
+      patch_type: portability
+      patch_source: "https://github.com/DCMTK/dcmtk/pull/88"
+    - patch_file: "patches/3.6.7-0004-fix-two-segmentation-faults.patch"
+      patch_description: "Fix CVE-2024-34508 and CVE-2024-34509 (SEGFAULT from malformed C-Store request)"
+      patch_type: vulnerability
+      patch_source: "https://github.com/DCMTK/dcmtk/commit/c78e434c0c5f9d932874f0b17a8b4ce305ca01f5"
diff --git a/recipes/dcmtk/all/conanfile.py b/recipes/dcmtk/all/conanfile.py
index a22b5ac9d4a21..c8c4804f39f44 100644
--- a/recipes/dcmtk/all/conanfile.py
+++ b/recipes/dcmtk/all/conanfile.py
@@ -1,11 +1,15 @@
-from conan.tools.microsoft import msvc_runtime_flag
-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 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, replace_in_file, rename, rmdir, save
+from conan.tools.microsoft import is_msvc, is_msvc_static_runtime
+from conan.tools.scm import Version
+
+required_conan_version = ">=2.0"
 
 
 class DCMTKConan(ConanFile):
@@ -14,8 +18,8 @@ class DCMTKConan(ConanFile):
     url = "https://github.com/conan-io/conan-center-index"
     homepage = "https://dicom.offis.de/dcmtk"
     license = "BSD-3-Clause"
-    topics = ("dcmtk", "dicom", "image")
-
+    topics = ("dicom", "image")
+    package_type = "library"
     settings = "os", "arch", "compiler", "build_type"
     options = {
         "shared": [True, False],
@@ -29,10 +33,13 @@ class DCMTKConan(ConanFile):
         "with_libpng": [True, False],
         "with_libtiff": [True, False],
         "with_tcpwrappers": [True, False],
-        "builtin_dictionary": [None, True, False],
+        "default_dict": ["builtin", "external", "none"],
+        "builtin_dictionary": [None, True, False, "deprecated"],
+        "use_dcmdictpath": [True, False],
         "builtin_private_tags": [True, False],
-        "external_dictionary": [None, True, False],
+        "external_dictionary": [None, True, False, "deprecated"],
         "wide_io": [True, False],
+        "enable_stl": [True, False],
     }
     default_options = {
         "shared": False,
@@ -46,175 +53,247 @@ class DCMTKConan(ConanFile):
         "with_libpng": True,
         "with_libtiff": True,
         "with_tcpwrappers": False,
-        "builtin_dictionary": None,
+        "default_dict": "external",
+        "builtin_dictionary": "deprecated",
+        "use_dcmdictpath": True,
         "builtin_private_tags": False,
-        "external_dictionary": None,
+        "external_dictionary": "deprecated",
         "wide_io": False,
+        "enable_stl": True,
     }
 
-    generators = "cmake", "cmake_find_package"
-
-    @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)
+        copy(self, "*.h", os.path.join(self.recipe_folder, "crossbuild"), os.path.join(self.export_sources_folder, "src"))
 
     def config_options(self):
         if self.settings.os == "Windows":
-            del self.options.fPIC
-            del self.options.with_tcpwrappers
+            self.options.rm_safe("fPIC")
+            self.options.rm_safe("with_tcpwrappers")
+            self.options.default_dict = "builtin"
 
     def configure(self):
         if self.options.shared:
-            del self.options.fPIC
+            self.options.rm_safe("fPIC")
+        # Deprecated options
+        if self.options.builtin_dictionary != "deprecated":
+            self.output.warning("builtin_dictionary option is deprecated. Use default_dict option instead.")
+            if self.options.builtin_dictionary:
+                self.options.default_dict = "builtin"
+            elif self.options.builtin_dictionary == False:
+                self.options.default_dict = "external"
+        if self.options.external_dictionary != "deprecated":
+            self.output.warning("external_dictionary option is deprecated. Use use_dcmdictpath option instead.")
+            if self.options.external_dictionary:
+                self.options.use_dcmdictpath = True
+            elif self.options.external_dictionary == False:
+                self.options.use_dcmdictpath = False
+
+    def layout(self):
+        cmake_layout(self, src_folder="src")
 
     def requirements(self):
         if self.options.charset_conversion == "libiconv":
-            self.requires("libiconv/1.16")
+            self.requires("libiconv/1.17")
         elif self.options.charset_conversion == "icu":
-            self.requires("icu/71.1")
+            self.requires("icu/73.2")
         if self.options.with_libxml2:
-            self.requires("libxml2/2.9.13")
+            self.requires("libxml2/[2.12.5 <3]")
         if self.options.with_zlib:
-            self.requires("zlib/1.2.12")
+            self.requires("zlib/[>=1.2.11 <2]")
         if self.options.with_openssl:
-            if self.settings.os == "Windows":
-                # FIXME: CMake configuration fails to detect Openssl 1.1 on Windows.
-                self.requires("openssl/1.0.2u")
-            else:
-                self.requires("openssl/1.1.1n")
+            self.requires("openssl/[>=1 <4]")
         if self.options.with_libpng:
-            self.requires("libpng/1.6.37")
+            self.requires("libpng/[>=1.6 <2]")
         if self.options.with_libtiff:
-            self.requires("libtiff/4.3.0")
+            self.requires("libtiff/4.6.0")
         if self.options.get_safe("with_tcpwrappers"):
             self.requires("tcp-wrappers/7.6")
 
+    def package_id(self):
+        # Deprecated options don't contribute to package id
+        del self.info.options.builtin_dictionary
+        del self.info.options.external_dictionary
+
+    def validate_build(self):
+        if cross_building(self):
+            if self.settings.os == "Macos" and self.settings.arch != "x86_64":
+                raise ConanInvalidConfiguration("MacOS crossbuilding is only supported to target x86_64")
+            else:
+                # Note: other cross-building scenarios have not been tested and may also need to be marked as invalid
+                self.output.warning("Crossbuilding has not been tested and may not work. Please report to Conan Center Index if you find any issues.")
+
     def validate(self):
-        if hasattr(self, "settings_build") and tools.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)")
+        check_min_cppstd(self, 11)
 
     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)
+        get(self, **self.conan_data["sources"][self.version], strip_root=True)
 
+    def generate(self):
+        tc = CMakeToolchain(self)
         # DICOM Data Dictionaries are required
-        cmake.definitions["CMAKE_INSTALL_DATADIR"] = self._dcm_datadictionary_path
-
-        cmake.definitions["BUILD_APPS"] = self.options.with_applications
-        cmake.definitions["DCMTK_WITH_ICONV"] = self.options.charset_conversion == "libiconv"
-        if self.options.charset_conversion == "libiconv":
-            cmake.definitions["WITH_LIBICONVINC"] = self.deps_cpp_info["libiconv"].rootpath
-        cmake.definitions["DCMTK_WITH_ICU"] = self.options.charset_conversion == "icu"
-        cmake.definitions["DCMTK_WITH_OPENJPEG"] = False
-        cmake.definitions["DCMTK_WITH_OPENSSL"] = self.options.with_openssl
-        if self.options.with_openssl:
-            cmake.definitions["WITH_OPENSSLINC"] = self.deps_cpp_info["openssl"].rootpath
-        cmake.definitions["DCMTK_WITH_PNG"] = self.options.with_libpng
-        if self.options.with_libpng:
-            cmake.definitions["WITH_LIBPNGINC"] = self.deps_cpp_info["libpng"].rootpath
-        cmake.definitions["DCMTK_WITH_SNDFILE"] = False
-        cmake.definitions["DCMTK_WITH_THREADS"] = self.options.with_multithreading
-        cmake.definitions["DCMTK_WITH_TIFF"] = self.options.with_libtiff
-        if self.options.with_libtiff:
-            cmake.definitions["WITH_LIBTIFFINC"] = self.deps_cpp_info["libtiff"].rootpath
+        tc.variables["CMAKE_INSTALL_DATADIR"] = self._dcm_datadictionary_path.replace("\\", "/")
+        tc.cache_variables["DCMTK_USE_FIND_PACKAGE"] = True
+        tc.variables["BUILD_APPS"] = self.options.with_applications
+        tc.variables["DCMTK_WITH_TIFF"] = self.options.with_libtiff
+        tc.variables["DCMTK_WITH_PNG"] = self.options.with_libpng
+        tc.variables["DCMTK_WITH_XML"] = self.options.with_libxml2
+        tc.variables["DCMTK_WITH_ZLIB"] = self.options.with_zlib
+        tc.variables["DCMTK_WITH_OPENSSL"] = self.options.with_openssl
+        tc.variables["DCMTK_WITH_SNDFILE"] = False # not used at all, do not try to add an option for this one
+        tc.variables["DCMTK_WITH_ICONV"] = self.options.charset_conversion == "libiconv"
+        tc.variables["DCMTK_WITH_ICU"] = self.options.charset_conversion == "icu"
         if self.settings.os != "Windows":
-            cmake.definitions["DCMTK_WITH_WRAP"] = self.options.with_tcpwrappers
-        cmake.definitions["DCMTK_WITH_XML"] = self.options.with_libxml2
-        if self.options.with_libxml2:
-            cmake.definitions["WITH_LIBXMLINC"] = self.deps_cpp_info["libxml2"].rootpath
-            cmake.definitions["WITH_LIBXML_SHARED"] = self.options["libxml2"].shared
-        cmake.definitions["DCMTK_WITH_ZLIB"] = self.options.with_zlib
-        if self.options.with_zlib:
-            cmake.definitions["WITH_ZLIBINC"] = self.deps_cpp_info["zlib"].rootpath
-
-        cmake.definitions["DCMTK_ENABLE_STL"] = "ON"
-        cmake.definitions["DCMTK_ENABLE_CXX11"] = True
-
-        cmake.definitions["DCMTK_ENABLE_MANPAGE"] = False
-        cmake.definitions["DCMTK_WITH_DOXYGEN"] = False
-
-        cmake.definitions["DCMTK_ENABLE_PRIVATE_TAGS"] = self.options.builtin_private_tags
-        if self.options.external_dictionary is not None:
-            cmake.definitions["DCMTK_ENABLE_EXTERNAL_DICTIONARY"] = self.options.external_dictionary
-        if self.options.builtin_dictionary is not None:
-            cmake.definitions["DCMTK_ENABLE_BUILTIN_DICTIONARY"] = self.options.builtin_dictionary
-        cmake.definitions["DCMTK_WIDE_CHAR_FILE_IO_FUNCTIONS"] = self.options.wide_io
-        cmake.definitions["DCMTK_WIDE_CHAR_MAIN_FUNCTION"] = self.options.wide_io
-
+            tc.variables["DCMTK_WITH_WRAP"] = self.options.with_tcpwrappers
+        tc.variables["DCMTK_WITH_OPENJPEG"] = False # not used at all, do not try to add an option for this one
+        tc.variables["DCMTK_ENABLE_PRIVATE_TAGS"] = self.options.builtin_private_tags
+        tc.variables["DCMTK_WITH_THREADS"] = self.options.with_multithreading
+        tc.variables["DCMTK_WITH_DOXYGEN"] = False
+        tc.variables["DCMTK_WIDE_CHAR_FILE_IO_FUNCTIONS"] = self.options.wide_io
+        tc.variables["DCMTK_WIDE_CHAR_MAIN_FUNCTION"] = self.options.wide_io
+        # Upstream CMakeLists really expects ON value and no other value (like TRUE) in its internal logic
+        # to enable STL features (see DCMTK_TEST_ENABLE_STL_FEATURE() function in CMake/GenerateDCMTKConfigure.cmake)
+        tc.variables["DCMTK_ENABLE_STL"] = "ON" if self.options.enable_stl else "OFF"
+        tc.variables["DCMTK_ENABLE_CXX11"] = True
+        tc.variables["DCMTK_ENABLE_MANPAGE"] = False
+        tc.cache_variables["DCMTK_DEFAULT_DICT"] = self.options.default_dict
+        if self.options.charset_conversion and Version(self.version) >= "3.6.8":
+            charset_conversion = { "libiconv": "libiconv", "icu": "ICU" }
+            tc.cache_variables["DCMTK_ENABLE_CHARSET_CONVERSION"] = charset_conversion[str(self.options.charset_conversion)]
+        tc.variables["DCMTK_USE_DCMDICTPATH"] = self.options.use_dcmdictpath
         if self.settings.os == "Windows":
-            cmake.definitions["DCMTK_OVERWRITE_WIN32_COMPILER_FLAGS"] = False
+            tc.variables["DCMTK_OVERWRITE_WIN32_COMPILER_FLAGS"] = False
+        if is_msvc(self):
+            tc.variables["DCMTK_ICONV_FLAGS_ANALYZED"] = True
+            tc.variables["DCMTK_COMPILE_WIN32_MULTITHREADED_DLL"] = not is_msvc_static_runtime(self)
+
+        if Version(self.version) >= "3.6.7" and cross_building(self):
+            # See https://support.dcmtk.org/redmine/projects/dcmtk/wiki/Cross_Compiling
+            tc.cache_variables["DCMTK_NO_TRY_RUN"] = True
+            if self.options.charset_conversion == "libiconv":
+                tc.cache_variables["DCMTK_ICONV_FLAGS_ANALYZED"] = True
+                tc.cache_variables["DCMTK_FIXED_ICONV_CONVERSION_FLAGS"] = "AbortTranscodingOnIllegalSequence"
+            if self.options.enable_stl:
+                # The recipe has C++11 as the minimum, and these should be available
+                # under that assumption
+                variables = ['HAVE_STL_VECTOR_TEST_RESULT', 'HAVE_STL_ALGORITHM_TEST_RESULT',
+                             'HAVE_STL_LIMITS_TEST_RESULT', 'HAVE_STL_LIST_TEST_RESULT', 'HAVE_STL_MAP_TEST_RESULT',
+                             'HAVE_STL_MEMORY_TEST_RESULT', 'HAVE_STL_STACK_TEST_RESULT',
+                             'HAVE_STL_STRING_TEST_RESULT', 'HAVE_STL_TYPE_TRAITS_TEST_RESULT',
+                             'HAVE_STL_TUPLE_TEST_RESULT', 'HAVE_STL_SYSTEM_ERROR_TEST_RESULT']
+                for var in variables:
+                    tc.cache_variables[var] = True
+            if self.settings.os == "Macos" and self.settings.arch == "x86_64":
+                dst_dir = os.path.join(self.build_folder, "config", "include", "dcmtk", "config")
+                arith_h = "arith_h_Macos_x86_64.h"
+                copy(self, arith_h, self.source_folder, dst_dir)
+                rename(self, os.path.join(dst_dir, arith_h), os.path.join(dst_dir, "arith.h"))
+           
+        tc.generate()
+
+        deps = CMakeDeps(self)
+        deps.generate()
+
+    def _collect_cmake_required(self, host_dependency):
+        """
+        Collect all compile & link flags of a host dependency so that they can be used in:
+          - CMAKE_REQUIRED_FLAGS
+          - CMAKE_REQUIRED_INCLUDES
+          - CMAKE_REQUIRED_DEFINITIONS
+          - CMAKE_REQUIRED_LINK_OPTIONS
+          - CMAKE_REQUIRED_LIBRARIES
+        These variables are listened by CMake functions like check_symbol_exists() etc
+        """
+        # Aggregate cpp_info of dependency and all its depencencies (direct and transitive)
+        dep = self.dependencies.host[host_dependency]
+        dep_cpp_info = dep.cpp_info.aggregated_components()
+        for _, trans_dep in dep.dependencies.items():
+            if trans_dep.context == "host":
+                dep_cpp_info.merge(trans_dep.cpp_info.aggregated_components())
+
+        dep_includes = [p.replace("\\", "/") for p in dep_cpp_info.includedirs]
+        libdirs_flag = "/LIBPATH:" if is_msvc(self) else "-L"
+        dep_libdirs = ["{}{}".format(libdirs_flag, p.replace("\\", "/")) for p in dep_cpp_info.libdirs]
+        dep_frameworks = [f"-framework {f}" for f in dep_cpp_info.frameworks]
 
-        if self._is_msvc:
-            cmake.definitions["DCMTK_ICONV_FLAGS_ANALYZED"] = True
-            cmake.definitions["DCMTK_COMPILE_WIN32_MULTITHREADED_DLL"] = "MD" in msvc_runtime_flag(self)
-
-        cmake.configure(build_folder=self._build_subfolder)
-        return cmake
+        return {
+            "flags": ";".join(dep_cpp_info.cflags + dep_cpp_info.cxxflags),
+            "includes": ";".join(dep_includes),
+            "definitions": ";".join(dep_cpp_info.defines),
+            "link_options": ";".join(dep_libdirs + dep_cpp_info.exelinkflags + dep_frameworks),
+            "libraries": ";".join(dep_cpp_info.libs + dep_cpp_info.system_libs),
+        }
 
     def _patch_sources(self):
-        for patch in self.conan_data.get("patches", {}).get(self.version, []):
-            tools.patch(**patch)
+        apply_conandata_patches(self)
+
+        # Workaround for CMakeDeps bug with check_* like functions.
+        # See https://github.com/conan-io/conan/issues/12012 & https://github.com/conan-io/conan/issues/12180
+        if self.options.with_openssl:
+            cmake_required = self._collect_cmake_required("openssl")
+            replace_in_file(
+                self,
+                os.path.join(self.source_folder, "CMake", "dcmtkPrepare.cmake"),
+                "set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${OPENSSL_LIBS} ${THREAD_LIBS})",
+                textwrap.dedent(f"""\
+                    list(APPEND CMAKE_REQUIRED_FLAGS "{cmake_required['flags']}")
+                    list(APPEND CMAKE_REQUIRED_INCLUDES "{cmake_required['includes']}")
+                    list(APPEND CMAKE_REQUIRED_DEFINITIONS "{cmake_required['definitions']}")
+                    list(APPEND CMAKE_REQUIRED_LINK_OPTIONS "{cmake_required['link_options']}")
+                    list(APPEND CMAKE_REQUIRED_LIBRARIES "{cmake_required['libraries']}")
+                """),
+            )
+
+        if self.options.charset_conversion == "libiconv":
+            cmake_required = self._collect_cmake_required("libiconv")
+            replace_in_file(
+                self,
+                os.path.join(self.source_folder, "CMake", "3rdparty.cmake"),
+                "set(CMAKE_REQUIRED_LIBRARIES ${LIBICONV_LIBS})",
+                textwrap.dedent(f"""\
+                    list(APPEND CMAKE_REQUIRED_FLAGS "{cmake_required['flags']}")
+                    list(APPEND CMAKE_REQUIRED_DEFINITIONS "{cmake_required['definitions']}")
+                    list(APPEND CMAKE_REQUIRED_LINK_OPTIONS "{cmake_required['link_options']}")
+                    list(APPEND CMAKE_REQUIRED_LIBRARIES "{cmake_required['libraries']}")
+                """),
+            )
 
     def build(self):
         self._patch_sources()
-        cmake = self._configure_cmake()
+        cmake = CMake(self)
+        cmake.configure()
         cmake.build()
 
     def package(self):
-        self.copy(pattern="COPYRIGHT", dst="licenses", src=self._source_subfolder)
-
-        cmake = self._configure_cmake()
+        copy(self, "COPYRIGHT", 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, "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, "etc"))
+        rmdir(self, 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"))
-        tools.rmdir(os.path.join(self.package_folder, "etc"))
-        tools.rmdir(os.path.join(self.package_folder, "share"))
-
+        # TODO: to remove once support of cmake_find_package* dropped
         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("""\
+            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 _dcmtk_components(self):
@@ -241,9 +320,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"
-
-        return {
+        components = {
             "ofstd"   : charset_conversion(),
             "oflog"   : ["ofstd"],
             "dcmdata" : ["ofstd", "oflog"] + zlib(),
@@ -254,8 +331,8 @@ def xml2():
             "ijg8"    : [],
             "ijg12"   : [],
             "ijg16"   : [],
-            "dcmjpls" : ["ofstd", "oflog", "dcmdata", "dcmimgle", "dcmimage", charls],
-            charls    : ["ofstd", "oflog"],
+            "dcmjpls" : ["ofstd", "oflog", "dcmdata", "dcmimgle", "dcmimage", "dcmtkcharls"],
+            "dcmtkcharls": ["ofstd", "oflog"],
             "dcmtls"  : ["ofstd", "dcmdata", "dcmnet"] + openssl(),
             "dcmnet"  : ["ofstd", "oflog", "dcmdata"] + tcpwrappers(),
             "dcmsr"   : ["ofstd", "oflog", "dcmdata", "dcmimgle", "dcmimage"] + xml2(),
@@ -270,7 +347,15 @@ def xml2():
             "dcmseg"  : ["dcmfg", "dcmiod", "dcmdata", "ofstd", "oflog"],
             "dcmtract": ["dcmiod", "dcmdata", "ofstd", "oflog"],
             "dcmpmap" : ["dcmfg", "dcmiod", "dcmdata", "ofstd", "oflog"],
+            "dcmect"  : ["dcmfg", "dcmiod", "dcmdata", "ofstd", "oflog"],
         }
+        if Version(self.version) >= "3.6.8":
+            components["dcmxml"] = ["dcmdata", "ofstd", "oflog"] + zlib() + xml2()
+            components["oficonv"] = []
+            components["dcmpstat"] += ["dcmiod"]
+            components["i2d"] += ["dcmxml"]
+            components["ofstd"] += ["oficonv"]
+        return components
 
     @property
     def _dcm_datadictionary_path(self):
@@ -280,41 +365,36 @@ def package_info(self):
         self.cpp_info.set_property("cmake_find_mode", "both")
         self.cpp_info.set_property("cmake_file_name", "DCMTK")
 
-        self.cpp_info.names["cmake_find_package"] = "DCMTK"
-        self.cpp_info.names["cmake_find_package_multi"] = "DCMTK"
-
-        def register_components(components):
-            for target_lib, requires in components.items():
-                self.cpp_info.components[target_lib].set_property("cmake_target_name", target_lib)
-                self.cpp_info.components[target_lib].libs = [target_lib]
-                self.cpp_info.components[target_lib].includedirs.append(os.path.join("include", "dcmtk"))
-                self.cpp_info.components[target_lib].requires = requires
-
-                # TODO: to remove in conan v2 once cmake_find_package* 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].builddirs.append(self._module_subfolder)
-                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.settings.os == "Windows":
-                self.cpp_info.components["ofstd"].system_libs.extend([
-                    "iphlpapi", "ws2_32", "netapi32", "wsock32"
-                ])
-            elif self.settings.os in ["Linux", "FreeBSD"]:
-                self.cpp_info.components["ofstd"].system_libs.append("m")
-                if self.options.with_multithreading:
-                    self.cpp_info.components["ofstd"].system_libs.append("pthread")
-
-        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.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.env_info.PATH.append(bin_path)
+        for target_lib, requires in self._dcmtk_components.items():
+            self.cpp_info.components[target_lib].set_property("cmake_target_name", f"DCMTK::{target_lib}")
+            # Before 3.6.7, targets were not namespaced, therefore they are also exposed for convenience
+            self.cpp_info.components[target_lib].set_property("cmake_target_aliases", [target_lib])
+
+            self.cpp_info.components[target_lib].libs = [target_lib]
+            self.cpp_info.components[target_lib].includedirs.append(os.path.join("include", "dcmtk"))
+            self.cpp_info.components[target_lib].requires = requires
+
+            if is_msvc(self):
+                # Required for the __cplusplus check at
+                # https://github.com/DCMTK/dcmtk/blob/DCMTK-3.6.8/config/include/dcmtk/config/osconfig.h.in#L1489
+                self.cpp_info.components[target_lib].cxxflags.append("/Zc:__cplusplus")
+
+        system_libs = []
+        if self.settings.os == "Windows":
+            system_libs = ["iphlpapi", "ws2_32", "netapi32", "wsock32"]
+        elif self.settings.os in ["Linux", "FreeBSD"]:
+            system_libs = ["m", "nsl"]
+            if self.options.with_multithreading:
+                system_libs.append("pthread")
+            if Version(self.version) >= "3.6.8":
+                system_libs.append("rt")
+        if Version(self.version) >= "3.6.8":
+            self.cpp_info.components["oficonv"].system_libs = system_libs
+        else:
+            self.cpp_info.components["ofstd"].system_libs = system_libs
+
+        if self.options.default_dict == "external":
+            dcmdictpath = os.path.join(self._dcm_datadictionary_path, "dcmtk", "dicom.dic")
+            self.runenv_info.define_path("DCMDICTPATH", dcmdictpath)
+            if self.options.with_applications:
+                self.buildenv_info.define_path("DCMDICTPATH", dcmdictpath)
diff --git a/recipes/dcmtk/all/crossbuild/arith_h_Macos_x86_64.h b/recipes/dcmtk/all/crossbuild/arith_h_Macos_x86_64.h
new file mode 100644
index 0000000000000..e52386cfbaf82
--- /dev/null
+++ b/recipes/dcmtk/all/crossbuild/arith_h_Macos_x86_64.h
@@ -0,0 +1,58 @@
+#ifndef CONFIG_ARITH_H
+#define CONFIG_ARITH_H
+
+#define DCMTK_SIGNED_CHAR_DIGITS10 2
+#define DCMTK_UNSIGNED_CHAR_DIGITS10 2
+#define DCMTK_SIGNED_SHORT_DIGITS10 4
+#define DCMTK_UNSIGNED_SHORT_DIGITS10 4
+#define DCMTK_SIGNED_INT_DIGITS10 9
+#define DCMTK_UNSIGNED_INT_DIGITS10 9
+#define DCMTK_SIGNED_LONG_DIGITS10 18
+#define DCMTK_UNSIGNED_LONG_DIGITS10 19
+#define DCMTK_FLOAT_MAX_DIGITS10 9
+#define DCMTK_DOUBLE_MAX_DIGITS10 17
+#define DCMTK_CHAR_TRAPS OFTrue
+#define DCMTK_CHAR_MODULO OFTrue
+#define DCMTK_SIGNED_CHAR_TRAPS OFTrue
+#define DCMTK_SIGNED_CHAR_MODULO OFTrue
+#define DCMTK_UNSIGNED_CHAR_TRAPS OFTrue
+#define DCMTK_UNSIGNED_CHAR_MODULO OFTrue
+#define DCMTK_SIGNED_SHORT_TRAPS OFTrue
+#define DCMTK_SIGNED_SHORT_MODULO OFTrue
+#define DCMTK_UNSIGNED_SHORT_TRAPS OFTrue
+#define DCMTK_UNSIGNED_SHORT_MODULO OFTrue
+#define DCMTK_SIGNED_INT_TRAPS OFTrue
+#define DCMTK_SIGNED_INT_MODULO OFTrue
+#define DCMTK_UNSIGNED_INT_TRAPS OFTrue
+#define DCMTK_UNSIGNED_INT_MODULO OFTrue
+#define DCMTK_SIGNED_LONG_TRAPS OFTrue
+#define DCMTK_SIGNED_LONG_MODULO OFTrue
+#define DCMTK_UNSIGNED_LONG_TRAPS OFTrue
+#define DCMTK_UNSIGNED_LONG_MODULO OFTrue
+#define DCMTK_FLOAT_TRAPS OFFalse
+#define DCMTK_DOUBLE_TRAPS OFFalse
+#define DCMTK_FLOAT_HAS_INFINITY OFTrue
+#define DCMTK_FLOAT_INFINITY *OFreinterpret_cast( const float*, "\000\000\200\177" )
+#define DCMTK_DOUBLE_HAS_INFINITY OFTrue
+#define DCMTK_DOUBLE_INFINITY *OFreinterpret_cast( const double*, "\000\000\000\000\000\000\360\177" )
+#define DCMTK_FLOAT_HAS_QUIET_NAN OFTrue
+#define DCMTK_FLOAT_QUIET_NAN *OFreinterpret_cast( const float*, "\000\000\300\177" )
+#define DCMTK_DOUBLE_HAS_QUIET_NAN OFTrue
+#define DCMTK_DOUBLE_QUIET_NAN *OFreinterpret_cast( const double*, "\000\000\000\000\000\000\370\177" )
+#define DCMTK_FLOAT_HAS_SIGNALING_NAN OFFalse
+#define DCMTK_FLOAT_SIGNALING_NAN *OFreinterpret_cast( const float*, "\001\000\200\177" )
+#define DCMTK_DOUBLE_HAS_SIGNALING_NAN OFFalse
+#define DCMTK_DOUBLE_SIGNALING_NAN *OFreinterpret_cast( const double*, "\001\000\000\000\000\000\360\177" )
+#define DCMTK_FLOAT_IS_IEC559 OFFalse
+#define DCMTK_DOUBLE_IS_IEC559 OFFalse
+#define DCMTK_FLOAT_HAS_DENORM OFdenorm_present
+#define DCMTK_FLOAT_DENORM_MIN *OFreinterpret_cast( const float*, "\001\000\000\000" )
+#define DCMTK_DOUBLE_HAS_DENORM OFdenorm_present
+#define DCMTK_DOUBLE_DENORM_MIN *OFreinterpret_cast( const double*, "\001\000\000\000\000\000\000\000" )
+#define DCMTK_FLOAT_TINYNESS_BEFORE OFTrue
+#define DCMTK_DOUBLE_TINYNESS_BEFORE OFTrue
+#define DCMTK_FLOAT_HAS_DENORM_LOSS OFTrue
+#define DCMTK_DOUBLE_HAS_DENORM_LOSS OFTrue
+#define DCMTK_ROUND_STYLE 1
+
+#endif // CONFIG_ARITH_H
diff --git a/recipes/dcmtk/all/patches/0001-cmake-use-conan-packages.patch b/recipes/dcmtk/all/patches/0001-cmake-use-conan-packages.patch
deleted file mode 100644
index 0e7d266d097c2..0000000000000
--- a/recipes/dcmtk/all/patches/0001-cmake-use-conan-packages.patch
+++ /dev/null
@@ -1,253 +0,0 @@
---- a/CMake/3rdparty.cmake
-+++ b/CMake/3rdparty.cmake
-@@ -40,13 +40,15 @@ if(WIN32 AND NOT MINGW)
-   # libxml support: configure compiler
-   if(DCMTK_WITH_XML)
-     if(WITH_LIBXMLINC)
--      set(LIBXML_INCDIR "${WITH_LIBXMLINC}/include")
--      set(LIBXML_LIBDIR "${WITH_LIBXMLINC}/lib")
--      set(LIBXML_LIBS debug "${LIBXML_LIBDIR}/libxml2_d.lib" optimized "${LIBXML_LIBDIR}/libxml2_o.lib" debug "${LIBXML_LIBDIR}/iconv_d.lib" optimized "${LIBXML_LIBDIR}/iconv_o.lib")
-+      set(LIBXML_INCDIR ${CONAN_INCLUDE_DIRS_LIBXML2} ${CONAN_INCLUDE_DIRS_ICONV})
-+      link_directories(${WITH_LIBXMLINC}/lib)
-+      set(LIBXML_LIBS ${CONAN_LIBS_LIBXML2})
-       message(STATUS "Info: DCMTK XML support will be enabled")
-       set(WITH_LIBXML 1)
-+      if(NOT WITH_LIBXML_SHARED)
-       # this hides some warnings that are emitted when linking against libxmlXXX.lib instead of linking the DLL directly
-       add_definitions("-DLIBXML_STATIC")
-+      endif()
-     else() # turn off library if library path not set
-       message(STATUS "Warning: XML support will be disabled because libxml2 directory is not specified. Correct path and re-enable DCMTK_WITH_XML.")
-       set(DCMTK_WITH_XML OFF CACHE BOOL "" FORCE)
-@@ -58,8 +60,8 @@ if(WIN32 AND NOT MINGW)
-   if(DCMTK_WITH_PNG)
-     if(WITH_LIBPNGINC)
-       set(LIBPNG_INCDIR "${WITH_LIBPNGINC}/include")
--      set(LIBPNG_LIBDIR "${WITH_LIBPNGINC}/lib")
--      set(LIBPNG_LIBS debug "${LIBPNG_LIBDIR}/libpng_d.lib" optimized "${LIBPNG_LIBDIR}/libpng_o.lib")
-+      link_directories(${WITH_LIBPNGINC}/lib)
-+      set(LIBPNG_LIBS CONAN_PKG::libpng)
-       message(STATUS "Info: DCMTK PNG support will be enabled")
-       set(WITH_LIBPNG 1)
-     else() # turn off library if library path not set
-@@ -73,8 +75,8 @@ if(WIN32 AND NOT MINGW)
-   if(DCMTK_WITH_TIFF)
-     if(WITH_LIBTIFFINC)
-       set(LIBTIFF_INCDIR "${WITH_LIBTIFFINC}/include")
--      set(LIBTIFF_LIBDIR "${WITH_LIBTIFFINC}/lib")
--      set(LIBTIFF_LIBS debug "${LIBTIFF_LIBDIR}/libtiff_d.lib" optimized "${LIBTIFF_LIBDIR}/libtiff_o.lib")
-+      link_directories(${WITH_LIBTIFFINC}/lib)
-+      set(LIBTIFF_LIBS CONAN_PKG::libtiff)
-       message(STATUS "Info: DCMTK TIFF support will be enabled")
-       set(WITH_LIBTIFF 1)
-     else() # turn off library if library path not set
-@@ -90,9 +92,9 @@ if(WIN32 AND NOT MINGW)
-       include(CheckCXXSourceCompiles)
-       set(OPENSSL_BINDIR "${WITH_OPENSSLINC}/bin")
-       set(OPENSSL_INCDIR "${WITH_OPENSSLINC}/include")
--      set(OPENSSL_LIBDIR "${WITH_OPENSSLINC}/lib")
-+      link_directories(${WITH_OPENSSLINC}/lib)
-       # starting with OpenSSL 1.1.0, the Windows crypt32 library is needed for a static link of OpenSSL.
--      set(OPENSSL_LIBS "crypt32" debug "${OPENSSL_LIBDIR}/dcmtkssl_d.lib" optimized "${OPENSSL_LIBDIR}/dcmtkssl_o.lib" debug "${OPENSSL_LIBDIR}/dcmtkcrypto_d.lib" optimized "${OPENSSL_LIBDIR}/dcmtkcrypto_o.lib")
-+      set(OPENSSL_LIBS ${CONAN_LIBS_OPENSSL})
-       set(TEMP_INCLUDES "${CMAKE_REQUIRED_INCLUDES}")
-       list(APPEND CMAKE_REQUIRED_INCLUDES "${OPENSSL_INCDIR}")
-       CHECK_CXX_SOURCE_COMPILES("extern \"C\" {\n#include \n}\nint main(){\n#if OPENSSL_VERSION_NUMBER < 0x10001000L\n#error OpenSSL too old\n#endif\n}\n" OPENSSL_VERSION_CHECK)
-@@ -116,8 +118,8 @@ if(WIN32 AND NOT MINGW)
-   if(DCMTK_WITH_ZLIB)
-     if(WITH_ZLIBINC)
-       set(ZLIB_INCDIR "${WITH_ZLIBINC}/include")
--      set(ZLIB_LIBDIR "${WITH_ZLIBINC}/lib")
--      set(ZLIB_LIBS debug "${ZLIB_LIBDIR}/zlib_d.lib" optimized "${ZLIB_LIBDIR}/zlib_o.lib")
-+      link_directories(${WITH_ZLIBINC}/lib)
-+      set(ZLIB_LIBS CONAN_PKG::zlib)
-       message(STATUS "Info: DCMTK ZLIB support will be enabled")
-       set(WITH_ZLIB 1)
-     else() # turn off library if library path not set
-@@ -131,8 +133,8 @@ if(WIN32 AND NOT MINGW)
-   if(DCMTK_WITH_SNDFILE)
-     if(WITH_SNDFILEINC)
-       set(SNDFILE_INCDIR "${WITH_SNDFILEINC}/include")
--      set(SNDFILE_LIBDIR "${WITH_SNDFILEINC}/lib")
--      set(SNDFILE_LIBS debug "${SNDFILE_LIBDIR}/libsndfile_d.lib" optimized "${SNDFILE_LIBDIR}/libsndfile_o.lib")
-+      link_directories(${WITH_SNDFILEINC}/lib)
-+      set(SNDFILE_LIBS CONAN_PKG::libsndfile)
-       message(STATUS "Info: DCMTK SNDFILE support will be enabled")
-       set(WITH_SNDFILE 1)
-     else() # turn off library if library path not set
-@@ -146,8 +148,8 @@ if(WIN32 AND NOT MINGW)
-   if(DCMTK_WITH_ICONV)
-     if(WITH_LIBICONVINC)
-       set(LIBICONV_INCDIR "${WITH_LIBICONVINC}/include")
--      set(LIBICONV_LIBDIR "${WITH_LIBICONVINC}/lib")
--      set(LIBICONV_LIBS debug "${LIBICONV_LIBDIR}/libiconv_d.lib" optimized "${LIBICONV_LIBDIR}/libiconv_o.lib")
-+      link_directories(${WITH_LIBICONVINC}/lib)
-+      set(LIBICONV_LIBS CONAN_PKG::libiconv)
-       message(STATUS "Info: DCMTK ICONV support will be enabled")
-       set(WITH_LIBICONV 1)
-     else() # turn off library if library path not set
-@@ -170,7 +172,7 @@ if(WIN32 AND NOT MINGW)
-       else()
-           set(OPENJPEG_INCDIR "${WITH_OPENJPEGINC1}")
-           set(OPENJPEG_LIBDIR "${WITH_OPENJPEGINC}/lib")
--          set(OPENJPEG_LIBS debug "${OPENJPEG_LIBDIR}/openjp2_d.lib" optimized "${OPENJPEG_LIBDIR}/openjp2_o.lib")
-+          set(OPENJPEG_LIBS CONAN_PKG::openjpeg)
-           message(STATUS "Info: DCMTK OpenJPEG support will be enabled")
-           set(WITH_OPENJPEG 1)
-       endif()
-@@ -185,7 +187,7 @@ else(WIN32 AND NOT MINGW)
- 
-   # Find TIFF
-   if(DCMTK_WITH_TIFF)
--    find_package(TIFF QUIET)
-+    find_package(TIFF REQUIRED)
-     # turn off library if it could not be found
-     if(NOT TIFF_FOUND)
-       message(STATUS "Warning: TIFF support will be disabled because libtiff was not found.")
-@@ -194,21 +196,21 @@ else(WIN32 AND NOT MINGW)
-     else()
-       set(WITH_LIBTIFF 1)
-       # libtiff can be compiled with libjpeg support; if available, add libjpeg to library and include path
--      find_package(JPEG QUIET)
-+      find_package(JPEG REQUIRED)
-       if(NOT JPEG_FOUND)
-         message(STATUS "Info: DCMTK TIFF support will be enabled (but without JPEG)")
--        include_directories(${TIFF_INCLUDE_DIR})
-+        include_directories(${TIFF_INCLUDE_DIRS})
-       else()
-         message(STATUS "Info: DCMTK TIFF support will be enabled")
--        include_directories(${TIFF_INCLUDE_DIR} ${JPEG_INCLUDE_DIR})
-+        include_directories(${TIFF_INCLUDE_DIRS} ${JPEG_INCLUDE_DIRS})
-       endif()
--      set(LIBTIFF_LIBS ${TIFF_LIBRARY} ${JPEG_LIBRARY})
-+      set(LIBTIFF_LIBS ${TIFF_LIBRARIES} ${JPEG_LIBRARIES})
-     endif()
-   endif()
- 
-   # Find PNG
-   if(DCMTK_WITH_PNG)
--    find_package(PNG QUIET)
-+    find_package(PNG REQUIRED)
-     if(NOT PNG_FOUND)
-       set(DCMTK_WITH_PNG OFF CACHE BOOL "" FORCE)
-       message(STATUS "Warning: PNG support will be disabled because libpng was not found.")
-@@ -217,13 +219,13 @@ else(WIN32 AND NOT MINGW)
-       message(STATUS "Info: DCMTK PNG support will be enabled")
-       set(WITH_LIBPNG 1)
-       include_directories(${PNG_INCLUDE_DIR})
--      set(LIBPNG_LIBS ${PNG_LIBRARY})
-+      set(LIBPNG_LIBS ${PNG_LIBRARIES})
-     endif()
-   endif()
- 
-   # Find OpenSSL
-   if(DCMTK_WITH_OPENSSL)
--    find_package(OpenSSL QUIET)
-+    find_package(OpenSSL REQUIRED)
-     if(NOT OPENSSL_FOUND)
-       message(STATUS "Warning: OPENSSL support will be disabled because openssl was not found.")
-       set(WITH_OPENSSL "")
-@@ -254,7 +256,7 @@ else(WIN32 AND NOT MINGW)
- 
-   # Find libXML2
-   if(DCMTK_WITH_XML)
--    find_package(LibXml2 QUIET)
-+    find_package(LibXml2 REQUIRED)
-     if(NOT LIBXML2_FOUND)
-       message(STATUS "Warning: XML support will be disabled because libxml2 was not found.")
-       set(WITH_LIBXML "")
-@@ -269,7 +271,7 @@ else(WIN32 AND NOT MINGW)
- 
-   # Find zlib
-   if(DCMTK_WITH_ZLIB)
--    find_package(ZLIB QUIET)
-+    find_package(ZLIB REQUIRED)
-     if(NOT ZLIB_FOUND)
-       message(STATUS "Warning: ZLIB support will be disabled because zlib was not found.")
-       set(WITH_ZLIB "")
-@@ -284,7 +286,7 @@ else(WIN32 AND NOT MINGW)
- 
-   # Find libsndfile
-   if(DCMTK_WITH_SNDFILE)
--    find_package(Sndfile QUIET)
-+    find_package(Sndfile REQUIRED)
-     if(NOT SNDFILE_LIBS)
-       message(STATUS "Warning: SNDFILE support will be disabled because libsndfile was not found.")
-       set(WITH_SNDFILE "")
-@@ -292,16 +294,16 @@ else(WIN32 AND NOT MINGW)
-     else()
-       message(STATUS "Info: DCMTK SNDFILE support will be enabled")
-       set(WITH_SNDFILE 1)
--      include_directories(${SNDFILE_INCLUDE_DIRS})
--      set(SNDFILE_LIBS ${SNDFILE_LIBRARIES})
-+      include_directories(${Sndfile_INCLUDE_DIRS})
-+      set(SNDFILE_LIBS ${Sndfile_LIBRARIES})
-     endif()
-   endif()
- 
-   # Find libiconv
-   if(DCMTK_WITH_ICONV)
--    find_package(Iconv QUIET)
--    find_package(Charset QUIET)
--    if(ICONV_FOUND)
-+    find_package(Iconv REQUIRED)
-+    #find_package(Charset REQUIRED) #FIXME??
-+    if(Iconv_FOUND)
-         if(NOT Iconv_IS_BUILT_IN)
-             set(LIBICONV_FOUND ${ICONV_FOUND})
-         else()
-@@ -322,14 +324,14 @@ else(WIN32 AND NOT MINGW)
-       set(WITH_LIBICONV 1)
-       set(LIBICONV_INCDIR ${LIBICONV_INCLUDE_DIRS} ${Iconv_INCLUDE_DIRS} ${ICONV_INCLUDE_DIR} ${LIBCHARSET_INCLUDE_DIRS})
-       set(LIBICONV_LIBDIR ${LIBICONV_LIBDIR})
--      set(LIBICONV_LIBS ${LIBICONV_LIBRARIES} ${Iconv_LIBRARIES} ${ICONV_LIBRARIES} ${LIBCHARSET_LIBRARY})
-+      set(LIBICONV_LIBS Iconv::Iconv)
-       include_directories(${LIBICONV_INCDIR})
-     endif()
-   endif()
- 
-   # Find libwrap
-   if(DCMTK_WITH_WRAP)
--    find_package(Wrap QUIET)
-+    find_package(Wrap REQUIRED)
-     if(NOT WRAP_FOUND)
-       message(STATUS "Warning: WRAP support will be disabled because libwrap was not found.")
-       set(WITH_TCPWRAPPER "")
-@@ -344,7 +346,7 @@ else(WIN32 AND NOT MINGW)
- 
-   # Find OpenJPEG
-   if(DCMTK_WITH_OPENJPEG)
--    find_package(OpenJPEG QUIET)
-+    find_package(OpenJPEG REQUIRED)
-     if(NOT OPENJPEG_FOUND)
-       message(STATUS "Warning: OpenJPEG support will be disabled because the OpenJPEG library was not found.")
-       set(WITH_OPENJPEG "")
-@@ -352,8 +354,8 @@ else(WIN32 AND NOT MINGW)
-     else()
-       message(STATUS "Info: DCMTK OpenJPEG support will be enabled")
-       set(WITH_OPENJPEG 1)
--      include_directories(${OPENJPEG_INCLUDE_DIRS})
--      set(OPENJPEG_LIBS ${OPENJPEG_LIBRARIES})
-+      include_directories(${OpenJPEG_INCLUDE_DIRS})
-+      set(OPENJPEG_LIBS ${OpenJPEG_LIBRARIES})
-     endif()
-   endif()
- 
-@@ -371,7 +373,7 @@ if(NOT DEFINED DCMTK_WITH_STDLIBC_ICONV)
- endif()
- 
- if(DCMTK_WITH_ICU)
--  find_package(ICU COMPONENTS uc data QUIET)
-+  find_package(ICU COMPONENTS uc data REQUIRED)
-   if(NOT ICU_FOUND)
-     message(STATUS "Warning: ICU support will be disabled because the ICU were not found.")
-     set(DCMTK_WITH_ICU OFF CACHE BOOL "" FORCE)
-@@ -387,7 +389,7 @@ endif()
- 
- # Find doxygen
- if(DCMTK_WITH_DOXYGEN)
--  find_package(Doxygen QUIET) # will set variable DOXYGEN_EXECUTABLE
-+  find_package(Doxygen REQUIRED) # will set variable DOXYGEN_EXECUTABLE
-   if(NOT DOXYGEN_FOUND)
-     message(STATUS "Warning: DOXYGEN support will be disabled because doxygen was not found.")
-     set(DCMTK_WITH_DOXYGEN OFF CACHE BOOL "" FORCE)
diff --git a/recipes/dcmtk/all/patches/0002-cmake-use-conan-packages.patch b/recipes/dcmtk/all/patches/0002-cmake-use-conan-packages.patch
deleted file mode 100644
index d566a50607ec7..0000000000000
--- a/recipes/dcmtk/all/patches/0002-cmake-use-conan-packages.patch
+++ /dev/null
@@ -1,225 +0,0 @@
---- CMake/3rdparty.cmake
-+++ CMake/3rdparty.cmake
-@@ -21,7 +21,7 @@ mark_as_advanced(DCMTK_USE_FIND_PACKAGE)
- if(DCMTK_USE_FIND_PACKAGE)
-   # Find TIFF
-   if(DCMTK_WITH_TIFF)
--    find_package(TIFF QUIET)
-+    find_package(TIFF REQUIRED)
-     # turn off library if it could not be found
-     if(NOT TIFF_FOUND)
-       message(STATUS "Warning: TIFF support will be disabled because libtiff was not found.")
-@@ -30,21 +30,21 @@ if(DCMTK_USE_FIND_PACKAGE)
-     else()
-       set(WITH_LIBTIFF 1)
-       # libtiff can be compiled with libjpeg support; if available, add libjpeg to library and include path
--      find_package(JPEG QUIET)
-+      find_package(JPEG REQUIRED)
-       if(NOT JPEG_FOUND)
-         message(STATUS "Info: DCMTK TIFF support will be enabled (but without JPEG)")
--        include_directories(${TIFF_INCLUDE_DIR})
-+        include_directories(${TIFF_INCLUDE_DIRS})
-       else()
-         message(STATUS "Info: DCMTK TIFF support will be enabled")
--        include_directories(${TIFF_INCLUDE_DIR} ${JPEG_INCLUDE_DIR})
-+        include_directories(${TIFF_INCLUDE_DIRS} ${JPEG_INCLUDE_DIRS})
-       endif()
--      set(LIBTIFF_LIBS ${TIFF_LIBRARY} ${JPEG_LIBRARY})
-+      set(LIBTIFF_LIBS ${TIFF_LIBRARIES} ${JPEG_LIBRARIES})
-     endif()
-   endif()
- 
-   # Find PNG
-   if(DCMTK_WITH_PNG)
--    find_package(PNG QUIET)
-+    find_package(PNG REQUIRED)
-     if(NOT PNG_FOUND)
-       set(DCMTK_WITH_PNG OFF CACHE BOOL "" FORCE)
-       message(STATUS "Warning: PNG support will be disabled because libpng was not found.")
-@@ -53,13 +53,13 @@ if(DCMTK_USE_FIND_PACKAGE)
-       message(STATUS "Info: DCMTK PNG support will be enabled")
-       set(WITH_LIBPNG 1)
-       include_directories(${PNG_INCLUDE_DIR})
--      set(LIBPNG_LIBS ${PNG_LIBRARY})
-+      set(LIBPNG_LIBS ${PNG_LIBRARIES})
-     endif()
-   endif()
- 
-   # Find OpenSSL
-   if(DCMTK_WITH_OPENSSL)
--    find_package(OpenSSL QUIET)
-+    find_package(OpenSSL REQUIRED)
-     if(NOT OPENSSL_FOUND)
-       message(STATUS "Warning: OPENSSL support will be disabled because openssl was not found.")
-       set(WITH_OPENSSL "")
-@@ -90,7 +90,7 @@ if(DCMTK_USE_FIND_PACKAGE)
- 
-   # Find libXML2
-   if(DCMTK_WITH_XML)
--    find_package(LibXml2 QUIET)
-+    find_package(LibXml2 REQUIRED)
-     if(NOT LIBXML2_FOUND)
-       message(STATUS "Warning: XML support will be disabled because libxml2 was not found.")
-       set(WITH_LIBXML "")
-@@ -105,7 +105,7 @@ if(DCMTK_USE_FIND_PACKAGE)
- 
-   # Find zlib
-   if(DCMTK_WITH_ZLIB)
--    find_package(ZLIB QUIET)
-+    find_package(ZLIB REQUIRED)
-     if(NOT ZLIB_FOUND)
-       message(STATUS "Warning: ZLIB support will be disabled because zlib was not found.")
-       set(WITH_ZLIB "")
-@@ -120,7 +120,7 @@ if(DCMTK_USE_FIND_PACKAGE)
- 
-   # Find libsndfile
-   if(DCMTK_WITH_SNDFILE)
--    find_package(Sndfile QUIET)
-+    find_package(Sndfile REQUIRED)
-     if(NOT SNDFILE_LIBS)
-       message(STATUS "Warning: SNDFILE support will be disabled because libsndfile was not found.")
-       set(WITH_SNDFILE "")
-@@ -128,16 +128,16 @@ if(DCMTK_USE_FIND_PACKAGE)
-     else()
-       message(STATUS "Info: DCMTK SNDFILE support will be enabled")
-       set(WITH_SNDFILE 1)
--      include_directories(${SNDFILE_INCLUDE_DIRS})
--      set(SNDFILE_LIBS ${SNDFILE_LIBRARIES})
-+      include_directories(${Sndfile_INCLUDE_DIRS})
-+      set(SNDFILE_LIBS ${Sndfile_LIBRARIES})
-     endif()
-   endif()
- 
-   # Find libiconv
-   if(DCMTK_WITH_ICONV)
--    find_package(Iconv QUIET)
--    find_package(Charset QUIET)
--    if(ICONV_FOUND)
-+    find_package(Iconv REQUIRED)
-+    #find_package(Charset QUIET) #FIXME??
-+    if(Iconv_FOUND)
-         if(NOT Iconv_IS_BUILT_IN)
-             set(LIBICONV_FOUND ${ICONV_FOUND})
-         else()
-@@ -158,7 +158,7 @@ if(DCMTK_USE_FIND_PACKAGE)
-       set(WITH_LIBICONV 1)
-       set(LIBICONV_INCDIR ${LIBICONV_INCLUDE_DIRS} ${Iconv_INCLUDE_DIRS} ${ICONV_INCLUDE_DIR} ${LIBCHARSET_INCLUDE_DIRS})
-       set(LIBICONV_LIBDIR ${LIBICONV_LIBDIR})
--      set(LIBICONV_LIBS ${LIBICONV_LIBRARIES} ${Iconv_LIBRARIES} ${ICONV_LIBRARIES} ${LIBCHARSET_LIBRARY})
-+      set(LIBICONV_LIBS Iconv::Iconv)
-       include_directories(${LIBICONV_INCDIR})
-     endif()
-   endif()
-@@ -234,13 +234,15 @@ else()
-   # libxml support: configure compiler
-   if(DCMTK_WITH_XML)
-     if(WITH_LIBXMLINC)
--      set(LIBXML_INCDIR "${WITH_LIBXMLINC}/include")
--      set(LIBXML_LIBDIR "${WITH_LIBXMLINC}/lib")
--      set(LIBXML_LIBS debug "${LIBXML_LIBDIR}/libxml2_d.lib" optimized "${LIBXML_LIBDIR}/libxml2_o.lib" debug "${LIBXML_LIBDIR}/iconv_d.lib" optimized "${LIBXML_LIBDIR}/iconv_o.lib")
-+      set(LIBXML_INCDIR ${CONAN_INCLUDE_DIRS_LIBXML2} ${CONAN_INCLUDE_DIRS_ICONV})
-+      link_directories(${WITH_LIBXMLINC}/lib)
-+      set(LIBXML_LIBS ${CONAN_LIBS_LIBXML2})
-       message(STATUS "Info: DCMTK XML support will be enabled")
-       set(WITH_LIBXML 1)
-+      if(NOT WITH_LIBXML_SHARED)
-       # this hides some warnings that are emitted when linking against libxmlXXX.lib instead of linking the DLL directly
-       add_definitions("-DLIBXML_STATIC")
-+      endif()
-     else() # turn off library if library path not set
-       message(STATUS "Warning: XML support will be disabled because libxml2 directory is not specified. Correct path and re-enable DCMTK_WITH_XML.")
-       set(DCMTK_WITH_XML OFF CACHE BOOL "" FORCE)
-@@ -252,8 +254,8 @@ else()
-   if(DCMTK_WITH_PNG)
-     if(WITH_LIBPNGINC)
-       set(LIBPNG_INCDIR "${WITH_LIBPNGINC}/include")
--      set(LIBPNG_LIBDIR "${WITH_LIBPNGINC}/lib")
--      set(LIBPNG_LIBS debug "${LIBPNG_LIBDIR}/libpng_d.lib" optimized "${LIBPNG_LIBDIR}/libpng_o.lib")
-+      link_directories(${WITH_LIBPNGINC}/lib)
-+      set(LIBPNG_LIBS CONAN_PKG::libpng)
-       message(STATUS "Info: DCMTK PNG support will be enabled")
-       set(WITH_LIBPNG 1)
-     else() # turn off library if library path not set
-@@ -267,8 +269,8 @@ else()
-   if(DCMTK_WITH_TIFF)
-     if(WITH_LIBTIFFINC)
-       set(LIBTIFF_INCDIR "${WITH_LIBTIFFINC}/include")
--      set(LIBTIFF_LIBDIR "${WITH_LIBTIFFINC}/lib")
--      set(LIBTIFF_LIBS debug "${LIBTIFF_LIBDIR}/libtiff_d.lib" optimized "${LIBTIFF_LIBDIR}/libtiff_o.lib")
-+      link_directories(${WITH_LIBTIFFINC}/lib)
-+      set(LIBTIFF_LIBS CONAN_PKG::libtiff)
-       message(STATUS "Info: DCMTK TIFF support will be enabled")
-       set(WITH_LIBTIFF 1)
-     else() # turn off library if library path not set
-@@ -284,9 +286,9 @@ else()
-       include(CheckCXXSourceCompiles)
-       set(OPENSSL_BINDIR "${WITH_OPENSSLINC}/bin")
-       set(OPENSSL_INCDIR "${WITH_OPENSSLINC}/include")
--      set(OPENSSL_LIBDIR "${WITH_OPENSSLINC}/lib")
-+      link_directories(${WITH_OPENSSLINC}/lib)
-       # starting with OpenSSL 1.1.0, the Windows crypt32 library is needed for a static link of OpenSSL.
--      set(OPENSSL_LIBS "crypt32" debug "${OPENSSL_LIBDIR}/dcmtkssl_d.lib" optimized "${OPENSSL_LIBDIR}/dcmtkssl_o.lib" debug "${OPENSSL_LIBDIR}/dcmtkcrypto_d.lib" optimized "${OPENSSL_LIBDIR}/dcmtkcrypto_o.lib")
-+      set(OPENSSL_LIBS ${CONAN_LIBS_OPENSSL})
-       set(TEMP_INCLUDES "${CMAKE_REQUIRED_INCLUDES}")
-       list(APPEND CMAKE_REQUIRED_INCLUDES "${OPENSSL_INCDIR}")
-       CHECK_CXX_SOURCE_COMPILES("extern \"C\" {\n#include \n}\nint main(){\n#if OPENSSL_VERSION_NUMBER < 0x10001000L\n#error OpenSSL too old\n#endif\n}\n" OPENSSL_VERSION_CHECK)
-@@ -310,8 +312,8 @@ else()
-   if(DCMTK_WITH_ZLIB)
-     if(WITH_ZLIBINC)
-       set(ZLIB_INCDIR "${WITH_ZLIBINC}/include")
--      set(ZLIB_LIBDIR "${WITH_ZLIBINC}/lib")
--      set(ZLIB_LIBS debug "${ZLIB_LIBDIR}/zlib_d.lib" optimized "${ZLIB_LIBDIR}/zlib_o.lib")
-+      link_directories(${WITH_ZLIBINC}/lib)
-+      set(ZLIB_LIBS CONAN_PKG::zlib)
-       message(STATUS "Info: DCMTK ZLIB support will be enabled")
-       set(WITH_ZLIB 1)
-     else() # turn off library if library path not set
-@@ -325,8 +327,8 @@ else()
-   if(DCMTK_WITH_SNDFILE)
-     if(WITH_SNDFILEINC)
-       set(SNDFILE_INCDIR "${WITH_SNDFILEINC}/include")
--      set(SNDFILE_LIBDIR "${WITH_SNDFILEINC}/lib")
--      set(SNDFILE_LIBS debug "${SNDFILE_LIBDIR}/libsndfile_d.lib" optimized "${SNDFILE_LIBDIR}/libsndfile_o.lib")
-+      link_directories(${WITH_SNDFILEINC}/lib)
-+      set(SNDFILE_LIBS CONAN_PKG::libsndfile)
-       message(STATUS "Info: DCMTK SNDFILE support will be enabled")
-       set(WITH_SNDFILE 1)
-     else() # turn off library if library path not set
-@@ -340,8 +342,8 @@ else()
-   if(DCMTK_WITH_ICONV)
-     if(WITH_LIBICONVINC)
-       set(LIBICONV_INCDIR "${WITH_LIBICONVINC}/include")
--      set(LIBICONV_LIBDIR "${WITH_LIBICONVINC}/lib")
--      set(LIBICONV_LIBS debug "${LIBICONV_LIBDIR}/libiconv_d.lib" optimized "${LIBICONV_LIBDIR}/libiconv_o.lib")
-+      link_directories(${WITH_LIBICONVINC}/lib)
-+      set(LIBICONV_LIBS CONAN_PKG::libiconv)
-       message(STATUS "Info: DCMTK ICONV support will be enabled")
-       set(WITH_LIBICONV 1)
-     else() # turn off library if library path not set
-@@ -364,7 +366,7 @@ else()
-       else()
-           set(OPENJPEG_INCDIR "${WITH_OPENJPEGINC1}")
-           set(OPENJPEG_LIBDIR "${WITH_OPENJPEGINC}/lib")
--          set(OPENJPEG_LIBS debug "${OPENJPEG_LIBDIR}/openjp2_d.lib" optimized "${OPENJPEG_LIBDIR}/openjp2_o.lib")
-+          set(OPENJPEG_LIBS CONAN_PKG::openjpeg)
-           message(STATUS "Info: DCMTK OpenJPEG support will be enabled")
-           set(WITH_OPENJPEG 1)
-       endif()
-@@ -388,7 +390,7 @@ if(NOT DEFINED DCMTK_WITH_STDLIBC_ICONV)
- endif()
- 
- if(DCMTK_WITH_ICU)
--  find_package(ICU COMPONENTS uc data QUIET)
-+  find_package(ICU COMPONENTS uc data REQUIRED)
-   if(NOT ICU_FOUND)
-     message(STATUS "Warning: ICU support will be disabled because the ICU were not found.")
-     set(DCMTK_WITH_ICU OFF CACHE BOOL "" FORCE)
-@@ -404,7 +406,7 @@ endif()
- 
- # Find doxygen
- if(DCMTK_WITH_DOXYGEN)
--  find_package(Doxygen QUIET) # will set variable DOXYGEN_EXECUTABLE
-+  find_package(Doxygen REQUIRED) # will set variable DOXYGEN_EXECUTABLE
-   if(NOT DOXYGEN_FOUND)
-     message(STATUS "Warning: DOXYGEN support will be disabled because doxygen was not found.")
-     set(DCMTK_WITH_DOXYGEN OFF CACHE BOOL "" FORCE)
diff --git a/recipes/dcmtk/all/patches/3.6.7-0001-cmake-robust-deps-handling.patch b/recipes/dcmtk/all/patches/3.6.7-0001-cmake-robust-deps-handling.patch
new file mode 100644
index 0000000000000..264a486b31bc6
--- /dev/null
+++ b/recipes/dcmtk/all/patches/3.6.7-0001-cmake-robust-deps-handling.patch
@@ -0,0 +1,162 @@
+--- a/CMake/3rdparty.cmake
++++ b/CMake/3rdparty.cmake
+@@ -21,7 +21,7 @@ mark_as_advanced(DCMTK_USE_FIND_PACKAGE)
+ if(DCMTK_USE_FIND_PACKAGE)
+   # Find TIFF
+   if(DCMTK_WITH_TIFF)
+-    find_package(TIFF QUIET)
++    find_package(TIFF REQUIRED)
+     # turn off library if it could not be found
+     if(NOT TIFF_FOUND)
+       message(STATUS "Warning: TIFF support will be disabled because libtiff was not found.")
+@@ -30,21 +30,13 @@ if(DCMTK_USE_FIND_PACKAGE)
+     else()
+       set(WITH_LIBTIFF 1)
+       # libtiff can be compiled with libjpeg support; if available, add libjpeg to library and include path
+-      find_package(JPEG QUIET)
+-      if(NOT JPEG_FOUND)
+-        message(STATUS "Info: DCMTK TIFF support will be enabled (but without JPEG)")
+-        include_directories(${TIFF_INCLUDE_DIR})
+-      else()
+-        message(STATUS "Info: DCMTK TIFF support will be enabled")
+-        include_directories(${TIFF_INCLUDE_DIR} ${JPEG_INCLUDE_DIR})
+-      endif()
+-      set(LIBTIFF_LIBS ${TIFF_LIBRARY} ${TIFF_EXTRA_LIBS_STATIC} ${JPEG_LIBRARY})
++      set(LIBTIFF_LIBS TIFF::TIFF)
+     endif()
+   endif()
+ 
+   # Find PNG
+   if(DCMTK_WITH_PNG)
+-    find_package(PNG QUIET)
++    find_package(PNG REQUIRED)
+     if(NOT PNG_FOUND)
+       set(DCMTK_WITH_PNG OFF CACHE BOOL "" FORCE)
+       message(STATUS "Warning: PNG support will be disabled because libpng was not found.")
+@@ -53,33 +45,23 @@ if(DCMTK_USE_FIND_PACKAGE)
+       message(STATUS "Info: DCMTK PNG support will be enabled")
+       set(WITH_LIBPNG 1)
+       include_directories(${PNG_INCLUDE_DIR})
+-      set(LIBPNG_LIBS ${PNG_LIBRARY})
++      set(LIBPNG_LIBS PNG::PNG)
+     endif()
+   endif()
+ 
+   # Find OpenSSL
+   if(DCMTK_WITH_OPENSSL)
+-    find_package(OpenSSL QUIET)
++    find_package(OpenSSL REQUIRED)
+     if(NOT OPENSSL_FOUND)
+       message(STATUS "Warning: OPENSSL support will be disabled because openssl was not found.")
+       set(WITH_OPENSSL "")
+       set(DCMTK_WITH_OPENSSL OFF CACHE BOOL "" FORCE)
+     else()
+-      include(CheckLibraryExists)
+-      include(CheckCXXSourceCompiles)
+-      set(TEMP_INCLUDES "${CMAKE_REQUIRED_INCLUDES}")
+-      list(APPEND CMAKE_REQUIRED_INCLUDES "${OPENSSL_INCLUDE_DIR}")
+-      CHECK_CXX_SOURCE_COMPILES("extern \"C\" {\n#include \n}\nint main(){\n#if OPENSSL_VERSION_NUMBER < 0x10001000L\n#error OpenSSL too old\n#endif\n}\n" OPENSSL_VERSION_CHECK)
+-      set(CMAKE_REQUIRED_INCLUDES "${TEMP_INCLUDES}")
+-      if(OPENSSL_VERSION_CHECK)
++      if(1)
+         message(STATUS "Info: DCMTK OPENSSL support will be enabled")
+         set(WITH_OPENSSL 1)
+         include_directories(${OPENSSL_INCLUDE_DIR})
+-        set(OPENSSL_LIBS ${OPENSSL_LIBRARIES} ${OPENSSL_EXTRA_LIBS_STATIC})
+-        CHECK_LIBRARY_EXISTS(dl dlopen "" HAVE_LIBDL)
+-        if(HAVE_LIBDL)
+-          set(OPENSSL_LIBS ${OPENSSL_LIBS} dl)
+-        endif()
++        set(OPENSSL_LIBS OpenSSL::SSL OpenSSL::Crypto)
+       else()
+         message(STATUS "Info: DCMTK OPENSSL support will be disabled: DCMTK requires OpenSSL version 1.0.1 or newer")
+         set(DCMTK_WITH_OPENSSL OFF CACHE BOOL "" FORCE)
+@@ -90,7 +72,7 @@ if(DCMTK_USE_FIND_PACKAGE)
+ 
+   # Find libXML2
+   if(DCMTK_WITH_XML)
+-    find_package(LibXml2 QUIET)
++    find_package(LibXml2 REQUIRED MODULE)
+     if(NOT LIBXML2_FOUND)
+       message(STATUS "Warning: XML support will be disabled because libxml2 was not found.")
+       set(WITH_LIBXML "")
+@@ -99,13 +81,13 @@ if(DCMTK_USE_FIND_PACKAGE)
+       message(STATUS "Info: DCMTK XML support will be enabled")
+       set(WITH_LIBXML 1)
+       include_directories(${LIBXML2_INCLUDE_DIR})
+-      set(LIBXML_LIBS ${LIBXML2_LIBRARIES} ${LIBXML2_EXTRA_LIBS_STATIC})
++      set(LIBXML_LIBS LibXml2::LibXml2)
+     endif()
+   endif()
+ 
+   # Find zlib
+   if(DCMTK_WITH_ZLIB)
+-    find_package(ZLIB QUIET)
++    find_package(ZLIB REQUIRED)
+     if(NOT ZLIB_FOUND)
+       message(STATUS "Warning: ZLIB support will be disabled because zlib was not found.")
+       set(WITH_ZLIB "")
+@@ -114,7 +96,7 @@ if(DCMTK_USE_FIND_PACKAGE)
+       message(STATUS "Info: DCMTK ZLIB support will be enabled")
+       set(WITH_ZLIB 1)
+       include_directories(${ZLIB_INCLUDE_DIRS})
+-      set(ZLIB_LIBS ${ZLIB_LIBRARIES})
++      set(ZLIB_LIBS ZLIB::ZLIB)
+     endif()
+   endif()
+ 
+@@ -135,11 +117,10 @@ if(DCMTK_USE_FIND_PACKAGE)
+ 
+   # Find libiconv
+   if(DCMTK_WITH_ICONV)
+-    find_package(Iconv QUIET)
+-    find_package(LIBCHARSET QUIET)
+-    if(ICONV_FOUND)
++    find_package(Iconv REQUIRED)
++    if(Iconv_FOUND)
+         if(NOT Iconv_IS_BUILT_IN)
+-            set(LIBICONV_FOUND ${ICONV_FOUND})
++            set(LIBICONV_FOUND ${Iconv_FOUND})
+         else()
+             message(STATUS "Info: found builtin ICONV support inside the C standard library.")
+             set(DCMTK_WITH_STDLIBC_ICONV ON CACHE BOOL "" FORCE)
+@@ -149,7 +130,7 @@ if(DCMTK_USE_FIND_PACKAGE)
+             set(LIBICONV_SECOND_ARGUMENT_CONST ${ICONV_SECOND_ARGUMENT_IS_CONST} CACHE INTERNAL "${HELPSTRING}")
+         endif()
+     endif()
+-    if(NOT LIBICONV_FOUND OR NOT LIBCHARSET_FOUND)
++    if(NOT LIBICONV_FOUND)
+       message(STATUS "Warning: ICONV support will be disabled because libiconv was not found. Correct LIBICONV_LIBDIR and LIBICONV_INCLUDE_DIR and re-enable DCMTK_WITH_ICONV.")
+       set(DCMTK_WITH_ICONV OFF CACHE BOOL "" FORCE)
+       set(WITH_LIBICONV "")
+@@ -157,24 +138,24 @@ if(DCMTK_USE_FIND_PACKAGE)
+       message(STATUS "Info: DCMTK ICONV support will be enabled")
+       set(WITH_LIBICONV 1)
+       set(LIBICONV_INCDIR ${LIBICONV_INCLUDE_DIRS} ${Iconv_INCLUDE_DIRS} ${ICONV_INCLUDE_DIR} ${LIBCHARSET_INCLUDE_DIRS})
+-      set(LIBICONV_LIBDIR ${LIBICONV_LIBDIR})
+-      set(LIBICONV_LIBS ${LIBICONV_LIBRARIES} ${Iconv_LIBRARIES} ${ICONV_LIBRARIES} ${LIBCHARSET_LIBRARY})
++      set(LIBICONV_LIBDIR ${Iconv_LIB_DIRS})
++      set(LIBICONV_LIBS Iconv::Iconv)
+       include_directories(${LIBICONV_INCDIR})
+     endif()
+   endif()
+ 
+   # Find libwrap
+   if(DCMTK_WITH_WRAP)
+-    find_package(WRAP QUIET)
+-    if(NOT WRAP_FOUND)
++    find_package(tcp-wrappers REQUIRED CONFIG)
++    if(NOT tcp-wrappers_FOUND)
+       message(STATUS "Warning: WRAP support will be disabled because libwrap was not found.")
+       set(WITH_TCPWRAPPER "")
+       set(DCMTK_WITH_WRAP OFF CACHE BOOL "" FORCE)
+     else()
+       message(STATUS "Info: DCMTK WRAP support will be enabled")
+       set(WITH_TCPWRAPPER 1)
+-      include_directories(${WRAP_INCLUDE_DIRS})
+-      set(WRAP_LIBS ${WRAP_LIBRARIES} ${WRAP_EXTRA_LIBS_STATIC})
++      include_directories(${tcp-wrappers_INCLUDE_DIRS})
++      set(WRAP_LIBS tcp-wrappers::tcp-wrappers)
+     endif()
+   endif()
+ 
diff --git a/recipes/dcmtk/all/patches/3.6.7-0002-cmake-check-openssl-symbol.patch b/recipes/dcmtk/all/patches/3.6.7-0002-cmake-check-openssl-symbol.patch
new file mode 100644
index 0000000000000..a3f1d5ac2c44b
--- /dev/null
+++ b/recipes/dcmtk/all/patches/3.6.7-0002-cmake-check-openssl-symbol.patch
@@ -0,0 +1,89 @@
+--- a/CMake/dcmtkPrepare.cmake
++++ b/CMake/dcmtkPrepare.cmake
+@@ -668,48 +668,50 @@ if(DCMTK_WITH_OPENSSL)
+   CHECK_INCLUDE_FILE_CXX("openssl/provider.h" HAVE_OPENSSL_PROVIDER_H)
+ 
+   # test presence of functions, constants and macros needed for the dcmtls module
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("SSL_CTX_get0_param" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_CTX_GET0_PARAM)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("RAND_egd" "openssl/rand.h" HAVE_OPENSSL_PROTOTYPE_RAND_EGD)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("DH_bits" "openssl/dh.h" HAVE_OPENSSL_PROTOTYPE_DH_BITS)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("EVP_PKEY_RSA_PSS" "openssl/evp.h" HAVE_OPENSSL_PROTOTYPE_EVP_PKEY_RSA_PSS)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("EVP_PKEY_base_id" "openssl/evp.h" HAVE_OPENSSL_PROTOTYPE_EVP_PKEY_BASE_ID)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("SSL_CTX_get_cert_store" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_CTX_GET_CERT_STORE)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("SSL_CTX_get_ciphers" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_CTX_GET_CIPHERS)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("SSL_CTX_set0_tmp_dh_pkey" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_CTX_SET0_TMP_DH_PKEY)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("SSL_CTX_set1_curves(0,0,0)" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_CTX_SET1_CURVES)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("SSL_CTX_set1_sigalgs" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_CTX_SET1_SIGALGS)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("SSL_CTX_set_ecdh_auto(0,0)" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_CTX_SET_ECDH_AUTO)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("SSL_CTX_set_max_proto_version(0,0)" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_CTX_SET_MAX_PROTO_VERSION)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("SSL_CTX_set_security_level" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_CTX_SET_SECURITY_LEVEL)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("SSL_ERROR_WANT_ASYNC" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_ERROR_WANT_ASYNC)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("SSL_ERROR_WANT_ASYNC_JOB" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_ERROR_WANT_ASYNC_JOB)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("SSL_ERROR_WANT_CLIENT_HELLO_CB" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_ERROR_WANT_CLIENT_HELLO_CB)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("TLS1_TXT_ECDHE_RSA_WITH_CHACHA20_POLY1305" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_TLS1_TXT_ECDHE_RSA_WITH_CHACHA20_POLY1305)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("TLS_method" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_TLS_METHOD)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("X509_STORE_get0_param" "openssl/x509.h" HAVE_OPENSSL_PROTOTYPE_X509_STORE_GET0_PARAM)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("X509_get_signature_nid" "openssl/x509.h" HAVE_OPENSSL_PROTOTYPE_X509_GET_SIGNATURE_NID)
++  include(CheckSymbolExists)
++  include(CheckCSourceCompiles)
++  check_symbol_exists("SSL_CTX_get0_param" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_CTX_GET0_PARAM)
++  check_symbol_exists("RAND_egd" "openssl/rand.h" HAVE_OPENSSL_PROTOTYPE_RAND_EGD)
++  check_symbol_exists("DH_bits" "openssl/dh.h" HAVE_OPENSSL_PROTOTYPE_DH_BITS)
++  check_symbol_exists("EVP_PKEY_RSA_PSS" "openssl/evp.h" HAVE_OPENSSL_PROTOTYPE_EVP_PKEY_RSA_PSS)
++  check_symbol_exists("EVP_PKEY_base_id" "openssl/evp.h" HAVE_OPENSSL_PROTOTYPE_EVP_PKEY_BASE_ID)
++  check_symbol_exists("SSL_CTX_get_cert_store" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_CTX_GET_CERT_STORE)
++  check_symbol_exists("SSL_CTX_get_ciphers" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_CTX_GET_CIPHERS)
++  check_symbol_exists("SSL_CTX_set0_tmp_dh_pkey" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_CTX_SET0_TMP_DH_PKEY)
++  check_c_source_compiles("#include \nint main() {SSL_CTX_set1_curves(0,0,0); return 0;}" HAVE_OPENSSL_PROTOTYPE_SSL_CTX_SET1_CURVES)
++  check_symbol_exists("SSL_CTX_set1_sigalgs" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_CTX_SET1_SIGALGS)
++  check_c_source_compiles("#include \nint main() {SSL_CTX_set_ecdh_auto(0,0); return 0;}" HAVE_OPENSSL_PROTOTYPE_SSL_CTX_SET_ECDH_AUTO)
++  check_c_source_compiles("#include \nint main() {SSL_CTX_set_max_proto_version(0,0); return 0;}" HAVE_OPENSSL_PROTOTYPE_SSL_CTX_SET_MAX_PROTO_VERSION)
++  check_symbol_exists("SSL_CTX_set_security_level" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_CTX_SET_SECURITY_LEVEL)
++  check_symbol_exists("SSL_ERROR_WANT_ASYNC" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_ERROR_WANT_ASYNC)
++  check_symbol_exists("SSL_ERROR_WANT_ASYNC_JOB" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_ERROR_WANT_ASYNC_JOB)
++  check_symbol_exists("SSL_ERROR_WANT_CLIENT_HELLO_CB" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_ERROR_WANT_CLIENT_HELLO_CB)
++  check_symbol_exists("TLS1_TXT_ECDHE_RSA_WITH_CHACHA20_POLY1305" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_TLS1_TXT_ECDHE_RSA_WITH_CHACHA20_POLY1305)
++  check_symbol_exists("TLS_method" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_TLS_METHOD)
++  check_symbol_exists("X509_STORE_get0_param" "openssl/x509.h" HAVE_OPENSSL_PROTOTYPE_X509_STORE_GET0_PARAM)
++  check_symbol_exists("X509_get_signature_nid" "openssl/x509.h" HAVE_OPENSSL_PROTOTYPE_X509_GET_SIGNATURE_NID)
+ 
+   # test presence of functions, constants and macros needed for the dcmsign module
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("ASN1_STRING_get0_data" "openssl/asn1.h" HAVE_OPENSSL_PROTOTYPE_ASN1_STRING_GET0_DATA)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("EVP_PKEY_get0_EC_KEY" "openssl/evp.h" HAVE_OPENSSL_PROTOTYPE_EVP_PKEY_GET0_EC_KEY)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("EVP_PKEY_get_group_name" "openssl/evp.h" HAVE_OPENSSL_PROTOTYPE_EVP_PKEY_GET_GROUP_NAME)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("EVP_PKEY_id" "openssl/evp.h" HAVE_OPENSSL_PROTOTYPE_EVP_PKEY_ID)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("OSSL_PROVIDER_load" "openssl/provider.h" HAVE_OPENSSL_PROTOTYPE_OSSL_PROVIDER_LOAD)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("TS_STATUS_INFO_get0_failure_info" "openssl/ts.h" HAVE_OPENSSL_PROTOTYPE_TS_STATUS_INFO_GET0_FAILURE_INFO)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("TS_STATUS_INFO_get0_status" "openssl/ts.h" HAVE_OPENSSL_PROTOTYPE_TS_STATUS_INFO_GET0_STATUS)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("TS_STATUS_INFO_get0_text" "openssl/ts.h" HAVE_OPENSSL_PROTOTYPE_TS_STATUS_INFO_GET0_TEXT)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("TS_VERIFY_CTS_set_certs(0,0)" "openssl/ts.h" HAVE_OPENSSL_PROTOTYPE_TS_VERIFY_CTS_SET_CERTS)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("TS_VERIFY_CTX_set_data" "openssl/ts.h" HAVE_OPENSSL_PROTOTYPE_TS_VERIFY_CTX_SET_DATA)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("TS_VERIFY_CTX_set_flags" "openssl/ts.h" HAVE_OPENSSL_PROTOTYPE_TS_VERIFY_CTX_SET_FLAGS)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("TS_VERIFY_CTX_set_store" "openssl/ts.h" HAVE_OPENSSL_PROTOTYPE_TS_VERIFY_CTX_SET_STORE)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("X509_get0_notAfter" "openssl/x509.h" HAVE_OPENSSL_PROTOTYPE_X509_GET0_NOTAFTER)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("X509_get0_notBefore" "openssl/x509.h" HAVE_OPENSSL_PROTOTYPE_X509_GET0_NOTBEFORE)
++  check_symbol_exists("ASN1_STRING_get0_data" "openssl/asn1.h" HAVE_OPENSSL_PROTOTYPE_ASN1_STRING_GET0_DATA)
++  check_symbol_exists("EVP_PKEY_get0_EC_KEY" "openssl/evp.h" HAVE_OPENSSL_PROTOTYPE_EVP_PKEY_GET0_EC_KEY)
++  check_symbol_exists("EVP_PKEY_get_group_name" "openssl/evp.h" HAVE_OPENSSL_PROTOTYPE_EVP_PKEY_GET_GROUP_NAME)
++  check_symbol_exists("EVP_PKEY_id" "openssl/evp.h" HAVE_OPENSSL_PROTOTYPE_EVP_PKEY_ID)
++  check_symbol_exists("OSSL_PROVIDER_load" "openssl/provider.h" HAVE_OPENSSL_PROTOTYPE_OSSL_PROVIDER_LOAD)
++  check_symbol_exists("TS_STATUS_INFO_get0_failure_info" "openssl/ts.h" HAVE_OPENSSL_PROTOTYPE_TS_STATUS_INFO_GET0_FAILURE_INFO)
++  check_symbol_exists("TS_STATUS_INFO_get0_status" "openssl/ts.h" HAVE_OPENSSL_PROTOTYPE_TS_STATUS_INFO_GET0_STATUS)
++  check_symbol_exists("TS_STATUS_INFO_get0_text" "openssl/ts.h" HAVE_OPENSSL_PROTOTYPE_TS_STATUS_INFO_GET0_TEXT)
++  check_c_source_compiles("#include \nint main() {TS_VERIFY_CTS_set_certs(0,0); return 0;}" HAVE_OPENSSL_PROTOTYPE_TS_VERIFY_CTS_SET_CERTS)
++  check_symbol_exists("TS_VERIFY_CTX_set_data" "openssl/ts.h" HAVE_OPENSSL_PROTOTYPE_TS_VERIFY_CTX_SET_DATA)
++  check_symbol_exists("TS_VERIFY_CTX_set_flags" "openssl/ts.h" HAVE_OPENSSL_PROTOTYPE_TS_VERIFY_CTX_SET_FLAGS)
++  check_symbol_exists("TS_VERIFY_CTX_set_store" "openssl/ts.h" HAVE_OPENSSL_PROTOTYPE_TS_VERIFY_CTX_SET_STORE)
++  check_symbol_exists("X509_get0_notAfter" "openssl/x509.h" HAVE_OPENSSL_PROTOTYPE_X509_GET0_NOTAFTER)
++  check_symbol_exists("X509_get0_notBefore" "openssl/x509.h" HAVE_OPENSSL_PROTOTYPE_X509_GET0_NOTBEFORE)
+ 
+   # check if type EVP_MD_CTX is defined as typedef for "struct evp_md_ctx_st" (new) or "struct env_md_ctx_st" (old)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("struct evp_md_ctx_st *a; EVP_MD_CTX *b=a" "openssl/evp.h" HAVE_OPENSSL_DECLARATION_NEW_EVP_MD_CTX)
++  check_c_source_compiles("#include \nint main() {struct evp_md_ctx_st *a; EVP_MD_CTX *b=a; return 0;}" HAVE_OPENSSL_DECLARATION_NEW_EVP_MD_CTX)
+ 
+   # check if the first parameter passed to X509_ALGOR_get0() should be "const ASN1_OBJECT **" (new) or "ASN1_OBJECT **" (old)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("const ASN1_OBJECT *a; X509_ALGOR_get0(&a,0,0,0)" "openssl/x509.h" HAVE_OPENSSL_X509_ALGOR_GET0_CONST_PARAM)
++  check_c_source_compiles("#include \nint main() {const ASN1_OBJECT *a; X509_ALGOR_get0(&a,0,0,0); return 0;}" HAVE_OPENSSL_X509_ALGOR_GET0_CONST_PARAM)
+ 
+   # restore previous value of CMAKE_REQUIRED_LIBRARIES
+   set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES_TEMP})
diff --git a/recipes/dcmtk/all/patches/3.6.7-0003-ambiguous-overload-operator-equal.patch b/recipes/dcmtk/all/patches/3.6.7-0003-ambiguous-overload-operator-equal.patch
new file mode 100644
index 0000000000000..d4b6242e861a2
--- /dev/null
+++ b/recipes/dcmtk/all/patches/3.6.7-0003-ambiguous-overload-operator-equal.patch
@@ -0,0 +1,26 @@
+--- a/dcmqrdb/include/dcmtk/dcmqrdb/dcmqridx.h
++++ b/dcmqrdb/include/dcmtk/dcmqrdb/dcmqridx.h
+@@ -122,10 +122,22 @@ struct DCMTK_DCMQRDB_EXPORT DB_SerializedTagKey
+     inline DB_SerializedTagKey(const DcmTagKey& rhs) { *this = rhs; }
+     inline DB_SerializedTagKey& operator=(const DcmTagKey& tk) { key[0] = tk.getGroup(); key[1] = tk.getElement(); return *this; }
+     inline operator DcmTagKey() const { return DcmTagKey( key[0], key[1] ); }
+-    inline bool operator==(const DB_SerializedTagKey& rhs) const { return key[0] == rhs.key[0] && key[1] == rhs.key[1]; }
+     Uint16 key[2];
+ };
+ 
++inline bool operator==(const DB_SerializedTagKey& lhs, const DB_SerializedTagKey& rhs)
++{
++    return lhs.key[0] == rhs.key[0] && lhs.key[1] == rhs.key[1];
++}
++inline bool operator==(const DB_SerializedTagKey& lhs, const DcmTagKey& rhs)
++{
++    return lhs == DB_SerializedTagKey(rhs);
++}
++inline bool operator==(const DcmTagKey& lhs, const DB_SerializedTagKey& rhs)
++{
++    return rhs == lhs;
++}
++
+ /* ENSURE THAT DBVERSION IS INCREMENTED WHENEVER ONE OF THESE STRUCTS IS MODIFIED */
+ 
+ struct DCMTK_DCMQRDB_EXPORT DB_SerializedCharPtr
diff --git a/recipes/dcmtk/all/patches/3.6.7-0004-fix-two-segmentation-faults.patch b/recipes/dcmtk/all/patches/3.6.7-0004-fix-two-segmentation-faults.patch
new file mode 100644
index 0000000000000..225b610e167f4
--- /dev/null
+++ b/recipes/dcmtk/all/patches/3.6.7-0004-fix-two-segmentation-faults.patch
@@ -0,0 +1,60 @@
+--- a/dcmdata/libsrc/dcelem.cc
++++ b/dcmdata/libsrc/dcelem.cc
+@@ -717,6 +717,13 @@ OFCondition DcmElement::loadValue(DcmInputStream *inStream)
+             if (isStreamNew)
+                 delete readStream;
+         }
++        else
++        {
++            errorFlag = EC_InvalidStream; // incomplete dataset read from stream
++            DCMDATA_ERROR("DcmElement: " << getTagName() << " " << getTag()
++                << " larger (" << getLengthField() << ") than remaining bytes ("
++                << getTransferredBytes() << ") in file, premature end of stream");
++        }
+     }
+     /* return result value */
+     return errorFlag;
+diff --git a/dcmnet/libsrc/dimcmd.cc b/dcmnet/libsrc/dimcmd.cc
+index 6dca39546..ffd225f4b 100644
+--- a/dcmnet/libsrc/dimcmd.cc
++++ b/dcmnet/libsrc/dimcmd.cc
+@@ -205,22 +205,25 @@ getString(DcmDataset *obj, DcmTagKey t, char *s, int maxlen, OFBool *spacePadded
+             return parseErrorWithMsg("dimcmd:getString: string too small", t);
+         } else {
+             ec =  elem->getString(aString);
+-            strncpy(s, aString, maxlen);
+-            if (spacePadded)
++            if (ec.good())
+             {
+-                /* before we remove leading and tailing spaces we want to know
+-                 * whether the string is actually space padded. Required to communicate
+-                 * with dumb peers which send space padded UIDs and fail if they
+-                 * receive correct UIDs back.
+-                 *
+-                 * This test can only detect space padded strings if
+-                 * dcmEnableAutomaticInputDataCorrection is false; otherwise the padding
+-                 * has already been removed by dcmdata at this stage.
+-                 */
+-                size_t s_len = strlen(s);
+-                if ((s_len > 0)&&(s[s_len-1] == ' ')) *spacePadded = OFTrue; else *spacePadded = OFFalse;
++                strncpy(s, aString, maxlen);
++                if (spacePadded)
++                {
++                    /* before we remove leading and tailing spaces we want to know
++                     * whether the string is actually space padded. Required to communicate
++                     * with dumb peers which send space padded UIDs and fail if they
++                     * receive correct UIDs back.
++                     *
++                     * This test can only detect space padded strings if
++                     * dcmEnableAutomaticInputDataCorrection is false; otherwise the padding
++                     * has already been removed by dcmdata at this stage.
++                     */
++                    size_t s_len = strlen(s);
++                    if ((s_len > 0)&&(s[s_len-1] == ' ')) *spacePadded = OFTrue; else *spacePadded = OFFalse;
++                }
++                DU_stripLeadingAndTrailingSpaces(s);
+             }
+-            DU_stripLeadingAndTrailingSpaces(s);
+         }
+     }
+     return (ec.good())? ec : DIMSE_PARSEFAILED;
\ No newline at end of file
diff --git a/recipes/dcmtk/all/patches/3.6.8-0001-cmake-robust-deps-handling.patch b/recipes/dcmtk/all/patches/3.6.8-0001-cmake-robust-deps-handling.patch
new file mode 100644
index 0000000000000..41e42340ad638
--- /dev/null
+++ b/recipes/dcmtk/all/patches/3.6.8-0001-cmake-robust-deps-handling.patch
@@ -0,0 +1,158 @@
+--- CMake/3rdparty.cmake
++++ CMake/3rdparty.cmake
+@@ -25,7 +25,7 @@
+ if(DCMTK_USE_FIND_PACKAGE)
+   # Find TIFF
+   if(DCMTK_WITH_TIFF)
+-    find_package(TIFF QUIET)
++    find_package(TIFF REQUIRED)
+     # turn off library if it could not be found
+     if(NOT TIFF_FOUND)
+       message(STATUS "Warning: TIFF support will be disabled because libtiff was not found.")
+@@ -34,21 +34,13 @@
+     else()
+       set(WITH_LIBTIFF 1)
+       # libtiff can be compiled with libjpeg support; if available, add libjpeg to library and include path
+-      find_package(JPEG QUIET)
+-      if(NOT JPEG_FOUND)
+-        message(STATUS "Info: DCMTK TIFF support will be enabled (but without JPEG)")
+-        include_directories(${TIFF_INCLUDE_DIR})
+-      else()
+-        message(STATUS "Info: DCMTK TIFF support will be enabled")
+-        include_directories(${TIFF_INCLUDE_DIR} ${JPEG_INCLUDE_DIR})
+-      endif()
+-      set(LIBTIFF_LIBS ${TIFF_LIBRARY} ${TIFF_EXTRA_LIBS_STATIC} ${JPEG_LIBRARY})
++      set(LIBTIFF_LIBS TIFF::TIFF)
+     endif()
+   endif()
+ 
+   # Find PNG
+   if(DCMTK_WITH_PNG)
+-    find_package(PNG QUIET)
++    find_package(PNG REQUIRED)
+     if(NOT PNG_FOUND)
+       set(DCMTK_WITH_PNG OFF CACHE BOOL "" FORCE)
+       message(STATUS "Warning: PNG support will be disabled because libpng was not found.")
+@@ -57,13 +49,13 @@
+       message(STATUS "Info: DCMTK PNG support will be enabled")
+       set(WITH_LIBPNG 1)
+       include_directories(${PNG_INCLUDE_DIR})
+-      set(LIBPNG_LIBS ${PNG_LIBRARY})
++      set(LIBPNG_LIBS PNG::PNG)
+     endif()
+   endif()
+ 
+   # Find OpenSSL
+   if(DCMTK_WITH_OPENSSL)
+-    find_package(OpenSSL QUIET)
++    find_package(OpenSSL REQUIRED)
+     if(NOT OPENSSL_FOUND)
+       message(STATUS "Warning: OPENSSL support will be disabled because openssl was not found.")
+       set(WITH_OPENSSL "")
+@@ -75,15 +67,11 @@
+       list(APPEND CMAKE_REQUIRED_INCLUDES "${OPENSSL_INCLUDE_DIR}")
+       CHECK_CXX_SOURCE_COMPILES("extern \"C\" {\n#include \n}\nint main(){\n#if OPENSSL_VERSION_NUMBER < 0x10002000L\n#error OpenSSL too old\n#endif\n}\n" OPENSSL_VERSION_CHECK)
+       set(CMAKE_REQUIRED_INCLUDES "${TEMP_INCLUDES}")
+-      if(OPENSSL_VERSION_CHECK)
++      if(1)
+         message(STATUS "Info: DCMTK OPENSSL support will be enabled")
+         set(WITH_OPENSSL 1)
+         include_directories(${OPENSSL_INCLUDE_DIR})
+-        set(OPENSSL_LIBS ${OPENSSL_LIBRARIES} ${OPENSSL_EXTRA_LIBS_STATIC})
+-        CHECK_LIBRARY_EXISTS(dl dlopen "" HAVE_LIBDL)
+-        if(HAVE_LIBDL)
+-          set(OPENSSL_LIBS ${OPENSSL_LIBS} dl)
+-        endif()
++        set(OPENSSL_LIBS OpenSSL::SSL OpenSSL::Crypto)
+       else()
+         message(STATUS "Info: DCMTK OPENSSL support will be disabled: DCMTK requires OpenSSL version 1.0.2 or newer")
+         set(DCMTK_WITH_OPENSSL OFF CACHE BOOL "" FORCE)
+@@ -94,7 +82,7 @@
+ 
+   # Find libXML2
+   if(DCMTK_WITH_XML)
+-    find_package(LibXml2 QUIET)
++    find_package(LibXml2 REQUIRED MODULE)
+     if(NOT LIBXML2_FOUND)
+       message(STATUS "Warning: XML support will be disabled because libxml2 was not found.")
+       set(WITH_LIBXML "")
+@@ -103,13 +91,13 @@
+       message(STATUS "Info: DCMTK XML support will be enabled")
+       set(WITH_LIBXML 1)
+       include_directories(${LIBXML2_INCLUDE_DIR})
+-      set(LIBXML_LIBS ${LIBXML2_LIBRARIES} ${LIBXML2_EXTRA_LIBS_STATIC})
++      set(LIBXML_LIBS LibXml2::LibXml2)
+     endif()
+   endif()
+ 
+   # Find zlib
+   if(DCMTK_WITH_ZLIB)
+-    find_package(ZLIB QUIET)
++    find_package(ZLIB REQUIRED)
+     if(NOT ZLIB_FOUND)
+       message(STATUS "Warning: ZLIB support will be disabled because zlib was not found.")
+       set(WITH_ZLIB "")
+@@ -118,7 +106,7 @@
+       message(STATUS "Info: DCMTK ZLIB support will be enabled")
+       set(WITH_ZLIB 1)
+       include_directories(${ZLIB_INCLUDE_DIRS})
+-      set(ZLIB_LIBS ${ZLIB_LIBRARIES})
++      set(ZLIB_LIBS ZLIB::ZLIB)
+     endif()
+   endif()
+ 
+@@ -139,11 +127,10 @@
+ 
+   # Find libiconv
+   if(DCMTK_WITH_ICONV)
+-    find_package(Iconv QUIET)
+-    find_package(LIBCHARSET QUIET)
+-    if(ICONV_FOUND)
++    find_package(Iconv REQUIRED)
++    if(Iconv_FOUND)
+         if(NOT Iconv_IS_BUILT_IN)
+-            set(LIBICONV_FOUND ${ICONV_FOUND})
++            set(LIBICONV_FOUND ${Iconv_FOUND})
+         else()
+             message(STATUS "Info: found builtin ICONV support inside the C standard library.")
+             set(DCMTK_WITH_STDLIBC_ICONV ON CACHE BOOL "" FORCE)
+@@ -153,7 +140,7 @@
+             set(LIBICONV_SECOND_ARGUMENT_CONST ${ICONV_SECOND_ARGUMENT_IS_CONST} CACHE INTERNAL "${HELPSTRING}")
+         endif()
+     endif()
+-    if(NOT LIBICONV_FOUND OR NOT LIBCHARSET_FOUND)
++    if(NOT LIBICONV_FOUND)
+       message(STATUS "Warning: ICONV support will be disabled because libiconv was not found. Correct LIBICONV_LIBDIR and LIBICONV_INCLUDE_DIR and re-enable DCMTK_WITH_ICONV.")
+       set(DCMTK_WITH_ICONV OFF CACHE BOOL "" FORCE)
+       set(WITH_LIBICONV "")
+@@ -161,24 +148,24 @@
+       message(STATUS "Info: DCMTK ICONV support will be enabled")
+       set(WITH_LIBICONV 1)
+       set(LIBICONV_INCDIR ${LIBICONV_INCLUDE_DIRS} ${Iconv_INCLUDE_DIRS} ${ICONV_INCLUDE_DIR} ${LIBCHARSET_INCLUDE_DIRS})
+-      set(LIBICONV_LIBDIR ${LIBICONV_LIBDIR})
+-      set(LIBICONV_LIBS ${LIBICONV_LIBRARIES} ${Iconv_LIBRARIES} ${ICONV_LIBRARIES} ${LIBCHARSET_LIBRARY})
++      set(LIBICONV_LIBDIR ${Iconv_LIB_DIRS})
++      set(LIBICONV_LIBS Iconv::Iconv)
+       include_directories(${LIBICONV_INCDIR})
+     endif()
+   endif()
+ 
+   # Find libwrap
+   if(DCMTK_WITH_WRAP)
+-    find_package(WRAP QUIET)
+-    if(NOT WRAP_FOUND)
++    find_package(tcp-wrappers REQUIRED CONFIG)
++    if(NOT tcp-wrappers_FOUND)
+       message(STATUS "Warning: WRAP support will be disabled because libwrap was not found.")
+       set(WITH_TCPWRAPPER "")
+       set(DCMTK_WITH_WRAP OFF CACHE BOOL "" FORCE)
+     else()
+       message(STATUS "Info: DCMTK WRAP support will be enabled")
+       set(WITH_TCPWRAPPER 1)
+-      include_directories(${WRAP_INCLUDE_DIRS})
+-      set(WRAP_LIBS ${WRAP_LIBRARIES} ${WRAP_EXTRA_LIBS_STATIC})
++      include_directories(${tcp-wrappers_INCLUDE_DIRS})
++      set(WRAP_LIBS tcp-wrappers::tcp-wrappers)
+     endif()
+   endif()
+ 
diff --git a/recipes/dcmtk/all/patches/3.6.8-0002-cmake-check-openssl-symbol.patch b/recipes/dcmtk/all/patches/3.6.8-0002-cmake-check-openssl-symbol.patch
new file mode 100644
index 0000000000000..a4cd32b6e2766
--- /dev/null
+++ b/recipes/dcmtk/all/patches/3.6.8-0002-cmake-check-openssl-symbol.patch
@@ -0,0 +1,107 @@
+--- CMake/dcmtkPrepare.cmake
++++ CMake/dcmtkPrepare.cmake
+@@ -689,57 +689,59 @@
+   CHECK_INCLUDE_FILE_CXX("openssl/provider.h" HAVE_OPENSSL_PROVIDER_H)
+ 
+   # test presence of functions, constants and macros needed for the dcmtls module
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("DH_bits" "openssl/dh.h" HAVE_OPENSSL_PROTOTYPE_DH_BITS)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("EVP_PKEY_RSA_PSS" "openssl/evp.h" HAVE_OPENSSL_PROTOTYPE_EVP_PKEY_RSA_PSS)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("EVP_PKEY_base_id" "openssl/evp.h" HAVE_OPENSSL_PROTOTYPE_EVP_PKEY_BASE_ID)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("NID_dsa_with_SHA512" "openssl/obj_mac.h" HAVE_OPENSSL_PROTOTYPE_NID_DSA_WITH_SHA512)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("NID_ecdsa_with_SHA3_256" "openssl/obj_mac.h" HAVE_OPENSSL_PROTOTYPE_NID_ECDSA_WITH_SHA3_256)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("NID_sha512_256WithRSAEncryption" "openssl/obj_mac.h" HAVE_OPENSSL_PROTOTYPE_NID_SHA512_256WITHRSAENCRYPTION)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("RAND_egd" "openssl/rand.h" HAVE_OPENSSL_PROTOTYPE_RAND_EGD)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("SSL_CTX_get0_param" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_CTX_GET0_PARAM)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("SSL_CTX_get_cert_store" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_CTX_GET_CERT_STORE)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("SSL_CTX_get_ciphers" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_CTX_GET_CIPHERS)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("SSL_CTX_set0_tmp_dh_pkey" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_CTX_SET0_TMP_DH_PKEY)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("SSL_CTX_set1_curves(0,0,0)" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_CTX_SET1_CURVES)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("SSL_CTX_set1_sigalgs" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_CTX_SET1_SIGALGS)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("SSL_CTX_set_ecdh_auto(0,0)" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_CTX_SET_ECDH_AUTO)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("SSL_CTX_set_max_proto_version(0,0)" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_CTX_SET_MAX_PROTO_VERSION)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("SSL_CTX_set_security_level" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_CTX_SET_SECURITY_LEVEL)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("SSL_ERROR_WANT_ASYNC" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_ERROR_WANT_ASYNC)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("SSL_ERROR_WANT_ASYNC_JOB" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_ERROR_WANT_ASYNC_JOB)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("SSL_ERROR_WANT_CLIENT_HELLO_CB" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_ERROR_WANT_CLIENT_HELLO_CB)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("TLS1_3_RFC_AES_128_CCM_8_SHA256" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_TLS1_3_RFC_AES_128_CCM_8_SHA256)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("TLS1_3_RFC_AES_256_GCM_SHA384" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_TLS1_3_RFC_AES_256_GCM_SHA384)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("TLS1_3_RFC_CHACHA20_POLY1305_SHA256" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_TLS1_3_RFC_CHACHA20_POLY1305_SHA256)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_CCM_8" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_CCM_8)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("TLS1_TXT_ECDHE_ECDSA_WITH_CAMELLIA_256_GCM_SHA384" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_TLS1_TXT_ECDHE_ECDSA_WITH_CAMELLIA_256_GCM_SHA384)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("TLS1_TXT_ECDHE_RSA_WITH_CHACHA20_POLY1305" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_TLS1_TXT_ECDHE_RSA_WITH_CHACHA20_POLY1305)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("TLS_method" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_TLS_METHOD)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("X509_STORE_CTX_get0_cert" "openssl/x509_vfy.h" HAVE_OPENSSL_PROTOTYPE_X509_STORE_CTX_GET0_CERT)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("X509_STORE_get0_param" "openssl/x509.h" HAVE_OPENSSL_PROTOTYPE_X509_STORE_GET0_PARAM)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("X509_get_signature_nid" "openssl/x509.h" HAVE_OPENSSL_PROTOTYPE_X509_GET_SIGNATURE_NID)
++  include(CheckSymbolExists)
++  include(CheckCSourceCompiles)
++  check_symbol_exists("DH_bits" "openssl/dh.h" HAVE_OPENSSL_PROTOTYPE_DH_BITS)
++  check_symbol_exists("EVP_PKEY_RSA_PSS" "openssl/evp.h" HAVE_OPENSSL_PROTOTYPE_EVP_PKEY_RSA_PSS)
++  check_symbol_exists("EVP_PKEY_base_id" "openssl/evp.h" HAVE_OPENSSL_PROTOTYPE_EVP_PKEY_BASE_ID)
++  check_symbol_exists("NID_dsa_with_SHA512" "openssl/obj_mac.h" HAVE_OPENSSL_PROTOTYPE_NID_DSA_WITH_SHA512)
++  check_symbol_exists("NID_ecdsa_with_SHA3_256" "openssl/obj_mac.h" HAVE_OPENSSL_PROTOTYPE_NID_ECDSA_WITH_SHA3_256)
++  check_symbol_exists("NID_sha512_256WithRSAEncryption" "openssl/obj_mac.h" HAVE_OPENSSL_PROTOTYPE_NID_SHA512_256WITHRSAENCRYPTION)
++  check_symbol_exists("RAND_egd" "openssl/rand.h" HAVE_OPENSSL_PROTOTYPE_RAND_EGD)
++  check_symbol_exists("SSL_CTX_get0_param" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_CTX_GET0_PARAM)
++  check_symbol_exists("SSL_CTX_get_cert_store" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_CTX_GET_CERT_STORE)
++  check_symbol_exists("SSL_CTX_get_ciphers" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_CTX_GET_CIPHERS)
++  check_symbol_exists("SSL_CTX_set0_tmp_dh_pkey" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_CTX_SET0_TMP_DH_PKEY)
++  check_c_source_compiles("#include \nint main() {SSL_CTX_set1_curves(0,0,0); return 0;}" HAVE_OPENSSL_PROTOTYPE_SSL_CTX_SET1_CURVES)
++  check_symbol_exists("SSL_CTX_set1_sigalgs" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_CTX_SET1_SIGALGS)
++  check_c_source_compiles("#include \nint main() {SSL_CTX_set_ecdh_auto(0,0); return 0;}" HAVE_OPENSSL_PROTOTYPE_SSL_CTX_SET_ECDH_AUTO)
++  check_c_source_compiles("#include \nint main() {SSL_CTX_set_max_proto_version(0,0); return 0;}" HAVE_OPENSSL_PROTOTYPE_SSL_CTX_SET_MAX_PROTO_VERSION)
++  check_symbol_exists("SSL_CTX_set_security_level" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_CTX_SET_SECURITY_LEVEL)
++  check_symbol_exists("SSL_ERROR_WANT_ASYNC" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_ERROR_WANT_ASYNC)
++  check_symbol_exists("SSL_ERROR_WANT_ASYNC_JOB" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_ERROR_WANT_ASYNC_JOB)
++  check_symbol_exists("SSL_ERROR_WANT_CLIENT_HELLO_CB" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_ERROR_WANT_CLIENT_HELLO_CB)
++  check_symbol_exists("TLS1_3_RFC_AES_128_CCM_8_SHA256" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_TLS1_3_RFC_AES_128_CCM_8_SHA256)
++  check_symbol_exists("TLS1_3_RFC_AES_256_GCM_SHA384" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_TLS1_3_RFC_AES_256_GCM_SHA384)
++  check_symbol_exists("TLS1_3_RFC_CHACHA20_POLY1305_SHA256" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_TLS1_3_RFC_CHACHA20_POLY1305_SHA256)
++  check_symbol_exists("TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_CCM_8" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_CCM_8)
++  check_symbol_exists("TLS1_TXT_ECDHE_ECDSA_WITH_CAMELLIA_256_GCM_SHA384" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_TLS1_TXT_ECDHE_ECDSA_WITH_CAMELLIA_256_GCM_SHA384)
++  check_symbol_exists("TLS1_TXT_ECDHE_RSA_WITH_CHACHA20_POLY1305" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_TLS1_TXT_ECDHE_RSA_WITH_CHACHA20_POLY1305)
++  check_symbol_exists("TLS_method" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_TLS_METHOD)
++  check_symbol_exists("X509_STORE_CTX_get0_cert" "openssl/x509_vfy.h" HAVE_OPENSSL_PROTOTYPE_X509_STORE_CTX_GET0_CERT)
++  check_symbol_exists("X509_STORE_get0_param" "openssl/x509.h" HAVE_OPENSSL_PROTOTYPE_X509_STORE_GET0_PARAM)
++  check_symbol_exists("X509_get_signature_nid" "openssl/x509.h" HAVE_OPENSSL_PROTOTYPE_X509_GET_SIGNATURE_NID)
+ 
+   # test presence of functions, constants and macros needed for the dcmsign module
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("ASN1_STRING_get0_data" "openssl/asn1.h" HAVE_OPENSSL_PROTOTYPE_ASN1_STRING_GET0_DATA)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("EVP_PKEY_get0_EC_KEY" "openssl/evp.h" HAVE_OPENSSL_PROTOTYPE_EVP_PKEY_GET0_EC_KEY)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("EVP_PKEY_get_group_name" "openssl/evp.h" HAVE_OPENSSL_PROTOTYPE_EVP_PKEY_GET_GROUP_NAME)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("EVP_PKEY_id" "openssl/evp.h" HAVE_OPENSSL_PROTOTYPE_EVP_PKEY_ID)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("OSSL_PROVIDER_load" "openssl/provider.h" HAVE_OPENSSL_PROTOTYPE_OSSL_PROVIDER_LOAD)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("TS_STATUS_INFO_get0_failure_info" "openssl/ts.h" HAVE_OPENSSL_PROTOTYPE_TS_STATUS_INFO_GET0_FAILURE_INFO)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("TS_STATUS_INFO_get0_status" "openssl/ts.h" HAVE_OPENSSL_PROTOTYPE_TS_STATUS_INFO_GET0_STATUS)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("TS_STATUS_INFO_get0_text" "openssl/ts.h" HAVE_OPENSSL_PROTOTYPE_TS_STATUS_INFO_GET0_TEXT)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("TS_VERIFY_CTS_set_certs(0,0)" "openssl/ts.h" HAVE_OPENSSL_PROTOTYPE_TS_VERIFY_CTS_SET_CERTS)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("TS_VERIFY_CTX_set_data" "openssl/ts.h" HAVE_OPENSSL_PROTOTYPE_TS_VERIFY_CTX_SET_DATA)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("TS_VERIFY_CTX_set_flags" "openssl/ts.h" HAVE_OPENSSL_PROTOTYPE_TS_VERIFY_CTX_SET_FLAGS)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("TS_VERIFY_CTX_set_store" "openssl/ts.h" HAVE_OPENSSL_PROTOTYPE_TS_VERIFY_CTX_SET_STORE)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("X509_get0_notAfter" "openssl/x509.h" HAVE_OPENSSL_PROTOTYPE_X509_GET0_NOTAFTER)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("X509_get0_notBefore" "openssl/x509.h" HAVE_OPENSSL_PROTOTYPE_X509_GET0_NOTBEFORE)
++  check_symbol_exists("ASN1_STRING_get0_data" "openssl/asn1.h" HAVE_OPENSSL_PROTOTYPE_ASN1_STRING_GET0_DATA)
++  check_symbol_exists("EVP_PKEY_get0_EC_KEY" "openssl/evp.h" HAVE_OPENSSL_PROTOTYPE_EVP_PKEY_GET0_EC_KEY)
++  check_symbol_exists("EVP_PKEY_get_group_name" "openssl/evp.h" HAVE_OPENSSL_PROTOTYPE_EVP_PKEY_GET_GROUP_NAME)
++  check_symbol_exists("EVP_PKEY_id" "openssl/evp.h" HAVE_OPENSSL_PROTOTYPE_EVP_PKEY_ID)
++  check_symbol_exists("OSSL_PROVIDER_load" "openssl/provider.h" HAVE_OPENSSL_PROTOTYPE_OSSL_PROVIDER_LOAD)
++  check_symbol_exists("TS_STATUS_INFO_get0_failure_info" "openssl/ts.h" HAVE_OPENSSL_PROTOTYPE_TS_STATUS_INFO_GET0_FAILURE_INFO)
++  check_symbol_exists("TS_STATUS_INFO_get0_status" "openssl/ts.h" HAVE_OPENSSL_PROTOTYPE_TS_STATUS_INFO_GET0_STATUS)
++  check_symbol_exists("TS_STATUS_INFO_get0_text" "openssl/ts.h" HAVE_OPENSSL_PROTOTYPE_TS_STATUS_INFO_GET0_TEXT)
++  check_c_source_compiles("#include \nint main() {TS_VERIFY_CTS_set_certs(0,0); return 0;}" HAVE_OPENSSL_PROTOTYPE_TS_VERIFY_CTS_SET_CERTS)
++  check_symbol_exists("TS_VERIFY_CTX_set_data" "openssl/ts.h" HAVE_OPENSSL_PROTOTYPE_TS_VERIFY_CTX_SET_DATA)
++  check_symbol_exists("TS_VERIFY_CTX_set_flags" "openssl/ts.h" HAVE_OPENSSL_PROTOTYPE_TS_VERIFY_CTX_SET_FLAGS)
++  check_symbol_exists("TS_VERIFY_CTX_set_store" "openssl/ts.h" HAVE_OPENSSL_PROTOTYPE_TS_VERIFY_CTX_SET_STORE)
++  check_symbol_exists("X509_get0_notAfter" "openssl/x509.h" HAVE_OPENSSL_PROTOTYPE_X509_GET0_NOTAFTER)
++  check_symbol_exists("X509_get0_notBefore" "openssl/x509.h" HAVE_OPENSSL_PROTOTYPE_X509_GET0_NOTBEFORE)
+ 
+   # check if type EVP_MD_CTX is defined as typedef for "struct evp_md_ctx_st" (new) or "struct env_md_ctx_st" (old)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("struct evp_md_ctx_st *a; EVP_MD_CTX *b=a" "openssl/evp.h" HAVE_OPENSSL_DECLARATION_NEW_EVP_MD_CTX)
++  check_c_source_compiles("#include \nint main() {struct evp_md_ctx_st *a; EVP_MD_CTX *b=a; return 0;}" HAVE_OPENSSL_DECLARATION_NEW_EVP_MD_CTX)
+ 
+   # check if the first parameter passed to X509_ALGOR_get0() should be "const ASN1_OBJECT **" (new) or "ASN1_OBJECT **" (old)
+-  CHECK_FUNCTIONWITHHEADER_EXISTS("const ASN1_OBJECT *a; X509_ALGOR_get0(&a,0,0,0)" "openssl/x509.h" HAVE_OPENSSL_X509_ALGOR_GET0_CONST_PARAM)
++  check_c_source_compiles("#include \nint main() {const ASN1_OBJECT *a; X509_ALGOR_get0(&a,0,0,0); return 0;}" HAVE_OPENSSL_X509_ALGOR_GET0_CONST_PARAM)
+ 
+   # restore previous value of CMAKE_REQUIRED_LIBRARIES
+   set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES_TEMP})
diff --git a/recipes/dcmtk/all/patches/3.6.8-0003-fix-two-segmentation-faults.patch b/recipes/dcmtk/all/patches/3.6.8-0003-fix-two-segmentation-faults.patch
new file mode 100644
index 0000000000000..225b610e167f4
--- /dev/null
+++ b/recipes/dcmtk/all/patches/3.6.8-0003-fix-two-segmentation-faults.patch
@@ -0,0 +1,60 @@
+--- a/dcmdata/libsrc/dcelem.cc
++++ b/dcmdata/libsrc/dcelem.cc
+@@ -717,6 +717,13 @@ OFCondition DcmElement::loadValue(DcmInputStream *inStream)
+             if (isStreamNew)
+                 delete readStream;
+         }
++        else
++        {
++            errorFlag = EC_InvalidStream; // incomplete dataset read from stream
++            DCMDATA_ERROR("DcmElement: " << getTagName() << " " << getTag()
++                << " larger (" << getLengthField() << ") than remaining bytes ("
++                << getTransferredBytes() << ") in file, premature end of stream");
++        }
+     }
+     /* return result value */
+     return errorFlag;
+diff --git a/dcmnet/libsrc/dimcmd.cc b/dcmnet/libsrc/dimcmd.cc
+index 6dca39546..ffd225f4b 100644
+--- a/dcmnet/libsrc/dimcmd.cc
++++ b/dcmnet/libsrc/dimcmd.cc
+@@ -205,22 +205,25 @@ getString(DcmDataset *obj, DcmTagKey t, char *s, int maxlen, OFBool *spacePadded
+             return parseErrorWithMsg("dimcmd:getString: string too small", t);
+         } else {
+             ec =  elem->getString(aString);
+-            strncpy(s, aString, maxlen);
+-            if (spacePadded)
++            if (ec.good())
+             {
+-                /* before we remove leading and tailing spaces we want to know
+-                 * whether the string is actually space padded. Required to communicate
+-                 * with dumb peers which send space padded UIDs and fail if they
+-                 * receive correct UIDs back.
+-                 *
+-                 * This test can only detect space padded strings if
+-                 * dcmEnableAutomaticInputDataCorrection is false; otherwise the padding
+-                 * has already been removed by dcmdata at this stage.
+-                 */
+-                size_t s_len = strlen(s);
+-                if ((s_len > 0)&&(s[s_len-1] == ' ')) *spacePadded = OFTrue; else *spacePadded = OFFalse;
++                strncpy(s, aString, maxlen);
++                if (spacePadded)
++                {
++                    /* before we remove leading and tailing spaces we want to know
++                     * whether the string is actually space padded. Required to communicate
++                     * with dumb peers which send space padded UIDs and fail if they
++                     * receive correct UIDs back.
++                     *
++                     * This test can only detect space padded strings if
++                     * dcmEnableAutomaticInputDataCorrection is false; otherwise the padding
++                     * has already been removed by dcmdata at this stage.
++                     */
++                    size_t s_len = strlen(s);
++                    if ((s_len > 0)&&(s[s_len-1] == ' ')) *spacePadded = OFTrue; else *spacePadded = OFFalse;
++                }
++                DU_stripLeadingAndTrailingSpaces(s);
+             }
+-            DU_stripLeadingAndTrailingSpaces(s);
+         }
+     }
+     return (ec.good())? ec : DIMSE_PARSEFAILED;
\ No newline at end of file
diff --git a/recipes/dcmtk/all/patches/3.6.8-0004-disable-oficonv-passthrough.patch b/recipes/dcmtk/all/patches/3.6.8-0004-disable-oficonv-passthrough.patch
new file mode 100644
index 0000000000000..535c23f69d8b9
--- /dev/null
+++ b/recipes/dcmtk/all/patches/3.6.8-0004-disable-oficonv-passthrough.patch
@@ -0,0 +1,35 @@
+--- a/config/docs/macros.txt
++++ b/config/docs/macros.txt
+@@ -70,6 +70,20 @@ DCMTK_ENABLE_ACR_NEMA_DATASET_PRESENT_COMPATIBILITY
+     if backwards compatibility with ACR-NEMA is desired. If this is
+     important, compile with this macro enabled.
+
++DCMTK_ENABLE_ICONV_PASSTHROUGH
++  Affected: oficonv
++  Type of modification: Activates feature
++  Explanation: If compiled with this macro, the oficonv libary will
++    simply copy input to output during a character set conversion if
++    input and output encoding are the same. This is more efficient, but
++    means that in invalid byte sequences in the source will remain
++    undetected and copied to the target, whereas the default behaviour
++    would detect this and stop the conversion. It is also incompatible
++    with the behaviour of the GNU iconv library.
++    In DCMTK 3.6.8, this feature was always enabled.
++    PATCH(conan-center-index): disabled by default in 3.6.8 as well to 
++    avoid regression https://support.dcmtk.org/redmine/issues/1143
++
+ DCMTK_ENABLE_STRICT_HUFFMAN_TABLE_CHECK
+   Affected: dcmjpeg
+   Type of modification: Activates feature
+--- a/oficonv/libsrc/citrus_iconv.c
++++ b/oficonv/libsrc/citrus_iconv.c
+@@ -139,8 +139,7 @@ open_shared(struct _citrus_iconv_shared * * rci,
+     size_t len_convname;
+     int ret;
+
+-#define INCOMPATIBLE_WITH_GNU_ICONV
+-#ifdef INCOMPATIBLE_WITH_GNU_ICONV
++#ifdef DCMTK_ENABLE_ICONV_PASSTHROUGH
+     /* 
+      * Use a pass-through when the (src,dest) encodings are the same.
+      */
\ No newline at end of file
diff --git a/recipes/dcmtk/all/test_package/CMakeLists.txt b/recipes/dcmtk/all/test_package/CMakeLists.txt
index b3dafcdddcb7d..0e71714e4b9f5 100644
--- a/recipes/dcmtk/all/test_package/CMakeLists.txt
+++ b/recipes/dcmtk/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.15)
+project(test_package LANGUAGES CXX)
 
 find_package(DCMTK REQUIRED CONFIG)
 
 add_executable(${PROJECT_NAME} test_package.cpp)
-target_link_libraries(${PROJECT_NAME} dcmdata)
-set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11)
+target_link_libraries(${PROJECT_NAME} PRIVATE DCMTK::dcmdata)
+target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11)
diff --git a/recipes/dcmtk/all/test_package/conanfile.py b/recipes/dcmtk/all/test_package/conanfile.py
index 38f4483872d47..0a6bc68712d90 100644
--- a/recipes/dcmtk/all/test_package/conanfile.py
+++ b/recipes/dcmtk/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/dcmtk/config.yml b/recipes/dcmtk/config.yml
index ebad15c840829..b11effedf16d6 100644
--- a/recipes/dcmtk/config.yml
+++ b/recipes/dcmtk/config.yml
@@ -1,5 +1,5 @@
 versions:
-  "3.6.6":
+  "3.6.8":
     folder: "all"
-  "3.6.5":
+  "3.6.7":
     folder: "all"
diff --git a/recipes/dd-opentracing-cpp/all/CMakeLists.txt b/recipes/dd-opentracing-cpp/all/CMakeLists.txt
deleted file mode 100644
index 4adab61a177bf..0000000000000
--- a/recipes/dd-opentracing-cpp/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(CONAN_COMPILER MATCHES "clang" AND CONAN_COMPILER_VERSION VERSION_LESS "4.0")
-    add_compile_options(-ftemplate-depth=1024)
-endif()
-
-add_subdirectory(source_subfolder)
diff --git a/recipes/dd-opentracing-cpp/all/conandata.yml b/recipes/dd-opentracing-cpp/all/conandata.yml
index 5c4a8f88936e6..d9d5dcbf278c1 100644
--- a/recipes/dd-opentracing-cpp/all/conandata.yml
+++ b/recipes/dd-opentracing-cpp/all/conandata.yml
@@ -1,8 +1,12 @@
 sources:
+  "1.3.7":
+    url: "https://github.com/DataDog/dd-opentracing-cpp/archive/refs/tags/v1.3.7.tar.gz"
+    sha256: "8d39c6b23f941a2d11571daaccc04e69539a3fcbcc50a631837560d5861a7b96"
   "1.3.0":
-    url: https://github.com/DataDog/dd-opentracing-cpp/archive/refs/tags/v1.3.0.tar.gz
-    sha256: 16aad0c0daed054d4bcdf68cf069956e8d3b0c60a33c2162ad655a17b33b65e4
+    url: "https://github.com/DataDog/dd-opentracing-cpp/archive/refs/tags/v1.3.0.tar.gz"
+    sha256: "16aad0c0daed054d4bcdf68cf069956e8d3b0c60a33c2162ad655a17b33b65e4"
 patches:
+  "1.3.7":
+    - patch_file: "patches/1.3.7/0001-Find-packages-setup.patch"
   "1.3.0":
-    - base_path: "source_subfolder"
-      patch_file: "patches/0001-Find-packages-setup.patch"
+    - patch_file: "patches/1.3.0/0001-Find-packages-setup.patch"
diff --git a/recipes/dd-opentracing-cpp/all/conanfile.py b/recipes/dd-opentracing-cpp/all/conanfile.py
index 39cb79ab41f5f..953c532aa7291 100644
--- a/recipes/dd-opentracing-cpp/all/conanfile.py
+++ b/recipes/dd-opentracing-cpp/all/conanfile.py
@@ -1,17 +1,24 @@
-from conans import ConanFile, CMake, 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.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
+
+required_conan_version = ">=1.53.0"
 
 
 class DatadogOpenTracingConan(ConanFile):
     name = "dd-opentracing-cpp"
     description = "Monitoring service for cloud-scale applications based on OpenTracing "
     license = "Apache-2.0"
-    topics = ("instrumentration", "monitoring", "security", "tracing")
-    homepage = "https://github.com/DataDog/dd-opentracing-cpp"
     url = "https://github.com/conan-io/conan-center-index"
+    homepage = "https://github.com/DataDog/dd-opentracing-cpp"
+    topics = ("instrumentation", "monitoring", "security", "tracing")
 
+    package_type = "library"
     settings = "os", "arch", "compiler", "build_type"
     options = {
         "shared": [True, False],
@@ -22,30 +29,18 @@ class DatadogOpenTracingConan(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"
-
     @property
     def _compilers_minimum_version(self):
         return {
             "gcc": "5",
             "Visual Studio": "15",
+            "msvc": "191",
             "clang": "3.4",
             "apple-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":
@@ -53,68 +48,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("opentracing-cpp/1.6.0")
-        self.requires("zlib/1.2.11")
-        self.requires("libcurl/7.80.0")
-        self.requires("msgpack/3.3.0")
-        self.requires("nlohmann_json/3.10.5")
+        self.requires("opentracing-cpp/1.6.0", transitive_headers=True, transitive_libs=True)
+        self.requires("zlib/[>=1.2.11 <2]")
+        self.requires("libcurl/[>=7.78 <9]")
+        self.requires("msgpack-cxx/6.1.0")
+        self.requires("nlohmann_json/3.11.2")
+
+    @property
+    def _min_cppstd(self):
+        return 14
 
     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("Datadog-opentracing requires C++14, which your compiler does not support.")
-        else:
-            self.output.warn("Datadog-opentracing requires C++14. Your compiler is unknown. Assuming it supports C++14.")
+            if 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], strip_root=True, destination=self._source_subfolder)
+        get(self, **self.conan_data["sources"][self.version], strip_root=True)
+
+    def generate(self):
+        tc = CMakeToolchain(self)
+        tc.variables["BUILD_PLUGIN"] = False
+        tc.variables["BUILD_SHARED"] = self.options.shared
+        tc.variables["BUILD_STATIC"] = not self.options.shared
+        tc.variables["BUILD_TESTING"] = False
+        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 _configure_cmake(self):
-        if self._cmake:
-            return self._cmake
-        self._cmake = CMake(self)
-        self._cmake.definitions["BUILD_PLUGIN"] = False
-        self._cmake.definitions["BUILD_SHARED"] = self.options.shared
-        self._cmake.definitions["BUILD_STATIC"] = not self.options.shared
-        self._cmake.definitions["BUILD_TESTING"] = False
-        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", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder)
+        cmake = CMake(self)
         cmake.install()
 
     def package_info(self):
-        # TODO: back to global scope in conan v2 once cmake_find_package_* generators removed
-        self.cpp_info.components["dd_opentracing"].libs = ["dd_opentracing"]
-        self.cpp_info.components["dd_opentracing"].defines.append(
-            "DD_OPENTRACING_SHARED" if self.options.shared else "DD_OPENTRACING_STATIC"
-        )
+        self.cpp_info.libs = ["dd_opentracing"]
+        self.cpp_info.defines.append("DD_OPENTRACING_SHARED" if self.options.shared else "DD_OPENTRACING_STATIC")
         if self.settings.os in ("Linux", "FreeBSD"):
-            self.cpp_info.components["dd_opentracing"].system_libs.append("pthread")
-
-        # TODO: to remove in conan v2 once cmake_find_package_* generators removed.
-        #       Do not support these names in CMakeDeps, it was a mistake, upstream doesn't export targets
-        self.cpp_info.names["cmake_find_package"] = "DataDogOpenTracing"
-        self.cpp_info.names["cmake_find_package_multi"] = "DataDogOpenTracing"
-        target_suffix = "" if self.options.shared else "-static"
-        self.cpp_info.components["dd_opentracing"].names["cmake_find_package"] = "dd_opentracing" + target_suffix
-        self.cpp_info.components["dd_opentracing"].names["cmake_find_package_multi"] = "dd_opentracing" + target_suffix
-        self.cpp_info.components["dd_opentracing"].requires = [
-            "opentracing-cpp::opentracing-cpp", "zlib::zlib", "libcurl::libcurl",
-            "msgpack::msgpack", "nlohmann_json::nlohmann_json",
-        ]
+            self.cpp_info.system_libs.append("pthread")
diff --git a/recipes/dd-opentracing-cpp/all/patches/0001-Find-packages-setup.patch b/recipes/dd-opentracing-cpp/all/patches/0001-Find-packages-setup.patch
deleted file mode 100644
index 3308c5a043699..0000000000000
--- a/recipes/dd-opentracing-cpp/all/patches/0001-Find-packages-setup.patch
+++ /dev/null
@@ -1,65 +0,0 @@
----
- CMakeLists.txt | 30 ++++++++++--------------------
- 1 file changed, 10 insertions(+), 20 deletions(-)
-
---- CMakeLists.txt
-+++ CMakeLists.txt
-@@ -34,17 +34,12 @@ include_directories(include)
- set(CMAKE_LIBRARY_PATH deps/lib)
- 
- # Dependencies
--find_path(OPENTRACING_INCLUDE_DIR NAMES opentracing/tracer.h)
--find_library(OPENTRACING_LIB opentracing)
-+find_package(OpenTracing REQUIRED)
- find_package(ZLIB REQUIRED)
--find_library(MSGPACK_LIB msgpack)
--find_package(CURL)
-+find_package(msgpack REQUIRED)
-+find_package(CURL REQUIRED)
- find_package(Threads REQUIRED)
- 
--# Code Sanitizers
--set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/3rd_party/sanitizers-cmake" ${CMAKE_MODULE_PATH})
--find_package(Sanitizers)
--
- # Code
- install(DIRECTORY include/datadog DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
- file(GLOB DD_OPENTRACING_SOURCES "src/*.cpp")
-@@ -58,29 +53,24 @@ else()
- endif()
- 
- # Outputs
--set(DATADOG_LINK_LIBRARIES ${OPENTRACING_LIB} ${CURL_LIBRARIES} ${ZLIB_LIBRARIES} Threads::Threads)
-+set(DATADOG_LINK_LIBRARIES OpenTracing::OpenTracing CURL::CURL msgpack::msgpack ZLIB::ZLIB Threads::Threads)
- 
- ## Shared lib
- if(BUILD_SHARED)
-   add_library(dd_opentracing SHARED ${DD_OPENTRACING_SOURCES})
--  add_sanitizers(dd_opentracing)
-   target_link_libraries(dd_opentracing ${DATADOG_LINK_LIBRARIES})
-   set_target_properties(dd_opentracing PROPERTIES SOVERSION ${SOVERSION})
--  target_compile_definitions(dd_opentracing PRIVATE DD_OPENTRACING_SHARED)
--  install(TARGETS dd_opentracing
--          LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
--          ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
-+  target_compile_definitions(dd_opentracing PUBLIC DD_OPENTRACING_SHARED)
-+  install(TARGETS dd_opentracing)
- endif()
- 
- ## Static lib
- if(BUILD_STATIC)
-   add_library(dd_opentracing-static STATIC ${DD_OPENTRACING_SOURCES})
--  add_sanitizers(dd_opentracing-static)
--  set_target_properties(dd_opentracing-static PROPERTIES OUTPUT_NAME dd_opentracing POSITION_INDEPENDENT_CODE ON)
--  target_compile_definitions(dd_opentracing PRIVATE DD_OPENTRACING_STATIC)
--  install(TARGETS dd_opentracing-static
--          LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
--          ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
-+  target_link_libraries(dd_opentracing-static ${DATADOG_LINK_LIBRARIES})
-+  set_target_properties(dd_opentracing-static PROPERTIES OUTPUT_NAME dd_opentracing)
-+  target_compile_definitions(dd_opentracing-static PUBLIC DD_OPENTRACING_STATIC)
-+  install(TARGETS dd_opentracing-static)
- endif()
- 
- ## Plugin
-
diff --git a/recipes/dd-opentracing-cpp/all/patches/1.3.0/0001-Find-packages-setup.patch b/recipes/dd-opentracing-cpp/all/patches/1.3.0/0001-Find-packages-setup.patch
new file mode 100644
index 0000000000000..da57cbb9c9845
--- /dev/null
+++ b/recipes/dd-opentracing-cpp/all/patches/1.3.0/0001-Find-packages-setup.patch
@@ -0,0 +1,54 @@
+--- CMakeLists.txt
++++ CMakeLists.txt
+@@ -34,16 +34,11 @@
+ set(CMAKE_LIBRARY_PATH deps/lib)
+ 
+ # Dependencies
+-find_path(OPENTRACING_INCLUDE_DIR NAMES opentracing/tracer.h)
+-find_library(OPENTRACING_LIB opentracing)
++find_package(OpenTracing REQUIRED CONFIG)
+ find_package(ZLIB REQUIRED)
+-find_library(MSGPACK_LIB msgpack)
+-find_package(CURL)
++find_package(msgpack REQUIRED CONFIG)
++find_package(CURL REQUIRED CONFIG)
+ find_package(Threads REQUIRED)
+-
+-# Code Sanitizers
+-set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/3rd_party/sanitizers-cmake" ${CMAKE_MODULE_PATH})
+-find_package(Sanitizers)
+ 
+ # Code
+ install(DIRECTORY include/datadog DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
+@@ -58,16 +53,16 @@
+ endif()
+ 
+ # Outputs
+-set(DATADOG_LINK_LIBRARIES ${OPENTRACING_LIB} ${CURL_LIBRARIES} ${ZLIB_LIBRARIES} Threads::Threads)
++set(DATADOG_LINK_LIBRARIES OpenTracing::OpenTracing CURL::libcurl msgpack-cxx ZLIB::ZLIB Threads::Threads)
+ 
+ ## Shared lib
+ if(BUILD_SHARED)
+   add_library(dd_opentracing SHARED ${DD_OPENTRACING_SOURCES})
+-  add_sanitizers(dd_opentracing)
+   target_link_libraries(dd_opentracing ${DATADOG_LINK_LIBRARIES})
+   set_target_properties(dd_opentracing PROPERTIES SOVERSION ${SOVERSION})
+   target_compile_definitions(dd_opentracing PRIVATE DD_OPENTRACING_SHARED)
+   install(TARGETS dd_opentracing
++          RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+           LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+           ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
+ endif()
+@@ -75,9 +70,9 @@
+ ## Static lib
+ if(BUILD_STATIC)
+   add_library(dd_opentracing-static STATIC ${DD_OPENTRACING_SOURCES})
+-  add_sanitizers(dd_opentracing-static)
+-  set_target_properties(dd_opentracing-static PROPERTIES OUTPUT_NAME dd_opentracing POSITION_INDEPENDENT_CODE ON)
+-  target_compile_definitions(dd_opentracing PRIVATE DD_OPENTRACING_STATIC)
++  target_link_libraries(dd_opentracing-static ${DATADOG_LINK_LIBRARIES})
++  set_target_properties(dd_opentracing-static PROPERTIES OUTPUT_NAME dd_opentracing)
++  target_compile_definitions(dd_opentracing-static PUBLIC DD_OPENTRACING_STATIC)
+   install(TARGETS dd_opentracing-static
+           LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+           ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
diff --git a/recipes/dd-opentracing-cpp/all/patches/1.3.7/0001-Find-packages-setup.patch b/recipes/dd-opentracing-cpp/all/patches/1.3.7/0001-Find-packages-setup.patch
new file mode 100644
index 0000000000000..9c70c924a04a6
--- /dev/null
+++ b/recipes/dd-opentracing-cpp/all/patches/1.3.7/0001-Find-packages-setup.patch
@@ -0,0 +1,60 @@
+--- CMakeLists.txt
++++ CMakeLists.txt
+@@ -35,15 +35,10 @@
+ set(CMAKE_LIBRARY_PATH deps/lib)
+ 
+ # Dependencies
+-find_path(OPENTRACING_INCLUDE_DIR NAMES opentracing/tracer.h)
+-find_library(OPENTRACING_LIB opentracing)
+-find_library(MSGPACK_LIB msgpack)
+-find_package(CURL)
++find_package(OpenTracing REQUIRED CONFIG)
++find_package(msgpack REQUIRED CONFIG)
++find_package(CURL REQUIRED CONFIG)
+ find_package(Threads REQUIRED)
+-
+-# Code Sanitizers
+-set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/3rd_party/sanitizers-cmake" ${CMAKE_MODULE_PATH})
+-find_package(Sanitizers)
+ 
+ # Code
+ install(DIRECTORY include/datadog DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
+@@ -64,12 +59,12 @@
+ if(BUILD_COVERAGE)
+   set(COVERAGE_LIBRARIES gcov)
+ endif()
+-set(DATADOG_LINK_LIBRARIES ${OPENTRACING_LIB} ${CURL_LIBRARIES} Threads::Threads ${COVERAGE_LIBRARIES})
++set(DATADOG_LINK_LIBRARIES OpenTracing::OpenTracing CURL::libcurl ${msgpack_LIBRARIES} ZLIB::ZLIB Threads::Threads)
++include_directories(${msgpack_INCLUDE_DIRS})
+ 
+ ## Shared lib
+ if(BUILD_SHARED)
+   add_library(dd_opentracing SHARED ${DD_OPENTRACING_SOURCES})
+-  add_sanitizers(dd_opentracing)
+   if(BUILD_COVERAGE)
+     target_link_options(dd_opentracing PRIVATE -fprofile-arcs -ftest-coverage)
+   endif()
+@@ -77,6 +72,7 @@
+   set_target_properties(dd_opentracing PROPERTIES SOVERSION ${SOVERSION})
+   target_compile_definitions(dd_opentracing PUBLIC DD_OPENTRACING_SHARED)
+   install(TARGETS dd_opentracing
++          RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+           LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+           ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
+ endif()
+@@ -84,13 +80,10 @@
+ ## Static lib
+ if(BUILD_STATIC)
+   add_library(dd_opentracing-static STATIC ${DD_OPENTRACING_SOURCES})
+-  add_sanitizers(dd_opentracing-static)
+   target_link_libraries(dd_opentracing-static ${DATADOG_LINK_LIBRARIES})
+-  set_target_properties(dd_opentracing-static PROPERTIES OUTPUT_NAME dd_opentracing POSITION_INDEPENDENT_CODE ON)
++  set_target_properties(dd_opentracing-static PROPERTIES OUTPUT_NAME dd_opentracing)
+   target_compile_definitions(dd_opentracing-static PUBLIC DD_OPENTRACING_STATIC)
+-  install(TARGETS dd_opentracing-static
+-          LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+-          ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
++  install(TARGETS dd_opentracing-static)
+ endif()
+ 
+ ## Object lib
diff --git a/recipes/dd-opentracing-cpp/all/test_package/CMakeLists.txt b/recipes/dd-opentracing-cpp/all/test_package/CMakeLists.txt
index 61e5eac8d9ed0..f80f836e06bd4 100644
--- a/recipes/dd-opentracing-cpp/all/test_package/CMakeLists.txt
+++ b/recipes/dd-opentracing-cpp/all/test_package/CMakeLists.txt
@@ -1,9 +1,8 @@
-cmake_minimum_required(VERSION 3.1)
+cmake_minimum_required(VERSION 3.15)
 project(test_package CXX)
 
-include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
-conan_basic_setup()
+find_package(dd-opentracing-cpp REQUIRED CONFIG)
 
 add_executable(${PROJECT_NAME} test_package.cpp)
-target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS})
+target_link_libraries(${PROJECT_NAME} PRIVATE dd-opentracing-cpp::dd-opentracing-cpp)
 set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14)
diff --git a/recipes/dd-opentracing-cpp/all/test_package/conanfile.py b/recipes/dd-opentracing-cpp/all/test_package/conanfile.py
index 5c09494bc67c0..ef5d7042163ec 100644
--- a/recipes/dd-opentracing-cpp/all/test_package/conanfile.py
+++ b/recipes/dd-opentracing-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"
+    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.bindir, "test_package")
+            self.run(bin_path, env="conanrun")
diff --git a/recipes/dd-opentracing-cpp/all/test_v1_package/CMakeLists.txt b/recipes/dd-opentracing-cpp/all/test_v1_package/CMakeLists.txt
new file mode 100644
index 0000000000000..91630d79f4abb
--- /dev/null
+++ b/recipes/dd-opentracing-cpp/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/dd-opentracing-cpp/all/test_v1_package/conanfile.py b/recipes/dd-opentracing-cpp/all/test_v1_package/conanfile.py
new file mode 100644
index 0000000000000..38f4483872d47
--- /dev/null
+++ b/recipes/dd-opentracing-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/dd-opentracing-cpp/config.yml b/recipes/dd-opentracing-cpp/config.yml
index 426a0e4c79e9b..670c8dce3f891 100644
--- a/recipes/dd-opentracing-cpp/config.yml
+++ b/recipes/dd-opentracing-cpp/config.yml
@@ -1,3 +1,5 @@
 versions:
+  "1.3.7":
+    folder: all
   "1.3.0":
     folder: all
diff --git a/recipes/debug_assert/all/conandata.yml b/recipes/debug_assert/all/conandata.yml
index cfa7ab5250ed4..dc2038ed34a68 100644
--- a/recipes/debug_assert/all/conandata.yml
+++ b/recipes/debug_assert/all/conandata.yml
@@ -1,4 +1,7 @@
 sources:
-  '1.3.3':
-    url: https://github.com/foonathan/debug_assert/archive/v1.3.3.zip
-    sha256: c0871c7bb8d7e0f36cfae9a5ba526ea0c0fcaa41203ffb4280de27cb030e7383
+  "1.3.4":
+    url: "https://github.com/foonathan/debug_assert/archive/v1.3.4.zip"
+    sha256: "e29925b1b51e10b46e8c4f3d57a86db6a7ebc7cdec53fe30c1b0ca22ef845f43"
+  "1.3.3":
+    url: "https://github.com/foonathan/debug_assert/archive/v1.3.3.zip"
+    sha256: "c0871c7bb8d7e0f36cfae9a5ba526ea0c0fcaa41203ffb4280de27cb030e7383"
diff --git a/recipes/debug_assert/all/conanfile.py b/recipes/debug_assert/all/conanfile.py
index 7c5ec7a1005be..6ffe03cd97e25 100644
--- a/recipes/debug_assert/all/conanfile.py
+++ b/recipes/debug_assert/all/conanfile.py
@@ -1,35 +1,50 @@
-from conans import ConanFile, tools
 import os
 
-class DebugAssert(ConanFile):
-    name = 'debug_assert'
-    description = 'Simple, flexible and modular assertion macro'
-    url = 'https://github.com/conan-io/conan-center-index'
-    homepage = 'http://foonathan.net/blog/2016/09/16/assertions.html'
-    license = 'Zlib'
-    topics = 'conan', 'assert', 'debugging', 'utilities'
+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
+
+required_conan_version = ">=1.52.0"
 
-    settings = 'compiler'
 
+class DebugAssert(ConanFile):
+    name = "debug_assert"
+    description = "Simple, flexible and modular assertion macro"
+    license = "Zlib"
+    url = "https://github.com/conan-io/conan-center-index"
+    homepage = "http://foonathan.net/blog/2016/09/16/assertions.html"
+    topics = ("assert", "debugging", "utilities", "header-only")
+
+    package_type = "header-library"
+    settings = "os", "arch", "compiler", "build_type"
     no_copy_source = True
-    _source_subfolder = 'source_subfolder'
 
     @property
-    def _repo_folder(self):
-        return os.path.join(self.source_folder, self._source_subfolder)
+    def _min_cppstd(self):
+        return 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)
+    def layout(self):
+        basic_layout(self, src_folder="src")
+
+    def package_id(self):
+        self.info.clear()
 
-    def configure(self):
-        if self.settings.compiler.get_safe("cppstd"):
-            tools.check_min_cppstd(self, '11')
+    def validate(self):
+        if self.settings.get_safe("compiler.cppstd"):
+            check_min_cppstd(self, self._min_cppstd)
 
-    def package(self):
-        self.copy("*LICENSE", dst="licenses", keep_path=False)
-        self.copy("debug_assert.hpp", src=self._repo_folder, dst='include/')
+    def source(self):
+        get(self, **self.conan_data["sources"][self.version], strip_root=True)
 
-    def package_id(self):
-        self.info.header_only()
+    def package(self):
+        copy(self, "*LICENSE",
+             dst=os.path.join(self.package_folder, "licenses"),
+             src=self.source_folder, keep_path=False)
+        copy(self, "debug_assert.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/debug_assert/all/test_package/CMakeLists.txt b/recipes/debug_assert/all/test_package/CMakeLists.txt
index 33ae887aa6aea..57219dd9b2fc5 100644
--- a/recipes/debug_assert/all/test_package/CMakeLists.txt
+++ b/recipes/debug_assert/all/test_package/CMakeLists.txt
@@ -1,9 +1,8 @@
-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()
+find_package(debug_assert REQUIRED CONFIG)
 
 add_executable(${PROJECT_NAME} test_package.cpp)
-target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS})
+target_link_libraries(${PROJECT_NAME} PRIVATE debug_assert::debug_assert)
 set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11)
diff --git a/recipes/debug_assert/all/test_package/conanfile.py b/recipes/debug_assert/all/test_package/conanfile.py
index bd7165a553cf4..fae501d0afb9e 100644
--- a/recipes/debug_assert/all/test_package/conanfile.py
+++ b/recipes/debug_assert/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"
+    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.bindir, "test_package")
+            self.run(bin_path, env="conanrun")
diff --git a/recipes/debug_assert/config.yml b/recipes/debug_assert/config.yml
index 416be34945c37..3b34bc0f54258 100644
--- a/recipes/debug_assert/config.yml
+++ b/recipes/debug_assert/config.yml
@@ -1,3 +1,5 @@
 versions:
-  '1.3.3':
+  "1.3.4":
+    folder: all
+  "1.3.3":
     folder: all
diff --git a/recipes/decimal_for_cpp/all/conanfile.py b/recipes/decimal_for_cpp/all/conanfile.py
index 3e6a2b2a8d7a3..52caed052e558 100644
--- a/recipes/decimal_for_cpp/all/conanfile.py
+++ b/recipes/decimal_for_cpp/all/conanfile.py
@@ -10,21 +10,21 @@ class DecimalforcppConan(ConanFile):
     name = "decimal_for_cpp"
     description = "Decimal data type support, for COBOL-like fixed-point operations on currency values."
     license = "BSD-3-Clause"
-    topics = ("decimal_for_cpp", "currency", "money-library", "decimal-numbers")
+    topics = ("currency", "money-library", "decimal-numbers")
     homepage = "https://github.com/vpiotr/decimal_for_cpp"
     url = "https://github.com/conan-io/conan-center-index"
+    package_type = "header-library"
     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
@@ -35,6 +35,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/decimal_for_cpp/all/test_package/conanfile.py b/recipes/decimal_for_cpp/all/test_package/conanfile.py
index d120a992c06a6..0a6bc68712d90 100644
--- a/recipes/decimal_for_cpp/all/test_package/conanfile.py
+++ b/recipes/decimal_for_cpp/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/decimal_for_cpp/all/test_v1_package/CMakeLists.txt b/recipes/decimal_for_cpp/all/test_v1_package/CMakeLists.txt
index 99324bd86f533..be00a8c7f57c7 100644
--- a/recipes/decimal_for_cpp/all/test_v1_package/CMakeLists.txt
+++ b/recipes/decimal_for_cpp/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(decimal_for_cpp REQUIRED CONFIG)
-
-add_executable(${PROJECT_NAME} ../test_package/test_package.cpp)
-target_link_libraries(${PROJECT_NAME} decimal_for_cpp::decimal_for_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/deco/all/conanfile.py b/recipes/deco/all/conanfile.py
index 3760e5bb68e07..29a4d2480e3aa 100644
--- a/recipes/deco/all/conanfile.py
+++ b/recipes/deco/all/conanfile.py
@@ -1,56 +1,82 @@
-from conans import ConanFile, 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.files import copy, get
+from conan.tools.layout import basic_layout
+from conan.tools.scm import Version
+
+required_conan_version = ">=1.52.0"
+
+
 class DecoConan(ConanFile):
     name = "deco"
-    license = "Apache-2.0-WITH-LLVM-exception"
     description = "Delimiter Collision Free Format"
-    topics = ("serialization")
-    homepage = "https://github.com/Enhex/Deco"
+    license = "Apache-2.0-WITH-LLVM-exception"
     url = "https://github.com/conan-io/conan-center-index"
+    homepage = "https://github.com/Enhex/Deco"
+    topics = ("serialization", "header-only")
+
+    package_type = "header-library"
+    settings = "os", "arch", "compiler", "build_type"
     no_copy_source = True
-    settings = ("compiler", "build_type", "os", "arch")
-    requires = (
-        "enhex-generic_serialization/1.0.0",
-        "enhex-strong_type/1.0.0",
-        "boost/1.79.0",
-        "rang/3.2",
-    )
 
     @property
-    def _source_subfolder(self):
-        return "source_subfolder"
-
-    def validate(self):
-        if self.settings.compiler.get_safe("cppstd"):
-            tools.check_min_cppstd(self, 17)
+    def _min_cppstd(self):
+        return 17
 
-        minimal_version = {
+    @property
+    def _compilers_minimum_version(self):
+        return {
             "Visual Studio": "15",
+            "msvc": "191",
             "gcc": "7",
             "clang": "5.0",
-            "apple-clang": "9.1"
+            "apple-clang": "9.1",
         }
+
+    def layout(self):
+        basic_layout(self, src_folder="src")
+
+    def requirements(self):
+        self.requires("enhex-generic_serialization/1.0.0")
+        self.requires("enhex-strong_type/1.0.0")
+        self.requires("boost/1.82.0")
+        self.requires("rang/3.2")
+
+    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)
-        compiler_version = tools.Version(self.settings.compiler.version)
+        compiler_version = Version(self.settings.compiler.version)
 
-        if compiler not in minimal_version:
-            self.output.info("{} requires a compiler that supports at least C++17".format(self.name))
+        if compiler not in self._compilers_minimum_version:
+            self.output.info(f"{self.name} requires a compiler that supports at least C++17")
             return
 
         # Exclude compilers not supported
-        if compiler_version < minimal_version[compiler]:
-            raise ConanInvalidConfiguration("{} requires a compiler that supports at least C++17. {} {} is not".format(
-                self.name, compiler, tools.Version(self.settings.compiler.version.value)))
+        if compiler_version < self._compilers_minimum_version[compiler]:
+            raise ConanInvalidConfiguration(
+                f"{self.name} requires a compiler that supports at least C++17. "
+                f"{compiler} {Version(self.settings.compiler.version.value)} is not"
+            )
 
     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(pattern="LICENSE.txt", dst="licenses", src=self._source_subfolder)
-        self.copy(pattern="*", dst="include", src=os.path.join(self._source_subfolder, "include"))
+        copy(self, "LICENSE.txt",
+             dst=os.path.join(self.package_folder, "licenses"),
+             src=self.source_folder)
+        copy(self, "*",
+             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/deco/all/test_package/CMakeLists.txt b/recipes/deco/all/test_package/CMakeLists.txt
index 00c3587be1a63..c3b92714405e8 100644
--- a/recipes/deco/all/test_package/CMakeLists.txt
+++ b/recipes/deco/all/test_package/CMakeLists.txt
@@ -1,11 +1,8 @@
-cmake_minimum_required(VERSION 3.1)
-project(PackageTest CXX)
-
-include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
-conan_basic_setup(TARGETS)
+cmake_minimum_required(VERSION 3.15)
+project(test_package CXX)
 
 find_package(deco CONFIG REQUIRED)
 
-add_executable(example example.cpp)
-target_link_libraries(example deco::deco)
-set_target_properties(example PROPERTIES CXX_STANDARD 17)
+add_executable(test_package test_package.cpp)
+target_link_libraries(test_package deco::deco)
+set_target_properties(test_package PROPERTIES CXX_STANDARD 17)
diff --git a/recipes/deco/all/test_package/conanfile.py b/recipes/deco/all/test_package/conanfile.py
index f735734fbcfa9..ef5d7042163ec 100644
--- a/recipes/deco/all/test_package/conanfile.py
+++ b/recipes/deco/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 DecoTestConan(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 +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.bindir, "test_package")
+            self.run(bin_path, env="conanrun")
diff --git a/recipes/deco/all/test_package/example.cpp b/recipes/deco/all/test_package/test_package.cpp
similarity index 100%
rename from recipes/deco/all/test_package/example.cpp
rename to recipes/deco/all/test_package/test_package.cpp
diff --git a/recipes/deco/all/test_v1_package/CMakeLists.txt b/recipes/deco/all/test_v1_package/CMakeLists.txt
new file mode 100644
index 0000000000000..91630d79f4abb
--- /dev/null
+++ b/recipes/deco/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/deco/all/test_v1_package/conanfile.py b/recipes/deco/all/test_v1_package/conanfile.py
new file mode 100644
index 0000000000000..f64055b093b4d
--- /dev/null
+++ b/recipes/deco/all/test_v1_package/conanfile.py
@@ -0,0 +1,18 @@
+import os
+
+from conans import ConanFile, CMake, tools
+
+
+class DecoTestConan(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/dependencies/all/conandata.yml b/recipes/dependencies/all/conandata.yml
new file mode 100644
index 0000000000000..b54b3a369232f
--- /dev/null
+++ b/recipes/dependencies/all/conandata.yml
@@ -0,0 +1,11 @@
+sources:
+  "1.11.1":
+    "x86_64":
+      url: "https://github.com/lucasg/Dependencies/releases/download/v1.11.1/Dependencies_x64_Release.zip"
+      sha256: "7d22dc00f1c09fd4415d48ad74d1cf801893e83b9a39944b0fce6dea7ceaea99"
+    "x86":
+      url: "https://github.com/lucasg/Dependencies/releases/download/v1.11.1/Dependencies_x86_Release.zip"
+      sha256: "3e6bc62b4163c4e8035e8a597515c116343fcb76fa4315317c3cafe0bdc9e257"
+    "license":
+      url: "https://raw.githubusercontent.com/lucasg/Dependencies/v1.11.1/LICENSE"
+      sha256: "5d7cbf9b08285c1f89e4f4f1341090c662f4078dbf7ce8a7d392d2482e550fb6"
diff --git a/recipes/dependencies/all/conanfile.py b/recipes/dependencies/all/conanfile.py
new file mode 100644
index 0000000000000..f0b08ddbf4d87
--- /dev/null
+++ b/recipes/dependencies/all/conanfile.py
@@ -0,0 +1,50 @@
+from conan import ConanFile
+from conan.errors import ConanInvalidConfiguration
+from conan.tools.files import copy, get, download
+import os
+
+required_conan_version = ">=1.47.0"
+
+
+class PackageConan(ConanFile):
+    name = "dependencies"
+    description = ("Dependencies can help Windows developers troubleshooting their DLL-loading dependency issues. "
+                   "It is a rewrite of the legacy Dependency Walker software, which was shipped along Windows SDKs, "
+                   "but whose development stopped around 2006.")
+    license = "MIT"
+    url = "https://github.com/conan-io/conan-center-index"
+    homepage = "https://github.com/lucasg/Dependencies"
+    topics = ("windows", "dll", "debugging", "pre-built")
+    package_type = "application"
+    settings = "os", "arch", "compiler", "build_type"
+
+    def package_id(self):
+        del self.info.settings.compiler
+        del self.info.settings.build_type
+
+    def validate(self):
+        if self.settings.os != "Windows":
+            raise ConanInvalidConfiguration("Dependencies is only available on Windows")
+        if self.settings.arch not in ["x86_64", "x86"]:
+            raise ConanInvalidConfiguration("Dependencies is only available for x86_64 and x86 architectures")
+
+    def build(self):
+        get(self, **self.conan_data["sources"][self.version][str(self.settings.arch)], strip_root=False)
+        download(self, **self.conan_data["sources"][self.version]["license"], filename="LICENSE")
+
+    def package(self):
+        copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses"))
+        copy(self, "*.exe", self.source_folder, os.path.join(self.package_folder, "bin"))
+        copy(self, "*.dll", self.source_folder, os.path.join(self.package_folder, "bin"),
+             excludes=["msvcp*.dll", "msvcr*.dll", "vcruntime*.dll"])
+        copy(self, "*.config", self.source_folder, 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/dependencies/all/test_package/conanfile.py b/recipes/dependencies/all/test_package/conanfile.py
new file mode 100644
index 0000000000000..9164a4171506f
--- /dev/null
+++ b/recipes/dependencies/all/test_package/conanfile.py
@@ -0,0 +1,22 @@
+import sys
+
+from conan import ConanFile
+from conan.tools.cmake import cmake_layout
+
+
+class TestPackageConan(ConanFile):
+    settings = "os", "arch", "compiler", "build_type"
+    generators = "VirtualBuildEnv"
+    test_type = "explicit"
+
+    def layout(self):
+        cmake_layout(self)
+
+    def build_requirements(self):
+        self.tool_requires(self.tested_reference_str)
+
+    def test(self):
+        self.run(f"dependencies -chain -depth 1 {sys.executable}")
+
+        # FYI, you can get similar info with a VCVars generator and
+        # self.run(f"dumpbin /imports {sys.executable}")
diff --git a/recipes/dependencies/config.yml b/recipes/dependencies/config.yml
new file mode 100644
index 0000000000000..2e6b30b92c133
--- /dev/null
+++ b/recipes/dependencies/config.yml
@@ -0,0 +1,3 @@
+versions:
+  "1.11.1":
+    folder: all
diff --git a/recipes/depot_tools/all/conandata.yml b/recipes/depot_tools/all/conandata.yml
index 76dffe6ab4ef4..ab4c55cfe78ae 100644
--- a/recipes/depot_tools/all/conandata.yml
+++ b/recipes/depot_tools/all/conandata.yml
@@ -6,4 +6,3 @@ sources:
 patches:
   "cci.20201009":
     - patch_file: "patches/001-use-system-python.patch"
-      base_path: "source_subfolder"
diff --git a/recipes/depot_tools/all/conanfile.py b/recipes/depot_tools/all/conanfile.py
index 45bfe37d78533..a56140f75a3c9 100644
--- a/recipes/depot_tools/all/conanfile.py
+++ b/recipes/depot_tools/all/conanfile.py
@@ -1,24 +1,33 @@
 import os
 import shutil
-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
+
+required_conan_version = ">=1.52.0"
 
 
 class DepotToolsConan(ConanFile):
     name = "depot_tools"
-    url = "https://github.com/conan-io/conan-center-index"
-    homepage = "https://chromium.googlesource.com/chromium/tools/depot_tools"
     description = "Tools for working with Chromium development."
-    topics = ("depot_tools", "chromium")
     license = "BSD-3-Clause"
+    url = "https://github.com/conan-io/conan-center-index"
+    homepage = "https://chromium.googlesource.com/chromium/tools/depot_tools"
+    topics = ("chromium", "pre-built")
+
+    package_type = "application"
+    settings = "os", "arch", "compiler", "build_type"
     short_paths = True
-    no_copy_source = True
-    settings = "os", "arch", "build_type", "compiler"
-    exports_sources = ["patches/**"]
 
+    def export_sources(self):
+        export_conandata_patches(self)
+
+    def layout(self):
+        basic_layout(self, src_folder="src")
 
-    @property
-    def _source_subfolder(self):
-        return os.path.join(self.source_folder, "source_subfolder")
+    def package_id(self):
+        self.info.clear()
 
     def _dereference_symlinks(self):
         """
@@ -30,7 +39,7 @@ def _dereference_symlinks(self):
         if self.settings.os != "Windows":
             return
 
-        for root, dirs, files in os.walk(self._source_subfolder):
+        for root, dirs, files in os.walk(self.source_folder):
             symlinks = [os.path.join(root, f) for f in files if os.path.islink(os.path.join(root, f))]
             for symlink in symlinks:
                 dest = os.readlink(symlink)
@@ -38,55 +47,60 @@ def _dereference_symlinks(self):
                 shutil.copy(os.path.join(root, dest), symlink, follow_symlinks=False)
                 self.output.info("Replaced symlink '%s' with its destination file '%s'" % (symlink, dest))
 
-    def source(self):
-        tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder)
+    def build(self):
+        get(self, **self.conan_data["sources"][self.version], destination=self.source_folder)
         self._dereference_symlinks()
-
-        for patch in self.conan_data.get("patches", {}).get(self.version, []):
-            tools.patch(**patch)
-
-    def package(self):
-        self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder)
-        self.copy(pattern="*", dst="bin", src=self._source_subfolder)
-        self._fix_permissions()
+        apply_conandata_patches(self)
 
     def _fix_permissions(self):
+        if self.settings.os == "Windows":
+            return
 
         def chmod_plus_x(name):
             os.chmod(name, os.stat(name).st_mode | 0o111)
 
-        if self.settings.os != "Windows":
-            for root, _, files in os.walk(self.package_folder):
-                for file_it in files:
-                    filename = os.path.join(root, file_it)
-                    with open(filename, 'rb') as f:
-                        sig = f.read(4)
-                        if type(sig) is str:
-                            sig = [ord(s) for s in sig]
-                        if len(sig) >= 2 and sig[0] == 0x23 and sig[1] == 0x21:
-                            self.output.info('chmod on script file %s' % file_it)
-                            chmod_plus_x(filename)
-                        elif sig == [0x7F, 0x45, 0x4C, 0x46]:
-                            self.output.info('chmod on ELF file %s' % file_it)
-                            chmod_plus_x(filename)
-                        elif \
-                                sig == [0xCA, 0xFE, 0xBA, 0xBE] or \
-                                sig == [0xBE, 0xBA, 0xFE, 0xCA] or \
-                                sig == [0xFE, 0xED, 0xFA, 0xCF] or \
-                                sig == [0xCF, 0xFA, 0xED, 0xFE] or \
-                                sig == [0xFE, 0xED, 0xFA, 0xCE] or \
-                                sig == [0xCE, 0xFA, 0xED, 0xFE]:
-                            self.output.info('chmod on Mach-O file %s' % file_it)
-                            chmod_plus_x(filename)
+        for root, _, files in os.walk(self.package_folder):
+            for file_it in files:
+                filename = os.path.join(root, file_it)
+                with open(filename, "rb") as f:
+                    sig = tuple(f.read(4))
+                if len(sig) >= 2 and sig[0] == 0x23 and sig[1] == 0x21:
+                    self.output.info(f"chmod on script file {file_it}")
+                    chmod_plus_x(filename)
+                elif sig == (0x7F, 0x45, 0x4C, 0x46):
+                    self.output.info(f"chmod on ELF file {file_it}")
+                    chmod_plus_x(filename)
+                elif sig in [
+                    (0xCA, 0xFE, 0xBA, 0xBE),
+                    (0xBE, 0xBA, 0xFE, 0xCA),
+                    (0xFE, 0xED, 0xFA, 0xCF),
+                    (0xCF, 0xFA, 0xED, 0xFE),
+                    (0xFE, 0xED, 0xFA, 0xCE),
+                    (0xCE, 0xFA, 0xED, 0xFE),
+                ]:
+                    self.output.info(f"chmod on Mach-O file {file_it}")
+                    chmod_plus_x(filename)
 
-    def package_id(self):
-        del self.info.settings.arch
-        del self.info.settings.build_type
-        del self.info.settings.compiler
+    def package(self):
+        copy(self, "LICENSE",
+             dst=os.path.join(self.package_folder, "licenses"),
+             src=self.source_folder)
+        copy(self, "*",
+             dst=os.path.join(self.package_folder, "bin"),
+             src=self.source_folder)
+        self._fix_permissions()
 
     def package_info(self):
+        self.cpp_info.frameworkdirs = []
+        self.cpp_info.libdirs = []
+        self.cpp_info.resdirs = []
+        self.cpp_info.includedirs = []
+
+        self.runenv_info.define("DEPOT_TOOLS_UPDATE", "0")
+        self.buildenv_info.define("DEPOT_TOOLS_UPDATE", "0")
+
+        # TODO: Legacy, to be removed on Conan 2.0
         bin_path = os.path.join(self.package_folder, "bin")
-        self.output.info("Appending PATH env var with : {}".format(bin_path))
+        self.output.info(f"Appending PATH env var with : {bin_path}")
         self.env_info.PATH.append(bin_path)
-
         self.env_info.DEPOT_TOOLS_UPDATE = "0"
diff --git a/recipes/depot_tools/all/test_package/conanfile.py b/recipes/depot_tools/all/test_package/conanfile.py
index 38bf21d14dbee..4315ef29254a7 100644
--- a/recipes/depot_tools/all/test_package/conanfile.py
+++ b/recipes/depot_tools/all/test_package/conanfile.py
@@ -1,7 +1,18 @@
-from conans import ConanFile
+from conan import ConanFile
+from conan.tools.cmake import cmake_layout
 
 
 class TestPackageConan(ConanFile):
+    settings = "os", "arch", "compiler", "build_type"
+    generators = "VirtualBuildEnv"
+    test_type = "explicit"
+
+    def layout(self):
+        cmake_layout(self)
+
+    def build_requirements(self):
+        self.tool_requires(self.tested_reference_str)
+
     def test(self):
         # cit: Chrome Infrastructure CLI
-        self.run("cit --help", run_environment=True)
+        self.run("cit --help")
diff --git a/recipes/depot_tools/all/test_v1_package/conanfile.py b/recipes/depot_tools/all/test_v1_package/conanfile.py
new file mode 100644
index 0000000000000..38bf21d14dbee
--- /dev/null
+++ b/recipes/depot_tools/all/test_v1_package/conanfile.py
@@ -0,0 +1,7 @@
+from conans import ConanFile
+
+
+class TestPackageConan(ConanFile):
+    def test(self):
+        # cit: Chrome Infrastructure CLI
+        self.run("cit --help", run_environment=True)
diff --git a/recipes/detools/all/CMakeLists.txt b/recipes/detools/all/CMakeLists.txt
index d0a389940b0bf..1b6ae8a07224a 100644
--- a/recipes/detools/all/CMakeLists.txt
+++ b/recipes/detools/all/CMakeLists.txt
@@ -1,9 +1,22 @@
-cmake_minimum_required(VERSION 3.1)
-project(detools C)
+cmake_minimum_required(VERSION 3.15)
+project(detools LANGUAGES C)
 
-include(conanbuildinfo.cmake)
-conan_basic_setup(KEEP_RPATHS)
+find_package(heatshrink REQUIRED CONFIG)
+find_package(LibLZMA REQUIRED CONFIG)
 
-add_library(detools source_subfolder/c/detools.c)
-install(TARGETS detools DESTINATION lib)
-install(FILES source_subfolder/c/detools.h DESTINATION include)
+add_library(detools ${DETOOLS_SRC_DIR}/c/detools.c)
+target_link_libraries(detools PRIVATE
+    heatshrink::heatshrink
+    LibLZMA::LibLZMA
+)
+
+include(GNUInstallDirs)
+
+install(
+    TARGETS detools
+    DESTINATION ${CMAKE_INSTALL_LIBDIR}
+)
+install(
+    FILES ${DETOOLS_SRC_DIR}/c/detools.h
+    DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+)
diff --git a/recipes/detools/all/conandata.yml b/recipes/detools/all/conandata.yml
index 0c05a6fd77b19..5ae9db2bb11c9 100644
--- a/recipes/detools/all/conandata.yml
+++ b/recipes/detools/all/conandata.yml
@@ -1,4 +1,7 @@
 sources:
+  "0.53.0":
+    url: "https://github.com/eerimoq/detools/archive/refs/tags/0.53.0.tar.gz"
+    sha256: "9ea3b547627f5d37756023d91c701ef18fb2748b801b985e55c74c7fe8247ac2"
   "0.51.0":
-    url: "https://github.com/eerimoq/detools/archive/refs/tags/0.51.0.zip"
-    sha256: 604175d493a9df5d19e78a55cd183e9c44789ee552f24d1a2b7466d58628c1ac
+    url: "https://github.com/eerimoq/detools/archive/refs/tags/0.51.0.tar.gz"
+    sha256: "18e5f08fbc3c09ec9d805fd859838940f57a3f064724bad4897461f9a3c8f87c"
diff --git a/recipes/detools/all/conanfile.py b/recipes/detools/all/conanfile.py
index 2b8703a181ae6..d6cf90deef7f6 100644
--- a/recipes/detools/all/conanfile.py
+++ b/recipes/detools/all/conanfile.py
@@ -1,17 +1,20 @@
-import functools
-
-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
+from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
+import os
 
+required_conan_version = ">=1.53.0"
 
 class DetoolsConan(ConanFile):
     name = "detools"
     description = "Binary delta encoding"
+    license = "MIT"
     url = "https://github.com/conan-io/conan-center-index"
     homepage = "https://github.com/eerimoq/detools"
-    license = "MIT"
     topics = ("delta-compression", "delta-update", "delta-encoding",
               "ota", "bsdiff", "hdiffpatch")
+    package_type = "library"
     settings = "os", "arch", "compiler", "build_type"
     options = {
         "shared": [True, False],
@@ -22,43 +25,42 @@ class DetoolsConan(ConanFile):
         "fPIC": True,
     }
     exports_sources = "CMakeLists.txt"
-    generators = "cmake"
-    requires = ['heatshrink/0.4.1', 'lz4/1.9.3', 'xz_utils/5.2.5']
 
-    @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.libcxx")
+        self.settings.rm_safe("compiler.cppstd")
+
+    def layout(self):
+        cmake_layout(self, src_folder="src")
 
-    @property
-    def _build_subfolder(self):
-        return "build_subfolder"
+    def requirements(self):
+        self.requires('heatshrink/0.4.1', transitive_headers=True)
+        self.requires('xz_utils/5.4.4', transitive_headers=True)
 
     def validate(self):
         if self.settings.os not in ["Linux", "FreeBSD"]:
-            raise ConanInvalidConfiguration("This library is only compatible with Linux and FreeBSD")
-
-    def configure(self):
-        if self.options.shared:
-            del self.options.fPIC
-        del self.settings.compiler.libcxx
-        del self.settings.compiler.cppstd
+            raise ConanInvalidConfiguration(f"{self.ref} is only compatible with 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], 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["DETOOLS_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/detools/all/test_package/CMakeLists.txt b/recipes/detools/all/test_package/CMakeLists.txt
index 4e6b7c3b6cba8..0b2e88f45d6b3 100644
--- a/recipes/detools/all/test_package/CMakeLists.txt
+++ b/recipes/detools/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)
+cmake_minimum_required(VERSION 3.15)
+project(PackageTest LANGUAGES C)
 
 find_package(detools REQUIRED CONFIG)
 
 add_executable(test_package test_package.c)
-target_link_libraries(test_package detools::detools)
+target_link_libraries(test_package PRIVATE detools::detools)
diff --git a/recipes/detools/all/test_package/conanfile.py b/recipes/detools/all/test_package/conanfile.py
index add2424f12959..ef5d7042163ec 100644
--- a/recipes/detools/all/test_package/conanfile.py
+++ b/recipes/detools/all/test_package/conanfile.py
@@ -1,18 +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 DetoolsTestConan(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 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 layout(self):
+        cmake_layout(self)
 
     def build(self):
         cmake = CMake(self)
@@ -20,13 +21,6 @@ def build(self):
         cmake.build()
 
     def test(self):
-        if tools.cross_building(self):
-            return
-
-        bin_path = os.path.join("bin", "test_package")
-        old_path = os.path.join(self.source_folder, "old")
-        patch_path = os.path.join(self.source_folder, "patch")
-        patched_path = os.path.join(self.build_folder, "patched")
-
-        self.run(f"{bin_path} {old_path} {patch_path} {patched_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/detools/all/test_package/old b/recipes/detools/all/test_package/old
deleted file mode 100644
index 0368e11feda26..0000000000000
Binary files a/recipes/detools/all/test_package/old and /dev/null differ
diff --git a/recipes/detools/all/test_package/patch b/recipes/detools/all/test_package/patch
deleted file mode 100644
index 99321d7000aa0..0000000000000
Binary files a/recipes/detools/all/test_package/patch and /dev/null differ
diff --git a/recipes/detools/all/test_package/test_package.c b/recipes/detools/all/test_package/test_package.c
index e96fd3f5f3d9a..b2e3a040fb0d5 100644
--- a/recipes/detools/all/test_package/test_package.c
+++ b/recipes/detools/all/test_package/test_package.c
@@ -1,23 +1,28 @@
 #include 
 #include "detools.h"
 
-#define EXPECTED_PATCHED_FILE_SIZE 2780
+static int dummy_function()
+{
+    return (0);
+}
 
-int main(int argc, const char *argv[])
+int main()
 {
+    struct detools_apply_patch_in_place_t apply_patch;
+    uint8_t buf[256];
     int res;
+    size_t patch_size = 512;
 
-    if (argc != 4) {
-        printf("Wrong number of arguments.\n");
-
-        return EXIT_FAILURE;
-    }
-
-    res = detools_apply_patch_filenames(argv[1], argv[2], argv[3]);
-
-    if (res == EXPECTED_PATCHED_FILE_SIZE) {
-        return EXIT_SUCCESS;
-    } else {
-        return EXIT_FAILURE;
+    res = detools_apply_patch_in_place_init(&apply_patch,
+                                            dummy_function,
+                                            dummy_function,
+                                            dummy_function,
+                                            dummy_function,
+                                            dummy_function,
+                                            patch_size,
+                                            NULL);
+    printf("detools_apply_patch_in_place_init: %d\n", res);
+    if (res != 0) {
+        return (res);
     }
 }
diff --git a/recipes/detools/config.yml b/recipes/detools/config.yml
index 0cb36a4c86d32..d1a25da138f0d 100644
--- a/recipes/detools/config.yml
+++ b/recipes/detools/config.yml
@@ -1,3 +1,5 @@
 versions:
+  "0.53.0":
+    folder: "all"
   "0.51.0":
     folder: "all"
diff --git a/recipes/detours/all/CMakeLists.txt b/recipes/detours/all/CMakeLists.txt
index 08643cd4c3e75..00fec6778e9bc 100644
--- a/recipes/detours/all/CMakeLists.txt
+++ b/recipes/detours/all/CMakeLists.txt
@@ -1,19 +1,15 @@
-cmake_minimum_required(VERSION 3.0)
+cmake_minimum_required(VERSION 3.12)
 project(conan_detours CXX)
 
-include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake")
-conan_basic_setup(TARGETS)
+set(SOURCES_DIR ${CMAKE_CURRENT_LIST_DIR}/src)
 
-file(GLOB DETOURS_SOURCES source_subfolder/src/*.cpp)
+file(GLOB DETOURS_SOURCES ${SOURCES_DIR}/src/*.cpp)
 list(REMOVE_ITEM DETOURS_SOURCES
-    "${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder/src/uimports.cpp"
+    "${SOURCES_DIR}/src/uimports.cpp"
 )
-file(GLOB DETOURS_HEADERS source_subfolder/src/*.h)
+file(GLOB DETOURS_HEADERS ${SOURCES_DIR}/src/*.h)
 add_library(detours STATIC ${DETOURS_SOURCES} ${DETOURS_HEADERS})
 
 include(GNUInstallDirs)
-install(TARGETS detours
-    ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
-    LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
-)
+install(TARGETS detours)
 install(FILES ${DETOURS_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
diff --git a/recipes/detours/all/conanfile.py b/recipes/detours/all/conanfile.py
index 6d72096230585..7bea0de65a209 100644
--- a/recipes/detours/all/conanfile.py
+++ b/recipes/detours/all/conanfile.py
@@ -1,35 +1,44 @@
-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
 
-required_conan_version = ">=1.45.0"
+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 chdir, copy, get, replace_in_file
+from conan.tools.microsoft import is_msvc, is_msvc_static_runtime, msvc_runtime_flag, VCVars
+
+required_conan_version = ">=1.53.0"
 
 
 class DetoursConan(ConanFile):
     name = "detours"
-    homepage = "https://github.com/antlr/antlr4/tree/master/runtime/Cpp"
     description = "Detours is a software package for monitoring and instrumenting API calls on Windows"
-    topics = ("monitoror", "instrumenting", "hook", "injection")
-    url = "https://github.com/conan-io/conan-center-index"
     license = "MIT"
-    generators = "cmake"
+    url = "https://github.com/conan-io/conan-center-index"
+    homepage = "https://github.com/microsoft/Detours"
+    topics = ("monitoring", "instrumenting", "hook", "injection", "windows")
+
+    package_type = "static-library"
     settings = "os", "arch", "compiler", "build_type"
 
     @property
-    def _source_subfolder(self):
-        return "source_subfolder"
+    def _target_processor(self):
+        return {
+            "x86": "X86",
+            "x86_64": "X64",
+            "armv7": "ARM",
+            "armv8": "ARM64",
+        }[str(self.settings.arch)]
 
-    @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)
+
+    def layout(self):
+        cmake_layout(self, src_folder="src")
 
     def validate(self):
         if self.settings.os != "Windows":
             raise ConanInvalidConfiguration("Only os=Windows is supported")
-        # if not is_msvc(self):
-        #     raise ConanInvalidConfiguration("Only the MSVC compiler is supported")
         if is_msvc(self) and not is_msvc_static_runtime(self):
             # Debug and/or dynamic runtime is undesired for a hooking library
             raise ConanInvalidConfiguration("Only static runtime is supported (MT)")
@@ -41,58 +50,53 @@ def validate(self):
             raise ConanInvalidConfiguration("Unsupported architecture")
 
     def source(self):
-        tools.get(**self.conan_data["sources"][self.version],
-                  destination=self._source_subfolder, strip_root=True)
-
-    def export_sources(self):
-        self.copy("CMakeLists.txt")
-
-    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)
 
-    @property
-    def _target_processor(self):
-        return {
-            "x86": "X86",
-            "x86_64": "X64",
-            "armv7": "ARM",
-            "armv8": "ARM64",
-        }[str(self.settings.arch)]
-
-    @functools.lru_cache(1)
-    def _configure_cmake(self):
-        cmake = CMake(self)
-        cmake.configure()
-        return cmake
+    def generate(self):
+        if is_msvc(self):
+            vcvars = VCVars(self)
+            vcvars.generate()
+        else:
+            tc = CMakeToolchain(self)
+            tc.generate()
 
     def _patch_sources(self):
         if is_msvc(self):
-            tools.replace_in_file(os.path.join(self._source_subfolder, "src", "Makefile"),
-                                  "/MT ", f"/{self.settings.compiler.runtime} ")
+            replace_in_file(
+                self,
+                os.path.join(self.source_folder, "src", "Makefile"),
+                "/MT ",
+                f"/{msvc_runtime_flag(self)} ",
+            )
 
     def build(self):
         self._patch_sources()
         if is_msvc(self):
-            with tools.vcvars(self):
-                with tools.chdir(os.path.join(self._source_subfolder, "src")):
-                    self.run(f"nmake DETOURS_TARGET_PROCESSOR={self._target_processor}")
+            with chdir(self, os.path.join(self.source_folder, "src")):
+                self.run(f"nmake DETOURS_TARGET_PROCESSOR={self._target_processor}")
         else:
-            cmake = self._configure_cmake()
+            cmake = CMake(self)
+            cmake.configure(build_script_folder=self.source_path.parent)
             cmake.build()
 
     def package(self):
-        self.copy("LICENSE.md", src=self._source_subfolder, dst="licenses")
+        copy(self, "LICENSE.md", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"))
         if is_msvc(self):
-            self.copy("detours.lib", src=os.path.join(self._source_subfolder, f"lib.{self._target_processor}"), dst="lib")
-            self.copy("*.h", src=os.path.join(self._source_subfolder, "include"), dst="include")
+            copy(self, "detours.lib",
+                src=os.path.join(self.source_folder, f"lib.{self._target_processor}"),
+                dst=os.path.join(self.package_folder, "lib"))
+            copy(self, "*.h",
+                src=os.path.join(self.source_folder, "include"),
+                dst=os.path.join(self.package_folder, "include"))
         else:
             cmake = CMake(self)
             cmake.install()
 
     def package_info(self):
         self.cpp_info.bindirs = []
+        self.cpp_info.frameworkdirs = []
+        self.cpp_info.resdirs = []
         self.cpp_info.libs = ["detours"]
         if self.settings.compiler == "gcc":
-            self.cpp_info.system_libs = [tools.stdcpp_library(self)]
+            self.cpp_info.system_libs = [stdcpp_library(self)]
             self.cpp_info.link_flags = ["-static-libgcc", "-static-libstdc++"]
diff --git a/recipes/detours/all/test_package/CMakeLists.txt b/recipes/detours/all/test_package/CMakeLists.txt
index 6b89b27839454..9dd543efc7ceb 100644
--- a/recipes/detours/all/test_package/CMakeLists.txt
+++ b/recipes/detours/all/test_package/CMakeLists.txt
@@ -1,9 +1,6 @@
-cmake_minimum_required(VERSION 3.8)
+cmake_minimum_required(VERSION 3.15)
 project(test_package C)
 
-include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
-conan_basic_setup(TARGETS)
-
 find_package(detours REQUIRED CONFIG)
 
 add_executable(victim victim.c)
diff --git a/recipes/detours/all/test_package/conanfile.py b/recipes/detours/all/test_package/conanfile.py
index 43240d491944c..beb314f8f339d 100644
--- a/recipes/detours/all/test_package/conanfile.py
+++ b/recipes/detours/all/test_package/conanfile.py
@@ -1,11 +1,21 @@
-from conans import ConanFile, CMake, tools
 import io
+
+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)
@@ -14,9 +24,9 @@ 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")
+        if can_run(self):
+            bin_path = os.path.join(self.cpp.build.bindir, "test_package")
             buffer = io.StringIO()
-            self.run(f"{bin_path} \"{os.path.join(self.build_folder, 'bin')}\"", run_environment=True, output=buffer)
+            self.run(f'{bin_path} "{os.path.join(self.cpp.build.bindir)}"', buffer, env="conanrun")
             print(buffer.getvalue())
             assert "I found your message! It was 'A secret text'! I am 1337! :^)" in buffer.getvalue()
diff --git a/recipes/detours/all/test_v1_package/CMakeLists.txt b/recipes/detours/all/test_v1_package/CMakeLists.txt
new file mode 100644
index 0000000000000..91630d79f4abb
--- /dev/null
+++ b/recipes/detours/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/detours/all/test_v1_package/conanfile.py b/recipes/detours/all/test_v1_package/conanfile.py
new file mode 100644
index 0000000000000..43240d491944c
--- /dev/null
+++ b/recipes/detours/all/test_v1_package/conanfile.py
@@ -0,0 +1,22 @@
+from conans import ConanFile, CMake, tools
+import io
+import os
+
+
+class TestPackageConan(ConanFile):
+    settings = "os", "arch", "compiler", "build_type"
+    generators = "cmake", "cmake_find_package_multi"
+
+    def build(self):
+        cmake = CMake(self)
+        cmake.verbose = 1
+        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")
+            buffer = io.StringIO()
+            self.run(f"{bin_path} \"{os.path.join(self.build_folder, 'bin')}\"", run_environment=True, output=buffer)
+            print(buffer.getvalue())
+            assert "I found your message! It was 'A secret text'! I am 1337! :^)" in buffer.getvalue()
diff --git a/recipes/devil/all/conandata.yml b/recipes/devil/all/conandata.yml
new file mode 100644
index 0000000000000..74ea90398189d
--- /dev/null
+++ b/recipes/devil/all/conandata.yml
@@ -0,0 +1,23 @@
+sources:
+  # Newer versions at the top
+  "1.8.0":
+    url:
+    - "https://github.com/DentonW/DevIL/archive/refs/tags/v1.8.0.tar.gz"
+    sha256: "52129f247b26fcb5554643c9e6bbee75c4b9717735fdbf3c6ebff08cee38ad37"
+patches:
+  "1.8.0":
+    - patch_file: "patches/1.8.0-jp2_fix.patch"
+      patch_description: "Make devil build with supported versions of jasper"
+      patch_type: "conan"
+    - patch_file: "patches/1.8.0-jpeg_fix.patch"
+      patch_description: "Make devil build with newer versions of libjpeg"
+      patch_type: "conan"
+    - patch_file: "patches/1.8.0-remove_register_keyword.patch"
+      patch_description: "Remove invalid register keyword"
+      patch_type: "conan"
+    - patch_file: "patches/1.8.0-avoid-methoddef-dllimport-error.patch"
+      patch_description: "remove uses of METHODDEF from libjpeg as they are unneeded and cause errors in MSVC"
+      patch_type: "conan"
+    - patch_file: "patches/1.8.0-install-ilut-config-h.patch"
+      patch_description: "ensure ilut_config.h is installed"
+      patch_type: "conan"
diff --git a/recipes/devil/all/conanfile.py b/recipes/devil/all/conanfile.py
new file mode 100644
index 0000000000000..cf4639c2ca38c
--- /dev/null
+++ b/recipes/devil/all/conanfile.py
@@ -0,0 +1,150 @@
+from conan import ConanFile
+from conan.tools.apple import fix_apple_shared_install_name
+from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout, CMakeDeps
+from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rm, rmdir
+import os
+
+
+required_conan_version = ">=2.1"
+
+
+class DevilConan(ConanFile):
+    name = "devil"
+    description = "Developer's Image Library (DevIL) is a programmer's library to develop applications with very " \
+                  "powerful image loading capabilities, yet is easy for a developer to learn and use."
+    license = "LGPL-2.1-only"
+    url = "https://github.com/conan-io/conan-center-index"
+    homepage = "https://openil.sourceforge.net/"
+    topics = ("devil", "image")
+    package_type = "library"
+    settings = "os", "arch", "compiler", "build_type"
+    options = {
+        "shared": [True, False],
+        "fPIC": [True, False],
+        "with_png": [True, False],
+        "with_jpeg": [True, False],
+        "with_tiff": [True, False],
+        "with_jasper": [True, False],
+        "with_squish": [True, False],
+        "with_lcms": [True, False]
+    }
+    default_options = {
+        "shared": False,
+        "fPIC": True,
+        "with_png": True,
+        "with_jpeg": True,
+        "with_tiff": True,
+        "with_jasper": True,
+        "with_squish": True,
+        "with_lcms": True
+    }
+
+    implements = ["auto_shared_fpic"]
+
+    def export_sources(self):
+        export_conandata_patches(self)
+
+    def layout(self):
+        cmake_layout(self, src_folder="src")
+
+    def requirements(self):
+        if self.options.with_png:
+            self.requires("libpng/[>=1.6 <2]")
+        if self.options.with_jpeg:
+            self.requires("libjpeg/9e")
+        if self.options.with_tiff:
+            self.requires("libtiff/4.7.0")
+        if self.options.with_jasper:
+            self.requires("jasper/4.2.4")
+        if self.options.with_squish:
+            self.requires("libsquish/1.15")
+        if self.options.with_lcms:
+            self.requires("lcms/2.16")
+
+    def source(self):
+        get(self, **self.conan_data["sources"][self.version], strip_root=True)
+        self._patch_sources()
+
+    def generate(self):
+        tc = CMakeToolchain(self)
+
+        # The CMakeLists will try to call find_package regardless of options
+        # ensure that even if they are picked up by the system, they are not used
+        tc.variables["IL_NO_PNG"] = not self.options.with_png
+        tc.variables["IL_NO_JPG"] = not self.options.with_jpeg
+        tc.variables["IL_NO_TIF"] = not self.options.with_tiff
+        tc.variables["IL_NO_JP2"] = not self.options.with_jasper
+        tc.variables["IL_NO_LCMS"] = not self.options.with_lcms
+        tc.variables["IL_USE_DXTC_SQUISH"] = self.options.with_squish
+
+        tc.generate()
+
+        deps = CMakeDeps(self)
+        deps.generate()
+
+    def _patch_sources(self):
+        apply_conandata_patches(self)
+        # Let Conan handle the shared/static build
+        replace_in_file(self, os.path.join(self.source_folder, "DevIL", "src-ILU", "CMakeLists.txt"),
+                        "add_library(ILU SHARED ",
+                        "add_library(ILU ")
+
+        replace_in_file(self, os.path.join(self.source_folder, "DevIL", "src-ILUT", "CMakeLists.txt"),
+                        "add_library(ILUT SHARED ",
+                        "add_library(ILUT ")
+
+    def build(self):
+        cmake = CMake(self)
+        cmake.configure(build_script_folder=os.path.join(self.source_folder, "DevIL"))
+        cmake.build()
+
+    def package(self):
+        copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses"))
+        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"))
+        fix_apple_shared_install_name(self)
+
+    def package_info(self):
+        self.cpp_info.set_property("cmake_file_name", "DevIL")
+        self.cpp_info.set_property("cmake_target_name", "DevIL::DevIL")
+
+        if self.settings.os == "Windows":
+            self.cpp_info.components["IL"].libs = ["DevIL"]
+        else:
+            self.cpp_info.components["IL"].libs = ["IL"]
+        self.cpp_info.components["IL"].set_property("cmake_target_name", "DevIL::IL")
+        il_requires = []
+        if self.options.with_png:
+            il_requires.append("libpng::libpng")
+        if self.options.with_jpeg:
+            il_requires.append("libjpeg::libjpeg")
+        if self.options.with_tiff:
+            il_requires.append("libtiff::libtiff")
+        if self.options.with_jasper:
+            il_requires.append("jasper::jasper")
+        if self.options.with_squish:
+            il_requires.append("libsquish::libsquish")
+        if self.options.with_lcms:
+            il_requires.append("lcms::lcms")
+        self.cpp_info.components["IL"].requires = il_requires
+
+        self.cpp_info.components["ILU"].libs = ["ILU"]
+        self.cpp_info.components["ILU"].set_property("cmake_target_name", "DevIL::ILU")
+        if self.options.with_tiff:
+            self.cpp_info.components["ILU"].requires = [
+                "libtiff::libtiff"
+            ]
+        self.cpp_info.components["ILUT"].libs = ["ILUT"]
+        self.cpp_info.components["ILUT"].set_property("cmake_target_name", "DevIL::ILUT")
+
+        if not self.options.shared:
+            self.cpp_info.components["IL"].defines = ["IL_STATIC_LIB"]
+            self.cpp_info.components["ILU"].defines = ["IL_STATIC_LIB"]
+            self.cpp_info.components["ILUT"].defines = ["IL_STATIC_LIB"]
diff --git a/recipes/devil/all/patches/1.8.0-avoid-methoddef-dllimport-error.patch b/recipes/devil/all/patches/1.8.0-avoid-methoddef-dllimport-error.patch
new file mode 100644
index 0000000000000..0e6174af77c19
--- /dev/null
+++ b/recipes/devil/all/patches/1.8.0-avoid-methoddef-dllimport-error.patch
@@ -0,0 +1,82 @@
+--- a/DevIL/src-IL/src/il_jpeg.cpp
++++ b/DevIL/src-IL/src/il_jpeg.cpp
+@@ -219,7 +219,7 @@ typedef iread_mgr * iread_ptr;
+ #define INPUT_BUF_SIZE  4096  // choose an efficiently iread'able size
+ 
+ 
+-METHODDEF(void)
++static void
+ init_source (j_decompress_ptr cinfo)
+ {
+ 	iread_ptr src = (iread_ptr) cinfo->src;
+@@ -227,7 +227,7 @@ init_source (j_decompress_ptr cinfo)
+ }
+ 
+ 
+-METHODDEF(boolean)
++static boolean
+ fill_input_buffer (j_decompress_ptr cinfo)
+ {
+ 	iread_ptr src = (iread_ptr) cinfo->src;
+@@ -259,7 +259,7 @@ fill_input_buffer (j_decompress_ptr cinfo)
+ }
+ 
+ 
+-METHODDEF(void)
++static void
+ skip_input_data (j_decompress_ptr cinfo, long num_bytes)
+ {
+ 	iread_ptr src = (iread_ptr) cinfo->src;
+@@ -275,14 +275,14 @@ skip_input_data (j_decompress_ptr cinfo, long num_bytes)
+ }
+ 
+ 
+-METHODDEF(void)
++static void
+ term_source (j_decompress_ptr cinfo)
+ {
+ 	// no work necessary here
+ }
+ 
+ 
+-GLOBAL(void)
++void
+ devil_jpeg_read_init (j_decompress_ptr cinfo)
+ {
+ 	iread_ptr src;
+@@ -371,7 +371,7 @@ typedef iwrite_mgr *iwrite_ptr;
+ #define OUTPUT_BUF_SIZE 4096
+ 
+ 
+-METHODDEF(void)
++static void
+ init_destination(j_compress_ptr cinfo)
+ {
+ 	iwrite_ptr dest = (iwrite_ptr)cinfo->dest;
+@@ -384,7 +384,7 @@ init_destination(j_compress_ptr cinfo)
+ 	return;
+ }
+ 
+-METHODDEF(boolean)
++static boolean
+ empty_output_buffer (j_compress_ptr cinfo)
+ {
+ 	iwrite_ptr dest = (iwrite_ptr)cinfo->dest;
+@@ -394,7 +394,7 @@ empty_output_buffer (j_compress_ptr cinfo)
+ 	return static_cast< boolean >( IL_TRUE );
+ }
+ 
+-METHODDEF(void)
++static void
+ term_destination (j_compress_ptr cinfo)
+ {
+ 	iwrite_ptr dest = (iwrite_ptr)cinfo->dest;
+@@ -403,7 +403,7 @@ term_destination (j_compress_ptr cinfo)
+ }
+ 
+ 
+-GLOBAL(void)
++void
+ devil_jpeg_write_init(j_compress_ptr cinfo)
+ {
+ 	iwrite_ptr dest;
diff --git a/recipes/devil/all/patches/1.8.0-install-ilut-config-h.patch b/recipes/devil/all/patches/1.8.0-install-ilut-config-h.patch
new file mode 100644
index 0000000000000..9e714b4088a27
--- /dev/null
+++ b/recipes/devil/all/patches/1.8.0-install-ilut-config-h.patch
@@ -0,0 +1,11 @@
+--- a/DevIL/src-ILUT/CMakeLists.txt
++++ b/DevIL/src-ILUT/CMakeLists.txt
+@@ -76,7 +76,7 @@ install (TARGETS ILUT
+     LIBRARY DESTINATION lib
+     RUNTIME DESTINATION bin
+ )
+-install (FILES ../include/IL/ilut.h DESTINATION include/IL)
++install (FILES ../include/IL/ilut.h ../include/IL/ilut_config.h DESTINATION include/IL)
+ 
+ install(FILES
+     ${CMAKE_CURRENT_BINARY_DIR}/ILUT.pc
diff --git a/recipes/devil/all/patches/1.8.0-jp2_fix.patch b/recipes/devil/all/patches/1.8.0-jp2_fix.patch
new file mode 100644
index 0000000000000..5fecfe09c7eee
--- /dev/null
+++ b/recipes/devil/all/patches/1.8.0-jp2_fix.patch
@@ -0,0 +1,18 @@
+--- a/DevIL/src-IL/src/il_jp2.cpp
++++ b/DevIL/src-IL/src/il_jp2.cpp
+@@ -314,13 +314,13 @@ ILboolean iLoadJp2Internal(jas_stream_t	*Stream, ILimage *Image)
+ 
+ 
+ 
+-static int iJp2_file_read(jas_stream_obj_t *obj, char *buf, int cnt)
++static ssize_t iJp2_file_read(jas_stream_obj_t *obj, char *buf, size_t cnt)
+ {
+ 	obj;
+ 	return iread(buf, 1, cnt);
+ }
+ 
+-static int iJp2_file_write(jas_stream_obj_t *obj, char *buf, int cnt)
++static ssize_t iJp2_file_write(jas_stream_obj_t *obj, const char *buf, size_t cnt)
+ {
+ 	obj;
+ 	return iwrite(buf, 1, cnt);
diff --git a/recipes/devil/all/patches/1.8.0-jpeg_fix.patch b/recipes/devil/all/patches/1.8.0-jpeg_fix.patch
new file mode 100644
index 0000000000000..d70cc922bd579
--- /dev/null
+++ b/recipes/devil/all/patches/1.8.0-jpeg_fix.patch
@@ -0,0 +1,73 @@
+--- a/DevIL/src-IL/src/il_jpeg.cpp
++++ b/DevIL/src-IL/src/il_jpeg.cpp
+@@ -245,7 +245,7 @@ fill_input_buffer (j_decompress_ptr cinfo)
+ 		src->buffer[0] = (JOCTET) 0xFF;
+ 		src->buffer[1] = (JOCTET) JPEG_EOI;
+ 		nbytes = 2;
+-		return IL_FALSE;
++		return static_cast< boolean >( IL_FALSE );
+ 	}
+ 	if (nbytes < INPUT_BUF_SIZE) {
+ 		ilGetError();  // Gets rid of the IL_FILE_READ_ERROR.
+@@ -253,9 +253,9 @@ fill_input_buffer (j_decompress_ptr cinfo)
+ 
+ 	src->pub.next_input_byte = src->buffer;
+ 	src->pub.bytes_in_buffer = nbytes;
+-	src->start_of_file = IL_FALSE;
++	src->start_of_file = static_cast< boolean >( IL_FALSE );
+ 
+-	return IL_TRUE;
++	return static_cast< boolean >( IL_TRUE );
+ }
+ 
+ 
+@@ -334,13 +334,13 @@ ILboolean iLoadJpegInternal()
+ 
+ 	if ((result = setjmp(JpegJumpBuffer) == 0) != IL_FALSE) {
+ 		jpeg_create_decompress(&JpegInfo);
+-		JpegInfo.do_block_smoothing = IL_TRUE;
+-		JpegInfo.do_fancy_upsampling = IL_TRUE;
++		JpegInfo.do_block_smoothing = static_cast< boolean >( IL_TRUE );
++		JpegInfo.do_fancy_upsampling = static_cast< boolean >( IL_TRUE );
+ 
+ 		//jpeg_stdio_src(&JpegInfo, iGetFile());
+ 
+ 		devil_jpeg_read_init(&JpegInfo);
+-		jpeg_read_header(&JpegInfo, IL_TRUE);
++		jpeg_read_header(&JpegInfo, static_cast< boolean >( IL_TRUE ));
+ 
+ 		result = ilLoadFromJpegStruct(&JpegInfo);
+ 
+@@ -391,7 +391,7 @@ empty_output_buffer (j_compress_ptr cinfo)
+ 	iwrite(dest->buffer, 1, OUTPUT_BUF_SIZE);
+ 	dest->pub.next_output_byte = dest->buffer;
+ 	dest->pub.free_in_buffer = OUTPUT_BUF_SIZE;
+-	return IL_TRUE;
++	return static_cast< boolean >( IL_TRUE );
+ }
+ 
+ METHODDEF(void)
+@@ -554,12 +554,12 @@ ILboolean iSaveJpegInternal()
+ //#endif//IL_USE_JPEGLIB_UNMODIFIED
+ 
+ 	// Set the quality output
+-	jpeg_set_quality(&JpegInfo, iGetInt(IL_JPG_QUALITY), IL_TRUE);
++	jpeg_set_quality(&JpegInfo, iGetInt(IL_JPG_QUALITY), static_cast(IL_TRUE));
+ 	// Sets progressive saving here
+ 	if (ilGetBoolean(IL_JPG_PROGRESSIVE))
+ 		jpeg_simple_progression(&JpegInfo);
+ 
+-	jpeg_start_compress(&JpegInfo, IL_TRUE);
++	jpeg_start_compress(&JpegInfo, static_cast(IL_TRUE));
+ 
+ 	//row_stride = image_width * 3;	// JSAMPLEs per row in image_buffer
+ 
+@@ -970,7 +970,7 @@ ILboolean ilSaveFromJpegStruct(void *_JpegInfo)
+ 	JpegInfo->image_height = TempImage->Height;
+ 	JpegInfo->input_components = TempImage->Bpp;  // # of color components per pixel
+ 
+-	jpeg_start_compress(JpegInfo, IL_TRUE);
++	jpeg_start_compress(JpegInfo, static_cast(IL_TRUE));
+ 
+ 	//row_stride = image_width * 3;	// JSAMPLEs per row in image_buffer
+ 
diff --git a/recipes/devil/all/patches/1.8.0-remove_register_keyword.patch b/recipes/devil/all/patches/1.8.0-remove_register_keyword.patch
new file mode 100644
index 0000000000000..861cfa9c82256
--- /dev/null
+++ b/recipes/devil/all/patches/1.8.0-remove_register_keyword.patch
@@ -0,0 +1,15 @@
+--- a/DevIL/src-IL/src/il_manip.cpp
++++ b/DevIL/src-IL/src/il_manip.cpp
+@@ -37,9 +37,9 @@ ILushort ILAPIENTRY ilFloatToHalf(ILuint i) {
+ 	// of float and half (127 versus 15).
+ 	//
+ 
+-	register int s =  (i >> 16) & 0x00008000;
+-	register int e = ((i >> 23) & 0x000000ff) - (127 - 15);
+-	register int m =   i        & 0x007fffff;
++	int s =  (i >> 16) & 0x00008000;
++	int e = ((i >> 23) & 0x000000ff) - (127 - 15);
++	int m =   i        & 0x007fffff;
+ 
+ 	//
+ 	// Now reassemble s, e and m into a half:
diff --git a/recipes/devil/all/test_package/CMakeLists.txt b/recipes/devil/all/test_package/CMakeLists.txt
new file mode 100644
index 0000000000000..d17240799670c
--- /dev/null
+++ b/recipes/devil/all/test_package/CMakeLists.txt
@@ -0,0 +1,9 @@
+cmake_minimum_required(VERSION 3.15)
+
+project(test_devil LANGUAGES CXX)
+
+find_package(DevIL REQUIRED CONFIG)
+
+add_executable(${PROJECT_NAME} test_package.cpp)
+# don't link to ${CONAN_LIBS} or CONAN_PKG::package
+target_link_libraries(${PROJECT_NAME} PRIVATE DevIL::IL DevIL::ILU DevIL::ILUT DevIL::DevIL)
diff --git a/recipes/devil/all/test_package/conanfile.py b/recipes/devil/all/test_package/conanfile.py
new file mode 100644
index 0000000000000..7b984260fd10f
--- /dev/null
+++ b/recipes/devil/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 TestDevilConan(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.bindir, "test_devil")
+            self.run(bin_path, env="conanrun")
diff --git a/recipes/devil/all/test_package/test_package.cpp b/recipes/devil/all/test_package/test_package.cpp
new file mode 100644
index 0000000000000..995955b900e72
--- /dev/null
+++ b/recipes/devil/all/test_package/test_package.cpp
@@ -0,0 +1,14 @@
+#include 
+#include 
+#include 
+#include 
+
+
+int main() {
+    ilInit();
+    iluGetImageInfo(0);
+
+    ilShutDown();
+
+    return EXIT_SUCCESS;
+}
diff --git a/recipes/devil/config.yml b/recipes/devil/config.yml
new file mode 100644
index 0000000000000..4d72270a88048
--- /dev/null
+++ b/recipes/devil/config.yml
@@ -0,0 +1,3 @@
+versions:
+  "1.8.0":
+    folder: all
diff --git a/recipes/dfp/all/conandata.yml b/recipes/dfp/all/conandata.yml
new file mode 100644
index 0000000000000..753d76e24d813
--- /dev/null
+++ b/recipes/dfp/all/conandata.yml
@@ -0,0 +1,7 @@
+sources:
+  "1.0.3":
+    url: "https://github.com/epam/DFP/releases/download/1.0.3/native-sources.tar.gz"
+    sha256: "362e324687d6b8ca42490811331052c46cccb64a2cf078f3b6c8df92a374497c"
+  "1.0.2":
+    url: "https://github.com/epam/DFP/releases/download/1.0.2-cxx/native-sources.tar.gz"
+    sha256: "f62acab311086c1207f7d58185232c7e86e11ed606596d9afcff49703c196058"
diff --git a/recipes/dfp/all/conanfile.py b/recipes/dfp/all/conanfile.py
new file mode 100644
index 0000000000000..93d025c258e68
--- /dev/null
+++ b/recipes/dfp/all/conanfile.py
@@ -0,0 +1,71 @@
+import os
+
+from conan import ConanFile
+from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps
+from conan.tools.files import copy, get
+
+required_conan_version = ">=1.54.0"
+
+
+class DfpConan(ConanFile):
+    name = "dfp"
+    package_type = "library"
+
+    # Optional metadata
+    description = "Decimal Floating Point Arithmetic Library"
+    homepage = "https://github.com/epam/DFP/"
+    url = "https://github.com/conan-io/conan-center-index"
+    license = ("Apache-2.0", "Intel")
+    topics = ("decimal", "dfp", "ieee-754", "deltix")
+
+    # Binary configuration
+    settings = "os", "compiler", "build_type", "arch"
+    options = {
+        "shared": [True, False],
+        "fPIC": [True, False]
+    }
+    default_options = {
+        "shared": False,
+        "fPIC": True
+    }
+
+
+    def source(self):
+        get(self, **self.conan_data["sources"][self.version], strip_root=True)
+
+    def config_options(self):
+        if self.settings.os == "Windows":
+            self.options.rm_safe("fPIC")
+
+    def configure(self):
+        # it's a C library
+        self.settings.rm_safe("compiler.libcxx")
+        self.settings.rm_safe("compiler.cppstd")
+        if self.options.shared:
+            self.options.rm_safe("fPIC")
+
+    def layout(self):
+        cmake_layout(self, src_folder="src")
+
+    def build_requirements(self):
+        self.tool_requires("cmake/[>=3.22.0 <4]")
+
+    def generate(self):
+        deps = CMakeDeps(self)
+        deps.generate()
+        tc = CMakeToolchain(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)
+        copy(self, "intel-eula.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 = ["ddfp"]
diff --git a/recipes/dfp/all/test_package/CMakeLists.txt b/recipes/dfp/all/test_package/CMakeLists.txt
new file mode 100644
index 0000000000000..0fc7fa3dfb5a0
--- /dev/null
+++ b/recipes/dfp/all/test_package/CMakeLists.txt
@@ -0,0 +1,10 @@
+cmake_minimum_required(VERSION 3.15)
+project(test_package LANGUAGES CXX)
+set(CMAKE_CXX_STANDARD 11)
+
+find_package(dfp CONFIG REQUIRED)
+
+
+add_executable(${PROJECT_NAME} src/demo.cpp)
+target_link_libraries(${PROJECT_NAME} PRIVATE dfp::dfp)
+set_property(TARGET ${PROJECT_NAME} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>")
diff --git a/recipes/dfp/all/test_package/conanfile.py b/recipes/dfp/all/test_package/conanfile.py
new file mode 100644
index 0000000000000..32f908420470d
--- /dev/null
+++ b/recipes/dfp/all/test_package/conanfile.py
@@ -0,0 +1,27 @@
+import os
+
+from conan import ConanFile
+from conan.tools.cmake import CMake, cmake_layout
+from conan.tools.build import can_run
+
+
+class TestExampleConan(ConanFile):
+    settings = "os", "compiler", "build_type", "arch"
+    generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv"
+    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 can_run(self):
+            cmd = os.path.join(self.cpp.build.bindir, "test_package")
+            self.run(cmd, env="conanrun")
diff --git a/recipes/dfp/all/test_package/src/demo.cpp b/recipes/dfp/all/test_package/src/demo.cpp
new file mode 100644
index 0000000000000..69d2647abc971
--- /dev/null
+++ b/recipes/dfp/all/test_package/src/demo.cpp
@@ -0,0 +1,10 @@
+#include 
+#include 
+
+using namespace epam::deltix::dfp;
+
+int main(void) {
+    const Decimal64 number("42");
+    std::cout << number << " : " << number.toUnderlying() << std::endl;
+    return 0;
+}
diff --git a/recipes/dfp/config.yml b/recipes/dfp/config.yml
new file mode 100644
index 0000000000000..f625d5d2b747f
--- /dev/null
+++ b/recipes/dfp/config.yml
@@ -0,0 +1,5 @@
+versions:
+  "1.0.3":
+    folder: all
+  "1.0.2":
+    folder: all
diff --git a/recipes/di/all/BSL-1.0.txt b/recipes/di/all/BSL-1.0.txt
deleted file mode 100644
index 36b7cd93cdfba..0000000000000
--- a/recipes/di/all/BSL-1.0.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-Boost Software License - Version 1.0 - August 17th, 2003
-
-Permission is hereby granted, free of charge, to any person or organization
-obtaining a copy of the software and accompanying documentation covered by
-this license (the "Software") to use, reproduce, display, distribute,
-execute, and transmit the Software, and to prepare derivative works of the
-Software, and to permit third-parties to whom the Software is furnished to
-do so, all subject to the following:
-
-The copyright notices in the Software and this entire statement, including
-the above license grant, this restriction and the following disclaimer,
-must be included in all copies of the Software, in whole or in part, and
-all derivative works of the Software, unless such copies or derivative
-works are solely in the form of machine-executable object code generated by
-a source language processor.
-
-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, TITLE AND NON-INFRINGEMENT. IN NO EVENT
-SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
-FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-DEALINGS IN THE SOFTWARE.
diff --git a/recipes/di/all/conandata.yml b/recipes/di/all/conandata.yml
index 0dd2a459aba98..36983ad396050 100644
--- a/recipes/di/all/conandata.yml
+++ b/recipes/di/all/conandata.yml
@@ -5,3 +5,6 @@ sources:
   "1.2.0":
     url: https://github.com/boost-ext/di/archive/v1.2.0.tar.gz
     sha256: 47ed660a1198f61394d30890cbb9a68b0fd6d17f41283e1de0036d10c1d24a55
+  "1.3.0":
+    url: "https://github.com/boost-ext/di/archive/v1.3.0.tar.gz"
+    sha256: "853e02ade9bf39f2863b470350c3ef55caffc3090d7d9a503724ff480c8d7eff"
diff --git a/recipes/di/all/conanfile.py b/recipes/di/all/conanfile.py
index 5ccda35c324e5..25630735095f5 100644
--- a/recipes/di/all/conanfile.py
+++ b/recipes/di/all/conanfile.py
@@ -1,61 +1,101 @@
-from conans import ConanFile, 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.files import copy, get, save, load
+from conan.tools.layout import basic_layout
+from conan.tools.scm import Version
+
+required_conan_version = ">=1.52.0"
+
 
 class DiConan(ConanFile):
     name = "di"
+    description = "DI: C++14 Dependency Injection Library."
     license = "BSL-1.0"
-    homepage = "https://github.com/boost-ext/di"
     url = "https://github.com/conan-io/conan-center-index"
-    description = "DI: C++14 Dependency Injection Library."
-    topics = ("dependency-injection", "metaprogramming", "design-patterns")
-    exports_sources = ["BSL-1.0.txt"]
-    settings = "compiler"
-    options = {"with_extensions": [True, False], "diagnostics_level": [0, 1, 2]}
-    default_options = {"with_extensions": False, "diagnostics_level": 1}
+    homepage = "https://github.com/boost-ext/di"
+    topics = ("dependency-injection", "metaprogramming", "design-patterns", "header-only")
+
+    package_type = "header-library"
+    settings = "os", "arch", "compiler", "build_type"
+    options = {
+        "with_extensions": [True, False],
+        "diagnostics_level": [0, 1, 2]
+    }
+    default_options = {
+        "with_extensions": False,
+        "diagnostics_level": 1
+    }
     no_copy_source = True
 
     @property
-    def _source_subfolder(self):
-        return "source_subfolder"
+    def _min_cppstd(self):
+        return 14
 
-    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": "5",
             "clang": "3.4",
             "apple-clang": "10",
-            "Visual Studio": "15"
+            "Visual Studio": "15",
+            "msvc": "191"
         }
+
+    def configure(self):
+        if self.settings.compiler.cppstd:
+            check_min_cppstd(self, self._min_cppstd)
         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))
+        if compiler not in self._compilers_minimum_version:
+            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++{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._compilers_minimum_version[compiler]:
+            raise ConanInvalidConfiguration(
+                f"{self.name} requires a compiler that supports at least C++{self._min_cppstd}")
 
-    def source(self):
-        tools.get(**self.conan_data["sources"][self.version])
-        extracted_dir = "di-" + self.version
-        os.rename(extracted_dir, self._source_subfolder)
-
-    def package(self):
-        self.copy("BSL-1.0.txt", src="", dst="licenses")
-        if self.options.with_extensions:
-            self.copy("*.hpp", src=os.path.join(self._source_subfolder, "extension", "include", "boost", "di", "extension"), dst=os.path.join("include", "boost", "di", "extension"), keep_path=True)
-        self.copy("di.hpp", src=os.path.join(self._source_subfolder, "include", "boost"), dst=os.path.join("include", "boost"))
+    def layout(self):
+        basic_layout(self, src_folder="src")
 
     def package_id(self):
         self.info.requires.clear()
         self.info.settings.clear()
         del self.info.options.diagnostics_level
 
+    def source(self):
+        get(self, **self.conan_data["sources"][self.version], strip_root=True)
+
+    def _extract_license(self):
+        file = os.path.join(self.source_folder, "CMakeLists.txt")
+        file_content = load(self, file)
+
+        license_start = file_content.find("# Copyright")
+        sub_end = "LICENSE_1_0.txt)"
+        license_end = file_content.find(sub_end)
+        license_contents = file_content[license_start:(license_end + len(sub_end))]
+        save(self, os.path.join(self.package_folder, "licenses", "LICENSE"), license_contents)
+
+
+    def package(self):
+        self._extract_license()
+        copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder)
+        if self.options.with_extensions:
+            copy(self, "*.hpp",
+                 dst=os.path.join(self.package_folder, "include", "boost", "di", "extension"),
+                 src=os.path.join(self.source_folder, "extension", "include", "boost", "di", "extension"),
+                 keep_path=True)
+        copy(self, "di.hpp",
+             dst=os.path.join(self.package_folder, "include", "boost"),
+             src=os.path.join(self.source_folder, "include", "boost"))
+
     def package_info(self):
-        self.cpp_info.defines.append("BOOST_DI_CFG_DIAGNOSTICS_LEVEL={}".format(self.options.diagnostics_level))
+        self.cpp_info.bindirs = []
+        self.cpp_info.libdirs = []
+
+        self.cpp_info.defines.append(
+            f"BOOST_DI_CFG_DIAGNOSTICS_LEVEL={self.options.diagnostics_level}")
diff --git a/recipes/di/all/test_package/CMakeLists.txt b/recipes/di/all/test_package/CMakeLists.txt
index 44d785353d02d..4ead030531af2 100644
--- a/recipes/di/all/test_package/CMakeLists.txt
+++ b/recipes/di/all/test_package/CMakeLists.txt
@@ -1,9 +1,8 @@
-cmake_minimum_required(VERSION 3.1.3)
+cmake_minimum_required(VERSION 3.15)
 project(PackageTest CXX)
 
-include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
-conan_basic_setup(TARGETS)
+find_package(di REQUIRED CONFIG)
 
 add_executable(example example.cpp)
+target_link_libraries(example di::di)
 set_target_properties(example PROPERTIES CXX_STANDARD 14)
-target_link_libraries(example CONAN_PKG::di)
diff --git a/recipes/di/all/test_package/conanfile.py b/recipes/di/all/test_package/conanfile.py
index 8d63f059b4cdc..8d52b7021efe1 100644
--- a/recipes/di/all/test_package/conanfile.py
+++ b/recipes/di/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 DiConan(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,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.bindir, "example")
+            self.run(bin_path, env="conanrun")
diff --git a/recipes/di/all/test_v1_package/CMakeLists.txt b/recipes/di/all/test_v1_package/CMakeLists.txt
new file mode 100644
index 0000000000000..91630d79f4abb
--- /dev/null
+++ b/recipes/di/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/di/all/test_v1_package/conanfile.py b/recipes/di/all/test_v1_package/conanfile.py
new file mode 100644
index 0000000000000..da134b42a75e3
--- /dev/null
+++ b/recipes/di/all/test_v1_package/conanfile.py
@@ -0,0 +1,16 @@
+from conans import ConanFile, CMake, tools
+import os
+
+
+class DiConan(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):
+            self.run(os.path.join("bin", "example"), run_environment=True)
diff --git a/recipes/di/config.yml b/recipes/di/config.yml
index 246aedabf295f..1ff0ab25aeeea 100644
--- a/recipes/di/config.yml
+++ b/recipes/di/config.yml
@@ -3,3 +3,5 @@ versions:
     folder: all
   "1.2.0":
     folder: all
+  "1.3.0":
+    folder: all
diff --git a/recipes/dice-template-library/all/CMakeLists.txt b/recipes/dice-template-library/all/CMakeLists.txt
deleted file mode 100644
index b71c882d9d33f..0000000000000
--- a/recipes/dice-template-library/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/dice-template-library/all/conandata.yml b/recipes/dice-template-library/all/conandata.yml
index a56456e70c621..580b85f394958 100644
--- a/recipes/dice-template-library/all/conandata.yml
+++ b/recipes/dice-template-library/all/conandata.yml
@@ -1,10 +1,34 @@
 sources:
-  "0.1.0":
-    url: "https://github.com/dice-group/dice-template-library/archive/refs/tags/v0.1.0.tar.gz"
-    sha256: "1d682283c4a54c4495fc65caa6f9a7674739156ce851227980430052120b2c29"
-  "0.2.0":
-    url: "https://github.com/dice-group/dice-template-library/archive/refs/tags/v0.2.0.tar.gz"
-    sha256: "0f981aeb5604eb305a190d3aef6625032bbb2a34a0bcd17f17ae0cef19fac384"
+  "1.9.0":
+    url: "https://github.com/dice-group/dice-template-library/archive/refs/tags/v1.9.0.tar.gz"
+    sha256: "ca82a61bd445e0eaf69e68fc4a96d037c8b2ea36ff7762042dbb6f47a89f99e9"
+  "1.8.0":
+    url: "https://github.com/dice-group/dice-template-library/archive/refs/tags/v1.8.0.tar.gz"
+    sha256: "cb20717cb596b156b098146d043caa158618e055b8edbeb4d3245cd11e1c8276"
+  "1.6.0":
+    url: "https://github.com/dice-group/dice-template-library/archive/refs/tags/v1.6.0.tar.gz"
+    sha256: "4eb176930beb05dba183d4a48fd9e9716676fe92f0a98a8f527cb8791b0d64fd"
+  "1.5.0":
+    url: "https://github.com/dice-group/dice-template-library/archive/refs/tags/v1.5.0.tar.gz"
+    sha256: "5ab4155097af5674dc9b34d1643db9ea8b30f78d15c1e547c58396ea31068ffd"
+  "1.3.0":
+    url: "https://github.com/dice-group/dice-template-library/archive/refs/tags/v1.3.0.tar.gz"
+    sha256: "2e61e95eeedf31f7041a6694c0789c5d1a5e3f9e4db87546cb83c9189808d4f5"
+  "1.2.0":
+    url: "https://github.com/dice-group/dice-template-library/archive/refs/tags/v1.2.0.tar.gz"
+    sha256: "9b21793e158af3ee81ceec827a1a43a87e309e2f7bf0be8ace0f538a95f4865a"
+  "1.1.0":
+    url: "https://github.com/dice-group/dice-template-library/archive/refs/tags/v1.1.0.tar.gz"
+    sha256: "a00ee401379eaf6c8af013fb39d6732fa68c3852e14b50789edde6f054647ca2"
+  "1.0.0":
+    url: "https://github.com/dice-group/dice-template-library/archive/refs/tags/v1.0.0.tar.gz"
+    sha256: "d0c75ec4861e2480dc7d6533125f9c2dfb3574fc2cffd15c66665b1cdfa66561"
   "0.3.0":
     url: "https://github.com/dice-group/dice-template-library/archive/refs/tags/v0.3.0.tar.gz"
     sha256: "2c02278f86c7b5fe1c684f5126f30529952a03784fa7c883cc4fd44965b3c33e"
+  "0.2.0":
+    url: "https://github.com/dice-group/dice-template-library/archive/refs/tags/v0.2.0.tar.gz"
+    sha256: "0f981aeb5604eb305a190d3aef6625032bbb2a34a0bcd17f17ae0cef19fac384"
+  "0.1.0":
+    url: "https://github.com/dice-group/dice-template-library/archive/refs/tags/v0.1.0.tar.gz"
+    sha256: "1d682283c4a54c4495fc65caa6f9a7674739156ce851227980430052120b2c29"
diff --git a/recipes/dice-template-library/all/conanfile.py b/recipes/dice-template-library/all/conanfile.py
index d7cce02ca9aa4..c799a85eb10c5 100644
--- a/recipes/dice-template-library/all/conanfile.py
+++ b/recipes/dice-template-library/all/conanfile.py
@@ -1,69 +1,79 @@
 import os
-from conans import ConanFile, CMake, tools
-from conans.errors import ConanInvalidConfiguration
 
-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.files import copy, get
+from conan.tools.layout import basic_layout
+from conan.tools.microsoft import is_msvc
+from conan.tools.scm import Version
+
+required_conan_version = ">=1.52.0"
 
 
 class DiceTemplateLibrary(ConanFile):
     name = "dice-template-library"
-    description = "This template library is a collection of handy template-oriented code that we, the Data Science Group at UPB, found pretty handy."
-    homepage = "https://dice-research.org/"
-    url = "https://github.com/conan-io/conan-center-index"
+    description = ("This template library is a collection of handy template-oriented code that we, "
+                   "the Data Science Group at UPB, found pretty handy.")
     license = "MIT"
-    topics = ("template", "template-library", "compile-time", "switch", "integral-tuple")
-    settings = "build_type", "compiler", "os", "arch"
+    url = "https://github.com/conan-io/conan-center-index"
+    homepage = "https://github.com/dice-group/dice-template-library/"
+    topics = ("template", "template-library", "compile-time", "switch", "integral-tuple", "header-only")
+
+    package_type = "header-library"
+    settings = "os", "arch", "compiler", "build_type"
     no_copy_source = True
 
     @property
     def _min_cppstd(self):
-        return "20"
+        return 20
 
     @property
     def _compilers_minimum_version(self):
         return {
             "gcc": "10.2",
             "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"):
-            tools.check_min_cppstd(self, self._min_cppstd)
-        if self.settings.compiler == "apple-clang":
-            raise ConanInvalidConfiguration("apple-clang is not supported because a full concept implementation is needed")
-        if self.settings.compiler == "Visual Studio":
+        if is_msvc(self):
             raise ConanInvalidConfiguration("MSVC is not supported because a full concept implementation is needed")
 
-        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++20. Your compiler is unknown. Assuming it supports C++20.".format(self.name, self.version))
-        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))
+        if self.settings.compiler.get_safe("cppstd"):
+            check_min_cppstd(self, self._min_cppstd)
 
-    @property
-    def _source_subfolder(self):
-        return "source_subfolder"
+        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], 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="*", dst="include", src=os.path.join(self._source_subfolder, "include"))
-        self.copy("COPYING", src=self._source_subfolder, dst="licenses")
-
-    def package_id(self):
-        self.info.header_only()
+        copy(self, "LICENSE",
+             dst=os.path.join(self.package_folder, "licenses"),
+             src=self.source_folder)
+        copy(self, "COPYING",
+             src=self.source_folder,
+             dst=os.path.join(self.package_folder, "licenses"))
+        copy(self, "*",
+             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", self.name)
-        self.cpp_info.set_property("cmake_target_aliases", ["{0}::{0}".format(self.name)])
+        self.cpp_info.set_property("cmake_target_aliases", [f"{self.name}::{self.name}"])
+
+        # TODO: to remove in conan v2 once cmake_find_package_* generators removed
         self.cpp_info.names["cmake_find_package"] = self.name
         self.cpp_info.names["cmake_find_package_multi"] = self.name
diff --git a/recipes/dice-template-library/all/test_package/CMakeLists.txt b/recipes/dice-template-library/all/test_package/CMakeLists.txt
index 6fcf6dde0f94e..554ae3cf16e97 100644
--- a/recipes/dice-template-library/all/test_package/CMakeLists.txt
+++ b/recipes/dice-template-library/all/test_package/CMakeLists.txt
@@ -1,12 +1,12 @@
-cmake_minimum_required(VERSION 3.1)
-project(test_package)
+cmake_minimum_required(VERSION 3.15)
+project(test_package LANGUAGES CXX)
 
-set(CMAKE_CXX_STANDARD 20)
-set(CMAKE_CXX_STANDARD_REQUIRED True)
+find_package(dice-template-library REQUIRED CONFIG)
 
-include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
-conan_basic_setup(TARGETS)
-
-find_package(dice-template-library REQUIRED)
 add_executable(${PROJECT_NAME} test_package.cpp)
 target_link_libraries(${PROJECT_NAME} PRIVATE dice-template-library::dice-template-library)
+target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20)
+
+if(dice-template-library_VERSION VERSION_GREATER_EQUAL "1.0.0")
+  target_compile_definitions(${PROJECT_NAME} PRIVATE DICE_TEMPLATE_LIBRARY_1_0_0_LATER)
+endif()
diff --git a/recipes/dice-template-library/all/test_package/conanfile.py b/recipes/dice-template-library/all/test_package/conanfile.py
index 9d8f35201d56c..fae501d0afb9e 100644
--- a/recipes/dice-template-library/all/test_package/conanfile.py
+++ b/recipes/dice-template-library/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", "cmake_find_package_multi",
+    settings = "os", "arch", "compiler", "build_type"
+    generators = "CMakeDeps", "CMakeToolchain"
+    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.bindir, "test_package")
+            self.run(bin_path, env="conanrun")
diff --git a/recipes/dice-template-library/all/test_package/test_package.cpp b/recipes/dice-template-library/all/test_package/test_package.cpp
index 49e49454d63d0..0b8175abb07cc 100644
--- a/recipes/dice-template-library/all/test_package/test_package.cpp
+++ b/recipes/dice-template-library/all/test_package/test_package.cpp
@@ -1,11 +1,41 @@
-#include 
-
 #include 
 #include 
 
-template  struct Wrapper { static constexpr int i = N; };
+#include 
+
+#ifdef DICE_TEMPLATE_LIBRARY_1_0_0_LATER
+template
+struct int_array : std::array {
+private:
+	template
+	int_array(int value, std::index_sequence) : std::array{((void) IDs, value)...} {}
+
+public:
+	int_array() = default;
+	int_array(int value) : int_array(value, std::make_index_sequence{}) {}
+};
+
+template
+std::ostream &operator<<(std::ostream &os, int_array const &arr) {
+	if (N == 0) { return os << "0: []"; }
+	os << N << ": [";
+	for (std::size_t i = 0; i < N - 1; ++i) { os << arr[i] << ", "; }
+	return os << arr[N - 1] << ']';
+}
+
+int main() {
+    dice::template_library::integral_template_tuple<5UL, 8, int_array> itt;
+    std::cout << "  " << itt.template get<5>() << '\n';
+}
+
+#else
+
+template  struct Wrapper {
+    static constexpr int i = N;
+};
 
 int main() {
     dice::template_library::integral_template_tuple tup;
     std::cout << std::boolalpha << "tup.get<3>().i == 3: " << (tup.get<3>().i == 3) << std::endl;
 }
+#endif
diff --git a/recipes/dice-template-library/all/test_v1_package/CMakeLists.txt b/recipes/dice-template-library/all/test_v1_package/CMakeLists.txt
new file mode 100644
index 0000000000000..91630d79f4abb
--- /dev/null
+++ b/recipes/dice-template-library/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/dice-template-library/all/test_v1_package/conanfile.py b/recipes/dice-template-library/all/test_v1_package/conanfile.py
new file mode 100644
index 0000000000000..fd66d89b7cd91
--- /dev/null
+++ b/recipes/dice-template-library/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", "cmake_find_package_multi",
+
+    def build(self):
+        cmake = CMake(self)
+        cmake.configure()
+        cmake.build()
+
+    def test(self):
+        if not tools.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/config.yml b/recipes/dice-template-library/config.yml
index b657866f6cca6..37901e90b8f3b 100644
--- a/recipes/dice-template-library/config.yml
+++ b/recipes/dice-template-library/config.yml
@@ -1,7 +1,23 @@
 versions:
-  "0.1.0":
+  "1.9.0":
     folder: all
-  "0.2.0":
+  "1.8.0":
+    folder: all
+  "1.6.0":
+    folder: all
+  "1.5.0":
+    folder: all
+  "1.3.0":
+    folder: all
+  "1.2.0":
+    folder: all
+  "1.1.0":
+    folder: all
+  "1.0.0":
     folder: all
   "0.3.0":
     folder: all
+  "0.2.0":
+    folder: all
+  "0.1.0":
+    folder: all
diff --git a/recipes/diligent-core/all/CMakeLists.txt b/recipes/diligent-core/all/CMakeLists.txt
deleted file mode 100644
index a00123a14d403..0000000000000
--- a/recipes/diligent-core/all/CMakeLists.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-cmake_minimum_required(VERSION 3.2)
-project(cmake_wrapper)
-
-find_package(SPIRV-Tools REQUIRED CONFIG)
-find_package(spirv-cross REQUIRED CONFIG)
-find_package(glslang REQUIRED CONFIG)
-find_package(volk REQUIRED CONFIG)
-find_package(xxHash REQUIRED CONFIG)
-
-add_library(glslang INTERFACE)
-target_link_libraries(glslang INTERFACE 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/conan_deps.cmake b/recipes/diligent-core/all/conan_deps.cmake
new file mode 100644
index 0000000000000..22d5c713e1417
--- /dev/null
+++ b/recipes/diligent-core/all/conan_deps.cmake
@@ -0,0 +1,15 @@
+find_package(SPIRV-Tools REQUIRED CONFIG)
+find_package(spirv-cross REQUIRED CONFIG)
+find_package(volk REQUIRED CONFIG)
+find_package(xxHash REQUIRED CONFIG)
+
+if (NOT ${DILIGENT_NO_GLSLANG})
+    find_package(glslang REQUIRED CONFIG)
+    add_library(glslang INTERFACE)
+    target_link_libraries(glslang INTERFACE glslang::glslang)
+    target_include_directories(glslang INTERFACE ${glslang_INCLUDE_DIR}/glslang)
+    add_library(SPIRV ALIAS glslang::SPIRV)
+endif()
+
+add_library(SPIRV-Headers ALIAS SPIRV-Headers::SPIRV-Headers)
+add_library(spirv-tools-core   ALIAS spirv-tools::spirv-tools)
diff --git a/recipes/diligent-core/all/conandata.yml b/recipes/diligent-core/all/conandata.yml
index a48d5fbd77dc8..1b7fc1ffdeef6 100644
--- a/recipes/diligent-core/all/conandata.yml
+++ b/recipes/diligent-core/all/conandata.yml
@@ -23,37 +23,21 @@ sources:
 patches:
   "api.252003":
     - patch_file: "patches/0023-252003-fix-warning-as-error.patch"
-      base_path: "source_subfolder"
   "2.5.2":
     - patch_file: "patches/0014-252-exclude-tests.patch"
-      base_path: "source_subfolder"
     - patch_file: "patches/0015-252-dont-install-3d-party-license.patch"
-      base_path: "source_subfolder"
     - patch_file: "patches/0016-252-fix-glslang-usage.patch"
-      base_path: "source_subfolder"
     - patch_file: "patches/0017-252-fix-glslang-include.patch"
-      base_path: "source_subfolder"
     - patch_file: "patches/0018-252-fix-warning-as-error.patch"
-      base_path: "source_subfolder"
   "2.5.1":
     - patch_file: "patches/0001-remove_warning_as_error.patch"
-      base_path: "source_subfolder"
     - patch_file: "patches/0002-use_conan_dependencies.patch"
-      base_path: "source_subfolder"
     - patch_file: "patches/0003-use_volk_from_conan.patch"
-      base_path: "source_subfolder"
     - patch_file: "patches/0005-spirv-cross-namespace-override.patch"
-      base_path: "source_subfolder"
     - patch_file: "patches/0006-install-linux-platform-header.diff"
-      base_path: "source_subfolder"
   "api.250014":
     - patch_file: "patches/0007-API250014-remove_warning_as_error.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"
-      base_path: "source_subfolder"
     - patch_file: "patches/0013-API250014-use-vulkan-headers-in-archiver.patch"
-      base_path: "source_subfolder"
     - patch_file: "patches/0005-spirv-cross-namespace-override.patch"
-      base_path: "source_subfolder"
diff --git a/recipes/diligent-core/all/conanfile.py b/recipes/diligent-core/all/conanfile.py
index a02de86844027..5b7a0c26b76e5 100644
--- a/recipes/diligent-core/all/conanfile.py
+++ b/recipes/diligent-core/all/conanfile.py
@@ -3,7 +3,8 @@
 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.files import rm, get, rmdir, rename, collect_libs, export_conandata_patches, copy, apply_conandata_patches, replace_in_file
+from conan.tools.microsoft import visual
 from conan.tools.apple import is_apple_os
 import os
 
@@ -34,6 +35,7 @@ class DiligentCoreConan(ConanFile):
     def _minimum_compilers_version(self):
         return {
             "Visual Studio": "16",
+            "msvc": "192",
             "gcc": "6",
             "clang": "3.4",
             "apple-clang": "5.1",
@@ -48,29 +50,28 @@ def validate(self):
             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.output.warning("{} 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))
-        if self.settings.compiler == "Visual Studio" and "MT" in self.settings.compiler.runtime:
+        if visual.is_msvc_static_runtime(self):
             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)
+        copy(self, "conan_deps.cmake", src=self.recipe_folder, dst=os.path.join(self.export_sources_folder, "src"), keep_path=False)
         export_conandata_patches(self)
         
     def source(self):
-        get(self, **self.conan_data["sources"][self.version],
-            destination=os.path.join(self.source_folder, "source_subfolder"), strip_root=True)
+        get(self, **self.conan_data["sources"][self.version], strip_root=True)
 
     def package_id(self):
-        if self.settings.compiler == "Visual Studio":
-            if "MD" in self.settings.compiler.runtime:
-                self.info.settings.compiler.runtime = "MD/MDd"
-            else:
+        if visual.is_msvc(self.info):
+            if visual.is_msvc_static_runtime(self.info):
                 self.info.settings.compiler.runtime = "MT/MTd"
+            else:
+                self.info.settings.compiler.runtime = "MD/MDd"
 
     def generate(self):
         tc = CMakeToolchain(self)
@@ -79,8 +80,7 @@ def generate(self):
         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["SPIRV_CROSS_NAMESPACE_OVERRIDE"] = self.dependencies["spirv-cross"].options.namespace
         tc.variables["DILIGENT_CLANG_COMPILE_OPTIONS"] = ""
         tc.variables["DILIGENT_MSVC_COMPILE_OPTIONS"] = ""
         tc.variables["ENABLE_RTTI"] = True
@@ -92,34 +92,37 @@ def generate(self):
         deps.generate()
 
     def layout(self):
-        cmake_layout(self)
+        cmake_layout(self, src_folder="src")
 
     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
+            self.options.rm_safe("fPIC")
 
     def _patch_sources(self):
-        patches.apply_conandata_patches(self)
+        apply_conandata_patches(self)
+        replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"),
+                        "project(DiligentCore)",
+                        "project(DiligentCore)\n\ninclude(conan_deps.cmake)")
 
     def build_requirements(self):
-        self.tool_requires("cmake/3.24.2")
+        self.tool_requires("cmake/[>=3.24 <4]")
 
     def requirements(self):
         self.requires("opengl/system")
         if self.settings.os == "Linux":
-            self.requires("wayland/1.21.0")
+            self.requires("wayland/1.22.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.224.0")
-        self.requires("vulkan-headers/1.3.224.1")
+        self.requires("vulkan-headers/1.3.224.0")
         self.requires("vulkan-validationlayers/1.3.224.1")
-        self.requires("volk/1.3.224.1")
+        self.requires("volk/1.3.224.0")
         self.requires("xxhash/0.8.1")
 
         if self.settings.os in ["Linux", "FreeBSD"]:
@@ -144,21 +147,25 @@ def _diligent_platform(self):
             return "PLATFORM_TVOS"
 
     def build(self):
-        apply_conandata_patches(self)
+        self._patch_sources()
         cmake = CMake(self)
-        cmake.configure()
+        # By default, Diligent builds static and shared versions of every main library. We select the one we
+        # want based on options.shared in package(). To avoid building every intermediate library as SHARED,
+        # we have to disable BUILD_SHARED_LIBS.
+        # However, BUILD_SHARED_LIBS cannot be disabled normally (in the toolchain in configure()), because
+        # Conan outputs that override after the standard line that enables BUILD_SHARED_LIBS. Since the latter
+        # is a CACHE variable that cannot be overwritten with another set(), we have to specify it on the
+        # command-line, so it takes effect before the toolchain is parsed.
+        cmake.configure(variables={"BUILD_SHARED_LIBS": "OFF"})
         cmake.build()
 
     def package(self):
         cmake = CMake(self)
         cmake.install()
-        rename(self, src=os.path.join(self.package_folder, "include", "source_subfolder"),
-        dst=os.path.join(self.package_folder, "include", "DiligentCore"))
-
         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"))
+        copy(self, "License.txt", dst=os.path.join(self.package_folder, "licenses"), src=os.path.join(self.package_folder, self.source_folder))
 
         if self.options.shared:
             copy(self, pattern="*.dylib", dst=os.path.join(self.package_folder, "lib"), src=self.build_folder, keep_path=False)
@@ -184,37 +191,37 @@ def package_info(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"))
-
-        self.cpp_info.includedirs.append(os.path.join("include", "DiligentCore"))
-        self.cpp_info.includedirs.append(os.path.join("include", "DiligentCore", "Common", "interface"))
-        self.cpp_info.includedirs.append(os.path.join("include", "DiligentCore", "Platforms", "interface"))
-        self.cpp_info.includedirs.append(os.path.join("include", "DiligentCore", "Graphics", "GraphicsEngine", "interface"))
-        self.cpp_info.includedirs.append(os.path.join("include", "DiligentCore", "Graphics", "GraphicsEngineVulkan", "interface"))
-        self.cpp_info.includedirs.append(os.path.join("include", "DiligentCore", "Graphics", "GraphicsEngineOpenGL", "interface"))
-        self.cpp_info.includedirs.append(os.path.join("include", "DiligentCore", "Graphics", "GraphicsAccessories", "interface"))
-        self.cpp_info.includedirs.append(os.path.join("include", "DiligentCore", "Graphics", "GraphicsTools", "interface"))
-        self.cpp_info.includedirs.append(os.path.join("include", "DiligentCore", "Graphics", "HLSL2GLSLConverterLib", "interface"))
-        archiver_path = os.path.join("include", "DiligentCore", "Graphics", "Archiver", "interface")
+        self.cpp_info.includedirs.append(os.path.join(self.package_folder, "include", "Common"))
+
+        self.cpp_info.includedirs.append(os.path.join("include"))
+        self.cpp_info.includedirs.append(os.path.join("include", "Common", "interface"))
+        self.cpp_info.includedirs.append(os.path.join("include", "Platforms", "interface"))
+        self.cpp_info.includedirs.append(os.path.join("include", "Graphics", "GraphicsEngine", "interface"))
+        self.cpp_info.includedirs.append(os.path.join("include", "Graphics", "GraphicsEngineVulkan", "interface"))
+        self.cpp_info.includedirs.append(os.path.join("include", "Graphics", "GraphicsEngineOpenGL", "interface"))
+        self.cpp_info.includedirs.append(os.path.join("include", "Graphics", "GraphicsAccessories", "interface"))
+        self.cpp_info.includedirs.append(os.path.join("include", "Graphics", "GraphicsTools", "interface"))
+        self.cpp_info.includedirs.append(os.path.join("include", "Graphics", "HLSL2GLSLConverterLib", "interface"))
+        archiver_path = os.path.join("include", "Graphics", "Archiver", "interface")
         if os.path.isdir(archiver_path):
             self.cpp_info.includedirs.append(archiver_path)
 
-        self.cpp_info.includedirs.append(os.path.join("include", "DiligentCore", "Primitives", "interface"))
-        self.cpp_info.includedirs.append(os.path.join("include", "DiligentCore", "Platforms", "Basic", "interface"))
+        self.cpp_info.includedirs.append(os.path.join("include", "Primitives", "interface"))
+        self.cpp_info.includedirs.append(os.path.join("include", "Platforms", "Basic", "interface"))
         if self.settings.os == "Android":
-            self.cpp_info.includedirs.append(os.path.join("include", "DiligentCore", "Platforms", "Android", "interface"))
+            self.cpp_info.includedirs.append(os.path.join("include", "Platforms", "Android", "interface"))
         elif is_apple_os(self):
-            self.cpp_info.includedirs.append(os.path.join("include", "DiligentCore", "Platforms", "Apple", "interface"))
+            self.cpp_info.includedirs.append(os.path.join("include", "Platforms", "Apple", "interface"))
         elif self.settings.os == "Emscripten":
-            self.cpp_info.includedirs.append(os.path.join("include", "DiligentCore", "Platforms", "Emscripten", "interface"))
+            self.cpp_info.includedirs.append(os.path.join("include", "Platforms", "Emscripten", "interface"))
         elif self.settings.os == "Linux":
-            self.cpp_info.includedirs.append(os.path.join("include", "DiligentCore", "Platforms", "Linux", "interface"))
+            self.cpp_info.includedirs.append(os.path.join("include", "Platforms", "Linux", "interface"))
         elif self.settings.os == "Windows":
-            self.cpp_info.includedirs.append(os.path.join("include", "DiligentCore", "Platforms", "Win32", "interface"))
-            self.cpp_info.includedirs.append(os.path.join("include", "DiligentCore", "Graphics", "GraphicsEngineD3D11", "interface"))
-            self.cpp_info.includedirs.append(os.path.join("include", "DiligentCore", "Graphics", "GraphicsEngineD3D12", "interface"))
+            self.cpp_info.includedirs.append(os.path.join("include", "Platforms", "Win32", "interface"))
+            self.cpp_info.includedirs.append(os.path.join("include", "Graphics", "GraphicsEngineD3D11", "interface"))
+            self.cpp_info.includedirs.append(os.path.join("include", "Graphics", "GraphicsEngineD3D12", "interface"))
 
-        self.cpp_info.defines.append("SPIRV_CROSS_NAMESPACE_OVERRIDE={}".format(self.options["spirv-cross"].namespace))
+        self.cpp_info.defines.append("SPIRV_CROSS_NAMESPACE_OVERRIDE={}".format(self.dependencies["spirv-cross"].options.namespace))
         self.cpp_info.defines.append("{}=1".format(self._diligent_platform()))
 
         if self.settings.os in ["Macos", "Linux"]:
diff --git a/recipes/diligent-core/all/test_package/CMakeLists.txt b/recipes/diligent-core/all/test_package/CMakeLists.txt
index 927e85d16c3ed..1960d37cb752f 100644
--- a/recipes/diligent-core/all/test_package/CMakeLists.txt
+++ b/recipes/diligent-core/all/test_package/CMakeLists.txt
@@ -1,24 +1,17 @@
 cmake_minimum_required(VERSION 3.1)
 project(test_package)
 
-include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
-conan_basic_setup()
+find_package(diligent-core REQUIRED CONFIG)
 
-if(WIN32)
-  set(FILE2STRING_PATH "${CONAN_BIN_DIRS_DILIGENT-CORE}/File2String.exe")
-else()
-  set(FILE2STRING_PATH "${CONAN_BIN_DIRS_DILIGENT-CORE}/File2String")
-endif()
-
-set(FILE "${CONAN_RES_DIRS_DILIGENT}/HLSLDefinitions.fxh")
+set(FILE "${core_INCLUDE_DIR}/../res/HLSLDefinitions.fxh")
 set(CONVERTED_FILE "${PROJECT_BINARY_DIR}/HLSLDefinitions.h")
 
 add_custom_command(OUTPUT ${CONVERTED_FILE}
-                   COMMAND ${FILE2STRING_PATH} ${FILE} ${CONVERTED_FILE}
+                   COMMAND File2String ${FILE} ${CONVERTED_FILE}
                    MAIN_DEPENDENCY ${FILE} # the primary input source file to the command
                    COMMENT "Processing shader ${FILE}"
                    VERBATIM)
 
 add_executable(${PROJECT_NAME} test_package.cpp)
-target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS})
+target_link_libraries(${PROJECT_NAME} diligent-core::diligent-core)
 set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17)
diff --git a/recipes/diligent-core/all/test_package/conanfile.py b/recipes/diligent-core/all/test_package/conanfile.py
index f2355b8294daf..fc51d8e4aee2d 100644
--- a/recipes/diligent-core/all/test_package/conanfile.py
+++ b/recipes/diligent-core/all/test_package/conanfile.py
@@ -1,10 +1,17 @@
-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
-from conan.tools.build import cross_building
 
 class TestPackageConan(ConanFile):
     settings = "os", "compiler", "build_type", "arch"
-    generators = "cmake"
+    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,6 +19,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/dime/all/CMakeLists.txt b/recipes/dime/all/CMakeLists.txt
deleted file mode 100644
index 8977c3f43d6f8..0000000000000
--- a/recipes/dime/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/dime/all/conanfile.py b/recipes/dime/all/conanfile.py
index 4c72fb275c245..a157a6f7cfc1a 100644
--- a/recipes/dime/all/conanfile.py
+++ b/recipes/dime/all/conanfile.py
@@ -1,96 +1,106 @@
-from conans import ConanFile, CMake, tools
-from conan.tools.microsoft import is_msvc
 import os
-import functools
 
-required_conan_version = ">=1.33.0"
+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, rm, rmdir
+from conan.tools.microsoft import is_msvc
+from conan.tools.scm import Version
+
+required_conan_version = ">=1.52.0"
+
 
 class DimeConan(ConanFile):
     name = "dime"
     description = "DXF (Data eXchange Format) file format support library."
-    topics = ("dxf", "coin3d", "opengl", "graphics")
-    homepage = "https://github.com/coin3d/dime"
-    url = "https://github.com/conan-io/conan-center-index"
     license = "BSD-3-Clause"
-    exports_sources = ["CMakeLists.txt"]
-    generators = "cmake",
-    settings = "os", "arch", "compiler", "build_type",
+    url = "https://github.com/conan-io/conan-center-index"
+    homepage = "https://github.com/coin3d/dime"
+    topics = ("dxf", "coin3d", "opengl", "graphics")
+
+    package_type = "library"
+    settings = "os", "arch", "compiler", "build_type"
     options = {
-        "fPIC": [True, False],
         "shared": [True, False],
+        "fPIC": [True, False],
         "fixbig": [True, False],
     }
     default_options = {
-        "fPIC": True,
         "shared": False,
+        "fPIC": True,
         "fixbig": False,
     }
 
-    @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 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], strip_root=True)
 
-    @functools.lru_cache(1)
-    def _configure_cmake(self):
-        cmake = CMake(self)
-        cmake.definitions["DIME_BUILD_SHARED_LIBS"] = self.options.shared
+    def generate(self):
+        tc = CMakeToolchain(self)
+        tc.variables["DIME_BUILD_SHARED_LIBS"] = self.options.shared
         if self.options.fixbig:
-            cmake.definitions["CMAKE_CXX_FLAGS"] = "-DDIME_FIXBIG"
-        cmake.configure(build_folder=self._build_subfolder)
-        return cmake
+            tc.preprocessor_definitions["DIME_FIXBIG"] = ""
+        # Remove register keyword for C++17
+        tc.preprocessor_definitions["register"] = ""
+        tc.generate()
+
+    def _patch_sources(self):
+        replace_in_file(
+            self,
+            os.path.join(self.source_folder, "CMakeLists.txt"),
+            ("configure_file(${CMAKE_SOURCE_DIR}/${PROJECT_NAME_LOWER}.pc.cmake.in"
+             " ${CMAKE_BINARY_DIR}/${PROJECT_NAME_LOWER}.pc @ONLY)"),
+            ("configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME_LOWER}.pc.cmake.in"
+             " ${CMAKE_BINARY_DIR}/${PROJECT_NAME_LOWER}.pc @ONLY)")
+        )
 
     def build(self):
-        tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"),
-            "configure_file(${CMAKE_SOURCE_DIR}/${PROJECT_NAME_LOWER}.pc.cmake.in ${CMAKE_BINARY_DIR}/${PROJECT_NAME_LOWER}.pc @ONLY)",
-            "configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME_LOWER}.pc.cmake.in ${CMAKE_BINARY_DIR}/${PROJECT_NAME_LOWER}.pc @ONLY)")
-        cmake = self._configure_cmake()
+        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, "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"))
         if self.settings.os == "Windows" and is_msvc(self):
-            tools.remove_files_by_mask(self.package_folder, "*.pdb")
+            rm(self, "*.pdb", self.package_folder, recursive=True)
 
     def package_info(self):
         libname = "dime"
         if self.settings.os == "Windows" and is_msvc(self):
             libname = "{}{}{}{}".format(
                 libname,
-                tools.Version(self.version).major,
+                Version(self.version).major,
                 "" if self.options.shared else "s",
                 "d" if self.settings.build_type == "Debug" else "",
-                )
+            )
         self.cpp_info.libs = [libname]
 
         if self.settings.os == "Windows":
-            self.cpp_info.cxxflags.append("-DDIME_DLL" if self.options.shared else "-DDIME_NOT_DLL")
+            self.cpp_info.defines.append("DIME_DLL" if self.options.shared else "DIME_NOT_DLL")
         if self.options.fixbig:
-            self.cpp_info.cxxflags.append("-DDIME_FIXBIG")
+            self.cpp_info.defines.append("DIME_FIXBIG")
 
         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/dime/all/test_package/CMakeLists.txt b/recipes/dime/all/test_package/CMakeLists.txt
index 78a1ddc2ab6be..419ecb0dafce7 100644
--- a/recipes/dime/all/test_package/CMakeLists.txt
+++ b/recipes/dime/all/test_package/CMakeLists.txt
@@ -1,9 +1,6 @@
-cmake_minimum_required(VERSION 3.1)
+cmake_minimum_required(VERSION 3.15)
 project(test_package CXX)
 
-include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
-conan_basic_setup()
-
 find_package(dime CONFIG REQUIRED)
 
 add_executable(${PROJECT_NAME} test_package.cpp)
diff --git a/recipes/dime/all/test_package/conanfile.py b/recipes/dime/all/test_package/conanfile.py
index 17d1e9ed261a6..f8b1e56816775 100644
--- a/recipes/dime/all/test_package/conanfile.py
+++ b/recipes/dime/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", "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,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.bindir, "test_package")
             dxf_path = os.path.join(self.source_folder, "testFile_Bug01.dxf")
-            self.run("{} {}".format(bin_path, dxf_path), run_environment=True)
+            self.run(f"{bin_path} {dxf_path}", env="conanrun")
diff --git a/recipes/dime/all/test_v1_package/CMakeLists.txt b/recipes/dime/all/test_v1_package/CMakeLists.txt
new file mode 100644
index 0000000000000..91630d79f4abb
--- /dev/null
+++ b/recipes/dime/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/dime/all/test_v1_package/conanfile.py b/recipes/dime/all/test_v1_package/conanfile.py
new file mode 100644
index 0000000000000..c1e0ae2f456f0
--- /dev/null
+++ b/recipes/dime/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")
+            dxf_path = os.path.join(self.source_folder, os.pardir, "test_package", "testFile_Bug01.dxf")
+            self.run(f"{bin_path} {dxf_path}", run_environment=True)
diff --git a/recipes/directshowbaseclasses/all/CMakeLists.txt b/recipes/directshowbaseclasses/all/CMakeLists.txt
index bb980e8f92249..f15c0b39a2b26 100644
--- a/recipes/directshowbaseclasses/all/CMakeLists.txt
+++ b/recipes/directshowbaseclasses/all/CMakeLists.txt
@@ -1,10 +1,7 @@
-cmake_minimum_required(VERSION 2.8.11)
+cmake_minimum_required(VERSION 3.12)
 project(strmbas)
 
-include(conanbuildinfo.cmake)
-conan_basic_setup()
-
-set(DSROOT "${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder/Samples/Win7Samples/multimedia/directshow/baseclasses")
+set(DSROOT "${CMAKE_CURRENT_SOURCE_DIR}/src/Samples/Win7Samples/multimedia/directshow/baseclasses")
 
 file(GLOB SOURCES "${DSROOT}/*.cpp")
 file(GLOB HEADERS "${DSROOT}/*.h")
diff --git a/recipes/directshowbaseclasses/all/conanfile.py b/recipes/directshowbaseclasses/all/conanfile.py
index 4f42eddc66a52..e71fc156ca323 100644
--- a/recipes/directshowbaseclasses/all/conanfile.py
+++ b/recipes/directshowbaseclasses/all/conanfile.py
@@ -1,40 +1,60 @@
-from conans import ConanFile, CMake, tools
 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, CMakeToolchain, cmake_layout
+from conan.tools.files import copy, get
+
+required_conan_version = ">=1.53.0"
+
 
 class DirectShowBaseClassesConan(ConanFile):
     name = "directshowbaseclasses"
-    description = "Microsoft DirectShow Base Classes are a set of C++ classes and utility functions designed for " \
-                  "implementing DirectShow filters"
+    description = (
+        "Microsoft DirectShow Base Classes are a set of C++ classes and "
+        "utility functions designed for implementing DirectShow filters"
+    )
+    license = "MIT"
     url = "https://github.com/conan-io/conan-center-index"
     homepage = "https://docs.microsoft.com/en-us/windows/desktop/directshow/directshow-base-classes"
-    topics = ("conan", "directshow", "dshow")
-    license = "MIT"
-    exports_sources = ["CMakeLists.txt"]
-    generators = "cmake"
-    settings = {"os": ["Windows"], "arch": ["x86", "x86_64"], "compiler": None, "build_type": None}
-    _source_subfolder = "source_subfolder"
-    _build_subfolder = "build_subfolder"
+    topics = ("directshow", "dshow")
+
+    package_type = "static-library"
+    settings = "os", "arch", "compiler", "build_type"
     short_paths = True
 
+    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.os != "Windows":
+            raise ConanInvalidConfiguration(f"{self.ref} can only be used on Windows.")
+        if self.settings.compiler.cppstd:
+            check_min_cppstd(self, 11)
+
     def source(self):
-        tools.get(**self.conan_data["sources"][self.version])
-        os.rename('Windows-classic-samples-%s' % self.version, self._source_subfolder)
+        get(self, **self.conan_data["sources"][self.version], strip_root=True)
 
-    def _configure_cmake(self):
-        cmake = CMake(self)
-        cmake.configure(build_folder=self._build_subfolder)
-        return cmake
+    def generate(self):
+        tc = CMakeToolchain(self)
+        tc.generate()
 
     def build(self):
-        cmake = self._configure_cmake()
+        cmake = CMake(self)
+        cmake.configure(build_script_folder=self.source_path.parent)
         cmake.build()
 
     def package(self):
-        self.copy(pattern="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()
 
     def package_info(self):
-        self.cpp_info.libs = ['strmbasd' if self.settings.build_type == 'Debug' else 'strmbase']
-        self.cpp_info.system_libs = ['strmiids', 'winmm']
+        self.cpp_info.libs = ["strmbasd" if self.settings.build_type == "Debug" else "strmbase"]
+        self.cpp_info.system_libs = ["strmiids", "winmm"]
diff --git a/recipes/directshowbaseclasses/all/test_package/CMakeLists.txt b/recipes/directshowbaseclasses/all/test_package/CMakeLists.txt
index 196188113685c..888739db919db 100644
--- a/recipes/directshowbaseclasses/all/test_package/CMakeLists.txt
+++ b/recipes/directshowbaseclasses/all/test_package/CMakeLists.txt
@@ -1,8 +1,8 @@
-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()
+find_package(directshowbaseclasses REQUIRED CONFIG)
 
 add_executable(${PROJECT_NAME} test_package.cpp)
-target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS})
+target_link_libraries(${PROJECT_NAME} PRIVATE directshowbaseclasses::directshowbaseclasses)
+target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11)
diff --git a/recipes/directshowbaseclasses/all/test_package/conanfile.py b/recipes/directshowbaseclasses/all/test_package/conanfile.py
index b88a6525524a6..ef5d7042163ec 100644
--- a/recipes/directshowbaseclasses/all/test_package/conanfile.py
+++ b/recipes/directshowbaseclasses/all/test_package/conanfile.py
@@ -1,10 +1,19 @@
-from conans import ConanFile, CMake
+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,5 +21,6 @@ def build(self):
         cmake.build()
 
     def test(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/directshowbaseclasses/all/test_v1_package/CMakeLists.txt b/recipes/directshowbaseclasses/all/test_v1_package/CMakeLists.txt
new file mode 100644
index 0000000000000..91630d79f4abb
--- /dev/null
+++ b/recipes/directshowbaseclasses/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/directshowbaseclasses/all/test_v1_package/conanfile.py b/recipes/directshowbaseclasses/all/test_v1_package/conanfile.py
new file mode 100644
index 0000000000000..a9a22676d134f
--- /dev/null
+++ b/recipes/directshowbaseclasses/all/test_v1_package/conanfile.py
@@ -0,0 +1,16 @@
+from conans import ConanFile, CMake
+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):
+        bin_path = os.path.join("bin", "test_package")
+        self.run(bin_path, run_environment=True)
diff --git a/recipes/directx-headers/all/conandata.yml b/recipes/directx-headers/all/conandata.yml
new file mode 100644
index 0000000000000..ad2d7265cac43
--- /dev/null
+++ b/recipes/directx-headers/all/conandata.yml
@@ -0,0 +1,7 @@
+sources:
+  "1.614.0":
+    url: "https://github.com/microsoft/DirectX-Headers/archive/refs/tags/v1.614.0.tar.gz"
+    sha256: "1cd54449799501a4ad129a4c7ccf0c026bbb699f937ba299d92de3aacd29c5be"
+  "1.610.2":
+    url: "https://github.com/microsoft/DirectX-Headers/archive/refs/tags/v1.610.2.tar.gz"
+    sha256: "59492497e99bd3c23f8f8aa8a709f4d7b5bc5bd5057efa8c568bbad40015a8b2"
diff --git a/recipes/directx-headers/all/conanfile.py b/recipes/directx-headers/all/conanfile.py
new file mode 100644
index 0000000000000..773848c7bfa5b
--- /dev/null
+++ b/recipes/directx-headers/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.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
+from conan.tools.scm import Version
+import os
+
+
+required_conan_version = ">=1.52.0"
+
+
+class DirectXHeadersConan(ConanFile):
+    name = "directx-headers"
+    description = "Headers for using D3D12"
+    license = "MIT"
+    url = "https://github.com/conan-io/conan-center-index"
+    homepage = "https://github.com/microsoft/DirectX-Headers"
+    topics = ("3d", "d3d", "d3d12", "direct", "direct3d", "directx", "graphics")
+    package_type = "static-library"
+    settings = "os", "arch", "compiler", "build_type"
+
+    @property
+    def _min_cppstd(self):
+        return 11
+
+    @property
+    def _compilers_minimum_version(self):
+        return {
+            "apple-clang": "10",
+            "clang": "5",
+            "gcc": "6",
+            "msvc": "191",
+            "Visual Studio": "15",
+        }
+
+    def layout(self):
+        basic_layout(self, src_folder="src")
+
+    def validate(self):
+        if not self.settings.os in ["Linux", "Windows"]:
+            raise ConanInvalidConfiguration(f"{self.name} is not supported on {self.settings.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 build_requirements(self):
+        self.tool_requires("meson/1.2.2")
+
+    def source(self):
+        get(self, **self.conan_data["sources"][self.version], strip_root=True)
+
+    def generate(self):
+        tc = MesonToolchain(self)
+        tc.project_options["build-test"] = False
+        tc.generate()
+        virtual_build_env = VirtualBuildEnv(self)
+        virtual_build_env.generate()
+
+    def build(self):
+        meson = Meson(self)
+        meson.configure()
+        meson.build()
+
+    def package(self):
+        copy(self, "LICENSE", 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"))
+
+    def package_info(self):
+        if self.settings.os == "Linux" or self.settings.get_safe("os.subsystem") == "wsl":
+            self.cpp_info.includedirs.append(os.path.join("include", "wsl", "stubs"))
+        self.cpp_info.libs = ["d3dx12-format-properties", "DirectX-Guids"]
+        self.cpp_info.set_property("cmake_file_name", "DirectX-Headers")
+        self.cpp_info.set_property("cmake_target_name", "Microsoft::DirectX-Headers")
+        self.cpp_info.set_property("pkg_config_name", "DirectX-Headers")
+        if self.settings.os == "Windows":
+            self.cpp_info.system_libs.append("d3d12")
+        if self.settings.compiler == "msvc":
+            self.cpp_info.system_libs.append("dxcore")
diff --git a/recipes/directx-headers/all/test_package/conanfile.py b/recipes/directx-headers/all/test_package/conanfile.py
new file mode 100644
index 0000000000000..5aab0703e7a4e
--- /dev/null
+++ b/recipes/directx-headers/all/test_package/conanfile.py
@@ -0,0 +1,32 @@
+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):
+    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/1.2.2")
+        if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str):
+            self.tool_requires("pkgconf/2.0.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.bindir, "test_package")
+            self.run(bin_path, env="conanrun")
diff --git a/recipes/directx-headers/all/test_package/meson.build b/recipes/directx-headers/all/test_package/meson.build
new file mode 100644
index 0000000000000..76e32d2ca901b
--- /dev/null
+++ b/recipes/directx-headers/all/test_package/meson.build
@@ -0,0 +1,5 @@
+project('test_package', 'cpp')
+package_dep = dependency('DirectX-Headers')
+executable('test_package',
+            sources : ['test_package.cpp'],
+            dependencies : [package_dep])
diff --git a/recipes/directx-headers/all/test_package/test_package.cpp b/recipes/directx-headers/all/test_package/test_package.cpp
new file mode 100644
index 0000000000000..274bb2436bb72
--- /dev/null
+++ b/recipes/directx-headers/all/test_package/test_package.cpp
@@ -0,0 +1,7 @@
+#include 
+#include 
+
+int main()
+{
+    return sizeof(IID_IUnknown) == 0;
+}
diff --git a/recipes/directx-headers/config.yml b/recipes/directx-headers/config.yml
new file mode 100644
index 0000000000000..5129440c45004
--- /dev/null
+++ b/recipes/directx-headers/config.yml
@@ -0,0 +1,5 @@
+versions:
+  "1.614.0":
+    folder: all
+  "1.610.2":
+    folder: all
diff --git a/recipes/dirent/all/conandata.yml b/recipes/dirent/all/conandata.yml
index 41d2c31a73c7a..30637c5892d6d 100644
--- a/recipes/dirent/all/conandata.yml
+++ b/recipes/dirent/all/conandata.yml
@@ -1,4 +1,7 @@
 sources:
+  "1.24":
+    url: "https://github.com/tronkko/dirent/archive/1.24.tar.gz"
+    sha256: "37009127a65bb1ddc47d06c097321f87f45ca2e998b2ec3bf2e0b2b19649d6f9"
   "1.23.2":
     url: "https://github.com/tronkko/dirent/archive/1.23.2.tar.gz"
     sha256: "f72d39e3c39610b6901e391b140aa69b51e0eb99216939ed5e547b5dad03afb1"
diff --git a/recipes/dirent/all/conanfile.py b/recipes/dirent/all/conanfile.py
index e071fe36066ee..57cf3a210664f 100644
--- a/recipes/dirent/all/conanfile.py
+++ b/recipes/dirent/all/conanfile.py
@@ -1,34 +1,47 @@
+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
-from conans import ConanFile, tools
-from conans.errors import ConanInvalidConfiguration
 
+required_conan_version = ">=1.52.0"
 
 class DirEntConan(ConanFile):
     name = "dirent"
     description = "Dirent is a C/C++ programming interface that allows programmers to retrieve information about " \
                   "files and directories under Linux/UNIX"
-    topics = ("conan", "dirent", "directory", "file system")
-    homepage = "https://github.com/tronkko/dirent"
-    url = "https://github.com/conan-io/conan-center-index"
     license = "MIT"
-    settings = "os", "compiler"
+    url = "https://github.com/conan-io/conan-center-index"
+    homepage = "https://github.com/tronkko/dirent"
+    topics = ("directory", "file system", "header-only")
+    package_type = "header-library"
+    settings = "os", "arch", "compiler", "build_type"
     no_copy_source = True
 
-    _source_subfolder = "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.os != "Windows":
             raise ConanInvalidConfiguration("Only Windows builds are supported")
         if self.settings.compiler == "gcc":
             raise ConanInvalidConfiguration("mingw has a dirent.h implementation")
 
     def source(self):
-        tools.get(**self.conan_data["sources"][self.version])
-        os.rename("dirent-{}".format(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="dirent.h", src=os.path.join(self._source_subfolder, "include"), dst="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/dirent/all/test_package/CMakeLists.txt b/recipes/dirent/all/test_package/CMakeLists.txt
index 196188113685c..682b23e6c7c90 100644
--- a/recipes/dirent/all/test_package/CMakeLists.txt
+++ b/recipes/dirent/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(dirent REQUIRED CONFIG)
 
 add_executable(${PROJECT_NAME} test_package.cpp)
-target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS})
+target_link_libraries(${PROJECT_NAME} dirent::dirent)
diff --git a/recipes/dirent/all/test_package/conanfile.py b/recipes/dirent/all/test_package/conanfile.py
index bd7165a553cf4..b9d7f11e89dcd 100644
--- a/recipes/dirent/all/test_package/conanfile.py
+++ b/recipes/dirent/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"
+    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.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/dirent/all/test_v1_package/CMakeLists.txt b/recipes/dirent/all/test_v1_package/CMakeLists.txt
new file mode 100644
index 0000000000000..be00a8c7f57c7
--- /dev/null
+++ b/recipes/dirent/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/dirent/all/test_v1_package/conanfile.py b/recipes/dirent/all/test_v1_package/conanfile.py
new file mode 100644
index 0000000000000..5a05af3c2dfd2
--- /dev/null
+++ b/recipes/dirent/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/dirent/config.yml b/recipes/dirent/config.yml
index 6086eb1e0524d..bb0674fda16d8 100644
--- a/recipes/dirent/config.yml
+++ b/recipes/dirent/config.yml
@@ -1,3 +1,5 @@
 versions:
+  "1.24":
+    folder: all
   "1.23.2":
     folder: all
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/dispenso/all/conandata.yml b/recipes/dispenso/all/conandata.yml
new file mode 100644
index 0000000000000..b025fdf2f9ff6
--- /dev/null
+++ b/recipes/dispenso/all/conandata.yml
@@ -0,0 +1,9 @@
+sources:
+  "1.3.0":
+    url: "https://github.com/facebookincubator/dispenso/archive/refs/tags/v1.3.0.tar.gz"
+    sha256: "824afe8d0d36bfd9bc9b1cbe9be89e7f3ed642a3612766d1c99d5f8dfc647c63"
+patches:
+  "1.3.0":
+    - patch_file: "patches/1.3.0-001-unvendorize-concurrentqueue.patch"
+      patch_type: "conan"
+      patch_description: "Unvendorize concurrentqueue dependency"
diff --git a/recipes/dispenso/all/conanfile.py b/recipes/dispenso/all/conanfile.py
new file mode 100644
index 0000000000000..3c8d02f91bd44
--- /dev/null
+++ b/recipes/dispenso/all/conanfile.py
@@ -0,0 +1,118 @@
+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, export_conandata_patches, apply_conandata_patches, rm, rmdir
+from conan.tools.scm import Version
+import os
+
+
+required_conan_version = ">=1.53.0"
+
+
+class DispensoPackage(ConanFile):
+    name = "dispenso"
+    description = "Dispenso is a library for working with sets of tasks in parallel"
+    license = "MIT"
+    url = "https://github.com/conan-io/conan-center-index"
+    homepage = "https://github.com/facebookincubator/dispenso"
+    topics = ("tasks", "parallel", "threads")
+    package_type = "library"
+    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 {
+            "apple-clang": "10",
+            "clang": "7",
+            "gcc": "7",
+            "msvc": "191",
+            "Visual Studio": "15",
+        }
+
+    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 export_sources(self):
+        export_conandata_patches(self)
+
+    def layout(self):
+        cmake_layout(self, src_folder="src")
+
+    def requirements(self):
+        # Part of the public api in dispenso/thread_pool.h (and more), unvendorized
+        self.requires("concurrentqueue/1.0.4", transitive_headers=True)
+
+    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."
+            )
+
+    def source(self):
+        get(self, **self.conan_data["sources"][self.version], strip_root=True)
+
+    def generate(self):
+        tc = CMakeToolchain(self)
+        tc.variables["DISPENSO_SHARED_LIB"] = self.options.shared
+        if self.settings.os == "Windows":
+            tc.preprocessor_definitions["NOMINMAX"] = 1
+            tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = 1
+        if self.settings.get_safe("compiler.cppstd") is None:
+            # TODO: Remove once Conan 1 is deprecated, this is needed so apple-clang
+            # can compile, as it defaults to C++98
+            tc.variables["CMAKE_CXX_STANDARD"] = self._min_cppstd
+        tc.generate()
+        tc = CMakeDeps(self)
+        tc.generate()
+
+    def build(self):
+        apply_conandata_patches(self)
+        cmake = CMake(self)
+        cmake.configure()
+        cmake.build()
+
+    def package(self):
+        copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses"))
+        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 = ["dispenso"]
+
+        self.cpp_info.set_property("cmake_file_name", "Dispenso")
+        self.cpp_info.set_property("cmake_target_name", "Dispenso::dispenso")
+
+        if self.settings.os in ["Linux", "FreeBSD"]:
+            self.cpp_info.system_libs.extend(["pthread", "m"])
+
+        if self.settings.os == "Windows":
+            self.cpp_info.system_libs.extend(["synchronization", "winmm"])
+            self.cpp_info.defines.append("NOMINMAX")
diff --git a/recipes/dispenso/all/patches/1.3.0-001-unvendorize-concurrentqueue.patch b/recipes/dispenso/all/patches/1.3.0-001-unvendorize-concurrentqueue.patch
new file mode 100644
index 0000000000000..59c0de38973fc
--- /dev/null
+++ b/recipes/dispenso/all/patches/1.3.0-001-unvendorize-concurrentqueue.patch
@@ -0,0 +1,36 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 7af1b8a..05c86a6 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -48,8 +48,6 @@ elseif (THREAD_SANITIZER)
+   add_link_options(-fsanitize=thread)
+ endif()
+ 
+-set(CMAKE_CXX_STANDARD 14 CACHE STRING "the C++ standard to use for this project")
+-
+ ###########################################################
+ # Targets
+ add_subdirectory(dispenso)
+diff --git a/dispenso/CMakeLists.txt b/dispenso/CMakeLists.txt
+index 24a8c48..9231949 100644
+--- a/dispenso/CMakeLists.txt
++++ b/dispenso/CMakeLists.txt
+@@ -33,16 +33,15 @@ endif()
+ target_include_directories(dispenso
+ PUBLIC
+   $
+-  $
+   $
+   $
+-  $
+ )
+ 
+ set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
+ set(THREADS_PREFER_PTHREAD_FLAG TRUE)
+ find_package(Threads REQUIRED)
+-target_link_libraries(dispenso PUBLIC Threads::Threads)
++find_package(concurrentqueue REQUIRED)
++target_link_libraries(dispenso PUBLIC Threads::Threads concurrentqueue::concurrentqueue)
+ 
+ check_cxx_source_compiles("
+ #include 
diff --git a/recipes/dispenso/all/test_package/CMakeLists.txt b/recipes/dispenso/all/test_package/CMakeLists.txt
new file mode 100644
index 0000000000000..37b4a548d33a9
--- /dev/null
+++ b/recipes/dispenso/all/test_package/CMakeLists.txt
@@ -0,0 +1,9 @@
+cmake_minimum_required(VERSION 3.15)
+
+project(test_package LANGUAGES CXX)
+
+find_package(Dispenso REQUIRED CONFIG)
+
+add_executable(${PROJECT_NAME} test_package.cpp)
+target_link_libraries(${PROJECT_NAME} PRIVATE Dispenso::dispenso)
+target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14)
diff --git a/recipes/dispenso/all/test_package/conanfile.py b/recipes/dispenso/all/test_package/conanfile.py
new file mode 100644
index 0000000000000..ef5d7042163ec
--- /dev/null
+++ b/recipes/dispenso/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.bindir, "test_package")
+            self.run(bin_path, env="conanrun")
diff --git a/recipes/dispenso/all/test_package/test_package.cpp b/recipes/dispenso/all/test_package/test_package.cpp
new file mode 100644
index 0000000000000..cd298492d0fe8
--- /dev/null
+++ b/recipes/dispenso/all/test_package/test_package.cpp
@@ -0,0 +1,9 @@
+#include 
+#include "dispenso/parallel_for.h"
+
+
+int main(void) {
+    dispenso::parallel_for(0, 5, [] (size_t j) {
+        std::cout << j << std::endl;
+   });
+}
diff --git a/recipes/dispenso/config.yml b/recipes/dispenso/config.yml
new file mode 100644
index 0000000000000..426a0e4c79e9b
--- /dev/null
+++ b/recipes/dispenso/config.yml
@@ -0,0 +1,3 @@
+versions:
+  "1.3.0":
+    folder: all
diff --git a/recipes/djinni-generator/all/conandata.yml b/recipes/djinni-generator/all/conandata.yml
index f0faa524fc522..3079ff3808154 100644
--- a/recipes/djinni-generator/all/conandata.yml
+++ b/recipes/djinni-generator/all/conandata.yml
@@ -29,3 +29,6 @@ sources:
   "1.3.2":
     url: https://github.com/cross-language-cpp/djinni-generator/releases/download/v1.3.2/djinni
     sha256: "8e618aeb8e9138e7fefaca804263317846799fee59d9465a4eee6625b8266ea1"
+  "1.4.0":
+    url: "https://github.com/cross-language-cpp/djinni-generator/releases/download/v1.4.0/djinni"
+    sha256: "1838504f29e9bd8d7246710cbf31d17abb44b2dbd7df91e08cc7566167fee068"
diff --git a/recipes/djinni-generator/all/conanfile.py b/recipes/djinni-generator/all/conanfile.py
index ae2c62ed78bb5..f6319f3914356 100644
--- a/recipes/djinni-generator/all/conanfile.py
+++ b/recipes/djinni-generator/all/conanfile.py
@@ -1,37 +1,60 @@
 import os
 
-from conans import ConanFile, tools
+from conan import ConanFile
+from conan.tools.files import copy, download
+from conan.tools.layout import basic_layout
+
+required_conan_version = ">=1.47.0"
 
 
 class Djinni(ConanFile):
     name = "djinni-generator"
+    description = "Djinni is a tool for generating cross-language type declarations and interface bindings."
+    license = "Apache-2.0"
     url = "https://github.com/conan-io/conan-center-index"
     homepage = "https://djinni.xlcpp.dev"
-    description = "Djinni is a tool for generating cross-language type declarations and interface bindings."
     topics = ("java", "Objective-C", "ios", "Android")
-    license = "Apache-2.0"
-    settings = "os", "arch"
 
+    package_type = "application"
+    settings = "os", "arch", "compiler", "build_type"
+    no_copy_source = 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
 
     def source(self):
         filename = os.path.basename(self.conan_data["sources"][self.version]["url"])
-        tools.download(filename=filename, **self.conan_data["sources"][self.version])
-        tools.download(filename="LICENSE", url="https://raw.githubusercontent.com/cross-language-cpp/djinni-generator/main/LICENSE")
+        download(self, filename=filename, **self.conan_data["sources"][self.version])
+        download(self, filename="LICENSE", url="https://raw.githubusercontent.com/cross-language-cpp/djinni-generator/main/LICENSE")
 
     def build(self):
         pass # avoid warning for missing build steps
 
     def package(self):
-        if tools.detected_os() == "Windows":
-            os.rename('djinni','djinni.bat')
-            self.copy("djinni.bat", dst="bin", keep_path=False)
+        copy(self, "LICENSE",
+             dst=os.path.join(self.package_folder, "licenses"),
+             src=self.source_folder,
+             keep_path=False)
+        copy(self, "djinni",
+             dst=os.path.join(self.package_folder, "bin"),
+             src=self.source_folder,
+             keep_path=False)
+        if self.settings.os == "Windows":
+            os.rename(os.path.join(self.package_folder, "bin", "djinni"),
+                      os.path.join(self.package_folder, "bin", "djinni.bat"))
         else:
-            self.copy("djinni", dst="bin", keep_path=False)
             executable = os.path.join(self.package_folder, "bin", "djinni")
             os.chmod(executable, os.stat(executable).st_mode | 0o111)
-        self.copy("LICENSE", dst="licenses", keep_path=False)
 
     def package_info(self):
+        self.cpp_info.frameworkdirs = []
+        self.cpp_info.libdirs = []
+        self.cpp_info.resdirs = []
         self.cpp_info.includedirs = []
-        self.env_info.PATH.append(os.path.join(self.package_folder, "bin"))
 
+        # 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/djinni-generator/all/test_package/conanfile.py b/recipes/djinni-generator/all/test_package/conanfile.py
index 456428a9a8670..7d899a138c0dd 100644
--- a/recipes/djinni-generator/all/test_package/conanfile.py
+++ b/recipes/djinni-generator/all/test_package/conanfile.py
@@ -1,21 +1,25 @@
-
 from io import StringIO
-from conans import ConanFile, tools
+
+from conan import ConanFile
+from conan.tools.build import can_run
+
 
 class TestPackageConan(ConanFile):
-    settings = "os", "arch"
+    settings = "os", "arch", "compiler", "build_type"
+    generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv"
+    test_type = "explicit"
 
-    def build(self):
-        pass # please no warning that we build nothing
+    def build_requirements(self):
+        self.tool_requires(self.tested_reference_str)
 
     def test(self):
-        if not tools.cross_building(self.settings):
+        if can_run(self):
             output = StringIO()
-            self.run("djinni --help", output=output, run_environment=True)
-            output.seek(0, 0)
+            self.run("djinni --help", output)
+            output.seek(0)
             found_usage = False
             for line in output:
                 if "Usage: djinni [options]" in line:
                     found_usage = True
                     break
-            assert(found_usage)
+            assert found_usage
diff --git a/recipes/djinni-generator/all/test_v1_package/conanfile.py b/recipes/djinni-generator/all/test_v1_package/conanfile.py
new file mode 100644
index 0000000000000..456428a9a8670
--- /dev/null
+++ b/recipes/djinni-generator/all/test_v1_package/conanfile.py
@@ -0,0 +1,21 @@
+
+from io import StringIO
+from conans import ConanFile, tools
+
+class TestPackageConan(ConanFile):
+    settings = "os", "arch"
+
+    def build(self):
+        pass # please no warning that we build nothing
+
+    def test(self):
+        if not tools.cross_building(self.settings):
+            output = StringIO()
+            self.run("djinni --help", output=output, run_environment=True)
+            output.seek(0, 0)
+            found_usage = False
+            for line in output:
+                if "Usage: djinni [options]" in line:
+                    found_usage = True
+                    break
+            assert(found_usage)
diff --git a/recipes/djinni-generator/config.yml b/recipes/djinni-generator/config.yml
index 47d0ee6875d8a..c523a45caabe7 100644
--- a/recipes/djinni-generator/config.yml
+++ b/recipes/djinni-generator/config.yml
@@ -19,3 +19,5 @@ versions:
     folder: "all"
   "1.3.2":
     folder: "all"
+  "1.4.0":
+    folder: "all"
diff --git a/recipes/djinni-support-lib/1.x.x/CMakeLists.txt b/recipes/djinni-support-lib/1.x.x/CMakeLists.txt
deleted file mode 100644
index 0afabb3cbe2e0..0000000000000
--- a/recipes/djinni-support-lib/1.x.x/CMakeLists.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-cmake_minimum_required(VERSION 3.4)
-project(conan_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/djinni-support-lib/1.x.x/conandata.yml b/recipes/djinni-support-lib/1.x.x/conandata.yml
index d35c553da9ba8..10c1b916311e1 100644
--- a/recipes/djinni-support-lib/1.x.x/conandata.yml
+++ b/recipes/djinni-support-lib/1.x.x/conandata.yml
@@ -1,13 +1,29 @@
 sources:
-  "1.0.0":
-    url: https://github.com/cross-language-cpp/djinni-support-lib/archive/v1.0.0.tar.gz
-    sha256: "25f8c648c3bec78a54d5387a792f1d7cd3c073c4477dc50ad2b9c5270a590779"
+  "1.2.1":
+    url: "https://github.com/cross-language-cpp/djinni-support-lib/archive/v1.2.1.tar.gz"
+    sha256: "ed64d3466ad7f13971913b5bd70c608a558a6b8574d9dbd8779dcdce9b97521b"
+  "1.2.0":
+    url: "https://github.com/cross-language-cpp/djinni-support-lib/archive/v1.2.0.tar.gz"
+    sha256: "3630870c2b3305dc6216f8ca8e37139f3f59f2ea7bd600a1154c5aa1c4d983a9"
   "1.1.0":
-    url: https://github.com/cross-language-cpp/djinni-support-lib/archive/v1.1.0.tar.gz
+    url: "https://github.com/cross-language-cpp/djinni-support-lib/archive/v1.1.0.tar.gz"
     sha256: "3a67d1c26959a9df5c158fdf0792e036149009b206ed89fcee8c7b1608187336"
+  "1.0.0":
+    url: "https://github.com/cross-language-cpp/djinni-support-lib/archive/v1.0.0.tar.gz"
+    sha256: "25f8c648c3bec78a54d5387a792f1d7cd3c073c4477dc50ad2b9c5270a590779"
+patches:
   "1.2.0":
-    url: https://github.com/cross-language-cpp/djinni-support-lib/archive/v1.2.0.tar.gz
-    sha256: "3630870c2b3305dc6216f8ca8e37139f3f59f2ea7bd600a1154c5aa1c4d983a9"
-  "1.2.1":
-    url: https://github.com/cross-language-cpp/djinni-support-lib/archive/v1.2.1.tar.gz
-    sha256: "ed64d3466ad7f13971913b5bd70c608a558a6b8574d9dbd8779dcdce9b97521b"
+    - patch_file: "patches/fix-missing-include.patch"
+      patch_source: "https://github.com/cross-language-cpp/djinni-support-lib/commit/ac0e9f4f633ad8bfc1378db8954af4f1f88c1f4f"
+      patch_description: "Fix missing #include "
+      patch_type: "backport"
+  "1.1.0":
+    - patch_file: "patches/fix-missing-include.patch"
+      patch_source: "https://github.com/cross-language-cpp/djinni-support-lib/commit/ac0e9f4f633ad8bfc1378db8954af4f1f88c1f4f"
+      patch_description: "Fix missing #include "
+      patch_type: "backport"
+  "1.0.0":
+    - patch_file: "patches/fix-missing-include.patch"
+      patch_source: "https://github.com/cross-language-cpp/djinni-support-lib/commit/ac0e9f4f633ad8bfc1378db8954af4f1f88c1f4f"
+      patch_description: "Fix missing #include "
+      patch_type: "backport"
diff --git a/recipes/djinni-support-lib/1.x.x/conanfile.py b/recipes/djinni-support-lib/1.x.x/conanfile.py
index 61920459f5086..ef96684a7eec4 100644
--- a/recipes/djinni-support-lib/1.x.x/conanfile.py
+++ b/recipes/djinni-support-lib/1.x.x/conanfile.py
@@ -1,145 +1,175 @@
 import os
 
-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.env import VirtualBuildEnv
+from conan.tools.files import collect_libs, copy, get, export_conandata_patches, apply_conandata_patches
+from conan.tools.microsoft import is_msvc, is_msvc_static_runtime
+from conan.tools.scm import Version
 
+required_conan_version = ">=1.53.0"
 
-class DjinniSuppotLib(ConanFile):
+
+class DjinniSupportLib(ConanFile):
     name = "djinni-support-lib"
-    homepage = "https://djinni.xlcpp.dev"
-    url = "https://github.com/conan-io/conan-center-index"
     description = "Djinni is a tool for generating cross-language type declarations and interface bindings"
-    topics = ("java", "Objective-C", "Android", "iOS")
     license = "Apache-2.0"
+    url = "https://github.com/conan-io/conan-center-index"
+    homepage = "https://djinni.xlcpp.dev"
+    topics = ("java", "Objective-C", "Android", "iOS")
+
+    package_type = "library"
     settings = "os", "arch", "compiler", "build_type"
-    options = {"shared": [True, False],
-               "fPIC": [True, False],
-               "target": ["jni", "objc", "python", "cppcli", "auto", "deprecated"],
-               "with_jni": [True, False, "auto"],
-               "with_objc": [True, False, "auto"],
-               "with_python": [True, False, "auto"],
-               "with_cppcli": [True, False, "auto"],
-               "system_java": [True, False]
-               }
-    default_options = {"shared": False,
-                       "fPIC": True,
-                       "target": "deprecated",
-                       "with_jni": "auto",
-                       "with_objc": "auto",
-                       "with_python": "auto",
-                       "with_cppcli": "auto",
-                       "system_java": False,
-                       }
-    exports_sources = ["CMakeLists.txt"]
-    generators = "cmake", "cmake_find_package"
-
-    _cmake = None
+    options = {
+        "shared": [True, False],
+        "fPIC": [True, False],
+        "with_jni": [True, False, "auto"],
+        "with_objc": [True, False, "auto"],
+        "with_python": [True, False, "auto"],
+        "with_cppcli": [True, False, "auto"],
+        "system_java": [True, False],
+    }
+    default_options = {
+        "shared": False,
+        "fPIC": True,
+        "with_jni": "auto",
+        "with_objc": "auto",
+        "with_python": "auto",
+        "with_cppcli": "auto",
+        "system_java": False,
+    }
+
+    def export_sources(self):
+        export_conandata_patches(self)
+
+    def config_options(self):
+        if self.settings.os == "Windows":
+            del self.options.fPIC
+        elif self.settings.os == "Android":
+            self.options.system_java = True
 
     @property
     def _objc_support(self):
-        if self.options.with_objc == "auto" or self.options.target == "auto":
-            return tools.is_apple_os(self.settings.os)
+        if self.options.with_objc == "auto":
+            return is_apple_os(self)
         else:
-            return self.options.with_objc == True or self.options.target == "objc"
+            return self.options.with_objc
 
     @property
     def _jni_support(self):
-        if self.options.with_jni == "auto" or self.options.target == "auto":
+        if self.options.with_jni == "auto":
             return self.settings.os == "Android"
         else:
-            return self.options.with_jni == True or self.options.target == "jni"
+            return self.options.with_jni
 
     @property
     def _python_support(self):
-        return self.options.with_python == True or self.options.target == "python"
+        return self.options.with_python
 
     @property
     def _cppcli_support(self):
-        if self.options.with_cppcli == "auto" or self.options.target == "auto":
+        if self.options.with_cppcli == "auto":
             return self.settings.os == "Windows"
         else:
-            return self.options.with_cppcli == True or self.options.target == "cppcli"
-
-    def configure(self):
-        if self.settings.compiler == "Visual Studio" or self.options.shared:
-            del self.options.fPIC
-
-    @property
-    def _source_subfolder(self):
-        return "source_subfolder"
-
-    def build_requirements(self):
-        if not self.options.system_java and self._jni_support:
-            self.build_requires("zulu-openjdk/11.0.12@")
-
-    def config_options(self):
-        if self.settings.os == "Windows":
-            del self.options.fPIC
-        elif self.settings.os == "Android":
-            self.options.system_java = True
+            return self.options.with_cppcli
 
     @property
     def _supported_compilers(self):
         return {
             "gcc": "8",
             "clang": "7",
-            "Visual Studio": "15",
             "apple-clang": "10",
+            "msvc": "191",
+            "Visual Studio": "15",
         }
 
+    def configure(self):
+        if is_msvc(self) or self.options.shared:
+            self.options.rm_safe("fPIC")
+
+    def layout(self):
+        cmake_layout(self, src_folder="src")
+
     def validate(self):
-        if self.options.target != "deprecated":
-            self.output.warn("The 'target' option is deprecated and will be removed soon. Use 'with_jni', 'with_objc', 'with_python' or 'with_cppcli' options instead.")
         if not (self._objc_support or self._jni_support or self._python_support or self._cppcli_support):
-            raise ConanInvalidConfiguration("Target language could not be determined automatically. Set at least one of 'with_jni', 'with_objc', 'with_python' or 'with_cppcli' options to `True`.")
+            raise ConanInvalidConfiguration(
+                "Target language could not be determined automatically. Set at least one of 'with_jni',"
+                " 'with_objc', 'with_python' or 'with_cppcli' options to `True`."
+            )
         if self._cppcli_support:
             if self.settings.os != "Windows":
-                raise ConanInvalidConfiguration("C++/CLI has been enabled on a non-Windows operating system. This is not supported.")
+                raise ConanInvalidConfiguration(
+                    "C++/CLI has been enabled on a non-Windows operating system. This is not supported."
+                )
+            if self._objc_support or self._jni_support or self._python_support:
+                raise ConanInvalidConfiguration(
+                    "C++/CLI is not yet supported with other languages enabled as well. "
+                    "Disable 'with_jni', 'with_objc' and 'with_python' options for a valid configuration."
+                )
             if self.options.shared:
                 raise ConanInvalidConfiguration("C++/CLI does not support building as shared library")
-            if self.settings.compiler.runtime == "MT" or self.settings.compiler.runtime == "MTd":
+            if is_msvc_static_runtime(self):
                 raise ConanInvalidConfiguration("'/clr' and '/MT' command-line options are incompatible")
-            if self._objc_support or self._jni_support or self._python_support:
-                raise ConanInvalidConfiguration(
-                    "C++/CLI is not yet supported with other languages enabled as well. Disable 'with_jni', 'with_objc' and 'with_python' options for a valid configuration.")
         if self._python_support:
             if self.settings.os == "Windows":
-                raise ConanInvalidConfiguration("Python on Windows is not fully yet supported, please see https://github.com/cross-language-cpp/djinni-support-lib/issues.")
+                raise ConanInvalidConfiguration(
+                    "Python on Windows is not fully yet supported, please see"
+                    " https://github.com/cross-language-cpp/djinni-support-lib/issues."
+                )
         if self.settings.get_safe("compiler.cppstd"):
-            tools.check_min_cppstd(self, "17")
+            check_min_cppstd(self, "17")
         try:
             minimum_required_compiler_version = self._supported_compilers[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.")
+            if 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.")
+            self.output.warning(
+                "This recipe has no support for the current compiler. Please consider adding it."
+            )
+
+    def build_requirements(self):
+        if not self.options.system_java and self._jni_support:
+            self.build_requires("zulu-openjdk/11.0.19")
 
     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["DJINNI_WITH_OBJC"] = self._objc_support
-        self._cmake.definitions["DJINNI_WITH_JNI"] = self._jni_support
-        self._cmake.definitions["DJINNI_WITH_PYTHON"] = self._python_support
-        self._cmake.definitions["DJINNI_WITH_CPPCLI"] = self._cppcli_support
-        self._cmake.definitions["BUILD_TESTING"] = False
+        get(self, **self.conan_data["sources"][self.version], strip_root=True)
+
+    def generate(self):
+        tc = CMakeToolchain(self)
+        tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = self.options.shared
+        tc.variables["DJINNI_WITH_OBJC"] = self._objc_support
+        tc.variables["DJINNI_WITH_JNI"] = self._jni_support
+        tc.variables["DJINNI_WITH_PYTHON"] = self._python_support
+        tc.variables["DJINNI_WITH_CPPCLI"] = self._cppcli_support
+        tc.variables["BUILD_TESTING"] = False
         if self._jni_support:
-            self._cmake.definitions["JAVA_AWT_LIBRARY"] = "NotNeeded"
-            self._cmake.definitions["JAVA_AWT_INCLUDE_PATH"] = "NotNeeded"
-        self._cmake.configure()
-        return self._cmake
+            tc.variables["JAVA_AWT_LIBRARY"] = "NotNeeded"
+            tc.variables["JAVA_AWT_INCLUDE_PATH"] = "NotNeeded"
+        tc.generate()
+        tc = CMakeDeps(self)
+        tc.generate()
+        tc = VirtualBuildEnv(self)
+        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()
-        self.copy("LICENSE", dst="licenses", src=self._source_subfolder)
+        copy(self, "LICENSE",
+             dst=os.path.join(self.package_folder, "licenses"),
+             src=self.source_folder)
 
     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.append("pthread")
diff --git a/recipes/djinni-support-lib/1.x.x/patches/fix-missing-include.patch b/recipes/djinni-support-lib/1.x.x/patches/fix-missing-include.patch
new file mode 100644
index 0000000000000..03996b5c26511
--- /dev/null
+++ b/recipes/djinni-support-lib/1.x.x/patches/fix-missing-include.patch
@@ -0,0 +1,22 @@
+From ac0e9f4f633ad8bfc1378db8954af4f1f88c1f4f Mon Sep 17 00:00:00 2001
+From: Denis Pershin 
+Date: Tue, 9 Nov 2021 19:36:50 +0700
+Subject: [PATCH] Fix compilation on gcc 11.2 (#67)
+
+Add include memory for standard smart pointer
+---
+ djinni/cwrapper/wrapper_marshal.hpp | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/djinni/cwrapper/wrapper_marshal.hpp b/djinni/cwrapper/wrapper_marshal.hpp
+index 75a75d1..6d6a7cc 100644
+--- a/djinni/cwrapper/wrapper_marshal.hpp
++++ b/djinni/cwrapper/wrapper_marshal.hpp
+@@ -9,6 +9,7 @@
+ #include 
+ #include 
+ #include 
++#include 
+ 
+ #ifdef __cplusplus
+ extern "C" {
diff --git a/recipes/djinni-support-lib/1.x.x/test_package/CMakeLists.txt b/recipes/djinni-support-lib/1.x.x/test_package/CMakeLists.txt
index 6c1d84c7e3d82..b118a50a53af8 100644
--- a/recipes/djinni-support-lib/1.x.x/test_package/CMakeLists.txt
+++ b/recipes/djinni-support-lib/1.x.x/test_package/CMakeLists.txt
@@ -1,9 +1,8 @@
-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()
+find_package(djinni-support-lib REQUIRED CONFIG)
 
 add_executable(${PROJECT_NAME} test_package.cpp)
-target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS})
+target_link_libraries(${PROJECT_NAME} PRIVATE djinni-support-lib::djinni-support-lib)
 set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17)
diff --git a/recipes/djinni-support-lib/1.x.x/test_package/conanfile.py b/recipes/djinni-support-lib/1.x.x/test_package/conanfile.py
index ed8aa8b7e0ebb..ef5d7042163ec 100644
--- a/recipes/djinni-support-lib/1.x.x/test_package/conanfile.py
+++ b/recipes/djinni-support-lib/1.x.x/test_package/conanfile.py
@@ -1,19 +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", "compiler", "build_type", "arch"
-    generators = "cmake"
+    settings = "os", "arch", "compiler", "build_type"
+    generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv"
+    test_type = "explicit"
 
-    def _configure_cmake(self):
-        cmake = CMake(self)
-        cmake.configure()
-        return cmake
+    def requirements(self):
+        self.requires(self.tested_reference_str)
+
+    def layout(self):
+        cmake_layout(self)
 
     def build(self):
-        cmake = self._configure_cmake()
+        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)
+        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/djinni-support-lib/1.x.x/test_package/test_package.cpp b/recipes/djinni-support-lib/1.x.x/test_package/test_package.cpp
index 9228c8f56407e..acdc2e577622c 100644
--- a/recipes/djinni-support-lib/1.x.x/test_package/test_package.cpp
+++ b/recipes/djinni-support-lib/1.x.x/test_package/test_package.cpp
@@ -1,11 +1,9 @@
 #include 
+
 #include 
 
 // since we would either need objective C++ or Java (jni) there is not a lot to test
-// just that we have the hearders and can link
+// just that we have the headers and can link
 int main() {
-    return EXIT_SUCCESS ;
+    return EXIT_SUCCESS;
 }
-
-
-
diff --git a/recipes/djinni-support-lib/1.x.x/test_v1_package/CMakeLists.txt b/recipes/djinni-support-lib/1.x.x/test_v1_package/CMakeLists.txt
new file mode 100644
index 0000000000000..91630d79f4abb
--- /dev/null
+++ b/recipes/djinni-support-lib/1.x.x/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/djinni-support-lib/1.x.x/test_v1_package/conanfile.py b/recipes/djinni-support-lib/1.x.x/test_v1_package/conanfile.py
new file mode 100644
index 0000000000000..c534d392ac09f
--- /dev/null
+++ b/recipes/djinni-support-lib/1.x.x/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 _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):
+            bin_path = os.path.join("bin", "test_package")
+            self.run(bin_path, run_environment=True)
diff --git a/recipes/djinni-support-lib/all/CMakeLists.txt b/recipes/djinni-support-lib/all/CMakeLists.txt
deleted file mode 100644
index 0afabb3cbe2e0..0000000000000
--- a/recipes/djinni-support-lib/all/CMakeLists.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-cmake_minimum_required(VERSION 3.4)
-project(conan_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/djinni-support-lib/all/conandata.yml b/recipes/djinni-support-lib/all/conandata.yml
index dea5fe156fcc1..fae655bf2e6d5 100644
--- a/recipes/djinni-support-lib/all/conandata.yml
+++ b/recipes/djinni-support-lib/all/conandata.yml
@@ -1,9 +1,7 @@
 sources:
   "0.0.1":
-    url: https://github.com/cross-language-cpp/djinni-support-lib/archive/v0.0.1.tar.gz
+    url: "https://github.com/cross-language-cpp/djinni-support-lib/archive/v0.0.1.tar.gz"
     sha256: "ddef30a95a8bd325446d3a76ea9c11f198f3b33f66157217bd46fb13d75c43d2"
 patches:
   "0.0.1":
     - patch_file: "patches/cmake_install.patch"
-      base_path: "source_subfolder"
-
diff --git a/recipes/djinni-support-lib/all/conanfile.py b/recipes/djinni-support-lib/all/conanfile.py
index 97c05458fb360..0957b9e7315cf 100644
--- a/recipes/djinni-support-lib/all/conanfile.py
+++ b/recipes/djinni-support-lib/all/conanfile.py
@@ -1,93 +1,104 @@
 import os
 
-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.env import VirtualBuildEnv
+from conan.tools.files import apply_conandata_patches, collect_libs, copy, export_conandata_patches, get
 
-class DjinniSuppotLib(ConanFile):
+required_conan_version = ">=1.53.0"
+
+
+class DjinniSupportLib(ConanFile):
     name = "djinni-support-lib"
-    homepage = "https://djinni.xlcpp.dev"
-    url = "https://github.com/conan-io/conan-center-index"
     description = "Djinni is a tool for generating cross-language type declarations and interface bindings"
-    topics = ("java", "Objective-C", "Android", "iOS")
     license = "Apache-2.0"
-    settings = "os", "arch", "compiler", "build_type"
-    options = {"shared": [True, False],
-                "fPIC": [True, False],
-                "target": ["jni", "objc", "auto"],
-                "system_java": [True, False]
-               }
-    default_options = {"shared": False,
-                        "fPIC": True ,
-                        "target": "auto",
-                        "system_java": False
-                       }
-    exports_sources = ["patches/**", "CMakeLists.txt"]
-    generators = "cmake", "cmake_find_package"
-
-    _cmake = None
+    url = "https://github.com/conan-io/conan-center-index"
+    homepage = "https://djinni.xlcpp.dev"
+    topics = ("java", "Objective-C", "Android", "iOS")
 
-    @property
-    def objc_support(self):
-        if self.options.target == "auto":
-            return tools.is_apple_os(self.settings.os)
-        else:
-            return self.options.target == "objc"
+    package_type = "library"
+    settings = "os", "arch", "compiler", "build_type"
+    options = {
+        "shared": [True, False],
+        "fPIC": [True, False],
+        "target": ["jni", "objc", "auto"],
+        "system_java": [True, False],
+    }
+    default_options = {
+        "shared": False,
+        "fPIC": True,
+        "target": "auto",
+        "system_java": False,
+    }
 
     @property
-    def jni_support(self):
-        if self.options.target == "auto":
-            return self.settings.os not in ["iOS", "watchOS", "tvOS"]
-        else:
-            return self.options.target == "jni"
+    def _objc_support(self):
+        return self.options.target == "objc"
 
     @property
-    def _source_subfolder(self):
-        return "source_subfolder"
+    def _jni_support(self):
+        return self.options.target == "jni"
 
-    def build_requirements(self):
-        if not self.options.system_java:
-            self.build_requires("zulu-openjdk/11.0.8@")
+    def export_sources(self):
+        export_conandata_patches(self)
 
     def config_options(self):
         if self.settings.os == "Windows":
             del self.options.fPIC
+        # Set default target based on OS
+        self.options.target = "objc" if is_apple_os(self) else "jni"
 
     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 build_requirements(self):
+        if not self.options.system_java and self._jni_support:
+            self.tool_requires("zulu-openjdk/21.0.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], strip_root=True)
 
-    def _configure_cmake(self):
-        if self._cmake:
-            return self._cmake
-        self._cmake = CMake(self)
+    def generate(self):
+        tc = CMakeToolchain(self)
+        tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True
         if not self.options.shared:
-            self._cmake.definitions["DJINNI_STATIC_LIB"] = True
-        self._cmake.definitions["DJINNI_WITH_OBJC"] = self.objc_support
-        self._cmake.definitions["DJINNI_WITH_JNI"] = self.jni_support
-        if self.jni_support:
-            self._cmake.definitions["JAVA_AWT_LIBRARY"] = "NotNeeded"
-            self._cmake.definitions["JAVA_AWT_INCLUDE_PATH"] = "NotNeeded"
-        self._cmake.configure()
-        return self._cmake
+            tc.variables["DJINNI_STATIC_LIB"] = True
+        tc.variables["DJINNI_WITH_OBJC"] = self._objc_support
+        tc.variables["DJINNI_WITH_JNI"] = self._jni_support
+        if self._jni_support:
+            tc.variables["JAVA_AWT_LIBRARY"] = "NotNeeded"
+            tc.variables["JAVA_AWT_INCLUDE_PATH"] = self.source_folder.replace("\\", "/")
+        tc.generate()
+        tc = CMakeDeps(self)
+        tc.generate()
+        tc = VirtualBuildEnv(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):
-        cmake = self._configure_cmake()
+        cmake = CMake(self)
         cmake.install()
-        self.copy("LICENSE", dst="licenses", src=self._source_subfolder)
+        copy(self, "LICENSE",
+             dst=os.path.join(self.package_folder, "licenses"),
+             src=self.source_folder)
 
     def package_info(self):
-        self.cpp_info.libs = tools.collect_libs(self)
+        self.cpp_info.libs = collect_libs(self)
         # these should not be here, but to support old generated files ....
-        if self.objc_support:
+        if self._objc_support:
             self.cpp_info.includedirs.append(os.path.join("include", "djinni", "objc"))
-        if self.jni_support:
+        if self._jni_support:
             self.cpp_info.includedirs.append(os.path.join("include", "djinni", "jni"))
+
+        if self._objc_support:
+            self.cpp_info.frameworks = ["Foundation", "CoreFoundation"]
diff --git a/recipes/djinni-support-lib/all/test_package/CMakeLists.txt b/recipes/djinni-support-lib/all/test_package/CMakeLists.txt
index 33ae887aa6aea..67f60b7a2aed7 100644
--- a/recipes/djinni-support-lib/all/test_package/CMakeLists.txt
+++ b/recipes/djinni-support-lib/all/test_package/CMakeLists.txt
@@ -1,9 +1,8 @@
-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()
+find_package(djinni-support-lib REQUIRED CONFIG)
 
 add_executable(${PROJECT_NAME} test_package.cpp)
-target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS})
+target_link_libraries(${PROJECT_NAME} PRIVATE djinni-support-lib::djinni-support-lib)
 set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11)
diff --git a/recipes/djinni-support-lib/all/test_package/conanfile.py b/recipes/djinni-support-lib/all/test_package/conanfile.py
index ed8aa8b7e0ebb..ef5d7042163ec 100644
--- a/recipes/djinni-support-lib/all/test_package/conanfile.py
+++ b/recipes/djinni-support-lib/all/test_package/conanfile.py
@@ -1,19 +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", "compiler", "build_type", "arch"
-    generators = "cmake"
+    settings = "os", "arch", "compiler", "build_type"
+    generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv"
+    test_type = "explicit"
 
-    def _configure_cmake(self):
-        cmake = CMake(self)
-        cmake.configure()
-        return cmake
+    def requirements(self):
+        self.requires(self.tested_reference_str)
+
+    def layout(self):
+        cmake_layout(self)
 
     def build(self):
-        cmake = self._configure_cmake()
+        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)
+        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/djinni-support-lib/all/test_package/test_package.cpp b/recipes/djinni-support-lib/all/test_package/test_package.cpp
index 9228c8f56407e..acdc2e577622c 100644
--- a/recipes/djinni-support-lib/all/test_package/test_package.cpp
+++ b/recipes/djinni-support-lib/all/test_package/test_package.cpp
@@ -1,11 +1,9 @@
 #include 
+
 #include 
 
 // since we would either need objective C++ or Java (jni) there is not a lot to test
-// just that we have the hearders and can link
+// just that we have the headers and can link
 int main() {
-    return EXIT_SUCCESS ;
+    return EXIT_SUCCESS;
 }
-
-
-
diff --git a/recipes/djinni-support-lib/all/test_v1_package/CMakeLists.txt b/recipes/djinni-support-lib/all/test_v1_package/CMakeLists.txt
new file mode 100644
index 0000000000000..91630d79f4abb
--- /dev/null
+++ b/recipes/djinni-support-lib/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/djinni-support-lib/all/test_v1_package/conanfile.py b/recipes/djinni-support-lib/all/test_v1_package/conanfile.py
new file mode 100644
index 0000000000000..c534d392ac09f
--- /dev/null
+++ b/recipes/djinni-support-lib/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 _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):
+            bin_path = os.path.join("bin", "test_package")
+            self.run(bin_path, run_environment=True)
diff --git a/recipes/djvulibre/all/conandata.yml b/recipes/djvulibre/all/conandata.yml
new file mode 100644
index 0000000000000..8f7d4ad051f7b
--- /dev/null
+++ b/recipes/djvulibre/all/conandata.yml
@@ -0,0 +1,9 @@
+sources:
+  "3.5.28":
+    url: "http://downloads.sourceforge.net/djvu/djvulibre-3.5.28.tar.gz"
+    sha256: "fcd009ea7654fde5a83600eb80757bd3a76998e47d13c66b54c8db849f8f2edc"
+patches:
+  "3.5.28":
+    - patch_file: "patches/remove-register-keyword.patch"
+      patch_type: "portability"
+      patch_description: "Remove deprecated 'register' keyword for C++17 compatibility"
diff --git a/recipes/djvulibre/all/conanfile.py b/recipes/djvulibre/all/conanfile.py
new file mode 100644
index 0000000000000..02736d758043d
--- /dev/null
+++ b/recipes/djvulibre/all/conanfile.py
@@ -0,0 +1,187 @@
+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, stdcpp_library
+from conan.tools.env import Environment, VirtualBuildEnv, VirtualRunEnv
+from conan.tools.files import copy, get, rm, rmdir, save, rename, export_conandata_patches, apply_conandata_patches
+from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps
+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.54.0"
+
+
+class DjVuLibreConan(ConanFile):
+    name = "djvulibre"
+    description = "Library and utilities to create, manipulate and view DjVu documents"
+    license = "GPL-2.0-or-later"
+    url = "https://github.com/conan-io/conan-center-index"
+    homepage = "https://djvu.sourceforge.net/"
+    topics = ("djvu", "file-format", "document-format")
+
+    package_type = "library"
+    settings = "os", "arch", "compiler", "build_type"
+    options = {
+        "shared": [True, False],
+        "fPIC": [True, False],
+        "tools": [True, False],
+        "with_libjpeg": ["libjpeg", "libjpeg-turbo", "mozjpeg"],
+    }
+    default_options = {
+        "shared": False,
+        "fPIC": True,
+        "tools": False,
+        "with_libjpeg": "libjpeg",
+    }
+
+    @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):
+        basic_layout(self, src_folder="src")
+
+    def requirements(self):
+        self.requires("libiconv/1.17")
+        if self.options.with_libjpeg == "libjpeg":
+            self.requires("libjpeg/9e")
+        elif self.options.with_libjpeg == "libjpeg-turbo":
+            self.requires("libjpeg-turbo/3.0.2")
+        elif self.options.with_libjpeg == "mozjpeg":
+            self.requires("mozjpeg/4.1.5")
+        self.requires("libtiff/4.6.0")
+
+    def validate(self):
+        if self.settings.os == "Windows" and not self.options.shared:
+            # __declspec(dllimport) or __declspec(dllexport) is always set for symbols
+            raise ConanInvalidConfiguration("Static linking is not supported on Windows")
+
+    def build_requirements(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")
+        if is_msvc(self):
+            self.tool_requires("automake/1.16.5")
+
+    def source(self):
+        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)
+        jpeg = self.dependencies[self.options.with_libjpeg.value].cpp_info.aggregated_components()
+        tiff = self.dependencies["libtiff"].cpp_info.aggregated_components()
+        tc.configure_args.extend([
+            f"JPEG_LIBS={' '.join(f'-l{l}' for l in jpeg.libs)}",
+            f"TIFF_LIBS={' '.join(f'-l{l}' for l in tiff.libs)}",
+        ])
+        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")
+            tc.extra_ldflags.append("-ladvapi32")
+        tc.generate()
+
+        if is_msvc(self):
+            env = Environment()
+            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")
+            env.define("NM", "dumpbin -symbols")
+            env.vars(self).save_script("conanbuild_msvc")
+
+        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 _patch_sources(self):
+        apply_conandata_patches(self)
+        if not self.options.tools:
+            save(self, os.path.join(self.source_folder, "tools", "Makefile.am"), "")
+            save(self, os.path.join(self.source_folder, "xmltools", "Makefile.am"), "")
+
+    def build(self):
+        self._patch_sources()
+        autotools = Autotools(self)
+        autotools.autoreconf()
+        autotools.configure()
+        autotools.make()
+
+    def package(self):
+        copy(self, "COPYING", 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, "lib", "pkgconfig"))
+        rmdir(self, os.path.join(self.package_folder, "share", "man"))
+        rmdir(self, os.path.join(self.package_folder, "share", "icons"))
+        rename(self, os.path.join(self.package_folder, "share"), os.path.join(self.package_folder, "res"))
+        fix_apple_shared_install_name(self)
+        if is_msvc(self) and self.options.shared:
+            rename(self, os.path.join(self.package_folder, "lib", "djvulibre.dll.lib"),
+                         os.path.join(self.package_folder, "lib", "djvulibre.lib"))
+
+    def package_info(self):
+        self.cpp_info.set_property("pkg_config_name", "ddjvuapi")
+        self.cpp_info.libs = ["djvulibre"]
+        self.cpp_info.resdirs = ["res"]
+
+        if self.settings.os in ["Linux", "FreeBSD"]:
+            self.cpp_info.system_libs.extend(["m", "pthread"])
+        elif is_apple_os(self):
+            self.cpp_info.frameworks.extend(["CoreFoundation"])
+        elif self.settings.os == "Windows":
+            self.cpp_info.system_libs.append("advapi32")
+
+        # Implemented in C++ but exports a pure C API
+        if stdcpp_library(self):
+            self.cpp_info.system_libs.append(stdcpp_library(self))
diff --git a/recipes/djvulibre/all/patches/remove-register-keyword.patch b/recipes/djvulibre/all/patches/remove-register-keyword.patch
new file mode 100644
index 0000000000000..d6a6af75193b6
--- /dev/null
+++ b/recipes/djvulibre/all/patches/remove-register-keyword.patch
@@ -0,0 +1,34 @@
+--- libdjvu/GBitmap.h
++++ libdjvu/GBitmap.h
+@@ -620,7 +620,7 @@
+ inline int
+ GBitmap::read_run(unsigned char *&data)
+ {
+-  register int z=*data++;
++  int z=*data++;
+   return (z>=RUNOVERFLOWVALUE)?
+     ((z&~RUNOVERFLOWVALUE)<<8)|(*data++):z;
+ }
+@@ -628,7 +628,7 @@
+ inline int
+ GBitmap::read_run(const unsigned char *&data)
+ {
+-  register int z=*data++;
++  int z=*data++;
+   return (z>=RUNOVERFLOWVALUE)?
+     ((z&~RUNOVERFLOWVALUE)<<8)|(*data++):z;
+ }
+--- libdjvu/MMX.h
++++ libdjvu/MMX.h
+@@ -172,9 +172,9 @@
+ #define MMXir(op,imm,dst) \
+   __asm { op dst,imm }
+ #define MMXar(op,addr,dst) \
+-  { register __int64 var=*(__int64*)(addr); __asm { op dst,var } }
++  { __int64 var=*(__int64*)(addr); __asm { op dst,var } }
+ #define MMXra(op,src,addr) \
+-  { register __int64 var; __asm { op [var],src };  *(__int64*)addr = var; } 
++  { __int64 var; __asm { op [var],src };  *(__int64*)addr = var; } 
+ // Probably not as efficient as GCC macros
+ #define MMX 1
+ #endif
diff --git a/recipes/djvulibre/all/test_package/CMakeLists.txt b/recipes/djvulibre/all/test_package/CMakeLists.txt
new file mode 100644
index 0000000000000..78eb45bda8ee3
--- /dev/null
+++ b/recipes/djvulibre/all/test_package/CMakeLists.txt
@@ -0,0 +1,8 @@
+cmake_minimum_required(VERSION 3.15)
+project(test_package LANGUAGES C)
+
+find_package(djvulibre REQUIRED CONFIG)
+
+add_executable(${PROJECT_NAME} test_package.c)
+target_link_libraries(${PROJECT_NAME} PRIVATE djvulibre::djvulibre)
+target_compile_features(${PROJECT_NAME} PRIVATE c_std_99)
diff --git a/recipes/djvulibre/all/test_package/conanfile.py b/recipes/djvulibre/all/test_package/conanfile.py
new file mode 100644
index 0000000000000..3a91c9439218e
--- /dev/null
+++ b/recipes/djvulibre/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.bindir, "test_package")
+            self.run(bin_path, env="conanrun")
diff --git a/recipes/djvulibre/all/test_package/test_package.c b/recipes/djvulibre/all/test_package/test_package.c
new file mode 100644
index 0000000000000..9c8f3383716ca
--- /dev/null
+++ b/recipes/djvulibre/all/test_package/test_package.c
@@ -0,0 +1,15 @@
+#include 
+#include 
+
+int main() {
+    ddjvu_context_t* context = ddjvu_context_create("test_package");
+    if (!context) {
+        printf("Failed to create djvu context\n");
+        return 1;
+    }
+    printf("DjVu context initialized successfully.\n");
+    int cache_size = ddjvu_cache_get_size(context);
+    printf("Cache size: %d\n", cache_size);
+    ddjvu_context_release(context);
+    return 0;
+}
diff --git a/recipes/djvulibre/config.yml b/recipes/djvulibre/config.yml
new file mode 100644
index 0000000000000..9cb2b472d3ed1
--- /dev/null
+++ b/recipes/djvulibre/config.yml
@@ -0,0 +1,3 @@
+versions:
+  "3.5.28":
+    folder: all
diff --git a/recipes/dlib/all/CMakeLists.txt b/recipes/dlib/all/CMakeLists.txt
deleted file mode 100644
index 1c22f04937945..0000000000000
--- a/recipes/dlib/all/CMakeLists.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-cmake_minimum_required(VERSION 3.1)
-project(cmake_wrapper)
-
-include(conanbuildinfo.cmake)
-conan_basic_setup(KEEP_RPATHS)
-
-# Include the dlib subdirectory to skip a check
-add_subdirectory(source_subfolder/dlib)
diff --git a/recipes/dlib/all/conandata.yml b/recipes/dlib/all/conandata.yml
index 8896193f464de..845293d979b05 100644
--- a/recipes/dlib/all/conandata.yml
+++ b/recipes/dlib/all/conandata.yml
@@ -1,4 +1,7 @@
 sources:
+  "19.24.2":
+    url: "https://github.com/davisking/dlib/archive/v19.24.2.tar.gz"
+    sha256: "0f5c7e3de6316a513635052c5f0a16a84e1cef26a7d233bf00c21348462b6d6f"
   "19.24":
     url: "https://github.com/davisking/dlib/archive/refs/tags/v19.24.tar.gz"
     sha256: "3cc42e84c7b1bb926c6451a21ad1595f56c5b10be3a1d7aa2f3c716a25b7ae39"
diff --git a/recipes/dlib/all/conanfile.py b/recipes/dlib/all/conanfile.py
index a15a2fc95a7d5..a026fc21e83a6 100644
--- a/recipes/dlib/all/conanfile.py
+++ b/recipes/dlib/all/conanfile.py
@@ -1,10 +1,14 @@
+from conan import ConanFile
+from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
+from conan.tools.files import get, replace_in_file, copy, rmdir, collect_libs, rm
+from conan.tools.build import check_min_cppstd
 from conan.tools.microsoft import is_msvc
-from conans import ConanFile, CMake, tools
-from conans.errors import ConanInvalidConfiguration
-import functools
+from conan.tools.scm import Version
+from conan.errors import ConanInvalidConfiguration
 import os
 
-required_conan_version = ">=1.45.0"
+
+required_conan_version = ">=1.53.0"
 
 
 class DlibConan(ConanFile):
@@ -14,7 +18,7 @@ class DlibConan(ConanFile):
     url = "https://github.com/conan-io/conan-center-index"
     homepage = "http://dlib.net"
     license = "BSL-1.0"
-
+    package_type = "library"
     settings = "os", "arch", "compiler", "build_type"
     options = {
         "shared": [True, False],
@@ -43,151 +47,166 @@ class DlibConan(ConanFile):
         "with_openblas": True,
     }
 
-    exports_sources = "CMakeLists.txt"
-    generators = "cmake", "cmake_find_package"
-
     @property
-    def _source_subfolder(self):
-        return "source_subfolder"
+    def _min_cppstd(self):
+        if Version(self.version) < "19.24.2":
+            return 11
+        return 14
 
     @property
-    def _build_subfolder(self):
-        return "build_subfolder"
+    def _compilers_minimum_version(self):
+        if Version(self.version) < "19.24.2":
+            return {}
+        return {
+            "Visual Studio": "15",
+            "msvc": "191",
+            "gcc": "6",
+            "clang": "5",
+            "apple-clang": "10",
+        }
 
     @property
     def _has_with_webp_option(self):
-        return tools.Version(self.version) >= "19.24"
+        return Version(self.version) >= "19.24"
 
     def config_options(self):
         if self.settings.os == "Windows":
-            del self.options.fPIC
+            self.options.rm_safe("fPIC")
         if self.settings.arch not in ["x86", "x86_64"]:
-            del self.options.with_sse2
-            del self.options.with_sse4
-            del self.options.with_avx
+            self.options.rm_safe("with_sse2")
+            self.options.rm_safe("with_sse4")
+            self.options.rm_safe("with_avx")
         if not self._has_with_webp_option:
-            del self.options.with_webp
+            self.options.rm_safe("with_webp")
 
     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_gif:
             self.requires("giflib/5.2.1")
         if self.options.with_jpeg:
-            self.requires("libjpeg/9d")
+            self.requires("libjpeg/9e")
         if self.options.with_png:
-            self.requires("libpng/1.6.37")
+            self.requires("libpng/[>=1.6 <2]")
         if self.options.get_safe("with_webp"):
-            self.requires("libwebp/1.2.2")
+            self.requires("libwebp/1.3.2")
         if self.options.with_sqlite3:
-            self.requires("sqlite3/3.38.5")
+            self.requires("sqlite3/3.45.0")
         if self.options.with_openblas:
-            self.requires("openblas/0.3.17")
+            self.requires("openblas/0.3.26")
 
     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 is_msvc(self) and self.options.shared:
-            raise ConanInvalidConfiguration("dlib can not be built as a shared library with Visual Studio")
-        if self.settings.os == "Macos" and self.settings.arch == "armv8":
-            raise ConanInvalidConfiguration("dlib doesn't support macOS M1")
+            raise ConanInvalidConfiguration(f"{self.ref} does not support shared on Windows. See https://github.com/davisking/dlib/issues/1483.")
 
     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):
-        dlib_cmakelists = os.path.join(self._source_subfolder, "dlib", "CMakeLists.txt")
+        dlib_cmakelists = os.path.join(self.source_folder, "dlib", "CMakeLists.txt")
         # robust giflib injection
-        tools.replace_in_file(dlib_cmakelists, "${GIF_LIBRARY}", "GIF::GIF")
+        replace_in_file(self, dlib_cmakelists, "${GIF_LIBRARY}", "GIF::GIF")
         # robust libjpeg injection
         for cmake_file in [
             dlib_cmakelists,
-            os.path.join(self._source_subfolder, "dlib", "cmake_utils", "find_libjpeg.cmake"),
-            os.path.join(self._source_subfolder, "dlib", "cmake_utils", "test_for_libjpeg", "CMakeLists.txt"),
+            os.path.join(self.source_folder, "dlib", "cmake_utils", "find_libjpeg.cmake"),
+            os.path.join(self.source_folder, "dlib", "cmake_utils", "test_for_libjpeg", "CMakeLists.txt"),
         ]:
-            tools.replace_in_file(cmake_file, "${JPEG_LIBRARY}", "JPEG::JPEG")
+            replace_in_file(self, cmake_file, "${JPEG_LIBRARY}", "JPEG::JPEG")
         # robust libpng injection
         for cmake_file in [
             dlib_cmakelists,
-            os.path.join(self._source_subfolder, "dlib", "cmake_utils", "find_libpng.cmake"),
-            os.path.join(self._source_subfolder, "dlib", "cmake_utils", "test_for_libpng", "CMakeLists.txt"),
+            os.path.join(self.source_folder, "dlib", "cmake_utils", "find_libpng.cmake"),
+            os.path.join(self.source_folder, "dlib", "cmake_utils", "test_for_libpng", "CMakeLists.txt"),
         ]:
-            tools.replace_in_file(cmake_file, "${PNG_LIBRARIES}", "PNG::PNG")
+            replace_in_file(self, cmake_file, "${PNG_LIBRARIES}", "PNG::PNG")
         # robust sqlite3 injection
-        tools.replace_in_file(dlib_cmakelists, "find_library(sqlite sqlite3)", "find_package(SQLite3 REQUIRED)")
-        tools.replace_in_file(dlib_cmakelists, "find_path(sqlite_path sqlite3.h)", "")
-        tools.replace_in_file(dlib_cmakelists, "if (sqlite AND sqlite_path)", "if(1)")
-        tools.replace_in_file(dlib_cmakelists, "${sqlite}", "SQLite::SQLite3")
+        if self.options.with_sqlite3:
+            replace_in_file(self, dlib_cmakelists, "find_library(sqlite sqlite3)", "find_package(SQLite3 REQUIRED)")
+            replace_in_file(self, dlib_cmakelists, "find_path(sqlite_path sqlite3.h)", "")
+            replace_in_file(self, dlib_cmakelists, "if (sqlite AND sqlite_path)", "if(1)")
+            replace_in_file(self, dlib_cmakelists, "${sqlite}", "SQLite::SQLite3")
         # robust libwebp injection
         if self._has_with_webp_option:
-            tools.replace_in_file(dlib_cmakelists, "include(cmake_utils/find_libwebp.cmake)", "find_package(WebP REQUIRED)")
-            tools.replace_in_file(dlib_cmakelists, "if (WEBP_FOUND)", "if(1)")
-            tools.replace_in_file(dlib_cmakelists, "${WEBP_LIBRARY}", "WebP::webp")
+            replace_in_file(self, dlib_cmakelists, "include(cmake_utils/find_libwebp.cmake)", "find_package(WebP REQUIRED)")
+            replace_in_file(self, dlib_cmakelists, "if (WEBP_FOUND)", "if(1)")
+            replace_in_file(self, dlib_cmakelists, "${WEBP_LIBRARY}", "WebP::webp")
+        if self.options.with_png:
+            replace_in_file(self, dlib_cmakelists, "include(cmake_utils/find_libpng.cmake)", "find_package(PNG REQUIRED)")
+        if self.options.with_jpeg:
+            replace_in_file(self, dlib_cmakelists, "include(cmake_utils/find_libjpeg.cmake)", "find_package(JPEG REQUIRED)")
 
-    @functools.lru_cache(1)
-    def _configure_cmake(self):
-        cmake = CMake(self)
+    def generate(self):
+        tc = CMakeToolchain(self)
 
         # With in-project builds dlib is always built as a static library,
         # we want to be able to build it as a shared library too
-        cmake.definitions["DLIB_IN_PROJECT_BUILD"] = False
-
-        cmake.definitions["DLIB_ISO_CPP_ONLY"] = False
-        cmake.definitions["DLIB_NO_GUI_SUPPORT"] = True
+        tc.variables["DLIB_IN_PROJECT_BUILD"] = False
 
+        tc.variables["DLIB_ISO_CPP_ONLY"] = False
+        tc.variables["DLIB_NO_GUI_SUPPORT"] = True
         # Configure external dependencies
-        cmake.definitions["DLIB_JPEG_SUPPORT"] = self.options.with_jpeg
+        tc.variables["DLIB_JPEG_SUPPORT"] = self.options.with_jpeg
         if self._has_with_webp_option:
-            cmake.definitions["DLIB_WEBP_SUPPORT"] = self.options.with_webp
-        cmake.definitions["DLIB_LINK_WITH_SQLITE3"] = self.options.with_sqlite3
-        cmake.definitions["DLIB_USE_BLAS"] = True    # FIXME: all the logic behind is not sufficiently under control
-        cmake.definitions["DLIB_USE_LAPACK"] = True  # FIXME: all the logic behind is not sufficiently under control
-        cmake.definitions["DLIB_USE_CUDA"] = False   # TODO: add with_cuda option?
-        cmake.definitions["DLIB_PNG_SUPPORT"] = self.options.with_png
-        cmake.definitions["DLIB_GIF_SUPPORT"] = self.options.with_gif
-        cmake.definitions["DLIB_USE_MKL_FFT"] = False
+            tc.variables["DLIB_WEBP_SUPPORT"] = self.options.with_webp
+        tc.variables["DLIB_LINK_WITH_SQLITE3"] = self.options.with_sqlite3
+        tc.variables["DLIB_USE_BLAS"] = True    # FIXME: all the logic behind is not sufficiently under control
+        tc.variables["DLIB_USE_LAPACK"] = True  # FIXME: all the logic behind is not sufficiently under control
+        tc.variables["DLIB_USE_CUDA"] = False   # TODO: add with_cuda option?
+        tc.variables["DLIB_PNG_SUPPORT"] = self.options.with_png
+        tc.variables["DLIB_GIF_SUPPORT"] = self.options.with_gif
+        tc.variables["DLIB_USE_MKL_FFT"] = False
 
         # Configure SIMD options if possible
         if self.settings.arch in ["x86", "x86_64"]:
             if self.options.with_sse2 != "auto":
-                cmake.definitions["USE_SSE2_INSTRUCTIONS"] = self.options.with_sse2
+                tc.variables["USE_SSE2_INSTRUCTIONS"] = self.options.with_sse2
             if self.options.with_sse4 != "auto":
-                cmake.definitions["USE_SSE4_INSTRUCTIONS"] = self.options.with_sse4
+                tc.variables["USE_SSE4_INSTRUCTIONS"] = self.options.with_sse4
             if self.options.with_avx != "auto":
-                cmake.definitions["USE_AVX_INSTRUCTIONS"] = self.options.with_avx
-
-        cmake.configure(build_folder=self._build_subfolder)
-        return cmake
+                tc.variables["USE_AVX_INSTRUCTIONS"] = self.options.with_avx
+        tc.generate()
+        tc = CMakeDeps(self)
+        tc.generate()
 
     def build(self):
         self._patch_sources()
-        cmake = self._configure_cmake()
+        cmake = CMake(self)
+        cmake.configure(build_script_folder=os.path.join(self.source_folder, "dlib"))
         cmake.build()
 
     def package(self):
-        cmake = self._configure_cmake()
+        cmake = CMake(self)
         cmake.install()
-
-        self.copy("LICENSE.txt", "licenses", os.path.join(self._source_subfolder, "dlib"), keep_path=False)
-
-        # Remove configuration files
+        copy(self, "LICENSE.txt", src=os.path.join(self.source_folder, "dlib"), dst=os.path.join(self.package_folder, "licenses"), keep_path=False)
         for dir_to_remove in [
             os.path.join("lib", "cmake"),
             os.path.join("lib", "pkgconfig"),
             os.path.join("include", "dlib", "cmake_utils"),
             os.path.join("include", "dlib", "external", "pybind11", "tools")
         ]:
-            tools.rmdir(os.path.join(self.package_folder, dir_to_remove))
+            rmdir(self, os.path.join(self.package_folder, dir_to_remove))
+        rm(self, "*.txt", os.path.join(self.package_folder, "include", "dlib"))
 
     def package_info(self):
         self.cpp_info.set_property("cmake_file_name", "dlib")
         self.cpp_info.set_property("cmake_target_name", "dlib::dlib")
         self.cpp_info.set_property("pkg_config_name", "dlib-1")
-        self.cpp_info.libs = tools.collect_libs(self)
+        # INFO: Unix systems use dlib as library name, but on Windows it includes settings, e.g dlib19.24.0_release_64bit_msvc1933.lib
+        self.cpp_info.libs = collect_libs(self)
         if self.settings.os in ["Linux", "FreeBSD"]:
-            self.cpp_info.system_libs = ["pthread"]
+            self.cpp_info.system_libs = ["pthread", "nsl"]
         elif self.settings.os == "Windows":
             self.cpp_info.system_libs = ["ws2_32", "winmm", "comctl32", "gdi32", "imm32"]
-
-        self.cpp_info.names["pkg_config"] = "dlib-1"
diff --git a/recipes/dlib/all/test_package/CMakeLists.txt b/recipes/dlib/all/test_package/CMakeLists.txt
index 50caaa372ec83..a2e5f6c5bb3a5 100644
--- a/recipes/dlib/all/test_package/CMakeLists.txt
+++ b/recipes/dlib/all/test_package/CMakeLists.txt
@@ -1,11 +1,13 @@
-cmake_minimum_required(VERSION 3.1)
-project(test_package LANGUAGES CXX)
-
-include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
-conan_basic_setup(TARGETS)
+cmake_minimum_required(VERSION 3.15)
+project(test_package CXX)
 
 find_package(dlib REQUIRED CONFIG)
 
 add_executable(${PROJECT_NAME} test_package.cpp)
-target_link_libraries(${PROJECT_NAME} dlib::dlib)
-set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11)
+target_link_libraries(${PROJECT_NAME} PRIVATE dlib::dlib)
+
+if(dlib_VERSION VERSION_GREATER_EQUAL 19.24.2)
+    target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14)
+else()
+    target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11)
+endif()
diff --git a/recipes/dlib/all/test_package/conanfile.py b/recipes/dlib/all/test_package/conanfile.py
index 38f4483872d47..ef5d7042163ec 100644
--- a/recipes/dlib/all/test_package/conanfile.py
+++ b/recipes/dlib/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.bindir, "test_package")
+            self.run(bin_path, env="conanrun")
diff --git a/recipes/dlib/all/test_v1_package/CMakeLists.txt b/recipes/dlib/all/test_v1_package/CMakeLists.txt
new file mode 100644
index 0000000000000..be00a8c7f57c7
--- /dev/null
+++ b/recipes/dlib/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/dlib/all/test_v1_package/conanfile.py b/recipes/dlib/all/test_v1_package/conanfile.py
new file mode 100644
index 0000000000000..e0660e0801b96
--- /dev/null
+++ b/recipes/dlib/all/test_v1_package/conanfile.py
@@ -0,0 +1,15 @@
+import os
+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.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/dlib/config.yml b/recipes/dlib/config.yml
index 4d03ed4f4b36d..8c827a6db181e 100644
--- a/recipes/dlib/config.yml
+++ b/recipes/dlib/config.yml
@@ -1,4 +1,6 @@
 versions:
+  "19.24.2":
+    folder: all
   "19.24":
     folder: all
   "19.23":
diff --git a/recipes/dlpack/all/conandata.yml b/recipes/dlpack/all/conandata.yml
index ef8f66a4af407..f541482d88868 100644
--- a/recipes/dlpack/all/conandata.yml
+++ b/recipes/dlpack/all/conandata.yml
@@ -1,4 +1,13 @@
 sources:
+  "1.0":
+    url: "https://github.com/dmlc/dlpack/archive/v1.0.tar.gz"
+    sha256: "f8cfdcb634ff3cf0e3d9a3426e019e1c6469780a3b0020c9bc4ecc09cf9abcb1"
+  "0.8":
+    url: "https://github.com/dmlc/dlpack/archive/v0.8.tar.gz"
+    sha256: "cf965c26a5430ba4cc53d61963f288edddcd77443aa4c85ce722aaf1e2f29513"
+  "0.6":
+    url: "https://github.com/dmlc/dlpack/archive/v0.6.tar.gz"
+    sha256: "ce7715108623c011aa1e01afb32e218ddbdf66492494d7e718a78ac41010b77a"
   "0.4":
     url: "https://github.com/dmlc/dlpack/archive/v0.4.tar.gz"
     sha256: "d0a533189ecd45a033b72e276fccaa2122cfd76de125e0a5e126bdea0fec2d24"
diff --git a/recipes/dlpack/all/conanfile.py b/recipes/dlpack/all/conanfile.py
index fa27209ed37f1..16cb97d66e4ba 100644
--- a/recipes/dlpack/all/conanfile.py
+++ b/recipes/dlpack/all/conanfile.py
@@ -1,7 +1,10 @@
+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.33.0"
+
+required_conan_version = ">=1.52.0"
 
 
 class DlpackConan(ConanFile):
@@ -10,18 +13,29 @@ class DlpackConan(ConanFile):
     url = "https://github.com/conan-io/conan-center-index"
     homepage = "https://github.com/dmlc/dlpack"
     description = "RFC for common in-memory tensor structure and operator interface for deep learning system"
-    topics = ("conan", "dlpack", "tensor", "operator")
+    topics = ("deep-learning", "operator", "tensor", "header-only")
+    package_type = "header-library"
+    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.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("LICENSE", dst="licenses")
-        self.copy("*dlpack.h", keep_path=True)
-
-    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="*.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/dlpack/all/test_package/CMakeLists.txt b/recipes/dlpack/all/test_package/CMakeLists.txt
index 196188113685c..45718466e5323 100644
--- a/recipes/dlpack/all/test_package/CMakeLists.txt
+++ b/recipes/dlpack/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(dlpack REQUIRED CONFIG)
 
 add_executable(${PROJECT_NAME} test_package.cpp)
-target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS})
+target_link_libraries(${PROJECT_NAME} PRIVATE dlpack::dlpack)
diff --git a/recipes/dlpack/all/test_package/conanfile.py b/recipes/dlpack/all/test_package/conanfile.py
index 1d0bdd3779793..48499fa0989d9 100644
--- a/recipes/dlpack/all/test_package/conanfile.py
+++ b/recipes/dlpack/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 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.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/dlpack/all/test_package/test_package.cpp b/recipes/dlpack/all/test_package/test_package.cpp
index a0a733faa8b21..9c286d918cb1b 100644
--- a/recipes/dlpack/all/test_package/test_package.cpp
+++ b/recipes/dlpack/all/test_package/test_package.cpp
@@ -4,9 +4,19 @@
 
 int main()
 {
+#ifdef DLPACK_MAJOR_VERSION // Since 1.0
+    int major = DLPACK_MAJOR_VERSION;
+    int minor = DLPACK_MINOR_VERSION;
+    int patch = 0;
+#elif DLPACK_VERSION < 60
     int major = (DLPACK_VERSION >> 6) & 7;
     int minor = (DLPACK_VERSION >> 3) & 7;
     int patch = DLPACK_VERSION & 7;
+#else
+    int major = DLPACK_VERSION / 100;
+    int minor = (DLPACK_VERSION - major * 100) / 10;
+    int patch = DLPACK_VERSION - major * 100 - minor * 10;
+#endif
     std::cout << "dlpack version: " << major << "." << minor << "." << patch << std::endl;
     return EXIT_SUCCESS;
 }
diff --git a/recipes/dlpack/all/test_v1_package/CMakeLists.txt b/recipes/dlpack/all/test_v1_package/CMakeLists.txt
new file mode 100644
index 0000000000000..9d54a092e0a67
--- /dev/null
+++ b/recipes/dlpack/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/docs/package_templates/header_only/all/test_v1_package/conanfile.py b/recipes/dlpack/all/test_v1_package/conanfile.py
similarity index 100%
rename from docs/package_templates/header_only/all/test_v1_package/conanfile.py
rename to recipes/dlpack/all/test_v1_package/conanfile.py
diff --git a/recipes/dlpack/config.yml b/recipes/dlpack/config.yml
index 4b83db0466f4e..001dc29f3eaea 100644
--- a/recipes/dlpack/config.yml
+++ b/recipes/dlpack/config.yml
@@ -1,3 +1,9 @@
 versions:
+  "1.0":
+    folder: "all"
+  "0.8":
+    folder: "all"
+  "0.6":
+    folder: "all"
   "0.4":
     folder: "all"
diff --git a/recipes/dnet/all/conandata.yml b/recipes/dnet/all/conandata.yml
new file mode 100644
index 0000000000000..f4b4a52916d3d
--- /dev/null
+++ b/recipes/dnet/all/conandata.yml
@@ -0,0 +1,7 @@
+sources:
+  "1.18.0":
+    url: "https://github.com/ofalk/libdnet/archive/refs/tags/libdnet-1.18.0.tar.gz"
+    sha256: "a4a82275c7d83b85b1daac6ebac9461352731922161f1dcdcccd46c318f583c9"
+  "1.17.0":
+    url: "https://github.com/ofalk/libdnet/archive/refs/tags/libdnet-1.17.0.tar.gz"
+    sha256: "6be1ed0763151ede4c9665a403f1c9d974b2ffab2eacdb26b22078e461aae1dc"
diff --git a/recipes/dnet/all/conanfile.py b/recipes/dnet/all/conanfile.py
new file mode 100644
index 0000000000000..c8d803e208864
--- /dev/null
+++ b/recipes/dnet/all/conanfile.py
@@ -0,0 +1,70 @@
+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.56.0"
+
+
+class dnetConan(ConanFile):
+    name = "dnet"
+    description = "Provides a simplified, portable interface to several low-level networking routines."
+    homepage = "https://github.com/ofalk/libdnet"
+    topics = ("dnet", "libdnet", "libdumbnet")
+    license = "BSD-3-Clause"
+    url = "https://github.com/conan-io/conan-center-index"
+    package_type = "library"
+    options = {
+        "shared": [True, False],
+        "fPIC": [True, False],
+    }
+    default_options = {
+        "shared": False,
+        "fPIC": True
+    }
+    settings = "os", "arch", "compiler", "build_type"
+
+
+    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")
+        # This is a pure C project
+        self.settings.rm_safe("compiler.cppstd")
+        self.settings.rm_safe("compiler.libcxx")
+
+    def source(self):
+        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):
+        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.configure()
+        cmake.install()
+        rmdir(self, os.path.join(self.package_folder, "lib", "cmake"))
+
+    def package_info(self):
+        self.cpp_info.libs.append("dnet")
+        self.cpp_info.includedirs.append(os.path.join("include", "dnet"))
+ 
+        if self.settings.os == 'Windows':
+            self.cpp_info.system_libs = ['Iphlpapi', 'wsock32']
diff --git a/recipes/dnet/all/test_package/CMakeLists.txt b/recipes/dnet/all/test_package/CMakeLists.txt
new file mode 100644
index 0000000000000..d2b66a2eb9cdf
--- /dev/null
+++ b/recipes/dnet/all/test_package/CMakeLists.txt
@@ -0,0 +1,7 @@
+cmake_minimum_required(VERSION 3.1)
+project(test_package C)
+
+find_package(dnet REQUIRED CONFIG)
+
+add_executable(${PROJECT_NAME} test_package.c)
+target_link_libraries(${PROJECT_NAME} PRIVATE dnet::dnet)
diff --git a/recipes/dnet/all/test_package/conanfile.py b/recipes/dnet/all/test_package/conanfile.py
new file mode 100644
index 0000000000000..dcfce1e159562
--- /dev/null
+++ b/recipes/dnet/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("{} {}".format(bin_path, "127.0.0.1"), env="conanrun")
diff --git a/recipes/dnet/all/test_package/test_package.c b/recipes/dnet/all/test_package/test_package.c
new file mode 100644
index 0000000000000..6102a898664e5
--- /dev/null
+++ b/recipes/dnet/all/test_package/test_package.c
@@ -0,0 +1,39 @@
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#if defined (__unix__) || (defined (__APPLE__) && defined (__MACH__))
+#include 
+#elif defined(_WIN32)
+#include 
+#endif
+
+void addr_usage(void)
+{
+	fprintf(stderr, "Usage: dnet addr 
...\n"); + exit(1); +} + +int main(int argc, char *argv[]) +{ + struct addr addr; + int c, len; + + if (argc == 1 || *(argv[1]) == '-') + addr_usage(); + + for (c = 1; c < argc; c++) { + if (addr_aton(argv[c], &addr) < 0) + addr_usage(); + + len = addr.addr_bits / 8; + + if (write(1, addr.addr_data8, len) != len) + err(1, "write"); + } + return 0; +} diff --git a/recipes/dnet/config.yml b/recipes/dnet/config.yml new file mode 100644 index 0000000000000..a8840ca57e8bd --- /dev/null +++ b/recipes/dnet/config.yml @@ -0,0 +1,5 @@ +versions: + "1.18.0": + folder: "all" + "1.17.0": + folder: "all" 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..f91d97fba0892 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.83.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/wayland/all/test_v1_package/CMakeLists.txt b/recipes/docopt.cpp/all/test_v1_package/CMakeLists.txt similarity index 100% rename from recipes/wayland/all/test_v1_package/CMakeLists.txt rename to recipes/docopt.cpp/all/test_v1_package/CMakeLists.txt 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/conandata.yml b/recipes/doctest/2.x.x/conandata.yml index e3e67654dc467..a2a355893f983 100644 --- a/recipes/doctest/2.x.x/conandata.yml +++ b/recipes/doctest/2.x.x/conandata.yml @@ -1,37 +1,43 @@ sources: - "2.3.5": - url: "https://github.com/doctest/doctest/archive/2.3.5.tar.gz" - sha256: "71d1ca0916bfea8f4550de196b66f2226f2fdb5fd4a2885a3b4c2dd8f035a8c9" - "2.3.6": - url: "https://github.com/doctest/doctest/archive/2.3.6.tar.gz" - sha256: "f63c3c01021ba3fb35a0702127abfaa6fc44aaefd309e2c246e62a083deffa1f" - "2.3.7": - url: "https://github.com/doctest/doctest/archive/2.3.7.tar.gz" - sha256: "a70cd25875029879e577b08cfaa57a76c7bea62c473ca94d85ec87ea53af7177" - "2.3.8": - url: "https://github.com/doctest/doctest/archive/2.3.8.tar.gz" - sha256: "d7232437eceb46ad5de03cacdee770c80f2e53e7b8efc1c8a8ed29539f64efa5" - "2.4.0": - url: "https://github.com/doctest/doctest/archive/2.4.0.tar.gz" - sha256: "f689f48e92c088928d88d8481e769c8e804f0a608b484ab8ef3d6ab6045b5444" - "2.4.1": - url: "https://github.com/doctest/doctest/archive/2.4.1.tar.gz" - sha256: "0a0f0be21ee23e36ff6b8b9d63c06a7792e04cce342e1df3dee0e40d1e21b9f0" - "2.4.3": - url: "https://github.com/doctest/doctest/archive/2.4.3.tar.gz" - sha256: "18c0f87f526bf34bb595c2841a2f0f33b28ab8c817d7c71ed1ba4665815d9ef6" - "2.4.4": - url: "https://github.com/doctest/doctest/archive/2.4.4.tar.gz" - sha256: "3bcb62ad316bf4230873a336fcc6eb6292116568a6e19ab8cdd37a1610773d70" - "2.4.5": - url: "https://github.com/doctest/doctest/archive/2.4.5.tar.gz" - sha256: "b76ece19f0e473e3afa5c545dbdce2dd70bfef98ed0f383443b2f9fd9f86d5b4" - "2.4.6": - url: "https://github.com/doctest/doctest/archive/2.4.6.tar.gz" - sha256: "39110778e6baf373ef04342d7cb3fe35da104cb40769103e8a2f0035f5a5f1cb" - "2.4.8": - url: "https://github.com/doctest/doctest/archive/v2.4.8.tar.gz" - sha256: "f52763630aa17bd9772b54e14b6cdd632c87adf0169455a86a49bd94abf2cd83" + "2.4.11": + url: "https://github.com/doctest/doctest/archive/refs/tags/v2.4.11.tar.gz" + sha256: "632ed2c05a7f53fa961381497bf8069093f0d6628c5f26286161fbd32a560186" + "2.4.10": + url: "https://github.com/doctest/doctest/archive/refs/tags/v2.4.10.tar.gz" + sha256: "d23213c415152d7aa4de99bb7c817fa29c0c03bd1a89972748579a7217fdbb8f" "2.4.9": - url: "https://github.com/doctest/doctest/archive/v2.4.9.tar.gz" + url: "https://github.com/doctest/doctest/archive/refs/tags/v2.4.9.tar.gz" sha256: "19b2df757f2f3703a5e63cee553d85596875f06d91a3333acd80a969ef210856" + "2.4.8": + url: "https://github.com/doctest/doctest/archive/refs/tags/v2.4.8.tar.gz" + sha256: "f52763630aa17bd9772b54e14b6cdd632c87adf0169455a86a49bd94abf2cd83" + "2.4.6": + url: "https://github.com/doctest/doctest/archive/refs/tags/2.4.6.tar.gz" + sha256: "39110778e6baf373ef04342d7cb3fe35da104cb40769103e8a2f0035f5a5f1cb" + "2.4.5": + url: "https://github.com/doctest/doctest/archive/refs/tags/2.4.5.tar.gz" + sha256: "b76ece19f0e473e3afa5c545dbdce2dd70bfef98ed0f383443b2f9fd9f86d5b4" + "2.4.4": + url: "https://github.com/doctest/doctest/archive/refs/tags/2.4.4.tar.gz" + sha256: "3bcb62ad316bf4230873a336fcc6eb6292116568a6e19ab8cdd37a1610773d70" + "2.4.3": + url: "https://github.com/doctest/doctest/archive/refs/tags/2.4.3.tar.gz" + sha256: "18c0f87f526bf34bb595c2841a2f0f33b28ab8c817d7c71ed1ba4665815d9ef6" + "2.4.1": + url: "https://github.com/doctest/doctest/archive/refs/tags/2.4.1.tar.gz" + sha256: "0a0f0be21ee23e36ff6b8b9d63c06a7792e04cce342e1df3dee0e40d1e21b9f0" + "2.4.0": + url: "https://github.com/doctest/doctest/archive/refs/tags/2.4.0.tar.gz" + sha256: "f689f48e92c088928d88d8481e769c8e804f0a608b484ab8ef3d6ab6045b5444" + "2.3.8": + url: "https://github.com/doctest/doctest/archive/refs/tags/2.3.8.tar.gz" + sha256: "d7232437eceb46ad5de03cacdee770c80f2e53e7b8efc1c8a8ed29539f64efa5" + "2.3.7": + url: "https://github.com/doctest/doctest/archive/refs/tags/2.3.7.tar.gz" + sha256: "a70cd25875029879e577b08cfaa57a76c7bea62c473ca94d85ec87ea53af7177" + "2.3.6": + url: "https://github.com/doctest/doctest/archive/refs/tags/2.3.6.tar.gz" + sha256: "f63c3c01021ba3fb35a0702127abfaa6fc44aaefd309e2c246e62a083deffa1f" + "2.3.5": + url: "https://github.com/doctest/doctest/archive/refs/tags/2.3.5.tar.gz" + sha256: "71d1ca0916bfea8f4550de196b66f2226f2fdb5fd4a2885a3b4c2dd8f035a8c9" diff --git a/recipes/doctest/2.x.x/conanfile.py b/recipes/doctest/2.x.x/conanfile.py index 4a5f3a48700e9..074df44e7b6d8 100644 --- a/recipes/doctest/2.x.x/conanfile.py +++ b/recipes/doctest/2.x.x/conanfile.py @@ -1,6 +1,9 @@ -import os from conan import ConanFile -from conan.tools import files +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout +import os + +required_conan_version = ">=1.50.0" class DoctestConan(ConanFile): @@ -8,43 +11,45 @@ class DoctestConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/onqtam/doctest" description = "C++11/14/17/20 single header testing framework" - topics = ("doctest", "header-only", "unit-test", "tdd") - settings = "os", "compiler" + topics = ("header-only", "unit-test", "tdd") + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" license = "MIT" - _source_subfolder = "source_subfolder" @property def _is_mingw(self): return self.settings.os == "Windows" and self.settings.compiler == "gcc" + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + def source(self): - files.get(self, **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 build(self): pass def package(self): - self.copy(pattern="LICENSE.txt", dst="licenses", src=self._source_subfolder) - self.copy(pattern="*doctest.h", dst="include", src=self._source_subfolder) - - cmake_script_dirs = { - "src": os.path.join(self._source_subfolder, "scripts/cmake"), - "dst": "lib/cmake" - } - - self.copy(pattern="doctest.cmake", **cmake_script_dirs) - self.copy(pattern="doctestAddTests.cmake", **cmake_script_dirs) + copy(self, "LICENSE.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*doctest.h", src=self.source_folder, dst=os.path.join(self.package_folder, "include")) + for cmake_file in ("doctest.cmake", "doctestAddTests.cmake"): + copy(self, cmake_file, src=os.path.join(self.source_folder, "scripts", "cmake"), + dst=os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): + self.cpp_info.set_property("cmake_file_name", "doctest") + self.cpp_info.set_property("cmake_target_name", "doctest::doctest") + # Upstream config file populates CMAKE_MODULE_PATH so that doctest.cmake & doctestAddTests.cmake + # are discoverable, therefore their folder is appended to builddirs. + # But this config file doesn't include these module files directly, + # thus they are not defined as cmake_build_modules + self.cpp_info.builddirs.append(os.path.join("lib", "cmake")) + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] if self._is_mingw: # See https://sourceforge.net/p/mingw-w64/bugs/727/ # can't use destructors in thread_local with mingw self.cpp_info.defines.append("DOCTEST_THREAD_LOCAL=") - - self.cpp_info.builddirs.append("lib/cmake") - self.cpp_info.build_modules.append("lib/cmake/doctest.cmake") - - def package_id(self): - self.info.clear() diff --git a/recipes/doctest/2.x.x/test_package/CMakeLists.txt b/recipes/doctest/2.x.x/test_package/CMakeLists.txt index 98cc84abb27fb..c3a61e866425e 100644 --- a/recipes/doctest/2.x.x/test_package/CMakeLists.txt +++ b/recipes/doctest/2.x.x/test_package/CMakeLists.txt @@ -1,15 +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(doctest REQUIRED CONFIG) -file(GLOB SOURCE_FILES *.cpp) - -add_executable(${PROJECT_NAME} ${SOURCE_FILES}) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) - -enable_testing() - -add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME}) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE doctest::doctest) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/doctest/2.x.x/test_package/conanfile.py b/recipes/doctest/2.x.x/test_package/conanfile.py index e209e5d26e439..0a6bc68712d90 100644 --- a/recipes/doctest/2.x.x/test_package/conanfile.py +++ b/recipes/doctest/2.x.x/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, 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 _configure_cmake(self): - cmake = CMake(self) - cmake.configure() - return cmake + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self.settings) or tools.os_info.is_windows: - cmake = self._configure_cmake() - cmake.test() + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/doctest/2.x.x/test_v1_package/CMakeLists.txt b/recipes/doctest/2.x.x/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/doctest/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/doctest/2.x.x/test_v1_package/conanfile.py b/recipes/doctest/2.x.x/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/doctest/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/doctest/config.yml b/recipes/doctest/config.yml index 61380be849cb7..9e8f4ea41f589 100644 --- a/recipes/doctest/config.yml +++ b/recipes/doctest/config.yml @@ -1,25 +1,29 @@ versions: - 2.3.5: + "2.4.11": folder: 2.x.x - 2.3.6: + "2.4.10": folder: 2.x.x - 2.3.7: + "2.4.9": folder: 2.x.x - 2.3.8: + "2.4.8": folder: 2.x.x - 2.4.0: + "2.4.6": folder: 2.x.x - 2.4.1: + "2.4.5": folder: 2.x.x - 2.4.3: + "2.4.4": folder: 2.x.x - 2.4.4: + "2.4.3": folder: 2.x.x - 2.4.5: + "2.4.1": folder: 2.x.x - 2.4.6: + "2.4.0": folder: 2.x.x - 2.4.8: + "2.3.8": folder: 2.x.x - "2.4.9": + "2.3.7": + folder: 2.x.x + "2.3.6": + folder: 2.x.x + "2.3.5": folder: 2.x.x diff --git a/recipes/double-conversion/all/conandata.yml b/recipes/double-conversion/all/conandata.yml index 7e987d626c73a..be979eb639b24 100644 --- a/recipes/double-conversion/all/conandata.yml +++ b/recipes/double-conversion/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.3.0": + url: "https://github.com/google/double-conversion/archive/refs/tags/v3.3.0.tar.gz" + sha256: "04ec44461850abbf33824da84978043b22554896b552c5fd11a9c5ae4b4d296e" "3.2.1": url: "https://github.com/google/double-conversion/archive/v3.2.1.tar.gz" sha256: "e40d236343cad807e83d192265f139481c51fc83a1c49e406ac6ce0a0ba7cd35" 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/double-conversion/config.yml b/recipes/double-conversion/config.yml index af0b0f2b2e22d..0b998927e4218 100644 --- a/recipes/double-conversion/config.yml +++ b/recipes/double-conversion/config.yml @@ -1,4 +1,6 @@ versions: + "3.3.0": + folder: all "3.2.1": folder: all "3.2.0": 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..bc35d6a0c794e 100644 --- a/recipes/doxygen/all/conandata.yml +++ b/recipes/doxygen/all/conandata.yml @@ -1,35 +1,13 @@ sources: + "1.12.0": + url: "https://github.com/doxygen/doxygen/releases/download/Release_1_12_0/doxygen-1.12.0.src.tar.gz" + sha256: "a3a3dba2018ef409d83d81a2fc42a0d19bdbe087252ef342bf214b51b8b01634" "1.9.4": url: "https://sourceforge.net/projects/doxygen/files/doxygen-1.9.4.src.tar.gz" sha256: "a15e9cd8c0d02b7888bc8356eac200222ecff1defd32f3fe05257d81227b1f37" - "1.9.2": - url: "https://sourceforge.net/projects/doxygen/files/doxygen-1.9.2.src.tar.gz" - sha256: "060f254bcef48673cc7ccf542736b7455b67c110b30fdaa33512a5b09bbecee5" - "1.9.1": - url: "https://sourceforge.net/projects/doxygen/files/doxygen-1.9.1.src.tar.gz" - sha256: "67aeae1be4e1565519898f46f1f7092f1973cce8a767e93101ee0111717091d1" - "1.8.20": - url: "https://sourceforge.net/projects/doxygen/files/doxygen-1.8.20.src.tar.gz" - sha256: "e0db6979286fd7ccd3a99af9f97397f2bae50532e4ecb312aa18862f8401ddec" - "1.8.18": - url: "https://sourceforge.net/projects/doxygen/files/doxygen-1.8.18.src.tar.gz" - sha256: "18173d9edc46d2d116c1f92a95d683ec76b6b4b45b817ac4f245bb1073d00656" - "1.8.17": - url: "https://sourceforge.net/projects/doxygen/files/doxygen-1.8.17.src.tar.gz" - sha256: "2cba988af2d495541cbbe5541b3bee0ee11144dcb23a81eada19f5501fd8b599" patches: - "1.9.2": - - patch_file: "patches/1.9.2-0001-imported-target.patch" - base_path: "source_subfolder" - "1.9.1": - - patch_file: "patches/1.9.1-0001-imported-target.patch" - base_path: "source_subfolder" - "1.8.20": - - patch_file: "patches/1.8.20-0001-relocatable-cmake.patch" - base_path: "source_subfolder" - "1.8.18": - - patch_file: "patches/1.8.18-0001-relocatable-cmake.patch" - base_path: "source_subfolder" - "1.8.17": - - patch_file: "patches/1.8.17-0001-relocatable-cmake.patch" - base_path: "source_subfolder" + "1.9.4": + - patch_file: "patches/1.9.4-0001-enable-modern-compilers.patch" + patch_description: "Enable modern compilers" + patch_type: "portability" + patch_source: "https://github.com/doxygen/doxygen/commit/5198966c8d5fec89116d025c74934ac03ea511fa" diff --git a/recipes/doxygen/all/conanfile.py b/recipes/doxygen/all/conanfile.py index b8ce7f7a1bd88..f86de9d6011bb 100644 --- a/recipes/doxygen/all/conanfile.py +++ b/recipes/doxygen/all/conanfile.py @@ -1,125 +1,99 @@ from conan import ConanFile -from conan.tools.scm import Version -from conan import tools -from conans import CMake 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 +from conan.tools.microsoft import is_msvc_static_runtime +from conan.tools.scm import Version import os -required_conan_version = ">=1.50.2" +required_conan_version = ">=2.4" class DoxygenConan(ConanFile): name = "doxygen" description = "A documentation system for C++, C, Java, IDL and PHP --- Note: Dot is disabled in this package" - topics = ("doxygen", "installer", "devtool", "documentation") + topics = ("installer", "devtool", "documentation") homepage = "https://github.com/doxygen/doxygen" license = "GPL-2.0-or-later" url = "https://github.com/conan-io/conan-center-index" + package_type = "application" settings = "os", "arch", "compiler", "build_type" options = { "enable_parse": [True, False], "enable_search": [True, False], + "enable_app": [True, False], } default_options = { "enable_parse": True, "enable_search": True, + "enable_app": False } - 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" + def export_sources(self): + export_conandata_patches(self) - @property - def _settings_build(self): - return getattr(self, "settings_build", self.settings) + def layout(self): + cmake_layout(self, src_folder="src") - def _minimum_compiler_version(self): - if Version(self.version) <= "1.9.1": - return { - "gcc": 5, - }.get(str(self.settings.compiler)) - return { - "gcc": 7, # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66297 - "Visual Studio": 15, - }.get(str(self.settings.compiler)) - - 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.11 <2]") + if self.options.enable_app or self.options.enable_parse: + self.requires("libiconv/1.17") + + def validate(self): + if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "5": + raise ConanInvalidConfiguration("Doxygen requires GCC >=5") + + if self.settings.compiler == "msvc" and Version(self.settings.compiler.version) < "191": + raise ConanInvalidConfiguration("Doxygen requires Visual Studio 2017 or newer") + + check_min_cppstd(self, "17") def build_requirements(self): - if self._settings_build.os == "Windows": - self.build_requires("winflexbison/2.5.24") + if self.settings_build.os == "Windows": + 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() - if minimum_compiler_version is not None: - if Version(self.settings.compiler.version) < minimum_compiler_version: - raise ConanInvalidConfiguration(f"Compiler version too old. At least {minimum_compiler_version} is required.") - if (self.settings.compiler == "Visual Studio" and - Version(self.settings.compiler.version) <= "14" and - Version(self.version) == "1.8.18"): - raise ConanInvalidConfiguration(f"Doxygen version {self.version} broken with VS {self.settings.compiler.version}.") - - 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) + self.tool_requires("cmake/[>=3.19 <4]") 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) + apply_conandata_patches(self) + + #Do not build manpages + cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") + replace_in_file(self, cmakelists, "add_subdirectory(doc)", "") + replace_in_file(self, cmakelists, "set(CMAKE_CXX_STANDARD", "##set(CMAKE_CXX_STANDARD") + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["build_parse"] = self.options.enable_parse + tc.variables["build_search"] = self.options.enable_search + tc.variables["build_app"] = self.options.enable_app + 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.set_property("libiconv", "cmake_additional_variables_prefixes", ["ICONV"]) + 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() + 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.set_property("cmake_find_mode", "none") self.cpp_info.libdirs = [] self.cpp_info.includedirs = [] - 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/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 deleted file mode 100644 index 53f65acfedfa3..0000000000000 --- a/recipes/doxygen/all/patches/1.9.1-0001-imported-target.patch +++ /dev/null @@ -1,92 +0,0 @@ -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 -+++ libmscgen/mscgen_bool.h -@@ -23,6 +23,14 @@ - #ifndef MSCGEN_BOOL_H - #define MSCGEN_BOOL_H - -+/* Some system headers define TRUE and FALSE so undefine them first */ -+#ifdef TRUE -+#undef TRUE -+#endif -+#ifdef FALSE -+#undef FALSE -+#endif -+ - typedef enum - { - FALSE = 0, -diff --git a/qtools/qglobal.h b/qtools/qglobal.h -index 0deef5d..86846f8 100644 ---- qtools/qglobal.h -+++ qtools/qglobal.h -@@ -357,6 +356,7 @@ typedef const char *pcchar; - typedef __int64 int64; - typedef unsigned __int64 uint64; - #else -+#include - #if !defined(_OS_AIX_) || !defined(_H_INTTYPES) - typedef long long int64; - #endif -diff --git a/src/doxygen.cpp b/src/doxygen.cpp -index 3fdde9bc..1b32e273 100644 ---- src/doxygen.cpp -+++ src/doxygen.cpp -@@ -12,6 +12,7 @@ - * input used in their production; they are not affected by this license. - * - */ -+#include - - #include - -@@ -32,7 +33,6 @@ - #include - #include - #include --#include - - #include "version.h" - #include "doxygen.h" -diff --git a/src/util.cpp b/src/util.cpp -index 7fcd5ed..399e7a2 100644 ---- src/util.cpp -+++ src/util.cpp -@@ -13,13 +13,13 @@ - * input used in their production; they are not affected by this license. - * - */ -+#include - - #include - #include - #include - #include - #include --#include - #include - - #include 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 deleted file mode 100644 index 57875eaf4cec1..0000000000000 --- a/recipes/doxygen/all/patches/1.9.2-0001-imported-target.patch +++ /dev/null @@ -1,37 +0,0 @@ ---- 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 @@ - #ifndef MSCGEN_BOOL_H - #define MSCGEN_BOOL_H - -+/* Some system headers define TRUE and FALSE so undefine them first */ -+#ifdef TRUE -+#undef TRUE -+#endif -+#ifdef FALSE -+#undef FALSE -+#endif -+ - typedef enum - { - FALSE = 0, diff --git a/recipes/doxygen/all/patches/1.9.4-0001-enable-modern-compilers.patch b/recipes/doxygen/all/patches/1.9.4-0001-enable-modern-compilers.patch new file mode 100644 index 0000000000000..d9f3f94873c2a --- /dev/null +++ b/recipes/doxygen/all/patches/1.9.4-0001-enable-modern-compilers.patch @@ -0,0 +1,25 @@ +From 5198966c8d5fec89116d025c74934ac03ea511fa Mon Sep 17 00:00:00 2001 +From: Dimitri van Heesch +Date: Fri, 6 May 2022 09:55:16 +0200 +Subject: [PATCH] issue #9312: Build: cache.h:53:14: error: 'exchange' is not a + member of 'std' + +--- + src/cache.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/cache.h b/src/cache.h +index 0ff3092ed5..e218eb27d2 100644 +--- a/src/cache.h ++++ b/src/cache.h +@@ -19,6 +19,7 @@ + #include + #include + #include ++#include + #include + + /*! Fixed size cache for value type V using keys of type K. +-- +2.39.1 + diff --git a/recipes/doxygen/all/test_package/CMakeLists.txt b/recipes/doxygen/all/test_package/CMakeLists.txt deleted file mode 100644 index 08bb0b438cb03..0000000000000 --- a/recipes/doxygen/all/test_package/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -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_package/conanfile.py b/recipes/doxygen/all/test_package/conanfile.py index a0fbd76152051..aeb3db4ed040f 100644 --- a/recipes/doxygen/all/test_package/conanfile.py +++ b/recipes/doxygen/all/test_package/conanfile.py @@ -1,22 +1,14 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanException -import os +from conan import ConanFile +from conan.tools.build import can_run 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 requirements(self): + self.requires(self.tested_reference_str) 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) + if can_run(self): + self.output.info("Doxygen Version:") + self.run("doxygen --version", env="conanrun") diff --git a/recipes/doxygen/all/test_package/test_package.cpp b/recipes/doxygen/all/test_package/test_package.cpp deleted file mode 100644 index 4caefdf4a378f..0000000000000 --- a/recipes/doxygen/all/test_package/test_package.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include - -/// \brief just a simple main function for the hello world -int main() -{ - std::cout << "bincrafters" << std::endl; - return 0; -} diff --git a/recipes/doxygen/config.yml b/recipes/doxygen/config.yml index 2157880ecf476..9354306101ae8 100644 --- a/recipes/doxygen/config.yml +++ b/recipes/doxygen/config.yml @@ -1,13 +1,5 @@ versions: - "1.9.4": - folder: "all" - "1.9.2": - folder: "all" - "1.9.1": - folder: "all" - "1.8.20": - folder: "all" - "1.8.18": - folder: "all" - "1.8.17": + "1.12.0": folder: "all" + "1.9.4": + folder: "all" \ No newline at end of file diff --git a/recipes/dpp/all/conandata.yml b/recipes/dpp/all/conandata.yml new file mode 100644 index 0000000000000..72137f59232db --- /dev/null +++ b/recipes/dpp/all/conandata.yml @@ -0,0 +1,9 @@ +sources: + "10.0.35": + url: + - "https://github.com/brainboxdotcc/DPP/archive/refs/tags/v10.0.35.zip" + sha256: "ebe82b0c3c7678d31bc26ad7ab9aedfd66057a559c541750ede5d19a0ed0c245" + "10.0.34": + url: + - "https://github.com/brainboxdotcc/DPP/archive/refs/tags/v10.0.34.zip" + sha256: "944dcaa19638ff88feceae2f543662675eb8aceb59458ad369edc28819e05054" diff --git a/recipes/dpp/all/conanfile.py b/recipes/dpp/all/conanfile.py new file mode 100644 index 0000000000000..b33af815685ca --- /dev/null +++ b/recipes/dpp/all/conanfile.py @@ -0,0 +1,81 @@ +import os +from conan import ConanFile +from conan.tools.build import check_min_cppstd, cross_building +from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps +from conan.tools.files import get, copy, rmdir +from conan.tools.scm import Version + +required_conan_version = ">=2" + +class DPPConan(ConanFile): + name = "dpp" + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/brainboxdotcc/DPP" + description = "D++ is a lightweight and efficient library for Discord" + topics = ("discord") + package_type = "shared-library" + settings = "os", "compiler", "build_type", "arch" + + def validate(self): + check_min_cppstd(self, "17") + + def requirements(self): + self.requires("nlohmann_json/3.11.2", transitive_libs=True, transitive_headers=True) + self.requires("openssl/[>=1.1 <4]") + self.requires("zlib/[>=1.2.11 <2]") + self.requires("opus/1.4") + + def layout(self): + cmake_layout(self, src_folder="src") + + + def build_requirements(self): + self.tool_requires("cmake/[>=3.16 <4]") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + deps = CMakeDeps(self) + deps.generate() + tc = CMakeToolchain(self) + tc.cache_variables["DPP_NO_VCPKG"] = True + tc.cache_variables["DPP_USE_EXTERNAL_JSON"] = True + tc.cache_variables["CONAN_EXPORTED"] = True + tc.cache_variables["BUILD_VOICE_SUPPORT"] = True + tc.cache_variables["DPP_BUILD_TEST"] = False + tc.cache_variables["BUILD_SHARED_LIBS"] = True + if Version(self.version) <= "10.0.34": + # Workaround for Neon not compiling in old versions + tc.cache_variables["AVX_TYPE"] = "AVX0" + if self.settings.os == "Macos" and cross_building(self) and self.settings.arch == "x86_64": + tc.cache_variables["AVX1_EXITCODE"] = "0" + tc.cache_variables["AVX2_EXITCODE"] = "0" + tc.cache_variables["AVX512_EXITCODE"] = "-1" + tc.cache_variables["AVX1024_EXITCODE"] = "-1" + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + 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")) + + def package_info(self): + self.cpp_info.libs = ["dpp"] + self.cpp_info.set_property("cmake_file_name", "dpp") + self.cpp_info.set_property("cmake_target_name", "dpp::dpp") + # On windows only, the headers and libs go into dpp-10.0 subdirectories. + if self.settings.os == "Windows": + self.cpp_info.includedirs = ["include/dpp-10.0"] + self.cpp_info.libdirs = ["lib/dpp-10.0"] + elif self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs = ["pthread"] + self.cpp_info.defines = ["DPP_USE_EXTERNAL_JSON"] diff --git a/recipes/dpp/all/test_package/CMakeLists.txt b/recipes/dpp/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..6aad9088d01aa --- /dev/null +++ b/recipes/dpp/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) + +project(test_package LANGUAGES CXX) +find_package(dpp REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE dpp::dpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/dpp/all/test_package/conanfile.py b/recipes/dpp/all/test_package/conanfile.py new file mode 100644 index 0000000000000..ef5d7042163ec --- /dev/null +++ b/recipes/dpp/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/dpp/all/test_package/test_package.cpp b/recipes/dpp/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..90606cfd59042 --- /dev/null +++ b/recipes/dpp/all/test_package/test_package.cpp @@ -0,0 +1,5 @@ +#include + +int main() { + dpp::cluster test_cluster(""); +} diff --git a/recipes/dpp/config.yml b/recipes/dpp/config.yml new file mode 100644 index 0000000000000..7b7ac472d8862 --- /dev/null +++ b/recipes/dpp/config.yml @@ -0,0 +1,5 @@ +versions: + "10.0.35": + folder: all + "10.0.34": + folder: all diff --git a/recipes/dr_libs/all/conandata.yml b/recipes/dr_libs/all/conandata.yml new file mode 100644 index 0000000000000..3781cb3dd93e8 --- /dev/null +++ b/recipes/dr_libs/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "cci.20230529": + url: "https://github.com/mackron/dr_libs/archive/dbbd08d81fd2b084c5ae931531871d0c5fd83b87.tar.gz" + sha256: "9e8d488092c9a0a6b08d9aafc631b1c8d75e707bc10a56a5f4bb1709213702c1" diff --git a/recipes/dr_libs/all/conanfile.py b/recipes/dr_libs/all/conanfile.py new file mode 100644 index 0000000000000..a0572bd8f2cdd --- /dev/null +++ b/recipes/dr_libs/all/conanfile.py @@ -0,0 +1,71 @@ +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 +from conan.tools.microsoft import is_msvc, check_min_vs +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration + +import os + +required_conan_version = ">=1.52.0" + + +class DrLibsConan(ConanFile): + name = "dr_libs" + description = "Public domain, single file audio decoding libraries for C and C++." + license = ("Unlicense", "MIT-0") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/mackron/dr_libs" + topics = ("audio", "encoding", "header-only") + no_copy_source = True + settings = "os", "arch", "compiler", "build_type" + package_type = "header-library" + + @property + def _min_cppstd(self): + return 11 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "4.7", + "clang": "3.4", + "apple-clang": "6", + } + + def validate(self): + if self.settings.get_safe("compiler.cppstd"): + check_min_cppstd(self, self._min_cppstd) + check_min_vs(self, 180) + 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 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], 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, + excludes=("old/*", "wip/*", "tests/*") + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/dr_libs/all/test_package/CMakeLists.txt b/recipes/dr_libs/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..ebee798816d9d --- /dev/null +++ b/recipes/dr_libs/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(test_DrLibs LANGUAGES CXX) +find_package(dr_libs REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE dr_libs::dr_libs) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/dr_libs/all/test_package/conanfile.py b/recipes/dr_libs/all/test_package/conanfile.py new file mode 100644 index 0000000000000..70d86ba6525a6 --- /dev/null +++ b/recipes/dr_libs/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 TestDrLibsConan(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_DrLibs") + self.run(bin_path, env="conanrun") diff --git a/recipes/dr_libs/all/test_package/test_package.cpp b/recipes/dr_libs/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..eca29117d03db --- /dev/null +++ b/recipes/dr_libs/all/test_package/test_package.cpp @@ -0,0 +1,24 @@ +#define DR_WAV_IMPLEMENTATION +#include "dr_wav.h" +#include +#include +#include + +#define BUFFER_SIZE 255 + +int main() { + srand(time(NULL)); + + // Create fake PCM data + std::vector buffer(BUFFER_SIZE); + for (size_t i = 0; i < BUFFER_SIZE; i++) + buffer[i] = rand() % std::numeric_limits::max(); + + // Convert it to 32-bit floating point + std::vector asFloat(buffer.size()); + drwav_s16_to_f32(asFloat.data(), buffer.data(), buffer.size()); + + // If we get here with no issues, then it's a success + std::cout << "Test success!" << std::endl; + return DRWAV_SUCCESS; +} diff --git a/recipes/dr_libs/config.yml b/recipes/dr_libs/config.yml new file mode 100644 index 0000000000000..612a58a0b962e --- /dev/null +++ b/recipes/dr_libs/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20230529": + folder: all diff --git a/recipes/draco/all/conandata.yml b/recipes/draco/all/conandata.yml index 5105546d4c2a2..5ef3ead009666 100644 --- a/recipes/draco/all/conandata.yml +++ b/recipes/draco/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.5.6": + url: "https://github.com/google/draco/archive/refs/tags/1.5.6.tar.gz" + sha256: "0280888e5b8e4c4fb93bf40e65e4e8a1ba316a0456f308164fb5c2b2b0c282d6" "1.5.5": url: "https://github.com/google/draco/archive/refs/tags/1.5.5.tar.gz" sha256: "6b7994150bbc513abcdbe22ad778d6b2df10fc8cdc7035e916985b2a209ab826" diff --git a/recipes/draco/all/conanfile.py b/recipes/draco/all/conanfile.py index fcf412b2c827e..c61899af9a34f 100644 --- a/recipes/draco/all/conanfile.py +++ b/recipes/draco/all/conanfile.py @@ -5,7 +5,7 @@ from conan.tools.scm import Version import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class DracoConan(ConanFile): @@ -18,6 +18,7 @@ class DracoConan(ConanFile): homepage = "https://google.github.io/draco/" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -51,10 +52,7 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") if not self.options.enable_mesh_compression: del self.options.enable_standard_edgebreaker del self.options.enable_predictive_edgebreaker @@ -63,12 +61,11 @@ def layout(self): cmake_layout(self, src_folder="src") def validate(self): - if self.info.settings.compiler.get_safe("cppstd"): + 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/draco/all/test_v1_package/CMakeLists.txt b/recipes/draco/all/test_v1_package/CMakeLists.txt index 4d130e35e6014..0d20897301b68 100644 --- a/recipes/draco/all/test_v1_package/CMakeLists.txt +++ b/recipes/draco/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(draco REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE draco::draco) -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/draco/config.yml b/recipes/draco/config.yml index 1d0bf1ab356f5..5abf33ed66800 100644 --- a/recipes/draco/config.yml +++ b/recipes/draco/config.yml @@ -1,4 +1,6 @@ versions: + "1.5.6": + folder: all "1.5.5": folder: all "1.5.4": diff --git a/recipes/drflac/all/conandata.yml b/recipes/drflac/all/conandata.yml index 4b8f26778e5b0..a2e60990c6f30 100644 --- a/recipes/drflac/all/conandata.yml +++ b/recipes/drflac/all/conandata.yml @@ -1,9 +1,11 @@ sources: # NOTE: https://github.com/mackron/dr_libs/blob/dd762b861ecadf5ddd5fb03e9ca1db6707b54fbb/dr_flac.h#L3 + "0.12.42": + url: "https://github.com/mackron/dr_libs/archive/a4b73d3d423e1cea0652b76d0806e7620337a40f.zip" + sha256: "89729a85f092a81eb6e646c1580525c7738c4780bc59890c908b9582e8e9312b" "0.12.39": - url: https://github.com/mackron/dr_libs/archive/dd762b861ecadf5ddd5fb03e9ca1db6707b54fbb.zip + 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 + url: "https://github.com/mackron/dr_libs/archive/089deaa62268e6dacf2026754b1b228e54eb3993.zip" sha256: "1b9fa02c56c2b42c99dd070c7dc3d4e8dee6a4e49139055e7f79e21aa88070d7" diff --git a/recipes/drflac/all/conanfile.py b/recipes/drflac/all/conanfile.py index ae9f5ee425002..99eec44380473 100644 --- a/recipes/drflac/all/conanfile.py +++ b/recipes/drflac/all/conanfile.py @@ -4,7 +4,7 @@ from conan.tools.scm import Version import os -required_conan_version = ">=1.46.0" +required_conan_version = ">=1.53.0" class DrflacConan(ConanFile): @@ -14,26 +14,27 @@ class DrflacConan(ConanFile): topics = ("audio", "flac", "sound") license = ("Unlicense", "MIT-0") url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { - "shared": [True, False], + "shared": [True, False], "fPIC": [True, False], "buffer_size": ["ANY"], "no_crc": [True, False], "no_ogg": [True, False], "no_simd": [True, False], "no_stdio": [True, False], - "no_wchar": [True, False] + "no_wchar": [True, False], } default_options = { - "shared": False, + "shared": False, "fPIC": True, "buffer_size": 0, # zero means the default buffer size is used "no_crc": False, "no_ogg": False, "no_simd": False, "no_stdio": False, - "no_wchar": False + "no_wchar": False, } exports_sources = ["CMakeLists.txt", "dr_flac.c"] @@ -45,15 +46,15 @@ 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) + 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) @@ -68,7 +69,7 @@ def generate(self): def build(self): cmake = CMake(self) - cmake.configure() + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() def package(self): @@ -91,4 +92,4 @@ def package_info(self): 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") + 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 f1c86abcb3be6..1db07f8a402a7 100644 --- a/recipes/drflac/all/test_package/CMakeLists.txt +++ b/recipes/drflac/all/test_package/CMakeLists.txt @@ -1,8 +1,8 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.8) project(test_package LANGUAGES C) find_package(drflac CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} drflac::drflac) -set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD 99) +target_link_libraries(${PROJECT_NAME} PRIVATE drflac::drflac) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) diff --git a/recipes/drflac/all/test_package/conanfile.py b/recipes/drflac/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/drflac/all/test_package/conanfile.py +++ b/recipes/drflac/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/drflac/all/test_v1_package/CMakeLists.txt b/recipes/drflac/all/test_v1_package/CMakeLists.txt index d9f4971c6bf0a..0d20897301b68 100644 --- a/recipes/drflac/all/test_v1_package/CMakeLists.txt +++ b/recipes/drflac/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(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) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/drflac/config.yml b/recipes/drflac/config.yml index f7ff0941f9f1b..75c09924cb231 100644 --- a/recipes/drflac/config.yml +++ b/recipes/drflac/config.yml @@ -1,4 +1,6 @@ versions: + "0.12.42": + folder: all "0.12.39": folder: all "0.12.38": diff --git a/recipes/drmp3/all/conandata.yml b/recipes/drmp3/all/conandata.yml index a26d9e9dbb871..58d5499fc9714 100644 --- a/recipes/drmp3/all/conandata.yml +++ b/recipes/drmp3/all/conandata.yml @@ -1,9 +1,11 @@ sources: # NOTE: https://github.com/mackron/dr_libs/blob/dd762b861ecadf5ddd5fb03e9ca1db6707b54fbb/dr_mp3.h#L3 + "0.6.38": + url: "https://github.com/mackron/dr_libs/archive/01d23df76776faccee3bc456f685900dcc273b4c.zip" + sha256: "fe82eac7a30c01679ddfdf1d51d1829d72a78b6ec236c47eb03abc089a4457ab" "0.6.34": - url: https://github.com/mackron/dr_libs/archive/dd762b861ecadf5ddd5fb03e9ca1db6707b54fbb.zip + 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 + url: "https://github.com/mackron/dr_libs/archive/9497270f581f43e6b795ce5d98d8764861fb6a50.zip" sha256: "572b59ec9719cf8f4938f982bc1f2e52689a3fbf6cceb4f27478942d7e35456b" diff --git a/recipes/drmp3/all/conanfile.py b/recipes/drmp3/all/conanfile.py index e21eeff31877c..4e596641bffba 100644 --- a/recipes/drmp3/all/conanfile.py +++ b/recipes/drmp3/all/conanfile.py @@ -3,48 +3,47 @@ from conan.tools.files import copy, get import os -required_conan_version = ">=1.46.0" +required_conan_version = ">=1.53.0" class Drmp3Conan(ConanFile): name = "drmp3" description = "MP3 audio decoder." - homepage = "https://mackron.github.io/" + homepage = "https://github.com/mackron/dr_libs" topics = ("audio", "mp3", "sound") license = ("Unlicense", "MIT-0") url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { - "shared": [True, False], + "shared": [True, False], "fPIC": [True, False], "no_simd": [True, False], - "no_stdio": [True, False] + "no_stdio": [True, False], } default_options = { - "shared": False, + "shared": False, "fPIC": True, "no_simd": False, - "no_stdio": False + "no_stdio": False, } exports_sources = ["CMakeLists.txt", "dr_mp3.c"] - _cmake = None - 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) + 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) @@ -55,7 +54,7 @@ def generate(self): def build(self): cmake = CMake(self) - cmake.configure() + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() def package(self): diff --git a/recipes/drmp3/all/test_package/CMakeLists.txt b/recipes/drmp3/all/test_package/CMakeLists.txt index b5b2e6102e202..d5c1b7eb10c20 100644 --- a/recipes/drmp3/all/test_package/CMakeLists.txt +++ b/recipes/drmp3/all/test_package/CMakeLists.txt @@ -1,8 +1,8 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.8) project(test_package LANGUAGES C) find_package(drmp3 CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} drmp3::drmp3) -set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD 99) +target_link_libraries(${PROJECT_NAME} PRIVATE drmp3::drmp3) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) diff --git a/recipes/drmp3/all/test_package/conanfile.py b/recipes/drmp3/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/drmp3/all/test_package/conanfile.py +++ b/recipes/drmp3/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/drmp3/all/test_v1_package/CMakeLists.txt b/recipes/drmp3/all/test_v1_package/CMakeLists.txt index bfd7908ef1c6f..0d20897301b68 100644 --- a/recipes/drmp3/all/test_v1_package/CMakeLists.txt +++ b/recipes/drmp3/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(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) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/drmp3/config.yml b/recipes/drmp3/config.yml index dda44114b507b..cd9d5736792a2 100644 --- a/recipes/drmp3/config.yml +++ b/recipes/drmp3/config.yml @@ -1,4 +1,6 @@ versions: + "0.6.38": + folder: all "0.6.34": folder: all "0.6.32": diff --git a/recipes/drogon/all/conandata.yml b/recipes/drogon/all/conandata.yml index 4211c4dd99f2b..78bae5ec69798 100644 --- a/recipes/drogon/all/conandata.yml +++ b/recipes/drogon/all/conandata.yml @@ -1,39 +1,106 @@ sources: - "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" + "1.9.8": + url: "https://github.com/drogonframework/drogon/archive/v1.9.8.tar.gz" + sha256: "62332a4882cc7db1c7cf04391b65c91ddf6fcbb49af129fc37eb0130809e0449" + "1.9.7": + url: "https://github.com/drogonframework/drogon/archive/v1.9.7.tar.gz" + sha256: "e54c5d604769a496b951e5af52a0f85e60eba584fae426d204eb5b2f02cfbf59" + "1.9.6": + url: "https://github.com/drogonframework/drogon/archive/v1.9.6.tar.gz" + sha256: "a81d0ea0e87b0214aa56f7fa7bb851011efe606af67891a0945825104505a08a" + "1.9.5": + url: "https://github.com/drogonframework/drogon/archive/v1.9.5.tar.gz" + sha256: "ec17882835abeb0672db29cb36ab0c5523f144d5d8ff177861b8f5865803eaae" + "1.9.4": + url: "https://github.com/drogonframework/drogon/archive/v1.9.4.tar.gz" + sha256: "b23d9d01d36fb1221298fcdbedcf7fd3e1b8b8821bf6fb8ed073c8b0c290d11d" + "1.9.3": + url: "https://github.com/drogonframework/drogon/archive/v1.9.3.tar.gz" + sha256: "fb4ef351b3e4c06ed850cfbbf50c571502decb1738fb7d62a9d7d70077c9fc23" + "1.9.2": + url: "https://github.com/drogonframework/drogon/archive/v1.9.2.tar.gz" + sha256: "5bfcb7e11df83de45efc24e2785646276a0166893e0475221d8e7fa82832ffbd" + "1.9.1": + url: "https://github.com/drogonframework/drogon/archive/v1.9.1.tar.gz" + sha256: "0f8bab22e02681d05787c88cbef5d04b105f6644ebf7cf29898d0a52ebe959e4" + "1.9.0": + url: "https://github.com/drogonframework/drogon/archive/v1.9.0.tar.gz" + sha256: "35793c1b64c32ebbea5a6cb3b1c22bcd0820e948674ecba92022ec05b41c848b" + "1.8.7": + url: "https://github.com/drogonframework/drogon/archive/v1.8.7.tar.gz" + sha256: "d2d80d35becd69bf80d74bf09b69425193f1b7be3926bd44f3ac7b951e54465d" patches: - "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" + "1.9.8": + - patch_file: "patches/1.8.5-0001-remove-shared-libs.patch" + patch_description: "remove shared libs option" patch_type: "conan" - - patch_file: "patches/1.8.0-0002-find-package-jsoncpp.patch" + - patch_file: "patches/1.9.7-0002-find-cci-packages.patch" patch_description: "Fix jsoncpp 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" + "1.9.7": + - patch_file: "patches/1.8.5-0001-remove-shared-libs.patch" + patch_description: "remove shared libs option" patch_type: "conan" - - patch_file: "patches/1.8.0-0002-find-package-jsoncpp.patch" + - patch_file: "patches/1.9.7-0002-find-cci-packages.patch" patch_description: "Fix jsoncpp cmake target name" patch_type: "conan" - "1.7.5": - - patch_file: "patches/1.7.5-0001-disable_trantor.patch" - patch_description: "Consume Trantor package from Conan instead of using the subproject" + - patch_file: "patches/1.9.7-0003-include-exception.patch" + patch_description: "include exception for exception_ptr" + patch_type: "portability" + patch_source: "https://github.com/drogonframework/drogon/pull/2159" + "1.9.6": + - patch_file: "patches/1.8.5-0001-remove-shared-libs.patch" + patch_description: "remove shared libs option" patch_type: "conan" - - patch_file: "patches/1.7.5-0002-remove-boost-components.patch" - patch_description: "Do not consume specific Boost components" + - patch_file: "patches/1.9.6-0002-find-cci-packages.patch" + patch_description: "Fix jsoncpp cmake target name" + patch_type: "conan" + "1.9.5": + - patch_file: "patches/1.8.5-0001-remove-shared-libs.patch" + patch_description: "remove shared libs option" + patch_type: "conan" + - patch_file: "patches/1.9.2-0002-find-cci-packages.patch" + patch_description: "Fix jsoncpp cmake target name" + patch_type: "conan" + "1.9.4": + - patch_file: "patches/1.8.5-0001-remove-shared-libs.patch" + patch_description: "remove shared libs option" + patch_type: "conan" + - patch_file: "patches/1.9.2-0002-find-cci-packages.patch" + patch_description: "Fix jsoncpp cmake target name" + patch_type: "conan" + "1.9.3": + - patch_file: "patches/1.8.5-0001-remove-shared-libs.patch" + patch_description: "remove shared libs option" + patch_type: "conan" + - patch_file: "patches/1.9.2-0002-find-cci-packages.patch" + patch_description: "Fix jsoncpp cmake target name" + patch_type: "conan" + "1.9.2": + - patch_file: "patches/1.8.5-0001-remove-shared-libs.patch" + patch_description: "remove shared libs option" + patch_type: "conan" + - patch_file: "patches/1.9.2-0002-find-cci-packages.patch" + patch_description: "Fix jsoncpp cmake target name" + patch_type: "conan" + "1.9.1": + - patch_file: "patches/1.8.5-0001-remove-shared-libs.patch" + patch_description: "remove shared libs option" + patch_type: "conan" + - patch_file: "patches/1.9.0-0002-find-cci-packages.patch" + patch_description: "Fix jsoncpp cmake target name" + patch_type: "conan" + "1.9.0": + - patch_file: "patches/1.8.5-0001-remove-shared-libs.patch" + patch_description: "remove shared libs option" + patch_type: "conan" + - patch_file: "patches/1.9.0-0002-find-cci-packages.patch" + patch_description: "Fix jsoncpp cmake target name" patch_type: "conan" - - patch_file: "patches/1.7.5-0003-find-package-trantor.patch" - patch_description: "Fix Trantor cmake target name" + "1.8.7": + - patch_file: "patches/1.8.5-0001-remove-shared-libs.patch" + patch_description: "remove shared libs option" patch_type: "conan" - - patch_file: "patches/1.7.5-0004-find-package-jsoncpp.patch" + - patch_file: "patches/1.8.6-0002-find-cci-packages.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 948067d576e19..88788705194dd 100644 --- a/recipes/drogon/all/conanfile.py +++ b/recipes/drogon/all/conanfile.py @@ -1,20 +1,24 @@ +import os + from conan import ConanFile -from conan.tools.cmake import cmake_layout, CMakeToolchain, CMakeDeps, CMake -from conan.tools.files import copy, get, apply_conandata_patches, rmdir +from conan.errors import ConanInvalidConfiguration from conan.tools.build import check_min_cppstd +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.scm import Version -from conan.errors import ConanInvalidConfiguration -import os +from conan.tools.microsoft import is_msvc + +required_conan_version = ">=1.53.0" -required_conan_version = ">=1.50.2 <1.51.0 || >=1.51.2" class DrogonConan(ConanFile): name = "drogon" description = "A C++14/17/20 based HTTP web application framework running on Linux/macOS/Unix/Windows" - topics = ("http-server", "non-blocking-io", "http-framework", "asynchronous-programming") license = "MIT" - homepage = "https://github.com/drogonframework/drogon" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/drogonframework/drogon" + topics = ("http-server", "non-blocking-io", "http-framework", "asynchronous-programming") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [False, True], @@ -24,6 +28,7 @@ class DrogonConan(ConanFile): "with_orm": [True, False], "with_profile": [True, False], "with_brotli": [True, False], + "with_yaml_cpp": [True, False], "with_postgres": [True, False], "with_postgres_batch": [True, False], "with_mysql": [True, False], @@ -38,6 +43,7 @@ class DrogonConan(ConanFile): "with_orm": True, "with_profile": False, "with_brotli": False, + "with_yaml_cpp": False, "with_postgres": False, "with_postgres_batch": False, "with_mysql": False, @@ -46,16 +52,17 @@ class DrogonConan(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) < "1.8.4": + del self.options.with_yaml_cpp 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 @@ -66,51 +73,71 @@ 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 { - "Visual Studio": "15" if Version(self.version) < "1.8.2" else "16", - "msvc": "191" if Version(self.version) < "1.8.2" else "192", - "gcc": "6", - "clang": "5", - "apple-clang": "10", - } + "14": { + "Visual Studio": "15", + "msvc": "191", + "gcc": "6", + "clang": "5", + "apple-clang": "10", + }, + "17": { + "Visual Studio": "16", + "msvc": "192", + "gcc": "8", + "clang": "7", + "apple-clang": "12", + } + }.get(str(self._min_cppstd), {}) 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) minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) if minimum_version: if Version(self.info.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration("{} requires C++14, which your compiler does not support.".format(self.name)) + 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}.") + + if self.settings.compiler.get_safe("cppstd") == "14" and not self.options.with_boost: + raise ConanInvalidConfiguration(f"{self.ref} requires boost on C++14") def requirements(self): - self.requires("trantor/1.5.8") - self.requires("jsoncpp/1.9.5") - self.requires("openssl/1.1.1s") - self.requires("zlib/1.2.13") + if Version(self.version) < "1.9.7": + self.requires("trantor/1.5.19", transitive_headers=True, transitive_libs=True) + else: + self.requires("trantor/1.5.21", transitive_headers=True, transitive_libs=True) + self.requires("jsoncpp/1.9.5", transitive_headers=True, transitive_libs=True) + self.requires("openssl/[>=1.1 <4]") + self.requires("zlib/[>=1.2.11 <2]") if self.settings.os == "Linux": - self.requires("libuuid/1.0.3") + self.requires("util-linux-libuuid/2.39.2") if self.options.with_profile: self.requires("coz/cci.20210322") if self.options.with_boost: - self.requires("boost/1.80.0") + self.requires("boost/1.83.0", transitive_headers=True) if self.options.with_brotli: - self.requires("brotli/1.0.9") + self.requires("brotli/1.1.0") if self.options.get_safe("with_postgres"): - self.requires("libpq/14.5") + self.requires("libpq/15.4") if self.options.get_safe("with_mysql"): - self.requires("libmysqlclient/8.0.30") + self.requires("libmysqlclient/8.1.0") if self.options.get_safe("with_sqlite"): - self.requires("sqlite3/3.40.0") + self.requires("sqlite3/3.45.0") if self.options.get_safe("with_redis"): - self.requires("hiredis/1.1.0") + self.requires("hiredis/1.2.0") + if self.options.get_safe("with_yaml_cpp", False): + self.requires("yaml-cpp/0.8.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 layout(self): cmake_layout(self, src_folder="src") @@ -124,11 +151,16 @@ def generate(self): tc.variables["BUILD_DROGON_SHARED"] = self.options.shared tc.variables["BUILD_DOC"] = False tc.variables["BUILD_BROTLI"] = self.options.with_brotli + tc.variables["BUILD_YAML_CONFIG"] = self.options.get_safe("with_yaml_cpp", False) 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) + if is_msvc(self): + tc.variables["CMAKE_CXX_FLAGS"] = "/Zc:__cplusplus /EHsc" + if Version(self.version) >= "1.8.4": + tc.variables["USE_SUBMODULE"] = False tc.generate() tc = CMakeDeps(self) tc.generate() @@ -154,7 +186,7 @@ def package_info(self): 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") diff --git a/recipes/drogon/all/patches/1.7.5-0001-disable_trantor.patch b/recipes/drogon/all/patches/1.7.5-0001-disable_trantor.patch deleted file mode 100644 index bd56d16c697b5..0000000000000 --- a/recipes/drogon/all/patches/1.7.5-0001-disable_trantor.patch +++ /dev/null @@ -1,29 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 146d2b8..f83e119 100755 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -52,7 +52,6 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC") - endif () - - if (BUILD_DROGON_SHARED) -- set(BUILD_TRANTOR_SHARED TRUE) - set(CMAKE_POSITION_INDEPENDENT_CODE TRUE) - find_package(Threads) - # set(BUILD_EXAMPLES FALSE) -@@ -110,7 +109,6 @@ target_include_directories( - $ - $ - $ -- $ - $ - $) - -@@ -120,8 +118,6 @@ if (WIN32) - PRIVATE $) - endif (WIN32) - --add_subdirectory(trantor) -- - target_link_libraries(${PROJECT_NAME} PUBLIC trantor) - - if(${CMAKE_SYSTEM_NAME} STREQUAL "Haiku") diff --git a/recipes/drogon/all/patches/1.7.5-0002-remove-boost-components.patch b/recipes/drogon/all/patches/1.7.5-0002-remove-boost-components.patch deleted file mode 100644 index 6823964b810ea..0000000000000 --- a/recipes/drogon/all/patches/1.7.5-0002-remove-boost-components.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index f83e119..46a23fd 100755 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -177,7 +177,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.7.5-0003-find-package-trantor.patch b/recipes/drogon/all/patches/1.7.5-0003-find-package-trantor.patch deleted file mode 100644 index d2e449648defd..0000000000000 --- a/recipes/drogon/all/patches/1.7.5-0003-find-package-trantor.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 46a23fd..d2e2f69 100755 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -118,7 +118,8 @@ if (WIN32) - PRIVATE $) - endif (WIN32) - --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) 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 deleted file mode 100644 index dc4849690a251..0000000000000 --- a/recipes/drogon/all/patches/1.7.5-0004-find-package-jsoncpp.patch +++ /dev/null @@ -1,17 +0,0 @@ -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 deleted file mode 100644 index 3038da266a3a2..0000000000000 --- a/recipes/drogon/all/patches/1.8.0-0001-disable-unused-data.patch +++ /dev/null @@ -1,41 +0,0 @@ -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 deleted file mode 100644 index 2402bc2bfdf71..0000000000000 --- a/recipes/drogon/all/patches/1.8.0-0002-find-package-jsoncpp.patch +++ /dev/null @@ -1,17 +0,0 @@ -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.5-0001-remove-shared-libs.patch b/recipes/drogon/all/patches/1.8.5-0001-remove-shared-libs.patch new file mode 100644 index 0000000000000..9920eee534139 --- /dev/null +++ b/recipes/drogon/all/patches/1.8.5-0001-remove-shared-libs.patch @@ -0,0 +1,12 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index db95642..e3e7fcf 100755 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -8,7 +8,6 @@ option(BUILD_CTL "Build drogon_ctl" ON) + option(BUILD_EXAMPLES "Build examples" ON) + 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) + option(BUILD_YAML_CONFIG "Build yaml config" ON) diff --git a/recipes/drogon/all/patches/1.8.6-0002-find-cci-packages.patch b/recipes/drogon/all/patches/1.8.6-0002-find-cci-packages.patch new file mode 100644 index 0000000000000..3da404b88ccc2 --- /dev/null +++ b/recipes/drogon/all/patches/1.8.6-0002-find-cci-packages.patch @@ -0,0 +1,71 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index a3ba35a..26fed2a 100755 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -198,9 +198,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}) + + # yamlcpp + if(BUILD_YAML_CONFIG) +@@ -212,7 +212,7 @@ if(BUILD_YAML_CONFIG) + message(STATUS "yaml-cpp not used") + else() + message(STATUS "yaml-cpp found ") +- target_link_libraries(${PROJECT_NAME} PUBLIC ${YAML_CPP_LINK_LIBRARY}) ++ target_link_libraries(${PROJECT_NAME} PUBLIC yaml-cpp) + target_compile_definitions(${PROJECT_NAME} PUBLIC HAS_YAML_CPP) + endif() + else() +@@ -444,7 +444,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) +@@ -467,10 +467,10 @@ if (BUILD_SQLITE) + endif (BUILD_SQLITE) + + if (BUILD_REDIS) +- find_package(Hiredis) +- if (Hiredis_FOUND) ++ find_package(hiredis) ++ if (hiredis_FOUND) + add_definitions(-DUSE_REDIS) +- target_link_libraries(${PROJECT_NAME} PRIVATE Hiredis_lib) ++ target_link_libraries(${PROJECT_NAME} PRIVATE hiredis::hiredis) + set(DROGON_SOURCES + ${DROGON_SOURCES} + nosql_lib/redis/src/RedisClientImpl.cc +@@ -490,10 +490,10 @@ if (BUILD_REDIS) + nosql_lib/redis/src/SubscribeContext.h + nosql_lib/redis/src/RedisSubscriberImpl.h) + +- endif (Hiredis_FOUND) ++ endif () + endif (BUILD_REDIS) + +-if (NOT Hiredis_FOUND) ++if (NOT hiredis_FOUND) + set(DROGON_SOURCES + ${DROGON_SOURCES} + lib/src/RedisClientSkipped.cc +@@ -502,7 +502,7 @@ if (NOT Hiredis_FOUND) + set(private_headers + ${private_headers} + lib/src/RedisClientManager.h) +-endif (NOT Hiredis_FOUND) ++endif () + + if (BUILD_TESTING) + add_subdirectory(nosql_lib/redis/tests) diff --git a/recipes/drogon/all/patches/1.9.0-0002-find-cci-packages.patch b/recipes/drogon/all/patches/1.9.0-0002-find-cci-packages.patch new file mode 100644 index 0000000000000..cf206b982069b --- /dev/null +++ b/recipes/drogon/all/patches/1.9.0-0002-find-cci-packages.patch @@ -0,0 +1,72 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 5799759..1db8ed3 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -164,9 +164,10 @@ 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}) ++ + + # yamlcpp + if(BUILD_YAML_CONFIG) +@@ -178,7 +179,7 @@ if(BUILD_YAML_CONFIG) + message(STATUS "yaml-cpp not used") + else() + message(STATUS "yaml-cpp found ") +- target_link_libraries(${PROJECT_NAME} PUBLIC ${YAML_CPP_LINK_LIBRARY}) ++ target_link_libraries(${PROJECT_NAME} PUBLIC yaml-cpp) + target_compile_definitions(${PROJECT_NAME} PUBLIC HAS_YAML_CPP) + endif() + else() +@@ -412,7 +413,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) +@@ -435,10 +436,10 @@ if (BUILD_SQLITE) + endif (BUILD_SQLITE) + + if (BUILD_REDIS) +- find_package(Hiredis) +- if (Hiredis_FOUND) ++ find_package(hiredis) ++ if (hiredis_FOUND) + add_definitions(-DUSE_REDIS) +- target_link_libraries(${PROJECT_NAME} PRIVATE Hiredis_lib) ++ target_link_libraries(${PROJECT_NAME} PRIVATE hiredis::hiredis) + set(DROGON_SOURCES + ${DROGON_SOURCES} + nosql_lib/redis/src/RedisClientImpl.cc +@@ -458,10 +459,10 @@ if (BUILD_REDIS) + nosql_lib/redis/src/SubscribeContext.h + nosql_lib/redis/src/RedisSubscriberImpl.h) + +- endif (Hiredis_FOUND) ++ endif () + endif (BUILD_REDIS) + +-if (NOT Hiredis_FOUND) ++if (NOT hiredis_FOUND) + set(DROGON_SOURCES + ${DROGON_SOURCES} + lib/src/RedisClientSkipped.cc +@@ -470,7 +471,7 @@ if (NOT Hiredis_FOUND) + set(private_headers + ${private_headers} + lib/src/RedisClientManager.h) +-endif (NOT Hiredis_FOUND) ++endif () + + if (BUILD_TESTING) + add_subdirectory(nosql_lib/redis/tests) diff --git a/recipes/drogon/all/patches/1.9.2-0002-find-cci-packages.patch b/recipes/drogon/all/patches/1.9.2-0002-find-cci-packages.patch new file mode 100644 index 0000000000000..bcc9b35c8ecff --- /dev/null +++ b/recipes/drogon/all/patches/1.9.2-0002-find-cci-packages.patch @@ -0,0 +1,71 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 8fbe8f9..68043fb 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -180,9 +180,9 @@ 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}) + + # yamlcpp + if(BUILD_YAML_CONFIG) +@@ -194,7 +194,7 @@ if(BUILD_YAML_CONFIG) + message(STATUS "yaml-cpp not used") + else() + message(STATUS "yaml-cpp found ") +- target_link_libraries(${PROJECT_NAME} PUBLIC ${YAML_CPP_LINK_LIBRARY}) ++ target_link_libraries(${PROJECT_NAME} PUBLIC yaml-cpp) + target_compile_definitions(${PROJECT_NAME} PUBLIC HAS_YAML_CPP) + endif() + else() +@@ -429,7 +429,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) +@@ -452,10 +452,10 @@ if (BUILD_SQLITE) + endif (BUILD_SQLITE) + + if (BUILD_REDIS) +- find_package(Hiredis) +- if (Hiredis_FOUND) ++ find_package(hiredis) ++ if (hiredis_FOUND) + add_definitions(-DUSE_REDIS) +- target_link_libraries(${PROJECT_NAME} PRIVATE Hiredis_lib) ++ target_link_libraries(${PROJECT_NAME} PRIVATE hiredis::hiredis) + set(DROGON_SOURCES + ${DROGON_SOURCES} + nosql_lib/redis/src/RedisClientImpl.cc +@@ -475,10 +475,10 @@ if (BUILD_REDIS) + nosql_lib/redis/src/SubscribeContext.h + nosql_lib/redis/src/RedisSubscriberImpl.h) + +- endif (Hiredis_FOUND) ++ endif () + endif (BUILD_REDIS) + +-if (NOT Hiredis_FOUND) ++if (NOT hiredis_FOUND) + set(DROGON_SOURCES + ${DROGON_SOURCES} + lib/src/RedisClientSkipped.cc +@@ -487,7 +487,7 @@ if (NOT Hiredis_FOUND) + set(private_headers + ${private_headers} + lib/src/RedisClientManager.h) +-endif (NOT Hiredis_FOUND) ++endif () + + if (BUILD_TESTING) + add_subdirectory(nosql_lib/redis/tests) diff --git a/recipes/drogon/all/patches/1.9.6-0002-find-cci-packages.patch b/recipes/drogon/all/patches/1.9.6-0002-find-cci-packages.patch new file mode 100644 index 0000000000000..1e82fc39d8876 --- /dev/null +++ b/recipes/drogon/all/patches/1.9.6-0002-find-cci-packages.patch @@ -0,0 +1,71 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 11c96b2..441b2c2 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -180,9 +180,9 @@ 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}) + + # yamlcpp + if(BUILD_YAML_CONFIG) +@@ -194,7 +194,7 @@ if(BUILD_YAML_CONFIG) + message(STATUS "yaml-cpp not used") + else() + message(STATUS "yaml-cpp found ") +- target_link_libraries(${PROJECT_NAME} PUBLIC ${YAML_CPP_LINK_LIBRARY}) ++ target_link_libraries(${PROJECT_NAME} PUBLIC yaml-cpp) + target_compile_definitions(${PROJECT_NAME} PUBLIC HAS_YAML_CPP) + endif() + else() +@@ -432,7 +432,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) +@@ -455,10 +455,10 @@ if (BUILD_SQLITE) + endif (BUILD_SQLITE) + + if (BUILD_REDIS) +- find_package(Hiredis) +- if (Hiredis_FOUND) ++ find_package(hiredis) ++ if (hiredis_FOUND) + add_definitions(-DUSE_REDIS) +- target_link_libraries(${PROJECT_NAME} PRIVATE Hiredis_lib) ++ target_link_libraries(${PROJECT_NAME} PRIVATE hiredis::hiredis) + set(DROGON_SOURCES + ${DROGON_SOURCES} + nosql_lib/redis/src/RedisClientImpl.cc +@@ -478,10 +478,10 @@ if (BUILD_REDIS) + nosql_lib/redis/src/SubscribeContext.h + nosql_lib/redis/src/RedisSubscriberImpl.h) + +- endif (Hiredis_FOUND) ++ endif () + endif (BUILD_REDIS) + +-if (NOT Hiredis_FOUND) ++if (NOT hiredis_FOUND) + set(DROGON_SOURCES + ${DROGON_SOURCES} + lib/src/RedisClientSkipped.cc +@@ -490,7 +490,7 @@ if (NOT Hiredis_FOUND) + set(private_headers + ${private_headers} + lib/src/RedisClientManager.h) +-endif (NOT Hiredis_FOUND) ++endif () + + if (BUILD_TESTING) + add_subdirectory(nosql_lib/redis/tests) diff --git a/recipes/drogon/all/patches/1.9.7-0002-find-cci-packages.patch b/recipes/drogon/all/patches/1.9.7-0002-find-cci-packages.patch new file mode 100644 index 0000000000000..10aaaaa8d1cad --- /dev/null +++ b/recipes/drogon/all/patches/1.9.7-0002-find-cci-packages.patch @@ -0,0 +1,71 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 91b9b9b..9a2773f 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -185,9 +185,9 @@ 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}) + + # yamlcpp + if(BUILD_YAML_CONFIG) +@@ -199,7 +199,7 @@ if(BUILD_YAML_CONFIG) + message(STATUS "yaml-cpp not used") + else() + message(STATUS "yaml-cpp found ") +- target_link_libraries(${PROJECT_NAME} PUBLIC ${YAML_CPP_LINK_LIBRARY}) ++ target_link_libraries(${PROJECT_NAME} PUBLIC yaml-cpp) + target_compile_definitions(${PROJECT_NAME} PUBLIC HAS_YAML_CPP) + endif() + else() +@@ -437,7 +437,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) +@@ -460,10 +460,10 @@ if (BUILD_SQLITE) + endif (BUILD_SQLITE) + + if (BUILD_REDIS) +- find_package(Hiredis) +- if (Hiredis_FOUND) ++ find_package(hiredis) ++ if (hiredis_FOUND) + add_definitions(-DUSE_REDIS) +- target_link_libraries(${PROJECT_NAME} PRIVATE Hiredis_lib) ++ target_link_libraries(${PROJECT_NAME} PRIVATE hiredis::hiredis) + set(DROGON_SOURCES + ${DROGON_SOURCES} + nosql_lib/redis/src/RedisClientImpl.cc +@@ -483,10 +483,10 @@ if (BUILD_REDIS) + nosql_lib/redis/src/SubscribeContext.h + nosql_lib/redis/src/RedisSubscriberImpl.h) + +- endif (Hiredis_FOUND) ++ endif () + endif (BUILD_REDIS) + +-if (NOT Hiredis_FOUND) ++if (NOT hiredis_FOUND) + set(DROGON_SOURCES + ${DROGON_SOURCES} + lib/src/RedisClientSkipped.cc +@@ -495,7 +495,7 @@ if (NOT Hiredis_FOUND) + set(private_headers + ${private_headers} + lib/src/RedisClientManager.h) +-endif (NOT Hiredis_FOUND) ++endif () + + if (BUILD_TESTING) + add_subdirectory(nosql_lib/redis/tests) diff --git a/recipes/drogon/all/patches/1.9.7-0003-include-exception.patch b/recipes/drogon/all/patches/1.9.7-0003-include-exception.patch new file mode 100644 index 0000000000000..8c99b4baf0dcc --- /dev/null +++ b/recipes/drogon/all/patches/1.9.7-0003-include-exception.patch @@ -0,0 +1,13 @@ +diff --git a/lib/inc/drogon/RequestStream.h b/lib/inc/drogon/RequestStream.h +index 852f075..b72e39e 100644 +--- a/lib/inc/drogon/RequestStream.h ++++ b/lib/inc/drogon/RequestStream.h +@@ -16,7 +16,7 @@ + #include + #include + #include +- ++#include + namespace drogon + { + class HttpRequest; diff --git a/recipes/drogon/all/test_package/CMakeLists.txt b/recipes/drogon/all/test_package/CMakeLists.txt index 196b33faabaf7..cf16e9b501eaa 100644 --- a/recipes/drogon/all/test_package/CMakeLists.txt +++ b/recipes/drogon/all/test_package/CMakeLists.txt @@ -8,7 +8,7 @@ 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 84eaa369e4a72..99d0db4a34c2c 100644 --- a/recipes/drogon/all/test_package/conanfile.py +++ b/recipes/drogon/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/drogon/config.yml b/recipes/drogon/config.yml index 53e81010b34fe..09b2c8efe8045 100644 --- a/recipes/drogon/config.yml +++ b/recipes/drogon/config.yml @@ -1,7 +1,21 @@ versions: - "1.8.2": + "1.9.8": folder: "all" - "1.8.0": + "1.9.7": folder: "all" - "1.7.5": + "1.9.6": + folder: "all" + "1.9.5": + folder: "all" + "1.9.4": + folder: "all" + "1.9.3": + folder: "all" + "1.9.2": + folder: "all" + "1.9.1": + folder: "all" + "1.9.0": + folder: "all" + "1.8.7": folder: "all" diff --git a/recipes/drwav/all/conandata.yml b/recipes/drwav/all/conandata.yml index 449e35d180bee..7757121179bae 100644 --- a/recipes/drwav/all/conandata.yml +++ b/recipes/drwav/all/conandata.yml @@ -1,9 +1,14 @@ sources: - # NOTE: https://github.com/mackron/dr_libs/blob/4f6da71ed357ade92dc91f00e6be7301ec9a82a3/dr_wav.h#L3 + # NOTE: https://github.com/mackron/dr_libs/blob/d35a3bc5efd02455d98cbe12b94647136f09b42d/dr_wav.h#L3 + "0.13.14": + url: "https://github.com/mackron/dr_libs/archive/a4b73d3d423e1cea0652b76d0806e7620337a40f.zip" + sha256: "89729a85f092a81eb6e646c1580525c7738c4780bc59890c908b9582e8e9312b" + "0.13.12": + url: "https://github.com/mackron/dr_libs/archive/d35a3bc5efd02455d98cbe12b94647136f09b42d.zip" + sha256: "4886462b8ed26f12b8bceccb80f1447075ed5e73240089f2a78e0c32b444b370" "0.13.7": - url: https://github.com/mackron/dr_libs/archive/4f6da71ed357ade92dc91f00e6be7301ec9a82a3.zip + 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 + url: "https://github.com/mackron/dr_libs/archive/15f37e3ab01654c1a3bc98cff2a9ca64e8296fa9.zip" sha256: "39ea8c1f9b60a945735dfe4a2e0a2a6bd3bc921619fa7d2612dbc284b68c2419" diff --git a/recipes/drwav/all/conanfile.py b/recipes/drwav/all/conanfile.py index 634d49129395e..29de2c8e01806 100644 --- a/recipes/drwav/all/conanfile.py +++ b/recipes/drwav/all/conanfile.py @@ -3,30 +3,31 @@ from conan.tools.files import copy, get import os -required_conan_version = ">=1.46.0" +required_conan_version = ">=1.53.0" class DrwavConan(ConanFile): name = "drwav" description = "WAV audio loader and writer." - homepage = "https://mackron.github.io/dr_wav" + homepage = "https://github.com/mackron/dr_libs" topics = ("audio", "wav", "wave", "sound") license = ("Unlicense", "MIT-0") url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { - "shared": [True, False], + "shared": [True, False], "fPIC": [True, False], "no_conversion_api": [True, False], "no_stdio": [True, False], - "no_wchar": [True, False] + "no_wchar": [True, False], } default_options = { - "shared": False, + "shared": False, "fPIC": True, "no_conversion_api": False, "no_stdio": False, - "no_wchar": False + "no_wchar": False, } exports_sources = ["CMakeLists.txt", "dr_wav.c"] @@ -36,15 +37,15 @@ 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) + 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) @@ -56,7 +57,7 @@ def generate(self): def build(self): cmake = CMake(self) - cmake.configure() + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() def package(self): @@ -73,4 +74,4 @@ def package_info(self): 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") + 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 8eb51f5f1843e..6e57f5fb28026 100644 --- a/recipes/drwav/all/test_package/CMakeLists.txt +++ b/recipes/drwav/all/test_package/CMakeLists.txt @@ -1,8 +1,8 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.8) project(test_package LANGUAGES C) find_package(drwav CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} drwav::drwav) -set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD 99) +target_link_libraries(${PROJECT_NAME} PRIVATE drwav::drwav) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) diff --git a/recipes/drwav/all/test_package/conanfile.py b/recipes/drwav/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/drwav/all/test_package/conanfile.py +++ b/recipes/drwav/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/drwav/all/test_v1_package/CMakeLists.txt b/recipes/drwav/all/test_v1_package/CMakeLists.txt index b7b4d6635b758..0d20897301b68 100644 --- a/recipes/drwav/all/test_v1_package/CMakeLists.txt +++ b/recipes/drwav/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(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) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/drwav/config.yml b/recipes/drwav/config.yml index 6c8f065f79d49..35331ff9db236 100644 --- a/recipes/drwav/config.yml +++ b/recipes/drwav/config.yml @@ -1,4 +1,8 @@ versions: + "0.13.14": + folder: all + "0.13.12": + folder: all "0.13.7": folder: all "0.13.6": diff --git a/recipes/dsp-filters/all/conandata.yml b/recipes/dsp-filters/all/conandata.yml new file mode 100644 index 0000000000000..17f324a8e1446 --- /dev/null +++ b/recipes/dsp-filters/all/conandata.yml @@ -0,0 +1,12 @@ +sources: + "cci.20170309": + url: "https://github.com/vinniefalco/DSPFilters/archive/acc49170e79a94fcb9c04b8a2116e9f8dffd1c7d.tar.gz" + sha256: "330c3960e55b8cdbf041d8ec4790a21a326dc331e43bf14c144ae5d88a47d53d" +patches: + "cci.20170309": + - patch_file: "patches/0001-remove-explicit-cmake-options.patch" + patch_description: "Remove explicit STATIC and FPIC options in CMakeLists.txt" + patch_type: "conan" + - patch_file: "patches/0002-remove-msvc-cmake-flags.patch" + patch_description: "Remove MY_FLAGS options in CMakeLists.txt" + patch_type: "conan" diff --git a/recipes/dsp-filters/all/conanfile.py b/recipes/dsp-filters/all/conanfile.py new file mode 100644 index 0000000000000..d4ef17870d051 --- /dev/null +++ b/recipes/dsp-filters/all/conanfile.py @@ -0,0 +1,74 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout +from conan.tools.files import copy, get, apply_conandata_patches, export_conandata_patches, rename +from conan.tools.microsoft import is_msvc +import os + +required_conan_version = ">=1.53.0" + +class DSPFiltersConan(ConanFile): + name = "dsp-filters" + description = "Set of DSP filters" + topics = ("dsp", "filters") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/vinniefalco/DSPFilters" + license = "MIT" + settings = "os", "arch", "compiler", "build_type" + package_type = "library" + + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + def validate(self): + # in case it does not work in another configuration, it should validated here too + 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 export_sources(self): + export_conandata_patches(self) + + 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 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(build_script_folder=os.path.join(self.source_folder, "shared")) + cmake.build() + + def package(self): + copy(self, "lib*", src=os.path.join(self.build_folder, "DSPFilters"), dst=os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, "DSPFilters.lib", src=os.path.join(self.build_folder, "DSPFilters", f"{self.settings.build_type}"), dst=os.path.join(self.package_folder, "lib"), keep_path=False) + + copy(self, "*.h", src=os.path.join(self.source_folder, "shared", "DSPFilters", "include"), dst=os.path.join(self.package_folder, "include")) + copy(self, "README.md", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + rename(self, src=os.path.join(self.package_folder, "licenses", "README.md"), dst=os.path.join(self.package_folder, "licenses", "license")) + + def package_info(self): + self.cpp_info.libs = ["DSPFilters"] + + if self.settings.os in ["Linux", "FreeBSD", "Neutrino"]: + self.cpp_info.system_libs.extend(["m"]) diff --git a/recipes/dsp-filters/all/patches/0001-remove-explicit-cmake-options.patch b/recipes/dsp-filters/all/patches/0001-remove-explicit-cmake-options.patch new file mode 100644 index 0000000000000..cece818ce0db2 --- /dev/null +++ b/recipes/dsp-filters/all/patches/0001-remove-explicit-cmake-options.patch @@ -0,0 +1,14 @@ +--- shared/DSPFilters/CMakeLists.txt 2017-03-09 13:40:27.000000000 +0100 ++++ shared/DSPFilters/CMakeLists.txt 2023-08-03 09:10:56.248123716 +0200 +@@ -4,10 +4,8 @@ + + aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/source SOURCE_LIB) + +-add_library(${PROJECT_NAME} STATIC ${SOURCE_LIB}) ++add_library(${PROJECT_NAME} ${SOURCE_LIB}) + + target_include_directories(${PROJECT_NAME} + PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) + +-set_property(TARGET ${PROJECT_NAME} PROPERTY POSITION_INDEPENDENT_CODE ON) +- diff --git a/recipes/dsp-filters/all/patches/0002-remove-msvc-cmake-flags.patch b/recipes/dsp-filters/all/patches/0002-remove-msvc-cmake-flags.patch new file mode 100644 index 0000000000000..e16d647a99e9c --- /dev/null +++ b/recipes/dsp-filters/all/patches/0002-remove-msvc-cmake-flags.patch @@ -0,0 +1,14 @@ +--- shared/CMakeLists.txt 2023-08-28 13:14:13.868202500 +0200 ++++ shared/CMakeLists.txt 2023-08-28 13:14:42.827596800 +0200 +@@ -8,11 +8,6 @@ + set(CMAKE_BUILD_TYPE Release) + + if((${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC)) +- set(MYFLAGS "/O2 /WX- /MT") +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MYFLAGS}") +- set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${MYFLAGS}") +- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MYFLAGS}") +- set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${MYFLAGS}") + include(CheckSymbolExists) + check_symbol_exists(snprintf "stdio.h" HAVE_SNPRINTF) + if(NOT HAVE_SNPRINTF) diff --git a/recipes/dsp-filters/all/test_package/CMakeLists.txt b/recipes/dsp-filters/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..f823007a47a74 --- /dev/null +++ b/recipes/dsp-filters/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.14.0) +project(test_package LANGUAGES CXX) + +find_package(dsp-filters REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE dsp-filters::dsp-filters) diff --git a/recipes/dsp-filters/all/test_package/conanfile.py b/recipes/dsp-filters/all/test_package/conanfile.py new file mode 100644 index 0000000000000..922d35b61f37a --- /dev/null +++ b/recipes/dsp-filters/all/test_package/conanfile.py @@ -0,0 +1,29 @@ +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 not can_run(self): + return + + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/dsp-filters/all/test_package/test_package.cpp b/recipes/dsp-filters/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..10690f2821e16 --- /dev/null +++ b/recipes/dsp-filters/all/test_package/test_package.cpp @@ -0,0 +1,11 @@ +#include + +#include + +int main() { + Dsp::SimpleFilter, 1> f; + f.setup(1, 100, 1000); + f.reset(); + + return 0; +} diff --git a/recipes/dsp-filters/config.yml b/recipes/dsp-filters/config.yml new file mode 100644 index 0000000000000..d7e185cf9c964 --- /dev/null +++ b/recipes/dsp-filters/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20170309": + folder: all diff --git a/recipes/dtl/all/conandata.yml b/recipes/dtl/all/conandata.yml index 7ae1dc4743d98..b14780dd20c90 100644 --- a/recipes/dtl/all/conandata.yml +++ b/recipes/dtl/all/conandata.yml @@ -1,10 +1,10 @@ sources: + "1.21": + url: "https://github.com/cubicdaiya/dtl/archive/v1.21.tar.gz" + sha256: "90ed2dbf4e6d687737fe25f118bbcb6aed778cecc3f2115d191a032bf8643dbd" "1.20": url: "https://github.com/cubicdaiya/dtl/archive/v1.20.tar.gz" sha256: "579f81bca88f4b9760a59d99c5a95bd8dd5dc2f20f33f1f9b5f64cb08979f54d" "1.19": url: "https://github.com/cubicdaiya/dtl/archive/v1.19.tar.gz" sha256: "f47b99dd11e5d771ad32a8dc960db4ab2fbe349fb0346fa0795f53c846a99c5d" - "cci.20210404": - url: "https://github.com/cubicdaiya/dtl/archive/0551c22f5ee3d30dbc4b0700bde5acdb6f1a9348.tar.gz" - sha256: "59c2e770454c935200179aa4457f72741aec2319072862950b2490d0758d4e43" diff --git a/recipes/dtl/all/conanfile.py b/recipes/dtl/all/conanfile.py index 6d45ac4104004..bc5ebc68cd927 100644 --- a/recipes/dtl/all/conanfile.py +++ b/recipes/dtl/all/conanfile.py @@ -1,28 +1,43 @@ -from conans import ConanFile, tools import os -required_conan_version = ">=1.33.0" +from conan import ConanFile +from conan.tools.files import copy, get, replace_in_file +from conan.tools.layout import basic_layout +from conan.tools.scm import Version + +required_conan_version = ">=1.52.0" + class DtlConan(ConanFile): name = "dtl" description = "diff template library written by C++" - topics = ("diff", "library", "algorithm") license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/cubicdaiya/dtl" + topics = ("diff", "library", "algorithm", "header-only") + + 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.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], strip_root=True) + if Version(self.version) < "1.21": + # See https://github.com/cubicdaiya/dtl/pull/18 + replace_in_file(self, os.path.join(self.source_folder, "dtl", "Diff.hpp"), "void enableTrivial () const {", "void enableTrivial () {") def package(self): - self.copy(os.path.join("dtl", "*.hpp"), dst="include", src=self._source_subfolder) - self.copy(pattern="COPYING", dst="licenses", src=self._source_subfolder) + copy(self, "COPYING", + dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, os.path.join("dtl", "*.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/dtl/all/test_package/CMakeLists.txt b/recipes/dtl/all/test_package/CMakeLists.txt index 9710bb88ce36c..f8aa0df23cba2 100644 --- a/recipes/dtl/all/test_package/CMakeLists.txt +++ b/recipes/dtl/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.15) +project(test_package LANGUAGES CXX) find_package(dtl CONFIG REQUIRED) diff --git a/recipes/dtl/all/test_package/conanfile.py b/recipes/dtl/all/test_package/conanfile.py index 49a3a66ea5bad..ef5d7042163ec 100644 --- a/recipes/dtl/all/test_package/conanfile.py +++ b/recipes/dtl/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/dtl/all/test_v1_package/CMakeLists.txt b/recipes/dtl/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/dtl/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/dtl/all/test_v1_package/conanfile.py b/recipes/dtl/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..49a3a66ea5bad --- /dev/null +++ b/recipes/dtl/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/dtl/config.yml b/recipes/dtl/config.yml index 66e68aaaf6fad..c7b2d5892fa8b 100644 --- a/recipes/dtl/config.yml +++ b/recipes/dtl/config.yml @@ -1,7 +1,7 @@ versions: + "1.21": + folder: "all" "1.20": folder: "all" "1.19": folder: "all" - "cci.20210404": - folder: "all" diff --git a/recipes/duckdb/all/conandata.yml b/recipes/duckdb/all/conandata.yml index 3126108b09688..459430601e0ca 100644 --- a/recipes/duckdb/all/conandata.yml +++ b/recipes/duckdb/all/conandata.yml @@ -1,30 +1,86 @@ 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" - + "1.1.3": + url: "https://github.com/duckdb/duckdb/archive/refs/tags/v1.1.2.tar.gz" + sha256: "a3319a64c390ed0454c869b2e4fc0af2413cd49f55cd0f1400aaed9069cdbc4c" + "1.1.2": + url: "https://github.com/duckdb/duckdb/archive/refs/tags/v1.1.2.tar.gz" + sha256: "a3319a64c390ed0454c869b2e4fc0af2413cd49f55cd0f1400aaed9069cdbc4c" + "1.1.1": + url: "https://github.com/duckdb/duckdb/archive/refs/tags/v1.1.1.tar.gz" + sha256: "a764cef80287ccfd8555884d8facbe962154e7c747043c0842cd07873b4d6752" + "1.1.0": + url: "https://github.com/duckdb/duckdb/archive/refs/tags/v1.1.0.tar.gz" + sha256: "d9be2c6d3a5ebe2b3d33044fb2cb535bb0bd972a27ae38c4de5e1b4caa4bf68d" + "1.0.0": + url: "https://github.com/duckdb/duckdb/archive/refs/tags/v1.0.0.tar.gz" + sha256: "04e472e646f5cadd0a3f877a143610674b0d2bcf9f4102203ac3c3d02f1c5f26" + "0.10.2": + url: "https://github.com/duckdb/duckdb/archive/refs/tags/v0.10.2.tar.gz" + sha256: "662a0ba5c35d678ab6870db8f65ffa1c72e6096ad525a35b41b275139684cea6" + "0.10.1": + url: "https://github.com/duckdb/duckdb/archive/refs/tags/v0.10.1.tar.gz" + sha256: "83bd4944c070fd0bd287fbe62919fa887f35d7422ba0fa66e13d4ed098f3791a" + "0.9.2": + url: "https://github.com/duckdb/duckdb/archive/refs/tags/v0.9.2.tar.gz" + sha256: "afff7bd925a98dc2af4039b8ab2159b0705cbf5e0ee05d97f7bb8dce5f880dc2" + "0.9.0": + url: "https://github.com/duckdb/duckdb/archive/refs/tags/v0.9.0.tar.gz" + sha256: "3dbf3326a831bf0797591572440e81a3d6d668f8e33a25ce04efae19afc3a23d" patches: - "0.6.1": - - patch_file: "patches/0.6.0-0001-fix-cmake.patch" + "1.1.3": + - patch_file: "patches/1.1.1-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_file: "patches/1.1.1-0002-msvc-bicobj.patch" + patch_description: "add /bigobj flag" patch_type: "portability" - "0.6.0": - - patch_file: "patches/0.6.0-0001-fix-cmake.patch" + "1.1.2": + - patch_file: "patches/1.1.1-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_file: "patches/1.1.1-0002-msvc-bicobj.patch" + patch_description: "add /bigobj flag" patch_type: "portability" - "0.5.1": - - patch_file: "patches/0.5.1-0001-fix-cmake.patch" + "1.1.1": + - patch_file: "patches/1.1.1-0001-fix-cmake.patch" + patch_description: "install static of shared library, add installation for odbc extention" + patch_type: "portability" + - patch_file: "patches/1.1.1-0002-msvc-bicobj.patch" + patch_description: "add /bigobj flag" + patch_type: "portability" + "1.1.0": + - patch_file: "patches/1.1.0-0001-fix-cmake.patch" + patch_description: "install static of shared library, add installation for odbc extention" + patch_type: "portability" + - patch_file: "patches/1.1.0-0002-msvc-bicobj.patch" + patch_description: "add /bigobj flag" + patch_type: "portability" + "1.0.0": + - patch_file: "patches/1.0.0-0001-fix-cmake.patch" + patch_description: "install static of shared library, add installation for odbc extention" + patch_type: "portability" + - patch_file: "patches/1.0.0-0002-msvc-bicobj.patch" + patch_description: "add /bigobj flag" + patch_type: "portability" + "0.10.2": + - patch_file: "patches/0.10.2-0001-fix-cmake.patch" + patch_description: "install static of shared library, add installation for odbc extention" + patch_type: "portability" + - patch_file: "patches/0.10.1-0002-msvc-bicobj.patch" + patch_description: "add /bigobj flag" + patch_type: "portability" + "0.10.1": + - patch_file: "patches/0.10.1-0001-fix-cmake.patch" + patch_description: "install static of shared library, add installation for odbc extention" + patch_type: "portability" + - patch_file: "patches/0.10.1-0002-msvc-bicobj.patch" + patch_description: "add /bigobj flag" + patch_type: "portability" + "0.9.2": + - patch_file: "patches/0.9.2-0001-fix-cmake.patch" + patch_description: "install static of shared library, add installation for odbc extention" + patch_type: "portability" + "0.9.0": + - patch_file: "patches/0.9.0-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 index 994004c113240..cce9c23deb6ff 100644 --- a/recipes/duckdb/all/conanfile.py +++ b/recipes/duckdb/all/conanfile.py @@ -1,10 +1,12 @@ 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.build import check_min_cppstd, cross_building from conan.tools.scm import Version from conan.tools.microsoft import is_msvc from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +import glob import os required_conan_version = ">=1.53.0" @@ -16,19 +18,21 @@ class DuckdbConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/cwida/duckdb" topics = ("sql", "database", "olap", "embedded-database") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], + "with_autocomplete": [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_httpfs": [True, False], "with_json": [True, False], "with_excel": [True, False], + "with_inet": [True, False], "with_sqlsmith": [True, False], "with_odbc": [True, False], "with_query_log": [True, False], @@ -39,15 +43,16 @@ class DuckdbConan(ConanFile): default_options = { "shared": False, "fPIC": True, + "with_autocomplete": False, "with_icu": False, - "with_parquet": False, "with_tpch": False, "with_tpcds": False, "with_fts": False, - "with_httpfs": False, "with_visualizer": False, + "with_httpfs": False, "with_json": False, "with_excel": False, + "with_inet": False, "with_sqlsmith": False, "with_odbc": False, "with_query_log": False, @@ -58,7 +63,7 @@ class DuckdbConan(ConanFile): short_paths = True @property - def _minimum_cpp_standard(self): + def _min_cppstd(self): return 11 def export_sources(self): @@ -67,6 +72,8 @@ def export_sources(self): def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + if Version(self.version) >= "1.1.0": + del self.options.with_odbc def configure(self): if self.options.shared: @@ -76,15 +83,19 @@ 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: + # FIXME: duckdb vendors a bunch of deps by modify the source code to have their own namespace + if self.options.get_safe("with_odbc"): self.requires("odbc/2.3.11") if self.options.with_httpfs: - self.requires("openssl/3.0.7") + self.requires("openssl/[>=1.1 <4]") def validate(self): - if self.info.settings.compiler.cppstd: - check_min_cppstd(self, self._minimum_cpp_standard) + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + # FIXME: drop support MSVC debug shared build + if Version(self.version) >= "0.9.2" and \ + is_msvc(self) and self.options.shared and self.settings.build_type == "Debug": + raise ConanInvalidConfiguration(f"{self.ref} does not support MSVC debug shared build") def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) @@ -95,17 +106,35 @@ def generate(self): 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["OVERRIDE_GIT_DESCRIBE"] = f"v{self.version}" + + build_extensions = "" + if self.options.with_icu: + build_extensions += ";icu" + if self.options.with_autocomplete: + build_extensions += ";autocomplete" + if self.options.with_tpch: + build_extensions += ";tpch" + if self.options.with_tpcds: + build_extensions += ";tpcds" + if self.options.with_fts: + build_extensions += ";fts" + if self.options.with_visualizer: + build_extensions += ";visualizer" + if self.options.with_httpfs: + build_extensions += ";httpfs" + if self.options.with_json: + build_extensions += ";json" + if self.options.with_excel: + build_extensions += ";excel" + if self.options.with_inet: + build_extensions += ";inet" + if self.options.with_sqlsmith: + build_extensions += ";sqlsmith" + tc.variables["BUILD_EXTENSIONS"] = build_extensions + + if "with_odbc" in self.options: + 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 @@ -116,6 +145,8 @@ def generate(self): tc.variables["ENABLE_UBSAN"] = False if is_msvc(self) and not self.options.shared: tc.preprocessor_definitions["DUCKDB_API"] = "" + if Version(self.version) >= "0.10.0" and cross_building(self): + tc.variables["DUCKDB_EXPLICIT_PLATFORM"] = f"{self.settings.os}_{self.settings.arch}" tc.generate() dpes = CMakeDeps(self) @@ -125,13 +156,13 @@ 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" - ) + "#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" - ) + "#define DUCKDB_API __declspec(dllimport)", + "#define DUCKDB_API" + ) cmake = CMake(self) cmake.configure() @@ -143,8 +174,10 @@ def package(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")) + for lib in glob.glob(os.path.join(self.package_folder, "lib", "*.a")): + if not lib.endswith(".dll.a"): + os.remove(lib) rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) rmdir(self, os.path.join(self.package_folder, "cmake")) @@ -164,12 +197,17 @@ def package_info(self): "duckdb_fastpforlib", "duckdb_mbedtls", ] - if Version(self.version) >= "0.6.0": - self.cpp_info.libs.append("duckdb_fsst") - + self.cpp_info.libs.append("duckdb_fsst") + if Version(self.version) >= "0.10.0": + self.cpp_info.libs.append("duckdb_skiplistlib") + if Version(self.version) >= "0.10.3": + self.cpp_info.libs.append("duckdb_yyjson") + + if self.options.with_autocomplete: + self.cpp_info.libs.append("autocomplete_extension") if self.options.with_icu: self.cpp_info.libs.append("icu_extension") - if self.options.with_parquet: + if self.options.get_safe("with_parquet", True): self.cpp_info.libs.append("parquet_extension") if self.options.with_tpch: self.cpp_info.libs.append("tpch_extension") @@ -177,26 +215,30 @@ def package_info(self): 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": + if self.options.with_httpfs: + self.cpp_info.libs.append("httpfs_extension") + if (self.settings.os == "Linux" and + (Version(self.version) < "0.10.1" or self.settings.arch == "x86_64")): 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_inet: + self.cpp_info.libs.append("inet_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") + self.cpp_info.system_libs.extend(["pthread", "dl", "m"]) if self.settings.os == "Windows": self.cpp_info.system_libs.append("ws2_32") + if Version(self.version) >= "0.10.0": + self.cpp_info.system_libs.extend(["rstrtmgr", "bcrypt"]) + if self.options.with_shell: binpath = os.path.join(self.package_folder, "bin") diff --git a/recipes/duckdb/all/patches/0.10.1-0001-fix-cmake.patch b/recipes/duckdb/all/patches/0.10.1-0001-fix-cmake.patch new file mode 100644 index 0000000000000..7843bec6ccf0e --- /dev/null +++ b/recipes/duckdb/all/patches/0.10.1-0001-fix-cmake.patch @@ -0,0 +1,118 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index aebc060..4698e32 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -836,7 +836,7 @@ function(build_static_extension NAME PARAMETERS) + set(FILES ${ARGV}) + list(REMOVE_AT FILES 0) + add_library(${NAME}_extension STATIC ${FILES}) +- target_link_libraries(${NAME}_extension duckdb_static) ++# target_link_libraries(${NAME}_extension duckdb_static) + endfunction() + + # Internal extension register function +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index d45ae7f..c13ca96 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -92,21 +92,21 @@ else() + duckdb_fastpforlib + duckdb_skiplistlib + duckdb_mbedtls) +- ++ if(BUILD_SHARED_LIBS) + add_library(duckdb SHARED ${ALL_OBJECT_FILES}) + target_link_libraries(duckdb ${DUCKDB_LINK_LIBS}) + link_threads(duckdb) + link_extension_libraries(duckdb) +- ++ endif() + add_library(duckdb_static STATIC ${ALL_OBJECT_FILES}) + target_link_libraries(duckdb_static ${DUCKDB_LINK_LIBS}) + link_threads(duckdb_static) + link_extension_libraries(duckdb_static) +- ++ if(BUILD_SHARED_LIBS) + target_include_directories( + duckdb PUBLIC $ + $) +- ++ endif() + target_include_directories( + duckdb_static PUBLIC $ + $) +@@ -121,10 +121,18 @@ else() + DESTINATION "${INSTALL_INCLUDE_DIR}") + + endif() +- ++if(BUILD_SHARED_LIBS) + install( +- TARGETS duckdb duckdb_static ++ 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 baf7823..4bef643 100644 +--- a/tools/odbc/CMakeLists.txt ++++ b/tools/odbc/CMakeLists.txt +@@ -38,6 +38,14 @@ add_library(duckdb_odbc SHARED ${ALL_OBJECT_FILES} duckdb_odbc.def) + 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} ++) ++ + if(NOT CLANG_TIDY) + add_subdirectory(test) + endif() +diff --git a/tools/sqlite3_api_wrapper/CMakeLists.txt b/tools/sqlite3_api_wrapper/CMakeLists.txt +index e29c33e..fb926b5 100644 +--- a/tools/sqlite3_api_wrapper/CMakeLists.txt ++++ b/tools/sqlite3_api_wrapper/CMakeLists.txt +@@ -26,20 +26,20 @@ if(NOT AMALGAMATION_BUILD) + endif() + link_threads(sqlite3_api_wrapper_static) + +-if(NOT WIN32 AND NOT ZOS) ++if(BUILD_SHARED_LIBS AND NOT WIN32 AND NOT ZOS) + 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) + endif() + +-include_directories(../../third_party/catch) ++# include_directories(../../third_party/catch) + +-include_directories(test/include) +-add_subdirectory(test) ++# include_directories(test/include) ++# add_subdirectory(test) + +-add_executable(test_sqlite3_api_wrapper ${SQLITE_TEST_FILES}) +-if(WIN32 OR ZOS) +- target_link_libraries(test_sqlite3_api_wrapper sqlite3_api_wrapper_static) +-else() +- target_link_libraries(test_sqlite3_api_wrapper sqlite3_api_wrapper) +-endif() ++# add_executable(test_sqlite3_api_wrapper ${SQLITE_TEST_FILES}) ++# if(WIN32 OR ZOS) ++# target_link_libraries(test_sqlite3_api_wrapper sqlite3_api_wrapper_static) ++# else() ++# target_link_libraries(test_sqlite3_api_wrapper sqlite3_api_wrapper) ++# endif() diff --git a/recipes/duckdb/all/patches/0.10.1-0002-msvc-bicobj.patch b/recipes/duckdb/all/patches/0.10.1-0002-msvc-bicobj.patch new file mode 100644 index 0000000000000..4dd0c46e33839 --- /dev/null +++ b/recipes/duckdb/all/patches/0.10.1-0002-msvc-bicobj.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index aebc060..4a696b6 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -508,7 +508,7 @@ if(NOT MSVC) + endif() + else() + set(CMAKE_CXX_WINDOWS_FLAGS +- "/wd4244 /wd4267 /wd4200 /wd26451 /wd26495 /D_CRT_SECURE_NO_WARNINGS /utf-8") ++ "/wd4244 /wd4267 /wd4200 /wd26451 /wd26495 /D_CRT_SECURE_NO_WARNINGS /utf-8 /bigobj") + if(TREAT_WARNINGS_AS_ERRORS) + set(CMAKE_CXX_WINDOWS_FLAGS "${CMAKE_CXX_WINDOWS_FLAGS} /WX") + endif() diff --git a/recipes/duckdb/all/patches/0.10.2-0001-fix-cmake.patch b/recipes/duckdb/all/patches/0.10.2-0001-fix-cmake.patch new file mode 100644 index 0000000000000..a64da2a33b94d --- /dev/null +++ b/recipes/duckdb/all/patches/0.10.2-0001-fix-cmake.patch @@ -0,0 +1,137 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 5f199d3..64c86c6 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -816,12 +816,12 @@ function(build_loadable_extension_directory NAME OUTPUT_DIRECTORY EXTENSION_VERS + COMMAND emcc $.lib -o $ -sSIDE_MODULE=1 -O3 + ) + endif() +- add_custom_command( +- TARGET ${TARGET_NAME} +- POST_BUILD +- COMMAND +- ${CMAKE_COMMAND} -DEXTENSION=$ -DPLATFORM_FILE=${DuckDB_BINARY_DIR}/duckdb_platform_out -DDUCKDB_VERSION="${DUCKDB_NORMALIZED_VERSION}" -DEXTENSION_VERSION="${EXTENSION_VERSION}" -DNULL_FILE=${CMAKE_CURRENT_FUNCTION_LIST_DIR}/scripts/null.txt -P ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/scripts/append_metadata.cmake +- ) ++ # add_custom_command( ++ # TARGET ${TARGET_NAME} ++ # POST_BUILD ++ # COMMAND ++ # ${CMAKE_COMMAND} -DEXTENSION=$ -DPLATFORM_FILE=${DuckDB_BINARY_DIR}/duckdb_platform_out -DDUCKDB_VERSION="${DUCKDB_NORMALIZED_VERSION}" -DEXTENSION_VERSION="${EXTENSION_VERSION}" -DNULL_FILE=${CMAKE_CURRENT_FUNCTION_LIST_DIR}/scripts/null.txt -P ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/scripts/append_metadata.cmake ++ # ) + add_dependencies(${TARGET_NAME} duckdb_platform) + if (NOT EXTENSION_CONFIG_BUILD AND NOT ${EXTENSION_TESTS_ONLY} AND NOT CLANG_TIDY) + add_dependencies(duckdb_local_extension_repo ${TARGET_NAME}) +@@ -842,7 +842,7 @@ function(build_static_extension NAME PARAMETERS) + set(FILES "${ARGV}") + list(REMOVE_AT FILES 0) + add_library(${NAME}_extension STATIC ${FILES}) +- target_link_libraries(${NAME}_extension duckdb_static) ++# target_link_libraries(${NAME}_extension duckdb_static) + endfunction() + + # Internal extension register function +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index d45ae7f..c13ca96 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -92,21 +92,21 @@ else() + duckdb_fastpforlib + duckdb_skiplistlib + duckdb_mbedtls) +- ++ if(BUILD_SHARED_LIBS) + add_library(duckdb SHARED ${ALL_OBJECT_FILES}) + target_link_libraries(duckdb ${DUCKDB_LINK_LIBS}) + link_threads(duckdb) + link_extension_libraries(duckdb) +- ++ endif() + add_library(duckdb_static STATIC ${ALL_OBJECT_FILES}) + target_link_libraries(duckdb_static ${DUCKDB_LINK_LIBS}) + link_threads(duckdb_static) + link_extension_libraries(duckdb_static) +- ++ if(BUILD_SHARED_LIBS) + target_include_directories( + duckdb PUBLIC $ + $) +- ++ endif() + target_include_directories( + duckdb_static PUBLIC $ + $) +@@ -121,10 +121,18 @@ else() + DESTINATION "${INSTALL_INCLUDE_DIR}") + + endif() +- ++if(BUILD_SHARED_LIBS) + install( +- TARGETS duckdb duckdb_static ++ 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 baf7823..4bef643 100644 +--- a/tools/odbc/CMakeLists.txt ++++ b/tools/odbc/CMakeLists.txt +@@ -38,6 +38,14 @@ add_library(duckdb_odbc SHARED ${ALL_OBJECT_FILES} duckdb_odbc.def) + 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} ++) ++ + if(NOT CLANG_TIDY) + add_subdirectory(test) + endif() +diff --git a/tools/sqlite3_api_wrapper/CMakeLists.txt b/tools/sqlite3_api_wrapper/CMakeLists.txt +index e29c33e..fb926b5 100644 +--- a/tools/sqlite3_api_wrapper/CMakeLists.txt ++++ b/tools/sqlite3_api_wrapper/CMakeLists.txt +@@ -26,20 +26,20 @@ if(NOT AMALGAMATION_BUILD) + endif() + link_threads(sqlite3_api_wrapper_static) + +-if(NOT WIN32 AND NOT ZOS) ++if(BUILD_SHARED_LIBS AND NOT WIN32 AND NOT ZOS) + 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) + endif() + +-include_directories(../../third_party/catch) ++# include_directories(../../third_party/catch) + +-include_directories(test/include) +-add_subdirectory(test) ++# include_directories(test/include) ++# add_subdirectory(test) + +-add_executable(test_sqlite3_api_wrapper ${SQLITE_TEST_FILES}) +-if(WIN32 OR ZOS) +- target_link_libraries(test_sqlite3_api_wrapper sqlite3_api_wrapper_static) +-else() +- target_link_libraries(test_sqlite3_api_wrapper sqlite3_api_wrapper) +-endif() ++# add_executable(test_sqlite3_api_wrapper ${SQLITE_TEST_FILES}) ++# if(WIN32 OR ZOS) ++# target_link_libraries(test_sqlite3_api_wrapper sqlite3_api_wrapper_static) ++# else() ++# target_link_libraries(test_sqlite3_api_wrapper sqlite3_api_wrapper) ++# endif() 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 deleted file mode 100644 index 4c586f0038760..0000000000000 --- a/recipes/duckdb/all/patches/0.5.1-0001-fix-cmake.patch +++ /dev/null @@ -1,82 +0,0 @@ -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 deleted file mode 100644 index d43649a21a753..0000000000000 --- a/recipes/duckdb/all/patches/0.6.0-0001-fix-cmake.patch +++ /dev/null @@ -1,58 +0,0 @@ -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 deleted file mode 100644 index e9e04e59a49cc..0000000000000 --- a/recipes/duckdb/all/patches/0.6.0-0002-include-stdlib.patch +++ /dev/null @@ -1,12 +0,0 @@ -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/patches/0.9.0-0001-fix-cmake.patch b/recipes/duckdb/all/patches/0.9.0-0001-fix-cmake.patch new file mode 100644 index 0000000000000..40ae0d24ebe51 --- /dev/null +++ b/recipes/duckdb/all/patches/0.9.0-0001-fix-cmake.patch @@ -0,0 +1,122 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 2b49e11..1a347ac 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -724,7 +724,7 @@ function(build_static_extension NAME PARAMETERS) + set(FILES ${ARGV}) + list(REMOVE_AT FILES 0) + add_library(${NAME}_extension STATIC ${FILES}) +- target_link_libraries(${NAME}_extension duckdb_static) ++ #target_link_libraries(${NAME}_extension INTERFACE duckdb_static) + endfunction() + + # Internal extension register function +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index cda2d86..4fb3bd3 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -77,24 +77,24 @@ else() + duckdb_fastpforlib + duckdb_mbedtls) + ++ if(BUILD_SHARED_LIBS) + add_library(duckdb SHARED ${ALL_OBJECT_FILES}) + target_link_libraries(duckdb ${DUCKDB_LINK_LIBS}) + link_threads(duckdb) + link_extension_libraries(duckdb) +- ++ endif() + add_library(duckdb_static STATIC ${ALL_OBJECT_FILES}) + target_link_libraries(duckdb_static ${DUCKDB_LINK_LIBS}) + link_threads(duckdb_static) + link_extension_libraries(duckdb_static) +- ++ if(BUILD_SHARED_LIBS) + target_include_directories( + duckdb PUBLIC $ + $) +- ++ endif() + target_include_directories( + duckdb_static PUBLIC $ + $) +- + install( + DIRECTORY "${PROJECT_SOURCE_DIR}/src/include/duckdb" + DESTINATION "${INSTALL_INCLUDE_DIR}" +@@ -105,10 +105,18 @@ else() + DESTINATION "${INSTALL_INCLUDE_DIR}") + + endif() +- ++if(BUILD_SHARED_LIBS) + install( +- TARGETS duckdb duckdb_static ++ 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 ffd0140..1901aa8 100644 +--- a/tools/odbc/CMakeLists.txt ++++ b/tools/odbc/CMakeLists.txt +@@ -53,7 +53,15 @@ 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} ++) + + if(NOT WIN32 AND NOT CLANG_TIDY) + add_subdirectory(test) + endif() ++ +diff --git a/tools/sqlite3_api_wrapper/CMakeLists.txt b/tools/sqlite3_api_wrapper/CMakeLists.txt +index 3fa4166..cd5870d 100644 +--- a/tools/sqlite3_api_wrapper/CMakeLists.txt ++++ b/tools/sqlite3_api_wrapper/CMakeLists.txt +@@ -25,20 +25,20 @@ if(NOT AMALGAMATION_BUILD) + endif() + link_threads(sqlite3_api_wrapper_static) + +-if(NOT WIN32 AND NOT ZOS) ++if(BUILD_SHARED_LIBS AND NOT WIN32 AND NOT ZOS) + 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) + endif() + +-include_directories(../../third_party/catch) ++# include_directories(../../third_party/catch) + +-include_directories(test/include) +-add_subdirectory(test) ++# include_directories(test/include) ++# add_subdirectory(test) + +-add_executable(test_sqlite3_api_wrapper ${SQLITE_TEST_FILES}) +-if(WIN32 OR ZOS) +- target_link_libraries(test_sqlite3_api_wrapper sqlite3_api_wrapper_static) +-else() +- target_link_libraries(test_sqlite3_api_wrapper sqlite3_api_wrapper) +-endif() ++# add_executable(test_sqlite3_api_wrapper ${SQLITE_TEST_FILES}) ++# if(WIN32 OR ZOS) ++# target_link_libraries(test_sqlite3_api_wrapper sqlite3_api_wrapper_static) ++# else() ++# target_link_libraries(test_sqlite3_api_wrapper sqlite3_api_wrapper) ++# endif() diff --git a/recipes/duckdb/all/patches/0.9.2-0001-fix-cmake.patch b/recipes/duckdb/all/patches/0.9.2-0001-fix-cmake.patch new file mode 100644 index 0000000000000..c7d4c07c092db --- /dev/null +++ b/recipes/duckdb/all/patches/0.9.2-0001-fix-cmake.patch @@ -0,0 +1,117 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 67444db..c34c3ce 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -721,7 +721,7 @@ function(build_static_extension NAME PARAMETERS) + set(FILES ${ARGV}) + list(REMOVE_AT FILES 0) + add_library(${NAME}_extension STATIC ${FILES}) +- target_link_libraries(${NAME}_extension duckdb_static) ++# target_link_libraries(${NAME}_extension duckdb_static) + endfunction() + + # Internal extension register function +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index cda2d86..011ecb5 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -76,21 +76,21 @@ else() + duckdb_hyperloglog + duckdb_fastpforlib + duckdb_mbedtls) +- ++ if(BUILD_SHARED_LIBS) + add_library(duckdb SHARED ${ALL_OBJECT_FILES}) + target_link_libraries(duckdb ${DUCKDB_LINK_LIBS}) + link_threads(duckdb) + link_extension_libraries(duckdb) +- ++ endif() + add_library(duckdb_static STATIC ${ALL_OBJECT_FILES}) + target_link_libraries(duckdb_static ${DUCKDB_LINK_LIBS}) + link_threads(duckdb_static) + link_extension_libraries(duckdb_static) +- ++ if(BUILD_SHARED_LIBS) + target_include_directories( + duckdb PUBLIC $ + $) +- ++ endif() + target_include_directories( + duckdb_static PUBLIC $ + $) +@@ -105,10 +105,18 @@ else() + DESTINATION "${INSTALL_INCLUDE_DIR}") + + endif() +- ++if(BUILD_SHARED_LIBS) + install( +- TARGETS duckdb duckdb_static ++ 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 4a8e7e1..8ae9681 100644 +--- a/tools/odbc/CMakeLists.txt ++++ b/tools/odbc/CMakeLists.txt +@@ -53,6 +53,13 @@ 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} ++) + + if(NOT CLANG_TIDY) + add_subdirectory(test) +diff --git a/tools/sqlite3_api_wrapper/CMakeLists.txt b/tools/sqlite3_api_wrapper/CMakeLists.txt +index 3fa4166..42af485 100644 +--- a/tools/sqlite3_api_wrapper/CMakeLists.txt ++++ b/tools/sqlite3_api_wrapper/CMakeLists.txt +@@ -25,20 +25,20 @@ if(NOT AMALGAMATION_BUILD) + endif() + link_threads(sqlite3_api_wrapper_static) + +-if(NOT WIN32 AND NOT ZOS) ++if(BUILD_SHARED_LIBS AND NOT WIN32 AND NOT ZOS) + 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) + endif() + +-include_directories(../../third_party/catch) ++# include_directories(../../third_party/catch) + +-include_directories(test/include) +-add_subdirectory(test) ++# include_directories(test/include) ++# add_subdirectory(test) + +-add_executable(test_sqlite3_api_wrapper ${SQLITE_TEST_FILES}) +-if(WIN32 OR ZOS) +- target_link_libraries(test_sqlite3_api_wrapper sqlite3_api_wrapper_static) +-else() +- target_link_libraries(test_sqlite3_api_wrapper sqlite3_api_wrapper) +-endif() ++#add_executable(test_sqlite3_api_wrapper ${SQLITE_TEST_FILES}) ++#if(WIN32 OR ZOS) ++# target_link_libraries(test_sqlite3_api_wrapper sqlite3_api_wrapper_static) ++#else() ++# target_link_libraries(test_sqlite3_api_wrapper sqlite3_api_wrapper) ++#endif() diff --git a/recipes/duckdb/all/patches/1.0.0-0001-fix-cmake.patch b/recipes/duckdb/all/patches/1.0.0-0001-fix-cmake.patch new file mode 100644 index 0000000000000..a557864ae780a --- /dev/null +++ b/recipes/duckdb/all/patches/1.0.0-0001-fix-cmake.patch @@ -0,0 +1,125 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index ec66b57..6321321 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -843,12 +843,12 @@ function(build_loadable_extension_directory NAME OUTPUT_DIRECTORY EXTENSION_VERS + COMMAND emcc $ -o $.wasm -O3 -sSIDE_MODULE=2 -sEXPORTED_FUNCTIONS="_${NAME}_init,_${NAME}_version" ${WASM_THREAD_FLAGS} ${TO_BE_LINKED} + ) + endif() +- add_custom_command( +- TARGET ${TARGET_NAME} +- POST_BUILD +- COMMAND +- ${CMAKE_COMMAND} -DEXTENSION=$${EXTENSION_POSTFIX} -DPLATFORM_FILE=${DuckDB_BINARY_DIR}/duckdb_platform_out -DDUCKDB_VERSION="${DUCKDB_NORMALIZED_VERSION}" -DEXTENSION_VERSION="${EXTENSION_VERSION}" -DNULL_FILE=${DUCKDB_MODULE_BASE_DIR}/scripts/null.txt -P ${DUCKDB_MODULE_BASE_DIR}/scripts/append_metadata.cmake +- ) ++ # add_custom_command( ++ # TARGET ${TARGET_NAME} ++ # POST_BUILD ++ # COMMAND ++ # ${CMAKE_COMMAND} -DEXTENSION=$${EXTENSION_POSTFIX} -DPLATFORM_FILE=${DuckDB_BINARY_DIR}/duckdb_platform_out -DDUCKDB_VERSION="${DUCKDB_NORMALIZED_VERSION}" -DEXTENSION_VERSION="${EXTENSION_VERSION}" -DNULL_FILE=${DUCKDB_MODULE_BASE_DIR}/scripts/null.txt -P ${DUCKDB_MODULE_BASE_DIR}/scripts/append_metadata.cmake ++ # ) + add_dependencies(${TARGET_NAME} duckdb_platform) + if (NOT EXTENSION_CONFIG_BUILD AND NOT ${EXTENSION_TESTS_ONLY} AND NOT CLANG_TIDY) + add_dependencies(duckdb_local_extension_repo ${TARGET_NAME}) +@@ -869,7 +869,7 @@ function(build_static_extension NAME PARAMETERS) + set(FILES "${ARGV}") + list(REMOVE_AT FILES 0) + add_library(${NAME}_extension STATIC ${FILES}) +- target_link_libraries(${NAME}_extension duckdb_static) ++# target_link_libraries(${NAME}_extension duckdb_static) + endfunction() + + # Internal extension register function +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 06c0c9a..ac1c4ad 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -93,21 +93,21 @@ else() + duckdb_skiplistlib + duckdb_mbedtls + duckdb_yyjson) +- ++ if(BUILD_SHARED_LIBS) + add_library(duckdb SHARED ${ALL_OBJECT_FILES}) + target_link_libraries(duckdb ${DUCKDB_LINK_LIBS}) + link_threads(duckdb) + link_extension_libraries(duckdb) +- ++ endif() + add_library(duckdb_static STATIC ${ALL_OBJECT_FILES}) + target_link_libraries(duckdb_static ${DUCKDB_LINK_LIBS}) + link_threads(duckdb_static) + link_extension_libraries(duckdb_static) +- ++ if(BUILD_SHARED_LIBS) + target_include_directories( + duckdb PUBLIC $ + $) +- ++ endif() + target_include_directories( + duckdb_static PUBLIC $ + $) +@@ -123,10 +123,18 @@ else() + DESTINATION "${INSTALL_INCLUDE_DIR}") + + endif() +- ++if(BUILD_SHARED_LIBS) + install( +- TARGETS duckdb duckdb_static ++ 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 baf7823..4447d26 100644 +--- a/tools/odbc/CMakeLists.txt ++++ b/tools/odbc/CMakeLists.txt +@@ -37,6 +37,13 @@ add_library(duckdb_odbc SHARED ${ALL_OBJECT_FILES} duckdb_odbc.def) + + 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} ++) + + if(NOT CLANG_TIDY) + add_subdirectory(test) +diff --git a/tools/sqlite3_api_wrapper/CMakeLists.txt b/tools/sqlite3_api_wrapper/CMakeLists.txt +index e29c33e..9e387f9 100644 +--- a/tools/sqlite3_api_wrapper/CMakeLists.txt ++++ b/tools/sqlite3_api_wrapper/CMakeLists.txt +@@ -26,12 +26,12 @@ if(NOT AMALGAMATION_BUILD) + endif() + link_threads(sqlite3_api_wrapper_static) + +-if(NOT WIN32 AND NOT ZOS) ++if(BUILD_SHARED_LIBS AND NOT WIN32 AND NOT ZOS) + 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) + endif() +- ++if(0) + include_directories(../../third_party/catch) + + include_directories(test/include) +@@ -43,3 +43,4 @@ if(WIN32 OR ZOS) + else() + target_link_libraries(test_sqlite3_api_wrapper sqlite3_api_wrapper) + endif() ++endif() diff --git a/recipes/duckdb/all/patches/1.0.0-0002-msvc-bicobj.patch b/recipes/duckdb/all/patches/1.0.0-0002-msvc-bicobj.patch new file mode 100644 index 0000000000000..ddefcf5673104 --- /dev/null +++ b/recipes/duckdb/all/patches/1.0.0-0002-msvc-bicobj.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 50d10e8..a06f30c 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -537,7 +537,7 @@ if(NOT MSVC) + endif() + else() + set(CMAKE_CXX_WINDOWS_FLAGS +- "/wd4244 /wd4267 /wd4200 /wd26451 /wd26495 /D_CRT_SECURE_NO_WARNINGS /utf-8") ++ "/wd4244 /wd4267 /wd4200 /wd26451 /wd26495 /D_CRT_SECURE_NO_WARNINGS /utf-8 /bigobj") + if(TREAT_WARNINGS_AS_ERRORS) + set(CMAKE_CXX_WINDOWS_FLAGS "${CMAKE_CXX_WINDOWS_FLAGS} /WX") + endif() diff --git a/recipes/duckdb/all/patches/1.1.0-0001-fix-cmake.patch b/recipes/duckdb/all/patches/1.1.0-0001-fix-cmake.patch new file mode 100644 index 0000000000000..988bca9f377f1 --- /dev/null +++ b/recipes/duckdb/all/patches/1.1.0-0001-fix-cmake.patch @@ -0,0 +1,110 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 7dc2bb7..89c0adc 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -896,12 +896,12 @@ function(build_loadable_extension_directory NAME ABI_TYPE OUTPUT_DIRECTORY EXTEN + set(FOOTER_VERSION_VALUE ${CAPI_VERSION}) + endif() + +- add_custom_command( +- TARGET ${TARGET_NAME} +- POST_BUILD +- COMMAND +- ${CMAKE_COMMAND} -DABI_TYPE=${ABI_TYPE} -DEXTENSION=$${EXTENSION_POSTFIX} -DPLATFORM_FILE=${DuckDB_BINARY_DIR}/duckdb_platform_out -DVERSION_FIELD="${FOOTER_VERSION_VALUE}" -DEXTENSION_VERSION="${EXTENSION_VERSION}" -DNULL_FILE=${DUCKDB_MODULE_BASE_DIR}/scripts/null.txt -P ${DUCKDB_MODULE_BASE_DIR}/scripts/append_metadata.cmake +- ) ++ # add_custom_command( ++ # TARGET ${TARGET_NAME} ++ # POST_BUILD ++ # COMMAND ++ # ${CMAKE_COMMAND} -DABI_TYPE=${ABI_TYPE} -DEXTENSION=$${EXTENSION_POSTFIX} -DPLATFORM_FILE=${DuckDB_BINARY_DIR}/duckdb_platform_out -DVERSION_FIELD="${FOOTER_VERSION_VALUE}" -DEXTENSION_VERSION="${EXTENSION_VERSION}" -DNULL_FILE=${DUCKDB_MODULE_BASE_DIR}/scripts/null.txt -P ${DUCKDB_MODULE_BASE_DIR}/scripts/append_metadata.cmake ++ # ) + add_dependencies(${TARGET_NAME} duckdb_platform) + if (NOT EXTENSION_CONFIG_BUILD AND NOT ${EXTENSION_TESTS_ONLY} AND NOT CLANG_TIDY) + add_dependencies(duckdb_local_extension_repo ${TARGET_NAME}) +@@ -931,7 +931,7 @@ function(build_static_extension NAME PARAMETERS) + set(FILES "${ARGV}") + list(REMOVE_AT FILES 0) + add_library(${NAME}_extension STATIC ${FILES}) +- target_link_libraries(${NAME}_extension duckdb_static) ++ # target_link_libraries(${NAME}_extension duckdb_static) + endfunction() + + # Internal extension register function +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 3e757a4..957f0e4 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -109,7 +109,7 @@ else() + duckdb_skiplistlib + duckdb_mbedtls + duckdb_yyjson) +- ++ if(BUILD_SHARED_LIBS) + add_library(duckdb SHARED ${ALL_OBJECT_FILES}) + + if(WIN32 AND NOT MINGW) +@@ -135,16 +135,16 @@ else() + target_link_libraries(duckdb ${DUCKDB_LINK_LIBS}) + link_threads(duckdb) + link_extension_libraries(duckdb) +- ++ endif() + add_library(duckdb_static STATIC ${ALL_OBJECT_FILES}) + target_link_libraries(duckdb_static ${DUCKDB_LINK_LIBS}) + link_threads(duckdb_static) + link_extension_libraries(duckdb_static) +- ++ if(BUILD_SHARED_LIBS) + target_include_directories( + duckdb PUBLIC $ + $) +- ++ endif() + target_include_directories( + duckdb_static PUBLIC $ + $) +@@ -160,10 +160,18 @@ else() + DESTINATION "${INSTALL_INCLUDE_DIR}") + + endif() +- ++if(BUILD_SHARED_LIBS) + install( +- TARGETS duckdb duckdb_static ++ 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/sqlite3_api_wrapper/CMakeLists.txt b/tools/sqlite3_api_wrapper/CMakeLists.txt +index e29c33e..9e387f9 100644 +--- a/tools/sqlite3_api_wrapper/CMakeLists.txt ++++ b/tools/sqlite3_api_wrapper/CMakeLists.txt +@@ -26,12 +26,12 @@ if(NOT AMALGAMATION_BUILD) + endif() + link_threads(sqlite3_api_wrapper_static) + +-if(NOT WIN32 AND NOT ZOS) ++if(BUILD_SHARED_LIBS AND NOT WIN32 AND NOT ZOS) + 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) + endif() +- ++if(0) + include_directories(../../third_party/catch) + + include_directories(test/include) +@@ -43,3 +43,4 @@ if(WIN32 OR ZOS) + else() + target_link_libraries(test_sqlite3_api_wrapper sqlite3_api_wrapper) + endif() ++endif() diff --git a/recipes/duckdb/all/patches/1.1.0-0002-msvc-bicobj.patch b/recipes/duckdb/all/patches/1.1.0-0002-msvc-bicobj.patch new file mode 100644 index 0000000000000..838678649e638 --- /dev/null +++ b/recipes/duckdb/all/patches/1.1.0-0002-msvc-bicobj.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 89c0adc..af5b786 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -574,7 +574,7 @@ if(NOT MSVC) + endif() + else() + set(CMAKE_CXX_WINDOWS_FLAGS +- "/wd4244 /wd4267 /wd4200 /wd26451 /wd26495 /D_CRT_SECURE_NO_WARNINGS /utf-8") ++ "/wd4244 /wd4267 /wd4200 /wd26451 /wd26495 /D_CRT_SECURE_NO_WARNINGS /utf-8 /bigobj") + if(TREAT_WARNINGS_AS_ERRORS) + set(CMAKE_CXX_WINDOWS_FLAGS "${CMAKE_CXX_WINDOWS_FLAGS} /WX") + endif() diff --git a/recipes/duckdb/all/patches/1.1.1-0001-fix-cmake.patch b/recipes/duckdb/all/patches/1.1.1-0001-fix-cmake.patch new file mode 100644 index 0000000000000..426c745da3cdf --- /dev/null +++ b/recipes/duckdb/all/patches/1.1.1-0001-fix-cmake.patch @@ -0,0 +1,110 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 5c2503e..f7ab0e8 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -892,12 +892,12 @@ function(build_loadable_extension_directory NAME ABI_TYPE OUTPUT_DIRECTORY EXTEN + set(FOOTER_VERSION_VALUE ${CAPI_VERSION}) + endif() + +- add_custom_command( +- TARGET ${TARGET_NAME} +- POST_BUILD +- COMMAND +- ${CMAKE_COMMAND} -DABI_TYPE=${ABI_TYPE} -DEXTENSION=$${EXTENSION_POSTFIX} -DPLATFORM_FILE=${DuckDB_BINARY_DIR}/duckdb_platform_out -DVERSION_FIELD="${FOOTER_VERSION_VALUE}" -DEXTENSION_VERSION="${EXTENSION_VERSION}" -DNULL_FILE=${DUCKDB_MODULE_BASE_DIR}/scripts/null.txt -P ${DUCKDB_MODULE_BASE_DIR}/scripts/append_metadata.cmake +- ) ++ # add_custom_command( ++ # TARGET ${TARGET_NAME} ++ # POST_BUILD ++ # COMMAND ++ # ${CMAKE_COMMAND} -DABI_TYPE=${ABI_TYPE} -DEXTENSION=$${EXTENSION_POSTFIX} -DPLATFORM_FILE=${DuckDB_BINARY_DIR}/duckdb_platform_out -DVERSION_FIELD="${FOOTER_VERSION_VALUE}" -DEXTENSION_VERSION="${EXTENSION_VERSION}" -DNULL_FILE=${DUCKDB_MODULE_BASE_DIR}/scripts/null.txt -P ${DUCKDB_MODULE_BASE_DIR}/scripts/append_metadata.cmake ++ # ) + add_dependencies(${TARGET_NAME} duckdb_platform) + if (NOT EXTENSION_CONFIG_BUILD AND NOT ${EXTENSION_TESTS_ONLY} AND NOT CLANG_TIDY) + add_dependencies(duckdb_local_extension_repo ${TARGET_NAME}) +@@ -927,7 +927,7 @@ function(build_static_extension NAME PARAMETERS) + set(FILES "${ARGV}") + list(REMOVE_AT FILES 0) + add_library(${NAME}_extension STATIC ${FILES}) +- target_link_libraries(${NAME}_extension duckdb_static) ++ # target_link_libraries(${NAME}_extension duckdb_static) + endfunction() + + # Internal extension register function +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 3e757a4..957f0e4 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -109,7 +109,7 @@ else() + duckdb_skiplistlib + duckdb_mbedtls + duckdb_yyjson) +- ++ if(BUILD_SHARED_LIBS) + add_library(duckdb SHARED ${ALL_OBJECT_FILES}) + + if(WIN32 AND NOT MINGW) +@@ -135,16 +135,16 @@ else() + target_link_libraries(duckdb ${DUCKDB_LINK_LIBS}) + link_threads(duckdb) + link_extension_libraries(duckdb) +- ++ endif() + add_library(duckdb_static STATIC ${ALL_OBJECT_FILES}) + target_link_libraries(duckdb_static ${DUCKDB_LINK_LIBS}) + link_threads(duckdb_static) + link_extension_libraries(duckdb_static) +- ++ if(BUILD_SHARED_LIBS) + target_include_directories( + duckdb PUBLIC $ + $) +- ++ endif() + target_include_directories( + duckdb_static PUBLIC $ + $) +@@ -160,10 +160,18 @@ else() + DESTINATION "${INSTALL_INCLUDE_DIR}") + + endif() +- ++if(BUILD_SHARED_LIBS) + install( +- TARGETS duckdb duckdb_static ++ 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/sqlite3_api_wrapper/CMakeLists.txt b/tools/sqlite3_api_wrapper/CMakeLists.txt +index e29c33e..9e387f9 100644 +--- a/tools/sqlite3_api_wrapper/CMakeLists.txt ++++ b/tools/sqlite3_api_wrapper/CMakeLists.txt +@@ -26,12 +26,12 @@ if(NOT AMALGAMATION_BUILD) + endif() + link_threads(sqlite3_api_wrapper_static) + +-if(NOT WIN32 AND NOT ZOS) ++if(BUILD_SHARED_LIBS AND NOT WIN32 AND NOT ZOS) + 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) + endif() +- ++if(0) + include_directories(../../third_party/catch) + + include_directories(test/include) +@@ -43,3 +43,4 @@ if(WIN32 OR ZOS) + else() + target_link_libraries(test_sqlite3_api_wrapper sqlite3_api_wrapper) + endif() ++endif() diff --git a/recipes/duckdb/all/patches/1.1.1-0002-msvc-bicobj.patch b/recipes/duckdb/all/patches/1.1.1-0002-msvc-bicobj.patch new file mode 100644 index 0000000000000..b8385d1df35d3 --- /dev/null +++ b/recipes/duckdb/all/patches/1.1.1-0002-msvc-bicobj.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f7ab0e8..a00353d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -570,7 +570,7 @@ if(NOT MSVC) + endif() + else() + set(CMAKE_CXX_WINDOWS_FLAGS +- "/wd4244 /wd4267 /wd4200 /wd26451 /wd26495 /D_CRT_SECURE_NO_WARNINGS /utf-8") ++ "/wd4244 /wd4267 /wd4200 /wd26451 /wd26495 /D_CRT_SECURE_NO_WARNINGS /utf-8 /bigobj") + if(TREAT_WARNINGS_AS_ERRORS) + set(CMAKE_CXX_WINDOWS_FLAGS "${CMAKE_CXX_WINDOWS_FLAGS} /WX") + endif() diff --git a/recipes/duckdb/config.yml b/recipes/duckdb/config.yml index 49d19e4d3a5cb..e49709a230ba5 100644 --- a/recipes/duckdb/config.yml +++ b/recipes/duckdb/config.yml @@ -1,7 +1,19 @@ versions: - "0.6.1": + "1.1.3": folder: "all" - "0.6.0": + "1.1.2": folder: "all" - "0.5.1": + "1.1.1": + folder: "all" + "1.1.0": + folder: "all" + "1.0.0": + folder: "all" + "0.10.2": + folder: "all" + "0.10.1": + folder: "all" + "0.9.2": + folder: "all" + "0.9.0": folder: "all" diff --git a/recipes/duckx/all/conandata.yml b/recipes/duckx/all/conandata.yml new file mode 100644 index 0000000000000..f22f7365670c4 --- /dev/null +++ b/recipes/duckx/all/conandata.yml @@ -0,0 +1,9 @@ +sources: + "1.2.2": + url: "https://github.com/amiremohamadi/DuckX/archive/refs/tags/v1.2.2.tar.gz" + sha256: "ca924b9dc3a38184f617d2ec96b91deae3f06caf42a4508c23dd9943dcf9da39" +patches: + "1.2.2": + - patch_file: "patches/0001-use-cci.patch" + patch_description: "use cci packages" + patch_type: "conan" diff --git a/recipes/duckx/all/conanfile.py b/recipes/duckx/all/conanfile.py new file mode 100644 index 0000000000000..8afefe6cb2eb7 --- /dev/null +++ b/recipes/duckx/all/conanfile.py @@ -0,0 +1,83 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import apply_conandata_patches, export_conandata_patches, copy, get, rmdir +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.build import check_min_cppstd +import os + +required_conan_version = ">=1.53.0" + +class DuckxConan(ConanFile): + name = "duckx" + description = " C++ library for creating and updating Microsoft Word (.docx) files." + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/amiremohamadi/DuckX/" + topics = ("docx", "docx-files", "office") + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": False, + "pugixml/*:header_only": 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("pugixml/1.14", transitive_headers=True) + self.requires("kuba-zip/0.3.1", transitive_headers=True) + + def validate(self): + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + if not self.dependencies["pugixml"].options.header_only: + raise ConanInvalidConfiguration(f"{self.ref} requires header_only pugixml.") + + 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.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + 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, "LICENSE", self.source_folder, 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.libs = ["duckx"] + diff --git a/recipes/duckx/all/patches/0001-use-cci.patch b/recipes/duckx/all/patches/0001-use-cci.patch new file mode 100644 index 0000000000000..fc24422c57061 --- /dev/null +++ b/recipes/duckx/all/patches/0001-use-cci.patch @@ -0,0 +1,53 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f452186..14a8c03 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -9,15 +9,19 @@ endif() + option(BUILD_SHARED_LIBS "Build shared instead of static library" OFF) + option(BUILD_SAMPLE "Build provided sample" OFF) + +-set(HEADERS src/duckx.hpp src/zip.h src/miniz.h +- src/pugixml.hpp src/pugiconfig.hpp) +-set(SOURCES src/duckx.cpp src/zip.c src/pugixml.cpp) ++find_package(pugixml REQUIRED CONFIG) ++find_package(zip REQUIRED CONFIG) ++ ++set(HEADERS src/duckx.hpp ++ ) ++set(SOURCES src/duckx.cpp) + + if(BUILD_SHARED_LIBS) + add_library(duckx SHARED ${HEADERS} ${SOURCES}) + else() + add_library(duckx STATIC ${HEADERS} ${SOURCES}) + endif() ++target_link_libraries(duckx PRIVATE pugixml::pugixml zip::zip) + + add_library(duckx::duckx ALIAS duckx) + +diff --git a/src/duckx.cpp b/src/duckx.cpp +index 7379d02..4d66e62 100644 +--- a/src/duckx.cpp ++++ b/src/duckx.cpp +@@ -292,7 +292,7 @@ void duckx::Document::save() const { + // Open the original zip and copy all files which are not replaced by duckX + zip_t* orig_zip = zip_open(original_file.c_str(), ZIP_DEFAULT_COMPRESSION_LEVEL, 'r'); + // Loop & copy each relevant entry in the original zip +- int orig_zip_entry_ct = zip_total_entries(orig_zip); ++ int orig_zip_entry_ct = zip_entries_total(orig_zip); + for (int i = 0; i < orig_zip_entry_ct; i++) + { + zip_entry_openbyindex(orig_zip, i); +diff --git a/src/duckx.hpp b/src/duckx.hpp +index fd54d10..c3350d3 100644 +--- a/src/duckx.hpp ++++ b/src/duckx.hpp +@@ -12,7 +12,7 @@ + #include + + #include "pugixml.hpp" +-#include "zip.h" ++#include "zip/zip.h" + + + // TODO: Use container-iterator design pattern! diff --git a/recipes/duckx/all/test_package/CMakeLists.txt b/recipes/duckx/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..fc42d4028cd4f --- /dev/null +++ b/recipes/duckx/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(duckx REQUIRED CONFDIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE duckx::duckx) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/duckx/all/test_package/conanfile.py b/recipes/duckx/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fbb7f543162 --- /dev/null +++ b/recipes/duckx/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/duckx/all/test_package/test_package.cpp b/recipes/duckx/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..053be6a46c0e6 --- /dev/null +++ b/recipes/duckx/all/test_package/test_package.cpp @@ -0,0 +1,8 @@ +#include +#include "duckx.hpp" + +int main() { + duckx::Document doc{}; + + return 0; +} diff --git a/recipes/duckx/config.yml b/recipes/duckx/config.yml new file mode 100644 index 0000000000000..af40d9653a378 --- /dev/null +++ b/recipes/duckx/config.yml @@ -0,0 +1,3 @@ +versions: + "1.2.2": + folder: all diff --git a/recipes/duktape/all/CMakeLists.txt b/recipes/duktape/all/CMakeLists.txt index 76bab4dba57c0..cc4f8cfa2df77 100644 --- a/recipes/duktape/all/CMakeLists.txt +++ b/recipes/duktape/all/CMakeLists.txt @@ -1,12 +1,8 @@ -cmake_minimum_required(VERSION 2.8.12) - +cmake_minimum_required(VERSION 3.12) project(duktape C) -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder/src/*.c) -file(GLOB HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder/src/*.h) +file(GLOB SOURCES ${CMAKE_CURRENT_LIST_DIR}/src/src/*.c) +file(GLOB HEADERS ${CMAKE_CURRENT_LIST_DIR}/src/src/*.h) add_library(duktape ${SOURCES} ${HEADERS}) set_target_properties(duktape PROPERTIES PUBLIC_HEADER "${HEADERS}") @@ -14,10 +10,8 @@ if (UNIX AND NOT APPLE AND NOT ANDROID) target_link_libraries(duktape m) endif() +include(GNUInstallDirs) install( TARGETS duktape - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib PUBLIC_HEADER DESTINATION include ) diff --git a/recipes/duktape/all/conanfile.py b/recipes/duktape/all/conanfile.py index 3e582932bd595..588a96a8c0f57 100644 --- a/recipes/duktape/all/conanfile.py +++ b/recipes/duktape/all/conanfile.py @@ -1,29 +1,33 @@ import os -from conans import CMake, ConanFile, tools -required_conan_version = ">=1.33.0" +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get + +required_conan_version = ">=1.53.0" + class DuktapeConan(ConanFile): name = "duktape" - license = "MIT" description = "Duktape is an embeddable Javascript engine, with a focus on portability and compact footprint." - topics = ("javascript", "engine", "embeddable", "compact") + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://duktape.org" - exports_sources = ["CMakeLists.txt"] - generators = "cmake" + topics = ("javascript", "engine", "embeddable", "compact") + + package_type = "library" settings = "os", "arch", "compiler", "build_type" - options = {"shared": [True, False], "fPIC": [True, False]} + options = { + "shared": [True, False], + "fPIC": [True, False], + } default_options = { "shared": False, "fPIC": True, } - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" + 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": @@ -31,44 +35,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 + 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], 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.configure() - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + if self.settings.os == "Windows" and self.options.shared: + # Duktape has a configure script with a number of options. + # However, it requires python 2 and PyYAML package + # which is quite an unusual combination to have. + # The most crucial option is --dll which enables + # DUK_F_DLL_BUILD and the following defines. + tc.preprocessor_definitions["DUK_EXTERNAL_DECL"] = "extern __declspec(dllexport)" + tc.preprocessor_definitions["DUK_EXTERNAL"] = "__declspec(dllexport)" + tc.generate() def build(self): - # Duktape has configure script with a number of options. - # However it requires python 2 and PyYAML package - # which is quite an unusual combination to have. - # The most crucial option is --dll which just flips this define. - if self.settings.os == "Windows" and self.options.shared: - tools.replace_in_file( - os.path.join(self._source_subfolder, "src", "duk_config.h"), - "#undef DUK_F_DLL_BUILD", - "#define DUK_F_DLL_BUILD", - ) - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=self.export_sources_folder) 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() def package_info(self): self.cpp_info.libs = ["duktape"] - if not self.options.shared and str(self.settings.os) in ( - "Linux", - "FreeBSD", - "SunOS", - ): + if not self.options.shared and self.settings.os in ("Linux", "FreeBSD", "SunOS"): self.cpp_info.system_libs = ["m"] diff --git a/recipes/duktape/all/test_package/CMakeLists.txt b/recipes/duktape/all/test_package/CMakeLists.txt index 526e8d40c66a2..e6adea9e794dd 100644 --- a/recipes/duktape/all/test_package/CMakeLists.txt +++ b/recipes/duktape/all/test_package/CMakeLists.txt @@ -1,9 +1,7 @@ -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(duktape REQUIRED CONFIG) add_executable(${CMAKE_PROJECT_NAME} test_package.c) -target_link_libraries(${CMAKE_PROJECT_NAME} CONAN_PKG::duktape) +target_link_libraries(${CMAKE_PROJECT_NAME} duktape::duktape) diff --git a/recipes/duktape/all/test_package/conanfile.py b/recipes/duktape/all/test_package/conanfile.py index ca9da95670911..ef5d7042163ec 100644 --- a/recipes/duktape/all/test_package/conanfile.py +++ b/recipes/duktape/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 CMake, ConanFile, 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 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): - self.run(os.path.join("bin", "test_package"), 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/duktape/all/test_v1_package/CMakeLists.txt b/recipes/duktape/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/duktape/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/duktape/all/test_v1_package/conanfile.py b/recipes/duktape/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..d47b5097e761e --- /dev/null +++ b/recipes/duktape/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +import os + +from conans import CMake, ConanFile, 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): + self.run(os.path.join("bin", "test_package"), run_environment=True) diff --git a/recipes/dylib/all/conandata.yml b/recipes/dylib/all/conandata.yml new file mode 100644 index 0000000000000..c085d1577b105 --- /dev/null +++ b/recipes/dylib/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "2.2.1": + url: "https://github.com/martin-olivier/dylib/archive/refs/tags/v2.2.1.tar.gz" + sha256: "6af0d2a91860743dc9f564ba0ab7f036a9b37c904395610288791571d4dbea5b" diff --git a/recipes/dylib/all/conanfile.py b/recipes/dylib/all/conanfile.py new file mode 100644 index 0000000000000..d607d4cbb0520 --- /dev/null +++ b/recipes/dylib/all/conanfile.py @@ -0,0 +1,52 @@ +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.53.0" + +class DylibConan(ConanFile): + name = "dylib" + homepage = "https://github.com/martin-olivier/dylib" + url = "https://github.com/conan-io/conan-center-index" + description = "C++ cross-platform wrapper around dynamic loading of shared libraries (dll, so, dylib)" + license = "MIT" + topics = ("shared-library", "cross-platform", "header-only") + + package_type = 'header-library' + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + pass + + 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], 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, "dylib.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", "dylib") + self.cpp_info.set_property("cmake_target_name", "dylib::dylib") + self.cpp_info.set_property("pkg_config_name", "dylib") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["dl"]) diff --git a/recipes/dylib/all/test_package/CMakeLists.txt b/recipes/dylib/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..b3c80ba7c695b --- /dev/null +++ b/recipes/dylib/all/test_package/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +enable_testing() + +find_package(dylib REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE dylib::dylib) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) + +add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME}) diff --git a/recipes/dylib/all/test_package/conanfile.py b/recipes/dylib/all/test_package/conanfile.py new file mode 100644 index 0000000000000..ad30644323b26 --- /dev/null +++ b/recipes/dylib/all/test_package/conanfile.py @@ -0,0 +1,29 @@ +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.build import can_run +from conan.tools.files import chdir + +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): + with chdir(self, self.build_folder): + self.run(f"ctest --output-on-failure -C {self.settings.build_type}", env="conanrun") diff --git a/recipes/dylib/all/test_package/test_package.cpp b/recipes/dylib/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..01f9e4b14bcb1 --- /dev/null +++ b/recipes/dylib/all/test_package/test_package.cpp @@ -0,0 +1,13 @@ +#include +#include + +int main() +{ + try { + dylib lib("foo"); + std::cerr << "Expected dylib::load_error exception" << std::endl; + return 1; + } catch (const dylib::load_error &) { + return 0; + } +} diff --git a/recipes/dylib/config.yml b/recipes/dylib/config.yml new file mode 100644 index 0000000000000..a816d92f78ee3 --- /dev/null +++ b/recipes/dylib/config.yml @@ -0,0 +1,3 @@ +versions: + "2.2.1": + folder: all diff --git a/recipes/eabase/all/CMakeLists.txt b/recipes/eabase/all/CMakeLists.txt deleted file mode 100644 index 2cc1d907283f7..0000000000000 --- a/recipes/eabase/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() - -add_subdirectory(source_subfolder) - -set(DEST_DIR "${CMAKE_INSTALL_PREFIX}") diff --git a/recipes/eabase/all/conandata.yml b/recipes/eabase/all/conandata.yml index 3d5c49b6fcf42..2c833d6c97845 100644 --- a/recipes/eabase/all/conandata.yml +++ b/recipes/eabase/all/conandata.yml @@ -1,7 +1,10 @@ sources: + "2.09.12": + url: "https://github.com/electronicarts/EABase/archive/d1be0a1d0fc01a9bf8f3f2cea75018df0d2410ee.zip" + sha256: "53b72d188aa17c7b23aa6bef9a4767854e82eac46a027dec233d12fd3dfbc677" + "2.09.06": + url: "https://github.com/electronicarts/EABase/archive/refs/heads/2.09.06.zip" + sha256: "3223c2b81dcdccaeb9fca7a83695f9edb402b817c89c073c0eb3ee64646699ea" "2.09.05": url: "https://github.com/electronicarts/EABase/archive/2.09.05.tar.gz" sha256: "f85b98c96f1976aa013c8d6016c5e37a409633ac3fce843cd4ec0b89c67e6b7a" - "2.09.06": - url: "https://github.com/electronicarts/EABase/archive/2.09.06.tar.gz" - sha256: "981f922441617152b841585c0fc0bd205bd898c758016fa4985599a63c5a6e16" diff --git a/recipes/eabase/all/conanfile.py b/recipes/eabase/all/conanfile.py index fa0631dead1bd..e1ead0a93a9bc 100644 --- a/recipes/eabase/all/conanfile.py +++ b/recipes/eabase/all/conanfile.py @@ -1,35 +1,59 @@ import os -from conans import ConanFile, CMake, tools + +from conan import ConanFile +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout + +required_conan_version = ">=1.52.0" class EABaseConan(ConanFile): name = "eabase" description = "EABase is a small set of header files that define platform-independent data types and platform feature macros. " - topics = ("conan", "eabase", "config",) + topics = ("eastl", "config") license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/electronicarts/EABase" + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - settings = "os", "compiler", "build_type", "arch" - @property - def _source_subfolder(self): - return "source_subfolder" - - def source(self): - tools.get(**self.conan_data["sources"][self.version]) - folder_name = "EABase-{}".format(self.version) - os.rename(folder_name, self._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): + get(self, **self.conan_data["sources"][self.version], strip_root=True) 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")) + 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.includedirs += [ + os.path.join("include", "Common"), + os.path.join("include", "Common", "EABase"), + ] + + self.cpp_info.set_property("cmake_file_name", "EABase") + self.cpp_info.set_property("cmake_target_name", "EABase::EABase") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "EABase" + self.cpp_info.filenames["cmake_find_package_multi"] = "EABase" self.cpp_info.names["cmake_find_package"] = "EABase" self.cpp_info.names["cmake_find_package_multi"] = "EABase" - self.cpp_info.includedirs.extend([os.path.join("include", "Common"), - os.path.join("include", "Common", "EABase")]) diff --git a/recipes/eabase/all/test_package/CMakeLists.txt b/recipes/eabase/all/test_package/CMakeLists.txt index 196188113685c..d2f6d0c57dfc9 100644 --- a/recipes/eabase/all/test_package/CMakeLists.txt +++ b/recipes/eabase/all/test_package/CMakeLists.txt @@ -1,8 +1,8 @@ -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() +find_package(EABase REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE EABase::EABase) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/eabase/all/test_package/conanfile.py b/recipes/eabase/all/test_package/conanfile.py index bd7165a553cf4..0a808db45f245 100644 --- a/recipes/eabase/all/test_package/conanfile.py +++ b/recipes/eabase/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" + 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.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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/eabase/all/test_v1_package/CMakeLists.txt b/recipes/eabase/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..f6d6c9603dafa --- /dev/null +++ b/recipes/eabase/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +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/docs/package_templates/msbuild_package/all/test_v1_package/conanfile.py b/recipes/eabase/all/test_v1_package/conanfile.py similarity index 100% rename from docs/package_templates/msbuild_package/all/test_v1_package/conanfile.py rename to recipes/eabase/all/test_v1_package/conanfile.py diff --git a/recipes/eabase/config.yml b/recipes/eabase/config.yml index 2e5ba08e41ecc..7c5c5f65bfc3e 100644 --- a/recipes/eabase/config.yml +++ b/recipes/eabase/config.yml @@ -1,5 +1,7 @@ versions: - "2.09.05": + "2.09.12": folder: "all" "2.09.06": folder: "all" + "2.09.05": + folder: "all" diff --git a/recipes/earcut/all/conanfile.py b/recipes/earcut/all/conanfile.py index 4705a812889d4..c1034e73dab2e 100644 --- a/recipes/earcut/all/conanfile.py +++ b/recipes/earcut/all/conanfile.py @@ -1,17 +1,24 @@ -from conans import ConanFile, 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.files import copy, get +from conan.tools.layout import basic_layout -class EarcutConan(ConanFile): +required_conan_version = ">=1.50.0" + + +class EarcutPackage(ConanFile): name = "earcut" description = "A C++ port of earcut.js, a fast, header-only polygon triangulation library." homepage = "https://github.com/mapbox/earcut.hpp" url = "https://github.com/conan-io/conan-center-index" license = "ISC" topics = ("algorithm", "cpp", "geometry", "rendering", "triangulation", - "polygon", "header-only", "tessellation", "earcut") - settings = "compiler" + "polygon", "header-only", "tessellation") + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True @property @@ -26,45 +33,51 @@ def _minimum_compilers_version(self): "gcc": "4.9", "intel": "15", "sun-cc": "5.14", - "Visual Studio": "12" + "Visual Studio": "12", + "msvc": "180", } @property - def _minimum_cpp_standard(self): + 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"): - tools.check_min_cppstd(self, self._minimum_cpp_standard) + 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] - 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 lazy_lt_semver(str(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)) - - @property - def _source_subfolder(self): - return "source_subfolder" + 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): + 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 package(self): - self.copy("*", "include", - src=os.path.join(self._source_subfolder, "include")) - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + copy(self, "*", os.path.join(self.source_folder, "include"), + os.path.join(self.package_folder, "include")) + copy(self, "LICENSE", self.source_folder, + 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", "earcut_hpp") + self.cpp_info.set_property("cmake_target_name", "earcut_hpp::earcut_hpp") + 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"] = "earcut_hpp" + self.cpp_info.names["cmake_find_package_multi"] = "earcut_hpp" diff --git a/recipes/earcut/all/test_package/CMakeLists.txt b/recipes/earcut/all/test_package/CMakeLists.txt index 6aab347eddf53..c341471bb32de 100644 --- a/recipes/earcut/all/test_package/CMakeLists.txt +++ b/recipes/earcut/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(PackageTest CXX) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(earcut_hpp 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 earcut_hpp::earcut_hpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/earcut/all/test_package/conanfile.py b/recipes/earcut/all/test_package/conanfile.py index 1423eb472e682..12503ced11f45 100644 --- a/recipes/earcut/all/test_package/conanfile.py +++ b/recipes/earcut/all/test_package/conanfile.py @@ -1,11 +1,19 @@ import os +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout -from conans import ConanFile, CMake, tools +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" -class EarcutTestConan(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/earcut/all/test_package/example.cpp b/recipes/earcut/all/test_package/test_package.cpp similarity index 100% rename from recipes/earcut/all/test_package/example.cpp rename to recipes/earcut/all/test_package/test_package.cpp diff --git a/recipes/earcut/all/test_v1_package/CMakeLists.txt b/recipes/earcut/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..cf60ef4f067f3 --- /dev/null +++ b/recipes/earcut/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/earcut/all/test_v1_package/conanfile.py b/recipes/earcut/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..a8c92dea63335 --- /dev/null +++ b/recipes/earcut/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +import os + +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.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/eastl/all/CMakeLists.txt b/recipes/eastl/all/CMakeLists.txt deleted file mode 100644 index 9533e6887cb91..0000000000000 --- a/recipes/eastl/all/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 3.1.2) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -set(CMAKE_CXX_STANDARD 14) - -add_subdirectory(source_subfolder) diff --git a/recipes/eastl/all/conandata.yml b/recipes/eastl/all/conandata.yml index f1c15b1dc7308..fbaa385964645 100644 --- a/recipes/eastl/all/conandata.yml +++ b/recipes/eastl/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.21.12": + url: "https://github.com/electronicarts/EASTL/archive/refs/tags/3.21.12.tar.gz" + sha256: "2a4d77e5eda23ec52fea8b22abbf2ea8002f38396d2a3beddda3ff2e17f7db2e" "3.18.00": url: "https://github.com/electronicarts/EASTL/archive/refs/tags/3.18.00.tar.gz" sha256: "a3c5b970684be02e81fb16fbf92ed2584e055898704fde87c72d0331afdea12b" @@ -21,30 +24,51 @@ sources: url: "https://github.com/electronicarts/EASTL/archive/3.15.00.tar.gz" sha256: "1578a2935ca490920b96c960fb570dab025280bb978fba40c88eb9ac74760c14" patches: + "3.21.12": + - patch_file: "patches/3.21.12-0001-cmake-shared-use-conan-add-install.patch" + patch_description: "support shared build, use cci's EABase, add install definitions" + patch_type: "conan" + - patch_file: "patches/3.17.03-0002-revert-c++14-constexpr.patch" + patch_description: "disable constexpr for unsupported compilers" + patch_type: "portability" + - patch_file: "patches/3.21.12-0003-rename_reference.patch" + patch_description: "use eastl::remove_reference instead of std::remove_reference" + patch_type: "portability" + patch_source: "https://github.com/electronicarts/EASTL/issues/512" "3.18.00": - patch_file: "patches/3.17.03-0001-cmake-shared-use-conan-add-install.patch" - base_path: "source_subfolder" + patch_description: "support shared build, use cci's EABase, add install definitions" + patch_type: "conan" - patch_file: "patches/3.17.03-0002-revert-c++14-constexpr.patch" - base_path: "source_subfolder" + patch_description: "disable constexpr for unsupported compilers" + patch_type: "portability" "3.17.06": - patch_file: "patches/3.17.03-0001-cmake-shared-use-conan-add-install.patch" - base_path: "source_subfolder" + patch_description: "support shared build, use cci's EABase, add install definitions" + patch_type: "conan" - patch_file: "patches/3.17.03-0002-revert-c++14-constexpr.patch" - base_path: "source_subfolder" + patch_description: "disable constexpr for unsupported compilers" + patch_type: "portability" "3.17.03": - patch_file: "patches/3.17.03-0001-cmake-shared-use-conan-add-install.patch" - base_path: "source_subfolder" + patch_description: "support shared build, use cci's EABase, add install definitions" + patch_type: "conan" - patch_file: "patches/3.17.03-0002-revert-c++14-constexpr.patch" - base_path: "source_subfolder" + patch_description: "disable constexpr for unsupported compilers" + patch_type: "portability" "3.16.07": - patch_file: "patches/3.15.00-0001-cmake-shared-use-conan-add-install.patch" - base_path: "source_subfolder" + patch_description: "support shared build, use cci's EABase, add install definitions" + patch_type: "conan" "3.16.05": - patch_file: "patches/3.15.00-0001-cmake-shared-use-conan-add-install.patch" - base_path: "source_subfolder" + patch_description: "support shared build, use cci's EABase, add install definitions" + patch_type: "conan" "3.16.01": - patch_file: "patches/3.15.00-0001-cmake-shared-use-conan-add-install.patch" - base_path: "source_subfolder" + patch_description: "support shared build, use cci's EABase, add install definitions" + patch_type: "conan" "3.15.00": - patch_file: "patches/3.15.00-0001-cmake-shared-use-conan-add-install.patch" - base_path: "source_subfolder" + patch_description: "support shared build, use cci's EABase, add install definitions" + patch_type: "conan" diff --git a/recipes/eastl/all/conanfile.py b/recipes/eastl/all/conanfile.py index faccbd629bec0..0e2ac3111ed3a 100644 --- a/recipes/eastl/all/conanfile.py +++ b/recipes/eastl/all/conanfile.py @@ -1,20 +1,36 @@ -from conans import ConanFile, CMake, 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.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, check_min_vs +from conan.tools.scm import Version + +required_conan_version = ">=1.52.0" class EastlConan(ConanFile): name = "eastl" - description = "EASTL stands for Electronic Arts Standard Template Library. " \ - "It is an extensive and robust implementation that has an " \ - "emphasis on high performance." + description = ( + "EASTL stands for Electronic Arts Standard Template Library. " + "It is an extensive and robust implementation that has an " + "emphasis on high performance." + ) topics = ("eastl", "stl", "high-performance") license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/electronicarts/EASTL" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -25,34 +41,22 @@ class EastlConan(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 _minimum_cpp_standard(self): + def _min_cppstd(self): return 14 @property - def _minimum_compilers_version(self): + def _compilers_minimum_version(self): return { "Visual Studio": "14", - "gcc": "5", + "msvc": "190", + "gcc": "5" if Version(self.version) < "3.21.12" else "6", "clang": "3.2", "apple-clang": "4.3", } 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,57 +64,81 @@ 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("eabase/2.09.06") + self.requires("eabase/2.09.12", transitive_headers=True) def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, self._minimum_cpp_standard) - - mininum_compiler_version = self._minimum_compilers_version.get(str(self.settings.compiler)) - if mininum_compiler_version and tools.Version(self.settings.compiler.version) < mininum_compiler_version: - raise ConanInvalidConfiguration("Compiler is too old for c++ {}".format(self._minimum_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." + ) + + if is_msvc(self) and check_min_vs(self, "193", raise_invalid=False) and Version(self.version) < "3.21.12": + raise ConanInvalidConfiguration(f"{self.ref} is not compatible with Visual Studio 2022, please use version >= 3.21.12") 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["EASTL_BUILD_BENCHMARK"] = False - self._cmake.definitions["EASTL_BUILD_TESTS"] = False - 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["EASTL_BUILD_BENCHMARK"] = False + tc.variables["EASTL_BUILD_TESTS"] = False + tc.variables["CMAKE_CXX_STANDARD"] = self._min_cppstd + tc.generate() + CMakeDeps(self).generate() def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - tools.replace_path_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "include(CommonCppFlags)", - "") + apply_conandata_patches(self) + replace_in_file( + self, + os.path.join(self.source_folder, "CMakeLists.txt"), + "include(CommonCppFlags)", + "", + ) 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") - self.copy("3RDPARTYLICENSES.TXT", 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, + "3RDPARTYLICENSES.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, "doc")) def package_info(self): self.cpp_info.libs = ["EASTL"] if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.system_libs.append("pthread") + self.cpp_info.system_libs.extend(["m", "pthread"]) if self.options.shared: self.cpp_info.defines.append("EA_DLL") - # Do not use these names in set_property, it was a mistake, eastl doesn't export its target + self.cpp_info.set_property("cmake_file_name", "EASTL") + self.cpp_info.set_property("cmake_target_name", "EASTL::EASTL") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "EASTL" + self.cpp_info.filenames["cmake_find_package_multi"] = "EASTL" self.cpp_info.names["cmake_find_package"] = "EASTL" self.cpp_info.names["cmake_find_package_multi"] = "EASTL" diff --git a/recipes/eastl/all/patches/3.15.00-0001-cmake-shared-use-conan-add-install.patch b/recipes/eastl/all/patches/3.15.00-0001-cmake-shared-use-conan-add-install.patch index 8b004f0ee5054..cb7647d7b88ea 100644 --- a/recipes/eastl/all/patches/3.15.00-0001-cmake-shared-use-conan-add-install.patch +++ b/recipes/eastl/all/patches/3.15.00-0001-cmake-shared-use-conan-add-install.patch @@ -1,11 +1,12 @@ --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -46,5 +46,18 @@ target_include_directories(EASTL PUBLIC include) +@@ -46,5 +46,19 @@ target_include_directories(EASTL PUBLIC include) #------------------------------------------------------------------------------------------- # Dependencies #------------------------------------------------------------------------------------------- -target_link_libraries(EASTL EABase) -+target_link_libraries(EASTL CONAN_PKG::eabase) ++find_package(EABase REQUIRED CONFIG) ++target_link_libraries(EASTL EABase::EABase) +if(BUILD_SHARED_LIBS) + target_compile_definitions(EASTL PUBLIC EASTL_DLL) diff --git a/recipes/eastl/all/patches/3.17.03-0001-cmake-shared-use-conan-add-install.patch b/recipes/eastl/all/patches/3.17.03-0001-cmake-shared-use-conan-add-install.patch index 05c5b0bd39e41..8e8ec2ed77d6e 100644 --- a/recipes/eastl/all/patches/3.17.03-0001-cmake-shared-use-conan-add-install.patch +++ b/recipes/eastl/all/patches/3.17.03-0001-cmake-shared-use-conan-add-install.patch @@ -1,6 +1,6 @@ --- CMakeLists.txt +++ CMakeLists.txt -@@ -47,8 +47,21 @@ +@@ -47,8 +47,22 @@ # Dependencies #------------------------------------------------------------------------------------------- if (NOT TARGET EABase) @@ -9,7 +9,8 @@ endif() -target_link_libraries(EASTL EABase) -+target_link_libraries(EASTL CONAN_PKG::eabase) ++find_package(EABase REQUIRED CONFIG) ++target_link_libraries(EASTL EABase::EABase) +if(BUILD_SHARED_LIBS) + target_compile_definitions(EASTL PUBLIC EASTL_DLL) diff --git a/recipes/eastl/all/patches/3.21.12-0001-cmake-shared-use-conan-add-install.patch b/recipes/eastl/all/patches/3.21.12-0001-cmake-shared-use-conan-add-install.patch new file mode 100644 index 0000000000000..475e12111343c --- /dev/null +++ b/recipes/eastl/all/patches/3.21.12-0001-cmake-shared-use-conan-add-install.patch @@ -0,0 +1,30 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index e3eb444..f033794 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -59,11 +59,22 @@ target_include_directories(EASTL PUBLIC include) + #------------------------------------------------------------------------------------------- + # Dependencies + #------------------------------------------------------------------------------------------- +-if (NOT TARGET EABase) +- add_subdirectory(test/packages/EABase) ++find_package(EABase REQUIRED CONFIG) ++target_link_libraries(EASTL EABase::EABase) ++ ++if(BUILD_SHARED_LIBS) ++ target_compile_definitions(EASTL PUBLIC EASTL_DLL) ++ if(MSVC OR CYGWIN) ++ target_compile_definitions(EASTL PRIVATE "EASTL_API=__declspec(dllexport)") ++ endif() + endif() + +-target_link_libraries(EASTL EABase) ++include(GNUInstallDirs) ++install(TARGETS EASTL ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) ++install(DIRECTORY ${CMAKE_INSTALL_INCLUDEDIR}/EASTL DESTINATION include) + + #------------------------------------------------------------------------------------------- + # Installation diff --git a/recipes/eastl/all/patches/3.21.12-0003-rename_reference.patch b/recipes/eastl/all/patches/3.21.12-0003-rename_reference.patch new file mode 100644 index 0000000000000..686977d001a8d --- /dev/null +++ b/recipes/eastl/all/patches/3.21.12-0003-rename_reference.patch @@ -0,0 +1,13 @@ +diff --git a/include/EASTL/internal/type_transformations.h b/include/EASTL/internal/type_transformations.h +index 5454cfa..54a1c14 100644 +--- a/include/EASTL/internal/type_transformations.h ++++ b/include/EASTL/internal/type_transformations.h +@@ -497,7 +497,7 @@ namespace eastl + namespace internal + { + template +- auto try_add_pointer(int) -> type_identity::type*>; ++ auto try_add_pointer(int) -> type_identity::type*>; + template + auto try_add_pointer(...) -> type_identity; + } diff --git a/recipes/eastl/all/test_package/CMakeLists.txt b/recipes/eastl/all/test_package/CMakeLists.txt index 3300ff7750277..8223214fdc1fe 100644 --- a/recipes/eastl/all/test_package/CMakeLists.txt +++ b/recipes/eastl/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -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(EASTL 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} EASTL::EASTL) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/eastl/all/test_package/conanfile.py b/recipes/eastl/all/test_package/conanfile.py index 5c09494bc67c0..ef5d7042163ec 100644 --- a/recipes/eastl/all/test_package/conanfile.py +++ b/recipes/eastl/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/eastl/all/test_package/test_package.cpp b/recipes/eastl/all/test_package/test_package.cpp index 3f5332883d4d5..433ff947f053b 100644 --- a/recipes/eastl/all/test_package/test_package.cpp +++ b/recipes/eastl/all/test_package/test_package.cpp @@ -1,9 +1,16 @@ -#include -#include +#include +#include -int main() -{ - std::vector vec; - eastl::max_element(vec.begin(), vec.end()); +// https://github.com/electronicarts/EASTL/blob/master/doc/FAQ.md#info15-how-hard-is-it-to-incorporate-eastl-into-my-project +void *operator new[](size_t size, const char *pName, int flags, unsigned debugFlags, const char *file, int line) { + return new uint8_t[size]; +} +void *operator new[](size_t size, size_t alignment, size_t alignmentOffset, const char *pName, int flags, unsigned debugFlags, const char *file, int line) { + return new uint8_t[size]; +} + +int main() { + eastl::hash_map map; + map[0] = 1; return 0; } diff --git a/recipes/eastl/config.yml b/recipes/eastl/config.yml index bfb95b02f09c0..0cd35fae8664c 100644 --- a/recipes/eastl/config.yml +++ b/recipes/eastl/config.yml @@ -1,4 +1,6 @@ versions: + "3.21.12": + folder: "all" "3.18.00": folder: "all" "3.17.06": diff --git a/recipes/easy_profiler/all/CMakeLists.txt b/recipes/easy_profiler/all/CMakeLists.txt deleted file mode 100644 index c986d294c7547..0000000000000 --- a/recipes/easy_profiler/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/easy_profiler/all/conandata.yml b/recipes/easy_profiler/all/conandata.yml index 912612b74f23d..a8ed1296ca75d 100644 --- a/recipes/easy_profiler/all/conandata.yml +++ b/recipes/easy_profiler/all/conandata.yml @@ -5,4 +5,5 @@ sources: patches: "2.1.0": - patch_file: "patches/0001-fix-cmake-bundle-install.patch" - base_path: "source_subfolder" + patch_description: "fix-cmake-bundle-install" + patch_type: "conan" diff --git a/recipes/easy_profiler/all/conanfile.py b/recipes/easy_profiler/all/conanfile.py index 8d7e8ffb71515..3365c9592b68d 100644 --- a/recipes/easy_profiler/all/conanfile.py +++ b/recipes/easy_profiler/all/conanfile.py @@ -1,20 +1,25 @@ -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 check_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 check_min_vs, is_msvc_static_runtime, is_msvc +from conan.tools.scm import Version import os import textwrap -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class EasyProfilerConan(ConanFile): name = "easy_profiler" description = "Lightweight profiler library for c++" license = "MIT" - topics = ("conan", "easy_profiler") + topics = ("profiler") homepage = "https://github.com/yse/easy_profiler/" url = "https://github.com/conan-io/conan-center-index" - exports_sources = ["CMakeLists.txt", "patches/*"] - generators = "cmake" + + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -25,72 +30,85 @@ class EasyProfilerConan(ConanFile): "fPIC": True } - _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 { + "gcc": "4.8", + "clang": "3.3", + "apple-clang": "8.0", + } + def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + def export_sources(self): + export_conandata_patches(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 self.settings.compiler.runtime == "MTd" and \ - self.options.shared and tools.Version(self.settings.compiler.version) >= "15": + 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." + ) + if is_msvc_static_runtime(self) and self.options.shared: raise ConanInvalidConfiguration( - "{} {} with MTd runtime not supported".format(self.settings.compiler, - self.settings.compiler.version) + "{} {} with static runtime not supported".format(self.settings.compiler, + self.settings.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) + def generate(self): + tc = CMakeToolchain(self) + tc.variables["EASY_PROFILER_NO_GUI"] = True + tc.variables["EASY_PROFILER_NO_SAMPLES"] = 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) - # Don't build the GUI because it is dependent on Qt - self._cmake.definitions["EASY_PROFILER_NO_GUI"] = True - self._cmake.definitions["EASY_PROFILER_NO_SAMPLES"] = True - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake - def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("LICENSE.MIT", dst="licenses", src=self._source_subfolder) - self.copy("LICENSE.APACHE", 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="LICENSE.MIT", dst=os.path.join(self.package_folder,"licenses"), src=self.source_folder) + copy(self, pattern="LICENSE.APACHE", 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")) - os.remove(os.path.join(self.package_folder, "LICENSE.MIT")) - os.remove(os.path.join(self.package_folder, "LICENSE.APACHE")) + + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rm(self, "LICENSE.MIT", self.package_folder) + rm(self, "LICENSE.APACHE", self.package_folder) 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)) + rm(self, "{}*.dll".format(dll_prefix), os.path.join(self.package_folder, "bin")) self._create_cmake_module_alias_targets( os.path.join(self.package_folder, self._module_file_rel_path), {"easy_profiler": "easy_profiler::easy_profiler"} ) - @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("""\ @@ -99,7 +117,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): @@ -111,12 +129,11 @@ def _module_file_rel_path(self): "conan-official-{}-targets.cmake".format(self.name)) def package_info(self): - self.cpp_info.names["cmake_find_package"] = "easy_profiler" - self.cpp_info.names["cmake_find_package_multi"] = "easy_profiler" - 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] + self.cpp_info.set_property("cmake_file_name", "easy_profiler") + self.cpp_info.set_property("cmake_target_name", "easy_profiler") + self.cpp_info.libs = ["easy_profiler"] + self.cpp_info.builddirs.append(self._module_subfolder) if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["m", "pthread"] elif self.settings.os == "Windows": @@ -124,6 +141,9 @@ def package_info(self): if not self.options.shared: self.cpp_info.defines.append("EASY_PROFILER_STATIC") - 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"] = "easy_profiler" + self.cpp_info.names["cmake_find_package_multi"] = "easy_profiler" + 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/easy_profiler/all/test_package/CMakeLists.txt b/recipes/easy_profiler/all/test_package/CMakeLists.txt index cc877a386be85..da87b85f5894a 100644 --- a/recipes/easy_profiler/all/test_package/CMakeLists.txt +++ b/recipes/easy_profiler/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.15) +project(test_package CXX) find_package(easy_profiler REQUIRED CONFIG) add_executable(${PROJECT_NAME} example.cpp) -target_link_libraries(${PROJECT_NAME} easy_profiler) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE easy_profiler) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/easy_profiler/all/test_package/conanfile.py b/recipes/easy_profiler/all/test_package/conanfile.py index fe3069158de8a..a9fb96656f203 100644 --- a/recipes/easy_profiler/all/test_package/conanfile.py +++ b/recipes/easy_profiler/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", "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,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/easy_profiler/all/test_package/example.cpp b/recipes/easy_profiler/all/test_package/example.cpp index fc452d1c9f188..f775269ec8586 100644 --- a/recipes/easy_profiler/all/test_package/example.cpp +++ b/recipes/easy_profiler/all/test_package/example.cpp @@ -42,12 +42,14 @@ void renderThread(){ int main(int argc, char* argv[]) { #ifndef SAMPLE_NETWORK_TEST - EASY_PROFILER_ENABLE; + EASY_PROFILER_ENABLE; #endif - EASY_MAIN_THREAD; - profiler::startListen(); + EASY_MAIN_THREAD; + profiler::startListen(); - renderThread(); + renderThread(); - return 0; + std::cout << "SUCCESS" << std::endl; + + return 0; } diff --git a/recipes/easy_profiler/all/test_v1_package/CMakeLists.txt b/recipes/easy_profiler/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/easy_profiler/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/easy_profiler/all/test_v1_package/conanfile.py b/recipes/easy_profiler/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..8037a9296cc42 --- /dev/null +++ b/recipes/easy_profiler/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/easyexif/all/CMakeLists.txt b/recipes/easyexif/all/CMakeLists.txt index de50a2ead5152..0e4ae0258643c 100644 --- a/recipes/easyexif/all/CMakeLists.txt +++ b/recipes/easyexif/all/CMakeLists.txt @@ -1,6 +1,8 @@ -cmake_minimum_required(VERSION 3.4) +cmake_minimum_required(VERSION 3.15) project(easyexif) +include(GNUInstallDirs) + set(CMAKE_CXX_STANDARD_REQUIRED True) set(CMAKE_CXX_STANDARD 11) @@ -8,12 +10,14 @@ if(WIN32 AND BUILD_SHARED_LIBS) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) endif() -add_library(easyexif exif.cpp) -target_include_directories(easyexif PUBLIC exif.h) +add_library(easyexif ${EASYEXIF_SRC_DIR}/exif.cpp) +target_include_directories(easyexif PUBLIC ${EASYEXIF_SRC_DIR}/exif.h) +set_target_properties( + easyexif + PROPERTIES + PUBLIC_HEADER "${EASYEXIF_SRC_DIR}/exif.h" +) install(TARGETS easyexif - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib) -install(FILES exif.h DESTINATION include/easyexif) - + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/easyexif +) diff --git a/recipes/easyexif/all/conanfile.py b/recipes/easyexif/all/conanfile.py index c2f91926a073b..8b47ebbc93442 100644 --- a/recipes/easyexif/all/conanfile.py +++ b/recipes/easyexif/all/conanfile.py @@ -10,12 +10,13 @@ class EasyExifConan(ConanFile): name = "easyexif" description = "Tiny ISO-compliant C++ EXIF parsing library, third-party dependency free." - topics = ("conan", "exif", "image", "multimedia", "format", "graphics") + topics = ("exif", "image", "multimedia", "format", "graphics") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/mayanklahiri/easyexif" license = "BSD-2-Clause" - exports_sources = "CMakeLists.txt" + settings = "os", "compiler", "build_type", "arch" + package_type = "library" options = { "shared": [True, False], "fPIC": [True, False] @@ -30,23 +31,31 @@ def configure(self): if self.options.shared: self.options.rm_safe("fPIC") + def export_sources(self): + copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder) + + @property + def _min_cppstd(self): + return 11 + def validate(self): - if self.info.settings.get_safe("compiler.cppstd"): - check_min_cppstd(self, 11) + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) def layout(self): - cmake_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["EASYEXIF_SRC_DIR"] = self.source_folder.replace("\\", "/") tc.generate() def build(self): cmake = CMake(self) - cmake.configure() + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() def package(self): @@ -56,3 +65,5 @@ def package(self): def package_info(self): self.cpp_info.libs = ["easyexif"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") diff --git a/recipes/easyexif/all/test_package/CMakeLists.txt b/recipes/easyexif/all/test_package/CMakeLists.txt index 2cf2b33919697..418b220626ca8 100644 --- a/recipes/easyexif/all/test_package/CMakeLists.txt +++ b/recipes/easyexif/all/test_package/CMakeLists.txt @@ -1,10 +1,9 @@ -cmake_minimum_required(VERSION 3.1) -project(PackageTest CXX) +cmake_minimum_required(VERSION 3.15) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +project(test_package LANGUAGES CXX) # if the project uses c++ -add_executable(example example.cpp) +find_package(easyexif REQUIRED CONFIG) -set_target_properties(example PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED ON) -target_link_libraries(example ${CONAN_LIBS}) +add_executable(${PROJECT_NAME} example.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE easyexif::easyexif) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/easyexif/all/test_package/conanfile.py b/recipes/easyexif/all/test_package/conanfile.py index f0acb990f0375..9da36f4d489c2 100644 --- a/recipes/easyexif/all/test_package/conanfile.py +++ b/recipes/easyexif/all/test_package/conanfile.py @@ -1,10 +1,20 @@ 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 can_run -class SolaceTestConan(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 +22,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.bindir, "test_package") + self.run(bin_path, env="conanrun") 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 deleted file mode 100644 index f6fc5c33e69b0..0000000000000 --- a/recipes/easyloggingpp/all/CMakeLists.txt +++ /dev/null @@ -1,67 +0,0 @@ -cmake_minimum_required(VERSION 3.2) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() -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) -endif() - -if (enable_thread_safe) - add_definitions(-DELPP_THREAD_SAFE) -endif() - -if (enable_debug_errors) - add_definitions(-DELPP_DEBUG_ERRORS) -endif() - -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/conandata.yml b/recipes/easyloggingpp/all/conandata.yml index 5649e78f158cc..83345fd6f0b12 100644 --- a/recipes/easyloggingpp/all/conandata.yml +++ b/recipes/easyloggingpp/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "9.97.1": + url: "https://github.com/amrayn/easyloggingpp/archive/v9.97.1.tar.gz" + sha256: "ebe473e17b13f1d1f16d0009689576625796947a711e14aec29530f39560c7c2" "9.97.0": url: "https://github.com/amrayn/easyloggingpp/archive/v9.97.0.tar.gz" sha256: "9110638e21ef02428254af8688bf9e766483db8cc2624144aa3c59006907ce22" diff --git a/recipes/easyloggingpp/all/conanfile.py b/recipes/easyloggingpp/all/conanfile.py index b5d1f9b44e060..7cacb1c38e312 100644 --- a/recipes/easyloggingpp/all/conanfile.py +++ b/recipes/easyloggingpp/all/conanfile.py @@ -1,22 +1,24 @@ import os -from conans import CMake -from conan.tools import files + from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, rmdir, replace_in_file +required_conan_version = ">=1.53.0" -required_conan_version = ">=1.33.0" class EasyloggingppConan(ConanFile): name = "easyloggingpp" - license = "The MIT License (MIT)" - homepage = "https://github.com/amrayn/easyloggingpp" + description = "Single-header C++ logging library." + license = "MIT" url = "https://github.com/conan-io/conan-center-index" - description = "Single header C++ logging library." + homepage = "https://github.com/amrayn/easyloggingpp" topics = ("logging", "stacktrace", "efficient-logging") - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" - exports_sources = "CMakeLists.txt", + + package_type = "static-library" + settings = "os", "arch", "compiler", "build_type" options = { + "fPIC": [True, False], "enable_crash_log": [True, False], "enable_thread_safe": [True, False], "enable_debug_errors": [True, False], @@ -28,9 +30,11 @@ class EasyloggingppConan(ConanFile): "disable_error_logs": [True, False], "disable_fatal_logs": [True, False], "disable_verbose_logs": [True, False], - "disable_trace_logs": [True, False] + "disable_trace_logs": [True, False], + "lib_utc_datetime": [True, False], } default_options = { + "fPIC": True, "enable_crash_log": False, "enable_thread_safe": False, "enable_debug_errors": False, @@ -42,80 +46,74 @@ class EasyloggingppConan(ConanFile): "disable_error_logs": False, "disable_fatal_logs": False, "disable_verbose_logs": False, - "disable_trace_logs": False + "disable_trace_logs": False, + "lib_utc_datetime": 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_cmake(self): - if self._cmake is not None: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["build_static_lib"] = True - self._cmake.definitions["enable_crash_log"] = self.options.enable_crash_log - 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 layout(self): + cmake_layout(self, src_folder="src") def source(self): - files.get(self, **self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def build(self): - cmake = self._configure_cmake() - cmake.build() - - def package(self): - cmake = self._configure_cmake() - cmake.install() - files.rmdir(self, os.path.join(self.package_folder, "share")) - self.copy(pattern="LICENSE", - dst="licenses", - src=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - def package_info(self): - self.cpp_info.names["cmake_find_package"] = "easyloggingpp" - self.cpp_info.names["cmake_find_package_multi"] = "easyloggingpp" - self.cpp_info.libs = ["easyloggingpp"] + @property + def _public_defines(self): + defines = [] if self.options.enable_crash_log: - self.cpp_info.defines.append("ELPP_FEATURE_CRASH_LOG") + defines.append("ELPP_FEATURE_CRASH_LOG") if self.options.enable_thread_safe: - self.cpp_info.defines.append("ELPP_THREAD_SAFE") + defines.append("ELPP_THREAD_SAFE") if self.options.enable_debug_errors: - self.cpp_info.defines.append("ELPP_DEBUG_ERRORS") + defines.append("ELPP_DEBUG_ERRORS") if self.options.enable_default_logfile: - self.cpp_info.defines.append("ELPP_NO_DEFAULT_LOG_FILE") + defines.append("ELPP_NO_DEFAULT_LOG_FILE") if self.options.disable_logs: - self.cpp_info.defines.append("ELPP_DISABLE_LOGS") + defines.append("ELPP_DISABLE_LOGS") if self.options.disable_debug_logs: - self.cpp_info.defines.append("ELPP_DISABLE_DEBUG_LOGS") + defines.append("ELPP_DISABLE_DEBUG_LOGS") if self.options.disable_info_logs: - self.cpp_info.defines.append("ELPP_DISABLE_INFO_LOGS") + defines.append("ELPP_DISABLE_INFO_LOGS") if self.options.disable_warning_logs: - self.cpp_info.defines.append("ELPP_DISABLE_WARNING_LOGS") + defines.append("ELPP_DISABLE_WARNING_LOGS") if self.options.disable_error_logs: - self.cpp_info.defines.append("ELPP_DISABLE_ERROR_LOGS") + defines.append("ELPP_DISABLE_ERROR_LOGS") if self.options.disable_fatal_logs: - self.cpp_info.defines.append("ELPP_DISABLE_FATAL_LOGS") + defines.append("ELPP_DISABLE_FATAL_LOGS") if self.options.disable_verbose_logs: - self.cpp_info.defines.append("ELPP_DISABLE_VERBOSE_LOGS") + defines.append("ELPP_DISABLE_VERBOSE_LOGS") if self.options.disable_trace_logs: - self.cpp_info.defines.append("ELPP_DISABLE_TRACE_LOGS") + defines.append("lib_utc_datetime") + if self.options.lib_utc_datetime: + defines.append("ELPP_UTC_DATETIME") + return defines + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["build_static_lib"] = True + for d in self._public_defines: + tc.preprocessor_definitions[d] = "1" + tc.generate() + def _patch_sources(self): + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "set_property(TARGET easyloggingpp PROPERTY POSITION_INDEPENDENT_CODE ON)", "") + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + cmake = CMake(self) + cmake.install() + rmdir(self, os.path.join(self.package_folder, "share")) + copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + + def package_info(self): + self.cpp_info.libs = ["easyloggingpp"] + self.cpp_info.defines = self._public_defines diff --git a/recipes/easyloggingpp/all/test_package/CMakeLists.txt b/recipes/easyloggingpp/all/test_package/CMakeLists.txt index e515e14d7e6ad..a353807cafd1f 100644 --- a/recipes/easyloggingpp/all/test_package/CMakeLists.txt +++ b/recipes/easyloggingpp/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(easyloggingpp REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/easyloggingpp/all/test_package/conanfile.py b/recipes/easyloggingpp/all/test_package/conanfile.py index 49a3a66ea5bad..ef5d7042163ec 100644 --- a/recipes/easyloggingpp/all/test_package/conanfile.py +++ b/recipes/easyloggingpp/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/easyloggingpp/all/test_package/test_package.cpp b/recipes/easyloggingpp/all/test_package/test_package.cpp index 9f1fc4b8dad34..da48715e9c0a2 100644 --- a/recipes/easyloggingpp/all/test_package/test_package.cpp +++ b/recipes/easyloggingpp/all/test_package/test_package.cpp @@ -10,11 +10,12 @@ void myCrashHandler(int sig) { } #endif -int main() { +int main(int argc, char* argv[]) { + START_EASYLOGGINGPP(argc, argv); LOG(INFO) << "My first info log using default logger"; - #ifdef ELPP_FEATURE_CRASH_LOG +#ifdef ELPP_FEATURE_CRASH_LOG LOG(INFO) << "Installed crash handler"; el::Helpers::setCrashHandler(myCrashHandler); - #endif +#endif return 0; } diff --git a/recipes/easyloggingpp/all/test_v1_package/CMakeLists.txt b/recipes/easyloggingpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/easyloggingpp/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/easyloggingpp/all/test_v1_package/conanfile.py b/recipes/easyloggingpp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..49a3a66ea5bad --- /dev/null +++ b/recipes/easyloggingpp/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/easyloggingpp/config.yml b/recipes/easyloggingpp/config.yml index 8f835ce7bab04..b4a91abbf7181 100644 --- a/recipes/easyloggingpp/config.yml +++ b/recipes/easyloggingpp/config.yml @@ -1,3 +1,5 @@ versions: + "9.97.1": + folder: all "9.97.0": folder: all diff --git a/recipes/easylzma/all/CMakeLists.txt b/recipes/easylzma/all/CMakeLists.txt deleted file mode 100644 index 8b2a23892d7de..0000000000000 --- a/recipes/easylzma/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.6) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/easylzma/all/conandata.yml b/recipes/easylzma/all/conandata.yml index ce63d9a78cbcc..80c52f3ee8642 100644 --- a/recipes/easylzma/all/conandata.yml +++ b/recipes/easylzma/all/conandata.yml @@ -5,7 +5,4 @@ sources: patches: "0.0.7": - patch_file: "patches/memleaksfix.patch" - base_path: "source_subfolder" - patch_file: "patches/cmake-no-cflags.patch" - base_path: "source_subfolder" - diff --git a/recipes/easylzma/all/conanfile.py b/recipes/easylzma/all/conanfile.py index 5e527b6090911..46a81f3f9abbc 100644 --- a/recipes/easylzma/all/conanfile.py +++ b/recipes/easylzma/all/conanfile.py @@ -1,72 +1,97 @@ import os -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, export_conandata_patches, get, load, save +from conan.tools.microsoft import is_msvc, msvc_runtime_flag + +required_conan_version = ">=1.53.0" class EazylzmaConan(ConanFile): name = "easylzma" - license = "Unlicense" + description = ( + "An easy to use, tiny, public domain, C wrapper library around " + "Igor Pavlov's work that can be used to compress and extract lzma files" + ) + license = "DocumentRef-README:LicenseRef-PublicDomain-WITH-Attribution" # Public Domain with attribution request url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/lloyd/easylzma" - description = ("An easy to use, tiny, public domain, C wrapper library around \ - Igor Pavlov's work that can be used to compress and extract lzma files") - settings = "os", "arch", "compiler", "build_type" - generators = "cmake" - topics = ("conan", "eazylzma", "lzma") - exports_sources = ["CMakeLists.txt", "patches/*"] - options = {"shared": [True, False], "fPIC": [True, False]} - default_options = {"shared": False, "fPIC": True} + topics = ("lzma",) - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _license_text(self): - # Extract the License/s from the README to a file - tmp = tools.load(os.path.join("source_subfolder", "README")) - return tmp[tmp.find("License",1):tmp.find("work.", 1)+5] + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } - @property - def _libname(self): - return "easylzma" if self.options.shared else "easylzma_s" + def export_sources(self): + 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 - 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]) - 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 generate(self): + tc = CMakeToolchain(self) + # Relocatable shared libs on macOS + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" + # Silence CMake warning about LOCATION property + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0026"] = "OLD" + tc.generate() def build(self): - for patch in self.conan_data["patches"][self.version]: - tools.patch(**patch) + apply_conandata_patches(self) cmake = CMake(self) cmake.configure() cmake.build(target=self._libname) - def package(self): - tools.save(os.path.join(self.package_folder, "licenses", "LICENSE"), self._license_text) + @property + def _license_text(self): + # Extract the License/s from the README to a file + tmp = load(self, os.path.join(self.source_folder, "README")) + return tmp[tmp.find("License", 1) : tmp.find("work.", 1) + 5] - self.copy(pattern="*.dylib*", dst="lib", src="lib", keep_path=False, symlinks=True) - self.copy(pattern="*.so*", dst="lib", src="lib", keep_path=False, symlinks=True) - self.copy(pattern="*.dll", dst="bin", src="bin", keep_path=False) - self.copy(pattern="*.a", dst="lib", src="lib", keep_path=False) - self.copy(pattern="*.lib", dst="lib", src="lib", keep_path=False) + def package(self): + save(self, os.path.join(self.package_folder, "licenses", "LICENSE"), self._license_text) + for pattern in ["*.lib", "*.a", "*.so*", "*.dylib"]: + copy(self, pattern, + dst=os.path.join(self.package_folder, "lib"), + src=self.build_folder, + keep_path=False) + copy(self, "*.dll", + dst=os.path.join(self.package_folder, "bin"), + src=self.build_folder, + keep_path=False) + copy(self, "easylzma/*", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "src")) - self.copy("easylzma/*", dst="include", src=os.path.join(self._source_subfolder, "src")) + @property + def _libname(self): + return "easylzma" if self.options.shared else "easylzma_s" def package_info(self): self.cpp_info.libs = [self._libname] if self.options.shared: self.cpp_info.defines = ["EASYLZMA_SHARED"] - if self.settings.compiler == "Visual Studio": - if "d" in str(self.settings.compiler.runtime): + if is_msvc(self): + if "d" in msvc_runtime_flag(self): self.cpp_info.defines.append("DEBUG") diff --git a/recipes/easylzma/all/test_package/CMakeLists.txt b/recipes/easylzma/all/test_package/CMakeLists.txt index 34af13462f44f..6e6b478dec699 100644 --- a/recipes/easylzma/all/test_package/CMakeLists.txt +++ b/recipes/easylzma/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 C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(easylzma REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE easylzma::easylzma) diff --git a/recipes/easylzma/all/test_package/conanfile.py b/recipes/easylzma/all/test_package/conanfile.py index 4903f1a7e8fa0..ef5d7042163ec 100644 --- a/recipes/easylzma/all/test_package/conanfile.py +++ b/recipes/easylzma/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/easylzma/all/test_v1_package/CMakeLists.txt b/recipes/easylzma/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/easylzma/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/easylzma/all/test_v1_package/conanfile.py b/recipes/easylzma/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..6c9d5dba712c7 --- /dev/null +++ b/recipes/easylzma/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_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/ecos/all/conandata.yml b/recipes/ecos/all/conandata.yml index 3034805590c75..d01723bbcc421 100644 --- a/recipes/ecos/all/conandata.yml +++ b/recipes/ecos/all/conandata.yml @@ -1,8 +1,13 @@ sources: + "2.0.10": + url: "https://github.com/embotech/ecos/archive/refs/tags/v2.0.10.tar.gz" + sha256: "1aa24b5782b84fa33df2987510fb8f60f5f999cc2d3a5c73cfc3eb5e5f3b46af" "2.0.8": url: "https://github.com/embotech/ecos/archive/refs/tags/v2.0.8.tar.gz" sha256: "d905d16599efd927a75b29852c3476ff1ffd0b97ab27d5b8ad63bb4ff2ad8130" patches: + "2.0.10": + - patch_file: "patches/0001-fix-cmake.patch" "2.0.8": - patch_file: "patches/0001-fix-cmake.patch" - patch_file: "patches/0002-missing-include.patch" diff --git a/recipes/ecos/config.yml b/recipes/ecos/config.yml index ebde7c07fe491..c6ba7fd0862f2 100644 --- a/recipes/ecos/config.yml +++ b/recipes/ecos/config.yml @@ -1,3 +1,5 @@ versions: + "2.0.10": + folder: all "2.0.8": folder: all diff --git a/recipes/editline/all/conanfile.py b/recipes/editline/all/conanfile.py index 2f03c73a34aa9..3a10507e0cd32 100644 --- a/recipes/editline/all/conanfile.py +++ b/recipes/editline/all/conanfile.py @@ -1,8 +1,14 @@ -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 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 -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class EditlineConan(ConanFile): @@ -10,9 +16,10 @@ class EditlineConan(ConanFile): description = "Autotool- and libtoolized port of the NetBSD Editline library (libedit)." url = "https://github.com/conan-io/conan-center-index" homepage = "http://thrysoee.dk/editline/" - topics = ("conan", "editline", "libedit", "line", "editing", "history", "tokenization") + topics = ("libedit", "line", "editing", "history", "tokenization") 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], @@ -24,27 +31,24 @@ class EditlineConan(ConanFile): "terminal_db": "termcap", } - _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.terminal_db == "termcap": self.requires("termcap/1.3.1") elif self.options.terminal_db == "ncurses": - self.requires("ncurses/6.2") + self.requires("ncurses/6.4") def validate(self): if self.settings.os == "Windows": @@ -54,43 +58,33 @@ def validate(self): raise ConanInvalidConfiguration("tinfo is not (yet) available on CCI") 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 = [] - - configure_args = ["--disable-examples"] - if self.options.shared: - configure_args.extend(["--disable-static", "--enable-shared"]) - else: - configure_args.extend(["--enable-static", "--disable-shared"]) - - self._autotools.configure(args=configure_args, configure_dir=self._source_subfolder) - return self._autotools - - def _patch_sources(self): - for patchdata in self.conan_data.get("patches",{}).get(self.version, []): - tools.patch(**patchdata) + 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) + tc.configure_args.append("--disable-examples") + tc.generate() + deps = AutotoolsDeps(self) + deps.generate() 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, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) - os.unlink(os.path.join(self.package_folder, "lib", "libedit.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): + self.cpp_info.set_property("pkg_config_name", "libedit") self.cpp_info.libs = ["edit"] self.cpp_info.includedirs.append(os.path.join("include", "editline")) diff --git a/recipes/editline/all/test_package/CMakeLists.txt b/recipes/editline/all/test_package/CMakeLists.txt index 7b9b613cbb24a..7dd22a34887ac 100644 --- a/recipes/editline/all/test_package/CMakeLists.txt +++ b/recipes/editline/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(editline REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE editline::editline) diff --git a/recipes/editline/all/test_package/conanfile.py b/recipes/editline/all/test_package/conanfile.py index efa177fece16d..299c3facd9ebf 100644 --- a/recipes/editline/all/test_package/conanfile.py +++ b/recipes/editline/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" + 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,6 +27,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - with tools.environment_append({"TERM": "xtermc"}): - 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/editline/all/test_v1_package/CMakeLists.txt b/recipes/editline/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/editline/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/editline/all/test_v1_package/conanfile.py b/recipes/editline/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..ca3e725401958 --- /dev/null +++ b/recipes/editline/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): + with tools.environment_append({"TERM": "xtermc"}): + self.run(os.path.join("bin", "test_package"), 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/conanfile.py b/recipes/edyn/all/conanfile.py index 9e0c289bac789..d6278b4cb5dcb 100644 --- a/recipes/edyn/all/conanfile.py +++ b/recipes/edyn/all/conanfile.py @@ -1,14 +1,13 @@ from conan import ConanFile -from conan.tools.files import rmdir, rm, copy, get, collect_libs +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 -from conan.tools.layout import cmake_layout -from conan.tools.microsoft import check_min_vs, is_msvc -from conan.errors import ConanInvalidConfiguration -from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" + class EdynConan(ConanFile): name = "edyn" @@ -17,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], @@ -31,11 +30,17 @@ class EdynConan(ConanFile): } @property - def _compiler_required(self): + def _min_cppstd(self): + return "17" + + @property + 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): @@ -44,35 +49,33 @@ 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("entt/3.10.1") + self.requires("entt/3.10.3", transitive_headers=True) def validate(self): if self.settings.compiler.get_safe("cppstd"): - check_min_cppstd(self, 17) - check_min_vs(self, 192) - 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++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): get(self, **self.conan_data["sources"][self.version], strip_root=True) 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 - if self.options.floating_type == "double": - tc.variables["EDYN_CONFIG_DOUBLE"] = True + tc.variables["EDYN_BUILD_TESTS"] = False + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True tc.generate() deps = CMakeDeps(self) @@ -84,29 +87,23 @@ def build(self): 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() - - copy(self, pattern="LICENSE", 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, "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 = collect_libs(self) - 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 3298fd461a4e3..c81d1ceba454a 100644 --- a/recipes/edyn/all/test_package/CMakeLists.txt +++ b/recipes/edyn/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ 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 a52c6b7a0d922..4e578144a798a 100644 --- a/recipes/edyn/all/test_package/conanfile.py +++ b/recipes/edyn/all/test_package/conanfile.py @@ -1,12 +1,11 @@ from conan import ConanFile from conan.tools.build import can_run -from conan.tools.layout import cmake_layout -from conan.tools.cmake import CMake +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "CMakeDeps", "CMakeToolchain" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" test_type = "explicit" def layout(self): diff --git a/recipes/edyn/all/test_v1_package/CMakeLists.txt b/recipes/edyn/all/test_v1_package/CMakeLists.txt index 26c41f72889f8..0d20897301b68 100644 --- a/recipes/edyn/all/test_v1_package/CMakeLists.txt +++ b/recipes/edyn/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(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) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/edyn/all/test_v1_package/test_package.cpp b/recipes/edyn/all/test_v1_package/test_package.cpp deleted file mode 100644 index ec6be85f6dfe0..0000000000000 --- a/recipes/edyn/all/test_v1_package/test_package.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include - -int main() -{ - edyn::vector3 const v0{ 0, 1, 2 }; - edyn::vector3 const v1{ -2, -1, -0 }; - - std::printf("%f\n", edyn::dot(v0, v1)); - assert(edyn::dot(v0, v1) == -1); -} diff --git a/recipes/effcee/all/CMakeLists.txt b/recipes/effcee/all/CMakeLists.txt deleted file mode 100644 index a53ad7e107d11..0000000000000 --- a/recipes/effcee/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/effcee/all/conandata.yml b/recipes/effcee/all/conandata.yml index 688296fd06354..8e17ad0e718d0 100644 --- a/recipes/effcee/all/conandata.yml +++ b/recipes/effcee/all/conandata.yml @@ -5,4 +5,3 @@ sources: patches: "2019.1": - patch_file: "patches/0001-fix-cmake.patch" - base_path: "source_subfolder" diff --git a/recipes/effcee/all/conanfile.py b/recipes/effcee/all/conanfile.py index 6f5840a5a392b..8579fbc0fec1b 100644 --- a/recipes/effcee/all/conanfile.py +++ b/recipes/effcee/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.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 +import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class EffceeConan(ConanFile): @@ -10,23 +15,21 @@ class EffceeConan(ConanFile): homepage = "https://github.com/google/effcee/" description = "Effcee is a C++ library for stateful pattern matching" \ " of strings, inspired by LLVM's FileCheck" - topics = ("conan", "effcee", "strings", "algorithm", "matcher") + topics = ("strings", "algorithm", "matcher") license = "Apache-2.0" - exports_sources = ["CMakeLists.txt", "patches/**"] - generators = "cmake", "cmake_find_package_multi" + 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 _build_subfolder(self): - return "build_subfolder" + 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": @@ -34,54 +37,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 requirements(self): - self.requires("re2/20210601") + self.requires("re2/20230301", transitive_headers=True) def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, "11") - if self.settings.compiler == "Visual Studio" and \ - self.options.shared and "MT" in self.settings.compiler.runtime: - raise ConanInvalidConfiguration("Visual Studio build for shared" - " library with MT runtime is not" - " supported") + check_min_cppstd(self, "11") + if self.options.shared and is_msvc(self) and is_msvc_static_runtime(self): + raise ConanInvalidConfiguration(f"{self.ref} shared with MT runtime not supported by msvc") 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["EFFCEE_BUILD_TESTING"] = False - self._cmake.definitions["EFFCEE_BUILD_SAMPLES"] = False + def generate(self): + tc = CMakeToolchain(self) + tc.variables["EFFCEE_BUILD_TESTING"] = False + tc.variables["EFFCEE_BUILD_SAMPLES"] = False if self.settings.os == "Windows": - if self.settings.compiler == "Visual Studio": - self._cmake.definitions["EFFCEE_ENABLE_SHARED_CRT"] = \ - "MD" in self.settings.compiler.runtime + if is_msvc(self): + tc.variables["EFFCEE_ENABLE_SHARED_CRT"] = not is_msvc_static_runtime(self) else: # Do not force linkage to static libgcc and libstdc++ for MinGW - self._cmake.definitions["EFFCEE_ENABLE_SHARED_CRT"] = True - - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + tc.variables["EFFCEE_ENABLE_SHARED_CRT"] = True + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + 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): - 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/effcee/all/test_package/CMakeLists.txt b/recipes/effcee/all/test_package/CMakeLists.txt index f42f881c6aad0..52906cfefeb69 100644 --- a/recipes/effcee/all/test_package/CMakeLists.txt +++ b/recipes/effcee/all/test_package/CMakeLists.txt @@ -1,13 +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(effcee REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) - -target_link_libraries(${PROJECT_NAME} effcee::effcee) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE effcee::effcee) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/effcee/all/test_package/conanfile.py b/recipes/effcee/all/test_package/conanfile.py index 12dd810a6ab3b..98ab55852ad56 100644 --- a/recipes/effcee/all/test_package/conanfile.py +++ b/recipes/effcee/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 = "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/effcee/all/test_v1_package/CMakeLists.txt b/recipes/effcee/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/effcee/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/effcee/all/test_v1_package/conanfile.py b/recipes/effcee/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..12dd810a6ab3b --- /dev/null +++ b/recipes/effcee/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" + + 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/effolkronium-random/all/conandata.yml b/recipes/effolkronium-random/all/conandata.yml index caf25d2461065..93228f36e51e4 100644 --- a/recipes/effolkronium-random/all/conandata.yml +++ b/recipes/effolkronium-random/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.5.0": + url: "https://github.com/effolkronium/random/archive/v1.5.0.tar.gz" + sha256: "c05a042f8daf54913e3a836e10a213bbbeaf09a89630649bd0011fe65eff50d9" "1.4.1": url: "https://github.com/effolkronium/random/archive/v1.4.1.tar.gz" sha256: "ec6beb67496ad2ce722d311d3fa5efb7e847dac5fd1c16b8920b51562fe20f53" diff --git a/recipes/effolkronium-random/all/conanfile.py b/recipes/effolkronium-random/all/conanfile.py index 1c77e0e87ce24..3b1d45a29a7e9 100644 --- a/recipes/effolkronium-random/all/conanfile.py +++ b/recipes/effolkronium-random/all/conanfile.py @@ -1,31 +1,55 @@ import os -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 + +required_conan_version = ">=1.52.0" + class RandomConan(ConanFile): name = "effolkronium-random" description = "Random for modern C++ with convenient API." license = "MIT" - topics = ("conan", "random", "header-only") - homepage = "https://github.com/effolkronium/random" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/effolkronium/random" + topics = ("random", "header-only") + + package_type = "header-library" + 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.cppstd: + check_min_cppstd(self, self._min_cppstd) def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename("random-" + self.version, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): - self.copy("LICENSE.MIT", dst="licenses", src=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, "LICENSE.MIT", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + 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.bindirs = [] + self.cpp_info.libdirs = [] + + self.cpp_info.set_property("cmake_file_name", "effolkronium_random") + self.cpp_info.set_property("cmake_target_name", "effolkronium_random") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.names["cmake_find_package"] = "effolkronium_random" self.cpp_info.names["cmake_find_package_multi"] = "effolkronium_random" diff --git a/recipes/effolkronium-random/all/test_package/CMakeLists.txt b/recipes/effolkronium-random/all/test_package/CMakeLists.txt index 33ae887aa6aea..186757f8c1657 100644 --- a/recipes/effolkronium-random/all/test_package/CMakeLists.txt +++ b/recipes/effolkronium-random/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -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() +find_package(effolkronium_random REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE effolkronium_random) set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) diff --git a/recipes/effolkronium-random/all/test_package/conanfile.py b/recipes/effolkronium-random/all/test_package/conanfile.py index ea57a464900be..fae501d0afb9e 100644 --- a/recipes/effolkronium-random/all/test_package/conanfile.py +++ b/recipes/effolkronium-random/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" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain" + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/effolkronium-random/config.yml b/recipes/effolkronium-random/config.yml index c0455a0dac1c9..81a82b944153f 100644 --- a/recipes/effolkronium-random/config.yml +++ b/recipes/effolkronium-random/config.yml @@ -1,4 +1,6 @@ versions: + "1.5.0": + folder: "all" "1.4.1": folder: "all" "1.4.0": diff --git a/recipes/efsw/all/conandata.yml b/recipes/efsw/all/conandata.yml new file mode 100644 index 0000000000000..7dd750f85dbbc --- /dev/null +++ b/recipes/efsw/all/conandata.yml @@ -0,0 +1,8 @@ +sources: + # Newer versions at the top + "1.4.1": + url: "https://github.com/SpartanJ/efsw/archive/refs/tags/1.4.1.tar.gz" + sha256: "f0ddee587928737c6a3dc92eb88266a804c77279cbdf29d47e5e6f6ad6c7fd9a" + "1.4.0": + url: "https://github.com/SpartanJ/efsw/archive/refs/tags/1.4.0.tar.gz" + sha256: "9eed5fc8471767faa44134f5379d4de02825e3756007dafa482fd1656e42bc4a" diff --git a/recipes/efsw/all/conanfile.py b/recipes/efsw/all/conanfile.py new file mode 100644 index 0000000000000..05d9db6ba0105 --- /dev/null +++ b/recipes/efsw/all/conanfile.py @@ -0,0 +1,75 @@ +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, rm, rmdir, replace_in_file +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +import os + + +required_conan_version = ">=2.1" + + +class EfswConan(ConanFile): + name = "efsw" + description = "efsw is a C++ cross-platform file system watcher and notifier." + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/SpartanJ/efsw" + topics = ("file system", "watch", "cross-platform") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + implements = ["auto_shared_fpic"] + + def validate(self): + 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], 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_TEST_APP"] = False + tc.variables["BUILD_STATIC_LIBS"] = False + tc.generate() + + def _patch_sources(self): + # INFO: Honor fPIC option. The upstream sets fPIC to ON always + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "set(CMAKE_POSITION_INDEPENDENT_CODE ON)", "") + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + 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.libs = ["efsw"] + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs = ["m", "pthread"] + if self.settings.os == "Macos": + self.cpp_info.frameworks = ["Cocoa", "CoreFoundation", "CoreServices"] diff --git a/recipes/efsw/all/test_package/CMakeLists.txt b/recipes/efsw/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..060bcf241df10 --- /dev/null +++ b/recipes/efsw/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) + +project(test_package LANGUAGES CXX) # if the project uses c++ + +find_package(efsw REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE efsw::efsw) diff --git a/recipes/efsw/all/test_package/conanfile.py b/recipes/efsw/all/test_package/conanfile.py new file mode 100644 index 0000000000000..cef342207237c --- /dev/null +++ b/recipes/efsw/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" + + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/efsw/all/test_package/test_package.cpp b/recipes/efsw/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..05eff3352085a --- /dev/null +++ b/recipes/efsw/all/test_package/test_package.cpp @@ -0,0 +1,13 @@ +#include +#include // EXIT_SUCCESS +#include "efsw/efsw.hpp" + +int main() { + efsw::FileWatcher* fileWatcher = new efsw::FileWatcher(); + + std::cout << "Follows symlinks?: " << fileWatcher->followSymlinks() << std::endl; + + delete fileWatcher; + + return EXIT_SUCCESS; +} diff --git a/recipes/efsw/config.yml b/recipes/efsw/config.yml new file mode 100644 index 0000000000000..4b2c882b0c67a --- /dev/null +++ b/recipes/efsw/config.yml @@ -0,0 +1,5 @@ +versions: + "1.4.1": + folder: all + "1.4.0": + folder: all diff --git a/recipes/egl-headers/all/conanfile.py b/recipes/egl-headers/all/conanfile.py index 5f6e1786a60cb..d9fb3976353e3 100644 --- a/recipes/egl-headers/all/conanfile.py +++ b/recipes/egl-headers/all/conanfile.py @@ -13,6 +13,7 @@ class EglHeadersConan(ConanFile): topics = ("egl-headers", "egl") homepage = "https://github.com/KhronosGroup/EGL-Registry" url = "https://github.com/conan-io/conan-center-index" + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -26,8 +27,7 @@ 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 @@ -43,4 +43,5 @@ def package(self): 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 + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/egl-headers/all/test_package/CMakeLists.txt b/recipes/egl-headers/all/test_package/CMakeLists.txt index 8c6a625d847ec..26e09ca1aa867 100644 --- a/recipes/egl-headers/all/test_package/CMakeLists.txt +++ b/recipes/egl-headers/all/test_package/CMakeLists.txt @@ -4,4 +4,4 @@ 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) +target_link_libraries(${PROJECT_NAME} PRIVATE egl-headers::egl-headers) diff --git a/recipes/egl/system/conanfile.py b/recipes/egl/system/conanfile.py index 2139b499f3f52..7461d1a751e0c 100644 --- a/recipes/egl/system/conanfile.py +++ b/recipes/egl/system/conanfile.py @@ -1,47 +1,31 @@ from conan import ConanFile -from conan.errors import ConanException, ConanInvalidConfiguration +from conan.errors import ConanInvalidConfiguration +from conan.tools.gnu import PkgConfig from conan.tools.system import package_manager -from conans import tools -required_conan_version = ">=1.47" +required_conan_version = ">=1.50.0" class SysConfigEGLConan(ConanFile): name = "egl" version = "system" description = "cross-platform virtual conan package for the EGL support" - topics = ("conan", "opengl", "egl") + topics = ("opengl", "egl") url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.khronos.org/egl" license = "MIT" + package_type = "shared-library" 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 layout(self): + pass 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("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")] + self.info.clear() - 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) + def validate(self): + if self.settings.os not in ["Linux", "FreeBSD"]: + raise ConanInvalidConfiguration("This recipes supports only Linux and FreeBSD") def system_requirements(self): dnf = package_manager.Dnf(self) @@ -51,13 +35,7 @@ def system_requirements(self): yum.install(["mesa-libEGL-devel"], update=True, check=True) apt = package_manager.Apt(self) - 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: - apt.install(["libegl-dev"], update=True, check=True) - else: - apt.install(["libegl1-mesa-dev"], update=True, check=True) + apt.install_substitutes(["libegl-dev"], ["libegl1-mesa-dev"], update=True, check=True) pacman = package_manager.PacMan(self) pacman.install(["libglvnd"], update=True, check=True) @@ -69,10 +47,7 @@ def system_requirements(self): pkg.install(["libglvnd"], 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" - 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 6e757c6f87da5..c035b5ceb11c3 100644 --- a/recipes/eigen/all/conandata.yml +++ b/recipes/eigen/all/conandata.yml @@ -12,6 +12,11 @@ sources: url: "https://gitlab.com/libeigen/eigen/-/archive/3.3.7/eigen-3.3.7.tar.bz2" sha256: "685adf14bd8e9c015b78097c1dc22f2f01343756f196acdc76a678e1ae352e11" patches: + "3.4.0": + - patch_file: "patches/3.4.0-0001-vec-reduce-half.patch" + patch_description: "Fix vectorized reductions compilation errors for Eigen::half" + patch_type: "bugfix" + patch_source: "https://gitlab.com/libeigen/eigen/-/commit/b0fe14213ec4c8615de485fe4c2bcd4bab0cbd19.patch" "3.3.9": - patch_file: "patches/0002-cmake-minimum-required.patch" patch_description: "CMake: Move cmake_minimum_required() before project()" diff --git a/recipes/eigen/all/conanfile.py b/recipes/eigen/all/conanfile.py index e988fa6d4d9e5..c97c160c28920 100644 --- a/recipes/eigen/all/conanfile.py +++ b/recipes/eigen/all/conanfile.py @@ -12,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 = ("algebra", "linear-algebra", "matrix", "vector", "numerical") + topics = ("algebra", "linear-algebra", "matrix", "vector", "numerical", "header-only") + package_type = "header-library" 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" diff --git a/recipes/eigen/all/patches/3.4.0-0001-vec-reduce-half.patch b/recipes/eigen/all/patches/3.4.0-0001-vec-reduce-half.patch new file mode 100644 index 0000000000000..3ab79a576da93 --- /dev/null +++ b/recipes/eigen/all/patches/3.4.0-0001-vec-reduce-half.patch @@ -0,0 +1,49 @@ +From b0fe14213ec4c8615de485fe4c2bcd4bab0cbd19 Mon Sep 17 00:00:00 2001 +From: Alex Druinsky +Date: Wed, 20 Oct 2021 16:03:12 -0700 +Subject: [PATCH] Fix vectorized reductions for Eigen::half + +Fixes compiler errors in expressions that look like + + Eigen::Matrix::Random().maxCoeff() + +The error comes from the code that creates the initial value for +vectorized reductions. The fix is to specify the scalar type of the +reduction's initial value. + +The cahnge is necessary for Eigen::half because unlike other types, +Eigen::half scalars cannot be implicitly created from integers. + + +(cherry picked from commit d0e3791b1a0e2db9edd5f1d1befdb2ac5a40efe0) +--- + Eigen/src/Core/PartialReduxEvaluator.h | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/Eigen/src/Core/PartialReduxEvaluator.h b/Eigen/src/Core/PartialReduxEvaluator.h +index 29abf35b99..17c06f0783 100644 +--- a/Eigen/src/Core/PartialReduxEvaluator.h ++++ b/Eigen/src/Core/PartialReduxEvaluator.h +@@ -54,12 +54,17 @@ struct packetwise_redux_traits + /* Value to be returned when size==0 , by default let's return 0 */ + template + EIGEN_DEVICE_FUNC +-PacketType packetwise_redux_empty_value(const Func& ) { return pset1(0); } ++PacketType packetwise_redux_empty_value(const Func& ) { ++ const typename unpacket_traits::type zero(0); ++ return pset1(zero); ++} + + /* For products the default is 1 */ + template + EIGEN_DEVICE_FUNC +-PacketType packetwise_redux_empty_value(const scalar_product_op& ) { return pset1(1); } ++PacketType packetwise_redux_empty_value(const scalar_product_op& ) { ++ return pset1(Scalar(1)); ++} + + /* Perform the actual reduction */ + template= "0.186": - if self.settings.compiler in ["Visual Studio", "apple-clang", "msvc"]: - raise ConanInvalidConfiguration("Compiler %s not supported. " - "elfutils only supports gcc and clang" % self.settings.compiler) - else: - if self.settings.compiler in ["Visual Studio", "clang", "apple-clang", "msvc"]: - raise ConanInvalidConfiguration("Compiler %s not supported. " - "elfutils only supports gcc" % self.settings.compiler) - if self.settings.compiler != "gcc": - self.output.warn("Compiler %s is not gcc." % self.settings.compiler) + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - self.requires("zlib/1.2.12") + self.requires("zlib/[>=1.2.11 <2]") if self.options.with_sqlite3: - self.requires("sqlite3/3.38.5") + self.requires("sqlite3/3.44.2") if self.options.with_bzlib: self.requires("bzip2/1.0.8") if self.options.with_lzma: - self.requires("xz_utils/5.2.5") + self.requires("xz_utils/5.4.5") + if self.options.get_safe("with_zstd"): + self.requires("zstd/1.5.5") if self.options.get_safe("libdebuginfod"): - self.requires("libcurl/7.83.0") + self.requires("libcurl/[>=7.78.0 <9]") if self.options.debuginfod: - # FIXME: missing recipe for libmicrohttpd - raise ConanInvalidConfiguration("libmicrohttpd is not available (yet) on CCI") - - @property - def _settings_build(self): - return getattr(self, "settings_build", self.settings) + self.requires("libmicrohttpd/0.9.75") def build_requirements(self): - self.build_requires("automake/1.16.4") + self.tool_requires("gettext/0.22.5") + self.tool_requires("automake/1.16.5") self.build_requires("m4/1.4.19") self.build_requires("flex/2.6.4") - self.build_requires("bison/3.7.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("bison/3.8.2") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/2.0.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 validate(self): + # Note that elfutils cannot be built on macOS + # Example Error: "configure: error: __thread support required" + # Reference: https://stackoverflow.com/questions/72372589/elfutils-build-error-on-mac-configure-error-thread-support-required + if self.settings.os == "Macos": + raise ConanInvalidConfiguration("elfutils does not support macOS.") + + if Version(self.version) >= "0.186": + if self.settings.compiler == "apple-clang" or is_msvc(self): + raise ConanInvalidConfiguration(f"Your compiler {self.settings.compiler} is not supported. " + "elfutils only supports GCC and Clang.") + else: + if self.settings.compiler in ("clang", "apple-clang") or is_msvc(self): + raise ConanInvalidConfiguration(f"Your compiler {self.settings.compiler} is not supported. " + "elfutils only supports GCC.") + if self.settings.compiler != "gcc": + self.output.warning(f"Your compiler {self.settings.compiler} is not GCC.") + 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: - args = [ - "--disable-werror", - "--enable-static={}".format("no" if self.options.shared else "yes"), - "--enable-deterministic-archives", - "--enable-silent-rules", - "--with-zlib", - "--with-bzlib" if self.options.with_bzlib else "--without-bzlib", - "--with-lzma" if self.options.with_lzma else "--without-lzma", - "--enable-debuginfod" if self.options.debuginfod else "--disable-debuginfod", - ] - if tools.Version(self.version) >= "0.186": - args.append("--enable-libdebuginfod" if self.options.libdebuginfod else "--disable-libdebuginfod") - args.append('BUILD_STATIC={}'.format("0" if self.options.shared else "1")) - - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - 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): + env = VirtualBuildEnv(self) + env.generate() + tc = AutotoolsToolchain(self) + tc.configure_args.extend([ + "--disable-werror", + "--enable-static={}".format("no" if self.options.shared else "yes"), + "--enable-deterministic-archives", + "--enable-silent-rules", + "--with-zlib", + "--with-bzlib" if self.options.with_bzlib else "--without-bzlib", + "--with-lzma" if self.options.with_lzma else "--without-lzma", + "--with-zstd" if self.options.get_safe("with_zstd") else "--without-zstd", + "--enable-debuginfod" if self.options.debuginfod else "--disable-debuginfod", + ]) + if Version(self.version) >= "0.186": + tc.configure_args.append("--enable-libdebuginfod" if self.options.libdebuginfod else "--disable-libdebuginfod") + tc.configure_args.append(f"BUILD_STATIC={'0' if self.options.shared else '1'}") + if self.options.get_safe("with_zstd"): + # ./configure ignores system_libs + tc.extra_ldflags.append("-pthread") + tc.generate() + deps = AutotoolsDeps(self) + deps.generate() + deps = PkgConfigDeps(self) + deps.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + replace_in_file(self, os.path.join(self.source_folder, "config", "eu.am"), + "-Werror", "", strict=False) 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("autoreconf -fiv") - autotools = self._configure_autotools() + self._patch_sources() + autotools = Autotools(self) + autotools.autoreconf(args=["-fiv"]) + 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, "etc")) - 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, "etc")) + 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")) 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, "lib"), "*.so.1") - + rm(self, "*.so", os.path.join(self.package_folder, "lib")) + rm(self, "*.so.1", os.path.join(self.package_folder, "lib")) + def package_info(self): # library components self.cpp_info.components["libelf"].libs = ["elf"] self.cpp_info.components["libelf"].requires = ["zlib::zlib"] - - self.cpp_info.components["libdw"].libs = ["dw"] - self.cpp_info.components["libdw"].requires = ["libelf", "zlib::zlib"] + self.cpp_info.components["libelf"].set_property("pkg_config_name", "libelf") if self.options.with_bzlib: - self.cpp_info.components["libdw"].requires.append("bzip2::bzip2") + self.cpp_info.components["libelf"].requires.append("bzip2::bzip2") if self.options.with_lzma: - self.cpp_info.components["libdw"].requires.append("xz_utils::xz_utils") + self.cpp_info.components["libelf"].requires.append("xz_utils::xz_utils") + if self.options.get_safe("with_zstd"): + self.cpp_info.components["libelf"].requires.append("zstd::zstd") + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["libelf"].system_libs.append("pthread") + + self.cpp_info.components["libdw"].libs = ["dw"] + self.cpp_info.components["libdw"].requires = ["libelf"] + self.cpp_info.components["libdw"].set_property("pkg_config_name", "libdw") + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["libdw"].system_libs.extend(["dl"]) self.cpp_info.components["libasm"].includedirs = ["include/elfutils"] self.cpp_info.components["libasm"].libs = ["asm"] @@ -157,79 +194,83 @@ def package_info(self): if self.options.get_safe("libdebuginfod"): self.cpp_info.components["libdebuginfod"].libs = ["debuginfod"] self.cpp_info.components["libdebuginfod"].requires = ["libcurl::curl"] + self.cpp_info.components["libdebuginfod"].set_property("pkg_config_name", "libdebuginfod") # utilities bin_path = os.path.join(self.package_folder, "bin") + lib_path = os.path.join(self.package_folder, "lib") self.output.info("Appending PATH env var with : {}".format(bin_path)) - self.env_info.PATH.append(bin_path) + self.env_info.PATH.append(bin_path) # Conan V1 + self.env_info.LD_LIBRARY_PATH.append(lib_path) # Conan V1 + self.buildenv_info.append_path("PATH", bin_path) # Conan V2 + self.buildenv_info.append_path("LD_LIBRARY_PATH", lib_path) bin_ext = ".exe" if self.settings.os == "Windows" else "" - - addr2line = tools.unix_path(os.path.join(self.package_folder, "bin", "eu-addr2line" + bin_ext)) + + addr2line = unix_path(self, os.path.join(self.package_folder, "bin", "eu-addr2line" + bin_ext)) self.output.info("Setting ADDR2LINE to {}".format(addr2line)) self.env_info.ADDR2LINE = addr2line - ar = tools.unix_path(os.path.join(self.package_folder, "bin", "eu-ar" + bin_ext)) + ar = unix_path(self, os.path.join(self.package_folder, "bin", "eu-ar" + bin_ext)) self.output.info("Setting AR to {}".format(ar)) self.env_info.AR = ar - elfclassify = tools.unix_path(os.path.join(self.package_folder, "bin", "eu-elfclassify" + bin_ext)) + elfclassify = unix_path(self, os.path.join(self.package_folder, "bin", "eu-elfclassify" + bin_ext)) self.output.info("Setting ELFCLASSIFY to {}".format(elfclassify)) self.env_info.ELFCLASSIFY = elfclassify - elfcmp = tools.unix_path(os.path.join(self.package_folder, "bin", "eu-elfcmp" + bin_ext)) + elfcmp = unix_path(self, os.path.join(self.package_folder, "bin", "eu-elfcmp" + bin_ext)) self.output.info("Setting ELFCMP to {}".format(elfcmp)) self.env_info.ELFCMP = elfcmp - elfcompress = tools.unix_path(os.path.join(self.package_folder, "bin", "eu-elfcompress" + bin_ext)) + elfcompress = unix_path(self, os.path.join(self.package_folder, "bin", "eu-elfcompress" + bin_ext)) self.output.info("Setting ELFCOMPRESS to {}".format(elfcompress)) self.env_info.ELFCOMPRESS = elfcompress - elflint = tools.unix_path(os.path.join(self.package_folder, "bin", "eu-elflint" + bin_ext)) + elflint = unix_path(self, os.path.join(self.package_folder, "bin", "eu-elflint" + bin_ext)) self.output.info("Setting ELFLINT to {}".format(elflint)) self.env_info.ELFLINT = elflint - findtextrel = tools.unix_path(os.path.join(self.package_folder, "bin", "eu-findtextrel" + bin_ext)) + findtextrel = unix_path(self, os.path.join(self.package_folder, "bin", "eu-findtextrel" + bin_ext)) self.output.info("Setting FINDTEXTREL to {}".format(findtextrel)) self.env_info.FINDTEXTREL = findtextrel - make_debug_archive = tools.unix_path(os.path.join(self.package_folder, "bin", "eu-make-debug-archive" + bin_ext)) + make_debug_archive = unix_path(self, os.path.join(self.package_folder, "bin", "eu-make-debug-archive" + bin_ext)) self.output.info("Setting MAKE_DEBUG_ARCHIVE to {}".format(make_debug_archive)) self.env_info.MAKE_DEBUG_ARCHIVE = make_debug_archive - nm = tools.unix_path(os.path.join(self.package_folder, "bin", "eu-nm" + bin_ext)) + nm = unix_path(self, os.path.join(self.package_folder, "bin", "eu-nm" + bin_ext)) self.output.info("Setting NM to {}".format(nm)) self.env_info.NM = nm - objdump = tools.unix_path(os.path.join(self.package_folder, "bin", "eu-objdump" + bin_ext)) + objdump = unix_path(self, os.path.join(self.package_folder, "bin", "eu-objdump" + bin_ext)) self.output.info("Setting OBJDUMP to {}".format(objdump)) self.env_info.OBJDUMP = objdump - ranlib = tools.unix_path(os.path.join(self.package_folder, "bin", "eu-ranlib" + bin_ext)) + ranlib = unix_path(self, os.path.join(self.package_folder, "bin", "eu-ranlib" + bin_ext)) self.output.info("Setting RANLIB to {}".format(ranlib)) self.env_info.RANLIB = ranlib - readelf = tools.unix_path(os.path.join(self.package_folder, "bin", "eu-readelf" + bin_ext)) + readelf = unix_path(self, os.path.join(self.package_folder, "bin", "eu-readelf" + bin_ext)) self.output.info("Setting READELF to {}".format(readelf)) self.env_info.READELF = readelf - size = tools.unix_path(os.path.join(self.package_folder, "bin", "eu-size" + bin_ext)) + size = unix_path(self, os.path.join(self.package_folder, "bin", "eu-size" + bin_ext)) self.output.info("Setting SIZE to {}".format(size)) self.env_info.SIZE = size - stack = tools.unix_path(os.path.join(self.package_folder, "bin", "eu-stack" + bin_ext)) + stack = unix_path(self, os.path.join(self.package_folder, "bin", "eu-stack" + bin_ext)) self.output.info("Setting STACK to {}".format(stack)) self.env_info.STACK = stack - strings = tools.unix_path(os.path.join(self.package_folder, "bin", "eu-strings" + bin_ext)) + strings = unix_path(self, os.path.join(self.package_folder, "bin", "eu-strings" + bin_ext)) self.output.info("Setting STRINGS to {}".format(strings)) self.env_info.STRINGS = strings - strip = tools.unix_path(os.path.join(self.package_folder, "bin", "eu-strip" + bin_ext)) + strip = unix_path(self, os.path.join(self.package_folder, "bin", "eu-strip" + bin_ext)) self.output.info("Setting STRIP to {}".format(strip)) self.env_info.STRIP = strip - unstrip = tools.unix_path(os.path.join(self.package_folder, "bin", "eu-unstrip" + bin_ext)) + unstrip = unix_path(self, os.path.join(self.package_folder, "bin", "eu-unstrip" + bin_ext)) self.output.info("Setting UNSTRIP to {}".format(unstrip)) self.env_info.UNSTRIP = unstrip - diff --git a/recipes/elfutils/all/patches/0.180-0001-Add-enable-werror-configure-option.patch b/recipes/elfutils/all/patches/0.180-0001-Add-enable-werror-configure-option.patch deleted file mode 100644 index 332c215103f1f..0000000000000 --- a/recipes/elfutils/all/patches/0.180-0001-Add-enable-werror-configure-option.patch +++ /dev/null @@ -1,41 +0,0 @@ ---- config/eu.am -+++ config/eu.am -@@ -73,7 +73,6 @@ AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat=2 \ - -Wold-style-definition -Wstrict-prototypes -Wtrampolines \ - $(LOGICAL_OP_WARNING) $(DUPLICATED_COND_WARNING) \ - $(NULL_DEREFERENCE_WARNING) $(IMPLICIT_FALLTHROUGH_WARNING) \ -- $(if $($(*F)_no_Werror),,-Werror) \ - $(if $($(*F)_no_Wunused),,-Wunused -Wextra) \ - $(if $($(*F)_no_Wstack_usage),,$(STACK_USAGE_WARNING)) \ - $(if $($(*F)_no_Wpacked_not_aligned),-Wno-packed-not-aligned,) \ -@@ -83,7 +82,6 @@ AM_CXXFLAGS = -std=c++11 -Wall -Wshadow \ - -Wtrampolines \ - $(LOGICAL_OP_WARNING) $(DUPLICATED_COND_WARNING) \ - $(NULL_DEREFERENCE_WARNING) $(IMPLICIT_FALLTHROUGH_WARNING) \ -- $(if $($(*F)_no_Werror),,-Werror) \ - $(if $($(*F)_no_Wunused),,-Wunused -Wextra) \ - $(if $($(*F)_no_Wstack_usage),,$(STACK_USAGE_WARNING)) \ - $(if $($(*F)_no_Wpacked_not_aligned),-Wno-packed-not-aligned,) \ -diff --git a/source/source_subfolder/configure.ac b/source/source_subfolder/configure.ac -index 74cc749..634858d 100644 ---- configure.ac -+++ configure.ac -@@ -294,6 +294,18 @@ - esac - AC_SUBST([DEBUGPRED], $use_debugpred_val) - -+dnl Enable -Werror -+AC_MSG_CHECKING([whether to treat warnings as errors]) -+AC_ARG_ENABLE([werror], -+AS_HELP_STRING([--enable-werror],[treat warnings as errors]), -+[werror=$enableval], [werror=yes]) -+if test "x$werror" = xyes; then -+ AC_MSG_RESULT([yes]) -+ CFLAGS="$CFLAGS -Werror" -+else -+ AC_MSG_RESULT([no]) -+fi -+ - dnl Enable gprof suport. - AC_ARG_ENABLE([gprof], - AS_HELP_STRING([--enable-gprof],[build binaries with gprof support]), [use_gprof=$enableval], [use_gprof=no]) diff --git a/recipes/elfutils/all/patches/0.180-0001-remove-werror-configure-option.patch b/recipes/elfutils/all/patches/0.180-0001-remove-werror-configure-option.patch new file mode 100644 index 0000000000000..a5b39f30d22c8 --- /dev/null +++ b/recipes/elfutils/all/patches/0.180-0001-remove-werror-configure-option.patch @@ -0,0 +1,23 @@ +diff --git a/source/source_subfolder/configure.ac b/source/source_subfolder/configure.ac +index 74cc749..634858d 100644 +--- configure.ac ++++ configure.ac +@@ -294,6 +294,18 @@ + esac + AC_SUBST([DEBUGPRED], $use_debugpred_val) + ++dnl Enable -Werror ++AC_MSG_CHECKING([whether to treat warnings as errors]) ++AC_ARG_ENABLE([werror], ++AS_HELP_STRING([--enable-werror],[treat warnings as errors]), ++[werror=$enableval], [werror=yes]) ++if test "x$werror" = xyes; then ++ AC_MSG_RESULT([yes]) ++ CFLAGS="$CFLAGS -Werror" ++else ++ AC_MSG_RESULT([no]) ++fi ++ + dnl Enable gprof suport. + AC_ARG_ENABLE([gprof], + AS_HELP_STRING([--enable-gprof],[build binaries with gprof support]), [use_gprof=$enableval], [use_gprof=no]) diff --git a/recipes/elfutils/all/patches/0.186-0001-Add-enable-werror-configure-option.patch b/recipes/elfutils/all/patches/0.186-0001-Add-enable-werror-configure-option.patch deleted file mode 100644 index 789694c1fe951..0000000000000 --- a/recipes/elfutils/all/patches/0.186-0001-Add-enable-werror-configure-option.patch +++ /dev/null @@ -1,41 +0,0 @@ ---- config/eu.am -+++ config/eu.am -@@ -91,7 +91,6 @@ AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat=2 \ - -Wold-style-definition -Wstrict-prototypes $(TRAMPOLINES_WARNING) \ - $(LOGICAL_OP_WARNING) $(DUPLICATED_COND_WARNING) \ - $(NULL_DEREFERENCE_WARNING) $(IMPLICIT_FALLTHROUGH_WARNING) \ -- $(if $($(*F)_no_Werror),,-Werror) \ - $(if $($(*F)_no_Wunused),,-Wunused -Wextra) \ - $(if $($(*F)_no_Wstack_usage),,$(STACK_USAGE_WARNING)) \ - $(if $($(*F)_no_Wpacked_not_aligned),$(NO_PACKED_NOT_ALIGNED_WARNING),) \ -@@ -101,7 +101,6 @@ AM_CXXFLAGS = -std=c++11 -Wall -Wshadow \ - $(TRAMPOLINES_WARNING) \ - $(LOGICAL_OP_WARNING) $(DUPLICATED_COND_WARNING) \ - $(NULL_DEREFERENCE_WARNING) $(IMPLICIT_FALLTHROUGH_WARNING) \ -- $(if $($(*F)_no_Werror),,-Werror) \ - $(if $($(*F)_no_Wunused),,-Wunused -Wextra) \ - $(if $($(*F)_no_Wstack_usage),,$(STACK_USAGE_WARNING)) \ - $(if $($(*F)_no_Wpacked_not_aligned),$(NO_PACKED_NOT_ALIGNED_WARNING),) \ -diff --git a/source/source_subfolder/configure.ac b/source/source_subfolder/configure.ac -index 74cc749..634858d 100644 ---- configure.ac -+++ configure.ac -@@ -262,6 +262,18 @@ - esac - AC_SUBST([DEBUGPRED], $use_debugpred_val) - -+dnl Enable -Werror -+AC_MSG_CHECKING([whether to treat warnings as errors]) -+AC_ARG_ENABLE([werror], -+AS_HELP_STRING([--enable-werror],[treat warnings as errors]), -+[werror=$enableval], [werror=yes]) -+if test "x$werror" = xyes; then -+ AC_MSG_RESULT([yes]) -+ CFLAGS="$CFLAGS -Werror" -+else -+ AC_MSG_RESULT([no]) -+fi -+ - dnl Enable gprof support. - AC_ARG_ENABLE([gprof], - AS_HELP_STRING([--enable-gprof],[build binaries with gprof support]), [use_gprof=$enableval], [use_gprof=no]) diff --git a/recipes/elfutils/all/patches/0.186-0001-remove-werror-configure-option.patch b/recipes/elfutils/all/patches/0.186-0001-remove-werror-configure-option.patch new file mode 100644 index 0000000000000..0cf39dab8bc5b --- /dev/null +++ b/recipes/elfutils/all/patches/0.186-0001-remove-werror-configure-option.patch @@ -0,0 +1,23 @@ +diff --git a/source/source_subfolder/configure.ac b/source/source_subfolder/configure.ac +index 74cc749..634858d 100644 +--- configure.ac ++++ configure.ac +@@ -262,6 +262,18 @@ + esac + AC_SUBST([DEBUGPRED], $use_debugpred_val) + ++dnl Enable -Werror ++AC_MSG_CHECKING([whether to treat warnings as errors]) ++AC_ARG_ENABLE([werror], ++AS_HELP_STRING([--enable-werror],[treat warnings as errors]), ++[werror=$enableval], [werror=yes]) ++if test "x$werror" = xyes; then ++ AC_MSG_RESULT([yes]) ++ CFLAGS="$CFLAGS -Werror" ++else ++ AC_MSG_RESULT([no]) ++fi ++ + dnl Enable gprof support. + AC_ARG_ENABLE([gprof], + AS_HELP_STRING([--enable-gprof],[build binaries with gprof support]), [use_gprof=$enableval], [use_gprof=no]) diff --git a/recipes/elfutils/all/patches/0.189-0002-add-enable-static-option-to-configure.patch b/recipes/elfutils/all/patches/0.189-0002-add-enable-static-option-to-configure.patch new file mode 100644 index 0000000000000..ae598f96a0713 --- /dev/null +++ b/recipes/elfutils/all/patches/0.189-0002-add-enable-static-option-to-configure.patch @@ -0,0 +1,32 @@ +diff --git a/configure.ac b/configure.ac +index 6e881fa..3b56d3a 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -414,8 +414,26 @@ AS_HELP_STRING([--enable-install-elfh],[install elf.h in include dir]), + [install_elfh=$enableval], [install_elfh=no]) + AM_CONDITIONAL(INSTALL_ELFH, test "$install_elfh" = yes) + ++AC_MSG_CHECKING([whether to build elfutils as a static library]) ++AC_ARG_ENABLE([static], ++AS_HELP_STRING([--enable-static],[build elfutils as static libraries]), ++[static_elfutils=$enableval], [static_elfutils=no]) ++ ++static_elfutils=$static_elfutils ++ ++if test "$static_elfutils" = yes ; then ++ AC_MSG_RESULT([yes]) ++else ++ if test "$use_gprof" = yes -o "$use_gcov" = yes ; then ++ AC_MSG_ERROR([cannot build a shared elfutils with gprof or gcov enabled]) ++ fi ++ AC_MSG_RESULT([no]) ++fi ++ ++ ++ + AM_CONDITIONAL(BUILD_STATIC, [dnl +-test "$use_gprof" = yes -o "$use_gcov" = yes]) ++test "$static_elfutils" = yes]) + + AC_ARG_ENABLE([tests-rpath], + AS_HELP_STRING([--enable-tests-rpath],[build $ORIGIN-using rpath into tests]), diff --git a/recipes/elfutils/all/test_package/CMakeLists.txt b/recipes/elfutils/all/test_package/CMakeLists.txt index 7b9b613cbb24a..5caca1b8ef2e8 100644 --- a/recipes/elfutils/all/test_package/CMakeLists.txt +++ b/recipes/elfutils/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(elfutils REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE elfutils::elfutils) diff --git a/recipes/elfutils/all/test_package/conanfile.py b/recipes/elfutils/all/test_package/conanfile.py index 3a92de2cf5935..ffc4801c9d705 100644 --- a/recipes/elfutils/all/test_package/conanfile.py +++ b/recipes/elfutils/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,14 +21,11 @@ def build(self): cmake.build() def test(self): - self.run("eu-ar --version", run_environment=True) - - bin_path = os.path.join("bin", "test_package") + self.run("eu-ar --version", env="conanbuild") + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") archive_path = "archive.a" - - self.run("eu-ar r {0} {1}".format(archive_path, bin_path), run_environment=True) - self.run("eu-objdump -d {0}".format(bin_path), run_environment=True) - if not tools.cross_building(self.settings): - self.run("{} {}".format(bin_path, bin_path), run_environment=True) - - self.run("{} {}".format(bin_path, archive_path), run_environment=True) + self.run(f"eu-ar r {archive_path} {bin_path}", env="conanbuild") + self.run(f"eu-objdump -d {bin_path}", env="conanbuild") + if can_run(self): + self.run(f"{bin_path} {bin_path}", env="conanrun") + self.run(f"{bin_path} {archive_path}", env="conanrun") diff --git a/recipes/elfutils/all/test_v1_package/CMakeLists.txt b/recipes/elfutils/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/elfutils/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/elfutils/all/test_v1_package/conanfile.py b/recipes/elfutils/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..a4c0641d885f0 --- /dev/null +++ b/recipes/elfutils/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.configure() + cmake.build() + + def test(self): + self.run("eu-ar --version", run_environment=True) + bin_path = os.path.join("bin", "test_package") + archive_path = "archive.a" + self.run(f"eu-ar r {archive_path} {bin_path}", run_environment=True) + self.run(f"eu-objdump -d {bin_path}", run_environment=True) + if not tools.cross_building(self): + self.run(f"{bin_path} {bin_path}", run_environment=True) + self.run(f"{bin_path} {archive_path}", run_environment=True) diff --git a/recipes/elfutils/config.yml b/recipes/elfutils/config.yml index 837391aa2d05d..2b63e87901919 100644 --- a/recipes/elfutils/config.yml +++ b/recipes/elfutils/config.yml @@ -1,4 +1,8 @@ versions: + "0.190": + folder: all + "0.189": + folder: all "0.186": folder: all "0.180": diff --git a/recipes/embag/all/CMakeLists.txt b/recipes/embag/all/CMakeLists.txt new file mode 100644 index 0000000000000..6638694bdd2b6 --- /dev/null +++ b/recipes/embag/all/CMakeLists.txt @@ -0,0 +1,33 @@ +cmake_minimum_required(VERSION 3.15) +project(embag LANGUAGES CXX) + +find_package(Boost REQUIRED COMPONENTS iostreams headers) +find_package(lz4 REQUIRED CONFIG) +find_package(BZip2 REQUIRED CONFIG) + +file(GLOB_RECURSE embag_SOURCES "lib/*.cc") +add_library(embag ${embag_SOURCES}) +set_target_properties(embag PROPERTIES + # embag does not export any symbols otherwise + WINDOWS_EXPORT_ALL_SYMBOLS ON +) +target_compile_features(embag PUBLIC cxx_std_14) +target_link_libraries(embag PUBLIC + Boost::iostreams + Boost::headers + lz4::lz4 + BZip2::BZip2 +) + +if (MSVC) + # For a #if __cplusplus < 201402L check in lib/util.h + target_compile_options(embag PRIVATE /Zc:__cplusplus) +endif() + +install(TARGETS embag) +install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib/ + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/embag + FILES_MATCHING + PATTERN "*.h" + PATTERN "*.hpp" +) diff --git a/recipes/embag/all/conandata.yml b/recipes/embag/all/conandata.yml new file mode 100644 index 0000000000000..6df20cbf9a5ef --- /dev/null +++ b/recipes/embag/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.0.42": + url: "https://github.com/embarktrucks/embag/archive/refs/tags/0.0.42.tar.gz" + sha256: "60b22ba9355528040046b7e2c3ee968798ad5773a9eb7a1d13cf33dc47e2adec" diff --git a/recipes/embag/all/conanfile.py b/recipes/embag/all/conanfile.py new file mode 100644 index 0000000000000..3d3e19b6eb19b --- /dev/null +++ b/recipes/embag/all/conanfile.py @@ -0,0 +1,91 @@ +import os + +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 get, copy, rm +from conan.tools.microsoft import is_msvc + +required_conan_version = ">=1.53.0" + + +class EmbagConan(ConanFile): + name = "embag" + description = "Schema and dependency free ROS bag reader" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/embarktrucks/embag" + topics = ("rosbag", "ros", "robotics") + package_type = "library" + 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 + + def export_sources(self): + copy(self, "CMakeLists.txt", + src=self.recipe_folder, + dst=os.path.join(self.export_sources_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 layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + # INFO: embag.h includes boost/variant.hpp + self.requires("boost/1.82.0", transitive_headers=True) + # INFO: decompression.h includes lz4frame.h + self.requires("lz4/1.9.4", transitive_headers=True) + # INFO: ros_bag_types.h includes bzlib.h + self.requires("bzip2/1.0.8", transitive_headers=True) + + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + + def source(self): + 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): + 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() + rm(self, "*.pdb", self.package_folder, recursive=True) + + def package_info(self): + self.cpp_info.libs = ["embag"] + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs = ["m"] + if is_msvc(self): + # For a #if __cplusplus < 201402L check in lib/util.h, which is a public header + self.cpp_info.cxxflags.append("/Zc:__cplusplus") diff --git a/recipes/embag/all/test_package/CMakeLists.txt b/recipes/embag/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..27b09cd59a901 --- /dev/null +++ b/recipes/embag/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(embag REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE embag::embag) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/embag/all/test_package/conanfile.py b/recipes/embag/all/test_package/conanfile.py new file mode 100644 index 0000000000000..ef5d7042163ec --- /dev/null +++ b/recipes/embag/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/embag/all/test_package/test_package.cpp b/recipes/embag/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..c8563d402b2b7 --- /dev/null +++ b/recipes/embag/all/test_package/test_package.cpp @@ -0,0 +1,18 @@ +#include +#include + +#include + +int main() { + Embag::View view{}; + // Do not load any bag file for testing + // view.addBag("xyz.bag"); + const auto start_time = view.getStartTime(); + const auto end_time = view.getEndTime(); + std::cout << "Start time is " << start_time.secs + start_time.nsecs * 1e-9 << std::endl; + std::cout << "End time is " << end_time.secs + end_time.nsecs * 1e-9 << std::endl; + for (const auto &message : view.getMessages()) { + message->print(); + } + return EXIT_SUCCESS; +} diff --git a/recipes/embag/config.yml b/recipes/embag/config.yml new file mode 100644 index 0000000000000..97f7bce9d3b04 --- /dev/null +++ b/recipes/embag/config.yml @@ -0,0 +1,3 @@ +versions: + "0.0.42": + folder: all diff --git a/recipes/embedded_ringbuf_cpp/all/conandata.yml b/recipes/embedded_ringbuf_cpp/all/conandata.yml new file mode 100644 index 0000000000000..123dfa0258590 --- /dev/null +++ b/recipes/embedded_ringbuf_cpp/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.3": + url: "https://github.com/wizard97/Embedded_RingBuf_CPP/archive/refs/tags/1.3.tar.gz" + sha256: "52340d9762e48b507810458507105c79c57c4d9bff2a9faec6c48bbf65ed2290" diff --git a/recipes/embedded_ringbuf_cpp/all/conanfile.py b/recipes/embedded_ringbuf_cpp/all/conanfile.py new file mode 100644 index 0000000000000..177f5ad4ff785 --- /dev/null +++ b/recipes/embedded_ringbuf_cpp/all/conanfile.py @@ -0,0 +1,47 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +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.52.0" + +class EmbeddedRingbufcppConan(ConanFile): + name = "embedded_ringbuf_cpp" + description = "A simple C++ Ring (Circular) Buffer Queuing Library for Programming with Arduino's and other Embedded platforms" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/wizard97/Embedded_RingBuf_CPP/" + topics = ("ring buffer", "circular buffer", "queue", "data-structures", "header-only") + + package_type = "header-library" + 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 validate(self): + # embedded_ringbuf_cpp uses #warning preprocessor directive + if is_msvc(self): + raise ConanInvalidConfiguration(f"{self.ref} doesn't support Visual Studio and msvc.") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def package(self): + copy(self, pattern="LICENSE.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, + pattern="RingBuf*.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/embedded_ringbuf_cpp/all/test_package/CMakeLists.txt b/recipes/embedded_ringbuf_cpp/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..ac26e4c63d05b --- /dev/null +++ b/recipes/embedded_ringbuf_cpp/all/test_package/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(embedded_ringbuf_cpp CONFIG REQUIRED) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE embedded_ringbuf_cpp::embedded_ringbuf_cpp) diff --git a/recipes/embedded_ringbuf_cpp/all/test_package/conanfile.py b/recipes/embedded_ringbuf_cpp/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/embedded_ringbuf_cpp/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/embedded_ringbuf_cpp/all/test_package/test_package.cpp b/recipes/embedded_ringbuf_cpp/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..c12de1cdf78c1 --- /dev/null +++ b/recipes/embedded_ringbuf_cpp/all/test_package/test_package.cpp @@ -0,0 +1,15 @@ +// size_t is needed for RingBufCPP +#include + +#include + +int main() { + RingBufCPP q; + + q.add(12); + + int tmp; + q.pull(&tmp); + + return 0; +} diff --git a/recipes/embedded_ringbuf_cpp/config.yml b/recipes/embedded_ringbuf_cpp/config.yml new file mode 100644 index 0000000000000..d2eb4ed4a511f --- /dev/null +++ b/recipes/embedded_ringbuf_cpp/config.yml @@ -0,0 +1,3 @@ +versions: + "1.3": + folder: all diff --git a/recipes/embree/all/conandata.yml b/recipes/embree/all/conandata.yml new file mode 100644 index 0000000000000..871010273df4a --- /dev/null +++ b/recipes/embree/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "4.3.3": + url: "https://github.com/embree/embree/archive/refs/tags/v4.3.3.tar.gz" + sha256: "8a3bc3c3e21aa209d9861a28f8ba93b2f82ed0dc93341dddac09f1f03c36ef2d" diff --git a/recipes/embree/all/conanfile.py b/recipes/embree/all/conanfile.py new file mode 100644 index 0000000000000..5dc630dc38bea --- /dev/null +++ b/recipes/embree/all/conanfile.py @@ -0,0 +1,126 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.apple import is_apple_os +from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout +from conan.tools.files import copy, get, rm, rmdir +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +from conan.tools.scm import Version +import os + +required_conan_version = ">=2.0.9" + +class EmbreeConan(ConanFile): + name = "embree" + description = "Intel's collection of high-performance ray tracing kernels." + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://embree.github.io/" + topics = ("embree", "raytracing", "rendering") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False] + } + + default_options = { + "shared": False, + "fPIC": True + } + implements = ["auto_shared_fpic"] + + @property + def _has_sse_avx(self): + return self.settings.arch in ["x86", "x86_64"] + + @property + def _has_neon(self): + return "arm" in self.settings.arch + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + if self.settings.os != "Emscripten": + self.requires("onetbb/2021.12.0") + + def validate(self): + check_min_cppstd(self, 14) + # See https://github.com/RenderKit/embree/blob/master/CMakeLists.txt#L538 + if ( + self.settings.compiler == "apple-clang" + and not self.options.shared + and Version(self.settings.compiler.version) >= "9.0" + ): + raise ConanInvalidConfiguration(f"{self.ref} static with apple-clang >=9 and multiple ISA (simd) is not supported") + + def source(self): + get(self, **self.conan_data["sources"][self.version], 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_INSTALL_DEPENDENCIES"] = False + tc.variables["EMBREE_TUTORIALS"] = False + tc.variables["EMBREE_BACKFACE_CULLING"] = False + tc.variables["EMBREE_IGNORE_INVALID_RAYS"] = False + tc.variables["EMBREE_ISPC_SUPPORT"] = False + tc.variables["EMBREE_TASKING_SYSTEM"] = "INTERNAL" if is_apple_os(self) or self.settings.os == "Emscripten" else "TBB" + tc.variables["EMBREE_MAX_ISA"] = "NONE" + tc.variables["EMBREE_ISA_NEON"] = self._has_neon + tc.variables["EMBREE_ISA_NEON2X"] = self._has_neon + tc.variables["EMBREE_ISA_SSE2"] = self._has_sse_avx + tc.variables["EMBREE_ISA_SSE42"] = self._has_sse_avx + # For Emscripten disable TBB and all ISAs. It will compile only for SSE + if self.settings.os == "Emscripten": + tc.variables["EMBREE_ISA_AVX"] = self._has_sse_avx + tc.variables["EMBREE_ISA_AVX2"] = self._has_sse_avx + tc.variables["EMBREE_ISA_AVX512"] = self._has_sse_avx and not is_msvc(self) + if is_msvc(self): + tc.variables["USE_STATIC_RUNTIME"] = is_msvc_static_runtime(self) + tc.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"), + ) + 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, "share")) + rm(self, "*.command", os.path.join(self.package_folder)) + rm(self, "*.cmake", os.path.join(self.package_folder)) + rm(self, "embree-vars.sh", os.path.join(self.package_folder)) + rm(self, "embree-vars.csh", os.path.join(self.package_folder)) + + # Remove MS runtime files + for dll_pattern_to_remove in ["concrt*.dll", "msvcp*.dll", "vcruntime*.dll"]: + rm(self, pattern=dll_pattern_to_remove, folder=os.path.join(self.package_folder, "bin"), recursive=True) + + def package_info(self): + self.cpp_info.libs = ["embree4"] + if not self.options.shared: + self.cpp_info.libs.extend(["sys", "math", "simd", "lexers", "tasking"]) + if self._has_sse_avx: + self.cpp_info.libs.extend(["embree_sse42", "embree_avx", "embree_avx2"]) + if not is_msvc(self): + self.cpp_info.libs.append("embree_avx512") + if self._has_neon: + self.cpp_info.libs.extend(["embree_avx2"]) + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["dl", "m", "pthread"]) diff --git a/recipes/embree/all/test_package/CMakeLists.txt b/recipes/embree/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..24a76f24afbfa --- /dev/null +++ b/recipes/embree/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(embree REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE embree::embree) diff --git a/recipes/embree/all/test_package/conanfile.py b/recipes/embree/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0a6bc68712d90 --- /dev/null +++ b/recipes/embree/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/embree/all/test_package/test_package.cpp b/recipes/embree/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..53ec64e813a94 --- /dev/null +++ b/recipes/embree/all/test_package/test_package.cpp @@ -0,0 +1,16 @@ +#include + +#include +#include + +int main() { + RTCDevice device = rtcNewDevice(NULL); + RTCScene scene = rtcNewScene(device); + RTCGeometry geom = rtcNewGeometry(device, RTC_GEOMETRY_TYPE_TRIANGLE); + + rtcReleaseGeometry(geom); + rtcReleaseScene(scene); + rtcReleaseDevice(device); + + return 0; +} \ No newline at end of file diff --git a/recipes/embree/config.yml b/recipes/embree/config.yml new file mode 100644 index 0000000000000..4582d013631e7 --- /dev/null +++ b/recipes/embree/config.yml @@ -0,0 +1,3 @@ +versions: + "4.3.3": + folder: all diff --git a/recipes/embree3/all/conandata.yml b/recipes/embree3/all/conandata.yml index 2254366a65cdf..231d0eaa13377 100644 --- a/recipes/embree3/all/conandata.yml +++ b/recipes/embree3/all/conandata.yml @@ -1,9 +1,9 @@ sources: "3.13.5": - url: "https://github.com/embree/embree/archive/v3.13.5.tar.gz" + url: "https://github.com/embree/embree/archive/refs/tags/v3.13.5.tar.gz" sha256: "b8c22d275d9128741265537c559d0ea73074adbf2f2b66b0a766ca52c52d665b" "3.13.3": - url: "https://github.com/embree/embree/archive/v3.13.3.tar.gz" + url: "https://github.com/embree/embree/archive/refs/tags/v3.13.3.tar.gz" sha256: "74ec785afb8f14d28ea5e0773544572c8df2e899caccdfc88509f1bfff58716f" "3.13.1": url: "https://github.com/embree/embree/archive/refs/tags/v3.13.1.tar.gz" @@ -15,20 +15,20 @@ 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_type: "portability" 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_type: "portability" 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_type: "portability" 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_type: "portability" patch_source: "https://github.com/embree/embree/pull/406" diff --git a/recipes/embree3/all/conanfile.py b/recipes/embree3/all/conanfile.py index f8e429587b3e0..326d9d376218a 100644 --- a/recipes/embree3/all/conanfile.py +++ b/recipes/embree3/all/conanfile.py @@ -1,15 +1,15 @@ 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, 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.52.0" +required_conan_version = ">=1.53.0" class EmbreeConan(ConanFile): @@ -20,6 +20,7 @@ class EmbreeConan(ConanFile): description = "Intel's collection of high-performance ray tracing kernels." homepage = "https://embree.github.io/" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -125,40 +126,36 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") def requirements(self): if self.options.with_tbb: - self.requires("onetbb/2021.6.0") + self.requires("onetbb/2021.7.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)) + raise ConanInvalidConfiguration(f"{self.ref} doesn't support {self.settings.arch}") - compiler_version = Version(self.info.settings.compiler.version) - if self.info.settings.compiler == "clang" and compiler_version < "4": + compiler_version = Version(self.settings.compiler.version) + if self.settings.compiler == "clang" and compiler_version < "4": raise ConanInvalidConfiguration("Clang < 4 is not supported") check_min_vs(self, 191) - if self.info.settings.os == "Linux" and self.info.settings.compiler == "clang" and self.info.settings.compiler.libcxx == "libc++": + if self.settings.os == "Linux" and self.settings.compiler == "clang" and self.settings.compiler.libcxx == "libc++": raise ConanInvalidConfiguration(f"{self.ref} cannot be built with clang libc++, use libstdc++ instead") - 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.settings.compiler == "apple-clang" and not self.options.shared and compiler_version >= "9.0" and self._num_isa > 1: + raise ConanInvalidConfiguration(f"{self.ref} 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): - 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/embree3/all/test_v1_package/CMakeLists.txt b/recipes/embree3/all/test_v1_package/CMakeLists.txt index 42932a8412566..0d20897301b68 100644 --- a/recipes/embree3/all/test_v1_package/CMakeLists.txt +++ b/recipes/embree3/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(embree REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE embree) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/emhash/all/conandata.yml b/recipes/emhash/all/conandata.yml new file mode 100644 index 0000000000000..4034de3bcdd95 --- /dev/null +++ b/recipes/emhash/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "cci.20240601": + url: "https://github.com/ktprime/emhash/archive/3efa77ef32786a033b379071fe8af3dc705736ca.tar.gz" + sha256: "db6c524f3acb487f88221aff75a9198700478ece4ea2a9a25b013ef7375bc819" diff --git a/recipes/emhash/all/conanfile.py b/recipes/emhash/all/conanfile.py new file mode 100644 index 0000000000000..7618a4de1e403 --- /dev/null +++ b/recipes/emhash/all/conanfile.py @@ -0,0 +1,49 @@ +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 EmhashConan(ConanFile): + name = "emhash" + description = "Fast and memory efficient c++ flat hash map/set" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/ktprime/emhash" + topics = ("flat", "map", "set", "hash", "header-only") + package_type = "header-library" + 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=self.source_folder, + excludes=["bench", "test", "thirdparty",] + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/emhash/all/test_package/CMakeLists.txt b/recipes/emhash/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..123ccacccfde9 --- /dev/null +++ b/recipes/emhash/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(emhash REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE emhash::emhash) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/emhash/all/test_package/conanfile.py b/recipes/emhash/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/emhash/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/emhash/all/test_package/test_package.cpp b/recipes/emhash/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..0fa8241e36634 --- /dev/null +++ b/recipes/emhash/all/test_package/test_package.cpp @@ -0,0 +1,48 @@ +#include +#include +#include +#include +#include + +#define EMH_EXT +#include "hash_table5.hpp" + +int main(void) { + // constructor + emhash5::HashMap m1(4); + m1.reserve(100); + for (int i = 1; i < 100; i++) + m1.emplace_unique(i, i); //key must be unique, performance is better than emplace, operator[]. + + auto no_value = m1.at(0); //no_value = 0; no exception throw!!!. only return zero for integer value. + + // list constructor + emhash5::HashMap m2 = { + {1, "foo"}, + {3, "bar"}, + {2, "baz"}, + }; + + auto* pvalue = m2.try_get(1); //return nullptr if key is not exist + if (m2.try_set(4, "for")) printf("set success"); + if (!m2.try_set(1, "new")) printf("set failed"); + std::string ovalue = m2.set_get(1, "new"); //ovalue = "foo" and m2[1] == "new" + + for(auto& p: m2) + std::cout << " " << p.first << " => " << p.second << '\n'; + + // copy constructor + emhash5::HashMap m3 = m2; + // move constructor + emhash5::HashMap m4 = std::move(m2); + + //insert. insert_unique. emplace + m2.insert_unique(4, "four"); + m2[4] = "four_again"; + m2.emplace(std::make_pair(4, "four")); + m2.insert({{6, "six"}, {5, "five"}}); + + // range constructor + std::vector, int>> v = { {0x12, 1}, {0x01,-1} }; + emhash5::HashMap, double> m5(v.begin(), v.end()); +} diff --git a/recipes/emhash/config.yml b/recipes/emhash/config.yml new file mode 100644 index 0000000000000..155d30b32fcf1 --- /dev/null +++ b/recipes/emhash/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20240601": + folder: all diff --git a/recipes/emio/all/conandata.yml b/recipes/emio/all/conandata.yml new file mode 100644 index 0000000000000..c3bda87372ad5 --- /dev/null +++ b/recipes/emio/all/conandata.yml @@ -0,0 +1,22 @@ +sources: + "0.8.0": + url: "https://github.com/Viatorus/emio/archive/0.8.0.tar.gz" + sha256: "86436eeb16cac7c7c74a7c1af9fe7bbbc1aa18d3d96e7bba9791c15ebe9ebdc7" + "0.7.0": + url: "https://github.com/viatorus/emio/archive/0.7.0.tar.gz" + sha256: "1ef5304964eee109c13477f2d84822ee474612475049a377b59e33a5fe05d7eb" + "0.6.1": + url: "https://github.com/viatorus/emio/archive/0.6.1.tar.gz" + sha256: "118bb67581d68b33d9764e016700014ad63b68520b5786c0d12036f33bcef0dc" + "0.6.0": + url: "https://github.com/viatorus/emio/archive/0.6.0.tar.gz" + sha256: "789c0c1b73d2add1caef9ffd90bc2dd0286e31a0f0f5dc12ff206eb32c394a98" + "0.5.0": + url: "https://github.com/viatorus/emio/archive/0.5.0.tar.gz" + sha256: "14cfa81d96db6ef74b8da7b5d2ffbd26535f2930d0d423e4fde7b526ddb3b308" + "0.4.0": + url: "https://github.com/viatorus/emio/archive/0.4.0.tar.gz" + sha256: "847198a37fbf9dcc00ac85fbc64b283e41a018f53c39363129a4bdb9939338a6" + "0.3.0": + url: "https://github.com/viatorus/emio/archive/0.3.0.tar.gz" + sha256: "d891d0a435a8b71eee78bba46b9abc3848b1c20d61eb747b6059adaf23acce1d" diff --git a/recipes/emio/all/conanfile.py b/recipes/emio/all/conanfile.py new file mode 100644 index 0000000000000..7785d5a02da74 --- /dev/null +++ b/recipes/emio/all/conanfile.py @@ -0,0 +1,62 @@ +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 EmioConan(ConanFile): + name = "emio" + description = "A character input/output library for embedded systems." + topics = ("format", "scan", "header-only") + homepage = "https://github.com/viatorus/emio" + url = "https://github.com/conan-io/conan-center-index" + license = "MIT" + settings = "os", "arch", "compiler", "build_type" + package_type = "header-library" + no_copy_source = True + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + @property + def _compilers_minimum_version(self): + return { + "gcc": "11", + "clang": "14", + "apple-clang": "14", + } + + @property + def _min_cppstd(self): + return 20 + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + + if is_msvc(self): + raise ConanInvalidConfiguration(f"{self.ref} does not support MSVC.") + + 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, "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")) diff --git a/recipes/emio/all/test_package/CMakeLists.txt b/recipes/emio/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..f5509edbbb4df --- /dev/null +++ b/recipes/emio/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(emio REQUIRED) + +add_executable(test_package test_package.cpp) +target_link_libraries(test_package PRIVATE emio::emio) +target_compile_features(test_package PRIVATE cxx_std_20) diff --git a/recipes/emio/all/test_package/conanfile.py b/recipes/emio/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0a6bc68712d90 --- /dev/null +++ b/recipes/emio/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/emio/all/test_package/test_package.cpp b/recipes/emio/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..efef6cc4e862d --- /dev/null +++ b/recipes/emio/all/test_package/test_package.cpp @@ -0,0 +1,9 @@ +#include + +int main() { + std::string s = emio::format("{}", 1); + if (s == "1") { + return EXIT_SUCCESS; + } + return EXIT_FAILURE; +} diff --git a/recipes/emio/config.yml b/recipes/emio/config.yml new file mode 100644 index 0000000000000..19b0eb079cdeb --- /dev/null +++ b/recipes/emio/config.yml @@ -0,0 +1,15 @@ +versions: + "0.8.0": + folder: all + "0.7.0": + folder: all + "0.6.1": + folder: all + "0.6.0": + folder: all + "0.5.0": + folder: all + "0.4.0": + folder: all + "0.3.0": + folder: all diff --git a/recipes/emsdk/all/conandata.yml b/recipes/emsdk/all/conandata.yml index 97335d64e50ee..09c67e41502df 100644 --- a/recipes/emsdk/all/conandata.yml +++ b/recipes/emsdk/all/conandata.yml @@ -1,4 +1,34 @@ sources: + "3.1.50": + url: "https://github.com/emscripten-core/emsdk/archive/3.1.50.tar.gz" + sha256: "7491a881eb5ee15fe81bbabcfff1fd571e45ccdb24a81890af429f9970cbd1f3" + "3.1.49": + url: "https://github.com/emscripten-core/emsdk/archive/3.1.49.tar.gz" + sha256: "c99d98da9241c7e72784bc764a3e60a65d8f27202d45f3cd422b2ac7245380d9" + "3.1.48": + url: "https://github.com/emscripten-core/emsdk/archive/3.1.48.tar.gz" + sha256: "94b965ba8f2ff0949ff67c6943bf5638a1b8850e4491a25413cdaff5b18da42b" + "3.1.47": + url: "https://github.com/emscripten-core/emsdk/archive/3.1.47.tar.gz" + sha256: "a882560a83cbacec67867e7ce6b00420d557e71c501b523d2ed956ded021f9b4" + "3.1.46": + url: "https://github.com/emscripten-core/emsdk/archive/3.1.46.tar.gz" + sha256: "5dd94e557b720800a60387ec078bf3b3a527cbd916ad74a696fe399f1544474f" + "3.1.45": + url: "https://github.com/emscripten-core/emsdk/archive/3.1.45.tar.gz" + sha256: "8b5b3433eb732dcc7643a2707a12fd5cbe793a5dadbbae9a60c24a737a78fe33" + "3.1.44": + url: "https://github.com/emscripten-core/emsdk/archive/3.1.44.tar.gz" + sha256: "cb8cded78f6953283429d724556e89211e51ac4d871fcf38e0b32405ee248e91" + "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" diff --git a/recipes/emsdk/all/conanfile.py b/recipes/emsdk/all/conanfile.py index 64d00c5064905..b8fc485ded548 100644 --- a/recipes/emsdk/all/conanfile.py +++ b/recipes/emsdk/all/conanfile.py @@ -125,7 +125,7 @@ def package(self): "set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)", "set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH)") if not cross_building(self): - self.run("embuilder build MINIMAL", env="conanemsdk") # force cache population + self.run("embuilder build MINIMAL", env=["conanemsdk", "conanrun"]) # force cache population # the line below forces emscripten to accept the cache as-is, even after re-location # https://github.com/emscripten-core/emscripten/issues/15053#issuecomment-920950710 os.remove(os.path.join(self._em_cache, "sanity.txt")) @@ -148,7 +148,7 @@ def package_info(self): return if self.settings_target.os != "Emscripten": - self.output.warn(f"You've added {self.name}/{self.version} as a build requirement, while os={self.settings_target.os} != Emscripten") + self.output.warning(f"You've added {self.name}/{self.version} as a build requirement, while os={self.settings_target.os} != Emscripten") return toolchain = os.path.join(self.package_folder, "bin", "upstream", "emscripten", "cmake", "Modules", "Platform", "Emscripten.cmake") diff --git a/recipes/emsdk/config.yml b/recipes/emsdk/config.yml index 7591f3687c322..3fd73e6da5530 100644 --- a/recipes/emsdk/config.yml +++ b/recipes/emsdk/config.yml @@ -1,4 +1,24 @@ versions: + "3.1.50": + folder: all + "3.1.49": + folder: all + "3.1.48": + folder: all + "3.1.47": + folder: all + "3.1.46": + folder: all + "3.1.45": + folder: all + "3.1.44": + folder: all + "3.1.31": + folder: all + "3.1.30": + folder: all + "3.1.29": + folder: all "3.1.23": folder: all "3.1.20": diff --git a/recipes/enchant/all/CMakeLists.txt b/recipes/enchant/all/CMakeLists.txt index 5c44e31e17e0f..ef18304559574 100644 --- a/recipes/enchant/all/CMakeLists.txt +++ b/recipes/enchant/all/CMakeLists.txt @@ -1,13 +1,10 @@ -cmake_minimum_required(VERSION 3.2) - +cmake_minimum_required(VERSION 3.12) project(enchant VERSION "${CONAN_enchant_VERSION}") -set(root "${PROJECT_SOURCE_DIR}/source_subfolder") +set(root "${PROJECT_SOURCE_DIR}/src") set(src "${root}/src") set(bin "${PROJECT_BINARY_DIR}") -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup(TARGETS KEEP_RPATHS) # ---- Config headers ---- @@ -54,7 +51,9 @@ add_library( "${src}/pwl.c" ) -target_compile_definitions(enchant PRIVATE NO_XMALLOC=1 PIC=1 ENABLE_COSTLY_RELOCATABLE=1) +find_package(glib REQUIRED CONFIG) + +target_compile_definitions(enchant PRIVATE NO_XMALLOC=1 PIC=1 ENABLE_COSTLY_RELOCATABLE=1 _GNU_SOURCE=1) target_include_directories(enchant PUBLIC "${bin}" "${src}" "${root}/lib") target_link_libraries(enchant PRIVATE glib::glib-2.0 glib::gmodule-2.0 ${DLADDR_LIBRARIES}) @@ -79,12 +78,7 @@ target_link_libraries(enchant_hunspell PRIVATE hunspell::hunspell glib::glib-2.0 include(GNUInstallDirs) -install( - TARGETS enchant - RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" - LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" - ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" -) +install(TARGETS enchant) if(NOT providers STREQUAL "") install( diff --git a/recipes/enchant/all/conandata.yml b/recipes/enchant/all/conandata.yml index 0e74282d629d1..6da09cd5f8f1b 100644 --- a/recipes/enchant/all/conandata.yml +++ b/recipes/enchant/all/conandata.yml @@ -5,14 +5,8 @@ sources: patches: "2.3.2": - patch_file: patches/0001-add-visibility-annotations.patch - base_path: source_subfolder - patch_file: patches/0002-remove-strchrnul-usage.patch - base_path: source_subfolder - patch_file: patches/0003-fix-file-locking.patch - base_path: source_subfolder - patch_file: patches/0004-fix-ssize_t-in-headers.patch - base_path: source_subfolder - patch_file: patches/0005-fix-relocatable.patch - base_path: source_subfolder - patch_file: patches/0006-add-macos-support.patch - base_path: source_subfolder diff --git a/recipes/enchant/all/conanfile.py b/recipes/enchant/all/conanfile.py index de37d8e54862f..4ccf80abd3897 100644 --- a/recipes/enchant/all/conanfile.py +++ b/recipes/enchant/all/conanfile.py @@ -1,8 +1,10 @@ -import functools +import os -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 -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class EnchantConan(ConanFile): @@ -11,47 +13,51 @@ class EnchantConan(ConanFile): "Enchant aims to provide a simple but comprehensive abstraction for " "dealing with different spell checking libraries in a consistent way" ) + license = "LGPL-2.1-or-later" url = "https://github.com/conan-io/conan-center-index" homepage = "https://abiword.github.io/enchant/" - topics = "enchant", "spell", "spell-check" - license = "LGPL-2.1-or-later" - settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" - requires = "glib/2.71.3", "hunspell/1.7.0" + topics = ("enchant", "spell", "spell-check") - @property - def _source_subfolder(self): - return "source_subfolder" + package_type = "shared-library" + settings = "os", "arch", "compiler", "build_type" def export_sources(self): - self.copy("CMakeLists.txt") - self.copy("configmake.h") - self.copy("configure.cmake") - 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) + copy(self, "configmake.h", src=self.recipe_folder, dst=self.export_sources_folder) + copy(self, "configure.cmake", src=self.recipe_folder, dst=self.export_sources_folder) + export_conandata_patches(self) + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires("glib/2.78.1") + self.requires("hunspell/1.7.2") 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], strip_root=True) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["CONAN_enchant_VERSION"] = self.version - cmake.configure() - return cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CONAN_enchant_VERSION"] = self.version + tc.generate() + tc = CMakeDeps(self) + tc.generate() def build(self): - for patch in self.conan_data["patches"][self.version]: - tools.patch(**patch) - self._configure_cmake().build() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure(build_script_folder=self.source_path.parent) + cmake.build() def package(self): - self.copy("COPYING.LIB", "licenses", self._source_subfolder) - self._configure_cmake().install() + copy(self, "COPYING.LIB", + 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 = ["enchant"] - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["dl"] diff --git a/recipes/enchant/all/test_package/CMakeLists.txt b/recipes/enchant/all/test_package/CMakeLists.txt index 71e01b224abd1..ee49a56d76d67 100644 --- a/recipes/enchant/all/test_package/CMakeLists.txt +++ b/recipes/enchant/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 KEEP_RPATHS) - find_package(enchant REQUIRED CONFIG) add_executable(test_package test_package.c) diff --git a/recipes/enchant/all/test_package/conanfile.py b/recipes/enchant/all/test_package/conanfile.py index a8c92dea63335..ef5d7042163ec 100644 --- a/recipes/enchant/all/test_package/conanfile.py +++ b/recipes/enchant/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 = "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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/enchant/all/test_v1_package/CMakeLists.txt b/recipes/enchant/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/enchant/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/enchant/all/test_v1_package/conanfile.py b/recipes/enchant/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..a8c92dea63335 --- /dev/null +++ b/recipes/enchant/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +import os + +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.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/enet/all/conandata.yml b/recipes/enet/all/conandata.yml index 872fdb0986138..346f8469ae010 100644 --- a/recipes/enet/all/conandata.yml +++ b/recipes/enet/all/conandata.yml @@ -1,22 +1,17 @@ sources: + "1.3.18": + url: "https://github.com/lsalzman/enet/archive/refs/tags/v1.3.18.tar.gz" + sha256: "28603c895f9ed24a846478180ee72c7376b39b4bb1287b73877e5eae7d96b0dd" "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" - sha256: "e749887a19b5a4a0a16daae2d695fd7ed581ec517f3b15aedc3cdce2d999d471" - "1.3.14": - url: "http://enet.bespin.org/download/enet-1.3.14.tar.gz" - sha256: "98f6f57aab0a424469619ed3047728f0d3901ce8f0dea919c11e7966d807e870" patches: + "1.3.18": + - patch_file: "patches/fix-cmake-1.3.18.patch" "1.3.17": - patch_file: "patches/fix-cmake.patch" "1.3.16": - patch_file: "patches/fix-cmake.patch" - "1.3.15": - - patch_file: "patches/fix-cmake.patch" - "1.3.14": - - 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/patches/fix-cmake-1.3.18.patch b/recipes/enet/all/patches/fix-cmake-1.3.18.patch new file mode 100644 index 0000000000000..6a6af96885d57 --- /dev/null +++ b/recipes/enet/all/patches/fix-cmake-1.3.18.patch @@ -0,0 +1,41 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index c6459b6..d7e68bd 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -84,19 +84,27 @@ set(SOURCE_FILES + source_group(include FILES ${INCLUDE_FILES}) + source_group(source FILES ${SOURCE_FILES}) + +-add_library(enet STATIC ++if(MSVC AND BUILD_SHARED_LIBS) ++ add_definitions(-DENET_DLL) ++ add_definitions(-DENET_BUILDING_LIB) ++endif() ++add_library(enet + ${INCLUDE_FILES} + ${SOURCE_FILES} + ) + +-if (MINGW) ++if (WIN32) + target_link_libraries(enet winmm ws2_32) + endif() + +-install(TARGETS enet +- RUNTIME DESTINATION bin +- ARCHIVE DESTINATION lib/static +- LIBRARY DESTINATION lib) +- +-install(DIRECTORY include/ +- DESTINATION include) ++include(GNUInstallDirs) ++install( ++ TARGETS enet ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++) ++install( ++ DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/enet ++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ++) 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/enet/config.yml b/recipes/enet/config.yml index 1e0720325112a..9574bb80165a0 100644 --- a/recipes/enet/config.yml +++ b/recipes/enet/config.yml @@ -1,9 +1,7 @@ versions: + "1.3.18": + folder: all "1.3.17": folder: all "1.3.16": folder: all - "1.3.15": - folder: all - "1.3.14": - folder: all diff --git a/recipes/enhex-generic_serialization/all/conanfile.py b/recipes/enhex-generic_serialization/all/conanfile.py index 9dbb338a5b3f4..f9f7cc76df650 100644 --- a/recipes/enhex-generic_serialization/all/conanfile.py +++ b/recipes/enhex-generic_serialization/all/conanfile.py @@ -1,50 +1,76 @@ -from conans import ConanFile, 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.files import copy, get +from conan.tools.layout import basic_layout +from conan.tools.scm import Version + +required_conan_version = ">=1.52.0" + + class EnhexGenericserializationConan(ConanFile): name = "enhex-generic_serialization" - license = "MIT" description = "Lightweight and extensible generic serialization library" - topics = ("serialization") - homepage = "https://github.com/Enhex/generic_serialization" + license = "MIT" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/Enhex/generic_serialization" + topics = ("serialization", "header-only") + + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - settings = ("compiler") @property - def _source_subfolder(self): - return "source_subfolder" - - def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 17) + def _min_cppstd(self): + return 17 - minimal_version = { + @property + def _compilers_minimum_version(self): + return { "Visual Studio": "15", + "msvc": "191", "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"): + check_min_cppstd(self, self._min_cppstd) + compiler = str(self.settings.compiler) - compiler_version = tools.Version(self.settings.compiler.version) + compiler_version = Version(self.settings.compiler.version) - if compiler not in minimal_version: - self.output.info("{} requires a compiler that supports at least C++17".format(self.name)) + if compiler not in self._compilers_minimum_version: + self.output.info(f"{self.name} requires a compiler that supports at least C++17") return # Exclude compilers not supported - if compiler_version < minimal_version[compiler]: - raise ConanInvalidConfiguration("{} requires a compiler that supports at least C++17. {} {} is not".format( - self.name, compiler, tools.Version(self.settings.compiler.version.value))) + if compiler_version < self._compilers_minimum_version[compiler]: + raise ConanInvalidConfiguration( + f"{self.name} requires a compiler that supports at least C++17. " + f"{compiler} {Version(self.settings.compiler.version.value)} is not" + ) 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(pattern="LICENSE.txt", dst="licenses", src=self._source_subfolder) - self.copy(pattern="*", dst="include", src=os.path.join(self._source_subfolder, "include")) + copy(self, "LICENSE.txt", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder) + copy(self, "*", + 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/enhex-generic_serialization/all/test_package/CMakeLists.txt b/recipes/enhex-generic_serialization/all/test_package/CMakeLists.txt index 60c63e2f06ba6..cca2369654837 100644 --- a/recipes/enhex-generic_serialization/all/test_package/CMakeLists.txt +++ b/recipes/enhex-generic_serialization/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(PackageTest CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(enhex-generic_serialization CONFIG REQUIRED) +find_package(enhex-generic_serialization REQUIRED CONFIG) add_executable(example example.cpp) target_link_libraries(example enhex-generic_serialization::enhex-generic_serialization) diff --git a/recipes/enhex-generic_serialization/all/test_package/conanfile.py b/recipes/enhex-generic_serialization/all/test_package/conanfile.py index 6ab1666628a5d..e0f447388fa1b 100644 --- a/recipes/enhex-generic_serialization/all/test_package/conanfile.py +++ b/recipes/enhex-generic_serialization/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" + test_type = "explicit" -class EnhexGenericserializationTestConan(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 +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.bindir, "example") + self.run(bin_path, env="conanrun") diff --git a/recipes/enhex-generic_serialization/all/test_v1_package/CMakeLists.txt b/recipes/enhex-generic_serialization/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/enhex-generic_serialization/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/enhex-generic_serialization/all/test_v1_package/conanfile.py b/recipes/enhex-generic_serialization/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..6ab1666628a5d --- /dev/null +++ b/recipes/enhex-generic_serialization/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +import os + +from conans import ConanFile, CMake, tools + + +class EnhexGenericserializationTestConan(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", "example") + self.run(bin_path, run_environment=True) diff --git a/recipes/enhex-strong_type/all/conanfile.py b/recipes/enhex-strong_type/all/conanfile.py index 40601c5f9d3e8..8b4ea08eec845 100644 --- a/recipes/enhex-strong_type/all/conanfile.py +++ b/recipes/enhex-strong_type/all/conanfile.py @@ -1,50 +1,72 @@ -from conans import ConanFile, 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.files import copy, get +from conan.tools.layout import basic_layout +from conan.tools.scm import Version + +required_conan_version = ">=1.52.0" + + class EnhexStrongTypeConan(ConanFile): name = "enhex-strong_type" - license = "MIT" description = "Create new type from existing type without changing the interface." - topics = ("strong_type", "safety") - homepage = "https://github.com/Enhex/strong_type" + license = "MIT" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/Enhex/strong_type" + topics = ("strong_type", "safety", "header-only") + + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - settings = ("compiler") @property - def _source_subfolder(self): - return "source_subfolder" - - def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 17) + def _min_cppstd(self): + return 17 - minimal_version = { + @property + def _compilers_minimum_version(self): + return { "Visual Studio": "15", + "msvc": "191", "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"): + check_min_cppstd(self, self._min_cppstd) + compiler = str(self.settings.compiler) - compiler_version = tools.Version(self.settings.compiler.version) + compiler_version = Version(self.settings.compiler.version) - if compiler not in minimal_version: - self.output.info("{} requires a compiler that supports at least C++17".format(self.name)) + if compiler not in self._compilers_minimum_version: + self.output.info(f"{self.name} requires a compiler that supports at least C++17") return # Exclude compilers not supported - if compiler_version < minimal_version[compiler]: - raise ConanInvalidConfiguration("{} requires a compiler that supports at least C++17. {} {} is not".format( - self.name, compiler, tools.Version(self.settings.compiler.version.value))) + if compiler_version < self._compilers_minimum_version[compiler]: + raise ConanInvalidConfiguration( + f"{self.name} requires a compiler that supports at least C++17. " + f"{compiler} {Version(self.settings.compiler.version.value)} is not" + ) 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(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", 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() + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/enhex-strong_type/all/test_package/CMakeLists.txt b/recipes/enhex-strong_type/all/test_package/CMakeLists.txt index ee8f5992e5656..51d45c127f722 100644 --- a/recipes/enhex-strong_type/all/test_package/CMakeLists.txt +++ b/recipes/enhex-strong_type/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(PackageTest CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(enhex-strong_type CONFIG REQUIRED) +find_package(enhex-strong_type REQUIRED CONFIG) add_executable(example example.cpp) target_link_libraries(example enhex-strong_type::enhex-strong_type) diff --git a/recipes/enhex-strong_type/all/test_package/conanfile.py b/recipes/enhex-strong_type/all/test_package/conanfile.py index c48d1d23bfccd..8d52b7021efe1 100644 --- a/recipes/enhex-strong_type/all/test_package/conanfile.py +++ b/recipes/enhex-strong_type/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 EnhexStrongTypeTestConan(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 +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.bindir, "example") + self.run(bin_path, env="conanrun") diff --git a/recipes/enhex-strong_type/all/test_v1_package/CMakeLists.txt b/recipes/enhex-strong_type/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/enhex-strong_type/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/enhex-strong_type/all/test_v1_package/conanfile.py b/recipes/enhex-strong_type/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..c48d1d23bfccd --- /dev/null +++ b/recipes/enhex-strong_type/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +import os + +from conans import ConanFile, CMake, tools + + +class EnhexStrongTypeTestConan(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", "example") + self.run(bin_path, run_environment=True) diff --git a/recipes/enjincppsdk/all/CMakeLists.txt b/recipes/enjincppsdk/all/CMakeLists.txt deleted file mode 100644 index 9d48e327cd88a..0000000000000 --- a/recipes/enjincppsdk/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/enjincppsdk/all/conanfile.py b/recipes/enjincppsdk/all/conanfile.py index 172ca8e02037d..8af63eb0a3f23 100644 --- a/recipes/enjincppsdk/all/conanfile.py +++ b/recipes/enjincppsdk/all/conanfile.py @@ -1,21 +1,26 @@ -from conans import ConanFile, CMake, 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.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, rmdir, save, replace_in_file +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" class EnjinCppSdk(ConanFile): name = "enjincppsdk" description = "A C++ SDK for development on the Enjin blockchain platform." license = "Apache-2.0" - topics = ("enjin", "sdk", "blockchain") - homepage = "https://github.com/enjin/enjin-cpp-sdk" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/enjin/enjin-cpp-sdk" + topics = ("enjin", "sdk", "blockchain") - settings = "os", "compiler", "arch", "build_type" - generators = "cmake", "cmake_find_package", "cmake_find_package_multi" - + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -29,108 +34,107 @@ class EnjinCppSdk(ConanFile): "with_default_ws_client": False, } - _cmake = None - 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 { "Visual Studio": "16", + "msvc": "192", "gcc": "9", "clang": "10", + "apple-clang": "12", } - def export_sources(self): - self.copy("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 + self.options.rm_safe("fPIC") if self.options.with_default_http_client: self.options["cpp-httplib"].with_openssl = True self.options["spdlog"].header_only = True + def layout(self): + cmake_layout(self, src_folder="src") + def requirements(self): if self.options.with_default_http_client: - self.requires("cpp-httplib/0.8.5") + self.requires("cpp-httplib/0.14.1") if self.options.with_default_ws_client: - self.requires("ixwebsocket/11.0.4") - - self.requires("rapidjson/1.1.0") - self.requires("spdlog/1.8.2") + self.requires("ixwebsocket/11.4.3") - def build_requirements(self): - self.build_requires("cmake/3.16.9") + self.requires("rapidjson/cci.20220822") + self.requires("spdlog/1.12.0") def validate(self): # Validations for OS - if self.settings.os == "Macos": - raise ConanInvalidConfiguration("macOS is not supported at this time. Contributions are welcomed.") + if is_apple_os(self): + raise ConanInvalidConfiguration(f"{self.settings.os} is not supported at this time. Contributions are welcomed.") # Validations for minimum required C++ standard compiler = self.settings.compiler - if compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 17) - + check_min_cppstd(self, 17) minimum_version = self._minimum_compilers_version.get(str(compiler), False) if not minimum_version: - self.output.warn("C++17 support is required. Your compiler is unknown. Assuming it supports C++17.") - elif tools.Version(compiler.version) < minimum_version: + self.output.warning("C++17 support is required. Your compiler is unknown. Assuming it supports C++17.") + elif Version(compiler.version) < minimum_version: raise ConanInvalidConfiguration("C++17 support is required, which your compiler does not support.") if compiler == "clang" and compiler.libcxx != "libstdc++11": raise ConanInvalidConfiguration("libstdc++11 is required for clang.") # Validations for dependencies - if not self.options["spdlog"].header_only: + if not self.dependencies["spdlog"].options.header_only: raise ConanInvalidConfiguration(f"{self.name} requires spdlog:header_only=True to be enabled.") - if self.options.with_default_http_client and not self.options["cpp-httplib"].with_openssl: - raise ConanInvalidConfiguration(f"{self.name} requires cpp-httplib:with_openssl=True when using " - f"with_default_http_client=True.") - - def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + if self.options.with_default_http_client and not self.dependencies["cpp-httplib"].options.with_openssl: + raise ConanInvalidConfiguration( + f"{self.name} requires cpp-httplib:with_openssl=True when using with_default_http_client=True." + ) - def _configure_cmake(self): - if self._cmake: - return self._cmake + def build_requirements(self): + self.tool_requires("cmake/[>=3.16]") - self._cmake = CMake(self) - self._cmake.definitions["ENJINSDK_BUILD_SHARED"] = self.options.shared - self._cmake.definitions["ENJINSDK_BUILD_TESTS"] = False - 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): + tc = CMakeToolchain(self) + tc.variables["ENJINSDK_BUILD_SHARED"] = self.options.shared + tc.variables["ENJINSDK_BUILD_TESTS"] = False + tc.generate() + tc = CMakeDeps(self) + tc.generate() + + def _patch_sources(self): + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "RAPIDJSON", "RapidJSON") + # Remove version check for RapidJSON + save(self, os.path.join(self.source_folder, "cmake", "enjinsdk_find_rapidjson.cmake"), + "find_package(RapidJSON REQUIRED CONFIG)") def build(self): - cmake = self._configure_cmake() + self._patch_sources() + 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*", 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", "enjinsdk")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "enjinsdk")) def package_info(self): + self.cpp_info.libs = ["enjinsdk"] + self.cpp_info.set_property("cmake_file_name", "enjinsdk") self.cpp_info.set_property("cmake_target_name", "enjinsdk::enjinsdk") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.names["cmake_find_package"] = "enjinsdk" self.cpp_info.names["cmake_find_package_multi"] = "enjinsdk" - self.cpp_info.libs = ["enjinsdk"] diff --git a/recipes/enjincppsdk/all/test_package/CMakeLists.txt b/recipes/enjincppsdk/all/test_package/CMakeLists.txt index 30e76e5090606..a986c4e5f3431 100644 --- a/recipes/enjincppsdk/all/test_package/CMakeLists.txt +++ b/recipes/enjincppsdk/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(enjinsdk REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/enjincppsdk/all/test_package/conanfile.py b/recipes/enjincppsdk/all/test_package/conanfile.py index 4a5eb7410ea85..ef5d7042163ec 100644 --- a/recipes/enjincppsdk/all/test_package/conanfile.py +++ b/recipes/enjincppsdk/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_layout, CMake import os -required_conan_version = ">=1.43.0" - 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) @@ -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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/enjincppsdk/all/test_v1_package/CMakeLists.txt b/recipes/enjincppsdk/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/enjincppsdk/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/enjincppsdk/all/test_v1_package/conanfile.py b/recipes/enjincppsdk/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..4a5eb7410ea85 --- /dev/null +++ b/recipes/enjincppsdk/all/test_v1_package/conanfile.py @@ -0,0 +1,19 @@ +from conans import ConanFile, CMake, tools +import os + +required_conan_version = ">=1.43.0" + + +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/enkits/all/CMakeLists.txt b/recipes/enkits/all/CMakeLists.txt deleted file mode 100644 index c986d294c7547..0000000000000 --- a/recipes/enkits/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/enkits/all/conandata.yml b/recipes/enkits/all/conandata.yml index 9604c7fcf2b72..197355c129edc 100644 --- a/recipes/enkits/all/conandata.yml +++ b/recipes/enkits/all/conandata.yml @@ -8,13 +8,3 @@ sources: "1.8": url: "https://github.com/dougbinks/enkiTS/archive/v1.8.zip" sha256: "b96d8d439502d52f9dc419539b12b588df10750f4631ad5518586f7048cdfaef" -patches: - "1.11": - - patch_file: "patches/cmake-install-lib-location.patch" - base_path: "source_subfolder" - "1.10": - - patch_file: "patches/cmake-install-lib-location.patch" - base_path: "source_subfolder" - "1.8": - - patch_file: "patches/cmake-install-lib-location.patch" - base_path: "source_subfolder" diff --git a/recipes/enkits/all/conanfile.py b/recipes/enkits/all/conanfile.py index 3a8bf5c9e920b..6149fad91345f 100644 --- a/recipes/enkits/all/conanfile.py +++ b/recipes/enkits/all/conanfile.py @@ -1,18 +1,22 @@ 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 copy, export_conandata_patches, get, replace_in_file + +required_conan_version = ">=1.53.0" + class EnkiTSConan(ConanFile): name = "enkits" description = "A permissively licensed C and C++ Task Scheduler for creating parallel programs." - topics = ("conan", "c", "thread", "multithreading", "scheduling", "enkits", "gamedev") + license = "Zlib" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/dougbinks/enkiTS" - license = "Zlib" - settings = "os", "arch", "compiler", "build_type" - - exports_sources = "CMakeLists.txt", "patches/*" - generators = "cmake" + topics = ("c", "thread", "multithreading", "scheduling", "gamedev") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -22,11 +26,8 @@ class EnkiTSConan(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": @@ -34,37 +35,44 @@ 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]) - extracted_dir = "enkiTS-" + self.version - os.rename(extracted_dir, self._source_subfolder) - - def _configure_cmake(self): - if not self._cmake: - self._cmake = CMake(self) - self._cmake.definitions["ENKITS_INSTALL"] = True - self._cmake.definitions["ENKITS_BUILD_EXAMPLES"] = False - self._cmake.definitions["ENKITS_BUILD_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["ENKITS_INSTALL"] = True + tc.variables["ENKITS_BUILD_EXAMPLES"] = False + tc.variables["ENKITS_BUILD_SHARED"] = self.options.shared + tc.generate() + + def _patch_sources(self): + replace_in_file( + self, + os.path.join(self.source_folder, "CMakeLists.txt"), + 'install(TARGETS enkiTS DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/enkiTS")', + "install(TARGETS enkiTS ARCHIVE LIBRARY RUNTIME)", + ) def build(self): - for patch in self.conan_data["patches"][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.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() def package_info(self): self.cpp_info.libs = ["enkiTS"] - + if self.options.shared: self.cpp_info.defines.append("ENKITS_DLL=1") - if self.settings.os == "Linux": - self.cpp_info.system_libs = ["pthread"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs = ["m", "pthread"] diff --git a/recipes/enkits/all/patches/cmake-install-lib-location.patch b/recipes/enkits/all/patches/cmake-install-lib-location.patch deleted file mode 100644 index 0a43979813c18..0000000000000 --- a/recipes/enkits/all/patches/cmake-install-lib-location.patch +++ /dev/null @@ -1,5 +0,0 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -63,1 +63,1 @@ -- install(TARGETS enkiTS DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/enkiTS") -+ install(TARGETS enkiTS ARCHIVE LIBRARY RUNTIME) diff --git a/recipes/enkits/all/test_package/CMakeLists.txt b/recipes/enkits/all/test_package/CMakeLists.txt index 33ae887aa6aea..2c29974d55284 100644 --- a/recipes/enkits/all/test_package/CMakeLists.txt +++ b/recipes/enkits/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -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() +find_package(enkits REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE enkits::enkits) set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) diff --git a/recipes/enkits/all/test_package/conanfile.py b/recipes/enkits/all/test_package/conanfile.py index 32e9e0cb58ab6..ef5d7042163ec 100644 --- a/recipes/enkits/all/test_package/conanfile.py +++ b/recipes/enkits/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", "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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/enkits/all/test_v1_package/CMakeLists.txt b/recipes/enkits/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/enkits/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/enkits/all/test_v1_package/conanfile.py b/recipes/enkits/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..910ae60d10438 --- /dev/null +++ b/recipes/enkits/all/test_v1_package/conanfile.py @@ -0,0 +1,16 @@ +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.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/ensmallen/all/conandata.yml b/recipes/ensmallen/all/conandata.yml new file mode 100644 index 0000000000000..31733be82e383 --- /dev/null +++ b/recipes/ensmallen/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "2.21.0": + url: "https://ensmallen.org/files/ensmallen-2.21.0.tar.gz" + sha256: "076f9d84e1ebc84c0ae19ee63accfc8fd3ec850f8993784bd9277776c3af2932" + "2.19.1": + url: "https://ensmallen.org/files/ensmallen-2.19.1.tar.gz" + sha256: "f36ad7f08b0688d2a8152e1c73dd437c56ed7a5af5facf65db6ffd977b275b2e" diff --git a/recipes/ensmallen/all/conanfile.py b/recipes/ensmallen/all/conanfile.py new file mode 100644 index 0000000000000..093bca4ec6467 --- /dev/null +++ b/recipes/ensmallen/all/conanfile.py @@ -0,0 +1,69 @@ +from conan import ConanFile, conan_version +from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps +from conan.tools.files import get, replace_in_file, rmdir, copy +from conan.tools.scm import Version + +import os + +required_conan_version = ">=1.55.0" + +class ensmallenRecipe(ConanFile): + name = "ensmallen" + description = "ensmallen is a high quality C++ library for non-linear numerical optimization." + license = "BSD-3-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/mlpack/ensmallen" + topics = ("optimization", "numerical", "header-only") + + package_type = "header-library" + settings = "os", "compiler", "build_type", "arch" + + def package_id(self): + self.info.clear() + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires("armadillo/12.6.4") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + deps = CMakeDeps(self) + deps.set_property("armadillo", "cmake_file_name", "Armadillo") + deps.set_property("armadillo", "cmake_target_name", "Armadillo::Armadillo") + deps.set_property("armadillo", "cmake_config_version_compat", "AnyNewerVersion") + deps.generate() + tc = CMakeToolchain(self) + tc.variables["USE_OPENMP"] = False + tc.generate() + + + def build(self): + # TODO: Remove when conan 1.x support is dropped. This is largely resolved by the above + # specification of AnyNewerVersion for the compatibility policy, but this feature isn't + # available below version 2.0.12. + if conan_version < Version("2.0.12"): + # Remove hard requirement on armadillo 9.800.0 + # This is a minimum requirement, use latest + replace_in_file( + self, + os.path.join(self.source_folder, "CMakeLists.txt"), + "find_package(Armadillo 9.800.0 REQUIRED)", + "find_package(Armadillo REQUIRED)", + ) + cmake = CMake(self) + cmake.configure() + + def package(self): + cmake = CMake(self) + cmake.install() + + copy(self, "LICENSE.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + rmdir(self, os.path.join(self.package_folder, "lib")) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/ensmallen/all/test_package/CMakeLists.txt b/recipes/ensmallen/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..be7bc25d1dfa3 --- /dev/null +++ b/recipes/ensmallen/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(PackageTest CXX) + +set(CMAKE_CXX_STANDARD 11) +find_package(ensmallen CONFIG REQUIRED) + +add_executable(example src/example.cpp) +target_link_libraries(example ensmallen::ensmallen) diff --git a/recipes/ensmallen/all/test_package/conanfile.py b/recipes/ensmallen/all/test_package/conanfile.py new file mode 100644 index 0000000000000..9cfc468cba5a7 --- /dev/null +++ b/recipes/ensmallen/all/test_package/conanfile.py @@ -0,0 +1,30 @@ +import os + +from conan import ConanFile +from conan.tools.cmake import CMake, cmake_layout +from conan.tools.build import can_run + +class ensmallenTestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "CMakeDeps", "CMakeToolchain" + + def requirements(self): + self.requires(self.tested_reference_str) + # Required for consumers of armadillo>=12.2.0 due to upstream changes + # and armadillo/*:use_hdf5=True by default. + # See https://github.com/conan-io/conan-center-index/pull/17320 for more + # information. + self.requires("hdf5/1.14.1") + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def layout(self): + cmake_layout(self) + + def test(self): + if can_run(self): + cmd = [os.path.join(self.cpp.build.bindir, "example"), "10", "20"] + self.run(" ".join(cmd), env="conanrun") diff --git a/recipes/ensmallen/all/test_package/src/example.cpp b/recipes/ensmallen/all/test_package/src/example.cpp new file mode 100644 index 0000000000000..264f137bd0657 --- /dev/null +++ b/recipes/ensmallen/all/test_package/src/example.cpp @@ -0,0 +1,70 @@ +// Example implementation of an objective function class for linear regression +// and usage of the L-BFGS optimizer. +// +// Compilation: +// g++ example.cpp -o example -O3 -larmadillo + + +#include +#include +#include + + +class LinearRegressionFunction +{ + public: + + LinearRegressionFunction(arma::mat& X, arma::vec& y) : X(X), y(y) { } + + double EvaluateWithGradient(const arma::mat& theta, arma::mat& gradient) + { + const arma::vec tmp = X.t() * theta - y; + gradient = 2 * X * tmp; + return arma::dot(tmp,tmp); + } + + private: + + const arma::mat& X; + const arma::vec& y; +}; + + +int main(int argc, char** argv) +{ + if (argc < 3) + { + std::cout << "usage: " << argv[0] << " n_dims n_points" << std::endl; + return -1; + } + + int n_dims = atoi(argv[1]); + int n_points = atoi(argv[2]); + + // generate noisy dataset with a slight linear pattern + arma::mat X(n_dims, n_points, arma::fill::randu); + arma::vec y( n_points, arma::fill::randu); + + for (size_t i = 0; i < n_points; ++i) + { + double a = arma::randu(); + X(1, i) += a; + y(i) += a; + } + + LinearRegressionFunction lrf(X, y); + + // create a Limited-memory BFGS optimizer object with default parameters + ens::L_BFGS opt; + opt.MaxIterations() = 10; + + // initial point (uniform random) + arma::vec theta(n_dims, arma::fill::randu); + + opt.Optimize(lrf, theta); + + // theta now contains the optimized parameters + theta.print("theta:"); + + return 0; +} diff --git a/recipes/ensmallen/config.yml b/recipes/ensmallen/config.yml new file mode 100644 index 0000000000000..0bd90f07549cf --- /dev/null +++ b/recipes/ensmallen/config.yml @@ -0,0 +1,5 @@ +versions: + "2.21.0": + folder: all + "2.19.1": + folder: all 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 b55145bf44224..bc82c187f9e2a 100644 --- a/recipes/entt/3.x.x/conandata.yml +++ b/recipes/entt/3.x.x/conandata.yml @@ -1,67 +1,25 @@ sources: + "3.14.0": + url: "https://github.com/skypjack/entt/archive/refs/tags/v3.14.0.tar.gz" + sha256: "e31f6e95a30e2977a50449ef9a607a9ff40febe6f9da2a8144a183f8606f7719" + "3.13.2": + url: "https://github.com/skypjack/entt/archive/refs/tags/v3.13.2.tar.gz" + sha256: "cb556aa543d01177b62de41321759e02d96078948dda72705b3d7fe68af88489" + "3.12.2": + url: "https://github.com/skypjack/entt/archive/refs/tags/v3.12.2.tar.gz" + sha256: "3F3E43988218DAECC0530CCAF45E960F7F7416E1FCF2C69799160C18B6A2FEE3" "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" - "3.10.1": - url: "https://github.com/skypjack/entt/archive/refs/tags/v3.10.1.tar.gz" - sha256: "f7031545130bfc06f5fe6b2f8c87dcbd4c1254fab86657e2788b70dfeea57965" - "3.10.0": - url: "https://github.com/skypjack/entt/archive/refs/tags/v3.10.0.tar.gz" - sha256: "4c716cebf4f2964824da158dd58cc81d9f1e056a083538e22fb03ae2d64805ee" - "3.9.0": - url: "https://github.com/skypjack/entt/archive/refs/tags/v3.9.0.tar.gz" - sha256: "1b06f1f6627c3702486855877bdeab6885f5d821d3dd78862126d4308c627c23" - "3.8.1": - url: "https://github.com/skypjack/entt/archive/v3.8.1.tar.gz" - sha256: "a2b767f06bca67a73a4d71fb9ebb6ed823bb5146faad3c282b9dbbbdae1aa01b" - "3.8.0": - url: "https://github.com/skypjack/entt/archive/refs/tags/v3.8.0.tar.gz" - sha256: "71c8ff5a604e8e214571a8b2218dfeaf61be59e2fe2ff5b550b4810c37d4da3c" - "3.7.1": - url: "https://github.com/skypjack/entt/archive/refs/tags/v3.7.1.tar.gz" - sha256: "fe3ce773c17797c0c57ffa97f73902854fcc8e7afc7e09bea373e0c64fa24a23" - "3.7.0": - url: "https://github.com/skypjack/entt/archive/refs/tags/v3.7.0.tar.gz" - sha256: "39ad5c42acf3434f8c37e0baa18a8cb562c0845383a6b4da17fdbacc9f0a7695" - "3.6.0": - url: "https://github.com/skypjack/entt/archive/v3.6.0.tar.gz" - sha256: "94b7dc874acd0961cfc28cf6b0342eeb0b7c58250ddde8bdc6c101e84b74c190" - "3.5.2": - url: "https://github.com/skypjack/entt/archive/v3.5.2.tar.gz" - sha256: "f9271293c44518386c402c9a2188627819748f66302df48af4f6d08e30661036" - "3.5.1": - url: "https://github.com/skypjack/entt/archive/v3.5.1.tar.gz" - sha256: "f442ece6881ec24863e7f0fbdc4bf641e01b0f87955f49dc4687b2fa564e9c83" - "3.5.0": - url: "https://github.com/skypjack/entt/archive/v3.5.0.tar.gz" - sha256: "89cba5ddf90bcec0dcf8d9554d9acf5ad86f5ce305e3acacf795007ee65c93f8" - "3.4.0": - url: "https://github.com/skypjack/entt/archive/v3.4.0.tar.gz" - sha256: "07086b8c5b1d84a1b76b39b0ce257c36c4f1521b77e664368b3d5ca7c00264e2" - "3.3.2": - url: "https://github.com/skypjack/entt/archive/v3.3.2.tar.gz" - sha256: "150cd89b45bffbcd7643d39bbce282e8fa38307bb5ed25567b79e337376ba1c7" - "3.3.1": - url: "https://github.com/skypjack/entt/archive/v3.3.1.tar.gz" - sha256: "432f31a80fb0463960dfd36e103c206dd67f1bfa91fc48408594c28aa790a3f5" - "3.3.0": - url: "https://github.com/skypjack/entt/archive/v3.3.0.tar.gz" - sha256: "d21a45df4960adc86a8f23a8c3c0cea6d2cecc4ef6946a8040e336d8e5266ab3" - "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" + "3.12.2": + - patch_file: "patches/0002-3.12.1-fix-gcc-7.0-7.3.patch" patch_description: "Fix GCC 7.0 to 7.3" patch_type: "portability" - "3.11.0": + "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" diff --git a/recipes/entt/3.x.x/conanfile.py b/recipes/entt/3.x.x/conanfile.py index bcce48c1ce46c..3247530d794dc 100644 --- a/recipes/entt/3.x.x/conanfile.py +++ b/recipes/entt/3.x.x/conanfile.py @@ -15,6 +15,7 @@ class EnttConan(ConanFile): homepage = "https://github.com/skypjack/entt" url = "https://github.com/conan-io/conan-center-index" license = "MIT" + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" @property @@ -41,7 +42,6 @@ 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) @@ -58,8 +58,7 @@ def loose_lt_semver(v1, v2): ) 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): apply_conandata_patches(self) diff --git a/recipes/entt/3.x.x/patches/0002-3.12.1-fix-gcc-7.0-7.3.patch b/recipes/entt/3.x.x/patches/0002-3.12.1-fix-gcc-7.0-7.3.patch new file mode 100644 index 0000000000000..d3cb85f5fbcc6 --- /dev/null +++ b/recipes/entt/3.x.x/patches/0002-3.12.1-fix-gcc-7.0-7.3.patch @@ -0,0 +1,20 @@ +--- a/src/entt/meta/meta.hpp ++++ b/src/entt/meta/meta.hpp +@@ -1688,7 +1688,7 @@ public: + using reference = value_type; + using iterator_category = std::input_iterator_tag; + +- constexpr meta_iterator() noexcept ++ meta_iterator() noexcept + : ctx{}, + vtable{}, + handle{} {} +@@ -1782,7 +1782,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/config.yml b/recipes/entt/config.yml index 0000b93d983f2..b6987050a29e9 100644 --- a/recipes/entt/config.yml +++ b/recipes/entt/config.yml @@ -1,39 +1,11 @@ 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": - folder: 3.x.x - "3.10.0": - folder: 3.x.x - "3.9.0": - folder: 3.x.x - "3.8.1": - folder: 3.x.x - "3.8.0": + "3.14.0": folder: 3.x.x - "3.7.1": + "3.13.2": folder: 3.x.x - "3.7.0": + "3.12.2": folder: 3.x.x - "3.6.0": - folder: 3.x.x - "3.5.2": - folder: 3.x.x - "3.5.1": - folder: 3.x.x - "3.5.0": - folder: 3.x.x - "3.4.0": - folder: 3.x.x - "3.3.2": - folder: 3.x.x - "3.3.1": - folder: 3.x.x - "3.3.0": + "3.11.1": folder: 3.x.x - "3.2.2": + "3.10.3": folder: 3.x.x diff --git a/recipes/enum-flags/all/conanfile.py b/recipes/enum-flags/all/conanfile.py index 81ac78601093a..5d86c60a02e47 100644 --- a/recipes/enum-flags/all/conanfile.py +++ b/recipes/enum-flags/all/conanfile.py @@ -14,7 +14,7 @@ class EnumFlagsConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" topics = ("bitmask", "enum") license = "MIT" - + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" options = { "forbid_implicit_conversions": [True, False], @@ -36,8 +36,7 @@ def validate(self): 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 build(self): pass diff --git a/recipes/enumbitmask/all/conandata.yml b/recipes/enumbitmask/all/conandata.yml new file mode 100644 index 0000000000000..cd53c7f619e50 --- /dev/null +++ b/recipes/enumbitmask/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.0": + url: "https://github.com/Reputeless/EnumBitmask/archive/refs/tags/v1.0.tar.gz" + sha256: "233efdefa4d0cfc8d8664ab7326db29835cc874b0af4926a7d93a184b250013d" diff --git a/recipes/enumbitmask/all/conanfile.py b/recipes/enumbitmask/all/conanfile.py new file mode 100644 index 0000000000000..e26040a23cf68 --- /dev/null +++ b/recipes/enumbitmask/all/conanfile.py @@ -0,0 +1,67 @@ +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 EnumBitmaskConan(ConanFile): + name = "enumbitmask" + description = "A C++ library to enable bitmask operators for an enum class type" + license = "CC0-1.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/Reputeless/EnumBitmask" + topics = ("enum", "bitmask", "header-only") + package_type = "header-library" + 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", + "Visual Studio": "16", + "msvc": "192", + } + + 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=self.source_folder, + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/enumbitmask/all/test_package/CMakeLists.txt b/recipes/enumbitmask/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..7e634d8528a16 --- /dev/null +++ b/recipes/enumbitmask/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(enumbitmask REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE enumbitmask::enumbitmask) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/enumbitmask/all/test_package/conanfile.py b/recipes/enumbitmask/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/enumbitmask/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/enumbitmask/all/test_package/test_package.cpp b/recipes/enumbitmask/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..80e777f36555c --- /dev/null +++ b/recipes/enumbitmask/all/test_package/test_package.cpp @@ -0,0 +1,20 @@ +#include + +#include "EnumBitmask.hpp" + +enum class OpenMode { + Append = 1, + Binary = 2, + Input = 4, + Output = 8, +}; +DEFINE_BITMASK_OPERATORS(OpenMode) + + +int main() { + constexpr auto mode = OpenMode::Binary | OpenMode::Input; + + constexpr auto flag = mode & OpenMode::Binary; + + return 0; +} diff --git a/recipes/enumbitmask/config.yml b/recipes/enumbitmask/config.yml new file mode 100644 index 0000000000000..edab1ee152d36 --- /dev/null +++ b/recipes/enumbitmask/config.yml @@ -0,0 +1,3 @@ +versions: + "1.0": + 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/conandata.yml b/recipes/erkir/all/conandata.yml index 24a6857c0b7eb..f16d2da6950e6 100644 --- a/recipes/erkir/all/conandata.yml +++ b/recipes/erkir/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.1.1": + url: "https://github.com/vahancho/erkir/archive/refs/tags/v2.1.1.tar.gz" + sha256: "b314824c126bf933e2f08e5335e12b7ef3ded9ceb341d542276455d991e7e85d" "2.0.0": url: "https://github.com/vahancho/erkir/archive/refs/tags/v2.0.0.tar.gz" sha256: "98d095adcf0f2f11e3ba345bd5bbe890568cde69de9680b2c2a424f0008453ac" @@ -6,6 +9,16 @@ sources: url: "https://github.com/vahancho/erkir/archive/refs/tags/1.0.0.tar.gz" sha256: "0bc5122fe2fef0f9036de275483af7f8adb947f6e8dd63fc18ac085ef31e9421" patches: + "2.1.1": + - 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.1.1-0002-fix-cmake.patch" + patch_description: "disable shared and fPIC options" + patch_type: "conan" + - patch_file: "patches/2.1.1-0003-fix-erkir_export.patch" + patch_description: "define ERKIR_EXPORT as empty on static build" + patch_type: "conan" "2.0.0": - patch_file: "patches/2.0.0-0001-remove-specify-architecture.patch" patch_description: "fix supported architectures limited to x86/x86_64" diff --git a/recipes/erkir/all/conanfile.py b/recipes/erkir/all/conanfile.py index 66b56ca8db092..10808e03cf409 100644 --- a/recipes/erkir/all/conanfile.py +++ b/recipes/erkir/all/conanfile.py @@ -1,12 +1,12 @@ 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 - +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.52.0" +required_conan_version = ">=1.54.0" + class ErkirConan(ConanFile): name = "erkir" @@ -15,6 +15,7 @@ class ErkirConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/vahancho/erkir" topics = ("earth", "geodesy", "geography", "coordinate-systems", "geodetic", "datum") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -26,8 +27,8 @@ class ErkirConan(ConanFile): } @property - def _minimum_cpp_standard(self): - return 11 + def _min_cppstd(self): + return "11" def export_sources(self): export_conandata_patches(self) @@ -38,18 +39,17 @@ 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: - check_min_cppstd(self, self._minimum_cpp_standard) + 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -83,3 +83,9 @@ def package(self): def package_info(self): postfix = "d" if Version(self.version) >= "2.0.0" and self.settings.build_type == "Debug" else "" self.cpp_info.libs = [f"erkir{postfix}"] + + if Version(self.version) >= "2.1.0" and self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") + + self.cpp_info.set_property("cmake_file_name", "erkir") + self.cpp_info.set_property("cmake_target_name", "erkir::erkir") diff --git a/recipes/erkir/all/patches/2.1.1-0002-fix-cmake.patch b/recipes/erkir/all/patches/2.1.1-0002-fix-cmake.patch new file mode 100644 index 0000000000000..0a92d7aabdffc --- /dev/null +++ b/recipes/erkir/all/patches/2.1.1-0002-fix-cmake.patch @@ -0,0 +1,22 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index d72f102..7bf1655 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -3,7 +3,7 @@ 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) ++# set(CMAKE_POSITION_INDEPENDENT_CODE ON) + + # The project definition + project(erkir VERSION 2.1.1 +@@ -14,7 +14,7 @@ project(erkir VERSION 2.1.1 + include(GNUInstallDirs) + + # General options +-option(BUILD_SHARED_LIBS "Build using shared libraries" ON) ++# 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.1.1-0003-fix-erkir_export.patch b/recipes/erkir/all/patches/2.1.1-0003-fix-erkir_export.patch new file mode 100644 index 0000000000000..a12676d0ed400 --- /dev/null +++ b/recipes/erkir/all/patches/2.1.1-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 ad88fd6..519a300 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -38,6 +38,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_v1_package/CMakeLists.txt b/recipes/erkir/all/test_v1_package/CMakeLists.txt index b00f9ba781174..0d20897301b68 100644 --- a/recipes/erkir/all/test_v1_package/CMakeLists.txt +++ b/recipes/erkir/all/test_v1_package/CMakeLists.txt @@ -1,12 +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(erkir REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE erkir::erkir) -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/erkir/config.yml b/recipes/erkir/config.yml index 870fb33e55af0..65dc9fbda0110 100644 --- a/recipes/erkir/config.yml +++ b/recipes/erkir/config.yml @@ -1,4 +1,6 @@ versions: + "2.1.1": + folder: all "2.0.0": folder: all "1.0.0": diff --git a/recipes/etc2comp/all/CMakeLists.txt b/recipes/etc2comp/all/CMakeLists.txt deleted file mode 100644 index c986d294c7547..0000000000000 --- a/recipes/etc2comp/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/etc2comp/all/conandata.yml b/recipes/etc2comp/all/conandata.yml index c09fa8bdc3d9b..a0bae7c1226dd 100644 --- a/recipes/etc2comp/all/conandata.yml +++ b/recipes/etc2comp/all/conandata.yml @@ -5,4 +5,3 @@ sources: patches: "cci.20170424": - patch_file: "patches/fix-cmake.patch" - base_path: "source_subfolder" diff --git a/recipes/etc2comp/all/conanfile.py b/recipes/etc2comp/all/conanfile.py index 4a9a0df7d2266..0293dc8b7a996 100644 --- a/recipes/etc2comp/all/conanfile.py +++ b/recipes/etc2comp/all/conanfile.py @@ -1,16 +1,22 @@ import os -import glob -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, collect_libs, copy, export_conandata_patches, get + +required_conan_version = ">=1.53.0" + class Etc2compConan(ConanFile): name = "etc2comp" description = "Open source c++ skeletal animation library and toolset." - license = "Apache-2.0", - topics = ("conan", "texture", "etc2", "compressor") - homepage = "https://github.com/google/etc2comp" + license = ("Apache-2.0",) url = "https://github.com/conan-io/conan-center-index" - exports_sources = ["CMakeLists.txt", "patches/**"] - generators = "cmake" + homepage = "https://github.com/google/etc2comp" + topics = ("texture", "etc2", "compressor") + + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -21,54 +27,51 @@ class Etc2compConan(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 layout(self): + cmake_layout(self, src_folder="src") + + 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_dir = glob.glob('etc2comp-*/')[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.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) - 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("*.lib", dst="lib", keep_path=False) - self.copy("*.dll", dst="bin", 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) - self.copy("*.h", dst=os.path.join("include"), src=os.path.join(self._source_subfolder, "EtcLib"), keep_path=False) + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + for pattern in ["*.lib", "*.a", "*.so*", "*.dylib"]: + copy(self, pattern, dst=os.path.join(self.package_folder, "lib"), src=self.build_folder, keep_path=False) + copy(self, "*.dll", dst=os.path.join(self.package_folder, "bin"), src=self.build_folder, keep_path=False) + copy( + self, + "*.h", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "EtcLib"), + keep_path=False, + ) def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) - if self.settings.os == "Linux": - self.cpp_info.system_libs.append("pthread") + self.cpp_info.libs = collect_libs(self) + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs = ["pthread"] diff --git a/recipes/etc2comp/all/test_package/CMakeLists.txt b/recipes/etc2comp/all/test_package/CMakeLists.txt index aede60e3b1e4a..174341b077e2c 100644 --- a/recipes/etc2comp/all/test_package/CMakeLists.txt +++ b/recipes/etc2comp/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -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() +find_package(etc2comp 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 etc2comp::etc2comp) set_property(TARGET ${CMAKE_PROJECT_NAME} PROPERTY CXX_STANDARD 11) diff --git a/recipes/etc2comp/all/test_package/conanfile.py b/recipes/etc2comp/all/test_package/conanfile.py index 4903f1a7e8fa0..ef5d7042163ec 100644 --- a/recipes/etc2comp/all/test_package/conanfile.py +++ b/recipes/etc2comp/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/etc2comp/all/test_v1_package/CMakeLists.txt b/recipes/etc2comp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/etc2comp/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/etc2comp/all/test_v1_package/conanfile.py b/recipes/etc2comp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..6c9d5dba712c7 --- /dev/null +++ b/recipes/etc2comp/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_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/etcd-cpp-apiv3/all/conandata.yml b/recipes/etcd-cpp-apiv3/all/conandata.yml new file mode 100644 index 0000000000000..639ef314f4821 --- /dev/null +++ b/recipes/etcd-cpp-apiv3/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.15.4": + url: "https://github.com/etcd-cpp-apiv3/etcd-cpp-apiv3/archive/refs/tags/v0.15.4.tar.gz" + sha256: "4516ecfa420826088c187efd42dad249367ca94ea6cdfc24e3030c3cf47af7b4" diff --git a/recipes/etcd-cpp-apiv3/all/conanfile.py b/recipes/etcd-cpp-apiv3/all/conanfile.py new file mode 100644 index 0000000000000..2d42f65ab0601 --- /dev/null +++ b/recipes/etcd-cpp-apiv3/all/conanfile.py @@ -0,0 +1,110 @@ +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout +from conan.tools.files import get, copy, rmdir +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration +import os + +required_conan_version = ">=1.53.0" + +class EtcdCppApiv3Conan(ConanFile): + name = "etcd-cpp-apiv3" + package_type = "library" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/etcd-cpp-apiv3/etcd-cpp-apiv3" + license = "BSD-3-Clause" + description = ("C++ library for etcd's v3 client APIs, i.e., ETCDCTL_API=3.") + topics = ("etcd", "api", ) + + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + @property + def _is_legacy_one_profile(self): + return not hasattr(self, "settings_build") + + @property + def _min_cppstd(self): + return 14 + + @property + def _compilers_minimum_version(self): + return { + "apple-clang": "10", + "clang": "7", + "gcc": "6", + "msvc": "191", + "Visual Studio": "15", + } + + 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 build_requirements(self): + if not self._is_legacy_one_profile: + self.tool_requires("protobuf/") + self.tool_requires("grpc/") + + def requirements(self): + self.requires("protobuf/3.21.12") + self.requires("openssl/[>=1.1 <4]") + self.requires("grpc/1.54.3") + self.requires("cpprestsdk/2.10.19", transitive_headers=True, transitive_libs=True) + + 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.") + + 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 self._is_legacy_one_profile: + env = VirtualRunEnv(self) + env.generate(scope="build") + + tc = CMakeToolchain(self) + tc.variables["gRPC_VERSION"] = self.dependencies["grpc"].ref.version + tc.variables["ETCD_CMAKE_CXX_STANDARD"] = self.settings.compiler.get_safe("cppstd", self._min_cppstd) + tc.variables["OpenSSL_DIR"] = self.dependencies["openssl"].package_folder.replace('\\', '/') + tc.generate() + + cmake_deps = CMakeDeps(self) + cmake_deps.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "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", "cmake")) + + def package_info(self): + self.cpp_info.libs = ["etcd-cpp-api"] diff --git a/recipes/etcd-cpp-apiv3/all/test_package/CMakeLists.txt b/recipes/etcd-cpp-apiv3/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..3dfe027a95ad7 --- /dev/null +++ b/recipes/etcd-cpp-apiv3/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES CXX) + +find_package(etcd-cpp-apiv3 REQUIRED) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE etcd-cpp-apiv3::etcd-cpp-apiv3) diff --git a/recipes/etcd-cpp-apiv3/all/test_package/conanfile.py b/recipes/etcd-cpp-apiv3/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0a6bc68712d90 --- /dev/null +++ b/recipes/etcd-cpp-apiv3/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/etcd-cpp-apiv3/all/test_package/test_package.cpp b/recipes/etcd-cpp-apiv3/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..b481840dd6d30 --- /dev/null +++ b/recipes/etcd-cpp-apiv3/all/test_package/test_package.cpp @@ -0,0 +1,13 @@ +#include +#include +#include +#include "etcd/Client.hpp" + +static const std::string etcd_url = + etcdv3::detail::resolve_etcd_endpoints("http://127.0.0.1:2379"); + +int main() +{ + etcd::Client* etcd = etcd::Client::WithUser(etcd_url, "root", "root"); + return EXIT_SUCCESS; +} diff --git a/recipes/etcd-cpp-apiv3/config.yml b/recipes/etcd-cpp-apiv3/config.yml new file mode 100644 index 0000000000000..810f6e84b1f61 --- /dev/null +++ b/recipes/etcd-cpp-apiv3/config.yml @@ -0,0 +1,3 @@ +versions: + "0.15.4": + folder: all diff --git a/recipes/eternal/all/conanfile.py b/recipes/eternal/all/conanfile.py index fd3a53c2138bb..e5e54e89f5ce3 100644 --- a/recipes/eternal/all/conanfile.py +++ b/recipes/eternal/all/conanfile.py @@ -7,7 +7,7 @@ import os -required_conan_version = ">=1.51.3" +required_conan_version = ">=1.50.0" class EternalConan(ConanFile): @@ -17,6 +17,7 @@ class EternalConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/mapbox/eternal" topics = ("hashing", "map", "constexpr", "header-only") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -34,10 +35,6 @@ def _compilers_minimum_version(self): "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") @@ -52,8 +49,7 @@ def validate(self): 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def build(self): pass @@ -64,6 +60,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/eternal/all/test_package/CMakeLists.txt b/recipes/eternal/all/test_package/CMakeLists.txt index 8d5920de9d2e0..332722f9d1b68 100644 --- a/recipes/eternal/all/test_package/CMakeLists.txt +++ b/recipes/eternal/all/test_package/CMakeLists.txt @@ -1,6 +1,5 @@ cmake_minimum_required(VERSION 3.8) - -project(test_package CXX) +project(test_package LANGUAGES CXX) find_package(eternal REQUIRED CONFIG) diff --git a/recipes/eternal/all/test_v1_package/CMakeLists.txt b/recipes/eternal/all/test_v1_package/CMakeLists.txt index e900db203f73f..be00a8c7f57c7 100644 --- a/recipes/eternal/all/test_v1_package/CMakeLists.txt +++ b/recipes/eternal/all/test_v1_package/CMakeLists.txt @@ -1,12 +1,8 @@ cmake_minimum_required(VERSION 3.8) - -project(test_package CXX) +project(test_package) 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) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/ethash/all/conandata.yml b/recipes/ethash/all/conandata.yml new file mode 100644 index 0000000000000..90bf836e839d3 --- /dev/null +++ b/recipes/ethash/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.0.1": + url: "https://github.com/chfast/ethash/archive/v1.0.1.tar.gz" + sha256: "17e0786ba8437c1b0c61f2065da71ce1b9cc871f8723a747a8aae8b71334d95f" diff --git a/recipes/ethash/all/conanfile.py b/recipes/ethash/all/conanfile.py new file mode 100644 index 0000000000000..b8c0665ba0213 --- /dev/null +++ b/recipes/ethash/all/conanfile.py @@ -0,0 +1,110 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout +from conan.tools.files import get, copy +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +import os + +required_conan_version = ">=1.51.1" + + +class EthashConan(ConanFile): + name = "ethash" + description = "C/C++ implementation of Ethash and ProgPoW – the Ethereum Proof of Work algorithms" + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/chfast/ethash" + topics = ("ethereum", "mining", "proof-of-work") + package_type = "library" + + settings = "os", "arch", "compiler", "build_type" + options = {"shared": [True, False], + "fPIC": [True, False], + "build_ethash": [True, False], + "build_global_context": [True, False]} + default_options = {"shared": False, + "fPIC": True, + "build_ethash": True, + "build_global_context": True} + + @property + def _min_cppstd(self): + return 14 + + 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 not self.options.build_ethash: + self.options.rm_safe("build_global_context") + + def layout(self): + cmake_layout(self, src_folder="src") + + @property + def _compilers_minimum_version(self): + return { + "Visual Studio": "15", + "msvc": "190", + "gcc": "5", + "clang": "5", + "apple-clang": "10", + } + + def build_requirements(self): + self.tool_requires("cmake/[>=3.16.2 <4]") + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + # INFO: Options are declared before project() call + tc.cache_variables["ETHASH_INSTALL_CMAKE_CONFIG"] = False + tc.cache_variables["ETHASH_TESTING"] = False + tc.cache_variables["ETHASH_BUILD_ETHASH"] = self.options.build_ethash + tc.cache_variables["ETHASH_BUILD_GLOBAL_CONTEXT"] = self.options.get_safe("build_global_context", False) + tc.generate() + + def validate(self): + if self.settings.get_safe("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): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + 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.components["keccak"].set_property("cmake_target_name", "ethash::keccak") + self.cpp_info.components["keccak"].libs = ["keccak"] + + if self.options.build_ethash: + self.cpp_info.components["ethash"].set_property("cmake_target_name", "ethash::ethash") + self.cpp_info.components["ethash"].requires = ["keccak"] + self.cpp_info.components["ethash"].libs = ["ethash"] + + if self.options.get_safe("build_global_context"): + # INFO: ethash-global-context is static library always + self.cpp_info.components["global_context"].set_property("cmake_target_name", "ethash::global-context") + self.cpp_info.components["global_context"].requires = ["ethash"] + self.cpp_info.components["global_context"].libs = ["ethash-global-context"] diff --git a/recipes/ethash/all/test_package/CMakeLists.txt b/recipes/ethash/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..5a5d08dd645f7 --- /dev/null +++ b/recipes/ethash/all/test_package/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(ethash REQUIRED CONFIG) + +set(ETHASH_TARGETS ethash::keccak) +if (TARGET ethash::ethash) + list(APPEND ETHASH_TARGETS ethash::ethash) +endif() +if (TARGET ethash::global-context) + list(APPEND ETHASH_TARGETS ethash::global-context) +endif() + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE ${ETHASH_TARGETS}) +set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 14) diff --git a/recipes/ethash/all/test_package/conanfile.py b/recipes/ethash/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fb96656f203 --- /dev/null +++ b/recipes/ethash/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/ethash/all/test_package/test_package.cpp b/recipes/ethash/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..da1378296d29d --- /dev/null +++ b/recipes/ethash/all/test_package/test_package.cpp @@ -0,0 +1,6 @@ +#include + +int main(int argc, char **) { + auto epoch_num = ethash::get_epoch_number(0); + return 0; +} diff --git a/recipes/ethash/config.yml b/recipes/ethash/config.yml new file mode 100644 index 0000000000000..715e55357a17b --- /dev/null +++ b/recipes/ethash/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 2de0fd014134d..ad1ca82dd2b02 100644 --- a/recipes/etl/all/conandata.yml +++ b/recipes/etl/all/conandata.yml @@ -1,28 +1,28 @@ sources: - "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" - "20.32.1": - url: "https://github.com/ETLCPP/etl/archive/20.32.1.tar.gz" - sha256: "f39c8ccf33190303946dbcb2b251c86b4516234f57e0e87b83c0a28a1bdb059d" - "20.31.3": - url: "https://github.com/ETLCPP/etl/archive/20.31.3.tar.gz" - sha256: "dabfeaec4e0aaee6920ee429ab262959595b78d65ef7846df13b5fe68ea85f4b" - "20.30.1": - url: "https://github.com/ETLCPP/etl/archive/20.30.1.tar.gz" - sha256: "10b50ca3ae406ae379e85504546843fc9d97be18924e71d8eb7e8e5a418e91cd" - "20.29.3": - url: "https://github.com/ETLCPP/etl/archive/20.29.3.tar.gz" - sha256: "8a0df2b475ea99bb27dd4ee04c39bda69e29be93b3709a1e243dcc2599e92ff4" + "20.39.4": + url: "https://github.com/ETLCPP/etl/archive/20.39.4.tar.gz" + sha256: "ce1222ed12fb39ae7a6160f8c33da61534d6b4c4d0d36be622910bbd545f5ee7" + "20.39.3": + url: "https://github.com/ETLCPP/etl/archive/20.39.3.tar.gz" + sha256: "1d596bc47d17959ced8b4586e0ae22348c903df6ab00f47ef900d854ef5e30c8" + "20.38.17": + url: "https://github.com/ETLCPP/etl/archive/20.38.17.tar.gz" + sha256: "5b490aca3faad3796a48bf0980e74f2a67953967fad3c051a6d4981051cb0b9a" + "20.38.16": + url: "https://github.com/ETLCPP/etl/archive/20.38.16.tar.gz" + sha256: "6d05e33d6e7eb2c8d4654c77dcd083adc70da29aba808f471ba7c6e2b8fcbf03" + "20.38.15": + url: "https://github.com/ETLCPP/etl/archive/20.38.15.tar.gz" + sha256: "c4f3108b35eb669ce4a6a217264ca133fe52cc8b5bce026a474ec81c0a2c4026" + "20.38.14": + url: "https://github.com/ETLCPP/etl/archive/20.38.14.tar.gz" + sha256: "d286191f0617e1c6c85e1ecb2175e84035918a7bf67d0bb347a8cb6fca3b2db4" + "20.38.13": + url: "https://github.com/ETLCPP/etl/archive/20.38.13.tar.gz" + sha256: "e606083e189a8fe6211c30c8c579b60c29658a531b5cafbb511daab1a2861a69" + "20.38.11": + url: "https://github.com/ETLCPP/etl/archive/20.38.11.tar.gz" + sha256: "c73b6b076ab59e02398a9f90a66198a9f8bf0cfa91af7be2eebefb3bb264ba83" + "20.38.10": + url: "https://github.com/ETLCPP/etl/archive/20.38.10.tar.gz" + sha256: "562f9b5d9e6786350b09d87be9c5f030073e34d7bf0a975de3e91476ddd471a3" diff --git a/recipes/etl/all/conanfile.py b/recipes/etl/all/conanfile.py index 11f8a49e83bd4..52ededc6ecbe6 100644 --- a/recipes/etl/all/conanfile.py +++ b/recipes/etl/all/conanfile.py @@ -1,69 +1,38 @@ from conan import ConanFile -from conan.tools.files import get, copy, save +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout import os -import textwrap - required_conan_version = ">=1.50.0" - class EmbeddedTemplateLibraryConan(ConanFile): name = "etl" description = "A C++ template library for embedded applications" license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.etlcpp.com/" - topics = ("cpp", "embedded", "template", "container", "utility", "framework", "messaging") + topics = ("cpp", "embedded", "template", "container", "utility", "framework", "messaging", "header-only") + package_type = "header-library" 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 + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): copy(self, "LICENSE", 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")) - # TODO: to remove in conan v2 once cmake_find_package* generators removed - self._create_cmake_module_alias_targets( - self, - os.path.join(self.package_folder, self._module_file_rel_path), - {"etl": "etl::etl"} - ) - - @staticmethod - def _create_cmake_module_alias_targets(conanfile, 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(conanfile, 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", "etl") - self.cpp_info.set_property("cmake_target_name", "etl") + self.cpp_info.set_property("cmake_target_name", "etl::etl") + self.cpp_info.set_property("cmake_target_aliases", ["etl"]) # legacy target before 20.27.2 self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] - 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.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/etl/all/test_package/CMakeLists.txt b/recipes/etl/all/test_package/CMakeLists.txt index 5755c51bbf480..b93512c6b9e61 100644 --- a/recipes/etl/all/test_package/CMakeLists.txt +++ b/recipes/etl/all/test_package/CMakeLists.txt @@ -1,8 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package CXX) +project(test_package LANGUAGES CXX) find_package(etl REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE etl::etl) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) -target_link_libraries(${PROJECT_NAME} etl) diff --git a/recipes/etl/all/test_package/conanfile.py b/recipes/etl/all/test_package/conanfile.py index 220ec13c13be3..ef412253ccf80 100644 --- a/recipes/etl/all/test_package/conanfile.py +++ b/recipes/etl/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/etl/all/test_v1_package/CMakeLists.txt b/recipes/etl/all/test_v1_package/CMakeLists.txt deleted file mode 100644 index b8e7ad788b821..0000000000000 --- a/recipes/etl/all/test_v1_package/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(etl REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) -target_link_libraries(${PROJECT_NAME} etl) diff --git a/recipes/etl/config.yml b/recipes/etl/config.yml index 7f5a085892dfb..084ac6d8aaecd 100644 --- a/recipes/etl/config.yml +++ b/recipes/etl/config.yml @@ -1,19 +1,19 @@ versions: - "20.35.7": + "20.39.4": folder: all - "20.35.5": + "20.39.3": folder: all - "20.35.0": + "20.38.17": folder: all - "20.34.0": + "20.38.16": folder: all - "20.33.0": + "20.38.15": folder: all - "20.32.1": + "20.38.14": folder: all - "20.31.3": + "20.38.13": folder: all - "20.30.1": + "20.38.11": folder: all - "20.29.3": + "20.38.10": folder: all diff --git a/recipes/eudev/all/conandata.yml b/recipes/eudev/all/conandata.yml new file mode 100644 index 0000000000000..72fcfaa216122 --- /dev/null +++ b/recipes/eudev/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "3.2.14": + url: "https://github.com/eudev-project/eudev/releases/download/v3.2.14/eudev-3.2.14.tar.gz" + sha256: "8da4319102f24abbf7fff5ce9c416af848df163b29590e666d334cc1927f006f" diff --git a/recipes/eudev/all/conanfile.py b/recipes/eudev/all/conanfile.py new file mode 100644 index 0000000000000..597e9d9b84092 --- /dev/null +++ b/recipes/eudev/all/conanfile.py @@ -0,0 +1,148 @@ +import os +import re + +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, load, rm, rmdir, save +from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps, PkgConfigDeps +from conan.tools.layout import basic_layout + + +required_conan_version = ">=1.54.0" + + +class EudevConan(ConanFile): + name = "eudev" + description = "eudev is a standalone dynamic and persistent device naming support (aka userspace devfs) daemon that runs independently from the init system." + license = "GPL-2.0-or-later" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/eudev-project/eudev" + topics = ("device", "udev") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "hwdb": [True, False], + "mtd_probe": [True, False], + "programs": [True, False], + "with_kmod": [True, False], + "with_libblkid": [True, False], + "with_selinux": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "hwdb": False, + "mtd_probe": False, + "programs": True, + "with_kmod": True, + "with_libblkid": True, + "with_selinux": True, + } + provides = "libudev" + + 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): + self.requires("acl/2.3.1") + self.requires("libcap/2.69") + self.requires("libxslt/1.1.42") + self.requires("linux-headers-generic/6.5.9") + + if self.options.with_kmod: + self.requires("kmod/30") + if self.options.with_libblkid: + self.requires("libmount/2.39.2") + if self.options.with_selinux: + self.requires("libselinux/3.6") + + def validate(self): + if self.settings.os != "Linux": + raise ConanInvalidConfiguration(f"{self.ref} is not supported on {self.settings.os}.") + + def build_requirements(self): + self.tool_requires("gperf/3.1") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/2.2.0") + + 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 = AutotoolsToolchain(self) + def yes_no(v): + return "yes" if v else "no" + tc.configure_args.extend([ + "--sysconfdir=${prefix}/res", + f"--enable-programs={yes_no(self.options.programs)}", + f"--enable-blkid={yes_no(self.options.with_libblkid)}", + f"--enable-selinux={yes_no(self.options.with_selinux)}", + f"--enable-kmod={yes_no(self.options.with_kmod)}", + f"--enable-hwdb={yes_no(self.options.hwdb)}", + f"--enable-mtd_probe={yes_no(self.options.mtd_probe)}", + "--enable-manpages=no", + ]) + tc.generate() + tc = PkgConfigDeps(self) + tc.generate() + tc = AutotoolsDeps(self) + tc.generate() + + def build(self): + autotools = Autotools(self) + autotools.configure() + autotools.make() + + @property + def _libudev_version_txt(self): + return os.path.join(self.package_folder, "res", f"{self.name}-libudev-version.txt") + + def package(self): + copy(self, "COPYING", self.source_folder, os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + autotools.install() + + pkg_config = load(self, os.path.join(self.package_folder, "lib", "pkgconfig", "libudev.pc")) + libudev_version = next(re.finditer("^Version: ([^\n$]+)[$\n]", pkg_config, flags=re.MULTILINE)).group(1) + save(self, self._libudev_version_txt, libudev_version) + + 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 = ["udev"] + libudev_version = load(self, self._libudev_version_txt).strip() + self.cpp_info.set_property("pkg_config_name", "libudev") + self.cpp_info.set_property("system_package_version", str(libudev_version)) + pkgconfig_variables = { + 'exec_prefix': '${prefix}', + } + self.cpp_info.set_property( + "pkg_config_custom_content", + "\n".join(f"{key}={value}" for key, value in pkgconfig_variables.items())) + self.cpp_info.requires = ["acl::acl", "libcap::cap", "libxslt::xslt", "linux-headers-generic::linux-headers-generic"] + if self.options.with_kmod: + self.cpp_info.requires.append("kmod::kmod") + if self.options.with_libblkid: + self.cpp_info.requires.append("libmount::libblkid") + if self.options.with_selinux: + self.cpp_info.requires.append("libselinux::selinux") + + # todo Remove this workaround for Conan v1 + self.cpp_info.set_property("component_version", str(libudev_version)) diff --git a/recipes/eudev/all/test_package/CMakeLists.txt b/recipes/eudev/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..ba37277275903 --- /dev/null +++ b/recipes/eudev/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) + +find_package(eudev REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE eudev::eudev) diff --git a/recipes/eudev/all/test_package/conanfile.py b/recipes/eudev/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0ce98f8735f95 --- /dev/null +++ b/recipes/eudev/all/test_package/conanfile.py @@ -0,0 +1,31 @@ +import os + +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +from conan.tools.gnu import PkgConfig +from conan.tools.scm import Version + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "PkgConfigDeps", "VirtualRunEnv" + 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): + pkg_config = PkgConfig(self, "libudev", pkg_config_path=self.generators_folder) + assert Version(pkg_config.version) >= 251, f"{pkg_config.version} should be >= 251" + 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/eudev/all/test_package/test_package.c b/recipes/eudev/all/test_package/test_package.c new file mode 100644 index 0000000000000..05b8913de0a37 --- /dev/null +++ b/recipes/eudev/all/test_package/test_package.c @@ -0,0 +1,25 @@ +#include +#include +#include + + +int main() { + struct udev *udev; + struct udev_enumerate *enumerate; + + udev = udev_new(); + if (!udev) { + fprintf(stderr, "Cannot create udev context.\n"); + return 1; + } + + enumerate = udev_enumerate_new(udev); + if (!enumerate) { + fprintf(stderr, "Cannot create enumerate context.\n"); + } + + udev_enumerate_unref(enumerate); + udev_unref(udev); + + return EXIT_SUCCESS; +} diff --git a/recipes/eudev/config.yml b/recipes/eudev/config.yml new file mode 100644 index 0000000000000..3420dd6df85af --- /dev/null +++ b/recipes/eudev/config.yml @@ -0,0 +1,3 @@ +versions: + "3.2.14": + folder: all diff --git a/recipes/eventpp/all/conandata.yml b/recipes/eventpp/all/conandata.yml new file mode 100644 index 0000000000000..71d384d9d4cba --- /dev/null +++ b/recipes/eventpp/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.1.3": + url: "https://github.com/wqking/eventpp/archive/v0.1.3.tar.gz" + sha256: "D87ABA67223FD9ACED2BA55EB82BD534007E43E1B919106A53FCD3070FA125EA" diff --git a/recipes/eventpp/all/conanfile.py b/recipes/eventpp/all/conanfile.py new file mode 100644 index 0000000000000..93267303876fd --- /dev/null +++ b/recipes/eventpp/all/conanfile.py @@ -0,0 +1,48 @@ +from conan import ConanFile +from conan.tools.files import get, copy, export_conandata_patches, apply_conandata_patches +from conan.tools.build import check_min_cppstd +from conan.tools.layout import basic_layout +import os + +required_conan_version = ">=1.51.1" + +class EventppConan(ConanFile): + name = "eventpp" + description = "Event Dispatcher and callback list for C++" + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/wqking/eventpp" + topics = ("observer-pattern", "event-dispatcher", "signal", "slot", "publish-subscribe", "nested-events", "thread-safe", "header-only") + + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + + @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.get_safe("compiler.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="*.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/eventpp/all/test_package/CMakeLists.txt b/recipes/eventpp/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..2af5b0c5c6a38 --- /dev/null +++ b/recipes/eventpp/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.12) +project(test_package LANGUAGES CXX) + +find_package(eventpp REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE eventpp::eventpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/eventpp/all/test_package/conanfile.py b/recipes/eventpp/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fb96656f203 --- /dev/null +++ b/recipes/eventpp/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/eventpp/all/test_package/test_package.cpp b/recipes/eventpp/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..565b7248f28f9 --- /dev/null +++ b/recipes/eventpp/all/test_package/test_package.cpp @@ -0,0 +1,14 @@ +#include + +int main(void) { + eventpp::CallbackList callbackList; + + callbackList.append([](const int i, const bool b) { + (void) i; + (void) b; + }); + + callbackList(1, true); + + return 0; +} diff --git a/recipes/eventpp/all/test_v1_package/CMakeLists.txt b/recipes/eventpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..9652e22fc19d5 --- /dev/null +++ b/recipes/eventpp/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/eventpp/all/test_v1_package/conanfile.py b/recipes/eventpp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/eventpp/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/eventpp/config.yml b/recipes/eventpp/config.yml new file mode 100644 index 0000000000000..b7f57204004e4 --- /dev/null +++ b/recipes/eventpp/config.yml @@ -0,0 +1,3 @@ +versions: + "0.1.3": + folder: all diff --git a/recipes/evmc/all/conandata.yml b/recipes/evmc/all/conandata.yml new file mode 100644 index 0000000000000..89f67a9cea549 --- /dev/null +++ b/recipes/evmc/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "11.0.0": + url: "https://github.com/ethereum/evmc/archive/v11.0.0.tar.gz" + sha256: "a628ba9062b80540c553e92a44288c696532461ea9c08ef00b2c2a677095727e" + "10.1.1": + url: "https://github.com/ethereum/evmc/archive/v10.1.1.tar.gz" + sha256: "314a18635b2727a5129a7da3e4e15bd2fd76ee0c5ae19f21391b7a94e79cf459" diff --git a/recipes/evmc/all/conanfile.py b/recipes/evmc/all/conanfile.py new file mode 100644 index 0000000000000..13c6e5da4cc78 --- /dev/null +++ b/recipes/evmc/all/conanfile.py @@ -0,0 +1,81 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout +from conan.tools.files import get, copy, rmdir +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +import os + + +required_conan_version = ">=1.54.0" + + +class EVMCConan(ConanFile): + name = "evmc" + description = "EVMC – Ethereum Client-VM Connector API" + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/ethereum/evmc" + topics = ("ethereum", "wasm", "evm") + package_type = "static-library" + settings = "os", "arch", "compiler", "build_type" + tool_requires = "cmake/[>=3.16.2 <4]" + 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": "9", + "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 generate(self): + tc = CMakeToolchain(self) + tc.variables["EVMC_INSTALL"] = True + tc.variables["EVMC_TESTING"] = False + tc.variables["EVMC_JAVA"] = False + tc.variables["EVMC_TESTING"] = False + tc.variables["EVMC_EXAMPLES"] = False + tc.variables["EVMC_TOOLS"] = False + tc.variables["HUNTER_ENABLED"] = False + tc.generate() + + def validate(self): + if self.settings.get_safe("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): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + 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 = ["evmc-instructions", "evmc-loader", "tooling"] diff --git a/recipes/evmc/all/test_package/CMakeLists.txt b/recipes/evmc/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..d3cab735f84a2 --- /dev/null +++ b/recipes/evmc/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.12) +project(test_package LANGUAGES CXX) + +find_package(evmc REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE evmc::evmc) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/evmc/all/test_package/conanfile.py b/recipes/evmc/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fb96656f203 --- /dev/null +++ b/recipes/evmc/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/evmc/all/test_package/test_package.cpp b/recipes/evmc/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..2810a6cfce945 --- /dev/null +++ b/recipes/evmc/all/test_package/test_package.cpp @@ -0,0 +1,19 @@ +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +int main() { + const auto table = evmc_get_instruction_names_table(EVMC_BYZANTIUM); + std::cout << "HEX 0x80: " << evmc::hex(0x80) << std::endl; + + return EXIT_SUCCESS; +} diff --git a/recipes/evmc/config.yml b/recipes/evmc/config.yml new file mode 100644 index 0000000000000..78558509f0505 --- /dev/null +++ b/recipes/evmc/config.yml @@ -0,0 +1,5 @@ +versions: + "11.0.0": + folder: all + "10.1.1": + folder: all diff --git a/recipes/exiv2/all/conandata.yml b/recipes/exiv2/all/conandata.yml index 5352f4d8920bf..49ba0667271df 100644 --- a/recipes/exiv2/all/conandata.yml +++ b/recipes/exiv2/all/conandata.yml @@ -1,21 +1,17 @@ sources: + "0.28.3": + url: "https://github.com/Exiv2/exiv2/archive/refs/tags/v0.28.3.tar.gz" + sha256: "1315e17d454bf4da3cc0edb857b1d2c143670f3485b537d0f946d9ed31d87b70" + "0.28.2": + url: "https://github.com/Exiv2/exiv2/archive/refs/tags/v0.28.2.tar.gz" + sha256: "543bead934135f20f438e0b6d8858c55c5fcb7ff80f5d1d55489965f1aad58b9" + "0.28.1": + url: "https://github.com/Exiv2/exiv2/archive/refs/tags/v0.28.1.tar.gz" + sha256: "3078651f995cb6313b1041f07f4dd1bf0e9e4d394d6e2adc6e92ad0b621291fa" "0.27.5": - url: "https://github.com/Exiv2/exiv2/archive/refs/tags/v0.27.5.tar.gz" - sha256: "1da1721f84809e4d37b3f106adb18b70b1b0441c860746ce6812bb3df184ed6c" - "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.5/exiv2-0.27.5-Source.tar.gz" + sha256: "35a58618ab236a901ca4928b0ad8b31007ebdc0386d904409d825024e45ea6e2" 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" - - patch_file: "patches/0002-fpic.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" diff --git a/recipes/exiv2/all/conanfile.py b/recipes/exiv2/all/conanfile.py index ba73c4ac8d363..93bf130b53027 100644 --- a/recipes/exiv2/all/conanfile.py +++ b/recipes/exiv2/all/conanfile.py @@ -1,12 +1,15 @@ -from conan import ConanFile -from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout, CMakeDeps +from conan import ConanFile, conan_version 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, msvc_runtime_flag +from conan.tools.build import check_min_cppstd, check_max_cppstd +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, replace_in_file +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime, check_min_vs +from conan.tools.scm import Version import os +import sys import textwrap -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class Exiv2Conan(ConanFile): @@ -14,10 +17,11 @@ class Exiv2Conan(ConanFile): description = "Exiv2 is a C++ library and a command-line utility " \ "to read, write, delete and modify Exif, IPTC, XMP and ICC image metadata." license = "GPL-2.0" - topics = ("image", "exif", "xmp") - homepage = "https://www.exiv2.org" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://www.exiv2.org" + topics = ("image", "exif", "xmp") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -25,6 +29,9 @@ class Exiv2Conan(ConanFile): "with_png": [True, False], "with_xmp": [False, "bundled", "external"], "with_curl": [True, False], + "with_brotli": [True, False], + "with_inih": [True, False], + "win_unicode": [True, False], } default_options = { "shared": False, @@ -32,44 +39,77 @@ class Exiv2Conan(ConanFile): "with_png": True, "with_xmp": "bundled", "with_curl": False, + "with_brotli": True, + "with_inih": True, + "win_unicode": False, } - provides = [] - def export_sources(self): export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + if Version(self.version) >= "0.28.0": + del self.options.win_unicode + else: + del self.options.with_brotli + del self.options.with_inih + + if self.settings.os == "Windows": + self.options.win_unicode = True 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") + self.provides = ["xmp-toolkit-sdk"] + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): self.requires("libiconv/1.17") if self.options.with_png: - self.requires("libpng/1.6.38") + self.requires("libpng/[>=1.6 <2]") + self.requires("zlib/[>=1.2.11 <2]") if self.options.with_xmp == "bundled": - self.requires("expat/2.4.9") + self.requires("expat/[>=2.6.2 <3]") if self.options.with_curl: - self.requires("libcurl/7.85.0") + self.requires("libcurl/[>=7.78.0 <9]") + if self.options.get_safe("with_brotli"): + self.requires("brotli/1.1.0") + if self.options.get_safe("with_inih"): + self.requires("inih/58") def validate(self): + if Version(self.version) >= "0.28.0": + min_cppstd = 17 + + check_min_cppstd(self, min_cppstd) + check_min_vs(self, 191) + + compilers_minimum_version = { + "gcc": "8", + "clang": "5", + "apple-clang": "10", + } + minimum_version = compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.info.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{min_cppstd}, which your compiler does not fully support." + ) + else: + # https://github.com/Exiv2/exiv2/tree/v0.27.7#217-building-with-c11-and-other-compilers + check_max_cppstd(self, 14) + if self.options.with_xmp == "external": raise ConanInvalidConfiguration("adobe-xmp-toolkit is not available on cci (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) @@ -83,19 +123,33 @@ def generate(self): tc.variables["EXIV2_ENABLE_WEBREADY"] = self.options.with_curl tc.variables["EXIV2_ENABLE_CURL"] = self.options.with_curl tc.variables["EXIV2_ENABLE_SSH"] = False + if Version(self.version) >= "0.28.0": + tc.variables["EXIV2_ENABLE_BMFF"] = self.options.with_brotli + tc.variables["EXIV2_ENABLE_BROTLI"] = self.options.with_brotli + tc.variables["EXIV2_ENABLE_INIH"] = self.options.with_inih + else: + tc.variables["EXIV2_ENABLE_WIN_UNICODE"] = self.options.win_unicode tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" if is_msvc(self): - tc.variables["EXIV2_ENABLE_DYNAMIC_RUNTIME"] = "MD" in msvc_runtime_flag(self) - # set PIC manually because of object target exiv2_int + tc.variables["EXIV2_ENABLE_DYNAMIC_RUNTIME"] = not is_msvc_static_runtime(self) + # set PIC manually because of the internal static library 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): + def _patch_sources(self): apply_conandata_patches(self) + replace_in_file(self, os.path.join(self.source_folder, "src", "CMakeLists.txt"), + "POSITION_INDEPENDENT_CODE ON", "") + # Enforce usage of FindEXPAT.cmake + replace_in_file(self, os.path.join(self.source_folder, "cmake", "findDependencies.cmake"), + "find_package(EXPAT REQUIRED)", "find_package(EXPAT REQUIRED MODULE)") + + def build(self): + self._patch_sources() cmake = CMake(self) cmake.configure() cmake.build() @@ -108,30 +162,6 @@ def package(self): 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"} - if self.options.with_xmp == "bundled": - targets.update({"exiv2-xmp": "exiv2::exiv2-xmp"}) - self._create_cmake_module_alias_targets( - os.path.join(self.package_folder, self._module_file_rel_path), - targets - ) - - 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", "conan-official-{}-targets.cmake".format(self.name)) - def package_info(self): self.cpp_info.set_property("cmake_file_name", "exiv2") self.cpp_info.set_property("pkg_config_name", "exiv2") @@ -141,9 +171,13 @@ 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") + if self.options.get_safe("with_brotli"): + self.cpp_info.components["exiv2lib"].requires.extend(["brotli::brotlidec", "brotli::brotlienc"]) + if self.options.get_safe("with_inih"): + self.cpp_info.components["exiv2lib"].requires.append("inih::inireader") if self.settings.os in ("FreeBSD", "Linux"): self.cpp_info.components["exiv2lib"].system_libs.extend(["pthread"]) @@ -153,14 +187,10 @@ def package_info(self): # component exiv2-xmp if self.options.with_xmp == "bundled": - self.cpp_info.components["exiv2-xmp"].set_property("cmake_target_name", "exiv2-xmp") - self.cpp_info.components["exiv2-xmp"].libs = ["exiv2-xmp"] - self.cpp_info.components["exiv2-xmp"].requires = [ "expat::expat" ] - self.cpp_info.components["exiv2lib"].requires.append("exiv2-xmp") - - # TODO: to remove in conan v2 once cmake_find_package_* generators removed - self.cpp_info.components["exiv2lib"].build_modules["cmake_find_package"] = [self._module_file_rel_path] - self.cpp_info.components["exiv2lib"].build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] - if self.options.with_xmp == "bundled": - self.cpp_info.components["exiv2-xmp"].build_modules["cmake_find_package"] = [self._module_file_rel_path] - self.cpp_info.components["exiv2-xmp"].build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] + if Version(self.version) < "0.28.0": + self.cpp_info.components["exiv2-xmp"].set_property("cmake_target_name", "exiv2-xmp") + self.cpp_info.components["exiv2-xmp"].libs = ["exiv2-xmp"] + self.cpp_info.components["exiv2-xmp"].requires = [ "expat::expat" ] + self.cpp_info.components["exiv2lib"].requires.append("exiv2-xmp") + else: + self.cpp_info.components["exiv2lib"].requires.append("expat::expat") diff --git a/recipes/exiv2/all/patches/0001-link-0.27.5.patch b/recipes/exiv2/all/patches/0001-link-0.27.5.patch index b94b7e7a8c10c..54a08d019d541 100644 --- a/recipes/exiv2/all/patches/0001-link-0.27.5.patch +++ b/recipes/exiv2/all/patches/0001-link-0.27.5.patch @@ -1,19 +1,3 @@ -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 diff --git a/recipes/exiv2/all/patches/0001-link.patch b/recipes/exiv2/all/patches/0001-link.patch deleted file mode 100644 index fd93d6c5c3698..0000000000000 --- a/recipes/exiv2/all/patches/0001-link.patch +++ /dev/null @@ -1,26 +0,0 @@ -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index c52b352f..2c270c5f 100644 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -215,7 +215,7 @@ else() - endif() - - if( EXIV2_ENABLE_PNG ) -- target_link_libraries( exiv2lib PRIVATE $) -+ target_link_libraries( exiv2lib PRIVATE ZLIB::ZLIB) - endif() - - if( EXIV2_ENABLE_NLS ) -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/0002-fpic.patch b/recipes/exiv2/all/patches/0002-fpic.patch deleted file mode 100644 index 680f251bd8de4..0000000000000 --- a/recipes/exiv2/all/patches/0002-fpic.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index c52b352f..92fcd847 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 --) -- - target_include_directories(exiv2lib_int PRIVATE ${ZLIB_INCLUDE_DIR}) - target_include_directories(exiv2lib PRIVATE - $ diff --git a/recipes/exiv2/all/patches/0004-find-expat.patch b/recipes/exiv2/all/patches/0004-find-expat.patch deleted file mode 100644 index 5bb571eb0f807..0000000000000 --- a/recipes/exiv2/all/patches/0004-find-expat.patch +++ /dev/null @@ -1,15 +0,0 @@ -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 3bd4318c428ba..47e4eda57e2b4 100644 --- a/recipes/exiv2/all/test_package/CMakeLists.txt +++ b/recipes/exiv2/all/test_package/CMakeLists.txt @@ -1,7 +1,11 @@ cmake_minimum_required(VERSION 3.1) -project(test_package CXX) +project(test_package LANGUAGES CXX) find_package(exiv2 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} exiv2lib) +target_link_libraries(${PROJECT_NAME} PRIVATE exiv2lib) + +if(${exiv2_VERSION} VERSION_GREATER_EQUAL "0.28.0") + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +endif() diff --git a/recipes/exiv2/all/test_package/conanfile.py b/recipes/exiv2/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/exiv2/all/test_package/conanfile.py +++ b/recipes/exiv2/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/exiv2/all/test_v1_package/CMakeLists.txt b/recipes/exiv2/all/test_v1_package/CMakeLists.txt deleted file mode 100644 index f62a34fb6ca55..0000000000000 --- a/recipes/exiv2/all/test_v1_package/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -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/test_package.cpp) -target_link_libraries(${PROJECT_NAME} exiv2lib) diff --git a/recipes/exiv2/config.yml b/recipes/exiv2/config.yml index 470d3a327a30b..572fad2a57e09 100644 --- a/recipes/exiv2/config.yml +++ b/recipes/exiv2/config.yml @@ -1,5 +1,9 @@ versions: - "0.27.5": + "0.28.3": + folder: all + "0.28.2": folder: all - "0.27.4": + "0.28.1": + folder: all + "0.27.5": folder: all diff --git a/recipes/expat/all/conandata.yml b/recipes/expat/all/conandata.yml index f3b9d575c901c..70605fb111359 100644 --- a/recipes/expat/all/conandata.yml +++ b/recipes/expat/all/conandata.yml @@ -1,4 +1,16 @@ sources: + "2.6.4": + url: "https://github.com/libexpat/libexpat/releases/download/R_2_6_4/expat-2.6.4.tar.xz" + sha256: "a695629dae047055b37d50a0ff4776d1d45d0a4c842cf4ccee158441f55ff7ee" + "2.6.3": + url: "https://github.com/libexpat/libexpat/releases/download/R_2_6_3/expat-2.6.3.tar.xz" + sha256: "274db254a6979bde5aad404763a704956940e465843f2a9bd9ed7af22e2c0efc" + "2.6.2": + url: "https://github.com/libexpat/libexpat/releases/download/R_2_6_2/expat-2.6.2.tar.xz" + sha256: "ee14b4c5d8908b1bec37ad937607eab183d4d9806a08adee472c3c3121d27364" + "2.6.0": + url: "https://github.com/libexpat/libexpat/releases/download/R_2_6_0/expat-2.6.0.tar.xz" + sha256: "cb5f5a8ea211e1cabd59be0a933a52e3c02cc326e86a4d387d8d218e7ee47a3e" "2.5.0": url: "https://github.com/libexpat/libexpat/releases/download/R_2_5_0/expat-2.5.0.tar.xz" sha256: "ef2420f0232c087801abf705e89ae65f6257df6b7931d37846a193ef2e8cdcbe" @@ -8,27 +20,6 @@ sources: "2.4.8": sha256: "f79b8f904b749e3e0d20afeadecf8249c55b2e32d4ebb089ae378df479dcaf25" url: "https://github.com/libexpat/libexpat/releases/download/R_2_4_8/expat-2.4.8.tar.xz" - "2.4.7": - sha256: "9875621085300591f1e64c18fd3da3a0eeca4a74f884b9abac2758ad1bd07a7d" - url: "https://github.com/libexpat/libexpat/releases/download/R_2_4_7/expat-2.4.7.tar.xz" - "2.4.6": - sha256: "de55794b7a9bc214852fdc075beaaecd854efe1361597e6268ee87946951289b" - url: "https://github.com/libexpat/libexpat/releases/download/R_2_4_6/expat-2.4.6.tar.xz" - "2.4.5": - sha256: "f2af8fc7cdc63a87920da38cd6d12cb113c3c3a3f437495b1b6541e0cff32579" - url: "https://github.com/libexpat/libexpat/releases/download/R_2_4_5/expat-2.4.5.tar.xz" - "2.4.4": - sha256: "b5d25d6e373351c2ed19b562b4732d01d2589ac8c8e9e7962d8df1207cc311b8" - url: "https://github.com/libexpat/libexpat/releases/download/R_2_4_4/expat-2.4.4.tar.xz" - "2.4.3": - sha256: "b1f9f1b1a5ebb0acaa88c9ff79bfa4e145823b78aa5185e5c5d85f060824778a" - url: "https://github.com/libexpat/libexpat/releases/download/R_2_4_3/expat-2.4.3.tar.xz" - "2.4.2": - sha256: "a2fb692e8e610406168296f25ba500ae8ce22cb4c8947a8689894d744b6deb02" - url: "https://github.com/libexpat/libexpat/releases/download/R_2_4_2/expat-2.4.2.tar.gz" - "2.4.1": - sha256: "a00ae8a6b96b63a3910ddc1100b1a7ef50dc26dceb65ced18ded31ab392f132b" - url: "https://github.com/libexpat/libexpat/releases/download/R_2_4_1/expat-2.4.1.tar.gz" "2.3.0": sha256: "89df123c62f2c2e2b235692d9fe76def6a9ab03dbe95835345bf412726eb1987" url: "https://github.com/libexpat/libexpat/releases/download/R_2_3_0/expat-2.3.0.tar.gz" diff --git a/recipes/expat/all/conanfile.py b/recipes/expat/all/conanfile.py index 04caae4cbe008..baaf7c03c6cca 100644 --- a/recipes/expat/all/conanfile.py +++ b/recipes/expat/all/conanfile.py @@ -14,16 +14,19 @@ class ExpatConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/libexpat/libexpat" topics = ("xml", "parsing") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], "char_type": ["char", "wchar_t", "ushort"], + "large_size": [True, False], } default_options = { "shared": False, "fPIC": True, "char_type": "char", + "large_size": False, } def export_sources(self): @@ -43,7 +46,7 @@ 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) @@ -56,6 +59,7 @@ def generate(self): if is_msvc(self): tc.variables["EXPAT_MSVC_STATIC_CRT"] = is_msvc_static_runtime(self) tc.variables["EXPAT_BUILD_PKGCONFIG"] = False + tc.variables["EXPAT_LARGE_SIZE"] = self.options.large_size tc.generate() def build(self): @@ -87,6 +91,8 @@ 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.options.large_size: + self.cpp_info.defines.append("XML_LARGE_SIZE") if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("m") diff --git a/recipes/expat/all/test_package_module/CMakeLists.txt b/recipes/expat/all/test_package_module/CMakeLists.txt index cc3b096a67958..9d264c42f3e45 100644 --- a/recipes/expat/all/test_package_module/CMakeLists.txt +++ b/recipes/expat/all/test_package_module/CMakeLists.txt @@ -14,7 +14,7 @@ set(_custom_vars EXPAT_FOUND ) foreach(_custom_var ${_custom_vars}) - if(DEFINED _custom_var) + if(DEFINED ${_custom_var}) message(STATUS "${_custom_var}: ${${_custom_var}}") else() message(FATAL_ERROR "${_custom_var} not defined") diff --git a/recipes/expat/config.yml b/recipes/expat/config.yml index e09e9d75495cc..3fbe2e2e68e1d 100644 --- a/recipes/expat/config.yml +++ b/recipes/expat/config.yml @@ -1,23 +1,17 @@ versions: - "2.5.0": - folder: all - "2.4.9": - folder: all - "2.4.8": + "2.6.4": folder: all - "2.4.7": + "2.6.3": folder: all - "2.4.6": + "2.6.2": folder: all - "2.4.5": + "2.6.0": folder: all - "2.4.4": - folder: all - "2.4.3": + "2.5.0": folder: all - "2.4.2": + "2.4.9": folder: all - "2.4.1": + "2.4.8": folder: all "2.3.0": folder: all diff --git a/recipes/expected-lite/all/conandata.yml b/recipes/expected-lite/all/conandata.yml index 164f98f702d8b..bbd60fdda1306 100644 --- a/recipes/expected-lite/all/conandata.yml +++ b/recipes/expected-lite/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "0.8.0": + url: "https://github.com/martinmoene/expected-lite/archive/v0.8.0.tar.gz" + sha256: "27649f30bd9d4fe7b193ab3eb6f78c64d0f585c24c085f340b4722b3d0b5e701" + "0.7.0": + url: "https://github.com/martinmoene/expected-lite/archive/v0.7.0.tar.gz" + sha256: "8e266cd304d405e02a6b4abf881ab7d8e203ca719c513711cf89a3b4e5d97918" + "0.6.3": + url: "https://github.com/martinmoene/expected-lite/archive/v0.6.3.tar.gz" + sha256: "b2f90d5f03f6423ec67cc3c06fd0c4e813ec10c4313062b875b37d17593b57b4" "0.6.2": url: "https://github.com/martinmoene/expected-lite/archive/v0.6.2.tar.gz" sha256: "8e3c58fddb32abc22a429543440554f1ae50d1de3fb9a0abf699bc3f247dc1da" diff --git a/recipes/expected-lite/all/conanfile.py b/recipes/expected-lite/all/conanfile.py index bb539b3e7df62..d964e10b21ad2 100644 --- a/recipes/expected-lite/all/conanfile.py +++ b/recipes/expected-lite/all/conanfile.py @@ -9,11 +9,12 @@ class ExpectedLiteConan(ConanFile): name = "expected-lite" - url = "https://github.com/conan-io/conan-center-index" - homepage = "https://github.com/martinmoene/expected-lite" description = "expected lite - Expected objects in C++11 and later in a single-file header-only library" - topics = ("cpp11", "cpp14", "cpp17", "expected", "expected-implementations") license = "BSL-1.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/martinmoene/expected-lite" + topics = ("cpp11", "cpp14", "cpp17", "expected", "expected-implementations", "header-only") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -28,8 +29,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 @@ -42,9 +42,7 @@ def package_info(self): self.cpp_info.set_property("cmake_file_name", "expected-lite") self.cpp_info.set_property("cmake_target_name", "nonstd::expected-lite") 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"] = "expected-lite" @@ -54,3 +52,4 @@ def package_info(self): self.cpp_info.components["expectedlite"].names["cmake_find_package"] = "expected-lite" self.cpp_info.components["expectedlite"].names["cmake_find_package_multi"] = "expected-lite" self.cpp_info.components["expectedlite"].set_property("cmake_target_name", "nonstd::expected-lite") + self.cpp_info.components["expectedlite"].libdirs = [] diff --git a/recipes/expected-lite/all/test_package/conanfile.py b/recipes/expected-lite/all/test_package/conanfile.py index d120a992c06a6..8a5bb47f50c4c 100644 --- a/recipes/expected-lite/all/test_package/conanfile.py +++ b/recipes/expected-lite/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/expected-lite/config.yml b/recipes/expected-lite/config.yml index ad5f08f24e4fd..1cfd509cacf71 100644 --- a/recipes/expected-lite/config.yml +++ b/recipes/expected-lite/config.yml @@ -1,4 +1,10 @@ versions: + "0.8.0": + folder: all + "0.7.0": + folder: all + "0.6.3": + folder: all "0.6.2": folder: all "0.6.1": diff --git a/recipes/exprtk/all/conandata.yml b/recipes/exprtk/all/conandata.yml index 7cc52941e132f..f5d45981f8145 100755 --- a/recipes/exprtk/all/conandata.yml +++ b/recipes/exprtk/all/conandata.yml @@ -1,4 +1,12 @@ sources: + "0.0.3": + url: "https://github.com/ArashPartow/exprtk/archive/0.0.3.tar.gz" + sha256: "f9dec6975e86c702033d6a65ba9a0368eba31a61b89d74f2b5d24457c02c8439" + + "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/all/conanfile.py b/recipes/exprtk/all/conanfile.py index 659e03b1f7e7e..d791fd83adf69 100755 --- a/recipes/exprtk/all/conanfile.py +++ b/recipes/exprtk/all/conanfile.py @@ -1,42 +1,52 @@ +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, load, save +from conan.tools.scm import Version import os -from conans import ConanFile, tools -required_conan_version = ">=1.33.0" +required_conan_version = ">=2.0" class ExprTkConan(ConanFile): name = "exprtk" description = "C++ Mathematical Expression Parsing And Evaluation Library ExprTk" - license = ("MIT") - topics = ("exprtk", "cpp", "math", "mathematics", "parser", "lexer", "numerical") + license = "MIT" + topics = ("math", "mathematics", "parser", "lexer", "numerical", "header-only") homepage = "https://www.partow.net/programming/exprtk/index.html" 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" - - 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): + 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 _extract_license(self): - exprtk_header_file = "exprtk.hpp" - file = os.path.join(self.source_folder, self._source_subfolder, exprtk_header_file) - file_content = tools.load(file) - license_end = "/MIT *" - license_contents = file_content[2:file_content.find(license_end) + len(license_end)] - tools.save(os.path.join(self.package_folder, "licenses", "LICENSE"), license_contents) + if Version(self.version) >= "0.0.3": + license_file = "license.txt" + copy(self, license_file, src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + else: + exprtk_header_file = "exprtk.hpp" + file = os.path.join(self.source_folder, exprtk_header_file) + file_content = load(self, file) + license_end = "/MIT *" + license_contents = file_content[2:file_content.find(license_end) + len(license_end)] + save(self, os.path.join(self.package_folder, "licenses", "LICENSE"), license_contents) def package(self): self._extract_license() - self.copy("exprtk.hpp", dst="include" , src=self._source_subfolder) + copy(self, "exprtk.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/exprtk/all/test_package/CMakeLists.txt b/recipes/exprtk/all/test_package/CMakeLists.txt index d2caf6eebd908..632ea1ba6d56e 100755 --- a/recipes/exprtk/all/test_package/CMakeLists.txt +++ b/recipes/exprtk/all/test_package/CMakeLists.txt @@ -1,17 +1,15 @@ -cmake_minimum_required(VERSION 3.1) +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(exprtk REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE exprtk::exprtk) if (MSVC) - target_compile_options(${PROJECT_NAME} PRIVATE "/bigobj") + # Compile will fail without this flag + # TODO should this be something added into conan recipe? + target_compile_options(${PROJECT_NAME} PRIVATE "/bigobj") endif (MSVC) - -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) diff --git a/recipes/exprtk/all/test_package/conanfile.py b/recipes/exprtk/all/test_package/conanfile.py index 5c09494bc67c0..e845ae751a301 100755 --- a/recipes/exprtk/all/test_package/conanfile.py +++ b/recipes/exprtk/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 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/exprtk/all/test_package/test_package.cpp b/recipes/exprtk/all/test_package/test_package.cpp index 8ae4a2288e7ce..f668e5bbe9c03 100755 --- a/recipes/exprtk/all/test_package/test_package.cpp +++ b/recipes/exprtk/all/test_package/test_package.cpp @@ -1,78 +1,9 @@ -/* - ************************************************************** - * C++ Mathematical Expression Toolkit Library * - * * - * Exprtk Test Package * - * Author: Arash Partow (1999-2022) * - * URL: https://www.partow.net/programming/exprtk/index.html * - * * - * Copyright notice: * - * Free use of the Mathematical Expression Toolkit Library is * - * permitted under the guidelines and in accordance with the * - * most current version of the MIT License. * - * http://www.opensource.org/licenses/MIT * - * * - ************************************************************** -*/ - - -#include -#include - #include - - -template -void test_function() -{ - typedef exprtk::symbol_table symbol_table_t; - typedef exprtk::expression expression_t; - typedef exprtk::parser parser_t; - typedef exprtk::parser_error::type error_t; - - symbol_table_t symbol_table; - expression_t expression; - parser_t parser; - - T x = 1; - T y = 2; - - const std::string expression_string = "x * y + 3"; - - symbol_table.add_variable("x",x); - symbol_table.add_variable("y",y); - - expression.register_symbol_table(symbol_table); - - if (!parser.compile(expression_string,expression)) - { - printf("Error: %s\tExpression: %s\n", - parser.error().c_str(), - expression_string.c_str()); - - for (std::size_t i = 0; i < parser.error_count(); ++i) - { - const error_t error = parser.get_error(i); - - printf("Error: %02d Position: %02d " - "Type: [%s] " - "Message: %s " - "Expression: %s\n", - static_cast(i), - static_cast(error.token.position), - exprtk::parser_error::to_str(error.mode).c_str(), - error.diagnostic.c_str(), - expression_string.c_str()); - } - - return; - } - - expression.value(); -} +#include int main() { - test_function(); + std::cout << exprtk::information::library << std::endl; + std::cout << "Test package successful\n"; return 0; } diff --git a/recipes/exprtk/config.yml b/recipes/exprtk/config.yml index fcaa7fd847f94..33fef0a6d37b3 100755 --- a/recipes/exprtk/config.yml +++ b/recipes/exprtk/config.yml @@ -1,3 +1,7 @@ versions: + "0.0.3": + folder: "all" + "0.0.2": + folder: "all" "0.0.1": folder: "all" diff --git a/recipes/extra-cmake-modules/all/conandata.yml b/recipes/extra-cmake-modules/all/conandata.yml index c1c71096d72a6..f556f71e55d06 100644 --- a/recipes/extra-cmake-modules/all/conandata.yml +++ b/recipes/extra-cmake-modules/all/conandata.yml @@ -1,13 +1,25 @@ sources: - "5.75.0": - url: "https://download.kde.org/stable/frameworks/5.75/extra-cmake-modules-5.75.0.zip" - sha256: "dc937fd2018eb8285c1b07d4b5de104c60959404c4979883f6bdb0a4d40cf98e" - "5.80.0": - url: "https://download.kde.org/stable/frameworks/5.80/extra-cmake-modules-5.80.0.tar.xz" - sha256: "2370fd80f685533d0b96efa6fa443ceea68e0ceba4e8a9d7c151d297b1c96f64" - "5.84.0": - url: "https://download.kde.org/stable/frameworks/5.84/extra-cmake-modules-5.84.0.tar.xz" - sha256: "bb085ef2e177c182ff46988516b6b31849d1497beb2ff5301165ad2ba12a1c41" + "6.2.0": + url: "https://download.kde.org/stable/frameworks/6.2/extra-cmake-modules-6.2.0.tar.xz" + sha256: "6374bfa0dded8be265c702acd5de11eecd2851c625b93e1c87d8d0f5f1a8ebe1" + "5.113.0": + url: "https://download.kde.org/stable/frameworks/5.113/extra-cmake-modules-5.113.0.tar.xz" + sha256: "265e5440eebeca07351a469e617a4bf35748927bd907b00ace9c018392bb3bc4" + "5.111.0": + url: "https://download.kde.org/stable/frameworks/5.111/extra-cmake-modules-5.111.0.tar.xz" + sha256: "555d3c1dfa6727b4e64a35d3f01724c9fcd6209c2a41f2b2297c39ed7aabea9a" + "5.108.0": + url: "https://download.kde.org/stable/frameworks/5.108/extra-cmake-modules-5.108.0.tar.xz" + sha256: "ff14abd21abd34c2d8c00ee7a1ccd173b9a57ed1824e5c01090897ffffed447a" "5.93.0": url: "https://download.kde.org/stable/frameworks/5.93/extra-cmake-modules-5.93.0.tar.xz" sha256: "093dea7b11647bc5f74e6971d47ef15b5c410cba2b4620acae00f008d5480b21" + "5.84.0": + url: "https://download.kde.org/stable/frameworks/5.84/extra-cmake-modules-5.84.0.tar.xz" + sha256: "bb085ef2e177c182ff46988516b6b31849d1497beb2ff5301165ad2ba12a1c41" + "5.80.0": + url: "https://download.kde.org/stable/frameworks/5.80/extra-cmake-modules-5.80.0.tar.xz" + sha256: "2370fd80f685533d0b96efa6fa443ceea68e0ceba4e8a9d7c151d297b1c96f64" + "5.75.0": + url: "https://download.kde.org/stable/frameworks/5.75/extra-cmake-modules-5.75.0.zip" + sha256: "dc937fd2018eb8285c1b07d4b5de104c60959404c4979883f6bdb0a4d40cf98e" diff --git a/recipes/extra-cmake-modules/all/conanfile.py b/recipes/extra-cmake-modules/all/conanfile.py index 260ac51ba3a9a..21a22cc3ddea8 100644 --- a/recipes/extra-cmake-modules/all/conanfile.py +++ b/recipes/extra-cmake-modules/all/conanfile.py @@ -1,56 +1,71 @@ 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 get, copy +from conan.tools.scm import Version + +required_conan_version = ">=1.50.0" + class ExtracmakemodulesConan(ConanFile): name = "extra-cmake-modules" license = ("MIT", "BSD-2-Clause", "BSD-3-Clause") url = "https://github.com/conan-io/conan-center-index" homepage = "https://api.kde.org/ecm/" - topics = ("conan", "cmake", "toolchain", "build-settings") + topics = ("cmake", "cmake-modules", "toolchain", "build-settings") description = "KDE's CMake modules" - generators = "cmake" - no_copy_source = False + package_type = "build-scripts" + settings = "os", "arch", "compiler", "build_type" + short_paths = True + + def layout(self): + cmake_layout(self, src_folder="src") - _cmake = None + def package_id(self): + self.info.clear() - @property - def _source_subfolder(self): - return "source_subfolder" + def build_requirements(self): + if Version(self.version) >= "5.84.0": + self.tool_requires("cmake/[>=3.16 <4]") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename("extra-cmake-modules-{}".format(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.cache_variables["BUILD_HTML_DOCS"] = False + tc.cache_variables["BUILD_QTHELP_DOCS"] = False + tc.cache_variables["BUILD_MAN_DOCS"] = False + tc.cache_variables["BUILD_TESTING"] = False - # KB-H016: do not install Find*.cmake - tools.replace_path_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "install(FILES ${installFindModuleFiles} DESTINATION ${FIND_MODULES_INSTALL_DIR})", "") + if self.package_folder is None: + share_folder = "res" + else: + share_folder = os.path.join(self.package_folder, "res").replace("\\", "/") - self._cmake = CMake(self) - self._cmake.definitions["BUILD_HTML_DOCS"] = False - self._cmake.definitions["BUILD_QTHELP_DOCS"] = False - self._cmake.definitions["BUILD_MAN_DOCS"] = False - self._cmake.definitions["SHARE_INSTALL_DIR"] = os.path.join(self.package_folder, "res") - self._cmake.configure(source_folder=os.path.join(self.source_folder, self._source_subfolder)) - return self._cmake + tc.cache_variables["SHARE_INSTALL_DIR"] = share_folder + tc.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - cmake = self._configure_cmake() + lic_folder = os.path.join(self.source_folder, "LICENSES") + lic_folder_inst = os.path.join(self.package_folder, "licenses") + copy(self, "*", src=lic_folder, dst=lic_folder_inst) + + cmake = CMake(self) cmake.install() - self.copy("testhelper.h", src=os.path.join(self.source_folder, self._source_subfolder, "tests/ECMAddTests"), dst="res/tests") - self.copy("*", src=os.path.join(self.source_folder, self._source_subfolder, "LICENSES"), dst="licenses") def package_info(self): - self.cpp_info.resdirs = ["res"] - self.cpp_info.builddirs = ["res/ECM/cmake", "res/ECM/kde-modules", "res/ECM/modules", "res/ECM/test-modules", "res/ECM/toolchain"] - - def package_id(self): - self.info.header_only() + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.includedirs = [] + self.cpp_info.set_property("cmake_find_mode", "none") + for dirname in ["cmake", "find-modules", "kde-modules", "toolchain", + "modules", "test-modules"]: + self.cpp_info.builddirs.append(os.path.join("res", "ECM", dirname)) diff --git a/recipes/extra-cmake-modules/all/test_package/CMakeLists.txt b/recipes/extra-cmake-modules/all/test_package/CMakeLists.txt index 96f9cb73534c7..fa47b1a420453 100644 --- a/recipes/extra-cmake-modules/all/test_package/CMakeLists.txt +++ b/recipes/extra-cmake-modules/all/test_package/CMakeLists.txt @@ -1,8 +1,5 @@ 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(ECM REQUIRED NO_MODULE) @@ -17,5 +14,5 @@ ecm_generate_headers( REQUIRED_HEADERS MyLib_HEADERS ) -add_executable(example example.cpp) -target_link_libraries(example MyLib) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE MyLib) diff --git a/recipes/extra-cmake-modules/all/test_package/conanfile.py b/recipes/extra-cmake-modules/all/test_package/conanfile.py index 1ffe0933a5715..c8c6fef7966a6 100644 --- a/recipes/extra-cmake-modules/all/test_package/conanfile.py +++ b/recipes/extra-cmake-modules/all/test_package/conanfile.py @@ -1,9 +1,25 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile, conan_version +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -class ExtraCMakeModulesTestConan(ConanFile): - settings = "os", "compiler", "arch", "build_type" - generators = "cmake" + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + # CMakeToolchain of conan v1 doesn't add cpp_info.builddirs of build requirements to CMAKE_PREFIX_PATH + if conan_version < "2": + self.requires(self.tested_reference_str) + + def build_requirements(self): + if conan_version >= "2": + self.tool_requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -11,7 +27,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/extra-cmake-modules/all/test_package/example.cpp b/recipes/extra-cmake-modules/all/test_package/test_package.cpp similarity index 100% rename from recipes/extra-cmake-modules/all/test_package/example.cpp rename to recipes/extra-cmake-modules/all/test_package/test_package.cpp diff --git a/recipes/extra-cmake-modules/config.yml b/recipes/extra-cmake-modules/config.yml index c17f03346f04f..101fb016a65c8 100644 --- a/recipes/extra-cmake-modules/config.yml +++ b/recipes/extra-cmake-modules/config.yml @@ -1,9 +1,17 @@ versions: - "5.75.0": + "6.2.0": folder: "all" - "5.80.0": + "5.113.0": folder: "all" - "5.84.0": + "5.111.0": + folder: "all" + "5.108.0": folder: "all" "5.93.0": folder: "all" + "5.84.0": + folder: "all" + "5.80.0": + folder: "all" + "5.75.0": + folder: "all" diff --git a/recipes/ezc3d/all/conandata.yml b/recipes/ezc3d/all/conandata.yml index 7c22e7d856992..4d18399acd0fa 100644 --- a/recipes/ezc3d/all/conandata.yml +++ b/recipes/ezc3d/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "1.5.5": + url: "https://github.com/pyomeca/ezc3d/archive/refs/tags/Release_1.5.5.tar.gz" + sha256: "93641b100f982d4297a8cee9bb06b2c1facddfca638cde8259e783174a5f68ca" + "1.5.4": + url: "https://github.com/pyomeca/ezc3d/archive/Release_1.5.4.tar.gz" + sha256: "d27a1d8ffc5cebf47b53c2d263a1c4dbb4a6dc2f474c6978b3588bbb143e272f" "1.5.0": url: "https://github.com/pyomeca/ezc3d/archive/refs/tags/Release_1.5.0.tar.gz" sha256: "8387857d989f5bbb62869ec930b417e6d0a303eef9b39e8b0e6b35437d5809ce" 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/ezc3d/config.yml b/recipes/ezc3d/config.yml index 3d5d9b1cd1d49..9f04ee1babe86 100644 --- a/recipes/ezc3d/config.yml +++ b/recipes/ezc3d/config.yml @@ -1,4 +1,8 @@ versions: + "1.5.5": + folder: all + "1.5.4": + folder: all "1.5.0": folder: all "1.4.8": 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..5fff9951f937e 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() + autotools.configure() 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.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 6c84b299ffd6c..e412e4270b67e 100644 --- a/recipes/fakeit/all/conandata.yml +++ b/recipes/fakeit/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "2.4.1": + url: "https://github.com/eranpeer/FakeIt/archive/2.4.1.tar.gz" + sha256: "f5234a36d42363cb7ccd2cf99c8a754c832d9092035d984ad40aafa5371d0e95" + "2.4.0": + url: "https://github.com/eranpeer/FakeIt/archive/2.4.0.tar.gz" + sha256: "eb79459ad6a97a5c985e3301b0d44538bdce2ba26115afe040f3874688edefb5" "2.3.2": url: "https://github.com/eranpeer/FakeIt/archive/2.3.2.tar.gz" sha256: "d2472d0d4b3dce83e8c9672e9221375c7a0c32aa8fe57c20075776928142b495" diff --git a/recipes/fakeit/all/conanfile.py b/recipes/fakeit/all/conanfile.py index 864bd2d4f2bb1..4d9a65b5c58a1 100644 --- a/recipes/fakeit/all/conanfile.py +++ b/recipes/fakeit/all/conanfile.py @@ -1,52 +1,73 @@ -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 import os -required_conan_version = ">=1.33.0" + +required_conan_version = ">=1.52.0" class FakeItConan(ConanFile): name = "fakeit" description = "C++ mocking made easy. A simple yet very expressive, headers only library for c++ mocking." - topics = ("mock", "fake", "spy") license = "MIT" - homepage = "https://github.com/eranpeer/FakeIt" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/eranpeer/FakeIt" + topics = ("mock", "fake", "spy", "header-only") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" options = { - "integration": ["boost", "catch", "cute", "gtest", "mettle", "nunit", "mstest", "qtest", "standalone", "tpunit"] + "integration": ["boost", "catch", "cute", "gtest", "mettle", "nunit", "mstest", "qtest", "standalone", "tpunit"], + } + default_options = { + "integration": "standalone", } - default_options = {"integration": "standalone"} 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 requirements(self): if self.options.integration == "boost": - self.requires("boost/1.79.0") + self.requires("boost/1.83.0") elif self.options.integration == "catch": - self.requires("catch2/2.13.9") + self.requires("catch2/3.5.2") elif self.options.integration == "gtest": - self.requires("gtest/1.11.0") + self.requires("gtest/1.14.0") elif self.options.integration == "qtest": - self.requires("qt/6.3.0") + self.requires("qt/6.6.1") elif self.options.integration == "standalone": pass else: raise ConanInvalidConfiguration("%s is not (yet) available on cci" % self.options.integration) def package_id(self): - self.info.header_only() + # The "integration" option must be kept because it will impact which header is packaged, + # therefor self.info.clear() cannot be used. + self.info.settings.clear() + self.info.requires.clear() def validate(self): - minimal_cpp_standard = "11" if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, minimal_cpp_standard) + 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="fakeit.hpp", dst="include", src=os.path.join(self._source_subfolder, "single_header", str(self.options.integration))) - 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) + copy( + self, + pattern="fakeit.hpp", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "single_header", str(self.options.integration)), + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/fakeit/all/test_package/CMakeLists.txt b/recipes/fakeit/all/test_package/CMakeLists.txt index 3053452921673..6beebe71b3c83 100644 --- a/recipes/fakeit/all/test_package/CMakeLists.txt +++ b/recipes/fakeit/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(fakeit REQUIRED CONFIG) diff --git a/recipes/fakeit/all/test_package/conanfile.py b/recipes/fakeit/all/test_package/conanfile.py index 304d96151d752..159d15723bbfa 100644 --- a/recipes/fakeit/all/test_package/conanfile.py +++ b/recipes/fakeit/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 FakeItTestConan(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,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/fakeit/all/test_v1_package/CMakeLists.txt b/recipes/fakeit/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..9d54a092e0a67 --- /dev/null +++ b/recipes/fakeit/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/fakeit/all/test_v1_package/conanfile.py b/recipes/fakeit/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..a1bf8d95c2742 --- /dev/null +++ b/recipes/fakeit/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 FakeItTestV1Conan(ConanFile): + settings = "os", "arch", "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/fakeit/config.yml b/recipes/fakeit/config.yml index a05c93c91a063..0755f94e23640 100644 --- a/recipes/fakeit/config.yml +++ b/recipes/fakeit/config.yml @@ -1,4 +1,8 @@ versions: + "2.4.1": + folder: all + "2.4.0": + folder: all "2.3.2": folder: all "2.3.1": diff --git a/recipes/faker-cxx/all/conandata.yml b/recipes/faker-cxx/all/conandata.yml new file mode 100644 index 0000000000000..33704b20363da --- /dev/null +++ b/recipes/faker-cxx/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "3.0.0": + url: "https://github.com/cieslarmichal/faker-cxx/archive/refs/tags/v3.0.0.tar.gz" + sha256: "63d6846376593e05da690136cabe8e7bf42ddcdd4edad3ae9b48696f86d80468" + "2.0.0": + url: "https://github.com/cieslarmichal/faker-cxx/archive/refs/tags/v2.0.0.tar.gz" + sha256: "8a7f5441f4453af868444675878a2d9a74918c1595caa65d537d3ea327e46a49" diff --git a/recipes/faker-cxx/all/conanfile.py b/recipes/faker-cxx/all/conanfile.py new file mode 100644 index 0000000000000..326381b2e9f9c --- /dev/null +++ b/recipes/faker-cxx/all/conanfile.py @@ -0,0 +1,103 @@ +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 +import os + +required_conan_version = ">=1.53.0" + +class FakerCXXConan(ConanFile): + name = "faker-cxx" + description = "C++ Faker library based on faker-js/faker. " + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/cieslarmichal/faker-cxx" + topics = ("faker", "fake",) + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_std_format": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_std_format": False, + } + + @property + def _min_cppstd(self): + return 20 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "12", + "clang": "16", + "apple-clang": "16", + "Visual Studio": "17", + "msvc": "193", + } + + 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): + if not self.options.with_std_format: + self.requires("fmt/10.2.1") + + def layout(self): + cmake_layout(self, src_folder="src") + + 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" and self.options.shared: + # https://github.com/cieslarmichal/faker-cxx/issues/753 + raise ConanInvalidConfiguration(f"{self.ref} is not prepared to generated shared library on Windows.") + + def build_requirements(self): + self.tool_requires("cmake/[>=3.22 <4]") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["USE_SYSTEM_DEPENDENCIES"] = True + tc.variables["BUILD_TESTING"] = False + tc.variables["WARNINGS_AS_ERRORS"] = False + tc.variables["WITH_STD_FORMAT"] = self.options.with_std_format + tc.generate() + deps = CMakeDeps(self) + deps.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 = ["faker-cxx"] + + self.cpp_info.set_property("cmake_file_name", "faker-cxx") + self.cpp_info.set_property("cmake_target_name", "faker-cxx::faker-cxx") diff --git a/recipes/faker-cxx/all/test_package/CMakeLists.txt b/recipes/faker-cxx/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..2485457ffc81e --- /dev/null +++ b/recipes/faker-cxx/all/test_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(faker-cxx REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE faker-cxx::faker-cxx) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) +if(faker-cxx_VERSION VERSION_LESS "3.0.0") + target_compile_definitions(${PROJECT_NAME} PRIVATE FAKER_CXX_2) +endif() diff --git a/recipes/faker-cxx/all/test_package/conanfile.py b/recipes/faker-cxx/all/test_package/conanfile.py new file mode 100644 index 0000000000000..ef5d7042163ec --- /dev/null +++ b/recipes/faker-cxx/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/faker-cxx/all/test_package/test_package.cpp b/recipes/faker-cxx/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..7251d095e5300 --- /dev/null +++ b/recipes/faker-cxx/all/test_package/test_package.cpp @@ -0,0 +1,23 @@ +#include +#ifdef FAKER_CXX_2 + #include "faker-cxx/Internet.h" + #include "faker-cxx/String.h" + #include "faker-cxx/Date.h" +#else + #include "faker-cxx/internet.h" + #include "faker-cxx/string.h" + #include "faker-cxx/date.h" +#endif + +int main() +{ + const auto id = faker::string::uuid(); + const auto email = faker::internet::email(); + const auto password = faker::internet::password(); + const auto createdAt = faker::date::pastDate(5, faker::date::DateFormat::ISO); + const auto updatedAt = faker::date::recentDate(2, faker::date::DateFormat::ISO); + + std::cout << "id: " << id << ", email: " << email << ", password: " << password << ", createdAt: " << createdAt << ", updatedAt: " << updatedAt << "\n"; + + return 0; +} diff --git a/recipes/faker-cxx/config.yml b/recipes/faker-cxx/config.yml new file mode 100644 index 0000000000000..70df618778342 --- /dev/null +++ b/recipes/faker-cxx/config.yml @@ -0,0 +1,5 @@ +versions: + "3.0.0": + folder: all + "2.0.0": + folder: all 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/conandata.yml b/recipes/fast-cdr/all/conandata.yml index 31c8bc7e11e9e..a1647a8bd5d43 100644 --- a/recipes/fast-cdr/all/conandata.yml +++ b/recipes/fast-cdr/all/conandata.yml @@ -1,13 +1,28 @@ sources: - "1.0.24": - url: "https://github.com/eProsima/Fast-CDR/archive/v1.0.24.tar.gz" - sha256: "ecd688ab89ff1c03b9031c314891ae60995e2e73d919b93569eb840d6e87dec2" - "1.0.23": - url: "https://github.com/eProsima/Fast-CDR/archive/v1.0.23.tar.gz" - sha256: "6f7c9c6c0c82c150b5ea2b0a58d5c9a466b87a1fcfca40d5786d99d4963a6721" - "1.0.22": - url: "https://github.com/eProsima/Fast-CDR/archive/v1.0.22.tar.gz" - sha256: "7ca7f09c633963622431bdb216eeb4145e378f81a2ce5113e341b9eee55e4f44" - "1.0.21": - url: "https://github.com/eProsima/Fast-CDR/archive/refs/tags/v1.0.21.tar.gz" - sha256: "C1F32BDD76910ADA00D551EB8828DE7561AD2B2846D063CB4316F9262C03C77D" + "2.2.5": + url: "https://github.com/eProsima/Fast-CDR/archive/v2.2.5.tar.gz" + sha256: "b01fd34135e9be5183bb69f31fa5b74c53ba6eca30a5b21de0120d21ece22a51" + "2.2.3": + url: "https://github.com/eProsima/Fast-CDR/archive/v2.2.3.tar.gz" + sha256: "2501ef0930727d3b3ac1819672a6df8631a58fbcf7f005947046c2de46e8da69" + "2.2.0": + url: "https://github.com/eProsima/Fast-CDR/archive/v2.2.0.tar.gz" + sha256: "8a75ee3aed59f495e95208050920d2c2146df92f073809505a3bd29011c21f20" + "2.1.0": + url: "https://github.com/eProsima/Fast-CDR/archive/v2.1.0.tar.gz" + sha256: "7ee3b3e977381f76f8d9ab1e1df7b5202556505b104afb3f03ee79bbe6507aa0" + "2.0.0": + url: "https://github.com/eProsima/Fast-CDR/archive/v2.0.0.tar.gz" + sha256: "66234a5504879f7af706530996177df930d61dd88045dcafb73799458413ee93" + "1.1.0": + url: "https://github.com/eProsima/Fast-CDR/archive/v1.1.0.tar.gz" + sha256: "5c4b2ad5493abd30b9475b14856641a8944c98077a36bd0760c1d83c65216e67" + "1.0.27": + url: "https://github.com/eProsima/Fast-CDR/archive/v1.0.27.tar.gz" + sha256: "a9bc8fd31a2c2b95e6d2fb46e6ce1ad733e86dc4442f733479e33ed9cdc54bf6" +patches: + "2.0.0": + - patch_file: "patches/2.0.0-0001-Fix-for-non-CWG-1270-revision-compliant-compilers-17.patch" + patch_type: "portability" + patch_description: "Fix for non CWG 1270 revision compliant compilers" + patch_source: "https://github.com/eProsima/Fast-CDR/pull/173" diff --git a/recipes/fast-cdr/all/conanfile.py b/recipes/fast-cdr/all/conanfile.py index b334d42bb6789..be8d79ee8f187 100644 --- a/recipes/fast-cdr/all/conanfile.py +++ b/recipes/fast-cdr/all/conanfile.py @@ -2,12 +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 collect_libs, copy, get, rm, rmdir, save +from conan.tools.files import apply_conandata_patches, collect_libs, copy, export_conandata_patches, get, rm, 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.51.1" +required_conan_version = ">=1.54.0" class FastCDRConan(ConanFile): @@ -18,6 +19,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], @@ -28,21 +30,28 @@ class FastCDRConan(ConanFile): "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: - del self.options.fPIC + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") + def build_requirements(self): + if Version(self.version) >= "1.1.0": + self.tool_requires("cmake/[>=3.16.3 <4]") + def validate(self): - if self.info.settings.compiler.get_safe("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): # 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 @@ -50,17 +59,15 @@ def validate(self): raise ConanInvalidConfiguration("Mixing a dll eprosima library with a static runtime is a bad idea") 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_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() def build(self): + apply_conandata_patches(self) cmake = CMake(self) cmake.configure() cmake.build() @@ -102,6 +109,9 @@ def package_info(self): if self.settings.os == "Windows" and self.options.shared: self.cpp_info.defines.append("FASTCDR_DYN_LINK") + if self.settings.os in ["Linux"]: + 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"] = "fastcdr" self.cpp_info.names["cmake_find_package_multi"] = "fastcdr" diff --git a/recipes/fast-cdr/all/patches/2.0.0-0001-Fix-for-non-CWG-1270-revision-compliant-compilers-17.patch b/recipes/fast-cdr/all/patches/2.0.0-0001-Fix-for-non-CWG-1270-revision-compliant-compilers-17.patch new file mode 100644 index 0000000000000..40b2a62ac988a --- /dev/null +++ b/recipes/fast-cdr/all/patches/2.0.0-0001-Fix-for-non-CWG-1270-revision-compliant-compilers-17.patch @@ -0,0 +1,33 @@ +From fe9a125ba5809fc1f7aa5799d4285392e837f35e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Utkan=20K=C4=B1l=C4=B1=C3=A7?= + <65946928+utkankilic@users.noreply.github.com> +Date: Wed, 25 Oct 2023 08:33:08 +0300 +Subject: [PATCH] Fix for non CWG 1270 revision compliant compilers (#173) +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Utkan Kılıç utkankilic@gmail.com + +Signed-off-by: utkan.kilic +Co-authored-by: utkan.kilic +--- + include/fastcdr/Cdr.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/fastcdr/Cdr.h b/include/fastcdr/Cdr.h +index 254cd08..9d08820 100644 +--- a/include/fastcdr/Cdr.h ++++ b/include/fastcdr/Cdr.h +@@ -3263,7 +3263,7 @@ private: + EncodingAlgorithmFlag current_encoding_ {EncodingAlgorithmFlag::PLAIN_CDR2}; + + //! @brief This attribute stores the option flags when the CDR type is DDS_CDR; +- std::array options_ {0}; ++ std::array options_{{0}}; + + //! @brief The endianness that will be applied over the buffer. + uint8_t endianness_ {Endianness::LITTLE_ENDIANNESS}; +-- +2.34.1 + diff --git a/recipes/fast-cdr/all/test_package/test_package.cpp b/recipes/fast-cdr/all/test_package/test_package.cpp index 3a437b366c3c4..f7a2f9396b6e8 100644 --- a/recipes/fast-cdr/all/test_package/test_package.cpp +++ b/recipes/fast-cdr/all/test_package/test_package.cpp @@ -61,14 +61,21 @@ int main() // Serialization. FastBuffer cdrbuffer(buffer, BUFFER_LENGTH); Cdr cdr_ser(cdrbuffer); +#if FASTCDR_VERSION_MAJOR >=2 + cdr_ser.serialize_sequence(char_seq_t, 5); +#else cdr_ser.serializeSequence(char_seq_t, 5); +#endif // Deserialization. Cdr cdr_des(cdrbuffer); char* char_seq_value = NULL; size_t char_seq_len = 0; - +#if FASTCDR_VERSION_MAJOR >=2 + cdr_des.deserialize_sequence(char_seq_value, char_seq_len); +#else cdr_des.deserializeSequence(char_seq_value, char_seq_len); +#endif return 0; } diff --git a/recipes/fast-cdr/all/test_v1_package/CMakeLists.txt b/recipes/fast-cdr/all/test_v1_package/CMakeLists.txt index 16d0cd412b0f9..0d20897301b68 100644 --- a/recipes/fast-cdr/all/test_v1_package/CMakeLists.txt +++ b/recipes/fast-cdr/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(fastcdr REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE fastcdr) -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-cdr/config.yml b/recipes/fast-cdr/config.yml index 27fb208178630..5e80a3438b5ca 100644 --- a/recipes/fast-cdr/config.yml +++ b/recipes/fast-cdr/config.yml @@ -1,9 +1,15 @@ versions: - "1.0.24": + "2.2.5": folder: all - "1.0.23": + "2.2.3": folder: all - "1.0.22": + "2.2.0": folder: all - "1.0.21": + "2.1.0": + folder: all + "2.0.0": + folder: all + "1.1.0": + folder: all + "1.0.27": folder: all diff --git a/recipes/fast-cpp-csv-parser/all/conandata.yml b/recipes/fast-cpp-csv-parser/all/conandata.yml index 87d270e80c74e..00225e59aaf16 100644 --- a/recipes/fast-cpp-csv-parser/all/conandata.yml +++ b/recipes/fast-cpp-csv-parser/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "cci.20240102": + url: "https://github.com/ben-strasser/fast-cpp-csv-parser/archive/a71a87e700b0fb92645c6b124742cbf326e0f7b1.tar.gz" + sha256: "635d34234b9ebfefde42af3431547a5da29a112dd43cdbb532f79844b3b761d8" "cci.20211104": url: "https://github.com/ben-strasser/fast-cpp-csv-parser/archive/5a417973b4cea674a5e4a3b88a23098a2ab75479.zip" sha256: "33a22bda2603a87b8f36c79673339490f58656d92a4882e788de3f4ef7ec57b2" diff --git a/recipes/fast-cpp-csv-parser/all/conanfile.py b/recipes/fast-cpp-csv-parser/all/conanfile.py index f20fc50349a4e..8073da0d1b137 100644 --- a/recipes/fast-cpp-csv-parser/all/conanfile.py +++ b/recipes/fast-cpp-csv-parser/all/conanfile.py @@ -14,7 +14,7 @@ class FastcppcsvparserConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/ben-strasser/fast-cpp-csv-parser" topics = ("csv", "parser", "header-only") - + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" options = { "with_thread": [True, False], @@ -25,6 +25,9 @@ class FastcppcsvparserConan(ConanFile): no_copy_source = True + def layout(self): + basic_layout(self, src_folder="src") + def package_id(self): self.info.clear() @@ -32,12 +35,8 @@ 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def build(self): pass @@ -48,9 +47,7 @@ def package(self): def package_info(self): self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] self.cpp_info.includedirs.append(os.path.join("include", "fast-cpp-csv-parser")) if not self.options.with_thread: self.cpp_info.defines.append("CSV_IO_NO_THREAD") diff --git a/recipes/fast-cpp-csv-parser/all/test_package/conanfile.py b/recipes/fast-cpp-csv-parser/all/test_package/conanfile.py index ca068b831644c..ef08a7439d5d1 100644 --- a/recipes/fast-cpp-csv-parser/all/test_package/conanfile.py +++ b/recipes/fast-cpp-csv-parser/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/fast-cpp-csv-parser/all/test_v1_package/CMakeLists.txt b/recipes/fast-cpp-csv-parser/all/test_v1_package/CMakeLists.txt index c53b3fb245385..be00a8c7f57c7 100644 --- a/recipes/fast-cpp-csv-parser/all/test_v1_package/CMakeLists.txt +++ b/recipes/fast-cpp-csv-parser/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(fast-cpp-csv-parser REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE fast-cpp-csv-parser::fast-cpp-csv-parser) -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-cpp-csv-parser/config.yml b/recipes/fast-cpp-csv-parser/config.yml index ca4b1e35049ab..383c881ec3492 100644 --- a/recipes/fast-cpp-csv-parser/config.yml +++ b/recipes/fast-cpp-csv-parser/config.yml @@ -1,4 +1,6 @@ versions: + "cci.20240102": + folder: all "cci.20211104": folder: all "cci.20200830": diff --git a/recipes/fast-dds/all/CMakeLists.txt b/recipes/fast-dds/all/CMakeLists.txt deleted file mode 100644 index 8b9014fcee176..0000000000000 --- a/recipes/fast-dds/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/fast-dds/all/conandata.yml b/recipes/fast-dds/all/conandata.yml index ea3e09684b01e..f53bf9511da8b 100644 --- a/recipes/fast-dds/all/conandata.yml +++ b/recipes/fast-dds/all/conandata.yml @@ -1,20 +1,50 @@ sources: + "2.14.3": + url: "https://github.com/eProsima/Fast-DDS/archive/refs/tags/v2.14.3.tar.gz" + sha256: "292e4170e4689d878eb5ddd38661134a704a1541402a4f564353190e4aadd23d" + "2.14.0": + url: "https://github.com/eProsima/Fast-DDS/archive/refs/tags/v2.14.0.tar.gz" + sha256: "a6f12bce6b77f265cab81abde5dc2e08133be9a55bc29e573c84571d44eddbc2" + "2.13.3": + url: "https://github.com/eProsima/Fast-DDS/archive/refs/tags/v2.13.3.tar.gz" + sha256: "0f33596a8a48b5da4c43a964f2dc70127c6449defd5698944dddbdfb16d2b268" + "2.11.2": + url: "https://github.com/eProsima/Fast-DDS/archive/refs/tags/v2.11.2.tar.gz" + sha256: "711f5d7afc6a31a908ab204f8b67045d5e7cab7b4052614b595b37c774f357fd" + "2.10.1": + url: "https://github.com/eProsima/Fast-DDS/archive/refs/tags/v2.10.1.tar.gz" + sha256: "2cc2682db5dc7e87684b7f23166e2f32faf8d5c4b4a8c94c6c21211a8a38f553" "2.3.4": url: "https://github.com/eProsima/Fast-DDS/archive/refs/tags/v2.3.4.tar.gz" sha256: "b1b2322de0ca55a16495666e3fbda8aca32b888bbfaecda29f2ffc4b072ef7ac" - "2.3.3": - url: "https://github.com/eProsima/Fast-DDS/archive/refs/tags/v2.3.3.tar.gz" - sha256: "5ebf27d810c6ab68eef7d42937cd421d85e50509ae96883239979a1b3a2f4f82" - "2.3.2": - url: "https://github.com/eProsima/Fast-DDS/archive/refs/tags/v2.3.2.tar.gz" - sha256: "4d8183cf4d37c3de9e6fd28d2850dd08023a9079001c4880b23c95f0d8c0b5ce" patches: + "2.14.3": + - patch_file: "patches/2.13.3-0001-fix-find-asio-and-tinyxml2.patch" + patch_type: "conan" + patch_description: "Fixup find asio and tinyxml2" + "2.14.0": + - patch_file: "patches/2.13.3-0001-fix-find-asio-and-tinyxml2.patch" + patch_type: "conan" + patch_description: "Fixup find asio and tinyxml2" + - patch_file: "patches/2.13.3-0002-add-gettid-macro-for-glibc-compat.patch" + patch_type: "conan" + patch_description: "Add gettid macro for glibc compat. See: eProsima/Fast-DDS#4565" + "2.13.3": + - patch_file: "patches/2.13.3-0001-fix-find-asio-and-tinyxml2.patch" + patch_type: "conan" + patch_description: "Fixup find asio and tinyxml2" + - patch_file: "patches/2.13.3-0002-add-gettid-macro-for-glibc-compat.patch" + patch_type: "conan" + patch_description: "Add gettid macro for glibc compat. See: eProsima/Fast-DDS#4565" + "2.11.2": + - patch_file: "patches/2.10.1-0001-fix-find-asio-and-tinyxml2.patch" + patch_type: "conan" + patch_description: "Fixup find asio and tinyxml2" + "2.10.1": + - patch_file: "patches/2.10.1-0001-fix-find-asio-and-tinyxml2.patch" + patch_type: "conan" + patch_description: "Fixup find asio and tinyxml2" "2.3.4": - patch_file: "patches/2.3.X-0001-fix-find-asio-and-tinyxml2.patch" - base_path: "source_subfolder" - "2.3.3": - - patch_file: "patches/2.3.X-0001-fix-find-asio-and-tinyxml2.patch" - base_path: "source_subfolder" - "2.3.2": - - patch_file: "patches/2.3.2-0001-fix-find-asio-and-tinyxml2.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "Fixup find asio and tinyxml2" diff --git a/recipes/fast-dds/all/conanfile.py b/recipes/fast-dds/all/conanfile.py index c7f1a37d3d3bd..bdeaac9382380 100644 --- a/recipes/fast-dds/all/conanfile.py +++ b/recipes/fast-dds/all/conanfile.py @@ -1,10 +1,26 @@ -from conan.tools.microsoft import msvc_runtime_flag -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.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, + rename, + rm, + rmdir, + save, +) +from conan.tools.microsoft import check_min_vs, is_msvc_static_runtime, is_msvc, msvc_runtime_flag +from conan.tools.scm import Version + + +required_conan_version = ">=1.53.0" class FastDDSConan(ConanFile): @@ -14,7 +30,7 @@ class FastDDSConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" description = "The most complete OSS DDS implementation for embedded systems." topics = ("dds", "middleware", "ipc") - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -27,113 +43,119 @@ class FastDDSConan(ConanFile): "with_ssl": False, } - 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 _minimum_cpp_standard(self): + def _min_cppstd(self): return 11 @property - def _minimum_compilers_version(self): - return { - "Visual Studio": "16", - "gcc": "5", - "clang": "3.9", - "apple-clang": "8", - } + def _compilers_minimum_version(self): + if Version(self.version) < "2.11.0": + return { + "gcc": "8", + "clang": "12", + "apple-clang": "12", + } + else: + return { + "gcc": "9", + "clang": "15", + "apple-clang": "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": del self.options.fPIC def configure(self): + self.options["fast-cdr"].shared = self.options.shared 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("tinyxml2/9.0.0") - self.requires("asio/1.21.0") - self.requires("fast-cdr/1.0.23") - self.requires("foonathan-memory/0.7.1") - self.requires("boost/1.75.0") # boost/1.76 is required by version 2.3.2, boost/1.75.0 required for 2.3.3 by Windows + self.requires("tinyxml2/10.0.0") + self.requires("asio/1.29.0") # This is now a package_type = header + # Fast-DDS < 2.12 uses Fast-CDR 1.x + if Version(self.version) < "2.12.0": + self.requires("fast-cdr/1.1.0", transitive_headers=True, transitive_libs=True) + else: + self.requires("fast-cdr/2.1.0", transitive_headers=True, transitive_libs=True) + self.requires("foonathan-memory/0.7.3") if self.options.with_ssl: - self.requires("openssl/1.1.1m") + self.requires("openssl/[>=1.1 <4]") def validate(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 min_version and tools.Version(self.settings.compiler.version) < min_version: - raise ConanInvalidConfiguration( - "{} requires C++{} support. {} {} does not support it.".format( - self.name, self._minimum_cpp_standard, - self.settings.compiler, self.settings.compiler.version + # fast-dds requires C++11 + 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." ) - ) - if self.options.shared and self._is_msvc and "MT" in msvc_runtime_flag(self): + + if self.options.shared and is_msvc(self) and "MT" in msvc_runtime_flag(self): # This combination leads to an fast-dds error when linking # linking dynamic '*.dll' and static MT runtime - raise ConanInvalidConfiguration("Mixing a dll {} library with a static runtime is a bad idea".format(self.name)) + raise ConanInvalidConfiguration("Mixing a dll {} library with a static runtime is not supported".format(self.name)) + + def build_requirements(self): + if Version(self.version) >= "2.7.0": + self.tool_requires("cmake/[>=3.16.3 <4]") 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["BUILD_MEMORY_TOOLS"] = False - self._cmake.definitions["NO_TLS"] = not self.options.with_ssl - self._cmake.definitions["SECURITY"] = self.options.with_ssl - self._cmake.definitions["EPROSIMA_INSTALLER_MINION"] = False - 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_MEMORY_TOOLS"] = False + tc.variables["NO_TLS"] = not self.options.with_ssl + tc.variables["SECURITY"] = self.options.with_ssl + tc.variables["EPROSIMA_INSTALLER_MINION"] = False + if is_msvc(self): + tc.variables["USE_MSVC_RUNTIME_LIBRARY_DLL"] = not is_msvc_static_runtime(self) + 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 package(self): - cmake = self._configure_cmake() - cmake.install() - tools.rmdir(os.path.join(self.package_folder, "share")) - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - tools.rename( - src=os.path.join(self.package_folder, "tools"), - dst=os.path.join(os.path.join(self.package_folder, "bin", "tools")) + copy( + self, + "LICENSE", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder, ) - 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" + cmake = CMake(self) + cmake.install() + + rmdir(self, os.path.join(self.package_folder, "share")) + rename( + self, + os.path.join(self.package_folder, "tools"), + os.path.join(os.path.join(self.package_folder, "bin", "tools")), ) + 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( os.path.join(self.package_folder, self._module_file_rel_path), {"fastrtps": "fastdds::fastrtps"} ) - @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("""\ @@ -142,7 +164,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): @@ -153,20 +175,20 @@ def package_info(self): # component fastrtps self.cpp_info.components["fastrtps"].set_property("cmake_target_name", "fastrtps") - self.cpp_info.components["fastrtps"].libs = tools.collect_libs(self) + self.cpp_info.components["fastrtps"].set_property("cmake_target_aliases", ["fastdds::fastrtps"]) + self.cpp_info.components["fastrtps"].libs = collect_libs(self) self.cpp_info.components["fastrtps"].requires = [ "fast-cdr::fast-cdr", "asio::asio", "tinyxml2::tinyxml2", "foonathan-memory::foonathan-memory", - "boost::boost" ] if self.settings.os in ["Linux", "FreeBSD", "Neutrino"]: self.cpp_info.components["fastrtps"].system_libs.append("pthread") if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.components["fastrtps"].system_libs.extend(["rt", "dl", "atomic"]) + self.cpp_info.components["fastrtps"].system_libs.extend(["rt", "dl", "atomic", "m"]) elif self.settings.os == "Windows": - self.cpp_info.components["fastrtps"].system_libs.extend(["iphlpapi","shlwapi"]) + self.cpp_info.components["fastrtps"].system_libs.extend(["iphlpapi", "shlwapi", "mswsock", "ws2_32"]) if self.options.shared: self.cpp_info.components["fastrtps"].defines.append("FASTRTPS_DYN_LINK") if self.options.with_ssl: @@ -176,9 +198,6 @@ def package_info(self): # FIXME: actually conan generators don't know how to create an executable imported target self.cpp_info.components["fast-discovery-server"].set_property("cmake_target_name", "fastdds::fast-discovery-server") self.cpp_info.components["fast-discovery-server"].bindirs = ["bin"] - bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH env var for fast-dds::fast-discovery-server 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"] = "fastdds" diff --git a/recipes/fast-dds/all/patches/2.10.1-0001-fix-find-asio-and-tinyxml2.patch b/recipes/fast-dds/all/patches/2.10.1-0001-fix-find-asio-and-tinyxml2.patch new file mode 100644 index 0000000000000..bada751126e81 --- /dev/null +++ b/recipes/fast-dds/all/patches/2.10.1-0001-fix-find-asio-and-tinyxml2.patch @@ -0,0 +1,31 @@ +From b8c533b0fb2b92e9bd2aada5e195d7a0b3c0c6a9 Mon Sep 17 00:00:00 2001 +From: Joakim Haugen +Date: Wed, 10 May 2023 13:17:11 +0200 +Subject: [PATCH] fix find asio and tinyxml2 + +--- + CMakeLists.txt | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index b01b2c470..7867feff3 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -232,9 +232,11 @@ if(NOT BUILD_SHARED_LIBS) + set(FASTDDS_STATIC ON) + endif() + +-eprosima_find_package(fastcdr REQUIRED) +-eprosima_find_thirdparty(Asio asio VERSION 1.10.8) +-eprosima_find_thirdparty(TinyXML2 tinyxml2) ++eprosima_find_thirdparty(fastcdr REQUIRED) ++eprosima_find_thirdparty(asio REQUIRED) ++eprosima_find_thirdparty(tinyxml2 REQUIRED) ++set(TINYXML2_LIBRARY tinyxml2::tinyxml2) ++set(Asio_INCLUDE_DIR ${asio_INCLUDE_DIR}) + + find_package(foonathan_memory REQUIRED) + message(STATUS "Found foonathan_memory: ${foonathan_memory_DIR}") +-- +2.30.2 + diff --git a/recipes/fast-dds/all/patches/2.13.3-0001-fix-find-asio-and-tinyxml2.patch b/recipes/fast-dds/all/patches/2.13.3-0001-fix-find-asio-and-tinyxml2.patch new file mode 100644 index 0000000000000..414ee059e1b42 --- /dev/null +++ b/recipes/fast-dds/all/patches/2.13.3-0001-fix-find-asio-and-tinyxml2.patch @@ -0,0 +1,31 @@ +From 7d4f8a198ce34570c3c5b678f74240a8c5b9eae8 Mon Sep 17 00:00:00 2001 +From: Wade Hunkapiller +Date: Mon, 18 Mar 2024 15:57:02 -0500 +Subject: [PATCH] fix find asio and tinyxml2 + +--- + CMakeLists.txt | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 5ccb97a1b..ac6630c44 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -234,9 +234,11 @@ if(NOT BUILD_SHARED_LIBS) + set(FASTDDS_STATIC ON) + endif() + +-eprosima_find_package(fastcdr REQUIRED) +-eprosima_find_thirdparty(Asio asio VERSION 1.10.8) +-eprosima_find_thirdparty(TinyXML2 tinyxml2) ++eprosima_find_thirdparty(fastcdr REQUIRED) ++eprosima_find_thirdparty(asio REQUIRED) ++eprosima_find_thirdparty(tinyxml2 REQUIRED) ++set(TINYXML2_LIBRARY tinyxml2::tinyxml2) ++set(Asio_INCLUDE_DIR ${asio_INCLUDE_DIR}) + + find_package(foonathan_memory REQUIRED) + message(STATUS "Found foonathan_memory: ${foonathan_memory_DIR}") +-- +2.39.3 + diff --git a/recipes/fast-dds/all/patches/2.13.3-0002-add-gettid-macro-for-glibc-compat.patch b/recipes/fast-dds/all/patches/2.13.3-0002-add-gettid-macro-for-glibc-compat.patch new file mode 100644 index 0000000000000..da528c2501e0d --- /dev/null +++ b/recipes/fast-dds/all/patches/2.13.3-0002-add-gettid-macro-for-glibc-compat.patch @@ -0,0 +1,31 @@ +From 12de52b7074f653cf9a1d1fed8f9f83a4030319d Mon Sep 17 00:00:00 2001 +From: WADE HUNKAPILLER +Date: Fri, 15 Mar 2024 10:45:45 -0500 +Subject: [PATCH] add gettid macro for glibc compat + +--- + src/cpp/utils/threading/threading_pthread.ipp | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/src/cpp/utils/threading/threading_pthread.ipp b/src/cpp/utils/threading/threading_pthread.ipp +index 75ad33f2d..252f60c77 100644 +--- a/src/cpp/utils/threading/threading_pthread.ipp ++++ b/src/cpp/utils/threading/threading_pthread.ipp +@@ -25,6 +25,14 @@ + #include + #include + ++#if defined(__GLIBC__) && ((__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ <= 30))) ++ #include ++ #ifndef SYS_gettid ++ #error "SYS_gettid unavailable on this system" ++ #endif ++ #define gettid() ((pid_t)syscall(SYS_gettid)) ++#endif ++ + namespace eprosima { + + template +-- +2.39.3 + diff --git a/recipes/fast-dds/all/patches/2.3.2-0001-fix-find-asio-and-tinyxml2.patch b/recipes/fast-dds/all/patches/2.3.2-0001-fix-find-asio-and-tinyxml2.patch deleted file mode 100644 index 4530f0222378b..0000000000000 --- a/recipes/fast-dds/all/patches/2.3.2-0001-fix-find-asio-and-tinyxml2.patch +++ /dev/null @@ -1,28 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 8a9cb0209..400c681e7 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -225,8 +225,8 @@ if(NOT BUILD_SHARED_LIBS) - endif() - - eprosima_find_package(fastcdr REQUIRED) --eprosima_find_thirdparty(Asio asio VERSION 1.10.8) --eprosima_find_thirdparty(TinyXML2 tinyxml2) -+eprosima_find_thirdparty(asio REQUIRED) -+eprosima_find_thirdparty(tinyxml2 REQUIRED) - - find_package(foonathan_memory REQUIRED) - message(STATUS "Found foonathan_memory: ${foonathan_memory_DIR}") -diff --git a/src/cpp/CMakeLists.txt b/src/cpp/CMakeLists.txt -index 04d313bf2..c7d64f04d 100644 ---- a/src/cpp/CMakeLists.txt -+++ b/src/cpp/CMakeLists.txt -@@ -455,7 +455,7 @@ elseif(NOT EPROSIMA_INSTALLER) - # Link library to external libraries. - target_link_libraries(${PROJECT_NAME} ${PRIVACY} fastcdr foonathan_memory - ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS} -- ${TINYXML2_LIBRARY} -+ tinyxml2::tinyxml2 - $<$:OpenSSL::SSL$OpenSSL::Crypto> - $<$:iphlpapi$Shlwapi> - ${THIRDPARTY_BOOST_LINK_LIBS} diff --git a/recipes/fast-dds/all/patches/2.3.3-0001-fix-find-asio-and-tinyxml2.patch b/recipes/fast-dds/all/patches/2.3.3-0001-fix-find-asio-and-tinyxml2.patch deleted file mode 100644 index a597b73998c04..0000000000000 --- a/recipes/fast-dds/all/patches/2.3.3-0001-fix-find-asio-and-tinyxml2.patch +++ /dev/null @@ -1,28 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 8a9cb0209..400c681e7 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -225,8 +225,8 @@ if(NOT BUILD_SHARED_LIBS) - endif() - - eprosima_find_package(fastcdr REQUIRED) --eprosima_find_thirdparty(Asio asio VERSION 1.10.8) --eprosima_find_thirdparty(TinyXML2 tinyxml2) -+eprosima_find_thirdparty(asio REQUIRED) -+eprosima_find_thirdparty(tinyxml2 REQUIRED) - - find_package(foonathan_memory REQUIRED) - message(STATUS "Found foonathan_memory: ${foonathan_memory_DIR}") -diff --git a/src/cpp/CMakeLists.txt b/src/cpp/CMakeLists.txt -index d26915242..f00e36ea6 100644 ---- a/src/cpp/CMakeLists.txt -+++ b/src/cpp/CMakeLists.txt -@@ -456,7 +456,7 @@ elseif(NOT EPROSIMA_INSTALLER) - # Link library to external libraries. - target_link_libraries(${PROJECT_NAME} ${PRIVACY} fastcdr foonathan_memory - ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS} -- ${TINYXML2_LIBRARY} -+ tinyxml2::tinyxml2 - $<$:OpenSSL::SSL$OpenSSL::Crypto$<$:$crypt32.lib>> - $<$:iphlpapi$Shlwapi> - ${THIRDPARTY_BOOST_LINK_LIBS} diff --git a/recipes/fast-dds/all/patches/2.3.X-0001-fix-find-asio-and-tinyxml2.patch b/recipes/fast-dds/all/patches/2.3.X-0001-fix-find-asio-and-tinyxml2.patch index a597b73998c04..a8f7744bacf11 100644 --- a/recipes/fast-dds/all/patches/2.3.X-0001-fix-find-asio-and-tinyxml2.patch +++ b/recipes/fast-dds/all/patches/2.3.X-0001-fix-find-asio-and-tinyxml2.patch @@ -14,9 +14,18 @@ index 8a9cb0209..400c681e7 100644 find_package(foonathan_memory REQUIRED) message(STATUS "Found foonathan_memory: ${foonathan_memory_DIR}") diff --git a/src/cpp/CMakeLists.txt b/src/cpp/CMakeLists.txt -index d26915242..f00e36ea6 100644 +index d26915242..5cc41ba84 100644 --- a/src/cpp/CMakeLists.txt +++ b/src/cpp/CMakeLists.txt +@@ -435,7 +435,7 @@ elseif(NOT EPROSIMA_INSTALLER) + $ + $ + PRIVATE +- ${Asio_INCLUDE_DIR} ++ ${asio_INCLUDE_DIR} + ${TINYXML2_INCLUDE_DIR} + $<$:${ANDROID_IFADDRS_INCLUDE_DIR}> + ${THIRDPARTY_BOOST_INCLUDE_DIR} @@ -456,7 +456,7 @@ elseif(NOT EPROSIMA_INSTALLER) # Link library to external libraries. target_link_libraries(${PROJECT_NAME} ${PRIVACY} fastcdr foonathan_memory @@ -26,3 +35,12 @@ index d26915242..f00e36ea6 100644 $<$:OpenSSL::SSL$OpenSSL::Crypto$<$:$crypt32.lib>> $<$:iphlpapi$Shlwapi> ${THIRDPARTY_BOOST_LINK_LIBS} +@@ -579,7 +579,7 @@ if(UNIX AND EPROSIMA_INSTALLER) + COMPONENT headers + ) + +- set_public_headers_directory(${Asio_INCLUDE_DIR} "" ++ set_public_headers_directory(${asio_INCLUDE_DIR} "" + DESTINATION thirdparty/asio + COMPONENT headers + ) diff --git a/recipes/fast-dds/all/test_package/CMakeLists.txt b/recipes/fast-dds/all/test_package/CMakeLists.txt index 8d075b0d63dcf..fbfb035dfe0a2 100644 --- a/recipes/fast-dds/all/test_package/CMakeLists.txt +++ b/recipes/fast-dds/all/test_package/CMakeLists.txt @@ -1,16 +1,23 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(fastdds REQUIRED CONFIG) -add_executable(${PROJECT_NAME} - test_package.cpp +add_executable(${PROJECT_NAME} test_package.cpp) + +if ("${fastdds_VERSION}" VERSION_LESS "2.12.0") + target_sources(${PROJECT_NAME} PRIVATE msg/HelloWorld.cxx - msg/HelloWorldPubSubTypes.cxx -) + msg/HelloWorldPubSubTypes.cxx) + target_include_directories(${PROJECT_NAME} PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/msg) +else() + target_sources(${PROJECT_NAME} PRIVATE + msg2/HelloWorld.cxx + msg2/HelloWorldPubSubTypes.cxx) + target_include_directories(${PROJECT_NAME} PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/msg2) +endif() -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) target_link_libraries(${PROJECT_NAME} fastrtps) diff --git a/recipes/fast-dds/all/test_package/conanfile.py b/recipes/fast-dds/all/test_package/conanfile.py index 1bf1c7e26255d..fafba71d30d56 100644 --- a/recipes/fast-dds/all/test_package/conanfile.py +++ b/recipes/fast-dds/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/fast-dds/all/test_package/msg2/HelloWorld.cxx b/recipes/fast-dds/all/test_package/msg2/HelloWorld.cxx new file mode 100644 index 0000000000000..ef9331d5d9e6d --- /dev/null +++ b/recipes/fast-dds/all/test_package/msg2/HelloWorld.cxx @@ -0,0 +1,165 @@ +// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed 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. + +/*! + * @file HelloWorld.cpp + * This source file contains the implementation of the described types in the IDL file. + * + * This file was generated by the tool fastddsgen. + */ + +#ifdef _WIN32 +// Remove linker warning LNK4221 on Visual Studio +namespace { +char dummy; +} // namespace +#endif // _WIN32 + +#include "HelloWorld.h" + +#include + + +#include +using namespace eprosima::fastcdr::exception; + +#include + + + + +HelloWorld::HelloWorld() +{ +} + +HelloWorld::~HelloWorld() +{ +} + +HelloWorld::HelloWorld( + const HelloWorld& x) +{ + m_index = x.m_index; + m_message = x.m_message; +} + +HelloWorld::HelloWorld( + HelloWorld&& x) noexcept +{ + m_index = x.m_index; + m_message = std::move(x.m_message); +} + +HelloWorld& HelloWorld::operator =( + const HelloWorld& x) +{ + + m_index = x.m_index; + m_message = x.m_message; + return *this; +} + +HelloWorld& HelloWorld::operator =( + HelloWorld&& x) noexcept +{ + + m_index = x.m_index; + m_message = std::move(x.m_message); + return *this; +} + +bool HelloWorld::operator ==( + const HelloWorld& x) const +{ + return (m_index == x.m_index && + m_message == x.m_message); +} + +bool HelloWorld::operator !=( + const HelloWorld& x) const +{ + return !(*this == x); +} + +/*! + * @brief This function sets a value in member index + * @param _index New value for member index + */ +void HelloWorld::index( + uint32_t _index) +{ + m_index = _index; +} + +/*! + * @brief This function returns the value of member index + * @return Value of member index + */ +uint32_t HelloWorld::index() const +{ + return m_index; +} + +/*! + * @brief This function returns a reference to member index + * @return Reference to member index + */ +uint32_t& HelloWorld::index() +{ + return m_index; +} + + +/*! + * @brief This function copies the value in member message + * @param _message New value to be copied in member message + */ +void HelloWorld::message( + const std::string& _message) +{ + m_message = _message; +} + +/*! + * @brief This function moves the value in member message + * @param _message New value to be moved in member message + */ +void HelloWorld::message( + std::string&& _message) +{ + m_message = std::move(_message); +} + +/*! + * @brief This function returns a constant reference to member message + * @return Constant reference to member message + */ +const std::string& HelloWorld::message() const +{ + return m_message; +} + +/*! + * @brief This function returns a reference to member message + * @return Reference to member message + */ +std::string& HelloWorld::message() +{ + return m_message; +} + + +// Include auxiliary functions like for serializing/deserializing. +#include "HelloWorldCdrAux.ipp" + diff --git a/recipes/fast-dds/all/test_package/msg2/HelloWorld.h b/recipes/fast-dds/all/test_package/msg2/HelloWorld.h new file mode 100644 index 0000000000000..b95bcb5b146dd --- /dev/null +++ b/recipes/fast-dds/all/test_package/msg2/HelloWorld.h @@ -0,0 +1,189 @@ +// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed 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. + +/*! + * @file HelloWorld.h + * This header file contains the declaration of the described types in the IDL file. + * + * This file was generated by the tool fastddsgen. + */ + +#ifndef _FAST_DDS_GENERATED_HELLOWORLD_H_ +#define _FAST_DDS_GENERATED_HELLOWORLD_H_ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + + + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#define eProsima_user_DllExport __declspec( dllexport ) +#else +#define eProsima_user_DllExport +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define eProsima_user_DllExport +#endif // _WIN32 + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#if defined(HELLOWORLD_SOURCE) +#define HELLOWORLD_DllAPI __declspec( dllexport ) +#else +#define HELLOWORLD_DllAPI __declspec( dllimport ) +#endif // HELLOWORLD_SOURCE +#else +#define HELLOWORLD_DllAPI +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define HELLOWORLD_DllAPI +#endif // _WIN32 + +namespace eprosima { +namespace fastcdr { +class Cdr; +class CdrSizeCalculator; +} // namespace fastcdr +} // namespace eprosima + + + + + +/*! + * @brief This class represents the structure HelloWorld defined by the user in the IDL file. + * @ingroup HelloWorld + */ +class HelloWorld +{ +public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport HelloWorld(); + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~HelloWorld(); + + /*! + * @brief Copy constructor. + * @param x Reference to the object HelloWorld that will be copied. + */ + eProsima_user_DllExport HelloWorld( + const HelloWorld& x); + + /*! + * @brief Move constructor. + * @param x Reference to the object HelloWorld that will be copied. + */ + eProsima_user_DllExport HelloWorld( + HelloWorld&& x) noexcept; + + /*! + * @brief Copy assignment. + * @param x Reference to the object HelloWorld that will be copied. + */ + eProsima_user_DllExport HelloWorld& operator =( + const HelloWorld& x); + + /*! + * @brief Move assignment. + * @param x Reference to the object HelloWorld that will be copied. + */ + eProsima_user_DllExport HelloWorld& operator =( + HelloWorld&& x) noexcept; + + /*! + * @brief Comparison operator. + * @param x HelloWorld object to compare. + */ + eProsima_user_DllExport bool operator ==( + const HelloWorld& x) const; + + /*! + * @brief Comparison operator. + * @param x HelloWorld object to compare. + */ + eProsima_user_DllExport bool operator !=( + const HelloWorld& x) const; + + /*! + * @brief This function sets a value in member index + * @param _index New value for member index + */ + eProsima_user_DllExport void index( + uint32_t _index); + + /*! + * @brief This function returns the value of member index + * @return Value of member index + */ + eProsima_user_DllExport uint32_t index() const; + + /*! + * @brief This function returns a reference to member index + * @return Reference to member index + */ + eProsima_user_DllExport uint32_t& index(); + + + /*! + * @brief This function copies the value in member message + * @param _message New value to be copied in member message + */ + eProsima_user_DllExport void message( + const std::string& _message); + + /*! + * @brief This function moves the value in member message + * @param _message New value to be moved in member message + */ + eProsima_user_DllExport void message( + std::string&& _message); + + /*! + * @brief This function returns a constant reference to member message + * @return Constant reference to member message + */ + eProsima_user_DllExport const std::string& message() const; + + /*! + * @brief This function returns a reference to member message + * @return Reference to member message + */ + eProsima_user_DllExport std::string& message(); + +private: + + uint32_t m_index{0}; + std::string m_message; + +}; + +#endif // _FAST_DDS_GENERATED_HELLOWORLD_H_ + + + diff --git a/recipes/fast-dds/all/test_package/msg2/HelloWorld.idl b/recipes/fast-dds/all/test_package/msg2/HelloWorld.idl new file mode 100644 index 0000000000000..0fd2c355aeefa --- /dev/null +++ b/recipes/fast-dds/all/test_package/msg2/HelloWorld.idl @@ -0,0 +1,5 @@ +struct HelloWorld +{ + unsigned long index; + string message; +}; diff --git a/recipes/fast-dds/all/test_package/msg2/HelloWorldCdrAux.hpp b/recipes/fast-dds/all/test_package/msg2/HelloWorldCdrAux.hpp new file mode 100644 index 0000000000000..9f346d306beca --- /dev/null +++ b/recipes/fast-dds/all/test_package/msg2/HelloWorldCdrAux.hpp @@ -0,0 +1,48 @@ +// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed 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. + +/*! + * @file HelloWorldCdrAux.hpp + * This source file contains some definitions of CDR related functions. + * + * This file was generated by the tool fastddsgen. + */ + +#ifndef _FAST_DDS_GENERATED_HELLOWORLDCDRAUX_HPP_ +#define _FAST_DDS_GENERATED_HELLOWORLDCDRAUX_HPP_ + +#include "HelloWorld.h" + +constexpr uint32_t HelloWorld_max_cdr_typesize {268UL}; +constexpr uint32_t HelloWorld_max_key_cdr_typesize {0UL}; + + +namespace eprosima { +namespace fastcdr { + +class Cdr; +class CdrSizeCalculator; + + + +eProsima_user_DllExport void serialize_key( + eprosima::fastcdr::Cdr& scdr, + const HelloWorld& data); + + +} // namespace fastcdr +} // namespace eprosima + +#endif // _FAST_DDS_GENERATED_HELLOWORLDCDRAUX_HPP_ + diff --git a/recipes/fast-dds/all/test_package/msg2/HelloWorldCdrAux.ipp b/recipes/fast-dds/all/test_package/msg2/HelloWorldCdrAux.ipp new file mode 100644 index 0000000000000..42e91f3cc384a --- /dev/null +++ b/recipes/fast-dds/all/test_package/msg2/HelloWorldCdrAux.ipp @@ -0,0 +1,128 @@ +// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed 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. + +/*! + * @file HelloWorldCdrAux.ipp + * This source file contains some declarations of CDR related functions. + * + * This file was generated by the tool fastddsgen. + */ + +#ifndef _FAST_DDS_GENERATED_HELLOWORLDCDRAUX_IPP_ +#define _FAST_DDS_GENERATED_HELLOWORLDCDRAUX_IPP_ + +#include "HelloWorldCdrAux.hpp" + +#include +#include + + +#include +using namespace eprosima::fastcdr::exception; + +namespace eprosima { +namespace fastcdr { + + + +template<> +eProsima_user_DllExport size_t calculate_serialized_size( + eprosima::fastcdr::CdrSizeCalculator& calculator, + const HelloWorld& data, + size_t& current_alignment) +{ + static_cast(data); + + eprosima::fastcdr::EncodingAlgorithmFlag previous_encoding = calculator.get_encoding(); + size_t calculated_size {calculator.begin_calculate_type_serialized_size( + eprosima::fastcdr::CdrVersion::XCDRv2 == calculator.get_cdr_version() ? + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, + current_alignment)}; + + + calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), + data.index(), current_alignment); + + calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(1), + data.message(), current_alignment); + + + calculated_size += calculator.end_calculate_type_serialized_size(previous_encoding, current_alignment); + + return calculated_size; +} + +template<> +eProsima_user_DllExport void serialize( + eprosima::fastcdr::Cdr& scdr, + const HelloWorld& data) +{ + eprosima::fastcdr::Cdr::state current_state(scdr); + scdr.begin_serialize_type(current_state, + eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); + + scdr + << eprosima::fastcdr::MemberId(0) << data.index() + << eprosima::fastcdr::MemberId(1) << data.message() +; + scdr.end_serialize_type(current_state); +} + +template<> +eProsima_user_DllExport void deserialize( + eprosima::fastcdr::Cdr& cdr, + HelloWorld& data) +{ + cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, + [&data](eprosima::fastcdr::Cdr& dcdr, const eprosima::fastcdr::MemberId& mid) -> bool + { + bool ret_value = true; + switch (mid.id) + { + case 0: + dcdr >> data.index(); + break; + + case 1: + dcdr >> data.message(); + break; + + default: + ret_value = false; + break; + } + return ret_value; + }); +} + +void serialize_key( + eprosima::fastcdr::Cdr& scdr, + const HelloWorld& data) +{ + static_cast(scdr); + static_cast(data); +} + + + +} // namespace fastcdr +} // namespace eprosima + +#endif // _FAST_DDS_GENERATED_HELLOWORLDCDRAUX_IPP_ + diff --git a/recipes/fast-dds/all/test_package/msg2/HelloWorldPubSubTypes.cxx b/recipes/fast-dds/all/test_package/msg2/HelloWorldPubSubTypes.cxx new file mode 100644 index 0000000000000..85cb477896e60 --- /dev/null +++ b/recipes/fast-dds/all/test_package/msg2/HelloWorldPubSubTypes.cxx @@ -0,0 +1,221 @@ +// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed 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. + +/*! + * @file HelloWorldPubSubTypes.cpp + * This header file contains the implementation of the serialization functions. + * + * This file was generated by the tool fastddsgen. + */ + + +#include + +#include "HelloWorldPubSubTypes.h" +#include "HelloWorldCdrAux.hpp" + +using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; +using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; +using DataRepresentationId_t = eprosima::fastdds::dds::DataRepresentationId_t; + + + +HelloWorldPubSubType::HelloWorldPubSubType() +{ + setName("HelloWorld"); + uint32_t type_size = +#if FASTCDR_VERSION_MAJOR == 1 + static_cast(HelloWorld::getMaxCdrSerializedSize()); +#else + HelloWorld_max_cdr_typesize; +#endif + type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ + m_typeSize = type_size + 4; /*encapsulation*/ + m_isGetKeyDefined = false; + uint32_t keyLength = HelloWorld_max_key_cdr_typesize > 16 ? HelloWorld_max_key_cdr_typesize : 16; + m_keyBuffer = reinterpret_cast(malloc(keyLength)); + memset(m_keyBuffer, 0, keyLength); +} + +HelloWorldPubSubType::~HelloWorldPubSubType() +{ + if (m_keyBuffer != nullptr) + { + free(m_keyBuffer); + } +} + +bool HelloWorldPubSubType::serialize( + void* data, + SerializedPayload_t* payload, + DataRepresentationId_t data_representation) +{ + HelloWorld* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); + // Object that serializes the data. + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, + data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? + eprosima::fastcdr::CdrVersion::XCDRv1 : eprosima::fastcdr::CdrVersion::XCDRv2); + payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; +#if FASTCDR_VERSION_MAJOR > 1 + ser.set_encoding_flag( + data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? + eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); +#endif // FASTCDR_VERSION_MAJOR > 1 + + try + { + // Serialize encapsulation + ser.serialize_encapsulation(); + // Serialize the object. + ser << *p_type; + } + catch (eprosima::fastcdr::exception::Exception& /*exception*/) + { + return false; + } + + // Get the serialized length +#if FASTCDR_VERSION_MAJOR == 1 + payload->length = static_cast(ser.getSerializedDataLength()); +#else + payload->length = static_cast(ser.get_serialized_data_length()); +#endif // FASTCDR_VERSION_MAJOR == 1 + return true; +} + +bool HelloWorldPubSubType::deserialize( + SerializedPayload_t* payload, + void* data) +{ + try + { + // Convert DATA to pointer of your type + HelloWorld* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->length); + + // Object that deserializes the data. + eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN +#if FASTCDR_VERSION_MAJOR == 1 + , eprosima::fastcdr::Cdr::CdrType::DDS_CDR +#endif // FASTCDR_VERSION_MAJOR == 1 + ); + + // Deserialize encapsulation. + deser.read_encapsulation(); + payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + + // Deserialize the object. + deser >> *p_type; + } + catch (eprosima::fastcdr::exception::Exception& /*exception*/) + { + return false; + } + + return true; +} + +std::function HelloWorldPubSubType::getSerializedSizeProvider( + void* data, + DataRepresentationId_t data_representation) +{ + return [data, data_representation]() -> uint32_t + { +#if FASTCDR_VERSION_MAJOR == 1 + static_cast(data_representation); + return static_cast(type::getCdrSerializedSize(*static_cast(data))) + + 4u /*encapsulation*/; +#else + try + { + eprosima::fastcdr::CdrSizeCalculator calculator( + data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? + eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); + size_t current_alignment {0}; + return static_cast(calculator.calculate_serialized_size( + *static_cast(data), current_alignment)) + + 4u /*encapsulation*/; + } + catch (eprosima::fastcdr::exception::Exception& /*exception*/) + { + return 0; + } +#endif // FASTCDR_VERSION_MAJOR == 1 + }; +} + +void* HelloWorldPubSubType::createData() +{ + return reinterpret_cast(new HelloWorld()); +} + +void HelloWorldPubSubType::deleteData( + void* data) +{ + delete(reinterpret_cast(data)); +} + +bool HelloWorldPubSubType::getKey( + void* data, + InstanceHandle_t* handle, + bool force_md5) +{ + if (!m_isGetKeyDefined) + { + return false; + } + + HelloWorld* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), + HelloWorld_max_key_cdr_typesize); + + // Object that serializes the data. + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); +#if FASTCDR_VERSION_MAJOR == 1 + p_type->serializeKey(ser); +#else + eprosima::fastcdr::serialize_key(ser, *p_type); +#endif // FASTCDR_VERSION_MAJOR == 1 + if (force_md5 || HelloWorld_max_key_cdr_typesize > 16) + { + m_md5.init(); +#if FASTCDR_VERSION_MAJOR == 1 + m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); +#else + m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); +#endif // FASTCDR_VERSION_MAJOR == 1 + m_md5.finalize(); + for (uint8_t i = 0; i < 16; ++i) + { + handle->value[i] = m_md5.digest[i]; + } + } + else + { + for (uint8_t i = 0; i < 16; ++i) + { + handle->value[i] = m_keyBuffer[i]; + } + } + return true; +} + diff --git a/recipes/fast-dds/all/test_package/msg2/HelloWorldPubSubTypes.h b/recipes/fast-dds/all/test_package/msg2/HelloWorldPubSubTypes.h new file mode 100644 index 0000000000000..cb61cd6ba2335 --- /dev/null +++ b/recipes/fast-dds/all/test_package/msg2/HelloWorldPubSubTypes.h @@ -0,0 +1,132 @@ +// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed 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. + +/*! + * @file HelloWorldPubSubTypes.h + * This header file contains the declaration of the serialization functions. + * + * This file was generated by the tool fastddsgen. + */ + + +#ifndef _FAST_DDS_GENERATED_HELLOWORLD_PUBSUBTYPES_H_ +#define _FAST_DDS_GENERATED_HELLOWORLD_PUBSUBTYPES_H_ + +#include +#include +#include +#include +#include + +#include "HelloWorld.h" + + +#if !defined(GEN_API_VER) || (GEN_API_VER != 2) +#error \ + Generated HelloWorld is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. +#endif // GEN_API_VER + + + + +/*! + * @brief This class represents the TopicDataType of the type HelloWorld defined by the user in the IDL file. + * @ingroup HelloWorld + */ +class HelloWorldPubSubType : public eprosima::fastdds::dds::TopicDataType +{ +public: + + typedef HelloWorld type; + + eProsima_user_DllExport HelloWorldPubSubType(); + + eProsima_user_DllExport ~HelloWorldPubSubType() override; + + eProsima_user_DllExport bool serialize( + void* data, + eprosima::fastrtps::rtps::SerializedPayload_t* payload) override + { + return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); + } + + eProsima_user_DllExport bool serialize( + void* data, + eprosima::fastrtps::rtps::SerializedPayload_t* payload, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool deserialize( + eprosima::fastrtps::rtps::SerializedPayload_t* payload, + void* data) override; + + eProsima_user_DllExport std::function getSerializedSizeProvider( + void* data) override + { + return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); + } + + eProsima_user_DllExport std::function getSerializedSizeProvider( + void* data, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool getKey( + void* data, + eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport void* createData() override; + + eProsima_user_DllExport void deleteData( + void* data) override; + +#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return false; + } + +#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + +#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + eProsima_user_DllExport inline bool is_plain() const override + { + return false; + } + + eProsima_user_DllExport inline bool is_plain( + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + { + static_cast(data_representation); + return false; + } + +#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + +#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + static_cast(memory); + return false; + } + +#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + + MD5 m_md5; + unsigned char* m_keyBuffer; + +}; + +#endif // _FAST_DDS_GENERATED_HELLOWORLD_PUBSUBTYPES_H_ + diff --git a/recipes/fast-dds/all/test_package/test_package.cpp b/recipes/fast-dds/all/test_package/test_package.cpp index 89ac973375f14..f183dbe4586b0 100644 --- a/recipes/fast-dds/all/test_package/test_package.cpp +++ b/recipes/fast-dds/all/test_package/test_package.cpp @@ -5,12 +5,12 @@ #include #include -#include "msg/HelloWorld.h" -#include "msg/HelloWorldPubSubTypes.h" +#include "HelloWorld.h" +#include "HelloWorldPubSubTypes.h" int main() { - // Define msg to send + // Define msg to send HelloWorld hello; hello.index(0); hello.message("HelloWorld"); diff --git a/recipes/fast-dds/all/test_v1_package/CMakeLists.txt b/recipes/fast-dds/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..fe92296627765 --- /dev/null +++ b/recipes/fast-dds/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +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/fast-dds/all/test_v1_package/conanfile.py b/recipes/fast-dds/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..1bf1c7e26255d --- /dev/null +++ b/recipes/fast-dds/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_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if 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-dds/config.yml b/recipes/fast-dds/config.yml index e8d99700ff1a0..101b2295a806a 100644 --- a/recipes/fast-dds/config.yml +++ b/recipes/fast-dds/config.yml @@ -1,7 +1,13 @@ versions: - "2.3.4": + "2.14.3": + folder: all + "2.14.0": + folder: all + "2.13.3": folder: all - "2.3.3": + "2.11.2": folder: all - "2.3.2": + "2.10.1": + folder: all + "2.3.4": folder: all diff --git a/recipes/fast_double_parser/all/conandata.yml b/recipes/fast_double_parser/all/conandata.yml index e6359076757f6..b8e8bab6d1227 100644 --- a/recipes/fast_double_parser/all/conandata.yml +++ b/recipes/fast_double_parser/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.8.0": + url: "https://github.com/lemire/fast_double_parser/archive/v0.8.0.tar.gz" + sha256: "9ad74e059cc7c3e53a3057ca97a74c88ae2a6a7d36ce470193557cbd05ee8f92" "0.7.0": url: "https://github.com/lemire/fast_double_parser/archive/v0.7.0.tar.gz" sha256: "eb80a1d9c406bbe8cb22fffd3c007651f716abd03225009302d8aba8e9c4df77" diff --git a/recipes/fast_double_parser/all/conanfile.py b/recipes/fast_double_parser/all/conanfile.py index a704c8e783d7f..824ad38a512bb 100644 --- a/recipes/fast_double_parser/all/conanfile.py +++ b/recipes/fast_double_parser/all/conanfile.py @@ -10,16 +10,16 @@ class FastDoubleParserConan(ConanFile): name = "fast_double_parser" description = "Fast function to parse strings into double (binary64) floating-point values, enforces the RFC 7159 (JSON standard) grammar: 4x faster than strtod" - topics = ("numerical", "header-only") + license = ("Apache-2.0", "BSL-1.0") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/lemire/fast_double_parser" - license = ("Apache-2.0", "BSL-1.0") - - settings = "os", "compiler", "build_type", "arch" + topics = ("numerical", "header-only") + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True def layout(self): - basic_layout(self) + basic_layout(self, src_folder="src") def validate(self): if self.settings.compiler.get_safe("cppstd"): @@ -29,10 +29,13 @@ 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 package(self): 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) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/fast_double_parser/all/test_package/CMakeLists.txt b/recipes/fast_double_parser/all/test_package/CMakeLists.txt index 00ff6376bfebe..0da8cca9a71e9 100644 --- a/recipes/fast_double_parser/all/test_package/CMakeLists.txt +++ b/recipes/fast_double_parser/all/test_package/CMakeLists.txt @@ -4,5 +4,5 @@ project(test_package LANGUAGES CXX) find_package(fast_double_parser REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} fast_double_parser::fast_double_parser) +target_link_libraries(${PROJECT_NAME} PRIVATE fast_double_parser::fast_double_parser) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/fast_double_parser/config.yml b/recipes/fast_double_parser/config.yml index d61439bae1bc3..4dec0affe6753 100644 --- a/recipes/fast_double_parser/config.yml +++ b/recipes/fast_double_parser/config.yml @@ -1,4 +1,6 @@ versions: + "0.8.0": + folder: all "0.7.0": folder: all "0.6.0": diff --git a/recipes/fast_float/all/conandata.yml b/recipes/fast_float/all/conandata.yml index 671eec2eea6bf..88c8750ff7686 100644 --- a/recipes/fast_float/all/conandata.yml +++ b/recipes/fast_float/all/conandata.yml @@ -1,4 +1,52 @@ sources: + "7.0.0": + url: "https://github.com/fastfloat/fast_float/archive/v7.0.0.tar.gz" + sha256: "d2a08e722f461fe699ba61392cd29e6b23be013d0f56e50c7786d0954bffcb17" + "6.1.5": + url: "https://github.com/fastfloat/fast_float/archive/v6.1.5.tar.gz" + sha256: "597126ff5edc3ee59d502c210ded229401a30dafecb96a513135e9719fcad55f" + "6.1.4": + url: "https://github.com/fastfloat/fast_float/archive/v6.1.4.tar.gz" + sha256: "12cb6d250824160ca16bcb9d51f0ca7693d0d10cb444f34f1093bc02acfce704" + "6.1.3": + url: "https://github.com/fastfloat/fast_float/archive/v6.1.3.tar.gz" + sha256: "7dd99cc2ff44e07dc2a42bed0c6b8c4a8ee4e3b1c330f77073b6cfdb48724c8e" + "6.1.1": + url: "https://github.com/fastfloat/fast_float/archive/v6.1.1.tar.gz" + sha256: "10159a4a58ba95fe9389c3c97fe7de9a543622aa0dcc12dd9356d755e9a94cb4" + "6.1.0": + url: "https://github.com/fastfloat/fast_float/archive/v6.1.0.tar.gz" + sha256: "5a629e1f18f037ad0016c41ead630ea471cccbcdf60239ed3466c491d8e7c908" + "6.0.0": + url: "https://github.com/fastfloat/fast_float/archive/v6.0.0.tar.gz" + sha256: "7e98671ef4cc7ed7f44b3b13f80156c8d2d9244fac55deace28bd05b0a2c7c8e" + "5.3.0": + url: "https://github.com/fastfloat/fast_float/archive/v5.3.0.tar.gz" + sha256: "2f3bc50670455534dcaedc9dcd0517b71152f319d0cec8625f21c51d23eaf4b9" + "5.2.0": + url: "https://github.com/fastfloat/fast_float/archive/v5.2.0.tar.gz" + sha256: "72bbfd1914e414c920e39abdc81378adf910a622b62c45b4c61d344039425d18" + "5.1.0": + url: "https://github.com/fastfloat/fast_float/archive/v5.1.0.tar.gz" + sha256: "37a0de5473ed6b9617ea4c199c2d5bda45ab027dbe72220fe36cf3000f9f23bf" + "5.0.0": + url: "https://github.com/fastfloat/fast_float/archive/v5.0.0.tar.gz" + sha256: "86645ab4af22d21d4ba2d980572dfb74faf90c20c52240d7d8d2201f3eaf4252" + "4.0.0": + url: "https://github.com/fastfloat/fast_float/archive/v4.0.0.tar.gz" + sha256: "9470f229b9ea8d116af7c92f2ab8e8ae6b3c3225d15081b859634328f28d4664" + "3.11.0": + url: "https://github.com/fastfloat/fast_float/archive/v3.11.0.tar.gz" + sha256: "accb9d1ae94bdb5c50b5a7c3723c0e2e128853f8d8f007068fec2b58887db05d" + "3.10.1": + url: "https://github.com/fastfloat/fast_float/archive/v3.10.1.tar.gz" + sha256: "d162c21c1dc538dbc6b3bb6d1317a7808f2eccef78638445630533f5bed902ee" + "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" @@ -17,27 +65,12 @@ sources: "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..70247daa50c98 100644 --- a/recipes/fast_float/all/conanfile.py +++ b/recipes/fast_float/all/conanfile.py @@ -6,15 +6,15 @@ 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" + license = ("Apache-2.0", "MIT", "BSL-1.0") url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/fastfloat/fast_float" + topics = ("conversion", "from_chars", "header-only") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -29,8 +29,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 +42,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" @@ -53,3 +50,5 @@ def package_info(self): self.cpp_info.components["fastfloat"].names["cmake_find_package"] = "fast_float" self.cpp_info.components["fastfloat"].names["cmake_find_package_multi"] = "fast_float" self.cpp_info.components["fastfloat"].set_property("cmake_target_name", "FastFloat::fast_float") + self.cpp_info.components["fastfloat"].bindirs = [] + self.cpp_info.components["fastfloat"].libdirs = [] diff --git a/recipes/fast_float/all/test_package/conanfile.py b/recipes/fast_float/all/test_package/conanfile.py index d120a992c06a6..8a5bb47f50c4c 100644 --- a/recipes/fast_float/all/test_package/conanfile.py +++ b/recipes/fast_float/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/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 d1bb7ba803813..4cba1be1f431a 100644 --- a/recipes/fast_float/config.yml +++ b/recipes/fast_float/config.yml @@ -1,4 +1,36 @@ versions: + "7.0.0": + folder: all + "6.1.5": + folder: all + "6.1.4": + folder: all + "6.1.3": + folder: all + "6.1.1": + folder: all + "6.1.0": + folder: all + "6.0.0": + folder: all + "5.3.0": + folder: all + "5.2.0": + folder: all + "5.1.0": + folder: all + "5.0.0": + folder: all + "4.0.0": + folder: all + "3.11.0": + folder: all + "3.10.1": + folder: all + "3.10.0": + folder: all + "3.9.0": + folder: all "3.8.1": folder: all "3.8.0": @@ -11,19 +43,9 @@ versions: folder: all "3.4.0": folder: all - "3.2.0": - folder: all - "3.1.0": - folder: all "2.0.0": folder: all "1.1.2": folder: all - "1.1.1": - folder: all - "1.0.0": - folder: all "0.9.0": folder: all - "0.8.0": - folder: all diff --git a/recipes/fast_io/all/conandata.yml b/recipes/fast_io/all/conandata.yml new file mode 100644 index 0000000000000..849d1ed038071 --- /dev/null +++ b/recipes/fast_io/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "cci.20240729": + url: "https://github.com/cppfastio/fast_io/archive/44617e9368b64047fabd00cd98b037c1c2fc7fb2.tar.gz" + sha256: "077692f72f2a7e3fed44fa5b37613d058657738c2592addfcb6559cf1ae30716" + "cci.20240219": + url: "https://github.com/cppfastio/fast_io/archive/316afccde333721b059a761b25217084e84a9ca0.tar.gz" + sha256: "9feab7802957c8069b2a112f97bfb885d503ff5d7f433197f47636f40a20188a" diff --git a/recipes/fast_io/all/conanfile.py b/recipes/fast_io/all/conanfile.py new file mode 100644 index 0000000000000..32f435f8730b5 --- /dev/null +++ b/recipes/fast_io/all/conanfile.py @@ -0,0 +1,68 @@ +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 FastIoConan(ConanFile): + name = "fast_io" + description = "fast_io is a C++ io exception-safe RAII library based on C++ 20 Concepts. It is at least 10 times faster than cstdio than iostream." + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/cppfastio/fast_io" + topics = ("cstdio", "iostream", "io", "header-only") + package_type = "header-library" + 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": "13", + "clang": "15", + # Apple-Clang 13 is not enough in this case, + # partial support for concepts + "apple-clang": "14", + "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) + 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.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"), + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/fast_io/all/test_package/CMakeLists.txt b/recipes/fast_io/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..091f3e6ef74db --- /dev/null +++ b/recipes/fast_io/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.12) +project(test_package LANGUAGES CXX) + +find_package(fast_io REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE fast_io::fast_io) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) diff --git a/recipes/fast_io/all/test_package/conanfile.py b/recipes/fast_io/all/test_package/conanfile.py new file mode 100644 index 0000000000000..b9d7f11e89dcd --- /dev/null +++ b/recipes/fast_io/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 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/fast_io/all/test_package/test_package.cpp b/recipes/fast_io/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..0e163592d3756 --- /dev/null +++ b/recipes/fast_io/all/test_package/test_package.cpp @@ -0,0 +1,8 @@ +#include +#include "fast_io.h" + +int main() { + fast_io::io::print(4, " " ,4, "\n"); + + return 0; +} diff --git a/recipes/fast_io/config.yml b/recipes/fast_io/config.yml new file mode 100644 index 0000000000000..7559ae4709057 --- /dev/null +++ b/recipes/fast_io/config.yml @@ -0,0 +1,5 @@ +versions: + "cci.20240729": + folder: all + "cci.20240219": + folder: all diff --git a/recipes/fastgltf/all/conandata.yml b/recipes/fastgltf/all/conandata.yml new file mode 100644 index 0000000000000..42f9e0fde5669 --- /dev/null +++ b/recipes/fastgltf/all/conandata.yml @@ -0,0 +1,24 @@ +sources: + "0.7.0": + url: "https://github.com/spnda/fastgltf/archive/refs/tags/v0.7.0.tar.gz" + sha256: "1d0af69db938fd81dd34ea51f99e37f0023852c93befe63e23f9e55abd4a18ec" + "0.6.1": + url: "https://github.com/spnda/fastgltf/archive/refs/tags/v0.6.1.tar.gz" + sha256: "5f10b153ec941f5e6465425f542d3864f586aca040b0b659cb9ae70d42369390" + "0.5.0": + url: "https://github.com/spnda/fastgltf/archive/refs/tags/v0.5.0.tar.gz" + sha256: "f67558da009bfd1174b3f32606c41c20fe6fbcb70fc516e9f7bf0f63c06e87ff" + "0.4.0": + url: "https://github.com/spnda/fastgltf/archive/refs/tags/v0.4.0.tar.gz" + sha256: "77debe12acb6b498ea77306ce64277cedb14ad803b461ea677a61bc604bb59b5" +patches: + "0.6.1": + - patch_file: "patches/0.6.1-0001-find_package-simdjson.patch" + patch_description: "find_package simdjson" + patch_type: "conan" + patch_source: "https://github.com/spnda/fastgltf/issues/22" + "0.5.0": + - patch_file: "patches/0.5.0-0001-find_package-simdjson.patch" + patch_description: "find_package simdjson" + patch_type: "conan" + patch_source: "https://github.com/spnda/fastgltf/issues/22" diff --git a/recipes/fastgltf/all/conanfile.py b/recipes/fastgltf/all/conanfile.py new file mode 100644 index 0000000000000..507a972f624fe --- /dev/null +++ b/recipes/fastgltf/all/conanfile.py @@ -0,0 +1,115 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMakeToolchain, CMakeDeps, CMake, cmake_layout +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 + +import os + +required_conan_version = ">=1.59.0" + + +class fastgltf(ConanFile): + name = "fastgltf" + description = "A modern C++17 glTF 2.0 library focused on speed, correctness, and usability" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/spnda/fastgltf" + topics = ("gltf", "simd", "cpp17") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "enable_small_vector": [True, False], + "disable_custom_memory_pool": [True, False], + "use_64bit_float": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "enable_small_vector": False, + "disable_custom_memory_pool": False, + "use_64bit_float": False, + } + + @property + def _min_cppstd(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "8", + "clang": "7", + "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 + + if Version(self.version) <= "0.6.0": + del self.options.disable_custom_memory_pool + del self.options.use_64bit_float + + 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("simdjson/3.2.0") + + def validate(self): + if self.settings.get_safe("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): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + if Version(self.version) <= "0.7.0": + tc.variables["FASTGLTF_DOWNLOAD_SIMDJSON"] = False + if self.options.enable_small_vector: + tc.variables["FASTGLTF_USE_CUSTOM_SMALLVECTOR"] = True + if self.options.get_safe("disable_custom_memory_pool"): + tc.variables["FASTGLTF_DISABLE_CUSTOM_MEMORY_POOL"] = True + if self.options.get_safe("use_64bit_float"): + tc.variables["FASTGLTF_USE_64BIT_FLOAT"] = True + if Version(self.version) >= "0.7.0": + tc.variables["FASTGLTF_COMPILE_AS_CPP20"] = "20" in str(self.settings.get_safe("compiler.cppstd")) + tc.generate() + deps = CMakeDeps(self) + deps.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*", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + + def package_info(self): + self.cpp_info.libs = ["fastgltf"] + if "20" in str(self.settings.get_safe("compiler.cppstd")): + self.cpp_info.defines.append("FASTGLTF_CPP_20") diff --git a/recipes/fastgltf/all/patches/0.5.0-0001-find_package-simdjson.patch b/recipes/fastgltf/all/patches/0.5.0-0001-find_package-simdjson.patch new file mode 100644 index 0000000000000..488ed53394d16 --- /dev/null +++ b/recipes/fastgltf/all/patches/0.5.0-0001-find_package-simdjson.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f76a8d8..27c1d1a 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -74,6 +74,8 @@ if (FASTGLTF_DOWNLOAD_SIMDJSON) + NAMESPACE fastgltf:: + DESTINATION lib/cmake/fastgltf + ) ++else() ++ find_package(simdjson CONFIG REQUIRED) + endif() + + # Create the library target diff --git a/recipes/fastgltf/all/patches/0.6.1-0001-find_package-simdjson.patch b/recipes/fastgltf/all/patches/0.6.1-0001-find_package-simdjson.patch new file mode 100644 index 0000000000000..d3ad49785a09a --- /dev/null +++ b/recipes/fastgltf/all/patches/0.6.1-0001-find_package-simdjson.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 250ee84..1877f54 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -79,6 +79,8 @@ if (FASTGLTF_DOWNLOAD_SIMDJSON) + NAMESPACE fastgltf:: + DESTINATION lib/cmake/fastgltf + ) ++else() ++ find_package(simdjson CONFIG REQUIRED) + endif() + + # Create the library target diff --git a/recipes/fastgltf/all/test_package/CMakeLists.txt b/recipes/fastgltf/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..b4c6d8669be8e --- /dev/null +++ b/recipes/fastgltf/all/test_package/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(fastgltf REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE fastgltf::fastgltf) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +if(fastgltf_VERSION VERSION_GREATER_EQUAL "0.7.0") + target_compile_definitions(${PROJECT_NAME} PRIVATE FASTGLTF_0_7_0_LATER) +elseif(fastgltf_VERSION VERSION_GREATER_EQUAL "0.5.0") + target_compile_definitions(${PROJECT_NAME} PRIVATE FASTGLTF_0_5_0_LATER) +endif() diff --git a/recipes/fastgltf/all/test_package/conanfile.py b/recipes/fastgltf/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fb96656f203 --- /dev/null +++ b/recipes/fastgltf/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/fastgltf/all/test_package/test_package.cpp b/recipes/fastgltf/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..b076f02e4cb70 --- /dev/null +++ b/recipes/fastgltf/all/test_package/test_package.cpp @@ -0,0 +1,26 @@ +#include +#if defined(FASTGLTF_0_7_0_LATER) +# include +#elif defined(FASTGLTF_0_5_0_LATER) +# include +#else +# include +#endif + +#include +#include + +int main() { +#ifdef FASTGLTF_0_5_0_LATER + // gcc < 11 uses pthread_once for std::call_once. + // there is an known bug about pthread_once with older glibc. + // This is workaround for that. + // see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60662 + std::this_thread::sleep_for(std::chrono::milliseconds(1)); +#endif + + fastgltf::Parser parser; + printf("Version: " FASTGLTF_QUOTE(FASTGLTF_VERSION) "\n"); + printf("C++17: " FASTGLTF_QUOTE(FASTGLTF_CPP_17) "\n"); + printf("C++20: " FASTGLTF_QUOTE(FASTGLTF_CPP_20) "\n"); +} diff --git a/recipes/fastgltf/all/test_v1_package/CMakeLists.txt b/recipes/fastgltf/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..be00a8c7f57c7 --- /dev/null +++ b/recipes/fastgltf/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/fastgltf/all/test_v1_package/conanfile.py b/recipes/fastgltf/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/fastgltf/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/fastgltf/config.yml b/recipes/fastgltf/config.yml new file mode 100644 index 0000000000000..2ea713dd46d98 --- /dev/null +++ b/recipes/fastgltf/config.yml @@ -0,0 +1,9 @@ +versions: + "0.7.0": + folder: all + "0.6.1": + folder: all + "0.5.0": + folder: all + "0.4.0": + folder: all diff --git a/recipes/fastnoise2/all/conandata.yml b/recipes/fastnoise2/all/conandata.yml new file mode 100644 index 0000000000000..63afd14b04674 --- /dev/null +++ b/recipes/fastnoise2/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.10.0-alpha": + url: "https://github.com/Auburn/FastNoise2/archive/v0.10.0-alpha.tar.gz" + sha256: "8e1331425d6372e65e73775e13fedd367ae5999ec5616036b99df33434e3b527" diff --git a/recipes/fastnoise2/all/conanfile.py b/recipes/fastnoise2/all/conanfile.py new file mode 100644 index 0000000000000..15602b9b08499 --- /dev/null +++ b/recipes/fastnoise2/all/conanfile.py @@ -0,0 +1,92 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import get, copy, rmdir, rm +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 Fastnoise2Conan(ConanFile): + name = "fastnoise2" + description = "Modular node graph based noise generation library using SIMD, C++17 and templates" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/Auburn/FastNoise2" + topics = ("procedural-generation", "terrain-generation", "noise") + package_type = "library" + 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 { + "gcc": "8", + "clang": "7", + "apple-clang": "12", + "Visual Studio": "16", + "msvc": "192", + } + + 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) + 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["FASTNOISE2_NOISETOOL"] = 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")) + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + rm(self, "*.pdb", os.path.join(self.package_folder, "lib")) + + def package_info(self): + lib_suffix = "D" if self.settings.build_type == "Debug" else "" + self.cpp_info.libs = [f"FastNoise{lib_suffix}"] + + self.cpp_info.set_property("cmake_file_name", "FastNoise2") + self.cpp_info.set_property("cmake_target_name", "FastNoise2::FastNoise") + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") diff --git a/recipes/fastnoise2/all/test_package/CMakeLists.txt b/recipes/fastnoise2/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..4c5f6ffc5d5fe --- /dev/null +++ b/recipes/fastnoise2/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(FastNoise2 REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE FastNoise2::FastNoise) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) + diff --git a/recipes/fastnoise2/all/test_package/conanfile.py b/recipes/fastnoise2/all/test_package/conanfile.py new file mode 100644 index 0000000000000..f5cf204295e19 --- /dev/null +++ b/recipes/fastnoise2/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/fastnoise2/all/test_package/test_package.cpp b/recipes/fastnoise2/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..0dd8b950d971d --- /dev/null +++ b/recipes/fastnoise2/all/test_package/test_package.cpp @@ -0,0 +1,11 @@ +#include "FastNoise/FastNoise.h" + +int main() { + auto fnSimplex = FastNoise::New(); + auto fnFractal = FastNoise::New(); + + fnFractal->SetSource( fnSimplex ); + fnFractal->SetOctaveCount( 5 ); + + return 0; +} diff --git a/recipes/fastnoise2/config.yml b/recipes/fastnoise2/config.yml new file mode 100644 index 0000000000000..a75277535cb78 --- /dev/null +++ b/recipes/fastnoise2/config.yml @@ -0,0 +1,3 @@ +versions: + "0.10.0-alpha": + 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..28f460ca23316 100644 --- a/recipes/fastpfor/all/conandata.yml +++ b/recipes/fastpfor/all/conandata.yml @@ -1,9 +1,9 @@ sources: - "cci.20220205": - url: "https://github.com/lemire/FastPFor/archive/773283d4a11fa2440a1b3b28fd77f775e86d7898.tar.gz" - sha256: "d4419512420f3bcc65862c5c367021f201b5ba3e8cb0dad895cdf444e0867b30" - + "0.2.0": + url: "https://github.com/lemire/FastPFor/archive/refs/tags/v0.2.0.tar.gz" + sha256: "d9f0eacf9c3c61866cda23bae35107ca9c5d35fa7b7a96ca9ccc85803d7e753d" patches: - "cci.20220205": - - patch_file: "patches/cci.20220205-0001-fix-cmake.patch" - base_path: "source_subfolder" + "0.2.0": + - patch_file: "patches/0.2.0-0001-fix-cmake.patch" + 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..3e02d3498b338 100644 --- a/recipes/fastpfor/all/conanfile.py +++ b/recipes/fastpfor/all/conanfile.py @@ -1,75 +1,79 @@ -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, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.apple import is_apple_os +from conan.tools.scm import Version 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") + package_type = "static-library" settings = "os", "arch", "compiler", "build_type" options = { - "shared": [True, False], "fPIC": [True, False], } default_options = { - "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": del self.options.fPIC - 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.arch != "x86_64": - raise ConanInvalidConfiguration("{} architecture is not supported".format(self.settings.arch)) + @property + def _has_simde(self): + return "arm" in str(self.settings.arch) - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, "11") + def requirements(self): + if self._has_simde: + self.requires("simde/0.8.0", transitive_headers=True) + + def validate(self): + check_min_cppstd(self, 11) + if self.settings.compiler == "apple-clang" and Version(self.settings.compiler.version) < "15.0": + raise ConanInvalidConfiguration("${self.ref} doesn't support ${self.settings.compiler} < 15.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) + apply_conandata_patches(self) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.configure() - return cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["WITH_TEST"] = False + if self._has_simde: + tc.cache_variables["SUPPORT_NEON"] = True + tc.preprocessor_definitions["SIMDE_ENABLE_NATIVE_ALIASES"] = 1 + 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() + 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,7 +81,8 @@ def package_info(self): self.cpp_info.set_property("cmake_file_name", "FastPFOR") self.cpp_info.set_property("cmake_target_name", "FastPFOR::FastPFOR") - 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" - self.cpp_info.names["cmake_find_package_multi"] = "FastPFOR" + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") + + if self._has_simde: + self.cpp_info.defines = ["SIMDE_ENABLE_NATIVE_ALIASES"] diff --git a/recipes/fastpfor/all/patches/0.2.0-0001-fix-cmake.patch b/recipes/fastpfor/all/patches/0.2.0-0001-fix-cmake.patch new file mode 100644 index 0000000000000..8ba1054fb355a --- /dev/null +++ b/recipes/fastpfor/all/patches/0.2.0-0001-fix-cmake.patch @@ -0,0 +1,85 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f06b25f..1f6bd0f 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -4,7 +4,7 @@ + # Copyright (c) 2012 Louis Dionne + # + cmake_minimum_required(VERSION 3.0) +-set (CMAKE_CXX_STANDARD 11) # for constexpr specifier and other goodies ++# set (CMAKE_CXX_STANDARD 11) # for constexpr specifier and other goodies + + if (NOT CMAKE_BUILD_TYPE) + message(STATUS "No build type selected, default to Release") +@@ -62,7 +62,7 @@ if( SUPPORT_SSE42 ) + MESSAGE( STATUS "SSE 4.2 support detected" ) + else() + if (SUPPORT_NEON) +- include("${CMAKE_MODULE_PATH}/simde.cmake") ++ find_package(simde REQUIRED CONFIG) + MESSAGE(STATUS "USING SIMDE FOR SIMD OPERATIONS") + else () + MESSAGE(STATUS "SIMDE and SSE 4.2 support not detected") +@@ -103,6 +103,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() +@@ -129,19 +133,19 @@ add_library(FastPFOR STATIC + 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) + add_executable(csv2maropu src/csv2maropu.cpp) +- ++endif() + if (SUPPORT_NEON) +- target_link_libraries(FastPFOR PUBLIC simde) +- target_link_libraries(gapstats PUBLIC simde) +- target_link_libraries(partitionbylength PUBLIC simde) +- target_link_libraries(csv2maropu PUBLIC simde) ++ target_link_libraries(FastPFOR PUBLIC simde::simde) ++ # target_link_libraries(gapstats PUBLIC simde::simde) ++ # target_link_libraries(partitionbylength PUBLIC simde::simde) ++ # target_link_libraries(csv2maropu PUBLIC simde::simde) + endif() +- ++if(0) + add_executable(entropy src/entropy.cpp) + target_link_libraries(entropy FastPFOR) + +@@ -149,7 +153,7 @@ if( SUPPORT_SSE42 ) + add_executable(benchbitpacking src/benchbitpacking.cpp) + target_link_libraries(benchbitpacking FastPFOR) + endif() +- ++endif() + find_package(snappy) + if(NOT ${snappy_FOUND}) + message(STATUS "Snappy was not found. codecssnappy and " +@@ -158,6 +162,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}) +@@ -165,6 +170,7 @@ else() + add_executable(inmemorybenchmarksnappy src/inmemorybenchmark.cpp) + set_target_properties(inmemorybenchmarksnappy PROPERTIES DEFINE_SYMBOL USESNAPPY) + target_link_libraries(inmemorybenchmarksnappy FastPFOR ${snappy_LIBRARIES}) ++ endif() + endif() + + option(WITH_TEST "Build with Google Test" ON) diff --git a/recipes/fastpfor/all/patches/cci.20220205-0001-fix-cmake.patch b/recipes/fastpfor/all/patches/cci.20220205-0001-fix-cmake.patch deleted file mode 100644 index 831aaf49de782..0000000000000 --- a/recipes/fastpfor/all/patches/cci.20220205-0001-fix-cmake.patch +++ /dev/null @@ -1,72 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 5520747..dfccbc1 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 -@@ -117,9 +121,8 @@ 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) -@@ -132,6 +135,7 @@ if( SUPPORT_SSE42 ) - add_executable(benchbitpacking src/benchbitpacking.cpp) - target_link_libraries(benchbitpacking FastPFOR) - endif() -+endif(0) - - find_package(snappy) - if(NOT ${snappy_FOUND}) -@@ -141,6 +145,8 @@ 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}) -@@ -148,8 +154,10 @@ else() - add_executable(inmemorybenchmarksnappy src/inmemorybenchmark.cpp) - set_target_properties(inmemorybenchmarksnappy PROPERTIES DEFINE_SYMBOL USESNAPPY) - target_link_libraries(inmemorybenchmarksnappy FastPFOR ${snappy_LIBRARIES}) -+ endif(0) - 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}" . -@@ -207,7 +215,7 @@ target_link_libraries(FastPFOR_unittest gtest FastPFOR) - enable_testing() - add_test("unit" unit) - add_test("FastPFOR_unittest" FastPFOR_unittest) -- -+endif(0) - - 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/config.yml b/recipes/fastpfor/config.yml index 19127b42445cc..b370fcee5fe7c 100644 --- a/recipes/fastpfor/config.yml +++ b/recipes/fastpfor/config.yml @@ -1,3 +1,3 @@ versions: - "cci.20220205": + "0.2.0": folder: all diff --git a/recipes/fastprng/all/conanfile.py b/recipes/fastprng/all/conanfile.py index c83ba01f89440..5c6a15b03e066 100644 --- a/recipes/fastprng/all/conanfile.py +++ b/recipes/fastprng/all/conanfile.py @@ -9,16 +9,20 @@ class FastPRNGConan(ConanFile): name = "fastprng" - description = "FAST 32/64 bit PRNG (pseudo-random generator), highly optimized, based on xoshiro* / xoroshiro*, xorshift and other Marsaglia algorithms." + description = ( + "FAST 32/64 bit PRNG (pseudo-random generator), highly optimized, based " + "on xoshiro* / xoroshiro*, xorshift and other Marsaglia algorithms." + ) topics = ("random", "prng", "xorshift", "xoshiro", ) license = "BSD-2-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/BrutPitt/fastPRNG" + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True def layout(self): - basic_layout(self) + basic_layout(self, src_folder="src") def package_id(self): self.info.clear() @@ -28,13 +32,12 @@ def validate(self): 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 package(self): 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")) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/fastprng/all/test_package/conanfile.py b/recipes/fastprng/all/test_package/conanfile.py index 48499fa0989d9..e845ae751a301 100644 --- a/recipes/fastprng/all/test_package/conanfile.py +++ b/recipes/fastprng/all/test_package/conanfile.py @@ -4,7 +4,6 @@ import os -# It will become the standard on Conan 2.x class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" diff --git a/recipes/fcl/all/conanfile.py b/recipes/fcl/all/conanfile.py index 2c8e8687c5122..2fd6a5fe45165 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,50 +41,50 @@ 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") - self.requires("libccd/2.1") + # Used in fcl/common/types.h public header + self.requires("eigen/3.4.0", transitive_headers=True) + # Used in fcl/narrowphase/detail/convexity_based_algorithm/support.h + self.requires("libccd/2.1", transitive_headers=True) if self.options.with_octomap: - self.requires("octomap/1.9.7") + # Used in fcl/geometry/octree/octree.h + self.requires("octomap/1.9.7", transitive_headers=True) 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) - tc.variables["FCL_ENABLE_PROFILING"] = False - tc.variables["FCL_TREAT_WARNINGS_AS_ERRORS"] = False - tc.variables["FCL_HIDE_ALL_SYMBOLS"] = False - tc.variables["FCL_STATIC_LIBRARY"] = not self.options.shared - tc.variables["FCL_USE_X64_SSE"] = False # Let consumer decide to add relevant compile options, fcl doesn't have simd intrinsics - tc.variables["FCL_USE_HOST_NATIVE_ARCH"] = False - tc.variables["FCL_USE_SSE"] = False - tc.variables["FCL_COVERALLS"] = False - tc.variables["FCL_COVERALLS_UPLOAD"] = False - tc.variables["FCL_WITH_OCTOMAP"] = self.options.with_octomap + tc.cache_variables["FCL_ENABLE_PROFILING"] = False + tc.cache_variables["FCL_TREAT_WARNINGS_AS_ERRORS"] = False + tc.cache_variables["FCL_HIDE_ALL_SYMBOLS"] = False + tc.cache_variables["FCL_STATIC_LIBRARY"] = not self.options.shared + tc.cache_variables["FCL_USE_X64_SSE"] = False # Let consumer decide to add relevant compile options, fcl doesn't have simd intrinsics + tc.cache_variables["FCL_USE_HOST_NATIVE_ARCH"] = False + tc.cache_variables["FCL_USE_SSE"] = False + tc.cache_variables["FCL_COVERALLS"] = False + tc.cache_variables["FCL_COVERALLS_UPLOAD"] = False + tc.cache_variables["FCL_WITH_OCTOMAP"] = self.options.with_octomap if self.options.with_octomap: - octomap_version_str = self.dependencies["octomap"].ref.version - tc.variables["OCTOMAP_VERSION"] = octomap_version_str + octomap_version_str = str(self.dependencies["octomap"].ref.version) + tc.cache_variables["OCTOMAP_VERSION"] = octomap_version_str octomap_version = Version(octomap_version_str) - tc.variables["OCTOMAP_MAJOR_VERSION"] = octomap_version.major - tc.variables["OCTOMAP_MINOR_VERSION"] = octomap_version.minor - tc.variables["OCTOMAP_PATCH_VERSION"] = octomap_version.patch - tc.variables["BUILD_TESTING"] = False - tc.variables["FCL_NO_DEFAULT_RPATH"] = False + tc.cache_variables["OCTOMAP_MAJOR_VERSION"] = str(octomap_version.major) + tc.cache_variables["OCTOMAP_MINOR_VERSION"] = str(octomap_version.minor) + tc.cache_variables["OCTOMAP_PATCH_VERSION"] = str(octomap_version.patch) + tc.cache_variables["BUILD_TESTING"] = False + tc.cache_variables["FCL_NO_DEFAULT_RPATH"] = False tc.generate() cd = CMakeDeps(self) @@ -114,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", "fcl") @@ -132,11 +132,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_package/test_package.cpp b/recipes/fcl/all/test_package/test_package.cpp index 0f0651d6aa60c..7142e516a4b32 100644 --- a/recipes/fcl/all/test_package/test_package.cpp +++ b/recipes/fcl/all/test_package/test_package.cpp @@ -1,78 +1,15 @@ -/* -From test_broadphase_dynamic_AABB_tree.cpp test in FCL test directory -*/ - -#include "fcl/common/types.h" -#include "fcl/geometry/shape/sphere.h" -#include "fcl/broadphase/broadphase_dynamic_AABB_tree.h" +#include #include -#include +#include int main() { - auto sphere0 = std::make_shared(0.1); - auto sphere1 = std::make_shared(0.2); - fcl::CollisionObjectd object0(sphere0); - fcl::CollisionObjectd object1(sphere1); - const fcl::Vector3d position0(0.1, 0.2, 0.3); - const fcl::Vector3d position1(0.11, 0.21, 0.31); - - // We will use `objects` to check the order of the two collision objects in - // our callback function. - // - // We use std::vector that contains *pointers* to CollisionObjectd, - // instead of std::vector that contains CollisionObjectd's. - // Previously we used std::vector, and it failed the - // Eigen alignment assertion on Win32. We also tried, without success, the - // custom allocator: - // std::vector>, - // but some platforms failed to build. - std::vector objects = {&object0, &object1}; - std::vector positions = {&position0, &position1}; - - fcl::DynamicAABBTreeCollisionManager dynamic_tree; - for (int i = 0; i < static_cast(objects.size()); ++i) { - objects[i]->setTranslation(*positions[i]); - objects[i]->computeAABB(); - dynamic_tree.registerObject(objects[i]); - } - - // Pack the data for callback function. - struct CallBackData { - bool expect_object0_then_object1; - std::vector* objects; - } data; - data.expect_object0_then_object1 = false; - data.objects = &objects; - - // This callback function tests the order of the two collision objects from - // the dynamic tree against the `data`. We assume that the first two - // parameters are always objects[0] and objects[1] in two possible orders, - // so we can safely ignore the second parameter. We do not use the last - // double& parameter, which specifies the distance beyond which the - // pair of objects will be skipped. - auto distance_callback = [](fcl::CollisionObjectd* a, fcl::CollisionObjectd*, - void* callback_data, double&) -> bool { - // Unpack the data. - auto data = static_cast(callback_data); - const std::vector& objects = *(data->objects); - const bool object0_first = a == objects[0]; - // EXPECT_EQ(data->expect_object0_then_object1, object0_first); - // TODO(DamrongGuoy): Remove the statement below when we solve the - // repeatability problem as mentioned in: - // https://github.com/flexible-collision-library/fcl/issues/368 - // Expect to switch the order next time. - data->expect_object0_then_object1 = !data->expect_object0_then_object1; - // Return true to stop the tree traversal. - return true; - }; - // We repeat update() and distance() many times. Each time, in the - // callback function, we check the order of the two objects. - for (int count = 0; count < 8; ++count) { - dynamic_tree.update(); - dynamic_tree.distance(&data, distance_callback); - } - - return 0; + using namespace fcl; + std::shared_ptr> box_geometry_1(new Box()); + std::shared_ptr> box_geometry_2(new Box()); + CollisionObject box_object_1(box_geometry_1); + CollisionObject box_object_2(box_geometry_2); + DistanceRequest request; + DistanceResult result; + std::cout << "Distance: " << distance(&box_object_1, &box_object_2, request, result) << std::endl; } 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/fernandovelcic-hexdump/all/conanfile.py b/recipes/fernandovelcic-hexdump/all/conanfile.py index 0f297f7cfa6c3..5497ae1f74ccd 100644 --- a/recipes/fernandovelcic-hexdump/all/conanfile.py +++ b/recipes/fernandovelcic-hexdump/all/conanfile.py @@ -1,24 +1,46 @@ -from conans import ConanFile, tools +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 + +required_conan_version = ">=1.52.0" + class FernandoVelcicHexdumpConan(ConanFile): name = "fernandovelcic-hexdump" description = "A header-only hexdump library." license = ["BSD-3-Clause"] - topics = ("hexadecimal", "hexdump", "inspection", "debug") - homepage = "https://github.com/FernandoVelcic/hexdump" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/FernandoVelcic/hexdump" + topics = ("hexadecimal", "hexdump", "inspection", "debug", "header-only") + + package_type = "header-library" + 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.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 package(self): - self.copy(pattern="COPYING", dst="licenses", src=self._source_subfolder) - self.copy(pattern="hexdump.hpp", dst="include", src=self._source_subfolder) + copy(self, pattern="COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, pattern="hexdump.hpp", dst=os.path.join(self.package_folder, "include"), src=self.source_folder) - def package_id(self): - self.info.header_only() + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/fernandovelcic-hexdump/all/test_package/CMakeLists.txt b/recipes/fernandovelcic-hexdump/all/test_package/CMakeLists.txt index 5e81affac8e80..3d3b2a5ec56bc 100644 --- a/recipes/fernandovelcic-hexdump/all/test_package/CMakeLists.txt +++ b/recipes/fernandovelcic-hexdump/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.15) +project(test_package LANGUAGES CXX) find_package(fernandovelcic-hexdump CONFIG REQUIRED) diff --git a/recipes/fernandovelcic-hexdump/all/test_package/conanfile.py b/recipes/fernandovelcic-hexdump/all/test_package/conanfile.py index 84ee68733e516..ef5d7042163ec 100644 --- a/recipes/fernandovelcic-hexdump/all/test_package/conanfile.py +++ b/recipes/fernandovelcic-hexdump/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.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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/fernandovelcic-hexdump/all/test_package/test_package.cpp b/recipes/fernandovelcic-hexdump/all/test_package/test_package.cpp index d9f8d0c243fcc..878b57bcdb438 100644 --- a/recipes/fernandovelcic-hexdump/all/test_package/test_package.cpp +++ b/recipes/fernandovelcic-hexdump/all/test_package/test_package.cpp @@ -29,6 +29,6 @@ int main(int argc, char **argv) testCustomHexdumpBase(); testCustomHexdumpBase(); testCustomHexdumpBase(); - + return 0; } diff --git a/recipes/fernandovelcic-hexdump/all/test_v1_package/CMakeLists.txt b/recipes/fernandovelcic-hexdump/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/fernandovelcic-hexdump/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/fernandovelcic-hexdump/all/test_v1_package/conanfile.py b/recipes/fernandovelcic-hexdump/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..84ee68733e516 --- /dev/null +++ b/recipes/fernandovelcic-hexdump/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.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/fff/all/conanfile.py b/recipes/fff/all/conanfile.py index b4367b0a79cab..04306861f2e25 100644 --- a/recipes/fff/all/conanfile.py +++ b/recipes/fff/all/conanfile.py @@ -1,26 +1,46 @@ -from conans import ConanFile, tools import os -class TypeSafe(ConanFile): - name = 'fff' - description = 'A testing micro framework for creating function test doubles' - url = 'https://github.com/conan-io/conan-center-index' - homepage = 'https://github.com/meekrosoft/fff' - license = 'MIT' - topics = 'conan', 'c', 'c++', 'embedded', 'tdd', 'micro-framework', 'fake-functions' +from conan import ConanFile +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout +required_conan_version = ">=1.52.0" + + +class FffConan(ConanFile): + name = "fff" + description = "A testing micro framework for creating function test doubles" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/meekrosoft/fff" + topics = ("c", "c++", "embedded", "tdd", "micro-framework", "fake-functions", "header-only") + 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 package(self): - self.copy("LICENSE*", dst="licenses", src=self._source_subfolder) - self.copy("fff.h", dst="include", src=self._source_subfolder) + copy( + self, + "LICENSE", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder, + ) + copy( + self, + "fff.h", + dst=os.path.join(self.package_folder, "include"), + src=self.source_folder, + ) - def package_id(self): - self.info.header_only() + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/fff/all/test_package/CMakeLists.txt b/recipes/fff/all/test_package/CMakeLists.txt index 196188113685c..7547d9c0590d3 100644 --- a/recipes/fff/all/test_package/CMakeLists.txt +++ b/recipes/fff/all/test_package/CMakeLists.txt @@ -1,8 +1,8 @@ -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() +find_package(fff REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE fff::fff) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/fff/all/test_package/conanfile.py b/recipes/fff/all/test_package/conanfile.py index bd7165a553cf4..ef5d7042163ec 100644 --- a/recipes/fff/all/test_package/conanfile.py +++ b/recipes/fff/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/fff/all/test_package/test_package.cpp b/recipes/fff/all/test_package/test_package.cpp index 80fdb032c8ac4..fabe3f8985bb5 100644 --- a/recipes/fff/all/test_package/test_package.cpp +++ b/recipes/fff/all/test_package/test_package.cpp @@ -1,16 +1,16 @@ -#include -#include "fff.h" +#include + +#include DEFINE_FFF_GLOBALS; FAKE_VOID_FUNC(TestFunction, uint32_t, uint8_t); -int main() -{ - RESET_FAKE(TestFunction); - FFF_RESET_HISTORY(); - - TestFunction(8, 16); - - return 0; +int main() { + RESET_FAKE(TestFunction); + FFF_RESET_HISTORY(); + + TestFunction(8, 16); + + return 0; } diff --git a/recipes/ffmpeg/all/conandata.yml b/recipes/ffmpeg/all/conandata.yml index 13f029f130a72..0c31b9c82f58e 100644 --- a/recipes/ffmpeg/all/conandata.yml +++ b/recipes/ffmpeg/all/conandata.yml @@ -1,16 +1,62 @@ sources: - "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" - "4.3.2": - url: "https://ffmpeg.org/releases/ffmpeg-4.3.2.tar.bz2" - sha256: "ab3a6d6a70358ba0a5f67f37f91f6656b7302b02e98e5b8c846c16763c99913a" - "4.2.1": - url: "https://ffmpeg.org/releases/ffmpeg-4.2.1.tar.bz2" - sha256: "682a9fa3f6864d7f0dbf224f86b129e337bc60286e0d00dffcd710998d521624" + "7.0.1": + url: "https://ffmpeg.org//releases/ffmpeg-7.0.1.tar.bz2" + sha256: "5e77e84b6434d656106fafe3bceccc77176449014f3eba24d33db3fbd0939dc9" + "6.1.1": + url: "http://ffmpeg.org/releases/ffmpeg-6.1.1.tar.bz2" + sha256: "5e3133939a61ef64ac9b47ffd29a5ea6e337a4023ef0ad972094b4da844e3a20" + "6.1": + url: "http://ffmpeg.org/releases/ffmpeg-6.1.tar.bz2" + sha256: "eb7da3de7dd3ce48a9946ab447a7346bd11a3a85e6efb8f2c2ce637e7f547611" + "6.0.1": + url: "http://ffmpeg.org/releases/ffmpeg-6.0.1.tar.bz2" + sha256: "2c6e294569d1ba8e99cbf1acbe49e060a23454228a540a0f45d679d72ec69a06" + "5.1.3": + url: "https://ffmpeg.org/releases/ffmpeg-5.1.3.tar.bz2" + sha256: "5d5bef6a11f0c500588f9870ec965a30acc0d54d8b1e535da6554a32902d236d" + "5.0.3": + url: "https://ffmpeg.org/releases/ffmpeg-5.0.3.tar.bz2" + sha256: "664e8fa8ac4cc5dce03277f022798461998d9bb8d96b9e1859b24e74511229fd" + "4.4.4": + url: "https://ffmpeg.org/releases/ffmpeg-4.4.4.tar.bz2" + sha256: "47b1fbf70a2c090d9c0fae5910da11c6406ca92408bb69d8c935cd46c622c7ce" +patches: + "5.1.3": + - patch_file: "patches/5.1-0001-fix-libsvtav1-compressed_ten_bit_format.patch" + patch_description: "Compatibility with libsvtav1 > 1.2.0" + patch_type: "portability" + patch_source: "https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/031f1561cd286596cdb374da32f8aa816ce3b135" + - patch_file: "patches/5.1-0002-fix-libsvtav1-vbv_bufsize-1.patch" + patch_description: "Compatibility with libsvtav1 > 1.2.0" + patch_type: "portability" + patch_source: "https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/1c6fd7d756afe0f8b7df14dbf7a95df275f8f5ee" + - patch_file: "patches/5.1-0003-fix-libsvtav1-vbv_bufsize-2.patch" + patch_description: "Compatibility with libsvtav1 > 1.2.0" + patch_type: "portability" + patch_source: "https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/96748ac54f998ba6fe22802799c16b4eba8d4ccc" + - patch_file: "patches/5.0-0001-fix-hwcontext_vulkan.patch" + patch_description: "Compatibility with vulkan >= 1.3.239" + patch_type: "portability" + patch_source: "https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/eb0455d64690eed0068e5cb202f72ecdf899837c" + - patch_file: "patches/5.1-0004-fix-binutils.patch" + patch_description: "Compatibility with binutils >= 2.41" + patch_type: "portability" + patch_source: "https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/effadce6c756247ea8bae32dc13bb3e6f464f0eb" + "5.0.3": + - patch_file: "patches/5.0-0001-fix-hwcontext_vulkan.patch" + patch_description: "Compatibility with vulkan >= 1.3.239" + patch_type: "portability" + patch_source: "https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/eb0455d64690eed0068e5cb202f72ecdf899837c" + - patch_file: "patches/5.1-0004-fix-binutils.patch" + patch_description: "Compatibility with binutils >= 2.41" + patch_type: "portability" + patch_source: "https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/effadce6c756247ea8bae32dc13bb3e6f464f0eb" + "4.4.4": + - patch_file: "patches/4.4-0001-fix-aom_codec_av1_dx_algo.patch" + patch_description: "Compatibility with shared libaom" + patch_type: "portability" + patch_source: "https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/d92fdc714496d43234733c315894abe0beeb3529" + - patch_file: "patches/5.1-0004-fix-binutils.patch" + patch_description: "Compatibility with binutils >= 2.41" + patch_type: "portability" + patch_source: "https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/effadce6c756247ea8bae32dc13bb3e6f464f0eb" \ No newline at end of file diff --git a/recipes/ffmpeg/all/conanfile.py b/recipes/ffmpeg/all/conanfile.py index c66437da011ce..3867ed6aa0b52 100644 --- a/recipes/ffmpeg/all/conanfile.py +++ b/recipes/ffmpeg/all/conanfile.py @@ -1,17 +1,22 @@ -from conan import ConanFile +from conan import ConanFile, conan_version 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.env import Environment, VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import ( + apply_conandata_patches, chdir, copy, export_conandata_patches, get, rename, + replace_in_file, rm, rmdir, save, load +) +from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain, PkgConfigDeps +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 -from conans import AutoToolsBuildEnvironment, tools import os -import contextlib import glob import shutil import re -required_conan_version = ">=1.51.3" +required_conan_version = ">=1.57.0" class FFMpegConan(ConanFile): @@ -21,9 +26,9 @@ class FFMpegConan(ConanFile): # https://github.com/FFmpeg/FFmpeg/blob/master/LICENSE.md license = ("LGPL-2.1-or-later", "GPL-2.0-or-later") homepage = "https://ffmpeg.org" - topics = ("ffmpeg", "multimedia", "audio", "video", "encoder", "decoder", "encoding", "decoding", + topics = ("multimedia", "audio", "video", "encoder", "decoder", "encoding", "decoding", "transcoding", "multiplexer", "demultiplexer", "streaming") - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -66,41 +71,48 @@ class FFMpegConan(ConanFile): "with_audiotoolbox": [True, False], "with_videotoolbox": [True, False], "with_programs": [True, False], + "with_libsvtav1": [True, False], + "with_libaom": [True, False], + "with_libdav1d": [True, False], + "with_libdrm": [True, False], + "with_jni": [True, False], + "with_mediacodec": [True, False], + "with_xlib": [True, False], "disable_everything": [True, False], "disable_all_encoders": [True, False], - "disable_encoders": "ANY", - "enable_encoders": "ANY", + "disable_encoders": [None, "ANY"], + "enable_encoders": [None, "ANY"], "disable_all_decoders": [True, False], - "disable_decoders": "ANY", - "enable_decoders": "ANY", + "disable_decoders": [None, "ANY"], + "enable_decoders": [None, "ANY"], "disable_all_hardware_accelerators": [True, False], - "disable_hardware_accelerators": "ANY", - "enable_hardware_accelerators": "ANY", + "disable_hardware_accelerators": [None, "ANY"], + "enable_hardware_accelerators": [None, "ANY"], "disable_all_muxers": [True, False], - "disable_muxers": "ANY", - "enable_muxers": "ANY", + "disable_muxers": [None, "ANY"], + "enable_muxers": [None, "ANY"], "disable_all_demuxers": [True, False], - "disable_demuxers": "ANY", - "enable_demuxers": "ANY", + "disable_demuxers": [None, "ANY"], + "enable_demuxers": [None, "ANY"], "disable_all_parsers": [True, False], - "disable_parsers": "ANY", - "enable_parsers": "ANY", + "disable_parsers": [None, "ANY"], + "enable_parsers": [None, "ANY"], "disable_all_bitstream_filters": [True, False], - "disable_bitstream_filters": "ANY", - "enable_bitstream_filters": "ANY", + "disable_bitstream_filters": [None, "ANY"], + "enable_bitstream_filters": [None, "ANY"], "disable_all_protocols": [True, False], - "disable_protocols": "ANY", - "enable_protocols": "ANY", + "disable_protocols": [None, "ANY"], + "enable_protocols": [None, "ANY"], "disable_all_devices": [True, False], "disable_all_input_devices": [True, False], - "disable_input_devices": "ANY", - "enable_input_devices": "ANY", + "disable_input_devices": [None, "ANY"], + "enable_input_devices": [None, "ANY"], "disable_all_output_devices": [True, False], - "disable_output_devices": "ANY", - "enable_output_devices": "ANY", + "disable_output_devices": [None, "ANY"], + "enable_output_devices": [None, "ANY"], "disable_all_filters": [True, False], - "disable_filters": "ANY", - "enable_filters": "ANY", + "disable_filters": [None, "ANY"], + "enable_filters": [None, "ANY"], } default_options = { "shared": False, @@ -135,7 +147,7 @@ class FFMpegConan(ConanFile): "with_pulse": True, "with_vaapi": True, "with_vdpau": True, - "with_vulkan": True, + "with_vulkan": False, "with_xcb": True, "with_appkit": True, "with_avfoundation": True, @@ -143,6 +155,13 @@ class FFMpegConan(ConanFile): "with_audiotoolbox": True, "with_videotoolbox": True, "with_programs": True, + "with_libsvtav1": True, + "with_libaom": True, + "with_libdav1d": True, + "with_libdrm": False, + "with_jni": False, + "with_mediacodec": False, + "with_xlib": True, "disable_everything": False, "disable_all_encoders": False, "disable_encoders": None, @@ -180,17 +199,6 @@ class FFMpegConan(ConanFile): "enable_filters": None, } - generators = "pkg_config" - _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) @@ -222,18 +230,32 @@ def _dependencies(self): "with_xcb": ["avdevice"], "with_pulse": ["avdevice"], "with_sdl": ["with_programs"], + "with_libsvtav1": ["avcodec"], + "with_libaom": ["avcodec"], + "with_libdav1d": ["avcodec"], + "with_mediacodec": ["with_jni"], + "with_xlib": ["avdevice"], } + @property + def _version_supports_libsvtav1(self): + return Version(self.version) >= "5.1.0" + + def export_sources(self): + export_conandata_patches(self) + def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - if not self.settings.os in ["Linux", "FreeBSD"]: + if self.settings.os not in ["Linux", "FreeBSD"]: del self.options.with_vaapi del self.options.with_vdpau del self.options.with_vulkan del self.options.with_xcb del self.options.with_libalsa del self.options.with_pulse + del self.options.with_xlib + del self.options.with_libdrm if self.settings.os != "Macos": del self.options.with_appkit if self.settings.os not in ["Macos", "iOS", "tvOS"]: @@ -242,55 +264,63 @@ def config_options(self): del self.options.with_videotoolbox if not is_apple_os(self): del self.options.with_avfoundation - if not self._version_supports_vulkan(): - del self.options.with_vulkan + if not self.settings.os == "Android": + del self.options.with_jni + del self.options.with_mediacodec + if not self._version_supports_libsvtav1: + self.options.rm_safe("with_libsvtav1") + if self.settings.os == "Android": + del self.options.with_libfdk_aac 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.13") + self.requires("zlib/[>=1.2.11 <2]") 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.5") if self.options.with_libiconv: self.requires("libiconv/1.17") if self.options.with_freetype: - self.requires("freetype/2.12.1") + self.requires("freetype/2.13.2") if self.options.with_openjpeg: - self.requires("openjpeg/2.5.0") + self.requires("openjpeg/2.5.2") if self.options.with_openh264: - self.requires("openh264/2.1.1") + self.requires("openh264/2.4.1") if self.options.with_vorbis: self.requires("vorbis/1.3.7") if self.options.with_opus: - self.requires("opus/1.3.1") + self.requires("opus/1.4") if self.options.with_zeromq: - self.requires("zeromq/4.3.4") + self.requires("zeromq/4.3.5") if self.options.with_sdl: - self.requires("sdl/2.24.1") + self.requires("sdl/2.28.5") if self.options.with_libx264: - self.requires("libx264/cci.20220602") + self.requires("libx264/cci.20240224") if self.options.with_libx265: self.requires("libx265/3.4") if self.options.with_libvpx: - self.requires("libvpx/1.11.0") + self.requires("libvpx/1.14.1") if self.options.with_libmp3lame: self.requires("libmp3lame/3.100") - if self.options.with_libfdk_aac: - self.requires("libfdk_aac/2.0.2") + if self.options.get_safe("with_libfdk_aac"): + self.requires("libfdk_aac/2.0.3") if self.options.with_libwebp: - self.requires("libwebp/1.2.4") + self.requires("libwebp/1.3.2") if self.options.with_ssl == "openssl": - self.requires("openssl/1.1.1s") + self.requires("openssl/[>=1.1 <4]") 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"): + self.requires("libalsa/1.2.10") + if self.options.get_safe("with_xcb") or self.options.get_safe("with_xlib"): self.requires("xorg/system") if self.options.get_safe("with_pulse"): self.requires("pulseaudio/14.2") @@ -298,8 +328,16 @@ def requirements(self): self.requires("vaapi/system") 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.231.1") + if self.options.get_safe("with_vulkan"): + self.requires("vulkan-loader/1.3.243.0") + if self.options.get_safe("with_libsvtav1"): + self.requires("libsvtav1/2.1.0") + if self.options.with_libaom: + self.requires("libaom-av1/3.6.1") + if self.options.get_safe("with_libdav1d"): + self.requires("dav1d/1.4.3") + if self.options.get_safe("with_libdrm"): + self.requires("libdrm/2.4.119") def validate(self): if self.options.with_ssl == "securetransport" and not is_apple_os(self): @@ -316,81 +354,125 @@ def validate(self): raise ConanInvalidConfiguration("FFmpeg '{}' option requires '{}' option to be enabled".format( dependency, "' or '".join(features))) + if Version(self.version) >= "6.1" and conan_version.major == 1 and is_msvc(self) and self.options.shared: + # Linking fails with "Argument list too long" for some reason on Conan v1 + raise ConanInvalidConfiguration("MSVC shared build is not supported for Conan v1") + + if Version(self.version) == "7.0.1" and self.settings.build_type == "Debug": + # FIXME: FFMpeg fails to build in Debug mode with the following error: + # ld: libavcodec/libavcodec.a(vvcdsp_init.o): in function `ff_vvc_put_pixels2_8_sse4': + # src/libavcodec/x86/vvc/vvcdsp_init.c:69: undefined reference to `ff_h2656_put_pixels2_8_sse4' + # May be related https://github.com/ffvvc/FFmpeg/issues/234 + raise ConanInvalidConfiguration(f"{self.ref} Conan recipe does not support build_type=Debug. Contributions are welcome to fix this issue.") + def build_requirements(self): if self.settings.arch in ("x86", "x86_64"): - self.build_requires("yasm/1.3.0") - 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") + if Version(self.version) >= "7.0": + # INFO: FFmpeg 7.0+ added avcodec vvc_mc.asm which fails to assemble with yasm 1.3.0 + # src/libavcodec/x86/vvc/vvc_mc.asm:55: error: operand 1: expression is not simple or relocatable + self.tool_requires("nasm/2.16.01") + else: + self.tool_requires("yasm/1.3.0") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/2.1.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): - 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 _target_arch(self): - 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, - ) - target_arch = triplet.split("-")[0] - return target_arch + # Taken from acceptable values https://github.com/FFmpeg/FFmpeg/blob/0684e58886881a998f1a7b510d73600ff1df2b90/configure#L5010 + if str(self.settings.arch).startswith("armv8"): + return "aarch64" + elif self.settings.arch == "x86": + return "i686" + return str(self.settings.arch) @property def _target_os(self): - if self._is_msvc: - return "win32" - else: - 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, - ) - target_os = triplet.split("-")[2] - if target_os == "gnueabihf": - target_os = "gnu" # could also be "linux" - if target_os.startswith("android"): - target_os = "android" - return target_os + if self.settings.os == "Windows": + return "mingw32" if self.settings.compiler == "gcc" else "win32" + elif is_apple_os(self): + return "darwin" + + # Taken from https://github.com/FFmpeg/FFmpeg/blob/0684e58886881a998f1a7b510d73600ff1df2b90/configure#L5485 + # This is the map of Conan OS settings to FFmpeg acceptable values + return { + "AIX": "aix", + "Android": "android", + "FreeBSD": "freebsd", + "Linux": "linux", + "Neutrino": "qnx", + "SunOS": "sunos", + }.get(str(self.settings.os), "none") def _patch_sources(self): - if self._is_msvc and self.options.with_libx264 and not self.options["libx264"].shared: + apply_conandata_patches(self) + if Version(self.version) < "5.1": # 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 - tools.replace_in_file(os.path.join(self._source_subfolder, "libavcodec", "libx264.c"), + replace_in_file(self, os.path.join(self.source_folder, "libavcodec", "libx264.c"), "#define X264_API_IMPORTS 1", "") if self.options.with_ssl == "openssl": # https://trac.ffmpeg.org/ticket/5675 - openssl_libraries = " ".join( - ["-l%s" % lib for lib in self.deps_cpp_info["openssl"].libs]) - tools.replace_in_file(os.path.join(self._source_subfolder, "configure"), + openssl_libs = load(self, os.path.join(self.build_folder, "openssl_libs.list")) + replace_in_file(self, os.path.join(self.source_folder, "configure"), "check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||", - "check_lib openssl openssl/ssl.h OPENSSL_init_ssl %s || " % openssl_libraries) - - @contextlib.contextmanager - def _build_context(self): - with tools.environment_append({"PKG_CONFIG_PATH": tools.unix_path(self.build_folder)}): - if self._is_msvc: - with tools.vcvars(self): - yield - else: - yield + f"check_lib openssl openssl/ssl.h OPENSSL_init_ssl {openssl_libs} || ") - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment( - self, win_bash=tools.os_info.is_windows) - self._autotools.libs = [] + replace_in_file(self, os.path.join(self.source_folder, "configure"), "echo libx264.lib", "echo x264.lib") - def opt_enable_disable( - what, v): return "--{}-{}".format("enable" if v else "disable", what) + @property + def _default_compilers(self): + if self.settings.compiler == "gcc": + return {"cc": "gcc", "cxx": "g++"} + elif self.settings.compiler in ["clang", "apple-clang"]: + return {"cc": "clang", "cxx": "clang++"} + elif is_msvc(self): + return {"cc": "cl.exe", "cxx": "cl.exe"} + return {} + + def _create_toolchain(self): + tc = AutotoolsToolchain(self) + # Custom configure script of ffmpeg understands: + # --prefix, --bindir, --datadir, --docdir, --incdir, --libdir, --mandir + # Options --datadir, --docdir, --incdir, and --mandir are not injected by AutotoolsToolchain but their default value + # in ffmpeg script matches expected conan install layout. + # Several options injected by AutotoolsToolchain are unknown from this configure script and must be pruned. + # This must be done before modifying tc.configure_args, because update_configre_args currently removes + # duplicate configuration keys, even when they have different values, such as list of encoder flags. + # See https://github.com/conan-io/conan-center-index/issues/17140 for further information. + tc.update_configure_args({ + "--sbindir": None, + "--includedir": None, + "--oldincludedir": None, + "--datarootdir": None, + "--build": None, + "--host": None, + "--target": None, + }) + return tc + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") + + def opt_enable_disable(what, v): + return "--{}-{}".format("enable" if v else "disable", what) def opt_append_disable_if_set(args, what, v): if v: - args.append("--disable-{}".format(what)) + args.append(f"--disable-{what}") + + tc = self._create_toolchain() args = [ "--pkg-config-flags=--static", @@ -425,39 +507,36 @@ def opt_append_disable_if_set(args, what, v): opt_enable_disable("libx265", self.options.with_libx265), opt_enable_disable("libvpx", self.options.with_libvpx), opt_enable_disable("libmp3lame", self.options.with_libmp3lame), - opt_enable_disable("libfdk-aac", self.options.with_libfdk_aac), + opt_enable_disable("libfdk-aac", self.options.get_safe("with_libfdk_aac")), opt_enable_disable("libwebp", self.options.with_libwebp), + opt_enable_disable("libaom", self.options.with_libaom), opt_enable_disable("openssl", self.options.with_ssl == "openssl"), opt_enable_disable("alsa", self.options.get_safe("with_libalsa")), - opt_enable_disable( - "libpulse", self.options.get_safe("with_pulse")), + opt_enable_disable("libpulse", self.options.get_safe("with_pulse")), opt_enable_disable("vaapi", self.options.get_safe("with_vaapi")), + opt_enable_disable("libdrm", self.options.get_safe("with_libdrm")), opt_enable_disable("vdpau", self.options.get_safe("with_vdpau")), opt_enable_disable("libxcb", self.options.get_safe("with_xcb")), - opt_enable_disable( - "libxcb-shm", self.options.get_safe("with_xcb")), - opt_enable_disable( - "libxcb-shape", self.options.get_safe("with_xcb")), - opt_enable_disable( - "libxcb-xfixes", self.options.get_safe("with_xcb")), + opt_enable_disable("libxcb-shm", self.options.get_safe("with_xcb")), + opt_enable_disable("libxcb-shape", self.options.get_safe("with_xcb")), + opt_enable_disable("libxcb-xfixes", self.options.get_safe("with_xcb")), opt_enable_disable("appkit", self.options.get_safe("with_appkit")), - opt_enable_disable( - "avfoundation", self.options.get_safe("with_avfoundation")), - opt_enable_disable( - "coreimage", self.options.get_safe("with_coreimage")), - opt_enable_disable( - "audiotoolbox", self.options.get_safe("with_audiotoolbox")), - opt_enable_disable( - "videotoolbox", self.options.get_safe("with_videotoolbox")), - opt_enable_disable("securetransport", - self.options.with_ssl == "securetransport"), + opt_enable_disable("avfoundation", self.options.get_safe("with_avfoundation")), + opt_enable_disable("coreimage", self.options.get_safe("with_coreimage")), + opt_enable_disable("audiotoolbox", self.options.get_safe("with_audiotoolbox")), + opt_enable_disable("videotoolbox", self.options.get_safe("with_videotoolbox")), + opt_enable_disable("securetransport", self.options.with_ssl == "securetransport"), + opt_enable_disable("vulkan", self.options.get_safe("with_vulkan")), + opt_enable_disable("libdav1d", self.options.get_safe("with_libdav1d")), + opt_enable_disable("jni", self.options.get_safe("with_jni")), + opt_enable_disable("mediacodec", self.options.get_safe("with_mediacodec")), + opt_enable_disable("xlib", self.options.get_safe("with_xlib")), "--disable-cuda", # FIXME: CUDA support "--disable-cuvid", # FIXME: CUVID support # Licenses - opt_enable_disable("nonfree", self.options.with_libfdk_aac or (self.options.with_ssl and ( + opt_enable_disable("nonfree", self.options.get_safe("with_libfdk_aac") or (self.options.with_ssl and ( self.options.with_libx264 or self.options.with_libx265 or self.options.postproc))), - opt_enable_disable( - "gpl", self.options.with_libx264 or self.options.with_libx265 or self.options.postproc) + opt_enable_disable("gpl", self.options.with_libx264 or self.options.with_libx265 or self.options.postproc) ] # Individual Component Options @@ -520,13 +599,12 @@ def opt_append_disable_if_set(args, what, v): args.extend(self._split_and_format_options_string( "disable-filter", self.options.disable_filters)) - if self._version_supports_vulkan(): - args.append(opt_enable_disable( - "vulkan", self.options.get_safe("with_vulkan"))) + if self._version_supports_libsvtav1: + args.append(opt_enable_disable("libsvtav1", self.options.get_safe("with_libsvtav1"))) if is_apple_os(self): # relocatable shared libs args.append("--install-name-dir=@rpath") - args.append("--arch={}".format(self._target_arch)) + args.append(f"--arch={self._target_arch}") if self.settings.build_type == "Debug": args.extend([ "--disable-optimizations", @@ -537,55 +615,102 @@ 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 - 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"))) - extra_cflags = [] - extra_ldflags = [] - 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( - self.settings.os, self.settings.os.version)) - if self._is_msvc: - args.append("--pkg-config={}".format(tools.get_env("PKG_CONFIG"))) + compilers_from_conf = self.conf.get("tools.build:compiler_executables", default={}, check_type=dict) + buildenv_vars = VirtualBuildEnv(self).vars() + nm = buildenv_vars.get("NM") + if nm: + args.append(f"--nm={unix_path(self, nm)}") + ar = buildenv_vars.get("AR") + if ar: + args.append(f"--ar={unix_path(self, ar)}") + if self.options.with_asm: + asm = compilers_from_conf.get("asm", buildenv_vars.get("AS")) + if asm: + args.append(f"--as={unix_path(self, asm)}") + strip = buildenv_vars.get("STRIP") + if strip: + args.append(f"--strip={unix_path(self, strip)}") + cc = compilers_from_conf.get("c", buildenv_vars.get("CC", self._default_compilers.get("cc"))) + if cc: + args.append(f"--cc={unix_path(self, cc)}") + cxx = compilers_from_conf.get("cpp", buildenv_vars.get("CXX", self._default_compilers.get("cxx"))) + if cxx: + args.append(f"--cxx={unix_path(self, cxx)}") + ld = buildenv_vars.get("LD") + if ld: + args.append(f"--ld={unix_path(self, ld)}") + ranlib = buildenv_vars.get("RANLIB") + if ranlib: + args.append(f"--ranlib={unix_path(self, ranlib)}") + # for some reason pkgconf from conan can't find .pc files on Linux in the context of ffmpeg configure... + if self._settings_build.os != "Linux": + pkg_config = self.conf.get("tools.gnu:pkg_config", default=buildenv_vars.get("PKG_CONFIG"), check_type=str) + if pkg_config: + args.append(f"--pkg-config={unix_path(self, pkg_config)}") + if is_msvc(self): args.append("--toolchain=msvc") - if self.settings.compiler == "Visual Studio" and tools.Version(self.settings.compiler.version) <= "12": + if not check_min_vs(self, "190", raise_invalid=False): # Visual Studio 2013 (and earlier) doesn't support "inline" keyword for C (only for C++) - self._autotools.defines.append("inline=__inline") + tc.extra_defines.append("inline=__inline") + if self.settings.compiler == "apple-clang" and Version(self.settings.compiler.version) >= "15": + # Workaround for link error "ld: building exports trie: duplicate symbol '_av_ac3_parse_header'" + tc.extra_ldflags.append("-Wl,-ld_classic") if cross_building(self): - if self._target_os == "emscripten": - args.append("--target-os=none") - else: - args.append("--target-os={}".format(self._target_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( - ["-arch {}".format(apple_arch), "-isysroot {}".format(xcrun.sdk_path)]) - extra_ldflags.extend( - ["-arch {}".format(apple_arch), "-isysroot {}".format(xcrun.sdk_path)]) + args.append(f"--target-os={self._target_os}") + if is_apple_os(self) and self.options.with_audiotoolbox: + args.append("--disable-outdev=audiotoolbox") + + if tc.cflags: + args.append("--extra-cflags={}".format(" ".join(tc.cflags))) + if tc.ldflags: + args.append("--extra-ldflags={}".format(" ".join(tc.ldflags))) + tc.configure_args.extend(args) + tc.generate() + + 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"-LIBPATH:{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() - args.append("--extra-cflags={}".format(" ".join(extra_cflags))) - args.append("--extra-ldflags={}".format(" ".join(extra_ldflags))) + deps = PkgConfigDeps(self) + deps.generate() - self._autotools.configure( - args=args, configure_dir=self._source_subfolder, build=False, host=False, target=False) - return self._autotools + if self.options.with_ssl == "openssl": + openssl_libs = " ".join([f"-l{lib}" for lib in self.dependencies["openssl"].cpp_info.aggregated_components().libs]) + save(self, os.path.join(self.build_folder, "openssl_libs.list"), openssl_libs) def _split_and_format_options_string(self, flag_name, options_list): if not options_list: return [] def _format_options_list_item(flag_name, options_item): - return "--{}={}".format(flag_name, options_item) + return f"--{flag_name}={options_item}" def _split_options_string(options_string): return list(filter(None, "".join(options_string.split()).split(","))) @@ -595,50 +720,48 @@ def _split_options_string(options_string): def build(self): self._patch_sources() - tools.replace_in_file(os.path.join(self._source_subfolder, "configure"), - "echo libx264.lib", "echo x264.lib") if self.options.with_libx264: - shutil.copy("x264.pc", "libx264.pc") - with self._build_context(): - autotools = self._configure_autotools() - autotools.make() + # ffmepg expects libx264.pc instead of x264.pc + with chdir(self, self.generators_folder): + shutil.copy("x264.pc", "libx264.pc") + autotools = Autotools(self) + autotools.configure() + autotools.make() def package(self): - self.copy("LICENSE.md", dst="licenses", src=self._source_subfolder) - with self._build_context(): - autotools = self._configure_autotools() - autotools.install() - + copy(self, "LICENSE.md", 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")) - - if self._is_msvc: + if is_msvc(self): if self.options.shared: # ffmpeg created `.lib` files in the `/bin` folder for fn in os.listdir(os.path.join(self.package_folder, "bin")): if fn.endswith(".lib"): rename(self, os.path.join(self.package_folder, "bin", fn), os.path.join(self.package_folder, "lib", fn)) - tools.remove_files_by_mask(os.path.join( - self.package_folder, "lib"), "*.def") + rm(self, "*.def", os.path.join(self.package_folder, "lib")) else: # ffmpeg produces `.a` files that are actually `.lib` files - with tools.chdir(os.path.join(self.package_folder, "lib")): + with chdir(self, os.path.join(self.package_folder, "lib")): for lib in glob.glob("*.a"): rename(self, lib, lib[3:-2] + ".lib") def _read_component_version(self, component_name): - version_file_name = os.path.join(self.package_folder, - "include", "lib%s" % component_name, - "version.h") - version_file = open(version_file_name, "r") - pattern = "define LIB%s_VERSION_(MAJOR|MINOR|MICRO)[ \t]+(\\d+)" % ( - component_name.upper()) + # since 5.1, major version may be defined in version_major.h instead of version.h + component_folder = os.path.join(self.package_folder, "include", f"lib{component_name}") + version_file_name = os.path.join(component_folder, "version.h") + version_major_file_name = os.path.join(component_folder, "version_major.h") + pattern = f"define LIB{component_name.upper()}_VERSION_(MAJOR|MINOR|MICRO)[ \t]+(\\d+)" version = dict() - for line in version_file: - match = re.search(pattern, line) - if match: - version[match[1]] = match[2] + for file in (version_file_name, version_major_file_name): + if os.path.isfile(file): + with open(file, "r", encoding="utf-8") as f: + for line in f: + match = re.search(pattern, line) + if match: + version[match[1]] = match[2] if "MAJOR" in version and "MINOR" in version and "MICRO" in version: return f"{version['MAJOR']}.{version['MINOR']}.{version['MICRO']}" return None @@ -646,268 +769,168 @@ def _read_component_version(self, component_name): def _set_component_version(self, component_name): version = self._read_component_version(component_name) if version is not None: + self.cpp_info.components[component_name].set_property("component_version", version) + # TODO: to remove once support of conan v1 dropped self.cpp_info.components[component_name].version = version else: - self.output.warn("cannot determine version of " - "lib%s packaged with ffmpeg!" % component_name) + self.output.warning(f"cannot determine version of lib{component_name} packaged with ffmpeg!") def package_info(self): if self.options.with_programs: if self.options.with_sdl: - self.cpp_info.components["programs"].requires = [ - "sdl::libsdl2"] - + self.cpp_info.components["programs"].requires = ["sdl::libsdl2"] + + def _add_component(name, dependencies): + component = self.cpp_info.components[name] + component.set_property("pkg_config_name", f"lib{name}") + self._set_component_version(name) + component.libs = [name] + if name != "avutil": + component.requires = ["avutil"] + for dep in dependencies: + if self.options.get_safe(dep): + component.requires.append(dep) + if self.settings.os in ("FreeBSD", "Linux"): + component.system_libs.append("m") + return component + + avutil = _add_component("avutil", []) if self.options.avdevice: - self.cpp_info.components["avdevice"].set_property( - "pkg_config_name", "libavdevice") - self.cpp_info.components["avdevice"].libs = ["avdevice"] - self.cpp_info.components["avdevice"].requires = ["avutil"] - if self.options.avfilter: - self.cpp_info.components["avdevice"].requires.append( - "avfilter") - if self.options.swscale: - self.cpp_info.components["avdevice"].requires.append("swscale") - if self.options.avformat: - self.cpp_info.components["avdevice"].requires.append( - "avformat") - if self.options.avcodec: - self.cpp_info.components["avdevice"].requires.append("avcodec") - if self.options.swresample: - self.cpp_info.components["avdevice"].requires.append( - "swresample") - if self.options.postproc: - self.cpp_info.components["avdevice"].requires.append( - "postproc") - self._set_component_version("avdevice") - + avdevice = _add_component("avdevice", ["avfilter", "swscale", "avformat", "avcodec", "swresample", "postproc"]) if self.options.avfilter: - self.cpp_info.components["avfilter"].set_property( - "pkg_config_name", "libavfilter") - self.cpp_info.components["avfilter"].libs = ["avfilter"] - self.cpp_info.components["avfilter"].requires = ["avutil"] - if self.options.swscale: - self.cpp_info.components["avfilter"].requires.append("swscale") - if self.options.avformat: - self.cpp_info.components["avfilter"].requires.append( - "avformat") - if self.options.avcodec: - self.cpp_info.components["avfilter"].requires.append("avcodec") - if self.options.swresample: - self.cpp_info.components["avfilter"].requires.append( - "swresample") - if self.options.postproc: - self.cpp_info.components["avfilter"].requires.append( - "postproc") - self._set_component_version("avfilter") - + avfilter = _add_component("avfilter", ["swscale", "avformat", "avcodec", "swresample", "postproc"]) if self.options.avformat: - self.cpp_info.components["avformat"].set_property( - "pkg_config_name", "libavformat") - self.cpp_info.components["avformat"].libs = ["avformat"] - self.cpp_info.components["avformat"].requires = ["avutil"] - if self.options.avcodec: - self.cpp_info.components["avformat"].requires.append("avcodec") - if self.options.swresample: - self.cpp_info.components["avformat"].requires.append( - "swresample") - self._set_component_version("avformat") - + avformat = _add_component("avformat", ["avcodec", "swscale"]) if self.options.avcodec: - self.cpp_info.components["avcodec"].set_property( - "pkg_config_name", "libavcodec") - self.cpp_info.components["avcodec"].libs = ["avcodec"] - self.cpp_info.components["avcodec"].requires = ["avutil"] - if self.options.swresample: - self.cpp_info.components["avcodec"].requires.append( - "swresample") - self._set_component_version("avcodec") - + avcodec = _add_component("avcodec", ["swresample"]) if self.options.swscale: - self.cpp_info.components["swscale"].set_property( - "pkg_config_name", "libswscale") - self.cpp_info.components["swscale"].libs = ["swscale"] - self.cpp_info.components["swscale"].requires = ["avutil"] - self._set_component_version("swscale") - + _add_component("swscale", []) if self.options.swresample: - self.cpp_info.components["swresample"].set_property( - "pkg_config_name", "libswresample") - self.cpp_info.components["swresample"].libs = ["swresample"] - self.cpp_info.components["swresample"].requires = ["avutil"] - self._set_component_version("swresample") - + _add_component("swresample", []) if self.options.postproc: - self.cpp_info.components["postproc"].set_property( - "pkg_config_name", "libpostproc") - self.cpp_info.components["postproc"].libs = ["postproc"] - self.cpp_info.components["postproc"].requires = ["avutil"] - self._set_component_version("postproc") - - self.cpp_info.components["avutil"].set_property( - "pkg_config_name", "libavutil") - self.cpp_info.components["avutil"].libs = ["avutil"] - self._set_component_version("avutil") + _add_component("postproc", []) if self.settings.os in ("FreeBSD", "Linux"): - self.cpp_info.components["avutil"].system_libs = [ - "pthread", "m", "dl"] - if self.options.swresample: - self.cpp_info.components["swresample"].system_libs = ["m"] - if self.options.swscale: - self.cpp_info.components["swscale"].system_libs = ["m"] - if self.options.postproc: - self.cpp_info.components["postproc"].system_libs = ["m"] + avutil.system_libs.extend(["pthread", "dl"]) if self.options.get_safe("fPIC"): if self.settings.compiler in ("gcc", "clang"): # https://trac.ffmpeg.org/ticket/1713 # https://ffmpeg.org/platform.html#Advanced-linking-configuration # https://ffmpeg.org/pipermail/libav-user/2014-December/007719.html - self.cpp_info.components["avcodec"].exelinkflags.append( - "-Wl,-Bsymbolic") - self.cpp_info.components["avcodec"].sharedlinkflags.append( - "-Wl,-Bsymbolic") - if self.options.avformat: - self.cpp_info.components["avformat"].system_libs = ["m"] + avcodec.exelinkflags.append("-Wl,-Bsymbolic") + avcodec.sharedlinkflags.append("-Wl,-Bsymbolic") if self.options.avfilter: - self.cpp_info.components["avfilter"].system_libs = [ - "m", "pthread"] - if self.options.avdevice: - self.cpp_info.components["avdevice"].system_libs = ["m"] + avfilter.system_libs.append("pthread") elif self.settings.os == "Windows": if self.options.avcodec: - self.cpp_info.components["avcodec"].system_libs = [ - "Mfplat", "Mfuuid", "strmiids"] + 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"] + avdevice.system_libs = ["ole32", "psapi", "strmiids", "uuid", "oleaut32", "shlwapi", "gdi32", "vfw32"] + avutil.system_libs = ["user32", "bcrypt"] + avformat.system_libs = ["secur32"] elif is_apple_os(self): if self.options.avdevice: - self.cpp_info.components["avdevice"].frameworks = [ - "CoreFoundation", "Foundation", "CoreGraphics"] + avdevice.frameworks = ["CoreFoundation", "Foundation", "CoreGraphics"] if self.options.avfilter: - self.cpp_info.components["avfilter"].frameworks = [ - "CoreGraphics"] + avfilter.frameworks = ["CoreGraphics"] if self.options.avcodec: - self.cpp_info.components["avcodec"].frameworks = [ - "CoreFoundation", "CoreVideo", "CoreMedia"] + avcodec.frameworks = ["CoreFoundation", "CoreVideo", "CoreMedia"] if self.settings.os == "Macos": if self.options.avdevice: - self.cpp_info.components["avdevice"].frameworks.append( - "OpenGL") + avdevice.frameworks.append("OpenGL") if self.options.avfilter: - self.cpp_info.components["avfilter"].frameworks.append( - "OpenGL") + avfilter.frameworks.append("OpenGL") if self.options.avdevice: if self.options.get_safe("with_libalsa"): - self.cpp_info.components["avdevice"].requires.append( - "libalsa::libalsa") + avdevice.requires.append("libalsa::libalsa") if self.options.get_safe("with_xcb"): - self.cpp_info.components["avdevice"].requires.append( - "xorg::xcb") + avdevice.requires.extend(["xorg::xcb", "xorg::xcb-shm", "xorg::xcb-xfixes", "xorg::xcb-shape", "xorg::xv", "xorg::xext"]) + if self.options.get_safe("with_xlib"): + avdevice.requires.extend(["xorg::x11", "xorg::xext", "xorg::xv"]) if self.options.get_safe("with_pulse"): - self.cpp_info.components["avdevice"].requires.append( - "pulseaudio::pulseaudio") + avdevice.requires.append("pulseaudio::pulseaudio") if self.options.get_safe("with_appkit"): - self.cpp_info.components["avdevice"].frameworks.append( - "AppKit") + avdevice.frameworks.append("AppKit") if self.options.get_safe("with_avfoundation"): - self.cpp_info.components["avdevice"].frameworks.append( - "AVFoundation") + avdevice.frameworks.append("AVFoundation") if self.options.get_safe("with_audiotoolbox"): - self.cpp_info.components["avdevice"].frameworks.append( - "CoreAudio") + avdevice.frameworks.append("CoreAudio") + if self.settings.os == "Android" and not self.options.shared: + avdevice.system_libs.extend(["android", "camera2ndk", "mediandk"]) if self.options.avcodec: if self.options.with_zlib: - self.cpp_info.components["avcodec"].requires.append( - "zlib::zlib") + avcodec.requires.append("zlib::zlib") if self.options.with_lzma: - self.cpp_info.components["avcodec"].requires.append( - "xz_utils::xz_utils") + avcodec.requires.append("xz_utils::xz_utils") if self.options.with_libiconv: - self.cpp_info.components["avcodec"].requires.append( - "libiconv::libiconv") + avcodec.requires.append("libiconv::libiconv") if self.options.with_openjpeg: - self.cpp_info.components["avcodec"].requires.append( - "openjpeg::openjpeg") + avcodec.requires.append("openjpeg::openjpeg") if self.options.with_openh264: - self.cpp_info.components["avcodec"].requires.append( - "openh264::openh264") + avcodec.requires.append("openh264::openh264") if self.options.with_vorbis: - self.cpp_info.components["avcodec"].requires.append( - "vorbis::vorbis") + avcodec.requires.append("vorbis::vorbis") if self.options.with_opus: - self.cpp_info.components["avcodec"].requires.append( - "opus::opus") + avcodec.requires.append("opus::opus") if self.options.with_libx264: - self.cpp_info.components["avcodec"].requires.append( - "libx264::libx264") + avcodec.requires.append("libx264::libx264") if self.options.with_libx265: - self.cpp_info.components["avcodec"].requires.append( - "libx265::libx265") + avcodec.requires.append("libx265::libx265") if self.options.with_libvpx: - self.cpp_info.components["avcodec"].requires.append( - "libvpx::libvpx") + avcodec.requires.append("libvpx::libvpx") if self.options.with_libmp3lame: - self.cpp_info.components["avcodec"].requires.append( - "libmp3lame::libmp3lame") - if self.options.with_libfdk_aac: - self.cpp_info.components["avcodec"].requires.append( - "libfdk_aac::libfdk_aac") + avcodec.requires.append("libmp3lame::libmp3lame") + if self.options.get_safe("with_libfdk_aac"): + avcodec.requires.append("libfdk_aac::libfdk_aac") if self.options.with_libwebp: - self.cpp_info.components["avcodec"].requires.append( - "libwebp::libwebp") + avcodec.requires.append("libwebp::libwebp") if self.options.get_safe("with_audiotoolbox"): - self.cpp_info.components["avcodec"].frameworks.append( - "AudioToolbox") + avcodec.frameworks.append("AudioToolbox") if self.options.get_safe("with_videotoolbox"): - self.cpp_info.components["avcodec"].frameworks.append( - "VideoToolbox") + avcodec.frameworks.append("VideoToolbox") + if self.options.get_safe("with_libsvtav1"): + avcodec.requires.extend(["libsvtav1::decoder", "libsvtav1::encoder"]) + if self.options.get_safe("with_libaom"): + avcodec.requires.append("libaom-av1::libaom-av1") + if self.options.get_safe("with_libdav1d"): + avcodec.requires.append("dav1d::dav1d") if self.options.avformat: if self.options.with_bzip2: - self.cpp_info.components["avformat"].requires.append( - "bzip2::bzip2") + avformat.requires.append("bzip2::bzip2") if self.options.with_zeromq: - self.cpp_info.components["avformat"].requires.append( - "zeromq::libzmq") + avformat.requires.append("zeromq::libzmq") if self.options.with_ssl == "openssl": - self.cpp_info.components["avformat"].requires.append( - "openssl::ssl") + avformat.requires.append("openssl::ssl") elif self.options.with_ssl == "securetransport": - self.cpp_info.components["avformat"].frameworks.append( - "Security") + avformat.frameworks.append("Security") if self.options.avfilter: if self.options.with_freetype: - self.cpp_info.components["avfilter"].requires.append( - "freetype::freetype") + avfilter.requires.append("freetype::freetype") if self.options.with_zeromq: - self.cpp_info.components["avfilter"].requires.append( - "zeromq::libzmq") + avfilter.requires.append("zeromq::libzmq") if self.options.get_safe("with_appkit"): - self.cpp_info.components["avfilter"].frameworks.append( - "AppKit") + avfilter.frameworks.append("AppKit") if self.options.get_safe("with_coreimage"): - self.cpp_info.components["avfilter"].frameworks.append( - "CoreImage") + avfilter.frameworks.append("CoreImage") if Version(self.version) >= "5.0" and is_apple_os(self): - self.cpp_info.components["avfilter"].frameworks.append("Metal") + avfilter.frameworks.append("Metal") + if self.options.get_safe("with_libdrm"): + avutil.requires.append("libdrm::libdrm_libdrm") if self.options.get_safe("with_vaapi"): - self.cpp_info.components["avutil"].requires.extend( - ["vaapi::vaapi", "xorg::x11"]) + avutil.requires.append("vaapi::vaapi") + if self.options.get_safe("with_xcb"): + avutil.requires.append("xorg::x11") if self.options.get_safe("with_vdpau"): - self.cpp_info.components["avutil"].requires.append("vdpau::vdpau") + avutil.requires.append("vdpau::vdpau") - if self._version_supports_vulkan() and self.options.get_safe("with_vulkan"): - self.cpp_info.components["avutil"].requires.append( - "vulkan-loader::vulkan-loader") + if self.options.with_ssl == "openssl": + avutil.requires.append("openssl::ssl") - def _version_supports_vulkan(self): - return Version(self.version) >= "4.3.0" + if self.options.get_safe("with_vulkan"): + avutil.requires.append("vulkan-loader::vulkan-loader") diff --git a/recipes/ffmpeg/all/patches/4.4-0001-fix-aom_codec_av1_dx_algo.patch b/recipes/ffmpeg/all/patches/4.4-0001-fix-aom_codec_av1_dx_algo.patch new file mode 100644 index 0000000000000..5855404e33592 --- /dev/null +++ b/recipes/ffmpeg/all/patches/4.4-0001-fix-aom_codec_av1_dx_algo.patch @@ -0,0 +1,11 @@ +--- a/libavcodec/libaomdec.c ++++ b/libavcodec/libaomdec.c +@@ -224,7 +224,7 @@ static av_cold int aom_free(AVCodecContext *avctx) + + static av_cold int av1_init(AVCodecContext *avctx) + { +- return aom_init(avctx, &aom_codec_av1_dx_algo); ++ return aom_init(avctx, aom_codec_av1_dx()); + } + + AVCodec ff_libaom_av1_decoder = { diff --git a/recipes/ffmpeg/all/patches/5.0-0001-fix-hwcontext_vulkan.patch b/recipes/ffmpeg/all/patches/5.0-0001-fix-hwcontext_vulkan.patch new file mode 100644 index 0000000000000..344b5c89fcdec --- /dev/null +++ b/recipes/ffmpeg/all/patches/5.0-0001-fix-hwcontext_vulkan.patch @@ -0,0 +1,17 @@ +--- a/libavutil/hwcontext_vulkan.c ++++ b/libavutil/hwcontext_vulkan.c +@@ -354,14 +354,6 @@ static const VulkanOptExtension optional_device_exts[] = { + { VK_KHR_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME, FF_VK_EXT_EXTERNAL_WIN32_MEMORY }, + { VK_KHR_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_NAME, FF_VK_EXT_EXTERNAL_WIN32_SEM }, + #endif +- +- /* Video encoding/decoding */ +- { VK_KHR_VIDEO_QUEUE_EXTENSION_NAME, FF_VK_EXT_NO_FLAG }, +- { VK_KHR_VIDEO_DECODE_QUEUE_EXTENSION_NAME, FF_VK_EXT_NO_FLAG }, +- { VK_KHR_VIDEO_ENCODE_QUEUE_EXTENSION_NAME, FF_VK_EXT_NO_FLAG }, +- { VK_EXT_VIDEO_ENCODE_H264_EXTENSION_NAME, FF_VK_EXT_NO_FLAG }, +- { VK_EXT_VIDEO_DECODE_H264_EXTENSION_NAME, FF_VK_EXT_NO_FLAG }, +- { VK_EXT_VIDEO_DECODE_H265_EXTENSION_NAME, FF_VK_EXT_NO_FLAG }, + }; + + /* Converts return values to strings */ diff --git a/recipes/ffmpeg/all/patches/5.1-0001-fix-libsvtav1-compressed_ten_bit_format.patch b/recipes/ffmpeg/all/patches/5.1-0001-fix-libsvtav1-compressed_ten_bit_format.patch new file mode 100644 index 0000000000000..f60f6d44f6e9d --- /dev/null +++ b/recipes/ffmpeg/all/patches/5.1-0001-fix-libsvtav1-compressed_ten_bit_format.patch @@ -0,0 +1,22 @@ +--- a/libavcodec/libsvtav1.c ++++ b/libavcodec/libsvtav1.c +@@ -124,16 +124,12 @@ static int svt_print_error(void *log_ctx, EbErrorType err, + + static int alloc_buffer(EbSvtAv1EncConfiguration *config, SvtContext *svt_enc) + { +- const int pack_mode_10bit = +- (config->encoder_bit_depth > 8) && (config->compressed_ten_bit_format == 0) ? 1 : 0; +- const size_t luma_size_8bit = +- config->source_width * config->source_height * (1 << pack_mode_10bit); +- const size_t luma_size_10bit = +- (config->encoder_bit_depth > 8 && pack_mode_10bit == 0) ? luma_size_8bit : 0; ++ const size_t luma_size = config->source_width * config->source_height * ++ (config->encoder_bit_depth > 8 ? 2 : 1); + + EbSvtIOFormat *in_data; + +- svt_enc->raw_size = (luma_size_8bit + luma_size_10bit) * 3 / 2; ++ svt_enc->raw_size = luma_size * 3 / 2; + + // allocate buffer for in and out + svt_enc->in_buf = av_mallocz(sizeof(*svt_enc->in_buf)); diff --git a/recipes/ffmpeg/all/patches/5.1-0002-fix-libsvtav1-vbv_bufsize-1.patch b/recipes/ffmpeg/all/patches/5.1-0002-fix-libsvtav1-vbv_bufsize-1.patch new file mode 100644 index 0000000000000..9df9fbb5d685c --- /dev/null +++ b/recipes/ffmpeg/all/patches/5.1-0002-fix-libsvtav1-vbv_bufsize-1.patch @@ -0,0 +1,20 @@ +--- a/libavcodec/libsvtav1.c ++++ b/libavcodec/libsvtav1.c +@@ -179,7 +179,7 @@ static int config_enc_params(EbSvtAv1EncConfiguration *param, + param->min_qp_allowed = avctx->qmin; + } + param->max_bit_rate = avctx->rc_max_rate; +- param->vbv_bufsize = avctx->rc_buffer_size; ++ param->maximum_buffer_size_ms = avctx->rc_buffer_size * 1000LL / avctx->bit_rate; + + if (svt_enc->crf > 0) { + param->qp = svt_enc->crf; +@@ -296,7 +296,7 @@ static int config_enc_params(EbSvtAv1EncConfiguration *param, + avctx->bit_rate = param->rate_control_mode > 0 ? + param->target_bit_rate : 0; + avctx->rc_max_rate = param->max_bit_rate; +- avctx->rc_buffer_size = param->vbv_bufsize; ++ avctx->rc_buffer_size = param->maximum_buffer_size_ms * avctx->bit_rate / 1000LL; + + if (avctx->bit_rate || avctx->rc_max_rate || avctx->rc_buffer_size) { + AVCPBProperties *cpb_props = ff_add_cpb_side_data(avctx); diff --git a/recipes/ffmpeg/all/patches/5.1-0003-fix-libsvtav1-vbv_bufsize-2.patch b/recipes/ffmpeg/all/patches/5.1-0003-fix-libsvtav1-vbv_bufsize-2.patch new file mode 100644 index 0000000000000..6bf52193253d7 --- /dev/null +++ b/recipes/ffmpeg/all/patches/5.1-0003-fix-libsvtav1-vbv_bufsize-2.patch @@ -0,0 +1,12 @@ +--- a/libavcodec/libsvtav1.c ++++ b/libavcodec/libsvtav1.c +@@ -179,7 +179,8 @@ static int config_enc_params(EbSvtAv1EncConfiguration *param, + param->min_qp_allowed = avctx->qmin; + } + param->max_bit_rate = avctx->rc_max_rate; +- param->maximum_buffer_size_ms = avctx->rc_buffer_size * 1000LL / avctx->bit_rate; ++ if (avctx->bit_rate && avctx->rc_buffer_size) ++ param->maximum_buffer_size_ms = avctx->rc_buffer_size * 1000LL / avctx->bit_rate; + + if (svt_enc->crf > 0) { + param->qp = svt_enc->crf; diff --git a/recipes/ffmpeg/all/patches/5.1-0004-fix-binutils.patch b/recipes/ffmpeg/all/patches/5.1-0004-fix-binutils.patch new file mode 100644 index 0000000000000..53a596d0ee7d4 --- /dev/null +++ b/recipes/ffmpeg/all/patches/5.1-0004-fix-binutils.patch @@ -0,0 +1,73 @@ +From effadce6c756247ea8bae32dc13bb3e6f464f0eb Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?R=C3=A9mi=20Denis-Courmont?= +Date: Sun, 16 Jul 2023 18:18:02 +0300 +Subject: [PATCH] avcodec/x86/mathops: clip constants used with shift + instructions within inline assembly + +Fixes assembling with binutil as >= 2.41 + +Signed-off-by: James Almer +--- + libavcodec/x86/mathops.h | 26 +++++++++++++++++++++++--- + 1 file changed, 23 insertions(+), 3 deletions(-) + +diff --git a/libavcodec/x86/mathops.h b/libavcodec/x86/mathops.h +index 6298f5ed1983b..ca7e2dffc1076 100644 +--- a/libavcodec/x86/mathops.h ++++ b/libavcodec/x86/mathops.h +@@ -35,12 +35,20 @@ + static av_always_inline av_const int MULL(int a, int b, unsigned shift) + { + int rt, dummy; ++ if (__builtin_constant_p(shift)) + __asm__ ( + "imull %3 \n\t" + "shrdl %4, %%edx, %%eax \n\t" + :"=a"(rt), "=d"(dummy) +- :"a"(a), "rm"(b), "ci"((uint8_t)shift) ++ :"a"(a), "rm"(b), "i"(shift & 0x1F) + ); ++ else ++ __asm__ ( ++ "imull %3 \n\t" ++ "shrdl %4, %%edx, %%eax \n\t" ++ :"=a"(rt), "=d"(dummy) ++ :"a"(a), "rm"(b), "c"((uint8_t)shift) ++ ); + return rt; + } + +@@ -113,19 +121,31 @@ __asm__ volatile(\ + // avoid +32 for shift optimization (gcc should do that ...) + #define NEG_SSR32 NEG_SSR32 + static inline int32_t NEG_SSR32( int32_t a, int8_t s){ ++ if (__builtin_constant_p(s)) + __asm__ ("sarl %1, %0\n\t" + : "+r" (a) +- : "ic" ((uint8_t)(-s)) ++ : "i" (-s & 0x1F) + ); ++ else ++ __asm__ ("sarl %1, %0\n\t" ++ : "+r" (a) ++ : "c" ((uint8_t)(-s)) ++ ); + return a; + } + + #define NEG_USR32 NEG_USR32 + static inline uint32_t NEG_USR32(uint32_t a, int8_t s){ ++ if (__builtin_constant_p(s)) + __asm__ ("shrl %1, %0\n\t" + : "+r" (a) +- : "ic" ((uint8_t)(-s)) ++ : "i" (-s & 0x1F) + ); ++ else ++ __asm__ ("shrl %1, %0\n\t" ++ : "+r" (a) ++ : "c" ((uint8_t)(-s)) ++ ); + return a; + } + diff --git a/recipes/ffmpeg/all/test_package/CMakeLists.txt b/recipes/ffmpeg/all/test_package/CMakeLists.txt index d2e36b81236a9..e8b19851e2f49 100644 --- a/recipes/ffmpeg/all/test_package/CMakeLists.txt +++ b/recipes/ffmpeg/all/test_package/CMakeLists.txt @@ -1,38 +1,35 @@ cmake_minimum_required(VERSION 3.1) project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(ffmpeg REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ffmpeg::avutil) +target_link_libraries(${PROJECT_NAME} PRIVATE ffmpeg::avutil) if (TARGET ffmpeg::avdevice) target_compile_definitions(${PROJECT_NAME} PRIVATE HAVE_FFMPEG_AVDEVICE) - target_link_libraries(${PROJECT_NAME} ffmpeg::avdevice) + target_link_libraries(${PROJECT_NAME} PRIVATE ffmpeg::avdevice) endif () if (TARGET ffmpeg::avfilter) target_compile_definitions(${PROJECT_NAME} PRIVATE HAVE_FFMPEG_AVFILTER) - target_link_libraries(${PROJECT_NAME} ffmpeg::avfilter) + target_link_libraries(${PROJECT_NAME} PRIVATE ffmpeg::avfilter) endif () if (TARGET ffmpeg::avformat) target_compile_definitions(${PROJECT_NAME} PRIVATE HAVE_FFMPEG_AVFORMAT) - target_link_libraries(${PROJECT_NAME} ffmpeg::avformat) + target_link_libraries(${PROJECT_NAME} PRIVATE ffmpeg::avformat) endif () if (TARGET ffmpeg::avcodec) target_compile_definitions(${PROJECT_NAME} PRIVATE HAVE_FFMPEG_AVCODEC) - target_link_libraries(${PROJECT_NAME} ffmpeg::avcodec) + target_link_libraries(${PROJECT_NAME} PRIVATE ffmpeg::avcodec) endif () if (TARGET ffmpeg::swscale) target_compile_definitions(${PROJECT_NAME} PRIVATE HAVE_FFMPEG_SWSCALE) - target_link_libraries(${PROJECT_NAME} ffmpeg::swscale) + target_link_libraries(${PROJECT_NAME} PRIVATE ffmpeg::swscale) endif () if (TARGET ffmpeg::swresample) target_compile_definitions(${PROJECT_NAME} PRIVATE HAVE_FFMPEG_SWRESAMPLE) - target_link_libraries(${PROJECT_NAME} ffmpeg::swresample) + target_link_libraries(${PROJECT_NAME} PRIVATE ffmpeg::swresample) endif () if (TARGET ffmpeg::postproc) target_compile_definitions(${PROJECT_NAME} PRIVATE HAVE_FFMPEG_POSTPROC) - target_link_libraries(${PROJECT_NAME} ffmpeg::postproc) + target_link_libraries(${PROJECT_NAME} PRIVATE ffmpeg::postproc) endif () diff --git a/recipes/ffmpeg/all/test_package/conanfile.py b/recipes/ffmpeg/all/test_package/conanfile.py index c7039d41e93dc..98ab55852ad56 100644 --- a/recipes/ffmpeg/all/test_package/conanfile.py +++ b/recipes/ffmpeg/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 = "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,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - if self.options["ffmpeg"].with_programs: - self.run("ffmpeg --help", 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") diff --git a/recipes/ffmpeg/all/test_v1_package/CMakeLists.txt b/recipes/ffmpeg/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/ffmpeg/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/ffmpeg/all/test_v1_package/conanfile.py b/recipes/ffmpeg/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..eab3ab98cce15 --- /dev/null +++ b/recipes/ffmpeg/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): + if self.options["ffmpeg"].with_programs: + self.run("ffmpeg --help", run_environment=True) + + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/ffmpeg/config.yml b/recipes/ffmpeg/config.yml index bd4009285d1b8..024586b060fe7 100644 --- a/recipes/ffmpeg/config.yml +++ b/recipes/ffmpeg/config.yml @@ -1,11 +1,15 @@ versions: - "5.0": + "7.0.1": folder: "all" - "4.4.3": + "6.1.1": folder: "all" - "4.4": + "6.1": folder: "all" - "4.3.2": + "6.0.1": folder: "all" - "4.2.1": + "5.1.3": + folder: "all" + "5.0.3": + folder: "all" + "4.4.4": folder: "all" 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..9e37904841157 100644 --- a/recipes/fftw/all/conandata.yml +++ b/recipes/fftw/all/conandata.yml @@ -1,10 +1,13 @@ sources: + "3.3.10": + url: + - "https://www.fftw.org/fftw-3.3.10.tar.gz" + - "https://fftw.org/fftw-3.3.10.tar.gz" + sha256: "56c932549852cddcfafdab3820b0200c7742675be92179e59e6215b340e26467" "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..48fcc3185c1a8 100644 --- a/recipes/fftw/all/conanfile.py +++ b/recipes/fftw/all/conanfile.py @@ -1,10 +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, 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" + +SINGLE = 'single' +DOUBLE = 'double' +LONGDOUBLE = 'longdouble' +QUAD = 'quad' +ALL = [SINGLE, DOUBLE, LONGDOUBLE, QUAD] class FFTWConan(ConanFile): @@ -15,11 +21,16 @@ 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], "fPIC": [True, False], - "precision": ["double", "single", "longdouble"], + "precision": ALL + ['deprecated'], + 'precision_single': [True, False], + 'precision_double': [True, False], + 'precision_longdouble': [True, False], + 'precision_quad': [True, False], "openmp": [True, False], "threads": [True, False], "combinedthreads": [True, False], @@ -28,7 +39,11 @@ class FFTWConan(ConanFile): default_options = { "shared": False, "fPIC": True, - "precision": "double", + "precision": 'deprecated', + 'precision_single': True, + 'precision_double': True, + 'precision_longdouble': True, + 'precision_quad': False, "openmp": False, "threads": False, "combinedthreads": False, @@ -36,8 +51,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,17 +59,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") if not self.options.threads: del self.options.combinedthreads + if self.options.precision != "deprecated": + self.output.warning("precision options is deprecated! use dedicated options 'precision_single', 'precision_double', 'precision_longdouble' and 'precision_quad' instead") + + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): if self.settings.os == "Windows" and self.options.shared: @@ -64,12 +77,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) @@ -77,66 +86,81 @@ def generate(self): tc.variables["ENABLE_OPENMP"] = self.options.openmp tc.variables["ENABLE_THREADS"] = self.options.threads tc.variables["WITH_COMBINED_THREADS"] = self.options.get_safe("combinedthreads", False) - tc.variables["ENABLE_FLOAT"] = self.options.precision == "single" - tc.variables["ENABLE_LONG_DOUBLE"] = self.options.precision == "longdouble" tc.variables["ENABLE_SSE"] = self.options.simd == "sse" 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() + @property + def _all_precisions(self): + return [p for p in ALL if self.options.get_safe(f"precision_{p}")] + def build(self): + def on_off(value): + return "ON" if value else 'OFF' + apply_conandata_patches(self) - cmake = CMake(self) - cmake.configure() - cmake.build() + for current_precision in self._all_precisions: + cmake = CMake(self) + variables = { + "ENABLE_FLOAT": on_off(current_precision == SINGLE), + "ENABLE_LONG_DOUBLE": on_off(current_precision == LONGDOUBLE), + "ENABLE_QUAD_PRECISION": on_off(current_precision == QUAD) + } + cmake.configure(variables=variables) + cmake.build() + cmake.install() def package(self): copy(self, "COPYRIGHT", 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")) rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): - prec_suffix = self._prec_suffix[str(self.options.precision)] - cmake_config_name = "FFTW3" + prec_suffix - cmake_namespace = "FFTW3" - cmake_target_name = "fftw3" + prec_suffix - pkgconfig_name = "fftw3" + prec_suffix - lib_name = "fftw3" + prec_suffix + cmake_config_name = cmake_namespace = "FFTW3" 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("pkg_config_name", pkgconfig_name) - - # TODO: back to global scope in conan v2 once cmake_find_package_* & pkg_config generators removed - if self.options.openmp: - self.cpp_info.components["fftwlib"].libs.append(lib_name + "_omp") - if self.options.threads and not self.options.combinedthreads: - self.cpp_info.components["fftwlib"].libs.append(lib_name + "_threads") - self.cpp_info.components["fftwlib"].libs.append(lib_name) - if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.components["fftwlib"].system_libs.append("m") - if self.options.threads: - self.cpp_info.components["fftwlib"].system_libs.append("pthread") # TODO: to remove in conan v2 once cmake_find_package_* & pkg_config generators removed self.cpp_info.filenames["cmake_find_package"] = cmake_config_name self.cpp_info.filenames["cmake_find_package_multi"] = cmake_config_name self.cpp_info.names["cmake_find_package"] = cmake_namespace 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("pkg_config_name", pkgconfig_name) + + for precision in self._all_precisions: + prec_suffix = self._prec_suffix[precision] + cmake_target_name = pkgconfig_name = lib_name = "fftw3" + prec_suffix + component_name = f"fftwlib_{precision}" + component = self.cpp_info.components[component_name] + + # TODO: back to global scope in conan v2 once cmake_find_package_* & pkg_config generators removed + if self.options.openmp: + component.libs.append(lib_name + "_omp") + if self.options.threads and not self.options.combinedthreads: + component.libs.append(lib_name + "_threads") + self.cpp_info.components[component_name].libs.append(lib_name) + if self.settings.os in ["Linux", "FreeBSD"]: + component.system_libs.append("m") + if precision == QUAD: + component.system_libs.extend(['quadmath']) + if self.options.threads: + component.system_libs.append("pthread") + self.cpp_info.components[component_name].includedirs.append(os.path.join(self.package_folder, "include")) + + component.names["cmake_find_package"] = cmake_target_name + component.names["cmake_find_package_multi"] = cmake_target_name + component.set_property("cmake_target_name", f"{cmake_namespace}::{cmake_target_name}") + component.set_property("pkg_config_name", pkgconfig_name) + + def package_id(self): + del self.info.options.precision @property def _prec_suffix(self): return { "double": "", "single": "f", - "longdouble": "l" + "longdouble": "l", + 'quad': 'q' } diff --git a/recipes/fftw/all/test_package/CMakeLists.txt b/recipes/fftw/all/test_package/CMakeLists.txt index 3943d935ac8c2..e2445bdf7545e 100644 --- a/recipes/fftw/all/test_package/CMakeLists.txt +++ b/recipes/fftw/all/test_package/CMakeLists.txt @@ -4,21 +4,18 @@ 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) +option(ENABLE_QUAD_PRECISION "Enable FFTW quad precision" OFF) -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() +find_package(FFTW3 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) target_link_libraries(${PROJECT_NAME} $<$:FFTW3::fftw3> $<$:FFTW3::fftw3f> - $<$:FFTW3::fftw3l>) + $<$:FFTW3::fftw3l> + $<$:FFTW3::fftw3q>) target_compile_options(${PROJECT_NAME} PRIVATE $<$:-DENABLE_SINGLE_PRECISION=1> - $<$:-DENABLE_LONG_DOUBLE_PRECISION=1>) + $<$:-DENABLE_LONG_DOUBLE_PRECISION=1> + $<$:-DENABLE_QUAD_PRECISION=1>) diff --git a/recipes/fftw/all/test_package/conanfile.py b/recipes/fftw/all/test_package/conanfile.py index 54a72f37e7a08..bf64344b75e94 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,18 +7,20 @@ 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" - tc.variables["ENABLE_SINGLE_PRECISION"] = self.dependencies["fftw"].options.precision == "single" - tc.variables["ENABLE_LONG_DOUBLE_PRECISION"] = self.dependencies["fftw"].options.precision == "longdouble" + tc.variables["ENABLE_DOUBLE_PRECISION"] = self.dependencies['fftw'].options.precision_double + tc.variables["ENABLE_SINGLE_PRECISION"] = self.dependencies['fftw'].options.precision_single + tc.variables["ENABLE_LONG_DOUBLE_PRECISION"] = self.dependencies['fftw'].options.precision_longdouble + tc.variables["ENABLE_QUAD_PRECISION"] = self.dependencies['fftw'].options.precision_quad tc.generate() def build(self): @@ -27,6 +29,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_package/test_package.c b/recipes/fftw/all/test_package/test_package.c index b098fdf9507b1..41b92c011b487 100644 --- a/recipes/fftw/all/test_package/test_package.c +++ b/recipes/fftw/all/test_package/test_package.c @@ -7,6 +7,9 @@ typedef float real_t; #elif defined(ENABLE_LONG_DOUBLE_PRECISION) typedef long double real_t; #define FFTW_MANGLE(name) FFTW_MANGLE_LONG_DOUBLE(name) +#elif defined(ENABLE_QUAD_PRECISION) +typedef __float128 real_t; +#define FFTW_MANGLE(name) FFTW_MANGLE_QUAD(name) #else typedef double real_t; #define FFTW_MANGLE(name) FFTW_MANGLE_DOUBLE(name) 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..bc42b2f516ea2 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 @@ -9,9 +8,10 @@ class TestPackageConan(ConanFile): def build(self): cmake = CMake(self) - cmake.definitions["ENABLE_DOUBLE_PRECISION"] = self.options["fftw"].precision == "double" - cmake.definitions["ENABLE_SINGLE_PRECISION"] = self.options["fftw"].precision == "single" - cmake.definitions["ENABLE_LONG_DOUBLE_PRECISION"] = self.options["fftw"].precision == "longdouble" + cmake.definitions["ENABLE_DOUBLE_PRECISION"] = self.options["fftw"].precision_double + cmake.definitions["ENABLE_SINGLE_PRECISION"] = self.options["fftw"].precision_single + cmake.definitions["ENABLE_LONG_DOUBLE_PRECISION"] = self.options["fftw"].precision_longdouble + cmake.definitions["ENABLE_QUAD_PRECISION"] = self.options["fftw"].precision_quad cmake.configure() cmake.build() diff --git a/recipes/fftw/config.yml b/recipes/fftw/config.yml index 3d0beaa65b4c9..246a8feb14244 100644 --- a/recipes/fftw/config.yml +++ b/recipes/fftw/config.yml @@ -1,4 +1,6 @@ versions: + "3.3.10": + folder: all "3.3.9": folder: all "3.3.8": diff --git a/recipes/fire-hpp/all/conandata.yml b/recipes/fire-hpp/all/conandata.yml index 0ac5acb1e3d98..e30c0635694c3 100644 --- a/recipes/fire-hpp/all/conandata.yml +++ b/recipes/fire-hpp/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.0": + url: "https://github.com/kongaskristjan/fire-hpp/archive/v1.0.tar.gz" + sha256: "73086d72a785a57bac8833d4f92799e8e769fef1d2ca46399cfbdb82a5c22f84" "0.2": - sha256: 50ac76005e5d45590355a51e5e1b62aba65c56f2003335acce0370da13d77b28 - url: https://github.com/kongaskristjan/fire-hpp/archive/v0.2.tar.gz + url: "https://github.com/kongaskristjan/fire-hpp/archive/v0.2.tar.gz" + sha256: "50ac76005e5d45590355a51e5e1b62aba65c56f2003335acce0370da13d77b28" diff --git a/recipes/fire-hpp/all/conanfile.py b/recipes/fire-hpp/all/conanfile.py index e2770d10a2f50..79b1be52cfefe 100644 --- a/recipes/fire-hpp/all/conanfile.py +++ b/recipes/fire-hpp/all/conanfile.py @@ -1,43 +1,54 @@ -from conans import ConanFile, CMake, tools import os +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 + +required_conan_version = ">=1.52.0" + + class FireHppConan(ConanFile): name = "fire-hpp" - homepage = "https://github.com/kongaskristjan/fire-hpp" - url = "https://github.com/conan-io/conan-center-index" description = "Fire for C++: Create fully functional CLIs using function signatures" - topics = ("command-line", "argument", "parser") license = "BSL-1.0" - no_copy_source = True - settings = "os", "arch", "compiler", "build_type" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/kongaskristjan/fire-hpp" + topics = ("command-line", "argument", "parser", "header-only") - _source_subfolder = "source_subfolder" - _build_subfolder = "build_subfolder" - _cmake = None + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" def configure(self): if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 11) + check_min_cppstd(self, 11) + + def layout(self): + cmake_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 = "{}-{}".format(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["FIRE_EXAMPLES"] = False - self._cmake.definitions["FIRE_UNIT_TESTS"] = False - self._cmake.configure(source_folder=self._source_subfolder, 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["FIRE_EXAMPLES"] = False + tc.variables["FIRE_UNIT_TESTS"] = False + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() def package(self): - cmake = self._configure_cmake() + cmake = CMake(self) cmake.install() - self.copy("LICENCE", dst="licenses", src=self._source_subfolder) - tools.rmdir(os.path.join(self.package_folder, "lib")) + copy(self, "LICENCE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + rmdir(self, os.path.join(self.package_folder, "lib")) - def package_id(self): - self.info.header_only() + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/fire-hpp/all/test_package/CMakeLists.txt b/recipes/fire-hpp/all/test_package/CMakeLists.txt index 520f51ea73d4a..fe3a31529853d 100644 --- a/recipes/fire-hpp/all/test_package/CMakeLists.txt +++ b/recipes/fire-hpp/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - -find_package(fire-hpp REQUIRED) +find_package(fire-hpp REQUIRED CONFIG) add_executable(${CMAKE_PROJECT_NAME} test_package.cpp) target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE fire-hpp::fire-hpp) diff --git a/recipes/fire-hpp/all/test_package/conanfile.py b/recipes/fire-hpp/all/test_package/conanfile.py index b6680c7d91280..1d145d1d569ec 100644 --- a/recipes/fire-hpp/all/test_package/conanfile.py +++ b/recipes/fire-hpp/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" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain" + 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.settings): - bin_path = os.path.join("bin", "test_package") - bin_args = "-x=1 -y=2" - self.run("{} {}".format(bin_path, bin_args), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + self.run(f"{bin_path} -x=1 -y=2", env="conanrun") diff --git a/recipes/fire-hpp/all/test_package/test_package.cpp b/recipes/fire-hpp/all/test_package/test_package.cpp index 614e5b1984d23..39e02ea0720f9 100644 --- a/recipes/fire-hpp/all/test_package/test_package.cpp +++ b/recipes/fire-hpp/all/test_package/test_package.cpp @@ -2,8 +2,8 @@ #include int fired_main(int x = fire::arg("-x"), int y = fire::arg("-y")) { - std::cout << x + y << std::endl; - return 0; + std::cout << x + y << std::endl; + return 0; } FIRE(fired_main) diff --git a/recipes/fire-hpp/config.yml b/recipes/fire-hpp/config.yml index 7e65100e62b2c..14d66964f38cc 100644 --- a/recipes/fire-hpp/config.yml +++ b/recipes/fire-hpp/config.yml @@ -1,3 +1,5 @@ versions: + "1.0": + folder: all "0.2": folder: all diff --git a/recipes/fixed-containers/all/conandata.yml b/recipes/fixed-containers/all/conandata.yml new file mode 100644 index 0000000000000..e2bbaf816f1d4 --- /dev/null +++ b/recipes/fixed-containers/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "cci.20240225": + url: "https://github.com/teslamotors/fixed-containers/archive/095b1bc100903a4c49cbec13842288f57e84b4f3.tar.gz" + sha256: "5d3624cd2c1fdfd1b054b03005804f2b7a2a6c2c114943976821c64b20a94588" diff --git a/recipes/fixed-containers/all/conanfile.py b/recipes/fixed-containers/all/conanfile.py new file mode 100644 index 0000000000000..9729326c0e725 --- /dev/null +++ b/recipes/fixed-containers/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 get, copy +from conan.tools.layout import basic_layout +from conan.tools.scm import Version +import os + +required_conan_version = ">=1.52.0" + +class FixedContainersConan(ConanFile): + name = "fixed-containers" + description = "C++ Fixed Containers" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/teslamotors/fixed-containers/" + topics = ("constexpr", "containers", "compile-time", "header-only") + package_type = "header-library" + 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", + "Visual Studio": "16", + "msvc": "192", + # apple-clang has support std::lexicographical_compare_three_way since 15. + "apple-clang": "15", + } + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("magic_enum/0.9.3", 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 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", "fixed_containers") + self.cpp_info.set_property("cmake_target_name", "fixed_containers::fixed_containers") diff --git a/recipes/fixed-containers/all/test_package/CMakeLists.txt b/recipes/fixed-containers/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..24c19844b253b --- /dev/null +++ b/recipes/fixed-containers/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(fixed_containers) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE fixed_containers::fixed_containers) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) diff --git a/recipes/fixed-containers/all/test_package/conanfile.py b/recipes/fixed-containers/all/test_package/conanfile.py new file mode 100644 index 0000000000000..e845ae751a301 --- /dev/null +++ b/recipes/fixed-containers/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/fixed-containers/all/test_package/test_package.cpp b/recipes/fixed-containers/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..d129e8622b3d9 --- /dev/null +++ b/recipes/fixed-containers/all/test_package/test_package.cpp @@ -0,0 +1,19 @@ +#include "fixed_containers/fixed_vector.hpp" +#include "fixed_containers/enum_utils.hpp" + +int main(void) { + constexpr auto v1 = []() { + fixed_containers::FixedVector v{}; + v.push_back(0); + v.emplace_back(1); + v.push_back(2); + return v; + }(); + static_assert(v1[0] == 0); + static_assert(v1[1] == 1); + static_assert(v1[2] == 2); + static_assert(v1.size() == 3); + static_assert(v1.capacity() == 11); + + return 0; +} diff --git a/recipes/fixed-containers/config.yml b/recipes/fixed-containers/config.yml new file mode 100644 index 0000000000000..5b3feee9a17dd --- /dev/null +++ b/recipes/fixed-containers/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20240225": + folder: all diff --git a/recipes/fixed_math/1.x.x/conandata.yml b/recipes/fixed_math/1.x.x/conandata.yml new file mode 100644 index 0000000000000..3e20dff4a8b77 --- /dev/null +++ b/recipes/fixed_math/1.x.x/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.0.2": + url: "https://github.com/arturbac/fixed_math/archive/refs/tags/v1.0.2.tar.gz" + sha256: "6c87217286e3b93ce5e1fff0bbbb08a9751d04f416cd76ddd5ddd37a8c6772cf" diff --git a/recipes/fixed_math/1.x.x/conanfile.py b/recipes/fixed_math/1.x.x/conanfile.py new file mode 100644 index 0000000000000..aed8cfa5c1d05 --- /dev/null +++ b/recipes/fixed_math/1.x.x/conanfile.py @@ -0,0 +1,143 @@ +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, replace_in_file +from conan.tools.scm import Version +from conan.tools.layout import basic_layout +from conan.tools.env import VirtualBuildEnv +from conan.tools.microsoft import is_msvc +import os + +required_conan_version = ">=1.53.0" + +class FixedMathConan(ConanFile): + name = "fixed_math" + description = "A High-Performance C++17 Library for Fixed-Point 48.16 Arithmetic" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/arturbac/fixed_math/" + topics = ("mathematics", "fixed-point") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "header_only": [True, False], + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "header_only": False, + "shared": False, + "fPIC": True, + } + + @property + def _min_cppstd(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "10", # fixed_math requires __has_builtin + "clang": "7", + "apple-clang": "12", + "Visual Studio": "16", + "msvc": "192", + } + + def config_options(self): + if self.settings.os == "Windows": + self.package_type = "static-library" + del self.options.fPIC + + def configure(self): + if self.settings.os == "Windows": + self.options.rm_safe("shared") + if self.options.header_only: + self.options.rm_safe("shared") + self.options.rm_safe("fPIC") + self.package_type = "header-library" + elif self.options.get_safe("shared"): + 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: + self.info.clear() + + 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." + ) + + def build_requirements(self): + if not self.options.header_only: + self.tool_requires("cmake/[>=3.21 <4]") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + if self.options.header_only: + return + tc = CMakeToolchain(self) + if is_msvc(self): + tc.variables["CMAKE_CXX_FLAGS"] = "/Zc:__cplusplus" + tc.generate() + venv = VirtualBuildEnv(self) + venv.generate(scope="build") + + def build(self): + if not self.options.header_only: + # fix install path (https://github.com/arturbac/fixed_math/issues/8) + replace_in_file(self, os.path.join(self.source_folder, "fixed_lib", "CMakeLists.txt"), + "${CMAKE_INSTALL_INCLUDEDIR}/fixed_math", + "${CMAKE_INSTALL_INCLUDEDIR}/fixedmath") + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENCE", self.source_folder, os.path.join(self.package_folder, "licenses")) + if not self.options.header_only: + cmake = CMake(self) + cmake.install() + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + else: + # fix install path (https://github.com/arturbac/fixed_math/issues/8) + copy( + self, + "*.h", + os.path.join(self.source_folder, "fixed_lib", "include", "fixedmath"), + os.path.join(self.package_folder, "include", "fixedmath"), + ) + copy( + self, + "*.hpp", + os.path.join(self.source_folder, "fixed_lib", "include", "fixedmath"), + os.path.join(self.package_folder, "include", "fixedmath"), + ) + + def package_info(self): + if self.options.header_only: + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + else: + self.cpp_info.libs = ["fixed_math"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") + + self.cpp_info.set_property("cmake_file_name", "fixed_math") + self.cpp_info.set_property("cmake_target_name", "fixed_math::fixed_math") + + if is_msvc(self): + self.cpp_info.cxxflags.append("/Zc:__cplusplus") diff --git a/recipes/fixed_math/1.x.x/test_package/CMakeLists.txt b/recipes/fixed_math/1.x.x/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..d63966d4ccdd2 --- /dev/null +++ b/recipes/fixed_math/1.x.x/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(fixed_math REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE fixed_math::fixed_math) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/fixed_math/1.x.x/test_package/conanfile.py b/recipes/fixed_math/1.x.x/test_package/conanfile.py new file mode 100644 index 0000000000000..ef5d7042163ec --- /dev/null +++ b/recipes/fixed_math/1.x.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_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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/fixed_math/1.x.x/test_package/test_package.cpp b/recipes/fixed_math/1.x.x/test_package/test_package.cpp new file mode 100644 index 0000000000000..9337496e2cbd5 --- /dev/null +++ b/recipes/fixed_math/1.x.x/test_package/test_package.cpp @@ -0,0 +1,39 @@ +#include + +#include "fixedmath/fixed_math.hpp" +#include "fixedmath/iostream.h" + +using fixedmath::fixed_t; +using fixedmath::operator ""_fix; + +//fixed and all functionality is constexpr so You can declare constants see features [1] +inline constexpr fixed_t foo_constant{ fixedmath::tan( 15 * fixedmath::phi/180) }; + +constexpr fixed_t my_function( fixed_t value ) { + using namespace fixedmath; + return foo_constant + sin(value) / (1.41_fix - 2*cos(value) / 4); +} + +int main() { + // converting to/from fixed_t + // construction from other arithmetic types is explicit + fixed_t val { 3.14 }; + + //- there is no implicit assignment from other types + float some_float{val}; + fixed_t some_fixed{some_float}; + + some_fixed = fixed_t{some_float}; + + //- converting to other arithmetic types coud be done with static cast and is explicit + double some_double { static_cast(some_fixed) }; + + // for constant values postfix operator _fix may be used + some_fixed = some_float * 2.45_fix; //operation with float is promoted to fixed_t + some_double = 4.15 * some_fixed; //operation with double is promoted to double + + std::cout << some_fixed << '\n'; + std::cout << some_double << '\n'; + + return 0; +} diff --git a/recipes/fixed_math/all/conandata.yml b/recipes/fixed_math/all/conandata.yml new file mode 100644 index 0000000000000..a7ea4a2ff9968 --- /dev/null +++ b/recipes/fixed_math/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "2.0.0": + url: "https://github.com/arturbac/fixed_math/archive/refs/tags/v2.0.0.tar.gz" + sha256: "a02efd417592f9cb3d21fc39877aba76fe5c37b3e68b11769065202f71242f66" diff --git a/recipes/fixed_math/all/conanfile.py b/recipes/fixed_math/all/conanfile.py new file mode 100644 index 0000000000000..4684b16404cb7 --- /dev/null +++ b/recipes/fixed_math/all/conanfile.py @@ -0,0 +1,78 @@ +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 +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc +import os + +required_conan_version = ">=1.53.0" + +class FixedMathConan(ConanFile): + name = "fixed_math" + description = "A High-Performance C++17 Library for Fixed-Point 48.16 Arithmetic" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/arturbac/fixed_math/" + topics = ("mathematics", "fixed-point", "header-only") + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _min_cppstd(self): + return 23 + + @property + def _compilers_minimum_version(self): + return { + "Visual Studio": "17", + "msvc": "193", + "gcc": "12", + "clang": "15", + "apple-clang": "16", + } + + 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._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, "LICENCE", self.source_folder, os.path.join(self.package_folder, "licenses")) + copy( + self, + "*.h", + os.path.join(self.source_folder, "fixed_lib", "include"), + os.path.join(self.package_folder, "include"), + ) + copy( + self, + "*.hpp", + os.path.join(self.source_folder, "fixed_lib", "include"), + os.path.join(self.package_folder, "include"), + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + self.cpp_info.set_property("cmake_file_name", "fixed_math") + self.cpp_info.set_property("cmake_target_name", "fixed_math::fixed_math") + + if is_msvc(self): + self.cpp_info.cxxflags.append("/Zc:__cplusplus") diff --git a/recipes/fixed_math/all/test_package/CMakeLists.txt b/recipes/fixed_math/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..2b820757c217b --- /dev/null +++ b/recipes/fixed_math/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.20) +project(test_package LANGUAGES CXX) + +find_package(fixed_math REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE fixed_math::fixed_math) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_23) diff --git a/recipes/fixed_math/all/test_package/conanfile.py b/recipes/fixed_math/all/test_package/conanfile.py new file mode 100644 index 0000000000000..ef5d7042163ec --- /dev/null +++ b/recipes/fixed_math/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/fixed_math/all/test_package/test_package.cpp b/recipes/fixed_math/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..7fbb1e6d1d25b --- /dev/null +++ b/recipes/fixed_math/all/test_package/test_package.cpp @@ -0,0 +1,37 @@ +#include + +#include "fixedmath/fixed_math.hpp" +#include "fixedmath/iostream.h" + +using fixedmath::fixed_t; +using fixedmath::operator""_fix; + +// fixed and all functionality is constexpr so You can declare constants see features [1] +inline constexpr fixed_t foo_constant{fixedmath::fobj::tan(15 * fixedmath::phi / 180)}; + +constexpr fixed_t my_function(fixed_t value) { + using namespace fixedmath; + // You can use funcioons or function objects + return foo_constant + fobj::sin(value) / (1.41_fix - 2 * func::cos(value) / 4); +} + +int main() { + // converting to/from fixed_t + // construction from other arithmetic types is explicit + fixed_t val1{3.14}; + fixed_t val2{3u}; + + //- there is no implicit assignment from other types + float some_float{3.14f}; + fixed_t some_fixed; + some_fixed = fixed_t{some_float}; + + //- converting to other arithmetic types coud be done with static cast and is explicit + double some_double(some_fixed); + + // for constant values postfix operator _fix may be used + some_fixed = some_float * 2.45_fix; // operation with float is promoted to fixed_t + some_double = 4.15 * some_fixed; // operation with double is promoted to double + + std::cout << some_double << " " << my_function(some_fixed) << std::endl; +} diff --git a/recipes/fixed_math/config.yml b/recipes/fixed_math/config.yml new file mode 100644 index 0000000000000..3a4c749874ca0 --- /dev/null +++ b/recipes/fixed_math/config.yml @@ -0,0 +1,5 @@ +versions: + "2.0.0": + folder: all + "1.0.2": + folder: 1.x.x diff --git a/recipes/flac/all/conandata.yml b/recipes/flac/all/conandata.yml index b7edb40c63666..da984a86264a9 100644 --- a/recipes/flac/all/conandata.yml +++ b/recipes/flac/all/conandata.yml @@ -1,7 +1,23 @@ sources: + "1.4.3": + url: "https://github.com/xiph/flac/releases/download/1.4.3/flac-1.4.3.tar.xz" + sha256: "6c58e69cd22348f441b861092b825e591d0b822e106de6eb0ee4d05d27205b70" + "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.3": + - patch_file: "patches/1.4.2-002-ignore-dll_export-define.patch" + patch_description: "Ignore autotools-specific DLL_EXPORT define in export.h" + patch_type: "conan" + "1.4.2": + - patch_file: "patches/1.4.2-002-ignore-dll_export-define.patch" + patch_description: "Ignore autotools-specific DLL_EXPORT define in export.h" + 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..12371889671ec 100644 --- a/recipes/flac/all/conanfile.py +++ b/recipes/flac/all/conanfile.py @@ -1,10 +1,12 @@ 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 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, replace_in_file +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 +28,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 +36,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): @@ -55,7 +56,9 @@ def generate(self): tc = CMakeToolchain(self) tc.variables["BUILD_EXAMPLES"] = False tc.variables["BUILD_DOCS"] = False + tc.variables["BUILD_PROGRAMS"] = not is_apple_os(self) or self.settings.os == "Macos" tc.variables["BUILD_TESTING"] = False + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" tc.generate() cd = CMakeDeps(self) cd.generate() @@ -63,8 +66,13 @@ def generate(self): envbuild = VirtualBuildEnv(self) envbuild.generate(scope="build") - def build(self): + def _patch_sources(self): apply_conandata_patches(self) + replace_in_file(self, os.path.join(self.source_folder, "src", "share", "getopt", "CMakeLists.txt"), + "find_package(Intl)", "") + + def build(self): + self._patch_sources() cmake = CMake(self) cmake.configure() cmake.build() @@ -79,6 +87,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") @@ -98,10 +108,9 @@ def package_info(self): self.cpp_info.components["libflac"].system_libs += ["m"] 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 + # 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/1.4.2-002-ignore-dll_export-define.patch b/recipes/flac/all/patches/1.4.2-002-ignore-dll_export-define.patch new file mode 100644 index 0000000000000..0ce0853b69c7e --- /dev/null +++ b/recipes/flac/all/patches/1.4.2-002-ignore-dll_export-define.patch @@ -0,0 +1,22 @@ +--- include/FLAC/export.h ++++ include/FLAC/export.h +@@ -74,7 +74,7 @@ + */ + #if defined(_WIN32) + +-#if defined(FLAC__NO_DLL) && !(defined(DLL_EXPORT)) ++#if defined(FLAC__NO_DLL) + #define FLAC_API + #else + #ifdef FLAC_API_EXPORTS +--- include/FLAC++/export.h ++++ include/FLAC++/export.h +@@ -73,7 +73,7 @@ + * by libtool, must override FLAC__NO_DLL on building shared components + */ + #if defined(_WIN32) +-#if defined(FLAC__NO_DLL) && !(defined(DLL_EXPORT)) ++#if defined(FLAC__NO_DLL) + #define FLACPP_API + #else + #ifdef FLACPP_API_EXPORTS diff --git a/recipes/flac/all/patches/fix-cmake-1.3.3.patch b/recipes/flac/all/patches/fix-cmake-1.3.3.patch new file mode 100644 index 0000000000000..3c5a864e8bbd4 --- /dev/null +++ b/recipes/flac/all/patches/fix-cmake-1.3.3.patch @@ -0,0 +1,48 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -25,9 +25,6 @@ endif() + if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wcast-align -Wshadow -Wwrite-strings -Wctor-dtor-privacy -Wnon-virtual-dtor -Wreorder -Wsign-promo -Wundef") + endif() +-if(CMAKE_C_COMPILER_ID MATCHES "GNU") +- set(CMAKE_EXE_LINKER_FLAGS -no-pie) +-endif() + + include(CMakePackageConfigHelpers) + include(CPack) +@@ -76,7 +73,7 @@ add_compile_options( + $<$,$>:-Wdeclaration-after-statement>) + + if(CMAKE_SYSTEM_PROCESSOR STREQUAL "i686" AND HAVE_STACKREALIGN_FLAG) +- add_compile_options(-mstackrealign) ++ add_compile_options($<$,$>:-mstackrealign>) + endif() + + include_directories("include") +--- a/src/flac/CMakeLists.txt ++++ b/src/flac/CMakeLists.txt +@@ -21,4 +21,4 @@ if(TARGET win_utf8_io) + endif() + + install(TARGETS flacapp EXPORT targets +- RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") ++ DESTINATION "${CMAKE_INSTALL_BINDIR}") +--- a/src/libFLAC/CMakeLists.txt ++++ b/src/libFLAC/CMakeLists.txt +@@ -102,7 +102,7 @@ target_compile_definitions(FLAC + target_include_directories(FLAC INTERFACE + "$" + "$") +-target_link_libraries(FLAC PRIVATE $<$:m>) ++target_link_libraries(FLAC PUBLIC $<$:m>) + if(TARGET Ogg::ogg) + target_link_libraries(FLAC PUBLIC Ogg::ogg) + endif() +--- a/src/metaflac/CMakeLists.txt ++++ b/src/metaflac/CMakeLists.txt +@@ -15,4 +15,4 @@ if(TARGET win_utf8_io) + endif() + + install(TARGETS metaflac EXPORT targets +- RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") ++ DESTINATION "${CMAKE_INSTALL_BINDIR}") diff --git a/recipes/flac/all/patches/fix-cmake.patch b/recipes/flac/all/patches/fix-cmake.patch deleted file mode 100644 index ec7db2f2d00aa..0000000000000 --- a/recipes/flac/all/patches/fix-cmake.patch +++ /dev/null @@ -1,66 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -13,7 +13,7 @@ option(BUILD_EXAMPLES "Build and install examples" ON) - option(WITH_OGG "ogg support (default: test for libogg)" ON) - - if(WITH_OGG) -- find_package(OGG REQUIRED) -+ find_package(Ogg REQUIRED CONFIG) - endif() - - if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang") -@@ -25,9 +25,6 @@ endif() - if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wcast-align -Wshadow -Wwrite-strings -Wctor-dtor-privacy -Wnon-virtual-dtor -Wreorder -Wsign-promo -Wundef") - endif() --if(CMAKE_C_COMPILER_ID MATCHES "GNU") -- set(CMAKE_EXE_LINKER_FLAGS -no-pie) --endif() - - include(CMakePackageConfigHelpers) - include(CPack) -@@ -76,7 +73,7 @@ add_compile_options( - $<$,$>:-Wdeclaration-after-statement>) - - if(CMAKE_SYSTEM_PROCESSOR STREQUAL "i686" AND HAVE_STACKREALIGN_FLAG) -- add_compile_options(-mstackrealign) -+ add_compile_options($<$,$>:-mstackrealign>) - endif() - - include_directories("include") ---- a/src/flac/CMakeLists.txt -+++ b/src/flac/CMakeLists.txt -@@ -21,4 +21,4 @@ if(TARGET win_utf8_io) - endif() - - install(TARGETS flacapp EXPORT targets -- RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") -+ DESTINATION "${CMAKE_INSTALL_BINDIR}") ---- a/src/libFLAC/CMakeLists.txt -+++ b/src/libFLAC/CMakeLists.txt -@@ -102,7 +102,7 @@ target_compile_definitions(FLAC - target_include_directories(FLAC INTERFACE - "$" - "$") --target_link_libraries(FLAC PRIVATE $<$:m>) -+target_link_libraries(FLAC PUBLIC $<$:m>) - if(TARGET Ogg::ogg) - target_link_libraries(FLAC PUBLIC Ogg::ogg) - endif() ---- a/src/metaflac/CMakeLists.txt -+++ b/src/metaflac/CMakeLists.txt -@@ -15,4 +15,4 @@ if(TARGET win_utf8_io) - endif() - - 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,6 +1,5 @@ - check_include_file("string.h" HAVE_STRING_H) - --find_package(Intl) - - add_library(getopt STATIC getopt.c getopt1.c) - diff --git a/recipes/flac/config.yml b/recipes/flac/config.yml index 3abfca40293f6..05362b19fb86b 100644 --- a/recipes/flac/config.yml +++ b/recipes/flac/config.yml @@ -1,3 +1,7 @@ versions: + "1.4.3": + folder: all + "1.4.2": + folder: all "1.3.3": folder: all diff --git a/recipes/flann/all/conandata.yml b/recipes/flann/all/conandata.yml index 820886a139772..7fc1c0b27777d 100644 --- a/recipes/flann/all/conandata.yml +++ b/recipes/flann/all/conandata.yml @@ -1,13 +1,17 @@ sources: "1.9.2": - url: "https://github.com/tkircher/flann/archive/1.9.2.tar.gz" + url: "https://github.com/flann-lib/flann/archive/refs/tags/1.9.2.tar.gz" sha256: "e26829bb0017f317d9cc45ab83ddcb8b16d75ada1ae07157006c1e7d601c8824" "1.9.1": - url: "https://github.com/mariusmuja/flann/archive/1.9.1.tar.gz" + url: "https://github.com/flann-lib/flann/archive/refs/tags/1.9.1.tar.gz" sha256: "b23b5f4e71139faa3bcb39e6bbcc76967fbaf308c4ee9d4f5bfbeceaa76cc5d3" patches: "1.9.2": - - patch_file: "patches/cxx-11-required.patch" - - patch_file: "patches/cmake-lz4.patch" + - patch_file: "patches/1.9.2-0001-cxx-11-required.patch" + - patch_file: "patches/1.9.2-0002-cmake-lz4.patch" "1.9.1": - - patch_file: "patches/external-lz4-and-export-symbols.patch" + - patch_file: "patches/1.9.1-0001-external-lz4-and-export-symbols.patch" + - patch_file: "patches/1.9.1-0002-support-cpp17.patch" + patch_description: "Support C++17" + patch_type: "portability" + patch_source: "https://github.com/flann-lib/flann/pull/392" diff --git a/recipes/flann/all/conanfile.py b/recipes/flann/all/conanfile.py index 0668657726b10..6a9cd05129f49 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,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("lz4/1.9.3") + # see https://github.com/conan-io/conan-center-index/pull/16355#discussion_r1150197550 + self.requires("lz4/1.9.4", transitive_headers=True, transitive_libs=True) 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 +124,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/patches/external-lz4-and-export-symbols.patch b/recipes/flann/all/patches/1.9.1-0001-external-lz4-and-export-symbols.patch similarity index 100% rename from recipes/flann/all/patches/external-lz4-and-export-symbols.patch rename to recipes/flann/all/patches/1.9.1-0001-external-lz4-and-export-symbols.patch diff --git a/recipes/flann/all/patches/1.9.1-0002-support-cpp17.patch b/recipes/flann/all/patches/1.9.1-0002-support-cpp17.patch new file mode 100644 index 0000000000000..fedae0a138f45 --- /dev/null +++ b/recipes/flann/all/patches/1.9.1-0002-support-cpp17.patch @@ -0,0 +1,103 @@ +--- a/src/cpp/flann/algorithms/kdtree_index.h ++++ b/src/cpp/flann/algorithms/kdtree_index.h +@@ -37,6 +37,9 @@ + #include + #include + #include ++#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) ++#include ++#endif + + #include "flann/general.h" + #include "flann/algorithms/nn_index.h" +@@ -265,8 +268,14 @@ protected: + /* Construct the randomized trees. */ + for (int i = 0; i < trees_; i++) { + /* Randomize the order of vectors to allow for unbiased sampling. */ ++#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) ++ std::random_device rd; ++ std::mt19937 g(rd()); ++ std::shuffle(ind.begin(), ind.end(), g); ++#else + std::random_shuffle(ind.begin(), ind.end()); + tree_roots_[i] = divideTree(&ind[0], int(size_) ); ++#endif + } + delete[] mean_; + delete[] var_; +--- a/src/cpp/flann/util/heap.h ++++ b/src/cpp/flann/util/heap.h +@@ -105,8 +105,11 @@ public: + count = 0; + } + +- struct CompareT : public std::binary_function ++ struct CompareT + { ++ typedef T first_argument_type; ++ typedef T second_argument_type; ++ typedef bool result_type; + bool operator()(const T& t_1, const T& t_2) const + { + return t_2 < t_1; +--- a/src/cpp/flann/util/lsh_table.h ++++ b/src/cpp/flann/util/lsh_table.h +@@ -39,6 +39,9 @@ + #include + #include + #include ++#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) ++#include ++#endif + // TODO as soon as we use C++0x, use the code in USE_UNORDERED_MAP + #if USE_UNORDERED_MAP + #include +@@ -364,7 +367,13 @@ inline LshTable::LshTable(unsigned int feature_size, unsigned int + // A bit brutal but fast to code + std::vector indices(feature_size * CHAR_BIT); + for (size_t i = 0; i < feature_size * CHAR_BIT; ++i) indices[i] = i; ++#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) ++ std::random_device rd; ++ std::mt19937 g(rd()); ++ std::shuffle(indices.begin(), indices.end(),g); ++#else + std::random_shuffle(indices.begin(), indices.end()); ++#endif + + // Generate a random set of order of subsignature_size_ bits + for (unsigned int i = 0; i < key_size_; ++i) { +--- a/src/cpp/flann/util/random.h ++++ b/src/cpp/flann/util/random.h +@@ -34,6 +34,9 @@ + #include + #include + #include ++#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) ++#include ++#endif + #include + + #include "flann/general.h" +@@ -110,14 +113,22 @@ public: + */ + void init(int n) + { ++#if !((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + static RandomGenerator generator; ++#endif + // create and initialize an array of size n + vals_.resize(n); + size_ = n; + for (int i = 0; i < size_; ++i) vals_[i] = i; + + // shuffle the elements in the array ++#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) ++ std::random_device rd; ++ std::mt19937 g(rd()); ++ std::shuffle(vals_.begin(), vals_.end(), g); ++#else + std::random_shuffle(vals_.begin(), vals_.end(), generator); ++#endif + + counter_ = 0; + } diff --git a/recipes/flann/all/patches/cxx-11-required.patch b/recipes/flann/all/patches/1.9.2-0001-cxx-11-required.patch similarity index 100% rename from recipes/flann/all/patches/cxx-11-required.patch rename to recipes/flann/all/patches/1.9.2-0001-cxx-11-required.patch diff --git a/recipes/flann/all/patches/cmake-lz4.patch b/recipes/flann/all/patches/1.9.2-0002-cmake-lz4.patch similarity index 100% rename from recipes/flann/all/patches/cmake-lz4.patch rename to recipes/flann/all/patches/1.9.2-0002-cmake-lz4.patch 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 a637b19cca0ad..a652904b42613 100644 --- a/recipes/flatbuffers/all/conandata.yml +++ b/recipes/flatbuffers/all/conandata.yml @@ -1,4 +1,19 @@ sources: + "24.3.25": + url: "https://github.com/google/flatbuffers/archive/v24.3.25.tar.gz" + sha256: "4157c5cacdb59737c5d627e47ac26b140e9ee28b1102f812b36068aab728c1ed" + "24.3.7": + url: "https://github.com/google/flatbuffers/archive/v24.3.7.tar.gz" + sha256: "bfff9d2150fcff88f844e8c608b02b2a0e94c92aea39b04c0624783464304784" + "23.5.26": + url: "https://github.com/google/flatbuffers/archive/v23.5.26.tar.gz" + sha256: "1cce06b17cddd896b6d73cc047e36a254fb8df4d7ea18a46acf16c4c0cd3f3f3" + "23.3.3": + url: "https://github.com/google/flatbuffers/archive/v23.3.3.tar.gz" + sha256: "8aff985da30aaab37edf8e5b02fda33ed4cbdd962699a8e2af98fdef306f4e4d" + "23.1.21": + url: "https://github.com/google/flatbuffers/archive/v23.1.21.tar.gz" + sha256: "d84cb25686514348e615163b458ae0767001b24b42325f426fd56406fd384238" "22.12.06": url: "https://github.com/google/flatbuffers/archive/v22.12.06.tar.gz" sha256: "209823306f2cbedab6ff70997e0d236fcfd1864ca9ad082cbfdb196e7386daed" @@ -11,35 +26,25 @@ sources: "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_description: "Don't use universal2 architecture" + patch_type: "bugfix" - 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" + patch_description: "No flatc execution during build time" + patch_type: "conan" + "1.12.0": + - patch_file: "patches/0005-arm-cxx-compiler-build.patch" + patch_description: "IAR ARM C++ Compiler build bugfix" + patch_type: "backport" + patch_source: "https://github.com/google/flatbuffers/commit/82fac326c5981a85233b8ae7e0d7ec8fda432963" diff --git a/recipes/flatbuffers/all/conanfile.py b/recipes/flatbuffers/all/conanfile.py index 7a56fe8b533bc..4f6cbc9b40b2b 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 = ">=2.1" class FlatbuffersConan(ConanFile): @@ -14,10 +14,11 @@ 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" + package_type = "library" options = { "shared": [True, False], "fPIC": [True, False], @@ -29,51 +30,51 @@ class FlatbuffersConan(ConanFile): "header_only": False, } - @property - def _has_flatc(self): + def _has_flatc(self, info=False): # don't build flatc when it makes little sense or not supported - return self.settings.os not in ["Android", "iOS", "watchOS", "tvOS", "Neutrino"] + host_os = self.info.settings.os if info else self.settings.os + return host_os not in ["Android", "iOS", "watchOS", "tvOS", "Neutrino"] 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 build_requirements(self): - if Version(self.version) >= "2.0.7": - self.tool_requires("cmake/3.24.0") - 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 + def layout(self): + cmake_layout(self, src_folder="src") + def package_id(self): - if self.options.header_only and not self._has_flatc: + if self.info.options.header_only and not self._has_flatc(info=True): self.info.clear() def validate(self): - if self.settings.compiler.get_safe("cppstd"): - check_min_cppstd(self, 11) + check_min_cppstd(self, 11) - def layout(self): - cmake_layout(self, src_folder="src") + def build_requirements(self): + # since 23.3.3 version, flatbuffers cmake scripts were refactored to use cmake 3.8 version + # see https://github.com/google/flatbuffers/pull/7801 + if Version(self.version) >= "2.0.8" and Version(self.version) < "23.3.3": + self.tool_requires("cmake/[>=3.16 <4]") 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) + self._patch_sources() def generate(self): tc = CMakeToolchain(self) tc.variables["FLATBUFFERS_BUILD_TESTS"] = False tc.variables["FLATBUFFERS_INSTALL"] = True tc.variables["FLATBUFFERS_BUILD_FLATLIB"] = not self.options.header_only and not self.options.shared - tc.variables["FLATBUFFERS_BUILD_FLATC"] = self._has_flatc + tc.variables["FLATBUFFERS_BUILD_FLATC"] = self._has_flatc() tc.variables["FLATBUFFERS_STATIC_FLATC"] = False tc.variables["FLATBUFFERS_BUILD_FLATHASH"] = False tc.variables["FLATBUFFERS_BUILD_SHAREDLIB"] = not self.options.header_only and self.options.shared @@ -92,9 +93,6 @@ def generate(self): # Fix iOS/tvOS/watchOS if is_apple_os(self): tc.variables["CMAKE_MACOSX_BUNDLE"] = False - # Inject at least C++11 standard (would be more elegant to rely on cxx_std_11 compile feature upstream) - if not valid_min_cppstd(self, 11): - tc.variables["CMAKE_CXX_STANDARD"] = 11 tc.generate() def _patch_sources(self): @@ -112,13 +110,12 @@ def _patch_sources(self): "RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}") def build(self): - self._patch_sources() 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, "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")) @@ -156,19 +153,6 @@ def package_info(self): os.path.join(self._module_path, "BuildFlatBuffers.cmake"), ] self.cpp_info.set_property("cmake_build_modules", build_modules) - if self._has_flatc: - bindir = os.path.join(self.package_folder, "bin") - self.output.info(f"Appending PATH environment variable: {bindir}") - 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.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 - self.cpp_info.components["libflatbuffers"].names["cmake_find_package_multi"] = cmake_target - self.cpp_info.components["libflatbuffers"].build_modules["cmake_find_package"] = build_modules - self.cpp_info.components["libflatbuffers"].build_modules["cmake_find_package_multi"] = build_modules - self.cpp_info.components["libflatbuffers"].set_property("cmake_file_name", f"flatbuffers::{cmake_target}") - self.cpp_info.components["libflatbuffers"].set_property("pkg_config_name", "flatbuffers") + + if self._has_flatc(): + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) 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/0005-arm-cxx-compiler-build.patch b/recipes/flatbuffers/all/patches/0005-arm-cxx-compiler-build.patch new file mode 100644 index 0000000000000..7ea43002f8643 --- /dev/null +++ b/recipes/flatbuffers/all/patches/0005-arm-cxx-compiler-build.patch @@ -0,0 +1,16 @@ +diff --git a/include/flatbuffers/flatbuffers.h b/include/flatbuffers/flatbuffers.h +index c4dc5bcd..0f3a7dfd 100644 +--- a/include/flatbuffers/flatbuffers.h ++++ b/include/flatbuffers/flatbuffers.h +@@ -1871,10 +1871,7 @@ class FlatBufferBuilder { + vector_downward &buf_; + + private: +- TableKeyComparator &operator=(const TableKeyComparator &other) { +- buf_ = other.buf_; +- return *this; +- } ++ FLATBUFFERS_DELETE_FUNC(TableKeyComparator &operator=(const TableKeyComparator &other)) + }; + /// @endcond + diff --git a/recipes/flatbuffers/all/test_package/CMakeLists.txt b/recipes/flatbuffers/all/test_package/CMakeLists.txt index e4d22dcbf68fe..59f9fe8ba9801 100644 --- a/recipes/flatbuffers/all/test_package/CMakeLists.txt +++ b/recipes/flatbuffers/all/test_package/CMakeLists.txt @@ -15,7 +15,9 @@ if(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 +# Testing this block in case of cross-build would require to add flatbuffers to build requirements of test package +# But due to c3i limitations, package id of build requirement if header_only is not available while building in c3i +if(NOT CMAKE_CROSSCOMPILING) add_executable(sample_binary sample_binary.cpp) target_link_libraries(sample_binary PRIVATE ${FLATBUFFERS_TARGET}) target_compile_features(sample_binary PRIVATE cxx_std_11) diff --git a/recipes/flatbuffers/all/test_package/conanfile.py b/recipes/flatbuffers/all/test_package/conanfile.py index 6cfe4c15fdd50..c045cfa4864e3 100644 --- a/recipes/flatbuffers/all/test_package/conanfile.py +++ b/recipes/flatbuffers/all/test_package/conanfile.py @@ -1,25 +1,27 @@ from conan import ConanFile -from conan.tools.build import can_run, cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.env import VirtualRunEnv import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "CMakeDeps", "VirtualBuildEnv", "VirtualRunEnv" + generators = "CMakeDeps" test_type = "explicit" - def requirements(self): - self.requires(self.tested_reference_str) - - def build_requirements(self): - if not (hasattr(self, "settings_build") and cross_building(self) and self.options["flatbuffers"].header_only): - self.tool_requires(self.tested_reference_str) - def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str, run=can_run(self)) + def generate(self): + env = VirtualRunEnv(self) + env.generate() + if can_run(self): + env = VirtualRunEnv(self) + env.generate(scope="build") tc = CMakeToolchain(self) tc.variables["FLATBUFFERS_HEADER_ONLY"] = self.dependencies["flatbuffers"].options.header_only tc.generate() diff --git a/recipes/flatbuffers/all/test_v1_package/CMakeLists.txt b/recipes/flatbuffers/all/test_v1_package/CMakeLists.txt deleted file mode 100644 index 2afd0f99c22b5..0000000000000 --- a/recipes/flatbuffers/all/test_v1_package/CMakeLists.txt +++ /dev/null @@ -1,39 +0,0 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) - -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() diff --git a/recipes/flatbuffers/all/test_v1_package/conanfile.py b/recipes/flatbuffers/all/test_v1_package/conanfile.py deleted file mode 100644 index 91ff65abd57aa..0000000000000 --- a/recipes/flatbuffers/all/test_v1_package/conanfile.py +++ /dev/null @@ -1,27 +0,0 @@ -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") and tools.cross_building(self) and \ - not self.options["flatbuffers"].header_only: # due to missing package id of build requirement if header_only - self.build_requires(self.tested_reference_str) - - def build(self): - cmake = CMake(self) - cmake.definitions["FLATBUFFERS_HEADER_ONLY"] = self.options["flatbuffers"].header_only - 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", "sample_binary"), run_environment=True) diff --git a/recipes/flatbuffers/config.yml b/recipes/flatbuffers/config.yml index 014a45840cfb2..4faf33c80023f 100644 --- a/recipes/flatbuffers/config.yml +++ b/recipes/flatbuffers/config.yml @@ -1,4 +1,14 @@ versions: + "24.3.25": + folder: all + "24.3.7": + folder: all + "23.5.26": + folder: all + "23.3.3": + folder: all + "23.1.21": + folder: all "22.12.06": folder: all "22.11.23": @@ -7,17 +17,9 @@ versions: folder: all "22.9.29": folder: all - "22.9.24": - folder: all "2.0.8": folder: all - "2.0.6": - folder: all "2.0.5": folder: all - "2.0.0": - folder: all "1.12.0": folder: all - "1.11.0": - folder: all diff --git a/recipes/flatbush/all/conandata.yml b/recipes/flatbush/all/conandata.yml index 3d50fc3bd1efd..4382ecd215405 100644 --- a/recipes/flatbush/all/conandata.yml +++ b/recipes/flatbush/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "1.2.1": + url: "https://github.com/chusitoo/flatbush/archive/refs/tags/v1.2.1.zip" + sha256: "7f8226cb9a58cc75c99800a8fb213b1c2c5df81051ec559d5ff7b4ed0e8c097a" + "1.2.0": + url: "https://github.com/chusitoo/flatbush/archive/refs/tags/v1.2.0.zip" + sha256: "d8d0471ad6aba1e4b1160abc38a0fe21a35e3ea1c2a9509ce9910072f7fc24bb" "1.1.0": url: "https://github.com/chusitoo/flatbush/archive/refs/tags/v1.1.0.zip" sha256: "3ef034110b0ea6f7514d3cdc362976e2a9ab321cc9e4b2c847167ad26df0c0f1" diff --git a/recipes/flatbush/all/conanfile.py b/recipes/flatbush/all/conanfile.py index c9dd4bc6e1a67..b97d78e5d781a 100644 --- a/recipes/flatbush/all/conanfile.py +++ b/recipes/flatbush/all/conanfile.py @@ -1,25 +1,49 @@ -from conans import ConanFile, tools +import os + +from conan import ConanFile +from conan.tools.build import valid_min_cppstd, check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout + +required_conan_version = ">=1.52.0" + class FlatbushConan(ConanFile): name = "flatbush" - license = "MIT" - homepage = "https://github.com/chusitoo/flatbush" description = "Flatbush for C++" - topics = ("header-only", "flatbush", "r-tree", "hilbert", "zero-copy", "spatial-index") + license = "MIT" url = "https://github.com/conan-io/conan-center-index" - settings = "os", "compiler", "build_type", "arch" + homepage = "https://github.com/chusitoo/flatbush" + topics = ("header-only", "r-tree", "hilbert", "zero-copy", "spatial-index") + + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True) + @property + def _min_cppstd(self): + return 11 - def package(self): - self.copy(pattern="LICENSE", dst="licenses") - self.copy(pattern="flatbush.h", dst="include") + 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.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, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, "flatbush.h", dst=os.path.join(self.package_folder, "include"), src=self.source_folder) def package_info(self): - if not tools.valid_min_cppstd(self, "20"): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + if not valid_min_cppstd(self, "20"): self.cpp_info.defines = ["FLATBUSH_SPAN"] diff --git a/recipes/flatbush/all/test_package/CMakeLists.txt b/recipes/flatbush/all/test_package/CMakeLists.txt index 6ad4f7bcfdd6b..96d337017953c 100644 --- a/recipes/flatbush/all/test_package/CMakeLists.txt +++ b/recipes/flatbush/all/test_package/CMakeLists.txt @@ -1,12 +1,8 @@ -cmake_minimum_required(VERSION 3.12) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) -project(test_package VERSION 1.0.0 LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) -find_package(flatbush CONFIG REQUIRED) - -add_executable(${PROJECT_NAME} "test_package.cpp") +find_package(flatbush REQUIRED CONFIG) +add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} flatbush::flatbush) - set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) diff --git a/recipes/flatbush/all/test_package/conanfile.py b/recipes/flatbush/all/test_package/conanfile.py index 5b0ef1df32f11..fae501d0afb9e 100644 --- a/recipes/flatbush/all/test_package/conanfile.py +++ b/recipes/flatbush/all/test_package/conanfile.py @@ -1,10 +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_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" + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/flatbush/all/test_package/test_package.cpp b/recipes/flatbush/all/test_package/test_package.cpp index 36860193e4ed8..1db2b51eded51 100644 --- a/recipes/flatbush/all/test_package/test_package.cpp +++ b/recipes/flatbush/all/test_package/test_package.cpp @@ -24,8 +24,7 @@ SOFTWARE. #include "flatbush.h" -int main(int argc, char** argv) -{ +int main() { flatbush::FlatbushBuilder wBuilder; wBuilder.add({ 0, 0, 0, 0 }); auto wIndex = wBuilder.finish(); diff --git a/recipes/flatbush/all/test_v1_package/CMakeLists.txt b/recipes/flatbush/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/flatbush/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/flatbush/all/test_v1_package/conanfile.py b/recipes/flatbush/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5b0ef1df32f11 --- /dev/null +++ b/recipes/flatbush/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +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.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/flatbush/config.yml b/recipes/flatbush/config.yml index 11b7aff3a5ac4..7b2fedacd7387 100644 --- a/recipes/flatbush/config.yml +++ b/recipes/flatbush/config.yml @@ -1,3 +1,7 @@ versions: + "1.2.1": + folder: "all" + "1.2.0": + folder: "all" "1.1.0": folder: "all" diff --git a/recipes/flatcc/all/CMakeLists.txt b/recipes/flatcc/all/CMakeLists.txt deleted file mode 100644 index 07ec7f05275cb..0000000000000 --- a/recipes/flatcc/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/flatcc/all/conanfile.py b/recipes/flatcc/all/conanfile.py index 09f5cab415518..8509d971bbcd8 100644 --- a/recipes/flatcc/all/conanfile.py +++ b/recipes/flatcc/all/conanfile.py @@ -1,52 +1,53 @@ -from conans import CMake, ConanFile, tools -from conans.errors import ConanInvalidConfiguration import os -import functools -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, can_run +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" + class FlatccConan(ConanFile): name = "flatcc" description = "C language binding for Flatbuffers, an efficient cross platform serialization library" license = "Apache-2.0" - topics = ("flatbuffers", "serialization") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/dvidelabs/flatcc" + topics = ("flatbuffers", "serialization") + + package_type = "library" settings = "os", "arch", "compiler", "build_type" - options = { "shared": [True, False], - "fPIC": [True, False], - "portable": [True, False], - "gnu_posix_memalign": [True, False], - "runtime_lib_only": [True, False], - "verify_assert": [True, False], - "verify_trace": [True, False], - "reflection": [True, False], - "native_optim": [True, False], - "fast_double": [True, False], - "ignore_const_condition": [True, False], + options = { + "shared": [True, False], + "fPIC": [True, False], + "portable": [True, False], + "gnu_posix_memalign": [True, False], + "runtime_lib_only": [True, False], + "verify_assert": [True, False], + "verify_trace": [True, False], + "reflection": [True, False], + "native_optim": [True, False], + "fast_double": [True, False], + "ignore_const_condition": [True, False], } - default_options = { "shared": False, - "fPIC": True, - "portable": False, - "gnu_posix_memalign": True, - "runtime_lib_only": False, - "verify_assert": False, - "verify_trace": False, - "reflection": True, - "native_optim": False, - "fast_double": False, - "ignore_const_condition": False + default_options = { + "shared": False, + "fPIC": True, + "portable": False, + "gnu_posix_memalign": True, + "runtime_lib_only": False, + "verify_assert": False, + "verify_trace": False, + "reflection": True, + "native_optim": False, + "fast_double": False, + "ignore_const_condition": False, } - generators = "cmake" - exports_sources = ["CMakeLists.txt"] - - @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": @@ -54,58 +55,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 validate(self): if self.settings.os == "Windows": - if self.settings.compiler == "Visual Studio" and self.options.shared: - #Building flatcc shared libs with Visual Studio is broken + if is_msvc(self) and self.options.shared: + # Building flatcc shared libs with Visual Studio is broken raise ConanInvalidConfiguration("Building flatcc libraries shared is not supported") - if tools.Version(self.version) == "0.6.0" and self.settings.compiler == "gcc": + if Version(self.version) == "0.6.0" and self.settings.compiler == "gcc": raise ConanInvalidConfiguration("Building flatcc with MinGW is not supported") + if cross_building(self) and not can_run(self): + raise ConanInvalidConfiguration(f"Cross-building for a non-native architecture ({self.settings.arch}) is 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], strip_root=True) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["FLATCC_PORTABLE"] = self.options.portable - cmake.definitions["FLATCC_GNU_POSIX_MEMALIGN"] = self.options.gnu_posix_memalign - cmake.definitions["FLATCC_RTONLY"] = self.options.runtime_lib_only - cmake.definitions["FLATCC_INSTALL"] = True - cmake.definitions["FLATCC_COVERAGE"] = False - cmake.definitions["FLATCC_DEBUG_VERIFY"] = self.options.verify_assert - cmake.definitions["FLATCC_TRACE_VERIFY"] = self.options.verify_trace - cmake.definitions["FLATCC_REFLECTION"] = self.options.reflection - cmake.definitions["FLATCC_NATIVE_OPTIM"] = self.options.native_optim - cmake.definitions["FLATCC_FAST_DOUBLE"] = self.options.fast_double - cmake.definitions["FLATCC_IGNORE_CONST_COND"] = self.options.ignore_const_condition - cmake.definitions["FLATCC_TEST"] = False - cmake.definitions["FLATCC_ALLOW_WERROR"] = False - cmake.configure(build_folder=self._build_subfolder) - return cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["FLATCC_PORTABLE"] = self.options.portable + tc.variables["FLATCC_GNU_POSIX_MEMALIGN"] = self.options.gnu_posix_memalign + tc.variables["FLATCC_RTONLY"] = self.options.runtime_lib_only + tc.variables["FLATCC_INSTALL"] = True + tc.variables["FLATCC_COVERAGE"] = False + tc.variables["FLATCC_DEBUG_VERIFY"] = self.options.verify_assert + tc.variables["FLATCC_TRACE_VERIFY"] = self.options.verify_trace + tc.variables["FLATCC_REFLECTION"] = self.options.reflection + tc.variables["FLATCC_NATIVE_OPTIM"] = self.options.native_optim + tc.variables["FLATCC_FAST_DOUBLE"] = self.options.fast_double + tc.variables["FLATCC_IGNORE_CONST_COND"] = self.options.ignore_const_condition + tc.variables["FLATCC_TEST"] = False + tc.variables["FLATCC_ALLOW_WERROR"] = False + tc.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() - if self.settings.build_type == "Debug" and not tools.os_info.is_windows: + if self.settings.build_type == "Debug" and not self.settings.os == "Windows": debug_suffix = "_d" if self.settings.build_type == "Debug" else "" - os.rename(os.path.join(self.package_folder, "bin", "flatcc%s" % debug_suffix), + os.rename(os.path.join(self.package_folder, "bin", f"flatcc{debug_suffix}"), os.path.join(self.package_folder, "bin", "flatcc")) - # Copy license file - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + fix_apple_shared_install_name(self) def package_info(self): - 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) debug_suffix = "_d" if self.settings.build_type == "Debug" else "" if not self.options.runtime_lib_only: - self.cpp_info.libs.append("flatcc%s" % debug_suffix) - self.cpp_info.libs.append("flatccrt%s" % debug_suffix) + self.cpp_info.libs.append(f"flatcc{debug_suffix}") + self.cpp_info.libs.append(f"flatccrt{debug_suffix}") + + # TODO: to remove in conan v2 + bin_path = os.path.join(self.package_folder, "bin") + self.env_info.PATH.append(bin_path) diff --git a/recipes/flatcc/all/test_package/CMakeLists.txt b/recipes/flatcc/all/test_package/CMakeLists.txt index 3a1e3c2e0ae88..30545f8db3c32 100644 --- a/recipes/flatcc/all/test_package/CMakeLists.txt +++ b/recipes/flatcc/all/test_package/CMakeLists.txt @@ -1,8 +1,5 @@ -cmake_minimum_required(VERSION 3.1) -project(flatcc_example) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.15) +project(flatcc_example LANGUAGES C) find_package(flatcc REQUIRED CONFIG) @@ -14,20 +11,14 @@ include_directories("${GEN_DIR}" "${INC_DIR}") add_executable(monster monster.c) -#On MacOS System Integrity Protection (SIP) will clear the DYLD_LIBRARY_PATH variable. -#As a result calling flatcc from cmake will currently not work if the flatcc executable -# is linked shared. As a workaround we generate the flatbuffer C files in the Conan recipe -# when on MacOS and flatcc option 'shared' is True. -if (NOT MACOS_SIP_WORKAROUND) - add_custom_target(gen_monster_fbs ALL) - add_custom_command ( - TARGET gen_monster_fbs - COMMAND cmake -E make_directory "${GEN_DIR}" - COMMAND flatcc -a -o "${GEN_DIR}" "${FBS_DIR}/monster.fbs" - DEPENDS flatcc "${FBS_DIR}/monster.fbs" - ) +add_custom_target(gen_monster_fbs ALL) +add_custom_command ( + TARGET gen_monster_fbs + COMMAND cmake -E make_directory "${GEN_DIR}" + COMMAND flatcc -a -o "${GEN_DIR}" "${FBS_DIR}/monster.fbs" + DEPENDS flatcc "${FBS_DIR}/monster.fbs" +) - add_dependencies(monster gen_monster_fbs) -endif() +add_dependencies(monster gen_monster_fbs) target_link_libraries(monster flatcc::flatcc) diff --git a/recipes/flatcc/all/test_package/conanfile.py b/recipes/flatcc/all/test_package/conanfile.py index 35aa66924f6ab..862b0fa5fd360 100644 --- a/recipes/flatcc/all/test_package/conanfile.py +++ b/recipes/flatcc/all/test_package/conanfile.py @@ -1,35 +1,46 @@ -import os.path +import os -from conans import ConanFile, CMake, tools, RunEnvironment -from conans.errors import ConanException +from conan import ConanFile, conan_version +from conan.tools.apple import is_apple_os +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +from conan.tools.env import VirtualRunEnv -class FlatccTestConan(ConanFile): +class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def build_requirements(self): + self.tool_requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + @property + def _skip_shared_macos(self): + return conan_version.major == 1 and self.options["flatcc"].shared and is_apple_os(self) + + def generate(self): + VirtualRunEnv(self).generate(scope="build") + VirtualRunEnv(self).generate(scope="run") + def build(self): - if tools.cross_building(self): + if self._skip_shared_macos: return - - env_build = RunEnvironment(self) - with tools.environment_append(env_build.vars): - cmake = CMake(self) - if tools.os_info.is_macos and self.options["flatcc"].shared: - # Because of MacOS System Integraty Protection it is currently not possible to run the flatcc - # executable from cmake if it is linked shared. As a temporary work-around run flatcc here in - # the build function. - tools.mkdir(os.path.join(self.build_folder, "generated")) - self.run("flatcc -a -o " + os.path.join(self.build_folder, "generated") + " " + os.path.join(self.source_folder, "monster.fbs"), run_environment=True) - cmake.definitions["MACOS_SIP_WORKAROUND"] = True - cmake.configure() - cmake.build() + cmake = CMake(self) + cmake.configure() + cmake.build() def test(self): - if tools.cross_building(self): - bin_path = os.path.join(self.deps_cpp_info["flatcc"].rootpath, "bin", "flatcc") - if not os.path.isfile(bin_path) or not os.access(bin_path, os.X_OK): - raise ConanException("flatcc doesn't exist.") - else: - bin_path = os.path.join(self.build_folder, "bin", "monster") - self.run(bin_path, cwd=self.source_folder, run_environment=True) + if self._skip_shared_macos: + return + if can_run(self): + self.run("flatcc --version") + bin_path = os.path.join(self.cpp.build.bindir, "monster") + self.run(bin_path, env="conanrun") diff --git a/recipes/flatcc/all/test_v1_package/CMakeLists.txt b/recipes/flatcc/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/flatcc/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/flatcc/all/test_v1_package/conanfile.py b/recipes/flatcc/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..397faab87a163 --- /dev/null +++ b/recipes/flatcc/all/test_v1_package/conanfile.py @@ -0,0 +1,40 @@ +import os.path + +from conans import ConanFile, CMake, tools, RunEnvironment +from conans.errors import ConanException + + +class FlatccTestConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + @property + def _skip_shared_macos(self): + # Because of MacOS System Integraty Protection it is currently not possible to run the flatcc + # executable from cmake if it is linked shared. As a temporary work-around run flatcc here in + # the build function. + return self.options["flatcc"].shared and tools.os_info.is_macos + + def build(self): + if tools.cross_building(self): + return + + if self._skip_shared_macos: + return + + env_build = RunEnvironment(self) + with tools.environment_append(env_build.vars): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if self._skip_shared_macos: + return + if tools.cross_building(self): + bin_path = os.path.join(self.deps_cpp_info["flatcc"].rootpath, "bin", "flatcc") + if not os.path.isfile(bin_path) or not os.access(bin_path, os.X_OK): + raise ConanException("flatcc doesn't exist.") + else: + bin_path = os.path.join(self.build_folder, "bin", "monster") + self.run(bin_path, cwd=self.source_folder, run_environment=True) diff --git a/recipes/flecs/all/conandata.yml b/recipes/flecs/all/conandata.yml index 66aade00ad726..5e77688b77f2b 100644 --- a/recipes/flecs/all/conandata.yml +++ b/recipes/flecs/all/conandata.yml @@ -1,4 +1,22 @@ sources: + "4.0.0": + url: "https://github.com/SanderMertens/flecs/archive/refs/tags/v4.0.0.tar.gz" + sha256: "6c9826c8602f797acd775269d143763adfb3d3a93031cc81bced2b6d267469d2" + "3.2.11": + url: "https://github.com/SanderMertens/flecs/archive/refs/tags/v3.2.11.tar.gz" + sha256: "8ebc5f6f3ec7bbba30b0afe9d22f157437925772857ea1c6e4201eb5d31b4fe5" + "3.2.8": + url: "https://github.com/SanderMertens/flecs/archive/refs/tags/v3.2.8.tar.gz" + sha256: "b40453a77b66e220408c50b119da54b153c248cf6f7025575e3fd1a8ff79f748" + "3.2.4": + url: "https://github.com/SanderMertens/flecs/archive/v3.2.4.tar.gz" + sha256: "0b65426053418911cae1c3f347748fba6eb7d4ae8860ce7fcc91ef25f386d4a1" + "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" diff --git a/recipes/flecs/all/conanfile.py b/recipes/flecs/all/conanfile.py index b4d76faa5ed41..772d3a2cb6618 100644 --- a/recipes/flecs/all/conanfile.py +++ b/recipes/flecs/all/conanfile.py @@ -17,6 +17,7 @@ class FlecsConan(ConanFile): homepage = "https://github.com/SanderMertens/flecs" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -53,6 +54,7 @@ def generate(self): else: tc.variables["FLECS_STATIC"] = not self.options.shared tc.variables["FLECS_SHARED"] = self.options.shared + tc.variables["FLECS_TESTS"] = False tc.variables["FLECS_PIC"] = self.options.get_safe("fPIC", True) tc.generate() diff --git a/recipes/flecs/all/test_package/conanfile.py b/recipes/flecs/all/test_package/conanfile.py index 0a6bc68712d90..1a364276dd853 100644 --- a/recipes/flecs/all/test_package/conanfile.py +++ b/recipes/flecs/all/test_package/conanfile.py @@ -1,12 +1,12 @@ from conan import ConanFile from conan.tools.build import can_run -from conan.tools.cmake import CMake, cmake_layout +from conan.tools.cmake import CMake, cmake_layout, CMakeToolchain import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + generators = "CMakeDeps", "VirtualRunEnv" test_type = "explicit" def layout(self): @@ -15,6 +15,12 @@ def layout(self): def requirements(self): self.requires(self.tested_reference_str) + def generate(self): + tc = CMakeToolchain(self) + if self.dependencies[self.tested_reference_str].ref.version < "4.0.0": + tc.preprocessor_definitions["LESS_VERSION_4"] = "1" + tc.generate() + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/flecs/all/test_package/test_package.c b/recipes/flecs/all/test_package/test_package.c index 6b277544863db..9a75f507a8f98 100644 --- a/recipes/flecs/all/test_package/test_package.c +++ b/recipes/flecs/all/test_package/test_package.c @@ -11,8 +11,11 @@ int main() { ecs_world_t *world = ecs_init(); ECS_COMPONENT(world, Position); - +#ifdef LESS_VERSION_4 ecs_entity_t e = ecs_new_id(world); +#else + ecs_entity_t e = ecs_new(world); +#endif ecs_set(world, e, Position, {10.0f, 20.0f}); const char *name = ecs_get_name(world, e); diff --git a/recipes/flecs/config.yml b/recipes/flecs/config.yml index 9d7fa5cf5dd91..c8dc8eaef31be 100644 --- a/recipes/flecs/config.yml +++ b/recipes/flecs/config.yml @@ -1,4 +1,16 @@ versions: + "4.0.0": + folder: all + "3.2.11": + folder: all + "3.2.8": + folder: all + "3.2.4": + folder: all + "3.1.4": + folder: all + "3.1.3": + folder: all "3.1.2": folder: all "3.1.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/flint/all/CMakeLists.txt b/recipes/flint/all/CMakeLists.txt deleted file mode 100644 index c986d294c7547..0000000000000 --- a/recipes/flint/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/flint/all/conandata.yml b/recipes/flint/all/conandata.yml index ca7fe5127f757..9430f00dbd6c3 100644 --- a/recipes/flint/all/conandata.yml +++ b/recipes/flint/all/conandata.yml @@ -1,18 +1,20 @@ sources: - "2.8.1": - url: "https://github.com/wbhart/flint2/archive/refs/tags/v2.8.1.tar.gz" - sha256: "93c4d6acd46d7a4357a2abe313e5f0625fa7e94a1a0e53048f9066f55a7acd49" + "3.0.1": + url: "https://github.com/flintlib/flint/releases/download/v3.0.1/flint-3.0.1.tar.xz" + sha256: "de9ada43c94a69de2e78a5241dc183a1c1ece11e45fe565da7272cf8ed818dd6" + "2.9.0": + url: "https://github.com/wbhart/flint2/archive/v2.9.0.tar.gz" + sha256: "624e0fc343b27a156c0e3bb48d2a644a1ac387aa66217f6753c03a02c80bbf6f" + "2.8.5": + url: "https://github.com/wbhart/flint2/archive/refs/tags/v2.8.5.tar.gz" + sha256: "4d5377e7432e67b0f34f95059a01d243ef29208da86ba3e812d312d323db0d8e" "2.7.1": url: "https://github.com/wbhart/flint2/archive/refs/tags/v2.7.1.tar.gz" - sha256: "bcadc2252e61092a9b3a3198b337e20abeac56078eaa19793ab99ff7a987efb7" + sha256: "80f1b7240f1ee5d15952c33cb0aa27b6395993fe897bc279ad984f4fc2743bd4" patches: - "2.8.1": - - patch_file: "patches/0001-cmake-2.8.1.patch" - base_path: "source_subfolder" + "2.9.0": + - patch_file: "patches/0002-msvc-alloca.patch" + "2.8.5": - patch_file: "patches/0002-msvc-alloca.patch" - base_path: "source_subfolder" "2.7.1": - - patch_file: "patches/0001-cmake.patch" - base_path: "source_subfolder" - patch_file: "patches/0002-msvc-alloca.patch" - base_path: "source_subfolder" diff --git a/recipes/flint/all/conanfile.py b/recipes/flint/all/conanfile.py index 29a0ae933dc5f..ef8d2e43bc72f 100644 --- a/recipes/flint/all/conanfile.py +++ b/recipes/flint/all/conanfile.py @@ -1,19 +1,24 @@ import os -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, replace_in_file +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class FlintConan(ConanFile): name = "flint" description = "FLINT (Fast Library for Number Theory)" license = "LGPL-2.1-or-later" - topics = ("math", "numerical") - homepage = "https://www.flintlib.org" url = "https://github.com/conan-io/conan-center-index" - exports_sources = ["CMakeLists.txt", "patches/**"] - generators = "cmake" + homepage = "https://www.flintlib.org" + topics = ("math", "numerical") + + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -24,15 +29,8 @@ class FlintConan(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": @@ -40,52 +38,71 @@ 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("gmp/6.2.1") - self.requires("mpfr/4.1.0") - if self.settings.compiler == "Visual Studio": + self.requires("gmp/6.3.0", transitive_headers=True, transitive_libs=True) + self.requires("mpfr/4.2.1", transitive_headers=True, transitive_libs=True) + if is_msvc(self): self.requires("pthreads4w/3.0.0") def source(self): - tools.get(**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) - cmake = self._configure_cmake() - cmake.build() + 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_TESTING"] = False - self._cmake.definitions["BUILD_DOCS"] = False - self._cmake.definitions["WITH_NTL"] = False + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["BUILD_TESTING"] = False + tc.cache_variables["BUILD_DOCS"] = False + tc.cache_variables["WITH_NTL"] = False # IPO/LTO breaks clang builds - self._cmake.definitions["IPO_SUPPORTED"] = False + tc.cache_variables["IPO_SUPPORTED"] = False # No BLAS yet - self._cmake.definitions["CMAKE_DISABLE_FIND_PACKAGE_CBLAS"] = True + tc.cache_variables["CMAKE_DISABLE_FIND_PACKAGE_CBLAS"] = True # handle run in a cross-build - if tools.cross_building(self): - self._cmake.definitions["FLINT_USES_POPCNT_EXITCODE"] = "1" - self._cmake.definitions["FLINT_USES_POPCNT_EXITCODE__TRYRUN_OUTPUT"] = "" - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + if cross_building(self): + tc.cache_variables["FLINT_USES_POPCNT_EXITCODE"] = "1" + tc.cache_variables["FLINT_USES_POPCNT_EXITCODE__TRYRUN_OUTPUT"] = "" + tc.generate() + + deps = CMakeDeps(self) + if Version(self.version) <= "3.0.1": + deps.set_property("pthreads4w", "cmake_file_name", "PThreads") + else: + # https://github.com/flintlib/flint/commit/c6cc1078cb55903b0853fb1b6dc660887842dadf + deps.set_property("pthreads4w", "cmake_file_name", "PThreads4W") + deps.set_property("pthreads4w", "cmake_target_name", "PThreads4W::PThreads4W") + deps.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "MPFR_", "mpfr_") + + 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, "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.names["cmake_find_package"] = "libflint" - self.cpp_info.names["cmake_find_package_multi"] = "libflint" + self.cpp_info.set_property("cmake_file_name", "libflint") + self.cpp_info.set_property("cmake_target_name", "libflint::libflint") if self.settings.os in ("FreeBSD", "Linux"): self.cpp_info.system_libs = ["pthread", "m"] self.cpp_info.includedirs.append(os.path.join("include", "flint")) - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = ["flint"] + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.names["cmake_find_package"] = "libflint" + self.cpp_info.names["cmake_find_package_multi"] = "libflint" diff --git a/recipes/flint/all/patches/0001-cmake-2.8.1.patch b/recipes/flint/all/patches/0001-cmake-2.8.1.patch deleted file mode 100644 index bfb50ddd978c7..0000000000000 --- a/recipes/flint/all/patches/0001-cmake-2.8.1.patch +++ /dev/null @@ -1,63 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 2616d0669..6fa4cf5f7 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -46,7 +46,10 @@ endif() - # pthread configuration - - if(MSVC) -- find_package(PThreads REQUIRED) -+ #find_package(PThreads REQUIRED) -+ set(PThreads_FOUND TRUE) -+ set(PThreads_LIBRARIES "${CONAN_LIBS_PTHREADS4W}") -+ set(PThreads_INCLUDE_DIRS "${CONAN_INCLUDE_DIRS_PTHREADS4W}") - set(FLINT_USES_PTHREAD ON CACHE BOOL "Use POSIX Threads.") - else() - option(CMAKE_THREAD_PREFER_PTHREAD "Prefer pthreads" yes) -@@ -101,9 +104,9 @@ set(HEADERS - ) - - foreach (build_dir IN LISTS BUILD_DIRS TEMPLATE_DIRS) -- file(GLOB TEMP RELATIVE "${CMAKE_SOURCE_DIR}" "${build_dir}/*.c") -+ file(GLOB TEMP RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${build_dir}/*.c") - list(APPEND SOURCES ${TEMP}) -- file(GLOB TEMP RELATIVE "${CMAKE_SOURCE_DIR}" "${build_dir}/*.h") -+ file(GLOB TEMP RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${build_dir}/*.h") - list(APPEND HEADERS ${TEMP}) - endforeach () - -@@ -112,7 +115,7 @@ execute_process( - " - from os.path import join - --with open(join('${CMAKE_SOURCE_DIR}','qadic', 'CPimport.txt')) as fin: -+with open(join('${CMAKE_CURRENT_SOURCE_DIR}','qadic', 'CPimport.txt')) as fin: - with open('CPimport.h.in', 'w+') as fout: - while True: - l = fin.readline() -@@ -212,14 +215,14 @@ endif() - set(TEMP ${HEADERS}) - set(HEADERS ) - foreach(header IN LISTS TEMP) -- if(EXISTS ${CMAKE_SOURCE_DIR}/${header}) -+ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${header}) - list(APPEND HEADERS ${header}) - else() -- list(APPEND HEADERS ${CMAKE_BINARY_DIR}/${header}) -+ list(APPEND HEADERS ${CMAKE_CURRENT_BINARY_DIR}/${header}) - endif() - endforeach() - --file(GLOB TEMP "${CMAKE_SOURCE_DIR}/*.h") -+file(GLOB TEMP "${CMAKE_CURRENT_SOURCE_DIR}/*.h") - list(APPEND HEADERS ${TEMP}) - - add_library(flint ${SOURCES}) -@@ -236,6 +239,7 @@ endif() - target_include_directories(flint PUBLIC - ${CMAKE_CURRENT_SOURCE_DIR} ${GMP_INCLUDE_DIRS} ${MPFR_INCLUDE_DIRS} - ${CMAKE_CURRENT_BINARY_DIR} ${PThreads_INCLUDE_DIRS} -+ ${CMAKE_BINARY_DIR} - ${NTL_INCLUDE_DIR} - ) - diff --git a/recipes/flint/all/patches/0001-cmake.patch b/recipes/flint/all/patches/0001-cmake.patch deleted file mode 100644 index 9e5780c52e94b..0000000000000 --- a/recipes/flint/all/patches/0001-cmake.patch +++ /dev/null @@ -1,63 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 11ff789a7..80a45f90f 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -46,7 +46,10 @@ endif() - # pthread configuration - - if(MSVC) -- find_package(PThreads REQUIRED) -+ #find_package(PThreads REQUIRED) -+ set(PThreads_FOUND TRUE) -+ set(PThreads_LIBRARIES "${CONAN_LIBS_PTHREADS4W}") -+ set(PThreads_INCLUDE_DIRS "${CONAN_INCLUDE_DIRS_PTHREADS4W}") - set(FLINT_USES_PTHREAD ON CACHE BOOL "Use POSIX Threads.") - else() - option(CMAKE_THREAD_PREFER_PTHREAD "Prefer pthreads" yes) -@@ -99,9 +102,9 @@ set(HEADERS - ) - - foreach (build_dir IN LISTS BUILD_DIRS TEMPLATE_DIRS) -- file(GLOB TEMP RELATIVE "${CMAKE_SOURCE_DIR}" "${build_dir}/*.c") -+ file(GLOB TEMP RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${build_dir}/*.c") - list(APPEND SOURCES ${TEMP}) -- file(GLOB TEMP RELATIVE "${CMAKE_SOURCE_DIR}" "${build_dir}/*.h") -+ file(GLOB TEMP RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${build_dir}/*.h") - list(APPEND HEADERS ${TEMP}) - endforeach () - -@@ -110,7 +113,7 @@ execute_process( - " - from os.path import join - --with open(join('${CMAKE_SOURCE_DIR}','qadic', 'CPimport.txt')) as fin: -+with open(join('${CMAKE_CURRENT_SOURCE_DIR}','qadic', 'CPimport.txt')) as fin: - with open('CPimport.h.in', 'w+') as fout: - while True: - l = fin.readline() -@@ -210,14 +213,14 @@ endif() - set(TEMP ${HEADERS}) - set(HEADERS ) - foreach(header IN LISTS TEMP) -- if(EXISTS ${CMAKE_SOURCE_DIR}/${header}) -+ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${header}) - list(APPEND HEADERS ${header}) - else() -- list(APPEND HEADERS ${CMAKE_BINARY_DIR}/${header}) -+ list(APPEND HEADERS ${CMAKE_CURRENT_BINARY_DIR}/${header}) - endif() - endforeach() - --file(GLOB TEMP "${CMAKE_SOURCE_DIR}/*.h") -+file(GLOB TEMP "${CMAKE_CURRENT_SOURCE_DIR}/*.h") - list(APPEND HEADERS ${TEMP}) - - add_library(flint ${SOURCES}) -@@ -234,6 +237,7 @@ endif() - target_include_directories(flint PUBLIC - ${CMAKE_CURRENT_SOURCE_DIR} ${GMP_INCLUDE_DIRS} ${MPFR_INCLUDE_DIRS} - ${CMAKE_CURRENT_BINARY_DIR} ${PThreads_INCLUDE_DIRS} -+ ${CMAKE_BINARY_DIR} - ${NTL_INCLUDE_DIR} - ) - diff --git a/recipes/flint/all/test_package/CMakeLists.txt b/recipes/flint/all/test_package/CMakeLists.txt index e0200ac7628d3..735196242a02e 100644 --- a/recipes/flint/all/test_package/CMakeLists.txt +++ b/recipes/flint/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(libflint REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/flint/all/test_package/conanfile.py b/recipes/flint/all/test_package/conanfile.py index b6a26067f365d..ef5d7042163ec 100644 --- a/recipes/flint/all/test_package/conanfile.py +++ b/recipes/flint/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/flint/all/test_v1_package/CMakeLists.txt b/recipes/flint/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/flint/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/exiv2/all/test_v1_package/conanfile.py b/recipes/flint/all/test_v1_package/conanfile.py similarity index 100% rename from recipes/exiv2/all/test_v1_package/conanfile.py rename to recipes/flint/all/test_v1_package/conanfile.py diff --git a/recipes/flint/config.yml b/recipes/flint/config.yml index fed2a63c4da2b..db7f74434bfa0 100644 --- a/recipes/flint/config.yml +++ b/recipes/flint/config.yml @@ -1,5 +1,9 @@ versions: - "2.8.1": + "3.0.1": + folder: all + "2.9.0": + folder: all + "2.8.5": folder: all "2.7.1": folder: all diff --git a/recipes/fltk/all/CMakeLists.txt b/recipes/fltk/all/CMakeLists.txt deleted file mode 100644 index 60dd71d7363c3..0000000000000 --- a/recipes/fltk/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8) -project(cmake_wrapper) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory(source_subfolder) diff --git a/recipes/fltk/all/conandata.yml b/recipes/fltk/all/conandata.yml index 1b3f085545004..680f83f1fe74a 100644 --- a/recipes/fltk/all/conandata.yml +++ b/recipes/fltk/all/conandata.yml @@ -1,13 +1,16 @@ sources: + "1.3.9": + url: "https://github.com/fltk/fltk/archive/refs/tags/release-1.3.9.tar.gz" + sha256: "f30661851a61f1931eaaceb9ef4005584c85cb07fd7ffc38a645172b8e4eb3df" "1.3.8": url: "https://github.com/fltk/fltk/archive/refs/tags/release-1.3.8.tar.gz" sha256: "abddf697bf1b0a59462a0d2ec57557f4bfb9c634627e6fa50d8c664112642811" patches: + "1.3.9": + - patch_file: "patches/1.3.8-0001-remove-fluid.patch" + - patch_file: "patches/1.3.8-0003-build-static-only-on-static.patch" "1.3.8": - - base_path: "source_subfolder" - patch_file: "patches/1.3.8-0001-remove-fluid.patch" - - base_path: "source_subfolder" - patch_file: "patches/1.3.8-0002-fix-resources.patch" - - base_path: "source_subfolder" - patch_file: "patches/1.3.8-0003-build-static-only-on-static.patch" + - patch_file: "patches/1.3.8-0001-remove-fluid.patch" + - patch_file: "patches/1.3.8-0002-fix-resources.patch" + - patch_file: "patches/1.3.8-0003-build-static-only-on-static.patch" diff --git a/recipes/fltk/all/conanfile.py b/recipes/fltk/all/conanfile.py index f086bb805af59..57f2437f1fe63 100644 --- a/recipes/fltk/all/conanfile.py +++ b/recipes/fltk/all/conanfile.py @@ -1,15 +1,24 @@ -from conans import CMake, ConanFile, tools import os -required_conan_version = ">=1.43.0" +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, collect_libs, copy, export_conandata_patches, get, rm, rmdir +from conan.tools.microsoft import msvc_runtime_flag +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" + class FltkConan(ConanFile): name = "fltk" description = "Fast Light Toolkit is a cross-platform C++ GUI toolkit" - topics = ("fltk", "gui") - homepage = "https://www.fltk.org" + license = "LGPL-2.1-or-later WITH FLTK-exception" url = "https://github.com/conan-io/conan-center-index" - license = "LGPL-2.0-custom" + homepage = "https://www.fltk.org" + topics = ("gui",) + + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -17,6 +26,8 @@ class FltkConan(ConanFile): "with_gl": [True, False], "with_threads": [True, False], "with_gdiplus": [True, False], + "abi_version": ["ANY"], + "with_xft": [True, False], } default_options = { "shared": False, @@ -24,95 +35,126 @@ class FltkConan(ConanFile): "with_gl": True, "with_threads": True, "with_gdiplus": True, + "with_xft": False, } - generators = "cmake", "cmake_find_package_multi" @property - def _source_subfolder(self): - return "source_subfolder" + def _is_cl_like(self): + return self.settings.compiler.get_safe("runtime") is not None + + @property + def _is_cl_like_static_runtime(self): + return self._is_cl_like and "MT" in msvc_runtime_flag(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": del self.options.fPIC else: - del self.options.with_gdiplus + self.options.rm_safe("with_gdiplus") + + if self.options.abi_version == None: + _version_token = self.version.split(".") + _version_major = int(_version_token[0]) + if len(_version_token) >= 3: + _version_minor = int(_version_token[1]) + _version_patch = int(_version_token[2]) + elif len(_version_token) >= 2: + _version_minor = int(_version_token[1]) + _version_patch = 0 + self.options.abi_version = str( + int(_version_major) * 10000 + int(_version_minor) * 100 + int(_version_patch) + ) 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("libjpeg/9d") - self.requires("libpng/1.6.37") - if self.settings.os == "Linux": - self.requires("opengl/system") - self.requires("glu/system") - self.requires("fontconfig/2.13.93") + self.requires("zlib/[>=1.2.11 <2]") + self.requires("libjpeg/9e") + self.requires("libpng/[>=1.6 <2]") + if self.settings.os in ["Linux", "FreeBSD"]: + if self.options.with_gl: + self.requires("opengl/system") + self.requires("glu/system") + self.requires("fontconfig/2.15.0") self.requires("xorg/system") + if self.options.with_xft: + self.requires("libxft/2.3.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], strip_root=True) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions['OPTION_BUILD_SHARED_LIBS'] = self.options.shared - cmake.definitions['FLTK_BUILD_TEST'] = False - cmake.definitions['FLTK_BUILD_EXAMPLES'] = False - cmake.definitions['OPTION_USE_GL'] = self.options.with_gl - cmake.definitions['OPTION_USE_THREADS'] = self.options.with_threads - cmake.definitions['OPTION_BUILD_HTML_DOCUMENTATION'] = False - cmake.definitions['OPTION_BUILD_PDF_DOCUMENTATION'] = False - cmake.configure() - return cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["OPTION_BUILD_SHARED_LIBS"] = self.options.shared + tc.variables["FLTK_BUILD_TEST"] = False + tc.variables["FLTK_BUILD_EXAMPLES"] = False + tc.variables["OPTION_USE_GL"] = self.options.with_gl + tc.variables["OPTION_USE_THREADS"] = self.options.with_threads + tc.variables["OPTION_BUILD_HTML_DOCUMENTATION"] = False + tc.variables["OPTION_BUILD_PDF_DOCUMENTATION"] = False + tc.variables["OPTION_USE_XFT"] = self.options.with_xft + if self.options.abi_version: + tc.variables["OPTION_ABI_VERSION"] = self.options.abi_version + tc.variables["OPTION_USE_SYSTEM_LIBJPEG"] = True + tc.variables["OPTION_USE_SYSTEM_ZLIB"] = True + tc.variables["OPTION_USE_SYSTEM_LIBPNG"] = True + if Version(self.version) >= "1.3.9": + if self._is_cl_like: + tc.variables["FLTK_MSVC_RUNTIME_DLL"] = not self._is_cl_like_static_runtime - def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + tc.generate() + tc = CMakeDeps(self) + tc.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="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, "FLTK.framework")) - tools.rmdir(os.path.join(self.package_folder, "CMake")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), "fltk-config*") + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "FLTK.framework")) + rmdir(self, os.path.join(self.package_folder, "CMake")) + rm(self, "fltk-config*", os.path.join(self.package_folder, "bin")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "fltk") self.cpp_info.set_property("cmake_target_name", "fltk::fltk") + self.cpp_info.libs = collect_libs(self) - self.cpp_info.names["cmake_find_package"] = "fltk" - self.cpp_info.names["cmake_find_package_multi"] = "fltk" - - if self.options.shared and self.settings.os == "Windows": - self.cpp_info.defines.append("FL_DLL") - self.cpp_info.libs = tools.collect_libs(self) if self.settings.os in ("Linux", "FreeBSD"): if self.options.with_threads: - self.cpp_info.system_libs.extend(['pthread', 'dl']) + self.cpp_info.system_libs.extend(["pthread", "dl"]) if self.options.with_gl: - self.cpp_info.system_libs.extend(['GL', 'GLU']) - if self.settings.os == "Macos": - self.cpp_info.frameworks = ['Cocoa', 'OpenGL', 'IOKit', 'Carbon', 'CoreFoundation', 'CoreVideo'] - if self.settings.os == "Windows": - self.cpp_info.system_libs = [ - "gdi32", - "imm32", - "msimg32", - "ole32", - "oleaut32", - "uuid", + self.cpp_info.system_libs.extend(["GL", "GLU"]) + elif is_apple_os(self): + self.cpp_info.frameworks = [ + "AppKit", "ApplicationServices", "Carbon", "Cocoa", "CoreFoundation", "CoreGraphics", + "CoreText", "CoreVideo", "Foundation", "IOKit", ] + if self.options.with_gl: + self.cpp_info.frameworks.append("OpenGL") + elif self.settings.os == "Windows": + if self.options.shared: + self.cpp_info.defines.append("FL_DLL") + self.cpp_info.system_libs = ["gdi32", "imm32", "msimg32", "ole32", "oleaut32", "uuid", "comctl32"] if self.options.get_safe("with_gdiplus"): self.cpp_info.system_libs.append("gdiplus") + if self.options.with_gl: + self.cpp_info.system_libs.append("opengl32") + + # TODO: to remove in conan v2 once legacy generators removed + self.cpp_info.names["cmake_find_package"] = "fltk" + self.cpp_info.names["cmake_find_package_multi"] = "fltk" diff --git a/recipes/fltk/all/test_package/CMakeLists.txt b/recipes/fltk/all/test_package/CMakeLists.txt index a163bc26a443b..cf30c297c5531 100644 --- a/recipes/fltk/all/test_package/CMakeLists.txt +++ b/recipes/fltk/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.15) +project(test_package LANGUAGES CXX) find_package(fltk REQUIRED CONFIG) diff --git a/recipes/fltk/all/test_package/conanfile.py b/recipes/fltk/all/test_package/conanfile.py index a500b98343c74..ef5d7042163ec 100644 --- a/recipes/fltk/all/test_package/conanfile.py +++ b/recipes/fltk/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", "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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/fltk/all/test_v1_package/CMakeLists.txt b/recipes/fltk/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/fltk/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/fltk/all/test_v1_package/conanfile.py b/recipes/fltk/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..a500b98343c74 --- /dev/null +++ b/recipes/fltk/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/fltk/config.yml b/recipes/fltk/config.yml index 76eba86fa7f6d..358eb3f39989f 100644 --- a/recipes/fltk/config.yml +++ b/recipes/fltk/config.yml @@ -1,3 +1,5 @@ versions: + "1.3.9": + folder: "all" "1.3.8": folder: "all" diff --git a/recipes/flux/all/conandata.yml b/recipes/flux/all/conandata.yml new file mode 100644 index 0000000000000..0e08f22b473ce --- /dev/null +++ b/recipes/flux/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "0.4.0": + url: "https://github.com/tcbrindle/flux/archive/refs/tags/v0.4.0.zip" + sha256: "d17c656934688e085197eb6bd576a2e468d2b513c4f3be60121b8863c0830e13" + "cci.20240115": + url: "https://codeload.github.com/tcbrindle/flux/zip/e942a678ed3b46c7f7ffeebe47eed5c5bec005b2" + sha256: "3832fb160417d14cfb3636c8edab04b2d0cd6c230b4d474a18bb1389fa1c3b8f" diff --git a/recipes/flux/all/conanfile.py b/recipes/flux/all/conanfile.py new file mode 100644 index 0000000000000..275dd18e535b9 --- /dev/null +++ b/recipes/flux/all/conanfile.py @@ -0,0 +1,77 @@ +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.52.0" + + +class PackageConan(ConanFile): + name = "flux" + description = ("Flux is an experimental C++20 library for working with sequences of values. " + "It offers similar facilities to C++20 ranges, D ranges, Python itertools, " + "Rust iterators and related libraries for other languages.") + license = "BSL-1.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/tcbrindle/flux" + topics = ("algorithms", "collections", "sequences", "ranges", "header-only") + + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _min_cppstd(self): + # https://github.com/tcbrindle/flux/blob/e942a678/CMakeLists.txt#L21 + if is_msvc(self): + return 23 + return 20 + + @property + def _compilers_minimum_version(self): + # https://github.com/tcbrindle/flux?tab=readme-ov-file#compiler-support + return { + "apple-clang": "15", + "clang": "16", + "gcc": "11", + "msvc": "193", + "Visual Studio": "17", + } + + 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 build(self): + pass + + def package(self): + copy(self, "LICENSE_1_0.txt", 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.set_property("cmake_file_name", "flux") + self.cpp_info.set_property("cmake_target_name", "flux::flux") + + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + diff --git a/recipes/flux/all/test_package/CMakeLists.txt b/recipes/flux/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..584da8ad2d297 --- /dev/null +++ b/recipes/flux/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(flux REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE flux::flux) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) diff --git a/recipes/flux/all/test_package/conanfile.py b/recipes/flux/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/flux/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/flux/all/test_package/test_package.cpp b/recipes/flux/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..54a70bdd39bbc --- /dev/null +++ b/recipes/flux/all/test_package/test_package.cpp @@ -0,0 +1,9 @@ +#include + +int main() { + constexpr auto result = flux::from(std::array{1, 2, 3, 4, 5}) + .filter(flux::pred::even) + .map([](int i) { return i * 2; }) + .sum(); + static_assert(result == 12); +} diff --git a/recipes/flux/config.yml b/recipes/flux/config.yml new file mode 100644 index 0000000000000..e1fec433b2cec --- /dev/null +++ b/recipes/flux/config.yml @@ -0,0 +1,5 @@ +versions: + "0.4.0": + folder: all + "cci.20240115": + folder: all diff --git a/recipes/fmi1/all/conandata.yml b/recipes/fmi1/all/conandata.yml new file mode 100644 index 0000000000000..3605e7f8bb5d7 --- /dev/null +++ b/recipes/fmi1/all/conandata.yml @@ -0,0 +1,10 @@ +sources: + "1.0.1": + co-simulation: + url: + - https://fmi-standard.org/assets/releases/FMI_for_CoSimulation_v1.0.1.zip + sha256: "81c87527febece29b5bb00bac89f9a58c5aed976aeb0afbfd357cf5aeebabd21" + model-exchange: + url: + - https://fmi-standard.org/assets/releases/FMI_for_ModelExchange_v1.0.1.zip + sha256: "966c948707531c5a764b70fa7bbe23030da962d8a939e01dc8bc9af9d8264cd1" diff --git a/recipes/fmi1/all/conanfile.py b/recipes/fmi1/all/conanfile.py new file mode 100644 index 0000000000000..e0cf988f8107d --- /dev/null +++ b/recipes/fmi1/all/conanfile.py @@ -0,0 +1,72 @@ +from os import path +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 + +required_conan_version = ">=1.52.0" + + +class PackageConan(ConanFile): + name = "fmi1" + description = "Functional Mock-up Interface (FMI) for Co-Simulation" + license = "BSD-2-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://fmi-standard.org" + topics = ("fmi-standard", "co-simulation", "model-exchange", "header-only") + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True # True OK because patch only adds new file + + def _extract_copyright(self): + fmiFunctions_h = load(self, path.join(self.source_folder, "cosim", "fmiFunctions.h")) + copyright_start = "Copyright(c)" + copyright_end = "DAMAGE." + start_index = fmiFunctions_h.find(copyright_start) + stop_index = fmiFunctions_h.find(copyright_end) + if start_index == -1 or stop_index == -1: + raise ConanException("Could not extract license from fmiFunctions.h file.") + return fmiFunctions_h[start_index:stop_index+len(copyright_end)] + + 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]["co-simulation"], + destination="cosim", strip_root=True) + get(self, **self.conan_data["sources"][self.version]["model-exchange"], + destination="modex", strip_root=True) + + def build(self): + pass + + def package(self): + save(self, path.join(self.package_folder, "licenses", "LICENSE"), self._extract_copyright()) + for comp in ["modex", "cosim"]: + copy( + self, + pattern="*.h", + src=path.join(self.source_folder, comp), + dst=path.join(self.package_folder, "include", comp) + ) + copy( + self, + pattern="*.xsd", + src=path.join(self.source_folder, comp), + dst=path.join(self.package_folder, "res", comp) + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = ["res"] + + self.cpp_info.components["cosim"].set_property("cmake_target_name", "fmi1::cosim") + self.cpp_info.components["cosim"].includedirs = ["include/cosim"] + self.cpp_info.components["cosim"].resdirs = ["res/cosim"] + self.cpp_info.components["modex"].set_property("cmake_target_name", "fmi1::modex") + self.cpp_info.components["modex"].includedirs = ["include/modex"] + self.cpp_info.components["modex"].resdirs = ["res/modex"] diff --git a/recipes/fmi1/all/test_package/CMakeLists.txt b/recipes/fmi1/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..7e700e5046782 --- /dev/null +++ b/recipes/fmi1/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C CXX) + +find_package(fmi1 REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE fmi1::cosim) diff --git a/recipes/fmi1/all/test_package/conanfile.py b/recipes/fmi1/all/test_package/conanfile.py new file mode 100644 index 0000000000000..e730ad6dc0dfc --- /dev/null +++ b/recipes/fmi1/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 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/fmi1/all/test_package/test_package.cpp b/recipes/fmi1/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..96872e2ca1ec7 --- /dev/null +++ b/recipes/fmi1/all/test_package/test_package.cpp @@ -0,0 +1,10 @@ +#include +#include +#include "fmiFunctions.h" + + +int main(void) { + std::cout << fmiVersion << std::endl; + + return EXIT_SUCCESS; +} diff --git a/recipes/fmi1/config.yml b/recipes/fmi1/config.yml new file mode 100644 index 0000000000000..715e55357a17b --- /dev/null +++ b/recipes/fmi1/config.yml @@ -0,0 +1,3 @@ +versions: + "1.0.1": + folder: all diff --git a/recipes/fmi2/all/conandata.yml b/recipes/fmi2/all/conandata.yml new file mode 100644 index 0000000000000..ca22c244cd704 --- /dev/null +++ b/recipes/fmi2/all/conandata.yml @@ -0,0 +1,5 @@ +sources: + "2.0.4": + url: + - https://github.com/modelica/fmi-standard/releases/download/v2.0.4/FMI-Standard-2.0.4.zip + sha256: "79abb211052d28354a0efff0c6b1998b60a973dd75fdcb338db99ae1b970c9b2" diff --git a/recipes/fmi2/all/conanfile.py b/recipes/fmi2/all/conanfile.py new file mode 100644 index 0000000000000..816be50f782af --- /dev/null +++ b/recipes/fmi2/all/conanfile.py @@ -0,0 +1,50 @@ +from os import path +from conan import ConanFile +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout + +required_conan_version = ">=1.52.0" + + +class PackageConan(ConanFile): + name = "fmi2" + description = "Functional Mock-up Interface (FMI)" + license = "BSD-2-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://fmi-standard.org" + topics = ("fmi-standard", "co-simulation", "model-exchange", "header-only") + package_type = "header-library" + 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], strip_root=False) + + def build(self): + pass + + def package(self): + copy(self, pattern="LICENSE.txt", dst=path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, + pattern="*.h", + src=path.join(self.source_folder, "headers"), + dst=path.join(self.package_folder, "include"), + ) + copy( + self, + pattern="*.xsd", + src=path.join(self.source_folder, "schema"), + dst=path.join(self.package_folder, "res"), + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = ["res"] diff --git a/recipes/fmi2/all/test_package/CMakeLists.txt b/recipes/fmi2/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..7332dbc8b5197 --- /dev/null +++ b/recipes/fmi2/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C CXX) + +find_package(fmi2 REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE fmi2::fmi2) diff --git a/recipes/fmi2/all/test_package/conanfile.py b/recipes/fmi2/all/test_package/conanfile.py new file mode 100644 index 0000000000000..e730ad6dc0dfc --- /dev/null +++ b/recipes/fmi2/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 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/fmi2/all/test_package/test_package.cpp b/recipes/fmi2/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..ec96970349ed1 --- /dev/null +++ b/recipes/fmi2/all/test_package/test_package.cpp @@ -0,0 +1,10 @@ +#include +#include +#include "fmi2Functions.h" + + +int main(void) { + std::cout << fmi2Version << std::endl; + + return EXIT_SUCCESS; +} diff --git a/recipes/fmi2/config.yml b/recipes/fmi2/config.yml new file mode 100644 index 0000000000000..1f2301f1f0282 --- /dev/null +++ b/recipes/fmi2/config.yml @@ -0,0 +1,3 @@ +versions: + "2.0.4": + folder: all diff --git a/recipes/fmi3/all/conandata.yml b/recipes/fmi3/all/conandata.yml new file mode 100644 index 0000000000000..b12c4c988ee8b --- /dev/null +++ b/recipes/fmi3/all/conandata.yml @@ -0,0 +1,5 @@ +sources: + "3.0.1": + url: + - https://github.com/modelica/fmi-standard/releases/download/v3.0.1/FMI-Standard-3.0.1.zip + sha256: "181a8a377ccfafa92167019bd3099227f8bf44192444bcb1a2d42aba65fbffe2" diff --git a/recipes/fmi3/all/conanfile.py b/recipes/fmi3/all/conanfile.py new file mode 100644 index 0000000000000..3d5c1d773f7ef --- /dev/null +++ b/recipes/fmi3/all/conanfile.py @@ -0,0 +1,50 @@ +from os import path +from conan import ConanFile +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout + +required_conan_version = ">=1.52.0" + + +class PackageConan(ConanFile): + name = "fmi3" + description = "Functional Mock-up Interface (FMI)" + license = "BSD-2-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://fmi-standard.org" + topics = ("fmi-standard", "co-simulation", "model-exchange", "scheduled execution", "header-only") + package_type = "header-library" + 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], strip_root=False) + + def build(self): + pass + + def package(self): + copy(self, pattern="LICENSE.txt", dst=path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, + pattern="*.h", + src=path.join(self.source_folder, "headers"), + dst=path.join(self.package_folder, "include"), + ) + copy( + self, + pattern="*.xsd", + src=path.join(self.source_folder, "schema"), + dst=path.join(self.package_folder, "res"), + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = ["res"] diff --git a/recipes/fmi3/all/test_package/CMakeLists.txt b/recipes/fmi3/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..24b88e3db471d --- /dev/null +++ b/recipes/fmi3/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C CXX) + +find_package(fmi3 REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE fmi3::fmi3) diff --git a/recipes/fmi3/all/test_package/conanfile.py b/recipes/fmi3/all/test_package/conanfile.py new file mode 100644 index 0000000000000..e730ad6dc0dfc --- /dev/null +++ b/recipes/fmi3/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 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/fmi3/all/test_package/test_package.cpp b/recipes/fmi3/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..ea4bf3fd0194a --- /dev/null +++ b/recipes/fmi3/all/test_package/test_package.cpp @@ -0,0 +1,10 @@ +#include +#include +#include "fmi3Functions.h" + + +int main(void) { + std::cout << fmi3Version << std::endl; + + return EXIT_SUCCESS; +} diff --git a/recipes/fmi3/config.yml b/recipes/fmi3/config.yml new file mode 100644 index 0000000000000..f1eca9cdf76de --- /dev/null +++ b/recipes/fmi3/config.yml @@ -0,0 +1,3 @@ +versions: + "3.0.1": + folder: all diff --git a/recipes/fmt/all/conandata.yml b/recipes/fmt/all/conandata.yml index 226084f79cbb0..5ec660a369fa8 100644 --- a/recipes/fmt/all/conandata.yml +++ b/recipes/fmt/all/conandata.yml @@ -1,25 +1,49 @@ sources: + "11.0.2": + url: "https://github.com/fmtlib/fmt/releases/download/11.0.2/fmt-11.0.2.zip" + sha256: "40fc58bebcf38c759e11a7bd8fdc163507d2423ef5058bba7f26280c5b9c5465" + "11.0.1": + url: "https://github.com/fmtlib/fmt/releases/download/11.0.1/fmt-11.0.1.zip" + sha256: "62ca45531814109b5d6cef0cf2fd17db92c32a30dd23012976e768c685534814" + "11.0.0": + url: "https://github.com/fmtlib/fmt/releases/download/11.0.0/fmt-11.0.0.zip" + sha256: "583ce480ef07fad76ef86e1e2a639fc231c3daa86c4aa6bcba524ce908f30699" + "10.2.1": + url: "https://github.com/fmtlib/fmt/releases/download/10.2.1/fmt-10.2.1.zip" + sha256: "312151a2d13c8327f5c9c586ac6cf7cddc1658e8f53edae0ec56509c8fa516c9" + "10.2.0": + url: "https://github.com/fmtlib/fmt/releases/download/10.2.0/fmt-10.2.0.zip" + sha256: "8a942861a94f8461a280f823041cde8f620a6d8b0e0aacc98c15bb5a9dd92399" + "10.1.1": + url: "https://github.com/fmtlib/fmt/releases/download/10.1.1/fmt-10.1.1.zip" + sha256: "b84e58a310c9b50196cda48d5678d5fa0849bca19e5fdba6b684f0ee93ed9d1b" + "10.1.0": + url: "https://github.com/fmtlib/fmt/releases/download/10.1.0/fmt-10.1.0.zip" + sha256: "d725fa83a8b57a3cedf238828fa6b167f963041e8f9f7327649bddc68ae316f4" + "10.0.0": + url: "https://github.com/fmtlib/fmt/releases/download/10.0.0/fmt-10.0.0.zip" + sha256: "4943cb165f3f587f26da834d3056ee8733c397e024145ca7d2a8a96bb71ac281" "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/archive/9.0.0.tar.gz" - sha256: "9a1e0e9e843a356d65c7604e2c8bf9402b50fe294c355de0095ebd42fb9bd2c5" + 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/archive/8.1.1.tar.gz" - sha256: "3d794d3cf67633b34b2771eb9f073bde87e846e0d395d254df7b211ef1ec7346" + 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/archive/8.0.1.tar.gz" - sha256: "b06ca3130158c625848f3fb7418f235155a4d389b2abc3a6245fb01cb0eb1e01" + url: "https://github.com/fmtlib/fmt/releases/download/8.0.1/fmt-8.0.1.zip" + sha256: "a627a56eab9554fc1e5dd9a623d0768583b3a383ff70a4312ba68f94c9d415bf" "7.1.3": - sha256: 5cae7072042b3043e12d53d50ef404bbb76949dad1de368d7f993a15c8c05ecc - url: https://github.com/fmtlib/fmt/archive/7.1.3.tar.gz + url: "https://github.com/fmtlib/fmt/releases/download/7.1.3/fmt-7.1.3.zip" + sha256: "5d98c504d0205f912e22449ecdea776b78ce0bb096927334f80781e720084c9f" "6.2.1": - sha256: 5edf8b0f32135ad5fafb3064de26d063571e95e8ae46829c2f4f4b52696bbff0 - url: https://github.com/fmtlib/fmt/archive/6.2.1.tar.gz + url: "https://github.com/fmtlib/fmt/releases/download/6.2.1/fmt-6.2.1.zip" + sha256: "94fea742ddcccab6607b517f6e608b1e5d63d712ddbc5982e44bafec5279881a" "5.3.0": - sha256: defa24a9af4c622a7134076602070b45721a43c51598c8456ec6f2c4dbb51c89 - url: https://github.com/fmtlib/fmt/archive/5.3.0.tar.gz + 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 66516fa1027c3..86da321d03862 100644 --- a/recipes/fmt/all/conanfile.py +++ b/recipes/fmt/all/conanfile.py @@ -6,17 +6,19 @@ from conan.tools.layout import basic_layout from conan.tools.build import check_min_cppstd from conan.tools.scm import Version +from conan.tools.microsoft import is_msvc -required_conan_version = ">=1.52.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 = ("format", "iostream", "printf") - url = "https://github.com/conan-io/conan-center-index" license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/fmtlib/fmt" + topics = ("format", "iostream", "printf") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "header_only": [True, False], @@ -24,6 +26,7 @@ class FmtConan(ConanFile): "fPIC": [True, False], "with_fmt_alias": [True, False], "with_os_api": [True, False], + "with_unicode": [True, False], } default_options = { "header_only": False, @@ -31,32 +34,20 @@ class FmtConan(ConanFile): "fPIC": True, "with_fmt_alias": False, "with_os_api": True, + "with_unicode": True, } @property def _has_with_os_api_option(self): return Version(self.version) >= "7.0.0" + @property + def _has_with_unicode_option(self): + return Version(self.version) >= "11.0.0" + def export_sources(self): export_conandata_patches(self) - 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 layout(self): - if self.options.header_only: - basic_layout(self, src_folder="src") - else: - cmake_layout(self, src_folder="src") - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC @@ -64,23 +55,22 @@ def config_options(self): del self.options.with_os_api elif str(self.settings.os) == "baremetal": self.options.with_os_api = False + if not self._has_with_unicode_option: + del self.options.with_unicode def configure(self): if self.options.header_only: - try: - del self.options.fPIC - except Exception: - pass - del self.options.shared - try: - del self.options.with_os_api - except Exception: - pass + self.options.rm_safe("fPIC") + self.options.rm_safe("shared") + self.options.rm_safe("with_os_api") elif self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + 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: @@ -89,12 +79,24 @@ def package_id(self): del self.info.options.with_fmt_alias def validate(self): - if self.info.settings.get_safe("compiler.cppstd"): + if self.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) + 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) + if self._has_with_unicode_option: + tc.cache_variables["FMT_UNICODE"] = bool(self.options.with_unicode) + tc.generate() def build(self): apply_conandata_patches(self) @@ -104,7 +106,10 @@ def build(self): cmake.build() def package(self): - copy(self, pattern="*LICENSE.rst", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + if Version(self.version) < "10.2.0": + copy(self, pattern="*LICENSE.rst", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + else: + copy(self, pattern="LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) if self.options.header_only: copy(self, pattern="*.h", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) else: @@ -121,12 +126,17 @@ def package_info(self): self.cpp_info.set_property("cmake_target_name", f"fmt::{target}") self.cpp_info.set_property("pkg_config_name", "fmt") + if self.options.get_safe("with_unicode") and is_msvc(self): + self.cpp_info.components["_fmt"].cxxflags.append("/utf-8") + # TODO: back to global scope in conan v2 once cmake_find_package* generators removed 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") + self.cpp_info.components["_fmt"].libdirs = [] + self.cpp_info.components["_fmt"].bindirs = [] else: postfix = "d" if self.settings.build_type == "Debug" else "" libname = "fmt" + postfix diff --git a/recipes/fmt/all/patches/fix-install-6.0.0.patch b/recipes/fmt/all/patches/fix-install-6.0.0.patch deleted file mode 100644 index c64f2ea628b1b..0000000000000 --- a/recipes/fmt/all/patches/fix-install-6.0.0.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -259,7 +259,9 @@ if (FMT_INSTALL) - - # Install the library and headers. - install(TARGETS ${INSTALL_TARGETS} EXPORT ${targets_export_name} -- DESTINATION ${FMT_LIB_DIR}) -+ LIBRARY DESTINATION ${FMT_LIB_DIR} -+ ARCHIVE DESTINATION ${FMT_LIB_DIR} -+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) - - install(FILES $ - DESTINATION ${FMT_LIB_DIR} OPTIONAL) diff --git a/recipes/fmt/all/patches/fix-mingw-msvc2015-export-assert-fail-6.1.0.patch b/recipes/fmt/all/patches/fix-mingw-msvc2015-export-assert-fail-6.1.0.patch deleted file mode 100644 index 4623c31cff962..0000000000000 --- a/recipes/fmt/all/patches/fix-mingw-msvc2015-export-assert-fail-6.1.0.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- a/include/fmt/core.h -+++ b/include/fmt/core.h -@@ -167,9 +167,9 @@ - - #if !defined(FMT_HEADER_ONLY) && defined(_WIN32) - # ifdef FMT_EXPORT --# define FMT_API __pragma(warning(suppress : 4275)) __declspec(dllexport) -+# define FMT_API __declspec(dllexport) - # elif defined(FMT_SHARED) --# define FMT_API __pragma(warning(suppress : 4275)) __declspec(dllimport) -+# define FMT_API __declspec(dllimport) - # define FMT_EXTERN_TEMPLATE_API FMT_API - # endif - #endif -@@ -224,7 +224,7 @@ namespace internal { - // A workaround for gcc 4.8 to make void_t work in a SFINAE context. - template struct void_t_impl { using type = void; }; - --void assert_fail(const char* file, int line, const char* message); -+FMT_API void assert_fail(const char* file, int line, const char* message); - - #ifndef FMT_ASSERT - # ifdef NDEBUG diff --git a/recipes/fmt/all/test_package/CMakeLists.txt b/recipes/fmt/all/test_package/CMakeLists.txt index a71cd67f135ec..98b237372b898 100644 --- a/recipes/fmt/all/test_package/CMakeLists.txt +++ b/recipes/fmt/all/test_package/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.15) project(test_package LANGUAGES CXX) find_package(fmt REQUIRED CONFIG) diff --git a/recipes/fmt/all/test_package/conanfile.py b/recipes/fmt/all/test_package/conanfile.py index 5fe5679b8d954..943effe9479aa 100644 --- a/recipes/fmt/all/test_package/conanfile.py +++ b/recipes/fmt/all/test_package/conanfile.py @@ -1,14 +1,17 @@ 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 + 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) @@ -17,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_package/test_package.cpp b/recipes/fmt/all/test_package/test_package.cpp index bcd009407212d..c8074af5f8eff 100644 --- a/recipes/fmt/all/test_package/test_package.cpp +++ b/recipes/fmt/all/test_package/test_package.cpp @@ -40,17 +40,15 @@ namespace fmt { 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::format_to(std::back_inserter(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); + fmt::print("The date is {}\n", Date(2012, 12, 9)); report("{} {} {}\n", "Conan", 42, 3.14159); diff --git a/recipes/fmt/all/test_v1_package/CMakeLists.txt b/recipes/fmt/all/test_v1_package/CMakeLists.txt index 925ecbe19e448..91630d79f4abb 100644 --- a/recipes/fmt/all/test_v1_package/CMakeLists.txt +++ b/recipes/fmt/all/test_v1_package/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) diff --git a/recipes/fmt/config.yml b/recipes/fmt/config.yml index 7251dde3fac9f..22c106719d701 100644 --- a/recipes/fmt/config.yml +++ b/recipes/fmt/config.yml @@ -1,4 +1,20 @@ versions: + "11.0.2": + folder: all + "11.0.1": + folder: all + "11.0.0": + folder: all + "10.2.1": + folder: all + "10.2.0": + folder: all + "10.1.1": + folder: all + "10.1.0": + folder: all + "10.0.0": + folder: all "9.1.0": folder: all "9.0.0": diff --git a/recipes/fmtlog/all/conanfile.py b/recipes/fmtlog/all/conanfile.py index e1fd99b8fca24..9bc3a7f6a4839 100644 --- a/recipes/fmtlog/all/conanfile.py +++ b/recipes/fmtlog/all/conanfile.py @@ -8,7 +8,7 @@ import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class PackageConan(ConanFile): @@ -17,7 +17,8 @@ class PackageConan(ConanFile): license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/MengRao/fmtlog" - topics = ("logging", "low-latency", "topic3") + topics = ("logging", "low-latency") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -53,10 +54,11 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") + if self.options.header_only: + self.package_type = "header-library" + self.options.rm_safe("fPIC") + self.options.rm_safe("shared") def layout(self): if self.options.header_only: @@ -65,14 +67,13 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("fmt/9.1.0") + self.requires("fmt/10.2.1", transitive_headers=True, transitive_libs=True) def package_id(self): - if self.options.header_only: + if self.info.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) @@ -80,8 +81,7 @@ def validate(self): 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): if self.options.header_only: @@ -112,6 +112,8 @@ def package(self): def package_info(self): if self.options.header_only: self.cpp_info.defines.append("FMTLOG_HEADER_ONLY") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] else: self.cpp_info.libs = ["fmtlog-shared" if self.options.shared else "fmtlog-static"] diff --git a/recipes/folly/all/CMakeLists.txt b/recipes/folly/all/CMakeLists.txt deleted file mode 100644 index 61f3d3b039e2b..0000000000000 --- a/recipes/folly/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/folly/all/conan_deps.cmake b/recipes/folly/all/conan_deps.cmake new file mode 100644 index 0000000000000..075e362b62636 --- /dev/null +++ b/recipes/folly/all/conan_deps.cmake @@ -0,0 +1,45 @@ +cmake_minimum_required(VERSION 3.17) +# Set the dependency flags expected by https://github.com/facebook/folly/blob/v2023.12.18.00/CMake/folly-deps.cmake + +macro(custom_find_package package_name variable_prefix) + find_package(${package_name} REQUIRED CONFIG ${ARGN}) + list(APPEND FROM FOUND VERSION VERSION_STRING INCLUDE_DIRS INCLUDE_DIR INCLUDE_DIR LIBRARIES LIBRARIES LIBRARIES DEFINITIONS) + list(APPEND TO FOUND VERSION VERSION_STRING INCLUDE_DIRS INCLUDE_DIR INCLUDE LIB LIBRARY LIBRARIES DEFINITIONS) + + foreach (from_substr to_substr IN ZIP_LISTS FROM TO) + set(src_var ${package_name}_${from_substr}) + set(dst_var ${variable_prefix}_${to_substr}) + if (NOT DEFINED ${src_var}) + continue() + endif() + if ((DEFINED ${dst_var}) AND ("${${dst_var}}" STREQUAL "${${src_var}}")) + # if they're equal, skip + continue() + endif() + message(DEBUG "custom_find_package definining ${dst_var} with ${src_var} contents: ${${src_var}}") + set(${dst_var} ${${src_var}}) + endforeach() +endmacro() + +custom_find_package(BZip2 BZIP2) +custom_find_package(DoubleConversion DOUBLE_CONVERSION REQUIRED) +custom_find_package(Gflags LIBGFLAGS) +custom_find_package(Glog GLOG) +custom_find_package(LZ4 LZ4) +custom_find_package(LibEvent LIBEVENT REQUIRED) +custom_find_package(LibLZMA LIBLZMA) +custom_find_package(Libsodium LIBSODIUM) +custom_find_package(OpenSSL OPENSSL REQUIRED) +custom_find_package(Snappy SNAPPY) +custom_find_package(ZLIB ZLIB) +custom_find_package(Zstd ZSTD) +custom_find_package(fmt FMT REQUIRED) + +if (NOT MSVC) + custom_find_package(LibDwarf LIBDWARF) +endif() +if (UNIX AND NOT APPLE) + custom_find_package(LibUring LIBURING) + custom_find_package(LibUnwind LIBUNWIND) + custom_find_package(Libiberty LIBIBERTY) +endif() \ No newline at end of file diff --git a/recipes/folly/all/conandata.yml b/recipes/folly/all/conandata.yml index 8fcc8945ab40d..a21030554ee04 100644 --- a/recipes/folly/all/conandata.yml +++ b/recipes/folly/all/conandata.yml @@ -1,56 +1,4 @@ sources: - "2019.10.21.00": - url: "https://github.com/facebook/folly/archive/v2019.10.21.00.tar.gz" - sha256: "6efcc2b2090691a9fe3d339c433d102d6399bbdc6dc4893080d59f15f648f393" - "2020.08.10.00": - url: "https://github.com/facebook/folly/archive/v2020.08.10.00.tar.gz" - sha256: "e81140d04a4e89e3f848e528466a9b3d3ae37d7eeb9e65467fca50d70918eef6" - "2022.01.31.00": - url: "https://github.com/facebook/folly/archive/v2022.01.31.00.tar.gz" - sha256: "d764b9a7832d967bb7cfea4bcda15d650315aa4d559fde1da2a52b015cd88b9c" -patches: - "2019.10.21.00": - - patch_file: "patches/0001-find-packages.patch" - base_path: "source_subfolder" - - patch_file: "patches/0002-compiler-flags.patch" - base_path: "source_subfolder" - - patch_file: "patches/0003-boost-shared-ptr.patch" - base_path: "source_subfolder" - - patch_file: "patches/0004-disable-posix-names.patch" - base_path: "source_subfolder" - - patch_file: "patches/0005-include-atomic.patch" - base_path: "source_subfolder" - - patch_file: "patches/0006-duplicate-hash.patch" - base_path: "source_subfolder" - - patch_file: "patches/0007-allow-builtins.patch" - base_path: "source_subfolder" - - patch_file: "patches/0013-include-bit.patch" - base_path: "source_subfolder" - - patch_file: "patches/0020-include-ssizet.patch" - base_path: "source_subfolder" - "2020.08.10.00": - - patch_file: "patches/0008-find-packages.patch" - base_path: "source_subfolder" - - patch_file: "patches/0009-ill-formed-atomic-copy.patch" - base_path: "source_subfolder" - - patch_file: "patches/0010-duplicate-hash.patch" - base_path: "source_subfolder" - - patch_file: "patches/0011-disable-logger-example.patch" - base_path: "source_subfolder" - - patch_file: "patches/0012-compiler-flags.patch" - base_path: "source_subfolder" - - patch_file: "patches/0014-find-librt.patch" - base_path: "source_subfolder" - - patch_file: "patches/0015-benchmark-format-macros.patch" - base_path: "source_subfolder" - "2022.01.31.00": - - patch_file: "patches/0016-find-packages.patch" - base_path: "source_subfolder" - - patch_file: "patches/0017-compiler-flags.patch" - base_path: "source_subfolder" - - patch_file: "patches/0018-find-glog.patch" - base_path: "source_subfolder" - - patch_file: "patches/0019-exclude-example.patch" - base_path: "source_subfolder" - - patch_file: "patches/0022-fix-windows-minmax.patch" - base_path: "source_subfolder" + "2024.08.12.00": + url: "https://github.com/facebook/folly/releases/download/v2024.08.12.00/folly-v2024.08.12.00.tar.gz" + sha256: "18d7be721721db547cb9c5dd5cc50df05cd88b0a8e683e3126ec6f9ce2c41c4d" diff --git a/recipes/folly/all/conanfile.py b/recipes/folly/all/conanfile.py index 06dc6965155a7..7b2eee5c31d02 100755 --- a/recipes/folly/all/conanfile.py +++ b/recipes/folly/all/conanfile.py @@ -1,14 +1,16 @@ -from conan.tools.microsoft import is_msvc, msvc_runtime_flag -from conan.tools.build import can_run -from conan.tools.scm import Version -from conan.tools import files from conan import ConanFile -from conans import CMake, tools from conan.errors import ConanInvalidConfiguration -import functools +from conan.tools.apple import is_apple_os +from conan.tools.build import check_min_cppstd, cross_building +from conan.tools.env import VirtualBuildEnv +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import get, copy, rmdir, replace_in_file, save, rm +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +from conan.tools.scm import Version import os -required_conan_version = ">=1.45.0" + +required_conan_version = ">=1.54.0" class FollyConan(ConanFile): @@ -19,278 +21,263 @@ class FollyConan(ConanFile): homepage = "https://github.com/facebook/folly" license = "Apache-2.0" + package_type = "library" settings = "os", "arch", "compiler", "build_type" 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" - @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 17 @property - def _minimum_cpp_standard(self): - return 17 if Version(self.version) >= "2022.01.31.00" else 14 - - @property - def _minimum_compilers_version(self): + def _compilers_minimum_version(self): + # https://github.com/facebook/folly/blob/v2024.07.08.00/folly/Portability.h return { - "Visual Studio": "15", - "gcc": "5", - "clang": "6", - "apple-clang": "8", - } if self._minimum_cpp_standard == 14 else { - "gcc": "7", + "gcc": "10", + "clang": "10", + "apple-clang": "14", + "msvc": "192", "Visual Studio": "16", - "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"]) - + copy(self, "conan_deps.cmake", self.recipe_folder, os.path.join(self.export_sources_folder, "src")) 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 + self.options.rm_safe("fPIC") + if is_msvc(self): + # Folly does not support shared library on Windows: https://github.com/facebook/folly/issues/962 + self.package_type = "static-library" + del self.options.shared + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("boost/1.78.0") + self.requires("boost/1.85.0", transitive_headers=True, transitive_libs=True) self.requires("bzip2/1.0.8") - self.requires("double-conversion/3.2.0") + self.requires("double-conversion/3.3.0", transitive_headers=True, transitive_libs=True) self.requires("gflags/2.2.2") - self.requires("glog/0.4.0") - self.requires("libevent/2.1.12") - self.requires("openssl/1.1.1q") - self.requires("lz4/1.9.3") - self.requires("snappy/1.1.9") - self.requires("zlib/1.2.12") - self.requires("zstd/1.5.2") + self.requires("glog/0.7.1", transitive_headers=True, transitive_libs=True) + self.requires("libevent/2.1.12", transitive_headers=True, transitive_libs=True) + self.requires("openssl/[>=1.1 <4]") + self.requires("lz4/1.10.0", transitive_libs=True) + self.requires("snappy/1.2.1") + self.requires("zlib/[>=1.2.11 <2]") + self.requires("zstd/1.5.5", transitive_libs=True) if not is_msvc(self): - self.requires("libdwarf/20191104") - self.requires("libsodium/1.0.18") - self.requires("xz_utils/5.2.5") - # FIXME: Causing compilation issues on clang: self.requires("jemalloc/5.2.1") - if self.settings.os == "Linux": + self.requires("libdwarf/0.9.1") + self.requires("libsodium/1.0.19") + self.requires("xz_utils/[>=5.4.5 <6]") + if self.settings.os in ["Linux", "FreeBSD"]: self.requires("libiberty/9.1.0") - self.requires("libunwind/1.5.0") - if Version(self.version) >= "2020.08.10.00": - self.requires("fmt/7.1.3") + self.requires("libunwind/1.8.0") + if self.settings.os == "Linux": + self.requires("liburing/2.6") + # INFO: Folly does not support fmt 11 on MSVC: https://github.com/facebook/folly/issues/2250 + self.requires("fmt/10.2.1", transitive_headers=True, transitive_libs=True) + + def build_requirements(self): + # INFO: Required due ZIP_LISTS CMake feature in conan_deps.cmake + self.tool_requires("cmake/[>=3.17 <4]") @property def _required_boost_components(self): return ["context", "filesystem", "program_options", "regex", "system", "thread"] + @property + def _required_boost_conan_components(self): + return [f"boost::{comp}" for comp in self._required_boost_components] + + @property + def _required_boost_cmake_targets(self): + return [f"Boost::{comp}" for comp in self._required_boost_components] + def validate(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 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 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": - raise ConanInvalidConfiguration("Conan currently requires a 64bit target architecture for Folly on Macos") + 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" and self.settings.arch != "x86_64": - raise ConanInvalidConfiguration("Folly requires a 64bit target architecture on Windows") - - 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)) + raise ConanInvalidConfiguration(f"{self.ref} Folly requires a 64bit target architecture on Windows.") - 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.settings.compiler == "apple-clang" and Version(self.settings.compiler.version) < "14.0": + # https://github.com/facebook/folly/issues/2266 + raise ConanInvalidConfiguration(f"{self.ref} could not be built by apple-clang < 14.0. Use apple-clang >= 14.0") - if self.options["boost"].header_only: - raise ConanInvalidConfiguration("Folly could not be built with a header only Boost") + boost = self.dependencies["boost"] + if boost.options.header_only: + raise ConanInvalidConfiguration(f"{self.ref} could not be built with a header only Boost. Use -o 'boost/*:header_only=False'") - miss_boost_required_comp = any(getattr(self.options["boost"], "without_{}".format(boost_comp), True) for boost_comp in self._required_boost_components) + miss_boost_required_comp = any(getattr(boost.options, f"without_{boost_comp}", True) for boost_comp in self._required_boost_components) if miss_boost_required_comp: - raise ConanInvalidConfiguration("Folly requires these boost components: {}".format(", ".join(self._required_boost_components))) - - 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)) - - 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") + required_components = ", ".join(self._required_boost_components) + raise ConanInvalidConfiguration(f"{self.ref} requires these Boost components: {required_components}. Try with '-o boost/*:without_{required_components}=False'") 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=False) + + def _cppstd_flag_value(self, cppstd): + if is_msvc(self): + prefix = "c" + year = str(cppstd) + if year > "17": + year = "latest" + return f"{prefix}++{year}" + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + tc = CMakeToolchain(self) + tc.variables["CMAKE_PROJECT_folly_INCLUDE"] = "conan_deps.cmake" + # Folly fails to check Gflags: https://github.com/conan-io/conan/issues/12012 + tc.variables["CMAKE_TRY_COMPILE_CONFIGURATION"] = str(self.settings.build_type) + + if is_apple_os(self) and cross_building(self): + # INFO: Folly fails to configure Mac M1 -> Mac Intel: + # CMake Error: try_run() invoked in cross-compiling mode, please set the following cache variables appropriately: HAVE_VSNPRINTF_ERRORS_EXITCODE (advanced) + for var in ["FOLLY_HAVE_UNALIGNED_ACCESS", "FOLLY_HAVE_LINUX_VDSO", "FOLLY_HAVE_WCHAR_SUPPORT", "HAVE_VSNPRINTF_ERRORS"]: + tc.cache_variables[f"{var}_EXITCODE"] = 0 + + # Folly is not respecting this from the helper https://github.com/conan-io/conan-center-index/pull/15726/files#r1097068754 + tc.cache_variables["CMAKE_POSITION_INDEPENDENT_CODE"] = self.options.get_safe("fPIC", True) + # Relocatable shared lib on Macos + if is_apple_os(self): + 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" + # Honor Boost_ROOT set by boost recipe + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0074"] = "NEW" + + + # 2019.10.21.00 -> either MSVC_ flags or CXX_STD + if is_msvc(self): + cxx_std_value = self._cppstd_flag_value(self.settings.get_safe("compiler.cppstd", self._min_cppstd)) + tc.cache_variables["MSVC_LANGUAGE_VERSION"] = cxx_std_value + tc.cache_variables["MSVC_ENABLE_ALL_WARNINGS"] = False + tc.cache_variables["MSVC_USE_STATIC_RUNTIME"] = is_msvc_static_runtime(self) + tc.preprocessor_definitions["NOMINMAX"] = "" + + if not self.dependencies["boost"].options.header_only: + tc.cache_variables["BOOST_LINK_STATIC"] = not self.dependencies["boost"].options.shared + + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0074"] = "NEW" # Honor Boost_ROOT set by boost recipe + tc.generate() + + deps = CMakeDeps(self) + deps.set_property("boost", "cmake_file_name", "Boost") + deps.set_property("bzip2", "cmake_file_name", "BZip2") + deps.set_property("double-conversion", "cmake_file_name", "DoubleConversion") + deps.set_property("fmt", "cmake_file_name", "fmt") + deps.set_property("gflags", "cmake_file_name", "Gflags") + deps.set_property("glog", "cmake_file_name", "Glog") + deps.set_property("libdwarf", "cmake_file_name", "LibDwarf") + deps.set_property("libevent", "cmake_file_name", "LibEvent") + deps.set_property("libiberty", "cmake_file_name", "Libiberty") + deps.set_property("libsodium", "cmake_file_name", "Libsodium") + deps.set_property("libunwind", "cmake_file_name", "LibUnwind") + deps.set_property("liburing", "cmake_file_name", "LibUring") + deps.set_property("lz4", "cmake_file_name", "LZ4") + deps.set_property("openssl", "cmake_file_name", "OpenSSL") + deps.set_property("snappy", "cmake_file_name", "Snappy") + deps.set_property("xz_utils", "cmake_file_name", "LibLZMA") + deps.set_property("zlib", "cmake_file_name", "ZLIB") + deps.set_property("zstd", "cmake_file_name", "Zstd") + deps.generate() + + def _patch_sources(self): + # Make sure will consume Conan dependencies + folly_deps = os.path.join(self.source_folder, "CMake", "folly-deps.cmake") + replace_in_file(self, folly_deps, " MODULE", " REQUIRED CONFIG") + replace_in_file(self, folly_deps, "${Boost_LIBRARIES}", f"{' '.join(self._required_boost_cmake_targets)}") + replace_in_file(self, folly_deps, "OpenSSL 1.1.1", "OpenSSL") + # Disable example + save(self, os.path.join(self.source_folder, "folly", "logging", "example", "CMakeLists.txt"), "") + # Disable custom find modules to use Conan CMakeDeps instead + rm(self, "Find*.cmake", os.path.join(self.source_folder, "CMake")) + rm(self, "Find*.cmake", os.path.join(self.source_folder, "build", "fbcode_builder", "CMake")) + # Skip generating .pc file to avoid Windows errors when trying to compile with pkg-config + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "gen_pkgconfig_vars(FOLLY_PKGCONFIG folly_deps)", "") - @functools.lru_cache(1) - def _configure_cmake(self): + def build(self): + self._patch_sources() cmake = CMake(self) - if can_run(self): - cmake.definitions["FOLLY_HAVE_UNALIGNED_ACCESS_EXITCODE"] = "0" - cmake.definitions["FOLLY_HAVE_UNALIGNED_ACCESS_EXITCODE__TRYRUN_OUTPUT"] = "" - cmake.definitions["FOLLY_HAVE_LINUX_VDSO_EXITCODE"] = "0" - cmake.definitions["FOLLY_HAVE_LINUX_VDSO_EXITCODE__TRYRUN_OUTPUT"] = "" - cmake.definitions["FOLLY_HAVE_WCHAR_SUPPORT_EXITCODE"] = "0" - 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) - cxx_std_value = cxx_std_flag.split('=')[1] if cxx_std_flag else "c++{}".format(self._minimum_cpp_standard) - cmake.definitions["CXX_STD"] = cxx_std_value - if is_msvc: - cmake.definitions["MSVC_LANGUAGE_VERSION"] = cxx_std_value - cmake.definitions["MSVC_ENABLE_ALL_WARNINGS"] = False - cmake.definitions["MSVC_USE_STATIC_RUNTIME"] = "MT" in msvc_runtime_flag(self) 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(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")) - 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")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "folly") - self.cpp_info.set_property("cmake_target_name", "Folly::folly") + self.cpp_info.set_property("cmake_target_name", "folly::folly") self.cpp_info.set_property("pkg_config_name", "libfolly") - # TODO: back to global scope in conan v2 once cmake_find_package_* generators removed - if Version(self.version) == "2019.10.21.00": - self.cpp_info.components["libfolly"].libs = [ - "follybenchmark", - "folly_test_util", - "folly" - ] - elif Version(self.version) >= "2020.08.10.00": - if self.settings.os == "Linux": - self.cpp_info.components["libfolly"].libs = [ - "folly_exception_counter", - "folly_exception_tracer", - "folly_exception_tracer_base", - "folly_test_util", - "follybenchmark", - "folly" - ] - else: - self.cpp_info.components["libfolly"].libs = [ - "folly_test_util", - "follybenchmark", - "folly" - ] - - self.cpp_info.components["libfolly"].requires = [ - "boost::boost", - "bzip2::bzip2", + self.cpp_info.components["libfolly"].set_property("cmake_target_name", "Folly::folly") + self.cpp_info.components["libfolly"].set_property("pkg_config_name", "libfolly") + self.cpp_info.components["libfolly"].libs = ["folly"] + self.cpp_info.components["libfolly"].requires = ["fmt::fmt"] + self._required_boost_conan_components + [ "double-conversion::double-conversion", "gflags::gflags", "glog::glog", "libevent::libevent", "lz4::lz4", "openssl::openssl", + "bzip2::bzip2", "snappy::snappy", "zlib::zlib", "zstd::zstd", "libsodium::libsodium", - "xz_utils::xz_utils" + "xz_utils::xz_utils", ] if not is_msvc(self): self.cpp_info.components["libfolly"].requires.append("libdwarf::libdwarf") - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["libfolly"].requires.extend(["libiberty::libiberty", "libunwind::libunwind"]) + if self.settings.os == "Linux": + self.cpp_info.components["libfolly"].requires.append("liburing::liburing") self.cpp_info.components["libfolly"].system_libs.extend(["pthread", "dl", "rt"]) - - if Version(self.version) >= "2020.08.10.00": - self.cpp_info.components["libfolly"].requires.append("fmt::fmt") - if self.settings.os == "Linux": - self.cpp_info.components["libfolly"].defines.extend(["FOLLY_HAVE_ELF", "FOLLY_HAVE_DWARF"]) - + self.cpp_info.components["libfolly"].defines.extend(["FOLLY_HAVE_ELF", "FOLLY_HAVE_DWARF"]) elif self.settings.os == "Windows": self.cpp_info.components["libfolly"].system_libs.extend(["ws2_32", "iphlpapi", "crypt32"]) - if (self.settings.os == "Linux" and self.settings.compiler == "clang" and - self.settings.compiler.libcxx == "libstdc++") or \ - (self.settings.os == "Macos" and self.settings.compiler == "apple-clang" and - Version(self.settings.compiler.version.value) == "9.0" and self.settings.compiler.libcxx == "libc++"): + if self.settings.get_safe("compiler.libcxx") == "libstdc++" or \ + (self.settings.compiler == "apple-clang" and Version(self.settings.compiler.version.value) == "9.0" and \ + self.settings.get_safe("compiler.libcxx") == "libc++"): self.cpp_info.components["libfolly"].system_libs.append("atomic") - if self.settings.os == "Macos" and self.settings.compiler == "apple-clang" and Version(self.settings.compiler.version.value) >= "11.0": + if 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" - self.cpp_info.names["cmake_find_package"] = "Folly" - self.cpp_info.names["cmake_find_package_multi"] = "Folly" - self.cpp_info.names["pkg_config"] = "libfolly" - self.cpp_info.components["libfolly"].names["cmake_find_package"] = "folly" - 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["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"] + 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": + if self.settings.os in ["Linux", "FreeBSD"]: 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"] @@ -305,3 +292,26 @@ def package_info(self): 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"] + + # 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" + self.cpp_info.names["cmake_find_package"] = "Folly" + self.cpp_info.names["cmake_find_package_multi"] = "Folly" + self.cpp_info.components["libfolly"].names["cmake_find_package"] = "folly" + self.cpp_info.components["libfolly"].names["cmake_find_package_multi"] = "folly" + + # TODO: to remove in conan v2 once cmake_find_package_* & pkg_config generators removed + self.cpp_info.components["follybenchmark"].names["cmake_find_package"] = "follybenchmark" + self.cpp_info.components["follybenchmark"].names["cmake_find_package_multi"] = "follybenchmark" + self.cpp_info.components["folly_test_util"].names["cmake_find_package"] = "folly_test_util" + self.cpp_info.components["folly_test_util"].names["cmake_find_package_multi"] = "folly_test_util" + + if self.settings.os in ["Linux", "FreeBSD"]: + # TODO: to remove in conan v2 once cmake_find_package_* & pkg_config generators removed + self.cpp_info.components["folly_exception_tracer_base"].names["cmake_find_package"] = "folly_exception_tracer_base" + self.cpp_info.components["folly_exception_tracer_base"].names["cmake_find_package_multi"] = "folly_exception_tracer_base" + self.cpp_info.components["folly_exception_tracer"].names["cmake_find_package"] = "folly_exception_tracer" + self.cpp_info.components["folly_exception_tracer"].names["cmake_find_package_multi"] = "folly_exception_tracer" + self.cpp_info.components["folly_exception_counter"].names["cmake_find_package"] = "folly_exception_counter" + self.cpp_info.components["folly_exception_counter"].names["cmake_find_package_multi"] = "folly_exception_counter" diff --git a/recipes/folly/all/patches/0001-find-packages.patch b/recipes/folly/all/patches/0001-find-packages.patch deleted file mode 100644 index 4cee77cd34c1c..0000000000000 --- a/recipes/folly/all/patches/0001-find-packages.patch +++ /dev/null @@ -1,93 +0,0 @@ -diff --git a/CMake/FindLibsodium.cmake b/CMake/FindLibsodium.cmake -index 18d4d0c..2b3cd2a 100644 ---- a/CMake/FindLibsodium.cmake -+++ b/CMake/FindLibsodium.cmake -@@ -15,7 +15,7 @@ - find_path(LIBSODIUM_INCLUDE_DIR NAMES sodium.h) - mark_as_advanced(LIBSODIUM_INCLUDE_DIR) - --find_library(LIBSODIUM_LIBRARY NAMES sodium) -+find_library(LIBSODIUM_LIBRARY NAMES sodium libsodium PATHS ${CONAN_LIBSODIUM_ROOT}) - mark_as_advanced(LIBSODIUM_LIBRARY) - - include(FindPackageHandleStandardArgs) -diff --git a/CMake/folly-deps.cmake b/CMake/folly-deps.cmake -index 048e1cd..da3ab8e 100644 ---- a/CMake/folly-deps.cmake -+++ b/CMake/folly-deps.cmake -@@ -36,19 +36,19 @@ find_package(DoubleConversion MODULE REQUIRED) - list(APPEND FOLLY_LINK_LIBRARIES ${DOUBLE_CONVERSION_LIBRARY}) - list(APPEND FOLLY_INCLUDE_DIRECTORIES ${DOUBLE_CONVERSION_INCLUDE_DIR}) - --find_package(Gflags MODULE) --set(FOLLY_HAVE_LIBGFLAGS ${LIBGFLAGS_FOUND}) --list(APPEND FOLLY_LINK_LIBRARIES ${LIBGFLAGS_LIBRARY}) --list(APPEND FOLLY_INCLUDE_DIRECTORIES ${LIBGFLAGS_INCLUDE_DIR}) --list(APPEND CMAKE_REQUIRED_LIBRARIES ${LIBGFLAGS_LIBRARY}) --list(APPEND CMAKE_REQUIRED_INCLUDES ${LIBGFLAGS_INCLUDE_DIR}) -- --find_package(Glog MODULE) -+find_package(gflags MODULE REQUIRED) -+set(FOLLY_HAVE_LIBGFLAGS ${GFLAGS_FOUND}) -+list(APPEND FOLLY_LINK_LIBRARIES ${CONAN_LIBS_GFLAGS}) -+list(APPEND FOLLY_INCLUDE_DIRECTORIES ${CONAN_INCLUDE_DIRS_GFLAGS}) -+list(APPEND CMAKE_REQUIRED_LIBRARIES ${gflags_LIBRARY}) -+list(APPEND CMAKE_REQUIRED_INCLUDES ${gflags_INCLUDE_DIR}) -+ -+find_package(glog MODULE) - set(FOLLY_HAVE_LIBGLOG ${GLOG_FOUND}) - list(APPEND FOLLY_LINK_LIBRARIES ${GLOG_LIBRARY}) - list(APPEND FOLLY_INCLUDE_DIRECTORIES ${GLOG_INCLUDE_DIR}) - --find_package(LibEvent MODULE REQUIRED) -+find_package(Libevent MODULE REQUIRED) - list(APPEND FOLLY_LINK_LIBRARIES ${LIBEVENT_LIB}) - list(APPEND FOLLY_INCLUDE_DIRECTORIES ${LIBEVENT_INCLUDE_DIR}) - -diff --git a/build/fbcode_builder/CMake/FindGflags.cmake b/build/fbcode_builder/CMake/FindGflags.cmake -index 246ceac..385605e 100644 ---- a/build/fbcode_builder/CMake/FindGflags.cmake -+++ b/build/fbcode_builder/CMake/FindGflags.cmake -@@ -48,8 +48,13 @@ if (gflags_FOUND) - else() - FIND_PATH(LIBGFLAGS_INCLUDE_DIR gflags/gflags.h) - -- FIND_LIBRARY(LIBGFLAGS_LIBRARY_DEBUG NAMES gflagsd gflags_staticd) -- FIND_LIBRARY(LIBGFLAGS_LIBRARY_RELEASE NAMES gflags gflags_static) -+ if(CMAKE_SYSTEM_NAME STREQUAL "Windows") -+ FIND_LIBRARY(LIBGFLAGS_LIBRARY_DEBUG NAMES gflagsd gflags_nothreads_staticd gflags_nothreads_static_debug PATHS ${CONAN_GFLAGS_ROOT}) -+ FIND_LIBRARY(LIBGFLAGS_LIBRARY_RELEASE NAMES gflags gflags_nothreads_static PATHS ${CONAN_GFLAGS_ROOT}) -+ else() -+ FIND_LIBRARY(LIBGFLAGS_LIBRARY_DEBUG NAMES gflags gflags_nothreads_debug PATHS ${CONAN_GFLAGS_ROOT}) -+ FIND_LIBRARY(LIBGFLAGS_LIBRARY_RELEASE NAMES gflags_nothreads gflags PATHS ${CONAN_GFLAGS_ROOT}) -+ endif() - - INCLUDE(SelectLibraryConfigurations) - SELECT_LIBRARY_CONFIGURATIONS(LIBGFLAGS) -diff --git a/build/fbcode_builder/CMake/FindGlog.cmake b/build/fbcode_builder/CMake/FindGlog.cmake -index a589b2e..15aef75 100644 ---- a/build/fbcode_builder/CMake/FindGlog.cmake -+++ b/build/fbcode_builder/CMake/FindGlog.cmake -@@ -8,8 +8,7 @@ - - include(FindPackageHandleStandardArgs) - --find_library(GLOG_LIBRARY glog -- PATHS ${GLOG_LIBRARYDIR}) -+find_library(GLOG_LIBRARY glog glogd PATHS ${CONAN_GLOG_ROOT}) - - find_path(GLOG_INCLUDE_DIR glog/logging.h - PATHS ${GLOG_INCLUDEDIR}) -diff --git a/build/fbcode_builder/CMake/FindLibEvent.cmake b/build/fbcode_builder/CMake/FindLibEvent.cmake -index dd11ebd..9ef0807 100644 ---- a/build/fbcode_builder/CMake/FindLibEvent.cmake -+++ b/build/fbcode_builder/CMake/FindLibEvent.cmake -@@ -50,7 +50,7 @@ if (TARGET event) - endif() - else() - find_path(LIBEVENT_INCLUDE_DIR event.h PATHS ${LibEvent_INCLUDE_PATHS}) -- find_library(LIBEVENT_LIB NAMES event PATHS ${LibEvent_LIB_PATHS}) -+ find_library(LIBEVENT_LIB NAMES event libevent PATHS ${CONAN_LIBEVENT_ROOT}) - - if (LIBEVENT_LIB AND LIBEVENT_INCLUDE_DIR) - set(LibEvent_FOUND TRUE) diff --git a/recipes/folly/all/patches/0002-compiler-flags.patch b/recipes/folly/all/patches/0002-compiler-flags.patch deleted file mode 100644 index b9213ff6d4895..0000000000000 --- a/recipes/folly/all/patches/0002-compiler-flags.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff --git a/CMake/FollyCompilerUnix.cmake b/CMake/FollyCompilerUnix.cmake -index 7fba75f..019d30f 100644 ---- a/CMake/FollyCompilerUnix.cmake -+++ b/CMake/FollyCompilerUnix.cmake -@@ -28,9 +28,9 @@ set( - ) - mark_as_advanced(CXX_STD) - --set(CMAKE_CXX_FLAGS_COMMON "-g -Wall -Wextra") -+set(CMAKE_CXX_FLAGS_COMMON "-Wall -Wextra") - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${CMAKE_CXX_FLAGS_COMMON}") --set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${CMAKE_CXX_FLAGS_COMMON} -O3") -+set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${CMAKE_CXX_FLAGS_COMMON}") - - # Note that CMAKE_REQUIRED_FLAGS must be a string, not a list - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=${CXX_STD}") -@@ -44,7 +44,6 @@ function(apply_folly_compile_options_to_target THETARGET) - ) - target_compile_options(${THETARGET} - PRIVATE -- -g - -std=${CXX_STD} - -finput-charset=UTF-8 - -fsigned-char diff --git a/recipes/folly/all/patches/0003-boost-shared-ptr.patch b/recipes/folly/all/patches/0003-boost-shared-ptr.patch deleted file mode 100644 index 7608d6b2e9e2b..0000000000000 --- a/recipes/folly/all/patches/0003-boost-shared-ptr.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff --git a/folly/portability/PThread.cpp b/folly/portability/PThread.cpp -index f8cd6d4..0908668 100644 ---- a/folly/portability/PThread.cpp -+++ b/folly/portability/PThread.cpp -@@ -18,7 +18,9 @@ - - #if !FOLLY_HAVE_PTHREAD && defined(_WIN32) - #include // @manual -- -+#include -+#include -+#include - #include - - #include -@@ -683,7 +685,7 @@ int pthread_setspecific(pthread_key_t key, const void* value) { - // function, which we don't want to do. - boost::detail::set_tss_data( - realKey, -- boost::shared_ptr(), -+ 0,0, - const_cast(value), - false); - return 0; diff --git a/recipes/folly/all/patches/0004-disable-posix-names.patch b/recipes/folly/all/patches/0004-disable-posix-names.patch deleted file mode 100644 index 9efd4e24140e1..0000000000000 --- a/recipes/folly/all/patches/0004-disable-posix-names.patch +++ /dev/null @@ -1,27 +0,0 @@ -diff --git a/folly/portability/Windows.h b/folly/portability/Windows.h -index f7990ca..b22fac5 100644 ---- a/folly/portability/Windows.h -+++ b/folly/portability/Windows.h -@@ -26,16 +26,12 @@ - // These have to be this way because we define our own versions - // of close(), because the normal Windows versions don't handle - // sockets at all. --#ifndef __STDC__ --/* nolint */ --#define __STDC__ 1 --#include // @manual nolint --#include // @manual nolint --#undef __STDC__ --#else --#include // @manual nolint --#include // @manual nolint --#endif -+#include -+#pragma push_macro("_CRT_INTERNAL_NONSTDC_NAMES") -+#define _CRT_INTERNAL_NONSTDC_NAMES 0 -+#include -+#include -+#pragma pop_macro("_CRT_INTERNAL_NONSTDC_NAMES") - - #if defined(min) || defined(max) - #error Windows.h needs to be included by this header, or else NOMINMAX needs \ diff --git a/recipes/folly/all/patches/0005-include-atomic.patch b/recipes/folly/all/patches/0005-include-atomic.patch deleted file mode 100644 index 0eb9382e49a9d..0000000000000 --- a/recipes/folly/all/patches/0005-include-atomic.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/folly/portability/PThread.cpp b/folly/portability/PThread.cpp -index 2891c4c..7c98975 100644 ---- a/folly/portability/PThread.cpp -+++ b/folly/portability/PThread.cpp -@@ -30,6 +30,7 @@ - #include - #include - #include -+#include - - #include - #include diff --git a/recipes/folly/all/patches/0006-duplicate-hash.patch b/recipes/folly/all/patches/0006-duplicate-hash.patch deleted file mode 100644 index f8905d003157e..0000000000000 --- a/recipes/folly/all/patches/0006-duplicate-hash.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/folly/hash/Hash.h b/folly/hash/Hash.h -index 33fa553..4266cf1 100644 ---- a/folly/hash/Hash.h -+++ b/folly/hash/Hash.h -@@ -730,7 +730,7 @@ struct TupleHasher<0, Ts...> { - - // Custom hash functions. - namespace std { --#if FOLLY_SUPPLY_MISSING_INT128_TRAITS -+#if 0 - template <> - struct hash<__int128> : folly::detail::integral_hasher<__int128> {}; - diff --git a/recipes/folly/all/patches/0007-allow-builtins.patch b/recipes/folly/all/patches/0007-allow-builtins.patch deleted file mode 100644 index de09722f02acc..0000000000000 --- a/recipes/folly/all/patches/0007-allow-builtins.patch +++ /dev/null @@ -1,128 +0,0 @@ -diff --git a/folly/portability/Builtins.h b/folly/portability/Builtins.h -index 971cb8819..e68de4456 100644 ---- a/folly/portability/Builtins.h -+++ b/folly/portability/Builtins.h -@@ -41,7 +41,6 @@ FOLLY_ALWAYS_INLINE void __builtin___clear_cache(char* begin, char* end) { - } - } - --#if !defined(_MSC_VER) || (_MSC_VER < 1923) - FOLLY_ALWAYS_INLINE int __builtin_clz(unsigned int x) { - unsigned long index; - return int(_BitScanReverse(&index, (unsigned long)x) ? 31 - index : 32); -@@ -93,7 +92,6 @@ FOLLY_ALWAYS_INLINE int __builtin_ctzll(unsigned long long x) { - return int(_BitScanForward64(&index, x) ? index : 64); - } - #endif --#endif // !defined(_MSC_VER) || (_MSC_VER < 1923) - - FOLLY_ALWAYS_INLINE int __builtin_ffs(int x) { - unsigned long index; -@@ -119,15 +117,12 @@ FOLLY_ALWAYS_INLINE int __builtin_popcount(unsigned int x) { - return int(__popcnt(x)); - } - --#if !defined(_MSC_VER) || (_MSC_VER < 1923) - FOLLY_ALWAYS_INLINE int __builtin_popcountl(unsigned long x) { - static_assert(sizeof(x) == 4, ""); - return int(__popcnt(x)); - } --#endif // !defined(_MSC_VER) || (_MSC_VER < 1923) - #endif - --#if !defined(_MSC_VER) || (_MSC_VER < 1923) - #if defined(_M_IX86) - FOLLY_ALWAYS_INLINE int __builtin_popcountll(unsigned long long x) { - return int(__popcnt((unsigned int)(x >> 32))) + -@@ -138,7 +133,6 @@ FOLLY_ALWAYS_INLINE int __builtin_popcountll(unsigned long long x) { - return int(__popcnt64(x)); - } - #endif --#endif // !defined(_MSC_VER) || (_MSC_VER < 1923) - - FOLLY_ALWAYS_INLINE void* __builtin_return_address(unsigned int frame) { - // I really hope frame is zero... --- - -diff --git a/folly/portability/Builtins.h b/folly/portability/Builtins.h -index e68de4456..30caf4003 100644 ---- a/folly/portability/Builtins.h -+++ b/folly/portability/Builtins.h -@@ -16,7 +16,7 @@ - - #pragma once - --#if defined(_WIN32) && !defined(__clang__) -+#if defined(_WIN32) && !defined(__MINGW32__) && !defined(__clang__) - #include - #include - #include --- -see https://github.com/facebook/folly/issues/1412 -diff --git a/folly/portability/Builtins.h b/folly/portability/Builtins.h -index 30caf4003..e8ef97266 100644 ---- a/folly/portability/Builtins.h -+++ b/folly/portability/Builtins.h -@@ -22,6 +22,14 @@ - #include - #include - -+// MSVC had added support for __builtin_clz etc. in 16.3 (1923) but it will be -+// removed in 16.8 (1928). -+#if (_MSC_VER >= 1923) && (_MSC_VER < 1928) -+#define FOLLY_DETAILFOLLY_DETAIL_MSC_BUILTIN_SUPPORT 1 -+#else -+#define FOLLY_DETAILFOLLY_DETAIL_MSC_BUILTIN_SUPPORT 0 -+#endif -+ - namespace folly { - namespace portability { - namespace detail { -@@ -41,6 +49,7 @@ FOLLY_ALWAYS_INLINE void __builtin___clear_cache(char* begin, char* end) { - } - } - -+#if !defined(_MSC_VER) || !defined(FOLLY_DETAIL_MSC_BUILTIN_SUPPORT) - FOLLY_ALWAYS_INLINE int __builtin_clz(unsigned int x) { - unsigned long index; - return int(_BitScanReverse(&index, (unsigned long)x) ? 31 - index : 32); -@@ -92,6 +101,7 @@ FOLLY_ALWAYS_INLINE int __builtin_ctzll(unsigned long long x) { - return int(_BitScanForward64(&index, x) ? index : 64); - } - #endif -+#endif // !defined(_MSC_VER) || !defined(FOLLY_DETAIL_MSC_BUILTIN_SUPPORT) - - FOLLY_ALWAYS_INLINE int __builtin_ffs(int x) { - unsigned long index; -@@ -117,12 +127,15 @@ FOLLY_ALWAYS_INLINE int __builtin_popcount(unsigned int x) { - return int(__popcnt(x)); - } - -+#if !defined(_MSC_VER) || !defined(FOLLY_DETAIL_MSC_BUILTIN_SUPPORT) - FOLLY_ALWAYS_INLINE int __builtin_popcountl(unsigned long x) { - static_assert(sizeof(x) == 4, ""); - return int(__popcnt(x)); - } -+#endif // !defined(_MSC_VER) || !defined(FOLLY_DETAIL_MSC_BUILTIN_SUPPORT) - #endif - -+#if !defined(_MSC_VER) || !defined(FOLLY_DETAIL_MSC_BUILTIN_SUPPORT) - #if defined(_M_IX86) - FOLLY_ALWAYS_INLINE int __builtin_popcountll(unsigned long long x) { - return int(__popcnt((unsigned int)(x >> 32))) + -@@ -133,6 +146,7 @@ FOLLY_ALWAYS_INLINE int __builtin_popcountll(unsigned long long x) { - return int(__popcnt64(x)); - } - #endif -+#endif // !defined(_MSC_VER) || !defined(FOLLY_DETAIL_MSC_BUILTIN_SUPPORT) - - FOLLY_ALWAYS_INLINE void* __builtin_return_address(unsigned int frame) { - // I really hope frame is zero... -@@ -141,3 +155,5 @@ FOLLY_ALWAYS_INLINE void* __builtin_return_address(unsigned int frame) { - return _ReturnAddress(); - } - #endif -+ -+#undef FOLLY_DETAIL_MSC_BUILTIN_SUPPORT --- - diff --git a/recipes/folly/all/patches/0008-find-packages.patch b/recipes/folly/all/patches/0008-find-packages.patch deleted file mode 100644 index 3329a68425e3b..0000000000000 --- a/recipes/folly/all/patches/0008-find-packages.patch +++ /dev/null @@ -1,73 +0,0 @@ -diff --git a/CMake/folly-deps.cmake b/CMake/folly-deps.cmake -index 3169b972d52..23dc6d509b1 100644 ---- a/CMake/folly-deps.cmake -+++ b/CMake/folly-deps.cmake -@@ -46,11 +46,11 @@ find_package(Boost 1.51.0 MODULE - list(APPEND FOLLY_LINK_LIBRARIES ${Boost_LIBRARIES}) - list(APPEND FOLLY_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIRS}) - --find_package(DoubleConversion MODULE REQUIRED) -+find_package(double-conversion MODULE REQUIRED) - list(APPEND FOLLY_LINK_LIBRARIES ${DOUBLE_CONVERSION_LIBRARY}) - list(APPEND FOLLY_INCLUDE_DIRECTORIES ${DOUBLE_CONVERSION_INCLUDE_DIR}) - --find_package(Gflags MODULE) -+find_package(gflags MODULE) - set(FOLLY_HAVE_LIBGFLAGS ${LIBGFLAGS_FOUND}) - if(LIBGFLAGS_FOUND) - list(APPEND FOLLY_LINK_LIBRARIES ${LIBGFLAGS_LIBRARY}) -@@ -59,12 +59,12 @@ if(LIBGFLAGS_FOUND) - list(APPEND CMAKE_REQUIRED_INCLUDES ${LIBGFLAGS_INCLUDE_DIR}) - endif() - --find_package(Glog MODULE) -+find_package(glog MODULE) - set(FOLLY_HAVE_LIBGLOG ${GLOG_FOUND}) - list(APPEND FOLLY_LINK_LIBRARIES ${GLOG_LIBRARY}) - list(APPEND FOLLY_INCLUDE_DIRECTORIES ${GLOG_INCLUDE_DIR}) - --find_package(LibEvent MODULE REQUIRED) -+find_package(Libevent MODULE REQUIRED) - list(APPEND FOLLY_LINK_LIBRARIES ${LIBEVENT_LIB}) - list(APPEND FOLLY_INCLUDE_DIRECTORIES ${LIBEVENT_INCLUDE_DIR}) - -@@ -96,14 +96,14 @@ if (LIBLZMA_FOUND) - list(APPEND FOLLY_LINK_LIBRARIES ${LIBLZMA_LIBRARIES}) - endif() - --find_package(LZ4 MODULE) -+find_package(lz4 MODULE) - set(FOLLY_HAVE_LIBLZ4 ${LZ4_FOUND}) - if (LZ4_FOUND) - list(APPEND FOLLY_INCLUDE_DIRECTORIES ${LZ4_INCLUDE_DIR}) - list(APPEND FOLLY_LINK_LIBRARIES ${LZ4_LIBRARY}) - endif() - --find_package(Zstd MODULE) -+find_package(zstd MODULE) - set(FOLLY_HAVE_LIBZSTD ${ZSTD_FOUND}) - if(ZSTD_FOUND) - list(APPEND FOLLY_INCLUDE_DIRECTORIES ${ZSTD_INCLUDE_DIR}) -@@ -117,11 +117,11 @@ if (SNAPPY_FOUND) - list(APPEND FOLLY_LINK_LIBRARIES ${SNAPPY_LIBRARY}) - endif() - --find_package(LibDwarf) -+find_package(libdwarf) - list(APPEND FOLLY_LINK_LIBRARIES ${LIBDWARF_LIBRARIES}) - list(APPEND FOLLY_INCLUDE_DIRECTORIES ${LIBDWARF_INCLUDE_DIRS}) - --find_package(Libiberty) -+find_package(libiberty) - list(APPEND FOLLY_LINK_LIBRARIES ${LIBIBERTY_LIBRARIES}) - list(APPEND FOLLY_INCLUDE_DIRECTORIES ${LIBIBERTY_INCLUDE_DIRS}) - -@@ -133,7 +133,7 @@ find_package(LibUring) - list(APPEND FOLLY_LINK_LIBRARIES ${LIBURING_LIBRARIES}) - list(APPEND FOLLY_INCLUDE_DIRECTORIES ${LIBURING_INCLUDE_DIRS}) - --find_package(Libsodium) -+find_package(libsodium) - list(APPEND FOLLY_LINK_LIBRARIES ${LIBSODIUM_LIBRARIES}) - list(APPEND FOLLY_INCLUDE_DIRECTORIES ${LIBSODIUM_INCLUDE_DIRS}) - diff --git a/recipes/folly/all/patches/0009-ill-formed-atomic-copy.patch b/recipes/folly/all/patches/0009-ill-formed-atomic-copy.patch deleted file mode 100644 index 58f95224f3873..0000000000000 --- a/recipes/folly/all/patches/0009-ill-formed-atomic-copy.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/folly/fibers/SemaphoreBase.cpp b/folly/fibers/SemaphoreBase.cpp -index 06e9ecc7111..77e2da75c18 100644 ---- a/folly/fibers/SemaphoreBase.cpp -+++ b/folly/fibers/SemaphoreBase.cpp -@@ -170,7 +170,7 @@ namespace { - class FutureWaiter final : public fibers::Baton::Waiter { - public: - explicit FutureWaiter(int64_t tokens) -- : semaphoreWaiter(SemaphoreBase::Waiter(tokens)) { -+ : semaphoreWaiter(tokens) { - semaphoreWaiter.baton.setWaiter(*this); - } - diff --git a/recipes/folly/all/patches/0010-duplicate-hash.patch b/recipes/folly/all/patches/0010-duplicate-hash.patch deleted file mode 100644 index 69268c6acf6f6..0000000000000 --- a/recipes/folly/all/patches/0010-duplicate-hash.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/folly/hash/Hash.h b/folly/hash/Hash.h -index a8a50e8e8dc..d7a3da8e61f 100644 ---- a/folly/hash/Hash.h -+++ b/folly/hash/Hash.h -@@ -733,7 +733,7 @@ struct TupleHasher<0, Ts...> { - - // Custom hash functions. - namespace std { --#if FOLLY_SUPPLY_MISSING_INT128_TRAITS -+#if 0 - template <> - struct hash<__int128> : folly::detail::integral_hasher<__int128> {}; - diff --git a/recipes/folly/all/patches/0011-disable-logger-example.patch b/recipes/folly/all/patches/0011-disable-logger-example.patch deleted file mode 100644 index fa20905367fb1..0000000000000 --- a/recipes/folly/all/patches/0011-disable-logger-example.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/folly/CMakeLists.txt b/folly/CMakeLists.txt -index 08de7daf20f..cdc1f03bf46 100644 ---- a/folly/CMakeLists.txt -+++ b/folly/CMakeLists.txt -@@ -27,7 +27,6 @@ install( - ) - - add_subdirectory(experimental/exception_tracer) --add_subdirectory(logging/example) - - if (PYTHON_EXTENSIONS) - # Create tree of symbolic links in structure required for successful diff --git a/recipes/folly/all/patches/0012-compiler-flags.patch b/recipes/folly/all/patches/0012-compiler-flags.patch deleted file mode 100644 index 358500a1800cd..0000000000000 --- a/recipes/folly/all/patches/0012-compiler-flags.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff --git a/CMake/FollyCompilerUnix.cmake b/CMake/FollyCompilerUnix.cmake -index 8dcaf141a3a..200fe8d3798 100644 ---- a/CMake/FollyCompilerUnix.cmake -+++ b/CMake/FollyCompilerUnix.cmake -@@ -28,9 +28,9 @@ set( - ) - mark_as_advanced(CXX_STD) - --set(CMAKE_CXX_FLAGS_COMMON "-g -Wall -Wextra") -+set(CMAKE_CXX_FLAGS_COMMON "-Wall -Wextra") - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${CMAKE_CXX_FLAGS_COMMON}") --set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${CMAKE_CXX_FLAGS_COMMON} -O3") -+set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${CMAKE_CXX_FLAGS_COMMON}") - - # Note that CMAKE_REQUIRED_FLAGS must be a string, not a list - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=${CXX_STD}") -@@ -43,7 +43,6 @@ function(apply_folly_compile_options_to_target THETARGET) - ) - target_compile_options(${THETARGET} - PRIVATE -- -g - -std=${CXX_STD} - -finput-charset=UTF-8 - -fsigned-char diff --git a/recipes/folly/all/patches/0013-include-bit.patch b/recipes/folly/all/patches/0013-include-bit.patch deleted file mode 100644 index 1a8ac249a146b..0000000000000 --- a/recipes/folly/all/patches/0013-include-bit.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- a/folly/lang/Bits.h -+++ b/folly/lang/Bits.h -@@ -64,6 +64,10 @@ - #include - #include - -+#if __has_include() && __cpp_lib_bit_cast -+#include -+#endif -+ - namespace folly { - - #if __cpp_lib_bit_cast diff --git a/recipes/folly/all/patches/0014-find-librt.patch b/recipes/folly/all/patches/0014-find-librt.patch deleted file mode 100644 index 90a1f0f7b9ada..0000000000000 --- a/recipes/folly/all/patches/0014-find-librt.patch +++ /dev/null @@ -1,18 +0,0 @@ -diff --git a/CMake/FollyConfigChecks.cmake b/CMake/FollyConfigChecks.cmake -index 6b8b308c7..908d72d51 100644 ---- a/CMake/FollyConfigChecks.cmake -+++ b/CMake/FollyConfigChecks.cmake -@@ -83,6 +83,13 @@ string(REGEX REPLACE - CMAKE_REQUIRED_FLAGS - "${CMAKE_REQUIRED_FLAGS}") - -+if (CMAKE_SYSTEM_NAME STREQUAL "Linux") -+ find_library(LIBRT rt) -+ if (LIBRT) -+ list(APPEND CMAKE_REQUIRED_LIBRARIES "rt") -+ endif() -+endif() -+ - check_symbol_exists(pthread_atfork pthread.h FOLLY_HAVE_PTHREAD_ATFORK) - - # Unfortunately check_symbol_exists() does not work for memrchr(): diff --git a/recipes/folly/all/patches/0015-benchmark-format-macros.patch b/recipes/folly/all/patches/0015-benchmark-format-macros.patch deleted file mode 100644 index 14f8b2088a1b3..0000000000000 --- a/recipes/folly/all/patches/0015-benchmark-format-macros.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/folly/Benchmark.cpp b/folly/Benchmark.cpp -index 389ee46a1..390b7674b 100644 ---- a/folly/Benchmark.cpp -+++ b/folly/Benchmark.cpp -@@ -16,6 +16,10 @@ - - // @author Andrei Alexandrescu (andrei.alexandrescu@fb.com) - -+#ifndef __STDC_FORMAT_MACROS -+#define __STDC_FORMAT_MACROS 1 -+#endif -+ - #include - - #include diff --git a/recipes/folly/all/patches/0016-find-packages.patch b/recipes/folly/all/patches/0016-find-packages.patch deleted file mode 100644 index c6cd14fad52c9..0000000000000 --- a/recipes/folly/all/patches/0016-find-packages.patch +++ /dev/null @@ -1,80 +0,0 @@ -diff --git a/CMake/folly-deps.cmake b/CMake/folly-deps.cmake -index 9c9d9ea60..e78611542 100644 ---- a/CMake/folly-deps.cmake -+++ b/CMake/folly-deps.cmake -@@ -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}) - --find_package(DoubleConversion MODULE REQUIRED) -+find_package(double-conversion MODULE REQUIRED) - list(APPEND FOLLY_LINK_LIBRARIES ${DOUBLE_CONVERSION_LIBRARY}) - 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 ${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) -+find_package(glog MODULE) - set(FOLLY_HAVE_LIBGLOG ${GLOG_FOUND}) - list(APPEND FOLLY_LINK_LIBRARIES ${GLOG_LIBRARY}) - list(APPEND FOLLY_INCLUDE_DIRECTORIES ${GLOG_INCLUDE_DIR}) - --find_package(LibEvent MODULE REQUIRED) -+find_package(Libevent MODULE REQUIRED) - list(APPEND FOLLY_LINK_LIBRARIES ${LIBEVENT_LIB}) - list(APPEND FOLLY_INCLUDE_DIRECTORIES ${LIBEVENT_INCLUDE_DIR}) - -@@ -104,14 +104,14 @@ if (LIBLZMA_FOUND) - list(APPEND FOLLY_LINK_LIBRARIES ${LIBLZMA_LIBRARIES}) - endif() - --find_package(LZ4 MODULE) -+find_package(lz4 MODULE) - set(FOLLY_HAVE_LIBLZ4 ${LZ4_FOUND}) - if (LZ4_FOUND) - list(APPEND FOLLY_INCLUDE_DIRECTORIES ${LZ4_INCLUDE_DIR}) - list(APPEND FOLLY_LINK_LIBRARIES ${LZ4_LIBRARY}) - endif() - --find_package(Zstd MODULE) -+find_package(zstd MODULE) - set(FOLLY_HAVE_LIBZSTD ${ZSTD_FOUND}) - if(ZSTD_FOUND) - list(APPEND FOLLY_INCLUDE_DIRECTORIES ${ZSTD_INCLUDE_DIR}) -@@ -125,11 +125,11 @@ if (SNAPPY_FOUND) - list(APPEND FOLLY_LINK_LIBRARIES ${SNAPPY_LIBRARY}) - endif() - --find_package(LibDwarf) -+find_package(libdwarf) - list(APPEND FOLLY_LINK_LIBRARIES ${LIBDWARF_LIBRARIES}) - list(APPEND FOLLY_INCLUDE_DIRECTORIES ${LIBDWARF_INCLUDE_DIRS}) - --find_package(Libiberty) -+find_package(libiberty) - list(APPEND FOLLY_LINK_LIBRARIES ${LIBIBERTY_LIBRARIES}) - list(APPEND FOLLY_INCLUDE_DIRECTORIES ${LIBIBERTY_INCLUDE_DIRS}) - -@@ -141,7 +141,7 @@ find_package(LibUring) - list(APPEND FOLLY_LINK_LIBRARIES ${LIBURING_LIBRARIES}) - list(APPEND FOLLY_INCLUDE_DIRECTORIES ${LIBURING_INCLUDE_DIRS}) - --find_package(Libsodium) -+find_package(libsodium) - list(APPEND FOLLY_LINK_LIBRARIES ${LIBSODIUM_LIBRARIES}) - list(APPEND FOLLY_INCLUDE_DIRECTORIES ${LIBSODIUM_INCLUDE_DIRS}) - diff --git a/recipes/folly/all/patches/0017-compiler-flags.patch b/recipes/folly/all/patches/0017-compiler-flags.patch deleted file mode 100644 index 1290e801ba4ba..0000000000000 --- a/recipes/folly/all/patches/0017-compiler-flags.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff --git a/CMake/FollyCompilerUnix.cmake b/CMake/FollyCompilerUnix.cmake -index 8dcaf14..200fe8d 100644 ---- a/CMake/FollyCompilerUnix.cmake -+++ b/CMake/FollyCompilerUnix.cmake -@@ -28,9 +28,9 @@ set( - ) - mark_as_advanced(CXX_STD) - --set(CMAKE_CXX_FLAGS_COMMON "-g -Wall -Wextra") -+set(CMAKE_CXX_FLAGS_COMMON "-Wall -Wextra") - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${CMAKE_CXX_FLAGS_COMMON}") --set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${CMAKE_CXX_FLAGS_COMMON} -O3") -+set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${CMAKE_CXX_FLAGS_COMMON}") - - # Note that CMAKE_REQUIRED_FLAGS must be a string, not a list - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=${CXX_STD}") -@@ -43,7 +43,6 @@ function(apply_folly_compile_options_to_target THETARGET) - ) - target_compile_options(${THETARGET} - PRIVATE -- -g - -std=${CXX_STD} - -finput-charset=UTF-8 - -fsigned-char diff --git a/recipes/folly/all/patches/0018-find-glog.patch b/recipes/folly/all/patches/0018-find-glog.patch deleted file mode 100644 index b2d17ad455a7b..0000000000000 --- a/recipes/folly/all/patches/0018-find-glog.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff --git a/build/fbcode_builder/CMake/FindGlog.cmake b/build/fbcode_builder/CMake/FindGlog.cmake -index 752647c..aa2fa1c 100644 ---- a/build/fbcode_builder/CMake/FindGlog.cmake -+++ b/build/fbcode_builder/CMake/FindGlog.cmake -@@ -10,9 +10,9 @@ include(FindPackageHandleStandardArgs) - include(SelectLibraryConfigurations) - - find_library(GLOG_LIBRARY_RELEASE glog -- PATHS ${GLOG_LIBRARYDIR}) -+ PATHS ${CONAN_GLOG_ROOT}) - find_library(GLOG_LIBRARY_DEBUG glogd -- PATHS ${GLOG_LIBRARYDIR}) -+ PATHS ${CONAN_GLOG_ROOT}) - - find_path(GLOG_INCLUDE_DIR glog/logging.h - PATHS ${GLOG_INCLUDEDIR}) diff --git a/recipes/folly/all/patches/0019-exclude-example.patch b/recipes/folly/all/patches/0019-exclude-example.patch deleted file mode 100644 index d2afb310ff8a0..0000000000000 --- a/recipes/folly/all/patches/0019-exclude-example.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/folly/CMakeLists.txt b/folly/CMakeLists.txt -index 883f27c..2d2086f 100644 ---- a/folly/CMakeLists.txt -+++ b/folly/CMakeLists.txt -@@ -28,7 +28,6 @@ install( - ) - - add_subdirectory(experimental/exception_tracer) --add_subdirectory(logging/example) - - if (PYTHON_EXTENSIONS) - # Create tree of symbolic links in structure required for successful diff --git a/recipes/folly/all/patches/0020-include-ssizet.patch b/recipes/folly/all/patches/0020-include-ssizet.patch deleted file mode 100644 index 0575fecd13e84..0000000000000 --- a/recipes/folly/all/patches/0020-include-ssizet.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/folly/executors/ExecutorWithPriority.h b/folly/executors/ExecutorWithPriority.h -index b95a6c4..18b8110 100644 ---- a/folly/executors/ExecutorWithPriority.h -+++ b/folly/executors/ExecutorWithPriority.h -@@ -18,6 +18,7 @@ - - #include - #include -+#include - - namespace folly { - diff --git a/recipes/folly/all/patches/0021-typedef-clockid.patch b/recipes/folly/all/patches/0021-typedef-clockid.patch deleted file mode 100644 index fb46c057d58ce..0000000000000 --- a/recipes/folly/all/patches/0021-typedef-clockid.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/folly/portability/Time.h b/folly/portability/Time.h -index 994a09e5d70..e4f0d101ca9 100644 ---- a/folly/portability/Time.h -+++ b/folly/portability/Time.h -@@ -49,7 +49,6 @@ - #define CLOCK_PROCESS_CPUTIME_ID 2 - #define CLOCK_THREAD_CPUTIME_ID 3 - --typedef uint8_t clockid_t; - extern "C" int clock_gettime(clockid_t clk_id, struct timespec* ts); - extern "C" int clock_getres(clockid_t clk_id, struct timespec* ts); - #endif diff --git a/recipes/folly/all/patches/0022-fix-windows-minmax.patch b/recipes/folly/all/patches/0022-fix-windows-minmax.patch deleted file mode 100644 index 1fc69a43a83e5..0000000000000 --- a/recipes/folly/all/patches/0022-fix-windows-minmax.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/CMake/FollyCompilerMSVC.cmake b/CMake/FollyCompilerMSVC.cmake -index ec2ce1a1d..16deda71c 100644 ---- a/CMake/FollyCompilerMSVC.cmake -+++ b/CMake/FollyCompilerMSVC.cmake -@@ -289,6 +289,7 @@ function(apply_folly_compile_options_to_target THETARGET) - # And the extra defines: - target_compile_definitions(${THETARGET} - PUBLIC -+ NOMINMAX - _CRT_NONSTDC_NO_WARNINGS # Don't deprecate posix names of functions. - _CRT_SECURE_NO_WARNINGS # Don't deprecate the non _s versions of various standard library functions, because safety is for chumps. - _SCL_SECURE_NO_WARNINGS # Don't deprecate the non _s versions of various standard library functions, because safety is for chumps. diff --git a/recipes/folly/all/test_package/CMakeLists.txt b/recipes/folly/all/test_package/CMakeLists.txt index 6a9df4ea0b752..82796f7de6547 100644 --- a/recipes/folly/all/test_package/CMakeLists.txt +++ b/recipes/folly/all/test_package/CMakeLists.txt @@ -4,13 +4,5 @@ project(test_package CXX) find_package(folly REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} - Folly::folly - Folly::follybenchmark) - - -if (${FOLLY_VERSION} VERSION_LESS "2021.07.20.00") - set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14) -else() - set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17) -endif() +target_link_libraries(${PROJECT_NAME} PRIVATE Folly::folly) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/folly/all/test_package/conanfile.py b/recipes/folly/all/test_package/conanfile.py index 63889d5258fa5..7aa104bd186ed 100644 --- a/recipes/folly/all/test_package/conanfile.py +++ b/recipes/folly/all/test_package/conanfile.py @@ -1,21 +1,19 @@ import os from conan import ConanFile -from conan.tools.cmake import CMake, CMakeToolchain +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout from conan.tools.build import can_run -from conan.tools.cmake import cmake_layout -required_conan_version = ">=1.43.0" class TestPackageConan(ConanFile): 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.variables["FOLLY_VERSION"] = self.dependencies["folly"].ref.version tc.generate() def layout(self): @@ -28,4 +26,4 @@ def build(self): def test(self): if can_run(self): - self.run(os.path.join(self.cpp.build.bindirs[0], "test_package"), env="conanrun") + self.run(os.path.join(self.cpp.build.bindir, "test_package"), env="conanrun") diff --git a/recipes/folly/all/test_package/test_package.cpp b/recipes/folly/all/test_package/test_package.cpp index cc522b8b0280d..247e44f76e0fd 100644 --- a/recipes/folly/all/test_package/test_package.cpp +++ b/recipes/folly/all/test_package/test_package.cpp @@ -1,29 +1,12 @@ #include #include -#include + #include -#include -#include -#include -#include -#if FOLLY_HAVE_ELF -#include -#endif +#include -static void print_uri(const folly::fbstring& value) { - const folly::Uri uri(value); - std::cout << "The authority from " << value << " is " << uri.authority() << std::endl; -} int main() { - folly::ThreadedExecutor executor; - folly::Promise promise; - folly::Future future = promise.getSemiFuture().via(&executor); - folly::Future unit = std::move(future).thenValue(print_uri); - promise.setValue("https://github.com/bincrafters"); - std::move(unit).get(); -#if FOLLY_HAVE_ELF - folly::symbolizer::ElfFile elffile; -#endif + folly::fbstring address{"127.0.0.1"}; + folly::IPAddress::validate(address); return EXIT_SUCCESS; } diff --git a/recipes/folly/all/test_v1_package/CMakeLists.txt b/recipes/folly/all/test_v1_package/CMakeLists.txt index f8cc697ab67d2..c2866c350e271 100644 --- a/recipes/folly/all/test_v1_package/CMakeLists.txt +++ b/recipes/folly/all/test_v1_package/CMakeLists.txt @@ -4,14 +4,5 @@ project(test_package CXX) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(folly CONFIG REQUIRED) - -add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} Folly::folly) - - -if (${FOLLY_VERSION} VERSION_LESS "2021.07.20.00") - set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14) -else() - set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17) -endif() +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/folly/all/test_v1_package/conanfile.py b/recipes/folly/all/test_v1_package/conanfile.py index 8b8cfae4c1882..49a3a66ea5bad 100644 --- a/recipes/folly/all/test_v1_package/conanfile.py +++ b/recipes/folly/all/test_v1_package/conanfile.py @@ -8,11 +8,10 @@ class TestPackageConan(ConanFile): def build(self): cmake = CMake(self) - cmake.definitions["FOLLY_VERSION"] = self.deps_cpp_info["folly"].version cmake.configure() cmake.build() def test(self): if not tools.cross_building(self): bin_path = os.path.join("bin", "test_package") - self.run(command=bin_path, run_environment=True) + self.run(bin_path, run_environment=True) diff --git a/recipes/folly/all/test_v1_package/test_package.cpp b/recipes/folly/all/test_v1_package/test_package.cpp deleted file mode 100644 index cc522b8b0280d..0000000000000 --- a/recipes/folly/all/test_v1_package/test_package.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#if FOLLY_HAVE_ELF -#include -#endif - -static void print_uri(const folly::fbstring& value) { - const folly::Uri uri(value); - std::cout << "The authority from " << value << " is " << uri.authority() << std::endl; -} - -int main() { - folly::ThreadedExecutor executor; - folly::Promise promise; - folly::Future future = promise.getSemiFuture().via(&executor); - folly::Future unit = std::move(future).thenValue(print_uri); - promise.setValue("https://github.com/bincrafters"); - std::move(unit).get(); -#if FOLLY_HAVE_ELF - folly::symbolizer::ElfFile elffile; -#endif - return EXIT_SUCCESS; -} diff --git a/recipes/folly/config.yml b/recipes/folly/config.yml index 6a14a274c3fe9..e799fbeee0433 100644 --- a/recipes/folly/config.yml +++ b/recipes/folly/config.yml @@ -1,7 +1,3 @@ versions: - "2019.10.21.00": - folder: all - "2020.08.10.00": - folder: all - "2022.01.31.00": - folder: all + "2024.08.12.00": + folder: all diff --git a/recipes/fontconfig/all/conandata.yml b/recipes/fontconfig/all/conandata.yml index d4f92f5455a44..6691cd7b19491 100644 --- a/recipes/fontconfig/all/conandata.yml +++ b/recipes/fontconfig/all/conandata.yml @@ -1,7 +1,16 @@ sources: - "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" + "2.15.0": + url: "https://www.freedesktop.org/software/fontconfig/release/fontconfig-2.15.0.tar.xz" + sha256: "63a0658d0e06e0fa886106452b58ef04f21f58202ea02a94c39de0d3335d7c0e" + "2.14.2": + url: "https://www.freedesktop.org/software/fontconfig/release/fontconfig-2.14.2.tar.xz" + sha256: "dba695b57bce15023d2ceedef82062c2b925e51f5d4cc4aef736cf13f60a468b" + "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/all/conanfile.py b/recipes/fontconfig/all/conanfile.py index 57f5865cd7ba6..dd6e6f661f713 100644 --- a/recipes/fontconfig/all/conanfile.py +++ b/recipes/fontconfig/all/conanfile.py @@ -1,12 +1,17 @@ from conan import ConanFile -from conan.errors import ConanInvalidConfiguration -from conan.tools import files, microsoft -from conans import tools, AutoToolsBuildEnvironment +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 PkgConfigDeps +from conan.tools.layout import basic_layout +from conan.tools.meson import Meson, MesonToolchain -import functools import os -required_conan_version = ">=1.50.2" +required_conan_version = ">=1.64.0 <2 || >=2.2.0" class FontconfigConan(ConanFile): @@ -26,23 +31,8 @@ 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"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -50,86 +40,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 + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") - def requirements(self): - self.requires("freetype/2.12.1") - self.requires("expat/2.4.9") - if self.settings.os == "Linux": - self.requires("libuuid/1.0.3") + def layout(self): + basic_layout(self, src_folder="src") - def validate(self): - if microsoft.is_msvc(self): - raise ConanInvalidConfiguration("fontconfig does not support Visual Studio for versions < 2.13.93.") + def requirements(self): + self.requires("freetype/2.13.2") + self.requires("expat/[>=2.6.2 <3]") def build_requirements(self): - self.build_requires("gperf/3.1") - self.build_requires("pkgconf/1.7.4") - if self._settings_build.os == "Windows" and not self.conf.get("tools.microsoft.bash:path", check_type=str): - self.build_requires("msys2/cci.latest") + self.tool_requires("gperf/3.1") + self.tool_requires("meson/1.4.0") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/2.1.0") 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_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-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 + 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", + "sysconfdir": os.path.join("res", "etc"), + "datadir": os.path.join("res", "share"), + }) + tc.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)) - # 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"), - "@CROSS_COMPILING_TRUE@RUN_FC_CACHE_TEST = false", - "RUN_FC_CACHE_TEST=false" - ) + apply_conandata_patches(self) def build(self): self._patch_files() - # 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() + meson = Meson(self) + meson.configure() + meson.build() def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") - 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", self.source_folder, os.path.join(self.package_folder, "licenses")) + meson = Meson(self) + meson.install() + rm(self, "*.pdb", self.package_folder, recursive=True) + rm(self, "*.conf", os.path.join(self.package_folder, "res", "etc", "fonts", "conf.d")) + rm(self, "*.def", os.path.join(self.package_folder, "lib")) + 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("cmake_find_mode", "both") @@ -140,15 +107,26 @@ def package_info(self): if self.settings.os in ("Linux", "FreeBSD"): self.cpp_info.system_libs.extend(["m", "pthread"]) + fontconfig_path = os.path.join(self.package_folder, "res", "etc", "fonts") + self.runenv_info.append_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" - - 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? + 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/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..42aa9d19c7fbe 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.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" + 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/meson/test_v1_package/CMakeLists.txt b/recipes/fontconfig/all/test_v1_package/CMakeLists.txt similarity index 100% rename from recipes/fontconfig/meson/test_v1_package/CMakeLists.txt rename to recipes/fontconfig/all/test_v1_package/CMakeLists.txt diff --git a/recipes/glew/all/test_v1_package/conanfile.py b/recipes/fontconfig/all/test_v1_package/conanfile.py similarity index 100% rename from recipes/glew/all/test_v1_package/conanfile.py rename to recipes/fontconfig/all/test_v1_package/conanfile.py diff --git a/recipes/fontconfig/config.yml b/recipes/fontconfig/config.yml index 266274964008f..1d4c62bc9edab 100644 --- a/recipes/fontconfig/config.yml +++ b/recipes/fontconfig/config.yml @@ -1,7 +1,7 @@ versions: - "2.13.93": - folder: meson - "2.13.92": + "2.15.0": + folder: all + "2.14.2": folder: all - "2.13.91": + "2.13.93": folder: all diff --git a/recipes/fontconfig/meson/conandata.yml b/recipes/fontconfig/meson/conandata.yml deleted file mode 100644 index 473f136c77b81..0000000000000 --- a/recipes/fontconfig/meson/conandata.yml +++ /dev/null @@ -1,10 +0,0 @@ -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: "backport" - 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 deleted file mode 100644 index 325f9afad288e..0000000000000 --- a/recipes/fontconfig/meson/conanfile.py +++ /dev/null @@ -1,137 +0,0 @@ -from conan import ConanFile -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 -from conan.tools.scm import Version -from conan.tools.env import VirtualBuildEnv -from conan.tools.meson import Meson, MesonToolchain -from conan.tools.gnu import PkgConfigDeps - -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 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/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 source(self): - get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=self.source_folder) - - def layout(self): - basic_layout(self, src_folder="src") - - def generate(self): - deps = PkgConfigDeps(self) - deps.generate() - - tc = MesonToolchain(self) - tc.project_options.update({ - "doc": "disabled", - "nls": "disabled", - "tests": "disabled", - "tools": "disabled" - }) - tc.generate() - - env = VirtualBuildEnv(self) - env.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.deps_cpp_info['freetype'].version)}'") - - def build(self): - self._patch_files() - meson = Meson(self) - meson.configure() - meson.build() - - def package(self): - meson = Meson(self) - meson.install() - if is_msvc(self): - if os.path.isfile(os.path.join(self.package_folder, "lib", "libfontconfig.a")): - rename(self, os.path.join(self.package_folder, "lib", "libfontconfig.a"), - os.path.join(self.package_folder, "lib", "fontconfig.lib")) - - copy(self, "COPYING", self.source_folder, os.path.join(self.package_folder, "licenses")) - 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")) - - 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"]) - - 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? diff --git a/recipes/fontconfig/meson/patches/0001-meson-win32.patch b/recipes/fontconfig/meson/patches/0001-meson-win32.patch deleted file mode 100644 index c8a4911fc8e45..0000000000000 --- a/recipes/fontconfig/meson/patches/0001-meson-win32.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- conf.d/link_confs.py -+++ conf.d/link_confs.py -@@ -3,6 +3,7 @@ - import os - import sys - import argparse -+import platform - - if __name__=='__main__': - parser = argparse.ArgumentParser() -@@ -26,7 +27,7 @@ if __name__=='__main__': - break - except OSError as e: - # Symlink privileges are not available -- if len(e.args) == 1 and 'privilege' in e.args[0]: -+ if platform.system().lower() == 'windows' and e.winerror == 1314: - break - raise - except FileExistsError: diff --git a/recipes/fontconfig/meson/test_package/CMakeLists.txt b/recipes/fontconfig/meson/test_package/CMakeLists.txt deleted file mode 100644 index cf73820fd98bc..0000000000000 --- a/recipes/fontconfig/meson/test_package/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package C) - -find_package(Fontconfig CONFIG REQUIRED) - -add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE Fontconfig::Fontconfig) -set_target_properties(${PROJECT_NAME} PROPERTIES C_STANDARD 99) diff --git a/recipes/fontconfig/meson/test_package/conanfile.py b/recipes/fontconfig/meson/test_package/conanfile.py deleted file mode 100644 index 42aa9d19c7fbe..0000000000000 --- a/recipes/fontconfig/meson/test_package/conanfile.py +++ /dev/null @@ -1,26 +0,0 @@ -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 deleted file mode 100644 index 7703ab64bbdec..0000000000000 --- a/recipes/fontconfig/meson/test_package/test_package.c +++ /dev/null @@ -1,24 +0,0 @@ -#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/foonathan-lexy/all/conandata.yml b/recipes/foonathan-lexy/all/conandata.yml index 3b5935228f47a..98cd033191be3 100644 --- a/recipes/foonathan-lexy/all/conandata.yml +++ b/recipes/foonathan-lexy/all/conandata.yml @@ -1,4 +1,7 @@ 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" diff --git a/recipes/foonathan-lexy/all/conanfile.py b/recipes/foonathan-lexy/all/conanfile.py index d95ef191b17a0..ab4e9af924282 100644 --- a/recipes/foonathan-lexy/all/conanfile.py +++ b/recipes/foonathan-lexy/all/conanfile.py @@ -15,8 +15,8 @@ class FoonathanLexyConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/foonathan/lexy" topics = ("parser", "parser-combinators", "grammar") + package_type = "static-library" settings = "os", "arch", "compiler", "build_type" - no_copy_source = True options = { "fPIC": [True, False], } @@ -46,7 +46,7 @@ def layout(self): cmake_layout(self, src_folder="src") def validate(self): - if self.info.settings.compiler.cppstd: + 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: @@ -54,20 +54,8 @@ def validate(self): 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") + self.tool_requires("cmake/[>=3.18 <4]") def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder) @@ -88,8 +76,6 @@ 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")) diff --git a/recipes/foonathan-lexy/all/test_package/conanfile.py b/recipes/foonathan-lexy/all/test_package/conanfile.py index 1111583fea732..a9fb96656f203 100644 --- a/recipes/foonathan-lexy/all/test_package/conanfile.py +++ b/recipes/foonathan-lexy/all/test_package/conanfile.py @@ -4,7 +4,6 @@ import os -# It will become the standard on Conan 2.x class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" diff --git a/recipes/foonathan-lexy/config.yml b/recipes/foonathan-lexy/config.yml index e64d73ad80095..9b16b933ef1b6 100644 --- a/recipes/foonathan-lexy/config.yml +++ b/recipes/foonathan-lexy/config.yml @@ -1,4 +1,6 @@ versions: + "2022.12.1": + folder: all "2022.12.00": folder: all "2022.05.01": diff --git a/recipes/foonathan-memory/all/conandata.yml b/recipes/foonathan-memory/all/conandata.yml index 7a847a5e8afc7..5438e06adfb02 100644 --- a/recipes/foonathan-memory/all/conandata.yml +++ b/recipes/foonathan-memory/all/conandata.yml @@ -1,4 +1,7 @@ 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" @@ -11,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 b341ffe0edc58..041ce28409468 100644 --- a/recipes/foonathan-memory/all/conanfile.py +++ b/recipes/foonathan-memory/all/conanfile.py @@ -2,7 +2,8 @@ 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, collect_libs, copy, get, rm, rmdir, save +from conan.tools.files import apply_conandata_patches, export_conandata_patches, collect_libs, copy, get, replace_in_file, rm, rmdir, save +from conan.tools.scm import Version import os import textwrap @@ -16,13 +17,13 @@ class FoonathanMemoryConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" description = "STL compatible C++ memory allocator library" topics = ("memory", "STL", "RawAllocator") - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], "with_tools": [True, False], - "with_sizecheck":[True, False], + "with_sizecheck": [True, False], } default_options = { "shared": False, @@ -34,8 +35,7 @@ class FoonathanMemoryConan(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": @@ -45,18 +45,19 @@ def configure(self): if self.options.shared: self.options.rm_safe("fPIC") - def validate(self): - # FIXME: jenkins servers throw error with this combination - # quick fix until somebody can reproduce - if hasattr(self, "settings_build") and cross_building(self): - raise ConanInvalidConfiguration("Cross building is not yet supported. Contributions are welcome") + def validate_build(self): + # Versions older than 0.7.2 require to compile and run an executable + # during the build, newer versions do it differently. + is_older = Version(self.version) < "0.7.2" + if hasattr(self, "settings_build") and cross_building(self) and is_older: + raise ConanInvalidConfiguration( + "Cross building is not supported on versions older than 0.7.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) @@ -66,17 +67,28 @@ def generate(self): tc.variables["FOONATHAN_MEMORY_CHECK_ALLOCATION_SIZE"] = self.options.with_sizecheck tc.generate() - def build(self): + def _patch_sources(self): apply_conandata_patches(self) + current_version = Version(self.version) + if current_version >= "0.7.2" and current_version < "0.7.4": + # Remove static linking when cross-building, see: + # https://github.com/conan-io/conan-center-index/pull/16997#issuecomment-1508243262 + # https://github.com/foonathan/memory/issues/162 + replace_in_file(self, os.path.join(self.source_folder, "tool/CMakeLists.txt"), "if (CMAKE_CROSSCOMPILING)", "if (FALSE)") + + 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")) + 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", "foonathan_memory", "cmake")) + rmdir(self, os.path.join(self.package_folder, + "lib", "foonathan_memory", "cmake")) rmdir(self, os.path.join(self.package_folder, "share")) rm(self, "*.pdb", os.path.join(self.package_folder, "lib")) @@ -105,7 +117,8 @@ def package_info(self): self.cpp_info.set_property("cmake_file_name", "foonathan_memory") self.cpp_info.set_property("cmake_target_name", "foonathan_memory") self.cpp_info.libs = collect_libs(self) - self.cpp_info.includedirs = [os.path.join("include", "foonathan_memory")] + self.cpp_info.includedirs = [ + os.path.join("include", "foonathan_memory")] if self.options.with_tools: bin_path = os.path.join(self.package_folder, "bin") @@ -115,5 +128,7 @@ def package_info(self): # TODO: to remove in conan v2 once legacy generators removed self.cpp_info.names["cmake_find_package"] = "foonathan_memory" self.cpp_info.names["cmake_find_package_multi"] = "foonathan_memory" - 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.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/foonathan-memory/config.yml b/recipes/foonathan-memory/config.yml index 75789cf28caa8..d4d016ea9d423 100644 --- a/recipes/foonathan-memory/config.yml +++ b/recipes/foonathan-memory/config.yml @@ -1,4 +1,6 @@ versions: + "0.7.3": + folder: all "0.7.2": folder: all "0.7.1": diff --git a/recipes/forestdb/all/CMakeLists.txt b/recipes/forestdb/all/CMakeLists.txt deleted file mode 100644 index 78b537ac50f88..0000000000000 --- a/recipes/forestdb/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.10) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/forestdb/all/conandata.yml b/recipes/forestdb/all/conandata.yml index 935f0559af335..e15581c6eba7e 100644 --- a/recipes/forestdb/all/conandata.yml +++ b/recipes/forestdb/all/conandata.yml @@ -5,4 +5,3 @@ sources: patches: "cci.20220727": - patch_file: "patches/0001-proper-cxx-std-flag.patch" - base_path: "source_subfolder" diff --git a/recipes/forestdb/all/conanfile.py b/recipes/forestdb/all/conanfile.py index 526ab2f1f2069..fd380e2335813 100644 --- a/recipes/forestdb/all/conanfile.py +++ b/recipes/forestdb/all/conanfile.py @@ -1,8 +1,13 @@ import os -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -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, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get + +required_conan_version = ">=1.53.0" + class ForestDBConan(ConanFile): name = "forestdb" @@ -11,12 +16,13 @@ class ForestDBConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/ForestDB-KVStore/forestdb" topics = ("kv-store", "mvcc", "wal") - settings = "os", "arch", "compiler", "build_type" + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], - "with_snappy": [True, False] + "with_snappy": [True, False], } default_options = { "shared": False, @@ -24,64 +30,65 @@ class ForestDBConan(ConanFile): "with_snappy": False, } - generators = "cmake" + def export_sources(self): + export_conandata_patches(self) - @property - def _source_subfolder(self): - return "source_subfolder" + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") - 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 layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.options.with_snappy: - self.requires("snappy/1.1.9") + self.requires("snappy/1.1.10") def validate(self): if self.settings.os == "Windows": raise ConanInvalidConfiguration("Windows Builds Unsupported") if self.settings.compiler == "clang": - if self.settings.compiler.libcxx == "libc++" and self.options.shared == False: + if self.settings.compiler.libcxx == "libc++" and not self.options.shared: raise ConanInvalidConfiguration("LibC++ Static Builds Unsupported") if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 11) - - def configure(self): - if self.options.shared: - del self.options.fPIC + 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], strip_root=True) - def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = CMake(self) - cmake.definitions["SNAPPY_OPTION"] = "Disable" + def generate(self): + tc = CMakeToolchain(self) + tc.variables["SNAPPY_OPTION"] = "Disable" if self.options.with_snappy: - cmake.definitions["SNAPPY_OPTION"] = "Enable" - cmake.configure() + tc.variables["SNAPPY_OPTION"] = "Enable" + tc.generate() + tc = CMakeDeps(self) + tc.generate() + + def build(self): + apply_conandata_patches(self) lib_target = "forestdb" if not self.options.shared: lib_target = "static_lib" + cmake = CMake(self) + cmake.configure() cmake.build(target=lib_target) 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) # Parent Build system does not support library type selection # and will only install the shared object from cmake; so we must # handpick our libraries. - self.copy("*.a*", dst="lib", src="lib") - self.copy("*.lib", dst="lib", src="lib") - self.copy("*.so*", dst="lib", src="lib", symlinks=True) - self.copy("*.dylib*", dst="lib", src="lib", symlinks=True) - self.copy("*.dll*", dst="lib", src="lib") - self.copy("*.h", dst="include", src=os.path.join(self._source_subfolder, "include"), keep_path=True) + for pattern in ["*.a*", "*.lib", "*.so*", "*.dylib*", "*.dll*"]: + copy(self, pattern, + dst=os.path.join(self.package_folder, "lib"), + src=self.build_folder) + copy(self, "*.h", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include"), + keep_path=True) def package_info(self): self.cpp_info.libs = ["forestdb"] - self.cpp_info.system_libs.extend(["pthread", "m", "dl"]) - if self.settings.os == "Linux": - self.cpp_info.system_libs.extend(["rt"]) + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs = ["pthread", "m", "dl", "rt"] diff --git a/recipes/forestdb/all/test_package/CMakeLists.txt b/recipes/forestdb/all/test_package/CMakeLists.txt index 9912b39ed8da5..44b53f97f3be5 100644 --- a/recipes/forestdb/all/test_package/CMakeLists.txt +++ b/recipes/forestdb/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - find_package(forestdb REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/forestdb/all/test_package/conanfile.py b/recipes/forestdb/all/test_package/conanfile.py index 751b9d5bc7b9c..fae501d0afb9e 100644 --- a/recipes/forestdb/all/test_package/conanfile.py +++ b/recipes/forestdb/all/test_package/conanfile.py @@ -1,11 +1,19 @@ -from conans import ConanFile, CMake, tools, RunEnvironment -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", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain" + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/forestdb/all/test_v1_package/CMakeLists.txt b/recipes/forestdb/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/forestdb/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/forestdb/all/test_v1_package/conanfile.py b/recipes/forestdb/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..751b9d5bc7b9c --- /dev/null +++ b/recipes/forestdb/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools, RunEnvironment +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/foxglove-schemas-protobuf/all/CMakeLists.txt b/recipes/foxglove-schemas-protobuf/all/CMakeLists.txt new file mode 100644 index 0000000000000..a8497dc9f144a --- /dev/null +++ b/recipes/foxglove-schemas-protobuf/all/CMakeLists.txt @@ -0,0 +1,44 @@ +cmake_minimum_required(VERSION 3.15) +project(Foxglove-Schemas CXX) + +find_package(Protobuf 3 REQUIRED) + +FILE(GLOB all_protos "schemas/proto/foxglove/*.proto") + +# Create lists of all the generated headers and sources +FOREACH(f ${all_protos}) + file(RELATIVE_PATH f ${CMAKE_CURRENT_SOURCE_DIR}/schemas/proto ${f}) + STRING(REGEX REPLACE "\\.proto$" "" f ${f}) + LIST(APPEND proto_headers "${CMAKE_CURRENT_SOURCE_DIR}/autogenerated/${f}.pb.h") + LIST(APPEND proto_sources "${CMAKE_CURRENT_SOURCE_DIR}/autogenerated/${f}.pb.cc") +ENDFOREACH(f) + +LIST(APPEND proto_sources ${proto_headers}) + +# Create a directory for the generated files +FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/autogenerated) + +# Execute the protoc compiler +add_custom_command( + OUTPUT ${proto_sources} + COMMAND ${CMAKE_COMMAND} -E make_directory autogenerated + COMMAND ${Protobuf_PROTOC_EXECUTABLE} --proto_path=${CMAKE_CURRENT_SOURCE_DIR}/schemas/proto --cpp_out=${CMAKE_CURRENT_SOURCE_DIR}/autogenerated ${all_protos} +) + +add_library(foxglove_schemas_protobuf ${proto_sources}) + +target_include_directories(foxglove_schemas_protobuf PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/autogenerated) + +target_link_libraries(foxglove_schemas_protobuf PUBLIC protobuf::libprotobuf) + +set_property(TARGET foxglove_schemas_protobuf PROPERTY CXX_STANDARD 17) + + +# Set all the headers as public so they are installed and add the proto files since they should also be installed in the include directory +LIST(APPEND proto_headers ${all_protos}) +set_target_properties(foxglove_schemas_protobuf PROPERTIES PUBLIC_HEADER "${proto_headers}" ) + + +install(TARGETS foxglove_schemas_protobuf + LIBRARY DESTINATION lib + PUBLIC_HEADER DESTINATION include/foxglove) diff --git a/recipes/foxglove-schemas-protobuf/all/conandata.yml b/recipes/foxglove-schemas-protobuf/all/conandata.yml new file mode 100644 index 0000000000000..658f5043f7c66 --- /dev/null +++ b/recipes/foxglove-schemas-protobuf/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + 0.1.0: + url: https://github.com/foxglove/schemas/archive/refs/tags/releases/python/foxglove-schemas-protobuf/v0.1.0.tar.gz + sha256: 42153b62000c0c614301ecd2b9173c69f467dd543db3328a1b0491bce8ee5594 diff --git a/recipes/foxglove-schemas-protobuf/all/conanfile.py b/recipes/foxglove-schemas-protobuf/all/conanfile.py new file mode 100644 index 0000000000000..c4e016879327e --- /dev/null +++ b/recipes/foxglove-schemas-protobuf/all/conanfile.py @@ -0,0 +1,101 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy, apply_conandata_patches, export_conandata_patches +from conan.tools.microsoft import check_min_vs +from conan.tools.scm import Version +import os + + +required_conan_version = ">=1.60.0" + + +class FoxgloveSchemasProtobufConan(ConanFile): + name = "foxglove-schemas-protobuf" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/foxglove/schemas" + description = "Protobuf schemas for Foxglove" + license = "MIT" + topics = ("foxglove", "protobuf", "schemas") + + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps" + package_type = "library" + + @property + def _min_cppstd(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "msvc": "191", + "gcc": "9", + "clang": "9", + "apple-clang": "12", + } + + def export_sources(self): + copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=(self.export_sources_folder + "/src")) + export_conandata_patches(self) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + check_min_vs(self, self._compilers_minimum_version["msvc"]) + 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" and self.options.shared: + raise ConanInvalidConfiguration("Windows shared builds are not supported yet.") + + def requirements(self): + self.requires("protobuf/3.21.12", transitive_headers=True, transitive_libs=True) + + def build_requirements(self): + self.tool_requires("protobuf/") + + def layout(self): + cmake_layout(self, src_folder="src") + + def generate(self): + tc = CMakeToolchain(self) + tc.generate() + + 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 build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + cmake = CMake(self) + cmake.configure() + cmake.install() + copy(self, "LICENSE.md", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + + def package_info(self): + self.cpp_info.libs = ["foxglove_schemas_protobuf"] diff --git a/recipes/foxglove-schemas-protobuf/all/test_package/CMakeLists.txt b/recipes/foxglove-schemas-protobuf/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..793bfe03abb6b --- /dev/null +++ b/recipes/foxglove-schemas-protobuf/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package CXX) + +find_package(foxglove-schemas-protobuf CONFIG REQUIRED) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} foxglove-schemas-protobuf::foxglove-schemas-protobuf) +set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 17 CXX_STANDARD_REQUIRED ON) diff --git a/recipes/foxglove-schemas-protobuf/all/test_package/conanfile.py b/recipes/foxglove-schemas-protobuf/all/test_package/conanfile.py new file mode 100644 index 0000000000000..8d2d8af87e4f6 --- /dev/null +++ b/recipes/foxglove-schemas-protobuf/all/test_package/conanfile.py @@ -0,0 +1,24 @@ +from conan import ConanFile +from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout +from conan.tools.build import can_run +import os + + +class TestPackageConan(ConanFile): + settings = ("os", "arch", "compiler", "build_type") + generators = "CMakeDeps", "CMakeToolchain" + + 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 can_run(self): + self.run(os.path.join(self.cpp.build.bindirs[0], "test_package"), env="conanrun") diff --git a/recipes/foxglove-schemas-protobuf/all/test_package/test_package.cpp b/recipes/foxglove-schemas-protobuf/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..264f429e55dee --- /dev/null +++ b/recipes/foxglove-schemas-protobuf/all/test_package/test_package.cpp @@ -0,0 +1,8 @@ +#include + + +int main() { + foxglove::SceneUpdate msg; + auto* entity = msg.add_entities(); + return 0; +} diff --git a/recipes/foxglove-schemas-protobuf/config.yml b/recipes/foxglove-schemas-protobuf/config.yml new file mode 100644 index 0000000000000..684647742e06b --- /dev/null +++ b/recipes/foxglove-schemas-protobuf/config.yml @@ -0,0 +1,3 @@ +versions: + 0.1.0: + folder: all diff --git a/recipes/foxglove-websocket/all/conandata.yml b/recipes/foxglove-websocket/all/conandata.yml index e0bef4a6e6152..1a4d0efe6e5f6 100644 --- a/recipes/foxglove-websocket/all/conandata.yml +++ b/recipes/foxglove-websocket/all/conandata.yml @@ -1,4 +1,16 @@ sources: - 0.0.1: - url: https://github.com/foxglove/ws-protocol/archive/refs/tags/releases/cpp/v0.0.1.tar.gz - sha256: 94766f44973f0c0ce7e87039b9ef9d5b4a8bc73727047568170ac61262625c9b + 1.3.1: + url: https://github.com/foxglove/ws-protocol/archive/refs/tags/releases/cpp/v1.3.1.tar.gz + sha256: 48bae8599603da893e559b952e7fec1392aeb55cc6d59288feac6e6428e61bef + 1.3.0: + url: https://github.com/foxglove/ws-protocol/archive/refs/tags/releases/cpp/v1.3.0.tar.gz + sha256: 5c1d4cda60a89bf635ef0150e8cd2f4da569f92beb8ac8555795ed7fd47f2a21 + 1.2.0: + url: https://github.com/foxglove/ws-protocol/archive/refs/tags/releases/cpp/v1.2.0.tar.gz + sha256: 0471d3932500ed6acd87a99cd76e048366c82f2527c1631afcee4f8ab71c4ab7 + 1.1.0: + url: https://github.com/foxglove/ws-protocol/archive/refs/tags/releases/cpp/v1.1.0.tar.gz + sha256: 3ad1f639e340e878dd638d542e57185b8c7c08fdfcb03d8c43d054957078a81f + 1.0.0: + url: https://github.com/foxglove/ws-protocol/archive/refs/tags/releases/cpp/v1.0.0.tar.gz + sha256: c6106934a47d9d5b53ee3f6a0a6c8ec778ffdb52e9b462136bfc1bc5391ed227 diff --git a/recipes/foxglove-websocket/all/conanfile.py b/recipes/foxglove-websocket/all/conanfile.py index 2d4424bef585f..666816b0d5820 100644 --- a/recipes/foxglove-websocket/all/conanfile.py +++ b/recipes/foxglove-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.cmake import CMakeToolchain, CMake, cmake_layout +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy, rmdir +from conan.tools.scm import Version import os +required_conan_version = ">=1.53.0" + class FoxgloveWebSocketConan(ConanFile): name = "foxglove-websocket" url = "https://github.com/conan-io/conan-center-index" @@ -11,30 +17,85 @@ class FoxgloveWebSocketConan(ConanFile): license = "MIT" topics = ("foxglove", "websocket") - settings = ("os", "compiler", "build_type", "arch") - requires = ("nlohmann_json/3.10.5", "websocketpp/0.8.2") - generators = ("cmake", "cmake_find_package") + options = { + "shared": [True, False], + "fPIC": [True, False], + "asio": ["boost", "standalone"], + } + default_options = { + "shared": False, + "fPIC": True, + "asio": "standalone" + } + + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps" + + @property + def _min_cppstd(self): + return 17 - _source_root = "source_root" - _source_package_path = os.path.join(_source_root, "cpp", "foxglove-websocket") + @property + def _compilers_minimum_version(self): + return { + "Visual Studio": "16.9", + "msvc": "191", + "gcc": "9", + "clang": "9", + "apple-clang": "12", + } + + @property + def _source_package_path(self): + return os.path.join(self.source_folder, "tarball", "cpp", "foxglove-websocket") def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_root) + tmp_folder = "tarball" + get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=tmp_folder) + copy(self, "*", src=os.path.join(self.source_folder, tmp_folder, "cpp", "foxglove-websocket"), dst=self.source_folder) + copy(self, "LICENSE", src=tmp_folder, dst=self.source_folder) + rmdir(self, tmp_folder) def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, "17") - 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 self.settings.compiler == "Visual Studio" and tools.Version(self.settings.compiler.version) <= "16.8": - 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 requirements(self): + self.requires("nlohmann_json/3.10.5", transitive_headers=True) + self.requires("websocketpp/0.8.2", transitive_headers=True, transitive_libs=True) + + def layout(self): + cmake_layout(self, src_folder="src") + + def generate(self): + tc = CMakeToolchain(self) + if self.settings.os == "Windows" and self.options.shared: + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + tc.generate() + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC def configure(self): - self.options["websocketpp"].asio = "standalone" + self.options["websocketpp"].asio = self.options.asio + + if self.options.shared: + self.options.rm_safe("fPIC") + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_package_path) - self.copy("include/*", src=self._source_package_path) + cmake = CMake(self) + cmake.install() - def package_id(self): - self.info.header_only() + def package_info(self): + self.cpp_info.libs = ["foxglove_websocket"] diff --git a/recipes/foxglove-websocket/all/test_package/CMakeLists.txt b/recipes/foxglove-websocket/all/test_package/CMakeLists.txt index 2b26900ab008c..869000fbad0c4 100644 --- a/recipes/foxglove-websocket/all/test_package/CMakeLists.txt +++ b/recipes/foxglove-websocket/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(foxglove-websocket 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 foxglove-websocket::foxglove-websocket) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} foxglove-websocket::foxglove-websocket) +set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 17 CXX_STANDARD_REQUIRED ON) diff --git a/recipes/foxglove-websocket/all/test_package/conanfile.py b/recipes/foxglove-websocket/all/test_package/conanfile.py index 005eae16e0474..3475b6c2095c1 100644 --- a/recipes/foxglove-websocket/all/test_package/conanfile.py +++ b/recipes/foxglove-websocket/all/test_package/conanfile.py @@ -1,17 +1,29 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMakeToolchain, 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 = "CMakeDeps" + test_type = "explicit" + + def generate(self): + tc = CMakeToolchain(self) + tc.generate() + + 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", "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/foxglove-websocket/all/test_package/test_package.cpp b/recipes/foxglove-websocket/all/test_package/test_package.cpp index 13842a1ec1a3b..d63b14b5b96bc 100644 --- a/recipes/foxglove-websocket/all/test_package/test_package.cpp +++ b/recipes/foxglove-websocket/all/test_package/test_package.cpp @@ -1,11 +1,17 @@ -#include -#include +#include +#include + +template<> +void foxglove::Server::setupTlsHandler() {} int main() { - foxglove::websocket::Server server{0, "example"}; - server.getEndpoint().set_timer(0, [&](std::error_code const& ec) { - server.stop(); - }); - server.run(); + // Note: Server instance is only initiated here and not started. This is similar to how it's + // done in the websocketpp recipe. + const auto logHandler = [](foxglove::WebSocketLogLevel, char const* msg) { + std::cout << msg << std::endl; + }; + foxglove::ServerOptions serverOptions; + foxglove::Server server("example", logHandler, serverOptions); + (void)server; return 0; } diff --git a/recipes/foxglove-websocket/all/test_v1_package/CMakeLists.txt b/recipes/foxglove-websocket/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..be00a8c7f57c7 --- /dev/null +++ b/recipes/foxglove-websocket/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/foxglove-websocket/all/test_v1_package/conanfile.py b/recipes/foxglove-websocket/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..a4da47d572258 --- /dev/null +++ b/recipes/foxglove-websocket/all/test_v1_package/conanfile.py @@ -0,0 +1,22 @@ +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") + test_type = "explicit" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def requirements(self): + self.requires(self.tested_reference_str) + + 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/foxglove-websocket/config.yml b/recipes/foxglove-websocket/config.yml index 768a10bf6dc2b..5aacc0f786340 100644 --- a/recipes/foxglove-websocket/config.yml +++ b/recipes/foxglove-websocket/config.yml @@ -1,3 +1,11 @@ versions: - 0.0.1: + 1.3.1: + folder: all + 1.3.0: + folder: all + 1.2.0: + folder: all + 1.1.0: + folder: all + 1.0.0: folder: all diff --git a/recipes/fp16/all/conanfile.py b/recipes/fp16/all/conanfile.py index 75666c9f3bd71..92f6f21bd74b0 100644 --- a/recipes/fp16/all/conanfile.py +++ b/recipes/fp16/all/conanfile.py @@ -13,6 +13,7 @@ class Fp16Conan(ConanFile): topics = ("half-precision-floating-point") homepage = "https://github.com/Maratyszcza/FP16" url = "https://github.com/conan-io/conan-center-index" + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -20,14 +21,13 @@ def layout(self): basic_layout(self, src_folder="src") def requirements(self): - self.requires("psimd/cci.20200517", transitive_headers=True) + self.requires("psimd/cci.20200517") 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 diff --git a/recipes/fpgen/all/conandata.yml b/recipes/fpgen/all/conandata.yml index 89315a6f71ce4..0ed9b7cc136ee 100644 --- a/recipes/fpgen/all/conandata.yml +++ b/recipes/fpgen/all/conandata.yml @@ -1,7 +1,4 @@ sources: - "1.1.0": - url: "https://github.com/jay-tux/fpgen/archive/refs/tags/v1.1.0.tar.gz" - sha256: "5e5faf1fbdcb3d93306bd8a838f805afdccdbb9076d78356ad5443943555be7d" "1.1.0-clang": url: "https://github.com/jay-tux/fpgen/archive/refs/tags/v1.1.0-clang.tar.gz" sha256: "02936c1e790bcdba1479cf8164596b05cfc5b7401b3c71e0a1fd77e51fe8b93f" diff --git a/recipes/fpgen/all/conanfile.py b/recipes/fpgen/all/conanfile.py index b9e1ea43fa34a..5d2f0cf538ac5 100644 --- a/recipes/fpgen/all/conanfile.py +++ b/recipes/fpgen/all/conanfile.py @@ -1,94 +1,77 @@ 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 copy, get +from conan.tools.layout import basic_layout + +required_conan_version = ">=1.52.0" class FpgenConan(ConanFile): name = "fpgen" - description = " Functional programming in C++ using C++20 coroutines." + description = "Functional programming in C++ using C++20 coroutines." license = ["MPL2"] - topics = ( - "generators", - "coroutines", - "c++20", - "header-only", - "functional-programming", - "functional", - ) - homepage = "https://github.com/jay-tux/fpgen/" url = "https://github.com/conan-io/conan-center-index" - settings = "arch", "os", "compiler", "build_type" - no_copy_source = True + homepage = "https://github.com/jay-tux/fpgen/" + topics = ("generators", "coroutines", "c++20", "header-only", "functional-programming", "functional") - @property - def _source_subfolder(self): - return "source_subfolder" + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True @property def _min_cppstd(self): - return "20" + return 20 @property def _compilers_minimum_version(self): return { "gcc": "11", "clang": "13", + "apple-clang": "13.1", + "Visual Studio": "16", + "msvc": "192", } - def package_id(self): - self.info.header_only() + 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, - ) + def package_id(self): + self.info.clear() def validate(self): - if self.settings.compiler == "clang" and "clang" not in str(self.version): - raise ConanInvalidConfiguration( - f"Use '{self.version}-clang' for Clang support." - ) - - if ( - self.settings.compiler == "clang" - and not self.settings.compiler.libcxx == "libc++" - ): - raise ConanInvalidConfiguration( - f"Use 'compiler.libcxx=libc++' for {self.name} on Clang." - ) + if self.settings.compiler == "clang" and not self.settings.compiler.libcxx == "libc++": + raise ConanInvalidConfiguration(f"Use 'compiler.libcxx=libc++' with Clang for {self.name}.") if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, self._min_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] - - minimum_version = self._compilers_minimum_version.get( - str(self.settings.compiler), False - ) - if not minimum_version: - raise ConanInvalidConfiguration( - f"{self.name} is currently not available for your compiler." - ) - elif lazy_lt_semver(str(self.settings.compiler.version), minimum_version): + # Needed to allow version "13" >= "13.1" for apple-clang + return all(int(p1) < int(p2) for p1, p2 in zip(v1.split("."), v2.split("."))) + + 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( - f"{self.name} {self.version} requires C++20, 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], strip_root=True) + def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - self.copy( - pattern="*.hpp", - dst=os.path.join("include", "fpgen"), - src=self._source_subfolder, - keep_path=False, - ) + copy(self, "LICENSE", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder) + copy(self, "*.hpp", + dst=os.path.join(self.package_folder, "include", "fpgen"), + src=self.source_folder, + keep_path=False) def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.includedirs.append(os.path.join("include", "fpgen")) diff --git a/recipes/fpgen/all/test_package/CMakeLists.txt b/recipes/fpgen/all/test_package/CMakeLists.txt index 2d7e6737381f9..7013b94735f0f 100644 --- a/recipes/fpgen/all/test_package/CMakeLists.txt +++ b/recipes/fpgen/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ -cmake_minimum_required(VERSION 3.12) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - find_package(fpgen REQUIRED CONFIG) add_executable(${PROJECT_NAME} main.cpp) diff --git a/recipes/fpgen/all/test_package/conanfile.py b/recipes/fpgen/all/test_package/conanfile.py index 3f4a9f50f389e..ef5d7042163ec 100644 --- a/recipes/fpgen/all/test_package/conanfile.py +++ b/recipes/fpgen/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 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.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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/fpgen/all/test_package/main.cpp b/recipes/fpgen/all/test_package/main.cpp index 43bf51fe320f0..d9d39d7a4b608 100644 --- a/recipes/fpgen/all/test_package/main.cpp +++ b/recipes/fpgen/all/test_package/main.cpp @@ -1,13 +1,14 @@ +#include "fpgen/fpgen.hpp" + #include #include -#include "fpgen/fpgen.hpp" int main() { - std::vector vals = {0,1,2,3}; + std::vector vals = {0, 1, 2, 3}; auto gen = fpgen::from(vals); - for(auto &&val : gen) { - std::cout << val << std::endl; + for (auto &&val : gen) { + std::cout << val << std::endl; } return 0; } diff --git a/recipes/fpgen/all/test_v1_package/CMakeLists.txt b/recipes/fpgen/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/fpgen/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/fpgen/all/test_v1_package/conanfile.py b/recipes/fpgen/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..3f4a9f50f389e --- /dev/null +++ b/recipes/fpgen/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +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.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/fpgen/config.yml b/recipes/fpgen/config.yml index ec935d5cf64ff..2786096f9ff86 100644 --- a/recipes/fpgen/config.yml +++ b/recipes/fpgen/config.yml @@ -1,5 +1,3 @@ versions: - "1.1.0": - folder: all "1.1.0-clang": folder: all diff --git a/recipes/fpzip/all/conandata.yml b/recipes/fpzip/all/conandata.yml new file mode 100644 index 0000000000000..ef306da4b0649 --- /dev/null +++ b/recipes/fpzip/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.3.0": + url: "https://github.com/LLNL/fpzip/releases/download/1.3.0/fpzip-1.3.0.tar.gz" + sha256: "248df7d84259e3feaa4c4797956b2a77c3fcd734e8f8fdc51ce171dcf4f0136c" diff --git a/recipes/fpzip/all/conanfile.py b/recipes/fpzip/all/conanfile.py new file mode 100644 index 0000000000000..2369b2e58e6b6 --- /dev/null +++ b/recipes/fpzip/all/conanfile.py @@ -0,0 +1,80 @@ +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 FpzipConan(ConanFile): + name = "fpzip" + description = "Lossless compressor of multidimensional floating-point arrays" + license = "BSD-3-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "http://fpzip.llnl.gov/" + topics = ("compression", "lossless", "floating-point") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_fp": ["fast", "safe", "emul", "int"], + } + default_options = { + "shared": False, + "fPIC": True, + "with_fp": "fast", + } + + 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 source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + @property + def _fp_name_table(self): + return { + "fast": "FPZIP_FP_FAST", + "safe": "FPZIP_FP_SAFE", + "emul": "FPZIP_FP_EMUL", + "int": "FPZIP_FP_INT", + } + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["FPZIP_FP"] = self._fp_name_table.get(str(self.options.with_fp), "FP_ZIP_FAST") + 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() + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + + def package_info(self): + self.cpp_info.libs = ["fpzip"] + self.cpp_info.defines.append("FPZIP_FP={}".format(self._fp_name_table.get(str(self.options.with_fp), "FP_ZIP_FAST"))) + if self.options.shared: + self.cpp_info.defines.append("FPZIP_SHARED_LIBS") + if self.settings.compiler in ["gcc", "clang", "apple-clang"]: + self.cpp_info.system_libs += ["stdc++"] diff --git a/recipes/fpzip/all/test_package/CMakeLists.txt b/recipes/fpzip/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..1476da8811ce6 --- /dev/null +++ b/recipes/fpzip/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) + +find_package(fpzip REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE fpzip::fpzip) diff --git a/recipes/fpzip/all/test_package/conanfile.py b/recipes/fpzip/all/test_package/conanfile.py new file mode 100644 index 0000000000000..ef5d7042163ec --- /dev/null +++ b/recipes/fpzip/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/fpzip/all/test_package/test_package.c b/recipes/fpzip/all/test_package/test_package.c new file mode 100644 index 0000000000000..8e359fe8da319 --- /dev/null +++ b/recipes/fpzip/all/test_package/test_package.c @@ -0,0 +1,142 @@ +#include +#include +#include +#include +#include + +#include "fpzip.h" + +static size_t +compress(FPZ* fpz, const void* data) +{ + size_t size; + /* write header */ + if (!fpzip_write_header(fpz)) { + fprintf(stderr, "cannot write header: %s\n", fpzip_errstr[fpzip_errno]); + return 0; + } + /* perform actual compression */ + size = fpzip_write(fpz, data); + if (!size) { + fprintf(stderr, "compression failed: %s\n", fpzip_errstr[fpzip_errno]); + return 0; + } + return size; +} + +static int +decompress(FPZ* fpz, void* data, size_t inbytes) +{ + /* read header */ + if (!fpzip_read_header(fpz)) { + fprintf(stderr, "cannot read header: %s\n", fpzip_errstr[fpzip_errno]); + return 0; + } + /* make sure array size stored in header matches expectations */ + if ((fpz->type == FPZIP_TYPE_FLOAT ? sizeof(float) : sizeof(double)) * fpz->nx * fpz->ny * fpz->nz * fpz->nf != inbytes) { + fprintf(stderr, "array size does not match dimensions from header\n"); + return 0; + } + /* perform actual decompression */ + if (!fpzip_read(fpz, data)) { + fprintf(stderr, "decompression failed: %s\n", fpzip_errstr[fpzip_errno]); + return 0; + } + return 1; +} + +static float +float_rand() +{ + static unsigned int seed = 1; + double val; + seed = 1103515245 * seed + 12345; + seed &= 0x7fffffffu; + val = ldexp((double)seed, -31); + val = 2 * val - 1; + val *= val * val; + val *= val * val; + return val; +} + +/* generate a trilinear field perturbed by random noise */ +float* +float_field(int nx, int ny, int nz, float offset) +{ + int n = nx * ny * nz; + float* field = malloc(n * sizeof(float)); + int i, x, y, z; + /* generate random field */ + *field = offset; + for (i = 1; i < n; i++) + field[i] = float_rand(); + /* integrate along x */ + for (z = 0; z < nz; z++) + for (y = 0; y < ny; y++) + for (x = 1; x < nx; x++) + field[x + nx * (y + ny * z)] += field[(x - 1) + nx * (y + ny * z)]; + /* integrate along y */ + for (z = 0; z < nz; z++) + for (y = 1; y < ny; y++) + for (x = 0; x < nx; x++) + field[x + nx * (y + ny * z)] += field[x + nx * ((y - 1) + ny * z)]; + /* integrate along z */ + for (z = 1; z < nz; z++) + for (y = 0; y < ny; y++) + for (x = 0; x < nx; x++) + field[x + nx * (y + ny * z)] += field[x + nx * (y + ny * (z - 1))]; + return field; +} + +static void +test_float_array(const float* field, int nx, int ny, int nz, int prec) +{ + int status; + unsigned int actual_checksum; + int dims = (nz == 1 ? ny == 1 ? 1 : 2 : 3); + size_t inbytes = nx * ny * nz * sizeof(float); + size_t bufbytes = 1024 + inbytes; + size_t outbytes = 0; + void* buffer = malloc(bufbytes); + float* copy = malloc(inbytes); + char name[0x100]; + + /* compress to memory */ + FPZ* fpz = fpzip_write_to_buffer(buffer, bufbytes); + fpz->type = FPZIP_TYPE_FLOAT; + fpz->prec = prec; + fpz->nx = nx; + fpz->ny = ny; + fpz->nz = nz; + fpz->nf = 1; + outbytes = compress(fpz, field); + status = (0 < outbytes && outbytes <= bufbytes); + fpzip_write_close(fpz); + sprintf(name, "test.float.%dd.prec%d.compress", dims, prec); + + /* decompress */ + fpz = fpzip_read_from_buffer(buffer); + status = decompress(fpz, copy, inbytes); + fpzip_read_close(fpz); + sprintf(name, "test.float.%dd.prec%d.decompress", dims, prec); + + free(copy); + free(buffer); +} + +static int +test_float(int nx, int ny, int nz) +{ + float* field = float_field(nx, ny, nz, 0); + int prec = 8; + test_float_array(field, nx * ny * nz, 1, 1, prec); + test_float_array(field, nx, ny * nz, 1, prec); + test_float_array(field, nx, ny, nz, prec); + free(field); +} + +int main(void) { + test_float(65, 64, 63); + + return 0; +} diff --git a/recipes/fpzip/config.yml b/recipes/fpzip/config.yml new file mode 100644 index 0000000000000..426a0e4c79e9b --- /dev/null +++ b/recipes/fpzip/config.yml @@ -0,0 +1,3 @@ +versions: + "1.3.0": + folder: all diff --git a/recipes/freealut/all/conandata.yml b/recipes/freealut/all/conandata.yml new file mode 100644 index 0000000000000..4ac03e7d67b4e --- /dev/null +++ b/recipes/freealut/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.1.0": + url: "http://ftp.debian.org/debian/pool/main/f/freealut/freealut_1.1.0.orig.tar.gz" + sha256: "60d1ea8779471bb851b89b49ce44eecb78e46265be1a6e9320a28b100c8df44f" diff --git a/recipes/freealut/all/conanfile.py b/recipes/freealut/all/conanfile.py new file mode 100644 index 0000000000000..42eae88dfb458 --- /dev/null +++ b/recipes/freealut/all/conanfile.py @@ -0,0 +1,96 @@ +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, rm, rmdir +from conan.errors import ConanInvalidConfiguration +import os + +required_conan_version = ">=1.54" + +class FreeAlutConan(ConanFile): + name = "freealut" + description = "freealut is a free implementation of OpenAL's ALUT standard." + topics = ("openal", "audio", "api") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://openal.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 + } + + 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") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def validate(self): + # FIXME: freealut supports Windows and Macos, but the recipe needs some help to work. + if self.settings.os in ["Windows", "Macos"] and \ + not self.options.shared: + raise ConanInvalidConfiguration( + f"{self.ref} recipe is currently not prepared for Windows or Macos. Contributions are welcome." + ) + + # freealut's cmake currently is using find_library instead of the package finders so it wouldn't get its public compile definitions. + # This causes al.h to be preprocessed as a dynamic library. Since Windows symbols are different for dynamic and static methods they aren't found. + if self.settings.os == "Windows" and \ + not self.dependencies["openal-soft"].options.shared: + raise ConanInvalidConfiguration( + f"{self.ref} cmake is currently not prepared to use openal-soft as a static library on Windows. Add option openal-soft/*:shared=True." + ) + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires("openal-soft/1.22.2", transitive_headers=True, transitive_libs=True) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeDeps(self) + tc.generate() + 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.cache_variables["CMAKE_POLICY_DEFAULT_CMP0003"] = "NEW" + tc.variables["BUILD_STATIC"] = not self.options.shared + # INFO: CMakeDeps generates CamelCase variables + tc.variables["OPENAL_LIB_DIR"] = os.path.join(self.dependencies["openal-soft"].package_folder, "lib") + tc.variables["OPENAL_INCLUDE_DIR"] = os.path.join(self.dependencies["openal-soft"].package_folder, "include") + if self.settings.os == "Windows": + tc.variables["OPENAL_INCLUDE_DIR"] += ";" + os.path.join(self.dependencies["openal-soft"].package_folder, "include", "AL") + tc.variables["OPENAL_LIB_DIR"] = tc.variables["OPENAL_LIB_DIR"].replace("\\","/") + tc.variables["OPENAL_INCLUDE_DIR"] = tc.variables["OPENAL_INCLUDE_DIR"].replace("\\","/") + 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() + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + if not self.options.shared: + rm(self, "*.so*", os.path.join(self.package_folder, "lib")) + + def package_info(self): + self.cpp_info.libs = ['alut'] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs = ["m", "pthread"] + if self.options.shared: + self.cpp_info.defines.append("ALUT_BUILD_LIBRARY") diff --git a/recipes/freealut/all/test_package/CMakeLists.txt b/recipes/freealut/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..4ba52d1b57dea --- /dev/null +++ b/recipes/freealut/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) + +find_package(freealut REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE freealut::freealut) diff --git a/recipes/freealut/all/test_package/conanfile.py b/recipes/freealut/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0a6bc68712d90 --- /dev/null +++ b/recipes/freealut/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/freealut/all/test_package/test_package.c b/recipes/freealut/all/test_package/test_package.c new file mode 100644 index 0000000000000..eebaa554d158e --- /dev/null +++ b/recipes/freealut/all/test_package/test_package.c @@ -0,0 +1,40 @@ +#include +#include +#include + +/* + This program checks that the version of OpenAL in the + library agrees with the header file we're compiled against. +*/ + +int +main (int argc, char **argv) +{ + ALboolean ok = AL_FALSE; + + alutInit (&argc, argv); + +#ifdef ALUT_API_MAJOR_VERSION + if (alutGetMajorVersion () != ALUT_API_MAJOR_VERSION || + alutGetMinorVersion () != ALUT_API_MINOR_VERSION) + { + fprintf (stderr, + "WARNING: The ALUT library is version %d.%d.x but says it's %d.%d.x!\n", + alutGetMajorVersion (), alutGetMinorVersion (), + ALUT_API_MAJOR_VERSION, ALUT_API_MINOR_VERSION); + } + else + { + fprintf (stderr, "The ALUT library is at version %d.%d.x.\n", + alutGetMajorVersion (), alutGetMinorVersion ()); + ok = AL_TRUE; + } +#else + fprintf (stderr, "WARNING: Your copy of is pre-1.0.0,\n"); + fprintf (stderr, "but you are running the ALUT test suite from ALUT\n"); + fprintf (stderr, "version 1.0.0 or later.\n"); +#endif + + alutExit (); + return ok ? EXIT_SUCCESS : EXIT_FAILURE; +} diff --git a/recipes/freealut/config.yml b/recipes/freealut/config.yml new file mode 100644 index 0000000000000..b5c0d3cb2d409 --- /dev/null +++ b/recipes/freealut/config.yml @@ -0,0 +1,3 @@ +versions: + "1.1.0": + folder: all diff --git a/recipes/freeglut/all/CMakeLists.txt b/recipes/freeglut/all/CMakeLists.txt deleted file mode 100644 index 8c8356e77d35a..0000000000000 --- a/recipes/freeglut/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() - -add_definitions("-DFREEGLUT_LIB_PRAGMAS=0") - -add_subdirectory("source_subfolder") diff --git a/recipes/freeglut/all/conandata.yml b/recipes/freeglut/all/conandata.yml index 1b8ca276b4eda..964de8ca2d213 100644 --- a/recipes/freeglut/all/conandata.yml +++ b/recipes/freeglut/all/conandata.yml @@ -1,7 +1,58 @@ sources: + "3.4.0": + url: "https://github.com/FreeGLUTProject/freeglut/archive/v3.4.0.tar.gz" + sha256: "3c0bcb915d9b180a97edaebd011b7a1de54583a838644dcd42bb0ea0c6f3eaec" "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: "https://github.com/FreeGLUTProject/freeglut/releases/download/v3.2.1/freeglut-3.2.1.tar.gz" +patches: + "3.4.0": + - patch_file: "patches/3.4.0-0001-Use-find_package-and-pkg_check_modules-to-find-more.patch" + patch_description: "Use find_package and pkg_check_modules to find dependencies" + patch_source: "https://github.com/FreeGLUTProject/freeglut/pull/147" + patch_type: "conan" + - patch_file: "patches/3.4.0-0002-Use-find_library-to-locate-GL-libraries-not-provided.patch" + patch_description: "Use find_library to locate GL libraries" + patch_source: "https://github.com/FreeGLUTProject/freeglut/pull/148" + patch_type: "portability" + - patch_file: "patches/3.4.0-0003-Incorporate-the-include-directory-for-glu.h-in-CMake.patch" + patch_description: "Incorporate the include directory for glu.h in CMake" + patch_source: "https://github.com/FreeGLUTProject/freeglut/pull/154" + patch_type: "portability" + "3.2.2": + - patch_file: "patches/3.2.1-0002-fixed-android-undefined-reference-to-glutCreateMenuU.patch" + patch_description: "Add a missing function definition" + patch_source: "https://github.com/FreeGLUTProject/freeglut/pull/122" + patch_type: "portability" + - patch_file: "patches/3.2.2-0001-Use-find_package-and-pkg_check_modules-to-find-more.patch" + patch_description: "Use find_package and pkg_check_modules to find dependencies" + patch_source: "https://github.com/FreeGLUTProject/freeglut/pull/147" + patch_type: "conan" + - patch_file: "patches/3.2.2-0002-Use-find_library-to-locate-GL-libraries-not-provided.patch" + patch_description: "Use find_library to locate GL libraries" + patch_source: "https://github.com/FreeGLUTProject/freeglut/pull/148" + patch_type: "portability" + - patch_file: "patches/3.2.2-0003-Incorporate-the-include-directory-for-glu.h-in-CMake.patch" + patch_description: "Incorporate the include directory for glu.h in CMake" + patch_source: "https://github.com/FreeGLUTProject/freeglut/pull/154" + patch_type: "portability" + "3.2.1": + - patch_file: "patches/3.2.1-0001-Use-find_package-and-pkg_check_modules-to-find-more.patch" + patch_description: "Use find_package and pkg_check_modules to find dependencies" + patch_source: "https://github.com/FreeGLUTProject/freeglut/pull/147" + patch_type: "conan" + - patch_file: "patches/3.2.1-0002-fixed-android-undefined-reference-to-glutCreateMenuU.patch" + patch_description: "Add a missing function definition" + patch_source: "https://github.com/FreeGLUTProject/freeglut/pull/122" + patch_type: "portability" + - patch_file: "patches/3.2.1-0003-Use-find_library-to-locate-GL-libraries-not-provided.patch" + patch_description: "Use find_library to locate GL libraries" + patch_source: "https://github.com/FreeGLUTProject/freeglut/pull/148" + patch_type: "portability" + - patch_file: "patches/3.2.1-0004-Incorporate-the-include-directory-for-glu.h-in-CMake.patch" + patch_description: "Incorporate the include directory for glu.h in CMake" + patch_source: "https://github.com/FreeGLUTProject/freeglut/pull/154" + patch_type: "portability" diff --git a/recipes/freeglut/all/conanfile.py b/recipes/freeglut/all/conanfile.py index 4fbf2e2eb4cf5..dc8ac66bf9e42 100644 --- a/recipes/freeglut/all/conanfile.py +++ b/recipes/freeglut/all/conanfile.py @@ -1,21 +1,23 @@ 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, collect_libs, copy, export_conandata_patches, get, rmdir +from conan.tools.gnu import PkgConfigDeps 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.47.0" +required_conan_version = ">=1.53.0" class freeglutConan(ConanFile): name = "freeglut" description = "Open-source alternative to the OpenGL Utility Toolkit (GLUT) library" - topics = ("freeglut", "opengl", "gl", "glut", "utility", "toolkit", "graphics") + topics = ("gl", "glut", "graphics," "opengl", "toolkit", "utility") url = "https://github.com/conan-io/conan-center-index" homepage = "http://freeglut.sourceforge.net" license = "X11" - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -24,6 +26,8 @@ class freeglutConan(ConanFile): "print_errors_at_runtime": [True, False], "print_warnings_at_runtime": [True, False], "replace_glut": [True, False], + "with_wayland": [True, False], + } default_options = { "shared": False, @@ -32,36 +36,73 @@ class freeglutConan(ConanFile): "print_errors_at_runtime": True, "print_warnings_at_runtime": True, "replace_glut": True, + "with_wayland": True, } - generators = "cmake" - _cmake = None + @property + def _requires_libglvnd_egl(self): + return self._requires_libglvnd_gles or self.options.get_safe("with_wayland") + + @property + def _requires_libglvnd_gles(self): + return self._with_libglvnd and self.options.get_safe("gles") + + @property + def _requires_libglvnd_glx(self): + return self._with_libglvnd and not self.options.get_safe("gles") @property - def _source_subfolder(self): - return "source_subfolder" + def _with_libglvnd(self): + return self.settings.os in ["FreeBSD", "Linux"] @property - def _build_subfolder(self): - return "build_subfolder" + def _with_x11(self): + return self.settings.os in ["FreeBSD", "Linux"] and not self.options.get_safe("with_wayland") def export_sources(self): - self.copy("CMakeLists.txt") + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": - del self.options.fPIC + self.options.rm_safe("fPIC") + if self.settings.os not in ["Android", "FreeBSD", "Linux"]: + self.options.rm_safe("gles") + else: + self.options.gles = self.settings.os == "Android" + if self.settings.os != "Linux": + self.options.rm_safe("with_wayland") 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._requires_libglvnd_egl: + self.options["libglvnd"].egl = True + if self._requires_libglvnd_gles: + self.options["libglvnd"].gles1 = True + self.options["libglvnd"].gles2 = True + if self._requires_libglvnd_glx: + self.options["libglvnd"].glx = True + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("opengl/system") - self.requires("glu/system") - if self.settings.os == "Linux": + if is_apple_os(self) or self.settings.os == "Windows": + self.requires("glu/system") + else: + # FreeGLUT includes glu.h in freeglut_std.h. + self.requires("mesa-glu/9.0.3", transitive_headers=True) + if self._with_libglvnd: + self.requires("libglvnd/1.7.0") + else: + self.requires("opengl/system") + if self.options.get_safe("with_wayland"): + self.requires("wayland/1.22.0") + self.requires("xkbcommon/1.6.0") + if self._with_x11: self.requires("xorg/system") def validate(self): @@ -69,45 +110,53 @@ def validate(self): # see https://github.com/dcnieho/FreeGLUT/issues/27 # 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) + raise ConanInvalidConfiguration(f"{self.ref} does not support macos") 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) + raise ConanInvalidConfiguration(f"{self.ref} does not support gcc >= 10 and clang >= 11") + if self._requires_libglvnd_egl and not self.dependencies["libglvnd"].options.egl: + raise ConanInvalidConfiguration(f"{self.ref} requires the egl option of libglvnd to be enabled when either the gles option or with_wayland option is enabled") + if self._requires_libglvnd_gles and not self.dependencies["libglvnd"].options.gles1: + raise ConanInvalidConfiguration(f"{self.ref} requires the gles1 option of libglvnd to be enabled when the gles option is enabled") + if self._requires_libglvnd_gles and not self.dependencies["libglvnd"].options.gles2: + raise ConanInvalidConfiguration(f"{self.ref} requires the gles2 option of libglvnd to be enabled when the gles option is enabled") + if self._requires_libglvnd_glx and not self.dependencies["libglvnd"].options.glx: + raise ConanInvalidConfiguration(f"{self.ref} requires the glx option of libglvnd to be enabled when the gles option is disabled") + def source(self): - 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 - - # See https://github.com/dcnieho/FreeGLUT/blob/44cf4b5b85cf6037349c1c8740b2531d7278207d/README.cmake - self._cmake = CMake(self, set_cmake_flags=True) - - self._cmake.definitions["FREEGLUT_BUILD_DEMOS"] = False - self._cmake.definitions["FREEGLUT_BUILD_STATIC_LIBS"] = not self.options.shared - self._cmake.definitions["FREEGLUT_BUILD_SHARED_LIBS"] = self.options.shared - self._cmake.definitions["FREEGLUT_GLES"] = self.options.gles - self._cmake.definitions["FREEGLUT_PRINT_ERRORS"] = self.options.print_errors_at_runtime - self._cmake.definitions["FREEGLUT_PRINT_WARNINGS"] = self.options.print_warnings_at_runtime - self._cmake.definitions["FREEGLUT_INSTALL_PDB"] = False - self._cmake.definitions["INSTALL_PDB"] = False - self._cmake.definitions["FREEGLUT_REPLACE_GLUT"] = self.options.replace_glut - # cmake.definitions["FREEGLUT_WAYLAND"] = "ON" if self.options.wayland else "OFF" # nightly version only as of now - - 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["FREEGLUT_BUILD_DEMOS"] = False + tc.variables["FREEGLUT_BUILD_STATIC_LIBS"] = not self.options.shared + tc.variables["FREEGLUT_BUILD_SHARED_LIBS"] = self.options.shared + tc.variables["FREEGLUT_GLES"] = self.options.get_safe("gles", False) + tc.variables["FREEGLUT_PRINT_ERRORS"] = self.options.print_errors_at_runtime + tc.variables["FREEGLUT_PRINT_WARNINGS"] = self.options.print_warnings_at_runtime + tc.variables["FREEGLUT_WAYLAND"] = self.options.get_safe("with_wayland", False) + tc.variables["FREEGLUT_INSTALL_PDB"] = False + tc.variables["INSTALL_PDB"] = False + tc.variables["FREEGLUT_REPLACE_GLUT"] = self.options.replace_glut + tc.preprocessor_definitions["FREEGLUT_LIB_PRAGMAS"] = "0" + tc.generate() + cmake_deps = CMakeDeps(self) + cmake_deps.generate() + pkg_config_deps = PkgConfigDeps(self) + pkg_config_deps.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="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() rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) @@ -120,12 +169,12 @@ def package_info(self): self.cpp_info.set_property("cmake_module_file_name", "GLUT") self.cpp_info.set_property("cmake_module_target_name", "GLUT::GLUT") self.cpp_info.set_property("cmake_file_name", "FreeGLUT") - self.cpp_info.set_property("cmake_target_name", "FreeGLUT::{}".format(config_target)) + self.cpp_info.set_property("cmake_target_name", f"FreeGLUT::{config_target}") 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 = collect_libs(self) - if self.settings.os == "Linux": + if self.settings.os in ["FreeBSD", "Linux"]: self.cpp_info.components["freeglut_"].system_libs.extend(["pthread", "m", "dl", "rt"]) elif self.settings.os == "Windows": if not self.options.shared: @@ -140,8 +189,24 @@ def package_info(self): self.cpp_info.components["freeglut_"].names["cmake_find_package"] = "GLUT" self.cpp_info.components["freeglut_"].set_property("cmake_module_target_name", "GLUT::GLUT") self.cpp_info.components["freeglut_"].names["cmake_find_package_multi"] = config_target - self.cpp_info.components["freeglut_"].set_property("cmake_target_name", "FreeGLUT::{}".format(config_target)) + self.cpp_info.components["freeglut_"].set_property("cmake_target_name", f"FreeGLUT::{config_target}") self.cpp_info.components["freeglut_"].set_property("pkg_config_name", pkg_config) - self.cpp_info.components["freeglut_"].requires.extend(["opengl::opengl", "glu::glu"]) - if self.settings.os == "Linux": + if self._requires_libglvnd_egl: + self.cpp_info.components["freeglut_"].requires.append("libglvnd::egl") + if self._requires_libglvnd_gles: + self.cpp_info.components["freeglut_"].requires.append("libglvnd::gles1") + self.cpp_info.components["freeglut_"].requires.append("libglvnd::gles2") + if self._requires_libglvnd_glx: + self.cpp_info.components["freeglut_"].requires.append("libglvnd::gl") + if self._with_libglvnd: + self.cpp_info.components["freeglut_"].requires.append("libglvnd::opengl") + else: + self.cpp_info.components["freeglut_"].requires.append("opengl::opengl") + if self._with_x11: self.cpp_info.components["freeglut_"].requires.append("xorg::xorg") + if self.options.get_safe("with_wayland"): + self.cpp_info.components["freeglut_"].requires.extend(["wayland::wayland-client", "wayland::wayland-cursor", "wayland::wayland-egl", "xkbcommon::xkbcommon"]) + if is_apple_os(self) or self.settings.os == "Windows": + self.cpp_info.components["freeglut_"].requires.append("glu::glu") + else: + self.cpp_info.components["freeglut_"].requires.append("mesa-glu::mesa-glu") diff --git a/recipes/freeglut/all/patches/3.2.1-0001-Use-find_package-and-pkg_check_modules-to-find-more.patch b/recipes/freeglut/all/patches/3.2.1-0001-Use-find_package-and-pkg_check_modules-to-find-more.patch new file mode 100644 index 0000000000000..9e1c3b9056866 --- /dev/null +++ b/recipes/freeglut/all/patches/3.2.1-0001-Use-find_package-and-pkg_check_modules-to-find-more.patch @@ -0,0 +1,94 @@ +From 4c573afc0453f3572c494d22b4f3bad9a9ce4073 Mon Sep 17 00:00:00 2001 +From: Jordan Williams +Date: Tue, 7 Nov 2023 07:38:42 -0600 +Subject: [PATCH] Use find_package and pkg_check_modules to find more + dependencies + +This commit enhances the use of the FindOpenGL CMake module. +This requires CMake version 3.10 for the OpenGL::EGL imported target. +CMake 3.11 and later enable CMake policy CMP0072. +This prefers the GLVND libraries when available. + +Finds the Wayland and xkbcommon dependencies with pkg_check_modules. +This works with the pkg-config files provided by the upstream projects. +--- + CMakeLists.txt | 53 +++++++++++++++++++++++++++++++++++++++++++------- + 1 file changed, 46 insertions(+), 7 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 6f403afa..a2a95c02 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,5 +1,9 @@ +-CMAKE_MINIMUM_REQUIRED(VERSION 3.0.0 FATAL_ERROR) +-PROJECT(freeglut) ++CMAKE_MINIMUM_REQUIRED(VERSION 3.1 FATAL_ERROR) ++PROJECT(freeglut LANGUAGES C) ++ ++if (POLICY CMP0072) ++ cmake_policy(SET CMP0072 NEW) ++endif() + + # for multiarch LIBDIR support (requires cmake>=2.8.8) + INCLUDE(GNUInstallDirs) +@@ -257,17 +261,52 @@ ENDIF() + # GLES1 and GLES2 libraries are compatible and can be co-linked. + IF(FREEGLUT_GLES) + LIST(APPEND PUBLIC_DEFINITIONS -DFREEGLUT_GLES) +- LIST(APPEND LIBS GLESv2 GLESv1_CM EGL) ++ if(NOT CMAKE_VERSION VERSION_LESS "3.27") ++ FIND_PACKAGE(OpenGL REQUIRED COMPONENTS EGL GLES2 OpenGL) ++ LIST(APPEND LIBS GLESv1_CM OpenGL::EGL OpenGL::GLES2 OpenGL::OpenGL) ++ elseif(NOT CMAKE_VERSION VERSION_LESS "3.10") ++ FIND_PACKAGE(OpenGL REQUIRED COMPONENTS EGL OpenGL) ++ LIST(APPEND LIBS GLESv2 GLESv1_CM OpenGL::EGL OpenGL::OpenGL) ++ else() ++ FIND_PACKAGE(OpenGL REQUIRED) ++ LIST(APPEND LIBS EGL GLESv2 GLESv1_CM) ++ endif() + ELSE() +- FIND_PACKAGE(OpenGL REQUIRED) +- LIST(APPEND LIBS ${OPENGL_gl_LIBRARY}) +- INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR}) ++ if(NOT CMAKE_VERSION VERSION_LESS "3.10") ++ FIND_PACKAGE(OpenGL REQUIRED COMPONENTS OpenGL) ++ LIST(APPEND LIBS OpenGL::GL) ++ else() ++ FIND_PACKAGE(OpenGL REQUIRED) ++ LIST(APPEND LIBS ${OPENGL_gl_LIBRARY}) ++ INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR}) ++ endif() + ENDIF() + + # For Wayland: compile with -DFREEGLUT_WAYLAND and pull EGL + IF(FREEGLUT_WAYLAND) + ADD_DEFINITIONS(-DFREEGLUT_WAYLAND) +- LIST(APPEND LIBS wayland-client wayland-cursor wayland-egl EGL xkbcommon) ++ INCLUDE(FindPkgConfig) ++ if(NOT CMAKE_VERSION VERSION_LESS "3.10") ++ FIND_PACKAGE(OpenGL REQUIRED COMPONENTS EGL OpenGL) ++ LIST(APPEND LIBS OpenGL::EGL OpenGL::OpenGL) ++ else() ++ FIND_PACKAGE(OpenGL REQUIRED) ++ LIST(APPEND LIBS EGL) ++ endif() ++ if(NOT CMAKE_VERSION VERSION_LESS "3.6") ++ PKG_CHECK_MODULES(wayland-client REQUIRED IMPORTED_TARGET wayland-client) ++ PKG_CHECK_MODULES(wayland-cursor REQUIRED IMPORTED_TARGET wayland-cursor) ++ PKG_CHECK_MODULES(wayland-egl REQUIRED IMPORTED_TARGET wayland-egl) ++ PKG_CHECK_MODULES(xkbcommon REQUIRED IMPORTED_TARGET xkbcommon) ++ LIST(APPEND LIBS PkgConfig::wayland-client PkgConfig::wayland-cursor PkgConfig::wayland-egl PkgConfig::xkbcommon) ++ else() ++ PKG_CHECK_MODULES(wayland-client REQUIRED) ++ PKG_CHECK_MODULES(wayland-cursor REQUIRED) ++ PKG_CHECK_MODULES(wayland-egl REQUIRED) ++ PKG_CHECK_MODULES(xkbcommon REQUIRED) ++ LIST(APPEND LIBS ${wayland-client_LINK_LIBRARIES} ${wayland-cursor_LINK_LIBRARIES} ${wayland-egl_LINK_LIBRARIES} ${xkbcommon_LINK_LIBRARIES}) ++ INCLUDE_DIRECTORIES(${wayland-client_INCLUDE_DIRS} ${wayland-cursor_INCLUDE_DIRS} ${wayland-egl_INCLUDE_DIRS} ${xkbcommon_INCLUDE_DIRS}) ++ endif() + ENDIF() + + # lib m for math, not needed on windows +-- +2.41.0 + diff --git a/recipes/freeglut/all/patches/3.2.1-0002-fixed-android-undefined-reference-to-glutCreateMenuU.patch b/recipes/freeglut/all/patches/3.2.1-0002-fixed-android-undefined-reference-to-glutCreateMenuU.patch new file mode 100644 index 0000000000000..039c12be9d43d --- /dev/null +++ b/recipes/freeglut/all/patches/3.2.1-0002-fixed-android-undefined-reference-to-glutCreateMenuU.patch @@ -0,0 +1,25 @@ +From 782e63b2eacd47155864d0d1d9b70615418e3083 Mon Sep 17 00:00:00 2001 +From: Jonatha Gabriel +Date: Sun, 4 Sep 2022 23:25:23 -0300 +Subject: [PATCH] fixed android undefined reference to glutCreateMenuUcall + +--- + src/gles_stubs.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/gles_stubs.c b/src/gles_stubs.c +index bc87c0d8..63a19209 100644 +--- a/src/gles_stubs.c ++++ b/src/gles_stubs.c +@@ -18,6 +18,8 @@ GLboolean fgCheckActiveMenu ( SFG_Window *window, int button, GLboolean pressed, + return GL_FALSE; + } + ++int FGAPIENTRY glutCreateMenuUcall( FGCBMenuUC callback, FGCBUserData userData ) { return 0; } ++ + int glutCreateMenu( void (* callback)( int menu ) ) { return 0; } + void glutDestroyMenu( int menu ) {} + int glutGetMenu( void ) { return 0; } +-- +2.41.0 + diff --git a/recipes/freeglut/all/patches/3.2.1-0003-Use-find_library-to-locate-GL-libraries-not-provided.patch b/recipes/freeglut/all/patches/3.2.1-0003-Use-find_library-to-locate-GL-libraries-not-provided.patch new file mode 100644 index 0000000000000..2a08c1427e3f1 --- /dev/null +++ b/recipes/freeglut/all/patches/3.2.1-0003-Use-find_library-to-locate-GL-libraries-not-provided.patch @@ -0,0 +1,65 @@ +From 9564dbb645a4be08aff7b65ac35b56e185a7598c Mon Sep 17 00:00:00 2001 +From: Jordan Williams +Date: Tue, 7 Nov 2023 11:00:39 -0600 +Subject: [PATCH] Use find_library to locate GL libraries not provided by + FindOpenGL + +FindOpenGL is used to find the OpenGL libraries. +It doesn't find all of the necessary libraries, however. +These missing libraries have been added to the link line directly. +This is problematic when FindOpenGL is pointed at OpenGL libraries somewhere outside LD_LIBRARY_PATH and the system's default linker paths. +In such cases, the libraries won't be found at link time. + +CMake's find_library function can be used instead to add the libraries as this commit does. +This function can use the location of the GL libraries that were already found as a hint. +Furthermore, this allows consumers to use CMake cache variables to set the exact libraries to use if needed. +--- + CMakeLists.txt | 21 +++++++++++++++++---- + 1 file changed, 17 insertions(+), 4 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index a2a95c02..772e73f3 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -263,13 +263,23 @@ IF(FREEGLUT_GLES) + LIST(APPEND PUBLIC_DEFINITIONS -DFREEGLUT_GLES) + if(NOT CMAKE_VERSION VERSION_LESS "3.27") + FIND_PACKAGE(OpenGL REQUIRED COMPONENTS EGL GLES2 OpenGL) +- LIST(APPEND LIBS GLESv1_CM OpenGL::EGL OpenGL::GLES2 OpenGL::OpenGL) ++ CMAKE_PATH(GET OPENGL_gles2_LIBRARY PARENT_PATH _OPENGL_LIBDIR) ++ FIND_LIBRARY(GLES1_LIBRARY GLESv1_CM HINTS ${_OPENGL_LIBDIR} REQUIRED) ++ LIST(APPEND LIBS ${GLES1_LIBRARY} OpenGL::EGL OpenGL::GLES2 OpenGL::OpenGL) + elseif(NOT CMAKE_VERSION VERSION_LESS "3.10") + FIND_PACKAGE(OpenGL REQUIRED COMPONENTS EGL OpenGL) +- LIST(APPEND LIBS GLESv2 GLESv1_CM OpenGL::EGL OpenGL::OpenGL) ++ GET_FILENAME_COMPONENT(_OPENGL_LIBDIR ${OPENGL_egl_LIBRARY} DIRECTORY) ++ FIND_LIBRARY(GLES1_LIBRARY GLESv1_CM HINTS ${_OPENGL_LIBDIR}) ++ FIND_LIBRARY(GLES2_LIBRARY GLESv2 HINTS ${_OPENGL_LIBDIR}) ++ LIST(APPEND LIBS ${GLES1_LIBRARY} ${GLES2_LIBRARY} OpenGL::EGL OpenGL::OpenGL) + else() + FIND_PACKAGE(OpenGL REQUIRED) +- LIST(APPEND LIBS EGL GLESv2 GLESv1_CM) ++ LIST(GET ${OPENGL_LIBRARIES} 0 _OPENGL_LIB) ++ GET_FILENAME_COMPONENT(_OPENGL_LIBDIR ${_OPENGL_LIB} DIRECTORY) ++ FIND_LIBRARY(EGL_LIBRARY EGL HINTS ${_OPENGL_LIBDIR}) ++ FIND_LIBRARY(GLES1_LIBRARY GLESv1_CM HINTS ${_OPENGL_LIBDIR}) ++ FIND_LIBRARY(GLES2_LIBRARY GLESv2 HINTS ${_OPENGL_LIBDIR}) ++ LIST(APPEND LIBS ${EGL_LIBRARY} ${GLES1_LIBRARY} ${GLES2_LIBRARY}) + endif() + ELSE() + if(NOT CMAKE_VERSION VERSION_LESS "3.10") +@@ -291,7 +301,10 @@ IF(FREEGLUT_WAYLAND) + LIST(APPEND LIBS OpenGL::EGL OpenGL::OpenGL) + else() + FIND_PACKAGE(OpenGL REQUIRED) +- LIST(APPEND LIBS EGL) ++ LIST(GET ${OPENGL_LIBRARIES} 0 _OPENGL_LIB) ++ GET_FILENAME_COMPONENT(_OPENGL_LIBDIR ${_OPENGL_LIB} DIRECTORY) ++ FIND_LIBRARY(EGL_LIBRARY EGL HINTS ${_OPENGL_LIBDIR}) ++ LIST(APPEND LIBS ${EGL_LIBRARY}) + endif() + if(NOT CMAKE_VERSION VERSION_LESS "3.6") + PKG_CHECK_MODULES(wayland-client REQUIRED IMPORTED_TARGET wayland-client) +-- +2.41.0 + diff --git a/recipes/freeglut/all/patches/3.2.1-0004-Incorporate-the-include-directory-for-glu.h-in-CMake.patch b/recipes/freeglut/all/patches/3.2.1-0004-Incorporate-the-include-directory-for-glu.h-in-CMake.patch new file mode 100644 index 0000000000000..a2fd409a85d19 --- /dev/null +++ b/recipes/freeglut/all/patches/3.2.1-0004-Incorporate-the-include-directory-for-glu.h-in-CMake.patch @@ -0,0 +1,61 @@ +From c81e600ace29bf5f3ded5e2650859f3303aaac6e Mon Sep 17 00:00:00 2001 +From: Jordan Williams +Date: Wed, 7 Feb 2024 10:09:25 -0600 +Subject: [PATCH] Incorporate the include directory for glu.h in CMake + +FreeGLUT doesn't properly check for the glu.h header file when it is required. +The glu.h header is not necessary when FreeGLUT is built for GLES. +However, the demos require use libGLU and so require the include and the library. + +CMake's FindOpenGL didn't properly search for the glu.h header file until very recently. +Refer to this PR: https://gitlab.kitware.com/cmake/cmake/-/merge_requests/9216. + +This PR checks for the glu.h header and adds the corresponding include directory when it is required. +For versions of CMake prior to 3.29, the include directory for GLU is added even when linking against the OpenGL::GLU target. +Like the FindOpenGL module, GLU include directories are ignored on Windows. +--- + CMakeLists.txt | 21 ++++++++++++++++++++- + 1 file changed, 20 insertions(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 772e73f3..162eec40 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -290,6 +290,17 @@ ELSE() + LIST(APPEND LIBS ${OPENGL_gl_LIBRARY}) + INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR}) + endif() ++ ++ if(NOT CMAKE_SYSTEM_NAME STREQUAL "Windows") ++ # CMake 3.29 properly locates the include directory for glu.h in the OPENGL_GLU_INCLUDE_DIR variable for us. ++ if(CMAKE_VERSION VERSION_LESS "3.29") ++ FIND_PATH(OPENGL_GLU_INCLUDE_DIR NAMES GL/glu.h OpenGL/glu.h HINTS ${OPENGL_INCLUDE_DIR}) ++ endif() ++ if(NOT OPENGL_GLU_INCLUDE_DIR) ++ message(FATAL_ERROR "Failed to find the glu.h header file.") ++ endif() ++ INCLUDE_DIRECTORIES(${OPENGL_GLU_INCLUDE_DIR}) ++ endif() + ENDIF() + + # For Wayland: compile with -DFREEGLUT_WAYLAND and pull EGL +@@ -566,7 +577,15 @@ INSTALL(FILES ${FREEGLUT_HEADERS} DESTINATION include/GL COMPONENT Devel) + # Optionally build demos, on by default. + option( FREEGLUT_BUILD_DEMOS "Build FreeGLUT demos." ON ) + +-SET(DEMO_LIBS ${OPENGL_glu_LIBRARY} ${LIBS}) ++set(DEMO_LIBS ${LIBS}) ++if (FREEGLUT_BUILD_DEMOS) ++ if (OPENGL_GLU_FOUND) ++ list(APPEND DEMO_LIBS ${OPENGL_glu_LIBRARY}) ++ else() ++ message(FATAL_ERROR "Failed to find the GLU library which is required to build the demos.") ++ endif() ++endif() ++ + # lib m for math, not needed on windows + IF (NOT WIN32) + LIST(APPEND DEMO_LIBS m) +-- +2.43.2 + diff --git a/recipes/freeglut/all/patches/3.2.2-0001-Use-find_package-and-pkg_check_modules-to-find-more.patch b/recipes/freeglut/all/patches/3.2.2-0001-Use-find_package-and-pkg_check_modules-to-find-more.patch new file mode 100644 index 0000000000000..83ea577575c3c --- /dev/null +++ b/recipes/freeglut/all/patches/3.2.2-0001-Use-find_package-and-pkg_check_modules-to-find-more.patch @@ -0,0 +1,94 @@ +From 4b4f63a41d4ee33a4b3c048bb4281051acbad106 Mon Sep 17 00:00:00 2001 +From: Jordan Williams +Date: Tue, 7 Nov 2023 07:38:42 -0600 +Subject: [PATCH] Use find_package and pkg_check_modules to find more + dependencies + +This commit enhances the use of the FindOpenGL CMake module. +This requires CMake version 3.10 for the OpenGL::EGL imported target. +CMake 3.11 and later enable CMake policy CMP0072. +This prefers the GLVND libraries when available. + +Finds the Wayland and xkbcommon dependencies with pkg_check_modules. +This works with the pkg-config files provided by the upstream projects. +--- + CMakeLists.txt | 53 +++++++++++++++++++++++++++++++++++++++++++------- + 1 file changed, 46 insertions(+), 7 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index ac8c8df3..f97f14ff 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,5 +1,9 @@ +-CMAKE_MINIMUM_REQUIRED(VERSION 3.0.0 FATAL_ERROR) +-PROJECT(freeglut) ++CMAKE_MINIMUM_REQUIRED(VERSION 3.1 FATAL_ERROR) ++PROJECT(freeglut LANGUAGES C) ++ ++if (POLICY CMP0072) ++ cmake_policy(SET CMP0072 NEW) ++endif() + + # for multiarch LIBDIR support (requires cmake>=2.8.8) + INCLUDE(GNUInstallDirs) +@@ -261,17 +265,52 @@ ENDIF() + # GLES1 and GLES2 libraries are compatible and can be co-linked. + IF(FREEGLUT_GLES) + LIST(APPEND PUBLIC_DEFINITIONS -DFREEGLUT_GLES) +- LIST(APPEND LIBS GLESv2 GLESv1_CM EGL) ++ if(NOT CMAKE_VERSION VERSION_LESS "3.27") ++ FIND_PACKAGE(OpenGL REQUIRED COMPONENTS EGL GLES2 OpenGL) ++ LIST(APPEND LIBS GLESv1_CM OpenGL::EGL OpenGL::GLES2 OpenGL::OpenGL) ++ elseif(NOT CMAKE_VERSION VERSION_LESS "3.10") ++ FIND_PACKAGE(OpenGL REQUIRED COMPONENTS EGL OpenGL) ++ LIST(APPEND LIBS GLESv2 GLESv1_CM OpenGL::EGL OpenGL::OpenGL) ++ else() ++ FIND_PACKAGE(OpenGL REQUIRED) ++ LIST(APPEND LIBS EGL GLESv2 GLESv1_CM) ++ endif() + ELSE() +- FIND_PACKAGE(OpenGL REQUIRED) +- LIST(APPEND LIBS ${OPENGL_gl_LIBRARY}) +- INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR}) ++ if(NOT CMAKE_VERSION VERSION_LESS "3.10") ++ FIND_PACKAGE(OpenGL REQUIRED COMPONENTS OpenGL) ++ LIST(APPEND LIBS OpenGL::GL) ++ else() ++ FIND_PACKAGE(OpenGL REQUIRED) ++ LIST(APPEND LIBS ${OPENGL_gl_LIBRARY}) ++ INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR}) ++ endif() + ENDIF() + + # For Wayland: compile with -DFREEGLUT_WAYLAND and pull EGL + IF(FREEGLUT_WAYLAND) + ADD_DEFINITIONS(-DFREEGLUT_WAYLAND) +- LIST(APPEND LIBS wayland-client wayland-cursor wayland-egl EGL xkbcommon) ++ INCLUDE(FindPkgConfig) ++ if(NOT CMAKE_VERSION VERSION_LESS "3.10") ++ FIND_PACKAGE(OpenGL REQUIRED COMPONENTS EGL OpenGL) ++ LIST(APPEND LIBS OpenGL::EGL OpenGL::OpenGL) ++ else() ++ FIND_PACKAGE(OpenGL REQUIRED) ++ LIST(APPEND LIBS EGL) ++ endif() ++ if(NOT CMAKE_VERSION VERSION_LESS "3.6") ++ PKG_CHECK_MODULES(wayland-client REQUIRED IMPORTED_TARGET wayland-client) ++ PKG_CHECK_MODULES(wayland-cursor REQUIRED IMPORTED_TARGET wayland-cursor) ++ PKG_CHECK_MODULES(wayland-egl REQUIRED IMPORTED_TARGET wayland-egl) ++ PKG_CHECK_MODULES(xkbcommon REQUIRED IMPORTED_TARGET xkbcommon) ++ LIST(APPEND LIBS PkgConfig::wayland-client PkgConfig::wayland-cursor PkgConfig::wayland-egl PkgConfig::xkbcommon) ++ else() ++ PKG_CHECK_MODULES(wayland-client REQUIRED) ++ PKG_CHECK_MODULES(wayland-cursor REQUIRED) ++ PKG_CHECK_MODULES(wayland-egl REQUIRED) ++ PKG_CHECK_MODULES(xkbcommon REQUIRED) ++ LIST(APPEND LIBS ${wayland-client_LINK_LIBRARIES} ${wayland-cursor_LINK_LIBRARIES} ${wayland-egl_LINK_LIBRARIES} ${xkbcommon_LINK_LIBRARIES}) ++ INCLUDE_DIRECTORIES(${wayland-client_INCLUDE_DIRS} ${wayland-cursor_INCLUDE_DIRS} ${wayland-egl_INCLUDE_DIRS} ${xkbcommon_INCLUDE_DIRS}) ++ endif() + ENDIF() + + # lib m for math, not needed on windows +-- +2.41.0 + diff --git a/recipes/freeglut/all/patches/3.2.2-0002-Use-find_library-to-locate-GL-libraries-not-provided.patch b/recipes/freeglut/all/patches/3.2.2-0002-Use-find_library-to-locate-GL-libraries-not-provided.patch new file mode 100644 index 0000000000000..42975bdd0a638 --- /dev/null +++ b/recipes/freeglut/all/patches/3.2.2-0002-Use-find_library-to-locate-GL-libraries-not-provided.patch @@ -0,0 +1,65 @@ +From 0bf1cd0cf4291ef130dcbf708128c72440ed6178 Mon Sep 17 00:00:00 2001 +From: Jordan Williams +Date: Tue, 7 Nov 2023 11:00:39 -0600 +Subject: [PATCH] Use find_library to locate GL libraries not provided by + FindOpenGL + +FindOpenGL is used to find the OpenGL libraries. +It doesn't find all of the necessary libraries, however. +These missing libraries have been added to the link line directly. +This is problematic when FindOpenGL is pointed at OpenGL libraries somewhere outside LD_LIBRARY_PATH and the system's default linker paths. +In such cases, the libraries won't be found at link time. + +CMake's find_library function can be used instead to add the libraries as this commit does. +This function can use the location of the GL libraries that were already found as a hint. +Furthermore, this allows consumers to use CMake cache variables to set the exact libraries to use if needed. +--- + CMakeLists.txt | 21 +++++++++++++++++---- + 1 file changed, 17 insertions(+), 4 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f97f14ff..c2549b1b 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -267,13 +267,23 @@ IF(FREEGLUT_GLES) + LIST(APPEND PUBLIC_DEFINITIONS -DFREEGLUT_GLES) + if(NOT CMAKE_VERSION VERSION_LESS "3.27") + FIND_PACKAGE(OpenGL REQUIRED COMPONENTS EGL GLES2 OpenGL) +- LIST(APPEND LIBS GLESv1_CM OpenGL::EGL OpenGL::GLES2 OpenGL::OpenGL) ++ CMAKE_PATH(GET OPENGL_gles2_LIBRARY PARENT_PATH _OPENGL_LIBDIR) ++ FIND_LIBRARY(GLES1_LIBRARY GLESv1_CM HINTS ${_OPENGL_LIBDIR} REQUIRED) ++ LIST(APPEND LIBS ${GLES1_LIBRARY} OpenGL::EGL OpenGL::GLES2 OpenGL::OpenGL) + elseif(NOT CMAKE_VERSION VERSION_LESS "3.10") + FIND_PACKAGE(OpenGL REQUIRED COMPONENTS EGL OpenGL) +- LIST(APPEND LIBS GLESv2 GLESv1_CM OpenGL::EGL OpenGL::OpenGL) ++ GET_FILENAME_COMPONENT(_OPENGL_LIBDIR ${OPENGL_egl_LIBRARY} DIRECTORY) ++ FIND_LIBRARY(GLES1_LIBRARY GLESv1_CM HINTS ${_OPENGL_LIBDIR}) ++ FIND_LIBRARY(GLES2_LIBRARY GLESv2 HINTS ${_OPENGL_LIBDIR}) ++ LIST(APPEND LIBS ${GLES1_LIBRARY} ${GLES2_LIBRARY} OpenGL::EGL OpenGL::OpenGL) + else() + FIND_PACKAGE(OpenGL REQUIRED) +- LIST(APPEND LIBS EGL GLESv2 GLESv1_CM) ++ LIST(GET ${OPENGL_LIBRARIES} 0 _OPENGL_LIB) ++ GET_FILENAME_COMPONENT(_OPENGL_LIBDIR ${_OPENGL_LIB} DIRECTORY) ++ FIND_LIBRARY(EGL_LIBRARY EGL HINTS ${_OPENGL_LIBDIR}) ++ FIND_LIBRARY(GLES1_LIBRARY GLESv1_CM HINTS ${_OPENGL_LIBDIR}) ++ FIND_LIBRARY(GLES2_LIBRARY GLESv2 HINTS ${_OPENGL_LIBDIR}) ++ LIST(APPEND LIBS ${EGL_LIBRARY} ${GLES1_LIBRARY} ${GLES2_LIBRARY}) + endif() + ELSE() + if(NOT CMAKE_VERSION VERSION_LESS "3.10") +@@ -295,7 +305,10 @@ IF(FREEGLUT_WAYLAND) + LIST(APPEND LIBS OpenGL::EGL OpenGL::OpenGL) + else() + FIND_PACKAGE(OpenGL REQUIRED) +- LIST(APPEND LIBS EGL) ++ LIST(GET ${OPENGL_LIBRARIES} 0 _OPENGL_LIB) ++ GET_FILENAME_COMPONENT(_OPENGL_LIBDIR ${_OPENGL_LIB} DIRECTORY) ++ FIND_LIBRARY(EGL_LIBRARY EGL HINTS ${_OPENGL_LIBDIR}) ++ LIST(APPEND LIBS ${EGL_LIBRARY}) + endif() + if(NOT CMAKE_VERSION VERSION_LESS "3.6") + PKG_CHECK_MODULES(wayland-client REQUIRED IMPORTED_TARGET wayland-client) +-- +2.41.0 + diff --git a/recipes/freeglut/all/patches/3.2.2-0003-Incorporate-the-include-directory-for-glu.h-in-CMake.patch b/recipes/freeglut/all/patches/3.2.2-0003-Incorporate-the-include-directory-for-glu.h-in-CMake.patch new file mode 100644 index 0000000000000..997edcafc5966 --- /dev/null +++ b/recipes/freeglut/all/patches/3.2.2-0003-Incorporate-the-include-directory-for-glu.h-in-CMake.patch @@ -0,0 +1,61 @@ +From 278ac11cf27c8112021735240dc0b34fe849045e Mon Sep 17 00:00:00 2001 +From: Jordan Williams +Date: Wed, 7 Feb 2024 10:09:25 -0600 +Subject: [PATCH] Incorporate the include directory for glu.h in CMake + +FreeGLUT doesn't properly check for the glu.h header file when it is required. +The glu.h header is not necessary when FreeGLUT is built for GLES. +However, the demos require use libGLU and so require the include and the library. + +CMake's FindOpenGL didn't properly search for the glu.h header file until very recently. +Refer to this PR: https://gitlab.kitware.com/cmake/cmake/-/merge_requests/9216. + +This PR checks for the glu.h header and adds the corresponding include directory when it is required. +For versions of CMake prior to 3.29, the include directory for GLU is added even when linking against the OpenGL::GLU target. +Like the FindOpenGL module, GLU include directories are ignored on Windows. +--- + CMakeLists.txt | 21 ++++++++++++++++++++- + 1 file changed, 20 insertions(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index c2549b1b..4ebc33af 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -294,6 +294,17 @@ ELSE() + LIST(APPEND LIBS ${OPENGL_gl_LIBRARY}) + INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR}) + endif() ++ ++ if(NOT CMAKE_SYSTEM_NAME STREQUAL "Windows") ++ # CMake 3.29 properly locates the include directory for glu.h in the OPENGL_GLU_INCLUDE_DIR variable for us. ++ if(CMAKE_VERSION VERSION_LESS "3.29") ++ FIND_PATH(OPENGL_GLU_INCLUDE_DIR NAMES GL/glu.h OpenGL/glu.h HINTS ${OPENGL_INCLUDE_DIR}) ++ endif() ++ if(NOT OPENGL_GLU_INCLUDE_DIR) ++ message(FATAL_ERROR "Failed to find the glu.h header file.") ++ endif() ++ INCLUDE_DIRECTORIES(${OPENGL_GLU_INCLUDE_DIR}) ++ endif() + ENDIF() + + # For Wayland: compile with -DFREEGLUT_WAYLAND and pull EGL +@@ -578,7 +589,15 @@ INSTALL(FILES ${FREEGLUT_HEADERS} DESTINATION include/GL COMPONENT Devel) + # Optionally build demos, on by default. + option( FREEGLUT_BUILD_DEMOS "Build FreeGLUT demos." ON ) + +-SET(DEMO_LIBS ${OPENGL_glu_LIBRARY} ${LIBS}) ++set(DEMO_LIBS ${LIBS}) ++if (FREEGLUT_BUILD_DEMOS) ++ if (OPENGL_GLU_FOUND) ++ list(APPEND DEMO_LIBS ${OPENGL_glu_LIBRARY}) ++ else() ++ message(FATAL_ERROR "Failed to find the GLU library which is required to build the demos.") ++ endif() ++endif() ++ + # lib m for math, not needed on windows + IF (NOT WIN32) + LIST(APPEND DEMO_LIBS m) +-- +2.43.2 + diff --git a/recipes/freeglut/all/patches/3.4.0-0001-Use-find_package-and-pkg_check_modules-to-find-more.patch b/recipes/freeglut/all/patches/3.4.0-0001-Use-find_package-and-pkg_check_modules-to-find-more.patch new file mode 100644 index 0000000000000..ccc7efdb7a68d --- /dev/null +++ b/recipes/freeglut/all/patches/3.4.0-0001-Use-find_package-and-pkg_check_modules-to-find-more.patch @@ -0,0 +1,100 @@ +From c60bc900b74d4e18994200550d26ae860899003f Mon Sep 17 00:00:00 2001 +From: Jordan Williams +Date: Thu, 2 Nov 2023 15:27:49 -0500 +Subject: [PATCH] Use find_package and pkg_check_modules to find more + dependencies + +This commit enhances the use of the FindOpenGL CMake module. +This requires CMake version 3.10 for the OpenGL::EGL imported target. +CMake 3.11 and later enable CMake policy CMP0072. +This prefers the GLVND libraries when available. + +Finds the Wayland and xkbcommon dependencies with pkg_check_modules. +This works with the pkg-config files provided by the upstream projects. +--- + CMakeLists.txt | 53 +++++++++++++++++++++++++++++++++++++++++++------- + 1 file changed, 46 insertions(+), 7 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 832d8672..87a54ae5 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,5 +1,9 @@ +-CMAKE_MINIMUM_REQUIRED(VERSION 3.0.0 FATAL_ERROR) +-PROJECT(freeglut C) ++CMAKE_MINIMUM_REQUIRED(VERSION 3.1 FATAL_ERROR) ++PROJECT(freeglut LANGUAGES C) ++ ++if (POLICY CMP0072) ++ cmake_policy(SET CMP0072 NEW) ++endif() + + # for multiarch LIBDIR support (requires cmake>=2.8.8) + INCLUDE(GNUInstallDirs) +@@ -292,7 +296,16 @@ ENDIF() + # GLES1 and GLES2 libraries are compatible and can be co-linked. + IF(FREEGLUT_GLES) + LIST(APPEND PUBLIC_DEFINITIONS -DFREEGLUT_GLES) +- LIST(APPEND LIBS GLESv2 GLESv1_CM EGL) ++ if(NOT CMAKE_VERSION VERSION_LESS "3.27") ++ FIND_PACKAGE(OpenGL REQUIRED COMPONENTS EGL GLES2 OpenGL) ++ LIST(APPEND LIBS GLESv1_CM OpenGL::EGL OpenGL::GLES2 OpenGL::OpenGL) ++ elseif(NOT CMAKE_VERSION VERSION_LESS "3.10") ++ FIND_PACKAGE(OpenGL REQUIRED COMPONENTS EGL OpenGL) ++ LIST(APPEND LIBS GLESv2 GLESv1_CM OpenGL::EGL OpenGL::OpenGL) ++ else() ++ FIND_PACKAGE(OpenGL REQUIRED) ++ LIST(APPEND LIBS EGL GLESv2 GLESv1_CM) ++ endif() + ELSE() + # On OS X, we need to link against the X11 OpenGL libraries, NOT the Cocoa OpenGL libraries. + # To do that, you need to manually find two of the libraries before calling FindOpenGL +@@ -304,15 +317,41 @@ ELSE() + find_library(OPENGL_glu_LIBRARY NAME GLU HINTS ${X11_LIB_PATH}) + endif() + +- FIND_PACKAGE(OpenGL REQUIRED) +- LIST(APPEND LIBS ${OPENGL_gl_LIBRARY}) +- INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR}) ++ if(NOT CMAKE_VERSION VERSION_LESS "3.10") ++ FIND_PACKAGE(OpenGL REQUIRED COMPONENTS OpenGL) ++ LIST(APPEND LIBS OpenGL::GL) ++ else() ++ FIND_PACKAGE(OpenGL REQUIRED) ++ LIST(APPEND LIBS ${OPENGL_gl_LIBRARY}) ++ INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR}) ++ endif() + ENDIF() + + # For Wayland: compile with -DFREEGLUT_WAYLAND and pull EGL + IF(FREEGLUT_WAYLAND) + ADD_DEFINITIONS(-DFREEGLUT_WAYLAND) +- LIST(APPEND LIBS wayland-client wayland-cursor wayland-egl EGL xkbcommon) ++ INCLUDE(FindPkgConfig) ++ if(NOT CMAKE_VERSION VERSION_LESS "3.10") ++ FIND_PACKAGE(OpenGL REQUIRED COMPONENTS EGL OpenGL) ++ LIST(APPEND LIBS OpenGL::EGL OpenGL::OpenGL) ++ else() ++ FIND_PACKAGE(OpenGL REQUIRED) ++ LIST(APPEND LIBS EGL) ++ endif() ++ if(NOT CMAKE_VERSION VERSION_LESS "3.6") ++ PKG_CHECK_MODULES(wayland-client REQUIRED IMPORTED_TARGET wayland-client) ++ PKG_CHECK_MODULES(wayland-cursor REQUIRED IMPORTED_TARGET wayland-cursor) ++ PKG_CHECK_MODULES(wayland-egl REQUIRED IMPORTED_TARGET wayland-egl) ++ PKG_CHECK_MODULES(xkbcommon REQUIRED IMPORTED_TARGET xkbcommon) ++ LIST(APPEND LIBS PkgConfig::wayland-client PkgConfig::wayland-cursor PkgConfig::wayland-egl PkgConfig::xkbcommon) ++ else() ++ PKG_CHECK_MODULES(wayland-client REQUIRED) ++ PKG_CHECK_MODULES(wayland-cursor REQUIRED) ++ PKG_CHECK_MODULES(wayland-egl REQUIRED) ++ PKG_CHECK_MODULES(xkbcommon REQUIRED) ++ LIST(APPEND LIBS ${wayland-client_LINK_LIBRARIES} ${wayland-cursor_LINK_LIBRARIES} ${wayland-egl_LINK_LIBRARIES} ${xkbcommon_LINK_LIBRARIES}) ++ INCLUDE_DIRECTORIES(${wayland-client_INCLUDE_DIRS} ${wayland-cursor_INCLUDE_DIRS} ${wayland-egl_INCLUDE_DIRS} ${xkbcommon_INCLUDE_DIRS}) ++ endif() + ENDIF() + + # lib m for math, not needed on windows +-- +2.41.0 + diff --git a/recipes/freeglut/all/patches/3.4.0-0002-Use-find_library-to-locate-GL-libraries-not-provided.patch b/recipes/freeglut/all/patches/3.4.0-0002-Use-find_library-to-locate-GL-libraries-not-provided.patch new file mode 100644 index 0000000000000..585a7de277647 --- /dev/null +++ b/recipes/freeglut/all/patches/3.4.0-0002-Use-find_library-to-locate-GL-libraries-not-provided.patch @@ -0,0 +1,65 @@ +From 4840a7d77e772d96074af64b6234cbc6e881d223 Mon Sep 17 00:00:00 2001 +From: Jordan Williams +Date: Tue, 7 Nov 2023 11:00:39 -0600 +Subject: [PATCH] Use find_library to locate GL libraries not provided by + FindOpenGL + +FindOpenGL is used to find the OpenGL libraries. +It doesn't find all of the necessary libraries, however. +These missing libraries have been added to the link line directly. +This is problematic when FindOpenGL is pointed at OpenGL libraries somewhere outside LD_LIBRARY_PATH and the system's default linker paths. +In such cases, the libraries won't be found at link time. + +CMake's find_library function can be used instead to add the libraries as this commit does. +This function can use the location of the GL libraries that were already found as a hint. +Furthermore, this allows consumers to use CMake cache variables to set the exact libraries to use if needed. +--- + CMakeLists.txt | 21 +++++++++++++++++---- + 1 file changed, 17 insertions(+), 4 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 87a54ae5..afb4d735 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -298,13 +298,23 @@ IF(FREEGLUT_GLES) + LIST(APPEND PUBLIC_DEFINITIONS -DFREEGLUT_GLES) + if(NOT CMAKE_VERSION VERSION_LESS "3.27") + FIND_PACKAGE(OpenGL REQUIRED COMPONENTS EGL GLES2 OpenGL) +- LIST(APPEND LIBS GLESv1_CM OpenGL::EGL OpenGL::GLES2 OpenGL::OpenGL) ++ CMAKE_PATH(GET OPENGL_gles2_LIBRARY PARENT_PATH _OPENGL_LIBDIR) ++ FIND_LIBRARY(GLES1_LIBRARY GLESv1_CM HINTS ${_OPENGL_LIBDIR} REQUIRED) ++ LIST(APPEND LIBS ${GLES1_LIBRARY} OpenGL::EGL OpenGL::GLES2 OpenGL::OpenGL) + elseif(NOT CMAKE_VERSION VERSION_LESS "3.10") + FIND_PACKAGE(OpenGL REQUIRED COMPONENTS EGL OpenGL) +- LIST(APPEND LIBS GLESv2 GLESv1_CM OpenGL::EGL OpenGL::OpenGL) ++ GET_FILENAME_COMPONENT(_OPENGL_LIBDIR ${OPENGL_egl_LIBRARY} DIRECTORY) ++ FIND_LIBRARY(GLES1_LIBRARY GLESv1_CM HINTS ${_OPENGL_LIBDIR}) ++ FIND_LIBRARY(GLES2_LIBRARY GLESv2 HINTS ${_OPENGL_LIBDIR}) ++ LIST(APPEND LIBS ${GLES1_LIBRARY} ${GLES2_LIBRARY} OpenGL::EGL OpenGL::OpenGL) + else() + FIND_PACKAGE(OpenGL REQUIRED) +- LIST(APPEND LIBS EGL GLESv2 GLESv1_CM) ++ LIST(GET ${OPENGL_LIBRARIES} 0 _OPENGL_LIB) ++ GET_FILENAME_COMPONENT(_OPENGL_LIBDIR ${_OPENGL_LIB} DIRECTORY) ++ FIND_LIBRARY(EGL_LIBRARY EGL HINTS ${_OPENGL_LIBDIR}) ++ FIND_LIBRARY(GLES1_LIBRARY GLESv1_CM HINTS ${_OPENGL_LIBDIR}) ++ FIND_LIBRARY(GLES2_LIBRARY GLESv2 HINTS ${_OPENGL_LIBDIR}) ++ LIST(APPEND LIBS ${EGL_LIBRARY} ${GLES1_LIBRARY} ${GLES2_LIBRARY}) + endif() + ELSE() + # On OS X, we need to link against the X11 OpenGL libraries, NOT the Cocoa OpenGL libraries. +@@ -336,7 +346,10 @@ IF(FREEGLUT_WAYLAND) + LIST(APPEND LIBS OpenGL::EGL OpenGL::OpenGL) + else() + FIND_PACKAGE(OpenGL REQUIRED) +- LIST(APPEND LIBS EGL) ++ LIST(GET ${OPENGL_LIBRARIES} 0 _OPENGL_LIB) ++ GET_FILENAME_COMPONENT(_OPENGL_LIBDIR ${_OPENGL_LIB} DIRECTORY) ++ FIND_LIBRARY(EGL_LIBRARY EGL HINTS ${_OPENGL_LIBDIR}) ++ LIST(APPEND LIBS ${EGL_LIBRARY}) + endif() + if(NOT CMAKE_VERSION VERSION_LESS "3.6") + PKG_CHECK_MODULES(wayland-client REQUIRED IMPORTED_TARGET wayland-client) +-- +2.41.0 + diff --git a/recipes/freeglut/all/patches/3.4.0-0003-Incorporate-the-include-directory-for-glu.h-in-CMake.patch b/recipes/freeglut/all/patches/3.4.0-0003-Incorporate-the-include-directory-for-glu.h-in-CMake.patch new file mode 100644 index 0000000000000..883e8141aa971 --- /dev/null +++ b/recipes/freeglut/all/patches/3.4.0-0003-Incorporate-the-include-directory-for-glu.h-in-CMake.patch @@ -0,0 +1,69 @@ +From 90f733b3adec8b3f97a24d4dd9dc47a595a17c2c Mon Sep 17 00:00:00 2001 +From: Jordan Williams +Date: Wed, 7 Feb 2024 10:09:25 -0600 +Subject: [PATCH] Incorporate the include directory for glu.h in CMake + +FreeGLUT doesn't properly check for the glu.h header file when it is required. +The glu.h header is not necessary when FreeGLUT is built for GLES. +However, the demos require use libGLU and so require the include and the library. + +CMake's FindOpenGL didn't properly search for the glu.h header file until very recently. +Refer to this PR: https://gitlab.kitware.com/cmake/cmake/-/merge_requests/9216. + +This PR checks for the glu.h header and adds the corresponding include directory when it is required. +For versions of CMake prior to 3.29, the include directory for GLU is added even when linking against the OpenGL::GLU target. +Like the FindOpenGL module, GLU include directories are ignored on Windows. +--- + CMakeLists.txt | 22 +++++++++++++++++++++- + 1 file changed, 21 insertions(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index afb4d735..aaf854d8 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -324,6 +324,7 @@ ELSE() + get_filename_component(X11_LIB_PATH ${X11_Xi_LIB} DIRECTORY) + + find_library(OPENGL_gl_LIBRARY NAME GL HINTS ${X11_LIB_PATH}) ++ find_path(OPENGL_GLU_INCLUDE_DIR NAMES GL/glu.h OpenGL/glu.h HINTS ${X11_Xi_INCLUDE_PATH}) + find_library(OPENGL_glu_LIBRARY NAME GLU HINTS ${X11_LIB_PATH}) + endif() + +@@ -335,6 +336,17 @@ ELSE() + LIST(APPEND LIBS ${OPENGL_gl_LIBRARY}) + INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR}) + endif() ++ ++ if(NOT CMAKE_SYSTEM_NAME STREQUAL "Windows") ++ # CMake 3.29 properly locates the include directory for glu.h in the OPENGL_GLU_INCLUDE_DIR variable for us. ++ if(CMAKE_VERSION VERSION_LESS "3.29") ++ FIND_PATH(OPENGL_GLU_INCLUDE_DIR NAMES GL/glu.h OpenGL/glu.h HINTS ${OPENGL_INCLUDE_DIR}) ++ endif() ++ if(NOT OPENGL_GLU_INCLUDE_DIR) ++ message(FATAL_ERROR "Failed to find the glu.h header file.") ++ endif() ++ INCLUDE_DIRECTORIES(${OPENGL_GLU_INCLUDE_DIR}) ++ endif() + ENDIF() + + # For Wayland: compile with -DFREEGLUT_WAYLAND and pull EGL +@@ -599,7 +611,15 @@ INSTALL(FILES ${FREEGLUT_HEADERS} DESTINATION include/GL COMPONENT Devel) + # Optionally build demos, on by default. + option( FREEGLUT_BUILD_DEMOS "Build FreeGLUT demos." ON ) + +-SET(DEMO_LIBS ${OPENGL_glu_LIBRARY} ${LIBS}) ++set(DEMO_LIBS ${LIBS}) ++if (FREEGLUT_BUILD_DEMOS) ++ if (OPENGL_GLU_FOUND) ++ list(APPEND DEMO_LIBS ${OPENGL_glu_LIBRARY}) ++ else() ++ message(FATAL_ERROR "Failed to find the GLU library which is required to build the demos.") ++ endif() ++endif() ++ + # lib m for math, not needed on windows + IF (NOT WIN32) + LIST(APPEND DEMO_LIBS m) +-- +2.43.2 + diff --git a/recipes/freeglut/all/test_package/CMakeLists.txt b/recipes/freeglut/all/test_package/CMakeLists.txt index 79ed7279f6790..9640aaa16d3b0 100644 --- a/recipes/freeglut/all/test_package/CMakeLists.txt +++ b/recipes/freeglut/all/test_package/CMakeLists.txt @@ -1,10 +1,12 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package C) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(GLUT REQUIRED) +find_package(FreeGLUT REQUIRED CONFIG) +find_package(OpenGL REQUIRED) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} GLUT::GLUT) +if(TARGET FreeGLUT::freeglut_static) + target_link_libraries(${PROJECT_NAME} PRIVATE FreeGLUT::freeglut_static OpenGL::GL) +else() + target_link_libraries(${PROJECT_NAME} PRIVATE FreeGLUT::freeglut OpenGL::GL) +endif() diff --git a/recipes/freeglut/all/test_package/conanfile.py b/recipes/freeglut/all/test_package/conanfile.py index 19e6a0c06e3d8..0a6bc68712d90 100644 --- a/recipes/freeglut/all/test_package/conanfile.py +++ b/recipes/freeglut/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/freeglut/all/test_package_module/CMakeLists.txt b/recipes/freeglut/all/test_package_module/CMakeLists.txt new file mode 100644 index 0000000000000..91faaebf9894b --- /dev/null +++ b/recipes/freeglut/all/test_package_module/CMakeLists.txt @@ -0,0 +1,22 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) + +find_package(GLUT REQUIRED MODULE) +find_package(OpenGL REQUIRED) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE GLUT::GLUT OpenGL::GL) + +# Test whether variables from https://cmake.org/cmake/help/latest/module/FindGLUT.html are properly defined +set(_custom_vars + GLUT_FOUND + GLUT_INCLUDE_DIRS + GLUT_LIBRARIES +) +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/freeglut/all/test_package_module/conanfile.py b/recipes/freeglut/all/test_package_module/conanfile.py new file mode 100644 index 0000000000000..0a6bc68712d90 --- /dev/null +++ b/recipes/freeglut/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 = "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/freeglut/config.yml b/recipes/freeglut/config.yml index 31ef026aaa09c..dc897e491fcb6 100644 --- a/recipes/freeglut/config.yml +++ b/recipes/freeglut/config.yml @@ -1,4 +1,6 @@ versions: + "3.4.0": + folder: all "3.2.2": folder: all "3.2.1": diff --git a/recipes/freeimage/all/conandata.yml b/recipes/freeimage/all/conandata.yml index ab58bf12a8d2b..a988135b5daba 100644 --- a/recipes/freeimage/all/conandata.yml +++ b/recipes/freeimage/all/conandata.yml @@ -1,6 +1,6 @@ sources: "3.18.0": - url: "http://downloads.sourceforge.net/project/freeimage/Source Distribution/3.18.0/FreeImage3180.zip" + url: "http://downloads.sourceforge.net/project/freeimage/Source%20Distribution/3.18.0/FreeImage3180.zip" sha256: "f41379682f9ada94ea7b34fe86bf9ee00935a3147be41b6569c9605a53e438fd" patches: "3.18.0": diff --git a/recipes/freeimage/all/conanfile.py b/recipes/freeimage/all/conanfile.py index 44eea75a589aa..9a83848609751 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,49 +57,51 @@ 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.11 <2]") 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/3.0.2") + elif self.options.with_jpeg == "mozjpeg": + self.requires("mozjpeg/4.1.1") if self.options.with_jpeg2000: - self.requires("openjpeg/2.5.0") + self.requires("openjpeg/2.5.2") if self.options.with_png: - self.requires("libpng/1.6.37") + self.requires("libpng/[>=1.6 <2]") if self.options.with_webp: - self.requires("libwebp/1.2.4") + self.requires("libwebp/1.3.2") 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") if self.options.with_tiff: - self.requires("libtiff/4.4.0") + self.requires("libtiff/4.6.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..0a6bc68712d90 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,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") - bees = os.path.join(self.source_folder, "test.png") - self.run(f"{bin_path} {bees}", env="conanrun") + self.run(bin_path, env="conanrun") diff --git a/recipes/freeimage/all/test_package/test.png b/recipes/freeimage/all/test_package/test.png deleted file mode 100644 index 11640c7488fb1..0000000000000 Binary files a/recipes/freeimage/all/test_package/test.png and /dev/null differ diff --git a/recipes/freeimage/all/test_package/test_package.cpp b/recipes/freeimage/all/test_package/test_package.cpp index 0adc1a0375b01..b2164b2ffb68d 100644 --- a/recipes/freeimage/all/test_package/test_package.cpp +++ b/recipes/freeimage/all/test_package/test_package.cpp @@ -11,39 +11,14 @@ void FreeImageErrorHandler(FREE_IMAGE_FORMAT fif, const char* message) std::cerr << "FreeImage error: " << message << std::endl; } -int main(int argc, char** argv ) -{ - if (argc < 2) { - std::cerr << "Need at least one argument" << std::endl; - return 1; - } +int main(int argc, char** argv ) { #if NEED_INIT FreeImage_Initialise(); #endif FreeImage_SetOutputMessage(FreeImageErrorHandler); - - std::cout << "FreeImage " << FreeImage_GetVersion() << ", with:" << std::endl; - - for (int i = 0; i < FreeImage_GetFIFCount(); ++i) - { - std::cout << "\t- " << FreeImage_GetFIFExtensionList((FREE_IMAGE_FORMAT)i) << std::endl; - } - - const char * image_file = argv[1]; - FREE_IMAGE_FORMAT fif = FIF_UNKNOWN; - fif = FreeImage_GetFileType(image_file, 0); - if (fif == FIF_UNKNOWN) { - fif = FreeImage_GetFIFFromFilename(image_file); - } - if ((fif != FIF_UNKNOWN) && FreeImage_FIFSupportsReading(fif)) { - FIBITMAP* dib = FreeImage_Load(fif, image_file, 0); - if (dib) - { - FreeImage_Unload(dib); - } - } + std::cout << "FreeImage " << FreeImage_GetVersion() << std::endl; #if NEED_INIT FreeImage_DeInitialise(); 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/freeimage/all/test_v1_package/conanfile.py b/recipes/freeimage/all/test_v1_package/conanfile.py index 6895afd01c85c..38f4483872d47 100644 --- a/recipes/freeimage/all/test_v1_package/conanfile.py +++ b/recipes/freeimage/all/test_v1_package/conanfile.py @@ -14,5 +14,4 @@ def build(self): 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", "test.png") - self.run(f"{bin_path} {bees}", run_environment=True) + self.run(bin_path, run_environment=True) diff --git a/recipes/freetype/all/conandata.yml b/recipes/freetype/all/conandata.yml index d87a9087670e2..ffe78e299e4fb 100644 --- a/recipes/freetype/all/conandata.yml +++ b/recipes/freetype/all/conandata.yml @@ -1,19 +1,16 @@ sources: "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" diff --git a/recipes/freetype/all/conanfile.py b/recipes/freetype/all/conanfile.py index 934fe24eeba5e..30f77de96b06e 100644 --- a/recipes/freetype/all/conanfile.py +++ b/recipes/freetype/all/conanfile.py @@ -1,12 +1,15 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout -from conan.tools.files import collect_libs, copy, load, get, rename, replace_in_file, rmdir, save +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 textwrap -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class FreetypeConan(ConanFile): @@ -16,7 +19,7 @@ class FreetypeConan(ConanFile): homepage = "https://www.freetype.org" license = "FTL" topics = ("freetype", "fonts") - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -34,87 +37,72 @@ class FreetypeConan(ConanFile): "with_zlib": True, "with_bzip2": True, "with_brotli": True, - "subpixel": False + "subpixel": False, } - @property - def _has_with_brotli_option(self): - return Version(self.version) >= "2.10.2" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - if not self._has_with_brotli_option: - del self.options.with_brotli 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 + 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.39") + self.requires("libpng/[>=1.6 <2]") if self.options.with_zlib: - self.requires("zlib/1.2.13") + self.requires("zlib/[>=1.2.10 <2]") if self.options.with_bzip2: self.requires("bzip2/1.0.8") - if self.options.get_safe("with_brotli"): - self.requires("brotli/1.0.9") + if self.options.with_brotli: + self.requires("brotli/1.1.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): deps = CMakeDeps(self) deps.generate() - cmake = CMakeToolchain(self) + tc = CMakeToolchain(self) if Version(self.version) >= "2.11.0": - cmake.variables["FT_REQUIRE_ZLIB"] = self.options.with_zlib - cmake.variables["FT_DISABLE_ZLIB"] = not self.options.with_zlib - cmake.variables["FT_REQUIRE_PNG"] = self.options.with_png - cmake.variables["FT_DISABLE_PNG"] = not self.options.with_png - cmake.variables["FT_REQUIRE_BZIP2"] = self.options.with_bzip2 - cmake.variables["FT_DISABLE_BZIP2"] = not self.options.with_bzip2 + 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. - cmake.variables["FT_REQUIRE_HARFBUZZ"] = False - cmake.variables["FT_DISABLE_HARFBUZZ"] = True - if self._has_with_brotli_option: - cmake.variables["FT_REQUIRE_BROTLI"] = self.options.with_brotli - cmake.variables["FT_DISABLE_BROTLI"] = not self.options.with_brotli + tc.variables["FT_REQUIRE_HARFBUZZ"] = False + tc.variables["FT_DISABLE_HARFBUZZ"] = True + tc.variables["FT_REQUIRE_BROTLI"] = self.options.with_brotli + tc.variables["FT_DISABLE_BROTLI"] = not self.options.with_brotli else: - cmake.variables["FT_WITH_ZLIB"] = self.options.with_zlib - cmake.variables["FT_WITH_PNG"] = self.options.with_png - cmake.variables["FT_WITH_BZIP2"] = self.options.with_bzip2 + 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. - cmake.variables["FT_WITH_HARFBUZZ"] = False - if self._has_with_brotli_option: - cmake.variables["FT_WITH_BROTLI"] = self.options.with_brotli + tc.variables["FT_WITH_HARFBUZZ"] = False + tc.variables["FT_WITH_BROTLI"] = self.options.with_brotli # Generate a relocatable shared lib on Macos - cmake.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" - cmake.generate() + 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_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, "find_package(HarfBuzz ${HARFBUZZ_MIN_VERSION})", "") replace_in_file(self, cmakelists, if_harfbuzz_found, "if(0)") if not self.options.with_png: replace_in_file(self, cmakelists, "find_package(PNG)", "") @@ -125,16 +113,15 @@ def _patch_sources(self): if not self.options.with_bzip2: 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 - replace_in_file(self, cmakelists, - "find_package(BrotliDec REQUIRED)", - "find_package(Brotli REQUIRED)\n" - "set(BROTLIDEC_FOUND 1)\n" - "set(BROTLIDEC_LIBRARIES \"brotli::brotli\")") - if not self.options.with_brotli: - replace_in_file(self, cmakelists, "find_package(BrotliDec)", "") - replace_in_file(self, cmakelists, "if (BROTLIDEC_FOUND)", "if(0)") + # the custom FindBrotliDec of upstream is too fragile + replace_in_file(self, cmakelists, + "find_package(BrotliDec REQUIRED)", + "find_package(Brotli REQUIRED)\n" + "set(BROTLIDEC_FOUND 1)\n" + "set(BROTLIDEC_LIBRARIES \"brotli::brotli\")") + if not self.options.with_brotli: + 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_folder, "include", "freetype", "config", "ftoption.h") if self.options.subpixel: @@ -206,17 +193,15 @@ def package(self): ) def _create_cmake_module_variables(self, module_file): - content = textwrap.dedent("""\ + content = textwrap.dedent(f"""\ set(FREETYPE_FOUND TRUE) if(DEFINED Freetype_INCLUDE_DIRS) - set(FREETYPE_INCLUDE_DIRS ${Freetype_INCLUDE_DIRS}) + set(FREETYPE_INCLUDE_DIRS ${{Freetype_INCLUDE_DIRS}}) endif() if(DEFINED Freetype_LIBRARIES) - set(FREETYPE_LIBRARIES ${Freetype_LIBRARIES}) - endif() - if(DEFINED Freetype_VERSION) - set(FREETYPE_VERSION_STRING ${Freetype_VERSION}) + set(FREETYPE_LIBRARIES ${{Freetype_LIBRARIES}}) endif() + set(FREETYPE_VERSION_STRING "{self.version}") """) save(self, module_file, content) @@ -241,15 +226,15 @@ def _module_target_rel_path(self): @staticmethod def _chmod_plus_x(filename): - if os.name == "posix": + if os.name == "posix" and (os.stat(filename).st_mode & 0o111) != 0o111: os.chmod(filename, os.stat(filename).st_mode | 0o111) def package_info(self): self.cpp_info.set_property("cmake_find_mode", "both") self.cpp_info.set_property("cmake_module_file_name", "Freetype") - 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.set_property("cmake_target_name", "Freetype::Freetype") + self.cpp_info.set_property("cmake_target_aliases", ["freetype"]) # other possible target name in upstream config file 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 = collect_libs(self) @@ -259,10 +244,10 @@ def package_info(self): 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 + self.cpp_info.set_property("system_package_version", libtool_version) # TODO: to remove in conan v2 once cmake_find_package* & pkg_config generators removed + self.cpp_info.set_property("component_version", libtool_version) self.cpp_info.filenames["cmake_find_package"] = "Freetype" self.cpp_info.filenames["cmake_find_package_multi"] = "freetype" self.cpp_info.names["cmake_find_package"] = "Freetype" diff --git a/recipes/freetype/all/test_package/OpenSans-Bold.ttf b/recipes/freetype/all/test_package/OpenSans-Bold.ttf index fd79d43bea029..1588c2ced3a6c 100644 Binary files a/recipes/freetype/all/test_package/OpenSans-Bold.ttf and b/recipes/freetype/all/test_package/OpenSans-Bold.ttf differ diff --git a/recipes/freetype/all/test_package/conanfile.py b/recipes/freetype/all/test_package/conanfile.py index 5da019d033eb1..7c01d32f07d5a 100644 --- a/recipes/freetype/all/test_package/conanfile.py +++ b/recipes/freetype/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" + license = "OFL-1.1-no-RFN" def layout(self): cmake_layout(self) diff --git a/recipes/freetype/all/test_package_module/CMakeLists.txt b/recipes/freetype/all/test_package_module/CMakeLists.txt index 3a9f9ffa7c630..2c27f3b8d69b0 100644 --- a/recipes/freetype/all/test_package_module/CMakeLists.txt +++ b/recipes/freetype/all/test_package_module/CMakeLists.txt @@ -15,7 +15,7 @@ set(_custom_vars FREETYPE_VERSION_STRING ) foreach(_custom_var ${_custom_vars}) - if(DEFINED _custom_var) + if(DEFINED ${_custom_var}) message(STATUS "${_custom_var}: ${${_custom_var}}") else() message(FATAL_ERROR "${_custom_var} not defined") diff --git a/recipes/freetype/all/test_package_module/conanfile.py b/recipes/freetype/all/test_package_module/conanfile.py index e789c017730b3..c01bc5d128062 100644 --- a/recipes/freetype/all/test_package_module/conanfile.py +++ b/recipes/freetype/all/test_package_module/conanfile.py @@ -8,6 +8,7 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" test_type = "explicit" + license = "OFL-1.1-no-RFN" def layout(self): cmake_layout(self) diff --git a/recipes/freetype/all/test_v1_package/conanfile.py b/recipes/freetype/all/test_v1_package/conanfile.py index da2d908b1d4a7..fba25cb7ecbbc 100644 --- a/recipes/freetype/all/test_v1_package/conanfile.py +++ b/recipes/freetype/all/test_v1_package/conanfile.py @@ -5,6 +5,7 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "cmake", "cmake_find_package_multi" + license = "OFL-1.1-no-RFN" def build(self): cmake = CMake(self) diff --git a/recipes/freetype/all/test_v1_package_module/conanfile.py b/recipes/freetype/all/test_v1_package_module/conanfile.py index 7834358365541..1ddffa6741246 100644 --- a/recipes/freetype/all/test_v1_package_module/conanfile.py +++ b/recipes/freetype/all/test_v1_package_module/conanfile.py @@ -5,6 +5,7 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "cmake", "cmake_find_package" + license = "OFL-1.1-no-RFN" def build(self): cmake = CMake(self) diff --git a/recipes/freetype/config.yml b/recipes/freetype/config.yml index 3617de8da17d5..d5b191e4495ca 100644 --- a/recipes/freetype/config.yml +++ b/recipes/freetype/config.yml @@ -1,4 +1,10 @@ versions: + "2.13.3": + folder: meson + "2.13.2": + folder: meson + "2.13.0": + folder: meson "2.12.1": folder: all "2.11.1": diff --git a/recipes/freetype/meson/conandata.yml b/recipes/freetype/meson/conandata.yml new file mode 100644 index 0000000000000..361e211d1b780 --- /dev/null +++ b/recipes/freetype/meson/conandata.yml @@ -0,0 +1,40 @@ +sources: + "2.13.3": + url: + - "https://download.savannah.gnu.org/releases/freetype/freetype-2.13.3.tar.xz" + - "https://sourceforge.net/projects/freetype/files/freetype2/2.13.3/freetype-2.13.3.tar.xz" + sha256: "0550350666d427c74daeb85d5ac7bb353acba5f76956395995311a9c6f063289" + "2.13.2": + url: + - "https://download.savannah.gnu.org/releases/freetype/freetype-2.13.2.tar.xz" + - "https://sourceforge.net/projects/freetype/files/freetype2/2.13.2/freetype-2.13.2.tar.xz" + sha256: "12991c4e55c506dd7f9b765933e62fd2be2e06d421505d7950a132e4f1bb484d" + "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" +patches: + "2.13.3": + - patch_file: "patches/2.13.3-0002-meson-Fix-static-windows.patch" + patch_description: "meson: define DLL_EXPORT for shared library only" + patch_source: "https://gitlab.freedesktop.org/freetype/freetype/-/merge_requests/341" + patch_type: "portability" + "2.13.2": + - patch_file: "patches/2.13.0-0001-meson-Use-the-standard-dependency-mechanism-to-find-.patch" + patch_description: "meson: Use the standard dependency mechanism to find bzip2" + patch_source: "https://gitlab.freedesktop.org/freetype/freetype/-/merge_requests/318" + patch_type: "portability" + - patch_file: "patches/2.13.0-0002-meson-Fix-static-windows.patch" + patch_description: "meson: define DLL_EXPORT for shared library only" + patch_source: "https://gitlab.freedesktop.org/freetype/freetype/-/merge_requests/341" + patch_type: "portability" + "2.13.0": + - patch_file: "patches/2.13.0-0001-meson-Use-the-standard-dependency-mechanism-to-find-.patch" + patch_description: "meson: Use the standard dependency mechanism to find bzip2" + patch_source: "https://gitlab.freedesktop.org/freetype/freetype/-/merge_requests/318" + patch_type: "portability" + - patch_file: "patches/2.13.0-0002-meson-Fix-static-windows.patch" + patch_description: "meson: define DLL_EXPORT for shared library only" + patch_source: "https://gitlab.freedesktop.org/freetype/freetype/-/merge_requests/341" + patch_type: "portability" diff --git a/recipes/freetype/meson/conanfile.py b/recipes/freetype/meson/conanfile.py new file mode 100644 index 0000000000000..c48b965407536 --- /dev/null +++ b/recipes/freetype/meson/conanfile.py @@ -0,0 +1,258 @@ +from conan import ConanFile +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.files import ( + apply_conandata_patches, copy, export_conandata_patches, load, + get, rename, replace_in_file, rm, rmdir, save +) +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.scm import Version +import os +import re +import shutil +import textwrap + +required_conan_version = ">=1.53.0" + + +class FreetypeConan(ConanFile): + name = "freetype" + description = "FreeType is a freely available software library to render fonts." + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://www.freetype.org" + license = "FTL" + topics = ("freetype", "fonts") + package_type = "library" + short_paths = True + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_png": [True, False], + "with_zlib": [True, False], + "with_bzip2": [True, False], + "with_brotli": [True, False], + "subpixel": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_png": True, + "with_zlib": True, + "with_bzip2": True, + "with_brotli": True, + "subpixel": 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.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + if self.options.with_png: + self.requires("libpng/[>=1.6 <2]") + if self.options.with_zlib: + self.requires("zlib/[>=1.2.10 <2]") + if self.options.with_bzip2: + self.requires("bzip2/1.0.8") + if self.options.get_safe("with_brotli"): + self.requires("brotli/1.1.0") + + def build_requirements(self): + self.tool_requires("meson/1.3.2") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/2.1.0") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + virtual_build_env = VirtualBuildEnv(self) + virtual_build_env.generate() + deps = PkgConfigDeps(self) + deps.generate() + + def feature(option): + return "enabled" if option else "disabled" + + tc = MesonToolchain(self) + tc.project_options["brotli"] = feature(self.options.with_brotli) + tc.project_options["bzip2"] = feature(self.options.with_bzip2) + # Harfbuzz support introduces a circular dependency between Harfbuzz and Freetype. + # They both have options to require each other. + tc.project_options["harfbuzz"] = "disabled" + tc.project_options["png"] = feature(self.options.with_png) + tc.project_options["tests"] = "disabled" + tc.project_options["zlib"] = "system" if self.options.with_zlib else "disabled" + tc.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + config_h = os.path.join(self.source_folder, "include", "freetype", "config", "ftoption.h") + if self.options.subpixel: + replace_in_file(self, config_h, "/* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */", "#define FT_CONFIG_OPTION_SUBPIXEL_RENDERING") + + def build(self): + self._patch_sources() + meson = Meson(self) + meson.configure() + meson.build() + + def _make_freetype_config(self, version): + 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") + rename(self, freetype_config_in, freetype_config) + staticlibs = "-lm -lfreetype" if self.settings.os == "Linux" else "-lfreetype" + 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"export LC_ALL", textwrap.dedent("""\ + export LC_ALL + BINDIR=$(dirname $0) + conan_prefix=$(dirname $BINDIR) + conan_exec_prefix=${{conan_prefix}}/bin + conan_includedir=${{conan_prefix}}/include + conan_libdir=${{conan_prefix}}/lib + conan_ftversion={version} + conan_staticlibs="{staticlibs}" + """).format(version=version, staticlibs=staticlibs)) + + def _extract_libtool_version(self): + conf_raw = load(self, os.path.join(self.source_folder, "builds", "unix", "configure.raw")) + return re.search(r"^version_info='([0-9:]+)'", conf_raw, flags=re.M).group(1).replace(":", ".") + + @property + def _libtool_version_txt(self): + return os.path.join(self.package_folder, "res", "freetype-libtool-version.txt") + + def package(self): + meson = Meson(self) + meson.install() + + # As a workaround to support versions of CMake before 3.29, rename the libfreetype.a static library to freetype.lib on Windows. + if self.settings.os == "Windows" and not self.options.shared: + rename(self, os.path.join(self.package_folder, "lib", "libfreetype.a"), os.path.join(self.package_folder, "lib", "freetype.lib")) + + ver = Version(self.version) + if self.settings.os == "Windows" and self.options.shared and ver >= "2.13.0" and ver < "2.14.0": + # Duplicate DLL name for backwards compatibility with earlier recipe revisions + # See https://github.com/conan-io/conan-center-index/issues/23768 + suffix = "d" if self.settings.build_type == "Debug" else "" + src = os.path.join(self.package_folder, "bin", "freetype-6.dll") + dst = os.path.join(self.package_folder, "bin", f"freetype{suffix}.dll") + shutil.copyfile(src, dst) + + libtool_version = self._extract_libtool_version() + + save(self, self._libtool_version_txt, libtool_version) + self._make_freetype_config(libtool_version) + + 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) + + 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")) + rmdir(self, os.path.join(self.package_folder, "share")) + self._create_cmake_module_variables( + os.path.join(self.package_folder, self._module_vars_rel_path) + ) + self._create_cmake_module_alias_targets( + os.path.join(self.package_folder, self._module_target_rel_path), + {"freetype": "Freetype::Freetype"} + ) + + fix_apple_shared_install_name(self) + + def _create_cmake_module_variables(self, module_file): + content = textwrap.dedent(f"""\ + set(FREETYPE_FOUND TRUE) + if(DEFINED Freetype_INCLUDE_DIRS) + set(FREETYPE_INCLUDE_DIRS ${{Freetype_INCLUDE_DIRS}}) + endif() + if(DEFINED Freetype_LIBRARIES) + set(FREETYPE_LIBRARIES ${{Freetype_LIBRARIES}}) + endif() + set(FREETYPE_VERSION_STRING "{self.version}") + """) + save(self, module_file, content) + + 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_vars_rel_path(self): + return os.path.join("lib", "cmake", f"conan-official-{self.name}-variables.cmake") + + @property + def _module_target_rel_path(self): + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") + + @staticmethod + def _chmod_plus_x(filename): + if os.name == "posix" and (os.stat(filename).st_mode & 0o111) != 0o111: + os.chmod(filename, os.stat(filename).st_mode | 0o111) + + def package_info(self): + self.cpp_info.set_property("cmake_find_mode", "both") + self.cpp_info.set_property("cmake_module_file_name", "Freetype") + self.cpp_info.set_property("cmake_file_name", "freetype") + self.cpp_info.set_property("cmake_target_name", "Freetype::Freetype") + self.cpp_info.set_property("cmake_target_aliases", ["freetype"]) # other possible target name in upstream config file + 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 = ["freetype"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") + self.cpp_info.includedirs.append(os.path.join("include", "freetype2")) + + libtool_version = load(self, self._libtool_version_txt).strip() + self.conf_info.define("user.freetype:libtool_version", libtool_version) + self.cpp_info.set_property("system_package_version", libtool_version) + + # TODO: to remove in conan v2 once cmake_find_package* & pkg_config generators removed + self.cpp_info.set_property("component_version", libtool_version) + self.cpp_info.filenames["cmake_find_package"] = "Freetype" + self.cpp_info.filenames["cmake_find_package_multi"] = "freetype" + self.cpp_info.names["cmake_find_package"] = "Freetype" + self.cpp_info.names["cmake_find_package_multi"] = "Freetype" + 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/meson/patches/2.13.0-0001-meson-Use-the-standard-dependency-mechanism-to-find-.patch b/recipes/freetype/meson/patches/2.13.0-0001-meson-Use-the-standard-dependency-mechanism-to-find-.patch new file mode 100644 index 0000000000000..c38db5d6a0d6c --- /dev/null +++ b/recipes/freetype/meson/patches/2.13.0-0001-meson-Use-the-standard-dependency-mechanism-to-find-.patch @@ -0,0 +1,31 @@ +From 2598fa002859d2af1c846363ff64e72d2ebde16a Mon Sep 17 00:00:00 2001 +From: Jordan Williams +Date: Mon, 4 Mar 2024 12:14:51 -0600 +Subject: [PATCH] meson: Use the standard dependency mechanism to find bzip2 + +This follows standard conventions in Meson by using the pkg-config file. +This change allows Conan to switch to the Meson build system. +--- + meson.build | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/meson.build b/meson.build +index f81de3e2f..c5cb8ea52 100644 +--- a/meson.build ++++ b/meson.build +@@ -316,8 +316,10 @@ else + endif + + # BZip2 support +-bzip2_dep = cc.find_library('bz2', +- required: get_option('bzip2')) ++bzip2_dep = dependency('bzip2', required: false) ++if not bzip2_dep.found() ++ bzip2_dep = cc.find_library('bz2', has_headers: ['bzlib.h'], required: get_option('bzip2')) ++endif + + if bzip2_dep.found() + ftoption_command += ['--enable=FT_CONFIG_OPTION_USE_BZIP2'] +-- +2.44.0 + diff --git a/recipes/freetype/meson/patches/2.13.0-0002-meson-Fix-static-windows.patch b/recipes/freetype/meson/patches/2.13.0-0002-meson-Fix-static-windows.patch new file mode 100644 index 0000000000000..7faf662f6ebdf --- /dev/null +++ b/recipes/freetype/meson/patches/2.13.0-0002-meson-Fix-static-windows.patch @@ -0,0 +1,12 @@ +--- a/meson.build ++++ b/meson.build +@@ -368,7 +368,8 @@ ftoption_h = custom_target('ftoption.h', + ft2_sources += ftoption_h + ft2_defines += ['-DFT_CONFIG_OPTIONS_H='] + +-if host_machine.system() == 'windows' ++if host_machine.system() == 'windows' and \ ++ get_option('default_library') == 'shared' + ft2_defines += ['-DDLL_EXPORT=1'] + endif + diff --git a/recipes/freetype/meson/patches/2.13.3-0002-meson-Fix-static-windows.patch b/recipes/freetype/meson/patches/2.13.3-0002-meson-Fix-static-windows.patch new file mode 100644 index 0000000000000..e001a8bdca37c --- /dev/null +++ b/recipes/freetype/meson/patches/2.13.3-0002-meson-Fix-static-windows.patch @@ -0,0 +1,12 @@ +--- a/meson.build ++++ b/meson.build +@@ -373,7 +373,8 @@ ftoption_h = custom_target('ftoption.h', + ft2_sources += ftoption_h + ft2_defines += ['-DFT_CONFIG_OPTIONS_H='] + +-if host_machine.system() == 'windows' ++if host_machine.system() == 'windows' and \ ++ get_option('default_library') == 'shared' + ft2_defines += ['-DDLL_EXPORT=1'] + endif + diff --git a/recipes/freetype/meson/test_package/CMakeLists.txt b/recipes/freetype/meson/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..daf57e167b0ad --- /dev/null +++ b/recipes/freetype/meson/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) + +find_package(freetype REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE freetype) diff --git a/recipes/freetype/meson/test_package/OpenSans-Bold.ttf b/recipes/freetype/meson/test_package/OpenSans-Bold.ttf new file mode 100644 index 0000000000000..1588c2ced3a6c Binary files /dev/null and b/recipes/freetype/meson/test_package/OpenSans-Bold.ttf differ diff --git a/recipes/freetype/meson/test_package/conanfile.py b/recipes/freetype/meson/test_package/conanfile.py new file mode 100644 index 0000000000000..c762b4d9a11e2 --- /dev/null +++ b/recipes/freetype/meson/test_package/conanfile.py @@ -0,0 +1,29 @@ +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 = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + license = "OFL-1.1-no-RFN" + short_paths = True + + 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, "OpenSans-Bold.ttf") + self.run(f"{bin_path} {font_path}", env="conanrun") diff --git a/recipes/freetype/meson/test_package/test_package.c b/recipes/freetype/meson/test_package/test_package.c new file mode 100644 index 0000000000000..332eeaeae1c39 --- /dev/null +++ b/recipes/freetype/meson/test_package/test_package.c @@ -0,0 +1,142 @@ +/* example1.c */ +/* */ +/* This small program shows how to print a rotated string with the */ +/* FreeType 2 library. */ + +#include "ft2build.h" +#include FT_FREETYPE_H + +#include +#include +#include +#include + + + +#define WIDTH 640 +#define HEIGHT 480 + + +/* origin is the upper left corner */ +unsigned char image[HEIGHT][WIDTH]; + + +/* Replace this function with something useful. */ + +void +draw_bitmap( FT_Bitmap* bitmap, + FT_Int x, + FT_Int y) +{ + FT_Int i, j, p, q; + FT_Int x_max = x + bitmap->width; + FT_Int y_max = y + bitmap->rows; + + + /* for simplicity, we assume that `bitmap->pixel_mode' */ + /* is `FT_PIXEL_MODE_GRAY' (i.e., not a bitmap font) */ + + for ( i = x, p = 0; i < x_max; i++, p++ ) + { + for ( j = y, q = 0; j < y_max; j++, q++ ) + { + if ( i < 0 || j < 0 || + i >= WIDTH || j >= HEIGHT ) + continue; + + image[j][i] |= bitmap->buffer[q * bitmap->width + p]; + } + } +} + + +int +main( int argc, + char** argv ) +{ + FT_Library library; + FT_Face face; + + FT_GlyphSlot slot; + FT_Matrix matrix; /* transformation matrix */ + FT_Vector pen; /* untransformed origin */ + FT_Error error; + + char* filename; + char* text; + + double angle; + int target_height; + size_t n, num_chars; + + if (argc < 2) { + fprintf(stderr, "Usage: %s FONT\n", argv[0]); + return EXIT_FAILURE; + } + + filename = argv[1]; + text = "conan-center-index"; + num_chars = strlen( text ); + angle = ( 25.0 / 360 ) * 3.14159 * 2; /* use 25 degrees */ + target_height = HEIGHT; + + error = FT_Init_FreeType( &library ); /* initialize library */ + if (error) { + exit(EXIT_FAILURE); + } + + error = FT_New_Face( library, filename, 0, &face );/* create face object */ + if (error) { + exit(EXIT_FAILURE); + } + + /* use 50pt at 100dpi */ + error = FT_Set_Char_Size( face, 50 * 64, 0, 100, 0 ); + if (error) { + exit(EXIT_FAILURE); + } + + /* cmap selection omitted; */ + /* for simplicity we assume that the font contains a Unicode cmap */ + + slot = face->glyph; + + /* set up matrix */ + matrix.xx = (FT_Fixed)( cos( angle ) * 0x10000L ); + matrix.xy = (FT_Fixed)(-sin( angle ) * 0x10000L ); + matrix.yx = (FT_Fixed)( sin( angle ) * 0x10000L ); + matrix.yy = (FT_Fixed)( cos( angle ) * 0x10000L ); + + /* the pen position in 26.6 cartesian space coordinates; */ + /* start at (300,200) relative to the upper left corner */ + pen.x = 300 * 64; + pen.y = ( target_height - 200 ) * 64; + + for ( n = 0; n < num_chars; n++ ) + { + /* set transformation */ + FT_Set_Transform( face, &matrix, &pen ); + + /* load glyph image into the slot (erase previous one) */ + error = FT_Load_Char( face, text[n], FT_LOAD_RENDER); + if (error) { + exit(EXIT_FAILURE); + } + + /* now, draw to our target surface (convert position) */ + draw_bitmap( &slot->bitmap, + slot->bitmap_left, + target_height - slot->bitmap_top ); + + /* increment pen position */ + pen.x += slot->advance.x; + pen.y += slot->advance.y; + } + + FT_Done_Face ( face ); + FT_Done_FreeType( library ); + + return EXIT_SUCCESS; +} + +/* EOF */ diff --git a/recipes/freetype/meson/test_package_module/CMakeLists.txt b/recipes/freetype/meson/test_package_module/CMakeLists.txt new file mode 100644 index 0000000000000..a6125556234ed --- /dev/null +++ b/recipes/freetype/meson/test_package_module/CMakeLists.txt @@ -0,0 +1,23 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) + +find_package(Freetype REQUIRED MODULE) + +# 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() + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE Freetype::Freetype) diff --git a/recipes/freetype/meson/test_package_module/conanfile.py b/recipes/freetype/meson/test_package_module/conanfile.py new file mode 100644 index 0000000000000..ac4c13a76a824 --- /dev/null +++ b/recipes/freetype/meson/test_package_module/conanfile.py @@ -0,0 +1,29 @@ +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" + license = "OFL-1.1-no-RFN" + short_paths = True + + 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/meson/test_v1_package/CMakeLists.txt b/recipes/freetype/meson/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..b21cc49efde95 --- /dev/null +++ b/recipes/freetype/meson/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/freetype/meson/test_v1_package/conanfile.py b/recipes/freetype/meson/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..fba25cb7ecbbc --- /dev/null +++ b/recipes/freetype/meson/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" + license = "OFL-1.1-no-RFN" + + def build(self): + 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/meson/test_v1_package_module/CMakeLists.txt b/recipes/freetype/meson/test_v1_package_module/CMakeLists.txt new file mode 100644 index 0000000000000..8d5fc09fe6811 --- /dev/null +++ b/recipes/freetype/meson/test_v1_package_module/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_module + ${CMAKE_CURRENT_BINARY_DIR}/test_package_module) diff --git a/recipes/freetype/meson/test_v1_package_module/conanfile.py b/recipes/freetype/meson/test_v1_package_module/conanfile.py new file mode 100644 index 0000000000000..1ddffa6741246 --- /dev/null +++ b/recipes/freetype/meson/test_v1_package_module/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" + license = "OFL-1.1-no-RFN" + + def build(self): + 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/freexl/all/conandata.yml b/recipes/freexl/all/conandata.yml index cad6629b77bd2..9d309ba6c3c0d 100644 --- a/recipes/freexl/all/conandata.yml +++ b/recipes/freexl/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.0.0": + url: "http://www.gaia-gis.it/gaia-sins/freexl-sources/freexl-2.0.0.tar.gz" + sha256: "176705f1de58ab7c1eebbf5c6de46ab76fcd8b856508dbd28f5648f7c6e1a7f0" "1.0.6": url: "http://www.gaia-gis.it/gaia-sins/freexl-sources/freexl-1.0.6.tar.gz" sha256: "3de8b57a3d130cb2881ea52d3aa9ce1feedb1b57b7daa4eb37f751404f90fc22" @@ -6,11 +9,10 @@ sources: url: "http://www.gaia-gis.it/gaia-sins/freexl-sources/freexl-1.0.5.tar.gz" sha256: "3dc9b150d218b0e280a3d6a41d93c1e45f4d7155829d75f1e5bf3e0b0de6750d" patches: + "2.0.0": + - patch_file: "patches/fix-nmake-2.0.0.patch" "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..7cbab97fd7d07 100644 --- a/recipes/freexl/all/conanfile.py +++ b/recipes/freexl/all/conanfile.py @@ -1,9 +1,15 @@ -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 +from conan.tools.scm import Version import os -import shutil -required_conan_version = ">=1.36.0" +required_conan_version = ">=1.55.0" class FreexlConan(ConanFile): @@ -11,10 +17,10 @@ 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") - homepage = "https://www.gaia-gis.it/fossil/freexl/index" url = "https://github.com/conan-io/conan-center-index" - + homepage = "https://www.gaia-gis.it/fossil/freexl/index" + topics = ("excel", "xls") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -25,25 +31,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 +44,80 @@ 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") + if Version(self.version) >= "2.0.0": + self.requires("expat/[>=2.6.2 <3]") + self.requires("minizip/1.2.13") 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/patches/fix-nmake-2.0.0.patch b/recipes/freexl/all/patches/fix-nmake-2.0.0.patch new file mode 100644 index 0000000000000..80cf36670487d --- /dev/null +++ b/recipes/freexl/all/patches/fix-nmake-2.0.0.patch @@ -0,0 +1,42 @@ +diff --git a/a/makefile.vc b/b/makefile.vc +index 5cd5d05..f7505ea 100644 +--- a/a/makefile.vc ++++ b/b/makefile.vc +@@ -11,7 +11,7 @@ ODS = freexl_ods.obj + LIBOBJ = $(CORE) $(XLSX) $(ODS) + FREEXL_DLL = freexl$(VERSION).dll + +-CFLAGS = /nologo -I. -Iheaders -IC:\OSGeo4W\include $(OPTFLAGS) ++CFLAGS = /nologo -I. -Iheaders $(OPTFLAGS) + + default: all + +@@ -33,12 +33,8 @@ freexl.lib: $(LIBOBJ) + $(FREEXL_DLL): freexl_i.lib + + freexl_i.lib: $(LIBOBJ) +- link /debug /dll /out:$(FREEXL_DLL) \ +- /implib:freexl_i.lib $(LIBOBJ) \ +- C:\OSGeo4W\lib\iconv.lib \ +- C:\OSGeo4W\lib\libexpat.lib \ +- C:\OSGeo4W\lib\libminizip.lib \ +- C:\OSGeo4w\lib\zlib.lib ++ link /dll /out:$(FREEXL_DLL) \ ++ /implib:freexl_i.lib $(LIBOBJ) + if exist $(FREEXL_DLL).manifest mt -manifest \ + $(FREEXL_DLL).manifest -outputresource:$(FREEXL_DLL);2 + +diff --git a/a/nmake.opt b/b/nmake.opt +index 35f9242..15abafe 100644 +--- a/a/nmake.opt ++++ b/b/nmake.opt +@@ -2,8 +2,7 @@ + INSTDIR=C:\OSGeo4W + + # Uncomment the first for an optimized build, or the second for debug. +-OPTFLAGS= /nologo /Ox /fp:precise /W3 /MD /D_CRT_SECURE_NO_WARNINGS \ +- /DDLL_EXPORT ++OPTFLAGS= /nologo /fp:precise /W3 /D_CRT_SECURE_NO_WARNINGS $(FREEXL_EXPORT) + #OPTFLAGS= /nologo /Zi /MD /Fdfreexl.pdb /DDLL_EXPORT + + # Set the version number for the DLL. Normally we leave this blank since 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..0a6bc68712d90 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,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - 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) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/freexl/all/test_package/simple2003_21.xls b/recipes/freexl/all/test_package/simple2003_21.xls deleted file mode 100644 index 20e5d1313430a..0000000000000 Binary files a/recipes/freexl/all/test_package/simple2003_21.xls and /dev/null differ diff --git a/recipes/freexl/all/test_package/test_package.c b/recipes/freexl/all/test_package/test_package.c index 8c12ee6b6e6ed..17c8e6a9e25c3 100644 --- a/recipes/freexl/all/test_package/test_package.c +++ b/recipes/freexl/all/test_package/test_package.c @@ -1,317 +1,11 @@ -#include - -#include #include -#include - -int main(int argc, char **argv) { - if (argc < 2) { - fprintf(stderr, "Need at least one argument\n"); - return -1; - } - - const void *handle; - int ret; - unsigned int info; - const char *worksheet_name; - unsigned short active_idx; - unsigned int num_rows; - unsigned short num_columns; - FreeXL_CellValue cell_value; - - ret = freexl_open(argv[1], &handle); - if (ret != FREEXL_OK) { - fprintf(stderr, "OPEN ERROR: %d\n", ret); - return -1; - } - - ret = freexl_get_info(handle, FREEXL_CFBF_VERSION, &info); - if (ret != FREEXL_OK) { - fprintf(stderr, "GET_INFO ERROR for CFBF version: %d\n", ret); - return -3; - } - if (info != FREEXL_UNKNOWN) { - fprintf(stderr, "Unexpected CFBF_VERSION: %d\n", info); - return -4; - } - - ret = freexl_get_info(handle, FREEXL_CFBF_SECTOR_SIZE, &info); - if (ret != FREEXL_OK) { - fprintf(stderr, "GET_INFO ERROR for sector size: %d\n", ret); - return -5; - } - if (info != FREEXL_UNKNOWN) { - fprintf(stderr, "Unexpected CFBF_SECTOR_SIZE: %d\n", info); - return -6; - } - - ret = freexl_get_info(handle, FREEXL_CFBF_FAT_COUNT, &info); - if (ret != FREEXL_OK) { - fprintf(stderr, "GET_INFO ERROR for fat count: %d\n", ret); - return -7; - } - if (info != 0) { - fprintf(stderr, "Unexpected CFBF_FAT_COUNT: %d\n", info); - return -8; - } - - ret = freexl_get_info(handle, FREEXL_BIFF_VERSION, &info); - if (ret != FREEXL_OK) { - fprintf(stderr, "GET_INFO ERROR for BIFF version: %d\n", ret); - return -9; - } - if (info != FREEXL_BIFF_VER_2) { - fprintf(stderr, "Unexpected BIFF version: %d\n", info); - return -10; - } - - ret = freexl_get_info(handle, FREEXL_BIFF_MAX_RECSIZE, &info); - if (ret != FREEXL_OK) { - fprintf(stderr, "GET_INFO ERROR for BIFF record size: %d\n", ret); - return -11; - } - if (info != FREEXL_UNKNOWN) { - fprintf(stderr, "Unexpected BIFF max record size: %d\n", info); - return -12; - } - - ret = freexl_get_info(handle, FREEXL_BIFF_DATEMODE, &info); - if (ret != FREEXL_OK) { - fprintf(stderr, "GET_INFO ERROR for BIFF date mode: %d\n", ret); - return -13; - } - if (info != FREEXL_BIFF_DATEMODE_1900) { - fprintf(stderr, "Unexpected BIFF date mode: %d\n", info); - return -14; - } - - ret = freexl_get_info(handle, FREEXL_BIFF_PASSWORD, &info); - if (ret != FREEXL_OK) { - fprintf(stderr, "GET_INFO ERROR for BIFF password mode: %d\n", ret); - return -15; - } - if (info != FREEXL_BIFF_PLAIN) { - fprintf(stderr, "Unexpected BIFF password mode: %d\n", info); - return -16; - } - - ret = freexl_get_info(handle, FREEXL_BIFF_CODEPAGE, &info); - if (ret != FREEXL_OK) { - fprintf(stderr, "GET_INFO ERROR for BIFF codepage: %d\n", ret); - return -17; - } - if (info != FREEXL_BIFF_CP1252) { - fprintf(stderr, "Unexpected BIFF codepage: %d\n", info); - return -18; - } - - ret = freexl_get_info(handle, FREEXL_BIFF_SHEET_COUNT, &info); - if (ret != FREEXL_OK) { - fprintf(stderr, "GET_INFO ERROR for BIFF worksheet count: %d\n", ret); - return -19; - } - if (info != 1) { - fprintf(stderr, "Unexpected BIFF worksheet count: %d\n", info); - return -20; - } - - ret = freexl_get_info(handle, FREEXL_BIFF_FORMAT_COUNT, &info); - if (ret != FREEXL_OK) { - fprintf(stderr, "GET_INFO ERROR for BIFF format count: %d\n", ret); - return -21; - } - if (info != 10) { - fprintf(stderr, "Unexpected BIFF format count: %d\n", info); - return -22; - } - - ret = freexl_get_info(handle, FREEXL_BIFF_XF_COUNT, &info); - if (ret != FREEXL_OK) { - fprintf(stderr, "GET_INFO ERROR for BIFF extended format count: %d\n", ret); - return -23; - } - if (info != 6) { - fprintf(stderr, "Unexpected BIFF extended format count: %d\n", info); - return -24; - } - - /* We only have one worksheet, zero index */ - ret = freexl_get_worksheet_name(handle, 0, &worksheet_name); - if (ret != FREEXL_OK) { - fprintf(stderr, "Error getting worksheet name: %d\n", ret); - return -25; - } - if (strcmp(worksheet_name, "Worksheet") != 0) { - fprintf(stderr, "Unexpected worksheet name: %s\n", worksheet_name); - return -26; - } - - ret = freexl_select_active_worksheet(handle, 0); - if (ret != FREEXL_OK) { - fprintf(stderr, "Error setting active worksheet: %d\n", ret); - return -27; - } - - ret = freexl_get_active_worksheet(handle, &active_idx); - if (ret != FREEXL_OK) { - fprintf(stderr, "Error getting active worksheet: %d\n", ret); - return -28; - } - if (active_idx != 0) { - fprintf(stderr, "Unexpected active sheet: %d\n", info); - return -29; - } - - ret = freexl_worksheet_dimensions(handle, &num_rows, &num_columns); - if (ret != FREEXL_OK) { - fprintf(stderr, "Error getting worksheet dimensions: %d\n", ret); - return -30; - } - if ((num_rows != 4) || (num_columns != 6)) { - fprintf(stderr, "Unexpected active sheet dimensions: %u x %u\n", - num_rows, num_columns); - return -31; - } - - ret = freexl_get_cell_value(handle, 0, 0, &cell_value); - if (ret != FREEXL_OK) { - fprintf(stderr, "Error getting cell value (0,0): %d\n", ret); - return -32; - } - if (cell_value.type != FREEXL_CELL_TEXT) { - fprintf(stderr, "Unexpected cell (0,0) type: %u\n", cell_value.type); - return -33; - } - if (strcmp(cell_value.value.text_value, "Column 1") != 0) { - fprintf(stderr, "Unexpected cell (0,0) value: %s\n", cell_value.value.text_value); - return -34; - } - - ret = freexl_get_cell_value(handle, 3, 0, &cell_value); - if (ret != FREEXL_OK) { - fprintf(stderr, "Error getting cell value (3,0): %d\n", ret); - return -35; - } - if (cell_value.type != FREEXL_CELL_DOUBLE) { - fprintf(stderr, "Unexpected cell (3,0) type: %u\n", cell_value.type); - return -36; - } - if (cell_value.value.double_value != 3.14) { - fprintf(stderr, "Unexpected cell (3,0) value: %g\n", cell_value.value.double_value); - return -37; - } - - ret = freexl_get_cell_value(handle, 3, 1, &cell_value); - if (ret != FREEXL_OK) { - fprintf(stderr, "Error getting cell value (3,1): %d\n", ret); - return -38; - } - if (cell_value.type != FREEXL_CELL_DOUBLE) { - fprintf(stderr, "Unexpected cell (3,1) type: %u\n", cell_value.type); - return -39; - } - if (cell_value.value.double_value != -56.3089) { - fprintf(stderr, "Unexpected cell (3,1) value: %g\n", cell_value.value.double_value); - return -40; - } - - ret = freexl_get_cell_value(handle, 3, 2, &cell_value); - if (ret != FREEXL_OK) { - fprintf(stderr, "Error getting cell value (3,2): %d\n", ret); - return -41; - } - if (cell_value.type != FREEXL_CELL_DOUBLE) { - fprintf(stderr, "Unexpected cell (3,2) type: %u\n", cell_value.type); - return -42; - } - if (cell_value.value.double_value != 0.67) { - fprintf(stderr, "Unexpected cell (3,2) value: %g\n", cell_value.value.double_value); - return -43; - } - - ret = freexl_get_cell_value(handle, 3, 3, &cell_value); - if (ret != FREEXL_OK) { - fprintf(stderr, "Error getting cell value (3,3): %d\n", ret); - return -44; - } - if (cell_value.type != FREEXL_CELL_DATE) { - fprintf(stderr, "Unexpected cell (3,3) type: %u\n", cell_value.type); - return -45; - } - if (strcmp(cell_value.value.text_value, "1967-10-01") != 0) { - fprintf(stderr, "Unexpected cell (3,3) value: %s\n", cell_value.value.text_value); - return -46; - } - - ret = freexl_get_cell_value(handle, 3, 4, &cell_value); - if (ret != FREEXL_OK) { - fprintf(stderr, "Error getting cell value (3,4): %d\n", ret); - return -47; - } - if (cell_value.type != FREEXL_CELL_INT) { - fprintf(stderr, "Unexpected cell (3,4) type: %u\n", cell_value.type); - return -48; - } - if (cell_value.value.int_value != 4) { - fprintf(stderr, "Unexpected cell (3,4) value: %d\n", cell_value.value.int_value); - return -49; - } - - ret = freexl_get_cell_value(handle, 3, 5, &cell_value); - if (ret != FREEXL_OK) { - fprintf(stderr, "Error getting cell value (3,5): %d\n", ret); - return -50; - } - if (cell_value.type != FREEXL_CELL_INT) { - fprintf(stderr, "Unexpected cell (3,5) type: %u\n", cell_value.type); - return -51; - } - if (cell_value.value.int_value != 237) { - fprintf(stderr, "Unexpected cell (3,5) value: %d\n", cell_value.value.int_value); - return -52; - } - - ret = freexl_get_cell_value(handle, 1, 5, &cell_value); - if (ret != FREEXL_OK) { - fprintf(stderr, "Error getting cell value (1,5): %d\n", ret); - return -53; - } - if (cell_value.type != FREEXL_CELL_TIME) { - fprintf(stderr, "Unexpected cell (1,5) type: %u\n", cell_value.type); - return -54; - } - if (strcmp(cell_value.value.text_value, "23:34:04") != 0) { - fprintf(stderr, "Unexpected cell (1,5) value: %s\n", cell_value.value.text_value); - return -55; - } +#include "freexl.h" - /* error cases */ - ret = freexl_get_cell_value(handle, 7, 3, &cell_value); - if (ret != FREEXL_ILLEGAL_CELL_ROW_COL) { - fprintf(stderr, "Unexpected result for (7,3): %d\n", ret); - return -56; - } - ret = freexl_get_cell_value(handle, 2, 99, &cell_value); - if (ret != FREEXL_ILLEGAL_CELL_ROW_COL) { - fprintf(stderr, "Unexpected result for (2,99): %d\n", ret); - return -57; - } - ret = freexl_get_cell_value(handle, 4, 2, &cell_value); - if (ret != FREEXL_ILLEGAL_CELL_ROW_COL) { - fprintf(stderr, "Unexpected result for (4,2): %d\n", ret); - return -58; - } - ret = freexl_get_cell_value(handle, 3, 6, &cell_value); - if (ret != FREEXL_ILLEGAL_CELL_ROW_COL) { - fprintf(stderr, "Unexpected result for (3,6): %d\n", ret); - return -59; - } - ret = freexl_close(handle); - if (ret != FREEXL_OK) { - fprintf(stderr, "CLOSE ERROR: %d\n", ret); - return -2; - } +int main() { + const void *handle; + int ret; + ret = freexl_open("", &handle); + freexl_close(handle); - return 0; } 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..38f4483872d47 --- /dev/null +++ b/recipes/freexl/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/freexl/config.yml b/recipes/freexl/config.yml index 06269eb399e91..e78a14da43e74 100644 --- a/recipes/freexl/config.yml +++ b/recipes/freexl/config.yml @@ -1,4 +1,6 @@ versions: + "2.0.0": + folder: all "1.0.6": folder: all "1.0.5": diff --git a/recipes/fribidi/all/conandata.yml b/recipes/fribidi/all/conandata.yml index 08937af14f728..281ca46617df0 100644 --- a/recipes/fribidi/all/conandata.yml +++ b/recipes/fribidi/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.0.13": + url: "https://github.com/fribidi/fribidi/archive/v1.0.13.tar.gz" + sha256: "f24e8e381bcf76533ae56bd776196f3a0369ec28e9c0fdb6edd163277e008314" "1.0.12": url: "https://github.com/fribidi/fribidi/releases/download/v1.0.12/fribidi-1.0.12.tar.xz" sha256: "0cd233f97fc8c67bb3ac27ce8440def5d3ffacf516765b91c2cc654498293495" diff --git a/recipes/fribidi/all/conanfile.py b/recipes/fribidi/all/conanfile.py index b303aebbbf036..4c363828a67c8 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.2.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 = 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/fribidi/config.yml b/recipes/fribidi/config.yml index 1a912a9e71c6e..88a69bbd50016 100644 --- a/recipes/fribidi/config.yml +++ b/recipes/fribidi/config.yml @@ -1,4 +1,6 @@ versions: + "1.0.13": + folder: all "1.0.12": folder: all "1.0.10": diff --git a/recipes/frozen/all/conandata.yml b/recipes/frozen/all/conandata.yml index 4d9b977925cb2..cf0083d308f87 100644 --- a/recipes/frozen/all/conandata.yml +++ b/recipes/frozen/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.2.0": + url: "https://github.com/serge-sans-paille/frozen/archive/1.2.0.tar.gz" + sha256: "ed8339c017d7c5fe019ac2c642477f435278f0dc643c1d69d3f3b1e95915e823" "1.1.1": url: "https://github.com/serge-sans-paille/frozen/archive/1.1.1.tar.gz" sha256: "f7c7075750e8fceeac081e9ef01944f221b36d9725beac8681cbd2838d26be45" diff --git a/recipes/frozen/all/conanfile.py b/recipes/frozen/all/conanfile.py index e1444fa2a4c65..c27fe687bd194 100644 --- a/recipes/frozen/all/conanfile.py +++ b/recipes/frozen/all/conanfile.py @@ -16,6 +16,7 @@ class FrozenConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" license = "Apache-2.0" topics = ("gperf", "constexpr", "header-only") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -49,8 +50,7 @@ def validate(self): ) 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 diff --git a/recipes/frozen/all/test_v1_package/CMakeLists.txt b/recipes/frozen/all/test_v1_package/CMakeLists.txt index ed695ba529434..0d20897301b68 100644 --- a/recipes/frozen/all/test_v1_package/CMakeLists.txt +++ b/recipes/frozen/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(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) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/frozen/config.yml b/recipes/frozen/config.yml index 9234b604d8ed1..188555eba6e58 100644 --- a/recipes/frozen/config.yml +++ b/recipes/frozen/config.yml @@ -1,4 +1,6 @@ versions: + "1.2.0": + folder: all "1.1.1": folder: all "1.0.1": diff --git a/recipes/frugally-deep/all/conandata.yml b/recipes/frugally-deep/all/conandata.yml index 5db89f0f8f389..8e2ab1f676fe6 100644 --- a/recipes/frugally-deep/all/conandata.yml +++ b/recipes/frugally-deep/all/conandata.yml @@ -1,16 +1,13 @@ sources: - "0.15.19-p0": - url: "https://github.com/Dobiasd/frugally-deep/archive/v0.15.19-p0.tar.gz" - sha256: "acaba428ae19ef8d57a53b3767373cd96770c190dd57909e52d2759be89ac942" - "0.15.18-p0": - url: "https://github.com/Dobiasd/frugally-deep/archive/v0.15.18-p0.tar.gz" - sha256: "b721bd7b2fa842a1a10f00008e079c057fab7a5cfc4c394d64238ee59ad7e189" - "0.15.16-p0": - url: "https://github.com/Dobiasd/frugally-deep/archive/v0.15.16-p0.tar.gz" - sha256: "778b8cf0da847239a2ad21c611331b231831c6c175154c68ca30dd87489336a5" - "0.15.13-p0": - url: "https://github.com/Dobiasd/frugally-deep/archive/v0.15.13-p0.tar.gz" - sha256: "ca18c7b8dc0df3a36dba3c2578df35592e61ff51e5bbaa1c1ed3e6c529e14075" - "0.15.1-p0": - url: "https://github.com/Dobiasd/frugally-deep/archive/v0.15.1-p0.tar.gz" - sha256: "ab15cb540a8ddeffa56cd8235bfdf709f5d6b3b2543d9ec83658c5d9bad02f18" + "0.16.0": + url: "https://github.com/Dobiasd/frugally-deep/archive/v0.16.0.tar.gz" + sha256: "5ffe8dddb43a645094b2ca1d48e4ee78e685fbef3c89f08cea8425a39dad9865" + "0.15.31": + url: "https://github.com/Dobiasd/frugally-deep/archive/v0.15.31.tar.gz" + sha256: "49bf5e30ad2d33e464433afbc8b6fe8536fc959474004a1ce2ac03d7c54bc8ba" + "0.15.30": + url: "https://github.com/Dobiasd/frugally-deep/archive/v0.15.30.tar.gz" + sha256: "8932f7b42612598402269a54f957af09084dc2cb812d32887d991d6e45b280fb" + "0.15.29": + url: "https://github.com/Dobiasd/frugally-deep/archive/v0.15.29.tar.gz" + sha256: "032cd525d4a7b9b3ebe28fd5e3984ac3e569da496f65d52c81030aabd9d0c52e" diff --git a/recipes/frugally-deep/all/conanfile.py b/recipes/frugally-deep/all/conanfile.py index 2588afa778f5b..f2070b97639e6 100644 --- a/recipes/frugally-deep/all/conanfile.py +++ b/recipes/frugally-deep/all/conanfile.py @@ -1,23 +1,30 @@ -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.52.0" class FrugallyDeepConan(ConanFile): name = "frugally-deep" description = "Use Keras models in C++ with ease." license = "MIT" - topics = ("keras", "tensorflow") - homepage = "https://github.com/Dobiasd/frugally-deep" url = "https://github.com/conan-io/conan-center-index" - settings = "os", "compiler", "build_type", "arch" + homepage = "https://github.com/Dobiasd/frugally-deep" + topics = ("keras", "tensorflow", "header-only") + + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 14 @property def _compilers_minimum_version(self): @@ -27,45 +34,44 @@ def _compilers_minimum_version(self): "clang": "3.7", "apple-clang": "9", } + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): self.requires("eigen/3.4.0") - self.requires("functionalplus/0.2.18-p0") - self.requires("nlohmann_json/3.10.5") + self.requires("functionalplus/0.2.24") + self.requires("nlohmann_json/3.11.3") + + def package_id(self): + self.info.clear() 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] - + 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("frugally-deep 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("frugally-deep requires C++14, which your compiler does not support.") - - def package_id(self): - self.info.header_only() + 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 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", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, "*", 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", "frugally-deep") self.cpp_info.set_property("cmake_target_name", "frugally-deep::fdeep") # TODO: back to global scope in conan v2 once cmake_find_package* generators removed - self.cpp_info.components["fdeep"].requires = ["eigen::eigen", - "functionalplus::functionalplus", - "nlohmann_json::nlohmann_json"] + self.cpp_info.components["fdeep"].requires = [ + "eigen::eigen", + "functionalplus::functionalplus", + "nlohmann_json::nlohmann_json", + ] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["fdeep"].system_libs = ["pthread"] diff --git a/recipes/frugally-deep/all/test_package/CMakeLists.txt b/recipes/frugally-deep/all/test_package/CMakeLists.txt index a8c615c1776b8..b64a8f93f961f 100644 --- a/recipes/frugally-deep/all/test_package/CMakeLists.txt +++ b/recipes/frugally-deep/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.15) +project(test_package LANGUAGES CXX) find_package(frugally-deep REQUIRED CONFIG) diff --git a/recipes/frugally-deep/all/test_package/conanfile.py b/recipes/frugally-deep/all/test_package/conanfile.py index 38f4483872d47..ef5d7042163ec 100644 --- a/recipes/frugally-deep/all/test_package/conanfile.py +++ b/recipes/frugally-deep/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/frugally-deep/all/test_v1_package/CMakeLists.txt b/recipes/frugally-deep/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/frugally-deep/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/frugally-deep/all/test_v1_package/conanfile.py b/recipes/frugally-deep/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/frugally-deep/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/frugally-deep/config.yml b/recipes/frugally-deep/config.yml index 5b45f70613267..4b946ca53d49d 100644 --- a/recipes/frugally-deep/config.yml +++ b/recipes/frugally-deep/config.yml @@ -1,11 +1,9 @@ versions: - "0.15.19-p0": + "0.16.0": folder: all - "0.15.18-p0": + "0.15.31": folder: all - "0.15.16-p0": + "0.15.30": folder: all - "0.15.13-p0": - folder: all - "0.15.1-p0": + "0.15.29": folder: all diff --git a/recipes/frugen/all/conandata.yml b/recipes/frugen/all/conandata.yml new file mode 100644 index 0000000000000..cc18fdc792d99 --- /dev/null +++ b/recipes/frugen/all/conandata.yml @@ -0,0 +1,15 @@ +sources: + "2.0": + url: "https://codeberg.org/IPMITool/frugen/archive/v2.0.tar.gz" + sha256: "cb5c59cf3593b162b9faedf1e5ae3b1f7e32fb732a61ada6baf7de69632bff77" +patches: + "2.0": + - patch_file: "patches/0001-cmake-use-find_package-to-locate-json-c-library.patch" + patch_description: "Upstream prefer to use pkg_check_modules instead of find_package to keep capatibility with old versions" + patch_type: "conan" + - patch_file: "patches/0002-libfru-fix-build-on-MacOS.patch" + patch_description: "Fixes build on MacOS" + patch_type: "portability" + - patch_file: "patches/0003-let-conan-choose-optimization-flags.patch" + patch_description: "Let Conan choose optimization flags" + patch_type: "conan" diff --git a/recipes/frugen/all/conanfile.py b/recipes/frugen/all/conanfile.py new file mode 100644 index 0000000000000..17b6eeec90bab --- /dev/null +++ b/recipes/frugen/all/conanfile.py @@ -0,0 +1,83 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import get, rmdir, apply_conandata_patches, export_conandata_patches +from conan.tools.microsoft import is_msvc +import os + +required_conan_version = ">=2.1" + +class FrugenConan(ConanFile): + name = "frugen" + description = "IPMI FRU Information generator / editor tool and library" + license = ("Apache-2.0", "GPL-2.0-or-later") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://codeberg.org/IPMITool/frugen" + topics = ("hardware", "ipmi", "fru") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_json": [True, False] + } + default_options = { + "shared": False, + "fPIC": True, + "with_json": True + } + implements = ["auto_shared_fpic"] + + def validate(self): + if is_msvc(self): + raise ConanInvalidConfiguration("MSVC not supported by the library") + + def export_sources(self): + export_conandata_patches(self) + + 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_json: + self.requires("json-c/0.18") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + apply_conandata_patches(self) + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["BUILD_SHARED_LIB"] = self.options.shared + tc.cache_variables["ENABLE_JSON"] = self.options.with_json + if self.settings.os != "Macos": + tc.cache_variables["BINARY_STATIC"] = not self.options.shared + tc.cache_variables["BINARY_32BIT"] = False + tc.cache_variables["DEBUG_OUTPUT"] = False + # Dont let CMake find doxygen and try to build documentation + tc.cache_variables["CMAKE_DISABLE_FIND_PACKAGE_Doxygen"] = True + tc.generate() + deps = CMakeDeps(self) + deps.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + cmake = CMake(self) + cmake.install() + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + + def package_info(self): + if self.options.shared: + self.cpp_info.components["fru-shared"].libs = ["fru"] + else: + self.cpp_info.components["fru-static"].libs = ["fru"] diff --git a/recipes/frugen/all/patches/0001-cmake-use-find_package-to-locate-json-c-library.patch b/recipes/frugen/all/patches/0001-cmake-use-find_package-to-locate-json-c-library.patch new file mode 100644 index 0000000000000..a2f037fa6302d --- /dev/null +++ b/recipes/frugen/all/patches/0001-cmake-use-find_package-to-locate-json-c-library.patch @@ -0,0 +1,38 @@ +From 00ff4c451deaa70da84fbac8d810d94ef7d59ab9 Mon Sep 17 00:00:00 2001 +From: "Andrei K." +Date: Sun, 17 Nov 2024 11:32:43 +0400 +Subject: [PATCH] cmake: use find_package to locate json-c library + +Signed-off-by: Andrei K. +--- + CMakeLists.txt | 13 +++---------- + 1 file changed, 3 insertions(+), 10 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 086b827..763c0b3 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -115,17 +115,10 @@ else(BINARY_STATIC OR NOT BUILD_SHARED_LIB) + endif(BINARY_STATIC OR NOT BUILD_SHARED_LIB) + + if(ENABLE_JSON) +- find_package(PkgConfig) +- pkg_check_modules(json-c REQUIRED json-c) +- ++ find_package(json-c CONFIG REQUIRED) ++ message (STATUS "Using JSON Library found at " ${json-c_DIR}) + add_definitions(-D__HAS_JSON__) +- if(JSON_STATIC OR BINARY_STATIC) +- target_link_libraries(frugen ${json-c_STATIC_LIBRARIES}) +- else() +- target_link_libraries(frugen ${json-c_LIBRARIES}) +- endif() +- +- target_include_directories(frugen PRIVATE ${json-c_INCLUDE_DIRS}) ++ target_link_libraries(frugen json-c::json-c) + else(ENABLE_JSON) + message (WARNING "JSON library support *disabled*!") + endif(ENABLE_JSON) +-- +2.45.2 + diff --git a/recipes/frugen/all/patches/0002-libfru-fix-build-on-MacOS.patch b/recipes/frugen/all/patches/0002-libfru-fix-build-on-MacOS.patch new file mode 100644 index 0000000000000..39e84842b9ae0 --- /dev/null +++ b/recipes/frugen/all/patches/0002-libfru-fix-build-on-MacOS.patch @@ -0,0 +1,87 @@ +From b31cf1c79730d5f288cd10361a05eb6b01d0698e Mon Sep 17 00:00:00 2001 +From: "Andrei K." +Date: Sun, 17 Nov 2024 17:29:35 +0400 +Subject: [PATCH] libfru: fix build on MacOS + +* remove explicit include of : it should be included in +* redefine endiangs manipulation functions +* rename uuid_t structure since there is same named type defined on + MacOS +* add type casting for print off_t variable - there is no portable way + to pass off_t to printf + +Signed-off-by: Andrei K. +--- + fru.c | 21 +++++++++++++++++---- + frugen.c | 2 +- + 2 files changed, 18 insertions(+), 5 deletions(-) + +diff --git a/fru.c b/fru.c +index 01aaef9..c0f79d9 100644 +--- a/fru.c ++++ b/fru.c +@@ -26,7 +26,20 @@ + #include "fru-errno.h" + + #define _BSD_SOURCE +-#include ++ ++#if defined(__APPLE__) ++#include ++ ++#define htobe16(x) OSSwapHostToBigInt16(x) ++#define htole16(x) OSSwapHostToLittleInt16(x) ++#define be16toh(x) OSSwapBigToHostInt16(x) ++#define le16toh(x) OSSwapLittleToHostInt16(x) ++ ++#define htobe32(x) OSSwapHostToBigInt32(x) ++#define htole32(x) OSSwapHostToLittleInt32(x) ++#define be32toh(x) OSSwapBigToHostInt32(x) ++#define le32toh(x) OSSwapLittleToHostInt32(x) ++#endif + + #ifdef __STANDALONE__ + #include +@@ -1354,7 +1367,7 @@ typedef union __attribute__((packed)) { + uint8_t clock_seq_low; + uint8_t node[6]; + }; +-} uuid_t; ++} fru_uuid_t; + #pragma pack(pop) + + static bool is_mr_rec_valid(fru_mr_rec_t *rec, size_t limit, fru_flags_t flags) +@@ -1476,7 +1489,7 @@ int fru_mr_mgmt_str2rec(fru_mr_rec_t **rec, + int fru_mr_uuid2rec(fru_mr_rec_t **rec, const char *str) + { + size_t len; +- uuid_t uuid; ++ fru_uuid_t uuid; + + if (!str) return -EFAULT; + +@@ -1531,7 +1544,7 @@ int fru_mr_uuid2rec(fru_mr_rec_t **rec, const char *str) + int fru_mr_rec2uuid(char **str, fru_mr_mgmt_rec_t *mgmt, fru_flags_t flags) + { + size_t i; +- uuid_t uuid; ++ fru_uuid_t uuid; + + if (!mgmt || !str) { + return -EFAULT; +diff --git a/frugen.c b/frugen.c +index b0aa76f..36a0c78 100644 +--- a/frugen.c ++++ b/frugen.c +@@ -314,7 +314,7 @@ void load_from_binary_file(const char *fname, + fatal("Cannot allocate buffer"); + } + +- debug(2, "Reading the template file of size %lu...", statbuf.st_size); ++ debug(2, "Reading the template file of size %ld...", (long) statbuf.st_size); + if (read(fd, buffer, statbuf.st_size) != statbuf.st_size) { + fatal("Cannot read file"); + } +-- +2.45.2 + diff --git a/recipes/frugen/all/patches/0003-let-conan-choose-optimization-flags.patch b/recipes/frugen/all/patches/0003-let-conan-choose-optimization-flags.patch new file mode 100644 index 0000000000000..192ce4029c7b6 --- /dev/null +++ b/recipes/frugen/all/patches/0003-let-conan-choose-optimization-flags.patch @@ -0,0 +1,15 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 763c0b3..0ce32df 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -39,8 +39,8 @@ option(ENABLE_JSON "enable JSON support" ON) + option(JSON_STATIC "link json-c library statically" OFF) + option(DEBUG_OUTPUT "show extra debug output" OFF) + +-set(CMAKE_C_FLAGS_RELEASE "-Os -Wall -Werror -Wfatal-errors") +-set(CMAKE_C_FLAGS_DEBUG "-g3 -O0 -Wall -Werror -Wfatal-errors") ++# set(CMAKE_C_FLAGS_RELEASE "-Os -Wall -Werror -Wfatal-errors") ++# set(CMAKE_C_FLAGS_DEBUG "-g3 -O0 -Wall -Werror -Wfatal-errors") + if(MSVC) + # warning level 4 + add_compile_options(/W4) diff --git a/recipes/frugen/all/test_package/CMakeLists.txt b/recipes/frugen/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..0398769665301 --- /dev/null +++ b/recipes/frugen/all/test_package/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) + +find_package(frugen REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) + +if(BUILD_SHARED_LIB) + target_link_libraries(${PROJECT_NAME} PRIVATE frugen::fru-shared) +else() + target_link_libraries(${PROJECT_NAME} PRIVATE frugen::fru-static) +endif() diff --git a/recipes/frugen/all/test_package/conanfile.py b/recipes/frugen/all/test_package/conanfile.py new file mode 100644 index 0000000000000..48f478322d8cc --- /dev/null +++ b/recipes/frugen/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, CMakeDeps, CMakeToolchain, cmake_layout +import os + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_SHARED_LIB"] = self.dependencies['frugen'].options.shared + tc.generate() + deps = CMakeDeps(self) + deps.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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/frugen/all/test_package/test_package.c b/recipes/frugen/all/test_package/test_package.c new file mode 100644 index 0000000000000..b239825897989 --- /dev/null +++ b/recipes/frugen/all/test_package/test_package.c @@ -0,0 +1,12 @@ +#include +#include "fru.h" + +int main(void) { + uint8_t buffer[64] = {0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF}; + if (!find_fru_header(buffer, sizeof(buffer), FRU_NOFLAGS)) { + printf("Failed to find FRU information block"); + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; +} diff --git a/recipes/frugen/config.yml b/recipes/frugen/config.yml new file mode 100644 index 0000000000000..eab700ad534a3 --- /dev/null +++ b/recipes/frugen/config.yml @@ -0,0 +1,3 @@ +versions: + "2.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..9ad222d0dcc88 100644 --- a/recipes/fruit/all/conanfile.py +++ b/recipes/fruit/all/conanfile.py @@ -1,9 +1,16 @@ -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 +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 +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" class FruitConan(ConanFile): @@ -12,36 +19,41 @@ 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") - settings = "os", "compiler", "build_type", "arch" - options = {"shared": [True, False], - "use_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" - - def build_requirements(self): - if self.options.use_boost: - self.build_requires("boost/1.72.0") + topics = ("injection", "framework") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_boost": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_boost": True, + } + + 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 + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + def requirements(self): + if self.options.with_boost: + self.requires("boost/1.83.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 +66,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 +82,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..63afa5b5e5a82 100644 --- a/recipes/fruit/config.yml +++ b/recipes/fruit/config.yml @@ -1,7 +1,11 @@ versions: - "3.4.0": + "3.7.1": folder: all - "3.5.0": + "3.7.0": folder: all "3.6.0": folder: all + "3.5.0": + folder: all + "3.4.0": + folder: all diff --git a/recipes/fswatch/all/conandata.yml b/recipes/fswatch/all/conandata.yml new file mode 100644 index 0000000000000..a068dc0bee813 --- /dev/null +++ b/recipes/fswatch/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.17.1.cci.20220902": + url: "https://github.com/emcrisostomo/fswatch/archive/ba411e0d0fabcd5cbf0881f1380482e2f5ab9f47.zip" + sha256: "278476f0f2178bf59dac494c07d6a9b9d181eac8d14f37d17eaf8c6d04a3b4d9" diff --git a/recipes/fswatch/all/conanfile.py b/recipes/fswatch/all/conanfile.py new file mode 100644 index 0000000000000..bede6a08e2e05 --- /dev/null +++ b/recipes/fswatch/all/conanfile.py @@ -0,0 +1,94 @@ +import os +from conan import ConanFile +from conan.tools.build import check_min_cppstd, cross_building +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import get, copy, replace_in_file, rmdir +from conan.tools.microsoft import is_msvc +from conan.tools.apple import is_apple_os +from conan.errors import ConanInvalidConfiguration + + +required_conan_version = ">=2.0.9" + + +class WatcherConan(ConanFile): + name = "fswatch" + description = "A cross-platform file change monitor with multiple backends" + license = "GPL-3.0-or-later" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/emcrisostomo/fswatch" + topics = ("watch", "filesystem", "event", "monitor") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True + } + implements = ["auto_shared_fpic"] + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate_build(self): + if is_apple_os(self) and cross_building(self): + # INFO: Cmake error: "VERSION_GREATER_EQUAL" "9.0" Unknown arguments specified + raise ConanInvalidConfiguration(f"{self.ref} does not support cross-building on {self.settings.os}") + + def validate(self): + check_min_cppstd(self, 11) + if is_msvc(self): + # INFO: fswatch requires pthread always and fails CMake when using MSVC + raise ConanInvalidConfiguration(f"{self.ref} does not support MSVC due pthread requirement.") + + def requirements(self): + self.requires("libgettext/0.22") + + def build_requirements(self): + self.tool_requires("gettext/0.22.5") + + def _apply_patches(self): + # Remove hardcoded CXX standard + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "set(CMAKE_CXX_STANDARD 11)", + "") + + # Dont compile tests + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "add_subdirectory(test/src)", + "") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + self._apply_patches() + + 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, "LICENSE*", 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, "share")) + + def package_info(self): + self.cpp_info.libs = ["fswatch"] + self.cpp_info.set_property("cmake_file_name", "fswatch") + self.cpp_info.set_property("cmake_target_name", "fswatch::fswatch") + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs = ["m", "pthread"] + elif self.settings.os == "Macos": + self.cpp_info.frameworks = ["CoreFoundation", "CoreServices"] diff --git a/recipes/fswatch/all/test_package/CMakeLists.txt b/recipes/fswatch/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..a4b5491d33cc7 --- /dev/null +++ b/recipes/fswatch/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(fswatch REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE fswatch::fswatch) diff --git a/recipes/fswatch/all/test_package/conanfile.py b/recipes/fswatch/all/test_package/conanfile.py new file mode 100644 index 0000000000000..cb428fdb55ba5 --- /dev/null +++ b/recipes/fswatch/all/test_package/conanfile.py @@ -0,0 +1,25 @@ +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" + + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/fswatch/all/test_package/test_package.cpp b/recipes/fswatch/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..13d2528437ace --- /dev/null +++ b/recipes/fswatch/all/test_package/test_package.cpp @@ -0,0 +1,9 @@ +#include + +#include + +int main() { + const auto directory_children = fsw::get_directory_children("."); + + return EXIT_SUCCESS; +} diff --git a/recipes/fswatch/config.yml b/recipes/fswatch/config.yml new file mode 100644 index 0000000000000..21934360d84a7 --- /dev/null +++ b/recipes/fswatch/config.yml @@ -0,0 +1,3 @@ +versions: + "1.17.1.cci.20220902": + folder: all diff --git a/recipes/ftjam/all/conandata.yml b/recipes/ftjam/all/conandata.yml index 11d1d96f36866..c3fe801d090c2 100644 --- a/recipes/ftjam/all/conandata.yml +++ b/recipes/ftjam/all/conandata.yml @@ -5,8 +5,5 @@ sources: patches: "2.5.2": - patch_file: "patches/0001-jam-2.5-overflow.patch" - base_path: "source_subfolder" - patch_file: "patches/0002-msvc-mingw-fix-makefile.patch" - base_path: "source_subfolder" - patch_file: "patches/0003-missing-includes.patch" - base_path: "source_subfolder" diff --git a/recipes/ftjam/all/conanfile.py b/recipes/ftjam/all/conanfile.py index 3a86cd556cb4a..9297683794c7e 100644 --- a/recipes/ftjam/all/conanfile.py +++ b/recipes/ftjam/all/conanfile.py @@ -1,127 +1,142 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, 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.build import cross_building +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, chdir, copy, export_conandata_patches, get, load, replace_in_file, save +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, NMakeToolchain + +required_conan_version = ">=1.47.0" class FtjamConan(ConanFile): name = "ftjam" description = "Jam (ftjam) is a small open-source build tool that can be used as a replacement for Make." - topics = ("conan", "ftjam", "build", "make") + license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.freetype.org/jam/" - license = "BSD-3-Clause" - exports_sources = "patches/*" - settings = "os", "arch", "compiler", "build_type" + topics = ("build", "make") - _autotools = None + package_type = "application" + settings = "os", "arch", "compiler", "build_type" @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.libcxx") + self.settings.rm_safe("compiler.cppstd") - def validate(self): - if self.settings.compiler == "Visual Studio": - raise ConanInvalidConfiguration("ftjam doesn't build with Visual Studio yet") - if hasattr(self, "settings_build") and tools.cross_building(self): - raise ConanInvalidConfiguration("ftjam can't be cross-built") + def layout(self): + basic_layout(self, src_folder="src") def package_id(self): del self.info.settings.compiler - @property - def _settings_build(self): - return getattr(self, "settings_build", self.settings) + def validate(self): + if is_msvc(self): + # Build fails with + # NMAKE : fatal error U1077: 'jam0 JamFile' : return code '0xc0000005' + raise ConanInvalidConfiguration("ftjam doesn't build with Visual Studio yet") + + def validate_build(self): + if hasattr(self, "settings_build") and cross_building(self): + raise ConanInvalidConfiguration("ftjam can't be cross-built") 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.2") - if self.settings.os != "Windows": - self.build_requires("bison/3.7.1") + if self._settings_build.os == "Windows": + self.tool_requires("winflexbison/2.5.24") + else: + self.tool_requires("bison/3.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], strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + if is_msvc(self): + tc = NMakeToolchain(self) + tc.generate() + else: + tc = AutotoolsToolchain(self) + tc.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(self._source_subfolder, "jamgram.c"), - "\n#line", "\n//#line") - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - self._autotools.libs = [] - # The configure MUST be run inside this directory - with tools.chdir(os.path.join(self.build_folder, self._source_subfolder, "builds", "unix")): - self._autotools.configure() - return self._autotools + apply_conandata_patches(self) + replace_in_file(self, os.path.join(self.source_folder, "jamgram.c"), "\n#line", "\n//#line") + + def _jam_toolset(self, os, compiler): + if is_msvc(self): + return "VISUALC" + if compiler == "intel-cc": + return "INTELC" + if os == "Windows": + return "MINGW" + return None def build(self): self._patch_sources() - with tools.chdir(self._source_subfolder): + with chdir(self, self.source_folder): if self.settings.os == "Windows": # toolset name of the system building ftjam jam_toolset = self._jam_toolset(self.settings.os, self.settings.compiler) - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - autotools.libs = [] - env = autotools.vars - with tools.environment_append(env): - if self.settings.compiler == "Visual Studio": - with tools.vcvars(self.settings): - self.run("nmake -f builds/win32-visualc.mk JAM_TOOLSET={}".format(jam_toolset)) - else: - with tools.environment_append({"PATH": [os.getcwd()]}): - autotools.make(args=["JAM_TOOLSET={}".format(jam_toolset), "-f", "builds/win32-gcc.mk"]) + if is_msvc(self): + self.run(f"nmake -f builds/win32-visualc.mk JAM_TOOLSET={jam_toolset}") + else: + os.environ["PATH"] += os.pathsep + os.getcwd() + autotools = Autotools(self) + autotools.make(args=[f"JAM_TOOLSET={jam_toolset}", "-f", "builds/win32-gcc.mk"]) else: - autotools = self._configure_autotools() + autotools = Autotools(self) + autotools.configure(build_script_folder=os.path.join(self.source_folder, "builds", "unix")) autotools.make() + def _extract_license(self): + txt = load(self, os.path.join(self.source_folder, "jam.c")) + license_txt = txt[: txt.find("*/") + 3] + save(self, os.path.join(self.package_folder, "licenses", "LICENSE"), license_txt) + def package(self): - txt = tools.load(os.path.join(self._source_subfolder, "jam.c")) - license_txt = txt[:txt.find("*/")+3] - tools.save(os.path.join(self.package_folder, "licenses", "LICENSE"), license_txt) + self._extract_license() if self.settings.os == "Windows": - if self.settings.compiler == "Visual Studio": - pass - else: - self.copy("*.exe", src=os.path.join(self._source_subfolder, "bin.nt"), dst=os.path.join(self.package_folder, "bin")) + if not is_msvc(self): + copy(self, "*.exe", + src=os.path.join(self.source_folder, "bin.nt"), + dst=os.path.join(self.package_folder, "bin")) else: - with tools.chdir(self._source_subfolder): - autotools = self._configure_autotools() - autotools.install() - - def _jam_toolset(self, os, compiler): - if compiler == "Visual Studio": - return "VISUALC" - if compiler == "intel": - return "INTELC" - if os == "Windows": - return "MINGW" - return None + copy(self, "jam", + src=os.path.join(self.source_folder, "bin.unix"), + dst=os.path.join(self.package_folder, "bin")) def package_info(self): - jam_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(jam_path)) - self.env_info.PATH.append(jam_path) + self.cpp_info.frameworkdirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] + self.cpp_info.includedirs = [] + jam_path = os.path.join(self.package_folder, "bin") jam_bin = os.path.join(jam_path, "jam") if self.settings.os == "Windows": jam_bin += ".exe" - self.output.info("Setting JAM environment variable: {}".format(jam_bin)) - self.env_info.JAM = jam_bin + self.buildenv.define_path("JAM", jam_bin) + self.runenv.define_path("JAM", jam_bin) # toolset of the system using ftjam jam_toolset = self._jam_toolset(self.settings.os, self.settings.compiler) if jam_toolset: - self.output.info("Setting JAM_TOOLSET environment variable: {}".format(jam_toolset)) + self.buildenv.define("JAM_TOOLSET", jam_toolset) + self.runenv.define("JAM_TOOLSET", jam_toolset) + + # TODO: Legacy, to be removed on Conan 2.0 + self.env_info.PATH.append(jam_path) + self.env_info.JAM = jam_bin + if jam_toolset: self.env_info.JAM_TOOLSET = jam_toolset diff --git a/recipes/ftjam/all/test_package/conanfile.py b/recipes/ftjam/all/test_package/conanfile.py index da7d45af31ef5..d071a67caf36c 100644 --- a/recipes/ftjam/all/test_package/conanfile.py +++ b/recipes/ftjam/all/test_package/conanfile.py @@ -1,31 +1,29 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, tools import os import shutil +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.layout import basic_layout -class TestPackage(ConanFile): + +class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" + generators = "VirtualBuildEnv" + test_type = "explicit" def build_requirements(self): - if hasattr(self, "settings_build"): - self.build_requires(str(self.requires["ftjam"])) + self.tool_requires(self.tested_reference_str) + + def layout(self): + basic_layout(self) def build(self): for f in ("header.h", "main.c", "source.c", "Jamfile"): - shutil.copy(os.path.join(self.source_folder, f), - os.path.join(self.build_folder, f)) - if not tools.cross_building(self): - assert os.path.isfile(tools.get_env("JAM")) - - vars = AutoToolsBuildEnvironment(self).vars - vars["CCFLAGS"] = vars["CFLAGS"] - vars["C++FLAGS"] = vars["CXXFLAGS"] - vars["LINKFLAGS"] = vars["LDFLAGS"] - vars["LINKLIBS"] = vars["LIBS"] - with tools.environment_append(vars): - self.run("{} -d7".format(tools.get_env("JAM")), run_environment=True) + shutil.copy(os.path.join(self.source_folder, f), os.path.join(self.build_folder, f)) + if can_run(self): + self.run("jam -d7") def test(self): - if not tools.cross_building(self): - bin_path = os.path.join(".", "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/ftjam/all/test_v1_package/conanfile.py b/recipes/ftjam/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..2c48aab90b45b --- /dev/null +++ b/recipes/ftjam/all/test_v1_package/conanfile.py @@ -0,0 +1,32 @@ +from conans import AutoToolsBuildEnvironment, ConanFile, tools +import os +import shutil + + +class TestPackage(ConanFile): + settings = "os", "arch", "compiler", "build_type" + + def build_requirements(self): + if hasattr(self, "settings_build"): + self.build_requires(str(self.requires["ftjam"])) + + def build(self): + source_folder = os.path.join(self.source_folder, "..", "test_package") + for f in ("header.h", "main.c", "source.c", "Jamfile"): + shutil.copy(os.path.join(source_folder, f), + os.path.join(self.build_folder, f)) + if not tools.cross_building(self): + assert os.path.isfile(tools.get_env("JAM")) + + vars = AutoToolsBuildEnvironment(self).vars + vars["CCFLAGS"] = vars["CFLAGS"] + vars["C++FLAGS"] = vars["CXXFLAGS"] + vars["LINKFLAGS"] = vars["LDFLAGS"] + vars["LINKLIBS"] = vars["LIBS"] + with tools.environment_append(vars): + self.run("{} -d7".format(tools.get_env("JAM")), run_environment=True) + + 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/ftxui/all/CMakeLists.txt b/recipes/ftxui/all/CMakeLists.txt deleted file mode 100644 index 26553983b8de0..0000000000000 --- a/recipes/ftxui/all/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 3.11) -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/ftxui/all/conandata.yml b/recipes/ftxui/all/conandata.yml index 84aba68ff064c..56009c498942c 100644 --- a/recipes/ftxui/all/conandata.yml +++ b/recipes/ftxui/all/conandata.yml @@ -1,4 +1,16 @@ sources: + "5.0.0": + url: "https://github.com/ArthurSonzogni/FTXUI/archive/refs/tags/v5.0.0.tar.gz" + sha256: "a2991cb222c944aee14397965d9f6b050245da849d8c5da7c72d112de2786b5b" + "4.1.1": + url: "https://github.com/ArthurSonzogni/FTXUI/archive/refs/tags/v4.1.1.tar.gz" + sha256: "9009d093e48b3189487d67fc3e375a57c7b354c0e43fc554ad31bec74a4bc2dd" + "4.1.0": + url: "https://github.com/ArthurSonzogni/FTXUI/archive/refs/tags/v4.1.0.tar.gz" + sha256: "6f03f5917b44c9bc12335ad891a93813bbb6e738e0bd0c44f97bcc6077c45980" + "4.0.0": + url: "https://github.com/ArthurSonzogni/FTXUI/archive/refs/tags/v4.0.0.tar.gz" + sha256: "7276e4117429ebf8e34ea371c3ea4e66eb99e0f234cb4c5c85fca17174a53dfa" "3.0.0": url: "https://github.com/ArthurSonzogni/FTXUI/archive/refs/tags/v3.0.0.tar.gz" sha256: "a8f2539ab95caafb21b0c534e8dfb0aeea4e658688797bb9e5539729d9258cc1" @@ -6,11 +18,27 @@ sources: url: "https://github.com/ArthurSonzogni/FTXUI/archive/refs/tags/v2.0.0.tar.gz" sha256: "d891695ef22176f0c09f8261a37af9ad5b262dd670a81e6b83661a23abc2c54f" patches: + "4.1.1": + - patch_file: "patches/4.1.1-0002-install-dll.patch" + patch_description: "add runtime destionation for windows shared build" + patch_type: "conan" + "4.1.0": + - patch_file: "patches/4.0.0-0002-install-dll.patch" + patch_description: "add runtime destionation for windows shared build" + patch_type: "conan" + "4.0.0": + - patch_file: "patches/4.0.0-0002-install-dll.patch" + patch_description: "add runtime destionation for windows shared build" + patch_type: "conan" "3.0.0": - - patch_file: "patches/0002-install-dll.patch" - base_path: "source_subfolder" + - patch_file: "patches/2.0.0-0002-install-dll.patch" + patch_description: "add runtime destionation for windows shared build" + patch_type: "conan" "2.0.0": - - patch_file: "patches/0001-lib-prefix.patch" - base_path: "source_subfolder" - - patch_file: "patches/0002-install-dll.patch" - base_path: "source_subfolder" + - patch_file: "patches/2.0.0-0001-lib-prefix.patch" + patch_description: "correct the order of cmake min and project" + patch_type: "bugfix" + patch_source: "https://github.com/ArthurSonzogni/FTXUI/pull/340" + - patch_file: "patches/2.0.0-0002-install-dll.patch" + patch_description: "add runtime destionation for windows shared build" + patch_type: "conan" diff --git a/recipes/ftxui/all/conanfile.py b/recipes/ftxui/all/conanfile.py index ab985f7b93858..2f4a068d989e3 100644 --- a/recipes/ftxui/all/conanfile.py +++ b/recipes/ftxui/all/conanfile.py @@ -1,22 +1,22 @@ +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, rm +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 - -from conan.tools.microsoft import is_msvc, msvc_runtime_flag -import conan.tools.files -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration - -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class FTXUIConan(ConanFile): name = "ftxui" description = "C++ Functional Terminal User Interface." license = "MIT" - topics = ("ncurses", "terminal", "screen", "tui") - homepage = "https://github.com/ArthurSonzogni/FTXUI" url = "https://github.com/conan-io/conan-center-index" - + homepage = "https://github.com/ArthurSonzogni/FTXUI" + topics = ("ncurses", "terminal", "screen", "tui") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -26,16 +26,23 @@ class FTXUIConan(ConanFile): "shared": False, "fPIC": True, } - generators = "cmake" @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "8", + "clang": "7", + "apple-clang": "12", + "Visual Studio": "16", + "msvc": "192", + } 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,52 +50,68 @@ 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): - compiler = self.settings.compiler - version = tools.Version(self.settings.compiler.version) - if compiler == 'gcc' and version < '8': - raise ConanInvalidConfiguration("gcc 8 required") - if compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, "17") - if is_msvc(self) and self.options.shared and "MT" in msvc_runtime_flag(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 is_msvc(self) and self.options.shared and is_msvc_static_runtime(self): raise ConanInvalidConfiguration("shared with static runtime 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], strip_root=True) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["FTXUI_BUILD_DOCS"] = False - cmake.definitions["FTXUI_BUILD_EXAMPLES"] = False - 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["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + tc.variables["FTXUI_BUILD_DOCS"] = False + tc.variables["FTXUI_BUILD_EXAMPLES"] = False + tc.generate() - def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - conan.tools.files.patch(self, **patch) + tc = CMakeDeps(self) + tc.generate() - 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, 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")) + if Version(self.version) >= "4.1.0": + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + if Version(self.version) >= "4.1.1": + rm(self, "ftxui.pc", os.path.join(self.package_folder, "lib"), ) def package_info(self): self.cpp_info.set_property("cmake_file_name", "ftxui") + if Version(self.version) >= "4.1.0": + self.cpp_info.set_property("pkg_config_name", "ftxui") self.cpp_info.components["ftxui-dom"].set_property("cmake_target_name", "ftxui::dom") self.cpp_info.components["ftxui-dom"].libs = ["ftxui-dom"] self.cpp_info.components["ftxui-dom"].requires = ["ftxui-screen"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["ftxui-dom"].system_libs.append("m") self.cpp_info.components["ftxui-screen"].set_property("cmake_target_name", "ftxui::screen") self.cpp_info.components["ftxui-screen"].libs = ["ftxui-screen"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["ftxui-screen"].system_libs.append("m") self.cpp_info.components["ftxui-component"].set_property("cmake_target_name", "ftxui::component") self.cpp_info.components["ftxui-component"].libs = ["ftxui-component"] diff --git a/recipes/ftxui/all/patches/0001-lib-prefix.patch b/recipes/ftxui/all/patches/2.0.0-0001-lib-prefix.patch similarity index 100% rename from recipes/ftxui/all/patches/0001-lib-prefix.patch rename to recipes/ftxui/all/patches/2.0.0-0001-lib-prefix.patch diff --git a/recipes/ftxui/all/patches/0002-install-dll.patch b/recipes/ftxui/all/patches/2.0.0-0002-install-dll.patch similarity index 100% rename from recipes/ftxui/all/patches/0002-install-dll.patch rename to recipes/ftxui/all/patches/2.0.0-0002-install-dll.patch diff --git a/recipes/ftxui/all/patches/4.0.0-0002-install-dll.patch b/recipes/ftxui/all/patches/4.0.0-0002-install-dll.patch new file mode 100644 index 0000000000000..41ba040d126b6 --- /dev/null +++ b/recipes/ftxui/all/patches/4.0.0-0002-install-dll.patch @@ -0,0 +1,12 @@ +diff --git a/cmake/ftxui_install.cmake b/cmake/ftxui_install.cmake +index 19e68d0..19d22c0 100644 +--- a/cmake/ftxui_install.cmake ++++ b/cmake/ftxui_install.cmake +@@ -5,6 +5,7 @@ endif() + include(GNUInstallDirs) + install(TARGETS screen dom component + EXPORT ftxui-export ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + ) diff --git a/recipes/ftxui/all/patches/4.1.1-0002-install-dll.patch b/recipes/ftxui/all/patches/4.1.1-0002-install-dll.patch new file mode 100644 index 0000000000000..6acb41d9c736a --- /dev/null +++ b/recipes/ftxui/all/patches/4.1.1-0002-install-dll.patch @@ -0,0 +1,12 @@ +diff --git a/cmake/ftxui_install.cmake b/cmake/ftxui_install.cmake +index d6de491..c5c4f66 100644 +--- a/cmake/ftxui_install.cmake ++++ b/cmake/ftxui_install.cmake +@@ -11,6 +11,7 @@ include(CMakePackageConfigHelpers) + install( + TARGETS screen dom component + EXPORT ftxui-targets ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + ) diff --git a/recipes/ftxui/all/test_package/CMakeLists.txt b/recipes/ftxui/all/test_package/CMakeLists.txt index f4c3b1f828f16..44e0ebf683f7a 100644 --- a/recipes/ftxui/all/test_package/CMakeLists.txt +++ b/recipes/ftxui/all/test_package/CMakeLists.txt @@ -1,10 +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(ftxui REQUIRED CONFIG) + add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ftxui::dom ftxui::screen) +target_link_libraries(${PROJECT_NAME} PRIVATE ftxui::dom ftxui::screen) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/ftxui/all/test_package/conanfile.py b/recipes/ftxui/all/test_package/conanfile.py index e788460ad0765..a9fbb7f543162 100644 --- a/recipes/ftxui/all/test_package/conanfile.py +++ b/recipes/ftxui/all/test_package/conanfile.py @@ -1,11 +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" + + def requirements(self): + self.requires(self.tested_reference_str) - settings = "os", "compiler", "build_type", "arch" - 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/ftxui/all/test_v1_package/CMakeLists.txt b/recipes/ftxui/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..be00a8c7f57c7 --- /dev/null +++ b/recipes/ftxui/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/plutovg/all/test_v1_package/conanfile.py b/recipes/ftxui/all/test_v1_package/conanfile.py similarity index 100% rename from recipes/plutovg/all/test_v1_package/conanfile.py rename to recipes/ftxui/all/test_v1_package/conanfile.py diff --git a/recipes/ftxui/config.yml b/recipes/ftxui/config.yml index 70df618778342..7747269b92a0d 100644 --- a/recipes/ftxui/config.yml +++ b/recipes/ftxui/config.yml @@ -1,4 +1,12 @@ versions: + "5.0.0": + folder: all + "4.1.1": + folder: all + "4.1.0": + folder: all + "4.0.0": + folder: all "3.0.0": folder: all "2.0.0": diff --git a/recipes/function2/all/conandata.yml b/recipes/function2/all/conandata.yml index 4a8c1d45eb5f5..ae317e99a1e7e 100644 --- a/recipes/function2/all/conandata.yml +++ b/recipes/function2/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "4.2.4": + url: "https://github.com/Naios/function2/archive/refs/tags/4.2.4.tar.gz" + sha256: "6081d0f7011ddb8555bd846caf1245d4bce62d83fee1403b9d247b66ed617a67" + "4.2.3": + url: "https://github.com/Naios/function2/archive/refs/tags/4.2.3.tar.gz" + sha256: "097333b05e596280d3bc7a4769f1262931716cd8cc31ca7337b7af714085f3fc" "4.2.2": url: "https://github.com/Naios/function2/archive/refs/tags/4.2.2.tar.gz" sha256: "f755cb79712dfb9ceefcf7f7ff3225f7c99d22a164dae109044dbfad55d7111e" diff --git a/recipes/function2/all/conanfile.py b/recipes/function2/all/conanfile.py index e29faac1dac09..cd8358a3305e8 100644 --- a/recipes/function2/all/conanfile.py +++ b/recipes/function2/all/conanfile.py @@ -16,24 +16,26 @@ class Function2Conan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/Naios/function2" license = "BSL-1.0" + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @property def _min_cppstd(self): - return 14 + return "14" @property - def _compiler_minimal_version(self): + def _compilers_minimum_version(self): return { "gcc": "5", "clang": "3.4", "apple-clang": "10", - "Visual Studio": "14" + "Visual Studio": "14", + "msvc": "190", } def layout(self): - basic_layout(self) + basic_layout(self, src_folder="src") def package_id(self): self.info.clear() @@ -41,20 +43,15 @@ def package_id(self): 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 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, self._min_cppstd)) - return - 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)) + + 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def build(self): pass diff --git a/recipes/function2/all/test_v1_package/CMakeLists.txt b/recipes/function2/all/test_v1_package/CMakeLists.txt index 5816ff152bbfe..0d20897301b68 100644 --- a/recipes/function2/all/test_v1_package/CMakeLists.txt +++ b/recipes/function2/all/test_v1_package/CMakeLists.txt @@ -1,14 +1,8 @@ -cmake_minimum_required(VERSION 3.10) - -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(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) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/function2/config.yml b/recipes/function2/config.yml index 955cd0773fc58..a3a96ea0ace3a 100644 --- a/recipes/function2/config.yml +++ b/recipes/function2/config.yml @@ -1,4 +1,8 @@ versions: + "4.2.4": + folder: all + "4.2.3": + folder: all "4.2.2": folder: all "4.2.1": diff --git a/recipes/functionalplus/all/conandata.yml b/recipes/functionalplus/all/conandata.yml index ca33489d4d5de..ce67a8c16c149 100644 --- a/recipes/functionalplus/all/conandata.yml +++ b/recipes/functionalplus/all/conandata.yml @@ -1,19 +1,13 @@ sources: - "0.2.18-p0": - url: "https://github.com/Dobiasd/FunctionalPlus/archive/v0.2.18-p0.tar.gz" - sha256: "ffc63fc86f89a205accafa85c35790eda307adf5f1d6d51bb7ceb5c5e21e013b" - "0.2.17-p0": - url: "https://github.com/Dobiasd/FunctionalPlus/archive/v0.2.17-p0.tar.gz" - sha256: "c41514b24a81ad47a8f98b3ef3a3bd3fe8109085f7965e9678386b08721e3620" - "0.2.16": - url: "https://github.com/Dobiasd/FunctionalPlus/archive/v0.2.16-p0.tar.gz" - sha256: "6026e64260afbd6941aaf19559d6e5dc51cbb3e045ef8d8e158d96bcd8651ed6" - "0.2.15": - url: "https://github.com/Dobiasd/FunctionalPlus/archive/v0.2.15-p0.tar.gz" - sha256: "4c76104ec8f6da5e66ed768380bdf128e0ba01725056c40a3c1b850cf4b441ad" - "0.2.14-p0": - url: "https://github.com/Dobiasd/FunctionalPlus/archive/refs/tags/v0.2.14-p0.tar.gz" - sha256: "68a0e715aa18d2fe558fede06d65ec125959895efe4d0ef21b102037c9864ba1" - "0.2.13-p0": - url: "https://github.com/Dobiasd/FunctionalPlus/archive/v0.2.13-p0.tar.gz" - sha256: "62f61ce6500859f0d77306b1644b5c6992287688de38e170b17b8a66b2448b54" + "0.2.25": + url: "https://github.com/Dobiasd/FunctionalPlus/archive/v0.2.25.tar.gz" + sha256: "9b5e24bbc92f43b977dc83efbc173bcf07dbe07f8718fc2670093655b56fcee3" + "0.2.24": + url: "https://github.com/Dobiasd/FunctionalPlus/archive/v0.2.24.tar.gz" + sha256: "446c63ac3f2045e7587f694501882a3d7c7b962b70bcc08deacf5777bdaaff8c" + "0.2.23": + url: "https://github.com/Dobiasd/FunctionalPlus/archive/v0.2.23.tar.gz" + sha256: "5c2d28d2ba7d0cdeab9e31bbf2e7f8a9d6f2ff6111a54bfc11d1b05422096f19" + "0.2.22": + url: "https://github.com/Dobiasd/FunctionalPlus/archive/v0.2.22.tar.gz" + sha256: "79378668dff6ffa8abc1abde2c2fe37dc6fe1ac040c55d5ee7886924fa6a1376" diff --git a/recipes/functionalplus/all/conanfile.py b/recipes/functionalplus/all/conanfile.py index e87d42e53ba37..53628cdcaf152 100644 --- a/recipes/functionalplus/all/conanfile.py +++ b/recipes/functionalplus/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" @@ -12,12 +13,18 @@ class FunctionalPlusConan(ConanFile): name = "functionalplus" description = "Functional Programming Library for C++." license = "BSL-1.0" - topics = ("functionalplus", "fplus", "functional programming") + topics = ("fplus", "functional programming", "header-only") homepage = "https://github.com/Dobiasd/FunctionalPlus" 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 _min_cppstd(self): + return 14 + @property def _compilers_minimum_version(self): return { @@ -28,36 +35,35 @@ def _compilers_minimum_version(self): "apple-clang": "9", } + 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 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] + check_min_cppstd(self, self._min_cppstd) 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("functionalplus requires C++14, which your compiler does not support.") - - def layout(self): - basic_layout(self, src_folder="src") + 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 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")) + 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", "FunctionalPlus") diff --git a/recipes/functionalplus/config.yml b/recipes/functionalplus/config.yml index 42d00dd1c341a..1aa00fc767fdd 100644 --- a/recipes/functionalplus/config.yml +++ b/recipes/functionalplus/config.yml @@ -1,13 +1,9 @@ versions: - "0.2.18-p0": + "0.2.25": folder: all - "0.2.17-p0": + "0.2.24": folder: all - "0.2.16": + "0.2.23": folder: all - "0.2.15": - folder: all - "0.2.14-p0": - folder: all - "0.2.13-p0": + "0.2.22": folder: all diff --git a/recipes/functions-framework-cpp/all/CMakeLists.txt b/recipes/functions-framework-cpp/all/CMakeLists.txt deleted file mode 100644 index c921d02a0d877..0000000000000 --- a/recipes/functions-framework-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/functions-framework-cpp/all/conandata.yml b/recipes/functions-framework-cpp/all/conandata.yml index c01327cda0d09..0f463b674b8cc 100644 --- a/recipes/functions-framework-cpp/all/conandata.yml +++ b/recipes/functions-framework-cpp/all/conandata.yml @@ -1,8 +1,22 @@ sources: + "1.2.0": + url: "https://github.com/GoogleCloudPlatform/functions-framework-cpp/archive/refs/tags/v1.2.0.tar.gz" + sha256: "729e24ef58a03b563e48d8006d63972b16a22bcf93bf2b49f40c3b219032b64b" "1.0.0": url: "https://github.com/GoogleCloudPlatform/functions-framework-cpp/archive/refs/tags/v1.0.0.tar.gz" sha256: "005f2fbe3b8be9f6f0bf7a4a5d218a23b0f62d854a5e84c56872dd3a4d2820f7" patches: + "1.2.0": + - patch_file: "patches/1.2.0-0001-dont-skip-namelink.patch" + patch_description: "disable NAMELINK_SKIP" + patch_type: "portability" + - patch_file: "patches/1.2.0-0002-find-nlohmann_json.patch" + patch_description: "use cci's nlohmann_json" + patch_type: "conan" "1.0.0": - - patch_file: "patches/0001-dont-skip-namelink.patch" - base_path: "source_subfolder" + - patch_file: "patches/1.0.0-0001-dont-skip-namelink.patch" + patch_description: "disable NAMELINK_SKIP" + patch_type: "portability" + - patch_file: "patches/1.0.0-0002-find-nlohmann_json.patch" + patch_description: "use cci's nlohmann_json" + patch_type: "conan" diff --git a/recipes/functions-framework-cpp/all/conanfile.py b/recipes/functions-framework-cpp/all/conanfile.py index 96389274771c4..859f3f1596a4e 100644 --- a/recipes/functions-framework-cpp/all/conanfile.py +++ b/recipes/functions-framework-cpp/all/conanfile.py @@ -1,19 +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_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, cross_building +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 FunctionsFrameworkCppConan(ConanFile): name = "functions-framework-cpp" description = "An open source FaaS (Functions as a Service) framework" license = "Apache-2.0" - topics = ("google", "cloud", "functions-as-a-service", "faas-framework") - homepage = "https://github.com/GoogleCloudPlatform/functions-framework-cpp" url = "https://github.com/conan-io/conan-center-index" - + homepage = "https://github.com/GoogleCloudPlatform/functions-framework-cpp" + topics = ("google", "cloud", "functions-as-a-service", "faas-framework") settings = "os", "arch", "compiler", "build_type" + package_type = "library" options = { "shared": [True, False], "fPIC": [True, False], @@ -22,23 +25,24 @@ class FunctionsFrameworkCppConan(ConanFile): "shared": False, "fPIC": True, } - - generators = "cmake", "cmake_find_package_multi", "cmake_find_package" short_paths = True - _cmake = None @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 17 @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] + def _compilers_minimum_version(self): + return { + "gcc": "9", + "Visual Studio": "15.7", + "msvc": "190", + "clang": "7", + "apple-clang": "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": @@ -46,21 +50,15 @@ 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("abseil/20211102.0") - self.requires("boost/1.78.0") - self.requires("nlohmann_json/3.10.5") + def layout(self): + cmake_layout(self, src_folder="src") - @property - def _compilers_minimum_version(self): - return { - "gcc": "9", - "Visual Studio": "15.7", - "clang": "7", - "apple-clang": "11", - } + def requirements(self): + self.requires("abseil/20230125.3") + self.requires("boost/1.83.0") + self.requires("nlohmann_json/3.11.2", transitive_headers=True) @property def _required_boost_components(self): @@ -68,10 +66,10 @@ def _required_boost_components(self): def validate(self): miss_boost_required_comp = \ - any(getattr(self.options["boost"], + any(getattr(self.dependencies["boost"].options, "without_{}".format(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) @@ -79,7 +77,7 @@ def validate(self): ) if self.settings.compiler.get_safe("cppstd"): - tools.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(".")] @@ -90,46 +88,40 @@ 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 C++17, which your compiler does not support.".format(self.name) + "{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." ) - if self._is_msvc and self.options.shared: + if is_msvc(self) and self.options.shared: raise ConanInvalidConfiguration("Fails to build for Visual Studio as a DLL") - if hasattr(self, "settings_build") and tools.cross_building(self): + if hasattr(self, "settings_build") and cross_building(self): raise ConanInvalidConfiguration( "Recipe not prepared for cross-building (yet)" ) 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["FUNCTIONS_FRAMEWORK_CPP_TEST_EXAMPLES"] = False - - self._cmake.configure() - return self._cmake + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["BUILD_TESTING"] = False + tc.variables["FUNCTIONS_FRAMEWORK_CPP_TEST_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")) - 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", "functions_framework_cpp") diff --git a/recipes/functions-framework-cpp/all/patches/0001-dont-skip-namelink.patch b/recipes/functions-framework-cpp/all/patches/1.0.0-0001-dont-skip-namelink.patch similarity index 100% rename from recipes/functions-framework-cpp/all/patches/0001-dont-skip-namelink.patch rename to recipes/functions-framework-cpp/all/patches/1.0.0-0001-dont-skip-namelink.patch diff --git a/recipes/functions-framework-cpp/all/patches/1.0.0-0002-find-nlohmann_json.patch b/recipes/functions-framework-cpp/all/patches/1.0.0-0002-find-nlohmann_json.patch new file mode 100644 index 0000000000000..869e28e535811 --- /dev/null +++ b/recipes/functions-framework-cpp/all/patches/1.0.0-0002-find-nlohmann_json.patch @@ -0,0 +1,22 @@ +diff --git a/google/cloud/functions/CMakeLists.txt b/google/cloud/functions/CMakeLists.txt +index f7cac3a..38f7449 100644 +--- a/google/cloud/functions/CMakeLists.txt ++++ b/google/cloud/functions/CMakeLists.txt +@@ -23,6 +23,7 @@ configure_file(internal/version_info.h.in + find_package(absl REQUIRED) + find_package(Boost REQUIRED COMPONENTS program_options) + find_package(Threads REQUIRED) ++find_package(nlohmann_json REQUIRED) + + add_library( + functions_framework_cpp # cmake-format: sort +@@ -76,7 +77,8 @@ target_include_directories(functions_framework_cpp SYSTEM + PUBLIC $) + target_link_libraries( + functions_framework_cpp PUBLIC absl::time Boost::headers +- Boost::program_options Threads::Threads) ++ Boost::program_options Threads::Threads ++ nlohmann_json::nlohmann_json) + target_compile_definitions(functions_framework_cpp + PUBLIC BOOST_BEAST_USE_STD_STRING_VIEW) + set_target_properties( diff --git a/recipes/functions-framework-cpp/all/patches/1.2.0-0001-dont-skip-namelink.patch b/recipes/functions-framework-cpp/all/patches/1.2.0-0001-dont-skip-namelink.patch new file mode 100644 index 0000000000000..661786756beb5 --- /dev/null +++ b/recipes/functions-framework-cpp/all/patches/1.2.0-0001-dont-skip-namelink.patch @@ -0,0 +1,12 @@ +diff --git a/google/cloud/functions/CMakeLists.txt b/google/cloud/functions/CMakeLists.txt +index 2b9506b..609c238 100644 +--- a/google/cloud/functions/CMakeLists.txt ++++ b/google/cloud/functions/CMakeLists.txt +@@ -137,7 +137,6 @@ install( + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT runtime + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT runtime +- NAMELINK_SKIP + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT development + NAMELINK_COMPONENT development diff --git a/recipes/functions-framework-cpp/all/patches/1.2.0-0002-find-nlohmann_json.patch b/recipes/functions-framework-cpp/all/patches/1.2.0-0002-find-nlohmann_json.patch new file mode 100644 index 0000000000000..974fed8146e70 --- /dev/null +++ b/recipes/functions-framework-cpp/all/patches/1.2.0-0002-find-nlohmann_json.patch @@ -0,0 +1,22 @@ +diff --git a/google/cloud/functions/CMakeLists.txt b/google/cloud/functions/CMakeLists.txt +index 2b9506b..ab3aaaa 100644 +--- a/google/cloud/functions/CMakeLists.txt ++++ b/google/cloud/functions/CMakeLists.txt +@@ -23,6 +23,7 @@ configure_file(internal/version_info.h.in + find_package(absl REQUIRED) + find_package(Boost REQUIRED COMPONENTS program_options) + find_package(Threads REQUIRED) ++find_package(nlohmann_json REQUIRED) + + add_library( + functions_framework_cpp # cmake-format: sort +@@ -80,7 +81,8 @@ target_include_directories(functions_framework_cpp SYSTEM + PUBLIC $) + target_link_libraries( + functions_framework_cpp PUBLIC absl::time Boost::headers +- Boost::program_options Threads::Threads) ++ Boost::program_options Threads::Threads ++ nlohmann_json::nlohmann_json) + target_compile_definitions(functions_framework_cpp + PUBLIC BOOST_BEAST_USE_STD_STRING_VIEW) + set_target_properties( diff --git a/recipes/functions-framework-cpp/all/test_package/CMakeLists.txt b/recipes/functions-framework-cpp/all/test_package/CMakeLists.txt index d4b4a2212f334..5126c69942f53 100644 --- a/recipes/functions-framework-cpp/all/test_package/CMakeLists.txt +++ b/recipes/functions-framework-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(functions_framework_cpp REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} functions-framework-cpp::framework) +target_link_libraries(${PROJECT_NAME} PRIVATE functions-framework-cpp::framework) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/functions-framework-cpp/all/test_package/conanfile.py b/recipes/functions-framework-cpp/all/test_package/conanfile.py index 38f4483872d47..ef5d7042163ec 100644 --- a/recipes/functions-framework-cpp/all/test_package/conanfile.py +++ b/recipes/functions-framework-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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/functions-framework-cpp/config.yml b/recipes/functions-framework-cpp/config.yml index c7f13630776fb..45091dac1186f 100644 --- a/recipes/functions-framework-cpp/config.yml +++ b/recipes/functions-framework-cpp/config.yml @@ -1,3 +1,5 @@ versions: + "1.2.0": + folder: "all" "1.0.0": folder: "all" diff --git a/recipes/fusepp/all/CMakeLists.txt b/recipes/fusepp/all/CMakeLists.txt index 661f0d421c545..95ef7fe563895 100644 --- a/recipes/fusepp/all/CMakeLists.txt +++ b/recipes/fusepp/all/CMakeLists.txt @@ -1,18 +1,16 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) +cmake_minimum_required(VERSION 3.12) +project(cmake_wrapper LANGUAGES CXX) -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup(KEEP_RPATHS) +find_package(libfuse REQUIRED CONFIG) -set(SOURCE_SUBFOLDER ${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder) +set(SOURCE_SUBFOLDER ${CMAKE_CURRENT_LIST_DIR}/src) file(GLOB_RECURSE INCLUDE_FILES "${SOURCE_SUBFOLDER}/Fuse*.h" "${SOURCE_SUBFOLDER}/Fuse.cpp") add_library(fusepp ${SOURCE_SUBFOLDER}/Fuse.cpp) - +target_link_libraries(fusepp PUBLIC libfuse::libfuse) set_target_properties(fusepp PROPERTIES PUBLIC_HEADER "${INCLUDE_FILES}") + +include(GNUInstallDirs) install(TARGETS fusepp - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) diff --git a/recipes/fusepp/all/conanfile.py b/recipes/fusepp/all/conanfile.py index f23b9daa7e874..36394b1187d48 100644 --- a/recipes/fusepp/all/conanfile.py +++ b/recipes/fusepp/all/conanfile.py @@ -1,15 +1,24 @@ -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.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" class FuseppConan(ConanFile): name = "fusepp" description = "A simple C++ wrapper for the FUSE filesystem." license = "MIT" - topics = ("fuse", "fusepp", "wrapper", "filesystem") - homepage = "https://github.com/jachappell/Fusepp" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/jachappell/Fusepp" + topics = ("fuse", "wrapper", "filesystem") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -17,23 +26,11 @@ class FuseppConan(ConanFile): } default_options = { "shared": False, - "fPIC": True + "fPIC": True, } - 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") - if self.settings.compiler == "gcc": - if tools.Version(self.settings.compiler.version) < "6": - raise ConanInvalidConfiguration("gcc < 6 is unsupported") + 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": @@ -41,38 +38,50 @@ 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 source(self): - tools.get(**self.conan_data["sources"][self.version], - strip_root=True, destination=self._source_subfolder) + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("libfuse/3.10.5") + self.requires("libfuse/3.10.5", transitive_headers=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.configure() - return self._cmake + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) + if self.settings.compiler == "gcc": + if Version(self.settings.compiler.version) < "6": + raise ConanInvalidConfiguration("gcc < 6 is unsupported") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.generate() + tc = CMakeDeps(self) + tc.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=self.export_sources_folder) 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() def package_info(self): self.cpp_info.libs = ["fusepp"] + self.cpp_info.set_property("cmake_file_name", "fusepp") + self.cpp_info.set_property("cmake_target_name", "fusepp::fusepp") + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs = ["m"] + # TODO: Remove after Conan 2.0 self.cpp_info.names["cmake_find_package"] = "fusepp" self.cpp_info.names["cmake_find_package_multi"] = "fusepp" - - self.cpp_info.set_property("cmake_file_name", "fusepp") - self.cpp_info.set_property("cmake_target_name", "fusepp") diff --git a/recipes/fusepp/all/test_package/CMakeLists.txt b/recipes/fusepp/all/test_package/CMakeLists.txt index 00168e2e07000..03f33e510f02d 100644 --- a/recipes/fusepp/all/test_package/CMakeLists.txt +++ b/recipes/fusepp/all/test_package/CMakeLists.txt @@ -1,10 +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) - -find_package(fusepp CONFIG REQUIRED) +find_package(fusepp REQUIRED CONFIG) add_executable(${PROJECT_NAME} example.cpp) target_link_libraries(${PROJECT_NAME} fusepp::fusepp) diff --git a/recipes/fusepp/all/test_package/conanfile.py b/recipes/fusepp/all/test_package/conanfile.py index 46d9d6bbaf311..23d14d1e4b9f6 100644 --- a/recipes/fusepp/all/test_package/conanfile.py +++ b/recipes/fusepp/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("%s --version" % bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + self.run(f"{bin_path} --version", env="conanrun") diff --git a/recipes/fusepp/all/test_v1_package/CMakeLists.txt b/recipes/fusepp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/fusepp/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/fusepp/all/test_v1_package/conanfile.py b/recipes/fusepp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..46d9d6bbaf311 --- /dev/null +++ b/recipes/fusepp/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("%s --version" % bin_path, run_environment=True) diff --git a/recipes/fxdiv/all/conanfile.py b/recipes/fxdiv/all/conanfile.py index 30d0773e14a46..8b36feb1d6229 100644 --- a/recipes/fxdiv/all/conanfile.py +++ b/recipes/fxdiv/all/conanfile.py @@ -11,21 +11,21 @@ class FxdivConan(ConanFile): description = "C99/C++ header-only library for division via fixed-point " \ "multiplication by inverse." license = "MIT" - topics = ("fxdiv", "integer-division") + topics = ("integer-division",) homepage = "https://github.com/Maratyszcza/FXdiv" url = "https://github.com/conan-io/conan-center-index" + package_type = "header-library" 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 @@ -36,6 +36,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/fxdiv/all/test_package/conanfile.py b/recipes/fxdiv/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/fxdiv/all/test_package/conanfile.py +++ b/recipes/fxdiv/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/fxdiv/all/test_v1_package/CMakeLists.txt b/recipes/fxdiv/all/test_v1_package/CMakeLists.txt index b7f38eca2a76d..0d20897301b68 100644 --- a/recipes/fxdiv/all/test_v1_package/CMakeLists.txt +++ b/recipes/fxdiv/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES C) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(fxdiv REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE fxdiv::fxdiv) -target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/g3log/all/conandata.yml b/recipes/g3log/all/conandata.yml index 140d23e5b67d1..d0c122e1d915c 100644 --- a/recipes/g3log/all/conandata.yml +++ b/recipes/g3log/all/conandata.yml @@ -1,16 +1,27 @@ sources: + "2.4": + url: "https://github.com/KjellKod/g3log/archive/2.4.tar.gz" + sha256: "a240673f6dda17a8d4d5768b6741534e6863e6c4d786c3678e4fe687eb115902" + "2.3": + url: "https://github.com/KjellKod/g3log/archive/2.3.tar.gz" + sha256: "a27dc3ff0d962cc6e0b4e60890b4904e664b0df16393d27e14c878d7de09b505" + "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" "1.3.3": url: "https://github.com/KjellKod/g3log/archive/1.3.3.tar.gz" sha256: "d8cae14e1508490145d710f10178b2da9b86ce03fb2428a684fff35576fe5d5c" - "1.3.2-86": - url: "https://github.com/KjellKod/g3log/archive/4000c5c899c0ae58b8b851f9b66e1a2ac0fe2bff.tar.gz" - sha256: "4572b723458fbe2b3bf620e2bd47ecfab2975c16369dc6390ffa27e177b33c88" "1.3.2": url: "https://github.com/KjellKod/g3log/archive/1.3.2.tar.gz" sha256: "0ed1983654fdd8268e051274904128709c3d9df8234acf7916e9015199b0b247" patches: "1.3.2": - - patch_file: "patches/0002-remove-explicit-stdlib-setting.patch" + - patch_file: "patches/1.3.2-0001-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..714d7778c58eb 100644 --- a/recipes/g3log/all/conanfile.py +++ b/recipes/g3log/all/conanfile.py @@ -2,26 +2,26 @@ 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") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -46,18 +46,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", - } + "14": { + "gcc": "6.1", + "clang": "3.4", + "apple-clang": "5.1", + "Visual Studio": "15", + "msvc": "191", + }, + "17": { + "gcc": "8", + "clang": "7", + "apple-clang": "12", + "Visual Studio": "16", + "msvc": "192", + }, + }.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": @@ -68,11 +81,14 @@ 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: - 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 +96,14 @@ 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( - "{} requires C++14, 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) @@ -147,8 +159,11 @@ 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"]: - self.cpp_info.system_libs.append("pthread") + + if self.settings.os in ["Linux", "FreeBSD", "Android"]: + self.cpp_info.system_libs.extend(["m", "pthread", "rt"]) + 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/patches/0001-remove-explicit-stdlib-setting.patch b/recipes/g3log/all/patches/0001-remove-explicit-stdlib-setting.patch deleted file mode 100644 index 51c9ab6daa793..0000000000000 --- a/recipes/g3log/all/patches/0001-remove-explicit-stdlib-setting.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff --git a/Build.cmake b/Build.cmake -index f266a62..b9e6c60 100644 ---- a/Build.cmake -+++ b/Build.cmake -@@ -24,11 +24,6 @@ IF ("${CMAKE_CXX_COMPILER_ID}" MATCHES ".*Clang") - MESSAGE("") - MESSAGE("cmake for Clang ") - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 -Wunused -D_GLIBCXX_USE_NANOSLEEP") -- IF (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") -- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libstdc++ -pthread") -- ELSE() -- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") -- ENDIF() - IF (${CMAKE_SYSTEM} MATCHES "FreeBSD-([0-9]*)\\.(.*)") - IF (${CMAKE_MATCH_1} GREATER 9) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread") diff --git a/recipes/g3log/all/patches/0002-remove-explicit-stdlib-setting.patch b/recipes/g3log/all/patches/1.3.2-0001-remove-explicit-stdlib-setting.patch similarity index 100% rename from recipes/g3log/all/patches/0002-remove-explicit-stdlib-setting.patch rename to recipes/g3log/all/patches/1.3.2-0001-remove-explicit-stdlib-setting.patch 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_package/conanfile.py b/recipes/g3log/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/g3log/all/test_package/conanfile.py +++ b/recipes/g3log/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/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..08a72fff292b3 100644 --- a/recipes/g3log/config.yml +++ b/recipes/g3log/config.yml @@ -1,9 +1,15 @@ versions: + "2.4": + folder: all + "2.3": + folder: all + "2.2": + folder: all + "2.1": + folder: all "1.3.4": folder: all "1.3.3": folder: all - "1.3.2-86": - folder: all "1.3.2": folder: all diff --git a/recipes/gaia-ecs/all/conandata.yml b/recipes/gaia-ecs/all/conandata.yml new file mode 100644 index 0000000000000..0f7a267f7719c --- /dev/null +++ b/recipes/gaia-ecs/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.8.6": + url: "https://github.com/richardbiely/gaia-ecs/archive/refs/tags/v0.8.6.tar.gz" + sha256: "9CAC0AC6F2FB19DFFF07D097F5DC0A97FF1CA4AEC3405219CB2D2A03601AB03F" diff --git a/recipes/gaia-ecs/all/conanfile.py b/recipes/gaia-ecs/all/conanfile.py new file mode 100644 index 0000000000000..ad8069272b4bb --- /dev/null +++ b/recipes/gaia-ecs/all/conanfile.py @@ -0,0 +1,74 @@ +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 +import os + +required_conan_version = ">=1.52.0" + + +class GaiaConan(ConanFile): + name = "gaia-ecs" + description = "A simple and powerful entity component system (ECS) written in C++17 " + topics = ("gamedev", "performance", "entity", "ecs") + homepage = "https://github.com/richardbiely/gaia-ecs" + url = "https://github.com/conan-io/conan-center-index" + license = "MIT" + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + + @property + def _min_cppstd(self): + return "17" + + @property + def _compilers_minimum_version(self): + return { + "Visual Studio": "16", + "msvc": "192", + "gcc": "10", + "clang": "7.0", + "apple-clang": "10.0", + "intel-cc": "2021.2" + } + + 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 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): + if self.settings.os in ["FreeBSD", "Linux"]: + self.cpp_info.system_libs = ["pthread"] + + self.cpp_info.set_property("cmake_file_name", "gaia") + self.cpp_info.set_property("cmake_target_name", "gaia::gaia") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + # TODO: remove when v1 support drops + self.cpp_info.names["cmake_find_package"] = "gaia" + self.cpp_info.names["cmake_find_package_multi"] = "gaia" diff --git a/recipes/gaia-ecs/all/test_package/CMakeLists.txt b/recipes/gaia-ecs/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..d9ccb13290576 --- /dev/null +++ b/recipes/gaia-ecs/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(gaia REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE gaia::gaia) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/gaia-ecs/all/test_package/conanfile.py b/recipes/gaia-ecs/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0a6bc68712d90 --- /dev/null +++ b/recipes/gaia-ecs/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/gaia-ecs/all/test_package/test_package.cpp b/recipes/gaia-ecs/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..105e808a6373e --- /dev/null +++ b/recipes/gaia-ecs/all/test_package/test_package.cpp @@ -0,0 +1,9 @@ +#include + +int main() +{ + gaia::ecs::World w; + gaia::ecs::Entity e = w.add(); + (void) w.valid(e); + return 0; +} diff --git a/recipes/gaia-ecs/config.yml b/recipes/gaia-ecs/config.yml new file mode 100644 index 0000000000000..5169c9c9c27e4 --- /dev/null +++ b/recipes/gaia-ecs/config.yml @@ -0,0 +1,3 @@ +versions: + "0.8.6": + folder: all diff --git a/recipes/gamenetworkingsockets/all/CMakeLists.txt b/recipes/gamenetworkingsockets/all/CMakeLists.txt deleted file mode 100644 index 7a80c0b2c26dc..0000000000000 --- a/recipes/gamenetworkingsockets/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(TARGETS) - -add_subdirectory("source_subfolder") diff --git a/recipes/gamenetworkingsockets/all/conandata.yml b/recipes/gamenetworkingsockets/all/conandata.yml index 882c3ee20c6d7..44325d5f8a183 100644 --- a/recipes/gamenetworkingsockets/all/conandata.yml +++ b/recipes/gamenetworkingsockets/all/conandata.yml @@ -1,10 +1,4 @@ sources: - "1.3.0": - url: "https://github.com/ValveSoftware/GameNetworkingSockets/archive/refs/tags/v1.3.0.zip" - sha256: "22e409546babc449c44f492b253b547a2f5f11abe11a100686a10a990b5091cd" -patches: - "1.3.0": - - patch_file: "patches/001-disable-runtime-override.patch" - base_path: "source_subfolder" - - patch_file: "patches/002-either-static-or-shared.patch" - base_path: "source_subfolder" + "1.4.1": + url: "https://github.com/ValveSoftware/GameNetworkingSockets/archive/refs/tags/v1.4.1.tar.gz" + sha256: "1cfb2bf79c51a08ae4e8b7ff5e9c1266b43cfff6f53ecd3e7bc5e3fcb2a22503" diff --git a/recipes/gamenetworkingsockets/all/conanfile.py b/recipes/gamenetworkingsockets/all/conanfile.py index cb91ff14df39f..7fcdd6e98b032 100644 --- a/recipes/gamenetworkingsockets/all/conanfile.py +++ b/recipes/gamenetworkingsockets/all/conanfile.py @@ -1,109 +1,124 @@ -from conans import ConanFile, CMake, 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.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import copy, get, rmdir, replace_in_file +from conan.tools.gnu import PkgConfigDeps + +required_conan_version = ">=1.53.0" class GameNetworkingSocketsConan(ConanFile): name = "gamenetworkingsockets" description = "GameNetworkingSockets is a basic transport layer for games." - topics = ("networking", "game-development") + license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/ValveSoftware/GameNetworkingSockets" - license = "BSD-3-Clause" - generators = "cmake", "pkg_config" - settings = "os", "arch", "compiler", "build_type" - exports_sources = ["CMakeLists.txt", "patches/**"] + topics = ("networking", "game-development") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], - "encryption": ["openssl", "libsodium", "bcrypt"] + "encryption": ["openssl", "libsodium", "bcrypt"], } - default_options = { "shared": False, "fPIC": True, - "encryption": "openssl" + "encryption": "openssl", } - _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 + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires("protobuf/3.21.12") + if self.options.encryption == "openssl": + self.requires("openssl/[>=1.1 <4]") + elif self.options.encryption == "libsodium": + self.requires("libsodium/cci.20220430") def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) + check_min_cppstd(self, 11) if self.options.encryption == "bcrypt" and self.settings.os != "Windows": raise ConanInvalidConfiguration("bcrypt is only valid on Windows") def build_requirements(self): - self.build_requires("protobuf/3.17.1") + self.tool_requires("protobuf/") - def requirements(self): - self.requires("protobuf/3.17.1") + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + venv = VirtualBuildEnv(self) + venv.generate() + venv = VirtualRunEnv(self) + venv.generate(scope="build") + + tc = CMakeToolchain(self) + tc.variables["GAMENETWORKINGSOCKETS_BUILD_EXAMPLES"] = False + tc.variables["GAMENETWORKINGSOCKETS_BUILD_TESTS"] = False + tc.variables["Protobuf_USE_STATIC_LIBS"] = not self.dependencies["protobuf"].options.shared + tc.variables["Protobuf_IMPORT_DIRS"] = os.path.join(self.source_folder, "src", "common").replace("\\", "/") + crypto = { + "openssl": "OpenSSL", + "libsodium": "libsodium", + "bcrypt": "BCrypt", + } + tc.variables["USE_CRYPTO"] = crypto[str(self.options.encryption)] + crypto25519 = { + "openssl": "OpenSSL", + "libsodium": "libsodium", + "bcrypt": "Reference", + } + tc.variables["USE_CRYPTO25519"] = crypto25519[str(self.options.encryption)] if self.options.encryption == "openssl": - self.requires("openssl/1.1.1l") - elif self.options.encryption == "libsodium": - self.requires("libsodium/1.0.18") + tc.variables["OPENSSL_NEW_ENOUGH"] = True + tc.variables["OPENSSL_HAS_25519_RAW"] = True + tc.generate() - def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + 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) + # Disable MSVC runtime override + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "configure_msvc_runtime()", "") def build(self): self._patch_sources() - 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["BUILD_STATIC"] = not self.options.shared - self._cmake.definitions["BUILD_SHARED"] = self.options.shared - self._cmake.definitions["GAMENETWORKINGSOCKETS_BUILD_EXAMPLES"] = False - self._cmake.definitions["GAMENETWORKINGSOCKETS_BUILD_TESTS"] = False - self._cmake.definitions["Protobuf_USE_STATIC_LIBS"] = not self.options["protobuf"].shared - crypto = {"openssl": "OpenSSL", "libsodium": "libsodium", "bcrypt": "BCrypt"} - self._cmake.definitions["USE_CRYPTO"] = crypto[str(self.options.encryption)] - crypto25519 = {"openssl": "OpenSSL", "libsodium": "libsodium", "bcrypt": "Reference"} - self._cmake.definitions["USE_CRYPTO25519"] = crypto25519[str(self.options.encryption)] - if self.options.encryption == "openssl": - self._cmake.definitions["OPENSSL_NEW_ENOUGH"] = True - self._cmake.definitions["OPENSSL_HAS_25519_RAW"] = True - 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", + 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.names["cmake_find_package"] = "GameNetworkingSockets" - self.cpp_info.names["cmake_find_package_multi"] = "GameNetworkingSockets" - self.cpp_info.names["pkg_config"] = "GameNetworkingSockets" + self.cpp_info.set_property("cmake_file_name", "GameNetworkingSockets") + self.cpp_info.set_property("cmake_target_name", "GameNetworkingSockets::GameNetworkingSockets") + self.cpp_info.set_property("pkg_config_name", "GameNetworkingSockets") self.cpp_info.includedirs.append(os.path.join("include", "GameNetworkingSockets")) if self.options.shared: self.cpp_info.libs = ["GameNetworkingSockets"] @@ -120,7 +135,10 @@ def package_info(self): 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", "crypt32", "winmm"] + self.cpp_info.system_libs = ["ws2_32", "crypt32", "winmm", "iphlpapi"] if self.options.encryption == "bcrypt": self.cpp_info.system_libs += ["bcrypt"] - + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.names["cmake_find_package"] = "GameNetworkingSockets" + self.cpp_info.names["cmake_find_package_multi"] = "GameNetworkingSockets" diff --git a/recipes/gamenetworkingsockets/all/patches/001-disable-runtime-override.patch b/recipes/gamenetworkingsockets/all/patches/001-disable-runtime-override.patch deleted file mode 100644 index 652aea2685bb8..0000000000000 --- a/recipes/gamenetworkingsockets/all/patches/001-disable-runtime-override.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/CMakeLists.txt b/tmp/CMakeLists.txt -index 3471701..49efee3 100644 ---- a/CMakeLists.txt -+++ b/tmp/CMakeLists.txt -@@ -35,7 +35,7 @@ endif() - - include(FlagsMSVC) - set(MSVC_RUNTIME "dynamic") --configure_msvc_runtime() -+# configure_msvc_runtime() - print_default_msvc_flags() - - add_definitions( -DVALVE_CRYPTO_ENABLE_25519 ) diff --git a/recipes/gamenetworkingsockets/all/patches/002-either-static-or-shared.patch b/recipes/gamenetworkingsockets/all/patches/002-either-static-or-shared.patch deleted file mode 100644 index 47b3eec1ee41e..0000000000000 --- a/recipes/gamenetworkingsockets/all/patches/002-either-static-or-shared.patch +++ /dev/null @@ -1,49 +0,0 @@ -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 7040ab3..c75897e 100644 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -282,28 +282,38 @@ macro(gamenetworkingsockets_common GNS_TARGET) - - endmacro() - -+if (BUILD_SHARED) - add_library(GameNetworkingSockets SHARED "") - add_library(GameNetworkingSockets::GameNetworkingSockets ALIAS GameNetworkingSockets) - add_library(GameNetworkingSockets::shared ALIAS GameNetworkingSockets) - gamenetworkingsockets_common(GameNetworkingSockets) - -+install( -+ TARGETS GameNetworkingSockets -+ EXPORT GameNetworkingSockets -+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} -+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} -+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} -+) -+endif() -+ -+if (BUILD_STATIC) - add_library(GameNetworkingSockets_s STATIC "") - add_library(GameNetworkingSockets::GameNetworkingSockets_s ALIAS GameNetworkingSockets_s) - add_library(GameNetworkingSockets::static ALIAS GameNetworkingSockets_s) - target_compile_definitions(GameNetworkingSockets_s INTERFACE STEAMNETWORKINGSOCKETS_STATIC_LINK) - gamenetworkingsockets_common(GameNetworkingSockets_s) - --# Install rules -- - install( -- TARGETS -- GameNetworkingSockets -- GameNetworkingSockets_s -+ TARGETS GameNetworkingSockets_s - EXPORT GameNetworkingSockets - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} -- ) -+) -+endif() -+ -+# Install rules - - install(DIRECTORY ../include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/GameNetworkingSockets) - diff --git a/recipes/gamenetworkingsockets/all/test_package/CMakeLists.txt b/recipes/gamenetworkingsockets/all/test_package/CMakeLists.txt index cb6bc1b893324..b45b07ce89114 100644 --- a/recipes/gamenetworkingsockets/all/test_package/CMakeLists.txt +++ b/recipes/gamenetworkingsockets/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(GameNetworkingSockets REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) target_link_libraries(${PROJECT_NAME} GameNetworkingSockets::GameNetworkingSockets) diff --git a/recipes/gamenetworkingsockets/all/test_package/conanfile.py b/recipes/gamenetworkingsockets/all/test_package/conanfile.py index 38f4483872d47..ef5d7042163ec 100644 --- a/recipes/gamenetworkingsockets/all/test_package/conanfile.py +++ b/recipes/gamenetworkingsockets/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/gamenetworkingsockets/all/test_v1_package/CMakeLists.txt b/recipes/gamenetworkingsockets/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/gamenetworkingsockets/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/gamenetworkingsockets/all/test_v1_package/conanfile.py b/recipes/gamenetworkingsockets/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/gamenetworkingsockets/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/gamenetworkingsockets/config.yml b/recipes/gamenetworkingsockets/config.yml index 426a0e4c79e9b..4709a2eb80f4c 100644 --- a/recipes/gamenetworkingsockets/config.yml +++ b/recipes/gamenetworkingsockets/config.yml @@ -1,3 +1,3 @@ versions: - "1.3.0": + "1.4.1": folder: all diff --git a/recipes/games101-cgl/all/conandata.yml b/recipes/games101-cgl/all/conandata.yml new file mode 100644 index 0000000000000..73b714f87c14e --- /dev/null +++ b/recipes/games101-cgl/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.1.0": + url: "https://github.com/endingly/games101-cgl/archive/refs/tags/v0.1.0.zip" + sha256: dc17b76ed4f2d9222c17a75ab22e07f156f077d0a243f35539b4439cc0cb9ae9 diff --git a/recipes/games101-cgl/all/conanfile.py b/recipes/games101-cgl/all/conanfile.py new file mode 100644 index 0000000000000..370dac2201804 --- /dev/null +++ b/recipes/games101-cgl/all/conanfile.py @@ -0,0 +1,91 @@ +from conan import ConanFile +from conan.tools.files import get, copy, rmdir, rm +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +import os + +required_conan_version = ">=1.55.0" + +class Games101CglConan(ConanFile): + name = "games101-cgl" + description = "The package is for Games101's homework8 subproject" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/endingly/games101-cgl" + topics = ("games101", "graphics") + package_type = "library" + 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 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("freetype/2.13.2") + self.requires("glew/2.2.0", transitive_headers=True) + self.requires("glfw/3.4", transitive_headers=True) + + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + + def build_requirements(self): + self.tool_requires("cmake/[>=3.25 <4.0.0]") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + toolchain = CMakeToolchain(self) + toolchain.generate() + deps = CMakeDeps(self) + deps.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")) + 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): + suffix = "d" if self.settings.build_type == "Debug" else "" + self.cpp_info.libs = ["CGL" + suffix] + + self.cpp_info.set_property("cmake_file_name", "games101-cgl") + self.cpp_info.set_property("cmake_target_name", "games101-cgl::games101-cgl") + + # TODO: to remove in conan v2 once cmake_find_package* generators removed + self.cpp_info.filenames["cmake_find_package"] = "games101-cgl" + self.cpp_info.filenames["cmake_find_package_multi"] = "games101-cgl" + self.cpp_info.names["cmake_find_package"] = "games101-cgl" + self.cpp_info.names["cmake_find_package_multi"] = "games101-cgl" diff --git a/recipes/games101-cgl/all/test_package/CMakeLists.txt b/recipes/games101-cgl/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..fbd0be167add6 --- /dev/null +++ b/recipes/games101-cgl/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(games101-cgl REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE games101-cgl::games101-cgl) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/games101-cgl/all/test_package/conanfile.py b/recipes/games101-cgl/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fbb7f543162 --- /dev/null +++ b/recipes/games101-cgl/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/games101-cgl/all/test_package/test_package.cpp b/recipes/games101-cgl/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..94b4226d74ca7 --- /dev/null +++ b/recipes/games101-cgl/all/test_package/test_package.cpp @@ -0,0 +1,8 @@ +#include + +#include + +int main() { + CGL::Vector2D vector{5, 4}; + std::cout << vector << '\n'; +} diff --git a/recipes/games101-cgl/all/test_v1_package/CMakeLists.txt b/recipes/games101-cgl/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..be00a8c7f57c7 --- /dev/null +++ b/recipes/games101-cgl/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/qcbor/all/test_v1_package/conanfile.py b/recipes/games101-cgl/all/test_v1_package/conanfile.py similarity index 100% rename from recipes/qcbor/all/test_v1_package/conanfile.py rename to recipes/games101-cgl/all/test_v1_package/conanfile.py diff --git a/recipes/games101-cgl/config.yml b/recipes/games101-cgl/config.yml new file mode 100644 index 0000000000000..6c11a439d0bc2 --- /dev/null +++ b/recipes/games101-cgl/config.yml @@ -0,0 +1,3 @@ +versions: + "0.1.0": + folder: all diff --git a/recipes/gamma/all/CMakeLists.txt b/recipes/gamma/all/CMakeLists.txt index d7ab29edac81b..c614cd0c1e028 100644 --- a/recipes/gamma/all/CMakeLists.txt +++ b/recipes/gamma/all/CMakeLists.txt @@ -26,9 +26,13 @@ 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) -find_library(LIBM NAMES m) -if(LIBM) - target_link_libraries(Gamma PRIVATE ${LIBM}) +find_package(Threads REQUIRED) +target_link_libraries(Gamma PRIVATE Threads::Threads) + +include(CheckFunctionExists) +check_function_exists(pow HAVE_MATH_SYSTEM) +if(NOT HAVE_MATH_SYSTEM) + target_link_libraries(Gamma PRIVATE m) endif() if(GAMMA_AUDIO_IO) diff --git a/recipes/gamma/all/conanfile.py b/recipes/gamma/all/conanfile.py index 451083af4f13c..b5f3681984e45 100644 --- a/recipes/gamma/all/conanfile.py +++ b/recipes/gamma/all/conanfile.py @@ -5,7 +5,7 @@ from conan.tools.files import copy, get import os -required_conan_version = ">=1.51.1" +required_conan_version = ">=1.53.0" class Gammaconan(ConanFile): @@ -19,6 +19,7 @@ class Gammaconan(ConanFile): homepage = "https://github.com/LancePutnam/Gamma" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -41,31 +42,27 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") def requirements(self): if self.options.soundfile: - self.requires("libsndfile/1.0.31") + self.requires("libsndfile/1.2.0") def validate(self): - if self.info.settings.compiler.get_safe("cppstd"): + if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, 14) - if self.info.options.audio_io: + if self.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): - 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) @@ -89,4 +86,4 @@ def package(self): def package_info(self): self.cpp_info.libs = ["Gamma"] if not self.options.shared and self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.system_libs.append("m") + self.cpp_info.system_libs.extend(["m", "pthread"]) diff --git a/recipes/gamma/all/test_v1_package/CMakeLists.txt b/recipes/gamma/all/test_v1_package/CMakeLists.txt index c32216450f32e..0d20897301b68 100644 --- a/recipes/gamma/all/test_v1_package/CMakeLists.txt +++ b/recipes/gamma/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(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) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/gcc/all/conandata.yml b/recipes/gcc/all/conandata.yml index dcd31b786fcb0..f7f3429651883 100644 --- a/recipes/gcc/all/conandata.yml +++ b/recipes/gcc/all/conandata.yml @@ -1,7 +1,10 @@ sources: - "10.2.0": - sha256: 27e879dccc639cd7b0cc08ed575c1669492579529b53c9ff27b0b96265fa867d - url: https://ftp.gnu.org/gnu/gcc/gcc-10.2.0/gcc-10.2.0.tar.gz "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..da18e51121b44 100644 --- a/recipes/gcc/all/conanfile.py +++ b/recipes/gcc/all/conanfile.py @@ -1,126 +1,191 @@ -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 + + # https://github.com/gcc-mirror/gcc/blob/6b5248d15c6d10325c6cbb92a0e0a9eb04e3f122/libcody/configure#L2505C11-L2505C25 + del self.settings.compiler.cppstd + + 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.42") + 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("mpfr/4.2.0") + self.requires("gmp/6.3.0") + self.requires("zlib/[>=1.2.13 <2]") + self.requires("isl/0.26") - 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 a9e585e6ddfd4..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 = 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) + 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 52029834a425b..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("Hello, World!\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 e59b7b15826e3..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 << "Hello, World!\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 204a7032b0bc4..20d860f029e5e 100644 --- a/recipes/gcc/config.yml +++ b/recipes/gcc/config.yml @@ -1,5 +1,7 @@ versions: - "10.2.0": - folder: all "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 58f1cc5b754a9..08aecb09abbd3 100644 --- a/recipes/gcem/all/conandata.yml +++ b/recipes/gcem/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "1.18.0": + url: "https://github.com/kthohr/gcem/archive/v1.18.0.tar.gz" + sha256: "8e71a9f5b62956da6c409dda44b483f98c4a98ae72184f3aa4659ae5b3462e61" + "1.17.0": + url: "https://github.com/kthohr/gcem/archive/v1.17.0.tar.gz" + sha256: "74cc499e2db247c32f1ce82fc22022d22e0f0a110ecd19281269289a9e78a6f8" "1.16.0": url: "https://github.com/kthohr/gcem/archive/v1.16.0.tar.gz" sha256: "119c742b9371c0adc7d9cd710c3cbc575459a98fb63f6be4c636215dcf8404ce" diff --git a/recipes/gcem/all/conanfile.py b/recipes/gcem/all/conanfile.py index 90bc15dd9edc5..a5ff425216138 100644 --- a/recipes/gcem/all/conanfile.py +++ b/recipes/gcem/all/conanfile.py @@ -13,11 +13,12 @@ class GcemConan(ConanFile): description = "A C++ compile-time math library using generalized " \ "constant expressions." license = "Apache-2.0" - topics = ("gcem", "math", "header-only") + topics = ("math", "header-only") homepage = "https://github.com/kthohr/gcem" url = "https://github.com/conan-io/conan-center-index" + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - settings = "os", "arch", "compiler", "build_type", def layout(self): basic_layout(self, src_folder="src") @@ -30,8 +31,7 @@ def validate(self): 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 build(self): pass diff --git a/recipes/gcem/config.yml b/recipes/gcem/config.yml index cc18649bfe195..93586d1055a3b 100644 --- a/recipes/gcem/config.yml +++ b/recipes/gcem/config.yml @@ -1,4 +1,8 @@ versions: + "1.18.0": + folder: all + "1.17.0": + folder: all "1.16.0": folder: all "1.14.1": diff --git a/recipes/gdal/config.yml b/recipes/gdal/config.yml index 3a324b7465d34..60275f391db83 100644 --- a/recipes/gdal/config.yml +++ b/recipes/gdal/config.yml @@ -1,15 +1,11 @@ versions: - "3.5.2": + "3.8.3": folder: "post_3.5.0" - "3.5.1": + "3.7.3": + folder: "post_3.5.0" + "3.5.3": folder: "post_3.5.0" "3.4.3": folder: "pre_3.5.0" "3.4.1": folder: "pre_3.5.0" - "3.3.3": - folder: "pre_3.5.0" - "3.2.3": - folder: "pre_3.5.0" - "3.1.4": - folder: "pre_3.5.0" diff --git a/recipes/gdal/post_3.5.0/CMakeLists.txt b/recipes/gdal/post_3.5.0/CMakeLists.txt index c0e666f41f1de..1a526ad3ffa0e 100644 --- a/recipes/gdal/post_3.5.0/CMakeLists.txt +++ b/recipes/gdal/post_3.5.0/CMakeLists.txt @@ -1,50 +1,7 @@ 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}) +if (GDAL_USE_OPENEXR) find_package(Imath REQUIRED) find_package(OpenEXR REQUIRED) add_library(OpenEXR::IlmImf ALIAS OpenEXR::IlmThread) @@ -56,62 +13,4 @@ if (${GDAL_USE_OPENEXR}) 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") +add_subdirectory(src) diff --git a/recipes/gdal/post_3.5.0/cmake/ConanFindPackage.cmake b/recipes/gdal/post_3.5.0/cmake/ConanFindPackage.cmake new file mode 100644 index 0000000000000..cc5455d748073 --- /dev/null +++ b/recipes/gdal/post_3.5.0/cmake/ConanFindPackage.cmake @@ -0,0 +1,48 @@ +function(define_find_package2 pkgname include_file library_name) +endfunction() +function(find_package2 pkgname) + # Remove args unsupported by find_package() + list(REMOVE_ITEM ARGN OUT_DEPENDENCY _find_dependency) + # Force CONFIG mode + list(REMOVE_ITEM ARGN MODULE NO_CONFIG NO_MODULE) + string(TOUPPER ${pkgname} key) + if(DEFINED GDAL_USE_${key} AND NOT GDAL_USE_${key}) + set(${pkgname}_FOUND) + set(${key}_FOUND) + return() + endif() + find_package(${pkgname} ${ARGN} + QUIET + CONFIG + GLOBAL + # Forbid the use of system libs entirely + NO_DEFAULT_PATH + PATHS ${CMAKE_PREFIX_PATH} + ) + # Add variables with upper-case package name in addition to the default ones + set(targets "") + foreach(lib ${${pkgname}_LIBRARIES}) + if(TARGET ${lib}) + list(APPEND targets ${lib}) + endif() + endforeach() + # Add upper-case variables + set(${key}_DEFINITIONS "${${pkgname}_DEFINITIONS}" CACHE STRING "") + set(${key}_FOUND ${${pkgname}_FOUND} CACHE BOOL "") + set(${key}_INCLUDE_DIR "${${pkgname}_INCLUDE_DIR}" CACHE STRING "") + set(${key}_INCLUDE_DIRS "${${pkgname}_INCLUDE_DIRS}" CACHE STRING "") + set(${key}_LIBRARIES "${${pkgname}_LIBRARIES}" CACHE STRING "") + set(${key}_LIBRARY "${${pkgname}_LIBRARIES}" CACHE STRING "") + set(${key}_TARGET "${targets}" CACHE STRING "") + set(${key}_VERSION ${${pkgname}_VERSION} CACHE BOOL "") + + # Add as cache vars for global visibility + set(${pkgname}_FOUND ${${pkgname}_FOUND} CACHE BOOL "") + set(${pkgname}_TARGET "${targets}" CACHE STRING "") + set(${pkgname}_VERSION ${${pkgname}_VERSION_STRING} CACHE BOOL "") + + message(STATUS "Found ${pkgname}: ${${pkgname}_FOUND}") + message(STATUS " ${key}_TARGET: ${${key}_TARGET}") + message(STATUS " ${key}_LIBRARIES: ${${key}_LIBRARIES}") + message(STATUS " ${key}_INCLUDE_DIRS: ${${key}_INCLUDE_DIRS}") +endfunction() diff --git a/recipes/gdal/post_3.5.0/conandata.yml b/recipes/gdal/post_3.5.0/conandata.yml index 2dbc2d17b374f..159958b913d13 100644 --- a/recipes/gdal/post_3.5.0/conandata.yml +++ b/recipes/gdal/post_3.5.0/conandata.yml @@ -1,14 +1,41 @@ 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" + "3.8.3": + url: "https://github.com/OSGeo/gdal/releases/download/v3.8.3/gdal-3.8.3.tar.gz" + sha256: "f7a30387a8239e9da26200f787a02136df2ee6473e86b36d05ad682761a049ea" + "3.7.3": + url: "https://github.com/OSGeo/gdal/releases/download/v3.7.3/gdal-3.7.3.tar.gz" + sha256: "f66161e10b8b89a8a541cd760cd36d490114ed3f020a26db1489a6154db5d2be" + "3.5.3": + url: "https://github.com/OSGeo/gdal/releases/download/v3.5.3/gdal-3.5.3.tar.gz" + sha256: "a9ea0300d17e35bab71df4f16e62bb2fb8081caf994ab3ee0502ce4cf0d4e593" 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" + "3.8.3": + - patch_file: "patches/3.8.1/0-replace-find-package.patch" + patch_description: "Use custom version of find_package() for Conan deps" + patch_type: "conan" + - patch_file: "patches/3.7.3/1-do-not-force-private-linking.patch" + patch_description: "Fix private linking not working for some Conan dependencies" + patch_type: "conan" + - patch_file: "patches/3.5.3/2-allow-cycles-in-cmake-targets.patch" + patch_description: "Fix CMake failure due to cyclical dependencies in CMakeDeps targets" + patch_type: "conan" + "3.7.3": + - patch_file: "patches/3.7.3/0-replace-find-package.patch" + patch_description: "Use custom version of find_package() for Conan deps" + patch_type: "conan" + - patch_file: "patches/3.7.3/1-do-not-force-private-linking.patch" + patch_description: "Fix private linking not working for some Conan dependencies" + patch_type: "conan" + - patch_file: "patches/3.5.3/2-allow-cycles-in-cmake-targets.patch" + patch_description: "Fix CMake failure due to cyclical dependencies in CMakeDeps targets" + patch_type: "conan" + "3.5.3": + - patch_file: "patches/3.5.3/0-replace-find-package.patch" + patch_description: "Use custom version of find_package() for Conan deps" + patch_type: "conan" + - patch_file: "patches/3.5.3/1-do-not-force-private-linking.patch" + patch_description: "Fix private linking not working for some Conan dependencies" + patch_type: "conan" + - patch_file: "patches/3.5.3/2-allow-cycles-in-cmake-targets.patch" + patch_description: "Fix CMake failure due to cyclical dependencies in CMakeDeps targets" + patch_type: "conan" diff --git a/recipes/gdal/post_3.5.0/conanfile.py b/recipes/gdal/post_3.5.0/conanfile.py index d03de4e5125cc..49c2e7d3e5d6e 100644 --- a/recipes/gdal/post_3.5.0/conanfile.py +++ b/recipes/gdal/post_3.5.0/conanfile.py @@ -1,42 +1,42 @@ +import os + 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 +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.microsoft import is_msvc +from conan.tools.scm import Version + +required_conan_version = ">=1.52.0" + 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" + homepage = "https://github.com/OSGeo/gdal" + topics = ("osgeo", "geospatial", "raster", "vector") + package_type = "library" 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_basisu": [True, False], "with_blosc": [True, False], + "with_brunsli": [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_crypto": ["deprecated", True, False], "with_cryptopp": [True, False], "with_curl": [True, False], "with_dds": [True, False], + "with_ecw": [True, False], "with_expat": [True, False], "with_exr": [True, False], "with_freexl": [True, False], @@ -46,48 +46,64 @@ class GdalConan(ConanFile): "with_hdf4": [True, False], "with_hdf5": [True, False], "with_heif": [True, False], + "with_jpeg": [False, "libjpeg", "libjpeg-turbo"], + "with_jxl": [True, False], "with_kea": [True, False], + "with_lerc": [True, False], + "with_libaec": [True, False], + "with_libarchive": [True, False], + "with_libcsf": [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_libtiff": ["deprecated", True, False], # always enabled + "with_lzma": [True, False], "with_lz4": [True, False], "with_mongocxx": [True, False], - "with_mysql": [None, "libmysqlclient", "mariadb-connector-c"], + "with_mysql": [False, "libmysqlclient", "mariadb-connector-c"], "with_netcdf": [True, False], "with_odbc": [True, False], + "with_opencad": [True, False], + "with_opencl": [True, False], "with_openjpeg": [True, False], "with_openssl": [True, False], "with_pcre": [True, False], "with_pcre2": [True, False], + # "with_pdfium": [True, False], "with_pg": [True, False], "with_png": [True, False], "with_podofo": [True, False], "with_poppler": [True, False], - "with_proj": [True, False], + "with_proj": ["deprecated", True, False], # always enabled + "with_publicdecompwt": [True, False], "with_qhull": [True, False], + "with_rasterlite2": [True, False], + "with_shapelib": [True, False], + "with_spatialite": [True, False], "with_sqlite3": [True, False], + "with_tiledb": [True, False], "with_webp": [True, False], "with_xerces": [True, False], "with_xml2": [True, False], - "with_zlib": [True, False], + "with_zlib": ["deprecated", True, False], # always enabled "with_zstd": [True, False], } - default_options = { "shared": False, "fPIC": True, "tools": False, "with_armadillo": False, - "with_arrow": False, + "with_arrow": True, + "with_basisu": False, "with_blosc": False, + "with_brunsli": False, "with_cfitsio": False, "with_crypto": "deprecated", "with_cryptopp": False, - "with_curl": False, + "with_curl": True, "with_dds": False, - "with_expat": False, + "with_ecw": False, + "with_expat": True, "with_exr": False, "with_freexl": False, "with_geos": True, @@ -96,211 +112,220 @@ class GdalConan(ConanFile): "with_hdf4": False, "with_hdf5": False, "with_heif": False, + "with_jpeg": "libjpeg", + "with_jxl": False, "with_kea": False, + "with_lerc": True, + "with_libaec": False, + "with_libarchive": False, + "with_libcsf": True, "with_libdeflate": True, "with_libiconv": True, - "with_jpeg": "libjpeg", "with_libkml": False, - "with_libtiff": True, + "with_libtiff": "deprecated", + "with_lzma": False, "with_lz4": False, "with_mongocxx": False, - "with_mysql": None, + "with_mysql": False, "with_netcdf": False, "with_odbc": False, + "with_opencad": False, + "with_opencl": True, "with_openjpeg": False, "with_openssl": False, "with_pcre": False, "with_pcre2": False, + # "with_pdfium": False, "with_pg": False, "with_png": True, "with_podofo": False, "with_poppler": False, - "with_proj": True, + "with_proj": "deprecated", + "with_publicdecompwt": False, "with_qhull": True, + "with_rasterlite2": False, + "with_shapelib": True, + "with_spatialite": False, "with_sqlite3": True, + "with_tiledb": False, "with_webp": False, "with_xerces": False, "with_xml2": False, - "with_zlib": True, + "with_zlib": "deprecated", "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"]) + copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder) + export_conandata_patches(self) + copy(self, "*.cmake", + src=os.path.join(self.recipe_folder, "cmake"), + dst=os.path.join(self.export_sources_folder, "src", "cmake", "helpers")) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + if Version(self.version) < "3.7": + # Latest versions of Arrow are no longer compatible with GDAL 3.5 + self.options.with_arrow = False + if Version(self.version) < "3.8": + del self.options.with_libaec 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 + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("json-c/0.16") + self.requires("json-c/0.17") self.requires("libgeotiff/1.7.1") - + self.requires("libtiff/4.6.0") + self.requires("proj/9.3.1") + # Used in a public header here: + # https://github.com/OSGeo/gdal/blob/v3.7.1/port/cpl_minizip_ioapi.h#L26 + self.requires("zlib/[>=1.2.11 <2]", transitive_headers=True, transitive_libs=True) if self.options.with_armadillo: - self.requires("armadillo/10.7.3") - + self.requires("armadillo/12.6.4") if self.options.with_arrow: - self.requires("arrow/8.0.1") - + self.requires("arrow/14.0.2") + if self.options.with_basisu: + self.requires("libbasisu/1.15.0") if self.options.with_blosc: - self.requires("c-blosc/1.21.1") - + self.requires("c-blosc/1.21.5") + if self.options.with_brunsli: + self.requires("brunsli/cci.20231024") if self.options.with_cfitsio: - self.requires("cfitsio/4.1.0") - + self.requires("cfitsio/4.3.1") if self.options.with_cryptopp: - self.requires("cryptopp/8.7.0") - + self.requires("cryptopp/8.9.0") if self.options.with_curl: - self.requires("libcurl/7.85.0") - + self.requires("libcurl/[>=7.78 <9]") if self.options.with_dds: self.requires("crunch/cci.20190615") - + if self.options.with_ecw: + self.requires("libecwj2/3.3") if self.options.with_expat: - self.requires("expat/2.4.9") - + self.requires("expat/2.5.0") if self.options.with_exr: - self.requires("openexr/3.1.5") - self.requires("imath/3.1.5") - + self.requires("openexr/3.2.1") + self.requires("imath/3.1.9") if self.options.with_freexl: - self.requires("freexl/1.0.6") - + self.requires("freexl/2.0.0") if self.options.with_geos: - self.requires("geos/3.11.0") - + self.requires("geos/3.12.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") - + self.requires("hdf4/4.2.16-2") if self.options.with_hdf5: - self.requires("hdf5/1.13.1") - + self.requires("hdf5/1.14.3") if self.options.with_heif: - self.requires("libheif/1.13.0") - + self.requires("libheif/1.16.2") if self.options.with_jpeg == "libjpeg": self.requires("libjpeg/9e") elif self.options.with_jpeg == "libjpeg-turbo": - self.requires("libjpeg-turbo/2.1.4") - + self.requires("libjpeg-turbo/3.0.1") + if self.options.with_jxl: + self.requires("libjxl/0.6.1") if self.options.with_kea: self.requires("kealib/1.4.14") - + if self.options.with_lerc: + self.requires("lerc/4.0.1") + if self.options.get_safe("with_libaec"): + self.requires("libaec/1.0.6") + if self.options.with_libarchive: + self.requires("libarchive/3.7.2") if self.options.with_libdeflate: - self.requires("libdeflate/1.12") - + self.requires("libdeflate/1.19") 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_lzma: + self.requires("xz_utils/5.4.5") if self.options.with_lz4: self.requires("lz4/1.9.4") - if self.options.with_mongocxx: - self.requires("mongo-cxx-driver/3.6.7") - + self.requires("mongo-cxx-driver/3.8.1") if self.options.with_mysql == "libmysqlclient": - self.requires("libmysqlclient/8.0.30") + self.requires("libmysqlclient/8.1.0") elif self.options.with_mysql == "mariadb-connector-c": - self.requires("mariadb-connector-c/3.1.12") - + self.requires("mariadb-connector-c/3.3.3") 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_opencl: + self.requires("opencl-icd-loader/2023.12.14") if self.options.with_openjpeg: self.requires("openjpeg/2.5.0") - if self.options.with_openssl: - self.requires("openssl/1.1.1q") - + self.requires("openssl/[>=1.1 <4]") if self.options.with_pcre: self.requires("pcre/8.45") - if self.options.with_pcre2: - self.requires("pcre2/10.40") - + self.requires("pcre2/10.42") + # TODO: pdfium recipe needs to be compatible with https://github.com/rouault/pdfium_build_gdal_3_8 + # if self.options.with_pdfium: + # self.requires("pdfium/95.0.4629") if self.options.with_pg: - self.requires("libpq/14.5") - + # libpq 15+ is not supported + self.requires("libpq/14.9") if self.options.with_png: - self.requires("libpng/1.6.38") - + self.requires("libpng/1.6.40") 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_rasterlite2: + self.requires("librasterlite2/1.1.0-beta1") + if self.options.with_spatialite: + self.requires("libspatialite/5.0.1") if self.options.with_sqlite3: - self.requires("sqlite3/3.39.3") - + self.requires("sqlite3/3.44.2") + if self.options.with_tiledb: + self.requires("tiledb/2.17.4") if self.options.with_webp: - self.requires("libwebp/1.2.4") - + self.requires("libwebp/1.3.2") if self.options.with_xerces: - self.requires("xerces-c/3.2.3") - + self.requires("xerces-c/3.2.5") if self.options.with_xml2: - self.requires("libxml2/2.9.14") - - if self.options.with_zlib: - self.requires("zlib/1.2.12") - + self.requires("libxml2/2.12.3") if self.options.with_zstd: - self.requires("zstd/1.5.2") + self.requires("zstd/1.5.5") + # Use of external shapelib is not recommended and is currently broken. + # https://github.com/OSGeo/gdal/issues/5711 + # if self.options.with_shapelib: + # self.requires("shapelib/1.6.0") + + def build_requirements(self): + # https://github.com/conan-io/conan/issues/3482#issuecomment-662284561 + self.tool_requires("cmake/[>=3.18 <4]") def package_id(self): + # Ignore deprecated options del self.info.options.with_crypto + del self.info.options.with_libtiff + del self.info.options.with_proj + del self.info.options.with_zlib def validate(self): - if self.options.get_safe("with_pcre") and self.options.get_safe("with_pcre2"): + for option in ["crypto", "zlib", "proj", "libtiff"]: + if self.options.get_safe(f"with_{option}") != "deprecated": + self.output.warning(f"{self.ref}:with_{option} option is deprecated. The {option} dependecy is always enabled now.") + if self.options.with_pcre and self.options.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: + if self.options.with_sqlite3 and not self.dependencies["sqlite3"].options.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"): + if self.dependencies["libtiff"].options.jpeg != self.options.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: @@ -309,591 +334,488 @@ def validate(self): 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"): + if self.options.with_poppler and self.dependencies["poppler"].options.with_libjpeg != self.options.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 + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["GDAL_OBJECT_LIBRARIES_POSITION_INDEPENDENT_CODE"] = self.options.get_safe("fPIC", True) + tc.variables["GDAL_SET_INSTALL_RELATIVE_RPATH"] = True + + tc.variables["BUILD_JAVA_BINDINGS"] = False + tc.variables["BUILD_CSHARP_BINDINGS"] = False + tc.variables["BUILD_PYTHON_BINDINGS"] = False + tc.variables["BUILD_APPS"] = self.options.tools + tc.variables["BUILD_TESTING"] = False + + tc.variables["GDAL_USE_ARCHIVE"] = self.options.with_libarchive + tc.variables["GDAL_USE_ARMADILLO"] = self.options.with_armadillo + tc.variables["GDAL_USE_ARROW"] = self.options.with_arrow + tc.variables["GDAL_USE_ARROWDATASET"] = self.options.with_arrow and self.dependencies["arrow"].options.dataset_modules + tc.variables["GDAL_USE_BASISU"] = self.options.with_basisu + tc.variables["GDAL_USE_BLOSC"] = self.options.with_blosc + tc.variables["GDAL_USE_BRUNSLI"] = self.options.with_brunsli + tc.variables["GDAL_USE_CFITSIO"] = self.options.with_cfitsio + tc.variables["GDAL_USE_CRNLIB"] = self.options.with_dds + tc.variables["GDAL_USE_CRYPTOPP"] = self.options.with_cryptopp + tc.variables["GDAL_USE_CURL"] = self.options.with_curl + tc.variables["GDAL_USE_DEFLATE"] = self.options.with_libdeflate + tc.variables["GDAL_USE_ECW"] = self.options.with_ecw + tc.variables["GDAL_USE_EXPAT"] = self.options.with_expat + tc.variables["GDAL_USE_FILEGDB"] = False + tc.variables["GDAL_USE_FREEXL"] = self.options.with_freexl + tc.variables["GDAL_USE_FYBA"] = False + tc.variables["GDAL_USE_GEOS"] = self.options.with_geos + tc.variables["GDAL_USE_GEOTIFF"] = True + tc.variables["GDAL_USE_GEOTIFF_INTERNAL"] = False + tc.variables["GDAL_USE_GIF"] = self.options.with_gif + tc.variables["GDAL_USE_GIF_INTERNAL"] = False + tc.variables["GDAL_USE_GTA"] = self.options.with_gta + tc.variables["GDAL_USE_HDF4"] = self.options.with_hdf4 + tc.variables["GDAL_USE_HDF5"] = self.options.with_hdf5 + tc.variables["GDAL_USE_HDFS"] = False + tc.variables["GDAL_USE_HEIF"] = self.options.with_heif + tc.variables["GDAL_USE_ICONV"] = self.options.with_libiconv + tc.variables["GDAL_USE_IDB"] = False + tc.variables["GDAL_USE_JPEG"] = bool(self.options.with_jpeg) + tc.variables["GDAL_USE_JPEG_INTERNAL"] = False + tc.variables["GDAL_USE_JPEG12_INTERNAL"] = False + tc.variables["GDAL_USE_JSONC"] = True + tc.variables["GDAL_USE_JSONC_INTERNAL"] = False + tc.variables["GDAL_USE_JXL"] = self.options.with_jxl + tc.variables["GDAL_USE_JXL_THREADS"] = self.options.with_jxl + tc.variables["GDAL_USE_KDU"] = False + tc.variables["GDAL_USE_KEA"] = self.options.with_kea + tc.variables["GDAL_USE_LERC"] = self.options.with_lerc + tc.variables["GDAL_USE_LERC_INTERNAL"] = False + tc.variables["GDAL_USE_LIBAEC"] = self.options.get_safe("with_libaec", False) + tc.variables["GDAL_USE_LIBCSF"] = False + tc.variables["GDAL_USE_LIBCSF_INTERNAL"] = self.options.with_libcsf + tc.variables["GDAL_USE_LIBKML"] = self.options.with_libkml + tc.variables["GDAL_USE_LIBLZMA"] = self.options.with_lzma + tc.variables["GDAL_USE_LIBQB3"] = False + tc.variables["GDAL_USE_LIBXML2"] = self.options.with_xml2 + tc.variables["GDAL_USE_LURATECH"] = False + tc.variables["GDAL_USE_LZ4"] = self.options.with_lz4 + tc.variables["GDAL_USE_MONGOCXX"] = self.options.with_mongocxx + tc.variables["GDAL_USE_MRSID"] = False + tc.variables["GDAL_USE_MSSQL_NCLI"] = False + tc.variables["GDAL_USE_MSSQL_ODBC"] = False + tc.variables["GDAL_USE_MYSQL"] = bool(self.options.with_mysql) + tc.variables["GDAL_USE_NETCDF"] = self.options.with_netcdf + tc.variables["GDAL_USE_ODBC"] = self.options.with_odbc + tc.variables["GDAL_USE_ODBCCPP"] = False + tc.variables["GDAL_USE_OGDI"] = False + tc.variables["GDAL_USE_OPENCAD"] = False + tc.variables["GDAL_USE_OPENCAD_INTERNAL"] = self.options.with_opencad + tc.variables["GDAL_USE_OPENCL"] = self.options.with_opencl + tc.variables["GDAL_USE_OPENEXR"] = self.options.with_exr + tc.variables["GDAL_USE_OPENJPEG"] = self.options.with_openjpeg + tc.variables["GDAL_USE_OPENSSL"] = self.options.with_openssl + tc.variables["GDAL_USE_ORACLE"] = False + tc.variables["GDAL_USE_PARQUET"] = self.options.with_arrow and self.dependencies["arrow"].options.parquet + tc.variables["GDAL_USE_PCRE"] = self.options.with_pcre + tc.variables["GDAL_USE_PCRE2"] = self.options.with_pcre2 + tc.variables["GDAL_USE_PDFIUM"] = False # self.options.with_pdfium + tc.variables["GDAL_USE_PNG"] = self.options.with_png + tc.variables["GDAL_USE_PNG_INTERNAL"] = False + tc.variables["GDAL_USE_PODOFO"] = self.options.with_podofo + tc.variables["GDAL_USE_POPPLER"] = self.options.with_poppler + tc.variables["GDAL_USE_POSTGRESQL"] = self.options.with_pg + tc.variables["GDAL_USE_PUBLICDECOMPWT"] = self.options.with_publicdecompwt + tc.variables["GDAL_USE_QHULL"] = self.options.with_qhull + tc.variables["GDAL_USE_QHULL_INTERNAL"] = False + tc.variables["GDAL_USE_RASTERLITE2"] = self.options.with_rasterlite2 + tc.variables["GDAL_USE_SFCGAL"] = False + tc.variables["GDAL_USE_SHAPELIB"] = False + tc.variables["GDAL_USE_SHAPELIB_INTERNAL"] = self.options.with_shapelib + tc.variables["GDAL_USE_SPATIALITE"] = self.options.with_spatialite + tc.variables["GDAL_USE_SQLITE3"] = self.options.with_sqlite3 + tc.variables["GDAL_USE_TEIGHA"] = False + tc.variables["GDAL_USE_TIFF_INTERNAL"] = False + tc.variables["GDAL_USE_TILEDB"] = self.options.with_tiledb + tc.variables["GDAL_USE_WEBP"] = self.options.with_webp + tc.variables["GDAL_USE_XERCESC"] = self.options.with_xerces + tc.variables["GDAL_USE_ZLIB"] = True + tc.variables["GDAL_USE_ZLIB_INTERNAL"] = False + tc.variables["GDAL_USE_ZSTD"] = self.options.with_zstd + + tc.variables["Parquet_FOUND"] = self.options.with_arrow and self.dependencies["arrow"].options.parquet + tc.variables["ArrowDataset_FOUND"] = self.options.with_arrow and self.dependencies["arrow"].options.dataset_modules + + # General workaround for try_compile() tests in the project + # https://github.com/conan-io/conan/issues/12180 + tc.variables["CMAKE_TRY_COMPILE_CONFIGURATION"] = self.settings.build_type + # https://github.com/OSGeo/gdal/blob/v3.8.1/cmake/modules/packages/FindSQLite3.cmake 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): + tc.variables["SQLite3_HAS_COLUMN_METADATA"] = self.dependencies["sqlite3"].options.enable_column_metadata + tc.variables["SQLite3_HAS_RTREE"] = self.dependencies["sqlite3"].options.enable_rtree + tc.variables["SQLite3_HAS_LOAD_EXTENSION"] = not self.dependencies["sqlite3"].options.omit_load_extension + tc.variables["SQLite3_HAS_PROGRESS_HANDLER"] = True + tc.variables["SQLite3_HAS_MUTEX_ALLOC"] = True + tc.preprocessor_definitions["SQLite3_HAS_COLUMN_METADATA"] = 1 if self.dependencies["sqlite3"].options.enable_column_metadata else 0 + tc.preprocessor_definitions["SQLite3_HAS_RTREE"] = 1 if self.dependencies["sqlite3"].options.enable_rtree else 0 + # https://github.com/OSGeo/gdal/blob/v3.8.0/cmake/helpers/CheckDependentLibraries.cmake#L419-L450 + tc.variables["HAVE_JPEGTURBO_DUAL_MODE_8_12"] = ( + self.options.with_jpeg == "libjpeg-turbo" and + bool(self.dependencies["libjpeg-turbo"].options.get_safe("enable12bit")) + ) + # https://github.com/OSGeo/gdal/blob/v3.8.0/port/CMakeLists.txt + tc.variables["BLOSC_HAS_BLOSC_CBUFFER_VALIDATE"] = ( + self.options.with_blosc and + Version(self.dependencies["c-blosc"].ref.version) >= "1.21.5" + ) + # https://github.com/OSGeo/gdal/blob/v3.8.0/frmts/hdf5/CMakeLists.txt#L61-L64 + tc.variables["GDAL_ENABLE_HDF5_GLOBAL_LOCK"] = ( + self.options.with_hdf5 and + bool(self.dependencies["hdf5"].options.get_safe("threadsafe")) + ) + # https://github.com/OSGeo/gdal/blob/v3.8.0/frmts/hdf4/CMakeLists.txt#L28-L46 + tc.variables["HDF4_HAS_MAXOPENFILES"] = ( + self.options.with_hdf4 and + Version(self.dependencies["hdf4"].ref.version) >= "4.2.5" + ) + # https://github.com/OSGeo/gdal/blob/4bb78aab3ae9ab5433042bc27239d1555cbe272e/cmake/helpers/CheckDependentLibraries.cmake#L301-L318 + # The detection fails for some reason + # Setting it to non-const is compatible with all platforms + tc.variables["_ICONV_SECOND_ARGUMENT_IS_NOT_CONST"] = True + tc.generate() + + + deps = CMakeDeps(self) + # https://gdal.org/development/building_from_source.html#cmake-package-dependent-options + # Based on `grep -hPIR '(gdal_check_package|find_package2)\(' ~/.conan2/p/b/gdal*/b/src/cmake | sort -u` + conan_to_cmake_pkg_name = { + "armadillo": "Armadillo", + "arrow": "Arrow", + "brunsli": "BRUNSLI", + "c-blosc": "Blosc", + "cfitsio": "CFITSIO", + "crunch": "Crnlib", + "cryptopp": "CryptoPP", + "expat": "EXPAT", + "freexl": "FreeXL", + # "fyba": "FYBA", + "geos": "GEOS", + "giflib": "GIF", + "hdf4": "HDF4", + "hdf5": "HDF5", + # "hdfs": "HDFS", + "json-c": "JSONC", + "kealib": "KEA", + "lerc": "LERC", + "libaec": "LIBAEC", + "libarchive": "ARCHIVE", + "libbasisu": "basisu", + # "libcsf": "LIBCSF", + "libcurl": "CURL", + "libdeflate": "Deflate", + "libecwj2": "ECW", + "libgeotiff": "GeoTIFF", + "libgta": "GTA", + "libheif": "HEIF", + "libiconv": "Iconv", + "libjpeg": "JPEG", + "libjpeg-turbo": "JPEG", + "libjxl": "JXL", + "libkml": "LibKML", + "libmysqlclient": "MySQL", + "libpng": "PNG", + "libpq": "PostgreSQL", + # "libqb3": "libQB3", + "librasterlite2": "RASTERLITE2", + "libspatialite": "SPATIALITE", + "libtiff": "TIFF", + "libwebp": "WebP", + "libxml2": "LibXml2", + "lz4": "LZ4", + "mariadb-connector-c": "MySQL", + "mongo-cxx-driver": "MONGOCXX", + "netcdf": "NetCDF", + "odbc": "ODBC", + # "odbccpp": "ODBCCPP", + # "ogdi": "OGDI", + # "opencad": "OpenCAD", + "opencl-icd-loader": "OpenCL", + "openexr": "OpenEXR", + "openjpeg": "OpenJPEG", + "openssl": "OpenSSL", + "pcre": "PCRE", + "pcre2": "PCRE2", + "pdfium": "PDFIUM", + "podofo": "Podofo", + "poppler": "Poppler", + "proj": "PROJ", + "qhull": "QHULL", + # "sfcgal": "SFCGAL", + "shapelib": "Shapelib", + "sqlite3": "SQLite3", + "tiledb": "TileDB", + "xerces-c": "XercesC", + "xz_utils": "LibLZMA", + "zlib": "ZLIB", + "zstd": "ZSTD", + # Closed-source/proprietary libraries + # "filegdb": "FileGDB", + # "idb": "IDB", + # "kdu": "KDU", + # "luratech": "LURATECH", + # "mrsid": "MRSID", + # "mssql_ncli": "MSSQL_NCLI", + # "mssql_odbc": "MSSQL_ODBC", + # "oracle": "Oracle", + # "rdb": "rdb", + # "teigha": "TEIGHA", + } + for conan_name, cmake_name in conan_to_cmake_pkg_name.items(): + deps.set_property(conan_name, "cmake_find_mode", "config") + deps.set_property(conan_name, "cmake_file_name", cmake_name) + + renamed_targets = { + "arrow::libarrow": "Arrow::arrow_shared" if Version(self.version) >= "3.7" else "arrow_shared", + "arrow::dataset": "ArrowDataset::arrow_dataset_shared", + "arrow::libparquet": "Parquet::parquet_shared", + "brunsli::brunslidec-c": "BRUNSLI::DECODE", + "brunsli::brunslienc-c": "BRUNSLI::ENCODE", + "c-blosc": "Blosc::Blosc", + "cfitsio": "CFITSIO::CFITSIO", + "crunch": "CRNLIB::Crnlib", + "cryptopp": "CRYPTOPP::CRYPTOPP", + "freexl": "FREEXL::freexl", + "geos": "GEOS::GEOS", + "hdf4": "HDF4::HDF4", + "hdfs": "HDFS::HDFS", + "kealib": "KEA::KEA", + "lerc": "LERC::LERC", + "libaec": "LIBAEC::LIBAEC", + "libarchive": "ARCHIVE::ARCHIVE", + "libbasisu": "basisu::basisu_lib", + "libdeflate": "Deflate::Deflate", + "libecwj2": "ECW::ECW_ALL", + "libgeotiff": "GEOTIFF::GEOTIFF", + "libheif": "HEIF::HEIF", + "libjxl::jxl": "JXL::JXL", + "libjxl::jxl_threads": "JXL_THREADS::JXL_THREADS", + "libjpeg": "JPEG::JPEG", + "libjpeg-turbo::jpeg": "JPEG::JPEG", + "libkml::kmldom": "LIBKML::DOM", + "libkml::kmlengine": "LIBKML::ENGINE", + "libkml": "LIBKML::LibKML", + "librasterlite2": "RASTERLITE2::RASTERLITE2", + "libspatialite": "SPATIALITE::SPATIALITE", + "libwebp": "WEBP::WebP", + "lz4": "LZ4::LZ4", + "mongo-cxx-driver::bsoncxx": "MONGOCXX::BSONCXX", + "mongo-cxx-driver::mongocxx": "MONGOCXX::MONGOCXX", + "netcds": "netCDF::netcdf", + "opencl-icd-loader": "OpenCL::OpenCL", + "openjpeg": "OPENJPEG::OpenJPEG", + "pcre": "PCRE::PCRE", + "pcre2::pcre2-8": "PCRE2::PCRE2-8", + "pdfium": "PDFIUM::PDFIUM", + "podofo": "PODOFO::Podofo", + "poppler": "Poppler::Poppler", + "shapelib": "SHAPELIB::shp", + "tiledb": "TileDB::tiledb_shared", + "xz_utils": "LibLZMA::LibLZMA", + "zstd": "ZSTD::zstd", + } + for component, new_target_name in renamed_targets.items(): + deps.set_property(component, "cmake_target_name", new_target_name) + + deps.generate() + + def _patch_sources(self): apply_conandata_patches(self) - cmake = self._configure_cmake() + # Fix Deflate::Deflate not being correctly propagated internally. + replace_in_file(self, os.path.join(self.source_folder, "port", "CMakeLists.txt"), + "PRIVATE Deflate::Deflate", + "PUBLIC Deflate::Deflate") + # Workaround for JXL_THREADS being provided by the JXL package on CCI. + replace_in_file(self, os.path.join(self.source_folder, "cmake", "helpers", "CheckDependentLibraries.cmake"), + "JXL_THREADS", "JXL", strict=False) + # Workaround for Parquet and ArrowDataset being provided by Arrow on CCI. + replace_in_file(self, os.path.join(self.source_folder, "cmake", "helpers", "CheckDependentLibraries.cmake"), + "gdal_check_package(Parquet", "# gdal_check_package(Parquet") + if Version(self.version) >= "3.6.0": + replace_in_file(self, os.path.join(self.source_folder, "cmake", "helpers", "CheckDependentLibraries.cmake"), + "gdal_check_package(ArrowDataset", "# gdal_check_package(ArrowDataset") + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure(build_script_folder=self.source_path.parent) cmake.build() def package(self): - self.copy("LICENSE.TXT", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE.TXT", self.source_folder, os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) 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")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + os.rename(os.path.join(self.package_folder, "share"), + os.path.join(self.package_folder, "res")) + rmdir(self, os.path.join(self.package_folder, "res", "bash-completion")) + rmdir(self, os.path.join(self.package_folder, "res", "man")) 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" - + # https://github.com/OSGeo/gdal/blob/v3.7.2/gdal.cmake#L384-L392 + # FIXME: set the correct postfix for MinGW shared builds libname = "gdal" - if self.settings.os == "Windows": + if is_msvc(self): 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']) - + self.cpp_info.libs = [libname] + self.cpp_info.resdirs = ["res"] + + self.cpp_info.requires.extend(["json-c::json-c"]) + self.cpp_info.requires.extend(["libgeotiff::libgeotiff"]) + self.cpp_info.requires.extend(["libtiff::libtiff"]) + self.cpp_info.requires.extend(["proj::projlib"]) + self.cpp_info.requires.extend(["zlib::zlib"]) if self.options.with_armadillo: - self.cpp_info.requires.extend(['armadillo::armadillo']) - + self.cpp_info.requires.extend(["armadillo::armadillo"]) if self.options.with_arrow: - self.cpp_info.requires.extend(['arrow::libarrow']) - + self.cpp_info.requires.extend(["arrow::libarrow"]) + if self.dependencies["arrow"].options.parquet: + self.cpp_info.requires.extend(["arrow::libparquet"]) + if self.dependencies["arrow"].options.dataset_modules: + self.cpp_info.requires.extend(["arrow::dataset"]) + if self.options.with_basisu: + self.cpp_info.requires.extend(["libbasisu::libbasisu"]) + if self.options.with_brunsli: + self.cpp_info.requires.extend(["brunsli::brunsli"]) if self.options.with_blosc: - self.cpp_info.requires.extend(['c-blosc::c-blosc']) - + self.cpp_info.requires.extend(["c-blosc::c-blosc"]) if self.options.with_cfitsio: - self.cpp_info.requires.extend(['cfitsio::cfitsio']) - + self.cpp_info.requires.extend(["cfitsio::cfitsio"]) if self.options.with_cryptopp: - self.cpp_info.requires.extend(['cryptopp::libcryptopp']) - + self.cpp_info.requires.extend(["cryptopp::libcryptopp"]) if self.options.with_curl: - self.cpp_info.requires.extend(['libcurl::curl']) - + self.cpp_info.requires.extend(["libcurl::curl"]) if self.options.with_dds: - self.cpp_info.requires.extend(['crunch::crunch']) - + self.cpp_info.requires.extend(["crunch::crunch"]) + if self.options.with_ecw: + self.cpp_info.requires.extend(["libecwj2::libecwj2"]) if self.options.with_expat: - self.cpp_info.requires.extend(['expat::expat']) - + self.cpp_info.requires.extend(["expat::expat"]) if self.options.with_exr: - self.cpp_info.requires.extend(['openexr::openexr', 'imath::imath']) - + self.cpp_info.requires.extend(["openexr::openexr", "imath::imath"]) if self.options.with_freexl: - self.cpp_info.requires.extend(['freexl::freexl']) - + self.cpp_info.requires.extend(["freexl::freexl"]) if self.options.with_geos: - self.cpp_info.requires.extend(['geos::geos_c']) - + self.cpp_info.requires.extend(["geos::geos_c"]) if self.options.with_gif: - self.cpp_info.requires.extend(['giflib::giflib']) - + self.cpp_info.requires.extend(["giflib::giflib"]) if self.options.with_gta: - self.cpp_info.requires.extend(['libgta::libgta']) - + self.cpp_info.requires.extend(["libgta::libgta"]) if self.options.with_hdf4: - self.cpp_info.requires.extend(['hdf4::hdf4']) - + self.cpp_info.requires.extend(["hdf4::hdf4"]) if self.options.with_hdf5: - self.cpp_info.requires.extend(['hdf5::hdf5_c']) - + self.cpp_info.requires.extend(["hdf5::hdf5_c"]) if self.options.with_heif: - self.cpp_info.requires.extend(['libheif::libheif']) - + self.cpp_info.requires.extend(["libheif::libheif"]) + if self.options.with_jxl: + self.cpp_info.requires.extend(["libjxl::libjxl"]) if self.options.with_kea: - self.cpp_info.requires.extend(['kealib::kealib']) - + self.cpp_info.requires.extend(["kealib::kealib"]) + if self.options.with_lerc: + self.cpp_info.requires.extend(["lerc::lerc"]) + if self.options.get_safe("with_libaec"): + self.cpp_info.requires.extend(["libaec::libaec"]) + if self.options.with_libarchive: + self.cpp_info.requires.extend(["libarchive::libarchive"]) if self.options.with_libdeflate: - self.cpp_info.requires.extend(['libdeflate::libdeflate']) - + self.cpp_info.requires.extend(["libdeflate::libdeflate"]) if self.options.with_libiconv: - self.cpp_info.requires.extend(['libiconv::libiconv']) - + self.cpp_info.requires.extend(["libiconv::libiconv"]) if self.options.with_jpeg == "libjpeg": - self.cpp_info.requires.extend(['libjpeg::libjpeg']) + self.cpp_info.requires.extend(["libjpeg::libjpeg"]) elif self.options.with_jpeg == "libjpeg-turbo": - self.cpp_info.requires.extend(['libjpeg-turbo::turbojpeg']) - + 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']) - + self.cpp_info.requires.extend(["libkml::kmldom", "libkml::kmlengine"]) + if self.options.with_lzma: + self.cpp_info.requires.extend(["xz_utils::xz_utils"]) if self.options.with_lz4: - self.cpp_info.requires.extend(['lz4::lz4']) - + self.cpp_info.requires.extend(["lz4::lz4"]) if self.options.with_mongocxx: - self.cpp_info.requires.extend(['mongo-cxx-driver::mongo-cxx-driver']) - + self.cpp_info.requires.extend(["mongo-cxx-driver::mongo-cxx-driver"]) if self.options.with_mysql == "libmysqlclient": - self.cpp_info.requires.extend(['libmysqlclient::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']) - + self.cpp_info.requires.extend(["mariadb-connector-c::mariadb-connector-c"]) if self.options.with_netcdf: - self.cpp_info.requires.extend(['netcdf::netcdf']) - + self.cpp_info.requires.extend(["netcdf::netcdf"]) if self.options.with_odbc: - self.cpp_info.requires.extend(['odbc::odbc']) - + self.cpp_info.requires.extend(["odbc::odbc"]) + if self.options.with_opencl: + self.cpp_info.requires.extend(["opencl-icd-loader::opencl-icd-loader"]) if self.options.with_openjpeg: - self.cpp_info.requires.extend(['openjpeg::openjpeg']) - + self.cpp_info.requires.extend(["openjpeg::openjpeg"]) if self.options.with_openssl: - self.cpp_info.requires.extend(['openssl::ssl']) - + self.cpp_info.requires.extend(["openssl::ssl"]) if self.options.with_pcre: - self.cpp_info.requires.extend(['pcre::pcre']) - + self.cpp_info.requires.extend(["pcre::pcre"]) if self.options.with_pcre2: - self.cpp_info.requires.extend(['pcre2::pcre2-8']) - + self.cpp_info.requires.extend(["pcre2::pcre2-8"]) + # if self.options.with_pdfium: + # self.cpp_info.requires.extend(["pdfium::pdfium"]) if self.options.with_pg: - self.cpp_info.requires.extend(['libpq::pq']) - + self.cpp_info.requires.extend(["libpq::pq"]) if self.options.with_png: - self.cpp_info.requires.extend(['libpng::libpng']) - + self.cpp_info.requires.extend(["libpng::libpng"]) if self.options.with_podofo: - self.cpp_info.requires.extend(['podofo::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']) - + self.cpp_info.requires.extend(["poppler::libpoppler"]) + if self.options.with_rasterlite2: + self.cpp_info.requires.extend(["librasterlite2::librasterlite2"]) if self.options.with_qhull: - self.cpp_info.requires.extend(['qhull::libqhull']) - + self.cpp_info.requires.extend(["qhull::libqhull"]) + if self.options.with_spatialite: + self.cpp_info.requires.extend(["libspatialite::libspatialite"]) if self.options.with_sqlite3: - self.cpp_info.requires.extend(['sqlite3::sqlite']) - + self.cpp_info.requires.extend(["sqlite3::sqlite"]) + if self.options.with_tiledb: + self.cpp_info.requires.extend(["tiledb::tiledb"]) if self.options.with_webp: - self.cpp_info.requires.extend(['libwebp::libwebp']) - + self.cpp_info.requires.extend(["libwebp::libwebp"]) if self.options.with_xerces: - self.cpp_info.requires.extend(['xerces-c::xerces-c']) - + 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']) - + self.cpp_info.requires.extend(["libxml2::libxml2"]) if self.options.with_zstd: - self.cpp_info.requires.extend(['zstd::zstdlib']) + self.cpp_info.requires.extend(["zstd::zstdlib"]) + + # Based on https://github.com/OSGeo/gdal/blob/v3.7.2/port/CMakeLists.txt + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs += ["pthread"] + elif self.settings.os == "Windows": + if is_msvc(self): + self.cpp_info.system_libs += ["wbemuuid"] + if self.options.with_openssl: + self.cpp_info.system_libs += ["crypt32"] 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 + self.runenv_info.define_path("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) + self.buildenv_info.define_path("GDAL_DATA", gdal_data_path) + + # TODO: remove in conan v2 + 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.env_info.GDAL_DATA = gdal_data_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 deleted file mode 100644 index e790a586d8abd..0000000000000 --- a/recipes/gdal/post_3.5.0/patches/3.5.1/0-replace-find-package.patch +++ /dev/null @@ -1,266 +0,0 @@ -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 deleted file mode 100644 index b01b5b271034c..0000000000000 --- a/recipes/gdal/post_3.5.0/patches/3.5.2/0-replace-find-package.patch +++ /dev/null @@ -1,266 +0,0 @@ -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/patches/3.5.3/0-replace-find-package.patch b/recipes/gdal/post_3.5.0/patches/3.5.3/0-replace-find-package.patch new file mode 100644 index 0000000000000..a13e4429270d1 --- /dev/null +++ b/recipes/gdal/post_3.5.0/patches/3.5.3/0-replace-find-package.patch @@ -0,0 +1,74 @@ +diff --git a/cmake/helpers/CheckDependentLibraries.cmake b/cmake/helpers/CheckDependentLibraries.cmake +--- a/cmake/helpers/CheckDependentLibraries.cmake ++++ b/cmake/helpers/CheckDependentLibraries.cmake +@@ -11,7 +11,7 @@ + include(CheckFunctionExists) + include(CMakeDependentOption) + include(FeatureSummary) +-include(DefineFindPackage2) ++include(ConanFindPackage) + include(CheckSymbolExists) + + option( +@@ -109,8 +109,8 @@ + string(TOUPPER ${name} key) + set(_find_dependency "") + set(_find_dependency_args "") +- find_package2(${name} QUIET OUT_DEPENDENCY _find_dependency) +- if (NOT DEFINED ${key}_FOUND) ++ find_package2(${name} QUIET) ++ if (FALSE) + set(_find_package_args) + if (_GCP_VERSION) + list(APPEND _find_package_args ${_GCP_VERSION}) +@@ -345,7 +345,7 @@ + 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) ++find_package2(PROJ 9 CONFIG REQUIRED) + if (NOT PROJ_FOUND) + find_package(PROJ 8 CONFIG QUIET) + endif() +@@ -411,8 +411,8 @@ + NAMES json-c + TARGETS json-c::json-c JSONC::JSONC + ) +-gdal_internal_library(JSONC REQUIRED) +-if(TARGET json-c::json-c) ++find_package2(JSONC REQUIRED) ++if(FALSE) + 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}") +@@ -517,9 +517,9 @@ + endif () + cmake_dependent_option(GDAL_USE_RASTERLITE2 "Set ON to use Rasterlite2" ON HAVE_RASTERLITE2 OFF) + +-find_package(LibKML COMPONENTS DOM ENGINE) ++find_package2(LibKML COMPONENTS DOM ENGINE) + if (GDAL_USE_LIBKML) + if (NOT LibKML_FOUND) + message(FATAL_ERROR "Configured to use GDAL_USE_LIBKML, but not found") + endif () + endif () +@@ -540,8 +540,8 @@ + gdal_check_package(MRSID "MrSID raster SDK" CAN_DISABLE) + gdal_check_package(Armadillo "C++ library for linear algebra (used for TPS transformation)" CAN_DISABLE) + if (ARMADILLO_FOUND) +- # On Conda, the armadillo package has no dependency on lapack, but the later is required for successful linking. So +- # try to build & link a test program using Armadillo. ++ # On Conda, the armadillo package has no dependency on lapack, but the later is required for successful linking. So try to build & link a test program using Armadillo. ++ include(CMakePushCheckState) + cmake_push_check_state(RESET) + set(CMAKE_REQUIRED_INCLUDES "${ARMADILLO_INCLUDE_DIRS}") + set(CMAKE_REQUIRED_LIBRARIES "${ARMADILLO_LIBRARIES}") +@@ -646,7 +646,7 @@ + gdal_check_package(HEIF "HEIF >= 1.1" CAN_DISABLE) + + # OpenJPEG's cmake-CONFIG is broken, so call module explicitly +-find_package(OpenJPEG MODULE) ++find_package2(OpenJPEG MODULE) + if (GDAL_USE_OPENJPEG) + if (NOT OPENJPEG_FOUND) + message(FATAL_ERROR "Configured to use GDAL_USE_OPENJPEG, but not found") diff --git a/recipes/gdal/post_3.5.0/patches/3.5.3/1-do-not-force-private-linking.patch b/recipes/gdal/post_3.5.0/patches/3.5.3/1-do-not-force-private-linking.patch new file mode 100644 index 0000000000000..e45427d007600 --- /dev/null +++ b/recipes/gdal/post_3.5.0/patches/3.5.3/1-do-not-force-private-linking.patch @@ -0,0 +1,20 @@ +diff --git a/cmake/helpers/GdalDriverHelper.cmake b/cmake/helpers/GdalDriverHelper.cmake +--- a/cmake/helpers/GdalDriverHelper.cmake ++++ b/cmake/helpers/GdalDriverHelper.cmake +@@ -280,7 +280,7 @@ + set(_oneValueArgs) + set(_multiValueArgs PRIVATE) + cmake_parse_arguments(_DRIVER "" "${_oneValueArgs}" "${_multiValueArgs}" ${ARGN}) +- if (NOT _DRIVER_PRIVATE) ++ if (FALSE AND NOT _DRIVER_PRIVATE) + message(FATAL_ERROR "gdal_target_link_libraries(): PRIVATE is a mandatory argument.") + endif () + is_plugin(RES ${target}) +@@ -289,6 +289,7 @@ + else () + gdal_target_interfaces(${target} ${_DRIVER_PRIVATE}) + gdal_add_private_link_libraries(${_DRIVER_PRIVATE}) ++ target_link_libraries(${ARGV}) + endif () + endfunction() + diff --git a/recipes/gdal/post_3.5.0/patches/3.5.3/2-allow-cycles-in-cmake-targets.patch b/recipes/gdal/post_3.5.0/patches/3.5.3/2-allow-cycles-in-cmake-targets.patch new file mode 100644 index 0000000000000..31bc2e5a8587d --- /dev/null +++ b/recipes/gdal/post_3.5.0/patches/3.5.3/2-allow-cycles-in-cmake-targets.patch @@ -0,0 +1,22 @@ +diff --git a/cmake/helpers/GdalDriverHelper.cmake b/cmake/helpers/GdalDriverHelper.cmake +--- a/cmake/helpers/GdalDriverHelper.cmake ++++ b/cmake/helpers/GdalDriverHelper.cmake +@@ -249,6 +249,7 @@ + target_compile_options(${_TARGET} PRIVATE ${_res}) + endif () + get_property(_res TARGET ${_LIB} PROPERTY INTERFACE_LINK_LIBRARIES) ++ list(REMOVE_ITEM _res ${_LIB}) + if (_res) + gdal_target_interfaces(${_TARGET} ${_res}) + endif () +diff --git a/cmake/helpers/GdalGenerateConfig.cmake b/cmake/helpers/GdalGenerateConfig.cmake +--- a/cmake/helpers/GdalGenerateConfig.cmake ++++ b/cmake/helpers/GdalGenerateConfig.cmake +@@ -50,6 +50,7 @@ + if(TARGET "${_lib}") + get_target_property(_link_libraries ${_lib} INTERFACE_LINK_LIBRARIES) + get_target_property(_type ${_lib} TYPE) ++ list(REMOVE_ITEM _link_libraries ${_lib}) + if(_link_libraries AND NOT TYPE STREQUAL "SHARED_LIBRARY") + list(INSERT ARGN 0 ${_link_libraries}) + endif() diff --git a/recipes/gdal/post_3.5.0/patches/3.7.3/0-replace-find-package.patch b/recipes/gdal/post_3.5.0/patches/3.7.3/0-replace-find-package.patch new file mode 100644 index 0000000000000..e25f0d63223d9 --- /dev/null +++ b/recipes/gdal/post_3.5.0/patches/3.7.3/0-replace-find-package.patch @@ -0,0 +1,64 @@ +diff -urN ./a/cmake/helpers/CheckDependentLibraries.cmake ./b/cmake/helpers/CheckDependentLibraries.cmake +--- ./a/cmake/helpers/CheckDependentLibraries.cmake ++++ ./b/cmake/helpers/CheckDependentLibraries.cmake +@@ -11,7 +11,7 @@ + include(CheckFunctionExists) + include(CMakeDependentOption) + include(FeatureSummary) +-include(DefineFindPackage2) ++include(ConanFindPackage) + include(CheckSymbolExists) + + option( +@@ -109,9 +109,8 @@ + string(TOUPPER ${name} key) + set(_find_dependency "") + set(_find_dependency_args "") +- if(FIND_PACKAGE2_${name}_ENABLED) +- find_package2(${name} QUIET OUT_DEPENDENCY _find_dependency) +- else() ++ find_package2(${name} QUIET) ++ if (FALSE) + set(_find_package_args) + if (_GCP_VERSION) + list(APPEND _find_package_args ${_GCP_VERSION}) +@@ -368,7 +367,7 @@ + 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) ++find_package2(PROJ 9 CONFIG REQUIRED) + if (NOT PROJ_FOUND) + find_package(PROJ 8 CONFIG QUIET) + endif() +@@ -457,8 +456,8 @@ + NAMES json-c + TARGETS json-c::json-c JSONC::JSONC + ) +-gdal_internal_library(JSONC REQUIRED) +-if(TARGET json-c::json-c) ++find_package2(JSONC REQUIRED) ++if(FALSE) + 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}") +@@ -566,9 +565,9 @@ + gdal_check_package(SPATIALITE "Enable spatialite support for sqlite3" VERSION 4.1.2 CAN_DISABLE) + gdal_check_package(RASTERLITE2 "Enable RasterLite2 support for sqlite3" VERSION 1.1.0 CAN_DISABLE) + +-find_package(LibKML COMPONENTS DOM ENGINE) ++find_package2(LibKML COMPONENTS DOM ENGINE) + if (GDAL_USE_LIBKML) + if (NOT LibKML_FOUND) + message(FATAL_ERROR "Configured to use GDAL_USE_LIBKML, but not found") + endif () + endif () +@@ -733,7 +732,7 @@ + gdal_check_package(HEIF "HEIF >= 1.1" CAN_DISABLE) + + # OpenJPEG's cmake-CONFIG is broken, so call module explicitly +-find_package(OpenJPEG MODULE) ++find_package2(OpenJPEG MODULE) + if (GDAL_USE_OPENJPEG) + if (NOT OPENJPEG_FOUND) + message(FATAL_ERROR "Configured to use GDAL_USE_OPENJPEG, but not found") diff --git a/recipes/gdal/post_3.5.0/patches/3.7.3/1-do-not-force-private-linking.patch b/recipes/gdal/post_3.5.0/patches/3.7.3/1-do-not-force-private-linking.patch new file mode 100644 index 0000000000000..d5b761df32ded --- /dev/null +++ b/recipes/gdal/post_3.5.0/patches/3.7.3/1-do-not-force-private-linking.patch @@ -0,0 +1,20 @@ +diff --git a/cmake/helpers/GdalDriverHelper.cmake b/cmake/helpers/GdalDriverHelper.cmake +--- a/cmake/helpers/GdalDriverHelper.cmake ++++ b/cmake/helpers/GdalDriverHelper.cmake +@@ -280,7 +280,7 @@ + set(_oneValueArgs) + set(_multiValueArgs PRIVATE) + cmake_parse_arguments(_DRIVER "" "${_oneValueArgs}" "${_multiValueArgs}" ${ARGN}) +- if (NOT _DRIVER_PRIVATE) ++ if (FALSE AND NOT _DRIVER_PRIVATE) + message(FATAL_ERROR "gdal_target_link_libraries(): PRIVATE is a mandatory argument.") + endif () + is_plugin(RES ${target}) +@@ -297,6 +297,7 @@ + else () + gdal_target_interfaces(${target} ${_DRIVER_PRIVATE}) + gdal_add_private_link_libraries(${_DRIVER_PRIVATE}) ++ target_link_libraries(${ARGV}) + endif () + + # For debugging purposes diff --git a/recipes/gdal/post_3.5.0/patches/3.8.1/0-replace-find-package.patch b/recipes/gdal/post_3.5.0/patches/3.8.1/0-replace-find-package.patch new file mode 100644 index 0000000000000..c82d659742baf --- /dev/null +++ b/recipes/gdal/post_3.5.0/patches/3.8.1/0-replace-find-package.patch @@ -0,0 +1,52 @@ +--- cmake/helpers/CheckDependentLibraries.cmake ++++ cmake/helpers/CheckDependentLibraries.cmake +@@ -11,7 +11,7 @@ + include(CheckFunctionExists) + include(CMakeDependentOption) + include(FeatureSummary) +-include(DefineFindPackage2) ++include(ConanFindPackage) + include(CheckSymbolExists) + + option( +@@ -109,9 +109,8 @@ + string(TOUPPER ${name} key) + set(_find_dependency "") + set(_find_dependency_args "") +- if(FIND_PACKAGE2_${name}_ENABLED) +- find_package2(${name} QUIET OUT_DEPENDENCY _find_dependency) +- else() ++ find_package2(${name} QUIET) ++ if(FALSE) + set(_find_package_args) + if (_GCP_VERSION) + list(APPEND _find_package_args ${_GCP_VERSION}) +@@ -368,7 +367,7 @@ + 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) ++find_package2(PROJ 9 CONFIG REQUIRED) + if (NOT PROJ_FOUND) + find_package(PROJ 8 CONFIG QUIET) + endif() +@@ -457,8 +456,8 @@ + NAMES json-c + TARGETS json-c::json-c JSONC::JSONC + ) +-gdal_internal_library(JSONC REQUIRED) +-if(TARGET json-c::json-c) ++find_package2(JSONC REQUIRED) ++if(FALSE) + 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}") +@@ -727,7 +726,7 @@ + gdal_check_package(HEIF "HEIF >= 1.1" CAN_DISABLE) + + # OpenJPEG's cmake-CONFIG is broken, so call module explicitly +-find_package(OpenJPEG MODULE) ++find_package2(OpenJPEG MODULE) + if (GDAL_USE_OPENJPEG) + if (NOT OPENJPEG_FOUND) + message(FATAL_ERROR "Configured to use GDAL_USE_OPENJPEG, but not found") diff --git a/recipes/gdal/post_3.5.0/test_package/CMakeLists.txt b/recipes/gdal/post_3.5.0/test_package/CMakeLists.txt index 861d8d69409b0..356b571fb9c63 100644 --- a/recipes/gdal/post_3.5.0/test_package/CMakeLists.txt +++ b/recipes/gdal/post_3.5.0/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ -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(GDAL REQUIRED) +find_package(GDAL REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} 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 index 9dced2ad9cf71..9ae9dd1c61f74 100644 --- a/recipes/gdal/post_3.5.0/test_package/conanfile.py +++ b/recipes/gdal/post_3.5.0/test_package/conanfile.py @@ -1,12 +1,20 @@ -from conan import ConanFile -from conan.tools.build import cross_building -from conans import CMake import os +from conan import ConanFile, conan_version +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake + 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) @@ -14,10 +22,11 @@ def build(self): 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) + if can_run(self): + gdal_options = self.options["gdal"] if conan_version < "2" else self.dependencies["gdal"].options + if gdal_options.tools: + self.run("gdal_translate --formats", env="conanrun") + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + self.run(bin_path, env="conanrun") + bin_path_c = os.path.join(self.cpp.build.bindir, "test_package_c") + self.run(bin_path_c, env="conanrun") diff --git a/recipes/gdal/post_3.5.0/test_v1_package/CMakeLists.txt b/recipes/gdal/post_3.5.0/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..b21cc49efde95 --- /dev/null +++ b/recipes/gdal/post_3.5.0/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/gdal/post_3.5.0/test_v1_package/conanfile.py b/recipes/gdal/post_3.5.0/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..e5d5a707ca0b3 --- /dev/null +++ b/recipes/gdal/post_3.5.0/test_v1_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_multi" + + 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/pre_3.5.0/conandata.yml b/recipes/gdal/pre_3.5.0/conandata.yml index e05a3af06bfda..16129b5ac3029 100644 --- a/recipes/gdal/pre_3.5.0/conandata.yml +++ b/recipes/gdal/pre_3.5.0/conandata.yml @@ -5,72 +5,16 @@ sources: "3.4.1": url: "https://github.com/OSGeo/gdal/releases/download/v3.4.1/gdal-3.4.1.tar.gz" sha256: "e360387bc25ec24940f46afbeada48002d72c74aaf9eccf2a40e8d74e711a2e4" - "3.3.3": - url: "https://github.com/OSGeo/gdal/releases/download/v3.3.3/gdal-3.3.3.tar.gz" - sha256: "28925ea4717b02185ee208bfc121a94fa0bc1dfe9cb862fd3868c2a0394d605a" - "3.2.3": - url: "https://github.com/OSGeo/gdal/releases/download/v3.2.3/gdal-3.2.3.tar.gz" - sha256: "86a35aad60a1eb87c2c0c145f9bccd83a47c4781254544ed5246f64d55ee1f18" - "3.1.4": - url: "https://github.com/OSGeo/gdal/releases/download/v3.1.4/gdal-3.1.4.tar.gz" - sha256: "5f09ea6ca797e296b608d261e08e18ffa43a12fa28d460ae139d2a026ee2b0c0" 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..0270a1825c5cf 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,113 +161,64 @@ class GdalConan(ConanFile): "with_heif": False, } - generators = "pkg_config" - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _has_with_exr_option(self): - return tools.Version(self.version) >= "3.1.0" - - @property - def _has_with_libdeflate_option(self): - return tools.Version(self.version) >= "3.2.0" - - @property - def _has_with_heif_option(self): - return tools.Version(self.version) >= "3.2.0" - - @property - def _has_with_blosc_option(self): - return tools.Version(self.version) >= "3.4.0" - - @property - def _has_with_lz4_option(self): - return tools.Version(self.version) >= "3.4.0" - - @property - def _has_with_brunsli_option(self): - return tools.Version(self.version) >= "3.4.0" - @property - def _has_with_pcre2_option(self): - return tools.Version(self.version) >= "3.4.1" + def _settings_build(self): + return getattr(self, "settings_build", self.settings) - @property - def _has_reentrant_qhull_support(self): - return tools.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": - # del self.options.with_tiledb - if not self._has_with_exr_option: - del self.options.with_exr - if not self._has_with_libdeflate_option: - del self.options.with_libdeflate - if not self._has_with_heif_option: - del self.options.with_heif - if not self._has_with_blosc_option: - del self.options.with_blosc - if not self._has_with_lz4_option: - del self.options.with_lz4 - if not self._has_with_brunsli_option: - del self.options.with_brunsli - if not self._has_with_pcre2_option: - del self.options.with_pcre2 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 + self.options["qhull"].reentrant = True + + 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.17") 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("flatbuffers/2.0.5") + self.requires("libtiff/4.6.0") + self.requires("proj/9.3.1") + self.requires("flatbuffers/2.0.5") if self.options.get_safe("with_zlib", True): - self.requires("zlib/1.2.12") - if self.options.get_safe("with_libdeflate"): - self.requires("libdeflate/1.12") + self.requires("zlib/[>=1.2.11 <2]") + if self.options.with_libdeflate: + self.requires("libdeflate/1.19") 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") - if self.options.get_safe("with_lz4"): - self.requires("lz4/1.9.3") + self.requires("zstd/1.5.5") + if self.options.with_blosc: + self.requires("c-blosc/1.21.3") + if self.options.with_lz4: + self.requires("lz4/1.9.4") if self.options.with_pg: - self.requires("libpq/14.2") + self.requires("libpq/15.4") # if self.options.with_libgrass: # self.requires("libgrass/x.x.x") if self.options.with_cfitsio: @@ -270,7 +226,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 <2]") if self.options.with_dds: self.requires("crunch/cci.20190615") if self.options.with_gta: @@ -278,11 +234,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/3.0.0") + 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 +248,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.6.2 <3]") 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/[>=8.2 <9]") 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.44.2") # 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.1") 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 +317,59 @@ 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 <4]") # 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") + if self.options.with_exr: + self.requires("openexr/3.1.9") + if self.options.with_heif: + 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"): + if self.options.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): + if self.options.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 not self.dependencies["qhull"].options.reentrant: + raise ConanInvalidConfiguration(f"{self.ref} depends on 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.") - 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 < 3.0.0 not yet supported in this recipe.") + if mongocxx_version < "3.4.0": + 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/2.1.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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def _patch_sources(self): apply_conandata_patches(self) @@ -430,112 +383,99 @@ def _patch_sources(self): os.path.join("frmts", "zlib"), # os.path.join("ogr", "ogrsf_frmts", "cad", "libopencad"), # TODO: uncomment when libopencad available os.path.join("ogr", "ogrsf_frmts", "geojson", "libjson"), + os.path.join("ogr", "ogrsf_frmts", "flatgeobuf", "flatbuffers"), ] - if tools.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": - 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, - clean_pattern, + replace_in_file(self, gnumakefile_apps, + "$(RM) *.o $(BIN_LIST) $(NON_DEFAULT_LIST) core gdal-config gdal-config-inst", "$(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 +494,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 +542,9 @@ 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 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"))) @@ -614,7 +555,7 @@ def _nmake_args(self): if self.options.get_safe("with_zlib", True): args.append("ZLIB_EXTERNAL_LIB=1") args.append("ZLIB_INC=\"-I{}\"".format(include_paths("zlib"))) - if self.options.get_safe("with_libdeflate"): + if self.options.with_libdeflate: args.append("LIBDEFLATE_CFLAGS=\"-I{}\"".format(include_paths("libdeflate"))) if self.options.with_poppler: poppler_version = version("poppler") @@ -627,9 +568,9 @@ def _nmake_args(self): args.append("PODOFO_ENABLED=YES") if self.options.get_safe("with_zstd"): args.append("ZSTD_CFLAGS=\"-I{}\"".format(include_paths("zstd"))) - if self.options.get_safe("with_blosc"): + if self.options.with_blosc: args.append("BLOSC_CFLAGS=\"-I{}\"".format(include_paths("c-blosc"))) - if self.options.get_safe("with_lz4"): + if self.options.with_lz4: args.append("LZ4_CFLAGS=\"-I{}\"".format(include_paths("lz4"))) if self.options.with_webp: args.append("WEBP_ENABLED=YES") @@ -641,17 +582,17 @@ 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"))) if self.options.without_lerc: args.append("HAVE_LERC=0") - if self.options.get_safe("with_brunsli"): + if self.options.with_brunsli: args.extend([ "BRUNSLI_DIR=\"{}\"".format(rootpath("brunsli")), "BRUNSLI_INC=\"{}\"".format(include_paths("brunsli")), @@ -664,256 +605,213 @@ def _nmake_args(self): args.append("CHARLS_FLAGS=-DCHARLS_2") if self.options.with_dds: args.append("CRUNCH_INC=\"-I{}\"".format(include_paths("crunch"))) - if self.options.get_safe("with_exr"): + if self.options.with_exr: args.append("EXR_INC=\"-I{}\"".format(include_paths("openexr"))) - if self.options.get_safe("with_heif"): + if self.options.with_heif: args.append("HEIF_INC=\"-I{}\"".format(include_paths("libheif"))) 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))) + 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 + tc.configure_args.append("--with-blosc={}".format(yes_no(self.options.with_blosc))) + 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 + 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 + 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 + 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") + 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 + tc.configure_args.append("--with-brunsli={}".format(yes_no(self.options.with_brunsli))) + 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))) + tc.configure_args.append("--with-lerc={}".format(internal_no(not self.options.without_lerc))) + if self.options.with_null: + tc.configure_args.append("--with-null") + tc.configure_args.append("--with-exr={}".format(yes_no(self.options.with_exr))) + 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 +819,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 +828,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 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/patches/3.1.x/fix-autotools-3.1.4.patch b/recipes/gdal/pre_3.5.0/patches/3.1.x/fix-autotools-3.1.4.patch deleted file mode 100644 index 974146f6a3f7a..0000000000000 --- a/recipes/gdal/pre_3.5.0/patches/3.1.x/fix-autotools-3.1.4.patch +++ /dev/null @@ -1,283 +0,0 @@ ---- a/GDALmake.opt.in -+++ b/GDALmake.opt.in -@@ -601,7 +601,7 @@ endif - - ifeq ($(HAVE_LIBTOOL), yes) - --CONFIG_LIBS = $(GDAL_ROOT)/$(LIBGDAL) -+CONFIG_LIBS = $(GDAL_ROOT)/$(LIBGDAL) $(LIBS) - ifeq ($(MACOSX_FRAMEWORK),yes) - CONFIG_LIBS_INS = -L$(INST_LIB)/unix/lib -lgdal - else ---- a/configure.ac -+++ b/configure.ac -@@ -1214,6 +1214,7 @@ dnl --------------------------------------------------------------------------- - dnl PROJ.6 related stuff - dnl --------------------------------------------------------------------------- - -+PKG_PROG_PKG_CONFIG([0.21]) - AC_MSG_CHECKING([for PROJ >= 6 library]) - - AC_ARG_WITH(proj,[ --with-proj=ARG Compile with PROJ.x (ARG=yes or path)],,) -@@ -1229,11 +1230,7 @@ if test "x$with_proj" = "xno" ; then - else - - if test "x$with_proj" = "xyes" -o "x$with_proj" = "x"; then -- ORIG_LIBS="$LIBS" -- LIBS="-lproj $ORIG_LIBS" -- AC_LANG_PUSH([C++]) -- AC_CHECK_LIB(proj,proj_create_from_wkt,PROJ_FOUND=yes,PROJ_FOUND=no,) -- AC_LANG_POP([C++]) -+ PROJ_FOUND=yes - if test "$PROJ_FOUND" = "no"; then - AC_LANG_PUSH([C++]) - AC_CHECK_LIB(proj,internal_proj_create_from_wkt,PROJ_FOUND=yes,PROJ_FOUND=no,) -@@ -1876,7 +1873,6 @@ else - - DDS_SETTING=yes - CRUNCHDIR="$with_dds" -- LIBS="-L$with_dds/lib/ -lcrunch $LIBS" - echo "using libcrunch from $with_dds." - - fi -@@ -2012,7 +2008,7 @@ else - AC_MSG_RESULT([using libtiff from ${with_libtiff}.]) - - dnl Check for the BigTIFF enabled library (libtiff >= 4.0) -- AC_CHECK_LIB(tiff,TIFFScanlineSize64,HAVE_BIGTIFF=yes,HAVE_BIGTIFF=no,) -+ AC_CHECK_LIB(tiff,TIFFScanlineSize64,HAVE_BIGTIFF=yes,HAVE_BIGTIFF=no,$LIBS) - - fi - -@@ -2082,7 +2078,6 @@ else - - dnl We now require libgeotiff 1.5.0 - dnl first check if $with_geotiff/lib has the library: -- AC_CHECK_LIB(geotiff,GTIFAttachPROJContext,GEOTIFF_SETTING=external,GEOTIFF_SETTING=not_found,-L$with_geotiff/lib) - - if test $GEOTIFF_SETTING = "external" ; then - LIBS="-L$with_geotiff/lib -lgeotiff $LIBS" -@@ -2650,6 +2645,10 @@ if test x"$with_hdf4" = x"no" ; then - - echo "hdf4 support disabled." - -+elif test x"$with_hdf4" = x"yes" ; then -+ PKG_CHECK_MODULES([HDF4], [hdf], [HAVE_HDF4=yes], [AC_MSG_ERROR([hdf4 not found...])]) -+ PKG_CHECK_MODULES([HDF4], [hdf >= 4.2.5], [HDF4_HAS_MAXOPENFILES=yes], [HDF4_HAS_MAXOPENFILES=no]) -+ HDF4_INCLUDE="$HDF4_CFLAGS" - else - - if test x"$with_hdf4" = x"yes" -o x"$with_hdf4" = x"" ; then -@@ -2780,7 +2779,6 @@ elif test "$with_hdf5" = "yes" -o "$with_hdf5" = "" ; then - # Test that the package found is for the right architecture - saved_LIBS="$LIBS" - LIBS="$HDF5_LIBS" -- AC_CHECK_LIB(hdf5,H5Fopen, [HAVE_HDF5=yes], [HAVE_HDF5=no]) - LIBS="$saved_LIBS" - - if test "$HAVE_HDF5" = "yes"; then -@@ -2849,21 +2847,21 @@ KEA_CONFIG=no - - AC_ARG_WITH(kea,[ --with-kea[=ARG] Include kealib (ARG=path to kea-config) [[default=yes]]],,) - -+AC_MSG_CHECKING([for kea]) - if test "$with_kea" = "yes" -o "x$with_kea" = "x" ; then -- AC_PATH_PROG(KEA_CONFIG, kea-config, no) -+ HAVE_KEA=yes -+ AC_MSG_RESULT([yes]) - else -- KEA_CONFIG=$with_kea -+ HAVE_KEA=no -+ AC_MSG_RESULT([no]) - fi - --AC_MSG_CHECKING([for kea]) - - if test "$KEA_CONFIG" = "no" ; then - -- HAVE_KEA=no - KEA_LIB= - KEA_INC= - -- AC_MSG_RESULT([no]) - - else - if test -d $KEA_CONFIG ; then -@@ -3715,18 +3713,15 @@ MYSQL_CONFIG=no - AC_ARG_WITH(mysql,[ --with-mysql[=ARG] Include MySQL (ARG=path to mysql_config) [[default=no]]],,) - - if test "$with_mysql" = "yes" ; then -- AC_PATH_PROG(MYSQL_CONFIG, mysql_config, no) -+ HAVE_MYSQL=yes - else -- if test "x$with_mysql" != "x" ; then -- MYSQL_CONFIG=$with_mysql -- fi -+ HAVE_MYSQL=no - fi - - AC_MSG_CHECKING([for MySQL]) - - if test "$MYSQL_CONFIG" = "no" ; then - -- HAVE_MYSQL=no - MYSQL_LIB= - MYSQL_INC= - -@@ -3820,8 +3815,11 @@ dnl Check for Expat configuration. - dnl --------------------------------------------------------------------------- - - dnl Expat 1.95.0 released in 2000-09-28 --EXPAT_REQ_VERSION="1.95.0" --AX_LIB_EXPAT($EXPAT_REQ_VERSION) -+# AX_LIB_EXPAT is too fragile, it doesn't properly handle debug expat on Windows -+HAVE_EXPAT=no -+AC_ARG_WITH([expat], AS_HELP_STRING([--with-expat[=ARG]], [use Expat library (ARG=yes or no)]),,) -+if test x"$with_expat" = x"yes" ; then -+PKG_CHECK_MODULES([EXPAT], [expat >= 1.95.0], [HAVE_EXPAT=yes], [AC_MSG_ERROR([expat not found...])]) - - if test "$HAVE_EXPAT" = "yes"; then - LIBS="$EXPAT_LDFLAGS $LIBS" -@@ -3834,6 +3832,7 @@ m4_foreach_w([frmt],EXPAT_DRIVERS,[ - fi - ]) - -+fi - fi - - AC_SUBST([HAVE_EXPAT], $HAVE_EXPAT) -@@ -4059,29 +4058,17 @@ AC_ARG_WITH(curl, - dnl Clear some cache variables - unset ac_cv_path_LIBCURL - --if test "`basename xx/$with_curl`" = "curl-config" ; then -- LIBCURL_CONFIG="$with_curl" --elif test "$with_curl" = "no" ; then -- LIBCURL_CONFIG=no --else -- AC_PATH_PROG(LIBCURL_CONFIG, curl-config, no) --fi -- --if test "$LIBCURL_CONFIG" != "no" ; then -- -- CURL_VERNUM=`$LIBCURL_CONFIG --vernum` -- CURL_VER=`$LIBCURL_CONFIG --version | awk '{print $2}'` -- -- AC_MSG_RESULT([ found libcurl version $CURL_VER]) -- -- AC_CHECK_LIB(curl,curl_global_init,CURL_SETTING=yes,CURL_SETTING=no,`$LIBCURL_CONFIG --libs`) - -+if test "$with_curl" = "yes" ; then -+ PKG_CHECK_MODULES([CURL], [libcurl], [CURL_SETTING=yes], [AC_MSG_ERROR([libcurl not found...])]) -+else -+ CURL_SETTING=no - fi - - if test "$CURL_SETTING" = "yes" ; then - -- CURL_INC=`$LIBCURL_CONFIG --cflags` -- CURL_LIB=`$LIBCURL_CONFIG --libs` -+ CURL_INC="$CURL_CFLAGS" -+ CURL_LIB="$CURL_LIBS" - m4_foreach_w([frmt],CURL_FORMATS,[ - driver_enabled=m4_join([_],[$INTERNAL_FORMAT],frmt,[ENABLED]) - if test "x$driver_enabled" = "xyes"; then -@@ -4121,7 +4108,6 @@ if test "x$with_xml2" = "xyes" -o "x$with_xml2" = "x" ; then - if test "${HAVE_LIBXML2}" = "yes"; then - SAVED_LIBS="${LIBS}" - LIBS="${LIBXML2_LIBS}" -- AC_CHECK_LIB(xml2,xmlParseDoc,HAVE_LIBXML2=yes,HAVE_LIBXML2=no) - LIBS="${SAVED_LIBS}" - fi - -@@ -4242,9 +4228,12 @@ dnl --------------------------------------------------------------------------- - dnl Check for SQLite (only if SpatiaLite is not detected) - dnl --------------------------------------------------------------------------- - -+HAVE_SQLITE3=no -+AC_ARG_WITH(sqlite3, AS_HELP_STRING([--with-sqlite3[=ARG]], [use SQLite 3 library (ARG=yes or no)]),,) - if test "${HAVE_SPATIALITE}" = "no" -o "${HAVE_SPATIALITE}" = "dlopen" ; then -- SQLITE3_REQ_VERSION="3.0.0" -- AX_LIB_SQLITE3($SQLITE3_REQ_VERSION) -+ if test x"$with_sqlite3" = x"yes" ; then -+ PKG_CHECK_MODULES([SQLITE3], [sqlite3 >= 3.0.0], [HAVE_SQLITE3=yes], [AC_MSG_ERROR([sqlite3 not found...])]) -+ fi - - if test "$HAVE_SQLITE3" = "yes"; then - LIBS="$SQLITE3_LDFLAGS $LIBS" -@@ -4597,8 +4586,13 @@ dnl --------------------------------------------------------------------------- - dnl Check if geos library is available. - dnl --------------------------------------------------------------------------- - --GEOS_INIT(3.1.0) -+AC_ARG_WITH(geos, AS_HELP_STRING([--with-geos[=ARG]], [Include GEOS support (ARG=yes or no)]),,) - HAVE_GEOS_RESULT="no" -+HAVE_GEOS=no -+if test x"$with_geos" = x"no" ; then -+ AC_MSG_RESULT([GEOS support disabled]) -+else -+ PKG_CHECK_MODULES([GEOS], [geos >= 3.1.0], [HAVE_GEOS=yes], [AC_MSG_ERROR([geos not found...])]) - if test "${HAVE_GEOS}" = "yes" ; then - - AC_MSG_NOTICE([Using C API from GEOS $GEOS_VERSION]) -@@ -4607,6 +4601,8 @@ if test "${HAVE_GEOS}" = "yes" ; then - LIBS="${GEOS_LIBS} ${LIBS}" - HAVE_GEOS_RESULT="yes" - fi -+fi -+AC_SUBST(HAVE_GEOS, $HAVE_GEOS) - - dnl --------------------------------------------------------------------------- - dnl Check if SFCGAL library is available. -@@ -4641,20 +4637,18 @@ elif test "$with_qhull" = "yes" -o "$with_qhull" = "" ; then - # qhull/qhull.h - AC_CHECK_HEADERS([qhull/libqhull.h]) - if test "$ac_cv_header_qhull_libqhull_h" = "yes"; then -- AC_CHECK_LIB(qhull,qh_new_qhull,QHULL_SETTING=yes,QHULL_SETTING=no,) -+ QHULL_SETTING=yes - if test "$QHULL_SETTING" = "yes"; then - QHULL_SETTING=external - QHULL_INCLUDE_SUBDIR_IS_LIBQHULL=0 -- LIBS="-lqhull $LIBS" - fi - fi - AC_CHECK_HEADERS([libqhull/libqhull.h]) - if test "$ac_cv_header_libqhull_libqhull_h" = "yes"; then -- AC_CHECK_LIB(qhull,qh_new_qhull,QHULL_SETTING=yes,QHULL_SETTING=no,) -+ QHULL_SETTING=yes - if test "$QHULL_SETTING" = "yes"; then - QHULL_SETTING=external - QHULL_INCLUDE_SUBDIR_IS_LIBQHULL=1 -- LIBS="-lqhull $LIBS" - fi - fi - -@@ -4741,7 +4735,9 @@ AC_MSG_CHECKING([for FreeXL support]) - HAVE_FREEXL=no - FREEXL_INCLUDE= - --if test "$with_freexl" = "" -o "$with_freexl" = "yes" ; then -+if test "$with_freexl" = "yes"; then -+ PKG_CHECK_MODULES([FREEXL], [freexl >= 1.0.0], [HAVE_FREEXL=yes], [AC_MSG_ERROR([freexl not found...])]) -+elif test "$with_freexl" = ""; then - AC_CHECK_HEADERS(freexl.h) - AC_CHECK_LIB(freexl,freexl_open,FREEXL_LIBS="-lfreexl",FREEXL_LIBS=missing) - -@@ -4847,8 +4843,7 @@ if test "$with_libjson_c" = "external" -o "$with_libjson_c" = "" -o "$with_libjs - elif test "$with_libjson_c" = "internal" ; then - LIBJSONC_SETTING=internal - elif test "$with_libjson_c" != "no"; then -- LIBS="-L$with_libjson_c/lib $LIBS" -- AC_CHECK_LIB(json-c,json_object_set_serializer,LIBJSONC_SETTING=external,LIBJSONC_SETTING=internal,-L$with_libjson_c/lib) -+ LIBJSONC_SETTING=external - else - AC_MSG_ERROR([libjson-c (internal or external) is required]) - fi -@@ -5952,7 +5947,6 @@ else - # Test that the package found is for the right architecture - saved_LIBS="$LIBS" - LIBS="$EXR_LIBS" -- AC_CHECK_LIB(IlmImf,ImfTiledInputReadTile, [HAVE_EXR=yes], [HAVE_EXR=no]) - LIBS="$saved_LIBS" - - if test "$HAVE_EXR" = "yes"; then diff --git a/recipes/gdal/pre_3.5.0/patches/3.1.x/fix-import-dll-msvc.patch b/recipes/gdal/pre_3.5.0/patches/3.1.x/fix-import-dll-msvc.patch deleted file mode 100644 index 308c1bca0a4c0..0000000000000 --- a/recipes/gdal/pre_3.5.0/patches/3.1.x/fix-import-dll-msvc.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- a/port/cpl_port.h -+++ b/port/cpl_port.h -@@ -344,7 +344,11 @@ typedef unsigned int GUIntptr_t; - - #ifndef CPL_DLL - #if defined(_MSC_VER) && !defined(CPL_DISABLE_DLL) --# define CPL_DLL __declspec(dllexport) -+# ifdef GDAL_COMPILATION -+# define CPL_DLL __declspec(dllexport) -+# else -+# define CPL_DLL -+# endif - # define CPL_INTERNAL - #else - # if defined(USE_GCC_VISIBILITY_FLAG) diff --git a/recipes/gdal/pre_3.5.0/patches/3.1.x/fix-include-jsonc.patch b/recipes/gdal/pre_3.5.0/patches/3.1.x/fix-include-jsonc.patch deleted file mode 100644 index c52f9dff53382..0000000000000 --- a/recipes/gdal/pre_3.5.0/patches/3.1.x/fix-include-jsonc.patch +++ /dev/null @@ -1,104 +0,0 @@ ---- a/gcore/gdal_rat.cpp -+++ b/gcore/gdal_rat.cpp -@@ -50,7 +50,7 @@ - #pragma clang diagnostic ignored "-Wunknown-pragmas" - #pragma clang diagnostic ignored "-Wdocumentation" - #endif --#include "json.h" -+#include - #ifdef __clang__ - #pragma clang diagnostic pop - #endif ---- a/ogr/ogrsf_frmts/geojson/ogresrijsonreader.cpp -+++ b/ogr/ogrsf_frmts/geojson/ogresrijsonreader.cpp -@@ -37,7 +37,7 @@ - - #include "cpl_conv.h" - #include "cpl_error.h" --#include "json.h" -+#include - // #include "json_object.h" - // #include "json_tokener.h" - #include "ogr_api.h" ---- a/ogr/ogrsf_frmts/geojson/ogrgeojsondatasource.cpp -+++ b/ogr/ogrsf_frmts/geojson/ogrgeojsondatasource.cpp -@@ -41,7 +41,7 @@ - #include "cpl_string.h" - #include "cpl_vsi.h" - #include "cpl_vsi_error.h" --#include "json.h" -+#include - // #include "json_object.h" - #include "gdal_utils.h" - #include "gdal.h" ---- a/ogr/ogrsf_frmts/geojson/ogrgeojsonlayer.cpp -+++ b/ogr/ogrsf_frmts/geojson/ogrgeojsonlayer.cpp -@@ -37,7 +37,7 @@ - # endif - #endif // !DEBUG_VERBOSE - --#include -+#include - - #if !DEBUG_JSON - # ifdef __clang ---- a/ogr/ogrsf_frmts/geojson/ogrgeojsonreader.cpp -+++ b/ogr/ogrsf_frmts/geojson/ogrgeojsonreader.cpp -@@ -32,7 +32,7 @@ - #include "ogrgeojsonreader.h" - #include "ogrgeojsonutils.h" - #include "ogr_geojson.h" --#include // JSON-C -+#include // JSON-C - - #if (!defined(JSON_C_VERSION_NUM)) || (JSON_C_VERSION_NUM < JSON_C_VER_013) - #include // just for sizeof(struct json_object) ---- a/ogr/ogrsf_frmts/geojson/ogrgeojsonutils.cpp -+++ b/ogr/ogrsf_frmts/geojson/ogrgeojsonutils.cpp -@@ -31,7 +31,7 @@ - #include - #include - #include --#include // JSON-C -+#include // JSON-C - - #include - #include ---- a/ogr/ogrsf_frmts/geojson/ogrgeojsonwriter.cpp -+++ b/ogr/ogrsf_frmts/geojson/ogrgeojsonwriter.cpp -@@ -33,13 +33,13 @@ - #include "ogrgeojsonutils.h" - #include "ogr_geojson.h" - #include "ogrgeojsonreader.h" --#include // JSON-C -+#include // JSON-C - - #if (!defined(JSON_C_VERSION_NUM)) || (JSON_C_VERSION_NUM < JSON_C_VER_013) - #include - #endif - --#include -+#include - #include - #include - ---- a/ogr/ogrsf_frmts/geojson/ogrtopojsonreader.cpp -+++ b/ogr/ogrsf_frmts/geojson/ogrtopojsonreader.cpp -@@ -30,5 +30,5 @@ - #include "ogrgeojsonutils.h" - #include "ogr_geojson.h" --#include // JSON-C -+#include // JSON-C - #include - ---- a/port/cpl_json_header.h -+++ b/port/cpl_json_header.h -@@ -33,7 +33,7 @@ - #pragma GCC system_header - #endif - --#include -+#include - - #undef json_object_object_foreachC - #define json_object_object_foreachC(obj,iter) \ diff --git a/recipes/gdal/pre_3.5.0/patches/3.1.x/fix-include-podofo.patch b/recipes/gdal/pre_3.5.0/patches/3.1.x/fix-include-podofo.patch deleted file mode 100644 index aa86489f0296b..0000000000000 --- a/recipes/gdal/pre_3.5.0/patches/3.1.x/fix-include-podofo.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/frmts/pdf/pdfsdk_headers.h -+++ b/frmts/pdf/pdfsdk_headers.h -@@ -103,7 +103,7 @@ typedef unsigned char Guchar; - #undef GetObject - #endif - --#include "podofo.h" -+#include - #endif // HAVE_PODOFO - - #ifdef HAVE_PDFIUM diff --git a/recipes/gdal/pre_3.5.0/patches/3.1.x/fix-include-xerces-3.1.2.patch b/recipes/gdal/pre_3.5.0/patches/3.1.x/fix-include-xerces-3.1.2.patch deleted file mode 100644 index 8b08760381794..0000000000000 --- a/recipes/gdal/pre_3.5.0/patches/3.1.x/fix-include-xerces-3.1.2.patch +++ /dev/null @@ -1,63 +0,0 @@ ---- a/ogr/ogr_xerces_headers.h -+++ b/ogr/ogr_xerces_headers.h -@@ -33,9 +33,9 @@ - #pragma GCC system_header - #endif - --#include --#include --#include -+#include -+#include -+#include - - #ifdef XERCES_CPP_NAMESPACE_USE - XERCES_CPP_NAMESPACE_USE ---- a/ogr/ogrsf_frmts/gml/xercesc_headers.h -+++ b/ogr/ogrsf_frmts/gml/xercesc_headers.h -@@ -33,13 +33,13 @@ - #pragma GCC system_header - #endif - --#include --#include --#include --#include --#include --#include --#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include - - #ifdef XERCES_CPP_NAMESPACE_USE - XERCES_CPP_NAMESPACE_USE ---- a/ogr/ogrsf_frmts/ili/xercesc_headers.h -+++ b/ogr/ogrsf_frmts/ili/xercesc_headers.h -@@ -33,14 +33,14 @@ - #pragma GCC system_header - #endif - --#include --#include --#include --#include --#include --#include --#include --#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include - - #ifdef XERCES_CPP_NAMESPACE_USE - XERCES_CPP_NAMESPACE_USE diff --git a/recipes/gdal/pre_3.5.0/patches/3.1.x/fix-nmake-common.patch b/recipes/gdal/pre_3.5.0/patches/3.1.x/fix-nmake-common.patch deleted file mode 100644 index c0201f8dc9cd8..0000000000000 --- a/recipes/gdal/pre_3.5.0/patches/3.1.x/fix-nmake-common.patch +++ /dev/null @@ -1,165 +0,0 @@ ---- a/alg/makefile.vc -+++ b/alg/makefile.vc -@@ -14,7 +14,7 @@ EXTRAFLAGS = -I../frmts/vrt -I../ogr/ogrsf_frmts $(GEOS_CFLAGS) $(PROJ_FLAGS) $( - EXTRAFLAGS = $(EXTRAFLAGS) -DINTERNAL_QHULL - !ELSE - !IF "$(QHULL_SETTING)" == "EXTERNAL" --EXTRAFLAGS = $(EXTRAFLAGS) -DEXTERNAL_QHULL $(QHULL_INC) -+EXTRAFLAGS = $(EXTRAFLAGS) -DEXTERNAL_QHULL -DQHULL_INCLUDE_SUBDIR_IS_LIBQHULL=1 $(QHULL_INC) - !ENDIF - !ENDIF - !ENDIF ---- a/apps/makefile.vc -+++ b/apps/makefile.vc -@@ -8,6 +8,9 @@ EXTRAFLAGS = -I..\frmts\vrt -I..\ogr\ogrsf_frmts\geojson\libjson -I..\ogr\ogrsf_ - !INCLUDE ..\nmake.opt - - LIBS = $(GDALLIB) -+!IF "$(DLLBUILD)" != "1" -+LIBS = $(LIBS) $(EXTERNAL_LIBS) -+!ENDIF - - !IFDEF INCLUDE_OGR_FRMTS - OGR_PROGRAMS = gdal_contour.exe gdaltindex.exe gdal_rasterize.exe \ ---- a/frmts/gif/makefile.vc -+++ b/frmts/gif/makefile.vc -@@ -10,14 +10,8 @@ EXTRAFLAGS = -Igiflib - - default: $(OBJ) - xcopy /D /Y *.obj ..\o -- cd giflib -- $(MAKE) /f makefile.vc -- cd .. - - clean: - -del *.obj -- cd giflib -- $(MAKE) /f makefile.vc clean -- cd .. - - ---- a/frmts/jpeg/makefile.vc -+++ b/frmts/jpeg/makefile.vc -@@ -29,12 +29,16 @@ default: $(EXTRA_DEP) $(OBJ) - - clean: - -del *.obj -+!IFNDEF JPEG_EXTERNAL_LIB - cd libjpeg - $(MAKE) /f makefile.vc clean - cd .. -+!ENDIF -+!IFDEF JPEG12_SUPPORTED - cd libjpeg12 - $(MAKE) /f makefile.vc clean - cd .. -+!ENDIF - - libjpeg12src: - cd libjpeg12 ---- a/frmts/kea/makefile.vc -+++ b/frmts/kea/makefile.vc -@@ -1,7 +1,7 @@ - - OBJ = keaband.obj keacopy.obj keadataset.obj keadriver.obj keamaskband.obj keaoverview.obj kearat.obj - --EXTRAFLAGS = $(KEA_CFLAGS) -DH5_BUILT_AS_DYNAMIC_LIB -+EXTRAFLAGS = $(KEA_CFLAGS) - - GDAL_ROOT = ..\.. - ---- a/frmts/makefile.vc -+++ b/frmts/makefile.vc -@@ -3,11 +3,11 @@ GDAL_ROOT = .. - - EXTRAFLAGS = -DFRMT_ceos -DFRMT_aigrid -DFRMT_elas -DFRMT_hfa -DFRMT_gtiff\ - -DFRMT_sdts -DFRMT_raw -DFRMT_gxf -DFRMT_ceos2 -DFRMT_png \ -- -DFRMT_dted -DFRMT_mem -DFRMT_jdem -DFRMT_gif \ -+ -DFRMT_dted -DFRMT_mem -DFRMT_jdem \ - -DFRMT_envisat -DFRMT_aaigrid -DFRMT_usgsdem -DFRMT_l1b \ - -DFRMT_fit -DFRMT_vrt -DFRMT_xpm -DFRMT_bmp -DFRMT_rmf \ -- -DFRMT_nitf -DFRMT_pcidsk -DFRMT_airsar -DFRMT_rs2 \ -- -DFRMT_ilwis -DFRMT_msgn -DFRMT_rik -DFRMT_pcraster \ -+ -DFRMT_nitf -DFRMT_airsar -DFRMT_rs2 \ -+ -DFRMT_ilwis -DFRMT_msgn -DFRMT_rik \ - -DFRMT_leveller -DFRMT_sgi -DFRMT_srtmhgt -DFRMT_idrisi \ - -DFRMT_jaxapalsar -DFRMT_ers -DFRMT_ingr -DFRMT_dimap \ - -DFRMT_gff -DFRMT_terragen -DFRMT_gsg -DFRMT_cosar -DFRMT_pds \ -@@ -32,6 +32,22 @@ PLUGINDIRLIST = $(PLUGINFLAGS:-DFRMT_=) - EXTRAFLAGS = $(EXTRAFLAGS) -DFRMT_postgisraster - !ENDIF - -+!IFDEF GIF_SETTING -+EXTRAFLAGS = $(EXTRAFLAGS) -DFRMT_gif -+!ENDIF -+ -+!IFDEF PCIDSK_SETTING -+EXTRAFLAGS = $(EXTRAFLAGS) -DFRMT_pcidsk -+!ENDIF -+ -+!IFDEF PCRASTER_SETTING -+EXTRAFLAGS = $(EXTRAFLAGS) -DFRMT_pcraster -+!ENDIF -+ -+!IFDEF EXR_INC -+EXTRAFLAGS = $(EXTRAFLAGS) -DFRMT_exr -+!ENDIF -+ - !IFDEF JPEG_SUPPORTED - EXTRAFLAGS = -DFRMT_jpeg $(EXTRAFLAGS) - !ENDIF ---- a/frmts/pcidsk/makefile.vc -+++ b/frmts/pcidsk/makefile.vc -@@ -14,7 +14,11 @@ OBJ = pcidskdataset2.obj ogrpcidsklayer.obj vsi_pcidsk_io.obj gdal_edb.obj - !ENDIF - - !IF "$(PCIDSK_SETTING)" == "INTERNAL" -+!IFDEF JPEG_SUPPORTED - PCIDSKFLAGS = -Isdk -DPCIDSK_INTERNAL -DHAVE_LIBJPEG -+!ELSE -+PCIDSKFLAGS = -Isdk -DPCIDSK_INTERNAL -+!ENDIF - - OBJ = pcidskdataset2.obj ogrpcidsklayer.obj vsi_pcidsk_io.obj gdal_edb.obj \ - sdk\channel\cbandinterleavedchannel.obj \ -@@ -57,11 +61,13 @@ OBJ = pcidskdataset2.obj ogrpcidsklayer.obj vsi_pcidsk_io.obj gdal_edb.obj \ - - !ENDIF - -+!IFDEF JPEG_SUPPORTED - !IFDEF JPEG_EXTERNAL_LIB - JPEGFLAGS = -I$(JPEGDIR) - !ELSE - JPEGFLAGS = -I..\jpeg\libjpeg - !ENDIF -+!ENDIF - - .cpp.obj: - $(CC) $(CFLAGS) $(PCIDSKFLAGS) $(JPEGFLAGS) /c $*.cpp /Fo$*.obj ---- a/makefile.vc -+++ b/makefile.vc -@@ -84,7 +84,7 @@ staticlib: $(LIB_DEPENDS) - call <= 4.0) -- AC_CHECK_LIB(tiff,TIFFScanlineSize64,HAVE_BIGTIFF=yes,HAVE_BIGTIFF=no,) -+ AC_CHECK_LIB(tiff,TIFFScanlineSize64,HAVE_BIGTIFF=yes,HAVE_BIGTIFF=no,$LIBS) - - fi - -@@ -1333,23 +1337,11 @@ AC_ARG_WITH(curl, - dnl Clear some cache variables - unset ac_cv_path_LIBCURL - --if test "`basename xx/$with_curl`" = "curl-config" ; then -- LIBCURL_CONFIG="$with_curl" --elif test "$with_curl" = "no" ; then -- LIBCURL_CONFIG=no -+PKG_PROG_PKG_CONFIG([0.21]) -+if test "$with_curl" = "yes" ; then -+ PKG_CHECK_MODULES([CURL], [libcurl], [CURL_SETTING=yes], [AC_MSG_ERROR([libcurl not found...])]) - else -- AC_PATH_PROG(LIBCURL_CONFIG, curl-config, no) --fi -- --if test "$LIBCURL_CONFIG" != "no" ; then -- -- CURL_VERNUM=`$LIBCURL_CONFIG --vernum` -- CURL_VER=`$LIBCURL_CONFIG --version | awk '{print $2}'` -- -- AC_MSG_RESULT([ found libcurl version $CURL_VER]) -- -- AC_CHECK_LIB(curl,curl_global_init,CURL_SETTING=yes,CURL_SETTING=no,`$LIBCURL_CONFIG --libs`) -- -+ CURL_SETTING=no - fi - - AC_SUBST(CURL_SETTING,$CURL_SETTING) -@@ -1361,8 +1353,11 @@ dnl Check for SQLite - dnl Proj depends on it so it must appear before. - dnl --------------------------------------------------------------------------- - --SQLITE3_REQ_VERSION="3.0.0" --AX_LIB_SQLITE3($SQLITE3_REQ_VERSION) -+HAVE_SQLITE3=no -+AC_ARG_WITH(sqlite3, AS_HELP_STRING([--with-sqlite3[=ARG]], [use SQLite 3 library (ARG=yes or no)]),,) -+if test x"$with_sqlite3" = x"yes" ; then -+ PKG_CHECK_MODULES([SQLITE3], [sqlite3 >= 3.0.0], [HAVE_SQLITE3=yes], [AC_MSG_ERROR([sqlite3 not found...])]) -+fi - - if test "$HAVE_SQLITE3" = "yes"; then - LIBS="$SQLITE3_LDFLAGS $LIBS" -@@ -1393,11 +1388,7 @@ if test "x$with_proj" = "xno" ; then - else - - if test "x$with_proj" = "xyes" -o "x$with_proj" = "x"; then -- ORIG_LIBS="$LIBS" -- LIBS="-lproj $with_proj_extra_lib_for_test $ORIG_LIBS" -- AC_LANG_PUSH([C++]) -- AC_CHECK_LIB(proj,proj_create_from_wkt,PROJ_FOUND=yes,PROJ_FOUND=no,) -- AC_LANG_POP([C++]) -+ PROJ_FOUND=yes - if test "$PROJ_FOUND" = "no"; then - AC_LANG_PUSH([C++]) - AC_CHECK_LIB(proj,internal_proj_create_from_wkt,PROJ_FOUND=yes,PROJ_FOUND=no,) -@@ -1820,8 +1811,8 @@ fi - - if test "$CURL_SETTING" = "yes" ; then - -- CURL_INC=`$LIBCURL_CONFIG --cflags` -- CURL_LIB=`$LIBCURL_CONFIG --libs` -+ CURL_INC="$CURL_CFLAGS" -+ CURL_LIB="$CURL_LIBS" - m4_foreach_w([frmt],CURL_FORMATS,[ - driver_enabled=m4_join([_],[$INTERNAL_FORMAT],frmt,[ENABLED]) - if test "x$driver_enabled" = "xyes"; then -@@ -2153,7 +2144,6 @@ else - - DDS_SETTING=yes - CRUNCHDIR="$with_dds" -- LIBS="-L$with_dds/lib/ -lcrunch $LIBS" - echo "using libcrunch from $with_dds." - - fi -@@ -2304,7 +2294,6 @@ else - - dnl We now require libgeotiff 1.5.0 - dnl first check if $with_geotiff/lib has the library: -- AC_CHECK_LIB(geotiff,GTIFAttachPROJContext,GEOTIFF_SETTING=external,GEOTIFF_SETTING=not_found,-L$with_geotiff/lib) - - if test $GEOTIFF_SETTING = "external" ; then - LIBS="-L$with_geotiff/lib -lgeotiff $LIBS" -@@ -2872,6 +2861,10 @@ if test x"$with_hdf4" = x"no" ; then - - echo "hdf4 support disabled." - -+elif test x"$with_hdf4" = x"yes" ; then -+ PKG_CHECK_MODULES([HDF4], [hdf], [HAVE_HDF4=yes], [AC_MSG_ERROR([hdf4 not found...])]) -+ PKG_CHECK_MODULES([HDF4], [hdf >= 4.2.5], [HDF4_HAS_MAXOPENFILES=yes], [HDF4_HAS_MAXOPENFILES=no]) -+ HDF4_INCLUDE="$HDF4_CFLAGS" - else - - if test x"$with_hdf4" = x"yes" -o x"$with_hdf4" = x"" ; then -@@ -3002,7 +2995,6 @@ elif test "$with_hdf5" = "yes" -o "$with_hdf5" = "" ; then - # Test that the package found is for the right architecture - saved_LIBS="$LIBS" - LIBS="$HDF5_LIBS" -- AC_CHECK_LIB(hdf5,H5Fopen, [HAVE_HDF5=yes], [HAVE_HDF5=no]) - LIBS="$saved_LIBS" - - if test "$HAVE_HDF5" = "yes"; then -@@ -3071,21 +3063,21 @@ KEA_CONFIG=no - - AC_ARG_WITH(kea,[ --with-kea[=ARG] Include kealib (ARG=path to kea-config) [[default=yes]]],,) - -+AC_MSG_CHECKING([for kea]) - if test "$with_kea" = "yes" -o "x$with_kea" = "x" ; then -- AC_PATH_PROG(KEA_CONFIG, kea-config, no) -+ HAVE_KEA=yes -+ AC_MSG_RESULT([yes]) - else -- KEA_CONFIG=$with_kea -+ HAVE_KEA=no -+ AC_MSG_RESULT([no]) - fi - --AC_MSG_CHECKING([for kea]) - - if test "$KEA_CONFIG" = "no" ; then - -- HAVE_KEA=no - KEA_LIB= - KEA_INC= - -- AC_MSG_RESULT([no]) - - else - if test -d $KEA_CONFIG ; then -@@ -3937,18 +3929,15 @@ MYSQL_CONFIG=no - AC_ARG_WITH(mysql,[ --with-mysql[=ARG] Include MySQL (ARG=path to mysql_config) [[default=no]]],,) - - if test "$with_mysql" = "yes" ; then -- AC_PATH_PROG(MYSQL_CONFIG, mysql_config, no) -+ HAVE_MYSQL=yes - else -- if test "x$with_mysql" != "x" ; then -- MYSQL_CONFIG=$with_mysql -- fi -+ HAVE_MYSQL=no - fi - - AC_MSG_CHECKING([for MySQL]) - - if test "$MYSQL_CONFIG" = "no" ; then - -- HAVE_MYSQL=no - MYSQL_LIB= - MYSQL_INC= - -@@ -4042,8 +4031,11 @@ dnl Check for Expat configuration. - dnl --------------------------------------------------------------------------- - - dnl Expat 1.95.0 released in 2000-09-28 --EXPAT_REQ_VERSION="1.95.0" --AX_LIB_EXPAT($EXPAT_REQ_VERSION) -+# AX_LIB_EXPAT is too fragile, it doesn't properly handle debug expat on Windows -+HAVE_EXPAT=no -+AC_ARG_WITH([expat], AS_HELP_STRING([--with-expat[=ARG]], [use Expat library (ARG=yes or no)]),,) -+if test x"$with_expat" = x"yes" ; then -+PKG_CHECK_MODULES([EXPAT], [expat >= 1.95.0], [HAVE_EXPAT=yes], [AC_MSG_ERROR([expat not found...])]) - - if test "$HAVE_EXPAT" = "yes"; then - LIBS="$EXPAT_LDFLAGS $LIBS" -@@ -4056,6 +4048,7 @@ m4_foreach_w([frmt],EXPAT_DRIVERS,[ - fi - ]) - -+fi - fi - - AC_SUBST([HAVE_EXPAT], $HAVE_EXPAT) -@@ -4287,7 +4280,6 @@ if test "x$with_xml2" = "xyes" -o "x$with_xml2" = "x" ; then - if test "${HAVE_LIBXML2}" = "yes"; then - SAVED_LIBS="${LIBS}" - LIBS="${LIBXML2_LIBS}" -- AC_CHECK_LIB(xml2,xmlParseDoc,HAVE_LIBXML2=yes,HAVE_LIBXML2=no) - LIBS="${SAVED_LIBS}" - fi - -@@ -4567,8 +4559,13 @@ dnl --------------------------------------------------------------------------- - dnl Check if geos library is available. - dnl --------------------------------------------------------------------------- - --GEOS_INIT(3.1.0) -+AC_ARG_WITH(geos, AS_HELP_STRING([--with-geos[=ARG]], [Include GEOS support (ARG=yes or no)]),,) - HAVE_GEOS_RESULT="no" -+HAVE_GEOS=no -+if test x"$with_geos" = x"no" ; then -+ AC_MSG_RESULT([GEOS support disabled]) -+else -+ PKG_CHECK_MODULES([GEOS], [geos >= 3.1.0], [HAVE_GEOS=yes], [AC_MSG_ERROR([geos not found...])]) - if test "${HAVE_GEOS}" = "yes" ; then - - AC_MSG_NOTICE([Using C API from GEOS $GEOS_VERSION]) -@@ -4577,6 +4574,8 @@ if test "${HAVE_GEOS}" = "yes" ; then - LIBS="${GEOS_LIBS} ${LIBS}" - HAVE_GEOS_RESULT="yes" - fi -+fi -+AC_SUBST(HAVE_GEOS, $HAVE_GEOS) - - dnl --------------------------------------------------------------------------- - dnl Check if SFCGAL library is available. -@@ -4611,20 +4610,18 @@ elif test "$with_qhull" = "yes" -o "$with_qhull" = "" ; then - # qhull/qhull.h - AC_CHECK_HEADERS([qhull/libqhull.h]) - if test "$ac_cv_header_qhull_libqhull_h" = "yes"; then -- AC_CHECK_LIB(qhull,qh_new_qhull,QHULL_SETTING=yes,QHULL_SETTING=no,) -+ QHULL_SETTING=yes - if test "$QHULL_SETTING" = "yes"; then - QHULL_SETTING=external - QHULL_INCLUDE_SUBDIR_IS_LIBQHULL=0 -- LIBS="-lqhull $LIBS" - fi - fi - AC_CHECK_HEADERS([libqhull/libqhull.h]) - if test "$ac_cv_header_libqhull_libqhull_h" = "yes"; then -- AC_CHECK_LIB(qhull,qh_new_qhull,QHULL_SETTING=yes,QHULL_SETTING=no,) -+ QHULL_SETTING=yes - if test "$QHULL_SETTING" = "yes"; then - QHULL_SETTING=external - QHULL_INCLUDE_SUBDIR_IS_LIBQHULL=1 -- LIBS="-lqhull $LIBS" - fi - fi - -@@ -4711,7 +4708,9 @@ AC_MSG_CHECKING([for FreeXL support]) - HAVE_FREEXL=no - FREEXL_INCLUDE= - --if test "$with_freexl" = "" -o "$with_freexl" = "yes" ; then -+if test "$with_freexl" = "yes"; then -+ PKG_CHECK_MODULES([FREEXL], [freexl >= 1.0.0], [HAVE_FREEXL=yes], [AC_MSG_ERROR([freexl not found...])]) -+elif test "$with_freexl" = ""; then - AC_CHECK_HEADERS(freexl.h) - AC_CHECK_LIB(freexl,freexl_open,FREEXL_LIBS="-lfreexl",FREEXL_LIBS=missing) - -@@ -4817,8 +4816,7 @@ if test "$with_libjson_c" = "external" -o "$with_libjson_c" = "" -o "$with_libjs - elif test "$with_libjson_c" = "internal" ; then - LIBJSONC_SETTING=internal - elif test "$with_libjson_c" != "no"; then -- LIBS="-L$with_libjson_c/lib $LIBS" -- AC_CHECK_LIB(json-c,json_object_set_serializer,LIBJSONC_SETTING=external,LIBJSONC_SETTING=internal,-L$with_libjson_c/lib) -+ LIBJSONC_SETTING=external - else - AC_MSG_ERROR([libjson-c (internal or external) is required]) - fi -@@ -5928,7 +5926,6 @@ else - # Test that the package found is for the right architecture - saved_LIBS="$LIBS" - LIBS="$EXR_LIBS" -- AC_CHECK_LIB(IlmImf,ImfTiledInputReadTile, [HAVE_EXR=yes], [HAVE_EXR=no]) - LIBS="$saved_LIBS" - - if test "$HAVE_EXR" = "yes"; then diff --git a/recipes/gdal/pre_3.5.0/patches/3.2.x/fix-include-jsonc.patch b/recipes/gdal/pre_3.5.0/patches/3.2.x/fix-include-jsonc.patch deleted file mode 100644 index e88043df4189f..0000000000000 --- a/recipes/gdal/pre_3.5.0/patches/3.2.x/fix-include-jsonc.patch +++ /dev/null @@ -1,104 +0,0 @@ ---- a/gcore/gdal_rat.cpp -+++ b/gcore/gdal_rat.cpp -@@ -50,7 +50,7 @@ - #pragma clang diagnostic ignored "-Wunknown-pragmas" - #pragma clang diagnostic ignored "-Wdocumentation" - #endif --#include "json.h" -+#include - #ifdef __clang__ - #pragma clang diagnostic pop - #endif ---- a/ogr/ogrsf_frmts/geojson/ogresrijsonreader.cpp -+++ b/ogr/ogrsf_frmts/geojson/ogresrijsonreader.cpp -@@ -37,7 +37,7 @@ - - #include "cpl_conv.h" - #include "cpl_error.h" --#include "json.h" -+#include - // #include "json_object.h" - // #include "json_tokener.h" - #include "ogr_api.h" ---- a/ogr/ogrsf_frmts/geojson/ogrgeojsondatasource.cpp -+++ b/ogr/ogrsf_frmts/geojson/ogrgeojsondatasource.cpp -@@ -41,7 +41,7 @@ - #include "cpl_string.h" - #include "cpl_vsi.h" - #include "cpl_vsi_error.h" --#include "json.h" -+#include - // #include "json_object.h" - #include "gdal_utils.h" - #include "gdal.h" ---- a/ogr/ogrsf_frmts/geojson/ogrgeojsonlayer.cpp -+++ b/ogr/ogrsf_frmts/geojson/ogrgeojsonlayer.cpp -@@ -37,7 +37,7 @@ - # endif - #endif // !DEBUG_VERBOSE - --#include -+#include - - #if !DEBUG_JSON - # ifdef __clang ---- a/ogr/ogrsf_frmts/geojson/ogrgeojsonreader.cpp -+++ b/ogr/ogrsf_frmts/geojson/ogrgeojsonreader.cpp -@@ -32,7 +32,7 @@ - #include "ogrgeojsonreader.h" - #include "ogrgeojsonutils.h" - #include "ogr_geojson.h" --#include // JSON-C -+#include - - #if (!defined(JSON_C_VERSION_NUM)) || (JSON_C_VERSION_NUM < JSON_C_VER_013) - #include // just for sizeof(struct json_object) ---- a/ogr/ogrsf_frmts/geojson/ogrgeojsonutils.cpp -+++ b/ogr/ogrsf_frmts/geojson/ogrgeojsonutils.cpp -@@ -32,7 +32,7 @@ - #include - #include - #include --#include // JSON-C -+#include - - #include - #include ---- a/ogr/ogrsf_frmts/geojson/ogrgeojsonwriter.cpp -+++ b/ogr/ogrsf_frmts/geojson/ogrgeojsonwriter.cpp -@@ -33,13 +33,13 @@ - #include "ogrgeojsonutils.h" - #include "ogr_geojson.h" - #include "ogrgeojsonreader.h" --#include // JSON-C -+#include - - #if (!defined(JSON_C_VERSION_NUM)) || (JSON_C_VERSION_NUM < JSON_C_VER_013) - #include - #endif - --#include -+#include - #include - #include - ---- a/ogr/ogrsf_frmts/geojson/ogrtopojsonreader.cpp -+++ b/ogr/ogrsf_frmts/geojson/ogrtopojsonreader.cpp -@@ -30,5 +30,5 @@ - #include "ogrgeojsonutils.h" - #include "ogr_geojson.h" --#include // JSON-C -+#include - #include - ---- a/port/cpl_json_header.h -+++ b/port/cpl_json_header.h -@@ -33,7 +33,7 @@ - #pragma GCC system_header - #endif - --#include -+#include - - #undef json_object_object_foreachC - #define json_object_object_foreachC(obj,iter) \ diff --git a/recipes/gdal/pre_3.5.0/patches/3.2.x/fix-include-podofo.patch b/recipes/gdal/pre_3.5.0/patches/3.2.x/fix-include-podofo.patch deleted file mode 100644 index aa86489f0296b..0000000000000 --- a/recipes/gdal/pre_3.5.0/patches/3.2.x/fix-include-podofo.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/frmts/pdf/pdfsdk_headers.h -+++ b/frmts/pdf/pdfsdk_headers.h -@@ -103,7 +103,7 @@ typedef unsigned char Guchar; - #undef GetObject - #endif - --#include "podofo.h" -+#include - #endif // HAVE_PODOFO - - #ifdef HAVE_PDFIUM diff --git a/recipes/gdal/pre_3.5.0/patches/3.2.x/fix-include-xerces.patch b/recipes/gdal/pre_3.5.0/patches/3.2.x/fix-include-xerces.patch deleted file mode 100644 index 8b08760381794..0000000000000 --- a/recipes/gdal/pre_3.5.0/patches/3.2.x/fix-include-xerces.patch +++ /dev/null @@ -1,63 +0,0 @@ ---- a/ogr/ogr_xerces_headers.h -+++ b/ogr/ogr_xerces_headers.h -@@ -33,9 +33,9 @@ - #pragma GCC system_header - #endif - --#include --#include --#include -+#include -+#include -+#include - - #ifdef XERCES_CPP_NAMESPACE_USE - XERCES_CPP_NAMESPACE_USE ---- a/ogr/ogrsf_frmts/gml/xercesc_headers.h -+++ b/ogr/ogrsf_frmts/gml/xercesc_headers.h -@@ -33,13 +33,13 @@ - #pragma GCC system_header - #endif - --#include --#include --#include --#include --#include --#include --#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include - - #ifdef XERCES_CPP_NAMESPACE_USE - XERCES_CPP_NAMESPACE_USE ---- a/ogr/ogrsf_frmts/ili/xercesc_headers.h -+++ b/ogr/ogrsf_frmts/ili/xercesc_headers.h -@@ -33,14 +33,14 @@ - #pragma GCC system_header - #endif - --#include --#include --#include --#include --#include --#include --#include --#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include - - #ifdef XERCES_CPP_NAMESPACE_USE - XERCES_CPP_NAMESPACE_USE diff --git a/recipes/gdal/pre_3.5.0/patches/3.2.x/fix-nmake.patch b/recipes/gdal/pre_3.5.0/patches/3.2.x/fix-nmake.patch deleted file mode 100644 index e23b85d35a16a..0000000000000 --- a/recipes/gdal/pre_3.5.0/patches/3.2.x/fix-nmake.patch +++ /dev/null @@ -1,179 +0,0 @@ ---- a/alg/makefile.vc -+++ b/alg/makefile.vc -@@ -14,7 +14,7 @@ EXTRAFLAGS = -I../frmts/vrt -I../ogr/ogrsf_frmts $(GEOS_CFLAGS) $(PROJ_FLAGS) $( - EXTRAFLAGS = $(EXTRAFLAGS) -DINTERNAL_QHULL - !ELSE - !IF "$(QHULL_SETTING)" == "EXTERNAL" --EXTRAFLAGS = $(EXTRAFLAGS) -DEXTERNAL_QHULL $(QHULL_INC) -+EXTRAFLAGS = $(EXTRAFLAGS) -DEXTERNAL_QHULL -DQHULL_INCLUDE_SUBDIR_IS_LIBQHULL=1 $(QHULL_INC) - !ENDIF - !ENDIF - !ENDIF ---- a/apps/makefile.vc -+++ b/apps/makefile.vc -@@ -8,6 +8,9 @@ EXTRAFLAGS = -I..\frmts\vrt -I..\ogr\ogrsf_frmts\geojson\libjson -I..\ogr\ogrsf_ - !INCLUDE ..\nmake.opt - - LIBS = $(GDALLIB) -+!IF "$(DLLBUILD)" != "1" -+LIBS = $(LIBS) $(EXTERNAL_LIBS) -+!ENDIF - - !IFDEF INCLUDE_OGR_FRMTS - OGR_PROGRAMS = gdal_contour.exe gdaltindex.exe gdal_rasterize.exe \ ---- a/frmts/gif/makefile.vc -+++ b/frmts/gif/makefile.vc -@@ -10,14 +10,8 @@ EXTRAFLAGS = -Igiflib - - default: $(OBJ) - xcopy /D /Y *.obj ..\o -- cd giflib -- $(MAKE) /f makefile.vc -- cd .. - - clean: - -del *.obj -- cd giflib -- $(MAKE) /f makefile.vc clean -- cd .. - - ---- a/frmts/jpeg/makefile.vc -+++ b/frmts/jpeg/makefile.vc -@@ -29,12 +29,16 @@ default: $(EXTRA_DEP) $(OBJ) - - clean: - -del *.obj -+!IFNDEF JPEG_EXTERNAL_LIB - cd libjpeg - $(MAKE) /f makefile.vc clean - cd .. -+!ENDIF -+!IFDEF JPEG12_SUPPORTED - cd libjpeg12 - $(MAKE) /f makefile.vc clean - cd .. -+!ENDIF - - libjpeg12src: - cd libjpeg12 ---- a/frmts/kea/makefile.vc -+++ b/frmts/kea/makefile.vc -@@ -1,7 +1,7 @@ - - OBJ = keaband.obj keacopy.obj keadataset.obj keadriver.obj keamaskband.obj keaoverview.obj kearat.obj - --EXTRAFLAGS = $(KEA_CFLAGS) -DH5_BUILT_AS_DYNAMIC_LIB -+EXTRAFLAGS = $(KEA_CFLAGS) - - GDAL_ROOT = ..\.. - ---- a/frmts/makefile.vc -+++ b/frmts/makefile.vc -@@ -3,11 +3,11 @@ GDAL_ROOT = .. - - EXTRAFLAGS = -DFRMT_ceos -DFRMT_aigrid -DFRMT_elas -DFRMT_hfa -DFRMT_gtiff\ - -DFRMT_sdts -DFRMT_raw -DFRMT_gxf -DFRMT_ceos2 -DFRMT_png \ -- -DFRMT_dted -DFRMT_mem -DFRMT_jdem -DFRMT_gif -DFRMT_esric \ -+ -DFRMT_dted -DFRMT_mem -DFRMT_jdem -DFRMT_esric \ - -DFRMT_envisat -DFRMT_aaigrid -DFRMT_usgsdem -DFRMT_l1b \ - -DFRMT_fit -DFRMT_vrt -DFRMT_xpm -DFRMT_bmp -DFRMT_rmf \ -- -DFRMT_nitf -DFRMT_pcidsk -DFRMT_airsar -DFRMT_rs2 \ -- -DFRMT_ilwis -DFRMT_msgn -DFRMT_rik -DFRMT_pcraster \ -+ -DFRMT_nitf -DFRMT_airsar -DFRMT_rs2 \ -+ -DFRMT_ilwis -DFRMT_msgn -DFRMT_rik \ - -DFRMT_leveller -DFRMT_sgi -DFRMT_srtmhgt -DFRMT_idrisi \ - -DFRMT_jaxapalsar -DFRMT_ers -DFRMT_ingr -DFRMT_dimap \ - -DFRMT_gff -DFRMT_terragen -DFRMT_gsg -DFRMT_cosar -DFRMT_pds \ -@@ -32,6 +32,22 @@ PLUGINDIRLIST = $(PLUGINFLAGS:-DFRMT_=) - EXTRAFLAGS = $(EXTRAFLAGS) -DFRMT_postgisraster - !ENDIF - -+!IFDEF GIF_SETTING -+EXTRAFLAGS = $(EXTRAFLAGS) -DFRMT_gif -+!ENDIF -+ -+!IFDEF PCIDSK_SETTING -+EXTRAFLAGS = $(EXTRAFLAGS) -DFRMT_pcidsk -+!ENDIF -+ -+!IFDEF PCRASTER_SETTING -+EXTRAFLAGS = $(EXTRAFLAGS) -DFRMT_pcraster -+!ENDIF -+ -+!IFDEF EXR_INC -+EXTRAFLAGS = $(EXTRAFLAGS) -DFRMT_exr -+!ENDIF -+ - !IFDEF JPEG_SUPPORTED - EXTRAFLAGS = -DFRMT_jpeg $(EXTRAFLAGS) - !ENDIF ---- a/frmts/pcidsk/makefile.vc -+++ b/frmts/pcidsk/makefile.vc -@@ -14,7 +14,11 @@ OBJ = pcidskdataset2.obj ogrpcidsklayer.obj vsi_pcidsk_io.obj gdal_edb.obj - !ENDIF - - !IF "$(PCIDSK_SETTING)" == "INTERNAL" -+!IFDEF JPEG_SUPPORTED - PCIDSKFLAGS = -Isdk -DPCIDSK_INTERNAL -DHAVE_LIBJPEG -+!ELSE -+PCIDSKFLAGS = -Isdk -DPCIDSK_INTERNAL -+!ENDIF - - OBJ = pcidskdataset2.obj ogrpcidsklayer.obj vsi_pcidsk_io.obj gdal_edb.obj \ - sdk\channel\cbandinterleavedchannel.obj \ -@@ -57,11 +61,13 @@ OBJ = pcidskdataset2.obj ogrpcidsklayer.obj vsi_pcidsk_io.obj gdal_edb.obj \ - - !ENDIF - -+!IFDEF JPEG_SUPPORTED - !IFDEF JPEG_EXTERNAL_LIB - JPEGFLAGS = -I$(JPEGDIR) - !ELSE - JPEGFLAGS = -I..\jpeg\libjpeg - !ENDIF -+!ENDIF - - .cpp.obj: - $(CC) $(CFLAGS) $(PCIDSKFLAGS) $(JPEGFLAGS) /c $*.cpp /Fo$*.obj ---- a/makefile.vc -+++ b/makefile.vc -@@ -84,7 +84,7 @@ staticlib: $(LIB_DEPENDS) - call <= 4.0) -- AC_CHECK_LIB(tiff,TIFFScanlineSize64,HAVE_BIGTIFF=yes,HAVE_BIGTIFF=no,) -+ AC_CHECK_LIB(tiff,TIFFScanlineSize64,HAVE_BIGTIFF=yes,HAVE_BIGTIFF=no,$LIBS) - - fi - -@@ -1402,23 +1406,11 @@ AC_ARG_WITH(curl, - dnl Clear some cache variables - unset ac_cv_path_LIBCURL - --if test "`basename xx/$with_curl`" = "curl-config" ; then -- LIBCURL_CONFIG="$with_curl" --elif test "$with_curl" = "no" ; then -- LIBCURL_CONFIG=no -+PKG_PROG_PKG_CONFIG([0.21]) -+if test "$with_curl" = "yes" ; then -+ PKG_CHECK_MODULES([CURL], [libcurl], [CURL_SETTING=yes], [AC_MSG_ERROR([libcurl not found...])]) - else -- AC_PATH_PROG(LIBCURL_CONFIG, curl-config, no) --fi -- --if test "$LIBCURL_CONFIG" != "no" ; then -- -- CURL_VERNUM=`$LIBCURL_CONFIG --vernum` -- CURL_VER=`$LIBCURL_CONFIG --version | awk '{print $2}'` -- -- AC_MSG_RESULT([ found libcurl version $CURL_VER]) -- -- AC_CHECK_LIB(curl,curl_global_init,CURL_SETTING=yes,CURL_SETTING=no,`$LIBCURL_CONFIG --libs`) -- -+ CURL_SETTING=no - fi - - AC_SUBST(CURL_SETTING,$CURL_SETTING) -@@ -1430,8 +1422,11 @@ dnl Check for SQLite - dnl Proj depends on it so it must appear before. - dnl --------------------------------------------------------------------------- - --SQLITE3_REQ_VERSION="3.0.0" --AX_LIB_SQLITE3($SQLITE3_REQ_VERSION) -+HAVE_SQLITE3=no -+AC_ARG_WITH(sqlite3, AS_HELP_STRING([--with-sqlite3[=ARG]], [use SQLite 3 library (ARG=yes or no)]),,) -+if test x"$with_sqlite3" = x"yes" ; then -+ PKG_CHECK_MODULES([SQLITE3], [sqlite3 >= 3.0.0], [HAVE_SQLITE3=yes], [AC_MSG_ERROR([sqlite3 not found...])]) -+fi - - if test "$HAVE_SQLITE3" = "yes"; then - LIBS="$SQLITE3_LDFLAGS $LIBS" -@@ -1462,11 +1457,7 @@ if test "x$with_proj" = "xno" ; then - else - - if test "x$with_proj" = "xyes" -o "x$with_proj" = "x"; then -- ORIG_LIBS="$LIBS" -- LIBS="-lproj $with_proj_extra_lib_for_test $ORIG_LIBS" -- AC_LANG_PUSH([C++]) -- AC_CHECK_LIB(proj,proj_create_from_wkt,PROJ_FOUND=yes,PROJ_FOUND=no,) -- AC_LANG_POP([C++]) -+ PROJ_FOUND=yes - if test "$PROJ_FOUND" = "no"; then - AC_LANG_PUSH([C++]) - AC_CHECK_LIB(proj,internal_proj_create_from_wkt,PROJ_FOUND=yes,PROJ_FOUND=no,) -@@ -1889,8 +1880,8 @@ fi - - if test "$CURL_SETTING" = "yes" ; then - -- CURL_INC=`$LIBCURL_CONFIG --cflags` -- CURL_LIB=`$LIBCURL_CONFIG --libs` -+ CURL_INC="$CURL_CFLAGS" -+ CURL_LIB="$CURL_LIBS" - m4_foreach_w([frmt],CURL_FORMATS,[ - driver_enabled=m4_join([_],[$INTERNAL_FORMAT],frmt,[ENABLED]) - if test "x$driver_enabled" = "xyes"; then -@@ -2222,7 +2213,6 @@ else - - DDS_SETTING=yes - CRUNCHDIR="$with_dds" -- LIBS="-L$with_dds/lib/ -lcrunch $LIBS" - echo "using libcrunch from $with_dds." - - fi -@@ -2373,7 +2363,6 @@ else - - dnl We now require libgeotiff 1.5.0 - dnl first check if $with_geotiff/lib has the library: -- AC_CHECK_LIB(geotiff,GTIFAttachPROJContext,GEOTIFF_SETTING=external,GEOTIFF_SETTING=not_found,-L$with_geotiff/lib) - - if test $GEOTIFF_SETTING = "external" ; then - LIBS="-L$with_geotiff/lib -lgeotiff $LIBS" -@@ -2875,6 +2864,10 @@ if test x"$with_hdf4" = x"no" ; then - - echo "hdf4 support disabled." - -+elif test x"$with_hdf4" = x"yes" ; then -+ PKG_CHECK_MODULES([HDF4], [hdf], [HAVE_HDF4=yes], [AC_MSG_ERROR([hdf4 not found...])]) -+ PKG_CHECK_MODULES([HDF4], [hdf >= 4.2.5], [HDF4_HAS_MAXOPENFILES=yes], [HDF4_HAS_MAXOPENFILES=no]) -+ HDF4_INCLUDE="$HDF4_CFLAGS" - else - - if test x"$with_hdf4" = x"yes" -o x"$with_hdf4" = x"" ; then -@@ -3005,7 +2998,6 @@ elif test "$with_hdf5" = "yes" -o "$with_hdf5" = "" ; then - # Test that the package found is for the right architecture - saved_LIBS="$LIBS" - LIBS="$HDF5_LIBS" -- AC_CHECK_LIB(hdf5,H5Fopen, [HAVE_HDF5=yes], [HAVE_HDF5=no]) - LIBS="$saved_LIBS" - - if test "$HAVE_HDF5" = "yes"; then -@@ -3074,21 +3066,21 @@ KEA_CONFIG=no - - AC_ARG_WITH(kea,[ --with-kea[=ARG] Include kealib (ARG=path to kea-config) [[default=yes]]],,) - -+AC_MSG_CHECKING([for kea]) - if test "$with_kea" = "yes" -o "x$with_kea" = "x" ; then -- AC_PATH_PROG(KEA_CONFIG, kea-config, no) -+ HAVE_KEA=yes -+ AC_MSG_RESULT([yes]) - else -- KEA_CONFIG=$with_kea -+ HAVE_KEA=no -+ AC_MSG_RESULT([no]) - fi - --AC_MSG_CHECKING([for kea]) - - if test "$KEA_CONFIG" = "no" ; then - -- HAVE_KEA=no - KEA_LIB= - KEA_INC= - -- AC_MSG_RESULT([no]) - - else - if test -d $KEA_CONFIG ; then -@@ -3940,18 +3932,15 @@ MYSQL_CONFIG=no - AC_ARG_WITH(mysql,[ --with-mysql[=ARG] Include MySQL (ARG=path to mysql_config) [[default=no]]],,) - - if test "$with_mysql" = "yes" ; then -- AC_PATH_PROG(MYSQL_CONFIG, mysql_config, no) -+ HAVE_MYSQL=yes - else -- if test "x$with_mysql" != "x" ; then -- MYSQL_CONFIG=$with_mysql -- fi -+ HAVE_MYSQL=no - fi - - AC_MSG_CHECKING([for MySQL]) - - if test "$MYSQL_CONFIG" = "no" ; then - -- HAVE_MYSQL=no - MYSQL_LIB= - MYSQL_INC= - -@@ -4045,8 +4034,11 @@ dnl Check for Expat configuration. - dnl --------------------------------------------------------------------------- - - dnl Expat 1.95.0 released in 2000-09-28 --EXPAT_REQ_VERSION="1.95.0" --AX_LIB_EXPAT($EXPAT_REQ_VERSION) -+# AX_LIB_EXPAT is too fragile, it doesn't properly handle debug expat on Windows -+HAVE_EXPAT=no -+AC_ARG_WITH([expat], AS_HELP_STRING([--with-expat[=ARG]], [use Expat library (ARG=yes or no)]),,) -+if test x"$with_expat" = x"yes" ; then -+PKG_CHECK_MODULES([EXPAT], [expat >= 1.95.0], [HAVE_EXPAT=yes], [AC_MSG_ERROR([expat not found...])]) - - if test "$HAVE_EXPAT" = "yes"; then - LIBS="$EXPAT_LDFLAGS $LIBS" -@@ -4059,6 +4051,7 @@ m4_foreach_w([frmt],EXPAT_DRIVERS,[ - fi - ]) - -+fi - fi - - AC_SUBST([HAVE_EXPAT], $HAVE_EXPAT) -@@ -4305,7 +4298,6 @@ if test "x$with_xml2" = "xyes" -o "x$with_xml2" = "x" ; then - if test "${HAVE_LIBXML2}" = "yes"; then - SAVED_LIBS="${LIBS}" - LIBS="${LIBXML2_LIBS}" -- AC_CHECK_LIB(xml2,xmlParseDoc,HAVE_LIBXML2=yes,HAVE_LIBXML2=no) - LIBS="${SAVED_LIBS}" - fi - -@@ -4550,13 +4542,18 @@ dnl --------------------------------------------------------------------------- - dnl Check if geos library is available. - dnl --------------------------------------------------------------------------- - --GEOS_INIT(3.1.0) -+AC_ARG_WITH(geos, AS_HELP_STRING([--with-geos[=ARG]], [Include GEOS support (ARG=yes or no)]),,) -+HAVE_GEOS=no -+if test x"$with_geos" = x"no" ; then -+ AC_MSG_RESULT([GEOS support disabled]) -+else -+ PKG_CHECK_MODULES([GEOS], [geos >= 3.1.0], [HAVE_GEOS=yes], [AC_MSG_ERROR([geos not found...])]) - if test "${HAVE_GEOS}" = "yes" ; then - AC_MSG_NOTICE([Using C API from GEOS $GEOS_VERSION]) -- STRIP_SYSTEM_LIBRARY_PATHS("${GEOS_LIBS}") -- GEOS_LIBS="$STRIPPED_LIBRARY_NAME" - LIBS="${GEOS_LIBS} ${LIBS}" - fi -+fi -+AC_SUBST(HAVE_GEOS, $HAVE_GEOS) - - dnl --------------------------------------------------------------------------- - dnl Check if SFCGAL library is available. -@@ -4588,20 +4585,18 @@ elif test "$with_qhull" = "yes" -o "$with_qhull" = "" ; then - # qhull/qhull.h - AC_CHECK_HEADERS([qhull/libqhull.h]) - if test "$ac_cv_header_qhull_libqhull_h" = "yes"; then -- AC_CHECK_LIB(qhull,qh_new_qhull,QHULL_SETTING=yes,QHULL_SETTING=no,) -+ QHULL_SETTING=yes - if test "$QHULL_SETTING" = "yes"; then - QHULL_SETTING=external - QHULL_INCLUDE_SUBDIR_IS_LIBQHULL=0 -- LIBS="-lqhull $LIBS" - fi - fi - AC_CHECK_HEADERS([libqhull/libqhull.h]) - if test "$ac_cv_header_libqhull_libqhull_h" = "yes"; then -- AC_CHECK_LIB(qhull,qh_new_qhull,QHULL_SETTING=yes,QHULL_SETTING=no,) -+ QHULL_SETTING=yes - if test "$QHULL_SETTING" = "yes"; then - QHULL_SETTING=external - QHULL_INCLUDE_SUBDIR_IS_LIBQHULL=1 -- LIBS="-lqhull $LIBS" - fi - fi - -@@ -4688,7 +4683,9 @@ AC_MSG_CHECKING([for FreeXL support]) - HAVE_FREEXL=no - FREEXL_INCLUDE= - --if test "$with_freexl" = "" -o "$with_freexl" = "yes" ; then -+if test "$with_freexl" = "yes"; then -+ PKG_CHECK_MODULES([FREEXL], [freexl >= 1.0.0], [HAVE_FREEXL=yes], [AC_MSG_ERROR([freexl not found...])]) -+elif test "$with_freexl" = ""; then - AC_CHECK_HEADERS(freexl.h) - AC_CHECK_LIB(freexl,freexl_open,FREEXL_LIBS="-lfreexl",FREEXL_LIBS=missing) - -@@ -4794,8 +4791,7 @@ if test "$with_libjson_c" = "external" -o "$with_libjson_c" = "" -o "$with_libjs - elif test "$with_libjson_c" = "internal" ; then - LIBJSONC_SETTING=internal - elif test "$with_libjson_c" != "no"; then -- LIBS="-L$with_libjson_c/lib $LIBS" -- AC_CHECK_LIB(json-c,json_object_set_serializer,LIBJSONC_SETTING=external,LIBJSONC_SETTING=internal,-L$with_libjson_c/lib) -+ LIBJSONC_SETTING=external - else - AC_MSG_ERROR([libjson-c (internal or external) is required]) - fi -@@ -5953,7 +5949,6 @@ else - # Test that the package found is for the right architecture - saved_LIBS="$LIBS" - LIBS="$EXR_LIBS" -- AC_CHECK_LIB(IlmImf,ImfTiledInputReadTile, [HAVE_EXR=yes], [HAVE_EXR=no]) - LIBS="$saved_LIBS" - - if test "$HAVE_EXR" = "yes"; then diff --git a/recipes/gdal/pre_3.5.0/patches/3.3.x/fix-include-jsonc.patch b/recipes/gdal/pre_3.5.0/patches/3.3.x/fix-include-jsonc.patch deleted file mode 100644 index e88043df4189f..0000000000000 --- a/recipes/gdal/pre_3.5.0/patches/3.3.x/fix-include-jsonc.patch +++ /dev/null @@ -1,104 +0,0 @@ ---- a/gcore/gdal_rat.cpp -+++ b/gcore/gdal_rat.cpp -@@ -50,7 +50,7 @@ - #pragma clang diagnostic ignored "-Wunknown-pragmas" - #pragma clang diagnostic ignored "-Wdocumentation" - #endif --#include "json.h" -+#include - #ifdef __clang__ - #pragma clang diagnostic pop - #endif ---- a/ogr/ogrsf_frmts/geojson/ogresrijsonreader.cpp -+++ b/ogr/ogrsf_frmts/geojson/ogresrijsonreader.cpp -@@ -37,7 +37,7 @@ - - #include "cpl_conv.h" - #include "cpl_error.h" --#include "json.h" -+#include - // #include "json_object.h" - // #include "json_tokener.h" - #include "ogr_api.h" ---- a/ogr/ogrsf_frmts/geojson/ogrgeojsondatasource.cpp -+++ b/ogr/ogrsf_frmts/geojson/ogrgeojsondatasource.cpp -@@ -41,7 +41,7 @@ - #include "cpl_string.h" - #include "cpl_vsi.h" - #include "cpl_vsi_error.h" --#include "json.h" -+#include - // #include "json_object.h" - #include "gdal_utils.h" - #include "gdal.h" ---- a/ogr/ogrsf_frmts/geojson/ogrgeojsonlayer.cpp -+++ b/ogr/ogrsf_frmts/geojson/ogrgeojsonlayer.cpp -@@ -37,7 +37,7 @@ - # endif - #endif // !DEBUG_VERBOSE - --#include -+#include - - #if !DEBUG_JSON - # ifdef __clang ---- a/ogr/ogrsf_frmts/geojson/ogrgeojsonreader.cpp -+++ b/ogr/ogrsf_frmts/geojson/ogrgeojsonreader.cpp -@@ -32,7 +32,7 @@ - #include "ogrgeojsonreader.h" - #include "ogrgeojsonutils.h" - #include "ogr_geojson.h" --#include // JSON-C -+#include - - #if (!defined(JSON_C_VERSION_NUM)) || (JSON_C_VERSION_NUM < JSON_C_VER_013) - #include // just for sizeof(struct json_object) ---- a/ogr/ogrsf_frmts/geojson/ogrgeojsonutils.cpp -+++ b/ogr/ogrsf_frmts/geojson/ogrgeojsonutils.cpp -@@ -32,7 +32,7 @@ - #include - #include - #include --#include // JSON-C -+#include - - #include - #include ---- a/ogr/ogrsf_frmts/geojson/ogrgeojsonwriter.cpp -+++ b/ogr/ogrsf_frmts/geojson/ogrgeojsonwriter.cpp -@@ -33,13 +33,13 @@ - #include "ogrgeojsonutils.h" - #include "ogr_geojson.h" - #include "ogrgeojsonreader.h" --#include // JSON-C -+#include - - #if (!defined(JSON_C_VERSION_NUM)) || (JSON_C_VERSION_NUM < JSON_C_VER_013) - #include - #endif - --#include -+#include - #include - #include - ---- a/ogr/ogrsf_frmts/geojson/ogrtopojsonreader.cpp -+++ b/ogr/ogrsf_frmts/geojson/ogrtopojsonreader.cpp -@@ -30,5 +30,5 @@ - #include "ogrgeojsonutils.h" - #include "ogr_geojson.h" --#include // JSON-C -+#include - #include - ---- a/port/cpl_json_header.h -+++ b/port/cpl_json_header.h -@@ -33,7 +33,7 @@ - #pragma GCC system_header - #endif - --#include -+#include - - #undef json_object_object_foreachC - #define json_object_object_foreachC(obj,iter) \ diff --git a/recipes/gdal/pre_3.5.0/patches/3.3.x/fix-include-podofo.patch b/recipes/gdal/pre_3.5.0/patches/3.3.x/fix-include-podofo.patch deleted file mode 100644 index aa86489f0296b..0000000000000 --- a/recipes/gdal/pre_3.5.0/patches/3.3.x/fix-include-podofo.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/frmts/pdf/pdfsdk_headers.h -+++ b/frmts/pdf/pdfsdk_headers.h -@@ -103,7 +103,7 @@ typedef unsigned char Guchar; - #undef GetObject - #endif - --#include "podofo.h" -+#include - #endif // HAVE_PODOFO - - #ifdef HAVE_PDFIUM diff --git a/recipes/gdal/pre_3.5.0/patches/3.3.x/fix-include-xerces.patch b/recipes/gdal/pre_3.5.0/patches/3.3.x/fix-include-xerces.patch deleted file mode 100644 index 8b08760381794..0000000000000 --- a/recipes/gdal/pre_3.5.0/patches/3.3.x/fix-include-xerces.patch +++ /dev/null @@ -1,63 +0,0 @@ ---- a/ogr/ogr_xerces_headers.h -+++ b/ogr/ogr_xerces_headers.h -@@ -33,9 +33,9 @@ - #pragma GCC system_header - #endif - --#include --#include --#include -+#include -+#include -+#include - - #ifdef XERCES_CPP_NAMESPACE_USE - XERCES_CPP_NAMESPACE_USE ---- a/ogr/ogrsf_frmts/gml/xercesc_headers.h -+++ b/ogr/ogrsf_frmts/gml/xercesc_headers.h -@@ -33,13 +33,13 @@ - #pragma GCC system_header - #endif - --#include --#include --#include --#include --#include --#include --#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include - - #ifdef XERCES_CPP_NAMESPACE_USE - XERCES_CPP_NAMESPACE_USE ---- a/ogr/ogrsf_frmts/ili/xercesc_headers.h -+++ b/ogr/ogrsf_frmts/ili/xercesc_headers.h -@@ -33,14 +33,14 @@ - #pragma GCC system_header - #endif - --#include --#include --#include --#include --#include --#include --#include --#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include - - #ifdef XERCES_CPP_NAMESPACE_USE - XERCES_CPP_NAMESPACE_USE diff --git a/recipes/gdal/pre_3.5.0/patches/3.3.x/fix-nmake.patch b/recipes/gdal/pre_3.5.0/patches/3.3.x/fix-nmake.patch deleted file mode 100644 index 4c0ef454c2aac..0000000000000 --- a/recipes/gdal/pre_3.5.0/patches/3.3.x/fix-nmake.patch +++ /dev/null @@ -1,179 +0,0 @@ ---- a/alg/makefile.vc -+++ b/alg/makefile.vc -@@ -14,7 +14,7 @@ EXTRAFLAGS = -I../frmts/vrt -I../ogr/ogrsf_frmts $(GEOS_CFLAGS) $(PROJ_FLAGS) $( - EXTRAFLAGS = $(EXTRAFLAGS) -DINTERNAL_QHULL - !ELSE - !IF "$(QHULL_SETTING)" == "EXTERNAL" --EXTRAFLAGS = $(EXTRAFLAGS) -DEXTERNAL_QHULL $(QHULL_INC) -+EXTRAFLAGS = $(EXTRAFLAGS) -DEXTERNAL_QHULL -DQHULL_INCLUDE_SUBDIR_IS_LIBQHULL=1 $(QHULL_INC) - !ENDIF - !ENDIF - !ENDIF ---- a/apps/makefile.vc -+++ b/apps/makefile.vc -@@ -8,6 +8,9 @@ EXTRAFLAGS = -I..\frmts\vrt -I..\ogr\ogrsf_frmts\geojson\libjson -I..\ogr\ogrsf_ - !INCLUDE ..\nmake.opt - - LIBS = $(GDALLIB) -+!IF "$(DLLBUILD)" != "1" -+LIBS = $(LIBS) $(EXTERNAL_LIBS) -+!ENDIF - - !IFDEF INCLUDE_OGR_FRMTS - OGR_PROGRAMS = gdal_contour.exe gdaltindex.exe gdal_rasterize.exe \ ---- a/frmts/gif/makefile.vc -+++ b/frmts/gif/makefile.vc -@@ -10,14 +10,8 @@ EXTRAFLAGS = -Igiflib - - default: $(OBJ) - xcopy /D /Y *.obj ..\o -- cd giflib -- $(MAKE) /f makefile.vc -- cd .. - - clean: - -del *.obj -- cd giflib -- $(MAKE) /f makefile.vc clean -- cd .. - - ---- a/frmts/jpeg/makefile.vc -+++ b/frmts/jpeg/makefile.vc -@@ -29,12 +29,16 @@ default: $(EXTRA_DEP) $(OBJ) - - clean: - -del *.obj -+!IFNDEF JPEG_EXTERNAL_LIB - cd libjpeg - $(MAKE) /f makefile.vc clean - cd .. -+!ENDIF -+!IFDEF JPEG12_SUPPORTED - cd libjpeg12 - $(MAKE) /f makefile.vc clean - cd .. -+!ENDIF - - libjpeg12src: - cd libjpeg12 ---- a/frmts/kea/makefile.vc -+++ b/frmts/kea/makefile.vc -@@ -1,7 +1,7 @@ - - OBJ = keaband.obj keacopy.obj keadataset.obj keadriver.obj keamaskband.obj keaoverview.obj kearat.obj - --EXTRAFLAGS = $(KEA_CFLAGS) -DH5_BUILT_AS_DYNAMIC_LIB -+EXTRAFLAGS = $(KEA_CFLAGS) - - GDAL_ROOT = ..\.. - ---- a/frmts/makefile.vc -+++ b/frmts/makefile.vc -@@ -3,11 +3,11 @@ GDAL_ROOT = .. - - EXTRAFLAGS = -DFRMT_ceos -DFRMT_aigrid -DFRMT_elas -DFRMT_hfa -DFRMT_gtiff\ - -DFRMT_sdts -DFRMT_raw -DFRMT_gxf -DFRMT_ceos2 -DFRMT_png \ -- -DFRMT_dted -DFRMT_mem -DFRMT_jdem -DFRMT_gif -DFRMT_esric \ -+ -DFRMT_dted -DFRMT_mem -DFRMT_jdem -DFRMT_esric \ - -DFRMT_envisat -DFRMT_aaigrid -DFRMT_usgsdem -DFRMT_l1b \ - -DFRMT_fit -DFRMT_vrt -DFRMT_xpm -DFRMT_bmp -DFRMT_rmf \ -- -DFRMT_nitf -DFRMT_pcidsk -DFRMT_airsar -DFRMT_rs2 \ -- -DFRMT_ilwis -DFRMT_msgn -DFRMT_rik -DFRMT_pcraster \ -+ -DFRMT_nitf -DFRMT_airsar -DFRMT_rs2 \ -+ -DFRMT_ilwis -DFRMT_msgn -DFRMT_rik \ - -DFRMT_leveller -DFRMT_sgi -DFRMT_srtmhgt -DFRMT_idrisi \ - -DFRMT_jaxapalsar -DFRMT_ers -DFRMT_ingr -DFRMT_dimap \ - -DFRMT_gff -DFRMT_terragen -DFRMT_gsg -DFRMT_cosar -DFRMT_pds \ -@@ -32,6 +32,22 @@ PLUGINDIRLIST = $(PLUGINFLAGS:-DFRMT_=) - EXTRAFLAGS = $(EXTRAFLAGS) -DFRMT_postgisraster - !ENDIF - -+!IFDEF GIF_SETTING -+EXTRAFLAGS = $(EXTRAFLAGS) -DFRMT_gif -+!ENDIF -+ -+!IFDEF PCIDSK_SETTING -+EXTRAFLAGS = $(EXTRAFLAGS) -DFRMT_pcidsk -+!ENDIF -+ -+!IFDEF PCRASTER_SETTING -+EXTRAFLAGS = $(EXTRAFLAGS) -DFRMT_pcraster -+!ENDIF -+ -+!IFDEF EXR_INC -+EXTRAFLAGS = $(EXTRAFLAGS) -DFRMT_exr -+!ENDIF -+ - !IFDEF JPEG_SUPPORTED - EXTRAFLAGS = -DFRMT_jpeg $(EXTRAFLAGS) - !ENDIF ---- a/frmts/pcidsk/makefile.vc -+++ b/frmts/pcidsk/makefile.vc -@@ -14,7 +14,11 @@ OBJ = pcidskdataset2.obj ogrpcidsklayer.obj vsi_pcidsk_io.obj gdal_edb.obj - !ENDIF - - !IF "$(PCIDSK_SETTING)" == "INTERNAL" -+!IFDEF JPEG_SUPPORTED - PCIDSKFLAGS = -Isdk -DPCIDSK_INTERNAL -DHAVE_LIBJPEG -+!ELSE -+PCIDSKFLAGS = -Isdk -DPCIDSK_INTERNAL -+!ENDIF - - OBJ = pcidskdataset2.obj ogrpcidsklayer.obj vsi_pcidsk_io.obj gdal_edb.obj \ - sdk\blockdir\asciitiledir.obj \ -@@ -70,11 +74,13 @@ OBJ = pcidskdataset2.obj ogrpcidsklayer.obj vsi_pcidsk_io.obj gdal_edb.obj \ - - !ENDIF - -+!IFDEF JPEG_SUPPORTED - !IFDEF JPEG_EXTERNAL_LIB - JPEGFLAGS = -I$(JPEGDIR) - !ELSE - JPEGFLAGS = -I..\jpeg\libjpeg - !ENDIF -+!ENDIF - - .cpp.obj: - $(CC) $(CFLAGS) $(PCIDSKFLAGS) $(JPEGFLAGS) /c $*.cpp /Fo$*.obj ---- a/makefile.vc -+++ b/makefile.vc -@@ -84,7 +84,7 @@ staticlib: $(LIB_DEPENDS) - call <= 2.2.0" + patch_type: "portability" + patch_source: "https://github.com/malaterre/GDCM/pull/157" + - 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.21": + - patch_file: "patches/0001-3.0.20-find-charls.patch" + patch_description: "allow using charls >= 2.2.0" + patch_type: "portability" + patch_source: "https://github.com/malaterre/GDCM/pull/157" + - 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.20": - - patch_file: "patches/0001-charls-linking.patch" - patch_description: "fix symbol export for gdcmcharls" + - patch_file: "patches/0001-3.0.20-find-charls.patch" + patch_description: "allow using charls >= 2.2.0" patch_type: "portability" + patch_source: "https://github.com/malaterre/GDCM/pull/157" - patch_file: "patches/0002-3.0.20-openjpeg.patch" patch_description: "fix variable names for openjpeg" patch_type: "conan" @@ -22,16 +119,23 @@ patches: - 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" - patch_description: "fix symbol export for gdcmcharls" + - patch_file: "patches/0001-3.0.9-find-charls.patch" + patch_description: "allow using charls >= 2.2.0" patch_type: "portability" + patch_source: "https://github.com/malaterre/GDCM/pull/157" - 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: "backport" + 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" @@ -42,3 +146,9 @@ patches: - 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 1ef89c6475efc..dd9ef9798d769 100644 --- a/recipes/gdcm/all/conanfile.py +++ b/recipes/gdcm/all/conanfile.py @@ -15,6 +15,7 @@ class GDCMConan(ConanFile): name = "gdcm" + package_type = "library" description = "C++ library for DICOM medical files" license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" @@ -26,17 +27,19 @@ class GDCMConan(ConanFile): "fPIC": [True, False], "with_json": [True, False], "with_openssl": [True, False], + "with_zlibng": [True, False], } default_options = { "shared": False, "fPIC": True, "with_json": True, "with_openssl": True, + "with_zlibng": False, } @property def _min_cppstd(self): - return 11 + return 14 def export_sources(self): export_conandata_patches(self) @@ -53,33 +56,41 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("expat/2.5.0") - self.requires("openjpeg/2.5.0") - self.requires("zlib/1.2.13") + self.requires("charls/2.4.2") + self.requires("expat/[>=2.6.2 <3]") + self.requires("openjpeg/2.5.2") + if self.options.with_zlibng: + self.requires("zlib-ng/2.2.0") + else: + self.requires("zlib/[>=1.2.11 <2]") if self.settings.os != "Windows": - self.requires("libuuid/1.0.3") + self.requires("util-linux-libuuid/2.39.2") if Version(self.version) >= Version("3.0.20"): self.requires("libiconv/1.17") if self.options.with_json: - self.requires("json-c/0.16") + self.requires("json-c/0.17") if self.options.with_openssl: - self.requires("openssl/1.1.1s") + self.requires("openssl/[>=1.1 <4]") def validate(self): - if self.info.settings.compiler.get_safe("cppstd"): + if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, self._min_cppstd) - if is_msvc_static_runtime(self) and self.info.options.shared: + if is_msvc_static_runtime(self) and self.options.shared: raise ConanInvalidConfiguration(f"{self.ref} does not support shared and static runtime together.") + 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") 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["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 + tc.variables["GDCM_USE_SYSTEM_CHARLS"] = True tc.variables["GDCM_USE_SYSTEM_EXPAT"] = True tc.variables["GDCM_USE_SYSTEM_JSON"] = self.options.with_json tc.variables["GDCM_USE_SYSTEM_OPENJPEG"] = True @@ -89,12 +100,23 @@ def generate(self): if not valid_min_cppstd(self, self._min_cppstd): tc.variables["CMAKE_CXX_STANDARD"] = self._min_cppstd + + # https://sourceforge.net/p/gdcm/bugs/548/ + tc.preprocessor_definitions["CHARLS_NO_DEPRECATED_WARNING"] = "1" + + #gdcm currently uses functionality that is deprecated since OpenSSL 1.1.0 + tc.preprocessor_definitions["OPENSSL_API_COMPAT"] = "0x10000000L" + tc.generate() deps = CMakeDeps(self) deps.generate() - def build(self): + 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 = CMake(self) cmake.configure() cmake.build() @@ -181,8 +203,7 @@ def _gdcm_build_modules(self): @property def _gdcm_libraries(self): - gdcm_libs = ["gdcmcharls", - "gdcmCommon", + gdcm_libs = ["gdcmCommon", "gdcmDICT", "gdcmDSED", "gdcmIOD", @@ -218,19 +239,23 @@ def package_info(self): if self.options.with_openssl: self.cpp_info.components["gdcmCommon"].requires.append("openssl::openssl") - self.cpp_info.components["gdcmDSED"].requires.extend(["gdcmCommon", "zlib::zlib"]) + + def zlib(): + return "zlib-ng::zlib-ng" if self.options.with_zlibng else "zlib::zlib" + + self.cpp_info.components["gdcmDSED"].requires.extend(["gdcmCommon", zlib()]) self.cpp_info.components["gdcmIOD"].requires.extend(["gdcmDSED", "gdcmCommon", "expat::expat"]) - self.cpp_info.components["gdcmMSFF"].requires.extend(["gdcmIOD", "gdcmDSED", "gdcmDICT", "openjpeg::openjpeg"]) + self.cpp_info.components["gdcmMSFF"].requires.extend(["gdcmIOD", "gdcmDSED", "gdcmDICT", "charls::charls", "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") + self.cpp_info.components["gdcmMSFF"].requires.append("util-linux-libuuid::util-linux-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"]) - self.cpp_info.components["gdcmMSFF"].requires.extend(["gdcmjpeg8", "gdcmjpeg12", "gdcmjpeg16", "gdcmcharls"]) + self.cpp_info.components["gdcmMSFF"].requires.extend(["gdcmjpeg8", "gdcmjpeg12", "gdcmjpeg16"]) if self.settings.os == "Windows": self.cpp_info.components["gdcmCommon"].system_libs = ["ws2_32", "crypt32"] diff --git a/recipes/gdcm/all/patches/0001-3.0.20-find-charls.patch b/recipes/gdcm/all/patches/0001-3.0.20-find-charls.patch new file mode 100644 index 0000000000000..c30995e540d0b --- /dev/null +++ b/recipes/gdcm/all/patches/0001-3.0.20-find-charls.patch @@ -0,0 +1,28 @@ +Allow using charls >= 2.2.0 +https://github.com/malaterre/GDCM/pull/157 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -352,8 +352,8 @@ else() + endif() + + if(GDCM_USE_SYSTEM_CHARLS) +- find_package(CharLS 2.0.0 REQUIRED) +- set(GDCM_CHARLS_LIBRARIES ${CHARLS_LIBRARIES}) ++ find_package(charls 2.2.0 REQUIRED) ++ set(GDCM_CHARLS_LIBRARIES charls) + else() + set(GDCM_CHARLS_LIBRARIES gdcmcharls) + endif() +--- a/Utilities/gdcm_charls.h ++++ b/Utilities/gdcm_charls.h +@@ -17,8 +17,8 @@ + /* Use the charls library configured for gdcm. */ + #include "gdcmTypes.h" + #ifdef GDCM_USE_SYSTEM_CHARLS +-// It is expected that version 2.0.0 is used +-# include ++// It is expected that version >= 2.2.0 is used ++# include + #else + #include "gdcmcharls/charls.h" + #endif diff --git a/recipes/gdcm/all/patches/0001-3.0.9-find-charls.patch b/recipes/gdcm/all/patches/0001-3.0.9-find-charls.patch new file mode 100644 index 0000000000000..c4dfe79c81524 --- /dev/null +++ b/recipes/gdcm/all/patches/0001-3.0.9-find-charls.patch @@ -0,0 +1,28 @@ +Allow using charls >= 2.2.0 +https://github.com/malaterre/GDCM/pull/157 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -356,8 +356,8 @@ else() + endif() + + if(GDCM_USE_SYSTEM_CHARLS) +- find_package(CharLS 2.0.0 REQUIRED) +- set(GDCM_CHARLS_LIBRARIES ${CHARLS_LIBRARIES}) ++ find_package(charls 2.2.0 REQUIRED) ++ set(GDCM_CHARLS_LIBRARIES charls) + else() + set(GDCM_CHARLS_LIBRARIES gdcmcharls) + endif() +--- a/Utilities/gdcm_charls.h ++++ b/Utilities/gdcm_charls.h +@@ -17,8 +17,8 @@ + /* Use the charls library configured for gdcm. */ + #include "gdcmTypes.h" + #ifdef GDCM_USE_SYSTEM_CHARLS +-// It is expected that version 2.0.0 is used +-# include ++// It is expected that version >= 2.2.0 is used ++# include + #else + #include "gdcmcharls/charls.h" + #endif diff --git a/recipes/gdcm/all/patches/0001-charls-linking.patch b/recipes/gdcm/all/patches/0001-charls-linking.patch deleted file mode 100644 index 57df8966f04ba..0000000000000 --- a/recipes/gdcm/all/patches/0001-charls-linking.patch +++ /dev/null @@ -1,38 +0,0 @@ ---- a/Utilities/gdcmcharls/CMakeLists.txt -+++ b/Utilities/gdcmcharls/CMakeLists.txt -@@ -61,12 +61,10 @@ endif() - #option(charls_BUILD_SHARED_LIBS "Build CharLS with shared libraries." OFF) - #set(BUILD_SHARED_LIBS ${charls_BUILD_SHARED_LIBS}) - --if(WIN32) -- if(BUILD_SHARED_LIBS) -- add_definitions(-DCHARLS_DLL_BUILD) -- else() -- add_definitions(-DCHARLS_STATIC) -- endif() -+if(BUILD_SHARED_LIBS) -+ add_definitions(-DCHARLS_DLL_BUILD) -+else() -+ add_definitions(-DCHARLS_STATIC) - endif() - - add_library(${CHARLS_LIBRARY_NAME} ---- a/Utilities/gdcmcharls/charls.h -+++ b/Utilities/gdcmcharls/charls.h -@@ -13,12 +13,12 @@ - #define CHARLS_IMEXPORT(returntype) __declspec(dllexport) returntype __stdcall - #endif - --// Non-windows (static linking) --#if !defined(CHARLS_IMEXPORT) && !defined(_WIN32) --# define CHARLS_IMEXPORT(returntype) returntype -+// Non-windows (dynamic linking) -+#if !defined(WIN32) && (defined(CHARLS_DLL) || defined(CHARLS_DLL_BUILD)) -+#define CHARLS_IMEXPORT(returntype) __attribute__((visibility("default"))) returntype - #endif - --// Windows static linking -+// Static linking - #if !defined(CHARLS_IMEXPORT) && defined(CHARLS_STATIC) - # define CHARLS_IMEXPORT(returntype) returntype - #endif diff --git a/recipes/gdcm/all/patches/0002-3.0.23-openjpeg.patch b/recipes/gdcm/all/patches/0002-3.0.23-openjpeg.patch new file mode 100644 index 0000000000000..eeab7fc906123 --- /dev/null +++ b/recipes/gdcm/all/patches/0002-3.0.23-openjpeg.patch @@ -0,0 +1,22 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -361,7 +361,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/0004-3.0.23-find-expat.patch b/recipes/gdcm/all/patches/0004-3.0.23-find-expat.patch new file mode 100644 index 0000000000000..17f0337ed9cbf --- /dev/null +++ b/recipes/gdcm/all/patches/0004-3.0.23-find-expat.patch @@ -0,0 +1,11 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -420,7 +420,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/0006-3.0.24-json.patch b/recipes/gdcm/all/patches/0006-3.0.24-json.patch new file mode 100644 index 0000000000000..6aa3414ba7c29 --- /dev/null +++ b/recipes/gdcm/all/patches/0006-3.0.24-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_SYMBOL_EXISTS(gettimeofday "sys/time.h" 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.23-find-json.patch b/recipes/gdcm/all/patches/0007-3.0.23-find-json.patch new file mode 100644 index 0000000000000..0dc527b8151cf --- /dev/null +++ b/recipes/gdcm/all/patches/0007-3.0.23-find-json.patch @@ -0,0 +1,45 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -427,7 +427,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.23-find-libuuid.patch b/recipes/gdcm/all/patches/0008-3.0.23-find-libuuid.patch new file mode 100644 index 0000000000000..25a30c12ea4d4 --- /dev/null +++ b/recipes/gdcm/all/patches/0008-3.0.23-find-libuuid.patch @@ -0,0 +1,40 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -412,7 +412,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 5465ea8e54b6d..b8df0da5056db 100644 --- a/recipes/gdcm/all/test_package/CMakeLists.txt +++ b/recipes/gdcm/all/test_package/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) find_package(GDCM REQUIRED CONFIG) diff --git a/recipes/gdcm/all/test_package/DCMTK_JPEGExt_12Bits.dcm b/recipes/gdcm/all/test_package/DCMTK_JPEGExt_12Bits.dcm deleted file mode 100644 index a38d4be8214fc..0000000000000 Binary files a/recipes/gdcm/all/test_package/DCMTK_JPEGExt_12Bits.dcm and /dev/null differ diff --git a/recipes/gdcm/all/test_package/conanfile.py b/recipes/gdcm/all/test_package/conanfile.py index 1f94130dd62ec..09886ae651d09 100644 --- a/recipes/gdcm/all/test_package/conanfile.py +++ b/recipes/gdcm/all/test_package/conanfile.py @@ -4,6 +4,7 @@ from conan.tools.files import mkdir import os + class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" @@ -22,9 +23,5 @@ def build(self): def test(self): 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" - mkdir(self, test_dir) - output_file = os.path.join(test_dir, "output.dcm") - self.run(f"\"{bin_path}\" \"{input_file}\" \"{output_file}\"", env="conanrun") + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/gdcm/all/test_package/test_package.cpp b/recipes/gdcm/all/test_package/test_package.cpp index 38a0b1316570a..3e8750a344529 100644 --- a/recipes/gdcm/all/test_package/test_package.cpp +++ b/recipes/gdcm/all/test_package/test_package.cpp @@ -1,104 +1,8 @@ -/*========================================================================= - - Program: GDCM (Grassroots DICOM). A DICOM library - - Copyright (c) 2006-2011 Mathieu Malaterre - All rights reserved. - See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ -/* - * This example is ... guess what this is for :) - */ - #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() +int main() { - 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) - { - std::cerr << argv[0] << " input.dcm output.dcm" << std::endl; - return 1; - } - const char* filename = argv[1]; - const char* outfilename = argv[2]; - - // Instanciate the reader: gdcm::Reader reader; - reader.SetFileName(filename); - if (!reader.Read()) - { - std::cerr << "Could not read: " << filename << std::endl; - return 1; - } - - // If we reach here, we know for sure only 1 thing: - // It is a valid DICOM file (potentially an old ACR-NEMA 1.0/2.0 file) - // (Maybe, it's NOT a Dicom image -could be a DICOMDIR, a RTSTRUCT, etc-) - - // The output of gdcm::Reader is a gdcm::File - gdcm::File& file = reader.GetFile(); - - // the dataset is the the set of element we are interested in: - gdcm::DataSet& ds = file.GetDataSet(); - - // Contruct a static(*) type for Image Comments : - gdcm::Attribute<0x0020, 0x4000> imagecomments; - imagecomments.SetValue("Hello, World !"); - - // Now replace the Image Comments from the dataset with our: - ds.Replace(imagecomments.GetAsDataElement()); - - // Write the modified DataSet back to disk - gdcm::Writer writer; - writer.CheckFileMetaInformationOff(); // Do not attempt to reconstruct the file meta to preserve the file - // as close to the original as possible. - writer.SetFileName(outfilename); - writer.SetFile(file); - if (!writer.Write()) - { - std::cerr << "Could not write: " << outfilename << std::endl; - return 1; - } - std::cout << "GDCM test: success\n"; + reader.SetFileName("myFileName"); return 0; } - -/* - * (*) static type, means that extra DICOM information VR & VM are computed at compilation time. - * The compiler is deducing those values from the template arguments of the class. - */ diff --git a/recipes/gdcm/all/test_v1_package/CMakeLists.txt b/recipes/gdcm/all/test_v1_package/CMakeLists.txt index 0d20897301b68..b21cc49efde95 100644 --- a/recipes/gdcm/all/test_v1_package/CMakeLists.txt +++ b/recipes/gdcm/all/test_v1_package/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) diff --git a/recipes/gdcm/all/test_v1_package/conanfile.py b/recipes/gdcm/all/test_v1_package/conanfile.py index a38d3dbb55dca..097d728c9571f 100644 --- a/recipes/gdcm/all/test_v1_package/conanfile.py +++ b/recipes/gdcm/all/test_v1_package/conanfile.py @@ -16,8 +16,4 @@ def build(self): 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) + self.run(bin_path, run_environment=True) diff --git a/recipes/gdcm/config.yml b/recipes/gdcm/config.yml index f1b37cf5e936f..3820bf3dda38c 100644 --- a/recipes/gdcm/config.yml +++ b/recipes/gdcm/config.yml @@ -1,4 +1,12 @@ versions: + "3.0.24": + folder: "all" + "3.0.23": + folder: "all" + "3.0.22": + folder: "all" + "3.0.21": + folder: "all" "3.0.20": folder: "all" "3.0.9": diff --git a/recipes/gdk-pixbuf/all/conandata.yml b/recipes/gdk-pixbuf/all/conandata.yml index 20b0c843bbfec..d321370ee9136 100644 --- a/recipes/gdk-pixbuf/all/conandata.yml +++ b/recipes/gdk-pixbuf/all/conandata.yml @@ -11,10 +11,9 @@ sources: "2.42.6": url: "https://download.gnome.org/sources/gdk-pixbuf/2.42/gdk-pixbuf-2.42.6.tar.xz" sha256: "c4a6b75b7ed8f58ca48da830b9fa00ed96d668d3ab4b1f723dcf902f78bde77f" - patches: "2.42.8": - patch_file: "patches/define_dllmain_only_when_shared.patch" - patch_type: backport + patch_type: "portability" 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 c7ef320ce9ef9..edcf9d96b7ad2 100644 --- a/recipes/gdk-pixbuf/all/conanfile.py +++ b/recipes/gdk-pixbuf/all/conanfile.py @@ -1,42 +1,36 @@ -from conan import ConanFile -from conan.tools.meson import MesonToolchain, Meson +import os + +from conan import ConanFile, conan_version +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.build import can_run +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.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.meson import Meson, MesonToolchain +from conan.tools.microsoft import is_msvc_static_runtime from conan.tools.scm import Version -from conan.errors import ConanInvalidConfiguration -import os - -required_conan_version = ">=1.53.0" +required_conan_version = ">=1.56.0 <2 || >=2.0.8" class GdkPixbufConan(ConanFile): name = "gdk-pixbuf" description = "toolkit for image loading and pixel buffer manipulation" - topics = ("gdk-pixbuf", "image") + topics = "image" url = "https://github.com/conan-io/conan-center-index" homepage = "https://developer.gnome.org/gdk-pixbuf/" license = "LGPL-2.1-or-later" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], "with_libpng": [True, False], "with_libtiff": [True, False], - "with_libjpeg": ["libjpeg", "libjpeg-turbo", False], + "with_libjpeg": ["libjpeg", "libjpeg-turbo", "mozjpeg", False], "with_introspection": [True, False], } default_options = { @@ -49,6 +43,9 @@ class GdkPixbufConan(ConanFile): } short_paths = True + def export_sources(self): + export_conandata_patches(self) + def config_options(self): if self.settings.os == "Windows": self.options.rm_safe("fPIC") @@ -59,64 +56,86 @@ def configure(self): self.settings.rm_safe("compiler.libcxx") self.settings.rm_safe("compiler.cppstd") if self.options.shared: - self.options["glib"].shared = True + wildcard = "" if Version(conan_version) < "2.0.0" else "/*" + self.options[f"glib{wildcard}"].shared = True def layout(self): basic_layout(self, src_folder="src") + def requirements(self): + self.requires("glib/2.78.3", transitive_headers=True, transitive_libs=True) + if self.options.with_libpng: + self.requires("libpng/[>=1.6 <2]") + if self.options.with_libtiff: + self.requires("libtiff/4.6.0") + if self.options.with_libjpeg == "libjpeg-turbo": + self.requires("libjpeg-turbo/3.0.2") + elif self.options.with_libjpeg == "libjpeg": + self.requires("libjpeg/9e") + elif self.options.with_libjpeg == "mozjpeg": + self.requires("mozjpeg/4.1.5") + def validate(self): - if self.info.options.shared and not self.dependencies["glib"].options.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.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" ) + def build_requirements(self): + self.tool_requires("meson/[>=1.2.3 <2]") + # FIXME: unify libgettext and gettext?? + # INFO: gettext provides msgfmt, which is required to build the .mo files + self.tool_requires("gettext/0.22.5") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/[>=2.2 <3]") + self.tool_requires("glib/") + if self.options.with_introspection: + self.tool_requires("gobject-introspection/1.72.0") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + @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" + env = VirtualBuildEnv(self) + env.generate() + if can_run(self): + env = VirtualRunEnv(self) + env.generate(scope="build") deps = PkgConfigDeps(self) deps.generate() - tc = MesonToolchain(self) + enabled_disabled = lambda v: "enabled" if v else "disabled" + true_false = lambda v: "true" if v else "false" tc.project_options.update({ "builtin_loaders": "all", "gio_sniffing": "false", - "introspection": is_enabled(self.options.with_introspection), + "introspection": enabled_disabled(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) + "png": enabled_disabled(self.options.with_libpng), + "tiff": enabled_disabled(self.options.with_libtiff), + "jpeg": enabled_disabled(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) + "png": true_false(self.options.with_libpng), + "tiff": true_false(self.options.with_libtiff), + "jpeg": true_false(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 @@ -124,49 +143,44 @@ def is_true(value): 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.tool_requires("meson/0.64.1") - self.tool_requires("pkgconf/1.9.3") - if self.options.with_introspection: - self.tool_requires("gobject-introspection/1.72.0") - - def export_sources(self): - export_conandata_patches(self) - - def source(self): - get(self, **self.conan_data["sources"][self.version], strip_root=True) - def _patch_sources(self): apply_conandata_patches(self) - meson_build = os.path.join(self.source_folder, "meson.build") + gdk_meson_build = os.path.join(self.source_folder, "gdk-pixbuf", "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'") + replace_in_file(self, meson_build, "gmodule_dep.get_variable(pkgconfig: 'gmodule_supported')", "'true'") # workaround https://gitlab.gnome.org/GNOME/gdk-pixbuf/-/issues/203 - 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')") + replace_in_file(self, os.path.join(self.source_folder, "build-aux", "post-install.py"), + "close_fds=True", "close_fds=(sys.platform != 'win32')") 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'") + replace_in_file(self, meson_build, "is_msvc_like = ", "is_msvc_like = false #") + # Fix libtiff and libpng not being linked against when building statically + # Reported upstream: https://gitlab.gnome.org/GNOME/gdk-pixbuf/-/merge_requests/159 + replace_in_file(self, gdk_meson_build, + "dependencies: gdk_pixbuf_deps + [ gdkpixbuf_dep ],", + "dependencies: loaders_deps + gdk_pixbuf_deps + [ gdkpixbuf_dep ],") + # Forcing Conan libgettext instead of system one (if OS != Linux) + if self.settings.os != "Linux": + # FIXME: unify libgettext and gettext ?? + replace_in_file(self, meson_build, + "intl_dep = cc.find_library('intl', required: false)", + "intl_dep = dependency('libgettext', version: '>=0.21', required: false, method: 'pkg-config')") + if self.settings.os == "Macos" and self.options.shared: + # Workaround to avoid generating gdk-pixbuf/loaders.cache fails + # Error output: + # [167/167] Generating gdk-pixbuf/loaders.cache with a custom command (wrapped by meson to capture output) + # FAILED: gdk-pixbuf/loaders.cache + # meson.py --internal exe --capture gdk-pixbuf/loaders.cache -- xxxx/gdk-pixbuf/gdk-pixbuf-query-loaders + # --- stderr --- + # dyld[25158]: Library not loaded: /lib/libgnuintl.8.dylib + # Reason: tried: '/lib/libgnuintl.8.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/lib/libgnuintl.8.dylib' (no such file) + # + # Obviously, the libgnuintl.8.dylib is in the VirtualRunEnv, but the current env is not passed to + # the meson custom_target function as it's wrappering the execution + # custom_target admits also an "env" parameter, but it's not working as expected + replace_in_file(self, gdk_meson_build, "build_by_default: true", "build_by_default: false") def build(self): self._patch_sources() @@ -175,17 +189,14 @@ def build(self): meson.build() def package(self): + copy(self, "COPYING", self.source_folder, os.path.join(self.package_folder, "licenses")) 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) - - + fix_apple_shared_install_name(self) + fix_msvc_libname(self) def package_info(self): self.cpp_info.set_property("pkg_config_name", "gdk-pixbuf-2.0") @@ -200,10 +211,13 @@ def package_info(self): self.cpp_info.exelinkflags = ldflags self.cpp_info.sharedlinkflags = ldflags + # Breaking change since Conan >= 2.0.8 + # Related to https://github.com/conan-io/conan/pull/14233 + libdir_variable = "libdir1" if Version(conan_version) < "2.0" else "libdir" pkgconfig_variables = { "bindir": "${prefix}/bin", "gdk_pixbuf_binary_version": "2.10.0", - "gdk_pixbuf_binarydir": "${libdir1}/gdk-pixbuf-2.0/2.10", + "gdk_pixbuf_binarydir": "${%s}/gdk-pixbuf-2.0/2.10" % libdir_variable, "gdk_pixbuf_moduledir": "${gdk_pixbuf_binarydir}/loaders", "gdk_pixbuf_cache_file": "${gdk_pixbuf_binarydir}/loaders.cache", "gdk_pixbuf_csource": "${bindir}/gdk-pixbuf-csource", @@ -218,9 +232,19 @@ def package_info(self): self.runenv_info.define_path("GDK_PIXBUF_PIXDATA", gdk_pixbuf_pixdata) self.env_info.GDK_PIXBUF_PIXDATA = gdk_pixbuf_pixdata # remove in conan v2? - # TODO: to remove in conan v2 once pkg_config generator removed - self.cpp_info.names["pkg_config"] = "gdk-pixbuf-2.0" - def package_id(self): - if not self.options["glib"].shared: - 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""" + 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/gdk-pixbuf/all/test_package/CMakeLists.txt b/recipes/gdk-pixbuf/all/test_package/CMakeLists.txt index f31a35477a32f..66c6c2f99bdd2 100644 --- a/recipes/gdk-pixbuf/all/test_package/CMakeLists.txt +++ b/recipes/gdk-pixbuf/all/test_package/CMakeLists.txt @@ -1,7 +1,6 @@ cmake_minimum_required(VERSION 3.1) project(test_package C) - find_package(gdk-pixbuf REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) diff --git a/recipes/gdk-pixbuf/all/test_package/conanfile.py b/recipes/gdk-pixbuf/all/test_package/conanfile.py index f04bef385c6cc..77f365fc4d372 100644 --- a/recipes/gdk-pixbuf/all/test_package/conanfile.py +++ b/recipes/gdk-pixbuf/all/test_package/conanfile.py @@ -1,6 +1,6 @@ from conan import ConanFile +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout -from conan.tools import build import os @@ -13,7 +13,7 @@ def layout(self): cmake_layout(self) def requirements(self): - self.requires(self.tested_reference_str) + 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 build.can_run(self): + if 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 index cb19ae21c7964..0d20897301b68 100644 --- a/recipes/gdk-pixbuf/all/test_v1_package/CMakeLists.txt +++ b/recipes/gdk-pixbuf/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package) 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) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/gegles-spdlog_setup/all/conandata.yml b/recipes/gegles-spdlog_setup/all/conandata.yml new file mode 100644 index 0000000000000..f836eaeba60c2 --- /dev/null +++ b/recipes/gegles-spdlog_setup/all/conandata.yml @@ -0,0 +1,5 @@ +sources: + "1.1.0": + url: + - "https://github.com/gegles/spdlog_setup/archive/v1.1.0.tar.gz" + sha256: "80a37463a1cd2735f6f7af0b0dfb01a1ecc0a271b33fb29966564b9758f7c309" diff --git a/recipes/gegles-spdlog_setup/all/conanfile.py b/recipes/gegles-spdlog_setup/all/conanfile.py new file mode 100644 index 0000000000000..5724281400475 --- /dev/null +++ b/recipes/gegles-spdlog_setup/all/conanfile.py @@ -0,0 +1,78 @@ +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 SpdlogSetupConan(ConanFile): + name = "gegles-spdlog_setup" + description = "Setup spdlog via a TOML config file" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/gegles/spdlog_setup" + topics = ('spdlog', 'logging', 'header-only', 'toml', 'cpptoml') + package_type = "header-library" + 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.0", + } + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("cpptoml/0.1.1") + self.requires("spdlog/1.14.1") + self.requires("fmt/10.2.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) + 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 = [] + self.cpp_info.set_property("cmake_file_name", "spdlog_setup") + self.cpp_info.set_property("cmake_target_name", "spdlog_setup::spdlog_setup") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + # This is needed since we prefixed the package name with the author name + self.cpp_info.names["cmake_find_package"] = "SPDLOG_SETUP" + self.cpp_info.names["cmake_find_package_multi"] = "spdlog_setup" diff --git a/recipes/gegles-spdlog_setup/all/test_package/CMakeLists.txt b/recipes/gegles-spdlog_setup/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..f3c223fadf1f3 --- /dev/null +++ b/recipes/gegles-spdlog_setup/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(spdlog_setup REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE spdlog_setup::spdlog_setup) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/gegles-spdlog_setup/all/test_package/conanfile.py b/recipes/gegles-spdlog_setup/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/gegles-spdlog_setup/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/gegles-spdlog_setup/all/test_package/test_package.cpp b/recipes/gegles-spdlog_setup/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..19eff1dcb9934 --- /dev/null +++ b/recipes/gegles-spdlog_setup/all/test_package/test_package.cpp @@ -0,0 +1,8 @@ +#include +#include +#include + +int main(void) { + std::cout << "Welcome to spdlog_setup!\n"; + return 123 == spdlog_setup::details::parse_max_size("123") ? EXIT_SUCCESS : EXIT_FAILURE; +} diff --git a/recipes/gegles-spdlog_setup/config.yml b/recipes/gegles-spdlog_setup/config.yml new file mode 100644 index 0000000000000..b5c0d3cb2d409 --- /dev/null +++ b/recipes/gegles-spdlog_setup/config.yml @@ -0,0 +1,3 @@ +versions: + "1.1.0": + folder: all diff --git a/recipes/gemmlowp/all/conanfile.py b/recipes/gemmlowp/all/conanfile.py index 14a41c63d1d09..b8480392b1dd3 100644 --- a/recipes/gemmlowp/all/conanfile.py +++ b/recipes/gemmlowp/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, 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.51.1" +required_conan_version = ">=1.53.0" class GemmlowpConan(ConanFile): @@ -16,6 +16,7 @@ class GemmlowpConan(ConanFile): description = "Low-precision matrix multiplication" topics = ("gemm", "matrix") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -27,8 +28,7 @@ class GemmlowpConan(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,18 +36,17 @@ 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.get_safe("cppstd"): + 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/gemmlowp/all/test_v1_package/CMakeLists.txt b/recipes/gemmlowp/all/test_v1_package/CMakeLists.txt index d3568415c41be..0d20897301b68 100644 --- a/recipes/gemmlowp/all/test_v1_package/CMakeLists.txt +++ b/recipes/gemmlowp/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(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) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/genie/all/conandata.yml b/recipes/genie/all/conandata.yml index 1b0883fe01d12..dcbfe49e2dc2e 100644 --- a/recipes/genie/all/conandata.yml +++ b/recipes/genie/all/conandata.yml @@ -11,3 +11,6 @@ sources: "1170": url: "https://github.com/bkaradzic/GENie/archive/22cc907a4351db46c55f73e6aa901f1b2f0c52ad.zip" sha256: "C7691E50F8FB6F2346D0D3CEED14A26F9DE7AEE658CE30B61770F8BE87C1FE00" + "1181": + url: "https://github.com/bkaradzic/GENie/archive/dde7e5ba4286c90117ba8261c810a904cc305326.zip" + sha256: "8C445842E6B2C3B364BEAE527B241F640DBB08A311D9B077E80642B76A38D0DD" \ No newline at end of file diff --git a/recipes/genie/all/conanfile.py b/recipes/genie/all/conanfile.py index d29587bee35bc..731e87cc4f266 100644 --- a/recipes/genie/all/conanfile.py +++ b/recipes/genie/all/conanfile.py @@ -57,8 +57,10 @@ def _os(self): }[str(self.settings.os)] def _patch_compiler(self, cc, 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}") + makefile = os.path.join(self.source_folder, "build", f"gmake.{self._os}", "genie.make") + + replace_in_file(self, makefile, "CC = gcc", f"CC = {cc}" if cc else "") + replace_in_file(self, makefile, "CXX = g++", f"CXX = {cxx}" if cxx else "") @property def _genie_config(self): @@ -79,19 +81,7 @@ def build(self): self._patch_compiler("cccl", "cccl") self.run("make", cwd=self.source_folder) else: - cc = os.environ.get("CC") - cxx = os.environ.get("CXX") - if is_apple_os(self): - if not cc: - cc = "clang" - if not cxx: - cxx = "clang" - else: - if not cc: - cc = "clang" if self.settings.compiler == "clang" else "gcc" - if not cxx: - cxx = "clang++" if self.settings.compiler == "clang" else "g++" - self._patch_compiler(cc, cxx) + self._patch_compiler("", "") autotools = Autotools(self) autotools.make(args=[f"-C {self.source_folder}", f"OS={self._os}", f"config={self._genie_config}"]) diff --git a/recipes/genie/config.yml b/recipes/genie/config.yml index f8c262eda3d07..47e75e6eafb62 100644 --- a/recipes/genie/config.yml +++ b/recipes/genie/config.yml @@ -7,3 +7,5 @@ versions: folder: "all" "1170": folder: "all" + "1181": + folder: "all" \ No newline at end of file diff --git a/recipes/geographiclib/all/conandata.yml b/recipes/geographiclib/all/conandata.yml index c7a7d43bcf927..6f7b35b699b25 100644 --- a/recipes/geographiclib/all/conandata.yml +++ b/recipes/geographiclib/all/conandata.yml @@ -1,27 +1,36 @@ sources: + "2.4": + url: "https://github.com/geographiclib/geographiclib/archive/refs/tags/v2.4.tar.gz" + sha256: "aa7edc6d86fcc297be6e6d6d53ddb6e622a46ef36fe9317335cac91bf471b5a9" + "2.3": + url: "https://github.com/geographiclib/geographiclib/archive/refs/tags/v2.3.tar.gz" + sha256: "18131077061ef8be14064f073f6dba2897a138519733803af807f861a01976c1" "1.52": - url: "https://sourceforge.net/projects/geographiclib/files/distrib/GeographicLib-1.52.tar.gz" - sha256: "5d4145cd16ebf51a2ff97c9244330a340787d131165cfd150e4b2840c0e8ac2b" + url: "https://github.com/geographiclib/geographiclib/archive/refs/tags/v1.52.tar.gz" + sha256: "f327ec3d16cc64d954c388b342893377dc56909fab267dbae8ea8bc170b32b2d" "1.51": - url: "https://sourceforge.net/projects/geographiclib/files/distrib/GeographicLib-1.51.tar.gz" - sha256: "34370949617df5105bd6961e0b91581aef758dc455fe8629eb5858516022d310" - "1.50.1": - url: "https://sourceforge.net/projects/geographiclib/files/distrib/GeographicLib-1.50.1.tar.gz" - sha256: "d1765009e068b8cc5e76957e5d6be45ce6cff08c4aad8e5995e84a28354385f1" + url: "https://github.com/geographiclib/geographiclib/archive/refs/tags/v1.51.tar.gz" + sha256: "9a2fe4fb69887ab7c625a40e5f1c20261bc80871670d729bea3119a2492e112c" + "1.50.2": + url: "https://github.com/geographiclib/geographiclib/archive/refs/tags/v1.50.2.tar.gz" + sha256: "6bdb960292b3197dc18bc3005ee76e4cdefbf025154d71fb42c986cb5ed1e4e7" patches: "1.52": - - patch_file: "patches/0002-cmake-minimum-required-1.52.patch" + - 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.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/0003-fix-rhumb.patch" + patch_description: "Fix Rhumb.hpp Clang compatibility" + patch_type: "portability" + patch_source: "https://github.com/geographiclib/geographiclib/commit/6c5767ba13a12710eab8b5ab7a3db331a1ed7161" + "1.50.2": - 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..62fa23933a44e 100644 --- a/recipes/geographiclib/all/conanfile.py +++ b/recipes/geographiclib/all/conanfile.py @@ -2,11 +2,16 @@ 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.env import VirtualBuildEnv +from conan.tools.files import ( + apply_conandata_patches, copy, export_conandata_patches, get, + replace_in_file, rm, rmdir, collect_libs +) from conan.tools.scm import Version +from conan.tools.microsoft import is_msvc import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class GeographiclibConan(ConanFile): @@ -31,9 +36,37 @@ class GeographiclibConan(ConanFile): "tools": True, } + @property + def _min_cppstd(self): + if Version(self.version) >= "2.4": + return 14 + if Version(self.version) >= "1.51": + return 11 + return None + + @property + def _compilers_minimum_version(self): + if self._min_cppstd == 11: + # Minimum compiler version having C++11 math functions + return { + "apple-clang": "3.3", + "gcc": "4.9", + "clang": "6", + "Visual Studio": "14", # guess + "msvc": "190", + } + elif self._min_cppstd == 14: + return { + "gcc": "7", + "clang": "6", + "Visual Studio": "16", + "msvc": "192", + "apple-clang": "14", + } + return {} + 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,44 +74,35 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") - @property - def _compilers_minimum_version(self): - # Minimum compiler version having C++11 math functions - return { - "apple-clang": "3.3", - "gcc": "4.9", - "clang": "6", - "Visual Studio": "14", # guess - } + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): - if Version(self.version) >= "1.51": - if self.info.settings.compiler.cppstd: - check_min_cppstd(self, 11) + if self.settings.compiler.get_safe("cppstd") and self._min_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] + def loose_lt_semver(v1, v2): + return all(int(p1) < int(p2) for p1, p2 in zip(str(v1).split("."), str(v2).split("."))) - 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++{self._min_cppstd}, 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 build_requirements(self): + if Version(self.version) >= "2.4": + self.tool_requires("cmake/[>=3.16 <4]") 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): @@ -96,18 +120,19 @@ def generate(self): tc.variables["GEOGRAPHICLIB_PRECISION"] = self._cmake_option_precision tc.generate() + VirtualBuildEnv(self).generate() + def _patch_sources(self): apply_conandata_patches(self) cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") - # it does not work on Windows but is not needed - replace_in_file(self, cmakelists, "add_subdirectory (js)", "") + if Version(self.version) < "2": + # it does not work on Windows but is not needed + replace_in_file(self, cmakelists, "add_subdirectory (js)", "") # Don't install system libs replace_in_file(self, cmakelists, "include (InstallRequiredSystemLibraries)", "") - # Don't build tools if asked - if not self.options.tools: - replace_in_file(self, cmakelists, "add_subdirectory (tools)", "") - replace_in_file(self, os.path.join(self.source_folder, "cmake", "CMakeLists.txt"), - "${TOOLS}", "") + # Disable -Werror + replace_in_file(self, cmakelists, "-Werror", "") + replace_in_file(self, cmakelists, "/WX", "") def build(self): self._patch_sources() @@ -127,21 +152,29 @@ def package(self): ]: rmdir(self, os.path.join(os.path.join(self.package_folder, folder))) rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + if not self.options.tools: + rmdir(self, os.path.join(self.package_folder, "sbin")) + bin_files = [it for it in os.listdir(os.path.join(self.package_folder, "bin")) if not it.endswith(".dll")] + for it in bin_files: + rm(self, it, os.path.join(self.package_folder, "bin")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "geographiclib") self.cpp_info.set_property("cmake_target_name", "GeographicLib::GeographicLib") self.cpp_info.set_property("pkg_config_name", "geographiclib") + # Geographic library name is GeographicLib since version 2.x (was Geographic before) + # It uses a debug postfix _d on Windows or when using multi-configuration generators (like Ninja Multi-Config) + # It's hard to track when using multi-configuration generators, so collect_libs is used + # Plus, it adds -i postfix on Windows when using shared libraries 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) + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs = ["m"] # 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/patches/0001-streamoff.patch b/recipes/geographiclib/all/patches/0001-streamoff.patch deleted file mode 100644 index 203a1711939ec..0000000000000 --- a/recipes/geographiclib/all/patches/0001-streamoff.patch +++ /dev/null @@ -1,38 +0,0 @@ ---- a/src/SphericalEngine.cpp -+++ b/src/SphericalEngine.cpp -@@ -134,6 +134,8 @@ - #include - #include - -+#include -+ - #if defined(_MSC_VER) - // Squelch warnings about constant conditional expressions and potentially - // uninitialized local variables -@@ -409,22 +411,22 @@ namespace GeographicLib { - SphericalEngine::coeff::Csize(N0, M )) * sizeof(double); - if (N == N0) { - Utility::readarray(stream, C); -- if (skip) stream.seekg(std::ios::streamoff(skip), ios::cur); -+ if (skip) stream.seekg(streamoff(skip), ios::cur); - Utility::readarray(stream, S); -- if (skip) stream.seekg(std::ios::streamoff(skip), ios::cur); -+ if (skip) stream.seekg(streamoff(skip), ios::cur); - } else { - for (int m = 0, k = 0; m <= M; ++m) { - Utility::readarray(stream, &C[k], N + 1 - m); - stream.seekg((N0 - N) * sizeof(double), ios::cur); - k += N + 1 - m; - } -- if (skip) stream.seekg(std::ios::streamoff(skip), ios::cur); -+ if (skip) stream.seekg(streamoff(skip), ios::cur); - for (int m = 1, k = 0; m <= M; ++m) { - Utility::readarray(stream, &S[k], N + 1 - m); - stream.seekg((N0 - N) * sizeof(double), ios::cur); - k += N + 1 - m; - } -- if (skip) stream.seekg(std::ios::streamoff(skip), ios::cur); -+ if (skip) stream.seekg(streamoff(skip), ios::cur); - } - return; - } diff --git a/recipes/geographiclib/all/patches/0002-cmake-minimum-required-1.52.patch b/recipes/geographiclib/all/patches/0002-cmake-minimum-required-1.52.patch deleted file mode 100644 index 7f25113816c11..0000000000000 --- a/recipes/geographiclib/all/patches/0002-cmake-minimum-required-1.52.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -1,3 +1,4 @@ -+cmake_minimum_required (VERSION 3.13.0) - project (GeographicLib) - - # Version information -@@ -47,7 +48,6 @@ set (LIBVERSION_BUILD 19.2.0) - string (TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER) - string (TOUPPER ${PROJECT_NAME} PROJECT_NAME_UPPER) - --cmake_minimum_required (VERSION 3.7.0) # This version was released 2016-11-11 - - # User-settable variables - diff --git a/recipes/geographiclib/all/patches/0003-fix-rhumb.patch b/recipes/geographiclib/all/patches/0003-fix-rhumb.patch new file mode 100644 index 0000000000000..5edf6ebaedf2a --- /dev/null +++ b/recipes/geographiclib/all/patches/0003-fix-rhumb.patch @@ -0,0 +1,27 @@ +From 6c5767ba13a12710eab8b5ab7a3db331a1ed7161 Mon Sep 17 00:00:00 2001 +From: Charles Karney +Date: Sun, 24 Jan 2021 09:28:41 -0500 +Subject: [PATCH] Clean up some lists with default methods in Rhumb. Document + issues with AlbersEqualArea. doc: Update gdal_translate example to include + offset + scale. + +--- include/GeographicLib/Rhumb.hpp ++++ include/GeographicLib/Rhumb.hpp +@@ -468,11 +468,15 @@ namespace GeographicLib { + const Rhumb& _rh; + bool _exact; + real _lat1, _lon1, _azi12, _salp, _calp, _mu1, _psi1, _r1; +- RhumbLine& operator=(const RhumbLine&); // copy assignment not allowed ++ // copy assignment not allowed ++ RhumbLine& operator=(const RhumbLine&) = delete; + RhumbLine(const Rhumb& rh, real lat1, real lon1, real azi12, + bool exact); + public: +- ++ /** ++ * Construction is via default copy constructor. ++ **********************************************************************/ ++ RhumbLine(const RhumbLine&) = default; + /** + * This is a duplication of Rhumb::mask. + **********************************************************************/ diff --git a/recipes/geographiclib/all/test_package/conanfile.py b/recipes/geographiclib/all/test_package/conanfile.py index 3a8c6c5442b33..fafba71d30d56 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): - bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + 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/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/geographiclib/config.yml b/recipes/geographiclib/config.yml index 6c3b63fe79e7e..2557b05844a79 100644 --- a/recipes/geographiclib/config.yml +++ b/recipes/geographiclib/config.yml @@ -1,7 +1,11 @@ versions: + "2.4": + folder: all + "2.3": + folder: all "1.52": folder: all "1.51": folder: all - "1.50.1": + "1.50.2": folder: all diff --git a/recipes/geos/all/conandata.yml b/recipes/geos/all/conandata.yml index df46a03c432bc..1c16e5baab94b 100644 --- a/recipes/geos/all/conandata.yml +++ b/recipes/geos/all/conandata.yml @@ -1,4 +1,16 @@ sources: + "3.13.0": + url: "https://github.com/libgeos/geos/releases/download/3.13.0/geos-3.13.0.tar.bz2" + sha256: "47ec83ff334d672b9e4426695f15da6e6368244214971fabf386ff8ef6df39e4" + "3.12.2": + url: "https://github.com/libgeos/geos/releases/download/3.12.2/geos-3.12.2.tar.bz2" + sha256: "34c7770bf0090ee88488af98767d08e779f124fa33437e0aabec8abd4609fec6" + "3.12.0": + url: "https://github.com/libgeos/geos/releases/download/3.12.0/geos-3.12.0.tar.bz2" + sha256: "d96db96011259178a35555a0f6d6e75a739e52a495a6b2aa5efb3d75390fbc39" + "3.11.2": + url: "https://github.com/libgeos/geos/releases/download/3.11.2/geos-3.11.2.tar.bz2" + sha256: "b1f077669481c5a3e62affc49e96eb06f281987a5d36fdab225217e5b825e4cc" "3.11.1": url: "https://github.com/libgeos/geos/releases/download/3.11.1/geos-3.11.1.tar.bz2" sha256: "be83ed195ffb82373710c90befc580911ea0eb57003a2d703e30101c5b262f62" @@ -6,8 +18,8 @@ sources: 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 48dc382e82ae4..1eefc045b2934 100644 --- a/recipes/geos/all/conanfile.py +++ b/recipes/geos/all/conanfile.py @@ -1,22 +1,22 @@ from conan import ConanFile -from conan.tools.build import check_min_cppstd +from conan.errors import ConanInvalidConfiguration +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.files import copy, get, rmdir, replace_in_file from conan.tools.scm import Version -from conans import tools as tools_legacy import os -required_conan_version = ">=1.53.0" +required_conan_version = ">=1.54.0" class GeosConan(ConanFile): name = "geos" - description = "C++11 library for performing operations on two-dimensional vector geometries" + description = "GEOS is a C++ library for performing operations on two-dimensional vector geometries." license = "LGPL-2.1" - topics = ("geos", "osgeo", "geometry", "topology", "geospatial") - homepage = "https://trac.osgeo.org/geos" url = "https://github.com/conan-io/conan-center-index" - + homepage = "https://libgeos.org/" + topics = ("osgeo", "geometry", "topology", "geospatial") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -31,6 +31,22 @@ class GeosConan(ConanFile): "utils": True, } + @property + def _min_cppstd(self): + return "14" if Version(self.version) >= "3.12.0" else "11" + + @property + def _compilers_minimum_version(self): + return { + "14": { + "gcc": "6", + "clang": "5", + "apple-clang": "10", + "Visual Studio": "15", + "msvc": "191", + }, + }.get(self._min_cppstd, {}) + @property def _has_inline_option(self): return Version(self.version) < "3.11.0" @@ -45,20 +61,30 @@ def configure(self): if self.options.shared: self.options.rm_safe("fPIC") - def validate(self): - if self.info.settings.compiler.get_safe("cppstd"): - check_min_cppstd(self, 11) - def layout(self): cmake_layout(self, src_folder="src") + 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." + ) + 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 + tc.cache_variables["CMAKE_BUILD_TYPE"] = str(self.settings.build_type) if self._has_inline_option: tc.variables["DISABLE_GEOS_INLINE"] = not self.options.inline tc.variables["BUILD_TESTING"] = False @@ -67,7 +93,15 @@ def generate(self): tc.variables["BUILD_GEOSOP"] = self.options.utils tc.generate() + def _patch_sources(self): + # Avoid setting CMAKE_BUILD_TYPE default when multi-config generators are used. + # https://github.com/libgeos/geos/pull/945 + if Version(self.version) <= "3.12.1": + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "set(CMAKE_BUILD_TYPE ${DEFAULT_BUILD_TYPE})", "") + def build(self): + self._patch_sources() cmake = CMake(self) cmake.configure() cmake.build() @@ -108,9 +142,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 @@ -119,6 +153,4 @@ def package_info(self): self.cpp_info.components["geos_c"].requires = ["geos_cpp"] if self.options.utils: - 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/geos/config.yml b/recipes/geos/config.yml index 40c19a7a4131d..b2d68bf99ca6a 100644 --- a/recipes/geos/config.yml +++ b/recipes/geos/config.yml @@ -1,4 +1,12 @@ versions: + "3.13.0": + folder: all + "3.12.2": + folder: all + "3.12.0": + folder: all + "3.11.2": + folder: all "3.11.1": folder: all "3.11.0": diff --git a/recipes/geotrans/all/conandata.yml b/recipes/geotrans/all/conandata.yml index d74641c250a30..2b4068a9ac96e 100644 --- a/recipes/geotrans/all/conandata.yml +++ b/recipes/geotrans/all/conandata.yml @@ -1,7 +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" patches: + "3.9": + - patch_file: "patches/3.x-fix-for-cxx20.patch" "3.8": - - patch_file: "patches/3.8-fix-for-cxx20.patch" + - patch_file: "patches/3.x-fix-for-cxx20.patch" diff --git a/recipes/geotrans/all/conanfile.py b/recipes/geotrans/all/conanfile.py index 45f53bc792fe5..416bae1b78a53 100644 --- a/recipes/geotrans/all/conanfile.py +++ b/recipes/geotrans/all/conanfile.py @@ -9,23 +9,12 @@ 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], @@ -52,12 +41,11 @@ def layout(self): cmake_layout(self, src_folder="src") def validate(self): - if self.info.settings.compiler.get_safe("cppstd"): + 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, filename=f"geotrans-{self.version}.tgz") def generate(self): tc = CMakeToolchain(self) 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/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/getdns/all/CMakeLists.txt b/recipes/getdns/all/CMakeLists.txt deleted file mode 100644 index f96c6dd4ed727..0000000000000 --- a/recipes/getdns/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(WIN32) - set(CMAKE_REQUIRED_LIBRARIES ws2_32) -endif() - -add_subdirectory(source_subfolder) diff --git a/recipes/getdns/all/conan_deps.cmake b/recipes/getdns/all/conan_deps.cmake new file mode 100644 index 0000000000000..0925ccf84a265 --- /dev/null +++ b/recipes/getdns/all/conan_deps.cmake @@ -0,0 +1,29 @@ +cmake_minimum_required(VERSION 3.15) +project(cmake_wrapper) + +# Wrapper for find_package() that sets variables in the format expected by the project +macro(custom_find_package name) + find_package(${name} REQUIRED CONFIG + # Allow only Conan packages + NO_DEFAULT_PATH + PATHS ${CMAKE_PREFIX_PATH} + ) + string(TOUPPER ${name} name_upper) + set(${name_upper}_FOUND TRUE) + set(${name_upper}_INCLUDE_DIR ${${name}_INCLUDE_DIR}) + set(${name_upper}_LIBRARIES ${${name}_LIBRARIES}) +endmacro() + +custom_find_package(OpenSSL) +if(BUILD_LIBEV) + custom_find_package(Libev) +endif() +if(BUILD_LIBEVENT2) + custom_find_package(Libevent2) +endif() +if(BUILD_LIBUV) + custom_find_package(Libuv) +endif() +if(USE_LIBIDN2) + custom_find_package(Libidn2) +endif() diff --git a/recipes/getdns/all/conandata.yml b/recipes/getdns/all/conandata.yml index 63656d1d51254..a97e641f541f4 100644 --- a/recipes/getdns/all/conandata.yml +++ b/recipes/getdns/all/conandata.yml @@ -1,14 +1,11 @@ sources: - "1.6.0": - url: "https://getdnsapi.net/dist/getdns-1.6.0.tar.gz" - sha256: "40e5737471a3902ba8304b0fd63aa7c95802f66ebbc6eae53c487c8e8a380f4a" + "1.7.3": + url: "https://getdnsapi.net/dist/getdns-1.7.3.tar.gz" + sha256: "f1404ca250f02e37a118aa00cf0ec2cbe11896e060c6d369c6761baea7d55a2c" patches: - "1.6.0": - - patch_file: "patches/1.6.0-0001-install-runtimes.patch" - base_path: "source_subfolder" + "1.7.3": - patch_file: "patches/1.6.0-0002-fix-exports-extension-libraries.patch" - base_path: "source_subfolder" - - patch_file: "patches/1.6.0-0003-let-find-modules-use-pkgconfig.patch" - base_path: "source_subfolder" - - patch_file: "patches/1.6.0-0004-dont-install-symlinked-license.patch" - base_path: "source_subfolder" + - patch_file: "patches/1.7.3-fix-windows-build.patch" + patch_description: "Fix Windows build" + patch_source: "https://github.com/getdnsapi/getdns/pull/538" + patch_type: "portability" diff --git a/recipes/getdns/all/conanfile.py b/recipes/getdns/all/conanfile.py index a1d7aed1728a6..33e5e1ab9e6c1 100644 --- a/recipes/getdns/all/conanfile.py +++ b/recipes/getdns/all/conanfile.py @@ -1,24 +1,28 @@ -from conans import CMake, ConanFile, tools -from conans.errors import ConanInvalidConfiguration -import glob import os +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, export_conandata_patches, get, rmdir, rm +from conan.tools.microsoft import is_msvc + +required_conan_version = ">=1.53.0" + class GetDnsConan(ConanFile): name = "getdns" description = "A modern asynchronous DNS API" - topics = "conan", "getdns", "asynchronous", "event" license = "BSD-3-Clause" - homepage = "https://getdnsapi.net/" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://getdnsapi.net/" + topics = ("dns", "asynchronous", "event") + + package_type = "library" settings = "os", "arch", "compiler", "build_type" - exports_sources = "CMakeLists.txt", "patches/**" options = { "shared": [True, False], "fPIC": [True, False], - "tls": [False, "gnutls"], - "stub_only": ["auto", True, False], - "with_libev": ["auto", True, False], + "with_libev": [True, False], "with_libevent": [True, False], "with_libuv": [True, False], "with_libidn2": [True, False], @@ -26,36 +30,15 @@ class GetDnsConan(ConanFile): default_options = { "shared": False, "fPIC": True, - "stub_only": "auto", - "tls": False, - "with_libev": "auto", + "with_libev": True, "with_libevent": True, "with_libuv": True, - "with_libidn2": True, + "with_libidn2": True } - generators = "cmake", "pkg_config", "cmake_find_package" - - _cmake = None - - @property - def _with_libev(self): - if self.options.with_libev == "auto": - return self.settings.os != "Windows" - else: - return self.options.with_libev - - @property - def _stub_only(self): - if self.options.stub_only == "auto": - # FIXME: uncomment the next line when libunbound is available - # return self.settings.os == "Windows" - return True - else: - return self.options.stub_only - - @property - def _source_subfolder(self): - return "source_subfolder" + + def export_sources(self): + export_conandata_patches(self) + copy(self, "conan_deps.cmake", src=self.recipe_folder, dst=os.path.join(self.export_sources_folder, "src")) def config_options(self): if self.settings.os == "Windows": @@ -63,108 +46,119 @@ 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("openssl/1.1.1j") - if self._with_libev: + self.requires("openssl/[>=1.1 <4]") + if self.options.with_libev: self.requires("libev/4.33") if self.options.with_libevent: self.requires("libevent/2.1.12") if self.options.with_libuv: - self.requires("libuv/1.41.0") + self.requires("libuv/1.48.0") if self.options.with_libidn2: self.requires("libidn2/2.3.0") - if self.options.tls == "gnutls": - self.requires("nettle/3.6") - # FIXME: missing gnutls recipe - raise ConanInvalidConfiguration("gnutls is not (yet) available on cci") - if not self._stub_only: - # FIXME: missing libunbound recipe - raise ConanInvalidConfiguration("libunbound is not (yet) available on cci") def build_requirements(self): - self.build_requires("pkgconf/1.7.3") + self.tool_requires("cmake/[>=3.20 <4]") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename("getdns-{}".format(self.version), self._source_subfolder) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["OPENSSL_USE_STATIC_LIBS"] = not self.options["openssl"].shared - self._cmake.definitions["ENABLE_SHARED"] = self.options.shared - self._cmake.definitions["ENABLE_STATIC"] = not self.options.shared - self._cmake.definitions["ENABLE_STUB_ONLY"] = self._stub_only - self._cmake.definitions["BUILD_LIBEV"] = self._with_libev - self._cmake.definitions["BUILD_LIBEVENT2"] = self.options.with_libevent - self._cmake.definitions["BUILD_LIBUV"] = self.options.with_libuv - self._cmake.definitions["USE_LIBIDN2"] = self.options.with_libidn2 - self._cmake.definitions["USE_GNUTLS"] = self.options.tls == "gnutls" - self._cmake.definitions["BUILD_TESTING"] = False - - self._cmake.configure() - return self._cmake + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + VirtualBuildEnv(self).generate() + + tc = CMakeToolchain(self) + tc.variables["CMAKE_PROJECT_getdns_INCLUDE"] = "conan_deps.cmake" + tc.variables["OPENSSL_USE_STATIC_LIBS"] = not self.dependencies["openssl"].options.shared + tc.variables["ENABLE_SHARED"] = self.options.shared + tc.variables["ENABLE_STATIC"] = not self.options.shared + # INFO: Disabling stub-only requires libunbound + tc.variables["ENABLE_STUB_ONLY"] = True + tc.variables["BUILD_LIBEV"] = self.options.with_libev + tc.variables["BUILD_LIBEVENT2"] = self.options.with_libevent + tc.variables["BUILD_LIBUV"] = self.options.with_libuv + tc.variables["USE_LIBIDN2"] = self.options.with_libidn2 + # INFO: GnuTLS requires libdane support and is not supported by MSVC + tc.variables["USE_GNUTLS"] = False + # Force use of internal strptime when cross-compiling + tc.variables["FORCE_COMPAT_STRPTIME"] = True + tc.variables["BUILD_TESTING"] = False + # To fix OpenSSL try_compile() checks + # https://github.com/conan-io/conan/issues/12180 + tc.variables["CMAKE_TRY_COMPILE_CONFIGURATION"] = str(self.settings.build_type) + if self.settings.compiler in ["clang", "apple-clang"]: + # INFO: https://github.com/getdnsapi/getdns/issues/544 + # TODO: Change to extra_clfags when CCI only uses Conan 2.x + tc.blocks["cmake_flags_init"].template += '\nstring(APPEND CMAKE_C_FLAGS_INIT " -Wno-incompatible-function-pointer-types")' + if self.options.with_libidn2 and is_msvc(self): + # INFO: getdns_static.lib(convert.c.obj): error LNK2019: unresolved external symbol __imp_idn2_lookup_u8 + tc.preprocessor_definitions.update({it: 1 for it in self.dependencies["libidn2"].cpp_info.defines}) + tc.generate() + + deps = CMakeDeps(self) + deps.set_property("libev", "cmake_file_name", "Libev") + deps.set_property("libev", "cmake_target_name", "Libev::Libev") + deps.set_property("libevent", "cmake_file_name", "Libevent2") + deps.set_property("libevent::core", "cmake_target_name", "Libevent2::Libevent_core") + deps.set_property("libidn2", "cmake_file_name", "Libidn2") + deps.set_property("libidn2", "cmake_target_name", "Libidn2::Libidn2") + deps.set_property("libuv", "cmake_file_name", "Libuv") + deps.set_property("libuv", "cmake_target_name", "Libuv::Libuv") + deps.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + rm(self, "Find*.cmake", os.path.join(self.source_folder, "cmake", "modules")) def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - # Use FindOpenSSL.cmake to let check_function_exists succeed - # Remove other cmake modules as they use FindPkgConfig - for fn in glob.glob("Find*cmake"): - if "OpenSSL" not in fn: - os.unlink(fn) - cmake = self._configure_cmake() + self._patch_sources() + 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, "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")) - tools.rmdir(os.path.join(self.package_folder, "share")) - - def package_id(self): - self.info.options.stub_only = self._stub_only - self.info.options.with_libev = self._with_libev + 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): libsuffix = "" - if self.settings.compiler == "Visual Studio" and not self.options.shared: + if is_msvc(self) and not self.options.shared: libsuffix = "_static" - self.cpp_info.components["libgetdns"].libs = ["getdns" + libsuffix] self.cpp_info.components["libgetdns"].includedirs.append(os.path.join("include", "getdns")) - self.cpp_info.components["libgetdns"].names["pkg_config"]= "getdns" + self.cpp_info.components["libgetdns"].set_property("pkg_config_name", "getdns") self.cpp_info.components["libgetdns"].requires = ["openssl::openssl"] if self.options.with_libidn2: self.cpp_info.components["libgetdns"].requires.append("libidn2::libidn2") - if self.options.with_libidn2: - self.cpp_info.components["libgetdns"].requires.append("libidn2::libidn2") - if self.options.tls == "gnutls": - self.cpp_info.components["libgetdns"].requires.extend(["nettle::nettle", "gnutls::gnutls"]) + if self.settings.os == "Windows": + self.cpp_info.components["libgetdns"].system_libs.extend(["ws2_32", "crypt32", "gdi32", "iphlpapi", "psapi", "userenv"]) if self.options.with_libevent: - self.cpp_info.components["dns_ex_event"].libs = ["getdns_ex_event" + libsuffix] - self.cpp_info.components["dns_ex_event"].requires= ["libgetdns", "libevent::libevent"] - self.cpp_info.components["dns_ex_event"].names["pkg_config"]= "getdns_ext_event" + self.cpp_info.components["dns_ext_event"].libs = ["getdns_ext_event" + libsuffix] + self.cpp_info.components["dns_ext_event"].requires = ["libgetdns", "libevent::libevent"] + self.cpp_info.components["dns_ext_event"].set_property("pkg_config_name", "getdns_ext_event") - if self._with_libev: - self.cpp_info.components["dns_ex_ev"].libs = ["getdns_ex_ev" + libsuffix] - self.cpp_info.components["dns_ex_ev"].requires = ["libgetdns", "libev::libev"] - self.cpp_info.components["dns_ex_ev"].names["pkg_config"]= "getdns_ext_ev" + if self.options.with_libev: + self.cpp_info.components["dns_ext_ev"].libs = ["getdns_ext_ev" + libsuffix] + self.cpp_info.components["dns_ext_ev"].requires = ["libgetdns", "libev::libev"] + self.cpp_info.components["dns_ext_ev"].set_property("pkg_config_name", "getdns_ext_ev") if self.options.with_libuv: - self.cpp_info.components["dns_ex_uv"].libs = ["getdns_ex_uv" + libsuffix] - self.cpp_info.components["dns_ex_uv"].requires = ["libgetdns", "libuv::libuv"] - self.cpp_info.components["dns_ex_uv"].names["pkg_config"]= "getdns_ext_uv" + self.cpp_info.components["dns_ext_uv"].libs = ["getdns_ext_uv" + libsuffix] + self.cpp_info.components["dns_ext_uv"].requires = ["libgetdns", "libuv::libuv"] + self.cpp_info.components["dns_ext_uv"].set_property("pkg_config_name", "getdns_ext_uv") + # TODO: Remove after dropping support for Conan 1.x in ConanCenterIndex 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/getdns/all/patches/1.6.0-0001-install-runtimes.patch b/recipes/getdns/all/patches/1.6.0-0001-install-runtimes.patch deleted file mode 100644 index de23061cc40af..0000000000000 --- a/recipes/getdns/all/patches/1.6.0-0001-install-runtimes.patch +++ /dev/null @@ -1,33 +0,0 @@ -Based on https://github.com/getdnsapi/getdns/pull/477 - ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -1055,22 +1055,22 @@ - endif () - endif () - if (ENABLE_SHARED) -- install(TARGETS getdns_shared LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) -+ install(TARGETS getdns_shared LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) - if (USE_LIBEV) -- install(TARGETS getdns_ex_ev_shared LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) -+ install(TARGETS getdns_ex_ev_shared LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) - endif () - if (USE_LIBEVENT2) -- install(TARGETS getdns_ex_event_shared LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) -+ install(TARGETS getdns_ex_event_shared LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) - endif () - if (USE_LIBUV) -- install(TARGETS getdns_ex_uv_shared LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) -+ install(TARGETS getdns_ex_uv_shared LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) - endif () - endif () - if (BUILD_GETDNS_QUERY) -- install(TARGETS getdns_query RUNTIME DESTINATION bin) -+ install(TARGETS getdns_query RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) - endif () - if (BUILD_GETDNS_SERVER_MON) -- install(TARGETS getdns_server_mon RUNTIME DESTINATION bin) -+ install(TARGETS getdns_server_mon RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) - endif () - - install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/getdns DESTINATION include) diff --git a/recipes/getdns/all/patches/1.6.0-0003-let-find-modules-use-pkgconfig.patch b/recipes/getdns/all/patches/1.6.0-0003-let-find-modules-use-pkgconfig.patch deleted file mode 100644 index 9e446cae01b2a..0000000000000 --- a/recipes/getdns/all/patches/1.6.0-0003-let-find-modules-use-pkgconfig.patch +++ /dev/null @@ -1,641 +0,0 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -659,9 +659,9 @@ - target_include_directories(getdns_objects PRIVATE src/ssl_dane) - set(USE_DANESSL 1) - endif () --if (Libidn_FOUND) -- target_include_directories(getdns_objects PRIVATE ${LIBIDN_INCLUDE_DIR}) --endif () -+#if (Libidn_FOUND) -+# target_include_directories(getdns_objects PRIVATE ${LIBIDN_INCLUDE_DIR}) -+#endif () - if (Libidn2_FOUND) - target_include_directories(getdns_objects PRIVATE ${LIBIDN2_INCLUDE_DIR}) - endif () -@@ -695,9 +695,9 @@ - if (Libunbound_FOUND) - target_link_libraries(getdns PUBLIC Libunbound::Libunbound) - endif () -- if (Libidn_FOUND) -- target_link_libraries(getdns PUBLIC Libidn::Libidn) -- endif () -+# if (Libidn_FOUND) -+# target_link_libraries(getdns PUBLIC Libidn::Libidn) -+# endif () - if (Libidn2_FOUND) - target_link_libraries(getdns PUBLIC Libidn2::Libidn2) - endif () ---- cmake/modules/FindGnuTLS.cmake -+++ cmake/modules/FindGnuTLS.cmake -@@ -30,51 +30,65 @@ - - #]=======================================================================] - --find_path(GNUTLS_INCLUDE_DIR gnutls/gnutls.h -- HINTS -- "${GNUTLS_DIR}" -- "${GNUTLS_DIR}/include" --) -- --find_library(GNUTLS_LIBRARY NAMES gnutls libgnutls -- HINTS -- "${GNUTLS_DIR}" -- "${GNUTLS_DIR}/lib" --) -- --find_library(GNUTLS_DANE_LIBRARY NAMES gnutls-dane libgnutls-dane -- HINTS -- "${GNUTLS_DIR}" -- "${GNUTLS_DIR}/lib" --) -- --set(GNUTLS_LIBRARIES "") -- --if (GNUTLS_INCLUDE_DIR AND GNUTLS_LIBRARY AND GNUTLS_DANE_LIBRARY) -- if (NOT TARGET GnuTLS::GnuTLS) -- add_library(GnuTLS::GnuTLS UNKNOWN IMPORTED) -- set_target_properties(GnuTLS::GnuTLS PROPERTIES -- INTERFACE_INCLUDE_DIRECTORIES "${GNUTLS_INCLUDE_DIR}" -- IMPORTED_LINK_INTERFACE_LANGUAGES "C" -- IMPORTED_LOCATION "${GNUTLS_LIBRARY}" -- ) -- endif () -- if (NOT TARGET GnuTLS::Dane) -- add_library(GnuTLS::Dane UNKNOWN IMPORTED) -- set_target_properties(GnuTLS::Dane PROPERTIES -- INTERFACE_INCLUDE_DIRECTORIES "${GNUTLS_INCLUDE_DIR}" -- IMPORTED_LINK_INTERFACE_LANGUAGES "C" -- IMPORTED_LOCATION "${GNUTLS_DANE_LIBRARY}" -- ) -- endif () -- -- if (NOT GNUTLS_VERSION AND GNUTLS_INCLUDE_DIR) -- file(STRINGS "${GNUTLS_INCLUDE_DIR}/gnutls/gnutls.h" GNUTLS_VER_H REGEX "^#define GNUTLS_VERSION_(MAJOR|MINOR|PATCH) ") -- string(REGEX REPLACE "^.*_MAJOR ([0-9]+).*_MINOR ([0-9]+).*_PATCH ([0-9]+).*$" "\\1.\\2.\\3c" GNUTLS_VERSION "${GNUTLS_VER_H}") -- endif () -+include(FindPkgConfig) -+if(PKG_CONFIG_FOUND) -+ pkg_check_modules(PkgGnuTLS IMPORTED_TARGET GLOBAL QUIET gnutls) -+ pkg_check_modules(PkgGnuTLSDane IMPORTED_TARGET GLOBAL QUIET gnutls-dane) - endif() - --list(APPEND GNUTLS_LIBRARIES "${GNUTLS_LIBRARY}" "${GNUTLS_DANE_LIBRARY}") -+if(PkgGnuTLS_FOUND AND PkgGnuTLSDane_FOUND) -+ set(GNUTLS_INCLUDE_DIR ${PkgGnuTLS_INCLUDE_DIRS} $PkgGnuTLSDane_INCLUDE_DIRS}) -+ set(NETTLE_LIBRARIES ${PkgGnuTLS_LIBRARIES} ${PkgGnuTLSDane_LIBRARIES}) -+ set(NETTLE_VERSION ${PkgGnuTLS_VERSION}) -+ add_library(GnuTLS::GnuTLS ALIAS PkgConfig::PkgGnuTLS) -+ add_library(GnuTLS::Dane ALIAS PkgConfig::PkgGnuTLSDane) -+else() -+ find_path(GNUTLS_INCLUDE_DIR gnutls/gnutls.h -+ HINTS -+ "${GNUTLS_DIR}" -+ "${GNUTLS_DIR}/include" -+ ) -+ -+ find_library(GNUTLS_LIBRARY NAMES gnutls libgnutls -+ HINTS -+ "${GNUTLS_DIR}" -+ "${GNUTLS_DIR}/lib" -+ ) -+ -+ find_library(GNUTLS_DANE_LIBRARY NAMES gnutls-dane libgnutls-dane -+ HINTS -+ "${GNUTLS_DIR}" -+ "${GNUTLS_DIR}/lib" -+ ) -+ -+ set(GNUTLS_LIBRARIES "") -+ -+ if (GNUTLS_INCLUDE_DIR AND GNUTLS_LIBRARY AND GNUTLS_DANE_LIBRARY) -+ if (NOT TARGET GnuTLS::GnuTLS) -+ add_library(GnuTLS::GnuTLS UNKNOWN IMPORTED) -+ set_target_properties(GnuTLS::GnuTLS PROPERTIES -+ INTERFACE_INCLUDE_DIRECTORIES "${GNUTLS_INCLUDE_DIR}" -+ IMPORTED_LINK_INTERFACE_LANGUAGES "C" -+ IMPORTED_LOCATION "${GNUTLS_LIBRARY}" -+ ) -+ endif () -+ if (NOT TARGET GnuTLS::Dane) -+ add_library(GnuTLS::Dane UNKNOWN IMPORTED) -+ set_target_properties(GnuTLS::Dane PROPERTIES -+ INTERFACE_INCLUDE_DIRECTORIES "${GNUTLS_INCLUDE_DIR}" -+ IMPORTED_LINK_INTERFACE_LANGUAGES "C" -+ IMPORTED_LOCATION "${GNUTLS_DANE_LIBRARY}" -+ ) -+ endif () -+ -+ if (NOT GNUTLS_VERSION AND GNUTLS_INCLUDE_DIR) -+ file(STRINGS "${GNUTLS_INCLUDE_DIR}/gnutls/gnutls.h" GNUTLS_VER_H REGEX "^#define GNUTLS_VERSION_(MAJOR|MINOR|PATCH) ") -+ string(REGEX REPLACE "^.*_MAJOR ([0-9]+).*_MINOR ([0-9]+).*_PATCH ([0-9]+).*$" "\\1.\\2.\\3c" GNUTLS_VERSION "${GNUTLS_VER_H}") -+ endif () -+ endif() -+ -+ list(APPEND GNUTLS_LIBRARIES "${GNUTLS_LIBRARY}" "${GNUTLS_DANE_LIBRARY}") -+endif() - - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(GnuTLS ---- cmake/modules/FindLibevent2.cmake -+++ cmake/modules/FindLibevent2.cmake -@@ -28,37 +28,49 @@ - - #]=======================================================================] - --find_path(LIBEVENT2_INCLUDE_DIR event2/event.h -- HINTS -- "${LIBEVENT2_DIR}" -- "${LIBEVENT2_DIR}/include" --) -- --find_library(LIBEVENT2_LIBRARY NAMES event_core libevent_core -- HINTS -- "${LIBEVENT2_DIR}" -- "${LIBEVENT2_DIR}/lib" --) -- --set(LIBEVENT2_LIBRARIES "") -- --if (LIBEVENT2_INCLUDE_DIR AND LIBEVENT2_LIBRARY) -- if (NOT TARGET Libevent2::Libevent_core) -- add_library(Libevent2::Libevent_core UNKNOWN IMPORTED) -- set_target_properties(Libevent2::Libevent_core PROPERTIES -- INTERFACE_INCLUDE_DIRECTORIES "${LIBEVENT2_INCLUDE_DIR}" -- IMPORTED_LINK_INTERFACE_LANGUAGES "C" -- IMPORTED_LOCATION "${LIBEVENT2_LIBRARY}" -- ) -- endif () -- -- if (NOT LIBEVENT2_VERSION AND LIBEVENT2_INCLUDE_DIR AND EXISTS "${LIBEVENT2_INCLUDE_DIR}/event2/event.h") -- file(STRINGS "${LIBEVENT2_INCLUDE_DIR}/event2/event-config.h" LIBEVENT2_H REGEX "^#define _?EVENT_+VERSION ") -- string(REGEX REPLACE "^.*EVENT_+VERSION \"([^\"]+)\".*$" "\\1" LIBEVENT2_VERSION "${LIBEVENT2_H}") -- endif () -+include(FindPkgConfig) -+if(PKG_CONFIG_FOUND) -+ pkg_check_modules(PkgLibevent IMPORTED_TARGET GLOBAL QUIET libevent>=2) - endif() - --list(APPEND LIBEVENT2_LIBRARIES "${LIBEVENT2_LIBRARY}") -+if(PkgLibevent_FOUND) -+ set(LIBEVENT2_INCLUDE_DIR ${PkgLibevent_INCLUDE_DIRS}) -+ set(LIBEVENT2_LIBRARIES ${PkgLibevent_LIBRARIES}) -+ set(LIBEVENT2_VERSION ${PkgLibevent_VERSION}) -+ add_library(Libevent2::Libevent_core ALIAS PkgConfig::PkgLibevent) -+else() -+ find_path(LIBEVENT2_INCLUDE_DIR event2/event.h -+ HINTS -+ "${LIBEVENT2_DIR}" -+ "${LIBEVENT2_DIR}/include" -+ ) -+ -+ find_library(LIBEVENT2_LIBRARY NAMES event_core libevent_core -+ HINTS -+ "${LIBEVENT2_DIR}" -+ "${LIBEVENT2_DIR}/lib" -+ ) -+ -+ set(LIBEVENT2_LIBRARIES "") -+ -+ if (LIBEVENT2_INCLUDE_DIR AND LIBEVENT2_LIBRARY) -+ if (NOT TARGET Libevent2::Libevent_core) -+ add_library(Libevent2::Libevent_core UNKNOWN IMPORTED) -+ set_target_properties(Libevent2::Libevent_core PROPERTIES -+ INTERFACE_INCLUDE_DIRECTORIES "${LIBEVENT2_INCLUDE_DIR}" -+ IMPORTED_LINK_INTERFACE_LANGUAGES "C" -+ IMPORTED_LOCATION "${LIBEVENT2_LIBRARY}" -+ ) -+ endif () -+ -+ if (NOT LIBEVENT2_VERSION AND LIBEVENT2_INCLUDE_DIR AND EXISTS "${LIBEVENT2_INCLUDE_DIR}/event2/event.h") -+ file(STRINGS "${LIBEVENT2_INCLUDE_DIR}/event2/event-config.h" LIBEVENT2_H REGEX "^#define _?EVENT_+VERSION ") -+ string(REGEX REPLACE "^.*EVENT_+VERSION \"([^\"]+)\".*$" "\\1" LIBEVENT2_VERSION "${LIBEVENT2_H}") -+ endif () -+ endif() -+ -+ list(APPEND LIBEVENT2_LIBRARIES "${LIBEVENT2_LIBRARY}") -+endif() - - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(Libevent2 ---- cmake/modules/FindLibidn2.cmake -+++ cmake/modules/FindLibidn2.cmake -@@ -28,37 +28,49 @@ - - #]=======================================================================] - --find_path(LIBIDN2_INCLUDE_DIR idn2.h -- HINTS -- "${LIBIDN2_DIR}" -- "${LIBIDN2_DIR}/include" --) -- --find_library(LIBIDN2_LIBRARY NAMES idn2 libidn2 -- HINTS -- "${LIBIDN2_DIR}" -- "${LIBIDN2_DIR}/lib" --) -- --set(LIBIDN2_LIBRARIES "") -- --if (LIBIDN2_INCLUDE_DIR AND LIBIDN2_LIBRARY) -- if (NOT TARGET Libidn2::Libidn2) -- add_library(Libidn2::Libidn2 UNKNOWN IMPORTED) -- set_target_properties(Libidn2::Libidn2 PROPERTIES -- INTERFACE_INCLUDE_DIRECTORIES "${LIBIDN2_INCLUDE_DIR}" -- IMPORTED_LINK_INTERFACE_LANGUAGES "C" -- IMPORTED_LOCATION "${LIBIDN2_LIBRARY}" -+include(FindPkgConfig) -+if(PKG_CONFIG_FOUND) -+ pkg_check_modules(PkgLibIdn2 IMPORTED_TARGET GLOBAL libidn2) -+endif() -+ -+if(PkgLibIdn2_FOUND) -+ set(LIBIDN2_INCLUDE_DIR ${PkgLibIdn2_INCLUDE_DIRS}) -+ set(LIBIDN2_LIBRARIES ${PkgLibIdn2_LIBRARIES}) -+ set(LIBIDN2_VERSION ${PkgLibIdn2_VERSION}) -+ add_library(Libidn2::Libidn2 ALIAS PkgConfig::PkgLibIdn2) -+else() -+ find_path(LIBIDN2_INCLUDE_DIR idn2.h -+ HINTS -+ "${LIBIDN2_DIR}" -+ "${LIBIDN2_DIR}/include" -+ ) -+ -+ find_library(LIBIDN2_LIBRARY NAMES idn2 libidn2 -+ HINTS -+ "${LIBIDN2_DIR}" -+ "${LIBIDN2_DIR}/lib" -+ ) -+ -+ set(LIBIDN2_LIBRARIES "") -+ -+ if (LIBIDN2_INCLUDE_DIR AND LIBIDN2_LIBRARY) -+ if (NOT TARGET Libidn2::Libidn2) -+ add_library(Libidn2::Libidn2 UNKNOWN IMPORTED) -+ set_target_properties(Libidn2::Libidn2 PROPERTIES -+ INTERFACE_INCLUDE_DIRECTORIES "${LIBIDN2_INCLUDE_DIR}" -+ IMPORTED_LINK_INTERFACE_LANGUAGES "C" -+ IMPORTED_LOCATION "${LIBIDN2_LIBRARY}" - ) -- endif () -+ endif () - -- if (NOT LIBIDN2_VERSION AND LIBIDN2_INCLUDE_DIR AND EXISTS "${LIBIDN2_INCLUDE_DIR}/unbound.h") -- file(STRINGS "${LIBIDN2_INCLUDE_DIR}/idn2.h" LIBIDN2_H REGEX "^#define IDN2_VERSION ") -- string(REGEX REPLACE "^.*IDN2_VERSION \"([0-9.]+)\".*$" "\\1" LIBIDN2_VERSION "${LIBIDN2_H}") -- endif () --endif() -+ if (NOT LIBIDN2_VERSION AND LIBIDN2_INCLUDE_DIR AND EXISTS "${LIBIDN2_INCLUDE_DIR}/unbound.h") -+ file(STRINGS "${LIBIDN2_INCLUDE_DIR}/idn2.h" LIBIDN2_H REGEX "^#define IDN2_VERSION ") -+ string(REGEX REPLACE "^.*IDN2_VERSION \"([0-9.]+)\".*$" "\\1" LIBIDN2_VERSION "${LIBIDN2_H}") -+ endif () - --list(APPEND LIBIDN2_LIBRARIES "${LIBIDN2_LIBRARY}") -+ list(APPEND LIBIDN2_LIBRARIES "${LIBIDN2_LIBRARY}") -+ endif() -+endif() - - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(Libidn2 ---- cmake/modules/FindLibunbound.cmake -+++ cmake/modules/FindLibunbound.cmake -@@ -28,58 +28,70 @@ - - #]=======================================================================] - --find_path(LIBUNBOUND_INCLUDE_DIR unbound.h -- HINTS -- "${LIBUNBOUND_DIR}" -- "${LIBUNBOUND_DIR}/include" --) -- --find_library(LIBUNBOUND_LIBRARY NAMES unbound -- HINTS -- "${LIBUNBOUND_DIR}" -- "${LIBUNBOUND_DIR}/lib" --) -- --set(LIBUNBOUND_LIBRARIES "") -- --if (UNIX) -- find_package(Threads REQUIRED) -- find_package(OpenSSL REQUIRED) -- -- list(APPEND LIBUNBOUND_LIBRARIES "${CMAKE_THREAD_LIBS_INIT}") -- list(APPEND LIBUNBOUND_LIBRARIES "${OPENSSL_LIBRARIES}") -+include(FindPkgConfig) -+if(PKG_CONFIG_FOUND) -+ pkg_check_modules(PkgLibunbound IMPORTED_TARGET GLOBAL QUIET libunbound) - endif() - --if (LIBUNBOUND_INCLUDE_DIR AND LIBUNBOUND_LIBRARY) -- if (NOT TARGET Libunbound::Libunbound) -- add_library(Libunbound::Libunbound UNKNOWN IMPORTED) -- set_target_properties(Libunbound::Libunbound PROPERTIES -- INTERFACE_INCLUDE_DIRECTORIES "${LIBUNBOUND_INCLUDE_DIR}" -- IMPORTED_LINK_INTERFACE_LANGUAGES "C" -- IMPORTED_LOCATION "${LIBUNBOUND_LIBRARY}" -- ) -- -- if(UNIX AND TARGET Threads::Threads) -- set_property(TARGET Libunbound::Libunbound APPEND PROPERTY -- INTERFACE_LINK_LIBRARIES Threads::Threads) -- endif () -- if(UNIX AND TARGET OpenSSL::SSL) -- set_property(TARGET Libunbound::Libunbound APPEND PROPERTY -- INTERFACE_LINK_LIBRARIES OpenSSL::SSL) -+if(PkgLibunbound_FOUND) -+ set(LIBUNBOUND_INCLUDE_DIR ${PkgLibunbound_INCLUDE_DIRS}) -+ set(LIBUNBOUND_LIBRARIES ${PkgLibunbound_LIBRARIES}) -+ set(LIBUNBOUND_VERSION ${PkgLibunbound_VERSION}) -+ add_library(Libunbound::Libunbound ALIAS PkgConfig::PkgLibunbound) -+else() -+ find_path(LIBUNBOUND_INCLUDE_DIR unbound.h -+ HINTS -+ "${LIBUNBOUND_DIR}" -+ "${LIBUNBOUND_DIR}/include" -+ ) -+ -+ find_library(LIBUNBOUND_LIBRARY NAMES unbound -+ HINTS -+ "${LIBUNBOUND_DIR}" -+ "${LIBUNBOUND_DIR}/lib" -+ ) -+ -+ set(LIBUNBOUND_LIBRARIES "") -+ -+ if (UNIX) -+ find_package(Threads REQUIRED) -+ find_package(OpenSSL REQUIRED) -+ -+ list(APPEND LIBUNBOUND_LIBRARIES "${CMAKE_THREAD_LIBS_INIT}") -+ list(APPEND LIBUNBOUND_LIBRARIES "${OPENSSL_LIBRARIES}") -+ endif() -+ -+ if (LIBUNBOUND_INCLUDE_DIR AND LIBUNBOUND_LIBRARY) -+ if (NOT TARGET Libunbound::Libunbound) -+ add_library(Libunbound::Libunbound UNKNOWN IMPORTED) -+ set_target_properties(Libunbound::Libunbound PROPERTIES -+ INTERFACE_INCLUDE_DIRECTORIES "${LIBUNBOUND_INCLUDE_DIR}" -+ IMPORTED_LINK_INTERFACE_LANGUAGES "C" -+ IMPORTED_LOCATION "${LIBUNBOUND_LIBRARY}" -+ ) -+ -+ if(UNIX AND TARGET Threads::Threads) -+ set_property(TARGET Libunbound::Libunbound APPEND PROPERTY -+ INTERFACE_LINK_LIBRARIES Threads::Threads) -+ endif () -+ if(UNIX AND TARGET OpenSSL::SSL) -+ set_property(TARGET Libunbound::Libunbound APPEND PROPERTY -+ INTERFACE_LINK_LIBRARIES OpenSSL::SSL) -+ endif () -+ if(UNIX AND TARGET OpenSSL::Crypto) -+ set_property(TARGET Libunbound::Libunbound APPEND PROPERTY -+ INTERFACE_LINK_LIBRARIES OpenSSL::Crypto) -+ endif () - endif () -- if(UNIX AND TARGET OpenSSL::Crypto) -- set_property(TARGET Libunbound::Libunbound APPEND PROPERTY -- INTERFACE_LINK_LIBRARIES OpenSSL::Crypto) -+ -+ if (NOT LIBUNBOUND_VERSION AND LIBUNBOUND_INCLUDE_DIR AND EXISTS "${LIBUNBOUND_INCLUDE_DIR}/unbound.h") -+ file(STRINGS "${LIBUNBOUND_INCLUDE_DIR}/unbound.h" LIBUNBOUND_H REGEX "^#define UNBOUND_VERSION_M[A-Z]+") -+ string(REGEX REPLACE "^.*MAJOR ([0-9]+).*MINOR ([0-9]+).*MICRO ([0-9]+).*$" "\\1.\\2.\\3" LIBUNBOUND_VERSION "${LIBUNBOUND_H}") - endif () -- endif () -- -- if (NOT LIBUNBOUND_VERSION AND LIBUNBOUND_INCLUDE_DIR AND EXISTS "${LIBUNBOUND_INCLUDE_DIR}/unbound.h") -- file(STRINGS "${LIBUNBOUND_INCLUDE_DIR}/unbound.h" LIBUNBOUND_H REGEX "^#define UNBOUND_VERSION_M[A-Z]+") -- string(REGEX REPLACE "^.*MAJOR ([0-9]+).*MINOR ([0-9]+).*MICRO ([0-9]+).*$" "\\1.\\2.\\3" LIBUNBOUND_VERSION "${LIBUNBOUND_H}") -- endif () --endif() -- --list(APPEND LIBUNBOUND_LIBRARIES "${LIBUNBOUND_LIBRARY}") -+ endif() -+ -+ list(APPEND LIBUNBOUND_LIBRARIES "${LIBUNBOUND_LIBRARY}") -+endif - - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(Libunbound ---- cmake/modules/FindLibuv.cmake -+++ cmake/modules/FindLibuv.cmake -@@ -28,42 +28,54 @@ - - #]=======================================================================] - --find_path(LIBUV_INCLUDE_DIR uv.h -- HINTS -- "${LIBUV_DIR}" -- "${LIBUV_DIR}/include" --) -- --find_library(LIBUV_LIBRARY NAMES uv libuv -- HINTS -- "${LIBUV_DIR}" -- "${LIBUV_DIR}/lib" --) -- --set(LIBUV_LIBRARIES "") -- --if (LIBUV_INCLUDE_DIR AND LIBUV_LIBRARY) -- if (NOT TARGET Libuv::Libuv) -- add_library(Libuv::Libuv UNKNOWN IMPORTED) -- set_target_properties(Libuv::Libuv PROPERTIES -- INTERFACE_INCLUDE_DIRECTORIES "${LIBUV_INCLUDE_DIR}" -- IMPORTED_LINK_INTERFACE_LANGUAGES "C" -- IMPORTED_LOCATION "${LIBUV_LIBRARY}" -- ) -- endif () -+include(FindPkgConfig) -+if(PKG_CONFIG_FOUND) -+ pkg_check_modules(PkgLibuv IMPORTED_TARGET GLOBAL QUIET libuv) -+endif() - -- if (NOT LIBUV_VERSION AND LIBUV_INCLUDE_DIR) -- if (EXISTS "${LIBUV_INCLUDE_DIR}/uv-version.h") -- file(STRINGS "${LIBUV_INCLUDE_DIR}/uv-version.h" LIBUV_VER_H REGEX "^#define UV_VERSION_(MAJOR|MINOR|PATCH) ") -- elseif (EXISTS "${LIBUV_INCLUDE_DIR}/uv/version.h") -- file(STRINGS "${LIBUV_INCLUDE_DIR}/uv/version.h" LIBUV_VER_H REGEX "^#define UV_VERSION_(MAJOR|MINOR|PATCH) ") -+if(PkgLibuv_FOUND) -+ set(LIBUV_INCLUDE_DIR ${PkgLibuv_INCLUDE_DIRS}) -+ set(LIBUV_LIBRARIES ${PkgLibuv_LIBRARIES}) -+ set(LIBUV_VERSION ${PkgLibuv_VERSION}) -+ add_library(Libuv::Libuv ALIAS PkgConfig::PkgLibuv) -+else() -+ find_path(LIBUV_INCLUDE_DIR uv.h -+ HINTS -+ "${LIBUV_DIR}" -+ "${LIBUV_DIR}/include" -+ ) -+ -+ find_library(LIBUV_LIBRARY NAMES uv libuv -+ HINTS -+ "${LIBUV_DIR}" -+ "${LIBUV_DIR}/lib" -+ ) -+ -+ set(LIBUV_LIBRARIES "") -+ -+ if (LIBUV_INCLUDE_DIR AND LIBUV_LIBRARY) -+ if (NOT TARGET Libuv::Libuv) -+ add_library(Libuv::Libuv UNKNOWN IMPORTED) -+ set_target_properties(Libuv::Libuv PROPERTIES -+ INTERFACE_INCLUDE_DIRECTORIES "${LIBUV_INCLUDE_DIR}" -+ IMPORTED_LINK_INTERFACE_LANGUAGES "C" -+ IMPORTED_LOCATION "${LIBUV_LIBRARY}" -+ ) - endif () -- string(REGEX REPLACE "^.*_MAJOR ([0-9]+).*_MINOR ([0-9]+).*_PATCH ([0-9]+).*$" "\\1.\\2.\\3" LIBUV_VERSION "${LIBUV_VER_H}") -- endif () -+ -+ if (NOT LIBUV_VERSION AND LIBUV_INCLUDE_DIR) -+ if (EXISTS "${LIBUV_INCLUDE_DIR}/uv-version.h") -+ file(STRINGS "${LIBUV_INCLUDE_DIR}/uv-version.h" LIBUV_VER_H REGEX "^#define UV_VERSION_(MAJOR|MINOR|PATCH) ") -+ elseif (EXISTS "${LIBUV_INCLUDE_DIR}/uv/version.h") -+ file(STRINGS "${LIBUV_INCLUDE_DIR}/uv/version.h" LIBUV_VER_H REGEX "^#define UV_VERSION_(MAJOR|MINOR|PATCH) ") -+ endif () -+ string(REGEX REPLACE "^.*_MAJOR ([0-9]+).*_MINOR ([0-9]+).*_PATCH ([0-9]+).*$" "\\1.\\2.\\3" LIBUV_VERSION "${LIBUV_VER_H}") -+ endif () -+ endif() -+ -+ list(APPEND LIBUV_LIBRARIES "${LIBUV_LIBRARY}") - endif() - --list(APPEND LIBUV_LIBRARIES "${LIBUV_LIBRARY}") -- - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(Libuv - REQUIRED_VARS LIBUV_LIBRARIES LIBUV_INCLUDE_DIR ---- cmake/modules/FindNettle.cmake -+++ cmake/modules/FindNettle.cmake -@@ -30,62 +30,76 @@ - - #]=======================================================================] - --find_path(NETTLE_INCLUDE_DIR nettle/version.h -- HINTS -- "${NETTLE_DIR}" -- "${NETTLE_DIR}/include" --) -- --find_library(NETTLE_LIBRARY NAMES nettle libnettle -- HINTS -- "${NETTLE_DIR}" -- "${NETTLE_DIR}/lib" --) -- --find_library(HOGWEED_LIBRARY NAMES hogweed libhogweed -- HINTS -- "${NETTLE_DIR}" -- "${NETTLE_DIR}/lib" --) -- --set(NETTLE_LIBRARIES "") -- --# May need gmp library on Unix. --if (UNIX) -- find_library(NETTLE_GMP_LIBRARY gmp) -- -- if (NETTLE_GMP_LIBRARY) -- list(APPEND NETTLE_LIBRARIES "${NETTLE_GMP_LIBRARY}") -- endif () --endif () -- --if (NETTLE_INCLUDE_DIR AND NETTLE_LIBRARY AND HOGWEED_LIBRARY) -- if (NOT TARGET Nettle::Nettle) -- add_library(Nettle::Nettle UNKNOWN IMPORTED) -- set_target_properties(Nettle::Nettle PROPERTIES -- INTERFACE_INCLUDE_DIRECTORIES "${NETTLE_INCLUDE_DIR}" -- INTERFACE_LINK_LIBRARIES "${NETTLE_LIBRARIES}" -- IMPORTED_LINK_INTERFACE_LANGUAGES "C" -- IMPORTED_LOCATION "${NETTLE_LIBRARY}" -- ) -- endif () -- if (NOT TARGET Nettle::Hogweed) -- add_library(Nettle::Hogweed UNKNOWN IMPORTED) -- set_target_properties(Nettle::Hogweed PROPERTIES -- INTERFACE_INCLUDE_DIRECTORIES "${NETTLE_INCLUDE_DIR}" -- IMPORTED_LINK_INTERFACE_LANGUAGES "C" -- IMPORTED_LOCATION "${HOGWEED_LIBRARY}" -- ) -- endif () -+include(FindPkgConfig) -+if(PKG_CONFIG_FOUND) -+ pkg_check_modules(PkgNettle IMPORTED_TARGET GLOBAL nettle) -+ pkg_check_modules(PkgHogweed IMPORTED_TARGET GLOBAL QUIET hogweed) -+endif() - -- if (NOT NETTLE_VERSION AND NETTLE_INCLUDE_DIR) -- file(STRINGS "${NETTLE_INCLUDE_DIR}/nettle/version.h" NETTLE_VER_H REGEX "^#define NETTLE_VERSION_(MAJOR|MINOR) ") -- string(REGEX REPLACE "^.*_MAJOR ([0-9]+).*_MINOR ([0-9]+).*$" "\\1.\\2" NETTLE_VERSION "${NETTLE_VER_H}") -+if(PkgNettle_FOUND AND PkHogweed_FOUND) -+ set(NETTLE_INCLUDE_DIR ${PkgNettle_INCLUDE_DIRS} ${PkgHogweed_INCLUDE_DIRS}) -+ set(NETTLE_LIBRARIES ${PkgNettle_LIBRARIES} ${PkgHogweed_LIBRARIES}) -+ set(NETTLE_VERSION ${PkgNettle_VERSION}) -+ add_library(Nettle::Nettle ALIAS PkgConfig::PkgNettle) -+ add_library(Nettle::Hogweed ALIAS PkgConfig::PkgHogweed) -+else() -+ find_path(NETTLE_INCLUDE_DIR nettle/version.h -+ HINTS -+ "${NETTLE_DIR}" -+ "${NETTLE_DIR}/include" -+ ) -+ -+ find_library(NETTLE_LIBRARY NAMES nettle libnettle -+ HINTS -+ "${NETTLE_DIR}" -+ "${NETTLE_DIR}/lib" -+ ) -+ -+ find_library(HOGWEED_LIBRARY NAMES hogweed libhogweed -+ HINTS -+ "${NETTLE_DIR}" -+ "${NETTLE_DIR}/lib" -+ ) -+ -+ set(NETTLE_LIBRARIES "") -+ -+ # May need gmp library on Unix. -+ if (UNIX) -+ find_library(NETTLE_GMP_LIBRARY gmp) -+ -+ if (NETTLE_GMP_LIBRARY) -+ list(APPEND NETTLE_LIBRARIES "${NETTLE_GMP_LIBRARY}") -+ endif () - endif () -+ -+ if (NETTLE_INCLUDE_DIR AND NETTLE_LIBRARY AND HOGWEED_LIBRARY) -+ if (NOT TARGET Nettle::Nettle) -+ add_library(Nettle::Nettle UNKNOWN IMPORTED) -+ set_target_properties(Nettle::Nettle PROPERTIES -+ INTERFACE_INCLUDE_DIRECTORIES "${NETTLE_INCLUDE_DIR}" -+ INTERFACE_LINK_LIBRARIES "${NETTLE_LIBRARIES}" -+ IMPORTED_LINK_INTERFACE_LANGUAGES "C" -+ IMPORTED_LOCATION "${NETTLE_LIBRARY}" -+ ) -+ endif () -+ if (NOT TARGET Nettle::Hogweed) -+ add_library(Nettle::Hogweed UNKNOWN IMPORTED) -+ set_target_properties(Nettle::Hogweed PROPERTIES -+ INTERFACE_INCLUDE_DIRECTORIES "${NETTLE_INCLUDE_DIR}" -+ IMPORTED_LINK_INTERFACE_LANGUAGES "C" -+ IMPORTED_LOCATION "${HOGWEED_LIBRARY}" -+ ) -+ endif () -+ -+ if (NOT NETTLE_VERSION AND NETTLE_INCLUDE_DIR) -+ file(STRINGS "${NETTLE_INCLUDE_DIR}/nettle/version.h" NETTLE_VER_H REGEX "^#define NETTLE_VERSION_(MAJOR|MINOR) ") -+ string(REGEX REPLACE "^.*_MAJOR ([0-9]+).*_MINOR ([0-9]+).*$" "\\1.\\2" NETTLE_VERSION "${NETTLE_VER_H}") -+ endif () -+ endif() -+ -+ list(APPEND NETTLE_LIBRARIES "${NETTLE_LIBRARY}" "${HOGWEED_LIBRARY}") - endif() - --list(APPEND NETTLE_LIBRARIES "${NETTLE_LIBRARY}" "${HOGWEED_LIBRARY}") -- - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(Nettle - REQUIRED_VARS NETTLE_LIBRARIES NETTLE_INCLUDE_DIR diff --git a/recipes/getdns/all/patches/1.6.0-0004-dont-install-symlinked-license.patch b/recipes/getdns/all/patches/1.6.0-0004-dont-install-symlinked-license.patch deleted file mode 100644 index fadb8d2d20e5f..0000000000000 --- a/recipes/getdns/all/patches/1.6.0-0004-dont-install-symlinked-license.patch +++ /dev/null @@ -1,16 +0,0 @@ -Avoids weird issue on c3i Windows builders: - - CMake Error at source_subfolder/cmake_install.cmake:104 (file): - file INSTALL cannot read symlink - "C:/J/w/cci_PR-2903@2/.conan/data/getdns/1.6.0/_/_/build/dd6d0e14f162a68e24ee52fee674d130eac57dea/source_subfolder/COPYING" - to duplicate at - "C:/J/w/cci_PR-2903@2/.conan/data/getdns/1.6.0/_/_/package/dd6d0e14f162a68e24ee52fee674d130eac57dea/share/doc/getdns/COPYING": - File exists. - Call Stack (most recent call first): - - ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -1080,1 +1080,1 @@ --install(FILES AUTHORS ChangeLog COPYING LICENSE NEWS README.md DESTINATION ${docdir}) -+install(FILES AUTHORS ChangeLog NEWS README.md DESTINATION ${docdir}) diff --git a/recipes/getdns/all/patches/1.7.3-fix-windows-build.patch b/recipes/getdns/all/patches/1.7.3-fix-windows-build.patch new file mode 100644 index 0000000000000..dc0f91e105f96 --- /dev/null +++ b/recipes/getdns/all/patches/1.7.3-fix-windows-build.patch @@ -0,0 +1,121 @@ +From bfd53d3cc3afbf199fa27f74bf4b35c1ad955c2e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rados=C5=82aw=20Szkodzi=C5=84ski?= +Date: Tue, 3 Jan 2023 14:14:07 +0100 +Subject: [PATCH] Fix Windows build + +Fixes all found instances of missing APIs and headers on Windows. +--- + src/anchor.c | 12 ++++++++++++ + src/compat/mkstemp.c | 6 +++--- + src/gldns/parse.c | 2 +- + src/gldns/parseutil.c | 2 ++ + src/stub.c | 5 +++++ + 5 files changed, 23 insertions(+), 4 deletions(-) + +diff --git a/src/anchor.c b/src/anchor.c +index f50c4a3d1..fc357b649 100644 +--- a/src/anchor.c ++++ b/src/anchor.c +@@ -551,7 +551,11 @@ static void tas_rinse(getdns_context *context, tas_connection *a) + GETDNS_CLEAR_EVENT(a->loop, &a->event); + a->event.ev = NULL; + if (a->fd >= 0) ++#ifdef USE_WINSOCK ++ closesocket(a->fd); ++#else + close(a->fd); ++#endif + a->fd = -1; + if (a->xml.data) + GETDNS_FREE(context->mf, a->xml.data); +@@ -662,7 +666,11 @@ static void tas_reconnect_cb(void *userarg) + , "Waiting for second document timeout. Reconnecting...\n"); + + GETDNS_CLEAR_EVENT(a->loop, &a->event); ++#ifdef USE_WINSOCK ++ closesocket(a->fd); ++#else + close(a->fd); ++#endif + a->fd = -1; + if (a->state == TAS_READ_PS7_HDR) { + a->state = TAS_RETRY; +@@ -778,7 +786,11 @@ static void tas_read_cb(void *userarg) + if (n == 0) { + DEBUG_ANCHOR("Connection closed\n"); + GETDNS_CLEAR_EVENT(a->loop, &a->event); ++#ifdef USE_WINSOCK ++ closesocket(a->fd); ++#else + close(a->fd); ++#endif + a->fd = -1; + if (a->state == TAS_READ_PS7_HDR) { + a->state = TAS_RETRY; +diff --git a/src/compat/mkstemp.c b/src/compat/mkstemp.c +index 49d3e919a..86d1dfd67 100644 +--- a/src/compat/mkstemp.c ++++ b/src/compat/mkstemp.c +@@ -30,14 +30,14 @@ + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +-#include +-#include + #include ++#include + #include ++#include + + int mkstemp(char *template) + { + if (_mktemp_s(template, strlen(template) + 1) != 0) + return -1; +- return open(template, _O_CREAT | _O_EXCL | _O_RDWR, _S_IWRITE | _S_IREAD); ++ return _open(template, _O_CREAT | _O_EXCL | _O_RDWR, _S_IWRITE | _S_IREAD); + } +diff --git a/src/gldns/parse.c b/src/gldns/parse.c +index 367fa80f3..c107c0df9 100644 +--- a/src/gldns/parse.c ++++ b/src/gldns/parse.c +@@ -13,7 +13,7 @@ + #include "gldns/gbuffer.h" + + #include +-#include ++#include + + gldns_lookup_table gldns_directive_types[] = { + { GLDNS_DIR_TTL, "$TTL" }, +diff --git a/src/gldns/parseutil.c b/src/gldns/parseutil.c +index 293496a90..1e4367898 100644 +--- a/src/gldns/parseutil.c ++++ b/src/gldns/parseutil.c +@@ -14,7 +14,9 @@ + + #include "config.h" + #include "gldns/parseutil.h" ++#ifdef HAVE_SYS_TIME_H + #include ++#endif + #include + #include + +diff --git a/src/stub.c b/src/stub.c +index ee3193126..ab393885d 100644 +--- a/src/stub.c ++++ b/src/stub.c +@@ -903,8 +903,13 @@ stub_tcp_write(int fd, getdns_tcp_state *tcp, getdns_network_req *netreq) + just fall back to a 'normal' write. */ + if (written == -1 + && _getdns_socketerror() == _getdns_EISCONN) ++#ifdef USE_WINSOCK ++ written = send(fd, (const char *)(netreq->query - 2) ++ , pkt_len + 2, 0); ++#else + written = write(fd, netreq->query - 2 + , pkt_len + 2); ++#endif + } else + written = send(fd, (const char *)(netreq->query - 2) + , pkt_len + 2, 0); diff --git a/recipes/getdns/all/test_package/CMakeLists.txt b/recipes/getdns/all/test_package/CMakeLists.txt index 3a403dc404b41..e78d760c7b17a 100644 --- a/recipes/getdns/all/test_package/CMakeLists.txt +++ b/recipes/getdns/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ -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() +find_package(getdns REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE getdns::getdns) diff --git a/recipes/getdns/all/test_package/conanfile.py b/recipes/getdns/all/test_package/conanfile.py index bd7165a553cf4..ef5d7042163ec 100644 --- a/recipes/getdns/all/test_package/conanfile.py +++ b/recipes/getdns/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/getdns/all/test_package/test_package.c b/recipes/getdns/all/test_package/test_package.c index c55c14f559026..b60140d92b44b 100644 --- a/recipes/getdns/all/test_package/test_package.c +++ b/recipes/getdns/all/test_package/test_package.c @@ -1,26 +1,10 @@ #include "getdns.h" -#include #include -#define CHECK(V) if ((V) != GETDNS_RETURN_GOOD) { \ - fprintf(stderr, "Fail: " #V "!\n"); \ - return 1; \ -} - -int main() -{ - getdns_context *context; - CHECK(getdns_context_create(&context, 1)); - getdns_dict *info = getdns_context_get_api_information(context); - if (info == NULL) { - fprintf(stderr, "Could not get api information\n"); - return 1; - } - char *txt = getdns_pretty_print_dict(info); - printf("%s\n", txt); - free(txt); - getdns_dict_destroy(info); +int main() { + getdns_context *context = NULL; + getdns_context_create(&context, 0); getdns_context_destroy(context); - return 0; + return EXIT_SUCCESS; } diff --git a/recipes/getdns/all/test_v1_package/CMakeLists.txt b/recipes/getdns/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/getdns/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/getdns/all/test_v1_package/conanfile.py b/recipes/getdns/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..7e2dfe859bb27 --- /dev/null +++ b/recipes/getdns/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/getdns/config.yml b/recipes/getdns/config.yml index 10acb3ad5b1e8..e14fae48c780f 100644 --- a/recipes/getdns/config.yml +++ b/recipes/getdns/config.yml @@ -1,3 +1,3 @@ versions: - "1.6.0": + "1.7.3": folder: "all" diff --git a/recipes/getopt-for-visual-studio/all/conanfile.py b/recipes/getopt-for-visual-studio/all/conanfile.py index 79b25ed563631..23ca37727bf10 100644 --- a/recipes/getopt-for-visual-studio/all/conanfile.py +++ b/recipes/getopt-for-visual-studio/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, load, save +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, load, save from conan.tools.layout import basic_layout from conan.tools.microsoft import is_msvc import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.52.0" class GetoptForVisualStudioConan(ConanFile): @@ -15,11 +15,14 @@ class GetoptForVisualStudioConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/skandhurkat/Getopt-for-Visual-Studio" license = "MIT", "BSD-2-Clause" + package_type = "header-library" 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) + export_conandata_patches(self) + + def layout(self): + basic_layout(self, src_folder="src") def package_id(self): self.info.clear() @@ -28,12 +31,8 @@ def validate(self): if not is_msvc(self): raise ConanInvalidConfiguration("getopt-for-visual-studio is only supported for Visual Studio") - 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): apply_conandata_patches(self) @@ -50,4 +49,3 @@ def package(self): def package_info(self): self.cpp_info.bindirs = [] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] diff --git a/recipes/getopt-for-visual-studio/all/test_package/CMakeLists.txt b/recipes/getopt-for-visual-studio/all/test_package/CMakeLists.txt index 9a45d31295100..1f997dfbcef54 100644 --- a/recipes/getopt-for-visual-studio/all/test_package/CMakeLists.txt +++ b/recipes/getopt-for-visual-studio/all/test_package/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.0) +cmake_minimum_required(VERSION 3.1) project(test_package LANGUAGES C) find_package(getopt-for-visual-studio) diff --git a/recipes/getopt-for-visual-studio/all/test_package/conanfile.py b/recipes/getopt-for-visual-studio/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/getopt-for-visual-studio/all/test_package/conanfile.py +++ b/recipes/getopt-for-visual-studio/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/getopt-for-visual-studio/all/test_v1_package/CMakeLists.txt b/recipes/getopt-for-visual-studio/all/test_v1_package/CMakeLists.txt index 2e0409f1c8ebf..0d20897301b68 100644 --- a/recipes/getopt-for-visual-studio/all/test_v1_package/CMakeLists.txt +++ b/recipes/getopt-for-visual-studio/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ -cmake_minimum_required(VERSION 3.0) -project(test_package LANGUAGES C) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(getopt-for-visual-studio) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE getopt-for-visual-studio::getopt-for-visual-studio) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/gettext/all/conandata.yml b/recipes/gettext/all/conandata.yml index 1c02d8978221d..cc749fa1165fe 100644 --- a/recipes/gettext/all/conandata.yml +++ b/recipes/gettext/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.22.5": + url: "https://ftp.gnu.org/pub/gnu/gettext/gettext-0.22.5.tar.gz" + sha256: "ec1705b1e969b83a9f073144ec806151db88127f5e40fe5a94cb6c8fa48996a0" "0.21": url: "https://ftp.gnu.org/pub/gnu/gettext/gettext-0.21.tar.gz" sha256: "c77d0da3102aec9c07f43671e60611ebff89a996ef159497ce8e59d075786b12" @@ -6,13 +9,27 @@ sources: url: "https://ftp.gnu.org/pub/gnu/gettext/gettext-0.20.1.tar.gz" sha256: "66415634c6e8c3fa8b71362879ec7575e27da43da562c798a8a2f223e6e47f5c" patches: + "0.22.5": + - patch_file: "patches/0004-autopoint-relocatable.patch" + patch_description: "relocatable autopoint with resources relative to script" + patch_type: "conan" + - patch_file: "patches/0.22.5-0001-fix-macos-crossbuild.patch" + patch_description: "fix ability to crossbuild on macos and assume macOS newer than 10.4" + patch_type: "conan" "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" + - patch_file: "patches/0.21-clang-16-noreturn-attribute-warning.patch" + patch_description: "apply the __atribute_noreturn__ to print_and_abort" + patch_source: "https://github.com/coreutils/gnulib/commit/0cc39712803ade7b2d4b89c36b143dad72404063" + patch_type: "conan" + - patch_file: "patches/0.21-include-stdlib_h.patch" + patch_description: "include stdlib.h for newer gcc" + patch_type: "portability" "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..03a7b60fc24c2 100644 --- a/recipes/gettext/all/conanfile.py +++ b/recipes/gettext/all/conanfile.py @@ -1,93 +1,74 @@ -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.layout import basic_layout +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 layout(self): + basic_layout(self, src_folder="src") 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: - self.build_requires("automake/1.16.5") + def package_id(self): + del self.info.settings.compiler 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 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") + + if self.version >= Version("0.22") or 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) - - @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], 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 +79,82 @@ 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 + + # prevent redefining compiler instrinsic functions + tc.configure_args.extend([ + 'ac_cv_func_memmove=yes', + 'ac_cv_func_memset=yes' + ]) + + # Skip checking for the 'n' printf format directly + # in msvc, as it is known to not be available due to security concerns. + # Skipping it avoids a GUI prompt during ./configure for a debug build + # See https://github.com/conan-io/conan-center-index/issues/23698] + if self.settings.build_type == "Debug": + tc.configure_args.extend(['gl_cv_func_printf_directive_n=no']) + + # 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 = [] - 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) - - 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 + 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) - self.env_info.GETTEXT_ROOT_UNIX = tools.unix_path(self.package_folder) + # TODO: the following can be removed when the recipe supports Conan >= 2.0 only + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) + self.env_info.AUTOMAKE_CONAN_INCLUDES.append(unix_path_package_info_legacy(self, aclocal)) + self.env_info.AUTOPOINT = unix_path_package_info_legacy(self, autopoint) diff --git a/recipes/gettext/all/patches/0.21-clang-16-noreturn-attribute-warning.patch b/recipes/gettext/all/patches/0.21-clang-16-noreturn-attribute-warning.patch new file mode 100644 index 0000000000000..59ee5067e98dd --- /dev/null +++ b/recipes/gettext/all/patches/0.21-clang-16-noreturn-attribute-warning.patch @@ -0,0 +1,78 @@ +diff --git a/gettext-tools/gnulib-lib/obstack.c b/gettext-tools/gnulib-lib/obstack.c +index a6757b8..7d4439f 100644 +--- a/gettext-tools/gnulib-lib/obstack.c ++++ b/gettext-tools/gnulib-lib/obstack.c +@@ -326,7 +326,7 @@ int obstack_exit_failure = EXIT_FAILURE; + # include + # endif + +-static _Noreturn void ++static __attribute_noreturn__ void + print_and_abort (void) + { + /* Don't change any of these strings. Yes, it would be possible to add +diff --git a/gettext-tools/gnulib-lib/obstack.h b/gettext-tools/gnulib-lib/obstack.h +index cb59627..e0494a1 100644 +--- a/gettext-tools/gnulib-lib/obstack.h ++++ b/gettext-tools/gnulib-lib/obstack.h +@@ -153,7 +153,7 @@ + + /* Not the same as _Noreturn, since it also works with function pointers. */ + #ifndef __attribute_noreturn__ +-# if 2 < __GNUC__ + (8 <= __GNUC_MINOR__) || 0x5110 <= __SUNPRO_C ++# if 2 < __GNUC__ + (8 <= __GNUC_MINOR__) || defined __clang__ || 0x5110 <= __SUNPRO_C + # define __attribute_noreturn__ __attribute__ ((__noreturn__)) + # else + # define __attribute_noreturn__ +diff --git a/gettext-tools/libgettextpo/obstack.c b/gettext-tools/libgettextpo/obstack.c +index a6757b8..7d4439f 100644 +--- a/gettext-tools/libgettextpo/obstack.c ++++ b/gettext-tools/libgettextpo/obstack.c +@@ -326,7 +326,7 @@ int obstack_exit_failure = EXIT_FAILURE; + # include + # endif + +-static _Noreturn void ++static __attribute_noreturn__ void + print_and_abort (void) + { + /* Don't change any of these strings. Yes, it would be possible to add +diff --git a/gettext-tools/libgettextpo/obstack.h b/gettext-tools/libgettextpo/obstack.h +index cb59627..e0494a1 100644 +--- a/gettext-tools/libgettextpo/obstack.h ++++ b/gettext-tools/libgettextpo/obstack.h +@@ -153,7 +153,7 @@ + + /* Not the same as _Noreturn, since it also works with function pointers. */ + #ifndef __attribute_noreturn__ +-# if 2 < __GNUC__ + (8 <= __GNUC_MINOR__) || 0x5110 <= __SUNPRO_C ++# if 2 < __GNUC__ + (8 <= __GNUC_MINOR__) || defined __clang__ || 0x5110 <= __SUNPRO_C + # define __attribute_noreturn__ __attribute__ ((__noreturn__)) + # else + # define __attribute_noreturn__ +diff --git a/libtextstyle/lib/obstack.c b/libtextstyle/lib/obstack.c +index a6757b8..7d4439f 100644 +--- a/libtextstyle/lib/obstack.c ++++ b/libtextstyle/lib/obstack.c +@@ -326,7 +326,7 @@ int obstack_exit_failure = EXIT_FAILURE; + # include + # endif + +-static _Noreturn void ++static __attribute_noreturn__ void + print_and_abort (void) + { + /* Don't change any of these strings. Yes, it would be possible to add +diff --git a/libtextstyle/lib/obstack.h b/libtextstyle/lib/obstack.h +index cb59627..e0494a1 100644 +--- a/libtextstyle/lib/obstack.h ++++ b/libtextstyle/lib/obstack.h +@@ -153,7 +153,7 @@ + + /* Not the same as _Noreturn, since it also works with function pointers. */ + #ifndef __attribute_noreturn__ +-# if 2 < __GNUC__ + (8 <= __GNUC_MINOR__) || 0x5110 <= __SUNPRO_C ++# if 2 < __GNUC__ + (8 <= __GNUC_MINOR__) || defined __clang__ || 0x5110 <= __SUNPRO_C + # define __attribute_noreturn__ __attribute__ ((__noreturn__)) + # else + # define __attribute_noreturn__ diff --git a/recipes/gettext/all/patches/0.21-include-stdlib_h.patch b/recipes/gettext/all/patches/0.21-include-stdlib_h.patch new file mode 100644 index 0000000000000..721436bc3f295 --- /dev/null +++ b/recipes/gettext/all/patches/0.21-include-stdlib_h.patch @@ -0,0 +1,12 @@ +diff --git a/gettext-tools/src/locating-rule.c b/gettext-tools/src/locating-rule.c +index 15faee1..66ec48a 100644 +--- a/gettext-tools/src/locating-rule.c ++++ b/gettext-tools/src/locating-rule.c +@@ -47,6 +47,7 @@ + #include + #include + #include "xalloc.h" ++#include + + #define _(str) gettext (str) + diff --git a/recipes/gettext/all/patches/0.22.5-0001-fix-macos-crossbuild.patch b/recipes/gettext/all/patches/0.22.5-0001-fix-macos-crossbuild.patch new file mode 100644 index 0000000000000..9deceb328f646 --- /dev/null +++ b/recipes/gettext/all/patches/0.22.5-0001-fix-macos-crossbuild.patch @@ -0,0 +1,26 @@ +diff --git a/gettext-runtime/configure b/gettext-runtime/configure +index 75c8e6f..6e4df72 100755 +--- a/gettext-runtime/configure ++++ b/gettext-runtime/configure +@@ -36149,7 +36149,7 @@ fi + haiku*) use_elf_origin_trick=yes ;; + # On Mac OS X 10.4 or newer, use Mac OS X tools. See + # . +- darwin | darwin[1-7].*) ;; ++ darwin | darwin[1-7].*) use_macos_tools=yes ;; + darwin*) use_macos_tools=yes ;; + esac + if test $is_noop = yes; then +diff --git a/gettext-tools/configure b/gettext-tools/configure +index c62f256..f3a66ed 100755 +--- a/gettext-tools/configure ++++ b/gettext-tools/configure +@@ -49566,7 +49566,7 @@ fi + haiku*) use_elf_origin_trick=yes ;; + # On Mac OS X 10.4 or newer, use Mac OS X tools. See + # . +- darwin | darwin[1-7].*) ;; ++ darwin | darwin[1-7].*) use_macos_tools=yes ;; + darwin*) use_macos_tools=yes ;; + esac + if test $is_noop = yes; then diff --git a/recipes/gettext/all/patches/0002-memmove-is-intrinsic-function-on-MSVC.patch b/recipes/gettext/all/patches/0002-memmove-is-intrinsic-function-on-MSVC.patch deleted file mode 100644 index dbbf7b795a53e..0000000000000 --- a/recipes/gettext/all/patches/0002-memmove-is-intrinsic-function-on-MSVC.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 9b2e480278d36c4d7b6f988621a3a9f699cc730f Mon Sep 17 00:00:00 2001 -From: SSE4 -Date: Wed, 10 Jul 2019 03:55:56 -0700 -Subject: [PATCH 2/2] - memmove is intrinsic function on MSVC - -Signed-off-by: SSE4 ---- - gettext-runtime/gnulib-lib/memmove.c | 4 ++++ - gettext-tools/gnulib-lib/memmove.c | 4 ++++ - gettext-tools/gnulib-lib/memset.c | 4 ++++ - 3 files changed, 12 insertions(+) - -diff --git a/gettext-runtime/gnulib-lib/memmove.c b/gettext-runtime/gnulib-lib/memmove.c -index 0f040540c..bc8883ae4 100644 ---- a/gettext-runtime/gnulib-lib/memmove.c -+++ b/gettext-runtime/gnulib-lib/memmove.c -@@ -7,6 +7,8 @@ - - #include - -+#ifndef _MSC_VER -+ - void * - memmove (void *dest0, void const *source0, size_t length) - { -@@ -24,3 +26,5 @@ memmove (void *dest0, void const *source0, size_t length) - } - return dest0; - } -+ -+#endif -diff --git a/gettext-tools/gnulib-lib/memmove.c b/gettext-tools/gnulib-lib/memmove.c -index 0f040540c..bc8883ae4 100644 ---- a/gettext-tools/gnulib-lib/memmove.c -+++ b/gettext-tools/gnulib-lib/memmove.c -@@ -7,6 +7,8 @@ - - #include - -+#ifndef _MSC_VER -+ - void * - memmove (void *dest0, void const *source0, size_t length) - { -@@ -24,3 +26,5 @@ memmove (void *dest0, void const *source0, size_t length) - } - return dest0; - } -+ -+#endif -diff --git a/gettext-tools/gnulib-lib/memset.c b/gettext-tools/gnulib-lib/memset.c -index 4e60124e7..b595fa966 100644 ---- a/gettext-tools/gnulib-lib/memset.c -+++ b/gettext-tools/gnulib-lib/memset.c -@@ -18,6 +18,8 @@ - - #include - -+#ifndef _MSC_VER -+ - void * - memset (void *str, int c, size_t len) - { -@@ -27,3 +29,5 @@ memset (void *str, int c, size_t len) - *st++ = c; - return str; - } -+ -+#endif --- -2.21.0.windows.1 - 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..38cf5d5e86a20 100644 --- a/recipes/gettext/all/test_package/conanfile.py +++ b/recipes/gettext/all/test_package/conanfile.py @@ -1,51 +1,25 @@ -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 VirtualRunEnv +from conan.tools.layout import basic_layout + class TestPackageConan(ConanFile): - settings = "os", "arch", "compiler" - exports_sources = "configure.ac", + settings = "os", "arch", "compiler", "build_type" 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 layout(self): + basic_layout(self, src_folder="src") + + def generate(self): + runenv = VirtualRunEnv(self) + runenv.generate() 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_v1_package/conanfile.py b/recipes/gettext/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..d35f2c0d29fb4 --- /dev/null +++ b/recipes/gettext/all/test_v1_package/conanfile.py @@ -0,0 +1,52 @@ +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.5") + self.build_requires("xz_utils/5.4.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", + "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_package/configure.ac b/recipes/gettext/all/test_v1_package/configure.ac similarity index 100% rename from recipes/gettext/all/test_package/configure.ac rename to recipes/gettext/all/test_v1_package/configure.ac diff --git a/recipes/gettext/config.yml b/recipes/gettext/config.yml index dc03f51a1d462..00bba3996ff90 100644 --- a/recipes/gettext/config.yml +++ b/recipes/gettext/config.yml @@ -1,4 +1,6 @@ versions: + "0.22.5": + folder: all "0.21": folder: all "0.20.1": diff --git a/recipes/gf-complete/all/conandata.yml b/recipes/gf-complete/all/conandata.yml index 58f9543628ba7..8fe397e19e0a6 100644 --- a/recipes/gf-complete/all/conandata.yml +++ b/recipes/gf-complete/all/conandata.yml @@ -8,4 +8,3 @@ sources: patches: "cci.20170410": - patch_file: "patches/0001-fix-msvc-cci.20170410.patch" - base_path: "source_subfolder" diff --git a/recipes/gf-complete/all/conanfile.py b/recipes/gf-complete/all/conanfile.py index 0947d375fcf7d..1d8d0803dbf13 100644 --- a/recipes/gf-complete/all/conanfile.py +++ b/recipes/gf-complete/all/conanfile.py @@ -1,162 +1,198 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, 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.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, collect_libs +from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, unix_path + +required_conan_version = ">=1.53.0" class GfCompleteConan(ConanFile): name = "gf-complete" description = "A library for Galois Field arithmetic" + license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/ceph/gf-complete" - license = "BSD-3-Clause" topics = ("galois field", "math", "algorithms") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], "neon": [True, False, "auto"], "sse": [True, False, "auto"], - "avx": [True, False, "auto"] + "avx": [True, False, "auto"], } default_options = { "shared": False, "fPIC": True, "neon": "auto", "sse": "auto", - "avx": "auto" + "avx": "auto", } - 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) + 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 if self.settings.arch not in ["x86", "x86_64"]: - del self.options.sse - del self.options.avx + self.options.rm_safe("sse") + self.options.rm_safe("avx") if "arm" not in self.settings.arch: - del self.options.neon + self.options.rm_safe("neon") 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.settings.compiler == "Visual Studio": + if is_msvc(self): self.requires("getopt-for-visual-studio/20200201") def validate(self): - if self.settings.compiler == "Visual Studio": - if self.options.shared: - raise ConanInvalidConfiguration("gf-complete doesn't support shared with Visual Studio") + if is_msvc(self): if self.version == "1.03": raise ConanInvalidConfiguration("gf-complete 1.03 doesn't 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") + 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) def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) # Don't build tests and examples (and also tools if Visual Studio) to_build = ["src"] - if self.settings.compiler != "Visual Studio": + if not is_msvc(self): to_build.append("tools") - tools.replace_in_file(os.path.join(self._source_subfolder, "Makefile.am"), - "SUBDIRS = src tools test examples", - "SUBDIRS = {}".format(" ".join(to_build))) + replace_in_file( + self, + os.path.join(self.source_folder, "Makefile.am"), + "SUBDIRS = src tools test examples", + "SUBDIRS = {}".format(" ".join(to_build)), + ) # Honor build type settings and fPIC option for subdir in ["src", "tools"]: for flag in ["-O3", "-fPIC"]: - tools.replace_in_file(os.path.join(self._source_subfolder, subdir, "Makefile.am"), - flag, "") - - @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 self.settings.compiler == "Visual Studio": - self._autotools.flags.append("-FS") - elif "x86" in self.settings.arch: - self._autotools.flags.append("-mstackrealign") - + replace_in_file(self, os.path.join(self.source_folder, subdir, "Makefile.am"), flag, "") + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") + + tc = AutotoolsToolchain(self) + if not is_msvc(self) and "x86" in self.settings.arch: + tc.extra_cxxflags.append("-mstackrealign") 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)), - ] - - if "arm" in self.settings.arch: + if "arm" in str(self.settings.arch): if self.options.neon != "auto": - conf_args.append("--enable-neon={}".format(yes_no(self.options.neon))) - + tc.configure_args.append("--enable-neon={}".format(yes_no(self.options.neon))) if self.settings.arch in ["x86", "x86_64"]: if self.options.sse != "auto": - conf_args.append("--enable-sse={}".format(yes_no(self.options.sse))) - + tc.configure_args.append("--enable-sse={}".format(yes_no(self.options.sse))) if self.options.avx != "auto": - conf_args.append("--enable-avx={}".format(yes_no(self.options.avx))) - - self._autotools.configure(args=conf_args, configure_dir=self._source_subfolder) - - return self._autotools + tc.configure_args.append("--enable-avx={}".format(yes_no(self.options.avx))) + if is_msvc(self): + if self.options.shared: + tc.extra_ldflags.append("-no-undefined") + tc.extra_ldflags.append("-Wl,--export-all-symbols") + tc.extra_cflags.append("-FS") + tc.extra_cxxflags.append("-FS") + tc.generate() + + if is_msvc(self): + env = Environment() + 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") + + 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 reversed(self.dependencies.host.topological_sort.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): self._patch_sources() - 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() + with chdir(self, self.source_folder): + 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() + copy(self, "COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + with chdir(self, self.source_folder): + autotools = Autotools(self) autotools.install() - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") + rm(self, "*.la", self.package_folder, recursive=True) + fix_apple_shared_install_name(self) def package_info(self): - self.cpp_info.libs = ["gf_complete"] + self.cpp_info.libs = collect_libs(self) - if self.settings.compiler != "Visual Studio": + if not is_msvc(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) diff --git a/recipes/gf-complete/all/test_package/CMakeLists.txt b/recipes/gf-complete/all/test_package/CMakeLists.txt index fd126a732c403..1e6c99d7b2ace 100644 --- a/recipes/gf-complete/all/test_package/CMakeLists.txt +++ b/recipes/gf-complete/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -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() +find_package(gf-complete REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE gf-complete::gf-complete) set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD 99) diff --git a/recipes/gf-complete/all/test_package/conanfile.py b/recipes/gf-complete/all/test_package/conanfile.py index 6bc1a2f31ef01..ef5d7042163ec 100644 --- a/recipes/gf-complete/all/test_package/conanfile.py +++ b/recipes/gf-complete/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, 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/gf-complete/all/test_v1_package/CMakeLists.txt b/recipes/gf-complete/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/gf-complete/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/gf-complete/all/test_v1_package/conanfile.py b/recipes/gf-complete/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..6d77c5add47fe --- /dev/null +++ b/recipes/gf-complete/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, skip_x64_x86=True): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) 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/conanfile.py b/recipes/gfortran/all/conanfile.py index 209997c47d1fa..2b4c0cbc0e73f 100644 --- a/recipes/gfortran/all/conanfile.py +++ b/recipes/gfortran/all/conanfile.py @@ -15,6 +15,8 @@ class GFortranConan(ConanFile): settings = "os", "arch", "compiler", "build_type" no_copy_source = True short_paths = True + + deprecated = "gcc" def validate(self): if self.settings.arch != "x86_64": @@ -24,7 +26,7 @@ def validate(self): def build_requirements(self): if self.settings.os == "Windows": - self.tool_requires("7zip/19.00") + self.tool_requires("7zip/22.01") def build(self): if self.settings.os == "Windows": diff --git a/recipes/gfortran/all/test_package/conanfile.py b/recipes/gfortran/all/test_package/conanfile.py index 9d3aaf213929b..e0f64282eb4bd 100644 --- a/recipes/gfortran/all/test_package/conanfile.py +++ b/recipes/gfortran/all/test_package/conanfile.py @@ -11,4 +11,4 @@ def build_requirements(self): def test(self): if can_run(self): - self.run("gfortran --version", env="conanrun") + self.run("gfortran --version") diff --git a/recipes/ghc-filesystem/all/conandata.yml b/recipes/ghc-filesystem/all/conandata.yml index 934a94aaf88eb..3090b1b69e602 100644 --- a/recipes/ghc-filesystem/all/conandata.yml +++ b/recipes/ghc-filesystem/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.5.14": + url: "https://github.com/gulrak/filesystem/archive/v1.5.14.tar.gz" + sha256: "e783f672e49de7c5a237a0cea905ed51012da55c04fbacab397161976efc8472" "1.5.12": url: "https://github.com/gulrak/filesystem/archive/v1.5.12.tar.gz" sha256: "7d62c5746c724d28da216d9e11827ba4e573df15ef40720292827a4dfd33f2e9" diff --git a/recipes/ghc-filesystem/all/conanfile.py b/recipes/ghc-filesystem/all/conanfile.py index e7b402102ac33..0f9f45315ad03 100644 --- a/recipes/ghc-filesystem/all/conanfile.py +++ b/recipes/ghc-filesystem/all/conanfile.py @@ -9,47 +9,46 @@ class GhcFilesystemRecipe(ConanFile): name = "ghc-filesystem" description = "A header-only single-file std::filesystem compatible helper library" - topics = ("ghc-filesystem", "header-only", "filesystem") + topics = ("header-only", "filesystem") homepage = "https://github.com/gulrak/filesystem" url = "https://github.com/conan-io/conan-center-index" license = "MIT" + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True def layout(self): - cmake_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) + get(self, **self.conan_data["sources"][self.version], 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 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.configure() cmake.install() rmdir(self, os.path.join(self.package_folder, "lib")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "ghc_filesystem") self.cpp_info.set_property("cmake_target_name", "ghcFilesystem::ghc_filesystem") - # TODO: back to global scope in conan v2 once cmake_find_package_* generators removed - self.cpp_info.components["ghc_filesystem"].bindirs = [] - self.cpp_info.components["ghc_filesystem"].frameworkdirs = [] - self.cpp_info.components["ghc_filesystem"].libdirs = [] - self.cpp_info.components["ghc_filesystem"].resdirs = [] + 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"] = "ghc_filesystem" @@ -59,3 +58,5 @@ def package_info(self): self.cpp_info.components["ghc_filesystem"].names["cmake_find_package"] = "ghc_filesystem" self.cpp_info.components["ghc_filesystem"].names["cmake_find_package_multi"] = "ghc_filesystem" self.cpp_info.components["ghc_filesystem"].set_property("cmake_target_name", "ghcFilesystem::ghc_filesystem") + self.cpp_info.components["ghc_filesystem"].bindirs = [] + self.cpp_info.components["ghc_filesystem"].libdirs = [] diff --git a/recipes/ghc-filesystem/config.yml b/recipes/ghc-filesystem/config.yml index a66760cf157ac..bff6eeb8992dd 100644 --- a/recipes/ghc-filesystem/config.yml +++ b/recipes/ghc-filesystem/config.yml @@ -1,4 +1,6 @@ versions: + "1.5.14": + folder: "all" "1.5.12": folder: "all" "1.5.8": diff --git a/recipes/giflib/5.1.x/conanfile.py b/recipes/giflib/5.1.x/conanfile.py index 9853dbf433ace..ea0071d4e3468 100644 --- a/recipes/giflib/5.1.x/conanfile.py +++ b/recipes/giflib/5.1.x/conanfile.py @@ -1,19 +1,27 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, tools -from conans.errors import ConanInvalidConfiguration import os import shutil -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 Environment, VirtualBuildEnv, VirtualRunEnv +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, unix_path + +required_conan_version = ">=1.53.0" class GiflibConan(ConanFile): name = "giflib" description = "A library and utilities for reading and writing GIF images." - url = "https://github.com/conan-io/conan-center-index" license = "MIT" + url = "https://github.com/conan-io/conan-center-index" homepage = "http://giflib.sourceforge.net" - topics = ("giflib", "image", "multimedia", "format", "graphics") + topics = ("image", "multimedia", "format", "graphics") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -24,25 +32,16 @@ class GiflibConan(ConanFile): "fPIC": True, } - # The exported files I took them from https://github.com/bjornblissing/osg-3rdparty-cmake/tree/master/giflib - # refactored a little - exports_sources = ["unistd.h", "gif_lib.h"] - - @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): + # The exported files I took them from + # https://github.com/bjornblissing/osg-3rdparty-cmake/tree/master/giflib + # refactored a little + copy(self, "unistd.h", src=self.recipe_folder, dst=self.export_sources_folder) + copy(self, "gif_lib.h", src=self.recipe_folder, dst=self.export_sources_folder) def config_options(self): if self.settings.os == "Windows": @@ -50,110 +49,100 @@ 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 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") + 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) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") + tc = AutotoolsToolchain(self) + if is_msvc(self): + tc.extra_defines.append("USE_GIF_DLL" if self.options.shared else "USE_GIF_LIB") + tc.extra_cflags.append("-FS") + tc.generate() + + if is_msvc(self): + env = Environment() + automake_conf = self.dependencies.build["automake"].conf_info + compile_wrapper = unix_path(self, automake_conf.get("user.automake:compile-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") + # ar-lib wrapper is added by ./configure automatically + # 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 _patch_sources(self): + # disable util build - tools and internal libs + replace_in_file(self, os.path.join(self.source_folder, "Makefile.in"), + "SUBDIRS = lib util pic $(am__append_1)", + "SUBDIRS = lib pic $(am__append_1)") + + if is_msvc(self): + # add unistd.h for VS + shutil.copy(os.path.join(self.export_sources_folder, "unistd.h"), + os.path.join(self.source_folder, "lib")) + # fully replace gif_lib.h for VS, with patched version + ver_components = self.version.split(".") + header_path = os.path.join(self.source_folder, "lib", "gif_lib.h") + shutil.copy(os.path.join(self.export_sources_folder, "gif_lib.h"), header_path) + replace_in_file(self, header_path, "@GIFLIB_MAJOR@", ver_components[0]) + replace_in_file(self, header_path, "@GIFLIB_MINOR@", ver_components[1]) + replace_in_file(self, header_path, "@GIFLIB_RELEASE@", ver_components[2]) + 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) + if is_apple_os(self): + # relocatable shared lib on macOS + replace_in_file(self, os.path.join(self.source_folder, "configure"), + "-install_name \\$rpath/\\$soname", + "-install_name \\@rpath/\\$soname") def build(self): - # disable util build - tools and internal libs - tools.replace_in_file(os.path.join(self._source_subfolder, "Makefile.in"), - "SUBDIRS = lib util pic $(am__append_1)", - "SUBDIRS = lib pic $(am__append_1)") - - if self._is_msvc: - self.build_visual() - else: - self.build_configure() - - def build_visual(self): - # fully replace gif_lib.h for VS, with patched version - ver_components = self.version.split(".") - tools.replace_in_file("gif_lib.h", "@GIFLIB_MAJOR@", ver_components[0]) - tools.replace_in_file("gif_lib.h", "@GIFLIB_MINOR@", ver_components[1]) - tools.replace_in_file("gif_lib.h", "@GIFLIB_RELEASE@", ver_components[2]) - shutil.copy("gif_lib.h", os.path.join(self._source_subfolder, "lib")) - # add unistd.h for VS - shutil.copy("unistd.h", os.path.join(self._source_subfolder, "lib")) - - with tools.chdir(self._source_subfolder): - if self.settings.arch == "x86": - host = "i686-w64-mingw32" - elif self.settings.arch == "x86_64": - host = "x86_64-w64-mingw32" - else: - raise ConanInvalidConfiguration("unsupported architecture %s" % self.settings.arch) - if self.options.shared: - options = "--disable-static --enable-shared" - else: - options = "--enable-static --disable-shared" - - cflags = "" - if not self.options.shared: - cflags = "-DUSE_GIF_LIB" - - prefix = tools.unix_path(os.path.abspath(self.package_folder)) - with tools.vcvars(self.settings): - command = "./configure " \ - "{options} " \ - "--host={host} " \ - "--prefix={prefix} " \ - 'CC="$PWD/compile cl -nologo" ' \ - 'CFLAGS="-{runtime} {cflags}" ' \ - 'CXX="$PWD/compile cl -nologo" ' \ - 'CXXFLAGS="-{runtime} {cflags}" ' \ - 'CPPFLAGS="-I{prefix}/include" ' \ - 'LDFLAGS="-L{prefix}/lib" ' \ - 'LD="link" ' \ - 'NM="dumpbin -symbols" ' \ - 'STRIP=":" ' \ - 'AR="$PWD/ar-lib lib" ' \ - 'RANLIB=":" '.format(host=host, prefix=prefix, options=options, - runtime=self.settings.compiler.runtime, cflags=cflags) - self.run(command, win_bash=True) - self.run("make", win_bash=True) - self.run("make install", win_bash=True) - - def build_configure(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")) - env_build = 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)), - ] - with tools.chdir(self._source_subfolder): - if tools.is_apple_os(self.settings.os): - # relocatable shared lib on macOS - tools.replace_in_file( - "configure", - "-install_name \\$rpath/\\$soname", - "-install_name \\@rpath/\\$soname" - ) - - self.run("chmod +x configure") - env_build.configure(args=args) - env_build.make() - env_build.make(args=["install"]) + self._patch_sources() + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.configure() + autotools.make() def package(self): - self.copy(pattern="COPYING*", dst="licenses", src=self._source_subfolder, ignore_case=True, keep_path=False) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") - tools.rmdir(os.path.join(self.package_folder, "share")) - if self._is_msvc and self.options.shared: - tools.rename(os.path.join(self.package_folder, "lib", "gif.dll.lib"), + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.install() + copy(self, "COPYING*", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder, keep_path=False) + rm(self, "*.la", self.package_folder, recursive=True) + 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", "gif.dll.lib"), os.path.join(self.package_folder, "lib", "gif.lib")) def package_info(self): @@ -161,9 +150,10 @@ def package_info(self): 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 self._is_msvc: + if is_msvc(self): self.cpp_info.defines.append("USE_GIF_DLL" if self.options.shared else "USE_GIF_LIB") + + # TODO: to remove in conan v2 + self.cpp_info.names["cmake_find_package"] = "GIF" + self.cpp_info.names["cmake_find_package_multi"] = "GIF" diff --git a/recipes/giflib/5.1.x/test_package/CMakeLists.txt b/recipes/giflib/5.1.x/test_package/CMakeLists.txt index 95fca5bec20b2..b39dc8b19722d 100644 --- a/recipes/giflib/5.1.x/test_package/CMakeLists.txt +++ b/recipes/giflib/5.1.x/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ -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(GIF REQUIRED) +find_package(GIF REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) target_link_libraries(${PROJECT_NAME} GIF::GIF) diff --git a/recipes/giflib/5.1.x/test_package/conanfile.py b/recipes/giflib/5.1.x/test_package/conanfile.py index 9c22b9663e80c..77c3c08f8b8ed 100644 --- a/recipes/giflib/5.1.x/test_package/conanfile.py +++ b/recipes/giflib/5.1.x/test_package/conanfile.py @@ -1,19 +1,29 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.apple import is_apple_os +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 build_requirements(self): - if self.settings.os == "Macos" and self.settings.arch == "armv8": + if is_apple_os(self) 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") + self.tool_requires("cmake/[>=3.22]") + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -21,8 +31,7 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): + if can_run(self): img_name = os.path.join(self.source_folder, "testimg.gif") - bin_path = os.path.join("bin", "test_package") - command = "{} {}".format(bin_path, img_name) - self.run(command, run_environment=True) + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + self.run(f"{bin_path} {img_name}", env="conanrun") diff --git a/recipes/giflib/5.2.x/CMakeLists.txt b/recipes/giflib/5.2.x/CMakeLists.txt index 2d4e86b610d29..e676b16d18f06 100644 --- a/recipes/giflib/5.2.x/CMakeLists.txt +++ b/recipes/giflib/5.2.x/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(gif LANGUAGES C) include(GNUInstallDirs) diff --git a/recipes/giflib/5.2.x/conandata.yml b/recipes/giflib/5.2.x/conandata.yml index e36e2cd9d7be2..5833d90506e97 100644 --- a/recipes/giflib/5.2.x/conandata.yml +++ b/recipes/giflib/5.2.x/conandata.yml @@ -1,7 +1,25 @@ sources: + "5.2.2": + url: "https://downloads.sourceforge.net/project/giflib/giflib-5.2.2.tar.gz" + sha256: "be7ffbd057cadebe2aa144542fd90c6838c6a083b5e8a9048b8ee3b66b29d5fb" "5.2.1": url: "https://downloads.sourceforge.net/project/giflib/giflib-5.2.1.tar.gz" sha256: "31da5562f44c5f15d63340a09a4fd62b48c45620cd302f77a6d9acf0077879bd" patches: + "5.2.2": + - patch_file: "patches/0000-msvc-strtok_r.patch" + patch_description: "Use strtok_s instead of strtok_r with MSVC" + patch_type: "portability" + - patch_file: "patches/5.2.2-0001-msvc-export.patch" + patch_description: "export symbols with MSVC" + patch_type: "portability" "5.2.1": + - patch_file: "patches/0000-msvc-strtok_r.patch" + patch_description: "Use strtok_s instead of strtok_r with MSVC" + patch_type: "portability" - patch_file: "patches/0001-msvc-unistd.patch" + patch_description: "import unistd in non windows os" + patch_type: "portability" + - patch_file: "patches/5.2.1-0002-msvc-export.patch" + patch_description: "export symbols with MSVC" + patch_type: "portability" diff --git a/recipes/giflib/5.2.x/conanfile.py b/recipes/giflib/5.2.x/conanfile.py index a310e9327cab1..4a1ab9027e884 100644 --- a/recipes/giflib/5.2.x/conanfile.py +++ b/recipes/giflib/5.2.x/conanfile.py @@ -4,7 +4,7 @@ from conan.tools.microsoft import is_msvc import os -required_conan_version = ">=1.53.0" +required_conan_version = ">=2.0.9" class GiflibConan(ConanFile): @@ -14,7 +14,7 @@ class GiflibConan(ConanFile): license = "MIT" homepage = "http://giflib.sourceforge.net" topics = ("gif", "image", "multimedia", "format", "graphics") - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -49,8 +49,7 @@ def requirements(self): 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -80,8 +79,3 @@ def package_info(self): 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") - - # 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/patches/0000-msvc-strtok_r.patch b/recipes/giflib/5.2.x/patches/0000-msvc-strtok_r.patch new file mode 100644 index 0000000000000..e9b7a0f9661b8 --- /dev/null +++ b/recipes/giflib/5.2.x/patches/0000-msvc-strtok_r.patch @@ -0,0 +1,15 @@ +diff --git a/gif_font.c b/gif_font.c +index d90783c..0fd20ed 100644 +--- a/gif_font.c ++++ b/gif_font.c +@@ -11,6 +11,10 @@ SPDX-License-Identifier: MIT + + #include "gif_lib.h" + ++#ifdef _MSC_VER ++# define strtok_r strtok_s ++#endif ++ + /***************************************************************************** + Ascii 8 by 8 regular font - only first 128 characters are supported. + *****************************************************************************/ diff --git a/recipes/giflib/5.2.x/patches/0001-msvc-unistd.patch b/recipes/giflib/5.2.x/patches/0001-msvc-unistd.patch index 05112f7bfb6f7..1a777f5c69b47 100644 --- a/recipes/giflib/5.2.x/patches/0001-msvc-unistd.patch +++ b/recipes/giflib/5.2.x/patches/0001-msvc-unistd.patch @@ -1,18 +1,3 @@ -diff --git a/gif_font.c b/gif_font.c -index d90783c..0fd20ed 100644 ---- a/gif_font.c -+++ b/gif_font.c -@@ -11,6 +11,10 @@ SPDX-License-Identifier: MIT - - #include "gif_lib.h" - -+#ifdef _MSC_VER -+# define strtok_r strtok_s -+#endif -+ - /***************************************************************************** - Ascii 8 by 8 regular font - only first 128 characters are supported. - *****************************************************************************/ diff --git a/gif_hash.h b/gif_hash.h index 6a1b585..6311cd1 100644 --- a/gif_hash.h @@ -29,233 +14,3 @@ index 6a1b585..6311cd1 100644 #include #define HT_SIZE 8192 /* 12bits = 4096 or twice as big! */ -diff --git a/gif_lib.h b/gif_lib.h -index ebdbd3c..bf0d373 100644 ---- a/gif_lib.h -+++ b/gif_lib.h -@@ -13,6 +13,20 @@ SPDX-License-Identifier: MIT - extern "C" { - #endif /* __cplusplus */ - -+#ifdef _MSC_VER -+ #ifdef USE_GIF_LIB -+ #define GIF_EXPORT -+ #else /* USE_GIF_LIB */ -+ #ifdef USE_GIF_DLL -+ #define GIF_EXPORT __declspec(dllimport) -+ #else /* USE_GIF_DLL */ -+ #define GIF_EXPORT __declspec(dllexport) -+ #endif /* USE_GIF_DLL */ -+ #endif /* USE_GIF_LIB */ -+#else -+ #define GIF_EXPORT -+#endif /* _MSC_VER */ -+ - #define GIFLIB_MAJOR 5 - #define GIFLIB_MINOR 2 - #define GIFLIB_RELEASE 1 -@@ -125,13 +139,13 @@ typedef struct GraphicsControlBlock { - ******************************************************************************/ - - /* Main entry points */ --GifFileType *EGifOpenFileName(const char *GifFileName, -+GIF_EXPORT GifFileType *EGifOpenFileName(const char *GifFileName, - const bool GifTestExistence, int *Error); --GifFileType *EGifOpenFileHandle(const int GifFileHandle, int *Error); --GifFileType *EGifOpen(void *userPtr, OutputFunc writeFunc, int *Error); --int EGifSpew(GifFileType * GifFile); --const char *EGifGetGifVersion(GifFileType *GifFile); /* new in 5.x */ --int EGifCloseFile(GifFileType *GifFile, int *ErrorCode); -+GIF_EXPORT GifFileType *EGifOpenFileHandle(const int GifFileHandle, int *Error); -+GIF_EXPORT GifFileType *EGifOpen(void *userPtr, OutputFunc writeFunc, int *Error); -+GIF_EXPORT int EGifSpew(GifFileType * GifFile); -+GIF_EXPORT const char *EGifGetGifVersion(GifFileType *GifFile); /* new in 5.x */ -+GIF_EXPORT int EGifCloseFile(GifFileType *GifFile, int *ErrorCode); - - #define E_GIF_SUCCEEDED 0 - #define E_GIF_ERR_OPEN_FAILED 1 /* And EGif possible errors. */ -@@ -146,31 +160,31 @@ int EGifCloseFile(GifFileType *GifFile, int *ErrorCode); - #define E_GIF_ERR_NOT_WRITEABLE 10 - - /* These are legacy. You probably do not want to call them directly */ --int EGifPutScreenDesc(GifFileType *GifFile, -+GIF_EXPORT int EGifPutScreenDesc(GifFileType *GifFile, - const int GifWidth, const int GifHeight, - const int GifColorRes, - const int GifBackGround, - const ColorMapObject *GifColorMap); --int EGifPutImageDesc(GifFileType *GifFile, -+GIF_EXPORT int EGifPutImageDesc(GifFileType *GifFile, - const int GifLeft, const int GifTop, - const int GifWidth, const int GifHeight, - const bool GifInterlace, - const ColorMapObject *GifColorMap); --void EGifSetGifVersion(GifFileType *GifFile, const bool gif89); --int EGifPutLine(GifFileType *GifFile, GifPixelType *GifLine, -+GIF_EXPORT void EGifSetGifVersion(GifFileType *GifFile, const bool gif89); -+GIF_EXPORT int EGifPutLine(GifFileType *GifFile, GifPixelType *GifLine, - int GifLineLen); --int EGifPutPixel(GifFileType *GifFile, const GifPixelType GifPixel); --int EGifPutComment(GifFileType *GifFile, const char *GifComment); --int EGifPutExtensionLeader(GifFileType *GifFile, const int GifExtCode); --int EGifPutExtensionBlock(GifFileType *GifFile, -+GIF_EXPORT int EGifPutPixel(GifFileType *GifFile, const GifPixelType GifPixel); -+GIF_EXPORT int EGifPutComment(GifFileType *GifFile, const char *GifComment); -+GIF_EXPORT int EGifPutExtensionLeader(GifFileType *GifFile, const int GifExtCode); -+GIF_EXPORT int EGifPutExtensionBlock(GifFileType *GifFile, - const int GifExtLen, const void *GifExtension); --int EGifPutExtensionTrailer(GifFileType *GifFile); --int EGifPutExtension(GifFileType *GifFile, const int GifExtCode, -+GIF_EXPORT int EGifPutExtensionTrailer(GifFileType *GifFile); -+GIF_EXPORT int EGifPutExtension(GifFileType *GifFile, const int GifExtCode, - const int GifExtLen, - const void *GifExtension); --int EGifPutCode(GifFileType *GifFile, int GifCodeSize, -+GIF_EXPORT int EGifPutCode(GifFileType *GifFile, int GifCodeSize, - const GifByteType *GifCodeBlock); --int EGifPutCodeNext(GifFileType *GifFile, -+GIF_EXPORT int EGifPutCodeNext(GifFileType *GifFile, - const GifByteType *GifCodeBlock); - - /****************************************************************************** -@@ -178,11 +192,11 @@ int EGifPutCodeNext(GifFileType *GifFile, - ******************************************************************************/ - - /* Main entry points */ --GifFileType *DGifOpenFileName(const char *GifFileName, int *Error); --GifFileType *DGifOpenFileHandle(int GifFileHandle, int *Error); --int DGifSlurp(GifFileType * GifFile); --GifFileType *DGifOpen(void *userPtr, InputFunc readFunc, int *Error); /* new one (TVT) */ -- int DGifCloseFile(GifFileType * GifFile, int *ErrorCode); -+GIF_EXPORT GifFileType *DGifOpenFileName(const char *GifFileName, int *Error); -+GIF_EXPORT GifFileType *DGifOpenFileHandle(int GifFileHandle, int *Error); -+GIF_EXPORT int DGifSlurp(GifFileType * GifFile); -+GIF_EXPORT GifFileType *DGifOpen(void *userPtr, InputFunc readFunc, int *Error); /* new one (TVT) */ -+GIF_EXPORT int DGifCloseFile(GifFileType * GifFile, int *ErrorCode); - - #define D_GIF_SUCCEEDED 0 - #define D_GIF_ERR_OPEN_FAILED 101 /* And DGif possible errors. */ -@@ -200,26 +214,26 @@ GifFileType *DGifOpen(void *userPtr, InputFunc readFunc, int *Error); /* new - #define D_GIF_ERR_EOF_TOO_SOON 113 - - /* These are legacy. You probably do not want to call them directly */ --int DGifGetScreenDesc(GifFileType *GifFile); --int DGifGetRecordType(GifFileType *GifFile, GifRecordType *GifType); --int DGifGetImageHeader(GifFileType *GifFile); --int DGifGetImageDesc(GifFileType *GifFile); --int DGifGetLine(GifFileType *GifFile, GifPixelType *GifLine, int GifLineLen); --int DGifGetPixel(GifFileType *GifFile, GifPixelType GifPixel); --int DGifGetExtension(GifFileType *GifFile, int *GifExtCode, -+GIF_EXPORT int DGifGetScreenDesc(GifFileType *GifFile); -+GIF_EXPORT int DGifGetRecordType(GifFileType *GifFile, GifRecordType *GifType); -+GIF_EXPORT int DGifGetImageHeader(GifFileType *GifFile); -+GIF_EXPORT int DGifGetImageDesc(GifFileType *GifFile); -+GIF_EXPORT int DGifGetLine(GifFileType *GifFile, GifPixelType *GifLine, int GifLineLen); -+GIF_EXPORT int DGifGetPixel(GifFileType *GifFile, GifPixelType GifPixel); -+GIF_EXPORT int DGifGetExtension(GifFileType *GifFile, int *GifExtCode, - GifByteType **GifExtension); --int DGifGetExtensionNext(GifFileType *GifFile, GifByteType **GifExtension); --int DGifGetCode(GifFileType *GifFile, int *GifCodeSize, -+GIF_EXPORT int DGifGetExtensionNext(GifFileType *GifFile, GifByteType **GifExtension); -+GIF_EXPORT int DGifGetCode(GifFileType *GifFile, int *GifCodeSize, - GifByteType **GifCodeBlock); --int DGifGetCodeNext(GifFileType *GifFile, GifByteType **GifCodeBlock); --int DGifGetLZCodes(GifFileType *GifFile, int *GifCode); --const char *DGifGetGifVersion(GifFileType *GifFile); -+GIF_EXPORT int DGifGetCodeNext(GifFileType *GifFile, GifByteType **GifCodeBlock); -+GIF_EXPORT int DGifGetLZCodes(GifFileType *GifFile, int *GifCode); -+GIF_EXPORT const char *DGifGetGifVersion(GifFileType *GifFile); - - - /****************************************************************************** - Error handling and reporting. - ******************************************************************************/ --extern const char *GifErrorString(int ErrorCode); /* new in 2012 - ESR */ -+GIF_EXPORT extern const char *GifErrorString(int ErrorCode); /* new in 2012 - ESR */ - - /***************************************************************************** - Everything below this point is new after version 1.2, supporting `slurp -@@ -230,43 +244,43 @@ extern const char *GifErrorString(int ErrorCode); /* new in 2012 - ESR */ - Color map handling from gif_alloc.c - ******************************************************************************/ - --extern ColorMapObject *GifMakeMapObject(int ColorCount, -+GIF_EXPORT extern ColorMapObject *GifMakeMapObject(int ColorCount, - const GifColorType *ColorMap); --extern void GifFreeMapObject(ColorMapObject *Object); --extern ColorMapObject *GifUnionColorMap(const ColorMapObject *ColorIn1, -+GIF_EXPORT extern void GifFreeMapObject(ColorMapObject *Object); -+GIF_EXPORT extern ColorMapObject *GifUnionColorMap(const ColorMapObject *ColorIn1, - const ColorMapObject *ColorIn2, - GifPixelType ColorTransIn2[]); --extern int GifBitSize(int n); -+GIF_EXPORT extern int GifBitSize(int n); - - /****************************************************************************** - Support for the in-core structures allocation (slurp mode). - ******************************************************************************/ - --extern void GifApplyTranslation(SavedImage *Image, GifPixelType Translation[]); --extern int GifAddExtensionBlock(int *ExtensionBlock_Count, -+GIF_EXPORT extern void GifApplyTranslation(SavedImage *Image, GifPixelType Translation[]); -+GIF_EXPORT extern int GifAddExtensionBlock(int *ExtensionBlock_Count, - ExtensionBlock **ExtensionBlocks, - int Function, - unsigned int Len, unsigned char ExtData[]); --extern void GifFreeExtensions(int *ExtensionBlock_Count, -+GIF_EXPORT extern void GifFreeExtensions(int *ExtensionBlock_Count, - ExtensionBlock **ExtensionBlocks); --extern SavedImage *GifMakeSavedImage(GifFileType *GifFile, -+GIF_EXPORT extern SavedImage *GifMakeSavedImage(GifFileType *GifFile, - const SavedImage *CopyFrom); --extern void GifFreeSavedImages(GifFileType *GifFile); -+GIF_EXPORT extern void GifFreeSavedImages(GifFileType *GifFile); - - /****************************************************************************** - 5.x functions for GIF89 graphics control blocks - ******************************************************************************/ - --int DGifExtensionToGCB(const size_t GifExtensionLength, -+GIF_EXPORT int DGifExtensionToGCB(const size_t GifExtensionLength, - const GifByteType *GifExtension, - GraphicsControlBlock *GCB); --size_t EGifGCBToExtension(const GraphicsControlBlock *GCB, -+GIF_EXPORT size_t EGifGCBToExtension(const GraphicsControlBlock *GCB, - GifByteType *GifExtension); - --int DGifSavedExtensionToGCB(GifFileType *GifFile, -+GIF_EXPORT int DGifSavedExtensionToGCB(GifFileType *GifFile, - int ImageIndex, - GraphicsControlBlock *GCB); --int EGifGCBToSavedExtension(const GraphicsControlBlock *GCB, -+GIF_EXPORT int EGifGCBToSavedExtension(const GraphicsControlBlock *GCB, - GifFileType *GifFile, - int ImageIndex); - -@@ -276,21 +290,21 @@ int EGifGCBToSavedExtension(const GraphicsControlBlock *GCB, - - #define GIF_FONT_WIDTH 8 - #define GIF_FONT_HEIGHT 8 --extern const unsigned char GifAsciiTable8x8[][GIF_FONT_WIDTH]; -+GIF_EXPORT extern const unsigned char GifAsciiTable8x8[][GIF_FONT_WIDTH]; - --extern void GifDrawText8x8(SavedImage *Image, -+GIF_EXPORT extern void GifDrawText8x8(SavedImage *Image, - const int x, const int y, - const char *legend, const int color); - --extern void GifDrawBox(SavedImage *Image, -+GIF_EXPORT extern void GifDrawBox(SavedImage *Image, - const int x, const int y, - const int w, const int d, const int color); - --extern void GifDrawRectangle(SavedImage *Image, -+GIF_EXPORT extern void GifDrawRectangle(SavedImage *Image, - const int x, const int y, - const int w, const int d, const int color); - --extern void GifDrawBoxedText8x8(SavedImage *Image, -+GIF_EXPORT extern void GifDrawBoxedText8x8(SavedImage *Image, - const int x, const int y, - const char *legend, - const int border, const int bg, const int fg); diff --git a/recipes/giflib/5.2.x/patches/5.2.1-0002-msvc-export.patch b/recipes/giflib/5.2.x/patches/5.2.1-0002-msvc-export.patch new file mode 100644 index 0000000000000..d9383c54a5729 --- /dev/null +++ b/recipes/giflib/5.2.x/patches/5.2.1-0002-msvc-export.patch @@ -0,0 +1,230 @@ +diff --git a/gif_lib.h b/gif_lib.h +index ebdbd3c..bf0d373 100644 +--- a/gif_lib.h ++++ b/gif_lib.h +@@ -13,6 +13,20 @@ SPDX-License-Identifier: MIT + extern "C" { + #endif /* __cplusplus */ + ++#ifdef _MSC_VER ++ #ifdef USE_GIF_LIB ++ #define GIF_EXPORT ++ #else /* USE_GIF_LIB */ ++ #ifdef USE_GIF_DLL ++ #define GIF_EXPORT __declspec(dllimport) ++ #else /* USE_GIF_DLL */ ++ #define GIF_EXPORT __declspec(dllexport) ++ #endif /* USE_GIF_DLL */ ++ #endif /* USE_GIF_LIB */ ++#else ++ #define GIF_EXPORT ++#endif /* _MSC_VER */ ++ + #define GIFLIB_MAJOR 5 + #define GIFLIB_MINOR 2 + #define GIFLIB_RELEASE 1 +@@ -125,13 +139,13 @@ typedef struct GraphicsControlBlock { + ******************************************************************************/ + + /* Main entry points */ +-GifFileType *EGifOpenFileName(const char *GifFileName, ++GIF_EXPORT GifFileType *EGifOpenFileName(const char *GifFileName, + const bool GifTestExistence, int *Error); +-GifFileType *EGifOpenFileHandle(const int GifFileHandle, int *Error); +-GifFileType *EGifOpen(void *userPtr, OutputFunc writeFunc, int *Error); +-int EGifSpew(GifFileType * GifFile); +-const char *EGifGetGifVersion(GifFileType *GifFile); /* new in 5.x */ +-int EGifCloseFile(GifFileType *GifFile, int *ErrorCode); ++GIF_EXPORT GifFileType *EGifOpenFileHandle(const int GifFileHandle, int *Error); ++GIF_EXPORT GifFileType *EGifOpen(void *userPtr, OutputFunc writeFunc, int *Error); ++GIF_EXPORT int EGifSpew(GifFileType * GifFile); ++GIF_EXPORT const char *EGifGetGifVersion(GifFileType *GifFile); /* new in 5.x */ ++GIF_EXPORT int EGifCloseFile(GifFileType *GifFile, int *ErrorCode); + + #define E_GIF_SUCCEEDED 0 + #define E_GIF_ERR_OPEN_FAILED 1 /* And EGif possible errors. */ +@@ -146,31 +160,31 @@ int EGifCloseFile(GifFileType *GifFile, int *ErrorCode); + #define E_GIF_ERR_NOT_WRITEABLE 10 + + /* These are legacy. You probably do not want to call them directly */ +-int EGifPutScreenDesc(GifFileType *GifFile, ++GIF_EXPORT int EGifPutScreenDesc(GifFileType *GifFile, + const int GifWidth, const int GifHeight, + const int GifColorRes, + const int GifBackGround, + const ColorMapObject *GifColorMap); +-int EGifPutImageDesc(GifFileType *GifFile, ++GIF_EXPORT int EGifPutImageDesc(GifFileType *GifFile, + const int GifLeft, const int GifTop, + const int GifWidth, const int GifHeight, + const bool GifInterlace, + const ColorMapObject *GifColorMap); +-void EGifSetGifVersion(GifFileType *GifFile, const bool gif89); +-int EGifPutLine(GifFileType *GifFile, GifPixelType *GifLine, ++GIF_EXPORT void EGifSetGifVersion(GifFileType *GifFile, const bool gif89); ++GIF_EXPORT int EGifPutLine(GifFileType *GifFile, GifPixelType *GifLine, + int GifLineLen); +-int EGifPutPixel(GifFileType *GifFile, const GifPixelType GifPixel); +-int EGifPutComment(GifFileType *GifFile, const char *GifComment); +-int EGifPutExtensionLeader(GifFileType *GifFile, const int GifExtCode); +-int EGifPutExtensionBlock(GifFileType *GifFile, ++GIF_EXPORT int EGifPutPixel(GifFileType *GifFile, const GifPixelType GifPixel); ++GIF_EXPORT int EGifPutComment(GifFileType *GifFile, const char *GifComment); ++GIF_EXPORT int EGifPutExtensionLeader(GifFileType *GifFile, const int GifExtCode); ++GIF_EXPORT int EGifPutExtensionBlock(GifFileType *GifFile, + const int GifExtLen, const void *GifExtension); +-int EGifPutExtensionTrailer(GifFileType *GifFile); +-int EGifPutExtension(GifFileType *GifFile, const int GifExtCode, ++GIF_EXPORT int EGifPutExtensionTrailer(GifFileType *GifFile); ++GIF_EXPORT int EGifPutExtension(GifFileType *GifFile, const int GifExtCode, + const int GifExtLen, + const void *GifExtension); +-int EGifPutCode(GifFileType *GifFile, int GifCodeSize, ++GIF_EXPORT int EGifPutCode(GifFileType *GifFile, int GifCodeSize, + const GifByteType *GifCodeBlock); +-int EGifPutCodeNext(GifFileType *GifFile, ++GIF_EXPORT int EGifPutCodeNext(GifFileType *GifFile, + const GifByteType *GifCodeBlock); + + /****************************************************************************** +@@ -178,11 +192,11 @@ int EGifPutCodeNext(GifFileType *GifFile, + ******************************************************************************/ + + /* Main entry points */ +-GifFileType *DGifOpenFileName(const char *GifFileName, int *Error); +-GifFileType *DGifOpenFileHandle(int GifFileHandle, int *Error); +-int DGifSlurp(GifFileType * GifFile); +-GifFileType *DGifOpen(void *userPtr, InputFunc readFunc, int *Error); /* new one (TVT) */ +- int DGifCloseFile(GifFileType * GifFile, int *ErrorCode); ++GIF_EXPORT GifFileType *DGifOpenFileName(const char *GifFileName, int *Error); ++GIF_EXPORT GifFileType *DGifOpenFileHandle(int GifFileHandle, int *Error); ++GIF_EXPORT int DGifSlurp(GifFileType * GifFile); ++GIF_EXPORT GifFileType *DGifOpen(void *userPtr, InputFunc readFunc, int *Error); /* new one (TVT) */ ++GIF_EXPORT int DGifCloseFile(GifFileType * GifFile, int *ErrorCode); + + #define D_GIF_SUCCEEDED 0 + #define D_GIF_ERR_OPEN_FAILED 101 /* And DGif possible errors. */ +@@ -200,26 +214,26 @@ GifFileType *DGifOpen(void *userPtr, InputFunc readFunc, int *Error); /* new + #define D_GIF_ERR_EOF_TOO_SOON 113 + + /* These are legacy. You probably do not want to call them directly */ +-int DGifGetScreenDesc(GifFileType *GifFile); +-int DGifGetRecordType(GifFileType *GifFile, GifRecordType *GifType); +-int DGifGetImageHeader(GifFileType *GifFile); +-int DGifGetImageDesc(GifFileType *GifFile); +-int DGifGetLine(GifFileType *GifFile, GifPixelType *GifLine, int GifLineLen); +-int DGifGetPixel(GifFileType *GifFile, GifPixelType GifPixel); +-int DGifGetExtension(GifFileType *GifFile, int *GifExtCode, ++GIF_EXPORT int DGifGetScreenDesc(GifFileType *GifFile); ++GIF_EXPORT int DGifGetRecordType(GifFileType *GifFile, GifRecordType *GifType); ++GIF_EXPORT int DGifGetImageHeader(GifFileType *GifFile); ++GIF_EXPORT int DGifGetImageDesc(GifFileType *GifFile); ++GIF_EXPORT int DGifGetLine(GifFileType *GifFile, GifPixelType *GifLine, int GifLineLen); ++GIF_EXPORT int DGifGetPixel(GifFileType *GifFile, GifPixelType GifPixel); ++GIF_EXPORT int DGifGetExtension(GifFileType *GifFile, int *GifExtCode, + GifByteType **GifExtension); +-int DGifGetExtensionNext(GifFileType *GifFile, GifByteType **GifExtension); +-int DGifGetCode(GifFileType *GifFile, int *GifCodeSize, ++GIF_EXPORT int DGifGetExtensionNext(GifFileType *GifFile, GifByteType **GifExtension); ++GIF_EXPORT int DGifGetCode(GifFileType *GifFile, int *GifCodeSize, + GifByteType **GifCodeBlock); +-int DGifGetCodeNext(GifFileType *GifFile, GifByteType **GifCodeBlock); +-int DGifGetLZCodes(GifFileType *GifFile, int *GifCode); +-const char *DGifGetGifVersion(GifFileType *GifFile); ++GIF_EXPORT int DGifGetCodeNext(GifFileType *GifFile, GifByteType **GifCodeBlock); ++GIF_EXPORT int DGifGetLZCodes(GifFileType *GifFile, int *GifCode); ++GIF_EXPORT const char *DGifGetGifVersion(GifFileType *GifFile); + + + /****************************************************************************** + Error handling and reporting. + ******************************************************************************/ +-extern const char *GifErrorString(int ErrorCode); /* new in 2012 - ESR */ ++GIF_EXPORT extern const char *GifErrorString(int ErrorCode); /* new in 2012 - ESR */ + + /***************************************************************************** + Everything below this point is new after version 1.2, supporting `slurp +@@ -230,43 +244,43 @@ extern const char *GifErrorString(int ErrorCode); /* new in 2012 - ESR */ + Color map handling from gif_alloc.c + ******************************************************************************/ + +-extern ColorMapObject *GifMakeMapObject(int ColorCount, ++GIF_EXPORT extern ColorMapObject *GifMakeMapObject(int ColorCount, + const GifColorType *ColorMap); +-extern void GifFreeMapObject(ColorMapObject *Object); +-extern ColorMapObject *GifUnionColorMap(const ColorMapObject *ColorIn1, ++GIF_EXPORT extern void GifFreeMapObject(ColorMapObject *Object); ++GIF_EXPORT extern ColorMapObject *GifUnionColorMap(const ColorMapObject *ColorIn1, + const ColorMapObject *ColorIn2, + GifPixelType ColorTransIn2[]); +-extern int GifBitSize(int n); ++GIF_EXPORT extern int GifBitSize(int n); + + /****************************************************************************** + Support for the in-core structures allocation (slurp mode). + ******************************************************************************/ + +-extern void GifApplyTranslation(SavedImage *Image, GifPixelType Translation[]); +-extern int GifAddExtensionBlock(int *ExtensionBlock_Count, ++GIF_EXPORT extern void GifApplyTranslation(SavedImage *Image, GifPixelType Translation[]); ++GIF_EXPORT extern int GifAddExtensionBlock(int *ExtensionBlock_Count, + ExtensionBlock **ExtensionBlocks, + int Function, + unsigned int Len, unsigned char ExtData[]); +-extern void GifFreeExtensions(int *ExtensionBlock_Count, ++GIF_EXPORT extern void GifFreeExtensions(int *ExtensionBlock_Count, + ExtensionBlock **ExtensionBlocks); +-extern SavedImage *GifMakeSavedImage(GifFileType *GifFile, ++GIF_EXPORT extern SavedImage *GifMakeSavedImage(GifFileType *GifFile, + const SavedImage *CopyFrom); +-extern void GifFreeSavedImages(GifFileType *GifFile); ++GIF_EXPORT extern void GifFreeSavedImages(GifFileType *GifFile); + + /****************************************************************************** + 5.x functions for GIF89 graphics control blocks + ******************************************************************************/ + +-int DGifExtensionToGCB(const size_t GifExtensionLength, ++GIF_EXPORT int DGifExtensionToGCB(const size_t GifExtensionLength, + const GifByteType *GifExtension, + GraphicsControlBlock *GCB); +-size_t EGifGCBToExtension(const GraphicsControlBlock *GCB, ++GIF_EXPORT size_t EGifGCBToExtension(const GraphicsControlBlock *GCB, + GifByteType *GifExtension); + +-int DGifSavedExtensionToGCB(GifFileType *GifFile, ++GIF_EXPORT int DGifSavedExtensionToGCB(GifFileType *GifFile, + int ImageIndex, + GraphicsControlBlock *GCB); +-int EGifGCBToSavedExtension(const GraphicsControlBlock *GCB, ++GIF_EXPORT int EGifGCBToSavedExtension(const GraphicsControlBlock *GCB, + GifFileType *GifFile, + int ImageIndex); + +@@ -276,21 +290,21 @@ int EGifGCBToSavedExtension(const GraphicsControlBlock *GCB, + + #define GIF_FONT_WIDTH 8 + #define GIF_FONT_HEIGHT 8 +-extern const unsigned char GifAsciiTable8x8[][GIF_FONT_WIDTH]; ++GIF_EXPORT extern const unsigned char GifAsciiTable8x8[][GIF_FONT_WIDTH]; + +-extern void GifDrawText8x8(SavedImage *Image, ++GIF_EXPORT extern void GifDrawText8x8(SavedImage *Image, + const int x, const int y, + const char *legend, const int color); + +-extern void GifDrawBox(SavedImage *Image, ++GIF_EXPORT extern void GifDrawBox(SavedImage *Image, + const int x, const int y, + const int w, const int d, const int color); + +-extern void GifDrawRectangle(SavedImage *Image, ++GIF_EXPORT extern void GifDrawRectangle(SavedImage *Image, + const int x, const int y, + const int w, const int d, const int color); + +-extern void GifDrawBoxedText8x8(SavedImage *Image, ++GIF_EXPORT extern void GifDrawBoxedText8x8(SavedImage *Image, + const int x, const int y, + const char *legend, + const int border, const int bg, const int fg); diff --git a/recipes/giflib/5.2.x/patches/5.2.2-0001-msvc-export.patch b/recipes/giflib/5.2.x/patches/5.2.2-0001-msvc-export.patch new file mode 100644 index 0000000000000..bdeb9f0885c6a --- /dev/null +++ b/recipes/giflib/5.2.x/patches/5.2.2-0001-msvc-export.patch @@ -0,0 +1,220 @@ +diff --git a/gif_lib.h b/gif_lib.h +--- a/gif_lib.h ++++ b/gif_lib.h +@@ -13,6 +13,20 @@ + extern "C" { + #endif /* __cplusplus */ + ++#ifdef _MSC_VER ++ #ifdef USE_GIF_LIB ++ #define GIF_EXPORT ++ #else /* USE_GIF_LIB */ ++ #ifdef USE_GIF_DLL ++ #define GIF_EXPORT __declspec(dllimport) ++ #else /* USE_GIF_DLL */ ++ #define GIF_EXPORT __declspec(dllexport) ++ #endif /* USE_GIF_DLL */ ++ #endif /* USE_GIF_LIB */ ++#else ++ #define GIF_EXPORT ++#endif /* _MSC_VER */ ++ + #define GIFLIB_MAJOR 5 + #define GIFLIB_MINOR 2 + #define GIFLIB_RELEASE 2 +@@ -125,13 +139,13 @@ + ******************************************************************************/ + + /* Main entry points */ +-GifFileType *EGifOpenFileName(const char *GifFileName, ++GIF_EXPORT GifFileType *EGifOpenFileName(const char *GifFileName, + const bool GifTestExistence, int *Error); +-GifFileType *EGifOpenFileHandle(const int GifFileHandle, int *Error); +-GifFileType *EGifOpen(void *userPtr, OutputFunc writeFunc, int *Error); +-int EGifSpew(GifFileType *GifFile); +-const char *EGifGetGifVersion(GifFileType *GifFile); /* new in 5.x */ +-int EGifCloseFile(GifFileType *GifFile, int *ErrorCode); ++GIF_EXPORT GifFileType *EGifOpenFileHandle(const int GifFileHandle, int *Error); ++GIF_EXPORT GifFileType *EGifOpen(void *userPtr, OutputFunc writeFunc, int *Error); ++GIF_EXPORT int EGifSpew(GifFileType *GifFile); ++GIF_EXPORT const char *EGifGetGifVersion(GifFileType *GifFile); /* new in 5.x */ ++GIF_EXPORT int EGifCloseFile(GifFileType *GifFile, int *ErrorCode); + + #define E_GIF_SUCCEEDED 0 + #define E_GIF_ERR_OPEN_FAILED 1 /* And EGif possible errors. */ +@@ -146,39 +160,39 @@ + #define E_GIF_ERR_NOT_WRITEABLE 10 + + /* These are legacy. You probably do not want to call them directly */ +-int EGifPutScreenDesc(GifFileType *GifFile, const int GifWidth, ++GIF_EXPORT int EGifPutScreenDesc(GifFileType *GifFile, const int GifWidth, + const int GifHeight, const int GifColorRes, + const int GifBackGround, + const ColorMapObject *GifColorMap); +-int EGifPutImageDesc(GifFileType *GifFile, const int GifLeft, const int GifTop, ++GIF_EXPORT int EGifPutImageDesc(GifFileType *GifFile, const int GifLeft, const int GifTop, + const int GifWidth, const int GifHeight, + const bool GifInterlace, + const ColorMapObject *GifColorMap); +-void EGifSetGifVersion(GifFileType *GifFile, const bool gif89); +-int EGifPutLine(GifFileType *GifFile, GifPixelType *GifLine, int GifLineLen); +-int EGifPutPixel(GifFileType *GifFile, const GifPixelType GifPixel); +-int EGifPutComment(GifFileType *GifFile, const char *GifComment); +-int EGifPutExtensionLeader(GifFileType *GifFile, const int GifExtCode); +-int EGifPutExtensionBlock(GifFileType *GifFile, const int GifExtLen, ++GIF_EXPORT void EGifSetGifVersion(GifFileType *GifFile, const bool gif89); ++GIF_EXPORT int EGifPutLine(GifFileType *GifFile, GifPixelType *GifLine, int GifLineLen); ++GIF_EXPORT int EGifPutPixel(GifFileType *GifFile, const GifPixelType GifPixel); ++GIF_EXPORT int EGifPutComment(GifFileType *GifFile, const char *GifComment); ++GIF_EXPORT int EGifPutExtensionLeader(GifFileType *GifFile, const int GifExtCode); ++GIF_EXPORT int EGifPutExtensionBlock(GifFileType *GifFile, const int GifExtLen, + const void *GifExtension); +-int EGifPutExtensionTrailer(GifFileType *GifFile); +-int EGifPutExtension(GifFileType *GifFile, const int GifExtCode, ++GIF_EXPORT int EGifPutExtensionTrailer(GifFileType *GifFile); ++GIF_EXPORT int EGifPutExtension(GifFileType *GifFile, const int GifExtCode, + const int GifExtLen, const void *GifExtension); +-int EGifPutCode(GifFileType *GifFile, int GifCodeSize, ++GIF_EXPORT int EGifPutCode(GifFileType *GifFile, int GifCodeSize, + const GifByteType *GifCodeBlock); +-int EGifPutCodeNext(GifFileType *GifFile, const GifByteType *GifCodeBlock); ++GIF_EXPORT int EGifPutCodeNext(GifFileType *GifFile, const GifByteType *GifCodeBlock); + + /****************************************************************************** + GIF decoding routines + ******************************************************************************/ + + /* Main entry points */ +-GifFileType *DGifOpenFileName(const char *GifFileName, int *Error); +-GifFileType *DGifOpenFileHandle(int GifFileHandle, int *Error); +-int DGifSlurp(GifFileType *GifFile); +-GifFileType *DGifOpen(void *userPtr, InputFunc readFunc, ++GIF_EXPORT GifFileType *DGifOpenFileName(const char *GifFileName, int *Error); ++GIF_EXPORT GifFileType *DGifOpenFileHandle(int GifFileHandle, int *Error); ++GIF_EXPORT int DGifSlurp(GifFileType *GifFile); ++GIF_EXPORT GifFileType *DGifOpen(void *userPtr, InputFunc readFunc, + int *Error); /* new one (TVT) */ +-int DGifCloseFile(GifFileType *GifFile, int *ErrorCode); ++GIF_EXPORT int DGifCloseFile(GifFileType *GifFile, int *ErrorCode); + + #define D_GIF_SUCCEEDED 0 + #define D_GIF_ERR_OPEN_FAILED 101 /* And DGif possible errors. */ +@@ -196,25 +210,25 @@ + #define D_GIF_ERR_EOF_TOO_SOON 113 + + /* These are legacy. You probably do not want to call them directly */ +-int DGifGetScreenDesc(GifFileType *GifFile); +-int DGifGetRecordType(GifFileType *GifFile, GifRecordType *GifType); +-int DGifGetImageHeader(GifFileType *GifFile); +-int DGifGetImageDesc(GifFileType *GifFile); +-int DGifGetLine(GifFileType *GifFile, GifPixelType *GifLine, int GifLineLen); +-int DGifGetPixel(GifFileType *GifFile, GifPixelType GifPixel); +-int DGifGetExtension(GifFileType *GifFile, int *GifExtCode, ++GIF_EXPORT int DGifGetScreenDesc(GifFileType *GifFile); ++GIF_EXPORT int DGifGetRecordType(GifFileType *GifFile, GifRecordType *GifType); ++GIF_EXPORT int DGifGetImageHeader(GifFileType *GifFile); ++GIF_EXPORT int DGifGetImageDesc(GifFileType *GifFile); ++GIF_EXPORT int DGifGetLine(GifFileType *GifFile, GifPixelType *GifLine, int GifLineLen); ++GIF_EXPORT int DGifGetPixel(GifFileType *GifFile, GifPixelType GifPixel); ++GIF_EXPORT int DGifGetExtension(GifFileType *GifFile, int *GifExtCode, + GifByteType **GifExtension); +-int DGifGetExtensionNext(GifFileType *GifFile, GifByteType **GifExtension); +-int DGifGetCode(GifFileType *GifFile, int *GifCodeSize, ++GIF_EXPORT int DGifGetExtensionNext(GifFileType *GifFile, GifByteType **GifExtension); ++GIF_EXPORT int DGifGetCode(GifFileType *GifFile, int *GifCodeSize, + GifByteType **GifCodeBlock); +-int DGifGetCodeNext(GifFileType *GifFile, GifByteType **GifCodeBlock); +-int DGifGetLZCodes(GifFileType *GifFile, int *GifCode); +-const char *DGifGetGifVersion(GifFileType *GifFile); ++GIF_EXPORT int DGifGetCodeNext(GifFileType *GifFile, GifByteType **GifCodeBlock); ++GIF_EXPORT int DGifGetLZCodes(GifFileType *GifFile, int *GifCode); ++GIF_EXPORT const char *DGifGetGifVersion(GifFileType *GifFile); + + /****************************************************************************** + Error handling and reporting. + ******************************************************************************/ +-extern const char *GifErrorString(int ErrorCode); /* new in 2012 - ESR */ ++GIF_EXPORT extern const char *GifErrorString(int ErrorCode); /* new in 2012 - ESR */ + + /***************************************************************************** + Everything below this point is new after version 1.2, supporting `slurp +@@ -225,42 +239,42 @@ + Color map handling from gif_alloc.c + ******************************************************************************/ + +-extern ColorMapObject *GifMakeMapObject(int ColorCount, ++GIF_EXPORT extern ColorMapObject *GifMakeMapObject(int ColorCount, + const GifColorType *ColorMap); +-extern void GifFreeMapObject(ColorMapObject *Object); +-extern ColorMapObject *GifUnionColorMap(const ColorMapObject *ColorIn1, ++GIF_EXPORT extern void GifFreeMapObject(ColorMapObject *Object); ++GIF_EXPORT extern ColorMapObject *GifUnionColorMap(const ColorMapObject *ColorIn1, + const ColorMapObject *ColorIn2, + GifPixelType ColorTransIn2[]); +-extern int GifBitSize(int n); ++GIF_EXPORT extern int GifBitSize(int n); + + /****************************************************************************** + Support for the in-core structures allocation (slurp mode). + ******************************************************************************/ + +-extern void GifApplyTranslation(SavedImage *Image, ++GIF_EXPORT extern void GifApplyTranslation(SavedImage *Image, + const GifPixelType Translation[]); +-extern int GifAddExtensionBlock(int *ExtensionBlock_Count, ++GIF_EXPORT extern int GifAddExtensionBlock(int *ExtensionBlock_Count, + ExtensionBlock **ExtensionBlocks, int Function, + unsigned int Len, unsigned char ExtData[]); +-extern void GifFreeExtensions(int *ExtensionBlock_Count, ++GIF_EXPORT extern void GifFreeExtensions(int *ExtensionBlock_Count, + ExtensionBlock **ExtensionBlocks); +-extern SavedImage *GifMakeSavedImage(GifFileType *GifFile, ++GIF_EXPORT extern SavedImage *GifMakeSavedImage(GifFileType *GifFile, + const SavedImage *CopyFrom); +-extern void GifFreeSavedImages(GifFileType *GifFile); ++GIF_EXPORT extern void GifFreeSavedImages(GifFileType *GifFile); + + /****************************************************************************** + 5.x functions for GIF89 graphics control blocks + ******************************************************************************/ + +-int DGifExtensionToGCB(const size_t GifExtensionLength, ++GIF_EXPORT int DGifExtensionToGCB(const size_t GifExtensionLength, + const GifByteType *GifExtension, + GraphicsControlBlock *GCB); +-size_t EGifGCBToExtension(const GraphicsControlBlock *GCB, ++GIF_EXPORT size_t EGifGCBToExtension(const GraphicsControlBlock *GCB, + GifByteType *GifExtension); + +-int DGifSavedExtensionToGCB(GifFileType *GifFile, int ImageIndex, ++GIF_EXPORT int DGifSavedExtensionToGCB(GifFileType *GifFile, int ImageIndex, + GraphicsControlBlock *GCB); +-int EGifGCBToSavedExtension(const GraphicsControlBlock *GCB, ++GIF_EXPORT int EGifGCBToSavedExtension(const GraphicsControlBlock *GCB, + GifFileType *GifFile, int ImageIndex); + + /****************************************************************************** +@@ -269,18 +283,18 @@ + + #define GIF_FONT_WIDTH 8 + #define GIF_FONT_HEIGHT 8 +-extern const unsigned char GifAsciiTable8x8[][GIF_FONT_WIDTH]; ++GIF_EXPORT extern const unsigned char GifAsciiTable8x8[][GIF_FONT_WIDTH]; + +-extern void GifDrawText8x8(SavedImage *Image, const int x, const int y, ++GIF_EXPORT extern void GifDrawText8x8(SavedImage *Image, const int x, const int y, + const char *legend, const int color); + +-extern void GifDrawBox(SavedImage *Image, const int x, const int y, const int w, ++GIF_EXPORT extern void GifDrawBox(SavedImage *Image, const int x, const int y, const int w, + const int d, const int color); + +-extern void GifDrawRectangle(SavedImage *Image, const int x, const int y, ++GIF_EXPORT extern void GifDrawRectangle(SavedImage *Image, const int x, const int y, + const int w, const int d, const int color); + +-extern void GifDrawBoxedText8x8(SavedImage *Image, const int x, const int y, ++GIF_EXPORT extern void GifDrawBoxedText8x8(SavedImage *Image, const int x, const int y, + const char *legend, const int border, + const int bg, const int fg); + diff --git a/recipes/giflib/5.2.x/test_package/CMakeLists.txt b/recipes/giflib/5.2.x/test_package/CMakeLists.txt index 909c7abfcc3fc..d40a4c2c931fb 100644 --- a/recipes/giflib/5.2.x/test_package/CMakeLists.txt +++ b/recipes/giflib/5.2.x/test_package/CMakeLists.txt @@ -1,7 +1,7 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package LANGUAGES C) -find_package(GIF REQUIRED) +find_package(GIF REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) target_link_libraries(${PROJECT_NAME} PRIVATE GIF::GIF) diff --git a/recipes/giflib/5.2.x/test_package/conanfile.py b/recipes/giflib/5.2.x/test_package/conanfile.py index b9fa3f37a5fb4..e79bad64833c1 100644 --- a/recipes/giflib/5.2.x/test_package/conanfile.py +++ b/recipes/giflib/5.2.x/test_package/conanfile.py @@ -24,7 +24,3 @@ def test(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") - if self.options["giflib"].utils: - self.run("gif2rgb -o testimg.rgb testimg.gif", env="conanrun") - assert os.path.isfile("testimg.rgb.R") diff --git a/recipes/giflib/5.2.x/test_v1_package/conanfile.py b/recipes/giflib/5.2.x/test_v1_package/conanfile.py deleted file mode 100644 index 15e08a8cf4897..0000000000000 --- a/recipes/giflib/5.2.x/test_v1_package/conanfile.py +++ /dev/null @@ -1,21 +0,0 @@ -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(f"{bin_path} testimg.gif", run_environment=True) - assert os.path.isfile("testimg.gif") - if self.options["giflib"].utils: - self.run("gif2rgb -o testimg.rgb testimg.gif", run_environment=True) - assert os.path.isfile("testimg.rgb.R") diff --git a/recipes/giflib/config.yml b/recipes/giflib/config.yml index 1ccf672c09135..c70c4f2d279f1 100644 --- a/recipes/giflib/config.yml +++ b/recipes/giflib/config.yml @@ -1,4 +1,6 @@ versions: + "5.2.2": + folder: "5.2.x" "5.2.1": folder: "5.2.x" "5.1.4": diff --git a/recipes/ginkgo/all/CMakeLists.txt b/recipes/ginkgo/all/CMakeLists.txt deleted file mode 100644 index c986d294c7547..0000000000000 --- a/recipes/ginkgo/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/ginkgo/all/conandata.yml b/recipes/ginkgo/all/conandata.yml index 80b4abc10b2df..471710d33e7c9 100644 --- a/recipes/ginkgo/all/conandata.yml +++ b/recipes/ginkgo/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "1.8.0": + url: "https://github.com/ginkgo-project/ginkgo/archive/v1.8.0.tar.gz" + sha256: "421efaed1be2ef11d230b79fc68bcf7e264a2c57ae52aff6dec7bd90f8d4ae30" + "1.7.0": + url: "https://github.com/ginkgo-project/ginkgo/archive/v1.7.0.tar.gz" + sha256: "f4b362bcb046bc53fbe2e578662b939222d0c44b96449101829e73ecce02bcb3" "1.4.0": url: "https://github.com/ginkgo-project/ginkgo/archive/v1.4.0.tar.gz" sha256: "6dcadbd3e93f6ec58ef6cda5b980fbf51ea3c7c13e27952ef38804058ac93f08" @@ -6,12 +12,22 @@ sources: url: "https://github.com/ginkgo-project/ginkgo/archive/v1.3.0.tar.gz" sha256: "1b0e907b4046cdf7cef16d1730c12ba812b38f2764f49f74f454239a27f63596" patches: + "1.7.0": + - patch_file: "patches/libc++-chrono.patch" + patch_type: "official" + patch_description: "Fix for std::chrono incompatibility with libc++" + patch_source: "https://github.com/ginkgo-project/ginkgo/pull/1463" "1.4.0": - patch_file: "patches/windows-symbols.patch" - base_path: "source_subfolder" + patch_type: "official" + patch_description: "Fix for excessive link symbol count with MSVC" + patch_source: "https://github.com/ginkgo-project/ginkgo/pull/868" "1.3.0": - patch_file: "patches/cmake-fixes.patch" - base_path: "source_subfolder" + patch_type: "official" + patch_description: "Fixes for CMake issues" + patch_source: "https://github.com/ginkgo-project/ginkgo/pull/713, https://github.com/ginkgo-project/ginkgo/pull/720" - patch_file: "patches/windows-iterator.patch" - base_path: "source_subfolder" - + patch_type: "official" + patch_description: "Fixes for MSVC compatibility" + patch_source: "https://github.com/ginkgo-project/ginkgo/pull/665" diff --git a/recipes/ginkgo/all/conanfile.py b/recipes/ginkgo/all/conanfile.py index 759ce0c647076..9eb411b3e5186 100644 --- a/recipes/ginkgo/all/conanfile.py +++ b/recipes/ginkgo/all/conanfile.py @@ -1,9 +1,19 @@ -from conan.tools.microsoft import msvc_runtime_flag -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 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, +) +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.54.0" class GinkgoConan(ConanFile): @@ -16,7 +26,7 @@ class GinkgoConan(ConanFile): "focus on sparse solution of linear systems." ) topics = ("hpc", "linear-algebra") - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -31,39 +41,23 @@ class GinkgoConan(ConanFile): "cuda": 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 _minimum_cpp_standard(self): - return 14 + def _min_cppstd(self): + return "14" @property def _minimum_compilers_version(self): return { "Visual Studio": "16", + "msvc": "193", "gcc": "5.4", "clang": "3.9", "apple-clang": "10.0", - "intel": "18" + "intel": "18", } 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": @@ -71,11 +65,14 @@ 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, self._minimum_cpp_standard) + check_min_cppstd(self, self._min_cppstd) def loose_lt_semver(v1, v2): lv1 = [int(v) for v in v1.split(".")] @@ -83,54 +80,68 @@ def loose_lt_semver(v1, v2): 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)) - if minimum_version and loose_lt_semver(str(self.settings.compiler.version), minimum_version): + minimum_version = self._minimum_compilers_version.get( + str(self.settings.compiler) + ) + if minimum_version and loose_lt_semver( + str(self.settings.compiler.version), minimum_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.ref} requires C++{self._min_cppstd}, which your compiler does not support." ) - if self.options.shared and self._is_msvc and "MT" in msvc_runtime_flag(self): - raise ConanInvalidConfiguration( - "Ginkgo does not support mixing static CRT and shared library" - ) + if is_msvc(self) and self.options.shared: + if self.settings.build_type == "Debug" and Version(self.version) >= "1.7.0": + raise ConanInvalidConfiguration( + "Ginkgo >= 1.7.0 cannot be built in shared debug mode on Windows" + ) + if is_msvc_static_runtime(self): + raise ConanInvalidConfiguration( + "Ginkgo does not support mixing static CRT and shared library" + ) + + def build_requirements(self): + if Version(self.version) >= "1.7.0": + self.tool_requires("cmake/[>=3.16 <4]") 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["GINKGO_BUILD_TESTS"] = False - self._cmake.definitions["GINKGO_BUILD_EXAMPLES"] = False - self._cmake.definitions["GINKGO_BUILD_BENCHMARKS"] = False - self._cmake.definitions["GINKGO_DEVEL_TOOLS"] = False - self._cmake.definitions["GINKGO_BUILD_REFERENCE"] = True - self._cmake.definitions["GINKGO_BUILD_OMP"] = self.options.openmp - self._cmake.definitions["GINKGO_BUILD_CUDA"] = self.options.cuda - self._cmake.definitions["GINKGO_BUILD_HIP"] = False - self._cmake.definitions["GINKGO_BUILD_DPCPP"] = False - self._cmake.definitions["GINKGO_BUILD_HWLOC"] = False - self._cmake.definitions["BUILD_SHARED_LIBS"] = self.options.shared - 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["GINKGO_BUILD_TESTS"] = False + tc.variables["GINKGO_BUILD_EXAMPLES"] = False + tc.variables["GINKGO_BUILD_BENCHMARKS"] = False + tc.variables["GINKGO_DEVEL_TOOLS"] = False + tc.variables["GINKGO_BUILD_REFERENCE"] = True + tc.variables["GINKGO_BUILD_OMP"] = self.options.openmp + tc.variables["GINKGO_BUILD_CUDA"] = self.options.cuda + tc.variables["GINKGO_BUILD_HIP"] = False + if Version(self.version) >= "1.7.0": + tc.variables["GINKGO_BUILD_SYCL"] = False + else: + tc.variables["GINKGO_BUILD_DPCPP"] = False + tc.variables["GINKGO_BUILD_HWLOC"] = False + tc.variables["GINKGO_BUILD_MPI"] = 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() - 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", "Ginkgo") @@ -138,57 +149,86 @@ def package_info(self): self.cpp_info.set_property("pkg_config_name", "ginkgo") debug_suffix = "d" if self.settings.build_type == "Debug" else "" - has_dpcpp_device = tools.Version(self.version) >= "1.4.0" - - self.cpp_info.components["ginkgo_core"].set_property("cmake_target_name", "Ginkgo::ginkgo") - self.cpp_info.components["ginkgo_core"].set_property("pkg_config_name", "ginkgo") - self.cpp_info.components["ginkgo_core"].libs = [ - "ginkgo" + debug_suffix] + has_dpcpp_device = Version(self.version) >= "1.4.0" + # Shared MSVC builds ues a separate library for part of Ginkgo since 1.8.0 + has_config_library = Version(self.version) >= "1.8.0" and self.options.shared and self.settings.os == "Windows" + + self.cpp_info.components["ginkgo_core"].set_property( + "cmake_target_name", "Ginkgo::ginkgo" + ) + self.cpp_info.components["ginkgo_core"].set_property( + "pkg_config_name", "ginkgo" + ) + self.cpp_info.components["ginkgo_core"].libs = ["ginkgo" + debug_suffix] self.cpp_info.components["ginkgo_core"].requires = [ - "ginkgo_omp", "ginkgo_cuda", "ginkgo_reference", "ginkgo_hip" + "ginkgo_omp", + "ginkgo_cuda", + "ginkgo_reference", + "ginkgo_hip", ] - self.cpp_info.components["ginkgo_cuda"].set_property("cmake_target_name", "Ginkgo::ginkgo_cuda") - self.cpp_info.components["ginkgo_cuda"].libs = [ - "ginkgo_cuda" + debug_suffix] + self.cpp_info.components["ginkgo_cuda"].set_property( + "cmake_target_name", "Ginkgo::ginkgo_cuda" + ) + self.cpp_info.components["ginkgo_cuda"].libs = ["ginkgo_cuda" + debug_suffix] self.cpp_info.components["ginkgo_cuda"].requires = ["ginkgo_hip"] - self.cpp_info.components["ginkgo_omp"].set_property("cmake_target_name", "Ginkgo::ginkgo_omp") - self.cpp_info.components["ginkgo_omp"].libs = [ - "ginkgo_omp" + debug_suffix] - self.cpp_info.components["ginkgo_omp"].requires = [ - "ginkgo_cuda", "ginkgo_hip"] + self.cpp_info.components["ginkgo_omp"].set_property( + "cmake_target_name", "Ginkgo::ginkgo_omp" + ) + self.cpp_info.components["ginkgo_omp"].libs = ["ginkgo_omp" + debug_suffix] + self.cpp_info.components["ginkgo_omp"].requires = ["ginkgo_cuda", "ginkgo_hip"] - self.cpp_info.components["ginkgo_hip"].set_property("cmake_target_name", "Ginkgo::ginkgo_hip") - self.cpp_info.components["ginkgo_hip"].libs = [ - "ginkgo_hip" + debug_suffix] + self.cpp_info.components["ginkgo_hip"].set_property( + "cmake_target_name", "Ginkgo::ginkgo_hip" + ) + self.cpp_info.components["ginkgo_hip"].libs = ["ginkgo_hip" + debug_suffix] - self.cpp_info.components["ginkgo_reference"].set_property("cmake_target_name", "Ginkgo::ginkgo_reference") + self.cpp_info.components["ginkgo_reference"].set_property( + "cmake_target_name", "Ginkgo::ginkgo_reference" + ) self.cpp_info.components["ginkgo_reference"].libs = [ - "ginkgo_reference" + debug_suffix] + "ginkgo_reference" + debug_suffix + ] - if has_dpcpp_device: # Always add these components + if has_dpcpp_device: # Always add these components # See https://github.com/conan-io/conan-center-index/pull/7044#discussion_r698181588 self.cpp_info.components["ginkgo_core"].requires += ["ginkgo_dpcpp"] self.cpp_info.components["ginkgo_core"].requires += ["ginkgo_device"] - self.cpp_info.components["ginkgo_dpcpp"].set_property("cmake_target_name", "Ginkgo::ginkgo_dpcpp") + self.cpp_info.components["ginkgo_dpcpp"].set_property( + "cmake_target_name", "Ginkgo::ginkgo_dpcpp" + ) self.cpp_info.components["ginkgo_dpcpp"].libs = [ - "ginkgo_dpcpp" + debug_suffix] + "ginkgo_dpcpp" + debug_suffix + ] - self.cpp_info.components["ginkgo_device"].set_property("cmake_target_name", "Ginkgo::ginkgo_device") + self.cpp_info.components["ginkgo_device"].set_property( + "cmake_target_name", "Ginkgo::ginkgo_device" + ) self.cpp_info.components["ginkgo_device"].libs = [ - "ginkgo_device" + debug_suffix] + "ginkgo_device" + debug_suffix + ] self.cpp_info.components["ginkgo_omp"].requires += [ - "ginkgo_dpcpp", "ginkgo_device"] + "ginkgo_dpcpp", + "ginkgo_device", + ] self.cpp_info.components["ginkgo_reference"].requires += ["ginkgo_device"] self.cpp_info.components["ginkgo_hip"].requires += ["ginkgo_device"] self.cpp_info.components["ginkgo_cuda"].requires += ["ginkgo_device"] self.cpp_info.components["ginkgo_dpcpp"].requires += ["ginkgo_device"] + + if has_config_library: + self.cpp_info.components["ginkgo_core"].requires += ["ginkgo_config"] + + self.cpp_info.components["ginkgo_config"].set_property("cmake_target_name", "Ginkgo::ginkgo_core") + self.cpp_info.components["ginkgo_config"].libs = ["ginkgo_core" + debug_suffix] # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.names["cmake_find_package"] = "Ginkgo" self.cpp_info.names["cmake_find_package_multi"] = "Ginkgo" self.cpp_info.components["ginkgo_core"].names["cmake_find_package"] = "ginkgo" - self.cpp_info.components["ginkgo_core"].names["cmake_find_package_multi"] = "ginkgo" + self.cpp_info.components["ginkgo_core"].names[ + "cmake_find_package_multi" + ] = "ginkgo" diff --git a/recipes/ginkgo/all/patches/libc++-chrono.patch b/recipes/ginkgo/all/patches/libc++-chrono.patch new file mode 100644 index 0000000000000..81e20b2bc3b95 --- /dev/null +++ b/recipes/ginkgo/all/patches/libc++-chrono.patch @@ -0,0 +1,17 @@ +--- + core/base/timer.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/core/base/timer.cpp b/core/base/timer.cpp +index 786c31cae39..2c587ff0d8c 100644 +--- a/core/base/timer.cpp ++++ b/core/base/timer.cpp +@@ -124,7 +124,7 @@ void CpuTimer::wait(time_point& time) {} + std::chrono::nanoseconds CpuTimer::difference_async(const time_point& start, + const time_point& stop) + { +- return std::chrono::duration_cast( ++ return std::chrono::duration_cast( + stop.data_.chrono - start.data_.chrono); + } + diff --git a/recipes/ginkgo/all/test_package/CMakeLists.txt b/recipes/ginkgo/all/test_package/CMakeLists.txt index f3372b703d4f2..b153fe63054f5 100644 --- a/recipes/ginkgo/all/test_package/CMakeLists.txt +++ b/recipes/ginkgo/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(Ginkgo REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} Ginkgo::ginkgo) -set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 14) +target_link_libraries(${PROJECT_NAME} PRIVATE Ginkgo::ginkgo) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/ginkgo/all/test_package/conanfile.py b/recipes/ginkgo/all/test_package/conanfile.py index 38f4483872d47..98ab55852ad56 100644 --- a/recipes/ginkgo/all/test_package/conanfile.py +++ b/recipes/ginkgo/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/ginkgo/all/test_v1_package/CMakeLists.txt b/recipes/ginkgo/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/ginkgo/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/ginkgo/all/test_v1_package/conanfile.py b/recipes/ginkgo/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/ginkgo/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/ginkgo/config.yml b/recipes/ginkgo/config.yml index 25c9b4921636c..ae16141456580 100644 --- a/recipes/ginkgo/config.yml +++ b/recipes/ginkgo/config.yml @@ -1,4 +1,8 @@ versions: + "1.8.0": + folder: all + "1.7.0": + folder: all "1.4.0": folder: all "1.3.0": diff --git a/recipes/gklib/all/CMakeLists.txt b/recipes/gklib/all/CMakeLists.txt deleted file mode 100644 index 17aa471de5c7b..0000000000000 --- a/recipes/gklib/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper LANGUAGES C) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/gklib/all/conandata.yml b/recipes/gklib/all/conandata.yml index 65acd4434d084..9326c830cfc5f 100644 --- a/recipes/gklib/all/conandata.yml +++ b/recipes/gklib/all/conandata.yml @@ -5,8 +5,14 @@ sources: patches: "5.1.1": - patch_file: "patches/001-install-win32-headers.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "Install win32 headers" - patch_file: "patches/002-disable-tests.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "Disable tests" - patch_file: "patches/003-install-runtime.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "Install runtime" + - patch_file: "patches/004-increase-minimum-cmakelists.patch" + patch_type: "conan" + patch_description: "Increase minium CMake version required" diff --git a/recipes/gklib/all/conanfile.py b/recipes/gklib/all/conanfile.py index c9233e206a92a..17e3f51c1d534 100644 --- a/recipes/gklib/all/conanfile.py +++ b/recipes/gklib/all/conanfile.py @@ -1,8 +1,11 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -from conan.tools.files import apply_conandata_patches +from os import path +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 +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class GKlibConan(ConanFile): @@ -13,6 +16,7 @@ class GKlibConan(ConanFile): description = "A library of various helper routines and frameworks" \ " used by many of the lab's software" topics = ("karypislab") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -22,29 +26,13 @@ class GKlibConan(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"] @property def _is_mingw(self): return self.settings.os == "Windows" and self.settings.compiler == "gcc" 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": @@ -52,45 +40,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.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): - if self.options.shared and self._is_msvc: + if self.options.shared and is_msvc(self): raise ConanInvalidConfiguration( f"{self.name} {self.version} shared 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 _patch_sources(self): - apply_conandata_patches(self) + def generate(self): + tc = CMakeToolchain(self) - def _configure_cmake(self): - if not self._cmake: - self._cmake = CMake(self) - self._cmake.definitions["ASSERT"] = self.settings.build_type == "Debug" - self._cmake.definitions["ASSERT2"] = self.settings.build_type == "Debug" - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + tc.variables["ASSERT"] = self.settings.build_type == "Debug" + tc.variables["ASSERT2"] = self.settings.build_type == "Debug" + + 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): - cmake = self._configure_cmake() + copy(self, pattern="LICENSE.txt", src=self.source_folder, + dst=path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - self.copy("LICENSE.txt", src=self._source_subfolder, dst="licenses") def package_info(self): self.cpp_info.libs = ["GKlib"] + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("m") - if self._is_msvc or self._is_mingw: + if is_msvc(self) or self._is_mingw: self.cpp_info.defines.append("USE_GKREGEX") - if self._is_msvc: + if is_msvc(self): self.cpp_info.defines.append("__thread=__declspec(thread)") diff --git a/recipes/gklib/all/patches/004-increase-minimum-cmakelists.patch b/recipes/gklib/all/patches/004-increase-minimum-cmakelists.patch new file mode 100644 index 0000000000000..fc47c174baee0 --- /dev/null +++ b/recipes/gklib/all/patches/004-increase-minimum-cmakelists.patch @@ -0,0 +1,22 @@ +From 216537a5a9f882005b1c1a762130b32b6f0c46a6 Mon Sep 17 00:00:00 2001 +From: Joakim Haugen +Date: Mon, 15 May 2023 10:34:16 +0200 +Subject: [PATCH] Increase minimum requires CMakeLists version + +--- + CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 2bc6f77..9ef8038 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,4 +1,4 @@ +-cmake_minimum_required(VERSION 2.8) ++cmake_minimum_required(VERSION 3.4) + project(GKlib C) + + option(BUILD_SHARED_LIBS "Build shared libraries (.dll/.so) instead of static ones (.lib/.a)" OFF) +-- +2.30.2 + diff --git a/recipes/gklib/all/test_package/CMakeLists.txt b/recipes/gklib/all/test_package/CMakeLists.txt index b012d77ecf242..1e94195212cdd 100644 --- a/recipes/gklib/all/test_package/CMakeLists.txt +++ b/recipes/gklib/all/test_package/CMakeLists.txt @@ -1,10 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package C) +cmake_minimum_required(VERSION 3.15) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package C) find_package(gklib REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} gklib::gklib) +target_link_libraries(${PROJECT_NAME} PRIVATE gklib::gklib) diff --git a/recipes/gklib/all/test_package/conanfile.py b/recipes/gklib/all/test_package/conanfile.py index 46d71712aba54..ef5d7042163ec 100644 --- a/recipes/gklib/all/test_package/conanfile.py +++ b/recipes/gklib/all/test_package/conanfile.py @@ -1,17 +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 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 requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -19,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/gklib/all/test_v1_package/CMakeLists.txt b/recipes/gklib/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..9735bda16bdf4 --- /dev/null +++ b/recipes/gklib/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +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/gklib/all/test_v1_package/conanfile.py b/recipes/gklib/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..20d4d2e28d57e --- /dev/null +++ b/recipes/gklib/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/glad/all/CMakeLists.txt b/recipes/glad/all/CMakeLists.txt deleted file mode 100644 index 354ee565338ae..0000000000000 --- a/recipes/glad/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/glad/all/conandata.yml b/recipes/glad/all/conandata.yml index e0ca7c0f4e158..1dba3ce94b4ce 100644 --- a/recipes/glad/all/conandata.yml +++ b/recipes/glad/all/conandata.yml @@ -14,13 +14,9 @@ sources: patches: "0.1.36": - patch_file: "patches/0003-CMake-handle-all-specs.patch" - base_path: "source_subfolder" "0.1.35": - patch_file: "patches/0003-CMake-handle-all-specs.patch" - base_path: "source_subfolder" "0.1.34": - patch_file: "patches/0002-CMake-handle-all-specs.patch" - base_path: "source_subfolder" "0.1.33": - patch_file: "patches/0001-CMake-handle-all-specs.patch" - base_path: "source_subfolder" diff --git a/recipes/glad/all/conanfile.py b/recipes/glad/all/conanfile.py index 5d47319c5575a..6e5e16777a859 100644 --- a/recipes/glad/all/conanfile.py +++ b/recipes/glad/all/conanfile.py @@ -1,17 +1,17 @@ import os -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, collect_libs, copy, export_conandata_patches, get, rmdir +from conan.errors import ConanInvalidConfiguration class GladConan(ConanFile): name = "glad" description = "Multi-Language GL/GLES/EGL/GLX/WGL Loader-Generator based on the official specs." - topics = ("conan", "glad", "opengl") + topics = ("opengl",) url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/Dav1dde/glad" license = "MIT" - exports_sources = ["CMakeLists.txt", "patches/*.patch"] - generators = "cmake" settings = "os", "compiler", "build_type", "arch" options = { @@ -19,7 +19,7 @@ class GladConan(ConanFile): "fPIC": [True, False], "no_loader": [True, False], "spec": ["gl", "egl", "glx", "wgl"], # Name of the spec - "extensions": "ANY", # Path to extensions file or comma separated list of extensions, if missing all extensions are included + "extensions": ["ANY"], # Path to extensions file or comma separated list of extensions, if missing all extensions are included # if specification is gl "gl_profile": ["compatibility", "core"], "gl_version": ["None", "1.0", "1.1", "1.2", "1.3", "1.4", "1.5", "2.0", @@ -41,7 +41,7 @@ class GladConan(ConanFile): "fPIC": True, "no_loader": False, "spec": "gl", - "extensions": "''", + "extensions": "", "gl_profile": "compatibility", "gl_version": "3.3", "gles1_version": "None", @@ -52,15 +52,8 @@ class GladConan(ConanFile): "wgl_version": "None" } - _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": @@ -68,9 +61,10 @@ 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 self.options.spec != "gl": del self.options.gl_profile @@ -88,38 +82,35 @@ def configure(self): if self.options.spec != "wgl": del self.options.wgl_version + def validate(self): if self.options.spec == "wgl" and self.settings.os != "Windows": - raise ConanInvalidConfiguration("{0} specification is not compatible with {1}".format(self.options.spec, - self.settings.os)) + raise ConanInvalidConfiguration(f"{self.ref}:{self.options.spec} specification is not compatible with {self.settings.os}") + + 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + if "gl_profile" in self.options: + tc.variables["GLAD_PROFILE"] = self.options.gl_profile + tc.variables["GLAD_API"] = self._get_api() + tc.variables["GLAD_EXTENSIONS"] = self.options.extensions + tc.variables["GLAD_SPEC"] = self.options.spec + tc.variables["GLAD_NO_LOADER"] = self.options.no_loader + tc.variables["GLAD_GENERATOR"] = "c" if self.settings.build_type == "Release" else "c-debug" + tc.variables["GLAD_EXPORT"] = True + tc.variables["GLAD_INSTALL"] = 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 _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - if "gl_profile" in self.options: - self._cmake.definitions["GLAD_PROFILE"] = self.options.gl_profile - self._cmake.definitions["GLAD_API"] = self._get_api() - self._cmake.definitions["GLAD_EXTENSIONS"] = self.options.extensions - self._cmake.definitions["GLAD_SPEC"] = self.options.spec - self._cmake.definitions["GLAD_NO_LOADER"] = self.options.no_loader - self._cmake.definitions["GLAD_GENERATOR"] = "c" if self.settings.build_type == "Release" else "c-debug" - self._cmake.definitions["GLAD_EXPORT"] = True - self._cmake.definitions["GLAD_INSTALL"] = True - - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake - def _get_api(self): if self.options.spec == "gl": spec_api = { @@ -135,20 +126,19 @@ def _get_api(self): elif self.options.spec == "wgl": spec_api = {"wgl": self.options.wgl_version} - api_concat = ",".join("{0}={1}".format(api_name, api_version) + api_concat = ",".join(f"{api_name}={api_version}".format() for api_name, api_version in spec_api.items() if api_version != "None") return api_concat def package(self): - cmake = self._configure_cmake() - cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + CMake(self).install() + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = collect_libs(self) if self.options.shared: self.cpp_info.defines = ["GLAD_GLAPI_EXPORT"] if self.settings.os == "Linux": diff --git a/recipes/glad/all/test_package/CMakeLists.txt b/recipes/glad/all/test_package/CMakeLists.txt index 9c415f835d0f1..672dd8a2797af 100644 --- a/recipes/glad/all/test_package/CMakeLists.txt +++ b/recipes/glad/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() +project(test_package LANGUAGES C) find_package(glad REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} glad::glad) +target_link_libraries(${PROJECT_NAME} PRIVATE glad::glad) diff --git a/recipes/glad/all/test_package/conanfile.py b/recipes/glad/all/test_package/conanfile.py index b6a26067f365d..6c4fa6db1be46 100644 --- a/recipes/glad/all/test_package/conanfile.py +++ b/recipes/glad/all/test_package/conanfile.py @@ -1,17 +1,26 @@ import os +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout -from conans import ConanFile, CMake, tools class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + 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(self.tested_reference_str) + 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/glad/all/test_v1_package/CMakeLists.txt b/recipes/glad/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..393ceb7e700f6 --- /dev/null +++ b/recipes/glad/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() + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/glad/all/test_v1_package/conanfile.py b/recipes/glad/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..90eb89e3f2f46 --- /dev/null +++ b/recipes/glad/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/glaze/all/conandata.yml b/recipes/glaze/all/conandata.yml index d9cb0b695b150..976be9b27337a 100644 --- a/recipes/glaze/all/conandata.yml +++ b/recipes/glaze/all/conandata.yml @@ -1,22 +1,40 @@ sources: - "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" + "4.0.1": + url: "https://github.com/stephenberry/glaze/archive/v4.0.1.tar.gz" + sha256: "0026aca33201ee6d3a820fb5926f36ba8c838bfd3120e2e179b0eee62b5bd231" + "3.6.2": + url: "https://github.com/stephenberry/glaze/archive/v3.6.2.tar.gz" + sha256: "74b14656b7a47c0a03d0a857adf5059e8c2351a7a84623593be0dd16b293216c" + "3.6.1": + url: "https://github.com/stephenberry/glaze/archive/v3.6.1.tar.gz" + sha256: "70324ad952adee32d6bbf95a0983f0c1623ce61bd237aa28c8337af2d8bb9ed5" + # keep 3.4.3 for breaking change: API(naming) change + "3.4.3": + url: "https://github.com/stephenberry/glaze/archive/v3.4.3.tar.gz" + sha256: "2af1ecc9fbdcb8182d5633979a12b950f6728dd0d76f02affa1e11b1a3369314" + "3.4.1": + url: "https://github.com/stephenberry/glaze/archive/v3.4.1.tar.gz" + sha256: "73a38c4d7731714581061a918b33ad57cf38404abc68d9a58dbe57d56fe26a79" + "3.3.4": + url: "https://github.com/stephenberry/glaze/archive/v3.3.4.tar.gz" + sha256: "7fe31c14e7ede69d937aa8f126894fef11ebf3156f25cb95446d3d6d38e9da9c" + "3.3.2": + url: "https://github.com/stephenberry/glaze/archive/v3.3.2.tar.gz" + sha256: "e492d3f662c3c096ce7abac86780af6c84f74c4f19b29223ad92fccc054aafad" + "3.3.1": + url: "https://github.com/stephenberry/glaze/archive/v3.3.1.tar.gz" + sha256: "edb16f7b75bf9a7c86a704c006a9859474e1d49467f8ddeabdc8c3a3d5a982a2" + "3.1.9": + url: "https://github.com/stephenberry/glaze/archive/v3.1.9.tar.gz" + sha256: "adfce5acc9d3d88525c006a525e8f21d2a4bb628b5f7022720625f052d88a73d" + "3.1.7": + url: "https://github.com/stephenberry/glaze/archive/v3.1.7.tar.gz" + sha256: "388483bb3dfa1fe25c1dfec24f0afd1651e0303833cfa1b7f51020a2569e992a" + # keep 2.9.5 for c++20 compilers + "2.9.5": + url: "https://github.com/stephenberry/glaze/archive/v2.9.5.tar.gz" + sha256: "67fda0fb0cc701451c261bb1e0c94d63bafaaba13390527521e02a034eff085e" + # keep 2.8.4 for breaking change: pure reflection support for C style arrays + "2.8.4": + url: "https://github.com/stephenberry/glaze/archive/v2.8.4.tar.gz" + sha256: "6ca8e63783f0a1dbe69f50c0bc289134301ecf930ada83489b9715cdd2a49252" diff --git a/recipes/glaze/all/conanfile.py b/recipes/glaze/all/conanfile.py index 0b0ed09d3669b..e353497cda64e 100644 --- a/recipes/glaze/all/conanfile.py +++ b/recipes/glaze/all/conanfile.py @@ -4,6 +4,7 @@ from conan.tools.build import check_min_cppstd from conan.tools.scm import Version from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc import os required_conan_version = ">=1.51.1" @@ -15,61 +16,53 @@ class GlazeConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/stephenberry/glaze" topics = ("json", "memory", "header-only") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @property - def _minimum_cpp_standard(self): - return 20 + def _min_cppstd(self): + return "20" if Version(self.version) < "3.0.0" else "23" @property def _compilers_minimum_version(self): return { - "Visual Studio": "16", - "msvc": "192", - "gcc": "11", - "clang": "12", - "apple-clang": "13.1", - } + "20": { + "Visual Studio": "17", + "msvc": "193", + "gcc": "11" if Version(self.version) < "2.6.3" else "12", + "clang": "14", + "apple-clang": "13.1", + }, + "23": { + "Visual Studio": "17", + "msvc": "193", + "gcc": "12", + "clang": "15", + "apple-clang": "14", + }, + }.get(self._min_cppstd, {}) def layout(self): basic_layout(self, src_folder="src") - def requirements(self): - self.requires("fmt/9.1.0") - self.requires("fast_float/3.8.1") - self.requires("frozen/1.1.1") - self.requires("nanorange/20200505") - if Version(self.version) >= "0.1.5": - 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] - + 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 loose_lt_semver(str(self.settings.compiler.version), minimum_version): + if minimum_version and Version(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.", + 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 + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): - copy(self, pattern="LICENSE.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, pattern="LICENSE*", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) copy( self, pattern="*.hpp", @@ -80,3 +73,5 @@ def package(self): def package_info(self): self.cpp_info.bindirs = [] self.cpp_info.libdirs = [] + if is_msvc(self): + self.cpp_info.cxxflags.append("/Zc:preprocessor") diff --git a/recipes/glaze/all/test_package/CMakeLists.txt b/recipes/glaze/all/test_package/CMakeLists.txt index 4811c5114c3c2..fc973c8b2b019 100644 --- a/recipes/glaze/all/test_package/CMakeLists.txt +++ b/recipes/glaze/all/test_package/CMakeLists.txt @@ -1,8 +1,12 @@ -cmake_minimum_required(VERSION 3.12) +cmake_minimum_required(VERSION 3.20) 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) +if(glaze_VERSION VERSION_GREATER_EQUAL "3.0.0") + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_23) +else() + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) +endif() diff --git a/recipes/glaze/all/test_package/conanfile.py b/recipes/glaze/all/test_package/conanfile.py index a9fb96656f203..9fd1075c52a6b 100644 --- a/recipes/glaze/all/test_package/conanfile.py +++ b/recipes/glaze/all/test_package/conanfile.py @@ -15,6 +15,9 @@ def requirements(self): def layout(self): cmake_layout(self) + def build_requirements(self): + self.tool_requires("cmake/[>=3.20 <4]") + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/glaze/all/test_package/test_package.cpp b/recipes/glaze/all/test_package/test_package.cpp index 19dbb41c1ae8f..8dbee5ab44d50 100644 --- a/recipes/glaze/all/test_package/test_package.cpp +++ b/recipes/glaze/all/test_package/test_package.cpp @@ -23,11 +23,21 @@ struct glz::meta { 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); +#ifdef GLAZE_USE_EXCEPTION + auto s = glz::read_json(buffer); (void)s.d; (void)s.hello; (void)s.arr; +#else + auto s = glz::read_json(buffer); + + if (s) { + (void)s.value().d; + (void)s.value().hello; + (void)s.value().arr; + } +#endif return 0; } diff --git a/recipes/glaze/config.yml b/recipes/glaze/config.yml index a951e691f29d8..3055b2585ba67 100644 --- a/recipes/glaze/config.yml +++ b/recipes/glaze/config.yml @@ -1,15 +1,25 @@ versions: - "0.2.2": + "4.0.1": folder: all - "0.2.1": + "3.6.2": folder: all - "0.2.0": + "3.6.1": folder: all - "0.1.8": + "3.4.3": folder: all - "0.1.7": + "3.4.1": folder: all - "0.1.4": + "3.3.4": folder: all - "0.0.7": + "3.3.2": + folder: all + "3.3.1": + folder: all + "3.1.9": + folder: all + "3.1.7": + folder: all + "2.9.5": + folder: all + "2.8.4": folder: all diff --git a/recipes/glbinding/all/conandata.yml b/recipes/glbinding/all/conandata.yml index c3868ee88cb4c..9b8d3422ed887 100644 --- a/recipes/glbinding/all/conandata.yml +++ b/recipes/glbinding/all/conandata.yml @@ -1,8 +1,13 @@ sources: + "3.3.0": + url: "https://github.com/cginternals/glbinding/archive/v3.3.0.tar.gz" + sha256: "a0aa5e67b538649979a71705313fc2b2c3aa49cf9af62a97f7ee9a665fd30564" "3.1.0": url: "https://github.com/cginternals/glbinding/archive/v3.1.0.tar.gz" sha256: "6729b260787108462ec6d8954f32a3f11f959ada7eebf1a2a33173b68762849e" patches: + "3.3.0": + - patch_file: "patches/3.3/cmake-install.patch" "3.1.0": - - patch_file: "patches/cmake-install.patch" - - patch_file: "patches/getProcAddr.patch" + - patch_file: "patches/3.1/cmake-install.patch" + - patch_file: "patches/3.1/getProcAddr.patch" 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/patches/cmake-install.patch b/recipes/glbinding/all/patches/3.1/cmake-install.patch similarity index 100% rename from recipes/glbinding/all/patches/cmake-install.patch rename to recipes/glbinding/all/patches/3.1/cmake-install.patch diff --git a/recipes/glbinding/all/patches/getProcAddr.patch b/recipes/glbinding/all/patches/3.1/getProcAddr.patch similarity index 100% rename from recipes/glbinding/all/patches/getProcAddr.patch rename to recipes/glbinding/all/patches/3.1/getProcAddr.patch diff --git a/recipes/glbinding/all/patches/3.3/cmake-install.patch b/recipes/glbinding/all/patches/3.3/cmake-install.patch new file mode 100644 index 0000000000000..2e146402917de --- /dev/null +++ b/recipes/glbinding/all/patches/3.3/cmake-install.patch @@ -0,0 +1,16 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -179,11 +179,11 @@ if(UNIX AND SYSTEM_DIR_INSTALL) + set(INSTALL_INIT "/etc/init") # /etc/init (upstart init scripts) + else() + # Install into local directory +- set(INSTALL_ROOT ".") # ./ ++ set(INSTALL_ROOT "share") # ./ + set(INSTALL_CMAKE "cmake") # ./cmake + set(INSTALL_EXAMPLES ".") # ./ + set(INSTALL_DATA ".") # ./ +- set(INSTALL_BIN ".") # ./ ++ set(INSTALL_BIN "bin") # ./ + set(INSTALL_SHARED "lib") # ./lib + set(INSTALL_LIB "lib") # ./lib + set(INSTALL_INCLUDE "include") # ./include 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/glbinding/config.yml b/recipes/glbinding/config.yml index baa80af0c4b7d..e574d205652e6 100644 --- a/recipes/glbinding/config.yml +++ b/recipes/glbinding/config.yml @@ -1,3 +1,5 @@ versions: + "3.3.0": + folder: all "3.1.0": folder: all diff --git a/recipes/glew/all/conanfile.py b/recipes/glew/all/conanfile.py index 75e5f17da8e37..990bfc4644ddd 100644 --- a/recipes/glew/all/conanfile.py +++ b/recipes/glew/all/conanfile.py @@ -1,9 +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, CMakeToolchain, cmake_layout from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class GlewConan(ConanFile): @@ -13,12 +15,13 @@ class GlewConan(ConanFile): homepage = "http://github.com/nigels-com/glew" topics = ("glew", "opengl", "wrangler", "loader", "binding") license = "MIT" - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], "with_egl": [True, False], + "with_glu": ["mesa-glu", "system"] } default_options = { "shared": False, @@ -29,36 +32,40 @@ class GlewConan(ConanFile): def export_sources(self): export_conandata_patches(self) + def validate(self): + if self.options.with_glu == "mesa-glu" and (is_apple_os(self) or self.settings.os == "Windows"): + raise ConanInvalidConfiguration("mesa-glu only suppported on Linux.") + def config_options(self): if self.settings.os == "Windows": del self.options.fPIC del self.options.with_egl + if self.options.with_glu == None: + if is_apple_os(self) or self.settings.os == "Windows": + self.options.with_glu = "system" + else: + self.options.with_glu = "mesa-glu" + 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 + 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") - self.requires("glu/system") + # GL/glew.h includes glu.h. + if self.options.with_glu == "mesa-glu": + self.requires("mesa-glu/9.0.3", transitive_headers=True) + else: + self.requires("glu/system", transitive_headers=True) 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,7 +91,6 @@ def package_info(self): glewlib_target_name = "glew" if self.options.shared else "glew_s" self.cpp_info.set_property("cmake_find_mode", "both") self.cpp_info.set_property("cmake_module_file_name", "GLEW") - self.cpp_info.set_property("cmake_file_name", "glew") self.cpp_info.set_property("cmake_target_name", "GLEW::GLEW") self.cpp_info.set_property("pkg_config_name", "glew") self.cpp_info.components["glewlib"].set_property("cmake_module_target_name", "GLEW::GLEW") @@ -100,12 +106,9 @@ def package_info(self): self.cpp_info.components["glewlib"].libs = [lib_name] if self.settings.os == "Windows" and not self.options.shared: self.cpp_info.components["glewlib"].defines.append("GLEW_STATIC") - self.cpp_info.components["glewlib"].requires = ["opengl::opengl", "glu::glu"] - - # TODO: to remove in conan v2 once cmake_find_package_* generators removed - self.cpp_info.filenames["cmake_find_package"] = "GLEW" - self.cpp_info.filenames["cmake_find_package_multi"] = "glew" - self.cpp_info.names["cmake_find_package"] = "GLEW" - self.cpp_info.names["cmake_find_package_multi"] = "GLEW" - self.cpp_info.components["glewlib"].names["cmake_find_package"] = "GLEW" - self.cpp_info.components["glewlib"].names["cmake_find_package_multi"] = glewlib_target_name + self.cpp_info.components["glewlib"].requires = ["opengl::opengl"] + + if self.options.with_glu == "mesa-glu": + self.cpp_info.components["glewlib"].requires.append("mesa-glu::mesa-glu") + else: + self.cpp_info.components["glewlib"].requires.append("glu::glu") diff --git a/recipes/glew/all/test_package/CMakeLists.txt b/recipes/glew/all/test_package/CMakeLists.txt index f7e367639f538..116694086f70b 100644 --- a/recipes/glew/all/test_package/CMakeLists.txt +++ b/recipes/glew/all/test_package/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package LANGUAGES C) find_package(GLEW REQUIRED) diff --git a/recipes/glew/all/test_v1_package/CMakeLists.txt b/recipes/glew/all/test_v1_package/CMakeLists.txt deleted file mode 100644 index abaffb362cf82..0000000000000 --- a/recipes/glew/all/test_v1_package/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -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/glext/all/conanfile.py b/recipes/glext/all/conanfile.py index 746356cd3af89..3cbf2eff985c1 100644 --- a/recipes/glext/all/conanfile.py +++ b/recipes/glext/all/conanfile.py @@ -1,35 +1,51 @@ import os -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.tools.files import copy, download, load, save +from conan.tools.layout import basic_layout + +required_conan_version = ">=1.52.0" -required_conan_version = ">=1.37.0" class GlextConan(ConanFile): name = "glext" + description = "OpenGL 1.2 and above compatibility profile and extension interfaces" license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.khronos.org/registry/OpenGL/index_gl.php" - description = "OpenGL 1.2 and above compatibility profile and extension interfaces" - topics = ("opengl", "gl", "glext") + topics = ("opengl", "gl", "glext", "header-only") + + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True + def layout(self): + basic_layout(self, src_folder="src") + def requirements(self): self.requires("opengl/system") self.requires("khrplatform/cci.20200529") + def package_id(self): + self.info.clear() + def source(self): - tools.download(filename="glext.h", **self.conan_data["sources"][self.version]) + download(self, filename="glext.h", **self.conan_data["sources"][self.version]) - def package(self): - self.copy(pattern="glext.h", dst=os.path.join("include", "GL")) - license_data = tools.load(os.path.join(self.source_folder, "glext.h")) + def _extract_license(self): + license_data = load(self, os.path.join(self.source_folder, "glext.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") + save(self, os.path.join(self.package_folder, "licenses", "LICENSE"), license_data) - def package_id(self): - self.info.header_only() + def package(self): + self._extract_license() + copy(self, "glext.h", + dst=os.path.join(self.package_folder, "include", "GL"), + src=self.source_folder) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/glext/all/test_package/CMakeLists.txt b/recipes/glext/all/test_package/CMakeLists.txt index b455e673a3ef0..02474af2d5d00 100644 --- a/recipes/glext/all/test_package/CMakeLists.txt +++ b/recipes/glext/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() - find_package(glext REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) diff --git a/recipes/glext/all/test_package/conanfile.py b/recipes/glext/all/test_package/conanfile.py index 49a3a66ea5bad..ef5d7042163ec 100644 --- a/recipes/glext/all/test_package/conanfile.py +++ b/recipes/glext/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/glfw/all/conandata.yml b/recipes/glfw/all/conandata.yml index f81e146ca342e..55bea05ef59a0 100644 --- a/recipes/glfw/all/conandata.yml +++ b/recipes/glfw/all/conandata.yml @@ -1,25 +1,27 @@ sources: + "3.4": + url: "https://github.com/glfw/glfw/releases/download/3.4/glfw-3.4.zip" + sha256: "b5ec004b2712fd08e8861dc271428f048775200a2df719ccf575143ba749a3e9" "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" - "3.3.6": - url: "https://github.com/glfw/glfw/archive/refs/tags/3.3.6.tar.gz" - sha256: "ed07b90e334dcd39903e6288d90fa1ae0cf2d2119fec516cf743a0a404527c02" - "3.3.5": - url: "https://github.com/glfw/glfw/archive/refs/tags/3.3.5.tar.gz" - sha256: "32fdb8705784adfe3082f97e0d41e7c515963e977b5a14c467a887cf0da827b5" - "3.3.4": - url: "https://github.com/glfw/glfw/archive/3.3.4.tar.gz" - sha256: "cc8ac1d024a0de5fd6f68c4133af77e1918261396319c24fd697775a6bc93b63" - "3.3.3": - sha256: aa9922b55a464d5bab58fcbe5a619f517d54e3dc122361c116de573670006a7a - url: https://github.com/glfw/glfw/archive/3.3.3.tar.gz - "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.7/glfw-3.3.7.zip" + sha256: "4ef0c544a8ace9a6cd0e0aef8250090f89fea1bf96e9fc1d9d6f76386c290c9c" patches: - "3.3.2": - - patch_file: "patches/fix-objc-cmake3.19+.patch" + "3.3.8": + - patch_file: "patches/3.3.5-0001-Wayland-Remove-extra-cmake-modules-dependency.patch" + patch_description: "Remove dependency on extra-cmake-modules to fix generation of Wayland Protocols" + patch_type: "official" + patch_source: "https://github.com/glfw/glfw/commit/2747e47393cbca2d09db56223e735bd94b21e2eb" + "3.3.7": + - patch_file: "patches/3.3.5-0001-Wayland-Remove-extra-cmake-modules-dependency.patch" + patch_description: "Remove dependency on extra-cmake-modules to fix generation of Wayland Protocols" + patch_type: "official" + patch_source: "https://github.com/glfw/glfw/commit/2747e47393cbca2d09db56223e735bd94b21e2eb" + "3.3.6": + - patch_file: "patches/3.3.5-0001-Wayland-Remove-extra-cmake-modules-dependency.patch" + patch_description: "Remove dependency on extra-cmake-modules to fix generation of Wayland Protocols" + patch_type: "official" + patch_source: "https://github.com/glfw/glfw/commit/2747e47393cbca2d09db56223e735bd94b21e2eb" + \ No newline at end of file diff --git a/recipes/glfw/all/conanfile.py b/recipes/glfw/all/conanfile.py index 70718f2458b26..feaae050b7850 100644 --- a/recipes/glfw/all/conanfile.py +++ b/recipes/glfw/all/conanfile.py @@ -1,11 +1,15 @@ from conan import ConanFile -from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.errors import ConanInvalidConfiguration +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, export_conandata_patches, get, replace_in_file, rmdir, save +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 import textwrap -required_conan_version = ">=1.53.0" +required_conan_version = ">=2.0.5" class GlfwConan(ConanFile): @@ -17,25 +21,39 @@ class GlfwConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/glfw/glfw" topics = ("graphics", "opengl", "vulkan", "opengl-es") - + package_type = "library" settings = "os", "arch", "build_type", "compiler" options = { "shared": [True, False], "fPIC": [True, False], "vulkan_static": [True, False], + "with_x11": [True, False], + "with_wayland": [True, False], } default_options = { "shared": False, "fPIC": True, "vulkan_static": False, + "with_x11": True, + "with_wayland": False, } + @property + def _has_build_profile(self): + return hasattr(self, "settings_build") + 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") + if self.settings.os != "Linux": + self.options.rm_safe("with_wayland") + if self.settings.os not in ["Linux", "FreeBSD"] or Version(self.version) <= "3.3.8": + self.options.rm_safe("with_x11") + if Version(self.version) >= "3.4": + self.options.rm_safe("vulkan_static") def configure(self): if self.options.shared: @@ -43,42 +61,105 @@ def configure(self): self.settings.rm_safe("compiler.cppstd") self.settings.rm_safe("compiler.libcxx") + if self.options.get_safe("with_wayland"): + self.options["xkbcommon"].with_wayland = True + self.options["wayland"].shared = True + self.options["xkbcommon"].shared = True + 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.231.1") + # libs=False because glfw does not link to opengl, it + # loads it via dlopen or equivalent + self.requires("opengl/system", libs=False, transitive_headers=True) + if self.options.get_safe("vulkan_static"): + self.requires("vulkan-loader/1.3.268.0") if self.settings.os in ["Linux", "FreeBSD"]: - self.requires("xorg/system") + if self.options.get_safe("with_x11", True): + self.requires("xorg/system") + if self.options.get_safe("with_wayland"): + self.requires("wayland/1.22.0") + self.requires("xkbcommon/1.6.0") + + def validate(self): + if self.options.get_safe("with_wayland"): + xkbcommon_options = self.dependencies["xkbcommon"].options + if not xkbcommon_options.with_wayland: + raise ConanInvalidConfiguration(f"{self.ref} requires the with_wayland option in xkbcommon to be enabled when the with_wayland option is enabled") + if not xkbcommon_options.shared: + raise ConanInvalidConfiguration(f"{self.ref} always loads xkbcommon dependencies dynamically and does not support static linkage") + if not self.dependencies["wayland"].options.shared: + raise ConanInvalidConfiguration(f"{self.ref} always loads wayland dependencies dynamically and does not support static linkage") + + def build_requirements(self): + if self.options.get_safe("with_wayland"): + self.tool_requires("wayland-protocols/1.33") + if self._has_build_profile: + self.tool_requires("wayland/") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/[>=2.2 <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 self.options.get_safe("with_wayland") and not self._has_build_profile: + env = VirtualRunEnv(self) + env.generate(scope="build") + tc = CMakeToolchain(self) - tc.variables["GLFW_BUILD_EXAMPLES"] = False - tc.variables["GLFW_BUILD_TESTS"] = False - tc.variables["GLFW_BUILD_DOCS"] = False - tc.variables["GLFW_INSTALL"] = True - tc.variables["GLFW_VULKAN_STATIC"] = self.options.vulkan_static + tc.cache_variables["GLFW_BUILD_DOCS"] = False + tc.cache_variables["GLFW_BUILD_EXAMPLES"] = False + tc.cache_variables["GLFW_BUILD_TESTS"] = False + tc.cache_variables["GLFW_INSTALL"] = True + if Version(self.version) > "3.3.8": + tc.cache_variables["GLFW_BUILD_X11"] = self.options.get_safe("with_x11", False) + tc.cache_variables["GLFW_BUILD_WAYLAND"] = self.options.get_safe("with_wayland", False) + else: + tc.cache_variables["GLFW_USE_WAYLAND"] = self.options.get_safe("with_wayland", False) + if Version(self.version) < "3.4": + tc.cache_variables["GLFW_VULKAN_STATIC"] = self.options.get_safe("vulkan_static", False) if is_msvc(self): - tc.variables["USE_MSVC_RUNTIME_LIBRARY_DLL"] = not is_msvc_static_runtime(self) + tc.cache_variables["USE_MSVC_RUNTIME_LIBRARY_DLL"] = not is_msvc_static_runtime(self) tc.generate() + cmake_deps = CMakeDeps(self) + if self.options.get_safe("with_wayland"): + cmake_deps.set_property("xkbcommon", "cmake_file_name", "XKBCommon") + cmake_deps.generate() + if self.options.get_safe("with_wayland"): + pkg_config_deps = PkgConfigDeps(self) + if self._has_build_profile: + pkg_config_deps.build_context_activated = ["wayland-protocols"] + else: + # Manually generate pkgconfig file of wayland-protocols since + # PkgConfigDeps.build_context_activated can't work with legacy 1 profile + wp_prefix = self.dependencies.build["wayland-protocols"].package_folder + wp_version = self.dependencies.build["wayland-protocols"].ref.version + wp_pkg_content = textwrap.dedent(f"""\ + prefix={wp_prefix} + datarootdir=${{prefix}}/res + pkgdatadir=${{datarootdir}}/wayland-protocols + Name: Wayland Protocols + Description: Wayland protocol files + Version: {wp_version} + """) + save(self, os.path.join(self.generators_folder, "wayland-protocols.pc"), wp_pkg_content) + pkg_config_deps.generate() def _patch_sources(self): apply_conandata_patches(self) # don't force PIC replace_in_file(self, os.path.join(self.source_folder, "src", "CMakeLists.txt"), - "POSITION_INDEPENDENT_CODE ON", "") + "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\")", "") + "target_link_libraries(glfw PRIVATE \"-static-libgcc\")", "") # Allow to link vulkan-loader into shared glfw - if self.options.vulkan_static: + if self.options.get_safe("vulkan_static"): cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") replace_in_file( self, @@ -101,7 +182,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*", self.source_folder, os.path.join(self.package_folder, "licenses")) cmake = CMake(self) cmake.install() rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) @@ -142,13 +223,42 @@ def package_info(self): 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"]) - - # backward support of cmake_find_package, cmake_find_package_multi & pkg_config generators - self.cpp_info.filenames["cmake_find_package"] = "glfw3" - self.cpp_info.filenames["cmake_find_package_multi"] = "glfw3" - self.cpp_info.names["cmake_find_package"] = "glfw" - self.cpp_info.names["cmake_find_package_multi"] = "glfw" - 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" + self.cpp_info.frameworks.extend([ + "AppKit", "Cocoa", "CoreFoundation", "CoreGraphics", + "CoreServices", "Foundation", "IOKit", + ]) + self.cpp_info.requires = ["opengl::opengl"] + if self.options.get_safe("vulkan_static"): + self.cpp_info.requires.append("vulkan-loader::vulkan-loader") + if self.settings.os in ["Linux", "FreeBSD"]: + if self.options.get_safe("with_x11", True): + # https://github.com/glfw/glfw/blob/3.4/src/CMakeLists.txt#L181-L218 + # https://github.com/glfw/glfw/blob/3.3.2/CMakeLists.txt#L196-L233 + self.cpp_info.requires.extend([ + "xorg::x11", # Also includes Xkb and Xshape + "xorg::xrandr", + "xorg::xinerama", + "xorg::xcursor", + "xorg::xi", + ]) + if self.options.get_safe("with_wayland"): + # https://github.com/glfw/glfw/blob/3.4/src/CMakeLists.txt#L163-L167 + self.cpp_info.requires.extend([ + "wayland::wayland-client", + "wayland::wayland-cursor", + "wayland::wayland-egl", + "xkbcommon::xkbcommon" + ]) + + # Starting with version 3.4, glfw loads the platform libraries at runtime + # and hence does not need to link with them. + self.cpp_info.requires = [] + if Version(self.version) < "3.4": + self.cpp_info.requires.append("opengl::opengl") + if self.options.get_safe("vulkan_static"): + self.cpp_info.requires.append("vulkan-loader::vulkan-loader") + if self.settings.os in ["Linux", "FreeBSD"]: + if self.options.get_safe("with_x11", True): + self.cpp_info.requires.append("xorg::x11") + if self.options.get_safe("with_wayland"): + self.cpp_info.requires.extend(["wayland::wayland", "xkbcommon::xkbcommon"]) diff --git a/recipes/glfw/all/patches/3.3.5-0001-Wayland-Remove-extra-cmake-modules-dependency.patch b/recipes/glfw/all/patches/3.3.5-0001-Wayland-Remove-extra-cmake-modules-dependency.patch new file mode 100644 index 0000000000000..a07360f22d403 --- /dev/null +++ b/recipes/glfw/all/patches/3.3.5-0001-Wayland-Remove-extra-cmake-modules-dependency.patch @@ -0,0 +1,122 @@ +From 3b10bdd8590ae788ff7ae3d8fe570480a8dcbda9 Mon Sep 17 00:00:00 2001 +From: Jordan Williams +Date: Fri, 3 Nov 2023 08:51:04 -0500 +Subject: [PATCH] Wayland: Remove extra-cmake-modules dependency + +Fixes #1774. +--- + CMakeLists.txt | 11 ++++---- + src/CMakeLists.txt | 67 +++++++++++++++++++++++++++++----------------- + 2 files changed, 48 insertions(+), 30 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 35835833..964c12aa 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -249,12 +249,13 @@ endif() + # Use Wayland for window creation + #-------------------------------------------------------------------- + if (_GLFW_WAYLAND) +- find_package(ECM REQUIRED NO_MODULE) +- list(APPEND CMAKE_MODULE_PATH "${ECM_MODULE_PATH}") + +- find_package(Wayland REQUIRED Client Cursor Egl) +- find_package(WaylandScanner REQUIRED) +- find_package(WaylandProtocols 1.15 REQUIRED) ++ include(FindPkgConfig) ++ pkg_check_modules(Wayland REQUIRED ++ wayland-client>=0.2.7 ++ wayland-cursor>=0.2.7 ++ wayland-egl>=0.2.7 ++ xkbcommon) + + list(APPEND glfw_PKG_DEPS "wayland-client") + +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index b6dd86c5..066f4d98 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -39,31 +39,6 @@ elseif (_GLFW_WAYLAND) + set(glfw_SOURCES ${common_SOURCES} wl_init.c wl_monitor.c wl_window.c + posix_time.c posix_thread.c xkb_unicode.c + egl_context.c osmesa_context.c) +- +- ecm_add_wayland_client_protocol(glfw_SOURCES +- PROTOCOL +- "${WAYLAND_PROTOCOLS_PKGDATADIR}/stable/xdg-shell/xdg-shell.xml" +- BASENAME xdg-shell) +- ecm_add_wayland_client_protocol(glfw_SOURCES +- PROTOCOL +- "${WAYLAND_PROTOCOLS_PKGDATADIR}/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml" +- BASENAME xdg-decoration) +- ecm_add_wayland_client_protocol(glfw_SOURCES +- PROTOCOL +- "${WAYLAND_PROTOCOLS_PKGDATADIR}/stable/viewporter/viewporter.xml" +- BASENAME viewporter) +- ecm_add_wayland_client_protocol(glfw_SOURCES +- PROTOCOL +- "${WAYLAND_PROTOCOLS_PKGDATADIR}/unstable/relative-pointer/relative-pointer-unstable-v1.xml" +- BASENAME relative-pointer-unstable-v1) +- ecm_add_wayland_client_protocol(glfw_SOURCES +- PROTOCOL +- "${WAYLAND_PROTOCOLS_PKGDATADIR}/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml" +- BASENAME pointer-constraints-unstable-v1) +- ecm_add_wayland_client_protocol(glfw_SOURCES +- PROTOCOL +- "${WAYLAND_PROTOCOLS_PKGDATADIR}/unstable/idle-inhibit/idle-inhibit-unstable-v1.xml" +- BASENAME idle-inhibit-unstable-v1) + elseif (_GLFW_OSMESA) + set(glfw_HEADERS ${common_HEADERS} null_platform.h null_joystick.h + posix_time.h posix_thread.h osmesa_context.h) +@@ -71,6 +46,48 @@ elseif (_GLFW_OSMESA) + null_joystick.c posix_time.c posix_thread.c osmesa_context.c) + endif() + ++if (_GLFW_WAYLAND) ++ find_program(WAYLAND_SCANNER_EXECUTABLE NAMES wayland-scanner) ++ pkg_check_modules(WAYLAND_PROTOCOLS REQUIRED wayland-protocols>=1.15) ++ pkg_get_variable(WAYLAND_PROTOCOLS_BASE wayland-protocols pkgdatadir) ++ ++ macro(wayland_generate protocol_file output_file) ++ add_custom_command(OUTPUT ${output_file}.h ++ COMMAND ${WAYLAND_SCANNER_EXECUTABLE} client-header ++ < ${protocol_file} > ${output_file}.h ++ DEPENDS ${protocol_file}) ++ list(APPEND GLFW_WAYLAND_PROTOCOL_SOURCES ${output_file}.h) ++ ++ add_custom_command(OUTPUT ${output_file}.c ++ COMMAND ${WAYLAND_SCANNER_EXECUTABLE} private-code ++ < ${protocol_file} > ${output_file}.c ++ DEPENDS ${protocol_file}) ++ list(APPEND GLFW_WAYLAND_PROTOCOL_SOURCES ${output_file}.c) ++ endmacro() ++ ++ set(GLFW_WAYLAND_PROTOCOL_SOURCES) ++ wayland_generate( ++ ${WAYLAND_PROTOCOLS_BASE}/stable/xdg-shell/xdg-shell.xml ++ ${GLFW_BINARY_DIR}/src/wayland-xdg-shell-client-protocol) ++ wayland_generate( ++ ${WAYLAND_PROTOCOLS_BASE}/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml ++ ${GLFW_BINARY_DIR}/src/wayland-xdg-decoration-client-protocol) ++ wayland_generate( ++ ${WAYLAND_PROTOCOLS_BASE}/stable/viewporter/viewporter.xml ++ ${GLFW_BINARY_DIR}/src/wayland-viewporter-client-protocol) ++ wayland_generate( ++ ${WAYLAND_PROTOCOLS_BASE}/unstable/relative-pointer/relative-pointer-unstable-v1.xml ++ ${GLFW_BINARY_DIR}/src/wayland-relative-pointer-unstable-v1-client-protocol) ++ wayland_generate( ++ ${WAYLAND_PROTOCOLS_BASE}/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml ++ ${GLFW_BINARY_DIR}/src/wayland-pointer-constraints-unstable-v1-client-protocol) ++ wayland_generate( ++ ${WAYLAND_PROTOCOLS_BASE}/unstable/idle-inhibit/idle-inhibit-unstable-v1.xml ++ ${GLFW_BINARY_DIR}/src/wayland-idle-inhibit-unstable-v1-client-protocol) ++ ++ list(APPEND glfw_SOURCES ${GLFW_WAYLAND_PROTOCOL_SOURCES}) ++endif() ++ + if (_GLFW_X11 OR _GLFW_WAYLAND) + if (CMAKE_SYSTEM_NAME STREQUAL "Linux") + set(glfw_HEADERS ${glfw_HEADERS} linux_joystick.h) +-- +2.41.0 + 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/CMakeLists.txt b/recipes/glfw/all/test_package/CMakeLists.txt index b6a8569c50ff8..d4fd9128472c1 100644 --- a/recipes/glfw/all/test_package/CMakeLists.txt +++ b/recipes/glfw/all/test_package/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package LANGUAGES C) find_package(glfw3 REQUIRED CONFIG) diff --git a/recipes/glfw/config.yml b/recipes/glfw/config.yml index a0746c2e38c76..4de833422197f 100644 --- a/recipes/glfw/config.yml +++ b/recipes/glfw/config.yml @@ -1,15 +1,7 @@ versions: + "3.4": + folder: all "3.3.8": folder: all "3.3.7": folder: all - "3.3.6": - folder: all - "3.3.5": - folder: all - "3.3.4": - folder: all - "3.3.3": - folder: all - "3.3.2": - folder: all diff --git a/recipes/gli/all/conandata.yml b/recipes/gli/all/conandata.yml new file mode 100644 index 0000000000000..d6e11dbb4707a --- /dev/null +++ b/recipes/gli/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "cci.20210515": + url: "https://github.com/g-truc/gli/archive/779b99ac6656e4d30c3b24e96e0136a59649a869.zip" + sha256: "38b3ee37404cb16b326025185a6480f6ca20c9228056e33bb4fcb37cd7d1aeb1" diff --git a/recipes/gli/all/conanfile.py b/recipes/gli/all/conanfile.py new file mode 100644 index 0000000000000..95708d6bbe9df --- /dev/null +++ b/recipes/gli/all/conanfile.py @@ -0,0 +1,78 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import copy, get, load, save +from conan.tools.layout import basic_layout +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +import os + +required_conan_version = ">=1.52.0" + + +class GliConan(ConanFile): + name = "gli" + description = "OpenGL Image (GLI)" + topics = ("opengl", "image") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/g-truc/gli" + license = "LicenseRef-copying.txt" + package_type = "header-library" + 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": "4.7", + "clang": "3.4", + "apple-clang": "6", + "Visual Studio": "12", + "msvc": "180", + } + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("glm/1.0.1") + + def package_id(self): + self.info.clear() + + 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." + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def build(self): + pass + + def package(self): + save(self, os.path.join(self.package_folder, "licenses", "copying.txt"), self._get_license()) + for headers in ("*.hpp", "*.inl", "*.h"): + copy(self, headers, src=os.path.join(self.source_folder, "gli"), + dst=os.path.join(self.package_folder, "include", "gli")) + + def _get_license(self): + manual = load(self, os.path.join(self.source_folder, "manual.md")) + begin = manual.find("### The Happy Bunny License (Modified MIT License)") + end = manual.find("\n![](https://github.com/g-truc/glm/blob/manual/doc/manual/frontpage2.png)", begin) + return manual[begin:end] + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "gli") + self.cpp_info.set_property("cmake_target_name", "gli") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/gli/all/test_package/CMakeLists.txt b/recipes/gli/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..928ba41028f6b --- /dev/null +++ b/recipes/gli/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES CXX) + +find_package(gli REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE gli) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/gli/all/test_package/conanfile.py b/recipes/gli/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0a6bc68712d90 --- /dev/null +++ b/recipes/gli/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/gli/all/test_package/test_package.cpp b/recipes/gli/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..17d15a1d74af1 --- /dev/null +++ b/recipes/gli/all/test_package/test_package.cpp @@ -0,0 +1,8 @@ +#include +#include +#include "gli/gli.hpp" + +int main (int argc, char * argv[]) { + std::cout << GLI_VERSION << "\n"; + return EXIT_SUCCESS; +} diff --git a/recipes/gli/config.yml b/recipes/gli/config.yml new file mode 100644 index 0000000000000..01c19117cfc2b --- /dev/null +++ b/recipes/gli/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20210515": + folder: all diff --git a/recipes/glib/all/conandata.yml b/recipes/glib/all/conandata.yml index 997e550aba596..9723a1277a5c1 100644 --- a/recipes/glib/all/conandata.yml +++ b/recipes/glib/all/conandata.yml @@ -1,39 +1,33 @@ sources: - "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.74.0": - url: "https://download.gnome.org/sources/glib/2.74/glib-2.74.0.tar.xz" - sha256: "3652c7f072d7b031a6b5edd623f77ebc5dcd2ae698598abcc89ff39ca75add30" - "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" - "2.71.3": - url: "https://download.gnome.org/sources/glib/2.71/glib-2.71.3.tar.xz" - sha256: "288549404c26db3d52cf7a37f2f42b495b31ccffce2b4cb2439a64099c740343" - "2.70.5": - url: "https://download.gnome.org/sources/glib/2.70/glib-2.70.5.tar.xz" - sha256: "f70bf76ebcc84e0705722f038be8e2f9a58d17e1a700810c635fcc18b8974b7e" - "2.69.3": - url: "https://download.gnome.org/sources/glib/2.69/glib-2.69.3.tar.xz" - sha256: "47af2c6e06becee44d447ae7d1212dbab255b002b5141d9b62a4357c0ecc058f" - "2.68.3": - url: "https://download.gnome.org/sources/glib/2.68/glib-2.68.3.tar.xz" - sha256: "e7e1a3c20c026109c45c9ec4a31d8dcebc22e86c69486993e565817d64be3138" + "2.81.0": + url: "https://download.gnome.org/sources/glib/2.81/glib-2.81.0.tar.xz" + sha256: "1665188ed9cc941c0a189dc6295e6859872523d1bfc84a5a84732a7ae87b02e4" + "2.78.3": + url: "https://download.gnome.org/sources/glib/2.78/glib-2.78.3.tar.xz" + sha256: "609801dd373796e515972bf95fc0b2daa44545481ee2f465c4f204d224b2bc21" + "2.77.3": + url: "https://download.gnome.org/sources/glib/2.77/glib-2.77.3.tar.xz" + sha256: "1753f963bb680b28a83d6e2095f63d0d4b94244675bcd2603850b2ebc1ac6a61" + "2.76.3": + url: "https://download.gnome.org/sources/glib/2.76/glib-2.76.3.tar.xz" + sha256: "c0be444e403d7c3184d1f394f89f0b644710b5e9331b54fa4e8b5037813ad32a" patches: - "2.74.0": - - patch_file: "patches/0001-2.74.0-clang-static-assert.patch" - patch_type: backport - patch_description: fix for clang compilation - patch_source: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2898 - "2.73.3": - - patch_file: "patches/0001-2.73.3-clang-static-assert.patch" - patch_type: backport - patch_description: fix for clang compilation - patch_source: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2898 + "2.81.0": + - patch_file: "patches/dont-use-python-packaging-2.81.0.patch" + patch_type: bugfix + patch_description: replace package.version.Version by internal code + patch_source: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3352 + "2.78.3": + - patch_file: "patches/remove-distutils-2.77.0.patch" + patch_type: bugfix + patch_description: remove distutils + patch_source: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/4133 + "2.76.3": + - patch_file: "patches/libintl-discovery.patch" + patch_type: bugfix + patch_description: fix libintl discovery + patch_source: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3352 + - patch_file: "patches/remove-distutils.patch" + patch_type: bugfix + patch_description: remove distutils + patch_source: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/4133 diff --git a/recipes/glib/all/conanfile.py b/recipes/glib/all/conanfile.py index e1f49826f840b..18816d5df363d 100644 --- a/recipes/glib/all/conanfile.py +++ b/recipes/glib/all/conanfile.py @@ -1,5 +1,4 @@ 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, replace_in_file, rm, rmdir @@ -7,35 +6,36 @@ from conan.tools.layout import basic_layout from conan.tools.meson import Meson, MesonToolchain from conan.tools.microsoft import is_msvc -from conan.tools.scm import Version import os import shutil -required_conan_version = ">=1.53.0" +required_conan_version = ">=2.0" class GLibConan(ConanFile): name = "glib" - 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.") + 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-or-later" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], - "with_pcre": [True, False], "with_elf": [True, False], "with_selinux": [True, False], "with_mount": [True, False], } default_options = { - "shared": True, + "shared": False, "fPIC": True, - "with_pcre": True, "with_elf": True, "with_mount": True, "with_selinux": True, @@ -48,14 +48,15 @@ def export_sources(self): def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - if 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 if is_msvc(self): del self.options.with_elf + if self.settings.os == "Neutrino": + del self.options.with_elf + def configure(self): if self.options.shared: self.options.rm_safe("fPIC") @@ -66,45 +67,29 @@ def layout(self): basic_layout(self, src_folder="src") def requirements(self): - self.requires("zlib/1.2.13") - self.requires("libffi/3.4.3") - if self.options.with_pcre: - if Version(self.version) >= "2.73.2": - self.requires("pcre2/10.40") - else: - self.requires("pcre/8.45") + self.requires("zlib/[>=1.2.11 <2]") + self.requires("libffi/3.4.4") + self.requires("pcre2/10.42") if self.options.get_safe("with_elf"): self.requires("libelf/0.8.13") if self.options.get_safe("with_mount"): - self.requires("libmount/2.36.2") + self.requires("libmount/2.39.2") if self.options.get_safe("with_selinux"): - self.requires("libselinux/3.3") + self.requires("libselinux/3.6") if self.settings.os != "Linux": # for Linux, gettext is provided by libc - self.requires("libgettext/0.21") + self.requires("libgettext/0.22", transitive_headers=True, transitive_libs=True) if is_apple_os(self): self.requires("libiconv/1.17") - def validate(self): - if Version(self.version) >= "2.69.0" and not self.info.options.with_pcre: - raise ConanInvalidConfiguration("option glib:with_pcre must be True for glib >= 2.69.0") - if self.info.settings.os == "Windows" and not self.info.options.shared and 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 Version(self.version) < "2.67.0" and not is_msvc(self) and not self.info.options.with_elf: - raise ConanInvalidConfiguration("libelf dependency can't be disabled in glib < 2.67.0") - def build_requirements(self): - 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") + self.tool_requires("meson/[>=1.2.3 <2]") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/[>=2.2 <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): virtual_build_env = VirtualBuildEnv(self) @@ -113,48 +98,33 @@ def generate(self): tc.generate() tc = MesonToolchain(self) - if is_apple_os(self): - 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 Version(self.version) < "2.69.0": - tc.project_options["internal_pcre"] = not self.options.with_pcre - if self.settings.os == "FreeBSD": + if self.settings.os == "FreeBSD" or self.settings.os == "Neutrino": tc.project_options["xattr"] = "false" - if Version(self.version) >= "2.67.2": - tc.project_options["tests"] = "false" - if Version(self.version) >= "2.67.0": - tc.project_options["libelf"] = "enabled" if self.options.get_safe("with_elf") else "disabled" + tc.project_options["tests"] = "false" + tc.project_options["libelf"] = "enabled" if self.options.get_safe("with_elf") else "disabled" + + if self.settings.os == "Neutrino": + tc.cross_build["host"]["system"] = "qnx" + tc.c_link_args.append("-lm") + tc.c_link_args.append("-lsocket") + tc.generate() def _patch_sources(self): apply_conandata_patches(self) - if Version(self.version) < "2.67.2": - replace_in_file(self, - os.path.join(self.source_folder, "meson.build"), - "build_tests = not meson.is_cross_build() or (meson.is_cross_build() and meson.has_exe_wrapper())", - "build_tests = false", - ) 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 Version(self.version) < "2.73.2": - for filename in [ - 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"), - ]: - replace_in_file(self, filename, "subdir('tests')", "#subdir('tests')") - if self.settings.os != "Linux": + if self.settings.os != "Linux" and self.settings.os != "Neutrino": # allow to find gettext 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)", + "libintl = dependency('intl', required: false", + "libintl = dependency('libgettext', method : 'pkg-config', required : false", ) replace_in_file(self, @@ -176,10 +146,7 @@ def build(self): meson.build() def package(self): - if Version(self.version) < "2.73.0": - copy(self, pattern="COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) - else: - 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")) + 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")) @@ -239,6 +206,15 @@ def package_info(self): self.cpp_info.components["gthread-2.0"].system_libs.append("pthread") self.cpp_info.components["gio-2.0"].system_libs.append("dl") + if self.settings.os == "Neutrino": + self.cpp_info.components["gmodule-export-2.0"].sharedlinkflags.append("-Wl,--export-dynamic") + self.cpp_info.components["gmodule-2.0"].sharedlinkflags.append("-Wl,--export-dynamic") + self.cpp_info.components["glib-2.0"].system_libs.append("m") + self.cpp_info.components["glib-2.0"].system_libs.append("socket") + self.cpp_info.components["gmodule-no-export-2.0"].system_libs.append("c") + self.cpp_info.components["gio-2.0"].system_libs.append("c") + self.cpp_info.components["gio-2.0"].system_libs.append("socket") + 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"]) @@ -258,11 +234,7 @@ def package_info(self): if is_apple_os(self): self.cpp_info.components["glib-2.0"].requires.append("libiconv::libiconv") - if self.options.with_pcre: - 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") + self.cpp_info.components["glib-2.0"].requires.append("pcre2::pcre2") if self.settings.os == "Linux": self.cpp_info.components["gio-2.0"].system_libs.append("resolv") @@ -279,9 +251,7 @@ def package_info(self): self.cpp_info.components["gresource"].requires.append("libelf::libelf") # this is actually an executable self.env_info.GLIB_COMPILE_SCHEMAS = os.path.join(self.package_folder, "bin", "glib-compile-schemas") - 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) + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) pkgconfig_variables = { 'datadir': '${prefix}/res', @@ -313,10 +283,10 @@ def package_info(self): "\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""" + """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/glib/all/patches/0001-2.73.3-clang-static-assert.patch b/recipes/glib/all/patches/0001-2.73.3-clang-static-assert.patch deleted file mode 100644 index c46f5e071d71c..0000000000000 --- a/recipes/glib/all/patches/0001-2.73.3-clang-static-assert.patch +++ /dev/null @@ -1,33 +0,0 @@ -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/0001-2.74.0-clang-static-assert.patch b/recipes/glib/all/patches/0001-2.74.0-clang-static-assert.patch deleted file mode 100644 index c9481d079569d..0000000000000 --- a/recipes/glib/all/patches/0001-2.74.0-clang-static-assert.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/gio/gio-launch-desktop.c b/gio/gio-launch-desktop.c -index 26b9ae1a1..47717b987 100644 ---- a/gio/gio-launch-desktop.c -+++ b/gio/gio-launch-desktop.c -@@ -121,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; - -- G_STATIC_ASSERT (LOG_EMERG == 0 && "Linux ABI defines LOG_EMERG"); -- G_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/dont-use-python-packaging-2.81.0.patch b/recipes/glib/all/patches/dont-use-python-packaging-2.81.0.patch new file mode 100644 index 0000000000000..a97c9a79ae133 --- /dev/null +++ b/recipes/glib/all/patches/dont-use-python-packaging-2.81.0.patch @@ -0,0 +1,148 @@ +diff --git a/gio/gdbus-2.0/codegen/gdbus-codegen.in b/gio/gdbus-2.0/codegen/gdbus-codegen.in +index 9c409e6..1913b6d 100755 +--- a/gio/gdbus-2.0/codegen/gdbus-codegen.in ++++ b/gio/gdbus-2.0/codegen/gdbus-codegen.in +@@ -1,4 +1,4 @@ +-#!@PYTHON@ ++#!/usr/bin/env @PYTHON@ + + # GDBus - GLib D-Bus Library + # +diff --git a/gio/gdbus-2.0/codegen/meson.build b/gio/gdbus-2.0/codegen/meson.build +index 67ea9f2..2ee1fc8 100644 +--- a/gio/gdbus-2.0/codegen/meson.build ++++ b/gio/gdbus-2.0/codegen/meson.build +@@ -31,7 +31,7 @@ gdbus_codegen_conf = configuration_data() + gdbus_codegen_conf.set('VERSION', glib_version) + gdbus_codegen_conf.set('MAJOR_VERSION', major_version) + gdbus_codegen_conf.set('MINOR_VERSION', minor_version) +-gdbus_codegen_conf.set('PYTHON', python.full_path()) ++gdbus_codegen_conf.set('PYTHON', python_name) + gdbus_codegen_conf.set('DATADIR', glib_datadir) + + # Install gdbus-codegen executable +diff --git a/gio/gdbus-2.0/codegen/utils.py b/gio/gdbus-2.0/codegen/utils.py +index 6399945..86024d7 100644 +--- a/gio/gdbus-2.0/codegen/utils.py ++++ b/gio/gdbus-2.0/codegen/utils.py +@@ -21,10 +21,9 @@ + # + # Author: David Zeuthen + +-import packaging.version + import os + import sys +- ++import re + + # pylint: disable=too-few-public-methods + class Color: +@@ -161,11 +160,35 @@ def lookup_brief_docs(annotations): + def version_cmp_key(key): + # If the 'since' version is 'UNRELEASED', compare higher than anything else + # If it is empty put a 0 in its place as this will +- # allow LooseVersion to work and will always compare lower. ++ # allow _parse_version() to work and will always compare lower. + if key[0] == "UNRELEASED": + v = "9999" + elif key[0]: + v = str(key[0]) + else: + v = "0" +- return (packaging.version.Version(v), key[1]) ++ return (_parse_version(v), key[1]) ++ ++ ++def _parse_version(version): ++ """ ++ Parse a version string into a list of integers and strings. ++ ++ This function takes a version string and breaks it down into its component parts. ++ It separates numeric and non-numeric segments, converting numeric segments to integers. ++ ++ Args: ++ version (str): The version string to parse. ++ ++ Returns: ++ list: A list where each element is either an integer (for numeric parts) ++ or a string (for non-numeric parts). ++ ++ Example: ++ >>> parseversion("1.2.3a") ++ [1, 2, 3, 'a'] ++ >>> parseversion("2.0.0-rc1") ++ [2, 0, 0, 'rc1'] ++ """ ++ blocks = re.findall(r"(\d+|\w+)", version) ++ return [int(b) if b.isdigit() else b for b in blocks] +diff --git a/glib/gtester-report.in b/glib/gtester-report.in +index 0745d53..b8291d2 100644 +--- a/glib/gtester-report.in ++++ b/glib/gtester-report.in +@@ -1,4 +1,4 @@ +-#!@PYTHON@ ++#! /usr/bin/env @PYTHON@ + # GLib Testing Framework Utility -*- Mode: python; -*- + # Copyright (C) 2007 Imendio AB + # Authors: Tim Janik +diff --git a/glib/meson.build b/glib/meson.build +index b2dd569..5c29bb7 100644 +--- a/glib/meson.build ++++ b/glib/meson.build +@@ -502,7 +502,7 @@ endif + + report_conf = configuration_data() + report_conf.set('GLIB_VERSION', glib_version) +-report_conf.set('PYTHON', python.full_path()) ++report_conf.set('PYTHON', python_name) + configure_file( + input: 'gtester-report.in', + output: 'gtester-report', +diff --git a/gobject/glib-genmarshal.in b/gobject/glib-genmarshal.in +index 0578b74..aa5af43 100755 +--- a/gobject/glib-genmarshal.in ++++ b/gobject/glib-genmarshal.in +@@ -1,4 +1,4 @@ +-#!@PYTHON@ ++#!/usr/bin/env @PYTHON@ + + # pylint: disable=too-many-lines, missing-docstring, invalid-name + +diff --git a/gobject/glib-mkenums.in b/gobject/glib-mkenums.in +index 7e794e9..e10b910 100755 +--- a/gobject/glib-mkenums.in ++++ b/gobject/glib-mkenums.in +@@ -1,4 +1,4 @@ +-#!@PYTHON@ ++#!/usr/bin/env @PYTHON@ + + # If the code below looks horrible and unpythonic, do not panic. + # +diff --git a/gobject/meson.build b/gobject/meson.build +index 78b732b..2129aaf 100644 +--- a/gobject/meson.build ++++ b/gobject/meson.build +@@ -87,7 +87,7 @@ python_tools = [ + + python_tools_conf = configuration_data() + python_tools_conf.set('VERSION', glib_version) +-python_tools_conf.set('PYTHON', python.full_path()) ++python_tools_conf.set('PYTHON', python_name) + + foreach tool: python_tools + tool_bin = configure_file( +diff --git a/meson.build b/meson.build +index bcc2887..6cca73d 100644 +--- a/meson.build ++++ b/meson.build +@@ -2457,7 +2457,9 @@ endif + + glib_conf.set('HAVE_PROC_SELF_CMDLINE', have_proc_self_cmdline) + +-python = import('python').find_installation(modules: ['packaging']) ++python = import('python').find_installation() ++# used for '#!/usr/bin/env ' ++python_name = 'python3' + + python_version = python.language_version() + python_version_req = '>=3.7' diff --git a/recipes/glib/all/patches/libintl-discovery.patch b/recipes/glib/all/patches/libintl-discovery.patch new file mode 100644 index 0000000000000..17083da96cd17 --- /dev/null +++ b/recipes/glib/all/patches/libintl-discovery.patch @@ -0,0 +1,49 @@ +From 32249a22fc39319651e7c23442d37ec837f05764 Mon Sep 17 00:00:00 2001 +From: Nirbheek Chauhan +Date: Thu, 8 Sep 2022 02:36:33 +0530 +Subject: [PATCH] meson: Fix detection of a system-provided proxy-libintl + +proxy-libintl defines ngettext() as a define in the header that points +to the actual symbol in the library which is g_libintl_ngettext(). +Same with bind_textdomain_codeset(). +--- + meson.build | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/meson.build b/meson.build +index 0cbc9689f5..de0bee5a39 100644 +--- a/meson.build ++++ b/meson.build +@@ -2089,6 +2089,7 @@ libz_dep = dependency('zlib') + # FIXME: glib-gettext.m4 has much more checks to detect broken/uncompatible + # implementations. This could be extended if issues are found in some platforms. + libintl_deps = [] ++libintl_prefix = '#include ' + libintl = dependency('intl', required: false, allow_fallback: false) + if libintl.found() + # libintl supports different threading APIs, which may not +@@ -2100,11 +2101,11 @@ if libintl.found() + # + # Meson's builtin dependency lookup as of 0.60.0 doesn't check for + # pthread, so we do this manually here. +- if cc.has_function('ngettext', dependencies : libintl) ++ if cc.has_function('ngettext', dependencies : libintl, prefix: libintl_prefix) + libintl_deps += [libintl] + else + libintl_pthread = cc.find_library('pthread', required : false) +- if libintl_pthread.found() and cc.has_function('ngettext', dependencies : [libintl, libintl_pthread]) ++ if libintl_pthread.found() and cc.has_function('ngettext', dependencies : [libintl, libintl_pthread], prefix: libintl_prefix) + libintl_deps += [libintl, libintl_pthread] + else + libintl = disabler() +@@ -2113,7 +2114,7 @@ if libintl.found() + endif + + if libintl.found() +- have_bind_textdomain_codeset = cc.has_function('bind_textdomain_codeset', dependencies: libintl_deps) ++ have_bind_textdomain_codeset = cc.has_function('bind_textdomain_codeset', dependencies: libintl_deps, prefix: libintl_prefix) + else + libintl = dependency('intl', allow_fallback: true) + assert(libintl.type_name() == 'internal') +-- +GitLab diff --git a/recipes/glib/all/patches/remove-distutils-2.77.0.patch b/recipes/glib/all/patches/remove-distutils-2.77.0.patch new file mode 100644 index 0000000000000..ba054b959ca4f --- /dev/null +++ b/recipes/glib/all/patches/remove-distutils-2.77.0.patch @@ -0,0 +1,51 @@ +diff --git a/gio/gdbus-2.0/codegen/utils.py b/gio/gdbus-2.0/codegen/utils.py +index 0204610..f8d758c 100644 +--- a/gio/gdbus-2.0/codegen/utils.py ++++ b/gio/gdbus-2.0/codegen/utils.py +@@ -19,7 +19,7 @@ + # + # Author: David Zeuthen + +-import distutils.version ++import re + import os + import sys + +@@ -159,11 +159,35 @@ def lookup_brief_docs(annotations): + def version_cmp_key(key): + # If the 'since' version is 'UNRELEASED', compare higher than anything else + # If it is empty put a 0 in its place as this will +- # allow LooseVersion to work and will always compare lower. ++ # allow _parse_version() to work and will always compare lower. + if key[0] == "UNRELEASED": + v = "9999" + elif key[0]: + v = str(key[0]) + else: + v = "0" +- return (distutils.version.LooseVersion(v), key[1]) ++ return (_parse_version(v), key[1]) ++ ++ ++def _parse_version(version): ++ """ ++ Parse a version string into a list of integers and strings. ++ ++ This function takes a version string and breaks it down into its component parts. ++ It separates numeric and non-numeric segments, converting numeric segments to integers. ++ ++ Args: ++ version (str): The version string to parse. ++ ++ Returns: ++ list: A list where each element is either an integer (for numeric parts) ++ or a string (for non-numeric parts). ++ ++ Example: ++ >>> parseversion("1.2.3a") ++ [1, 2, 3, 'a'] ++ >>> parseversion("2.0.0-rc1") ++ [2, 0, 0, 'rc1'] ++ """ ++ blocks = re.findall(r"(\d+|\w+)", version) ++ return [int(b) if b.isdigit() else b for b in blocks] diff --git a/recipes/glib/all/patches/remove-distutils.patch b/recipes/glib/all/patches/remove-distutils.patch new file mode 100644 index 0000000000000..3096261030b0d --- /dev/null +++ b/recipes/glib/all/patches/remove-distutils.patch @@ -0,0 +1,51 @@ +diff --git a/gio/gdbus-2.0/codegen/utils.py b/gio/gdbus-2.0/codegen/utils.py +index 95559d3..2b7a176 100644 +--- a/gio/gdbus-2.0/codegen/utils.py ++++ b/gio/gdbus-2.0/codegen/utils.py +@@ -19,7 +19,7 @@ + # + # Author: David Zeuthen + +-import distutils.version ++import re + import os + import sys + +@@ -155,11 +155,35 @@ def lookup_brief_docs(annotations): + def version_cmp_key(key): + # If the 'since' version is 'UNRELEASED', compare higher than anything else + # If it is empty put a 0 in its place as this will +- # allow LooseVersion to work and will always compare lower. ++ # allow _parse_version() to work and will always compare lower. + if key[0] == "UNRELEASED": + v = "9999" + elif key[0]: + v = str(key[0]) + else: + v = "0" +- return (distutils.version.LooseVersion(v), key[1]) ++ return (_parse_version(v), key[1]) ++ ++ ++def _parse_version(version): ++ """ ++ Parse a version string into a list of integers and strings. ++ ++ This function takes a version string and breaks it down into its component parts. ++ It separates numeric and non-numeric segments, converting numeric segments to integers. ++ ++ Args: ++ version (str): The version string to parse. ++ ++ Returns: ++ list: A list where each element is either an integer (for numeric parts) ++ or a string (for non-numeric parts). ++ ++ Example: ++ >>> parseversion("1.2.3a") ++ [1, 2, 3, 'a'] ++ >>> parseversion("2.0.0-rc1") ++ [2, 0, 0, 'rc1'] ++ """ ++ blocks = re.findall(r"(\d+|\w+)", version) ++ return [int(b) if b.isdigit() else b for b in blocks] diff --git a/recipes/glib/all/test_package/CMakeLists.txt b/recipes/glib/all/test_package/CMakeLists.txt index 44f2423e0f831..c2e2b58b04658 100644 --- a/recipes/glib/all/test_package/CMakeLists.txt +++ b/recipes/glib/all/test_package/CMakeLists.txt @@ -1,17 +1,7 @@ -cmake_minimum_required(VERSION 3.6) +cmake_minimum_required(VERSION 3.15) project(test_package LANGUAGES C) -add_executable(${PROJECT_NAME} test_package.c) +find_package(glib CONFIG REQUIRED) -if (CMAKE_SYSTEM_NAME STREQUAL "Windows") - find_package(glib CONFIG REQUIRED) - 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) - pkg_check_modules(gio-2.0 REQUIRED IMPORTED_TARGET gio-2.0) - 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} PRIVATE PkgConfig::glib-2.0 PkgConfig::gio-2.0 PkgConfig::gmodule-2.0 PkgConfig::gobject-2.0 PkgConfig::gthread-2.0) -endif() +add_executable(${PROJECT_NAME} test_package.c) +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) diff --git a/recipes/glib/all/test_package/conanfile.py b/recipes/glib/all/test_package/conanfile.py index 22973c4baccc5..686967e0621b8 100644 --- a/recipes/glib/all/test_package/conanfile.py +++ b/recipes/glib/all/test_package/conanfile.py @@ -1,43 +1,19 @@ 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 +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "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 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() + self.requires(self.tested_reference_str, run=True) def build(self): cmake = CMake(self) @@ -48,8 +24,5 @@ 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") - 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") + self.run("gdbus-codegen -h", env="conanrun") diff --git a/recipes/glib/all/test_v1_package/conanfile.py b/recipes/glib/all/test_v1_package/conanfile.py deleted file mode 100644 index ed236807fcf7e..0000000000000 --- a/recipes/glib/all/test_v1_package/conanfile.py +++ /dev/null @@ -1,27 +0,0 @@ -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 a3f68d3f20d1a..178cce999a640 100644 --- a/recipes/glib/config.yml +++ b/recipes/glib/config.yml @@ -1,19 +1,9 @@ versions: - "2.75.0": + "2.81.0": folder: all - "2.74.1": + "2.78.3": folder: all - "2.74.0": + "2.77.3": folder: all - "2.73.3": - folder: all - "2.72.4": - folder: all - "2.71.3": - folder: all - "2.70.5": - folder: all - "2.69.3": - folder: all - "2.68.3": + "2.76.3": folder: all diff --git a/recipes/glibmm/all/conandata.yml b/recipes/glibmm/all/conandata.yml index 9134c71e80aa3..830679f3678f2 100644 --- a/recipes/glibmm/all/conandata.yml +++ b/recipes/glibmm/all/conandata.yml @@ -1,19 +1,13 @@ sources: + "2.78.1": + url: "https://download.gnome.org/sources/glibmm/2.78/glibmm-2.78.1.tar.xz" + sha256: "f473f2975d26c3409e112ed11ed36406fb3843fa975df575c22d4cb843085f61" + "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" "2.66.4": url: "https://download.gnome.org/sources/glibmm/2.66/glibmm-2.66.4.tar.xz" sha256: "199ace5682d81b15a1d565480b4a950682f2db6402c8aa5dd7217d71edff81d5" - -patches: - "2.72.1": - - patch_file: "patches/enable_static_libs_2_72_1.patch" - base_path: "source_subfolder" - - patch_file: "patches/fix_initialization_order_fiasco_2_72_1.patch" - base_path: "source_subfolder" - "2.66.4": - - patch_file: "patches/enable_static_libs_2_66_4.patch" - base_path: "source_subfolder" - - patch_file: "patches/fix_initialization_order_fiasco_2_66_4.patch" - base_path: "source_subfolder" diff --git a/recipes/glibmm/all/conanfile.py b/recipes/glibmm/all/conanfile.py index 6f564ef425241..d36d4666df42d 100644 --- a/recipes/glibmm/all/conanfile.py +++ b/recipes/glibmm/all/conanfile.py @@ -1,18 +1,20 @@ -import os import glob +import os 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 copy, 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, 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): @@ -21,18 +23,14 @@ class GlibmmConan(ConanFile): license = "LGPL-2.1" url = "https://github.com/conan-io/conan-center-index" description = "glibmm is a C++ API for parts of glib that are useful for C++." - topics = ["glibmm", "giomm"] - 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/**" + topics = ("giomm",) + package_type = "shared-library" + settings = "os", "arch", "compiler", "build_type" 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 +40,82 @@ 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 configure(self): + self.options["glib"].shared = True + + def layout(self): + basic_layout(self, src_folder="src") + def requirements(self): + self.requires("glib/2.78.3", transitive_headers=True) + if self._abi_version == "2.68": + self.requires("libsigcpp/3.0.7", transitive_headers=True) + else: + self.requires("libsigcpp/2.10.8", transitive_headers=True) + + def validate(self): if self.settings.compiler.get_safe("cppstd"): - if self._abi_version == "2.68": - build.check_min_cppstd(self, 17) + if Version(self._abi_version) >= "2.68": + 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 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.64.1") - self.build_requires("pkgconf/1.9.3") + self.tool_requires("meson/1.3.2") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/2.1.0") - def requirements(self): - self.requires("glib/2.75.0") + 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() - 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): - # 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", - ) + tc = MesonToolchain(self) + tc.project_options.update({ + "build-examples": "false", + "build-documentation": "false", + "msvc14x-parallel-installable": "false" + }) + tc.generate() + def _patch_sources(self): + meson_build = os.path.join(self.source_folder, "meson.build") + replace_in_file(self, meson_build, "subdir('tests')", "") + if is_msvc(self): # 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() + meson = Meson(self) meson.install() - if microsoft.is_msvc(self): - files.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"), - ) + 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")) for directory in [self._glibmm_lib, self._giomm_lib]: directory_path = os.path.join(self.package_folder, "lib", directory, "include", "*.h") @@ -176,26 +126,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_66_4.patch b/recipes/glibmm/all/patches/enable_static_libs_2_66_4.patch deleted file mode 100644 index c94b5200949f7..0000000000000 --- a/recipes/glibmm/all/patches/enable_static_libs_2_66_4.patch +++ /dev/null @@ -1,32 +0,0 @@ -diff --git a/glib/glibmmconfig.h.meson b/glib/glibmmconfig.h.meson -index e50dcccf..19e64a46 100644 ---- a/glib/glibmmconfig.h.meson -+++ b/glib/glibmmconfig.h.meson -@@ -47,7 +47,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 4feee0fd..9382645a 100644 ---- a/glib/meson.build -+++ b/glib/meson.build -@@ -36,12 +36,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/enable_static_libs_2_72_1.patch b/recipes/glibmm/all/patches/enable_static_libs_2_72_1.patch deleted file mode 100644 index b9ec412d84d2e..0000000000000 --- a/recipes/glibmm/all/patches/enable_static_libs_2_72_1.patch +++ /dev/null @@ -1,32 +0,0 @@ -diff --git a/glib/glibmmconfig.h.meson b/glib/glibmmconfig.h.meson -index ef4753d..58b343c 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 0c20a91..6b8baa0 100644 ---- a/glib/meson.build -+++ b/glib/meson.build -@@ -36,12 +36,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_66_4.patch b/recipes/glibmm/all/patches/fix_initialization_order_fiasco_2_66_4.patch deleted file mode 100644 index 3cf9f867ed1f0..0000000000000 --- a/recipes/glibmm/all/patches/fix_initialization_order_fiasco_2_66_4.patch +++ /dev/null @@ -1,163 +0,0 @@ -Author: Hesham -Date: Fri May 6 20:02:25 2022 +0000 - - Fix initialization order fiasco - - By default global static initialization with shared libraries begins down - the linking chain upwards, so that the deepest dependency initializes first - This is not guaranteed with static libraries, which might cause glibmm to - initialize before glib. This fix uses lazy initialization for static vars - in glibmm that depend on glib. - -diff --git a/glib/glibmm/class.cc b/glib/glibmm/class.cc -index 057abed..e51d01b 100644 ---- a/glib/glibmm/class.cc -+++ b/glib/glibmm/class.cc -@@ -170,7 +170,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 ab96892..267a6c0 100644 ---- a/glib/glibmm/init.cc -+++ b/glib/glibmm/init.cc -@@ -14,15 +14,25 @@ - * License along with this library. If not, see . - */ - -+#include - #include - #include - -+#if GLIB_STATIC_COMPILATION -+#include -+#endif -+ - namespace Glib - { - - void - init() - { -+#if GLIB_STATIC_COMPILATION -+ Glib::Class::iface_properties_quark = -+ g_quark_from_string("gtkmm_CustomObject_iface_properties"); -+#endif -+ - // Also calls Glib::wrap_register_init() and Glib::wrap_init(). - Glib::Error::register_init(); - } -diff --git a/glib/glibmm/property.cc b/glib/glibmm/property.cc -index a2624e5..d9f1095 100644 ---- a/glib/glibmm/property.cc -+++ b/glib/glibmm/property.cc -@@ -89,8 +89,10 @@ 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 const 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 +113,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/untracked/gio/giomm/application.cc b/untracked/gio/giomm/application.cc -index 43ae9df..0d12c9d 100644 ---- a/untracked/gio/giomm/application.cc -+++ b/untracked/gio/giomm/application.cc -@@ -51,8 +51,13 @@ struct ExtraApplicationData - } - }; - --GQuark quark_extra_application_data = -- g_quark_from_string("glibmm__Gio::Application::quark_extra_application_data"); -+static GQuark& -+quark_extra_application_data() -+{ -+ static GQuark quark_extra_application_data_ = -+ g_quark_from_string("glibmm__Gio::Application::quark_extra_application_data"); -+ return quark_extra_application_data_; -+} - - void - Application_delete_extra_application_data(gpointer data) -@@ -465,11 +470,11 @@ Application::add_main_option_entry_private(GOptionArg arg, const Glib::ustring& - gchar* arg_desc = arg_description.empty() ? nullptr : g_strdup(arg_description.c_str()); - - ExtraApplicationData* extra_application_data = -- static_cast(g_object_get_qdata(gobject_, quark_extra_application_data)); -+ static_cast(g_object_get_qdata(gobject_, quark_extra_application_data())); - if (!extra_application_data) - { - extra_application_data = new ExtraApplicationData(); -- g_object_set_qdata_full(gobject_, quark_extra_application_data, extra_application_data, -+ g_object_set_qdata_full(gobject_, quark_extra_application_data(), extra_application_data, - Application_delete_extra_application_data); - } - -@@ -1546,5 +1551,3 @@ void Gio::Application::run_mainloop_vfunc() - - - } // namespace Gio -- -- -diff --git a/untracked/glib/glibmm/binding.cc b/untracked/glib/glibmm/binding.cc -index d0d4f47..0528893 100644 ---- a/untracked/glib/glibmm/binding.cc -+++ b/untracked/glib/glibmm/binding.cc -@@ -29,7 +29,10 @@ - namespace - { - // TODO: When we can break ABI, replace this GQuark by a new data member in Glib::Binding. --GQuark quark_manage = g_quark_from_string("glibmm__Glib::Binding::manage"); -+GQuark& quark_manage() { -+ static GQuark quark_manage_ = g_quark_from_string("glibmm__Glib::Binding::manage"); -+ return quark_manage_; -+} - - struct BindingTransformSlots - { -@@ -150,7 +153,7 @@ Binding::unbind() - void - Binding::unreference() const - { -- if (!g_object_get_qdata(gobject_, quark_manage)) -+ if (!g_object_get_qdata(gobject_, quark_manage())) - { - GBinding* const binding = const_cast(gobj()); - -@@ -168,7 +171,7 @@ void - Binding::set_manage() - { - // Any pointer can be set, just not nullptr. -- g_object_set_qdata(gobject_, quark_manage, this); -+ g_object_set_qdata(gobject_, quark_manage(), this); - } - - const Glib::RefPtr& diff --git a/recipes/glibmm/all/patches/fix_initialization_order_fiasco_2_72_1.patch b/recipes/glibmm/all/patches/fix_initialization_order_fiasco_2_72_1.patch deleted file mode 100644 index e2f8e705abbe0..0000000000000 --- a/recipes/glibmm/all/patches/fix_initialization_order_fiasco_2_72_1.patch +++ /dev/null @@ -1,95 +0,0 @@ -Author: Hesham -Date: Fri May 6 19:37:32 2022 +0000 - - Fix initialization order fiasco - - By default global static initialization with shared libraries begins down - the linking chain upwards, so that the deepest dependency initializes first - This is not guaranteed with static libraries, which might cause glibmm to - initialize before glib. This fix uses lazy initialization for static vars - in glibmm that depend on glib. - -diff --git a/glib/glibmm/class.cc b/glib/glibmm/class.cc -index 36c3c4b..f735129 100644 ---- a/glib/glibmm/class.cc -+++ b/glib/glibmm/class.cc -@@ -157,7 +157,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 0b34447..6b70a4c 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 56dad84..630b35b 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..825105b610efd 100644 --- a/recipes/glibmm/all/test_package/conanfile.py +++ b/recipes/glibmm/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", "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 +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/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..c3ca69bc81afd 100644 --- a/recipes/glibmm/config.yml +++ b/recipes/glibmm/config.yml @@ -1,4 +1,8 @@ versions: + "2.78.1": + folder: "all" + "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..f0837f7018575 100644 --- a/recipes/glm/all/conandata.yml +++ b/recipes/glm/all/conandata.yml @@ -1,19 +1,7 @@ sources: - "cci.20220420": - url: "https://github.com/g-truc/glm/archive/cc98465e3508535ba8c7f6208df934c156a018dc.zip" - sha256: "06d48e336857777d2d1f7da9ccd59e4b9d79720dbd70886d48837d19cda997bb" + "1.0.1": + url: "https://github.com/g-truc/glm/releases/download/1.0.1/glm-1.0.1-light.zip" + sha256: "9A995DE4DA09723BD33EF194E6B79818950E5A8F2E154792F02E4615277CFB8D" "0.9.9.8": - url: "https://github.com/g-truc/glm/archive/0.9.9.8.tar.gz" - sha256: "7d508ab72cb5d43227a3711420f06ff99b0a0cb63ee2f93631b162bfe1fe9592" - "0.9.9.7": - url: "https://github.com/g-truc/glm/archive/0.9.9.7.tar.gz" - sha256: "2ec9e33a80b548892af64fbd84a947f93f0e725423b1b7bec600f808057a8239" - "0.9.9.6": - url: "https://github.com/g-truc/glm/archive/0.9.9.6.tar.gz" - sha256: "30b05f31f5d8528caa9fc8fe8132e5a0444d55b1c39db53fe4db8857654afafc" - "0.9.9.5": - url: "https://github.com/g-truc/glm/archive/0.9.9.5.tar.gz" - sha256: "5e33b6131cea6a904339734b015110d4342b7dc02d995164fdb86332d28a5aa4" - "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.9.8/glm-0.9.9.8.zip" + sha256: "37e2a3d62ea3322e43593c34bae29f57e3e251ea89f4067506c94043769ade4c" diff --git a/recipes/glm/all/conanfile.py b/recipes/glm/all/conanfile.py index 5607f01a9ed01..71d8ed1fa37de 100644 --- a/recipes/glm/all/conanfile.py +++ b/recipes/glm/all/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.files import copy, get, load, save +from conan.tools.files import copy, get from conan.tools.layout import basic_layout from conan.tools.scm import Version import os @@ -14,48 +14,33 @@ class GlmConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/g-truc/glm" license = "MIT" + package_type = "header-library" 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=self.version < Version("1.0.0")) def build(self): pass def package(self): - glm_version = self.version if self.version.startswith("cci") else Version(self._get_semver()) - if glm_version == "0.9.8" or (glm_version == "0.9.9" and self._get_tweak_number() < 6): - save(self, os.path.join(self.package_folder, "licenses", "copying.txt"), self._get_license()) - else: + if self.version < Version("1.0.0"): copy(self, "copying.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) - for headers in ("*.hpp", "*.inl", "*.h"): + else: + copy(self, "copying.txt", src=os.path.join(self.source_folder, "glm"), dst=os.path.join(self.package_folder, "licenses")) + for headers in ("*.hpp", "*.inl", "*.h", "*.cppm"): copy(self, headers, src=os.path.join(self.source_folder, "glm"), dst=os.path.join(self.package_folder, "include", "glm")) - def _get_semver(self): - return self.version.rsplit(".", 1)[0] - - def _get_tweak_number(self): - return int(self.version.rsplit(".", 1)[-1]) - - def _get_license(self): - manual = load(self, os.path.join(self.source_folder, "manual.md")) - begin = manual.find("### The Happy Bunny License (Modified MIT License)") - end = manual.find("\n![](./doc/manual/frontpage2.png)", begin) - return manual[begin:end] - 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..c716b00aceaa5 100644 --- a/recipes/glm/config.yml +++ b/recipes/glm/config.yml @@ -1,13 +1,5 @@ versions: - "cci.20220420": + "1.0.1": folder: all "0.9.9.8": folder: all - "0.9.9.7": - folder: all - "0.9.9.6": - folder: all - "0.9.9.5": - folder: all - "0.9.5.4": - folder: all diff --git a/recipes/glog/all/conandata.yml b/recipes/glog/all/conandata.yml index 280f568cd746b..620508ce97a33 100644 --- a/recipes/glog/all/conandata.yml +++ b/recipes/glog/all/conandata.yml @@ -1,13 +1,19 @@ sources: + "0.7.1": + url: "https://github.com/google/glog/archive/refs/tags/v0.7.1.tar.gz" + sha256: "00e4a87e87b7e7612f519a41e491f16623b12423620006f59f5688bfd8d13b08" + "0.7.0": + url: "https://github.com/google/glog/archive/refs/tags/v0.7.0.tar.gz" + sha256: "375106b5976231b92e66879c1a92ce062923b9ae573c42b56ba28b112ee4cc11" "0.6.0": - sha256: 8a83bf982f37bb70825df71a9709fa90ea9f4447fb3c099e1d720a439d88bad6 - url: https://github.com/google/glog/archive/refs/tags/v0.6.0.tar.gz + url: "https://github.com/google/glog/archive/refs/tags/v0.6.0.tar.gz" + sha256: "8a83bf982f37bb70825df71a9709fa90ea9f4447fb3c099e1d720a439d88bad6" "0.5.0": - sha256: eede71f28371bf39aa69b45de23b329d37214016e2055269b3b5e7cfd40b59f5 - url: https://github.com/google/glog/archive/refs/tags/v0.5.0.tar.gz + url: "https://github.com/google/glog/archive/refs/tags/v0.5.0.tar.gz" + sha256: "eede71f28371bf39aa69b45de23b329d37214016e2055269b3b5e7cfd40b59f5" "0.4.0": - sha256: f28359aeba12f30d73d9e4711ef356dc842886968112162bc73002645139c39c - url: https://github.com/google/glog/archive/v0.4.0.tar.gz + url: "https://github.com/google/glog/archive/v0.4.0.tar.gz" + sha256: "f28359aeba12f30d73d9e4711ef356dc842886968112162bc73002645139c39c" patches: "0.5.0": - patch_file: "patches/0001-fix-msvc-snprintf.patch" diff --git a/recipes/glog/all/conanfile.py b/recipes/glog/all/conanfile.py index 2d7a2e163db5b..3b6d58c7ef863 100644 --- a/recipes/glog/all/conanfile.py +++ b/recipes/glog/all/conanfile.py @@ -1,21 +1,23 @@ from conan import ConanFile +from conan.errors import ConanInvalidConfiguration 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, 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.scm import Version +from conan.tools.build import check_min_cppstd import os -required_conan_version = ">=1.51.1" +required_conan_version = ">=1.54.0" class GlogConan(ConanFile): name = "glog" - url = "https://github.com/conan-io/conan-center-index" - homepage = "https://github.com/google/glog/" description = "Google logging library" - topics = ("conan", "glog", "logging") license = "BSD-3-Clause" - + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/google/glog/" + topics = ("logging",) + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -32,9 +34,22 @@ class GlogConan(ConanFile): "with_unwind": True, } + @property + def _min_cppstd(self): + return 14 + + @property + def _compilers_minimum_version(self): + return { + "apple-clang": "10", + "clang": "7", + "gcc": "7", + "msvc": "191", + "Visual Studio": "15", + } + 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,7 +59,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 @@ -53,24 +68,38 @@ def layout(self): def requirements(self): if self.options.with_gflags: - self.requires("gflags/2.2.2") + self.requires("gflags/2.2.2", transitive_headers=True, transitive_libs=True) # 0.4.0 requires libunwind unconditionally 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") + self.requires("libunwind/1.8.0", transitive_headers=True, transitive_libs=True) + + def validate(self): + if Version(self.version) < "0.7.0": + return + 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 build_requirements(self): - if Version(self.version) >= "0.6.0": - self.tool_requires("cmake/3.22.3") + if Version(self.version) >= "0.7.0": + self.tool_requires("cmake/[>=3.22 <4]") + elif Version(self.version) >= "0.6.0": + self.tool_requires("cmake/[>=3.16 <4]") 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": @@ -87,9 +116,6 @@ def generate(self): tc = CMakeDeps(self) tc.generate() - tc = VirtualBuildEnv(self) - tc.generate(scope="build") - def _patch_sources(self): apply_conandata_patches(self) # do not force PIC @@ -122,7 +148,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"] @@ -131,3 +157,5 @@ def package_info(self): self.cpp_info.defines.append(f"GOOGLE_GLOG_DLL_DECL={decl}") if self.options.with_gflags and not self.options.shared: self.cpp_info.defines.extend(["GFLAGS_DLL_DECLARE_FLAG=", "GFLAGS_DLL_DEFINE_FLAG="]) + if Version(self.version) >= "0.7.0": + self.cpp_info.defines.extend(["GLOG_USE_GLOG_EXPORT="]) diff --git a/recipes/glog/all/test_package/CMakeLists.txt b/recipes/glog/all/test_package/CMakeLists.txt index 286cd0d4348c1..846b06b94b1ef 100644 --- a/recipes/glog/all/test_package/CMakeLists.txt +++ b/recipes/glog/all/test_package/CMakeLists.txt @@ -1,7 +1,10 @@ cmake_minimum_required(VERSION 3.1) -project(test_package CXX) +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) +if (glog_VERSION VERSION_GREATER_EQUAL "0.7.0") + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) +endif() diff --git a/recipes/glog/all/test_v1_package/CMakeLists.txt b/recipes/glog/all/test_v1_package/CMakeLists.txt index 3473c9c27d148..0d20897301b68 100644 --- a/recipes/glog/all/test_v1_package/CMakeLists.txt +++ b/recipes/glog/all/test_v1_package/CMakeLists.txt @@ -1,10 +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(glog REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} glog::glog) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/glog/config.yml b/recipes/glog/config.yml index babcbfb79d964..3e17acecd35c8 100644 --- a/recipes/glog/config.yml +++ b/recipes/glog/config.yml @@ -1,4 +1,8 @@ versions: + "0.7.1": + folder: all + "0.7.0": + folder: all "0.6.0": folder: all "0.5.0": diff --git a/recipes/glpk/all/conanfile.py b/recipes/glpk/all/conanfile.py index e03f104fe6d73..7c7e12af60356 100644 --- a/recipes/glpk/all/conanfile.py +++ b/recipes/glpk/all/conanfile.py @@ -1,10 +1,15 @@ -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, conan_version +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 copy, 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.45.0" +required_conan_version = ">=1.54.0" class GlpkConan(ConanFile): @@ -14,137 +19,98 @@ class GlpkConan(ConanFile): topics = ("linear", "programming", "simplex", "solver") url = "https://github.com/conan-io/conan-center-index" license = "GPL-3.0-or-later" + package_type = "library" 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) - @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"]) - 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): - 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") + if is_msvc(self): + self.tool_requires("automake/1.16.5") 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): + env = VirtualBuildEnv(self) + env.generate() + + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") - @contextmanager - def _build_context(self): + tc = AutotoolsToolchain(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".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 - - 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 _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.extra_defines.append("__WOE__") + if (Version(conan_version).major < "2" and 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): - self._autotools.defines.append("__WOE__") - if self.settings.compiler == "Visual Studio" and \ - tools.Version(self.settings.compiler.version) >= "12": - self._autotools.flags.append("-FS") - self._autotools.configure(args=args, configure_dir=self._source_subfolder) - return self._autotools + env = Environment() + 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): - #self._patch_source() - 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") - + 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")) + fix_apple_shared_install_name(self) if is_msvc(self) and self.options.shared: pjoin = lambda p: os.path.join(self.package_folder, "lib", p) rename(self, pjoin("glpk.dll.lib"), pjoin("glpk.lib")) def package_info(self): - self.cpp_info.set_property("cmake_find_mode", "both") - self.cpp_info.set_property("cmake_file_name", "glpk") - self.cpp_info.set_property("cmake_target_name", "glpk::glpk") - self.cpp_info.set_property("pkg_config_name", "glpk") - - self.cpp_info.components["libglpk"].set_property("cmake_target_name", "glpk::glpk") - self.cpp_info.components["libglpk"].libs = ["glpk"] - - if self.settings.os in ("FreeBSD", "Linux"): - self.cpp_info.components["libglpk"].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"] = "glpk" - self.cpp_info.names["cmake_find_package_multi"] = "glpk" - self.cpp_info.components["libglpk"].names["cmake_find_package"] = "glpk" - self.cpp_info.components["libglpk"].names["cmake_find_package_multi"] = "glpk" - + self.cpp_info.libs = ["glpk"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") + # TODO: to remove in conan v2 + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/glpk/all/test_package/CMakeLists.txt b/recipes/glpk/all/test_package/CMakeLists.txt index 3258d5f78ee30..b283b9e10c4e0 100644 --- a/recipes/glpk/all/test_package/CMakeLists.txt +++ b/recipes/glpk/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(glpk CONFIG REQUIRED) +find_package(glpk REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) target_link_libraries(${PROJECT_NAME} PRIVATE glpk::glpk) diff --git a/recipes/glpk/all/test_package/conanfile.py b/recipes/glpk/all/test_package/conanfile.py index 66177d47bc143..0a6bc68712d90 100644 --- a/recipes/glpk/all/test_package/conanfile.py +++ b/recipes/glpk/all/test_package/conanfile.py @@ -1,17 +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 GlpkTestConan(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 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 layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -19,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/glpk/all/test_package/test_package.c b/recipes/glpk/all/test_package/test_package.c index 965bd82a292c4..4c43ab6e7eb91 100644 --- a/recipes/glpk/all/test_package/test_package.c +++ b/recipes/glpk/all/test_package/test_package.c @@ -11,44 +11,43 @@ int main(void) { glp_prob *lp; int ia[1+1000], ja[1+1000]; double ar[1+1000], z, x1, x2, x3; -s1: lp = glp_create_prob(); -s2: glp_set_prob_name(lp, "sample"); -s3: glp_set_obj_dir(lp, GLP_MAX); -s4: glp_add_rows(lp, 3); -s5: glp_set_row_name(lp, 1, "p"); -s6: glp_set_row_bnds(lp, 1, GLP_UP, 0.0, 100.0); -s7: glp_set_row_name(lp, 2, "q"); -s8: glp_set_row_bnds(lp, 2, GLP_UP, 0.0, 600.0); -s9: glp_set_row_name(lp, 3, "r"); -s10: glp_set_row_bnds(lp, 3, GLP_UP, 0.0, 300.0); -s11: glp_add_cols(lp, 3); -s12: glp_set_col_name(lp, 1, "x1"); -s13: glp_set_col_bnds(lp, 1, GLP_LO, 0.0, 0.0); -s14: glp_set_obj_coef(lp, 1, 10.0); -s15: glp_set_col_name(lp, 2, "x2"); -s16: glp_set_col_bnds(lp, 2, GLP_LO, 0.0, 0.0); -s17: glp_set_obj_coef(lp, 2, 6.0); -s18: glp_set_col_name(lp, 3, "x3"); -s19: glp_set_col_bnds(lp, 3, GLP_LO, 0.0, 0.0); -s20: glp_set_obj_coef(lp, 3, 4.0); -s21: ia[1] = 1, ja[1] = 1, ar[1] = 1.0; /* a[1,1] = 1 */ -s22: ia[2] = 1, ja[2] = 2, ar[2] = 1.0; /* a[1,2] = 1 */ -s23: ia[3] = 1, ja[3] = 3, ar[3] = 1.0; /* a[1,3] = 1 */ -s24: ia[4] = 2, ja[4] = 1, ar[4] = 10.0; /* a[2,1] = 10 */ -s25: ia[5] = 3, ja[5] = 1, ar[5] = 2.0; /* a[3,1] = 2 */ -s26: ia[6] = 2, ja[6] = 2, ar[6] = 4.0; /* a[2,2] = 4 */ -s27: ia[7] = 3, ja[7] = 2, ar[7] = 2.0; /* a[3,2] = 2 */ -s28: ia[8] = 2, ja[8] = 3, ar[8] = 5.0; /* a[2,3] = 5 */ -s29: ia[9] = 3, ja[9] = 3, ar[9] = 6.0; /* a[3,3] = 6 */ -s30: glp_load_matrix(lp, 9, ia, ja, ar); -s31: glp_simplex(lp, NULL); -s32: z = glp_get_obj_val(lp); -s33: x1 = glp_get_col_prim(lp, 1); -s34: x2 = glp_get_col_prim(lp, 2); -s35: x3 = glp_get_col_prim(lp, 3); -s36: printf("\nz = %g; x1 = %g; x2 = %g; x3 = %g\n", + lp = glp_create_prob(); + glp_set_prob_name(lp, "sample"); + glp_set_obj_dir(lp, GLP_MAX); + glp_add_rows(lp, 3); + glp_set_row_name(lp, 1, "p"); + glp_set_row_bnds(lp, 1, GLP_UP, 0.0, 100.0); + glp_set_row_name(lp, 2, "q"); + glp_set_row_bnds(lp, 2, GLP_UP, 0.0, 600.0); + glp_set_row_name(lp, 3, "r"); + glp_set_row_bnds(lp, 3, GLP_UP, 0.0, 300.0); + glp_add_cols(lp, 3); + glp_set_col_name(lp, 1, "x1"); + glp_set_col_bnds(lp, 1, GLP_LO, 0.0, 0.0); + glp_set_obj_coef(lp, 1, 10.0); + glp_set_col_name(lp, 2, "x2"); + glp_set_col_bnds(lp, 2, GLP_LO, 0.0, 0.0); + glp_set_obj_coef(lp, 2, 6.0); + glp_set_col_name(lp, 3, "x3"); + glp_set_col_bnds(lp, 3, GLP_LO, 0.0, 0.0); + glp_set_obj_coef(lp, 3, 4.0); + ia[1] = 1, ja[1] = 1, ar[1] = 1.0; /* a[1,1] = 1 */ + ia[2] = 1, ja[2] = 2, ar[2] = 1.0; /* a[1,2] = 1 */ + ia[3] = 1, ja[3] = 3, ar[3] = 1.0; /* a[1,3] = 1 */ + ia[4] = 2, ja[4] = 1, ar[4] = 10.0; /* a[2,1] = 10 */ + ia[5] = 3, ja[5] = 1, ar[5] = 2.0; /* a[3,1] = 2 */ + ia[6] = 2, ja[6] = 2, ar[6] = 4.0; /* a[2,2] = 4 */ + ia[7] = 3, ja[7] = 2, ar[7] = 2.0; /* a[3,2] = 2 */ + ia[8] = 2, ja[8] = 3, ar[8] = 5.0; /* a[2,3] = 5 */ + ia[9] = 3, ja[9] = 3, ar[9] = 6.0; /* a[3,3] = 6 */ + glp_load_matrix(lp, 9, ia, ja, ar); + glp_simplex(lp, NULL); + z = glp_get_obj_val(lp); + x1 = glp_get_col_prim(lp, 1); + x2 = glp_get_col_prim(lp, 2); + x3 = glp_get_col_prim(lp, 3); + printf("\nz = %g; x1 = %g; x2 = %g; x3 = %g\n", z, x1, x2, x3); -s37: glp_delete_prob(lp); + glp_delete_prob(lp); return 0; } - diff --git a/recipes/glpk/all/test_v1_package/CMakeLists.txt b/recipes/glpk/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..b21cc49efde95 --- /dev/null +++ b/recipes/glpk/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/glpk/all/test_v1_package/conanfile.py b/recipes/glpk/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/glpk/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/glshaderpp/all/conanfile.py b/recipes/glshaderpp/all/conanfile.py index 5f5d7e6cc487c..047572c5d5dc7 100644 --- a/recipes/glshaderpp/all/conanfile.py +++ b/recipes/glshaderpp/all/conanfile.py @@ -1,25 +1,26 @@ -from conans import ConanFile, 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.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.52.0" + class GLShaderPPConan(ConanFile): name = "glshaderpp" - homepage = "https://gitlab-lepuy.iut.uca.fr/opengl/glshaderpp" description = "A lightweight header-only library to compile and link OpenGL GLSL shaders." - topics = ("opengl", "glsl", "shader", "header-only") - url = "https://github.com/conan-io/conan-center-index" - no_copy_source = True license = "LGPL-3.0-or-later" - settings = "compiler", "os", "arch", "build_type" - - @property - def _source_subfolder(self): - return "source_subfolder" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://gitlab-lepuy.iut.uca.fr/opengl/glshaderpp" + topics = ("opengl", "glsl", "shader", "header-only") - def package_id(self): - self.info.header_only() + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True @property def _minimum_cpp_standard(self): @@ -28,28 +29,45 @@ def _minimum_cpp_standard(self): @property def _minimum_compilers_version(self): return { - "Visual Studio": "17", "gcc": "7", "clang": "6", "apple-clang": "10", + "msvc": "193", + "Visual Studio": "17", } + 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._minimum_cpp_standard) 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} compiler support.") + self.output.warning(f"{self.name} recipe lacks information about the {self.settings.compiler} compiler support.") else: - if tools.Version(self.settings.compiler.version) < min_version: - raise ConanInvalidConfiguration(f"{self.name} requires C++{self._minimum_cpp_standard} support. The current compiler {self.settings.compiler} {self.settings.compiler.version} does not support it.") + if Version(self.settings.compiler.version) < min_version: + raise ConanInvalidConfiguration( + f"{self.name} requires C++{self._minimum_cpp_standard} support. The current compiler" + f" {self.settings.compiler} {self.settings.compiler.version} does not support it." + ) 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", src=self._source_subfolder, dst="licenses") - self.copy("*", src=os.path.join(self._source_subfolder, "include"), dst="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 = [] + self.cpp_info.includedirs.append(os.path.join("include", "GLShaderPP")) diff --git a/recipes/glshaderpp/all/test_package/CMakeLists.txt b/recipes/glshaderpp/all/test_package/CMakeLists.txt index 7f0e01ff5256f..36af631b4dd6a 100644 --- a/recipes/glshaderpp/all/test_package/CMakeLists.txt +++ b/recipes/glshaderpp/all/test_package/CMakeLists.txt @@ -1,12 +1,9 @@ -cmake_minimum_required(VERSION 3.1) -project(PackageTest CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.15) +project(test_package CXX) find_package(glew CONFIG REQUIRED) find_package(glshaderpp CONFIG REQUIRED) -add_executable(${PROJECT_NAME} example.cpp) +add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} glshaderpp::glshaderpp GLEW::GLEW) set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 17 CXX_STANDARD_REQUIRED ON) diff --git a/recipes/glshaderpp/all/test_package/conanfile.py b/recipes/glshaderpp/all/test_package/conanfile.py index b5aad28ecae40..8141b9ee65dbb 100644 --- a/recipes/glshaderpp/all/test_package/conanfile.py +++ b/recipes/glshaderpp/all/test_package/conanfile.py @@ -1,19 +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 + class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain" + test_type = "explicit" def requirements(self): + self.requires(self.tested_reference_str) self.requires("glew/2.2.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", "PackageTest") - 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/glshaderpp/all/test_package/example.cpp b/recipes/glshaderpp/all/test_package/example.cpp deleted file mode 100644 index eb8a668f50e89..0000000000000 --- a/recipes/glshaderpp/all/test_package/example.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include -#include -#include -#include - -int main() { - GLShaderPP::CShaderException e("If you read this, GLShaderPP is happy :)", GLShaderPP::CShaderException::ExceptionType::LinkError); - std::cout << e.what() << '\n'; - return EXIT_SUCCESS; -} diff --git a/recipes/glshaderpp/all/test_package/test_package.cpp b/recipes/glshaderpp/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..e8dce6ff7068b --- /dev/null +++ b/recipes/glshaderpp/all/test_package/test_package.cpp @@ -0,0 +1,13 @@ +#include +#include +#include +#include + +#include + +int main() { + GLShaderPP::CShaderException e("If you read this, GLShaderPP is happy :)", + GLShaderPP::CShaderException::ExceptionType::LinkError); + std::cout << e.what() << '\n'; + return EXIT_SUCCESS; +} diff --git a/recipes/glshaderpp/all/test_v1_package/CMakeLists.txt b/recipes/glshaderpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/glshaderpp/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/glshaderpp/all/test_v1_package/conanfile.py b/recipes/glshaderpp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..6e16e1852823f --- /dev/null +++ b/recipes/glshaderpp/all/test_v1_package/conanfile.py @@ -0,0 +1,19 @@ +import os +from conans import ConanFile, CMake, tools + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def requirements(self): + self.requires("glew/2.2.0") + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/glslang/all/conandata.yml b/recipes/glslang/all/conandata.yml index 5f989bd0af008..091cef7cb2d40 100644 --- a/recipes/glslang/all/conandata.yml +++ b/recipes/glslang/all/conandata.yml @@ -1,45 +1,20 @@ +# Add only the SDK release versions from https://github.com/KhronosGroup/glslang/tags for consistency sources: - "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" - "1.3.211.0": - url: "https://github.com/KhronosGroup/glslang/archive/refs/tags/sdk-1.3.211.0.tar.gz" - sha256: "4335eec84b87d64130e860dad5d6dc1f722277d4e0ff5027153e2743628cb221" - "1.3.204.0": - url: "https://github.com/KhronosGroup/glslang/archive/refs/tags/sdk-1.3.204.0.tar.gz" - sha256: "c6bec993194377944fb8d6d585a90e1288994660782d709e30fa1d91810d6820" - "11.7.0": - url: "https://github.com/KhronosGroup/glslang/archive/refs/tags/11.7.0.tar.gz" - sha256: "b6c83864c3606678d11675114fa5f358c519fe1dad9a781802bcc87fb8fa32d5" - "11.6.0": - url: "https://github.com/KhronosGroup/glslang/archive/refs/tags/11.6.0.tar.gz" - sha256: "99ecd3a0c2c2219293d76723846f762a9f3e7dd0dc2a4f346d0fc3a05a0ce000" - "11.5.0": - url: "https://github.com/KhronosGroup/glslang/archive/11.5.0.tar.gz" - sha256: "fd0b5e3bda591bb08bd3049655a99a0a55f0de4059b9c8f7b397e4b19cf5d51f" - "8.13.3559": - url: "https://github.com/KhronosGroup/glslang/archive/8.13.3559.tar.gz" - sha256: "c58fdcf7e00943ba10f9ae565b2725ec9d5be7dab7c8e82cac72fcaa83c652ca" -patches: - "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" - "1.3.211.0": - - patch_file: "patches/0001-no-force-glslang-pic.patch" - "1.3.204.0": - - patch_file: "patches/0001-no-force-glslang-pic.patch" - "11.7.0": - - patch_file: "patches/0001-no-force-glslang-pic.patch" - "11.6.0": - - patch_file: "patches/0001-no-force-glslang-pic.patch" - "11.5.0": - - patch_file: "patches/0001-no-force-glslang-pic.patch" + "1.3.268.0": + url: "https://github.com/KhronosGroup/glslang/archive/refs/tags/vulkan-sdk-1.3.268.0.tar.gz" + sha256: "8cfb4824f185bc246cd41cceedbfcdf14abd3d2fa861512baf81df8a263b9283" + "1.3.261.1": + url: "https://github.com/KhronosGroup/glslang/archive/refs/tags/sdk-1.3.261.1.tar.gz" + sha256: "eb1f9c2ff0a1409151d7749fb37bc1988dc1fd908444c1e4f43d4190c90befcd" + "1.3.243.0": + url: "https://github.com/KhronosGroup/glslang/archive/refs/tags/sdk-1.3.243.0.tar.gz" + sha256: "18b8f296874ac19d034bfb9060238c87b6d67a39af0dfd305d3252762c265f9f" + "1.3.239.0": + url: "https://github.com/KhronosGroup/glslang/archive/refs/tags/sdk-1.3.239.0.tar.gz" + sha256: "8b040328c18399b7bbf5bef84fac3d7b7376b39ec6833b7e19b7961bf7a72017" + "1.3.236.0": + url: "https://github.com/KhronosGroup/glslang/archive/refs/tags/sdk-1.3.236.0.tar.gz" + sha256: "fb6f323a36efcd98766bb72f598008f73c4c92bce69c79fc98ad2b3cdca0c263" + "1.2.198.0": + url: "https://github.com/KhronosGroup/glslang/archive/refs/tags/sdk-1.2.198.0.tar.gz" + sha256: "b2a0541caf01de4fc411cbb32c805a3bd0f6578432e532c5fa6336d187a4a1b1" diff --git a/recipes/glslang/all/conanfile.py b/recipes/glslang/all/conanfile.py index b5f950bef195e..2302eb69e2d87 100644 --- a/recipes/glslang/all/conanfile.py +++ b/recipes/glslang/all/conanfile.py @@ -1,24 +1,27 @@ +import os +import re + from conan import ConanFile -from conan.errors import ConanInvalidConfiguration -from conan.tools.apple import is_apple_os +from conan.errors import ConanInvalidConfiguration, ConanException 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.env import VirtualBuildEnv +from conan.tools.files import copy, get, rmdir from conan.tools.scm import Version -import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.54.0" class GlslangConan(ConanFile): name = "glslang" description = "Khronos-reference front end for GLSL/ESSL, partial front " \ "end for HLSL, and a SPIR-V generator." - license = ["BSD-3-Clause", "NVIDIA"] + license = "DocumentRef-LICENSE.txt:LicenseRef-glslang" topics = ("glsl", "hlsl", "spirv", "spir-v", "validation", "translation") homepage = "https://github.com/KhronosGroup/glslang" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -41,7 +44,6 @@ class GlslangConan(ConanFile): 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": @@ -49,112 +51,80 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") - @property - def _get_compatible_spirv_tools_version(self): - return { - "11.7.0": "2021.4", - "11.6.0": "2021.3", - "11.5.0": "2021.2", - "8.13.3559": "2020.5", - }.get(str(self.version), self.version) - def requirements(self): if self.options.enable_optimizer: - self.requires(f"spirv-tools/{self._get_compatible_spirv_tools_version}") + self.requires(f"spirv-tools/{self.version}") def validate(self): - if self.info.settings.compiler.get_safe("cppstd"): + if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, 11) # see https://github.com/KhronosGroup/glslang/issues/2283 - 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(f"{self.ref} shared library build is broken on {self.info.settings.os}") - - if self.info.options.enable_optimizer and self.dependencies["spirv-tools"].options.shared: + if self.options.shared: + if self.settings.os == "Windows": + raise ConanInvalidConfiguration(f"{self.ref} shared library build is broken on {self.settings.os}") + + if self.options.enable_optimizer and self.dependencies["spirv-tools"].options.shared: raise ConanInvalidConfiguration( f"{self.ref} with enable_optimizer requires static spirv-tools, " "because SPIRV-Tools-opt is not built if shared" ) + def build_requirements(self): + if Version(self.version) >= "1.3.261": + self.tool_requires("cmake/[>=3.17.2 <4]") + 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): + venv = VirtualBuildEnv(self) + venv.generate() + 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_GLSLANG_JS"] = False + tc.variables["ENABLE_GLSLANG_WEBMIN"] = False + tc.variables["ENABLE_GLSLANG_WEBMIN_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_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.variables["OVERRIDE_MSVCCRT"] = False + tc.variables["CMAKE_MACOSX_BUNDLE"] = False + # Generate a relocatable shared lib on Macos + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" + # glslang builds intermediate static libs, but Conan does not set -fPIC for shared builds + tc.variables["CMAKE_POSITION_INDEPENDENT_CODE"] = self.options.get_safe("fPIC", True) tc.generate() 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: - cmake_files_to_fix = [ - {"target": "OGLCompiler", "relpath": os.path.join("OGLCompilersDLL", "CMakeLists.txt")}, - {"target": "SPIRV" , "relpath": os.path.join("SPIRV", "CMakeLists.txt")}, - {"target": "SPVRemapper", "relpath": os.path.join("SPIRV", "CMakeLists.txt")}, - {"target": "OSDependent", "relpath": os.path.join("glslang", "OSDependent", "Unix","CMakeLists.txt")}, - {"target": "OSDependent", "relpath": os.path.join("glslang", "OSDependent", "Windows","CMakeLists.txt")}, - {"target": "HLSL" , "relpath": os.path.join("hlsl", "CMakeLists.txt")}, - ] - 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")}) - 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: - 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"]), - "") + for cmake_file in sorted(self.source_path.rglob("CMakeLists.txt")): + content = cmake_file.read_text(encoding="utf8") + if "POSITION_INDEPENDENT_CODE ON" in content: + content = re.sub(r"set_property\(TARGET \S+ PROPERTY POSITION_INDEPENDENT_CODE ON\)\n", "", content) + content = content.replace("POSITION_INDEPENDENT_CODE ON", "") + cmake_file.write_text(content, encoding="utf8") + self.output.info(f"Patched fPIC handling in {cmake_file.relative_to(self.source_path)}") + if "POSITION_INDEPENDENT_CODE" in content: + raise ConanException(f"POSITION_INDEPENDENT_CODE found in {cmake_file}, please update the recipe") def build(self): self._patch_sources() @@ -163,7 +133,7 @@ def build(self): cmake.build() def package(self): - copy(self, "LICENSE.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "LICENSE.txt", self.source_folder, os.path.join(self.package_folder, "licenses")) cmake = CMake(self) cmake.install() rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) @@ -171,22 +141,21 @@ def package(self): def package_info(self): 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 + 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 + has_machineindependent = not self.options.shared + has_genericcodegen = not self.options.shared + has_osdependent = not self.options.shared + has_oglcompiler = 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 = [f"glslang{lib_suffix}"] - if (glslang_version < "7.0.0" or glslang_version >= "11.0.0") and self.options.shared: + if 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"]) @@ -264,3 +233,9 @@ def package_info(self): if self.options.build_executables: self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) + + if Version(self.version) >= "1.3.243": + self.cpp_info.components["glslang-default-resource-limits"].set_property("cmake_target_name", "glslang::glslang-default-resource-limits") + self.cpp_info.components["glslang-default-resource-limits"].names["cmake_find_package"] = "glslang-default-resource-limits" + self.cpp_info.components["glslang-default-resource-limits"].names["cmake_find_package_multi"] = "glslang-default-resource-limits" + self.cpp_info.components["glslang-default-resource-limits"].libs = [f"glslang-default-resource-limits{lib_suffix}"] diff --git a/recipes/glslang/all/patches/0001-no-force-glslang-pic.patch b/recipes/glslang/all/patches/0001-no-force-glslang-pic.patch deleted file mode 100644 index 00e2266d3a9ae..0000000000000 --- a/recipes/glslang/all/patches/0001-no-force-glslang-pic.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/glslang/CMakeLists.txt -+++ b/glslang/CMakeLists.txt -@@ -167,7 +167,6 @@ - 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/conanfile.py b/recipes/glslang/all/test_package/conanfile.py index 216f67362e0fd..ee5a5cfcdd781 100644 --- a/recipes/glslang/all/test_package/conanfile.py +++ b/recipes/glslang/all/test_package/conanfile.py @@ -13,7 +13,7 @@ def layout(self): cmake_layout(self) def requirements(self): - self.requires(self.tested_reference_str) + self.requires(self.tested_reference_str, run=can_run(self)) def build(self): cmake = CMake(self) diff --git a/recipes/glslang/config.yml b/recipes/glslang/config.yml index eb0c5a565bc36..87519b61c9623 100644 --- a/recipes/glslang/config.yml +++ b/recipes/glslang/config.yml @@ -1,19 +1,13 @@ versions: - "1.3.231.1": + "1.3.268.0": folder: all - "1.3.224.0": + "1.3.261.1": folder: all - "1.3.216.0": + "1.3.243.0": folder: all - "1.3.211.0": + "1.3.239.0": folder: all - "1.3.204.0": + "1.3.236.0": folder: all - "11.7.0": - folder: all - "11.6.0": - folder: all - "11.5.0": - folder: all - "8.13.3559": + "1.2.198.0": folder: all diff --git a/recipes/glu/all/conanfile.py b/recipes/glu/all/conanfile.py index 42fc9acb237e8..17787ed1bf0f7 100644 --- a/recipes/glu/all/conanfile.py +++ b/recipes/glu/all/conanfile.py @@ -1,9 +1,9 @@ from conan import ConanFile -from conan.errors import ConanException +from conan.tools.apple import is_apple_os +from conan.tools.gnu import PkgConfig from conan.tools.system import package_manager -from conans import tools -required_conan_version = ">=1.47" +required_conan_version = ">=1.51.3" class SysConfigGLUConan(ConanFile): @@ -14,10 +14,24 @@ class SysConfigGLUConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://cgit.freedesktop.org/mesa/glu/" license = "SGI-B-2.0" + package_type = "shared-library" settings = "os", "arch", "compiler", "build_type" - requires = "opengl/system" + + def layout(self): + pass + + def requirements(self): + # - glu headers include opengl headers + # - on Apple OS, glu is part of OpenGL framework, already managed by opengl recipe + self.requires("opengl/system", transitive_headers=True, transitive_libs=is_apple_os(self)) + + def package_id(self): + self.info.clear() def system_requirements(self): + if self.settings.os not in ["Linux", "FreeBSD", "SunOS"]: + return + dnf = package_manager.Dnf(self) dnf.install(["mesa-libGLU-devel"], update=True, check=True) @@ -36,34 +50,16 @@ def system_requirements(self): pkg = package_manager.Pkg(self) pkg.install(["libGLU"], 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")] - - 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) + pkg_util = package_manager.PkgUtil(self) + pkg_util.install(["mesalibs"], 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"] - elif self.settings.os in ["Linux", "FreeBSD"]: - self._fill_cppinfo_from_pkgconfig("glu") - - def package_id(self): - self.info.header_only() + self.cpp_info.system_libs = ["glu32"] + elif self.settings.os in ["Linux", "FreeBSD", "SunOS"]: + 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_package/test_package.c b/recipes/glu/all/test_package/test_package.c index 9beded5a5fd8b..27c553570eadf 100644 --- a/recipes/glu/all/test_package/test_package.c +++ b/recipes/glu/all/test_package/test_package.c @@ -1,13 +1,11 @@ #include #ifdef __APPLE__ -# include # include #else # ifdef _WIN32 -# include +# include # endif -# include # include #endif 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/gm2calc/all/CMakeLists.txt b/recipes/gm2calc/all/CMakeLists.txt deleted file mode 100644 index 023f135034eed..0000000000000 --- a/recipes/gm2calc/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(MSVC AND BUILD_SHARED_LIBS) - set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) -endif() - -add_subdirectory("source_subfolder") diff --git a/recipes/gm2calc/all/conandata.yml b/recipes/gm2calc/all/conandata.yml index 5246438fdf67a..20c1af33fc98d 100644 --- a/recipes/gm2calc/all/conandata.yml +++ b/recipes/gm2calc/all/conandata.yml @@ -8,7 +8,9 @@ sources: "2.1.0": url: "https://github.com/GM2Calc/GM2Calc/archive/v2.1.0.tar.gz" sha256: "33fd0d6da089e25ae0a6ac81b70e9bc9152952e7be4383f4c0baa862af7921bb" + "2.2.0": + url: "https://github.com/GM2Calc/GM2Calc/archive/v2.2.0.tar.gz" + sha256: "02c36a3d1d58d66cd1bce8affcd64152d965596075730d51147dc5ac78323106" patches: "1.7.5": - patch_file: "patches/0001-update-1.7.5-to-FindMathematica-3.6.0.patch" - base_path: "source_subfolder" diff --git a/recipes/gm2calc/all/conanfile.py b/recipes/gm2calc/all/conanfile.py index 5332dc62195c9..4eb7c82e9db86 100644 --- a/recipes/gm2calc/all/conanfile.py +++ b/recipes/gm2calc/all/conanfile.py @@ -1,35 +1,35 @@ import os -import conan -from conans import ConanFile, CMake, tools -required_conan_version = ">=1.30.0" +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, replace_in_file, save +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" class Gm2calcConan(ConanFile): name = "gm2calc" + description = "C++ library to calculate the anomalous magnetic moment of the muon in the MSSM and 2HDM" license = "GPL-3.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/GM2Calc/GM2Calc" - description = "C++ library to calculate the anomalous magnetic moment of the muon in the MSSM and 2HDM" topics = ("high-energy", "physics", "hep", "magnetic moment", "muon", "mssm", "2hdm") - 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_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - @property - def _build_subfolder(self): - return "build_subfolder" + 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): - 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,38 +37,58 @@ 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("eigen/3.3.9") + self.requires("boost/1.83.0") + self.requires("eigen/3.4.0", transitive_headers=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]) - conan.tools.files.rename(self, "GM2Calc-{}".format(self.version), self._source_subfolder) + 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() + tc = CMakeDeps(self) + tc.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + if Version(self.version) < "2.2.0": + replace_in_file(self, os.path.join(self.source_folder, "src", "CMakeLists.txt"), "EIGEN3", "Eigen3") + # Fix src/slhaea.h:25:10: fatal error: boost/algorithm/string/classification.hpp: No such file or directory + save(self, os.path.join(self.source_folder, "src", "CMakeLists.txt"), + "\ninclude_directories(${Boost_INCLUDE_DIRS})", append=True) + # Disable examples, test and doc + for subdir in ["examples", "test", "doc"]: + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), f"add_subdirectory({subdir})", "") 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 _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 package(self): - self.copy(pattern="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")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): + self.cpp_info.set_property("cmake_file_name", "GM2Calc") + self.cpp_info.set_property("cmake_target_name", "GM2Calc::GM2Calc") + self.cpp_info.set_property("pkg_config_name", "gm2calc") + self.cpp_info.libs = ["gm2calc"] + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.names["cmake_find_package"] = "GM2Calc" self.cpp_info.names["cmake_find_package_multi"] = "GM2Calc" - self.cpp_info.names["pkg_config"] = "gm2calc" - self.cpp_info.libs = ["gm2calc"] - self.cpp_info.requires = ["boost::headers", "eigen::eigen"] diff --git a/recipes/gm2calc/all/test_package/CMakeLists.txt b/recipes/gm2calc/all/test_package/CMakeLists.txt index 126cafe808e38..4cff2f8c273e9 100644 --- a/recipes/gm2calc/all/test_package/CMakeLists.txt +++ b/recipes/gm2calc/all/test_package/CMakeLists.txt @@ -1,11 +1,10 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(PackageTest C CXX) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(GM2Calc REQUIRED CONFIG) add_executable(test_package test_package.cpp) -target_link_libraries(test_package ${CONAN_LIBS}) +target_link_libraries(test_package PRIVATE GM2Calc::GM2Calc) diff --git a/recipes/gm2calc/all/test_package/conanfile.py b/recipes/gm2calc/all/test_package/conanfile.py index ab40ee8b181e8..ef5d7042163ec 100644 --- a/recipes/gm2calc/all/test_package/conanfile.py +++ b/recipes/gm2calc/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 Gm2calcTestConan(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): - self.run(os.path.join("bin", "test_package"), 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/gm2calc/all/test_v1_package/CMakeLists.txt b/recipes/gm2calc/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/gm2calc/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/gm2calc/all/test_v1_package/conanfile.py b/recipes/gm2calc/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5ff327440fd86 --- /dev/null +++ b/recipes/gm2calc/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +import os + +from conans import ConanFile, CMake, tools + + +class Gm2calcTestConan(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/gm2calc/config.yml b/recipes/gm2calc/config.yml index 008d442d385b9..783fc3e71ba44 100644 --- a/recipes/gm2calc/config.yml +++ b/recipes/gm2calc/config.yml @@ -5,3 +5,5 @@ versions: folder: all "2.1.0": folder: all + "2.2.0": + folder: all diff --git a/recipes/gmp/all/conandata.yml b/recipes/gmp/all/conandata.yml index d97aab0d277f2..2590ca2c5c73a 100644 --- a/recipes/gmp/all/conandata.yml +++ b/recipes/gmp/all/conandata.yml @@ -1,6 +1,13 @@ sources: + "6.3.0": + url: + - "https://ftp.gnu.org/gnu/gmp/gmp-6.3.0.tar.bz2" + - "https://gmplib.org/download/gmp/gmp-6.3.0.tar.bz2" + sha256: "ac28211a7cfb609bae2e2c8d6058d66c8fe96434f740cf6fe2e47b000d1c20cb" "6.2.1": - url: "https://gmplib.org/download/gmp/gmp-6.2.1.tar.bz2" + url: + - "https://ftp.gnu.org/gnu/gmp/gmp-6.2.1.tar.bz2" + - "https://gmplib.org/download/gmp/gmp-6.2.1.tar.bz2" sha256: "eae9326beb4158c386e39a356818031bd28f3124cf915f8c5b1dc4c7a36b4d7c" "6.2.0": url: "https://gmplib.org/download/gmp/gmp-6.2.0.tar.bz2" @@ -9,20 +16,48 @@ sources: url: "https://gmplib.org/download/gmp/gmp-6.1.2.tar.bz2" sha256: "5275bb04f4863a13516b2f39392ac5e272f5e1bb8057b18aec1c9b79d73d8fb2" patches: + "6.3.0": + - patch_file: "patches/0001-msvc-dumpbin-yasm-wrapper.patch" + - patch_file: "patches/6.x.x-0001-fix-MSVC-next-prime-error.patch" + - patch_file: "patches/emscripten/0001-configure.patch" + patch_os: "Emscripten" + patch_source: "https://github.com/fpelliccioni" + patch_type: "portability" + - patch_file: "patches/emscripten/0002-gmp-mparam.h.patch" + patch_os: "Emscripten" + patch_source: "https://github.com/fpelliccioni" + patch_type: "portability" "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" + - patch_file: "patches/6.x.x-0001-fix-MSVC-next-prime-error.patch" + - patch_file: "patches/emscripten/0001-configure.patch" + patch_os: "Emscripten" + patch_source: "https://github.com/fpelliccioni" + patch_type: "portability" + - patch_file: "patches/emscripten/0002-gmp-mparam.h.patch" + patch_os: "Emscripten" + patch_source: "https://github.com/fpelliccioni" + patch_type: "portability" "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" + - patch_file: "patches/6.x.x-0001-fix-MSVC-next-prime-error.patch" + - patch_file: "patches/emscripten/0001-configure.patch" + patch_os: "Emscripten" + patch_source: "https://github.com/fpelliccioni" + patch_type: "portability" + - patch_file: "patches/emscripten/0002-gmp-mparam.h.patch" + patch_os: "Emscripten" + patch_source: "https://github.com/fpelliccioni" + patch_type: "portability" "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" + - patch_file: "patches/emscripten/0001-configure.patch" + patch_os: "Emscripten" + patch_source: "https://github.com/fpelliccioni" + patch_type: "portability" + - patch_file: "patches/emscripten/0002-gmp-mparam.h.patch" + patch_os: "Emscripten" + patch_source: "https://github.com/fpelliccioni" + patch_type: "portability" diff --git a/recipes/gmp/all/conanfile.py b/recipes/gmp/all/conanfile.py index 5ccdd6563bbde..13d9a9a41b8c1 100644 --- a/recipes/gmp/all/conanfile.py +++ b/recipes/gmp/all/conanfile.py @@ -1,11 +1,15 @@ -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 copy, export_conandata_patches, get, patch, 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 import stat -required_conan_version = ">=1.36.0" +required_conan_version = ">=1.57.0" class GmpConan(ConanFile): @@ -15,10 +19,11 @@ class GmpConan(ConanFile): "on signed integers, rational numbers, and floating-point numbers." ) url = "https://github.com/conan-io/conan-center-index" - topics = ("gmp", "math", "arbitrary", "precision", "integer") + topics = ("math", "arbitrary", "precision", "integer") license = ("LGPL-3.0", "GPL-2.0") homepage = "https://gmplib.org" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -37,25 +42,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 +57,113 @@ 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], 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 check_min_vs(self, "180", raise_invalid=False): + 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): + # Usage allowed after consideration with CCI maintainers + for it in self.conan_data.get("patches", {}).get(self.version, []): + if "patch_os" not in it or self.settings.os == it["patch_os"]: + entry = it.copy() + patch_file = entry.pop("patch_file") + patch_file_path = os.path.join(self.export_sources_folder, patch_file) + if "patch_description" not in entry: + entry["patch_description"] = patch_file + patch(self, patch_file=patch_file_path, **entry) + + # 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 +175,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/patches/6.2.x-0001-fix-MSVC-next-prime-error.patch b/recipes/gmp/all/patches/6.x.x-0001-fix-MSVC-next-prime-error.patch similarity index 100% rename from recipes/gmp/all/patches/6.2.x-0001-fix-MSVC-next-prime-error.patch rename to recipes/gmp/all/patches/6.x.x-0001-fix-MSVC-next-prime-error.patch diff --git a/recipes/gmp/all/patches/emscripten/0001-configure.patch b/recipes/gmp/all/patches/emscripten/0001-configure.patch new file mode 100644 index 0000000000000..290382628e9ed --- /dev/null +++ b/recipes/gmp/all/patches/emscripten/0001-configure.patch @@ -0,0 +1,14 @@ +--- configure-orig 2023-08-23 10:38:02 ++++ configure 2023-08-23 10:38:02 +@@ -4078,8 +4078,10 @@ + + + # abilist needs to be non-empty, "standard" is just a generic name here +-abilist="standard" ++abilist="standard longlong" ++limb_longlong=longlong + ++ + # FIXME: We'd like to prefer an ANSI compiler, perhaps by preferring + # c89 over cc here. But note that on HP-UX c89 provides a castrated + # environment, and would want to be excluded somehow. Maybe diff --git a/recipes/gmp/all/patches/emscripten/0002-gmp-mparam.h.patch b/recipes/gmp/all/patches/emscripten/0002-gmp-mparam.h.patch new file mode 100644 index 0000000000000..a73a98ce168ce --- /dev/null +++ b/recipes/gmp/all/patches/emscripten/0002-gmp-mparam.h.patch @@ -0,0 +1,147 @@ +--- mpn/generic/gmp-mparam.h-orig 2023-08-22 16:57:58 ++++ mpn/generic/gmp-mparam.h 2023-08-22 16:58:43 +@@ -1,33 +1,122 @@ +-/* Generic C gmp-mparam.h -- Compiler/machine parameter header file. ++/* Generated by tuneup.c, 2022-04-30, gcc 4.2 */ + +-Copyright 1991, 1993, 1994, 2000 Free Software Foundation, Inc. ++#define DIVREM_1_NORM_THRESHOLD 0 /* always */ ++#define DIVREM_1_UNNORM_THRESHOLD 0 /* always */ ++#define MOD_1_1P_METHOD 2 /* 14.77% faster than 1 */ ++#define MOD_1_NORM_THRESHOLD 0 /* always */ ++#define MOD_1_UNNORM_THRESHOLD 0 /* always */ ++#define MOD_1N_TO_MOD_1_1_THRESHOLD 8 ++#define MOD_1U_TO_MOD_1_1_THRESHOLD 4 ++#define MOD_1_1_TO_MOD_1_2_THRESHOLD 22 ++#define MOD_1_2_TO_MOD_1_4_THRESHOLD 0 /* never mpn_mod_1s_2p */ ++#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 29 ++#define USE_PREINV_DIVREM_1 1 ++#define DIV_QR_1N_PI1_METHOD 1 /* 33.79% faster than 2 */ ++#define DIV_QR_1_NORM_THRESHOLD 3 ++#define DIV_QR_1_UNNORM_THRESHOLD 1 ++#define DIV_QR_2_PI2_THRESHOLD 13 ++#define DIVEXACT_1_THRESHOLD 0 /* always */ ++#define BMOD_1_TO_MOD_1_THRESHOLD MP_SIZE_T_MAX /* never */ + +-This file is part of the GNU MP Library. ++#define DIV_1_VS_MUL_1_PERCENT 116 + +-The GNU MP Library is free software; you can redistribute it and/or modify +-it under the terms of either: ++#define MUL_TOOM22_THRESHOLD 12 ++#define MUL_TOOM33_THRESHOLD 77 ++#define MUL_TOOM44_THRESHOLD 118 ++#define MUL_TOOM6H_THRESHOLD 156 ++#define MUL_TOOM8H_THRESHOLD 212 + +- * the GNU Lesser General Public License as published by the Free +- Software Foundation; either version 3 of the License, or (at your +- option) any later version. ++#define MUL_TOOM32_TO_TOOM43_THRESHOLD 73 ++#define MUL_TOOM32_TO_TOOM53_THRESHOLD 91 ++#define MUL_TOOM42_TO_TOOM53_THRESHOLD 73 ++#define MUL_TOOM42_TO_TOOM63_THRESHOLD 78 ++#define MUL_TOOM43_TO_TOOM54_THRESHOLD 88 + +-or ++#define SQR_BASECASE_THRESHOLD 4 ++#define SQR_TOOM2_THRESHOLD 26 ++#define SQR_TOOM3_THRESHOLD 85 ++#define SQR_TOOM4_THRESHOLD 142 ++#define SQR_TOOM6_THRESHOLD 180 ++#define SQR_TOOM8_THRESHOLD 260 + +- * the GNU General Public License as published by the Free Software +- Foundation; either version 2 of the License, or (at your option) any +- later version. ++#define MULMID_TOOM42_THRESHOLD 18 + +-or both in parallel, as here. ++#define MULMOD_BNM1_THRESHOLD 9 ++#define SQRMOD_BNM1_THRESHOLD 11 + +-The GNU MP Library is distributed in the hope that it will be useful, but +-WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +-or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +-for more details. ++#define MUL_FFT_MODF_THRESHOLD 244 /* k = 5 */ ++#define MUL_FFT_TABLE3 \ ++ { { 244, 5}, { 11, 6}, { 6, 5}, { 13, 6}, \ ++ { 7, 5}, { 15, 6}, { 15, 7}, { 8, 6}, \ ++ { 17, 7}, { 9, 6}, { 19, 7}, { 13, 8}, \ ++ { 7, 7}, { 17, 8}, { 9, 7}, { 20, 8}, \ ++ { 11, 7}, { 23, 8}, { 13, 9}, { 7, 8}, \ ++ { 19, 9}, { 11, 8}, { 25,10}, { 7, 9}, \ ++ { 15, 8}, { 33, 9}, { 19, 8}, { 39, 9}, \ ++ { 23,10}, { 15, 9}, { 39,10}, { 23,11}, \ ++ { 15,10}, { 31, 9}, { 67,10}, { 39, 9}, \ ++ { 79,10}, { 47,11}, { 2048,12}, { 4096,13}, \ ++ { 8192,14}, { 16384,15}, { 32768,16} } ++#define MUL_FFT_TABLE3_SIZE 43 ++#define MUL_FFT_THRESHOLD 2240 + +-You should have received copies of the GNU General Public License and the +-GNU Lesser General Public License along with the GNU MP Library. If not, +-see https://www.gnu.org/licenses/. */ ++#define SQR_FFT_MODF_THRESHOLD 208 /* k = 5 */ ++#define SQR_FFT_TABLE3 \ ++ { { 208, 5}, { 11, 6}, { 6, 5}, { 13, 6}, \ ++ { 15, 7}, { 8, 6}, { 17, 7}, { 13, 8}, \ ++ { 7, 7}, { 17, 8}, { 9, 7}, { 20, 8}, \ ++ { 13, 9}, { 7, 8}, { 19, 9}, { 11, 8}, \ ++ { 25,10}, { 7, 9}, { 15, 8}, { 33, 9}, \ ++ { 19, 8}, { 39, 9}, { 27,10}, { 15, 9}, \ ++ { 39,10}, { 23,11}, { 15,10}, { 31, 9}, \ ++ { 63,10}, { 39, 8}, { 159, 7}, { 319, 9}, \ ++ { 83,10}, { 47,11}, { 2048,12}, { 4096,13}, \ ++ { 8192,14}, { 16384,15}, { 32768,16} } ++#define SQR_FFT_TABLE3_SIZE 39 ++#define SQR_FFT_THRESHOLD 1984 + ++#define MULLO_BASECASE_THRESHOLD 0 /* always */ ++#define MULLO_DC_THRESHOLD 43 ++#define MULLO_MUL_N_THRESHOLD 4392 ++#define SQRLO_BASECASE_THRESHOLD 0 /* always */ ++#define SQRLO_DC_THRESHOLD 90 ++#define SQRLO_SQR_THRESHOLD 590 + +-/* Values for GMP_LIMB_BITS etc will be determined by ./configure and put +- in config.h. */ ++#define DC_DIV_QR_THRESHOLD 35 ++#define DC_DIVAPPR_Q_THRESHOLD 151 ++#define DC_BDIV_QR_THRESHOLD 40 ++#define DC_BDIV_Q_THRESHOLD 86 ++ ++#define INV_MULMOD_BNM1_THRESHOLD 22 ++#define INV_NEWTON_THRESHOLD 228 ++#define INV_APPR_THRESHOLD 165 ++ ++#define BINV_NEWTON_THRESHOLD 236 ++#define REDC_1_TO_REDC_N_THRESHOLD 46 ++ ++#define MU_DIV_QR_THRESHOLD 979 ++#define MU_DIVAPPR_Q_THRESHOLD 1078 ++#define MUPI_DIV_QR_THRESHOLD 98 ++#define MU_BDIV_QR_THRESHOLD 807 ++#define MU_BDIV_Q_THRESHOLD 979 ++ ++#define POWM_SEC_TABLE 7,34,135,579,1378 ++ ++#define GET_STR_DC_THRESHOLD 19 ++#define GET_STR_PRECOMPUTE_THRESHOLD 27 ++#define SET_STR_DC_THRESHOLD 228 ++#define SET_STR_PRECOMPUTE_THRESHOLD 1356 ++ ++#define FAC_DSC_THRESHOLD 270 ++#define FAC_ODD_THRESHOLD 0 /* always */ ++ ++#define MATRIX22_STRASSEN_THRESHOLD 15 ++#define HGCD2_DIV1_METHOD 3 /* 5.64% faster than 1 */ ++#define HGCD_THRESHOLD 84 ++#define HGCD_APPR_THRESHOLD 101 ++#define HGCD_REDUCE_THRESHOLD 1437 ++#define GCD_DC_THRESHOLD 327 ++#define GCDEXT_DC_THRESHOLD 253 ++#define JACOBI_BASE_METHOD 4 /* 2.47% faster than 3 */ ++ ++/* Tuneup completed successfully, took 74 seconds */ diff --git a/recipes/gmp/all/test_package/CMakeLists.txt b/recipes/gmp/all/test_package/CMakeLists.txt index 9f96d523192a5..264e5af18d86e 100644 --- a/recipes/gmp/all/test_package/CMakeLists.txt +++ b/recipes/gmp/all/test_package/CMakeLists.txt @@ -1,18 +1,13 @@ -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() +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) -if (TEST_PIC) - add_library(${PROJECT_NAME}_shared SHARED test_package.c) - target_link_libraries(${PROJECT_NAME}_shared ${CONAN_LIBS}) -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) endif() diff --git a/recipes/gmp/all/test_package/conanfile.py b/recipes/gmp/all/test_package/conanfile.py index 605e1da44137b..9f0e5d3db8fa5 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 +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" + 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.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 can_run(self): + bin_path = self.cpp.build.bindirs[0] + self.run(os.path.join(bin_path, "test_package"), env="conanrun") + if self.dependencies['gmp'].options.enable_cxx: + self.run(os.path.join(bin_path, "test_package_cpp"), env="conanrun") diff --git a/recipes/gmp/all/test_package/test_package.c b/recipes/gmp/all/test_package/test_package.c index 855fb40978336..14783504f48a1 100644 --- a/recipes/gmp/all/test_package/test_package.c +++ b/recipes/gmp/all/test_package/test_package.c @@ -1,25 +1,9 @@ #include -#include -#include - int main (void) { - mpz_t a,b,c; - mpz_init_set_str(a, "1234", 10); - mpz_init_set_str(b, "4321", 10); - mpz_init(c); - - mpz_add(c, a, b); - - char *a_str = mpz_get_str(NULL, 10, a); - char *b_str = mpz_get_str(NULL, 10, b); - char *c_str = mpz_get_str(NULL, 10, c); - - printf("%s + %s = %s\n", a_str, b_str, c_str); - - free(a_str); - free(b_str); - free(c_str); + mpz_t a; + mpz_init(a); + mpz_clear(a); - return EXIT_SUCCESS; + return 0; } diff --git a/recipes/gmp/config.yml b/recipes/gmp/config.yml index 7beafba5ffe63..4be5637d7da8f 100644 --- a/recipes/gmp/config.yml +++ b/recipes/gmp/config.yml @@ -1,4 +1,6 @@ versions: + "6.3.0": + folder: all "6.2.1": folder: all "6.2.0": diff --git a/recipes/gn/all/conandata.yml b/recipes/gn/all/conandata.yml index 171741d9a625a..7bda923d38021 100644 --- a/recipes/gn/all/conandata.yml +++ b/recipes/gn/all/conandata.yml @@ -1,3 +1,5 @@ sources: + "cci.20240611": + url: "https://gn.googlesource.com/gn/+archive/b2afae122eeb6ce09c52d63f67dc53fc517dbdc8.tar.gz" "cci.20210429": url: "https://gn.googlesource.com/gn/+archive/6771ce569fb4803dad7a427aa2e2c23e960b917e.tar.gz" diff --git a/recipes/gn/all/conanfile.py b/recipes/gn/all/conanfile.py index 14fc7169fc53f..4d70a7b853851 100644 --- a/recipes/gn/all/conanfile.py +++ b/recipes/gn/all/conanfile.py @@ -1,128 +1,163 @@ -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration -from contextlib import contextmanager -import conan.tools.files as tools_files -import conan.tools.scm as tools_scm import os +import shutil import sys import textwrap import time -required_conan_version = ">=1.46.0" +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os, XCRun +from conan.tools.build import check_min_cppstd +from conan.tools.env import VirtualBuildEnv, Environment +from conan.tools.files import chdir, copy, get, load, save, replace_in_file +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, VCVars +from conan.tools.scm import Version + +required_conan_version = ">=1.47.0" class GnConan(ConanFile): name = "gn" description = "GN is a meta-build system that generates build files for Ninja." - url = "https://github.com/conan-io/conan-center-index" - topics = ("gn", "build", "system", "ninja") license = "BSD-3-Clause" + url = "https://github.com/conan-io/conan-center-index" homepage = "https://gn.googlesource.com/" + topics = ("build system", "ninja") + + package_type = "application" settings = "os", "arch", "compiler", "build_type" + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + del self.info.settings.compiler + @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + if self.version == "cci.20210429": + return 17 + else: + return 20 @property - def _minimum_compiler_version_supporting_cxx17(self): - return { - "Visual Studio": 15, - "gcc": 7, - "clang": 4, - "apple-clang": 10, - }.get(str(self.settings.compiler)) - - def validate(self): - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 17) + def _minimum_compiler_version(self): + if self._min_cppstd == 17: + return { + "Visual Studio": 15, + "msvc": 191, + "gcc": 7, + "clang": 4, + "apple-clang": 10, + }.get(str(self.settings.compiler)) else: - if self._minimum_compiler_version_supporting_cxx17: - if tools_scm.Version(self.settings.compiler.version) < self._minimum_compiler_version_supporting_cxx17: - raise ConanInvalidConfiguration("gn requires a compiler supporting c++17") - else: - self.output.warn("gn recipe does not recognize the compiler. gn requires a compiler supporting c++17. Assuming it does.") + return { + "gcc": "11", + "clang": "12", + "apple-clang": "15", + "msvc": "192", + "Visual Studio": "16", + } - def package_id(self): - del self.info.settings.compiler + def validate_build(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + if self._minimum_compiler_version and Version(self.settings.compiler.version) < self._minimum_compiler_version: + raise ConanInvalidConfiguration(f"gn requires a compiler supporting C++{self._min_cppstd}") - def source(self): - tools_files.get(self, **self.conan_data["sources"][self.version], destination=self._source_subfolder) def build_requirements(self): # FIXME: add cpython build requirements for `build/gen.py`. - self.build_requires("ninja/1.10.2") + self.tool_requires("ninja/1.11.1") - @contextmanager - def _build_context(self): - if self.settings.compiler == "Visual Studio": - with tools.vcvars(self.settings): - yield - else: - compiler_defaults = {} - if self.settings.compiler == "gcc": - compiler_defaults = { - "CC": "gcc", - "CXX": "g++", - "AR": "ar", - "LD": "g++", - } - elif self.settings.compiler == "clang": - compiler_defaults = { - "CC": "clang", - "CXX": "clang++", - "AR": "ar", - "LD": "clang++", - } - env = {} - for k in ("CC", "CXX", "AR", "LD"): - v = tools.get_env(k, compiler_defaults.get(k, None)) - if v: - env[k] = v - with tools.environment_append(env): - yield - - @staticmethod - def _to_gn_platform(os_, compiler): - if tools.is_apple_os(os_): + def source(self): + get(self, **self.conan_data["sources"][self.version]) + + @property + def _gn_platform(self): + if is_apple_os(self): return "darwin" - if compiler == "Visual Studio": + if is_msvc(self): return "msvc" # Assume gn knows about the os - return str(os_).lower() + return str(self.settings.os).lower() + + @property + def _cxx(self): + 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 self.settings.compiler == "apple-clang": + return XCRun(self).cxx + compiler_version = self.settings.compiler.version + major = Version(compiler_version).major + if self.settings.compiler == "gcc": + return shutil.which(f"g++-{compiler_version}") or shutil.which(f"g++-{major}") or shutil.which("g++") or "" + if self.settings.compiler == "clang": + return shutil.which(f"clang++-{compiler_version}") or shutil.which(f"clang++-{major}") or shutil.which("clang++") or "" + return "" + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + + # Make sure CXX env var is set, otherwise gn defaults it to clang++ + # https://gn.googlesource.com/gn/+/refs/heads/main/build/gen.py#386 + env = Environment() + env.define("CXX", self._cxx) + env.vars(self).save_script("conanbuild_gn") + + if is_msvc(self): + vcvars = VCVars(self) + vcvars.generate() + + configure_args = [ + "--no-last-commit-position", + f"--host={self._gn_platform}", + ] + if self.settings.build_type in ["Debug", "RelWithDebInfo"]: + configure_args.append("-d") + save(self, os.path.join(self.source_folder, "configure_args"), " ".join(configure_args)) def build(self): - with tools.chdir(self._source_subfolder): - with self._build_context(): - # Generate dummy header to be able to run `build/ben.py` with `--no-last-commit-position`. This allows running the script without the tree having to be a git checkout. - tools.save(os.path.join("src", "gn", "last_commit_position.h"), - textwrap.dedent("""\ - #pragma once - #define LAST_COMMIT_POSITION "1" - #define LAST_COMMIT_POSITION_NUM 1 - """)) - conf_args = [ - "--no-last-commit-position", - "--host={}".format(self._to_gn_platform(self.settings.os, self.settings.compiler)), - ] - if self.settings.build_type == "Debug": - conf_args.append("-d") - self.run("{} build/gen.py {}".format(sys.executable, " ".join(conf_args)), run_environment=True) - # Try sleeping one second to avoid time skew of the generated ninja.build file (and having to re-run build/gen.py) - time.sleep(1) - build_args = [ - "-C", "out", - "-j{}".format(tools.cpu_count()), - ] - self.run("ninja {}".format(" ".join(build_args)), run_environment=True) + with chdir(self, self.source_folder): + # Generate dummy header to be able to run `build/gen.py` with `--no-last-commit-position`. + # This allows running the script without the tree having to be a git checkout. + save(self, os.path.join(self.source_folder, "src", "gn", "last_commit_position.h"), + textwrap.dedent("""\ + #pragma once + #define LAST_COMMIT_POSITION "1" + #define LAST_COMMIT_POSITION_NUM 1 + """), + ) + + # Disable GenerateLastCommitPosition() + replace_in_file(self, os.path.join(self.source_folder, "build/gen.py"), + "def GenerateLastCommitPosition(host, header):", + "def GenerateLastCommitPosition(host, header):\n return") + + self.run(f"{sys.executable} build/gen.py " + load(self, "configure_args")) + self.run(f"ninja -C out -j{os.cpu_count()} -v") def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - self.copy("gn", src=os.path.join(self._source_subfolder, "out"), dst="bin") - self.copy("gn.exe", src=os.path.join(self._source_subfolder, "out"), dst="bin") + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + if self.settings.os == "Windows": + copy(self, "gn.exe", + src=os.path.join(self.source_folder, "out"), + dst=os.path.join(self.package_folder, "bin")) + else: + copy(self, "gn", + src=os.path.join(self.source_folder, "out"), + dst=os.path.join(self.package_folder, "bin")) def package_info(self): + self.cpp_info.includedirs = [] + self.cpp_info.frameworkdirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] + 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 = [] diff --git a/recipes/gn/all/test_package/conanfile.py b/recipes/gn/all/test_package/conanfile.py index 6afe525facbbe..4a3175e52589e 100644 --- a/recipes/gn/all/test_package/conanfile.py +++ b/recipes/gn/all/test_package/conanfile.py @@ -1,46 +1,28 @@ -from conans import ConanFile, CMake, tools -from contextlib import contextmanager import os +from conan import ConanFile +from conan.tools.apple import is_apple_os +from conan.tools.build import can_run, cross_building +from conan.tools.env import VirtualRunEnv, VirtualBuildEnv +from conan.tools.layout import basic_layout +from conan.tools.microsoft import unix_path + class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" + settings = "os", "arch", "compiler", "build_type" + generators = "VCVars" + test_type = "explicit" def build_requirements(self): - self.build_requires("ninja/1.10.2") + self.tool_requires(self.tested_reference_str) + self.tool_requires("ninja/1.11.1") - @contextmanager - def _build_context(self): - if self.settings.compiler == "Visual Studio": - with tools.vcvars(self.settings): - yield - else: - compiler_defaults = {} - if self.settings.compiler == "gcc": - compiler_defaults = { - "CC": "gcc", - "CXX": "g++", - "AR": "ar", - "LD": "g++", - } - elif self.settings.compiler in ("apple-clang", "clang"): - compiler_defaults = { - "CC": "clang", - "CXX": "clang++", - "AR": "ar", - "LD": "clang++", - } - env = {} - for k in ("CC", "CXX", "AR", "LD"): - v = tools.get_env(k, compiler_defaults.get(k, None)) - if v: - env[k] = v - with tools.environment_append(env): - yield + def layout(self): + basic_layout(self) @property def _target_os(self): - if tools.is_apple_os(self.settings.os): + if is_apple_os(self): return "mac" # Assume gn knows about the os return { @@ -53,17 +35,22 @@ def _target_cpu(self): "x86_64": "x64", }.get(str(self.settings.arch), str(self.settings.arch)) + def generate(self): + VirtualBuildEnv(self).generate() + VirtualRunEnv(self).generate(scope="run") + VirtualRunEnv(self).generate(scope="build") + def build(self): - if not tools.cross_building(self.settings): - with tools.chdir(self.source_folder): - gn_args = [ - os.path.relpath(os.path.join(self.build_folder, "bin"), os.getcwd()).replace("\\", "/"), - "--args=\"target_os=\\\"{os_}\\\" target_cpu=\\\"{cpu}\\\"\"".format(os_=self._target_os, cpu=self._target_cpu), - ] - self.run("gn gen {}".format(" ".join(gn_args)), run_environment=True) - with self._build_context(): - self.run("ninja -v -j{} -C bin".format(tools.cpu_count()), run_environment=True) + if not cross_building(self): + rel_bindir = unix_path(self, os.path.relpath(os.path.join(self.cpp.build.bindir), os.getcwd())) + gn_args = [ + rel_bindir, + f'--args="target_os=\\"{self._target_os}\\" target_cpu=\\"{self._target_cpu}\\""', + ] + self.run("gn gen " + " ".join(gn_args)) + self.run(f"ninja -v -j{os.cpu_count()} -C {rel_bindir}") 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/gn/all/test_package/test_package.cpp b/recipes/gn/all/test_package/test_package.cpp index 576931dcb63ac..7a70c493ae50a 100644 --- a/recipes/gn/all/test_package/test_package.cpp +++ b/recipes/gn/all/test_package/test_package.cpp @@ -3,7 +3,7 @@ #include -int main(int argc, char* argv[]) { +int main() { std::cout << get_test_shared_text() << "\n"; std::cout << get_test_static_text() << "\n"; return 0; diff --git a/recipes/gn/config.yml b/recipes/gn/config.yml index 7831e6ed51225..864345cea83ba 100644 --- a/recipes/gn/config.yml +++ b/recipes/gn/config.yml @@ -1,3 +1,5 @@ versions: + "cci.20240611": + folder: all "cci.20210429": folder: all diff --git a/recipes/gnu-config/all/conandata.yml b/recipes/gnu-config/all/conandata.yml index c687fcf43a384..c49d54ae16b78 100644 --- a/recipes/gnu-config/all/conandata.yml +++ b/recipes/gnu-config/all/conandata.yml @@ -5,3 +5,8 @@ sources: "cci.20201022": url: "http://git.savannah.gnu.org/cgit/config.git/snapshot/config-1c4398015583eb77bc043234f5734be055e64bea.tar.gz" sha256: "339eb64757bf5af9e23ca15daa136acdd9d778753377190ce17fba7e1b222aff" +patches: + "cci.20210814": + - patch_file: "patches/cci.20210814-0001-tvos-support.patch" + patch_description: "add support to tvOS" + patch_type: "portability" diff --git a/recipes/gnu-config/all/conanfile.py b/recipes/gnu-config/all/conanfile.py index 58814fbffa9e0..ad0c56aabe7bd 100644 --- a/recipes/gnu-config/all/conanfile.py +++ b/recipes/gnu-config/all/conanfile.py @@ -1,6 +1,6 @@ from conan import ConanFile from conan.errors import ConanException -from conan.tools.files import copy, get, load, save +from conan.tools.files import copy, get, load, save, apply_conandata_patches, export_conandata_patches from conan.tools.layout import basic_layout import os @@ -14,8 +14,11 @@ 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" + package_type = "build-scripts" os = "arch", "compiler", "build_type", "arch" - no_copy_source = True + + def export_sources(self): + export_conandata_patches(self) def layout(self): basic_layout(self, src_folder="src") @@ -24,11 +27,10 @@ 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 + apply_conandata_patches(self) def _extract_license(self): txt_lines = load(self, os.path.join(self.source_folder, "config.guess")).splitlines() diff --git a/recipes/gnu-config/all/patches/cci.20210814-0001-tvos-support.patch b/recipes/gnu-config/all/patches/cci.20210814-0001-tvos-support.patch new file mode 100644 index 0000000000000..64667f1b35284 --- /dev/null +++ b/recipes/gnu-config/all/patches/cci.20210814-0001-tvos-support.patch @@ -0,0 +1,11 @@ +--- config.sub ++++ config.sub +@@ -1723,7 +1723,7 @@ + | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \ + | sym* | plan9* | psp* | sim* | xray* | os68k* | v88r* \ + | hiux* | abug | nacl* | netware* | windows* \ +- | os9* | macos* | osx* | ios* \ ++ | os9* | macos* | osx* | ios* | tvos* | watchos* \ + | mpw* | magic* | mmixware* | mon960* | lnews* \ + | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \ + | aos* | aros* | cloudabi* | sortix* | twizzler* \ diff --git a/recipes/gnu-config/all/test_package/conanfile.py b/recipes/gnu-config/all/test_package/conanfile.py index d50d33bfc8962..93cb4f77f7eab 100644 --- a/recipes/gnu-config/all/test_package/conanfile.py +++ b/recipes/gnu-config/all/test_package/conanfile.py @@ -1,6 +1,4 @@ from conan import ConanFile -from conan.errors import ConanException -from conans import tools as tools_legacy class TestPackageConan(ConanFile): @@ -20,8 +18,4 @@ def build_requirements(self): def test(self): self.run("config.guess") - try: - triplet = tools_legacy.get_gnu_triplet(str(self.settings.os), str(self.settings.arch), str(self.settings.compiler)) - self.run(f"config.sub {triplet}") - except ConanException: - self.output.info("Current configuration is not supported by GNU config.\nIgnoring...") + self.run("config.sub --version") diff --git a/recipes/gnulib/all/conandata.yml b/recipes/gnulib/all/conandata.yml index 5a178c6fd8562..f0a11d9e7bc47 100644 --- a/recipes/gnulib/all/conandata.yml +++ b/recipes/gnulib/all/conandata.yml @@ -1,4 +1,7 @@ sources: - "20200224": - url: "http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=snapshot;h=d279bc6d9f9323e19ad8c32b6d12ff96dfb0f5ba;sf=tgz" - sha256: "171142863dd860b3a5babc0f6172048313cf9d98d00a289be9c154bf015ac68d" + "20231231": + url: "http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=snapshot;h=4f6545e79c4a7cd7feb2c8f23f1d5167e7165907;sf=tgz" + sha256: "8b95e1ac4dc3a925dd282031445f544f332cdb0b0df2f0b97f5675b7ec42acff" + "20230218": + url: "http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=snapshot;h=bb3fd10;sf=tgz" + sha256: "e94cb8a4f85439e3b6509f22bd8a132bbf0cc0f22996c67cdc0c7329142b6498" diff --git a/recipes/gnulib/all/conanfile.py b/recipes/gnulib/all/conanfile.py index 8f85099afedec..ad906d69a08cb 100644 --- a/recipes/gnulib/all/conanfile.py +++ b/recipes/gnulib/all/conanfile.py @@ -1,51 +1,49 @@ -from conans import ConanFile, tools import os -import shutil -required_conan_version = ">=1.33.0" +from conan import ConanFile +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout + +required_conan_version = ">=1.52.0" class GnuLibConanFile(ConanFile): name = "gnulib" description = "Gnulib is a central location for common GNU code, intended to be shared among GNU packages." - homepage = "https://www.gnu.org/software/gnulib/" + license = ("GPL-3.0-or-later", "LGPL-3.0-or-later", "Public-domain") url = "https://github.com/conan-io/conan-center-index" - topics = ("gnulib", "library", "gnu") - license = ("GPL-3.0-or-later", "LGPL-3.0-or-later", "Unlicense") + homepage = "https://www.gnu.org/software/gnulib/" + topics = ("library", "gnu") + package_type = "build-scripts" + 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.header_only() + self.info.clear() def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True, filename="gnulib.tar.gz") + get(self, **self.conan_data["sources"][self.version], strip_root=True, filename="gnulib.tar.gz") def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") - - # The following line did not work, so do it the long way... - # shutil.copy(os.path.join(self.source_folder, self._source_subfolder), os.path.join(self.package_folder, "bin")) - - gnulib_dir = os.path.join(self.source_folder, self._source_subfolder) - for root, _, files in os.walk(gnulib_dir): - relpath = os.path.relpath(root, gnulib_dir) - dstdir = os.path.join(self.package_folder, "bin", relpath) - try: - os.makedirs(dstdir) - except FileExistsError: - pass - for file in files: - src = os.path.join(root, file) - dst = os.path.join(dstdir, file) - shutil.copy(src, dst) + copy(self, "COPYING", + src=self.source_folder, + dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*", + dst=os.path.join(self.package_folder, "bin"), + src=self.source_folder) def package_info(self): + self.cpp_info.includedirs = [] self.cpp_info.libdirs = [] + # Set GNULIB_SRCDIR for the standard ./bootstrap script from build-aux + # https://github.com/digitalocean/gnulib/blob/master/build-aux/bootstrap#L58-L62 + self.buildenv_info.define_path("GNULIB_SRCDIR", os.path.join(self.package_folder, "bin")) + + # TODO: Legacy, to be removed on Conan 2.0 binpath = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment var: {}".format(binpath)) self.env_info.PATH.append(binpath) diff --git a/recipes/gnulib/all/test_package/conanfile.py b/recipes/gnulib/all/test_package/conanfile.py index 39d8fd2e49aac..09e7f8d503e60 100644 --- a/recipes/gnulib/all/test_package/conanfile.py +++ b/recipes/gnulib/all/test_package/conanfile.py @@ -1,60 +1,68 @@ -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.cmake import cmake_layout +from conan.tools.env import Environment, VirtualBuildEnv +from conan.tools.files import copy, save, chdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.microsoft import is_msvc, unix_path class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - exports_sources = "configure.ac", "Makefile.am", "test_package.c" + settings = "os", "arch", "compiler", "build_type" + test_type = "explicit" + win_bash = True # Needed in Conan v1 to avoid "Cannot wrap command with different envs." @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.build_requires("automake/1.16.4") - - @contextlib.contextmanager - def _build_context(self): - if self.settings.compiler == "Visual Studio": - with tools.vcvars(self): - env = { - "AR": "{} lib".format(tools.unix_path(os.path.join(self.build_folder, "build-aux", "ar-lib"))), - "CC": "cl -nologo", - "CXX": "cl -nologo", - "LD": "link -nologo", - "NM": "dumpbin -symbols", - "OBJDUMP": ":", - "RANLIB": ":", - "STRIP": ":", - } - with tools.environment_append(env): - yield - else: - yield + self.tool_requires(self.tested_reference_str) + 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") + self.tool_requires("libtool/2.4.7") + + def layout(self): + cmake_layout(self) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + tc = AutotoolsToolchain(self) + tc.generate() + + if is_msvc(self): + env = Environment() + automake_conf = self.dependencies.build["automake"].conf_info + compile_wrapper = unix_path(self, automake_conf.get("user.automake:compile-wrapper", check_type=str)) + env.define("CC", f"{compile_wrapper} cl -nologo") + env.define("LD", "link -nologo") + # ar-lib wrapper is added automatically by ./configure, no need to set AR + 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), dst=os.path.join(self.build_folder, src)) - with tools.chdir(self.build_folder): - for fn in ("COPYING", "NEWS", "INSTALL", "README", "AUTHORS", "ChangeLog"): - tools.save(fn, "\n") - with tools.run_environment(self): - self.run("gnulib-tool --list", win_bash=tools.os_info.is_windows, run_environment=True) - self.run("gnulib-tool --import getopt-posix", win_bash=tools.os_info.is_windows, run_environment=True) - # m4 built with Visual Studio does not support executing *nix utils (e.g. `test`) - with tools.environment_append({"M4":None}) if self.settings.os == "Windows" else tools.no_op(): - self.run("{} -fiv".format(os.environ["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.configure() - autotools.make() + for src in ["configure.ac", "Makefile.am", "test_package.c"]: + copy(self, src, src=self.source_folder, dst=self.build_folder) + for fn in ("COPYING", "NEWS", "INSTALL", "README", "AUTHORS", "ChangeLog"): + save(self, os.path.join(self.build_folder, fn), "\n") + self.run("gnulib-tool --list") + self.run("gnulib-tool --import getopt-posix", env="conanbuild") + with chdir(self, self.build_folder): + autotools = Autotools(self) + if self._settings_build.os == "Windows": + # Disable m4 from Conan, which is not able to run shell commands with syscmd() + os.environ["M4"] = "" + # autotools.autoreconf() does not have build_script_folder param in Conan v1, so using .run() + self.run("autoreconf -fiv") + autotools.configure(self.build_folder) + autotools.make() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join(".", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = unix_path(self, os.path.join(self.build_folder, "test_package")) + self.run(bin_path, env="conanrun") diff --git a/recipes/gnulib/all/test_v1_package/conanfile.py b/recipes/gnulib/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..33375b9245e7b --- /dev/null +++ b/recipes/gnulib/all/test_v1_package/conanfile.py @@ -0,0 +1,61 @@ +from conans import ConanFile, tools, AutoToolsBuildEnvironment +import contextlib +import os +import shutil + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + exports_sources = "configure.ac", "Makefile.am", "test_package.c" + + @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.build_requires("automake/1.16.4") + + @contextlib.contextmanager + def _build_context(self): + if self.settings.compiler == "Visual Studio": + with tools.vcvars(self): + env = { + "AR": "{} lib".format(tools.unix_path(os.path.join(self.build_folder, "build-aux", "ar-lib"))), + "CC": "cl -nologo", + "CXX": "cl -nologo", + "LD": "link -nologo", + "NM": "dumpbin -symbols", + "OBJDUMP": ":", + "RANLIB": ":", + "STRIP": ":", + } + with tools.environment_append(env): + yield + else: + yield + + def build(self): + source_folder = os.path.join(self.source_folder, "..", "test_package") + for src in self.exports_sources: + shutil.copy(os.path.join(source_folder, src), dst=os.path.join(self.build_folder, src)) + with tools.chdir(self.build_folder): + for fn in ("COPYING", "NEWS", "INSTALL", "README", "AUTHORS", "ChangeLog"): + tools.save(fn, "\n") + with tools.run_environment(self): + self.run("gnulib-tool --list", win_bash=tools.os_info.is_windows, run_environment=True) + self.run("gnulib-tool --import getopt-posix", win_bash=tools.os_info.is_windows, run_environment=True) + # m4 built with Visual Studio does not support executing *nix utils (e.g. `test`) + with tools.environment_append({"M4":None}) if self.settings.os == "Windows" else tools.no_op(): + self.run("{} -fiv".format(os.environ["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.configure() + autotools.make() + + 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/gnulib/config.yml b/recipes/gnulib/config.yml index 3f6aba5ec0fcc..ee83643c5044f 100644 --- a/recipes/gnulib/config.yml +++ b/recipes/gnulib/config.yml @@ -1,3 +1,5 @@ versions: - "20200224": + "20231231": + folder: all + "20230218": folder: all diff --git a/recipes/gnutls/all/conandata.yml b/recipes/gnutls/all/conandata.yml new file mode 100644 index 0000000000000..92c4817c69f19 --- /dev/null +++ b/recipes/gnutls/all/conandata.yml @@ -0,0 +1,34 @@ +sources: + "3.8.7": + url: + - "https://www.gnupg.org/ftp/gcrypt/gnutls/v3.8/gnutls-3.8.7.tar.xz" + - "http://www.ring.gr.jp/pub/net/gnupg/gnutls/v3.8/gnutls-3.8.7.tar.xz" + - "https://www.mirrorservice.org/sites/ftp.gnupg.org/gcrypt/gnutls/v3.8/gnutls-3.8.7.tar.xz" + sha256: "fe302f2b6ad5a564bcb3678eb61616413ed5277aaf8e7bf7cdb9a95a18d9f477" + "3.8.2": + url: + - "https://www.gnupg.org/ftp/gcrypt/gnutls/v3.8/gnutls-3.8.2.tar.xz" + - "http://www.ring.gr.jp/pub/net/gnupg/gnutls/v3.8/gnutls-3.8.2.tar.xz" + - "https://www.mirrorservice.org/sites/ftp.gnupg.org/gcrypt/gnutls/v3.8/gnutls-3.8.2.tar.xz" + sha256: "e765e5016ffa9b9dd243e363a0460d577074444ee2491267db2e96c9c2adef77" + "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.8.2": + - patch_file: "patches/3.8.2-0001-ossstaues-argument-fix.patch" + patch_description: "specify osstatus_error takes in an OSStatus as its first argument" + patch_type: "backport" + patch_source: "https://gitlab.com/gnutls/gnutls/-/commit/925b7072ac1a242b0968f889585e61993f9ca449.patch" + "3.7.8": + - patch_file: "patches/3.7.8-0001-fix-isdigit.patch" + 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/3.7.8-0002-ossstaues-argument-fix.patch" + patch_description: "specify osstatus_error takes in an OSStatus as its first argument (reapplied from 3.8.2)" + patch_type: "backport" + patch_source: "https://gitlab.com/gnutls/gnutls/-/commit/925b7072ac1a242b0968f889585e61993f9ca449.patch" diff --git a/recipes/gnutls/all/conanfile.py b/recipes/gnutls/all/conanfile.py new file mode 100644 index 0000000000000..4f1bb9180932b --- /dev/null +++ b/recipes/gnutls/all/conanfile.py @@ -0,0 +1,205 @@ +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 apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir, save +from conan.tools.gnu import AutotoolsToolchain, AutotoolsDeps, PkgConfigDeps, Autotools +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc +import os +import textwrap + +required_conan_version = ">=1.54.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") + package_type = "library" + 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, + } + + @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") + 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.9.1") + self.requires("gmp/6.3.0") + self.requires("libiconv/1.17") + if self.options.with_zlib: + self.requires("zlib/[>=1.2.11 <2]") + if self.options.with_zstd: + self.requires("zstd/1.5.5") + if self.options.with_brotli: + self.requires("brotli/1.1.0") + + def validate(self): + if is_msvc(self): + raise ConanInvalidConfiguration(f"{self.ref} cannot be deployed by Visual Studio.") + + def build_requirements(self): + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/2.1.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): + 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.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)), + ]) + if is_apple_os(self): + # fix_apple_shared_install_name() may fail without -headerpad_max_install_names + # (see https://github.com/conan-io/conan-center-index/pull/15946#issuecomment-1464321305) + tc.extra_ldflags.append("-headerpad_max_install_names") + env = tc.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") + tc.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")) + fix_apple_shared_install_name(self) + 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(f"""\ + set(GNUTLS_FOUND TRUE) + if(NOT DEFINED GNUTLS_INCLUDE_DIR AND DEFINED GnuTLS_INCLUDE_DIRS) + set(GNUTLS_INCLUDE_DIR ${{GnuTLS_INCLUDE_DIRS}}) + endif() + if(NOT DEFINED GNUTLS_LIBRARIES AND DEFINED GnuTLS_LIBRARIES) + set(GNUTLS_LIBRARIES ${{GnuTLS_LIBRARIES}}) + endif() + if(NOT DEFINED GNUTLS_DEFINITIONS) + if(DEFINED GnuTLS_DEFINITIONS) + set(GNUTLS_DEFINITIONS ${{GnuTLS_DEFINITIONS}}) + else() + set(GNUTLS_DEFINITIONS "") + endif() + endif() + set(GNUTLS_VERSION {self.version}) + """) + 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.libs = ["gnutlsxx", "gnutls"] 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("cmake_build_modules", [self._module_file_rel_path]) + 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" + self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] + if self.options.enable_tools: + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/gnutls/all/patches/3.7.8-0001-fix-isdigit.patch b/recipes/gnutls/all/patches/3.7.8-0001-fix-isdigit.patch new file mode 100644 index 0000000000000..64c04ca78c4c2 --- /dev/null +++ b/recipes/gnutls/all/patches/3.7.8-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/patches/3.7.8-0002-ossstaues-argument-fix.patch b/recipes/gnutls/all/patches/3.7.8-0002-ossstaues-argument-fix.patch new file mode 100644 index 0000000000000..e91a76a05b55a --- /dev/null +++ b/recipes/gnutls/all/patches/3.7.8-0002-ossstaues-argument-fix.patch @@ -0,0 +1,13 @@ +diff --git a/lib/system/certs.c b/lib/system/certs.c +index 611c645..b1eb414 100644 +--- a/lib/system/certs.c ++++ b/lib/system/certs.c +@@ -278,7 +278,7 @@ int add_system_trust(gnutls_x509_trust_list_t list, unsigned int tl_flags, + } + #elif defined(__APPLE__) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 + static +-int osstatus_error(status) ++int osstatus_error(OSStatus status) + { + CFStringRef err_str = SecCopyErrorMessageString(status, NULL); + _gnutls_debug_log("Error loading system root certificates: %s\n", diff --git a/recipes/gnutls/all/patches/3.8.2-0001-ossstaues-argument-fix.patch b/recipes/gnutls/all/patches/3.8.2-0001-ossstaues-argument-fix.patch new file mode 100644 index 0000000000000..efe2c3114f52e --- /dev/null +++ b/recipes/gnutls/all/patches/3.8.2-0001-ossstaues-argument-fix.patch @@ -0,0 +1,26 @@ +From 925b7072ac1a242b0968f889585e61993f9ca449 Mon Sep 17 00:00:00 2001 +From: Mark Harfouche +Date: Mon, 27 Nov 2023 12:20:23 +0000 +Subject: [PATCH] specify osstatus_error takes in an OSStatus as its first + argument + +Signed-off-by: Mark Harfouche +--- + lib/system/certs.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/system/certs.c b/lib/system/certs.c +index 9619ed18c1..779d928609 100644 +--- a/lib/system/certs.c ++++ b/lib/system/certs.c +@@ -289,7 +289,7 @@ static int add_system_trust(gnutls_x509_trust_list_t list, + return r; + } + #elif defined(__APPLE__) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 +-static int osstatus_error(status) ++static int osstatus_error(OSStatus status) + { + CFStringRef err_str = SecCopyErrorMessageString(status, NULL); + _gnutls_debug_log("Error loading system root certificates: %s\n", +-- +GitLab diff --git a/recipes/gnutls/all/test_package/CMakeLists.txt b/recipes/gnutls/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..0529758951292 --- /dev/null +++ b/recipes/gnutls/all/test_package/CMakeLists.txt @@ -0,0 +1,23 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES C) + +find_package(GnuTLS REQUIRED) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE GnuTLS::GnuTLS) + +# Test whether variables from https://cmake.org/cmake/help/latest/module/FindGnuTLS.html are properly defined +set(_custom_vars + GNUTLS_FOUND + GNUTLS_INCLUDE_DIR + GNUTLS_LIBRARIES + GNUTLS_DEFINITIONS + GNUTLS_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() diff --git a/recipes/gnutls/all/test_package/conanfile.py b/recipes/gnutls/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fb96656f203 --- /dev/null +++ b/recipes/gnutls/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/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/plutovg/all/test_v1_package/CMakeLists.txt b/recipes/gnutls/all/test_v1_package/CMakeLists.txt similarity index 100% rename from recipes/plutovg/all/test_v1_package/CMakeLists.txt rename to recipes/gnutls/all/test_v1_package/CMakeLists.txt 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..e335244ee18cf --- /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", "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/gnutls/config.yml b/recipes/gnutls/config.yml new file mode 100644 index 0000000000000..70ce87bedbde5 --- /dev/null +++ b/recipes/gnutls/config.yml @@ -0,0 +1,7 @@ +versions: + "3.8.7": + folder: "all" + "3.8.2": + folder: "all" + "3.7.8": + folder: "all" diff --git a/recipes/gobject-introspection/all/conandata.yml b/recipes/gobject-introspection/all/conandata.yml index 47eccc41d1faf..4203b61eacd08 100644 --- a/recipes/gobject-introspection/all/conandata.yml +++ b/recipes/gobject-introspection/all/conandata.yml @@ -1,19 +1,7 @@ sources: + "1.78.1": + url: "https://download.gnome.org/sources/gobject-introspection/1.78/gobject-introspection-1.78.1.tar.xz" + sha256: "bd7babd99af7258e76819e45ba4a6bc399608fe762d83fde3cac033c50841bb4" "1.72.0": - sha256: "02fe8e590861d88f83060dd39cda5ccaa60b2da1d21d0f95499301b186beaabc" url: "https://download.gnome.org/sources/gobject-introspection/1.72/gobject-introspection-1.72.0.tar.xz" - "1.70.0": - url: "https://download.gnome.org/sources/gobject-introspection/1.70/gobject-introspection-1.70.0.tar.xz" - sha256: "902b4906e3102d17aa2fcb6dad1c19971c70f2a82a159ddc4a94df73a3cafc4a" - "1.69.0": - url: "https://download.gnome.org/sources/gobject-introspection/1.69/gobject-introspection-1.69.0.tar.xz" - sha256: "c668cbe4a3aad7539e2cf669ab576ce7fbadac6890472f4095ca215dbbebee99" - "1.68.0": - url: "https://download.gnome.org/sources/gobject-introspection/1.68/gobject-introspection-1.68.0.tar.xz" - sha256: "d229242481a201b84a0c66716de1752bca41db4133672cfcfb37c93eb6e54a27" - "1.67.1": - url: "https://download.gnome.org/sources/gobject-introspection/1.67/gobject-introspection-1.67.1.tar.xz" - sha256: "9635184d668794609f9fe661c5bde11c106385d26c3babe291c24e3655987e47" - "1.66.1": - url: "https://download.gnome.org/sources/gobject-introspection/1.66/gobject-introspection-1.66.1.tar.xz" - sha256: "dd44a55ee5f426ea22b6b89624708f9e8d53f5cc94e5485c15c87cb30e06161d" + sha256: "02fe8e590861d88f83060dd39cda5ccaa60b2da1d21d0f95499301b186beaabc" diff --git a/recipes/gobject-introspection/all/conanfile.py b/recipes/gobject-introspection/all/conanfile.py index 4e30ffbb5f86f..74c5c3b60e338 100644 --- a/recipes/gobject-introspection/all/conanfile.py +++ b/recipes/gobject-introspection/all/conanfile.py @@ -1,129 +1,188 @@ -from conans import ConanFile, tools, Meson, VisualStudioBuildEnvironment -from conans.errors import ConanInvalidConfiguration import os -import shutil -import glob -required_conan_version = ">=1.36.0" +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 PkgConfigDeps +from conan.tools.layout import basic_layout +from conan.tools.meson import MesonToolchain, Meson +from conan.tools.env import Environment +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.scm import Version +from conan import conan_version + +required_conan_version = ">=1.60.0 <2.0 || >=2.0.5" + class GobjectIntrospectionConan(ConanFile): name = "gobject-introspection" - description = "GObject introspection is a middleware layer between C libraries (using GObject) and language bindings" - topics = ("conan", "gobject-instrospection") + description = ("GObject introspection is a middleware layer between " + "C libraries (using GObject) and language bindings") + license = "LGPL-2.1-or-later" url = "https://github.com/conan-io/conan-center-index" homepage = "https://gitlab.gnome.org/GNOME/gobject-introspection" - license = "LGPL-2.1" - 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" - generators = "pkg_config" + topics = ("gobject-instrospection",) - @property - def _is_msvc(self): - return self.settings.compiler == "Visual Studio" - - def configure(self): - if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + package_type = "shared-library" + settings = "os", "arch", "compiler", "build_type" + options = { + "fPIC": [True, False], + "build_introspection_data": [True, False], + } + default_options = { + "fPIC": True, + "build_introspection_data": True, + } + short_paths = True def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - if self.settings.os == "Windows": - raise ConanInvalidConfiguration("%s recipe does not support windows. Contributions are welcome!" % self.name) + if self.settings.os in ["Windows", "Macos"] or cross_building(self): + # FIXME: tools/g-ir-scanner fails to load glib + self.options.build_introspection_data = False + + def configure(self): + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + if self.options.get_safe("build_introspection_data"): + # INFO: g-ir-scanner looks for dynamic glib and gobject libraries when running + self.options["glib"].shared = True + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + # https://gitlab.gnome.org/GNOME/gobject-introspection/-/blob/1.76.1/meson.build?ref_type=tags#L127-131 + self.requires("glib/2.78.3", transitive_headers=True, transitive_libs=True) + # ffi.h is exposed by public header gobject-introspection-1.0/girffi.h + self.requires("libffi/3.4.4", transitive_headers=True) + + def validate(self): + if self.settings.os == "Windows" and self.settings.build_type == "Debug": + # fatal error LNK1104: cannot open file 'python37_d.lib' + raise ConanInvalidConfiguration( + f"{self.ref} debug build on Windows is disabled due to debug version of Python libs likely not being available. Contributions to fix this are welcome.") + if self.options.build_introspection_data and not self.dependencies["glib"].options.shared: + # FIXME: tools/g-ir-scanner fails to load glib + # tools/g-ir-scanner --output=gir/GLib-2.0.gir ... + # ERROR: can't resolve libraries to shared libraries: glib-2.0, gobject-2.0 + raise ConanInvalidConfiguration(f"{self.ref} requires shared glib to be built as shared. Use -o 'glib/*:shared=True'.") + if self.options.build_introspection_data and self.settings.os in ["Windows", "Macos"]: + # FIXME: tools/g-ir-scanner', '--output=gir/GLib-2.0.gir' ... ERROR: can't resolve libraries to shared libraries: glib-2.0, gobject-2.0 + # FIXME: g-ir-scanner fails to find libgnuintl + # giscanner/_giscanner.cpython-37m-darwin.so, 0x0002): Library not loaded: /lib/libgnuintl.8.dylib + raise ConanInvalidConfiguration(f"{self.ref} fails to run g-ir-scanner due glib loaded as shared. Use -o 'glib/*:shared=False'. Contributions to fix this are welcome.") + if self.options.build_introspection_data and cross_building(self): + raise ConanInvalidConfiguration(f"{self.ref} build_introspection_data is not supported when cross-building. Use '&:build_introspection_data=False'.") def build_requirements(self): - if tools.Version(self.version) >= "1.71.0": - self.build_requires("meson/0.62.2") - else: - # https://gitlab.gnome.org/GNOME/gobject-introspection/-/issues/414 - self.build_requires("meson/0.59.3") - self.build_requires("pkgconf/1.7.4") + self.tool_requires("meson/[>=1.2.3 <2]") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/[>=2.2 <3]") if self.settings.os == "Windows": - self.build_requires("winflexbison/2.5.24") + self.tool_requires("winflexbison/2.5.25") else: - self.build_requires("flex/2.6.4") - self.build_requires("bison/3.7.6") - - def requirements(self): - self.requires("glib/2.73.0") + self.tool_requires("flex/2.6.4") + self.tool_requires("bison/3.8.2") + self.tool_requires("glib/") def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) - - def _configure_meson(self): - meson = Meson(self) - defs = dict() - defs["build_introspection_data"] = self.options["glib"].shared - defs["datadir"] = os.path.join(self.package_folder, "res") - - meson.configure( - source_folder=self._source_subfolder, - args=["--wrap-mode=nofallback"], - build_folder=self._build_subfolder, - defs=defs, - ) - return meson + 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) + if cross_building(self): + tc.project_options["gi_cross_use_prebuilt_gi"] = "false" + tc.project_options["build_introspection_data"] = self.options.build_introspection_data + tc.project_options["datadir"] = "res" + tc.generate() + deps = PkgConfigDeps(self) + deps.generate() + # INFO: g-ir-scanner uses PKG_CONFIG_PATH directly instead of pkg-config Meson module + env = Environment() + env.define_path("PKG_CONFIG_PATH", self.generators_folder) + envvars = env.vars(self) + envvars.save_script("pkg_config_env") + + def _patch_sources(self): + # Disable tests + replace_in_file(self, os.path.join(self.source_folder, "meson.build"), + "subdir('tests')", + "#subdir('tests')") + # Look for data files in res/ instead of share/ + replace_in_file(self, os.path.join(self.source_folder, "tools", "g-ir-tool-template.in"), + "os.path.join(filedir, '..', 'share')", + "os.path.join(filedir, '..', 'res')") + if Version(conan_version) < "2": + # INFO: Conan 1.x generates PkgConfigDeps with libdir1 and includedir1 variables only for glib due its modules + replace_in_file(self, os.path.join(self.source_folder, "gir", "meson.build"), + "glib_dep.get_variable(pkgconfig: 'libdir')", + "glib_dep.get_variable(pkgconfig: 'libdir1')") + replace_in_file(self, os.path.join(self.source_folder, "gir", "meson.build"), + "join_paths(glib_dep.get_variable(pkgconfig: 'includedir'), 'glib-2.0')", + "join_paths(glib_dep.get_variable(pkgconfig: 'includedir1'), 'glib-2.0')") + # gir/meson.build expects the gio-unix-2.0 includedir to be passed as a build flag. + # Patch this for glib from Conan. + replace_in_file(self, os.path.join(self.source_folder, "gir", "meson.build"), + "join_paths(giounix_dep.get_variable(pkgconfig: 'includedir'), 'gio-unix-2.0')", + "giounix_dep.get_variable(pkgconfig: 'includedir1')") + else: + # gir/meson.build expects the gio-unix-2.0 includedir to be passed as a build flag. + # Patch this for glib from Conan. + replace_in_file(self, os.path.join(self.source_folder, "gir", "meson.build"), + "join_paths(giounix_dep.get_variable(pkgconfig: 'includedir'), 'gio-unix-2.0')", + "giounix_dep.get_variable(pkgconfig: 'includedir')") def build(self): - tools.replace_in_file( - os.path.join(self._source_subfolder, "meson.build"), - "subdir('tests')", - "#subdir('tests')", - ) - tools.replace_in_file( - os.path.join(self._source_subfolder, "meson.build"), - "if meson.version().version_compare('>=0.54.0')", - "if false", - ) - - with tools.environment_append( - VisualStudioBuildEnvironment(self).vars - if self._is_msvc - else {"PKG_CONFIG_PATH": self.build_folder} - ): - meson = self._configure_meson() - meson.build() + self._patch_sources() + meson = Meson(self) + meson.configure() + meson.build() def package(self): - self.copy(pattern="COPYING", dst="licenses", src=self._source_subfolder) - with tools.environment_append( - VisualStudioBuildEnvironment(self).vars - ) if self._is_msvc else tools.no_op(): - meson = self._configure_meson() - meson.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) - for pdb_file in glob.glob(os.path.join(self.package_folder, "bin", "*.pdb")): - os.unlink(pdb_file) + copy(self, "COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + meson = Meson(self) + meson.install() + 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) + fix_apple_shared_install_name(self) def package_info(self): - self.cpp_info.names["pkg_config"] = "gobject-introspection-1.0" + self.cpp_info.set_property("pkg_config_name", "gobject-introspection-1.0") self.cpp_info.libs = ["girepository-1.0"] - self.cpp_info.includedirs.append( - os.path.join("include", "gobject-introspection-1.0") - ) - - 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.includedirs.append(os.path.join("include", "gobject-introspection-1.0")) exe_ext = ".exe" if self.settings.os == "Windows" else "" pkgconfig_variables = { - 'datadir': '${prefix}/res', - 'bindir': '${prefix}/bin', - 'g_ir_scanner': '${bindir}/g-ir-scanner', - 'g_ir_compiler': '${bindir}/g-ir-compiler%s' % exe_ext, - 'g_ir_generate': '${bindir}/g-ir-generate%s' % exe_ext, - 'gidatadir': '${datadir}/gobject-introspection-1.0', - 'girdir': '${datadir}/gir-1.0', - 'typelibdir': '${libdir}/girepository-1.0', + "datadir": "${prefix}/res", + "bindir": "${prefix}/bin", + "libdir": "${prefix}/lib", + "g_ir_scanner": "${bindir}/g-ir-scanner", + "g_ir_compiler": "${bindir}/g-ir-compiler%s" % exe_ext, + "g_ir_generate": "${bindir}/g-ir-generate%s" % exe_ext, + "gidatadir": "${datadir}/gobject-introspection-1.0", + "girdir": "${datadir}/gir-1.0", + "typelibdir": "${libdir}/girepository-1.0", } self.cpp_info.set_property( "pkg_config_custom_content", - "\n".join("%s=%s" % (key, value) for key,value in pkgconfig_variables.items())) + "\n".join(f"{key}={value}" for key, value in pkgconfig_variables.items()), + ) + self.buildenv_info.define_path("GI_GIR_PATH", os.path.join(self.package_folder, "res", "gir-1.0")) + self.buildenv_info.define_path("GI_TYPELIB_PATH", os.path.join(self.package_folder, "lib", "girepository-1.0")) + + # TODO: remove in conan v2 + bin_path = os.path.join(self.package_folder, "bin") + self.env_info.PATH.append(bin_path) + self.env_info.GI_GIR_PATH = os.path.join(self.package_folder, "res", "gir-1.0") + self.env_info.GI_TYPELIB_PATH = os.path.join(self.package_folder, "lib", "girepository-1.0") diff --git a/recipes/gobject-introspection/all/test_package/CMakeLists.txt b/recipes/gobject-introspection/all/test_package/CMakeLists.txt index 7b9b613cbb24a..228388b92ebea 100644 --- a/recipes/gobject-introspection/all/test_package/CMakeLists.txt +++ b/recipes/gobject-introspection/all/test_package/CMakeLists.txt @@ -1,8 +1,12 @@ -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() +find_package(gobject-introspection REQUIRED CONFIG) -add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +add_executable(test_basic test_basic.c) +target_link_libraries(test_basic PRIVATE gobject-introspection::gobject-introspection) + +if(GLIB_INTROSPECTION_DATA_AVAILABLE) + add_executable(test_girepository test_girepository.c) + target_link_libraries(test_girepository PRIVATE gobject-introspection::gobject-introspection) +endif() diff --git a/recipes/gobject-introspection/all/test_package/conanfile.py b/recipes/gobject-introspection/all/test_package/conanfile.py index 32d4b65e5f11e..ec823a4f6e977 100644 --- a/recipes/gobject-introspection/all/test_package/conanfile.py +++ b/recipes/gobject-introspection/all/test_package/conanfile.py @@ -1,26 +1,57 @@ -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_layout, CMake, CMakeToolchain +from conan.tools.files import save, load +from conan.tools.apple import is_apple_os + class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package", "pkg_config" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" - def build(self): - if self.settings.os != 'Windows': - with tools.environment_append({'PKG_CONFIG_PATH': "."}): - pkg_config = tools.PkgConfig("gobject-introspection-1.0") - for tool in ["g_ir_compiler", "g_ir_generate", "g_ir_scanner"]: - self.run('%s --version' % pkg_config.variables[tool], run_environment=True) - self.run('g-ir-annotation-tool --version', run_environment=True) - self.run('g-ir-inspect -h', run_environment=True) + def requirements(self): + self.requires(self.tested_reference_str, run=True) + + def layout(self): + cmake_layout(self) + def generate(self): + introspection_data = self.dependencies["glib"].options.shared and not is_apple_os(self) + tc = CMakeToolchain(self) + tc.variables["GLIB_INTROSPECTION_DATA_AVAILABLE"] = introspection_data + tc.generate() + save(self, os.path.join(self.build_folder, "gobject_introspection_data"), str(introspection_data)) + save(self, os.path.join(self.build_folder, "gobject_introspection_bin"), + self.dependencies["gobject-introspection"].cpp_info.bindirs[0]) + + def build(self): cmake = CMake(self) cmake.configure() cmake.build() 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): + if self.settings.os != "Windows": + gobject_introspection_bin = load(self, os.path.join(self.build_folder, "gobject_introspection_bin")) + gobject_introspection_data = load(self, os.path.join(self.build_folder, "gobject_introspection_data")) == "True" + for tool in ["g-ir-compiler", "g-ir-generate", "g-ir-scanner", "g-ir-annotation-tool"]: + if not gobject_introspection_data and tool in ["g-ir-scanner", "g-ir-annotation-tool"]: + continue + tool_path = os.path.join(gobject_introspection_bin, tool) + if os.path.exists(tool_path): + self.run(f"{tool_path} --version", env="conanrun") + else: + raise Exception(f"Tool {tool} not found in {gobject_introspection_bin}") + tool_path = os.path.join(gobject_introspection_bin, "g-ir-inspect") + if os.path.exists(tool_path): + self.run(f"{tool_path} -h", env="conanrun") + + bin_path = os.path.join(self.cpp.build.bindir, "test_basic") + self.run(bin_path, env="conanrun") + bin_path = os.path.join(self.cpp.build.bindir, "test_girepository") + if os.path.exists(bin_path): + self.run(bin_path, env="conanrun") diff --git a/recipes/gobject-introspection/all/test_package/test_basic.c b/recipes/gobject-introspection/all/test_package/test_basic.c new file mode 100644 index 0000000000000..44d8cd552ebdd --- /dev/null +++ b/recipes/gobject-introspection/all/test_package/test_basic.c @@ -0,0 +1,12 @@ +#include +#include + +#include "girepository.h" + +int main(void) { + printf("gobject introspection version %d.%d.%d\n", + gi_get_major_version(), + gi_get_minor_version(), + gi_get_micro_version()); + return EXIT_SUCCESS; +} diff --git a/recipes/gobject-introspection/all/test_package/test_girepository.c b/recipes/gobject-introspection/all/test_package/test_girepository.c new file mode 100644 index 0000000000000..d6994f8155c80 --- /dev/null +++ b/recipes/gobject-introspection/all/test_package/test_girepository.c @@ -0,0 +1,7 @@ +#include +#include "girepository.h" + +int main() { + GIRepository* repository = g_irepository_get_default(); + return EXIT_SUCCESS; +} diff --git a/recipes/gobject-introspection/all/test_package/test_package.c b/recipes/gobject-introspection/all/test_package/test_package.c deleted file mode 100644 index c1b18cd52e49e..0000000000000 --- a/recipes/gobject-introspection/all/test_package/test_package.c +++ /dev/null @@ -1,12 +0,0 @@ -#include - -#include "girepository.h" - -int main(int argc, char **argv) -{ - printf("gobject introspection version %d.%d.%d\n", - gi_get_major_version(), - gi_get_minor_version(), - gi_get_micro_version()); - return 0; -} diff --git a/recipes/gobject-introspection/all/test_v1_package/CMakeLists.txt b/recipes/gobject-introspection/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/gobject-introspection/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/gobject-introspection/all/test_v1_package/conanfile.py b/recipes/gobject-introspection/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..52695b0ce44eb --- /dev/null +++ b/recipes/gobject-introspection/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_basic") + self.run(bin_path, run_environment=True) diff --git a/recipes/gobject-introspection/config.yml b/recipes/gobject-introspection/config.yml index 06afabf3f5bc4..42a826aff4ed3 100644 --- a/recipes/gobject-introspection/config.yml +++ b/recipes/gobject-introspection/config.yml @@ -1,13 +1,5 @@ versions: - "1.72.0": - folder: all - "1.70.0": - folder: all - "1.69.0": + "1.78.1": folder: all - "1.68.0": - folder: all - "1.67.1": - folder: all - "1.66.1": + "1.72.0": folder: all diff --git a/recipes/godot-cpp/all/conandata.yml b/recipes/godot-cpp/all/conandata.yml index ce95c40023693..a5e56e1b0aaa0 100644 --- a/recipes/godot-cpp/all/conandata.yml +++ b/recipes/godot-cpp/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.5.1": + url: "https://github.com/godotengine/godot-cpp/archive/godot-3.5.1-stable.tar.gz" + sha256: "a0ab1f117d30ab01837e39e7ff704bbded282db4643343579b2bca11794f99fc" "3.3.4": url: "https://github.com/godotengine/godot-cpp/archive/godot-3.3.4-stable.tar.gz" sha256: "fa12b8dd8652109eceae7aecf134f64529edfb34ec33d24b1a9c220b40599575" diff --git a/recipes/godot-cpp/all/conanfile.py b/recipes/godot-cpp/all/conanfile.py index 625aabfb6d902..a99c635a67338 100644 --- a/recipes/godot-cpp/all/conanfile.py +++ b/recipes/godot-cpp/all/conanfile.py @@ -1,8 +1,16 @@ -import glob import os -from conans import 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 +from conan.tools.env import VirtualBuildEnv +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 + +required_conan_version = ">=1.53.0" class GodotCppConan(ConanFile): @@ -12,20 +20,81 @@ class GodotCppConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/godotengine/godot-cpp" topics = ("game-engine", "game-development", "c++") + + package_type = "static-library" settings = "os", "arch", "compiler", "build_type" - build_requires = ["scons/3.1.2"] + options = { + "fPIC": [True, False], + } + default_options = { + "fPIC": True, + } + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires(f"godot_headers/{self.version}", transitive_headers=True) + + def package_id(self): + if self.info.settings.build_type != "Debug": + self.info.settings.build_type = "Release" + + def validate(self): + minimal_cpp_standard = 14 + if self.settings.compiler.cppstd: + check_min_cppstd(self, minimal_cpp_standard) + + minimal_version = { + "gcc": "5", + "clang": "4", + "apple-clang": "10", + "msvc": "191", + "Visual Studio": "15", + } + + compiler = str(self.settings.compiler) + if compiler not in minimal_version: + 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]: + if compiler in ["apple-clang", "clang"]: + raise ConanInvalidConfiguration( + f"{self.name} requires a clang version that supports the '-Og' flag" + ) + raise ConanInvalidConfiguration( + f"{self.name} requires a compiler that supports at least C++{minimal_cpp_standard}" + ) + + def build_requirements(self): + self.tool_requires("scons/4.3.0") @property def _bits(self): - return 64 if self.settings.get_safe("arch") in ["x86_64", "armv8"] else 32 + return 32 if self.settings.arch in ["x86"] else 64 + + @property + def _godot_headers(self): + return self.dependencies["godot_headers"].cpp_info @property def _custom_api_file(self): - return "{}/api.json".format(self._godot_headers.res_paths[0]) + return f"{self._godot_headers.resdirs[0]}/api.json" @property def _headers_dir(self): - return self._godot_headers.include_paths[0] + return self._godot_headers.includedirs[0] @property def _platform(self): @@ -34,98 +103,67 @@ def _platform(self): "Linux": "linux", "Macos": "osx", } - return flag_map[self.settings.get_safe("os")] + return flag_map[str(self.settings.os)] @property def _target(self): - return "debug" if self.settings.get_safe("build_type") == "Debug" else "release" + return "debug" if self.settings.build_type == "Debug" else "release" @property def _use_llvm(self): - return self.settings.get_safe("compiler") in ["clang", "apple-clang"] + return self.settings.compiler in ["clang", "apple-clang"] @property def _use_mingw(self): - return self._platform == "windows" and self.settings.compiler == "gcc" + return self.settings.os == "Windows" and self.settings.compiler == "gcc" @property def _libname(self): - return "godot-cpp.{platform}.{target}.{bits}".format(platform=self._platform, target=self._target, bits=self._bits) - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _godot_headers(self): - return self.deps_cpp_info["godot_headers"] + return f"godot-cpp.{self._platform}.{self._target}.{self._bits}" def source(self): - tools.get(**self.conan_data["sources"][self.version]) - tools.rename(glob.glob("godot-cpp-*")[0], self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - def requirements(self): - self.requires("godot_headers/{}".format(self.version)) - - 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": "4", - "apple-clang": "10", - "Visual Studio": "15", - } - - 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)) - return - - version = tools.Version(self.settings.compiler.version) - if version < minimal_version[compiler]: - if compiler in ["apple-clang", "clang"]: - raise ConanInvalidConfiguration( - "{} requires a clang version that supports the '-Og' flag".format(self.name)) - raise ConanInvalidConfiguration( - "{} requires a compiler that supports at least C++{}".format(self.name, minimal_cpp_standard)) + def generate(self): + VirtualBuildEnv(self).generate() def build(self): self.run("python --version") - if self.settings.os == "Macos": + if is_apple_os(self): self.run("which python") self.run("scons --version") - self.run( - " ".join([ - "scons", - "-C{}".format(self._source_subfolder), - "-j{}".format(tools.cpu_count()), - "generate_bindings=yes", - "use_custom_api_file=yes", - "bits={}".format(self._bits), - "custom_api_file={}".format(self._custom_api_file), - "headers_dir={}".format(self._headers_dir), - "platform={}".format(self._platform), - "target={}".format(self._target), - "use_llvm={}".format(self._use_llvm), - "use_mingw={}".format(self._use_mingw), - ]) - ) + self.run(" ".join([ + "scons", + f"-C{self.source_folder}", + f"-j{os.cpu_count()}", + "generate_bindings=yes", + "use_custom_api_file=yes", + f"bits={self._bits}", + f"custom_api_file={self._custom_api_file}", + f"headers_dir={self._headers_dir}", + f"platform={self._platform}", + f"target={self._target}", + f"use_llvm={self._use_llvm}", + f"use_mingw={self._use_mingw}", + ])) def package(self): - self.copy("LICENSE*", dst="licenses", src=self._source_subfolder) - self.copy("*.hpp", dst="include/godot-cpp", src=os.path.join(self._source_subfolder, "include")) - self.copy("*.a", dst="lib", src=os.path.join(self._source_subfolder, "bin")) - self.copy("*.lib", dst="lib", src=os.path.join(self._source_subfolder, "bin")) + copy(self, "LICENSE*", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder) + copy(self, "*.hpp", + dst=os.path.join(self.package_folder, "include/godot-cpp"), + src=os.path.join(self.source_folder, "include")) + copy(self, "*.a", + dst=os.path.join(self.package_folder, "lib"), + src=os.path.join(self.source_folder, "bin")) + copy(self, "*.lib", + dst=os.path.join(self.package_folder, "lib"), + src=os.path.join(self.source_folder, "bin")) def package_info(self): - if self.settings.os == "Windows" and self.settings.compiler == "Visual Studio": - self.cpp_info.libs = ["lib{}".format(self._libname)] + if is_msvc(self): + self.cpp_info.libs = [f"lib{self._libname}"] else: self.cpp_info.libs = [self._libname] @@ -134,9 +172,3 @@ def package_info(self): os.path.join("include", "godot-cpp", "core"), os.path.join("include", "godot-cpp", "gen"), ] - - def package_id(self): - if self._target == "release": - self.info.settings.build_type = "Release" - else: - self.info.settings.build_type = "Debug" diff --git a/recipes/godot-cpp/all/test_package/CMakeLists.txt b/recipes/godot-cpp/all/test_package/CMakeLists.txt index cb623ce6ed58f..49d358aeae0ef 100644 --- a/recipes/godot-cpp/all/test_package/CMakeLists.txt +++ b/recipes/godot-cpp/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION "3.1") +cmake_minimum_required(VERSION 3.15) project("test_package" LANGUAGES CXX) -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup() +find_package(godot-cpp 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") +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} godot-cpp::godot-cpp) +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14) diff --git a/recipes/godot-cpp/all/test_package/conanfile.py b/recipes/godot-cpp/all/test_package/conanfile.py index 4dea15a1318e1..ef5d7042163ec 100644 --- a/recipes/godot-cpp/all/test_package/conanfile.py +++ b/recipes/godot-cpp/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 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/godot-cpp/all/test_v1_package/CMakeLists.txt b/recipes/godot-cpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/godot-cpp/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/godot-cpp/all/test_v1_package/conanfile.py b/recipes/godot-cpp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..75634e62bcb66 --- /dev/null +++ b/recipes/godot-cpp/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +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/godot-cpp/config.yml b/recipes/godot-cpp/config.yml index 0d66aae9da011..6d3463978fb93 100644 --- a/recipes/godot-cpp/config.yml +++ b/recipes/godot-cpp/config.yml @@ -1,4 +1,6 @@ versions: + "3.5.1": + folder: all "3.3.4": folder: all "cci.3.2-20200130": diff --git a/recipes/godot_headers/all/conandata.yml b/recipes/godot_headers/all/conandata.yml index 8764611b2ac9a..8f004a1d2a043 100644 --- a/recipes/godot_headers/all/conandata.yml +++ b/recipes/godot_headers/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "3.5.3": + url: "https://github.com/godotengine/godot-headers/archive/godot-3.5.3-stable.tar.gz" + sha256: "98bf368ab07cac91b864e983bffa50757aabf2a8156d3e9f4d81ecbcea77ebd7" + "3.5.2": + url: "https://github.com/godotengine/godot-headers/archive/godot-3.5.2-stable.tar.gz" + sha256: "42e97953d3f193db01cccd856dff0430a6737d47b8496a70e7df34387d870a6e" "3.5.1": url: "https://github.com/godotengine/godot-headers/archive/godot-3.5.1-stable.tar.gz" sha256: "1c38268031425a4881c0d6d41926a0f1bf5847f05dc24c29332609e318276b6b" diff --git a/recipes/godot_headers/all/conanfile.py b/recipes/godot_headers/all/conanfile.py index 0a0d46219f9db..ed0b3120bd04c 100644 --- a/recipes/godot_headers/all/conanfile.py +++ b/recipes/godot_headers/all/conanfile.py @@ -13,6 +13,7 @@ class GodotHeadersConan(ConanFile): homepage = "https://github.com/godotengine/godot_headers" description = "Godot Native interface headers" topics = ("game-engine", "game-development") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -23,8 +24,7 @@ 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 diff --git a/recipes/godot_headers/all/test_v1_package/CMakeLists.txt b/recipes/godot_headers/all/test_v1_package/CMakeLists.txt index 643dedc50d02a..de3b75d9538de 100644 --- a/recipes/godot_headers/all/test_v1_package/CMakeLists.txt +++ b/recipes/godot_headers/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(godot_headers REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE godot_headers::godot_headers) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/godot_headers/config.yml b/recipes/godot_headers/config.yml index 3ded438e58f33..6aadd92e7a3d8 100644 --- a/recipes/godot_headers/config.yml +++ b/recipes/godot_headers/config.yml @@ -1,4 +1,8 @@ versions: + "3.5.3": + folder: all + "3.5.2": + folder: all "3.5.1": folder: all "3.4.4": diff --git a/recipes/google-cloud-cpp/2.x/components_2_15_1.py b/recipes/google-cloud-cpp/2.x/components_2_15_1.py new file mode 100644 index 0000000000000..6de02bc36704b --- /dev/null +++ b/recipes/google-cloud-cpp/2.x/components_2_15_1.py @@ -0,0 +1,441 @@ +# Automatically generated by /usr/local/google/home/coryan/cci-develop/recipes/google-cloud-cpp/2.x/extract_dependencies.py DO NOT EDIT +DEPENDENCIES = { + "accessapproval_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf'], + "accesscontextmanager_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_expr_protos'], + "advisorynotifications_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf'], + "aiplatform_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_httpbody_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_interval_protos', 'type_money_protos'], + "alloydb_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_dayofweek_protos', 'type_timeofday_protos'], + "apigateway_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "apigeeconnect_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf', 'rpc_status_protos'], + "apikeys_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "appengine_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'logging_type_type_protos', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "artifactregistry_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_expr_protos'], + "asset_protos": ['accesscontextmanager_protos', 'api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'longrunning_operations_protos', 'osconfig_protos', 'protobuf::libprotobuf', 'rpc_code_protos', 'rpc_status_protos', 'type_date_protos', 'type_datetime_protos', 'type_dayofweek_protos', 'type_expr_protos', 'type_timeofday_protos'], + "assuredworkloads_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "automl_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "baremetalsolution_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "batch_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "beyondcorp_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "bigquery_protos": ['api_annotations_protos', 'api_client_protos', 'api_distribution_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_label_protos', 'api_launch_stage_protos', 'api_metric_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'protobuf::libprotobuf', 'rpc_error_details_protos', 'rpc_status_protos', 'type_expr_protos'], + "bigtable_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'api_routing_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_expr_protos'], + "billing_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'protobuf::libprotobuf', 'type_date_protos', 'type_expr_protos', 'type_money_protos'], + "binaryauthorization_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grafeas_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf', 'rpc_status_protos'], + "certificatemanager_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "channel_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_date_protos', 'type_datetime_protos', 'type_decimal_protos', 'type_money_protos', 'type_postal_address_protos'], + "cloudbuild_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_httpbody_protos', 'api_launch_stage_protos', 'api_resource_protos', 'api_routing_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "commerce_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "cloud_common_common_protos": ['api_field_behavior_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf'], + "composer_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_date_protos'], + "confidentialcomputing_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf', 'rpc_status_protos'], + "connectors_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "contactcenterinsights_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "container_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf', 'rpc_code_protos', 'rpc_status_protos'], + "containeranalysis_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grafeas_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_expr_protos'], + "contentwarehouse_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'documentai_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_policy_protos', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_color_protos', 'type_date_protos', 'type_datetime_protos', 'type_expr_protos', 'type_interval_protos', 'type_money_protos', 'type_postal_address_protos'], + "datacatalog_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_expr_protos'], + "datafusion_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "datamigration_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_expr_protos'], + "dataplex_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_expr_protos'], + "dataproc_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "datastore_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_routing_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_latlng_protos'], + "datastream_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "deploy_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_date_protos'], + "dialogflow_cx_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_latlng_protos'], + "dialogflow_es_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_latlng_protos'], + "discoveryengine_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_httpbody_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_date_protos'], + "dlp_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_date_protos', 'type_dayofweek_protos', 'type_timeofday_protos'], + "documentai_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_color_protos', 'type_date_protos', 'type_datetime_protos', 'type_money_protos', 'type_postal_address_protos'], + "domains_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_money_protos', 'type_postal_address_protos'], + "edgecontainer_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "essentialcontacts_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf'], + "eventarc_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_code_protos', 'rpc_status_protos'], + "filestore_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'cloud_common_common_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "functions_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_expr_protos'], + "gkebackup_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "gkehub_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "gkemulticloud_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "grafeas_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf', 'rpc_status_protos'], + "iam_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'protobuf::libprotobuf', 'type_expr_protos'], + "iam_v2_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_expr_protos'], + "iap_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'protobuf::libprotobuf', 'type_expr_protos'], + "ids_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "kms_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf'], + "language_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf'], + "logging_protos": ['api_annotations_protos', 'api_client_protos', 'api_distribution_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_label_protos', 'api_launch_stage_protos', 'api_metric_protos', 'api_monitored_resource_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'logging_type_type_protos', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "logging_type_protos": ['grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf'], + "managedidentities_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "memcache_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_dayofweek_protos', 'type_timeofday_protos'], + "metastore_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_dayofweek_protos'], + "migrationcenter_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_date_protos', 'type_money_protos'], + "monitoring_protos": ['api_annotations_protos', 'api_client_protos', 'api_distribution_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_label_protos', 'api_launch_stage_protos', 'api_metric_protos', 'api_monitored_resource_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_calendar_period_protos'], + "networkconnectivity_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "networkmanagement_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "networksecurity_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "networkservices_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "notebooks_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "optimization_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_latlng_protos'], + "orgpolicy_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf', 'type_expr_protos'], + "osconfig_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_date_protos', 'type_datetime_protos', 'type_dayofweek_protos', 'type_timeofday_protos'], + "oslogin_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf'], + "policysimulator_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_policy_protos', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_date_protos', 'type_expr_protos'], + "policytroubleshooter_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_policy_protos', 'iam_v2_protos', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_expr_protos'], + "privateca_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_expr_protos'], + "profiler_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf'], + "pubsub_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf'], + "rapidmigrationassessment_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "recaptchaenterprise_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf'], + "recommender_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf', 'type_money_protos'], + "redis_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_dayofweek_protos', 'type_timeofday_protos'], + "resourcemanager_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_expr_protos'], + "resourcesettings_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf'], + "retail_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_httpbody_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_date_protos'], + "run_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'api_routing_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_expr_protos'], + "scheduler_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf', 'rpc_status_protos'], + "secretmanager_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'protobuf::libprotobuf', 'type_expr_protos'], + "securitycenter_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_expr_protos'], + "servicecontrol_protos": ['api_annotations_protos', 'api_client_protos', 'api_distribution_protos', 'api_http_protos', 'api_launch_stage_protos', 'grpc::_grpc', 'grpc::grpc++', 'logging_type_type_protos', 'protobuf::libprotobuf', 'rpc_context_attribute_context_protos', 'rpc_status_protos'], + "servicedirectory_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'protobuf::libprotobuf', 'type_expr_protos'], + "servicemanagement_protos": ['api_annotations_protos', 'api_auth_protos', 'api_backend_protos', 'api_billing_protos', 'api_client_protos', 'api_config_change_protos', 'api_context_protos', 'api_control_protos', 'api_documentation_protos', 'api_endpoint_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_label_protos', 'api_launch_stage_protos', 'api_log_protos', 'api_logging_protos', 'api_metric_protos', 'api_monitored_resource_protos', 'api_monitoring_protos', 'api_policy_protos', 'api_quota_protos', 'api_resource_protos', 'api_service_protos', 'api_source_info_protos', 'api_system_parameter_protos', 'api_usage_protos', 'api_visibility_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "serviceusage_protos": ['api_annotations_protos', 'api_auth_protos', 'api_client_protos', 'api_documentation_protos', 'api_endpoint_protos', 'api_http_protos', 'api_label_protos', 'api_launch_stage_protos', 'api_monitored_resource_protos', 'api_monitoring_protos', 'api_quota_protos', 'api_usage_protos', 'api_visibility_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "shell_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "spanner_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_expr_protos'], + "speech_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "storage_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'api_routing_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'protobuf::libprotobuf', 'type_date_protos', 'type_expr_protos'], + "storageinsights_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_date_protos', 'type_datetime_protos'], + "storagetransfer_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_code_protos', 'rpc_status_protos', 'type_date_protos', 'type_timeofday_protos'], + "support_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "talent_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_latlng_protos', 'type_money_protos', 'type_postal_address_protos', 'type_timeofday_protos'], + "tasks_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_expr_protos'], + "texttospeech_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "timeseriesinsights_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf', 'rpc_status_protos'], + "tpu_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "trace_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf', 'rpc_status_protos'], + "translate_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "video_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_datetime_protos'], + "videointelligence_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "vision_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_color_protos', 'type_latlng_protos'], + "vmmigration_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_error_details_protos', 'rpc_status_protos'], + "vmwareengine_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "vpcaccess_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "webrisk_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "websecurityscanner_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf'], + "workflows_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "workstations_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "api_annotations_protos": ['api_http_protos'], + "api_auth_protos": ['api_annotations_protos'], + "api_billing_protos": ['api_annotations_protos', 'api_metric_protos'], + "api_client_protos": ['api_launch_stage_protos'], + "api_distribution_protos": ['api_annotations_protos'], + "api_endpoint_protos": ['api_annotations_protos'], + "api_log_protos": ['api_label_protos'], + "api_logging_protos": ['api_annotations_protos', 'api_label_protos'], + "api_metric_protos": ['api_label_protos', 'api_launch_stage_protos'], + "api_monitored_resource_protos": ['api_label_protos', 'api_launch_stage_protos'], + "api_monitoring_protos": ['api_annotations_protos'], + "api_quota_protos": ['api_annotations_protos'], + "api_service_protos": ['api_annotations_protos', 'api_auth_protos', 'api_backend_protos', 'api_billing_protos', 'api_client_protos', 'api_context_protos', 'api_control_protos', 'api_documentation_protos', 'api_endpoint_protos', 'api_http_protos', 'api_label_protos', 'api_log_protos', 'api_logging_protos', 'api_metric_protos', 'api_monitored_resource_protos', 'api_monitoring_protos', 'api_quota_protos', 'api_resource_protos', 'api_source_info_protos', 'api_system_parameter_protos', 'api_usage_protos'], + "api_usage_protos": ['api_annotations_protos', 'api_visibility_protos'], + "iam_credentials_v1_common_protos": ['api_field_behavior_protos', 'api_resource_protos'], + "iam_credentials_v1_iamcredentials_protos": ['api_annotations_protos', 'api_client_protos', 'iam_credentials_v1_common_protos'], + "iam_v1_iam_policy_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_resource_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos'], + "iam_v1_options_protos": ['api_annotations_protos'], + "iam_v1_policy_protos": ['api_annotations_protos', 'type_expr_protos'], +} + +PROTO_COMPONENTS = { + "accessapproval_protos", + "accesscontextmanager_protos", + "advisorynotifications_protos", + "aiplatform_protos", + "alloydb_protos", + "api_annotations_protos", + "api_auth_protos", + "api_backend_protos", + "api_billing_protos", + "api_client_protos", + "api_config_change_protos", + "api_context_protos", + "api_control_protos", + "api_distribution_protos", + "api_documentation_protos", + "api_endpoint_protos", + "api_field_behavior_protos", + "api_http_protos", + "api_httpbody_protos", + "api_label_protos", + "api_launch_stage_protos", + "api_log_protos", + "api_logging_protos", + "api_metric_protos", + "api_monitored_resource_protos", + "api_monitoring_protos", + "api_policy_protos", + "api_quota_protos", + "api_resource_protos", + "api_routing_protos", + "api_service_protos", + "api_source_info_protos", + "api_system_parameter_protos", + "api_usage_protos", + "api_visibility_protos", + "apigateway_protos", + "apigeeconnect_protos", + "apikeys_protos", + "appengine_protos", + "artifactregistry_protos", + "asset_protos", + "assuredworkloads_protos", + "automl_protos", + "baremetalsolution_protos", + "batch_protos", + "beyondcorp_protos", + "bigquery_protos", + "bigtable_protos", + "billing_protos", + "binaryauthorization_protos", + "certificatemanager_protos", + "channel_protos", + "cloud_common_common_protos", + "cloudbuild_protos", + "commerce_protos", + "composer_protos", + "confidentialcomputing_protos", + "connectors_protos", + "contactcenterinsights_protos", + "container_protos", + "containeranalysis_protos", + "contentwarehouse_protos", + "datacatalog_protos", + "datafusion_protos", + "datamigration_protos", + "dataplex_protos", + "dataproc_protos", + "datastore_protos", + "datastream_protos", + "deploy_protos", + "devtools_source_v1_source_context_protos", + "dialogflow_cx_protos", + "dialogflow_es_protos", + "discoveryengine_protos", + "dlp_protos", + "documentai_protos", + "domains_protos", + "edgecontainer_protos", + "essentialcontacts_protos", + "eventarc_protos", + "filestore_protos", + "functions_protos", + "gkebackup_protos", + "gkehub_protos", + "gkemulticloud_protos", + "grafeas_protos", + "iam_credentials_v1_common_protos", + "iam_credentials_v1_iamcredentials_protos", + "iam_protos", + "iam_v1_iam_policy_protos", + "iam_v1_options_protos", + "iam_v1_policy_protos", + "iam_v2_protos", + "iap_protos", + "ids_protos", + "kms_protos", + "language_protos", + "logging_protos", + "logging_type_protos", + "logging_type_type_protos", + "longrunning_operations_protos", + "managedidentities_protos", + "memcache_protos", + "metastore_protos", + "migrationcenter_protos", + "monitoring_protos", + "networkconnectivity_protos", + "networkmanagement_protos", + "networksecurity_protos", + "networkservices_protos", + "notebooks_protos", + "optimization_protos", + "orgpolicy_protos", + "osconfig_protos", + "oslogin_protos", + "policysimulator_protos", + "policytroubleshooter_protos", + "privateca_protos", + "profiler_protos", + "pubsub_protos", + "rapidmigrationassessment_protos", + "recaptchaenterprise_protos", + "recommender_protos", + "redis_protos", + "resourcemanager_protos", + "resourcesettings_protos", + "retail_protos", + "rpc_code_protos", + "rpc_context_attribute_context_protos", + "rpc_error_details_protos", + "rpc_status_protos", + "run_protos", + "scheduler_protos", + "secretmanager_protos", + "securitycenter_protos", + "servicecontrol_protos", + "servicedirectory_protos", + "servicemanagement_protos", + "serviceusage_protos", + "shell_protos", + "spanner_protos", + "speech_protos", + "storage_protos", + "storageinsights_protos", + "storagetransfer_protos", + "support_protos", + "talent_protos", + "tasks_protos", + "texttospeech_protos", + "timeseriesinsights_protos", + "tpu_protos", + "trace_protos", + "translate_protos", + "type_calendar_period_protos", + "type_color_protos", + "type_date_protos", + "type_datetime_protos", + "type_dayofweek_protos", + "type_decimal_protos", + "type_expr_protos", + "type_interval_protos", + "type_latlng_protos", + "type_money_protos", + "type_postal_address_protos", + "type_timeofday_protos", + "video_protos", + "videointelligence_protos", + "vision_protos", + "vmmigration_protos", + "vmwareengine_protos", + "vpcaccess_protos", + "webrisk_protos", + "websecurityscanner_protos", + "workflows_protos", + "workstations_protos" +} + +COMPONENTS = { + "accessapproval", + "accesscontextmanager", + "advisorynotifications", + "aiplatform", + "alloydb", + "apigateway", + "apigeeconnect", + "apikeys", + "appengine", + "artifactregistry", + "asset", + "assuredworkloads", + "automl", + "baremetalsolution", + "batch", + "beyondcorp", + "bigquery", + "bigtable", + "billing", + "binaryauthorization", + "certificatemanager", + "channel", + "cloudbuild", + "commerce", + "composer", + "confidentialcomputing", + "connectors", + "contactcenterinsights", + "container", + "containeranalysis", + "contentwarehouse", + "datacatalog", + "datafusion", + "datamigration", + "dataplex", + "dataproc", + "datastore", + "datastream", + "deploy", + "dialogflow_cx", + "dialogflow_es", + "discoveryengine", + "dlp", + "documentai", + "domains", + "edgecontainer", + "essentialcontacts", + "eventarc", + "filestore", + "functions", + "gkebackup", + "gkehub", + "gkemulticloud", + "iam", + "iap", + "ids", + "kms", + "language", + "logging", + "managedidentities", + "memcache", + "metastore", + "migrationcenter", + "monitoring", + "networkconnectivity", + "networkmanagement", + "networksecurity", + "networkservices", + "notebooks", + "optimization", + "orgpolicy", + "osconfig", + "oslogin", + "policysimulator", + "policytroubleshooter", + "privateca", + "profiler", + "pubsub", + "rapidmigrationassessment", + "recaptchaenterprise", + "recommender", + "redis", + "resourcemanager", + "resourcesettings", + "retail", + "run", + "scheduler", + "secretmanager", + "securitycenter", + "servicecontrol", + "servicedirectory", + "servicemanagement", + "serviceusage", + "shell", + "spanner", + "speech", + "storage", + "storageinsights", + "storagetransfer", + "support", + "talent", + "tasks", + "texttospeech", + "timeseriesinsights", + "tpu", + "trace", + "translate", + "video", + "videointelligence", + "vision", + "vmmigration", + "vmwareengine", + "vpcaccess", + "webrisk", + "websecurityscanner", + "workflows", + "workstations" +} diff --git a/recipes/google-cloud-cpp/2.x/components_2_19_0.py b/recipes/google-cloud-cpp/2.x/components_2_19_0.py new file mode 100644 index 0000000000000..704bb08158fe3 --- /dev/null +++ b/recipes/google-cloud-cpp/2.x/components_2_19_0.py @@ -0,0 +1,695 @@ +# Automatically generated by /usr/local/google/home/coryan/cci-develop/recipes/google-cloud-cpp/2.x/extract_dependencies.py DO NOT EDIT +DEPENDENCIES = { + "accessapproval_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf'], + "accesscontextmanager_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_expr_protos'], + "advisorynotifications_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf'], + "aiplatform_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_httpbody_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_interval_protos', 'type_money_protos'], + "alloydb_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_dayofweek_protos', 'type_timeofday_protos'], + "apigateway_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "apigeeconnect_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf', 'rpc_status_protos'], + "apikeys_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "appengine_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'logging_type_type_protos', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "artifactregistry_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_expr_protos'], + "asset_protos": ['accesscontextmanager_protos', 'api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'longrunning_operations_protos', 'osconfig_protos', 'protobuf::libprotobuf', 'rpc_code_protos', 'rpc_status_protos', 'type_date_protos', 'type_datetime_protos', 'type_dayofweek_protos', 'type_expr_protos', 'type_timeofday_protos'], + "assuredworkloads_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "automl_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "baremetalsolution_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "batch_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "beyondcorp_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "bigquery_protos": ['api_annotations_protos', 'api_client_protos', 'api_distribution_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_label_protos', 'api_launch_stage_protos', 'api_metric_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_error_details_protos', 'rpc_status_protos', 'type_expr_protos'], + "bigtable_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'api_routing_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_expr_protos'], + "billing_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'protobuf::libprotobuf', 'type_date_protos', 'type_expr_protos', 'type_money_protos'], + "binaryauthorization_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grafeas_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf', 'rpc_status_protos'], + "certificatemanager_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "channel_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_date_protos', 'type_datetime_protos', 'type_decimal_protos', 'type_money_protos', 'type_postal_address_protos'], + "cloudbuild_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_httpbody_protos', 'api_launch_stage_protos', 'api_resource_protos', 'api_routing_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "commerce_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "cloud_common_common_protos": ['api_field_behavior_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf'], + "composer_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_date_protos'], + "confidentialcomputing_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf', 'rpc_status_protos'], + "config_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "connectors_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "contactcenterinsights_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "container_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf', 'rpc_code_protos', 'rpc_status_protos'], + "containeranalysis_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grafeas_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_expr_protos'], + "contentwarehouse_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'documentai_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_policy_protos', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_color_protos', 'type_date_protos', 'type_datetime_protos', 'type_expr_protos', 'type_interval_protos', 'type_money_protos', 'type_postal_address_protos'], + "datacatalog_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_expr_protos'], + "datafusion_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "datamigration_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_expr_protos'], + "dataplex_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_expr_protos'], + "dataproc_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_interval_protos'], + "datastore_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_routing_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_latlng_protos'], + "datastream_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "deploy_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_date_protos'], + "dialogflow_cx_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_latlng_protos'], + "dialogflow_es_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_latlng_protos'], + "discoveryengine_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_httpbody_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_date_protos'], + "dlp_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_date_protos', 'type_dayofweek_protos', 'type_timeofday_protos'], + "documentai_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_color_protos', 'type_date_protos', 'type_datetime_protos', 'type_money_protos', 'type_postal_address_protos'], + "domains_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_money_protos', 'type_postal_address_protos'], + "edgecontainer_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "edgenetwork_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "essentialcontacts_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf'], + "eventarc_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_code_protos', 'rpc_status_protos'], + "filestore_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'cloud_common_common_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "functions_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_expr_protos'], + "gkebackup_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "gkehub_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "gkemulticloud_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "grafeas_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf', 'rpc_status_protos'], + "iam_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'protobuf::libprotobuf', 'type_expr_protos'], + "iam_v2_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_expr_protos'], + "iap_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'protobuf::libprotobuf', 'type_expr_protos'], + "ids_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "kms_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf'], + "language_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf'], + "logging_protos": ['api_annotations_protos', 'api_client_protos', 'api_distribution_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_label_protos', 'api_launch_stage_protos', 'api_metric_protos', 'api_monitored_resource_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'logging_type_type_protos', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "logging_type_protos": ['grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf'], + "managedidentities_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "memcache_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_dayofweek_protos', 'type_timeofday_protos'], + "metastore_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_dayofweek_protos'], + "migrationcenter_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_date_protos', 'type_money_protos'], + "monitoring_protos": ['api_annotations_protos', 'api_client_protos', 'api_distribution_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_label_protos', 'api_launch_stage_protos', 'api_metric_protos', 'api_monitored_resource_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_calendar_period_protos'], + "netapp_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "networkconnectivity_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "networkmanagement_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "networksecurity_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "networkservices_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "notebooks_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "optimization_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_latlng_protos'], + "orgpolicy_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf', 'type_expr_protos'], + "osconfig_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_date_protos', 'type_datetime_protos', 'type_dayofweek_protos', 'type_timeofday_protos'], + "oslogin_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf'], + "policysimulator_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_policy_protos', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_date_protos', 'type_expr_protos'], + "policytroubleshooter_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_policy_protos', 'iam_v2_protos', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_expr_protos'], + "privateca_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_expr_protos'], + "profiler_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf'], + "pubsub_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf'], + "rapidmigrationassessment_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "recaptchaenterprise_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf', 'rpc_status_protos'], + "recommender_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf', 'type_money_protos'], + "redis_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_dayofweek_protos', 'type_timeofday_protos'], + "resourcemanager_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_expr_protos'], + "resourcesettings_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf'], + "retail_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_httpbody_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_date_protos'], + "run_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'api_routing_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_expr_protos'], + "scheduler_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf', 'rpc_status_protos'], + "secretmanager_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'protobuf::libprotobuf', 'type_expr_protos'], + "securesourcemanager_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_expr_protos'], + "securitycenter_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_expr_protos'], + "servicecontrol_protos": ['api_annotations_protos', 'api_client_protos', 'api_distribution_protos', 'api_http_protos', 'api_launch_stage_protos', 'grpc::_grpc', 'grpc::grpc++', 'logging_type_type_protos', 'protobuf::libprotobuf', 'rpc_context_attribute_context_protos', 'rpc_status_protos'], + "servicedirectory_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'protobuf::libprotobuf', 'type_expr_protos'], + "servicemanagement_protos": ['api_annotations_protos', 'api_auth_protos', 'api_backend_protos', 'api_billing_protos', 'api_client_protos', 'api_config_change_protos', 'api_context_protos', 'api_control_protos', 'api_documentation_protos', 'api_endpoint_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_label_protos', 'api_launch_stage_protos', 'api_log_protos', 'api_logging_protos', 'api_metric_protos', 'api_monitored_resource_protos', 'api_monitoring_protos', 'api_policy_protos', 'api_quota_protos', 'api_resource_protos', 'api_service_protos', 'api_source_info_protos', 'api_system_parameter_protos', 'api_usage_protos', 'api_visibility_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "serviceusage_protos": ['api_annotations_protos', 'api_auth_protos', 'api_client_protos', 'api_documentation_protos', 'api_endpoint_protos', 'api_http_protos', 'api_label_protos', 'api_launch_stage_protos', 'api_monitored_resource_protos', 'api_monitoring_protos', 'api_quota_protos', 'api_resource_protos', 'api_usage_protos', 'api_visibility_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "shell_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "spanner_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_expr_protos'], + "speech_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "sql_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "storage_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'api_routing_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'protobuf::libprotobuf', 'type_date_protos', 'type_expr_protos'], + "storageinsights_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_date_protos', 'type_datetime_protos'], + "storagetransfer_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_code_protos', 'rpc_status_protos', 'type_date_protos', 'type_timeofday_protos'], + "support_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "talent_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_latlng_protos', 'type_money_protos', 'type_postal_address_protos', 'type_timeofday_protos'], + "tasks_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_expr_protos'], + "telcoautomation_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "texttospeech_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "timeseriesinsights_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf', 'rpc_status_protos'], + "tpu_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "trace_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf', 'rpc_status_protos'], + "translate_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "video_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_datetime_protos'], + "videointelligence_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "vision_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_color_protos', 'type_latlng_protos'], + "vmmigration_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_error_details_protos', 'rpc_status_protos'], + "vmwareengine_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "vpcaccess_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "webrisk_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "websecurityscanner_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf'], + "workflows_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "workstations_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "api_annotations_protos": ['api_http_protos'], + "api_auth_protos": ['api_annotations_protos'], + "api_billing_protos": ['api_annotations_protos', 'api_metric_protos'], + "api_client_protos": ['api_launch_stage_protos'], + "api_distribution_protos": ['api_annotations_protos'], + "api_endpoint_protos": ['api_annotations_protos'], + "api_log_protos": ['api_label_protos'], + "api_logging_protos": ['api_annotations_protos', 'api_label_protos'], + "api_metric_protos": ['api_label_protos', 'api_launch_stage_protos'], + "api_monitored_resource_protos": ['api_label_protos', 'api_launch_stage_protos'], + "api_monitoring_protos": ['api_annotations_protos'], + "api_quota_protos": ['api_annotations_protos'], + "api_service_protos": ['api_annotations_protos', 'api_auth_protos', 'api_backend_protos', 'api_billing_protos', 'api_client_protos', 'api_context_protos', 'api_control_protos', 'api_documentation_protos', 'api_endpoint_protos', 'api_http_protos', 'api_label_protos', 'api_log_protos', 'api_logging_protos', 'api_metric_protos', 'api_monitored_resource_protos', 'api_monitoring_protos', 'api_quota_protos', 'api_resource_protos', 'api_source_info_protos', 'api_system_parameter_protos', 'api_usage_protos'], + "api_usage_protos": ['api_annotations_protos', 'api_visibility_protos'], + "iam_credentials_v1_common_protos": ['api_field_behavior_protos', 'api_resource_protos'], + "iam_credentials_v1_iamcredentials_protos": ['api_annotations_protos', 'api_client_protos', 'iam_credentials_v1_common_protos'], + "iam_v1_iam_policy_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_resource_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos'], + "iam_v1_options_protos": ['api_annotations_protos'], + "iam_v1_policy_protos": ['api_annotations_protos', 'type_expr_protos'], + "compute_internal_protos": ["protobuf::libprotobuf"], + "cloud_extended_operations_protos": ["protobuf::libprotobuf"], + "compute_accelerator_types_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_addresses_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_autoscalers_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_backend_buckets_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_backend_services_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_disk_types_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_disks_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_external_vpn_gateways_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_firewall_policies_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_firewalls_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_forwarding_rules_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_global_addresses_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_global_forwarding_rules_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_global_network_endpoint_groups_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_global_operations_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_global_organization_operations_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_global_public_delegated_prefixes_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_health_checks_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_http_health_checks_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_https_health_checks_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_image_family_views_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_images_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_instance_group_managers_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_instance_groups_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_instance_templates_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_instances_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_interconnect_attachments_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_interconnect_locations_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_interconnects_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_license_codes_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_licenses_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_machine_images_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_machine_types_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_network_attachments_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_network_edge_security_services_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_network_endpoint_groups_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_network_firewall_policies_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_networks_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_node_groups_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_node_templates_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_node_types_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_packet_mirrorings_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_projects_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_public_advertised_prefixes_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_public_delegated_prefixes_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_region_autoscalers_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_region_backend_services_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_region_commitments_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_region_disk_types_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_region_disks_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_region_health_check_services_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_region_health_checks_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_region_instance_group_managers_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_region_instance_groups_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_region_instance_templates_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_region_instances_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_region_network_endpoint_groups_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_region_network_firewall_policies_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_region_notification_endpoints_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_region_operations_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_region_security_policies_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_region_ssl_certificates_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_ssl_policies_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_subnetworks_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_target_grpc_proxies_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_target_http_proxies_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_target_https_proxies_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_target_instances_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_target_pools_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_target_ssl_proxies_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_target_tcp_proxies_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_target_vpn_gateways_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_url_maps_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_vpn_gateways_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_vpn_tunnels_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_zone_operations_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], + "compute_zones_protos": ["compute_internal_protos", "cloud_extended_operations_protos", "protobuf::libprotobuf"], +} + +PROTO_COMPONENTS = { + "accessapproval_protos", + "accesscontextmanager_protos", + "advisorynotifications_protos", + "aiplatform_protos", + "alloydb_protos", + "api_annotations_protos", + "api_auth_protos", + "api_backend_protos", + "api_billing_protos", + "api_client_protos", + "api_config_change_protos", + "api_context_protos", + "api_control_protos", + "api_distribution_protos", + "api_documentation_protos", + "api_endpoint_protos", + "api_field_behavior_protos", + "api_http_protos", + "api_httpbody_protos", + "api_label_protos", + "api_launch_stage_protos", + "api_log_protos", + "api_logging_protos", + "api_metric_protos", + "api_monitored_resource_protos", + "api_monitoring_protos", + "api_policy_protos", + "api_quota_protos", + "api_resource_protos", + "api_routing_protos", + "api_service_protos", + "api_source_info_protos", + "api_system_parameter_protos", + "api_usage_protos", + "api_visibility_protos", + "apigateway_protos", + "apigeeconnect_protos", + "apikeys_protos", + "appengine_protos", + "artifactregistry_protos", + "asset_protos", + "assuredworkloads_protos", + "automl_protos", + "baremetalsolution_protos", + "batch_protos", + "beyondcorp_protos", + "bigquery_protos", + "bigtable_protos", + "billing_protos", + "binaryauthorization_protos", + "certificatemanager_protos", + "channel_protos", + "cloud_common_common_protos", + "cloud_extended_operations_protos", + "cloudbuild_protos", + "commerce_protos", + "composer_protos", + "compute_accelerator_types_protos", + "compute_addresses_protos", + "compute_autoscalers_protos", + "compute_backend_buckets_protos", + "compute_backend_services_protos", + "compute_disk_types_protos", + "compute_disks_protos", + "compute_external_vpn_gateways_protos", + "compute_firewall_policies_protos", + "compute_firewalls_protos", + "compute_forwarding_rules_protos", + "compute_global_addresses_protos", + "compute_global_forwarding_rules_protos", + "compute_global_network_endpoint_groups_protos", + "compute_global_operations_protos", + "compute_global_organization_operations_protos", + "compute_global_public_delegated_prefixes_protos", + "compute_health_checks_protos", + "compute_http_health_checks_protos", + "compute_https_health_checks_protos", + "compute_image_family_views_protos", + "compute_images_protos", + "compute_instance_group_managers_protos", + "compute_instance_groups_protos", + "compute_instance_templates_protos", + "compute_instances_protos", + "compute_interconnect_attachments_protos", + "compute_interconnect_locations_protos", + "compute_interconnects_protos", + "compute_internal_protos", + "compute_license_codes_protos", + "compute_licenses_protos", + "compute_machine_images_protos", + "compute_machine_types_protos", + "compute_network_attachments_protos", + "compute_network_edge_security_services_protos", + "compute_network_endpoint_groups_protos", + "compute_network_firewall_policies_protos", + "compute_networks_protos", + "compute_node_groups_protos", + "compute_node_templates_protos", + "compute_node_types_protos", + "compute_packet_mirrorings_protos", + "compute_projects_protos", + "compute_public_advertised_prefixes_protos", + "compute_public_delegated_prefixes_protos", + "compute_region_autoscalers_protos", + "compute_region_backend_services_protos", + "compute_region_commitments_protos", + "compute_region_disk_types_protos", + "compute_region_disks_protos", + "compute_region_health_check_services_protos", + "compute_region_health_checks_protos", + "compute_region_instance_group_managers_protos", + "compute_region_instance_groups_protos", + "compute_region_instance_templates_protos", + "compute_region_instances_protos", + "compute_region_network_endpoint_groups_protos", + "compute_region_network_firewall_policies_protos", + "compute_region_notification_endpoints_protos", + "compute_region_operations_protos", + "compute_region_security_policies_protos", + "compute_region_ssl_certificates_protos", + "compute_ssl_policies_protos", + "compute_subnetworks_protos", + "compute_target_grpc_proxies_protos", + "compute_target_http_proxies_protos", + "compute_target_https_proxies_protos", + "compute_target_instances_protos", + "compute_target_pools_protos", + "compute_target_ssl_proxies_protos", + "compute_target_tcp_proxies_protos", + "compute_target_vpn_gateways_protos", + "compute_url_maps_protos", + "compute_vpn_gateways_protos", + "compute_vpn_tunnels_protos", + "compute_zone_operations_protos", + "compute_zones_protos", + "confidentialcomputing_protos", + "config_protos", + "connectors_protos", + "contactcenterinsights_protos", + "container_protos", + "containeranalysis_protos", + "contentwarehouse_protos", + "datacatalog_protos", + "datafusion_protos", + "datamigration_protos", + "dataplex_protos", + "dataproc_protos", + "datastore_protos", + "datastream_protos", + "deploy_protos", + "devtools_source_v1_source_context_protos", + "dialogflow_cx_protos", + "dialogflow_es_protos", + "discoveryengine_protos", + "dlp_protos", + "documentai_protos", + "domains_protos", + "edgecontainer_protos", + "edgenetwork_protos", + "essentialcontacts_protos", + "eventarc_protos", + "filestore_protos", + "functions_protos", + "gkebackup_protos", + "gkehub_protos", + "gkemulticloud_protos", + "grafeas_protos", + "iam_credentials_v1_common_protos", + "iam_credentials_v1_iamcredentials_protos", + "iam_protos", + "iam_v1_iam_policy_protos", + "iam_v1_options_protos", + "iam_v1_policy_protos", + "iam_v2_protos", + "iap_protos", + "ids_protos", + "kms_protos", + "language_protos", + "logging_protos", + "logging_type_protos", + "logging_type_type_protos", + "longrunning_operations_protos", + "managedidentities_protos", + "memcache_protos", + "metastore_protos", + "migrationcenter_protos", + "monitoring_protos", + "netapp_protos", + "networkconnectivity_protos", + "networkmanagement_protos", + "networksecurity_protos", + "networkservices_protos", + "notebooks_protos", + "optimization_protos", + "orgpolicy_protos", + "osconfig_protos", + "oslogin_protos", + "policysimulator_protos", + "policytroubleshooter_protos", + "privateca_protos", + "profiler_protos", + "pubsub_protos", + "rapidmigrationassessment_protos", + "recaptchaenterprise_protos", + "recommender_protos", + "redis_protos", + "resourcemanager_protos", + "resourcesettings_protos", + "retail_protos", + "rpc_code_protos", + "rpc_context_attribute_context_protos", + "rpc_error_details_protos", + "rpc_status_protos", + "run_protos", + "scheduler_protos", + "secretmanager_protos", + "securesourcemanager_protos", + "securitycenter_protos", + "servicecontrol_protos", + "servicedirectory_protos", + "servicemanagement_protos", + "serviceusage_protos", + "shell_protos", + "spanner_protos", + "speech_protos", + "sql_protos", + "storage_protos", + "storageinsights_protos", + "storagetransfer_protos", + "support_protos", + "talent_protos", + "tasks_protos", + "telcoautomation_protos", + "texttospeech_protos", + "timeseriesinsights_protos", + "tpu_protos", + "trace_protos", + "translate_protos", + "type_calendar_period_protos", + "type_color_protos", + "type_date_protos", + "type_datetime_protos", + "type_dayofweek_protos", + "type_decimal_protos", + "type_expr_protos", + "type_interval_protos", + "type_latlng_protos", + "type_money_protos", + "type_postal_address_protos", + "type_timeofday_protos", + "video_protos", + "videointelligence_protos", + "vision_protos", + "vmmigration_protos", + "vmwareengine_protos", + "vpcaccess_protos", + "webrisk_protos", + "websecurityscanner_protos", + "workflows_protos", + "workstations_protos" +} + +COMPONENTS = { + "accessapproval", + "accesscontextmanager", + "advisorynotifications", + "aiplatform", + "alloydb", + "apigateway", + "apigeeconnect", + "apikeys", + "appengine", + "artifactregistry", + "asset", + "assuredworkloads", + "automl", + "baremetalsolution", + "batch", + "beyondcorp", + "bigquery", + "bigtable", + "billing", + "binaryauthorization", + "certificatemanager", + "channel", + "cloudbuild", + "commerce", + "composer", + "compute_accelerator_types", + "compute_addresses", + "compute_autoscalers", + "compute_backend_buckets", + "compute_backend_services", + "compute_disk_types", + "compute_disks", + "compute_external_vpn_gateways", + "compute_firewall_policies", + "compute_firewalls", + "compute_forwarding_rules", + "compute_global_addresses", + "compute_global_forwarding_rules", + "compute_global_network_endpoint_groups", + "compute_global_operations", + "compute_global_organization_operations", + "compute_global_public_delegated_prefixes", + "compute_health_checks", + "compute_http_health_checks", + "compute_https_health_checks", + "compute_image_family_views", + "compute_images", + "compute_instance_group_managers", + "compute_instance_groups", + "compute_instance_templates", + "compute_instances", + "compute_interconnect_attachments", + "compute_interconnect_locations", + "compute_interconnects", + "compute_license_codes", + "compute_licenses", + "compute_machine_images", + "compute_machine_types", + "compute_network_attachments", + "compute_network_edge_security_services", + "compute_network_endpoint_groups", + "compute_network_firewall_policies", + "compute_networks", + "compute_node_groups", + "compute_node_templates", + "compute_node_types", + "compute_packet_mirrorings", + "compute_projects", + "compute_public_advertised_prefixes", + "compute_public_delegated_prefixes", + "compute_region_autoscalers", + "compute_region_backend_services", + "compute_region_commitments", + "compute_region_disk_types", + "compute_region_disks", + "compute_region_health_check_services", + "compute_region_health_checks", + "compute_region_instance_group_managers", + "compute_region_instance_groups", + "compute_region_instance_templates", + "compute_region_instances", + "compute_region_network_endpoint_groups", + "compute_region_network_firewall_policies", + "compute_region_notification_endpoints", + "compute_region_operations", + "compute_region_security_policies", + "compute_region_ssl_certificates", + "compute_ssl_policies", + "compute_subnetworks", + "compute_target_grpc_proxies", + "compute_target_http_proxies", + "compute_target_https_proxies", + "compute_target_instances", + "compute_target_pools", + "compute_target_ssl_proxies", + "compute_target_tcp_proxies", + "compute_target_vpn_gateways", + "compute_url_maps", + "compute_vpn_gateways", + "compute_vpn_tunnels", + "compute_zone_operations", + "compute_zones", + "confidentialcomputing", + "config", + "connectors", + "contactcenterinsights", + "container", + "containeranalysis", + "contentwarehouse", + "datacatalog", + "datafusion", + "datamigration", + "dataplex", + "dataproc", + "datastore", + "datastream", + "deploy", + "dialogflow_cx", + "dialogflow_es", + "discoveryengine", + "dlp", + "documentai", + "domains", + "edgecontainer", + "edgenetwork", + "essentialcontacts", + "eventarc", + "filestore", + "functions", + "gkebackup", + "gkehub", + "gkemulticloud", + "iam", + "iap", + "ids", + "kms", + "language", + "logging", + "managedidentities", + "memcache", + "metastore", + "migrationcenter", + "monitoring", + "netapp", + "networkconnectivity", + "networkmanagement", + "networksecurity", + "networkservices", + "notebooks", + "oauth2", + "optimization", + "orgpolicy", + "osconfig", + "oslogin", + "policysimulator", + "policytroubleshooter", + "privateca", + "profiler", + "pubsub", + "rapidmigrationassessment", + "recaptchaenterprise", + "recommender", + "redis", + "resourcemanager", + "resourcesettings", + "retail", + "run", + "scheduler", + "secretmanager", + "securesourcemanager", + "securitycenter", + "servicecontrol", + "servicedirectory", + "servicemanagement", + "serviceusage", + "shell", + "spanner", + "speech", + "sql", + "storage", + "storageinsights", + "storagetransfer", + "support", + "talent", + "tasks", + "telcoautomation", + "texttospeech", + "timeseriesinsights", + "tpu", + "trace", + "translate", + "video", + "videointelligence", + "vision", + "vmmigration", + "vmwareengine", + "vpcaccess", + "webrisk", + "websecurityscanner", + "workflows", + "workstations" +} diff --git a/recipes/google-cloud-cpp/2.x/components_2_28_0.py b/recipes/google-cloud-cpp/2.x/components_2_28_0.py new file mode 100644 index 0000000000000..dafa862192730 --- /dev/null +++ b/recipes/google-cloud-cpp/2.x/components_2_28_0.py @@ -0,0 +1,573 @@ +# Automatically generated by /usr/local/google/home/dbolduc/code/git/conan-center-index/recipes/google-cloud-cpp/2.x/extract_dependencies.py DO NOT EDIT +DEPENDENCIES = { + "accessapproval_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf'], + "accesscontextmanager_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_expr_protos'], + "advisorynotifications_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf'], + "aiplatform_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_httpbody_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_date_protos', 'type_interval_protos', 'type_money_protos'], + "alloydb_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_dayofweek_protos', 'type_timeofday_protos'], + "apigateway_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "apigeeconnect_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf', 'rpc_status_protos'], + "apikeys_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "appengine_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'logging_type_protos', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "apphub_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_field_info_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "artifactregistry_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_expr_protos'], + "asset_protos": ['accesscontextmanager_protos', 'api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'longrunning_operations_protos', 'osconfig_protos', 'protobuf::libprotobuf', 'rpc_code_protos', 'rpc_status_protos', 'type_date_protos', 'type_datetime_protos', 'type_dayofweek_protos', 'type_expr_protos', 'type_timeofday_protos'], + "assuredworkloads_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "automl_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "backupdr_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "baremetalsolution_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "batch_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_field_info_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "beyondcorp_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "bigquery_protos": ['api_annotations_protos', 'api_client_protos', 'api_distribution_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_label_protos', 'api_launch_stage_protos', 'api_metric_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_error_details_protos', 'rpc_status_protos', 'type_expr_protos'], + "bigtable_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'api_routing_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_date_protos', 'type_expr_protos'], + "billing_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'protobuf::libprotobuf', 'type_date_protos', 'type_expr_protos', 'type_money_protos'], + "binaryauthorization_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grafeas_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf', 'rpc_status_protos'], + "certificatemanager_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "channel_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_date_protos', 'type_datetime_protos', 'type_decimal_protos', 'type_money_protos', 'type_postal_address_protos'], + "cloudbuild_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_httpbody_protos', 'api_launch_stage_protos', 'api_resource_protos', 'api_routing_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "cloudcontrolspartner_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf', 'type_interval_protos'], + "cloudquotas_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf'], + "commerce_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "cloud_common_common_protos": ['api_field_behavior_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf'], + "composer_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_date_protos'], + "confidentialcomputing_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf', 'rpc_status_protos'], + "config_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_field_info_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "connectors_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "contactcenterinsights_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "container_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf', 'rpc_code_protos', 'rpc_status_protos'], + "containeranalysis_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grafeas_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_expr_protos'], + "contentwarehouse_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'documentai_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_policy_protos', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_color_protos', 'type_date_protos', 'type_datetime_protos', 'type_expr_protos', 'type_interval_protos', 'type_money_protos', 'type_postal_address_protos'], + "datacatalog_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_expr_protos'], + "datafusion_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "datamigration_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_expr_protos'], + "dataplex_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_expr_protos'], + "dataproc_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_interval_protos'], + "datastore_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_routing_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_latlng_protos'], + "datastream_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "deploy_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_date_protos'], + "developerconnect_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_field_info_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "dialogflow_cx_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_latlng_protos'], + "dialogflow_es_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_latlng_protos'], + "discoveryengine_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_httpbody_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_date_protos'], + "dlp_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_date_protos', 'type_dayofweek_protos', 'type_timeofday_protos'], + "documentai_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_color_protos', 'type_date_protos', 'type_datetime_protos', 'type_money_protos', 'type_postal_address_protos'], + "domains_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_money_protos', 'type_postal_address_protos'], + "edgecontainer_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "edgenetwork_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "essentialcontacts_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf'], + "eventarc_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_code_protos', 'rpc_status_protos'], + "filestore_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'cloud_common_common_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "functions_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_expr_protos'], + "gkebackup_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_date_protos', 'type_dayofweek_protos', 'type_timeofday_protos'], + "gkehub_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "gkemulticloud_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_date_protos'], + "grafeas_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf', 'rpc_status_protos'], + "iam_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'protobuf::libprotobuf', 'type_expr_protos'], + "iam_v2_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_expr_protos'], + "iap_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'protobuf::libprotobuf', 'type_expr_protos'], + "ids_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "kms_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "language_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf'], + "logging_protos": ['api_annotations_protos', 'api_client_protos', 'api_distribution_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_label_protos', 'api_launch_stage_protos', 'api_metric_protos', 'api_monitored_resource_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'logging_type_protos', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "logging_type_protos": ['grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf'], + "managedidentities_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "managedkafka_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_field_info_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "memcache_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_dayofweek_protos', 'type_timeofday_protos'], + "metastore_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_dayofweek_protos'], + "migrationcenter_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_date_protos', 'type_money_protos'], + "monitoring_protos": ['api_annotations_protos', 'api_client_protos', 'api_distribution_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_label_protos', 'api_launch_stage_protos', 'api_metric_protos', 'api_monitored_resource_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_calendar_period_protos', 'type_interval_protos'], + "netapp_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "networkconnectivity_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "networkmanagement_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_field_info_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "networksecurity_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "networkservices_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_field_info_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "notebooks_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "optimization_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_latlng_protos'], + "orgpolicy_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf', 'type_expr_protos'], + "osconfig_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_date_protos', 'type_datetime_protos', 'type_dayofweek_protos', 'type_timeofday_protos'], + "oslogin_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf'], + "policysimulator_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_policy_protos', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_date_protos', 'type_expr_protos'], + "policytroubleshooter_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_policy_protos', 'iam_v2_protos', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_expr_protos'], + "privateca_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_expr_protos'], + "privilegedaccessmanager_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "profiler_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf'], + "publicca_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf'], + "pubsub_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf'], + "rapidmigrationassessment_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "recaptchaenterprise_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_field_info_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf', 'rpc_status_protos'], + "recommender_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf', 'type_money_protos'], + "redis_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_dayofweek_protos', 'type_timeofday_protos'], + "resourcemanager_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_expr_protos'], + "resourcesettings_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf'], + "retail_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_httpbody_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_date_protos'], + "run_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'api_routing_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_expr_protos'], + "scheduler_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf', 'rpc_status_protos'], + "secretmanager_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'protobuf::libprotobuf', 'type_expr_protos'], + "securesourcemanager_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_expr_protos'], + "securitycenter_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'api_routing_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_expr_protos'], + "securitycentermanagement_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_policy_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_expr_protos'], + "servicecontrol_protos": ['api_annotations_protos', 'api_client_protos', 'api_distribution_protos', 'api_http_protos', 'api_launch_stage_protos', 'grpc::_grpc', 'grpc::grpc++', 'logging_type_protos', 'protobuf::libprotobuf', 'rpc_context_attribute_context_protos', 'rpc_status_protos'], + "servicedirectory_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'protobuf::libprotobuf', 'type_expr_protos'], + "servicehealth_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf'], + "servicemanagement_protos": ['api_annotations_protos', 'api_auth_protos', 'api_backend_protos', 'api_billing_protos', 'api_client_protos', 'api_config_change_protos', 'api_context_protos', 'api_control_protos', 'api_documentation_protos', 'api_endpoint_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_label_protos', 'api_launch_stage_protos', 'api_log_protos', 'api_logging_protos', 'api_metric_protos', 'api_monitored_resource_protos', 'api_monitoring_protos', 'api_policy_protos', 'api_quota_protos', 'api_resource_protos', 'api_service_protos', 'api_source_info_protos', 'api_system_parameter_protos', 'api_usage_protos', 'api_visibility_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "serviceusage_protos": ['api_annotations_protos', 'api_auth_protos', 'api_client_protos', 'api_documentation_protos', 'api_endpoint_protos', 'api_http_protos', 'api_label_protos', 'api_launch_stage_protos', 'api_monitored_resource_protos', 'api_monitoring_protos', 'api_quota_protos', 'api_resource_protos', 'api_usage_protos', 'api_visibility_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "shell_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "spanner_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_expr_protos'], + "speech_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_field_info_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "sql_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "storage_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'api_routing_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'protobuf::libprotobuf', 'type_date_protos', 'type_expr_protos'], + "storagecontrol_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_field_info_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'api_routing_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "storageinsights_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_date_protos', 'type_datetime_protos'], + "storagetransfer_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_code_protos', 'rpc_status_protos', 'type_date_protos', 'type_timeofday_protos'], + "support_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "talent_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_latlng_protos', 'type_money_protos', 'type_postal_address_protos', 'type_timeofday_protos'], + "tasks_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_iam_policy_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_expr_protos'], + "telcoautomation_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "texttospeech_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "timeseriesinsights_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf', 'rpc_status_protos'], + "tpu_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "trace_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf', 'rpc_status_protos'], + "translate_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'iam_v1_policy_protos', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_expr_protos'], + "video_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_field_info_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_datetime_protos'], + "videointelligence_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "vision_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos', 'type_color_protos', 'type_latlng_protos'], + "vmmigration_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_error_details_protos', 'rpc_status_protos'], + "vmwareengine_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_field_info_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "vpcaccess_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "webrisk_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "websecurityscanner_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'protobuf::libprotobuf'], + "workflows_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "workstations_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_http_protos', 'api_launch_stage_protos', 'api_resource_protos', 'grpc::_grpc', 'grpc::grpc++', 'longrunning_operations_protos', 'protobuf::libprotobuf', 'rpc_status_protos'], + "api_annotations_protos": ['api_http_protos'], + "api_auth_protos": ['api_annotations_protos'], + "api_billing_protos": ['api_annotations_protos', 'api_metric_protos'], + "api_client_protos": ['api_launch_stage_protos'], + "api_distribution_protos": ['api_annotations_protos'], + "api_endpoint_protos": ['api_annotations_protos'], + "api_log_protos": ['api_label_protos'], + "api_logging_protos": ['api_annotations_protos', 'api_label_protos'], + "api_metric_protos": ['api_label_protos', 'api_launch_stage_protos'], + "api_monitored_resource_protos": ['api_label_protos', 'api_launch_stage_protos'], + "api_monitoring_protos": ['api_annotations_protos'], + "api_quota_protos": ['api_annotations_protos'], + "api_service_protos": ['api_annotations_protos', 'api_auth_protos', 'api_backend_protos', 'api_billing_protos', 'api_client_protos', 'api_context_protos', 'api_control_protos', 'api_documentation_protos', 'api_endpoint_protos', 'api_http_protos', 'api_label_protos', 'api_log_protos', 'api_logging_protos', 'api_metric_protos', 'api_monitored_resource_protos', 'api_monitoring_protos', 'api_quota_protos', 'api_resource_protos', 'api_source_info_protos', 'api_system_parameter_protos', 'api_usage_protos'], + "api_usage_protos": ['api_annotations_protos', 'api_visibility_protos'], + "iam_credentials_v1_common_protos": ['api_field_behavior_protos', 'api_resource_protos'], + "iam_credentials_v1_iamcredentials_protos": ['api_annotations_protos', 'api_client_protos', 'iam_credentials_v1_common_protos'], + "iam_v1_iam_policy_protos": ['api_annotations_protos', 'api_client_protos', 'api_field_behavior_protos', 'api_resource_protos', 'iam_v1_options_protos', 'iam_v1_policy_protos'], + "iam_v1_options_protos": ['api_annotations_protos'], + "iam_v1_policy_protos": ['api_annotations_protos', 'type_expr_protos'], + "cloud_extended_operations_protos": ["protobuf::libprotobuf"], + "compute_protos": ["cloud_extended_operations_protos", "protobuf::libprotobuf"], +} + +PROTO_COMPONENTS = { + "accessapproval_protos", + "accesscontextmanager_protos", + "advisorynotifications_protos", + "aiplatform_protos", + "alloydb_protos", + "api_annotations_protos", + "api_auth_protos", + "api_backend_protos", + "api_billing_protos", + "api_client_protos", + "api_config_change_protos", + "api_context_protos", + "api_control_protos", + "api_distribution_protos", + "api_documentation_protos", + "api_endpoint_protos", + "api_field_behavior_protos", + "api_field_info_protos", + "api_http_protos", + "api_httpbody_protos", + "api_label_protos", + "api_launch_stage_protos", + "api_log_protos", + "api_logging_protos", + "api_metric_protos", + "api_monitored_resource_protos", + "api_monitoring_protos", + "api_policy_protos", + "api_quota_protos", + "api_resource_protos", + "api_routing_protos", + "api_service_protos", + "api_source_info_protos", + "api_system_parameter_protos", + "api_usage_protos", + "api_visibility_protos", + "apigateway_protos", + "apigeeconnect_protos", + "apikeys_protos", + "appengine_protos", + "apphub_protos", + "artifactregistry_protos", + "asset_protos", + "assuredworkloads_protos", + "automl_protos", + "backupdr_protos", + "baremetalsolution_protos", + "batch_protos", + "beyondcorp_protos", + "bigquery_protos", + "bigtable_protos", + "billing_protos", + "binaryauthorization_protos", + "certificatemanager_protos", + "channel_protos", + "cloud_common_common_protos", + "cloud_extended_operations_protos", + "cloudbuild_protos", + "cloudcontrolspartner_protos", + "cloudquotas_protos", + "commerce_protos", + "composer_protos", + "compute_protos", + "confidentialcomputing_protos", + "config_protos", + "connectors_protos", + "contactcenterinsights_protos", + "container_protos", + "containeranalysis_protos", + "contentwarehouse_protos", + "datacatalog_protos", + "datafusion_protos", + "datamigration_protos", + "dataplex_protos", + "dataproc_protos", + "datastore_protos", + "datastream_protos", + "deploy_protos", + "developerconnect_protos", + "dialogflow_cx_protos", + "dialogflow_es_protos", + "discoveryengine_protos", + "dlp_protos", + "documentai_protos", + "domains_protos", + "edgecontainer_protos", + "edgenetwork_protos", + "essentialcontacts_protos", + "eventarc_protos", + "filestore_protos", + "functions_protos", + "gkebackup_protos", + "gkehub_protos", + "gkemulticloud_protos", + "grafeas_protos", + "iam_credentials_v1_common_protos", + "iam_credentials_v1_iamcredentials_protos", + "iam_protos", + "iam_v1_iam_policy_protos", + "iam_v1_options_protos", + "iam_v1_policy_protos", + "iam_v2_protos", + "iap_protos", + "ids_protos", + "kms_protos", + "language_protos", + "logging_protos", + "logging_type_protos", + "longrunning_operations_protos", + "managedidentities_protos", + "managedkafka_protos", + "memcache_protos", + "metastore_protos", + "migrationcenter_protos", + "monitoring_protos", + "netapp_protos", + "networkconnectivity_protos", + "networkmanagement_protos", + "networksecurity_protos", + "networkservices_protos", + "notebooks_protos", + "optimization_protos", + "orgpolicy_protos", + "osconfig_protos", + "oslogin_protos", + "policysimulator_protos", + "policytroubleshooter_protos", + "privateca_protos", + "privilegedaccessmanager_protos", + "profiler_protos", + "publicca_protos", + "pubsub_protos", + "rapidmigrationassessment_protos", + "recaptchaenterprise_protos", + "recommender_protos", + "redis_protos", + "resourcemanager_protos", + "resourcesettings_protos", + "retail_protos", + "rpc_code_protos", + "rpc_context_attribute_context_protos", + "rpc_error_details_protos", + "rpc_status_protos", + "run_protos", + "scheduler_protos", + "secretmanager_protos", + "securesourcemanager_protos", + "securitycenter_protos", + "securitycentermanagement_protos", + "servicecontrol_protos", + "servicedirectory_protos", + "servicehealth_protos", + "servicemanagement_protos", + "serviceusage_protos", + "shell_protos", + "spanner_protos", + "speech_protos", + "sql_protos", + "storage_protos", + "storagecontrol_protos", + "storageinsights_protos", + "storagetransfer_protos", + "support_protos", + "talent_protos", + "tasks_protos", + "telcoautomation_protos", + "texttospeech_protos", + "timeseriesinsights_protos", + "tpu_protos", + "trace_protos", + "translate_protos", + "type_calendar_period_protos", + "type_color_protos", + "type_date_protos", + "type_datetime_protos", + "type_dayofweek_protos", + "type_decimal_protos", + "type_expr_protos", + "type_interval_protos", + "type_latlng_protos", + "type_money_protos", + "type_postal_address_protos", + "type_timeofday_protos", + "video_protos", + "videointelligence_protos", + "vision_protos", + "vmmigration_protos", + "vmwareengine_protos", + "vpcaccess_protos", + "webrisk_protos", + "websecurityscanner_protos", + "workflows_protos", + "workstations_protos" +} + +COMPONENTS = { + "accessapproval", + "accesscontextmanager", + "advisorynotifications", + "aiplatform", + "alloydb", + "apigateway", + "apigeeconnect", + "apikeys", + "appengine", + "apphub", + "artifactregistry", + "asset", + "assuredworkloads", + "automl", + "backupdr", + "baremetalsolution", + "batch", + "beyondcorp", + "bigquery", + "bigtable", + "billing", + "binaryauthorization", + "certificatemanager", + "channel", + "cloudbuild", + "cloudcontrolspartner", + "cloudquotas", + "commerce", + "composer", + "compute_accelerator_types", + "compute_addresses", + "compute_autoscalers", + "compute_backend_buckets", + "compute_backend_services", + "compute_disk_types", + "compute_disks", + "compute_external_vpn_gateways", + "compute_firewall_policies", + "compute_firewalls", + "compute_forwarding_rules", + "compute_global_addresses", + "compute_global_forwarding_rules", + "compute_global_network_endpoint_groups", + "compute_global_operations", + "compute_global_organization_operations", + "compute_global_public_delegated_prefixes", + "compute_health_checks", + "compute_http_health_checks", + "compute_https_health_checks", + "compute_image_family_views", + "compute_images", + "compute_instance_group_managers", + "compute_instance_groups", + "compute_instance_templates", + "compute_instances", + "compute_interconnect_attachments", + "compute_interconnect_locations", + "compute_interconnects", + "compute_license_codes", + "compute_licenses", + "compute_machine_images", + "compute_machine_types", + "compute_network_attachments", + "compute_network_edge_security_services", + "compute_network_endpoint_groups", + "compute_network_firewall_policies", + "compute_networks", + "compute_node_groups", + "compute_node_templates", + "compute_node_types", + "compute_packet_mirrorings", + "compute_projects", + "compute_public_advertised_prefixes", + "compute_public_delegated_prefixes", + "compute_region_autoscalers", + "compute_region_backend_services", + "compute_region_commitments", + "compute_region_disk_types", + "compute_region_disks", + "compute_region_health_check_services", + "compute_region_health_checks", + "compute_region_instance_group_managers", + "compute_region_instance_groups", + "compute_region_instance_templates", + "compute_region_instances", + "compute_region_network_endpoint_groups", + "compute_region_network_firewall_policies", + "compute_region_notification_endpoints", + "compute_region_operations", + "compute_region_security_policies", + "compute_region_ssl_certificates", + "compute_ssl_policies", + "compute_subnetworks", + "compute_target_grpc_proxies", + "compute_target_http_proxies", + "compute_target_https_proxies", + "compute_target_instances", + "compute_target_pools", + "compute_target_ssl_proxies", + "compute_target_tcp_proxies", + "compute_target_vpn_gateways", + "compute_url_maps", + "compute_vpn_gateways", + "compute_vpn_tunnels", + "compute_zone_operations", + "compute_zones", + "confidentialcomputing", + "config", + "connectors", + "contactcenterinsights", + "container", + "containeranalysis", + "contentwarehouse", + "datacatalog", + "datafusion", + "datamigration", + "dataplex", + "dataproc", + "datastore", + "datastream", + "deploy", + "developerconnect", + "dialogflow_cx", + "dialogflow_es", + "discoveryengine", + "dlp", + "documentai", + "domains", + "edgecontainer", + "edgenetwork", + "essentialcontacts", + "eventarc", + "filestore", + "functions", + "gkebackup", + "gkehub", + "gkemulticloud", + "iam", + "iap", + "ids", + "kms", + "language", + "logging", + "managedidentities", + "managedkafka", + "memcache", + "metastore", + "migrationcenter", + "monitoring", + "netapp", + "networkconnectivity", + "networkmanagement", + "networksecurity", + "networkservices", + "notebooks", + "oauth2", + "optimization", + "orgpolicy", + "osconfig", + "oslogin", + "policysimulator", + "policytroubleshooter", + "privateca", + "privilegedaccessmanager", + "profiler", + "publicca", + "pubsub", + "rapidmigrationassessment", + "recaptchaenterprise", + "recommender", + "redis", + "resourcemanager", + "resourcesettings", + "retail", + "run", + "scheduler", + "secretmanager", + "securesourcemanager", + "securitycenter", + "securitycentermanagement", + "servicecontrol", + "servicedirectory", + "servicehealth", + "servicemanagement", + "serviceusage", + "shell", + "spanner", + "speech", + "sql", + "storage", + "storagecontrol", + "storageinsights", + "storagetransfer", + "support", + "talent", + "tasks", + "telcoautomation", + "texttospeech", + "timeseriesinsights", + "tpu", + "trace", + "translate", + "video", + "videointelligence", + "vision", + "vmmigration", + "vmwareengine", + "vpcaccess", + "webrisk", + "websecurityscanner", + "workflows", + "workstations" +} diff --git a/recipes/google-cloud-cpp/2.x/conandata.yml b/recipes/google-cloud-cpp/2.x/conandata.yml new file mode 100644 index 0000000000000..65a9e8f5f8351 --- /dev/null +++ b/recipes/google-cloud-cpp/2.x/conandata.yml @@ -0,0 +1,26 @@ +sources: + "2.15.1": + url: "https://github.com/googleapis/google-cloud-cpp/archive/refs/tags/v2.15.1.tar.gz" + sha256: "47a5c6beff48625fa1b65b1ddc575247def80c88d29062c66d463172280d3959" + "2.19.0": + url: "https://github.com/googleapis/google-cloud-cpp/archive/refs/tags/v2.19.0.tar.gz" + sha256: "63f009092afd900cb812050bcecf607e37d762ac911e0bcbf4af9a432da91890" + "2.28.0": + url: "https://github.com/googleapis/google-cloud-cpp/archive/refs/tags/v2.28.0.tar.gz" + sha256: "1d51910cb4419f6100d8b9df6bccd33477d09f50e378f12b06dae0f137ed7bc6" +patches: + "2.15.1": + - patch_file: "patches/2.15.1/001-use-conan-msvc-runtime.patch" + patch_description: "Let Conan select the MSVC runtime" + patch_type: conan + "2.19.0": + - patch_file: "patches/2.19.0/001-use-conan-msvc-runtime.patch" + patch_description: "Let Conan select the MSVC runtime" + patch_type: conan + - patch_file: "patches/2.19.0/002-add-find-package-threads.patch" + patch_description: "Missing find_package() in CMake files" + patch_type: conan + "2.28.0": + - patch_file: "patches/2.28.0/001-add-find-package-threads.patch" + patch_description: "Missing find_package() in CMake files" + patch_type: conan diff --git a/recipes/google-cloud-cpp/2.x/conanfile.py b/recipes/google-cloud-cpp/2.x/conanfile.py new file mode 100644 index 0000000000000..bf23faefd5366 --- /dev/null +++ b/recipes/google-cloud-cpp/2.x/conanfile.py @@ -0,0 +1,360 @@ +import os + +from conan import ConanFile +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, copy, export_conandata_patches, get, replace_in_file, rmdir +from conan.tools.microsoft import check_min_vs, is_msvc +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration + +# Load the generated component dependency information. +# +# `google-cloud-cpp` has well over 200 components. Conan cannot use the CMake +# files generated by `google-cloud-cpp`. Manually maintaining this dependency +# information is error prone and fairly tedious. A helper script in this +# directory reproduces the algorithms used by `google-cloud-cpp` to generate its +# dependency information. With each new revision of `google-cloud-cpp` the +# script will be used to generate a new file with the component dependency +# information. The expectation is that maintaining this script will be easier +# than writing long lists of dependencies by hand. +import components_2_15_1 +import components_2_19_0 +import components_2_28_0 + +required_conan_version = ">=1.56.0" + + +class GoogleCloudCppConan(ConanFile): + name = "google-cloud-cpp" + description = "C++ Client Libraries for Google Cloud Services" + license = "Apache-2.0" + topics = ( + "google", + "cloud", + "google-cloud-storage", + "google-cloud-platform", + "google-cloud-pubsub", + "google-cloud-spanner", + "google-cloud-bigtable", + ) + homepage = "https://github.com/googleapis/google-cloud-cpp" + 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} + exports = ["components_2_15_1.py", + "components_2_19_0.py", + "components_2_28_0.py", + ] + + short_paths = True + + _GA_COMPONENTS = { + '2.15.1': components_2_15_1.COMPONENTS, + '2.19.0': components_2_19_0.COMPONENTS, + '2.28.0': components_2_28_0.COMPONENTS, + } + _PROTO_COMPONENTS = { + '2.15.1': components_2_15_1.PROTO_COMPONENTS, + '2.19.0': components_2_19_0.PROTO_COMPONENTS, + '2.28.0': components_2_28_0.PROTO_COMPONENTS, + } + _PROTO_COMPONENT_DEPENDENCIES = { + "2.15.1": components_2_15_1.DEPENDENCIES, + "2.19.0": components_2_19_0.DEPENDENCIES, + "2.28.0": components_2_28_0.DEPENDENCIES, + } + # Some components require custom dependency definitions. + _REQUIRES_CUSTOM_DEPENDENCIES = { + "bigquery", "bigtable", "iam", "oauth2", "pubsub", "spanner", "storage", + } + + @property + def _is_legacy_one_profile(self): + return not hasattr(self, "settings_build") + + 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["protobuf"].shared = True + self.options["grpc"].shared = True + + def validate(self): + # As-of 2022-03, google-cloud-cpp only supports "Visual Studio >= 2019", + # and Visual Studio < 2019 is out of mainline support. + # The wikipedia page says this maps to 192* for the MSVC version: + # https://en.wikipedia.org/wiki/Microsoft_Visual_C%2B%2B + check_min_vs(self, "192") + if is_msvc(self) and self.info.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} shared not supported by Visual Studio") + + if hasattr(self, "settings_build") and cross_building(self): + raise ConanInvalidConfiguration( + "Recipe not prepared for cross-building (yet)" + ) + + if str(self.version) not in self._GA_COMPONENTS: + print(f"{type(self.version)} {self.version}") + raise ConanInvalidConfiguration( + f"The components are unknown for version {self.version}. Expected one of {self._GA_COMPONENTS.keys()}" + ) + + if str(self.version) not in self._PROTO_COMPONENTS: + raise ConanInvalidConfiguration( + f"The proto components are unknown for version {self.version}. Expected one of {self._PROTO_COMPONENTS.keys()}" + ) + + if str(self.version) not in self._PROTO_COMPONENT_DEPENDENCIES: + raise ConanInvalidConfiguration( + f"The inter-component components are unknown for version {self.version}. Expected one of {self._PROTO_COMPONENT_DEPENDENCIES.keys()}" + ) + + if ( + self.settings.compiler == "clang" + and Version(self.settings.compiler.version) < "6.0" + ): + raise ConanInvalidConfiguration("Clang version must be at least 6.0.") + + if self.settings.compiler.cppstd: + check_min_cppstd(self, 14) + + if ( + self.settings.compiler == "gcc" + and Version(self.settings.compiler.version) < "5.4" + ): + raise ConanInvalidConfiguration("Building requires GCC >= 5.4") + + if self.info.options.shared and \ + (not self.dependencies["protobuf"].options.shared or \ + not self.dependencies["grpc"].options.shared): + raise ConanInvalidConfiguration( + "If built as shared, protobuf, and grpc must be shared as well." + " Please, use `protobuf/*:shared=True`, and `grpc/*:shared=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) + + def requirements(self): + # These must remain pinned in conan index. + self.requires("protobuf/3.21.12", transitive_headers=True) + self.requires("abseil/[>=20230125.3 <=20230802.1]", transitive_headers=True) + self.requires("grpc/1.54.3", transitive_headers=True) + self.requires("nlohmann_json/3.11.3") + self.requires("crc32c/1.1.2") + # The rest require less pinning. + self.requires("libcurl/[>=7.78 <9]") + self.requires("openssl/[>=1.1 <4]") + self.requires("zlib/[>=1.2.11 <2]") + + def build_requirements(self): + # For the `grpc-cpp-plugin` executable, and indirectly `protoc` + if not self._is_legacy_one_profile: + self.tool_requires("grpc/") + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTING"] = False + tc.variables["GOOGLE_CLOUD_CPP_WITH_MOCKS"] = False + tc.variables["GOOGLE_CLOUD_CPP_ENABLE_MACOS_OPENSSL_CHECK"] = False + tc.variables["GOOGLE_CLOUD_CPP_ENABLE_WERROR"] = False + tc.variables["GOOGLE_CLOUD_CPP_ENABLE"] = ",".join(self._components()) + tc.generate() + VirtualBuildEnv(self).generate() + if self._is_legacy_one_profile: + VirtualRunEnv(self).generate(scope="build") + deps = CMakeDeps(self) + deps.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + # This was informed by comments in the grpc port. On macOS `Make` will + # run commands via `/bin/sh`. `/bin/sh` is subject to System Integrity + # Protections. In particular, the system will purge the DYLD_LIBRARY_PATH + # enviroment variables: + # https://developer.apple.com/library/archive/documentation/Security/Conceptual/System_Integrity_Protection_Guide/RuntimeProtections/RuntimeProtections.html + settings_build = getattr(self, "settings_build", self.settings) + if settings_build.os == "Macos": + replace_in_file(self, os.path.join(self.source_folder, "cmake/CompileProtos.cmake"), + "${Protobuf_PROTOC_EXECUTABLE} ARGS", + '${CMAKE_COMMAND} -E env "DYLD_LIBRARY_PATH=$ENV{DYLD_LIBRARY_PATH}" ${Protobuf_PROTOC_EXECUTABLE} ARGS') + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() + cmake.build() + + def _generate_proto_requires(self, component): + deps = self._PROTO_COMPONENT_DEPENDENCIES.get(self.version, dict()) + return deps.get(component, []) + + _SKIPPED_COMPONENTS = { + # Some protos do not compile due to inconvenient system macros clashing + # with proto enum values. Protobuf can workaround these problems, but + # the current version in Conan index (protobuf/3.21.4) do not contain + # the fixes for these cases. + # TODO - review after protobuf >= 4.23.x + 'asset', + 'channel', + 'storagetransfer', + } + + def _components(self): + result = self._GA_COMPONENTS.get(str(self.version), []).copy() + for c in self._SKIPPED_COMPONENTS: + result.remove(c) + # TODO - these do not build on Android due to conflicts between OS + # macros and Proto enums. Revisit after Protobuf >= 4.23.x + if self.settings.os == "Android": + result.remove('accesscontextmanager') + result.remove('talent') + if self.settings.os == "Windows" and Version(self.version) >= '2.28.0': + result.remove('securitycenter') + return result + + def _proto_components(self): + result = self._PROTO_COMPONENTS.get(self.version, []).copy() + for c in self._SKIPPED_COMPONENTS: + result.remove(c + '_protos') + # TODO - these do not build on Android due to conflicts between OS + # macros and Proto enums. Revisit after Protobuf >= 4.23.x + if self.settings.os == "Android": + result.remove('accesscontextmanager_protos') + result.remove('talent_protos') + if Version(self.version) <= '2.19.0': + # Handling of these proto libraries was simplified in the 2.28.0 + # `conanfile.py`. We prefer not to regenerate the old + # `components_*.py` files, so we manually skip the protos in here. + result.remove('logging_type_type_protos') + result.remove('devtools_source_v1_source_context_protos') + if self.settings.os == "Windows" and Version(self.version) >= '2.28.0': + result.remove('securitycenter_protos') + return result + + 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, path=os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, path=os.path.join(self.package_folder, "lib", "pkgconfig")) + + def _add_proto_component(self, component): + self.cpp_info.components[component].requires = self._generate_proto_requires(component) + self.cpp_info.components[component].libs = [f"google_cloud_cpp_{component}"] + self.cpp_info.components[component].names["pkg_config"] = f"google_cloud_cpp_{component}" + + def _add_grpc_component(self, component, protos, extra=None): + SHARED_REQUIRES=["grpc_utils", "common", "grpc::grpc++", "grpc::_grpc", "protobuf::libprotobuf", "abseil::absl_memory"] + self.cpp_info.components[component].requires = (extra or []) + [protos] + SHARED_REQUIRES + self.cpp_info.components[component].libs = [f"google_cloud_cpp_{component}"] + self.cpp_info.components[component].names["pkg_config"] = f"google_cloud_cpp_{component}" + + # The compute librar(ies) do not use gRPC, and they have many components + # with dependencies between them + def _add_compute_component(self, component, protos): + SHARED_REQUIRES=["rest_protobuf_internal", "rest_internal", "common"] + # Common components shared by other compute components + COMPUTE_COMMON_COMPONENTS = [ + 'compute_global_operations', + 'compute_global_organization_operations', + 'compute_region_operations', + 'compute_zone_operations', + ] + requires = [protos] + if component not in COMPUTE_COMMON_COMPONENTS: + requires = requires + COMPUTE_COMMON_COMPONENTS + self.cpp_info.components[component].requires = requires + SHARED_REQUIRES + self.cpp_info.components[component].libs = [f"google_cloud_cpp_{component}"] + self.cpp_info.components[component].names["pkg_config"] = f"google_cloud_cpp_{component}" + + def package_info(self): + self.cpp_info.components["common"].requires = ["abseil::absl_any", "abseil::absl_flat_hash_map", "abseil::absl_memory", "abseil::absl_optional", "abseil::absl_time"] + self.cpp_info.components["common"].libs = ["google_cloud_cpp_common"] + self.cpp_info.components["common"].names["pkg_config"] = "google_cloud_cpp_common" + + self.cpp_info.components["rest_internal"].requires = ["common", "libcurl::libcurl", "openssl::ssl", "openssl::crypto", "zlib::zlib"] + self.cpp_info.components["rest_internal"].libs = ["google_cloud_cpp_rest_internal"] + self.cpp_info.components["rest_internal"].names["pkg_config"] = "google_cloud_cpp_rest_internal" + + # A small number of gRPC-generated stubs are used directly in the common components + # shared by all gRPC-based libraries. These must be defined without reference to `grpc_utils`. + GRPC_UTILS_REQUIRED_PROTOS = { + "iam_credentials_v1_iamcredentials_protos", + "iam_v1_policy_protos", + "longrunning_operations_protos", + "rpc_error_details_protos", + "rpc_status_protos", + } + for component in GRPC_UTILS_REQUIRED_PROTOS: + self._add_proto_component(component) + + self.cpp_info.components["grpc_utils"].requires = list(GRPC_UTILS_REQUIRED_PROTOS) + ["common", "abseil::absl_function_ref", "abseil::absl_memory", "abseil::absl_time", "grpc::grpc++", "grpc::_grpc"] + self.cpp_info.components["grpc_utils"].libs = ["google_cloud_cpp_grpc_utils"] + self.cpp_info.components["grpc_utils"].names["pkg_config"] = "google_cloud_cpp_grpc_utils" + + for component in self._proto_components(): + if component == 'storage_protos': + # The `storage_protos` are compiled only when needed. They are + # not used in Conan because they are only needed for an + # experimental library, supporting an allow-listed service. + continue + if component not in GRPC_UTILS_REQUIRED_PROTOS: + self._add_proto_component(component) + + # Interface libraries for backwards compatibility + self.cpp_info.components["cloud_bigquery_protos"].requires = ["bigquery_protos"] + self.cpp_info.components["cloud_dialogflow_v2_protos"].requires = ["dialogflow_es_protos"] + self.cpp_info.components["cloud_speech_protos"].requires = ["speech_protos"] + self.cpp_info.components["cloud_texttospeech_protos"].requires = ["texttospeech_protos"] + self.cpp_info.components["devtools_cloudtrace_v2_trace_protos"].requires = ["trace_protos"] + self.cpp_info.components["devtools_cloudtrace_v2_tracing_protos"].requires = ["trace_protos"] + self.cpp_info.components["logging_type_type_protos"].requires = ["logging_type_protos"] + + for component in self._components(): + protos=f"{component}_protos" + # `compute` components do not depend on gRPC + if component.startswith("compute_"): + # Individual compute proto libraries were replaced with a single + # `compute_protos` library. + if Version(self.version) >= '2.28.0': + protos = "compute_protos" + self._add_compute_component(component, protos) + continue + # `storage` is the only component that does not depend on a matching `*_protos` library + if component in self._REQUIRES_CUSTOM_DEPENDENCIES: + continue + self._add_grpc_component(component, protos) + + self._add_grpc_component("bigtable", "bigtable_protos") + self._add_grpc_component("iam", "iam_protos") + self._add_grpc_component("pubsub", "pubsub_protos", ["abseil::absl_flat_hash_map"]) + self._add_grpc_component("spanner", "spanner_protos", ["abseil::absl_fixed_array", "abseil::absl_numeric", "abseil::absl_strings", "abseil::absl_time"]) + + if Version(self.version) >= '2.19.0': + self.cpp_info.components["rest_protobuf_internal"].requires = ["rest_internal", "grpc_utils", "common"] + self.cpp_info.components["rest_protobuf_internal"].libs = ["google_cloud_cpp_rest_protobuf_internal"] + self.cpp_info.components["rest_protobuf_internal"].names["pkg_config"] = "google_cloud_cpp_rest_protobuf_internal" + # The `google-cloud-cpp::compute` interface library groups all the compute + # libraries in a single target. + self.cpp_info.components["compute"].requires = [c for c in self._components() if c.startswith("compute_")] + # The `google-cloud-cpp::oauth2` library does not depend on gRPC or any protos. + self.cpp_info.components["oauth2"].requires = ["rest_internal", "common", "nlohmann_json::nlohmann_json", "libcurl::libcurl", "openssl::ssl", "openssl::crypto", "zlib::zlib"] + self.cpp_info.components["oauth2"].libs = ["google_cloud_cpp_oauth2"] + self.cpp_info.components["oauth2"].names["pkg_config"] = "google_cloud_cpp_oauth2" + + self.cpp_info.components["storage"].requires = ["rest_internal", "common", "nlohmann_json::nlohmann_json", "abseil::absl_memory", "abseil::absl_strings", "abseil::absl_str_format", "abseil::absl_time", "abseil::absl_variant", "crc32c::crc32c", "libcurl::libcurl", "openssl::ssl", "openssl::crypto", "zlib::zlib"] + self.cpp_info.components["storage"].libs = ["google_cloud_cpp_storage"] + self.cpp_info.components["storage"].names["pkg_config"] = "google_cloud_cpp_storage" diff --git a/recipes/google-cloud-cpp/2.x/extract_dependencies.py b/recipes/google-cloud-cpp/2.x/extract_dependencies.py new file mode 100755 index 0000000000000..0235b7b50d130 --- /dev/null +++ b/recipes/google-cloud-cpp/2.x/extract_dependencies.py @@ -0,0 +1,285 @@ +#!/usr/bin/env python3 + +import argparse +import glob +import os + +"""Extract google-cloud-cpp's component dependency info for use in Conan. + +google-cloud-cpp builds a number (about 100) of libraries from proto files. +These libraries have dependencies between them. In Conan, one cannot use the +dependencies preserved in the *-config.cmake files generated by the package, so +we have to reconstruct the dependencies here. + +Fortunately, google-cloud-cpp uses a number of *.deps files to keep these +dependencies. We just need to reimplement their algorithm to load these files +and convert them to CMake dependencies. + +The *.deps files themselves are generated (and committed to GitHub) from +Bazel rules. +""" + +# Used in _generate_proto_requires(): common requirements +_PROTO_DEPS_COMMON_REQUIRES = {"grpc::grpc++", "grpc::_grpc", "protobuf::libprotobuf"} + +# Used in _generate_proto_requires(): the *.deps files are generated from +# Bazel and contain a few targets that do not exit (nor do they need to +# exist) in CMake. +# +# This list maps onto google_cloud_cpp_load_protodeps()'s `targets_to_omit`. +_PROTO_DEPS_REMOVED_TARGETS = { + "cloud_kms_v1_kms_protos", + "cloud_orgpolicy_v1_orgpolicy_protos", + "cloud_oslogin_common_common_protos", + "cloud_recommender_v1_recommender_protos", + "identity_accesscontextmanager_type_type_protos", +} + +# Used in _generate_proto_requires(): the *.deps files are generated from +# Bazel and contain a few targets that have incorrect names for CMake. +# +# This list maps onto google_cloud_cpp_load_protodeps()'s `targets_substitutions`. +_PROTO_DEPS_REPLACED_TARGETS = { + "grafeas_v1_grafeas_protos": "grafeas_protos", + "iam_v2_policy_protos": "iam_v2_protos", + "logging_type_type_protos": "logging_type_protos", + "identity_accesscontextmanager_v1_accesscontextmanager_protos": "accesscontextmanager_protos", + "cloud_osconfig_v1_osconfig_protos": "osconfig_protos", + "cloud_documentai_v1_documentai_protos": "documentai_protos", +} + +# A few *.deps files use ad-hoc naming. +_PROTO_DEPS_REPLACED_NAMES = { + "common": "cloud_common_common", +} + +# A few *.deps files are not used. +_PROTO_DEPS_UNUSED = { + "iam_policy", +} + +# A few _protos libraries were introduced before `google-cloud-cpp` adopted +# more consistent naming. +_PROTO_BASE_COMPONENTS = { + "api_service_protos", + "api_visibility_protos", + "api_monitoring_protos", + "type_date_protos", + "api_control_protos", + "api_client_protos", + "api_annotations_protos", + "api_httpbody_protos", + "iam_v1_policy_protos", + "api_auth_protos", + "api_resource_protos", + "api_billing_protos", + "api_quota_protos", + "api_source_info_protos", + "api_backend_protos", + "type_datetime_protos", + "iam_v1_options_protos", + "api_endpoint_protos", + "api_launch_stage_protos", + "api_documentation_protos", + "type_color_protos", + "api_distribution_protos", + "api_config_change_protos", + "iam_v1_iam_policy_protos", + "type_expr_protos", + "api_routing_protos", + "api_usage_protos", + "type_calendar_period_protos", + "rpc_code_protos", + "api_system_parameter_protos", + "cloud_common_common_protos", + "type_postal_address_protos", + "type_latlng_protos", + "type_dayofweek_protos", + "api_monitored_resource_protos", + "type_money_protos", + "api_metric_protos", + "api_label_protos", + "api_log_protos", + "grafeas_protos", + "api_http_protos", + "type_timeofday_protos", + "api_field_behavior_protos", + "api_context_protos", + "api_logging_protos", + "iam_credentials_v1_common_protos", + "iam_credentials_v1_iamcredentials_protos", +} + +# A list of experimental components used when `google-cloud-cpp` does not +# provide an easy-to-use list. +_DEFAULT_EXPERIMENTAL_COMPONENTS = { + "apikeys", + "pubsublite", +} + +# `google-cloud-cpp` manages these dependencies using CMake code. +_HARD_CODED_DEPENDENCIES = { + "api_annotations_protos": ["api_http_protos"], + "api_auth_protos": ["api_annotations_protos"], + "api_client_protos": ["api_launch_stage_protos"], + "api_metric_protos": ["api_launch_stage_protos", "api_label_protos"], + "api_billing_protos": ["api_annotations_protos", "api_metric_protos"], + "api_distribution_protos": ["api_annotations_protos"], + "api_endpoint_protos": ["api_annotations_protos"], + "api_log_protos": ["api_label_protos"], + "api_logging_protos": ["api_annotations_protos", "api_label_protos"], + "api_monitored_resource_protos": ["api_launch_stage_protos", "api_label_protos"], + "api_monitoring_protos": ["api_annotations_protos"], + "api_quota_protos": ["api_annotations_protos"], + "api_usage_protos": ["api_annotations_protos", "api_visibility_protos"], + "api_service_protos": [ + "api_annotations_protos", + "api_auth_protos", + "api_backend_protos", + "api_billing_protos", + "api_client_protos", + "api_context_protos", + "api_control_protos", + "api_documentation_protos", + "api_endpoint_protos", + "api_http_protos", + "api_label_protos", + "api_log_protos", + "api_logging_protos", + "api_metric_protos", + "api_monitored_resource_protos", + "api_monitoring_protos", + "api_quota_protos", + "api_resource_protos", + "api_source_info_protos", + "api_system_parameter_protos", + "api_usage_protos", + ], + "iam_v1_options_protos": ["api_annotations_protos"], + "iam_v1_policy_protos": ["api_annotations_protos", "type_expr_protos"], + "iam_v1_iam_policy_protos": [ + "api_annotations_protos", + "api_client_protos", + "api_field_behavior_protos", + "api_resource_protos", + "iam_v1_options_protos", + "iam_v1_policy_protos", + ], + "iam_credentials_v1_common_protos": [ + "api_field_behavior_protos", + "api_resource_protos", + ], + "iam_credentials_v1_iamcredentials_protos": [ + "api_annotations_protos", + "api_client_protos", + "iam_credentials_v1_common_protos", + ], +} + + +def _components(source_folder): + libraries = os.path.join(source_folder, "libraries.bzl") + # Use the hard-coded list because the `google-cloud-cpp` does not provide + # an easy way to get all the components. + if not os.path.exists(libraries): + raise Exception("Missing 'libraries.bzl' file") + # The `libraries.bzl` file is a Starlark file that simply defines some + # variables listing all GA, experimental, and "transition", components. + # We want both the GA and transition components, the latter are components + # that recently transitioned from experimental to GA. + g = dict() + with open(libraries) as f: + exec(compile(f.read(), libraries, "exec"), g) + return ( + g["GOOGLE_CLOUD_CPP_GA_LIBRARIES"] + g["GOOGLE_CLOUD_CPP_TRANSITION_LIBRARIES"] + ) + + +def _experimental_components(source_folder): + libraries = os.path.join(source_folder, "libraries.bzl") + # Use the hard-coded list because the `google-cloud-cpp` does not provide + # an easy way to get all the components. + if not os.path.exists(libraries): + return _DEFAULT_EXPERIMENTAL_COMPONENTS + # The `libraries.bzl` file is a Starlark file that simply defines some + # variables listing all GA, experimental, and "transition", components. + # We want to return any experimental components, the caller will skip them + # as they are not built by Conan. + g = dict() + with open(libraries) as f: + exec(compile(f.read(), libraries, "exec"), g) + return g["GOOGLE_CLOUD_CPP_EXPERIMENTAL_LIBRARIES"] + + +def _generate_proto_requires(depfile): + """Load the dependencies for a single google-cloud-cpp::*-protos library.""" + requires = [] + with open(depfile, "r", encoding="utf-8") as f: + for line in f.readlines(): + line = line.strip() + line = line.replace(":", "_") + line = line.replace("_proto", "_protos") + line = line.replace("@com_google_googleapis//", "") + line = line.replace("google/", "") + line = line.replace("/", "_") + if line in _PROTO_DEPS_REMOVED_TARGETS: + continue + line = _PROTO_DEPS_REPLACED_TARGETS.get(line, line) + requires.append(line) + return list(_PROTO_DEPS_COMMON_REQUIRES) + requires + + +def main(): + """Generate a python file representing the google-cloud-cpp proto deps.""" + parser = argparse.ArgumentParser(description=(__doc__)) + parser.add_argument( + "-s", + "--source-folder", + help="a directory where `google-cloud-cpp` source has been extracted", + ) + args = parser.parse_args() + source_folder = vars(args)["source_folder"] + deps_folder = os.path.join(source_folder, "external", "googleapis", "protodeps") + print("# Automatically generated by %s DO NOT EDIT" % __file__) + print("DEPENDENCIES = {") + proto_components = _PROTO_BASE_COMPONENTS.copy() + files = sorted(glob.glob(os.path.join(deps_folder, "*.deps"))) + experimental = set(_experimental_components(source_folder)) + components = set(_components(source_folder)) + for filename in files: + component = os.path.basename(filename).replace(".deps", "") + component = _PROTO_DEPS_REPLACED_NAMES.get(component, component) + if component in experimental or component in _PROTO_DEPS_UNUSED: + # Experimental components have an associated *_protos, component. + # The Conan package only compiles the GA components, so we need + # to skip these. + continue + if component == "compute": + # `compute` does not use gRPC or the `*.deps` files. + continue + component = component + "_protos" + deps = _generate_proto_requires(filename) + proto_components.add(component) + proto_components.update(deps) + print(f' "{component}": {sorted(deps)},') + for component in sorted(_HARD_CODED_DEPENDENCIES.keys()): + deps = _HARD_CODED_DEPENDENCIES[component] + proto_components.add(component) + proto_components.update(deps) + print(f' "{component}": {sorted(deps)},') + print(f' "cloud_extended_operations_protos": ["protobuf::libprotobuf"],') + print(f' "compute_protos": ["cloud_extended_operations_protos", "protobuf::libprotobuf"],') + proto_components.add("cloud_extended_operations_protos") + proto_components.add("compute_protos") + print("}") + proto_components = proto_components - _PROTO_DEPS_COMMON_REQUIRES + names = ['"%s"' % c for c in proto_components] + joined = ",\n ".join(sorted(names)) + print(f"\nPROTO_COMPONENTS = {{\n {joined}\n}}") + names = ['"%s"' % c for c in components] + joined = ",\n ".join(sorted(names)) + print(f"\nCOMPONENTS = {{\n {joined}\n}}") + + +if __name__ == "__main__": + main() diff --git a/recipes/google-cloud-cpp/2.x/patches/2.15.1/001-use-conan-msvc-runtime.patch b/recipes/google-cloud-cpp/2.x/patches/2.15.1/001-use-conan-msvc-runtime.patch new file mode 100644 index 0000000000000..f1d07df826202 --- /dev/null +++ b/recipes/google-cloud-cpp/2.x/patches/2.15.1/001-use-conan-msvc-runtime.patch @@ -0,0 +1,53 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 66e3e7c3..32e64b5d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -53,7 +53,6 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + endif () + + list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) +-include(SelectMSVCRuntime) + + option(GOOGLE_CLOUD_CPP_ENABLE_MACOS_OPENSSL_CHECK + "If enabled, check that the user has defined OPENSSL_ROOT_DIR on macOS" +diff --git a/cmake/GoogleCloudCppCommon.cmake b/cmake/GoogleCloudCppCommon.cmake +index b487a1bc..880c98fe 100644 +--- a/cmake/GoogleCloudCppCommon.cmake ++++ b/cmake/GoogleCloudCppCommon.cmake +@@ -17,9 +17,6 @@ + # Get the destination directories based on the GNU recommendations. + include(GNUInstallDirs) + +-# Pick the right MSVC runtime libraries. +-include(SelectMSVCRuntime) +- + # Enable Werror + include(EnableWerror) + +diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt +index ec8b7395..91a7b32d 100644 +--- a/examples/CMakeLists.txt ++++ b/examples/CMakeLists.txt +@@ -20,9 +20,6 @@ if (NOT GOOGLE_CLOUD_CPP_ENABLE_EXAMPLES) + return() + endif () + +-# Pick the right MSVC runtime libraries. +-include(SelectMSVCRuntime) +- + if (bigtable IN_LIST GOOGLE_CLOUD_CPP_ENABLE AND storage IN_LIST + GOOGLE_CLOUD_CPP_ENABLE) + add_executable(gcs2cbt gcs2cbt.cc) +diff --git a/external/googleapis/CMakeLists.txt b/external/googleapis/CMakeLists.txt +index 15dcc92f..b6146bfe 100644 +--- a/external/googleapis/CMakeLists.txt ++++ b/external/googleapis/CMakeLists.txt +@@ -163,8 +163,6 @@ externalproject_add( + + google_cloud_cpp_find_proto_include_dir(PROTO_INCLUDE_DIR) + +-include(SelectMSVCRuntime) +- + google_cloud_cpp_add_protos_property() + + function (external_googleapis_short_name var proto) diff --git a/recipes/google-cloud-cpp/2.x/patches/2.19.0/001-use-conan-msvc-runtime.patch b/recipes/google-cloud-cpp/2.x/patches/2.19.0/001-use-conan-msvc-runtime.patch new file mode 100644 index 0000000000000..926222913c3a8 --- /dev/null +++ b/recipes/google-cloud-cpp/2.x/patches/2.19.0/001-use-conan-msvc-runtime.patch @@ -0,0 +1,53 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index aebfc6b1..f1c4f196 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -53,7 +53,6 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + endif () + + list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) +-include(SelectMSVCRuntime) + + option(GOOGLE_CLOUD_CPP_ENABLE_MACOS_OPENSSL_CHECK + "If enabled, check that the user has defined OPENSSL_ROOT_DIR on macOS" +diff --git a/cmake/GoogleCloudCppCommon.cmake b/cmake/GoogleCloudCppCommon.cmake +index b487a1bc..880c98fe 100644 +--- a/cmake/GoogleCloudCppCommon.cmake ++++ b/cmake/GoogleCloudCppCommon.cmake +@@ -17,9 +17,6 @@ + # Get the destination directories based on the GNU recommendations. + include(GNUInstallDirs) + +-# Pick the right MSVC runtime libraries. +-include(SelectMSVCRuntime) +- + # Enable Werror + include(EnableWerror) + +diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt +index ce44aafe..cdaba904 100644 +--- a/examples/CMakeLists.txt ++++ b/examples/CMakeLists.txt +@@ -20,9 +20,6 @@ if (NOT GOOGLE_CLOUD_CPP_ENABLE_EXAMPLES) + return() + endif () + +-# Pick the right MSVC runtime libraries. +-include(SelectMSVCRuntime) +- + if (bigtable IN_LIST GOOGLE_CLOUD_CPP_ENABLE AND storage IN_LIST + GOOGLE_CLOUD_CPP_ENABLE) + add_executable(gcs2cbt gcs2cbt.cc) +diff --git a/external/googleapis/CMakeLists.txt b/external/googleapis/CMakeLists.txt +index c3df633c..6a85dfe8 100644 +--- a/external/googleapis/CMakeLists.txt ++++ b/external/googleapis/CMakeLists.txt +@@ -163,8 +163,6 @@ externalproject_add( + + google_cloud_cpp_find_proto_include_dir(PROTO_INCLUDE_DIR) + +-include(SelectMSVCRuntime) +- + google_cloud_cpp_add_protos_property() + + function (external_googleapis_short_name var proto) diff --git a/recipes/google-cloud-cpp/2.x/patches/2.19.0/002-add-find-package-threads.patch b/recipes/google-cloud-cpp/2.x/patches/2.19.0/002-add-find-package-threads.patch new file mode 100644 index 0000000000000..5eee169050480 --- /dev/null +++ b/recipes/google-cloud-cpp/2.x/patches/2.19.0/002-add-find-package-threads.patch @@ -0,0 +1,12 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f1c4f196..53497f0a 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -187,6 +187,7 @@ add_custom_target(google-cloud-cpp-protos) + add_custom_target(doxygen-docs) + add_custom_target(all-docfx) + ++find_package(Threads REQUIRED) + find_package(absl CONFIG REQUIRED) + if (GOOGLE_CLOUD_CPP_ENABLE_GRPC) + find_package(gRPC REQUIRED QUIET) diff --git a/recipes/google-cloud-cpp/2.x/patches/2.28.0/001-add-find-package-threads.patch b/recipes/google-cloud-cpp/2.x/patches/2.28.0/001-add-find-package-threads.patch new file mode 100644 index 0000000000000..00d1143424d10 --- /dev/null +++ b/recipes/google-cloud-cpp/2.x/patches/2.28.0/001-add-find-package-threads.patch @@ -0,0 +1,12 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 96297b4a..f274a111 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -218,6 +218,7 @@ add_custom_target(google-cloud-cpp-protos) + add_custom_target(doxygen-docs) + add_custom_target(all-docfx) + ++find_package(Threads REQUIRED) + find_package(absl CONFIG REQUIRED) + if (GOOGLE_CLOUD_CPP_ENABLE_GRPC) + find_package(gRPC REQUIRED QUIET) diff --git a/recipes/google-cloud-cpp/2.x/test_package/CMakeLists.txt b/recipes/google-cloud-cpp/2.x/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..a3c3a27d44c93 --- /dev/null +++ b/recipes/google-cloud-cpp/2.x/test_package/CMakeLists.txt @@ -0,0 +1,29 @@ +cmake_minimum_required(VERSION 3.10...3.24) +project(google-cloud-cpp-test CXX) + +find_package(google-cloud-cpp CONFIG REQUIRED) + +# There are too many libraries to test them all. We +# should pick what we test with a view to detecting +# the most common packaging problems. + +set(tests + # Bigtable, Pub/Sub and Spanner have signficant amounts of + # custom code and thus some amount of ad-hoc dependencies on + # absl::* components. + "bigtable" "pubsub" "spanner" + # Storage has custom code and does not depend on gRPC or Protobuf. + "storage" + # Speech is a good model for most other libraries. + "speech") +if (WITH_COMPUTE) + # Compute does not use gRPC and has a different structure from most + # libraries. + list(APPEND tests "compute") +endif () + +foreach(component IN LISTS tests) + add_executable("${component}" "${component}.cpp") + target_compile_features("${component}" PRIVATE cxx_std_14) + target_link_libraries("${component}" google-cloud-cpp::${component}) +endforeach() diff --git a/recipes/google-cloud-cpp/2.x/test_package/bigtable.cpp b/recipes/google-cloud-cpp/2.x/test_package/bigtable.cpp new file mode 100644 index 0000000000000..3c792f63e06bf --- /dev/null +++ b/recipes/google-cloud-cpp/2.x/test_package/bigtable.cpp @@ -0,0 +1,16 @@ +#include + +int main(int argc, char *argv[]) { + if (argc != 1) { + std::cerr << "Usage: bigtable\n"; + return 1; + } + auto const project_id = std::string{"test-only-invalid"}; + auto const instance_id = std::string{"test-only-invalid"}; + auto const table_id = std::string{"test-only-invalid"}; + std::cout << "Testing google-cloud-cpp::bigtable library " << google::cloud::version_string() << "\n"; + namespace cbt = ::google::cloud::bigtable; + auto table = cbt::Table( + cbt::MakeDataConnection(), cbt::TableResource(project_id, instance_id, table_id)); + return 0; +} diff --git a/recipes/google-cloud-cpp/2.x/test_package/compute.cpp b/recipes/google-cloud-cpp/2.x/test_package/compute.cpp new file mode 100644 index 0000000000000..59d7b98bea158 --- /dev/null +++ b/recipes/google-cloud-cpp/2.x/test_package/compute.cpp @@ -0,0 +1,12 @@ +#include + +int main(int argc, char *argv[]) { + if (argc != 1) { + std::cerr << "Usage: compute\n"; + return 1; + } + std::cout << "Testing google-cloud-cpp::compute library " << google::cloud::version_string() << "\n"; + namespace disks = ::google::cloud::compute_disks_v1; + auto client = disks::DisksClient(disks::MakeDisksConnectionRest()); + return 0; +} diff --git a/recipes/google-cloud-cpp/2.x/test_package/conanfile.py b/recipes/google-cloud-cpp/2.x/test_package/conanfile.py new file mode 100644 index 0000000000000..a1ab26b6de654 --- /dev/null +++ b/recipes/google-cloud-cpp/2.x/test_package/conanfile.py @@ -0,0 +1,59 @@ +import os + +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.build import can_run +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.scm import Version + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + @property + def _is_legacy_one_profile(self): + return not hasattr(self, "settings_build") + + def layout(self): + cmake_layout(self) + + def _supports_compute(self): + if not hasattr(self, "dependencies"): + # This is typically a Conan v1 build. We skip the test for compute + # because it is difficult to establish the `google-cloud-cpp` + # version, and Conan v1 is being retired, and the support is tested + # as part of the Conan v2 build. + return False + return Version(self.dependencies["google-cloud-cpp"].ref.version) >= "2.19.0" + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["WITH_COMPUTE"] = self._supports_compute() + tc.generate() + if self._is_legacy_one_profile: + VirtualRunEnv(self).generate(scope="build") + else: + VirtualBuildEnv(self).generate() + # Environment so that the compiled test executable can load shared libraries + VirtualRunEnv(self).generate(scope="run") + deps = CMakeDeps(self) + deps.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not can_run(self): + return + for test in ["bigtable", "pubsub", "spanner", "speech", "storage"]: + cmd = os.path.join(self.cpp.build.bindir, test) + self.run(cmd, env="conanrun") + if self._supports_compute(): + cmd = os.path.join(self.cpp.build.bindir, "compute") + self.run(cmd, env="conanrun") diff --git a/recipes/google-cloud-cpp/2.x/test_package/pubsub.cpp b/recipes/google-cloud-cpp/2.x/test_package/pubsub.cpp new file mode 100644 index 0000000000000..c000cd8a7c940 --- /dev/null +++ b/recipes/google-cloud-cpp/2.x/test_package/pubsub.cpp @@ -0,0 +1,16 @@ +#include +#include + +int main(int argc, char* argv[]) { + if (argc != 1) { + std::cerr << "Usage: pubsub\n"; + return 1; + } + auto const project_id = std::string{"test-only-invalid"}; + auto const topic_id = std::string{"test-only-invalid"}; + std::cout << "Testing google-cloud-cpp::pubsub library " << google::cloud::version_string() << "\n"; + namespace pubsub = google::cloud::pubsub; + auto publisher = pubsub::Publisher( + pubsub::MakePublisherConnection(pubsub::Topic(project_id, topic_id))); + return 0; +} diff --git a/recipes/google-cloud-cpp/2.x/test_package/spanner.cpp b/recipes/google-cloud-cpp/2.x/test_package/spanner.cpp new file mode 100644 index 0000000000000..77d7f3f6a68ad --- /dev/null +++ b/recipes/google-cloud-cpp/2.x/test_package/spanner.cpp @@ -0,0 +1,17 @@ +#include +#include + +int main(int argc, char *argv[]) { + if (argc != 1) { + std::cerr << "Usage: bigtable\n"; + return 1; + } + auto const project_id = std::string{"test-only-invalid"}; + auto const instance_id = std::string{"test-only-invalid"}; + auto const database_id = std::string{"test-only-invalid"}; + std::cout << "Testing google-cloud-cpp::spanner library " << google::cloud::version_string() << "\n"; + namespace spanner = ::google::cloud::spanner; + auto client = spanner::Client( + spanner::MakeConnection(spanner::Database(project_id, instance_id, database_id))); + return 0; +} diff --git a/recipes/google-cloud-cpp/2.x/test_package/speech.cpp b/recipes/google-cloud-cpp/2.x/test_package/speech.cpp new file mode 100644 index 0000000000000..e05f7ddf8d1b5 --- /dev/null +++ b/recipes/google-cloud-cpp/2.x/test_package/speech.cpp @@ -0,0 +1,13 @@ +#include +#include + +int main(int argc, char* argv[]) { + if (argc != 1) { + std::cerr << "Usage: speech\n"; + return 1; + } + std::cout << "Testing google-cloud-cpp::speech library " << google::cloud::version_string() << "\n"; + namespace speech = ::google::cloud::speech; + auto client = speech::SpeechClient(speech::MakeSpeechConnection()); + return 0; +} diff --git a/recipes/google-cloud-cpp/2.x/test_package/storage.cpp b/recipes/google-cloud-cpp/2.x/test_package/storage.cpp new file mode 100644 index 0000000000000..ae43da936475d --- /dev/null +++ b/recipes/google-cloud-cpp/2.x/test_package/storage.cpp @@ -0,0 +1,18 @@ +#include +#include + +int main(int argc, char* argv[]) { + if (argc != 1) { + std::cerr << "Usage: storage\n"; + return 1; + } + + // Create aliases to make the code easier to read. + namespace gcs = google::cloud::storage; + + // Create a client to communicate with Google Cloud Storage. This client + // uses the default configuration for authentication and project id. + std::cout << "Testing google-cloud-cpp::storage library " << google::cloud::version_string() << "\n"; + auto client = gcs::Client(); + return 0; +} diff --git a/recipes/google-cloud-cpp/2.x/test_v1_package/CMakeLists.txt b/recipes/google-cloud-cpp/2.x/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..9d63e750dab0a --- /dev/null +++ b/recipes/google-cloud-cpp/2.x/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.10...3.24) +project(google-cloud-cpp-test 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/google-cloud-cpp/2.x/test_v1_package/conanfile.py b/recipes/google-cloud-cpp/2.x/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..35fbd17e1bba5 --- /dev/null +++ b/recipes/google-cloud-cpp/2.x/test_v1_package/conanfile.py @@ -0,0 +1,21 @@ +import os + +from conans import ConanFile, CMake +from conan.tools.build import can_run + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not can_run(self): + return + for test in ["bigtable", "pubsub", "spanner", "speech", "storage"]: + cmd = os.path.join("bin", test) + self.run(cmd, run_environment=True) diff --git a/recipes/google-cloud-cpp/all/CMakeLists.txt b/recipes/google-cloud-cpp/all/CMakeLists.txt deleted file mode 100644 index a342eb16dcf1a..0000000000000 --- a/recipes/google-cloud-cpp/all/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) - -if(MSVC) - add_definitions("-D_SILENCE_CXX20_REL_OPS_DEPRECATION_WARNING") - add_definitions("-D_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING") -endif() - -add_subdirectory("source_subfolder") diff --git a/recipes/google-cloud-cpp/all/conandata.yml b/recipes/google-cloud-cpp/all/conandata.yml index a410b93b2e064..ab3c9439c131a 100644 --- a/recipes/google-cloud-cpp/all/conandata.yml +++ b/recipes/google-cloud-cpp/all/conandata.yml @@ -1,23 +1,16 @@ sources: - "1.26.1": - url: "https://github.com/googleapis/google-cloud-cpp/archive/refs/tags/v1.26.1.tar.gz" - sha256: "83108515fc59c72cdb87f178712256f4b0098e1ca5dc6f64c2c20dd2f1e1559d" - "1.27.0": - url: "https://github.com/googleapis/google-cloud-cpp/archive/refs/tags/v1.27.0.tar.gz" - sha256: "84a7ac7b63db986bb737462e374c11fc6f35f6020ccaacec1d0e4d61ec929528" - "1.30.1": - url: "https://github.com/googleapis/google-cloud-cpp/archive/refs/tags/v1.30.1.tar.gz" - sha256: "b651a58cb44bd715f0cb8e42c7ea58490b3e768a35ede01d798b983eef88e143" - "1.31.1": - url: "https://github.com/googleapis/google-cloud-cpp/archive/refs/tags/v1.31.1.tar.gz" - sha256: "dc7cbf95b506a84b48cf71e0462985d262183edeaabdacaaee2109852394a609" "1.40.1": url: "https://github.com/googleapis/google-cloud-cpp/archive/refs/tags/v1.40.1.tar.gz" sha256: "fb62f0e7dc964c5d3cd0d85977b85f3e0e7dce97e9029abf9c32ecc29db07043" -patches: - "1.26.1": - - patch_file: "patches/0001-googleapis-folder.patch" - base_path: "source_subfolder" + "1.31.1": + url: "https://github.com/googleapis/google-cloud-cpp/archive/refs/tags/v1.31.1.tar.gz" + sha256: "dc7cbf95b506a84b48cf71e0462985d262183edeaabdacaaee2109852394a609" + "1.30.1": + url: "https://github.com/googleapis/google-cloud-cpp/archive/refs/tags/v1.30.1.tar.gz" + sha256: "b651a58cb44bd715f0cb8e42c7ea58490b3e768a35ede01d798b983eef88e143" "1.27.0": - - patch_file: "patches/0001-googleapis-folder.patch" - base_path: "source_subfolder" + url: "https://github.com/googleapis/google-cloud-cpp/archive/refs/tags/v1.27.0.tar.gz" + sha256: "84a7ac7b63db986bb737462e374c11fc6f35f6020ccaacec1d0e4d61ec929528" + "1.26.1": + url: "https://github.com/googleapis/google-cloud-cpp/archive/refs/tags/v1.26.1.tar.gz" + sha256: "83108515fc59c72cdb87f178712256f4b0098e1ca5dc6f64c2c20dd2f1e1559d" diff --git a/recipes/google-cloud-cpp/all/conanfile.py b/recipes/google-cloud-cpp/all/conanfile.py index 30fac004d5e19..e54c3ef7dc95c 100644 --- a/recipes/google-cloud-cpp/all/conanfile.py +++ b/recipes/google-cloud-cpp/all/conanfile.py @@ -1,41 +1,45 @@ import os import textwrap -import functools -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, cross_building +from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout +from conan.tools.files import copy, get, replace_in_file, rmdir +from conan.tools.microsoft import check_min_vs, is_msvc +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" -required_conan_version = ">=1.33.0" class GoogleCloudCppConan(ConanFile): name = "google-cloud-cpp" description = "C++ Client Libraries for Google Cloud Services" license = "Apache-2.0" - topics = "google", "cloud", "google-cloud-storage", "google-cloud-platform", "google-cloud-pubsub", "google-cloud-spanner", "google-cloud-bigtable" + topics = ( + "google", "cloud", "google-cloud-storage", "google-cloud-platform", + "google-cloud-pubsub", "google-cloud-spanner", "google-cloud-bigtable" + ) homepage = "https://github.com/googleapis/google-cloud-cpp" url = "https://github.com/conan-io/conan-center-index" - generators = "cmake", "cmake_find_package_multi", "cmake_find_package" + package_type = "library" 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, + } short_paths = True - _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"]) + def _minimum_compiler_versions(self): + return { + "gcc": "5.4", + "clang": "6", + } def config_options(self): if self.settings.os == "Windows": @@ -43,71 +47,77 @@ 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("abseil/[>=20230125.3 <=20230802.1]", transitive_headers=True) + self.requires("crc32c/1.1.2") + self.requires("grpc/1.54.3") + self.requires("libcurl/[>=7.78.0 <9]") + self.requires("nlohmann_json/3.11.3") + self.requires("openssl/[>=1.1 <4]") + self.requires("protobuf/3.21.12") + # TODO: googleapis is hard to unvendorize, as it creates google-cloud-cpp:: targets + # and it's not trivial to replace them with the googleapis:: targets, + # there's not clean 1:1 mapping between them either way + # self.requires("googleapis/cci.20220531") + + def build_requirements(self): + self.tool_requires("grpc/") + self.tool_requires("protobuf/") + def validate(self): - if self.settings.os == 'Windows' and self.options.shared: + if self.settings.os == "Windows" and self.options.shared: raise ConanInvalidConfiguration("Fails to compile for Windows as a DLL") - if hasattr(self, "settings_build") and tools.cross_building(self): + if hasattr(self, "settings_build") and cross_building(self): raise ConanInvalidConfiguration("Recipe not prepared for cross-building (yet)") - if tools.Version(self.version) >= "1.30.0": - if self.settings.compiler == 'clang' and tools.Version(self.settings.compiler.version) < "6.0": - raise ConanInvalidConfiguration("Clang version must be at least 6.0.") + if self.settings.compiler.get_safe("cppstd"): + if self.settings.compiler == "msvc": + check_min_cppstd(self, 20) + check_min_cppstd(self, 11) - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 11) + check_min_vs(self, "192") - if self.settings.compiler == 'gcc' and tools.Version(self.settings.compiler.version) < "5.4": - raise ConanInvalidConfiguration("Building requires GCC >= 5.4") - if self.settings.compiler == 'clang' and tools.Version(self.settings.compiler.version) < "3.8": - raise ConanInvalidConfiguration("Building requires clang >= 3.8") - if self.settings.compiler == 'Visual Studio' and tools.Version(self.settings.compiler.version) < "16": - raise ConanInvalidConfiguration("Building requires VS >= 2019") + minimum_version = self._minimum_compiler_versions.get(str(self.settings.compiler)) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration(f"{self.name} requires {self.settings.compiler} >= {minimum_version}") def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) - - def requirements(self): - self.requires('protobuf/3.20.0') - self.requires('grpc/1.45.2') - self.requires('nlohmann_json/3.10.5') - self.requires('crc32c/1.1.2') - self.requires('abseil/20211102.0') - self.requires('libcurl/7.80.0') - self.requires('openssl/1.1.1n') - # TODO: Add googleapis once it is available in CCI (now it is embedded) - - @functools.lru_cache(1) - def _configure_cmake(self): - # Do not build in parallel for certain configurations, it fails writting/reading files at the same time - parallel = not (self.settings.compiler == "Visual Studio" and self.settings.compiler.version == "16" and self.version in ["1.31.1", "1.30.1"]) - cmake = CMake(self, parallel=parallel) - cmake.definitions["BUILD_TESTING"] = 0 - - cmake.definitions["GOOGLE_CLOUD_CPP_ENABLE_MACOS_OPENSSL_CHECK"] = False - - cmake.definitions["GOOGLE_CLOUD_CPP_ENABLE_BIGTABLE"] = True - cmake.definitions["GOOGLE_CLOUD_CPP_ENABLE_BIGQUERY"] = True - cmake.definitions["GOOGLE_CLOUD_CPP_ENABLE_SPANNER"] = True - cmake.definitions["GOOGLE_CLOUD_CPP_ENABLE_STORAGE"] = True - cmake.definitions["GOOGLE_CLOUD_CPP_ENABLE_FIRESTORE"] = True - cmake.definitions["GOOGLE_CLOUD_CPP_ENABLE_PUBSUB"] = True - cmake.definitions["GOOGLE_CLOUD_CPP_ENABLE_IAM"] = True - cmake.definitions["GOOGLE_CLOUD_CPP_ENABLE_LOGGING"] = True - cmake.definitions["GOOGLE_CLOUD_CPP_ENABLE_GENERATOR"] = True - - cmake.configure() - return cmake + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["BUILD_TESTING"] = 0 + tc.cache_variables["GOOGLE_CLOUD_CPP_ENABLE_WERROR"] = False + tc.cache_variables["GOOGLE_CLOUD_CPP_ENABLE_MACOS_OPENSSL_CHECK"] = False + tc.cache_variables["GOOGLE_CLOUD_CPP_ENABLE_CCACHE"] = False + tc.cache_variables["GOOGLE_CLOUD_CPP_ENABLE_BIGTABLE"] = True + tc.cache_variables["GOOGLE_CLOUD_CPP_ENABLE_BIGQUERY"] = True + tc.cache_variables["GOOGLE_CLOUD_CPP_ENABLE_SPANNER"] = True + tc.cache_variables["GOOGLE_CLOUD_CPP_ENABLE_STORAGE"] = True + tc.cache_variables["GOOGLE_CLOUD_CPP_ENABLE_FIRESTORE"] = True + tc.cache_variables["GOOGLE_CLOUD_CPP_ENABLE_PUBSUB"] = True + tc.cache_variables["GOOGLE_CLOUD_CPP_ENABLE_IAM"] = True + tc.cache_variables["GOOGLE_CLOUD_CPP_ENABLE_LOGGING"] = True + tc.cache_variables["GOOGLE_CLOUD_CPP_ENABLE_GENERATOR"] = False + + if is_msvc(self): + tc.preprocessor_definitions["_SILENCE_CXX20_REL_OPS_DEPRECATION_WARNING"] = 1 + tc.preprocessor_definitions["_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING"] = 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) - - if tools.Version(self.version) < "1.33.0": + if Version(self.version) < "1.33.0": # Do not override CMAKE_CXX_STANDARD if provided - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), textwrap.dedent("""\ set(CMAKE_CXX_STANDARD 11 @@ -117,258 +127,262 @@ def _patch_sources(self): set(CMAKE_CXX_STANDARD 11 CACHE STRING "Configure the C++ standard version for all targets.") endif() """)) + if self.version == "1.40.1": + replace_in_file(self, os.path.join(self.source_folder, "google", "cloud", "internal", "openssl_util.h"), + "#include ", "#include \n#include ") 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")) - 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.components["common"].requires = ["abseil::absl_any", "abseil::absl_flat_hash_map", "abseil::absl_memory", "abseil::absl_optional", "abseil::absl_time"] self.cpp_info.components["common"].libs = ["google_cloud_cpp_common"] - self.cpp_info.components["common"].names["pkg_config"] = "google_cloud_cpp_common" + self.cpp_info.components["common"].set_property("pkg_config_name", "google_cloud_cpp_common") self.cpp_info.components["experimental-bigquery"].requires = ["grpc_utils", "common", "cloud_bigquery_protos"] self.cpp_info.components["experimental-bigquery"].libs = ["google_cloud_cpp_bigquery"] - self.cpp_info.components["experimental-bigquery"].names["pkg_config"] = "google_cloud_cpp_bigquery" + self.cpp_info.components["experimental-bigquery"].set_property("pkg_config_name", "google_cloud_cpp_bigquery") self.cpp_info.components["bigtable"].requires = ["abseil::absl_memory", "bigtable_protos", "common", "grpc_utils", "grpc::grpc++", "grpc::grpc", "protobuf::libprotobuf"] self.cpp_info.components["bigtable"].libs = ["google_cloud_cpp_bigtable"] - self.cpp_info.components["bigtable"].names["pkg_config"] = "google_cloud_cpp_bigtable" + self.cpp_info.components["bigtable"].set_property("pkg_config_name", "google_cloud_cpp_bigtable") - if tools.Version(self.version) < "1.40.1": # FIXME: Probably this library was removed before + if Version(self.version) < "1.40.1": # FIXME: Probably this library was removed before self.cpp_info.components["experimental-firestore"].requires = ["common"] self.cpp_info.components["experimental-firestore"].libs = ["google_cloud_cpp_firestore"] - self.cpp_info.components["experimental-firestore"].names["pkg_config"] = "google_cloud_cpp_firestore" - + self.cpp_info.components["experimental-firestore"].set_property("pkg_config_name", "google_cloud_cpp_firestore") + self.cpp_info.components["bigtable_protos"].requires = ["grpc::grpc++", "grpc::grpc", "protobuf::libprotobuf", "api_annotations_protos", "api_client_protos", "api_field_behavior_protos", "api_resource_protos", "iam_v1_iam_policy_protos", "iam_v1_policy_protos", "longrunning_operations_protos", "rpc_status_protos", "api_auth_protos"] self.cpp_info.components["bigtable_protos"].libs = ["google_cloud_cpp_bigtable_protos"] - self.cpp_info.components["bigtable_protos"].names["pkg_config"] = "google_cloud_cpp_bigtable_protos" + self.cpp_info.components["bigtable_protos"].set_property("pkg_config_name", "google_cloud_cpp_bigtable_protos") self.cpp_info.components["cloud_bigquery_protos"].requires = ["grpc::grpc++", "grpc::grpc", "protobuf::libprotobuf", "api_annotations_protos", "api_client_protos", "api_field_behavior_protos", "api_resource_protos", "iam_v1_iam_policy_protos", "iam_v1_policy_protos", "rpc_status_protos", "api_http_protos"] self.cpp_info.components["cloud_bigquery_protos"].libs = ["google_cloud_cpp_cloud_bigquery_protos"] - self.cpp_info.components["cloud_bigquery_protos"].names["pkg_config"] = "google_cloud_cpp_cloud_bigquery_protos" + self.cpp_info.components["cloud_bigquery_protos"].set_property("pkg_config_name", "google_cloud_cpp_cloud_bigquery_protos") self.cpp_info.components["cloud_speech_protos"].requires = ["grpc::grpc++", "grpc::grpc", "protobuf::libprotobuf", "api_annotations_protos", "api_client_protos", "api_field_behavior_protos", "longrunning_operations_protos", "rpc_status_protos"] self.cpp_info.components["cloud_speech_protos"].libs = ["google_cloud_cpp_cloud_speech_protos"] - self.cpp_info.components["cloud_speech_protos"].names["pkg_config"] = "google_cloud_cpp_cloud_speech_protos" + self.cpp_info.components["cloud_speech_protos"].set_property("pkg_config_name", "google_cloud_cpp_cloud_speech_protos") self.cpp_info.components["cloud_texttospeech_protos"].requires = ["grpc::grpc++", "grpc::grpc", "protobuf::libprotobuf", "api_annotations_protos", "api_client_protos", "api_field_behavior_protos"] self.cpp_info.components["cloud_texttospeech_protos"].libs = ["google_cloud_cpp_cloud_texttospeech_protos"] - self.cpp_info.components["cloud_texttospeech_protos"].names["pkg_config"] = "google_cloud_cpp_cloud_texttospeech_protos" + self.cpp_info.components["cloud_texttospeech_protos"].set_property("pkg_config_name", "google_cloud_cpp_cloud_texttospeech_protos") self.cpp_info.components["iam_protos"].requires = ["grpc::grpc++", "grpc::grpc", "protobuf::libprotobuf", "api_annotations_protos", "api_client_protos", "api_field_behavior_protos", "api_resource_protos"] self.cpp_info.components["iam_protos"].libs = ["google_cloud_cpp_iam_protos"] - self.cpp_info.components["iam_protos"].names["pkg_config"] = "google_cloud_cpp_iam_protos" + self.cpp_info.components["iam_protos"].set_property("pkg_config_name", "google_cloud_cpp_iam_protos") self.cpp_info.components["pubsub_protos"].requires = ["grpc::grpc++", "grpc::grpc", "protobuf::libprotobuf", "api_annotations_protos", "api_client_protos", "api_field_behavior_protos", "api_resource_protos"] self.cpp_info.components["pubsub_protos"].libs = ["google_cloud_cpp_pubsub_protos"] - self.cpp_info.components["pubsub_protos"].names["pkg_config"] = "google_cloud_cpp_pubsub_protos" + self.cpp_info.components["pubsub_protos"].set_property("pkg_config_name", "google_cloud_cpp_pubsub_protos") self.cpp_info.components["spanner_protos"].requires = ["grpc::grpc++", "grpc::grpc", "protobuf::libprotobuf", "api_annotations_protos", "api_client_protos", "api_field_behavior_protos", "api_resource_protos", "iam_v1_iam_policy_protos", "iam_v1_policy_protos", "longrunning_operations_protos", "rpc_status_protos"] self.cpp_info.components["spanner_protos"].libs = ["google_cloud_cpp_spanner_protos"] - self.cpp_info.components["spanner_protos"].names["pkg_config"] = "google_cloud_cpp_spanner_protos" + self.cpp_info.components["spanner_protos"].set_property("pkg_config_name", "google_cloud_cpp_spanner_protos") self.cpp_info.components["storage_protos"].requires = ["grpc::grpc++", "grpc::grpc", "protobuf::libprotobuf", "api_annotations_protos", "api_client_protos", "api_field_behavior_protos", "iam_v1_iam_policy_protos", "iam_v1_policy_protos"] self.cpp_info.components["storage_protos"].libs = ["google_cloud_cpp_storage_protos"] - self.cpp_info.components["storage_protos"].names["pkg_config"] = "google_cloud_cpp_storage_protos" + self.cpp_info.components["storage_protos"].set_property("pkg_config_name", "google_cloud_cpp_storage_protos") self.cpp_info.components["longrunning_operations_protos"].requires = ["grpc::grpc++", "grpc::grpc", "protobuf::libprotobuf", "api_annotations_protos", "api_client_protos", "rpc_status_protos"] self.cpp_info.components["longrunning_operations_protos"].libs = ["google_cloud_cpp_longrunning_operations_protos"] - self.cpp_info.components["longrunning_operations_protos"].names["pkg_config"] = "google_cloud_cpp_longrunning_operations_protos" + self.cpp_info.components["longrunning_operations_protos"].set_property("pkg_config_name", "google_cloud_cpp_longrunning_operations_protos") self.cpp_info.components["api_http_protos"].requires = ["grpc::grpc++", "grpc::grpc", "protobuf::libprotobuf"] self.cpp_info.components["api_http_protos"].libs = ["google_cloud_cpp_api_http_protos"] - self.cpp_info.components["api_http_protos"].names["pkg_config"] = "google_cloud_cpp_api_http_protos" + self.cpp_info.components["api_http_protos"].set_property("pkg_config_name", "google_cloud_cpp_api_http_protos") self.cpp_info.components["api_annotations_protos"].requires = ["grpc::grpc++", "grpc::grpc", "protobuf::libprotobuf", "api_http_protos"] self.cpp_info.components["api_annotations_protos"].libs = ["google_cloud_cpp_api_annotations_protos"] - self.cpp_info.components["api_annotations_protos"].names["pkg_config"] = "google_cloud_cpp_api_annotations_protos" + self.cpp_info.components["api_annotations_protos"].set_property("pkg_config_name", "google_cloud_cpp_api_annotations_protos") self.cpp_info.components["api_auth_protos"].requires = ["grpc::grpc++", "grpc::grpc", "protobuf::libprotobuf", "api_annotations_protos"] self.cpp_info.components["api_auth_protos"].libs = ["google_cloud_cpp_api_auth_protos"] - self.cpp_info.components["api_auth_protos"].names["pkg_config"] = "google_cloud_cpp_api_auth_protos" + self.cpp_info.components["api_auth_protos"].set_property("pkg_config_name", "google_cloud_cpp_api_auth_protos") self.cpp_info.components["api_client_protos"].requires = ["grpc::grpc++", "grpc::grpc", "protobuf::libprotobuf"] self.cpp_info.components["api_client_protos"].libs = ["google_cloud_cpp_api_client_protos"] - self.cpp_info.components["api_client_protos"].names["pkg_config"] = "google_cloud_cpp_api_client_protos" + self.cpp_info.components["api_client_protos"].set_property("pkg_config_name", "google_cloud_cpp_api_client_protos") self.cpp_info.components["api_distribution_protos"].requires = ["grpc::grpc++", "grpc::grpc", "protobuf::libprotobuf"] self.cpp_info.components["api_distribution_protos"].libs = ["google_cloud_cpp_api_distribution_protos"] - self.cpp_info.components["api_distribution_protos"].names["pkg_config"] = "google_cloud_cpp_api_distribution_protos" + self.cpp_info.components["api_distribution_protos"].set_property("pkg_config_name", "google_cloud_cpp_api_distribution_protos") self.cpp_info.components["api_field_behavior_protos"].requires = ["grpc::grpc++", "grpc::grpc", "protobuf::libprotobuf"] self.cpp_info.components["api_field_behavior_protos"].libs = ["google_cloud_cpp_api_field_behavior_protos"] - self.cpp_info.components["api_field_behavior_protos"].names["pkg_config"] = "google_cloud_cpp_api_field_behavior_protos" + self.cpp_info.components["api_field_behavior_protos"].set_property("pkg_config_name", "google_cloud_cpp_api_field_behavior_protos") self.cpp_info.components["api_label_protos"].requires = ["grpc::grpc++", "grpc::grpc", "protobuf::libprotobuf"] self.cpp_info.components["api_label_protos"].libs = ["google_cloud_cpp_api_label_protos"] - self.cpp_info.components["api_label_protos"].names["pkg_config"] = "google_cloud_cpp_api_label_protos" + self.cpp_info.components["api_label_protos"].set_property("pkg_config_name", "google_cloud_cpp_api_label_protos") self.cpp_info.components["api_launch_stage_protos"].requires = ["grpc::grpc++", "grpc::grpc", "protobuf::libprotobuf"] self.cpp_info.components["api_launch_stage_protos"].libs = ["google_cloud_cpp_api_launch_stage_protos"] - self.cpp_info.components["api_launch_stage_protos"].names["pkg_config"] = "google_cloud_cpp_api_launch_stage_protos" + self.cpp_info.components["api_launch_stage_protos"].set_property("pkg_config_name", "google_cloud_cpp_api_launch_stage_protos") self.cpp_info.components["api_metric_protos"].requires = ["grpc::grpc++", "grpc::grpc", "protobuf::libprotobuf", "api_launch_stage_protos", "api_label_protos"] self.cpp_info.components["api_metric_protos"].libs = ["google_cloud_cpp_api_metric_protos"] - self.cpp_info.components["api_metric_protos"].names["pkg_config"] = "google_cloud_cpp_api_metric_protos" + self.cpp_info.components["api_metric_protos"].set_property("pkg_config_name", "google_cloud_cpp_api_metric_protos") self.cpp_info.components["api_monitored_resource_protos"].requires = ["grpc::grpc++", "grpc::grpc", "protobuf::libprotobuf", "api_launch_stage_protos", "api_label_protos"] self.cpp_info.components["api_monitored_resource_protos"].libs = ["google_cloud_cpp_api_monitored_resource_protos"] - self.cpp_info.components["api_monitored_resource_protos"].names["pkg_config"] = "google_cloud_cpp_api_monitored_resource_protos" + self.cpp_info.components["api_monitored_resource_protos"].set_property("pkg_config_name", "google_cloud_cpp_api_monitored_resource_protos") self.cpp_info.components["api_resource_protos"].requires = ["grpc::grpc++", "grpc::grpc", "protobuf::libprotobuf"] self.cpp_info.components["api_resource_protos"].libs = ["google_cloud_cpp_api_resource_protos"] - self.cpp_info.components["api_resource_protos"].names["pkg_config"] = "google_cloud_cpp_api_resource_protos" + self.cpp_info.components["api_resource_protos"].set_property("pkg_config_name", "google_cloud_cpp_api_resource_protos") self.cpp_info.components["devtools_cloudtrace_v2_trace_protos"].requires = ["grpc::grpc++", "grpc::grpc", "protobuf::libprotobuf", "api_annotations_protos", "api_field_behavior_protos", "api_resource_protos", "rpc_status_protos"] self.cpp_info.components["devtools_cloudtrace_v2_trace_protos"].libs = ["google_cloud_cpp_devtools_cloudtrace_v2_trace_protos"] - self.cpp_info.components["devtools_cloudtrace_v2_trace_protos"].names["pkg_config"] = "google_cloud_cpp_devtools_cloudtrace_v2_trace_protos" + self.cpp_info.components["devtools_cloudtrace_v2_trace_protos"].set_property("pkg_config_name", "google_cloud_cpp_devtools_cloudtrace_v2_trace_protos") self.cpp_info.components["devtools_cloudtrace_v2_tracing_protos"].requires = ["grpc::grpc++", "grpc::grpc", "protobuf::libprotobuf", "devtools_cloudtrace_v2_trace_protos", "api_annotations_protos", "api_client_protos", "api_field_behavior_protos", "rpc_status_protos"] self.cpp_info.components["devtools_cloudtrace_v2_tracing_protos"].libs = ["google_cloud_cpp_devtools_cloudtrace_v2_tracing_protos"] - self.cpp_info.components["devtools_cloudtrace_v2_tracing_protos"].names["pkg_config"] = "google_cloud_cpp_devtools_cloudtrace_v2_tracing_protos" + self.cpp_info.components["devtools_cloudtrace_v2_tracing_protos"].set_property("pkg_config_name", "google_cloud_cpp_devtools_cloudtrace_v2_tracing_protos") cmp_logging_type_type_protos = None - if tools.Version(self.version) < "1.40.1": # FIXME: Probably this library was removed before + if Version(self.version) < "1.40.1": # FIXME: Probably this library was removed before cmp_logging_type_type_protos = "logging_type_protos" self.cpp_info.components[cmp_logging_type_type_protos].requires = ["grpc::grpc++", "grpc::grpc", "protobuf::libprotobuf", "api_annotations_protos"] self.cpp_info.components[cmp_logging_type_type_protos].libs = ["google_cloud_cpp_logging_type_protos"] - self.cpp_info.components[cmp_logging_type_type_protos].names["pkg_config"] = "google_cloud_cpp_logging_type_protos" + self.cpp_info.components[cmp_logging_type_type_protos].set_property("pkg_config_name", "google_cloud_cpp_logging_type_protos") else: cmp_logging_type_type_protos = "logging_type_type_protos" self.cpp_info.components[cmp_logging_type_type_protos].requires = ["grpc::grpc++", "grpc::grpc", "protobuf::libprotobuf", "api_annotations_protos"] self.cpp_info.components[cmp_logging_type_type_protos].libs = ["google_cloud_cpp_logging_type_type_protos"] - self.cpp_info.components[cmp_logging_type_type_protos].names["pkg_config"] = "google_cloud_cpp_logging_type_type_protos" + self.cpp_info.components[cmp_logging_type_type_protos].set_property("pkg_config_name", "google_cloud_cpp_logging_type_type_protos") self.cpp_info.components["logging_protos"].requires = ["grpc::grpc++", "grpc::grpc", "protobuf::libprotobuf", "api_annotations_protos", "api_client_protos", "api_distribution_protos", "api_field_behavior_protos", "api_metric_protos", "api_monitored_resource_protos", "api_resource_protos", cmp_logging_type_type_protos, "rpc_status_protos"] self.cpp_info.components["logging_protos"].libs = ["google_cloud_cpp_logging_protos"] - self.cpp_info.components["logging_protos"].names["pkg_config"] = "google_cloud_cpp_logging_protos" + self.cpp_info.components["logging_protos"].set_property("pkg_config_name", "google_cloud_cpp_logging_protos") self.cpp_info.components["monitoring_protos"].requires = ["grpc::grpc++", "grpc::grpc", "protobuf::libprotobuf", "api_annotations_protos", "api_client_protos", "api_distribution_protos", "api_field_behavior_protos", "api_label_protos", "api_launch_stage_protos", "api_metric_protos", "api_monitored_resource_protos", "api_resource_protos", "rpc_status_protos", "type_calendar_period_protos"] self.cpp_info.components["monitoring_protos"].libs = ["google_cloud_cpp_monitoring_protos"] - self.cpp_info.components["monitoring_protos"].names["pkg_config"] = "google_cloud_cpp_monitoring_protos" + self.cpp_info.components["monitoring_protos"].set_property("pkg_config_name", "google_cloud_cpp_monitoring_protos") self.cpp_info.components["iam_v1_options_protos"].requires = ["grpc::grpc++", "grpc::grpc", "protobuf::libprotobuf", "api_annotations_protos"] self.cpp_info.components["iam_v1_options_protos"].libs = ["google_cloud_cpp_iam_v1_options_protos"] - self.cpp_info.components["iam_v1_options_protos"].names["pkg_config"] = "google_cloud_cpp_iam_v1_options_protos" + self.cpp_info.components["iam_v1_options_protos"].set_property("pkg_config_name", "google_cloud_cpp_iam_v1_options_protos") self.cpp_info.components["iam_v1_policy_protos"].requires = ["grpc::grpc++", "grpc::grpc", "protobuf::libprotobuf", "api_annotations_protos", "type_expr_protos"] self.cpp_info.components["iam_v1_policy_protos"].libs = ["google_cloud_cpp_iam_v1_policy_protos"] - self.cpp_info.components["iam_v1_policy_protos"].names["pkg_config"] = "google_cloud_cpp_iam_v1_policy_protos" + self.cpp_info.components["iam_v1_policy_protos"].set_property("pkg_config_name", "google_cloud_cpp_iam_v1_policy_protos") self.cpp_info.components["iam_v1_iam_policy_protos"].requires = ["grpc::grpc++", "grpc::grpc", "protobuf::libprotobuf", "api_annotations_protos", "api_client_protos", "api_field_behavior_protos", "api_resource_protos", "iam_v1_options_protos", "iam_v1_policy_protos"] self.cpp_info.components["iam_v1_iam_policy_protos"].libs = ["google_cloud_cpp_iam_v1_iam_policy_protos"] - self.cpp_info.components["iam_v1_iam_policy_protos"].names["pkg_config"] = "google_cloud_cpp_iam_v1_iam_policy_protos" + self.cpp_info.components["iam_v1_iam_policy_protos"].set_property("pkg_config_name", "google_cloud_cpp_iam_v1_iam_policy_protos") self.cpp_info.components["rpc_error_details_protos"].requires = ["grpc::grpc++", "grpc::grpc", "protobuf::libprotobuf"] self.cpp_info.components["rpc_error_details_protos"].libs = ["google_cloud_cpp_rpc_error_details_protos"] - self.cpp_info.components["rpc_error_details_protos"].names["pkg_config"] = "google_cloud_cpp_rpc_error_details_protos" + self.cpp_info.components["rpc_error_details_protos"].set_property("pkg_config_name", "google_cloud_cpp_rpc_error_details_protos") self.cpp_info.components["rpc_status_protos"].requires = ["grpc::grpc++", "grpc::grpc", "protobuf::libprotobuf", "rpc_error_details_protos"] self.cpp_info.components["rpc_status_protos"].libs = ["google_cloud_cpp_rpc_status_protos"] - self.cpp_info.components["rpc_status_protos"].names["pkg_config"] = "google_cloud_cpp_rpc_status_protos" + self.cpp_info.components["rpc_status_protos"].set_property("pkg_config_name", "google_cloud_cpp_rpc_status_protos") self.cpp_info.components["type_calendar_period_protos"].requires = ["grpc::grpc++", "grpc::grpc", "protobuf::libprotobuf"] self.cpp_info.components["type_calendar_period_protos"].libs = ["google_cloud_cpp_type_calendar_period_protos"] - self.cpp_info.components["type_calendar_period_protos"].names["pkg_config"] = "google_cloud_cpp_type_calendar_period_protos" + self.cpp_info.components["type_calendar_period_protos"].set_property("pkg_config_name", "google_cloud_cpp_type_calendar_period_protos") self.cpp_info.components["type_color_protos"].requires = ["grpc::grpc++", "grpc::grpc", "protobuf::libprotobuf"] self.cpp_info.components["type_color_protos"].libs = ["google_cloud_cpp_type_color_protos"] - self.cpp_info.components["type_color_protos"].names["pkg_config"] = "google_cloud_cpp_type_color_protos" + self.cpp_info.components["type_color_protos"].set_property("pkg_config_name", "google_cloud_cpp_type_color_protos") self.cpp_info.components["type_date_protos"].requires = ["grpc::grpc++", "grpc::grpc", "protobuf::libprotobuf"] self.cpp_info.components["type_date_protos"].libs = ["google_cloud_cpp_type_date_protos"] - self.cpp_info.components["type_date_protos"].names["pkg_config"] = "google_cloud_cpp_type_date_protos" + self.cpp_info.components["type_date_protos"].set_property("pkg_config_name", "google_cloud_cpp_type_date_protos") self.cpp_info.components["type_datetime_protos"].requires = ["grpc::grpc++", "grpc::grpc", "protobuf::libprotobuf"] self.cpp_info.components["type_datetime_protos"].libs = ["google_cloud_cpp_type_datetime_protos"] - self.cpp_info.components["type_datetime_protos"].names["pkg_config"] = "google_cloud_cpp_type_datetime_protos" + self.cpp_info.components["type_datetime_protos"].set_property("pkg_config_name", "google_cloud_cpp_type_datetime_protos") self.cpp_info.components["type_dayofweek_protos"].requires = ["grpc::grpc++", "grpc::grpc", "protobuf::libprotobuf"] self.cpp_info.components["type_dayofweek_protos"].libs = ["google_cloud_cpp_type_dayofweek_protos"] - self.cpp_info.components["type_dayofweek_protos"].names["pkg_config"] = "google_cloud_cpp_type_dayofweek_protos" + self.cpp_info.components["type_dayofweek_protos"].set_property("pkg_config_name", "google_cloud_cpp_type_dayofweek_protos") self.cpp_info.components["type_expr_protos"].requires = ["grpc::grpc++", "grpc::grpc", "protobuf::libprotobuf"] self.cpp_info.components["type_expr_protos"].libs = ["google_cloud_cpp_type_expr_protos"] - self.cpp_info.components["type_expr_protos"].names["pkg_config"] = "google_cloud_cpp_type_expr_protos" + self.cpp_info.components["type_expr_protos"].set_property("pkg_config_name", "google_cloud_cpp_type_expr_protos") self.cpp_info.components["type_fraction_protos"].requires = ["grpc::grpc++", "grpc::grpc", "protobuf::libprotobuf"] self.cpp_info.components["type_fraction_protos"].libs = ["google_cloud_cpp_type_fraction_protos"] - self.cpp_info.components["type_fraction_protos"].names["pkg_config"] = "google_cloud_cpp_type_fraction_protos" + self.cpp_info.components["type_fraction_protos"].set_property("pkg_config_name", "google_cloud_cpp_type_fraction_protos") self.cpp_info.components["type_interval_protos"].requires = ["grpc::grpc++", "grpc::grpc", "protobuf::libprotobuf"] self.cpp_info.components["type_interval_protos"].libs = ["google_cloud_cpp_type_interval_protos"] - self.cpp_info.components["type_interval_protos"].names["pkg_config"] = "google_cloud_cpp_type_interval_protos" + self.cpp_info.components["type_interval_protos"].set_property("pkg_config_name", "google_cloud_cpp_type_interval_protos") self.cpp_info.components["type_latlng_protos"].requires = ["grpc::grpc++", "grpc::grpc", "protobuf::libprotobuf"] self.cpp_info.components["type_latlng_protos"].libs = ["google_cloud_cpp_type_latlng_protos"] - self.cpp_info.components["type_latlng_protos"].names["pkg_config"] = "google_cloud_cpp_type_latlng_protos" + self.cpp_info.components["type_latlng_protos"].set_property("pkg_config_name", "google_cloud_cpp_type_latlng_protos") self.cpp_info.components["type_localized_text_protos"].requires = ["grpc::grpc++", "grpc::grpc", "protobuf::libprotobuf"] self.cpp_info.components["type_localized_text_protos"].libs = ["google_cloud_cpp_type_localized_text_protos"] - self.cpp_info.components["type_localized_text_protos"].names["pkg_config"] = "google_cloud_cpp_type_localized_text_protos" + self.cpp_info.components["type_localized_text_protos"].set_property("pkg_config_name", "google_cloud_cpp_type_localized_text_protos") self.cpp_info.components["type_money_protos"].requires = ["grpc::grpc++", "grpc::grpc", "protobuf::libprotobuf"] self.cpp_info.components["type_money_protos"].libs = ["google_cloud_cpp_type_money_protos"] - self.cpp_info.components["type_money_protos"].names["pkg_config"] = "google_cloud_cpp_type_money_protos" + self.cpp_info.components["type_money_protos"].set_property("pkg_config_name", "google_cloud_cpp_type_money_protos") self.cpp_info.components["type_month_protos"].requires = ["grpc::grpc++", "grpc::grpc", "protobuf::libprotobuf"] self.cpp_info.components["type_month_protos"].libs = ["google_cloud_cpp_type_month_protos"] - self.cpp_info.components["type_month_protos"].names["pkg_config"] = "google_cloud_cpp_type_month_protos" + self.cpp_info.components["type_month_protos"].set_property("pkg_config_name", "google_cloud_cpp_type_month_protos") self.cpp_info.components["type_phone_number_protos"].requires = ["grpc::grpc++", "grpc::grpc", "protobuf::libprotobuf"] self.cpp_info.components["type_phone_number_protos"].libs = ["google_cloud_cpp_type_phone_number_protos"] - self.cpp_info.components["type_phone_number_protos"].names["pkg_config"] = "google_cloud_cpp_type_phone_number_protos" + self.cpp_info.components["type_phone_number_protos"].set_property("pkg_config_name", "google_cloud_cpp_type_phone_number_protos") self.cpp_info.components["type_postal_address_protos"].requires = ["grpc::grpc++", "grpc::grpc", "protobuf::libprotobuf"] self.cpp_info.components["type_postal_address_protos"].libs = ["google_cloud_cpp_type_postal_address_protos"] - self.cpp_info.components["type_postal_address_protos"].names["pkg_config"] = "google_cloud_cpp_type_postal_address_protos" + self.cpp_info.components["type_postal_address_protos"].set_property("pkg_config_name", "google_cloud_cpp_type_postal_address_protos") self.cpp_info.components["type_quaternion_protos"].requires = ["grpc::grpc++", "grpc::grpc", "protobuf::libprotobuf"] self.cpp_info.components["type_quaternion_protos"].libs = ["google_cloud_cpp_type_quaternion_protos"] - self.cpp_info.components["type_quaternion_protos"].names["pkg_config"] = "google_cloud_cpp_type_quaternion_protos" + self.cpp_info.components["type_quaternion_protos"].set_property("pkg_config_name", "google_cloud_cpp_type_quaternion_protos") self.cpp_info.components["type_timeofday_protos"].requires = ["grpc::grpc++", "grpc::grpc", "protobuf::libprotobuf"] self.cpp_info.components["type_timeofday_protos"].libs = ["google_cloud_cpp_type_timeofday_protos"] - self.cpp_info.components["type_timeofday_protos"].names["pkg_config"] = "google_cloud_cpp_type_timeofday_protos" + self.cpp_info.components["type_timeofday_protos"].set_property("pkg_config_name", "google_cloud_cpp_type_timeofday_protos") self.cpp_info.components["cloud_dialogflow_v2_protos"].requires = ["grpc::grpc++", "grpc::grpc", "protobuf::libprotobuf", "api_annotations_protos", "api_client_protos", "api_field_behavior_protos", "api_resource_protos", "longrunning_operations_protos", "rpc_status_protos", "type_latlng_protos"] self.cpp_info.components["cloud_dialogflow_v2_protos"].libs = ["google_cloud_cpp_cloud_dialogflow_v2_protos"] - self.cpp_info.components["cloud_dialogflow_v2_protos"].names["pkg_config"] = "google_cloud_cpp_cloud_dialogflow_v2_protos" + self.cpp_info.components["cloud_dialogflow_v2_protos"].set_property("pkg_config_name", "google_cloud_cpp_cloud_dialogflow_v2_protos") - if tools.Version(self.version) < "1.40.1": # FIXME: Probably this library was removed before + if Version(self.version) < "1.40.1": # FIXME: Probably this library was removed before self.cpp_info.components["cloud_dialogflow_v2beta1_protos"].requires = ["grpc::grpc++", "grpc::grpc", "protobuf::libprotobuf", "api_annotations_protos", "api_client_protos", "api_field_behavior_protos", "api_resource_protos", "longrunning_operations_protos", "rpc_status_protos", "type_latlng_protos"] self.cpp_info.components["cloud_dialogflow_v2beta1_protos"].libs = ["google_cloud_cpp_cloud_dialogflow_v2beta1_protos"] - self.cpp_info.components["cloud_dialogflow_v2beta1_protos"].names["pkg_config"] = "google_cloud_cpp_cloud_dialogflow_v2beta1_protos" + self.cpp_info.components["cloud_dialogflow_v2beta1_protos"].set_property("pkg_config_name", "google_cloud_cpp_cloud_dialogflow_v2beta1_protos") self.cpp_info.components["grpc_utils"].requires = ["abseil::absl_function_ref", "abseil::absl_memory", "abseil::absl_time", "rpc_status_protos", "common", "grpc::grpc++", "grpc::grpc"] self.cpp_info.components["grpc_utils"].libs = ["google_cloud_cpp_grpc_utils"] - self.cpp_info.components["grpc_utils"].names["pkg_config"] = "google_cloud_cpp_grpc_utils" + self.cpp_info.components["grpc_utils"].set_property("pkg_config_name", "google_cloud_cpp_grpc_utils") self.cpp_info.components["experimental-iam"].requires = ["grpc_utils", "common", "iam_protos"] self.cpp_info.components["experimental-iam"].libs = ["google_cloud_cpp_iam"] - self.cpp_info.components["experimental-iam"].names["pkg_config"] = "google_cloud_cpp_iam" + self.cpp_info.components["experimental-iam"].set_property("pkg_config_name", "google_cloud_cpp_iam") self.cpp_info.components["experimental-logging"].requires = ["grpc_utils", "common", "logging_protos"] self.cpp_info.components["experimental-logging"].libs = ["google_cloud_cpp_logging"] - self.cpp_info.components["experimental-logging"].names["pkg_config"] = "google_cloud_cpp_logging" + self.cpp_info.components["experimental-logging"].set_property("pkg_config_name", "google_cloud_cpp_logging") self.cpp_info.components["pubsub"].requires = ["grpc_utils", "common", "pubsub_protos", "abseil::absl_flat_hash_map"] self.cpp_info.components["pubsub"].libs = ["google_cloud_cpp_pubsub"] - self.cpp_info.components["pubsub"].names["pkg_config"] = "google_cloud_cpp_pubsub" + self.cpp_info.components["pubsub"].set_property("pkg_config_name", "google_cloud_cpp_pubsub") self.cpp_info.components["spanner"].requires = ["abseil::absl_fixed_array", "abseil::absl_memory", "abseil::absl_numeric", "abseil::absl_strings", "abseil::absl_time", "grpc_utils", "common", "spanner_protos"] self.cpp_info.components["spanner"].libs = ["google_cloud_cpp_spanner"] - self.cpp_info.components["spanner"].names["pkg_config"] = "google_cloud_cpp_spanner" + self.cpp_info.components["spanner"].set_property("pkg_config_name", "google_cloud_cpp_spanner") self.cpp_info.components["storage"].requires = ["abseil::absl_memory", "abseil::absl_strings", "abseil::absl_str_format", "abseil::absl_time", "abseil::absl_variant", "common", "nlohmann_json::nlohmann_json", "crc32c::crc32c", "libcurl::libcurl", "openssl::ssl", "openssl::crypto"] self.cpp_info.components["storage"].libs = ["google_cloud_cpp_storage"] - self.cpp_info.components["storage"].names["pkg_config"] = "google_cloud_cpp_storage" + self.cpp_info.components["storage"].set_property("pkg_config_name", "google_cloud_cpp_storage") diff --git a/recipes/google-cloud-cpp/all/patches/0001-googleapis-folder.patch b/recipes/google-cloud-cpp/all/patches/0001-googleapis-folder.patch deleted file mode 100644 index 0fc76cae5ba7c..0000000000000 --- a/recipes/google-cloud-cpp/all/patches/0001-googleapis-folder.patch +++ /dev/null @@ -1,22 +0,0 @@ -diff --git a/external/googleapis/CMakeLists.txt b/external/googleapis/CMakeLists.txt -index c3f1ef1..fb65356 100644 ---- a/external/googleapis/CMakeLists.txt -+++ b/external/googleapis/CMakeLists.txt -@@ -25,7 +25,7 @@ set(GOOGLE_CLOUD_CPP_GOOGLEAPIS_SHA256 - "6762083f829f998c3971efa2ba858c21d4ac4ba77feb9650bad7d358e3add2a5") - - set(EXTERNAL_GOOGLEAPIS_SOURCE -- "${CMAKE_BINARY_DIR}/external/googleapis/src/googleapis_download") -+ "${PROJECT_BINARY_DIR}/external/googleapis/src/googleapis_download") - - set(EXTERNAL_GOOGLEAPIS_PROTO_FILES - "google/api/http.proto" -@@ -161,7 +161,7 @@ include(ExternalProject) - ExternalProject_Add( - googleapis_download - EXCLUDE_FROM_ALL ON -- PREFIX "${CMAKE_BINARY_DIR}/external/googleapis" -+ PREFIX "${PROJECT_BINARY_DIR}/external/googleapis" - URL ${GOOGLE_CLOUD_CPP_GOOGLEAPIS_URL} - URL_HASH SHA256=${GOOGLE_CLOUD_CPP_GOOGLEAPIS_SHA256} - PATCH_COMMAND diff --git a/recipes/google-cloud-cpp/all/test_package/CMakeLists.txt b/recipes/google-cloud-cpp/all/test_package/CMakeLists.txt index a657ae7a34ce1..7ec50c6e07dfe 100644 --- a/recipes/google-cloud-cpp/all/test_package/CMakeLists.txt +++ b/recipes/google-cloud-cpp/all/test_package/CMakeLists.txt @@ -1,14 +1,8 @@ -cmake_minimum_required(VERSION 3.5) -project(google-cloud-cpp-storage-quickstart CXX C) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +find_package(google-cloud-cpp REQUIRED CONFIG) -set(CMAKE_CXX_STANDARD 11) -set(CMAKE_CXX_STANDARD_REQUIRED ON) - -find_package(google-cloud-cpp REQUIRED) - -# Once the packages are found, define the targets. -add_executable(storage storage.cpp) -target_link_libraries(storage google-cloud-cpp::storage) +add_executable(${PROJECT_NAME} storage.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE google-cloud-cpp::storage) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/google-cloud-cpp/all/test_package/conanfile.py b/recipes/google-cloud-cpp/all/test_package/conanfile.py index 39f0d1104e661..9adb575c7818b 100644 --- a/recipes/google-cloud-cpp/all/test_package/conanfile.py +++ b/recipes/google-cloud-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", "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) @@ -11,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "storage") - self.run("%s bucket_name" % 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} bucket_name", env="conanrun") diff --git a/recipes/google-cloud-cpp/config.yml b/recipes/google-cloud-cpp/config.yml index 79daaecfa3b4d..fc485bd919336 100644 --- a/recipes/google-cloud-cpp/config.yml +++ b/recipes/google-cloud-cpp/config.yml @@ -1,11 +1,13 @@ versions: - "1.26.1": - folder: "all" - "1.27.0": - folder: "all" - "1.30.1": + "2.28.0": + folder: "2.x" + "2.19.0": + folder: "2.x" + "2.15.1": + folder: "2.x" + "1.40.1": folder: "all" "1.31.1": folder: "all" - "1.40.1": + "1.30.1": folder: "all" 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..1c14a1790d586 100644 --- a/recipes/googleapis/all/conandata.yml +++ b/recipes/googleapis/all/conandata.yml @@ -7,6 +7,12 @@ # (master branch) https://github.com/grpc/grpc/blob/master/CMakeLists.txt#L347 sources: + "cci.20230501": + url: "https://github.com/googleapis/googleapis/archive/2da477b6a72168c65fdb4245530cfa702cc4b029.tar.gz" + sha256: "3e48e5833fcd2e1fcb8b6a5b7a88e18503b670e8636b868cdb5ac32e00fbdafb" + "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 +25,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 022bfade0055c..7d10eb1883d33 100644 --- a/recipes/googleapis/all/conanfile.py +++ b/recipes/googleapis/all/conanfile.py @@ -1,95 +1,94 @@ -import os import functools import glob -from io import StringIO - -from conans import CMake, tools +import os from conan import ConanFile -from conan.tools.files import get, copy +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, VirtualRunEnv +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 conan.errors import ConanInvalidConfiguration - from helpers import parse_proto_libraries -required_conan_version = ">=1.45.0" +required_conan_version = ">=1.60.0 <2 || >=2.0.5" + 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" options = { "shared": [True, False], - "fPIC": [True, False] - } + "fPIC": [True, False], + } default_options = { "shared": False, - "fPIC": True - } + "fPIC": True, + } exports = "helpers.py" short_paths = True - def export_sources(self): - self.copy("CMakeLists.txt") + @property + def _is_legacy_one_profile(self): + return not hasattr(self, "settings_build") - def source(self): - get(self, **self.conan_data["sources"][str(self.version)], destination=self.source_folder, strip_root=True) + def export_sources(self): + copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=os.path.join(self.export_sources_folder, "src")) + 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") self.options["protobuf"].shared = True + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + # https://github.com/conan-io/conan-center-index/pull/15601#issuecomment-1493086506 + self.requires("protobuf/3.21.12", transitive_headers=True, transitive_libs=True) + 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.settings.compiler == "gcc" and Version(self.settings.compiler.version) <= "5": raise ConanInvalidConfiguration("Build with GCC 5 fails") 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: + if self.options.shared and not self.dependencies.host["protobuf"].options.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: - import re - output = StringIO() - self.run("cmake --version", output=output) - m = re.search(r'cmake version (\d+)\.(\d+)\.(\d+)', output.getvalue()) - major, minor = int(m.group(1)), int(m.group(2)) - assert major >= 3 and minor >= 20 - except: - return False - else: - return True - def build_requirements(self): - self.build_requires('protobuf/3.21.4') + if not self._is_legacy_one_profile: + self.tool_requires("protobuf/") + # 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') + self.tool_requires("cmake/[>=3.20 <4]") - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.configure() - return cmake + def source(self): + get(self, **self.conan_data["sources"][str(self.version)], strip_root=True) + + def generate(self): + VirtualBuildEnv(self).generate() + if self._is_legacy_one_profile: + VirtualRunEnv(self).generate(scope="build") + tc = CMakeToolchain(self) + tc.generate() + deps = CMakeDeps(self) + deps.generate() @functools.lru_cache(1) def _parse_proto_libraries(self): @@ -126,13 +125,15 @@ def deactivate_library(key): all_dict[key].is_used = False # - 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 Version(self.deps_cpp_info["protobuf"].version) <= "3.21.5" and self.settings.os == "Macos" or \ + # https://github.com/conan-io/conan-center-index/pull/16034/files#r1159042324 + # This was fixed in the v22 release which starts at 4.22 for the C++ library + if Version(self.dependencies["protobuf"].ref.version) <= "3.21.9" 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 @@ -151,17 +152,34 @@ def deactivate_library(key): 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") + # This fails to build on Windows. It is arguably a missing feature of + # Protobuf. + # https://github.com/protocolbuffers/protobuf/issues/12774 + # Fortunately this library is not used by any downstream packages + # (grpc-protos, or google-cloud-cpp), and it is only "beta" at the + # moment. Simply disable it for now. + deactivate_library("//google/cloud/lifesciences/v2beta:lifesciences_proto") + deactivate_library("//google/cloud/lifesciences/v2beta:lifesciences_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")) @@ -173,11 +191,19 @@ def package(self): 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) - def package_id(self): - self.info.requires["protobuf"].full_package_mode() + 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_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].set_property("pkg_config_name", name) + if self.settings.os in ["Linux", "FreeBSD"]: + 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..268a1364e7302 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): @@ -49,31 +59,38 @@ def to_cmake_target(item): 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" + 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) - protobuf_generate(LANGUAGE cpp - TARGET {self.cmake_target} - PROTOS ${{{self.cmake_target}_PROTOS}} + 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 {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 @@ -90,14 +107,18 @@ def parse_proto_libraries(filename, source_folder, error): basedir = os.path.dirname(filename) current_folder_str = os.path.relpath(basedir, source_folder).replace('\\', '/') # We need forward slashes because of Windows proto_library = None - + def parsing_sources(line): proto_path = os.path.relpath(os.path.join(basedir, line.strip(",").strip("\"")), source_folder).replace('\\', '/') proto_library.srcs.append(proto_path) def parsing_deps(line): + # Remove any comments + line = line.split('#', 1)[0].strip() line = line.strip(",").strip("\"") - if line.startswith("@com_google_protobuf//:"): + if line == '': + pass + elif line.startswith("@com_google_protobuf//:"): proto_library.deps.add("protobuf::libprotobuf") elif line.startswith("@com_google_googleapis//"): proto_library.deps.add(line[len("@com_google_googleapis"):]) @@ -114,13 +135,13 @@ def collecting_items(collection, line): line = line.strip(",").strip("\"") collection.append(line) - with open(filename, 'r') as f: + with open(filename, 'r', encoding='utf-8') as f: action = None parsing_variable = None variables = {} for line in f.readlines(): line = line.strip() - + if line == "proto_library(": assert proto_library == None proto_library = _ProtoLibrary(is_cc=False) @@ -158,11 +179,11 @@ def collecting_items(collection, line): proto_library = None action = None elif line == "],": - action = None + action = None elif line.startswith("] + "): varname = re_add_varname.search(line).group(1) for it in variables[varname]: - action(it) + action(it) elif action: action(line) 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/CMakeLists.txt b/recipes/googleapis/all/test_package/CMakeLists.txt index d676bb7ea7cdc..aba09b40ee6df 100644 --- a/recipes/googleapis/all/test_package/CMakeLists.txt +++ b/recipes/googleapis/all/test_package/CMakeLists.txt @@ -1,10 +1,8 @@ -cmake_minimum_required(VERSION 3.15) -project(test_package CXX) - -set(CMAKE_CXX_STANDARD 11) -set(CMAKE_CXX_STANDARD_REQUIRED ON) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(googleapis REQUIRED CONFIG) add_executable(${PROJECT_NAME} 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_package/conanfile.py b/recipes/googleapis/all/test_package/conanfile.py index e279a6afcd236..bb39603872037 100644 --- a/recipes/googleapis/all/test_package/conanfile.py +++ b/recipes/googleapis/all/test_package/conanfile.py @@ -1,29 +1,26 @@ 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, cmake_layout class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) - - def generate(self): - tc = CMakeToolchain(self) - tc.generate() + 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): + 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 index d1b58c810713b..0d20897301b68 100644 --- a/recipes/googleapis/all/test_v1_package/CMakeLists.txt +++ b/recipes/googleapis/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(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) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/googleapis/config.yml b/recipes/googleapis/config.yml index 0df9fcd3465bb..dd9050334b552 100644 --- a/recipes/googleapis/config.yml +++ b/recipes/googleapis/config.yml @@ -1,4 +1,8 @@ versions: + "cci.20230501": + folder: all + "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..0ed1afdf40204 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,85 @@ 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") - - def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + 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 _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 + # gperf makefile relies on GNU Make behaviour + if self._settings_build.os == "FreeBSD": + self.tool_requires("make/4.4.1") - @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 + 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) + 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/gperftools/all/conandata.yml b/recipes/gperftools/all/conandata.yml new file mode 100644 index 0000000000000..fe3e23057591f --- /dev/null +++ b/recipes/gperftools/all/conandata.yml @@ -0,0 +1,22 @@ +sources: + "2.16": + url: "https://github.com/gperftools/gperftools/releases/download/gperftools-2.16/gperftools-2.16.tar.gz" + sha256: "f12624af5c5987f2cc830ee534f754c3c5961eec08004c26a8b80de015cf056f" + "2.15": + url: "https://github.com/gperftools/gperftools/releases/download/gperftools-2.15/gperftools-2.15.tar.gz" + sha256: "c69fef855628c81ef56f12e3c58f2b7ce1f326c0a1fe783e5cae0b88cbbe9a80" + "2.14.0": + url: "https://github.com/gperftools/gperftools/releases/download/gperftools-2.14/gperftools-2.14.tar.gz" + sha256: "6b561baf304b53d0a25311bd2e29bc993bed76b7c562380949e7cb5e3846b299" + "2.13.0": + url: "https://github.com/gperftools/gperftools/releases/download/gperftools-2.13/gperftools-2.13.tar.gz" + sha256: "4882c5ece69f8691e51ffd6486df7d79dbf43b0c909d84d3c0883e30d27323e7" + "2.12.0": + url: "https://github.com/gperftools/gperftools/releases/download/gperftools-2.12/gperftools-2.12.tar.gz" + sha256: "fb611b56871a3d9c92ab0cc41f9c807e8dfa81a54a4a9de7f30e838756b5c7c6" + "2.11.0": + url: "https://github.com/gperftools/gperftools/releases/download/gperftools-2.11/gperftools-2.11.tar.gz" + sha256: "8ffda10e7c500fea23df182d7adddbf378a203c681515ad913c28a64b87e24dc" + "2.10.0": + url: "https://github.com/gperftools/gperftools/releases/download/gperftools-2.10/gperftools-2.10.tar.gz" + sha256: "83e3bfdd28b8bcf53222c3798d4d395d52dadbbae59e8730c4a6d31a9c3732d8" diff --git a/recipes/gperftools/all/conanfile.py b/recipes/gperftools/all/conanfile.py new file mode 100644 index 0000000000000..9b3639725e4ab --- /dev/null +++ b/recipes/gperftools/all/conanfile.py @@ -0,0 +1,253 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name, is_apple_os, XCRun +from conan.tools.build import cross_building, check_min_cppstd, stdcpp_library +from conan.tools.cmake import cmake_layout +from conan.tools.env import VirtualRunEnv +from conan.tools.files import get, copy, rm, rmdir, replace_in_file +from conan.tools.gnu import AutotoolsToolchain, AutotoolsDeps, Autotools +from conan.tools.scm import Version +import os + +required_conan_version = ">=1.53.0" + +class GperftoolsConan(ConanFile): + name = "gperftools" + description = "High-performance multi-threaded malloc()" + license = "BSD-3-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/gperftools/gperftools" + topics = ("memory", "allocator", "tcmalloc", "google-perftools") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "build_cpu_profiler": [True, False], + "build_heap_profiler": [True, False], + "build_heap_checker": [True, False], + "build_debugalloc": [True, False], + "dynamic_sized_delete_support": [True, False], + "emergency_malloc": [None, True, False], + "enable_aggressive_decommit_by_default": [True, False], + "enable_frame_pointers": [True, False], + "enable_large_alloc_report": [True, False], + "enable_libunwind": [True, False], + "enable_stacktrace_via_backtrace": [None, True, False], + "sized_delete": [True, False], + "tcmalloc_alignment": [None, "ANY"], + "tcmalloc_pagesize": [None, "ANY"], + } + default_options = { + "shared": False, + "fPIC": True, + "build_cpu_profiler": False, + "build_heap_profiler": False, + "build_heap_checker": False, + "build_debugalloc": False, + "dynamic_sized_delete_support": False, + "emergency_malloc": None, + "enable_aggressive_decommit_by_default": False, + "enable_frame_pointers": False, + "enable_large_alloc_report": False, + "enable_libunwind": True, + "enable_stacktrace_via_backtrace": False, + "sized_delete": False, + "tcmalloc_alignment": None, + "tcmalloc_pagesize": None, + } + + @property + def _min_cppstd(self): + return "11" if Version(self.version) < "2.16" else "17" + + @property + def _compilers_minimum_version(self): + return { + "17": { + "gcc": "8", + "clang": "7", + "apple-clang": "12", + "Visual Studio": "16", + "msvc": "192", + }, + }.get(self._min_cppstd, {}) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + @property + def _build_minimal(self): + # Corresponds to the gperftools build_minimal option + return not ( + self.options.build_cpu_profiler + or self.options.build_heap_profiler + or self.options.build_heap_checker + ) + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + if self._build_minimal: + # Minimal build does not include stack trace support, so these options are irrelevant + self.options.rm_safe("enable_libunwind") + self.options.rm_safe("enable_frame_pointers") + self.options.rm_safe("enable_stacktrace_via_backtrace") + self.options.rm_safe("emergency_malloc") + elif self.options.enable_libunwind: + # enable_stacktrace_via_backtrace has no effect if libunwind is enabled + self.options.rm_safe("enable_stacktrace_via_backtrace") + + 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." + ) + + if Version(self.version) >= "2.11.0" and self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "7": + raise ConanInvalidConfiguration(f"{self.ref} does not support gcc < 7.") + + if self.settings.os == "Windows": + raise ConanInvalidConfiguration( + f"{self.ref} does not currently support Windows. Contributions are welcome." + ) + + def requirements(self): + if self.options.get_safe("enable_libunwind", False): + self.requires("libunwind/1.6.2") + + def source(self): + 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) + args = {} + args["prefix"] = "" + args["enable-cpu-profiler"] = self.options.build_cpu_profiler + args["enable-heap-profiler"] = self.options.build_heap_profiler + args["enable-heap-checker"] = self.options.build_heap_checker + args["enable-debugalloc"] = self.options.build_debugalloc + args["enable-minimal"] = self._build_minimal + args["enable-dynamic-sized-delete-support"] = self.options.dynamic_sized_delete_support + args["enable-sized-delete"] = self.options.sized_delete + args["enable-large-alloc-report"] = self.options.enable_large_alloc_report + args["enable-aggressive-decommit-by-default"] = self.options.enable_aggressive_decommit_by_default + if self._build_minimal: + # No stack trace support will be built + args["enable-libunwind"] = False + args["enable-frame-pointers"] = False + args["enable-stacktrace-via-backtrace"] = False + args["enable-emergency-malloc"] = False + else: + args["enable-libunwind"] = self.options.enable_libunwind + args["enable-frame-pointers"] = self.options.enable_frame_pointers + args["enable-stacktrace-via-backtrace"] = self.options.get_safe( + "enable_stacktrace_via_backtrace", False + ) + args["enable-emergency-malloc"] = self.options.emergency_malloc + args["with-tcmalloc-alignment"] = self.options.tcmalloc_alignment + args["with-tcmalloc-pagesize"] = self.options.tcmalloc_pagesize + + # Based on https://github.com/conan-io/conan-center-index/blob/c647b1/recipes/libx264/all/conanfile.py#L94 + if is_apple_os(self) and self.settings.arch == "armv8": + args["host"] = "aarch64-apple-darwin" + tc.extra_asflags = ["-arch arm64"] + tc.extra_ldflags = ["-arch arm64"] + if self.settings.os != "Macos": + xcrun = XCRun(self) + platform_flags = ["-isysroot", xcrun.sdk_path] + apple_min_version_flag = AutotoolsToolchain(self).apple_min_version_flag + if apple_min_version_flag: + platform_flags.append(apple_min_version_flag) + tc.extra_asflags.extend(platform_flags) + tc.extra_cflags.extend(platform_flags) + tc.extra_ldflags.extend(platform_flags) + + for k, v in args.items(): + if v in [True, False]: + v = "yes" if v else "no" + if v is not None: + tc.configure_args.append(f"--{k}={v}") + tc.generate() + + tc = AutotoolsDeps(self) + tc.generate() + + def _patch_sources(self): + # Disable building of tests and benchmarks in Makefile + for pattern in ["noinst_PROGRAMS = ", "TESTS = "]: + replace_in_file( + self, + os.path.join(self.source_folder, "Makefile.in"), + pattern, + f"{pattern}\n_{pattern}", + ) + + def build(self): + self._patch_sources() + autotools = Autotools(self) + autotools.configure() + autotools.make() + + def package(self): + copy(self, "COPYING", 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")) + fix_apple_shared_install_name(self) + + def _add_component(self, lib): + self.cpp_info.components[lib].libs = [lib] + self.cpp_info.components[lib].set_property("pkg_config_name", f"lib{lib}") + if stdcpp_library(self): + self.cpp_info.components[lib].system_libs.append(stdcpp_library(self)) + + def package_info(self): + self._add_component("tcmalloc_minimal") + if self.options.build_debugalloc: + self._add_component("tcmalloc_minimal_debug") + if self.options.build_heap_profiler or self.options.build_heap_checker: + self._add_component("tcmalloc") + if self.options.build_debugalloc: + self._add_component("tcmalloc_debug") + if self.options.build_cpu_profiler: + self._add_component("profiler") + if "tcmalloc" in self.cpp_info.components: + self._add_component("tcmalloc_and_profiler") + + for component in self.cpp_info.components.values(): + if self.settings.os in ["Linux", "FreeBSD"]: + component.system_libs.extend(["pthread", "m"]) + component.cflags.append("-pthread") + component.cxxflags.append("-pthread") + if self.options.get_safe("enable_libunwind"): + component.requires.append("libunwind::libunwind") + + # Select the preferred library to link against by default + main_component = self.cpp_info.components["gperftools"] + for lib in [ + "tcmalloc_and_profiler", + "tcmalloc", + "tcmalloc_debug", + "tcmalloc_minimal_debug", + "tcmalloc_minimal", + ]: + if lib in self.cpp_info.components: + main_component.requires = [lib] + if lib != "tcmalloc_and_profiler" and "profiler" in self.cpp_info.components: + main_component.requires.append("profiler") + break diff --git a/recipes/gperftools/all/test_package/CMakeLists.txt b/recipes/gperftools/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..5baf67b50cd5e --- /dev/null +++ b/recipes/gperftools/all/test_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) + +find_package(gperftools REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE gperftools::gperftools) + +add_executable(${PROJECT_NAME}_minimal test_package.c) +target_link_libraries(${PROJECT_NAME}_minimal PRIVATE gperftools::tcmalloc_minimal) + diff --git a/recipes/gperftools/all/test_package/conanfile.py b/recipes/gperftools/all/test_package/conanfile.py new file mode 100644 index 0000000000000..f5cf204295e19 --- /dev/null +++ b/recipes/gperftools/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/gperftools/all/test_package/test_package.c b/recipes/gperftools/all/test_package/test_package.c new file mode 100644 index 0000000000000..1c8031c880cd6 --- /dev/null +++ b/recipes/gperftools/all/test_package/test_package.c @@ -0,0 +1,12 @@ +#include + +#include +#include +#include + +int main() { + void *p = tc_malloc(100); + tc_free(p); + puts(tc_version(NULL, NULL, NULL)); + return p == 0 ? EXIT_FAILURE : EXIT_SUCCESS; +} diff --git a/recipes/gperftools/config.yml b/recipes/gperftools/config.yml new file mode 100644 index 0000000000000..11bc45e75f53f --- /dev/null +++ b/recipes/gperftools/config.yml @@ -0,0 +1,15 @@ +versions: + "2.16": + folder: all + "2.15": + folder: all + "2.14.0": + folder: all + "2.13.0": + folder: all + "2.12.0": + folder: all + "2.11.0": + folder: all + "2.10.0": + folder: all 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 24a18f93603a5..ccf6c76d58f43 100644 --- a/recipes/graphene/all/conanfile.py +++ b/recipes/graphene/all/conanfile.py @@ -1,31 +1,27 @@ import os from conan import ConanFile -from conan.tools.meson import MesonToolchain, Meson -from conan.tools.gnu import PkgConfigDeps +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, - rename, - rm, - rmdir -) -from conan.tools.microsoft import is_msvc, is_msvc_static_runtime -from conan.tools.scm import Version +from conan.tools.files import copy, get, rm, rmdir, replace_in_file +from conan.tools.gnu import PkgConfigDeps from conan.tools.layout import basic_layout -from conan.errors import ConanInvalidConfiguration +from conan.tools.meson import Meson, MesonToolchain +from conan.tools.microsoft import is_msvc_static_runtime +from conan.tools.scm import Version -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" -class LibnameConan(ConanFile): +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" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -42,31 +38,29 @@ def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - 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 requirements(self): - if self.options.with_glib: - self.requires("glib/2.74.1") - 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.78.3") + def validate(self): 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.info.options.with_glib: + if self.options.with_glib: glib_is_shared = self.dependencies["glib"].options.shared - if self.info.options.shared and not glib_is_shared: + if self.options.shared and not glib_is_shared: raise ConanInvalidConfiguration( "Linking a shared library against static glib can cause unexpected behaviour." ) @@ -75,10 +69,18 @@ def validate(self): "Linking shared glib with the MSVC static runtime is not supported" ) - def layout(self): - basic_layout(self, src_folder="src") + def build_requirements(self): + self.tool_requires("meson/1.3.1") + if not self.conf.get("tools.gnu:pkg_config", default=False): + self.tool_requires("pkgconf/2.1.0") + + 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() @@ -86,7 +88,7 @@ def generate(self): meson.project_options.update({ "tests": "false", "installed_tests": "false", - "gtk_doc": "false" + "gtk_doc": "false", }) meson.project_options["gobject_types"] = "true" if self.options.with_glib else "false" if Version(self.version) < "1.10.4": @@ -95,28 +97,27 @@ def generate(self): meson.project_options["introspection"] = "disabled" meson.generate() - venv = VirtualBuildEnv(self) - venv.generate() - - def source(self): - get(self, **self.conan_data["sources"][self.version], strip_root=True) + def _patch_sources(self): + # The finite-math-only optimization has no effect and can cause linking errors + # when linked against glibc >= 2.31 + replace_in_file(self, os.path.join(self.source_folder, "meson.build"), + "'-ffast-math'", + "'-ffast-math', '-fno-finite-math-only'") def build(self): + self._patch_sources() meson = Meson(self) meson.configure() meson.build() def package(self): + copy(self, "LICENSE.txt", self.source_folder, os.path.join(self.package_folder, "licenses")) meson = Meson(self) meson.install() - copy(self, "LICENSE.txt", self.source_folder, os.path.join(self.package_folder, "licenses")) - - if is_msvc(self) and not self.options.shared: - libfolder = os.path.join(self.package_folder, "lib") - rename(self, os.path.join(libfolder, "libgraphene-1.0.a"), os.path.join(libfolder, "graphene-1.0.lib")) - 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") @@ -132,6 +133,18 @@ def package_info(self): self.cpp_info.components["graphene-gobject-1.0"].includedirs = [os.path.join("include", "graphene-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 and not self.options["glib"].shared: - 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_v1_package/CMakeLists.txt b/recipes/graphene/all/test_v1_package/CMakeLists.txt index 0eed825b22dae..0d20897301b68 100644 --- a/recipes/graphene/all/test_v1_package/CMakeLists.txt +++ b/recipes/graphene/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(graphene CONFIG REQUIRED) - -add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ - ${CMAKE_CURRENT_BINARY_DIR}/test_package/) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) 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/graphthewy/all/conanfile.py b/recipes/graphthewy/all/conanfile.py index 87bfe2e73e236..a57627cf2f7dd 100644 --- a/recipes/graphthewy/all/conanfile.py +++ b/recipes/graphthewy/all/conanfile.py @@ -1,55 +1,63 @@ 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 copy, get +from conan.tools.layout import basic_layout +from conan.tools.scm import Version + +required_conan_version = ">=1.52.0" class GraphthewyConan(ConanFile): name = "graphthewy" + description = "Simple header-only C++ Library for graph modelling (directed or not) and graph cycle detection. " license = "EUPL-1.2" - homepage = "https://github.com/alex-87/graphthewy" url = "https://github.com/conan-io/conan-center-index" - description = "Simple header-only C++ Library for graph modelling (directed or not) and graph cycle detection. " + homepage = "https://github.com/alex-87/graphthewy" topics = ("graph", "algorithm", "modelling", "header-only") - settings = "compiler" + + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename(self.name + "-" + self.version, self._source_subfolder) + @property + def _min_cppstd(self): + return 17 @property def _compilers_minimum_version(self): return { "Visual Studio": "15.7", + "msvc": "191", "gcc": "7", "clang": "7", "apple-clang": "10" - } - - @property - def _source_subfolder(self): - return "source_subfolder" + } - def configure(self): - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 17) + def layout(self): + basic_layout(self, src_folder="src") - 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] + 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 not minimum_version: - self.output.warn("graphthewy 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("graphthewy requires C++17, 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." + ) + + 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_subfolder) - self.copy("*.hpp", dst=os.path.join("include", "graphthewy"), src=self._source_subfolder, keep_path=False) + copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, "*.hpp", dst=os.path.join(self.package_folder, "include", "graphthewy"), src=self.source_folder, keep_path=False) - def package_id(self): - self.info.header_only() + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/graphthewy/all/test_package/CMakeLists.txt b/recipes/graphthewy/all/test_package/CMakeLists.txt index 4f4089cf5e4ec..3883365747974 100644 --- a/recipes/graphthewy/all/test_package/CMakeLists.txt +++ b/recipes/graphthewy/all/test_package/CMakeLists.txt @@ -1,10 +1,8 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(PackageTest CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(graphthewy REQUIRED CONFIG) add_executable(test_package test_package.cpp) -target_link_libraries(test_package ${CONAN_LIBS}) - +target_link_libraries(test_package PRIVATE graphthewy::graphthewy) set_property(TARGET test_package PROPERTY CXX_STANDARD 17) diff --git a/recipes/graphthewy/all/test_package/conanfile.py b/recipes/graphthewy/all/test_package/conanfile.py index 1d8d5788c2d75..fae501d0afb9e 100644 --- a/recipes/graphthewy/all/test_package/conanfile.py +++ b/recipes/graphthewy/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" + test_type = "explicit" -class GraphthewyTestConan(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,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/graphthewy/all/test_package/test_package.cpp b/recipes/graphthewy/all/test_package/test_package.cpp index 10db9f97c57c1..c60ac86359e1d 100644 --- a/recipes/graphthewy/all/test_package/test_package.cpp +++ b/recipes/graphthewy/all/test_package/test_package.cpp @@ -1,7 +1,7 @@ #include #include -int main(int argc, char** arvg) +int main() { graphthewy::UndirectedGraph(g); g.addVertex(1); @@ -11,7 +11,7 @@ int main(int argc, char** arvg) g.link(2, 3); g.link(3, 1); - graphthewy::GraphCyclegc(g); + graphthewy::GraphCycle gc(g); return (gc.hasCycle() == true ? 0 : -1); } diff --git a/recipes/graphthewy/all/test_v1_package/CMakeLists.txt b/recipes/graphthewy/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/graphthewy/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/graphthewy/all/test_v1_package/conanfile.py b/recipes/graphthewy/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..3c2537c3ee226 --- /dev/null +++ b/recipes/graphthewy/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +import os + +from conans import ConanFile, CMake, tools + + +class GraphthewyTestConan(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/greatest/all/conanfile.py b/recipes/greatest/all/conanfile.py index cda1c077e6c1d..24675294fec7f 100644 --- a/recipes/greatest/all/conanfile.py +++ b/recipes/greatest/all/conanfile.py @@ -1,4 +1,10 @@ -from conans import ConanFile, tools +import os + +from conan import ConanFile +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout + +required_conan_version = ">=1.52.0" class GreatestConan(ConanFile): @@ -8,19 +14,24 @@ class GreatestConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/silentbicycle/greatest" topics = ("testing", "testing-framework", "unit-testing", "header-only") + + 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], - destination=self._source_subfolder, strip_root=True) + 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("greatest.h", dst="include", src=self._source_subfolder) + copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, "greatest.h", dst=os.path.join(self.package_folder, "include"), src=self.source_folder) - def package_id(self): - self.info.header_only() + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/greatest/all/test_package/CMakeLists.txt b/recipes/greatest/all/test_package/CMakeLists.txt index a5ffd526aaea7..7ddc15d912feb 100644 --- a/recipes/greatest/all/test_package/CMakeLists.txt +++ b/recipes/greatest/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ -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() +find_package(greatest REQUIRED CONFIG) add_executable(${CMAKE_PROJECT_NAME} test_package.c) -target_link_libraries(${CMAKE_PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${CMAKE_PROJECT_NAME} greatest::greatest) diff --git a/recipes/greatest/all/test_package/conanfile.py b/recipes/greatest/all/test_package/conanfile.py index d4128b0450777..fae501d0afb9e 100644 --- a/recipes/greatest/all/test_package/conanfile.py +++ b/recipes/greatest/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" + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/greg7mdp-gtl/all/conandata.yml b/recipes/greg7mdp-gtl/all/conandata.yml index 03c557a0c1185..b401f2186d351 100644 --- a/recipes/greg7mdp-gtl/all/conandata.yml +++ b/recipes/greg7mdp-gtl/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "1.2.0": + url: "https://github.com/greg7mdp/gtl/archive/refs/tags/v1.2.0.tar.gz" + sha256: "1547ab78f62725c380f50972f7a49ffd3671ded17a3cb34305da5c953c6ba8e7" + "1.1.8": + url: "https://github.com/greg7mdp/gtl/archive/v1.1.8.tar.gz" + sha256: "6bda4c07bd966a88740ee07e3df23863a93d7b5365e0eea7f13cde9eda961b86" "1.1.5": url: "https://github.com/greg7mdp/gtl/archive/v1.1.5.tar.gz" sha256: "2d943d2ccc33c6c662918efc51782dac414354a1458441f16041a98eec164bda" diff --git a/recipes/greg7mdp-gtl/all/conanfile.py b/recipes/greg7mdp-gtl/all/conanfile.py index 44af92f813395..511f3700cda78 100644 --- a/recipes/greg7mdp-gtl/all/conanfile.py +++ b/recipes/greg7mdp-gtl/all/conanfile.py @@ -17,11 +17,12 @@ class Greg7mdpGtlConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/greg7mdp/gtl" topics = ("bitset", "memoize", "containers", "bitvector", "unordered-set", "header-only") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @property - def _minimum_cpp_standard(self): + def _min_cppstd(self): return 20 @property @@ -42,14 +43,13 @@ def package_id(self): def validate(self): if self.settings.get_safe("compiler.cppstd"): - check_min_cppstd(self, self._minimum_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.get_safe("compiler.version")) < minimum_version: - raise ConanInvalidConfiguration(f"{self.ref} requires C++{self._minimum_cpp_standard}, which your compiler does not support.") + 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 build(self): pass @@ -60,9 +60,7 @@ def package(self): 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") diff --git a/recipes/greg7mdp-gtl/all/test_package/CMakeLists.txt b/recipes/greg7mdp-gtl/all/test_package/CMakeLists.txt index a2b5f552d2486..4de04c5c56508 100644 --- a/recipes/greg7mdp-gtl/all/test_package/CMakeLists.txt +++ b/recipes/greg7mdp-gtl/all/test_package/CMakeLists.txt @@ -1,6 +1,5 @@ cmake_minimum_required(VERSION 3.12) - -project(test_package CXX) +project(test_package LANGUAGES CXX) find_package(gtl REQUIRED CONFIG) diff --git a/recipes/greg7mdp-gtl/all/test_v1_package/CMakeLists.txt b/recipes/greg7mdp-gtl/all/test_v1_package/CMakeLists.txt index 7967c88037332..9652e22fc19d5 100644 --- a/recipes/greg7mdp-gtl/all/test_v1_package/CMakeLists.txt +++ b/recipes/greg7mdp-gtl/all/test_v1_package/CMakeLists.txt @@ -1,12 +1,9 @@ cmake_minimum_required(VERSION 3.12) -project(test_package CXX) +project(test_package) 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) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/greg7mdp-gtl/config.yml b/recipes/greg7mdp-gtl/config.yml index 94e2cbf33f6be..ae3262a541e37 100644 --- a/recipes/greg7mdp-gtl/config.yml +++ b/recipes/greg7mdp-gtl/config.yml @@ -1,4 +1,8 @@ versions: + "1.2.0": + folder: all + "1.1.8": + folder: all "1.1.5": folder: all "1.1.4": 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/conandata.yml b/recipes/grpc-proto/all/conandata.yml index b76746f043b85..d933b0654e5f3 100644 --- a/recipes/grpc-proto/all/conandata.yml +++ b/recipes/grpc-proto/all/conandata.yml @@ -1,7 +1,7 @@ sources: - "cci.20211106": # Synced here https://github.com/grpc/grpc/pull/27957 - url: "https://github.com/grpc/grpc-proto/archive/8e3fec8612bc0708e857950dccadfd5063703e04.zip" - sha256: "8675b46d7997f9b6b80b37e8c30c359e0f919632ca3d8d6076944c7893c2d4cf" "cci.20220627": url: "https://github.com/grpc/grpc-proto/archive/d653c6d98105b2af937511aa6e46610c7e677e6e.zip" sha256: "365c0c8d9ae90aa11a8bd7fa870d8962a13600cfc851405acd5327907f9f4c56" + "cci.20211106": # Synced here https://github.com/grpc/grpc/pull/27957 + url: "https://github.com/grpc/grpc-proto/archive/8e3fec8612bc0708e857950dccadfd5063703e04.zip" + sha256: "8675b46d7997f9b6b80b37e8c30c359e0f919632ca3d8d6076944c7893c2d4cf" diff --git a/recipes/grpc-proto/all/conanfile.py b/recipes/grpc-proto/all/conanfile.py index aff2e90b78de9..e0de5ab7f7c55 100644 --- a/recipes/grpc-proto/all/conanfile.py +++ b/recipes/grpc-proto/all/conanfile.py @@ -1,74 +1,104 @@ -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 +import os + +from conan import ConanFile, conan_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.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import get, collect_libs, copy +from conan.tools.scm import Version from helpers import parse_proto_libraries +required_conan_version = ">=1.60.0 <2.0 || >=2.0.5" + 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" options = { - "shared": [True, False], - "fPIC": [True, False] - } + "shared": [True, False], + "fPIC": [True, False], + } default_options = { - "shared": False, - "fPIC": True - } + "shared": False, + "fPIC": True, + } exports = "helpers.py" - def export_sources(self): - self.copy("CMakeLists.txt") + @property + def _is_legacy_one_profile(self): + return not hasattr(self, "settings_build") - def source(self): - get(self, **self.conan_data["sources"][str(self.version)], destination=self.source_folder, strip_root=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 + self.options.rm_safe("fPIC") def configure(self): if self.options.shared: - del self.options.fPIC - self.options["protobuf"].shared = True - self.options["googleapis"].shared = True + self.options.rm_safe("fPIC") + if Version(conan_version) < "2.0.0": + self.options["protobuf"].shared = True + self.options["googleapis"].shared = True + else: + self.options["protobuf/*"].shared = True + self.options["googleapis/*"].shared = True - def validate(self): - if self.settings.compiler.cppstd: - tools.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 layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires('protobuf/3.21.4') - self.requires('googleapis/cci.20220711') + # protobuf symbols are exposed from generated structures + # https://github.com/conan-io/conan-center-index/pull/16185#issuecomment-1501174215 + self.requires("protobuf/3.21.12", transitive_headers=True, transitive_libs=True) + self.requires("googleapis/cci.20230501") + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) + + if self.options.shared and \ + not (self.dependencies["protobuf"].options.shared and self.dependencies["googleapis"].options.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 build_requirements(self): - self.build_requires('protobuf/3.21.4') + if not self._is_legacy_one_profile: + self.tool_requires("protobuf/") - @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 + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + if self._is_legacy_one_profile: + env = VirtualRunEnv(self) + env.generate(scope="build") + 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() + deps = CMakeDeps(self) + deps.generate() @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"] @@ -90,11 +120,13 @@ def activate_library(proto_library): return proto_libraries def build(self): + copy(self, "CMakeLists.txt", src=os.path.join(self.source_folder, os.pardir), dst=self.source_folder) proto_libraries = self._parse_proto_libraries() 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): @@ -108,11 +140,9 @@ def package(self): 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) - 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.libs = collect_libs(self) + self.cpp_info.resdirs = ["res"] + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.extend(["m"]) diff --git a/recipes/grpc-proto/all/test_package/CMakeLists.txt b/recipes/grpc-proto/all/test_package/CMakeLists.txt index ea5be5f993fd1..3ea2dba3ece4d 100644 --- a/recipes/grpc-proto/all/test_package/CMakeLists.txt +++ b/recipes/grpc-proto/all/test_package/CMakeLists.txt @@ -1,10 +1,8 @@ -cmake_minimum_required(VERSION 3.15) -project(test_package CXX) - -set(CMAKE_CXX_STANDARD 11) -set(CMAKE_CXX_STANDARD_REQUIRED ON) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(grpc-proto REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE grpc-proto::grpc-proto) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/grpc-proto/all/test_package/conanfile.py b/recipes/grpc-proto/all/test_package/conanfile.py index e279a6afcd236..3dd9c60ba6118 100644 --- a/recipes/grpc-proto/all/test_package/conanfile.py +++ b/recipes/grpc-proto/all/test_package/conanfile.py @@ -1,29 +1,25 @@ 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, cmake_layout class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) - - def generate(self): - tc = CMakeToolchain(self) - tc.generate() + 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): + 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-proto/config.yml b/recipes/grpc-proto/config.yml index a3f9e213cb226..89d36274b28d4 100644 --- a/recipes/grpc-proto/config.yml +++ b/recipes/grpc-proto/config.yml @@ -1,5 +1,5 @@ versions: - "cci.20211106": - folder: all "cci.20220627": folder: all + "cci.20211106": + folder: all diff --git a/recipes/grpc/all/CMakeLists.txt b/recipes/grpc/all/CMakeLists.txt deleted file mode 100644 index 8ad4fadf5f276..0000000000000 --- a/recipes/grpc/all/CMakeLists.txt +++ /dev/null @@ -1,26 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -find_package(grpc-proto CONFIG REQUIRED) -find_package(googleapis CONFIG REQUIRED) - -set(googleapis_RES_DIRS - $<$:${googleapis_RES_DIRS_RELEASE}> - $<$:${googleapis_RES_DIRS_RELWITHDEBINFO}> - $<$:${googleapis_RES_DIRS_MINSIZEREL}> - $<$:${googleapis_RES_DIRS_DEBUG}>) -set(grpc-proto_RES_DIRS - $<$:${grpc-proto_RES_DIRS_RELEASE}> - $<$:${grpc-proto_RES_DIRS_RELWITHDEBINFO}> - $<$:${grpc-proto_RES_DIRS_MINSIZEREL}> - $<$:${grpc-proto_RES_DIRS_DEBUG}>) - -add_subdirectory("source_subfolder") - -# TODO: move to a patch? It avoids link errors while resolving abseil symbols with gcc -if (TARGET check_epollexclusive) - set_target_properties(check_epollexclusive PROPERTIES LINKER_LANGUAGE CXX) -endif() diff --git a/recipes/grpc/all/cmake/grpc_plugin_template.cmake.in b/recipes/grpc/all/cmake/grpc_plugin_template.cmake.in index 4685c5c34b8fc..5ab1d94fab8cd 100644 --- a/recipes/grpc/all/cmake/grpc_plugin_template.cmake.in +++ b/recipes/grpc/all/cmake/grpc_plugin_template.cmake.in @@ -1,28 +1,28 @@ if(NOT TARGET @target_name@) + # Find @executable_name@ + ## Workaround for legacy "cmake" generator in case of cross-build if(CMAKE_CROSSCOMPILING) find_program(@find_program_variable@ NAMES @executable_name@ PATHS ENV PATH NO_DEFAULT_PATH ) - else() + endif() + ## And here this will work fine with "CMakeToolchain" (for native & cross-build) + ## and legacy "cmake" generator in case of native build + if(NOT @find_program_variable@) + find_program(@find_program_variable@ NAMES @executable_name@) + endif() + ## Last resort: we search in package folder directly + if(NOT @find_program_variable@) find_program(@find_program_variable@ NAMES @executable_name@ PATHS "${CMAKE_CURRENT_LIST_DIR}/@relative_path@bin/" NO_DEFAULT_PATH ) endif() - # TODO: In conan v2 with CMakeToolchain, can be replaced by: - # find_program(@find_program_variable@ NAMES @executable_name@)) - # # Nice enough to handle grpc not in build_requires for native build - # if(NOT @find_program_variable@ AND NOT CMAKE_CROSSCOMPILING) - # find_program(@find_program_variable@ - # NAMES @executable_name@ - # PATHS "${CMAKE_CURRENT_LIST_DIR}/@relative_path@bin/" - # NO_DEFAULT_PATH - # ) - # endif() + # Define @target_name@ imported target if(@find_program_variable@) get_filename_component(@find_program_variable@ "${@find_program_variable@}" ABSOLUTE) add_executable(@target_name@ IMPORTED) diff --git a/recipes/grpc/all/conan_cmake_project_include.cmake b/recipes/grpc/all/conan_cmake_project_include.cmake new file mode 100644 index 0000000000000..0d23c71e319ad --- /dev/null +++ b/recipes/grpc/all/conan_cmake_project_include.cmake @@ -0,0 +1,4 @@ +# TODO: move to a patch? It avoids link errors while resolving abseil symbols with gcc +if (TARGET check_epollexclusive) + set_target_properties(check_epollexclusive PROPERTIES LINKER_LANGUAGE CXX) +endif() diff --git a/recipes/grpc/all/conandata.yml b/recipes/grpc/all/conandata.yml index 7dec80ae52456..bffed171ed04e 100644 --- a/recipes/grpc/all/conandata.yml +++ b/recipes/grpc/all/conandata.yml @@ -1,42 +1,25 @@ sources: + "1.67.1": + url: "https://github.com/grpc/grpc/archive/v1.67.1.tar.gz" + sha256: "d74f8e99a433982a12d7899f6773e285c9824e1d9a173ea1d1fb26c9bd089299" + "1.65.0": + url: "https://github.com/grpc/grpc/archive/v1.65.0.tar.gz" + sha256: "ebc3acfde70cfae3f4f04b8dbb72259540cb1dc427be362569fbc2607dabfe39" + "1.54.3": + url: "https://github.com/grpc/grpc/archive/v1.54.3.tar.gz" + sha256: "17e4e1b100657b88027721220cbfb694d86c4b807e9257eaf2fb2d273b41b1b1" "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" - "1.47.1": - url: "https://github.com/grpc/grpc/archive/v1.47.1.tar.gz" - sha256: "ba7c36989ad8a52c813adeebb0c65869283448f496dbb2868c75f69941dec6a9" - "1.46.3": - url: "https://github.com/grpc/grpc/archive/refs/tags/v1.46.3.tar.gz" - sha256: "d6cbf22cb5007af71b61c6be316a79397469c58c82a942552a62e708bce60964" patches: + "1.54.3": + - patch_file: "patches/v1.50.x/002-CMake-Add-gRPC_USE_SYSTEMD-option-34384.patch" + patch_type: "backport" + patch_source: "https://github.com/grpc/grpc/commit/5c3400e8dc08d0810e3301d7e8cd8a718c82eeed" "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" - - patch_file: "patches/v1.48.x/002-consume-protos-from-requirements.patch" - base_path: "source_subfolder" - "1.47.1": - - patch_file: "patches/v1.47.x/001-disable-cppstd-override.patch" - base_path: "source_subfolder" - - patch_file: "patches/v1.47.x/002-consume-protos-from-requirements.patch" - base_path: "source_subfolder" - "1.46.3": - - patch_file: "patches/v1.46.x/001-disable-cppstd-override.patch" - base_path: "source_subfolder" - - patch_file: "patches/v1.46.x/002-consume-protos-from-requirements.patch" - base_path: "source_subfolder" diff --git a/recipes/grpc/all/conanfile.py b/recipes/grpc/all/conanfile.py index b6bf2b1a2b355..0369581dce144 100644 --- a/recipes/grpc/all/conanfile.py +++ b/recipes/grpc/all/conanfile.py @@ -1,25 +1,28 @@ +import os +import yaml + 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.cmake import cmake_layout, CMake, CMakeToolchain, CMakeDeps +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv 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 CMake -import os -import shutil -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.60.0 <2 || >=2.0.5" -class grpcConan(ConanFile): +class GrpcConan(ConanFile): name = "grpc" description = "Google's RPC (remote procedure call) library and framework." license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/grpc/grpc" - topics = ("rpc") + topics = ("rpc",) + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { @@ -34,7 +37,9 @@ class grpcConan(ConanFile): "php_plugin": [True, False], "python_plugin": [True, False], "ruby_plugin": [True, False], - "secure": [True, False] + "otel_plugin": [True, False], + "secure": [True, False], + "with_libsystemd": [True, False] } default_options = { "shared": False, @@ -48,20 +53,13 @@ class grpcConan(ConanFile): "php_plugin": True, "python_plugin": True, "ruby_plugin": True, + "otel_plugin": False, "secure": False, + "with_libsystemd": True } 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" + _target_info = None @property def _grpc_plugin_template(self): @@ -71,77 +69,98 @@ def _grpc_plugin_template(self): def _cxxstd_required(self): return 14 if Version(self.version) >= "1.47" else 11 + @property + def _is_legacy_one_profile(self): + return not hasattr(self, "settings_build") + + @property + def _supports_libsystemd(self): + return self.settings.os in ["Linux", "FreeBSD"] and Version(self.version) >= "1.52" + + def export(self): + copy(self, f"target_info/grpc_{self.version}.yml", src=self.recipe_folder, dst=self.export_folder) + def export_sources(self): - 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) + copy(self, "conan_cmake_project_include.cmake", self.recipe_folder, os.path.join(self.export_sources_folder, "src")) + copy(self, f"cmake/{self._grpc_plugin_template}", self.recipe_folder, os.path.join(self.export_sources_folder, "src")) export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + if not self._supports_libsystemd: + del self.options.with_libsystemd + if Version(self.version) < "1.65.0": + del self.options.otel_plugin def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") self.options["protobuf"].shared = True - self.options["googleapis"].shared = True - self.options["grpc-proto"].shared = True + + if cross_building(self): + self.options["grpc"].shared = True def layout(self): - pass + cmake_layout(self, src_folder="src") def requirements(self): - if is_msvc(self) and Version(self.version) < "1.47": - self.requires("abseil/20211102.0") + # abseil requires: + # transitive_headers=True because grpc headers include abseil headers + # transitive_libs=True because generated code (grpc_cpp_plugin) require symbols from abseil + if Version(self.version) >= "1.62.0": + self.requires("protobuf/5.27.0", transitive_headers=True) + self.requires("abseil/[>=20240116.1 <20240117.0]", transitive_headers=True, transitive_libs=True) else: - self.requires("abseil/20220623.0") - self.requires("c-ares/1.18.1") - self.requires("openssl/1.1.1s") - self.requires("re2/20220601") - self.requires("zlib/1.2.13") - self.requires("protobuf/3.21.4") - self.requires("googleapis/cci.20220711") - self.requires("grpc-proto/cci.20220627") + self.requires("abseil/[>=20230125.3 <=20230802.1]", transitive_headers=True, transitive_libs=True) + self.requires("protobuf/3.21.12", transitive_headers=True) + self.requires("c-ares/[>=1.19.1 <2]") + self.requires("openssl/[>=1.1 <4]") + self.requires("re2/20230301") + self.requires("zlib/[>=1.2.11 <2]") + if self.options.get_safe("with_libsystemd"): + if Version(self.version) >= "1.67.0": + self.requires("libsystemd/255.10") + else: + self.requires("libsystemd/255") + if self.options.get_safe("otel_plugin"): + self.requires("opentelemetry-cpp/1.14.2") def package_id(self): del self.info.options.secure - self.info.requires["protobuf"].full_package_mode() def validate(self): check_min_vs(self, "190") - if is_msvc(self) and self.info.options.shared: + if is_msvc(self) and self.options.shared: raise ConanInvalidConfiguration(f"{self.ref} shared not supported by Visual Studio") - if Version(self.version) >= "1.47" and self.info.settings.compiler == "gcc" and Version(self.info.settings.compiler.version) < "6": + 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") - if self.info.settings.compiler.get_safe("cppstd"): + if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, self._cxxstd_required) - 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): + if self.options.shared and not self.dependencies.host["protobuf"].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`", + "If built as shared protobuf must be shared as well. " + "Please, use `protobuf:shared=True`.", ) def build_requirements(self): - if hasattr(self, "settings_build"): - self.build_requires('protobuf/3.21.4') + if not self._is_legacy_one_profile: + self.tool_requires("protobuf/") + if cross_building(self): # when cross compiling we need pre compiled grpc plugins for protoc - if cross_building(self): - self.build_requires('grpc/{}'.format(self.version)) + self.tool_requires(f"grpc/{self.version}") 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 _configure_cmake(self): - if self._cmake is not None: - return self._cmake + def generate(self): + # Set up environment so that we can run grpc-cpp-plugin at build time + VirtualBuildEnv(self).generate() + if self._is_legacy_one_profile: + VirtualRunEnv(self).generate(scope="build") # This doesn't work yet as one would expect, because the install target builds everything # and we need the install target because of the generated CMake files @@ -149,125 +168,117 @@ def _configure_cmake(self): # enable_mobile=False # Enables iOS and Android support # # cmake.definitions["CONAN_ENABLE_MOBILE"] = "ON" if self.options.csharp_ext else "OFF" + tc = CMakeToolchain(self) + + tc.cache_variables["CMAKE_PROJECT_grpc_INCLUDE"] = os.path.join(self.source_folder, "conan_cmake_project_include.cmake") - self._cmake = CMake(self) - self._cmake.definitions["gRPC_BUILD_CODEGEN"] = self.options.codegen - self._cmake.definitions["gRPC_BUILD_CSHARP_EXT"] = self.options.csharp_ext - self._cmake.definitions["gRPC_BUILD_TESTS"] = False + tc.cache_variables["gRPC_BUILD_CODEGEN"] = self.options.codegen + tc.cache_variables["gRPC_BUILD_CSHARP_EXT"] = self.options.csharp_ext + tc.cache_variables["gRPC_BUILD_TESTS"] = "OFF" # We need the generated cmake/ files (bc they depend on the list of targets, which is dynamic) - self._cmake.definitions["gRPC_INSTALL"] = True - self._cmake.definitions["gRPC_INSTALL_SHAREDIR"] = "res/grpc" + tc.cache_variables["gRPC_INSTALL"] = True + tc.cache_variables["gRPC_INSTALL_SHAREDIR"] = "res/grpc" # tell grpc to use the find_package versions - self._cmake.definitions["gRPC_ZLIB_PROVIDER"] = "package" - self._cmake.definitions["gRPC_CARES_PROVIDER"] = "package" - self._cmake.definitions["gRPC_RE2_PROVIDER"] = "package" - self._cmake.definitions["gRPC_SSL_PROVIDER"] = "package" - self._cmake.definitions["gRPC_PROTOBUF_PROVIDER"] = "package" - self._cmake.definitions["gRPC_ABSL_PROVIDER"] = "package" - - self._cmake.definitions["gRPC_BUILD_GRPC_CPP_PLUGIN"] = self.options.cpp_plugin - self._cmake.definitions["gRPC_BUILD_GRPC_CSHARP_PLUGIN"] = self.options.csharp_plugin - self._cmake.definitions["gRPC_BUILD_GRPC_NODE_PLUGIN"] = self.options.node_plugin - self._cmake.definitions["gRPC_BUILD_GRPC_OBJECTIVE_C_PLUGIN"] = self.options.objective_c_plugin - self._cmake.definitions["gRPC_BUILD_GRPC_PHP_PLUGIN"] = self.options.php_plugin - self._cmake.definitions["gRPC_BUILD_GRPC_PYTHON_PLUGIN"] = self.options.python_plugin - self._cmake.definitions["gRPC_BUILD_GRPC_RUBY_PLUGIN"] = self.options.ruby_plugin + tc.cache_variables["gRPC_ZLIB_PROVIDER"] = "package" + tc.cache_variables["gRPC_CARES_PROVIDER"] = "package" + tc.cache_variables["gRPC_RE2_PROVIDER"] = "package" + tc.cache_variables["gRPC_SSL_PROVIDER"] = "package" + tc.cache_variables["gRPC_PROTOBUF_PROVIDER"] = "package" + tc.cache_variables["gRPC_ABSL_PROVIDER"] = "package" + tc.cache_variables["gRPC_OPENTELEMETRY_PROVIDER"] = "package" + + tc.cache_variables["gRPC_BUILD_GRPC_CPP_PLUGIN"] = self.options.cpp_plugin + tc.cache_variables["gRPC_BUILD_GRPC_CSHARP_PLUGIN"] = self.options.csharp_plugin + tc.cache_variables["gRPC_BUILD_GRPC_NODE_PLUGIN"] = self.options.node_plugin + tc.cache_variables["gRPC_BUILD_GRPC_OBJECTIVE_C_PLUGIN"] = self.options.objective_c_plugin + tc.cache_variables["gRPC_BUILD_GRPC_PHP_PLUGIN"] = self.options.php_plugin + tc.cache_variables["gRPC_BUILD_GRPC_PYTHON_PLUGIN"] = self.options.python_plugin + tc.cache_variables["gRPC_BUILD_GRPC_RUBY_PLUGIN"] = self.options.ruby_plugin + tc.cache_variables["gRPC_BUILD_GRPCPP_OTEL_PLUGIN"] = self.options.get_safe("otel_plugin", False) # Consumed targets (abseil) via interface target_compiler_feature can propagate newer standards if not valid_min_cppstd(self, self._cxxstd_required): - self._cmake.definitions["CMAKE_CXX_STANDARD"] = self._cxxstd_required - - 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" + tc.cache_variables["CMAKE_CXX_STANDARD"] = self._cxxstd_required if is_apple_os(self): # workaround for: install TARGETS given no BUNDLE DESTINATION for MACOSX_BUNDLE executable - self._cmake.definitions["CMAKE_MACOSX_BUNDLE"] = False + tc.cache_variables["CMAKE_MACOSX_BUNDLE"] = False - if is_msvc(self) and Version(self.version) >= "1.48": - self._cmake.definitions["CMAKE_SYSTEM_VERSION"] = "10.0.18362.0" + if self._supports_libsystemd: + tc.cache_variables["gRPC_USE_SYSTEMD"] = self.options.with_libsystemd - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + if Version(self.version) >= "1.62.0": + tc.cache_variables["gRPC_DOWNLOAD_ARCHIVES"] = False - def _patch_sources(self): - apply_conandata_patches(self) + tc.generate() - # Clean existing proto files, they will be taken from requirements - shutil.rmtree(os.path.join(self._source_subfolder, "src", "proto", "grpc")) + cmake_deps = CMakeDeps(self) + cmake_deps.generate() - if Version(self.version) >= "1.47": - # Take googleapis from requirement instead of vendored/hardcoded version - 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" - ) + def _patch_sources(self): + apply_conandata_patches(self) - # 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) - 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 $)" - ) + # On macOS if all the following are true: + # - protoc from protobuf has shared library dependencies + # - grpc_cpp_plugin has shared library deps (when crossbuilding) + # - using `make` as the cmake generator + # Make will run commands via `/bin/sh` which will strip all env vars that start with `DYLD*` + # This workaround wraps the protoc command to be invoked by CMake with a modified environment + cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") + settings_build = getattr(self, "settings_build", self.settings) + if settings_build.os == "Macos": + replace_in_file(self, cmakelists, + "COMMAND ${_gRPC_PROTOBUF_PROTOC_EXECUTABLE}", + 'COMMAND ${CMAKE_COMMAND} -E env "DYLD_LIBRARY_PATH=$ENV{DYLD_LIBRARY_PATH}" ${_gRPC_PROTOBUF_PROTOC_EXECUTABLE}') + elif not cross_building(self) and settings_build.os == "Linux": + # we are not cross-building, but protobuf or abseil may be shared + # so we need to set LD_LIBRARY_PATH to find them + # Note: if protobuf used RPATH instead of RUNPATH this is not needed + replace_in_file(self, cmakelists, + "COMMAND ${_gRPC_PROTOBUF_PROTOC_EXECUTABLE}", + 'COMMAND ${CMAKE_COMMAND} -E env "LD_LIBRARY_PATH=$:$ENV{LD_LIBRARY_PATH}" ${_gRPC_PROTOBUF_PROTOC_EXECUTABLE}') + if self.settings.os == "Macos" and Version(self.version) >= "1.64": + # See https://github.com/grpc/grpc/issues/36654#issuecomment-2228569158 + replace_in_file(self, cmakelists, "target_compile_features(upb_textformat_lib PUBLIC cxx_std_14)", + """target_compile_features(upb_textformat_lib PUBLIC cxx_std_14) + target_link_options(upb_textformat_lib PRIVATE -Wl,-undefined,dynamic_lookup) + target_link_options(upb_json_lib PRIVATE -Wl,-undefined,dynamic_lookup) + """) def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() + @property + def target_info(self): + if self._target_info: + return self._target_info + target_info_file = os.path.join(self.recipe_folder, "target_info", f"grpc_{self.version}.yml") + with open(target_info_file) as f: + self._target_info = yaml.safe_load(f) + return self._target_info + 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() 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 - for plugin_option, values in self._grpc_plugins.items(): - if self.options.get_safe(plugin_option): - target = values["target"] - executable = values["executable"] + # CMake executables imported targets of grpc plugins. + for plugin_info in self.target_info["grpc_plugins"]: + target = plugin_info["target"] + executable = plugin_info["executable"] + option_name = executable.replace("grpc_", "") + if self.options.get_safe(option_name): self._create_executable_module_file(target, executable) - @property - def _grpc_plugins(self): - return { - "cpp_plugin": { - "target": "gRPC::grpc_cpp_plugin", - "executable": "grpc_cpp_plugin", - }, - "csharp_plugin": { - "target": "gRPC::grpc_csharp_plugin", - "executable": "grpc_csharp_plugin", - }, - "node_plugin": { - "target": "gRPC::grpc_node_plugin", - "executable": "grpc_node_plugin", - }, - "objective_c_plugin": { - "target": "gRPC::grpc_objective_c_plugin", - "executable": "grpc_objective_c_plugin", - }, - "php_plugin": { - "target": "gRPC::grpc_php_plugin", - "executable": "grpc_php_plugin", - }, - "python_plugin": { - "target": "gRPC::grpc_python_plugin", - "executable": "grpc_python_plugin", - }, - "ruby_plugin": { - "target": "gRPC::grpc_ruby_plugin", - "executable": "grpc_ruby_plugin", - }, - } - def _create_executable_module_file(self, target, executable): module_abs_path = os.path.join(self.package_folder, self._module_path) @@ -295,6 +306,10 @@ def _module_path(self): @property def _grpc_components(self): + + def libsystemd(): + return ["libsystemd::libsystemd"] if self._supports_libsystemd and self.options.with_libsystemd else [] + def libm(): return ["m"] if self.settings.os in ["Linux", "FreeBSD"] else [] @@ -310,95 +325,19 @@ def ws2_32(): def wsock32(): return ["wsock32"] if self.settings.os == "Windows" else [] - def corefoundation(): - return ["CoreFoundation"] if is_apple_os(self) else [] - - components = { - "address_sorting": { - "lib": "address_sorting", - "system_libs": libm() + pthread() + crypt32() + ws2_32() + wsock32(), - }, - "gpr": { - "lib": "gpr", - "requires": [ - "upb", "abseil::absl_base", "abseil::absl_memory", - "abseil::absl_status", "abseil::absl_str_format", - "abseil::absl_strings", "abseil::absl_synchronization", - "abseil::absl_time", "abseil::absl_optional", - ], - "system_libs": libm() + pthread() + crypt32() + ws2_32() + wsock32(), - }, - "_grpc": { - "lib": "grpc", - "requires": [ - "address_sorting", "gpr", "upb", "abseil::absl_bind_front", - "abseil::absl_flat_hash_map", "abseil::absl_inlined_vector", - "abseil::absl_statusor", "abseil::absl_random_random", - "c-ares::cares", "openssl::crypto", - "openssl::ssl", "re2::re2", "zlib::zlib", - ], - "system_libs": libm() + pthread() + crypt32() + ws2_32() + wsock32(), - "frameworks": corefoundation(), - }, - "grpc++": { - "lib": "grpc++", - "requires": ["_grpc", "protobuf::libprotobuf"], - "system_libs": libm() + pthread() + crypt32() + ws2_32() + wsock32(), - }, - "grpc++_alts": { - "lib": "grpc++_alts", - "requires": ["grpc++", "protobuf::libprotobuf"], + targets = self.target_info['grpc_targets'] + components = {} + for target in targets: + if self.options.secure and target['name'] in ["grpc_unsecure", "grpc++_unsecure"]: + continue + if not self.options.codegen and target['name'] in ["grpc++_reflection", "grpcpp_channelz"]: + continue + components[target['name']] = { + "lib": target['lib'], + "requires": target.get('requires', []) + libsystemd(), "system_libs": libm() + pthread() + crypt32() + ws2_32() + wsock32(), - }, - "grpc++_error_details": { - "lib": "grpc++_error_details", - "requires": ["grpc++", "protobuf::libprotobuf"], - "system_libs": libm() + pthread() + crypt32() + ws2_32() + wsock32(), - }, - "upb": { - "lib": "upb", - "system_libs": libm() + pthread() + crypt32() + ws2_32() + wsock32(), - }, - "grpc_plugin_support": { - "lib": "grpc_plugin_support", - "requires": ["protobuf::libprotoc", "protobuf::libprotobuf"], - "system_libs": libm() + pthread() + crypt32() + ws2_32() + wsock32(), - }, - } - - if not self.options.secure: - components.update({ - "grpc_unsecure": { - "lib": "grpc_unsecure", - "requires": [ - "address_sorting", "gpr", "upb", "abseil::absl_flat_hash_map", - "abseil::absl_inlined_vector", "abseil::absl_statusor", - "c-ares::cares", "re2::re2", "zlib::zlib", - "abseil::absl_random_random", - ], - "system_libs": libm() + pthread() + crypt32() + ws2_32() + wsock32(), - "frameworks": corefoundation(), - }, - "grpc++_unsecure": { - "lib": "grpc++_unsecure", - "requires": ["grpc_unsecure", "protobuf::libprotobuf"], - "system_libs": libm() + pthread() + crypt32() + ws2_32() + wsock32(), - }, - }) - - if self.options.codegen: - components.update({ - "grpc++_reflection": { - "lib": "grpc++_reflection", - "requires": ["grpc++", "protobuf::libprotobuf", "grpc-proto::grpc-proto", "googleapis::googleapis"], - "system_libs": libm() + pthread() + crypt32() + ws2_32() + wsock32(), - }, - "grpcpp_channelz": { - "lib": "grpcpp_channelz", - "requires": ["grpc++", "protobuf::libprotobuf", "grpc-proto::grpc-proto", "googleapis::googleapis"], - "system_libs": libm() + pthread() + crypt32() + ws2_32() + wsock32(), - }, - }) + "frameworks": target.get('frameworks', []), + } return components @@ -407,7 +346,6 @@ def package_info(self): 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? for component, values in self._grpc_components.items(): target = values.get("lib") @@ -427,20 +365,19 @@ def package_info(self): # Executable imported targets are added through custom CMake module files, # since conan generators don't know how to emulate these kind of targets. grpc_modules = [] - for plugin_option, values in self._grpc_plugins.items(): - if self.options.get_safe(plugin_option): - grpc_module_filename = "{}.cmake".format(values["executable"]) + for plugin_info in self.target_info["grpc_plugins"]: + executable = plugin_info["executable"] + option_name = executable.replace("grpc_", "") + if self.options.get_safe(option_name): + grpc_module_filename = "{}.cmake".format(executable) grpc_modules.append(os.path.join(self._module_path, grpc_module_filename)) self.cpp_info.set_property("cmake_build_modules", grpc_modules) - if any(self.options.get_safe(plugin_option) for plugin_option in self._grpc_plugins.keys()): - 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_* generators removed + # TODO: to remove once conan v1 not supported anymore self.cpp_info.names["cmake_find_package"] = "gRPC" self.cpp_info.names["cmake_find_package_multi"] = "gRPC" + self.env_info.GRPC_DEFAULT_SSL_ROOTS_FILE_PATH = ssl_roots_file_path if grpc_modules: self.cpp_info.components["grpc_execs"].build_modules["cmake_find_package"] = grpc_modules self.cpp_info.components["grpc_execs"].build_modules["cmake_find_package_multi"] = grpc_modules + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/grpc/all/patches/v1.46.x/001-disable-cppstd-override.patch b/recipes/grpc/all/patches/v1.46.x/001-disable-cppstd-override.patch deleted file mode 100644 index a260124675947..0000000000000 --- a/recipes/grpc/all/patches/v1.46.x/001-disable-cppstd-override.patch +++ /dev/null @@ -1,26 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 7a97604b75..7ae815042f 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -222,21 +222,6 @@ if (NOT DEFINED CMAKE_C_STANDARD) - set(CMAKE_C_STANDARD 99) - endif() - --# Add c++11 flags --if (NOT DEFINED CMAKE_CXX_STANDARD) -- set(CMAKE_CXX_STANDARD 11) --else() -- if (CMAKE_CXX_STANDARD LESS 11) -- message(FATAL_ERROR "CMAKE_CXX_STANDARD is less than 11, please specify at least SET(CMAKE_CXX_STANDARD 11)") -- 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.46.x/002-consume-protos-from-requirements.patch b/recipes/grpc/all/patches/v1.46.x/002-consume-protos-from-requirements.patch deleted file mode 100644 index ff27fa43b34ea..0000000000000 --- a/recipes/grpc/all/patches/v1.46.x/002-consume-protos-from-requirements.patch +++ /dev/null @@ -1,290 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 2db10e5..612d2cf 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -329,7 +329,7 @@ function(protobuf_generate_grpc_cpp) - return() - endif() - -- 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}) - foreach(FIL ${ARGN}) - get_filename_component(ABS_FIL ${FIL} ABSOLUTE) - get_filename_component(FIL_WE ${FIL} NAME_WE) -@@ -348,18 +348,15 @@ function(protobuf_generate_grpc_cpp) - 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 ${ABS_FIL} ${_gRPC_PROTOBUF_PROTOC} ${_gRPC_CPP_PLUGIN} -+ ${FIL} -+ DEPENDS ${_gRPC_PROTOBUF_PROTOC} ${_gRPC_CPP_PLUGIN} - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - COMMENT "Running gRPC C++ protocol buffer compiler on ${FIL}" -- VERBATIM) -+ ) - endforeach() - endfunction() - -@@ -413,178 +410,28 @@ add_custom_target(tools - DEPENDS tools_c tools_cxx) - - protobuf_generate_grpc_cpp( -- src/proto/grpc/channelz/channelz.proto -+ grpc/channelz/v1/channelz.proto - ) - protobuf_generate_grpc_cpp( -- src/proto/grpc/core/stats.proto -+ grpc/core/stats.proto - ) - protobuf_generate_grpc_cpp( -- src/proto/grpc/health/v1/health.proto -+ grpc/health/v1/health.proto - ) - protobuf_generate_grpc_cpp( -- src/proto/grpc/lb/v1/load_balancer.proto -+ grpc/lb/v1/load_balancer.proto - ) - protobuf_generate_grpc_cpp( -- src/proto/grpc/lookup/v1/rls.proto -+ grpc/lookup/v1/rls.proto - ) - protobuf_generate_grpc_cpp( -- src/proto/grpc/lookup/v1/rls_config.proto -+ grpc/lookup/v1/rls_config.proto - ) - protobuf_generate_grpc_cpp( -- src/proto/grpc/reflection/v1alpha/reflection.proto -+ grpc/reflection/v1alpha/reflection.proto - ) - protobuf_generate_grpc_cpp( -- src/proto/grpc/status/status.proto --) --protobuf_generate_grpc_cpp( -- src/proto/grpc/testing/benchmark_service.proto --) --protobuf_generate_grpc_cpp( -- src/proto/grpc/testing/control.proto --) --protobuf_generate_grpc_cpp( -- src/proto/grpc/testing/duplicate/echo_duplicate.proto --) --protobuf_generate_grpc_cpp( -- src/proto/grpc/testing/echo.proto --) --protobuf_generate_grpc_cpp( -- src/proto/grpc/testing/echo_messages.proto --) --protobuf_generate_grpc_cpp( -- src/proto/grpc/testing/empty.proto --) --protobuf_generate_grpc_cpp( -- src/proto/grpc/testing/messages.proto --) --protobuf_generate_grpc_cpp( -- src/proto/grpc/testing/payloads.proto --) --protobuf_generate_grpc_cpp( -- src/proto/grpc/testing/report_qps_scenario_service.proto --) --protobuf_generate_grpc_cpp( -- src/proto/grpc/testing/simple_messages.proto --) --protobuf_generate_grpc_cpp( -- src/proto/grpc/testing/stats.proto --) --protobuf_generate_grpc_cpp( -- src/proto/grpc/testing/test.proto --) --protobuf_generate_grpc_cpp( -- src/proto/grpc/testing/worker_service.proto --) --protobuf_generate_grpc_cpp( -- src/proto/grpc/testing/xds/ads_for_test.proto --) --protobuf_generate_grpc_cpp( -- src/proto/grpc/testing/xds/cds_for_test.proto --) --protobuf_generate_grpc_cpp( -- src/proto/grpc/testing/xds/eds_for_test.proto --) --protobuf_generate_grpc_cpp( -- src/proto/grpc/testing/xds/lds_rds_for_test.proto --) --protobuf_generate_grpc_cpp( -- src/proto/grpc/testing/xds/lrs_for_test.proto --) --protobuf_generate_grpc_cpp( -- src/proto/grpc/testing/xds/v3/address.proto --) --protobuf_generate_grpc_cpp( -- src/proto/grpc/testing/xds/v3/ads.proto --) --protobuf_generate_grpc_cpp( -- src/proto/grpc/testing/xds/v3/aggregate_cluster.proto --) --protobuf_generate_grpc_cpp( -- src/proto/grpc/testing/xds/v3/base.proto --) --protobuf_generate_grpc_cpp( -- src/proto/grpc/testing/xds/v3/cluster.proto --) --protobuf_generate_grpc_cpp( -- src/proto/grpc/testing/xds/v3/config_dump.proto --) --protobuf_generate_grpc_cpp( -- src/proto/grpc/testing/xds/v3/config_source.proto --) --protobuf_generate_grpc_cpp( -- src/proto/grpc/testing/xds/v3/csds.proto --) --protobuf_generate_grpc_cpp( -- src/proto/grpc/testing/xds/v3/discovery.proto --) --protobuf_generate_grpc_cpp( -- src/proto/grpc/testing/xds/v3/endpoint.proto --) --protobuf_generate_grpc_cpp( -- src/proto/grpc/testing/xds/v3/expr.proto --) --protobuf_generate_grpc_cpp( -- src/proto/grpc/testing/xds/v3/extension.proto --) --protobuf_generate_grpc_cpp( -- src/proto/grpc/testing/xds/v3/fault.proto --) --protobuf_generate_grpc_cpp( -- src/proto/grpc/testing/xds/v3/fault_common.proto --) --protobuf_generate_grpc_cpp( -- src/proto/grpc/testing/xds/v3/http_connection_manager.proto --) --protobuf_generate_grpc_cpp( -- src/proto/grpc/testing/xds/v3/http_filter_rbac.proto --) --protobuf_generate_grpc_cpp( -- src/proto/grpc/testing/xds/v3/listener.proto --) --protobuf_generate_grpc_cpp( -- src/proto/grpc/testing/xds/v3/load_report.proto --) --protobuf_generate_grpc_cpp( -- src/proto/grpc/testing/xds/v3/lrs.proto --) --protobuf_generate_grpc_cpp( -- src/proto/grpc/testing/xds/v3/metadata.proto --) --protobuf_generate_grpc_cpp( -- src/proto/grpc/testing/xds/v3/orca_load_report.proto --) --protobuf_generate_grpc_cpp( -- src/proto/grpc/testing/xds/v3/orca_service.proto --) --protobuf_generate_grpc_cpp( -- src/proto/grpc/testing/xds/v3/path.proto --) --protobuf_generate_grpc_cpp( -- src/proto/grpc/testing/xds/v3/percent.proto --) --protobuf_generate_grpc_cpp( -- src/proto/grpc/testing/xds/v3/protocol.proto --) --protobuf_generate_grpc_cpp( -- src/proto/grpc/testing/xds/v3/range.proto --) --protobuf_generate_grpc_cpp( -- src/proto/grpc/testing/xds/v3/rbac.proto --) --protobuf_generate_grpc_cpp( -- src/proto/grpc/testing/xds/v3/regex.proto --) --protobuf_generate_grpc_cpp( -- src/proto/grpc/testing/xds/v3/route.proto --) --protobuf_generate_grpc_cpp( -- src/proto/grpc/testing/xds/v3/router.proto --) --protobuf_generate_grpc_cpp( -- src/proto/grpc/testing/xds/v3/string.proto --) --protobuf_generate_grpc_cpp( -- src/proto/grpc/testing/xds/v3/tls.proto -+ grpc/status/status.proto - ) - protobuf_generate_grpc_cpp( - test/core/tsi/alts/fake_handshaker/handshaker.proto -@@ -3275,10 +3122,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 - ) -@@ -3317,6 +3162,7 @@ target_link_libraries(grpc++_reflection - ${_gRPC_PROTOBUF_LIBRARIES} - ${_gRPC_ALLTARGETS_LIBRARIES} - grpc++ -+ grpc-proto::grpc-proto - ) - - foreach(_hdr -@@ -3872,10 +3718,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 - ) -@@ -3914,6 +3758,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 04f1e63..82837e8 100644 ---- a/src/cpp/ext/proto_server_reflection.h -+++ b/src/cpp/ext/proto_server_reflection.h -@@ -24,7 +24,7 @@ - - #include - --#include "src/proto/grpc/reflection/v1alpha/reflection.grpc.pb.h" -+#include "grpc/reflection/v1alpha/reflection.grpc.pb.h" - - namespace grpc { - -diff --git a/src/cpp/server/channelz/channelz_service.h b/src/cpp/server/channelz/channelz_service.h -index 824f0a9..bfa31a1 100644 ---- a/src/cpp/server/channelz/channelz_service.h -+++ b/src/cpp/server/channelz/channelz_service.h -@@ -23,7 +23,7 @@ - - #include - --#include "src/proto/grpc/channelz/channelz.grpc.pb.h" -+#include "grpc/channelz/v1/channelz.grpc.pb.h" - - namespace grpc { - diff --git a/recipes/grpc/all/patches/v1.47.x/001-disable-cppstd-override.patch b/recipes/grpc/all/patches/v1.47.x/001-disable-cppstd-override.patch deleted file mode 100644 index 0ba329e6480bc..0000000000000 --- a/recipes/grpc/all/patches/v1.47.x/001-disable-cppstd-override.patch +++ /dev/null @@ -1,31 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index db075cbe4a..289cc52215 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -220,26 +220,6 @@ if(WIN32) - set(_gRPC_PLATFORM_WINDOWS ON) - endif() - -- # Use C11 standard --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.47.x/002-consume-protos-from-requirements.patch b/recipes/grpc/all/patches/v1.47.x/002-consume-protos-from-requirements.patch deleted file mode 100644 index 9ead7f09de502..0000000000000 --- a/recipes/grpc/all/patches/v1.47.x/002-consume-protos-from-requirements.patch +++ /dev/null @@ -1,309 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index c1eaeba..706e6d1 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -445,7 +445,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 -@@ -470,8 +470,8 @@ 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}) -+ # 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) -@@ -484,18 +484,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 -@@ -548,181 +545,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/messages.proto src/proto/grpc/testing/messages.proto --) --protobuf_generate_grpc_cpp_with_import_path_correction( -- src/proto/grpc/testing/payloads.proto src/proto/grpc/testing/payloads.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 --) --protobuf_generate_grpc_cpp_with_import_path_correction( -- src/proto/grpc/testing/simple_messages.proto src/proto/grpc/testing/simple_messages.proto --) --protobuf_generate_grpc_cpp_with_import_path_correction( -- src/proto/grpc/testing/stats.proto src/proto/grpc/testing/stats.proto --) --protobuf_generate_grpc_cpp_with_import_path_correction( -- src/proto/grpc/testing/test.proto src/proto/grpc/testing/test.proto --) --protobuf_generate_grpc_cpp_with_import_path_correction( -- src/proto/grpc/testing/worker_service.proto src/proto/grpc/testing/worker_service.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 -+ grpc/channelz/v1/channelz.proto grpc/channelz/v1/channelz.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 -+ grpc/core/stats.proto grpc/core/stats.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 -+ grpc/health/v1/health.proto grpc/health/v1/health.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 -+ grpc/lb/v1/load_balancer.proto grpc/lb/v1/load_balancer.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 -+ grpc/lookup/v1/rls.proto grpc/lookup/v1/rls.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 -+ grpc/lookup/v1/rls_config.proto grpc/lookup/v1/rls_config.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 -+ grpc/reflection/v1alpha/reflection.proto grpc/reflection/v1alpha/reflection.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/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 -+ grpc/status/status.proto grpc/status/status.proto - ) - protobuf_generate_grpc_cpp_with_import_path_correction( - test/core/tsi/alts/fake_handshaker/handshaker.proto test/core/tsi/alts/fake_handshaker/handshaker.proto -@@ -3446,10 +3290,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 - ) -@@ -3488,6 +3330,7 @@ target_link_libraries(grpc++_reflection - ${_gRPC_PROTOBUF_LIBRARIES} - ${_gRPC_ALLTARGETS_LIBRARIES} - grpc++ -+ grpc-proto::grpc-proto - ) - - foreach(_hdr -@@ -4076,10 +3919,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 - ) -@@ -4118,6 +3959,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..a84c57a 100644 ---- a/src/cpp/server/channelz/channelz_service.h -+++ b/src/cpp/server/channelz/channelz_service.h -@@ -24,8 +24,8 @@ - #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/all/patches/v1.48.x/001-disable-cppstd-override.patch b/recipes/grpc/all/patches/v1.48.x/001-disable-cppstd-override.patch deleted file mode 100644 index 65b655ba1f8b5..0000000000000 --- a/recipes/grpc/all/patches/v1.48.x/001-disable-cppstd-override.patch +++ /dev/null @@ -1,26 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 25990a5..f37849c 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -226,21 +226,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.48.x/002-consume-protos-from-requirements.patch b/recipes/grpc/all/patches/v1.48.x/002-consume-protos-from-requirements.patch deleted file mode 100644 index 5fd52235a25e3..0000000000000 --- a/recipes/grpc/all/patches/v1.48.x/002-consume-protos-from-requirements.patch +++ /dev/null @@ -1,327 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 7d23aa5..457188b 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -451,7 +451,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 -@@ -476,8 +476,8 @@ 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}) -+ # 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) -@@ -490,18 +490,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 +551,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 -@@ -3497,10 +3323,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 - ) -@@ -3539,6 +3363,7 @@ target_link_libraries(grpc++_reflection - ${_gRPC_PROTOBUF_LIBRARIES} - ${_gRPC_ALLTARGETS_LIBRARIES} - grpc++ -+ grpc-proto::grpc-proto - ) - - foreach(_hdr -@@ -4096,10 +3921,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 - ) -@@ -4138,6 +3961,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..a84c57a 100644 ---- a/src/cpp/server/channelz/channelz_service.h -+++ b/src/cpp/server/channelz/channelz_service.h -@@ -24,8 +24,8 @@ - #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/all/patches/v1.50.x/001-disable-cppstd-override.patch b/recipes/grpc/all/patches/v1.50.x/001-disable-cppstd-override.patch index a9339dbcc896b..fb952330fde1c 100644 --- 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 @@ -5,7 +5,7 @@ index 7052846..259fa93 100644 @@ -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) diff --git a/recipes/grpc/all/patches/v1.50.x/002-CMake-Add-gRPC_USE_SYSTEMD-option-34384.patch b/recipes/grpc/all/patches/v1.50.x/002-CMake-Add-gRPC_USE_SYSTEMD-option-34384.patch new file mode 100644 index 0000000000000..a0b7846cd9ddb --- /dev/null +++ b/recipes/grpc/all/patches/v1.50.x/002-CMake-Add-gRPC_USE_SYSTEMD-option-34384.patch @@ -0,0 +1,57 @@ +From 64d855b0ddd944369e96b24210a1ce59e704a779 Mon Sep 17 00:00:00 2001 +From: Kirill +Date: Tue, 2 Apr 2024 13:17:47 -0700 +Subject: [PATCH] [CMake] Add gRPC_USE_SYSTEMD option (#34384) + +Issue https://github.com/grpc/grpc/issues/34304 + +Allows to disable systemd support, +as well as linking with libsystemd, +when it is not required. + +The option has three possible values: +AUTO - Default, Will try to find libsystemd. If found, systemd support will be enabled. +ON - Enable systemd support. Build will fail if libsystemd is not found. +OFF - Disable systemd support. + +Closes #34384 + +COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/34384 from kirpichik:cmake-use-systemd-option 96f5f4bd68251ca62ccc45a2d44a68a8203531ac +PiperOrigin-RevId: 621274356 +--- + cmake/systemd.cmake | 21 ++++++++++++++++----- + 1 file changed, 16 insertions(+), 5 deletions(-) + +diff --git a/cmake/systemd.cmake b/cmake/systemd.cmake +index a34210177e..559c8d24b6 100644 +--- a/cmake/systemd.cmake ++++ b/cmake/systemd.cmake +@@ -12,9 +12,20 @@ + # See the License for the specific language governing permissions and + # limitations under the License. + +-find_package(systemd) +-if(TARGET systemd) +- set(_gRPC_SYSTEMD_LIBRARIES systemd ${SYSTEMD_LINK_LIBRARIES}) +- add_definitions(-DHAVE_LIBSYSTEMD) ++set(gRPC_USE_SYSTEMD "AUTO" CACHE STRING "Build with libsystemd support if available. Can be ON, OFF or AUTO") ++ ++if (NOT gRPC_USE_SYSTEMD STREQUAL "OFF") ++ if (gRPC_USE_SYSTEMD STREQUAL "ON") ++ find_package(systemd REQUIRED) ++ elseif (gRPC_USE_SYSTEMD STREQUAL "AUTO") ++ find_package(systemd) ++ else() ++ message(FATAL_ERROR "Unknown value for gRPC_USE_SYSTEMD = ${gRPC_USE_SYSTEMD}") ++ endif() ++ ++ if(TARGET systemd) ++ set(_gRPC_SYSTEMD_LIBRARIES systemd ${SYSTEMD_LINK_LIBRARIES}) ++ add_definitions(-DHAVE_LIBSYSTEMD) ++ endif() ++ set(_gRPC_FIND_SYSTEMD "if(NOT systemd_FOUND)\n find_package(systemd)\nendif()") + endif() +-set(_gRPC_FIND_SYSTEMD "if(NOT systemd_FOUND)\n find_package(systemd)\nendif()") +-- +2.43.0 + 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 deleted file mode 100644 index 515291213b267..0000000000000 --- a/recipes/grpc/all/patches/v1.50.x/002-consume-protos-from-requirements.patch +++ /dev/null @@ -1,326 +0,0 @@ -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/all/target_info/grpc_1.50.0.yml b/recipes/grpc/all/target_info/grpc_1.50.0.yml new file mode 100644 index 0000000000000..693b7c8e2a330 --- /dev/null +++ b/recipes/grpc/all/target_info/grpc_1.50.0.yml @@ -0,0 +1,120 @@ +grpc_version: 1.50.0 +grpc_targets: + - name: "address_sorting" + lib: "address_sorting" + - name: "gpr" + lib: "gpr" + requires: + - abseil::absl_base + - abseil::absl_core_headers + - abseil::absl_memory + - abseil::absl_random_random + - abseil::absl_status + - abseil::absl_cord + - abseil::absl_str_format + - abseil::absl_strings + - abseil::absl_synchronization + - abseil::absl_time + - abseil::absl_optional + - abseil::absl_variant + - name: "_grpc" + lib: "grpc" + requires: + - zlib::zlib + - c-ares::cares + - address_sorting + - re2::re2 + - upb + - abseil::absl_flat_hash_map + - abseil::absl_flat_hash_set + - abseil::absl_inlined_vector + - abseil::absl_any_invocable + - abseil::absl_bind_front + - abseil::absl_function_ref + - abseil::absl_hash + - abseil::absl_type_traits + - abseil::absl_statusor + - abseil::absl_span + - abseil::absl_utility + - gpr + - openssl::ssl + - openssl::crypto + - address_sorting + - upb + frameworks: ['CoreFoundation'] + - name: "grpc_unsecure" + lib: "grpc_unsecure" + requires: + - zlib::zlib + - c-ares::cares + - address_sorting + - re2::re2 + - upb + - abseil::absl_flat_hash_map + - abseil::absl_flat_hash_set + - abseil::absl_inlined_vector + - abseil::absl_any_invocable + - abseil::absl_bind_front + - abseil::absl_function_ref + - abseil::absl_hash + - abseil::absl_type_traits + - abseil::absl_statusor + - abseil::absl_span + - abseil::absl_utility + - gpr + - address_sorting + - upb + frameworks: ['CoreFoundation'] + - name: "grpc++" + lib: "grpc++" + requires: + - protobuf::libprotobuf + - abseil::absl_cleanup + - _grpc + - name: "grpc++_alts" + lib: "grpc++_alts" + requires: + - protobuf::libprotobuf + - grpc++ + - name: "grpc++_error_details" + lib: "grpc++_error_details" + requires: + - protobuf::libprotobuf + - grpc++ + - name: "grpc++_reflection" + lib: "grpc++_reflection" + requires: + - protobuf::libprotobuf + - grpc++ + - name: "grpc++_unsecure" + lib: "grpc++_unsecure" + requires: + - protobuf::libprotobuf + - grpc_unsecure + - name: "grpc_plugin_support" + lib: "grpc_plugin_support" + requires: + - protobuf::libprotoc + - protobuf::libprotobuf + - name: "grpcpp_channelz" + lib: "grpcpp_channelz" + requires: + - protobuf::libprotobuf + - grpc++ + - name: "upb" + lib: "upb" +grpc_plugins: + - target: "gRPC::grpc_cpp_plugin" + executable: "grpc_cpp_plugin" + - target: "gRPC::grpc_csharp_plugin" + executable: "grpc_csharp_plugin" + - target: "gRPC::grpc_node_plugin" + executable: "grpc_node_plugin" + - target: "gRPC::grpc_objective_c_plugin" + executable: "grpc_objective_c_plugin" + - target: "gRPC::grpc_php_plugin" + executable: "grpc_php_plugin" + - target: "gRPC::grpc_python_plugin" + executable: "grpc_python_plugin" + - target: "gRPC::grpc_ruby_plugin" + executable: "grpc_ruby_plugin" diff --git a/recipes/grpc/all/target_info/grpc_1.50.1.yml b/recipes/grpc/all/target_info/grpc_1.50.1.yml new file mode 100644 index 0000000000000..3bf059795e135 --- /dev/null +++ b/recipes/grpc/all/target_info/grpc_1.50.1.yml @@ -0,0 +1,120 @@ +grpc_version: 1.50.1 +grpc_targets: + - name: "address_sorting" + lib: "address_sorting" + - name: "gpr" + lib: "gpr" + requires: + - abseil::absl_base + - abseil::absl_core_headers + - abseil::absl_memory + - abseil::absl_random_random + - abseil::absl_status + - abseil::absl_cord + - abseil::absl_str_format + - abseil::absl_strings + - abseil::absl_synchronization + - abseil::absl_time + - abseil::absl_optional + - abseil::absl_variant + - name: "_grpc" + lib: "grpc" + requires: + - zlib::zlib + - c-ares::cares + - address_sorting + - re2::re2 + - upb + - abseil::absl_flat_hash_map + - abseil::absl_flat_hash_set + - abseil::absl_inlined_vector + - abseil::absl_any_invocable + - abseil::absl_bind_front + - abseil::absl_function_ref + - abseil::absl_hash + - abseil::absl_type_traits + - abseil::absl_statusor + - abseil::absl_span + - abseil::absl_utility + - gpr + - openssl::ssl + - openssl::crypto + - address_sorting + - upb + frameworks: ['CoreFoundation'] + - name: "grpc_unsecure" + lib: "grpc_unsecure" + requires: + - zlib::zlib + - c-ares::cares + - address_sorting + - re2::re2 + - upb + - abseil::absl_flat_hash_map + - abseil::absl_flat_hash_set + - abseil::absl_inlined_vector + - abseil::absl_any_invocable + - abseil::absl_bind_front + - abseil::absl_function_ref + - abseil::absl_hash + - abseil::absl_type_traits + - abseil::absl_statusor + - abseil::absl_span + - abseil::absl_utility + - gpr + - address_sorting + - upb + frameworks: ['CoreFoundation'] + - name: "grpc++" + lib: "grpc++" + requires: + - protobuf::libprotobuf + - abseil::absl_cleanup + - _grpc + - name: "grpc++_alts" + lib: "grpc++_alts" + requires: + - protobuf::libprotobuf + - grpc++ + - name: "grpc++_error_details" + lib: "grpc++_error_details" + requires: + - protobuf::libprotobuf + - grpc++ + - name: "grpc++_reflection" + lib: "grpc++_reflection" + requires: + - protobuf::libprotobuf + - grpc++ + - name: "grpc++_unsecure" + lib: "grpc++_unsecure" + requires: + - protobuf::libprotobuf + - grpc_unsecure + - name: "grpc_plugin_support" + lib: "grpc_plugin_support" + requires: + - protobuf::libprotoc + - protobuf::libprotobuf + - name: "grpcpp_channelz" + lib: "grpcpp_channelz" + requires: + - protobuf::libprotobuf + - grpc++ + - name: "upb" + lib: "upb" +grpc_plugins: + - target: "gRPC::grpc_cpp_plugin" + executable: "grpc_cpp_plugin" + - target: "gRPC::grpc_csharp_plugin" + executable: "grpc_csharp_plugin" + - target: "gRPC::grpc_node_plugin" + executable: "grpc_node_plugin" + - target: "gRPC::grpc_objective_c_plugin" + executable: "grpc_objective_c_plugin" + - target: "gRPC::grpc_php_plugin" + executable: "grpc_php_plugin" + - target: "gRPC::grpc_python_plugin" + executable: "grpc_python_plugin" + - target: "gRPC::grpc_ruby_plugin" + executable: "grpc_ruby_plugin" diff --git a/recipes/grpc/all/target_info/grpc_1.54.3.yml b/recipes/grpc/all/target_info/grpc_1.54.3.yml new file mode 100644 index 0000000000000..a97cd9a17b217 --- /dev/null +++ b/recipes/grpc/all/target_info/grpc_1.54.3.yml @@ -0,0 +1,152 @@ +grpc_version: 1.54.3 +grpc_targets: + - name: "address_sorting" + lib: "address_sorting" + requires: + - zlib::zlib + - name: "gpr" + lib: "gpr" + requires: + - zlib::zlib + - abseil::absl_base + - abseil::absl_core_headers + - abseil::absl_flags + - abseil::absl_flags_marshalling + - abseil::absl_any_invocable + - abseil::absl_memory + - abseil::absl_random_random + - abseil::absl_status + - abseil::absl_cord + - abseil::absl_str_format + - abseil::absl_strings + - abseil::absl_synchronization + - abseil::absl_time + - abseil::absl_optional + - abseil::absl_variant + - name: "_grpc" + lib: "grpc" + requires: + - zlib::zlib + - c-ares::cares + - address_sorting + - re2::re2 + - upb + - abseil::absl_cleanup + - abseil::absl_flat_hash_map + - abseil::absl_flat_hash_set + - abseil::absl_inlined_vector + - abseil::absl_bind_front + - abseil::absl_function_ref + - abseil::absl_hash + - abseil::absl_type_traits + - abseil::absl_statusor + - abseil::absl_span + - abseil::absl_utility + - gpr + - openssl::ssl + - openssl::crypto + - address_sorting + - upb + frameworks: ['CoreFoundation'] + - name: "grpc_unsecure" + lib: "grpc_unsecure" + requires: + - zlib::zlib + - c-ares::cares + - address_sorting + - re2::re2 + - upb + - abseil::absl_cleanup + - abseil::absl_flat_hash_map + - abseil::absl_flat_hash_set + - abseil::absl_inlined_vector + - abseil::absl_bind_front + - abseil::absl_function_ref + - abseil::absl_hash + - abseil::absl_type_traits + - abseil::absl_statusor + - abseil::absl_span + - abseil::absl_utility + - gpr + - address_sorting + - upb + frameworks: ['CoreFoundation'] + - name: "grpc++" + lib: "grpc++" + requires: + - protobuf::libprotobuf + - zlib::zlib + - _grpc + - name: "grpc++_alts" + lib: "grpc++_alts" + requires: + - protobuf::libprotobuf + - zlib::zlib + - grpc++ + - name: "grpc++_error_details" + lib: "grpc++_error_details" + requires: + - protobuf::libprotobuf + - zlib::zlib + - grpc++ + - name: "grpc++_reflection" + lib: "grpc++_reflection" + requires: + - protobuf::libprotobuf + - zlib::zlib + - grpc++ + - name: "grpc++_unsecure" + lib: "grpc++_unsecure" + requires: + - protobuf::libprotobuf + - zlib::zlib + - grpc_unsecure + - name: "grpc_authorization_provider" + lib: "grpc_authorization_provider" + requires: + - protobuf::libprotobuf + - zlib::zlib + - re2::re2 + - abseil::absl_cleanup + - abseil::absl_flat_hash_map + - abseil::absl_flat_hash_set + - abseil::absl_inlined_vector + - abseil::absl_function_ref + - abseil::absl_hash + - abseil::absl_type_traits + - abseil::absl_statusor + - abseil::absl_span + - abseil::absl_utility + - gpr + - upb + - name: "grpc_plugin_support" + lib: "grpc_plugin_support" + requires: + - protobuf::libprotoc + - protobuf::libprotobuf + - zlib::zlib + - name: "grpcpp_channelz" + lib: "grpcpp_channelz" + requires: + - protobuf::libprotobuf + - zlib::zlib + - grpc++ + - name: "upb" + lib: "upb" + requires: + - zlib::zlib +grpc_plugins: + - target: "gRPC::grpc_cpp_plugin" + executable: "grpc_cpp_plugin" + - target: "gRPC::grpc_csharp_plugin" + executable: "grpc_csharp_plugin" + - target: "gRPC::grpc_node_plugin" + executable: "grpc_node_plugin" + - target: "gRPC::grpc_objective_c_plugin" + executable: "grpc_objective_c_plugin" + - target: "gRPC::grpc_php_plugin" + executable: "grpc_php_plugin" + - target: "gRPC::grpc_python_plugin" + executable: "grpc_python_plugin" + - target: "gRPC::grpc_ruby_plugin" + executable: "grpc_ruby_plugin" diff --git a/recipes/grpc/all/target_info/grpc_1.65.0.yml b/recipes/grpc/all/target_info/grpc_1.65.0.yml new file mode 100644 index 0000000000000..14d6c7bc379f9 --- /dev/null +++ b/recipes/grpc/all/target_info/grpc_1.65.0.yml @@ -0,0 +1,176 @@ +grpc_version: 1.65.0 +grpc_targets: + - name: "address_sorting" + lib: "address_sorting" + - name: "gpr" + lib: "gpr" + requires: + - abseil::absl_base + - abseil::absl_core_headers + - abseil::absl_log_severity + - abseil::absl_flags + - abseil::absl_flags_marshalling + - abseil::absl_any_invocable + - abseil::absl_check + - abseil::absl_log_globals + - abseil::absl_log + - abseil::absl_memory + - abseil::absl_random_random + - abseil::absl_status + - abseil::absl_cord + - abseil::absl_str_format + - abseil::absl_strings + - abseil::absl_synchronization + - abseil::absl_time + - abseil::absl_optional + - abseil::absl_variant + - name: "_grpc" + lib: "grpc" + requires: + - upb_json_lib + - upb_textformat_lib + - re2::re2 + - zlib::zlib + - abseil::absl_algorithm_container + - abseil::absl_config + - abseil::absl_no_destructor + - abseil::absl_cleanup + - abseil::absl_flat_hash_map + - abseil::absl_flat_hash_set + - abseil::absl_inlined_vector + - abseil::absl_bind_front + - abseil::absl_function_ref + - abseil::absl_hash + - abseil::absl_type_traits + - abseil::absl_random_bit_gen_ref + - abseil::absl_random_distributions + - abseil::absl_statusor + - abseil::absl_span + - abseil::absl_utility + - c-ares::cares + - gpr + - openssl::ssl + - openssl::crypto + - address_sorting + frameworks: ['CoreFoundation'] + - name: "grpc_unsecure" + lib: "grpc_unsecure" + requires: + - utf8_range_lib + - upb_message_lib + - zlib::zlib + - abseil::absl_algorithm_container + - abseil::absl_config + - abseil::absl_no_destructor + - abseil::absl_cleanup + - abseil::absl_flat_hash_map + - abseil::absl_flat_hash_set + - abseil::absl_inlined_vector + - abseil::absl_bind_front + - abseil::absl_function_ref + - abseil::absl_hash + - abseil::absl_type_traits + - abseil::absl_random_bit_gen_ref + - abseil::absl_random_distributions + - abseil::absl_statusor + - abseil::absl_span + - abseil::absl_utility + - c-ares::cares + - gpr + - address_sorting + frameworks: ['CoreFoundation'] + - name: "upb_base_lib" + lib: "upb_base_lib" + - name: "upb_json_lib" + lib: "upb_json_lib" + requires: + - utf8_range_lib + - upb_message_lib + - name: "upb_mem_lib" + lib: "upb_mem_lib" + - name: "upb_message_lib" + lib: "upb_message_lib" + requires: + - upb_base_lib + - upb_mem_lib + - name: "upb_textformat_lib" + lib: "upb_textformat_lib" + requires: + - utf8_range_lib + - upb_message_lib + - name: "utf8_range_lib" + lib: "utf8_range_lib" + - name: "grpc++" + lib: "grpc++" + requires: + - abseil::absl_absl_check + - abseil::absl_absl_log + - _grpc + - protobuf::libprotobuf + - name: "grpc++_alts" + lib: "grpc++_alts" + requires: + - grpc++ + - name: "grpc++_error_details" + lib: "grpc++_error_details" + requires: + - grpc++ + - name: "grpc++_reflection" + lib: "grpc++_reflection" + requires: + - grpc++ + - name: "grpc++_unsecure" + lib: "grpc++_unsecure" + requires: + - abseil::absl_absl_check + - abseil::absl_absl_log + - grpc_unsecure + - protobuf::libprotobuf + - name: "grpc_authorization_provider" + lib: "grpc_authorization_provider" + requires: + - utf8_range_lib + - upb_message_lib + - re2::re2 + - zlib::zlib + - abseil::absl_config + - abseil::absl_no_destructor + - abseil::absl_cleanup + - abseil::absl_flat_hash_map + - abseil::absl_flat_hash_set + - abseil::absl_inlined_vector + - abseil::absl_function_ref + - abseil::absl_hash + - abseil::absl_type_traits + - abseil::absl_statusor + - abseil::absl_span + - abseil::absl_utility + - c-ares::cares + - gpr + - address_sorting + - name: "grpc_plugin_support" + lib: "grpc_plugin_support" + requires: + - protobuf::libprotobuf + - protobuf::libprotoc + - name: "grpcpp_channelz" + lib: "grpcpp_channelz" + requires: + - grpc++ +grpc_plugins: + - target: "gRPC::grpc_cpp_plugin" + executable: "grpc_cpp_plugin" + - target: "gRPC::grpc_csharp_plugin" + executable: "grpc_csharp_plugin" + - target: "gRPC::grpc_node_plugin" + executable: "grpc_node_plugin" + - target: "gRPC::grpc_objective_c_plugin" + executable: "grpc_objective_c_plugin" + - target: "gRPC::grpc_php_plugin" + executable: "grpc_php_plugin" + - target: "gRPC::grpc_python_plugin" + executable: "grpc_python_plugin" + - target: "gRPC::grpc_ruby_plugin" + executable: "grpc_ruby_plugin" + - target: "gRPC::grpc_otel_plugin" + executable: "grpc_otel_plugin" diff --git a/recipes/grpc/all/target_info/grpc_1.67.1.yml b/recipes/grpc/all/target_info/grpc_1.67.1.yml new file mode 100644 index 0000000000000..9d25e03682db2 --- /dev/null +++ b/recipes/grpc/all/target_info/grpc_1.67.1.yml @@ -0,0 +1,187 @@ +grpc_version: 1.67.0 +grpc_targets: + - name: "address_sorting" + lib: "address_sorting" + - name: "gpr" + lib: "gpr" + requires: + - abseil::absl_base + - abseil::absl_core_headers + - abseil::absl_log_severity + - abseil::absl_flags + - abseil::absl_flags_marshalling + - abseil::absl_any_invocable + - abseil::absl_check + - abseil::absl_log_globals + - abseil::absl_log + - abseil::absl_memory + - abseil::absl_random_random + - abseil::absl_status + - abseil::absl_cord + - abseil::absl_str_format + - abseil::absl_strings + - abseil::absl_synchronization + - abseil::absl_time + - abseil::absl_optional + - abseil::absl_variant + - name: "_grpc" + lib: "grpc" + requires: + - upb_json_lib + - upb_textformat_lib + - re2::re2 + - zlib::zlib + - abseil::absl_algorithm_container + - abseil::absl_config + - abseil::absl_no_destructor + - abseil::absl_cleanup + - abseil::absl_flat_hash_map + - abseil::absl_flat_hash_set + - abseil::absl_inlined_vector + - abseil::absl_bind_front + - abseil::absl_function_ref + - abseil::absl_hash + - abseil::absl_type_traits + - abseil::absl_random_bit_gen_ref + - abseil::absl_random_distributions + - abseil::absl_statusor + - abseil::absl_span + - abseil::absl_utility + - c-ares::cares + - gpr + - openssl::ssl + - openssl::crypto + - address_sorting + frameworks: ['CoreFoundation'] + - name: "grpc_unsecure" + lib: "grpc_unsecure" + requires: + - upb_mini_descriptor_lib + - upb_wire_lib + - zlib::zlib + - abseil::absl_algorithm_container + - abseil::absl_config + - abseil::absl_no_destructor + - abseil::absl_cleanup + - abseil::absl_flat_hash_map + - abseil::absl_flat_hash_set + - abseil::absl_inlined_vector + - abseil::absl_bind_front + - abseil::absl_function_ref + - abseil::absl_hash + - abseil::absl_type_traits + - abseil::absl_random_bit_gen_ref + - abseil::absl_random_distributions + - abseil::absl_statusor + - abseil::absl_span + - abseil::absl_utility + - c-ares::cares + - gpr + - address_sorting + frameworks: ['CoreFoundation'] + - name: "upb_base_lib" + lib: "upb_base_lib" + - name: "upb_mini_descriptor_lib" + lib: "upb_mini_descriptor_lib" + requires: + - upb_base_lib + - upb_mem_lib + - name: "upb_wire_lib" + lib: "upb_wire_lib" + requires: + - utf8_range_lib + - upb_message_lib + - name: "upb_json_lib" + lib: "upb_json_lib" + requires: + - upb_mini_descriptor_lib + - upb_wire_lib + - name: "upb_mem_lib" + lib: "upb_mem_lib" + - name: "upb_message_lib" + lib: "upb_message_lib" + requires: + - upb_base_lib + - upb_mem_lib + - name: "upb_textformat_lib" + lib: "upb_textformat_lib" + requires: + - upb_mini_descriptor_lib + - upb_wire_lib + - name: "utf8_range_lib" + lib: "utf8_range_lib" + - name: "grpc++" + lib: "grpc++" + requires: + - abseil::absl_absl_check + - abseil::absl_absl_log + - _grpc + - protobuf::libprotobuf + - name: "grpc++_alts" + lib: "grpc++_alts" + requires: + - grpc++ + - name: "grpc++_error_details" + lib: "grpc++_error_details" + requires: + - grpc++ + - name: "grpc++_reflection" + lib: "grpc++_reflection" + requires: + - grpc++ + - name: "grpc++_unsecure" + lib: "grpc++_unsecure" + requires: + - abseil::absl_absl_check + - abseil::absl_absl_log + - grpc_unsecure + - protobuf::libprotobuf + - name: "grpc_authorization_provider" + lib: "grpc_authorization_provider" + requires: + - upb_mini_descriptor_lib + - upb_wire_lib + - upb_message_lib + - re2::re2 + - zlib::zlib + - abseil::absl_config + - abseil::absl_no_destructor + - abseil::absl_cleanup + - abseil::absl_flat_hash_map + - abseil::absl_flat_hash_set + - abseil::absl_inlined_vector + - abseil::absl_function_ref + - abseil::absl_hash + - abseil::absl_type_traits + - abseil::absl_statusor + - abseil::absl_span + - abseil::absl_utility + - c-ares::cares + - gpr + - address_sorting + - name: "grpc_plugin_support" + lib: "grpc_plugin_support" + requires: + - protobuf::libprotobuf + - protobuf::libprotoc + - name: "grpcpp_channelz" + lib: "grpcpp_channelz" + requires: + - grpc++ +grpc_plugins: + - target: "gRPC::grpc_cpp_plugin" + executable: "grpc_cpp_plugin" + - target: "gRPC::grpc_csharp_plugin" + executable: "grpc_csharp_plugin" + - target: "gRPC::grpc_node_plugin" + executable: "grpc_node_plugin" + - target: "gRPC::grpc_objective_c_plugin" + executable: "grpc_objective_c_plugin" + - target: "gRPC::grpc_php_plugin" + executable: "grpc_php_plugin" + - target: "gRPC::grpc_python_plugin" + executable: "grpc_python_plugin" + - target: "gRPC::grpc_ruby_plugin" + executable: "grpc_ruby_plugin" + - target: "gRPC::grpc_otel_plugin" + executable: "grpc_otel_plugin" diff --git a/recipes/grpc/all/test_package/CMakeLists.txt b/recipes/grpc/all/test_package/CMakeLists.txt index 0ada3fb25d2c8..9bdf7d4baad66 100644 --- a/recipes/grpc/all/test_package/CMakeLists.txt +++ b/recipes/grpc/all/test_package/CMakeLists.txt @@ -1,30 +1,23 @@ -cmake_minimum_required(VERSION 3.12) -project(test_package) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) -find_package(protobuf CONFIG REQUIRED) find_package(gRPC CONFIG REQUIRED) -add_executable(${PROJECT_NAME} test_package.cpp helloworld.proto) + +add_executable(${PROJECT_NAME} test_package.cpp) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) # grpc 1.47.0 requires c++14 target_link_libraries(${PROJECT_NAME} PRIVATE - protobuf::libprotobuf $,gRPC::grpc++_unsecure,gRPC::grpc++> ) -target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) -if(TEST_ACTUAL_SERVER) - target_compile_definitions(${PROJECT_NAME} PRIVATE -DTEST_ACTUAL_SERVER) -endif() -protobuf_generate( - TARGET ${PROJECT_NAME} - LANGUAGE cpp -) -protobuf_generate( - TARGET ${PROJECT_NAME} - LANGUAGE grpc - GENERATE_EXTENSIONS .grpc.pb.h .grpc.pb.cc - PLUGIN protoc-gen-grpc=$ -) + +if(CHECK_GRPC_CPP_PLUGIN) + if(NOT GRPC_CPP_PLUGIN_PROGRAM) + message(FATAL_ERROR "grpc_cpp_plugin not found") + endif() + + if(NOT TARGET gRPC::grpc_cpp_plugin) + message(FATAL_ERROR "grpc_cpp_plugin target not defined, but expected") + endif() +endif() \ No newline at end of file diff --git a/recipes/grpc/all/test_package/conanfile.py b/recipes/grpc/all/test_package/conanfile.py index 711d400cf235d..3e5ae9905391e 100644 --- a/recipes/grpc/all/test_package/conanfile.py +++ b/recipes/grpc/all/test_package/conanfile.py @@ -1,44 +1,31 @@ -from conans import ConanFile, CMake, tools -import contextlib +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 build_requirements(self): - if hasattr(self, "settings_build"): - self.build_requires(str(self.requires["grpc"])) + def layout(self): + cmake_layout(self) - @contextlib.contextmanager - def _buildenv(self): - # TODO: conan v2: replace by VirtualBuildEnv and always add grpc to build requirements - if tools.cross_building(self): - yield - else: - with tools.run_environment(self): - yield + def requirements(self): + self.requires(self.tested_reference_str) + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["CHECK_GRPC_CPP_PLUGIN"] = self.dependencies[self.tested_reference_str].options.cpp_plugin + tc.generate() def build(self): - # TODO: always build in conan v2 - # this is a limitation of conan v1: - # at build time we want to inject PATH/LD_LIBRARY/DYLD_LIBRARY_PATH - # of build requirements so that gprc_cpp_plugin can find its - # shared dependencies (in build context as well) - # should be fixed by using: CMakeToolchain + VirtualBuildEnv - if tools.cross_building(self) and self.options["grpc"].shared: - return - with self._buildenv(): - cmake = CMake(self) - # FIXME: This combination of settings randomly fails in CI - cmake.definitions["TEST_ACTUAL_SERVER"] = not (self.settings.compiler == "Visual Studio" - and self.settings.compiler.version == "15" - and self.settings.build_type == "Release") - cmake.configure() - cmake.build() + cmake = CMake(self) + cmake.configure() + cmake.build() 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/grpc/all/test_package/helloworld.proto b/recipes/grpc/all/test_package/helloworld.proto deleted file mode 100644 index be878ce25fffc..0000000000000 --- a/recipes/grpc/all/test_package/helloworld.proto +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2015 gRPC authors. -// -// Licensed 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. - -syntax = "proto3"; - -option java_multiple_files = true; -option java_package = "io.grpc.examples.helloworld"; -option java_outer_classname = "HelloWorldProto"; -option objc_class_prefix = "HLW"; - -package helloworld; - -// The greeting service definition. -service Greeter { - // Sends a greeting - rpc SayHello (HelloRequest) returns (HelloReply) {} -} - -// The request message containing the user's name. -message HelloRequest { - string name = 1; -} - -// The response message containing the greetings -message HelloReply { - string message = 1; -} diff --git a/recipes/grpc/all/test_package/test_package.cpp b/recipes/grpc/all/test_package/test_package.cpp index 18a37cf90692e..53d020094793e 100644 --- a/recipes/grpc/all/test_package/test_package.cpp +++ b/recipes/grpc/all/test_package/test_package.cpp @@ -1,122 +1,9 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed 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 -#include -#include #include -#include - #include -#include "helloworld.grpc.pb.h" - -using grpc::Channel; -using grpc::ClientContext; -using grpc::Server; -using grpc::ServerBuilder; -using grpc::ServerContext; -using grpc::Status; -using helloworld::HelloRequest; -using helloworld::HelloReply; -using helloworld::Greeter; - -class GreeterClient { - public: - GreeterClient(std::shared_ptr channel) - : stub_(Greeter::NewStub(channel)) {} - - // Assembles the client's payload, sends it and presents the response back - // from the server. - std::string SayHello(const std::string& user) { - // Data we are sending to the server. - HelloRequest request; - request.set_name(user); - - // Container for the data we expect from the server. - HelloReply reply; - - // Context for the client. It could be used to convey extra information to - // the server and/or tweak certain RPC behaviors. - ClientContext context; - // The actual RPC. - Status status = stub_->SayHello(&context, request, &reply); - - // Act upon its status. - if (status.ok()) { - return reply.message(); - } else { - std::cout << status.error_code() << ": " << status.error_message() - << std::endl; - return "RPC failed"; - } - } - - private: - std::unique_ptr stub_; -}; - -// Logic and data behind the server's behavior. -class GreeterServiceImpl final : public Greeter::Service { - Status SayHello(ServerContext* context, const HelloRequest* request, - HelloReply* reply) override { - std::string prefix("Hello "); - reply->set_message(prefix + request->name()); - return Status::OK; - } -}; int main(int argc, char** argv) { - std::string server_address("127.0.0.1:0"); - GreeterServiceImpl service; - - ServerBuilder builder; - int selected_port = 0; - // Listen on the given address without any authentication mechanism. - builder.AddListeningPort(server_address, grpc::InsecureServerCredentials(), &selected_port); - // Register "service" as the instance through which we'll communicate with - // clients. In this case it corresponds to an *synchronous* service. - builder.RegisterService(&service); - - // Finally assemble the server. -#ifdef TEST_ACTUAL_SERVER - std::unique_ptr server(builder.BuildAndStart()); - std::thread serverThread([&](){ - std::cout << "Server listening on 127.0.0.1:" << selected_port << std::endl; - server->Wait(); - std::cout << "Server closed" << std::endl; - }); -#endif - - // Instantiate the client. It requires a channel, out of which the actual RPCs - // are created. This channel models a connection to an endpoint (in this case, - // localhost at the selected port). We indicate that the channel isn't - // authenticated (use of InsecureChannelCredentials()). - std::ostringstream addr; - addr << "localhost:" << selected_port; - GreeterClient greeter(grpc::CreateChannel(addr.str(), grpc::InsecureChannelCredentials())); - std::string user("world"); - std::string reply = greeter.SayHello(user); - std::cout << "Greeter received: " << reply << std::endl; - -#ifdef TEST_ACTUAL_SERVER - server->Shutdown(); - serverThread.join(); -#endif + std::cout << "gPRC version: " << grpc::Version() << "\n"; return 0; } diff --git a/recipes/grpc/config.yml b/recipes/grpc/config.yml index 4d7fb36be2c32..cbfb6a6cea659 100644 --- a/recipes/grpc/config.yml +++ b/recipes/grpc/config.yml @@ -1,11 +1,11 @@ versions: - "1.50.1": + "1.67.1": folder: "all" - "1.50.0": + "1.65.0": folder: "all" - "1.48.0": + "1.54.3": folder: "all" - "1.47.1": + "1.50.1": folder: "all" - "1.46.3": + "1.50.0": folder: "all" diff --git a/recipes/gsl-lite/all/conandata.yml b/recipes/gsl-lite/all/conandata.yml index 010ad6b469c3c..219a6dbb026e5 100644 --- a/recipes/gsl-lite/all/conandata.yml +++ b/recipes/gsl-lite/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "0.42.0": + url: "https://github.com/gsl-lite/gsl-lite/archive/v0.42.0.tar.gz" + sha256: "54a1b6f9db72eab5d8dcaf06b36d32d4f5da3471d91dac71aba19fe15291a773" + "0.41.0": + url: "https://github.com/gsl-lite/gsl-lite/archive/v0.41.0.tar.gz" + sha256: "4682d8a60260321b92555760be3b9caab60e2a71f95eddbdfb91e557ee93302a" "0.40.0": url: "https://github.com/gsl-lite/gsl-lite/archive/v0.40.0.tar.gz" sha256: "65af4ec8a1050dac4f1ca4622881bb02a9c3978a9baec289fb56e25412d6cac7" @@ -14,9 +20,3 @@ sources: "0.37.0": url: "https://github.com/gsl-lite/gsl-lite/archive/0.37.0.zip" sha256: "980c8e91dd25bfaac7bfbd7151f04027fa68ff0bf652baa11de137242641e399" - "0.36.0": - url: "https://github.com/martinmoene/gsl-lite/archive/v0.36.0.zip" - sha256: "ab1bb560611dcf9cef2265b8e40e59689bb4af1fd64914aa4a8eff945dd75057" - "0.34.0": - url: "https://github.com/martinmoene/gsl-lite/archive/v0.34.0.zip" - sha256: "44255fd8aab1780773a5a2a16703c9c5a95f8c944d95caa7c468b229c0fcd1ff" diff --git a/recipes/gsl-lite/all/conanfile.py b/recipes/gsl-lite/all/conanfile.py index d59ea8610e6a3..7d9514bf2f40f 100644 --- a/recipes/gsl-lite/all/conanfile.py +++ b/recipes/gsl-lite/all/conanfile.py @@ -1,19 +1,20 @@ from conan import ConanFile from conan.tools.files import get, copy +from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.50.0" class GslLiteConan(ConanFile): name = "gsl-lite" + description = "A single-file header-only version of ISO C++ " \ + "Guideline Support Library (GSL) for C++98, C++11 and later" license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/martinmoene/gsl-lite" - topics = ("GSL") - description = "A single-file header-only version of ISO C++ " \ - "Guideline Support Library (GSL) for C++98, C++11 and later" - + topics = ("GSL", "header-only") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" # There are three configuration options for this GSL implementation's behavior # when pre/post conditions on the GSL types are violated: @@ -31,10 +32,6 @@ class GslLiteConan(ConanFile): no_copy_source = True - @property - def _source_subfolder(self): - return os.path.join(self.source_folder, "source_subfolder") - @property def _contract_map(self): return { @@ -43,20 +40,24 @@ def _contract_map(self): "unenforced": "GSL_UNENFORCED_ON_CONTRACT_VIOLATION" } + 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_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): - copy(self, "*gsl-lite.hpp", src=self._source_subfolder, dst=self.package_folder) - copy(self, "LICENSE", src=self._source_subfolder, 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")) + 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", "gsl-lite") self.cpp_info.set_property("cmake_target_name", "gsl::gsl-lite") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] # TODO: back to global scope in conan v2 once cmake_find_package* generators removed self.cpp_info.components["gsllite"].defines = [self._contract_map[str(self.options.on_contract_violation)]] @@ -68,3 +69,5 @@ def package_info(self): self.cpp_info.components["gsllite"].names["cmake_find_package"] = "gsl-lite" self.cpp_info.components["gsllite"].names["cmake_find_package_multi"] = "gsl-lite" self.cpp_info.components["gsllite"].set_property("cmake_target_name", "gsl::gsl-lite") + self.cpp_info.components["gsllite"].bindirs = [] + self.cpp_info.components["gsllite"].libdirs = [] diff --git a/recipes/gsl-lite/all/test_package/CMakeLists.txt b/recipes/gsl-lite/all/test_package/CMakeLists.txt index 0063a1958556f..b4d8ae0dd1ce8 100644 --- a/recipes/gsl-lite/all/test_package/CMakeLists.txt +++ b/recipes/gsl-lite/all/test_package/CMakeLists.txt @@ -1,8 +1,8 @@ cmake_minimum_required(VERSION 3.15) -project(test_package CXX) +project(test_package LANGUAGES CXX) find_package(gsl-lite REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} gsl::gsl-lite) +target_link_libraries(${PROJECT_NAME} PRIVATE gsl::gsl-lite) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/gsl-lite/all/test_v1_package/CMakeLists.txt b/recipes/gsl-lite/all/test_v1_package/CMakeLists.txt index 6042a2363b626..b21cc49efde95 100644 --- a/recipes/gsl-lite/all/test_v1_package/CMakeLists.txt +++ b/recipes/gsl-lite/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.15) -project(test_package CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(gsl-lite REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE gsl::gsl-lite) -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/gsl-lite/all/test_v1_package/conanfile.py b/recipes/gsl-lite/all/test_v1_package/conanfile.py index db36d97f3c465..7895db93c24a6 100644 --- a/recipes/gsl-lite/all/test_v1_package/conanfile.py +++ b/recipes/gsl-lite/all/test_v1_package/conanfile.py @@ -7,10 +7,6 @@ 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(self): cmake = CMake(self) diff --git a/recipes/gsl-lite/config.yml b/recipes/gsl-lite/config.yml index d21a23d317e33..928876dabb2a2 100644 --- a/recipes/gsl-lite/config.yml +++ b/recipes/gsl-lite/config.yml @@ -1,4 +1,8 @@ versions: + "0.42.0": + folder: all + "0.41.0": + folder: all "0.40.0": folder: all "0.39.0": @@ -9,7 +13,3 @@ versions: folder: all "0.37.0": folder: all - "0.36.0": - folder: all - "0.34.0": - folder: all diff --git a/recipes/gsl/all/conandata.yml b/recipes/gsl/all/conandata.yml index ae4c67c1283a1..d61a5f24f34f4 100644 --- a/recipes/gsl/all/conandata.yml +++ b/recipes/gsl/all/conandata.yml @@ -1,11 +1,17 @@ sources: + "2.7.1": + url: "https://ftpmirror.gnu.org/gsl/gsl-2.7.1.tar.gz" + sha256: "dcb0fbd43048832b757ff9942691a8dd70026d5da0ff85601e52687f6deeb34b" "2.7": - url: "https://ftp.gnu.org/gnu/gsl/gsl-2.7.tar.gz" + url: "https://ftpmirror.gnu.org/gsl/gsl-2.7.tar.gz" sha256: "efbbf3785da0e53038be7907500628b466152dbc3c173a87de1b5eba2e23602b" "2.6": - url: "https://ftp.gnu.org/gnu/gsl/gsl-2.6.tar.gz" + url: "https://ftpmirror.gnu.org/gsl/gsl-2.6.tar.gz" sha256: "b782339fc7a38fe17689cb39966c4d821236c28018b6593ddb6fd59ee40786a8" patches: + "2.7.1": + - patch_file: "patches/0001-windows-support.patch" + - patch_file: "patches/0002-export-all-gsl_-symbols.patch" "2.7": - patch_file: "patches/0001-windows-support.patch" - patch_file: "patches/0002-export-all-gsl_-symbols.patch" diff --git a/recipes/gsl/all/conanfile.py b/recipes/gsl/all/conanfile.py index a722ffd447fe9..ed26f83de3863 100644 --- a/recipes/gsl/all/conanfile.py +++ b/recipes/gsl/all/conanfile.py @@ -1,13 +1,13 @@ 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.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 +from conan.tools.microsoft import check_min_vs, is_msvc, unix_path import os -required_conan_version = ">=1.53.0" +required_conan_version = ">=1.57.0" class GslConan(ConanFile): @@ -18,6 +18,7 @@ class GslConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" license = "GPL-3.0-or-later" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -33,10 +34,6 @@ class GslConan(ConanFile): 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) @@ -61,8 +58,7 @@ def build_requirements(self): self.tool_requires("msys2/cci.latest") 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) @@ -75,21 +71,19 @@ def generate(self): tc.extra_defines.append("GSL_DLL") if self.settings.os == "Linux" and "x86" in self.settings.arch: 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): tc.configure_args.extend([ "ac_cv_func_memcpy=yes", "ac_cv_func_memmove=yes", "ac_cv_c_c99inline=no", ]) - tc.generate() - + if check_min_vs(self, "180", raise_invalid=False): + tc.extra_cflags.append("-FS") + env = tc.environment() 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) + 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") @@ -98,29 +92,25 @@ def generate(self): env.define("OBJDUMP", ":") env.define("RANLIB", ":") env.define("STRIP", ":") - env.vars(self).save_script("conanbuild_gsl_msvc") + tc.generate(env) def build(self): 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): 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)}"]) + 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")) rm(self, "*.c", os.path.join(self.package_folder, "include", "gsl")) rm(self, "gsl-config", os.path.join(self.package_folder, "bin")) + fix_apple_shared_install_name(self) 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")) diff --git a/recipes/gsl/config.yml b/recipes/gsl/config.yml index 15814520e1bfd..6bdfd995018bc 100644 --- a/recipes/gsl/config.yml +++ b/recipes/gsl/config.yml @@ -1,4 +1,6 @@ versions: + "2.7.1": + folder: all "2.7": folder: all "2.6": diff --git a/recipes/gsoap/all/conandata.yml b/recipes/gsoap/all/conandata.yml index 4a616af7b7a29..a182b51ca54e4 100644 --- a/recipes/gsoap/all/conandata.yml +++ b/recipes/gsoap/all/conandata.yml @@ -1,21 +1,22 @@ +# The sources for this project get deleted from time to time. +# We use the backup sources from Conan Center as mirrors to let users compile in the future +# When adding new versions, directly add the URL following previous versions schema +# https://c3i.jfrog.io/artifactory/conan-center-backup-sources/ + sha256 of the sources +# The file will be automatically uploaded after the first successful compilation of the new version +# And will be usable as a mirror from then on. +# At some point the Conan client might come pre-configured with this backup remote by default, but don't delete the links then +# some users might still rely on the old revisions/not have it set to point to our CCI backup remote sources: - "2.8.117": + "2.8.134": url: - - "https://sourceforge.net/projects/gsoap2/files/gsoap_2.8.117.zip/download" - - "https://c3i.jfrog.io/artifactory/cci-sources-backup/sources/gsoap/gsoap_2.8.117.zip" - sha256: "7cadf8808cfd982629948fe09e4fa6cd18e23cafd40df0aaaff1b1f5b695c442" - "2.8.116": + - "https://sourceforge.net/projects/gsoap2/files/gsoap_2.8.134.zip/download" + - "https://c3i.jfrog.io/artifactory/conan-center-backup-sources/63478e555c0ccde0164f055ff605b02805db0abc6712a04bcb14cb617b047218" + sha256: "63478e555c0ccde0164f055ff605b02805db0abc6712a04bcb14cb617b047218" + "2.8.132": url: - - "https://sourceforge.net/projects/gsoap2/files/gsoap_2.8.116.zip/download" - - "https://c3i.jfrog.io/artifactory/cci-sources-backup/sources/gsoap/gsoap_2.8.116.zip" - sha256: "2a41e42aaddbcd603b99004af95bb83559dbd4fd2d842920f003d24867599192" - "2.8.115": + - "https://c3i.jfrog.io/artifactory/conan-center-backup-sources/d6eb5d0d2c31532746f4dc9fa1ce95d4553414e918059eac23cf081d88c2aeee" + sha256: "d6eb5d0d2c31532746f4dc9fa1ce95d4553414e918059eac23cf081d88c2aeee" + "2.8.129": url: - - "https://sourceforge.net/projects/gsoap2/files/gsoap_2.8.115.zip/download" - - "https://c3i.jfrog.io/artifactory/cci-sources-backup/sources/gsoap/gsoap_2.8.115.zip" - sha256: "6f6813b189d201022254a2879cc8ee005bdb1bcf126bc03238710f19ec4e7268" - "2.8.114": - url: - - "https://sourceforge.net/projects/gsoap2/files/gsoap_2.8.114.zip/download" - - "https://c3i.jfrog.io/artifactory/cci-sources-backup/sources/gsoap/gsoap_2.8.114.zip" - sha256: "aa70a999258100c170a3f8750c1f91318a477d440f6a28117f68bc1ded32327f" + - "https://c3i.jfrog.io/artifactory/conan-center-backup-sources/16cb8852ea791a6aec8f0213d619c15eecc8171e0c888f3b0e0c66d3ef78e20a" + sha256: "16cb8852ea791a6aec8f0213d619c15eecc8171e0c888f3b0e0c66d3ef78e20a" diff --git a/recipes/gsoap/all/conanfile.py b/recipes/gsoap/all/conanfile.py index 49ca4cbe85bbd..6f49eae5e182d 100644 --- a/recipes/gsoap/all/conanfile.py +++ b/recipes/gsoap/all/conanfile.py @@ -3,7 +3,6 @@ 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.52.0" @@ -16,7 +15,8 @@ class GsoapConan(ConanFile): license = ("gSOAP-1.3b", "GPL-2.0-or-later") url = "https://github.com/conan-io/conan-center-index" homepage = "https://sourceforge.net/projects/gsoap2" - topics = ("gsoap", "logging") + topics = ("logging",) + package_type = "static-library" settings = "os", "arch", "compiler", "build_type" options = { "fPIC": [True, False], @@ -32,14 +32,16 @@ class GsoapConan(ConanFile): "with_cookies": True, "with_c_locale": True, } - - exports_sources = "CMakeLists.txt", "cmake/*.cmake" short_paths = True @property def _settings_build(self): return getattr(self, "settings_build", self.settings) + def export_sources(self): + copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) + copy(self, "cmake/*.cmake", self.recipe_folder, self.export_sources_folder) + def config_options(self): if self.settings.os == "Windows": del self.options.fPIC @@ -49,22 +51,21 @@ def layout(self): def requirements(self): if self.options.with_openssl: - self.requires("openssl/1.1.1s") - self.requires("zlib/1.2.13") + self.requires("openssl/[>=1.1 <4]", transitive_headers=True) + self.requires("zlib/[>=1.2.11 <2]") def build_requirements(self): if cross_building(self, skip_x64_x86=True) and hasattr(self, "settings_build"): self.tool_requires(f"gsoap/{self.version}") - if is_msvc(self, build_context=True): + if self._settings_build.os == "Windows": self.tool_requires("winflexbison/2.5.24") else: - self.tool_requires("bison/3.7.6") + self.tool_requires("bison/3.8.2") self.tool_requires("flex/2.6.4") 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): toolchain = CMakeToolchain(self) @@ -96,11 +97,11 @@ def package(self): def package_info(self): defines = [] if self.options.with_openssl: - libs = ["gsoapssl++", ] + libs = ["gsoapssl++"] defines.append("WITH_OPENSSL") defines.append("WITH_GZIP") else: - libs = ["gsoap++", ] + libs = ["gsoap++"] self.cpp_info.libs = libs if self.options.with_ipv6: diff --git a/recipes/gsoap/all/test_package/CMakeLists.txt b/recipes/gsoap/all/test_package/CMakeLists.txt index 1464ab750d83b..9d9cb52d4bac7 100644 --- a/recipes/gsoap/all/test_package/CMakeLists.txt +++ b/recipes/gsoap/all/test_package/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package LANGUAGES CXX) find_package(gsoap REQUIRED CONFIG) diff --git a/recipes/gsoap/all/test_package/conanfile.py b/recipes/gsoap/all/test_package/conanfile.py index b6f1a8aefca6f..72383b4f0375e 100644 --- a/recipes/gsoap/all/test_package/conanfile.py +++ b/recipes/gsoap/all/test_package/conanfile.py @@ -1,10 +1,11 @@ -from conan import ConanFile -from conan.tools.build import can_run, cross_building +from conan import ConanFile, conan_version +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv import os -class TestGsoapConan(ConanFile): +class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" test_type = "explicit" @@ -13,23 +14,27 @@ def layout(self): cmake_layout(self) def requirements(self): - self.requires(self.tested_reference_str) + self.requires(self.tested_reference_str, run=True) def build(self): - # TODO: Add some test for the cross-building scenario - - if not cross_building(self): - calc_wsdl = os.path.join(self.source_folder, "calc.wsdl") - self.output.info(f"Generating code from WSDL '{calc_wsdl}'") - self.run(f"wsdl2h -o calc.h {calc_wsdl}", env="conanrun") + if not can_run(self): + self.output.warning("Skipping build: the package was cross-built") + return + calc_wsdl = os.path.join(self.source_folder, "calc.wsdl") + self.output.info(f"Generating code from WSDL '{calc_wsdl}'") + self.run(f"wsdl2h -o calc.h {calc_wsdl}", env="conanrun") + if conan_version.major < "2": + # conan v1 limitation: self.dependencies is not defined in build() method of test package 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") + else: + import_dir = os.path.join(self.dependencies["gsoap"].package_folder, "bin", "import") + self.run(f"soapcpp2 -j -CL -I{import_dir} calc.h", env="conanrun") - cmake = CMake(self) - cmake.configure() - cmake.build() + 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") + bin_path = os.path.join(self.cpp.build.bindir, "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/gsoap/all/test_package/test_package.cpp b/recipes/gsoap/all/test_package/test_package.cpp index bf5391ec2d579..a2173524bd23c 100644 --- a/recipes/gsoap/all/test_package/test_package.cpp +++ b/recipes/gsoap/all/test_package/test_package.cpp @@ -6,15 +6,7 @@ int main() { calcProxy calc; - double sum; - if (calc.add(1.23, 4.56, sum) == SOAP_OK) - { - std::cout << "Sum = " << sum << std::endl; - } - else - { - std::cout << "Cannot sum" << std::endl; - calc.soap_stream_fault(std::cerr); - } calc.destroy(); // same as: soap_destroy(calc.soap); soap_end(calc.soap); + std::cout << "gSoap Test package successful\n"; + return 0; } diff --git a/recipes/gsoap/all/test_v1_package/CMakeLists.txt b/recipes/gsoap/all/test_v1_package/CMakeLists.txt index 0d20897301b68..b21cc49efde95 100644 --- a/recipes/gsoap/all/test_v1_package/CMakeLists.txt +++ b/recipes/gsoap/all/test_v1_package/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) diff --git a/recipes/gsoap/all/test_v1_package/conanfile.py b/recipes/gsoap/all/test_v1_package/conanfile.py index efaa7d687c237..27d9e27609d72 100644 --- a/recipes/gsoap/all/test_v1_package/conanfile.py +++ b/recipes/gsoap/all/test_v1_package/conanfile.py @@ -5,16 +5,22 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "cmake", "cmake_find_package_multi" + test_type = "explicit" - def build(self): - # TODO: Add some test for the cross-building scenario + def requirements(self): + self.requires(self.tested_reference_str) - if not tools.cross_building(self): + 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): calc_wsdl = os.path.join(self.source_folder, os.pardir, "test_package", "calc.wsdl") self.output.info(f"Generating code from WSDL '{calc_wsdl}'") - self.run(f"wsdl2h -o calc.h {calc_wsdl}", run_environment=True) + self.run(f"wsdl2h -o calc.h {calc_wsdl}") 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) + self.run(f"soapcpp2 -j -CL -I{import_dir} calc.h") cmake = CMake(self) cmake.configure() diff --git a/recipes/gsoap/config.yml b/recipes/gsoap/config.yml index 01534d05392ba..89600de4b1c5d 100644 --- a/recipes/gsoap/config.yml +++ b/recipes/gsoap/config.yml @@ -1,9 +1,7 @@ versions: - "2.8.117": + "2.8.134": folder: all - "2.8.116": + "2.8.132": folder: all - "2.8.115": - folder: all - "2.8.114": + "2.8.129": folder: all diff --git a/recipes/gstreamer/all/conandata.yml b/recipes/gstreamer/all/conandata.yml index 5c2457feed4e9..e9f1bbcb66bfb 100644 --- a/recipes/gstreamer/all/conandata.yml +++ b/recipes/gstreamer/all/conandata.yml @@ -1,19 +1,22 @@ sources: - "1.16.2": - sha256: "dac037ab84d557f5d4e6e66e833f6bf8cf4f84671a311e0b2df99f9b30a9d693" - url: "https://gitlab.freedesktop.org/gstreamer/gstreamer/-/archive/1.16.2/gstreamer-1.16.2.tar.bz2" - "1.18.0": - sha256: "f072da67b6dad9b4aecf2cb594aaaa66f86c22af9ba80503b90f957d47015ef8" - url: "https://gitlab.freedesktop.org/gstreamer/gstreamer/-/archive/1.18.0/gstreamer-1.18.0.tar.bz2" - "1.18.3": - url: "https://gitlab.freedesktop.org/gstreamer/gstreamer/-/archive/1.18.3/gstreamer-1.18.3.tar.gz" - sha256: "d7e3917b5d3d9c3bd9bb70b7500314a5725377cff39bcd818df13c1fda0f60ba" - "1.18.4": - url: "https://gitlab.freedesktop.org/gstreamer/gstreamer/-/archive/1.18.4/gstreamer-1.18.4.tar.gz" - sha256: "f0956c2056281f5909d030945a9896810e55084f29b6bcfc401b53e91ddf1c7f" - "1.19.1": - url: "https://gitlab.freedesktop.org/gstreamer/gstreamer/-/archive/1.19.1/gstreamer-1.19.1.tar.gz" - sha256: "2e51f61e59564e48883b5f1996871b0d1c404406aadb9aa1b306de8a2a331a90" + "1.24.7": + url: "https://gstreamer.freedesktop.org/src/gstreamer/gstreamer-1.24.7.tar.xz" + sha256: "c0e75b124c52bb7a0c3dcdb734b2ad260ea7286a8745cf2ea629d4c849e6a958" + "1.22.6": + url: "https://gstreamer.freedesktop.org/src/gstreamer/gstreamer-1.22.6.tar.xz" + sha256: "f500e6cfddff55908f937711fc26a0840de28a1e9ec49621c0b6f1adbd8f818e" + "1.20.6": + url: "https://gstreamer.freedesktop.org/src/gstreamer/gstreamer-1.20.6.tar.xz" + sha256: "0545b030960680f71a95f9d39c95daae54b4d317d335e8f239d81138773c9b90" "1.19.2": url: "https://gitlab.freedesktop.org/gstreamer/gstreamer/-/archive/1.19.2/gstreamer-1.19.2.tar.gz" sha256: "6ec8494867d9b58f145c0c357da631faf21c2c72c7cd8b637b440188fe904ab8" + "1.19.1": + url: "https://gitlab.freedesktop.org/gstreamer/gstreamer/-/archive/1.19.1/gstreamer-1.19.1.tar.gz" + sha256: "2e51f61e59564e48883b5f1996871b0d1c404406aadb9aa1b306de8a2a331a90" + "1.18.4": + url: "https://gitlab.freedesktop.org/gstreamer/gstreamer/-/archive/1.18.4/gstreamer-1.18.4.tar.gz" + sha256: "f0956c2056281f5909d030945a9896810e55084f29b6bcfc401b53e91ddf1c7f" + "1.16.2": + url: "https://gitlab.freedesktop.org/gstreamer/gstreamer/-/archive/1.16.2/gstreamer-1.16.2.tar.bz2" + sha256: "dac037ab84d557f5d4e6e66e833f6bf8cf4f84671a311e0b2df99f9b30a9d693" diff --git a/recipes/gstreamer/all/conanfile.py b/recipes/gstreamer/all/conanfile.py index f2f81654473da..71de230e0d57a 100644 --- a/recipes/gstreamer/all/conanfile.py +++ b/recipes/gstreamer/all/conanfile.py @@ -1,18 +1,27 @@ -from conans import ConanFile, tools, Meson, VisualStudioBuildEnvironment -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, VirtualRunEnv +from conan.tools.files import chdir, copy, 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, check_min_vs +from conan.tools.scm import Version + import glob import os -import shutil -required_conan_version = ">=1.29" +required_conan_version = ">=1.60.0 <2 || >=2.0.5" class GStreamerConan(ConanFile): name = "gstreamer" description = "GStreamer is a development framework for creating applications like media players, video editors, streaming media broadcasters and so on" - topics = ("conan", "gstreamer", "multimedia", "video", "audio", "broadcasting", "framework", "media") + topics = ("multimedia", "video", "audio", "broadcasting", "framework", "media") url = "https://github.com/conan-io/conan-center-index" homepage = "https://gstreamer.freedesktop.org/" - license = "GPL-2.0-only" + license = "LGPL-2.0-or-later" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -24,104 +33,98 @@ class GStreamerConan(ConanFile): "fPIC": True, "with_introspection": False, } - generators = "pkg_config" - _meson = None @property - def _source_subfolder(self): - return "source_subfolder" + def _settings_build(self): + return getattr(self, "settings_build", self.settings) @property - def _build_subfolder(self): - return "build_subfolder" - - def requirements(self): - self.requires("glib/2.72.0") + def _is_legacy_one_profile(self): + return not hasattr(self, "settings_build") - @property - def _is_msvc(self): - return self.settings.compiler == "Visual Studio" + 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 requirements(self): + self.requires("glib/2.78.3", transitive_headers=True, transitive_libs=True) def validate(self): - if not self.options["glib"].shared and self.options.shared: + if not self.dependencies.direct_host["glib"].options.shared and self.options.shared: # https://gitlab.freedesktop.org/gstreamer/gst-build/-/issues/133 raise ConanInvalidConfiguration("shared GStreamer cannot link to static GLib") def build_requirements(self): - self.build_requires("meson/0.61.2") - self.build_requires("pkgconf/1.7.4") + self.tool_requires("meson/[>=1.2.3 <2]") + # There used to be an issue with glib being shared by default but its dependencies being static + # No longer the case, but see: https://github.com/conan-io/conan-center-index/pull/13400#issuecomment-1551565573 for context + if not self._is_legacy_one_profile: + self.tool_requires("glib/") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/[>=2.2 <3]") if self.options.with_introspection: - self.build_requires("gobject-introspection/1.70.0") - if self.settings.os == 'Windows': - self.build_requires("winflexbison/2.5.24") + self.tool_requires("gobject-introspection/1.72.0") + if self._settings_build.os == 'Windows': + self.tool_requires("winflexbison/2.5.25") 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]) - os.rename("%s-%s" % (self.name, self.version), self._source_subfolder) - - def _configure_meson(self): - if self._meson: - return self._meson - meson = Meson(self) - if self._is_msvc: - if tools.Version(self.settings.compiler.version) < "14": - meson.options["c_args"] = " -Dsnprintf=_snprintf" - meson.options["cpp_args"] = " -Dsnprintf=_snprintf" - if self.settings.get_safe("compiler.runtime"): - meson.options["b_vscrt"] = str(self.settings.compiler.runtime).lower() - meson.options["tools"] = "disabled" - meson.options["examples"] = "disabled" - meson.options["benchmarks"] = "disabled" - meson.options["tests"] = "disabled" - meson.options["introspection"] = "enabled" if self.options.with_introspection else "disabled" - meson.configure(build_folder=self._build_subfolder, - source_folder=self._source_subfolder, - args=['--wrap-mode=nofallback']) - self._meson = meson - 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() + if self._is_legacy_one_profile: + VirtualRunEnv(self).generate(scope="build") + pkg_config_deps = PkgConfigDeps(self) + pkg_config_deps.generate() + tc = MesonToolchain(self) + if is_msvc(self) and not check_min_vs(self, "190", raise_invalid=False): + tc.project_options["c_std"] = "c99" + tc.project_options["tools"] = "disabled" + tc.project_options["examples"] = "disabled" + tc.project_options["benchmarks"] = "disabled" + tc.project_options["tests"] = "disabled" + tc.project_options["introspection"] = "enabled" if self.options.with_introspection else "disabled" + tc.generate() def build(self): - with tools.environment_append(VisualStudioBuildEnvironment(self).vars) if self._is_msvc else tools.no_op(): - meson = self._configure_meson() - meson.build() + meson = Meson(self) + meson.configure() + meson.build() def _fix_library_names(self, path): # regression in 1.16 - if self.settings.compiler == "Visual Studio": - with tools.chdir(path): + if 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)) - shutil.move(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(pattern="COPYING", dst="licenses", src=self._source_subfolder) - with tools.environment_append(VisualStudioBuildEnvironment(self).vars) if self._is_msvc else tools.no_op(): - meson = self._configure_meson() - meson.install() + copy(self, "COPYING", self.source_folder, os.path.join(self.package_folder, "licenses")) + meson = Meson(self) + meson.install() self._fix_library_names(os.path.join(self.package_folder, "lib")) 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.rmdir(os.path.join(self.package_folder, "lib", "gstreamer-1.0", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.remove_files_by_mask(self.package_folder, "*.pdb") - - def package_id(self): - self.info.requires["glib"].full_package_mode() + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "gstreamer-1.0", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "*.pdb", self.package_folder, recursive=True) + fix_apple_shared_install_name(self) def package_info(self): gst_plugin_path = os.path.join(self.package_folder, "lib", "gstreamer-1.0") @@ -129,16 +132,18 @@ def package_info(self): pkgconfig_variables = { "exec_prefix": "${prefix}", "toolsdir": "${exec_prefix}/bin", - "pluginsdir": "${libdir}/gstreamer-1.0", + # PkgConfigDep uses libdir1 instead of libdir, so the path is spelled out explicitly here. + "pluginsdir": "${prefix}/lib/gstreamer-1.0", "datarootdir": "${prefix}/share", "datadir": "${datarootdir}", "girdir": "${datadir}/gir-1.0", - "typelibdir": "${libdir}/girepository-1.0", + "typelibdir": "${prefix}/lib/girepository-1.0", "libexecdir": "${prefix}/libexec", "pluginscannerdir": "${libexecdir}/gstreamer-1.0", } pkgconfig_custom_content = "\n".join("{}={}".format(key, value) for key, value in pkgconfig_variables.items()) + self.cpp_info.components["gstreamer-1.0"].set_property("pkg_config_name", "gstreamer-1.0") self.cpp_info.components["gstreamer-1.0"].names["pkg_config"] = "gstreamer-1.0" self.cpp_info.components["gstreamer-1.0"].requires = ["glib::glib-2.0", "glib::gobject-2.0"] if not self.options.shared: @@ -147,15 +152,17 @@ def package_info(self): self.cpp_info.components["gstreamer-1.0"].libs = ["gstreamer-1.0"] self.cpp_info.components["gstreamer-1.0"].includedirs = [os.path.join("include", "gstreamer-1.0")] if self.settings.os == "Linux": - self.cpp_info.components["gstreamer-1.0"].system_libs = ["m"] + self.cpp_info.components["gstreamer-1.0"].system_libs = ["m", "dl", "nsl"] self.cpp_info.components["gstreamer-1.0"].set_property("pkg_config_custom_content", pkgconfig_custom_content) - + + self.cpp_info.components["gstreamer-base-1.0"].set_property("pkg_config_name", "gstreamer-base-1.0") self.cpp_info.components["gstreamer-base-1.0"].names["pkg_config"] = "gstreamer-base-1.0" self.cpp_info.components["gstreamer-base-1.0"].requires = ["gstreamer-1.0"] self.cpp_info.components["gstreamer-base-1.0"].libs = ["gstbase-1.0"] self.cpp_info.components["gstreamer-base-1.0"].includedirs = [os.path.join("include", "gstreamer-1.0")] self.cpp_info.components["gstreamer-base-1.0"].set_property("pkg_config_custom_content", pkgconfig_custom_content) - + + self.cpp_info.components["gstreamer-controller-1.0"].set_property("pkg_config_name", "gstreamer-controller-1.0") self.cpp_info.components["gstreamer-controller-1.0"].names["pkg_config"] = "gstreamer-controller-1.0" self.cpp_info.components["gstreamer-controller-1.0"].requires = ["gstreamer-1.0"] self.cpp_info.components["gstreamer-controller-1.0"].libs = ["gstcontroller-1.0"] @@ -163,13 +170,17 @@ def package_info(self): if self.settings.os == "Linux": self.cpp_info.components["gstreamer-controller-1.0"].system_libs = ["m"] self.cpp_info.components["gstreamer-controller-1.0"].set_property("pkg_config_custom_content", pkgconfig_custom_content) - + + self.cpp_info.components["gstreamer-net-1.0"].set_property("pkg_config_name", "gstreamer-net-1.0") self.cpp_info.components["gstreamer-net-1.0"].names["pkg_config"] = "gstreamer-net-1.0" self.cpp_info.components["gstreamer-net-1.0"].requires = ["gstreamer-1.0", "glib::gio-2.0"] + if Version(self.version) >= "1.21.1" and self.settings.os != "Windows": + self.cpp_info.components["gstreamer-net-1.0"].requires.append("glib::gio-unix-2.0") self.cpp_info.components["gstreamer-net-1.0"].libs = ["gstnet-1.0"] self.cpp_info.components["gstreamer-net-1.0"].includedirs = [os.path.join("include", "gstreamer-1.0")] self.cpp_info.components["gstreamer-net-1.0"].set_property("pkg_config_custom_content", pkgconfig_custom_content) - + + self.cpp_info.components["gstreamer-check-1.0"].set_property("pkg_config_name", "gstreamer-check-1.0") self.cpp_info.components["gstreamer-check-1.0"].names["pkg_config"] = "gstreamer-check-1.0" self.cpp_info.components["gstreamer-check-1.0"].requires = ["gstreamer-1.0"] self.cpp_info.components["gstreamer-check-1.0"].libs = ["gstcheck-1.0"] @@ -177,15 +188,17 @@ def package_info(self): if self.settings.os == "Linux": self.cpp_info.components["gstreamer-check-1.0"].system_libs = ["rt", "m"] self.cpp_info.components["gstreamer-check-1.0"].set_property("pkg_config_custom_content", pkgconfig_custom_content) - - # gstcoreelements and gstcoretracers are plugins which should be loaded dynamicaly, and not linked to directly + + # gstcoreelements and gstcoretracers are plugins which should be loaded dynamically, and not linked to directly if not self.options.shared: + self.cpp_info.components["gstcoreelements"].set_property("pkg_config_name", "gstcoreelements") self.cpp_info.components["gstcoreelements"].names["pkg_config"] = "gstcoreelements" self.cpp_info.components["gstcoreelements"].requires = ["glib::gobject-2.0", "glib::glib-2.0", "gstreamer-1.0", "gstreamer-base-1.0"] self.cpp_info.components["gstcoreelements"].libs = ["gstcoreelements"] self.cpp_info.components["gstcoreelements"].includedirs = [os.path.join("include", "gstreamer-1.0")] self.cpp_info.components["gstcoreelements"].libdirs = [gst_plugin_path] + self.cpp_info.components["gstcoretracers"].set_property("pkg_config_name", "gstcoretracers") self.cpp_info.components["gstcoretracers"].names["pkg_config"] = "gstcoretracers" self.cpp_info.components["gstcoretracers"].requires = ["gstreamer-1.0"] self.cpp_info.components["gstcoretracers"].libs = ["gstcoretracers"] @@ -193,18 +206,23 @@ def package_info(self): self.cpp_info.components["gstcoretracers"].libdirs = [gst_plugin_path] if self.options.shared: - self.output.info("Appending GST_PLUGIN_PATH env var : %s" % gst_plugin_path) - self.env_info.GST_PLUGIN_PATH.append(gst_plugin_path) + self.runenv_info.define_path("GST_PLUGIN_PATH", gst_plugin_path) gstreamer_root = self.package_folder - self.output.info("Creating GSTREAMER_ROOT env var : %s" % gstreamer_root) - self.env_info.GSTREAMER_ROOT = gstreamer_root gst_plugin_scanner = "gst-plugin-scanner.exe" if self.settings.os == "Windows" else "gst-plugin-scanner" gst_plugin_scanner = os.path.join(self.package_folder, "bin", "gstreamer-1.0", gst_plugin_scanner) - self.output.info("Creating GST_PLUGIN_SCANNER env var : %s" % gst_plugin_scanner) + self.runenv_info.define_path("GSTREAMER_ROOT", gstreamer_root) + self.runenv_info.define_path("GST_PLUGIN_SCANNER", gst_plugin_scanner) + if self.settings.arch == "x86": + self.runenv_info.define_path("GSTREAMER_ROOT_X86", gstreamer_root) + elif self.settings.arch == "x86_64": + self.runenv_info.define_path("GSTREAMER_ROOT_X86_64", gstreamer_root) + + # TODO: remove the following when only Conan 2.0 is supported + if self.options.shared: + self.env_info.GST_PLUGIN_PATH.append(gst_plugin_path) + self.env_info.GSTREAMER_ROOT = gstreamer_root self.env_info.GST_PLUGIN_SCANNER = gst_plugin_scanner if self.settings.arch == "x86": - self.output.info("Creating GSTREAMER_ROOT_X86 env var : %s" % gstreamer_root) self.env_info.GSTREAMER_ROOT_X86 = gstreamer_root elif self.settings.arch == "x86_64": - self.output.info("Creating GSTREAMER_ROOT_X86_64 env var : %s" % gstreamer_root) self.env_info.GSTREAMER_ROOT_X86_64 = gstreamer_root diff --git a/recipes/gstreamer/all/test_package/CMakeLists.txt b/recipes/gstreamer/all/test_package/CMakeLists.txt index 4e7b0a54031d8..d70e14ee506c0 100644 --- a/recipes/gstreamer/all/test_package/CMakeLists.txt +++ b/recipes/gstreamer/all/test_package/CMakeLists.txt @@ -1,15 +1,28 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(gstreamer REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} - gstreamer::gstreamer-1.0 gstreamer::gstreamer-base-1.0 gstreamer::gstreamer-controller-1.0 - gstreamer::gstreamer-net-1.0 gstreamer::gstreamer-check-1.0) -if (TARGET gstreamer::gstcoreelements) - target_link_libraries(${PROJECT_NAME} gstreamer::gstcoreelements) -endif () + +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") + target_link_libraries(${PROJECT_NAME} PRIVATE + gstreamer::gstreamer-1.0 gstreamer::gstreamer-base-1.0 gstreamer::gstreamer-controller-1.0 + gstreamer::gstreamer-net-1.0 gstreamer::gstreamer-check-1.0) + if (TARGET gstreamer::gstcoreelements) + target_link_libraries(${PROJECT_NAME} PRIVATE gstreamer::gstcoreelements) + endif () +else() + find_package(PkgConfig REQUIRED) + pkg_check_modules(gstreamer-1.0 REQUIRED IMPORTED_TARGET gstreamer-1.0) + pkg_check_modules(gstreamer-base-1.0 REQUIRED IMPORTED_TARGET gstreamer-base-1.0) + pkg_check_modules(gstreamer-controller-1.0 REQUIRED IMPORTED_TARGET gstreamer-controller-1.0) + pkg_check_modules(gstreamer-net-1.0 REQUIRED IMPORTED_TARGET gstreamer-net-1.0) + pkg_check_modules(gstreamer-check-1.0 REQUIRED IMPORTED_TARGET gstreamer-check-1.0) + pkg_check_modules(gstcoreelements IMPORTED_TARGET gstcoreelements) + target_link_libraries(${PROJECT_NAME} PRIVATE PkgConfig::gstreamer-1.0 PkgConfig::gstreamer-base-1.0 PkgConfig::gstreamer-controller-1.0 + PkgConfig::gstreamer-net-1.0 PkgConfig::gstreamer-check-1.0) + if (TARGET PkgConfig::gstcoreelements) + target_link_libraries(${PROJECT_NAME} PRIVATE PkgConfig::gstcoreelements) + endif () +endif() diff --git a/recipes/gstreamer/all/test_package/conanfile.py b/recipes/gstreamer/all/test_package/conanfile.py index 49a3a66ea5bad..c0da610abd3b1 100644 --- a/recipes/gstreamer/all/test_package/conanfile.py +++ b/recipes/gstreamer/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, 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", "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/2.1.0") + + def generate(self): + # Print debug information from gstreamer at runtime + env = Environment() + env.define("GST_DEBUG", "7") + env.vars(self, scope="run").save_script("conanrun_gstdebug") 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/gstreamer/all/test_v1_package/CMakeLists.txt b/recipes/gstreamer/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..73976ce47fac2 --- /dev/null +++ b/recipes/gstreamer/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(gstreamer REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE + gstreamer::gstreamer-1.0 gstreamer::gstreamer-base-1.0 gstreamer::gstreamer-controller-1.0 + gstreamer::gstreamer-net-1.0 gstreamer::gstreamer-check-1.0) +if (TARGET gstreamer::gstcoreelements) + target_link_libraries(${PROJECT_NAME} PRIVATE gstreamer::gstcoreelements) +endif () diff --git a/recipes/gstreamer/all/test_v1_package/conanfile.py b/recipes/gstreamer/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/gstreamer/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/gstreamer/config.yml b/recipes/gstreamer/config.yml index e2a4a362c2d1c..99cca4b40e56f 100644 --- a/recipes/gstreamer/config.yml +++ b/recipes/gstreamer/config.yml @@ -1,13 +1,15 @@ versions: - "1.16.2": + "1.24.7": folder: all - "1.18.0": + "1.22.6": folder: all - "1.18.3": + "1.20.6": folder: all - "1.18.4": + "1.19.2": folder: all "1.19.1": folder: all - "1.19.2": + "1.18.4": + folder: all + "1.16.2": folder: all diff --git a/recipes/gtest/all/conandata.yml b/recipes/gtest/all/conandata.yml index 57289aca6e374..7b9115d9da952 100644 --- a/recipes/gtest/all/conandata.yml +++ b/recipes/gtest/all/conandata.yml @@ -1,10 +1,22 @@ sources: + "1.15.0": + url: "https://github.com/google/googletest/releases/download/v1.15.0/googletest-1.15.0.tar.gz" + sha256: "7315acb6bf10e99f332c8a43f00d5fbb1ee6ca48c52f6b936991b216c586aaad" + "1.14.0": + url: "https://github.com/google/googletest/archive/refs/tags/v1.14.0.tar.gz" + sha256: "8ad598c73ad796e0d8280b082cebd82a630d73e73cd3c70057938a6501bba5d7" + "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.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.10.0": - patch_file: "patches/gtest-1.10.0.patch" @@ -12,5 +24,9 @@ patches: patch_type: "conan" - patch_file: "patches/gtest-1.10.0-override.patch" patch_description: "prevent compiler from complaining while compiling" - patch_type: "backport" + patch_type: "bugfix" patch_source: "https://github.com/google/googletest/pull/2507" + "1.8.1": + - patch_file: "patches/gtest-1.8.1.patch" + patch_description: "add CUSTOM_DEBUG_POSTFIX option" + patch_type: "conan" diff --git a/recipes/gtest/all/conanfile.py b/recipes/gtest/all/conanfile.py index cdbad83c02fff..9b88c6888f25b 100644 --- a/recipes/gtest/all/conanfile.py +++ b/recipes/gtest/all/conanfile.py @@ -3,11 +3,11 @@ 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, rm, rmdir -from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +from conan.tools.microsoft import is_msvc_static_runtime, msvc_runtime_flag from conan.tools.scm import Version import os -required_conan_version = ">=1.53.0" +required_conan_version = ">=1.54.0" class GTestConan(ConanFile): @@ -17,6 +17,7 @@ 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], @@ -25,6 +26,7 @@ class GTestConan(ConanFile): "no_main": [True, False], "hide_symbols": [True, False], "debug_postfix": ["ANY"], + "disable_pthreads": [True, False], } default_options = { "shared": False, @@ -33,25 +35,37 @@ class GTestConan(ConanFile): "no_main": False, "hide_symbols": False, "debug_postfix": "d", + "disable_pthreads": False, } + # disallow cppstd compatibility, as it affects the ABI in this library + # see https://github.com/conan-io/conan-center-index/issues/23854 + # Requires Conan >=1.53.0 <2 || >=2.1.0 to work + extension_properties = {"compatibility_cppstd": False} @property - def _minimum_cpp_standard(self): - return 11 + def _min_cppstd(self): + return "11" if Version(self.version) < "1.13.0" else "14" @property def _minimum_compilers_version(self): return { - "Visual Studio": "14", - "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", - } - - @property - def _is_clang_cl(self): - return self.settings.os == "Windows" and self.settings.compiler == "clang" + "11": { + "Visual Studio": "14", + "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): export_conandata_patches(self) @@ -73,14 +87,11 @@ def package_id(self): del self.info.options.no_main # Only used to expose more targets def validate(self): - if self.info.options.shared and (is_msvc(self) or self._is_clang_cl) and is_msvc_static_runtime(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.info.settings.get_safe("compiler.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(".")] @@ -88,43 +99,40 @@ def loose_lt_semver(v1, v2): min_length = min(len(lv1), len(lv2)) return lv1[:min_length] < lv2[:min_length] - compiler = self.info.settings.compiler + 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.ref} requires {compiler} {min_version}. The current compiler is {compiler} {compiler.version}." + 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) - # 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["BUILD_GMOCK"] = bool(self.options.build_gmock) tc.variables["gtest_hide_internal_symbols"] = bool(self.options.hide_symbols) 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.variables["gtest_force_shared_crt"] = not is_msvc_static_runtime(self) - if self.settings.os == "Windows" and self.settings.compiler == "gcc": - tc.variables["gtest_disable_pthreads"] = True + if self.settings.compiler.get_safe("runtime"): + tc.variables["gtest_force_shared_crt"] = "MD" in msvc_runtime_flag(self) + tc.variables["gtest_disable_pthreads"] = self.options.disable_pthreads + 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): - internal_utils = os.path.join(self.source_folder, "googletest", - "cmake", "internal_utils.cmake") 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", "") - if is_msvc(self) or self._is_clang_cl: - # No warnings as errors - replace_in_file(self, internal_utils, "-WX", "") - def build(self): self._patch_sources() cmake = CMake(self) @@ -154,7 +162,8 @@ def package_info(self): self.cpp_info.components["libgtest"].libs = [f"gtest{self._postfix}"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["libgtest"].system_libs.append("m") - self.cpp_info.components["libgtest"].system_libs.append("pthread") + if not self.options.disable_pthreads: + self.cpp_info.components["libgtest"].system_libs.append("pthread") if self.settings.os == "Neutrino" and self.settings.os.version == "7.1": self.cpp_info.components["libgtest"].system_libs.append("regex") if self.options.shared: diff --git a/recipes/gtest/all/patches/gtest-1.8.1.patch b/recipes/gtest/all/patches/gtest-1.8.1.patch new file mode 100755 index 0000000000000..838ab42c89f02 --- /dev/null +++ b/recipes/gtest/all/patches/gtest-1.8.1.patch @@ -0,0 +1,13 @@ +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 b62a59b30f394..3ca688fabb972 100644 --- a/recipes/gtest/all/test_package/CMakeLists.txt +++ b/recipes/gtest/all/test_package/CMakeLists.txt @@ -5,7 +5,11 @@ find_package(GTest REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE GTest::gtest) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +if(GTest_VERSION VERSION_LESS "1.13.0") + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +else() + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) +endif() if(WITH_MAIN) target_link_libraries(${PROJECT_NAME} PRIVATE GTest::gtest_main) diff --git a/recipes/gtest/config.yml b/recipes/gtest/config.yml index 0ca5dd0b1675e..e0f7e6d533d7f 100644 --- a/recipes/gtest/config.yml +++ b/recipes/gtest/config.yml @@ -1,5 +1,13 @@ versions: + "1.15.0": + folder: all + "1.14.0": + folder: all + "1.13.0": + folder: all "1.12.1": folder: all "1.10.0": folder: all + "1.8.1": + folder: all diff --git a/recipes/gtk-doc-stub/all/conandata.yml b/recipes/gtk-doc-stub/all/conandata.yml index f0e15055fe310..c03929cb0c469 100644 --- a/recipes/gtk-doc-stub/all/conandata.yml +++ b/recipes/gtk-doc-stub/all/conandata.yml @@ -5,4 +5,3 @@ sources: patches: "cci.20181216": - patch_file: "patches/0001-relocatable-gtkdocize.patch" - base_path: "source_subfolder" diff --git a/recipes/gtk-doc-stub/all/conanfile.py b/recipes/gtk-doc-stub/all/conanfile.py index dc86c338bb133..e2a8032aad958 100644 --- a/recipes/gtk-doc-stub/all/conanfile.py +++ b/recipes/gtk-doc-stub/all/conanfile.py @@ -1,8 +1,13 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, tools -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 +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 -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class GtkDocStubConan(ConanFile): @@ -12,54 +17,59 @@ class GtkDocStubConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" license = "GPL-2.0-or-later" topics = ("gtk", "documentation", "gtkdocize") + package_type = "application" settings = "os" - exports_sources = "patches/*" - - @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 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 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) - - @functools.lru_cache(1) - def _configure_autotools(self): - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - args = [ - "--datadir={}".format(tools.unix_path(os.path.join(self.package_folder, "res"))), - "--datarootdir={}".format(tools.unix_path(os.path.join(self.package_folder, "res"))), - ] - 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): + virtual_build_env = VirtualBuildEnv(self) + virtual_build_env.generate() + tc = AutotoolsToolchain(self) + tc.configure_args.append("--datarootdir=${prefix}/res") + 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() + copy(self, "COPYING", self.source_folder, os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) autotools.install() def package_info(self): + self.cpp_info.includedirs = [] self.cpp_info.libdirs = [] self.cpp_info.resdirs = ["res"] - automake_dir = tools.unix_path(os.path.join(self.package_folder, "res", "aclocal")) - self.output.info("Appending AUTOMAKE_CONAN_INCLUDES environment variable: {}".format(automake_dir)) + self.buildenv_info.append_path("PATH", os.path.join(self.package_folder, "bin")) + + automake_dir = unix_path_package_info_legacy(self, os.path.join(self.package_folder, "res", "aclocal")) + self.buildenv_info.append_path("AUTOMAKE_CONAN_INCLUDES", automake_dir) + + # TODO: remove the following when only Conan 2.0 is supported + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) self.env_info.AUTOMAKE_CONAN_INCLUDES.append(automake_dir) diff --git a/recipes/gtk-doc-stub/all/test_package/conanfile.py b/recipes/gtk-doc-stub/all/test_package/conanfile.py index 9346d5cf9cd7a..f3486b7aa5a22 100644 --- a/recipes/gtk-doc-stub/all/test_package/conanfile.py +++ b/recipes/gtk-doc-stub/all/test_package/conanfile.py @@ -1,37 +1,45 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, tools -import os -import shutil +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.files import copy +from conan.tools.env import VirtualBuildEnv +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - exports_sources = "configure.ac", + exports_sources = "configure.ac" test_type = "explicit" + 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 requirements(self): - self.requires(self.tested_reference_str) + def layout(self): + basic_layout(self) 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") - self.build_requires("automake/1.16.4") + 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") + self.tool_requires("automake/1.16.5") + + def generate(self): + virtual_build_env = VirtualBuildEnv(self) + virtual_build_env.generate() + tc = AutotoolsToolchain(self) + tc.configure_args.append("--enable-option-checking=fatal") + tc.configure_args.append("--enable-gtk-doc=no") + tc.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")), run_environment=True, win_bash=tools.os_info.is_windows) - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - args = [ - "--enable-option-checking=fatal", - "--enable-gtk-doc=no", - ] - autotools.configure(args=args) + copy(self, "configure.ac", self.export_sources_folder, self.build_folder) + autotools = Autotools(self) + autotools.autoreconf() + autotools.configure() def test(self): - self.run("gtkdocize --copy", run_environment=True, win_bash=tools.os_info.is_windows) + if can_run(self): + self.run(f"gtkdocize --version", env="conanbuild") diff --git a/recipes/gtk/system/conanfile.py b/recipes/gtk/system/conanfile.py index eaa08c92e96a6..265377d6fedfe 100644 --- a/recipes/gtk/system/conanfile.py +++ b/recipes/gtk/system/conanfile.py @@ -1,9 +1,9 @@ from conan import ConanFile -from conan.errors import ConanInvalidConfiguration, ConanException +from conan.errors import ConanInvalidConfiguration +from conan.tools.gnu import PkgConfig from conan.tools.system import package_manager -from conans import tools -required_conan_version = ">=1.47" +required_conan_version = ">=1.50.0" class ConanGTK(ConanFile): @@ -12,37 +12,21 @@ 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" + topics = ("gui", "widget", "graphical") + package_type = "shared-library" settings = "os", "arch", "compiler", "build_type" options = {"version": [2, 3]} default_options = {"version": 2} - topics = ("gui", "widget", "graphical") - def validate(self): - if self.settings.os not in ["Linux", "FreeBSD"]: - raise ConanInvalidConfiguration("This recipe supports only Linux and FreeBSD") + def layout(self): + pass 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(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] - 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.components[name].system_libs = libs - self.cpp_info.components[name].libdirs = lib_dirs - self.cpp_info.components[name].sharedlinkflags = ldflags - self.cpp_info.components[name].exelinkflags = ldflags - self.cpp_info.components[name].defines = defines - self.cpp_info.components[name].includedirs = include_dirs - self.cpp_info.components[name].cflags = cflags - self.cpp_info.components[name].cxxflags = cflags + def validate(self): + if self.settings.os not in ["Linux", "FreeBSD"]: + raise ConanInvalidConfiguration("This recipe supports only Linux and FreeBSD") def system_requirements(self): dnf = package_manager.Dnf(self) @@ -65,4 +49,5 @@ def system_requirements(self): def package_info(self): for name in [f"gtk+-{self.options.version}.0"]: - self._fill_cppinfo_from_pkgconfig(name) + pkg_config = PkgConfig(self, name) + pkg_config.fill_cpp_info(self.cpp_info, is_system=True) diff --git a/recipes/gtk/system/test_package/CMakeLists.txt b/recipes/gtk/system/test_package/CMakeLists.txt index 7b9b613cbb24a..7439c8794d1a1 100644 --- a/recipes/gtk/system/test_package/CMakeLists.txt +++ b/recipes/gtk/system/test_package/CMakeLists.txt @@ -1,8 +1,10 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package C) +cmake_minimum_required(VERSION 3.15) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +project(test_package LANGUAGES C) + +find_package(gtk REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) + +target_link_libraries(${PROJECT_NAME} PRIVATE gtk::gtk) + diff --git a/recipes/gtk/system/test_package/conanfile.py b/recipes/gtk/system/test_package/conanfile.py index bd7165a553cf4..1111583fea732 100644 --- a/recipes/gtk/system/test_package/conanfile.py +++ b/recipes/gtk/system/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" + 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.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/hiredis/0.x.x/test_package/CMakeLists.txt b/recipes/gtk/system/test_v1_package/CMakeLists.txt similarity index 100% rename from recipes/hiredis/0.x.x/test_package/CMakeLists.txt rename to recipes/gtk/system/test_v1_package/CMakeLists.txt diff --git a/recipes/gtk/system/test_v1_package/conanfile.py b/recipes/gtk/system/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..bd7165a553cf4 --- /dev/null +++ b/recipes/gtk/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" + + 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/gtk/system/test_v1_package/test_package.c b/recipes/gtk/system/test_v1_package/test_package.c new file mode 100644 index 0000000000000..3d9a10b5d775d --- /dev/null +++ b/recipes/gtk/system/test_v1_package/test_package.c @@ -0,0 +1,8 @@ +#include +#include + +int main(void) { + gtk_window_new (GTK_WINDOW_TOPLEVEL); + + return EXIT_SUCCESS; +} diff --git a/recipes/gtlab-logging/all/conandata.yml b/recipes/gtlab-logging/all/conandata.yml new file mode 100644 index 0000000000000..a3c93f35dda32 --- /dev/null +++ b/recipes/gtlab-logging/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "4.4.1": + sha256: "3f905b36de130e32a3b2230b78fee8dfc2747775a6171c7a81d3d02843093e72" + url: "https://github.com/dlr-gtlab/gt-logging/archive/refs/tags/4-4-1.tar.gz" diff --git a/recipes/gtlab-logging/all/conanfile.py b/recipes/gtlab-logging/all/conanfile.py new file mode 100644 index 0000000000000..4faba2a85c630 --- /dev/null +++ b/recipes/gtlab-logging/all/conanfile.py @@ -0,0 +1,110 @@ +from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout +from conan.tools import files +from conan.tools.build import check_min_cppstd +from conan.errors import ConanInvalidConfiguration +from conan import ConanFile +import os + +required_conan_version = ">=1.59.0" + +class GTLabLoggingConan(ConanFile): + name = "gtlab-logging" + license = "BSD-3-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/dlr-gtlab/gt-logging" + topics = ("logging", "qt") + description = "Simple logging interface with qt support" + + settings = "os", "arch", "compiler", "build_type" + package_type = "library" + + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_qt": [True, False] + } + default_options = { + "shared": False, + "fPIC": True, + "with_qt": False + } + + def requirements(self): + if self.options.with_qt: + self.requires("qt/[>=5.15 <7]", transitive_headers=True) + + + @property + def _min_cppstd(self): + return "14" + + @property + def _minimum_compilers_version(self): + return { + "14": { + "Visual Studio": "15", + "msvc": "191", + "gcc": "7.3.1", + "clang": "6", + "apple-clang": "14", + }, + }.get(self._min_cppstd, {}) + + def validate(self): + if self.settings.get_safe("compiler.cppstd"): + check_min_cppstd(self, self._min_cppstd) + + def loose_lt_semver(v1, v2): + return all(int(p1) < int(p2) for p1, p2 in zip(str(v1).split("."), str(v2).split("."))) + + 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.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) + + def generate(self): + CMakeToolchain(self).generate() + CMakeDeps(self).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 source(self): + files.get(self, **self.conan_data["sources"][self.version], + strip_root=True, destination=self.source_folder) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + + def package(self): + cmake = CMake(self) + cmake.install() + + files.rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + files.copy(self, os.path.join("LICENSES", "BSD-3-Clause.txt"), dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + + def package_info(self): + self.cpp_info.libs = ["GTlabLogging"] if self.settings.build_type != "Debug" else ["GTlabLogging-d"] + + self.cpp_info.includedirs.append(os.path.join("include", "logging")) + + self.cpp_info.libdirs = [os.path.join("lib", "logging")] + + self.cpp_info.set_property("cmake_file_name", "GTlabLogging") + self.cpp_info.set_property("cmake_target_name", "GTlab::Logging") + + if self.options.with_qt: + self.cpp_info.defines = ['GT_LOG_USE_QT_BINDINGS'] diff --git a/recipes/gtlab-logging/all/test_package/CMakeLists.txt b/recipes/gtlab-logging/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..78edd9030ca73 --- /dev/null +++ b/recipes/gtlab-logging/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.12) +project(PackageTest CXX) + +find_package(GTlabLogging REQUIRED) + +add_executable(example example.cpp) +target_link_libraries(example GTlab::Logging) diff --git a/recipes/gtlab-logging/all/test_package/conanfile.py b/recipes/gtlab-logging/all/test_package/conanfile.py new file mode 100644 index 0000000000000..1f279ef73c18b --- /dev/null +++ b/recipes/gtlab-logging/all/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 GTlabLoggingTestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + 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) + + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "example") + self.run(bin_path, env="conanrun") diff --git a/recipes/gtlab-logging/all/test_package/example.cpp b/recipes/gtlab-logging/all/test_package/example.cpp new file mode 100644 index 0000000000000..831dda5df891b --- /dev/null +++ b/recipes/gtlab-logging/all/test_package/example.cpp @@ -0,0 +1,6 @@ +#include + +int main() { + gtError() << "Hello World"; + return 0; +} diff --git a/recipes/gtlab-logging/config.yml b/recipes/gtlab-logging/config.yml new file mode 100644 index 0000000000000..e4bb798c7e054 --- /dev/null +++ b/recipes/gtlab-logging/config.yml @@ -0,0 +1,3 @@ +versions: + "4.4.1": + folder: all 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..243d25034c49e 100644 --- a/recipes/gtsam/all/conandata.yml +++ b/recipes/gtsam/all/conandata.yml @@ -1,26 +1,50 @@ sources: + "4.2": + url: "https://github.com/borglab/gtsam/archive/refs/tags/4.2.tar.gz" + sha256: "9ff8846d0a83a245c284cb5760ec2d74535ef9b5885183ccfefd7ff122eba60e" "4.1.1": url: "https://github.com/borglab/gtsam/archive/4.1.1.tar.gz" sha256: "c7b5e6cdad52b141c272778f47baf628975457be3e26ed96a7bc2ae685a00af0" "4.0.3": url: "https://github.com/borglab/gtsam/archive/4.0.3.tar.gz" sha256: "eaa561749edf7a2d402981828253e28aed6c717dae35738301c5ab23e2595f25" - "4.0.2": - url: "https://github.com/borglab/gtsam/archive/4.0.2.tar.gz" - sha256: "8770a440f1af98c3f0d9d4dffd568de2d4c21b245e7231e987e26bc236aeb5aa" patches: + "4.2": + - patch_file: "patches/4.1.1-0001-cmake-boost.patch" + patch_description: "Use boost targets" + patch_type: "conan" + - patch_file: "patches/4.2.0-0001-macos-rpath.patch" + patch_description: "Relocatable shared libs on Apple OS" + patch_type: "conan" + - patch_file: "patches/4.2.0-0002-eigen3-version.patch" + patch_description: "Get Eigen3 version info from Conan" + patch_type: "conan" "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.3-0004-cmake-project.patch" + patch_description: "CMake: move project() after cmake_minimum_required()" + patch_type: "conan" + - patch_file: "patches/4.1.1-0005-eigen3-version.patch" + patch_description: "Get Eigen3 version info from Conan" + 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" - "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.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.3-0004-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..b0e2304308da8 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): @@ -12,180 +15,321 @@ class GtsamConan(ConanFile): license = "BSD-3-Clause" homepage = "https://github.com/borglab/gtsam" 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") + description = ("GTSAM is a library of C++ classes that implement " + "smoothing and mapping (SAM) in robotics and vision") + topics = ("mapping", "smoothing", "optimization", "factor-graphs", + "state-estimation", "computer-vision", "robotics") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], - "use_quaternions": [True, False], + "allow_deprecated": [True, False], + "build_type_postfixes": [True, False], + "build_unstable": [True, False], + "build_with_march_native": [True, False], + "default_allocator": [None, "STL", "BoostPool", "TBB", "tcmalloc"], + "disable_new_timers": [True, False], + "enable_consistency_checks": [True, False], + "install_cppunitlite": [True, False], + "install_matlab_toolbox": [True, False], "pose3_expmap": [True, False], "rot3_expmap": [True, False], - "enable_consistency_checks": [True, False], + "slow_but_correct_betweenfactor": [True, False], + "support_nested_dissection": [True, False], + "tangent_preintegration": [True, False], + "throw_cheirality_exception": [True, False], + "use_quaternions": [True, False], "with_TBB": [True, False], "with_eigen_MKL": [True, False], "with_eigen_MKL_OPENMP": [True, False], - "throw_cheirality_exception": [True, False], - "allow_deprecated_since_V4": [True, False], - "typedef_points_to_vectors": [True, False], - "support_nested_dissection": [True, False], - "tangent_preintegration": [True, False], + + # Removed since v4.1 "build_wrap": [True, False], - "wrap_serialization": [True, False], - "build_unstable": [True, False], - "disable_new_timers": [True, False], - "build_type_postfixes": [True, False], - "install_matlab_toolbox": [True, False], "install_cython_toolbox": [True, False], - "install_cppunitlite": [True, False], + "typedef_points_to_vectors": [True, False], + "wrap_serialization": [True, False], } default_options = { "shared": False, "fPIC": True, - "use_quaternions": False, - "pose3_expmap": False, - "rot3_expmap": False, + "allow_deprecated": True, + "build_type_postfixes": True, + "build_unstable": True, + "build_with_march_native": False, + "default_allocator": None, + "disable_new_timers": False, "enable_consistency_checks": False, - "with_TBB": False, + "install_cppunitlite": True, + "install_matlab_toolbox": False, + "pose3_expmap": True, + "rot3_expmap": True, + "slow_but_correct_betweenfactor": False, + "support_nested_dissection": True, + "tangent_preintegration": True, + "throw_cheirality_exception": True, + "use_quaternions": False, + "with_TBB": True, "with_eigen_MKL": False, "with_eigen_MKL_OPENMP": False, - "throw_cheirality_exception": True, - "allow_deprecated_since_V4": True, - "typedef_points_to_vectors": False, - "support_nested_dissection": False, - "tangent_preintegration": False, + + # < v4.1 only "build_wrap": False, - "wrap_serialization": True, - "build_unstable": True, - "disable_new_timers": False, - "build_type_postfixes": True, - "install_matlab_toolbox": False, "install_cython_toolbox": False, - "install_cppunitlite": True, + "typedef_points_to_vectors": False, + "wrap_serialization": True, } + options_description = { + "allow_deprecated": "Allow use of deprecated methods/functions", + "build_type_postfixes": "Append the build type to the name of compiled libraries", + "build_unstable": "Enable building of gtsam_unstable", + "build_with_march_native": "Build with all instructions supported by native architecture (binary may not be portable!)", + "default_allocator": "Set preferred memory allocator. If unset, defaults to STL or to TBB, if with_TBB is enabled", + "disable_new_timers": "Disables using Boost.chrono for timing", + "enable_consistency_checks": "Enable expensive consistency checks", + "install_cppunitlite": "Install CppUnitLite library as a component", + "install_matlab_toolbox": "Install MATLAB toolbox", + "pose3_expmap": "Use Pose3::EXPMAP as the default mode. If disabled, Pose3::FIRST_ORDER will be used.", + "rot3_expmap": ("Ignore if GTSAM_USE_QUATERNIONS is OFF (Rot3::EXPMAP by default). " + "Otherwise, enable Rot3::EXPMAP, or if disabled, use Rot3::CAYLEY."), + "slow_but_correct_betweenfactor": "Use the slower but correct version of BetweenFactor", + "support_nested_dissection": "Support METIS-based nested dissection", + "tangent_preintegration": "Use the new ImuFactor with integration on tangent space", + "throw_cheirality_exception": "Throw exception when a triangulated point is behind a camera", + "use_quaternions": ("Enable an internal Quaternion representation for rotations instead of rotation matrices. " + "If enabled, Rot3::EXPMAP is enforced by default."), + "with_TBB": "Use Intel Threaded Building Blocks (TBB)", + "with_eigen_MKL": "Eigen will use Intel MKL if available", + "with_eigen_MKL_OPENMP": "Eigen, when using Intel MKL, will also use OpenMP for multithreading if available", - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + # < v4.1 only + "build_wrap": "Build Matlab/Cython wrap utility (necessary for Matlab/Cython interface)", + "install_cython_toolbox": "Install Cython toolbox", + "typedef_points_to_vectors": "Typedef Point2 and Point3 to Eigen::Vector equivalents", + "wrap_serialization": "Allow wrapped objects to be saved via boost.serialization", + } 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) >= "4.1": + del self.options.build_wrap + del self.options.install_cython_toolbox + del self.options.typedef_points_to_vectors + del self.options.wrap_serialization + else: + del self.options.slow_but_correct_betweenfactor 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("eigen/3.4.0") + self.requires("boost/1.84.0", transitive_headers=True) + self.requires("eigen/3.4.0", transitive_headers=True) if self.options.with_TBB: - self.requires("onetbb/2020.3") + if Version(self.version) >= "4.1": + self.requires("onetbb/2021.10.0", transitive_headers=True, transitive_libs=True) + else: + self.requires("onetbb/2020.3.3", transitive_headers=True, transitive_libs=True) + if self.options.default_allocator == "tcmalloc": + self.requires("gperftools/2.15") + if self.options.support_nested_dissection: + # Used in a public header here: + # https://github.com/borglab/gtsam/blob/4.2.0/gtsam_unstable/partition/FindSeparator-inl.h#L23-L27 + self.requires("metis/5.2.1", transitive_headers=True, transitive_libs=True) @property def _required_boost_components(self): - return ["serialization", "system", "filesystem", "thread", "date_time", "regex", "timer", "chrono"] + # Based on https://github.com/borglab/gtsam/blob/4.2.0/cmake/HandleBoost.cmake#L26 + return [ + "chrono", + "date_time", + "filesystem", + "program_options", + "regex", + "serialization", + "system", + "thread", + "timer", + ] 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: - raise ConanInvalidConfiguration("gtsam with tbb requires onetbb:tbbmalloc=True") + if self.options.with_TBB: + if self.options.default_allocator in [None, "TBB"]: + if not self.dependencies["onetbb"].options.tbbmalloc: + raise ConanInvalidConfiguration("GTSAM with TBB requires onetbb/*:tbbmalloc=True") + elif self.options.default_allocator != "tcmalloc": + raise ConanInvalidConfiguration(f"with_TBB option cannot be used with default_allocator={self.options.default_allocator}") + elif self.options.default_allocator == "TBB": + raise ConanInvalidConfiguration("default_allocator=TBB requires with_TBB=True") + + check_min_vs(self, "191") - if is_msvc(self) and tools.Version(self.settings.compiler.version) < 15: - raise ConanInvalidConfiguration ("GTSAM requires MSVC >= 15") + if Version(self.version) >= "4.1" 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" + if Version(self.version) < "4.2" + else "https://github.com/borglab/gtsam/issues/1541" + ) - 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 self.options.support_nested_dissection and self.dependencies["metis"].options.with_64bit_types: + raise ConanInvalidConfiguration("GTSAM does not support METIS with 64-bit types") 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) + # https://github.com/borglab/gtsam/blob/4.2.0/cmake/HandleGeneralOptions.cmake + tc.variables["GTSAM_BUILD_UNSTABLE"] = self.options.build_unstable + tc.variables["GTSAM_UNSTABLE_BUILD_PYTHON"] = False + tc.variables["GTSAM_UNSTABLE_INSTALL_MATLAB_TOOLBOX"] = self.options.install_matlab_toolbox + 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_BUILD_PYTHON"] = False + tc.variables["GTSAM_INSTALL_MATLAB_TOOLBOX"] = self.options.install_matlab_toolbox + tc.variables["GTSAM_ALLOW_DEPRECATED_SINCE_V4"] = self.options.allow_deprecated + tc.variables["GTSAM_ALLOW_DEPRECATED_SINCE_V41"] = self.options.allow_deprecated + tc.variables["GTSAM_ALLOW_DEPRECATED_SINCE_V42"] = self.options.allow_deprecated + tc.variables["GTSAM_SUPPORT_NESTED_DISSECTION"] = self.options.support_nested_dissection + tc.variables["GTSAM_TANGENT_PREINTEGRATION"] = self.options.tangent_preintegration + # Added in 4.1+ + if Version(self.version) >= "4.1": + tc.variables["GTSAM_SLOW_BUT_CORRECT_BETWEENFACTOR"] = self.options.slow_but_correct_betweenfactor + tc.variables["GTSAM_BUILD_WITH_CCACHE"] = False + # https://github.com/borglab/gtsam/blob/4.2.0/cmake/HandleAllocators.cmake + if self.options.default_allocator is not None: + tc.variables["GTSAM_DEFAULT_ALLOCATOR"] = self.options.default_allocator + # https://github.com/borglab/gtsam/blob/4.2.0/cmake/GtsamBuildTypes.cmake#L59 + tc.variables["GTSAM_BUILD_TYPE_POSTFIXES"] = self.options.build_type_postfixes + # https://github.com/borglab/gtsam/blob/4.2.0/cmake/GtsamBuildTypes.cmake#L193 + tc.variables["GTSAM_BUILD_WITH_MARCH_NATIVE"] = self.options.build_with_march_native + # https://github.com/borglab/gtsam/blob/4.2.0/cmake/HandleBoost.cmake#L36 + tc.variables["GTSAM_DISABLE_NEW_TIMERS"] = self.options.disable_new_timers + # https://github.com/borglab/gtsam/blob/4.2.0/CppUnitLite/CMakeLists.txt#L13 + tc.variables["GTSAM_INSTALL_CPPUNITLITE"] = self.options.install_cppunitlite + # https://github.com/borglab/gtsam/blob/4.2.0/cmake/HandleEigen.cmake#L3 + tc.variables["GTSAM_USE_SYSTEM_EIGEN"] = True + # https://github.com/borglab/gtsam/blob/4.2.0/cmake/HandleMetis.cmake#L11 + tc.variables["GTSAM_USE_SYSTEM_METIS"] = False + # https://github.com/borglab/gtsam/blob/4.2.0/gtsam/3rdparty/CMakeLists.txt#L76 + tc.variables["GTSAM_INSTALL_GEOGRAPHICLIB"] = False + # https://github.com/borglab/gtsam/blob/4.2.0/matlab/CMakeLists.txt#L14-L15 + tc.variables["GTSAM_MEX_BUILD_STATIC_MODULE"] = False + # https://github.com/borglab/gtsam/blob/4.2.0/cmake/GtsamTesting.cmake#L89-L91 + tc.variables["GTSAM_BUILD_TESTS"] = False + tc.variables["GTSAM_BUILD_EXAMPLES_ALWAYS"] = False + tc.variables["GTSAM_BUILD_TIMING_ALWAYS"] = False + # https://github.com/borglab/gtsam/blob/4.2.0/doc/CMakeLists.txt + tc.variables["GTSAM_BUILD_DOCS"] = False + tc.variables["GTSAM_BUILD_DOC_HTML"] = False + tc.variables["GTSAM_BUILD_DOC_LATEX"] = False + + # Removed in 4.1+ + if Version(self.version) < "4.1": + # https://github.com/borglab/gtsam/blob/4.0.3/CMakeLists.txt + tc.variables["GTSAM_BUILD_WRAP"] = self.options.build_wrap + tc.variables["GTSAM_INSTALL_CYTHON_TOOLBOX"] = self.options.install_cython_toolbox + tc.variables["GTSAM_TYPEDEF_POINTS_TO_VECTORS"] = self.options.typedef_points_to_vectors + # https://github.com/borglab/gtsam/blob/4.0.3/wrap/CMakeLists.txt#L15 + tc.variables["GTSAM_WRAP_SERIALIZATION"] = self.options.wrap_serialization + + tc.variables["Boost_USE_STATIC_LIBS"] = not self.dependencies["boost"].options.shared + tc.variables["Boost_NO_SYSTEM_PATHS"] = True + + if Version(self.version) < "4.1": + # Fix "The practice of declaring the Bind placeholders (_1, _2, ...) in the global namespace is deprecated" + tc.preprocessor_definitions["BOOST_BIND_GLOBAL_PLACEHOLDERS"] = "" + + tc.generate() + + deps = CMakeDeps(self) + deps.set_property("metis", "cmake_target_name", "metis-gtsam-if") + 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)} ") + + # Ensure a newer CMake standard is used for non-cache_variables support and other policies + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "cmake_minimum_required(VERSION 3.0)", + "cmake_minimum_required(VERSION 3.15)") + + # Fix tcmalloc / gperftools handling + if self.options.default_allocator == "tcmalloc": + handle_allocators_path = os.path.join(self.source_folder, "cmake", "HandleAllocators.cmake") + if Version(self.version) < "4.1": + handle_allocators_path = os.path.join(self.source_folder, "CMakeLists.txt") + replace_in_file(self, handle_allocators_path, + "if(GOOGLE", + ("find_package(gperftools REQUIRED)\n" + "set(GOOGLE_PERFTOOLS_FOUND TRUE)\n" + "if(GOOGLE")) + replace_in_file(self, handle_allocators_path, + 'GTSAM_ADDITIONAL_LIBRARIES "tcmalloc"', + 'GTSAM_ADDITIONAL_LIBRARIES "gperftools::gperftools"') + + # Fix HandleMetis.cmake incompatibility with METIS from Conan + save(self, os.path.join(self.source_folder, "cmake", "HandleMetis.cmake"), + "find_package(metis REQUIRED CONFIG)\n") + + # Fix TBB handling + handle_tbb_path = os.path.join(self.source_folder, "cmake", "HandleTBB.cmake") + if Version(self.version) < "4.1": + handle_tbb_path = os.path.join(self.source_folder, "CMakeLists.txt") + replace_in_file(self, handle_tbb_path, "find_package(TBB 4.4 ", "find_package(TBB ") + if Version(self.version) < "4.2.1": + replace_in_file(self, handle_tbb_path, + "list(APPEND GTSAM_ADDITIONAL_LIBRARIES tbb tbbmalloc)", + "list(APPEND GTSAM_ADDITIONAL_LIBRARIES TBB::tbb TBB::tbbmalloc)") + 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,72 +342,75 @@ 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): + # GTSAM uses targets without a namespace prefix: + # https://github.com/borglab/gtsam/blob/4.2.0/cmake/example_cmake_find_gtsam/CMakeLists.txt self.cpp_info.set_property("cmake_file_name", "GTSAM") - 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"].requires.append("eigen::eigen") + gtsam = self.cpp_info.components["libgtsam"] + gtsam.set_property("cmake_target_name", "gtsam") + gtsam.libs = ["gtsam"] + gtsam.requires = [f"boost::{component}" for component in self._required_boost_components] + gtsam.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": - self.cpp_info.components["libgtsam"].system_libs = ["dbghelp"] + gtsam.requires.append("onetbb::onetbb") + if self.options.default_allocator == "tcmalloc": + gtsam.requires.append("gperftools::gperftools") + if self.settings.os == "Windows": + gtsam.system_libs = ["dbghelp"] + if Version(self.version) < "4.1": + # Fix "The practice of declaring the Bind placeholders (_1, _2, ...) in the global namespace is deprecated" + gtsam.defines.append("BOOST_BIND_GLOBAL_PLACEHOLDERS") 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"].requires = ["libgtsam"] + gtsam_unstable = self.cpp_info.components["libgtsam_unstable"] + gtsam_unstable.set_property("cmake_target_name", "gtsam_unstable") + gtsam_unstable.libs = ["gtsam_unstable"] + gtsam_unstable.requires = ["libgtsam"] if self.options.support_nested_dissection: - self.cpp_info.components["libmetis-gtsam"].set_property("cmake_target_name", "metis-gtsam") - self.cpp_info.components["libmetis-gtsam"].libs = ["metis-gtsam"] - self.cpp_info.components["libmetis-gtsam"].names["pkg_config"] = "metis-gtsam" + gtsam.requires.append("metis::metis") if self.options.install_cppunitlite: - self.cpp_info.components["gtsam_CppUnitLite"].set_property("cmake_target_name", "CppUnitLite") - self.cpp_info.components["gtsam_CppUnitLite"].libs = ["CppUnitLite"] - self.cpp_info.components["gtsam_CppUnitLite"].requires = ["boost::boost"] + cppunitlite = self.cpp_info.components["gtsam_CppUnitLite"] + cppunitlite.set_property("cmake_target_name", "CppUnitLite") + cppunitlite.libs = ["CppUnitLite"] + cppunitlite.requires = ["boost::boost"] + + if is_msvc(self) and not self.options.shared: + for component in self.cpp_info.components.values(): + component.libs = [f"lib{lib}" for lib in component.libs if lib.startswith("gtsam")] + if self.options.build_type_postfixes and self.settings.build_type != "Release": + for component in self.cpp_info.components.values(): + component.libs = [f"{lib}{self.settings.build_type}" for lib in component.libs] # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.names["cmake_find_package"] = "GTSAM" self.cpp_info.names["cmake_find_package_multi"] = "GTSAM" - self.cpp_info.components["libgtsam"].names["cmake_find_package"] = "gtsam" - self.cpp_info.components["libgtsam"].names["cmake_find_package_multi"] = "gtsam" - self.cpp_info.components["libgtsam"].build_modules["cmake_find_package"] = [self._module_file_rel_path] - self.cpp_info.components["libgtsam"].build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] - if self.options.build_unstable: - self.cpp_info.components["libgtsam_unstable"].names["cmake_find_package"] = "gtsam_unstable" - self.cpp_info.components["libgtsam_unstable"].names["cmake_find_package_multi"] = "gtsam_unstable" - self.cpp_info.components["libgtsam_unstable"].build_modules["cmake_find_package"] = [self._module_file_rel_path] - self.cpp_info.components["libgtsam_unstable"].build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] - if self.options.support_nested_dissection: - self.cpp_info.components["libmetis-gtsam"].names["cmake_find_package"] = "metis-gtsam" - self.cpp_info.components["libmetis-gtsam"].names["cmake_find_package_multi"] = "metis-gtsam" - self.cpp_info.components["libmetis-gtsam"].build_modules["cmake_find_package"] = [self._module_file_rel_path] - self.cpp_info.components["libmetis-gtsam"].build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] - if self.options.install_cppunitlite: - self.cpp_info.components["gtsam_CppUnitLite"].names["cmake_find_package"] = "CppUnitLite" - self.cpp_info.components["gtsam_CppUnitLite"].names["cmake_find_package_multi"] = "CppUnitLite" - self.cpp_info.components["gtsam_CppUnitLite"].build_modules["cmake_find_package"] = [self._module_file_rel_path] - self.cpp_info.components["gtsam_CppUnitLite"].build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] + for component_name, lib_name in [ + ("libgtsam", "gtsam"), + ("libgtsam_unstable", "gtsam_unstable"), + ("libmetis-gtsam", "metis-gtsam"), + ("gtsam_CppUnitLite", "CppUnitLite"), + ]: + if component_name in self.cpp_info.components: + component = self.cpp_info.components[component_name] + component.names["cmake_find_package"] = lib_name + component.names["cmake_find_package_multi"] = lib_name + component.build_modules["cmake_find_package"] = [self._module_file_rel_path] + component.build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] 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.0.2.patch b/recipes/gtsam/all/patches/0002-macos-rpath-4.0.2.patch deleted file mode 100644 index 6bc74d30d7ff1..0000000000000 --- a/recipes/gtsam/all/patches/0002-macos-rpath-4.0.2.patch +++ /dev/null @@ -1,34 +0,0 @@ ---- 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/gtsam/CMakeLists.txt -+++ b/gtsam/CMakeLists.txt -@@ -177,9 +177,6 @@ if(WIN32) # Add 'lib' prefix to static library to avoid filename collision with - endif() - - if (APPLE AND BUILD_SHARED_LIBS) -- set_target_properties(gtsam PROPERTIES -- INSTALL_NAME_DIR -- "${CMAKE_INSTALL_PREFIX}/lib") - endif() - - install( ---- a/gtsam/3rdparty/metis/libmetis/CMakeLists.txt -+++ b/gtsam/3rdparty/metis/libmetis/CMakeLists.txt -@@ -16,9 +16,6 @@ if(WIN32) - endif() - - if (APPLE) -- set_target_properties(metis PROPERTIES -- INSTALL_NAME_DIR -- "${CMAKE_INSTALL_PREFIX}/lib") - endif() - - install(TARGETS metis EXPORT GTSAM-exports LIBRARY DESTINATION lib ARCHIVE DESTINATION lib RUNTIME DESTINATION bin) 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.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/4.0.3-0004-cmake-project.patch b/recipes/gtsam/all/patches/4.0.3-0004-cmake-project.patch new file mode 100644 index 0000000000000..e6d665e0c60aa --- /dev/null +++ b/recipes/gtsam/all/patches/4.0.3-0004-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/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/patches/4.1.1-0005-eigen3-version.patch b/recipes/gtsam/all/patches/4.1.1-0005-eigen3-version.patch new file mode 100644 index 0000000000000..8bd45c6d8f747 --- /dev/null +++ b/recipes/gtsam/all/patches/4.1.1-0005-eigen3-version.patch @@ -0,0 +1,21 @@ +Otherwise the Eigen version detection will fail due to the Eigen path variable containing a generator expression. +diff --git a/cmake/HandleEigen.cmake b/cmake/HandleEigen.cmake +--- a/cmake/HandleEigen.cmake ++++ b/cmake/HandleEigen.cmake +@@ -46,6 +46,8 @@ + endif() + + # Detect Eigen version: ++set(GTSAM_EIGEN_VERSION "${Eigen3_VERSION_STRING}") ++if (FALSE) + set(EIGEN_VER_H "${GTSAM_EIGEN_INCLUDE_FOR_BUILD}/Eigen/src/Core/util/Macros.h") + if (EXISTS ${EIGEN_VER_H}) + file(READ "${EIGEN_VER_H}" STR_EIGEN_VERSION) +@@ -67,6 +69,7 @@ + else() + message(WARNING "Cannot determine Eigen version, missing file: `${EIGEN_VER_H}`") + endif () ++endif() + + if (MSVC) + if (BUILD_SHARED_LIBS) diff --git a/recipes/gtsam/all/patches/4.2.0-0001-macos-rpath.patch b/recipes/gtsam/all/patches/4.2.0-0001-macos-rpath.patch new file mode 100644 index 0000000000000..2f60f9adaef8a --- /dev/null +++ b/recipes/gtsam/all/patches/4.2.0-0001-macos-rpath.patch @@ -0,0 +1,30 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -5,5 +5,4 @@ cmake_minimum_required(VERSION 3.0) + 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/patches/4.2.0-0002-eigen3-version.patch b/recipes/gtsam/all/patches/4.2.0-0002-eigen3-version.patch new file mode 100644 index 0000000000000..19bc6febd2db0 --- /dev/null +++ b/recipes/gtsam/all/patches/4.2.0-0002-eigen3-version.patch @@ -0,0 +1,20 @@ +diff --git a/cmake/HandleEigen.cmake b/cmake/HandleEigen.cmake +--- a/cmake/HandleEigen.cmake ++++ b/cmake/HandleEigen.cmake +@@ -59,6 +59,8 @@ + endif() + + # Detect Eigen version: ++set(GTSAM_EIGEN_VERSION "${Eigen3_VERSION_STRING}") ++if (FALSE) + set(EIGEN_VER_H "${GTSAM_EIGEN_INCLUDE_FOR_BUILD}/Eigen/src/Core/util/Macros.h") + if (EXISTS ${EIGEN_VER_H}) + file(READ "${EIGEN_VER_H}" STR_EIGEN_VERSION) +@@ -80,6 +82,7 @@ + else() + message(WARNING "Cannot determine Eigen version, missing file: `${EIGEN_VER_H}`") + endif () ++endif() + + if (MSVC) + if (BUILD_SHARED_LIBS) 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/config.yml b/recipes/gtsam/config.yml index 6f380a83ebb14..92f20f30ab347 100644 --- a/recipes/gtsam/config.yml +++ b/recipes/gtsam/config.yml @@ -1,7 +1,7 @@ versions: + "4.2": + folder: all "4.1.1": folder: all "4.0.3": folder: all - "4.0.2": - folder: all diff --git a/recipes/guetzli/all/conandata.yml b/recipes/guetzli/all/conandata.yml index d051b6e10260b..0581848785da0 100644 --- a/recipes/guetzli/all/conandata.yml +++ b/recipes/guetzli/all/conandata.yml @@ -2,7 +2,3 @@ sources: "1.0.1": url: "https://github.com/google/guetzli/archive/v1.0.1.tar.gz" sha256: "e52eb417a5c0fb5a3b08a858c8d10fa797627ada5373e203c196162d6a313697" -patches: - "1.0.1": - - base_path: "source_subfolder" - patch_file: "patches/0001-no-debug.patch" diff --git a/recipes/guetzli/all/conanfile.py b/recipes/guetzli/all/conanfile.py index acf147558e0f4..1ca0fe9e70fdd 100644 --- a/recipes/guetzli/all/conanfile.py +++ b/recipes/guetzli/all/conanfile.py @@ -1,76 +1,105 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, MSBuild, tools -from conans.errors import ConanInvalidConfiguration import os +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import chdir, copy, get, replace_in_file, rm +from conan.tools.gnu import AutotoolsToolchain, Autotools, AutotoolsDeps +from conan.tools.layout import basic_layout +from conan.tools.microsoft import MSBuild, MSBuildToolchain, is_msvc, MSBuildDeps + +required_conan_version = ">=1.47.0" + class GoogleGuetzliConan(ConanFile): name = "guetzli" + description = "Perceptual JPEG encoder" license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://opensource.google/projects/guetzli" - description = "Perceptual JPEG encoder" - topics = "jpeg", "compression" - exports_sources = "patches/**" - settings = "os", "compiler", "arch" - generators = "pkg_config" - requires = ["libpng/1.6.37"] + topics = ("jpeg", "compression") - @property - def _source_subfolder(self): - return "source_subfolder" + package_type = "application" + settings = "os", "arch", "compiler", "build_type" - @property - def _is_msvc(self): - return self.settings.compiler == "Visual Studio" + def layout(self): + basic_layout(self, src_folder="src") - def configure(self): - if self.settings.os not in ["Linux", "Windows"]: - raise ConanInvalidConfiguration("conan recipe for guetzli v{0} is not \ - available in {1}.".format(self.version, self.settings.os)) - - if self.settings.compiler.get_safe("libcxx") == "libc++": - raise ConanInvalidConfiguration("conan recipe for guetzli v{0} cannot be\ - built with libc++".format(self.version)) + def requirements(self): + self.requires("libpng/[>=1.6 <2]") + + def package_id(self): + del self.info.settings.compiler + def validate(self): + if self.settings.os not in ["Linux", "FreeBSD", "Windows"]: + raise ConanInvalidConfiguration( + f"conan recipe for {self.ref} is not available in {self.settings.os}." + ) + if str(self.settings.compiler.get_safe("libcxx")) == "libc++": + raise ConanInvalidConfiguration( + f"conan recipe for {self.ref} cannot be built with libc++" + ) def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = "guetzli-" + self.version - os.rename(extracted_dir, 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 = "Debug" if self.settings.build_type == "Debug" else "Release" + tc.generate() + deps = MSBuildDeps(self) + deps.generate() + else: + tc = AutotoolsToolchain(self) + tc.generate() + deps = AutotoolsDeps(self) + deps.generate() def _patch_sources(self): - for patch in self.conan_data["patches"][self.version]: - tools.patch(**patch) + if is_msvc(self): + # TODO: to remove once https://github.com/conan-io/conan/pull/12817 available in conan client + 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"" + vcxproj_file = os.path.join(self.source_folder, "guetzli.vcxproj") + replace_in_file(self, vcxproj_file, + "v140", + f"{platform_toolset}") + if props_path: + replace_in_file(self, vcxproj_file, + '', + f'{import_conan_generators}') + else: + if self.settings.build_type not in ["Debug", "RelWithDebInfo"]: + replace_in_file(self, os.path.join(self.source_folder, "guetzli.make"), " -g ", " ") def build(self): self._patch_sources() - if self._is_msvc: + if is_msvc(self): msbuild = MSBuild(self) - with tools.chdir(self._source_subfolder): - msbuild.build("guetzli.sln", build_type="Release") + with chdir(self, self.source_folder): + msbuild.build("guetzli.sln") else: - autotools = AutoToolsBuildEnvironment(self) - with tools.chdir(self._source_subfolder): - env_vars = {"PKG_CONFIG_PATH": self.build_folder} - env_vars.update(autotools.vars) - with tools.environment_append(env_vars): - make_args = [ - "config=release", - "verbose=1'," - ] - autotools.make(args=make_args) + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.make() def package(self): - if self._is_msvc: - self.copy(os.path.join(self._source_subfolder, "bin", str(self.settings.arch), "Release", "guetzli.exe"), dst="bin", keep_path=False) - else: - self.copy(os.path.join(self._source_subfolder, "bin", "Release", "guetzli"), dst="bin", keep_path=False) - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - - def package_id(self): - del self.info.settings.compiler + for path in (self.source_path / "bin").rglob("guetzli*"): + copy(self, path.name, + dst=os.path.join(self.package_folder, "bin"), + src=path.parent) + copy(self, "LICENSE", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder) + rm(self, "*.pdb", self.package_folder, recursive=True) 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) + self.cpp_info.frameworkdirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] + self.cpp_info.includedirs = [] diff --git a/recipes/guetzli/all/patches/0001-no-debug.patch b/recipes/guetzli/all/patches/0001-no-debug.patch deleted file mode 100644 index e3d119caf2292..0000000000000 --- a/recipes/guetzli/all/patches/0001-no-debug.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- guetzli.make -+++ guetzli.make -@@ -19,8 +19,8 @@ - INCLUDES += -I. -Ithird_party/butteraugli - FORCE_INCLUDE += - ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES) -- ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -O3 -g `pkg-config --cflags libpng` -- ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -O3 -g -std=c++11 `pkg-config --cflags libpng` -+ ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -O3 `pkg-config --cflags libpng` -+ ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -O3 -std=c++11 `pkg-config --cflags libpng` - ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) - LIBS += - LDDEPS += -@@ -46,8 +46,8 @@ - INCLUDES += -I. -Ithird_party/butteraugli - FORCE_INCLUDE += - ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES) -- ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -g `pkg-config --cflags libpng` -- ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -g -std=c++11 `pkg-config --cflags libpng` -+ ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) `pkg-config --cflags libpng` -+ ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -std=c++11 `pkg-config --cflags libpng` - ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) - LIBS += - LDDEPS += diff --git a/recipes/guetzli/all/test_package/conanfile.py b/recipes/guetzli/all/test_package/conanfile.py index 49abdec557672..addf429c28646 100644 --- a/recipes/guetzli/all/test_package/conanfile.py +++ b/recipes/guetzli/all/test_package/conanfile.py @@ -1,16 +1,18 @@ import os -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.build import can_run -class GoogleguetzliTestConan(ConanFile): - settings = "os", "compiler", "build_type", "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): - bees_path = os.path.join(self.source_folder, "bees.png") - if not tools.cross_building(self.settings): - app = "guetzli" - if self.settings.os == "Windows": - app += ".exe" - self.run("{} --quality 84 {} bees.jpg".format(app, bees_path), - run_environment=True) + if can_run(self): + bees_path = os.path.join(self.source_folder, "bees.png") + self.run(f"guetzli --quality 84 {bees_path} bees.jpg") diff --git a/recipes/guetzli/all/test_v1_package/conanfile.py b/recipes/guetzli/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..c30ef97cb4cf1 --- /dev/null +++ b/recipes/guetzli/all/test_v1_package/conanfile.py @@ -0,0 +1,12 @@ +import os + +from conans import ConanFile, tools + + +class GoogleguetzliTestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + + def test(self): + bees_path = os.path.join(self.source_folder, os.pardir, "test_package", "bees.png") + if not tools.cross_building(self.settings): + self.run(f"guetzli --quality 84 {bees_path} bees.jpg", run_environment=True) diff --git a/recipes/guetzli/config.yml b/recipes/guetzli/config.yml index 312ec85b4db11..67af1aea3aa55 100644 --- a/recipes/guetzli/config.yml +++ b/recipes/guetzli/config.yml @@ -1,4 +1,3 @@ versions: "1.0.1": folder: "all" - diff --git a/recipes/gurkenlaeufer/all/conandata.yml b/recipes/gurkenlaeufer/all/conandata.yml new file mode 100644 index 0000000000000..8c528ae68f26c --- /dev/null +++ b/recipes/gurkenlaeufer/all/conandata.yml @@ -0,0 +1,9 @@ +sources: + "1.1.0": + url: + - "https://github.com/paulelsner/gurkenlaeufer/archive/refs/tags/v1.1.0.zip" + sha256: "afa8ff520354ece11c97537ba61998b04fca02d3eda1909d112f008dd4522ba0" + "1.0.1": + url: + - "https://github.com/paulelsner/gurkenlaeufer/archive/refs/tags/v1.0.1.zip" + sha256: "3b156fe3f14a1e61e848632ebb8118dca331c61ad7b135d40500dbad1549d70d" diff --git a/recipes/gurkenlaeufer/all/conanfile.py b/recipes/gurkenlaeufer/all/conanfile.py new file mode 100644 index 0000000000000..50934895c439f --- /dev/null +++ b/recipes/gurkenlaeufer/all/conanfile.py @@ -0,0 +1,53 @@ +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get, rmdir +from conan.tools.layout import basic_layout +import os + + +required_conan_version = ">=1.52.0" + + +class GurkenlaeuferConan(ConanFile): + name = "gurkenlaeufer" + description = "Simple way to write cucumber tests for your C++ projects" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/paulelsner/gurkenlaeufer" + topics = ("testing", "header-only", "cucumber", "gherkin") + package_type = "header-library" + 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("gtest/1.12.1", 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], strip_root=True) + rmdir(self, os.path.join(self.source_folder, "gtest")) + + def build(self): + pass + + def package(self): + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder,"licenses")) + copy(self, "*.h", os.path.join(self.source_folder, "include"), os.path.join(self.package_folder, "include")) + + def package_info(self): + # Folders not used for header-only + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/gurkenlaeufer/all/test_package/CMakeLists.txt b/recipes/gurkenlaeufer/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..51bf4a2706c39 --- /dev/null +++ b/recipes/gurkenlaeufer/all/test_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(gurkenlaeufer REQUIRED) + +add_executable(${PROJECT_NAME} main.cpp parsertests.cpp) + +target_link_libraries(${PROJECT_NAME} PRIVATE gurkenlaeufer::gurkenlaeufer) + +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/gurkenlaeufer/all/test_package/conanfile.py b/recipes/gurkenlaeufer/all/test_package/conanfile.py new file mode 100644 index 0000000000000..fb58033b71878 --- /dev/null +++ b/recipes/gurkenlaeufer/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 TestGurkenlaeuferConan(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): + 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) diff --git a/recipes/gurkenlaeufer/all/test_package/main.cpp b/recipes/gurkenlaeufer/all/test_package/main.cpp new file mode 100644 index 0000000000000..08fb83905205f --- /dev/null +++ b/recipes/gurkenlaeufer/all/test_package/main.cpp @@ -0,0 +1,7 @@ +#include "gtest/gtest.h" + +int main(int argc, char** argv) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/recipes/gurkenlaeufer/all/test_package/parsertests.cpp b/recipes/gurkenlaeufer/all/test_package/parsertests.cpp new file mode 100644 index 0000000000000..f0cb9f35c7e8f --- /dev/null +++ b/recipes/gurkenlaeufer/all/test_package/parsertests.cpp @@ -0,0 +1,27 @@ +#include "gmock/gmock.h" +#include "gtest/gtest.h" + +#include "gurkenlaeufer/Parser.h" +#include "gurkenlaeufer/ParserStateFactory.h" +#include "gurkenlaeufer/ScenarioCollection.h" +#include "gurkenlaeufer/ScenarioInterface.h" + +using namespace testing; +using namespace gurkenlaeufer; + +struct MockIScenarioCollection : public IScenarioCollection { + MOCK_METHOD1(appendScenario, void(Scenario steps)); + MOCK_CONST_METHOD0(getScenarios, std::list()); +}; + +TEST(ParserTest, shouldParseOneScenario) +{ + auto scenariosMock = std::make_shared(); + Parser parser(IParserStateFactoryPtr(new ParserStateFactory(scenariosMock))); + + EXPECT_CALL(*scenariosMock, appendScenario(_)); + parser.parseLine("Scenario: Add two numbers."); + parser.parseLine("Given I have entered 1 into the calculator"); + parser.finish(); +} + diff --git a/recipes/gurkenlaeufer/all/test_v1_package/CMakeLists.txt b/recipes/gurkenlaeufer/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..9d54a092e0a67 --- /dev/null +++ b/recipes/gurkenlaeufer/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/gurkenlaeufer/all/test_v1_package/conanfile.py b/recipes/gurkenlaeufer/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..7d408490e37b7 --- /dev/null +++ b/recipes/gurkenlaeufer/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 TestGurkenlaeuferV1Conan(ConanFile): + settings = "os", "arch", "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/gurkenlaeufer/config.yml b/recipes/gurkenlaeufer/config.yml new file mode 100644 index 0000000000000..20ec1c9e2bdee --- /dev/null +++ b/recipes/gurkenlaeufer/config.yml @@ -0,0 +1,5 @@ +versions: + "1.1.0": + folder: all + "1.0.1": + folder: all diff --git a/recipes/gzip-hpp/all/conanfile.py b/recipes/gzip-hpp/all/conanfile.py index 9401872c82770..8e576978736f7 100644 --- a/recipes/gzip-hpp/all/conanfile.py +++ b/recipes/gzip-hpp/all/conanfile.py @@ -16,6 +16,7 @@ class GzipHppConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/mapbox/gzip-hpp" topics = ("gzip", "zlib", "compression", "decompression", "header-only") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -27,7 +28,7 @@ def layout(self): basic_layout(self, src_folder="src") def requirements(self): - self.requires("zlib/1.2.13", transitive_headers=True) + self.requires("zlib/[>=1.2.11 <2]") def package_id(self): self.info.clear() @@ -37,7 +38,7 @@ def validate(self): 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def build(self): pass 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..1976ac70237aa 100644 --- a/recipes/h3/all/conanfile.py +++ b/recipes/h3/all/conanfile.py @@ -1,19 +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, 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 H3Conan(ConanFile): name = "h3" description = "Hexagonal hierarchical geospatial indexing system." license = "Apache-2.0" - topics = ("h3", "hierarchical", "geospatial", "indexing") + topics = ("hierarchical", "geospatial", "indexing") homepage = "https://github.com/uber/h3" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -29,8 +31,7 @@ class H3Conan(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 +39,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.libcxx") + self.settings.rm_safe("compiler.cppstd") def layout(self): cmake_layout(self, src_folder="src") + def build_requirements(self): + if Version(self.version) >= "4.1.0": + self.tool_requires("cmake/[>=3.20 <4]") + 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,11 +83,9 @@ def package_info(self): self.cpp_info.set_property("cmake_file_name", "h3") self.cpp_info.set_property("cmake_target_name", "h3::h3") self.cpp_info.libs = ["h3"] - self.cpp_info.defines.append("H3_PREFIX={}".format(self.options.h3_prefix)) + self.cpp_info.defines.append(f"H3_PREFIX={self.options.h3_prefix}") if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("m") if self.options.build_filters: - 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/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/conanfile.py b/recipes/h3/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/h3/all/test_package/conanfile.py +++ b/recipes/h3/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/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..8a624a3c51a3b 100644 --- a/recipes/h5pp/all/conandata.yml +++ b/recipes/h5pp/all/conandata.yml @@ -1,19 +1,57 @@ sources: - "1.8.3": - sha256: 52d439a0008cb76071f0e839d15ca6a4e911a87dc779f0bbd9dc91d98ba0b52b - url: https://github.com/DavidAce/h5pp/archive/v1.8.3.tar.gz - "1.8.4": - sha256: 401f2014d90d9ce318e518e368e7e45fc2aa95b8e30cdc91baa41212df15b831 - url: https://github.com/DavidAce/h5pp/archive/v1.8.4.tar.gz - "1.8.5": - sha256: 1e1a42159fccd10b1022445ea0f0690c5314e94b0fc3d5c9fa0f02b165148c18 - url: https://github.com/DavidAce/h5pp/archive/v1.8.5.tar.gz + "1.11.2": + url: "https://github.com/DavidAce/h5pp/archive/v1.11.2.tar.gz" + sha256: "5638bf699a92049910c80a7af3d6c8495f02253dd32ee0000bc35a29a9e61e9c" + "1.11.1": + url: "https://github.com/DavidAce/h5pp/archive/v1.11.1.tar.gz" + sha256: "659d566dcb011e7a0f14f9fec9d6e6c783559eec3fd051de1e5cf44d95fd752b" + "1.11.0.1": + url: "https://github.com/DavidAce/h5pp/archive/v1.11.0.1.tar.gz" + sha256: "73b08273c36220fad2836897138f4e0adbe347ea7d1cc7c22f9783a29b24f967" + "1.11.0": + url: "https://github.com/DavidAce/h5pp/archive/v1.11.0.tar.gz" + sha256: "1c4171275eb50a26ed9da8055397f03a726896c4c49ad0380b16dcb13574ecff" + "1.10.0": + url: "https://github.com/DavidAce/h5pp/archive/v1.10.0.tar.gz" + sha256: "27a3e42ed02d8d9341229d58a517134753e1ea46dab4c40d01bb309098c32f13" + "1.9.0": + url: "https://github.com/DavidAce/h5pp/archive/v1.9.0.tar.gz" + sha256: "f633b6f76ab20e1767f55068154cf8bf553e39d526ae80947388640c57ea2056" "1.8.6": - sha256: 39d413c9383b00a87153b9480ab6a91ba356d3f30b3598de0c0c8f7f3bd802c7 - url: https://github.com/DavidAce/h5pp/archive/v1.8.6.tar.gz + url: "https://github.com/DavidAce/h5pp/archive/v1.8.6.tar.gz" + sha256: "39d413c9383b00a87153b9480ab6a91ba356d3f30b3598de0c0c8f7f3bd802c7" + "1.8.5": + url: "https://github.com/DavidAce/h5pp/archive/v1.8.5.tar.gz" + sha256: "1e1a42159fccd10b1022445ea0f0690c5314e94b0fc3d5c9fa0f02b165148c18" + "1.8.4": + url: "https://github.com/DavidAce/h5pp/archive/v1.8.4.tar.gz" + sha256: "401f2014d90d9ce318e518e368e7e45fc2aa95b8e30cdc91baa41212df15b831" + "1.8.3": + url: "https://github.com/DavidAce/h5pp/archive/v1.8.3.tar.gz" + sha256: "52d439a0008cb76071f0e839d15ca6a4e911a87dc779f0bbd9dc91d98ba0b52b" +patches: "1.9.0": - sha256: f633b6f76ab20e1767f55068154cf8bf553e39d526ae80947388640c57ea2056 - url: https://github.com/DavidAce/h5pp/archive/v1.9.0.tar.gz - "1.10.0": - sha256: 27a3e42ed02d8d9341229d58a517134753e1ea46dab4c40d01bb309098c32f13 - url: https://github.com/DavidAce/h5pp/archive/v1.10.0.tar.gz + - patch_file: "patches/fix-support-new-hdf5-v1.9.0.patch" + patch_type: "bugfix" + patch_source: "https://github.com/DavidAce/h5pp/commit/a8471cd2a21310bae0564eeed21dc00c457d674d" + patch_description: "Adds support for HDF5 versions later than 1.12.1 by allowing the construction of h5pp::hid types from any integral type (not just hid_t)" + "1.8.6": + - patch_file: "patches/fix-support-new-hdf5-v1.8.6.patch" + patch_type: "bugfix" + patch_source: "https://github.com/DavidAce/h5pp/commit/a8471cd2a21310bae0564eeed21dc00c457d674d" + patch_description: "Adds support for HDF5 versions later than 1.12.1 by allowing the construction of h5pp::hid types from any integral type (not just hid_t)" + "1.8.5": + - patch_file: "patches/fix-support-new-hdf5-v1.8.3-5.patch" + patch_type: "bugfix" + patch_source: "https://github.com/DavidAce/h5pp/commit/a8471cd2a21310bae0564eeed21dc00c457d674d" + patch_description: "Adds support for HDF5 versions later than 1.12.1 by allowing the construction of h5pp::hid types from any integral type (not just hid_t)" + "1.8.4": + - patch_file: "patches/fix-support-new-hdf5-v1.8.3-5.patch" + patch_type: "bugfix" + patch_source: "https://github.com/DavidAce/h5pp/commit/a8471cd2a21310bae0564eeed21dc00c457d674d" + patch_description: "Adds support for HDF5 versions later than 1.12.1 by allowing the construction of h5pp::hid types from any integral type (not just hid_t)" + "1.8.3": + - patch_file: "patches/fix-support-new-hdf5-v1.8.3-5.patch" + patch_type: "bugfix" + patch_source: "https://github.com/DavidAce/h5pp/commit/a8471cd2a21310bae0564eeed21dc00c457d674d" + patch_description: "Adds support for HDF5 versions later than 1.12.1 by allowing the construction of h5pp::hid types from any integral type (not just hid_t)" diff --git a/recipes/h5pp/all/conanfile.py b/recipes/h5pp/all/conanfile.py index 7179031345df5..d86cc080b5e0a 100644 --- a/recipes/h5pp/all/conanfile.py +++ b/recipes/h5pp/all/conanfile.py @@ -1,33 +1,43 @@ +from conan import ConanFile +from conan.tools.layout import basic_layout 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.files import copy +from conan.tools.files import 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.45.0" - +required_conan_version = ">=1.50.0" class H5ppConan(ConanFile): name = "h5pp" description = "A C++17 wrapper for HDF5 with focus on simplicity" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/DavidAce/h5pp" - topics = ("h5pp", "hdf5", "binary", "storage", "header-only", "cpp17") + topics = ("hdf5", "binary", "storage", "header-only", "cpp17") license = "MIT" + package_type="header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True short_paths = True options = { "with_eigen": [True, False], "with_spdlog": [True, False], + "with_zlib" : [True, False], + "with_quadmath": [True, False] } default_options = { "with_eigen": True, "with_spdlog": True, + "with_zlib" : True, + "with_quadmath": False } @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return "17" @property def _compilers_minimum_version(self): @@ -38,8 +48,11 @@ def _compilers_minimum_version(self): "apple-clang": "10", } + def export_sources(self): + export_conandata_patches(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, @@ -48,60 +61,87 @@ def config_options(self): # that including the headers is intentional. del self.options.with_eigen del self.options.with_spdlog + del self.options.with_zlib + else: + self.options["hdf5"].with_zlib = self.options.with_zlib + if Version(self.version) < "1.11.1" or self.settings.compiler != "gcc": + # h5pp only supports quadmath with GNU compilers + del self.options.with_quadmath def requirements(self): - self.requires("hdf5/1.12.1") - if tools.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") + self.requires("hdf5/1.14.3", transitive_headers=True, transitive_libs=True) + if Version(self.version) < "1.10.0" or self.options.get_safe('with_eigen'): + self.requires("eigen/3.4.0", transitive_headers=True) + if Version(self.version) < "1.10.0" or self.options.get_safe('with_spdlog'): + self.requires("spdlog/1.13.0", transitive_headers=True, transitive_libs=True) + if Version(self.version) >= "1.10.0" and self.options.with_zlib: + self.requires("zlib/1.3", transitive_headers=True, transitive_libs=True) + + 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"): - tools.check_min_cppstd(self, 17) + 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("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.") + self.output.warning("h5pp 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) + apply_conandata_patches(self) def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - if tools.Version(self.version) < "1.9.0": - includedir = os.path.join(self._source_subfolder, "h5pp", "include") + if Version(self.version) < "1.9.0": + includedir = os.path.join(self.source_folder, "h5pp", "include") else: - includedir = os.path.join(self._source_subfolder, "include") - self.copy("*", src=includedir, dst="include") + includedir = os.path.join(self.source_folder, "include") + copy(self, pattern="*", src=includedir, dst=os.path.join(self.package_folder, "include")) + copy(self, pattern="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", "h5pp") self.cpp_info.set_property("cmake_target_name", "h5pp::h5pp") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] self.cpp_info.components["h5pp_headers"].set_property("cmake_target_name", "h5pp::headers") + self.cpp_info.components["h5pp_headers"].bindirs = [] + self.cpp_info.components["h5pp_headers"].libdirs = [] self.cpp_info.components["h5pp_deps"].set_property("cmake_target_name", "h5pp::deps") - self.cpp_info.components["h5pp_flags"].set_property("cmake_target_name", "h5pp::flags") + self.cpp_info.components["h5pp_deps"].bindirs = [] + self.cpp_info.components["h5pp_deps"].libdirs = [] self.cpp_info.components["h5pp_deps"].requires = ["hdf5::hdf5"] + self.cpp_info.components["h5pp_flags"].set_property("cmake_target_name", "h5pp::flags") + self.cpp_info.components["h5pp_flags"].bindirs = [] + self.cpp_info.components["h5pp_flags"].libdirs = [] - if tools.Version(self.version) >= "1.10.0": - if self.options.with_eigen: + if Version(self.version) < "1.10.0": + self.cpp_info.components["h5pp_deps"].requires.append("eigen::eigen") + self.cpp_info.components["h5pp_deps"].requires.append("spdlog::spdlog") + else: + if self.options.get_safe("with_eigen"): self.cpp_info.components["h5pp_deps"].requires.append("eigen::eigen") self.cpp_info.components["h5pp_flags"].defines.append("H5PP_USE_EIGEN3") - if self.options.with_spdlog: + if self.options.get_safe("with_spdlog"): self.cpp_info.components["h5pp_deps"].requires.append("spdlog::spdlog") self.cpp_info.components["h5pp_flags"].defines.append("H5PP_USE_SPDLOG") self.cpp_info.components["h5pp_flags"].defines.append("H5PP_USE_FMT") - else: - self.cpp_info.components["h5pp_deps"].requires.append("eigen::eigen") - self.cpp_info.components["h5pp_deps"].requires.append("spdlog::spdlog") + if self.options.get_safe("with_zlib"): + self.cpp_info.components["h5pp_deps"].requires.append("zlib::zlib") + if self.options.get_safe("with_quadmath"): + self.cpp_info.components["h5pp_flags"].defines.append("H5PP_USE_FLOAT128") + self.cpp_info.components["h5pp_flags"].defines.append("H5PP_USE_QUADMATH") + self.cpp_info.system_libs.append('quadmath') - 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/all/patches/fix-support-new-hdf5-v1.8.3-5.patch b/recipes/h5pp/all/patches/fix-support-new-hdf5-v1.8.3-5.patch new file mode 100644 index 0000000000000..aeea88c60d8ff --- /dev/null +++ b/recipes/h5pp/all/patches/fix-support-new-hdf5-v1.8.3-5.patch @@ -0,0 +1,13 @@ +diff --git a/h5pp/include/h5pp/details/h5ppHid.h b/h5pp/include/h5pp/details/h5ppHid.h +index 7bd9f12..1335dd8 100644 +--- a/h5pp/include/h5pp/details/h5ppHid.h ++++ b/h5pp/include/h5pp/details/h5ppHid.h +@@ -16,7 +16,7 @@ namespace h5pp::hid { + hid_base() = default; + hid_base(std::initializer_list) = delete; + // Use enable_if to avoid implicit conversion from hid_h5x and still have a non-explicit hid_t constructor +- template>> ++ template>> + hid_base(const T &other) { + // constructor from hid_t + if constexpr(zeroValueIsOK){ diff --git a/recipes/h5pp/all/patches/fix-support-new-hdf5-v1.8.6.patch b/recipes/h5pp/all/patches/fix-support-new-hdf5-v1.8.6.patch new file mode 100644 index 0000000000000..02970a76bf18c --- /dev/null +++ b/recipes/h5pp/all/patches/fix-support-new-hdf5-v1.8.6.patch @@ -0,0 +1,22 @@ +diff --git a/h5pp/include/h5pp/details/h5ppHid.h b/h5pp/include/h5pp/details/h5ppHid.h +index cda2d6d..76ba594 100644 +--- a/h5pp/include/h5pp/details/h5ppHid.h ++++ b/h5pp/include/h5pp/details/h5ppHid.h +@@ -15,7 +15,7 @@ namespace h5pp::hid { + virtual ~hid_base() = default; + hid_base() = default; + // Use enable_if to avoid implicit conversion from hid_h5x and still have a non-explicit hid_t constructor +- template>> ++ template>> + hid_base(const T &other) { + // constructor from hid_t + if constexpr(zeroValueIsOK) { +@@ -66,7 +66,7 @@ namespace h5pp::hid { + return *this; + } + +- template>> ++ template>> + hid_base &operator=(const T &rhs) { + // Copy assignment from hid_t + if constexpr(zeroValueIsOK) { diff --git a/recipes/h5pp/all/patches/fix-support-new-hdf5-v1.9.0.patch b/recipes/h5pp/all/patches/fix-support-new-hdf5-v1.9.0.patch new file mode 100644 index 0000000000000..af8a034bf7dd1 --- /dev/null +++ b/recipes/h5pp/all/patches/fix-support-new-hdf5-v1.9.0.patch @@ -0,0 +1,23 @@ +diff --git a/include/h5pp/details/h5ppHid.h b/include/h5pp/details/h5ppHid.h +index b1f4989..8af0eb3 100644 +--- a/include/h5pp/details/h5ppHid.h ++++ b/include/h5pp/details/h5ppHid.h +@@ -15,7 +15,7 @@ namespace h5pp::hid { + virtual ~hid_base() = default; + hid_base() = default; + // Use enable_if to avoid implicit conversion from hid_h5x and still have a non-explicit hid_t constructor +- template>> ++ template>> + hid_base(const T &other) { + // constructor from hid_t + if constexpr(zeroValueIsOK) { +@@ -66,7 +66,7 @@ namespace h5pp::hid { + return *this; + } + +- template>> ++ template>> + hid_base &operator=(const T &rhs) { + // Copy assignment from hid_t + if constexpr(zeroValueIsOK) { + diff --git a/recipes/h5pp/all/test_package/CMakeLists.txt b/recipes/h5pp/all/test_package/CMakeLists.txt index 7b0b3d3e25936..523f3a9d98155 100644 --- a/recipes/h5pp/all/test_package/CMakeLists.txt +++ b/recipes/h5pp/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) - -add_executable(${CMAKE_PROJECT_NAME} test_package.cpp) -target_compile_features(${CMAKE_PROJECT_NAME} PRIVATE cxx_std_17) +add_executable(test_package test_package.cpp) +target_compile_features(test_package PRIVATE cxx_std_17) find_package(h5pp REQUIRED CONFIG) -target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE h5pp::h5pp) +target_link_libraries(test_package PRIVATE h5pp::h5pp) diff --git a/recipes/h5pp/all/test_package/conanfile.py b/recipes/h5pp/all/test_package/conanfile.py index ca45a778caa64..57ecdac2f006b 100644 --- a/recipes/h5pp/all/test_package/conanfile.py +++ b/recipes/h5pp/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, cmake_layout class TestPackageConan(ConanFile): - settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "compiler", "build_type", "arch" + 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,5 @@ 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): + self.run(os.path.join(self.cpp.build.bindirs[0], "test_package"), env="conanrun") diff --git a/recipes/h5pp/all/test_package/test_package.cpp b/recipes/h5pp/all/test_package/test_package.cpp index 384a3eda62383..ea55e300f5e70 100644 --- a/recipes/h5pp/all/test_package/test_package.cpp +++ b/recipes/h5pp/all/test_package/test_package.cpp @@ -19,5 +19,12 @@ int main() { // Read dummy data from file auto vectorComplexRead = file.readDataset>("vectorComplex"); + +#if defined(H5PP_USE_FLOAT128) + __float128 f128 = 6.28318530717958623199592693708837032318115234375; + file.writeDataset(f128, "__float128"); + auto f128_read = file.readDataset<__float128>("__float128"); +#endif + return 0; } diff --git a/recipes/h5pp/all/test_v1_package/CMakeLists.txt b/recipes/h5pp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..7b0b3d3e25936 --- /dev/null +++ b/recipes/h5pp/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) + +add_executable(${CMAKE_PROJECT_NAME} test_package.cpp) +target_compile_features(${CMAKE_PROJECT_NAME} PRIVATE cxx_std_17) + +find_package(h5pp REQUIRED CONFIG) +target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE h5pp::h5pp) diff --git a/recipes/h5pp/all/test_v1_package/conanfile.py b/recipes/h5pp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..ca45a778caa64 --- /dev/null +++ b/recipes/h5pp/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/h5pp/all/test_v1_package/test_package.cpp b/recipes/h5pp/all/test_v1_package/test_package.cpp new file mode 100644 index 0000000000000..384a3eda62383 --- /dev/null +++ b/recipes/h5pp/all/test_v1_package/test_package.cpp @@ -0,0 +1,23 @@ +#include + +int main() { + using cplx = std::complex; + + static_assert(h5pp::type::sfinae::has_data>() and + "h5pp ompile time type-checker failed. Could not properly detect class member data. Check that you are using a supported compiler!"); + + std::string outputFilename = "test_package.h5"; + size_t logLevel = 1; + h5pp::File file(outputFilename, H5F_ACC_TRUNC | H5F_ACC_RDWR, logLevel); + + // Generate dummy data + std::vector vectorComplexWrite = {{-0.191154, 0.326211}, {0.964728, -0.712335}, {-0.0351791, -0.10264}, {0.177544, 0.99999}}; + + // Write dummy data to file + file.writeDataset(vectorComplexWrite, "vectorComplex"); + + + // Read dummy data from file + auto vectorComplexRead = file.readDataset>("vectorComplex"); + return 0; +} diff --git a/recipes/h5pp/config.yml b/recipes/h5pp/config.yml index a0e0d5427545b..a489a477b18f9 100644 --- a/recipes/h5pp/config.yml +++ b/recipes/h5pp/config.yml @@ -11,3 +11,11 @@ versions: folder: "all" "1.10.0": folder: "all" + "1.11.0": + folder: "all" + "1.11.0.1": + folder: "all" + "1.11.1": + folder: "all" + "1.11.2": + folder: "all" diff --git a/recipes/half/all/conanfile.py b/recipes/half/all/conanfile.py index 64b104957470d..07e6b8fcf90e0 100644 --- a/recipes/half/all/conanfile.py +++ b/recipes/half/all/conanfile.py @@ -15,20 +15,21 @@ class HalfConan(ConanFile): "functions." ) license = "MIT" - topics = ("half", "half-precision", "float", "arithmetic") + topics = ("half-precision", "float", "arithmetic") homepage = "https://sourceforge.net/projects/half" url = "https://github.com/conan-io/conan-center-index" + package_type = "header-library" 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) + get(self, **self.conan_data["sources"][self.version]) def build(self): pass @@ -39,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/half/all/test_package/conanfile.py b/recipes/half/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/half/all/test_package/conanfile.py +++ b/recipes/half/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/half/all/test_v1_package/CMakeLists.txt b/recipes/half/all/test_v1_package/CMakeLists.txt index c8aa9412f7287..b21cc49efde95 100644 --- a/recipes/half/all/test_v1_package/CMakeLists.txt +++ b/recipes/half/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.15) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(half REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE half::half) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/happly/all/conanfile.py b/recipes/happly/all/conanfile.py index 21fdcfcb45fd6..2d6741283955a 100644 --- a/recipes/happly/all/conanfile.py +++ b/recipes/happly/all/conanfile.py @@ -1,30 +1,42 @@ -from conans import ConanFile, tools +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 + +required_conan_version = ">=1.52.0" class HapplyConan(ConanFile): name = "happly" + description = "A C++ header-only parser for the PLY file format. Parse .ply happily!" + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/nmwsharp/happly" - topics = ("conan", "happly", "ply", "3D") - license = "MIT" - description = "A C++ header-only parser for the PLY file format. Parse .ply happily!" - settings = "compiler" + topics = ("ply", "3D", "mesh", "point cloud", "header-only") + + 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 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], destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - self.copy("happly.h", src=self._source_subfolder, dst="include") + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "happly.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/happly/all/test_package/CMakeLists.txt b/recipes/happly/all/test_package/CMakeLists.txt index 33ae887aa6aea..6b4a4a756dfdf 100644 --- a/recipes/happly/all/test_package/CMakeLists.txt +++ b/recipes/happly/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -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() +find_package(happly REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE happly::happly) set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) diff --git a/recipes/happly/all/test_package/conanfile.py b/recipes/happly/all/test_package/conanfile.py index 5a25a64cfaaa9..93e4ec3d18f37 100644 --- a/recipes/happly/all/test_package/conanfile.py +++ b/recipes/happly/all/test_package/conanfile.py @@ -1,12 +1,21 @@ import glob 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 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) @@ -14,8 +23,9 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - self.run(os.path.join("bin", "test_package")) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + self.run(bin_path, env="conanrun") # Let's check if the *.ply file has been created successfully ply_format_file = glob.glob("*.ply")[0] assert os.path.exists(ply_format_file) diff --git a/recipes/happly/all/test_v1_package/CMakeLists.txt b/recipes/happly/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/happly/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/happly/all/test_v1_package/conanfile.py b/recipes/happly/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..4b114846091e7 --- /dev/null +++ b/recipes/happly/all/test_v1_package/conanfile.py @@ -0,0 +1,21 @@ +import glob +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.settings): + self.run(os.path.join("bin", "test_package")) + # Let's check if the *.ply file has been created successfully + ply_format_file = glob.glob("*.ply")[0] + assert os.path.exists(ply_format_file) diff --git a/recipes/harfbuzz/all/conandata.yml b/recipes/harfbuzz/all/conandata.yml index 8ab99e436984b..0621f68bfe102 100644 --- a/recipes/harfbuzz/all/conandata.yml +++ b/recipes/harfbuzz/all/conandata.yml @@ -1,31 +1,29 @@ sources: - "3.2.0": - url: "https://github.com/harfbuzz/harfbuzz/releases/download/3.2.0/harfbuzz-3.2.0.tar.xz" - sha256: "0ada50a1c199bb6f70843ab893c55867743a443b84d087d54df08ad883ebc2cd" - "4.4.1": - url: "https://github.com/harfbuzz/harfbuzz/releases/download/4.4.1/harfbuzz-4.4.1.tar.xz" - sha256: "c5bc33ac099b2e52f01d27cde21cee4281b9d5bfec7684135e268512478bc9ee" + "8.3.0": + url: "https://github.com/harfbuzz/harfbuzz/releases/download/8.3.0/harfbuzz-8.3.0.tar.xz" + sha256: "109501eaeb8bde3eadb25fab4164e993fbace29c3d775bcaa1c1e58e2f15f847" + "8.2.2": + url: "https://github.com/harfbuzz/harfbuzz/releases/download/8.2.2/harfbuzz-8.2.2.tar.xz" + sha256: "e433ad85fbdf57f680be29479b3f964577379aaf319f557eb76569f0ecbc90f3" + "8.2.1": + url: "https://github.com/harfbuzz/harfbuzz/releases/download/8.2.1/harfbuzz-8.2.1.tar.xz" + sha256: "0fec78f98c9c8faf228957a201c8846f809452c20f8445eb092a1ba6f22dbea5" + "8.1.1": + url: "https://github.com/harfbuzz/harfbuzz/releases/download/8.1.1/harfbuzz-8.1.1.tar.xz" + sha256: "0305ad702e11906a5fc0c1ba11c270b7f64a8f5390d676aacfd71db129d6565f" + "8.0.1": + url: "https://github.com/harfbuzz/harfbuzz/releases/download/8.0.1/harfbuzz-8.0.1.tar.xz" + sha256: "c1ce780acd385569f25b9a29603d1d5bc71e6940e55bfdd4f7266fad50e42620" + "7.3.0": + url: "https://github.com/harfbuzz/harfbuzz/releases/download/7.3.0/harfbuzz-7.3.0.tar.xz" + sha256: "20770789749ac9ba846df33983dbda22db836c70d9f5d050cb9aa5347094a8fb" + "6.0.0": + url: "https://github.com/harfbuzz/harfbuzz/releases/download/6.0.0/harfbuzz-6.0.0.tar.xz" + sha256: "1d1010a1751d076d5291e433c138502a794d679a7498d1268ee21e2d4a140eb4" "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: - "4.4.1": - - 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/0000-fix-freetype-lookup-5.1.0.patch" patch_type: "portability" diff --git a/recipes/harfbuzz/all/conanfile.py b/recipes/harfbuzz/all/conanfile.py index 5f497e976e583..873c8a5081e27 100644 --- a/recipes/harfbuzz/all/conanfile.py +++ b/recipes/harfbuzz/all/conanfile.py @@ -1,28 +1,18 @@ -from conan import ConanFile +from conan import ConanFile, conan_version 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 -from conan.tools.env import VirtualBuildEnv +from conan.tools.build import can_run, stdcpp_library +from conan.tools.env import Environment, VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir, replace_in_file 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 -from conans.tools import stdcpp_library -import glob import os -required_conan_version = ">=1.53.0" +required_conan_version = ">=1.60.0 <2.0 || >=2.0.6" class HarfbuzzConan(ConanFile): @@ -30,8 +20,9 @@ class HarfbuzzConan(ConanFile): description = "HarfBuzz is an OpenType text shaping engine." topics = ("opentype", "text", "engine") url = "https://github.com/conan-io/conan-center-index" - homepage = "http://harfbuzz.org" + homepage = "https://harfbuzz.github.io/" license = "MIT" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -43,6 +34,7 @@ class HarfbuzzConan(ConanFile): "with_uniscribe": [True, False], "with_directwrite": [True, False], "with_subset": [True, False], + "with_coretext": [True, False], } default_options = { "shared": False, @@ -54,10 +46,15 @@ class HarfbuzzConan(ConanFile): "with_uniscribe": True, "with_directwrite": False, "with_subset": False, + "with_coretext": True, } short_paths = True + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) + def export_sources(self): export_conandata_patches(self) @@ -68,37 +65,53 @@ def config_options(self): del self.options.with_gdi del self.options.with_uniscribe del self.options.with_directwrite + if not is_apple_os(self): + del self.options.with_coretext def configure(self): if self.options.shared: self.options.rm_safe("fPIC") if self.options.shared and self.options.with_glib: - self.options["glib"].shared = True + wildcard = "" if Version(conan_version) < "2.0.0" else "/*" + self.options[f"glib{wildcard}"].shared = True + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + if self.options.with_freetype: + self.requires("freetype/2.13.2") + if self.options.with_icu: + self.requires("icu/74.1") + if self.options.with_glib: + self.requires("glib/2.78.3") def validate(self): - if self.info.options.shared and self.info.options.with_glib and not self.dependencies["glib"].options.shared: + if self.options.shared and self.options.with_glib and not self.dependencies["glib"].options.shared: raise ConanInvalidConfiguration( "Linking a shared library against static glib can cause unexpected behaviour." ) - 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.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "7": + raise ConanInvalidConfiguration("New versions of harfbuzz require at least gcc 7") - if self.info.options.with_glib and self.dependencies["glib"].options.shared and is_msvc_static_runtime(self): + if self.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" ) - def requirements(self): - if self.options.with_freetype: - self.requires("freetype/2.12.1") - if self.options.with_icu: - self.requires("icu/71.1") + def build_requirements(self): + self.tool_requires("meson/1.4.0") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/2.1.0") if self.options.with_glib: - self.requires("glib/2.75.0") + self.tool_requires("glib/") + if self.settings.os == "Macos": + # Ensure that the gettext we use at build time is compatible + # with the libiconv that is transitively exposed by glib + self.tool_requires("gettext/0.21") - def layout(self): - basic_layout(self, src_folder="src") + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): def is_enabled(value): @@ -114,15 +127,27 @@ def is_vs_2017(): return "vs", ["/bigobj"] return "ninja", [] + VirtualBuildEnv(self).generate() + + # Avoid conflicts with libiconv + # see: https://github.com/conan-io/conan-center-index/pull/17046#issuecomment-1554629094 + if self._settings_build.os == "Macos": + env = Environment() + env.define_path("DYLD_FALLBACK_LIBRARY_PATH", "$DYLD_LIBRARY_PATH") + env.define_path("DYLD_LIBRARY_PATH", "") + env.vars(self, scope="build").save_script("conanbuild_macos_runtimepath") + PkgConfigDeps(self).generate() backend, cxxflags = meson_backend_and_flags() tc = MesonToolchain(self, backend=backend) + tc.project_options["auto_features"] = "disabled" 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")), + "coretext": is_enabled(self.options.get_safe("with_coretext")), "directwrite": is_enabled(self.options.get_safe("with_directwrite")), "gobject": is_enabled(can_run(self) and self.options.with_glib), "introspection": is_enabled(False), @@ -134,51 +159,26 @@ def is_vs_2017(): tc.cpp_args += cxxflags tc.generate() - VirtualBuildEnv(self).generate() - - def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) - - def build_requirements(self): - 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") - self.tool_requires("glib/2.75.0") - def build(self): apply_conandata_patches(self) + replace_in_file(self, os.path.join(self.source_folder, "meson.build"), "subdir('util')", "") meson = Meson(self) meson.configure() meson.build() def package(self): - 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")) - + copy(self, "COPYING", self.source_folder, os.path.join(self.package_folder, "licenses")) 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")) + fix_apple_shared_install_name(self) + fix_msvc_libname(self) 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("cmake_file_name", "harfbuzz") + self.cpp_info.set_property("cmake_target_name", "harfbuzz::harfbuzz") self.cpp_info.set_property("pkg_config_name", "harfbuzz") if self.options.with_icu: self.cpp_info.libs.append("harfbuzz-icu") @@ -186,7 +186,7 @@ def package_info(self): self.cpp_info.libs.append("harfbuzz-subset") self.cpp_info.libs.append("harfbuzz") self.cpp_info.includedirs.append(os.path.join("include", "harfbuzz")) - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("m") if self.settings.os == "Windows" and not self.options.shared: self.cpp_info.system_libs.append("user32") @@ -198,13 +198,29 @@ def package_info(self): self.cpp_info.system_libs.append("usp10") if self.options.with_directwrite: self.cpp_info.system_libs.append("dwrite") - if is_apple_os(self): - self.cpp_info.frameworks.extend(["CoreFoundation", "CoreGraphics", "CoreText", "ApplicationServices"]) + if is_apple_os(self) and self.options.get_safe("with_coretext", False): + if self.settings.os == "Macos": + self.cpp_info.frameworks.append("ApplicationServices") + else: + self.cpp_info.frameworks.extend(["CoreFoundation", "CoreGraphics", "CoreText"]) if not self.options.shared: libcxx = stdcpp_library(self) if libcxx: self.cpp_info.system_libs.append(libcxx) - def package_id(self): - if self.options.with_glib and not self.options["glib"].shared: - 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/harfbuzz/all/patches/0000-fix-freetype-lookup-4.4.1.patch b/recipes/harfbuzz/all/patches/0000-fix-freetype-lookup-4.4.1.patch deleted file mode 100644 index 708b5d9734b00..0000000000000 --- a/recipes/harfbuzz/all/patches/0000-fix-freetype-lookup-4.4.1.patch +++ /dev/null @@ -1,99 +0,0 @@ -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/test_package/CMakeLists.txt b/recipes/harfbuzz/all/test_package/CMakeLists.txt index 80c151599daee..297728d956c6c 100644 --- a/recipes/harfbuzz/all/test_package/CMakeLists.txt +++ b/recipes/harfbuzz/all/test_package/CMakeLists.txt @@ -1,8 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package C) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES C) find_package(harfbuzz REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) target_link_libraries(${PROJECT_NAME} PRIVATE harfbuzz::harfbuzz) -set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD 99) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) diff --git a/recipes/harfbuzz/all/test_package/conanfile.py b/recipes/harfbuzz/all/test_package/conanfile.py index e9a060aba448d..ca918824970c4 100644 --- a/recipes/harfbuzz/all/test_package/conanfile.py +++ b/recipes/harfbuzz/all/test_package/conanfile.py @@ -23,6 +23,5 @@ def build(self): def test(self): if can_run(self): - font = os.path.join(self.source_folder, "example.ttf") bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") - self.run(f"{bin_path} {font}", env="conanrun") + self.run(bin_path, env="conanrun") diff --git a/recipes/harfbuzz/all/test_package/example.ttf b/recipes/harfbuzz/all/test_package/example.ttf deleted file mode 100644 index 1849f5cc07efa..0000000000000 Binary files a/recipes/harfbuzz/all/test_package/example.ttf and /dev/null differ diff --git a/recipes/harfbuzz/all/test_package/test_package.c b/recipes/harfbuzz/all/test_package/test_package.c index 5f2ac9a8454e4..0bd42e5ab1456 100644 --- a/recipes/harfbuzz/all/test_package/test_package.c +++ b/recipes/harfbuzz/all/test_package/test_package.c @@ -1,141 +1,9 @@ -/* - * Copyright © 2011 Google, Inc. - * - * This is part of HarfBuzz, a text shaping library. - * - * Permission is hereby granted, without written agreement and without - * license or royalty fees, to use, copy, modify, and distribute this - * software and its documentation for any purpose, provided that the - * above copyright notice and the following two paragraphs appear in - * all copies of this software. - * - * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR - * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES - * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN - * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH - * DAMAGE. - * - * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, - * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS - * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO - * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - * - * Google Author(s): Behdad Esfahbod - */ - -#include #include -#include - -#include "harfbuzz/hb.h" -#include "harfbuzz/hb-ot.h" - -#define FONT_SIZE 36 -#define MARGIN (FONT_SIZE * .5) - -/* Use native open type implementation to load font - https://github.com/harfbuzz/harfbuzz/issues/255 */ -hb_font_t* -get_font_ot(const char *filename, int size) -{ - size_t result = 0; - FILE* file = fopen(filename, "rb"); - fseek(file, 0, SEEK_END); - unsigned int length = ftell(file); - fseek(file, 0, SEEK_SET); - - char* data = (char*) malloc(length); - result = fread(data, length, 1, file); - if (result != 1) - { - fputs ("Reading error", stderr); - exit (3); - } - fclose(file); - - hb_blob_t* blob = hb_blob_create(data, length, HB_MEMORY_MODE_WRITABLE, (void*)data, NULL); - hb_face_t* face = hb_face_create(blob, 0); - hb_font_t* font = hb_font_create(face); - - hb_ot_font_set_funcs(font); - hb_font_set_scale(font, size, size); - - return font; -} - -int -main(int argc, char **argv) -{ - if (argc < 2) { - fprintf(stderr, "Usage: %s FONT\n", argv[0]); - return 1; - } - const char *fontfile = argv[1]; - const char *text = "conan-center-index"; - - /* Create hb-ft font. */ - hb_font_t *hb_font; - hb_font = get_font_ot (fontfile, FONT_SIZE*64); - - /* Create hb-buffer and populate. */ - hb_buffer_t *hb_buffer; - hb_buffer = hb_buffer_create (); - hb_buffer_add_utf8 (hb_buffer, text, -1, 0, -1); - hb_buffer_guess_segment_properties (hb_buffer); - - /* Shape it! */ - hb_shape (hb_font, hb_buffer, NULL, 0); - - /* Get glyph information and positions out of the buffer. */ - unsigned int len = hb_buffer_get_length (hb_buffer); - hb_glyph_info_t *info = hb_buffer_get_glyph_infos (hb_buffer, NULL); - hb_glyph_position_t *pos = hb_buffer_get_glyph_positions (hb_buffer, NULL); - - /* Print them out as is. */ - printf ("Raw buffer contents:\n"); - for (unsigned int i = 0; i < len; i++) - { - hb_codepoint_t gid = info[i].codepoint; - unsigned int cluster = info[i].cluster; - double x_advance = pos[i].x_advance / 64.; - double y_advance = pos[i].y_advance / 64.; - double x_offset = pos[i].x_offset / 64.; - double y_offset = pos[i].y_offset / 64.; - - char glyphname[32]; - hb_font_get_glyph_name (hb_font, gid, glyphname, sizeof (glyphname)); - - printf ("glyph='%s' cluster=%d advance=(%g,%g) offset=(%g,%g)\n", - glyphname, cluster, x_advance, y_advance, x_offset, y_offset); - } - - printf ("Converted to absolute positions:\n"); - /* And converted to absolute positions. */ - { - double current_x = 0; - double current_y = 0; - for (unsigned int i = 0; i < len; i++) - { - hb_codepoint_t gid = info[i].codepoint; - unsigned int cluster = info[i].cluster; - double x_position = current_x + pos[i].x_offset / 64.; - double y_position = current_y + pos[i].y_offset / 64.; - - - char glyphname[32]; - hb_font_get_glyph_name (hb_font, gid, glyphname, sizeof (glyphname)); - - printf ("glyph='%s' cluster=%d position=(%g,%g)\n", - glyphname, cluster, x_position, y_position); - - current_x += pos[i].x_advance / 64.; - current_y += pos[i].y_advance / 64.; - } - } - - hb_buffer_destroy (hb_buffer); - hb_font_destroy (hb_font); +#include +#include - return 0; +int main() { + const char *version = hb_version_string(); + printf("harfbuzz version: %s\n", version); + return 0; } diff --git a/recipes/harfbuzz/all/test_v1_package/CMakeLists.txt b/recipes/harfbuzz/all/test_v1_package/CMakeLists.txt index 2f6b1a2f7ec79..925ecbe19e448 100644 --- a/recipes/harfbuzz/all/test_v1_package/CMakeLists.txt +++ b/recipes/harfbuzz/all/test_v1_package/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) diff --git a/recipes/harfbuzz/all/test_v1_package/conanfile.py b/recipes/harfbuzz/all/test_v1_package/conanfile.py index a4aa2f28304a1..994065a757445 100644 --- a/recipes/harfbuzz/all/test_v1_package/conanfile.py +++ b/recipes/harfbuzz/all/test_v1_package/conanfile.py @@ -13,7 +13,6 @@ def build(self): 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) + self.run(bin_path, run_environment=True) diff --git a/recipes/harfbuzz/config.yml b/recipes/harfbuzz/config.yml index 3dd17ac25646c..d5a1a8bf9dfc4 100644 --- a/recipes/harfbuzz/config.yml +++ b/recipes/harfbuzz/config.yml @@ -1,15 +1,17 @@ versions: - "3.2.0": + "8.3.0": folder: all - "4.4.1": + "8.2.2": folder: all - "5.1.0": + "8.2.1": folder: all - "5.2.0": + "8.1.1": folder: all - "5.3.0": + "8.0.1": folder: all - "5.3.1": + "7.3.0": folder: all "6.0.0": folder: all + "5.1.0": + folder: all diff --git a/recipes/hayai/all/conandata.yml b/recipes/hayai/all/conandata.yml new file mode 100644 index 0000000000000..490eb3204ef39 --- /dev/null +++ b/recipes/hayai/all/conandata.yml @@ -0,0 +1,9 @@ +sources: + "cci.20190823": + url: "https://github.com/nickbruun/hayai/archive/9bdca1c693e950ab2cb17c4ef885792c3c530234.tar.gz" + sha256: "3e4b703b675a30338c73d9b207824cebd6275de9757eb8eefeef892e863c242f" +patches: + "cci.20190823": + - patch_file: "patches/fix-cmake-project.patch" + patch_description: "Move cmake_minimum_required() before project() in CMakeLists.txt" + patch_type: "conan" diff --git a/recipes/hayai/all/conanfile.py b/recipes/hayai/all/conanfile.py new file mode 100644 index 0000000000000..f9c7ed8eb904b --- /dev/null +++ b/recipes/hayai/all/conanfile.py @@ -0,0 +1,69 @@ +import os + +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import get, copy, rm, rmdir, export_conandata_patches, apply_conandata_patches + +required_conan_version = ">=1.53.0" + + +class HayaiConan(ConanFile): + name = "hayai" + description = "C++ benchmarking framework" + license = "Apache" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/nickbruun/hayai" + topics = ("benchmarking",) + + 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 source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["BUILD_HAYAI_TESTS"] = False + tc.cache_variables["BUILD_HAYAI_SAMPLES"] = False + 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.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")) + rmdir(self, os.path.join(self.package_folder, "CMake")) + rm(self, "*.pdb", self.package_folder, recursive=True) + + def package_info(self): + self.cpp_info.libs = ["hayai_main"] + self.cpp_info.set_property("cmake_target_name", "hayai_main") diff --git a/recipes/hayai/all/patches/fix-cmake-project.patch b/recipes/hayai/all/patches/fix-cmake-project.patch new file mode 100644 index 0000000000000..f2e12a251e0b8 --- /dev/null +++ b/recipes/hayai/all/patches/fix-cmake-project.patch @@ -0,0 +1,8 @@ +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -3,3 +3,2 @@ +-project(hayai) +-cmake_minimum_required(VERSION 2.4) +-cmake_policy(SET CMP0012 NEW) ++cmake_minimum_required(VERSION 3.15) ++project(hayai CXX) diff --git a/recipes/hayai/all/test_package/CMakeLists.txt b/recipes/hayai/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..500852dd444f2 --- /dev/null +++ b/recipes/hayai/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package CXX) + +find_package(hayai REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE hayai_main) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/hayai/all/test_package/conanfile.py b/recipes/hayai/all/test_package/conanfile.py new file mode 100644 index 0000000000000..ef5d7042163ec --- /dev/null +++ b/recipes/hayai/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/hayai/all/test_package/test_package.cpp b/recipes/hayai/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..32f9269a28efc --- /dev/null +++ b/recipes/hayai/all/test_package/test_package.cpp @@ -0,0 +1,8 @@ +#include + +#include +#include + +BENCHMARK(SomeSleep, Sleep1ms, 5, 10) { + std::this_thread::sleep_for(std::chrono::milliseconds(1)); +} diff --git a/recipes/hayai/config.yml b/recipes/hayai/config.yml new file mode 100644 index 0000000000000..524a9c8112de1 --- /dev/null +++ b/recipes/hayai/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20190823": + folder: all diff --git a/recipes/hazelcast-cpp-client/all/conandata.yml b/recipes/hazelcast-cpp-client/all/conandata.yml index 90b1afe2d9103..132cdd0f76ad6 100644 --- a/recipes/hazelcast-cpp-client/all/conandata.yml +++ b/recipes/hazelcast-cpp-client/all/conandata.yml @@ -1,19 +1,18 @@ sources: - "5.0.0": - url: "https://github.com/hazelcast/hazelcast-cpp-client/archive/v5.0.0.tar.gz" - sha256: "0df7948bc6f4d219c60f51179355599938cab5b713335c2ea48d1d38be1b69dc" + "5.3.0": + url: "https://github.com/hazelcast/hazelcast-cpp-client/archive/v5.3.0.tar.gz" + sha256: "5d38710d027b6311a479c2e4c42f9ac2a04c831a3eb673d4539a2221c8ff8015" + "5.2.0": + url: "https://github.com/hazelcast/hazelcast-cpp-client/archive/v5.2.0.tar.gz" + sha256: "49afe765fe4e8ddf134ebf2862a698b8d0dd8dc724d4300e09e5bf7da9e4cbfb" + "5.1.0": + url: "https://github.com/hazelcast/hazelcast-cpp-client/archive/v5.1.0.tar.gz" + sha256: "de22ddf2c99079ed2385baa554a997b15ae17b039d6d108f68e25e1b3bbf76b6" "4.2.0": url: "https://github.com/hazelcast/hazelcast-cpp-client/archive/v4.2.0.zip" sha256: "18aeb755a875015a2e182d4c575cc46a041bdfb699937c5174d94534517e4708" - "4.1.1": - url: "https://github.com/hazelcast/hazelcast-cpp-client/archive/v4.1.1.zip" - sha256: "ca425c97eb871400de4bd2307ddaf3c557c9c1bae50d6a0db6507d72f435830c" - "4.1.0": - url: "https://github.com/hazelcast/hazelcast-cpp-client/archive/v4.1.0.zip" - sha256: "8356bc76077fea354e83ffcd506096797137af10b292809c6b7843a8fbd084e3" - "4.0.1": - url: "https://github.com/hazelcast/hazelcast-cpp-client/archive/v4.0.1.zip" - sha256: "4b3c6a876ebca2a4dcf23a556d3c3d4da2284e4ce1d2bbdf335df7f86b03fd28" patches: - "4.1.0": - - patch_file: "patches/gcc_4.9_5_fix.patch" + "5.1.0": + - patch_file: "patches/gcc_11_1_0.patch" + patch_description: "Fix for GCC-111" + patch_type: "portability" diff --git a/recipes/hazelcast-cpp-client/all/conanfile.py b/recipes/hazelcast-cpp-client/all/conanfile.py index 6f3062922937b..b58eed49bb2fa 100644 --- a/recipes/hazelcast-cpp-client/all/conanfile.py +++ b/recipes/hazelcast-cpp-client/all/conanfile.py @@ -1,12 +1,12 @@ 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 +from conan.tools.cmake import CMakeToolchain, CMakeDeps, CMake, cmake_layout +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 HazelcastCppClient(ConanFile): name = "hazelcast-cpp-client" @@ -15,21 +15,21 @@ class HazelcastCppClient(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/hazelcast/hazelcast-cpp-client" topics = ("hazelcast", "client", "database", "cache", "in-memory", "distributed", "computing", "ssl") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], - "with_openssl": [True, False] + "with_openssl": [True, False], } default_options = { "shared": False, "fPIC": True, - "with_openssl": False + "with_openssl": False, } 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) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -37,49 +37,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) + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("boost/1.79.0") + self.requires("boost/1.83.0", transitive_headers=True, transitive_libs=True) if self.options.with_openssl: - self.requires("openssl/1.1.1q") + self.requires("openssl/[>=1.1 <4]") def validate(self): if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, 11) def source(self): - files.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): - 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: - toolchain.variables["BUILD_SHARED_LIBS"] = self.options.shared - toolchain.generate() + tc = CMakeToolchain(self) + tc.variables["WITH_OPENSSL"] = self.options.with_openssl + tc.generate() deps = CMakeDeps(self) deps.generate() def build(self): - files.apply_conandata_patches(self) + apply_conandata_patches(self) cmake = CMake(self) cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self.source_folder) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) 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")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "hazelcast-cpp-client") @@ -88,6 +81,6 @@ def package_info(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") + self.cpp_info.system_libs.extend(["pthread", "m"]) if self.settings.os == "Windows": self.cpp_info.system_libs.append("ws2_32") diff --git a/recipes/hazelcast-cpp-client/all/patches/cmake_install.patch b/recipes/hazelcast-cpp-client/all/patches/cmake_install.patch deleted file mode 100644 index 2f63b7751b9ca..0000000000000 --- a/recipes/hazelcast-cpp-client/all/patches/cmake_install.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 6e0e99ae69..6f867f22d0 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -236,8 +236,8 @@ function(add_hazelcast_library name type) - # install -config.cmake and -config-version.cmake files - install( - FILES -- ${CMAKE_BINARY_DIR}/${name}-config.cmake -- ${CMAKE_BINARY_DIR}/${name}-config-version.cmake -+ ${CMAKE_CURRENT_BINARY_DIR}/${name}-config.cmake -+ ${CMAKE_CURRENT_BINARY_DIR}/${name}-config-version.cmake - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${name} - ) - endfunction() 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/patches/gcc_4.9_5_fix.patch b/recipes/hazelcast-cpp-client/all/patches/gcc_4.9_5_fix.patch deleted file mode 100644 index f5655c00c6f25..0000000000000 --- a/recipes/hazelcast-cpp-client/all/patches/gcc_4.9_5_fix.patch +++ /dev/null @@ -1,79 +0,0 @@ -diff --git a/hazelcast/include/hazelcast/client/spi/impl/ClientPartitionServiceImpl.h b/hazelcast/include/hazelcast/client/spi/impl/ClientPartitionServiceImpl.h -index 41b437a80..6bef9e28b 100644 ---- a/hazelcast/include/hazelcast/client/spi/impl/ClientPartitionServiceImpl.h -+++ b/hazelcast/include/hazelcast/client/spi/impl/ClientPartitionServiceImpl.h -@@ -64,10 +64,7 @@ namespace hazelcast { - void reset(); - private: - struct partition_table { -- partition_table(int32_t connectionId = 0, int32_t version = -1, -- const std::unordered_map &partitions = {}); -- -- int32_t connection_id{0}; -+ int32_t connection_id; - int32_t version; - std::unordered_map partitions; - }; -diff --git a/hazelcast/src/hazelcast/client/config.cpp b/hazelcast/src/hazelcast/client/config.cpp -index 88cad1ec5..5da63b36a 100644 ---- a/hazelcast/src/hazelcast/client/config.cpp -+++ b/hazelcast/src/hazelcast/client/config.cpp -@@ -856,7 +856,7 @@ namespace hazelcast { - return it->second; - } - -- return reliable_topic_config_map_.emplace(name, name).first->second; -+ return reliable_topic_config_map_.emplace(name, config::reliable_topic_config{name}).first->second; - } - - const config::reliable_topic_config *client_config::lookup_reliable_topic_config(const std::string &name) const { -diff --git a/hazelcast/src/hazelcast/client/discovery.cpp b/hazelcast/src/hazelcast/client/discovery.cpp -index cdc10a906..51279b446 100644 ---- a/hazelcast/src/hazelcast/client/discovery.cpp -+++ b/hazelcast/src/hazelcast/client/discovery.cpp -@@ -588,7 +588,7 @@ namespace hazelcast { - - std::unordered_map aws_client::get_addresses() { - util::Preconditions::check_ssl("aws_client::get_addresses"); -- return {}; -+ return std::unordered_map(); - } - } - } -diff --git a/hazelcast/src/hazelcast/client/spi.cpp b/hazelcast/src/hazelcast/client/spi.cpp -index ada4e665c..206aecb9e 100644 ---- a/hazelcast/src/hazelcast/client/spi.cpp -+++ b/hazelcast/src/hazelcast/client/spi.cpp -@@ -788,9 +788,10 @@ namespace hazelcast { - auto previous_list = member_list_snapshot_.load()->members; - - member_list_snapshot_.store( -- boost::shared_ptr(new member_list_snapshot{0, {}})); -+ boost::shared_ptr(new member_list_snapshot{0})); - -- return detect_membership_events(previous_list, {}); -+ return detect_membership_events(previous_list, -+ std::unordered_map>()); - } - - void ClientClusterServiceImpl::clear_member_list() { -@@ -2357,7 +2358,7 @@ namespace hazelcast { - } - #else - util::Preconditions::check_ssl("cloud_discovery::get_addresses"); -- return {}; -+ return std::unordered_map(); - #endif - } - -@@ -2388,10 +2389,6 @@ namespace hazelcast { - return address(std::move(scoped_hostname), address_holder.get_port()); - } - } -- -- ClientPartitionServiceImpl::partition_table::partition_table(int32_t connectionId, int32_t version, -- const std::unordered_map &partitions) -- : connection_id(connectionId), version(version), partitions(partitions) {} - } - } - } diff --git a/recipes/hazelcast-cpp-client/all/test_package/test_package.cpp b/recipes/hazelcast-cpp-client/all/test_package/test_package.cpp index 485a5dcd244e1..1352f7b0b0a1b 100644 --- a/recipes/hazelcast-cpp-client/all/test_package/test_package.cpp +++ b/recipes/hazelcast-cpp-client/all/test_package/test_package.cpp @@ -1,12 +1,7 @@ #include +#include int main() { - hazelcast::client::client_config config; - config.get_connection_strategy_config().get_retry_config().set_cluster_connect_timeout(std::chrono::seconds(1)); - - try { - auto hz = hazelcast::new_client(std::move(config)).get(); - } catch (std::exception &e) { - } + std::cout << "Hazelcast version: " << hazelcast::client::version(); return EXIT_SUCCESS; } diff --git a/recipes/hazelcast-cpp-client/all/test_v1_package/CMakeLists.txt b/recipes/hazelcast-cpp-client/all/test_v1_package/CMakeLists.txt index 87fd6b32ee2e1..0d20897301b68 100644 --- a/recipes/hazelcast-cpp-client/all/test_v1_package/CMakeLists.txt +++ b/recipes/hazelcast-cpp-client/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(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) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/hazelcast-cpp-client/config.yml b/recipes/hazelcast-cpp-client/config.yml index 50e0bcc183e61..5dd47e8b5a4e0 100644 --- a/recipes/hazelcast-cpp-client/config.yml +++ b/recipes/hazelcast-cpp-client/config.yml @@ -1,11 +1,9 @@ versions: - "5.0.0": + "5.3.0": folder: all - "4.2.0": - folder: all - "4.1.1": + "5.2.0": folder: all - "4.1.0": + "5.1.0": folder: all - "4.0.1": + "4.2.0": folder: all diff --git a/recipes/hdf4/all/CMakeLists.txt b/recipes/hdf4/all/CMakeLists.txt deleted file mode 100644 index 217b9530b904d..0000000000000 --- a/recipes/hdf4/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/hdf4/all/conandata.yml b/recipes/hdf4/all/conandata.yml index c28edc581baba..b92568111eedd 100644 --- a/recipes/hdf4/all/conandata.yml +++ b/recipes/hdf4/all/conandata.yml @@ -1,10 +1,13 @@ sources: + "4.2.16-2": + url: + - "https://hdf-wordpress-1.s3.amazonaws.com/wp-content/uploads/manual/HDF4/HDF4.2.16-2/src/hdf-4.2.16-2.tar.bz2" + - "https://support.hdfgroup.org/ftp/HDF/releases/HDF4.2.16-2/src/hdf-4.2.16-2.tar.bz2" + sha256: "c5c3234b5012258aef2e4432f649b31c21b26015afba1857ad83640c3f2b692c" "4.2.15": url: "https://support.hdfgroup.org/ftp/HDF/releases/HDF4.2.15/src/hdf-4.2.15.tar.gz" sha256: "dbeeef525af7c2d01539906c28953f0fdab7dba603d1bc1ec4a5af60d002c459" patches: "4.2.15": - patch_file: "patches/fix-export-macro.patch" - base_path: "source_subfolder" - patch_file: "patches/fix-missing-unistd-include.patch" - base_path: "source_subfolder" diff --git a/recipes/hdf4/all/conanfile.py b/recipes/hdf4/all/conanfile.py index 2d8c7ea8622e4..daa7c6c3b6c69 100644 --- a/recipes/hdf4/all/conanfile.py +++ b/recipes/hdf4/all/conanfile.py @@ -1,17 +1,23 @@ -from conans import ConanFile, CMake, tools import os -required_conan_version = ">=1.33.0" +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, rmdir, save, move_folder_contents +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" class Hdf4Conan(ConanFile): name = "hdf4" description = "HDF4 is a data model, library, and file format for storing and managing data." license = "BSD-3-Clause" - topics = ("conan", "hdf4", "hdf", "data") - homepage = "https://portal.hdfgroup.org/display/HDF4/HDF4" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://portal.hdfgroup.org/display/HDF4/HDF4" + topics = ("hdf", "data") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -28,17 +34,8 @@ class Hdf4Conan(ConanFile): "szip_encoding": 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": @@ -46,96 +43,131 @@ 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 bool(self.options.szip_support): del self.options.szip_encoding + def layout(self): + cmake_layout(self, src_folder="src") + def requirements(self): - self.requires("zlib/1.2.12") + self.requires("zlib/[>=1.2.11 <2]") if self.options.jpegturbo: - self.requires("libjpeg-turbo/2.1.2") + self.requires("libjpeg-turbo/3.0.0") else: - self.requires("libjpeg/9d") + self.requires("libjpeg/9e") if self.options.szip_support == "with_libaec": self.requires("libaec/1.0.6") elif self.options.szip_support == "with_szip": self.requires("szip/2.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) + if Version(self.version) > "4.2.15": + move_folder_contents(self, os.path.join(self.source_folder, f"hdf-{self.version}"), self.source_folder) + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["HDF4_EXTERNALLY_CONFIGURED"] = True + tc.cache_variables["HDF4_EXTERNAL_LIB_PREFIX"] = "" + tc.cache_variables["HDF4_NO_PACKAGES"] = True + tc.cache_variables["ONLY_SHARED_LIBS"] = self.options.shared + tc.cache_variables["HDF4_ENABLE_COVERAGE"] = False + tc.cache_variables["HDF4_ENABLE_DEPRECATED_SYMBOLS"] = True + tc.cache_variables["HDF4_ENABLE_JPEG_LIB_SUPPORT"] = True # HDF can't compile without libjpeg or libjpeg-turbo + tc.cache_variables["HDF4_ENABLE_Z_LIB_SUPPORT"] = True # HDF can't compile without zlib + tc.cache_variables["HDF4_ENABLE_SZIP_SUPPORT"] = bool(self.options.szip_support) + tc.cache_variables["HDF4_ENABLE_SZIP_ENCODING"] = self.options.get_safe("szip_encoding") or False + tc.cache_variables["HDF4_PACKAGE_EXTLIBS"] = False + tc.cache_variables["HDF4_BUILD_XDR_LIB"] = True + tc.cache_variables["BUILD_TESTING"] = False + tc.cache_variables["HDF4_INSTALL_INCLUDE_DIR"] = os.path.join(self.package_folder, "include", "hdf4").replace("\\", "/") + tc.cache_variables["HDF4_BUILD_FORTRAN"] = False + tc.cache_variables["HDF4_BUILD_UTILS"] = False + tc.cache_variables["HDF4_BUILD_TOOLS"] = False + tc.cache_variables["HDF4_BUILD_EXAMPLES"] = False + tc.cache_variables["HDF4_BUILD_JAVA"] = False + if cross_building(self): + tc.cache_variables["H4_PRINTF_LL_TEST_RUN"] = "0" + tc.cache_variables["H4_PRINTF_LL_TEST_RUN__TRYRUN_OUTPUT"] = "" + tc.generate() + + deps = CMakeDeps(self) + if self.options.szip_support == "with_szip": + deps.set_property("szip", "cmake_file_name", "SZIP") + deps.set_property("szip", "cmake_target_name", "SZIP::SZIP") + elif self.options.szip_support == "with_libaec": + deps.set_property("libaec", "cmake_file_name", "SZIP") + deps.set_property("libaec", "cmake_target_name", "SZIP::SZIP") + deps.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + libs = ["JPEG::JPEG", "ZLIB::ZLIB"] + if self.options.szip_support: + libs.append("SZIP::SZIP") + save(self, os.path.join(self.source_folder, "CMakeFilters.cmake"), + "\nlink_libraries({})".format(" ".join(libs)), append=True) 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 _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["HDF4_EXTERNALLY_CONFIGURED"] = True - self._cmake.definitions["HDF4_EXTERNAL_LIB_PREFIX"] = "" - self._cmake.definitions["HDF4_NO_PACKAGES"] = True - self._cmake.definitions["ONLY_SHARED_LIBS"] = self.options.shared - self._cmake.definitions["HDF4_ENABLE_COVERAGE"] = False - self._cmake.definitions["HDF4_ENABLE_DEPRECATED_SYMBOLS"] = True - self._cmake.definitions["HDF4_ENABLE_JPEG_LIB_SUPPORT"] = True # HDF can't compile without libjpeg or libjpeg-turbo - self._cmake.definitions["HDF4_ENABLE_Z_LIB_SUPPORT"] = True # HDF can't compile without zlib - self._cmake.definitions["HDF4_ENABLE_SZIP_SUPPORT"] = bool(self.options.szip_support) - self._cmake.definitions["HDF4_ENABLE_SZIP_ENCODING"] = self.options.get_safe("szip_encoding") or False - self._cmake.definitions["HDF4_PACKAGE_EXTLIBS"] = False - self._cmake.definitions["HDF4_BUILD_XDR_LIB"] = True - self._cmake.definitions["BUILD_TESTING"] = False - self._cmake.definitions["HDF4_INSTALL_INCLUDE_DIR"] = os.path.join(self.package_folder, "include", "hdf4") - self._cmake.definitions["HDF4_BUILD_FORTRAN"] = False - self._cmake.definitions["HDF4_BUILD_UTILS"] = False - self._cmake.definitions["HDF4_BUILD_TOOLS"] = False - self._cmake.definitions["HDF4_BUILD_EXAMPLES"] = False - self._cmake.definitions["HDF4_BUILD_JAVA"] = False - if tools.cross_building(self): - self._cmake.definitions["H4_PRINTF_LL_TEST_RUN"] = "0" - self._cmake.definitions["H4_PRINTF_LL_TEST_RUN__TRYRUN_OUTPUT"] = "" - 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", 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")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) os.remove(os.path.join(self.package_folder, "lib", "libhdf4.settings")) + def _get_decorated_lib(self, name): + libname = name + if self.settings.os == "Windows" and self.settings.compiler != "gcc" and not self.options.shared: + libname = "lib" + libname + if self.settings.build_type == "Debug": + libname += "_D" if self.settings.os == "Windows" else "_debug" + return libname + def package_info(self): - self.cpp_info.names["pkg_config"] = "hdf" + self.cpp_info.set_property("pkg_config_name", "hdf") unofficial_includedir = os.path.join(self.package_folder, "include", "hdf4") + target_suffix = "shared" if self.options.shared else "static" + # xdr - xdr_cmake = "xdr-shared" if self.options.shared else "xdr-static" + xdr_cmake = f"xdr-{target_suffix}" + self.cpp_info.components["xdr"].set_property("cmake_target_name", f"hdf4::{xdr_cmake}") self.cpp_info.components["xdr"].names["cmake_find_package"] = xdr_cmake self.cpp_info.components["xdr"].names["cmake_find_package_multi"] = xdr_cmake self.cpp_info.components["xdr"].includedirs.append(unofficial_includedir) self.cpp_info.components["xdr"].libs = [self._get_decorated_lib("xdr")] if self.settings.os == "Windows": self.cpp_info.components["xdr"].system_libs.append("ws2_32") + # hdf - hdf_cmake = "hdf-shared" if self.options.shared else "hdf-static" + hdf_cmake = f"hdf-{target_suffix}" + self.cpp_info.components["hdf"].set_property("cmake_target_name", f"hdf4::{hdf_cmake}") self.cpp_info.components["hdf"].names["cmake_find_package"] = hdf_cmake self.cpp_info.components["hdf"].names["cmake_find_package_multi"] = hdf_cmake self.cpp_info.components["hdf"].includedirs.append(unofficial_includedir) self.cpp_info.components["hdf"].libs = [self._get_decorated_lib("hdf")] self.cpp_info.components["hdf"].requires = [ "zlib::zlib", - "libjpeg-turbo::libjpeg-turbo" if self.options.jpegturbo else "libjpeg::libjpeg" + "libjpeg-turbo::libjpeg-turbo" if self.options.jpegturbo else "libjpeg::libjpeg", ] if self.options.szip_support == "with_libaec": self.cpp_info.components["hdf"].requires.append("libaec::libaec") elif self.options.szip_support == "with_szip": self.cpp_info.components["hdf"].requires.append("szip::szip") + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["hdf"].system_libs = ["m", "dl"] + # mfhdf - mfhdf_cmake = "mfhdf-shared" if self.options.shared else "mfhdf-static" + mfhdf_cmake = f"mfhdf-{target_suffix}" + self.cpp_info.components["mfhdf"].set_property("cmake_target_name", f"hdf4::{mfhdf_cmake}") self.cpp_info.components["mfhdf"].names["cmake_find_package"] = mfhdf_cmake self.cpp_info.components["mfhdf"].names["cmake_find_package_multi"] = mfhdf_cmake self.cpp_info.components["mfhdf"].includedirs.append(unofficial_includedir) @@ -146,11 +178,3 @@ def package_info(self): self.cpp_info.components["xdr"].defines.append("H4_BUILT_AS_DYNAMIC_LIB=1") self.cpp_info.components["hdf"].defines.append("H4_BUILT_AS_DYNAMIC_LIB=1") self.cpp_info.components["mfhdf"].defines.append("H4_BUILT_AS_DYNAMIC_LIB=1") - - def _get_decorated_lib(self, name): - libname = name - if self.settings.os == "Windows" and self.settings.compiler != "gcc" and not self.options.shared: - libname = "lib" + libname - if self.settings.build_type == "Debug": - libname += "_D" if self.settings.os == "Windows" else "_debug" - return libname diff --git a/recipes/hdf4/all/test_package/CMakeLists.txt b/recipes/hdf4/all/test_package/CMakeLists.txt index a6de4b1271021..546a9e09d090d 100644 --- a/recipes/hdf4/all/test_package/CMakeLists.txt +++ b/recipes/hdf4/all/test_package/CMakeLists.txt @@ -1,14 +1,7 @@ -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(hdf4 REQUIRED) +find_package(hdf4 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -if(TARGET hdf4::hdf-shared) - target_link_libraries(${PROJECT_NAME} hdf4::hdf-shared) -else() - target_link_libraries(${PROJECT_NAME} hdf4::hdf-static) -endif() +target_link_libraries(${PROJECT_NAME} hdf4::hdf4) diff --git a/recipes/hdf4/all/test_package/conanfile.py b/recipes/hdf4/all/test_package/conanfile.py index 612db2552bfca..7d51739a368b2 100644 --- a/recipes/hdf4/all/test_package/conanfile.py +++ b/recipes/hdf4/all/test_package/conanfile.py @@ -1,17 +1,27 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.apple import is_apple_os +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 build_requirements(self): - if self.settings.os == "Macos" and self.settings.arch == "armv8": + if is_apple_os(self) 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") + self.tool_requires("cmake/[>=3.20]") + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -19,6 +29,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/hdf4/all/test_package/test_package.c b/recipes/hdf4/all/test_package/test_package.c index 4efcf0be4d7a7..2e268465bf9bd 100644 --- a/recipes/hdf4/all/test_package/test_package.c +++ b/recipes/hdf4/all/test_package/test_package.c @@ -49,12 +49,12 @@ int main() { file_desc_id = ANcreatef(an_id, AN_FILE_DESC); /* - * Write the annotation to the file description. + * Write the annotation to the file description. */ status_32 = ANwriteann(file_desc_id, FILE_DESC_TXT, (int32) strlen(FILE_DESC_TXT)); /* - * Create a vgroup in the V interface. Note that the vgroup's ref number + * Create a vgroup in the V interface. Note that the vgroup's ref number * is set to -1 for creating and the access mode is "w" for writing. */ status_n = Vstart(file_id); @@ -63,13 +63,13 @@ int main() { /* * Obtain the tag and ref number of the vgroup for subsequent - * references. + * references. */ vgroup_tag = (uint16) VQuerytag(vgroup_id); vgroup_ref = (uint16) VQueryref(vgroup_id); /* - * Create the data label for the vgroup identified by its tag + * Create the data label for the vgroup identified by its tag * and ref number. */ data_label_id = ANcreate(an_id, vgroup_tag, vgroup_ref, AN_DATA_LABEL); @@ -80,7 +80,7 @@ int main() { status_32 = ANwriteann(data_label_id, DATA_LABEL_TXT, (int32) strlen(DATA_LABEL_TXT)); /* - * Create the data description for the vgroup identified by its tag + * Create the data description for the vgroup identified by its tag * and ref number. */ data_desc_id = ANcreate(an_id, vgroup_tag, vgroup_ref, AN_DATA_DESC); diff --git a/recipes/hdf4/all/test_v1_package/CMakeLists.txt b/recipes/hdf4/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/hdf4/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/hdf4/all/test_v1_package/conanfile.py b/recipes/hdf4/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..2d700055b1faf --- /dev/null +++ b/recipes/hdf4/all/test_v1_package/conanfile.py @@ -0,0 +1,24 @@ +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_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]") + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/hdf4/config.yml b/recipes/hdf4/config.yml index 64a8c610990e2..da09b79435da4 100644 --- a/recipes/hdf4/config.yml +++ b/recipes/hdf4/config.yml @@ -1,3 +1,5 @@ versions: + "4.2.16-2": + folder: all "4.2.15": folder: all diff --git a/recipes/hdf5/all/conandata.yml b/recipes/hdf5/all/conandata.yml index 4414eb5420df7..b3a2eb941b898 100644 --- a/recipes/hdf5/all/conandata.yml +++ b/recipes/hdf5/all/conandata.yml @@ -1,4 +1,22 @@ sources: + "1.14.5": + url: "https://github.com/HDFGroup/hdf5/archive/refs/tags/hdf5_1.14.5.tar.gz" + sha256: "c83996dc79080a34e7b5244a1d5ea076abfd642ec12d7c25388e2fdd81d26350" + "1.14.4.3": + url: "https://github.com/HDFGroup/hdf5/archive/refs/tags/hdf5_1.14.4.3.tar.gz" + sha256: "690c1db7ba0fed4ffac61709236675ffd99d95d191e8920ee79c58d7e7ea3361" + "1.14.3": + url: "https://github.com/HDFGroup/hdf5/archive/hdf5-1_14_3/hdf5-1_14_3.tar.gz" + sha256: "df5ee33c74d5efb59738075ef96f4201588e1f1eeb233f047ac7fd1072dee1f6" + "1.14.2": + url: "https://github.com/HDFGroup/hdf5/archive/hdf5-1_14_2.tar.gz" + sha256: "83eaee3f9d1790bb4b29368bf1a648ece763097a4122c80a81076e8fb1e890e6" + "1.14.1": + url: "https://github.com/HDFGroup/hdf5/archive/hdf5-1_14_1.tar.gz" + sha256: "1f710f3846d9c3ef9a4c57ef252ee0570f0af4e028fd6ccc360a48b7b16c347d" + "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" @@ -19,6 +37,10 @@ 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" patch_type: "conan" diff --git a/recipes/hdf5/all/conanfile.py b/recipes/hdf5/all/conanfile.py index 7fd80ff13f959..6ef1845be3cb4 100644 --- a/recipes/hdf5/all/conanfile.py +++ b/recipes/hdf5/all/conanfile.py @@ -1,14 +1,15 @@ +import glob import os +import textwrap + from conan import ConanFile -from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout from conan.errors import ConanInvalidConfiguration -from conan.tools.files import get, copy, replace_in_file, rm, rmdir, apply_conandata_patches, export_conandata_patches, save +from conan.tools.build import cross_building, 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, replace_in_file, rm, rmdir, save from conan.tools.scm import Version -from conan.tools.build import can_run -import textwrap - -required_conan_version = ">=1.53.0" +required_conan_version = ">=1.54.0" class Hdf5Conan(ConanFile): @@ -16,9 +17,9 @@ class Hdf5Conan(ConanFile): description = "HDF5 is a data model, library, and file format for storing and managing data." license = "BSD-3-Clause" topics = "hdf", "data" - homepage = "https://portal.hdfgroup.org/display/HDF5/HDF5" + homepage = "https://www.hdfgroup.org/solutions/hdf5/" 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,11 @@ class Hdf5Conan(ConanFile): "hl": [True, False], "threadsafe": [True, False], "with_zlib": [True, False], + "with_zlibng": [True, False], "szip_support": [None, "with_libaec", "with_szip"], "szip_encoding": [True, False], "parallel": [True, False], + "enable_unsupported": [True, False], } default_options = { "shared": False, @@ -38,11 +41,19 @@ class Hdf5Conan(ConanFile): "hl": True, "threadsafe": False, "with_zlib": True, + "with_zlibng": False, "szip_support": None, "szip_encoding": False, "parallel": False, + "enable_unsupported": False } + @property + def _min_cppstd(self): + if Version(self.version) < "1.14.0": + return "98" + return "11" + def export_sources(self): export_conandata_patches(self) @@ -50,26 +61,14 @@ 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)") - def configure(self): if self.options.shared: self.options.rm_safe("fPIC") - self.settings.rm_safe("compiler.libcxx") - self.settings.rm_safe("compiler.cppstd") - if self.options.enable_cxx or self.options.hl or (self.settings.os == "Windows" and not self.options.shared): + if not self.options.enable_cxx: + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + if (not self.options.enable_unsupported and (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 @@ -79,7 +78,9 @@ def layout(self): def requirements(self): if self.options.with_zlib: - self.requires("zlib/1.2.13") + self.requires("zlib/[>=1.2.11 <2]") + if self.options.with_zlibng: + self.requires("zlib-ng/2.2.2") if self.options.szip_support == "with_libaec": self.requires("libaec/1.0.6") elif self.options.szip_support == "with_szip": @@ -87,14 +88,50 @@ def requirements(self): if self.options.parallel: self.requires("openmpi/4.1.0") + def validate(self): + if self.options.parallel and not self.options.enable_unsupported: + if self.options.enable_cxx: + raise ConanInvalidConfiguration("Parallel and C++ options are mutually exclusive, forcefully allow with enable_unsupported=True") + if self.options.get_safe("threadsafe", False): + raise ConanInvalidConfiguration("Parallel and Threadsafe options are mutually exclusive, forcefully allow with enable_unsupported=True") + if self.options.szip_support == "with_szip" and \ + self.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.options.with_zlib and self.options.get_safe("with_zlibng"): + raise ConanInvalidConfiguration("with_zlib and with_zlibng cannot be enabled at the same time") + if self.options.get_safe("with_zlibng") and Version(self.version) < "1.14.5": + raise ConanInvalidConfiguration("with_zlibng=True is incompatible with versions prior to v1.14.5") + if self.settings.get_safe("compiler.cppstd"): + check_min_cppstd(self, self._min_cppstd) + + def validate_build(self): + if cross_building(self) and Version(self.version) < "1.14.4.3": + # While building it runs some executables like H5detect + raise ConanInvalidConfiguration("Current recipe doesn't support cross-building (yet)") + + def build_requirements(self): + if Version(self.version) >= "1.14.0": + self.tool_requires("cmake/[>=3.18 <4]") + def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) + def _inject_stdlib_flag(self, tc): + if self.settings.os in ["Linux", "FreeBSD"] 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 generate(self): cmakedeps = CMakeDeps(self) cmakedeps.generate() tc = CMakeToolchain(self) + if not valid_min_cppstd(self, self._min_cppstd): + tc.variables["CMAKE_CXX_STANDARD"] = self._min_cppstd + 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 @@ -121,13 +158,13 @@ def generate(self): 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_USE_ZLIB_NG"] = self.options.get_safe("with_zlibng", 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 - # 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_INSTALL_INCLUDE_DIR"] = "include/hdf5" tc.variables["HDF5_BUILD_TOOLS"] = False tc.variables["HDF5_BUILD_EXAMPLES"] = False @@ -136,11 +173,9 @@ def generate(self): 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.variables["ALLOW_UNSUPPORTED"] = self.options.enable_unsupported tc.generate() - def build(self): apply_conandata_patches(self) # Do not force PIC @@ -168,15 +203,15 @@ def _components(self): "hdf5_hl_cpp": {"component": "HL_CXX", "alias_target": "hdf5_hl_cpp", "requirements": ["hdf5_c", "hdf5_cpp", "hdf5_hl"]}, } - def _create_cmake_module_alias_targets(self, 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("""\ - 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)) + 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() + """) # add the additional hdf5_hl_cxx target when both CXX and HL components are specified content += textwrap.dedent("""\ @@ -185,14 +220,22 @@ def _create_cmake_module_alias_targets(self, 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")) + 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_file_rel_path(self): + def _module_targets_file_rel_path(self): return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") + @property + def _module_variables_file_rel_path(self): + return os.path.join("lib", "cmake", + f"conan-official-{self.name}-variables.cmake") + def package(self): copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) @@ -201,12 +244,22 @@ def package(self): 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: + for lib in glob.glob(os.path.join(self.package_folder, "lib", "*.a")): + if not lib.endswith(".dll.a"): + os.remove(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), - {f"hdf5::{component['alias_target']}": f"HDF5::{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) ) @@ -230,21 +283,24 @@ def _config_libname(lib): # 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"]) self.cpp_info.components["hdf5_c"].includedirs.append(os.path.join("include", "hdf5")) - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["hdf5_c"].system_libs.extend(["dl", "m"]) if self.options.get_safe("threadsafe"): self.cpp_info.components["hdf5_c"].system_libs.append("pthread") + elif self.settings.os == "Windows": + self.cpp_info.components["hdf5_c"].system_libs.append("Shlwapi") if self.options.shared: self.cpp_info.components["hdf5_c"].defines.append("H5_BUILT_AS_DYNAMIC_LIB") 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/test_package/CMakeLists.txt b/recipes/hdf5/all/test_package/CMakeLists.txt index f55f0f366b044..a613c94b64b96 100644 --- a/recipes/hdf5/all/test_package/CMakeLists.txt +++ b/recipes/hdf5/all/test_package/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.8) project(test_package LANGUAGES C CXX) set(HDF5_COMPONENTS C) @@ -11,6 +11,9 @@ endif() find_package(HDF5 COMPONENTS ${HDF5_COMPONENTS}) add_executable(${PROJECT_NAME} test_package.c) +if(HDF5_CXX) + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +endif() if (TARGET hdf5::hdf5_cpp) target_compile_definitions(${PROJECT_NAME} PRIVATE CONAN_HDF5_CXX) diff --git a/recipes/hdf5/all/test_package/conanfile.py b/recipes/hdf5/all/test_package/conanfile.py index 062e3a1d36ef6..9ff0574745609 100644 --- a/recipes/hdf5/all/test_package/conanfile.py +++ b/recipes/hdf5/all/test_package/conanfile.py @@ -1,7 +1,8 @@ +import os + from conan import ConanFile from conan.tools.build import can_run -from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout -import os +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout class TestPackageConan(ConanFile): @@ -9,17 +10,17 @@ class TestPackageConan(ConanFile): generators = "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 generate(self): tc = CMakeToolchain(self) tc.variables.update({ - "HDF5_CXX": self.options["hdf5"].enable_cxx, - "HDF5_HL": self.options["hdf5"].hl, + "HDF5_CXX": self.dependencies["hdf5"].options.enable_cxx, + "HDF5_HL": self.dependencies["hdf5"].options.hl, }) tc.generate() diff --git a/recipes/hdf5/all/test_v1_package/CMakeLists.txt b/recipes/hdf5/all/test_v1_package/CMakeLists.txt index 61e2f5929ebe0..907e42aba8a37 100644 --- a/recipes/hdf5/all/test_v1_package/CMakeLists.txt +++ b/recipes/hdf5/all/test_v1_package/CMakeLists.txt @@ -1,28 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C CXX) +project(test_package) 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() +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/hdf5/all/test_v1_package/conanfile.py b/recipes/hdf5/all/test_v1_package/conanfile.py index 4d4698a0afd36..57bd58e9f46c2 100644 --- a/recipes/hdf5/all/test_v1_package/conanfile.py +++ b/recipes/hdf5/all/test_v1_package/conanfile.py @@ -1,6 +1,7 @@ -from conans import ConanFile, CMake, tools import os +from conans import CMake, ConanFile, tools + class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" diff --git a/recipes/hdf5/all/test_v1_package/test_package.c b/recipes/hdf5/all/test_v1_package/test_package.c deleted file mode 100644 index acc23d1bd8c5f..0000000000000 --- a/recipes/hdf5/all/test_v1_package/test_package.c +++ /dev/null @@ -1,50 +0,0 @@ -#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 deleted file mode 100644 index ef3ec22b3871e..0000000000000 --- a/recipes/hdf5/all/test_v1_package/test_package.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#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 deleted file mode 100644 index 557e7c0f80372..0000000000000 --- a/recipes/hdf5/all/test_v1_package/test_parallel.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - * 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 05116bbcf4173..ecd8ab4173bf5 100644 --- a/recipes/hdf5/config.yml +++ b/recipes/hdf5/config.yml @@ -1,4 +1,16 @@ versions: + "1.14.5": + folder: all + "1.14.4.3": + folder: all + "1.14.3": + folder: all + "1.14.2": + folder: all + "1.14.1": + folder: all + "1.14.0": + folder: all "1.13.1": folder: all "1.12.2": diff --git a/recipes/hdrhistogram-c/all/conandata.yml b/recipes/hdrhistogram-c/all/conandata.yml index b4fa682a3e25b..7332bd3995031 100644 --- a/recipes/hdrhistogram-c/all/conandata.yml +++ b/recipes/hdrhistogram-c/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "0.11.8": + url: "https://github.com/HdrHistogram/HdrHistogram_c/archive/0.11.8.tar.gz" + sha256: "bb95351a6a8b242dc9be1f28562761a84d4cf0a874ffc90a9b630770a6468e94" + "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" diff --git a/recipes/hdrhistogram-c/all/conanfile.py b/recipes/hdrhistogram-c/all/conanfile.py index 4166d96c192f3..f9f345becdeab 100644 --- a/recipes/hdrhistogram-c/all/conanfile.py +++ b/recipes/hdrhistogram-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 apply_conandata_patches, collect_libs, copy, export_conandata_patches, get, rmdir +from conan.tools.scm import Version import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class HdrhistogramcConan(ConanFile): @@ -13,7 +14,7 @@ class HdrhistogramcConan(ConanFile): homepage = "https://github.com/HdrHistogram/HdrHistogram_c" description = "'C' port of High Dynamic Range (HDR) Histogram" topics = ("libraries", "c", "histogram") - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "fPIC": [True, False], @@ -33,28 +34,18 @@ def config_options(self): 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 + 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.13") + self.requires("zlib/[>=1.2.11 <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 = CMakeToolchain(self) @@ -80,18 +71,21 @@ def package(self): 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", 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 = 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"] diff --git a/recipes/hdrhistogram-c/all/test_v1_package/CMakeLists.txt b/recipes/hdrhistogram-c/all/test_v1_package/CMakeLists.txt index 0f3ffb58a6c47..925ecbe19e448 100644 --- a/recipes/hdrhistogram-c/all/test_v1_package/CMakeLists.txt +++ b/recipes/hdrhistogram-c/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(hdr_histogram REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -if(TARGET hdr_histogram::hdr_histogram_static) - target_link_libraries(${PROJECT_NAME} PRIVATE hdr_histogram::hdr_histogram_static) -else() - target_link_libraries(${PROJECT_NAME} PRIVATE hdr_histogram::hdr_histogram) -endif() +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/hdrhistogram-c/config.yml b/recipes/hdrhistogram-c/config.yml index f69c5e8ad6e99..9f7269d8ddea4 100644 --- a/recipes/hdrhistogram-c/config.yml +++ b/recipes/hdrhistogram-c/config.yml @@ -1,4 +1,8 @@ versions: + "0.11.8": + folder: all + "0.11.6": + folder: all "0.11.1": folder: all "0.11.0": diff --git a/recipes/hedley/all/conanfile.py b/recipes/hedley/all/conanfile.py index 835a13a80a59b..b59e08a89ffbb 100644 --- a/recipes/hedley/all/conanfile.py +++ b/recipes/hedley/all/conanfile.py @@ -13,6 +13,7 @@ class HedleyConan(ConanFile): 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") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -23,8 +24,7 @@ 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 diff --git a/recipes/hello-conan/all/CMakeLists.txt b/recipes/hello-conan/all/CMakeLists.txt new file mode 100644 index 0000000000000..4be7c999bbce3 --- /dev/null +++ b/recipes/hello-conan/all/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.15) + +project(hello-conan LANGUAGES CXX) + +add_library(hello-conan src/hello-conan.cpp) + +target_include_directories(hello-conan PUBLIC include) +set_target_properties(hello-conan PROPERTIES PUBLIC_HEADER "include/hello-conan.h") +install(TARGETS hello-conan) diff --git a/recipes/hello-conan/all/conanfile.py b/recipes/hello-conan/all/conanfile.py new file mode 100644 index 0000000000000..5ce78afb9e98a --- /dev/null +++ b/recipes/hello-conan/all/conanfile.py @@ -0,0 +1,53 @@ +from conan import ConanFile +from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps +from conan.tools.files import save + +from pathlib import Path + +required_conan_version = ">=2.8.0" + +class hello_conanRecipe(ConanFile): + name = "hello-conan" + package_type = "library" + + # Optional metadata !_!!!! + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + description = "Dummy recipe for internal testing" + topics = ("conan-testing", "dummy") + + # Binary configuration + settings = "os", "compiler", "build_type", "arch" + options = {"shared": [True, False], "fPIC": [True, False]} + default_options = {"shared": False, "fPIC": True} + + # Sources are located in the same place as this recipe, copy them to the recipe + exports_sources = "CMakeLists.txt", "src/*", "include/*" + + implements = ["auto_shared_fpic"] + + def layout(self): + cmake_layout(self) + + def generate(self): + deps = CMakeDeps(self) + deps.generate() + tc = CMakeToolchain(self) + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + cmake = CMake(self) + cmake.install() + + # save a dummy .la file to trigger hook warning + la_file = Path(self.package_folder) / "lib" / "hello-conan-foobar.la" + save(self, la_file.as_posix(), "foobar") + + def package_info(self): + self.cpp_info.libs = ["hello-conan"] + diff --git a/recipes/hello-conan/all/include/hello-conan.h b/recipes/hello-conan/all/include/hello-conan.h new file mode 100644 index 0000000000000..a7ad36e5ace0c --- /dev/null +++ b/recipes/hello-conan/all/include/hello-conan.h @@ -0,0 +1,14 @@ +#pragma once + +#include +#include + + +#ifdef _WIN32 + #define HELLO_CONAN_EXPORT __declspec(dllexport) +#else + #define HELLO_CONAN_EXPORT +#endif + +HELLO_CONAN_EXPORT void hello_conan(); +HELLO_CONAN_EXPORT void hello_conan_print_vector(const std::vector &strings); diff --git a/recipes/hello-conan/all/src/hello-conan.cpp b/recipes/hello-conan/all/src/hello-conan.cpp new file mode 100644 index 0000000000000..e4ac284e8c482 --- /dev/null +++ b/recipes/hello-conan/all/src/hello-conan.cpp @@ -0,0 +1,120 @@ +#include +#include "hello-conan.h" + + + +void hello_conan(){ + + + #ifdef NDEBUG + std::cout << "hello-conan: Hello World Release!\n"; + #else + std::cout << "hello-conan: Hello World Debug!\n"; + #endif + + // ARCHITECTURES + #ifdef _M_X64 + std::cout << " hello-conan: _M_X64 defined\n"; + #endif + + #ifdef _M_IX86 + std::cout << " hello-conan: _M_IX86 defined\n"; + #endif + + #ifdef _M_ARM64 + std::cout << " hello-conan: _M_ARM64 defined\n"; + #endif + + #if __i386__ + std::cout << " hello-conan: __i386__ defined\n"; + #endif + + #if __x86_64__ + std::cout << " hello-conan: __x86_64__ defined\n"; + #endif + + #if __aarch64__ + std::cout << " hello-conan: __aarch64__ defined\n"; + #endif + + // Libstdc++ + #if defined _GLIBCXX_USE_CXX11_ABI + std::cout << " hello-conan: _GLIBCXX_USE_CXX11_ABI "<< _GLIBCXX_USE_CXX11_ABI << "\n"; + #endif + + // MSVC runtime + #if defined(_DEBUG) + #if defined(_MT) && defined(_DLL) + std::cout << " hello-conan: MSVC runtime: MultiThreadedDebugDLL\n"; + #elif defined(_MT) + std::cout << " hello-conan: MSVC runtime: MultiThreadedDebug\n"; + #endif + #else + #if defined(_MT) && defined(_DLL) + std::cout << " hello-conan: MSVC runtime: MultiThreadedDLL\n"; + #elif defined(_MT) + std::cout << " hello-conan: MSVC runtime: MultiThreaded\n"; + #endif + #endif + + // COMPILER VERSIONS + #if _MSC_VER + std::cout << " hello-conan: _MSC_VER" << _MSC_VER<< "\n"; + #endif + + #if _MSVC_LANG + std::cout << " hello-conan: _MSVC_LANG" << _MSVC_LANG<< "\n"; + #endif + + #if __cplusplus + std::cout << " hello-conan: __cplusplus" << __cplusplus<< "\n"; + #endif + + #if __INTEL_COMPILER + std::cout << " hello-conan: __INTEL_COMPILER" << __INTEL_COMPILER<< "\n"; + #endif + + #if __GNUC__ + std::cout << " hello-conan: __GNUC__" << __GNUC__<< "\n"; + #endif + + #if __GNUC_MINOR__ + std::cout << " hello-conan: __GNUC_MINOR__" << __GNUC_MINOR__<< "\n"; + #endif + + #if __clang_major__ + std::cout << " hello-conan: __clang_major__" << __clang_major__<< "\n"; + #endif + + #if __clang_minor__ + std::cout << " hello-conan: __clang_minor__" << __clang_minor__<< "\n"; + #endif + + #if __apple_build_version__ + std::cout << " hello-conan: __apple_build_version__" << __apple_build_version__<< "\n"; + #endif + + // SUBSYSTEMS + + #if __MSYS__ + std::cout << " hello-conan: __MSYS__" << __MSYS__<< "\n"; + #endif + + #if __MINGW32__ + std::cout << " hello-conan: __MINGW32__" << __MINGW32__<< "\n"; + #endif + + #if __MINGW64__ + std::cout << " hello-conan: __MINGW64__" << __MINGW64__<< "\n"; + #endif + + #if __CYGWIN__ + std::cout << " hello-conan: __CYGWIN__" << __CYGWIN__<< "\n"; + #endif +} + +void hello_conan_print_vector(const std::vector &strings) { + for(std::vector::const_iterator it = strings.begin(); it != strings.end(); ++it) { + std::cout << "hello_conan " << *it << std::endl; + } +} diff --git a/recipes/hello-conan/all/test_package/CMakeLists.txt b/recipes/hello-conan/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..5a6e6596a4333 --- /dev/null +++ b/recipes/hello-conan/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(PackageTest CXX) + +find_package(hello-conan CONFIG REQUIRED) + +add_executable(example src/example.cpp) +target_link_libraries(example hello-conan::hello-conan) diff --git a/recipes/hello-conan/all/test_package/conanfile.py b/recipes/hello-conan/all/test_package/conanfile.py new file mode 100644 index 0000000000000..953f2c57d31ae --- /dev/null +++ b/recipes/hello-conan/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 hello_conanTestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "CMakeDeps", "CMakeToolchain" + + 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 can_run(self): + cmd = os.path.join(self.cpp.build.bindir, "example") + self.run(cmd, env="conanrun") diff --git a/recipes/hello-conan/all/test_package/src/example.cpp b/recipes/hello-conan/all/test_package/src/example.cpp new file mode 100644 index 0000000000000..92b072f19e866 --- /dev/null +++ b/recipes/hello-conan/all/test_package/src/example.cpp @@ -0,0 +1,12 @@ +#include "hello-conan.h" +#include +#include + +int main() { + hello_conan(); + + std::vector vec; + vec.push_back("test_package"); + + hello_conan_print_vector(vec); +} diff --git a/recipes/hello-conan/config.yml b/recipes/hello-conan/config.yml new file mode 100644 index 0000000000000..87dc2c7cd104e --- /dev/null +++ b/recipes/hello-conan/config.yml @@ -0,0 +1,3 @@ +versions: + "0.0.1.cci.20241029": + folder: all \ No newline at end of file diff --git a/recipes/hexl/all/CMakeLists.txt b/recipes/hexl/all/CMakeLists.txt deleted file mode 100644 index 8b3b9ef203c08..0000000000000 --- a/recipes/hexl/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.13.0) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory("source_subfolder") diff --git a/recipes/hexl/all/conandata.yml b/recipes/hexl/all/conandata.yml index 8ed6d6d348eaa..78aeef07d0a65 100644 --- a/recipes/hexl/all/conandata.yml +++ b/recipes/hexl/all/conandata.yml @@ -1,8 +1,7 @@ sources: + "1.2.5": + url: "https://github.com/intel/hexl/archive/refs/tags/v1.2.5.tar.gz" + sha256: "3692e6e6183dbc49253e51e86c3e52e7affcac925f57db0949dbb4d34b558a9a" "1.2.4": url: "https://github.com/intel/hexl/archive/refs/tags/v1.2.4.tar.gz" sha256: "f91dd158e3faa8795035f618286cdef7dacbf488fd0ba4f44409880997b4549f" -patches: - "1.2.4": - - patch_file: "patches/fix-cmake.patch" - base_path: "source_subfolder" diff --git a/recipes/hexl/all/conanfile.py b/recipes/hexl/all/conanfile.py index 820c3b5030b0a..c5006ac155cfc 100644 --- a/recipes/hexl/all/conanfile.py +++ b/recipes/hexl/all/conanfile.py @@ -1,158 +1,161 @@ -from conans import CMake, tools +import os + from conan import ConanFile from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd, cross_building +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, replace_in_file, get, rmdir from conan.tools.microsoft import is_msvc -from conan.tools.files import get, rmdir from conan.tools.scm import Version -from conan.tools.build import cross_building -import os +required_conan_version = ">=1.53.0" -required_conan_version = ">=1.43.0" class HexlConan(ConanFile): name = "hexl" + description = "Intel Homomorphic Encryption (HE) Acceleration Library" license = "Apache-2.0" - homepage = "https://github.com/intel/hexl" url = "https://github.com/conan-io/conan-center-index" - description = "Intel Homomorphic Encryption (HE) Acceleration Library" + homepage = "https://github.com/intel/hexl" topics = ("homomorphic", "encryption", "privacy") - settings = "os", "compiler", "build_type", "arch" - exports_sources = ["CMakeLists.txt", "patches/**"] - generators = "cmake", "cmake_find_package" - - _cmake = None + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], "experimental": [True, False], "fpga_compatibility_dyadic_multiply": [True, False], - "fpga_compatibility_keyswitch": [True, False] + "fpga_compatibility_keyswitch": [True, False], } - default_options = { "shared": False, "fPIC": True, "experimental": False, "fpga_compatibility_dyadic_multiply": False, - "fpga_compatibility_keyswitch": False + "fpga_compatibility_keyswitch": False, } - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - - def source(self): - get(self, **self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) - - def build_requirements(self): - self.build_requires("cmake/3.22.0") - - def requirements(self): - self.requires("cpu_features/0.7.0") - - if self.settings.build_type == "Debug": - self.requires("easyloggingpp/9.97.0") - @property def _compilers_minimum_version(self): return { "gcc": "7", "Visual Studio": "15.7", + "msvc": "191", "clang": "7", "apple-clang": "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 requirements(self): + self.requires("cpu_features/0.9.0") + + if self.settings.build_type == "Debug": + self.requires("easyloggingpp/9.97.1") + def validate(self): if self.settings.compiler.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 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)) + raise ConanInvalidConfiguration( + f"{self.name} requires C++17, which your compiler does not support." + ) if self.settings.arch not in ["x86", "x86_64"]: - raise ConanInvalidConfiguration("Hexl only supports x86 architecture") + raise ConanInvalidConfiguration("Hexl only supports x86 architectures") - if self.options.shared and is_msvc(self): - raise ConanInvalidConfiguration("Hexl only supports static linking with msvc") - - def config_options(self): - if self.settings.os == "Windows": - del self.options.fPIC - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self); + def build_requirements(self): + self.tool_requires("cmake/[>=3.24 <4]") + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) - self._cmake.definitions["HEXL_BENCHMARK"] = False - self._cmake.definitions["HEXL_TESTING"] = False - self._cmake.definitions["HEXL_EXPERIMENTAL"] = self.options.experimental + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["HEXL_BENCHMARK"] = False + tc.cache_variables["HEXL_TESTING"] = False + tc.cache_variables["HEXL_EXPERIMENTAL"] = self.options.experimental if self.options.fpga_compatibility_dyadic_multiply and self.options.fpga_compatibility_keyswitch: - self._cmake.definitions["HEXL_FPGA_COMPATIBILITY"] = 3 + tc.cache_variables["HEXL_FPGA_COMPATIBILITY"] = 3 elif self.options.fpga_compatibility_dyadic_multiply: - self._cmake.definitions["HEXL_FPGA_COMPATIBILITY"] = 1 + tc.cache_variables["HEXL_FPGA_COMPATIBILITY"] = 1 elif self.options.fpga_compatibility_keyswitch: - self._cmake.definitions["HEXL_FPGA_COMPATIBILITY"] = 2 + tc.cache_variables["HEXL_FPGA_COMPATIBILITY"] = 2 else: - self._cmake.definitions["HEXL_FPGA_COMPATIBILITY"] = 0 + tc.cache_variables["HEXL_FPGA_COMPATIBILITY"] = 0 - self._cmake.definitions["HEXL_SHARED_LIB"] = self.options.shared - self._cmake.definitions["HEXL_CROSS_COMPILED"] = cross_building(self) + tc.cache_variables["HEXL_SHARED_LIB"] = self.options.shared + tc.cache_variables["HEXL_CROSS_COMPILED"] = cross_building(self) - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + tc.cache_variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = self.options.shared - def configure(self): - if self.options.shared: - del self.options.fPIC + tc.generate() + + tc = CMakeDeps(self) + tc.set_property("easyloggingpp", "cmake_file_name", "EASYLOGGINGPP") + tc.set_property("easyloggingpp", "cmake_target_name", "easyloggingpp") + tc.generate() + + def _patch_sources(self): + rmdir(self, os.path.join(self.package_folder, "cmake", "third-party")) + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "set(CMAKE_POSITION_INDEPENDENT_CODE ON)", "") + replace_in_file(self, os.path.join(self.source_folder, "hexl", "CMakeLists.txt"), + "set_target_properties(hexl PROPERTIES POSITION_INDEPENDENT_CODE ON)", "") + # Should come from compiler.sanitizer=Address + replace_in_file(self, os.path.join(self.source_folder, "hexl", "CMakeLists.txt"), + "hexl_add_asan_flag(hexl)", "") + if cross_building(self): + replace_in_file(self, os.path.join(self.source_folder, "hexl", "CMakeLists.txt"), + "-march=native", "") 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): - cmake = self._configure_cmake() + cmake = CMake(self) cmake.install() - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + copy(self, "LICENSE", 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, "lib", "cmake")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "Hexl") - # TODO: Remove in Conan 2.0 - self.cpp_info.names["cmake_find_package"] = "Hexl" - self.cpp_info.names["cmake_find_package_multi"] = "Hexl" - - if self.settings.build_type == "Debug": - if not is_msvc(self): - self.cpp_info.components["Hexl"].libs = ["hexl_debug"] - else: - self.cpp_info.components["Hexl"].libs = ["hexl"] + self.cpp_info.set_property("cmake_target_name", "Hexl::Hexl") + self.cpp_info.set_property("pkg_config_name", "hexl") - self.cpp_info.components["Hexl"].requires.append("easyloggingpp::easyloggingpp") + if not is_msvc(self) and self.settings.build_type == "Debug": + self.cpp_info.components["Hexl"].libs = ["hexl_debug"] else: self.cpp_info.components["Hexl"].libs = ["hexl"] - self.cpp_info.components["Hexl"].names["cmake_find_package"] = "hexl" - self.cpp_info.components["Hexl"].names["cmake_find_package_multi"] = "hexl" - self.cpp_info.components["Hexl"].set_property("cmake_target_name", "Hexl::hexl") - self.cpp_info.components["Hexl"].set_property("pkg_config_name", "hexl") - self.cpp_info.components["Hexl"].requires.append("cpu_features::libcpu_features") - if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["Hexl"].system_libs = ["pthread", "m"] + self.cpp_info.components["Hexl"].set_property("cmake_target_name", "Hexl::hexl") + self.cpp_info.components["Hexl"].requires.append("cpu_features::libcpu_features") + if self.settings.build_type == "Debug": + self.cpp_info.components["Hexl"].requires.append("easyloggingpp::easyloggingpp") + + # TODO: Remove in Conan 2.0 + self.cpp_info.names["cmake_find_package"] = "Hexl" + self.cpp_info.names["cmake_find_package_multi"] = "Hexl" + self.cpp_info.components["Hexl"].names["cmake_find_package"] = "hexl" + self.cpp_info.components["Hexl"].names["cmake_find_package_multi"] = "hexl" diff --git a/recipes/hexl/all/patches/fix-cmake.patch b/recipes/hexl/all/patches/fix-cmake.patch deleted file mode 100644 index 8aeb45bf1b421..0000000000000 --- a/recipes/hexl/all/patches/fix-cmake.patch +++ /dev/null @@ -1,122 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 1cee76b..0db1f9c 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -28,10 +28,6 @@ if(CMAKE_BUILD_TYPE) - endif() - endif() - --if(NOT CMAKE_BUILD_TYPE) -- set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type" FORCE) --endif() -- - if (CMAKE_BUILD_TYPE STREQUAL "Debug") - set(HEXL_DEBUG ON) - else() -@@ -139,18 +135,12 @@ message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}") - #------------------------------------------------------------------------------ - # Third-party code... - #------------------------------------------------------------------------------ --find_package(CpuFeatures CONFIG) --if (NOT CpuFeatures_FOUND) -- message(STATUS "CpuFeatures: pre-installed CpuFeatures not found") -- add_subdirectory(cmake/third-party/cpu-features) --else() -- message(STATUS "CpuFeatures: found") -- add_library(cpu_features ALIAS CpuFeatures::cpu_features) -- get_target_property( -- CpuFeatures_INCLUDE_DIR -- CpuFeatures::cpu_features -- INTERFACE_INCLUDE_DIRECTORIES) --endif() -+find_package(CpuFeatures REQUIRED) -+add_library(cpu_features ALIAS CpuFeatures::cpu_features) -+get_target_property( -+ CpuFeatures_INCLUDE_DIR -+ CpuFeatures::cpu_features -+ INTERFACE_INCLUDE_DIRECTORIES) - - if (HEXL_TESTING OR HEXL_BENCHMARK OR HEXL_DEBUG) - if(NOT TARGET Threads::Threads) -@@ -168,18 +158,11 @@ if (HEXL_BENCHMARK) - endif() - - if (HEXL_DEBUG) -- list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/third-party/easylogging") -- find_package(EASYLOGGINGPP MODULE) -- if (EASYLOGGINGPP_FOUND) -- message(STATUS "easyloggingpp: pre-installed easyloggingpp found") -- get_target_property( -- EASYLOGGINGPP_INCLUDE_DIR -- easyloggingpp -- INTERFACE_INCLUDE_DIRECTORIES) -- else() -- message(STATUS "easyloggingpp: pre-installed easyloggingpp NOT found, building from source") -- add_subdirectory(cmake/third-party/easylogging) -- endif() -+ find_package(easyloggingpp REQUIRED) -+ get_target_property( -+ EASYLOGGINGPP_INCLUDE_DIR -+ easyloggingpp::easyloggingpp -+ INTERFACE_INCLUDE_DIRECTORIES) - endif() - - #------------------------------------------------------------------------------ -diff --git a/hexl/CMakeLists.txt b/hexl/CMakeLists.txt -index 139f17c..6558256 100644 ---- a/hexl/CMakeLists.txt -+++ b/hexl/CMakeLists.txt -@@ -53,7 +53,8 @@ else() - endif() - add_library(HEXL::hexl ALIAS hexl) - --hexl_add_asan_flag(hexl) -+# Should come from compiler.sanitizer=Address -+# hexl_add_asan_flag(hexl) - - set(HEXL_DEFINES_IN_FILENAME ${CMAKE_CURRENT_SOURCE_DIR}/include/hexl/util/defines.hpp.in) - set(HEXL_DEFINES_FILENAME ${CMAKE_CURRENT_SOURCE_DIR}/include/hexl/util/defines.hpp) -@@ -89,10 +90,15 @@ endif() - - if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") - target_compile_options(hexl PRIVATE -Wall -Wconversion -Wshadow -pedantic -Wextra -- -Wno-unknown-pragmas -march=native -O3 -fomit-frame-pointer -+ -Wno-unknown-pragmas -O3 -fomit-frame-pointer - -Wno-sign-conversion - -Wno-implicit-int-conversion - ) -+ -+ if(NOT HEXL_CROSS_COMPILED) -+ target_compile_options(hexl PRIVATE -march=native) -+ endif() -+ - # Avoid 3rd-party dependency warnings when including HEXL as a dependency - target_compile_options(hexl PUBLIC - -Wno-unknown-warning -@@ -121,7 +127,7 @@ if (HEXL_SHARED_LIB) - target_link_libraries(hexl PUBLIC easyloggingpp) - # Manually add logging include directory - target_include_directories(hexl -- PUBLIC $> -+ PUBLIC ${EASYLOGGINGPP_INCLUDE_DIR} - ) - endif() - else () -@@ -132,7 +138,7 @@ else () - if (HEXL_DEBUG) - # Manually add logging include directory - target_include_directories(hexl -- PUBLIC $> -+ PUBLIC ${EASYLOGGINGPP_INCLUDE_DIR} - ) - if (EASYLOGGINGPP_FOUND) - target_link_libraries(hexl PRIVATE easyloggingpp) -@@ -152,8 +158,6 @@ else () - PRIVATE $) - endif() - --install(TARGETS hexl DESTINATION ${CMAKE_INSTALL_LIBDIR}) -- - #------------------------------------------------------------------------------ - # Config export... - #------------------------------------------------------------------------------ diff --git a/recipes/hexl/all/test_package/CMakeLists.txt b/recipes/hexl/all/test_package/CMakeLists.txt index cf18c1281c79a..6b4c1055e308d 100644 --- a/recipes/hexl/all/test_package/CMakeLists.txt +++ b/recipes/hexl/all/test_package/CMakeLists.txt @@ -1,12 +1,11 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(PackageTest CXX) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +find_package(Hexl REQUIRED CONFIG) find_package(Hexl COMPONENTS hexl REQUIRED) add_executable(example example.cpp) diff --git a/recipes/hexl/all/test_package/conanfile.py b/recipes/hexl/all/test_package/conanfile.py index 417bb10e807de..8d52b7021efe1 100644 --- a/recipes/hexl/all/test_package/conanfile.py +++ b/recipes/hexl/all/test_package/conanfile.py @@ -1,13 +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 -from conan.tools.build import cross_building +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" -class HexlTestConan(ConanFile): - settings = "os", "build_type", "arch", "compiler" - 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) @@ -15,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not 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.bindir, "example") + self.run(bin_path, env="conanrun") diff --git a/recipes/hexl/all/test_v1_package/CMakeLists.txt b/recipes/hexl/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/hexl/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/hexl/all/test_v1_package/conanfile.py b/recipes/hexl/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..0a70df7062409 --- /dev/null +++ b/recipes/hexl/all/test_v1_package/conanfile.py @@ -0,0 +1,20 @@ +import os + +from conans import ConanFile, CMake, tools +from conan.tools.build import cross_building + + +class HexlTestConan(ConanFile): + settings = "os", "build_type", "arch", "compiler" + 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", "example") + self.run(bin_path, run_environment=True) diff --git a/recipes/hexl/config.yml b/recipes/hexl/config.yml index 5c12183246809..e06c947a952fd 100644 --- a/recipes/hexl/config.yml +++ b/recipes/hexl/config.yml @@ -1,3 +1,5 @@ versions: + "1.2.5": + folder: all "1.2.4": folder: all diff --git a/recipes/hffix/all/conandata.yml b/recipes/hffix/all/conandata.yml index 63e048eedc787..a5fdd1b12f317 100644 --- a/recipes/hffix/all/conandata.yml +++ b/recipes/hffix/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.3.0": + url: "https://github.com/jamesdbrock/hffix/archive/v1.3.0.tar.gz" + sha256: "db3584c9daa5cfb76a096e02d945355294558a78d0128b5c2e82b8849fa26d77" "1.1.1": url: "https://github.com/jamesdbrock/hffix/archive/refs/tags/v1.1.1.tar.gz" sha256: "25dcaee8ded3590dd04225bd98909c9d78c8e39c26fb3c9880ec001a35464c07" diff --git a/recipes/hffix/all/conanfile.py b/recipes/hffix/all/conanfile.py index b8be09b23ee81..daed63ba031a6 100644 --- a/recipes/hffix/all/conanfile.py +++ b/recipes/hffix/all/conanfile.py @@ -13,20 +13,18 @@ class HffixConan(ConanFile): topics = ("fixprotocol", "financial") homepage = "https://github.com/jamesdbrock/hffix" url = "https://github.com/conan-io/conan-center-index" - + package_type = "header-library" 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 @@ -38,5 +36,3 @@ def package(self): def package_info(self): self.cpp_info.bindirs = [] self.cpp_info.libdirs = [] - self.cpp_info.frameworkdirs = [] - self.cpp_info.resdirs = [] diff --git a/recipes/hffix/all/test_package/CMakeLists.txt b/recipes/hffix/all/test_package/CMakeLists.txt index bea843560a088..c27ed0c7d9302 100644 --- a/recipes/hffix/all/test_package/CMakeLists.txt +++ b/recipes/hffix/all/test_package/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package LANGUAGES CXX) find_package(hffix REQUIRED CONFIG) diff --git a/recipes/hffix/all/test_package/conanfile.py b/recipes/hffix/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/hffix/all/test_package/conanfile.py +++ b/recipes/hffix/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/hffix/all/test_v1_package/CMakeLists.txt b/recipes/hffix/all/test_v1_package/CMakeLists.txt index 31a17e5e32684..b21cc49efde95 100644 --- a/recipes/hffix/all/test_v1_package/CMakeLists.txt +++ b/recipes/hffix/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.15) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(hffix REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE hffix::hffix) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/hffix/config.yml b/recipes/hffix/config.yml index 60d31991f5141..4d32e3eeef7e4 100644 --- a/recipes/hffix/config.yml +++ b/recipes/hffix/config.yml @@ -1,3 +1,5 @@ versions: + "1.3.0": + folder: all "1.1.1": folder: all diff --git a/recipes/hictk/all/conandata.yml b/recipes/hictk/all/conandata.yml new file mode 100644 index 0000000000000..2ad5e6a4a9214 --- /dev/null +++ b/recipes/hictk/all/conandata.yml @@ -0,0 +1,25 @@ +sources: + "1.0.0": + url: "https://github.com/paulsengroup/hictk/archive/refs/tags/v1.0.0.tar.gz" + sha256: "e337f52658a257eb6265e211dd3cef6b73db40bdc5b5a6433b47ce4faa6006fb" + "0.0.12": + url: "https://github.com/paulsengroup/hictk/archive/refs/tags/v0.0.12.tar.gz" + sha256: "03e8f7c0076ea6209fdfee1580658e871895f6a59b895407c4a25512b9558fb7" + "0.0.10": + url: "https://github.com/paulsengroup/hictk/archive/refs/tags/v0.0.10.tar.gz" + sha256: "0b2d60af73578b292317e5ab513f24965176f9852ceda29e8d02007a434588c3" + "0.0.9": + url: "https://github.com/paulsengroup/hictk/archive/refs/tags/v0.0.9.tar.gz" + sha256: "c64cb07a057863baa199b9d344b27b8f15a1db458390ccf7b5cac0627308d8c8" + "0.0.8": + url: "https://github.com/paulsengroup/hictk/archive/refs/tags/v0.0.8.tar.gz" + sha256: "4bdadf49cb053731ea31f50312c9e4fcbcdcbaf94c39715f7b325641629bed4b" + "0.0.3": + url: "https://github.com/paulsengroup/hictk/archive/refs/tags/v0.0.3.tar.gz" + sha256: "f49657b9ef80ef9fa07f125a0b6f056923235c9ea77e19cee312b004384ea39e" + "0.0.2": + url: "https://github.com/paulsengroup/hictk/archive/refs/tags/v0.0.2.tar.gz" + sha256: "7716711ecb33247d8f79f6768ebbdcf55e51e9b6f962245747b33d0967431427" + "0.0.1": + url: "https://github.com/paulsengroup/hictk/archive/refs/tags/v0.0.1.tar.gz" + sha256: "460985413c3b2e80121f7697c6c824a91955a38051de770d7eb946ddafa88460" diff --git a/recipes/hictk/all/conanfile.py b/recipes/hictk/all/conanfile.py new file mode 100644 index 0000000000000..d125eb77e94dc --- /dev/null +++ b/recipes/hictk/all/conanfile.py @@ -0,0 +1,135 @@ +import os.path + +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.scm import Version + +required_conan_version = ">=1.50.0" + + +class HictkConan(ConanFile): + name = "hictk" + description = "Blazing fast toolkit to work with .hic and .cool files" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/paulsengroup/hictk" + topics = "hictk", "bioinformatics", "hic" + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + options = { + "with_arrow": [True, False], + "with_eigen": [True, False] + } + default_options = { + "with_arrow": False, + "with_eigen": True + } + + @property + def _min_cppstd(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "apple-clang": "11", + "clang": "7", + "gcc": "8", + "Visual Studio": "16", + "msvc": "192", + } + + def layout(self): + cmake_layout(self, src_folder="src") + + def config_options(self): + if Version(self.version) < "1.0.0": + del self.options.with_arrow + + def requirements(self): + if self.options.get_safe("with_arrow"): + self.requires("arrow/16.1.0") + self.requires("bshoshany-thread-pool/4.1.0") + self.requires("fast_float/6.1.1") + if self.options.with_eigen: + self.requires("eigen/3.4.0") + self.requires("fmt/10.2.1") + self.requires("hdf5/1.14.3") + self.requires("highfive/2.9.0") + self.requires("libdeflate/1.20") + self.requires("parallel-hashmap/1.3.12") # Note: v1.3.12 is more recent than v1.37 + self.requires("span-lite/0.11.0") + self.requires("spdlog/1.14.1") + self.requires("zstd/[>=1.5 <1.6]") + + if Version(self.version) == "0.0.3": + self.requires("xxhash/0.8.2") + + if Version(self.version) > "0.0.7": + self.requires("readerwriterqueue/1.0.6") + self.requires("concurrentqueue/1.0.4") + + 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._compilers_minimum_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." + ) + + def build_requirements(self): + self.tool_requires("cmake/[>=3.25 <4]") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["HICTK_BUILD_BENCHMARKS"] = "OFF" + tc.variables["HICTK_BUILD_EXAMPLES"] = "OFF" + tc.variables["HICTK_BUILD_TOOLS"] = "OFF" + tc.variables["HICTK_ENABLE_GIT_VERSION_TRACKING"] = "OFF" + tc.variables["HICTK_ENABLE_TESTING"] = "OFF" + tc.variables["HICTK_WITH_ARROW"] = self.options.get_safe("with_arrow", False) + tc.variables["HICTK_WITH_EIGEN"] = self.options.with_eigen + tc.generate() + + cmakedeps = CMakeDeps(self) + cmakedeps.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")) + rmdir(self, os.path.join(self.package_folder, "share")) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.set_property("cmake_file_name", "hictk") + self.cpp_info.set_property("cmake_target_name", "hictk::libhictk") + + if self.options.get_safe("with_arrow"): + self.cpp_info.defines.append("HICTK_WITH_ARROW") + if self.options.with_eigen: + self.cpp_info.defines.append("HICTK_WITH_EIGEN") diff --git a/recipes/hictk/all/test_package/CMakeLists.txt b/recipes/hictk/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..969fb76fe7be1 --- /dev/null +++ b/recipes/hictk/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package LANGUAGES CXX) + +find_package(hictk REQUIRED CONFIG) + +add_executable(${CMAKE_PROJECT_NAME} test_package.cpp) +target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE hictk::libhictk) +target_compile_features(${CMAKE_PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/hictk/all/test_package/conanfile.py b/recipes/hictk/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3bfefffc36b5c --- /dev/null +++ b/recipes/hictk/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 HictkTestConan(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/hictk/all/test_package/test_package.cpp b/recipes/hictk/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..30467b8f8512b --- /dev/null +++ b/recipes/hictk/all/test_package/test_package.cpp @@ -0,0 +1,13 @@ +#include + +#include "hictk/file.hpp" + + +int main(int argc, char** argv) { + try { + const hictk::File f(argv[0], 10); // This is expected to throw + return 1; + } catch (const std::exception& e) { + return 0; + } +} diff --git a/recipes/hictk/config.yml b/recipes/hictk/config.yml new file mode 100644 index 0000000000000..0ded733d49966 --- /dev/null +++ b/recipes/hictk/config.yml @@ -0,0 +1,17 @@ +versions: + "1.0.0": + folder: all + "0.0.12": + folder: all + "0.0.10": + folder: all + "0.0.9": + folder: all + "0.0.8": + folder: all + "0.0.3": + folder: all + "0.0.2": + folder: all + "0.0.1": + folder: all diff --git a/recipes/hidapi/all/conandata.yml b/recipes/hidapi/all/conandata.yml index 51d6d194c4062..a5b2b5c3f2c29 100644 --- a/recipes/hidapi/all/conandata.yml +++ b/recipes/hidapi/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "0.14.0": + url: "https://github.com/libusb/hidapi/archive/hidapi-0.14.0.tar.gz" + sha256: "a5714234abe6e1f53647dd8cba7d69f65f71c558b7896ed218864ffcf405bcbd" + "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 +15,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..893e57541d41c 100644 --- a/recipes/hidapi/all/conanfile.py +++ b/recipes/hidapi/all/conanfile.py @@ -1,9 +1,16 @@ -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.apple import is_apple_os +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 +32,110 @@ 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") + if self.settings.os == "Linux": + self.requires("libudev/system") 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"]: @@ -116,8 +146,12 @@ def package_info(self): self.cpp_info.components["hidraw"].set_property("pkg_config_name", "hidapi-hidraw") self.cpp_info.components["hidraw"].libs = ["hidapi-hidraw"] + if self.settings.os == "Linux": + self.cpp_info.components["hidraw"].requires = ["libudev::libudev"] self.cpp_info.components["hidraw"].system_libs = ["pthread", "dl"] else: self.cpp_info.libs = ["hidapi"] - if self.settings.os == "Macos": - self.cpp_info.frameworks.extend(["IOKit", "CoreFoundation", "Appkit"]) + if is_apple_os(self): + 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..9873ccd8c495b 100644 --- a/recipes/hidapi/config.yml +++ b/recipes/hidapi/config.yml @@ -1,4 +1,8 @@ versions: + "0.14.0": + folder: all + "0.13.1": + folder: all "0.12.0": folder: all "0.11.2": diff --git a/recipes/highfive/all/conandata.yml b/recipes/highfive/all/conandata.yml index 22d7539389bd7..b506775776cce 100644 --- a/recipes/highfive/all/conandata.yml +++ b/recipes/highfive/all/conandata.yml @@ -1,4 +1,19 @@ sources: + "2.10.0": + url: "https://github.com/BlueBrain/HighFive/archive/refs/tags/v2.10.0.tar.gz" + sha256: "c29e8e1520e7298fabb26545f804e35bb3af257005c1c2df62e39986458d7c38" + "2.9.0": + url: "https://github.com/BlueBrain/HighFive/archive/refs/tags/v2.9.0.tar.gz" + sha256: "6301def8ceb9f4d7a595988612db288b448a3c0546f6c83417dab38c64994d7e" + "2.8.0": + url: "https://github.com/BlueBrain/HighFive/archive/refs/tags/v2.8.0.tar.gz" + sha256: "cd2502cae61bfb00e32dd18c9dc75289e09ad1db5c2a46d3b0eefd32e0df983b" + "2.7.1": + url: "https://github.com/BlueBrain/HighFive/archive/refs/tags/v2.7.1.tar.gz" + sha256: "25b4c51a94d1e670dc93b9b73f51e79b65d8ff49bcd6e5d5582d5ecd2789a249" + "2.7.0": + url: "https://github.com/BlueBrain/HighFive/archive/refs/tags/v2.7.0.tar.gz" + sha256: "8e05672ddf81a59ce014b1d065bd9a8c5034dbd91a5c2578e805ef880afa5907" "2.6.2": url: "https://github.com/BlueBrain/HighFive/archive/refs/tags/v2.6.2.tar.gz" sha256: "ab51b9fbb49e877dd1aa7b53b4b26875f41e4e0b8ee0fc2f1d735e0d1e43d708" diff --git a/recipes/highfive/all/conanfile.py b/recipes/highfive/all/conanfile.py index 11ed9374f0a0a..b502330e87c37 100644 --- a/recipes/highfive/all/conanfile.py +++ b/recipes/highfive/all/conanfile.py @@ -2,65 +2,73 @@ 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 +from conan.tools.scm import Version import os import textwrap -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.54.0" class HighFiveConan(ConanFile): name = "highfive" description = "HighFive is a modern header-only C++11 friendly interface for libhdf5." - license = "Boost Software License 1.0" - topics = ("hdf5", "hdf", "data") - homepage = "https://github.com/BlueBrain/HighFive" + license = "BSL-1.0" url = "https://github.com/conan-io/conan-center-index" - + homepage = "https://github.com/BlueBrain/HighFive" + topics = ("hdf5", "hdf", "data", "header-only") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" options = { "with_boost": [True, False], "with_eigen": [True, False], "with_xtensor": [True, False], "with_opencv": [True, False], + "with_static_hdf5": ["deprecated", True, False], } default_options = { "with_boost": True, "with_eigen": True, "with_xtensor": True, "with_opencv": False, + "with_static_hdf5": "deprecated", } def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("hdf5/1.13.1") + if Version(self.version) < "2.5.1": + self.requires("hdf5/1.14.1") + else: + self.requires("hdf5/1.14.3") if self.options.with_boost: - self.requires("boost/1.80.0") + self.requires("boost/1.84.0") if self.options.with_eigen: self.requires("eigen/3.4.0") if self.options.with_xtensor: - self.requires("xtensor/0.24.2") + self.requires("xtensor/0.24.7") if self.options.with_opencv: - self.requires("opencv/4.5.5") + self.requires("opencv/4.8.1") def package_id(self): + # INFO: We only set different compiler definitions. The package content is the same. self.info.clear() def validate(self): if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, 11) + if self.options.with_static_hdf5 != "deprecated": + self.output.warning("The option 'with_static_hdf5' is deprecated. Use '-o hdf5/*:shared=True/False' instead.") 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["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.cache_variables["USE_BOOST"] = self.options.with_boost + tc.cache_variables["USE_EIGEN"] = self.options.with_eigen + tc.cache_variables["USE_XTENSOR"] = self.options.with_xtensor + tc.cache_variables["USE_OPENCV"] = self.options.with_opencv tc.variables["HIGHFIVE_UNIT_TESTS"] = False tc.variables["HIGHFIVE_EXAMPLES"] = False tc.variables["HIGHFIVE_BUILD_DOCS"] = False @@ -121,16 +129,19 @@ def package_info(self): 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") + self.cpp_info.defines.append("H5_USE_BOOST") if self.options.with_eigen: self.cpp_info.requires.append("eigen::eigen") + self.cpp_info.defines.append("H5_USE_EIGEN") if self.options.with_xtensor: self.cpp_info.requires.append("xtensor::xtensor") + self.cpp_info.defines.append("H5_USE_XTENSOR") if self.options.with_opencv: self.cpp_info.requires.append("opencv::opencv") + self.cpp_info.defines.append("H5_USE_OPENCV") # TODO: to remove in conan v2 once legacy generators removed self.cpp_info.names["cmake_find_package"] = "HighFive" diff --git a/recipes/highfive/all/test_v1_package/CMakeLists.txt b/recipes/highfive/all/test_v1_package/CMakeLists.txt index 671f071b8ed9f..b21cc49efde95 100644 --- a/recipes/highfive/all/test_v1_package/CMakeLists.txt +++ b/recipes/highfive/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.15) +project(test_package) 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) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/highfive/config.yml b/recipes/highfive/config.yml index 68e95d416e0fd..e2719579f8a54 100644 --- a/recipes/highfive/config.yml +++ b/recipes/highfive/config.yml @@ -1,4 +1,14 @@ versions: + "2.10.0": + folder: all + "2.9.0": + folder: all + "2.8.0": + folder: all + "2.7.1": + folder: all + "2.7.0": + folder: all "2.6.2": folder: all "2.5.1": diff --git a/recipes/highs/all/conandata.yml b/recipes/highs/all/conandata.yml new file mode 100644 index 0000000000000..05842bd3d81e0 --- /dev/null +++ b/recipes/highs/all/conandata.yml @@ -0,0 +1,19 @@ +sources: + "1.8.1": + url: "https://github.com/ERGO-Code/HiGHS/archive/refs/tags/v1.8.1.tar.gz" + sha256: "a0d09371fadb56489497996b28433be1ef91a705e3811fcb1f50a107c7d427d1" + "1.8.0": + url: "https://github.com/ERGO-Code/HiGHS/archive/refs/tags/v1.8.0.tar.gz" + sha256: "e184e63101cf19688a02102f58447acc7c021d77eef0d3475ceaceb61f035539" + "1.7.2": + url: "https://github.com/ERGO-Code/HiGHS/archive/refs/tags/v1.7.2.tar.gz" + sha256: "5ff96c14ae19592d3568e9ae107624cbaf3409d328fb1a586359f0adf9b34bf7" + "1.7.0": + url: "https://github.com/ERGO-Code/HiGHS/archive/refs/tags/v1.7.0.tar.gz" + sha256: "D10175AD66E7F113AC5DC00C9D6650A620663A6884FBF2942D6EB7A3D854604F" + "1.6.0": + url: "https://github.com/ERGO-Code/HiGHS/archive/refs/tags/v1.6.0.tar.gz" + sha256: "71962981566477c72c51b8b722c5df053d857b05b4f0e6869f455f657b3aa193" + "1.5.3": + url: "https://github.com/ERGO-Code/HiGHS/archive/refs/tags/v1.5.3.tar.gz" + sha256: "ce1a7d2f008e60cc69ab06f8b16831bd0fcd5f6002d3bbebae9d7a3513a1d01d" diff --git a/recipes/highs/all/conanfile.py b/recipes/highs/all/conanfile.py new file mode 100644 index 0000000000000..31a3a0427b60b --- /dev/null +++ b/recipes/highs/all/conanfile.py @@ -0,0 +1,78 @@ +import os + +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, rmdir + +required_conan_version = ">=1.54.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") + 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") + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires("zlib/[>=1.2.11 <2]") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["FAST_BUILD"] = True + tc.variables["BUILD_TESTING"] = False + tc.variables["PYTHON"] = False + tc.variables["FORTRAN"] = False + tc.variables["CSHARP"] = False + tc.variables["EXP"] = False + tc.variables["BUILD_EXAMPLES"] = False + tc.variables["JULIA"] = False + tc.generate() + deps = CMakeDeps(self) + deps.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")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "highs") + self.cpp_info.set_property("cmake_target_name", "highs::highs") + self.cpp_info.set_property("pkg_config_name", "highs") + self.cpp_info.libs = ["highs"] + self.cpp_info.includedirs = [os.path.join("include", "highs")] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["m", "pthread"]) diff --git a/recipes/highs/all/test_package/CMakeLists.txt b/recipes/highs/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..ef56bb8244acc --- /dev/null +++ b/recipes/highs/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(highs REQUIRED CONFIG) +add_executable(${PROJECT_NAME} main.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE highs::highs) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) 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/config.yml b/recipes/highs/config.yml new file mode 100644 index 0000000000000..4ca9835fcd719 --- /dev/null +++ b/recipes/highs/config.yml @@ -0,0 +1,13 @@ +versions: + "1.8.1": + folder: all + "1.8.0": + folder: all + "1.7.2": + folder: all + "1.7.0": + folder: all + "1.6.0": + folder: all + "1.5.3": + folder: all diff --git a/recipes/highway/all/conandata.yml b/recipes/highway/all/conandata.yml index 08bd07626134a..0d5218b55b50f 100644 --- a/recipes/highway/all/conandata.yml +++ b/recipes/highway/all/conandata.yml @@ -1,4 +1,25 @@ sources: + "1.2.0": + url: "https://github.com/google/highway/archive/1.2.0.tar.gz" + sha256: "7e0be78b8318e8bdbf6fa545d2ecb4c90f947df03f7aadc42c1967f019e63343" + "1.1.0": + url: "https://github.com/google/highway/archive/1.1.0.tar.gz" + sha256: "354a8b4539b588e70b98ec70844273e3f2741302c4c377bcc4e81b3d1866f7c9" + "1.0.7": + url: "https://github.com/google/highway/archive/1.0.7.tar.gz" + sha256: "5434488108186c170a5e2fca5e3c9b6ef59a1caa4d520b008a9b8be6b8abe6c5" + "1.0.6": + url: "https://github.com/google/highway/archive/1.0.6.tar.gz" + sha256: "d89664a045a41d822146e787bceeefbf648cc228ce354f347b18f2b419e57207" + "1.0.5": + url: "https://github.com/google/highway/archive/1.0.5.tar.gz" + sha256: "99b7dad98b8fa088673b720151458fae698ae5df9154016e39de4afdc23bb927" + "1.0.4": + url: "https://github.com/google/highway/archive/1.0.4.tar.gz" + sha256: "faccd343935c9e98afd1016e9d20e0b8b89d908508d1af958496f8c2d3004ac2" + "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" @@ -11,17 +32,12 @@ sources: "0.17.0": url: "https://github.com/google/highway/archive/0.17.0.tar.gz" sha256: "25158fd5c090b70ecea47fc246c860d150f07f801d2434e1e51ec14a6c15822c" - "0.16.0": - url: "https://github.com/google/highway/archive/0.16.0.tar.gz" - sha256: "746c9578446be6c5286e8846c5f0d4118c0c1f04219c401abadcb8a5f2051893" "0.12.2": url: "https://github.com/google/highway/archive/0.12.2.tar.gz" sha256: "e1d47ce510429fdcf31f41697ca74fb0dcd59d933196e531a86d51751a56f4cc" - "0.11.1": - url: "https://github.com/google/highway/archive/0.11.1.tar.gz" - sha256: "4c4bb9501c02b27a0944afde8923aaab554384690d37e5b2a7f97553426ea641" patches: - "0.16.0": - - patch_file: "patches/0.16.0-0001-fix-sys-random-h.patch" - "0.11.1": - - patch_file: "patches/0.11.1-0001-remove-contrib.patch" + "1.2.0": + - patch_file: "patches/1.2.0-0001-fix-dllexport.patch" + patch_description: "fix incorrect DLLEXPORT" + patch_type: "backport" + patch_source: "https://github.com/google/highway/pull/2229" diff --git a/recipes/highway/all/conanfile.py b/recipes/highway/all/conanfile.py index a659244ef92cd..70b41b9d07eb4 100644 --- a/recipes/highway/all/conanfile.py +++ b/recipes/highway/all/conanfile.py @@ -6,30 +6,32 @@ from conan.tools.scm import Version import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.54.0" class HighwayConan(ConanFile): name = "highway" - description = "Performance-portable, length-agnostic SIMD with runtime " \ - "dispatch" - topics = ("highway", "simd") + description = "Performance-portable, length-agnostic SIMD with runtime dispatch" license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/google/highway" + topics = ("simd", "neon", "avx", "sse",) + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], + "with_test": [True, False], } default_options = { "shared": False, "fPIC": True, + "with_test": False, } @property - def _minimum_cpp_standard(self): - return 11 + def _min_cppstd(self): + return "11" @property def _minimum_compilers_version(self): @@ -50,34 +52,32 @@ def config_options(self): def configure(self): if Version(self.version) < "0.16.0": del self.options.shared + self.package_type = "static-library" elif self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") + if Version(self.version) < "1.0.6": + del self.options.with_test 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._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: + 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._minimum_cpp_standard}, 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) + get(self, **self.conan_data["sources"][self.version], 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.variables["HWY_ENABLE_TESTS"] = self.options.get_safe("with_test", False) tc.generate() def _patch_sources(self): @@ -100,6 +100,7 @@ def package(self): 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")) def package_info(self): self.cpp_info.components["hwy"].set_property("pkg_config_name", "libhwy") @@ -112,7 +113,10 @@ def package_info(self): 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": + if "0.15.0" <= Version(self.version) < "1.0.6" or (Version(self.version) >= "1.0.6" and self.options.with_test): 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/patches/0.11.1-0001-remove-contrib.patch b/recipes/highway/all/patches/0.11.1-0001-remove-contrib.patch deleted file mode 100644 index e409cd92d3227..0000000000000 --- a/recipes/highway/all/patches/0.11.1-0001-remove-contrib.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -52,9 +52,6 @@ check_cxx_source_compiles( - ) - - set(HWY_SOURCES -- contrib/image/image.cc -- contrib/image/image.h -- contrib/math/math-inl.h - hwy/aligned_allocator.cc - hwy/aligned_allocator.h - hwy/base.h diff --git a/recipes/highway/all/patches/0.16.0-0001-fix-sys-random-h.patch b/recipes/highway/all/patches/0.16.0-0001-fix-sys-random-h.patch deleted file mode 100644 index aee3b37dc1e43..0000000000000 --- a/recipes/highway/all/patches/0.16.0-0001-fix-sys-random-h.patch +++ /dev/null @@ -1,50 +0,0 @@ -diff --git a/hwy/contrib/sort/vqsort.cc b/hwy/contrib/sort/vqsort.cc -index 951a0bd..2009da8 100644 ---- a/hwy/contrib/sort/vqsort.cc -+++ b/hwy/contrib/sort/vqsort.cc -@@ -25,12 +25,43 @@ - // After foreach_target - #include "hwy/contrib/sort/shared-inl.h" - -+// Check if we have sys/random.h. First skip some systems on which the check -+// itself (features.h) might be problematic. -+#if defined(ANDROID) || defined(__ANDROID__) || HWY_ARCH_RVV -+#define VQSORT_GETRANDOM 0 -+#endif -+ -+#if !defined(VQSORT_GETRANDOM) && (defined(linux) || defined(__linux__)) -+#include -+ -+// ---- which libc -+#if defined(__UCLIBC__) -+#define VQSORT_GETRANDOM 1 // added Mar 2015, before uclibc-ng 1.0 -+ -+#elif defined(__GLIBC__) && defined(__GLIBC_PREREQ) -+#if __GLIBC_PREREQ(2, 25) -+#define VQSORT_GETRANDOM 1 -+#else -+#define VQSORT_GETRANDOM 0 -+#endif -+ -+#else -+// Assume MUSL, which has getrandom since 2018. There is no macro to test, see -+// https://www.openwall.com/lists/musl/2013/03/29/13. -+#define VQSORT_GETRANDOM 1 -+ -+#endif // ---- which libc -+#endif // linux -+ -+#if !defined(VQSORT_GETRANDOM) -+#define VQSORT_GETRANDOM 0 -+#endif -+ - // Seed source for SFC generator: 1=getrandom, 2=CryptGenRandom - // (not all Android support the getrandom wrapper) - #ifndef VQSORT_SECURE_SEED - --#if (defined(linux) || defined(__linux__)) && \ -- !(defined(ANDROID) || defined(__ANDROID__) || HWY_ARCH_RVV) -+#if VQSORT_GETRANDOM - #define VQSORT_SECURE_SEED 1 - #elif defined(_WIN32) || defined(_WIN64) - #define VQSORT_SECURE_SEED 2 diff --git a/recipes/highway/all/patches/1.2.0-0001-fix-dllexport.patch b/recipes/highway/all/patches/1.2.0-0001-fix-dllexport.patch new file mode 100644 index 0000000000000..30ecee4740bdb --- /dev/null +++ b/recipes/highway/all/patches/1.2.0-0001-fix-dllexport.patch @@ -0,0 +1,91 @@ +diff --git a/hwy/contrib/thread_pool/topology.cc b/hwy/contrib/thread_pool/topology.cc +index 3d24f4f..17f3563 100644 +--- a/hwy/contrib/thread_pool/topology.cc ++++ b/hwy/contrib/thread_pool/topology.cc +@@ -64,7 +64,7 @@ + + namespace hwy { + +-HWY_DLLEXPORT bool HaveThreadingSupport() { ++HWY_CONTRIB_DLLEXPORT bool HaveThreadingSupport() { + #if HWY_ARCH_WASM + return emscripten_has_threading_support() != 0; + #else +@@ -72,7 +72,7 @@ HWY_DLLEXPORT bool HaveThreadingSupport() { + #endif + } + +-HWY_DLLEXPORT size_t TotalLogicalProcessors() { ++HWY_CONTRIB_DLLEXPORT size_t TotalLogicalProcessors() { + size_t lp = 0; + #if HWY_ARCH_WASM + const int num_cores = emscripten_num_logical_cores(); +@@ -111,7 +111,7 @@ HWY_DLLEXPORT size_t TotalLogicalProcessors() { + #include + #endif + +-HWY_DLLEXPORT bool GetThreadAffinity(LogicalProcessorSet& lps) { ++HWY_CONTRIB_DLLEXPORT bool GetThreadAffinity(LogicalProcessorSet& lps) { + #if HWY_OS_WIN + // Only support the first 64 because WINE does not support processor groups. + const HANDLE hThread = GetCurrentThread(); +@@ -173,7 +173,7 @@ HWY_DLLEXPORT bool GetThreadAffinity(LogicalProcessorSet& lps) { + #endif + } + +-HWY_DLLEXPORT bool SetThreadAffinity(const LogicalProcessorSet& lps) { ++HWY_CONTRIB_DLLEXPORT bool SetThreadAffinity(const LogicalProcessorSet& lps) { + #if HWY_OS_WIN + const HANDLE hThread = GetCurrentThread(); + const DWORD_PTR prev = SetThreadAffinityMask(hThread, lps.Get64()); +@@ -385,7 +385,7 @@ std::vector DetectPackages(std::vector& lps) { + } // namespace + #endif // HWY_OS_LINUX + +-HWY_DLLEXPORT Topology::Topology() { ++HWY_CONTRIB_DLLEXPORT Topology::Topology() { + #if HWY_OS_LINUX + lps.resize(TotalLogicalProcessors()); + const std::vector& per_package = DetectPackages(lps); +diff --git a/hwy/contrib/thread_pool/topology.h b/hwy/contrib/thread_pool/topology.h +index 95b0835..f80fc47 100644 +--- a/hwy/contrib/thread_pool/topology.h ++++ b/hwy/contrib/thread_pool/topology.h +@@ -28,7 +28,7 @@ + namespace hwy { + + // Returns false if std::thread should not be used. +-HWY_DLLEXPORT bool HaveThreadingSupport(); ++HWY_CONTRIB_DLLEXPORT bool HaveThreadingSupport(); + + // Upper bound on logical processors, including hyperthreads. + static constexpr size_t kMaxLogicalProcessors = 1024; // matches glibc +@@ -38,12 +38,12 @@ using LogicalProcessorSet = BitSet4096; + + // Returns false, or sets `lps` to all logical processors which are online and + // available to the current thread. +-HWY_DLLEXPORT bool GetThreadAffinity(LogicalProcessorSet& lps); ++HWY_CONTRIB_DLLEXPORT bool GetThreadAffinity(LogicalProcessorSet& lps); + + // Ensures the current thread can only run on the logical processors in `lps`. + // Returns false if not supported (in particular on Apple), or if the + // intersection between `lps` and `GetThreadAffinity` is the empty set. +-HWY_DLLEXPORT bool SetThreadAffinity(const LogicalProcessorSet& lps); ++HWY_CONTRIB_DLLEXPORT bool SetThreadAffinity(const LogicalProcessorSet& lps); + + // Returns false, or ensures the current thread will only run on `lp`, which + // must not exceed `TotalLogicalProcessors`. Note that this merely calls +@@ -58,11 +58,11 @@ static inline bool PinThreadToLogicalProcessor(size_t lp) { + // provided by the hardware clamped to `kMaxLogicalProcessors`. + // These processors are not necessarily all usable; you can determine which are + // via GetThreadAffinity(). +-HWY_DLLEXPORT size_t TotalLogicalProcessors(); ++HWY_CONTRIB_DLLEXPORT size_t TotalLogicalProcessors(); + + struct Topology { + // Caller must check packages.empty(); if so, do not use any fields. +- HWY_DLLEXPORT Topology(); ++ HWY_CONTRIB_DLLEXPORT Topology(); + + // Clique of cores with lower latency to each other. On Apple M1 these are + // four cores sharing an L2. On Zen4 these 'CCX' are up to eight cores sharing diff --git a/recipes/highway/config.yml b/recipes/highway/config.yml index a34a1de737c39..a5864ae8e0682 100644 --- a/recipes/highway/config.yml +++ b/recipes/highway/config.yml @@ -1,4 +1,18 @@ versions: + "1.2.0": + folder: all + "1.1.0": + folder: all + "1.0.7": + folder: all + "1.0.6": + folder: all + "1.0.5": + folder: all + "1.0.4": + folder: all + "1.0.3": + folder: all "1.0.2": folder: all "1.0.1": @@ -7,9 +21,5 @@ versions: folder: all "0.17.0": folder: all - "0.16.0": - folder: all "0.12.2": folder: all - "0.11.1": - folder: all diff --git a/recipes/hipony-enumerate/all/CMakeLists.txt b/recipes/hipony-enumerate/all/CMakeLists.txt deleted file mode 100644 index 4beb13671fe5e..0000000000000 --- a/recipes/hipony-enumerate/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8) -project(cmake_wrapper) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/hipony-enumerate/all/conanfile.py b/recipes/hipony-enumerate/all/conanfile.py index d007bd9aa0946..d73933d9969a3 100644 --- a/recipes/hipony-enumerate/all/conanfile.py +++ b/recipes/hipony-enumerate/all/conanfile.py @@ -1,9 +1,12 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -import functools import os -required_conan_version = ">=1.43.0" +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, rmdir +from conan.tools.build import check_min_cppstd + +required_conan_version = ">=1.53.0" class HiponyEnumerateConan(ConanFile): @@ -15,6 +18,7 @@ class HiponyEnumerateConan(ConanFile): topics = ("enumerate", "header-only", "cpp", "constexpr", "cpp17", "cpp11", "tuples") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" options = { "aggregates": [True, False], @@ -23,19 +27,14 @@ class HiponyEnumerateConan(ConanFile): "aggregates": False, } - generators = "cmake", "cmake_find_package_multi" no_copy_source = True - exports_sources = ["CMakeLists.txt"] - - @property - def _source_subfolder(self): - return "source_subfolder" @property def _compilers_minimum_version(self): return { "gcc": "8" if self.options.aggregates else "6", "Visual Studio": "16" if self.options.aggregates else "14", + "msvc": "192" if self.options.aggregates else "190", "clang": "5.0" if self.options.aggregates else "3.9", "apple-clang": "10", } @@ -44,17 +43,19 @@ def _compilers_minimum_version(self): def _minimum_standard(self): return "17" if self.options.aggregates else "11" + def layout(self): + cmake_layout(self, src_folder="src") + def requirements(self): if self.options.aggregates: self.requires("pfr/2.0.3") 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, self._minimum_standard) + check_min_cppstd(self, self._minimum_standard) def lazy_lt_semver(v1, v2): lv1 = [int(v) for v in v1.split(".")] @@ -65,7 +66,7 @@ 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( + self.output.warning( "{0} {1} requires C++{2}. Your compiler is unknown. Assuming it supports C++{2}." .format(self.name, self.version, self._minimum_standard)) elif lazy_lt_semver(str(self.settings.compiler.version), minimum_version): @@ -74,36 +75,36 @@ def lazy_lt_semver(v1, v2): .format(self.name, self.version, self._minimum_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) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["BUILD_TESTING"] = "OFF" - cmake.definitions["HIPONY_ENUMERATE_AGGREGATES_ENABLED"] = self.options.aggregates - cmake.configure() - return cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTING"] = "OFF" + tc.variables["HIPONY_ENUMERATE_AGGREGATES_ENABLED"] = self.options.aggregates + 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.configure() 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", "hipony-enumerate") self.cpp_info.set_property("cmake_target_name", "hipony::enumerate") - # TODO: back to global scope in conan v2 once cmake_find_package_* generators removed if self.options.aggregates: self.cpp_info.components["enumerate"].defines.append( "HIPONY_ENUMERATE_AGGREGATES_ENABLED") - # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.filenames["cmake_find_package"] = "hipony-enumerate" self.cpp_info.filenames["cmake_find_package_multi"] = "hipony-enumerate" diff --git a/recipes/hipony-enumerate/all/test_package/CMakeLists.txt b/recipes/hipony-enumerate/all/test_package/CMakeLists.txt index a77fd26125266..b8ca205c62256 100644 --- a/recipes/hipony-enumerate/all/test_package/CMakeLists.txt +++ b/recipes/hipony-enumerate/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(hipony-enumerate REQUIRED CONFIG) diff --git a/recipes/hipony-enumerate/all/test_package/conanfile.py b/recipes/hipony-enumerate/all/test_package/conanfile.py index 38f4483872d47..58ea4a29517f7 100644 --- a/recipes/hipony-enumerate/all/test_package/conanfile.py +++ b/recipes/hipony-enumerate/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" + 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/hipony-enumerate/all/test_v1_package/CMakeLists.txt b/recipes/hipony-enumerate/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/hipony-enumerate/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/hipony-enumerate/all/test_v1_package/conanfile.py b/recipes/hipony-enumerate/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/hipony-enumerate/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/hippomocks/all/conanfile.py b/recipes/hippomocks/all/conanfile.py index 313e2b97cc5a4..8ecc6faeb6ba7 100755 --- a/recipes/hippomocks/all/conanfile.py +++ b/recipes/hippomocks/all/conanfile.py @@ -1,28 +1,54 @@ -from conans import ConanFile, ConanFile, tools -import os, glob +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 + +required_conan_version = ">=1.52.0" + class HippomocksConan(ConanFile): - name = 'hippomocks' - _libname = 'HippoMocks' - description = 'Single-header mocking framework.' - topics = ("conan", "hippomocks", "mock", "framework") + name = "hippomocks" + description = "Single-header mocking framework." + license = "LGPL-2.1" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/dascandy/hippomocks" - license = 'LGPL-2.1' + topics = ("mock", "framework", "header-only") + + package_type = "header-library" + 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.cppstd: + check_min_cppstd(self, self._min_cppstd) def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = glob.glob("%s-*" % (self.name))[0] - os.rename(extracted_dir, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + @property + def _libname(self): + return "HippoMocks" def package(self): - self.copy('LICENSE', dst='licenses', src=self._source_subfolder) - self.copy('*.h', dst=os.path.join('include', self._libname), src=os.path.join(self._source_subfolder, self._libname)) + copy(self, "LICENSE", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder) + copy(self, "*.h", + dst=os.path.join(self.package_folder, "include", self._libname), + src=os.path.join(self.source_folder, self._libname)) - def package_id(self): - self.info.header_only() + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/hippomocks/all/test_package/CMakeLists.txt b/recipes/hippomocks/all/test_package/CMakeLists.txt index aff8268476df7..2e78c73ea8082 100755 --- a/recipes/hippomocks/all/test_package/CMakeLists.txt +++ b/recipes/hippomocks/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(hippomocks REQUIRED) +find_package(hippomocks REQUIRED CONFIG) add_executable(${PROJECT_NAME} main.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE hippomocks::hippomocks) diff --git a/recipes/hippomocks/all/test_package/conanfile.py b/recipes/hippomocks/all/test_package/conanfile.py index e065617c053bc..ef5d7042163ec 100755 --- a/recipes/hippomocks/all/test_package/conanfile.py +++ b/recipes/hippomocks/all/test_package/conanfile.py @@ -1,16 +1,26 @@ -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 + 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) 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/hippomocks/all/test_package/main.cpp b/recipes/hippomocks/all/test_package/main.cpp old mode 100755 new mode 100644 diff --git a/recipes/hippomocks/all/test_v1_package/CMakeLists.txt b/recipes/hippomocks/all/test_v1_package/CMakeLists.txt new file mode 100755 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/hippomocks/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/hippomocks/all/test_v1_package/conanfile.py b/recipes/hippomocks/all/test_v1_package/conanfile.py new file mode 100755 index 0000000000000..121b7b9615044 --- /dev/null +++ b/recipes/hippomocks/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_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/hiredis/0.x.x/conandata.yml b/recipes/hiredis/0.x.x/conandata.yml deleted file mode 100644 index 0b74d88eff05f..0000000000000 --- a/recipes/hiredis/0.x.x/conandata.yml +++ /dev/null @@ -1,8 +0,0 @@ -sources: - "0.14.1": - url: "https://github.com/redis/hiredis/archive/v0.14.1.tar.gz" - sha256: "2663b2aed9fd430507e30fc5e63274ee40cdd1a296026e22eafd7d99b01c8913" -patches: - "0.14.1": - - patch_file: "patches/0001-fix-makefile.patch" - base_path: "source_subfolder" diff --git a/recipes/hiredis/0.x.x/conanfile.py b/recipes/hiredis/0.x.x/conanfile.py deleted file mode 100644 index f94cea21a0db9..0000000000000 --- a/recipes/hiredis/0.x.x/conanfile.py +++ /dev/null @@ -1,78 +0,0 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, tools -from conans.errors import ConanInvalidConfiguration -import os - -required_conan_version = ">=1.36.0" - - -class HiredisConan(ConanFile): - name = "hiredis" - description = "Hiredis is a minimalistic C client library for the Redis database." - license = "BSD-3-Clause" - topics = ("hiredis", "redis", "client", "database") - homepage = "https://github.com/redis/hiredis" - 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 _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"]) - - def configure(self): - if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx - - def validate(self): - if self.settings.os == "Windows": - raise ConanInvalidConfiguration("hiredis {} is not supported on Windows.".format(self.version)) - - 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) - # Do not force PIC if static - if not self.options.shared: - makefile = os.path.join(self._source_subfolder, "Makefile") - tools.replace_in_file(makefile, "-fPIC ", "") - - def build(self): - self._patch_sources() - with tools.chdir(self._source_subfolder): - autoTools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - autoTools.make() - - def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - with tools.chdir(self._source_subfolder): - autoTools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - autoTools.install(vars={ - "DESTDIR": tools.unix_path(self.package_folder), - "PREFIX": "", - }) - tools.remove_files_by_mask( - os.path.join(self.package_folder, "lib"), - "*.a" if self.options.shared else "*.[so|dylib]*", - ) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - - def package_info(self): - self.cpp_info.set_property("pkg_config_name", "hiredis") - self.cpp_info.libs = ["hiredis"] diff --git a/recipes/hiredis/0.x.x/patches/0001-fix-makefile.patch b/recipes/hiredis/0.x.x/patches/0001-fix-makefile.patch deleted file mode 100644 index 52271f0ac9947..0000000000000 --- a/recipes/hiredis/0.x.x/patches/0001-fix-makefile.patch +++ /dev/null @@ -1,42 +0,0 @@ ---- a/Makefile_old -+++ b/Makefile -@@ -38,10 +38,8 @@ export REDIS_TEST_CONFIG - # Fallback to gcc when $CC is not in $PATH. - CC:=$(shell sh -c 'type $${CC%% *} >/dev/null 2>/dev/null && echo $(CC) || echo gcc') - CXX:=$(shell sh -c 'type $${CXX%% *} >/dev/null 2>/dev/null && echo $(CXX) || echo g++') --OPTIMIZATION?=-O3 - WARNINGS=-Wall -W -Wstrict-prototypes -Wwrite-strings --DEBUG_FLAGS?= -g -ggdb --REAL_CFLAGS=$(OPTIMIZATION) -fPIC $(CFLAGS) $(WARNINGS) $(DEBUG_FLAGS) -+REAL_CFLAGS=-fPIC $(CFLAGS) $(WARNINGS) - REAL_LDFLAGS=$(LDFLAGS) - - DYLIBSUFFIX=so -@@ -49,7 +47,7 @@ STLIBSUFFIX=a - DYLIB_MINOR_NAME=$(LIBNAME).$(DYLIBSUFFIX).$(HIREDIS_SONAME) - DYLIB_MAJOR_NAME=$(LIBNAME).$(DYLIBSUFFIX).$(HIREDIS_MAJOR) - DYLIBNAME=$(LIBNAME).$(DYLIBSUFFIX) --DYLIB_MAKE_CMD=$(CC) -shared -Wl,-soname,$(DYLIB_MINOR_NAME) -o $(DYLIBNAME) $(LDFLAGS) -+DYLIB_MAKE_CMD=$(CC) -shared -Wl,-soname,$(DYLIB_MINOR_NAME) -o $(DYLIBNAME) $(CFLAGS) $(LDFLAGS) - STLIBNAME=$(LIBNAME).$(STLIBSUFFIX) - STLIB_MAKE_CMD=ar rcs $(STLIBNAME) - -@@ -57,15 +55,15 @@ STLIB_MAKE_CMD=ar rcs $(STLIBNAME) - uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not') - ifeq ($(uname_S),SunOS) - REAL_LDFLAGS+= -ldl -lnsl -lsocket -- DYLIB_MAKE_CMD=$(CC) -G -o $(DYLIBNAME) -h $(DYLIB_MINOR_NAME) $(LDFLAGS) -+ DYLIB_MAKE_CMD=$(CC) -G -o $(DYLIBNAME) -h $(DYLIB_MINOR_NAME) $(CFLAGS) $(LDFLAGS) - endif - ifeq ($(uname_S),Darwin) - DYLIBSUFFIX=dylib - DYLIB_MINOR_NAME=$(LIBNAME).$(HIREDIS_SONAME).$(DYLIBSUFFIX) -- DYLIB_MAKE_CMD=$(CC) -dynamiclib -Wl,-install_name,$(PREFIX)/$(LIBRARY_PATH)/$(DYLIB_MINOR_NAME) -o $(DYLIBNAME) $(LDFLAGS) -+ DYLIB_MAKE_CMD=$(CC) -dynamiclib -Wl,-install_name,$(PREFIX)/$(LIBRARY_PATH)/$(DYLIB_MINOR_NAME) -o $(DYLIBNAME) $(CFLAGS) $(LDFLAGS) - endif - --all: $(DYLIBNAME) $(STLIBNAME) hiredis-test $(PKGCONFNAME) -+all: $(DYLIBNAME) $(STLIBNAME) $(PKGCONFNAME) - - # Deps (use make dep to generate this) - alloc.o: alloc.c fmacros.h alloc.h diff --git a/recipes/hiredis/0.x.x/test_package/conanfile.py b/recipes/hiredis/0.x.x/test_package/conanfile.py deleted file mode 100644 index 5c09494bc67c0..0000000000000 --- a/recipes/hiredis/0.x.x/test_package/conanfile.py +++ /dev/null @@ -1,17 +0,0 @@ -from conans import ConanFile, CMake, tools -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 tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) diff --git a/recipes/hiredis/0.x.x/test_package/test_package.c b/recipes/hiredis/0.x.x/test_package/test_package.c deleted file mode 100644 index 6df475bd4539a..0000000000000 --- a/recipes/hiredis/0.x.x/test_package/test_package.c +++ /dev/null @@ -1,21 +0,0 @@ -#include - -#include -#include - -int main() -{ - printf("hiredis version: %i.%i.%i\n", HIREDIS_MAJOR, HIREDIS_MINOR, HIREDIS_PATCH); - - const char *hostname = "127.0.0.1"; - int port = 6379; - - redisContext *c = redisConnect(hostname, port); - if (c == NULL) - { - printf("Error: Can't allocate redis context\n"); - return EXIT_FAILURE; - } - - return EXIT_SUCCESS; -} diff --git a/recipes/hiredis/all/conandata.yml b/recipes/hiredis/all/conandata.yml index 2063383701218..780975d1b5665 100644 --- a/recipes/hiredis/all/conandata.yml +++ b/recipes/hiredis/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.2.0": + url: "https://github.com/redis/hiredis/archive/v1.2.0.tar.gz" + sha256: "82ad632d31ee05da13b537c124f819eb88e18851d9cb0c30ae0552084811588c" "1.1.0": url: "https://github.com/redis/hiredis/archive/v1.1.0.tar.gz" sha256: "fe6d21741ec7f3fc9df409d921f47dfc73a4d8ff64f4ac6f1d95f951bf7f53d6" @@ -9,6 +12,10 @@ sources: url: "https://github.com/redis/hiredis/archive/v1.0.0.tar.gz" sha256: "2a0b5fe5119ec973a0c1966bfc4bd7ed39dbce1cb6d749064af9121fe971936f" patches: + "1.2.0": + - patch_file: "patches/0002-fix-aix.patch" + patch_description: "support AIX build" + patch_type: "portability" "1.1.0": - patch_file: "patches/0001-fix-cmake-1.1.0.patch" patch_description: "divide static/shared build, fix openssl link name" diff --git a/recipes/hiredis/all/conanfile.py b/recipes/hiredis/all/conanfile.py index 40c8d8d1f2a2e..f81b8f52adbcd 100644 --- a/recipes/hiredis/all/conanfile.py +++ b/recipes/hiredis/all/conanfile.py @@ -1,11 +1,11 @@ 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.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, rm from conan.tools.scm import Version from conan.tools.microsoft import is_msvc import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class HiredisConan(ConanFile): @@ -15,7 +15,7 @@ class HiredisConan(ConanFile): topics = ("hiredis", "redis", "client", "database") homepage = "https://github.com/redis/hiredis" url = "https://github.com/conan-io/conan-center-index" - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -37,35 +37,28 @@ def config_options(self): 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 + 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") def requirements(self): if self.options.with_ssl: - self.requires("openssl/1.1.1s") + self.requires("openssl/[>=1.1 <4]") 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["ENABLE_SSL"] = self.options.with_ssl - tc.variables["DISABLE_TESTS"] = True - tc.variables["ENABLE_EXAMPLES"] = False + # Since 1.2.0, BUILD_SHARED_LIBS has been defined by option() + if Version(self.version) >= "1.2.0": + tc.cache_variables["BUILD_SHARED_LIBS"] = self.options.shared + tc.cache_variables["ENABLE_SSL"] = self.options.with_ssl + tc.cache_variables["DISABLE_TESTS"] = True + tc.cache_variables["ENABLE_EXAMPLES"] = False tc.generate() deps = CMakeDeps(self) deps.generate() @@ -84,15 +77,16 @@ def package(self): 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")) + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) 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: + if is_msvc(self) and not self.options.shared and Version(self.version) < "1.2.0": suffix += "_static" - if self.info.settings.build_type == "Debug": + if self.settings.build_type == "Debug": suffix += "d" # hiredis diff --git a/recipes/hiredis/config.yml b/recipes/hiredis/config.yml index b06a4f7517eb0..977ca3a028023 100644 --- a/recipes/hiredis/config.yml +++ b/recipes/hiredis/config.yml @@ -1,9 +1,9 @@ versions: + "1.2.0": + folder: all "1.1.0": folder: all "1.0.2": folder: all "1.0.0": folder: all - "0.14.1": - folder: "0.x.x" diff --git a/recipes/hlslpp/all/conandata.yml b/recipes/hlslpp/all/conandata.yml index 41a6668e87c71..213b230fcc1d6 100644 --- a/recipes/hlslpp/all/conandata.yml +++ b/recipes/hlslpp/all/conandata.yml @@ -1,10 +1,10 @@ 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" + "3.3.1": + url: "https://github.com/redorav/hlslpp/archive/3.3.1.tar.gz" + sha256: "0756161beb8dd9eae377dc11e933d045618fea7ac93674f60eb8cffc04080499" + "3.2.3": + url: "https://github.com/redorav/hlslpp/archive/refs/tags/3.2.3.tar.gz" + sha256: "132149d25306cdc56a87c1d6a4a93d3200de4864b5d27d758d235ce4ace64498" "3.1": url: "https://github.com/redorav/hlslpp/archive/refs/tags/3.1.tar.gz" sha256: "6f933e43bf8150a41d76a188377e59007897dc87e96be30608e7f2007605d5c4" diff --git a/recipes/hlslpp/all/conanfile.py b/recipes/hlslpp/all/conanfile.py index d8ccb3fef6db2..89394902b2939 100644 --- a/recipes/hlslpp/all/conanfile.py +++ b/recipes/hlslpp/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" @@ -14,9 +16,18 @@ class HlslppConan(ConanFile): license = "MIT" homepage = "https://github.com/redorav/hlslpp" 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 _min_cppstd(self): + return 11 + + @property + def _compilers_minimum_version(self): + return {"gcc": "6"} if Version(self.version) >= "3.3" else {} + def layout(self): basic_layout(self, src_folder="src") @@ -25,11 +36,15 @@ 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 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 diff --git a/recipes/hlslpp/config.yml b/recipes/hlslpp/config.yml index 199b902f23539..6f4aad719df58 100644 --- a/recipes/hlslpp/config.yml +++ b/recipes/hlslpp/config.yml @@ -1,7 +1,7 @@ versions: - "3.2.2": + "3.3.1": folder: all - "3.2": + "3.2.3": folder: all "3.1": folder: all diff --git a/recipes/homog2d/all/conandata.yml b/recipes/homog2d/all/conandata.yml index 9703143edc4f0..f297bf870a626 100644 --- a/recipes/homog2d/all/conandata.yml +++ b/recipes/homog2d/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "2.11": + url: "https://github.com/skramm/homog2d/archive/refs/tags/v2.11.tar.gz" + sha256: "469a557b87f3285170d84eb06d9b23c6b422f01b17eb753819bfc488d59bf83a" + "2.10": + url: "https://github.com/skramm/homog2d/archive/refs/tags/v2.10.tar.gz" + sha256: "fb71f709d78c386188894b7f08a2c4690b45a5695b8d988e24efbe1216c53052" "2.9": url: "https://github.com/skramm/homog2d/archive/refs/tags/v2.9.tar.gz" sha256: "7784237154fd0c1beea5b1ed4349e910ce86ad463d21f4f21019f553834c1dad" @@ -11,3 +17,7 @@ patches: - 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 index 389de93f97426..ba7c79a56f0f0 100644 --- a/recipes/homog2d/all/conanfile.py +++ b/recipes/homog2d/all/conanfile.py @@ -4,13 +4,10 @@ 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." @@ -18,8 +15,8 @@ class Homog2dConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/skramm/homog2d" topics = ("computational-geometry", "homography", "2d-geometric", "header-only") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" - no_copy_source = True @property def _min_cppstd(self): @@ -28,9 +25,11 @@ def _min_cppstd(self): @property def _compilers_minimum_version(self): return { - "gcc": "5", + "gcc": "6", "clang": "5", - "apple-clang": "5.1", + "apple-clang": "10", + "Visual Studio": "15", + "msvc": "191", } def export_sources(self): @@ -45,16 +44,14 @@ def package_id(self): 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." - ) + 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def build(self): apply_conandata_patches(self) diff --git a/recipes/homog2d/all/patches/0002-pretty_function-for-msvc.patch b/recipes/homog2d/all/patches/0002-pretty_function-for-msvc.patch index ea9cad9d77946..5b68d2eeb13ec 100644 --- a/recipes/homog2d/all/patches/0002-pretty_function-for-msvc.patch +++ b/recipes/homog2d/all/patches/0002-pretty_function-for-msvc.patch @@ -1,5 +1,5 @@ diff --git a/homog2d.hpp b/homog2d.hpp -index f30d150..68bc280 100644 +index f30d150..d82d7e5 100644 --- a/homog2d.hpp +++ b/homog2d.hpp @@ -115,12 +115,18 @@ See https://github.com/skramm/homog2d @@ -31,15 +31,3 @@ index f30d150..68bc280 100644 << "\n -Error count=" << ++errorCount(); \ throw std::runtime_error( oss.str() ); \ } -@@ -2914,11 +2920,6 @@ private: - h2d::operator * ( const h2d::Point2d_&, const h2d::Point2d_& ) - -> h2d::Line2d_; - -- template -- friend auto -- h2d::operator * ( const h2d::Homogr_&, const h2d::Line2d_& ) -- -> h2d::Line2d_; -- - template - friend base::LPBase - detail::crossProduct( const base::LPBase&, const base::LPBase& ); 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/config.yml b/recipes/homog2d/config.yml index 15e714af2f48e..37be65648ed14 100644 --- a/recipes/homog2d/config.yml +++ b/recipes/homog2d/config.yml @@ -1,3 +1,7 @@ versions: + "2.11": + folder: all + "2.10": + folder: all "2.9": folder: all diff --git a/recipes/http_parser/all/conanfile.py b/recipes/http_parser/all/conanfile.py index e764d7f53939c..0223cb4a807aa 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): @@ -13,7 +13,7 @@ class HttpParserConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/nodejs/http-parser" license = "MIT" - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -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/huffman/all/conandata.yml b/recipes/huffman/all/conandata.yml index 25d1ea6cda398..cb51aa08c2967 100644 --- a/recipes/huffman/all/conandata.yml +++ b/recipes/huffman/all/conandata.yml @@ -3,13 +3,3 @@ sources: # Don't use tar.gz because test data files in tar.gz has invalid paths on Windows. url: "https://github.com/drichardson/huffman/archive/refs/tags/v1.2.7.zip" sha256: "0d382f271daf47623676307710cb05d246839247370989b8ffa6fee82bea375a" - "1.2.2": - url: "https://github.com/drichardson/huffman/archive/refs/tags/v1.2.2.zip" - sha256: "7968728c4a0e2705575e9f03e0252cb5195919756d3a64343255f518548cb533" -patches: - "1.2.7": - - patch_file: "patches/1.2.7-0001-use-_WIN32.patch" - base_path: "source_subfolder" - "1.2.2": - - patch_file: "patches/1.2.2-0001-use-_WIN32.patch" - base_path: "source_subfolder" diff --git a/recipes/huffman/all/conanfile.py b/recipes/huffman/all/conanfile.py index 6cbfd60d77f27..236e549a5af09 100644 --- a/recipes/huffman/all/conanfile.py +++ b/recipes/huffman/all/conanfile.py @@ -1,7 +1,11 @@ -from conans import ConanFile, CMake, tools -import functools +import os + +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, export_conandata_patches, get, replace_in_file + +required_conan_version = ">=1.53.0" -required_conan_version = ">=1.33.0" class HuffmanConan(ConanFile): name = "huffman" @@ -9,61 +13,60 @@ class HuffmanConan(ConanFile): license = "Unlicense" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/drichardson/huffman" - topics = ["huffman", "encoder", "decoder", "compression"] - settings = "os", "arch", "compiler","build_type" + topics = ("encoder", "decoder", "compression") + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], } default_options = { - 'shared': False, - 'fPIC': True, + "shared": False, + "fPIC": True, } - exports_sources = ["CMakeLists.txt"] - generators = "cmake" - @property - def _source_subfolder(self): - return "source_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": del self.options.fPIC - 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 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) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.configure() - return cmake + def generate(self): + tc = CMakeToolchain(self) + tc.generate() + + def _patch_sources(self): + replace_in_file(self, os.path.join(self.source_folder, "huffman.c"), + "#ifdef WIN32", + "#if defined _WIN32 || defined __CYGWIN__") 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*", 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() def package_info(self): - self.cpp_info.libs.append("huffman") + self.cpp_info.libs = ["huffman"] if self.settings.os == "Windows": self.cpp_info.system_libs.append("ws2_32") diff --git a/recipes/huffman/all/patches/1.2.2-0001-use-_WIN32.patch b/recipes/huffman/all/patches/1.2.2-0001-use-_WIN32.patch deleted file mode 100644 index f04952ff087f5..0000000000000 --- a/recipes/huffman/all/patches/1.2.2-0001-use-_WIN32.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/a/huffman.c b/b/huffman.c -index 81959cb..ecea371 100644 ---- a/a/huffman.c -+++ b/b/huffman.c -@@ -11,7 +11,7 @@ - #include - #include - --#ifdef WIN32 -+#if defined _WIN32 || defined __CYGWIN__ - #include - #include - #else diff --git a/recipes/huffman/all/patches/1.2.7-0001-use-_WIN32.patch b/recipes/huffman/all/patches/1.2.7-0001-use-_WIN32.patch deleted file mode 100644 index 9c1fe246e8193..0000000000000 --- a/recipes/huffman/all/patches/1.2.7-0001-use-_WIN32.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/a/huffman.c b/b/huffman.c -index 7cae8c1..34f3101 100644 ---- a/a/huffman.c -+++ b/b/huffman.c -@@ -6,7 +6,7 @@ - #include - #include - --#ifdef WIN32 -+#if defined _WIN32 || defined __CYGWIN__ - #include - #include - #else diff --git a/recipes/huffman/all/test_package/CMakeLists.txt b/recipes/huffman/all/test_package/CMakeLists.txt index cca65fc1e8c24..8c882942df773 100644 --- a/recipes/huffman/all/test_package/CMakeLists.txt +++ b/recipes/huffman/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) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) find_package(huffman REQUIRED CONFIG) diff --git a/recipes/huffman/all/test_package/conanfile.py b/recipes/huffman/all/test_package/conanfile.py index 38f4483872d47..ef5d7042163ec 100644 --- a/recipes/huffman/all/test_package/conanfile.py +++ b/recipes/huffman/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/huffman/all/test_v1_package/CMakeLists.txt b/recipes/huffman/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/huffman/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/huffman/all/test_v1_package/conanfile.py b/recipes/huffman/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/huffman/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/huffman/config.yml b/recipes/huffman/config.yml index 1bf1c0d4bfeb0..6772821daadb7 100644 --- a/recipes/huffman/config.yml +++ b/recipes/huffman/config.yml @@ -1,5 +1,3 @@ versions: "1.2.7": folder: all - "1.2.2": - folder: all diff --git a/recipes/hunspell/all/CMakeLists.txt b/recipes/hunspell/all/CMakeLists.txt index b2bc98f40adab..8fb4e22ab52aa 100644 --- a/recipes/hunspell/all/CMakeLists.txt +++ b/recipes/hunspell/all/CMakeLists.txt @@ -1,10 +1,8 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(hunspell VERSION "${CONAN_hunspell_VERSION}" LANGUAGES CXX) -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup(TARGETS KEEP_RPATHS) -set(src src/hunspell) +set(src "${CMAKE_CURRENT_SOURCE_DIR}/src/src/hunspell") # ---- Configure hunvisapi.h ---- @@ -28,6 +26,8 @@ add_library( "${src}/suggestmgr.cxx" ) +target_compile_features(hunspell PRIVATE cxx_std_11) + if(MSVC) target_compile_options(hunspell PRIVATE /wd4267 /wd4996) endif() diff --git a/recipes/hunspell/all/conandata.yml b/recipes/hunspell/all/conandata.yml index 6c8c08bc2e4b0..69ac32949f949 100644 --- a/recipes/hunspell/all/conandata.yml +++ b/recipes/hunspell/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "1.7.2": + sha256: "69fa312d3586c988789266eaf7ffc9861d9f6396c31fc930a014d551b59bbd6e" + url: https://github.com/hunspell/hunspell/archive/refs/tags/v1.7.2.tar.gz "1.7.0": sha256: "57be4e03ae9dd62c3471f667a0d81a14513e314d4d92081292b90435944ff951" url: https://github.com/hunspell/hunspell/files/2573619/hunspell-1.7.0.tar.gz +patches: + "1.7.2": + - patch_file: "patches/0001-fix-basic-string.patch" + patch_description: "Fix build problem with basic_string::append()" + patch_type: "official" + patch_source: "https://github.com/hunspell/hunspell/commit/a6cb9f609b0292df12e2e855c97303de306bae44" diff --git a/recipes/hunspell/all/conanfile.py b/recipes/hunspell/all/conanfile.py index 6c74ea78eaba7..914e9604ac575 100644 --- a/recipes/hunspell/all/conanfile.py +++ b/recipes/hunspell/all/conanfile.py @@ -1,21 +1,21 @@ -import functools +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, export_conandata_patches, apply_conandata_patches import os -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class HunspellConan(ConanFile): name = "hunspell" - description = ( - "Hunspell is a free spell checker and morphological analyzer library" - ) + description = "Hunspell is a free spell checker and morphological analyzer library" url = "https://github.com/conan-io/conan-center-index" homepage = "https://hunspell.github.io/" topics = "spell", "spell-check" license = "MPL-1.1", "GPL-2.0-or-later", "LGPL-2.1-or-later" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -25,10 +25,11 @@ class HunspellConan(ConanFile): "shared": False, "fPIC": True, } - generators = "cmake" - # FIXME: Remove once the pending upstream PR for CMake support is merged - exports_sources = "CMakeLists.txt" - no_copy_source = True + + def export_sources(self): + export_conandata_patches(self) + # TODO: Remove once PR is merged: https://github.com/hunspell/hunspell/pull/704/ + copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder) def config_options(self): if self.settings.os == "Windows": @@ -36,30 +37,44 @@ 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) # NOTE: The source contains a pre-configured hunvisapi.h and it would # prevent no_copy_source and building without patches. h = os.path.join(self.source_folder, "src", "hunspell", "hunvisapi.h") os.remove(h) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["CONAN_hunspell_VERSION"] = self.version - cmake.configure() - return cmake + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CONAN_hunspell_VERSION"] = self.version + tc.generate() def build(self): - self._configure_cmake().build() + 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._configure_cmake().install() - self.copy("COPYING", "licenses") - self.copy("COPYING.LESSER", "licenses") - self.copy("license.hunspell", "licenses") + cmake = CMake(self) + cmake.install() + copy(self, "COPYING*", + src=self.source_folder, + dst=os.path.join(self.package_folder, "licenses"), + keep_path=False) + copy(self, "license.hunspell", + src=self.source_folder, + dst=os.path.join(self.package_folder, "licenses"), + keep_path=False) def package_info(self): self.cpp_info.libs = ["hunspell"] diff --git a/recipes/hunspell/all/patches/0001-fix-basic-string.patch b/recipes/hunspell/all/patches/0001-fix-basic-string.patch new file mode 100644 index 0000000000000..71aa1cdafa6c8 --- /dev/null +++ b/recipes/hunspell/all/patches/0001-fix-basic-string.patch @@ -0,0 +1,71 @@ +diff --git a/src/hunspell/affentry.cxx b/src/hunspell/affentry.cxx +index 46e8b5826..6ee23bec9 100644 +--- a/src/hunspell/affentry.cxx ++++ b/src/hunspell/affentry.cxx +@@ -290,7 +290,7 @@ struct hentry* PfxEntry::check_twosfx(const std::string& word, + // back any characters that would have been stripped + + std::string tmpword(strip); +- tmpword.append(word, start + appnd.size()); ++ tmpword.append(word, start + appnd.size(), tmpl); + + // now make sure all of the conditions on characters + // are met. Please see the appendix at the end of +@@ -338,7 +338,7 @@ std::string PfxEntry::check_twosfx_morph(const std::string& word, + // back any characters that would have been stripped + + std::string tmpword(strip); +- tmpword.append(word, start + appnd.size()); ++ tmpword.append(word, start + appnd.size(), tmpl); + + // now make sure all of the conditions on characters + // are met. Please see the appendix at the end of +@@ -386,7 +386,7 @@ std::string PfxEntry::check_morph(const std::string& word, + // back any characters that would have been stripped + + std::string tmpword(strip); +- tmpword.append(word, start + appnd.size()); ++ tmpword.append(word, start + appnd.size(), tmpl); + + // now make sure all of the conditions on characters + // are met. Please see the appendix at the end of +diff --git a/src/hunspell/affixmgr.cxx b/src/hunspell/affixmgr.cxx +index 4d1ad2f12..a8931c14a 100644 +--- a/src/hunspell/affixmgr.cxx ++++ b/src/hunspell/affixmgr.cxx +@@ -2465,7 +2465,7 @@ int AffixMgr::compound_check_morph(const std::string& word, + result.append(presult); + result.push_back(MSEP_FLD); + result.append(MORPH_PART); +- result.append(word, i); ++ result.append(word, i, word.size()); + if (complexprefixes && HENTRY_DATA(rv)) + result.append(HENTRY_DATA2(rv)); + if (!HENTRY_FIND(rv, MORPH_STEM)) { +@@ -2522,7 +2522,7 @@ int AffixMgr::compound_check_morph(const std::string& word, + result.append(presult); + result.push_back(MSEP_FLD); + result.append(MORPH_PART); +- result.append(word, i); ++ result.append(word, i, word.size()); + + if (HENTRY_DATA(rv)) { + if (complexprefixes) +@@ -2573,7 +2573,7 @@ int AffixMgr::compound_check_morph(const std::string& word, + if (!m.empty()) { + result.push_back(MSEP_FLD); + result.append(MORPH_PART); +- result.append(word, i); ++ result.append(word, i, word.size()); + line_uniq_app(m, MSEP_REC); + result.append(m); + } +@@ -2665,7 +2665,7 @@ int AffixMgr::compound_check_morph(const std::string& word, + if (!m.empty()) { + result.push_back(MSEP_FLD); + result.append(MORPH_PART); +- result.append(word, i); ++ result.append(word, i, word.size()); + line_uniq_app(m, MSEP_REC); + result.push_back(MSEP_FLD); + result.append(m); diff --git a/recipes/hunspell/all/test_package/CMakeLists.txt b/recipes/hunspell/all/test_package/CMakeLists.txt index 73177e055de6d..45217182fc8cf 100644 --- a/recipes/hunspell/all/test_package/CMakeLists.txt +++ b/recipes/hunspell/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) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) find_package(hunspell REQUIRED CONFIG) -add_executable(test_package test_package.cxx) -target_link_libraries(test_package PRIVATE hunspell::hunspell) +add_executable(${PROJECT_NAME} test_package.cxx) +target_link_libraries(${PROJECT_NAME} PRIVATE hunspell::hunspell) diff --git a/recipes/hunspell/all/test_package/conanfile.py b/recipes/hunspell/all/test_package/conanfile.py index a8c92dea63335..0a6bc68712d90 100644 --- a/recipes/hunspell/all/test_package/conanfile.py +++ b/recipes/hunspell/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/hunspell/all/test_v1_package/CMakeLists.txt b/recipes/hunspell/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..5d38c542b67a4 --- /dev/null +++ b/recipes/hunspell/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +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/hunspell/all/test_v1_package/conanfile.py b/recipes/hunspell/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..a500b98343c74 --- /dev/null +++ b/recipes/hunspell/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/hunspell/config.yml b/recipes/hunspell/config.yml index 0f57b11de8fb0..cc37272dbe648 100644 --- a/recipes/hunspell/config.yml +++ b/recipes/hunspell/config.yml @@ -1,3 +1,5 @@ versions: + "1.7.2": + folder: all "1.7.0": folder: all diff --git a/recipes/hwdata/all/conandata.yml b/recipes/hwdata/all/conandata.yml new file mode 100644 index 0000000000000..4dd2a08c35c6b --- /dev/null +++ b/recipes/hwdata/all/conandata.yml @@ -0,0 +1,16 @@ +sources: + "0.385": + url: "https://github.com/vcrhonek/hwdata/archive/v0.385.tar.gz" + sha256: "577219d44d9686e8177f6291adbff7bacdd785ad4e8a8d0c4b2a14dbf850d6ac" + "0.382": + url: "https://github.com/vcrhonek/hwdata/archive/v0.382.tar.gz" + sha256: "5e25457b562a5227eb77eac21d5e4344bd1183c7d62b41e7d3e780ae33e053c1" + "0.378": + url: "https://github.com/vcrhonek/hwdata/archive/v0.378.tar.gz" + sha256: "098ea8db12a50290f4b23f7f521edf9c5bab25935d2740de17e4a487110b40c8" + "0.376": + url: "https://github.com/vcrhonek/hwdata/archive/v0.376.tar.gz" + sha256: "48d85dbf05650b2c382ffaadeb601cac1650f5a34ee5c452df8021af988ea090" + "0.374": + url: "https://github.com/vcrhonek/hwdata/archive/v0.374.tar.gz" + sha256: "2a0988bf5e97e49159d7f02a5e02a719c8976d4ec883a8abb635149d221ceca0" diff --git a/recipes/hwdata/all/conanfile.py b/recipes/hwdata/all/conanfile.py new file mode 100644 index 0000000000000..a8f5e3c5ad118 --- /dev/null +++ b/recipes/hwdata/all/conanfile.py @@ -0,0 +1,84 @@ +from conan import ConanFile +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import copy, get, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +import os + + +required_conan_version = ">=1.53.0" + + +class HwDataConan(ConanFile): + name = "hwdata" + description = "hwdata contains various hardware identification and configuration data, such as the pci.ids and usb.ids databases" + license = ("GPL-2.0-or-later", "XFree86-1.1") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/vcrhonek/hwdata" + topics = ("hardware", "id", "pci", "usb") + package_type = "unknown" + settings = "os", "arch", "compiler", "build_type" + options = { + "disable_blacklist": [True, False], + } + default_options = { + "disable_blacklist": False, + } + + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) + + def configure(self): + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + basic_layout(self, src_folder="src") + self.folders.build = "src" + + def package_id(self): + del self.info.settings.arch + del self.info.settings.build_type + del self.info.settings.compiler + del self.info.settings.os + + 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): + 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.append("--datarootdir=/res") + if self.options.disable_blacklist: + tc.configure_args.append("--disable-blacklist") + tc.generate() + + def build(self): + autotools = Autotools(self) + autotools.configure() + autotools.make() + + def package(self): + copy(self, "COPYING", self.source_folder, os.path.join(self.package_folder, "licenses")) + 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, "res", "pkgconfig")) + + def package_info(self): + self.cpp_info.includedirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = ["res"] + pkg_config_variables = { + "pkgdatadir": os.path.join(self.package_folder, "res", self.name) + } + self.cpp_info.set_property("pkg_config_custom_content", + "\n".join(f"{key}={value}" for key, value in pkg_config_variables.items())) diff --git a/recipes/hwdata/all/test_package/conanfile.py b/recipes/hwdata/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0edcd74c5d4d6 --- /dev/null +++ b/recipes/hwdata/all/test_package/conanfile.py @@ -0,0 +1,18 @@ +from conan import ConanFile +from conan.tools.files import save, load +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def generate(self): + save(self, "hwdata_pkg_dir", self.dependencies[self.tested_reference_str].package_folder) + + def test(self): + pkg_dir = load(self, "hwdata_pkg_dir") + assert os.path.isfile(os.path.join(pkg_dir, "res", "hwdata", "usb.ids")) diff --git a/recipes/hwdata/config.yml b/recipes/hwdata/config.yml new file mode 100644 index 0000000000000..329f229df7ce9 --- /dev/null +++ b/recipes/hwdata/config.yml @@ -0,0 +1,11 @@ +versions: + "0.385": + folder: all + "0.382": + folder: all + "0.378": + folder: all + "0.376": + folder: all + "0.374": + folder: all diff --git a/recipes/hwloc/all/conandata.yml b/recipes/hwloc/all/conandata.yml new file mode 100644 index 0000000000000..98b2b2bec0fbe --- /dev/null +++ b/recipes/hwloc/all/conandata.yml @@ -0,0 +1,10 @@ +sources: + "2.11.1": + url: "https://download.open-mpi.org/release/hwloc/v2.11/hwloc-2.11.1.tar.bz2" + sha256: "04cdfbffad225ce15f66184f0f4141327dabf288d10a8b84d13f517acb7870c6" + "2.10.0": + url: "https://download.open-mpi.org/release/hwloc/v2.10/hwloc-2.10.0.tar.bz2" + sha256: "0305dd60c9de2fbe6519fe2a4e8fdc6d3db8de574a0ca7812b92e80c05ae1392" + "2.9.3": + url: "https://download.open-mpi.org/release/hwloc/v2.9/hwloc-2.9.3.tar.bz2" + sha256: "5c4062ce556f6d3451fc177ffb8673a2120f81df6835dea6a21a90fbdfff0dec" diff --git a/recipes/hwloc/all/conanfile.py b/recipes/hwloc/all/conanfile.py new file mode 100644 index 0000000000000..ff20e76545dae --- /dev/null +++ b/recipes/hwloc/all/conanfile.py @@ -0,0 +1,102 @@ +from conan import ConanFile +from conan.tools.apple import is_apple_os, fix_apple_shared_install_name +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain, PkgConfigDeps +from conan.tools.layout import basic_layout +import os + +required_conan_version = ">=1.53.0" + +# INFO: In order to prevent OneTBB missing package error, we build only shared library for hwloc. + +class HwlocConan(ConanFile): + name = "hwloc" + description = "Portable Hardware Locality (hwloc)" + topics = ("hardware", "topology") + license = "BSD-3-Clause" + homepage = "https://www.open-mpi.org/projects/hwloc/" + url = "https://github.com/conan-io/conan-center-index" + package_type = "shared-library" + settings = "os", "arch", "compiler", "build_type" + options = { + "with_libxml2": [True, False] + } + default_options = { + "with_libxml2": False + } + + def configure(self): + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def requirements(self): + if self.options.with_libxml2: + self.requires("libxml2/[>=2.12.5 <3]") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def layout(self): + if self.settings.os == "Windows": + cmake_layout(self, src_folder="src") + else: + basic_layout(self, src_folder="src") + + def generate(self): + if self.settings.os == "Windows": + deps = CMakeDeps(self) + deps.generate() + tc = CMakeToolchain(self) + tc.cache_variables["HWLOC_ENABLE_TESTING"] = 'OFF' + tc.cache_variables["HWLOC_SKIP_LSTOPO"] = 'ON' + tc.cache_variables["HWLOC_SKIP_TOOLS"] = 'ON' + tc.cache_variables["HWLOC_SKIP_INCLUDES"] = 'OFF' + tc.cache_variables["HWLOC_WITH_OPENCL"] = 'OFF' + tc.cache_variables["HWLOC_WITH_CUDA"] = 'OFF' + tc.cache_variables["HWLOC_BUILD_SHARED_LIBS"] = True + tc.cache_variables["HWLOC_WITH_LIBXML2"] = self.options.with_libxml2 + tc.generate() + else: + deps = PkgConfigDeps(self) + deps.generate() + tc = AutotoolsToolchain(self) + if not self.options.with_libxml2: + tc.configure_args.extend(["--disable-libxml2"]) + tc.configure_args.extend(["--disable-io", "--disable-cairo"]) + tc.configure_args.extend(["--enable-shared", "--disable-static"]) + tc.generate() + + def build(self): + if self.settings.os == "Windows": + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join("contrib", "windows-cmake")) + cmake.build() + else: + autotools = Autotools(self) + autotools.configure() + autotools.make() + + def package(self): + copy(self, "COPYING", self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + if self.settings.os == "Windows": + cmake = CMake(self) + cmake.install() + # remove PDB files + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + else: + autotools = Autotools(self) + autotools.install() + fix_apple_shared_install_name(self) + # remove tools + rmdir(self, os.path.join(self.package_folder, "bin")) + + 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.set_property("pkg_config_name", "hwloc") + self.cpp_info.libs = ["hwloc"] + if is_apple_os(self): + self.cpp_info.frameworks = ['IOKit', 'Foundation', 'CoreFoundation'] diff --git a/recipes/hwloc/all/test_package/CMakeLists.txt b/recipes/hwloc/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..ea8c4a4511afc --- /dev/null +++ b/recipes/hwloc/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) + +find_package(hwloc REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE hwloc::hwloc) diff --git a/recipes/hwloc/all/test_package/conanfile.py b/recipes/hwloc/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0a6bc68712d90 --- /dev/null +++ b/recipes/hwloc/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/hwloc/all/test_package/test_package.c b/recipes/hwloc/all/test_package/test_package.c new file mode 100644 index 0000000000000..a8a04af2fe797 --- /dev/null +++ b/recipes/hwloc/all/test_package/test_package.c @@ -0,0 +1,10 @@ +#include + +int main(void) { + hwloc_topology_t topology; + + hwloc_topology_init(&topology); + hwloc_topology_destroy(topology); + + return 0; +} diff --git a/recipes/hwloc/config.yml b/recipes/hwloc/config.yml new file mode 100644 index 0000000000000..c94edb0b5eb63 --- /dev/null +++ b/recipes/hwloc/config.yml @@ -0,0 +1,7 @@ +versions: + "2.11.1": + folder: all + "2.10.0": + folder: all + "2.9.3": + folder: all 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..e3925c18673ce 100644 --- a/recipes/hyperscan/all/conandata.yml +++ b/recipes/hyperscan/all/conandata.yml @@ -1,8 +1,22 @@ sources: + "5.4.2": + url: "https://github.com/intel/hyperscan/archive/v5.4.2.tar.gz" + sha256: "32b0f24b3113bbc46b6bfaa05cf7cf45840b6b59333d078cc1f624e4c40b2b99" "5.4.0": url: "https://github.com/intel/hyperscan/archive/v5.4.0.tar.gz" sha256: "e51aba39af47e3901062852e5004d127fa7763b5dbbc16bcca4265243ffa106f" patches: + "5.4.2": + - patch_file: "patches/5.4.2-0001-fix-cmake.patch" + patch_description: "modify cmake files to build with conan" + patch_type: "conan" + - patch_file: "patches/5.4.2-0002-use-ue2-make_unique.patch" + patch_description: "add ue2:: prefix to make_unique for name collision" + patch_type: "portability" "5.4.0": - - patch_file: "patches/fix-cmake.patch" - base_path: "source_subfolder" + - patch_file: "patches/5.4.0-0001-fix-cmake.patch" + patch_description: "modify cmake files to build with conan" + patch_type: "conan" + - patch_file: "patches/5.4.0-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..8ccc3f01da959 100644 --- a/recipes/hyperscan/all/conanfile.py +++ b/recipes/hyperscan/all/conanfile.py @@ -1,23 +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.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 - + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -26,9 +26,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 +36,91 @@ 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.83.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 + tc.variables["BUILD_EXAMPLES"] = False 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 +129,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/5.4.0-0001-fix-cmake.patch b/recipes/hyperscan/all/patches/5.4.0-0001-fix-cmake.patch new file mode 100644 index 0000000000000..ab66becd930f5 --- /dev/null +++ b/recipes/hyperscan/all/patches/5.4.0-0001-fix-cmake.patch @@ -0,0 +1,338 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 8bc6077..2dfdf29 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 () +@@ -242,8 +242,8 @@ else() + if (NOT RELEASE_BUILD) + # -Werror is most useful during development, don't potentially break + # release builds +- set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Werror") +- set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Werror") ++ #set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Werror") ++ #set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Werror") + endif() + + if (DISABLE_ASSERTS) +@@ -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/5.4.0-0002-use-ue2-make_unique.patch b/recipes/hyperscan/all/patches/5.4.0-0002-use-ue2-make_unique.patch new file mode 100644 index 0000000000000..9d4f5ee294490 --- /dev/null +++ b/recipes/hyperscan/all/patches/5.4.0-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/5.4.2-0001-fix-cmake.patch b/recipes/hyperscan/all/patches/5.4.2-0001-fix-cmake.patch new file mode 100644 index 0000000000000..87c26ae4533b6 --- /dev/null +++ b/recipes/hyperscan/all/patches/5.4.2-0001-fix-cmake.patch @@ -0,0 +1,282 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 7757916..6f05b5b 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -6,7 +6,7 @@ set (HS_MINOR_VERSION 4) + set (HS_PATCH_VERSION 2) + 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 () +@@ -242,8 +242,8 @@ else() + if (NOT RELEASE_BUILD) + # -Werror is most useful during development, don't potentially break + # release builds +- set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Werror") +- set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Werror") ++ #set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Werror") ++ #set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Werror") + endif() + + if (DISABLE_ASSERTS) +@@ -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) +@@ -477,7 +477,6 @@ else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + endif() + +-add_subdirectory(util) + add_subdirectory(doc/dev-reference) + + if (NOT WIN32) +@@ -486,7 +485,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() +@@ -496,17 +495,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) + 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) +@@ -519,7 +520,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() + +@@ -538,7 +539,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() +@@ -548,10 +549,12 @@ 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) + add_subdirectory(tools) + endif() ++endif() + if (EXISTS ${CMAKE_SOURCE_DIR}/chimera/CMakeLists.txt AND BUILD_CHIMERA) + add_subdirectory(chimera) + endif() +@@ -562,14 +565,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}") + +@@ -1230,28 +1233,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) +@@ -1259,7 +1262,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) + +@@ -1294,14 +1297,14 @@ 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 $) +@@ -1317,7 +1320,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) +@@ -1326,7 +1329,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/ch_database.h b/chimera/ch_database.h +index 28bde86..33cda9d 100644 +--- a/chimera/ch_database.h ++++ b/chimera/ch_database.h +@@ -38,7 +38,6 @@ extern "C" + { + #endif + +-#define PCRE_STATIC + #include + + #include "ch_compile.h" // for CH_MODE_ flags +diff --git a/cmake/pcre.cmake b/cmake/pcre.cmake +index e0acda5..0f9e8ac 100644 +--- a/cmake/pcre.cmake ++++ b/cmake/pcre.cmake +@@ -50,14 +50,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..73c299d 100644 +--- a/tools/CMakeLists.txt ++++ b/tools/CMakeLists.txt +@@ -1,3 +1,6 @@ ++# Tools are not installed ++return () ++ + find_package(Threads) + + # remove some warnings diff --git a/recipes/hyperscan/all/patches/5.4.2-0002-use-ue2-make_unique.patch b/recipes/hyperscan/all/patches/5.4.2-0002-use-ue2-make_unique.patch new file mode 100644 index 0000000000000..7c24368a9f0e1 --- /dev/null +++ b/recipes/hyperscan/all/patches/5.4.2-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 ba6b350..106b900 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)); + } + } + +@@ -1848,7 +1848,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 ea89669..fc4e5cb 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 22becbd..4c671c0 100644 +--- a/tools/hsbench/main.cpp ++++ b/tools/hsbench/main.cpp +@@ -1043,7 +1043,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 f796cd4..1613082 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..5e1749b052fcf 100644 --- a/recipes/hyperscan/all/test_package/conanfile.py +++ b/recipes/hyperscan/all/test_package/conanfile.py @@ -1,25 +1,39 @@ +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" + _with_chimera = False + 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() + + self._with_chimera = self.dependencies["hyperscan"].options.build_chimera 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) + if self._with_chimera: + 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/hyperscan/config.yml b/recipes/hyperscan/config.yml index d02161efd202b..4915e863cdb5a 100644 --- a/recipes/hyperscan/config.yml +++ b/recipes/hyperscan/config.yml @@ -1,3 +1,5 @@ versions: + "5.4.2": + folder: all "5.4.0": folder: all diff --git a/recipes/i2c-tools/all/conanfile.py b/recipes/i2c-tools/all/conanfile.py index 869b97a3d490e..544ea4beb37db 100644 --- a/recipes/i2c-tools/all/conanfile.py +++ b/recipes/i2c-tools/all/conanfile.py @@ -1,18 +1,23 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, tools -from conans.errors import ConanInvalidConfiguration import os -requires_conan_version = ">=1.33.0" +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import chdir, copy, get, replace_in_file, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout + +required_conan_version = ">=1.53.0" class I2cConan(ConanFile): name = "i2c-tools" - license = "GPL-2.0-or-later", "LGPL-2.1" + description = "I2C tools for the linux kernel as well as an I2C library." + license = ("GPL-2.0-or-later", "LGPL-2.1") url = "https://github.com/conan-io/conan-center-index" homepage = "https://i2c.wiki.kernel.org/index.php/I2C_Tools" - description = "I2C tools for the linux kernel as well as an I2C library." - topics = ("i2c") + topics = ("i2c",) + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -23,56 +28,62 @@ class I2cConan(ConanFile): "fPIC": True, } - @property - def _source_subfolder(self): - return "source_subfolder" - 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("linux-headers-generic/5.14.9") + self.requires("linux-headers-generic/5.15.128") def validate(self): - if self.settings.os != "Linux": + if self.settings.os not in ["Linux", "FreeBSD"]: raise ConanInvalidConfiguration("i2c-tools only support Linux") 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, "Makefile"), - "SRCDIRS := include lib eeprom stub tools $(EXTRA)", - "SRCDIRS := include lib $(EXTRA)") - - @property - def _make_args(self): - return [ - "PREFIX={}".format(self.package_folder), - "BUILD_DYNAMIC_LIB={}".format("1" if self.options.shared else "0"), - "BUILD_STATIC_LIB={}".format("0" if self.options.shared else "1"), - "USE_STATIC_LIB={}".format("0" if self.options.shared else "1"), + def generate(self): + tc = AutotoolsToolchain(self) + shared = "1" if self.options.shared else "0" + not_shared = "1" if not self.options.shared else "0" + tc.make_args = [ + "PREFIX=/", + f"BUILD_DYNAMIC_LIB={shared}", + f"BUILD_STATIC_LIB={not_shared}", + f"USE_STATIC_LIB={not_shared}", ] + tc.generate() + + def _patch_sources(self): + replace_in_file( + self, + os.path.join(self.source_folder, "Makefile"), + "SRCDIRS := include lib eeprom stub tools $(EXTRA)", + "SRCDIRS := include lib $(EXTRA)", + ) def build(self): self._patch_sources() - autotools = AutoToolsBuildEnvironment(self) - autotools.flags += [f"-I{path}" for path in autotools.include_paths] - with tools.chdir(self._source_subfolder): - autotools.make(args=self._make_args) + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.make() def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") - self.copy("COPYING.LGPL", src=self._source_subfolder, dst="licenses") - autotools = AutoToolsBuildEnvironment(self) - autotools.flags += [f"-I{path}" for path in autotools.include_paths] - with tools.chdir(self._source_subfolder): - autotools.install(args=self._make_args) - 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, "COPYING.LGPL", + 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")) def package_info(self): self.cpp_info.libs = ["i2c"] diff --git a/recipes/i2c-tools/all/test_package/CMakeLists.txt b/recipes/i2c-tools/all/test_package/CMakeLists.txt index 8e909fdb64156..5140938481408 100644 --- a/recipes/i2c-tools/all/test_package/CMakeLists.txt +++ b/recipes/i2c-tools/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(i2c-tools REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) diff --git a/recipes/i2c-tools/all/test_package/conanfile.py b/recipes/i2c-tools/all/test_package/conanfile.py index 2780f5433abb4..e5500f0ff4d7b 100644 --- a/recipes/i2c-tools/all/test_package/conanfile.py +++ b/recipes/i2c-tools/all/test_package/conanfile.py @@ -1,9 +1,17 @@ -from conans import ConanFile, CMake +from conan import ConanFile +from conan.tools.cmake import cmake_layout, CMake 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) diff --git a/recipes/i2c-tools/all/test_v1_package/CMakeLists.txt b/recipes/i2c-tools/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/i2c-tools/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/i2c-tools/all/test_v1_package/conanfile.py b/recipes/i2c-tools/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..2780f5433abb4 --- /dev/null +++ b/recipes/i2c-tools/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): + # For obvious reasons, don't run the test package (we don't want to write data to some device) + pass diff --git a/recipes/icecream-cpp/all/conanfile.py b/recipes/icecream-cpp/all/conanfile.py index ad2f369b0f440..472b8f9d1ba62 100644 --- a/recipes/icecream-cpp/all/conanfile.py +++ b/recipes/icecream-cpp/all/conanfile.py @@ -1,42 +1,49 @@ -from conans import ConanFile, 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.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.52.0" class IcecreamcppConan(ConanFile): name = "icecream-cpp" + description = "A little library to help with the print debugging on C++11 and forward." license = "MIT" - homepage = "https://github.com/renatoGarcia/icecream-cpp" url = "https://github.com/conan-io/conan-center-index" - description = "A little library to help with the print debugging on C++11 and forward." - topics = ("debug", "single-header-lib", "print") - settings = "compiler" + homepage = "https://github.com/renatoGarcia/icecream-cpp" + topics = ("debug", "single-header-lib", "print", "header-only") + + 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 validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) + check_min_cppstd(self, 11) - 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( - "icecream-cpp can't be used by {0} {1}".format( - self.settings.compiler, - self.settings.compiler.version - ) + f"icecream-cpp can't be used 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], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): - self.copy("LICENSE.txt", dst="licenses", src=self._source_subfolder) - self.copy("icecream.hpp", dst="include", src=self._source_subfolder) + copy(self, "LICENSE.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, "icecream.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/icecream-cpp/all/test_package/CMakeLists.txt b/recipes/icecream-cpp/all/test_package/CMakeLists.txt index 6aab347eddf53..5b9d4de6b2558 100644 --- a/recipes/icecream-cpp/all/test_package/CMakeLists.txt +++ b/recipes/icecream-cpp/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(PackageTest CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(icecream-cpp REQUIRED CONFIG) add_executable(example example.cpp) -target_link_libraries(example ${CONAN_LIBS}) +target_link_libraries(example PRIVATE icecream-cpp::icecream-cpp) set_property(TARGET example PROPERTY CXX_STANDARD 11) diff --git a/recipes/icecream-cpp/all/test_package/conanfile.py b/recipes/icecream-cpp/all/test_package/conanfile.py index 186ee2682166d..e0f447388fa1b 100644 --- a/recipes/icecream-cpp/all/test_package/conanfile.py +++ b/recipes/icecream-cpp/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" + test_type = "explicit" -class IcecreamcppTestConan(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,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.bindir, "example") + self.run(bin_path, env="conanrun") diff --git a/recipes/iceoryx/all/CMakeLists.txt b/recipes/iceoryx/all/CMakeLists.txt index ae4d7a261b19e..eb44e488fa5bd 100644 --- a/recipes/iceoryx/all/CMakeLists.txt +++ b/recipes/iceoryx/all/CMakeLists.txt @@ -1,7 +1,9 @@ -cmake_minimum_required(VERSION 3.5) +cmake_minimum_required(VERSION 3.12) project(cmake_wrapper) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(acl) +if(acl_FOUND) + link_libraries(acl::acl) +endif() -add_subdirectory("source_subfolder/iceoryx_meta") +add_subdirectory(src/iceoryx_meta) diff --git a/recipes/iceoryx/all/conandata.yml b/recipes/iceoryx/all/conandata.yml index 638b5224b83e0..22e1451348b38 100644 --- a/recipes/iceoryx/all/conandata.yml +++ b/recipes/iceoryx/all/conandata.yml @@ -1,40 +1,18 @@ sources: - "2.0.2": - url: "https://github.com/eclipse-iceoryx/iceoryx/archive/v2.0.2.tar.gz" - sha256: "99871BCAA8DA4361D1BAAE9CF1507683058DE8572AC3080EDC41E590FFBA06C0" - "2.0.1": - url: "https://github.com/eclipse-iceoryx/iceoryx/archive/v2.0.1.tar.gz" - sha256: "A6750992EA668786F267E4EDA5588DE4D7585F30E59DCF8512620AF509D6690F" - "2.0.0": - url: "https://github.com/eclipse-iceoryx/iceoryx/archive/v2.0.0.tar.gz" - sha256: "C598DD0630F535D61EA9F8BDE5FE7DA3EF4C595419ECFBCD2384CA6FB4CA804F" - "1.0.1": - url: "https://github.com/eclipse-iceoryx/iceoryx/archive/v1.0.1.tar.gz" - sha256: "c47f2e1e6cb7660a2d1c2666fa3b640a2f57275d2e524d0c80160a51a781e0dc" - "1.0.0": - url: "https://github.com/eclipse-iceoryx/iceoryx/archive/refs/tags/v1.0.0.tar.gz" - sha256: "3D7BABCF92974F6D22E8A497E31198DE1D88DF8B20C942992DBBEC5DFB06C4BB" + "2.0.6": + url: "https://github.com/eclipse-iceoryx/iceoryx/archive/v2.0.6.tar.gz" + sha256: "a2add8ffee0c3357ef985cc46c7de79ccb754ea2bed02c61f2ff805ab2c869f1" + "2.0.5": + url: "https://github.com/eclipse-iceoryx/iceoryx/archive/v2.0.5.tar.gz" + sha256: "bf6de70e3edee71223f993a29bff5e61af95ce4871104929d8bd1729f544bafb" + "2.0.3": + url: "https://github.com/eclipse-iceoryx/iceoryx/archive/v2.0.3.tar.gz" + sha256: "8f391696daf2e63da9437aab8d7154371df630fc93876479f2e84c693fc1ba5a" + "1.0.3": + url: "https://github.com/eclipse-iceoryx/iceoryx/archive/v1.0.3.tar.gz" + sha256: "566b7766fb1fabb48d1ca979f7a31082422d6aa5af014a56c1a6b605c60e33f0" patches: - "2.0.2": - - base_path: "source_subfolder" - patch_file: "patches/2.0.X-0001-fix-find-toml.patch" - "2.0.1": - - base_path: "source_subfolder" - patch_file: "patches/2.0.X-0001-fix-find-toml.patch" - "2.0.0": - - base_path: "source_subfolder" - patch_file: "patches/2.0.X-0001-fix-find-toml.patch" - "1.0.1": - - base_path: "source_subfolder" - patch_file: "patches/1.0.0-0001-fix-find-toml.patch" - - base_path: "source_subfolder" - patch_file: "patches/1.0.0-0002-fix-install-bundle.patch" - - base_path: "source_subfolder" - patch_file: "patches/1.0.0-0003-no-hardcoded-libcxx.patch" - "1.0.0": - - base_path: "source_subfolder" - patch_file: "patches/1.0.0-0001-fix-find-toml.patch" - - base_path: "source_subfolder" - patch_file: "patches/1.0.0-0002-fix-install-bundle.patch" - - base_path: "source_subfolder" - patch_file: "patches/1.0.0-0003-no-hardcoded-libcxx.patch" + "1.0.3": + - patch_file: "patches/1.0.0-0001-fix-find-toml.patch" + - patch_file: "patches/1.0.0-0002-fix-install-bundle.patch" + - patch_file: "patches/1.0.0-0003-no-hardcoded-libcxx.patch" diff --git a/recipes/iceoryx/all/conanfile.py b/recipes/iceoryx/all/conanfile.py index c14f7ee13f243..3144cdb2e4a59 100644 --- a/recipes/iceoryx/all/conanfile.py +++ b/recipes/iceoryx/all/conanfile.py @@ -1,19 +1,26 @@ -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.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, export_conandata_patches, get, mkdir, rename, replace_in_file, rmdir, save, rm +from conan.tools.microsoft import is_msvc, check_min_vs +from conan.tools.scm import Version + +required_conan_version = ">=1.52.0" class IceoryxConan(ConanFile): name = "iceoryx" + description = "Eclipse iceoryx - true zero-copy inter-process-communication" license = "Apache-2.0" - homepage = "https://iceoryx.io/" url = "https://github.com/conan-io/conan-center-index" - description = "Eclipse iceoryx - true zero-copy inter-process-communication" + homepage = "https://iceoryx.io/" topics = ("Shared Memory", "IPC", "ROS", "Middleware") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -26,17 +33,9 @@ class IceoryxConan(ConanFile): "toml_config": 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) + copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder) def config_options(self): if self.settings.os == "Windows": @@ -44,110 +43,134 @@ 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.toml_config: - self.requires("cpptoml/0.1.1") - if self.settings.os == "Linux": - self.requires("acl/2.3.1") - - def build_requirements(self): - if tools.Version(self.version) >= "2.0.0": - self.tool_requires("cmake/3.16.2") + self.requires("cpptoml/0.1.1", transitive_headers=True) + if self.settings.os in ["Linux", "FreeBSD"]: + self.requires("acl/2.3.1", transitive_headers=True) def validate(self): compiler = self.settings.compiler - version = tools.Version(self.settings.compiler.version) + version = Version(self.settings.compiler.version) if compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 14) + check_min_cppstd(self, 14) - if compiler == "Visual Studio": - if version < "16": - raise ConanInvalidConfiguration("Iceoryx is just supported for Visual Studio 2019 and higher.") + if is_msvc(self): + check_min_vs(self, 192) if self.options.shared: raise ConanInvalidConfiguration( - 'Using Iceoryx with Visual Studio currently just possible with "shared=False"') + 'Using Iceoryx with Visual Studio currently just possible with "shared=False"' + ) elif compiler == "gcc": if version < "6": raise ConanInvalidConfiguration("Using Iceoryx with gcc requires gcc 6 or higher.") if version < "9" and compiler.get_safe("libcxx") == "libstdc++": raise ConanInvalidConfiguration("gcc < 9 with libstdc++ not supported") if version == "6": - self.output.warn("Iceoryx package is compiled with gcc 6, it is recommended to use 7 or higher") - self.output.warn("GCC 6 will build with warnings.") + self.output.warning( + "Iceoryx package is compiled with gcc 6, it is recommended to use 7 or higher" + ) + self.output.warning("GCC 6 will build with warnings.") elif compiler == "clang": if compiler.get_safe("libcxx") == "libstdc++": raise ConanInvalidConfiguration("clang with libstdc++ not supported") - if version == "7.0" and compiler.get_safe("libcxx") == "libc++" and \ - self.options.shared and self.settings.build_type == "Debug": + if ( + version == "7.0" + and compiler.get_safe("libcxx") == "libc++" + and self.options.shared + and self.settings.build_type == "Debug" + ): raise ConanInvalidConfiguration("shared Debug with clang 7.0 and libc++ not supported") + def build_requirements(self): + if Version(self.version) >= "2.0.0": + self.tool_requires("cmake/[>=3.16 <4]") + 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): + tc = CMakeToolchain(self) + tc.cache_variables["TOML_CONFIG"] = self.options.toml_config + if Version(self.version) >= "2.0.0": + tc.cache_variables["DOWNLOAD_TOML_LIB"] = False + tc.generate() + tc = CMakeDeps(self) + tc.set_property("cpptoml", "cmake_target_name", "cpptoml") + 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 Version(self.version) >= "2.0.0": + hoofs_dir = os.path.join(self.source_folder, "iceoryx_hoofs") + else: + hoofs_dir = os.path.join(self.source_folder, "iceoryx_utils") + + # Use acl::acl target, since plain acl fails to link + replace_in_file(self, os.path.join(hoofs_dir, "CMakeLists.txt"), " acl", " acl::acl") + # Honor fPIC option - iceoryx_utils = "iceoryx_hoofs" if tools.Version(self.version) >= "2.0.0" else "iceoryx_utils" - for cmake_file in [ - os.path.join("iceoryx_binding_c", "CMakeLists.txt"), - os.path.join("iceoryx_posh", "CMakeLists.txt"), - os.path.join(iceoryx_utils, "CMakeLists.txt") - ]: - tools.replace_in_file(os.path.join(self._source_subfolder, cmake_file), "POSITION_INDEPENDENT_CODE ON", "") - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["TOML_CONFIG"] = self.options.toml_config - if tools.Version(self.version) >= "2.0.0": - self._cmake.definitions["DOWNLOAD_TOML_LIB"] = False - self._cmake.configure() - return self._cmake + if Version(self.version) >= "2.90": + replace_in_file(self, os.path.join(self.source_folder, "iceoryx_hoofs", "cmake", "IceoryxPackageHelper.cmake"), + "set_target_properties( ${IOX_TARGET} PROPERTIES POSITION_INDEPENDENT_CODE ON )", "") + else: + cmakelists_list = [ + os.path.join(self.source_folder, "iceoryx_dds", "CMakeLists.txt"), + os.path.join(self.source_folder, "iceoryx_posh", "CMakeLists.txt"), + os.path.join(self.source_folder, "tools", "introspection", "CMakeLists.txt"), + os.path.join(hoofs_dir, "CMakeLists.txt"), + ] + if Version(self.version) >= "2.0.0": + cmakelists_list += [ + os.path.join(self.source_folder, "iceoryx_binding_c", "CMakeLists.txt"), + os.path.join(hoofs_dir, "platform", "CMakeLists.txt"), + ] + for cmakelists in cmakelists_list: + replace_in_file(self, cmakelists, "POSITION_INDEPENDENT_CODE ON", "") def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=self.source_path.parent) 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, "share")) - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + copy(self, "LICENSE", src=self.source_folder, dst=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", "cmake")) + rm(self, ".clang-tidy", os.path.join(self.package_folder, "include"), recursive=True) if self.options.toml_config: - tools.mkdir(os.path.join(self.package_folder, "res")) - tools.rename(os.path.join(self.package_folder, "etc", "roudi_config_example.toml"), + mkdir(self, os.path.join(self.package_folder, "res")) + rename(self, os.path.join(self.package_folder, "etc", "roudi_config_example.toml"), os.path.join(self.package_folder, "res", "roudi_config.toml")) - tools.rmdir(os.path.join(self.package_folder, "etc")) + rmdir(self, os.path.join(self.package_folder, "etc")) # bring to default package structure - if (tools.Version(self.version) >= "2.0.0"): + if Version(self.version) >= "2.0.0": include_paths = ["iceoryx_binding_c", "iceoryx_hoofs", "iceoryx_posh", "iceoryx_versions.hpp"] for include_path in include_paths: - tools.rename( - os.path.join(self.package_folder, "include", "iceoryx", "v{}".format(self.version), include_path), - os.path.join(self.package_folder, "include", include_path)) + rename(self, os.path.join(self.package_folder, "include", "iceoryx", f"v{self.version}", include_path), + os.path.join(self.package_folder, "include", include_path)) # TODO: to remove in conan v2 once cmake_find_package* generators removed - if (tools.Version(self.version) >= "2.0.0"): + if Version(self.version) >= "2.0.0": self._create_cmake_module_alias_targets( os.path.join(self.package_folder, self._module_file_rel_path), - {v["target"]: "iceoryx::{}".format(k) - for k, v in self._iceoryx_components["2.0.0"].items()}) + {v["target"]: f"iceoryx::{k}" for k, v in self._iceoryx_components["2.0.0"].items()}) else: self._create_cmake_module_alias_targets( os.path.join(self.package_folder, self._module_file_rel_path), - {v["target"]: "iceoryx::{}".format(k) - for k, v in self._iceoryx_components["1.0.X"].items()}) + {v["target"]: f"iceoryx::{k}" for k, v in self._iceoryx_components["1.0.X"].items()}) @property def _iceoryx_components(self): - def pthread(): return ["pthread"] if self.settings.os in ["Linux", "FreeBSD"] else [] @@ -155,16 +178,16 @@ def rt(): return ["rt"] if self.settings.os in ["Linux", "FreeBSD"] else [] def atomic(): - return ["atomic"] if self.settings.os == "Linux" else [] + return ["atomic"] if self.settings.os in ["Linux", "FreeBSD"] else [] def acl(): - return ["acl::acl"] if self.settings.os == "Linux" else [] + return ["acl::acl"] if self.settings.os in ["Linux", "FreeBSD"] else [] def cpptoml(): return ["cpptoml::cpptoml"] if self.options.toml_config else [] def libcxx(): - libcxx = tools.stdcpp_library(self) + libcxx = stdcpp_library(self) return [libcxx] if libcxx and not self.options.shared else [] return { @@ -172,100 +195,99 @@ def libcxx(): "iceoryx_platform": { "target": "iceoryx_utils::iceoryx_platform", "system_libs": pthread(), - "requires": [] + "requires": [], }, "iceoryx_utils": { "target": "iceoryx_utils::iceoryx_utils", "system_libs": pthread() + rt() + atomic(), - "requires": ["iceoryx_platform"] + acl() + "requires": ["iceoryx_platform"] + acl(), }, "iceoryx_posh": { "target": "iceoryx_posh::iceoryx_posh", "system_libs": pthread(), - "requires": ["iceoryx_utils"] + "requires": ["iceoryx_utils"], }, "iceoryx_posh_roudi": { "target": "iceoryx_posh::iceoryx_posh_roudi", "system_libs": pthread(), - "requires": ["iceoryx_utils", "iceoryx_posh"] + cpptoml() + "requires": ["iceoryx_utils", "iceoryx_posh"] + cpptoml(), }, "iceoryx_posh_gateway": { "target": "iceoryx_posh::iceoryx_posh_gateway", "system_libs": pthread(), - "requires": ["iceoryx_utils", "iceoryx_posh"] + "requires": ["iceoryx_utils", "iceoryx_posh"], }, "iceoryx_posh_config": { "target": "iceoryx_posh::iceoryx_posh_config", "system_libs": pthread(), - "requires": ["iceoryx_posh_roudi", "iceoryx_utils", "iceoryx_posh"] + "requires": ["iceoryx_posh_roudi", "iceoryx_utils", "iceoryx_posh"], }, "iceoryx_binding_c": { "target": "iceoryx_binding_c::iceoryx_binding_c", "system_libs": pthread() + libcxx(), - "requires": ["iceoryx_utils", "iceoryx_posh"] - } + "requires": ["iceoryx_utils", "iceoryx_posh"], + }, }, "2.0.0": { "iceoryx_platform": { "target": "iceoryx_hoofs::iceoryx_platform", "system_libs": pthread() + rt(), "requires": [], - "includeDir": False + "includeDir": False, }, "iceoryx_hoofs": { "target": "iceoryx_hoofs::iceoryx_hoofs", "system_libs": pthread() + rt() + atomic(), "requires": ["iceoryx_platform"] + acl(), - "includeDir": True + "includeDir": True, }, "iceoryx_posh": { "target": "iceoryx_posh::iceoryx_posh", "system_libs": pthread() + rt(), "requires": ["iceoryx_hoofs"], - "includeDir": True + "includeDir": True, }, "iceoryx_posh_roudi": { "target": "iceoryx_posh::iceoryx_posh_roudi", "system_libs": pthread(), "requires": ["iceoryx_hoofs", "iceoryx_posh"] + cpptoml(), - "includeDir": False + "includeDir": False, }, "iceoryx_posh_gateway": { "target": "iceoryx_posh::iceoryx_posh_gateway", "system_libs": pthread(), "requires": ["iceoryx_hoofs", "iceoryx_posh"], - "includeDir": False + "includeDir": False, }, "iceoryx_posh_config": { "target": "iceoryx_posh::iceoryx_posh_config", "system_libs": pthread(), "requires": ["iceoryx_posh_roudi", "iceoryx_hoofs", "iceoryx_posh"], - "includeDir": False + "includeDir": False, }, "iceoryx_binding_c": { "target": "iceoryx_binding_c::iceoryx_binding_c", "system_libs": pthread() + libcxx(), "requires": ["iceoryx_hoofs", "iceoryx_posh"], - "includeDir": True - } - } + "includeDir": True, + }, + }, } - @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): # FIXME: We should provide 3 CMake config files: @@ -284,15 +306,13 @@ def _register_components(components): self.cpp_info.components[lib_name].requires = requires # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.components[lib_name].build_modules["cmake_find_package"] = [self._module_file_rel_path] - self.cpp_info.components[lib_name].build_modules["cmake_find_package_multi"] = [ - self._module_file_rel_path - ] + self.cpp_info.components[lib_name].build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] - if tools.Version(self.version) >= "2.0.0": + if Version(self.version) >= "2.0.0": _register_components(self._iceoryx_components["2.0.0"]) else: _register_components(self._iceoryx_components["1.0.X"]) 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/iceoryx/all/patches/1.0.0-0001-fix-find-toml.patch b/recipes/iceoryx/all/patches/1.0.0-0001-fix-find-toml.patch index 062232389f69a..d7d0a656f692e 100644 --- a/recipes/iceoryx/all/patches/1.0.0-0001-fix-find-toml.patch +++ b/recipes/iceoryx/all/patches/1.0.0-0001-fix-find-toml.patch @@ -11,11 +11,3 @@ index 6df5429b..e7dedbc4 100644 find_package(cpptoml REQUIRED) endif() -@@ -325,7 +323,6 @@ if(TOML_CONFIG) - iceoryx_posh::iceoryx_posh - iceoryx_utils::iceoryx_utils - iceoryx_posh::iceoryx_posh_roudi -- cpptoml - ${ICEORYX_SANITIZER_FLAGS} - ) - diff --git a/recipes/iceoryx/all/patches/2.0.X-0001-fix-find-toml.patch b/recipes/iceoryx/all/patches/2.0.X-0001-fix-find-toml.patch deleted file mode 100644 index fe7e89524991f..0000000000000 --- a/recipes/iceoryx/all/patches/2.0.X-0001-fix-find-toml.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/iceoryx_posh/CMakeLists.txt b/iceoryx_posh/CMakeLists.txt -index 8f28ac07b..c07b16b88 100644 ---- a/iceoryx_posh/CMakeLists.txt -+++ b/iceoryx_posh/CMakeLists.txt -@@ -350,7 +350,6 @@ if(TOML_CONFIG) - iceoryx_posh::iceoryx_posh - iceoryx_hoofs::iceoryx_hoofs - iceoryx_posh::iceoryx_posh_roudi -- cpptoml - ${ICEORYX_SANITIZER_FLAGS} - ) - diff --git a/recipes/iceoryx/all/test_package/CMakeLists.txt b/recipes/iceoryx/all/test_package/CMakeLists.txt index 4d89e84377074..1ebb72134038c 100644 --- a/recipes/iceoryx/all/test_package/CMakeLists.txt +++ b/recipes/iceoryx/all/test_package/CMakeLists.txt @@ -1,20 +1,17 @@ cmake_minimum_required(VERSION 3.15) -project(test_package) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -if (${MSVC}) +if (MSVC) set(CMAKE_CXX_STANDARD 17) -else() +else() set(CMAKE_CXX_STANDARD 14) endif() - set(CMAKE_CXX_STANDARD_REQUIRED ON) find_package(iceoryx REQUIRED CONFIG) add_executable(test_package main.cpp) -target_link_libraries(test_package iceoryx_posh::iceoryx_posh - iceoryx_posh::iceoryx_posh_roudi +target_link_libraries(test_package + iceoryx_posh::iceoryx_posh + iceoryx_posh::iceoryx_posh_roudi ) diff --git a/recipes/iceoryx/all/test_package/conanfile.py b/recipes/iceoryx/all/test_package/conanfile.py index 50e21d11f1ebd..49365cc526d27 100644 --- a/recipes/iceoryx/all/test_package/conanfile.py +++ b/recipes/iceoryx/all/test_package/conanfile.py @@ -1,9 +1,19 @@ import os -from conans import ConanFile, CMake -class IceoryxTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = ["cmake", "cmake_find_package_multi"] +from conan import ConanFile +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) @@ -17,5 +27,5 @@ def test(self): # a bad idea (checked on 3 different linux devices # always ok - but in container get # "fatal SIGBUS signal appeared caused by memset") - path, dirs, files = next(os.walk("bin")) - print("All %d example files are present" % (len(files))) + path, dirs, files = next(os.walk(self.cpp.build.bindir)) + print(f"All {len(files)} example files are present") diff --git a/recipes/iceoryx/all/test_v1_package/CMakeLists.txt b/recipes/iceoryx/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/iceoryx/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/iceoryx/all/test_v1_package/conanfile.py b/recipes/iceoryx/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..50e21d11f1ebd --- /dev/null +++ b/recipes/iceoryx/all/test_v1_package/conanfile.py @@ -0,0 +1,21 @@ +import os +from conans import ConanFile, CMake + +class IceoryxTestConan(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): + # ToDo : add an executable which can be + # executed in container. + # currently seems shared memory in container is + # a bad idea (checked on 3 different linux devices + # always ok - but in container get + # "fatal SIGBUS signal appeared caused by memset") + path, dirs, files = next(os.walk("bin")) + print("All %d example files are present" % (len(files))) diff --git a/recipes/iceoryx/config.yml b/recipes/iceoryx/config.yml index bb084f4416dd3..4a60749deb79c 100644 --- a/recipes/iceoryx/config.yml +++ b/recipes/iceoryx/config.yml @@ -1,11 +1,9 @@ versions: - "2.0.2": + "2.0.6": folder: all - "2.0.1": + "2.0.5": folder: all - "2.0.0": + "2.0.3": folder: all - "1.0.1": - folder: all - "1.0.0": + "1.0.3": folder: all diff --git a/recipes/iconfontcppheaders/all/conandata.yml b/recipes/iconfontcppheaders/all/conandata.yml new file mode 100644 index 0000000000000..81e9b251ba0f8 --- /dev/null +++ b/recipes/iconfontcppheaders/all/conandata.yml @@ -0,0 +1,13 @@ +sources: + "cci.20240620": + sha256: 363613c9ea6b4d4b290527bc1fcd626b09accd985a40f14442e86d1df16ec487 + url: https://github.com/juliettef/IconFontCppHeaders/archive/62d27fa93d8f1f881dac18f13881dd97af66fa74/main.zip + "cci.20240128": + sha256: de946a4471dca969426b2e7863d79136a91f2e4e4cc7a766df31bbb8412571f9 + url: https://github.com/juliettef/IconFontCppHeaders/archive/8886c5657bac22b8fee34354871e3ade2a596433/main.zip + "cci.20231102": + sha256: 7618e844dcbfea2404c209e8b52158a37c2368a79cc77e94087375a8186442c4 + url: https://github.com/juliettef/IconFontCppHeaders/archive/41b304750e83c0a89375cc1834f65c1204308b4a/main.zip + "cci.20231026": + sha256: b65a0256820ce24541247eeb22843968164acc40786c017392e53c5aa5a58996 + url: https://github.com/juliettef/IconFontCppHeaders/archive/b1700cdf6ca2f78f8d27321dfecdafd7c2d8ef08/main.zip diff --git a/recipes/iconfontcppheaders/all/conanfile.py b/recipes/iconfontcppheaders/all/conanfile.py new file mode 100644 index 0000000000000..278c4d54b8232 --- /dev/null +++ b/recipes/iconfontcppheaders/all/conanfile.py @@ -0,0 +1,38 @@ +import os + +from conan import ConanFile +from conan.tools.layout import basic_layout +from conan.tools.files import copy, get + +required_conan_version = ">=1.52.0" + + +class FireHppConan(ConanFile): + name = "iconfontcppheaders" + description = "Headers for icon fonts Font Awesome, Fork Awesome, Google Material Design Icons, Google Material Design Symbols, Pictogrammers Material Design icons, Kenney game icons, Fontaudio, Codicons and Lucide." + license = "Zlib" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/juliettef/IconFontCppHeaders" + topics = ("icons", "fonts", "icon-fonts", "header-only") + no_copy_source = True + + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain" + + 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], strip_root=True) + + def package(self): + copy(self, "licence.txt", self.source_folder, os.path.join(self.package_folder, "licenses")) + copy(self, "*.h", self.source_folder, os.path.join(self.package_folder, "include")) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/iconfontcppheaders/all/test_package/CMakeLists.txt b/recipes/iconfontcppheaders/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..edfa602f53039 --- /dev/null +++ b/recipes/iconfontcppheaders/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1.2) +project(test_package CXX) + +find_package(iconfontcppheaders REQUIRED CONFIG) + +add_executable(${CMAKE_PROJECT_NAME} test_package.cpp) +target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE iconfontcppheaders::iconfontcppheaders) diff --git a/recipes/iconfontcppheaders/all/test_package/conanfile.py b/recipes/iconfontcppheaders/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a2ac5bf6805ee --- /dev/null +++ b/recipes/iconfontcppheaders/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" + 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): + cmd = os.path.join(self.cpp.build.bindir, "test_package") + self.run(cmd, env="conanrun") diff --git a/recipes/iconfontcppheaders/all/test_package/test_package.cpp b/recipes/iconfontcppheaders/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..99ac9eb113bd7 --- /dev/null +++ b/recipes/iconfontcppheaders/all/test_package/test_package.cpp @@ -0,0 +1,8 @@ +#include +#include + +int main() { + std::cout << FONT_ICON_FILE_NAME_FAR << std::endl + << FONT_ICON_FILE_NAME_FAS << std::endl; + return 0; +} diff --git a/recipes/iconfontcppheaders/config.yml b/recipes/iconfontcppheaders/config.yml new file mode 100644 index 0000000000000..163b17b48651e --- /dev/null +++ b/recipes/iconfontcppheaders/config.yml @@ -0,0 +1,9 @@ +versions: + "cci.20240620": + folder: all + "cci.20240128": + folder: all + "cci.20231102": + folder: all + "cci.20231026": + folder: all diff --git a/recipes/icu/all/conandata.yml b/recipes/icu/all/conandata.yml index 822f91ba171c8..32facbe5d4811 100644 --- a/recipes/icu/all/conandata.yml +++ b/recipes/icu/all/conandata.yml @@ -1,44 +1,49 @@ sources: - "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" - "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" - "67.1": - url: "https://github.com/unicode-org/icu/releases/download/release-67-1/icu4c-67_1-src.tgz" - sha256: "94a80cd6f251a53bd2a997f6f1b5ac6653fe791dfab66e1eb0227740fb86d5dc" - "66.1": - url: "https://github.com/unicode-org/icu/releases/download/release-66-1/icu4c-66_1-src.tgz" - sha256: "52a3f2209ab95559c1cf0a14f24338001f389615bf00e2585ef3dbc43ecf0a2e" - "65.1": - url: "https://github.com/unicode-org/icu/releases/download/release-65-1/icu4c-65_1-src.tgz" - sha256: "53e37466b3d6d6d01ead029e3567d873a43a5d1c668ed2278e253b683136d948" + "76.1": + url: "https://github.com/unicode-org/icu/releases/download/release-76-1/icu4c-76_1-src.tgz" + sha256: "dfacb46bfe4747410472ce3e1144bf28a102feeaa4e3875bac9b4c6cf30f4f3e" + "75.1": + url: "https://github.com/unicode-org/icu/releases/download/release-75-1/icu4c-75_1-src.tgz" + sha256: "cb968df3e4d2e87e8b11c49a5d01c787bd13b9545280fc6642f826527618caef" + "74.2": + url: "https://github.com/unicode-org/icu/releases/download/release-74-2/icu4c-74_2-src.tgz" + sha256: "68db082212a96d6f53e35d60f47d38b962e9f9d207a74cfac78029ae8ff5e08c" + "74.1": + url: "https://github.com/unicode-org/icu/releases/download/release-74-1/icu4c-74_1-src.tgz" + sha256: "86ce8e60681972e60e4dcb2490c697463fcec60dd400a5f9bffba26d0b52b8d0" + "73.2": + url: "https://github.com/unicode-org/icu/releases/download/release-73-2/icu4c-73_2-src.tgz" + sha256: "818a80712ed3caacd9b652305e01afc7fa167e6f2e94996da44b90c2ab604ce1" + "73.1": + url: "https://github.com/unicode-org/icu/releases/download/release-73-1/icu4c-73_1-src.tgz" + sha256: "a457431de164b4aa7eca00ed134d00dfbf88a77c6986a10ae7774fc076bb8c45" patches: - "72.1": + "76.1": + - patch_file: "patches/0001-76.1-fix-mingw.patch" + patch_description: "support mingw" + patch_type: "portability" + + "75.1": - patch_file: "patches/0001-69.1-fix-mingw.patch" - "71.1": + patch_description: "support mingw" + patch_type: "portability" + "74.2": - patch_file: "patches/0001-69.1-fix-mingw.patch" - - patch_file: "patches/0001-71.1-fix-undef-strict-ansi.patch" - - patch_file: "patches/0001-71.1-fix-emscripten.patch" + patch_description: "support mingw" + patch_type: "portability" + - patch_file: "patches/0002-74.2-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": + "74.1": - patch_file: "patches/0001-69.1-fix-mingw.patch" - "69.1": + patch_description: "support mingw" + patch_type: "portability" + "73.2": - patch_file: "patches/0001-69.1-fix-mingw.patch" - "68.2": - - patch_file: "patches/0001-67.1-fix-mingw.patch" - "67.1": - - patch_file: "patches/6aba9344a18f4f32e8070ee53b79495630901c26.patch" - - patch_file: "patches/0001-67.1-fix-mingw.patch" + patch_description: "support mingw" + patch_type: "portability" + "73.1": + - patch_file: "patches/0001-69.1-fix-mingw.patch" + patch_description: "support mingw" + patch_type: "portability" diff --git a/recipes/icu/all/conanfile.py b/recipes/icu/all/conanfile.py index 96bfccb5a0165..75b503c2c0e07 100644 --- a/recipes/icu/all/conanfile.py +++ b/recipes/icu/all/conanfile.py @@ -1,18 +1,20 @@ +import glob +import hashlib +import os +import shutil + 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.build import cross_building, stdcpp_library, check_min_cppstd 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 is_msvc, unix_path +from conan.tools.microsoft import check_min_vs, is_msvc, unix_path from conan.tools.scm import Version -from conans.tools import get_gnu_triplet, sha256sum, stdcpp_library -import glob -import os -import shutil -required_conan_version = ">=1.53.0" +required_conan_version = ">=1.57.0" class ICUConan(ConanFile): @@ -22,8 +24,8 @@ class ICUConan(ConanFile): description = "ICU is a mature, widely used set of C/C++ and Java libraries " \ "providing Unicode and Globalization support for software applications." url = "https://github.com/conan-io/conan-center-index" - topics = ("icu", "icu4c", "i see you", "unicode") - + topics = ("icu4c", "i see you", "unicode") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -44,6 +46,20 @@ class ICUConan(ConanFile): "with_extras": False, } + @property + def _min_cppstd(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "8", + "clang": "7", + "apple-clang": "12", + "Visual Studio": "16", + "msvc": "192", + } + @property def _settings_build(self): return getattr(self, "settings_build", self.settings) @@ -67,14 +83,36 @@ def config_options(self): def configure(self): if self.options.shared: self.options.rm_safe("fPIC") + if Version(self.version) >= "74.1": + self.license = "Unicode-3.0" + + def validate(self): + if self.options.dat_package_file: + if not os.path.exists(str(self.options.dat_package_file)): + raise ConanInvalidConfiguration("Non-existent dat_package_file specified") + if Version(self.version) >= "75.1": + 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 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): - if self.options.dat_package_file: - dat_package_file_sha256 = sha256sum(str(self.options.dat_package_file)) - self.info.options.dat_package_file = dat_package_file_sha256 + if self.info.options.dat_package_file: + 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": @@ -83,21 +121,21 @@ def build_requirements(self): self.tool_requires("msys2/cci.latest") if cross_building(self) and hasattr(self, "settings_build"): - self.tool_requires(self.ref) + self.tool_requires(str(self.ref)) 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 = 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"): + if check_min_vs(self, "180", raise_invalid=False): tc.extra_cflags.append("-FS") tc.extra_cxxflags.append("-FS") + if Version(self.version) >= "75.1" and not self.settings.compiler.cppstd and is_msvc(self): + tc.extra_cxxflags.append(f"-std:c++{self._min_cppstd}") if not self.options.shared: tc.extra_defines.append("U_STATIC_IMPLEMENTATION") if is_apple_os(self): @@ -119,22 +157,15 @@ def generate(self): 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 (not is_msvc(self)): - # --with-cross-build above prevents tc.generate() from setting --build option. - # Workaround for https://github.com/conan-io/conan/issues/12642 - gnu_triplet = get_gnu_triplet(str(self._settings_build.os), str(self._settings_build.arch), str(self.settings.compiler)) - tc.configure_args.append(f"--build={gnu_triplet}") if self.settings.os in ["iOS", "tvOS", "watchOS"]: - gnu_triplet = get_gnu_triplet("Macos", str(self.settings.arch)) - tc.configure_args.append(f"--host={gnu_triplet}") - elif is_msvc(self): - # ICU doesn't like GNU triplet of conan for msvc (see https://github.com/conan-io/conan/issues/12546) - host = get_gnu_triplet(str(self.settings.os), str(self.settings.arch), "gcc") - build = get_gnu_triplet(str(self._settings_build.os), str(self._settings_build.arch), "gcc") - tc.configure_args.extend([ - f"--host={host}", - f"--build={build}", - ]) + # 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" @@ -149,6 +180,8 @@ def generate(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): @@ -201,7 +234,7 @@ def build(self): @property def _data_filename(self): - vtag = self.version.split(".")[0] + vtag = Version(self.version).major return f"icudt{vtag}l.dat" @property @@ -209,14 +242,13 @@ 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) def package(self): 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)}"]) + autotools.install() dll_files = glob.glob(os.path.join(self.package_folder, "lib", "*.dll")) if dll_files: diff --git a/recipes/icu/all/patches/0001-67.1-fix-mingw.patch b/recipes/icu/all/patches/0001-67.1-fix-mingw.patch deleted file mode 100644 index 93f5bd7f9ab8a..0000000000000 --- a/recipes/icu/all/patches/0001-67.1-fix-mingw.patch +++ /dev/null @@ -1,37 +0,0 @@ ---- source/config/mh-mingw64 -+++ source/config/mh-mingw64 -@@ -94,7 +94,7 @@ - # This is also for backwards compatibility. - DATA_STUBNAME = dt - I18N_STUBNAME = in --LIBICU = $(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX) -+#LIBICU = $(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX) - - #SH### copied from Makefile.inc - #SH## for icu-config to test with -@@ -102,10 +102,10 @@ - #SH#ICULIBS_COMMON_LIB_NAME_A="${LIBICU}${COMMON_STUBNAME}${ICULIBSUFFIX}.${A}" - - #SH#ICULIBS_DATA="-l$(ICUPREFIX)$(DATA_STUBNAME)$(ICULIBSUFFIX)$(ICULIBSUFFIX_VERSION)" --ICULIBS_DT="-l$(ICUPREFIX)$(DATA_STUBNAME)$(ICULIBSUFFIX)$(ICULIBSUFFIX_VERSION)" --ICULIBS_I18N="-l$(ICUPREFIX)$(I18N_STUBNAME)$(ICULIBSUFFIX)$(ICULIBSUFFIX_VERSION)" --ICULIBS_IO="-l$(ICUPREFIX)$(IO_STUBNAME)$(ICULIBSUFFIX)$(ICULIBSUFFIX_VERSION)" --ICULIBS_UC="-l$(ICUPREFIX)$(COMMON_STUBNAME)$(ICULIBSUFFIX)$(ICULIBSUFFIX_VERSION)" -+#ICULIBS_DT="-l$(ICUPREFIX)$(DATA_STUBNAME)$(ICULIBSUFFIX)$(ICULIBSUFFIX_VERSION)" -+#ICULIBS_I18N="-l$(ICUPREFIX)$(I18N_STUBNAME)$(ICULIBSUFFIX)$(ICULIBSUFFIX_VERSION)" -+#ICULIBS_IO="-l$(ICUPREFIX)$(IO_STUBNAME)$(ICULIBSUFFIX)$(ICULIBSUFFIX_VERSION)" -+#ICULIBS_UC="-l$(ICUPREFIX)$(COMMON_STUBNAME)$(ICULIBSUFFIX)$(ICULIBSUFFIX_VERSION)" - #SH# - #SH## ICULIBS is the set of libraries your application should link - #SH## with usually. Many applications will want to add ${ICULIBS_I18N} as well. ---- source/data/Makefile.in -+++ source/data/Makefile.in -@@ -207,7 +207,7 @@ - ifneq ($(ICUDATA_SOURCE_IS_NATIVE_TARGET),YES) - # For MinGW, do we want the DLL to go in the bin location? - ifeq ($(MINGW_MOVEDLLSTOBINDIR),YES) -- $(PKGDATA_INVOKE) $(PKGDATA) -m $(PKGDATA_MODE) $(PKGDATA_VERSIONING) -e $(ICUDATA_ENTRY_POINT) -T $(OUTTMPDIR) -s $(BUILDDIR) -p $(ICUDATA_NAME) $(PKGDATA_LIBNAME) $(PKGDATA_LIST) -I $(DESTDIR)$(bindir) -+ $(PKGDATA_INVOKE) $(PKGDATA) -m $(PKGDATA_MODE) $(PKGDATA_VERSIONING) -e $(ICUDATA_ENTRY_POINT) -T $(OUTTMPDIR) -s $(BUILDDIR) -p $(ICUDATA_NAME) $(PKGDATA_LIBNAME) $(PKGDATA_LIST) -I $(ICUPKGDATA_INSTALL_DIR) - else - $(PKGDATA_INVOKE) $(PKGDATA) -m $(PKGDATA_MODE) $(PKGDATA_VERSIONING) -e $(ICUDATA_ENTRY_POINT) -T $(OUTTMPDIR) -s $(BUILDDIR) -p $(ICUDATA_NAME) $(PKGDATA_LIBNAME) $(PKGDATA_LIST) -I $(ICUPKGDATA_INSTALL_DIR) - endif diff --git a/recipes/icu/all/patches/0001-71.1-fix-emscripten.patch b/recipes/icu/all/patches/0001-71.1-fix-emscripten.patch deleted file mode 100644 index 5693ab70111d5..0000000000000 --- a/recipes/icu/all/patches/0001-71.1-fix-emscripten.patch +++ /dev/null @@ -1,117 +0,0 @@ -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 ${ header unless __STRICT_ANSI__ is defined. --// __GNUC__ is set by both gcc and clang. --#undef __STRICT_ANSI__ --#endif -- - #include "locmap.h" - #include "unicode/ustdio.h" - diff --git a/recipes/icu/all/patches/0001-76.1-fix-mingw.patch b/recipes/icu/all/patches/0001-76.1-fix-mingw.patch new file mode 100644 index 0000000000000..f7169b0989fbc --- /dev/null +++ b/recipes/icu/all/patches/0001-76.1-fix-mingw.patch @@ -0,0 +1,47 @@ +diff --git a/source/config/mh-mingw64 b/source/config/mh-mingw64 +index fb64c56..ff8922c 100644 +--- a/source/config/mh-mingw64 ++++ b/source/config/mh-mingw64 +@@ -94,7 +94,7 @@ LIBPREFIX= + # This is also for backwards compatibility. + DATA_STUBNAME = dt + I18N_STUBNAME = in +-LIBICU = $(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX) ++#LIBICU = $(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX) + + #SH### copied from Makefile.inc + #SH## for icu-config to test with +@@ -102,13 +102,13 @@ LIBICU = $(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX) + #SH#ICULIBS_COMMON_LIB_NAME_A="${LIBICU}${COMMON_STUBNAME}${ICULIBSUFFIX}.${A}" + + #SH#ICULIBS_DATA="-l$(ICUPREFIX)$(DATA_STUBNAME)$(ICULIBSUFFIX)" +-ICULIBS_DT="-l$(ICUPREFIX)$(DATA_STUBNAME)$(ICULIBSUFFIX)" +-ICULIBS_I18N="-l$(ICUPREFIX)$(I18N_STUBNAME)$(ICULIBSUFFIX)" +-ICULIBS_LX="-l$(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)$(LAYOUTEX_STUBNAME)$(ICULIBSUFFIX)" +-ICULIBS_IO="-l$(ICUPREFIX)$(IO_STUBNAME)$(ICULIBSUFFIX)" +-ICULIBS_UC="-l$(ICUPREFIX)$(COMMON_STUBNAME)$(ICULIBSUFFIX)" +-ICULIBS_CTESTFW="-l$(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)$(CTESTFW_STUBNAME)$(ICULIBSUFFIX)" +-ICULIBS_TOOLUTIL="-l$(ICUPREFIX)tu$(ICULIBSUFFIX)" ++#ICULIBS_DT="-l$(ICUPREFIX)$(DATA_STUBNAME)$(ICULIBSUFFIX)" ++#ICULIBS_I18N="-l$(ICUPREFIX)$(I18N_STUBNAME)$(ICULIBSUFFIX)" ++#ICULIBS_LX="-l$(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)$(LAYOUTEX_STUBNAME)$(ICULIBSUFFIX)" ++#ICULIBS_IO="-l$(ICUPREFIX)$(IO_STUBNAME)$(ICULIBSUFFIX)" ++#ICULIBS_UC="-l$(ICUPREFIX)$(COMMON_STUBNAME)$(ICULIBSUFFIX)" ++#ICULIBS_CTESTFW="-l$(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)$(CTESTFW_STUBNAME)$(ICULIBSUFFIX)" ++#ICULIBS_TOOLUTIL="-l$(ICUPREFIX)tu$(ICULIBSUFFIX)" + #SH# + #SH## ICULIBS is the set of libraries your application should link + #SH## with usually. Many applications will want to add ${ICULIBS_I18N} as well. +diff --git a/source/data/Makefile.in b/source/data/Makefile.in +index 266ad7a..8e3be4f 100644 +--- a/source/data/Makefile.in ++++ b/source/data/Makefile.in +@@ -193,7 +193,7 @@ endif + ifneq ($(ICUDATA_SOURCE_IS_NATIVE_TARGET),YES) + # For MinGW, do we want the DLL to go in the bin location? + ifeq ($(MINGW_MOVEDLLSTOBINDIR),YES) +- $(PKGDATA_INVOKE) $(PKGDATA) -m $(PKGDATA_MODE) $(PKGDATA_VERSIONING) -e $(ICUDATA_ENTRY_POINT) -T $(OUTTMPDIR) -s $(BUILDDIR) -p $(ICUDATA_NAME) $(PKGDATA_LIBNAME) $(PKGDATA_LIST) -I $(DESTDIR)$(bindir) ++ $(PKGDATA_INVOKE) $(PKGDATA) -m $(PKGDATA_MODE) $(PKGDATA_VERSIONING) -e $(ICUDATA_ENTRY_POINT) -T $(OUTTMPDIR) -s $(BUILDDIR) -p $(ICUDATA_NAME) $(PKGDATA_LIBNAME) $(PKGDATA_LIST) -I $(ICUPKGDATA_INSTALL_DIR) + else + $(PKGDATA_INVOKE) $(PKGDATA) -m $(PKGDATA_MODE) $(PKGDATA_VERSIONING) -e $(ICUDATA_ENTRY_POINT) -T $(OUTTMPDIR) -s $(BUILDDIR) -p $(ICUDATA_NAME) $(PKGDATA_LIBNAME) $(PKGDATA_LIST) -I $(ICUPKGDATA_INSTALL_DIR) + endif diff --git a/recipes/icu/all/patches/0002-74.2-fix-emscripten.patch b/recipes/icu/all/patches/0002-74.2-fix-emscripten.patch new file mode 100644 index 0000000000000..9c7748fc3e0f1 --- /dev/null +++ b/recipes/icu/all/patches/0002-74.2-fix-emscripten.patch @@ -0,0 +1,109 @@ +--- a/source/acinclude.m4 ++++ b/source/acinclude.m4 +@@ -85,6 +85,7 @@ powerpc*-apple-darwin*) icu_cv_host_frag=mh-darwin-ppc ;; + *-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 + ] +--- /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: Fri, 24 Apr 2020 19:23:40 -0500 -Subject: [PATCH] ICU-21081 Make U_ASSERT C++14 compatible - ---- - source/common/uassert.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/source/common/uassert.h b/source/common/uassert.h -index 15cd55c8734..afd31eeffd9 100644 ---- a/source/common/uassert.h -+++ b/source/common/uassert.h -@@ -32,7 +32,7 @@ - # include - # define U_ASSERT(exp) assert(exp) - #elif U_CPLUSPLUS_VERSION --# define U_ASSERT(exp) void() -+# define U_ASSERT(exp) (void)0 - #else - # define U_ASSERT(exp) - #endif diff --git a/recipes/icu/all/test_package/CMakeLists.txt b/recipes/icu/all/test_package/CMakeLists.txt index 4275c0782ed46..56b6a86f5e653 100644 --- a/recipes/icu/all/test_package/CMakeLists.txt +++ b/recipes/icu/all/test_package/CMakeLists.txt @@ -5,4 +5,8 @@ find_package(ICU REQUIRED uc) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE ICU::uc) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +if(ICU_VERSION VERSION_LESS "75.1") + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +else() + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +endif() diff --git a/recipes/icu/config.yml b/recipes/icu/config.yml index a50d69cbe08f0..780ca5227a7a5 100644 --- a/recipes/icu/config.yml +++ b/recipes/icu/config.yml @@ -1,17 +1,13 @@ versions: - "72.1": + "76.1": folder: all - "71.1": + "75.1": folder: all - "70.1": + "74.2": folder: all - "69.1": + "74.1": folder: all - "68.2": + "73.2": folder: all - "67.1": - folder: all - "66.1": - folder: all - "65.1": + "73.1": folder: all diff --git a/recipes/id3v2lib/all/conandata.yml b/recipes/id3v2lib/all/conandata.yml new file mode 100644 index 0000000000000..c6353a726bee8 --- /dev/null +++ b/recipes/id3v2lib/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "2.1": + url: "https://github.com/larsbs/id3v2lib/archive/refs/tags/2.1.tar.gz" + sha256: "c91d185e227254d800617f18bee53181f126cb654bfee6041ed9c04172cea95a" diff --git a/recipes/id3v2lib/all/conanfile.py b/recipes/id3v2lib/all/conanfile.py new file mode 100644 index 0000000000000..d920c95d34bde --- /dev/null +++ b/recipes/id3v2lib/all/conanfile.py @@ -0,0 +1,72 @@ +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 +from conan.errors import ConanInvalidConfiguration +import os + +required_conan_version = ">=1.53.0" + + +class Id3v2libConan(ConanFile): + name = "id3v2lib" + description = "id3v2lib is a library written in C to read and edit id3 tags from mp3 files." + topics = ("conan", "id3", "tags", "mp3", "container", "media", "audio") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/larsbs/id3v2lib" + license = "BSD-2-Clause" + package_type = "library" + + settings = "os", "arch", "compiler", "build_type" + + options = { + "shared": [True, False], + "fPIC": [True, False], + } + + default_options = { + "shared": False, + "fPIC": True, + } + + def validate(self): + # An issue has been opened to discuss supporting MSVC: + # https://github.com/larsbs/id3v2lib/issues/48 + if is_msvc(self): + raise ConanInvalidConfiguration("id3v2lib does not support Visual Studio.") + + 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.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + cmake = CMake(self) + cmake.install() + 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", "id3v2lib") + self.cpp_info.set_property("cmake_target_name", "id3v2lib::id3v2lib") + self.cpp_info.set_property("pkg_config_name", "id3v2lib") + self.cpp_info.libs = ["id3v2lib"] diff --git a/recipes/id3v2lib/all/test_package/CMakeLists.txt b/recipes/id3v2lib/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..4ba735415e377 --- /dev/null +++ b/recipes/id3v2lib/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +find_package(id3v2lib REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE id3v2lib::id3v2lib) diff --git a/recipes/id3v2lib/all/test_package/conanfile.py b/recipes/id3v2lib/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0a6bc68712d90 --- /dev/null +++ b/recipes/id3v2lib/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/id3v2lib/all/test_package/test_package.c b/recipes/id3v2lib/all/test_package/test_package.c new file mode 100644 index 0000000000000..cc17067652458 --- /dev/null +++ b/recipes/id3v2lib/all/test_package/test_package.c @@ -0,0 +1,13 @@ +#include +#include + +int main(void) { + ID3v2_Tag *tag = ID3v2_Tag_new_empty(); + ID3v2_Tag_set_title(tag, "Amazing Song!"); + + ID3v2_TextFrame *title_frame = ID3v2_Tag_get_title_frame(tag); + printf("Track title: %s\n", title_frame->data->text); + + ID3v2_Tag_free(tag); + return 0; +} diff --git a/recipes/id3v2lib/config.yml b/recipes/id3v2lib/config.yml new file mode 100644 index 0000000000000..adf6918baab9c --- /dev/null +++ b/recipes/id3v2lib/config.yml @@ -0,0 +1,3 @@ +versions: + "2.1": + folder: all diff --git a/recipes/idna/all/conandata.yml b/recipes/idna/all/conandata.yml new file mode 100644 index 0000000000000..9c2dca57fc556 --- /dev/null +++ b/recipes/idna/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "cci.20240228": + url: "https://github.com/ada-url/idna/archive/fff988508f659ef5c6494572ebea3d5db2466ed0.tar.gz" + sha256: "68cf182f822d8e8599f827767e215a0c4f67f381d729e4ba15509443b52f849b" diff --git a/recipes/idna/all/conanfile.py b/recipes/idna/all/conanfile.py new file mode 100644 index 0000000000000..2e0091c585904 --- /dev/null +++ b/recipes/idna/all/conanfile.py @@ -0,0 +1,85 @@ +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.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.env import VirtualBuildEnv +import os + +required_conan_version = ">=1.52.0" + +class IdnaConan(ConanFile): + name = "idna" + description = "C++ library implementing the to_ascii and to_unicode functions from the Unicode Technical Standard." + license = ("Apache-2.0", "MIT") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/ada-url/idna/" + topics = ("unicode", "icu") + package_type = "static-library" + 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": "8", + "clang": "7", + "apple-clang": "12", + "Visual Studio": "16", + "msvc": "192", + } + + 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"): + 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 build_requirements(self): + self.tool_requires("cmake/[>=3.16 <4]") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + VirtualBuildEnv(self).generate() + + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTING"] = False + tc.variables["ADA_IDNA_BENCHMARKS"] = 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() + + def package_info(self): + self.cpp_info.libs = ["ada-idna"] + self.cpp_info.set_property("cmake_file_name", "ada-idna") + self.cpp_info.set_property("cmake_target_name", "ada-idna") diff --git a/recipes/idna/all/test_package/CMakeLists.txt b/recipes/idna/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..889584ca451e0 --- /dev/null +++ b/recipes/idna/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(ada-idna REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE ada-idna) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/idna/all/test_package/conanfile.py b/recipes/idna/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/idna/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/idna/all/test_package/test_package.cpp b/recipes/idna/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..cbb7f6eeb2dec --- /dev/null +++ b/recipes/idna/all/test_package/test_package.cpp @@ -0,0 +1,14 @@ +#include +#include + +#include "idna.h" + +int main(void) { + std::string_view input = reinterpret_cast(u8"meßagefactory.ca"); // non-empty UTF-8 string, must be percent decoded + std::string idna_ascii = ada::idna::to_ascii(input); + if(idna_ascii.empty()) { + // There was an error. + } + std::cout << idna_ascii << std::endl; + // outputs 'xn--meagefactory-m9a.ca' if the input is u8"meßagefactory.ca" +} diff --git a/recipes/idna/config.yml b/recipes/idna/config.yml new file mode 100644 index 0000000000000..34cca17a5b748 --- /dev/null +++ b/recipes/idna/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20240228": + folder: all diff --git a/recipes/ignition-cmake/all/CMakeLists.txt b/recipes/ignition-cmake/all/CMakeLists.txt deleted file mode 100644 index 8d6da516c42c7..0000000000000 --- a/recipes/ignition-cmake/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.10.2) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/ignition-cmake/all/conandata.yml b/recipes/ignition-cmake/all/conandata.yml index 91e85702d37b5..7fffddb3eb19f 100644 --- a/recipes/ignition-cmake/all/conandata.yml +++ b/recipes/ignition-cmake/all/conandata.yml @@ -1,15 +1,23 @@ sources: - "2.5.0": - url: "https://github.com/gazebosim/gz-cmake/archive/ignition-cmake2_2.5.0.zip" - sha256: "30945958fbe598f654d30de926a798f9055b1c635f7d85441ecba1ebe0804d2d" + "2.17.1": + url: "https://github.com/gazebosim/gz-cmake/archive/refs/tags/ignition-cmake2_2.17.1.tar.gz" + sha256: "f8dbadac71540324e0c506b607cefa99e99a8aca997f7af8e67cb486eb610cc0" "2.10.0": url: "https://github.com/gazebosim/gz-cmake/archive/refs/tags/ignition-cmake2_2.10.0.tar.gz" sha256: "48a01131731b09c32cfc7d577c4db378fb02e49a071e24c9299624766e1d05a2" - -patches: "2.5.0": - - base_path: "source_subfolder" - patch_file: "patches/0001-cmake-fixes.patch" + url: "https://github.com/gazebosim/gz-cmake/archive/refs/tags/ignition-cmake2_2.5.0.tar.gz" + sha256: "d19d0005f0a8dcf79851376a8beff13a0d41b441dd00b3504d218e912dba9d1e" +patches: + "2.17.1": + - patch_file: "patches/2.17.1-0001-fix-cmake.patch" + patch_description: "fix cmake folders" + patch_type: "conan" "2.10.0": - - base_path: "source_subfolder" - patch_file: "patches/0002-ignition-cmake-2.10.0-fixes.patch" + - patch_file: "patches/2.10.0-0001-fix-cmake.patch" + patch_description: "fix cmake folders" + patch_type: "conan" + "2.5.0": + - patch_file: "patches/2.5.0-0001-fix-cmake.patch" + patch_description: "fix cmake folders" + patch_type: "conan" diff --git a/recipes/ignition-cmake/all/conanfile.py b/recipes/ignition-cmake/all/conanfile.py index f09f2bd8badbc..90598402ac8d1 100644 --- a/recipes/ignition-cmake/all/conanfile.py +++ b/recipes/ignition-cmake/all/conanfile.py @@ -1,115 +1,121 @@ -from conans import CMake, ConanFile, tools, RunEnvironment -import conan.tools.files import os import textwrap +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.scm import Version + +required_conan_version = ">=1.52.0" + class IgnitionCmakeConan(ConanFile): name = "ignition-cmake" + description = "A set of CMake modules that are used by the C++-based Ignition projects." license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/gazebosim/gz-cmake" - description = "A set of CMake modules that are used by the C++-based Ignition projects." - topics = ("ignition", "robotics", "cmake") - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" - exports_sources = "CMakeLists.txt", "patches/**" + topics = ("ignition", "robotics", "cmake", "gazebo", "header-only") - _cmake = None + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True - @property - def _module_file_rel_path(self): - return os.path.join("lib", "cmake", f"conan-official-{self.name}-variables.cmake") + 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") def package_id(self): - self.info.header_only() - - def _configure_cmake(self): - if self._cmake is not None: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["CMAKE_INSTALL_DATAROOTDIR"] = "lib" - self._cmake.definitions["SKIP_component_name"] = False - self._cmake.configure(source_folder=self._source_subfolder) - return self._cmake + 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 generate(self): + tc = CMakeToolchain(self) + tc.variables["CMAKE_INSTALL_DATAROOTDIR"] = "lib" + tc.variables["SKIP_component_name"] = False + tc.generate() def build(self): - version_major = tools.Version(self.version).major - env_build = RunEnvironment(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.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - version_major = tools.Version(self.version).major - cmake_config_files_dir = os.path.join(self.package_folder, "lib", "cmake",f"ignition-cmake{version_major}") - files = os.listdir(cmake_config_files_dir) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "bin")) - # retain the special config file for utilities target provided by ignition-cmake - # removing it from the list - files.remove(f"ignition-cmake{version_major}-utilities-targets.cmake") - - # remove all other xxx.cmake files from the list - for file in files: + version_major = Version(self.version).major + cmake_config_files_dir = os.path.join(self.package_folder, "lib", "cmake", f"ignition-cmake{version_major}") + for file in os.listdir(cmake_config_files_dir): if file.endswith(".cmake"): + if file == f"ignition-cmake{version_major}-utilities-targets.cmake": + # retain the special config file for utilities target provided by ignition-cmake + continue os.remove(os.path.join(cmake_config_files_dir, file)) - - # add version information for downstream dependencies consuming ign-cmake through cmake_find_package generators + + # add version information for downstream dependencies consuming ign-cmake through CMake generators self._create_cmake_module_variables( os.path.join(self.package_folder, self._module_file_rel_path), - tools.Version(self.version) + Version(self.version) ) - @staticmethod - def _create_cmake_module_variables(module_file, version): + def _create_cmake_module_variables(self, module_file, version): # the version info is needed by downstream ignition-dependencies - content = textwrap.dedent("""\ - set(ignition-cmake{major}_VERSION_MAJOR {major}) - set(ignition-cmake{major}_VERSION_MINOR {minor}) - set(ignition-cmake{major}_VERSION_PATCH {patch}) - set(ignition-cmake{major}_VERSION_STRING "{major}.{minor}.{patch}") - """.format(major=version.major, minor=version.minor, patch=version.patch)) - tools.save(module_file, content) + content = textwrap.dedent(f"""\ + set(ignition-cmake{version.major}_VERSION_MAJOR {version.major}) + set(ignition-cmake{version.major}_VERSION_MINOR {version.minor}) + set(ignition-cmake{version.major}_VERSION_PATCH {version.patch}) + set(ignition-cmake{version.major}_VERSION_STRING "{version.major}.{version.minor}.{version.patch}") + """) + 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): - version_major = tools.Version(self.version).major + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.frameworkdirs = [] + + version_major = Version(self.version).major ign_cmake_component = f"ignition-cmake{version_major}" - base_module_path = os.path.join(self.package_folder, "lib", "cmake", ign_cmake_component) + self.cpp_info.set_property("cmake_file_name", ign_cmake_component) + + base_module_path = os.path.join("lib", "cmake", ign_cmake_component) ign_cmake_file = os.path.join(base_module_path, f"cmake{version_major}", "IgnCMake.cmake") utils_targets_file = os.path.join(base_module_path, f"{ign_cmake_component}-utilities-targets.cmake") - + self.cpp_info.set_property("cmake_build_modules", [self._module_file_rel_path, ign_cmake_file, utils_targets_file]) + + self.cpp_info.components[ign_cmake_component].set_property("cmake_target_name", f"{ign_cmake_component}::{ign_cmake_component}") + self.cpp_info.components[ign_cmake_component].builddirs.append(os.path.join(base_module_path, f"cmake{version_major}")) + + self.cpp_info.components["utilities"].set_property("cmake_target_name", f"{ign_cmake_component}::utilities") + self.cpp_info.components["utilities"].builddirs.append(os.path.join(base_module_path, f"cmake{version_major}")) + self.cpp_info.components["utilities"].includedirs.append(os.path.join("include", "ignition", f"cmake{version_major}")) + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.names["cmake_find_package"] = ign_cmake_component self.cpp_info.names["cmake_find_package_multi"] = ign_cmake_component self.cpp_info.names["cmake_paths"] = ign_cmake_component - self.cpp_info.components[ign_cmake_component].names["cmake_find_package"] = ign_cmake_component self.cpp_info.components[ign_cmake_component].names["cmake_find_package_multi"] = ign_cmake_component self.cpp_info.components[ign_cmake_component].names["cmake_paths"] = ign_cmake_component - self.cpp_info.components[ign_cmake_component].builddirs.append(os.path.join(base_module_path, f"cmake{version_major}")) - self.cpp_info.components[ign_cmake_component].build_modules["cmake_find_package"] = [self._module_file_rel_path, ign_cmake_file] self.cpp_info.components[ign_cmake_component].build_modules["cmake_find_package_multi"] = [self._module_file_rel_path, ign_cmake_file] self.cpp_info.components[ign_cmake_component].build_modules["cmake_paths"] = [self._module_file_rel_path, ign_cmake_file] - self.cpp_info.components["utilities"].names["cmake_find_package"] = "utilities" self.cpp_info.components["utilities"].names["cmake_find_package_multi"] = "utilities" self.cpp_info.components["utilities"].names["cmake_paths"] = "utilities" - self.cpp_info.components["utilities"].includedirs.append(f"include/ignition/cmake{version_major}") - - self.cpp_info.set_property("cmake_build_modules", [self._module_file_rel_path, ign_cmake_file]) self.cpp_info.components["utilities"].build_modules["cmake_find_package"] = [self._module_file_rel_path, ign_cmake_file, utils_targets_file] self.cpp_info.components["utilities"].build_modules["cmake_find_package_multi"] = [self._module_file_rel_path, ign_cmake_file, utils_targets_file] self.cpp_info.components["utilities"].build_modules["cmake_paths"] = [self._module_file_rel_path, ign_cmake_file, utils_targets_file] diff --git a/recipes/ignition-cmake/all/patches/0002-ignition-cmake-2.10.0-fixes.patch b/recipes/ignition-cmake/all/patches/2.10.0-0001-fix-cmake.patch similarity index 100% rename from recipes/ignition-cmake/all/patches/0002-ignition-cmake-2.10.0-fixes.patch rename to recipes/ignition-cmake/all/patches/2.10.0-0001-fix-cmake.patch diff --git a/recipes/ignition-cmake/all/patches/2.17.1-0001-fix-cmake.patch b/recipes/ignition-cmake/all/patches/2.17.1-0001-fix-cmake.patch new file mode 100644 index 0000000000000..efd3c2a4c4a5f --- /dev/null +++ b/recipes/ignition-cmake/all/patches/2.17.1-0001-fix-cmake.patch @@ -0,0 +1,58 @@ +diff --git a/cmake/IgnCMake.cmake b/cmake/IgnCMake.cmake +index b4aa7e3..17ece86 100644 +--- a/cmake/IgnCMake.cmake ++++ b/cmake/IgnCMake.cmake +@@ -37,3 +37,10 @@ include(IgnSanitizers) + #============================================================================ + include(CMakePackageConfigHelpers) + include(CMakeParseArguments) ++ ++set(IGNITION_CMAKE_DIR "${CMAKE_CURRENT_LIST_DIR}") ++set(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../..") ++set(IGNITION_CMAKE_DOXYGEN_DIR "${PACKAGE_PREFIX_DIR}/lib/ignition/ignition-cmake2/doxygen") ++set(IGNITION_CMAKE_CODECHECK_DIR "${PACKAGE_PREFIX_DIR}/lib/ignition/ignition-cmake2/codecheck") ++set(IGNITION_CMAKE_BENCHMARK_DIR "${PACKAGE_PREFIX_DIR}/lib/ignition/ignition-cmake2/benchmark") ++set(IGNITION_CMAKE_TOOLS_DIR "${PACKAGE_PREFIX_DIR}/lib/ignition/ignition-cmake2/tools") +diff --git a/cmake/IgnSetCompilerFlags.cmake b/cmake/IgnSetCompilerFlags.cmake +index 0a6b5b5..03df75b 100644 +--- a/cmake/IgnSetCompilerFlags.cmake ++++ b/cmake/IgnSetCompilerFlags.cmake +@@ -77,9 +77,9 @@ macro(ign_setup_unix) + exec_program(${CMAKE_UNAME} ARGS -m OUTPUT_VARIABLE CMAKE_SYSTEM_PROCESSOR) + set(CMAKE_SYSTEM_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR} CACHE INTERNAL + "processor type (i386 and x86_64)") +- if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64") +- set(IGN_ADD_fPIC_TO_LIBRARIES true) +- endif(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64") ++ # if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64") ++ # set(IGN_ADD_fPIC_TO_LIBRARIES true) ++ # endif(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64") + endif(CMAKE_UNAME) + + endmacro() +@@ -93,8 +93,10 @@ macro(ign_setup_apple) + # 10.x.x = Mac OSX Snow Leopard (10.6) + # 11.x.x = Mac OSX Lion (10.7) + # 12.x.x = Mac OSX Mountain Lion (10.8) +- if(${CMAKE_SYSTEM_VERSION} LESS 10) +- add_definitions(-DMAC_OS_X_VERSION=1050) ++ if(NOT CMAKE_SYSTEM_VERSION) ++ return() ++ elseif(${CMAKE_SYSTEM_VERSION} LESS 10) ++ add_definitions(-DMAC_OS_X_VERSION=1050) + elseif(${CMAKE_SYSTEM_VERSION} GREATER 10 AND ${CMAKE_SYSTEM_VERSION} LESS 11) + add_definitions(-DMAC_OS_X_VERSION=1060) + elseif(${CMAKE_SYSTEM_VERSION} GREATER 11 AND ${CMAKE_SYSTEM_VERSION} LESS 12) +diff --git a/cmake/IgnUtils.cmake b/cmake/IgnUtils.cmake +index 9b94c85..5e525e6 100644 +--- a/cmake/IgnUtils.cmake ++++ b/cmake/IgnUtils.cmake +@@ -1409,7 +1409,7 @@ macro(_ign_add_library_or_component) + # Generate export macro headers + # Note: INTERFACE libraries do not need the export header + set(binary_include_dir +- "${CMAKE_BINARY_DIR}/include/${include_dir}") ++ "${PROJECT_BINARY_DIR}/include/${include_dir}") + + set(implementation_file_name "${binary_include_dir}/detail/Export.hh") + diff --git a/recipes/ignition-cmake/all/patches/0001-cmake-fixes.patch b/recipes/ignition-cmake/all/patches/2.5.0-0001-fix-cmake.patch similarity index 100% rename from recipes/ignition-cmake/all/patches/0001-cmake-fixes.patch rename to recipes/ignition-cmake/all/patches/2.5.0-0001-fix-cmake.patch diff --git a/recipes/ignition-cmake/all/test_package/CMakeLists.txt b/recipes/ignition-cmake/all/test_package/CMakeLists.txt index 9595663869a7f..de43752ed5575 100644 --- a/recipes/ignition-cmake/all/test_package/CMakeLists.txt +++ b/recipes/ignition-cmake/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ -cmake_minimum_required(VERSION 3.10.2) +cmake_minimum_required(VERSION 3.15) project(test_package VERSION 1.0) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - set(IGN_CMAKE_VER "" CACHE STRING "Version of igition-cmake") if(NOT IGN_CMAKE_VER) diff --git a/recipes/ignition-cmake/all/test_package/conanfile.py b/recipes/ignition-cmake/all/test_package/conanfile.py index 5b49fe0a15144..708eb36d16238 100644 --- a/recipes/ignition-cmake/all/test_package/conanfile.py +++ b/recipes/ignition-cmake/all/test_package/conanfile.py @@ -1,23 +1,47 @@ import os -from conans import CMake, ConanFile, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake, CMakeToolchain, CMakeDeps +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" - + settings = "os", "arch", "compiler", "build_type" + generators = "VirtualRunEnv" test_type = "explicit" + def requirements(self): - self.requires(self.tested_reference_str) + # For headers + self.requires(self.tested_reference_str) + + def build_requirements(self): + # For *.cmake files + self.tool_requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["IGN_CMAKE_VER"] = Version(self.dependencies["ignition-cmake"].ref.version).major + tc.generate() + deps = CMakeDeps(self) + # If using as a build requirement, the following lines are necessary + # deps.build_context_activated = ["ignition-cmake"] + # deps.build_context_build_modules = ["ignition-cmake"] + deps.generate() def build(self): cmake = CMake(self) - cmake.definitions["IGN_CMAKE_VER"] = tools.Version(self.deps_cpp_info["ignition-cmake"].version).major 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): + if is_msvc(self): + bin_path = os.path.join(self.build_folder, "bin", str(self.settings.build_type), "test_package") + else: + bin_path = os.path.join(self.build_folder, "bin", "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/ignition-cmake/all/test_package/src/CMakeLists.txt b/recipes/ignition-cmake/all/test_package/src/CMakeLists.txt index e050db890afd7..3934b5db47f4a 100644 --- a/recipes/ignition-cmake/all/test_package/src/CMakeLists.txt +++ b/recipes/ignition-cmake/all/test_package/src/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) ign_add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} ignition-cmake${IGN_CMAKE_VER}::utilities) diff --git a/recipes/ignition-cmake/all/test_v1_package/CMakeLists.txt b/recipes/ignition-cmake/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/ignition-cmake/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/ignition-cmake/all/test_v1_package/conanfile.py b/recipes/ignition-cmake/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..8f851887ec419 --- /dev/null +++ b/recipes/ignition-cmake/all/test_v1_package/conanfile.py @@ -0,0 +1,23 @@ +import os + +from conans import CMake, ConanFile, tools + + +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 build(self): + cmake = CMake(self) + cmake.definitions["IGN_CMAKE_VER"] = tools.Version(self.deps_cpp_info["ignition-cmake"].version).major + cmake.configure() + 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(bin_path, run_environment=True) diff --git a/recipes/ignition-cmake/config.yml b/recipes/ignition-cmake/config.yml index 90aed98c5dd74..1d34d3bb6f93d 100644 --- a/recipes/ignition-cmake/config.yml +++ b/recipes/ignition-cmake/config.yml @@ -1,5 +1,7 @@ versions: - "2.5.0": + "2.17.1": folder: all "2.10.0": folder: all + "2.5.0": + folder: all diff --git a/recipes/ignition-math/all/conanfile.py b/recipes/ignition-math/all/conanfile.py index 3af2ddca7b420..4e3d073bc2587 100644 --- a/recipes/ignition-math/all/conanfile.py +++ b/recipes/ignition-math/all/conanfile.py @@ -67,7 +67,7 @@ def configure(self): def requirements(self): self.requires("eigen/3.3.9") - self.requires("doxygen/1.8.17") + self.requires("doxygen/[>=1.8 <2]") self.requires("swig/4.0.2") def build_requirements(self): diff --git a/recipes/ignition-utils/all/conanfile.py b/recipes/ignition-utils/all/conanfile.py index 0086df1bf32b9..40a49d79dc3da 100644 --- a/recipes/ignition-utils/all/conanfile.py +++ b/recipes/ignition-utils/all/conanfile.py @@ -75,7 +75,7 @@ def validate(self): ) def requirements(self): - self.requires("doxygen/1.9.2") + self.requires("doxygen/[>=1.8 <2]") if self.options.ign_utils_vendor_cli11: self.requires("cli11/2.1.2") diff --git a/recipes/iguana/all/conandata.yml b/recipes/iguana/all/conandata.yml new file mode 100644 index 0000000000000..3e9e419a87075 --- /dev/null +++ b/recipes/iguana/all/conandata.yml @@ -0,0 +1,13 @@ +sources: + "1.0.6": + url: "https://github.com/qicosmos/iguana/archive/refs/tags/1.0.6.tar.gz" + sha256: "cfacf1cce4ebe49b947ec823f93a23c2a7fd220f67f6847e9f449e7c469deb9e" + "1.0.5": + url: "https://github.com/qicosmos/iguana/archive/refs/tags/1.0.5.tar.gz" + sha256: "b7a7385c49574a60f9f6bf887c1addbc08f557a0117bf18cf7eec532ac2536b1" + "1.0.4": + url: "https://github.com/qicosmos/iguana/archive/refs/tags/1.0.4.tar.gz" + sha256: "b584cd26e65902a14a3a349ebc480beb7b4502fd5a5ffa3cb7c6102d857958b1" + "1.0.3": + url: "https://github.com/qicosmos/iguana/archive/refs/tags/v1.0.3.tar.gz" + sha256: "7dcb21a36bd64a63a9ea857f3563ac61e965c49ec60ad7b99a2bfb9192f3e4c3" diff --git a/recipes/iguana/all/conanfile.py b/recipes/iguana/all/conanfile.py new file mode 100644 index 0000000000000..20b73f1969975 --- /dev/null +++ b/recipes/iguana/all/conanfile.py @@ -0,0 +1,78 @@ +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.52.0" + +class IguanaConan(ConanFile): + name = "iguana" + description = "universal serialization engine" + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/qicosmos/iguana" + topics = ("serialization", "json", "xml", "header-only") + package_type = "header-library" + 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", + "Visual Studio": "16", + "msvc": "192", + } + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("frozen/1.1.1", 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 package(self): + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + copy( + self, + "*.h", + os.path.join(self.source_folder, "iguana"), + os.path.join(self.package_folder, "include", "iguana"), + ) + copy( + self, + "*.hpp", + os.path.join(self.source_folder, "iguana"), + os.path.join(self.package_folder, "include", "iguana"), + ) + + 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("pthread") + self.cpp_info.system_libs.append("dl") diff --git a/recipes/iguana/all/test_package/CMakeLists.txt b/recipes/iguana/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..b17ea62c13e23 --- /dev/null +++ b/recipes/iguana/all/test_package/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(iguana REQUIRED CONFIG) + +if(iguana_VERSION VERSION_GREATER_EQUAL "1.0.6") + add_executable(${PROJECT_NAME} test_package.cpp) +else() + add_executable(${PROJECT_NAME} test_package_1_0_5.cpp) +endif() +target_link_libraries(${PROJECT_NAME} PRIVATE iguana::iguana) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/iguana/all/test_package/conanfile.py b/recipes/iguana/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/iguana/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/iguana/all/test_package/test_package.cpp b/recipes/iguana/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..4e191ae1388a2 --- /dev/null +++ b/recipes/iguana/all/test_package/test_package.cpp @@ -0,0 +1,88 @@ +#include +#include +#include + +namespace client { +struct person { + std::string name; + int64_t age; +}; + +#if __cplusplus < 202002L +YLT_REFL(person, name, age); +#endif +} // namespace client + +struct MyStruct { + uint64_t a; +}; +#if __cplusplus < 202002L +YLT_REFL(MyStruct, a); +#endif + +struct student { + int id; + std::string name; + int age; +}; +#if __cplusplus < 202002L +YLT_REFL(student, id, name, age); +#endif + +void test() { + MyStruct p = {5566777755311}; + iguana::string_stream ss; + iguana::to_json(p, ss); + + MyStruct p2; + iguana::from_json(p2, ss); + std::cout << p2.a << std::endl; +} + +void test_v() { + client::person p1 = {"tom", 20}; + client::person p2 = {"jack", 19}; + client::person p3 = {"mike", 21}; + + std::vector v{p1, p2, p3}; + iguana::string_stream ss; + iguana::to_json(v, ss); + std::cout << ss << std::endl; + + std::vector v1; + iguana::from_json(v1, ss); +} + +void test_disorder() { + student s{1, "tom", 20}; + iguana::string_stream ss; + iguana::to_json(s, ss); + std::cout << ss << std::endl; + + student s1{}; + std::string str = "{\"name\":\"tom\",\"id\":1,\"age\":20}"; + iguana::from_json(s1, str.data(), str.length()); + std::string str1 = "{\"name\":\"tom\",\"age\":20,\"id\":1}"; + iguana::from_json(s1, str1.data(), str1.length()); + + std::string str2 = "{ \"id\":1,\"name\" : \"madoka\",\"age\" : 27 }"; + iguana::from_json(s1, str2.data(), str2.length()); +} + +int main(void) { + test_disorder(); + test_v(); + test(); + client::person p = {"zombie chow", -311}; + iguana::string_stream ss; + iguana::to_json(p, ss); + + std::cout << ss << std::endl; + client::person p2; + + iguana::from_json(p2, ss.data(), ss.length()); + + std::cout << p2.name << " - " << p2.age << std::endl; + + return 0; +} diff --git a/recipes/iguana/all/test_package/test_package_1_0_5.cpp b/recipes/iguana/all/test_package/test_package_1_0_5.cpp new file mode 100644 index 0000000000000..f97e8fb335c14 --- /dev/null +++ b/recipes/iguana/all/test_package/test_package_1_0_5.cpp @@ -0,0 +1,81 @@ +#include +#include + +namespace client { +struct person { + std::string name; + int64_t age; +}; + +REFLECTION(person, name, age); +} // namespace client + +struct MyStruct { + uint64_t a; +}; +REFLECTION(MyStruct, a); + +struct student { + int id; + std::string name; + int age; +}; +REFLECTION(student, id, name, age); + +void test() { + MyStruct p = {5566777755311}; + iguana::string_stream ss; + iguana::to_json(p, ss); + + MyStruct p2; + iguana::from_json(p2, ss); + std::cout << p2.a << std::endl; +} + +void test_v() { + client::person p1 = {"tom", 20}; + client::person p2 = {"jack", 19}; + client::person p3 = {"mike", 21}; + + std::vector v{p1, p2, p3}; + iguana::string_stream ss; + iguana::to_json(v, ss); + std::cout << ss << std::endl; + + std::vector v1; + iguana::from_json(v1, ss); +} + +void test_disorder() { + student s{1, "tom", 20}; + iguana::string_stream ss; + iguana::to_json(s, ss); + std::cout << ss << std::endl; + + student s1{}; + std::string str = "{\"name\":\"tom\",\"id\":1,\"age\":20}"; + iguana::from_json(s1, str.data(), str.length()); + std::string str1 = "{\"name\":\"tom\",\"age\":20,\"id\":1}"; + iguana::from_json(s1, str1.data(), str1.length()); + + std::string str2 = "{ \"id\":1,\"name\" : \"madoka\",\"age\" : 27 }"; + iguana::from_json(s1, str2.data(), str2.length()); +} + +int main(void) { + test_disorder(); + test_v(); + test(); + client::person p = {"zombie chow", -311}; + iguana::string_stream ss; + iguana::to_json(p, ss); + + std::cout << ss << std::endl; + client::person p2; + + iguana::from_json(p2, ss.data(), ss.length()); + + std::cout << p2.name << " - " << p2.age << std::endl; + + return 0; +} diff --git a/recipes/iguana/config.yml b/recipes/iguana/config.yml new file mode 100644 index 0000000000000..c64afb84e8dad --- /dev/null +++ b/recipes/iguana/config.yml @@ -0,0 +1,9 @@ +versions: + "1.0.6": + folder: all + "1.0.5": + folder: all + "1.0.4": + folder: all + "1.0.3": + folder: all diff --git a/recipes/iir1/all/conandata.yml b/recipes/iir1/all/conandata.yml index dcf07a8d3050e..f693ec80aa1be 100644 --- a/recipes/iir1/all/conandata.yml +++ b/recipes/iir1/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.9.4": + url: "https://github.com/berndporr/iir1/archive/refs/tags/1.9.4.tar.gz" + sha256: "67d0982356f33fd37522e4711cda12f70a981a9c83de332386f89de3d7601d2b" "1.9.1": url: "https://github.com/berndporr/iir1/archive/refs/tags/1.9.1.tar.gz" sha256: "97b4a7d62fa4859ac0d80283696b0d91c320b61ec2a455cdd3d8cfbb2be3ad9a" @@ -11,10 +14,6 @@ patches: patch_description: "Avoid to define __declspec(dllexport) on windows at consume time & in static lib" patch_type: "portability" sha256: "b29a0a2f4e6f76c57b7a8e4051173a0e82d7d154571377a0fbd75fd73e4fa73c" - - patch_file: "patches/1.9.0-0003-disable-test-demo.patch" - patch_description: "Do not build test & demo" - patch_type: "conan" - sha256: "5b866e0a6d536f12386ecc212c47a993b9e891584879fd507f8b86f596f97cdd" "1.9.0": - patch_file: "patches/1.9.0-0001-no-export-static-win.patch" patch_description: "Avoid to define __declspec(dllexport) on windows at consume time & in static lib" @@ -24,7 +23,3 @@ patches: patch_description: "Install dll to bin folder" patch_type: "portability" sha256: "2f423eb1ee633a03c30d60f58a125f118cf9323402983c908708e7a6478e4bf6" - - patch_file: "patches/1.9.0-0003-disable-test-demo.patch" - patch_description: "Do not build test & demo" - patch_type: "conan" - sha256: "5b866e0a6d536f12386ecc212c47a993b9e891584879fd507f8b86f596f97cdd" diff --git a/recipes/iir1/all/conanfile.py b/recipes/iir1/all/conanfile.py index 07124a82ae39d..101593b61dcea 100644 --- a/recipes/iir1/all/conanfile.py +++ b/recipes/iir1/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, export_conandata_patches, get, rm, rmdir +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir, save from conan.tools.scm import Version import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class Iir1Conan(ConanFile): @@ -20,6 +20,7 @@ class Iir1Conan(ConanFile): homepage = "https://github.com/berndporr/iir1" topics = ("dsp", "signals", "filtering") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -47,21 +48,17 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + 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"): + 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -69,8 +66,14 @@ def generate(self): tc.preprocessor_definitions["IIR1_NO_EXCEPTIONS"] = "1" tc.generate() - def build(self): + def _patch_sources(self): apply_conandata_patches(self) + # Disable test and demo subdirs + save(self, os.path.join(self.source_folder, "test", "CMakeLists.txt"), "") + save(self, os.path.join(self.source_folder, "demo", "CMakeLists.txt"), "") + + def build(self): + self._patch_sources() cmake = CMake(self) cmake.configure() cmake.build() @@ -96,6 +99,8 @@ def package_info(self): self.cpp_info.components["iir"].libs = [name] if self.options.get_safe("noexceptions"): self.cpp_info.components["iir"].defines.append("IIR1_NO_EXCEPTIONS") + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["iir"].system_libs.append("m") # TODO: to remove in conan v2 self.cpp_info.names["cmake_find_package"] = "iir" 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 deleted file mode 100644 index 18bc682ab4948..0000000000000 --- a/recipes/iir1/all/patches/1.9.0-0003-disable-test-demo.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- 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/config.yml b/recipes/iir1/config.yml index 8e492271b1dfd..01169b44873a4 100644 --- a/recipes/iir1/config.yml +++ b/recipes/iir1/config.yml @@ -1,4 +1,6 @@ versions: + "1.9.4": + folder: "all" "1.9.1": folder: "all" "1.9.0": diff --git a/recipes/im95able-rea/all/conandata.yml b/recipes/im95able-rea/all/conandata.yml new file mode 100644 index 0000000000000..a13404bd2b981 --- /dev/null +++ b/recipes/im95able-rea/all/conandata.yml @@ -0,0 +1,9 @@ +sources: + "cci.20190225": + url: "https://github.com/im95able/Rea/archive/064d99897c9dcc547dc38853dcd917ba04a34ef4.tar.gz" + sha256: "efcf822116ea22422d2ea5249250cd5d13db54ab65b1a84a3f16c5d7413aed7e" +patches: + "cci.20190225": + - patch_file: "patches/0001-include-limits.patch" + patch_description: "include limits" + patch_type: "portability" diff --git a/recipes/im95able-rea/all/conanfile.py b/recipes/im95able-rea/all/conanfile.py new file mode 100644 index 0000000000000..66b814aa4851f --- /dev/null +++ b/recipes/im95able-rea/all/conanfile.py @@ -0,0 +1,82 @@ +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 Im95ableReaConan(ConanFile): + name = "im95able-rea" + description = ( + "Lightweight library of data structures implemented in C++11, " + "designed for constant time insertion, erasure, lookup, and fastest possible iteration." + ) + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/im95able/Rea/" + topics = ("slot_map", "slot_list", "header-only") + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + + @property + def _min_cppstd(self): + return 14 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "6", + "clang": "5", + "apple-clang": "10", + "Visual Studio": "15", + "msvc": "191", + } + + 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) + 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): + 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="*.h", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "Rea"), + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + self.cpp_info.set_property("cmake_file_name", "rea") + self.cpp_info.set_property("cmake_target_name", "rea::rea") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "rea" + self.cpp_info.filenames["cmake_find_package_multi"] = "rea" + self.cpp_info.names["cmake_find_package"] = "rea" + self.cpp_info.names["cmake_find_package_multi"] = "rea" diff --git a/recipes/im95able-rea/all/patches/0001-include-limits.patch b/recipes/im95able-rea/all/patches/0001-include-limits.patch new file mode 100644 index 0000000000000..6b3cced25f67f --- /dev/null +++ b/recipes/im95able-rea/all/patches/0001-include-limits.patch @@ -0,0 +1,12 @@ +diff --git a/Rea/rea.h b/Rea/rea.h +index 2cc0a25..8cf57cc 100644 +--- a/Rea/rea.h ++++ b/Rea/rea.h +@@ -30,6 +30,7 @@ SOFTWARE. + #include + #include + #include ++#include + + + namespace rea { diff --git a/recipes/im95able-rea/all/test_package/CMakeLists.txt b/recipes/im95able-rea/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..b670ff5e6af64 --- /dev/null +++ b/recipes/im95able-rea/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(rea REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE rea::rea) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/im95able-rea/all/test_package/conanfile.py b/recipes/im95able-rea/all/test_package/conanfile.py new file mode 100644 index 0000000000000..b9d7f11e89dcd --- /dev/null +++ b/recipes/im95able-rea/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 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/im95able-rea/all/test_package/test_package.cpp b/recipes/im95able-rea/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..9f43b119dca2d --- /dev/null +++ b/recipes/im95able-rea/all/test_package/test_package.cpp @@ -0,0 +1,7 @@ +#include "rea.h" + +int main() { + auto sl = rea::slot_list{}; + + return 0; +} diff --git a/recipes/im95able-rea/all/test_v1_package/CMakeLists.txt b/recipes/im95able-rea/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..be00a8c7f57c7 --- /dev/null +++ b/recipes/im95able-rea/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/im95able-rea/all/test_v1_package/conanfile.py b/recipes/im95able-rea/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/im95able-rea/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/im95able-rea/config.yml b/recipes/im95able-rea/config.yml new file mode 100644 index 0000000000000..5ed6e21978a2a --- /dev/null +++ b/recipes/im95able-rea/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20190225": + folder: all diff --git a/recipes/imagemagick/all/conanfile.py b/recipes/imagemagick/all/conanfile.py index 4e944b9046b3f..49e0388b61d25 100644 --- a/recipes/imagemagick/all/conanfile.py +++ b/recipes/imagemagick/all/conanfile.py @@ -108,7 +108,7 @@ def requirements(self): if self.options.with_lzma: self.requires("xz_utils/5.2.5") if self.options.with_lcms: - self.requires("lcms/2.11") + self.requires("lcms/2.16") if self.options.with_openexr: self.requires("openexr/2.5.7") if self.options.with_heic: diff --git a/recipes/imagl/all/CMakeLists.txt b/recipes/imagl/all/CMakeLists.txt deleted file mode 100644 index 434aea21733de..0000000000000 --- a/recipes/imagl/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/imagl/all/conandata.yml b/recipes/imagl/all/conandata.yml index 4c28973c33e6b..83cf32f1dbe98 100644 --- a/recipes/imagl/all/conandata.yml +++ b/recipes/imagl/all/conandata.yml @@ -1,26 +1,42 @@ sources: "0.1.0": - url: "https://gitlab-lepuy.iut-clermont.uca.fr/opengl/imagl/-/archive/v0.1.0/imagl-v0.1.0.tar.gz" - sha256: "9dcfba4c2efa8d44bf4cc9edd324794865dd6d6331467d3c69f5c5574db3844e" + url: "https://github.com/Woazim/imaGL/archive/refs/tags/v0.1.0.tar.gz" + sha256: "070d155f61c3036be67683dcec7bef57d5407f5aa7ca35487358b55fd2762ef8" "0.1.1": - url: "https://gitlab-lepuy.iut-clermont.uca.fr/opengl/imagl/-/archive/v0.1.1/imagl-v0.1.1.tar.gz" - sha256: "4a7502cc733431af6423246fe5144e2eddb984454a66cca51742c852980ac862" + url: "https://github.com/Woazim/imaGL/archive/refs/tags/v0.1.1.tar.gz" + sha256: "25c1df00dfd1741b013044de9407f30f58ca64d155d862db740518ed8667f3ec" "0.1.2": - url: "https://gitlab-lepuy.iut-clermont.uca.fr/opengl/imagl/-/archive/v0.1.2/imagl-v0.1.2.tar.gz" - sha256: "d1edf74e00f969a47dc56e4400b805600d6997270339d49e91b7c6112a2cb37e" + url: "https://github.com/Woazim/imaGL/archive/refs/tags/v0.1.2.tar.gz" + sha256: "03296707f4c6b5a03cd4d6670c7444c0660d22ca09de981e57fcb75111fd16a5" "0.2.1": - url: "https://gitlab-lepuy.iut-clermont.uca.fr/opengl/imagl/-/archive/v0.2.1/imagl-v0.2.1.tar.gz" - sha256: "5a68cdeff4338e411695cca16c4230567de298f8efee2a9fadcc6fa644a70248" + url: "https://github.com/Woazim/imaGL/archive/refs/tags/v0.2.1.tar.gz" + sha256: "b0109b1d0cadf3054ad959ed4a0420b61202f8143f5a7ad766c1e449603d30d8" patches: "0.1.0": - patch_file: "patches/0001-no-unmanaged-conan-0.1.x.patch" - base_path: "source_subfolder" + patch_description: "No unmanaged conan: update CMakeLists.txt remove call to conan" + patch_type: conan + - patch_file: "patches/0002-use-findpackage-0.1.x.patch" + patch_description: "Use find_package: update CMakeLists.txt to use modern find_package compatible with conan 2.0" + patch_type: conan "0.1.1": - patch_file: "patches/0001-no-unmanaged-conan-0.1.x.patch" - base_path: "source_subfolder" + patch_description: "No unmanaged conan: update CMakeLists.txt remove call to conan" + patch_type: conan + - patch_file: "patches/0002-use-findpackage-0.1.x.patch" + patch_description: "Use find_package: update CMakeLists.txt to use modern find_package compatible with conan 2.0" + patch_type: conan "0.1.2": - patch_file: "patches/0001-no-unmanaged-conan-0.1.x.patch" - base_path: "source_subfolder" + patch_description: "No unmanaged conan: update CMakeLists.txt remove call to conan" + patch_type: conan + - patch_file: "patches/0002-use-findpackage-0.1.x.patch" + patch_description: "Use find_package: update CMakeLists.txt to use modern find_package compatible with conan 2.0" + patch_type: conan "0.2.1": - patch_file: "patches/0001-no-unmanaged-conan-0.2.1.patch" - base_path: "source_subfolder" + patch_description: "No unmanaged conan: update CMakeLists.txt remove call to conan" + patch_type: conan + - patch_file: "patches/0002-use-findpackage-0.2.1.patch" + patch_description: "Use find_package: update CMakeLists.txt to use modern find_package compatible with conan 2.0" + patch_type: conan diff --git a/recipes/imagl/all/conanfile.py b/recipes/imagl/all/conanfile.py index a8994d4c2ba67..485f56d442ad3 100644 --- a/recipes/imagl/all/conanfile.py +++ b/recipes/imagl/all/conanfile.py @@ -1,12 +1,18 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps +from conan.tools.scm import Version +from conan.tools.build import check_min_cppstd +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy +from conan.tools.microsoft import is_msvc, check_min_vs +from conan.errors import ConanInvalidConfiguration +import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class ImaglConan(ConanFile): name = "imagl" - license = "GPL-3.0-or-later" + license = "LGPL-3.0-only" homepage = "https://github.com/Woazim/imaGL" url = "https://github.com/conan-io/conan-center-index" description = "A lightweight library to load image for OpenGL application." @@ -24,108 +30,88 @@ class ImaglConan(ConanFile): "with_png": True, "with_jpeg": 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 _min_cppstd(self): + return 20 @property def _compilers_minimum_version(self): - minimum_versions = { + return { "gcc": "9", - "Visual Studio": "16.2", - "msvc": "19.22", "clang": "10", "apple-clang": "11" } - if tools.Version(self.version) <= "0.1.1" or tools.Version(self.version) == "0.2.0": - minimum_versions["Visual Studio"] = "16.5" - minimum_versions["msvc"] = "19.25" - return minimum_versions @property def _supports_jpeg(self): - return tools.Version(self.version) >= "0.2.0" + return Version(self.version) >= "0.2.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") if not self._supports_jpeg: - del self.options.with_jpeg + self.options.rm_safe("with_jpeg") 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_png: - self.requires("libpng/1.6.37") + self.requires("libpng/[>=1.6 <2]") if self._supports_jpeg and self.options.with_jpeg: - self.requires("libjpeg/9d") + self.requires("libjpeg/9e") def validate(self): if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 20) - - 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] - - #Special check for clang that can only be linked to libc++ - if self.settings.compiler == "clang" and self.settings.compiler.libcxx != "libc++": + 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." + ) + + # INFO: Special check for clang that can only be linked to libc++ + if self.settings.compiler == "clang" and self.settings.get_safe("compiler.libcxx") != "libc++": raise ConanInvalidConfiguration("imagl requires some C++20 features, which are available in libc++ for clang compiler.") - compiler_version = str(self.settings.compiler.version) - - minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) - if not minimum_version: - self.output.warn("imaGL requires C++20. Your compiler is unknown. Assuming it supports C++20.") - elif lazy_lt_semver(compiler_version, minimum_version): - raise ConanInvalidConfiguration("imaGL requires some C++20 features, which your {} {} compiler does not support.".format(str(self.settings.compiler), compiler_version)) - else: - print("Your compiler is {} {} and is compatible.".format(str(self.settings.compiler), compiler_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["STATIC_LIB"] = not self.options.shared - self._cmake.definitions["SUPPORT_PNG"] = self.options.with_png + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + deps = CMakeDeps(self) + deps.generate() + tc = CMakeToolchain(self) + tc.variables["STATIC_LIB"] = not self.options.shared + tc.variables["SUPPORT_PNG"] = self.options.with_png if self._supports_jpeg: - self._cmake.definitions["SUPPORT_JPEG"] = self.options.with_jpeg - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + tc.variables["SUPPORT_JPEG"] = self.options.with_jpeg + 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", self.source_folder, os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() def package_info(self): debug_suffix = "d" if self.settings.build_type == "Debug" else "" static_suffix = "" if self.options.shared else "s" - self.cpp_info.libs = ["imaGL{}{}".format(debug_suffix, static_suffix)] + self.cpp_info.libs = [f"imaGL{debug_suffix}{static_suffix}"] if not self.options.shared: self.cpp_info.defines = ["IMAGL_STATIC=1"] - diff --git a/recipes/imagl/all/patches/0002-use-findpackage-0.1.x.patch b/recipes/imagl/all/patches/0002-use-findpackage-0.1.x.patch new file mode 100644 index 0000000000000..8be7d6463c6b8 --- /dev/null +++ b/recipes/imagl/all/patches/0002-use-findpackage-0.1.x.patch @@ -0,0 +1,15 @@ +--- a/imaGL/CMakeLists.txt ++++ b/imaGL/CMakeLists.txt +@@ -12,9 +12,10 @@ set_property(TARGET libImaGL PROPERTY OUTPUT_NAME imaGL) + set_property(TARGET libImaGL PROPERTY PUBLIC_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/public/imaGL/imaGL.h") + target_include_directories(libImaGL INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/public") + +-if(TARGET CONAN_PKG::libpng) ++find_package(PNG) ++if(PNG_FOUND) + add_compile_definitions(_HAS_PNG) +- target_link_libraries (libImaGL CONAN_PKG::libpng) ++ target_link_libraries (libImaGL PNG::PNG) + endif() + + file(GLOB_RECURSE ImaGL_SRC "*.h" "*.cpp") diff --git a/recipes/imagl/all/patches/0002-use-findpackage-0.2.1.patch b/recipes/imagl/all/patches/0002-use-findpackage-0.2.1.patch new file mode 100644 index 0000000000000..0053f809e4461 --- /dev/null +++ b/recipes/imagl/all/patches/0002-use-findpackage-0.2.1.patch @@ -0,0 +1,23 @@ +--- a/imaGL/CMakeLists.txt ++++ b/imaGL/CMakeLists.txt +@@ -12,14 +12,16 @@ set_property(TARGET libImaGL PROPERTY OUTPUT_NAME imaGL) + set_property(TARGET libImaGL PROPERTY PUBLIC_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/public/imaGL/imaGL.h") + target_include_directories(libImaGL INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/public") + +-if(TARGET CONAN_PKG::libpng) ++find_package(PNG) ++if(PNG_FOUND) + add_compile_definitions(_HAS_PNG) +- target_link_libraries (libImaGL CONAN_PKG::libpng) ++ target_link_libraries (libImaGL PNG::PNG) + endif() + +-if(TARGET CONAN_PKG::libjpeg) ++find_package(JPEG) ++if(JPEG_FOUND) + add_compile_definitions(_HAS_JPEG) +- target_link_libraries (libImaGL CONAN_PKG::libjpeg) ++ target_link_libraries (libImaGL JPEG::JPEG) + endif() + + file(GLOB_RECURSE ImaGL_SRC "*.h" "*.cpp") diff --git a/recipes/imagl/all/test_package/CMakeLists.txt b/recipes/imagl/all/test_package/CMakeLists.txt index 15d229320021c..ba0d23b2326bb 100644 --- a/recipes/imagl/all/test_package/CMakeLists.txt +++ b/recipes/imagl/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(PackageTest CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(imagl CONFIG REQUIRED) add_executable(example example.cpp) -target_link_libraries(example ${CONAN_LIBS}) -set_target_properties(example PROPERTIES CXX_STANDARD 20 CXX_STANDARD_REQUIRED ON) +target_link_libraries(example PRIVATE imagl::imagl) +target_compile_features(example PRIVATE cxx_std_20) diff --git a/recipes/imagl/all/test_package/conanfile.py b/recipes/imagl/all/test_package/conanfile.py index 156e2a8976e7c..0d267f1fe3b58 100644 --- a/recipes/imagl/all/test_package/conanfile.py +++ b/recipes/imagl/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 ImaglTestConan(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) @@ -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.bindir, "example") + self.run(bin_path, env="conanrun") diff --git a/recipes/imagl/all/test_v1_package/CMakeLists.txt b/recipes/imagl/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/imagl/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/imagl/all/test_v1_package/conanfile.py b/recipes/imagl/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..923bd771c14e7 --- /dev/null +++ b/recipes/imagl/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +import os +from conans import ConanFile, CMake, tools + + +class ImaglTestConan(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", "example") + self.run(bin_path, run_environment=True) diff --git a/recipes/imake/all/conandata.yml b/recipes/imake/all/conandata.yml index b60e9f5b7c62c..36a5068b003f9 100644 --- a/recipes/imake/all/conandata.yml +++ b/recipes/imake/all/conandata.yml @@ -1,10 +1,14 @@ sources: + "1.0.9": + url: "https://www.x.org/releases/individual/util/imake-1.0.9.tar.gz" + sha256: "ca53ad18c683091490596d72fee8dbee4c6ddb7693709e25f26da140d29687c1" "1.0.8": url: "https://www.x.org/releases/individual/util/imake-1.0.8.tar.gz" sha256: "8178a09bfef33ad5f61cb5cb62283df7d3a5682f014507d2e7cfd922485a5c00" patches: + "1.0.9": + - patch_file: "patches/0001-reproducible-behavior.patch" + - patch_file: "patches/0002-msvc-debug-build_type.patch" "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..490f157a75b1f 100644 --- a/recipes/imake/all/conanfile.py +++ b/recipes/imake/all/conanfile.py @@ -1,17 +1,24 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment -import contextlib +from conan import ConanFile +from conan.tools.env import VirtualBuildEnv +from conan.errors import ConanInvalidConfiguration +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 +41,60 @@ 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 validate(self): + if self.settings.compiler == "clang": + # See https://github.com/conan-io/conan-center-index/pull/16267#issuecomment-1469824504 + raise ConanInvalidConfiguration("Recipe cannot be built with clang") 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/2.0.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 +106,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..9f73275ca1219 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.4") + + 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/imake/config.yml b/recipes/imake/config.yml index 28e3ee22ca8ac..1c656ce0b375f 100644 --- a/recipes/imake/config.yml +++ b/recipes/imake/config.yml @@ -1,3 +1,5 @@ versions: + "1.0.9": + folder: all "1.0.8": folder: all diff --git a/recipes/imath/all/conandata.yml b/recipes/imath/all/conandata.yml index c74e535dae312..afe9fa4328195 100644 --- a/recipes/imath/all/conandata.yml +++ b/recipes/imath/all/conandata.yml @@ -1,10 +1,22 @@ 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" - "3.1.4": - url: "https://github.com/AcademySoftwareFoundation/Imath/archive/refs/tags/v3.1.4.tar.gz" - sha256: "fcca5fbb37d375a252bacd8a29935569bdc28b888f01ef1d9299ca0c9e87c17a" + "3.1.12": + url: "https://github.com/AcademySoftwareFoundation/Imath/archive/v3.1.12.tar.gz" + sha256: "8a1bc258f3149b5729c2f4f8ffd337c0e57f09096e4ba9784329f40c4a9035da" + "3.1.11": + url: "https://github.com/AcademySoftwareFoundation/Imath/archive/v3.1.11.tar.gz" + sha256: "9057849585e49b8b85abe7cc1e76e22963b01bfdc3b6d83eac90c499cd760063" + "3.1.10": + url: "https://github.com/AcademySoftwareFoundation/Imath/archive/v3.1.10.tar.gz" + sha256: "f2943e86bfb694e216c60b9a169e5356f8a90f18fbd34d7b6e3450be14f60b10" + "3.1.9": + url: "https://github.com/AcademySoftwareFoundation/Imath/archive/v3.1.9.tar.gz" + sha256: "f1d8aacd46afed958babfced3190d2d3c8209b66da451f556abd6da94c165cf3" + "3.1.8": + url: "https://github.com/AcademySoftwareFoundation/Imath/archive/v3.1.8.tar.gz" + sha256: "a23a4e2160ca8ff68607a4e129e484edd1d0d13f707394d32af7aed659020803" +patches: + "3.1.10": + - patch_file: "patches/3.1.10-gcc5-backport.patch" + patch_description: "Add std:: prefix for isfinite (Backport from main, two commits on the file fix the issue)" + patch_type: "official" + patch_source: "https://github.com/AcademySoftwareFoundation/Imath/blob/main/src/Imath/ImathFun.cpp" diff --git a/recipes/imath/all/conanfile.py b/recipes/imath/all/conanfile.py index 283ef1037345d..1493689ab88b1 100644 --- a/recipes/imath/all/conanfile.py +++ b/recipes/imath/all/conanfile.py @@ -1,10 +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 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 import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class ImathConan(ConanFile): @@ -18,6 +19,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], @@ -28,30 +30,38 @@ class ImathConan(ConanFile): "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: - 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) + if is_msvc(self) and self.settings.compiler.get_safe("cppstd"): + # when msvc is working with a C++ standard level higher + # than the default, we need the __cplusplus macro to be correct + tc.variables["CMAKE_CXX_FLAGS"] = "/Zc:__cplusplus" tc.generate() def build(self): + apply_conandata_patches(self) + cmake = CMake(self) cmake.configure() cmake.build() diff --git a/recipes/imath/all/patches/3.1.10-gcc5-backport.patch b/recipes/imath/all/patches/3.1.10-gcc5-backport.patch new file mode 100644 index 0000000000000..8d27e5461ad48 --- /dev/null +++ b/recipes/imath/all/patches/3.1.10-gcc5-backport.patch @@ -0,0 +1,34 @@ +diff --git src/Imath/ImathFun.cpp src/Imath/ImathFun.cpp +index bfec292..c8c2e7e 100644 +--- src/Imath/ImathFun.cpp ++++ src/Imath/ImathFun.cpp +@@ -10,25 +10,25 @@ IMATH_INTERNAL_NAMESPACE_SOURCE_ENTER + + float succf(float f) IMATH_NOEXCEPT + { +- return isfinite(f) ? ++ return std::isfinite(f) ? + std::nextafter(f, std::numeric_limits::infinity()) : f; + } + + float predf(float f) IMATH_NOEXCEPT + { +- return isfinite(f) ? ++ return std::isfinite(f) ? + std::nextafter(f, -std::numeric_limits::infinity()) : f; + } + + double succd(double d) IMATH_NOEXCEPT + { +- return isfinite(d) ? ++ return std::isfinite(d) ? + std::nextafter(d, std::numeric_limits::infinity()) : d; + } + + double predd(double d) IMATH_NOEXCEPT + { +- return isfinite(d) ? ++ return std::isfinite(d) ? + std::nextafter(d, -std::numeric_limits::infinity()) : d; + } + 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 566850eaffa71..299f457f6ad28 100644 --- a/recipes/imath/config.yml +++ b/recipes/imath/config.yml @@ -1,7 +1,11 @@ versions: - "3.1.6": + "3.1.12": folder: all - "3.1.5": + "3.1.11": folder: all - "3.1.4": + "3.1.10": + folder: all + "3.1.9": + folder: all + "3.1.8": folder: all diff --git a/recipes/imgui/all/CMakeLists.txt b/recipes/imgui/all/CMakeLists.txt index 8c9bf128442ff..0626bf7008e52 100644 --- a/recipes/imgui/all/CMakeLists.txt +++ b/recipes/imgui/all/CMakeLists.txt @@ -7,6 +7,7 @@ set(IMGUI_EXPORT_HEADERS imgui_export_headers.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) @@ -15,6 +16,7 @@ endif() set(BINARY_TO_COMPRESSED_BIN binary_to_compressed_c) add_executable(${BINARY_TO_COMPRESSED_BIN} ${EXTRA_FONTS_DIR}/binary_to_compressed_c.cpp) +target_compile_features(${BINARY_TO_COMPRESSED_BIN} PRIVATE cxx_std_11) add_library(${PROJECT_NAME} ${SOURCE_FILES}) set_target_properties(${PROJECT_NAME} PROPERTIES diff --git a/recipes/imgui/all/conandata.yml b/recipes/imgui/all/conandata.yml index 9ed281a0bbcaf..f613b3daeb214 100644 --- a/recipes/imgui/all/conandata.yml +++ b/recipes/imgui/all/conandata.yml @@ -1,7 +1,70 @@ sources: - "1.89.1": - url: "https://github.com/ocornut/imgui/archive/v1.89.1.tar.gz" - sha256: "6d02a0079514d869e4b5f8f590f9060259385fcddd93a07ef21298b6a9610cbd" + "1.91.5": + url: "https://github.com/ocornut/imgui/archive/v1.91.5.tar.gz" + sha256: "2aa2d169c569368439e5d5667e0796d09ca5cc6432965ce082e516937d7db254" + "1.91.5-docking": + url: "https://github.com/ocornut/imgui/archive/v1.91.5-docking.tar.gz" + sha256: "f66c5d1b28fed044bd8dffa3882b4d1b29b2dbd1167fabe3d9d2219081e81cd8" + "1.91.4": + url: "https://github.com/ocornut/imgui/archive/v1.91.4.tar.gz" + sha256: "a455c28d987c78ddf56aab98ce0ff0fda791a23a2ec88ade46dd106b837f0923" + "1.91.4-docking": + url: "https://github.com/ocornut/imgui/archive/v1.91.4-docking.tar.gz" + sha256: "7405bdaf304b77d6d03e6d17d1f31ca3586fa0c65a466fa1dd71b6ca6a222023" + "1.91.3": + url: "https://github.com/ocornut/imgui/archive/v1.91.3.tar.gz" + sha256: "29949d7b300c30565fbcd66398100235b63aa373acfee0b76853a7aeacd1be28" + "1.91.3-docking": + url: "https://github.com/ocornut/imgui/archive/v1.91.3-docking.tar.gz" + sha256: "d462ccd0ca10cb412f8946c09ebd4cd0f62ca5def544dec5b3ce293c59f089fb" + "1.91.2": + url: "https://github.com/ocornut/imgui/archive/v1.91.2.tar.gz" + sha256: "a3c4fd857a0a48f6edad3e25de68fa1e96d2437f1665039714d1de9ad579b8d0" + "1.91.2-docking": + url: "https://github.com/ocornut/imgui/archive/v1.91.2-docking.tar.gz" + sha256: "bd6e9e6dc0451060152cea2a610256969c77a360659f4bd3836d6d4c9267229b" + "1.91.0": + url: "https://github.com/ocornut/imgui/archive/v1.91.0.tar.gz" + sha256: "6e62c87252e6b3725ba478a1c04dc604aa0aaeec78fedcf4011f1e52548f4cc9" + "1.91.0-docking": + url: "https://github.com/ocornut/imgui/archive/v1.91.0-docking.tar.gz" + sha256: "b08a569eedcf2bf25e763e034754fdbe37dfcb035072310781c92fa6e6504bf7" + "1.90.9": + url: "https://github.com/ocornut/imgui/archive/v1.90.9.tar.gz" + sha256: "04943919721e874ac75a2f45e6eb6c0224395034667bf508923388afda5a50bf" + "1.90.9-docking": + url: "https://github.com/ocornut/imgui/archive/v1.90.9-docking.tar.gz" + sha256: "48e7e4e4f154ad98d0946126a84e2375f849f6a67792129a805817dd60a34330" + "1.90.8": + url: "https://github.com/ocornut/imgui/archive/v1.90.8.tar.gz" + sha256: "f606b4fb406aa0f8dad36d4a9dd3d6f0fd39f5f0693e7468abc02d545fb505ae" + "1.90.8-docking": + url: "https://github.com/ocornut/imgui/archive/v1.90.8-docking.tar.gz" + sha256: "51845ed8b8e81490288c3c8165173d47e9bcf92f7d999aea800635f95587b9e7" + "1.90.7": + url: "https://github.com/ocornut/imgui/archive/v1.90.7.tar.gz" + sha256: "872574217643d4ad7e9e6df420bb8d9e0d468fb90641c2bf50fd61745e05de99" + "1.90.7-docking": + url: "https://github.com/ocornut/imgui/archive/v1.90.7-docking.tar.gz" + sha256: "582a9061a508b82b0ff6504aa17af6bb449bca9edf0a0f0f33bf729252cd3194" + "1.90.6": + url: "https://github.com/ocornut/imgui/archive/v1.90.6.tar.gz" + sha256: "70b4b05ac0938e82b4d5b8d59480d3e2ca63ca570dfb88c55023831f387237ad" + "1.90.6-docking": + url: "https://github.com/ocornut/imgui/archive/v1.90.6-docking.tar.gz" + sha256: "fc7f81d009ef718917aee0ac3ea1c74c8a5cfc8016049ad153b4d91d302b8aef" + "1.90.5": + url: "https://github.com/ocornut/imgui/archive/v1.90.5.tar.gz" + sha256: "e94b48dba7311c85ba8e3e6fe7c734d76a0eed21b2b42c5180fd5706d1562241" + "1.90.5-docking": + url: "https://github.com/ocornut/imgui/archive/v1.90.5-docking.tar.gz" + sha256: "8a5e1e594d6c8552e46e4c1ba8dd9deb51262067f04937904babc04384533ccc" + "1.89.9": + url: "https://github.com/ocornut/imgui/archive/v1.89.9.tar.gz" + sha256: "1acc27a778b71d859878121a3f7b287cd81c29d720893d2b2bf74455bf9d52d6" + "1.89.9-docking": + url: "https://github.com/ocornut/imgui/archive/v1.89.9-docking.tar.gz" + sha256: "2481489ce9091239b3cab8a330d0409ffdd9ee607ad1f3fe3a0b0b751c27a8eb" "1.88": url: "https://github.com/ocornut/imgui/archive/v1.88.tar.gz" sha256: "9f14c788aee15b777051e48f868c5d4d959bd679fc5050e3d2a29de80d8fd32e" @@ -14,13 +77,3 @@ sources: "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.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 8fc402938d64d..ffe8b2248047c 100644 --- a/recipes/imgui/all/conanfile.py +++ b/recipes/imgui/all/conanfile.py @@ -1,12 +1,13 @@ 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 +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout import os import re required_conan_version = ">=1.53.0" + class IMGUIConan(ConanFile): name = "imgui" description = "Bloat-free Immediate Mode Graphical User interface for C++ with minimal dependencies" @@ -14,6 +15,7 @@ class IMGUIConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/ocornut/imgui" topics = ("gui", "graphical", "bloat-free") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { @@ -40,7 +42,7 @@ 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) @@ -61,9 +63,12 @@ def build(self): cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() + def _match_docking_branch(self): + return re.match(r'cci\.\d{8}\+(?P\d+\.\d+(?:\.\d+))\.docking', str(self.version)) + def package(self): 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)) + m = self._match_docking_branch() version = Version(m.group('version')) if m else Version(self.version) backends_folder = os.path.join( self.source_folder, @@ -72,10 +77,21 @@ def package(self): copy(self, pattern="imgui_impl_*", dst=os.path.join(self.package_folder, "res", "bindings"), src=backends_folder) + copy(self, pattern="imgui*.cpp", + dst=os.path.join(self.package_folder, "res", "src"), + src=os.path.join(self.source_folder)) + copy(self, pattern="*.*", + dst=os.path.join(self.package_folder, "res", "misc", "cpp"), + src=os.path.join(self.source_folder, "misc", "cpp")) + copy(self, pattern="*.*", + dst=os.path.join(self.package_folder, "res", "misc", "freetype"), + src=os.path.join(self.source_folder, "misc", "freetype")) cmake = CMake(self) cmake.install() def package_info(self): + self.conf_info.define("user.imgui:with_docking", bool(self._match_docking_branch())) + self.cpp_info.libs = ["imgui"] if self.settings.os == "Linux": self.cpp_info.system_libs.append("m") diff --git a/recipes/imgui/all/test_package/CMakeLists.txt b/recipes/imgui/all/test_package/CMakeLists.txt index 3e9ea943d420e..e5abc72962c86 100644 --- a/recipes/imgui/all/test_package/CMakeLists.txt +++ b/recipes/imgui/all/test_package/CMakeLists.txt @@ -5,8 +5,12 @@ find_package(imgui REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE imgui::imgui) + +option(DOCKING "Test docking" OFF) + 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 a9fb96656f203..b97c0a2e4d75c 100644 --- a/recipes/imgui/all/test_package/conanfile.py +++ b/recipes/imgui/all/test_package/conanfile.py @@ -1,12 +1,13 @@ from conan import ConanFile from conan.tools.build import can_run -from conan.tools.cmake import cmake_layout, CMake +from conan.tools.cmake import cmake_layout, CMake, CMakeToolchain import os +import re class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + generators = "CMakeDeps", "VirtualRunEnv" test_type = "explicit" def requirements(self): @@ -15,6 +16,12 @@ def requirements(self): def layout(self): cmake_layout(self) + def generate(self): + with_docking = self.dependencies[self.tested_reference_str].conf_info.get("user.imgui:with_docking", False) + tc = CMakeToolchain(self) + tc.variables["DOCKING"] = with_docking + tc.generate() + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/imgui/all/test_package/test_package.cpp b/recipes/imgui/all/test_package/test_package.cpp index 6a0a221db872e..37c38430fa7a8 100644 --- a/recipes/imgui/all/test_package/test_package.cpp +++ b/recipes/imgui/all/test_package/test_package.cpp @@ -7,43 +7,11 @@ int main(int, char**) { - ImGuiContext* context =ImGui::CreateContext(); - ImGuiIO& io = ImGui::GetIO(); - - ImGuiTextBuffer textBuffer; - textBuffer.append("Hello, ImGui"); - - // Build atlas - unsigned char* tex_pixels = NULL; - int tex_w, tex_h; - io.Fonts->GetTexDataAsRGBA32(&tex_pixels, &tex_w, &tex_h); - - for (int n = 0; n < 50; n++) - { - printf("NewFrame() %d\n", n); - io.DisplaySize = ImVec2(1920, 1080); - io.DeltaTime = 1.0f / 60.0f; - ImGui::NewFrame(); - + printf("IMGUI VERSION: %s\n", IMGUI_VERSION); + ImGui::CreateContext(); #ifdef DOCKING - auto dockspaceID = ImGui::GetID("MyDockSpace"); - static ImGuiDockNodeFlags dockspace_flags = ImGuiDockNodeFlags_None; - ImGui::DockSpace(dockspaceID, ImVec2(0.0f, 0.0f), dockspace_flags); - printf(" with docking\n"); + printf(" with docking\n"); #endif - - static float f = 0.0f; - ImGui::Text("Hello, world!"); - ImGui::Text("%s", textBuffer.begin()); - ImGui::SliderFloat("float", &f, 0.0f, 1.0f); - ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / io.Framerate, io.Framerate); - ImGui::MyFunction("test_package"); // ensure we are using our provided IMGUI_USER_CONFIG - ImGui::ShowDemoWindow(NULL); - - ImGui::Render(); - } - - printf("DestroyContext()\n"); - ImGui::DestroyContext(context); + ImGui::DestroyContext(); return 0; } diff --git a/recipes/imgui/config.yml b/recipes/imgui/config.yml index 876df7dac7789..20b8472fac4aa 100644 --- a/recipes/imgui/config.yml +++ b/recipes/imgui/config.yml @@ -1,5 +1,47 @@ versions: - "1.89.1": + "1.91.5": + folder: all + "1.91.5-docking": + folder: all + "1.91.4": + folder: all + "1.91.4-docking": + folder: all + "1.91.3": + folder: all + "1.91.3-docking": + folder: all + "1.91.2": + folder: all + "1.91.2-docking": + folder: all + "1.91.0": + folder: all + "1.91.0-docking": + folder: all + "1.90.9": + folder: all + "1.90.9-docking": + folder: all + "1.90.8": + folder: all + "1.90.8-docking": + folder: all + "1.90.7": + folder: all + "1.90.7-docking": + folder: all + "1.90.6": + folder: all + "1.90.6-docking": + folder: all + "1.90.5": + folder: all + "1.90.5-docking": + folder: all + "1.89.9": + folder: all + "1.89.9-docking": folder: all "1.88": folder: all @@ -10,10 +52,3 @@ versions: "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.20220621+1.88.docking": - folder: all - "cci.20220207+1.87.docking": - folder: all diff --git a/recipes/imguizmo/all/CMakeLists.txt b/recipes/imguizmo/all/CMakeLists.txt index 73784d828761a..00a03f5032972 100644 --- a/recipes/imguizmo/all/CMakeLists.txt +++ b/recipes/imguizmo/all/CMakeLists.txt @@ -1,27 +1,22 @@ -cmake_minimum_required(VERSION 3.4) +cmake_minimum_required(VERSION 3.15) project(imguizmo CXX) + set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) - -include(conanbuildinfo.cmake) -conan_basic_setup() - set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) -set(SOURCE_DIR source_subfolder) +set(SOURCE_DIR src) file(GLOB SOURCE_FILES ${SOURCE_DIR}/*.cpp) file(GLOB HEADER_FILES ${SOURCE_DIR}/*.h) +find_package(imgui CONFIG REQUIRED) + add_library(${PROJECT_NAME} ${SOURCE_FILES}) target_include_directories(${PROJECT_NAME} PRIVATE ${SOURCE_DIR}) -target_link_libraries(${PROJECT_NAME} PUBLIC ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PUBLIC imgui::imgui) include(GNUInstallDirs) - -install(TARGETS ${PROJECT_NAME} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) +install(TARGETS ${PROJECT_NAME}) install(FILES ${HEADER_FILES} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ) diff --git a/recipes/imguizmo/all/conandata.yml b/recipes/imguizmo/all/conandata.yml index 11e9cb824cab9..ae95ecdea6a27 100644 --- a/recipes/imguizmo/all/conandata.yml +++ b/recipes/imguizmo/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "cci.20231114": + url: "https://github.com/CedricGuillemet/ImGuizmo/archive/ba662b119d64f9ab700bb2cd7b2781f9044f5565.zip" + sha256: "5a63baebb5bce96d83e5e3d6daa4598844ba8d5d0e3cb1ee385fcc54cf996115" "1.83": url: "https://github.com/CedricGuillemet/ImGuizmo/archive/refs/tags/1.83.tar.gz" sha256: "e6d05c5ebde802df7f6c342a06bc675bd2aa1c754d2d96755399a182187098a8" diff --git a/recipes/imguizmo/all/conanfile.py b/recipes/imguizmo/all/conanfile.py index 62c65e6489c8b..64f8cb9f6dab2 100644 --- a/recipes/imguizmo/all/conanfile.py +++ b/recipes/imguizmo/all/conanfile.py @@ -1,31 +1,34 @@ -import functools -from conans import ConanFile, CMake, tools +import os + +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, replace_in_file +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" class ImGuizmoConan(ConanFile): name = "imguizmo" + description = "Immediate mode 3D gizmo for scene editing and other controls based on Dear Imgui" + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/CedricGuillemet/ImGuizmo" - description = "Immediate mode 3D gizmo for scene editing and other controls based on Dear Imgui" topics = ("imgui", "3d", "graphics", "guizmo") - license = "MIT" - settings = "os", "arch", "compiler", "build_type" - - exports_sources = ["CMakeLists.txt"] - generators = "cmake" + 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" + 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": @@ -33,28 +36,39 @@ def config_options(self): 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 requirements(self): - self.requires("imgui/1.87") + self.requires("imgui/1.90.5", transitive_headers=True) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.configure() - return cmake + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.preprocessor_definitions["IMGUI_DEFINE_MATH_OPERATORS"] = "" + tc.generate() + tc = CMakeDeps(self) + tc.generate() def build(self): - cmake = self._configure_cmake() + if self.version == "1.83" and Version(self.dependencies["imgui"].ref.version) >= "1.89.4": + # Related to a breaking change: https://github.com/ocornut/imgui/blob/master/docs/CHANGELOG.txt#L912 + # Redirection: ImDrawList::AddBezierCurve() -> use ImDrawList::AddBezierCubic() + replace_in_file(self, os.path.join(self.source_folder, "GraphEditor.cpp"), + "AddBezierCurve", "AddBezierCubic") + cmake = CMake(self) + cmake.configure(build_script_folder=self.source_path.parent) cmake.build() def package(self): - self.copy(pattern="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() def package_info(self): diff --git a/recipes/imguizmo/all/test_package/CMakeLists.txt b/recipes/imguizmo/all/test_package/CMakeLists.txt index 4db4d9b97252b..bca22087e3920 100644 --- a/recipes/imguizmo/all/test_package/CMakeLists.txt +++ b/recipes/imguizmo/all/test_package/CMakeLists.txt @@ -1,13 +1,11 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.15) +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() - -find_package(imgui REQUIRED) -find_package(imguizmo REQUIRED) +find_package(imgui REQUIRED CONFIG) +find_package(imguizmo REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} imgui::imgui) diff --git a/recipes/imguizmo/all/test_package/conanfile.py b/recipes/imguizmo/all/test_package/conanfile.py index 23ba95e79f465..ef5d7042163ec 100644 --- a/recipes/imguizmo/all/test_package/conanfile.py +++ b/recipes/imguizmo/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" + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/imguizmo/all/test_v1_package/CMakeLists.txt b/recipes/imguizmo/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/imguizmo/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/imguizmo/all/test_v1_package/conanfile.py b/recipes/imguizmo/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..6c9d5dba712c7 --- /dev/null +++ b/recipes/imguizmo/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_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/imguizmo/config.yml b/recipes/imguizmo/config.yml index cc1b28a70b3ee..a2886d669a4e7 100644 --- a/recipes/imguizmo/config.yml +++ b/recipes/imguizmo/config.yml @@ -1,3 +1,5 @@ versions: + "cci.20231114": + folder: "all" "1.83": folder: "all" diff --git a/recipes/immer/all/conandata.yml b/recipes/immer/all/conandata.yml index 811b858690dba..dcc9095290082 100644 --- a/recipes/immer/all/conandata.yml +++ b/recipes/immer/all/conandata.yml @@ -1,10 +1,10 @@ sources: + "0.8.1": + url: "https://github.com/arximboldi/immer/archive/v0.8.1.tar.gz" + sha256: "de8411c84830864604bb685dc8f2e3c0dbdc40b95b2f6726092f7dcc85e75209" "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" - "0.6.2": - url: "https://github.com/arximboldi/immer/archive/refs/tags/v0.6.2.tar.gz" - sha256: "c3bb8847034437dee64adacb04e1e0163ae640b596c582eb4c0aa1d7c6447cd7" diff --git a/recipes/immer/all/conanfile.py b/recipes/immer/all/conanfile.py index 952501519b554..dadfcc5005ec6 100644 --- a/recipes/immer/all/conanfile.py +++ b/recipes/immer/all/conanfile.py @@ -1,40 +1,32 @@ -from conans import ConanFile, tools, errors +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.52.0" -required_conan_version = ">=1.33.0" class ImmerConan(ConanFile): name = "immer" + description = "Postmodern immutable and persistent data structures for C++ - value semantics at scale" license = "BSL-1.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/arximboldi/immer" - description = "Postmodern immutable and persistent data structures for C++---value semantics at scale" - topics = ("header", "header-only", "persistent", "modern", "immutable", - "data structures", "functional", "value semantics", "postmodern", - "rrb-tree") + topics = ("header", "header-only", "persistent", "modern", "immutable", "data structures", + "functional", "value semantics", "postmodern", "rrb-tree") + + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - settings = "compiler" @property - def _minimum_cpp_standard(self): + def _min_cppstd(self): return 14 - @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=include_folder) - - def package_id(self): - self.info.header_only() - @property def _minimum_compilers_version(self): # Reference: https://en.cppreference.com/w/cpp/compiler_support/14 @@ -44,17 +36,36 @@ def _minimum_compilers_version(self): "gcc": "6", "intel": "17", "sun-cc": "5.15", - "Visual Studio": "15" + "Visual Studio": "15", } + 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.warning(f"{self.name} 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.name} requires C++{self._min_cppstd} support. The current compiler" + f" {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 package(self): + include_folder = self.source_folder + copy(self, pattern="*.hpp", dst=os.path.join(self.package_folder, "include"), src=include_folder) + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=include_folder) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/immer/all/test_package/CMakeLists.txt b/recipes/immer/all/test_package/CMakeLists.txt index 870b269d2d660..3e9a18f3dcd2f 100644 --- a/recipes/immer/all/test_package/CMakeLists.txt +++ b/recipes/immer/all/test_package/CMakeLists.txt @@ -1,13 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(PackageTest CXX) +cmake_minimum_required(VERSION 3.15) +project(PackageTest LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +find_package(immer REQUIRED CONFIG) -find_package(immer CONFIG REQUIRED) - -add_executable(example example.cpp) - -target_link_libraries(example immer::immer) - -target_compile_features(example PUBLIC cxx_std_14) +add_executable(test_package test_package.cpp) +target_link_libraries(test_package PRIVATE immer::immer) +target_compile_features(test_package PRIVATE cxx_std_14) diff --git a/recipes/immer/all/test_package/conanfile.py b/recipes/immer/all/test_package/conanfile.py index 0242d96a644ca..ef5d7042163ec 100644 --- a/recipes/immer/all/test_package/conanfile.py +++ b/recipes/immer/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", "example") - 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/immer/all/test_package/example.cpp b/recipes/immer/all/test_package/example.cpp deleted file mode 100644 index 3778564a31082..0000000000000 --- a/recipes/immer/all/test_package/example.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include "immer/vector.hpp" -#include - -int main() { - const auto v0 = immer::vector{}; - const auto v1 = v0.push_back(13); - assert(v0.size() == 0 && v1.size() == 1 && v1[0] == 13); - - const auto v2 = v1.set(0, 42); - assert(v1[0] == 13 && v2[0] == 42); - - return 0; -} diff --git a/recipes/immer/all/test_package/test_package.cpp b/recipes/immer/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..78e26ad5b37e6 --- /dev/null +++ b/recipes/immer/all/test_package/test_package.cpp @@ -0,0 +1,13 @@ +#include "immer/vector.hpp" +#include + +int main() { + const auto v0 = immer::vector{}; + const auto v1 = v0.push_back(13); + assert(v0.size() == 0 && v1.size() == 1 && v1[0] == 13); + + const auto v2 = v1.set(0, 42); + assert(v1[0] == 13 && v2[0] == 42); + + return 0; +} diff --git a/recipes/immer/all/test_v1_package/CMakeLists.txt b/recipes/immer/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/immer/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/immer/all/test_v1_package/conanfile.py b/recipes/immer/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..90eb89e3f2f46 --- /dev/null +++ b/recipes/immer/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/immer/config.yml b/recipes/immer/config.yml index 9e53a8732b403..249b90e4014ba 100644 --- a/recipes/immer/config.yml +++ b/recipes/immer/config.yml @@ -1,7 +1,7 @@ versions: + "0.8.1": + folder: all "0.8.0": folder: all "0.7.0": folder: all - "0.6.2": - folder: all diff --git a/recipes/implot/all/CMakeLists.txt b/recipes/implot/all/CMakeLists.txt index 4a06ba1470e36..317f2805b1b38 100644 --- a/recipes/implot/all/CMakeLists.txt +++ b/recipes/implot/all/CMakeLists.txt @@ -1,20 +1,24 @@ -cmake_minimum_required(VERSION 3.4) -project(implot CXX) -set(CMAKE_CXX_STANDARD 11) -set(CMAKE_CXX_STANDARD_REQUIRED ON) +cmake_minimum_required(VERSION 3.15) +project(implot LANGUAGES CXX) -include(conanbuildinfo.cmake) -conan_basic_setup() +file(GLOB HEADER_FILES ${IMPLOT_SRC_DIR}/*.h) -set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) +add_library(${PROJECT_NAME} + ${IMPLOT_SRC_DIR}/implot.cpp + ${IMPLOT_SRC_DIR}/implot_items.cpp + # implot_demo.cpp is included so that user can use it to display the main documentation of implot. + # Note that these functions are not declared by the public headers. + # https://github.com/conan-io/conan-center-index/pull/20374 + ${IMPLOT_SRC_DIR}/implot_demo.cpp +) +target_include_directories(${PROJECT_NAME} PRIVATE ${IMPLOT_SRC_DIR}) -set(SOURCE_DIR source_subfolder) -file(GLOB SOURCE_FILES ${SOURCE_DIR}/*.cpp) -file(GLOB HEADER_FILES ${SOURCE_DIR}/*.h) +find_package(imgui CONFIG REQUIRED) -add_library(${PROJECT_NAME} ${SOURCE_FILES}) -target_include_directories(${PROJECT_NAME} PRIVATE ${SOURCE_DIR}) -target_link_libraries(${PROJECT_NAME} PUBLIC ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PUBLIC imgui::imgui) + +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +set_target_properties(${PROJECT_NAME} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON) include(GNUInstallDirs) @@ -24,4 +28,4 @@ install(TARGETS ${PROJECT_NAME} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) install(FILES ${HEADER_FILES} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} - PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ) +) diff --git a/recipes/implot/all/conandata.yml b/recipes/implot/all/conandata.yml index 21af4dfe87312..5aa143a53a498 100644 --- a/recipes/implot/all/conandata.yml +++ b/recipes/implot/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "0.16": + url: "https://github.com/epezent/implot/archive/v0.16.tar.gz" + sha256: "961df327d8a756304d1b0a67316eebdb1111d13d559f0d3415114ec0eb30abd1" + "0.15": + url: "https://github.com/epezent/implot/archive/v0.15.tar.gz" + sha256: "4c20f22fbfbe4ad055f3d344581918d62cde72070b233dad75419a4334f82146" "0.14": url: "https://github.com/epezent/implot/archive/v0.14.tar.gz" sha256: "1613af3e6554c0a74de20c6e60e9bce5ce35c2d4f9e1aa5ff963f7fe2d48af88" diff --git a/recipes/implot/all/conanfile.py b/recipes/implot/all/conanfile.py index c90ba7a4fb427..ce5a386b006bb 100644 --- a/recipes/implot/all/conanfile.py +++ b/recipes/implot/all/conanfile.py @@ -1,32 +1,33 @@ -from conans import ConanFile, CMake, tools -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 get, copy, replace_in_file +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.54" class ImplotConan(ConanFile): name = "implot" + description = "Advanced 2D Plotting for Dear ImGui" + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/epezent/implot" - description = "Advanced 2D Plotting for Dear ImGui" topics = ("imgui", "plot", "graphics", ) - license = "MIT" + package_type = "library" settings = "os", "arch", "compiler", "build_type" - - exports_sources = ["CMakeLists.txt"] - generators = "cmake" - 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" + def export_sources(self): + copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) def config_options(self): if self.settings.os == "Windows": @@ -34,31 +35,54 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") def requirements(self): - if tools.Version(self.version) >= "0.13": - self.requires("imgui/1.87") + if Version(self.version) >= "0.14": + self.requires("imgui/1.90.5", transitive_headers=True) + elif Version(self.version) >= "0.13": + # imgui 1.89 renamed ImGuiKeyModFlags_* to ImGuiModFlags_* + self.requires("imgui/1.88", transitive_headers=True) else: - self.requires("imgui/1.86") + self.requires("imgui/1.86", transitive_headers=True) + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + if Version(self.version) < "0.13" and is_msvc(self) and self.dependencies["imgui"].options.shared: + raise ConanInvalidConfiguration(f"{self.ref} doesn't support shared imgui.") 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["IMPLOT_SRC_DIR"] = self.source_folder.replace("\\", "/") + if Version(self.version) < "0.16": + # Set in code since v0.16 https://github.com/epezent/implot/commit/33c5a965f55f80057f197257d1d1cdb06523e963 + tc.preprocessor_definitions["IMGUI_DEFINE_MATH_OPERATORS"] = "" + tc.generate() + deps = CMakeDeps(self) + deps.generate() + + def _patch_sources(self): + if Version(self.version) == "0.14" and Version(self.dependencies["imgui"].ref.version) >= "1.89.7": + # https://github.com/ocornut/imgui/commit/51f564eea6333bae9242f40c983a3e29d119a9c2 + replace_in_file(self, os.path.join(self.source_folder, "implot.cpp"), + "ImGuiButtonFlags_AllowItemOverlap", + "ImGuiButtonFlags_AllowOverlap") 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() 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) + copy(self, pattern="implot*.cpp", dst=os.path.join(self.package_folder, "res", "src"), src=self.source_folder) + cmake = CMake(self) cmake.install() def package_info(self): diff --git a/recipes/implot/all/test_package/CMakeLists.txt b/recipes/implot/all/test_package/CMakeLists.txt index 12c0824c90a91..e39ff9333e1cc 100644 --- a/recipes/implot/all/test_package/CMakeLists.txt +++ b/recipes/implot/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.4) project(test_package) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(implot CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/implot/all/test_package/conanfile.py b/recipes/implot/all/test_package/conanfile.py index 4576de7f46804..4b1e5bb19a0a2 100644 --- a/recipes/implot/all/test_package/conanfile.py +++ b/recipes/implot/all/test_package/conanfile.py @@ -1,15 +1,27 @@ -from conans import ConanFile, CMake, tools import os -class TestPackageConan(ConanFile): +from conan import ConanFile +from conan.tools.cmake import CMake, cmake_layout +from conan.tools.build import can_run + + +class ImplotTestConan(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 build(self): cmake = CMake(self) cmake.configure() cmake.build() + def layout(self): + cmake_layout(self) + def test(self): - if not tools.cross_building(self): - self.run(os.path.join("bin", "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/implot/all/test_v1_package/CMakeLists.txt b/recipes/implot/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..8d8cf1572027f --- /dev/null +++ b/recipes/implot/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.4) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/implot/all/test_v1_package/conanfile.py b/recipes/implot/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..4ef0320775f21 --- /dev/null +++ b/recipes/implot/all/test_v1_package/conanfile.py @@ -0,0 +1,23 @@ +import os + +from conans import ConanFile, CMake +from conans.tools import cross_building + + +class ImplotTestConan(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 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/implot/config.yml b/recipes/implot/config.yml index d62abd0d999a8..60016fd219bda 100644 --- a/recipes/implot/config.yml +++ b/recipes/implot/config.yml @@ -1,4 +1,8 @@ versions: + "0.16": + folder: "all" + "0.15": + folder: "all" "0.14": folder: "all" "0.13": diff --git a/recipes/imutils-cpp/all/conanfile.py b/recipes/imutils-cpp/all/conanfile.py index d577073c8baef..d9f313c9e9b84 100644 --- a/recipes/imutils-cpp/all/conanfile.py +++ b/recipes/imutils-cpp/all/conanfile.py @@ -1,14 +1,13 @@ 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 - +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.scm import Version import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" + class ImutilsCppConan(ConanFile): name = "imutils-cpp" @@ -17,6 +16,7 @@ class ImutilsCppConan(ConanFile): topics = ("opencv", "imutils", "computer vision", ) homepage = "https://github.com/thedevmanek/imutils-cpp" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -28,7 +28,7 @@ class ImutilsCppConan(ConanFile): } @property - def _minimum_cpp_standard(self): + def _min_cppstd(self): return 17 @property @@ -42,8 +42,7 @@ def _compilers_minimum_version(self): } 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) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -51,30 +50,32 @@ 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) + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("opencv/4.5.5") - self.requires("libcurl/7.84.0") - self.requires("openssl/1.1.1q") + self.requires("opencv/4.8.1", transitive_headers=True, transitive_libs=True) + self.requires("libcurl/[>=7.78.0 <9]") 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.") + 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): - files.get(self, **self.conan_data["sources"][self.version], strip_root=True) + 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() + tc = CMakeToolchain(self) + if not valid_min_cppstd(self, self._min_cppstd): + tc.cache_variables["CMAKE_CXX_STANDARD"] = self._min_cppstd + tc.generate() deps = CMakeDeps(self) deps.generate() @@ -86,21 +87,17 @@ def build(self): cmake.build() def package(self): - files.copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + 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")) + 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 = ["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/test_package/CMakeLists.txt b/recipes/imutils-cpp/all/test_package/CMakeLists.txt index 7dc0936c26b56..79460b8878562 100644 --- a/recipes/imutils-cpp/all/test_package/CMakeLists.txt +++ b/recipes/imutils-cpp/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(imutils_cpp REQUIRED CONFIG) diff --git a/recipes/imutils-cpp/all/test_package/conanfile.py b/recipes/imutils-cpp/all/test_package/conanfile.py index c7933801f1176..98ab55852ad56 100644 --- a/recipes/imutils-cpp/all/test_package/conanfile.py +++ b/recipes/imutils-cpp/all/test_package/conanfile.py @@ -1,16 +1,20 @@ 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() diff --git a/recipes/imutils-cpp/all/test_v1_package/CMakeLists.txt b/recipes/imutils-cpp/all/test_v1_package/CMakeLists.txt index 529de77d0cf37..0d20897301b68 100644 --- a/recipes/imutils-cpp/all/test_v1_package/CMakeLists.txt +++ b/recipes/imutils-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(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) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/incbin/all/conanfile.py b/recipes/incbin/all/conanfile.py index ec1c1be93ab74..446fadbc04892 100644 --- a/recipes/incbin/all/conanfile.py +++ b/recipes/incbin/all/conanfile.py @@ -1,32 +1,41 @@ -from conans.errors import ConanInvalidConfiguration -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.microsoft import is_msvc +from conan.errors import ConanInvalidConfiguration +import os + +required_conan_version = ">=1.50.0" -required_conan_version = ">=1.33.0" class IncbinConan(ConanFile): name = "incbin" + description = "Include binary files in C/C++" license = "Unlicense" url = "https://github.com/conan-io/conan-center-index" - description = "Include binary files in C/C++" - topics = ("include", "binary", "preprocess") homepage = "https://github.com/graphitemaster/incbin/" + topics = ("include", "binary", "preprocess", "header-only") + package_type = "header-library" + 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 package_id(self): + self.info.clear() def validate(self): - if self.settings.compiler == "Visual Studio": + if is_msvc(self): raise ConanInvalidConfiguration("Currently incbin recipe is not supported for Visual Studio because it requires external command 'incbin'.") 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("UNLICENSE", "licenses", self._source_subfolder) - self.copy("incbin.h", "include", self._source_subfolder) + copy(self, "UNLICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, "incbin.h", dst=os.path.join(self.package_folder, "include"), src=self.source_folder) - def package_id(self): - self.info.header_only() + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/incbin/all/test_package/CMakeLists.txt b/recipes/incbin/all/test_package/CMakeLists.txt index 0016bcbe2bd7d..32f39d585f388 100644 --- a/recipes/incbin/all/test_package/CMakeLists.txt +++ b/recipes/incbin/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.15) +project(test_package LANGUAGES C) find_package(incbin CONFIG REQUIRED) diff --git a/recipes/incbin/all/test_package/conanfile.py b/recipes/incbin/all/test_package/conanfile.py index 27c426e38df11..e845ae751a301 100644 --- a/recipes/incbin/all/test_package/conanfile.py +++ b/recipes/incbin/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 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/incbin/all/test_v1_package/CMakeLists.txt b/recipes/incbin/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..de3b75d9538de --- /dev/null +++ b/recipes/incbin/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/etl/all/test_v1_package/conanfile.py b/recipes/incbin/all/test_v1_package/conanfile.py similarity index 100% rename from recipes/etl/all/test_v1_package/conanfile.py rename to recipes/incbin/all/test_v1_package/conanfile.py diff --git a/recipes/indicators/all/conandata.yml b/recipes/indicators/all/conandata.yml index 3b571273f51e6..2d3d2eb9e7a85 100644 --- a/recipes/indicators/all/conandata.yml +++ b/recipes/indicators/all/conandata.yml @@ -1,11 +1,13 @@ sources: - "1.9": - url: "https://github.com/p-ranav/indicators/archive/v1.9.tar.gz" - sha256: "842e11fa542ac392a2a2ddee48620a06c3005ec38ca25cf352471e46e18f389d" - "2.0": - url: "https://github.com/p-ranav/indicators/archive/v2.0.tar.gz" - sha256: "ef296fa614edcd798db0ac6c3c0f2990682cae8b83724a4db34eed17521c75f7" + "2.3": + url: "https://github.com/p-ranav/indicators/archive/v2.3.tar.gz" + sha256: "70da7a693ff7a6a283850ab6d62acf628eea17d386488af8918576d0760aef7b" "2.2": url: "https://github.com/p-ranav/indicators/archive/v2.2.tar.gz" sha256: "b768f1b7ca64a413503f72d5460cc617c1458c17fb7a8c0ee503d753e1f20d03" - + "2.0": + url: "https://github.com/p-ranav/indicators/archive/v2.0.tar.gz" + sha256: "ef296fa614edcd798db0ac6c3c0f2990682cae8b83724a4db34eed17521c75f7" + "1.9": + url: "https://github.com/p-ranav/indicators/archive/v1.9.tar.gz" + sha256: "842e11fa542ac392a2a2ddee48620a06c3005ec38ca25cf352471e46e18f389d" diff --git a/recipes/indicators/all/conanfile.py b/recipes/indicators/all/conanfile.py index 8981baf41e1d7..fa47f76cede99 100644 --- a/recipes/indicators/all/conanfile.py +++ b/recipes/indicators/all/conanfile.py @@ -1,46 +1,58 @@ 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.50.0" class IndicatorsConan(ConanFile): name = "indicators" - homepage = "https://github.com/p-ranav/indicators" - 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") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/p-ranav/indicators" + topics = ("activity", "indicator", "loading", "spinner", "animation", "progress", "header-only") + 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 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": + self.cpp_info.set_property("cmake_file_name", "indicators") + self.cpp_info.set_property("cmake_target_name", "indicators::indicators") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("pthread") diff --git a/recipes/indicators/all/test_package/CMakeLists.txt b/recipes/indicators/all/test_package/CMakeLists.txt index 454c47bb2cbab..886f8f419992a 100644 --- a/recipes/indicators/all/test_package/CMakeLists.txt +++ b/recipes/indicators/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(indicators 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 indicators::indicators) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/indicators/all/test_package/conanfile.py b/recipes/indicators/all/test_package/conanfile.py index bd7165a553cf4..b9d7f11e89dcd 100644 --- a/recipes/indicators/all/test_package/conanfile.py +++ b/recipes/indicators/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" + 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.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/indicators/all/test_package/test_package.cpp b/recipes/indicators/all/test_package/test_package.cpp index 0ee39928f35da..71cfd4f7b82c4 100644 --- a/recipes/indicators/all/test_package/test_package.cpp +++ b/recipes/indicators/all/test_package/test_package.cpp @@ -50,274 +50,6 @@ int main() { thread.join(); } - { - // - // PROGRESS BAR 2 - // - indicators::ProgressBar p; - p.set_option(option::BarWidth{0}); - p.set_option(option::PrefixText{"Reading package list... "}); - p.set_option(option::Start{""}); - p.set_option(option::Fill{""}); - p.set_option(option::Lead{""}); - p.set_option(option::Remainder{""}); - p.set_option(option::End{""}); - p.set_option(option::ForegroundColor{indicators::Color::white}); - p.set_option(option::ShowPercentage{false}); - p.set_option( - option::FontStyles{std::vector{indicators::FontStyle::bold}}); - auto job = [&p]() { - while (true) { - p.set_option( - option::PrefixText{"Reading package list... " + std::to_string(p.current()) + "% "}); - if (p.current() + 2 >= 100) - p.set_option(option::PrefixText{"Reading package list... Done"}); - p.tick(); - if (p.is_completed()) { - break; - } - std::this_thread::sleep_for(std::chrono::milliseconds(1)); - } - }; - std::thread thread(job); - thread.join(); - } - - { - // - // PROGRESS BAR 3 - // - indicators::ProgressBar p; - p.set_option(option::BarWidth{50}); - p.set_option(option::Start{"["}); - p.set_option(option::Fill{"="}); - p.set_option(option::Lead{">"}); - p.set_option(option::Remainder{" "}); - p.set_option(option::End{"]"}); - p.set_option(option::PostfixText{"Getting started"}); - p.set_option(option::ForegroundColor{indicators::Color::green}); - p.set_option( - option::FontStyles{std::vector{indicators::FontStyle::bold}}); - auto job = [&p]() { - while (true) { - auto ticks = p.current(); - if (ticks > 20 && ticks < 50) - p.set_option(option::PostfixText{"Delaying the inevitable"}); - else if (ticks > 50 && ticks < 80) - p.set_option(option::PostfixText{"Crying quietly"}); - else if (ticks > 80 && ticks < 98) - p.set_option(option::PostfixText{"Almost there"}); - else if (ticks >= 98) - p.set_option(option::PostfixText{"Done"}); - p.tick(); - if (p.is_completed()) - break; - std::this_thread::sleep_for(std::chrono::milliseconds(1)); - } - }; - std::thread thread(job); - thread.join(); - } - - { - // - // PROGRESS BAR 4 - // - std::vector lead_spinner{"â ‹", "â ™", "â ¹", "â ¸", "â ¼", "â ´", "â ¦", "â §", "â ‡", "â "}; - indicators::ProgressBar p4; - p4.set_option(option::BarWidth{40}); - p4.set_option(option::Start{""}); - p4.set_option(option::Fill{"â ¸"}); - p4.set_option(option::Lead{""}); - p4.set_option(option::Remainder{" "}); - p4.set_option(option::End{""}); - p4.set_option(option::ForegroundColor{indicators::Color::cyan}); - p4.set_option(option::PostfixText{"Restoring system state"}); - p4.set_option(option::ShowPercentage{false}); - p4.set_option( - option::FontStyles{std::vector{indicators::FontStyle::bold}}); - std::atomic index4{0}; - auto job4 = [&p4, &index4, &lead_spinner]() { - while (true) { - p4.set_option(option::PrefixText{"{ " + std::to_string(p4.current()) + "% } "}); - p4.set_option(option::Lead{lead_spinner[index4 % lead_spinner.size()]}); - index4 += 1; - if (p4.current() + 2 >= 100) { - std::cout << std::endl; - p4.set_option(option::ForegroundColor{indicators::Color::red}); - p4.set_option(option::PrefixText{"{ ERROR }"}); - p4.set_option(option::BarWidth{0}); - p4.set_option(option::Start{}); - p4.set_option(option::Fill{}); - p4.set_option(option::Lead{}); - p4.set_option(option::Remainder{}); - p4.set_option(option::ShowPercentage{true}); - p4.set_option(option::PostfixText{"Failed to restore system"}); - p4.mark_as_completed(); - break; - } - p4.tick(); - std::this_thread::sleep_for(std::chrono::milliseconds(1)); - } - }; - std::thread thread4(job4); - thread4.join(); - - std::this_thread::sleep_for(std::chrono::milliseconds(1)); - - { - // - // GOING BACKWARDS - // - indicators::ProgressBar p{ - option::BarWidth{50}, - option::ProgressType{ProgressType::decremental}, - option::Start{"["}, - option::Fill{"â– "}, - option::Lead{"â– "}, - option::Remainder{"-"}, - option::End{"]"}, - option::ForegroundColor{indicators::Color::white}, - option::PostfixText{"Reverting system restore"}, - option::FontStyles{std::vector{indicators::FontStyle::bold}}}; - auto job = [&p]() { - while (true) { - p.tick(); - if (p.is_completed()) { - p.set_option(option::PostfixText{"Revert complete!"}); - break; - } - std::this_thread::sleep_for(std::chrono::milliseconds(1)); - } - }; - std::thread thread(job); - thread.join(); - } - } - - { - // - // PROGRESS BAR 5 - // - indicators::ProgressSpinner p{ - option::PrefixText{""}, option::PostfixText{"Checking credentials"}, - option::ForegroundColor{indicators::Color::yellow}, - option::SpinnerStates{std::vector{"â ˆ", "â ", "â  ", "⢀", "â¡€", "â „", "â ‚", "â "}}, - option::FontStyles{std::vector{indicators::FontStyle::bold}}}; - - auto job = [&p]() { - while (true) { - if (p.is_completed()) { - p.set_option(option::ForegroundColor{indicators::Color::green}); - p.set_option(option::PrefixText{"✔"}); - p.set_option(option::ShowSpinner{false}); - p.set_option(option::ShowPercentage{false}); - p.set_option(option::PostfixText{"Authenticated!"}); - p.mark_as_completed(); - break; - } else - p.tick(); - std::this_thread::sleep_for(std::chrono::milliseconds(1)); - } - }; - std::thread thread(job); - thread.join(); - } - - std::cout << " Compiling mission\n"; - { - // - // PROGRESS BAR 6 - // - indicators::ProgressSpinner p{ - option::PrefixText{" - "}, - option::PostfixText{"Searching for the Moon"}, - option::ForegroundColor{indicators::Color::white}, - option::ShowPercentage{false}, - option::SpinnerStates{std::vector{"â––", "â–˜", "â–", "â–—"}}, - option::FontStyles{std::vector{indicators::FontStyle::bold}}}; - auto job = [&p]() { - while (true) { - auto current = p.current(); - if (current == 24) { - p.set_option(option::PrefixText{" - ✔"}); - p.set_option(option::ShowSpinner{false}); - } else if (current == 25) { - std::cout << std::endl; - p.set_option(option::ShowSpinner{true}); - p.set_option(option::PrefixText{" - "}); - p.set_option(option::PostfixText{"Contacting Kerbal headquarters"}); - } else if (current == 49) { - p.set_option(option::PrefixText{" - ✔"}); - p.set_option(option::ShowSpinner{false}); - } else if (current == 50) { - std::cout << std::endl; - p.set_option(option::ShowSpinner{true}); - p.set_option(option::PrefixText{" - "}); - p.set_option(option::PostfixText{"Designing spaceship"}); - } else if (current == 74) { - p.set_option(option::PrefixText{" - ✔"}); - p.set_option(option::ShowSpinner{false}); - } else if (current == 75) { - std::cout << std::endl; - p.set_option(option::ShowSpinner{true}); - p.set_option(option::PrefixText{" - "}); - p.set_option(option::PostfixText{"Launching rocket"}); - } else if (current == 95) { - p.set_option(option::PrefixText{" - ✔"}); - p.set_option(option::ShowSpinner{false}); - } else if (current == 99) { - std::cout << std::endl; - // - // NESTED PROGRESS BAR - // - indicators::ProgressBar p2{ - option::BarWidth{30}, - option::PrefixText{" - "}, - option::Start{"🌎"}, - option::Fill{"·"}, - option::Lead{"🚀"}, - option::Remainder{" "}, - option::End{"🌑"}, - option::PostfixText{"Achieved low-Earth orbit"}, - option::ForegroundColor{indicators::Color::white}, - option::FontStyles{std::vector{indicators::FontStyle::bold}}}; - std::vector ship_trail{"â ", "â ‚", "â „", "â¡€", "⢀", "â  ", "â ", "â ˆ"}; - std::atomic ship_trail_index{0}; - auto job2 = [&p2, &ship_trail_index, &ship_trail]() { - while (true) { - auto ticks = p2.current(); - if (ticks > 20 && ticks < 50) - p2.set_option(option::PostfixText{"Switching to trans-lunar trajectory"}); - else if (ticks > 50 && ticks < 80) - p2.set_option(option::PostfixText{"Transferred to Lunar lander"}); - else if (ticks > 80 && ticks < 98) - p2.set_option(option::PostfixText{"Almost there"}); - else if (ticks >= 98) - p2.set_option(option::PostfixText{"Landed on the Moon"}); - p2.tick(); - ship_trail_index += 1; - if (p2.is_completed()) - break; - std::this_thread::sleep_for(std::chrono::milliseconds(1)); - } - }; - std::thread thread2(job2); - thread2.join(); - p.set_option(indicators::option::PostfixText{"Mission successful!"}); - p.mark_as_completed(); - break; - } - p.tick(); - if (p.is_completed()) - break; - std::this_thread::sleep_for(std::chrono::milliseconds(1)); - } - }; - std::thread thread(job); - thread.join(); - } - // Show cursor show_console_cursor(true); diff --git a/recipes/indicators/all/test_v1_package/CMakeLists.txt b/recipes/indicators/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..be00a8c7f57c7 --- /dev/null +++ b/recipes/indicators/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/indicators/all/test_v1_package/conanfile.py b/recipes/indicators/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/indicators/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/indicators/config.yml b/recipes/indicators/config.yml index 3e719d24708ab..e7a199ca0be29 100644 --- a/recipes/indicators/config.yml +++ b/recipes/indicators/config.yml @@ -1,7 +1,9 @@ versions: - "1.9": + "2.3": + folder: "all" + "2.2": folder: "all" "2.0": folder: "all" - "2.2": + "1.9": folder: "all" diff --git a/recipes/indirect_value/all/conanfile.py b/recipes/indirect_value/all/conanfile.py index ce84972958e04..7ef5edf99c73d 100644 --- a/recipes/indirect_value/all/conanfile.py +++ b/recipes/indirect_value/all/conanfile.py @@ -1,24 +1,27 @@ -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.52.0" class IndirectValueConan(ConanFile): name = "indirect_value" - homepage = "https://github.com/jbcoe/indirect_value" description = "Production-quality reference implementation of P1950: A Free-Store-Allocated Value Type For C++" - topics = ("std", "vocabulary-type", "value-semantics") license = "MIT" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/jbcoe/indirect_value" + topics = ("std", "vocabulary-type", "value-semantics", "header-only") + + 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 17 @@ -29,40 +32,45 @@ def _minimum_compilers_version(self): "Visual Studio": "16", "gcc": "8", "clang": "8", - "apple-clang": "11" + "apple-clang": "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"): - tools.check_min_cppstd(self, self._minimum_cpp_standard) - min_version = self._minimum_compilers_version.get( - str(self.settings.compiler)) + 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(f"{self.name} recipe lacks information about the " + f"{self.settings.compiler} compiler support.") 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)) - - def package_id(self): - self.info.header_only() + f"{self.name} requires C++{self._minimum_cpp_standard} support. The current compiler" + f" {self.settings.compiler} {self.settings.compiler.version} does not support it." + ) 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="indirect_value.*", dst="include", - src=self._source_subfolder) - self.copy("*LICENSE*", dst="licenses", keep_path=False) + copy(self, "indirect_value.*", + dst=os.path.join(self.package_folder, "include"), + src=self.source_folder) + copy(self, "*LICENSE*", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder, + keep_path=False) def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.set_property("cmake_file_name", "indirect_value") self.cpp_info.set_property("cmake_target_name", "indirect_value::indirect_value") diff --git a/recipes/indirect_value/all/test_package/CMakeLists.txt b/recipes/indirect_value/all/test_package/CMakeLists.txt index fd68256049f87..e44109c29e389 100644 --- a/recipes/indirect_value/all/test_package/CMakeLists.txt +++ b/recipes/indirect_value/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ -cmake_minimum_required(VERSION 3.12) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(indirect_value REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/indirect_value/all/test_package/conanfile.py b/recipes/indirect_value/all/test_package/conanfile.py index 9b63bd176646b..fae501d0afb9e 100644 --- a/recipes/indirect_value/all/test_package/conanfile.py +++ b/recipes/indirect_value/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" + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/indirect_value/all/test_v1_package/CMakeLists.txt b/recipes/indirect_value/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/indirect_value/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/indirect_value/all/test_v1_package/conanfile.py b/recipes/indirect_value/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..9b63bd176646b --- /dev/null +++ b/recipes/indirect_value/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/influxdb-cpp/all/conandata.yml b/recipes/influxdb-cpp/all/conandata.yml index 08568ef090742..d9e475ef4f194 100644 --- a/recipes/influxdb-cpp/all/conandata.yml +++ b/recipes/influxdb-cpp/all/conandata.yml @@ -1,4 +1,7 @@ sources: + 'cci.20240102': + url: 'https://github.com/orca-zhang/influxdb-cpp/archive/db18273f09c113d0bd6037463997389afe978ac7.tar.gz' + sha256: '8c019ca700a723d9ed33d93e366cffac44b99a65485192ab70e760bf4229c7c8' 'cci.20201227': url: 'https://github.com/orca-zhang/influxdb-cpp/archive/800e0912552bc1b261c2afc6553a95caf5e9c66d.tar.gz' sha256: '456f0160cd6b12f88a19dcd0106dc0ba1935841f53ec642bf368843fa28def0e' diff --git a/recipes/influxdb-cpp/all/conanfile.py b/recipes/influxdb-cpp/all/conanfile.py index fa5b1610b16b3..c4120819ef945 100644 --- a/recipes/influxdb-cpp/all/conanfile.py +++ b/recipes/influxdb-cpp/all/conanfile.py @@ -1,33 +1,48 @@ import os -from conans import ConanFile, tools -import glob +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 + +required_conan_version = ">=1.52.0" class InfluxDBCppConan(ConanFile): name = "influxdb-cpp" + description = "C++ client for InfluxDB." license = "MIT" - homepage = "https://github.com/orca-zhang/influxdb-cpp" url = "https://github.com/conan-io/conan-center-index" - description = "C++ client for InfluxDB." - topics = ("single-header-lib", "influxdb") - settings = "os" + homepage = "https://github.com/orca-zhang/influxdb-cpp" + topics = ("single-header-lib", "influxdb", "header-only") + + package_type = "header-library" + 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() + + @property + def _min_cppstd(self): + return 11 + + 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_dir = glob.glob("influxdb-cpp-*")[0] - os.rename(extracted_dir, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): - self.copy('LICENSE', dst='licenses', src=self._source_subfolder) - self.copy('influxdb.hpp', dst='include', src=self._source_subfolder) + copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, "influxdb.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 = [] if self.settings.os == "Windows": self.cpp_info.system_libs = ["ws2_32"] - - def package_id(self): - self.info.header_only() diff --git a/recipes/influxdb-cpp/all/test_package/CMakeLists.txt b/recipes/influxdb-cpp/all/test_package/CMakeLists.txt index 6aab347eddf53..8aaa0b611508b 100644 --- a/recipes/influxdb-cpp/all/test_package/CMakeLists.txt +++ b/recipes/influxdb-cpp/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(PackageTest CXX) +cmake_minimum_required(VERSION 3.15) +project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(influxdb-cpp REQUIRED CONFIG) -add_executable(example example.cpp) -target_link_libraries(example ${CONAN_LIBS}) -set_property(TARGET example PROPERTY CXX_STANDARD 11) +add_executable(test_package test_package.cpp) +target_link_libraries(test_package PRIVATE influxdb-cpp::influxdb-cpp) +set_property(TARGET test_package PROPERTY CXX_STANDARD 11) diff --git a/recipes/influxdb-cpp/all/test_package/conanfile.py b/recipes/influxdb-cpp/all/test_package/conanfile.py index 17295afcb8561..fae501d0afb9e 100644 --- a/recipes/influxdb-cpp/all/test_package/conanfile.py +++ b/recipes/influxdb-cpp/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" + test_type = "explicit" -class InfluxDBCppTestConan(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,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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/influxdb-cpp/all/test_package/example.cpp b/recipes/influxdb-cpp/all/test_package/test_package.cpp similarity index 100% rename from recipes/influxdb-cpp/all/test_package/example.cpp rename to recipes/influxdb-cpp/all/test_package/test_package.cpp diff --git a/recipes/influxdb-cpp/all/test_v1_package/CMakeLists.txt b/recipes/influxdb-cpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/influxdb-cpp/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/influxdb-cpp/all/test_v1_package/conanfile.py b/recipes/influxdb-cpp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..49bc2bd787325 --- /dev/null +++ b/recipes/influxdb-cpp/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +import os + +from conans import ConanFile, CMake, tools + + +class InfluxDBCppTestConan(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/influxdb-cpp/config.yml b/recipes/influxdb-cpp/config.yml index a58749d6e9c51..911f00a7a6918 100644 --- a/recipes/influxdb-cpp/config.yml +++ b/recipes/influxdb-cpp/config.yml @@ -1,3 +1,5 @@ versions: + "cci.20240102": + folder: all "cci.20201227": folder: all diff --git a/recipes/influxdb-cxx/all/conandata.yml b/recipes/influxdb-cxx/all/conandata.yml new file mode 100644 index 0000000000000..465f6aea89730 --- /dev/null +++ b/recipes/influxdb-cxx/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.7.2": + url: "https://github.com/offa/influxdb-cxx/archive/refs/tags/v0.7.2.tar.gz" + sha256: "951e067df5731cb23b72f53fcbea8e56920819c6191b6885ea180168eb1950d9" diff --git a/recipes/influxdb-cxx/all/conanfile.py b/recipes/influxdb-cxx/all/conanfile.py new file mode 100644 index 0000000000000..c903fb4c5efc1 --- /dev/null +++ b/recipes/influxdb-cxx/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, CMakeDeps, CMakeToolchain, cmake_layout +import os + +required_conan_version = ">=1.53.0" + +class InfluxdbCxxConan(ConanFile): + name = "influxdb-cxx" + description = "InfluxDB C++ client library." + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/offa/influxdb-cxx" + topics = ("influxdb", "influxdb-client") + settings = "os", "arch", "compiler", "build_type" + package_type = "library" + options = { + "shared": [True, False], + "fPIC": [True, False], + "boost": [True, False] + } + default_options = { + "shared": False, + "fPIC": True, + "boost": True, + } + + @property + def _min_cppstd(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "8", + "clang": "7", + "apple-clang": "12", + "Visual Studio": "16", + "msvc": "192", + } + + 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("cpr/1.10.4") + if self.options.boost: + self.requires("boost/1.82.0") + + 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." + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + # BUILD_SHARED_LIBS is defined explicitly in CMakeLists.txt + tc.cache_variables["BUILD_SHARED_LIBS"] = self.options.shared + tc.cache_variables["INFLUXCXX_TESTING"] = False + tc.cache_variables["INFLUXCXX_WITH_BOOST"] = self.options.boost + if self.options.shared: + # See https://github.com/offa/influxdb-cxx/issues/194 + tc.preprocessor_definitions["InfluxDB_EXPORTS"] = 1 + tc.generate() + deps = CMakeDeps(self) + deps.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 = ["InfluxDB"] + + self.cpp_info.set_property("cmake_file_name", "InfluxDB") + self.cpp_info.set_property("cmake_target_name", "InfluxData::InfluxDB") diff --git a/recipes/influxdb-cxx/all/test_package/CMakeLists.txt b/recipes/influxdb-cxx/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..2f8068d41fdb4 --- /dev/null +++ b/recipes/influxdb-cxx/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(InfluxDB REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(test_package PRIVATE InfluxData::InfluxDB) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/influxdb-cxx/all/test_package/conanfile.py b/recipes/influxdb-cxx/all/test_package/conanfile.py new file mode 100644 index 0000000000000..ef5d7042163ec --- /dev/null +++ b/recipes/influxdb-cxx/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/influxdb-cxx/all/test_package/test_package.cpp b/recipes/influxdb-cxx/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..e91f55ee908cc --- /dev/null +++ b/recipes/influxdb-cxx/all/test_package/test_package.cpp @@ -0,0 +1,16 @@ +#include +#include +#include + +int main() +{ + try { + auto influxdb = influxdb::InfluxDBFactory::Get("xyz://foobar"); + } + catch(influxdb::InfluxDBException& e) { + + } + + std::cout << "Influxdb-cxx test package successful\n"; + return 0; +} diff --git a/recipes/influxdb-cxx/config.yml b/recipes/influxdb-cxx/config.yml new file mode 100644 index 0000000000000..eb766ff2f024b --- /dev/null +++ b/recipes/influxdb-cxx/config.yml @@ -0,0 +1,3 @@ +versions: + "0.7.2": + folder: all diff --git a/recipes/inih/all/conandata.yml b/recipes/inih/all/conandata.yml index f45a313d7e7e2..0df8fee5d2fee 100644 --- a/recipes/inih/all/conandata.yml +++ b/recipes/inih/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "58": + url: "https://github.com/benhoyt/inih/archive/r58.tar.gz" + sha256: "e79216260d5dffe809bda840be48ab0eec7737b2bb9f02d2275c1b46344ea7b7" + "57": + url: "https://github.com/benhoyt/inih/archive/r57.tar.gz" + sha256: "f03f98ca35c3adb56b2358573c8d3eda319ccd5287243d691e724b7eafa970b3" "56": url: "https://github.com/benhoyt/inih/archive/r56.tar.gz" sha256: "4f2ba6bd122d30281a8c7a4d5723b7af90b56aa828c0e88256d7fceda03a491a" diff --git a/recipes/inih/all/conanfile.py b/recipes/inih/all/conanfile.py index 10b7f92326704..559726ced856f 100644 --- a/recipes/inih/all/conanfile.py +++ b/recipes/inih/all/conanfile.py @@ -3,74 +3,81 @@ from conan.tools.apple import fix_apple_shared_install_name from conan.tools.env import VirtualBuildEnv from conan.tools.files import copy, get, rmdir +from conan.tools.build import check_min_cppstd from conan.tools.layout import basic_layout from conan.tools.meson import Meson, MesonToolchain from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version 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], "fPIC": [True, False], + "with_inireader": [True, False], } default_options = { "shared": False, "fPIC": True, + "with_inireader": True, } + @property + 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: - 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") + # INIReader is written in C++ + if not self.options.with_inireader: + 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.options.shared and is_msvc(self): + # since 57, INIReader requires C++11 + if Version(self.version) >= "57" and self.options.with_inireader and \ + self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + 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.2.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 = 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.project_options["with_INIReader"] = self.options.with_inireader + # since 57, INIReader requires C++11 + if Version(self.version) >= "57" and not is_msvc(self): + tc.cpp_args.append("-std=c++11") tc.generate() - env = VirtualBuildEnv(self) - env.generate(scope="build") - def build(self): meson = Meson(self) meson.configure() @@ -90,15 +97,16 @@ def package_info(self): self.cpp_info.components["libinih"].set_property("pkg_config_name", "inih") self.cpp_info.components["libinih"].libs = ["inih"] - self.cpp_info.components["inireader"].set_property("pkg_config_name", "INIReader") - self.cpp_info.components["inireader"].libs = ["INIReader"] - self.cpp_info.components["inireader"].requires = ["libinih"] + if self.options.with_inireader: + self.cpp_info.components["inireader"].set_property("pkg_config_name", "INIReader") + self.cpp_info.components["inireader"].libs = ["INIReader"] + 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/inih/config.yml b/recipes/inih/config.yml index 3746836949531..b228120159954 100644 --- a/recipes/inih/config.yml +++ b/recipes/inih/config.yml @@ -1,4 +1,8 @@ versions: + "58": + folder: "all" + "57": + folder: "all" "56": folder: "all" "55": diff --git a/recipes/inipp/all/conandata.yml b/recipes/inipp/all/conandata.yml new file mode 100644 index 0000000000000..64126a2c14163 --- /dev/null +++ b/recipes/inipp/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.0.12": + url: "https://github.com/mcmtroffaes/inipp/archive/refs/tags/1.0.12.tar.gz" + sha256: "e37833ab689c7b38de09b1923635b131f80db42e9b22f37d88ae4d74a7cd3e78" diff --git a/recipes/inipp/all/conanfile.py b/recipes/inipp/all/conanfile.py new file mode 100644 index 0000000000000..8d2aa4480c81c --- /dev/null +++ b/recipes/inipp/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 copy, get +from conan.tools.layout import basic_layout +from conan.tools.scm import Version +import os + +required_conan_version = ">=1.52.0" + +class InippConan(ConanFile): + name = "inipp" + description = "Simple C++ ini parser." + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/mcmtroffaes/inipp" + topics = ("ini", "header-only") + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _min_cppstd(self): + # inipp requires `deduced return type` which is provided in C++14 + return 14 + + @property + def _compilers_minimum_version(self): + return { + "apple-clang": "10", + "clang": "7", + "gcc": "7", + "msvc": "191", + "Visual Studio": "15", + } + + 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._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, "LICENSE.txt", self.source_folder, os.path.join(self.package_folder, "licenses")) + copy( + self, + "*.h", + os.path.join(self.source_folder, "inipp"), + os.path.join(self.package_folder, "include"), + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + self.cpp_info.set_property("cmake_file_name", "inipp") + self.cpp_info.set_property("cmake_target_name", "inipp::inipp") diff --git a/recipes/inipp/all/test_package/CMakeLists.txt b/recipes/inipp/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..8b6037a46e4cd --- /dev/null +++ b/recipes/inipp/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(inipp REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE inipp::inipp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/inipp/all/test_package/conanfile.py b/recipes/inipp/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/inipp/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/inipp/all/test_package/test_package.cpp b/recipes/inipp/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..cb8defcfdd28d --- /dev/null +++ b/recipes/inipp/all/test_package/test_package.cpp @@ -0,0 +1,13 @@ +#include +#include "inipp.h" + +int main() { + inipp::Ini ini; + ini.generate(std::cout); + + ini.default_section(ini.sections["DEFAULT"]); + ini.interpolate(); + ini.generate(std::cout); + + return 0; +} diff --git a/recipes/inipp/config.yml b/recipes/inipp/config.yml new file mode 100644 index 0000000000000..81d603cb239b7 --- /dev/null +++ b/recipes/inipp/config.yml @@ -0,0 +1,3 @@ +versions: + "1.0.12": + folder: all 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..e6c08750f5681 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" @@ -14,25 +16,46 @@ class InjaConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" description = "Inja is a template engine for modern C++, loosely inspired by jinja for python" topics = ("jinja2", "string templates", "templates engine") + package_type = "header-library" 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 layout(self): + basic_layout(self, src_folder="src") + def requirements(self): - self.requires("nlohmann_json/3.11.2") + self.requires("nlohmann_json/3.11.3") def package_id(self): self.info.clear() def validate(self): if self.settings.compiler.get_safe("cppstd"): - check_min_cppstd(self, 11) - - def layout(self): - basic_layout(self, src_folder="src") + 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], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def build(self): pass @@ -45,9 +68,7 @@ def package_info(self): self.cpp_info.set_property("cmake_file_name", "inja") self.cpp_info.set_property("cmake_target_name", "pantor::inja") 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.filenames["cmake_find_package"] = "inja" @@ -59,6 +80,4 @@ def package_info(self): self.cpp_info.components["libinja"].set_property("cmake_target_name", "pantor::inja") self.cpp_info.components["libinja"].requires = ["nlohmann_json::nlohmann_json"] self.cpp_info.components["libinja"].bindirs = [] - self.cpp_info.components["libinja"].frameworkdirs = [] self.cpp_info.components["libinja"].libdirs = [] - self.cpp_info.components["libinja"].resdirs = [] 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_package/conanfile.py b/recipes/inja/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/inja/all/test_package/conanfile.py +++ b/recipes/inja/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/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/intel-ipsec-mb/all/conandata.yml b/recipes/intel-ipsec-mb/all/conandata.yml new file mode 100644 index 0000000000000..d898ee0ccba2f --- /dev/null +++ b/recipes/intel-ipsec-mb/all/conandata.yml @@ -0,0 +1,12 @@ +sources: + "1.4": + url: "https://github.com/intel/intel-ipsec-mb/archive/refs/tags/v1.4.tar.gz" + sha256: "b441b3ecf0a9fe69ff675f2eb9fe4d1304814558a8f15f5617638ddc99e05873" +patches: + "1.4": + - patch_file: "patches/0001-unix-fpic.patch" + patch_description: "Do not enforce fPIC flag always" + patch_type: "conan" + - patch_file: "patches/0002-install-windows.patch" + patch_description: "Do not enforce Windows folders path when installing" + patch_type: "conan" diff --git a/recipes/intel-ipsec-mb/all/conanfile.py b/recipes/intel-ipsec-mb/all/conanfile.py new file mode 100644 index 0000000000000..4e9e314b05c43 --- /dev/null +++ b/recipes/intel-ipsec-mb/all/conanfile.py @@ -0,0 +1,104 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import get, copy, rmdir, apply_conandata_patches, export_conandata_patches +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.env import VirtualBuildEnv, Environment +from conan.tools.microsoft import is_msvc +import os + +required_conan_version = ">=1.53.0" + + +class PackageConan(ConanFile): + name = "intel-ipsec-mb" + description = "Intel(R) Multi-Buffer Crypto for IPSec" + license = "BSD-3-Clause" + homepage = "https://github.com/intel/intel-ipsec-mb" + url = "https://github.com/conan-io/conan-center-index" + topics = ("intel", "ipsec", "crypto", "security") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + @property + def _cmake_target(self): + return "libIPSec_MB" if is_msvc(self) else "IPSec_MB" + + @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.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + if self.settings.os not in ("FreeBSD", "Linux", "Windows"): + raise ConanInvalidConfiguration(f"{self.ref} does not support the O.S. {self.settings.os}.") + + def build_requirements(self): + self.tool_requires("nasm/2.15.05") + self.tool_requires("cmake/[>3.16 <4]") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + # INFO: Conan 1.x does not find nasm package automatically due PATH priority. + nasm_bin_folder = os.path.join(self.dependencies.direct_build["nasm"].package_folder, "bin").replace("\\", "/") + nasm_path = os.path.join(nasm_bin_folder, "nasm").replace("\\", "/") + env = Environment() + env.define("AS", nasm_path) + env.prepend("PATH", nasm_bin_folder) + envvars = env.vars(self, scope="build") + envvars.save_script("asm_configuration") + + env = VirtualBuildEnv(self) + env.generate(scope="build") + tc = CMakeToolchain(self) + # INFO: intel-ipsec-mb project forces shared by default. + tc.cache_variables["BUILD_SHARED_LIBS"] = self.options.shared + # INFO: When running on Linux, uses /usr/bin/nasm in case no enforced + if self._settings_build.os == "Linux": + tc.cache_variables["CMAKE_ASM_NASM_COMPILER"] = nasm_path + tc.generate() + tc = CMakeDeps(self) + tc.generate() + + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() + cmake.build(target=self._cmake_target) + + def package(self): + copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, "intel-ipsec-mb.h", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self.source_folder, "lib"), keep_path=False) + cmake = CMake(self) + cmake.install() + rmdir(self, os.path.join(self.package_folder, "man")) + rmdir(self, os.path.join(self.package_folder, "intel-ipsec-mb")) + + def package_info(self): + self.cpp_info.libs = [self._cmake_target] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs = ["pthread"] diff --git a/recipes/intel-ipsec-mb/all/patches/0001-unix-fpic.patch b/recipes/intel-ipsec-mb/all/patches/0001-unix-fpic.patch new file mode 100644 index 0000000000000..b4684f31ccc0b --- /dev/null +++ b/recipes/intel-ipsec-mb/all/patches/0001-unix-fpic.patch @@ -0,0 +1,13 @@ +diff --git a/lib/cmake/unix.cmake b/lib/cmake/unix.cmake +index 78aafae..d94297c 100644 +--- a/lib/cmake/unix.cmake ++++ b/lib/cmake/unix.cmake +@@ -38,7 +38,7 @@ string(APPEND CMAKE_ASM_NASM_FLAGS + + # set C compiler flags + set(CMAKE_C_FLAGS +- "-fPIC -W -Wall -Wextra -Wmissing-declarations \ ++ "-W -Wall -Wextra -Wmissing-declarations \ + -Wpointer-arith -Wcast-qual -Wundef -Wwrite-strings -Wformat \ + -Wformat-security -Wunreachable-code -Wmissing-noreturn \ + -Wsign-compare -Wno-endif-labels -Wstrict-prototypes \ diff --git a/recipes/intel-ipsec-mb/all/patches/0002-install-windows.patch b/recipes/intel-ipsec-mb/all/patches/0002-install-windows.patch new file mode 100644 index 0000000000000..ddaeab8b5f130 --- /dev/null +++ b/recipes/intel-ipsec-mb/all/patches/0002-install-windows.patch @@ -0,0 +1,36 @@ +diff --git a/lib/cmake/windows.cmake b/lib/cmake/windows.cmake +index 02d39a1..0647029 100644 +--- a/lib/cmake/windows.cmake ++++ b/lib/cmake/windows.cmake +@@ -93,27 +93,18 @@ endif() + add_library(${LIB} ${SRC_FILES_ASM} ${SRC_FILES_C} ${SRC_DEF_FILE}) + + # set install rules +-set(CMAKE_INSTALL_PREFIX "c:/Program Files" +- CACHE STRING "Set default installation directory" FORCE) + install(TARGETS ${LIB} +- DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_PROJECT_NAME}) ++ RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin ++ LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) ++ + install(FILES + ${IMB_HDR} + ${SRC_DEF_FILE} + DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_PROJECT_NAME}) +-if(BUILD_SHARED_LIBS) +- install(FILES +- $/${LIB}.exp +- $/${LIB}.pdb +- DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_PROJECT_NAME}) +- install(FILES +- $/${LIB}.dll +- DESTINATION $ENV{WINDIR}/system32) +-endif() + + execute_process( + COMMAND cmd /C ${GEN_DEF_FILE_CMD} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + OUTPUT_QUIET + ) +- diff --git a/recipes/intel-ipsec-mb/all/test_package/CMakeLists.txt b/recipes/intel-ipsec-mb/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..094c6cf883fd7 --- /dev/null +++ b/recipes/intel-ipsec-mb/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package C) + +find_package(intel-ipsec-mb REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE intel-ipsec-mb::intel-ipsec-mb) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) diff --git a/recipes/intel-ipsec-mb/all/test_package/conanfile.py b/recipes/intel-ipsec-mb/all/test_package/conanfile.py new file mode 100644 index 0000000000000..ef5d7042163ec --- /dev/null +++ b/recipes/intel-ipsec-mb/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/intel-ipsec-mb/all/test_package/test_package.c b/recipes/intel-ipsec-mb/all/test_package/test_package.c new file mode 100644 index 0000000000000..231c42793f295 --- /dev/null +++ b/recipes/intel-ipsec-mb/all/test_package/test_package.c @@ -0,0 +1,13 @@ +#include "intel-ipsec-mb.h" + +#include +#include + +int main() { + const char * version = NULL; + + version = imb_get_version_str(); + printf("Intel IPSec MB Version: %s\n", version); + + return EXIT_SUCCESS; +} diff --git a/recipes/intel-ipsec-mb/config.yml b/recipes/intel-ipsec-mb/config.yml new file mode 100644 index 0000000000000..49afec8b671eb --- /dev/null +++ b/recipes/intel-ipsec-mb/config.yml @@ -0,0 +1,3 @@ +versions: + "1.4": + folder: all diff --git a/recipes/intel-neon2sse/all/CMakeLists.txt b/recipes/intel-neon2sse/all/CMakeLists.txt deleted file mode 100644 index d605c85283e5c..0000000000000 --- a/recipes/intel-neon2sse/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() - -add_subdirectory(source_subfolder) diff --git a/recipes/intel-neon2sse/all/conanfile.py b/recipes/intel-neon2sse/all/conanfile.py index 0ddd476cb87e2..9d152bb546968 100644 --- a/recipes/intel-neon2sse/all/conanfile.py +++ b/recipes/intel-neon2sse/all/conanfile.py @@ -1,9 +1,11 @@ -from conans import ConanFile, tools, CMake -from conans.errors import ConanInvalidConfiguration -import os +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 os import path +required_conan_version = ">=1.50.0" -required_conan_version = ">=1.33.0" class IntelNeon2sseConan(ConanFile): name = "intel-neon2sse" @@ -12,9 +14,8 @@ class IntelNeon2sseConan(ConanFile): description = "Header only library intended to simplify ARM->IA32 porting" license = "BSD-2-Clause" topics = "neon", "sse", "port", "translation", "intrinsics" + package_type = "header-library" settings = "os", "compiler", "build_type", "arch" - generators = "cmake" - exports_sources = "CMakeLists.txt" options = { "SSE4": [True, False], "disable_performance_warnings": [True, False], @@ -24,45 +25,44 @@ class IntelNeon2sseConan(ConanFile): "disable_performance_warnings": False, } - _cmake = None + def layout(self): + cmake_layout(self, src_folder="src") - @property - def _source_subfolder(self): - return "source_subfolder" - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.configure() - return self._cmake + def package_id(self): + self.info.clear() def validate(self): if self.settings.arch not in ("x86", "x86_64"): raise ConanInvalidConfiguration("neon2sse only supports arch={x86,x86_64}") 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() 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() - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - tools.rmdir(os.path.join(self.package_folder, "lib")) - - def package_id(self): - self.info.header_only() + copy(self, "LICENSE", dst=path.join(self.package_folder, "licenses"), src=self.source_folder) + rmdir(self, path.join(self.package_folder, "lib")) def package_info(self): + self.cpp_info.bindirs = [] self.cpp_info.libdirs = [] - self.cpp_info.names["cmake_find_package"] = "NEON_2_SSE" - self.cpp_info.names["cmake_find_package_multi"] = "NEON_2_SSE" + self.cpp_info.set_property("cmake_file_name", "NEON_2_SSE") + self.cpp_info.set_property("cmake_target_name", "NEON_2_SSE::NEON_2_SSE") if self.options.SSE4: self.cpp_info.defines.append("USE_SSE4") if self.options.disable_performance_warnings: self.cpp_info.defines.append("NEON2SSE_DISABLE_PERFORMANCE_WARNING") + + # TODO: remove once generators for legacy generators is no longer needed + self.cpp_info.names["cmake_find_package"] = "NEON_2_SSE" + self.cpp_info.names["cmake_find_package_multi"] = "NEON_2_SSE" diff --git a/recipes/intel-neon2sse/all/test_package/CMakeLists.txt b/recipes/intel-neon2sse/all/test_package/CMakeLists.txt index 63169f693286c..959db15bea23b 100644 --- a/recipes/intel-neon2sse/all/test_package/CMakeLists.txt +++ b/recipes/intel-neon2sse/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(NEON_2_SSE REQUIRED) +find_package(NEON_2_SSE REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} NEON_2_SSE::NEON_2_SSE) +target_link_libraries(${PROJECT_NAME} PRIVATE NEON_2_SSE::NEON_2_SSE) diff --git a/recipes/intel-neon2sse/all/test_package/conanfile.py b/recipes/intel-neon2sse/all/test_package/conanfile.py index 5493d58611803..0a6bc68712d90 100644 --- a/recipes/intel-neon2sse/all/test_package/conanfile.py +++ b/recipes/intel-neon2sse/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" + 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/intel-neon2sse/all/test_v1_package/CMakeLists.txt b/recipes/intel-neon2sse/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..b21cc49efde95 --- /dev/null +++ b/recipes/intel-neon2sse/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/intel-neon2sse/all/test_v1_package/conanfile.py b/recipes/intel-neon2sse/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..1bf1c7e26255d --- /dev/null +++ b/recipes/intel-neon2sse/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_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/intx/all/conandata.yml b/recipes/intx/all/conandata.yml new file mode 100644 index 0000000000000..5e7cb7a5f366d --- /dev/null +++ b/recipes/intx/all/conandata.yml @@ -0,0 +1,10 @@ +sources: + "0.12.0": + url: "https://github.com/chfast/intx/archive/v0.12.0.tar.gz" + sha256: "d68ff5dde9a2f340c73be67888f3f72bb18a2ad30aa16cd663ec3bc611afc9b4" + "0.11.0": + url: "https://github.com/chfast/intx/archive/v0.11.0.tar.gz" + sha256: "bff2a78e3a9a3b9bbabf50500feae65bc0ec50a2364f4a83768277d6eba7a844" + "0.10.1": + url: "https://github.com/chfast/intx/archive/v0.10.1.tar.gz" + sha256: "4663073458b5e0564e92058e5aa1a7ce88634fc72827191856b17bd7335de29b" diff --git a/recipes/intx/all/conanfile.py b/recipes/intx/all/conanfile.py new file mode 100644 index 0000000000000..813526a90e8a3 --- /dev/null +++ b/recipes/intx/all/conanfile.py @@ -0,0 +1,68 @@ +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.1" + +class IntxConan(ConanFile): + name = "intx" + description = "Extended precision integer C++ library" + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/chfast/intx" + topics = ("evm", "biginteger", "arbitrary-precision", "header-only") + package_type = "header-library" + 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", + "msvc": "192", + "gcc": "11", + "clang": "13", + "apple-clang": "14.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"): + 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 = [] + + self.cpp_info.set_property("cmake_file_name", "intx") + self.cpp_info.set_property("cmake_target_name", "intx::intx") diff --git a/recipes/intx/all/test_package/CMakeLists.txt b/recipes/intx/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..460d6198ba06f --- /dev/null +++ b/recipes/intx/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.12) +project(test_package LANGUAGES CXX) + +find_package(intx REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE intx::intx) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) diff --git a/recipes/intx/all/test_package/conanfile.py b/recipes/intx/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fb96656f203 --- /dev/null +++ b/recipes/intx/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/intx/all/test_package/test_package.cpp b/recipes/intx/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..e9521bde28299 --- /dev/null +++ b/recipes/intx/all/test_package/test_package.cpp @@ -0,0 +1,6 @@ +#include + +int main(int argc, char**) +{ + return static_cast(intx::uint512{argc} / (intx::uint512{1} << 111)); +} diff --git a/recipes/intx/all/test_v1_package/CMakeLists.txt b/recipes/intx/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..9652e22fc19d5 --- /dev/null +++ b/recipes/intx/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/intx/all/test_v1_package/conanfile.py b/recipes/intx/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/intx/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/intx/config.yml b/recipes/intx/config.yml new file mode 100644 index 0000000000000..85ca9aa067b7a --- /dev/null +++ b/recipes/intx/config.yml @@ -0,0 +1,7 @@ +versions: + "0.12.0": + folder: all + "0.11.0": + folder: all + "0.10.1": + folder: all diff --git a/recipes/inversify-cpp/all/conanfile.py b/recipes/inversify-cpp/all/conanfile.py index 3d897954ee020..cbe49e9425718 100644 --- a/recipes/inversify-cpp/all/conanfile.py +++ b/recipes/inversify-cpp/all/conanfile.py @@ -1,20 +1,31 @@ -from conans import ConanFile, 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.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.52.0" class InversifyCppConan(ConanFile): name = "inversify-cpp" description = "C++17 inversion of control and dependency injection container library" - topics = ("ioc", "container", "dependency", "injection") + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/mosure/inversify-cpp" - license = "MIT" - settings = "compiler" + topics = ("ioc", "container", "dependency", "injection", "header-only") + + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True + @property + def _min_cppstd(self): + return 17 + @property def _compilers_minimum_version(self): return { @@ -24,27 +35,36 @@ def _compilers_minimum_version(self): "apple-clang": "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"): - tools.check_min_cppstd(self, 17) + 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("{} requires C++17, which your compiler does not support.".format(self.name)) + 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("{} requires C++17. Your compiler is unknown. Assuming it supports C++17.".format(self.name)) - - @property - def _source_subfolder(self): - return "source_subfolder" + self.output.warning(f"{self.name} requires C++{self._min_cppstd}. " + f"Your compiler is unknown. Assuming it supports C++{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="*", dst="include", src=os.path.join(self._source_subfolder, "include")) + copy(self, "LICENSE", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder) + copy(self, "*", + 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/inversify-cpp/all/test_package/CMakeLists.txt b/recipes/inversify-cpp/all/test_package/CMakeLists.txt index fc7a3028bf1a1..98d70570dc70a 100644 --- a/recipes/inversify-cpp/all/test_package/CMakeLists.txt +++ b/recipes/inversify-cpp/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(inversify-cpp CONFIG REQUIRED) +find_package(inversify-cpp REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} inversify-cpp::inversify-cpp) diff --git a/recipes/inversify-cpp/all/test_package/conanfile.py b/recipes/inversify-cpp/all/test_package/conanfile.py index 49a3a66ea5bad..fae501d0afb9e 100644 --- a/recipes/inversify-cpp/all/test_package/conanfile.py +++ b/recipes/inversify-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" + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/inversify-cpp/all/test_package/test_package.cpp b/recipes/inversify-cpp/all/test_package/test_package.cpp index 3bf0d0cfb88a1..4f9ae5cdc6296 100644 --- a/recipes/inversify-cpp/all/test_package/test_package.cpp +++ b/recipes/inversify-cpp/all/test_package/test_package.cpp @@ -2,21 +2,17 @@ #include "mosure/inversify.hpp" - namespace inversify = mosure::inversify; namespace symbols { - using foo = inversify::Symbol; +using foo = inversify::Symbol; } - int main() { - inversify::Container< - symbols::foo - > container; + inversify::Container container; container.bind().toConstantValue(true); - std::cout <<"working: " << container.get() << std::endl; + std::cout << "working: " << container.get() << std::endl; return 0; } diff --git a/recipes/inversify-cpp/all/test_v1_package/CMakeLists.txt b/recipes/inversify-cpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/inversify-cpp/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/inversify-cpp/all/test_v1_package/conanfile.py b/recipes/inversify-cpp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..49a3a66ea5bad --- /dev/null +++ b/recipes/inversify-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/iowow/all/conandata.yml b/recipes/iowow/all/conandata.yml new file mode 100644 index 0000000000000..047330d4f8fd9 --- /dev/null +++ b/recipes/iowow/all/conandata.yml @@ -0,0 +1,27 @@ +sources: + "1.4.18": + url: "https://github.com/Softmotions/iowow/archive/refs/tags/v1.4.18.tar.gz" + sha256: "ef4ee56dd77ce326fff25b6f41e7d78303322cca3f11cf5683ce9abfda34faf9" + "1.4.17": + url: "https://github.com/Softmotions/iowow/archive/refs/tags/v1.4.17.tar.gz" + sha256: "13a851026dbc1f31583fba96986e86e94a7554f9e7d38aa12a9ea5dbebdf328b" + "1.4.16": + url: "https://github.com/Softmotions/iowow/archive/refs/tags/v1.4.16.tar.gz" + sha256: "6e3b92b6c342ef6ef4a2731ca2d43368749d66ca876b24b773587364cff01003" +patches: + "1.4.18": + - patch_file: "patches/1.4.18-0002-fix-uint64_t-format.patch" + patch_description: "fix uint64_t printf format" + patch_type: "portability" + "1.4.17": + - patch_file: "patches/1.4.16-0002-fix-uint64_t-format.patch" + patch_description: "fix uint64_t printf format" + patch_type: "portability" + "1.4.16": + - patch_file: "patches/1.4.16-0001-some-fix-for-macOS.patch" + patch_description: "Some fixes for macOS" + patch_type: "portability" + patch_source: "https://github.com/Softmotions/iowow/pull/56" + - patch_file: "patches/1.4.16-0002-fix-uint64_t-format.patch" + patch_description: "fix uint64_t printf format" + patch_type: "portability" diff --git a/recipes/iowow/all/conanfile.py b/recipes/iowow/all/conanfile.py new file mode 100644 index 0000000000000..5a4fade27f4f6 --- /dev/null +++ b/recipes/iowow/all/conanfile.py @@ -0,0 +1,78 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import get, copy, rmdir, export_conandata_patches, apply_conandata_patches +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.microsoft import is_msvc +import os + +required_conan_version = ">=1.53.0" + +class IowowConan(ConanFile): + name = "iowow" + description = "A C utility library and persistent key/value storage engine." + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://iowow.softmotions.com/" + topics = ("database", "nosql", "key-value", "kvstore", "skiplist", "ejdb") + package_type = "library" + settings = "os", "compiler", "build_type", "arch" + 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 validate(self): + if is_msvc(self): + raise ConanInvalidConfiguration(f"{self.ref} is not supported on Visual Studio") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CMAKE_BUILD_TYPE"] = self.settings.build_type + tc.variables["BUILD_EXAMPLES"] = False + tc.variables["PACKAGE_ZIP"] = False + tc.variables["PACKAGE_TGZ"] = 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() + + 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.libs = ["iowow-1"] + self.cpp_info.set_property("pkg_config_name", "package") + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("pthread") + self.cpp_info.system_libs.append("m") diff --git a/recipes/iowow/all/patches/1.4.16-0001-some-fix-for-macOS.patch b/recipes/iowow/all/patches/1.4.16-0001-some-fix-for-macOS.patch new file mode 100644 index 0000000000000..0a42af275a2ee --- /dev/null +++ b/recipes/iowow/all/patches/1.4.16-0001-some-fix-for-macOS.patch @@ -0,0 +1,148 @@ +diff --git a/a/src/CMakeLists.txt b/b/src/CMakeLists.txt +index 7fd40ff..6c5990e 100644 +--- a/a/src/CMakeLists.txt ++++ b/b/src/CMakeLists.txt +@@ -184,7 +184,7 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} \ + -Wno-sign-compare -Wno-unused-parameter \ + -Wno-implicit-fallthrough -Wno-unknown-pragmas -Wno-unused-function -Wno-missing-field-initializers \ + -Wno-missing-braces") +-if (APPLE) ++if (APPLE AND CMAKE_C_COMPILER_ID MATCHES "Clang") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-shorten-64-to-32") + endif() + +diff --git a/a/src/platform/unix/unix.c b/b/src/platform/unix/unix.c +index 96b4920..0f8ceb4 100644 +--- a/a/src/platform/unix/unix.c ++++ b/b/src/platform/unix/unix.c +@@ -348,6 +348,7 @@ iwrc iwp_exec_path(char *opath, size_t opath_maxlen) { + if (ret < 0) { + return iwrc_set_errno(IW_ERROR_ERRNO, errno); + } ++ return 0; + #else + // TODO: + return IW_ERROR_NOT_IMPLEMENTED; +diff --git a/a/src/utils/iwhmap.c b/b/src/utils/iwhmap.c +index 07ae953..757e31f 100644 +--- a/a/src/utils/iwhmap.c ++++ b/b/src/utils/iwhmap.c +@@ -109,13 +109,13 @@ IW_INLINE uint32_t _hash_uint64(uint64_t x) { + } + + IW_INLINE uint32_t _hash_uint64_key(const void *key) { +- if (sizeof(uintptr_t) >= sizeof(uint64_t)) { ++#ifdef IW_64 + return _hash_uint64((uint64_t) key); +- } else { ++#else + uint64_t lv; + memcpy(&lv, key, sizeof(lv)); + return _hash_uint64(lv); +- } ++#endif + } + + IW_INLINE uint32_t _hash_uint32_key(const void *key) { +diff --git a/a/src/utils/murmur3.c b/b/src/utils/murmur3.c +index c09bf73..7f3a066 100644 +--- a/a/src/utils/murmur3.c ++++ b/b/src/utils/murmur3.c +@@ -7,7 +7,7 @@ + #include "murmur3.h" + #include + +-#if !defined(__x86_64__) || defined(IW_TESTS) ++#if !defined(IW64) || defined(IW_TESTS) + + IW_INLINE uint32_t rotl32(uint32_t x, int8_t r) { + return (x << r) | (x >> (32 - r)); +@@ -22,10 +22,28 @@ IW_INLINE uint64_t rotl64(uint64_t x, int8_t r) { + #define ROTL32(x, y) rotl32(x, y) + #define ROTL64(x, y) rotl64(x, y) + ++IW_INLINE uint32_t getblock32 (const uint32_t * p, size_t i) ++{ ++#ifndef IW_BIGENDIAN ++ return p[i]; ++#else ++ return IW_SWAB32(p[i]); ++#endif ++} ++ ++IW_INLINE uint64_t getblock64 (const uint64_t * p, size_t i) ++{ ++#ifndef IW_BIGENDIAN ++ return p[i]; ++#else ++ return IW_SWAB64(p[i]); ++#endif ++} ++ + static uint32_t seed_value = 0x2fa1bca; + + // Finalization mix - force all bits of a hash block to avalanche +-#if !defined(__x86_64__) || defined(IW_TESTS) ++#if !defined(IW64) || defined(IW_TESTS) + + IW_INLINE uint32_t fmix32(uint32_t h) { + h ^= h >> 16; +@@ -47,7 +65,7 @@ IW_INLINE uint64_t fmix64(uint64_t k) { + return k; + } + +-#if !defined(__x86_64__) || defined(IW_TESTS) ++#if !defined(IW64) || defined(IW_TESTS) + + void murmur3_x86_32(const void *key, size_t len, uint32_t seed, void *out) { + const uint8_t *data = (const uint8_t*) key; +@@ -59,9 +77,7 @@ void murmur3_x86_32(const void *key, size_t len, uint32_t seed, void *out) { + + const uint32_t *blocks = (const uint32_t*) (data + nblocks * 4); + for (i = -nblocks; i; i++) { +- uint32_t k1; +- +- memcpy(&k1, blocks + i, sizeof(k1)); ++ uint32_t k1 = getblock32(blocks, i); + + k1 *= c1; + k1 = ROTL32(k1, 15); +@@ -113,12 +129,10 @@ void murmur3_x86_128(const void *key, const size_t len, uint32_t seed, void *out + const uint32_t *blocks = (const uint32_t*) (data + nblocks * 16); + + for (i = -nblocks; i; i++) { +- uint32_t k1, k2, k3, k4; +- +- memcpy(&k1, blocks + i * 4 + 0, sizeof(k1)); +- memcpy(&k2, blocks + i * 4 + 1, sizeof(k2)); +- memcpy(&k3, blocks + i * 4 + 2, sizeof(k3)); +- memcpy(&k4, blocks + i * 4 + 3, sizeof(k4)); ++ uint32_t k1 = getblock32(blocks, i * 4 + 0); ++ uint32_t k2 = getblock32(blocks, i * 4 + 1); ++ uint32_t k3 = getblock32(blocks, i * 4 + 2); ++ uint32_t k4 = getblock32(blocks, i * 4 + 3); + + k1 *= c1; + k1 = ROTL32(k1, 15); +@@ -264,10 +278,8 @@ void murmur3_x64_128(const void *key, const size_t len, const uint32_t seed, voi + + const uint64_t *blocks = (const uint64_t*) (data); + for (i = 0; i < nblocks; i++) { +- uint64_t k1, k2; +- +- memcpy(&k1, blocks + i * 2 + 0, sizeof(k1)); +- memcpy(&k2, blocks + i * 2 + 1, sizeof(k2)); ++ uint64_t k1 = getblock64(blocks, i * 2 + 0); ++ uint64_t k2 = getblock64(blocks, i * 2 + 1); + + k1 *= c1; + k1 = ROTL64(k1, 31); +@@ -358,7 +370,7 @@ void murmur3_x64_128(const void *key, const size_t len, const uint32_t seed, voi + } + + uint32_t murmur3(const char *keyptr, size_t len) { +-#ifdef __x86_64__ ++#ifdef IW_64 + uint64_t hash[2]; + murmur3_x64_128(keyptr, len, seed_value, hash); + return (uint32_t) hash[1]; diff --git a/recipes/iowow/all/patches/1.4.16-0002-fix-uint64_t-format.patch b/recipes/iowow/all/patches/1.4.16-0002-fix-uint64_t-format.patch new file mode 100644 index 0000000000000..82d76f00b56a7 --- /dev/null +++ b/recipes/iowow/all/patches/1.4.16-0002-fix-uint64_t-format.patch @@ -0,0 +1,13 @@ +diff --git a/a/src/fs/iwfsmfile.c b/b/src/fs/iwfsmfile.c +index 75cc4d5..6ee3f7e 100644 +--- a/a/src/fs/iwfsmfile.c ++++ b/b/src/fs/iwfsmfile.c +@@ -1338,7 +1338,7 @@ static iwrc _fsm_read_meta_lr(struct fsm *fsm) { + fsm->bmlen = llv; + if (llv & (64 - 1)) { + rc = IWFS_ERROR_INVALID_FILEMETA; +- iwlog_ecode_error(rc, "Free-space bitmap length is not 64bit aligned: %" PRIuMAX "", fsm->bmlen); ++ iwlog_ecode_error(rc, "Free-space bitmap length is not 64bit aligned: %" PRIx64 "", fsm->bmlen); + } + rp += sizeof(llv); + diff --git a/recipes/iowow/all/patches/1.4.18-0002-fix-uint64_t-format.patch b/recipes/iowow/all/patches/1.4.18-0002-fix-uint64_t-format.patch new file mode 100644 index 0000000000000..3253bb3ff1bdd --- /dev/null +++ b/recipes/iowow/all/patches/1.4.18-0002-fix-uint64_t-format.patch @@ -0,0 +1,13 @@ +diff --git a/src/fs/iwfsmfile.c b/src/fs/iwfsmfile.c +index 2d1452a..121e989 100644 +--- a/src/fs/iwfsmfile.c ++++ b/src/fs/iwfsmfile.c +@@ -1339,7 +1339,7 @@ static iwrc _fsm_read_meta_lr(struct fsm *fsm) { + fsm->bmlen = llv; + if (llv & (64 - 1)) { + rc = IWFS_ERROR_INVALID_FILEMETA; +- iwlog_ecode_error(rc, "Free-space bitmap length is not 64bit aligned: %" PRIuMAX "", fsm->bmlen); ++ iwlog_ecode_error(rc, "Free-space bitmap length is not 64bit aligned: %" PRIx64 "", fsm->bmlen); + } + rp += sizeof(llv); + diff --git a/recipes/iowow/all/test_package/CMakeLists.txt b/recipes/iowow/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..9e0ebfd3d59d1 --- /dev/null +++ b/recipes/iowow/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) + +find_package(iowow REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE iowow::iowow) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_11) diff --git a/recipes/iowow/all/test_package/conanfile.py b/recipes/iowow/all/test_package/conanfile.py new file mode 100644 index 0000000000000..ef5d7042163ec --- /dev/null +++ b/recipes/iowow/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/iowow/all/test_package/test_package.c b/recipes/iowow/all/test_package/test_package.c new file mode 100644 index 0000000000000..2ee836be4e2af --- /dev/null +++ b/recipes/iowow/all/test_package/test_package.c @@ -0,0 +1,14 @@ +#include "iowow/iwkv.h" + +int main() { + IWKV_OPTS opts = { + .path = "example1.db", + .oflags = IWKV_TRUNC // Cleanup database before open + }; + IWKV iwkv; + iwrc rc = iwkv_open(&opts, &iwkv); + + iwkv_close(&iwkv); + + return 0; +} diff --git a/recipes/iowow/config.yml b/recipes/iowow/config.yml new file mode 100644 index 0000000000000..c30ae14aca332 --- /dev/null +++ b/recipes/iowow/config.yml @@ -0,0 +1,7 @@ +versions: + "1.4.18": + folder: all + "1.4.17": + folder: all + "1.4.16": + folder: all diff --git a/recipes/ipaddress/all/conandata.yml b/recipes/ipaddress/all/conandata.yml new file mode 100644 index 0000000000000..a3ae373c62221 --- /dev/null +++ b/recipes/ipaddress/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "1.1.0": + url: "https://github.com/VladimirShaleev/ipaddress/archive/v1.1.0.tar.gz" + sha256: "e5084d83ebd712210882eb6dac14ed1b9b71584dede523b35c6181e0a06375f1" + "1.0.1": + url: "https://github.com/VladimirShaleev/ipaddress/archive/v1.0.1.tar.gz" + sha256: "49c16294f06fe95ffc66cae828dc08d116efb4a1ede3dddd21dcc182a2eceb03" diff --git a/recipes/ipaddress/all/conanfile.py b/recipes/ipaddress/all/conanfile.py new file mode 100644 index 0000000000000..1bdda098db7d5 --- /dev/null +++ b/recipes/ipaddress/all/conanfile.py @@ -0,0 +1,89 @@ +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.52.0" + + +class IpAddressConan(ConanFile): + name = "ipaddress" + description = "A library for working and manipulating IPv4/IPv6 addresses and networks" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/VladimirShaleev/ipaddress" + topics = ("ipv4", "ipv6", "ipaddress", "ip", "network", "header-only") + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + options = { + "exceptions": [True, False], + "overload_std": [True, False], + "ipv6_scope": [True, False], + "ipv6_scope_max_length": ["ANY"], + } + default_options = { + "exceptions": True, + "overload_std": True, + "ipv6_scope": True, + "ipv6_scope_max_length": 16, + } + + @property + def _min_cppstd(self): + return 11 + + @property + def _compilers_minimum_version(self): + return { + "apple-clang": "13.0", + "clang": "6.0", + "gcc": "7.5", + "msvc": "192", + "Visual Studio": "16", + } + + 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} doesn't support {self.settings.compiler} < {minimum_version}" + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def package(self): + copy(self, "LICENSE", 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_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + if not self.options.exceptions: + self.cpp_info.defines.append("IPADDRESS_NO_EXCEPTIONS") + if not self.options.overload_std: + self.cpp_info.defines.append("IPADDRESS_NO_OVERLOAD_STD") + if not self.options.ipv6_scope: + self.cpp_info.defines.append("IPADDRESS_NO_IPV6_SCOPE") + else: + self.cpp_info.defines.append(f"IPADDRESS_IPV6_SCOPE_MAX_LENGTH={int(self.options.ipv6_scope_max_length)}") diff --git a/recipes/ipaddress/all/test_package/CMakeLists.txt b/recipes/ipaddress/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..f9368cb4ca108 --- /dev/null +++ b/recipes/ipaddress/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(ipaddress CONFIG REQUIRED) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} ipaddress::ipaddress) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/ipaddress/all/test_package/conanfile.py b/recipes/ipaddress/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/ipaddress/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/ipaddress/all/test_package/test_package.cpp b/recipes/ipaddress/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..1e0a4a4597eaf --- /dev/null +++ b/recipes/ipaddress/all/test_package/test_package.cpp @@ -0,0 +1,11 @@ +#include +#include +#include "ipaddress/ipaddress.hpp" + + +int main(void) { + auto ip = ipaddress::ipv6_address::parse("fec0::1ff:fe23:4567:890a%eth2"); + std::cout << "Parsing ipv6: " << ip << std::endl; + + return EXIT_SUCCESS; +} diff --git a/recipes/ipaddress/config.yml b/recipes/ipaddress/config.yml new file mode 100644 index 0000000000000..20ec1c9e2bdee --- /dev/null +++ b/recipes/ipaddress/config.yml @@ -0,0 +1,5 @@ +versions: + "1.1.0": + folder: all + "1.0.1": + folder: all diff --git a/recipes/iphreeqc/all/conandata.yml b/recipes/iphreeqc/all/conandata.yml new file mode 100644 index 0000000000000..a249b379218dd --- /dev/null +++ b/recipes/iphreeqc/all/conandata.yml @@ -0,0 +1,9 @@ +sources: + "3.8.1": + url: "https://github.com/usgs-coupled/iphreeqc/releases/download/v3.8.1/iphreeqc-3.8.1-16963.tar.gz" + sha256: "15c47959a25e6c8b5d0c47214ea0c3f3626257dacc24a89d0f9c9635186c375c" +patches: + "3.8.1": + - patch_file: "patches/3.8.1-0001-dont-build-examples-doc-database.patch" + patch_description: "Don't build examples, doc and database" + patch_type: "conan" diff --git a/recipes/iphreeqc/all/conanfile.py b/recipes/iphreeqc/all/conanfile.py new file mode 100644 index 0000000000000..84c2b765e8d90 --- /dev/null +++ b/recipes/iphreeqc/all/conanfile.py @@ -0,0 +1,101 @@ +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, rmdir +from conan.tools.microsoft import msvc_runtime_flag +import os + +required_conan_version = ">=1.54.0" + + +class IphreeqcConan(ConanFile): + name = "iphreeqc" + description = ( + "Library implementing the geochemical model PHREEQC. It is capable of " + "simulating a wide range of equilibrium reactions between water and " + "minerals, ion exchangers, surface complexes, solid solutions, and gases." + ) + license = "FSFUL" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://www.usgs.gov/software/phreeqc-version-3" + topics = ("geochemistry", "modeling") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + @property + def _is_cl_like(self): + return self.settings.compiler.get_safe("runtime") is not None + + @property + def _is_cl_like_static_runtime(self): + return self._is_cl_like and "MT" in msvc_runtime_flag(self) + + 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 build_requirements(self): + self.tool_requires("cmake/[>=3.20 <4]") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + if self._is_cl_like: + tc.variables["IPHREEQC_STATIC_RUNTIME"] = self._is_cl_like_static_runtime + tc.variables["IPHREEQC_ENABLE_MODULE"] = False + tc.variables["IPHREEQC_FORTRAN_TESTING"] = False + tc.variables["BUILD_CLR_LIBS"] = False + tc.generate() + + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "INSTALL", 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, "src")) + rmdir(self, os.path.join(self.package_folder, "share")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "IPhreeqc") + self.cpp_info.set_property("cmake_target_name", "IPhreeqc::IPhreeqc") + postfix = "" + if self.settings.build_type == "Debug": + postfix += "d" + elif self.settings.build_type == "MinSizeRel": + postfix += "msr" + elif self.settings.build_type == "RelWithDebInfo": + postfix += "rwd" + self.cpp_info.libs = [f"IPhreeqc{postfix}"] + self.cpp_info.defines.append("IPHREEQC_NO_FORTRAN_MODULE") + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") + if not self.options.shared: + libcxx = stdcpp_library(self) + if libcxx: + self.cpp_info.system_libs.append(libcxx) diff --git a/recipes/iphreeqc/all/patches/3.8.1-0001-dont-build-examples-doc-database.patch b/recipes/iphreeqc/all/patches/3.8.1-0001-dont-build-examples-doc-database.patch new file mode 100644 index 0000000000000..3704fa470a6a6 --- /dev/null +++ b/recipes/iphreeqc/all/patches/3.8.1-0001-dont-build-examples-doc-database.patch @@ -0,0 +1,11 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -400,7 +400,7 @@ endif() + + include (CTest) + +-if (STANDALONE_BUILD) ++if (0) + + add_subdirectory(database) + add_subdirectory(doc) diff --git a/recipes/iphreeqc/all/test_package/CMakeLists.txt b/recipes/iphreeqc/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..13618cfaf693e --- /dev/null +++ b/recipes/iphreeqc/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) + +find_package(IPhreeqc REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE IPhreeqc::IPhreeqc) diff --git a/recipes/iphreeqc/all/test_package/conanfile.py b/recipes/iphreeqc/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0a6bc68712d90 --- /dev/null +++ b/recipes/iphreeqc/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/iphreeqc/all/test_package/test_package.c b/recipes/iphreeqc/all/test_package/test_package.c new file mode 100644 index 0000000000000..f29ed23c37243 --- /dev/null +++ b/recipes/iphreeqc/all/test_package/test_package.c @@ -0,0 +1,8 @@ +#include + +int main() +{ + int id = CreateIPhreeqc(); + DestroyIPhreeqc(id); + return 0; +} diff --git a/recipes/iphreeqc/config.yml b/recipes/iphreeqc/config.yml new file mode 100644 index 0000000000000..f3cf585c380d6 --- /dev/null +++ b/recipes/iphreeqc/config.yml @@ -0,0 +1,3 @@ +versions: + "3.8.1": + folder: all diff --git a/recipes/iqa/all/CMakeLists.txt b/recipes/iqa/all/CMakeLists.txt index 04c167a387fc1..6b7355d415953 100644 --- a/recipes/iqa/all/CMakeLists.txt +++ b/recipes/iqa/all/CMakeLists.txt @@ -1,22 +1,16 @@ -cmake_minimum_required(VERSION 3.4) +cmake_minimum_required(VERSION 3.12) project(cmake_wrapper) -include(conanbuildinfo.cmake) -conan_basic_setup() - if(MSVC AND BUILD_SHARED_LIBS) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) endif() -file(GLOB IQA_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder/source/*.c) -file(GLOB IQA_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder/include/*.h) +file(GLOB IQA_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/source/*.c) +file(GLOB IQA_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src/include/*.h) add_library(iqa ${IQA_SOURCES}) -target_include_directories(iqa PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder/include) +target_include_directories(iqa PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src/include) -install(TARGETS iqa - ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib - RUNTIME DESTINATION bin -) +include(GNUInstallDirs) +install(TARGETS iqa) install(FILES ${IQA_HEADERS} DESTINATION include) diff --git a/recipes/iqa/all/conanfile.py b/recipes/iqa/all/conanfile.py index 1f64617c87676..5fed7c16effcf 100644 --- a/recipes/iqa/all/conanfile.py +++ b/recipes/iqa/all/conanfile.py @@ -1,16 +1,22 @@ import os -import glob -from conans import ConanFile, CMake, tools + +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import collect_libs, copy, get, save + +required_conan_version = ">=1.53.0" class IqaConan(ConanFile): name = "iqa" description = "Image Quality Analysis Library" license = "BSD-3-Clause" - topics = ("conan", "iqa", "image", "quality", "analysis") - homepage = "https://github.com/tjdistler/iqa" url = "https://github.com/conan-io/conan-center-index" - settings = "os", "compiler", "build_type", "arch" + homepage = "https://github.com/tjdistler/iqa" + topics = ("image", "quality", "analysis") + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -19,18 +25,9 @@ class IqaConan(ConanFile): "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): + copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder) def config_options(self): if self.settings.os == "Windows": @@ -38,40 +35,38 @@ 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): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = glob.glob('iqa-*/')[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.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(build_script_folder=self.export_sources_folder) cmake.build() def _extract_license(self): - content_lines = open(os.path.join(self._source_subfolder, "include", "iqa.h")).readlines() + content_lines = open(os.path.join(self.source_folder, "include", "iqa.h")).readlines() license_content = [] for i in range(1, 31): license_content.append(content_lines[i][3:-1]) - tools.save("LICENSE", "\n".join(license_content)) + save(self, os.path.join(self.package_folder, "licenses", "LICENSE"), "\n".join(license_content)) def package(self): - cmake = self._configure_cmake() - cmake.install() self._extract_license() - self.copy("LICENSE", dst="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 self.settings.os == "Linux": self.cpp_info.system_libs = ["m"] diff --git a/recipes/iqa/all/test_package/CMakeLists.txt b/recipes/iqa/all/test_package/CMakeLists.txt index 094a38e418f47..5401493431040 100644 --- a/recipes/iqa/all/test_package/CMakeLists.txt +++ b/recipes/iqa/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(PackageTest C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(iqa REQUIRED CONFIG) add_executable(test_package test_package.c) -target_link_libraries(test_package ${CONAN_LIBS}) +target_link_libraries(test_package PRIVATE iqa::iqa) diff --git a/recipes/iqa/all/test_package/conanfile.py b/recipes/iqa/all/test_package/conanfile.py index 02bdaace3b783..ef5d7042163ec 100644 --- a/recipes/iqa/all/test_package/conanfile.py +++ b/recipes/iqa/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 TestConan(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", "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/iqa/all/test_v1_package/CMakeLists.txt b/recipes/iqa/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/iqa/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/iqa/all/test_v1_package/conanfile.py b/recipes/iqa/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..54e4743603cf3 --- /dev/null +++ b/recipes/iqa/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.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) 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/isa-l/all/conanfile.py b/recipes/isa-l/all/conanfile.py index 56f45edf048a4..de6e6376e8a4f 100644 --- a/recipes/isa-l/all/conanfile.py +++ b/recipes/isa-l/all/conanfile.py @@ -1,17 +1,25 @@ -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 chdir, copy, get, replace_in_file +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, NMakeToolchain + +required_conan_version = ">=1.53.0" + class LibisalConan(ConanFile): name = "isa-l" description = "Intel's Intelligent Storage Acceleration Library" - license = "BSD-3" + license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/intel/isa-l" - topics = ("isa-l", "compression") + topics = "compression" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -19,54 +27,96 @@ class LibisalConan(ConanFile): } default_options = { "shared": False, - "fPIC" :True + "fPIC": True, } - build_requires = ( - "libtool/2.4.6", - "nasm/2.15.05", - ) @property - def _source_subfolder(self): - return "source_subfolder" + def _settings_build(self): + return getattr(self, "settings_build", self.settings) - def validate(self): - if self.settings.arch not in [ "x86", "x86_64", "armv8" ]: - raise ConanInvalidConfiguration("CPU Architecture not supported") - if self.settings.os not in ["Linux", "FreeBSD"]: - raise ConanInvalidConfiguration("Only Linux and FreeBSD builds are supported") + 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.libcxx") + self.settings.rm_safe("compiler.cppstd") 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.arch not in ["x86", "x86_64"]: + raise ConanInvalidConfiguration(f"{self.settings.arch} architecture is not supported") + if self.version == "2.30.0" and self._settings_build.arch == "armv8": + raise ConanInvalidConfiguration(f"Version {self.version} does not support armv8") + + def build_requirements(self): + self.tool_requires("nasm/2.15.05") + 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], 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() + if is_msvc(self): + tc = NMakeToolchain(self) + tc.generate() + else: + tc = AutotoolsToolchain(self) + # ./configure bugs out if $AS executable has an absolute path + env = tc.environment() + env.define("AS", "nasm") + tc.generate(env) def build(self): - with tools.chdir(self._source_subfolder): - self.run("./autogen.sh") - env_build = AutoToolsBuildEnvironment(self) - extra_args = list() - if self.options.shared: - extra_args.extend(('--enable-static=no',)) + with chdir(self, self.source_folder): + if is_msvc(self): + replace_in_file(self, "Makefile.nmake", + " static" if self.options.shared else " dll", "") + self.run("nmake /f Makefile.nmake") else: - extra_args.extend(('--enable-shared=no',)) - env_build.configure(".", args=extra_args, build=False, host=False, target=False) - env_build.make() + autotools = Autotools(self) + autotools.autoreconf() + autotools.configure() + autotools.make() def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - self.copy("*/isa-l.h", dst="include/isa-l", keep_path=False) - self.copy("*.h", dst="include/isa-l", src="%s/include" % (self._source_subfolder) , keep_path=False) - if self.options.shared: - self.copy("*.dll", dst="bin", keep_path=False) - self.copy("*.so*", dst="lib", keep_path=False, symlinks=True) - self.copy("*.dylib", dst="lib", keep_path=False) - else: - self.copy("*.a", dst="lib", keep_path=False) + copy(self, "LICENSE", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder) + copy(self, "*/isa-l.h", + dst=os.path.join(self.package_folder, "include/isa-l"), + src=self.source_folder, + keep_path=False) + copy(self, "*.h", + dst=os.path.join(self.package_folder, "include/isa-l"), + src=os.path.join(self.source_folder, "include"), + keep_path=False) + copy(self, "*.dll", + dst=os.path.join(self.package_folder, "bin"), + src=self.source_folder, + keep_path=False) + for pattern in ["*.so*", "*.dylib", "*.lib", "*.a"]: + copy(self, pattern, + dst=os.path.join(self.package_folder, "lib"), + src=self.source_folder, + keep_path=False) + fix_apple_shared_install_name(self) def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.set_property("pkg_config_name", "libisal") + if is_msvc(self): + suffix = "" if self.options.shared else "_static" + self.cpp_info.libs = [f"isa-l{suffix}"] + else: + self.cpp_info.libs = ["isal"] diff --git a/recipes/isa-l/all/test_package/CMakeLists.txt b/recipes/isa-l/all/test_package/CMakeLists.txt index 196188113685c..9e88b9de0b709 100644 --- a/recipes/isa-l/all/test_package/CMakeLists.txt +++ b/recipes/isa-l/all/test_package/CMakeLists.txt @@ -1,8 +1,8 @@ -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() +find_package(isa-l REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE isa-l::isa-l) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/isa-l/all/test_package/conanfile.py b/recipes/isa-l/all/test_package/conanfile.py index e1f2192537436..ef5d7042163ec 100644 --- a/recipes/isa-l/all/test_package/conanfile.py +++ b/recipes/isa-l/all/test_package/conanfile.py @@ -1,16 +1,19 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -from conans import ConanFile, CMake, tools, RunEnvironment -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" + 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) @@ -18,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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/isa-l/all/test_v1_package/CMakeLists.txt b/recipes/isa-l/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/isa-l/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/isa-l/all/test_v1_package/conanfile.py b/recipes/isa-l/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..9d2678d8486a0 --- /dev/null +++ b/recipes/isa-l/all/test_v1_package/conanfile.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +from conans import ConanFile, CMake, tools, RunEnvironment +from conan.tools.build import cross_building +import os +import subprocess +import re + + +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/isl/all/conandata.yml b/recipes/isl/all/conandata.yml index cf2c5f3fb54ee..525debaa9344b 100644 --- a/recipes/isl/all/conandata.yml +++ b/recipes/isl/all/conandata.yml @@ -1,10 +1,15 @@ sources: + "0.26": + url: "https://libisl.sourceforge.io/isl-0.26.tar.xz" + sha256: "a0b5cb06d24f9fa9e77b55fabbe9a3c94a336190345c2555f9915bb38e976504" + "0.25": + url: "https://libisl.sourceforge.io/isl-0.25.tar.xz" + sha256: "be7b210647ccadf90a2f0b000fca11a4d40546374a850db67adb32fad4b230d9" "0.24": - url: "https://libisl.sourceforge.io/isl-0.24.tar.gz" - sha256: "26e6e4d60ad59b3fff9948eb36743f0c874e124e410ef5bab930d0f546bc580d" - "0.23": - url: "https://libisl.sourceforge.io/isl-0.23.tar.gz" - sha256: "19e77cb562ab3da5a37f263208d6f902ae3a9d52c756bf6eb1a6b2f8a74b883c" - "0.22": - url: "https://libisl.sourceforge.io/isl-0.22.tar.gz" - sha256: "d0c6714e4427d3eb964388afe526a8e0f69687da7e944f1ad66ffa639923be46" + url: "https://libisl.sourceforge.io/isl-0.24.tar.xz" + sha256: "043105cc544f416b48736fff8caf077fb0663a717d06b1113f16e391ac99ebad" +patches: + "0.24": + - patch_file: "patches/0.24-0001-fix-ac_test_cflags.patch" + patch_description: "Fix ac_test_CFLAGS logic error" + patch_type: "portability" diff --git a/recipes/isl/all/conanfile.py b/recipes/isl/all/conanfile.py index 139d5fc0036f3..892a970bf8f60 100644 --- a/recipes/isl/all/conanfile.py +++ b/recipes/isl/all/conanfile.py @@ -1,9 +1,15 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, tools -from conans.errors import ConanInvalidConfiguration -from contextlib import contextmanager +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.build import cross_building +from conan.tools.files import copy, get, rm, rmdir, apply_conandata_patches, export_conandata_patches +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, msvc_runtime_flag, check_min_vs, unix_path, is_msvc_static_runtime +from conan.tools.scm import Version import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.58.0" class IslConan(ConanFile): @@ -13,23 +19,24 @@ class IslConan(ConanFile): license = "MIT" homepage = "https://libisl.sourceforge.io" 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_int": ["gmp", "imath", "imath-32"], + "autogen": [True, False], } default_options = { "shared": False, "fPIC": True, "with_int": "gmp", + "autogen": False, } - _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": @@ -37,97 +44,86 @@ 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.os == "Windows" and self.options.shared: raise ConanInvalidConfiguration("Cannot build shared isl library on Windows (due to libtool refusing to link to static/import libraries)") - if self.settings.os == "Macos" and self.settings.arch == "armv8": - raise ConanInvalidConfiguration("Apple M1 is not yet supported. Contributions are welcome") - if self.options.with_int != "gmp": - # FIXME: missing imath recipe - raise ConanInvalidConfiguration("imath is not (yet) available on cci") - if self.settings.compiler == "Visual Studio" and tools.Version(self.settings.compiler.version) < 16 and self.settings.compiler.runtime == "MDd": + if Version(self.version) < "0.25" and is_apple_os(self) and cross_building(self): + raise ConanInvalidConfiguration("Cross-building with Apple Clang is not supported yet") + if msvc_runtime_flag(self) == "MDd" and not check_min_vs(self, 192, raise_invalid=False): + # isl fails to link with this version of visual studio and MDd runtime: # gmp.lib(bdiv_dbm1c.obj) : fatal error LNK1318: Unexpected PDB error; OK (0) - raise ConanInvalidConfiguration("isl fails to link with this version of visual studio and MDd runtime") + raise ConanInvalidConfiguration("isl cannot be built with MDd runtime with MSVC < 192") def requirements(self): if self.options.with_int == "gmp": - self.requires("gmp/6.2.1") + self.requires("gmp/6.3.0") + elif self.options.with_int == "imath": + self.requires("imath/3.1.9") @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.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 self.options.autogen: + self.tool_requires("autoconf/2.71") + self.tool_requires("automake/1.16.5") + self.tool_requires("libtool/2.4.7") + + def package_id(self): + del self.info.options.autogen + + 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) - - @contextmanager - def _build_context(self): - if self.settings.compiler == "Visual Studio": - with tools.vcvars(self.settings): - 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), self.settings.compiler.runtime), - "CXX": "{} cl -nologo -{}".format(tools.unix_path(self.deps_user_info["automake"].compile), self.settings.compiler.runtime), - "NM": "dumpbin -symbols", - "OBJDUMP": ":", - "RANLIB": ":", - "STRIP": ":", - } - 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" - conf_args = [ - "--with-int={}".format(self.options.with_int), - "--enable-portable-binary", - "--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) + + def generate(self): + tc = AutotoolsToolchain(self) + tc.configure_args.append(f'--with-int={self.options.with_int}') + tc.configure_args.append("--enable-portable-binary") if self.options.with_int == "gmp": - conf_args.extend([ - "--with-gmp=system", - "--with-gmp-prefix={}".format(self.deps_cpp_info["gmp"].rootpath.replace("\\", "/")), - ]) - if self.settings.compiler == "Visual Studio": - if tools.Version(self.settings.compiler.version) >= 15: - self._autotools.flags.append("-Zf") - if tools.Version(self.settings.compiler.version) >= 12: - self._autotools.flags.append("-FS") - self._autotools.configure(args=conf_args, configure_dir=self._source_subfolder) - return self._autotools + tc.configure_args.append("--with-gmp=system") + tc.configure_args.append(f'--with-gmp-prefix={unix_path(self, self.dependencies["gmp"].package_folder)}') + if is_msvc(self): + if check_min_vs(self, 191, raise_invalid=False): + tc.extra_cflags = ["-Zf"] + if check_min_vs(self, 180, raise_invalid=False): + tc.extra_cflags = ["-FS"] + if is_msvc(self) and self.version == "0.24" and not is_msvc_static_runtime(self): + # Pass BUILD flags to avoid confusion with GCC and mixing of runtime variants + tc.configure_args += ['CC_FOR_BUILD=cl -nologo', f'CFLAGS_FOR_BUILD=-{msvc_runtime_flag(self)}'] + env = tc.environment() + if is_msvc(self): + env.define("CC", "cl -nologo") + env.define("CXX", "cl -nologo") + tc.generate(env) def build(self): - with self._build_context(): - autotools = self._configure_autotools() - autotools.make() + if self.options.autogen: + apply_conandata_patches(self) # Currently, the only patch is for the autogen use case + self.run("./autogen.sh", cwd=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() - - os.unlink(os.path.join(os.path.join(self.package_folder, "lib", "libisl.la"))) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + autotools.install() + rm(self, "*.la", os.path.join(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"] = "isl" + self.cpp_info.set_property("pkg_config_name", "isl") self.cpp_info.libs = ["isl"] diff --git a/recipes/isl/all/patches/0.24-0001-fix-ac_test_cflags.patch b/recipes/isl/all/patches/0.24-0001-fix-ac_test_cflags.patch new file mode 100644 index 0000000000000..ac347c50759b3 --- /dev/null +++ b/recipes/isl/all/patches/0.24-0001-fix-ac_test_cflags.patch @@ -0,0 +1,11 @@ +--- m4/ax_cc_maxopt.m4 ++++ m4/ax_cc_maxopt.m4 +@@ -65,7 +65,7 @@ + acx_maxopt_portable=$withval, acx_maxopt_portable=no) + + # Try to determine "good" native compiler flags if none specified via CFLAGS +-if test "$ac_test_CFLAGS" != "set"; then ++if test "x$ac_test_CFLAGS" = "x"; then + CFLAGS="" + case $ax_cv_c_compiler_vendor in + dec) CFLAGS="-newc -w0 -O5 -ansi_alias -ansi_args -fp_reorder -tune host" diff --git a/recipes/isl/all/test_package/CMakeLists.txt b/recipes/isl/all/test_package/CMakeLists.txt index 3a403dc404b41..c40193c08604f 100644 --- a/recipes/isl/all/test_package/CMakeLists.txt +++ b/recipes/isl/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(isl REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE isl::isl) diff --git a/recipes/isl/all/test_package/conanfile.py b/recipes/isl/all/test_package/conanfile.py index bd7165a553cf4..7b760066c7165 100644 --- a/recipes/isl/all/test_package/conanfile.py +++ b/recipes/isl/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 cross_building 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 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/isl/all/test_v1_package/CMakeLists.txt b/recipes/isl/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..33e5f24630032 --- /dev/null +++ b/recipes/isl/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() + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) diff --git a/recipes/isl/all/test_v1_package/conanfile.py b/recipes/isl/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..bd7165a553cf4 --- /dev/null +++ b/recipes/isl/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" + + 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/isl/config.yml b/recipes/isl/config.yml index e0fa5e44a1f96..ae426ef703a32 100644 --- a/recipes/isl/config.yml +++ b/recipes/isl/config.yml @@ -1,7 +1,7 @@ versions: - "0.24": + "0.26": folder: "all" - "0.23": + "0.25": folder: "all" - "0.22": + "0.24": folder: "all" 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/itk/all/CMakeLists.txt b/recipes/itk/all/CMakeLists.txt deleted file mode 100644 index 7ae2d73951a0d..0000000000000 --- a/recipes/itk/all/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -cmake_minimum_required(VERSION 3.10.2) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -# conan created FindXXX.cmake modules that create IMPORTED targets -# that not have the GLOBAL option set. By requiring them here, -# these targets are visible in all the subprojects. -file(GLOB conan_modules "Find*.cmake") -message("modules: ${conan_modules}") -foreach(module ${conan_modules}) - get_filename_component(modname "${module}" NAME) - string(REGEX MATCH "^Find(.*).cmake$" modmatch "${modname}") - if(NOT modmatch) - message(FATAL_ERROR "Not a module?? ${module} (${modname})") - endif() - message(STATUS "requiring package ${CMAKE_MATCH_1}") - find_package("${CMAKE_MATCH_1}" REQUIRED) -endforeach() - -add_subdirectory(source_subfolder) diff --git a/recipes/itk/all/conan_cmake_project_include.cmake b/recipes/itk/all/conan_cmake_project_include.cmake new file mode 100644 index 0000000000000..1583596ab7878 --- /dev/null +++ b/recipes/itk/all/conan_cmake_project_include.cmake @@ -0,0 +1,8 @@ +find_package(double-conversion REQUIRED CONFIG) +find_package(Eigen3 REQUIRED CONFIG) +find_package(EXPAT REQUIRED MODULE) +find_package(JPEG REQUIRED CONFIG) +find_package(OpenJPEG REQUIRED CONFIG) +find_package(PNG REQUIRED) +find_package(TIFF REQUIRED) +find_package(ZLIB REQUIRED) diff --git a/recipes/itk/all/conandata.yml b/recipes/itk/all/conandata.yml index 3cb9b81826a59..74a479bc9586a 100644 --- a/recipes/itk/all/conandata.yml +++ b/recipes/itk/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "5.3.0": + url: "https://github.com/InsightSoftwareConsortium/ITK/releases/download/v5.3.0/InsightToolkit-5.3.0.tar.gz" + sha256: "57a4471133dc8f76bde3d6eb45285c440bd40d113428884a1487472b7b71e383" "5.1.2": url: "https://github.com/InsightSoftwareConsortium/ITK/releases/download/v5.1.2/InsightToolkit-5.1.2.tar.gz" sha256: "f1e5a78e11125348f68f655c6b89b617c3a8b2c09f710081f621054811a70c98" @@ -6,9 +9,15 @@ sources: url: "https://github.com/InsightSoftwareConsortium/ITK/releases/download/v5.1.0/InsightToolkit-5.1.0.tar.gz" sha256: "121020a1611508cec8123eb5226215598cec07be627d843a2e6b6da891e61d13" patches: + "5.3.0": + - patch_file: "patches/0002-find-conan-packages.patch" + patch_description: "inject thirdparties from conan" + patch_type: "conan" "5.1.2": - patch_file: "patches/0001-find-conan-packages.patch" - base_path: "source_subfolder" + patch_description: "inject thirdparties from conan" + patch_type: "conan" "5.1.0": - patch_file: "patches/0001-find-conan-packages.patch" - base_path: "source_subfolder" + patch_description: "inject thirdparties from conan" + patch_type: "conan" diff --git a/recipes/itk/all/conanfile.py b/recipes/itk/all/conanfile.py index 3c833fb68b446..0ab11f37d60c6 100644 --- a/recipes/itk/all/conanfile.py +++ b/recipes/itk/all/conanfile.py @@ -1,20 +1,26 @@ -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, CMakeDeps, 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, rmdir, save +from conan.tools.microsoft import check_min_vs, is_msvc +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration import glob import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class ITKConan(ConanFile): name = "itk" - topics = ("itk", "scientific", "image", "processing") - homepage = "http://www.itk.org/" - url = "https://github.com/conan-io/conan-center-index" + description = "Open-source, cross-platform toolkit for N-dimensional scientific image processing, segmentation, and registration" license = "Apache-2.0" - description = "Insight Segmentation and Registration Toolkit" - + url = "https://github.com/conan-io/conan-center-index" + homepage = "http://www.itk.org/" + topics = ("medical-imaging", "scientific", "image", "processing") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -26,26 +32,23 @@ class ITKConan(ConanFile): } short_paths = True - generators = "cmake", "cmake_find_package" - _cmake = None @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 11 @property - def _build_subfolder(self): - return "build_subfolder" - - # TODO: Some packages can be added as optional, but they are not in CCI: - # - mkl - # - vtk - # - opencv + def _compilers_minimum_version(self): + return { + "Visual Studio": "14", + "gcc": "4.8.1", + "clang": "3.3", + "apple-clang": "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) + copy(self, "conan_cmake_project_include.cmake", self.recipe_folder, os.path.join(self.export_sources_folder, "src")) def config_options(self): if self.settings.os == "Windows": @@ -53,250 +56,239 @@ 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("dcmtk/3.6.6") - self.requires("double-conversion/3.2.0") + # TODO: Some packages can be added as optional, but they are not in CCI: + # - mkl + # - vtk + # - opencv + #todo: enable after fixing dcmtk compatibility with openssl on Windows + #self.requires("dcmtk/3.6.7") + self.requires("double-conversion/3.3.0") self.requires("eigen/3.4.0") - self.requires("expat/2.4.8") - self.requires("fftw/3.3.9") - self.requires("gdcm/3.0.9") - self.requires("hdf5/1.12.0") - self.requires("icu/71.1") # TODO: to remove? Seems to be a transitivie dependency through dcmtk - self.requires("libjpeg/9d") - self.requires("libpng/1.6.37") - self.requires("libtiff/4.3.0") - self.requires("openjpeg/2.4.0") - self.requires("onetbb/2020.3") - self.requires("zlib/1.2.12") - - @property - def _minimum_cpp_standard(self): - return 11 - - @property - def _minimum_compilers_version(self): - return { - "Visual Studio": "14", - "gcc": "4.8.1", - "clang": "3.3", - "apple-clang": "9", - } + self.requires("expat/[>=2.6.2 <3]") + self.requires("fftw/3.3.10") + self.requires("gdcm/3.0.23") + self.requires("hdf5/1.14.3") + self.requires("libjpeg/9e") + self.requires("libpng/[>=1.6 <2]") + self.requires("libtiff/4.6.0") + self.requires("openjpeg/2.5.2") + self.requires("onetbb/2021.9.0") + self.requires("zlib/[>=1.2.11 <2]") + + def build_requirements(self): + if Version(self.version) >= "5.3.0": + self.tool_requires("cmake/[>=3.16.3 <4]") def validate(self): - if self.options.shared and not self.options["hdf5"].shared: + if self.options.shared and not self.dependencies["hdf5"].options.shared: raise ConanInvalidConfiguration("When building a shared itk, hdf5 needs to be shared too (or not linked to by the consumer).\n" "This is because H5::DataSpace::ALL might get initialized twice, which will cause a H5::DataSpaceIException to be thrown).") - 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)) + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + check_min_vs(self, 190) + 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." + ) + if Version(self.version) < "5.2" and self.settings.os == "Macos": + raise ConanInvalidConfiguration(f"{self.ref} fails to compile in {self.settings.os}, fixed in 5.2.0") 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) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - - self._cmake = CMake(self) - self._cmake.definitions["BUILD_EXAMPLES"] = False - self._cmake.definitions["BUILD_TESTING"] = False - self._cmake.definitions["BUILD_DOCUMENTATION"] = False - self._cmake.definitions["ITK_SKIP_PATH_LENGTH_CHECKS"] = True - - self._cmake.definitions["ITK_USE_SYSTEM_LIBRARIES"] = True - self._cmake.definitions["ITK_USE_SYSTEM_DCMTK"] = True - self._cmake.definitions["ITK_USE_SYSTEM_DOUBLECONVERSION"] = True - self._cmake.definitions["ITK_USE_SYSTEM_EIGEN"] = True - self._cmake.definitions["ITK_USE_SYSTEM_FFTW"] = True - self._cmake.definitions["ITK_USE_SYSTEM_GDCM"] = True - self._cmake.definitions["ITK_USE_SYSTEM_HDF5"] = True - self._cmake.definitions["ITK_USE_SYSTEM_ICU"] = True - self._cmake.definitions["ITK_USE_SYSTEM_JPEG"] = True - self._cmake.definitions["ITK_USE_SYSTEM_PNG"] = True - self._cmake.definitions["ITK_USE_SYSTEM_TIFF"] = True - self._cmake.definitions["ITK_USE_SYSTEM_ZLIB"] = True + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + #call find_package on top level + tc.cache_variables["CMAKE_PROJECT_ITK_INCLUDE"] = os.path.join(self.source_folder, "conan_cmake_project_include.cmake") + tc.variables["BUILD_EXAMPLES"] = False + tc.variables["BUILD_TESTING"] = False + tc.variables["BUILD_DOCUMENTATION"] = False + tc.variables["DO_NOT_BUILD_ITK_TEST_DRIVER"] = True + tc.variables["DO_NOT_INSTALL_ITK_TEST_DRIVER"] = True + tc.variables["DISABLE_MODULE_TESTS"] = True + tc.variables["ITK_SKIP_PATH_LENGTH_CHECKS"] = True + + tc.variables["ITK_USE_SYSTEM_LIBRARIES"] = True + tc.variables["ITK_USE_SYSTEM_DCMTK"] = True + tc.variables["ITK_USE_SYSTEM_DOUBLECONVERSION"] = True + tc.variables["ITK_USE_SYSTEM_EIGEN"] = True + tc.variables["ITK_USE_SYSTEM_FFTW"] = True + tc.variables["ITK_USE_SYSTEM_GDCM"] = True + tc.variables["ITK_USE_SYSTEM_HDF5"] = True + tc.variables["ITK_USE_SYSTEM_ICU"] = True + tc.variables["ITK_USE_SYSTEM_JPEG"] = True + tc.variables["ITK_USE_SYSTEM_PNG"] = True + tc.variables["ITK_USE_SYSTEM_TIFF"] = True + tc.variables["ITK_USE_SYSTEM_ZLIB"] = True # FIXME: Missing Kwiml recipe - self._cmake.definitions["ITK_USE_SYSTEM_KWIML"] = False + tc.variables["ITK_USE_SYSTEM_KWIML"] = False # FIXME: Missing VXL recipe - self._cmake.definitions["ITK_USE_SYSTEM_VXL"] = False - self._cmake.definitions["GDCM_USE_SYSTEM_OPENJPEG"] = True - - self._cmake.definitions["ITK_BUILD_DEFAULT_MODULES"] = False - self._cmake.definitions["Module_ITKDeprecated"] = False - self._cmake.definitions["Module_ITKMINC"] = False - self._cmake.definitions["Module_ITKIOMINC"] = False - - self._cmake.definitions["Module_ITKVideoBridgeOpenCV"] = False - - self._cmake.definitions["Module_ITKDCMTK"] = True - self._cmake.definitions["Module_ITKIODCMTK"] = True - self._cmake.definitions["Module_ITKIOHDF5"] = True - self._cmake.definitions["Module_ITKIOTransformHDF5"] = False - self._cmake.definitions["Module_ITKAnisotropicSmoothing"] = True - self._cmake.definitions["Module_ITKAntiAlias"] = True - self._cmake.definitions["Module_ITKBiasCorrection"] = True - self._cmake.definitions["Module_ITKBinaryMathematicalMorphology"] = True - self._cmake.definitions["Module_ITKBioCell"] = True - self._cmake.definitions["Module_ITKClassifiers"] = True - self._cmake.definitions["Module_ITKColormap"] = True - self._cmake.definitions["Module_ITKConnectedComponents"] = True - self._cmake.definitions["Module_ITKConvolution"] = True - self._cmake.definitions["Module_ITKCurvatureFlow"] = True - self._cmake.definitions["Module_ITKDeconvolution"] = True - self._cmake.definitions["Module_ITKDeformableMesh"] = True - self._cmake.definitions["Module_ITKDenoising"] = True - self._cmake.definitions["Module_ITKDiffusionTensorImage"] = True - self._cmake.definitions["Module_ITKDisplacementField"] = True - self._cmake.definitions["Module_ITKDistanceMap"] = True - self._cmake.definitions["Module_ITKEigen"] = True - self._cmake.definitions["Module_ITKFEM"] = True - self._cmake.definitions["Module_ITKFEMRegistration"] = True - self._cmake.definitions["Module_ITKFFT"] = True - self._cmake.definitions["Module_ITKFastMarching"] = True - self._cmake.definitions["Module_ITKGIFTI"] = True - self._cmake.definitions["Module_ITKGPUAnisotropicSmoothing"] = True - self._cmake.definitions["Module_ITKGPUImageFilterBase"] = True - self._cmake.definitions["Module_ITKGPUPDEDeformableRegistration"] = True - self._cmake.definitions["Module_ITKGPURegistrationCommon"] = True - self._cmake.definitions["Module_ITKGPUSmoothing"] = True - self._cmake.definitions["Module_ITKGPUThresholding"] = True - self._cmake.definitions["Module_ITKIOCSV"] = True - self._cmake.definitions["Module_ITKIOGE"] = True - self._cmake.definitions["Module_ITKIOIPL"] = True - self._cmake.definitions["Module_ITKIOMesh"] = True - self._cmake.definitions["Module_ITKIOPhilipsREC"] = True - self._cmake.definitions["Module_ITKIORAW"] = True - self._cmake.definitions["Module_ITKIOSiemens"] = True - self._cmake.definitions["Module_ITKIOSpatialObjects"] = True - self._cmake.definitions["Module_ITKIOTransformBase"] = True - self._cmake.definitions["Module_ITKIOTransformInsightLegacy"] = True - self._cmake.definitions["Module_ITKIOTransformMatlab"] = True - self._cmake.definitions["Module_ITKIOXML"] = True - self._cmake.definitions["Module_ITKImageCompare"] = True - self._cmake.definitions["Module_ITKImageCompose"] = True - self._cmake.definitions["Module_ITKImageFeature"] = True - self._cmake.definitions["Module_ITKImageFusion"] = True - self._cmake.definitions["Module_ITKImageGradient"] = True - self._cmake.definitions["Module_ITKImageGrid"] = True - self._cmake.definitions["Module_ITKImageIntensity"] = True - self._cmake.definitions["Module_ITKImageLabel"] = True - self._cmake.definitions["Module_ITKImageSources"] = True - self._cmake.definitions["Module_ITKImageStatistics"] = True - self._cmake.definitions["Module_ITKIntegratedTest"] = True - self._cmake.definitions["Module_ITKKLMRegionGrowing"] = True - self._cmake.definitions["Module_ITKLabelMap"] = True - self._cmake.definitions["Module_ITKLabelVoting"] = True - self._cmake.definitions["Module_ITKLevelSets"] = True - self._cmake.definitions["Module_ITKLevelSetsv4"] = True - self._cmake.definitions["Module_ITKMarkovRandomFieldsClassifiers"] = True - self._cmake.definitions["Module_ITKMathematicalMorphology"] = True - self._cmake.definitions["Module_ITKMetricsv4"] = True - self._cmake.definitions["Module_ITKNarrowBand"] = True - self._cmake.definitions["Module_ITKNeuralNetworks"] = True - self._cmake.definitions["Module_ITKOptimizers"] = True - self._cmake.definitions["Module_ITKOptimizersv4"] = True - self._cmake.definitions["Module_ITKPDEDeformableRegistration"] = True - self._cmake.definitions["Module_ITKPath"] = True - self._cmake.definitions["Module_ITKPolynomials"] = True - self._cmake.definitions["Module_ITKQuadEdgeMeshFiltering"] = True - self._cmake.definitions["Module_ITKRegionGrowing"] = True - self._cmake.definitions["Module_ITKRegistrationCommon"] = True - self._cmake.definitions["Module_ITKRegistrationMethodsv4"] = True - self._cmake.definitions["Module_ITKReview"] = True - self._cmake.definitions["Module_ITKSignedDistanceFunction"] = True - self._cmake.definitions["Module_ITKSmoothing"] = True - self._cmake.definitions["Module_ITKSpatialFunction"] = True - self._cmake.definitions["Module_ITKTBB"] = True - self._cmake.definitions["Module_ITKThresholding"] = True - self._cmake.definitions["Module_ITKVideoCore"] = True - self._cmake.definitions["Module_ITKVideoFiltering"] = True - self._cmake.definitions["Module_ITKVideoIO"] = False - self._cmake.definitions["Module_ITKVoronoi"] = True - self._cmake.definitions["Module_ITKWatersheds"] = True - self._cmake.definitions["Module_ITKDICOMParser"] = True - - self._cmake.definitions["Module_ITKVTK"] = False - self._cmake.definitions["Module_ITKVtkGlue"] = False + tc.variables["ITK_USE_SYSTEM_VXL"] = False + tc.variables["GDCM_USE_SYSTEM_OPENJPEG"] = True + + tc.variables["ITK_BUILD_DEFAULT_MODULES"] = False + tc.variables["Module_ITKDeprecated"] = False + tc.variables["Module_ITKMINC"] = False + tc.variables["Module_ITKIOMINC"] = False + + tc.variables["Module_ITKVideoBridgeOpenCV"] = False + + #todo: enable after fixing dcmtk compatibility with openssl on Windows + tc.variables["Module_ITKDCMTK"] = False + tc.variables["Module_ITKIODCMTK"] = False + + tc.variables["Module_ITKIOHDF5"] = True + tc.variables["Module_ITKIOTransformHDF5"] = False + tc.variables["Module_ITKAnisotropicSmoothing"] = True + tc.variables["Module_ITKAntiAlias"] = True + tc.variables["Module_ITKBiasCorrection"] = True + tc.variables["Module_ITKBinaryMathematicalMorphology"] = True + tc.variables["Module_ITKBioCell"] = True + tc.variables["Module_ITKClassifiers"] = True + tc.variables["Module_ITKColormap"] = True + tc.variables["Module_ITKConnectedComponents"] = True + tc.variables["Module_ITKConvolution"] = True + tc.variables["Module_ITKCurvatureFlow"] = True + tc.variables["Module_ITKDeconvolution"] = True + tc.variables["Module_ITKDeformableMesh"] = True + tc.variables["Module_ITKDenoising"] = True + tc.variables["Module_ITKDiffusionTensorImage"] = True + tc.variables["Module_ITKDisplacementField"] = True + tc.variables["Module_ITKDistanceMap"] = True + tc.variables["Module_ITKEigen"] = True + tc.variables["Module_ITKFEM"] = True + tc.variables["Module_ITKFEMRegistration"] = True + tc.variables["Module_ITKFFT"] = True + tc.variables["Module_ITKFastMarching"] = True + tc.variables["Module_ITKGIFTI"] = True + tc.variables["Module_ITKGPUAnisotropicSmoothing"] = True + tc.variables["Module_ITKGPUImageFilterBase"] = True + tc.variables["Module_ITKGPUPDEDeformableRegistration"] = True + tc.variables["Module_ITKGPURegistrationCommon"] = True + tc.variables["Module_ITKGPUSmoothing"] = True + tc.variables["Module_ITKGPUThresholding"] = True + tc.variables["Module_ITKIOCSV"] = True + tc.variables["Module_ITKIOGE"] = True + tc.variables["Module_ITKIOIPL"] = True + tc.variables["Module_ITKIOMesh"] = True + tc.variables["Module_ITKIOPhilipsREC"] = True + tc.variables["Module_ITKIORAW"] = True + tc.variables["Module_ITKIOSiemens"] = True + tc.variables["Module_ITKIOSpatialObjects"] = True + tc.variables["Module_ITKIOTransformBase"] = True + tc.variables["Module_ITKIOTransformInsightLegacy"] = True + tc.variables["Module_ITKIOTransformMatlab"] = True + tc.variables["Module_ITKIOXML"] = True + tc.variables["Module_ITKImageCompare"] = True + tc.variables["Module_ITKImageCompose"] = True + tc.variables["Module_ITKImageFeature"] = True + tc.variables["Module_ITKImageFusion"] = True + tc.variables["Module_ITKImageGradient"] = True + tc.variables["Module_ITKImageGrid"] = True + tc.variables["Module_ITKImageIntensity"] = True + tc.variables["Module_ITKImageLabel"] = True + tc.variables["Module_ITKImageSources"] = True + tc.variables["Module_ITKImageStatistics"] = True + tc.variables["Module_ITKIntegratedTest"] = True + tc.variables["Module_ITKKLMRegionGrowing"] = True + tc.variables["Module_ITKLabelMap"] = True + tc.variables["Module_ITKLabelVoting"] = True + tc.variables["Module_ITKLevelSets"] = True + tc.variables["Module_ITKLevelSetsv4"] = True + tc.variables["Module_ITKMarkovRandomFieldsClassifiers"] = True + tc.variables["Module_ITKMathematicalMorphology"] = True + tc.variables["Module_ITKMetricsv4"] = True + tc.variables["Module_ITKNarrowBand"] = True + tc.variables["Module_ITKNeuralNetworks"] = True + tc.variables["Module_ITKOptimizers"] = True + tc.variables["Module_ITKOptimizersv4"] = True + tc.variables["Module_ITKPDEDeformableRegistration"] = True + tc.variables["Module_ITKPath"] = True + tc.variables["Module_ITKPolynomials"] = True + tc.variables["Module_ITKQuadEdgeMeshFiltering"] = True + tc.variables["Module_ITKRegionGrowing"] = True + tc.variables["Module_ITKRegistrationCommon"] = True + tc.variables["Module_ITKRegistrationMethodsv4"] = True + tc.variables["Module_ITKReview"] = True + tc.variables["Module_ITKSignedDistanceFunction"] = True + tc.variables["Module_ITKSmoothing"] = True + tc.variables["Module_ITKSpatialFunction"] = True + tc.variables["Module_ITKTBB"] = True + tc.variables["Module_ITKThresholding"] = True + tc.variables["Module_ITKVideoCore"] = True + tc.variables["Module_ITKVideoFiltering"] = True + tc.variables["Module_ITKVideoIO"] = False + tc.variables["Module_ITKVoronoi"] = True + tc.variables["Module_ITKWatersheds"] = True + tc.variables["Module_ITKDICOMParser"] = True + + tc.variables["Module_ITKVTK"] = False + tc.variables["Module_ITKVtkGlue"] = False # Disabled on Linux (link errors) - self._cmake.definitions["Module_ITKLevelSetsv4Visualization"] = False + tc.variables["Module_ITKLevelSetsv4Visualization"] = False # Disabled because Vxl vidl is not built anymore - self._cmake.definitions["Module_ITKVideoBridgeVXL"] = False + tc.variables["Module_ITKVideoBridgeVXL"] = False - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + tc.generate() - def build(self): - self._patch_sources() - cmake = self._configure_cmake() - cmake.build() + tc = CMakeDeps(self) + tc.generate() - def package(self): - self.copy("LICENSE", 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, "share")) - tools.rmdir(os.path.join(self.package_folder, self._cmake_module_dir, "Modules")) - # Do not remove UseITK.cmake and *.h.in files - for cmake_file in glob.glob(os.path.join(self.package_folder, self._cmake_module_dir, "*.cmake")): - if os.path.basename(cmake_file) != "UseITK.cmake": - os.remove(cmake_file) + venv = VirtualBuildEnv(self) + venv.generate() - self._create_cmake_module_alias_targets( - os.path.join(self.package_folder, self._module_file_rel_path), - {target:"ITK::{}".format(target) for target in self._itk_components.keys()}, - ) + def _patch_sources(self): + apply_conandata_patches(self) + #The CMake policy CMP0091 must be NEW, but is '' + replace_in_file(self, + os.path.join(self.source_folder, "Modules", "ThirdParty", "VNL", "src", "vxl", "config", "cmake", "config", "VXLIntrospectionConfig.cmake"), + "-DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS}", + "-DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS}") - @staticmethod - def _create_cmake_module_alias_targets(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)) - tools.save(module_file, content) + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() + cmake.build() @property - def _module_file_rel_path(self): - return os.path.join(self._cmake_module_dir, "conan-official-{}-targets.cmake".format(self.name)) + def _itk_subdir(self): + v = Version(self.version) + return f"ITK-{v.major}.{v.minor}" @property def _cmake_module_dir(self): return os.path.join("lib", "cmake", self._itk_subdir) @property - def _itk_subdir(self): - v = tools.Version(self.version) - return "ITK-{}.{}".format(v.major, v.minor) + def _module_variables_file_rel_path(self): + return os.path.join(self._cmake_module_dir, f"conan-official-{self.name}-variables.cmake") + + @property + def _module_file_rel_path(self): + return os.path.join(self._cmake_module_dir, f"conan-official-{self.name}-targets.cmake") @property def _itk_components(self): def libm(): return ["m"] if self.settings.os in ["Linux", "FreeBSD"] else [] + def libdl(): + return ["dl"] if self.settings.os in ["Linux", "FreeBSD"] else [] return { - "itksys": {}, + "itksys": {"system_libs": libdl()}, "itkvcl": {"system_libs": libm()}, "itkv3p_netlib": {"system_libs": libm()}, "itkvnl": {"requires": ["itkvcl"]}, @@ -386,7 +378,8 @@ def libm(): "ITKIOBMP": {"requires": ["ITKIOImageBase"]}, "ITKIOBioRad": {"requires": ["ITKIOImageBase"]}, "ITKIOCSV": {"requires": ["ITKIOImageBase"]}, - "ITKIODCMTK": {"requires": ["ITKIOImageBase", "dcmtk::dcmtk", "icu::icu"]}, + #todo: enable after fixing dcmtk compatibility with openssl on Windows + #"ITKIODCMTK": {"requires": ["ITKIOImageBase", "dcmtk::dcmtk"]}, "ITKIOGDCM": {"requires": ["ITKCommon", "ITKIOImageBase", "gdcm::gdcmDICT", "gdcm::gdcmMSFF"]}, "ITKIOIPL": {"requires": ["ITKIOImageBase"]}, "ITKIOGE": {"requires": ["ITKIOIPL", "ITKIOImageBase"]}, @@ -477,32 +470,76 @@ def libm(): "ITKVideoCore": {"requires": ["ITKCommon"]}, } + def _create_cmake_module_variables(self): + content = 'set(ITK_CMAKE_DIR "${CMAKE_CURRENT_LIST_DIR}")' + save(self, os.path.join(self.package_folder, self._module_variables_file_rel_path), content) + + def _create_cmake_module_alias_targets(self): + targets = {target:f"ITK::{target}" for target in self._itk_components.keys()} + 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, os.path.join(self.package_folder, self._module_file_rel_path), content) + + @property + def _itk_modules_files(self): + cmake_files = [] + if Version(self.version) >= "5.3": + cmake_files.extend(["ITKFactoryRegistration.cmake", "ITKInitializeCXXStandard.cmake"]) + cmake_files.append("UseITK.cmake") + return cmake_files + + 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")) + rmdir(self, os.path.join(self.package_folder, self._cmake_module_dir, "Modules")) + + # Do not remove UseITK.cmake, ITKFactoryRegistration.cmake, ITKInitializeCXXStandard.cmake and *.h.in files + for cmake_file in glob.glob(os.path.join(self.package_folder, self._cmake_module_dir, "*.cmake")): + file_name = os.path.basename(cmake_file) + if file_name not in self._itk_modules_files: + os.remove(cmake_file) + + self._create_cmake_module_variables() + self._create_cmake_module_alias_targets() + def package_info(self): + itk_version = Version(self.version) + lib_suffix = f"-{itk_version.major}.{itk_version.minor}" + build_modules = [self._module_variables_file_rel_path] + build_modules.extend([os.path.join(self._cmake_module_dir, f) for f in self._itk_modules_files]) self.cpp_info.set_property("cmake_file_name", "ITK") - self.cpp_info.set_property("cmake_build_modules", [os.path.join(self._cmake_module_dir, "UseITK.cmake")]) - - itk_version = tools.Version(self.version) - lib_suffix = "-{}.{}".format(itk_version.major, itk_version.minor) + self.cpp_info.set_property("cmake_build_modules", build_modules) for name, values in self._itk_components.items(): is_header_only = values.get("header_only", False) system_libs = values.get("system_libs", []) requires = values.get("requires", []) self.cpp_info.components[name].set_property("cmake_target_name", name) + self.cpp_info.components[name].set_property("cmake_target_aliases", [f"ITK::{name}"]) self.cpp_info.components[name].builddirs.append(self._cmake_module_dir) self.cpp_info.components[name].includedirs.append(os.path.join("include", self._itk_subdir)) if not is_header_only: - self.cpp_info.components[name].libs = ["{}{}".format(name, lib_suffix)] + self.cpp_info.components[name].libs = [f"{name}{lib_suffix}"] self.cpp_info.components[name].system_libs = system_libs self.cpp_info.components[name].requires = requires # TODO: to remove in conan v2 once cmake_find_package* generators removed - self.cpp_info.components[name].names["cmake_find_package"] = name - self.cpp_info.components[name].names["cmake_find_package_multi"] = name - self.cpp_info.components[name].build_modules.append(os.path.join(self._cmake_module_dir, "UseITK.cmake")) - self.cpp_info.components[name].build_modules["cmake_find_package"].append(self._module_file_rel_path) - self.cpp_info.components[name].build_modules["cmake_find_package_multi"].append(self._module_file_rel_path) + for generator in ["cmake_find_package", "cmake_find_package_multi"]: + self.cpp_info.components[name].names[generator] = name + self.cpp_info.components[name].build_modules[generator].extend([self._module_file_rel_path, self._module_variables_file_rel_path]) + self.cpp_info.components[name].build_modules[generator].extend( + [os.path.join(self._cmake_module_dir, f) for f in self._itk_modules_files]) # TODO: to remove in conan v2 once cmake_find_package* generators removed - self.cpp_info.names["cmake_find_package"] = "ITK" - self.cpp_info.names["cmake_find_package_multi"] = "ITK" + for generator in ["cmake_find_package", "cmake_find_package_multi"]: + self.cpp_info.names[generator] = "ITK" diff --git a/recipes/itk/all/patches/0002-find-conan-packages.patch b/recipes/itk/all/patches/0002-find-conan-packages.patch new file mode 100644 index 0000000000000..34b81a5788250 --- /dev/null +++ b/recipes/itk/all/patches/0002-find-conan-packages.patch @@ -0,0 +1,189 @@ +--- Modules/ThirdParty/Eigen3/itk-module-init.cmake ++++ Modules/ThirdParty/Eigen3/itk-module-init.cmake +@@ -1,3 +1,3 @@ + if(ITK_USE_SYSTEM_EIGEN) +- find_package(Eigen3 REQUIRED CONFIG) ++ find_package(Eigen3 REQUIRED) + endif() +--- Modules/ThirdParty/DCMTK/itk-module-init.cmake ++++ Modules/ThirdParty/DCMTK/itk-module-init.cmake +@@ -24,7 +24,7 @@ + if(ITK_USE_SYSTEM_DCMTK) + # Use local FindDCMTK.cmake. + list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_LIST_DIR}/CMake") +- find_package(DCMTK REQUIRED NO_MODULE) ++ find_package(DCMTK REQUIRED) + else(ITK_USE_SYSTEM_DCMTK) + # Copied and mofified from DCMTK/CMake/3rdparty.cmake + if(NOT DEFINED DCMTK_USE_ICU) +--- Modules/ThirdParty/Eigen3/CMakeLists.txt ++++ Modules/ThirdParty/Eigen3/CMakeLists.txt +@@ -52,9 +52,9 @@ + + if(ITK_USE_SYSTEM_EIGEN) + set(_Eigen3_SYSTEM_OR_INTERNAL "Eigen3") +- find_package(${_Eigen3_SYSTEM_OR_INTERNAL} ${_Eigen3_min_version} REQUIRED CONFIG) +- set(Eigen3_DIR_INSTALL ${Eigen3_DIR}) +- set(Eigen3_DIR_BUILD ${Eigen3_DIR}) ++ find_package(${_Eigen3_SYSTEM_OR_INTERNAL} ${_Eigen3_min_version} REQUIRED) ++ set(Eigen3_DIR_INSTALL ${Eigen3_INCLUDE_DIR}) ++ set(Eigen3_DIR_BUILD ${Eigen3_INCLUDE_DIR}) + else() + set(_Eigen3_SYSTEM_OR_INTERNAL "ITKInternalEigen3") + find_package(${_Eigen3_SYSTEM_OR_INTERNAL} ${_Eigen3_min_version} REQUIRED CONFIG) +@@ -66,7 +66,7 @@ + # Eigen3 is header only, but there are compile definitions that we want to provide + # to enforce use of MPL only code, and to disable warnings. + # We only need to add the location of the header itk_eigen.h used internally. +-get_target_property(Eigen_INCLUDE_DIRS ${_eigen_itk_target} INTERFACE_INCLUDE_DIRECTORIES) ++set(Eigen_INCLUDE_DIRS ${Eigen3_INCLUDE_DIRS}) + set(ITKEigen3_INCLUDE_DIRS + ${Eigen_INCLUDE_DIRS} + ${ITKEigen3_BINARY_DIR}/src # For the generated itk_eigen.h +@@ -75,14 +75,10 @@ + # When this module is loaded by an app, load Eigen too. + # Load ITKInternalEigen3 or Eigen3 depending on ITK_USE_SYSTEM_EIGEN + set(ITKEigen3_EXPORT_CODE_INSTALL " +-set(ITK_USE_SYSTEM_EIGEN \"${ITK_USE_SYSTEM_EIGEN}\") +-set(${_Eigen3_SYSTEM_OR_INTERNAL}_DIR \"${Eigen3_DIR_INSTALL}\") +-find_package(${_Eigen3_SYSTEM_OR_INTERNAL} ${_Eigen3_min_version} REQUIRED CONFIG) ++find_package(${_Eigen3_SYSTEM_OR_INTERNAL} ${_Eigen3_min_version} REQUIRED) + ") + set(ITKEigen3_EXPORT_CODE_BUILD " +-set(ITK_USE_SYSTEM_EIGEN \"${ITK_USE_SYSTEM_EIGEN}\") +-set(${_Eigen3_SYSTEM_OR_INTERNAL}_DIR \"${Eigen3_DIR_BUILD}\") +-find_package(${_Eigen3_SYSTEM_OR_INTERNAL} ${_Eigen3_min_version} REQUIRED CONFIG) ++find_package(${_Eigen3_SYSTEM_OR_INTERNAL} ${_Eigen3_min_version} REQUIRED) + ") + + # Eigen3 targets are not installed if ITK_USE_SYSTEM_EIGEN==True +--- Modules/ThirdParty/Eigen3/src/itk_eigen.h.in ++++ Modules/ThirdParty/Eigen3/src/itk_eigen.h.in +@@ -43,10 +43,10 @@ + set(Eigen3_DIR ${ITKInternalEigen3_DIR}) + endif() + message(STATUS "From ITK: Eigen3_DIR: ${Eigen3_DIR}") +-find_package(Eigen3 REQUIRED CONFIG) ++find_package(Eigen3 REQUIRED) + add_executable(main main.cpp) + target_link_libraries(main PUBLIC ${ITK_LIBRARIES}) + target_link_libraries(main PUBLIC Eigen3::Eigen) + \endcode + * + * Then, the user can use Eigen3 as usual: +--- Modules/ThirdParty/JPEG/CMakeLists.txt ++++ Modules/ThirdParty/JPEG/CMakeLists.txt +@@ -6,13 +6,13 @@ + + if(ITK_USE_SYSTEM_JPEG) + find_package(JPEG REQUIRED) + set(ITKJPEG_INCLUDE_DIRS + ${ITKJPEG_BINARY_DIR}/src + ) + set(ITKJPEG_SYSTEM_INCLUDE_DIRS + ${JPEG_INCLUDE_DIR} + ) +- set(ITKJPEG_LIBRARIES "${JPEG_LIBRARIES}") ++ set(ITKJPEG_LIBRARIES JPEG::JPEG) + set(ITKJPEG_NO_SRC 1) + else() + set(ITKJPEG_INCLUDE_DIRS +--- Modules/ThirdParty/DoubleConversion/CMakeLists.txt ++++ Modules/ThirdParty/DoubleConversion/CMakeLists.txt +@@ -8,8 +8,8 @@ + + if(ITK_USE_SYSTEM_DOUBLECONVERSION) + find_package(double-conversion 3.1.6 REQUIRED) +- get_target_property(ITKDoubleConversion_INCLUDE_DIRS double-conversion::double-conversion INTERFACE_INCLUDE_DIRECTORIES) +- get_target_property(ITKDoubleConversion_LIBRARIES double-conversion::double-conversion LOCATION) ++ set(ITKDoubleConversion_INCLUDE_DIRS ${double-conversion_INCLUDE_DIRS}) ++ set(ITKDoubleConversion_LIBRARIES ${double-conversion_LIBRARIES}) + else() + set(ITKDoubleConversion_INCLUDE_DIRS + ${ITKDoubleConversion_SOURCE_DIR}/src +--- Modules/ThirdParty/Expat/CMakeLists.txt ++++ Modules/ThirdParty/Expat/CMakeLists.txt +@@ -6,9 +6,9 @@ + + if(ITK_USE_SYSTEM_EXPAT) + find_package(EXPAT REQUIRED) +- set(ITKExpat_INCLUDE_DIRS ${ITKExpat_BINARY_DIR}/src ) +- set(ITKExpat_SYSTEM_INCLUDE_DIRS "${EXPAT_INCLUDE_DIR}") +- set(ITKExpat_LIBRARIES "${EXPAT_LIBRARY}") ++ set(ITKExpat_INCLUDE_DIRS ${EXPAT_INCLUDE_DIRECTORIES}) ++ set(ITKExpat_SYSTEM_INCLUDE_DIRS ${EXPAT_INCLUDE_DIRECTORIES}) ++ set(ITKExpat_LIBRARIES EXPAT::EXPAT) + set(ITKExpat_NO_SRC 1) + else() + set(ITKExpat_INCLUDE_DIRS +--- Modules/ThirdParty/HDF5/CMakeLists.txt ++++ Modules/ThirdParty/HDF5/CMakeLists.txt +@@ -19,25 +19,9 @@ if(CMAKE_LINKER MATCHES "link.exe$") + endif() + + if(ITK_USE_SYSTEM_HDF5) +- +- if(HDF5_DIR) +- set(_HDF5_DIR_CODE "set(HDF5_DIR \"${HDF5_DIR}\")") +- endif() +- if(HDF5_NO_MODULE) +- set(_HDF5_NO_MODULE_ARG "NO_MODULE") +- endif() +- +- # When ITK's config is loaded, load HDF5 too. +- set(ITKHDF5_EXPORT_CODE_INSTALL " +-${_HDF5_DIR_CODE} +-find_package(HDF5 ${_HDF5_NO_MODULE_ARG} REQUIRED COMPONENTS CXX C HL) +-") +- set(ITKHDF5_EXPORT_CODE_BUILD " +-if(NOT ITK_BINARY_DIR) +- ${_HDF5_DIR_CODE} +- find_package(HDF5 ${_HDF5_NO_MODULE_ARG} REQUIRED COMPONENTS CXX C HL) +-endif() +-") ++ find_package(HDF5 REQUIRED) ++ set(HDF5_C_SHARED_LIBRARY HDF5::HDF5) ++ set(HDF5_C_STATIC_LIBRARY HDF5::HDF5) + + if(BUILD_SHARED_LIBS) + if (TARGET hdf5-shared) +--- Modules/ThirdParty/OpenJPEG/src/CMakeLists.txt ++++ Modules/ThirdParty/OpenJPEG/src/CMakeLists.txt +@@ -4,5 +4,8 @@ + set(ITK3P_INSTALL_RUNTIME_DIR "${ITKOpenJPEG_INSTALL_RUNTIME_DIR}") + set(ITK3P_INSTALL_LIBRARY_DIR "${ITKOpenJPEG_INSTALL_LIBRARY_DIR}") + set(ITK3P_INSTALL_ARCHIVE_DIR "${ITKOpenJPEG_INSTALL_ARCHIVE_DIR}") +-add_subdirectory(openjpeg) +-itk_module_target(itkopenjpeg NO_INSTALL) ++find_package(OpenJPEG REQUIRED) ++add_library(itkopenjpeg INTERFACE) ++set_property(TARGET itkopenjpeg PROPERTY INTERFACE_LINK_LIBRARIES openjp2) ++#target_compile_definitions(itkopenjpeg INTERFACE) ++install(TARGETS itkopenjpeg EXPORT ${ITK3P_INSTALL_EXPORT_NAME}) +--- Modules/ThirdParty/TBB/CMakeLists.txt ++++ Modules/ThirdParty/TBB/CMakeLists.txt +@@ -8,14 +8,14 @@ set(ITKTBB_NO_SRC 1) + # When this module is loaded by an app, load TBB too. + set(ITKTBB_EXPORT_CODE_INSTALL " + set(TBB_DIR \"${TBB_DIR}\") +-find_package(TBB REQUIRED CONFIG) ++find_package(TBB REQUIRED) + ") + + # When this module is configured by an app, configure TBB too. + set(ITKTBB_EXPORT_CODE_BUILD " + if(NOT ITK_BINARY_DIR) + set(TBB_DIR \"${TBB_DIR}\") +- find_package(TBB REQUIRED CONFIG) ++ find_package(TBB REQUIRED) + endif() + ") + +diff --git a/Modules/ThirdParty/TBB/itk-module-init.cmake b/Modules/ThirdParty/TBB/itk-module-init.cmake +index 1b7ee20a..0859ef33 100644 +--- a/Modules/ThirdParty/TBB/itk-module-init.cmake ++++ b/Modules/ThirdParty/TBB/itk-module-init.cmake +@@ -1,2 +1,2 @@ +-find_package(TBB REQUIRED CONFIG) # must have TBBConfig.cmake, provided since version tbb2017_20170604oss ++find_package(TBB REQUIRED) + get_target_property(TBB_INCLUDE_DIRS TBB::tbb INTERFACE_INCLUDE_DIRECTORIES) diff --git a/recipes/itk/all/test_package/CMakeLists.txt b/recipes/itk/all/test_package/CMakeLists.txt index f9c2acebbb0bb..ad9e58069124d 100644 --- a/recipes/itk/all/test_package/CMakeLists.txt +++ b/recipes/itk/all/test_package/CMakeLists.txt @@ -1,12 +1,11 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.15) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package CXX) find_package(ITK REQUIRED CONFIG) -find_package(HDF5 COMPONENTS CXX) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ITKCommon hdf5::hdf5_cpp) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE ITKCommon) +#itksys is already linked through dependencies of ITKCommon but we also want to check name alias +target_link_libraries(${PROJECT_NAME} PRIVATE ITK::itksys) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/itk/all/test_package/conanfile.py b/recipes/itk/all/test_package/conanfile.py index 38f4483872d47..ef5d7042163ec 100644 --- a/recipes/itk/all/test_package/conanfile.py +++ b/recipes/itk/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/itk/all/test_package/test_package.cpp b/recipes/itk/all/test_package/test_package.cpp index ef775457ccc9c..56077cb584102 100644 --- a/recipes/itk/all/test_package/test_package.cpp +++ b/recipes/itk/all/test_package/test_package.cpp @@ -1,8 +1,5 @@ #include "itkLightObject.h" -#include -#include - #include class Test : public itk::LightObject { @@ -12,12 +9,9 @@ class Test : public itk::LightObject { const char *GetNameOfClass() { return "Test"; } }; -int main(int, char **) try { - //Test::Pointer test = Test::New(); - //std::cout << test->GetNameOfClass() << std::endl; - return 0; -} catch(const H5::DataSpaceIException &e) { - std::cerr << "CAUGHT\n"; - e.printErrorStack(); +int main(int, char **) +{ + Test::Pointer test = Test::New(); + std::cout << test->GetNameOfClass() << std::endl; return 0; } diff --git a/recipes/itk/all/test_v1_package/CMakeLists.txt b/recipes/itk/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/itk/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/itk/all/test_v1_package/conanfile.py b/recipes/itk/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/itk/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/itk/config.yml b/recipes/itk/config.yml index 989b5ee90fe13..f362c6f4b0b84 100644 --- a/recipes/itk/config.yml +++ b/recipes/itk/config.yml @@ -1,4 +1,6 @@ versions: + "5.3.0": + folder: "all" "5.1.2": folder: "all" "5.1.0": diff --git a/recipes/itlib/all/conandata.yml b/recipes/itlib/all/conandata.yml index a892e231322bb..19923cd832b58 100644 --- a/recipes/itlib/all/conandata.yml +++ b/recipes/itlib/all/conandata.yml @@ -1,25 +1,22 @@ sources: - "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.6.1": - url: "https://github.com/iboB/itlib/archive/v1.6.1.tar.gz" - sha256: "bff70b95ca223b4fbca206d8e1c5f6c75fd5ac86d76c8f8f14f45c748d25866a" - "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" - sha256: "f1d3533014433316475b6196cd2b1890bb42db1ae3059616538788712e1a33aa" - "1.3.0": - url: "https://github.com/iboB/itlib/archive/refs/tags/v1.3.0.tar.gz" - sha256: "d3af2ea3cf0dae63fe1e186af79562e584bfb86bf02f358cab9675662fb9b5ef" + "1.11.4": + url: "https://github.com/iboB/itlib/archive/v1.11.4.tar.gz" + sha256: "09b155afcb9766fe36d0156294f6656956189235612eb7711903ebc22079c37e" + "1.11.3": + url: "https://github.com/iboB/itlib/archive/v1.11.3.tar.gz" + sha256: "38999b3c4c2425ac3700529457fb2683d6fa5853752747c3afb97b2e688255b8" + "1.11.2": + url: "https://github.com/iboB/itlib/archive/v1.11.2.tar.gz" + sha256: "bbf734f6084af77a1e886e54e4efadab491ada242f5858afa561353db6a0a03f" + "1.11.1": + url: "https://github.com/iboB/itlib/archive/v1.11.1.tar.gz" + sha256: "2c60e02660ea63dfb7a39237e29b30a066670cef228d22e8d0908e1fff2fa7f1" + "1.10.3": + url: "https://github.com/iboB/itlib/archive/v1.10.3.tar.gz" + sha256: "e533c44354d48b2251ca57f1502778033b38170d9d6aba6bb2bbad90f2bf9d27" + "1.10.0": + url: "https://github.com/iboB/itlib/archive/v1.10.0.tar.gz" + sha256: "a97b98514aa7194241383b537c368a01d4a56e05316a94551cd183a986caa9c7" + "1.9.2": + url: "https://github.com/iboB/itlib/archive/v1.9.2.tar.gz" + sha256: "70627c57edff91dfae219e101c0672560f65567272e889f461069c8ea506bef1" diff --git a/recipes/itlib/all/conanfile.py b/recipes/itlib/all/conanfile.py index bb31e9b71bfa0..b96a180998454 100644 --- a/recipes/itlib/all/conanfile.py +++ b/recipes/itlib/all/conanfile.py @@ -13,7 +13,8 @@ class ItlibConan(ConanFile): license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/iboB/itlib" - topics = ("template", "flatmatp", "static-vector") + topics = ("template", "flatmatp", "static-vector", "header-only") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -32,8 +33,7 @@ def validate(self): 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): copy(self, pattern="*.hpp", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self.source_folder, "include")) diff --git a/recipes/itlib/config.yml b/recipes/itlib/config.yml index 5f100c0f23fd3..5e6bf450f30f7 100644 --- a/recipes/itlib/config.yml +++ b/recipes/itlib/config.yml @@ -1,17 +1,15 @@ versions: - "1.7.0": + "1.11.4": folder: all - "1.6.3": + "1.11.3": folder: all - "1.6.1": + "1.11.2": folder: all - "1.5.2": + "1.11.1": folder: all - "1.5.1": + "1.10.3": folder: all - "1.5.0": + "1.10.0": folder: all - "1.4.5": - folder: all - "1.3.0": + "1.9.2": folder: all diff --git a/recipes/ittapi/all/conandata.yml b/recipes/ittapi/all/conandata.yml index fe25f2187adf4..a637e62d86570 100644 --- a/recipes/ittapi/all/conandata.yml +++ b/recipes/ittapi/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "3.24.4": + url: "https://github.com/intel/ittapi/archive/v3.24.4.tar.gz" + sha256: "f7341c563f228f4358b645fce526208c742fe13e61fc3ba2c777ba94d36e98f5" + "3.24.0": + url: "https://github.com/intel/ittapi/archive/v3.24.0.tar.gz" + sha256: "36c42d3f2446ddfaa2d7dfa02dfaa79615933f1a68a72d7e4f1d70de7b56e2c9" "3.23.0": url: "https://github.com/intel/ittapi/archive/v3.23.0.tar.gz" sha256: "9af1231808c602c2f7a66924c8798b1741d3aa4b15f3874d82ca7a89b5dbb1b1" diff --git a/recipes/ittapi/all/conanfile.py b/recipes/ittapi/all/conanfile.py index dc49d467bcae0..0e0597fe61fbb 100644 --- a/recipes/ittapi/all/conanfile.py +++ b/recipes/ittapi/all/conanfile.py @@ -1,6 +1,7 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout from conan.tools.files import copy, get, replace_in_file +from conan.tools.scm import Version import os required_conan_version = ">=1.47.0" @@ -52,10 +53,9 @@ def source(self): def _patch_sources(self): # Don't force PIC - replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), - "set(CMAKE_C_FLAGS \"${CMAKE_C_FLAGS} -fPIC\")", - "" - ) + if Version(self.version) < "3.24.1": + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + 'set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")', "") def generate(self): self._patch_sources() diff --git a/recipes/ittapi/config.yml b/recipes/ittapi/config.yml index c34864bd34f7f..68b246e705157 100644 --- a/recipes/ittapi/config.yml +++ b/recipes/ittapi/config.yml @@ -1,3 +1,7 @@ versions: + "3.24.4": + folder: all + "3.24.0": + folder: all "3.23.0": 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..7ab18405e8412 100644 --- a/recipes/ixwebsocket/all/conandata.yml +++ b/recipes/ixwebsocket/all/conandata.yml @@ -1,28 +1,31 @@ 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.5": + url: "https://github.com/machinezone/IXWebSocket/archive/refs/tags/v11.4.5.tar.gz" + sha256: "c5fc225edec32bf7d583e55347ef2c9c4940d005c13ef5e848354a85602f5fd6" "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..1c2ba7acf0e06 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.11 <2]") if self.options.tls == "openssl": - self.requires("openssl/1.1.1q") + self.requires("openssl/1.1.1w") 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,79 @@ 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 + # INFO: IXWebSocketHttpHeaders.cpp consumes WSAEINVAL but there is no winsock2.h included + replace_in_file(self, os.path.join(self.source_folder, "ixwebsocket", "IXWebSocketHttpHeaders.cpp"), '#include "IXSocket.h"', '#include "IXNetSystem.h"\n#include "IXSocket.h"') + # INFO: IXHttpClient.cpp consumes WSAEINVAL but there is no winsock2.h included + replace_in_file(self, os.path.join(self.source_folder, "ixwebsocket", "IXHttpClient.h"), '#include "IXSocket.h"', '#include "IXNetSystem.h"\n#include "IXSocket.h"') 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")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) 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..876784ab3f633 100644 --- a/recipes/ixwebsocket/config.yml +++ b/recipes/ixwebsocket/config.yml @@ -1,19 +1,21 @@ versions: - "7.9.2": + "11.4.5": folder: all - "9.1.9": + "11.4.3": folder: all - "9.6.4": + "11.2.4": folder: all - "10.2.5": + "11.0.9": + folder: all + "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/conandata.yml b/recipes/jasper/all/conandata.yml index e929114808462..a0a3b5ff5c970 100644 --- a/recipes/jasper/all/conandata.yml +++ b/recipes/jasper/all/conandata.yml @@ -1,27 +1,38 @@ sources: - "3.0.6": - url: "https://github.com/jasper-software/jasper/archive/refs/tags/version-3.0.6.tar.gz" - sha256: "c79961bc00158f5b5dc5f5fcfa792fde9bebb024432689d0f9e3f95a097d0ec3" - "2.0.33": - url: "https://github.com/jasper-software/jasper/archive/refs/tags/version-2.0.33.tar.gz" - sha256: "38b8f74565ee9e7fec44657e69adb5c9b2a966ca5947ced5717cde18a7d2eca6" + "4.2.4": + url: "https://github.com/jasper-software/jasper/releases/download/version-4.2.4/jasper-4.2.4.tar.gz" + sha256: "6a597613d8d84c500b5b83bf0eec06cd3707c23d19957f70354ac2394c9914e7" + "4.2.0": + url: "https://github.com/jasper-software/jasper/releases/download/version-4.2.0/jasper-4.2.0.tar.gz" + sha256: "69f0b08a0cc281a06eaf7feed510736854bbff9af89ab1d01b77382ad57ec957" + "4.1.2": + url: "https://github.com/jasper-software/jasper/releases/download/version-4.1.2/jasper-4.1.2.tar.gz" + sha256: "22392e439b87c79aaf8689ec79a286a7147e811c4bee34edf3d0b239798d672b" + "4.0.0": + url: "https://github.com/jasper-software/jasper/releases/download/version-4.0.0/jasper-4.0.0.tar.gz" + sha256: "39514e1b53a5333fcff817e19565371f016ea536c36fd2d13a9c4d8da8f0be0c" patches: - "3.0.6": - - patch_file: "patches/3.0.6-0001-skip-rpath.patch" + "4.2.4": + - patch_file: "patches/4.2.0-0003-deterministic-libname.patch" + patch_description: "No generator dependent libname" + patch_type: "conan" + "4.2.0": + - patch_file: "patches/4.2.0-0003-deterministic-libname.patch" + patch_description: "No generator dependent libname" + patch_type: "conan" + "4.1.2": + - patch_file: "patches/4.1.1-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_file: "patches/4.1.1-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" + "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/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_file: "patches/4.0.0-0003-deterministic-libname.patch" + patch_description: "No generator dependent libname" patch_type: "conan" diff --git a/recipes/jasper/all/conanfile.py b/recipes/jasper/all/conanfile.py index d677d22f394d5..25cff6caab8e5 100644 --- a/recipes/jasper/all/conanfile.py +++ b/recipes/jasper/all/conanfile.py @@ -1,8 +1,9 @@ from conan import ConanFile from conan.tools.build import 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, export_conandata_patches, get, rm, rmdir, save -from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version import os import textwrap @@ -11,16 +12,17 @@ class JasperConan(ConanFile): name = "jasper" + description = "JasPer Image Processing/Coding Tool Kit" license = "JasPer-2.0" - homepage = "https://jasper-software.github.io/jasper" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://jasper-software.github.io/jasper" topics = ("toolkit", "coding", "jpeg", "images") - description = "JasPer Image Processing/Coding Tool Kit" + package_type = "library" 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, @@ -45,35 +47,39 @@ 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.4") - elif self.options.with_libjpeg == "libjpeg": + if self.options.with_libjpeg == "libjpeg": self.requires("libjpeg/9e") + elif self.options.with_libjpeg == "libjpeg-turbo": + self.requires("libjpeg-turbo/3.0.2") + elif self.options.with_libjpeg == "mozjpeg": + self.requires("mozjpeg/4.1.5") + + def build_requirements(self): + if Version(self.version) >= "4.1.1": + self.tool_requires("cmake/[>=3.20 <4]") 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): + VirtualBuildEnv(self).generate() + tc = CMakeToolchain(self) + 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) + tc.variables["JAS_HAVE_JPEGLIB_H"] = True + tc.variables["JAS_ENABLE_LIBHEIF"] = False tc.variables["JAS_ENABLE_OPENGL"] = False - tc.variables["JAS_ENABLE_LIBJPEG"] = True - 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" - + if Version(self.version) >= "4.2.0": + tc.variables["JAS_PACKAGING"] = True tc.generate() cmakedeps = CMakeDeps(self) @@ -99,17 +105,15 @@ def package(self): # 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("""\ + content = textwrap.dedent(f"""\ set(JASPER_FOUND TRUE) if(DEFINED Jasper_INCLUDE_DIR) - set(JASPER_INCLUDE_DIR ${Jasper_INCLUDE_DIR}) + set(JASPER_INCLUDE_DIR ${{Jasper_INCLUDE_DIR}}) endif() if(DEFINED Jasper_LIBRARIES) - set(JASPER_LIBRARIES ${Jasper_LIBRARIES}) - endif() - if(DEFINED Jasper_VERSION) - set(JASPER_VERSION_STRING ${Jasper_VERSION}) + set(JASPER_LIBRARIES ${{Jasper_LIBRARIES}}) endif() + set(JASPER_VERSION_STRING "{self.version}") """) save(self, module_file, content) @@ -126,6 +130,13 @@ def package_info(self): 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" 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 deleted file mode 100644 index eb9d47cbbb014..0000000000000 --- a/recipes/jasper/all/patches/2.0.33-0001-skip-rpath.patch +++ /dev/null @@ -1,24 +0,0 @@ -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 deleted file mode 100644 index e95e029549359..0000000000000 --- a/recipes/jasper/all/patches/2.0.33-0002-find-libjpeg.patch +++ /dev/null @@ -1,18 +0,0 @@ -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 deleted file mode 100644 index 959d169bd49ad..0000000000000 --- a/recipes/jasper/all/patches/3.0.6-0001-skip-rpath.patch +++ /dev/null @@ -1,24 +0,0 @@ -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 deleted file mode 100644 index 47a8350d738d4..0000000000000 --- a/recipes/jasper/all/patches/3.0.6-0002-find-libjpeg.patch +++ /dev/null @@ -1,18 +0,0 @@ -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 deleted file mode 100644 index 567ff16e021a4..0000000000000 --- a/recipes/jasper/all/patches/3.0.6-0003-deterministic-libname.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- 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-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/4.1.1-0001-skip-rpath.patch b/recipes/jasper/all/patches/4.1.1-0001-skip-rpath.patch new file mode 100644 index 0000000000000..69c4f82817230 --- /dev/null +++ b/recipes/jasper/all/patches/4.1.1-0001-skip-rpath.patch @@ -0,0 +1,31 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index ba6f117..6b79a94 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -800,13 +800,13 @@ + + if(JAS_ENABLE_SHARED) + # use, i.e. don't skip the full RPATH for the build tree +- set(CMAKE_SKIP_BUILD_RPATH FALSE) ++# set(CMAKE_SKIP_BUILD_RPATH FALSE) + + # when building, don't use the install RPATH already + # (but later on when installing) + set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) + +- set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") ++# 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 +@@ -817,8 +817,8 @@ + 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}") ++# set(CMAKE_INSTALL_RPATH ++# "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") + endif() + endif() + diff --git a/recipes/jasper/all/patches/4.1.1-0003-deterministic-libname.patch b/recipes/jasper/all/patches/4.1.1-0003-deterministic-libname.patch new file mode 100644 index 0000000000000..88f2faa6388a7 --- /dev/null +++ b/recipes/jasper/all/patches/4.1.1-0003-deterministic-libname.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 86eb065..9c2da51 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -276,7 +276,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) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY .) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY .) + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY .) diff --git a/recipes/jasper/all/patches/4.2.0-0003-deterministic-libname.patch b/recipes/jasper/all/patches/4.2.0-0003-deterministic-libname.patch new file mode 100644 index 0000000000000..ed1edf420e3b3 --- /dev/null +++ b/recipes/jasper/all/patches/4.2.0-0003-deterministic-libname.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index c6925e4..8392edf 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -274,7 +274,7 @@ message("JAS_MULTICONFIGURATION_GENERATOR ${JAS_MULTICONFIGURATION_GENERATOR}") + # 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) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY .) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY .) + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY .) diff --git a/recipes/jasper/all/test_package/CMakeLists.txt b/recipes/jasper/all/test_package/CMakeLists.txt index 54cd6e29fc23c..7722c78a71d35 100644 --- a/recipes/jasper/all/test_package/CMakeLists.txt +++ b/recipes/jasper/all/test_package/CMakeLists.txt @@ -10,7 +10,7 @@ set(_custom_vars JASPER_VERSION_STRING ) foreach(_custom_var ${_custom_vars}) -if(DEFINED _custom_var) +if(DEFINED ${_custom_var}) message(STATUS "${_custom_var}: ${${_custom_var}}") else() message(FATAL_ERROR "${_custom_var} not defined") diff --git a/recipes/jasper/config.yml b/recipes/jasper/config.yml index 8b1f048c0d0c7..7d70ab2a393a0 100644 --- a/recipes/jasper/config.yml +++ b/recipes/jasper/config.yml @@ -1,5 +1,9 @@ versions: - "3.0.6": + "4.2.4": folder: all - "2.0.33": + "4.2.0": + folder: all + "4.1.2": + folder: all + "4.0.0": 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/conanfile.py b/recipes/jeaiii-itoa/all/conanfile.py index e7cabf3b1a327..43dfc55725a27 100644 --- a/recipes/jeaiii-itoa/all/conanfile.py +++ b/recipes/jeaiii-itoa/all/conanfile.py @@ -15,30 +15,26 @@ class ItoaConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/jeaiii/itoa/" topics = ("string-conversion", "itona", "integer-conversion",) + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @property - def _minimum_cpp_standard(self): + def _min_cppstd(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) + check_min_cppstd(self, self._min_cppstd) 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 @@ -49,6 +45,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/jeaiii-itoa/all/test_package/CMakeLists.txt b/recipes/jeaiii-itoa/all/test_package/CMakeLists.txt index d27bc00b65615..09813e133a472 100644 --- a/recipes/jeaiii-itoa/all/test_package/CMakeLists.txt +++ b/recipes/jeaiii-itoa/all/test_package/CMakeLists.txt @@ -1,6 +1,5 @@ cmake_minimum_required(VERSION 3.8) - -project(test_package CXX) +project(test_package LANGUAGES CXX) find_package(jeaiii-itoa REQUIRED CONFIG) diff --git a/recipes/jeaiii-itoa/all/test_v1_package/CMakeLists.txt b/recipes/jeaiii-itoa/all/test_v1_package/CMakeLists.txt index f35b931b51133..b21cc49efde95 100644 --- a/recipes/jeaiii-itoa/all/test_v1_package/CMakeLists.txt +++ b/recipes/jeaiii-itoa/all/test_v1_package/CMakeLists.txt @@ -1,12 +1,8 @@ -cmake_minimum_required(VERSION 3.8) - -project(test_package CXX) +cmake_minimum_required(VERSION 3.15) +project(test_package) 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) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/jemalloc/all/conandata.yml b/recipes/jemalloc/all/conandata.yml index 01ec764057557..d4bd61a7e3212 100644 --- a/recipes/jemalloc/all/conandata.yml +++ b/recipes/jemalloc/all/conandata.yml @@ -9,3 +9,14 @@ sources: patches: "5.2.1": - patch_file: "patches/0001-clang12-dont-declare-system-functions-as-nothrow.patch" + patch_description: "Remove nothrow from system function declarations on macOS and FreeBSD." + patch_type: "backport" + "5.3.0": + - patch_file: "patches/0002-add-missing-ac-define-description.patch" + patch_description: "Patch configure.ac to add the missing description in AC_DEFINE." + patch_type: "backport" + patch_source: "https://github.com/jemalloc/jemalloc/pull/2396" + - patch_file: "patches/0003-add-missing-cpp-flags-for-windows.patch" + patch_description: "Add the missing compiler flags for MSVC on Windows." + patch_type: "backport" + patch_source: "https://github.com/jemalloc/jemalloc/issues/2283" diff --git a/recipes/jemalloc/all/conanfile.py b/recipes/jemalloc/all/conanfile.py index 03cf37de219b0..6c77bdecc8679 100644 --- a/recipes/jemalloc/all/conanfile.py +++ b/recipes/jemalloc/all/conanfile.py @@ -1,28 +1,30 @@ 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.env import VirtualBuildEnv +from conan.tools.gnu import Autotools, AutotoolsToolchain from conan.tools.layout import basic_layout +from conan.tools.files import export_conandata_patches, apply_conandata_patches, get, copy, rename, rmdir +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +from conan.tools.scm import Version import os import shutil -import string -required_conan_version = ">=1.51.3" +required_conan_version = ">=1.54.0" + class JemallocConan(ConanFile): name = "jemalloc" description = "jemalloc is a general purpose malloc(3) implementation that emphasizes fragmentation avoidance and scalable concurrency support." url = "https://github.com/conan-io/conan-center-index" license = "BSD-2-Clause" - homepage = "http://jemalloc.net/" - topics = ("conan", "jemalloc", "malloc", "free") + homepage = "https://jemalloc.net/" + topics = ("jemalloc", "malloc", "free") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], - "prefix": "ANY", + "prefix": ["ANY"], "enable_cxx": [True, False], "enable_fill": [True, False], "enable_xmalloc": [True, False], @@ -49,9 +51,36 @@ class JemallocConan(ConanFile): "enable_libdl": True, "enable_prof": False, } - exports_sources = ["patches/**"] - _autotools = None + @property + def _minimum_compilers_version(self): + return { + "clang": "3.9", + "apple-clang": "8", + # The upstream repository provides solution files for Visual Studio 2015, 2017, 2019 and 2022, + # but the 2015 solution does not work properly due to unresolved external symbols: + # `test_hooks_libc_hook` and `test_hooks_arena_new_hook` + "Visual Studio": "15", + "msvc": "191", + } + + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) + + @property + def _library_name(self): + libname = "jemalloc" + if self.settings.os == "Windows": + if not self.options.shared: + libname += "_s" + else: + if not self.options.shared and self.options.fPIC: + libname += "_pic" + return libname + + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -59,166 +88,105 @@ 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: - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd - - def validate(self): - if self.options.enable_cxx and \ - self.settings.compiler.get_safe("libcxx") == "libc++" and \ - self.settings.compiler == "clang" and \ - 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 \ - "MT" in self.settings.compiler.runtime: - raise ConanInvalidConfiguration("Visual Studio build for shared library with MT runtime is not supported") - if self.settings.compiler == "Visual Studio" and self.settings.compiler.version != "15": - # https://github.com/jemalloc/jemalloc/issues/1703 - raise ConanInvalidConfiguration("Only Visual Studio 15 2017 is supported. Please fix this if other versions are supported") - if self.settings.build_type not in ("Release", "Debug", None): - 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 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") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") 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 self.conf.get("tools.microsoft.bash:path", default=False, check_type=bool): - self.build_requires("msys2/cci.latest") - - def source(self): - get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + 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 _autotools_args(self): - conf_args = [ - "--with-jemalloc-prefix={}".format(self.options.prefix), - "--enable-debug" if self.settings.build_type == "Debug" else "--disable-debug", - "--enable-cxx" if self.options.enable_cxx else "--disable-cxx", - "--enable-fill" if self.options.enable_fill else "--disable-fill", - "--enable-xmalloc" if self.options.enable_cxx else "--disable-xmalloc", - "--enable-readlinkat" if self.options.enable_readlinkat else "--disable-readlinkat", - "--enable-syscall" if self.options.enable_syscall else "--disable-syscall", - "--enable-lazy-lock" if self.options.enable_lazy_lock else "--disable-lazy-lock", - "--enable-log" if self.options.enable_debug_logging else "--disable-log", - "--enable-initial-exec-tls" if self.options.enable_initial_exec_tls else "--disable-initial-exec-tls", - "--enable-libdl" if self.options.enable_libdl else "--disable-libdl", - ] - if self.options.enable_prof: - conf_args.append("--enable-prof") - if self.options.shared: - conf_args.extend(["--enable-shared", "--disable-static"]) - else: - conf_args.extend(["--disable-shared", "--enable-static"]) - return conf_args - - def _configure_autotools(self): - if self._autotools: - return self._autotools - 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 - def _msvc_build_type(self): - build_type = str(self.settings.build_type) or "Release" - if not self.options.shared: - build_type += "-static" - return build_type - - def _patch_sources(self): - if self.settings.os == "Windows": - 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", 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)", strict=False) - - apply_conandata_patches(self) + def validate(self): + 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 {self.settings.compiler} >= {minimum_version}") + # 1. MSVC specific checks + if is_msvc(self): + # Building the shared library with a static MSVC runtime is not supported + if self.options.shared and is_msvc_static_runtime(self): + raise ConanInvalidConfiguration("Building the shared library with MT runtime is not supported.") + # Only x86-64 and x86 are supported + if self.settings.arch not in ["x86_64", "x86"]: + raise ConanInvalidConfiguration(f"{self.settings.arch} is not supported.") + # 2. Clang specific checks + if self.settings.compiler == "clang": + if self.options.enable_cxx and self.settings.compiler.get_safe("libcxx") == "libc++" and \ + Version(self.settings.compiler.version) < "10": + raise ConanInvalidConfiguration("Clang 9 or earlier with libc++ is not supported due to the missing mutex implementation.") + # 3: Apple Silicon specific checks + if self.settings.os == "Macos" and self.settings.arch == "armv8": + if Version(self.version) < "5.3.0": + raise ConanInvalidConfiguration("Support for Apple Silicon is only available as of 5.3.0.") + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + tc = AutotoolsToolchain(self) + enable_disable = lambda opt, val: f"--enable-{opt}" if val else f"--disable-{opt}" + tc.configure_args.extend([ + f"--with-jemalloc-prefix={self.options.prefix}", + enable_disable("debug", self.settings.build_type == "Debug"), + enable_disable("cxx", self.options.enable_cxx), + enable_disable("fill", self.options.enable_fill), + enable_disable("xmalloc", self.options.enable_cxx), + enable_disable("readlinkat", self.options.enable_readlinkat), + enable_disable("syscall", self.options.enable_syscall), + enable_disable("lazy-lock", self.options.enable_lazy_lock), + enable_disable("log", self.options.enable_debug_logging), + enable_disable("initial-exec-tls", self.options.enable_initial_exec_tls), + enable_disable("libdl", self.options.enable_libdl), + enable_disable("prof", self.options.enable_prof), + ]) + env = tc.environment() + if is_msvc(self): + # Do not check whether the math library exists when compiled by MSVC + # because MSVC treats the function `char log()` as a intrinsic function + # and therefore complains about insufficient arguments passed to the function + tc.configure_args.append("ac_cv_search_log=none required") + env.define("CC", "cl") + env.define("CXX", "cl") + tc.generate(env) def build(self): - self._patch_sources() - if self.settings.compiler == "Visual Studio": - 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_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_folder, "msvc", "jemalloc_vc2017.sln") - msbuild.build(sln_file, targets=["jemalloc"], build_type=self._msvc_build_type) - else: - autotools = self._configure_autotools() - autotools.make() - - @property - def _library_name(self): - libname = "jemalloc" - if self.settings.compiler == "Visual Studio": - if self.options.shared: - if self.settings.build_type == "Debug": - libname += "d" - else: - 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: - if self.settings.os == "Windows": - if not self.options.shared: - libname += "_s" - else: - if not self.options.shared and self.options.fPIC: - libname += "_pic" - return libname + apply_conandata_patches(self) + autotools = Autotools(self) + autotools.configure() + autotools.make() def package(self): - 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_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) + copy(self, pattern="COPYING*", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + autotools.install(target="install_lib_shared" if self.options.shared else "install_lib_static") + autotools.install(target="install_include") + if self.settings.os == "Windows" and self.settings.compiler == "gcc": + rename(self, os.path.join(self.package_folder, "lib", f"{self._library_name}.lib"), + os.path.join(self.package_folder, "lib", f"lib{self._library_name}.a")) + if not self.options.shared: + os.unlink(os.path.join(self.package_folder, "lib", "jemalloc.lib")) + if is_msvc(self): 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() - # Use install_lib_XXX and install_include to avoid mixing binaries and dll's - 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": - 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")) + if self.options.shared: + rmdir(self, os.path.join(self.package_folder, "lib")) + copy(self, "*.lib", os.path.join(self.build_folder, "lib"), os.path.join(self.package_folder, "lib")) + copy(self, "*.dll", os.path.join(self.build_folder, "lib"), os.path.join(self.package_folder, "bin")) def package_info(self): - self.cpp_info.names["pkg_config"] = "jemalloc" + self.cpp_info.set_property("pkg_config_name", "jemalloc") self.cpp_info.libs = [self._library_name] self.cpp_info.includedirs = [os.path.join(self.package_folder, "include"), os.path.join(self.package_folder, "include", "jemalloc")] - if self.settings.compiler == "Visual Studio": + if is_msvc(self): self.cpp_info.includedirs.append(os.path.join(self.package_folder, "include", "msvc_compat")) if not self.options.shared: self.cpp_info.defines = ["JEMALLOC_EXPORT="] diff --git a/recipes/jemalloc/all/patches/0002-add-missing-ac-define-description.patch b/recipes/jemalloc/all/patches/0002-add-missing-ac-define-description.patch new file mode 100644 index 0000000000000..7799dfb9e80e3 --- /dev/null +++ b/recipes/jemalloc/all/patches/0002-add-missing-ac-define-description.patch @@ -0,0 +1,13 @@ +diff --git a/configure.ac b/configure.ac +index f6d25f334..3115504e2 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1592,7 +1592,7 @@ fi + [enable_uaf_detection="0"] + ) + if test "x$enable_uaf_detection" = "x1" ; then +- AC_DEFINE([JEMALLOC_UAF_DETECTION], [ ]) ++ AC_DEFINE([JEMALLOC_UAF_DETECTION], [ ], ["enable UAF"]) + fi + AC_SUBST([enable_uaf_detection]) + diff --git a/recipes/jemalloc/all/patches/0003-add-missing-cpp-flags-for-windows.patch b/recipes/jemalloc/all/patches/0003-add-missing-cpp-flags-for-windows.patch new file mode 100644 index 0000000000000..6e6e2d1403fb2 --- /dev/null +++ b/recipes/jemalloc/all/patches/0003-add-missing-cpp-flags-for-windows.patch @@ -0,0 +1,12 @@ +diff --git a/configure.ac b/configure.ac +index 3115504e2..ffb504b08 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -749,6 +749,7 @@ case "${host}" in + so="dll" + if test "x$je_cv_msvc" = "xyes" ; then + importlib="lib" ++ JE_APPEND_VS(CPPFLAGS, -DJEMALLOC_NO_PRIVATE_NAMESPACE) + DSO_LDFLAGS="-LD" + EXTRA_LDFLAGS="-link -DEBUG" + CTARGET='-Fo$@' diff --git a/recipes/jemalloc/all/test_package/CMakeLists.txt b/recipes/jemalloc/all/test_package/CMakeLists.txt index 0cc486467b601..718824817866d 100644 --- a/recipes/jemalloc/all/test_package/CMakeLists.txt +++ b/recipes/jemalloc/all/test_package/CMakeLists.txt @@ -1,9 +1,7 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(jemalloc REQUIRED CONFIG) -add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) -set_property(TARGET ${CMAKE_PROJECT_NAME} PROPERTY CXX_STANDARD 11) +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE jemalloc::jemalloc) diff --git a/recipes/jemalloc/all/test_package/conanfile.py b/recipes/jemalloc/all/test_package/conanfile.py index d4128b0450777..d60b533632ddd 100644 --- a/recipes/jemalloc/all/test_package/conanfile.py +++ b/recipes/jemalloc/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 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/jemalloc/all/test_package/test_package.c b/recipes/jemalloc/all/test_package/test_package.c new file mode 100644 index 0000000000000..cf16dc2c9e11e --- /dev/null +++ b/recipes/jemalloc/all/test_package/test_package.c @@ -0,0 +1,19 @@ +#include + +#include + +void do_something(size_t i) { + // Leak some memory. + malloc(i * 100); +} + +int main() { + for (size_t i = 0; i < 1000; i++) { + do_something(i); + } + + // Dump allocator statistics to stderr. + malloc_stats_print(NULL, NULL, NULL); + + return 0; +} diff --git a/recipes/jemalloc/all/test_package/test_package.cpp b/recipes/jemalloc/all/test_package/test_package.cpp deleted file mode 100644 index 5d19fec4f824a..0000000000000 --- a/recipes/jemalloc/all/test_package/test_package.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include - -#include - -void -do_something(size_t i) { - // Leak some memory. - malloc(i * 100); -} - -int -main(int argc, char **argv) { - for (size_t i = 0; i < 1000; i++) { - do_something(i); - } - - // Dump allocator statistics to stderr. - malloc_stats_print(NULL, NULL, NULL); - - return 0; -} diff --git a/recipes/jemalloc/all/test_v1_package/CMakeLists.txt b/recipes/jemalloc/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..b21cc49efde95 --- /dev/null +++ b/recipes/jemalloc/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/jemalloc/all/test_v1_package/conanfile.py b/recipes/jemalloc/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..49a3a66ea5bad --- /dev/null +++ b/recipes/jemalloc/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/jerryscript/all/CMakeLists.txt b/recipes/jerryscript/all/CMakeLists.txt deleted file mode 100644 index 361b35d4c17d9..0000000000000 --- a/recipes/jerryscript/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/jerryscript/all/conandata.yml b/recipes/jerryscript/all/conandata.yml index f587b0a08830d..466f9de6c36b3 100644 --- a/recipes/jerryscript/all/conandata.yml +++ b/recipes/jerryscript/all/conandata.yml @@ -10,13 +10,9 @@ sources: url: https://github.com/jerryscript-project/jerryscript/archive/v2.4.0.zip patches: "2.2.0": - - base_path: "source_subfolder" - patch_file: "patches/0001-2.3.0-remove-werror.patch" + - patch_file: "patches/0001-2.3.0-remove-werror.patch" "2.3.0": - - base_path: "source_subfolder" - patch_file: "patches/0001-2.3.0-remove-werror.patch" + - patch_file: "patches/0001-2.3.0-remove-werror.patch" "2.4.0": - - base_path: "source_subfolder" - patch_file: "patches/0002-2.4.0-remove-werror.patch" - - base_path: "source_subfolder" - patch_file: "patches/0003-2.4.0-no-CMAKE_SOURCE_DIR.patch" + - patch_file: "patches/0002-2.4.0-remove-werror.patch" + - patch_file: "patches/0003-2.4.0-no-CMAKE_SOURCE_DIR.patch" diff --git a/recipes/jerryscript/all/conanfile.py b/recipes/jerryscript/all/conanfile.py index d7fc6037445eb..b262445d3a489 100644 --- a/recipes/jerryscript/all/conanfile.py +++ b/recipes/jerryscript/all/conanfile.py @@ -1,18 +1,26 @@ -from conans import CMake, ConanFile, 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 is_apple_os, fix_apple_shared_install_name +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, load, rmdir +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" + class JerryScriptStackConan(ConanFile): name = "jerryscript" + description = "Ultra-lightweight JavaScript engine for the Internet of Things" license = "Apache-2.0" - homepage = "https://github.com/jerryscript-project/jerryscript" url = "https://github.com/conan-io/conan-center-index" - description = "Ultra-lightweight JavaScript engine for the Internet of Things" - topics = ["javascript", "iot", "jerryscript", "javascript-engine"] - exports_sources = "CMakeLists.txt", "patches/**" - settings = "os", "compiler", "build_type", "arch" + homepage = "https://github.com/jerryscript-project/jerryscript" + topics = ("javascript", "iot", "javascript-engine") + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -27,7 +35,7 @@ class JerryScriptStackConan(ConanFile): "amalgamated": [True, False], "debugger": [True, False], "keep_line_info": [True, False], - "profile": "ANY", + "profile": ["ANY"], "promise_callback": [True, False], "external_context": [True, False], "snapshot_execution": [True, False], @@ -39,10 +47,10 @@ class JerryScriptStackConan(ConanFile): "error_messages": [True, False], "logging": [True, False], "memory_statistics": [True, False], - "heap_size": "ANY", - "gc_limit": "ANY", - "gc_mark_limit": "ANY", - "stack_limit": "ANY", + "heap_size": ["ANY"], + "gc_limit": ["ANY"], + "gc_mark_limit": ["ANY"], + "stack_limit": ["ANY"], "cpointer_32_bit": [True, False], "system_allocator": [True, False], "valgrind": [True, False], @@ -85,47 +93,41 @@ class JerryScriptStackConan(ConanFile): "gc_before_each_alloc": False, "vm_exec_stop": False, } - generators = "cmake" - short_paths = True - - _cmake = None - _predefined_profiles = ["es.next", "es5.1", "minimal"] - - @property - def _source_subfolder(self): - return "source_subfolder" @property - def _build_subfolder(self): - return "build_subfolder" + def _predefined_profiles(self): + return ["es.next", "es5.1", "minimal"] @property def _jerry_math(self): return self.options.get_safe("jerry_math", False) + def export_sources(self): + export_conandata_patches(self) + def config_options(self): if self.settings.os == "Windows": del self.options.fPIC # profile and jerry_match default option value depend on version - if tools.Version(self.version) < "2.4.0": + if Version(self.version) < "2.4.0": self.options.profile = "es5.1" self.options.jerry_math = True - if self.settings.compiler == "Visual Studio": + if is_msvc(self): del self.options.jerry_math # forced to False else: self.options.profile = "es.next" self.options.jerry_math = False - if self.settings.os == "Macos": + if is_apple_os(self): del self.options.jerry_math # forced to False del self.options.link_time_optimization # forced to False - del self.options.strip # forced to False + del self.options.strip_symbols # forced to False 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") if not self.options.debugger: del self.options.keep_line_info @@ -133,6 +135,13 @@ def configure(self): if self.settings.os == "Windows" and self.options.shared: raise ConanInvalidConfiguration("jerryscript shared lib is not yet supported under windows") + def layout(self): + cmake_layout(self, src_folder="src") + + def package_id(self): + if self.info.options.profile not in self._predefined_profiles: + self.info.options.profile = load(self, str(self.info.options.profile)) + def validate(self): # validate integers try: @@ -146,105 +155,107 @@ def validate(self): if not check_res: raise ConanInvalidConfiguration(txt) except ValueError as e: - raise ConanInvalidConfiguration("jerryscript heap size, gc mark limit, stack limit, gc limit should be a positive integer") + raise ConanInvalidConfiguration( + "jerryscript heap size, gc mark limit, stack limit, " + "gc limit should be a positive integer" + ) # validate profile file if self.options.profile not in self._predefined_profiles and not os.path.isfile(str(self.options.profile)): - raise ConanInvalidConfiguration("Invalid profile option. Feature profile must either be a valid file or one of these: es.next, es5.1, minimal") + raise ConanInvalidConfiguration( + "Invalid profile option. " + "Feature profile must either be a valid file or one of these: es.next, es5.1, minimal" + ) # validate the use of the system allocator option if self.settings.arch == "x86_64" and self.options.system_allocator: raise ConanInvalidConfiguration("jerryscript system allocator not available on 64bit systems") if self.options.system_allocator and not self.options.cpointer_32_bit: raise ConanInvalidConfiguration("jerryscript system allocator must be used with 32 bit pointers") - def package_id(self): - if self.options.profile not in self._predefined_profiles: - self.info.options.profile = tools.load(str(self.options.profile)) - 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["patches"][self.version]: - tools.patch(**patch) + 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) + def generate(self): + tc = CMakeToolchain(self) amalgamation_definition = "ENABLE_AMALGAM" libmath_definition = "JERRY_MATH" - if tools.Version(self.version) < tools.Version("2.4.0"): + if Version(self.version) < "2.4.0": amalgamation_definition = "ENABLE_ALL_IN_ONE" libmath_definition = "JERRY_LIBM" - self._cmake.definitions["JERRY_CMDLINE"] = self.options.tool_cmdline - self._cmake.definitions["JERRY_CMDLINE_TEST"] = self.options.tool_cmdline_test - self._cmake.definitions["JERRY_CMDLINE_SNAPSHOT"] = self.options.tool_cmdline_snapshot - self._cmake.definitions["JERRY_PORT_DEFAULT"] = self.options.default_port_implementation - self._cmake.definitions["JERRY_EXT"] = self.options.jerry_ext - self._cmake.definitions[libmath_definition] = self._jerry_math - self._cmake.definitions["ENABLE_STRIP"] = self.options.get_safe("jerry_strip", False) - self._cmake.definitions["ENABLE_LTO"] = self.options.get_safe("link_time_optimization", False) - self._cmake.definitions[amalgamation_definition] = self.options.amalgamated - self._cmake.definitions["JERRY_DEBUGGER"] = self.options.debugger - self._cmake.definitions["JERRY_LINE_INFO"] = self.options.get_safe("keep_line_info", False) - self._cmake.definitions["JERRY_PROFILE"] = self.options.profile - self._cmake.definitions["JERRY_EXTERNAL_CONTEXT"] = self.options.external_context - self._cmake.definitions["JERRY_SNAPSHOT_EXEC"] = self.options.snapshot_execution - self._cmake.definitions["JERRY_SNAPSHOT_SAVE"] = self.options.snapshot_saving - self._cmake.definitions["JERRY_PARSER"] = self.options.parser - self._cmake.definitions["JERRY_PARSER_DUMP_BYTE_CODE"] = self.options.enable_dump_bytecode - self._cmake.definitions["JERRY_REGEXP_DUMP_BYTE_CODE"] = self.options.enable_dump_regexp_bytecode - self._cmake.definitions["JERRY_REGEXP_STRICT_MODE"] = self.options.strict_regexp - self._cmake.definitions["JERRY_ERROR_MESSAGES"] = self.options.error_messages - self._cmake.definitions["JERRY_LOGGING"] = self.options.logging - self._cmake.definitions["JERRY_MEM_STATS"] = self.options.memory_statistics - self._cmake.definitions["JERRY_GLOBAL_HEAP_SIZE"] = "(%s)" % self.options.heap_size - self._cmake.definitions["JERRY_GC_LIMIT"] = "(%s)" % self.options.gc_limit - self._cmake.definitions["JERRY_GC_MARK_LIMIT"] = "(%s)" % self.options.gc_mark_limit - self._cmake.definitions["JERRY_STACK_LIMIT"] = "(%s)" % self.options.stack_limit - self._cmake.definitions["JERRY_CPOINTER_32_BIT"] = self.options.cpointer_32_bit - self._cmake.definitions["JERRY_SYSTEM_ALLOCATOR"] = self.options.system_allocator - self._cmake.definitions["JERRY_VALGRIND"] = self.options.valgrind - self._cmake.definitions["JERRY_MEM_GC_BEFORE_EACH_ALLOC"] = self.options.gc_before_each_alloc - self._cmake.definitions["JERRY_VM_EXEC_STOP"] = self.options.vm_exec_stop - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + tc.variables["JERRY_CMDLINE"] = self.options.tool_cmdline + tc.variables["JERRY_CMDLINE_TEST"] = self.options.tool_cmdline_test + tc.variables["JERRY_CMDLINE_SNAPSHOT"] = self.options.tool_cmdline_snapshot + tc.variables["JERRY_PORT_DEFAULT"] = self.options.default_port_implementation + tc.variables["JERRY_EXT"] = self.options.jerry_ext + tc.variables[libmath_definition] = self._jerry_math + tc.variables["ENABLE_STRIP"] = self.options.get_safe("jerry_strip", False) + tc.variables["ENABLE_LTO"] = self.options.get_safe("link_time_optimization", False) + tc.variables[amalgamation_definition] = self.options.amalgamated + tc.variables["JERRY_DEBUGGER"] = self.options.debugger + tc.variables["JERRY_LINE_INFO"] = self.options.get_safe("keep_line_info", False) + tc.variables["JERRY_PROFILE"] = self.options.profile + tc.variables["JERRY_EXTERNAL_CONTEXT"] = self.options.external_context + tc.variables["JERRY_SNAPSHOT_EXEC"] = self.options.snapshot_execution + tc.variables["JERRY_SNAPSHOT_SAVE"] = self.options.snapshot_saving + tc.variables["JERRY_PARSER"] = self.options.parser + tc.variables["JERRY_PARSER_DUMP_BYTE_CODE"] = self.options.enable_dump_bytecode + tc.variables["JERRY_REGEXP_DUMP_BYTE_CODE"] = self.options.enable_dump_regexp_bytecode + tc.variables["JERRY_REGEXP_STRICT_MODE"] = self.options.strict_regexp + tc.variables["JERRY_ERROR_MESSAGES"] = self.options.error_messages + tc.variables["JERRY_LOGGING"] = self.options.logging + tc.variables["JERRY_MEM_STATS"] = self.options.memory_statistics + tc.variables["JERRY_GLOBAL_HEAP_SIZE"] = "(%s)" % self.options.heap_size + tc.variables["JERRY_GC_LIMIT"] = "(%s)" % self.options.gc_limit + tc.variables["JERRY_GC_MARK_LIMIT"] = "(%s)" % self.options.gc_mark_limit + tc.variables["JERRY_STACK_LIMIT"] = "(%s)" % self.options.stack_limit + tc.variables["JERRY_CPOINTER_32_BIT"] = self.options.cpointer_32_bit + tc.variables["JERRY_SYSTEM_ALLOCATOR"] = self.options.system_allocator + tc.variables["JERRY_VALGRIND"] = self.options.valgrind + tc.variables["JERRY_MEM_GC_BEFORE_EACH_ALLOC"] = self.options.gc_before_each_alloc + tc.variables["JERRY_VM_EXEC_STOP"] = self.options.vm_exec_stop + tc.generate() + + tc = CMakeDeps(self) + tc.generate() + + def _patch_sources(self): + 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, "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")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + fix_apple_shared_install_name(self) def package_info(self): - self.cpp_info.components["libjerry-port-default"].names["pkg_config"] = ["libjerry-port-default"] + self.cpp_info.components["libjerry-port-default"].set_property("pkg_config_name", "libjerry-port-default") self.cpp_info.components["libjerry-port-default"].libs = ["jerry-port-default"] if self._jerry_math: - mathlibname = "jerry-libm" if tools.Version(self.version) < "2.4.0" else "jerry-math" - self.cpp_info.components["libjerry-math"].names["pkg_config"] = "lib{}".format(mathlibname) + mathlibname = "jerry-libm" if Version(self.version) < "2.4.0" else "jerry-math" + self.cpp_info.components["libjerry-math"].set_property("pkg_config_name", f"lib{mathlibname}") self.cpp_info.components["libjerry-math"].libs = [mathlibname] self.cpp_info.components["libjerry-math"].requires = ["libjerry-port-default"] self.cpp_info.components["libjerry-core"].requires.append("libjerry-math") - if tools.Version(self.version) < "2.4.0": - self.cpp_info.components["libjerry-port-default-minimal"].names["pkg_config"] = ["libjerry-port-default-minimal"] + if Version(self.version) < "2.4.0": + self.cpp_info.components["libjerry-port-default-minimal"].set_property("pkg_config_name", "libjerry-port-default-minimal") self.cpp_info.components["libjerry-port-default-minimal"].libs = ["jerry-port-default-minimal"] self.cpp_info.components["libjerry-port-default"].requires.append("libjerry-port-default-minimal") - self.cpp_info.components["libjerry-core"].names["pkg_config"] = "libjerry-core" + self.cpp_info.components["libjerry-core"].set_property("pkg_config_name", "libjerry-core") self.cpp_info.components["libjerry-core"].libs = ["jerry-core"] # The pc file does not explicitly add the port. But it's needed for the test self.cpp_info.components["libjerry-core"].requires = ["libjerry-port-default"] if self.settings.os in ("FreeBSD", "Linux"): self.cpp_info.components["libjerry-core"].system_libs.append("m") - self.cpp_info.components["libjerry-ext"].names["pkg_config"] = "libjerry-ext" + self.cpp_info.components["libjerry-ext"].set_property("pkg_config_name", "libjerry-ext") self.cpp_info.components["libjerry-ext"].libs = ["jerry-ext"] self.cpp_info.components["libjerry-ext"].requires = ["libjerry-core"] diff --git a/recipes/jerryscript/all/test_package/CMakeLists.txt b/recipes/jerryscript/all/test_package/CMakeLists.txt index 7b9b613cbb24a..d0cab5c74bc2f 100644 --- a/recipes/jerryscript/all/test_package/CMakeLists.txt +++ b/recipes/jerryscript/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ -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() +find_package(jerryscript REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE jerryscript::jerryscript) diff --git a/recipes/jerryscript/all/test_package/conanfile.py b/recipes/jerryscript/all/test_package/conanfile.py index bbf2351737349..ef5d7042163ec 100644 --- a/recipes/jerryscript/all/test_package/conanfile.py +++ b/recipes/jerryscript/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 TestConan(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", "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/jerryscript/all/test_v1_package/CMakeLists.txt b/recipes/jerryscript/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/jerryscript/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/jerryscript/all/test_v1_package/conanfile.py b/recipes/jerryscript/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..f575dfc3e9c8a --- /dev/null +++ b/recipes/jerryscript/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +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.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/jfalcou-eve/all/conandata.yml b/recipes/jfalcou-eve/all/conandata.yml index 05a5aeff2b5fd..1564d67865638 100644 --- a/recipes/jfalcou-eve/all/conandata.yml +++ b/recipes/jfalcou-eve/all/conandata.yml @@ -1,13 +1,16 @@ sources: - "v2021.10.0": - url: "https://github.com/jfalcou/eve/archive/refs/tags/v2021.10.0.tar.gz" - sha256: "580c40a8244039a700b93ea49fb0affc1c8d3c100eb6dc66368e101753f51e5c" - "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" + "v2023.02.15": + url: "https://github.com/jfalcou/eve/archive/refs/tags/v2023.02.15.tar.gz" + sha256: "7a5fb59c0e6ef3bef3e8b36d62e138d31e7f2a9f1bdfe95a8e96512b207f84c5" "v2022.09.1": url: "https://github.com/jfalcou/eve/archive/refs/tags/v2022.09.1.tar.gz" sha256: "d8d3ae55f0ca2690f8a22883eaaa8251275b76702da0267e8e1725b22c51e978" + "v2022.09.0": + url: "https://github.com/jfalcou/eve/archive/refs/tags/v2022.09.0.tar.gz" + sha256: "53a4e1944a1080c67380a6d7f4fb42998f1c1db35e2370e02d7853c3ac1e0a33" + "v2022.03.0": + url: "https://github.com/jfalcou/eve/archive/refs/tags/v2022.03.0.tar.gz" + sha256: "8bf9faea516806e7dd468e778dcedc81c51f0b2c6a70b9c75987ce12bb759911" + "v2021.10.0": + url: "https://github.com/jfalcou/eve/archive/refs/tags/v2021.10.0.tar.gz" + sha256: "580c40a8244039a700b93ea49fb0affc1c8d3c100eb6dc66368e101753f51e5c" diff --git a/recipes/jfalcou-eve/all/conanfile.py b/recipes/jfalcou-eve/all/conanfile.py index d79178dde59e1..51aa78ce2dd31 100644 --- a/recipes/jfalcou-eve/all/conanfile.py +++ b/recipes/jfalcou-eve/all/conanfile.py @@ -1,7 +1,6 @@ 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.files import copy, get from conan.tools.scm import Version from conan.tools.layout import basic_layout from conan.tools.microsoft import is_msvc @@ -9,7 +8,7 @@ import os -required_conan_version = ">=1.51.3" +required_conan_version = ">=1.50.0" class JfalcouEveConan(ConanFile): @@ -17,29 +16,30 @@ class JfalcouEveConan(ConanFile): description = ("Expressive Velocity Engine - reimplementation of the old " "Boost.SIMD on C++20" ) - homepage = "https://jfalcou.github.io/eve/" - topics = ("cpp", "simd") license = ("MIT", "BSL-1.0") url = "https://github.com/conan-io/conan-center-index" + homepage = "https://jfalcou.github.io/eve/" + topics = ("cpp", "simd", "header-only") + package_type = "header-library" 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", - "Visual Studio": "16.9", - "msvc": "1928", - "clang": "13", - "apple-clang": "13"} + return { + "gcc": "11", + "Visual Studio": "16.9", + "msvc": "192", + "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): + if Version(self.version.strip("v")) < "2022.09.0": self.license = "MIT" else: self.license = "BSL-1.0" @@ -47,39 +47,42 @@ def configure(self): def layout(self): basic_layout(self, src_folder="src") + def package_id(self): + self.info.clear() + def validate(self): - # 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): + if is_msvc(self) and Version(self.version.strip("v")) < "2023.02.15": + raise ConanInvalidConfiguration(f"{self.ref} does not support MSVC. See https://github.com/jfalcou/eve/issues/1022") + + 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(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(f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.") - - def package_id(self): - self.info.clear() + 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): - files.get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=self.source_folder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): 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.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.set_property("cmake_file_name", "eve") self.cpp_info.set_property("cmake_target_name", "eve::eve") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.names["cmake_find_package"] = "eve" + self.cpp_info.names["cmake_find_package_multi"] = "eve" diff --git a/recipes/jfalcou-eve/all/test_package/CMakeLists.txt b/recipes/jfalcou-eve/all/test_package/CMakeLists.txt index 07df5491f5a34..27bf0e618e9af 100644 --- a/recipes/jfalcou-eve/all/test_package/CMakeLists.txt +++ b/recipes/jfalcou-eve/all/test_package/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.12) -project(test_package CXX) +project(test_package LANGUAGES CXX) find_package(eve REQUIRED CONFIG) diff --git a/recipes/jfalcou-eve/all/test_v1_package/CMakeLists.txt b/recipes/jfalcou-eve/all/test_v1_package/CMakeLists.txt index 7e31b52213165..999a4a03ed9c9 100644 --- a/recipes/jfalcou-eve/all/test_v1_package/CMakeLists.txt +++ b/recipes/jfalcou-eve/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package CXX) +project(test_package) 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) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/jfalcou-eve/config.yml b/recipes/jfalcou-eve/config.yml index 5db2eb32f0264..7bff48f980652 100644 --- a/recipes/jfalcou-eve/config.yml +++ b/recipes/jfalcou-eve/config.yml @@ -1,9 +1,11 @@ versions: - "v2021.10.0": + "v2023.02.15": folder: all - "v2022.03.0": + "v2022.09.1": folder: all "v2022.09.0": folder: all - "v2022.09.1": + "v2022.03.0": + folder: all + "v2021.10.0": folder: all diff --git a/recipes/jinja2cpp/all/CMakeLists.txt b/recipes/jinja2cpp/all/CMakeLists.txt deleted file mode 100644 index 4b0bc06c8282d..0000000000000 --- a/recipes/jinja2cpp/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/jinja2cpp/all/conandata.yml b/recipes/jinja2cpp/all/conandata.yml index ba871764ca5c4..ef96ec4edd10e 100644 --- a/recipes/jinja2cpp/all/conandata.yml +++ b/recipes/jinja2cpp/all/conandata.yml @@ -1,14 +1,23 @@ sources: + "1.3.2": + url: "https://github.com/jinja2cpp/Jinja2Cpp/archive/1.3.2.tar.gz" + sha256: "227afb9d16eb1a47c3f3ca10c2f589dd2791c5d8b4767c73e26a0b8997e4c03e" "1.2.1": - url: "https://github.com/jinja2cpp/Jinja2Cpp/archive/refs/tags/1.2.1.tar.gz" + url: "https://github.com/jinja2cpp/Jinja2Cpp/archive/1.2.1.tar.gz" sha256: "2e61516fd4fd77452c8dd7a6f958ad47c42990df9b7bdc62cf2deb8aa7819b6c" "1.1.0": url: "https://github.com/jinja2cpp/Jinja2Cpp/archive/1.1.0.tar.gz" sha256: "3d321a144f3774702d3a6252e3a6370cdaff9c96d8761d850bb79cdb45b372c5" patches: + "1.3.2": + - patch_file: "patches/fix-cmake-1.3.2.patch" + patch_description: "use cci package, fix compilation error on MSVC" + patch_type: "conan" "1.2.1": - patch_file: "patches/fix-cmake-1.2.1.patch" - base_path: "source_subfolder" + patch_description: "use cci package, fix compilation error on MSVC" + patch_type: "conan" "1.1.0": - patch_file: "patches/fix-cmake-1.1.0.patch" - base_path: "source_subfolder" + patch_description: "use cci package, include mutex for std::unique_lock" + patch_type: "conan" diff --git a/recipes/jinja2cpp/all/conanfile.py b/recipes/jinja2cpp/all/conanfile.py index 5ccade1cbf22f..a4f69271c3eb5 100644 --- a/recipes/jinja2cpp/all/conanfile.py +++ b/recipes/jinja2cpp/all/conanfile.py @@ -1,148 +1,136 @@ -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.microsoft import msvc_runtime_flag, is_msvc +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 -import textwrap - -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class Jinja2cppConan(ConanFile): name = "jinja2cpp" + description = "Jinja2 C++ (and for C++) almost full-conformance template engine implementation" license = "MIT" - homepage = "https://jinja2cpp.dev/" url = "https://github.com/conan-io/conan-center-index" - description = "Jinja2 C++ (and for C++) almost full-conformance template engine implementation" + homepage = "https://jinja2cpp.dev/" topics = ("cpp14", "cpp17", "jinja2", "string templates", "templates engine") - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], + "with_regex": ["std", "boost"], } default_options = { "shared": False, "fPIC": True, + "with_regex": "boost", } - generators = "cmake", "cmake_find_package" - _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 _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] + def _compilers_minimum_version(self): + return { + "gcc": "6", + "clang": "5", + "apple-clang": "10", + "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"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + if Version(self.version) < "1.3.2": + del self.options.with_regex 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("expected-lite/0.5.0") - self.requires("optional-lite/3.5.0") - self.requires("rapidjson/cci.20211112") - self.requires("string-view-lite/1.6.0") - self.requires("variant-lite/2.0.0") + self.requires("boost/1.83.0") + self.requires("expected-lite/0.6.3", transitive_headers=True) + self.requires("optional-lite/3.5.0", transitive_headers=True) + self.requires("rapidjson/cci.20220822") + self.requires("string-view-lite/1.7.0", transitive_headers=True) + self.requires("variant-lite/2.0.0", transitive_headers=True) if self.version == "1.1.0": self.requires("fmt/6.2.1") # not compatible with fmt >= 7.0.0 else: - self.requires("nlohmann_json/3.10.5") - self.requires("fmt/8.1.1") + self.requires("nlohmann_json/3.11.2") + self.requires("fmt/10.2.0") 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 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 Version(self.version) >= "1.3.1" and self.dependencies["boost"].options.without_json: + raise ConanInvalidConfiguration(f"{self.ref} require Boost::json.") + + def build_requirements(self): + if Version(self.version) >= "1.3.1": + self.tool_requires("cmake/[>=3.23 <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], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + if Version(self.version) >= "1.3.2": + tc.cache_variables["JINJA2CPP_USE_REGEX"] = self.options.with_regex + tc.variables["JINJA2CPP_BUILD_TESTS"] = False + tc.variables["JINJA2CPP_STRICT_WARNINGS"] = False + tc.variables["JINJA2CPP_BUILD_SHARED"] = self.options.shared + tc.variables["JINJA2CPP_DEPS_MODE"] = "conan-build" + cppstd = self.settings.compiler.get_safe("cppstd") + if cppstd: + tc.cache_variables["JINJA2CPP_CXX_STANDARD"] = str(cppstd).replace("gnu", "") + if is_msvc(self): + # Runtime type configuration for Jinja2C++ should be strictly '/MT' or '/MD' + runtime = "/MD" if "MD" in msvc_runtime_flag(self) else "/MT" + tc.variables["JINJA2CPP_MSVC_RUNTIME_TYPE"] = runtime + tc.generate() + deps = CMakeDeps(self) + deps.set_property("expected-lite", "cmake_target_name", "expected-lite::expected-lite") + deps.generate() def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) # Don't force MD for shared lib, allow to honor runtime from profile - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "set(JINJA2CPP_MSVC_RUNTIME_TYPE \"/MD\")", "") - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["JINJA2CPP_BUILD_TESTS"] = False - self._cmake.definitions["JINJA2CPP_STRICT_WARNINGS"] = False - self._cmake.definitions["JINJA2CPP_BUILD_SHARED"] = self.options.shared - self._cmake.definitions["JINJA2CPP_DEPS_MODE"] = "conan-build" - self._cmake.definitions["JINJA2CPP_CXX_STANDARD"] = self.settings.compiler.get_safe("cppstd", 14) - # Conan cmake generator omits the build_type flag for MSVC multiconfiguration CMake, - # but provide build-type-specific runtime type flag. For now, Jinja2C++ build scripts - # need to know the build type is being built in order to setup internal flags correctly - self._cmake.definitions["CMAKE_BUILD_TYPE"] = self.settings.build_type - if self._is_msvc: - # Runtime type configuration for Jinja2C++ should be strictly '/MT' or '/MD' - runtime = "/MD" if "MD" in msvc_runtime_flag(self) else "/MT" - self._cmake.definitions["JINJA2CPP_MSVC_RUNTIME_TYPE"] = runtime - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "set(JINJA2CPP_MSVC_RUNTIME_TYPE \"/MD\")", "") def build(self): - if self.version == "1.1.0": - if tools.Version(self.deps_cpp_info["fmt"].version) >= "7.0.0": - raise ConanInvalidConfiguration("jinja2cpp requires fmt < 7.0.0") 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", "jinja2cpp")) - tools.rmdir(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), - {"jinja2cpp": "jinja2cpp::jinja2cpp"} - ) - - @staticmethod - def _create_cmake_module_alias_targets(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)) - tools.save(module_file, content) - - @property - def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + rmdir(self, os.path.join(self.package_folder, "lib", "jinja2cpp")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "jinja2cpp") self.cpp_info.set_property("cmake_target_name", "jinja2cpp") self.cpp_info.libs = ["jinja2cpp"] - # 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/jinja2cpp/all/patches/fix-cmake-1.1.0.patch b/recipes/jinja2cpp/all/patches/fix-cmake-1.1.0.patch index 2c9056e924d37..e1b4bd4776539 100644 --- a/recipes/jinja2cpp/all/patches/fix-cmake-1.1.0.patch +++ b/recipes/jinja2cpp/all/patches/fix-cmake-1.1.0.patch @@ -1,3 +1,5 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index b5c8b3c..c0afc14 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,10 +21,6 @@ option(JINJA2CPP_STRICT_WARNINGS "Enable additional warnings and treat them as e @@ -29,20 +31,37 @@ PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/jinja2cpp ) +diff --git a/include/jinja2cpp/template_env.h b/include/jinja2cpp/template_env.h +index d49859e..0bd456e 100644 +--- a/include/jinja2cpp/template_env.h ++++ b/include/jinja2cpp/template_env.h +@@ -6,6 +6,7 @@ + #include "filesystem_handler.h" + #include "template.h" + ++#include + #include + #include + +diff --git a/thirdparty/thirdparty-conan-build.cmake b/thirdparty/thirdparty-conan-build.cmake +index 5aecfbd..957657f 100644 --- a/thirdparty/thirdparty-conan-build.cmake +++ b/thirdparty/thirdparty-conan-build.cmake -@@ -8,7 +8,11 @@ find_package(string-view-lite) +@@ -6,9 +6,13 @@ find_package(optional-lite) + find_package(string-view-lite) + find_package(Boost) - set(CONAN_BOOST_PACKAGE_NAME Boost::Boost) +-set(CONAN_BOOST_PACKAGE_NAME Boost::Boost) find_package(fmt) -find_package(rapidjson) +find_package(RapidJSON) - --set(JINJA2_PRIVATE_LIBS_INT ${CONAN_BOOST_PACKAGE_NAME} fmt::fmt rapidjson::rapidjson) --set(JINJA2_PUBLIC_LIBS_INT expected-lite::expected-lite variant-lite::variant-lite optional-lite::optional-lite string-view-lite::string-view-lite) ++ +# TODO: replace conan targets by official imported targets when fixed in corresponding recipes: +# - CONAN_PKG::rapidjson => rapidjson +# - CONAN_PKG::optional-lite => nonstd::optional-lite +# - CONAN_PKG::variant-lite => nonstd::variant-lite -+set(JINJA2_PRIVATE_LIBS_INT ${CONAN_BOOST_PACKAGE_NAME} fmt::fmt CONAN_PKG::rapidjson) -+set(JINJA2_PUBLIC_LIBS_INT nonstd::expected-lite CONAN_PKG::variant-lite CONAN_PKG::optional-lite nonstd::string-view-lite) ++set(JINJA2_PRIVATE_LIBS_INT Boost::headers Boost::filesystem fmt::fmt rapidjson) ++set(JINJA2_PUBLIC_LIBS_INT nonstd::expected-lite nonstd::variant-lite nonstd::optional-lite nonstd::string-view-lite) + +-set(JINJA2_PRIVATE_LIBS_INT ${CONAN_BOOST_PACKAGE_NAME} fmt::fmt rapidjson::rapidjson) +-set(JINJA2_PUBLIC_LIBS_INT expected-lite::expected-lite variant-lite::variant-lite optional-lite::optional-lite string-view-lite::string-view-lite) diff --git a/recipes/jinja2cpp/all/patches/fix-cmake-1.2.1.patch b/recipes/jinja2cpp/all/patches/fix-cmake-1.2.1.patch index d355b60a17daa..391fd64166078 100644 --- a/recipes/jinja2cpp/all/patches/fix-cmake-1.2.1.patch +++ b/recipes/jinja2cpp/all/patches/fix-cmake-1.2.1.patch @@ -12,7 +12,7 @@ index bf603b0..6229f02 100644 ) diff --git a/src/helpers.h b/src/helpers.h -index 3af280f..a6a3205 100644 +index 3af280f..b1c31fe 100644 --- a/src/helpers.h +++ b/src/helpers.h @@ -32,12 +32,21 @@ struct MultiStringLiteral @@ -37,3 +37,33 @@ index 3af280f..a6a3205 100644 template struct SelectMemberPtr; +diff --git a/thirdparty/CMakeLists.txt b/thirdparty/CMakeLists.txt +index 77794b9..e31b999 100644 +--- a/thirdparty/CMakeLists.txt ++++ b/thirdparty/CMakeLists.txt +@@ -67,8 +67,8 @@ if(JINJA2CPP_BUILD_TESTS) + endif() + + if (NOT DEFINED JINJA2_PRIVATE_LIBS_INT) +- set(JINJA2CPP_PRIVATE_LIBS ${JINJA2CPP_PRIVATE_LIBS} Boost::variant +- Boost::filesystem Boost::algorithm Boost::lexical_cast fmt RapidJson) ++ set(JINJA2CPP_PRIVATE_LIBS ${JINJA2CPP_PRIVATE_LIBS} Boost::headers ++ Boost::filesystem fmt RapidJson) + else () + set (JINJA2CPP_PRIVATE_LIBS ${JINJA2_PRIVATE_LIBS_INT}) + endif () +diff --git a/thirdparty/thirdparty-conan-build.cmake b/thirdparty/thirdparty-conan-build.cmake +index ec1e2c4..3a70e8a 100644 +--- a/thirdparty/thirdparty-conan-build.cmake ++++ b/thirdparty/thirdparty-conan-build.cmake +@@ -7,9 +7,8 @@ find_package(string-view-lite REQUIRED) + find_package(nlohmann_json REQUIRED) + + find_package(Boost) +-set(CONAN_BOOST_PACKAGE_NAME Boost::Boost) + find_package(fmt) + find_package(RapidJSON) + +-set(JINJA2_PRIVATE_LIBS_INT ${CONAN_BOOST_PACKAGE_NAME} fmt::fmt RapidJSON::RapidJSON nlohmann_json::nlohmann_json) ++set(JINJA2_PRIVATE_LIBS_INT Boost::headers Boost::filesystem fmt::fmt rapidjson nlohmann_json::nlohmann_json) + set(JINJA2_PUBLIC_LIBS_INT nonstd::expected-lite nonstd::variant-lite nonstd::optional-lite nonstd::string-view-lite) diff --git a/recipes/jinja2cpp/all/patches/fix-cmake-1.3.2.patch b/recipes/jinja2cpp/all/patches/fix-cmake-1.3.2.patch new file mode 100644 index 0000000000000..0484b48da6ca2 --- /dev/null +++ b/recipes/jinja2cpp/all/patches/fix-cmake-1.3.2.patch @@ -0,0 +1,47 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 4aabcff..9016742 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -312,7 +312,7 @@ if(JINJA2CPP_INSTALL) + InstallTargets + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/static ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + FILE_SET HEADERS + ) + +@@ -353,4 +353,4 @@ if(JINJA2CPP_INSTALL) + DESTINATION + ${JINJA2CPP_INSTALL_CONFIG_DIR} + ) +-endif() +\ No newline at end of file ++endif() +diff --git a/thirdparty/CMakeLists.txt b/thirdparty/CMakeLists.txt +index 57c8f8e..499f3c7 100644 +--- a/thirdparty/CMakeLists.txt ++++ b/thirdparty/CMakeLists.txt +@@ -70,8 +70,8 @@ endif() + + if (NOT DEFINED JINJA2_PRIVATE_LIBS_INT) + set(JINJA2CPP_PRIVATE_LIBS ${JINJA2CPP_PRIVATE_LIBS} +- Boost::variant Boost::filesystem Boost::algorithm Boost::lexical_cast Boost::json +- Boost::regex Boost::numeric_conversion fmt RapidJson) ++ Boost::headers Boost::filesystem Boost::json ++ Boost::regex fmt RapidJson) + else () + set (JINJA2CPP_PRIVATE_LIBS ${JINJA2_PRIVATE_LIBS_INT}) + endif () +diff --git a/thirdparty/thirdparty-conan-build.cmake b/thirdparty/thirdparty-conan-build.cmake +index e1bc3a4..fd30743 100644 +--- a/thirdparty/thirdparty-conan-build.cmake ++++ b/thirdparty/thirdparty-conan-build.cmake +@@ -10,6 +10,6 @@ find_package(Boost COMPONENTS algorithm filesystem numeric_conversion json optio + find_package(fmt REQUIRED) + find_package(RapidJSON REQUIRED) + +-set(JINJA2_PRIVATE_LIBS_INT Boost::headers Boost::filesystem Boost::numeric_conversion) ++set(JINJA2_PRIVATE_LIBS_INT Boost::headers Boost::filesystem) + set(JINJA2_PUBLIC_LIBS_INT Boost::json fmt::fmt rapidjson Boost::regex + nlohmann_json::nlohmann_json nonstd::expected-lite nonstd::variant-lite nonstd::optional-lite nonstd::string-view-lite) diff --git a/recipes/jinja2cpp/all/test_package/CMakeLists.txt b/recipes/jinja2cpp/all/test_package/CMakeLists.txt index 5f02285c2de3e..832ed53e2f10d 100644 --- a/recipes/jinja2cpp/all/test_package/CMakeLists.txt +++ b/recipes/jinja2cpp/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.15) +project(test_package LANGUAGES CXX) find_package(jinja2cpp REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} jinja2cpp) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14) +target_link_libraries(${PROJECT_NAME} PRIVATE jinja2cpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/jinja2cpp/all/test_package/conanfile.py b/recipes/jinja2cpp/all/test_package/conanfile.py index 38f4483872d47..ef5d7042163ec 100644 --- a/recipes/jinja2cpp/all/test_package/conanfile.py +++ b/recipes/jinja2cpp/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/jinja2cpp/config.yml b/recipes/jinja2cpp/config.yml index 97294286ce46b..6f563b16b51e2 100644 --- a/recipes/jinja2cpp/config.yml +++ b/recipes/jinja2cpp/config.yml @@ -1,4 +1,6 @@ versions: + "1.3.2": + folder: all "1.2.1": folder: all "1.1.0": diff --git a/recipes/jnk0le_ringbuffer/all/conandata.yml b/recipes/jnk0le_ringbuffer/all/conandata.yml new file mode 100644 index 0000000000000..e3e3019c5ae04 --- /dev/null +++ b/recipes/jnk0le_ringbuffer/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "cci.20240422": + url: "https://github.com/jnk0le/Ring-Buffer/archive/160190e0c985e0181e728a0b9f321f25ac549f20.tar.gz" + sha256: "9984f0f9c9bc453c3e835a9954e0b1914472e3657086accd5d1345a7c7c28e88" diff --git a/recipes/jnk0le_ringbuffer/all/conanfile.py b/recipes/jnk0le_ringbuffer/all/conanfile.py new file mode 100644 index 0000000000000..473c00193624d --- /dev/null +++ b/recipes/jnk0le_ringbuffer/all/conanfile.py @@ -0,0 +1,48 @@ +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 RingBufferConan(ConanFile): + name = "jnk0le_ringbuffer" + description = "simple C++11 ring buffer implementation, allocated and evaluated at compile time" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/jnk0le/Ring-Buffer" + topics = ("ring buffer", "compile time", "data-structures", "header-only") + package_type = "header-library" + 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=self.source_folder + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/jnk0le_ringbuffer/all/test_package/CMakeLists.txt b/recipes/jnk0le_ringbuffer/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..75a4d646f54c0 --- /dev/null +++ b/recipes/jnk0le_ringbuffer/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(jnk0le_ringbuffer CONFIG REQUIRED) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE jnk0le_ringbuffer::jnk0le_ringbuffer) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/jnk0le_ringbuffer/all/test_package/conanfile.py b/recipes/jnk0le_ringbuffer/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/jnk0le_ringbuffer/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/jnk0le_ringbuffer/all/test_package/test_package.cpp b/recipes/jnk0le_ringbuffer/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..63ad1c8b9609b --- /dev/null +++ b/recipes/jnk0le_ringbuffer/all/test_package/test_package.cpp @@ -0,0 +1,14 @@ +#include + +int main() { + // older gcc(4.9, 5.3) has a bug for alignas(0) + // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69089 + jnk0le::Ringbuffer message; + + message.insert("Hello world"); + + const char* tmp = nullptr; + message.remove(tmp); + + return 0; +} diff --git a/recipes/jnk0le_ringbuffer/config.yml b/recipes/jnk0le_ringbuffer/config.yml new file mode 100644 index 0000000000000..2dbea38f25622 --- /dev/null +++ b/recipes/jnk0le_ringbuffer/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20240422": + folder: all diff --git a/recipes/joltphysics/all/conandata.yml b/recipes/joltphysics/all/conandata.yml index 7c5580239b9ad..3b85494834125 100644 --- a/recipes/joltphysics/all/conandata.yml +++ b/recipes/joltphysics/all/conandata.yml @@ -1,9 +1,16 @@ sources: + "3.0.1": + url: "https://github.com/jrouwe/JoltPhysics/archive/refs/tags/v3.0.1.tar.gz" + sha256: "7ebb40bf2dddbcf0515984582aaa197ddd06e97581fd55b98cb64f91b243b8a6" "2.0.1": url: "https://github.com/jrouwe/JoltPhysics/archive/refs/tags/v2.0.1.tar.gz" sha256: "96ae2e8691c4802e56bf2587da30f2cc86b8abe82a78bc2398065bd87dd718af" patches: + "3.0.1": + - patch_file: "patches/3.0.1-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" "2.0.1": - - patch_file: "patches/0001-fix-cmake.patch" + - patch_file: "patches/2.0.1-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 index 875b57e559f57..ef2cbdfc71184 100644 --- a/recipes/joltphysics/all/conanfile.py +++ b/recipes/joltphysics/all/conanfile.py @@ -4,6 +4,7 @@ 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 +from conan.tools.scm import Version import os required_conan_version = ">=1.53.0" @@ -20,6 +21,7 @@ class JoltPhysicsConan(ConanFile): homepage = "https://github.com/jrouwe/JoltPhysics" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -86,8 +88,11 @@ def configure(self): def layout(self): cmake_layout(self, src_folder="src") + def build_requirements(self): + self.tool_requires("cmake/[>=3.16 <4]") + def validate(self): - if self.info.settings.compiler.get_safe("cppstd"): + if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, self._min_cppstd) def loose_lt_semver(v1, v2): @@ -96,18 +101,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.ref} requires C++{self._min_cppstd}, which your compiler does not support.", ) - if is_msvc(self) and self.info.options.shared: + 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) @@ -127,6 +131,8 @@ def generate(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 + if Version(self.version) >= "3.0.0": + tc.variables["ENABLE_ALL_WARNINGS"] = False tc.generate() def build(self): diff --git a/recipes/joltphysics/all/patches/0001-fix-cmake.patch b/recipes/joltphysics/all/patches/2.0.1-0001-fix-cmake.patch similarity index 100% rename from recipes/joltphysics/all/patches/0001-fix-cmake.patch rename to recipes/joltphysics/all/patches/2.0.1-0001-fix-cmake.patch diff --git a/recipes/joltphysics/all/patches/3.0.1-0001-fix-cmake.patch b/recipes/joltphysics/all/patches/3.0.1-0001-fix-cmake.patch new file mode 100644 index 0000000000000..b42aafe47bc62 --- /dev/null +++ b/recipes/joltphysics/all/patches/3.0.1-0001-fix-cmake.patch @@ -0,0 +1,125 @@ +diff --git a/Build/CMakeLists.txt b/Build/CMakeLists.txt +index e4fddc5..b106489 100644 +--- a/Build/CMakeLists.txt ++++ b/Build/CMakeLists.txt +@@ -19,8 +19,8 @@ option(CROSS_COMPILE_ARM "Cross compile to aarch64-linux-gnu" OFF) + # If you don't do this you may get an error: /usr/bin/ld: libJolt.a: error adding symbols: file format not recognized + option(INTERPROCEDURAL_OPTIMIZATION "Enable interprocedural optimizations" ON) + +-# When turning this on, in Debug and Release mode, the library will emit extra code to ensure that the 4th component of a 3-vector is kept the same as the 3rd component +-# and will enable floating point exceptions during simulation to detect divisions by zero. ++# When turning this on, in Debug and Release mode, the library will emit extra code to ensure that the 4th component of a 3-vector is kept the same as the 3rd component ++# and will enable floating point exceptions during simulation to detect divisions by zero. + # Note that this currently only works using MSVC. Clang turns Float2 into a SIMD vector sometimes causing floating point exceptions (the option is ignored). + option(FLOATING_POINT_EXCEPTIONS_ENABLED "Enable floating point exceptions" ON) + +@@ -47,17 +47,10 @@ 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) + +-# Determine which configurations exist +-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 + set(CLANG_LIB_PATH "\"$(VSInstallDir)\\VC\\Tools\\Llvm\\x64\\lib\\clang\\${CMAKE_CXX_COMPILER_VERSION}\\lib\\windows\"") +- ++ + # 64 bit architecture + set(CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE "x64") + +@@ -68,7 +61,7 @@ if (("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows" OR "${CMAKE_SYSTEM_NAME}" STREQUA + + # Set general compiler flags + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:__cplusplus /Gm- /MP /nologo /diagnostics:classic /FC /fp:except- /Zc:inline") +- ++ + # Enable warnings + if (ENABLE_ALL_WARNINGS) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Wall /WX") +@@ -189,7 +182,7 @@ set(PHYSICS_REPO_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../) + include(${PHYSICS_REPO_ROOT}/Jolt/Jolt.cmake) + if (IOS) + # Ensure that we enable SSE4.2 for the x86_64 build, CMAKE_SYSTEM_PROCESSOR is not set for iOS +- set_property(TARGET Jolt PROPERTY XCODE_ATTRIBUTE_OTHER_CPLUSPLUSFLAGS[arch=x86_64] "$(inherited) -msse4.2 -mpopcnt") ++ set_property(TARGET Jolt PROPERTY XCODE_ATTRIBUTE_OTHER_CPLUSPLUSFLAGS[arch=x86_64] "$(inherited) -msse4.2 -mpopcnt") + endif() + + # Install Jolt library and includes +@@ -202,7 +195,7 @@ foreach(SRC_FILE ${JOLT_PHYSICS_SRC_FILES}) + endif() + endforeach() + +-# Check if we're the root CMakeLists.txt, if not we are included by another CMake file and we should disable everything except for the main library ++# Check if we're the root CMakeLists.txt, if not we are included by another CMake file and we should disable everything except for the main library + if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) + # Ability to turn ON/OFF individual applications + option(TARGET_UNIT_TESTS "Build Unit Tests" ON) +@@ -258,7 +251,7 @@ if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) + target_link_options(PerformanceTest PUBLIC "/SUBSYSTEM:CONSOLE") + endif() + set_property(TARGET PerformanceTest PROPERTY VS_DEBUGGER_WORKING_DIRECTORY "${PHYSICS_REPO_ROOT}") +- ++ + # Copy the assets folder + add_custom_command(TARGET PerformanceTest PRE_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${PHYSICS_REPO_ROOT}/Assets/ $/Assets/) + endif() +@@ -276,4 +269,4 @@ if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) + include(${PHYSICS_REPO_ROOT}/JoltViewer/JoltViewer.cmake) + endif() + endif() +-endif() +\ No newline at end of file ++endif() +diff --git a/Jolt/Jolt.cmake b/Jolt/Jolt.cmake +index 176a757..efed8f0 100644 +--- a/Jolt/Jolt.cmake ++++ b/Jolt/Jolt.cmake +@@ -430,14 +430,28 @@ 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>") + + # Setting floating point exceptions +@@ -471,7 +485,7 @@ function(EMIT_X86_INSTRUCTION_SET_DEFINITIONS) + endif() + if (USE_AVX) + target_compile_definitions(Jolt PUBLIC JPH_USE_AVX) +- endif() ++ endif() + if (USE_SSE4_1) + target_compile_definitions(Jolt PUBLIC JPH_USE_SSE4_1) + endif() diff --git a/recipes/joltphysics/config.yml b/recipes/joltphysics/config.yml index bb7eb85dfac49..41bbdfae2300d 100644 --- a/recipes/joltphysics/config.yml +++ b/recipes/joltphysics/config.yml @@ -1,3 +1,5 @@ versions: + "3.0.1": + folder: all "2.0.1": folder: all diff --git a/recipes/jom/all/conandata.yml b/recipes/jom/all/conandata.yml index 0fe464cf0c395..0b87aa433e46a 100644 --- a/recipes/jom/all/conandata.yml +++ b/recipes/jom/all/conandata.yml @@ -1,4 +1,15 @@ sources: + "1.1.4": + x86_64: + url: "http://download.qt.io/official_releases/jom/jom_1_1_4.zip" + sha256: "d533c1ef49214229681e90196ed2094691e8c4a0a0bef0b2c901debcb562682b" + license: + url: "https://code.qt.io/cgit/qt-labs/jom.git/plain/LICENSE.GPL?h=v1.1.3" + sha256: "d3d9052b838761dbe00067168ed9ebc437734d53ebf71dea1c8e9f7532a5333b" "1.1.3": - sha256: "128fdd846fe24f8594eed37d1d8929a0ea78df563537c0c1b1861a635013fff8" - url: "http://download.qt.io/official_releases/jom/jom_1_1_3.zip" + x86_64: + url: "http://download.qt.io/official_releases/jom/jom_1_1_3.zip" + sha256: "128fdd846fe24f8594eed37d1d8929a0ea78df563537c0c1b1861a635013fff8" + license: + url: "https://code.qt.io/cgit/qt-labs/jom.git/plain/LICENSE.GPL?h=v1.1.3" + sha256: "d3d9052b838761dbe00067168ed9ebc437734d53ebf71dea1c8e9f7532a5333b" diff --git a/recipes/jom/all/conanfile.py b/recipes/jom/all/conanfile.py index e94e1344b85ef..6605c75c3ffa3 100644 --- a/recipes/jom/all/conanfile.py +++ b/recipes/jom/all/conanfile.py @@ -12,6 +12,7 @@ class JomInstallerConan(ConanFile): homepage = "http://wiki.qt.io/Jom" license = "GPL-3.0-only" topics = ("build", "make", "makefile", "nmake") + package_type = "application" settings = "os", "arch", "compiler", "build_type" def layout(self): @@ -22,24 +23,22 @@ def package_id(self): del self.info.settings.build_type def validate(self): - if self.info.settings.os != "Windows": + if self.settings.os != "Windows": raise ConanInvalidConfiguration(f"{self.ref} only supports Windows") def source(self): 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") + get(self, **self.conan_data["sources"][self.version]["x86_64"]) + download(self, **self.conan_data["sources"][self.version]["license"], filename="LICENSE.GPL") def package(self): 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.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] self.cpp_info.includedirs = [] # TODO: Legacy, to be removed on Conan 2.0 diff --git a/recipes/jom/all/test_package/conanfile.py b/recipes/jom/all/test_package/conanfile.py index 7762b725dc75e..2c855138b84ae 100644 --- a/recipes/jom/all/test_package/conanfile.py +++ b/recipes/jom/all/test_package/conanfile.py @@ -1,5 +1,4 @@ from conan import ConanFile -from conan.tools.build import can_run class TestPackageConan(ConanFile): @@ -14,5 +13,4 @@ def build(self): pass def test(self): - if can_run(self): - self.run("jom /VERSION") + self.run("jom /VERSION") diff --git a/recipes/jom/config.yml b/recipes/jom/config.yml index e1c4f3be24983..7f3d713ab8481 100644 --- a/recipes/jom/config.yml +++ b/recipes/jom/config.yml @@ -1,3 +1,5 @@ versions: + "1.1.4": + folder: all "1.1.3": folder: all diff --git a/recipes/jpcre2/all/conanfile.py b/recipes/jpcre2/all/conanfile.py index f0f2f817d89da..537216e3b272a 100644 --- a/recipes/jpcre2/all/conanfile.py +++ b/recipes/jpcre2/all/conanfile.py @@ -1,33 +1,44 @@ -from conans import ConanFile, tools import os -required_conan_version = ">=1.33.0" +from conan import ConanFile +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout + +required_conan_version = ">=1.52.0" class Jpcre2Conan(ConanFile): name = "jpcre2" - homepage = "https://github.com/jpcre2/jpcre2" description = "Header-only C++ wrapper for PCRE2 library." - topics = ("regex", "pcre2", "header-only", "single-header") - 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/jpcre2/jpcre2" + topics = ("regex", "pcre2", "header-only", "single-header") + 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 requirements(self): - self.requires("pcre2/10.37") + self.requires("pcre2/10.42") + + def package_id(self): + 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("COPYING", dst="licenses", src=self._source_subfolder) - self.copy("jpcre2.hpp", dst="include", src=os.path.join(self._source_subfolder, "src")) - - def package_id(self): - self.info.header_only() + copy(self, "COPYING", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder) + copy(self, "jpcre2.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/jpcre2/all/test_package/CMakeLists.txt b/recipes/jpcre2/all/test_package/CMakeLists.txt index c2f7a55ce01f3..dd0af07a2c068 100644 --- a/recipes/jpcre2/all/test_package/CMakeLists.txt +++ b/recipes/jpcre2/all/test_package/CMakeLists.txt @@ -1,10 +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) - -find_package(jpcre2 REQUIRED) +find_package(jpcre2 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE jpcre2::jpcre2) diff --git a/recipes/jpcre2/all/test_package/conanfile.py b/recipes/jpcre2/all/test_package/conanfile.py index 3da371b660e0a..fae501d0afb9e 100644 --- a/recipes/jpcre2/all/test_package/conanfile.py +++ b/recipes/jpcre2/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" + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/jpcre2/all/test_package/test_package.cpp b/recipes/jpcre2/all/test_package/test_package.cpp index dbaa3accd96c7..a1ec58eee8bf5 100644 --- a/recipes/jpcre2/all/test_package/test_package.cpp +++ b/recipes/jpcre2/all/test_package/test_package.cpp @@ -2,12 +2,10 @@ typedef jpcre2::select jp; -int main(int, char**) -{ +int main(int, char **) { jp::Regex re; re.setPattern("Hello (\\S+?)").compile(); - if (!re.match("Hello conan-center-index")) - { + if (!re.match("Hello conan-center-index")) { return 1; } diff --git a/recipes/jpcre2/all/test_v1_package/CMakeLists.txt b/recipes/jpcre2/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/jpcre2/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/jpcre2/all/test_v1_package/conanfile.py b/recipes/jpcre2/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..49a3a66ea5bad --- /dev/null +++ b/recipes/jpcre2/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/jpeg-compressor/all/test_package/conanfile.py b/recipes/jpeg-compressor/all/test_package/conanfile.py index ea70607af0172..0a6bc68712d90 100644 --- a/recipes/jpeg-compressor/all/test_package/conanfile.py +++ b/recipes/jpeg-compressor/all/test_package/conanfile.py @@ -23,5 +23,4 @@ def build(self): def test(self): 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") - self.run(f"{bin_path} {img_path}", env="conanrun") + self.run(bin_path, env="conanrun") diff --git a/recipes/jpeg-compressor/all/test_package/test_package.cpp b/recipes/jpeg-compressor/all/test_package/test_package.cpp index ef3f49c1a1fba..956e76e45a8b0 100644 --- a/recipes/jpeg-compressor/all/test_package/test_package.cpp +++ b/recipes/jpeg-compressor/all/test_package/test_package.cpp @@ -5,29 +5,21 @@ int main(int argc, const char* argv[]) { - if (argc < 2) { - std::cerr << "Need at least one argument" << std::endl; - return 1; - } - - const char* pSrc_filename = argv[1]; + const char* pSrc_filename = "non-real-file.jpg"; const int req_comps = 4; int width = 0, height = 0, actual_comps = 0; uint8_t* pImage_data = jpgd::decompress_jpeg_image_from_file(pSrc_filename, &width, &height, &actual_comps, req_comps); if (!pImage_data) { - std::cerr << "Failed loading file " << pSrc_filename << std::endl; - return EXIT_FAILURE; + std::cerr << "Test jpgd function" << std::endl;// Always displayed } int buf_size = width * height * 3; - if (buf_size < 1024) buf_size = 1024; void* pBuf = malloc(buf_size); if (!jpge::compress_image_to_jpeg_file_in_memory(pBuf, buf_size, width, height, req_comps, pImage_data)) { - std::cerr << "Failed creating JPEG data" << std::endl; - return EXIT_FAILURE; + std::cerr << "Test jpge function" << std::endl;// Always displayed } free(pBuf); diff --git a/recipes/jpeg-compressor/all/test_v1_package/conanfile.py b/recipes/jpeg-compressor/all/test_v1_package/conanfile.py index ff285a92f9ca9..38f4483872d47 100644 --- a/recipes/jpeg-compressor/all/test_v1_package/conanfile.py +++ b/recipes/jpeg-compressor/all/test_v1_package/conanfile.py @@ -14,5 +14,4 @@ def build(self): 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) + self.run(bin_path, run_environment=True) diff --git a/recipes/jsbsim/all/conandata.yml b/recipes/jsbsim/all/conandata.yml new file mode 100644 index 0000000000000..e42c1af7e0ef0 --- /dev/null +++ b/recipes/jsbsim/all/conandata.yml @@ -0,0 +1,15 @@ +sources: + "1.1.13": + url: "https://github.com/JSBSim-Team/jsbsim/archive/refs/tags/v1.1.13.tar.gz" + sha256: "e6cc167d4e7bb9d36e8cbb75bfaac270b15926e87367eebe9559e69ca32ad7e6" +patches: + "1.1.13": + - patch_file: "patches/1.1.13-0001-expat-link.patch" + patch_description: "CMake: fix link to expat" + patch_type: "conan" + - patch_file: "patches/1.1.13-0002-cmake-install.patch" + patch_description: "CMake: fix installation" + patch_type: "conan" + - patch_file: "patches/1.1.13-0003-fix-use-t-before-auto-deduction.patch" + patch_description: "Fix 'use of t before deduction of auto' in FGTable.cpp" + patch_type: "portability" diff --git a/recipes/jsbsim/all/conanfile.py b/recipes/jsbsim/all/conanfile.py new file mode 100644 index 0000000000000..048e4a19a18e0 --- /dev/null +++ b/recipes/jsbsim/all/conanfile.py @@ -0,0 +1,95 @@ +import os + +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 + +required_conan_version = ">=1.53.0" + + +class JsbsimConan(ConanFile): + name = "jsbsim" + description = ( + "JSBSim is a multi-platform, general purpose object-oriented " + "Flight Dynamics Model (FDM) written in C++" + ) + license = "LGPL-2.1-or-later" + topics = ("aircraft", "aerospace", "flight-dynamics", "flight-simulation") + homepage = "https://github.com/JSBSim-Team/jsbsim" + 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, + } + + @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("expat/[>=2.6.2 <3]") + + 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 generate(self): + tc = CMakeToolchain(self) + tc.variables["SYSTEM_EXPAT"] = True + tc.variables["BUILD_DOCS"] = False + tc.variables["BUILD_PYTHON_MODULE"] = False + tc.generate() + deps = CMakeDeps(self) + deps.set_property("expat", "cmake_file_name", "EXPAT") + deps.set_property("expat", "cmake_target_name", "EXPAT::EXPAT") + deps.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, "lib", "pkgconfig")) + + def package_info(self): + self.cpp_info.set_property("pkg_config_name", "JSBSim") + self.cpp_info.libs = ["JSBSim"] + self.cpp_info.includedirs = [os.path.join("include", "JSBSim")] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") + elif self.settings.os == "Windows": + self.cpp_info.system_libs.extend(["wsock32", "ws2_32"]) + if not self.options.shared: + self.cpp_info.defines.append("JSBSIM_STATIC_LINK") + + # TODO: to remove in conan v2 + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/jsbsim/all/patches/1.1.13-0001-expat-link.patch b/recipes/jsbsim/all/patches/1.1.13-0001-expat-link.patch new file mode 100644 index 0000000000000..422dcb5cbf527 --- /dev/null +++ b/recipes/jsbsim/all/patches/1.1.13-0001-expat-link.patch @@ -0,0 +1,28 @@ +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -65,12 +65,11 @@ add_library(libJSBSim ${HEADERS} ${SOURCES} + add_coverage(libJSBSim) + + if(EXPAT_FOUND) +- include_directories(${EXPAT_INCLUDE_DIRS}) +- if (PKG_CONFIG_FOUND) ++ if (0) + target_link_libraries(libJSBSim ${PC_EXPAT_LIBRARIES}) + set(ALL_LINK_LIBRARIES ${PC_EXPAT_LIBRARIES}) + else() +- target_link_libraries(libJSBSim ${EXPAT_LIBRARIES}) ++ target_link_libraries(libJSBSim EXPAT::EXPAT) + set(ALL_LINK_LIBRARIES ${EXPAT_LIBRARIES}) + endif() + else() +--- a/src/simgear/xml/CMakeLists.txt ++++ b/src/simgear/xml/CMakeLists.txt +@@ -28,5 +28,8 @@ endif() + add_library(Xml OBJECT ${HEADERS} ${SOURCES}) + set_target_properties(Xml PROPERTIES TARGET_DIRECTORY + ${CMAKE_CURRENT_SOURCE_DIR}) ++if(EXPAT_FOUND) ++ target_link_libraries(Xml EXPAT::EXPAT) ++endif() + + install(FILES ${HEADERS} DESTINATION include/JSBSim/simgear/xml COMPONENT devel) diff --git a/recipes/jsbsim/all/patches/1.1.13-0002-cmake-install.patch b/recipes/jsbsim/all/patches/1.1.13-0002-cmake-install.patch new file mode 100644 index 0000000000000..0f6fb6ace3ef3 --- /dev/null +++ b/recipes/jsbsim/all/patches/1.1.13-0002-cmake-install.patch @@ -0,0 +1,39 @@ +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -135,26 +135,12 @@ elseif(UNIX) + endforeach() + endif() + +-if(BUILD_SHARED_LIBS) + set_target_properties (libJSBSim PROPERTIES + SOVERSION ${LIBRARY_SOVERSION} +- FRAMEWORK ON) ++ ) + install(TARGETS libJSBSim LIBRARY DESTINATION lib +- NAMELINK_SKIP +- COMPONENT runtime +- # For Mac +- FRAMEWORK DESTINATION "/Library/Frameworks") +- install(TARGETS libJSBSim LIBRARY DESTINATION lib +- NAMELINK_ONLY +- COMPONENT devel +- # For Mac +- FRAMEWORK DESTINATION "/Library/Frameworks") +-else() +- install(TARGETS libJSBSim ARCHIVE DESTINATION lib +- COMPONENT devel +- # For Mac +- FRAMEWORK DESTINATION "/Library/Frameworks") +-endif() ++ ARCHIVE DESTINATION lib ++ RUNTIME DESTINATION bin) + + ################################################################################ + # Build and install command line executable # +--- a/utils/aeromatic++/CMakeLists.txt ++++ b/utils/aeromatic++/CMakeLists.txt +@@ -47,4 +47,3 @@ ADD_EXECUTABLE( aeromatic aeromatic.cpp ) + TARGET_LINK_LIBRARIES( aeromatic ${LIBAEROMATIC3} ${EXTRA_LIBS}) + + INSTALL(TARGETS aeromatic RUNTIME DESTINATION bin COMPONENT runtime) +-INSTALL(TARGETS ${LIBAEROMATIC3} ARCHIVE DESTINATION lib COMPONENT devel) diff --git a/recipes/jsbsim/all/patches/1.1.13-0003-fix-use-t-before-auto-deduction.patch b/recipes/jsbsim/all/patches/1.1.13-0003-fix-use-t-before-auto-deduction.patch new file mode 100644 index 0000000000000..958e041dc8752 --- /dev/null +++ b/recipes/jsbsim/all/patches/1.1.13-0003-fix-use-t-before-auto-deduction.patch @@ -0,0 +1,13 @@ +--- a/src/math/FGTable.cpp ++++ b/src/math/FGTable.cpp +@@ -87,8 +87,8 @@ FGTable::FGTable(const FGTable& t) + + // Deep copy of t.Tables + Tables.reserve(t.Tables.size()); +- for(const auto &t: t.Tables) +- Tables.push_back(std::unique_ptr(new FGTable(*t))); ++ for(const auto &table: t.Tables) ++ Tables.push_back(std::unique_ptr(new FGTable(*table))); + + Data = t.Data; + } diff --git a/recipes/jsbsim/all/test_package/CMakeLists.txt b/recipes/jsbsim/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..5ee8eae7c8e6f --- /dev/null +++ b/recipes/jsbsim/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(jsbsim REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE jsbsim::jsbsim) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/jsbsim/all/test_package/conanfile.py b/recipes/jsbsim/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0a6bc68712d90 --- /dev/null +++ b/recipes/jsbsim/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/jsbsim/all/test_package/test_package.cpp b/recipes/jsbsim/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..bd360361a7c3d --- /dev/null +++ b/recipes/jsbsim/all/test_package/test_package.cpp @@ -0,0 +1,7 @@ +#include + +int main() +{ + JSBSim::FGFDMExec FDMExec; + return 0; +} diff --git a/recipes/jsbsim/all/test_v1_package/CMakeLists.txt b/recipes/jsbsim/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/jsbsim/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/jsbsim/all/test_v1_package/conanfile.py b/recipes/jsbsim/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/jsbsim/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/jsbsim/config.yml b/recipes/jsbsim/config.yml new file mode 100644 index 0000000000000..26b3368e2a692 --- /dev/null +++ b/recipes/jsbsim/config.yml @@ -0,0 +1,3 @@ +versions: + "1.1.13": + folder: all diff --git a/recipes/jsmn/all/conanfile.py b/recipes/jsmn/all/conanfile.py index 80c11f45949cb..eff4b5d9d9571 100644 --- a/recipes/jsmn/all/conanfile.py +++ b/recipes/jsmn/all/conanfile.py @@ -16,6 +16,7 @@ class JsmnConan(ConanFile): topics = ("json", "parser") homepage = "https://github.com/zserge/jsmn" url = "https://github.com/conan-io/conan-center-index" + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -26,8 +27,7 @@ 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 diff --git a/recipes/json-c/all/conandata.yml b/recipes/json-c/all/conandata.yml index 7ed706059e17c..71904777ad4e0 100644 --- a/recipes/json-c/all/conandata.yml +++ b/recipes/json-c/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "0.18": + url: "https://github.com/json-c/json-c/archive/json-c-0.18-20240915.tar.gz" + sha256: "3112c1f25d39eca661fe3fc663431e130cc6e2f900c081738317fba49d29e298" + "0.17": + url: "https://github.com/json-c/json-c/archive/json-c-0.17-20230812.tar.gz" + sha256: "024d302a3aadcbf9f78735320a6d5aedf8b77876c8ac8bbb95081ca55054c7eb" "0.16": url: "https://github.com/json-c/json-c/archive/json-c-0.16-20220414.tar.gz" sha256: "3ecaeedffd99a60b1262819f9e60d7d983844073abc74e495cb822b251904185" diff --git a/recipes/json-c/all/conanfile.py b/recipes/json-c/all/conanfile.py index 7bdf4d8251e6d..20358585918dc 100644 --- a/recipes/json-c/all/conanfile.py +++ b/recipes/json-c/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 collect_libs, copy, get, rmdir +from conan.tools.files import copy, get, rmdir from conan.tools.scm import Version import os -required_conan_version = ">=1.53.0" +required_conan_version = ">=1.54.0" class JSONCConan(ConanFile): name = "json-c" - description = "JSON-C - A JSON implementation in C" - topics = ("json-c", "json", "encoding", "decoding", "manipulation") + description = "A JSON implementation in C" + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/json-c/json-c" - license = "MIT" + topics = ("json", "encoding", "decoding", "manipulation") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -39,8 +40,7 @@ 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) @@ -49,8 +49,6 @@ def generate(self): tc.variables["DISABLE_STATIC_FPIC"] = not self.options.get_safe("fPIC", True) # 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): @@ -66,7 +64,12 @@ def package(self): rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): + self.cpp_info.libs = ["json-c"] + self.cpp_info.set_property("cmake_file_name", "json-c") self.cpp_info.set_property("cmake_target_name", "json-c::json-c") self.cpp_info.set_property("pkg_config_name", "json-c") - self.cpp_info.libs = collect_libs(self) + self.cpp_info.includedirs = ["include", os.path.join("include", "json-c")] + + if Version(self.version) >= "0.17" and self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["m",]) diff --git a/recipes/json-c/config.yml b/recipes/json-c/config.yml index 1e4023fe84046..0a8630e20d06f 100644 --- a/recipes/json-c/config.yml +++ b/recipes/json-c/config.yml @@ -1,4 +1,8 @@ versions: + "0.18": + folder: all + "0.17": + folder: all "0.16": folder: all "0.15": diff --git a/recipes/json-schema-validator/all/conandata.yml b/recipes/json-schema-validator/all/conandata.yml index 122476811e03f..3c6f2f96fc4ed 100644 --- a/recipes/json-schema-validator/all/conandata.yml +++ b/recipes/json-schema-validator/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.3.0": + url: "https://github.com/pboettch/json-schema-validator/archive/refs/tags/2.3.0.tar.gz" + sha256: "2c00b50023c7d557cdaa71c0777f5bcff996c4efd7a539e58beaa4219fa2a5e1" "2.2.0": url: "https://github.com/pboettch/json-schema-validator/archive/refs/tags/2.2.0.tar.gz" sha256: "03897867bd757ecac1db7545babf0c6c128859655b496582a9cea4809c2260aa" diff --git a/recipes/json-schema-validator/all/conanfile.py b/recipes/json-schema-validator/all/conanfile.py index c9901f8fafff9..312888fba61cb 100644 --- a/recipes/json-schema-validator/all/conanfile.py +++ b/recipes/json-schema-validator/all/conanfile.py @@ -1,7 +1,10 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools import build, files, microsoft, scm +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 +from conan.tools.scm import Version import os import textwrap @@ -10,27 +13,48 @@ class JsonSchemaValidatorConan(ConanFile): name = "json-schema-validator" + description = "JSON schema validator for JSON for Modern C++" license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/pboettch/json-schema-validator" - description = "JSON schema validator for JSON for Modern C++ " - topics = ("json-schema-validator", "modern-json", - "schema-validation", "json") - + topics = ("modern-json", "schema-validation", "json") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], + "json_diagnostics": [True, False], + } + options_description = { + "json_diagnostics": ( + "Defines JSON_DIAGNOSTICS=1 for the nlohmann_json library. " + "Refer https://json.nlohmann.me/api/macros/json_diagnostics/ " + "This macro enables extended diagnostics for exception messages." + ) } default_options = { "shared": False, "fPIC": True, + "json_diagnostics": False, } - short_paths = True + @property + def _min_cppstd(self): + return "17" if is_msvc(self) and Version(self.version) < "2.1.0" else "11" + + @property + def _compilers_minimum_version(self): + return { + "Visual Studio": "15" if Version(self.version) < "2.1.0" else "14", + "msvc": "191" if Version(self.version) < "2.1.0" else "190", + "gcc": "5" if Version(self.version) < "2.1.0" else "4.9", + "clang": "4", + "apple-clang": "9" + } + def export_sources(self): - files.export_conandata_patches(self) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -40,65 +64,64 @@ def configure(self): if self.options.shared: self.options.rm_safe("fPIC") - def requirements(self): - self.requires("nlohmann_json/3.11.2", transitive_headers=True) + def layout(self): + cmake_layout(self, src_folder="src") - def validate(self): - version = scm.Version(self.version) - min_vs_version = "16" if version < "2.1.0" else "14" - 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 = { - "Visual Studio": min_vs_version, - "gcc": "5" if version < "2.1.0" else "4.9", - "clang": "4", - "apple-clang": "9"} - min_version = compilers.get(str(self.info.settings.compiler)) - if not min_version: - self.output.warn(f"{self.name} recipe lacks information about the {self.info.settings.compiler} compiler support.") + def requirements(self): + # to support latest compilers, we have to downgrade nlohmann_json. + # https://github.com/pboettch/json-schema-validator/pull/276 + if Version(self.version) < "2.3.0": + self.requires("nlohmann_json/3.10.5", transitive_headers=True) else: - 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.") + self.requires("nlohmann_json/3.11.3", transitive_headers=True) - 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): - files.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) - if scm.Version(self.version) < "2.2.0": + if 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.variables["JSON_VALIDATOR_INSTALL"] = True + tc.variables["JSON_VALIDATOR_SHARED_LIBS"] = self.options.shared + tc.variables["CMAKE_INSTALL_RUNTIMEDIR"] = "bin" + if self.options.json_diagnostics: + tc.preprocessor_definitions["JSON_DIAGNOSTICS"] = '1' + if Version(self.version) < "2.1.0": + nlohmann_json_includedirs = self.dependencies["nlohmann_json"].cpp_info.aggregated_components().includedirs + tc.variables["NLOHMANN_JSON_DIR"] = ";".join([p.replace("\\", "/") for p in nlohmann_json_includedirs]) tc.generate() deps = CMakeDeps(self) deps.generate() def build(self): - files.apply_conandata_patches(self) + apply_conandata_patches(self) cmake = CMake(self) cmake.configure() cmake.build() def package(self): - files.copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) cmake = CMake(self) cmake.install() - if scm.Version(self.version) < "2.1.0": - files.copy(self, "json-schema.hpp", + if Version(self.version) < "2.1.0": + 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")) + 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( @@ -109,13 +132,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)) - files.save(self, module_file, content) + """) + save(self, module_file, content) @property def _module_file_rel_path(self): @@ -124,10 +147,14 @@ def _module_file_rel_path(self): 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 scm.Version(self.version) < "2.1.0" else "nlohmann_json_schema_validator"] + self.cpp_info.libs = ["json-schema-validator" if Version(self.version) < "2.1.0" else "nlohmann_json_schema_validator"] + if self.options.json_diagnostics: + self.cpp_info.defines = ["JSON_DIAGNOSTICS=1"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("m") + elif self.settings.os == "Windows" and self.options.shared: + self.cpp_info.defines.append("JSON_SCHEMA_VALIDATOR_EXPORTS=1") # 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/test_package/CMakeLists.txt b/recipes/json-schema-validator/all/test_package/CMakeLists.txt index c2d764c121782..193d69ef33260 100644 --- a/recipes/json-schema-validator/all/test_package/CMakeLists.txt +++ b/recipes/json-schema-validator/all/test_package/CMakeLists.txt @@ -4,5 +4,5 @@ project(test_package LANGUAGES CXX) find_package(nlohmann_json_schema_validator CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} nlohmann_json_schema_validator) +target_link_libraries(${PROJECT_NAME} PRIVATE nlohmann_json_schema_validator) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/json-schema-validator/config.yml b/recipes/json-schema-validator/config.yml index ddf20dd4ca819..3d204ba702a0b 100644 --- a/recipes/json-schema-validator/config.yml +++ b/recipes/json-schema-validator/config.yml @@ -1,4 +1,6 @@ versions: + "2.3.0": + folder: all "2.2.0": folder: all "2.1.0": diff --git a/recipes/json_dto/all/conandata.yml b/recipes/json_dto/all/conandata.yml index 3d6e5b35876d7..504fe8367f255 100644 --- a/recipes/json_dto/all/conandata.yml +++ b/recipes/json_dto/all/conandata.yml @@ -1,22 +1,22 @@ sources: - "0.2.11": - url: "https://github.com/Stiffstream/json_dto/archive/v.0.2.11.tar.gz" - sha256: "9ce409a8210ee78ef5b1e60dfb919186ba6a2e928e391e46f0e1d36049e06b1c" - "0.2.12": - url: "https://github.com/Stiffstream/json_dto/archive/v.0.2.12.tar.gz" - sha256: "3b1ca412a74c339c01bcbf739542fa69b2391d24c321742098a2d6dfa7402d84" - "0.2.13": - url: "https://github.com/Stiffstream/json_dto/archive/v.0.2.13.tar.gz" - sha256: "ed4138bf86e0724c95508a9c74bed6fa0c98814b96f4cb3a1b540857e2302663" - "0.2.14": - url: "https://github.com/Stiffstream/json_dto/archive/v.0.2.14.tar.gz" - sha256: "d885fe16cf621f7470a45fb6e955e8aded02958bb2212819dc151feac930905b" - "0.2.15": - url: "https://github.com/Stiffstream/json_dto/archive/v.0.2.15.tar.gz" - sha256: "d7631d21785ddddc81b2fe04a7998d0d49323c2224168568cb80cc32093da3ac" - "0.3.0": - url: "https://github.com/Stiffstream/json_dto/archive/v.0.3.0.tar.gz" - sha256: "cd497c9ee5556c45aaa3402a23ab935e6a90c1e62076562efd0708d1ec8f4c30" + "0.3.4": + url: "https://github.com/Stiffstream/json_dto/archive/refs/tags/v.0.3.4.tar.gz" + sha256: "1b9595dbd86fa90edf621b72f5f4dac43170339250e9e650ede5269ff6fa3f2e" + "0.3.3": + url: "https://github.com/Stiffstream/json_dto/archive/refs/tags/v.0.3.3.tar.gz" + sha256: "c52857c074f4e204426a52160e2699694c45bb93e9297ca535e2d5fdf54ae187" + "0.3.2": + url: "https://github.com/Stiffstream/json_dto/archive/refs/tags/v.0.3.2.tar.gz" + sha256: "425d31c06c4e7f82d6414969fcdeaccb95ab44063c08296984ea0703de445744" "0.3.1": - url: "https://github.com/Stiffstream/json_dto/archive/v.0.3.1.tar.gz" + url: "https://github.com/Stiffstream/json_dto/archive/refs/tags/v.0.3.1.tar.gz" sha256: "515a2d1510d3d8f8b240eb2149f44aeb47a70d26a7071609cca45c0ee198d1d1" + "0.3.0": + url: "https://github.com/Stiffstream/json_dto/archive/refs/tags/v.0.3.0.tar.gz" + sha256: "cd497c9ee5556c45aaa3402a23ab935e6a90c1e62076562efd0708d1ec8f4c30" + "0.2.15": + url: "https://github.com/Stiffstream/json_dto/archive/refs/tags/v.0.2.15.tar.gz" + sha256: "d7631d21785ddddc81b2fe04a7998d0d49323c2224168568cb80cc32093da3ac" + "0.2.14": + url: "https://github.com/Stiffstream/json_dto/archive/refs/tags/v.0.2.14.tar.gz" + sha256: "d885fe16cf621f7470a45fb6e955e8aded02958bb2212819dc151feac930905b" diff --git a/recipes/json_dto/all/conanfile.py b/recipes/json_dto/all/conanfile.py index ee89f2d2edf51..ce69026f02b64 100644 --- a/recipes/json_dto/all/conanfile.py +++ b/recipes/json_dto/all/conanfile.py @@ -1,66 +1,79 @@ -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 JsonDtoConan(ConanFile): name = "json_dto" + description = "A small header-only helper for converting data between json representation and c++ structs" license = "BSD-3-Clause" - homepage = "https://github.com/Stiffstream/json_dto" url = "https://github.com/conan-io/conan-center-index" - description = "A small header-only helper for converting data between json representation and c++ structs" - topics = ("json", "dto", "serialization") - settings = "os", "compiler", "build_type", "arch" + homepage = "https://github.com/Stiffstream/json_dto" + topics = ("json", "dto", "serialization", "header-only") + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 14 - def requirements(self): - self.requires("rapidjson/1.1.0") - - 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") 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." + ) + # several gcc doesn't allow "this" in noexcept clauses due to bug. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100752 + if Version(self.version) >= "0.3.2" and \ + self.settings.compiler == "gcc" and \ + (Version(self.settings.compiler.version) < "9.0" or Version(self.settings.compiler.version).major == 11): + raise ConanInvalidConfiguration(f"{self.ref} requires gcc 9, 10 or 12 later") 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", 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/CMakeLists.txt b/recipes/json_dto/all/test_package/CMakeLists.txt index 45401a5b844ae..b20143685a5e9 100644 --- a/recipes/json_dto/all/test_package/CMakeLists.txt +++ b/recipes/json_dto/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(PackageTest CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) find_package(json-dto REQUIRED CONFIG) -add_executable(example example.cpp) -target_link_libraries(example json-dto::json-dto) -set_property(TARGET example PROPERTY CXX_STANDARD 14) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE json-dto::json-dto) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/json_dto/all/test_package/conanfile.py b/recipes/json_dto/all/test_package/conanfile.py index 21d7adcc4bb1c..81d4d29e64c73 100644 --- a/recipes/json_dto/all/test_package/conanfile.py +++ b/recipes/json_dto/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 JsondtoTestConan(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) @@ -13,6 +22,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/json_dto/all/test_package/example.cpp b/recipes/json_dto/all/test_package/example.cpp deleted file mode 100644 index 166e1da61969e..0000000000000 --- a/recipes/json_dto/all/test_package/example.cpp +++ /dev/null @@ -1,75 +0,0 @@ -#include -#include -#include - -#include - -// Message. -struct message_t -{ - message_t() {} - - message_t( - std::string from, - std::int64_t when, - std::string text ) - : m_from{ std::move( from ) } - , m_when{ when } - , m_text{ std::move( text ) } - {} - - // Who sent a message. - std::string m_from; - // When the message was sent (unixtime). - std::int64_t m_when; - // Message text. - std::string m_text; - - template< typename Json_Io > - void json_io( Json_Io & io ) - { - io & json_dto::mandatory( "from", m_from ) - & json_dto::mandatory( "when", m_when ) - & json_dto::mandatory( "text", m_text ); - } -}; - -const std::string json_data{ -R"JSON({ - "from" : "json_dto", - "when" : 1474884330, - "text" : "Hello world!" -})JSON" }; - -int -main( int , char *[] ) -{ - try - { - { - auto msg = json_dto::from_json< message_t >( json_data ); - - const auto t = static_cast< std::time_t >( msg.m_when ); - std::cout - << "Deserialized from JSON:\n" - << "\tfrom: " << msg.m_from << "\n" - << "\twhen: " << std::ctime( &t ) - << "\ttext: " << msg.m_text << std::endl; - } - - { - const message_t msg{ "json_dto", std::time( nullptr ), "Hello once again!" }; - - std::cout - << "\nSerialized to JSON:\n" - << json_dto::to_json( msg ) << std::endl; - } - } - catch( const std::exception & ex ) - { - std::cerr << "Error: " << ex.what() << "." << std::endl; - return 1; - } - - return 0; -} diff --git a/recipes/json_dto/all/test_package/test_package.cpp b/recipes/json_dto/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..959a2eed78a41 --- /dev/null +++ b/recipes/json_dto/all/test_package/test_package.cpp @@ -0,0 +1,76 @@ +#include +#include +#include + +#include +#include + +// Message. +struct message_t +{ + message_t() {} + + message_t( + std::string from, + std::int64_t when, + std::string text ) + : m_from{ std::move( from ) } + , m_when{ when } + , m_text{ std::move( text ) } + {} + + // Who sent a message. + std::string m_from; + // When the message was sent (unixtime). + std::int64_t m_when; + // Message text. + std::string m_text; + + template< typename Json_Io > + void json_io( Json_Io & io ) + { + io & json_dto::mandatory( "from", m_from ) + & json_dto::mandatory( "when", m_when ) + & json_dto::mandatory( "text", m_text ); + } +}; + +const std::string json_data{ +R"JSON({ + "from" : "json_dto", + "when" : 1474884330, + "text" : "Hello world!" +})JSON" }; + +int +main( int , char *[] ) +{ + try + { + { + auto msg = json_dto::from_json< message_t >( json_data ); + + const auto t = static_cast< std::time_t >( msg.m_when ); + std::cout + << "Deserialized from JSON:\n" + << "\tfrom: " << msg.m_from << "\n" + << "\twhen: " << std::ctime( &t ) + << "\ttext: " << msg.m_text << std::endl; + } + + { + const message_t msg{ "json_dto", std::time( nullptr ), "Hello once again!" }; + + std::cout + << "\nSerialized to JSON:\n" + << json_dto::to_json( msg ) << std::endl; + } + } + catch( const std::exception & ex ) + { + std::cerr << "Error: " << ex.what() << "." << std::endl; + return 1; + } + + return 0; +} diff --git a/recipes/json_dto/all/test_v1_package/CMakeLists.txt b/recipes/json_dto/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..b21cc49efde95 --- /dev/null +++ b/recipes/json_dto/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/json_dto/all/test_v1_package/conanfile.py b/recipes/json_dto/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/json_dto/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_dto/config.yml b/recipes/json_dto/config.yml index 464caddcd4136..78d5c217becaf 100644 --- a/recipes/json_dto/config.yml +++ b/recipes/json_dto/config.yml @@ -1,15 +1,15 @@ versions: - "0.2.11": + "0.3.4": folder: all - "0.2.12": + "0.3.3": folder: all - "0.2.13": + "0.3.2": folder: all - "0.2.14": - folder: all - "0.2.15": + "0.3.1": folder: all "0.3.0": folder: all - "0.3.1": + "0.2.15": + folder: all + "0.2.14": folder: all diff --git a/recipes/json_struct/all/conandata.yml b/recipes/json_struct/all/conandata.yml new file mode 100644 index 0000000000000..31102ff6a0fa4 --- /dev/null +++ b/recipes/json_struct/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.0.2": + url: "https://github.com/jorgen/json_struct/archive/refs/tags/1.0.2.tar.gz" + sha256: "c424ae3e8dbe6846311cb878d2d400c98a297a28eb1556961a985b6ed7b16090" diff --git a/recipes/json_struct/all/conanfile.py b/recipes/json_struct/all/conanfile.py new file mode 100644 index 0000000000000..b269918faa003 --- /dev/null +++ b/recipes/json_struct/all/conanfile.py @@ -0,0 +1,42 @@ +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 JsonStructConan(ConanFile): + name = "json_struct" + description = "json_struct is a single header only C++ library for parsing JSON directly to C++ structs and vice versa" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/jorgen/json_struct" + + topics = ("serialization", "deserialization", "reflection", "json") + + settings = "os", "compiler", "build_type", "arch" + package_type = "header-library" + no_copy_source = True + + def validate(self): + check_min_cppstd(self, 14) + + def layout(self): + basic_layout(self, src_folder="src") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def package_id(self): + self.info.clear() + + # Copy all files to the package folder + def package(self): + copy(self, "COPYING", self.source_folder, os.path.join(self.package_folder, "licenses")) + copy( + self, + "*.h", + os.path.join(self.source_folder, "include"), + os.path.join(self.package_folder, "include"), + ) diff --git a/recipes/json_struct/all/test_package/CMakeLists.txt b/recipes/json_struct/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..2c8c0eb28ba17 --- /dev/null +++ b/recipes/json_struct/all/test_package/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.15) + +project(JsonStructTester + DESCRIPTION "Tester package for json_struct" + LANGUAGES C CXX) + +find_package(json_struct REQUIRED) + +add_executable(${PROJECT_NAME} main.cpp) + +target_link_libraries(${PROJECT_NAME} json_struct::json_struct) +target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_14) diff --git a/recipes/json_struct/all/test_package/conanfile.py b/recipes/json_struct/all/test_package/conanfile.py new file mode 100644 index 0000000000000..f0d4e6b76d579 --- /dev/null +++ b/recipes/json_struct/all/test_package/conanfile.py @@ -0,0 +1,28 @@ +import os + +from conan import ConanFile +from conan.tools.cmake import CMake, cmake_layout +from conan.tools.build import can_run + + +class JsonStructTest(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "CMakeDeps", "CMakeToolchain" + + 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 can_run(self): + self.output.info("Checking compiled tester...") + cmd = os.path.join(self.cpp.build.bindir, "JsonStructTester") + self.run(cmd, env="conanrun") + diff --git a/recipes/json_struct/all/test_package/main.cpp b/recipes/json_struct/all/test_package/main.cpp new file mode 100644 index 0000000000000..a61797c693d60 --- /dev/null +++ b/recipes/json_struct/all/test_package/main.cpp @@ -0,0 +1,21 @@ +#include "json_struct/json_struct.h" +#include + +struct MyTestStruct +{ + std::string name; + unsigned age; + JS_OBJ(name, age); +}; + +int main() +{ + MyTestStruct person; + person.name="Jonh"; + person.age=23; + + std::string person_json = JS::serializeStruct(person); + std::cout << person_json << std::endl; + + return 0; +} diff --git a/recipes/json_struct/config.yml b/recipes/json_struct/config.yml new file mode 100644 index 0000000000000..8457ca9a4a8cd --- /dev/null +++ b/recipes/json_struct/config.yml @@ -0,0 +1,3 @@ +versions: + "1.0.2": + folder: all diff --git a/recipes/jsoncons/all/conandata.yml b/recipes/jsoncons/all/conandata.yml new file mode 100644 index 0000000000000..fa96f6778d1c7 --- /dev/null +++ b/recipes/jsoncons/all/conandata.yml @@ -0,0 +1,37 @@ +sources: + "0.178.0": + url: "https://github.com/danielaparker/jsoncons/archive/refs/tags/v0.178.0.tar.gz" + sha256: "c531b4288bb08c9c2b36fba53f568bc800e93656830bcffc18a87a3af1f46290" + "0.177.0": + url: "https://github.com/danielaparker/jsoncons/archive/refs/tags/v0.177.0.tar.gz" + sha256: "a381d58489f143a3a515484f4ad6e32ae4d977033e1a455fecf8cdc4e2c9a49e" + "0.176.0": + url: "https://github.com/danielaparker/jsoncons/archive/refs/tags/v0.176.0.tar.gz" + sha256: "2eb50b5cbe204265fef96c052511ed6e3b8808935c6e2c8d28e0aba7b08fda33" + "0.175.0": + url: "https://github.com/danielaparker/jsoncons/archive/refs/tags/v0.175.0.tar.gz" + sha256: "7f8a04cfd25a73d2ba2283be8eb98a39780df1e90600d8c75ddf19d52bd2c2c9" + "0.174.0": + url: "https://github.com/danielaparker/jsoncons/archive/refs/tags/v0.174.0.tar.gz" + sha256: "60507721a26c752c71fbb228568f7944ea3fd287e9b179a9128ca32d7ddbb386" + "0.173.4": + url: "https://github.com/danielaparker/jsoncons/archive/refs/tags/v0.173.4.tar.gz" + sha256: "3e3525325c88b33f15af2e1f3cf7a1893a49e47aa787a2df723a098b3a4b20b1" + "0.173.3": + url: "https://github.com/danielaparker/jsoncons/archive/refs/tags/v0.173.3.tar.gz" + sha256: "2b5796e8f681ce9253fb5863d695ecb1cebc7092596af01ce4fca0e5e245b7be" + "0.173.2": + url: "https://github.com/danielaparker/jsoncons/archive/refs/tags/v0.173.2.tar.gz" + sha256: "c689e9275fe428abf2914e4588321ed0fa756cce6448af94fbd625eb0a618a57" + "0.173.0": + url: "https://github.com/danielaparker/jsoncons/archive/refs/tags/v0.173.0.tar.gz" + sha256: "61abb5e4fbdb3ef7601b4fdc263bc806785609c47b4d7e81f8c3110bd53a9282" + "0.172.1": + url: "https://github.com/danielaparker/jsoncons/archive/refs/tags/v0.172.1.tar.gz" + sha256: "710ac7656373a118cee4ad10ecb2225d331ca5b4706a4add3a2b482b7fceef1f" + "0.172.0": + url: "https://github.com/danielaparker/jsoncons/archive/refs/tags/v0.172.0.tar.gz" + sha256: "a0b9f8c9afcfc30993bc9122a659e3790351b621c354e5dee09dd7c53665df14" + "0.171.1": + url: "https://github.com/danielaparker/jsoncons/archive/refs/tags/v0.171.1.tar.gz" + sha256: "e84d71bcf7c78f21de8bbd88a8da6f6afa458f562f6b846ef51f1aa5697ad904" diff --git a/recipes/jsoncons/all/conanfile.py b/recipes/jsoncons/all/conanfile.py new file mode 100644 index 0000000000000..54b1abb2a2c3e --- /dev/null +++ b/recipes/jsoncons/all/conanfile.py @@ -0,0 +1,76 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +import os + +required_conan_version = ">=1.50.0" + + +class JsonconsConan(ConanFile): + name = "jsoncons" + description = "A C++, header-only library for constructing JSON and JSON-like data formats, with JSON Pointer, JSON Patch, JSON Schema, JSONPath, JMESPath, CSV, MessagePack, CBOR, BSON, UBJSON" + license = "BSL-1.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/danielaparker/jsoncons" + topics = ( + "json", "csv", "json-serialization", "cbor", "json-parser", + "messagepack", "json-pointer", "json-patch", "json-diff", "bson", + "ubjson", "json-parsing", "jsonpath", "jmespath", "csv-parser", + "csv-reader", "jsonschema", "json-construction", "streaming-json-read", + "header-only", + ) + pckage_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _min_cppstd(self): + return "11" if Version(self.version) < "0.172.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 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._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", 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.bindirs = [] + self.cpp_info.libdirs = [] + + self.cpp_info.set_property("cmake_file_name", "jsoncons") + self.cpp_info.set_property("cmake_target_name", "jsoncons") + + # TODO: to remove in conan v2 once cmake_find_package* generators removed + self.cpp_info.names["cmake_find_package"] = "jsoncons" + self.cpp_info.names["cmake_find_package_multi"] = "jsoncons" diff --git a/recipes/jsoncons/all/test_package/CMakeLists.txt b/recipes/jsoncons/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..067c8673df55b --- /dev/null +++ b/recipes/jsoncons/all/test_package/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(jsoncons CONFIG REQUIRED) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE jsoncons) +if(jsoncons_VERSION VERSION_LESS "0.172.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/jsoncons/all/test_package/conanfile.py b/recipes/jsoncons/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a803ae0923ba5 --- /dev/null +++ b/recipes/jsoncons/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): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/jsoncons/all/test_package/test_package.cpp b/recipes/jsoncons/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..c0ab09763124a --- /dev/null +++ b/recipes/jsoncons/all/test_package/test_package.cpp @@ -0,0 +1,49 @@ +#include +#include +#include + +using namespace jsoncons; // for convenience + +std::string data = R"( + { + "application": "hiking", + "reputons": [ + { + "rater": "HikingAsylum", + "assertion": "advanced", + "rated": "Marilyn C", + "rating": 0.90, + "generated": 1514862245 + } + ] + } +)"; + +int main() +{ + // Parse the string of data into a json value + json j = json::parse(data); + + // Does object member reputons exist? + std::cout << "(1) " << std::boolalpha << j.contains("reputons") << "\n\n"; + + // Get a reference to reputons array + const json& v = j["reputons"]; + + // Iterate over reputons array + std::cout << "(2)\n"; + for (const auto& item : v.array_range()) + { + // Access rated as string and rating as double + std::cout << item["rated"].as() << ", " << item["rating"].as() << "\n"; + } + std::cout << "\n"; + + // Select all "rated" with JSONPath + std::cout << "(3)\n"; + json result = jsonpath::json_query(j,"$..rated"); + std::cout << pretty_print(result) << "\n\n"; + + // Serialize back to JSON + std::cout << "(4)\n" << pretty_print(j) << "\n\n"; +} diff --git a/recipes/jsoncons/all/test_v1_package/CMakeLists.txt b/recipes/jsoncons/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..a5743e33125cd --- /dev/null +++ b/recipes/jsoncons/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(jsoncons CONFIG REQUIRED) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE jsoncons::jsoncons) +if(jsoncons_VERSION VERSION_LESS "0.172.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/jsoncons/all/test_v1_package/conanfile.py b/recipes/jsoncons/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..8037a9296cc42 --- /dev/null +++ b/recipes/jsoncons/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/jsoncons/config.yml b/recipes/jsoncons/config.yml new file mode 100644 index 0000000000000..bfd0d8f2ead05 --- /dev/null +++ b/recipes/jsoncons/config.yml @@ -0,0 +1,25 @@ +versions: + "0.178.0": + folder: "all" + "0.177.0": + folder: "all" + "0.176.0": + folder: "all" + "0.175.0": + folder: "all" + "0.174.0": + folder: "all" + "0.173.4": + folder: "all" + "0.173.3": + folder: "all" + "0.173.2": + folder: "all" + "0.173.0": + folder: "all" + "0.172.1": + folder: "all" + "0.172.0": + folder: "all" + "0.171.1": + folder: "all" diff --git a/recipes/jsoncpp/all/conandata.yml b/recipes/jsoncpp/all/conandata.yml index b5b4f5372dd99..8973aaac6a3fe 100644 --- a/recipes/jsoncpp/all/conandata.yml +++ b/recipes/jsoncpp/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.9.6": + url: https://github.com/open-source-parsers/jsoncpp/archive/1.9.6.tar.gz + sha256: f93b6dd7ce796b13d02c108bc9f79812245a82e577581c4c9aabe57075c90ea2 "1.9.5": url: https://github.com/open-source-parsers/jsoncpp/archive/1.9.5.tar.gz sha256: f409856e5920c18d0c2fb85276e24ee607d2a09b5e7d5f0a371368903c275da2 diff --git a/recipes/jsoncpp/all/conanfile.py b/recipes/jsoncpp/all/conanfile.py index 99b1d8ec06857..dc347bac0be0d 100644 --- a/recipes/jsoncpp/all/conanfile.py +++ b/recipes/jsoncpp/all/conanfile.py @@ -2,6 +2,7 @@ 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, save from conan.tools.scm import Version +from conan.tools.microsoft import is_msvc import os import textwrap @@ -10,12 +11,12 @@ class JsoncppConan(ConanFile): name = "jsoncpp" + description = "A C++ library for interacting with JSON." license = "MIT" - homepage = "https://github.com/open-source-parsers/jsoncpp" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/open-source-parsers/jsoncpp" topics = ("json", "parser", "config") - description = "A C++ library for interacting with JSON." - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -41,8 +42,7 @@ 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) @@ -70,7 +70,7 @@ def generate(self): def _patch_sources(self): apply_conandata_patches(self) - 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()") @@ -123,6 +123,8 @@ def package_info(self): 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] diff --git a/recipes/jsoncpp/config.yml b/recipes/jsoncpp/config.yml index e11b41080c02a..f4837dd548b8a 100644 --- a/recipes/jsoncpp/config.yml +++ b/recipes/jsoncpp/config.yml @@ -1,4 +1,6 @@ versions: + "1.9.6": + folder: all "1.9.5": folder: all "1.9.4": diff --git a/recipes/jsonifier/all/conandata.yml b/recipes/jsonifier/all/conandata.yml new file mode 100644 index 0000000000000..d326552c7b2a5 --- /dev/null +++ b/recipes/jsonifier/all/conandata.yml @@ -0,0 +1,10 @@ +sources: + "0.9.97": + url: "https://github.com/RealTimeChris/Jsonifier/archive/refs/tags/v0.9.97.tar.gz" + sha256: "68828c982a994862b02bcee562ee4e6d7cc461013ac3d4dcb98c0f1581049924" + "0.9.96": + url: "https://github.com/RealTimeChris/Jsonifier/archive/refs/tags/v0.9.96.tar.gz" + sha256: "9f2658282f53680be0121091adacc8f82b2de5b95c31bc6eadb98802c0aa59f0" + "0.9.95": + url: "https://github.com/RealTimeChris/Jsonifier/archive/refs/tags/v0.9.95.tar.gz" + sha256: "4db5fd2c4ae77bbd13e4f80fcc255edb39835cb5cf00d33468cb957af04d933b" diff --git a/recipes/jsonifier/all/conanfile.py b/recipes/jsonifier/all/conanfile.py new file mode 100644 index 0000000000000..5dcf12ea3c5b0 --- /dev/null +++ b/recipes/jsonifier/all/conanfile.py @@ -0,0 +1,72 @@ +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 JsonifierConan(ConanFile): + name = "jsonifier" + description = "A few classes for parsing and serializing objects from/into JSON - very rapidly." + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/RealTimeChris/Jsonifier" + topics = ("serialization", "json", "simd", "parswer", "header-only") + package_type = "header-library" + 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": "12", + "clang": "17", + "apple-clang": "14", + "Visual Studio": "17", + "msvc": "193", + } + + def layout(self): + cmake_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 generate(self): + tc = CMakeToolchain(self) + 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, "share")) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/jsonifier/all/test_package/CMakeLists.txt b/recipes/jsonifier/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..386a7df4b60c0 --- /dev/null +++ b/recipes/jsonifier/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) + +project(test_package LANGUAGES CXX) +find_package(jsonifier REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE jsonifier::jsonifier) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) diff --git a/recipes/jsonifier/all/test_package/conanfile.py b/recipes/jsonifier/all/test_package/conanfile.py new file mode 100644 index 0000000000000..ef5d7042163ec --- /dev/null +++ b/recipes/jsonifier/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/jsonifier/all/test_package/test_package.cpp b/recipes/jsonifier/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..21035cf3ed4c1 --- /dev/null +++ b/recipes/jsonifier/all/test_package/test_package.cpp @@ -0,0 +1,25 @@ +#include +#include + +#include "jsonifier/Index.hpp" + +struct MyObject { + std::string name; + int age; +}; + +template<> struct jsonifier::core { + using value_type = MyObject; + static constexpr auto parseValue = createValue("name", &value_type::name, "age", &value_type::age); +}; + +int main() { + MyObject obj("John", 30); + jsonifier::jsonifier_core jsonifier{}; + std::string jsonBuffer{}; + jsonifier.serializeJson(obj, jsonBuffer); + + std::cout << jsonBuffer << std::endl; + + return 0; +} diff --git a/recipes/jsonifier/config.yml b/recipes/jsonifier/config.yml new file mode 100644 index 0000000000000..f8a1d2a6df61b --- /dev/null +++ b/recipes/jsonifier/config.yml @@ -0,0 +1,7 @@ +versions: + "0.9.97": + folder: all + "0.9.96": + folder: all + "0.9.95": + folder: all diff --git a/recipes/jsonnet/all/CMakeLists.txt b/recipes/jsonnet/all/CMakeLists.txt deleted file mode 100644 index 881b1cb39250b..0000000000000 --- a/recipes/jsonnet/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/jsonnet/all/conandata.yml b/recipes/jsonnet/all/conandata.yml index af6fab5053143..260d7031fb23c 100644 --- a/recipes/jsonnet/all/conandata.yml +++ b/recipes/jsonnet/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.20.0": + url: "https://github.com/google/jsonnet/archive/v0.20.0.tar.gz" + sha256: "77bd269073807731f6b11ff8d7c03e9065aafb8e4d038935deb388325e52511b" "0.19.1": url: "https://github.com/google/jsonnet/archive/v0.19.1.tar.gz" sha256: "f5a20f2dc98fdebd5d42a45365f52fa59a7e6b174e43970fea4f9718a914e887" @@ -9,18 +12,35 @@ sources: url: "https://github.com/google/jsonnet/archive/v0.17.0.tar.gz" sha256: "076b52edf888c01097010ad4299e3b2e7a72b60a41abbc65af364af1ed3c8dbe" patches: + "0.20.0": + - patch_file: "patches/0.18.0/0001-fix-nlohmann-include.patch" + patch_description: "fix include path to use cci package" + patch_type: "conan" + - patch_file: "patches/0.18.0/0002-cmake-fixes.patch" + patch_description: "fix rapidyaml name, add installation" + patch_type: "conan" + - patch_file: "patches/0.20.0/0003-use-cpp17.patch" + patch_description: "use C++17" + patch_type: "portability" + patch_source: "https://github.com/google/jsonnet/pull/1076" "0.19.1": - patch_file: "patches/0.18.0/0001-fix-nlohmann-include.patch" - base_path: "source_subfolder" + patch_description: "fix include path to use cci package" + patch_type: "conan" - patch_file: "patches/0.18.0/0002-cmake-fixes.patch" - base_path: "source_subfolder" + patch_description: "fix rapidyaml name, add installation" + patch_type: "conan" "0.18.0": - patch_file: "patches/0.18.0/0001-fix-nlohmann-include.patch" - base_path: "source_subfolder" + patch_description: "fix include path to use cci package" + patch_type: "conan" - patch_file: "patches/0.18.0/0002-cmake-fixes.patch" - base_path: "source_subfolder" + patch_description: "fix rapidyaml name, add installation" + patch_type: "conan" "0.17.0": - patch_file: "patches/0.17.0/0001-fix-nlohmann-include.patch" - base_path: "source_subfolder" + patch_description: "fix include path to use cci package" + patch_type: "conan" - patch_file: "patches/0.17.0/0002-cmake-fixes.patch" - base_path: "source_subfolder" + patch_description: "fix rapidyaml name, add installation" + patch_type: "conan" diff --git a/recipes/jsonnet/all/conanfile.py b/recipes/jsonnet/all/conanfile.py index ff9c2346a3e5f..01b0516363b18 100644 --- a/recipes/jsonnet/all/conanfile.py +++ b/recipes/jsonnet/all/conanfile.py @@ -1,19 +1,23 @@ -import functools -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, msvc_runtime_flag +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy +from conan.tools.build import check_min_cppstd, cross_building, stdcpp_library +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 JsonnetConan(ConanFile): name = "jsonnet" description = "Jsonnet - The data templating language" - topics = ("config", "json", "functional", "configuration") license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/google/jsonnet" + topics = ("config", "json", "functional", "configuration") settings = "os", "arch", "compiler", "build_type" + package_type = "library" options = { "shared": [True, False], "fPIC": [True, False], @@ -22,15 +26,25 @@ class JsonnetConan(ConanFile): "shared": False, "fPIC": True, } - generators = "cmake", "cmake_find_package" @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return "11" if Version(self.version) < "0.20.0" else "17" @property - def _build_subfolder(self): - return "build_subfolder" + def _compilers_minimum_version(self): + return { + "17": { + "gcc": "8", + "clang": "7", + "apple-clang": "12", + "Visual Studio": "16", + "msvc": "192", + }, + }.get(self._min_cppstd, {}) + + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -38,70 +52,78 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - # This is a workround. - # If jsonnet is shared, rapidyaml must be built as shared, - # or the c4core functions that rapidyaml depends on will not be able to be found. - # This seems to be a issue of rapidyaml. - # https://github.com/conan-io/conan-center-index/pull/9786#discussion_r829887879 - if tools.Version(self.version) >= "0.18.0": - self.options["rapidyaml"].shared = True + self.options.rm_safe("fPIC") - def requirements(self): - self.requires("nlohmann_json/3.10.5") - if tools.Version(self.version) >= "0.18.0": - self.requires("rapidyaml/0.4.1") + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): - if hasattr(self, "settings_build") and tools.cross_building(self, skip_x64_x86=True): - raise ConanInvalidConfiguration("jsonnet does not support cross building") + 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." + ) + + if Version(self.version) == "0.17.0" and Version(self.settings.compiler.get_safe("cppstd")) > "17": + raise ConanInvalidConfiguration(f"{self.ref} does not support C++{self.settings.compiler.cppstd}") - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, "11") + if hasattr(self, "settings_build") and cross_building(self, skip_x64_x86=True): + raise ConanInvalidConfiguration(f"{self.ref} does not support cross building") if self.options.shared and is_msvc(self) and "d" in msvc_runtime_flag(self): - raise ConanInvalidConfiguration("shared {} is not supported with MTd/MDd runtime".format(self.name)) + raise ConanInvalidConfiguration(f"shared {self.ref} is not supported with MTd/MDd runtime") - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + # This is a workround. + # If jsonnet is shared, rapidyaml must be built as shared, + # or the c4core functions that rapidyaml depends on will not be able to be found. + # This seems to be a issue of rapidyaml. + # https://github.com/conan-io/conan-center-index/pull/9786#discussion_r829887879 + if self.options.shared and Version(self.version) >= "0.18.0" and self.dependencies["rapidyaml"].options.shared == False: + raise ConanInvalidConfiguration(f"shared {self.ref} requires rapidyaml to be built as shared") - def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + def requirements(self): + self.requires("nlohmann_json/3.11.3") + if Version(self.version) >= "0.18.0": + self.requires("rapidyaml/0.5.0") - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["BUILD_TESTS"] = False - cmake.definitions["BUILD_STATIC_LIBS"] = not self.options.shared - cmake.definitions["BUILD_SHARED_BINARIES"] = False - cmake.definitions["BUILD_JSONNET"] = False - cmake.definitions["BUILD_JSONNETFMT"] = False - cmake.definitions["USE_SYSTEM_JSON"] = True - cmake.configure(build_folder=self._build_subfolder) - return cmake + def source(self): + 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_STATIC_LIBS"] = not self.options.shared + tc.variables["BUILD_SHARED_BINARIES"] = False + tc.variables["BUILD_JSONNET"] = False + tc.variables["BUILD_JSONNETFMT"] = False + tc.variables["USE_SYSTEM_JSON"] = True + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = 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("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): self.cpp_info.components["libjsonnet"].libs = ["jsonnet"] self.cpp_info.components["libjsonnet"].requires = ["nlohmann_json::nlohmann_json"] - if tools.Version(self.version) >= "0.18.0": + if Version(self.version) >= "0.18.0": self.cpp_info.components["libjsonnet"].requires.append("rapidyaml::rapidyaml") - if tools.stdcpp_library(self): - self.cpp_info.components["libjsonnet"].system_libs.append(tools.stdcpp_library(self)) + if stdcpp_library(self): + self.cpp_info.components["libjsonnet"].system_libs.append(stdcpp_library(self)) if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["libjsonnet"].system_libs.append("m") diff --git a/recipes/jsonnet/all/patches/0.17.0/0002-cmake-fixes.patch b/recipes/jsonnet/all/patches/0.17.0/0002-cmake-fixes.patch index 6d8e892eb89a7..887943f82c372 100644 --- a/recipes/jsonnet/all/patches/0.17.0/0002-cmake-fixes.patch +++ b/recipes/jsonnet/all/patches/0.17.0/0002-cmake-fixes.patch @@ -1,32 +1,44 @@ -- install headers -- optionally disable shared build -- add md5 objects to c library -- allow MSVC ---- core/CMakeLists.txt -+++ core/CMakeLists.txt -@@ -16,8 +16,8 @@ set(LIBJSONNET_HEADERS - string_utils.h +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 385ea82..34b1c63 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -40,7 +40,7 @@ if (${CMAKE_CXX_COMPILER_ID} MATCHES "Clang" OR + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -Wextra -Woverloaded-virtual -pedantic -std=c++11 -fPIC ${OPT}") + else() + # TODO: Windows support. +- message(FATAL_ERROR "Compiler ${CMAKE_CXX_COMPILER_ID} not supported") ++ message(WARNING "Compiler ${CMAKE_CXX_COMPILER_ID} not supported") + endif() + + set(CMAKE_CXX_STANDARD 11) +diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt +index e8ad830..7d87527 100644 +--- a/core/CMakeLists.txt ++++ b/core/CMakeLists.txt +@@ -17,7 +17,8 @@ set(LIBJSONNET_HEADERS unicode.h vm.h) -- + -set(LIBJSONNET_SOURCE +install(FILES ../include/libjsonnet.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +set(LIBJSONNET_SOURCE $ desugarer.cpp formatter.cpp lexer.cpp -@@ -27,7 +27,7 @@ set(LIBJSONNET_SOURCE - static_analysis.cpp +@@ -28,6 +29,7 @@ set(LIBJSONNET_SOURCE string_utils.cpp vm.cpp) -- + +if (NOT BUILD_STATIC_LIBS) add_library(libjsonnet SHARED ${LIBJSONNET_HEADERS} ${LIBJSONNET_SOURCE}) add_dependencies(libjsonnet md5 stdlib) target_link_libraries(libjsonnet md5 nlohmann_json::nlohmann_json) -@@ -50,7 +50,7 @@ install(TARGETS libjsonnet +@@ -47,10 +49,10 @@ set_target_properties(libjsonnet PROPERTIES OUTPUT_NAME jsonnet + install(TARGETS libjsonnet + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" - PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") -+ PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") ++ PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") target_include_directories(libjsonnet INTERFACE $) - @@ -34,9 +46,11 @@ if (BUILD_STATIC_LIBS) # Static library for jsonnet command-line tool. add_library(libjsonnet_static STATIC ${LIBJSONNET_SOURCE}) ---- cpp/CMakeLists.txt -+++ cpp/CMakeLists.txt -@@ -3,11 +3,11 @@ +diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt +index 5549902..3091a9c 100644 +--- a/cpp/CMakeLists.txt ++++ b/cpp/CMakeLists.txt +@@ -3,14 +3,14 @@ set(LIBJSONNETPP_HEADERS ../include/libjsonnet++.h ) @@ -51,7 +65,13 @@ add_dependencies(libjsonnet++ jsonnet) -# target_link_libraries(libjsonnet libjsonnet) +target_link_libraries(libjsonnet++ libjsonnet) -@@ -24,7 +24,7 @@ + + # CMake prepends CMAKE_SHARED_LIBRARY_PREFIX to shared libraries, so without + # this step the output would be |liblibjsonnet|. +@@ -21,10 +21,10 @@ set_target_properties(libjsonnet++ PROPERTIES OUTPUT_NAME jsonnet++ + install(TARGETS libjsonnet++ + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" - PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") + PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") target_include_directories(libjsonnet++ INTERFACE @@ -61,20 +81,11 @@ if (BUILD_STATIC_LIBS) # Static library for jsonnet command-line tool. add_library(libjsonnet++_static STATIC ${LIBJSONNETPP_SOURCE}) ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -40,7 +40,7 @@ - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -Wextra -Woverloaded-virtual -pedantic -std=c++11 -fPIC ${OPT}") - else() - # TODO: Windows support. -- message(FATAL_ERROR "Compiler ${CMAKE_CXX_COMPILER_ID} not supported") -+ message(WARNING "Compiler ${CMAKE_CXX_COMPILER_ID} not supported") - endif() - - set(CMAKE_CXX_STANDARD 11) ---- stdlib/CMakeLists.txt -+++ stdlib/CMakeLists.txt -@@ -5,7 +5,7 @@ +diff --git a/stdlib/CMakeLists.txt b/stdlib/CMakeLists.txt +index a481d9f..00ff502 100644 +--- a/stdlib/CMakeLists.txt ++++ b/stdlib/CMakeLists.txt +@@ -5,7 +5,7 @@ add_executable(to_c_array to_c_array.cpp) # Custom command that will only build stdlib when it changes. add_custom_command( OUTPUT ${PROJECT_SOURCE_DIR}/core/std.jsonnet.h @@ -83,5 +94,3 @@ ${PROJECT_SOURCE_DIR}/stdlib/std.jsonnet ${PROJECT_SOURCE_DIR}/core/std.jsonnet.h DEPENDS to_c_array std.jsonnet) - - diff --git a/recipes/jsonnet/all/patches/0.18.0/0002-cmake-fixes.patch b/recipes/jsonnet/all/patches/0.18.0/0002-cmake-fixes.patch index 505ce96c21e93..58b0135ca2153 100644 --- a/recipes/jsonnet/all/patches/0.18.0/0002-cmake-fixes.patch +++ b/recipes/jsonnet/all/patches/0.18.0/0002-cmake-fixes.patch @@ -20,7 +20,7 @@ index 5df20ca..c14c93c 100644 add_subdirectory(cpp) add_subdirectory(cmd) diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt -index e62a858..c0389f8 100644 +index e62a858..f0fb69f 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -17,7 +17,8 @@ set(LIBJSONNET_HEADERS @@ -33,15 +33,21 @@ index e62a858..c0389f8 100644 desugarer.cpp formatter.cpp lexer.cpp -@@ -28,6 +29,7 @@ set(LIBJSONNET_SOURCE +@@ -28,9 +29,12 @@ set(LIBJSONNET_SOURCE string_utils.cpp vm.cpp) ++find_package(ryml REQUIRED CONFIG) ++ +if (NOT BUILD_STATIC_LIBS) add_library(libjsonnet SHARED ${LIBJSONNET_HEADERS} ${LIBJSONNET_SOURCE}) add_dependencies(libjsonnet md5 stdlib) - target_link_libraries(libjsonnet md5 nlohmann_json::nlohmann_json ryml) -@@ -47,10 +49,10 @@ set_target_properties(libjsonnet PROPERTIES OUTPUT_NAME jsonnet +-target_link_libraries(libjsonnet md5 nlohmann_json::nlohmann_json ryml) ++target_link_libraries(libjsonnet md5 nlohmann_json::nlohmann_json ryml::ryml) + + file(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/../include/libjsonnet.h JSONNET_VERSION_DEF + REGEX "[#]define[ \t]+LIB_JSONNET_VERSION[ \t]+") +@@ -47,15 +51,15 @@ set_target_properties(libjsonnet PROPERTIES OUTPUT_NAME jsonnet install(TARGETS libjsonnet LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" @@ -54,6 +60,12 @@ index e62a858..c0389f8 100644 if (BUILD_STATIC_LIBS) # Static library for jsonnet command-line tool. add_library(libjsonnet_static STATIC ${LIBJSONNET_SOURCE}) + add_dependencies(libjsonnet_static md5 stdlib) +- target_link_libraries(libjsonnet_static md5 nlohmann_json::nlohmann_json ryml) ++ target_link_libraries(libjsonnet_static md5 nlohmann_json::nlohmann_json ryml::ryml) + set_target_properties(libjsonnet_static PROPERTIES OUTPUT_NAME jsonnet) + install(TARGETS libjsonnet_static DESTINATION "${CMAKE_INSTALL_LIBDIR}") + target_include_directories(libjsonnet_static INTERFACE diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index eb7686c..cbf21bb 100644 --- a/cpp/CMakeLists.txt diff --git a/recipes/jsonnet/all/patches/0.20.0/0003-use-cpp17.patch b/recipes/jsonnet/all/patches/0.20.0/0003-use-cpp17.patch new file mode 100644 index 0000000000000..6735bb58adc58 --- /dev/null +++ b/recipes/jsonnet/all/patches/0.20.0/0003-use-cpp17.patch @@ -0,0 +1,14 @@ +iff --git a/CMakeLists.txt b/CMakeLists.txt +index c14c93c..b1cb1b3 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -43,7 +43,8 @@ else() + message(WARNING "Compiler ${CMAKE_CXX_COMPILER_ID} not supported") + endif() + +-set(CMAKE_CXX_STANDARD 11) ++# FIXME: This is a temporary workaround, necessary in MSVC only for version 0.20 and Conan 1.X ++set(CMAKE_CXX_STANDARD 17) + + + # Include external googletest project. This runs a CMake sub-script diff --git a/recipes/jsonnet/all/test_package/CMakeLists.txt b/recipes/jsonnet/all/test_package/CMakeLists.txt index b1f60f164ad79..ad42d5d0faada 100644 --- a/recipes/jsonnet/all/test_package/CMakeLists.txt +++ b/recipes/jsonnet/all/test_package/CMakeLists.txt @@ -1,14 +1,15 @@ -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 CXX) find_package(jsonnet CONFIG REQUIRED) add_executable(${PROJECT_NAME}_c test_package.c) -target_link_libraries(${PROJECT_NAME}_c jsonnet::libjsonnet) +target_link_libraries(${PROJECT_NAME}_c PRIVATE jsonnet::libjsonnet) add_executable(${PROJECT_NAME}_cxx test_package.cpp) -target_link_libraries(${PROJECT_NAME}_cxx jsonnet::libjsonnetpp) -set_property(TARGET ${PROJECT_NAME}_cxx PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME}_cxx PRIVATE jsonnet::libjsonnetpp) +if(jsonnet_VERSION VERSION_LESS "0.20.0") + target_compile_features(${PROJECT_NAME}_cxx PRIVATE cxx_std_11) +else() + target_compile_features(${PROJECT_NAME}_cxx PRIVATE cxx_std_17) +endif() diff --git a/recipes/jsonnet/all/test_package/conanfile.py b/recipes/jsonnet/all/test_package/conanfile.py index 1460ef0546803..7f7fcbab40166 100644 --- a/recipes/jsonnet/all/test_package/conanfile.py +++ b/recipes/jsonnet/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): - self.run(os.path.join("bin", "test_package_c"), run_environment=True) - self.run(os.path.join("bin", "test_package_cxx"), run_environment=True) + if can_run(self): + self.run(os.path.join(self.cpp.build.bindir, "test_package_c"), env="conanrun") + self.run(os.path.join(self.cpp.build.bindir, "test_package_cxx"), env="conanrun") diff --git a/recipes/jsonnet/all/test_v1_package/CMakeLists.txt b/recipes/jsonnet/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..be00a8c7f57c7 --- /dev/null +++ b/recipes/jsonnet/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/jsonnet/all/test_v1_package/conanfile.py b/recipes/jsonnet/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..25fbcb7a6d066 --- /dev/null +++ b/recipes/jsonnet/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): + self.run(os.path.join("bin", "test_package_c"), run_environment=True) + self.run(os.path.join("bin", "test_package_cxx"), run_environment=True) diff --git a/recipes/jsonnet/config.yml b/recipes/jsonnet/config.yml index d98d76db4349a..be300c9c5c2b0 100644 --- a/recipes/jsonnet/config.yml +++ b/recipes/jsonnet/config.yml @@ -1,4 +1,6 @@ versions: + "0.20.0": + folder: all "0.19.1": folder: all "0.18.0": diff --git a/recipes/jthread-lite/all/conanfile.py b/recipes/jthread-lite/all/conanfile.py index efd2ef2fde6ab..b1f862a6ab31f 100644 --- a/recipes/jthread-lite/all/conanfile.py +++ b/recipes/jthread-lite/all/conanfile.py @@ -12,8 +12,9 @@ class JthreadLiteConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/martinmoene/jthread-lite" description = "jthread lite - C++20's jthread for C++11 and later in a single-file header-only library " - topics = ("jthread-lite", "jthread", "cpp11") + topics = ("jthread", "cpp11") license = "BSL-1.0" + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -28,8 +29,7 @@ def validate(self): 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 build(self): pass diff --git a/recipes/jungle/all/CMakeLists.txt b/recipes/jungle/all/CMakeLists.txt deleted file mode 100644 index d2b01e47d9d63..0000000000000 --- a/recipes/jungle/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.11) -project(jungle) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -add_subdirectory("source_subfolder") diff --git a/recipes/jungle/all/conandata.yml b/recipes/jungle/all/conandata.yml index bd27aef1a8932..804a4efea38b2 100644 --- a/recipes/jungle/all/conandata.yml +++ b/recipes/jungle/all/conandata.yml @@ -10,31 +10,19 @@ patches: - patch_file: "patches/0001-cmake-alterations.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" "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/conanfile.py b/recipes/jungle/all/conanfile.py index 5350d8f70668d..dba32eb6f0f01 100644 --- a/recipes/jungle/all/conanfile.py +++ b/recipes/jungle/all/conanfile.py @@ -1,21 +1,23 @@ -from os.path import join +import os + from conan import ConanFile -from conan.tools.files import apply_conandata_patches, copy, get from conan.tools.build import check_min_cppstd -from conans import CMake +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get + +required_conan_version = ">=1.53.0" -required_conan_version = ">=1.50.0" class JungleConan(ConanFile): name = "jungle" - homepage = "https://github.com/eBay/Jungle" description = "Key-value storage library, based on a combined index of LSM-tree and copy-on-write B+tree" - topics = ("kv-store", "cow") - url = "https://github.com/conan-io/conan-center-index" license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/eBay/Jungle" + topics = ("kv-store", "cow") + package_type = "library" settings = "os", "arch", "compiler", "build_type" - options = { "shared": [True, False], "fPIC": [True, False], @@ -25,16 +27,19 @@ class JungleConan(ConanFile): "fPIC": True, } - generators = "cmake", "cmake_find_package" + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC - @property - def _source_subfolder(self): - return "source_subfolder" + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") - def export_sources(self): - self.copy("CMakeLists.txt") - for patch_file in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch_file["patch_file"]) + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): self.requires("forestdb/cci.20220727") @@ -43,12 +48,14 @@ def validate(self): if self.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_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.generate() + tc = CMakeDeps(self) + tc.generate() def build(self): apply_conandata_patches(self) @@ -57,18 +64,17 @@ def build(self): cmake.build() def package(self): - src_dir = join(self.source_folder, self._source_subfolder) - copy(self, "LICENSE*", src_dir, join(self.package_folder, "licenses")) - - hdr_src = join(src_dir, "include") - copy(self, "*.h", hdr_src, join(self.package_folder, "include"), keep_path=True) - - lib_dir = join(self.package_folder, "lib") - copy(self, "*.a", self.build_folder, lib_dir, keep_path=False) - copy(self, "*.lib", self.build_folder, lib_dir, keep_path=False) - copy(self, "*.so*", self.build_folder, lib_dir, keep_path=False) - copy(self, "*.dylib*", self.build_folder, lib_dir, keep_path=False) - copy(self, "*.dll*", self.build_folder, join(self.package_folder, "bin"), keep_path=False) + 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")) + for pattern in ["*.a", "*.lib", "*.so*", "*.dylib*", "*.dll*"]: + copy(self, pattern, + src=self.build_folder, + dst=os.path.join(self.package_folder, "lib"), + keep_path=False) def package_info(self): self.cpp_info.libs = ["jungle"] diff --git a/recipes/jungle/all/test_package/CMakeLists.txt b/recipes/jungle/all/test_package/CMakeLists.txt index 354670d11c755..fdc2bc33ffe24 100644 --- a/recipes/jungle/all/test_package/CMakeLists.txt +++ b/recipes/jungle/all/test_package/CMakeLists.txt @@ -1,11 +1,9 @@ -cmake_minimum_required(VERSION 3.11) -set(CMAKE_CXX_STANDARD 11) -project(test_package) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +set(CMAKE_CXX_STANDARD 11) -find_package(jungle CONFIG REQUIRED) +find_package(jungle REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} jungle::jungle) diff --git a/recipes/jungle/all/test_package/conanfile.py b/recipes/jungle/all/test_package/conanfile.py index 9ebf26743f34b..ef5d7042163ec 100644 --- a/recipes/jungle/all/test_package/conanfile.py +++ b/recipes/jungle/all/test_package/conanfile.py @@ -1,11 +1,19 @@ -from conans import ConanFile -from conan.tools.build import cross_building -from conans import CMake +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) @@ -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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/jungle/all/test_v1_package/CMakeLists.txt b/recipes/jungle/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/jungle/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/jungle/all/test_v1_package/conanfile.py b/recipes/jungle/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..9ebf26743f34b --- /dev/null +++ b/recipes/jungle/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans 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_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/jwasm/all/conanfile.py b/recipes/jwasm/all/conanfile.py index 682db91532894..fb10aeba03ec3 100644 --- a/recipes/jwasm/all/conanfile.py +++ b/recipes/jwasm/all/conanfile.py @@ -1,44 +1,36 @@ 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 JwasmConan(ConanFile): name = "jwasm" description = "JWasm is intended to be a free Masm-compatible assembler." license = "Watcom-1.0" - topics = ("jwasm", "masm", "assembler") + topics = ("masm", "assembler") homepage = "https://github.com/JWasm/JWasm" url = "https://github.com/conan-io/conan-center-index" - + package_type = "application" 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) + export_conandata_patches(self) def configure(self): - 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.settings.compiler + 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.settings.compiler + 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,11 +48,8 @@ def package(self): cmake.install() def package_info(self): - self.cpp_info.frameworkdirs = [] self.cpp_info.includedirs = [] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] - 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 once conan v1 support dropped + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/jwt-cpp/all/conandata.yml b/recipes/jwt-cpp/all/conandata.yml index bf093248fb260..e8a69c12dceae 100644 --- a/recipes/jwt-cpp/all/conandata.yml +++ b/recipes/jwt-cpp/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.7.0": + url: "https://github.com/Thalhammer/jwt-cpp/archive/v0.7.0.tar.gz" + sha256: "b9eb270e3ba8221e4b2bc38723c9a1cb4fa6c241a42908b9a334daff31137406" "0.6.0": url: "https://github.com/Thalhammer/jwt-cpp/archive/v0.6.0.tar.gz" sha256: "0227bd6e0356b211341075c7997c837f0b388c01379bd256aa525566a5553f03" @@ -15,6 +18,10 @@ sources: url: "https://github.com/Thalhammer/jwt-cpp/archive/v0.3.1.tar.gz" sha256: "399345e81883f2959df658cd945de39548ddfefdab2acf7b23ee07b9e9a02938" patches: + "0.7.0": + - patch_file: "patches/0005-fix-picojson-header-location-for-conan.patch" + patch_description: "Remove picojson namespace from its include" + patch_type: "conan" "0.6.0": - patch_file: "patches/0005-fix-picojson-header-location-for-conan.patch" patch_description: "Remove picojson namespace from its include" diff --git a/recipes/jwt-cpp/all/conanfile.py b/recipes/jwt-cpp/all/conanfile.py index 75e913785ea24..9a7ee532d7797 100644 --- a/recipes/jwt-cpp/all/conanfile.py +++ b/recipes/jwt-cpp/all/conanfile.py @@ -8,32 +8,37 @@ class JwtCppConan(ConanFile): name = "jwt-cpp" + description = "A C++ JSON Web Token library for encoding/decoding" license = "MIT" 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 = ("json", "jwt", "jws", "jwe", "jwk", "jwks", "jose", "header-only") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" - no_copy_source = True + + options = { "with_picojson": [True, False] } + default_options = { "with_picojson" : False } @property - def _supports_generic_json(self): - return Version(self.version) >= "0.5.0" + def _with_picojson(self): + return Version(self.version) < "0.5.0" or self.options.with_picojson def export_sources(self): export_conandata_patches(self) + def layout(self): + basic_layout(self, src_folder="src") + def requirements(self): - self.requires("openssl/1.1.1s") - if not self._supports_generic_json: + self.requires("openssl/[>=1.1 <4]") + if self._with_picojson: self.requires("picojson/1.3.0") - def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=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], strip_root=True) def build(self): apply_conandata_patches(self) @@ -43,21 +48,14 @@ def package(self): 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.clear() - def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.requires = ["openssl::openssl"] + if self._with_picojson: + self.cpp_info.requires.append("picojson::picojson") + else: + self.cpp_info.defines.append("JWT_DISABLE_PICOJSON") self.cpp_info.set_property("cmake_file_name", "jwt-cpp") self.cpp_info.set_property("cmake_target_name", "jwt-cpp::jwt-cpp") - # 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 020cb1aab4c7d..123d03753d8a0 100644 --- a/recipes/jwt-cpp/all/test_package/CMakeLists.txt +++ b/recipes/jwt-cpp/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(jwt-cpp REQUIRED CONFIG) find_package(picojson REQUIRED CONFIG) @@ -8,6 +8,10 @@ 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) +if (MSVC) + target_compile_definitions(${PROJECT_NAME} PRIVATE NOMINMAX) +endif() + if (jwt-cpp_VERSION VERSION_GREATER 0.4.0) target_compile_definitions(${PROJECT_NAME} PRIVATE JSON_TRAITS_NEEDED) endif() @@ -15,3 +19,7 @@ endif() if (jwt-cpp_VERSION VERSION_GREATER_EQUAL 0.6.0) target_compile_definitions(${PROJECT_NAME} PRIVATE HAS_DEFAULT_TRAITS) endif() + +if (jwt-cpp_VERSION VERSION_GREATER_EQUAL 0.7.0) + target_compile_definitions(${PROJECT_NAME} PRIVATE GET_PAYLOAD_JSON) +endif() diff --git a/recipes/jwt-cpp/all/test_package/test_package.cpp b/recipes/jwt-cpp/all/test_package/test_package.cpp index a7af84c85dc7c..64275af84bffa 100644 --- a/recipes/jwt-cpp/all/test_package/test_package.cpp +++ b/recipes/jwt-cpp/all/test_package/test_package.cpp @@ -18,8 +18,13 @@ int main() { .sign(jwt::algorithm::hs256{"secret"}); auto decoded = jwt::decode(token); - for(auto& e : decoded.get_payload_claims()) +#ifdef GET_PAYLOAD_JSON + for(auto& e : decoded.get_payload_json()) + std::cout << e.first << " = " << e.second << std::endl; +#else + for(auto& e : decoded.get_payload_claims()) std::cout << e.first << " = " << e.second.to_json() << std::endl; +#endif auto verifier = jwt::verify() .allow_algorithm(jwt::algorithm::hs256{"secret"}) diff --git a/recipes/jwt-cpp/all/test_v1_package/CMakeLists.txt b/recipes/jwt-cpp/all/test_v1_package/CMakeLists.txt index d58f9a64ba28e..84b1906ecf746 100644 --- a/recipes/jwt-cpp/all/test_v1_package/CMakeLists.txt +++ b/recipes/jwt-cpp/all/test_v1_package/CMakeLists.txt @@ -1,20 +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(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() +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/jwt-cpp/config.yml b/recipes/jwt-cpp/config.yml index 49536ba2e770d..ebed14e0108cb 100644 --- a/recipes/jwt-cpp/config.yml +++ b/recipes/jwt-cpp/config.yml @@ -1,4 +1,6 @@ versions: + "0.7.0": + folder: all "0.6.0": folder: all "0.5.1": diff --git a/recipes/jxrlib/all/conanfile.py b/recipes/jxrlib/all/conanfile.py index d4c71b54de455..14c91a4a33519 100644 --- a/recipes/jxrlib/all/conanfile.py +++ b/recipes/jxrlib/all/conanfile.py @@ -5,7 +5,7 @@ from conan.tools.microsoft import is_msvc import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class JxrlibConan(ConanFile): @@ -15,6 +15,7 @@ class JxrlibConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" license = "BSD-2-Clause" topics = ("jxr", "jpeg", "xr") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { @@ -36,18 +37,9 @@ def config_options(self): 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 + 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/jxrlib/all/test_package/conanfile.py b/recipes/jxrlib/all/test_package/conanfile.py index b8d2e695e4b3a..0a6bc68712d90 100644 --- a/recipes/jxrlib/all/test_package/conanfile.py +++ b/recipes/jxrlib/all/test_package/conanfile.py @@ -23,5 +23,4 @@ def build(self): def test(self): 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(f"{bin_path} {img_path}", env="conanrun") + self.run(bin_path, env="conanrun") diff --git a/recipes/jxrlib/all/test_package/test.jxr b/recipes/jxrlib/all/test_package/test.jxr deleted file mode 100644 index 4f66a2e27671a..0000000000000 Binary files a/recipes/jxrlib/all/test_package/test.jxr and /dev/null differ diff --git a/recipes/jxrlib/all/test_package/test_package.c b/recipes/jxrlib/all/test_package/test_package.c index 122b6c2fd1cc3..03492cea6383f 100644 --- a/recipes/jxrlib/all/test_package/test_package.c +++ b/recipes/jxrlib/all/test_package/test_package.c @@ -4,28 +4,14 @@ int main(int argc, char* argv[]) { - if (argc < 2) { - fprintf(stderr, "Need at least one argument\n"); - return 1; - } - - const char *jxr_path = argv[1]; - - { - ERR err = WMP_errSuccess; - - PKCodecFactory* pCodecFactory = NULL; - PKImageDecode* pDecoder = NULL; - - Call(PKCreateCodecFactory(&pCodecFactory, WMP_SDK_VERSION)); - Call(pCodecFactory->CreateDecoderFromFile(jxr_path, &pDecoder)); + ERR err = WMP_errSuccess; + PKCodecFactory* pCodecFactory = NULL; - PKPixelFormatGUID pix_frmt; - Call(pDecoder->GetPixelFormat(pDecoder, &pix_frmt)); + Call(PKCreateCodecFactory(&pCodecFactory, WMP_SDK_VERSION)); Cleanup: - if(pDecoder) pDecoder->Release(&pDecoder); - if(pCodecFactory) pCodecFactory->Release(&pCodecFactory); + if(pCodecFactory) { + pCodecFactory->Release(&pCodecFactory); } return 0; diff --git a/recipes/jxrlib/all/test_v1_package/conanfile.py b/recipes/jxrlib/all/test_v1_package/conanfile.py index ffd0b1c74921b..38f4483872d47 100644 --- a/recipes/jxrlib/all/test_v1_package/conanfile.py +++ b/recipes/jxrlib/all/test_v1_package/conanfile.py @@ -14,5 +14,4 @@ def build(self): 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) + self.run(bin_path, run_environment=True) diff --git a/recipes/kainjow-mustache/all/conanfile.py b/recipes/kainjow-mustache/all/conanfile.py index 5a235a430af98..0d2d3ee8e05e2 100644 --- a/recipes/kainjow-mustache/all/conanfile.py +++ b/recipes/kainjow-mustache/all/conanfile.py @@ -1,35 +1,48 @@ -from conans import ConanFile, tools import os -import glob + +from conan import ConanFile +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout + +required_conan_version = ">=1.52.0" class KainjowMustacheConan(ConanFile): name = "kainjow-mustache" description = "Mustache text templates for modern C++" - topics = ("conan", "mustache", "template") + license = "BSL-1.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/kainjow/Mustache" - license = "BSL-1.0" + topics = ("mustache", "template", "header-only") + + 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]) - os.rename( - "Mustache-{}".format(self.version), - self._source_subfolder - ) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("mustache.hpp", dst=os.path.join("include", "kainjow"), src=self._source_subfolder) - - def package_id(self): - self.info.header_only() + copy(self, "LICENSE", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder) + copy(self, "mustache.hpp", + dst=os.path.join(self.package_folder, "include", "kainjow"), + src=self.source_folder) def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + self.cpp_info.set_property("cmake_file_name", "kainjow_mustache") + self.cpp_info.set_property("cmake_target_name", "kainjow_mustache::kainjow_mustache") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.names["cmake_find_package"] = "kainjow_mustache" self.cpp_info.names["cmake_find_package_multi"] = "kainjow_mustache" diff --git a/recipes/kainjow-mustache/all/test_package/CMakeLists.txt b/recipes/kainjow-mustache/all/test_package/CMakeLists.txt index 10c7c5ddbef7f..931342e8916cd 100644 --- a/recipes/kainjow-mustache/all/test_package/CMakeLists.txt +++ b/recipes/kainjow-mustache/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.9) -project(test_package) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(kainjow_mustache REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE kainjow_mustache::kainjow_mustache) set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) diff --git a/recipes/kainjow-mustache/all/test_package/conanfile.py b/recipes/kainjow-mustache/all/test_package/conanfile.py index bd7165a553cf4..ef5d7042163ec 100644 --- a/recipes/kainjow-mustache/all/test_package/conanfile.py +++ b/recipes/kainjow-mustache/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/kainjow-mustache/all/test_package/test_package.cpp b/recipes/kainjow-mustache/all/test_package/test_package.cpp index e2d83b0f477ec..d45d847b4bf07 100644 --- a/recipes/kainjow-mustache/all/test_package/test_package.cpp +++ b/recipes/kainjow-mustache/all/test_package/test_package.cpp @@ -1,18 +1,15 @@ -#include #include "kainjow/mustache.hpp" - +#include int main() { - using namespace kainjow::mustache; + using namespace kainjow::mustache; - mustache tmpl{"{{#employees}}{{name}}{{#comma}}, {{/comma}}{{/employees}}"}; - data employees{data::type::list}; - employees - << object{{"name", "Steve"}, {"comma", true}} - << object{{"name", "Bill"}}; + mustache tmpl{"{{#employees}}{{name}}{{#comma}}, {{/comma}}{{/employees}}"}; + data employees{data::type::list}; + employees << object{{"name", "Steve"}, {"comma", true}} << object{{"name", "Bill"}}; - if( tmpl.render({"employees", employees}) == "Steve, Bill" ) { - return 0; - } - return 1; + if (tmpl.render({"employees", employees}) == "Steve, Bill") { + return 0; + } + return 1; } 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..86037b3ef63f6 100644 --- a/recipes/kaitai_struct_cpp_stl_runtime/all/conandata.yml +++ b/recipes/kaitai_struct_cpp_stl_runtime/all/conandata.yml @@ -1,4 +1,24 @@ sources: + "0.10.1": + url: "https://github.com/kaitai-io/kaitai_struct_cpp_stl_runtime/archive/refs/tags/0.10.1.tar.gz" + sha256: "19a7fb2d386d1bb14c04ffa514d26673444c71fef73246984e2a587dc5ae1ab2" + "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.1": + - patch_file: "patches/0.10.1-0001-remove-template-id.patch" + patch_description: "rempte template-id from constructor/destructor" + patch_type: "portability" + patch_source: "https://github.com/kaitai-io/kaitai_struct_cpp_stl_runtime/pull/68" + "0.10": + - patch_file: "patches/0.10-0001-cmake-minimum-required.patch" + patch_description: "declare cmake_minimum_required first" + patch_type: "portability" + "cci.20210701": + - patch_file: "patches/0.10-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..ee40515a48071 100644 --- a/recipes/kaitai_struct_cpp_stl_runtime/all/conanfile.py +++ b/recipes/kaitai_struct_cpp_stl_runtime/all/conanfile.py @@ -1,68 +1,68 @@ +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") + package_type = "shared-library" + 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.11 <2]") 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.variables["BUILD_TESTS"] = False + 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"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") diff --git a/recipes/kaitai_struct_cpp_stl_runtime/all/patches/0.10-0001-cmake-minimum-required.patch b/recipes/kaitai_struct_cpp_stl_runtime/all/patches/0.10-0001-cmake-minimum-required.patch new file mode 100644 index 0000000000000..d2ea72d0b994f --- /dev/null +++ b/recipes/kaitai_struct_cpp_stl_runtime/all/patches/0.10-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/patches/0.10.1-0001-remove-template-id.patch b/recipes/kaitai_struct_cpp_stl_runtime/all/patches/0.10.1-0001-remove-template-id.patch new file mode 100644 index 0000000000000..ca0d4c309f4aa --- /dev/null +++ b/recipes/kaitai_struct_cpp_stl_runtime/all/patches/0.10.1-0001-remove-template-id.patch @@ -0,0 +1,94 @@ +diff --git a/kaitai/exceptions.h b/kaitai/exceptions.h +index 1c1e414..8033b98 100644 +--- a/kaitai/exceptions.h ++++ b/kaitai/exceptions.h +@@ -115,7 +115,7 @@ protected: + template + class validation_not_equal_error: public validation_failed_error { + public: +- validation_not_equal_error(const T& expected, const T& actual, kstream* io, const std::string src_path): ++ validation_not_equal_error(const T& expected, const T& actual, kstream* io, const std::string src_path): + validation_failed_error("not equal", io, src_path), + m_expected(expected), + m_actual(actual) +@@ -124,7 +124,7 @@ public: + + // "not equal, expected #{expected.inspect}, but got #{actual.inspect}" + +- virtual ~validation_not_equal_error() KS_NOEXCEPT {}; ++ virtual ~validation_not_equal_error() KS_NOEXCEPT {}; + + protected: + const T& m_expected; +@@ -138,7 +138,7 @@ protected: + template + class validation_less_than_error: public validation_failed_error { + public: +- validation_less_than_error(const T& min, const T& actual, kstream* io, const std::string src_path): ++ validation_less_than_error(const T& min, const T& actual, kstream* io, const std::string src_path): + validation_failed_error("not in range", io, src_path), + m_min(min), + m_actual(actual) +@@ -147,7 +147,7 @@ public: + + // "not in range, min #{min.inspect}, but got #{actual.inspect}" + +- virtual ~validation_less_than_error() KS_NOEXCEPT {}; ++ virtual ~validation_less_than_error() KS_NOEXCEPT {}; + + protected: + const T& m_min; +@@ -161,7 +161,7 @@ protected: + template + class validation_greater_than_error: public validation_failed_error { + public: +- validation_greater_than_error(const T& max, const T& actual, kstream* io, const std::string src_path): ++ validation_greater_than_error(const T& max, const T& actual, kstream* io, const std::string src_path): + validation_failed_error("not in range", io, src_path), + m_max(max), + m_actual(actual) +@@ -170,7 +170,7 @@ public: + + // "not in range, max #{max.inspect}, but got #{actual.inspect}" + +- virtual ~validation_greater_than_error() KS_NOEXCEPT {}; ++ virtual ~validation_greater_than_error() KS_NOEXCEPT {}; + + protected: + const T& m_max; +@@ -184,7 +184,7 @@ protected: + template + class validation_not_any_of_error: public validation_failed_error { + public: +- validation_not_any_of_error(const T& actual, kstream* io, const std::string src_path): ++ validation_not_any_of_error(const T& actual, kstream* io, const std::string src_path): + validation_failed_error("not any of the list", io, src_path), + m_actual(actual) + { +@@ -192,7 +192,7 @@ public: + + // "not any of the list, got #{actual.inspect}" + +- virtual ~validation_not_any_of_error() KS_NOEXCEPT {}; ++ virtual ~validation_not_any_of_error() KS_NOEXCEPT {}; + + protected: + const T& m_actual; +@@ -205,7 +205,7 @@ protected: + template + class validation_expr_error: public validation_failed_error { + public: +- validation_expr_error(const T& actual, kstream* io, const std::string src_path): ++ validation_expr_error(const T& actual, kstream* io, const std::string src_path): + validation_failed_error("not matching the expression", io, src_path), + m_actual(actual) + { +@@ -213,7 +213,7 @@ public: + + // "not matching the expression, got #{actual.inspect}" + +- virtual ~validation_expr_error() KS_NOEXCEPT {}; ++ virtual ~validation_expr_error() KS_NOEXCEPT {}; + + protected: + const T& m_actual; 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..aa873ad2d383c 100644 --- a/recipes/kaitai_struct_cpp_stl_runtime/config.yml +++ b/recipes/kaitai_struct_cpp_stl_runtime/config.yml @@ -1,3 +1,7 @@ versions: + "0.10.1": + folder: all + "0.10": + folder: all "cci.20210701": folder: all diff --git a/recipes/kangaru/all/CMakeLists.txt b/recipes/kangaru/all/CMakeLists.txt deleted file mode 100644 index 1848ca5a77c35..0000000000000 --- a/recipes/kangaru/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/kangaru/all/conandata.yml b/recipes/kangaru/all/conandata.yml index eb79fa1ae4766..996d16a86895e 100644 --- a/recipes/kangaru/all/conandata.yml +++ b/recipes/kangaru/all/conandata.yml @@ -1,11 +1,19 @@ sources: - "4.2.4": - url: "https://github.com/gracicot/kangaru/archive/v4.2.4.tar.gz" - sha256: "0ef74825d98165c26919ce01026533b6594faa584ea93c2f275e1f275bda9dc5" + "4.3.2": + url: "https://github.com/gracicot/kangaru/archive/v4.3.2.tar.gz" + sha256: "ed2dec53087fe4c5fbfc7f7ffcb0e963b3e0a7f27699338c4bc5a116193113b8" + "4.3.1": + url: "https://github.com/gracicot/kangaru/archive/v4.3.1.tar.gz" + sha256: "3896ea2a13cc1c220b4d83bf598e27e77004170b4a212af8f14264f8a6fb0e45" "4.3.0": - url: "https://github.com/gracicot/kangaru/archive/v4.3.0.tar.gz" + url: "https://github.com/gracicot/kangaru/archive/refs/tags/v4.3.0.tar.gz" sha256: "98a0d7f2e5ac65d93fe83615ead1627fab2237b173e18151fb68d50234ed6eaf" + "4.2.4": + url: "https://github.com/gracicot/kangaru/archive/refs/tags/v4.2.4.tar.gz" + sha256: "0ef74825d98165c26919ce01026533b6594faa584ea93c2f275e1f275bda9dc5" patches: "4.2.4": - patch_file: "patches/fix-cmake.patch" - base_path: "source_subfolder" + patch_description: "use CURRENT macros for portability" + patch_type: "portability" + patch_source: "https://github.com/gracicot/kangaru/commit/3908d927c43c1a9c99daaef6eca12d55dd0dcc79" diff --git a/recipes/kangaru/all/conanfile.py b/recipes/kangaru/all/conanfile.py index 3472c5810dbf4..3e901d2203121 100644 --- a/recipes/kangaru/all/conanfile.py +++ b/recipes/kangaru/all/conanfile.py @@ -1,19 +1,23 @@ -from conans import ConanFile, tools, CMake +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, rmdir, save import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class KangaruConan(ConanFile): name = "kangaru" description = "A dependency injection container for C++11, C++14 and later" license = "MIT" - topics = ("gracicot", "kangaru", "DI", "IoC", "inversion of control") - homepage = "https://github.com/gracicot/kangaru/wiki" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/gracicot/kangaru/wiki" + topics = ("DI", "IoC", "inversion of control", "header-only") - settings = "os", "compiler", "build_type", "arch" + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" options = { "reverse_destruction": [True, False], "no_exception": [True, False], @@ -23,53 +27,39 @@ class KangaruConan(ConanFile): "no_exception": False, } - 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 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 package_id(self): self.info.settings.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) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["KANGARU_REVERSE_DESTRUCTION"] = self.options.reverse_destruction - self._cmake.definitions["KANGARU_NO_EXCEPTION"] = self.options.no_exception - 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["KANGARU_REVERSE_DESTRUCTION"] = self.options.reverse_destruction + tc.variables["KANGARU_NO_EXCEPTION"] = self.options.no_exception + 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, "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")) - self.copy(os.path.join(self._source_subfolder, "LICENSE"), "licenses") + rmdir(self, os.path.join(self.package_folder, "lib")) # TODO: to remove in conan v2 once cmake_find_package* generators removed self._create_cmake_module_alias_targets( @@ -77,25 +67,26 @@ def package(self): {"kangaru": "kangaru::kangaru"} ) - @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", "kangaru") self.cpp_info.set_property("cmake_target_name", "kangaru") + 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/kangaru/all/test_package/CMakeLists.txt b/recipes/kangaru/all/test_package/CMakeLists.txt index 5b65007810d6a..c2fae203f0d0c 100644 --- a/recipes/kangaru/all/test_package/CMakeLists.txt +++ b/recipes/kangaru/all/test_package/CMakeLists.txt @@ -1,12 +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(kangaru REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} kangaru) -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 kangaru) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/kangaru/all/test_package/conanfile.py b/recipes/kangaru/all/test_package/conanfile.py index 38f4483872d47..539e617675db7 100644 --- a/recipes/kangaru/all/test_package/conanfile.py +++ b/recipes/kangaru/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, run=True) 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/kangaru/all/test_v1_package/CMakeLists.txt b/recipes/kangaru/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/kangaru/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/kangaru/all/test_v1_package/conanfile.py b/recipes/kangaru/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/kangaru/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/kangaru/config.yml b/recipes/kangaru/config.yml index 4be017b5b8de6..572d8f5785b54 100644 --- a/recipes/kangaru/config.yml +++ b/recipes/kangaru/config.yml @@ -1,5 +1,9 @@ versions: - "4.2.4": + "4.3.2": + folder: all + "4.3.1": folder: all "4.3.0": folder: all + "4.2.4": + folder: all diff --git a/recipes/kcov/all/CMakeLists.txt b/recipes/kcov/all/CMakeLists.txt deleted file mode 100644 index a69305eb3971f..0000000000000 --- a/recipes/kcov/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/kcov/all/conan_deps.cmake b/recipes/kcov/all/conan_deps.cmake new file mode 100644 index 0000000000000..47c0823a35eb3 --- /dev/null +++ b/recipes/kcov/all/conan_deps.cmake @@ -0,0 +1,34 @@ +# Wrapper for find_package() that also adds upper-case variables and allows only Conan packages +macro(custom_find_package name) + find_package(${name} ${ARGN} CONFIG + # Allow only Conan packages + NO_DEFAULT_PATH + PATHS ${CMAKE_PREFIX_PATH} + ) + string(TOUPPER ${name} name_upper) + set(${name_upper}_FOUND TRUE) + set(${name_upper}_VERSION_STRING ${${name}_VERSION_STRING}) + set(${name_upper}_INCLUDE_DIRS ${${name}_INCLUDE_DIRS}) + set(${name_upper}_INCLUDE_DIR ${${name}_INCLUDE_DIR}) + set(${name_upper}_LIBRARIES ${${name}_LIBRARIES}) + set(${name_upper}_DEFINITIONS ${${name}_DEFINITIONS}) + unset(name_upper) +endmacro() + +custom_find_package(Bfd) +custom_find_package(ZLIB REQUIRED) +custom_find_package(CURL REQUIRED) + +if(APPLE) + custom_find_package(Dwarfutils REQUIRED) + set(dwarfutils_FOUND TRUE) +else() + custom_find_package(ElfUtils REQUIRED) + set(Elfutils_FOUND TRUE) + # ElfUtils also provides LibElf + set(LibElf_FOUND TRUE) + set(LIBELF_FOUND TRUE) + set(LIBELF_INCLUDE_DIRS ${ElfUtils_INCLUDE_DIRS}) + set(LIBELF_LIBRARIES ${ElfUtils_LIBRARIES}) + set(LIBELF_DEFINITIONS ${ElfUtils_DEFINITIONS}) +endif() diff --git a/recipes/kcov/all/conandata.yml b/recipes/kcov/all/conandata.yml index b98fb5f6098f5..972457056a28e 100644 --- a/recipes/kcov/all/conandata.yml +++ b/recipes/kcov/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "42": + url: "https://github.com/SimonKagstrom/kcov/archive/refs/tags/v42.tar.gz" + sha256: "2c47d75397af248bc387f60cdd79180763e1f88f3dd71c94bb52478f8e74a1f8" "40": url: "https://github.com/SimonKagstrom/kcov/archive/refs/tags/v40.tar.gz" sha256: "6b1c11b066d57426d61375a31c3816f1fcd2610b447050c86d9920e22d5200b3" @@ -6,9 +9,14 @@ sources: url: "https://github.com/SimonKagstrom/kcov/archive/38.tar.gz" sha256: "b37af60d81a9b1e3b140f9473bdcb7975af12040feb24cc666f9bb2bb0be68b4" patches: - "40": [] + "42": + - patch_file: "patches/0003-fix-missing-include.patch" + patch_description: "Add a missing includes on macOS" + patch_type: "backport" + patch_source: "https://github.com/SimonKagstrom/kcov/commit/4efe5e4a4ac4e7b6d99fc869d826aa74ff716ebf" + - patch_file: "patches/0004-fix-libdwarf-prefix.patch" + patch_description: "Adjust libdwarf include to match CCI includedirs" + patch_type: "conan" "38": - patch_file: "patches/0001-fix-SOLIB-path.patch" - base_path: "source_subfolder" - patch_file: "patches/0002-fix-missing-libssl-dependency.patch" - base_path: "source_subfolder" diff --git a/recipes/kcov/all/conanfile.py b/recipes/kcov/all/conanfile.py index 563b33b2f010e..ccb250afff541 100644 --- a/recipes/kcov/all/conanfile.py +++ b/recipes/kcov/all/conanfile.py @@ -1,63 +1,98 @@ import os + from conan import ConanFile -from conans import CMake, tools -from conans.errors import ConanInvalidConfiguration +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, copy, export_conandata_patches, get, rmdir, rm +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" + class KcovConan(ConanFile): name = "kcov" + description = ( + "Code coverage tool for compiled programs, Python and Bash which uses " + "debugging information to collect and report data without special compilation options" + ) license = "GPL-2.0" - url = "https://github.com/conan-io/conan-center-index/" + url = "https://github.com/conan-io/conan-center-index" homepage = "http://simonkagstrom.github.io/kcov/index.html" - description = "Code coverage tool for compiled programs, Python and Bash\ - which uses debugging information to collect and report data without\ - special compilation options" topics = ("coverage", "linux", "debug") - settings = "os", "compiler", "build_type", "arch" - exports_sources = "CMakeLists.txt", "patches/**" - requires = ["zlib/1.2.12", - "libiberty/9.1.0", - "libcurl/7.83.1", - "elfutils/0.180"] - generators = "cmake" - _cmake = None - _source_subfolder = "source_subfolder" - _build_subfolder = "build_subfolder" - - def configure(self): + + package_type = "application" + settings = "os", "arch", "compiler", "build_type" + + def export_sources(self): + export_conandata_patches(self) + copy(self, "conan_deps.cmake", self.recipe_folder, os.path.join(self.export_sources_folder, "src")) + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires("zlib/[>=1.2.11 <2]") + self.requires("libcurl/[>=7.78 <9]") + self.requires("openssl/[>=1.1 <4]") + if is_apple_os(self): + self.requires("libdwarf/0.8.0") + else: + self.requires("elfutils/0.190") + + def package_id(self): + del self.info.settings.compiler + del self.info.settings.build_type + + def validate(self): if self.settings.os == "Windows": - raise ConanInvalidConfiguration( - "kcov can not be built on windows.") + raise ConanInvalidConfiguration("kcov can not be built on windows.") + if is_apple_os(self): + if Version(self.version) < 42: + # MachO support was added in v42 + raise ConanInvalidConfiguration(f"{self.ref} does not support {self.settings.os}.") + if self.settings.arch == "armv8": + # https://github.com/SimonKagstrom/kcov/blob/v42/cmake/TargetArch.cmake + raise ConanInvalidConfiguration(f"{self.ref} does not support {self.settings.arch}.") 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 _patch_sources(self): - for patch in self.conan_data["patches"][self.version]: - tools.patch(**patch) + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CMAKE_PROJECT_kcov_INCLUDE"] = "conan_deps.cmake" + tc.generate() + deps = CMakeDeps(self) + # Match Find*.cmake module names used by the project + deps.set_property("libbfd", "cmake_file_name", "Bfd") + deps.set_property("libdwarf", "cmake_file_name", "Dwarfutils") + deps.set_property("elfutils", "cmake_file_name", "ElfUtils") + deps.set_property("libcrpcut", "cmake_file_name", "LibCRPCUT") + deps.generate() - def _configure_cmake(self): - if self._cmake is not None: - return self._cmake - self._cmake = CMake(self) - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def _patch_sources(self): + apply_conandata_patches(self) + # Disable project Find*.cmake modules just in case + 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): - 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, "share")) - self.copy("COPYING*", dst="licenses", src=self._source_subfolder) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): + self.cpp_info.includedirs = [] + self.cpp_info.frameworkdirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] + + # 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.cpp_info.includedirs = [] diff --git a/recipes/kcov/all/patches/0003-fix-missing-include.patch b/recipes/kcov/all/patches/0003-fix-missing-include.patch new file mode 100644 index 0000000000000..49167148ac3b4 --- /dev/null +++ b/recipes/kcov/all/patches/0003-fix-missing-include.patch @@ -0,0 +1,20 @@ +Use updated includes from master to fix a missing and +https://github.com/SimonKagstrom/kcov/blob/1d036f7799f95fed025c5fa0665c19df38632ab4/src/engines/mach-engine.cc + +--- src/engines/mach-engine.cc ++++ src/engines/mach-engine.cc +@@ -26,7 +26,14 @@ + #include + #include + #include ++#include ++// clang-format off ++// sys/ptrace.h needs sys/types.h, so make sure clang-format doesn't change the order ++#include + #include ++// clang-format on ++#include ++#include + #include + #include + #include diff --git a/recipes/kcov/all/patches/0004-fix-libdwarf-prefix.patch b/recipes/kcov/all/patches/0004-fix-libdwarf-prefix.patch new file mode 100644 index 0000000000000..3c5509fce924d --- /dev/null +++ b/recipes/kcov/all/patches/0004-fix-libdwarf-prefix.patch @@ -0,0 +1,18 @@ +FIXME: update libdwarf instead + +--- src/parsers/macho-parser.cc ++++ src/parsers/macho-parser.cc +@@ -6,11 +6,11 @@ + */ + #include + #include +-#include ++#include + #include + #include + #include +-#include ++#include + #include + #include + #include diff --git a/recipes/kcov/all/test_package/conanfile.py b/recipes/kcov/all/test_package/conanfile.py index ea5ad0c50ed3e..9808e9680a682 100644 --- a/recipes/kcov/all/test_package/conanfile.py +++ b/recipes/kcov/all/test_package/conanfile.py @@ -1,9 +1,19 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.cmake import cmake_layout +from conan.tools.build import can_run -class KcovTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def test(self): - if not tools.cross_building(self.settings): - self.run("kcov --version", run_environment=True) + if can_run(self): + self.run("kcov --version", env="conanrun") diff --git a/recipes/kcov/all/test_v1_package/conanfile.py b/recipes/kcov/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..ea5ad0c50ed3e --- /dev/null +++ b/recipes/kcov/all/test_v1_package/conanfile.py @@ -0,0 +1,9 @@ +from conans import ConanFile, tools + + +class KcovTestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + + def test(self): + if not tools.cross_building(self.settings): + self.run("kcov --version", run_environment=True) diff --git a/recipes/kcov/config.yml b/recipes/kcov/config.yml index b36ca0e497b00..97b2691d28e3b 100644 --- a/recipes/kcov/config.yml +++ b/recipes/kcov/config.yml @@ -1,4 +1,6 @@ versions: + "42": + folder: all "40": folder: all "38": diff --git a/recipes/kcp/all/CMakeLists.txt b/recipes/kcp/all/CMakeLists.txt deleted file mode 100644 index 0feb437e18418..0000000000000 --- a/recipes/kcp/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/kcp/all/conandata.yml b/recipes/kcp/all/conandata.yml index da8ca059669a3..4ecaaa44cfb1c 100644 --- a/recipes/kcp/all/conandata.yml +++ b/recipes/kcp/all/conandata.yml @@ -5,10 +5,3 @@ sources: "1.7": url: "https://github.com/skywind3000/kcp/archive/1.7.tar.gz" sha256: "b4d26994d95599ab0c44e1f93002f9fda275094a879d66c192d79d596529199e" -patches: - "1.5": - - patch_file: "patches/0001-kcp-remove-add_library-STATIC.patch" - base_path: "source_subfolder" - "1.7": - - patch_file: "patches/0001-kcp-remove-add_library-STATIC.patch" - base_path: "source_subfolder" diff --git a/recipes/kcp/all/conanfile.py b/recipes/kcp/all/conanfile.py index ea23c3a999a55..0146b7ee7c3cc 100644 --- a/recipes/kcp/all/conanfile.py +++ b/recipes/kcp/all/conanfile.py @@ -1,17 +1,23 @@ -from conans import ConanFile, CMake, tools import os -required_conan_version = ">=1.33.0" +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.tools.files import copy, export_conandata_patches, get, rmdir, replace_in_file + +required_conan_version = ">=1.53.0" class KcpConan(ConanFile): name = "kcp" description = "A Fast and Reliable ARQ Protocol" - topics = ("conan", "kcp", "ARQ", "TCP", "protocol") - homepage = "https://github.com/skywind3000/kcp" - url = "https://github.com/conan-io/conan-center-index" license = "MIT" - exports_sources = "CMakeLists.txt", "patches/**" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/skywind3000/kcp" + topics = ("ARQ", "TCP", "protocol") + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -20,18 +26,9 @@ class KcpConan(ConanFile): "shared": False, "fPIC": True, } - settings = "os", "arch", "compiler", "build_type" - 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": @@ -39,36 +36,46 @@ 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["BUILD_TESTING"] = False - self._cmake.configure() - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + tc.variables["BUILD_TESTING"] = False + tc.generate() + tc = CMakeDeps(self) + tc.generate() def _patch_sources(self): - for patch in self.conan_data["patches"][self.version]: - tools.patch(**patch) + # Fix shared builds on Windows + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + " STATIC", "") + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "ARCHIVE DESTINATION", + "RUNTIME DESTINATION bin\nARCHIVE DESTINATION") 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")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + fix_apple_shared_install_name(self) def package_info(self): self.cpp_info.libs = ["kcp"] diff --git a/recipes/kcp/all/patches/0001-kcp-remove-add_library-STATIC.patch b/recipes/kcp/all/patches/0001-kcp-remove-add_library-STATIC.patch deleted file mode 100644 index b8c9f32e1e658..0000000000000 --- a/recipes/kcp/all/patches/0001-kcp-remove-add_library-STATIC.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -5,12 +5,14 @@ - include(CTest) - include(GNUInstallDirs) - --add_library(kcp STATIC ikcp.c) -+add_library(kcp ikcp.c) - - install(FILES ikcp.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) - - install(TARGETS kcp - EXPORT kcp-targets -+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} -+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} - ) diff --git a/recipes/kcp/all/test_package/CMakeLists.txt b/recipes/kcp/all/test_package/CMakeLists.txt index d5b08913be93b..b15d2eca4c2a3 100644 --- a/recipes/kcp/all/test_package/CMakeLists.txt +++ b/recipes/kcp/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(kcp REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/kcp/all/test_package/conanfile.py b/recipes/kcp/all/test_package/conanfile.py index f8eeed898d7bd..ef5d7042163ec 100644 --- a/recipes/kcp/all/test_package/conanfile.py +++ b/recipes/kcp/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,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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/kcp/all/test_v1_package/CMakeLists.txt b/recipes/kcp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/kcp/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/kcp/all/test_v1_package/conanfile.py b/recipes/kcp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..f8eeed898d7bd --- /dev/null +++ b/recipes/kcp/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_multi" + + 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) diff --git a/recipes/kdbindings/all/conandata.yml b/recipes/kdbindings/all/conandata.yml new file mode 100644 index 0000000000000..ee5ec1ceee917 --- /dev/null +++ b/recipes/kdbindings/all/conandata.yml @@ -0,0 +1,10 @@ +sources: + "1.1.0": + url: "https://github.com/KDAB/KDBindings/archive/refs/tags/v1.1.0.tar.gz" + sha256: "0ee07cb3e2ec4f5688b4b2971c42e5a4f4a41c7bf4aa130e6b118bea4b6340ab" + "1.0.5": + url: "https://github.com/KDAB/KDBindings/archive/refs/tags/v1.0.5.tar.gz" + sha256: "4d001419809a719f8c966e9bc73f457180325655deca0a11c07c47ee112447a3" + "1.0.3": + url: "https://github.com/KDAB/KDBindings/archive/refs/tags/v1.0.3.tar.gz" + sha256: "da8de679d12bf123df6a3c63a482a862d4122a2f3d3567c9b3b2fc2c4f574393" diff --git a/recipes/kdbindings/all/conanfile.py b/recipes/kdbindings/all/conanfile.py new file mode 100644 index 0000000000000..101357d6a2525 --- /dev/null +++ b/recipes/kdbindings/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 get, copy +from conan.tools.layout import basic_layout +from conan.tools.scm import Version +import os + +class KDBindingsConan(ConanFile): + name = "kdbindings" + license = "MIT" + description = "Reactive programming & data binding in C++" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/KDAB/KDBindings" + topics = ("c++17", "reactive", "kdab", "header-only") + package_type = "header-library" + 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": "9", + "clang": "7", + "apple-clang": "11", + "Visual Studio": "15.7", + "msvc": "191", + } + + def layout(self): + # src_folder must use the same source folder name than the project + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + 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++17, which your compiler does not support.") + + def package(self): + copy(self, "*.h", os.path.join(self.source_folder, "src","kdbindings"), os.path.join(self.package_folder, "include", "kdbindings")) + copy(self, "LICENSES/*", dst=os.path.join(self.package_folder,"licenses"), src=self.source_folder) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.set_property("cmake_file_name", "KDBindings") + self.cpp_info.set_property("cmake_target_name", "KDAB::KDBindings") + self.cpp_info.set_property("cmake_target_aliases", ["KDBindings"]) diff --git a/recipes/kdbindings/all/test_package/CMakeLists.txt b/recipes/kdbindings/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..cbd352d1e0df7 --- /dev/null +++ b/recipes/kdbindings/all/test_package/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(KDBindings REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} main.cpp) + +target_link_libraries(${PROJECT_NAME} PRIVATE KDAB::KDBindings) + +set_target_properties(${PROJECT_NAME} + PROPERTIES + CMAKE_INCLUDE_CURRENT_DIRS ON + CXX_STANDARD 17 + CXX_STANDARD_REQUIRED ON +) diff --git a/recipes/kdbindings/all/test_package/conanfile.py b/recipes/kdbindings/all/test_package/conanfile.py new file mode 100644 index 0000000000000..e845ae751a301 --- /dev/null +++ b/recipes/kdbindings/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/kdbindings/all/test_package/main.cpp b/recipes/kdbindings/all/test_package/main.cpp new file mode 100644 index 0000000000000..82e0dc503f17b --- /dev/null +++ b/recipes/kdbindings/all/test_package/main.cpp @@ -0,0 +1,63 @@ +/* + This file is part of KDBindings. + + SPDX-FileCopyrightText: 2021-2022 Klarälvdalens Datakonsult AB, a KDAB Group company + Author: Leon Matthes + + SPDX-License-Identifier: MIT + + Contact KDAB at for commercial licensing options. +*/ + +#include +#include + +#include +#include + +using namespace KDBindings; + +void display() +{ + std::cout << "Hello World!" << std::endl; +} + +void displayLabelled(const std::string &label, int value) +{ + std::cout << label << ": " << value << std::endl; +} + +class SignalHandler +{ +public: + bool received = 0; + + void receive() + { + received = true; + } +}; + +int main() +{ + Signal signal; + + // Signal::connect allows connecting functions that take too few arguments. + signal.connect(display); + + // As well as functions with too many arguments, as long as default values are provided. + signal.connect(displayLabelled, "Emitted value"); + + // This is very useful to connect member functions, where the first implicit argument + // is a pointer to the "this" object. + SignalHandler handler; + signal.connect(&SignalHandler::receive, &handler); + + // This will print "Hello World!" and "Emitted value: 5" in an unspecified order. + // It will also set handler.received to true + signal.emit(5); + + std::cout << std::boolalpha << handler.received << std::endl; + + return 0; +} diff --git a/recipes/kdbindings/config.yml b/recipes/kdbindings/config.yml new file mode 100644 index 0000000000000..39a3c40066d56 --- /dev/null +++ b/recipes/kdbindings/config.yml @@ -0,0 +1,7 @@ +versions: + "1.1.0": + folder: all + "1.0.5": + folder: all + "1.0.3": + folder: all diff --git a/recipes/kealib/all/CMakeLists.txt b/recipes/kealib/all/CMakeLists.txt deleted file mode 100644 index fd2f93f3b4298..0000000000000 --- a/recipes/kealib/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.5) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/kealib/all/conandata.yml b/recipes/kealib/all/conandata.yml index f812df3cfab60..d999ff7ca194b 100644 --- a/recipes/kealib/all/conandata.yml +++ b/recipes/kealib/all/conandata.yml @@ -1,14 +1,10 @@ sources: + "1.5.2": + url: "https://github.com/ubarsc/kealib/archive/refs/tags/kealib-1.5.2.tar.gz" + sha256: "f16a51007ab7612aa598de6ee2cac0aa4421040894777c8e57cb4a50ea552ab1" + "1.4.15": + url: "https://github.com/ubarsc/kealib/archive/kealib-1.4.15.tar.gz" + sha256: "fc7bd049663985e9528acd894724f0c730c84a3408d5bff3c0c0f01d7c6cd172" "1.4.14": url: "https://github.com/ubarsc/kealib/archive/kealib-1.4.14.tar.gz" sha256: "b3f73104acebe5304ecce5c19c1560def66fd5c448ce251e9486494baeb141bc" - "1.4.13": - url: "https://github.com/ubarsc/kealib/archive/kealib-1.4.13.tar.gz" - sha256: "2a254eb557a4ec20638a5134ed549a16b7f64977f37de3cf3853a206c8d82199" -patches: - "1.4.14": - - patch_file: "patches/fix-cmake-1.4.14.patch" - base_path: "source_subfolder" - "1.4.13": - - patch_file: "patches/fix-export-symbols-and-cmake.patch" - base_path: "source_subfolder" diff --git a/recipes/kealib/all/conanfile.py b/recipes/kealib/all/conanfile.py index 292c817544c7d..fb6eebf5cc31b 100644 --- a/recipes/kealib/all/conanfile.py +++ b/recipes/kealib/all/conanfile.py @@ -1,32 +1,38 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration import os -required_conan_version = ">=1.32.0" +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.microsoft import is_msvc +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" class KealibConan(ConanFile): name = "kealib" description = "C++ library providing complete access to the KEA image format." license = "MIT" - topics = ("conan", "kealib", "image", "raster") - homepage = "https://github.com/ubarsc/kealib" url = "https://github.com/conan-io/conan-center-index" - exports_sources = ["CMakeLists.txt", "patches/**"] - generators = "cmake" - settings = "os", "arch", "compiler", "build_type" - options = {"shared": [True, False], "fPIC": [True, False]} - default_options = {"shared": False, "fPIC": True} - - _cmake = None + homepage = "https://github.com/ubarsc/kealib" + topics = ("image", "raster") - @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 _build_subfolder(self): - return "build_subfolder" + def _min_cppstd(self): + return 11 def config_options(self): if self.settings.os == "Windows": @@ -34,41 +40,62 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") self.options["hdf5"].enable_cxx = True self.options["hdf5"].hl = True + def layout(self): + cmake_layout(self, src_folder="src") + def requirements(self): - self.requires("hdf5/1.12.0") + self.requires("hdf5/1.14.3", transitive_headers=True, transitive_libs=True) def validate(self): - if not (self.options["hdf5"].enable_cxx and self.options["hdf5"].hl): - raise ConanInvalidConfiguration("kealib requires hdf5 with cxx and hl enabled.") + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + hdf5_opts = self.dependencies["hdf5"].options + if not (hdf5_opts.enable_cxx and hdf5_opts.hl): + raise ConanInvalidConfiguration(f"{self.ref} requires dependencies options -o 'hdf5/*:enable_cxx=True' -o 'hdf5/*:hl=True'") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename("{0}-{0}-{1}".format(self.name, self.version), self._source_subfolder) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["HDF5_USE_STATIC_LIBRARIES"] = not self.options["hdf5"].shared - self._cmake.definitions["HDF5_PREFER_PARALLEL"] = False # TODO: rely on self.options["hdf5"].parallel when implemented in hdf5 recipe - self._cmake.definitions["LIBKEA_WITH_GDAL"] = False - 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["HDF5_USE_STATIC_LIBRARIES"] = not self.dependencies["hdf5"].options.shared + tc.variables["HDF5_PREFER_PARALLEL"] = self.dependencies["hdf5"].options.parallel + tc.variables["HDF5_THREADSAFE"] = self.dependencies["hdf5"].options.get_safe("threadsafe", False) + tc.variables["LIBKEA_WITH_GDAL"] = False + # INFO: kealib uses C++11 but does not configure in cmake: https://github.com/ubarsc/kealib/pull/48 + if not valid_min_cppstd(self, self._min_cppstd): + tc.variables["CMAKE_CXX_STANDARD"] = self._min_cppstd + 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() + 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() + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) + if is_msvc(self): + if not self.options.shared and Version(self.version) <= "1.4.14": + self.cpp_info.libs = ["liblibkea"] + else: + self.cpp_info.libs = ["libkea"] + else: + self.cpp_info.libs = ["kea"] + + if self.settings.os == "Windows": + self.cpp_info.system_libs.append("shlwapi") diff --git a/recipes/kealib/all/patches/fix-cmake-1.4.14.patch b/recipes/kealib/all/patches/fix-cmake-1.4.14.patch deleted file mode 100644 index 40e8ed0c1a606..0000000000000 --- a/recipes/kealib/all/patches/fix-cmake-1.4.14.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -30,7 +30,7 @@ source_group("include_kea" FILES ${LIBKEA_H}) - ############################################################################### - # Build, link and install library - add_library(${LIBKEA_LIB_NAME} ${LIBKEA_CPP} ${LIBKEA_H} ) --target_link_libraries(${LIBKEA_LIB_NAME} ${HDF5_LIBRARIES} ${HDF5_HL_LIBRARIES}) -+target_link_libraries(${LIBKEA_LIB_NAME} ${CONAN_LIBS}) - - include(GenerateExportHeader) - generate_export_header(${LIBKEA_LIB_NAME} -@@ -63,8 +63,6 @@ target_link_libraries(Kealib INTERFACE "${LIBKEA_LIB_NAME}") - ############################################################################### - # Testing - # exe needs to be in 'src' otherwise it doesn't work --add_executable (test1 ${PROJECT_SOURCE_DIR}/src/tests/test1.cpp) --target_link_libraries (test1 ${LIBKEA_LIB_NAME}) - ############################################################################### - - ############################################################################### diff --git a/recipes/kealib/all/patches/fix-export-symbols-and-cmake.patch b/recipes/kealib/all/patches/fix-export-symbols-and-cmake.patch deleted file mode 100644 index 0107ba1879496..0000000000000 --- a/recipes/kealib/all/patches/fix-export-symbols-and-cmake.patch +++ /dev/null @@ -1,219 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -52,14 +52,7 @@ set (LIBKEA_PACKAGE_BUGREPORT "petebunting@mac.com") - set (LIBKEA_PACKAGE "LibKEA") - set (LIBKEA_COPYRIGHT_YEAR 2013) - --if(MSVC) -- # set Name of C++ library -- # this forces it to be libkea on Windows with VC -- set(LIBKEA_LIB_NAME libkea) --else() -- # set Name of C++ library -- set(LIBKEA_LIB_NAME kea) --endif() -+set(LIBKEA_LIB_NAME kea) - - include(CMakeDependentOption) - # CMake global option valiable -@@ -195,11 +188,11 @@ endif(MSVC) - - ############################################################################### - # Setup configure file --configure_file ( "${PROJECT_HEADER_DIR}/kea-config.h.in" "${CMAKE_BINARY_DIR}/${PROJECT_HEADER_DIR}/libkea/kea-config.h" ) -+configure_file ( "${PROJECT_HEADER_DIR}/kea-config.h.in" "${CMAKE_CURRENT_BINARY_DIR}/include/libkea/kea-config.h" ) - if(MSVC) -- configure_file ( "${PROJECT_TOOLS_DIR}/kea-config.bat.in" "${CMAKE_BINARY_DIR}/${PROJECT_BINARY_DIR}/kea-config.bat" ) -+ configure_file ( "${PROJECT_TOOLS_DIR}/kea-config.bat.in" "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_BINARY_DIR}/kea-config.bat" ) - else() -- configure_file ( "${PROJECT_TOOLS_DIR}/kea-config.in" "${CMAKE_BINARY_DIR}/${PROJECT_BINARY_DIR}/kea-config" ) -+ configure_file ( "${PROJECT_TOOLS_DIR}/kea-config.in" "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_BINARY_DIR}/kea-config" ) - endif(MSVC) - ############################################################################### - -@@ -213,7 +206,7 @@ endif(MSVC) - # Build library - - include_directories ("${PROJECT_HEADER_DIR}") --include_directories ("${CMAKE_BINARY_DIR}/${PROJECT_HEADER_DIR}") -+include_directories ("${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_HEADER_DIR}") - include_directories(${HDF5_INCLUDE_DIRS}) - add_subdirectory ("${PROJECT_SOURCE_DIR}") - if (LIBKEA_WITH_GDAL) -@@ -234,7 +227,7 @@ if(MSVC) - else() - install (FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_BINARY_DIR}/kea-config" DESTINATION bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) - endif(MSVC) --install (FILES "${CMAKE_BINARY_DIR}/${PROJECT_HEADER_DIR}/libkea/kea-config.h" DESTINATION include/libkea) -+install (FILES "${CMAKE_CURRENT_BINARY_DIR}/include/libkea/kea-config.h" DESTINATION include/libkea) - ############################################################################### - - ############################################################################### ---- a/include/libkea/KEAAttributeTable.h -+++ b/include/libkea/KEAAttributeTable.h -@@ -98,7 +98,7 @@ namespace kealib{ - void *p; - } VarLenFieldHDF; - -- class DllExport KEAAttributeTable -+ class KEA_EXPORT KEAAttributeTable - { - public: - KEAAttributeTable(KEAATTType keaAttType); ---- a/include/libkea/KEAAttributeTableFile.h -+++ b/include/libkea/KEAAttributeTableFile.h -@@ -43,7 +43,7 @@ - - namespace kealib{ - -- class DllExport KEAAttributeTableFile : public KEAAttributeTable -+ class KEA_EXPORT KEAAttributeTableFile : public KEAAttributeTable - { - public: - KEAAttributeTableFile(H5::H5File *keaImgIn, const std::string &bandPathBaseIn, size_t numRowsIn, size_t chunkSizeIn, unsigned int deflateIn=KEA_DEFLATE); ---- a/include/libkea/KEAAttributeTableInMem.h -+++ b/include/libkea/KEAAttributeTableInMem.h -@@ -43,7 +43,7 @@ - - namespace kealib{ - -- class DllExport KEAAttributeTableInMem : public KEAAttributeTable -+ class KEA_EXPORT KEAAttributeTableInMem : public KEAAttributeTable - { - public: - KEAAttributeTableInMem(); ---- a/include/libkea/KEACommon.h -+++ b/include/libkea/KEACommon.h -@@ -38,15 +38,7 @@ - - #include "H5Cpp.h" - --// mark all exported classes/functions with DllExport to have --// them exported by Visual Studio --#ifndef DllExport -- #ifdef _MSC_VER -- #define DllExport __declspec( dllexport ) -- #else -- #define DllExport -- #endif --#endif -+#include "libkea/kea_export.h" - - // MSVC 2008 uses different names.... - #ifdef _MSC_VER ---- a/include/libkea/KEAException.h -+++ b/include/libkea/KEAException.h -@@ -37,7 +37,7 @@ - - namespace kealib - { -- class DllExport KEAException : public std::exception -+ class KEA_EXPORT KEAException : public std::exception - { - public: - KEAException() : exception() {msgs = "A KEAException has been created.";}; -@@ -49,7 +49,7 @@ namespace kealib - std::string msgs; - }; - -- class DllExport KEAIOException : public KEAException -+ class KEA_EXPORT KEAIOException : public KEAException - { - public: - KEAIOException() : KEAException("KEAIOException has been created."){}; -@@ -58,7 +58,7 @@ namespace kealib - ~KEAIOException() throw() {}; - }; - -- class DllExport KEAATTException : public KEAException -+ class KEA_EXPORT KEAATTException : public KEAException - { - public: - KEAATTException() : KEAException("KEAATTException has been created."){}; ---- a/include/libkea/KEAImageIO.h -+++ b/include/libkea/KEAImageIO.h -@@ -45,7 +45,7 @@ - - namespace kealib{ - -- class DllExport KEAImageIO -+ class KEA_EXPORT KEAImageIO - { - public: - KEAImageIO(); -@@ -171,7 +171,7 @@ namespace kealib{ - } - - // returns the current KEA version as a double --extern "C" DllExport double get_kealibversion(); -+extern "C" KEA_EXPORT double get_kealibversion(); - - #endif - ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -30,34 +30,37 @@ source_group("include_kea" FILES ${LIBKEA_H}) - ############################################################################### - # Build, link and install library - add_library(${LIBKEA_LIB_NAME} ${LIBKEA_CPP} ${LIBKEA_H} ) --target_link_libraries(${LIBKEA_LIB_NAME} ${HDF5_LIBRARIES} ${HDF5_HL_LIBRARIES}) -+target_link_libraries(${LIBKEA_LIB_NAME} ${CONAN_LIBS}) - --if(BUILD_SHARED_LIBS) -- SET_TARGET_PROPERTIES(${LIBKEA_LIB_NAME} -- PROPERTIES -- SOVERSION ${LIBKEA_VERSION_MAJOR}.${LIBKEA_VERSION_MINOR} -- VERSION ${LIBKEA_VERSION} -- CLEAN_DIRECT_OUTPUT 1) --else() -- SET_TARGET_PROPERTIES(${LIBKEA_LIB_NAME} -- PROPERTIES -- OUTPUT_NAME "${LIBKEA_LIB_NAME}" -- PREFIX "lib" -- VERSION ${LIBKEA_VERSION} -- CLEAN_DIRECT_OUTPUT 1) -+include(GenerateExportHeader) -+generate_export_header(${LIBKEA_LIB_NAME} -+ EXPORT_MACRO_NAME KEA_EXPORT -+ EXPORT_FILE_NAME ${CMAKE_CURRENT_BINARY_DIR}/include/libkea/kea_export.h -+) -+target_include_directories(${LIBKEA_LIB_NAME} PUBLIC -+ $ -+ $ -+ $ -+) -+set_target_properties(${LIBKEA_LIB_NAME} -+ PROPERTIES -+ CXX_VISIBILITY_PRESET hidden -+ VISIBILITY_INLINES_HIDDEN 1 -+ PREFIX "lib" -+ IMPORT_PREFIX "lib" -+ SOVERSION ${LIBKEA_VERSION_MAJOR}.${LIBKEA_VERSION_MINOR} -+ VERSION ${LIBKEA_VERSION} -+) -+if(MSVC AND NOT BUILD_SHARED_LIBS) -+ set_target_properties(${LIBKEA_LIB_NAME} PROPERTIES OUTPUT_NAME "libkea") - endif() - add_library(Kealib INTERFACE) - target_link_libraries(Kealib INTERFACE "${LIBKEA_LIB_NAME}") --target_include_directories(Kealib INTERFACE -- $ -- $) - ############################################################################### - - ############################################################################### - # Testing - # exe needs to be in 'src' otherwise it doesn't work --add_executable (test1 ${CMAKE_SOURCE_DIR}/src/tests/test1.cpp) --target_link_libraries (test1 ${LIBKEA_LIB_NAME}) - - ############################################################################### - # Set target properties -@@ -76,5 +79,6 @@ install (TARGETS ${LIBKEA_LIB_NAME} - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib) --install (FILES ${LIBKEA_H} DESTINATION include/libkea) -+install (FILES ${LIBKEA_H} ${CMAKE_CURRENT_BINARY_DIR}/include/libkea/kea_export.h -+ DESTINATION include/libkea) - ############################################################################### diff --git a/recipes/kealib/all/test_package/CMakeLists.txt b/recipes/kealib/all/test_package/CMakeLists.txt index 196188113685c..0d6f2bcf3918c 100644 --- a/recipes/kealib/all/test_package/CMakeLists.txt +++ b/recipes/kealib/all/test_package/CMakeLists.txt @@ -1,8 +1,8 @@ -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() +find_package(kealib REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE kealib::kealib) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/kealib/all/test_package/conanfile.py b/recipes/kealib/all/test_package/conanfile.py index ea57a464900be..ef5d7042163ec 100644 --- a/recipes/kealib/all/test_package/conanfile.py +++ b/recipes/kealib/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" + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/kealib/all/test_package/test_package.cpp b/recipes/kealib/all/test_package/test_package.cpp index ed6447aec5e35..4a9b2a79bfb1a 100644 --- a/recipes/kealib/all/test_package/test_package.cpp +++ b/recipes/kealib/all/test_package/test_package.cpp @@ -7,23 +7,23 @@ * * This file is part of LibKEA. * - * 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 + * 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 + * 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 + * 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. * */ @@ -42,7 +42,7 @@ int main() try { kealib::KEAImageIO io; - H5::H5File *h5file = kealib::KEAImageIO::createKEAImage("bob.kea", + H5::H5File *h5file = kealib::KEAImageIO::createKEAImage("bob.kea", kealib::kea_8uint, IMG_XSIZE, IMG_YSIZE, 1); io.openKEAImageHeader(h5file); @@ -52,7 +52,7 @@ int main() { pData[i] = rand() % 255; } - io.writeImageBlock2Band(1, pData, 0, 0, IMG_XSIZE, IMG_YSIZE, + io.writeImageBlock2Band(1, pData, 0, 0, IMG_XSIZE, IMG_YSIZE, IMG_XSIZE, IMG_YSIZE, kealib::kea_8uint); free(pData); diff --git a/recipes/kealib/all/test_v1_package/CMakeLists.txt b/recipes/kealib/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/kealib/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/kealib/all/test_v1_package/conanfile.py b/recipes/kealib/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..84ee68733e516 --- /dev/null +++ b/recipes/kealib/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.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/kealib/config.yml b/recipes/kealib/config.yml index 46b5f6a142b86..d8de052a2b5a1 100644 --- a/recipes/kealib/config.yml +++ b/recipes/kealib/config.yml @@ -1,5 +1,7 @@ versions: - "1.4.14": + "1.5.2": + folder: all + "1.4.15": folder: all - "1.4.13": + "1.4.14": folder: all diff --git a/recipes/keychain/all/CMakeLists.txt b/recipes/keychain/all/CMakeLists.txt deleted file mode 100644 index 1848ca5a77c35..0000000000000 --- a/recipes/keychain/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/keychain/all/conandata.yml b/recipes/keychain/all/conandata.yml index b28baa662e7b6..f10687c09e1bc 100644 --- a/recipes/keychain/all/conandata.yml +++ b/recipes/keychain/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "1.3.0": + url: "https://github.com/hrantzsch/keychain/archive/refs/tags/v1.3.0.tar.gz" + sha256: "0e2eb3c6ca2c62253f7d28a478d0cb3eeb4b9656b33d2946e1a294361f72809c" + "1.2.1": + url: "https://github.com/hrantzsch/keychain/archive/v1.2.1.tar.gz" + sha256: "725cc30da0451403713dee648edd06686fdc31b5041e75e3350e6056c78de076" "1.2.0": url: "https://github.com/hrantzsch/keychain/archive/v1.2.0.tar.gz" sha256: "82cc66a7fa12af43f3e2efeb378bacb0a514056617e369430f252da2392acaae" diff --git a/recipes/keychain/all/conanfile.py b/recipes/keychain/all/conanfile.py index d6ff7829ddf3c..5a1130d8d16d6 100644 --- a/recipes/keychain/all/conanfile.py +++ b/recipes/keychain/all/conanfile.py @@ -1,62 +1,90 @@ -from conans import ConanFile, CMake, tools import os +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 collect_libs, copy, get, replace_in_file +from conan.tools.gnu import PkgConfigDeps + + class KeychainConan(ConanFile): name = "keychain" - homepage = "https://github.com/hrantzsch/keychain" - description = "A cross-platform wrapper for the operating system's credential storage" - topics = ("conan", "keychain", "security", "credentials", "password", "cpp11") - url = "https://github.com/conan-io/conan-center-index" + description = ( + "A cross-platform wrapper for the operating system's credential storage" + ) license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/hrantzsch/keychain" + topics = ("keychain", "security", "credentials", "password", "cpp11") + package_type = "library" settings = "os", "arch", "compiler", "build_type" - exports_sources = ["CMakeLists.txt"] - generators = "cmake", "pkg_config" - options = {'fPIC': [False, True]} - default_options = {'fPIC': True} + options = {"shared": [False, True], "fPIC": [False, True]} + 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 configure(self): - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 11) + if self.options.shared: + 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 requirements(self): if self.settings.os == "Linux": - self.requires("libsecret/0.20.4") + self.requires("libsecret/0.20.5") + self.requires("glib/2.78.3") + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) def build_requirements(self): if self.settings.os == "Linux": - self.build_requires("pkgconf/1.7.3") + self.tool_requires("pkgconf/2.0.3") 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], strip_root=True) + # Ensure .dll is installed on Windows + replace_in_file( + self, + os.path.join(self.source_folder, "CMakeLists.txt"), + "TARGETS ${PROJECT_NAME}", + "TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin", + ) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["BUILD_TESTS"] = False - cmake.configure() - return cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTS"] = False + # Export all symbols by default to allow generating a shared library with msvc + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + tc.generate() + pc = PkgConfigDeps(self) + pc.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() def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = collect_libs(self) - if self.settings.os == 'Macos': - self.cpp_info.frameworks = ['Security', 'CoreFoundation'] + if self.settings.os == "Macos": + self.cpp_info.frameworks = ["Security", "CoreFoundation"] if self.settings.os == "Windows": - self.cpp_info.system_libs = ['crypt32'] + self.cpp_info.system_libs = ["crypt32"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs = ["m"] diff --git a/recipes/keychain/all/test_package/CMakeLists.txt b/recipes/keychain/all/test_package/CMakeLists.txt index 8a9dd0b5b3015..84121712cf11b 100644 --- a/recipes/keychain/all/test_package/CMakeLists.txt +++ b/recipes/keychain/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -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() +find_package(keychain CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) -set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED ON) +target_link_libraries(${PROJECT_NAME} keychain::keychain) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/keychain/all/test_package/conanfile.py b/recipes/keychain/all/test_package/conanfile.py index bd7165a553cf4..e0f3e3cf43edb 100644 --- a/recipes/keychain/all/test_package/conanfile.py +++ b/recipes/keychain/all/test_package/conanfile.py @@ -1,17 +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, cmake_layout + 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 build(self): cmake = CMake(self) 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 can_run(self): + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/keychain/all/test_package/test_package.cpp b/recipes/keychain/all/test_package/test_package.cpp index b28378d16ed4a..fef9682a48345 100644 --- a/recipes/keychain/all/test_package/test_package.cpp +++ b/recipes/keychain/all/test_package/test_package.cpp @@ -1,4 +1,5 @@ #include +#include using namespace keychain; @@ -13,5 +14,7 @@ void never_called(Error &error) { int main() { Error error; + + std::cout << "Keychain Conan test_package\n"; return error.type == ErrorType::NoError ? 0 : 1; } diff --git a/recipes/keychain/config.yml b/recipes/keychain/config.yml index 7ed1f1b6fc695..21c776e737e77 100644 --- a/recipes/keychain/config.yml +++ b/recipes/keychain/config.yml @@ -1,3 +1,7 @@ versions: + "1.3.0": + folder: all + "1.2.1": + folder: all "1.2.0": folder: all diff --git a/recipes/keystone/all/conandata.yml b/recipes/keystone/all/conandata.yml new file mode 100644 index 0000000000000..293bb6907aa2e --- /dev/null +++ b/recipes/keystone/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.9.2": + url: "https://github.com/keystone-engine/keystone/archive/refs/tags/0.9.2.tar.gz" + sha256: "c9b3a343ed3e05ee168d29daf89820aff9effb2c74c6803c2d9e21d55b5b7c24" diff --git a/recipes/keystone/all/conanfile.py b/recipes/keystone/all/conanfile.py new file mode 100644 index 0000000000000..a4075c2b51be6 --- /dev/null +++ b/recipes/keystone/all/conanfile.py @@ -0,0 +1,93 @@ +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, is_msvc_static_runtime +from conan.tools.build import check_max_cppstd +import os + +required_conan_version = ">=2.0" + + +class KeystoneConan(ConanFile): + name = "keystone" + description = ( + "Keystone assembler framework: Core (Arm, Arm64, Hexagon, " + "Mips, PowerPC, Sparc, SystemZ & X86) + bindings." + ) + license = ( "GPL-2.0-only", "DocumentRef-EXCEPTIONS-CLIENT:LicenseRef-FOSS-License-Exception" ) + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://www.keystone-engine.org" + topics = ( + "security", + "arm", + "framework", + "mips", + "x86-64", + "reverse-engineering", + "assembler", + "x86", + "hexagon", + "arm64", + "sparc", + "powerpc", + "systemz" + ) + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + implements = ["auto_shared_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 validate(self): + # INFO: include/llvm/ADT/STLExtras.h:54:34: error: no template named 'binary_function' in namespace 'std' + # The std::binary_function was removed in C++17 + check_max_cppstd(self, 14) + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["BUILD_LIBS_ONLY"] = True + tc.cache_variables["KEYSTONE_BUILD_STATIC_RUNTIME"] = is_msvc_static_runtime(self) + 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"), + ) + copy( + self, + "EXCEPTIONS-CLIENT", + 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", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + + def package_info(self): + self.cpp_info.libs = ["keystone"] + if is_msvc(self) and self.options.shared: + self.cpp_info.bindirs = ["lib"] + if self.settings.os == "Windows": + self.cpp_info.system_libs = ["shell32", "ole32", "uuid"] diff --git a/recipes/keystone/all/test_package/CMakeLists.txt b/recipes/keystone/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..fa5c67fc76107 --- /dev/null +++ b/recipes/keystone/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(keystone REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE keystone::keystone) diff --git a/recipes/keystone/all/test_package/conanfile.py b/recipes/keystone/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0a6bc68712d90 --- /dev/null +++ b/recipes/keystone/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/keystone/all/test_package/test_package.cpp b/recipes/keystone/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..979bb61f8423f --- /dev/null +++ b/recipes/keystone/all/test_package/test_package.cpp @@ -0,0 +1,10 @@ +#include +#include + +int main() +{ + unsigned int major = 0, minor = 0; + ks_version(&major, &minor); + std::cout << "Keystone version: " << major << "." << minor << std::endl; + return EXIT_SUCCESS; +} diff --git a/recipes/keystone/config.yml b/recipes/keystone/config.yml new file mode 100644 index 0000000000000..6adb5bb604435 --- /dev/null +++ b/recipes/keystone/config.yml @@ -0,0 +1,3 @@ +versions: + "0.9.2": + folder: "all" diff --git a/recipes/khrplatform/all/conanfile.py b/recipes/khrplatform/all/conanfile.py index 4125f97c39bdb..8a3e15b829a64 100644 --- a/recipes/khrplatform/all/conanfile.py +++ b/recipes/khrplatform/all/conanfile.py @@ -13,6 +13,7 @@ class KhrplatformConan(ConanFile): homepage = "https://www.khronos.org/registry/EGL/" description = "Khronos EGL platform interfaces" topics = ("opengl", "gl", "egl", "khr", "khronos") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True diff --git a/recipes/kickcat/all/conandata.yml b/recipes/kickcat/all/conandata.yml new file mode 100644 index 0000000000000..26db9ceb70f4e --- /dev/null +++ b/recipes/kickcat/all/conandata.yml @@ -0,0 +1,10 @@ +sources: + "v2.0-rc1": + url: "https://github.com/leducp/KickCAT/archive/refs/tags/v2.0-rc1.zip" + sha256: "3feec08fd2718d286a041cb83266479840f7739c1203b4450375ea1f59f234c8" + "v2-alpha4": + url: "https://github.com/leducp/KickCAT/archive/refs/tags/v2-alpha4.zip" + sha256: "483a374f77808cb35823652eb37c5ab864a3f12a1c3a957d3315c319ca0ec528" + "v2-alpha3": + url: "https://github.com/leducp/KickCAT/archive/refs/tags/v2-alpha3.zip" + sha256: "dadd8518c3232162b7455fdcd837578120ece5a42c3bc2701147a68cbee60da4" diff --git a/recipes/kickcat/all/conanfile.py b/recipes/kickcat/all/conanfile.py new file mode 100644 index 0000000000000..abaf5d422d588 --- /dev/null +++ b/recipes/kickcat/all/conanfile.py @@ -0,0 +1,74 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout +from conan.tools.files import get, copy +from conan.tools.scm import Version +import os + +required_conan_version = ">=1.55" + + +class KickCATRecipe(ConanFile): + name = "kickcat" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/Siviuze/KickCAT" + description = "Thin EtherCAT stack designed to be embedded in a more complex software and with efficiency in mind" + license = "CeCILL-C" + topics = ("ethercat") + package_type = "library" + settings = "os", "compiler", "build_type", "arch" + options = {"shared": [True, False], "fPIC": [True, False]} + default_options = {"shared": False, "fPIC": True} + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def configure(self): + if self.options.get_safe("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, 17) + + if self.settings.os != "Linux": + raise ConanInvalidConfiguration( + f"{self.ref} is not supported on {self.settings.os}.") + + if self.settings.compiler != "gcc": + raise ConanInvalidConfiguration( + f"{self.ref} is not supported on {self.settings.compiler}.") + + if self.settings.compiler == 'gcc' and Version(self.settings.compiler.version) < "7": + raise ConanInvalidConfiguration("Building requires GCC >= 7") + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["BUILD_UNIT_TESTS"] = "OFF" + tc.cache_variables["BUILD_EXAMPLES"] = "OFF" + tc.cache_variables["BUILD_SIMULATION"] = "OFF" + tc.cache_variables["BUILD_TOOLS"] = "OFF" + tc.cache_variables["DEBUG"] = "OFF" + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "*.h", os.path.join(self.source_folder, "include"), + os.path.join(self.package_folder, "include")) + copy(self, "*.a", self.build_folder, + os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, "*.so", self.build_folder, + os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, "LICENSE", self.source_folder, + os.path.join(self.package_folder, "licenses")) + + def package_info(self): + self.cpp_info.libs = ["kickcat"] diff --git a/recipes/kickcat/all/test_package/CMakeLists.txt b/recipes/kickcat/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..8b77c31d9ca12 --- /dev/null +++ b/recipes/kickcat/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +set(CMAKE_CXX_STANDARD 17) + +find_package(kickcat REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cc) +target_link_libraries(${PROJECT_NAME} PRIVATE kickcat::kickcat) diff --git a/recipes/kickcat/all/test_package/conanfile.py b/recipes/kickcat/all/test_package/conanfile.py new file mode 100644 index 0000000000000..e46a141327eed --- /dev/null +++ b/recipes/kickcat/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" + + 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/kickcat/all/test_package/test_package.cc b/recipes/kickcat/all/test_package/test_package.cc new file mode 100644 index 0000000000000..a0ac4c8fdf423 --- /dev/null +++ b/recipes/kickcat/all/test_package/test_package.cc @@ -0,0 +1,32 @@ +#include "kickcat/Bus.h" +#include "kickcat/Link.h" +#include "kickcat/Prints.h" +#include "kickcat/SocketNull.h" + +#include + +using namespace kickcat; + +int main(int argc, char *argv[]) +{ + std::shared_ptr socket = std::make_shared(); + try + { + socket->open("null"); + } + catch (std::exception const &e) + { + std::cerr << e.what() << std::endl; + return 1; + } + + auto report_redundancy = []() { + }; + + std::shared_ptr link = std::make_shared(socket, socket, report_redundancy); + link->setTimeout(2ms); + link->checkRedundancyNeeded(); + + Bus bus(link); + return 0; +} diff --git a/recipes/kickcat/config.yml b/recipes/kickcat/config.yml new file mode 100644 index 0000000000000..8eaf698f74187 --- /dev/null +++ b/recipes/kickcat/config.yml @@ -0,0 +1,7 @@ +versions: + "v2.0-rc1": + folder: all + "v2-alpha4": + folder: all + "v2-alpha3": + folder: all 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/kitten/all/CMakeLists.txt b/recipes/kitten/all/CMakeLists.txt deleted file mode 100644 index d17aaff199b4a..0000000000000 --- a/recipes/kitten/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/kitten/all/conanfile.py b/recipes/kitten/all/conanfile.py index 7db05a55fbcac..04b20a94ca5f9 100644 --- a/recipes/kitten/all/conanfile.py +++ b/recipes/kitten/all/conanfile.py @@ -1,28 +1,30 @@ -from conans import ConanFile, CMake, 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.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, rmdir +from conan.tools.scm import Version + +required_conan_version = ">=1.52.0" class KittenConan(ConanFile): name = "kitten" description = "A small C++ library inspired by Category Theory focused on functional composition." - homepage = "https://github.com/rvarago/kitten" - url = "https://github.com/conan-io/conan-center-index" license = "MIT" - topics = ("category-theory", "composition", "monadic-interface", "declarative-programming") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/rvarago/kitten" + topics = ("category-theory", "composition", "monadic-interface", "declarative-programming", "header-only") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" - no_copy_source = True - exports_sources = "CMakeLists.txt" - generators = "cmake" - _cmake = None @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 17 @property def _minimum_compilers_version(self): @@ -33,50 +35,46 @@ def _minimum_compilers_version(self): "apple-clang": "10", } + def layout(self): + cmake_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) - - 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] + check_min_cppstd(self, self._min_cppstd) 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): - raise ConanInvalidConfiguration( - "{} requires C++17, which your compiler does not support.".format(self.name) - ) - - def package_id(self): - self.info.header_only() + if min_version and Version(self.settings.compiler.version) < min_version: + raise ConanInvalidConfiguration(f"{self.name} 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 _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BUILD_TESTS"] = False - self._cmake.configure() - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTS"] = False + 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) - 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.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.set_property("cmake_file_name", "kitten") self.cpp_info.set_property("cmake_target_name", "rvarago::kitten") + self.cpp_info.components["libkitten"].set_property("cmake_target_name", "rvarago::kitten") # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.filenames["cmake_find_package"] = "kitten" @@ -85,4 +83,3 @@ def package_info(self): self.cpp_info.names["cmake_find_package_multi"] = "rvarago" self.cpp_info.components["libkitten"].names["cmake_find_package"] = "kitten" self.cpp_info.components["libkitten"].names["cmake_find_package_multi"] = "kitten" - self.cpp_info.components["libkitten"].set_property("cmake_target_name", "rvarago::kitten") diff --git a/recipes/kitten/all/test_package/CMakeLists.txt b/recipes/kitten/all/test_package/CMakeLists.txt index 60b5b3b426db6..8f30ef6f01138 100644 --- a/recipes/kitten/all/test_package/CMakeLists.txt +++ b/recipes/kitten/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.15) project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(kitten REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/kitten/all/test_package/conanfile.py b/recipes/kitten/all/test_package/conanfile.py index 38f4483872d47..ef5d7042163ec 100644 --- a/recipes/kitten/all/test_package/conanfile.py +++ b/recipes/kitten/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/kitten/all/test_package/test_package.cpp b/recipes/kitten/all/test_package/test_package.cpp index 8ddfae2423dd7..50559e2a32b1d 100644 --- a/recipes/kitten/all/test_package/test_package.cpp +++ b/recipes/kitten/all/test_package/test_package.cpp @@ -1,14 +1,15 @@ +#include "kitten/instances/optional.h" +#include "kitten/kitten.h" + #include #include -#include "kitten/kitten.h" -#include "kitten/instances/optional.h" - using namespace rvarago::kitten; int main() { auto constexpr maybe_an_approximate_answer = std::optional{41}; - auto constexpr exact_answer = (maybe_an_approximate_answer | [](auto const& el) { return el + 1; }).value(); + auto constexpr exact_answer = + (maybe_an_approximate_answer | [](auto const& el) { return el + 1; }).value(); static_assert(42 == exact_answer); std::cout << "rvarago::kitten works! The exact answer is: " << exact_answer << '\n'; return 0; diff --git a/recipes/kitten/all/test_v1_package/CMakeLists.txt b/recipes/kitten/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/kitten/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/kitten/all/test_v1_package/conanfile.py b/recipes/kitten/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/kitten/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/kmod/all/conandata.yml b/recipes/kmod/all/conandata.yml index adea0f2044a1e..e2d88fd85c718 100644 --- a/recipes/kmod/all/conandata.yml +++ b/recipes/kmod/all/conandata.yml @@ -1,7 +1,10 @@ sources: + "31": + url: "https://kernel.org/pub/linux/utils/kernel/kmod/kmod-31.tar.xz" + sha256: "f5a6949043cc72c001b728d8c218609c5a15f3c33d75614b78c79418fcf00d80" "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 26122c967dc44..9877db42cb118 100644 --- a/recipes/kmod/all/conanfile.py +++ b/recipes/kmod/all/conanfile.py @@ -2,7 +2,7 @@ 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, rm, rmdir, save +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 @@ -17,9 +17,9 @@ class KModConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/kmod-project/kmod" license = "LGPL-2.1-only" + package_type = "shared-library" settings = "os", "arch", "compiler", "build_type" options = { - "fPIC": [True, False], "with_zstd": [True, False], "with_xz": [True, False], "with_zlib": [True, False], @@ -28,7 +28,6 @@ class KModConan(ConanFile): "logging": [True, False], } default_options = { - "fPIC": True, "with_zstd": True, "with_xz": True, "with_zlib": True, @@ -46,24 +45,24 @@ def layout(self): def requirements(self): if self.options.with_zstd: - self.requires("zstd/1.5.2") + self.requires("zstd/1.5.5") if self.options.with_xz: - self.requires("xz_utils/5.2.5") + self.requires("xz_utils/5.4.4") if self.options.with_zlib: - self.requires("zlib/1.2.13") + self.requires("zlib/[>=1.2.11 <2]") if self.options.with_openssl: - self.requires("openssl/3.0.7") + self.requires("openssl/[>=1.1 <4]") def validate(self): - if self.info.settings.os != "Linux": + 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.9.3") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/2.0.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) @@ -93,9 +92,7 @@ def generate(self): tc.generate() 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/config.yml b/recipes/kmod/config.yml index 61353908a11fc..6c4bbbc0156bb 100644 --- a/recipes/kmod/config.yml +++ b/recipes/kmod/config.yml @@ -1,4 +1,6 @@ versions: + "31": + folder: all "30": folder: all "29": diff --git a/recipes/kplot/all/CMakeLists.txt b/recipes/kplot/all/CMakeLists.txt new file mode 100644 index 0000000000000..d9ac5598dcf53 --- /dev/null +++ b/recipes/kplot/all/CMakeLists.txt @@ -0,0 +1,59 @@ +cmake_minimum_required(VERSION 3.15) +project(kplot LANGUAGES C) + +find_package(cairo REQUIRED CONFIG) + +set(kplot_src + colours.c + array.c + border.c + bucket.c + buffer.c + draw.c + grid.c + hist.c + label.c + kdata.c + kplot.c + margin.c + mean.c + plotctx.c + reallocarray.c + stddev.c + tic.c + vector.c +) + +set(kplot_inc + compat.h + extern.h + kplot.h +) + +try_run(HAVE_reallocarray COMPIE_reallocarray ${CMAKE_BINARY_DIR} "${CMAKE_SOURCE_DIR}/test-reallocarray.c") +file(READ compat.pre.h COMPAT_CONTENTS) +file(WRITE compat.h "${COMPAT_CONTENTS}") +if (COMPIE_reallocarray AND NOT HAVE_reallocarray) + file(APPEND compat.h "#define HAVE_REALLOCARRAY") +endif() +file(READ compat.post.h COMPAT_CONTENTS) +file(APPEND 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..e7de72e829781 --- /dev/null +++ b/recipes/kplot/all/conanfile.py @@ -0,0 +1,71 @@ +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") + 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): + copy(self, "CMakeLists.txt", self.recipe_folder, os.path.join(self.export_sources_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") + 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", transitive_headers=True) + + def source(self): + 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): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE.md", self.source_folder, os.path.join(self.package_folder, "licenses")) + 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..1823d8d11f41d --- /dev/null +++ b/recipes/kplot/all/test_package/test_package.c @@ -0,0 +1,11 @@ +// Both are required by kplot.h +#include +#include + +#include + +int main() { + struct kpair points1[50]; + struct kdata* d1 = kdata_array_alloc(points1, 50); + kdata_destroy(d1); +} 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/krb5/all/conandata.yml b/recipes/krb5/all/conandata.yml new file mode 100644 index 0000000000000..f074e932120e0 --- /dev/null +++ b/recipes/krb5/all/conandata.yml @@ -0,0 +1,16 @@ +sources: + "1.21.2": + url: "https://kerberos.org/dist/krb5/1.21/krb5-1.21.2.tar.gz" + sha256: "9560941a9d843c0243a71b17a7ac6fe31c7cebb5bce3983db79e52ae7e850491" +patches: + "1.21.2": + - patch_file: "patches/0001-no-tests.patch" + patch_type: "conan" + patch_description: "Disable building tests" + - patch_file: "patches/0002-disable_ksu_root.patch" + patch_description: "No ksu install as root user" + patch_type: "conan" + - patch_file: "patches/0003-find-openssl-module.patch" + patch_description: "Use OpenSSL .pc module to find libraries" + patch_source: "https://github.com/krb5/krb5/pull/1351" + patch_type: "portability" diff --git a/recipes/krb5/all/conanfile.py b/recipes/krb5/all/conanfile.py new file mode 100644 index 0000000000000..45d89ebc279af --- /dev/null +++ b/recipes/krb5/all/conanfile.py @@ -0,0 +1,169 @@ +from conan import ConanFile +from conan.tools.build import cross_building +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import copy, get, rmdir, export_conandata_patches, apply_conandata_patches, chdir +from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps, PkgConfigDeps +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc +import os + +required_conan_version = ">=1.54.0" + +class Krb5Conan(ConanFile): + name = "krb5" + description = "Kerberos is a network authentication protocol. It is designed to provide strong authentication " \ + "for client/server applications by using secret-key cryptography." + homepage = "https://web.mit.edu/kerberos" + topics = ("kerberos", "network", "authentication", "protocol", "client", "server", "cryptography") + license = "LicenseRef-NOTICE" + url = "https://github.com/conan-io/conan-center-index" + package_type = "shared-library" + options = { + "use_thread": [True, False], + "use_dns_realms": [True, False], + "with_tls": [False, "openssl"], + } + default_options = { + "use_thread": True, + "use_dns_realms": False, + "with_tls": "openssl" + } + options_description = { + "use_thread": "Enable thread support", + "use_dns_realms": "Enable DNS for realms", + "with_tls": "Enable TLS support with OpenSSL", + } + settings = "os", "arch", "compiler", "build_type" + + def export_sources(self): + export_conandata_patches(self) + + def configure(self): + 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 is_msvc(self): + raise ConanInvalidConfiguration(f"{self.ref} Conan recipe is not prepared for Windows yet. Contributions are welcome!") + if self.settings.os == "Macos": + raise ConanInvalidConfiguration(f"{self.ref} Conan recipe is not prepared for Macos yet. Contributions are welcome!") + if self.options.with_tls == "openssl" and not self.dependencies["openssl"].options.shared: + # k5tls does not respect linkage order, it passes krb5 and krb5support before openssl to the linker, which causes linking errors + # gcc -shared -fPIC -Wl,-h,k5tls.so.0 -Wl,--no-undefined -o k5tls.so openssl.so notls.so -L../../../lib -lkrb5 -lkrb5support ... + # /usr/bin/ld: /.../lib/libssl.a(libssl-lib-ssl_cert_comp.o): in function `OSSL_COMP_CERT_from_uncompressed_data': + # ssl_cert_comp.c:(.text+0x3d1): undefined reference to `COMP_CTX_free' + raise ConanInvalidConfiguration(f"{self.ref} building with static OpenSSL generates linking errors. Please use '-o openssl/*:shared=True'") + + 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) + yes_no = lambda v: "yes" if v else "no" + tls_impl = {"openssl": "openssl",}.get(str(self.options.get_safe('with_tls'))) + tc.configure_args.extend([ + f"--enable-thread-support={yes_no(self.options.get_safe('use_thread'))}", + f"--enable-dns-for-realm={yes_no(self.options.use_dns_realms)}", + f"--enable-pkinit={yes_no(self.options.get_safe('with_tls'))}", + f"--with-crypto-impl={(tls_impl or 'builtin')}", + f"--with-spake-openssl={yes_no(self.options.get_safe('with_tls') == 'openssl')}", + f"--with-tls-impl={(tls_impl or 'no')}", + "--disable-nls", + "--disable-rpath", + "--without-libedit", + "--without-readline", + "--with-system-verto", + "--enable-dns-for-realm", + f"--with-keyutils={self.package_folder}", + f"--with-tcl={(self.dependencies['tcl'].package_folder if self.options.get_safe('with_tcl') else 'no')}", + ]) + tc.generate() + + pkg = AutotoolsDeps(self) + pkg.generate() + pkg = PkgConfigDeps(self) + pkg.generate() + + def requirements(self): + self.requires("libverto/0.3.2") + if self.options.get_safe("with_tls") == "openssl": + self.requires("openssl/[>=1.1 <4]") + if self.options.get_safe("with_tcl"): + self.requires("tcl/8.6.11") + + def build_requirements(self): + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/1.9.3") + self.build_requires("automake/1.16.5") + self.build_requires("bison/3.8.2") + + def build(self): + apply_conandata_patches(self) + with chdir(self, os.path.join(self.source_folder, "src")): + self.run("autoreconf -vif") + autotools = Autotools(self) + autotools.configure(build_script_folder=os.path.join(self.source_folder, "src")) + autotools.make() + + def package(self): + copy(self, "NOTICE", 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")) + rmdir(self, os.path.join(self.package_folder, "var")) + + def package_info(self): + self.cpp_info.components["mit-krb5"].libs = ["krb5", "k5crypto", "com_err"] + if self.options.get_safe('with_tls') == "openssl": + self.cpp_info.components["mit-krb5"].requires = ["openssl::crypto"] + self.cpp_info.components["mit-krb5"].names["pkg_config"] = "mit-krb5" + if self.settings.os == "Linux": + self.cpp_info.components["mit-krb5"].system_libs = ["resolv"] + + self.cpp_info.components["libkrb5"].libs = [] + self.cpp_info.components["libkrb5"].requires = ["mit-krb5"] + self.cpp_info.components["libkrb5"].names["pkg_config"] = "krb5" + + self.cpp_info.components["mit-krb5-gssapi"].libs = ["gssapi_krb5"] + self.cpp_info.components["mit-krb5-gssapi"].requires = ["mit-krb5"] + self.cpp_info.components["mit-krb5-gssapi"].names["pkg_config"] = "mit-krb5-gssapi" + + self.cpp_info.components["krb5-gssapi"].libs = [] + self.cpp_info.components["krb5-gssapi"].requires = ["mit-krb5-gssapi"] + self.cpp_info.components["krb5-gssapi"].names["pkg_config"] = "krb5-gssapi" + + self.cpp_info.components["gssrpc"].libs = ["gssrpc"] + self.cpp_info.components["gssrpc"].requires = ["mit-krb5-gssapi"] + self.cpp_info.components["gssrpc"].names["pkg_config"] = "gssrpc" + + self.cpp_info.components["kadm-client"].libs = ["kadm5clnt_mit"] + self.cpp_info.components["kadm-client"].requires = ["mit-krb5-gssapi", "gssrpc"] + self.cpp_info.components["kadm-client"].names["pkg_config"] = "kadm-client" + + self.cpp_info.components["kdb"].libs = ["kdb5"] + self.cpp_info.components["kdb"].requires = ["mit-krb5-gssapi", "mit-krb5", "gssrpc"] + self.cpp_info.components["kdb"].names["pkg_config"] = "kdb-client" + + self.cpp_info.components["kadm-server"].libs = ["kadm5srv_mit"] + self.cpp_info.components["kadm-server"].requires = ["kdb", "mit-krb5-gssapi"] + self.cpp_info.components["kadm-server"].names["pkg_config"] = "kadm-server" + + self.cpp_info.components["krad"].libs = ["krad"] + self.cpp_info.components["krad"].requires = ["libkrb5", "libverto::libverto"] + + krb5_config = os.path.join(self.package_folder, "bin", "krb5-config").replace("\\", "/") + self.output.info("Appending KRB5_CONFIG environment variable: {}".format(krb5_config)) + self.runenv_info.define_path("KRB5_CONFIG", krb5_config) diff --git a/recipes/krb5/all/patches/0001-no-tests.patch b/recipes/krb5/all/patches/0001-no-tests.patch new file mode 100644 index 0000000000000..6277a45dd0a98 --- /dev/null +++ b/recipes/krb5/all/patches/0001-no-tests.patch @@ -0,0 +1,13 @@ +diff --git a/src/Makefile.in b/src/Makefile.in +index 8f14e9bf2..dfb6843c9 100644 +--- a/src/Makefile.in ++++ b/src/Makefile.in +@@ -30,7 +30,7 @@ SUBDIRS=util include lib \ + plugins/preauth/spake \ + plugins/preauth/test \ + plugins/tls/k5tls \ +- kdc kadmin kprop clients appl tests \ ++ kdc kadmin kprop clients appl \ + config-files build-tools man doc @po@ + WINSUBDIRS=include util lib ccapi windows clients appl plugins\preauth\spake + BUILDTOP=$(REL). diff --git a/recipes/krb5/all/patches/0002-disable_ksu_root.patch b/recipes/krb5/all/patches/0002-disable_ksu_root.patch new file mode 100644 index 0000000000000..1c0aa45316310 --- /dev/null +++ b/recipes/krb5/all/patches/0002-disable_ksu_root.patch @@ -0,0 +1,13 @@ +diff --git a/src/config/pre.in b/src/config/pre.in +index 3752174..98dbe0f 100644 +--- a/src/config/pre.in ++++ b/src/config/pre.in +@@ -184,7 +184,7 @@ INSTALL_PROGRAM=@INSTALL_PROGRAM@ $(INSTALL_STRIP) + INSTALL_SCRIPT=@INSTALL_PROGRAM@ + INSTALL_DATA=@INSTALL_DATA@ + INSTALL_SHLIB=@INSTALL_SHLIB@ +-INSTALL_SETUID=$(INSTALL) $(INSTALL_STRIP) -m 4755 -o root ++INSTALL_SETUID=$(INSTALL) $(INSTALL_STRIP) -m 755 + ## This is needed because autoconf will sometimes define @exec_prefix@ to be + ## ${prefix}. + prefix=@prefix@ diff --git a/recipes/krb5/all/patches/0003-find-openssl-module.patch b/recipes/krb5/all/patches/0003-find-openssl-module.patch new file mode 100644 index 0000000000000..6c1d8cf5ff6fb --- /dev/null +++ b/recipes/krb5/all/patches/0003-find-openssl-module.patch @@ -0,0 +1,20 @@ +diff --git a/src/configure.ac b/src/configure.ac +index 77be7a2..577da79 100644 +--- a/src/configure.ac ++++ b/src/configure.ac +@@ -295,13 +295,10 @@ AC_ARG_WITH([tls-impl], + [TLS_IMPL=$withval], [TLS_IMPL=auto]) + case "$TLS_IMPL" in + openssl|auto) +- AC_CHECK_LIB(ssl,SSL_CTX_new,[have_lib_ssl=true],[have_lib_ssl=false], +- -lcrypto) +- AC_MSG_CHECKING([for OpenSSL]) ++ PKG_CHECK_MODULES([OPENSSL], [openssl >= 1.1.0], [have_lib_ssl=true], [have_lib_ssl=false]) + if test x$have_lib_ssl = xtrue ; then + AC_DEFINE(TLS_IMPL_OPENSSL,1,[Define if TLS implementation is OpenSSL]) +- AC_MSG_RESULT([yes]) +- TLS_IMPL_LIBS="-lssl -lcrypto" ++ TLS_IMPL_LIBS=$OPENSSL_LIBS + TLS_IMPL=openssl + AC_MSG_NOTICE([TLS module will use OpenSSL]) + else diff --git a/recipes/krb5/all/test_package/CMakeLists.txt b/recipes/krb5/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..8bf1b7258ab16 --- /dev/null +++ b/recipes/krb5/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package C) + +find_package(krb5 REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE krb5::krb5) diff --git a/recipes/krb5/all/test_package/conanfile.py b/recipes/krb5/all/test_package/conanfile.py new file mode 100644 index 0000000000000..23c0291e76c1f --- /dev/null +++ b/recipes/krb5/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", "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/krb5/all/test_package/test_package.c b/recipes/krb5/all/test_package/test_package.c new file mode 100644 index 0000000000000..1e241814c8386 --- /dev/null +++ b/recipes/krb5/all/test_package/test_package.c @@ -0,0 +1,16 @@ +#include "krb5.h" + +#include + +int +main(int argc, char **argv) +{ + krb5_context context; + int ret = krb5_init_context(&context); + if (ret != 0) { + fprintf(stderr, "krb5_init_context failed\n"); + return 1; + } + krb5_free_context(context); + return 0; +} diff --git a/recipes/krb5/config.yml b/recipes/krb5/config.yml new file mode 100644 index 0000000000000..5522f8acd1f0a --- /dev/null +++ b/recipes/krb5/config.yml @@ -0,0 +1,3 @@ +versions: + "1.21.2": + folder: "all" diff --git a/recipes/ktx/all/CMakeLists.txt b/recipes/ktx/all/CMakeLists.txt deleted file mode 100644 index 7bc9d34119351..0000000000000 --- a/recipes/ktx/all/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -link_libraries(${CONAN_LIBS}) -add_subdirectory(source_subfolder) diff --git a/recipes/ktx/all/conandata.yml b/recipes/ktx/all/conandata.yml index 955ee1b7c0556..a63666c9c170a 100644 --- a/recipes/ktx/all/conandata.yml +++ b/recipes/ktx/all/conandata.yml @@ -1,12 +1,16 @@ sources: + "4.3.2": + url: "https://github.com/KhronosGroup/KTX-Software/archive/refs/tags/v4.3.2.tar.gz" + sha256: "74a114f465442832152e955a2094274b446c7b2427c77b1964c85c173a52ea1f" "4.0.0": url: "https://github.com/KhronosGroup/KTX-Software/archive/refs/tags/v4.0.0.tar.gz" sha256: "6091f5064d0cfd54c6155bb6c0d2ba7287f312d109010e9b702839ac78529fd3" patches: + "4.3.2": + - patch_file: "patches/4.3.2/0001-objutil-cxx-std.patch" + - patch_file: "patches/4.3.2/0004-unvendor-dependencies.patch" "4.0.0": - - patch_file: "patches/0001-objutil-cxx-std.patch" - base_path: "source_subfolder" - - patch_file: "patches/0002-lodepng-no-export-symbols.patch" - base_path: "source_subfolder" - - patch_file: "patches/0003-clamp-include-algorithm.patch" - base_path: "source_subfolder" + - patch_file: "patches/4.0.0/0001-objutil-cxx-std.patch" + - patch_file: "patches/4.0.0/0002-lodepng-no-export-symbols.patch" + - patch_file: "patches/4.0.0/0003-clamp-include-algorithm.patch" + - patch_file: "patches/4.0.0/0004-unvendor-dependencies.patch" diff --git a/recipes/ktx/all/conanfile.py b/recipes/ktx/all/conanfile.py index b476c62299b82..a7aab249baf8d 100644 --- a/recipes/ktx/all/conanfile.py +++ b/recipes/ktx/all/conanfile.py @@ -1,17 +1,22 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +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, export_conandata_patches, get, rmdir, replace_in_file, save +from conan.tools.scm import Version import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class KtxConan(ConanFile): name = "ktx" description = "Khronos Texture library and tool." license = "Apache-2.0" - topics = ("ktx", "texture", "khronos") + topics = ("texture", "khronos") homepage = "https://github.com/KhronosGroup/KTX-Software" url = "https://github.com/conan-io/conan-center-index" - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -26,21 +31,31 @@ class KtxConan(ConanFile): "tools": True, } - generators = "cmake" - _cmake = None + @property + def _min_cppstd(self): + if Version(self.version) < "4.3.2": + return 11 + return 17 @property - def _source_subfolder(self): - return "source_subfolder" + def _compilers_minimum_version(self): + if self._min_cppstd == 17: + return { + "gcc": "8", + "clang": "7", + "apple-clang": "10", + "msvc": "191", + "Visual Studio": "15", + } + return {} + @property def _has_sse_support(self): return self.settings.arch in ["x86", "x86_64"] 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,94 +68,107 @@ 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("lodepng/cci.20200615") - self.requires("zstd/1.5.0") + if Version(self.version) < "4.2.0": + # Newer versions use modified lodepng + # https://github.com/KhronosGroup/KTX-Software/blob/v4.2.1/tools/imageio/png.imageio/lodepng.h#L26-L32 + self.requires("lodepng/cci.20230410") + self.requires("zstd/1.5.5") def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.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." + ) + if Version(self.version) >= "4.2" and self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < 6: + # astcenc_vecmathlib_sse_4.h:809:41: error: the last argument must be a 4-bit immediate + raise ConanInvalidConfiguration("GCC v6+ is required") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def build(self): - self._patch_sources() - cmake = self._configure_cmake() - cmake.build() + get(self, **self.conan_data["sources"][self.version], strip_root=True) + # Avoid copying of 300 MB of test assets and third-party binaries + rmdir(self, os.path.join(self.source_folder, "tests")) + rmdir(self, os.path.join(self.source_folder, "other_lib")) + save(self, os.path.join(self.source_folder, "tests", "CMakeLists.txt"), "") + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["KTX_FEATURE_TOOLS"] = self.options.tools + tc.variables["KTX_FEATURE_DOC"] = False + tc.variables["KTX_FEATURE_LOADTEST_APPS"] = False + tc.variables["KTX_FEATURE_STATIC_LIBRARY"] = not self.options.shared + tc.variables["KTX_FEATURE_TESTS"] = False + tc.variables["BASISU_SUPPORT_SSE"] = self.options.get_safe("sse", False) + tc.generate() + deps = CMakeDeps(self) + deps.set_property("zstd", "cmake_target_name", "zstd::libzstd") + 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") - # Allow CMake wrapper - tools.replace_in_file(cmakelists, "${CMAKE_SOURCE_DIR}", "${CMAKE_CURRENT_SOURCE_DIR}") - tools.replace_in_file(cmakelists, "${CMAKE_BINARY_DIR}", "${CMAKE_CURRENT_BINARY_DIR}") - # Unvendor several libs (we rely on CMake wrapper to link those libs) + apply_conandata_patches(self) + # Unvendor several libs (we rely on patch files to link those libs) # It's worth noting that vendored jpeg-compressor can't be replaced by CCI equivalent - basisu_dir = os.path.join(self.build_folder, self._source_subfolder, "lib", "basisu") - ## lodepng (the patch file 0002-lodepng-no-export-symbols is important, in order to not try to export lodepng symbols) - os.remove(os.path.join(basisu_dir, "encoder", "lodepng.cpp")) - os.remove(os.path.join(basisu_dir, "encoder", "lodepng.h")) - tools.replace_in_file(cmakelists, "lib/basisu/encoder/lodepng.cpp", "") - tools.replace_in_file(cmakelists, "lib/basisu/encoder/lodepng.h", "") - tools.replace_in_file(os.path.join(self._source_subfolder, "tools", "toktx", "pngimage.cc"), - "#include \"encoder/lodepng.h\"", - "#include ") + basisu_dir = os.path.join(self.source_folder, "lib", "basisu") + if Version(self.version) < "4.1.0": + ## lodepng (the patch file 0002-lodepng-no-export-symbols is important, in order to not try to export lodepng symbols) + os.remove(os.path.join(basisu_dir, "encoder", "lodepng.cpp")) + os.remove(os.path.join(basisu_dir, "encoder", "lodepng.h")) ## zstd - tools.rmdir(os.path.join(basisu_dir, "zstd")) - tools.replace_in_file(cmakelists, "lib/basisu/zstd/zstd.c", "") - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["KTX_FEATURE_TOOLS"] = self.options.tools - self._cmake.definitions["KTX_FEATURE_DOC"] = False - self._cmake.definitions["KTX_FEATURE_LOADTEST_APPS"] = False - self._cmake.definitions["KTX_FEATURE_STATIC_LIBRARY"] = not self.options.shared - self._cmake.definitions["KTX_FEATURE_TESTS"] = False - self._cmake.definitions["BASISU_SUPPORT_SSE"] = self.options.get_safe("sse", False) - self._cmake.configure() - return self._cmake + rmdir(self, os.path.join(basisu_dir, "zstd")) + # disable -Werror + if Version(self.version) >= "4.3.2": + replace_in_file(self, os.path.join(self.source_folder, "lib", "astc-encoder", "Source", "cmake_core.cmake"), + "-Werror", "") + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() + cmake.build() def package(self): - self.copy("LICENSE.md", dst="licenses", src=self._source_subfolder) - self.copy("*", dst="licenses", src=os.path.join(self._source_subfolder, "LICENSES")) - cmake = self._configure_cmake() + 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, "LICENSES"), 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", "Ktx") self.cpp_info.set_property("cmake_target_name", "KTX::ktx") - - self.cpp_info.filenames["cmake_find_package"] = "Ktx" - self.cpp_info.filenames["cmake_find_package_multi"] = "Ktx" - self.cpp_info.names["cmake_find_package"] = "KTX" - self.cpp_info.names["cmake_find_package_multi"] = "KTX" - self.cpp_info.components["libktx"].names["cmake_find_package"] = "ktx" - self.cpp_info.components["libktx"].names["cmake_find_package_multi"] = "ktx" - + # TODO: back to root level in conan v2 self.cpp_info.components["libktx"].libs = ["ktx"] self.cpp_info.components["libktx"].defines = [ "KTX_FEATURE_KTX1", "KTX_FEATURE_KTX2", "KTX_FEATURE_WRITE" ] if not self.options.shared: self.cpp_info.components["libktx"].defines.append("KHRONOS_STATIC") - stdcpp_library = tools.stdcpp_library(self) - if stdcpp_library: - self.cpp_info.components["libktx"].system_libs.append(stdcpp_library) + libcxx = stdcpp_library(self) + if libcxx: + self.cpp_info.components["libktx"].system_libs.append(libcxx) if self.settings.os == "Windows": self.cpp_info.components["libktx"].defines.append("BASISU_NO_ITERATOR_DEBUG_LEVEL") elif self.settings.os == "Linux": self.cpp_info.components["libktx"].system_libs.extend(["m", "dl", "pthread"]) - self.cpp_info.components["libktx"].requires = ["lodepng::lodepng", "zstd::zstd"] + # TODO: to remove in conan v2 + self.cpp_info.filenames["cmake_find_package"] = "Ktx" + self.cpp_info.filenames["cmake_find_package_multi"] = "Ktx" + self.cpp_info.names["cmake_find_package"] = "KTX" + self.cpp_info.names["cmake_find_package_multi"] = "KTX" + self.cpp_info.components["libktx"].names["cmake_find_package"] = "ktx" + self.cpp_info.components["libktx"].names["cmake_find_package_multi"] = "ktx" + self.cpp_info.components["libktx"].set_property("cmake_target_name", "KTX::ktx") + self.cpp_info.components["libktx"].requires = ["zstd::zstd"] + if Version(self.version) < "4.2.0": + self.cpp_info.components["libktx"].requires.append("lodepng::lodepng") 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/ktx/all/patches/0001-objutil-cxx-std.patch b/recipes/ktx/all/patches/4.0.0/0001-objutil-cxx-std.patch similarity index 100% rename from recipes/ktx/all/patches/0001-objutil-cxx-std.patch rename to recipes/ktx/all/patches/4.0.0/0001-objutil-cxx-std.patch diff --git a/recipes/ktx/all/patches/0002-lodepng-no-export-symbols.patch b/recipes/ktx/all/patches/4.0.0/0002-lodepng-no-export-symbols.patch similarity index 100% rename from recipes/ktx/all/patches/0002-lodepng-no-export-symbols.patch rename to recipes/ktx/all/patches/4.0.0/0002-lodepng-no-export-symbols.patch diff --git a/recipes/ktx/all/patches/0003-clamp-include-algorithm.patch b/recipes/ktx/all/patches/4.0.0/0003-clamp-include-algorithm.patch similarity index 100% rename from recipes/ktx/all/patches/0003-clamp-include-algorithm.patch rename to recipes/ktx/all/patches/4.0.0/0003-clamp-include-algorithm.patch diff --git a/recipes/ktx/all/patches/4.0.0/0004-unvendor-dependencies.patch b/recipes/ktx/all/patches/4.0.0/0004-unvendor-dependencies.patch new file mode 100644 index 0000000000000..076b9eecaa908 --- /dev/null +++ b/recipes/ktx/all/patches/4.0.0/0004-unvendor-dependencies.patch @@ -0,0 +1,48 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -121,7 +121,6 @@ set(KTX_MAIN_SRC + lib/basisu/transcoder/basisu_transcoder.cpp + lib/basisu/transcoder/basisu_transcoder.h + lib/basisu/transcoder/basisu.h +- lib/basisu/zstd/zstd.c + lib/checkheader.c + lib/dfdutils/createdfd.c + lib/dfdutils/colourspaces.c +@@ -415,11 +414,13 @@ PRIVATE + lib/basisu/encoder/cppspmd_type_aliases.h + lib/basisu/encoder/jpgd.cpp + lib/basisu/encoder/jpgd.h +- lib/basisu/encoder/lodepng.cpp +- lib/basisu/encoder/lodepng.h + lib/writer1.c + lib/writer2.c + ) ++find_package(lodepng REQUIRED CONFIG) ++find_package(zstd REQUIRED CONFIG) ++target_link_libraries(ktx PRIVATE lodepng::lodepng zstd::libzstd) ++target_link_libraries(ktx_read PRIVATE zstd::libzstd) + target_include_directories( + ktx + PRIVATE +--- a/tools/toktx/CMakeLists.txt ++++ b/tools/toktx/CMakeLists.txt +@@ -28,6 +28,8 @@ PRIVATE + target_link_libraries( + toktx + ktx ++ lodepng::lodepng ++ zstd::libzstd + ) + + target_compile_definitions( +--- a/tools/toktx/pngimage.cc ++++ b/tools/toktx/pngimage.cc +@@ -21,7 +21,7 @@ + #include + + #include "image.hpp" +-#include "encoder/lodepng.h" ++#include + #include + #include "dfd.h" + diff --git a/recipes/ktx/all/patches/4.3.2/0001-objutil-cxx-std.patch b/recipes/ktx/all/patches/4.3.2/0001-objutil-cxx-std.patch new file mode 100644 index 0000000000000..fee67e7e70f54 --- /dev/null +++ b/recipes/ktx/all/patches/4.3.2/0001-objutil-cxx-std.patch @@ -0,0 +1,10 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -972,6 +972,6 @@ + PUBLIC + utils + ) +- ++target_compile_features(objUtil PUBLIC cxx_std_11) + # In C++ apps that use statically linked Libraries all compilatiom units must + # be compiled with matching symbol visibility settings to avoid warnings from diff --git a/recipes/ktx/all/patches/4.3.2/0004-unvendor-dependencies.patch b/recipes/ktx/all/patches/4.3.2/0004-unvendor-dependencies.patch new file mode 100644 index 0000000000000..5fb6ef588fa4e --- /dev/null +++ b/recipes/ktx/all/patches/4.3.2/0004-unvendor-dependencies.patch @@ -0,0 +1,21 @@ +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -355,7 +355,6 @@ + lib/basisu/transcoder/basisu_transcoder.cpp + lib/basisu/transcoder/basisu_transcoder.h + lib/basisu/transcoder/basisu.h +- lib/basisu/zstd/zstd.c + lib/checkheader.c + lib/dfdutils/createdfd.c + lib/dfdutils/colourspaces.c +@@ -765,6 +764,10 @@ + BASISD_SUPPORT_KTX2=0 + ) + ++find_package(zstd REQUIRED CONFIG) ++target_link_libraries(ktx PUBLIC zstd::libzstd) ++target_link_libraries(ktx_read PUBLIC zstd::libzstd) ++ + # Turn off these warnings until Rich fixes the occurences. + # It it not clear to me if generator expressions can be used here + # hence the long-winded way. diff --git a/recipes/ktx/all/test_package/CMakeLists.txt b/recipes/ktx/all/test_package/CMakeLists.txt index 6eb84d40ec7ba..0d08193e7ed87 100644 --- a/recipes/ktx/all/test_package/CMakeLists.txt +++ b/recipes/ktx/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(Ktx REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} KTX::ktx) +target_link_libraries(${PROJECT_NAME} PRIVATE KTX::ktx) diff --git a/recipes/ktx/all/test_package/conanfile.py b/recipes/ktx/all/test_package/conanfile.py index 8bf8322cf17d1..98ab55852ad56 100644 --- a/recipes/ktx/all/test_package/conanfile.py +++ b/recipes/ktx/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,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") - ktx_path = os.path.join(self.source_folder, "etc1.ktx") - self.run("{} {}".format(bin_path, ktx_path), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/ktx/all/test_package/etc1.ktx b/recipes/ktx/all/test_package/etc1.ktx deleted file mode 100644 index ff6f8186fd1db..0000000000000 Binary files a/recipes/ktx/all/test_package/etc1.ktx and /dev/null differ diff --git a/recipes/ktx/all/test_package/test_package.c b/recipes/ktx/all/test_package/test_package.c index f877690cdb0d6..ebd19452339ab 100644 --- a/recipes/ktx/all/test_package/test_package.c +++ b/recipes/ktx/all/test_package/test_package.c @@ -4,16 +4,12 @@ int main(int argc, char **argv) { - if (argc < 2) { - fprintf(stderr, "Need at least one argument\n"); - return 1; - } - ktxTexture* texture; KTX_error_code result; - result = ktxTexture_CreateFromNamedFile(argv[1], + result = ktxTexture_CreateFromNamedFile("fake-file.ktx", KTX_TEXTURE_CREATE_LOAD_IMAGE_DATA_BIT, &texture); + printf("Test: %s\n", ktxErrorString(result)); return 0; } diff --git a/recipes/ktx/all/test_v1_package/CMakeLists.txt b/recipes/ktx/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/ktx/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/ktx/all/test_v1_package/conanfile.py b/recipes/ktx/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/ktx/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/ktx/config.yml b/recipes/ktx/config.yml index d2be8f453d7c0..6d8c546915dba 100644 --- a/recipes/ktx/config.yml +++ b/recipes/ktx/config.yml @@ -1,3 +1,5 @@ versions: + "4.3.2": + folder: all "4.0.0": folder: all diff --git a/recipes/kuba-zip/all/conandata.yml b/recipes/kuba-zip/all/conandata.yml index 687b00ee7e238..2c9419a46ca41 100644 --- a/recipes/kuba-zip/all/conandata.yml +++ b/recipes/kuba-zip/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "0.3.2": + url: "https://github.com/kuba--/zip/archive/v0.3.2.tar.gz" + sha256: "0c33740aec7a3913bca07df360420c19cac5e794e0f602f14f798cb2e6f710e5" + "0.3.1": + url: "https://github.com/kuba--/zip/archive/v0.3.1.tar.gz" + sha256: "775b8a44b53e72a55c13839bf507219c2cf30b26f62e70f1a20bb727db54438f" + "0.3.0": + url: "https://github.com/kuba--/zip/archive/v0.3.0.tar.gz" + sha256: "feb70ae0fe5948b805635b3cc2f3b7f074662c481981857bc6b5896a4343fe5e" "0.2.6": url: "https://github.com/kuba--/zip/archive/v0.2.6.tar.gz" sha256: "6a00e10dc5242f614f76f1bd1d814726a41ee6e3856ef3caf7c73de0b63acf0b" diff --git a/recipes/kuba-zip/all/conanfile.py b/recipes/kuba-zip/all/conanfile.py index f2b2cdbf10c1b..7d777e775d48f 100644 --- a/recipes/kuba-zip/all/conanfile.py +++ b/recipes/kuba-zip/all/conanfile.py @@ -3,7 +3,7 @@ from conan.tools.files import copy, get, replace_in_file, rmdir import os -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.53.0" class ZipConan(ConanFile): @@ -14,6 +14,7 @@ class ZipConan(ConanFile): description = "A portable, simple zip library written in C" topics = ("zip", "compression", "c", "miniz", "portable", "hacking") + 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/kuba-zip/all/test_package/conanfile.py b/recipes/kuba-zip/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/kuba-zip/all/test_package/conanfile.py +++ b/recipes/kuba-zip/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/kuba-zip/all/test_v1_package/CMakeLists.txt b/recipes/kuba-zip/all/test_v1_package/CMakeLists.txt index 4bc4ff0d96e4b..0d20897301b68 100644 --- a/recipes/kuba-zip/all/test_v1_package/CMakeLists.txt +++ b/recipes/kuba-zip/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(zip REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE zip::zip) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/kuba-zip/config.yml b/recipes/kuba-zip/config.yml index 7244cf3b53ff7..b1201b1eaf043 100644 --- a/recipes/kuba-zip/config.yml +++ b/recipes/kuba-zip/config.yml @@ -1,4 +1,10 @@ versions: + "0.3.2": + folder: "all" + "0.3.1": + folder: "all" + "0.3.0": + folder: "all" "0.2.6": folder: "all" "0.2.5": diff --git a/recipes/kuliya/all/conandata.yml b/recipes/kuliya/all/conandata.yml new file mode 100644 index 0000000000000..06675980fd094 --- /dev/null +++ b/recipes/kuliya/all/conandata.yml @@ -0,0 +1,10 @@ +sources: + "1.0.0": + release: + url: "https://github.com/dzcode-io/kuliya/releases/download/c-v1.0.0/c-release.tar.gz" + sha256: "a0e064d29358e40245dc8b7b35160a6b15e10059e4bd42d9dc4f0af76d031e5f" + # Old versions don't have the license embed in the release tar, download it separatedly for now + # from the commit of the upstream tag + license: + url: "https://raw.githubusercontent.com/dzcode-io/kuliya/c-v1.0.0/LICENSE" + sha256: "70884fb7eff4f91c8d776f8cf7bd93cce0c93213f57153956189b488cfd911be" diff --git a/recipes/kuliya/all/conanfile.py b/recipes/kuliya/all/conanfile.py new file mode 100644 index 0000000000000..ad769bd5235f6 --- /dev/null +++ b/recipes/kuliya/all/conanfile.py @@ -0,0 +1,40 @@ +from conan import ConanFile +from conan.tools.files import copy, get, download +from conan.tools.layout import basic_layout +import os + +required_conan_version = ">=1.50.0" + + +class JsmnConan(ConanFile): + name = "kuliya" + description = "Algeria's college hierarchy dataset as a C library." + license = "MIT" + topics = ("dataset", "api", "dz", "header-only") + homepage = "https://github.com/dzcode-io/kuliya" + url = "https://github.com/conan-io/conan-center-index" + package_type = "header-library" + 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]["release"], strip_root=True) + download(self, **self.conan_data["sources"][self.version]["license"], filename="LICENSE") + + def build(self): + pass + + def package(self): + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "kuliya.h", src=self.source_folder, dst=os.path.join(self.package_folder, "include")) + copy(self, "data.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/kuliya/all/test_package/CMakeLists.txt b/recipes/kuliya/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..6ca62a693d64a --- /dev/null +++ b/recipes/kuliya/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) + +find_package(kuliya REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE kuliya::kuliya) diff --git a/recipes/kuliya/all/test_package/conanfile.py b/recipes/kuliya/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0a6bc68712d90 --- /dev/null +++ b/recipes/kuliya/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/kuliya/all/test_package/test_package.c b/recipes/kuliya/all/test_package/test_package.c new file mode 100644 index 0000000000000..5e3b275cf2747 --- /dev/null +++ b/recipes/kuliya/all/test_package/test_package.c @@ -0,0 +1,13 @@ +#undef NDEBUG + +#include +#include +#include + +int main() +{ + kuliya_init(); + kuliya_schema *res = get_node_by_path("umkb/fst"); + assert(strcmp(res->name.en, "Faculty of Science and Technology") == 0); + kuliya_deinit(); +} diff --git a/recipes/kuliya/config.yml b/recipes/kuliya/config.yml new file mode 100644 index 0000000000000..40341aa3db6cd --- /dev/null +++ b/recipes/kuliya/config.yml @@ -0,0 +1,3 @@ +versions: + "1.0.0": + folder: all diff --git a/recipes/lager/all/conandata.yml b/recipes/lager/all/conandata.yml new file mode 100644 index 0000000000000..e2389a84794f3 --- /dev/null +++ b/recipes/lager/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.1.1": + url: "https://github.com/arximboldi/lager/archive/refs/tags/v0.1.1.tar.gz" + sha256: "9e4743c3fe2c95c1653c3fd088a2200108f09d758725697831852dc91d15d174" diff --git a/recipes/lager/all/conanfile.py b/recipes/lager/all/conanfile.py new file mode 100644 index 0000000000000..296459306e38a --- /dev/null +++ b/recipes/lager/all/conanfile.py @@ -0,0 +1,91 @@ +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, cmake_layout +from conan.tools.files import copy, get, rmdir, replace_in_file +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" + +class LagerConan(ConanFile): + name = "lager" + description = "C++ library for value-oriented design using the unidirectional data-flow architecture" + license = "MIT" + homepage = "https://sinusoid.es/lager/" + url = "https://github.com/conan-io/conan-center-index" + topics = ("redux", "functional-programming", "interactive", "value-semantics", "header-only") + + package_type = "header-library" + 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": "9", + "clang": "10", + "apple-clang": "11", + "msvc": "192", + "Visual Studio": "16.2", + } + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires("boost/1.83.0") + self.requires("zug/0.1.0") + + def package_id(self): + self.info.clear() + + 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." + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["lager_BUILD_EXAMPLES"] = False + tc.cache_variables["lager_BUILD_TESTS"] = False + tc.cache_variables["lager_BUILD_DOCS"] = False + tc.generate() + deps = CMakeDeps(self) + deps.generate() + + def _patch_sources(self): + # Do not inject the package folder path into the library. + # This is only used for examples. + replace_in_file(self, os.path.join(self.source_folder, "lager", "resources_path.hpp.in"), + '"@LAGER_PREFIX_PATH@"', "") + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE", self.source_folder, 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.bindirs = [] + self.cpp_info.libdirs = [] + diff --git a/recipes/lager/all/test_package/CMakeLists.txt b/recipes/lager/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..d147f04fcbbe1 --- /dev/null +++ b/recipes/lager/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(lager REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE lager::lager) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) diff --git a/recipes/lager/all/test_package/conanfile.py b/recipes/lager/all/test_package/conanfile.py new file mode 100644 index 0000000000000..ef5d7042163ec --- /dev/null +++ b/recipes/lager/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/lager/all/test_package/test_package.cpp b/recipes/lager/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..c61d64b17b9ae --- /dev/null +++ b/recipes/lager/all/test_package/test_package.cpp @@ -0,0 +1,32 @@ +// https://github.com/arximboldi/lager/blob/v0.1.1/test/deps.cpp +// +// lager - library for functional interactive c++ programs +// Copyright (C) 2017 Juan Pedro Bolivar Puente +// +// This file is part of lager. +// +// lager is free software: you can redistribute it and/or modify +// it under the terms of the MIT License, as detailed in the LICENSE +// file located at the root of this source code distribution, +// or here: +// + +#include +#include + +struct foo +{ + int x = 0; +}; + +struct bar +{ + const char* s = "lol"; +}; + +int main() { + auto x = lager::deps::with(foo{}, bar{}); + assert(x.get().x == 0); + assert(lager::get(x).s == std::string{"lol"}); + return 0; +} diff --git a/recipes/lager/config.yml b/recipes/lager/config.yml new file mode 100644 index 0000000000000..b893ff21f7c23 --- /dev/null +++ b/recipes/lager/config.yml @@ -0,0 +1,3 @@ +versions: + "0.1.1": + folder: all diff --git a/recipes/laslib/all/conandata.yml b/recipes/laslib/all/conandata.yml new file mode 100644 index 0000000000000..06edf050658b1 --- /dev/null +++ b/recipes/laslib/all/conandata.yml @@ -0,0 +1,9 @@ +sources: + "2.0.2": + url: "https://github.com/LAStools/LAStools/archive/refs/tags/v2.0.2.tar.gz" + sha256: "41200e2b6ad92fe057fc5008132978090890463d5b602bce89ecf8aa84c78a82" +patches: + "2.0.2": + - patch_file: "patches/0001-build-only-laslib.patch" + patch_description: "Build only laslib from LASTools: update multiple CMakeList.txt" + patch_type: "conan" diff --git a/recipes/laslib/all/conanfile.py b/recipes/laslib/all/conanfile.py new file mode 100644 index 0000000000000..10c2dfd18d650 --- /dev/null +++ b/recipes/laslib/all/conanfile.py @@ -0,0 +1,108 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rm, rmdir, save +from conan.tools.build import stdcpp_library, 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 LASlibConan(ConanFile): + name = "laslib" + description = "Efficient tools for lidar processing" + license = "LGPL-2.1" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/LAStools/LAStools/tree/master/LASlib" + topics = ("las", "laz", "lidar", "compression", "decompression") + + package_type = "library" + 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 { + "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 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.generate() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + + 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." + ) + + def build(self): + apply_conandata_patches(self) + save(self, os.path.join(self.source_folder, "CMakeLists.txt"), "add_subdirectory(LASlib/src)") + save(self, os.path.join(self.source_folder, "LASlib", "example", "CMakeLists.txt"), "") + 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() + + # Copy the libraries + if self.options.shared: + copy(self, pattern="*.dll", src=self.package_folder, dst=os.path.join(self.package_folder, "bin"), keep_path=False) + + # some files extensions and folders are not allowed. + 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.libdirs = ["lib/LASlib"] + self.cpp_info.libs = ["LASlib"] + + 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/laslib/all/patches/0001-build-only-laslib.patch b/recipes/laslib/all/patches/0001-build-only-laslib.patch new file mode 100644 index 0000000000000..5680289b540d1 --- /dev/null +++ b/recipes/laslib/all/patches/0001-build-only-laslib.patch @@ -0,0 +1,24 @@ +diff --git a/LASlib/src/CMakeLists.txt b/LASlib/src/CMakeLists.txt +index 1b170bf..6a114eb 100644 +--- a/LASlib/src/CMakeLists.txt ++++ b/LASlib/src/CMakeLists.txt +@@ -101,15 +101,7 @@ endif() + + install(FILES ${LAS_INCLUDES} DESTINATION include/LASlib) + +-if (MSVC) +- foreach( OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES} ) +- install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../lib/${OUTPUTCONFIG} DESTINATION lib/LASlib) +- endforeach( OUTPUTCONFIG CMAKE_CONFIGURATION_TYPES ) +-else() +- install(TARGETS LASlib EXPORT laslib-targets +- ARCHIVE DESTINATION lib/LASlib +- LIBRARY DESTINATION lib/LASlib +- RUNTIME DESTINATION lib/LASlib) +- install(EXPORT laslib-targets DESTINATION lib/cmake/LASlib) +- install(FILES ${CMAKE_SOURCE_DIR}/LASlib/src/laslib-config.cmake DESTINATION lib/cmake/LASlib) +-endif(MSVC) ++install(TARGETS LASlib EXPORT laslib-targets ++ ARCHIVE DESTINATION lib/LASlib ++ LIBRARY DESTINATION lib/LASlib ++ RUNTIME DESTINATION lib/LASlib) diff --git a/recipes/laslib/all/test_package/CMakeLists.txt b/recipes/laslib/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..37bb2bb665c3c --- /dev/null +++ b/recipes/laslib/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package CXX) + +find_package(laslib REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) + +target_link_libraries(${PROJECT_NAME} PRIVATE laslib::laslib) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/laslib/all/test_package/conanfile.py b/recipes/laslib/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0af7e06b95a10 --- /dev/null +++ b/recipes/laslib/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 = "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.bindir, "test_package") + self.run(bin_path, env="conanrun") + diff --git a/recipes/laslib/all/test_package/test_package.cpp b/recipes/laslib/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..39f06f0b590d3 --- /dev/null +++ b/recipes/laslib/all/test_package/test_package.cpp @@ -0,0 +1,12 @@ +#include +#include "LASlib/lasreader.hpp" + +int main(void) { + + LASreadOpener readOpener; + readOpener.set_file_name("test_package.cpp"); + + std::cout << "Test: " << readOpener.active() << std::endl; + + return EXIT_SUCCESS; +} diff --git a/recipes/laslib/config.yml b/recipes/laslib/config.yml new file mode 100644 index 0000000000000..766ae143dc2cf --- /dev/null +++ b/recipes/laslib/config.yml @@ -0,0 +1,4 @@ +versions: + # Newer versions at the top + "2.0.2": + folder: all diff --git a/recipes/laszip/all/conandata.yml b/recipes/laszip/all/conandata.yml index 4f7409d4b12f0..8adc75c9b51ce 100644 --- a/recipes/laszip/all/conandata.yml +++ b/recipes/laszip/all/conandata.yml @@ -1,8 +1,17 @@ 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" + "3.4.4": + url: "https://github.com/LASzip/LASzip/archive/refs/tags/3.4.4.tar.gz" + sha256: "6d034bf3a400f81317a5dbad59d1b7ce82d971e887ca22d15813b914f0a5c281" patches: "3.4.3": - patch_file: "patches/0001-no-build-laszip-api.patch" - patch_file: "patches/0002-no-rpath-and-relocatable-macos.patch" + "3.4.4": + - patch_file: "patches/0001-3.4.4-no-build-laszip-api.patch" + - patch_file: "patches/0002-3.4.4-no-rpath-and-relocatable-macos.patch" + - patch_file: "patches/0003-3.4.4-remove-cppstd-hardcode.patch" + patch_type: "conan" + patch_description: "Let Conan set the cppstd, instead of forcing it (In this version it's incorreclty set to C++17 instead of the supported C++14)" diff --git a/recipes/laszip/all/conanfile.py b/recipes/laszip/all/conanfile.py index 0550e96992ca8..30e72169c7cd5 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, 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 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], @@ -26,24 +27,32 @@ class LaszipConan(ConanFile): "fPIC": True, } + @property + def _min_cppstd(self): + return 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 config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): + if Version(self.version) >= "3.4.4": + self.license = "Apache-2.0" if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + 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): - 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 +78,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/patches/0001-3.4.4-no-build-laszip-api.patch b/recipes/laszip/all/patches/0001-3.4.4-no-build-laszip-api.patch new file mode 100644 index 0000000000000..8e99797f7ecb7 --- /dev/null +++ b/recipes/laszip/all/patches/0001-3.4.4-no-build-laszip-api.patch @@ -0,0 +1,8 @@ +--- a/dll/CMakeLists.txt ++++ b/dll/CMakeLists.txt +@@ -2,5 +2,4 @@ set(LASZIP_API_SOURCES + laszip_api.c + ) + +-LASZIP_ADD_LIBRARY(${LASZIP_API_LIB_NAME} ${LASZIP_API_SOURCES}) + LASZIP_ADD_INCLUDES("laszip" "${CMAKE_CURRENT_SOURCE_DIR}/laszip_api.h" ${LASZIP_API_VERSION_H}) diff --git a/recipes/laszip/all/patches/0002-3.4.4-no-rpath-and-relocatable-macos.patch b/recipes/laszip/all/patches/0002-3.4.4-no-rpath-and-relocatable-macos.patch new file mode 100644 index 0000000000000..5aa1f83f0fd18 --- /dev/null +++ b/recipes/laszip/all/patches/0002-3.4.4-no-rpath-and-relocatable-macos.patch @@ -0,0 +1,29 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -81,15 +81,11 @@ file(MAKE_DIRECTORY "${LASZIP_OUTPUT_BIN_DIR}") + # per http://www.cmake.org/Wiki/CMake_RPATH_handling + SET(CMAKE_SKIP_BUILD_RPATH FALSE) + SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) +-SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + IF (APPLE) + SET(MACOSX_RPATH ON) + endif() + LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES + "${CMAKE_INSTALL_PREFIX}/${LASZIP_LIB_INSTALL_DIR}" isSystemDir) +-IF("${isSystemDir}" STREQUAL "-1") +- SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LASZIP_LIB_INSTALL_DIR}") +-ENDIF("${isSystemDir}" STREQUAL "-1") + + # wipe lib/ drectory on clean. It will have plugins that could be out of date + # in the next build +--- a/cmake/macros.cmake ++++ b/cmake/macros.cmake +@@ -71,8 +71,6 @@ macro(LASZIP_ADD_LIBRARY _name) + LIBRARY DESTINATION ${LASZIP_LIB_INSTALL_DIR} + ARCHIVE DESTINATION ${LASZIP_LIB_INSTALL_DIR}) + if (APPLE) +- set_target_properties(${_name} PROPERTIES INSTALL_NAME_DIR +- "@executable_path/../lib") + endif() + endmacro(LASZIP_ADD_LIBRARY) + diff --git a/recipes/laszip/all/patches/0003-3.4.4-remove-cppstd-hardcode.patch b/recipes/laszip/all/patches/0003-3.4.4-remove-cppstd-hardcode.patch new file mode 100644 index 0000000000000..1dbe071adbbce --- /dev/null +++ b/recipes/laszip/all/patches/0003-3.4.4-remove-cppstd-hardcode.patch @@ -0,0 +1,12 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 4b0a02b..a9cc6b5 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,7 +1,6 @@ + cmake_minimum_required(VERSION 3.10) + + project(LASZIP CXX C) +-set(CMAKE_CXX_STANDARD 17) + string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER) + + set(ROOT_DIR "${PROJECT_SOURCE_DIR}") 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/laszip/config.yml b/recipes/laszip/config.yml index 0d0a2f21c9983..a2d2267e94e46 100644 --- a/recipes/laszip/config.yml +++ b/recipes/laszip/config.yml @@ -1,3 +1,5 @@ versions: + "3.4.4": + folder: all "3.4.3": folder: all diff --git a/recipes/lazycsv/all/conandata.yml b/recipes/lazycsv/all/conandata.yml new file mode 100644 index 0000000000000..1f9c6533da7ce --- /dev/null +++ b/recipes/lazycsv/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "cci.20221117": + url: "https://github.com/ashtum/lazycsv/archive/844e3f318af2d9ede96039dd9f57ebf4cad59ce2.tar.gz" + sha256: "cb8592fc0b563a1236dfadfc423a91d63e705ff0086941218800abda22530540" diff --git a/recipes/lazycsv/all/conanfile.py b/recipes/lazycsv/all/conanfile.py new file mode 100644 index 0000000000000..f0f8f490335f9 --- /dev/null +++ b/recipes/lazycsv/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 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 LazyCSVConan(ConanFile): + name = "lazycsv" + description = "A fast, lightweight and single-header C++ csv parser library" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/ashtum/lazycsv" + topics = ("csv", "csv-parser", "header-only") + package_type = "header-library" + 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", + "Visual Studio": "16", + "msvc": "192", + } + + 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." + ) + if is_msvc(self): + raise ConanInvalidConfiguration( + f"{self.ref} doen't support MSVC." + ) + + 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/lazycsv/all/test_package/CMakeLists.txt b/recipes/lazycsv/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..655f63d80bdcf --- /dev/null +++ b/recipes/lazycsv/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(lazycsv REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE lazycsv::lazycsv) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/lazycsv/all/test_package/conanfile.py b/recipes/lazycsv/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/lazycsv/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/lazycsv/all/test_package/test_package.cpp b/recipes/lazycsv/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..c0e33ee18739a --- /dev/null +++ b/recipes/lazycsv/all/test_package/test_package.cpp @@ -0,0 +1,10 @@ +#include +#include "lazycsv.hpp" + + +int main(void) { + std::string csv_data{ "name,lastname,age\nPeter,Griffin,45\nchris,Griffin,14\n" }; + + lazycsv::parser parser_a{ csv_data }; + lazycsv::parser parser_b{ csv_data }; +} diff --git a/recipes/lazycsv/config.yml b/recipes/lazycsv/config.yml new file mode 100644 index 0000000000000..4d61dda20e41a --- /dev/null +++ b/recipes/lazycsv/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20221117": + folder: all diff --git a/recipes/lcms/all/conandata.yml b/recipes/lcms/all/conandata.yml index 55991f5faffdb..5887ed1478b6c 100644 --- a/recipes/lcms/all/conandata.yml +++ b/recipes/lcms/all/conandata.yml @@ -1,19 +1,19 @@ sources: + "2.16": + url: "https://github.com/mm2/Little-CMS/releases/download/lcms2.16/lcms2-2.16.tar.gz" + sha256: "d873d34ad8b9b4cea010631f1a6228d2087475e4dc5e763eb81acc23d9d45a51" "2.14": - url: "https://github.com/mm2/Little-CMS/archive/lcms2.14.tar.gz" - sha256: "05869269f14e589b0b6d05a76f510c68c67fabb304904d16c6bd818abec80a83" + 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..42471635a5f47 100644 --- a/recipes/lcms/all/conanfile.py +++ b/recipes/lcms/all/conanfile.py @@ -1,9 +1,14 @@ -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.microsoft import check_min_vs +from conan.tools.scm import Version import os -import re -import shutil -required_conan_version = ">=1.36.0" +required_conan_version = ">=1.57.0" class LcmsConan(ConanFile): @@ -12,8 +17,8 @@ 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") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -24,23 +29,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 +38,68 @@ 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.2.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): + 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) + if check_min_vs(self, "190", raise_invalid=False): # 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")) + license_file = "LICENSE" if Version(self.version) >= "2.16" else "COPYING" + copy(self, license_file, 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 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/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 82126a56f46e6..5bef14d0c33a0 100644 --- a/recipes/lcms/config.yml +++ b/recipes/lcms/config.yml @@ -1,13 +1,7 @@ versions: + "2.16": + folder: all "2.14": folder: all "2.13.1": folder: all - "2.12": - folder: all - "2.11": - folder: all - "2.10": - folder: all - "2.9": - folder: all diff --git a/recipes/ldns/all/conandata.yml b/recipes/ldns/all/conandata.yml index a5e4b6259dffa..44d9095cd63eb 100644 --- a/recipes/ldns/all/conandata.yml +++ b/recipes/ldns/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.8.2": + url: "https://nlnetlabs.nl/downloads/ldns/ldns-1.8.2.tar.gz" + sha256: "b92b001cdd382de653620a05445e42e17a827eec93d64ee587ad291a533cc1e9" "1.8.1": url: "https://nlnetlabs.nl/downloads/ldns/ldns-1.8.1.tar.gz" sha256: "958229abce4d3aaa19a75c0d127666564b17216902186e952ca4aef47c6d7fa3" diff --git a/recipes/ldns/all/conanfile.py b/recipes/ldns/all/conanfile.py index d942fc9b22eb7..531318c15033c 100644 --- a/recipes/ldns/all/conanfile.py +++ b/recipes/ldns/all/conanfile.py @@ -1,8 +1,14 @@ -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, XCRun +from conan.tools.build import cross_building +from conan.tools.env import VirtualRunEnv +from conan.tools.files import copy, get, rm +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.54.0" class LdnsConan(ConanFile): @@ -12,7 +18,7 @@ class LdnsConan(ConanFile): homepage = "https://www.nlnetlabs.nl/projects/ldns" description = "LDNS is a DNS library that facilitates DNS tool programming" topics = ("dns") - + package_type = "library" settings = "os", "compiler", "build_type", "arch" options = { "shared": [True, False], @@ -23,53 +29,50 @@ class LdnsConan(ConanFile): "fPIC": True, } - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - def validate(self): + def config_options(self): if self.settings.os == "Windows": - raise ConanInvalidConfiguration("Windows is not supported by the ldns recipe. Contributions are welcome.") - - @property - def _settings_build(self): - return getattr(self, "settings_build", self.settings) - - def requirements(self): - self.requires("openssl/1.1.1o") - - 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.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 config_options(self): - if self.settings.os == "Windows": - del self.options.fPIC + 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) + def requirements(self): + self.requires("openssl/[>=1.1 <4]") - def _configure_autotools(self): - if self._autotools: - return self._autotools + def validate(self): + if self.settings.os == "Windows": + raise ConanInvalidConfiguration("Windows is not supported by the ldns recipe. Contributions are welcome.") - def yes_no(v): return "yes" if v else "no" - args = [ - # libraries - f"--enable-shared={yes_no(self.options.shared)}", - f"--enable-static={yes_no(not self.options.shared)}", - f"--with-pic={yes_no(self.settings.os != 'Windows' and (self.options.shared or self.options.fPIC))}", + def source(self): + 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 = AutotoolsDeps(self) + try: + # This fixes an issue of linking against ldns in combination of openssl:shared=False, ldns:shared=True, and an older GCC: + # > hidden symbol `pthread_atfork' in /usr/lib/x86_64-linux-gnu/libpthread_nonshared.a(pthread_atfork.oS) is referenced by DSO + # OpenSSL adds -lpthread to link with POSIX thread library. Instead, it should use -pthread compiler flag which additionally + # sets required macros at compile time. + tc.environment.remove("LIBS", "-lpthread") + tc.environment.append("CFLAGS", "-pthread") + except ValueError: + pass + tc.generate() + + tc = AutotoolsToolchain(self) + tc.configure_args.extend([ "--disable-rpath", - # dependencies - f"--with-ssl={self.deps_cpp_info['openssl'].rootpath}", + f"--with-ssl={self.dependencies['openssl'].package_folder}", # DNSSEC algorithm support "--enable-ecdsa", "--enable-ed25519", @@ -84,36 +87,23 @@ def yes_no(v): return "yes" if v else "no" # library bindings "--without-pyldns", "--without-p5-dns-ldns", - ] + ]) if self.settings.compiler == "apple-clang": - args.append(f"--with-xcode-sdk={tools.XCRun(self.settings).sdk_version}") - - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - - # This fixes the issue of linking against ldns in combination of openssl:shared=False, ldns:shared=True, and an older GCC: - # > hidden symbol `pthread_atfork' in /usr/lib/x86_64-linux-gnu/libpthread_nonshared.a(pthread_atfork.oS) is referenced by DSO - # OpenSSL adds -lpthread to link POSIX thread library explicitly. That is not correct because using the library - # may require setting various on compilation as well. The compiler has a dedicated -pthread option for that. - if self.settings.os == "Linux": - self._autotools.libs.remove("pthread") - env = self._autotools.vars - env["CFLAGS"] += " -pthread" - else: - env = None - - self._autotools.configure(configure_dir=self._source_subfolder, args=args, vars=env) - return self._autotools + tc.configure_args.append(f"--with-xcode-sdk={XCRun(self).sdk_version}") + tc.generate() def build(self): - autotools = self._configure_autotools() + autotools = Autotools(self) + autotools.configure() autotools.make() def package(self): - autotools = self._configure_autotools() + autotools = Autotools(self) for target in ["install-h", "install-lib"]: - autotools.make(target=target) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) + autotools.install(target=target) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + copy(self, pattern="LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + fix_apple_shared_install_name(self) def package_info(self): self.cpp_info.libs = ["ldns"] diff --git a/recipes/ldns/all/test_package/conanfile.py b/recipes/ldns/all/test_package/conanfile.py index e6e81c8ee4894..651afdb268a4f 100644 --- a/recipes/ldns/all/test_package/conanfile.py +++ b/recipes/ldns/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_layout, CMake import os class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "pkg_config" + generators = "PkgConfigDeps", "CMakeToolchain", "VirtualRunEnv" + + 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/2.1.0") def build(self): cmake = CMake(self) @@ -12,5 +24,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - self.run(os.path.join(".", "example")) + if can_run(self): + example = os.path.join(self.cpp.build.bindir, "example") + self.run(example, env="conanrun") diff --git a/recipes/ldns/all/test_v1_package/CMakeLists.txt b/recipes/ldns/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..3c9553de48e54 --- /dev/null +++ b/recipes/ldns/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 3.1) +project(PackageTest C) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/ldns/all/test_v1_package/conanfile.py b/recipes/ldns/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..17fb742bffdde --- /dev/null +++ b/recipes/ldns/all/test_v1_package/conanfile.py @@ -0,0 +1,22 @@ +from conans import ConanFile, CMake +from conans.tools import cross_building +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "pkg_config" + + def build_requirements(self): + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.build_requires("pkgconf/2.1.0") + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + example = os.path.join("test_package", "example") + self.run(example, run_environment=True) diff --git a/recipes/ldns/config.yml b/recipes/ldns/config.yml index c3578038cb2a3..29db722a9f041 100644 --- a/recipes/ldns/config.yml +++ b/recipes/ldns/config.yml @@ -1,3 +1,5 @@ versions: - "1.8.1": - folder: all + "1.8.2": + folder: all + "1.8.1": + folder: all diff --git a/recipes/lefticus-tools/all/conandata.yml b/recipes/lefticus-tools/all/conandata.yml new file mode 100644 index 0000000000000..5f60c304dca5d --- /dev/null +++ b/recipes/lefticus-tools/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "cci.20230420": + url: "https://github.com/lefticus/tools/archive/137dd15b8aa9d43cc8633b972eec82c9009b6bbd.tar.gz" + sha256: "f1ef4929ea608fb466e11af635d2537808a7df7b1bc664d9742d147ed08e24c2" diff --git a/recipes/lefticus-tools/all/conanfile.py b/recipes/lefticus-tools/all/conanfile.py new file mode 100644 index 0000000000000..d3dbf33094acc --- /dev/null +++ b/recipes/lefticus-tools/all/conanfile.py @@ -0,0 +1,68 @@ +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, check_min_vs +from conan.tools.scm import Version +import os + + +required_conan_version = ">=1.53.0" + + +class LefticusToolsConan(ConanFile): + name = "lefticus-tools" + description = "Some handy C++ tools" + topics = ("tools", "cpp", "cmake") + license = "MIT" + homepage = "https://github.com/lefticus/tools" + 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 _min_cppstd(self): + return "20" + + @property + def _compilers_minimum_version(self): + return { + "gcc": "11", + "clang": "13", + "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.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 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="ProjectOptions", dst=os.path.join(self.package_folder, "lib", "cmake"), src=self.source_folder) + copy(self, pattern="*.cmake", dst=os.path.join(self.package_folder, "lib", "cmake", "cmake"), src=os.path.join(self.source_folder, "cmake")) + 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.set_property("cmake_target_name", "lefticus::tools") + self.cpp_info.builddirs.append(os.path.join("lib", "cmake")) + self.cpp_info.libdirs = [] + self.cpp_info.bindirs = [] diff --git a/recipes/lefticus-tools/all/test_package/CMakeLists.txt b/recipes/lefticus-tools/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..d6a06ccd62240 --- /dev/null +++ b/recipes/lefticus-tools/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(lefticus-tools REQUIRED CONFIG) + +add_executable(${CMAKE_PROJECT_NAME} test_package.cpp) +target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE lefticus::tools) +target_compile_features(${CMAKE_PROJECT_NAME} PRIVATE cxx_std_20) diff --git a/recipes/lefticus-tools/all/test_package/conanfile.py b/recipes/lefticus-tools/all/test_package/conanfile.py new file mode 100644 index 0000000000000..254feca104287 --- /dev/null +++ b/recipes/lefticus-tools/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 = "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): + self.run(os.path.join(self.cpp.build.bindirs[0], "test_package"), env="conanrun") diff --git a/recipes/lefticus-tools/all/test_package/test_package.cpp b/recipes/lefticus-tools/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..01077cece833f --- /dev/null +++ b/recipes/lefticus-tools/all/test_package/test_package.cpp @@ -0,0 +1,15 @@ +#include +#include + +#include "lefticus/tools/consteval_invoke.hpp" + + +constexpr unsigned int Factorial(unsigned int number) { + return number <= 1 ? number : Factorial(number - 1) * number; +} + + +int main() { + std::cout << "Factorial of 3 is: " << lefticus::tools::consteval_invoke(Factorial, 3) << std::endl; + return EXIT_SUCCESS; +} diff --git a/recipes/lefticus-tools/config.yml b/recipes/lefticus-tools/config.yml new file mode 100644 index 0000000000000..7c6ba2bb8da04 --- /dev/null +++ b/recipes/lefticus-tools/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20230420": + folder: all diff --git a/recipes/lely-core/all/conandata.yml b/recipes/lely-core/all/conandata.yml new file mode 100644 index 0000000000000..a02c4e51288f2 --- /dev/null +++ b/recipes/lely-core/all/conandata.yml @@ -0,0 +1,10 @@ +sources: + "2.3.4": + url: "https://gitlab.com/lely_industries/lely-core/-/archive/v2.3.4/lely-core-v2.3.4.tar.gz" + sha256: "6f31b4fd7ea6aafb1a62b9d956a12a900386564859099e97af1c6bd1d10bdaf2" + "2.3.3": + url: "https://gitlab.com/lely_industries/lely-core/-/archive/v2.3.3/lely-core-v2.3.3.tar.gz" + sha256: "6d0810f9e835543f0aeb5f86dcdc7a24578041f5d0a714bf5a14db2cb24ce373" + "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..7e88aacc94143 --- /dev/null +++ b/recipes/lely-core/all/conanfile.py @@ -0,0 +1,233 @@ +import os + +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import copy, get, rm, rmdir +from conan.tools.gnu import AutotoolsToolchain, Autotools +from conan.tools.layout import basic_layout + +required_conan_version = ">=1.53.0" + + +class LelyConan(ConanFile): + name = "lely-core" + 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." + ) + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://gitlab.com/lely_industries/lely-core/" + topics = ("canopen",) + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + 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 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 layout(self): + basic_layout(self, src_folder="src") + + 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 build_requirements(self): + self.tool_requires("libtool/2.4.7") + + def source(self): + 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 += [ + "--disable-cython", + "--disable-python", + "--disable-tools", + "--disable-dependency-tracking", + "--disable-maintainer-mode", + ] + if self.options.get_safe("ecss-compliance"): + tc.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): + tc.configure_args.append(f"--disable-{option}") + + tc.generate() + + def build(self): + autotools = Autotools(self) + autotools.autoreconf() + autotools.configure() + autotools.make() + + def package(self): + autotools = Autotools(self) + autotools.install() + + 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].set_property("pkg_config_name", f"liblely-{component}") + 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..f6bd04d2f5aad --- /dev/null +++ b/recipes/lely-core/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.2) +project(test_package LANGUAGES CXX) + +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..e8d99700ff1a0 --- /dev/null +++ b/recipes/lely-core/config.yml @@ -0,0 +1,7 @@ +versions: + "2.3.4": + folder: all + "2.3.3": + folder: all + "2.3.2": + folder: all diff --git a/recipes/lemon/all/CMakeLists.txt b/recipes/lemon/all/CMakeLists.txt index b3566d9546bb6..5faeac922c385 100644 --- a/recipes/lemon/all/CMakeLists.txt +++ b/recipes/lemon/all/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 2.8.14) -project(ConanLemon C) +cmake_minimum_required(VERSION 3.15) +project(Lemon LANGUAGES C) -include(conanbuildinfo.cmake) -conan_basic_setup() +add_executable(lemon ${LEMON_SRC_DIR}/tool/lemon.c) -add_executable(lemon source_subfolder/tool/lemon.c) -install(TARGETS lemon DESTINATION bin) -install(FILES source_subfolder/tool/lempar.c DESTINATION bin) +include(GNUInstallDirs) +install(TARGETS lemon DESTINATION ${CMAKE_INSTALL_BINDIR}) +install(FILES ${LEMON_SRC_DIR}/tool/lempar.c DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/recipes/lemon/all/conandata.yml b/recipes/lemon/all/conandata.yml index 9614c3e605634..c28ab14ba08ac 100644 --- a/recipes/lemon/all/conandata.yml +++ b/recipes/lemon/all/conandata.yml @@ -1,8 +1,7 @@ sources: "3.32.3": - "url": "https://sqlite.org/2020/sqlite-src-3320300.zip" - "sha256": "9312f0865d3692384d466048f746d18f88e7ffd1758b77d4f07904e03ed5f5b9" + url: "https://sqlite.org/2020/sqlite-src-3320300.zip" + sha256: "9312f0865d3692384d466048f746d18f88e7ffd1758b77d4f07904e03ed5f5b9" patches: "3.32.3": - patch_file: "patches/0001-use-executable-template-path.patch" - base_path: "source_subfolder" diff --git a/recipes/lemon/all/conanfile.py b/recipes/lemon/all/conanfile.py index c627284798121..648e6e06bd3a0 100644 --- a/recipes/lemon/all/conanfile.py +++ b/recipes/lemon/all/conanfile.py @@ -1,7 +1,9 @@ -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, load, save import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class LemonConan(ConanFile): @@ -9,49 +11,48 @@ class LemonConan(ConanFile): description = "The Lemon program reads a grammar of the input language and emits C-code to implement a parser for that language." url = "https://github.com/conan-io/conan-center-index" homepage = "https://sqlite.org/lemon.html" - topics = ("conan", "lemon", "grammar", "lexer", "lalr", "parser", "generator", "sqlite") + topics = ("grammar", "lexer", "lalr", "parser", "generator", "sqlite") license = "Unlicense" - exports_sources = "CMakeLists.txt", "patches/**" - settings = "os", "compiler", "arch", "build_type" - generators = "cmake" + package_type = "application" + settings = "os", "arch", "compiler", "build_type" - @property - def _source_subfolder(self): - return "source_subfolder" - - _cmake = None + def export_sources(self): + copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder) + 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 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.configure() - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["LEMON_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_text(self): - header = tools.load(os.path.join(self._source_subfolder, "tool", "lempar.c")) + header = load(self, os.path.join(self.source_folder, "tool", "lempar.c")) return "\n".join(line.strip(" \n*") for line in header[3:header.find("*******", 1)].splitlines()) def package(self): - tools.save(os.path.join(self.package_folder, "licenses", "LICENSE"), self._extract_license_text()) - cmake = self._configure_cmake() + save(self, os.path.join(self.package_folder, "licenses", "LICENSE"), self._extract_license_text()) + cmake = CMake(self) cmake.install() 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.includedirs = [] + 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/lemon/all/test_package/CMakeLists.txt b/recipes/lemon/all/test_package/CMakeLists.txt index 14a7c1be4f8e9..939f259b3d4dd 100644 --- a/recipes/lemon/all/test_package/CMakeLists.txt +++ b/recipes/lemon/all/test_package/CMakeLists.txt @@ -1,13 +1,12 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.2) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_program(LEMON_PROGRAM NAMES lemon) -add_custom_command(OUTPUT gram.c gram.h - COMMAND lemon -s "${PROJECT_SOURCE_DIR}/gram.y" -d"${PROJECT_BINARY_DIR}" +add_custom_command( + OUTPUT gram.c gram.h + COMMAND ${LEMON_PROGRAM} -s "${PROJECT_SOURCE_DIR}/gram.y" -d"${PROJECT_BINARY_DIR}" BYPRODUCTS gram.out ) add_executable(${PROJECT_NAME} gram.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) diff --git a/recipes/lemon/all/test_package/conanfile.py b/recipes/lemon/all/test_package/conanfile.py index 287e10a174c2f..a1b9a2d470968 100644 --- a/recipes/lemon/all/test_package/conanfile.py +++ b/recipes/lemon/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" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "VirtualBuildEnv", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def build_requirements(self): + self.tool_requires(self.tested_reference_str) def build(self): - if not tools.cross_building(self.settings): - cmake = CMake(self) - cmake.configure() - cmake.build() + 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) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/lemon/all/test_v1_package/CMakeLists.txt b/recipes/lemon/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/lemon/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/lemon/all/test_v1_package/conanfile.py b/recipes/lemon/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..02ecf312299d6 --- /dev/null +++ b/recipes/lemon/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" + test_type = "explicit" + + 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") + self.run(bin_path, run_environment=True) diff --git a/recipes/lemon/config.yml b/recipes/lemon/config.yml index 2d5e8d76accb1..65d307f5d363d 100644 --- a/recipes/lemon/config.yml +++ b/recipes/lemon/config.yml @@ -1,3 +1,3 @@ -"versions": +versions: "3.32.3": - "folder": "all" + folder: "all" diff --git a/recipes/leopard/all/conandata.yml b/recipes/leopard/all/conandata.yml new file mode 100644 index 0000000000000..293257cff4fed --- /dev/null +++ b/recipes/leopard/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "2.1.0": + url: "https://github.com/hosseinmoein/Leopard/archive/refs/tags/2.1.0.tar.gz" + sha256: "26b57fdea4cd94ddbc34a478e978632637cde2fc263bdf2d6bdfd3e9ddd0b1d5" + "2.0.0": + url: "https://github.com/hosseinmoein/Leopard/archive/refs/tags/2.0.0.tar.gz" + sha256: "c24ac5d2555c4496f26662925061a52ae1b2265ae9fc91b0cce19d1647d62699" diff --git a/recipes/leopard/all/conanfile.py b/recipes/leopard/all/conanfile.py new file mode 100644 index 0000000000000..f2a3c9d555477 --- /dev/null +++ b/recipes/leopard/all/conanfile.py @@ -0,0 +1,80 @@ +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 LeopardConan(ConanFile): + name = "leopard" + description = "C++ light-weight Thread Pool library" + license = "BSD-3-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/hosseinmoein/Leopard" + topics = ("async", "concurrency", "multithreading", "threadpool", "header-only") + package_type = "header-library" + 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": "14", + "Visual Studio": "16", + "msvc": "192", + } + + 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="*.h", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include"), + ) + copy( + self, + pattern="*.tcc", + 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", "ThreadPool") + self.cpp_info.set_property("cmake_target_name", "ThreadPool::ThreadPool") + self.cpp_info.set_property("pkg_config_name", "ThreadPool") + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["pthread", "dl", "m"]) diff --git a/recipes/leopard/all/test_package/CMakeLists.txt b/recipes/leopard/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..ea0b1b09a817d --- /dev/null +++ b/recipes/leopard/all/test_package/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(ThreadPool REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE ThreadPool::ThreadPool) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) + +if(ThreadPool_VERSION VERSION_LESS 2.1.0) + target_compile_definitions(${PROJECT_NAME} PRIVATE "THREADPOOL_LESS_2_1_0") +endif() diff --git a/recipes/leopard/all/test_package/conanfile.py b/recipes/leopard/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/leopard/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/leopard/all/test_package/test_package.cpp b/recipes/leopard/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..abf2d43498e45 --- /dev/null +++ b/recipes/leopard/all/test_package/test_package.cpp @@ -0,0 +1,69 @@ +#ifdef THREADPOOL_LESS_2_1_0 +#include +#else +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace hmthrp; + +// ---------------------------------------------------------------------------- + +static constexpr std::size_t THREAD_COUNT = 5; + +// ---------------------------------------------------------------------------- + +static void parallel_accumulate() { + + std::cout << "Running parallel_accumulate() ..." << std::endl; + + constexpr std::size_t n { 10003 }; + constexpr std::size_t the_sum { (n * (n + 1)) / 2 }; + std::vector vec (n); + + std::iota(vec.begin(), vec.end(), 1); + + constexpr std::size_t block_size { n / THREAD_COUNT }; + std::vector> futs; + auto block_start = vec.begin(); + ThreadPool thr_pool { THREAD_COUNT }; + + futs.reserve(THREAD_COUNT - 1); + for (std::size_t i = 0; i < (THREAD_COUNT - 1); ++i) { + const auto block_end { block_start + block_size }; + + futs.push_back( + thr_pool.dispatch( + false, + std::accumulate, + block_start, block_end, 0)); + block_start = block_end; + } + + // Last result + // + std::size_t result { std::accumulate(block_start, vec.end(), 0UL) }; + + for (std::size_t i = 0; i < futs.size(); ++i) + result += futs[i].get(); + + assert(result == the_sum); + return; +} + +// ---------------------------------------------------------------------------- + +int main (int, char *[]) { + + parallel_accumulate(); + + return (EXIT_SUCCESS); +} diff --git a/recipes/leopard/config.yml b/recipes/leopard/config.yml new file mode 100644 index 0000000000000..2d136f3fe768d --- /dev/null +++ b/recipes/leopard/config.yml @@ -0,0 +1,5 @@ +versions: + "2.1.0": + folder: all + "2.0.0": + folder: all diff --git a/recipes/leptonica/all/conandata.yml b/recipes/leptonica/all/conandata.yml index 452eea8cdafea..0a2cd20eab0b4 100644 --- a/recipes/leptonica/all/conandata.yml +++ b/recipes/leptonica/all/conandata.yml @@ -1,19 +1,13 @@ sources: + "1.85.0": + url: "https://github.com/DanBloomberg/leptonica/archive/1.85.0.tar.gz" + sha256: "c01376bce0379d4ea4bc2ec5d5cbddaa49e2f06f88242619ab8c059e21adf233" + "1.83.1": + url: "https://github.com/DanBloomberg/leptonica/archive/1.83.1.tar.gz" + sha256: "4289d0a4224b614010072253531c0455a33a4d7c7a0017fe7825ed382290c0da" "1.82.0": url: "https://github.com/DanBloomberg/leptonica/archive/1.82.0.tar.gz" sha256: "40fa9ac1e815b91e0fa73f0737e60c9eec433a95fa123f95f2573dd3127dd669" "1.81.0": url: "https://github.com/DanBloomberg/leptonica/archive/1.81.0.tar.gz" sha256: "70ebc04ff8b9684205bd1d01843c635a8521255b74813bf7cce9a33368f7952c" - "1.80.0": - url: "https://github.com/DanBloomberg/leptonica/archive/1.80.0.tar.gz" - sha256: "3952b974ec057d24267aae48c54bca68ead8275604bf084a73a4b953ff79196e" - "1.79.0": - url: "https://github.com/DanBloomberg/leptonica/archive/1.79.0.tar.gz" - sha256: "bf9716f91a4844c2682a07ef21eaf68b6f1077af1f63f27c438394fd66218e17" - "1.78.0": - url: "https://github.com/DanBloomberg/leptonica/archive/1.78.0.tar.gz" - sha256: "f8ac4d93cc76b524c2c81d27850bfc342e68b91368aa7a1f7d69e34ce13adbb4" -patches: - "1.78.0": - - patch_file: "patches/fix-find-modules-variables.patch" diff --git a/recipes/leptonica/all/conanfile.py b/recipes/leptonica/all/conanfile.py index 399ac8b097d48..f19aa2e7c182f 100644 --- a/recipes/leptonica/all/conanfile.py +++ b/recipes/leptonica/all/conanfile.py @@ -1,14 +1,13 @@ 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.env import 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.52.0" +required_conan_version = ">=1.55.0" class LeptonicaConan(ConanFile): @@ -16,17 +15,18 @@ class LeptonicaConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" description = "Library containing software that is broadly useful for " \ "image processing and image analysis applications." - topics = ("leptonica", "image", "multimedia", "format", "graphics") + topics = ("image", "multimedia", "format", "graphics") homepage = "http://leptonica.org" license = "BSD 2-Clause" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], "with_zlib": [True, False], "with_gif": [True, False], - "with_jpeg": [False, "libjpeg", "libjpeg-turbo"], + "with_jpeg": [False, "libjpeg", "libjpeg-turbo", "mozjpeg"], "with_png": [True, False], "with_tiff": [True, False], "with_openjpeg": [True, False], @@ -52,62 +52,61 @@ def config_options(self): del self.options.fPIC def configure(self): - if self.options.with_tiff: - self.options["libtiff"].jpeg = self.options.with_jpeg 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 + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + if bool(self.options.with_jpeg): + self.options["*"].jpeg = self.options.with_jpeg + self.options["*"].with_jpeg = self.options.with_jpeg + self.options["*"].with_libjpeg = self.options.with_jpeg def layout(self): cmake_layout(self, src_folder="src") def requirements(self): if self.options.with_zlib: - self.requires("zlib/1.2.13") + self.requires("zlib/[>=1.2.11 <2]") if self.options.with_gif: self.requires("giflib/5.2.1") if self.options.with_jpeg == "libjpeg": self.requires("libjpeg/9e") - if self.options.with_jpeg == "libjpeg-turbo": - self.requires("libjpeg-turbo/2.1.4") + elif self.options.with_jpeg == "libjpeg-turbo": + self.requires("libjpeg-turbo/3.0.2") + elif self.options.with_jpeg == "mozjpeg": + self.requires("mozjpeg/4.1.5") if self.options.with_png: - self.requires("libpng/1.6.38") + self.requires("libpng/[>=1.6 <2]") if self.options.with_tiff: - self.requires("libtiff/4.4.0") + self.requires("libtiff/4.6.0") if self.options.with_openjpeg: - self.requires("openjpeg/2.5.0") + self.requires("openjpeg/2.5.2") if self.options.with_webp: - 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.") + self.requires("libwebp/1.3.2") def build_requirements(self): if self.options.with_webp or self.options.with_openjpeg: - self.tool_requires("pkgconf/1.9.3") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/2.1.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): 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.85.0": + tc.variables["ENABLE_ZLIB"] = self.options.with_zlib + tc.variables["ENABLE_PNG"] = self.options.with_png + tc.variables["ENABLE_GIF"] = self.options.with_gif + tc.variables["ENABLE_JPEG"] = self.options.with_jpeg + tc.variables["ENABLE_TIFF"] = self.options.with_tiff + tc.variables["ENABLE_WEBP"] = self.options.with_webp + tc.variables["ENABLE_OPENJPEG"] = self.options.with_openjpeg + elif 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() @@ -116,10 +115,6 @@ def generate(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") def _patch_sources(self): apply_conandata_patches(self) @@ -158,28 +153,37 @@ def _patch_sources(self): ## We have to be more aggressive with dependencies found with pkgconfig ## Injection of libdirs is ensured by conan_basic_setup() ## openjpeg - replace_in_file(self, cmakelists, "if(NOT JP2K)", "if(0)") - replace_in_file(self, cmakelists_src, - "if (JP2K_FOUND)", - "if (JP2K_FOUND)\n" - "target_link_directories(leptonica PRIVATE ${JP2K_LIBRARY_DIRS})\n" - "target_compile_definitions(leptonica PRIVATE ${JP2K_CFLAGS_OTHER})") - 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)") + if Version(self.version) < "1.85.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 + 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)") + elif Version(self.version) < "1.85.0": + 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 - replace_in_file(self, cmakelists, "if(NOT WEBP)", "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})") - replace_in_file(self, cmakelists_src, "${WEBP_LIBRARIES}", "${WEBP_LIBRARIES} ${WEBPMUX_LIBRARIES}") - if Version(self.version) >= "1.79.0": + 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)") 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)") + 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)") + if Version(self.version) < "1.85.0": + if Version(self.version) >= "1.83.0" and self.options.with_webp: + 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})") + 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. diff --git a/recipes/leptonica/all/patches/fix-find-modules-variables.patch b/recipes/leptonica/all/patches/fix-find-modules-variables.patch deleted file mode 100644 index 3dc86df7e707e..0000000000000 --- a/recipes/leptonica/all/patches/fix-find-modules-variables.patch +++ /dev/null @@ -1,48 +0,0 @@ -see https://github.com/DanBloomberg/leptonica/pull/456 - ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -31,33 +31,33 @@ if (NOT STATIC) - target_compile_definitions (leptonica PRIVATE -DLIBLEPT_EXPORTS) - endif() - --if (GIF_LIBRARY) -+if (GIF_LIBRARIES) - target_include_directories (leptonica PUBLIC ${GIF_INCLUDE_DIR}) -- target_link_libraries (leptonica ${GIF_LIBRARY}) -+ target_link_libraries (leptonica ${GIF_LIBRARIES}) - endif() --if (JPEG_LIBRARY) -+if (JPEG_LIBRARIES) - target_include_directories (leptonica PUBLIC ${JPEG_INCLUDE_DIR}) -- target_link_libraries (leptonica ${JPEG_LIBRARY}) -+ target_link_libraries (leptonica ${JPEG_LIBRARIES}) - endif() - if (JP2K_FOUND) - target_include_directories (leptonica PUBLIC ${JP2K_INCLUDE_DIRS}) - target_link_libraries (leptonica ${JP2K_LIBRARIES}) - endif() --if (PNG_LIBRARY) -+if (PNG_LIBRARIES) - target_include_directories (leptonica PUBLIC ${PNG_INCLUDE_DIRS}) -- target_link_libraries (leptonica ${PNG_LIBRARY}) -+ target_link_libraries (leptonica ${PNG_LIBRARIES}) - endif() --if (TIFF_LIBRARY) -+if (TIFF_LIBRARIES) - target_include_directories (leptonica PUBLIC ${TIFF_INCLUDE_DIR}) -- target_link_libraries (leptonica ${TIFF_LIBRARY}) -+ target_link_libraries (leptonica ${TIFF_LIBRARIES}) - endif() - if (WEBP_FOUND) - target_include_directories (leptonica PUBLIC ${WEBP_INCLUDE_DIRS}) - target_link_libraries (leptonica ${WEBP_LIBRARIES}) - endif() --if (ZLIB_LIBRARY) -+if (ZLIB_LIBRARIES) - target_include_directories (leptonica PUBLIC ${ZLIB_INCLUDE_DIR}) -- target_link_libraries (leptonica ${ZLIB_LIBRARY}) -+ target_link_libraries (leptonica ${ZLIB_LIBRARIES}) - endif() - - if (UNIX) diff --git a/recipes/leptonica/all/test_v1_package/CMakeLists.txt b/recipes/leptonica/all/test_v1_package/CMakeLists.txt index f86c2a9f99016..0d20897301b68 100644 --- a/recipes/leptonica/all/test_v1_package/CMakeLists.txt +++ b/recipes/leptonica/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(Leptonica REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE leptonica) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/leptonica/config.yml b/recipes/leptonica/config.yml index eb5d4ef99b906..73dd82999a627 100644 --- a/recipes/leptonica/config.yml +++ b/recipes/leptonica/config.yml @@ -1,11 +1,9 @@ versions: - "1.82.0": - folder: all - "1.81.0": + "1.85.0": folder: all - "1.80.0": + "1.83.1": folder: all - "1.79.0": + "1.82.0": folder: all - "1.78.0": + "1.81.0": folder: all diff --git a/recipes/lerc/all/conandata.yml b/recipes/lerc/all/conandata.yml index f1d58df7a46b7..d53c3de3dfbc3 100644 --- a/recipes/lerc/all/conandata.yml +++ b/recipes/lerc/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "4.0.4": + url: "https://github.com/Esri/lerc/archive/js_v4.0.4.tar.gz" + sha256: "1dc090218387ab8ca615eefd844207be64454e37868b396f3e965ed0dcf83947" + "4.0.1": + url: "https://github.com/Esri/lerc/archive/js_v4.0.1.tar.gz" + sha256: "d771f45b90dd033187d5fad2b99159d0a98d46878d88d3236147c3df297dd544" "4.0.0": url: "https://github.com/Esri/lerc/archive/refs/tags/v4.0.0.tar.gz" sha256: "91431c2b16d0e3de6cbaea188603359f87caed08259a645fd5a3805784ee30a0" @@ -9,6 +15,18 @@ sources: url: "https://github.com/Esri/lerc/archive/v2.1.tar.gz" sha256: "7c48de40cd5f09319de4b39c417ff4eec4ad4b6aa5d6144f6ffa9b10d18ec94e" patches: + "4.0.4": + - patch_file: "patches/4.0.0-include-algorithm.patch" + patch_description: "include algorithm header for std::min/max" + patch_type: "portability" + - patch_file: "patches/4.0.4-add-missing-climits-include.patch" + patch_description: "add missing #include " + patch_type: "bugfix" + patch_source: "https://github.com/Esri/lerc/commit/1fc73694263f53cf029c8cac2e632170880f56d4" + "4.0.1": + - patch_file: "patches/4.0.0-include-algorithm.patch" + patch_description: "include algorithm header for std::min/max" + patch_type: "portability" "4.0.0": - patch_file: "patches/4.0.0-include-algorithm.patch" patch_description: "include algorithm header for std::min/max" diff --git a/recipes/lerc/all/conanfile.py b/recipes/lerc/all/conanfile.py index 367095e05fd6b..02e1f24f77f3f 100644 --- a/recipes/lerc/all/conanfile.py +++ b/recipes/lerc/all/conanfile.py @@ -1,11 +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 export_conandata_patches, apply_conandata_patches, copy, get, rmdir from conan.tools.scm import Version import os -required_conan_version = ">=1.53.0" +required_conan_version = ">=1.54.0" class LercConan(ConanFile): @@ -14,7 +14,8 @@ class LercConan(ConanFile): license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/Esri/lerc" - topics = ("lerc", "lerclib", "compression", "decompression", "image", "raster") + topics = ("lerclib", "compression", "decompression", "image", "raster") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -40,20 +41,18 @@ def configure(self): if self.options.shared: self.options.rm_safe("fPIC") - def validate(self): - if self.info.settings.compiler.cppstd: - check_min_cppstd(self, self._min_cppstd) - 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): - 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.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" tc.generate() def build(self): @@ -74,6 +73,8 @@ def package_info(self): 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 not self.options.shared and stdcpp_library(self): + self.cpp_info.system_libs.append(stdcpp_library(self)) if Version(self.version) >= "3.0": self.cpp_info.set_property("pkg_config_name", "Lerc") diff --git a/recipes/lerc/all/patches/4.0.4-add-missing-climits-include.patch b/recipes/lerc/all/patches/4.0.4-add-missing-climits-include.patch new file mode 100644 index 0000000000000..e65c9a909930e --- /dev/null +++ b/recipes/lerc/all/patches/4.0.4-add-missing-climits-include.patch @@ -0,0 +1,21 @@ +From 1fc73694263f53cf029c8cac2e632170880f56d4 Mon Sep 17 00:00:00 2001 +From: Thomas Maurer +Date: Wed, 8 Nov 2023 12:54:35 -0800 +Subject: [PATCH] add missing include + +--- + src/LercLib/fpl_Compression.cpp | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/LercLib/fpl_Compression.cpp b/src/LercLib/fpl_Compression.cpp +index bea9483..22773dd 100644 +--- a/src/LercLib/fpl_Compression.cpp ++++ b/src/LercLib/fpl_Compression.cpp +@@ -27,6 +27,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 50d07b3052d3e..e4ae3c108dbd4 100644 --- a/recipes/lerc/all/test_package/CMakeLists.txt +++ b/recipes/lerc/all/test_package/CMakeLists.txt @@ -1,12 +1,11 @@ cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +project(test_package LANGUAGES C 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) +add_executable(${PROJECT_NAME}_cxx test_package.cpp) +target_link_libraries(${PROJECT_NAME}_cxx PRIVATE lerc::lerc) +target_compile_features(${PROJECT_NAME}_cxx PRIVATE cxx_std_11) -if(lerc_VERSION VERSION_GREATER_EQUAL "3.0") - target_compile_definitions(${PROJECT_NAME} PRIVATE -DLERC_VER3_LATER) -endif() +add_executable(${PROJECT_NAME}_c test_package.c) +target_link_libraries(${PROJECT_NAME}_c PRIVATE lerc::lerc) diff --git a/recipes/lerc/all/test_package/conanfile.py b/recipes/lerc/all/test_package/conanfile.py index d120a992c06a6..f5c4345946223 100644 --- a/recipes/lerc/all/test_package/conanfile.py +++ b/recipes/lerc/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() @@ -21,5 +22,7 @@ def build(self): def test(self): if can_run(self): - bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + bin_path = os.path.join(self.cpp.build.bindir, "test_package_cxx") + self.run(bin_path, env="conanrun") + bin_path = os.path.join(self.cpp.build.bindir, "test_package_c") self.run(bin_path, env="conanrun") diff --git a/recipes/lerc/all/test_package/test_package.c b/recipes/lerc/all/test_package/test_package.c new file mode 100644 index 0000000000000..193917ddd512b --- /dev/null +++ b/recipes/lerc/all/test_package/test_package.c @@ -0,0 +1,11 @@ +#include + +#include + +int main() { + const uint32_t numBytesBlob = 275714; + uint8_t pLercBlob[1000000]; + uint32_t infoArr[10]; + double dataRangeArr[3]; + lerc_getBlobInfo(&pLercBlob[0], numBytesBlob, infoArr, dataRangeArr, 10, 3); +} diff --git a/recipes/lerc/all/test_package/test_package.cpp b/recipes/lerc/all/test_package/test_package.cpp index c399abcf8d219..98eb0ea449f54 100644 --- a/recipes/lerc/all/test_package/test_package.cpp +++ b/recipes/lerc/all/test_package/test_package.cpp @@ -1,140 +1,12 @@ #include -#include -#include -#include -#include +#include #include -typedef unsigned char Byte; // convenience -typedef unsigned int uint32; - -enum lerc_DataType { dt_char = 0, dt_uchar, dt_short, dt_ushort, dt_int, dt_uint, dt_float, dt_double }; - -void BlobInfo_Print(const uint32* infoArr) -{ - const uint32* ia = infoArr; - printf("version = %d, dataType = %d, nDim = %d, nCols = %d, nRows = %d, nBands = %d, nValidPixels = %d, blobSize = %d\n", - ia[0], ia[1], ia[2], ia[3], ia[4], ia[5], ia[6], ia[7]); -} - -bool BlobInfo_Equal(const uint32* infoArr, uint32 nDim, uint32 nCols, uint32 nRows, uint32 nBands, uint32 dataType) -{ - const uint32* ia = infoArr; - return ia[1] == dataType && ia[2] == nDim && ia[3] == nCols && ia[4] == nRows && ia[5] == nBands; -} - -// Sample 1: float image, 1 band, with some pixels set to invalid / void, maxZError = 0.1 -void sample1() { - const int h = 512; - const int w = 512; - - std::vector zImg(w * h); - std::vector maskByteImg(w * h); - for (int k = 0, i = 0; i < h; ++i) { - for (int j = 0; j < w; ++j, ++k) { - zImg[k] = std::sqrt(static_cast(i * i + j * j)); // smooth surface - zImg[k] += std::rand() % 20; // add some small amplitude noise - - if (j % 100 == 0 || i % 100 == 0) // set some void points - maskByteImg[k] = 0; - else - maskByteImg[k] = 1; - } - } - - - // compress into byte arr - - double maxZErrorWanted = 0.1; - double eps = 0.0001; // safety margin (optional), to account for finite floating point accuracy - double maxZError = maxZErrorWanted - eps; - - uint32 numBytesNeeded = 0; - uint32 numBytesWritten = 0; - - 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, -#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 - - if (hr) - std::cout << "lerc_computeCompressedSize(...) failed" << std::endl; - - uint32 numBytesBlob = numBytesNeeded; - std::vector pLercBlob(numBytesBlob); - - hr = lerc_encode(reinterpret_cast(&zImg[0]), // raw image data, row by row, band by band - static_cast(dt_float), 1, w, h, 1, -#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 - &numBytesWritten); // num bytes written to buffer - - if (hr) - std::cout << "lerc_encode(...) failed" << std::endl; - - double ratio = w * h * (0.125 + sizeof(float)) / numBytesBlob; - std::cout << "sample 1 compression ratio = " << ratio << std::endl; - - - // decompress - - 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, 1, w, h, 1, static_cast(dt_float))) - std::cout << "got wrong lerc info" << std::endl; - - // new empty data storage - std::vector zImg3(w * h); - - 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; - - // compare to orig - - double maxDelta = 0; - for (int k = 0, i = 0; i < h; i++) - { - for (int j = 0; j < w; j++, k++) - { - if (maskByteImg3[k] != maskByteImg[k]) - std::cout << "Error in main: decoded valid bytes differ from encoded valid bytes" << std::endl; - - if (maskByteImg3[k]) - { - double delta = std::fabs(zImg3[k] - zImg[k]); - if (delta > maxDelta) - maxDelta = delta; - } - } - } - - std::cout << "max z error per pixel = " << maxDelta << std::endl; -} - int main() { - sample1(); - return 0; + uint32_t numBytesBlob = 275714; + std::vector pLercBlob(numBytesBlob); + uint32_t infoArr[10]; + double dataRangeArr[3]; + lerc_getBlobInfo(&pLercBlob[0], numBytesBlob, infoArr, dataRangeArr, 10, 3); } diff --git a/recipes/lerc/all/test_v1_package/conanfile.py b/recipes/lerc/all/test_v1_package/conanfile.py index 38f4483872d47..b7e21a6312c34 100644 --- a/recipes/lerc/all/test_v1_package/conanfile.py +++ b/recipes/lerc/all/test_v1_package/conanfile.py @@ -1,3 +1,4 @@ +from conan.tools.microsoft import is_msvc from conans import ConanFile, CMake, tools import os @@ -13,5 +14,9 @@ def build(self): def test(self): if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") + bin_path = os.path.join("bin", "test_package_cxx") self.run(bin_path, run_environment=True) + if not is_msvc(self): + # lerc_computeCompressedSize() fails with a stack overflow on MSVC for some reason + bin_path = os.path.join("bin", "test_package_c") + self.run(bin_path, run_environment=True) diff --git a/recipes/lerc/config.yml b/recipes/lerc/config.yml index 6bcfdf0332e1f..471b2c25702d4 100644 --- a/recipes/lerc/config.yml +++ b/recipes/lerc/config.yml @@ -1,4 +1,8 @@ versions: + "4.0.4": + folder: all + "4.0.1": + folder: all "4.0.0": folder: all "2.2": diff --git a/recipes/lest/all/conandata.yml b/recipes/lest/all/conandata.yml index 0c06b134376db..e910aac388249 100644 --- a/recipes/lest/all/conandata.yml +++ b/recipes/lest/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.35.2": + url: "https://github.com/martinmoene/lest/archive/v1.35.2.tar.gz" + sha256: "570031345d703587c4984b1fa918e611693735beeb37a6d889d234599b73c670" "1.35.1": url: "https://github.com/martinmoene/lest/archive/v1.35.1.tar.gz" sha256: "ca715833563f983c81d86623c2d1911d7a2aa04ce00459b0f3794a8e441265e0" diff --git a/recipes/lest/all/conanfile.py b/recipes/lest/all/conanfile.py index 64f52a3c5b929..8360bb0147108 100644 --- a/recipes/lest/all/conanfile.py +++ b/recipes/lest/all/conanfile.py @@ -1,27 +1,47 @@ import os -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout + class LestConan(ConanFile): name = "lest" - description = "A modern, C++11-native, single-file header-only, tiny framework for unit-tests, TDD and BDD." + description = ( + "A modern, C++11-native, single-file header-only, " + "tiny framework for unit-tests, TDD and BDD." + ) license = "BSL-1.0" - topics = ("conan", "testing", "testing-framework", "unit-testing", "header-only") - homepage = "https://github.com/martinmoene/lest" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/martinmoene/lest" + topics = ("testing", "testing-framework", "unit-testing", "header-only") + 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]) - os.rename(self.name + "-" + self.version, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): - self.copy("LICENSE.txt", dst="licenses", src=self._source_subfolder) - self.copy(pattern="*.hpp", dst="include", src=os.path.join(self._source_subfolder, "include")) + copy( + self, + "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_id(self): - self.info.header_only() + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/lest/all/test_package/CMakeLists.txt b/recipes/lest/all/test_package/CMakeLists.txt index 33ae887aa6aea..7c83263783aaf 100644 --- a/recipes/lest/all/test_package/CMakeLists.txt +++ b/recipes/lest/all/test_package/CMakeLists.txt @@ -1,9 +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() +find_package(lest 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 lest::lest) diff --git a/recipes/lest/all/test_package/conanfile.py b/recipes/lest/all/test_package/conanfile.py index ea57a464900be..ef5d7042163ec 100644 --- a/recipes/lest/all/test_package/conanfile.py +++ b/recipes/lest/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" + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/lest/all/test_package/test_package.cpp b/recipes/lest/all/test_package/test_package.cpp index 7b3f62f3908f8..e161263ae0bc7 100644 --- a/recipes/lest/all/test_package/test_package.cpp +++ b/recipes/lest/all/test_package/test_package.cpp @@ -1,14 +1,16 @@ -#include "lest/lest.hpp" +#include "lest/lest_cpp03.hpp" +#define CASE( name ) lest_CASE( specification, name ) -const lest::test specification[] = +using namespace lest; + +test_specification specification; + +CASE( "Comment converted to bool indicates absence or presence of comment" ) { - CASE( "Empty string has length zero (succeed)" ) - { - EXPECT( 0 == std::string( ).length() ); - EXPECT( 0 == std::string("").length() ); - }, -}; + EXPECT( false == bool( comment( "") ) ); + EXPECT( true == bool( comment("x") ) ); +} int main( int argc, char * argv[] ) { diff --git a/recipes/lest/config.yml b/recipes/lest/config.yml index 1e86bc3f93bdf..d5f65df0bf534 100644 --- a/recipes/lest/config.yml +++ b/recipes/lest/config.yml @@ -1,3 +1,5 @@ versions: + "1.35.2": + folder: all "1.35.1": folder: all diff --git a/recipes/level-zero/all/conandata.yml b/recipes/level-zero/all/conandata.yml new file mode 100644 index 0000000000000..239ec80fcfb55 --- /dev/null +++ b/recipes/level-zero/all/conandata.yml @@ -0,0 +1,9 @@ +sources: + "1.17.39": + url: "https://github.com/oneapi-src/level-zero/archive/refs/tags/v1.17.39.tar.gz" + sha256: "70473c7262eee80dbe7c17974684ba9d3e34efc15ecba919b85e3cea7b1e180e" +patches: + "1.17.39": + - patch_file: "patches/1.17.39/001-patch-remove-qspectre.patch" + patch_description: "Removed /Qspectre" + patch_type: "portability" \ No newline at end of file diff --git a/recipes/level-zero/all/conanfile.py b/recipes/level-zero/all/conanfile.py new file mode 100644 index 0000000000000..191466efdba72 --- /dev/null +++ b/recipes/level-zero/all/conanfile.py @@ -0,0 +1,74 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os +from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps +from conan.tools.files import get, apply_conandata_patches, copy, export_conandata_patches, rmdir, replace_in_file +from conan.tools.build import check_min_cppstd +import os + + +class LevelZeroConan(ConanFile): + name = "level-zero" + license = "MIT" + homepage = "https://github.com/oneapi-src/level-zero" + url = "https://github.com/conan-io/conan-center-index" + description = "OneAPI Level Zero Specification Headers and Loader" + topics = ("api-headers", "loader", "level-zero", "oneapi") + package_type = "shared-library" + + # Binary configuration + settings = "os", "arch", "compiler", "build_type" + + def requirements(self): + self.requires("spdlog/1.14.1") + + def source(self): + version_data = self.conan_data["sources"][self.version] + get(self, **version_data, strip_root=True) + apply_conandata_patches(self) + replace_in_file(self, os.path.join(self.source_folder, "source", "loader","ze_loader.cpp"), + "#ifdef __linux__", "#if defined(__linux__) || defined(__APPLE__)") + + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + cmake_layout(self, src_folder="src") + + def generate(self): + deps = CMakeDeps(self) + deps.generate() + + toolchain = CMakeToolchain(self) + toolchain.generate() + + def validate(self): + if is_apple_os(self): + self.output.warning("Level Zero is not known to support Apple platforms") + if self.settings.os == "Windows" and self.settings.get_safe("subsystem") == "uwp": + raise ConanInvalidConfiguration(f"{self.ref} does not support UWP on Windows.") + + min_cpp_std = "14" + check_min_cppstd(self, min_cpp_std) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + cmake = CMake(self) + cmake.install() + copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + + def package_info(self): + self.cpp_info.components["ze-loader"].libs = ["ze_loader"] + self.cpp_info.components["ze-loader"].includedirs = ["include", "include/level_zero"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["ze-loader"].system_libs = ["pthread"] + elif self.settings.os == "Windows": + self.cpp_info.components["ze-loader"].system_libs = ["cfgmgr32"] + self.cpp_info.components["ze-loader"].set_property("pkg_config_name", "libze_loader") + self.cpp_info.components["level-zero"].requires = ["ze-loader"] + self.cpp_info.components["level-zero"].set_property("pkg_config_name", "level-zero") diff --git a/recipes/level-zero/all/patches/1.17.39/001-patch-remove-qspectre.patch b/recipes/level-zero/all/patches/1.17.39/001-patch-remove-qspectre.patch new file mode 100644 index 0000000000000..997ca7a844e96 --- /dev/null +++ b/recipes/level-zero/all/patches/1.17.39/001-patch-remove-qspectre.patch @@ -0,0 +1,17 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index ac2ab9f..5282757 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -132,12 +132,6 @@ if(MSVC) + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DYNAMICBASE") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /guard:cf") + # enable Spectre Mitigation, not supported by clang-cl +- if((NOT CMAKE_CXX_COMPILER_ID STREQUAL Clang) AND (NOT CMAKE_CXX_COMPILER_ID STREQUAL IntelLLVM)) +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Qspectre") +- endif() +- if((NOT CMAKE_C_COMPILER_ID STREQUAL Clang) AND NOT (CMAKE_C_COMPILER_ID STREQUAL IntelLLVM)) +- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Qspectre") +- endif() + endif() + + #CXX compiler support diff --git a/recipes/level-zero/all/test_package/CMakeLists.txt b/recipes/level-zero/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..6b92e033f045a --- /dev/null +++ b/recipes/level-zero/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.2.0) +project(test_package LANGUAGES CXX) + +find_package(level-zero CONFIG REQUIRED) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE level-zero::level-zero) + +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) \ No newline at end of file diff --git a/recipes/level-zero/all/test_package/conanfile.py b/recipes/level-zero/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0ac491f64a94f --- /dev/null +++ b/recipes/level-zero/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, CMakeDeps, CMakeToolchain, 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/level-zero/all/test_package/test_package.cpp b/recipes/level-zero/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..50cc7683ea557 --- /dev/null +++ b/recipes/level-zero/all/test_package/test_package.cpp @@ -0,0 +1,6 @@ +#include "ze_api.h" + +int main() { + zeInit(0); + return 0; +} diff --git a/recipes/level-zero/config.yml b/recipes/level-zero/config.yml new file mode 100644 index 0000000000000..6cac94c96d3b8 --- /dev/null +++ b/recipes/level-zero/config.yml @@ -0,0 +1,3 @@ +versions: + "1.17.39": + folder: "all" diff --git a/recipes/leveldb/all/conanfile.py b/recipes/leveldb/all/conanfile.py index 7aefd15a7bf6f..8886ea342497d 100644 --- a/recipes/leveldb/all/conanfile.py +++ b/recipes/leveldb/all/conanfile.py @@ -4,7 +4,7 @@ from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class LevelDBCppConan(ConanFile): @@ -15,9 +15,10 @@ class LevelDBCppConan(ConanFile): ) url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/google/leveldb" - topics = ("leveldb", "google", "db") + topics = ("google", "db") license = ("BSD-3-Clause",) + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -41,10 +42,7 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") @@ -54,17 +52,16 @@ def requirements(self): # 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") + self.requires("snappy/1.1.10") if self.options.with_crc32c: self.requires("crc32c/1.1.2") def validate(self): - if self.info.settings.compiler.get_safe("cppstd"): + 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/leveldb/all/test_v1_package/CMakeLists.txt b/recipes/leveldb/all/test_v1_package/CMakeLists.txt index add355dae7008..0d20897301b68 100644 --- a/recipes/leveldb/all/test_v1_package/CMakeLists.txt +++ b/recipes/leveldb/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(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) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/lexbor/all/CMakeLists.txt b/recipes/lexbor/all/CMakeLists.txt deleted file mode 100644 index 96d7aa4b915cd..0000000000000 --- a/recipes/lexbor/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper LANGUAGES C) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory(source_subfolder) diff --git a/recipes/lexbor/all/conandata.yml b/recipes/lexbor/all/conandata.yml index 21c6f4fc19465..35cc55439d666 100644 --- a/recipes/lexbor/all/conandata.yml +++ b/recipes/lexbor/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "2.4.0": + url: "https://github.com/lexbor/lexbor/archive/v2.4.0.zip" + sha256: "8cfaf8783f736ce784f5fbdf284a6db8c0943d6589d5a0c10257ba948ae2e7b1" + "2.3.0": + url: "https://github.com/lexbor/lexbor/archive/v2.3.0.zip" + sha256: "5ebdaca76715d737ba5ce5cb782c743caabccdf918854c19c1d5a9a3dd5f19e9" + "2.2.0": + url: "https://github.com/lexbor/lexbor/archive/v2.2.0.zip" + sha256: "837d75e253c9dc157e20246984d7357a7288e2bd2a2b53f371ac047fec3b88e9" "2.1.0": url: "https://github.com/lexbor/lexbor/archive/v2.1.0.zip" sha256: "58d684d19cec689e40d8d443b3b953697cfa677a0ca59a2cf1fc14cd37ac2404" diff --git a/recipes/lexbor/all/conanfile.py b/recipes/lexbor/all/conanfile.py index 64b27525d9645..edf0b7a768ab8 100644 --- a/recipes/lexbor/all/conanfile.py +++ b/recipes/lexbor/all/conanfile.py @@ -1,33 +1,31 @@ -from conans import ConanFile, CMake, tools -from conan.tools.microsoft import is_msvc -import functools +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 get, copy, rm +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 LexborConan(ConanFile): name = "lexbor" description = "Lexbor is development of an open source HTML Renderer library" - topics = ("html5", "css", "parser", "renderer") license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/lexbor/lexbor/" + topics = ("html5", "css", "parser", "renderer") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { - "shared": [True, False], + "shared": [True, False], "fPIC": [True, False], "build_separately": [True, False], } default_options = { - "shared": False, + "shared": False, "fPIC": True, "build_separately": False, } - generators = "cmake" - exports_sources = ["CMakeLists.txt", ] - - @property - def _source_subfolder(self): - return "source_subfolder" @property def _is_mingw(self): @@ -39,55 +37,61 @@ 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 validate(self): # static build on Windows will be support by future release. (https://github.com/lexbor/lexbor/issues/69) if str(self.version) == "2.1.0" and self.options.shared == False and (is_msvc(self) or self._is_mingw): - raise tools.ConanInvalidConfiguration("{}/{} doesn't support static build on Windows(please use cci.20220301).".format(self.name, self.version)) + raise ConanInvalidConfiguration(f"{self.ref} doesn't support static build on Windows(please use 2.2.0).") if self.options.build_separately: - raise tools.ConanInvalidConfiguration("{}/{} doesn't support build_separately option(yet).".format(self.name, self.version)) + raise ConanInvalidConfiguration(f"{self.ref} doesn't support build_separately option(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) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - - cmake.definitions["LEXBOR_BUILD_SHARED"] = self.options.shared - cmake.definitions["LEXBOR_BUILD_STATIC"] = not self.options.shared - cmake.definitions["LEXBOR_TESTS_CPP"] = False - # TODO: enable build_separately option - cmake.definitions["LEXBOR_BUILD_SEPARATELY"] = self.options.build_separately - cmake.definitions["LEXBOR_INSTALL_HEADERS"] = True - - cmake.configure() - return cmake + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["LEXBOR_BUILD_SHARED"] = self.options.shared + tc.cache_variables["LEXBOR_BUILD_STATIC"] = not self.options.shared + tc.variables["LEXBOR_TESTS_CPP"] = False + tc.variables["LEXBOR_BUILD_SEPARATELY"] = self.options.build_separately + tc.variables["LEXBOR_INSTALL_HEADERS"] = True + 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) - 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): target = "lexbor" if self.options.shared else "lexbor_static" - self.cpp_info.set_property("cmake_file_name", "lexbor") - self.cpp_info.set_property("cmake_target_name", "lexbor::{}".format(target)) self.cpp_info.names["cmake_find_package"] = "lexbor" self.cpp_info.names["cmake_find_package_multi"] = "lexbor" - self.cpp_info.components["_lexbor"].set_property("cmake_target_name", "lexbor::{}".format(target)) - self.cpp_info.components["_lexbor"].names["cmake_find_package"] = target - self.cpp_info.components["_lexbor"].names["cmake_find_package_multi"] = target + self.cpp_info.components["_lexbor"].set_property("cmake_target_name", f"lexbor::{target}") self.cpp_info.components["_lexbor"].libs = [target] self.cpp_info.components["_lexbor"].defines = ["LEXBOR_BUILD_SHARED" if self.options.shared else "LEXBOR_BUILD_STATIC"] + + if not self.options.shared: + self.cpp_info.components["_lexbor"].defines.append("LEXBOR_STATIC") + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["_lexbor"].system_libs.append("m") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.set_property("cmake_file_name", "lexbor") + self.cpp_info.set_property("cmake_target_name", f"lexbor::{target}") + self.cpp_info.components["_lexbor"].names["cmake_find_package"] = target + self.cpp_info.components["_lexbor"].names["cmake_find_package_multi"] = target diff --git a/recipes/lexbor/all/test_package/CMakeLists.txt b/recipes/lexbor/all/test_package/CMakeLists.txt index 2f7061d3b066d..6ac27dcd72792 100644 --- a/recipes/lexbor/all/test_package/CMakeLists.txt +++ b/recipes/lexbor/all/test_package/CMakeLists.txt @@ -1,15 +1,12 @@ 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(lexbor CONFIG REQUIRED) +find_package(lexbor REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) if(TARGET lexbor::lexbor_static) - target_link_libraries(${PROJECT_NAME} lexbor::lexbor_static) + target_link_libraries(${PROJECT_NAME} PRIVATE lexbor::lexbor_static) else() - target_link_libraries(${PROJECT_NAME} lexbor::lexbor) + target_link_libraries(${PROJECT_NAME} PRIVATE lexbor::lexbor) endif() diff --git a/recipes/lexbor/all/test_package/conanfile.py b/recipes/lexbor/all/test_package/conanfile.py index 54473a706ca69..a9fb96656f203 100644 --- a/recipes/lexbor/all/test_package/conanfile.py +++ b/recipes/lexbor/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 LexborTestConan(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/lexbor/all/test_v1_package/CMakeLists.txt b/recipes/lexbor/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/lexbor/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/lexbor/all/test_v1_package/conanfile.py b/recipes/lexbor/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/lexbor/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/lexbor/config.yml b/recipes/lexbor/config.yml index 110c267dc74e0..35c4f4ddfb50b 100644 --- a/recipes/lexbor/config.yml +++ b/recipes/lexbor/config.yml @@ -1,3 +1,9 @@ versions: + "2.4.0": + folder: "all" + "2.3.0": + folder: "all" + "2.2.0": + folder: "all" "2.1.0": folder: "all" diff --git a/recipes/libaec/all/conandata.yml b/recipes/libaec/all/conandata.yml index f02aae783d14c..02f7c64ddfad5 100644 --- a/recipes/libaec/all/conandata.yml +++ b/recipes/libaec/all/conandata.yml @@ -1,22 +1,7 @@ sources: + "1.1.2": + url: "https://gitlab.dkrz.de/k202009/libaec/-/archive/v1.1.2/libaec-v1.1.2.tar.bz2" + sha256: "bdad8c7923537c3695327aa85afdcd714fb3d30a5f956a27ba2971ef98c043ac" "1.0.6": - url: "https://gitlab.dkrz.de/k202009/libaec/uploads/45b10e42123edd26ab7b3ad92bcf7be2/libaec-1.0.6.tar.gz" - sha256: "032961877231113bb094ef224085e6d66fd670f85a3e17f53d0f131abf24f2fd" - "1.0.4": - url: "https://gitlab.dkrz.de/k202009/libaec/uploads/ea0b7d197a950b0c110da8dfdecbb71f/libaec-1.0.4.tar.gz" - sha256: "f2b1b232083bd8beaf8a54a024225de3dd72a673a9bcdf8c3ba96c39483f4309" -patches: - "1.0.4": - - patch_file: "patches/1.0.4-0001-Fix-static-library-builds.patch" - patch_type: "conan" - patch_description: "Fix static library builds" - - patch_file: "patches/1.0.4-0002-fix-install-ios.patch" - patch_type: "conan" - patch_description: "Fix install iOS" - "1.0.6": - - patch_file: "patches/1.0.6-0001-fix-library-builds.patch" - 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" + url: "https://gitlab.dkrz.de/k202009/libaec/-/archive/v1.0.6/libaec-v1.0.6.tar.bz2" + sha256: "31fb65b31e835e1a0f3b682d64920957b6e4407ee5bbf42ca49549438795a288" diff --git a/recipes/libaec/all/conanfile.py b/recipes/libaec/all/conanfile.py index e624f9f76f9b5..82b06f8697908 100644 --- a/recipes/libaec/all/conanfile.py +++ b/recipes/libaec/all/conanfile.py @@ -1,12 +1,12 @@ 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 +from conan.tools.files import get, copy, rm, rmdir, replace_in_file +from conan.tools.microsoft import is_msvc, check_min_vs +from conan.tools.scm import Version import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class LibaecConan(ConanFile): @@ -16,6 +16,8 @@ class LibaecConan(ConanFile): homepage = "https://gitlab.dkrz.de/k202009/libaec" description = "Adaptive Entropy Coding library" topics = "dsp", "encoding", "decoding" + + package_type = "library" settings = "os", "compiler", "build_type", "arch" options = { "shared": [True, False], @@ -27,7 +29,7 @@ class LibaecConan(ConanFile): } def export_sources(self): - export_conandata_patches(self) + copy(self, "set_runtime_output_dir.cmake", self.recipe_folder, os.path.join(self.export_sources_folder, "src")) def config_options(self): if self.settings.os == "Windows": @@ -35,72 +37,74 @@ def config_options(self): 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 + 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 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 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. - if self.options.shared and self.settings.build_type == "Debug": - raise ConanInvalidConfiguration("{} does not support debug and shared build in Visual Studio(currently)".format(self.name)) + # libaec/1.0.6 uses "restrict" keyword which seems to be supported since Visual Studio 16. + check_min_vs(self, 192) + # libaec/1.0.6 fails to build aec_client command with debug and shared settings in Visual Studio. + # Temporary, this recipe doesn't support these settings. + if is_msvc(self) and self.options.shared and self.settings.build_type == "Debug": + raise ConanInvalidConfiguration(f"{self.name} does not support debug and shared build in Visual Studio (currently)") 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.cache_variables["CMAKE_PROJECT_libaec_INCLUDE"] = "set_runtime_output_dir.cmake" + tc.cache_variables["CMAKE_POSITION_INDEPENDENT_CODE"] = self.options.get_safe("fPIC", True) + tc.cache_variables["BUILD_SHARED_LIBS"] = self.options.shared tc.generate() + def _patch_sources(self): + cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") + replace_in_file(self, cmakelists, "set(CMAKE_C_STANDARD 99)", "set(CMAKE_C_STANDARD 11)") + replace_in_file(self, cmakelists, "set(CMAKE_POSITION_INDEPENDENT_CODE ON)", "") + targets = "aec_shared sz_shared" if self.options.shared else "aec_static sz_static" + aec_client = " aec_client" if Version(self.version) < "1.1" else "" + replace_in_file(self, os.path.join(self.source_folder, "src", "CMakeLists.txt"), + f"install(TARGETS aec_static aec_shared sz_static sz_shared{aec_client})", + f"install(TARGETS {targets}{aec_client} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib RUNTIME DESTINATION bin)") + def build(self): - 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)", "") + self._patch_sources() cmake = CMake(self) cmake.configure() cmake.build() def package(self): - 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: - copy(self, pattern="LICENSE.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, "LICENSE.txt", self.source_folder, os.path.join(self.package_folder, "licenses")) cmake = CMake(self) cmake.install() + copy(self, "*.h", os.path.join(self.source_folder, "include"), os.path.join(self.package_folder, "include")) + copy(self, "libaec.h", os.path.join(self.build_folder, "include"), os.path.join(self.package_folder, "include")) 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): + self.cpp_info.set_property("cmake_file_name", "libaec") + + # CMake targets are based on + # https://gitlab.dkrz.de/k202009/libaec/-/blob/master/cmake/libaec-config.cmake.in + self.cpp_info.components["aec"].set_property("cmake_target_name", "libaec::aec") aec_name = "aec" - if self.settings.os == "Windows" and Version(self.version) >= "1.0.6" and not self.options.shared: - aec_name = "aec_static" + if self.settings.os == "Windows" and not self.options.shared: + aec_name = "aec-static" + self.cpp_info.components["aec"].libs = [aec_name] + + self.cpp_info.components["sz"].set_property("cmake_target_name", "libaec::sz") szip_name = "sz" if self.settings.os == "Windows": - 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 = [szip_name, aec_name] + szip_name = "szip" if self.options.shared else "szip-static" + self.cpp_info.components["sz"].libs = [szip_name] + + # TODO: Legacy, to be removed on Conan 2.0 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.4-0001-Fix-static-library-builds.patch b/recipes/libaec/all/patches/1.0.4-0001-Fix-static-library-builds.patch deleted file mode 100644 index ba756f64d8e76..0000000000000 --- a/recipes/libaec/all/patches/1.0.4-0001-Fix-static-library-builds.patch +++ /dev/null @@ -1,135 +0,0 @@ -From 6df13969e6967dbed660271011e872c9c366037a Mon Sep 17 00:00:00 2001 -From: Brennan Ashton -Date: Tue, 28 Jan 2020 03:59:02 -0800 -Subject: [PATCH] Fix static library builds - -Signed-off-by: Brennan Ashton ---- - CMakeLists.txt | 3 --- - src/CMakeLists.txt | 10 +++++++++- - src/libaec.h | 28 ++++++++++------------------ - src/szlib.h | 6 +++--- - 4 files changed, 22 insertions(+), 25 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index d71d26c..4f38618 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -43,9 +43,6 @@ option(BUILD_SHARED_LIBS "Build Shared Libraries" ON) - if(BUILD_SHARED_LIBS) - set (LIB_TYPE SHARED) - else(BUILD_SHARED_LIBS) -- if(WIN32) -- message(WARNING "You will have to modify libaec.h for static libs.") -- endif(WIN32) - set(LIB_TYPE STATIC) - endif(BUILD_SHARED_LIBS) - -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index ed6053e..93a78f2 100644 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -1,5 +1,13 @@ -+include (GenerateExportHeader) - add_library(aec ${LIB_TYPE} ${libaec_SRCS}) - set_target_properties(aec PROPERTIES VERSION 0.0.10 SOVERSION 0) -+generate_export_header(aec -+ BASE_NAME libaec -+ EXPORT_MACRO_NAME libaec_EXPORT -+ EXPORT_FILE_NAME ${PROJECT_BINARY_DIR}/libaec_Export.h -+ STATIC_DEFINE libaec_BUILT_AS_STATIC -+) -+ - add_library(sz ${LIB_TYPE} sz_compat.c) - set_target_properties(sz PROPERTIES VERSION 2.0.1 SOVERSION 2) - -@@ -41,7 +49,7 @@ else(WIN32) - DESTINATION ${CMAKE_INSTALL_FULL_MANDIR}/man1 COMPONENT doc) - endif(WIN32) - --install(FILES libaec.h szlib.h -+install(FILES libaec.h szlib.h ${PROJECT_BINARY_DIR}/libaec_Export.h - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} - COMPONENT headers) - install(TARGETS aec_client -diff --git a/src/libaec.h b/src/libaec.h -index bb43be9..44505e4 100644 ---- a/src/libaec.h -+++ b/src/libaec.h -@@ -52,20 +52,12 @@ - - #include - -+#include "libaec_Export.h" -+ - #ifdef __cplusplus - extern "C"{ - #endif - --#if BUILDING_LIBAEC && HAVE_VISIBILITY --# define LIBAEC_DLL_EXPORTED __attribute__((__visibility__("default"))) --#elif BUILDING_LIBAEC && defined _MSC_VER --# define LIBAEC_DLL_EXPORTED __declspec(dllexport) --#elif defined _MSC_VER --# define LIBAEC_DLL_EXPORTED __declspec(dllimport) --#else --# define LIBAEC_DLL_EXPORTED --#endif -- - struct internal_state; - - struct aec_stream { -@@ -155,19 +147,19 @@ struct aec_stream { - /*********************************************/ - /* Streaming encoding and decoding functions */ - /*********************************************/ --LIBAEC_DLL_EXPORTED int aec_encode_init(struct aec_stream *strm); --LIBAEC_DLL_EXPORTED int aec_encode(struct aec_stream *strm, int flush); --LIBAEC_DLL_EXPORTED int aec_encode_end(struct aec_stream *strm); -+libaec_EXPORT int aec_encode_init(struct aec_stream *strm); -+libaec_EXPORT int aec_encode(struct aec_stream *strm, int flush); -+libaec_EXPORT int aec_encode_end(struct aec_stream *strm); - --LIBAEC_DLL_EXPORTED int aec_decode_init(struct aec_stream *strm); --LIBAEC_DLL_EXPORTED int aec_decode(struct aec_stream *strm, int flush); --LIBAEC_DLL_EXPORTED int aec_decode_end(struct aec_stream *strm); -+libaec_EXPORT int aec_decode_init(struct aec_stream *strm); -+libaec_EXPORT int aec_decode(struct aec_stream *strm, int flush); -+libaec_EXPORT int aec_decode_end(struct aec_stream *strm); - - /***************************************************************/ - /* Utility functions for encoding or decoding a memory buffer. */ - /***************************************************************/ --LIBAEC_DLL_EXPORTED int aec_buffer_encode(struct aec_stream *strm); --LIBAEC_DLL_EXPORTED int aec_buffer_decode(struct aec_stream *strm); -+libaec_EXPORT int aec_buffer_encode(struct aec_stream *strm); -+libaec_EXPORT int aec_buffer_decode(struct aec_stream *strm); - - #ifdef __cplusplus - } -diff --git a/src/szlib.h b/src/szlib.h -index 1eaa577..18b6a3c 100644 ---- a/src/szlib.h -+++ b/src/szlib.h -@@ -80,15 +80,15 @@ typedef struct SZ_com_t_s - int pixels_per_scanline; - } SZ_com_t; - --LIBAEC_DLL_EXPORTED int SZ_BufftoBuffCompress( -+libaec_EXPORT int SZ_BufftoBuffCompress( - void *dest, size_t *destLen, - const void *source, size_t sourceLen, - SZ_com_t *param); --LIBAEC_DLL_EXPORTED int SZ_BufftoBuffDecompress( -+libaec_EXPORT int SZ_BufftoBuffDecompress( - void *dest, size_t *destLen, - const void *source, size_t sourceLen, - SZ_com_t *param); - --LIBAEC_DLL_EXPORTED int SZ_encoder_enabled(void); -+libaec_EXPORT int SZ_encoder_enabled(void); - - #endif /* SZLIB_H */ --- -2.24.1 - diff --git a/recipes/libaec/all/patches/1.0.4-0002-fix-install-ios.patch b/recipes/libaec/all/patches/1.0.4-0002-fix-install-ios.patch deleted file mode 100644 index 7d7d56d1f60b6..0000000000000 --- a/recipes/libaec/all/patches/1.0.4-0002-fix-install-ios.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -53,7 +53,6 @@ install(FILES libaec.h szlib.h ${PROJECT_BINARY_DIR}/libaec_Export.h - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} - COMPONENT headers) - install(TARGETS aec_client -- RUNTIME - DESTINATION ${CMAKE_INSTALL_BINDIR} - COMPONENT applications) - diff --git a/recipes/libaec/all/patches/1.0.6-0001-fix-library-builds.patch b/recipes/libaec/all/patches/1.0.6-0001-fix-library-builds.patch deleted file mode 100644 index 500c20a889d8c..0000000000000 --- a/recipes/libaec/all/patches/1.0.6-0001-fix-library-builds.patch +++ /dev/null @@ -1,113 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 6f75ead..c974cce 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -4,7 +4,7 @@ project(libaec LANGUAGES C VERSION 1.0.6) - # Automatically export symbols for Windows DLLs - set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) - --set(CMAKE_C_STANDARD 99) -+set(CMAKE_C_STANDARD 11) - set(CMAKE_C_VISIBILITY_PRESET hidden) - set(CMAKE_POSITION_INDEPENDENT_CODE ON) - include(CTest) -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index a26f9b7..3cd8f72 100644 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -10,12 +10,17 @@ target_include_directories(aec - "$" - "$") - --# Create both static and shared aec library. -+if (NOT BUILD_SHARED_LIBS) -+ -+# Create aec library. - add_library(aec_static STATIC "$") - target_link_libraries(aec_static PUBLIC aec) - set_target_properties(aec_static - PROPERTIES -- OUTPUT_NAME $,aec_static,aec>) -+ OUTPUT_NAME $,aec_static,aec> -+ PUBLIC_HEADER ../include/libaec.h) -+ -+else() - - add_library(aec_shared SHARED "$") - target_link_libraries(aec_shared PUBLIC aec) -@@ -26,17 +31,24 @@ set_target_properties(aec_shared - OUTPUT_NAME aec - PUBLIC_HEADER ../include/libaec.h) - -+endif() -+ - # Wrapper for compatibility with szip - add_library(sz OBJECT sz_compat.c) - target_link_libraries(sz PUBLIC aec) - --# Create both static and shared szip library. -+# Create szip library. -+if (NOT BUILD_SHARED_LIBS) -+ - add_library(sz_static STATIC "$" "$") - set_target_properties(sz_static - PROPERTIES -- OUTPUT_NAME $,szip_static,sz>) -+ OUTPUT_NAME $,szip_static,sz> -+ PUBLIC_HEADER ../include/szlib.h) - target_link_libraries(sz_static PUBLIC sz) - -+else() -+ - add_library(sz_shared SHARED "$" "$") - target_link_libraries(sz_shared PUBLIC sz) - set_target_properties(sz_shared -@@ -46,11 +58,16 @@ set_target_properties(sz_shared - OUTPUT_NAME $,szip,sz> - PUBLIC_HEADER ../include/szlib.h) - -+endif() -+ - # Simple client for testing and benchmarking. - # Can also be used stand-alone - add_executable(aec_client aec.c) - set_target_properties(aec_client PROPERTIES OUTPUT_NAME aec) - target_link_libraries(aec_client PUBLIC aec) -+if (MSVC) -+ target_compile_options(aec_client PUBLIC /FS /Z7) -+endif() - - include(GNUInstallDirs) - if(UNIX) -@@ -61,23 +78,14 @@ if(UNIX) - PROPERTIES - COMPILE_DEFINITIONS - "HAVE_VISIBILITY=$;BUILDING_LIBAEC") -- -- # The shell scripts for benchmarking are supported on unix only -- add_executable(utime EXCLUDE_FROM_ALL utime.c) -- target_include_directories(utime PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/..") -- add_custom_target(bench -- COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/benc.sh -- ${CMAKE_CURRENT_SOURCE_DIR}/../data/typical.rz -- COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/bdec.sh -- DEPENDS aec_client utime) - endif() - --if(UNIX OR MINGW) -- # Install manpage -- install( -- FILES aec.1 -- DESTINATION ${CMAKE_INSTALL_FULL_MANDIR}/man1 -- COMPONENT doc) --endif() -+if (NOT BUILD_SHARED_LIBS) - --install(TARGETS aec_static aec_shared sz_static sz_shared aec_client) -+install(TARGETS aec_static sz_static aec_client) -+ -+else() -+ -+install(TARGETS aec_shared sz_shared aec_client) -+ -+endif() 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 deleted file mode 100644 index b3782f6654ad3..0000000000000 --- a/recipes/libaec/all/patches/1.0.6-0002-fix-cmake-build-with-ninja.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- 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/set_runtime_output_dir.cmake b/recipes/libaec/all/set_runtime_output_dir.cmake new file mode 100644 index 0000000000000..d154a1133b327 --- /dev/null +++ b/recipes/libaec/all/set_runtime_output_dir.cmake @@ -0,0 +1,2 @@ +# Ninja needs 'aec' binary to be put in a separate folder to an imaginary 'aec' object output +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin) diff --git a/recipes/libaec/all/test_package/CMakeLists.txt b/recipes/libaec/all/test_package/CMakeLists.txt index f87e0b5ca8eb9..957285057e22b 100644 --- a/recipes/libaec/all/test_package/CMakeLists.txt +++ b/recipes/libaec/all/test_package/CMakeLists.txt @@ -1,7 +1,8 @@ -cmake_minimum_required(VERSION 3.1.3) +cmake_minimum_required(VERSION 3.15) project(test_package C) find_package(libaec CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} libaec::libaec) +target_link_libraries(${PROJECT_NAME} libaec::aec) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_11) diff --git a/recipes/libaec/all/test_package/conanfile.py b/recipes/libaec/all/test_package/conanfile.py index 75526b1d02b79..0c7c612cdc73e 100644 --- a/recipes/libaec/all/test_package/conanfile.py +++ b/recipes/libaec/all/test_package/conanfile.py @@ -1,8 +1,8 @@ +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.scm import Version -import os +from conan.tools.cmake import CMake, cmake_layout class TestPackageConan(ConanFile): @@ -16,12 +16,6 @@ def requirements(self): 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) cmake.configure() @@ -29,5 +23,5 @@ def build(self): def test(self): if can_run(self): - bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + bin_path = os.path.join(self.cpp.build.bindir, "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/libaec/config.yml b/recipes/libaec/config.yml index a41a7cbb0ffc2..e52184bafc974 100644 --- a/recipes/libaec/config.yml +++ b/recipes/libaec/config.yml @@ -1,5 +1,5 @@ versions: - "1.0.6": + "1.1.2": folder: all - "1.0.4": + "1.0.6": folder: all diff --git a/recipes/libaesgm/all/CMakeLists.txt b/recipes/libaesgm/all/CMakeLists.txt new file mode 100644 index 0000000000000..423d807676428 --- /dev/null +++ b/recipes/libaesgm/all/CMakeLists.txt @@ -0,0 +1,48 @@ +cmake_minimum_required(VERSION 3.8) +project(LibAesgm LANGUAGES C) + +add_library(Aesgm + #sources + ${LIBAESGM_SRC_DIR}/aescrypt.c + ${LIBAESGM_SRC_DIR}/aeskey.c + ${LIBAESGM_SRC_DIR}/aes_modes.c + ${LIBAESGM_SRC_DIR}/aes_ni.c + ${LIBAESGM_SRC_DIR}/aestab.c + #headers + ${LIBAESGM_SRC_DIR}/aescpp.h + ${LIBAESGM_SRC_DIR}/aes.h + ${LIBAESGM_SRC_DIR}/aes_ni.h + ${LIBAESGM_SRC_DIR}/aesopt.h + ${LIBAESGM_SRC_DIR}/aestab.h + ${LIBAESGM_SRC_DIR}/aes_via_ace.h + ${LIBAESGM_SRC_DIR}/brg_endian.h + ${LIBAESGM_SRC_DIR}/brg_types.h +) + +target_include_directories(Aesgm + INTERFACE + $ + $ +) + +if(WIN32 AND BUILD_SHARED_LIBS) + target_compile_definitions(Aesgm PRIVATE DLL_EXPORT) +endif() + +install(TARGETS Aesgm + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} +) +install( + FILES + ${LIBAESGM_SRC_DIR}/aes.h + ${LIBAESGM_SRC_DIR}/aes_ni.h + ${LIBAESGM_SRC_DIR}/aes_via_ace.h + ${LIBAESGM_SRC_DIR}/aescpp.h + ${LIBAESGM_SRC_DIR}/aesopt.h + ${LIBAESGM_SRC_DIR}/aestab.h + ${LIBAESGM_SRC_DIR}/brg_endian.h + ${LIBAESGM_SRC_DIR}/brg_types.h + DESTINATION include +) diff --git a/recipes/libaesgm/all/conandata.yml b/recipes/libaesgm/all/conandata.yml new file mode 100644 index 0000000000000..5a2d1592cd373 --- /dev/null +++ b/recipes/libaesgm/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "2013.1.1": + url: "https://github.com/xmake-mirror/libaesgm/archive/refs/tags/2013.1.1.tar.gz" + sha256: "102353a486126c91ccab791c3e718d056d8fbb1be488da81b26561bc7ef4f363" diff --git a/recipes/libaesgm/all/conanfile.py b/recipes/libaesgm/all/conanfile.py new file mode 100644 index 0000000000000..17f6f991a5f99 --- /dev/null +++ b/recipes/libaesgm/all/conanfile.py @@ -0,0 +1,72 @@ +from conan import ConanFile +from conan.tools.files import get, copy, load, save +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +import os + + +required_conan_version = ">=1.53.0" + +class LibaesgmConan(ConanFile): + name = "libaesgm" + description = "Library implementation of AES (Rijndael) cryptographic methods" + license = "LicenseRef-libaesgm-BSD" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/xmake-mirror/libaesgm" + topics = ("aes", "cryptographic") + 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): + 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") + 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) + tc.variables["LIBAESGM_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): + filename = os.path.join(self.source_folder, "aes.h") + file_content = load(self, filename) + license_end = "*/" + license_contents = file_content[:file_content.find(license_end)].replace("/*", "") + save(self, os.path.join(self.package_folder, "licenses", "LICENSE"), license_contents) + + cmake = CMake(self) + cmake.install() + + def package_info(self): + self.cpp_info.libs = ["Aesgm"] + + self.cpp_info.set_property("cmake_file_name", "Aesgm") + self.cpp_info.set_property("cmake_target_name", "Aesgm::Aesgm") diff --git a/recipes/libaesgm/all/test_package/CMakeLists.txt b/recipes/libaesgm/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..ed4bf02743021 --- /dev/null +++ b/recipes/libaesgm/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package C) + +find_package(Aesgm REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE Aesgm::Aesgm) diff --git a/recipes/libaesgm/all/test_package/conanfile.py b/recipes/libaesgm/all/test_package/conanfile.py new file mode 100644 index 0000000000000..f5cf204295e19 --- /dev/null +++ b/recipes/libaesgm/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libaesgm/all/test_package/test_package.c b/recipes/libaesgm/all/test_package/test_package.c new file mode 100644 index 0000000000000..af96572482927 --- /dev/null +++ b/recipes/libaesgm/all/test_package/test_package.c @@ -0,0 +1,10 @@ +#include + +int main() { + aes_encrypt_ctx ctx; + char message[] = "test"; + char key[] = "0123456789ABCDEF"; + aes_encrypt(message, key, &ctx); + + return 0; +} diff --git a/recipes/libaesgm/config.yml b/recipes/libaesgm/config.yml new file mode 100644 index 0000000000000..97cadcf3a3227 --- /dev/null +++ b/recipes/libaesgm/config.yml @@ -0,0 +1,3 @@ +versions: + "2013.1.1": + folder: all diff --git a/recipes/libalsa/all/conandata.yml b/recipes/libalsa/all/conandata.yml index 55a14a6d4051e..aa2c61fa39407 100644 --- a/recipes/libalsa/all/conandata.yml +++ b/recipes/libalsa/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "1.2.13": + url: "https://github.com/alsa-project/alsa-lib/archive/v1.2.13.tar.gz" + sha256: "e296a2e8fa165855e2c8f263ff6bc0b0ea21a3bece4404135f3a181d1a03e63a" + "1.2.12": + url: "https://github.com/alsa-project/alsa-lib/archive/v1.2.12.tar.gz" + sha256: "f067dbba9376e5bbbb417b77751d2a9f2f277c54fb3a2b5c023cc2c7dfb4e3c1" + "1.2.10": + url: "https://github.com/alsa-project/alsa-lib/archive/v1.2.10.tar.gz" + sha256: "f55749847fd98274501f4691a2d847e89280c07d40a43cdac43d6443f69fc939" "1.2.7.2": url: "https://github.com/alsa-project/alsa-lib/archive/v1.2.7.2.tar.gz" sha256: "2ed6d908120beb4a91c2271b01489181b28dc9f35f32229ef83bcd5ac8817654" diff --git a/recipes/libalsa/all/conanfile.py b/recipes/libalsa/all/conanfile.py index d8a78fbfec4c2..eff1547ac38a9 100644 --- a/recipes/libalsa/all/conanfile.py +++ b/recipes/libalsa/all/conanfile.py @@ -12,12 +12,13 @@ class LibalsaConan(ConanFile): name = "libalsa" + description = "Library of ALSA: The Advanced Linux Sound Architecture, that provides audio " \ + "and MIDI functionality to the Linux operating system" license = "LGPL-2.1-or-later" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/alsa-project/alsa-lib" 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], @@ -43,15 +44,14 @@ def layout(self): basic_layout(self, src_folder="src") def validate(self): - if self.info.settings.os != "Linux": + if self.settings.os != "Linux": raise ConanInvalidConfiguration(f"{self.ref} only supports Linux") def build_requirements(self): self.tool_requires("libtool/2.4.7") 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) 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/config.yml b/recipes/libalsa/config.yml index b1fdda2825fa6..11dc7bc660309 100644 --- a/recipes/libalsa/config.yml +++ b/recipes/libalsa/config.yml @@ -1,4 +1,10 @@ versions: + "1.2.13": + folder: all + "1.2.12": + folder: all + "1.2.10": + folder: all "1.2.7.2": folder: all "1.2.7": diff --git a/recipes/libaom-av1/all/conandata.yml b/recipes/libaom-av1/all/conandata.yml index 8a6a9a41576b7..a094fca193ea9 100644 --- a/recipes/libaom-av1/all/conandata.yml +++ b/recipes/libaom-av1/all/conandata.yml @@ -1,41 +1,34 @@ sources: + "3.8.0": + url: "https://storage.googleapis.com/aom-releases/libaom-3.8.0.tar.gz" + sha256: "a768d3e54c7f00cd38b01208d1ae52d671be410cfc387ff7881ea71c855f3600" + "3.6.1": + url: "https://storage.googleapis.com/aom-releases/libaom-3.6.1.tar.gz" + sha256: "42b862f58b3d00bd3902d2dc469526574f5b012e5b178e6a9652845a113d6887" "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" - "3.3.0": - url: "https://storage.googleapis.com/aom-releases/libaom-3.3.0.tar.gz" - sha256: "1dafde32bc2237bf0570294661ae61db30e818840f77dc4e90d1ebf5a6286664" - "3.1.2": - url: "https://storage.googleapis.com/aom-releases/libaom-3.1.2.tar.gz" - sha256: "a295eb3779657fad7d34217091ee4c6257d02580a82012231afef72792330075" - "3.1.1": - url: "https://storage.googleapis.com/aom-releases/libaom-3.1.1.tar.gz" - sha256: "7cd5e8e469268c37241df93fe61557ea0dc46980ca21b37e786e92a3d0729276" "2.0.1": 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" + "3.8.0": + - patch_file: "patches/0001-3.8.0-fix-install.patch" patch_type: conan patch_description: Install just aom library without aom_static. - "3.4.0": + "3.6.1": - 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" + "3.5.0": + - patch_file: "patches/0001-3.4.0-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" + "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. "2.0.1": diff --git a/recipes/libaom-av1/all/conanfile.py b/recipes/libaom-av1/all/conanfile.py index e7216a0f083aa..26d670c71d8c3 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,30 +44,25 @@ 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): self.tool_requires("nasm/2.15.05") if self._settings_build.os == "Windows": - self.tool_requires("strawberryperl/5.30.0.1") + self.tool_requires("strawberryperl/5.32.1.1") 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) @@ -101,6 +94,9 @@ def package(self): def package_info(self): self.cpp_info.set_property("pkg_config_name", "aom") - self.cpp_info.libs = ["aom"] + lib = "aom" + if Version(self.version) >= "3.8.0" and self.settings.os == "Windows" and self.options.shared: + lib = "aom_dll" + self.cpp_info.libs = [lib] if self.settings.os in ("FreeBSD", "Linux"): self.cpp_info.system_libs = ["pthread", "m"] diff --git a/recipes/libaom-av1/all/patches/0001-3.1.1-fix-install.patch b/recipes/libaom-av1/all/patches/0001-3.1.1-fix-install.patch deleted file mode 100644 index af10132d05fe7..0000000000000 --- a/recipes/libaom-av1/all/patches/0001-3.1.1-fix-install.patch +++ /dev/null @@ -1,34 +0,0 @@ ---- a/build/cmake/aom_install.cmake -+++ b/build/cmake/aom_install.cmake -@@ -26,7 +26,7 @@ endif() - # Note: aom.pc generation uses GNUInstallDirs: - # https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html - macro(setup_aom_install_targets) -- if(NOT (MSVC OR XCODE)) -+ if(1) - include("GNUInstallDirs") - set(AOM_PKG_CONFIG_FILE "${AOM_CONFIG_DIR}/aom.pc") - -@@ -76,7 +76,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() -@@ -88,8 +89,10 @@ macro(setup_aom_install_targets) - install( - FILES "${AOM_PKG_CONFIG_FILE}" - DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/pkgconfig") -- install(TARGETS ${AOM_INSTALL_LIBS} DESTINATION -- "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") -+ install(TARGETS ${AOM_INSTALL_LIBS} -+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} -+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} -+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) - - if(ENABLE_EXAMPLES) - install(TARGETS ${AOM_INSTALL_BINS} DESTINATION diff --git a/recipes/libaom-av1/all/patches/0001-3.3.0-fix-install.patch b/recipes/libaom-av1/all/patches/0001-3.3.0-fix-install.patch deleted file mode 100644 index 0dc76d16fc7f5..0000000000000 --- a/recipes/libaom-av1/all/patches/0001-3.3.0-fix-install.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- 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") - -@@ -77,7 +77,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/patches/0001-3.5.0-fix-install.patch b/recipes/libaom-av1/all/patches/0001-3.5.0-fix-install.patch deleted file mode 100644 index cdf8395c587c8..0000000000000 --- a/recipes/libaom-av1/all/patches/0001-3.5.0-fix-install.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- 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/patches/0001-3.8.0-fix-install.patch b/recipes/libaom-av1/all/patches/0001-3.8.0-fix-install.patch new file mode 100644 index 0000000000000..1bb2cbdc3adb3 --- /dev/null +++ b/recipes/libaom-av1/all/patches/0001-3.8.0-fix-install.patch @@ -0,0 +1,21 @@ +--- build/cmake/aom_install.cmake ++++ build/cmake/aom_install.cmake +@@ -27,7 +27,7 @@ + # 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") + +@@ -79,7 +79,8 @@ + 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 63fbe232d5922..45dfabb3e4ed1 100644 --- a/recipes/libaom-av1/config.yml +++ b/recipes/libaom-av1/config.yml @@ -1,13 +1,11 @@ versions: - "3.5.0": - folder: all - "3.4.0": + "3.8.0": folder: all - "3.3.0": + "3.6.1": folder: all - "3.1.2": + "3.5.0": folder: all - "3.1.1": + "3.4.0": folder: all "2.0.1": folder: all diff --git a/recipes/libarchive/all/conandata.yml b/recipes/libarchive/all/conandata.yml index dd56f7af959bf..67adbd7936a29 100644 --- a/recipes/libarchive/all/conandata.yml +++ b/recipes/libarchive/all/conandata.yml @@ -1,71 +1,54 @@ sources: - "3.6.1": - url: "https://github.com/libarchive/libarchive/releases/download/v3.6.1/libarchive-3.6.1.tar.xz" - sha256: "5a411aceb978f43e626f0c2d1812ddd8807b645ed892453acabd532376c148e6" - "3.6.0": - url: "https://github.com/libarchive/libarchive/releases/download/v3.6.0/libarchive-3.6.0.tar.xz" - sha256: "df283917799cb88659a5b33c0a598f04352d61936abcd8a48fe7b64e74950de7" - "3.5.2": - url: "https://github.com/libarchive/libarchive/releases/download/v3.5.2/libarchive-3.5.2.tar.xz" - sha256: "f0b19ff39c3c9a5898a219497ababbadab99d8178acc980155c7e1271089b5a0" - "3.5.1": - url: "https://github.com/libarchive/libarchive/releases/download/v3.5.1/libarchive-3.5.1.tar.xz" - sha256: "0e17d3a8d0b206018693b27f08029b598f6ef03600c2b5d10c94ce58692e299b" - "3.4.3": - url: "https://github.com/libarchive/libarchive/releases/download/v3.4.3/libarchive-3.4.3.tar.xz" - sha256: "0bfc3fd40491768a88af8d9b86bf04a9e95b6d41a94f9292dbc0ec342288c05f" - "3.4.0": - url: "https://github.com/libarchive/libarchive/releases/download/v3.4.0/libarchive-3.4.0.tar.gz" - sha256: "8643d50ed40c759f5412a3af4e353cffbce4fdf3b5cf321cb72cacf06b2d825e" + "3.7.6": + url: "https://github.com/libarchive/libarchive/releases/download/v3.7.6/libarchive-3.7.6.tar.xz" + sha256: "0a2efdcb185da2eb1e7cd8421434cb9a6119f72417a13335cca378d476fd3ba0" + "3.7.4": + url: "https://github.com/libarchive/libarchive/releases/download/v3.7.4/libarchive-3.7.4.tar.xz" + sha256: "f887755c434a736a609cbd28d87ddbfbe9d6a3bb5b703c22c02f6af80a802735" + "3.7.3": + url: "https://github.com/libarchive/libarchive/releases/download/v3.7.3/libarchive-3.7.3.tar.xz" + sha256: "63e7a7174638fc7d6b79b4c8b0ad954e0f4f45abe7239c1ecb200232aa9a43d2" + "3.7.2": + url: "https://github.com/libarchive/libarchive/releases/download/v3.7.2/libarchive-3.7.2.tar.xz" + sha256: "04357661e6717b6941682cde02ad741ae4819c67a260593dfb2431861b251acb" patches: - "3.6.1": - - 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" + "3.7.6": + - patch_file: "patches/0003-3.7.6-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/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_file: "patches/0005-3.7.6-try-compile-cmakedeps.patch" + patch_description: "Patch try_compile check to work with imported CMake targets from Conan packages" 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_file: "patches/0006-3.7.6-fix-msvc-build.patch" + patch_description: "Fix MSVC build" 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" + "3.7.4": + - patch_file: "patches/0003-3.7.4-cmake.patch" + patch_description: "Make CMake build-system compatible with Conan" + patch_type: "conan" + - patch_file: "patches/0005-3.7.4-try-compile-cmakedeps.patch" + patch_description: "Patch try_compile check to work with imported CMake targets from Conan packages" + patch_type: "conan" + - patch_file: "patches/0006-3.7.4-fix-msvc-build.patch" + patch_description: "Fix MSVC build" + patch_type: "conan" + "3.7.3": + - patch_file: "patches/0003-3.7.3-cmake.patch" + patch_description: "Make CMake build-system compatible with Conan" + patch_type: "conan" + - patch_file: "patches/0005-3.7.3-try-compile-cmakedeps.patch" + patch_description: "Patch try_compile check to work with imported CMake targets from Conan packages" + patch_type: "conan" + - patch_file: "patches/0006-3.7.3-fix-msvc-build.patch" + patch_description: "Fix MSVC build" + patch_type: "conan" + "3.7.2": + - patch_file: "patches/0003-3.7.2-cmake.patch" + patch_description: "Make CMake build-system compatible 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_file: "patches/0005-3.7.2-try-compile-cmakedeps.patch" + patch_description: "Patch try_compile check to work with imported CMake targets from Conan packages" patch_type: "conan" - "3.4.0": - - 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_file: "patches/0006-3.7.2-fix-msvc-build.patch" + patch_description: "Fix MSVC build" patch_type: "conan" diff --git a/recipes/libarchive/all/conanfile.py b/recipes/libarchive/all/conanfile.py index c388b063a3a02..ba7095f6abb17 100644 --- a/recipes/libarchive/all/conanfile.py +++ b/recipes/libarchive/all/conanfile.py @@ -12,10 +12,11 @@ class LibarchiveConan(ConanFile): name = "libarchive" description = "Multi-format archive and compression library" - topics = "archive", "compression", "tar", "data-compressor", "file-compression" + license = "BSD-2-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://libarchive.org" - license = "BSD-2-Clause" + topics = ("archive", "compression", "tar", "data-compressor", "file-compression") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -37,6 +38,7 @@ class LibarchiveConan(ConanFile): "with_zstd": [True, False], "with_mbedtls": [True, False], "with_xattr": [True, False], + "with_pcre2": [True, False], } default_options = { "shared": False, @@ -58,6 +60,7 @@ class LibarchiveConan(ConanFile): "with_zstd": False, "with_mbedtls": False, "with_xattr": False, + "with_pcre2": False, } def export_sources(self): @@ -66,8 +69,8 @@ def export_sources(self): def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - if Version(self.version) < "3.4.2": - del self.options.with_mbedtls + if Version(self.version) < "3.7.3": + del self.options.with_pcre2 def configure(self): if self.options.shared: @@ -75,23 +78,26 @@ def configure(self): 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.13") + self.requires("zlib/[>=1.2.11 <2]") if self.options.with_bzip2: self.requires("bzip2/1.0.8") if self.options.with_libxml2: - self.requires("libxml2/2.10.3") + self.requires("libxml2/[>=2.12.5 <3]") if self.options.with_expat: - self.requires("expat/2.5.0") + self.requires("expat/[>=2.6.2 <3]") 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.8.1") + self.requires("nettle/3.9.1") if self.options.with_openssl: - self.requires("openssl/1.1.1q") + self.requires("openssl/[>=1.1 <4]") if self.options.with_libb2: self.requires("libb2/20190723") if self.options.with_lz4: @@ -99,25 +105,23 @@ def requirements(self): 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.5 <6]") if self.options.with_zstd: - self.requires("zstd/1.5.2") + self.requires("zstd/[>=1.5 <1.6]") if self.options.get_safe("with_mbedtls"): - self.requires("mbedtls/3.2.1") + self.requires("mbedtls/3.6.1") + if self.options.get_safe("with_pcre2"): + self.requires("pcre2/10.43") def validate(self): - if self.info.settings.os != "Windows" and self.info.options.with_cng: + if self.settings.os != "Windows" and self.options.with_cng: # TODO: add cng when available in CCI raise ConanInvalidConfiguration("cng recipe not yet available in CCI.") - if self.info.options.with_expat and self.info.options.with_libxml2: + if self.options.with_expat and self.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): - 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): cmake_deps = CMakeDeps(self) @@ -149,11 +153,16 @@ def generate(self): tc.variables["ENABLE_CPIO"] = False tc.variables["ENABLE_CAT"] = False tc.variables["ENABLE_TEST"] = False + tc.variables["ENABLE_UNZIP"] = False # too strict check tc.variables["ENABLE_WERROR"] = False - if Version(self.version) >= "3.4.2": - tc.variables["ENABLE_MBEDTLS"] = self.options.with_mbedtls + tc.variables["ENABLE_MBEDTLS"] = self.options.with_mbedtls + if Version(self.version) >= "3.7.3": + tc.variables["ENABLE_PCRE2POSIX"] = self.options.with_pcre2 tc.variables["ENABLE_XATTR"] = self.options.with_xattr + # 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) tc.generate() def build(self): 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 deleted file mode 100644 index 5acce6e86c2cd..0000000000000 --- a/recipes/libarchive/all/patches/0001-3.4.0-zlib-winapi.patch +++ /dev/null @@ -1,20 +0,0 @@ -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 deleted file mode 100644 index b0d70de9dec3b..0000000000000 --- a/recipes/libarchive/all/patches/0001-3.4.3-zlib-winapi.patch +++ /dev/null @@ -1,20 +0,0 @@ -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 deleted file mode 100644 index dceed2848f701..0000000000000 --- a/recipes/libarchive/all/patches/0001-3.6.0-zlib-winapi.patch +++ /dev/null @@ -1,20 +0,0 @@ -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/0002-3.4.0-msvc-no-we4061.patch b/recipes/libarchive/all/patches/0002-3.4.0-msvc-no-we4061.patch deleted file mode 100644 index ff6f218ef3e36..0000000000000 --- a/recipes/libarchive/all/patches/0002-3.4.0-msvc-no-we4061.patch +++ /dev/null @@ -1,12 +0,0 @@ -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 deleted file mode 100644 index 7b724f1fba164..0000000000000 --- a/recipes/libarchive/all/patches/0003-3.4.0-cmake.patch +++ /dev/null @@ -1,101 +0,0 @@ -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 deleted file mode 100644 index 5c46b58290b77..0000000000000 --- a/recipes/libarchive/all/patches/0003-3.4.3-cmake.patch +++ /dev/null @@ -1,101 +0,0 @@ -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 deleted file mode 100644 index 5584b5f1606bc..0000000000000 --- a/recipes/libarchive/all/patches/0003-3.5.2-cmake.patch +++ /dev/null @@ -1,101 +0,0 @@ -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 deleted file mode 100644 index 436c8194e3e4d..0000000000000 --- a/recipes/libarchive/all/patches/0003-3.6.0-cmake.patch +++ /dev/null @@ -1,112 +0,0 @@ -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.7.2-cmake.patch b/recipes/libarchive/all/patches/0003-3.7.2-cmake.patch new file mode 100644 index 0000000000000..ffd8ff242c656 --- /dev/null +++ b/recipes/libarchive/all/patches/0003-3.7.2-cmake.patch @@ -0,0 +1,83 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 6849ce40..8d5b6018 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() + +@@ -511,7 +511,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}) +@@ -532,7 +532,7 @@ ELSE(LIBLZMA_FOUND) + # LZMA not found and will not be used. + SET(HAVE_LZMA_STREAM_ENCODER_MT 0) + ENDIF(LIBLZMA_FOUND) +-MARK_AS_ADVANCED(CLEAR LIBLZMA_INCLUDE_DIR) ++MARK_AS_ADVANCED(CLEAR LIBLZMA_INCLUDE_DIRS) + MARK_AS_ADVANCED(CLEAR LIBLZMA_LIBRARY) + + # +@@ -603,7 +603,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) +@@ -827,7 +827,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 f7fdfb68..9d2915ac 100644 +--- a/libarchive/CMakeLists.txt ++++ b/libarchive/CMakeLists.txt +@@ -251,6 +251,7 @@ IF(BUILD_SHARED_LIBS) + ENDIF(BUILD_SHARED_LIBS) + + # archive_static is a static library ++if(NOT BUILD_SHARED_LIBS) + ADD_LIBRARY(archive_static STATIC ${libarchive_SOURCES} ${include_HEADERS}) + TARGET_LINK_LIBRARIES(archive_static ${ADDITIONAL_LIBS}) + SET_TARGET_PROPERTIES(archive_static PROPERTIES COMPILE_DEFINITIONS +@@ -259,6 +260,7 @@ SET_TARGET_PROPERTIES(archive_static PROPERTIES COMPILE_DEFINITIONS + IF(NOT WIN32 OR CYGWIN OR NOT BUILD_SHARED_LIBS) + SET_TARGET_PROPERTIES(archive_static PROPERTIES OUTPUT_NAME archive) + ENDIF(NOT WIN32 OR CYGWIN OR NOT BUILD_SHARED_LIBS) ++endif() + + IF(ENABLE_INSTALL) + # How to install the libraries +@@ -268,10 +270,12 @@ IF(ENABLE_INSTALL) + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) + ENDIF(BUILD_SHARED_LIBS) ++ if(NOT BUILD_SHARED_LIBS) + 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.7.3-cmake.patch b/recipes/libarchive/all/patches/0003-3.7.3-cmake.patch new file mode 100644 index 0000000000000..a4c5151bebe08 --- /dev/null +++ b/recipes/libarchive/all/patches/0003-3.7.3-cmake.patch @@ -0,0 +1,92 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 44ca23d..40439ca 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -12,7 +12,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() +@@ -449,7 +449,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) + # + # Test if ZLIB_WINAPI macro is needed to use. +@@ -518,7 +518,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}) +@@ -539,7 +539,7 @@ ELSE(LIBLZMA_FOUND) + # LZMA not found and will not be used. + SET(HAVE_LZMA_STREAM_ENCODER_MT 0) + ENDIF(LIBLZMA_FOUND) +-MARK_AS_ADVANCED(CLEAR LIBLZMA_INCLUDE_DIR) ++MARK_AS_ADVANCED(CLEAR LIBLZMA_INCLUDE_DIRS) + MARK_AS_ADVANCED(CLEAR LIBLZMA_LIBRARY) + + # +@@ -610,7 +610,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) +@@ -834,7 +834,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 b79091c..bd9e980 100644 +--- a/libarchive/CMakeLists.txt ++++ b/libarchive/CMakeLists.txt +@@ -251,6 +251,7 @@ IF(BUILD_SHARED_LIBS) + ENDIF(BUILD_SHARED_LIBS) + + # archive_static is a static library ++if(NOT BUILD_SHARED_LIBS) + ADD_LIBRARY(archive_static STATIC ${libarchive_SOURCES} ${include_HEADERS}) + TARGET_INCLUDE_DIRECTORIES(archive_static PUBLIC .) + TARGET_LINK_LIBRARIES(archive_static ${ADDITIONAL_LIBS}) +@@ -260,7 +261,7 @@ SET_TARGET_PROPERTIES(archive_static PROPERTIES COMPILE_DEFINITIONS + IF(NOT WIN32 OR CYGWIN OR NOT BUILD_SHARED_LIBS) + SET_TARGET_PROPERTIES(archive_static PROPERTIES OUTPUT_NAME archive) + ENDIF(NOT WIN32 OR CYGWIN OR NOT BUILD_SHARED_LIBS) +- ++endif() + IF(ENABLE_INSTALL) + # How to install the libraries + IF(BUILD_SHARED_LIBS) +@@ -269,10 +270,12 @@ IF(ENABLE_INSTALL) + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) + ENDIF(BUILD_SHARED_LIBS) ++ if(NOT BUILD_SHARED_LIBS) + 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.7.4-cmake.patch b/recipes/libarchive/all/patches/0003-3.7.4-cmake.patch new file mode 100644 index 0000000000000..1cd38344e5586 --- /dev/null +++ b/recipes/libarchive/all/patches/0003-3.7.4-cmake.patch @@ -0,0 +1,83 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 7e87e07..2c9a5f8 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -12,7 +12,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() +@@ -451,7 +451,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) + # + # Test if ZLIB_WINAPI macro is needed to use. +@@ -541,7 +541,7 @@ ELSE(LIBLZMA_FOUND) + # LZMA not found and will not be used. + SET(HAVE_LZMA_STREAM_ENCODER_MT 0) + ENDIF(LIBLZMA_FOUND) +-MARK_AS_ADVANCED(CLEAR LIBLZMA_INCLUDE_DIR) ++MARK_AS_ADVANCED(CLEAR LIBLZMA_INCLUDE_DIRS) + MARK_AS_ADVANCED(CLEAR LIBLZMA_LIBRARY) + + # +@@ -612,7 +612,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) +@@ -836,7 +836,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 b79091c..bd9e980 100644 +--- a/libarchive/CMakeLists.txt ++++ b/libarchive/CMakeLists.txt +@@ -251,6 +251,7 @@ IF(BUILD_SHARED_LIBS) + ENDIF(BUILD_SHARED_LIBS) + + # archive_static is a static library ++if(NOT BUILD_SHARED_LIBS) + ADD_LIBRARY(archive_static STATIC ${libarchive_SOURCES} ${include_HEADERS}) + TARGET_INCLUDE_DIRECTORIES(archive_static PUBLIC .) + TARGET_LINK_LIBRARIES(archive_static ${ADDITIONAL_LIBS}) +@@ -260,7 +261,7 @@ SET_TARGET_PROPERTIES(archive_static PROPERTIES COMPILE_DEFINITIONS + IF(NOT WIN32 OR CYGWIN OR NOT BUILD_SHARED_LIBS) + SET_TARGET_PROPERTIES(archive_static PROPERTIES OUTPUT_NAME archive) + ENDIF(NOT WIN32 OR CYGWIN OR NOT BUILD_SHARED_LIBS) +- ++endif() + IF(ENABLE_INSTALL) + # How to install the libraries + IF(BUILD_SHARED_LIBS) +@@ -269,10 +270,12 @@ IF(ENABLE_INSTALL) + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) + ENDIF(BUILD_SHARED_LIBS) ++ if(NOT BUILD_SHARED_LIBS) + 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.7.6-cmake.patch b/recipes/libarchive/all/patches/0003-3.7.6-cmake.patch new file mode 100644 index 0000000000000..98e97aac6cf07 --- /dev/null +++ b/recipes/libarchive/all/patches/0003-3.7.6-cmake.patch @@ -0,0 +1,84 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 582258c..b59a7e2 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -16,7 +16,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() +@@ -469,7 +469,7 @@ ENDIF() + 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) + # +@@ -560,7 +560,7 @@ ELSE(LIBLZMA_FOUND) + # LZMA not found and will not be used. + SET(HAVE_LZMA_STREAM_ENCODER_MT 0) + ENDIF(LIBLZMA_FOUND) +-MARK_AS_ADVANCED(CLEAR LIBLZMA_INCLUDE_DIR) ++MARK_AS_ADVANCED(CLEAR LIBLZMA_INCLUDE_DIRS) + MARK_AS_ADVANCED(CLEAR LIBLZMA_LIBRARY) + + # +@@ -631,7 +631,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) +@@ -854,7 +854,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 dd0b280..2a31de6 100644 +--- a/libarchive/CMakeLists.txt ++++ b/libarchive/CMakeLists.txt +@@ -255,6 +255,7 @@ IF(BUILD_SHARED_LIBS) + ENDIF(BUILD_SHARED_LIBS) + + # archive_static is a static library ++IF(NOT BUILD_SHARED_LIBS) + ADD_LIBRARY(archive_static STATIC ${libarchive_SOURCES} ${include_HEADERS}) + TARGET_INCLUDE_DIRECTORIES(archive_static PUBLIC .) + TARGET_LINK_LIBRARIES(archive_static ${ADDITIONAL_LIBS}) +@@ -264,7 +265,7 @@ SET_TARGET_PROPERTIES(archive_static PROPERTIES COMPILE_DEFINITIONS + IF(NOT WIN32 OR CYGWIN OR NOT BUILD_SHARED_LIBS) + SET_TARGET_PROPERTIES(archive_static PROPERTIES OUTPUT_NAME archive) + ENDIF(NOT WIN32 OR CYGWIN OR NOT BUILD_SHARED_LIBS) +- ++ENDIF() + IF(ENABLE_INSTALL) + # How to install the libraries + IF(BUILD_SHARED_LIBS) +@@ -272,11 +273,12 @@ IF(ENABLE_INSTALL) + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) +- ENDIF(BUILD_SHARED_LIBS) ++ 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 deleted file mode 100644 index c4c91d3ecb18a..0000000000000 --- a/recipes/libarchive/all/patches/0004-3.6.0-android.patch +++ /dev/null @@ -1,15 +0,0 @@ -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.7.2-try-compile-cmakedeps.patch b/recipes/libarchive/all/patches/0005-3.7.2-try-compile-cmakedeps.patch new file mode 100644 index 0000000000000..53603bc1f64f9 --- /dev/null +++ b/recipes/libarchive/all/patches/0005-3.7.2-try-compile-cmakedeps.patch @@ -0,0 +1,32 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 6849ce40..e7c9fbee 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -855,14 +855,14 @@ IF(NOT OPENSSL_FOUND) + ENDIF(LIBMD_FOUND) + ENDIF(NOT OPENSSL_FOUND) + +-# + # How to prove that CRYPTO functions, which have several names on various + # platforms, just see if archive_digest.c can compile and link against + # required libraries. +-# + MACRO(CHECK_CRYPTO ALGORITHMS IMPLEMENTATION) ++ include(CMakePushCheckState) + FOREACH(ALGORITHM ${ALGORITHMS}) + IF(NOT ARCHIVE_CRYPTO_${ALGORITHM}) ++ cmake_push_check_state() + STRING(TOLOWER "${ALGORITHM}" lower_algorithm) + STRING(TOUPPER "${ALGORITHM}" algorithm) + IF ("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND NOT OPENSSL_FOUND) +@@ -882,8 +882,8 @@ 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}") diff --git a/recipes/libarchive/all/patches/0005-3.7.3-try-compile-cmakedeps.patch b/recipes/libarchive/all/patches/0005-3.7.3-try-compile-cmakedeps.patch new file mode 100644 index 0000000000000..a55e8c8709b68 --- /dev/null +++ b/recipes/libarchive/all/patches/0005-3.7.3-try-compile-cmakedeps.patch @@ -0,0 +1,25 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 40439ca..6845238 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -867,8 +867,10 @@ ENDIF(NOT OPENSSL_FOUND) + # required libraries. + # + MACRO(CHECK_CRYPTO ALGORITHMS IMPLEMENTATION) ++ include(CMakePushCheckState) + FOREACH(ALGORITHM ${ALGORITHMS}) + IF(NOT ARCHIVE_CRYPTO_${ALGORITHM}) ++ cmake_push_check_state() + STRING(TOLOWER "${ALGORITHM}" lower_algorithm) + STRING(TOUPPER "${ALGORITHM}" algorithm) + IF ("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND NOT OPENSSL_FOUND) +@@ -901,8 +903,7 @@ MACRO(CHECK_CRYPTO ALGORITHMS IMPLEMENTATION) + SET(TRY_CRYPTO_REQUIRED_LIBS + "-DLINK_LIBRARIES:STRING=${NETTLE_LIBRARY}") + ELSEIF("${IMPLEMENTATION}" MATCHES "^LIBMD$" AND LIBMD_FOUND) +- SET(TRY_CRYPTO_REQUIRED_LIBS +- "-DLINK_LIBRARIES:STRING=${LIBMD_LIBRARY}") ++ SET(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_LIBRARIES}) + ENDIF("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND OPENSSL_FOUND) + + CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/build/cmake/config.h.in diff --git a/recipes/libarchive/all/patches/0005-3.7.4-try-compile-cmakedeps.patch b/recipes/libarchive/all/patches/0005-3.7.4-try-compile-cmakedeps.patch new file mode 100644 index 0000000000000..a6c90a0205df0 --- /dev/null +++ b/recipes/libarchive/all/patches/0005-3.7.4-try-compile-cmakedeps.patch @@ -0,0 +1,25 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 2c9a5f8..91d0f49 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -869,8 +869,10 @@ ENDIF(NOT OPENSSL_FOUND) + # required libraries. + # + MACRO(CHECK_CRYPTO ALGORITHMS IMPLEMENTATION) ++ include(CMakePushCheckState) + FOREACH(ALGORITHM ${ALGORITHMS}) + IF(NOT ARCHIVE_CRYPTO_${ALGORITHM}) ++ cmake_push_check_state() + STRING(TOLOWER "${ALGORITHM}" lower_algorithm) + STRING(TOUPPER "${ALGORITHM}" algorithm) + IF ("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND NOT OPENSSL_FOUND) +@@ -903,8 +905,7 @@ MACRO(CHECK_CRYPTO ALGORITHMS IMPLEMENTATION) + SET(TRY_CRYPTO_REQUIRED_LIBS + "-DLINK_LIBRARIES:STRING=${NETTLE_LIBRARY}") + ELSEIF("${IMPLEMENTATION}" MATCHES "^LIBMD$" AND LIBMD_FOUND) +- SET(TRY_CRYPTO_REQUIRED_LIBS +- "-DLINK_LIBRARIES:STRING=${LIBMD_LIBRARY}") ++ SET(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_LIBRARIES}) + ENDIF("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND OPENSSL_FOUND) + + CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/build/cmake/config.h.in diff --git a/recipes/libarchive/all/patches/0005-3.7.6-try-compile-cmakedeps.patch b/recipes/libarchive/all/patches/0005-3.7.6-try-compile-cmakedeps.patch new file mode 100644 index 0000000000000..7485f8082d921 --- /dev/null +++ b/recipes/libarchive/all/patches/0005-3.7.6-try-compile-cmakedeps.patch @@ -0,0 +1,25 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index b59a7e2..dfa6af0 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -887,8 +887,10 @@ ENDIF(NOT OPENSSL_FOUND) + # required libraries. + # + MACRO(CHECK_CRYPTO ALGORITHMS IMPLEMENTATION) ++ include(CMakePushCheckState) + FOREACH(ALGORITHM ${ALGORITHMS}) + IF(NOT ARCHIVE_CRYPTO_${ALGORITHM}) ++ cmake_push_check_state() + STRING(TOLOWER "${ALGORITHM}" lower_algorithm) + STRING(TOUPPER "${ALGORITHM}" algorithm) + IF ("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND NOT OPENSSL_FOUND) +@@ -921,8 +923,7 @@ MACRO(CHECK_CRYPTO ALGORITHMS IMPLEMENTATION) + SET(TRY_CRYPTO_REQUIRED_LIBS + "-DLINK_LIBRARIES:STRING=${NETTLE_LIBRARY}") + ELSEIF("${IMPLEMENTATION}" MATCHES "^LIBMD$" AND LIBMD_FOUND) +- SET(TRY_CRYPTO_REQUIRED_LIBS +- "-DLINK_LIBRARIES:STRING=${LIBMD_LIBRARY}") ++ SET(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_LIBRARIES}) + ENDIF("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND OPENSSL_FOUND) + + CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/build/cmake/config.h.in diff --git a/recipes/libarchive/all/patches/0006-3.7.2-fix-msvc-build.patch b/recipes/libarchive/all/patches/0006-3.7.2-fix-msvc-build.patch new file mode 100644 index 0000000000000..4a669d0956310 --- /dev/null +++ b/recipes/libarchive/all/patches/0006-3.7.2-fix-msvc-build.patch @@ -0,0 +1,45 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 6849ce40..d5dac48b 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1402,7 +1402,7 @@ CHECK_FUNCTION_EXISTS_GLIBC(localtime_r HAVE_LOCALTIME_R) + CHECK_FUNCTION_EXISTS_GLIBC(lstat HAVE_LSTAT) + CHECK_FUNCTION_EXISTS_GLIBC(lutimes HAVE_LUTIMES) + CHECK_FUNCTION_EXISTS_GLIBC(mbrtowc HAVE_MBRTOWC) +-CHECK_FUNCTION_EXISTS_GLIBC(memmove HAVE_MEMMOVE) ++SET(HAVE_MEMMOVE 1) + CHECK_FUNCTION_EXISTS_GLIBC(mkdir HAVE_MKDIR) + CHECK_FUNCTION_EXISTS_GLIBC(mkfifo HAVE_MKFIFO) + CHECK_FUNCTION_EXISTS_GLIBC(mknod HAVE_MKNOD) +@@ -1435,11 +1435,11 @@ CHECK_FUNCTION_EXISTS_GLIBC(utime HAVE_UTIME) + CHECK_FUNCTION_EXISTS_GLIBC(utimes HAVE_UTIMES) + CHECK_FUNCTION_EXISTS_GLIBC(utimensat HAVE_UTIMENSAT) + CHECK_FUNCTION_EXISTS_GLIBC(vfork HAVE_VFORK) +-CHECK_FUNCTION_EXISTS_GLIBC(wcrtomb HAVE_WCRTOMB) +-CHECK_FUNCTION_EXISTS_GLIBC(wcscmp HAVE_WCSCMP) +-CHECK_FUNCTION_EXISTS_GLIBC(wcscpy HAVE_WCSCPY) +-CHECK_FUNCTION_EXISTS_GLIBC(wcslen HAVE_WCSLEN) +-CHECK_FUNCTION_EXISTS_GLIBC(wctomb HAVE_WCTOMB) ++SET(HAVE_WCRTOMB 1) ++SET(HAVE_WCSCMP 1) ++SET(HAVE_WCSCPY 1) ++SET(HAVE_WCSLEN 1) ++SET(HAVE_WCTOMB 1) + CHECK_FUNCTION_EXISTS_GLIBC(_fseeki64 HAVE__FSEEKI64) + CHECK_FUNCTION_EXISTS_GLIBC(_get_timezone HAVE__GET_TIMEZONE) + CHECK_SYMBOL_EXISTS(ctime_s "time.h" HAVE_CTIME_S) +@@ -1452,10 +1452,10 @@ CHECK_FUNCTION_EXISTS(cygwin_conv_path HAVE_CYGWIN_CONV_PATH) + CHECK_FUNCTION_EXISTS(fseeko HAVE_FSEEKO) + CHECK_FUNCTION_EXISTS(strerror_r HAVE_STRERROR_R) + CHECK_FUNCTION_EXISTS(strftime HAVE_STRFTIME) +-CHECK_FUNCTION_EXISTS(vprintf HAVE_VPRINTF) +-CHECK_FUNCTION_EXISTS(wmemcmp HAVE_WMEMCMP) +-CHECK_FUNCTION_EXISTS(wmemcpy HAVE_WMEMCPY) +-CHECK_FUNCTION_EXISTS(wmemmove HAVE_WMEMMOVE) ++SET(HAVE_VPRINTF 1) ++SET(HAVE_WMEMCMP 1) ++SET(HAVE_WMEMCPY 1) ++SET(HAVE_WMEMMOVE 1) + + CMAKE_POP_CHECK_STATE() # Restore the state of the variables + diff --git a/recipes/libarchive/all/patches/0006-3.7.3-fix-msvc-build.patch b/recipes/libarchive/all/patches/0006-3.7.3-fix-msvc-build.patch new file mode 100644 index 0000000000000..d25d36378b560 --- /dev/null +++ b/recipes/libarchive/all/patches/0006-3.7.3-fix-msvc-build.patch @@ -0,0 +1,45 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 6845238..489936a 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1471,7 +1471,7 @@ CHECK_FUNCTION_EXISTS_GLIBC(localtime_r HAVE_LOCALTIME_R) + CHECK_FUNCTION_EXISTS_GLIBC(lstat HAVE_LSTAT) + CHECK_FUNCTION_EXISTS_GLIBC(lutimes HAVE_LUTIMES) + CHECK_FUNCTION_EXISTS_GLIBC(mbrtowc HAVE_MBRTOWC) +-CHECK_FUNCTION_EXISTS_GLIBC(memmove HAVE_MEMMOVE) ++SET(HAVE_MEMMOVE 1) + CHECK_FUNCTION_EXISTS_GLIBC(mkdir HAVE_MKDIR) + CHECK_FUNCTION_EXISTS_GLIBC(mkfifo HAVE_MKFIFO) + CHECK_FUNCTION_EXISTS_GLIBC(mknod HAVE_MKNOD) +@@ -1504,11 +1504,11 @@ CHECK_FUNCTION_EXISTS_GLIBC(utime HAVE_UTIME) + CHECK_FUNCTION_EXISTS_GLIBC(utimes HAVE_UTIMES) + CHECK_FUNCTION_EXISTS_GLIBC(utimensat HAVE_UTIMENSAT) + CHECK_FUNCTION_EXISTS_GLIBC(vfork HAVE_VFORK) +-CHECK_FUNCTION_EXISTS_GLIBC(wcrtomb HAVE_WCRTOMB) +-CHECK_FUNCTION_EXISTS_GLIBC(wcscmp HAVE_WCSCMP) +-CHECK_FUNCTION_EXISTS_GLIBC(wcscpy HAVE_WCSCPY) +-CHECK_FUNCTION_EXISTS_GLIBC(wcslen HAVE_WCSLEN) +-CHECK_FUNCTION_EXISTS_GLIBC(wctomb HAVE_WCTOMB) ++SET(HAVE_WCRTOMB 1) ++SET(HAVE_WCSCMP 1) ++SET(HAVE_WCSCPY 1) ++SET(HAVE_WCSLEN 1) ++SET(HAVE_WCTOMB 1) + CHECK_FUNCTION_EXISTS_GLIBC(_fseeki64 HAVE__FSEEKI64) + CHECK_FUNCTION_EXISTS_GLIBC(_get_timezone HAVE__GET_TIMEZONE) + CHECK_SYMBOL_EXISTS(ctime_s "time.h" HAVE_CTIME_S) +@@ -1521,10 +1521,10 @@ CHECK_FUNCTION_EXISTS(cygwin_conv_path HAVE_CYGWIN_CONV_PATH) + CHECK_FUNCTION_EXISTS(fseeko HAVE_FSEEKO) + CHECK_FUNCTION_EXISTS(strerror_r HAVE_STRERROR_R) + CHECK_FUNCTION_EXISTS(strftime HAVE_STRFTIME) +-CHECK_FUNCTION_EXISTS(vprintf HAVE_VPRINTF) +-CHECK_FUNCTION_EXISTS(wmemcmp HAVE_WMEMCMP) +-CHECK_FUNCTION_EXISTS(wmemcpy HAVE_WMEMCPY) +-CHECK_FUNCTION_EXISTS(wmemmove HAVE_WMEMMOVE) ++SET(HAVE_VPRINTF 1) ++SET(HAVE_WMEMCMP 1) ++SET(HAVE_WMEMCPY 1) ++SET(HAVE_WMEMMOVE 1) + + CMAKE_POP_CHECK_STATE() # Restore the state of the variables + diff --git a/recipes/libarchive/all/patches/0006-3.7.4-fix-msvc-build.patch b/recipes/libarchive/all/patches/0006-3.7.4-fix-msvc-build.patch new file mode 100644 index 0000000000000..754faa44c171c --- /dev/null +++ b/recipes/libarchive/all/patches/0006-3.7.4-fix-msvc-build.patch @@ -0,0 +1,45 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 91d0f49..4041b9b 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1473,7 +1473,7 @@ CHECK_FUNCTION_EXISTS_GLIBC(localtime_r HAVE_LOCALTIME_R) + CHECK_FUNCTION_EXISTS_GLIBC(lstat HAVE_LSTAT) + CHECK_FUNCTION_EXISTS_GLIBC(lutimes HAVE_LUTIMES) + CHECK_FUNCTION_EXISTS_GLIBC(mbrtowc HAVE_MBRTOWC) +-CHECK_FUNCTION_EXISTS_GLIBC(memmove HAVE_MEMMOVE) ++SET(HAVE_MEMMOVE 1) + CHECK_FUNCTION_EXISTS_GLIBC(mkdir HAVE_MKDIR) + CHECK_FUNCTION_EXISTS_GLIBC(mkfifo HAVE_MKFIFO) + CHECK_FUNCTION_EXISTS_GLIBC(mknod HAVE_MKNOD) +@@ -1507,11 +1507,11 @@ CHECK_FUNCTION_EXISTS_GLIBC(utime HAVE_UTIME) + CHECK_FUNCTION_EXISTS_GLIBC(utimes HAVE_UTIMES) + CHECK_FUNCTION_EXISTS_GLIBC(utimensat HAVE_UTIMENSAT) + CHECK_FUNCTION_EXISTS_GLIBC(vfork HAVE_VFORK) +-CHECK_FUNCTION_EXISTS_GLIBC(wcrtomb HAVE_WCRTOMB) +-CHECK_FUNCTION_EXISTS_GLIBC(wcscmp HAVE_WCSCMP) +-CHECK_FUNCTION_EXISTS_GLIBC(wcscpy HAVE_WCSCPY) +-CHECK_FUNCTION_EXISTS_GLIBC(wcslen HAVE_WCSLEN) +-CHECK_FUNCTION_EXISTS_GLIBC(wctomb HAVE_WCTOMB) ++SET(HAVE_WCRTOMB 1) ++SET(HAVE_WCSCMP 1) ++SET(HAVE_WCSCPY 1) ++SET(HAVE_WCSLEN 1) ++SET(HAVE_WCTOMB 1) + CHECK_FUNCTION_EXISTS_GLIBC(_fseeki64 HAVE__FSEEKI64) + CHECK_FUNCTION_EXISTS_GLIBC(_get_timezone HAVE__GET_TIMEZONE) + CHECK_SYMBOL_EXISTS(ctime_s "time.h" HAVE_CTIME_S) +@@ -1524,10 +1524,10 @@ CHECK_FUNCTION_EXISTS(cygwin_conv_path HAVE_CYGWIN_CONV_PATH) + CHECK_FUNCTION_EXISTS(fseeko HAVE_FSEEKO) + CHECK_FUNCTION_EXISTS(strerror_r HAVE_STRERROR_R) + CHECK_FUNCTION_EXISTS(strftime HAVE_STRFTIME) +-CHECK_FUNCTION_EXISTS(vprintf HAVE_VPRINTF) +-CHECK_FUNCTION_EXISTS(wmemcmp HAVE_WMEMCMP) +-CHECK_FUNCTION_EXISTS(wmemcpy HAVE_WMEMCPY) +-CHECK_FUNCTION_EXISTS(wmemmove HAVE_WMEMMOVE) ++SET(HAVE_VPRINTF 1) ++SET(HAVE_WMEMCMP 1) ++SET(HAVE_WMEMCPY 1) ++SET(HAVE_WMEMMOVE 1) + + CMAKE_POP_CHECK_STATE() # Restore the state of the variables + diff --git a/recipes/libarchive/all/patches/0006-3.7.6-fix-msvc-build.patch b/recipes/libarchive/all/patches/0006-3.7.6-fix-msvc-build.patch new file mode 100644 index 0000000000000..9652721d7fe5e --- /dev/null +++ b/recipes/libarchive/all/patches/0006-3.7.6-fix-msvc-build.patch @@ -0,0 +1,45 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index dfa6af0..b2cac97 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1491,7 +1491,7 @@ CHECK_FUNCTION_EXISTS_GLIBC(localtime_r HAVE_LOCALTIME_R) + CHECK_FUNCTION_EXISTS_GLIBC(lstat HAVE_LSTAT) + CHECK_FUNCTION_EXISTS_GLIBC(lutimes HAVE_LUTIMES) + CHECK_FUNCTION_EXISTS_GLIBC(mbrtowc HAVE_MBRTOWC) +-CHECK_FUNCTION_EXISTS_GLIBC(memmove HAVE_MEMMOVE) ++SET(HAVE_MEMMOVE 1) + CHECK_FUNCTION_EXISTS_GLIBC(mkdir HAVE_MKDIR) + CHECK_FUNCTION_EXISTS_GLIBC(mkfifo HAVE_MKFIFO) + CHECK_FUNCTION_EXISTS_GLIBC(mknod HAVE_MKNOD) +@@ -1525,11 +1525,11 @@ CHECK_FUNCTION_EXISTS_GLIBC(utime HAVE_UTIME) + CHECK_FUNCTION_EXISTS_GLIBC(utimes HAVE_UTIMES) + CHECK_FUNCTION_EXISTS_GLIBC(utimensat HAVE_UTIMENSAT) + CHECK_FUNCTION_EXISTS_GLIBC(vfork HAVE_VFORK) +-CHECK_FUNCTION_EXISTS_GLIBC(wcrtomb HAVE_WCRTOMB) +-CHECK_FUNCTION_EXISTS_GLIBC(wcscmp HAVE_WCSCMP) +-CHECK_FUNCTION_EXISTS_GLIBC(wcscpy HAVE_WCSCPY) +-CHECK_FUNCTION_EXISTS_GLIBC(wcslen HAVE_WCSLEN) +-CHECK_FUNCTION_EXISTS_GLIBC(wctomb HAVE_WCTOMB) ++SET(HAVE_WCRTOMB 1) ++SET(HAVE_WCSCMP 1) ++SET(HAVE_WCSCPY 1) ++SET(HAVE_WCSLEN 1) ++SET(HAVE_WCTOMB 1) + CHECK_FUNCTION_EXISTS_GLIBC(_fseeki64 HAVE__FSEEKI64) + CHECK_FUNCTION_EXISTS_GLIBC(_get_timezone HAVE__GET_TIMEZONE) + CHECK_SYMBOL_EXISTS(ctime_s "time.h" HAVE_CTIME_S) +@@ -1542,10 +1542,10 @@ CHECK_FUNCTION_EXISTS(cygwin_conv_path HAVE_CYGWIN_CONV_PATH) + CHECK_FUNCTION_EXISTS(fseeko HAVE_FSEEKO) + CHECK_FUNCTION_EXISTS(strerror_r HAVE_STRERROR_R) + CHECK_FUNCTION_EXISTS(strftime HAVE_STRFTIME) +-CHECK_FUNCTION_EXISTS(vprintf HAVE_VPRINTF) +-CHECK_FUNCTION_EXISTS(wmemcmp HAVE_WMEMCMP) +-CHECK_FUNCTION_EXISTS(wmemcpy HAVE_WMEMCPY) +-CHECK_FUNCTION_EXISTS(wmemmove HAVE_WMEMMOVE) ++SET(HAVE_VPRINTF 1) ++SET(HAVE_WMEMCMP 1) ++SET(HAVE_WMEMCPY 1) ++SET(HAVE_WMEMMOVE 1) + + CMAKE_POP_CHECK_STATE() # Restore the state of the variables + diff --git a/recipes/libarchive/config.yml b/recipes/libarchive/config.yml index 5e7bb50cad34c..df2cddd584f6d 100644 --- a/recipes/libarchive/config.yml +++ b/recipes/libarchive/config.yml @@ -1,13 +1,9 @@ versions: - "3.6.1": + "3.7.6": folder: all - "3.6.0": + "3.7.4": folder: all - "3.5.2": + "3.7.3": folder: all - "3.5.1": - folder: all - "3.4.3": - folder: all - "3.4.0": + "3.7.2": folder: all diff --git a/recipes/libassert/config.yml b/recipes/libassert/config.yml new file mode 100644 index 0000000000000..635e69403c99f --- /dev/null +++ b/recipes/libassert/config.yml @@ -0,0 +1,21 @@ +versions: + "2.1.2": + folder: v2 + "2.1.1": + folder: v2 + "2.1.0": + folder: v2 + "2.0.2": + folder: v2 + "2.0.1": + folder: v2 + "2.0.0": + folder: v2 + "1.2.2": + folder: v1 + "1.2.1": + folder: v1 + "1.1": + folder: v1 + "1.0": + folder: v1 diff --git a/recipes/libassert/v1/conandata.yml b/recipes/libassert/v1/conandata.yml new file mode 100644 index 0000000000000..1cae5dc94ff57 --- /dev/null +++ b/recipes/libassert/v1/conandata.yml @@ -0,0 +1,48 @@ +sources: + # Newer versions at the top + "1.2.2": + url: + - "https://github.com/jeremy-rifkin/libassert/archive/refs/tags/v1.2.2.tar.gz" + sha256: "68206b43bc4803357ba7d366574b4631bd327c46ab76ddef6ff9366784fa6b3c" + "1.2.1": + url: + - "https://github.com/jeremy-rifkin/libassert/archive/refs/tags/v1.2.1.tar.gz" + sha256: "58538368751d59f2fc756046eaa4cc926b994ba930f1889d770106c9a1db3425" + "1.1": + url: + - "https://github.com/jeremy-rifkin/libassert/archive/refs/tags/v1.1.tar.gz" + sha256: "01e1b99bf4dacd816fceeb5cc7efdc8875ed21295a62396584a0e7649b944c67" + "1.0": + url: + - "https://github.com/jeremy-rifkin/libassert/archive/refs/tags/v1.0.tar.gz" + sha256: "e1bb3b50767994ca4d0f60b7977b279cf32b8569ff92c5830e7a1de567b82fd5" + +patches: + "1.2.2": + - patch_file: "patches/1.2.2/0001-cpptrace-dll-copy.patch" + patch_type: "conan" + patch_description: "Disable custom command to copy cpptrace.dll on windows" + "1.2.1": + - patch_file: "patches/1.2.1/0001-cpptrace-dll-copy.patch" + patch_type: "conan" + patch_description: "Disable custom command to copy cpptrace.dll on windows" + "1.1": + - patch_file: "patches/1.1/0001-fix-max_line_number_width-miscalculation.patch" + patch_type: "bugfix" + patch_description: "Fix max_line_number_width miscalculation" + - patch_file: "patches/1.1/0002-binary_diagnostics_descriptor-noexcept.patch" + patch_type: "portability" + patch_description: "Fixes GCC 8 build" + - patch_file: "patches/1.1/0003-cmake-windows.patch" + patch_type: "bugfix" + patch_description: "Fixes Windows DLL CMake install" + "1.0": + - patch_file: "patches/1.0/0001-add-cstring-include.patch" + patch_type: "bugfix" + patch_description: "Add missing include" + - patch_file: "patches/1.0/0002-cmake-backport.patch" + patch_type: "portability" + patch_description: "Port back CMake install" + - patch_file: "patches/1.0/0003-fix-max_line_number_width-miscalculation.patch" + patch_type: "bugfix" + patch_description: "Fix max_line_number_width miscalculation" diff --git a/recipes/libassert/v1/conanfile.py b/recipes/libassert/v1/conanfile.py new file mode 100644 index 0000000000000..8ccc475577fbc --- /dev/null +++ b/recipes/libassert/v1/conanfile.py @@ -0,0 +1,148 @@ +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.apple import is_apple_os +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, CMakeDeps, cmake_layout +from conan.tools.files import apply_conandata_patches, export_conandata_patches +import os + +required_conan_version = ">=1.53.0" + +class LibassertConan(ConanFile): + name = "libassert" + description = "The most over-engineered and overpowered C++ assertion library." + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/jeremy-rifkin/libassert" + package_type = "library" + + topics = ("assert", "library", "assertions", "stacktrace") + 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 { + "gcc": "8", + "clang": "9" + } + + 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 Version(self.version) >= "1.2.2": + self.requires("cpptrace/0.3.1") + elif Version(self.version) >= "1.2.1": + self.requires("cpptrace/0.2.1") + + def validate(self): + if is_apple_os(self): + raise ConanInvalidConfiguration(f"{self.ref} is not supported on Mac. Please, update to version >=2.0.0") + + 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 export_sources(self): + export_conandata_patches(self) + + def generate(self): + tc = CMakeToolchain(self) + + if is_msvc(self): + tc.variables["USE_MSVC_RUNTIME_LIBRARY_DLL"] = not is_msvc_static_runtime(self) + + if not self.options.shared: + tc.variables["ASSERT_STATIC"] = True + tc.variables["ASSERT_USE_EXTERNAL_CPPTRACE"] = True + deps = CMakeDeps(self) + deps.generate() + + 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() + + if self.settings.os == "Windows" and self.options.shared: + copy( + self, + "*.dll", + src=self.build_folder, + dst=os.path.join(self.package_folder, "bin"), + keep_path=False + ) + + 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 = ["assert"] + + self.cpp_info.set_property("cmake_file_name", "assert") + self.cpp_info.set_property("cmake_target_name", "assert::assert") + + # the first version of this library used assert/assert as include folder + # appending this one but not removing the default to not break consumers + self.cpp_info.includedirs.append(os.path.join("include", "assert")) + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "assert" + self.cpp_info.filenames["cmake_find_package_multi"] = "assert" + self.cpp_info.names["cmake_find_package"] = "assert" + self.cpp_info.names["cmake_find_package_multi"] = "assert" + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") + + if Version(self.version) < "1.2.1": + # pre-cpptrace + if self.settings.os == "Linux": + self.cpp_info.system_libs.append("dl") + if self.settings.os == "Windows": + self.cpp_info.system_libs.append("dbghelp") diff --git a/recipes/libassert/v1/patches/1.0/0001-add-cstring-include.patch b/recipes/libassert/v1/patches/1.0/0001-add-cstring-include.patch new file mode 100644 index 0000000000000..1d164d02c27f8 --- /dev/null +++ b/recipes/libassert/v1/patches/1.0/0001-add-cstring-include.patch @@ -0,0 +1,12 @@ +diff --git a/include/assert.hpp b/include/assert.hpp +index d4cc580..f1cc9f9 100644 +--- a/include/assert.hpp ++++ b/include/assert.hpp +@@ -5,6 +5,7 @@ + // https://github.com/jeremy-rifkin/asserts + + #include ++#include + #include + #include + #include diff --git a/recipes/libassert/v1/patches/1.0/0002-cmake-backport.patch b/recipes/libassert/v1/patches/1.0/0002-cmake-backport.patch new file mode 100644 index 0000000000000..51a8f768416e8 --- /dev/null +++ b/recipes/libassert/v1/patches/1.0/0002-cmake-backport.patch @@ -0,0 +1,68 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index b3cd118..0bb5de8 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -2,6 +2,12 @@ cmake_minimum_required(VERSION 3.1) + + project(asserts) + ++set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) ++ ++# libassert uses relocs, -fpic has to be used to allow shared libs to link libassert as a static library. ++set(CMAKE_POSITION_INDEPENDENT_CODE ON) ++include(GNUInstallDirs) ++ + add_library(asserts_library_warnings INTERFACE) + + if(MSVC) +@@ -11,8 +15,12 @@ else() + endif() + + add_library(assert src/assert.cpp) +-target_include_directories(assert PUBLIC +- $) ++target_include_directories( ++ assert ++ PUBLIC ++ $ ++ $ ++) + + option(ASSERT_DECOMPOSE_BINARY_LOGICAL "Enables expression decomposition of && and ||" OFF) + option(ASSERT_LOWERCASE "Enables assert alias for ASSERT" OFF) +@@ -43,7 +51,32 @@ set_target_properties(assert + + target_link_libraries(assert PRIVATE asserts_library_warnings) + +-if (MSVC) +- target_link_libraries(assert PRIVATE dbghelp) +-endif () ++target_link_libraries( ++ assert ++ PRIVATE ++ $<$:dbghelp> ++ ${CMAKE_DL_LIBS} ++) ++ ++if(NOT CMAKE_SKIP_INSTALL_RULES) ++ install( ++ TARGETS assert ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ) ++ ++ install( ++ FILES ++ include/assert.hpp ++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/assert/assert ++ ) + ++ install( ++ FILES ++ third_party/magic_enum.hpp ++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/assert/third_party ++ ) ++ ++endif() diff --git a/recipes/libassert/v1/patches/1.0/0003-fix-max_line_number_width-miscalculation.patch b/recipes/libassert/v1/patches/1.0/0003-fix-max_line_number_width-miscalculation.patch new file mode 100644 index 0000000000000..88fb2864143b2 --- /dev/null +++ b/recipes/libassert/v1/patches/1.0/0003-fix-max_line_number_width-miscalculation.patch @@ -0,0 +1,40 @@ +From caeea1c4cfae0d8be1e60bcd9e6d0944fc264acf Mon Sep 17 00:00:00 2001 +From: Tsche <2440422+Tsche@users.noreply.github.com> +Date: Thu, 2 Mar 2023 16:51:22 +0100 +Subject: [PATCH] fix max_line_number_width miscalculation (#40) + +--- + src/assert.cpp | 18 ++++++++++++++---- + 1 file changed, 14 insertions(+), 4 deletions(-) + +diff --git a/src/assert.cpp b/src/assert.cpp +--- a/src/assert.cpp ++++ b/src/assert.cpp +@@ -2021,10 +2021,20 @@ namespace libassert::detail { + // path preprocessing + constexpr size_t max_file_length = 50; + auto [files, longest_file_width] = process_paths(trace, start, end); +- size_t max_line_number_width = log10(std::max_element(trace.begin(), trace.begin() + end + 1, +- [](const asserts::detail::stacktrace_entry& a, const asserts::detail::stacktrace_entry& b) { +- return std::to_string(a.line).size() < std::to_string(b.line).size(); +- })->line - start + 1 + 1); // +1 for indices starting at 0, +1 again for log ++ ++ const auto max_line_number = ++ std::max_element(std::next(trace.begin(), start), ++ std::next(trace.begin(), end + 1), ++ [](const asserts::detail::stacktrace_entry& a, ++ const asserts::detail::stacktrace_entry& b) { ++ return std::to_string(a.line).size() < ++ std::to_string(b.line).size(); ++ }) ++ ->line; ++ ++ // +1 for indices starting at 0, +1 again for log ++ const size_t max_line_number_width = log10(max_line_number + 1 + 1); ++ + size_t max_frame_width = log10(end - start + 1 + 1); // ^ + // do the actual trace + for(size_t i = start; i <= end; i++) { +-- +2.39.1 + diff --git a/recipes/libassert/v1/patches/1.1/0001-fix-max_line_number_width-miscalculation.patch b/recipes/libassert/v1/patches/1.1/0001-fix-max_line_number_width-miscalculation.patch new file mode 100644 index 0000000000000..f50510da3be16 --- /dev/null +++ b/recipes/libassert/v1/patches/1.1/0001-fix-max_line_number_width-miscalculation.patch @@ -0,0 +1,40 @@ +From caeea1c4cfae0d8be1e60bcd9e6d0944fc264acf Mon Sep 17 00:00:00 2001 +From: Tsche <2440422+Tsche@users.noreply.github.com> +Date: Thu, 2 Mar 2023 16:51:22 +0100 +Subject: [PATCH] fix max_line_number_width miscalculation (#40) + +--- + src/assert.cpp | 18 ++++++++++++++---- + 1 file changed, 14 insertions(+), 4 deletions(-) + +diff --git a/src/assert.cpp b/src/assert.cpp +--- a/src/assert.cpp ++++ b/src/assert.cpp +@@ -2024,10 +2024,20 @@ namespace libassert::detail { + // path preprocessing + constexpr size_t max_file_length = 50; + auto [files, longest_file_width] = process_paths(trace, start, end); +- size_t max_line_number_width = log10(std::max_element(trace.begin(), trace.begin() + end + 1, +- [](const libassert::detail::stacktrace_entry& a, const libassert::detail::stacktrace_entry& b) { +- return std::to_string(a.line).size() < std::to_string(b.line).size(); +- })->line - start + 1 + 1); // +1 for indices starting at 0, +1 again for log ++ ++ const auto max_line_number = ++ std::max_element(std::next(trace.begin(), start), ++ std::next(trace.begin(), end + 1), ++ [](const libassert::detail::stacktrace_entry& a, ++ const libassert::detail::stacktrace_entry& b) { ++ return std::to_string(a.line).size() < ++ std::to_string(b.line).size(); ++ }) ++ ->line; ++ ++ // +1 for indices starting at 0, +1 again for log ++ const size_t max_line_number_width = log10(max_line_number + 1 + 1); ++ + size_t max_frame_width = log10(end - start + 1 + 1); // ^ + // do the actual trace + for(size_t i = start; i <= end; i++) { +-- +2.39.1 + diff --git a/recipes/libassert/v1/patches/1.1/0002-binary_diagnostics_descriptor-noexcept.patch b/recipes/libassert/v1/patches/1.1/0002-binary_diagnostics_descriptor-noexcept.patch new file mode 100644 index 0000000000000..09970102b04bd --- /dev/null +++ b/recipes/libassert/v1/patches/1.1/0002-binary_diagnostics_descriptor-noexcept.patch @@ -0,0 +1,26 @@ +diff --git a/include/assert.hpp b/include/assert.hpp +index 89113c0..8c52d1b 100644 +--- a/include/assert.hpp ++++ b/include/assert.hpp +@@ -693,7 +693,7 @@ namespace libassert::detail { + binary_diagnostics_descriptor(const binary_diagnostics_descriptor&) = delete; + binary_diagnostics_descriptor(binary_diagnostics_descriptor&&) noexcept; // = default; in the .cpp + binary_diagnostics_descriptor& operator=(const binary_diagnostics_descriptor&) = delete; +- binary_diagnostics_descriptor& operator=(binary_diagnostics_descriptor&&) noexcept; // = default; in the .cpp ++ binary_diagnostics_descriptor& operator=(binary_diagnostics_descriptor&&); // = default; in the .cpp + }; + + void sort_and_dedup(literal_format(&)[format_arr_length]); +diff --git a/src/assert.cpp b/src/assert.cpp +index 5eb80f1..8d52a64 100644 +--- a/src/assert.cpp ++++ b/src/assert.cpp +@@ -2111,7 +2111,7 @@ namespace libassert::detail { + LIBASSERT_ATTR_COLD + binary_diagnostics_descriptor::binary_diagnostics_descriptor(binary_diagnostics_descriptor&&) noexcept = default; + LIBASSERT_ATTR_COLD binary_diagnostics_descriptor& +- binary_diagnostics_descriptor::operator=(binary_diagnostics_descriptor&&) noexcept = default; ++ binary_diagnostics_descriptor::operator=(binary_diagnostics_descriptor&&) = default; + + LIBASSERT_ATTR_COLD + static std::string print_values(const std::vector& vec, size_t lw) { diff --git a/recipes/libassert/v1/patches/1.1/0003-cmake-windows.patch b/recipes/libassert/v1/patches/1.1/0003-cmake-windows.patch new file mode 100644 index 0000000000000..2cac0ab5b331d --- /dev/null +++ b/recipes/libassert/v1/patches/1.1/0003-cmake-windows.patch @@ -0,0 +1,21 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 64a1a43..9eb9269 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -11,6 +11,8 @@ option(ASSERT_LOWERCASE "Enables assert alias for ASSERT" OFF) + option(ASSERT_USE_MAGIC_ENUM "Use the MagicEnum library to print better diagnostics for enum classes" ON) + set(ASSERT_FAIL "" CACHE STRING "ASSERT_FAIL") + ++set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) ++ + # libassert uses relocs, -fpic has to be used to allow shared libs to link libassert as a static library. + set(CMAKE_POSITION_INDEPENDENT_CODE ON) + +@@ -90,6 +90,7 @@ if(NOT CMAKE_SKIP_INSTALL_RULES) + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR} + ) + + install( diff --git a/recipes/libassert/v1/patches/1.2.1/0001-cpptrace-dll-copy.patch b/recipes/libassert/v1/patches/1.2.1/0001-cpptrace-dll-copy.patch new file mode 100644 index 0000000000000..feca84df9664e --- /dev/null +++ b/recipes/libassert/v1/patches/1.2.1/0001-cpptrace-dll-copy.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index ce5dbcf..085a1aa 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -161,7 +161,7 @@ + + # Don't run tests when library is used with add_subdirectory + if(PROJECT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) +- if(WIN32) ++ if(0) + add_custom_command( + TARGET assert POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different diff --git a/recipes/libassert/v1/patches/1.2.2/0001-cpptrace-dll-copy.patch b/recipes/libassert/v1/patches/1.2.2/0001-cpptrace-dll-copy.patch new file mode 100644 index 0000000000000..27871ced2d3f0 --- /dev/null +++ b/recipes/libassert/v1/patches/1.2.2/0001-cpptrace-dll-copy.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index ce5dbcf..085a1aa 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -163,7 +163,7 @@ + + # Don't run tests when library is used with add_subdirectory + if(PROJECT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) +- if(WIN32) ++ if(0) + add_custom_command( + TARGET assert POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different diff --git a/recipes/libassert/v1/test_package/CMakeLists.txt b/recipes/libassert/v1/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..7e6204817489c --- /dev/null +++ b/recipes/libassert/v1/test_package/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.15) + +project(test_package CXX) + + +add_executable(${PROJECT_NAME} test_package.cpp) + +find_package(assert REQUIRED CONFIG) +target_link_libraries(${PROJECT_NAME} PRIVATE assert::assert) + + +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/libassert/v1/test_package/conanfile.py b/recipes/libassert/v1/test_package/conanfile.py new file mode 100644 index 0000000000000..a804618d0f86f --- /dev/null +++ b/recipes/libassert/v1/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): + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libassert/v1/test_package/test_package.cpp b/recipes/libassert/v1/test_package/test_package.cpp new file mode 100644 index 0000000000000..751d401023f78 --- /dev/null +++ b/recipes/libassert/v1/test_package/test_package.cpp @@ -0,0 +1,16 @@ +#include +#include +#include + +int main(void) { + std::cout << "Testing libassert\n"; + + try{ + VERIFY(1 != 1); + } + catch (...){ + return EXIT_SUCCESS; + } + + return EXIT_FAILURE; +} diff --git a/recipes/libassert/v1/test_v1_package/CMakeLists.txt b/recipes/libassert/v1/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/libassert/v1/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/libassert/v1/test_v1_package/conanfile.py b/recipes/libassert/v1/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..c492184eec19c --- /dev/null +++ b/recipes/libassert/v1/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/libassert/v2/conandata.yml b/recipes/libassert/v2/conandata.yml new file mode 100644 index 0000000000000..b97af2f4b26ef --- /dev/null +++ b/recipes/libassert/v2/conandata.yml @@ -0,0 +1,35 @@ +sources: + "2.1.2": + url: "https://github.com/jeremy-rifkin/libassert/archive/refs/tags/v2.1.2.tar.gz" + sha256: "a7220ca354270deca08a7a162b93523c738ba3c8037a4df1a46ababfdc664196" + "2.1.1": + url: "https://github.com/jeremy-rifkin/libassert/archive/refs/tags/v2.1.1.tar.gz" + sha256: "2bdf27523f964f41668d266cfdbd7f5f58988af963d976577195969ed44359d1" + "2.1.0": + url: "https://github.com/jeremy-rifkin/libassert/archive/refs/tags/v2.1.0.tar.gz" + sha256: "e42405b49cde017c44c78aacac35c6e03564532838709031e73d10ab71f5363d" + "2.0.2": + url: "https://github.com/jeremy-rifkin/libassert/archive/refs/tags/v2.0.2.tar.gz" + sha256: "4a0b52e6523bdde0116231a67583131ea1a84bb574076fad939fc13fc7490443" + "2.0.1": + url: "https://github.com/jeremy-rifkin/libassert/archive/refs/tags/v2.0.1.tar.gz" + sha256: "405a44c14c5e40de5b81b01538ba12ef9d7c1f57e2c29f81b929e7e179847d4c" + "2.0.0": + url: "https://github.com/jeremy-rifkin/libassert/archive/refs/tags/v2.0.0.tar.gz" + sha256: "d4b2da2179a94637b34d18813a814531a1eceb0ddc6dd6db6098050dd638f4a1" +patches: + "2.1.0": + - patch_file: "patches/2.1.0/0001-msvc-ice.patch" + patch_type: "portability" + patch_source: https://github.com/jeremy-rifkin/libassert/commit/aff047da702316b10219a967f78da352f847b8d0 + patch_description: "Handle an ICE in old MSVC" + "2.0.1": + - patch_file: "patches/2.0.1/0001-fix-string_view-detection.patch" + patch_type: "portability" + patch_source: https://github.com/jeremy-rifkin/libassert/commit/1825976ebc7ccb34687d75aaaaf2a961dafc5450 + patch_description: "Update #if checks for string_view support" + "2.0.0": + - patch_file: "patches/2.0.0/0001-fix-export-and-include.patch" + patch_type: "bugfix" + patch_source: https://github.com/jeremy-rifkin/libassert/commit/25c1f3e43737ab18490a0d9430cb1c70f976a662 + patch_description: "Fix export header and an incorrect #include" diff --git a/recipes/libassert/v2/conanfile.py b/recipes/libassert/v2/conanfile.py new file mode 100644 index 0000000000000..7026af82c23fe --- /dev/null +++ b/recipes/libassert/v2/conanfile.py @@ -0,0 +1,137 @@ +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 get, copy, rmdir +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout +from conan.tools.files import apply_conandata_patches, export_conandata_patches +import os + +required_conan_version = ">=1.53.0" + +class LibassertConan(ConanFile): + name = "libassert" + description = "The most over-engineered C++ assertion library" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/jeremy-rifkin/libassert" + topics = ("assert", "library", "assertions", "stacktrace", "diagnostics", "defensive programming", "testing") + package_type = "library" + 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 { + "gcc": "8", + "clang": "9" + } + + 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 Version(self.version) >= "2.1.2": + self.requires("cpptrace/0.7.2", transitive_headers=True, transitive_libs=True) + else: + self.requires("cpptrace/0.7.1", transitive_headers=True, transitive_libs=True) + + 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 export_sources(self): + export_conandata_patches(self) + + 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["LIBASSERT_USE_EXTERNAL_CPPTRACE"] = True + deps = CMakeDeps(self) + deps.generate() + + 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() + + if self.settings.os == "Windows" and self.options.shared: + copy( + self, + "*.dll", + src=self.build_folder, + dst=os.path.join(self.package_folder, "bin"), + keep_path=False + ) + + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + + def package_info(self): + self.cpp_info.libs = ["assert"] + + self.cpp_info.set_property("cmake_file_name", "libassert") + self.cpp_info.set_property("cmake_target_name", "libassert::assert") + + # the first version of this library used assert/assert as include folder + # appending this one but not removing the default to not break consumers + self.cpp_info.includedirs.append(os.path.join("include", "libassert")) + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "libassert" + self.cpp_info.filenames["cmake_find_package_multi"] = "libassert" + self.cpp_info.names["cmake_find_package"] = "libassert" + self.cpp_info.names["cmake_find_package_multi"] = "libassert" + + self.cpp_info.components["assert"].names["cmake_find_package"] = "assert" + self.cpp_info.components["assert"].names["cmake_find_package_multi"] = "assert" + self.cpp_info.components["assert"].requires = ["cpptrace::cpptrace"] + self.cpp_info.components["assert"].libs = ["assert"] + if not self.options.shared: + self.cpp_info.components["assert"].defines.append("LIBASSERT_STATIC_DEFINE") + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") + self.cpp_info.requires = ["cpptrace::cpptrace"] diff --git a/recipes/libassert/v2/patches/2.0.0/0001-fix-export-and-include.patch b/recipes/libassert/v2/patches/2.0.0/0001-fix-export-and-include.patch new file mode 100644 index 0000000000000..199fdd0350b42 --- /dev/null +++ b/recipes/libassert/v2/patches/2.0.0/0001-fix-export-and-include.patch @@ -0,0 +1,13 @@ +diff --git a/include/libassert/assert-gtest.hpp b/include/libassert/assert-gtest.hpp +index 912da40..57dbc91 100644 +--- a/include/libassert/assert-gtest.hpp ++++ b/include/libassert/assert-gtest.hpp +@@ -6,8 +6,6 @@ + #define LIBASSERT_PREFIX_ASSERTIONS + #include + +-#include "tokenizer.hpp" +- + #if defined(_MSVC_TRADITIONAL) && _MSVC_TRADITIONAL != 0 + #error "Libassert integration does not work with MSVC's non-conformant preprocessor. /Zc:preprocessor must be used." + #endif diff --git a/recipes/libassert/v2/patches/2.0.1/0001-fix-string_view-detection.patch b/recipes/libassert/v2/patches/2.0.1/0001-fix-string_view-detection.patch new file mode 100644 index 0000000000000..ca09e305589b6 --- /dev/null +++ b/recipes/libassert/v2/patches/2.0.1/0001-fix-string_view-detection.patch @@ -0,0 +1,58 @@ +diff --git a/src/microfmt.hpp b/src/microfmt.hpp +index 0f750c3..59f5eea 100644 +--- a/src/microfmt.hpp ++++ b/src/microfmt.hpp +@@ -10,7 +10,7 @@ + #include + #include + #include +-#if defined(__cpp_lib_string_view) && __cpp_lib_string_view >= 201606L ++#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + #include + #endif + #ifdef _MSC_VER +@@ -118,7 +118,7 @@ namespace microfmt { + int64_value, + uint64_value, + string_value, +- #if defined(__cpp_lib_string_view) && __cpp_lib_string_view >= 201606L ++ #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + string_view_value, + #endif + c_string_value, +@@ -128,7 +128,7 @@ namespace microfmt { + std::int64_t int64_value; + std::uint64_t uint64_value; + const std::string* string_value; +- #if defined(__cpp_lib_string_view) && __cpp_lib_string_view >= 201606L ++ #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + std::string_view string_view_value; + #endif + const char* c_string_value; +@@ -147,7 +147,7 @@ namespace microfmt { + format_value(unsigned long int_val) : uint64_value(int_val), value(value_type::uint64_value) {} + format_value(unsigned long long int_val) : uint64_value(int_val), value(value_type::uint64_value) {} + format_value(const std::string& string) : string_value(&string), value(value_type::string_value) {} +- #if defined(__cpp_lib_string_view) && __cpp_lib_string_view >= 201606L ++ #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + format_value(std::string_view sv) : string_view_value(sv), value(value_type::string_view_value) {} + #endif + format_value(const char* c_string) : c_string_value(c_string), value(value_type::c_string_value) {} +@@ -187,7 +187,7 @@ namespace microfmt { + case value_type::string_value: + do_write(out, string_value->begin(), string_value->end(), options); + break; +- #if defined(__cpp_lib_string_view) && __cpp_lib_string_view >= 201606L ++ #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + case value_type::string_view_value: + do_write(out, string_view_value.begin(), string_view_value.end(), options); + break; +@@ -302,7 +302,7 @@ namespace microfmt { + } + } + +- #if defined(__cpp_lib_string_view) && __cpp_lib_string_view >= 201606L ++ #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + template + std::string format(std::string_view fmt, Args&&... args) { + return detail::format(fmt.begin(), fmt.end(), {detail::format_value(args)...}); diff --git a/recipes/libassert/v2/patches/2.1.0/0001-msvc-ice.patch b/recipes/libassert/v2/patches/2.1.0/0001-msvc-ice.patch new file mode 100644 index 0000000000000..5e0ad013faca0 --- /dev/null +++ b/recipes/libassert/v2/patches/2.1.0/0001-msvc-ice.patch @@ -0,0 +1,32 @@ +diff --git a/src/utils.hpp b/src/utils.hpp +index 80b7ca4..18b90e5 100644 +--- a/src/utils.hpp ++++ b/src/utils.hpp +@@ -97,7 +97,8 @@ namespace libassert::detail { + } + }; + +- // note: the use of U here is mainly to workaround a gcc 8 issue https://godbolt.org/z/bdsWhdGj3 ++ #if LIBASSERT_IS_GCC && LIBASSERT_GCC_VERSION < 900 ++ // note: the use of U here is to workaround a gcc 8 issue https://godbolt.org/z/bdsWhdGj3 + template + constexpr std::array, N> to_array_impl(U(&&a)[N], std::index_sequence) { + return {{std::move(a[I])...}}; +@@ -106,6 +107,17 @@ namespace libassert::detail { + constexpr std::array, N> to_array(U(&&a)[N]) { + return to_array_impl(std::move(a), std::make_index_sequence{}); + } ++ #else ++ // unfortunately the above workaround ICEs MSVC https://godbolt.org/z/bjMEcY9fM ++ template ++ constexpr std::array, N> to_array_impl(T(&&a)[N], std::index_sequence) { ++ return {{std::move(a[I])...}}; ++ } ++ template ++ constexpr std::array, N> to_array(T(&&a)[N]) { ++ return to_array_impl(std::move(a), std::make_index_sequence{}); ++ } ++ #endif + + template + constexpr void constexpr_swap(A& a, B& b) { diff --git a/recipes/libassert/v2/test_package/CMakeLists.txt b/recipes/libassert/v2/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..c539de918f22b --- /dev/null +++ b/recipes/libassert/v2/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +add_executable(${PROJECT_NAME} test_package.cpp) + +find_package(libassert REQUIRED CONFIG) +target_link_libraries(${PROJECT_NAME} PRIVATE libassert::assert) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/libassert/v2/test_package/conanfile.py b/recipes/libassert/v2/test_package/conanfile.py new file mode 100644 index 0000000000000..a804618d0f86f --- /dev/null +++ b/recipes/libassert/v2/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): + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libassert/v2/test_package/test_package.cpp b/recipes/libassert/v2/test_package/test_package.cpp new file mode 100644 index 0000000000000..2b1f1ea26d9ee --- /dev/null +++ b/recipes/libassert/v2/test_package/test_package.cpp @@ -0,0 +1,22 @@ +#include +#include +#include + +int main(void) { + std::cout << "Testing libassert\n"; + + libassert::set_failure_handler([](const libassert::assertion_info& info) { + std::cerr<=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/config.yml b/recipes/libatomic_ops/config.yml index c989c79eb8c41..03c7395ab6c04 100644 --- a/recipes/libatomic_ops/config.yml +++ b/recipes/libatomic_ops/config.yml @@ -1,3 +1,3 @@ versions: - "7.6.14": + "7.8.2": folder: all diff --git a/recipes/libattr/all/conandata.yml b/recipes/libattr/all/conandata.yml index af8ff8f208c73..186ef69a97394 100644 --- a/recipes/libattr/all/conandata.yml +++ b/recipes/libattr/all/conandata.yml @@ -1,4 +1,4 @@ sources: "2.5.1": url: "http://download.savannah.nongnu.org/releases/attr/attr-2.5.1.tar.gz" - sha256: "BAE1C6949B258A0D68001367CE0C741CEBDACDD3B62965D17E5EB23CD78ADAF8" + sha256: "bae1c6949b258a0d68001367ce0c741cebdacdd3b62965d17e5eb23cd78adaf8" diff --git a/recipes/libattr/all/conanfile.py b/recipes/libattr/all/conanfile.py index 4019c132ebbba..8e2a7e6466753 100644 --- a/recipes/libattr/all/conanfile.py +++ b/recipes/libattr/all/conanfile.py @@ -1,109 +1,69 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import copy, get, mkdir, rename, rm, rmdir +from conan.tools.gnu import Autotools, 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 LibAttrConan(ConanFile): name = "libattr" description = "Commands for Manipulating Filesystem Extended Attributes" - topics = ("conan", "attr", "filesystem") + topics = ("attr", "filesystem") license = "GPL-2.0-or-later" homepage = "https://savannah.nongnu.org/projects/attr/" 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, } - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" - @property - def _pkg_etc(self): - return os.path.join( - self.package_folder, - "etc" - ) - - @property - def _pkg_res(self): - return os.path.join( - self.package_folder, - "res" - ) + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") - @property - def _doc_folder(self): - return os.path.join( - self._source_subfolder, - "doc" - ) + def layout(self): + basic_layout(self, src_folder="src") def validate(self): if self.settings.os != "Linux": - raise ConanInvalidConfiguration( - "libattr 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 + raise ConanInvalidConfiguration("libattr is just supported on Linux") 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, win_bash=tools.os_info.is_windows) - conf_args = [ - "--prefix={}".format(tools.unix_path(self.package_folder)), - "--bindir={}".format(tools.unix_path( - os.path.join(self.package_folder, "bin"))), - "--libdir={}".format(tools.unix_path( - os.path.join(self.package_folder, "lib"))) - ] - 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) - return self._autotools + def generate(self): + tc = AutotoolsToolchain(self) + tc.generate() def build(self): - with tools.chdir(self._source_subfolder): - autotools = self._configure_autotools() - autotools.make() + autotools = Autotools(self) + autotools.configure() + autotools.make() def package(self): - with tools.chdir(self._source_subfolder): - autotools = self._configure_autotools() - autotools.install() - tools.mkdir(self._pkg_res) - tools.rename( - os.path.join(self._pkg_etc, "xattr.conf"), - os.path.join(self._pkg_res, "xattr.conf") - ) - 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")) - tools.rmdir(os.path.join(self.package_folder, "etc")) - + copy(self, "COPYING", src=os.path.join(self.source_folder, "doc"), dst=os.path.join(self.package_folder, "licenses")) + 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")) + rmdir(self, os.path.join(self.package_folder, "share")) + mkdir(self, os.path.join(self.package_folder, "res")) + rename(self, os.path.join(self.package_folder, "etc", "xattr.conf"), + os.path.join(self.package_folder, "res", "xattr.conf")) + rmdir(self, os.path.join(self.package_folder, "etc")) + def package_info(self): - self.cpp_info.names["pkg_config"] = "libattr" - self.cpp_info.names["cmake_find_package"] = "libattr" - self.cpp_info.names["cmake_find_package_multi"] = "libattr" + self.cpp_info.set_property("pkg_config_name", "libattr") self.cpp_info.libs = ["attr"] + self.cpp_info.resdirs = ["res"] diff --git a/recipes/libattr/all/test_package/CMakeLists.txt b/recipes/libattr/all/test_package/CMakeLists.txt index 3024422845688..731d92a3c2e3b 100644 --- a/recipes/libattr/all/test_package/CMakeLists.txt +++ b/recipes/libattr/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(${PROJECT_NAME} example.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +find_package(libattr REQUIRED CONFIG) +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE libattr::libattr) diff --git a/recipes/libattr/all/test_package/conanfile.py b/recipes/libattr/all/test_package/conanfile.py index b1340e4df3916..0a6bc68712d90 100644 --- a/recipes/libattr/all/test_package/conanfile.py +++ b/recipes/libattr/all/test_package/conanfile.py @@ -1,15 +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): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libattr/all/test_package/example.cpp b/recipes/libattr/all/test_package/example.cpp deleted file mode 100644 index 8cf42fee6329a..0000000000000 --- a/recipes/libattr/all/test_package/example.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include -#include - -int main(int argc, char* argv[]) -{ - char value[255]; - int len = sizeof(value); - const char *path = "file_not_exist.txt"; - const char *attr = "attr_not_exist"; - attr_get(path, attr, value, &len, 0); - return 0; -} diff --git a/recipes/libattr/all/test_package/test_package.c b/recipes/libattr/all/test_package/test_package.c new file mode 100644 index 0000000000000..23f2ef2fb85c1 --- /dev/null +++ b/recipes/libattr/all/test_package/test_package.c @@ -0,0 +1,12 @@ +#include +#include + +int main(int argc, char* argv[]) +{ + char value[255]; + int len = sizeof(value); + const char *path = "file_not_exist.txt"; + const char *attr = "attr_not_exist"; + attr_get(path, attr, value, &len, 0); + return 0; +} diff --git a/recipes/libattr/all/test_v1_package/CMakeLists.txt b/recipes/libattr/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libattr/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libattr/all/test_v1_package/conanfile.py b/recipes/libattr/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libattr/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/all/conandata.yml b/recipes/libavif/all/conandata.yml index 1889bd2ede18f..7d4af07ae59e6 100644 --- a/recipes/libavif/all/conandata.yml +++ b/recipes/libavif/all/conandata.yml @@ -1,4 +1,22 @@ sources: + "1.1.1": + url: "https://github.com/AOMediaCodec/libavif/archive/refs/tags/v1.1.1.tar.gz" + sha256: "914662e16245e062ed73f90112fbb4548241300843a7772d8d441bb6859de45b" + "1.1.0": + url: "https://github.com/AOMediaCodec/libavif/archive/refs/tags/v1.1.0.tar.gz" + sha256: "edb31951005d7a143be1724f24825809599a4832073add50eaf987733defb5c8" + "1.0.4": + url: "https://github.com/AOMediaCodec/libavif/archive/refs/tags/v1.0.4.tar.gz" + sha256: "dc56708c83a4b934a8af2b78f67f866ba2fb568605c7cf94312acf51ee57d146" + "1.0.3": + url: "https://github.com/AOMediaCodec/libavif/archive/refs/tags/v1.0.3.tar.gz" + sha256: "35e3cb3cd7158209dcc31d3bf222036de5b9597e368a90e18449ecc89bb86a19" + "1.0.2": + url: "https://github.com/AOMediaCodec/libavif/archive/refs/tags/v1.0.2.tar.gz" + sha256: "de8bf79488c5b523b77358df8b85ae69c3078e6b3f1636fc1f313f952269ad20" + "1.0.1": + url: "https://github.com/AOMediaCodec/libavif/archive/refs/tags/v1.0.1.tar.gz" + sha256: "398fe7039ce35db80fe7da8d116035924f2c02ea4a4aa9f4903df6699287599c" "0.11.1": url: "https://github.com/AOMediaCodec/libavif/archive/refs/tags/v0.11.1.tar.gz" sha256: "0eb49965562a0e5e5de58389650d434cff32af84c34185b6c9b7b2fccae06d4e" @@ -6,6 +24,30 @@ sources: url: "https://github.com/AOMediaCodec/libavif/archive/refs/tags/v0.9.3.tar.gz" sha256: "bcd9a1f57f982a9615eb7e2faf87236dc88eb1d0c886f3471c7440ead605060d" patches: + "1.1.1": + - patch_file: patches/1.1.1-0001-disable-developer-only-codepaths.patch + patch_description: "disable compiler options for develop" + patch_type: "portability" + "1.1.0": + - patch_file: patches/1.1.0-0001-disable-developer-only-codepaths.patch + patch_description: "disable compiler options for develop" + patch_type: "portability" + "1.0.4": + - patch_file: patches/1.0.1-0001-disable-developer-only-codepaths.patch + patch_description: "disable compiler options for develop" + patch_type: "portability" + "1.0.3": + - patch_file: patches/1.0.1-0001-disable-developer-only-codepaths.patch + patch_description: "disable compiler options for develop" + patch_type: "portability" + "1.0.2": + - patch_file: patches/1.0.1-0001-disable-developer-only-codepaths.patch + patch_description: "disable compiler options for develop" + patch_type: "portability" + "1.0.1": + - patch_file: patches/1.0.1-0001-disable-developer-only-codepaths.patch + patch_description: "disable compiler options for develop" + patch_type: "portability" "0.11.1": - patch_file: patches/0.11.1-0001-disable-developer-only-codepaths.patch patch_description: "disable compiler options for develop" diff --git a/recipes/libavif/all/conanfile.py b/recipes/libavif/all/conanfile.py index 9c967ac3bf425..f9c0bcaec2901 100644 --- a/recipes/libavif/all/conanfile.py +++ b/recipes/libavif/all/conanfile.py @@ -1,10 +1,13 @@ 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.scm import Version +from conan.tools.env import VirtualBuildEnv import os import textwrap -required_conan_version = ">=1.53.0" +required_conan_version = ">=1.54.0" class LibAVIFConan(ConanFile): @@ -13,25 +16,44 @@ class LibAVIFConan(ConanFile): license = "BSD-2-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/AOMediaCodec/libavif" - topics = "avif" + topics = ("avif",) + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], "with_decoder": ["aom", "dav1d"], + "with_ycgco_r": [True, False], + "with_gain_map": [True, False], + "with_metav1": [True, False], + "with_sample_transform": [True, False], } default_options = { "shared": False, "fPIC": True, "with_decoder": "dav1d", + "with_ycgco_r": False, + "with_gain_map": False, + "with_metav1": False, + "with_sample_transform": False, } + @property + def _depends_on_sharpyuv(self): + return Version(self.version) >= "0.11.0" + def export_sources(self): export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + if Version(self.version) < "1.0.0": + del self.options.with_ycgco_r + if Version(self.version) < "1.1.0": + del self.options.with_gain_map + del self.options.with_metav1 + del self.options.with_sample_transform def configure(self): if self.options.shared: @@ -47,14 +69,22 @@ def _has_dav1d(self): return self.options.with_decoder == "dav1d" def requirements(self): - self.requires("libaom-av1/3.5.0") - self.requires("libyuv/1845") + self.requires("libaom-av1/3.6.1") + self.requires("libyuv/1854") if self._has_dav1d: - self.requires("dav1d/1.0.0") + self.requires("dav1d/1.2.1") + if self._depends_on_sharpyuv: + self.requires("libwebp/1.3.2") + + def validate(self): + if self._depends_on_sharpyuv and Version(self.dependencies["libwebp"].ref.version) < "1.3.0": + raise ConanInvalidConfiguration(f"{self.ref} requires libwebp >= 1.3.0 in order to get libsharpyuv") + + def build_requirements(self): + self.tool_requires("cmake/[>=3.19 <4]") 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) @@ -63,21 +93,33 @@ def generate(self): 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" + if "with_ycgco_r" in self.options: + tc.variables["AVIF_ENABLE_EXPERIMENTAL_YCGCO_R"] = self.options.with_ycgco_r + if "with_gain_map" in self.options: + tc.variables["AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP"] = self.options.with_gain_map + if "with_metav1" in self.options: + tc.variables["AVIF_ENABLE_EXPERIMENTAL_METAV1"] = self.options.with_metav1 + if "with_sample_transform" in self.options: + tc.variables["AVIF_ENABLE_EXPERIMENTAL_SAMPLE_TRANSFORM"] = self.options.with_sample_transform tc.generate() deps = CMakeDeps(self) + if Version(self.version) >= "1.1.0": + deps.set_property("libyuv", "cmake_target_name", "yuv::yuv") deps.generate() + venv = VirtualBuildEnv(self) + venv.generate(scope="build") + 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") + if Version(self.version) < "1.1.0": + 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") def build(self): self._patch_sources() @@ -110,10 +152,6 @@ def package(self): save(self, alias, content) def package_info(self): - self.cpp_info.requires = ["libyuv::libyuv", "libaom-av1::libaom-av1"] - if self._has_dav1d: - self.cpp_info.requires.append("dav1d::dav1d") - self.cpp_info.libs = ["avif"] if self.options.shared: self.cpp_info.defines = ["AVIF_DLL"] @@ -122,6 +160,12 @@ def package_info(self): if self._has_dav1d: self.cpp_info.system_libs.append("dl") + self.cpp_info.requires = ["libyuv::libyuv", "libaom-av1::libaom-av1"] + if self._has_dav1d: + self.cpp_info.requires.append("dav1d::dav1d") + if self._depends_on_sharpyuv: + self.cpp_info.requires.append("libwebp::sharpyuv") + 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") diff --git a/recipes/libavif/all/patches/1.0.1-0001-disable-developer-only-codepaths.patch b/recipes/libavif/all/patches/1.0.1-0001-disable-developer-only-codepaths.patch new file mode 100644 index 0000000000000..9bedacfdc3b86 --- /dev/null +++ b/recipes/libavif/all/patches/1.0.1-0001-disable-developer-only-codepaths.patch @@ -0,0 +1,34 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 1f0cde1..4ad03b6 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -70,11 +70,13 @@ if(AVIF_LOCAL_LIBGAV1) + enable_language(CXX) + endif() + ++if(0) + if(APPLE) + set(XCRUN xcrun) + else() + set(XCRUN) + endif() ++endif() + + if(BUILD_SHARED_LIBS) + set(AVIF_LIBRARY_PREFIX "${CMAKE_SHARED_LIBRARY_PREFIX}") +@@ -209,6 +211,7 @@ else(libsharpyuv_FOUND) + endif(libsharpyuv_FOUND) + # --------------------------------------------------------------------------------------- + ++if(0) + # Enable all warnings + include(CheckCCompilerFlag) + if(CMAKE_C_COMPILER_ID MATCHES "Clang") +@@ -257,6 +260,7 @@ if(AVIF_ENABLE_COVERAGE) + message(WARNING "libavif: Ignoring request for coverage (AVIF_ENABLE_COVERAGE); only clang is currently supported.") + endif() + endif() ++endif() + + if(AVIF_ENABLE_EXPERIMENTAL_YCGCO_R) + add_compile_definitions(AVIF_ENABLE_EXPERIMENTAL_YCGCO_R) diff --git a/recipes/libavif/all/patches/1.1.0-0001-disable-developer-only-codepaths.patch b/recipes/libavif/all/patches/1.1.0-0001-disable-developer-only-codepaths.patch new file mode 100644 index 0000000000000..205b84f1dcbf0 --- /dev/null +++ b/recipes/libavif/all/patches/1.1.0-0001-disable-developer-only-codepaths.patch @@ -0,0 +1,38 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index bc478ae..1b2229d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -137,13 +137,13 @@ if(AVIF_BUILD_APPS + ) + set(AVIF_USE_CXX ON) + endif() +- ++if(0) + if(APPLE) + set(XCRUN xcrun) + else() + set(XCRUN) + endif() +- ++endif() + # This is also needed to get shared libraries (e.g. pixbufloader-avif) to compile against a static libavif. + set(CMAKE_POSITION_INDEPENDENT_CODE ON) + if(BUILD_SHARED_LIBS) +@@ -260,7 +260,7 @@ if(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) + check_avif_option(AVIF_LIBXML2 TARGET LibXml2::LibXml2 PKG_NAME LibXml2) + endif() + # --------------------------------------------------------------------------------------- +- ++if(0) + # Enable all warnings + include(CheckCCompilerFlag) + if(CMAKE_C_COMPILER_ID MATCHES "Clang") +@@ -290,7 +290,7 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "MSVC") + else() + message(FATAL_ERROR "libavif: Unknown compiler, bailing out") + endif() +- ++endif() + if(AVIF_ENABLE_WERROR) + # Warnings as errors + if(CMAKE_C_COMPILER_ID MATCHES "Clang" OR CMAKE_C_COMPILER_ID MATCHES "GNU") diff --git a/recipes/libavif/all/patches/1.1.1-0001-disable-developer-only-codepaths.patch b/recipes/libavif/all/patches/1.1.1-0001-disable-developer-only-codepaths.patch new file mode 100644 index 0000000000000..00825d66fdb2c --- /dev/null +++ b/recipes/libavif/all/patches/1.1.1-0001-disable-developer-only-codepaths.patch @@ -0,0 +1,38 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index baf5964..dc3704e 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -147,13 +147,13 @@ option(AVIF_LOCAL_FUZZTEST + + # Whether the libavif library uses c++ indirectly (e.g. through linking to libyuv). + set(AVIF_LIB_USE_CXX OFF) +- ++if(0) + if(APPLE) + set(XCRUN xcrun) + else() + set(XCRUN) + endif() +- ++endif() + # This is also needed to get shared libraries (e.g. pixbufloader-avif) to compile against a static libavif. + set(CMAKE_POSITION_INDEPENDENT_CODE ON) + if(BUILD_SHARED_LIBS) +@@ -269,7 +269,7 @@ if(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) + check_avif_option(AVIF_LIBXML2 TARGET LibXml2::LibXml2 PKG_NAME LibXml2) + endif() + # --------------------------------------------------------------------------------------- +- ++if(0) + # Enable all warnings + include(CheckCCompilerFlag) + if(MSVC) +@@ -310,7 +310,7 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "GNU") + else() + message(FATAL_ERROR "libavif: Unknown compiler, bailing out") + endif() +- ++endif() + if(AVIF_ENABLE_WERROR) + # Warnings as errors + if(MSVC) diff --git a/recipes/libavif/config.yml b/recipes/libavif/config.yml index f3e6d6038f1fa..d8cfe5a49c15a 100644 --- a/recipes/libavif/config.yml +++ b/recipes/libavif/config.yml @@ -1,4 +1,16 @@ versions: + "1.1.1": + folder: all + "1.1.0": + folder: all + "1.0.4": + folder: all + "1.0.3": + folder: all + "1.0.2": + folder: all + "1.0.1": + folder: all "0.11.1": folder: all "0.9.3": 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..4431ba3942fec 100644 --- a/recipes/libavrocpp/all/conandata.yml +++ b/recipes/libavrocpp/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "1.11.3": + url: "https://github.com/apache/avro/archive/release-1.11.3.tar.gz" + sha256: "da377ac1cf8b91458bf702cbcfb214eecb5c399b267f0ca9c0aade6cabaf126e" + "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 +15,75 @@ sources: url: "https://github.com/apache/avro/archive/release-1.10.1.tar.gz" sha256: "8fd1f850ce37e60835e6d8335c0027a959aaa316773da8a9660f7d33a66ac142" patches: + "1.11.3": + - 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/0006-disable-warn-as-error-1-11-3.patch" + patch_description: "disable warn as error for boost c++14 breaking change" + patch_type: "portability" + "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..e0658c9cdfa87 100644 --- a/recipes/libavrocpp/all/conanfile.py +++ b/recipes/libavrocpp/all/conanfile.py @@ -1,41 +1,37 @@ +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, valid_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") + package_type = "library" 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 +39,68 @@ 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") + self.options.rm_safe("fPIC") + def layout(self): + cmake_layout(self, src_folder="src") + def requirements(self): - self.requires("boost/1.78.0") + # boost upper to 1.81.0 requires C++14 minimum + self.requires("boost/1.81.0", transitive_headers=True) 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/patches/0006-disable-warn-as-error-1-11-3.patch b/recipes/libavrocpp/all/patches/0006-disable-warn-as-error-1-11-3.patch new file mode 100644 index 0000000000000..711abad6d4b00 --- /dev/null +++ b/recipes/libavrocpp/all/patches/0006-disable-warn-as-error-1-11-3.patch @@ -0,0 +1,13 @@ +diff --git a/lang/c++/CMakeLists.txt b/lang/c++/CMakeLists.txt +index 52d6ac8a..26d8d146 100644 +--- a/lang/c++/CMakeLists.txt ++++ b/lang/c++/CMakeLists.txt +@@ -59,7 +59,7 @@ if (WIN32 AND NOT CYGWIN AND NOT MSYS) + endif() + + if (CMAKE_COMPILER_IS_GNUCXX) +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Werror") ++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic") + if (AVRO_ADD_PROTECTOR_FLAGS) + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fstack-protector-all -D_GLIBCXX_DEBUG") + # Unset _GLIBCXX_DEBUG for avrogencpp.cc because using Boost Program Options 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..c159828f2eb37 100644 --- a/recipes/libavrocpp/config.yml +++ b/recipes/libavrocpp/config.yml @@ -1,4 +1,8 @@ versions: + 1.11.3: + folder: all + 1.11.1: + folder: all 1.11.0: folder: all 1.10.2: diff --git a/recipes/libb2/all/CMakeLists.txt b/recipes/libb2/all/CMakeLists.txt index ba9b7e9e27948..9834b369a4d4b 100644 --- a/recipes/libb2/all/CMakeLists.txt +++ b/recipes/libb2/all/CMakeLists.txt @@ -1,9 +1,6 @@ -cmake_minimum_required(VERSION 3.4) +cmake_minimum_required(VERSION 3.12) project(b2 C) -include("conanbuildinfo.cmake") -conan_basic_setup() - if(WIN32 AND BUILD_SHARED_LIBS AND MSVC) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) endif() @@ -11,38 +8,40 @@ endif() option(USE_SSE "Optimized for speed on CPUs supporting SSE2, SSSE3, SSE4.1, AVX, or XOP" OFF) option(USE_NEON "Optimiced for arm CPUs" OFF) +set(src ${CMAKE_CURRENT_LIST_DIR}/src) + if (USE_NEON) message(STATUS "Using neon sources") - set(SOURCE_FILES source_subfolder/neon/blake2b-neon.c - source_subfolder/neon/blake2bp.c - source_subfolder/neon/blake2s-neon.c - source_subfolder/neon/blake2xb.c - source_subfolder/neon/blake2sp.c - source_subfolder/neon/blake2xs.c) + set(SOURCE_FILES ${src}/neon/blake2b-neon.c + ${src}/neon/blake2bp.c + ${src}/neon/blake2s-neon.c + ${src}/neon/blake2xb.c + ${src}/neon/blake2sp.c + ${src}/neon/blake2xs.c) elseif (USE_SSE) message(STATUS "Using sse sources") - set(SOURCE_FILES source_subfolder/sse/blake2b.c - source_subfolder/sse/blake2bp.c - source_subfolder/sse/blake2s.c - source_subfolder/sse/blake2sp.c - source_subfolder/sse/blake2xb.c - source_subfolder/sse/blake2xs.c) + set(SOURCE_FILES ${src}/sse/blake2b.c + ${src}/sse/blake2bp.c + ${src}/sse/blake2s.c + ${src}/sse/blake2sp.c + ${src}/sse/blake2xb.c + ${src}/sse/blake2xs.c) else () message(STATUS "Using ref sources") - set(SOURCE_FILES source_subfolder/ref/blake2bp-ref.c - source_subfolder/ref/blake2b-ref.c - source_subfolder/ref/blake2sp-ref.c - source_subfolder/ref/blake2s-ref.c - source_subfolder/ref/blake2xb-ref.c - source_subfolder/ref/blake2xs-ref.c) + set(SOURCE_FILES ${src}/ref/blake2bp-ref.c + ${src}/ref/blake2b-ref.c + ${src}/ref/blake2sp-ref.c + ${src}/ref/blake2s-ref.c + ${src}/ref/blake2xb-ref.c + ${src}/ref/blake2xs-ref.c) endif() add_library(${CMAKE_PROJECT_NAME} ${SOURCE_FILES}) -set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES PUBLIC_HEADER source_subfolder/ref/blake2.h) +set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES PUBLIC_HEADER ${src}/ref/blake2.h) +include(GNUInstallDirs) install(TARGETS ${CMAKE_PROJECT_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libb2 - ) + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libb2) diff --git a/recipes/libb2/all/conanfile.py b/recipes/libb2/all/conanfile.py index 88ad67891d73b..ffc67ff6345fe 100644 --- a/recipes/libb2/all/conanfile.py +++ b/recipes/libb2/all/conanfile.py @@ -1,65 +1,83 @@ import os -import glob -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 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 libb2Conan(ConanFile): name = "libb2" + description = ( + "libb2 is a library that implements the BLAKE2 cryptographic hash function, which is faster than MD5, " + "SHA-1, SHA-2, and SHA-3, yet is at least as secure as the latest standard SHA-3" + ) license = ["CC0-1.0", "OpenSSL", "APSL-2.0"] url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/BLAKE2/BLAKE2" - description = ("libb2 is a library that implemets the BLAKE2 cryptographic hash function, which is faster than MD5, \ - SHA-1, SHA-2, and SHA-3, yet is at least as secure as the latest standard SHA-3") + topics = ("blake2", "hash") + + package_type = "library" settings = "os", "arch", "compiler", "build_type" - topics = ("conan", "blake2", "hash") - exports_sources = ["CMakeLists.txt"] - generators = ["cmake"] - options = {"fPIC": [True, False], "shared": [True, False], "use_sse": [True, False], "use_neon": [True, False]} - default_options = {"fPIC": True, "shared": False, "use_sse": False, "use_neon": False} - _cmake = None + options = { + "shared": [True, False], + "fPIC": [True, False], + "use_sse": [True, False], + "use_neon": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "use_sse": False, + "use_neon": False, + } - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder) - @property - def _build_subfolder(self): - return "build_subfolder" + 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.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) if self.options.use_neon and not "arm" in self.settings.arch: raise ConanInvalidConfiguration("Neon sources only supported on arm-based CPUs") if self.options.use_neon and self.options.use_sse: raise ConanInvalidConfiguration("Neon and SSE can not be used together.") - def config_options(self): - if self.settings.os == "Windows": - del self.options.fPIC - def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = glob.glob("BLAKE2-*")[0] - os.rename(extracted_dir, 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.definitions["USE_SSE"] = self.options.use_sse - self._cmake.definitions["USE_NEON"] = self.options.use_neon - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["USE_SSE"] = self.options.use_sse + tc.variables["USE_NEON"] = self.options.use_neon + tc.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=self.export_sources_folder) cmake.build() def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") - 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.includedirs = ["include", os.path.join("include","libb2")] + self.cpp_info.libs = ["b2"] + self.cpp_info.includedirs = ["include", os.path.join("include", "libb2")] diff --git a/recipes/libb2/all/test_package/CMakeLists.txt b/recipes/libb2/all/test_package/CMakeLists.txt index 6aab347eddf53..a422f3ac0c116 100644 --- a/recipes/libb2/all/test_package/CMakeLists.txt +++ b/recipes/libb2/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(PackageTest CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(libb2 REQUIRED CONFIG) add_executable(example example.cpp) -target_link_libraries(example ${CONAN_LIBS}) +target_link_libraries(example libb2::libb2) set_property(TARGET example PROPERTY CXX_STANDARD 11) diff --git a/recipes/libb2/all/test_package/conanfile.py b/recipes/libb2/all/test_package/conanfile.py index 0383b1729b064..8d52b7021efe1 100644 --- a/recipes/libb2/all/test_package/conanfile.py +++ b/recipes/libb2/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 blake2TestConan(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) @@ -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.bindir, "example") + self.run(bin_path, env="conanrun") diff --git a/recipes/libb2/all/test_v1_package/CMakeLists.txt b/recipes/libb2/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/libb2/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/libb2/all/test_v1_package/conanfile.py b/recipes/libb2/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..24ecc57793dc6 --- /dev/null +++ b/recipes/libb2/all/test_v1_package/conanfile.py @@ -0,0 +1,16 @@ +import os +from conans import ConanFile, CMake, tools + +class blake2TestConan(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", "example") + self.run(bin_path, run_environment=True) diff --git a/recipes/libbacktrace/all/conandata.yml b/recipes/libbacktrace/all/conandata.yml index 56d79ce7402eb..7aec17549ec3c 100644 --- a/recipes/libbacktrace/all/conandata.yml +++ b/recipes/libbacktrace/all/conandata.yml @@ -1,8 +1,22 @@ sources: + "cci.20240730": + url: "https://github.com/ianlancetaylor/libbacktrace/archive/0dd27b95f9f2c11b4a89db5f185a888af912838e.tar.gz" + sha256: "dfbc52012846c57759eaaa5131c329c43f77695c808b3e1847ec2dacce238c35" "cci.20210118": url: "https://github.com/ianlancetaylor/libbacktrace/archive/dedbe13fda00253fe5d4f2fb812c909729ed5937.tar.gz" sha256: "dc8c167f48f3de5ae318c528b26b72f300edb6e33744e55394674fd4b7cdd21d" patches: + "cci.20240730": + - patch_file: "patches/cci.20240719-0001-pointer-arithmetic.patch" + patch_description: "casting pointer types for pointer arithmetics" + patch_type: "portability" + - patch_file: "patches/0002-msvc-unistd-alternative.patch" + patch_description: "support msvc for codes using unistd.h" + patch_type: "portability" "cci.20210118": - patch_file: "patches/0001-pointer-arithmetic.patch" + patch_description: "casting pointer types for pointer arithmetics" + patch_type: "portability" - patch_file: "patches/0002-msvc-unistd-alternative.patch" + patch_description: "support msvc for codes using unistd.h" + patch_type: "portability" diff --git a/recipes/libbacktrace/all/conanfile.py b/recipes/libbacktrace/all/conanfile.py index c0bdadcedebed..fd0cc977d3ab2 100644 --- a/recipes/libbacktrace/all/conanfile.py +++ b/recipes/libbacktrace/all/conanfile.py @@ -1,23 +1,24 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration from conan.tools.apple import fix_apple_shared_install_name -from conan.tools.env import Environment, VirtualBuildEnv +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.53.0" +required_conan_version = ">=1.54.0" class LibbacktraceConan(ConanFile): name = "libbacktrace" description = "A C library that may be linked into a C/C++ program to produce symbolic backtraces." + license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" 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], @@ -32,10 +33,6 @@ class LibbacktraceConan(ConanFile): 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) @@ -54,20 +51,19 @@ def layout(self): def validate(self): check_min_vs(self, "180") - if is_msvc(self) and self.info.options.shared: - raise ConanInvalidConfiguration("libbacktrace shared is not supported with Visual Studio") + if is_msvc(self) and self.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} shared is not supported with Visual Studio") 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=bool): + 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): - 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) @@ -77,12 +73,10 @@ def generate(self): if is_msvc(self): # https://github.com/conan-io/conan/issues/6514 tc.extra_cflags.append("-FS") - tc.generate() - + env = tc.environment() 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) + 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") @@ -91,7 +85,7 @@ def generate(self): env.define("OBJDUMP", ":") env.define("RANLIB", ":") env.define("STRIP", ":") - env.vars(self).save_script("conanbuild_libbacktrace_msvc") + tc.generate(env) def build(self): apply_conandata_patches(self) @@ -102,8 +96,7 @@ def build(self): def package(self): copy(self, "LICENSE", 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)}"]) + autotools.install() lib_folder = os.path.join(self.package_folder, "lib") rm(self, "*.la", lib_folder) fix_apple_shared_install_name(self) diff --git a/recipes/libbacktrace/all/patches/cci.20240719-0001-pointer-arithmetic.patch b/recipes/libbacktrace/all/patches/cci.20240719-0001-pointer-arithmetic.patch new file mode 100644 index 0000000000000..dbf4fb3485b67 --- /dev/null +++ b/recipes/libbacktrace/all/patches/cci.20240719-0001-pointer-arithmetic.patch @@ -0,0 +1,31 @@ +diff --git a/pecoff.c b/pecoff.c +index 636e1b1..975e417 100644 +--- a/pecoff.c ++++ b/pecoff.c +@@ -704,7 +704,7 @@ coff_add (struct backtrace_state *state, int descriptor, + magic_ok = memcmp (magic, "PE\0", 4) == 0; + fhdr_off += 4; + +- memcpy (&fhdr, fhdr_view.data + 4, sizeof fhdr); ++ memcpy (&fhdr, (char*)fhdr_view.data + 4, sizeof fhdr); + } + else + { +@@ -738,7 +738,7 @@ coff_add (struct backtrace_state *state, int descriptor, + sects_view_valid = 1; + opt_hdr = (const b_coff_optional_header *) sects_view.data; + sects = (const b_coff_section_header *) +- (sects_view.data + fhdr.size_of_optional_header); ++ ((b_coff_optional_header *)sects_view.data + fhdr.size_of_optional_header); + + is_64 = 0; + memset (&image_base, 0, sizeof image_base); +@@ -781,7 +781,7 @@ coff_add (struct backtrace_state *state, int descriptor, + goto fail; + syms_view_valid = 1; + +- str_size = coff_read4 (syms_view.data + syms_size); ++ str_size = coff_read4 ((const unsigned char *)((char *)syms_view.data + syms_size)); + + str_off = syms_off + syms_size; + diff --git a/recipes/libbacktrace/all/test_v1_package/CMakeLists.txt b/recipes/libbacktrace/all/test_v1_package/CMakeLists.txt index ee84a5e843025..0d20897301b68 100644 --- a/recipes/libbacktrace/all/test_v1_package/CMakeLists.txt +++ b/recipes/libbacktrace/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(libbacktrace REQUIRED CONFIG) - -add_executable(test_package ../test_package/test_package.c) -target_link_libraries(test_package PRIVATE libbacktrace::libbacktrace) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libbacktrace/config.yml b/recipes/libbacktrace/config.yml index bc0e7ddecd921..952bd0433d7d5 100644 --- a/recipes/libbacktrace/config.yml +++ b/recipes/libbacktrace/config.yml @@ -1,3 +1,5 @@ versions: + "cci.20240730": + folder: all "cci.20210118": folder: all diff --git a/recipes/libbasisu/all/CMakeLists.txt b/recipes/libbasisu/all/CMakeLists.txt deleted file mode 100644 index bd4164cb5c1c7..0000000000000 --- a/recipes/libbasisu/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/libbasisu/all/conandata.yml b/recipes/libbasisu/all/conandata.yml index 7cca98d66479b..7f4a8cfdd695f 100644 --- a/recipes/libbasisu/all/conandata.yml +++ b/recipes/libbasisu/all/conandata.yml @@ -5,4 +5,3 @@ sources: patches: "1.15.0": - patch_file: "patches/cmakelist_build_lib.patch" - base_path: "source_subfolder" diff --git a/recipes/libbasisu/all/conanfile.py b/recipes/libbasisu/all/conanfile.py index 6dfaf4ee7f3de..2c8606aca448a 100644 --- a/recipes/libbasisu/all/conanfile.py +++ b/recipes/libbasisu/all/conanfile.py @@ -1,114 +1,133 @@ import os -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -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, 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 +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" class LibBasisUniversalConan(ConanFile): name = "libbasisu" description = "Basis Universal Supercompressed GPU Texture Codec" - homepage = "https://github.com/BinomialLLC/basis_universal" - topics = ("conan", "basis", "textures", "compression") - url = "https://github.com/conan-io/conan-center-index" license = "Apache-2.0" - exports_sources = ["CMakeLists.txt", "patches/*"] - generators = "cmake" - settings = "os", "compiler", "build_type", "arch" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/BinomialLLC/basis_universal" + topics = ("basis", "textures", "compression") + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { - "fPIC": [True, False], "shared": [True, False], + "fPIC": [True, False], "use_sse4": [True, False], "with_zstd": [True, False], "enable_encoder": [True, False], - "custom_iterator_debug_level": [True, False] + "custom_iterator_debug_level": [True, False], } default_options = { - "fPIC": True, "shared": False, + "fPIC": True, "use_sse4": False, "with_zstd": True, "enable_encoder": True, - "custom_iterator_debug_level": False + "custom_iterator_debug_level": False, } - _cmake = None + def _minimum_compiler_version(self): + return { + "Visual Studio": "15", + "gcc": "5.4", + "clang": "3.9", + "apple-clang": "10", + } - @property - def _source_subfolder(self): - return "source_subfolder" + def _use_custom_iterator_debug_level(self): + return self.options.get_safe("custom_iterator_debug_level", + default=self.default_options["custom_iterator_debug_level"]) - @property - def _build_subfolder(self): - return "build_subfolder" + def export_sources(self): + export_conandata_patches(self) - def _use_custom_iterator_debug_level(self): - return self.options.get_safe("custom_iterator_debug_level", default=self.default_options["custom_iterator_debug_level"]) - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - if self.settings.compiler != "Visual Studio": - del self.options.custom_iterator_debug_level + if not is_msvc(self): + self.options.rm_safe("custom_iterator_debug_level") - def _minimum_compiler_version(self) -> bool: - return { - "Visual Studio": "15", - "gcc": "5.4", - "clang": "3.9", - "apple-clang": "10" - } + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def requirements(self): + if self.options.with_zstd: + self.requires("zstd/1.5.5") + + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): min_version = self._minimum_compiler_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)) - elif tools.Version(self.settings.compiler.version) < min_version: - raise ConanInvalidConfiguration("{} {} does not support compiler with version {} {}, minimum supported compiler version is {} ".format(self.name, self.version, self.settings.compiler, self.settings.compiler.version, min_version)) + self.output.warning( + f"{self.name} recipe lacks information about the {self.settings.compiler} compiler support." + ) + elif Version(self.settings.compiler.version) < min_version: + raise ConanInvalidConfiguration( + f"{self.name} {self.version} does not support compiler with version" + f" {self.settings.compiler} {self.settings.compiler.version}, minimum supported compiler" + f" version is {min_version} " + ) if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) - - def configure(self): - if self.options.shared: - del self.options.fPIC + 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["SSE4"] = self.options.use_sse4 - self._cmake.definitions["ZSTD"] = self.options.with_zstd - self._cmake.definitions["ENABLE_ENCODER"] = self.options.enable_encoder - self._cmake.definitions["NO_ITERATOR_DEBUG_LEVEL"] = not self._use_custom_iterator_debug_level() - 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["SSE4"] = self.options.use_sse4 + tc.variables["ZSTD"] = self.options.with_zstd + tc.variables["ENABLE_ENCODER"] = self.options.enable_encoder + tc.variables["NO_ITERATOR_DEBUG_LEVEL"] = not self._use_custom_iterator_debug_level() + 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 package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("*.h", dst=os.path.join("include", self.name, "transcoder"), src=os.path.join(self._source_subfolder, "transcoder")) + copy(self, "LICENSE", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder) + copy(self, "*.h", + dst=os.path.join(self.package_folder, "include", self.name, "transcoder"), + src=os.path.join(self.source_folder, "transcoder")) if self.options.enable_encoder: - self.copy("*.h", dst=os.path.join("include", self.name, "encoder"), src=os.path.join(self._source_subfolder, "encoder")) - self.copy(pattern="*.a", dst="lib", keep_path=False) - self.copy(pattern="*.so", dst="lib", keep_path=False) - self.copy(pattern="*.dylib*", dst="lib", keep_path=False) - self.copy(pattern="*.lib", dst="lib", keep_path=False) - self.copy(pattern="*.dll", dst="bin", keep_path=False) + copy(self,"*.h", + dst=os.path.join(self.package_folder, "include", self.name, "encoder"), + src=os.path.join(self.source_folder, "encoder")) + for pattern in ["*.a", "*.so*", "*.dylib*", "*.lib"]: + copy(self, pattern, + dst=os.path.join(self.package_folder, "lib"), + src=self.build_folder, keep_path=False) + copy(self, "*.dll", + dst=os.path.join(self.package_folder, "bin"), + src=self.build_folder, keep_path=False) def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) - self.cpp_info.names["cmake_find_package"] = self.name - self.cpp_info.names["cmake_find_package_multi"] = self.name + self.cpp_info.libs = collect_libs(self) self.cpp_info.includedirs = ["include", os.path.join("include", self.name)] - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["m", "pthread"] - self.cpp_info.defines.append("BASISU_NO_ITERATOR_DEBUG_LEVEL={}".format("1" if self._use_custom_iterator_debug_level() else "0")) + self.cpp_info.defines.append( + "BASISU_NO_ITERATOR_DEBUG_LEVEL={}".format("1" if self._use_custom_iterator_debug_level() else "0") + ) diff --git a/recipes/libbasisu/all/patches/cmakelist_build_lib.patch b/recipes/libbasisu/all/patches/cmakelist_build_lib.patch index 043a9778c605d..69bef6820b138 100644 --- a/recipes/libbasisu/all/patches/cmakelist_build_lib.patch +++ b/recipes/libbasisu/all/patches/cmakelist_build_lib.patch @@ -17,7 +17,7 @@ -if( NOT CMAKE_BUILD_TYPE ) - set( CMAKE_BUILD_TYPE Release ) -endif() -+project(basisu VERSION 1.15.0 LANGUAGES CXX) ++project(basisu VERSION 1.15.0 LANGUAGES CXX C) -message( ${PROJECT_NAME} " build type: " ${CMAKE_BUILD_TYPE} ) - @@ -55,7 +55,7 @@ - if (NOT BUILD_X64) - set(GCC_COMPILE_FLAGS "${GCC_COMPILE_FLAGS} -m32") - endif() -+ set(GCC_COMPILE_FLAGS "-fPIC -fno-strict-aliasing -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 -Wall -Wextra -Wno-unused-local-typedefs -Wno-unused-value -Wno-unused-parameter -Wno-unused-variable") ++ set(GCC_COMPILE_FLAGS "-fno-strict-aliasing -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 -Wall -Wextra -Wno-unused-local-typedefs -Wno-unused-value -Wno-unused-parameter -Wno-unused-variable") - if (EMSCRIPTEN) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -s ALLOW_MEMORY_GROWTH=1 -DBASISU_SUPPORT_SSE=0") @@ -99,7 +99,7 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DBASISU_SUPPORT_SSE=1") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBASISU_SUPPORT_SSE=1") else() -@@ -93,64 +51,57 @@ else() +@@ -93,64 +51,63 @@ else() endif() endif() @@ -173,6 +173,12 @@ if (ZSTD) - target_compile_definitions(basisu PRIVATE BASISD_SUPPORT_KTX2_ZSTD=1) + target_compile_definitions(${PROJECT_NAME} PRIVATE BASISD_SUPPORT_KTX2_ZSTD=1) ++ find_package(zstd REQUIRED) ++ if (TARGET zstd::libzstd_static) ++ target_link_libraries(${PROJECT_NAME} PRIVATE zstd::libzstd_static) ++ else() ++ target_link_libraries(${PROJECT_NAME} PRIVATE zstd::libzstd_shared) ++ endif() else() - target_compile_definitions(basisu PRIVATE BASISD_SUPPORT_KTX2_ZSTD=0) + target_compile_definitions(${PROJECT_NAME} PRIVATE BASISD_SUPPORT_KTX2_ZSTD=0) diff --git a/recipes/libbasisu/all/test_package/CMakeLists.txt b/recipes/libbasisu/all/test_package/CMakeLists.txt index 2adca01f3e68a..e4b4ddeb886b6 100644 --- a/recipes/libbasisu/all/test_package/CMakeLists.txt +++ b/recipes/libbasisu/all/test_package/CMakeLists.txt @@ -1,10 +1,8 @@ -cmake_minimum_required(VERSION 3.10) -project(test_package) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +find_package(libbasisu REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) - -target_link_libraries(${PROJECT_NAME} PRIVATE CONAN_PKG::libbasisu) +target_link_libraries(${PROJECT_NAME} PRIVATE libbasisu::libbasisu) set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) diff --git a/recipes/libbasisu/all/test_package/conanfile.py b/recipes/libbasisu/all/test_package/conanfile.py index 12dd810a6ab3b..ef5d7042163ec 100644 --- a/recipes/libbasisu/all/test_package/conanfile.py +++ b/recipes/libbasisu/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" + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libbasisu/all/test_v1_package/CMakeLists.txt b/recipes/libbasisu/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/libbasisu/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/libbasisu/all/test_v1_package/conanfile.py b/recipes/libbasisu/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..abcaeed3f89b6 --- /dev/null +++ b/recipes/libbasisu/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.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libbigwig/all/conanfile.py b/recipes/libbigwig/all/conanfile.py index 7caf0f129e795..be4c72a8890d2 100644 --- a/recipes/libbigwig/all/conanfile.py +++ b/recipes/libbigwig/all/conanfile.py @@ -1,10 +1,11 @@ +import os + 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 +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class LibBigWigConan(ConanFile): @@ -14,6 +15,7 @@ class LibBigWigConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/dpryan79/libBigWig" license = "MIT" + package_type = "library" settings = "arch", "build_type", "compiler", "os" options = { @@ -26,32 +28,28 @@ class LibBigWigConan(ConanFile): default_options = { "shared": False, "fPIC": True, - "with_curl": False, + "with_curl": True, "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 + 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_curl: - self.requires("libcurl/7.85.0") + # transitive_headers=True is required due to includes in bigWigIO.h + # https://github.com/dpryan79/libBigWig/blob/master/bigWigIO.h#L5 + self.requires("libcurl/[>=7.78.0 <9]", transitive_headers=True) if self.options.with_zlibng: - self.requires("zlib-ng/2.0.6") + self.requires("zlib-ng/2.2.0") else: - self.requires("zlib/1.2.12") + self.requires("zlib/[>=1.2.11 <2]") def validate(self): if self.info.settings.os == "Windows": @@ -62,13 +60,9 @@ def validate(self): 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) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -91,10 +85,11 @@ def package(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") + self.cpp_info.libs = ["BigWig"] + self.cpp_info.system_libs = ["m"] + if not self.options.with_curl: self.cpp_info.defines = ["NOCURL"] diff --git a/recipes/libbigwig/all/test_package/CMakeLists.txt b/recipes/libbigwig/all/test_package/CMakeLists.txt index 7a790b50c498a..fae2a97e9d90d 100644 --- a/recipes/libbigwig/all/test_package/CMakeLists.txt +++ b/recipes/libbigwig/all/test_package/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.8) -project(test_package C) +project(test_package LANGUAGES C) find_package(BigWig REQUIRED CONFIG) diff --git a/recipes/libbigwig/all/test_package/conanfile.py b/recipes/libbigwig/all/test_package/conanfile.py index 8a6b7483b895d..c76c01456ca00 100644 --- a/recipes/libbigwig/all/test_package/conanfile.py +++ b/recipes/libbigwig/all/test_package/conanfile.py @@ -1,7 +1,8 @@ import os + from conan import ConanFile -from conan.tools.cmake import CMake, cmake_layout from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout class TestPackageConan(ConanFile): diff --git a/recipes/libbigwig/all/test_v1_package/CMakeLists.txt b/recipes/libbigwig/all/test_v1_package/CMakeLists.txt index 0ef441c1d3786..70375bb9b607e 100644 --- a/recipes/libbigwig/all/test_v1_package/CMakeLists.txt +++ b/recipes/libbigwig/all/test_v1_package/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.8) -project(test_package C) +project(test_package LANGUAGES C) include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") conan_basic_setup(TARGETS) diff --git a/recipes/libbigwig/all/test_v1_package/conanfile.py b/recipes/libbigwig/all/test_v1_package/conanfile.py index fe504f17122b3..e8dacc213db5b 100644 --- a/recipes/libbigwig/all/test_v1_package/conanfile.py +++ b/recipes/libbigwig/all/test_v1_package/conanfile.py @@ -1,7 +1,7 @@ import os -from conans import ConanFile, CMake from conan.tools.build import cross_building +from conans import CMake, ConanFile class TestPackageConan(ConanFile): diff --git a/recipes/libboxes/all/conandata.yml b/recipes/libboxes/all/conandata.yml new file mode 100644 index 0000000000000..5ed3e25a8e382 --- /dev/null +++ b/recipes/libboxes/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.1.1": + url: "https://gitlab.com/twdev_projects/boxes/-/archive/v0.1.1/boxes-v0.1.1.tar.gz" + sha256: "a9943a47abd820b7847e1f7abd15fc733c028379542815f8038192a0e4902cd0" diff --git a/recipes/libboxes/all/conanfile.py b/recipes/libboxes/all/conanfile.py new file mode 100644 index 0000000000000..59e6f45a38714 --- /dev/null +++ b/recipes/libboxes/all/conanfile.py @@ -0,0 +1,95 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, export_conandata_patches, get, rmdir +from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps +from conan.tools.scm import Version +import os + +class libboxesRecipe(ConanFile): + name = "libboxes" + description = "Boxes is a set of frequently used containers built on top of STL" + + license = "BSD-3-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://gitlab.com/twdev_projects/boxes" + + topics = ("container", "utility") + package_type = "library" + 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 20 + + @property + def _compilers_minimum_version(self): + return { + "apple-clang": "13", + "clang": "14", + "gcc": "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("xxhash/0.8.2", transitive_headers=True) + + def validate(self): + if self.settings.os == "Windows": + raise ConanInvalidConfiguration("libboxes does not support Windows yet") + + 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): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["BUILD_SHARED_LIBS"] = self.options.shared + tc.cache_variables["BUILD_EXAMPLES"] = "OFF" + tc.generate() + + tc = CMakeDeps(self) + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE.md", self.source_folder, 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", "libboxes") + self.cpp_info.set_property("cmake_target_name", "libboxes::libboxes") + self.cpp_info.set_property("pkg_config_name", "libboxes") + + if self.settings.os in ["Linux", "Android", "FreeBSD", "SunOS", "AIX"]: + self.cpp_info.system_libs.append("m") diff --git a/recipes/libboxes/all/test_package/CMakeLists.txt b/recipes/libboxes/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..2c73e54e37773 --- /dev/null +++ b/recipes/libboxes/all/test_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.15) +project(PackageTest CXX) + +find_package(libboxes CONFIG REQUIRED) + + + +add_executable(example src/example.cpp) +target_link_libraries(example libboxes::libboxes) +target_compile_features(example PRIVATE cxx_std_20) diff --git a/recipes/libboxes/all/test_package/conanfile.py b/recipes/libboxes/all/test_package/conanfile.py new file mode 100644 index 0000000000000..fa3590fe7255a --- /dev/null +++ b/recipes/libboxes/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 libboxesTestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "CMakeDeps", "CMakeToolchain" + + 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 can_run(self): + cmd = os.path.join(self.cpp.build.bindir, "example") + self.run(cmd, env="conanrun") diff --git a/recipes/libboxes/all/test_package/src/example.cpp b/recipes/libboxes/all/test_package/src/example.cpp new file mode 100644 index 0000000000000..813df03e7c552 --- /dev/null +++ b/recipes/libboxes/all/test_package/src/example.cpp @@ -0,0 +1,16 @@ +#include + +#include + +int main() { + boxes::RingBuffer buf; + buf.push_back(123); + + if (buf.size() == 1 && buf.front() == 123) { + std::cout << "libboxes::RingBuffer works!" << std::endl; + } else { + std::cout << "libboxes::RingBuffer is broken!" << std::endl; + } + + return 0; +} diff --git a/recipes/libboxes/config.yml b/recipes/libboxes/config.yml new file mode 100644 index 0000000000000..b893ff21f7c23 --- /dev/null +++ b/recipes/libboxes/config.yml @@ -0,0 +1,3 @@ +versions: + "0.1.1": + folder: all diff --git a/recipes/libbpf/all/conandata.yml b/recipes/libbpf/all/conandata.yml index 80547c38b8b06..2d16ec7238800 100644 --- a/recipes/libbpf/all/conandata.yml +++ b/recipes/libbpf/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "1.3.0": + url: "https://github.com/libbpf/libbpf/archive/v1.3.0.tar.gz" + sha256: "11db86acd627e468bc48b7258c1130aba41a12c4d364f78e184fd2f5a913d861" + "1.1.0": + url: "https://github.com/libbpf/libbpf/archive/refs/tags/v1.1.0.tar.gz" + sha256: "5da826c968fdb8a2f714701cfef7a4b7078be030cf58b56143b245816301cbb8" + "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..b154fd66ef174 100644 --- a/recipes/libbpf/all/conanfile.py +++ b/recipes/libbpf/all/conanfile.py @@ -1,90 +1,102 @@ -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" - settings = "os", "arch", "compiler", "build_type" - - _autotools = None + topics = ("berkeley-packet-filter", "bpf", "ebpf", "network", "tracing") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], - "fPIC": [True, False] + "fPIC": [True, False], + "with_uapi_headers": [True, False] } - default_options = { "shared": False, - "fPIC": True + "fPIC": True, + "with_uapi_headers": False } - @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("libelf/0.8.13") - self.requires("zlib/1.2.11") + self.requires("linux-headers-generic/5.15.128", transitive_headers=True) + self.requires("elfutils/0.190", transitive_headers=True, transitive_libs=True) + self.requires("zlib/[>=1.2.11 <2]") + + def validate(self): + if self.settings.os != "Linux": + raise ConanInvalidConfiguration(f"{self.ref} is only available on Linux") + + def build_requirements(self): + self.tool_requires("make/4.3") - def _configure_autotools(self): - make_args = [ - "--directory={}".format("src"), + 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)) + tc.configure_args.append("BUILD_STATIC_ONLY={}".format(1)) + tc.generate() - 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") - - 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() + if self.options.with_uapi_headers: + autotools.make('install_uapi_headers') 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" self.cpp_info.libs = ["bpf"] + self.cpp_info.set_property("pkg_config_name", "libbpf") + + # TODO: Remove once v1 is no longer needed + 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..6fd5fe398b43d 100644 --- a/recipes/libbpf/config.yml +++ b/recipes/libbpf/config.yml @@ -1,4 +1,10 @@ versions: + "1.3.0": + folder: all + "1.1.0": + folder: all + "0.7.0": + folder: all "0.5.0": folder: all "0.4.0": diff --git a/recipes/libbsd/all/conandata.yml b/recipes/libbsd/all/conandata.yml index 6ed28ef4d2392..fe3e56bc2a2d1 100644 --- a/recipes/libbsd/all/conandata.yml +++ b/recipes/libbsd/all/conandata.yml @@ -5,4 +5,10 @@ sources: patches: "0.10.0": - patch_file: "patches/0001-support-macosx.patch" - base_path: "source_subfolder" + patch_description: "Enables building on MacOS" + patch_type: "portability" + patch_source: "https://github.com/NixOS/nixpkgs/blob/1016bfcff1df163aff75d908df1e00f897a29b9b/pkgs/development/libraries/libbsd/darwin.patch" + - patch_file: "patches/0002-fix-getentropy-conditional.patch" + patch_description: "Fix check if getentropy needs building" + patch_type: "backport" + patch_source: "https://gitlab.freedesktop.org/libbsd/libbsd/-/commit/5cfa39e5cde6b64ccf3d1335cee4d4744d4ce242.patch" diff --git a/recipes/libbsd/all/conanfile.py b/recipes/libbsd/all/conanfile.py index d921957f06961..468a858c4a3dc 100644 --- a/recipes/libbsd/all/conanfile.py +++ b/recipes/libbsd/all/conanfile.py @@ -1,8 +1,14 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, tools -from conans.errors import ConanInvalidConfiguration -import glob import os +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps +from conan.tools.apple import is_apple_os, fix_apple_shared_install_name +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, export_conandata_patches, copy, get, rmdir +from conan.tools.layout import basic_layout + +required_conan_version = ">=1.53.0" class LibBsdConan(ConanFile): name = "libbsd" @@ -12,6 +18,7 @@ class LibBsdConan(ConanFile): license = ("ISC", "MIT", "Beerware", "BSD-2-clause", "BSD-3-clause", "BSD-4-clause") homepage = "https://libbsd.freedesktop.org/wiki/" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -21,72 +28,66 @@ class LibBsdConan(ConanFile): "shared": False, "fPIC": True, } - exports_sources = "patches/**" - - _autotools = None def build_requirements(self): - self.build_requires("libtool/2.4.6") - - @property - def _source_subfolder(self): - return "source_subfolder" + self.tool_requires("libtool/2.4.7") + def export_sources(self): + 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") + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + tc = AutotoolsToolchain(self) + if is_apple_os(self): + tc.extra_cflags.append("-Wno-error=implicit-function-declaration") + tc.generate() + deps = AutotoolsDeps(self) + deps.generate() + + def layout(self): + basic_layout(self, src_folder="src") def validate(self): - if not tools.is_apple_os(self.settings.os) and self.settings.os != "Linux": - raise ConanInvalidConfiguration("libbsd is only available for GNU-like operating systems (e.g. Linux)") + if not is_apple_os(self) and self.settings.os != "Linux": + raise ConanInvalidConfiguration(f"{self.ref} is only available for GNU-like operating systems (e.g. Linux)") 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, win_bash=tools.os_info.is_windows) - if tools.is_apple_os(self.settings.os): - self._autotools.flags.append("-Wno-error=implicit-function-declaration") - 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], strip_root=True) 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("autoreconf -fiv") - 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() os.unlink(os.path.join(os.path.join(self.package_folder, "lib", "libbsd.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, "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["bsd"].libs = ["bsd"] - self.cpp_info.components["bsd"].names["pkg_config"] = "libbsd" + self.cpp_info.components["bsd"].set_property("pkg_config_name", "libbsd") self.cpp_info.components["libbsd-overlay"].libs = [] self.cpp_info.components["libbsd-overlay"].requires = ["bsd"] self.cpp_info.components["libbsd-overlay"].includedirs.append(os.path.join("include", "bsd")) self.cpp_info.components["libbsd-overlay"].defines = ["LIBBSD_OVERLAY"] - self.cpp_info.components["libbsd-overlay"].names["pkg_config"] = "libbsd-overlay" + self.cpp_info.components["libbsd-overlay"].set_property("pkg_config_name", "libbsd-overlay") # on apple-clang, GNU .init_array section is not supported if self.settings.compiler != "apple-clang": @@ -95,4 +96,5 @@ def package_info(self): if self.settings.os == "Linux": self.cpp_info.components["libbsd-ctor"].exelinkflags = ["-Wl,-z,nodlopen", "-Wl,-u,libbsd_init_func"] self.cpp_info.components["libbsd-ctor"].sharedlinkflags = ["-Wl,-z,nodlopen", "-Wl,-u,libbsd_init_func"] - self.cpp_info.components["libbsd-ctor"].names["pkg_config"] = "libbsd-ctor" + self.cpp_info.components["libbsd-ctor"].set_property("pkg_config_name", "libbsd-ctor") + diff --git a/recipes/libbsd/all/patches/0002-fix-getentropy-conditional.patch b/recipes/libbsd/all/patches/0002-fix-getentropy-conditional.patch new file mode 100644 index 0000000000000..4c7cb9a8e5cf7 --- /dev/null +++ b/recipes/libbsd/all/patches/0002-fix-getentropy-conditional.patch @@ -0,0 +1,31 @@ +From 5cfa39e5cde6b64ccf3d1335cee4d4744d4ce242 Mon Sep 17 00:00:00 2001 +From: Guillem Jover +Date: Wed, 23 Nov 2022 23:42:49 +0100 +Subject: [PATCH] =?UTF-8?q?build:=20Use=20=C2=AByes=C2=BB=20instead=20of?= + =?UTF-8?q?=20=C2=ABtrue=C2=BB=20for=20AC=5FCHECK=5FFUNCS=20cache=20value?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This autoconf macro sets the ac_cv_func_ cached variable to «yes» not +«true» so we were checking for an impossible condition. +--- + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index 17d113c..842f5d6 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -173,7 +173,7 @@ AC_CHECK_FUNCS([clearenv dirfd fopencookie __fpurge \ + getauxval getentropy getexecname getline \ + pstat_getproc sysconf \ + strlcpy strlcat strnstr strmode fpurge]) +-AM_CONDITIONAL([HAVE_GETENTROPY], [test "x$ac_cv_func_getentropy" = "xtrue"]) ++AM_CONDITIONAL([HAVE_GETENTROPY], [test "x$ac_cv_func_getentropy" = "xyes"]) + + AC_CONFIG_FILES([ + Makefile +-- +GitLab + diff --git a/recipes/libbsd/all/test_package/CMakeLists.txt b/recipes/libbsd/all/test_package/CMakeLists.txt index 532326ae9815e..d4aafe28c716a 100644 --- a/recipes/libbsd/all/test_package/CMakeLists.txt +++ b/recipes/libbsd/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(libbsd REQUIRED) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} libbsd::libbsd-overlay) +target_link_libraries(${PROJECT_NAME} PRIVATE libbsd::libbsd-overlay) diff --git a/recipes/libbsd/all/test_package/conanfile.py b/recipes/libbsd/all/test_package/conanfile.py index 6128ac2ebae8f..ec1844a785913 100644 --- a/recipes/libbsd/all/test_package/conanfile.py +++ b/recipes/libbsd/all/test_package/conanfile.py @@ -1,25 +1,27 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanException 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", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package", "pkg_config" + 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): - pcfiles = ["libbsd", "libbsd-overlay"] - if self.settings.compiler != "apple-clang": - pcfiles.append("libbsd-ctor") - for f in pcfiles: - pc = "{}.pc".format(f) - if not os.path.isfile(pc): - raise ConanException("{} not created by pkg_config generator".format(pc)) 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) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libbsd/all/test_v1_package/CMakeLists.txt b/recipes/libbsd/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..cd6f4a15c06e7 --- /dev/null +++ b/recipes/libbsd/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/libbsd/all/test_v1_package/conanfile.py b/recipes/libbsd/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..6128ac2ebae8f --- /dev/null +++ b/recipes/libbsd/all/test_v1_package/conanfile.py @@ -0,0 +1,25 @@ +from conans import ConanFile, CMake, tools +from conans.errors import ConanException +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package", "pkg_config" + + def build(self): + pcfiles = ["libbsd", "libbsd-overlay"] + if self.settings.compiler != "apple-clang": + pcfiles.append("libbsd-ctor") + for f in pcfiles: + pc = "{}.pc".format(f) + if not os.path.isfile(pc): + raise ConanException("{} not created by pkg_config generator".format(pc)) + 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/libcap/all/conandata.yml b/recipes/libcap/all/conandata.yml index 847c16afd3b78..213e20579f77b 100644 --- a/recipes/libcap/all/conandata.yml +++ b/recipes/libcap/all/conandata.yml @@ -1,51 +1,122 @@ 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.70": + url: "https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.70.tar.xz" + sha256: "23a6ef8aadaf1e3e875f633bb2d116cfef8952dba7bc7c569b13458e1952b30f" + "2.69": + url: "https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.69.tar.xz" + sha256: "f311f8f3dad84699d0566d1d6f7ec943a9298b28f714cae3c931dfd57492d7eb" + "2.68": + url: "https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.68.tar.xz" + sha256: "90be3b6d41be5f81ae4b03ec76012b0d27c829293684f6c05b65d5f9cce724b2" + "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.70": - 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.69": - 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.62": + patch_description: "allow to override compiler via environment variables" + patch_type: "conan" + "2.68": - 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.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" + 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" + 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..0b95333fdd78f 100644 --- a/recipes/libcap/all/conanfile.py +++ b/recipes/libcap/all/conanfile.py @@ -3,11 +3,11 @@ 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.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 +17,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 +29,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,10 +59,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)) - env.define("BUILD_CC", native_cc) + if cross_building(self): + # libcap needs to run an executable that is compiled from sources + # during the build - so it needs a native compiler (it doesn't matter which) + # Assume the `cc` command points to a working C compiler + env.define("BUILD_CC", "cc") tc.generate(env) @@ -74,15 +71,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 +93,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..6412745da8b97 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/2.0.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..a24aa126c9102 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/2.0.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..e8abe4aef997c 100644 --- a/recipes/libcap/config.yml +++ b/recipes/libcap/config.yml @@ -1,17 +1,25 @@ versions: - "2.45": + "2.70": folder: all - "2.46": + "2.69": folder: all - "2.48": + "2.68": folder: all - "2.50": + "2.66": folder: all - "2.57": + "2.65": + folder: all + "2.62": folder: all "2.58": folder: all - "2.62": + "2.57": folder: all - "2.65": + "2.50": + folder: all + "2.48": + folder: all + "2.46": + folder: all + "2.45": folder: all diff --git a/recipes/libcbor/all/conandata.yml b/recipes/libcbor/all/conandata.yml index 62e7073df986d..c9712282e5c82 100644 --- a/recipes/libcbor/all/conandata.yml +++ b/recipes/libcbor/all/conandata.yml @@ -1,4 +1,16 @@ sources: + "0.11.0": + url: "https://github.com/PJK/libcbor/archive/v0.11.0.tar.gz" + sha256: "89e0a83d16993ce50651a7501355453f5250e8729dfc8d4a251a78ea23bb26d7" + "0.10.2": + url: "https://github.com/PJK/libcbor/archive/v0.10.2.tar.gz" + sha256: "e75f712215d7b7e5c89ef322a09b701f7159f028b8b48978865725f00f79875b" + "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,6 +20,12 @@ sources: patches: "0.9.0": - patch_file: "patches/0.7.0/002_fix_cmake_module_path.patch" + patch_description: "fix cmake module path" + patch_type: "portability" "0.7.0": - patch_file: "patches/0.7.0/001_fix_shared_build.patch" + patch_description: "fix shared build compilation error" + patch_type: "conan" - patch_file: "patches/0.7.0/002_fix_cmake_module_path.patch" + patch_description: "fix cmake module path" + patch_type: "portability" diff --git a/recipes/libcbor/all/conanfile.py b/recipes/libcbor/all/conanfile.py index 2dcedcee9a1fc..e7b8cdd0c66a8 100644 --- a/recipes/libcbor/all/conanfile.py +++ b/recipes/libcbor/all/conanfile.py @@ -71,6 +71,7 @@ def package(self): 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")) def package_info(self): self.cpp_info.set_property("pkg_config_name", "libcbor") diff --git a/recipes/libcbor/all/test_package/CMakeLists.txt b/recipes/libcbor/all/test_package/CMakeLists.txt index fc2cbc0d5af6e..94fca8fa66406 100644 --- a/recipes/libcbor/all/test_package/CMakeLists.txt +++ b/recipes/libcbor/all/test_package/CMakeLists.txt @@ -5,3 +5,7 @@ find_package(libcbor REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) target_link_libraries(${PROJECT_NAME} PRIVATE 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/test_package.c b/recipes/libcbor/all/test_package/test_package.c index aeae930f3bd7b..63def1fbfb9b0 100644 --- a/recipes/libcbor/all/test_package/test_package.c +++ b/recipes/libcbor/all/test_package/test_package.c @@ -3,7 +3,9 @@ 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); diff --git a/recipes/libcbor/config.yml b/recipes/libcbor/config.yml index b4b6b81f6444e..fcc17114549de 100644 --- a/recipes/libcbor/config.yml +++ b/recipes/libcbor/config.yml @@ -1,4 +1,12 @@ versions: + "0.11.0": + folder: "all" + "0.10.2": + folder: "all" + "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/libcds/all/conanfile.py b/recipes/libcds/all/conanfile.py index 678232b29deac..4e60a137e0fd6 100644 --- a/recipes/libcds/all/conanfile.py +++ b/recipes/libcds/all/conanfile.py @@ -2,20 +2,21 @@ 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, get, rmdir +from conan.tools.files import apply_conandata_patches, collect_libs, copy, export_conandata_patches, get, rmdir import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class LibcdsConan(ConanFile): name = "libcds" description = "C++11 library of Concurrent Data Structures." license = "BSL-1.0" - topics = ("libcds", "concurrent", "lock-free", "containers", "hazard-pointer", "rcu") + topics = ("concurrent", "lock-free", "containers", "hazard-pointer", "rcu") homepage = "https://github.com/khizmax/libcds" 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 LibcdsConan(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,23 +36,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 requirements(self): - self.requires("boost/1.79.0") + self.requires("boost/1.81.0") 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 == "Macos" and self.info.settings.arch == "armv8": + if self.settings.os == "Macos" and self.settings.arch == "armv8": raise ConanInvalidConfiguration("Macos M1 not supported (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) @@ -82,13 +81,13 @@ def package(self): def package_info(self): cmake_target = "cds" if self.options.shared else "cds-s" self.cpp_info.set_property("cmake_file_name", "LibCDS") - self.cpp_info.set_property("cmake_target_name", "LibCDS::{}".format(cmake_target)) + self.cpp_info.set_property("cmake_target_name", f"LibCDS::{cmake_target}") # TODO: back to global scope in conan v2 once cmake_find_package* generators removed self.cpp_info.components["_libcds"].libs = collect_libs(self) if self.settings.os == "Windows" and not self.options.shared: self.cpp_info.components["_libcds"].defines = ["CDS_BUILD_STATIC_LIB"] if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.components["_libcds"].system_libs = ["pthread"] + self.cpp_info.components["_libcds"].system_libs = ["m", "pthread"] if self.settings.compiler in ["gcc", "clang", "apple-clang"] and self.settings.arch == "x86_64": self.cpp_info.components["_libcds"].cxxflags = ["-mcx16"] self.cpp_info.components["_libcds"].requires = ["boost::boost"] @@ -98,4 +97,4 @@ def package_info(self): self.cpp_info.names["cmake_find_package_multi"] = "LibCDS" self.cpp_info.components["_libcds"].names["cmake_find_package"] = cmake_target self.cpp_info.components["_libcds"].names["cmake_find_package_multi"] = cmake_target - self.cpp_info.components["_libcds"].set_property("cmake_target_name", "LibCDS::{}".format(cmake_target)) + self.cpp_info.components["_libcds"].set_property("cmake_target_name", f"LibCDS::{cmake_target}") diff --git a/recipes/libcds/all/test_package/conanfile.py b/recipes/libcds/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/libcds/all/test_package/conanfile.py +++ b/recipes/libcds/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/libcds/all/test_v1_package/CMakeLists.txt b/recipes/libcds/all/test_v1_package/CMakeLists.txt index fb01e094e9d0d..0d20897301b68 100644 --- a/recipes/libcds/all/test_v1_package/CMakeLists.txt +++ b/recipes/libcds/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(LibCDS REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) -if(TARGET LibCDS::cds-s) - target_link_libraries(${PROJECT_NAME} PRIVATE LibCDS::cds-s) -else() - target_link_libraries(${PROJECT_NAME} PRIVATE LibCDS::cds) -endif() +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libcheck/all/CMakeLists.txt b/recipes/libcheck/all/CMakeLists.txt deleted file mode 100644 index bd3083b512cb9..0000000000000 --- a/recipes/libcheck/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/libcheck/all/conandata.yml b/recipes/libcheck/all/conandata.yml index 767df99b3d51a..fbaed8dabebec 100644 --- a/recipes/libcheck/all/conandata.yml +++ b/recipes/libcheck/all/conandata.yml @@ -5,12 +5,7 @@ sources: patches: "0.15.2": - patch_file: "patches/0001-remove-check-h-header.patch" - base_path: "source_subfolder" - patch_file: "patches/0002-disable-cmake-subproject-check.patch" - base_path: "source_subfolder" - patch_file: "patches/0003-don-t-check-subunit-dependency.patch" - base_path: "source_subfolder" - patch_file: "patches/0004-install-shared-static-exclusive.patch" - base_path: "source_subfolder" - patch_file: "patches/0005-add-missing-lib-pthread_mutex-c.patch" - base_path: "source_subfolder" diff --git a/recipes/libcheck/all/conanfile.py b/recipes/libcheck/all/conanfile.py index 5113b075852b0..4837f11de4b81 100644 --- a/recipes/libcheck/all/conanfile.py +++ b/recipes/libcheck/all/conanfile.py @@ -1,17 +1,22 @@ -from conans import CMake, ConanFile, tools import os -required_conan_version = ">=1.43.0" +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 +from conan.tools.microsoft import is_msvc + +required_conan_version = ">=1.52.0" class LibCheckConan(ConanFile): name = "libcheck" description = "A unit testing framework for C" - topics = ("libcheck", "unit", "testing", "framework", "C") license = "LGPL-2.1-or-later" - homepage = "https://github.com/libcheck/check" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/libcheck/check" + topics = ("unit", "testing", "framework", "C") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -24,25 +29,8 @@ class LibCheckConan(ConanFile): "with_subunit": 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": @@ -50,70 +38,77 @@ 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.with_subunit: - self.requires("subunit/1.4.0") + self.requires("subunit/1.4.0", transitive_headers=True, transitive_libs=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["CHECK_ENABLE_TESTS"] = False - self._cmake.definitions["ENABLE_MEMORY_LEAKING_TESTS"] = False - self._cmake.definitions["CHECK_ENABLE_TIMEOUT_TESTS"] = False - self._cmake.definitions["HAVE_SUBUNIT"] = self.options.with_subunit - 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["CHECK_ENABLE_TESTS"] = False + tc.variables["ENABLE_MEMORY_LEAKING_TESTS"] = False + tc.variables["CHECK_ENABLE_TIMEOUT_TESTS"] = False + tc.variables["HAVE_SUBUNIT"] = self.options.with_subunit + tc.generate() + tc = CMakeDeps(self) + tc.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + # Do not build the unnecessary target + disabled_target = "check" if self.options.shared else "checkShared" + save(self, os.path.join(self.source_folder, "src", "CMakeLists.txt"), + f"set_target_properties({disabled_target} PROPERTIES EXCLUDE_FROM_ALL TRUE)\n", + append=True) + 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("COPYING.LESSER", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, "COPYING.LESSER", 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")) def package_info(self): target = "checkShared" if self.options.shared else "check" self.cpp_info.set_property("cmake_file_name", "check") - self.cpp_info.set_property("cmake_target_name", "Check::{}".format(target)) + self.cpp_info.set_property("cmake_target_name", f"Check::{target}") self.cpp_info.set_property("pkg_config_name", "check") # TODO: back to global scope in conan v2 once cmake_find_package_* generators removed - libsuffix = "Dynamic" if self._is_msvc and self.options.shared else "" - self.cpp_info.components["liblibcheck"].libs = ["check{}".format(libsuffix)] + libsuffix = "Dynamic" if is_msvc(self) and self.options.shared else "" + self.cpp_info.components["liblibcheck"].libs = [f"check{libsuffix}"] if self.options.with_subunit: - self.cpp_info.components["liblibcheck"].requires.append("subunit::libsubunit") + self.cpp_info.components["liblibcheck"].requires.append("subunit::subunit") if not self.options.shared: if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["liblibcheck"].system_libs = ["m", "pthread", "rt"] + # 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.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"] = "check" self.cpp_info.filenames["cmake_find_package_multi"] = "check" self.cpp_info.names["cmake_find_package"] = "Check" self.cpp_info.names["cmake_find_package_multi"] = "Check" - self.cpp_info.names["pkg_config"] = "check" self.cpp_info.components["liblibcheck"].names["cmake_find_package"] = target self.cpp_info.components["liblibcheck"].names["cmake_find_package_multi"] = target - self.cpp_info.components["liblibcheck"].set_property("cmake_target_name", "Check::{}".format(target)) + self.cpp_info.components["liblibcheck"].set_property("cmake_target_name", f"Check::{target}") self.cpp_info.components["liblibcheck"].set_property("pkg_config_name", "check") diff --git a/recipes/libcheck/all/patches/0003-don-t-check-subunit-dependency.patch b/recipes/libcheck/all/patches/0003-don-t-check-subunit-dependency.patch index 320eb687dab0f..55bb33e3fe378 100644 --- a/recipes/libcheck/all/patches/0003-don-t-check-subunit-dependency.patch +++ b/recipes/libcheck/all/patches/0003-don-t-check-subunit-dependency.patch @@ -1,12 +1,14 @@ --- CMakeLists.txt +++ CMakeLists.txt -@@ -393,7 +393,7 @@ +@@ -393,7 +393,9 @@ ADD_DEFINITIONS(-DHAVE_LIBRT=1) endif (HAVE_LIBRT) -check_library_exists(subunit subunit_test_start "" HAVE_SUBUNIT) -+option(HAVE_SUBUNIT "Do you have subunit" ON) if (HAVE_SUBUNIT) ++ find_package(subunit REQUIRED CONFIG) ++ link_libraries(subunit::subunit) ++ link_directories(${subunit_INCLUDE_DIR}/../lib) # Conan v1 does not set the lib dirs correctly for some reason set(SUBUNIT "subunit") set(ENABLE_SUBUNIT 1) diff --git a/recipes/libcheck/all/test_package/CMakeLists.txt b/recipes/libcheck/all/test_package/CMakeLists.txt index d0ea6b764c70f..c0946969bf599 100644 --- a/recipes/libcheck/all/test_package/CMakeLists.txt +++ b/recipes/libcheck/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(check REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) diff --git a/recipes/libcheck/all/test_package/conanfile.py b/recipes/libcheck/all/test_package/conanfile.py index 38f4483872d47..ef5d7042163ec 100644 --- a/recipes/libcheck/all/test_package/conanfile.py +++ b/recipes/libcheck/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libcoap/all/CMakeLists.txt b/recipes/libcoap/all/CMakeLists.txt deleted file mode 100644 index bd3083b512cb9..0000000000000 --- a/recipes/libcoap/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/libcoap/all/conandata.yml b/recipes/libcoap/all/conandata.yml index 933f8a2810d53..0cce54484d005 100644 --- a/recipes/libcoap/all/conandata.yml +++ b/recipes/libcoap/all/conandata.yml @@ -1,7 +1,10 @@ sources: - "cci.20200424": - sha256: 8402bf2dd9979d6d5f823a050cd3533619fe9b21e76be8c69a9b7d8b8ea175ab - url: https://github.com/obgm/libcoap/archive/17957e1e687c2218b7752a8a959eac36dbf5cb62.zip + "4.3.3": + url: "https://github.com/obgm/libcoap/archive/v4.3.3.tar.gz" + sha256: "3df6e1a51e42ef8fd45f16276505a47ed32aef150d348d60f251a0b470dda379" "4.3.0": - url: https://github.com/obgm/libcoap/archive/refs/tags/v4.3.0.tar.gz - sha256: 1a195adacd6188d3b71c476e7b21706fef7f3663ab1fb138652e8da49a9ec556 + url: "https://github.com/obgm/libcoap/archive/refs/tags/v4.3.0.tar.gz" + sha256: "1a195adacd6188d3b71c476e7b21706fef7f3663ab1fb138652e8da49a9ec556" + "cci.20200424": + url: "https://github.com/obgm/libcoap/archive/17957e1e687c2218b7752a8a959eac36dbf5cb62.zip" + sha256: "8402bf2dd9979d6d5f823a050cd3533619fe9b21e76be8c69a9b7d8b8ea175ab" diff --git a/recipes/libcoap/all/conanfile.py b/recipes/libcoap/all/conanfile.py index 016cb1a3f6f02..eebfa5aaa0ba0 100644 --- a/recipes/libcoap/all/conanfile.py +++ b/recipes/libcoap/all/conanfile.py @@ -1,17 +1,24 @@ import os -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 +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, rmdir + +required_conan_version = ">=1.53.0" class LibCoapConan(ConanFile): name = "libcoap" + description = "A CoAP (RFC 7252) implementation in C" license = "BSD-2-Clause" - homepage = "https://github.com/obgm/libcoap" url = "https://github.com/conan-io/conan-center-index" - description = """A CoAP (RFC 7252) implementation in C""" - topics = ("coap") - exports_sources = "CMakeLists.txt" - settings = "os", "compiler", "build_type", "arch" + homepage = "https://github.com/obgm/libcoap" + topics = "coap" + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -24,88 +31,93 @@ class LibCoapConan(ConanFile): "with_epoll": False, "dtls_backend": "openssl", } - generators = "cmake", "cmake_find_package" - _cmake = None + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC - @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.libcxx") + self.settings.rm_safe("compiler.cppstd") - @property - def _build_subfolder(self): - return "build_subfolder" + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.options.dtls_backend == "openssl": - self.requires("openssl/1.1.1q") + self.requires("openssl/[>=1.1 <4]") elif self.options.dtls_backend == "mbedtls": - self.requires("mbedtls/2.25.0") - elif self.options.dtls_backend == "gnutls": - raise ConanInvalidConfiguration("gnu tls not available yet") - elif self.options.dtls_backend == "tinydtls": - raise ConanInvalidConfiguration("tinydtls not available yet") - - def config_options(self): - if self.settings.os == "Windows": - del self.options.fPIC + self.requires("mbedtls/3.2.1") - def configure(self): - if self.settings.os in ("Windows", "Macos"): + def validate(self): + if self.settings.os == "Windows" or is_apple_os(self): raise ConanInvalidConfiguration("Platform is currently not supported") - if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd - 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, 11) + if self.options.dtls_backend in ["gnutls", "tinydtls"]: + raise ConanInvalidConfiguration(f"{self.options.dtls_backend} not available yet") - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["WITH_EPOLL"] = self.options.with_epoll - self._cmake.definitions["ENABLE_DTLS"] = self.options.dtls_backend != None - self._cmake.definitions["DTLS_BACKEND"] = self.options.dtls_backend + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + def generate(self): + tc = CMakeToolchain(self) + tc.variables["WITH_EPOLL"] = self.options.with_epoll + tc.variables["ENABLE_DTLS"] = self.options.dtls_backend is not None + tc.variables["DTLS_BACKEND"] = self.options.dtls_backend if self.version != "cci.20200424": - self._cmake.definitions["ENABLE_DOCS"] = False - self._cmake.definitions["ENABLE_EXAMPLES"] = False + tc.variables["ENABLE_DOCS"] = False + tc.variables["ENABLE_EXAMPLES"] = False + tc.generate() - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + tc = CMakeDeps(self) + tc.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): - library_name = "" - pkgconfig_name = "" if self.version == "cci.20200424": library_name = "coap" - pkgconfig_name = "libcoap-2" + cmake_target_name = "coap" + pkgconfig_filename = "libcoap-2" else: library_name = "coap-3" - pkgconfig_name = "libcoap-3" + cmake_target_name = "coap-3" + pkgconfig_filename = "libcoap-3" - self.cpp_info.components["coap"].names["cmake_find_package"] = "coap" - self.cpp_info.components["coap"].names["cmake_find_package_multi"] = "coap" - pkgconfig_filename = "{}{}".format(pkgconfig_name, "-{}".format(self.options.dtls_backend) if self.options.dtls_backend else "") - self.cpp_info.components["coap"].names["pkg_config"] = pkgconfig_filename - self.cpp_info.components["coap"].libs = [library_name] + if self.options.dtls_backend: + pkgconfig_filename += f"-{self.options.dtls_backend}" + + self.cpp_info.set_property("cmake_file_name", "libcoap") + self.cpp_info.set_property("cmake_target_name", f"libcoap::{cmake_target_name}") + if cmake_target_name != "coap": + # Old target, still provided to not break users + self.cpp_info.set_property("cmake_target_aliases", ["libcoap::coap"]) + self.cpp_info.set_property("pkg_config_name", pkgconfig_filename) - if self.settings.os == "Linux": + # TODO: back to global scope once legacy generators support removed + self.cpp_info.components["coap"].libs = [library_name] + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["coap"].system_libs = ["pthread"] if self.options.dtls_backend == "openssl": self.cpp_info.components["coap"].requires = ["openssl::openssl"] elif self.options.dtls_backend == "mbedtls": self.cpp_info.components["coap"].requires = ["mbedtls::mbedtls"] + + # TODO: to remove once legacy generators support removed + self.cpp_info.components["coap"].names["cmake_find_package"] = cmake_target_name + self.cpp_info.components["coap"].names["cmake_find_package_multi"] = cmake_target_name + self.cpp_info.components["coap"].set_property("cmake_target_name", f"libcoap::{cmake_target_name}") + self.cpp_info.components["coap"].set_property("pkg_config_name", pkgconfig_filename) diff --git a/recipes/libcoap/all/test_package/CMakeLists.txt b/recipes/libcoap/all/test_package/CMakeLists.txt index b81eef988f5b5..999bf7cd574a5 100644 --- a/recipes/libcoap/all/test_package/CMakeLists.txt +++ b/recipes/libcoap/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() +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) find_package(libcoap REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} libcoap::coap) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) -target_compile_definitions(${PROJECT_NAME} PUBLIC LIB_VERSION=${LIB_VERSION}) +if(TARGET libcoap::coap-3) + target_link_libraries(${PROJECT_NAME} libcoap::coap-3) +else() + target_link_libraries(${PROJECT_NAME} libcoap::coap) +endif() +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/libcoap/all/test_package/conanfile.py b/recipes/libcoap/all/test_package/conanfile.py index 8bd5d5d915f3d..e1b4c4f5f3efb 100644 --- a/recipes/libcoap/all/test_package/conanfile.py +++ b/recipes/libcoap/all/test_package/conanfile.py @@ -1,24 +1,35 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake, CMakeToolchain import os -from conans import ConanFile, CMake, tools -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", "VirtualRunEnv" + test_type = "explicit" - def build(self): - cmake = CMake(self) + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) - version = self.deps_cpp_info["libcoap"].version; + def generate(self): + tc = CMakeToolchain(self) + version = self.dependencies["libcoap"].ref.version if version == "cci.20200424": - cmake.definitions["LIB_VERSION"] = 2 + tc.preprocessor_definitions["LIB_VERSION"] = "2" else: - cmake.definitions["LIB_VERSION"] = 3 + tc.preprocessor_definitions["LIB_VERSION"] = "3" + tc.generate() + 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") - bin_path = 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/libcoap/all/test_v1_package/CMakeLists.txt b/recipes/libcoap/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/libcoap/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/libcoap/all/test_v1_package/conanfile.py b/recipes/libcoap/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..0e1f34afd83e4 --- /dev/null +++ b/recipes/libcoap/all/test_v1_package/conanfile.py @@ -0,0 +1,20 @@ +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) + version = self.deps_cpp_info["libcoap"].version + lib_version = 2 if version == "cci.20200424" else 3 + cmake.definitions["CMAKE_CXX_FLAGS"] = f"-DLIB_VERSION={lib_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/libcoap/config.yml b/recipes/libcoap/config.yml index 2b90fe3a049b9..4bddf9ef347cf 100644 --- a/recipes/libcoap/config.yml +++ b/recipes/libcoap/config.yml @@ -1,6 +1,7 @@ ---- versions: - "cci.20200424": - folder: "all" + "4.3.3": + folder: all "4.3.0": - folder: "all" + folder: all + "cci.20200424": + folder: all 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/conanfile.py b/recipes/libconfuse/all/conanfile.py index 6b372d54a5173..05cfd416ce7a5 100644 --- a/recipes/libconfuse/all/conanfile.py +++ b/recipes/libconfuse/all/conanfile.py @@ -1,14 +1,13 @@ from conan import ConanFile from conan.tools.apple import fix_apple_shared_install_name -from conan.tools.env import Environment, VirtualBuildEnv +from conan.tools.env import 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 +from conan.tools.microsoft import check_min_vs, is_msvc import os -required_conan_version = ">=1.53.0" +required_conan_version = ">=1.57.0" class LibConfuseConan(ConanFile): @@ -18,6 +17,7 @@ class LibConfuseConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/martinh/libconfuse" license = "ISC" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -52,25 +52,21 @@ def build_requirements(self): self.tool_requires("msys2/cci.latest") 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 = 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"): + if is_msvc(self) and check_min_vs(self, "180", raise_invalid=False): tc.extra_cflags.append("-FS") - tc.generate() - + env = tc.environment() 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") + tc.generate(env) def _patch_sources(self): replace_in_file(self, os.path.join(self.source_folder, "Makefile.in"), @@ -89,8 +85,7 @@ def build(self): def package(self): 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)}"]) + 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")) diff --git a/recipes/libconfuse/all/test_package/conanfile.py b/recipes/libconfuse/all/test_package/conanfile.py index f7963cc87b0ba..bead96008a67b 100644 --- a/recipes/libconfuse/all/test_package/conanfile.py +++ b/recipes/libconfuse/all/test_package/conanfile.py @@ -26,7 +26,7 @@ def test(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(f"{bin_path} {config_path}", env="conanrun", output=output) + self.run(f"{bin_path} {config_path}", output, env="conanrun") text = output.getvalue() print(text) assert "Neighbour" in text diff --git a/recipes/libcoro/all/conandata.yml b/recipes/libcoro/all/conandata.yml new file mode 100644 index 0000000000000..08d3f083c5782 --- /dev/null +++ b/recipes/libcoro/all/conandata.yml @@ -0,0 +1,47 @@ +sources: + "0.12.1": + url: "https://github.com/jbaldwin/libcoro/archive/refs/tags/v0.12.1.tar.gz" + sha256: "2cb6f45fc73dad6008cc930d92939785684835e03b12df422b98fcab9e393add" + "0.12": + url: "https://github.com/jbaldwin/libcoro/archive/refs/tags/v0.12.tar.gz" + sha256: "9a89f329e12fda7d6425523fb2cbd1ebaf41e0e1d41e210d93ad4f3a196333a2" + "0.11.1": + url: "https://github.com/jbaldwin/libcoro/archive/refs/tags/v0.11.1.tar.gz" + sha256: "c7eb1bf133519ec0e0bc2e3e018ac4d1447a143e5e7385dab19204277d7c7671" + "0.10": + url: "https://github.com/jbaldwin/libcoro/archive/refs/tags/v0.10.tar.gz" + sha256: "0e952e72012925b75910f80772f3642dac631644578dbbc0db4fee047badc745" + "0.9": + url: "https://github.com/jbaldwin/libcoro/archive/refs/tags/v0.9.tar.gz" + sha256: "680479582023f019bfa58b17bbcd30aa2ef1a8ba2c09d4ea9b296dbc77e93f1f" + "0.8": + url: "https://github.com/jbaldwin/libcoro/archive/refs/tags/v0.8.tar.gz" + sha256: "09d8de39c9233d79c0dd1379c6826c636f63667f21001b66eb9b2080f6b270ad" + "0.7": + url: "https://github.com/jbaldwin/libcoro/archive/refs/tags/v0.7.tar.gz" + sha256: "ce1f3f1c4fa21b53d1cd195a29bd5a2313e53aa35637b402db04207d02316e51" +patches: + "0.10": + - patch_file: "patches/0.10-0002-disable-git-config.patch" + patch_type: "official" + patch_description: "Comment out invocation of git config command" + patch_source: "https://github.com/jbaldwin/libcoro/pull/234" + "0.9": + - patch_file: "patches/0.9-0002-disable-git-config.patch" + patch_type: "conan" + patch_description: "Comment out invocation of git config command" + - patch_file: "patches/0.9-0003-include-exception.patch" + patch_type: "backport" + patch_source: "https://github.com/jbaldwin/libcoro/pull/169" + patch_description: "include std headers" + "0.8": + - patch_file: "patches/0.8-0002-disable-git-config.patch" + patch_type: "conan" + patch_description: "Comment out invocation of git config command" + "0.7": + - patch_file: "patches/0.7-0002-disable-git-config.patch" + patch_type: "conan" + patch_description: "Comment out invocation of git config command" + - patch_file: "patches/0.7-0003-fix-dependencies.patch" + patch_type: "conan" + patch_description: "Replace add_subdirectory dependencies with find_package" diff --git a/recipes/libcoro/all/conanfile.py b/recipes/libcoro/all/conanfile.py new file mode 100644 index 0000000000000..0e6a519c86124 --- /dev/null +++ b/recipes/libcoro/all/conanfile.py @@ -0,0 +1,148 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.microsoft import 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, rmdir +from conan.tools.scm import Version +import os + +required_conan_version = ">=1.53.0" + + +class LibcoroConan(ConanFile): + name = "libcoro" + description = "C++20 coroutine library" + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/jbaldwin/libcoro" + topics = ("coroutines", "concurrency", "tasks", "executors", "networking") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_networking": [True, False], + "with_ssl": [True, False], + "with_threading": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_networking": True, + "with_ssl": True, + "with_threading": True, + } + + @property + def _min_cppstd(self): + return "20" + + @property + def _minimum_compilers_version(self): + return { + "gcc": "10.2.1", + "clang": "16.0.0", + "apple-clang": "16", + "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 + if Version(self.version) < "0.8": + del self.options.with_networking + if Version(self.version) < "0.9": + del self.options.with_ssl + del self.options.with_threading + if is_msvc(self) or self.settings.os == "Emscripten": + self.options.rm_safe("with_networking") + self.options.rm_safe("with_ssl") + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + if Version(self.version) < "0.11": + self.package_type = "static-library" + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + if "with_ssl" not in self.options or self.options.with_ssl: + self.requires("openssl/[>=1.1 <4]", transitive_headers=True) + self.requires("c-ares/1.25.0", transitive_headers=True) + self.requires("tl-expected/1.1.0", transitive_headers=True) + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + if Version(self.version) < "0.10": + if self.settings.os not in ["Linux", "FreeBSD", "Macos"]: + raise ConanInvalidConfiguration(f"{self.ref} is not supported on {self.settings.os}.") + if self.settings.compiler != "gcc": + raise ConanInvalidConfiguration(f"The Conan recipe {self.ref} only supports GCC for now. Contributions are welcome!") + + 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 Version(self.version) < "0.11" and self.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} Only supports shared linking for versions >=0.11") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["LIBCORO_BUILD_TESTS"] = False + tc.variables["LIBCORO_BUILD_EXAMPLES"] = False + if Version(self.version) >= "0.8": + tc.variables["LIBCORO_EXTERNAL_DEPENDENCIES"] = True + tc.variables["LIBCORO_FEATURE_NETWORKING"] = self.options.get_safe("with_networking") + if Version(self.version) >= "0.9": + tc.variables["LIBCORO_FEATURE_THREADING"] = self.options.with_threading + tc.variables["LIBCORO_FEATURE_SSL"] = self.options.get_safe("with_ssl", False) + if Version(self.version) >= "0.11": + tc.variables["LIBCORO_RUN_GITCONFIG"] = False + tc.variables["LIBCORO_BUILD_SHARED_LIBS"] = self.options.shared + tc.variables["LIBCORO_FEATURE_TLS"] = self.options.get_safe("with_ssl", 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): + 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")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "libcoro") + self.cpp_info.set_property("cmake_target_name", "libcoro::libcoro") + if Version(self.version) >= "0.8": + self.cpp_info.libs = ["libcoro"] if is_msvc(self) else ["coro"] + else: + self.cpp_info.libs = ["libcoro"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs = ["pthread", "m"] + + if Version(self.version) >= "0.9": + if self.options.get_safe("with_networking"): + self.cpp_info.defines.append("LIBCORO_FEATURE_NETWORKING") + if self.options.get_safe("with_ssl"): + self.cpp_info.defines.extend(["LIBCORO_FEATURE_SSL", "LIBCORO_FEATURE_TLS"]) + if self.options.with_threading: + self.cpp_info.defines.append("LIBCORO_FEATURE_THREADING") diff --git a/recipes/libcoro/all/patches/0.10-0002-disable-git-config.patch b/recipes/libcoro/all/patches/0.10-0002-disable-git-config.patch new file mode 100644 index 0000000000000..c6f4b03da3194 --- /dev/null +++ b/recipes/libcoro/all/patches/0.10-0002-disable-git-config.patch @@ -0,0 +1,32 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index b749c11..ce78a2d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -12,17 +12,20 @@ if (NOT "$ENV{version}" STREQUAL "") + set(PROJECT_VERSION "$ENV{version}" CACHE INTERNAL "Copied from environment variable") + endif() + +-# Set the githooks directory to auto format and update the readme. +-message("${PROJECT_NAME} ${CMAKE_CURRENT_SOURCE_DIR} -> git config --local core.hooksPath .githooks") +-execute_process( +- COMMAND git config --local core.hooksPath .githooks +- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} +-) +- + option(LIBCORO_EXTERNAL_DEPENDENCIES "Use Cmake find_package to resolve dependencies instead of embedded libraries, Default=OFF." OFF) + option(LIBCORO_BUILD_TESTS "Build the tests, Default=ON." ON) + option(LIBCORO_CODE_COVERAGE "Enable code coverage, tests must also be enabled, Default=OFF" OFF) + option(LIBCORO_BUILD_EXAMPLES "Build the examples, Default=ON." ON) ++option(LIBCORO_RUN_GITCONFIG "Set the githooks directory to auto format and update the readme, Default=ON." OFF) ++ ++# Set the githooks directory to auto format and update the readme. ++if (LIBCORO_RUN_GITCONFIG) ++ message("${PROJECT_NAME} ${CMAKE_CURRENT_SOURCE_DIR} -> git config --local core.hooksPath .githooks") ++ execute_process( ++ COMMAND git config --local core.hooksPath .githooks ++ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ++ ) ++endif() + + cmake_dependent_option(LIBCORO_FEATURE_PLATFORM "Include linux platform features, Default=ON." ON "NOT EMSCRIPTEN; NOT MSVC" OFF) + cmake_dependent_option(LIBCORO_FEATURE_NETWORKING "Include networking features, Default=ON." ON "NOT EMSCRIPTEN; NOT MSVC" OFF) diff --git a/recipes/libcoro/all/patches/0.7-0002-disable-git-config.patch b/recipes/libcoro/all/patches/0.7-0002-disable-git-config.patch new file mode 100644 index 0000000000000..6753e7e98b819 --- /dev/null +++ b/recipes/libcoro/all/patches/0.7-0002-disable-git-config.patch @@ -0,0 +1,18 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -7,9 +7,9 @@ + + # Set the githooks directory to auto format and update the readme. +-message("${PROJECT_NAME} ${CMAKE_CURRENT_SOURCE_DIR} -> git config --local core.hooksPath .githooks") +-execute_process( +- COMMAND git config --local core.hooksPath .githooks +- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} +-) ++#message("${PROJECT_NAME} ${CMAKE_CURRENT_SOURCE_DIR} -> git config --local core.hooksPath .githooks") ++#execute_process( ++# COMMAND git config --local core.hooksPath .githooks ++# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ++#) + + option(LIBCORO_BUILD_TESTS "Build the tests, Default=ON." ON) diff --git a/recipes/libcoro/all/patches/0.7-0003-fix-dependencies.patch b/recipes/libcoro/all/patches/0.7-0003-fix-dependencies.patch new file mode 100644 index 0000000000000..5c46168e06145 --- /dev/null +++ b/recipes/libcoro/all/patches/0.7-0003-fix-dependencies.patch @@ -0,0 +1,32 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -24,8 +24,11 @@ set(CARES_STATIC ON CACHE INTERNAL "") + set(CARES_SHARED OFF CACHE INTERNAL "") + set(CARES_INSTALL OFF CACHE INTERNAL "") + +-add_subdirectory(vendor/c-ares/c-ares) +-add_subdirectory(vendor/tartanllama/expected) ++include(GNUInstallDirs) ++ ++find_package(c-ares CONFIG REQUIRED) ++find_package(tl-expected CONFIG REQUIRED) ++find_package(OpenSSL REQUIRED) + + set(LIBCORO_SOURCE_FILES + inc/coro/concepts/awaitable.hpp +@@ -72,7 +75,7 @@ add_library(${PROJECT_NAME} STATIC ${LIBCORO_SOURCE_FILES}) + set_target_properties(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX) + target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_20) + target_include_directories(${PROJECT_NAME} PUBLIC inc) +-target_link_libraries(${PROJECT_NAME} PUBLIC pthread c-ares expected ssl crypto) ++target_link_libraries(${PROJECT_NAME} PUBLIC pthread c-ares::cares tl::expected OpenSSL::SSL OpenSSL::Crypto) + + if(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU") + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "10.2.0") +@@ -105,4 +108,4 @@ configure_file(libcoro.pc.in libcoro.pc @ONLY) + + install(TARGETS libcoro) + install(DIRECTORY inc/coro TYPE INCLUDE) +-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libcoro.pc DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/../lib/pkgconfig) ++install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libcoro.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) diff --git a/recipes/libcoro/all/patches/0.8-0002-disable-git-config.patch b/recipes/libcoro/all/patches/0.8-0002-disable-git-config.patch new file mode 100644 index 0000000000000..9996b0fa3402a --- /dev/null +++ b/recipes/libcoro/all/patches/0.8-0002-disable-git-config.patch @@ -0,0 +1,18 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 8de8174..4790572 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -11,13 +11,6 @@ if (NOT "$ENV{version}" STREQUAL "") + set(PROJECT_VERSION "$ENV{version}" CACHE INTERNAL "Copied from environment variable") + endif() + +-# Set the githooks directory to auto format and update the readme. +-message("${PROJECT_NAME} ${CMAKE_CURRENT_SOURCE_DIR} -> git config --local core.hooksPath .githooks") +-execute_process( +- COMMAND git config --local core.hooksPath .githooks +- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} +-) +- + option(LIBCORO_EXTERNAL_DEPENDENCIES "Use Cmake find_package to resolve dependencies instead of embedded libraries, Default=OFF." OFF) + option(LIBCORO_BUILD_TESTS "Build the tests, Default=ON." ON) + option(LIBCORO_CODE_COVERAGE "Enable code coverage, tests must also be enabled, Default=OFF" OFF) diff --git a/recipes/libcoro/all/patches/0.9-0002-disable-git-config.patch b/recipes/libcoro/all/patches/0.9-0002-disable-git-config.patch new file mode 100644 index 0000000000000..b169455e6e1ba --- /dev/null +++ b/recipes/libcoro/all/patches/0.9-0002-disable-git-config.patch @@ -0,0 +1,21 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index ef0eea4..4c342e3 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -12,11 +12,11 @@ if (NOT "$ENV{version}" STREQUAL "") + endif() + + # Set the githooks directory to auto format and update the readme. +-message("${PROJECT_NAME} ${CMAKE_CURRENT_SOURCE_DIR} -> git config --local core.hooksPath .githooks") +-execute_process( +- COMMAND git config --local core.hooksPath .githooks +- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} +-) ++#message("${PROJECT_NAME} ${CMAKE_CURRENT_SOURCE_DIR} -> git config --local core.hooksPath .githooks") ++#execute_process( ++# COMMAND git config --local core.hooksPath .githooks ++# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ++#) + + option(LIBCORO_EXTERNAL_DEPENDENCIES "Use Cmake find_package to resolve dependencies instead of embedded libraries, Default=OFF." OFF) + option(LIBCORO_BUILD_TESTS "Build the tests, Default=ON." ON) diff --git a/recipes/libcoro/all/patches/0.9-0003-include-exception.patch b/recipes/libcoro/all/patches/0.9-0003-include-exception.patch new file mode 100644 index 0000000000000..eac4b8bc794e6 --- /dev/null +++ b/recipes/libcoro/all/patches/0.9-0003-include-exception.patch @@ -0,0 +1,15 @@ +diff --git a/inc/coro/generator.hpp b/inc/coro/generator.hpp +index ede42d0..b103fb8 100644 +--- a/inc/coro/generator.hpp ++++ b/inc/coro/generator.hpp +@@ -1,8 +1,8 @@ + #pragma once +- + #include + #include +- ++#include ++#include + namespace coro + { + template diff --git a/recipes/libcoro/all/test_package/CMakeLists.txt b/recipes/libcoro/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..b5b603835dec1 --- /dev/null +++ b/recipes/libcoro/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.12) +project(test_package LANGUAGES CXX) + +find_package(libcoro REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE libcoro::libcoro) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) diff --git a/recipes/libcoro/all/test_package/conanfile.py b/recipes/libcoro/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0a6bc68712d90 --- /dev/null +++ b/recipes/libcoro/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/libcoro/all/test_package/test_package.cpp b/recipes/libcoro/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..c1c44f942c456 --- /dev/null +++ b/recipes/libcoro/all/test_package/test_package.cpp @@ -0,0 +1,35 @@ +#include +#include +#include + +int main() +{ + auto task = []() -> coro::task { + auto fibonacci = []() -> coro::generator { + int a = 0; + int b = 1; + while (true) + { + co_yield b; + int tmp = a; + a = b; + b += tmp; + } + }; + + size_t i = 0; + for (int x : fibonacci()) + { + std::cout << x << std::endl; + + if (i++ == 10) + { + break; + } + } + co_return; + }; + + coro::sync_wait(task()); + return 0; +} diff --git a/recipes/libcoro/all/test_v1_package/CMakeLists.txt b/recipes/libcoro/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libcoro/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libcoro/all/test_v1_package/conanfile.py b/recipes/libcoro/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libcoro/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/libcoro/config.yml b/recipes/libcoro/config.yml new file mode 100644 index 0000000000000..3e368a245af64 --- /dev/null +++ b/recipes/libcoro/config.yml @@ -0,0 +1,15 @@ +versions: + "0.12.1": + folder: all + "0.12": + folder: all + "0.11.1": + folder: all + "0.10": + folder: all + "0.9": + folder: all + "0.8": + folder: all + "0.7": + folder: all diff --git a/recipes/libcpuid/all/CMakeLists.txt b/recipes/libcpuid/all/CMakeLists.txt deleted file mode 100644 index dcbf69112bb06..0000000000000 --- a/recipes/libcpuid/all/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -include(GNUInstallDirs) - -if(MSVC AND BUILD_SHARED_LIBS) - set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) -endif() - -add_subdirectory(source_subfolder) diff --git a/recipes/libcpuid/all/conandata.yml b/recipes/libcpuid/all/conandata.yml index 133cbeb595d14..a10d26bb3cb6c 100644 --- a/recipes/libcpuid/all/conandata.yml +++ b/recipes/libcpuid/all/conandata.yml @@ -8,7 +8,5 @@ sources: patches: "0.5.1": - patch_file: "patches/0.5.0-cmake-fixes.patch" - base_path: "source_subfolder" "0.5.0": - patch_file: "patches/0.5.0-cmake-fixes.patch" - base_path: "source_subfolder" diff --git a/recipes/libcpuid/all/conanfile.py b/recipes/libcpuid/all/conanfile.py index 68d83bcf3f7fc..819fb78b61c57 100644 --- a/recipes/libcpuid/all/conanfile.py +++ b/recipes/libcpuid/all/conanfile.py @@ -1,18 +1,22 @@ -from conans import CMake, 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.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir + +required_conan_version = ">=1.53.0" class LibCpuidConan(ConanFile): name = "libcpuid" - description = "libcpuid is a small C library for x86 CPU detection and feature extraction" - topics = ("libcpuid", "detec", "cpu", "intel", "amd", "x86_64") + description = "libcpuid is a small C library for x86 CPU detection and feature extraction" license = "https://github.com/anrieff/libcpuid" - homepage = "https://github.com/anrieff/libcpuid" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/anrieff/libcpuid" + topics = ("detec", "cpu", "intel", "amd", "x86_64") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -23,21 +27,8 @@ class LibCpuidConan(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": @@ -45,38 +36,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 + 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 package_id(self): + del self.info.settings.compiler + del self.info.settings.build_type def validate(self): if self.settings.arch not in ("x86", "x86_64"): raise ConanInvalidConfiguration("libcpuid is only available for x86 and x86_64 architecture") 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["ENABLE_DOCS"] = False - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = self.options.shared + tc.variables["ENABLE_DOCS"] = 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("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", "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", "cpuid") @@ -85,7 +82,7 @@ def package_info(self): self.cpp_info.libs = ["cpuid"] 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 diff --git a/recipes/libcpuid/all/test_package/CMakeLists.txt b/recipes/libcpuid/all/test_package/CMakeLists.txt index bbffbda24bead..a08817e34e922 100644 --- a/recipes/libcpuid/all/test_package/CMakeLists.txt +++ b/recipes/libcpuid/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(cpuid REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) diff --git a/recipes/libcpuid/all/test_package/conanfile.py b/recipes/libcpuid/all/test_package/conanfile.py index a2a865893b40b..b71178d68741b 100644 --- a/recipes/libcpuid/all/test_package/conanfile.py +++ b/recipes/libcpuid/all/test_package/conanfile.py @@ -1,10 +1,25 @@ -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_layout, CMake +from conan.tools.env import VirtualRunEnv + class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str, run=True) + + def layout(self): + cmake_layout(self) + + def generate(self): + VirtualRunEnv(self).generate(scope="build") + VirtualRunEnv(self).generate(scope="run") def build(self): cmake = CMake(self) @@ -12,8 +27,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.bindir, "test_package") + self.run(bin_path, env="conanrun") - self.run("cpuid_tool --report", run_environment=True) + self.run("cpuid_tool --report") diff --git a/recipes/libcpuid/all/test_v1_package/CMakeLists.txt b/recipes/libcpuid/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/libcpuid/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/libcpuid/all/test_v1_package/conanfile.py b/recipes/libcpuid/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..a2a865893b40b --- /dev/null +++ b/recipes/libcpuid/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) + + self.run("cpuid_tool --report", run_environment=True) diff --git a/recipes/libcuckoo/all/conanfile.py b/recipes/libcuckoo/all/conanfile.py index 3f070f7ebb3fc..bca46ac3eb7a8 100644 --- a/recipes/libcuckoo/all/conanfile.py +++ b/recipes/libcuckoo/all/conanfile.py @@ -1,7 +1,11 @@ import os -from conans import CMake, ConanFile, tools -required_conan_version = ">=1.33.0" +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, rmdir + +required_conan_version = ">=1.53.0" class LibCuckooConan(ConanFile): @@ -11,46 +15,56 @@ class LibCuckooConan(ConanFile): homepage = "https://github.com/efficient/libcuckoo" url = "https://github.com/conan-io/conan-center-index" topics = ("concurrency", "hashmap", "header-only", "library", "cuckoo") + package_type = "header-library" settings = "arch", "build_type", "compiler", "os" - generators = "cmake", "cmake_find_package_multi" - no_copy_source = True @property def _minimum_cpp_standard(self): return 11 - @property - def _source_subfolder(self): - return "source_subfolder" + 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) + 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], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_EXAMPLES"] = False + tc.variables["BUILD_STRESS_TESTS"] = False + tc.variables["BUILD_TESTS"] = False + tc.variables["BUILD_UNIT_TESTS"] = False + tc.variables["BUILD_UNIVERSAL_BENCHMARK"] = False + tc.generate() + deps = CMakeDeps(self) + deps.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")) # Install with CMake cmake = CMake(self) - cmake.definitions["BUILD_EXAMPLES"] = "OFF" - cmake.definitions["BUILD_STRESS_TESTS"] = "OFF" - cmake.definitions["BUILD_TESTS"] = "OFF" - cmake.definitions["BUILD_UNIT_TESTS"] = "OFF" - cmake.definitions["BUILD_UNIVERSAL_BENCHMARK"] = "OFF" - cmake.configure(source_folder=self._source_subfolder) cmake.install() - # Copy license files - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - # Remove CMake config files (only files in share) - 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() def package_info(self): + self.cpp_info.set_property("cmake_file_name", "libcuckoo") + self.cpp_info.set_property("cmake_target_name", "libcuckoo::libcuckoo") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] if self.settings.os == "Linux": self.cpp_info.system_libs = ["pthread"] - self.cpp_info.names["cmake_find_package"] = "libcuckoo" - self.cpp_info.names["cmake_find_package_multi"] = "libcuckoo" diff --git a/recipes/libcuckoo/all/test_package/CMakeLists.txt b/recipes/libcuckoo/all/test_package/CMakeLists.txt index 5bea3f6fd86e4..bbb37dc967899 100644 --- a/recipes/libcuckoo/all/test_package/CMakeLists.txt +++ b/recipes/libcuckoo/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package) +project(test_package LANGUAGES CXX) set(CMAKE_CXX_STANDARD 11) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(libcuckoo REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/libcuckoo/all/test_package/conanfile.py b/recipes/libcuckoo/all/test_package/conanfile.py index 22583ef52742a..45ce88cf52fa9 100644 --- a/recipes/libcuckoo/all/test_package/conanfile.py +++ b/recipes/libcuckoo/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 TestPackageConan(ConanFile): +class LibcuckooTestConan(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.settings): - bin_path = os.path.join("bin", "test_package") - self.run("{0}".format(bin_path), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libcuckoo/all/test_v1_package/CMakeLists.txt b/recipes/libcuckoo/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..a4368c23dc75f --- /dev/null +++ b/recipes/libcuckoo/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,13 @@ +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(libcuckoo REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE libcuckoo::libcuckoo) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_${CMAKE_CXX_STANDARD}) diff --git a/recipes/libcuckoo/all/test_v1_package/conanfile.py b/recipes/libcuckoo/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..8a5678ccbf761 --- /dev/null +++ b/recipes/libcuckoo/all/test_v1_package/conanfile.py @@ -0,0 +1,15 @@ +import os + +from conans import CMake, ConanFile, 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.settings): + bin_path = os.path.join("bin", "test_package") + self.run("{0}".format(bin_path), run_environment=True) diff --git a/recipes/libcurl/all/conandata.yml b/recipes/libcurl/all/conandata.yml index 65ff7d7373b90..1874298a4a4e7 100644 --- a/recipes/libcurl/all/conandata.yml +++ b/recipes/libcurl/all/conandata.yml @@ -1,36 +1,56 @@ sources: - "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" - "7.83.1": - url: "https://curl.se/download/curl-7.83.1.tar.gz" - sha256: "93fb2cd4b880656b4e8589c912a9fd092750166d555166370247f09d18f5d0c0" - "7.82.0": - url: "https://curl.se/download/curl-7.82.0.tar.gz" - sha256: "910cc5fe279dc36e2cca534172c94364cf3fcf7d6494ba56e6c61a390881ddce" - "7.80.0": - url: "https://curl.se/download/curl-7.80.0.tar.gz" - sha256: "dab997c9b08cb4a636a03f2f7f985eaba33279c1c52692430018fae4a4878dc7" - "7.79.1": - url: "https://curl.se/download/curl-7.79.1.tar.gz" - sha256: "370b11201349816287fb0ccc995e420277fbfcaf76206e309b3f60f0eda090c2" - "7.78.0": - url: "https://curl.se/download/curl-7.78.0.tar.gz" - sha256: "ed936c0b02c06d42cf84b39dd12bb14b62d77c7c4e875ade022280df5dcc81d7" - "7.77.0": - url: "https://curl.se/download/curl-7.77.0.tar.gz" - sha256: "b0a3428acb60fa59044c4d0baae4e4fc09ae9af1d8a3aa84b2e3fbcd99841f77" - "7.76.0": - url: "https://curl.se/download/curl-7.76.0.tar.gz" - sha256: "3b4378156ba09e224008e81dcce854b7ce4d182b1f9cfb97fe5ed9e9c18c6bd3" -patches: - "7.79.0": - - patch_file: "patches/004-no-checksrc.patch" - patch_description: "don't run checksrc" - patch_type: "conan" + "8.10.1": + url: + - "https://curl.se/download/curl-8.10.1.tar.xz" + - "https://github.com/curl/curl/releases/download/curl-8_10_1/curl-8.10.1.tar.xz" + sha256: "73a4b0e99596a09fa5924a4fb7e4b995a85fda0d18a2c02ab9cf134bebce04ee" + "8.10.0": + url: + - "https://curl.se/download/curl-8.10.0.tar.xz" + - "https://github.com/curl/curl/releases/download/curl-8_10_0/curl-8.10.0.tar.xz" + sha256: "e6b142f0e85e954759d37e26a3627e2278137595be80e3a860c4353e4335e5a0" + "8.9.1": + url: + - "https://curl.se/download/curl-8.9.1.tar.xz" + - "https://github.com/curl/curl/releases/download/curl-8_9_1/curl-8.9.1.tar.xz" + sha256: "f292f6cc051d5bbabf725ef85d432dfeacc8711dd717ea97612ae590643801e5" + "8.8.0": + url: + - "https://curl.se/download/curl-8.8.0.tar.xz" + - "https://github.com/curl/curl/releases/download/curl-8_8_0/curl-8.8.0.tar.xz" + sha256: "0f58bb95fc330c8a46eeb3df5701b0d90c9d9bfcc42bd1cd08791d12551d4400" + "8.6.0": + url: + - "https://curl.se/download/curl-8.6.0.tar.xz" + - "https://github.com/curl/curl/releases/download/curl-8_6_0/curl-8.6.0.tar.xz" + sha256: "3ccd55d91af9516539df80625f818c734dc6f2ecf9bada33c76765e99121db15" + "8.5.0": + url: + - "https://curl.se/download/curl-8.5.0.tar.xz" + - "https://github.com/curl/curl/releases/download/curl-8_5_0/curl-8.5.0.tar.xz" + sha256: "42ab8db9e20d8290a3b633e7fbb3cec15db34df65fd1015ef8ac1e4723750eeb" + "8.4.0": + url: + - "https://curl.se/download/curl-8.4.0.tar.xz" + - "https://github.com/curl/curl/releases/download/curl-8_4_0/curl-8.4.0.tar.xz" + sha256: "16c62a9c4af0f703d28bda6d7bbf37ba47055ad3414d70dec63e2e6336f2a82d" + "8.2.1": + url: + - "https://curl.se/download/curl-8.2.1.tar.xz" + - "https://github.com/curl/curl/releases/download/curl-8_2_1/curl-8.2.1.tar.xz" + sha256: "dd322f6bd0a20e6cebdfd388f69e98c3d183bed792cf4713c8a7ef498cba4894" + "8.1.2": + url: + - "https://curl.se/download/curl-8.1.2.tar.xz" + - "https://github.com/curl/curl/releases/download/curl-8_1_2/curl-8.1.2.tar.xz" + sha256: "31b1118eb8bfd43cd95d9a3f146f814ff874f6ed3999b29d94f4d1e7dbac5ef6" + "8.0.1": + url: + - "https://curl.se/download/curl-8.0.1.tar.xz" + - "https://github.com/curl/curl/releases/download/curl-8_0_1/curl-8.0.1.tar.xz" + sha256: "0a381cd82f4d00a9a334438b8ca239afea5bfefcfa9a1025f2bf118e79e0b5f0" + "7.88.1": + url: + - "https://curl.se/download/curl-7.88.1.tar.xz" + - "https://github.com/curl/curl/releases/download/curl-7_88_1/curl-7.88.1.tar.xz" + sha256: "1dae31b2a7c1fe269de99c0c31bb488346aab3459b5ffca909d6938249ae415f" diff --git a/recipes/libcurl/all/conanfile.py b/recipes/libcurl/all/conanfile.py index dd2fe94b93cc0..1eb13831e058b 100644 --- a/recipes/libcurl/all/conanfile.py +++ b/recipes/libcurl/all/conanfile.py @@ -2,7 +2,7 @@ from conan.errors import ConanInvalidConfiguration 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, cmake_layout +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 @@ -13,7 +13,7 @@ import os import re -required_conan_version = ">=1.53.0" +required_conan_version = ">=1.54.0" class LibcurlConan(ConanFile): @@ -25,11 +25,12 @@ class LibcurlConan(ConanFile): topics = ("curl", "data-transfer", "ftp", "gopher", "http", "imap", "ldap", "mqtt", "pop3", "rtmp", "rtsp", "scp", "sftp", "smb", "smtp", "telnet", "tftp") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], - "with_ssl": [False, "openssl", "wolfssl", "schannel", "darwinssl"], + "with_ssl": [False, "openssl", "wolfssl", "schannel", "darwinssl", "mbedtls"], "with_file": [True, False], "with_ftp": [True, False], "with_http": [True, False], @@ -47,7 +48,7 @@ class LibcurlConan(ConanFile): "with_libssh2": [True, False], "with_libidn": [True, False], "with_librtmp": [True, False], - "with_libmetalink": [True, False], + "with_libgsasl": [True, False], "with_libpsl": [True, False], "with_largemaxwritesize": [True, False], "with_nghttp2": [True, False], @@ -63,12 +64,14 @@ class LibcurlConan(ConanFile): "with_cookies": [True, False], "with_ipv6": [True, False], "with_docs": [True, False], + "with_misc_docs": [True, False], "with_verbose_debug": [True, False], "with_symbol_hiding": [True, False], "with_unix_sockets": [True, False], "with_verbose_strings": [True, False], "with_ca_bundle": [False, "auto", "ANY"], "with_ca_path": [False, "auto", "ANY"], + "with_ca_fallback": [True, False], } default_options = { "shared": False, @@ -91,7 +94,7 @@ class LibcurlConan(ConanFile): "with_libssh2": False, "with_libidn": False, "with_librtmp": False, - "with_libmetalink": False, + "with_libgsasl": False, "with_libpsl": False, "with_largemaxwritesize": False, "with_nghttp2": False, @@ -107,12 +110,14 @@ class LibcurlConan(ConanFile): "with_cookies": True, "with_ipv6": True, "with_docs": False, + "with_misc_docs": False, "with_verbose_debug": True, "with_symbol_hiding": False, "with_unix_sockets": True, "with_verbose_strings": True, "with_ca_bundle": "auto", "with_ca_path": "auto", + "with_ca_fallback": False, } @property @@ -131,28 +136,19 @@ def _is_win_x_android(self): def _is_using_cmake_build(self): return is_msvc(self) or self._is_win_x_android - @property - def _has_zstd_option(self): - return Version(self.version) >= "7.72.0" - - @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 - def export_sources(self): 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 self._is_using_cmake_build: + del self.options.with_libgsasl + + if Version(self.version) < "8.7.0": + del self.options.with_misc_docs + # Default options self.options.with_ssl = "darwinssl" if is_apple_os(self) else "openssl" @@ -162,41 +158,45 @@ def configure(self): 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.1s") + self.requires("openssl/[>=1.1 <4]") elif self.options.with_ssl == "wolfssl": - self.requires("wolfssl/5.5.1") + self.requires("wolfssl/5.6.6") + elif self.options.with_ssl == "mbedtls": + self.requires("mbedtls/3.5.0") if self.options.with_nghttp2: - self.requires("libnghttp2/1.50.0") + self.requires("libnghttp2/1.59.0") if self.options.with_libssh2: - self.requires("libssh2/1.10.0") + self.requires("libssh2/1.11.0") if self.options.with_zlib: - self.requires("zlib/1.2.13") + self.requires("zlib/[>=1.2.11 <2]") if self.options.with_brotli: - self.requires("brotli/1.0.9") - if self.options.get_safe("with_zstd"): - self.requires("zstd/1.5.2") + self.requires("brotli/1.1.0") + if self.options.with_zstd: + self.requires("zstd/1.5.5") if self.options.with_c_ares: - self.requires("c-ares/1.18.1") + self.requires("c-ares/[>=1.27 <2]") + if self.options.get_safe("with_libpsl"): + self.requires("libpsl/0.21.1") def validate(self): - if self.info.options.with_ssl == "schannel" and self.info.settings.os != "Windows": + if self.options.with_ssl == "schannel" and self.settings.os != "Windows": raise ConanInvalidConfiguration("schannel only suppported on Windows.") - if self.info.options.with_ssl == "darwinssl" and not is_apple_os(self): + 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.info.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.info.options.with_ssl == "openssl": + if self.options.with_ssl == "openssl": openssl = self.dependencies["openssl"] - if self.info.options.with_ntlm and openssl.options.no_des: + if self.options.with_ntlm and openssl.options.no_des: raise ConanInvalidConfiguration("option with_ntlm=True requires openssl:no_des=False") + if self.options.with_ssl == "wolfssl" and not self.dependencies["wolfssl"].options.with_curl: + raise ConanInvalidConfiguration("option with_ssl=wolfssl requires wolfssl:with_curl=True") def build_requirements(self): if self._is_using_cmake_build: @@ -205,22 +205,19 @@ def build_requirements(self): else: 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") + self.tool_requires("pkgconf/2.1.0") + if self.settings.os in [ "tvOS", "watchOS" ]: + 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 layout(self): - if self._is_using_cmake_build: - cmake_layout(self, src_folder="src") - else: - basic_layout(self, src_folder="src") - def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) - download(self, "https://curl.haxx.se/ca/cacert.pem", "cacert.pem", verify=True, sha256="2cff03f9efdaf52626bd1b451d700605dc1ea000c5da56bd0fc59f8f43071040") + get(self, **self.conan_data["sources"][self.version], strip_root=True) + cert_url = self.conf.get("user.libcurl.cert:url", check_type=str) or "https://curl.se/ca/cacert-2023-08-22.pem" + cert_sha256 = self.conf.get("user.libcurl.cert:sha256", check_type=str) or "23c2469e2a568362a62eecf1b49ed90a15621e6fa30e29947ded3436422de9b9" + download(self, cert_url, "cacert.pem", verify=True, sha256=cert_sha256) def generate(self): env = VirtualBuildEnv(self) @@ -239,9 +236,23 @@ def build(self): else: autotools = Autotools(self) autotools.autoreconf() + # autoreconf is caalled with "--force" which regenerate all files. + # Because we want to use a patched config.sub for tvOS/watchOS, we + # need to call this patch after autoreconf. + self._patch_autoreconf() autotools.configure() autotools.make() + def _patch_autoreconf(self): + # Fix config.sub for tvOS/watchOS + if self.settings.os in [ "tvOS", "watchOS" ]: + 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 _patch_sources(self): apply_conandata_patches(self) self._patch_misc_files() @@ -270,18 +281,21 @@ def _patch_autotools(self): # - 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_folder, "Makefile.am") - replace_in_file(self, top_makefile, "SUBDIRS = lib src", "SUBDIRS = lib") + if Version(self.version) < "8.8.0": + replace_in_file(self, top_makefile, "SUBDIRS = lib src", "SUBDIRS = lib") + else: + replace_in_file(self, top_makefile, "SUBDIRS = lib docs src scripts", "SUBDIRS = lib") replace_in_file(self, top_makefile, "include src/Makefile.inc", "") # 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.libs[0] + 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 ", + "-lz", f"-l{zlib_name} ") if self._is_mingw and self.options.shared: @@ -299,51 +313,93 @@ def _patch_autotools(self): # add directives to build dll # used only for native mingw-make if not cross_building(self): - added_content = load(self, "lib_Makefile_add.am") + # 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_folder, "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_folder, "CMake", "FindZstd.cmake"), - "if(UNIX)", "if(TRUE)") # TODO: check this patch, it's suspicious - replace_in_file(self, cmakelists, - "include(CurlSymbolHiding)", "") + if Version(self.version) < "8.4.0": + replace_in_file(self, cmakelists, + "include(CurlSymbolHiding)", "") + + # brotli + if Version(self.version) < "8.2.0": + replace_in_file(self, cmakelists, "find_package(Brotli QUIET)", "find_package(brotli REQUIRED CONFIG)") + else: + replace_in_file(self, cmakelists, "find_package(Brotli REQUIRED)", "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)") + if Version(self.version) < "8.10.0": + replace_in_file(self, os.path.join(self.source_folder, "CMake", "FindZstd.cmake"), "if(UNIX)", "if(0)") + + # c-ares + if Version(self.version) < "8.10.0": + 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") + else: + replace_in_file(self, cmakelists, "find_package(Cares REQUIRED)", "find_package(c-ares REQUIRED CONFIG)") + replace_in_file(self, cmakelists, "${CARES_LIBRARIES}", "c-ares::cares") + + # libpsl + if Version(self.version) < "8.10.0": + replace_in_file(self, cmakelists, "find_package(LibPSL)", "find_package(libpsl REQUIRED CONFIG)") + replace_in_file(self, cmakelists, "${LIBPSL_LIBRARY}", "libpsl::libpsl") + replace_in_file(self, cmakelists, "${LIBPSL_INCLUDE_DIR}", "${libpsl_INCLUDE_DIRS}") + else: + replace_in_file(self, cmakelists, "${LIBPSL_LIBRARIES}", "libpsl::libpsl") + replace_in_file(self, cmakelists, "${LIBPSL_INCLUDE_DIRS}", "${libpsl_INCLUDE_DIRS}") + replace_in_file(self, cmakelists, "if(LIBPSL_FOUND)", "if(libpsl_FOUND)") + + # libssh2 + if Version(self.version) < "8.10.0": + replace_in_file(self, cmakelists, "find_package(LibSSH2)", "find_package(Libssh2 REQUIRED CONFIG)") + replace_in_file(self, cmakelists, "${LIBSSH2_LIBRARY}", "Libssh2::libssh2") + replace_in_file(self, cmakelists, "${LIBSSH2_INCLUDE_DIR}", "${Libssh2_INCLUDE_DIRS}") + else: + replace_in_file(self, cmakelists, "${LIBSSH2_LIBRARIES}", "Libssh2::libssh2") + replace_in_file(self, cmakelists, "${LIBSSH2_INCLUDE_DIRS}", "${Libssh2_INCLUDE_DIRS}") + replace_in_file(self, cmakelists, "if(LIBSSH2_FOUND)", "if(Libssh2_FOUND)") # 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)", - ) + if Version(self.version) < "8.10.0": + replace_in_file(self, cmakelists, "find_package(NGHTTP2 REQUIRED)", "find_package(libnghttp2 REQUIRED CONFIG)") + else: + replace_in_file(self, cmakelists, "find_package(NGHTTP2)", "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)") + if Version(self.version) < "8.10.0": + replace_in_file(self, cmakelists, "${WolfSSL_LIBRARIES}", "${wolfssl_LIBRARIES}") + replace_in_file(self, cmakelists, "${WolfSSL_INCLUDE_DIRS}", "${wolfssl_INCLUDE_DIRS}") + else: + 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 - if Version(self.version) >= "7.80.0": - replace_in_file(self, - cmakelists, - 'get_target_property(_lib "${_libname}" LOCATION)', - """get_target_property(_type "${_libname}" TYPE) + replace_in_file( + self, + cmakelists, + 'get_target_property(_lib "${_libname}" LOCATION)', + """get_target_property(_type "${_libname}" TYPE) if(${_type} STREQUAL "INTERFACE_LIBRARY") # Reading the INTERFACE_LIBRARY property on non-imported target will error out. continue() endif() get_target_property(_lib "${_libname}" LOCATION)""", - ) + ) def _yes_no(self, value): return "yes" if value else "no" @@ -358,6 +414,7 @@ def _generate_with_autotools(self): 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)}", @@ -385,19 +442,19 @@ def _generate_with_autotools(self): 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.with_unix_sockets)}", + 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: + if 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": path = unix_path(self, self.dependencies["openssl"].package_folder) - tc.configure_args.append(f"--with-{openssl_option}={path}") + tc.configure_args.append(f"--with-openssl={path}") else: - tc.configure_args.append(f"--without-{openssl_option}") + tc.configure_args.append("--without-openssl") if self.options.with_ssl == "wolfssl": path = unix_path(self, self.dependencies["wolfssl"].package_folder) @@ -405,6 +462,12 @@ def _generate_with_autotools(self): else: tc.configure_args.append("--without-wolfssl") + if self.options.with_ssl == "mbedtls": + path = unix_path(self, self.dependencies["mbedtls"].package_folder) + tc.configure_args.append(f"--with-mbedtls={path}") + else: + tc.configure_args.append("--without-mbedtls") + if self.options.with_libssh2: path = unix_path(self, self.dependencies["libssh2"].package_folder) tc.configure_args.append(f"--with-libssh2={path}") @@ -423,12 +486,6 @@ def _generate_with_autotools(self): else: tc.configure_args.append("--without-zlib") - if self._has_zstd_option: - tc.configure_args.append(f"--with-zstd={self._yes_no(self.options.with_zstd)}") - - if self._has_metalink_option: - tc.configure_args.append(f"--with-libmetalink={self._yes_no(self.options.with_libmetalink)}") - if not self.options.with_proxy: tc.configure_args.append("--disable-proxy") @@ -440,10 +497,7 @@ def _generate_with_autotools(self): # ntlm will default to enabled if any SSL options are enabled if not self.options.with_ntlm: - if Version(self.version) <= "7.77.0": - tc.configure_args.append("--disable-crypto-auth") - else: - tc.configure_args.append("--disable-ntlm") + tc.configure_args.append("--disable-ntlm") if not self.options.with_ntlm_wb: tc.configure_args.append("--disable-ntlm-wb") @@ -458,6 +512,14 @@ def _generate_with_autotools(self): elif self.options.with_ca_path != "auto": tc.configure_args.append(f"--with-ca-path={str(self.options.with_ca_path)}") + tc.configure_args.append(f"--with-ca-fallback={self._yes_no(self.options.with_ca_fallback)}") + + if "with_misc_docs" in self.options: + if self.options.with_misc_docs: + tc.configure_args.append("--enable-docs") + else: + tc.configure_args.append("--disable-docs") + # Cross building flags if cross_building(self): if self.settings.os == "Linux" and "arm" in self.settings.arch: @@ -468,6 +530,8 @@ def _generate_with_autotools(self): elif self.settings.os == "Android": pass # this just works, conan is great! + env = tc.environment() + # tweaks for mingw if self._is_mingw: rcflags = "-O COFF" @@ -476,17 +540,15 @@ def _generate_with_autotools(self): elif self.settings.arch == "x86_64": rcflags += " --target=pe-x86-64" tc.extra_defines.append("_AMD64_") - env = tc.environment() 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() + tc.generate(env) tc = PkgConfigDeps(self) tc.generate() tc = AutotoolsDeps(self) @@ -519,52 +581,36 @@ def _generate_with_cmake(self): tc = CMakeToolchain(self, generator="Ninja") else: 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": - tc.variables["CURL_USE_SCHANNEL"] = self.options.with_ssl == "schannel" - elif Version(self.version) >= "7.72.0": - tc.variables["CMAKE_USE_SCHANNEL"] = self.options.with_ssl == "schannel" - else: - tc.variables["CMAKE_USE_WINSSL"] = self.options.with_ssl == "schannel" - if Version(self.version) >= "7.81.0": - tc.variables["CURL_USE_OPENSSL"] = self.options.with_ssl == "openssl" - else: - tc.variables["CMAKE_USE_OPENSSL"] = self.options.with_ssl == "openssl" - if Version(self.version) >= "7.81.0": - tc.variables["CURL_USE_WOLFSSL"] = self.options.with_ssl == "wolfssl" - elif Version(self.version) >= "7.70.0": - tc.variables["CMAKE_USE_WOLFSSL"] = self.options.with_ssl == "wolfssl" + tc.variables["CURL_USE_SCHANNEL"] = self.options.with_ssl == "schannel" + tc.variables["CURL_USE_OPENSSL"] = self.options.with_ssl == "openssl" + tc.variables["CURL_USE_WOLFSSL"] = self.options.with_ssl == "wolfssl" + tc.variables["CURL_USE_MBEDTLS"] = self.options.with_ssl == "mbedtls" tc.variables["USE_NGHTTP2"] = self.options.with_nghttp2 tc.variables["CURL_ZLIB"] = self.options.with_zlib tc.variables["CURL_BROTLI"] = self.options.with_brotli - if self._has_zstd_option: - tc.variables["CURL_ZSTD"] = self.options.with_zstd - if Version(self.version) >= "7.81.0": - tc.variables["CURL_USE_LIBSSH2"] = self.options.with_libssh2 - else: - tc.variables["CMAKE_USE_LIBSSH2"] = self.options.with_libssh2 + tc.variables["CURL_ZSTD"] = self.options.with_zstd + tc.variables["CURL_USE_LIBPSL"] = self.options.with_libpsl + tc.variables["CURL_USE_LIBSSH2"] = self.options.with_libssh2 tc.variables["ENABLE_ARES"] = self.options.with_c_ares if not self.options.with_c_ares: 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 - if Version(self.version) >= "7.75.0": - tc.variables["USE_LIBIDN2"] = self.options.with_libidn + 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": - tc.variables["CURL_DISABLE_CRYPTO_AUTH"] = True - else: - tc.variables["CURL_DISABLE_NTLM"] = True + tc.variables["CURL_DISABLE_NTLM"] = True tc.variables["NTLM_WB_ENABLED"] = self.options.with_ntlm_wb if self.options.with_ca_bundle: @@ -577,8 +623,20 @@ def _generate_with_cmake(self): else: tc.cache_variables["CURL_CA_PATH"] = "none" + tc.cache_variables["CURL_CA_FALLBACK"] = self.options.with_ca_fallback + + # TODO: remove this when https://github.com/conan-io/conan/issues/12180 will be fixed. + if Version(self.version) >= "8.3.0": + tc.variables["HAVE_SSL_SET0_WBIO"] = False + if Version(self.version) >= "8.4.0": + tc.variables["HAVE_OPENSSL_SRP"] = True + tc.variables["HAVE_SSL_CTX_SET_QUIC_METHOD"] = True + tc.generate() + deps = CMakeDeps(self) + deps.generate() + def package(self): 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")) @@ -588,16 +646,15 @@ def package(self): rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) else: 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)}"]) - fix_apple_shared_install_name(self) + autotools.install() rmdir(self, os.path.join(self.package_folder, "share")) rm(self, "*.la", os.path.join(self.package_folder, "lib")) if self._is_mingw and self.options.shared: # Handle only mingw libs - copy(self, pattern="*.dll", src=self.build_folder, dst="bin", keep_path=False) - copy(self, pattern="*.dll.a", src=self.build_folder, dst="lib", keep_path=False) - copy(self, pattern="*.lib", src=self.build_folder, 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): @@ -627,10 +684,9 @@ 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") + self.cpp_info.components["curl"].frameworks.append("CoreFoundation") + self.cpp_info.components["curl"].frameworks.append("CoreServices") + 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": @@ -649,6 +705,8 @@ def package_info(self): self.cpp_info.components["curl"].requires.append("openssl::openssl") if self.options.with_ssl == "wolfssl": self.cpp_info.components["curl"].requires.append("wolfssl::wolfssl") + if self.options.with_ssl == "mbedtls": + self.cpp_info.components["curl"].requires.append("mbedtls::mbedtls") if self.options.with_nghttp2: self.cpp_info.components["curl"].requires.append("libnghttp2::libnghttp2") if self.options.with_libssh2: @@ -657,10 +715,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/patches/004-no-checksrc.patch b/recipes/libcurl/all/patches/004-no-checksrc.patch deleted file mode 100644 index 7a5cb866faa93..0000000000000 --- a/recipes/libcurl/all/patches/004-no-checksrc.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -ruN a/lib/Makefile.am b/lib/Makefile.am ---- a/lib/Makefile.am -+++ b/lib/Makefile.am -@@ -138,8 +138,6 @@ - CS_ = $(CS_0) - - checksrc: -- $(CHECKSRC)(@PERL@ $(srcdir)/checksrc.pl -D$(srcdir) -W$(srcdir)/curl_config.h \ -- $(srcdir)/*.[ch] $(srcdir)/vauth/*.[ch] $(srcdir)/vtls/*.[ch] $(srcdir)/vquic/*.[ch] $(srcdir)/vssh/*.[ch]) - - if CURLDEBUG - # for debug builds, we scan the sources on all regular make invokes diff --git a/recipes/libcurl/all/test_package/CMakeLists.txt b/recipes/libcurl/all/test_package/CMakeLists.txt index a36a89aea9b2b..cbc46379aedd1 100644 --- a/recipes/libcurl/all/test_package/CMakeLists.txt +++ b/recipes/libcurl/all/test_package/CMakeLists.txt @@ -4,4 +4,4 @@ project(test_package C) find_package(CURL REQUIRED) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} CURL::libcurl) +target_link_libraries(${PROJECT_NAME} PRIVATE CURL::libcurl) 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 index 87b6e499b5d8e..448a8a5aaf0d7 100644 --- a/recipes/libcurl/all/test_v1_package/CMakeLists.txt +++ b/recipes/libcurl/all/test_v1_package/CMakeLists.txt @@ -4,7 +4,6 @@ project(test_package C) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(CURL REQUIRED) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} CURL::libcurl) diff --git a/recipes/libcurl/config.yml b/recipes/libcurl/config.yml index 67489a56924a2..eb9a8179a3b87 100644 --- a/recipes/libcurl/config.yml +++ b/recipes/libcurl/config.yml @@ -1,21 +1,23 @@ versions: - "7.86.0": + "8.10.1": folder: all - "7.85.0": + "8.10.0": folder: all - "7.84.0": + "8.9.1": folder: all - "7.83.1": + "8.8.0": folder: all - "7.82.0": + "8.6.0": folder: all - "7.80.0": + "8.5.0": folder: all - "7.79.1": + "8.4.0": folder: all - "7.78.0": + "8.2.1": folder: all - "7.77.0": + "8.1.2": folder: all - "7.76.0": + "8.0.1": + folder: all + "7.88.1": folder: all diff --git a/recipes/libcvd/all/conandata.yml b/recipes/libcvd/all/conandata.yml new file mode 100644 index 0000000000000..8c0de4fe10731 --- /dev/null +++ b/recipes/libcvd/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "2.5.1": + url: "https://github.com/edrosten/libcvd/archive/refs/tags/RELEASE_2_5_1.tar.gz" + sha256: "c077e426e1bd6e6c7af3b9330ec1496a59789f2d0c529dc18049fc653947dd6e" diff --git a/recipes/libcvd/all/conanfile.py b/recipes/libcvd/all/conanfile.py new file mode 100644 index 0000000000000..da62d0fad1d30 --- /dev/null +++ b/recipes/libcvd/all/conanfile.py @@ -0,0 +1,171 @@ +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, cmake_layout +from conan.tools.files import copy, get, save, rmdir, replace_in_file +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" + + +class LibCVDConan(ConanFile): + name = "libcvd" + description = "libCVD - efficient and easy-to-use C++ computer vision library" + license = "BSD-2-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/edrosten/libcvd" + topics = ("computer-vision",) + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_libjpeg": [False, "libjpeg", "libjpeg-turbo", "mozjpeg"], + "with_libpng": [True, False], + "with_libtiff": [True, False], + "with_ffmpeg": [True, False], + "with_libdc1394": [True, False], + "with_opengl": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_libjpeg": "libjpeg", + "with_libpng": True, + "with_libtiff": True, + # Build without video support by default + "with_ffmpeg": False, + "with_libdc1394": False, + "with_opengl": False, + } + + @property + def _min_cppstd(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "7", + "clang": "5", + "apple-clang": "10", + "msvc": "191", + "Visual Studio": "15", + } + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + # OpenGL is always used on Windows + del self.options.with_opengl + + 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://github.com/edrosten/libcvd/blob/main/cmake/CVDFindAllDeps.cmake + # Used in a public header https://github.com/edrosten/libcvd/blob/RELEASE_2_5_0/cvd/canny.h#L4 + self.requires("toon/3.2", transitive_headers=True, transitive_libs=True) + if self.options.with_ffmpeg: + # FFMPEG v5.x+ are not supported + self.requires("ffmpeg/4.4.4", transitive_libs=True) + if self.options.with_libdc1394: + # FIXME: libidc1394 seems to be missing raw1394 dependency + # test_package fails with "undefined reference to `raw1394_new_handle'" etc + self.requires("libdc1394/2.2.7") + if self.options.with_libjpeg == "libjpeg-turbo": + self.requires("libjpeg-turbo/3.0.2") + elif self.options.with_libjpeg == "libjpeg": + self.requires("libjpeg/9e") + elif self.options.with_libjpeg == "mozjpeg": + self.requires("mozjpeg/4.1.5") + if self.options.with_libpng: + self.requires("libpng/[>=1.6 <2]") + if self.options.with_libtiff: + self.requires("libtiff/4.6.0") + if self.options.get_safe("with_opengl", True): + # https://github.com/edrosten/libcvd/blob/RELEASE_2_5_0/cvd/videodisplay.h#L18-L20 + self.requires("opengl/system", transitive_headers=True, transitive_libs=True) + + 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." + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CVD_ENABLE_TESTS"] = False + tc.variables["CVD_ENABLE_PROGS"] = False + tc.variables["CVD_ENABLE_EXAMPLES"] = False + tc.variables["CMAKE_DISABLE_FIND_PACKAGE_ffmpeg"] = not self.options.with_ffmpeg + tc.variables["CMAKE_DISABLE_FIND_PACKAGE_libdc1394"] = not self.options.with_libdc1394 + tc.variables["CMAKE_DISABLE_FIND_PACKAGE_JPEG"] = not self.options.with_libjpeg + tc.variables["CMAKE_DISABLE_FIND_PACKAGE_PNG"] = not self.options.with_libpng + tc.variables["CMAKE_DISABLE_FIND_PACKAGE_TIFF"] = not self.options.with_libtiff + tc.variables["CMAKE_DISABLE_FIND_PACKAGE_OpenGL"] = not self.options.get_safe("with_opengl", True) + tc.variables["CMAKE_DISABLE_FIND_PACKAGE_X11"] = not self.options.get_safe("with_opengl", True) + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() + + deps = CMakeDeps(self) + deps.set_property("ffmpeg", "cmake_file_name", "CVD_FFMPEG") + deps.set_property("libdc1394", "cmake_file_name", "CVD_dc1394v2") + deps.set_property("toon", "cmake_file_name", "CVD_TooN") + deps.generate() + + def _patch_sources(self): + # Use deps from Conan + save(self, os.path.join(self.source_folder, "cmake", "CVDFindFFMPEG.cmake"), + "find_package(CVD_FFMPEG REQUIRED)\n" if self.options.with_ffmpeg else "") + save(self, os.path.join(self.source_folder, "cmake", "CVDFinddc1394v2.cmake"), + "find_package(CVD_dc1394v2 REQUIRED)\n" if self.options.with_libdc1394 else "") + save(self, os.path.join(self.source_folder, "cmake", "CVDFindTooN.cmake"), + "set(CVD_TooN_FOUND FALSE)\n") + + # For debugging + save(self, os.path.join(self.source_folder, "cmake", "CVDFindAllDeps.cmake"), + '\nmessage(INFO "CVD_DEP_LIBS: ${CVD_DEP_LIBS}")\n', append=True) + + # Install DLL + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "install(TARGETS ${PROJECT_NAME} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib)", + "install(TARGETS ${PROJECT_NAME} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib RUNTIME DESTINATION bin)") + + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + rmdir(self, os.path.join(self.package_folder, "cmake")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "CVD") + self.cpp_info.set_property("cmake_target_name", "cvd") + self.cpp_info.set_property("cmake_find_mode", "both") + + postfix = "_debug" if self.settings.build_type == "Debug" else "" + self.cpp_info.libs = ["cvd" + postfix] + + if self.settings.os == "Windows": + self.cpp_info.system_libs.append("ws2_32") diff --git a/recipes/libcvd/all/test_package/CMakeLists.txt b/recipes/libcvd/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..22605b8561ab7 --- /dev/null +++ b/recipes/libcvd/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(CVD REQUIRED MODULE) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE ${CVD_LIBRARIES}) +target_include_directories(${PROJECT_NAME} PRIVATE ${CVD_INCLUDE_DIRS}) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/libcvd/all/test_package/conanfile.py b/recipes/libcvd/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/libcvd/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libcvd/all/test_package/test_package.cpp b/recipes/libcvd/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..4e0988c93bbd2 --- /dev/null +++ b/recipes/libcvd/all/test_package/test_package.cpp @@ -0,0 +1,85 @@ +// https://github.com/edrosten/libcvd/blob/RELEASE_2_5_0/examples/distance_transform.cc + +// Copyright (c) 2005--2013, The Authors +// All rights reserved. +// +// 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. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER 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 AUTHOR OR OTHER 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. + +#include +#include + +#include +#include + +using CVD::byte; +using CVD::euclidean_distance_transform_sq; +using CVD::Image; +using CVD::ImageRef; +using CVD::img_save; +using CVD::Rgb; +using std::max_element; +using std::mt19937; +using std::uniform_int_distribution; + +int main() +{ + //Create a blank image. + Image im(ImageRef(128, 128), 0); + + mt19937 engine; + uniform_int_distribution rand_x(0, im.size().x - 1); + uniform_int_distribution rand_y(0, im.size().y - 1); + + //Scatter down 7 points at random. + for(int i = 1; i < 8; i++) + im[rand_y(engine)][rand_x(engine)] = i; + + Image dt(im.size()); + Image inverse_dt(im.size()); + + //Perform the distance transform + euclidean_distance_transform_sq(im, dt, inverse_dt); + + //Create an output which is the distance transfom of the input, + //but coloured according to which pixel is closest. + int largest_distance = *max_element(dt.begin(), dt.end()); + + Image> out(im.size()); + + for(int y = 0; y < im.size().y; y++) + for(int x = 0; x < im.size().x; x++) + { + int c = floor(sqrt(dt[y][x] * 1.0 / largest_distance) * 255 + .5); + + Rgb r(0, 0, 0); + if(im[inverse_dt[y][x]] & 1) + r.red = c; + if(im[inverse_dt[y][x]] & 2) + r.green = c; + if(im[inverse_dt[y][x]] & 4) + r.blue = c; + + out[y][x] = r; + } + + img_save(out, "distance_transform_result.png"); +} diff --git a/recipes/libcvd/config.yml b/recipes/libcvd/config.yml new file mode 100644 index 0000000000000..eab83a303df52 --- /dev/null +++ b/recipes/libcvd/config.yml @@ -0,0 +1,3 @@ +versions: + "2.5.1": + folder: all diff --git a/recipes/libdatrie/all/conandata.yml b/recipes/libdatrie/all/conandata.yml new file mode 100644 index 0000000000000..96b260a1cc4e3 --- /dev/null +++ b/recipes/libdatrie/all/conandata.yml @@ -0,0 +1,9 @@ +sources: + "0.2.13": + url: "https://linux.thai.net/pub/ThaiLinux/software/libthai/libdatrie-0.2.13.tar.xz" + sha256: "12231bb2be2581a7f0fb9904092d24b0ed2a271a16835071ed97bed65267f4be" +patches: + "0.2.13": + - patch_file: "patches/fix-exports.patch" + patch_type: "portability" + patch_description: "Fix .def exports for Windows" diff --git a/recipes/libdatrie/all/conanfile.py b/recipes/libdatrie/all/conanfile.py new file mode 100644 index 0000000000000..7ec417808f17c --- /dev/null +++ b/recipes/libdatrie/all/conanfile.py @@ -0,0 +1,138 @@ +import os + +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 Environment, VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir, save, 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 + +required_conan_version = ">=1.54.0" + + +class LibdatrieConan(ConanFile): + name = "libdatrie" + description = "Implementation of double-array structure for representing tries" + license = "LGPL-2.1-or-later" + homepage = "https://linux.thai.net/projects/datrie" + url = "https://github.com/conan-io/conan-center-index" + topics = ("trie", "double-array-trie", "datrie") + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "tools": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "tools": False, + } + + @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 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 export_sources(self): + export_conandata_patches(self) + + def requirements(self): + self.requires("libiconv/1.17") + + def validate(self): + if is_apple_os(self) and self.options.shared: + # Fails due to build script bugs + raise ConanInvalidConfiguration("shared builds on Apple OS-s are not 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", check_type=str): + self.tool_requires("msys2/cci.latest") + if is_msvc(self): + self.tool_requires("automake/1.16.5") + + 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 = AutotoolsToolchain(self) + tc.configure_args.extend([ + "--disable-doxygen-doc", + ]) + if is_msvc(self): + tc.extra_cflags.append("-FS") + tc.extra_cxxflags.append("-FS") + tc.generate() + + if is_msvc(self): + env = Environment() + iconv_info = self.dependencies["libiconv"].cpp_info + env.append("CPPFLAGS", [f"-I{unix_path(self, iconv_info.includedir)}"] + [f"-D{d}" for d in iconv_info.defines]) + env.append("_LINK_", [lib if lib.endswith(".lib") else f"{lib}.lib" for lib in iconv_info.libs]) + env.append("LDFLAGS", [f"-L{unix_path(self, iconv_info.libdir)}"]) + env.vars(self).save_script("conanautotoolsdeps_cl_workaround") + else: + tc = AutotoolsDeps(self) + tc.generate() + + if is_msvc(self): + env = Environment() + 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("LD", "link -nologo") + env.define("AR", f"{ar_wrapper} lib") + env.vars(self).save_script("conanbuild_msvc") + + def build(self): + apply_conandata_patches(self) + autotools = Autotools(self) + autotools.configure() + if not self.options.tools: + save(self, os.path.join(self.build_folder, "tools", "Makefile"), "all:\n\t\ninstall:\n\t\n") + # Unnecessary and breaks MSVC build + save(self, os.path.join(self.build_folder, "man", "Makefile"), "all:\n\t\ninstall:\n\t\n") + autotools.make() + + def package(self): + copy(self, "COPYING", 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, "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", "datrie.dll.lib"), + os.path.join(self.package_folder, "lib", "datrie.lib")) + + def package_info(self): + self.cpp_info.set_property("pkg_config_name", "datrie-0.2") + self.cpp_info.libs = ["datrie"] diff --git a/recipes/libdatrie/all/patches/fix-exports.patch b/recipes/libdatrie/all/patches/fix-exports.patch new file mode 100644 index 0000000000000..70886973e7745 --- /dev/null +++ b/recipes/libdatrie/all/patches/fix-exports.patch @@ -0,0 +1,7 @@ +--- datrie/libdatrie.def ++++ datrie/libdatrie.def +@@ -1,3 +1,4 @@ ++EXPORTS + alpha_map_new + alpha_map_clone + alpha_map_free diff --git a/recipes/libdatrie/all/test_package/CMakeLists.txt b/recipes/libdatrie/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..baf1d9bc4e755 --- /dev/null +++ b/recipes/libdatrie/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) + +find_package(libdatrie REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE libdatrie::libdatrie) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) diff --git a/recipes/libdatrie/all/test_package/conanfile.py b/recipes/libdatrie/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/libdatrie/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libdatrie/all/test_package/test_package.c b/recipes/libdatrie/all/test_package/test_package.c new file mode 100644 index 0000000000000..683c115b1b56f --- /dev/null +++ b/recipes/libdatrie/all/test_package/test_package.c @@ -0,0 +1,15 @@ +#include + +int main(void) { + AlphaMap *en_map = alpha_map_new(); + if (!en_map) + return 1; + if (alpha_map_add_range(en_map, 0x0061, 0x007a) != 0) + return 1; + Trie *test_trie = trie_new(en_map); + if (!test_trie) + return 1; + trie_free(test_trie); + alpha_map_free(en_map); + return 0; +} diff --git a/recipes/libdatrie/config.yml b/recipes/libdatrie/config.yml new file mode 100644 index 0000000000000..58b2f36b9fab3 --- /dev/null +++ b/recipes/libdatrie/config.yml @@ -0,0 +1,3 @@ +versions: + "0.2.13": + folder: all diff --git a/recipes/libdb/all/conandata.yml b/recipes/libdb/all/conandata.yml index 0707d6df726bf..f522bcff96322 100644 --- a/recipes/libdb/all/conandata.yml +++ b/recipes/libdb/all/conandata.yml @@ -5,10 +5,11 @@ sources: patches: "5.3.28": - patch_file: "patches/0001-rename_atomic_compare_exchange.patch" - base_path: "source_subfolder" + patch_description: "Rename __atomic_compare_exchange to __atomic_compare_exchange_db" + patch_type: "portability" - patch_file: "patches/0002-no-conditional-tcl-include.patch" - base_path: "source_subfolder" + patch_description: "Always include tcl.h. Remove conditions." + patch_type: "conan" - patch_file: "patches/0003-msvc-db_tcl-add-static-configuration.patch" - base_path: "source_subfolder" - - patch_file: "patches/0004-msvc-tcl-include-conanbuildinfo-props.patch" - base_path: "source_subfolder" + patch_description: "Add static configuration" + patch_type: "conan" diff --git a/recipes/libdb/all/conanfile.py b/recipes/libdb/all/conanfile.py index 1fd743e1c3a19..7e15eabaa687f 100644 --- a/recipes/libdb/all/conanfile.py +++ b/recipes/libdb/all/conanfile.py @@ -1,10 +1,17 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, MSBuild, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile, conan_version +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, replace_in_file, rename, rm, rmdir +from conan.tools.microsoft import MSBuild, MSBuildDeps, MSBuildToolchain, is_msvc, check_min_vs, vs_layout +from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.scm import Version +from conan.tools.apple import fix_apple_shared_install_name + import glob import os import shutil -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.55.0" class LibdbConan(ConanFile): @@ -14,7 +21,7 @@ class LibdbConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.oracle.com/database/berkeley-db" license = ("BSD-3-Clause") - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -29,13 +36,6 @@ class LibdbConan(ConanFile): "with_cxx": False, } - generators = "visual_studio" - - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" @property def _mingw_build(self): @@ -45,116 +45,157 @@ def _mingw_build(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 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.compiler == "Visual Studio": - del self.options.with_cxx + self.options.rm_safe("fPIC") + if is_msvc(self): + self.options.rm_safe("with_cxx") def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") if not self.options.get_safe("with_cxx", False): - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.settings.compiler.rm_safe("libcxx") + self.settings.compiler.rm_safe("cppstd") def requirements(self): if self.options.with_tcl: self.requires("tcl/8.6.10") def validate(self): - if self.settings.compiler == "Visual Studio": + if is_msvc(self) and check_min_vs(self, "192", raise_invalid=False): # FIXME: it used to work with previous versions of Visual Studio 2019 in CI of CCI. - if tools.Version(self.settings.compiler.version) == "16": - raise ConanInvalidConfiguration("Visual Studio 2019 not supported.") + # Currently won't work with Visual Studio 2019 or newer + raise ConanInvalidConfiguration(f"{self.ref} Visual Studio 2019 is currently not supported. Contributions are welcomed!") + + if self.settings.os == "Macos" and self.settings.arch == "armv8": + raise ConanInvalidConfiguration(f"{self.ref} Macos Apple Sillicon is currently not supported. Contributions are welcomed!") if self.options.get_safe("with_cxx"): - if self.settings.compiler == "clang": - if tools.Version(self.settings.compiler.version) <= "5": - raise ConanInvalidConfiguration("This compiler version is unsupported") - if self.settings.compiler == "apple-clang": - if tools.Version(self.settings.compiler.version) < "10": - raise ConanInvalidConfiguration("This compiler version is unsupported") + if self.settings.compiler == "clang" and Version(self.settings.compiler.version) < "6": + raise ConanInvalidConfiguration(f"{self.ref} does not support clang<6 with_cxx=True") + if self.settings.compiler == "apple-clang" and Version(self.settings.compiler.version) < "10": + raise ConanInvalidConfiguration(f"{self.ref} does not support apple-clang<10 with_cxx=True") 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 self._settings_build.os == "Windows": + self.tool_requires("gnu-config/cci.20201022") + + def layout(self): + if is_msvc(self): + vs_layout(self) + else: + 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 _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - - if self.settings.compiler != "Visual Studio": + apply_conandata_patches(self) + if is_msvc(self): + 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"" + projects = ["db", "db_sql", "db_stl"] + if self.options.with_tcl: + projects.append("db_tcl") + for project in projects: + # ================================= + # TODO: To remove once https://github.com/conan-io/conan/pull/12817 is available in conan client + project_file = os.path.join(self.source_folder, "build_windows", "VS10", f"{project}.vcxproj") + toolset = MSBuildToolchain(self).toolset + replace_in_file( + self, project_file, + "", + f" {toolset}\n ", + ) + replace_in_file( + self, project_file, + "", + f"\n {toolset}", + ) + if import_conan_generators: + replace_in_file( + self, project_file, + "", + f"{import_conan_generators}", + ) + # ================================= + + for file in glob.glob(os.path.join(self.source_folder, "build_windows", "VS10", "*.vcxproj")): + pass + # The WindowsTargetPlatformVersion selected below will depend on what Windows SDK is installed. + replace_in_file(self, file, + "", + # 10.0 should select the "latest" SDK available, but doesn't always work. It may be necessary to specify a specific version + #"10.0") + "10.0.20348.0") + #"10.0.19041.0") + else: for subdir in [ "dist", os.path.join("lang", "sql", "jdbc"), os.path.join("lang", "sql", "odbc"), os.path.join("lang", "sql", "sqlite"), ]: - shutil.copy(self._user_info_build["gnu-config"].CONFIG_SUB, - os.path.join(self._source_subfolder, subdir, "config.sub")) - shutil.copy(self._user_info_build["gnu-config"].CONFIG_GUESS, - os.path.join(self._source_subfolder, subdir, "config.guess")) - - for file in glob.glob(os.path.join(self._source_subfolder, "build_windows", "VS10", "*.vcxproj")): - tools.replace_in_file(file, - "", - "10.0.17763.0") - - dist_configure = os.path.join(self._source_subfolder, "dist", "configure") - tools.replace_in_file(dist_configure, "../$sqlite_dir", "$sqlite_dir") - tools.replace_in_file(dist_configure, - "\n --disable-option-checking)", - "\n --datarootdir=*)" - "\n ;;" - "\n --disable-option-checking)") - - 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 == "apple-clang" and tools.Version(self.settings.compiler.version) >= "12": - self._autotools.flags.append("-Wno-error=implicit-function-declaration") - conf_args = [ - "--enable-debug" if self.settings.build_type == "Debug" else "--disable-debug", - "--enable-mingw" if self._mingw_build else "--disable-mingw", - "--enable-compat185", - "--enable-sql", - ] - if self.options.with_cxx: - conf_args.extend(["--enable-cxx", "--enable-stl"]) - else: - conf_args.extend(["--disable-cxx", "--disable-stl"]) + shutil.copy(self.dependencies.build["gnu-config"].conf_info.get("user.gnu-config:config_sub"), + os.path.join(self.source_folder, subdir, "config.sub")) + shutil.copy(self.dependencies.build["gnu-config"].conf_info.get("user.gnu-config:config_guess"), + os.path.join(self.source_folder, subdir, "config.guess")) + + dist_configure = os.path.join(self.source_folder, "dist", "configure") + replace_in_file(self, dist_configure, "../$sqlite_dir", "$sqlite_dir") + replace_in_file(self, dist_configure, + "\n --disable-option-checking)", + "\n --datarootdir=*)" + "\n ;;" + "\n --disable-option-checking)") + + + def generate(self): + if is_msvc(self): + tc = MSBuildToolchain(self) + tc.generate() + + deps = MSBuildDeps(self) + deps.generate() - if self.options.shared: - conf_args.extend(["--enable-shared", "--disable-static"]) else: - conf_args.extend(["--disable-shared", "--enable-static"]) - if self.options.with_tcl: - conf_args.append("--with-tcl={}".format(tools.unix_path(os.path.join(self.deps_cpp_info["tcl"].rootpath, "lib")))) - self._autotools.configure(configure_dir=os.path.join(self.source_folder, self._source_subfolder, "dist"), args=conf_args) - if self.settings.os == "Windows" and self.options.shared: - tools.replace_in_file(os.path.join(self.build_folder, "libtool"), - "\ndeplibs_check_method=", - "\ndeplibs_check_method=pass_all\n#deplibs_check_method=") - tools.replace_in_file(os.path.join(self.build_folder, "Makefile"), - ".a", - ".dll.a") - return self._autotools + tc = AutotoolsToolchain(self) + tc.configure_args.append("--enable-debug" if self.settings.build_type == "Debug" else "--disable-debug") + tc.configure_args.append("--enable-mingw" if self._mingw_build else "--disable-mingw") + tc.configure_args.append("--enable-compat185") + tc.configure_args.append("--enable-sql") + if self.options.with_cxx: + tc.configure_args.extend(["--enable-cxx", "--enable-stl"]) + else: + tc.configure_args.extend(["--disable-cxx", "--disable-stl"]) + + if self.options.shared: + tc.configure_args.extend(["--enable-shared", "--disable-static"]) + else: + tc.configure_args.extend(["--disable-shared", "--enable-static"]) + + if self.options.with_tcl: + tc.configure_args.append(f"--with-tcl={os.path.join(self.dependencies['tcl'].package_folder, 'lib')}") + + if self.settings.compiler == "apple-clang" and Version(self.settings.compiler.version) >= "12": + tc.extra_cflags.append("-Wno-error=implicit-function-declaration") + if self.settings.compiler == "clang" and Version(self.settings.compiler.version) >= "15": + # -Wimplicit-function-declaration is default as of clang 15 + # https://releases.llvm.org/15.0.0/tools/clang/docs/ReleaseNotes.html#improvements-to-clang-s-diagnostics + # https://releases.llvm.org/16.0.0/tools/clang/docs/ReleaseNotes.html#potentially-breaking-changes + tc.extra_cflags.append("-Wno-error=implicit-function-declaration") + + tc.generate() + + deps = AutotoolsDeps(self) + deps.generate() @property def _msvc_build_type(self): @@ -169,37 +210,38 @@ def _msvc_build_type(self): def _msvc_arch(self): return self._msvc_platforms[str(self.settings.arch)] - def _build_msvc(self): - projects = ["db", "db_sql", "db_stl"] - if self.options.with_tcl: - projects.append("db_tcl") - msbuild = MSBuild(self) - upgraded = False - for project in projects: - msbuild.build(os.path.join(self._source_subfolder, "build_windows", "VS10", "{}.vcxproj".format(project)), - build_type=self._msvc_build_type, platforms=self._msvc_platforms, - upgrade_project=not upgraded) - upgraded = True - def build(self): self._patch_sources() - if self.settings.compiler == "Visual Studio": - self._build_msvc() + if is_msvc(self): + msbuild = MSBuild(self) + projects = ["db", "db_sql", "db_stl"] + if self.options.with_tcl: + projects.append("db_tcl") + for project in projects: + project_file = os.path.join(self.source_folder, "build_windows", "VS10", f"{project}.vcxproj") + build_type = "{}{}".format( + "" if self.options.shared else "Static ", + "Debug" if self.settings.build_type == "Debug" else "Release", + ) + msbuild.build_type = build_type if Version(conan_version).major >= 2 else f"\"{build_type}\"" + msbuild.platform = "Win32" if self.settings.arch == "x86" else msbuild.platform + msbuild.build(sln=project_file) else: - autotools = self._configure_autotools() + autotools = Autotools(self) + autotools.configure(build_script_folder=os.path.join(self.source_folder, "dist")) 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")) bindir = os.path.join(self.package_folder, "bin") libdir = os.path.join(self.package_folder, "lib") - if self.settings.compiler == "Visual Studio": - build_windows = os.path.join(self._source_subfolder, "build_windows") - build_dir = os.path.join(self._source_subfolder, "build_windows", self._msvc_arch, self._msvc_build_type) - self.copy("*.lib", src=build_dir, dst="lib") - self.copy("*.dll", src=build_dir, dst="bin") + if is_msvc(self): + build_windows = os.path.join(self.source_folder, "build_windows") + build_dir = os.path.join(self.source_folder, "build_windows", self._msvc_arch, self._msvc_build_type) + copy(self, "*.lib", src=build_dir, dst=libdir) + copy(self, "*.dll", src=build_dir, dst=bindir) for fn in ("db.h", "db.cxx", "db_int.h", "dbstl_common.h"): - self.copy(fn, src=build_windows, dst="include") + copy(self, fn, src=build_windows, dst=os.path.join(self.package_folder, "include")) def _lib_to_msvc_lib(lib): shared_suffix = "" if self.options.shared else "s" @@ -209,16 +251,16 @@ def _lib_to_msvc_lib(lib): msvc_libs = [_lib_to_msvc_lib(lib) for lib in self._libs] for lib, msvc_lib in zip(self._libs, msvc_libs): - tools.rename(os.path.join(libdir, "{}.lib".format(msvc_lib)), + rename(self, os.path.join(libdir, "{}.lib".format(msvc_lib)), os.path.join(libdir, "{}.lib".format(lib))) else: - autotools = self._configure_autotools() + autotools = Autotools(self) autotools.install() if self.settings.os == "Windows": for fn in os.listdir(libdir): if fn.endswith(".dll"): - tools.rename(os.path.join(libdir, fn), os.path.join(bindir, fn)) + rename(self, os.path.join(libdir, fn), os.path.join(bindir, fn)) for fn in os.listdir(bindir): if not fn.endswith(".dll"): binpath = os.path.join(bindir, fn) @@ -232,13 +274,14 @@ def _lib_to_msvc_lib(lib): os.remove(os.path.join(bindir, fn)) if not os.listdir(bindir): - tools.rmdir(bindir) + rmdir(self, bindir) - tools.rmdir(os.path.join(self.package_folder, "docs")) - tools.remove_files_by_mask(libdir, "*.la") + rmdir(self, os.path.join(self.package_folder, "docs")) + rm(self, "*.la", libdir) if not self.options.shared: # autotools installs the static libraries twice as libXXX.a and libXXX-5.3.a ==> remove libXXX-5.3.a - tools.remove_files_by_mask(libdir, "*-{}.a".format(".".join(self._major_minor_version))) + rm(self, "*-{}.a".format(".".join(self._major_minor_version)), libdir) + fix_apple_shared_install_name(self) @property def _major_minor_version(self): @@ -253,16 +296,15 @@ def _libs(self): if self.options.get_safe("with_cxx"): libs.extend(["db_cxx", "db_stl"]) libs.extend(["db_sql", "db"]) - if self.settings.compiler == "Visual Studio": - libs = ["lib{}".format(lib) for lib in libs] + if is_msvc(self): + libs = [f"lib{libname}" for libname in libs] return libs def package_info(self): self.cpp_info.libs = self._libs - if self.settings.compiler == "Visual Studio" and self.options.shared: + if is_msvc(self) and self.options.shared: self.cpp_info.defines = ["DB_USE_DLL"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.extend(["dl", "pthread"]) - elif self.settings.os == "Windows" : + elif self.settings.os == "Windows": self.cpp_info.system_libs.append("ws2_32") - diff --git a/recipes/libdb/all/patches/0004-msvc-tcl-include-conanbuildinfo-props.patch b/recipes/libdb/all/patches/0004-msvc-tcl-include-conanbuildinfo-props.patch deleted file mode 100644 index 742431d50ece2..0000000000000 --- a/recipes/libdb/all/patches/0004-msvc-tcl-include-conanbuildinfo-props.patch +++ /dev/null @@ -1,9 +0,0 @@ ---- build_windows/VS10/db_tcl.vcxproj -+++ build_windows/VS10/db_tcl.vcxproj -@@ -1,5 +2,5 @@ - -- -+ - - - Debug diff --git a/recipes/libdb/all/test_package/CMakeLists.txt b/recipes/libdb/all/test_package/CMakeLists.txt index 7b9b613cbb24a..ee5ced82bf710 100644 --- a/recipes/libdb/all/test_package/CMakeLists.txt +++ b/recipes/libdb/all/test_package/CMakeLists.txt @@ -1,8 +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() +find_package(libdb CONFIG REQUIRED) -add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +add_executable(example src/test_package.c) +target_link_libraries(example libdb::libdb) diff --git a/recipes/libdb/all/test_package/conanfile.py b/recipes/libdb/all/test_package/conanfile.py index d919133e5c230..91a8fc7a09b42 100644 --- a/recipes/libdb/all/test_package/conanfile.py +++ b/recipes/libdb/all/test_package/conanfile.py @@ -1,16 +1,26 @@ -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", "arch", "compiler", "build_type" - generators = "cmake" + +class fooTestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "CMakeDeps", "CMakeToolchain" + + 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): - self.run(os.path.join("bin", "test_package"), run_environment=True) + if can_run(self): + cmd = os.path.join(self.cpp.build.bindir, "example") + self.run(cmd, env="conanrun") diff --git a/recipes/libdb/all/test_package/src/test_package.c b/recipes/libdb/all/test_package/src/test_package.c new file mode 100644 index 0000000000000..a83b3cc09a879 --- /dev/null +++ b/recipes/libdb/all/test_package/src/test_package.c @@ -0,0 +1,22 @@ +#include + +#include +#include + +int main(int argc, char *argv[]) { + DB *dbp; + int res; + res = db_create(&dbp, NULL, 0); + if (res != 0) { + puts("db_create failed\n"); + return EXIT_FAILURE; + } + + res = dbp->close(dbp, 0); + if (res != 0) { + puts("DP->close failed\n"); + return EXIT_FAILURE; + } + puts("libdb test_package success!\n"); + return EXIT_SUCCESS; +} diff --git a/recipes/libdb/all/test_package/test_package.c b/recipes/libdb/all/test_package/test_package.c deleted file mode 100644 index d94592e5c75f1..0000000000000 --- a/recipes/libdb/all/test_package/test_package.c +++ /dev/null @@ -1,21 +0,0 @@ -#include - -#include -#include - -int main(int argc, char *argv[]) { - DB *dbp; - int res; - res = db_create(&dbp, NULL, 0); - if (res != 0) { - puts("db_create failed\n"); - return EXIT_FAILURE; - } - - res = dbp->close(dbp, 0); - if (res != 0) { - puts("DP->close failed\n"); - return EXIT_FAILURE; - } - return EXIT_SUCCESS; -} diff --git a/recipes/libdb/all/test_v1_package/CMakeLists.txt b/recipes/libdb/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..b9027a80ab6af --- /dev/null +++ b/recipes/libdb/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() + +add_executable(${PROJECT_NAME} ../test_package/src/test_package.c) +target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) diff --git a/recipes/libdb/all/test_v1_package/conanfile.py b/recipes/libdb/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..d919133e5c230 --- /dev/null +++ b/recipes/libdb/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" + + 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/libdc1394/all/conandata.yml b/recipes/libdc1394/all/conandata.yml index f12a9d3794e20..72fa1e3400e1a 100644 --- a/recipes/libdc1394/all/conandata.yml +++ b/recipes/libdc1394/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.2.7": + url: "https://sourceforge.net/projects/libdc1394/files/libdc1394-2/2.2.7/libdc1394-2.2.7.tar.gz" + sha256: "537ceb78dd3cef271a183f4a176191d1cecf85f025520e6bd3758b0e19e6609f" "2.2.6": url: "https://sourceforge.net/projects/libdc1394/files/libdc1394-2/2.2.6/libdc1394-2.2.6.tar.gz" sha256: "2b905fc9aa4eec6bdcf6a2ae5f5ba021232739f5be047dec8fe8dd6049c10fed" diff --git a/recipes/libdc1394/all/conanfile.py b/recipes/libdc1394/all/conanfile.py index f52cb3b808339..0ac48cba03bef 100644 --- a/recipes/libdc1394/all/conanfile.py +++ b/recipes/libdc1394/all/conanfile.py @@ -54,7 +54,7 @@ def validate(self): 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") + self.tool_requires("pkgconf/2.0.3") def source(self): get(self, **self.conan_data["sources"][self.version], diff --git a/recipes/libdc1394/config.yml b/recipes/libdc1394/config.yml index 02d886e69e974..ca2455c42caf9 100644 --- a/recipes/libdc1394/config.yml +++ b/recipes/libdc1394/config.yml @@ -1,3 +1,5 @@ versions: + "2.2.7": + folder: all "2.2.6": folder: all diff --git a/recipes/libde265/all/conandata.yml b/recipes/libde265/all/conandata.yml index 47d525a12ed76..3dd8fd65fd529 100644 --- a/recipes/libde265/all/conandata.yml +++ b/recipes/libde265/all/conandata.yml @@ -1,10 +1,19 @@ sources: + "1.0.15": + url: "https://github.com/strukturag/libde265/releases/download/v1.0.15/libde265-1.0.15.tar.gz" + sha256: "00251986c29d34d3af7117ed05874950c875dd9292d016be29d3b3762666511d" + "1.0.12": + url: "https://github.com/strukturag/libde265/releases/download/v1.0.12/libde265-1.0.12.tar.gz" + sha256: "62185ea2182e68cf68bba20cc6eb4c287407b509cf0a827d7ddb75614db77b5c" + "1.0.11": + url: "https://github.com/strukturag/libde265/releases/download/v1.0.11/libde265-1.0.11.tar.gz" + sha256: "2f8f12cabbdb15e53532b7c1eb964d4e15d444db1be802505e6ac97a25035bab" "1.0.9": - url: "https://github.com/strukturag/libde265/archive/v1.0.9.tar.gz" - sha256: "153554f407718a75f1e0ae197d35b43147ce282118a54f894554dbe27c32163d" + 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" diff --git a/recipes/libde265/all/conanfile.py b/recipes/libde265/all/conanfile.py index d6051d473a9ba..6618b97bf0692 100644 --- a/recipes/libde265/all/conanfile.py +++ b/recipes/libde265/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, 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 +from conan.tools.scm import Version 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" - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -30,8 +30,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 +40,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): @@ -79,47 +75,50 @@ 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")) # 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), - {"libde265": "libde265::libde265"} + { + "de265": "libde265::libde265", + "libde265": "libde265::libde265", + } ) 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") - self.cpp_info.set_property("cmake_target_name", "libde265") + self.cpp_info.set_property("cmake_target_name", "de265") + self.cpp_info.set_property("cmake_target_aliases", ["libde265"]) # official imported target before 1.0.10 self.cpp_info.set_property("pkg_config_name", "libde265") - - self.cpp_info.libs = ["libde265"] + version = Version(self.version) + prefix = "lib" if (version < "1.0.10" or (version > "1.0.11" and self.settings.os == "Windows" and not self.options.shared)) else "" + self.cpp_info.libs = [f"{prefix}de265"] if not self.options.shared: self.cpp_info.defines = ["LIBDE265_STATIC_BUILD"] 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/config.yml b/recipes/libde265/config.yml index 1c656ce0b375f..4323cd76505c9 100644 --- a/recipes/libde265/config.yml +++ b/recipes/libde265/config.yml @@ -1,4 +1,10 @@ versions: + "1.0.15": + folder: all + "1.0.12": + folder: all + "1.0.11": + folder: all "1.0.9": folder: all "1.0.8": diff --git a/recipes/libdeflate/all/conandata.yml b/recipes/libdeflate/all/conandata.yml index 2f736fbb60442..3f2d733ec1559 100644 --- a/recipes/libdeflate/all/conandata.yml +++ b/recipes/libdeflate/all/conandata.yml @@ -1,4 +1,22 @@ sources: + "1.22": + url: "https://github.com/ebiggers/libdeflate/archive/refs/tags/v1.22.tar.gz" + sha256: "7f343c7bf2ba46e774d8a632bf073235e1fd27723ef0a12a90f8947b7fe851d6" + "1.21": + url: "https://github.com/ebiggers/libdeflate/archive/refs/tags/v1.21.tar.gz" + sha256: "50827d312c0413fbd41b0628590cd54d9ad7ebf88360cba7c0e70027942dbd01" + "1.20": + url: "https://github.com/ebiggers/libdeflate/archive/refs/tags/v1.20.tar.gz" + sha256: "ed1454166ced78913ff3809870a4005b7170a6fd30767dc478a09b96847b9c2a" + "1.19": + url: "https://github.com/ebiggers/libdeflate/archive/refs/tags/v1.19.tar.gz" + sha256: "27bf62d71cd64728ff43a9feb92f2ac2f2bf748986d856133cc1e51992428c25" + "1.18": + url: "https://github.com/ebiggers/libdeflate/archive/refs/tags/v1.18.tar.gz" + sha256: "225d982bcaf553221c76726358d2ea139bb34913180b20823c782cede060affd" + "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 0dfcbb1a51a82..b72d35d422049 100644 --- a/recipes/libdeflate/all/conanfile.py +++ b/recipes/libdeflate/all/conanfile.py @@ -13,6 +13,7 @@ class LibdeflateConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/ebiggers/libdeflate" topics = ("compression", "decompression", "deflate", "zlib", "gzip") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -37,8 +38,7 @@ 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,8 +62,9 @@ def package(self): def package_info(self): self.cpp_info.set_property("cmake_file_name", "libdeflate") - target_suffix = "" if self.options.shared else "_static" + target_suffix = "_shared" if self.options.shared else "_static" self.cpp_info.set_property("cmake_target_name", f"libdeflate::libdeflate{target_suffix}") + self.cpp_info.set_property("cmake_target_aliases", ["libdeflate::libdeflate"]) # not official, avoid to break users self.cpp_info.set_property("pkg_config_name", "libdeflate") # TODO: back to global scope in conan v2 self.cpp_info.components["_libdeflate"].libs = collect_libs(self) diff --git a/recipes/libdeflate/all/test_package/CMakeLists.txt b/recipes/libdeflate/all/test_package/CMakeLists.txt index 8a0545abfaa5f..ba0dfeb9e192f 100644 --- a/recipes/libdeflate/all/test_package/CMakeLists.txt +++ b/recipes/libdeflate/all/test_package/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) find_package(libdeflate REQUIRED CONFIG) @@ -7,5 +7,5 @@ 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) + target_link_libraries(${PROJECT_NAME} PRIVATE libdeflate::libdeflate_shared) endif() diff --git a/recipes/libdeflate/config.yml b/recipes/libdeflate/config.yml index 10dff89847eaa..e0c8d8a06e43c 100644 --- a/recipes/libdeflate/config.yml +++ b/recipes/libdeflate/config.yml @@ -1,4 +1,16 @@ versions: + "1.22": + folder: "all" + "1.21": + folder: "all" + "1.20": + folder: "all" + "1.19": + folder: "all" + "1.18": + folder: "all" + "1.17": + folder: "all" "1.15": folder: "all" "1.14": diff --git a/recipes/libdeflate/pre_1.15/conanfile.py b/recipes/libdeflate/pre_1.15/conanfile.py index 47e0d742be3d1..02ec8db904133 100644 --- a/recipes/libdeflate/pre_1.15/conanfile.py +++ b/recipes/libdeflate/pre_1.15/conanfile.py @@ -1,12 +1,12 @@ from conan import ConanFile -from conan.tools.env import Environment, VirtualBuildEnv +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, VCVars +from conan.tools.microsoft import is_msvc, unix_path, NMakeToolchain import os -required_conan_version = ">=1.53.0" +required_conan_version = ">=1.55.0" class LibdeflateConan(ConanFile): @@ -16,6 +16,7 @@ class LibdeflateConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/ebiggers/libdeflate" topics = ("compression", "decompression", "deflate", "zlib", "gzip") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -57,23 +58,15 @@ def build_requirements(self): self.tool_requires("msys2/cci.latest") 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 is_msvc(self) or self._is_clangcl: - vc = VCVars(self) - vc.generate() - # FIXME: no conan v2 build helper for NMake yet (see https://github.com/conan-io/conan/issues/12188) - # So populate CL with AutotoolsToolchain cflags - env = Environment() - c_flags = AutotoolsToolchain(self).cflags - if c_flags: - env.define("CL", c_flags) - env.vars(self).save_script("conanbuildenv_nmake") + tc = NMakeToolchain(self) + tc.generate() else: + env = VirtualBuildEnv(self) + env.generate() tc = AutotoolsToolchain(self) tc.generate() diff --git a/recipes/libdicom/all/conandata.yml b/recipes/libdicom/all/conandata.yml new file mode 100644 index 0000000000000..8eb7bfa03fad7 --- /dev/null +++ b/recipes/libdicom/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.0.5": + url: "https://github.com/ImagingDataCommons/libdicom/archive/refs/tags/v1.0.5.tar.gz" + sha256: "ebf5f7c0d1a0f802c1801f2f762537f014f2a431be3e063142f6ed3c96878abb" diff --git a/recipes/libdicom/all/conanfile.py b/recipes/libdicom/all/conanfile.py new file mode 100644 index 0000000000000..ab459c73d54b3 --- /dev/null +++ b/recipes/libdicom/all/conanfile.py @@ -0,0 +1,85 @@ +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, rm, rmdir +from conan.tools.gnu import PkgConfigDeps +from conan.tools.layout import basic_layout +from conan.tools.meson import Meson, MesonToolchain + +required_conan_version = ">=1.53.0" + + +class LibdicomConan(ConanFile): + name = "libdicom" + description = "libdicom is a C library and a set of command-line tools for reading DICOM WSI files." + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/ImagingDataCommons/libdicom" + topics = ("dicom", "medical-imaging") + + 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 requirements(self): + self.requires("uthash/2.3.0") + + def layout(self): + basic_layout(self, src_folder="src") + + def build_requirements(self): + self.tool_requires("meson/1.2.3") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/2.0.3") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = MesonToolchain(self) + tc.project_options["tests"] = "false" + tc.generate() + tc = PkgConfigDeps(self) + tc.generate() + tc = VirtualBuildEnv(self) + tc.generate() + + def build(self): + meson = Meson(self) + meson.configure() + meson.build() + + def package(self): + copy(self, "LICENSE", 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")) + 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")) + fix_apple_shared_install_name(self) + + def package_info(self): + self.cpp_info.libs = ["dicom"] + self.cpp_info.set_property("pkg_config_name", "libdicom") + if not self.options.shared: + self.cpp_info.defines = ["DCM_STATIC"] diff --git a/recipes/libdicom/all/test_package/conanfile.py b/recipes/libdicom/all/test_package/conanfile.py new file mode 100644 index 0000000000000..2e3df45816e5a --- /dev/null +++ b/recipes/libdicom/all/test_package/conanfile.py @@ -0,0 +1,32 @@ +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): + 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/1.2.3") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/2.0.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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libdicom/all/test_package/meson.build b/recipes/libdicom/all/test_package/meson.build new file mode 100644 index 0000000000000..706b1702c86ed --- /dev/null +++ b/recipes/libdicom/all/test_package/meson.build @@ -0,0 +1,5 @@ +project('test_package', 'c') +package_dep = dependency('libdicom') +executable('test_package', + sources : ['test_package.c'], + dependencies : [package_dep]) diff --git a/recipes/libdicom/all/test_package/test_package.c b/recipes/libdicom/all/test_package/test_package.c new file mode 100644 index 0000000000000..1c30db0e66514 --- /dev/null +++ b/recipes/libdicom/all/test_package/test_package.c @@ -0,0 +1,7 @@ +#include + +int main(void) { + DcmError *error = NULL; + dcm_filehandle_create_from_file(&error, "xyz"); + return 0; +} diff --git a/recipes/libdicom/config.yml b/recipes/libdicom/config.yml new file mode 100644 index 0000000000000..84f5016ed4a14 --- /dev/null +++ b/recipes/libdicom/config.yml @@ -0,0 +1,3 @@ +versions: + "1.0.5": + folder: all diff --git a/recipes/libdisasm/all/conanfile.py b/recipes/libdisasm/all/conanfile.py index 8de1232946b5d..59fcdff727fe9 100644 --- a/recipes/libdisasm/all/conanfile.py +++ b/recipes/libdisasm/all/conanfile.py @@ -1,14 +1,13 @@ 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.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 +from conan.tools.microsoft import check_min_vs, is_msvc, unix_path import os -required_conan_version = ">=1.53.0" +required_conan_version = ">=1.57.0" class LibdisasmConan(ConanFile): @@ -19,6 +18,7 @@ class LibdisasmConan(ConanFile): topics = ("disassembler", "x86", "asm") license = "MIT" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "fPIC": [True, False], @@ -33,10 +33,6 @@ class LibdisasmConan(ConanFile): 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) @@ -61,20 +57,19 @@ def build_requirements(self): self.tool_requires("msys2/cci.latest") 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 = 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"): + if is_msvc(self) and check_min_vs(self, "180", raise_invalid=False): tc.extra_cflags.append("-FS") env = tc.environment() if is_msvc(self): - ar_wrapper = unix_path(self, self._user_info_build["automake"].ar_lib) + automake_conf = self.dependencies.build["automake"].conf_info + ar_wrapper = unix_path(self, automake_conf.get("user.automake:lib-wrapper", check_type=str)) env.define("CC", "cl -nologo") env.define("CXX", "cl -nologo") env.define("CPP", "cl -E -nologo") @@ -97,10 +92,9 @@ def build(self): def package(self): 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)}"]) + autotools.install() if self.settings.os != "Windows": - autotools.install(args=[f"DESTDIR={unix_path(self, self.package_folder)}", "-C", "x86dis"]) + autotools.install(args=["-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: diff --git a/recipes/libdisasm/all/test_package/conanfile.py b/recipes/libdisasm/all/test_package/conanfile.py index 0a8e988d43472..1c3cd9bc22a9e 100644 --- a/recipes/libdisasm/all/test_package/conanfile.py +++ b/recipes/libdisasm/all/test_package/conanfile.py @@ -13,7 +13,7 @@ def layout(self): cmake_layout(self) def requirements(self): - self.requires(self.tested_reference_str) + self.requires(self.tested_reference_str, run=True) def build(self): cmake = CMake(self) diff --git a/recipes/libdispatch/all/CMakeLists.txt b/recipes/libdispatch/all/CMakeLists.txt deleted file mode 100644 index 217b9530b904d..0000000000000 --- a/recipes/libdispatch/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/libdispatch/all/conanfile.py b/recipes/libdispatch/all/conanfile.py index e88fe5b5ab8e0..e5d4766a02600 100644 --- a/recipes/libdispatch/all/conanfile.py +++ b/recipes/libdispatch/all/conanfile.py @@ -1,66 +1,81 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration import os -required_conan_version = ">=1.32.0" +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, rmdir, replace_in_file + +required_conan_version = ">=1.53.0" + class LibDispatchConan(ConanFile): name = "libdispatch" - homepage = "https://github.com/apple/swift-corelibs-libdispatch" - description = "Grand Central Dispatch (GCD or libdispatch) provides comprehensive support for concurrent code execution on multicore hardware." - topics = ("conan", "libdispatch", "apple", "GCD", "concurrency") - url = "https://github.com/conan-io/conan-center-index" + description = ( + "Grand Central Dispatch (GCD or libdispatch) provides comprehensive support " + "for concurrent code execution on multicore hardware." + ) license = "Apache-2.0" - exports_sources = ["CMakeLists.txt"] - generators = "cmake" - settings = "os", "compiler", "build_type", "arch" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/apple/swift-corelibs-libdispatch" + topics = ("apple", "GCD", "concurrency") - options = {"shared": [True, False], "fPIC": [True, False]} - default_options = {"shared": False, "fPIC": True} + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } - _cmake = None + 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 != "clang": raise ConanInvalidConfiguration("Clang compiler is required.") - @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]) - extracted_dir = "swift-corelibs-{}-swift-{}-RELEASE".format(self.name, self.version) - 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() - 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): + replace_in_file(self, os.path.join(self.source_folder, "cmake", "modules", "DispatchCompilerWarnings.cmake"), + "-Werror", "") def build(self): - 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", 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")) def package_info(self): - if self.settings.os == "Macos": + if is_apple_os(self): self.cpp_info.libs = ["dispatch"] else: self.cpp_info.libs = ["dispatch", "BlocksRuntime"] - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["pthread", "rt"] elif self.settings.os == "Windows": self.cpp_info.system_libs = ["shlwapi", "ws2_32", "winmm", "synchronization"] diff --git a/recipes/libdispatch/all/test_package/CMakeLists.txt b/recipes/libdispatch/all/test_package/CMakeLists.txt index d66f5d5a5a432..3bc47f2c45cd7 100644 --- a/recipes/libdispatch/all/test_package/CMakeLists.txt +++ b/recipes/libdispatch/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ -cmake_minimum_required(VERSION 3.1.2) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - -find_package(libdispatch REQUIRED) +find_package(libdispatch REQUIRED CONFIG) # TEST_PACKAGE ################################################################# add_executable(${CMAKE_PROJECT_NAME} test_package.cpp) diff --git a/recipes/libdispatch/all/test_package/conanfile.py b/recipes/libdispatch/all/test_package/conanfile.py index 9294e13566895..ef5d7042163ec 100644 --- a/recipes/libdispatch/all/test_package/conanfile.py +++ b/recipes/libdispatch/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", "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,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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libdispatch/all/test_v1_package/CMakeLists.txt b/recipes/libdispatch/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/libdispatch/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/libdispatch/all/test_v1_package/conanfile.py b/recipes/libdispatch/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..b6f313836cc05 --- /dev/null +++ b/recipes/libdispatch/all/test_v1_package/conanfile.py @@ -0,0 +1,16 @@ +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.settings): + self.run(os.path.join("bin", "test_package"), run_environment=True) diff --git a/recipes/libdisplay-info/all/conandata.yml b/recipes/libdisplay-info/all/conandata.yml new file mode 100644 index 0000000000000..8019b0f27fc6e --- /dev/null +++ b/recipes/libdisplay-info/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "0.2.0": + url: "https://gitlab.freedesktop.org/emersion/libdisplay-info/-/archive/0.2.0/libdisplay-info-0.2.0.tar.bz2" + sha256: "f6cf2ddbba3753ae38de5113d1fcb8fab977dfaf5fb07b38cd68d8482765e208" + "0.1.1": + url: "https://gitlab.freedesktop.org/emersion/libdisplay-info/-/archive/0.1.1/libdisplay-info-0.1.1.tar.bz2" + sha256: "51cdb0362882ca2af62532ab4d95e60d81e9890b339264719fd55f8e3945d695" diff --git a/recipes/libdisplay-info/all/conanfile.py b/recipes/libdisplay-info/all/conanfile.py new file mode 100644 index 0000000000000..45fbfde532ed8 --- /dev/null +++ b/recipes/libdisplay-info/all/conanfile.py @@ -0,0 +1,90 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import cross_building +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import copy, 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 +import os + + +required_conan_version = ">=2.0.9" + + +class LibdisplayInfoConan(ConanFile): + name = "libdisplay-info" + description = "EDID and DisplayID library" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://gitlab.freedesktop.org/emersion/libdisplay-info" + topics = ("display", "DisplayID", "EDID") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + implements = ["auto_shared_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 validate(self): + if not self.settings.os in ["FreeBSD", "Linux"]: + raise ConanInvalidConfiguration(f"{self.ref} is not supported on {self.settings.os}") + + def build_requirements(self): + self.tool_requires("hwdata/0.376") + self.tool_requires("meson/[>=1.2.3 <2]") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/[>=2.2 <3]") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + tc = MesonToolchain(self) + if cross_building(self): + # https://mesonbuild.com/Builtin-options.html#specifying-options-per-machine + tc.project_options["build.pkg_config_path"] = self.generators_folder + tc.generate() + + pkg_config_deps = PkgConfigDeps(self) + pkg_config_deps.build_context_activated = ["hwdata"] + pkg_config_deps.generate() + + def _patch_sources(self): + replace_in_file(self, os.path.join(self.source_folder, "meson.build"), "subdir('test')", "# subdir('test')") + + def build(self): + self._patch_sources() + meson = Meson(self) + meson.configure() + meson.build() + + def package(self): + copy(self, "LICENSE", 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", 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 = ["display-info"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["m"]) diff --git a/recipes/libdisplay-info/all/test_package/conanfile.py b/recipes/libdisplay-info/all/test_package/conanfile.py new file mode 100644 index 0000000000000..2e3df45816e5a --- /dev/null +++ b/recipes/libdisplay-info/all/test_package/conanfile.py @@ -0,0 +1,32 @@ +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): + 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/1.2.3") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/2.0.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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libdisplay-info/all/test_package/meson.build b/recipes/libdisplay-info/all/test_package/meson.build new file mode 100644 index 0000000000000..3b75f6e4e942b --- /dev/null +++ b/recipes/libdisplay-info/all/test_package/meson.build @@ -0,0 +1,5 @@ +project('test_package', 'c') +package_dep = dependency('libdisplay-info') +executable('test_package', + sources : ['test_package.c'], + dependencies : [package_dep]) diff --git a/recipes/libdisplay-info/all/test_package/test_package.c b/recipes/libdisplay-info/all/test_package/test_package.c new file mode 100644 index 0000000000000..21c1bf8b467cd --- /dev/null +++ b/recipes/libdisplay-info/all/test_package/test_package.c @@ -0,0 +1,8 @@ +#include + +#include + +int main() +{ + return di_info_parse_edid("", 0) != 0; +} diff --git a/recipes/libdisplay-info/config.yml b/recipes/libdisplay-info/config.yml new file mode 100644 index 0000000000000..cc2bbccb73a1b --- /dev/null +++ b/recipes/libdisplay-info/config.yml @@ -0,0 +1,5 @@ +versions: + "0.2.0": + folder: all + "0.1.1": + folder: all diff --git a/recipes/libdivide/all/conandata.yml b/recipes/libdivide/all/conandata.yml index 6b1811615bec8..1cbb0260b35e7 100644 --- a/recipes/libdivide/all/conandata.yml +++ b/recipes/libdivide/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "5.1": + url: "https://github.com/ridiculousfish/libdivide/archive/refs/tags/v5.1.tar.gz" + sha256: "fec2e4141878c58eb92cfcd478accc3b7f34b39491c1e638566f083d378cc7d4" "5.0": url: "https://github.com/ridiculousfish/libdivide/archive/refs/tags/5.0.tar.gz" sha256: "01ffdf90bc475e42170741d381eb9cfb631d9d7ddac7337368bcd80df8c98356" diff --git a/recipes/libdivide/all/conanfile.py b/recipes/libdivide/all/conanfile.py index 47e6ad87f66f6..2252c68d61a0f 100644 --- a/recipes/libdivide/all/conanfile.py +++ b/recipes/libdivide/all/conanfile.py @@ -1,16 +1,24 @@ -from conans import ConanFile, tools +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 +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" -required_conan_version = ">=1.33.0" class LibdivideConan(ConanFile): name = "libdivide" description = "Header-only C/C++ library for optimizing integer division." - topics = ("libdivide", "division", "integer", ) license = ["Zlib", "BSL-1.0"] - homepage = "http://libdivide.com/" url = "https://github.com/conan-io/conan-center-index" - settings = "arch", "compiler" - no_copy_source = True + homepage = "http://libdivide.com/" + topics = ("libdivide", "division", "integer", "header-only") + + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" options = { "simd_intrinsics": [False, "sse2", "avx2", "avx512"], "sse2": [True, False], @@ -25,53 +33,52 @@ class LibdivideConan(ConanFile): "avx512": False, "neon": False, } - - @property - def _source_subfolder(self): - return "source_subfolder" + no_copy_source = True def config_options(self): - if tools.Version(self.version) < "4.0.0": - del self.options.sse2 - del self.options.avx2 - del self.options.avx512 - del self.options.neon + if Version(self.version) < "4.0.0": + self.options.rm_safe("sse2") + self.options.rm_safe("avx2") + self.options.rm_safe("avx512") + self.options.rm_safe("neon") if self.settings.arch not in ["x86", "x86_64"]: - del self.options.simd_intrinsics + self.options.rm_safe("simd_intrinsics") else: - del self.options.simd_intrinsics + self.options.rm_safe("simd_intrinsics") if self.settings.arch not in ["x86", "x86_64"]: - del self.options.sse2 - del self.options.avx2 - del self.options.avx512 + self.options.rm_safe("sse2") + self.options.rm_safe("avx2") + self.options.rm_safe("avx512") if not str(self.settings.arch).startswith("arm"): - del self.options.neon + self.options.rm_safe("neon") - def configure(self): - if tools.Version(self.version) < "4.0.0" and 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 Version(self.version) < "4.0.0" and 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): - self.copy("LICENSE.txt", dst="licenses", src=self._source_subfolder) - self.copy("libdivide.h", dst="include", src=self._source_subfolder) - self.copy("constant_fast_div.h", dst="include", src=self._source_subfolder) - self.copy("s16_ldparams.h", dst="include", src=self._source_subfolder) - self.copy("u16_ldparams.h", dst="include", src=self._source_subfolder) + copy(self, "LICENSE.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, "libdivide.h", dst=os.path.join(self.package_folder, "include"), src=self.source_folder) + copy(self, "constant_fast_div.h", dst=os.path.join(self.package_folder, "include"), src=self.source_folder) + copy(self, "s16_ldparams.h", dst=os.path.join(self.package_folder, "include"), src=self.source_folder) + copy(self, "u16_ldparams.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 = [] + simd = self.options.get_safe("simd_intrinsics", False) if bool(simd): - self.cpp_info.defines = [ - {"sse2": "LIBDIVIDE_SSE2", - "avx2": "LIBDIVIDE_AVX2", - "avx512": "LIBDIVIDE_AVX512"}[str(simd)] - ] + self.cpp_info.defines = [{"sse2": "LIBDIVIDE_SSE2", "avx2": "LIBDIVIDE_AVX2", "avx512": "LIBDIVIDE_AVX512"}[str(simd)]] if self.options.get_safe("sse2", False): self.cpp_info.defines.append("LIBDIVIDE_SSE2") if self.options.get_safe("avx2", False): diff --git a/recipes/libdivide/all/test_package/CMakeLists.txt b/recipes/libdivide/all/test_package/CMakeLists.txt index c08b1cebc6009..619dae18c0777 100644 --- a/recipes/libdivide/all/test_package/CMakeLists.txt +++ b/recipes/libdivide/all/test_package/CMakeLists.txt @@ -1,15 +1,18 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX C) find_package(libdivide REQUIRED CONFIG) add_executable(${PROJECT_NAME}_c test_package.c) target_link_libraries(${PROJECT_NAME}_c libdivide::libdivide) -set_property(TARGET ${PROJECT_NAME}_c PROPERTY C_STANDARD 99) +set_target_properties(${PROJECT_NAME}_c PROPERTIES +C_STANDARD 99 +LINKER_LANGUAGE C +) add_executable(${PROJECT_NAME}_cpp test_package.cpp) target_link_libraries(${PROJECT_NAME}_cpp libdivide::libdivide) -set_property(TARGET ${PROJECT_NAME}_cpp PROPERTY CXX_STANDARD 11) +set_target_properties( ${PROJECT_NAME}_cpp PROPERTIES +CXX_STANDARD 11 +LINKER_LANGUAGE CXX +) diff --git a/recipes/libdivide/all/test_package/conanfile.py b/recipes/libdivide/all/test_package/conanfile.py index 0eee35d285cde..b89281b9f4061 100644 --- a/recipes/libdivide/all/test_package/conanfile.py +++ b/recipes/libdivide/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" + 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_c_path = os.path.join("bin", "test_package_c") - self.run(bin_c_path, run_environment=True) - bin_cpp_path = os.path.join("bin", "test_package_cpp") - self.run(bin_cpp_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindir, "test_package_c") + self.run(bin_path, env="conanrun") + bin_path = os.path.join(self.cpp.build.bindir, "test_package_cpp") + self.run(bin_path, env="conanrun") diff --git a/recipes/libdivide/all/test_v1_package/CMakeLists.txt b/recipes/libdivide/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/libdivide/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/libdivide/all/test_v1_package/conanfile.py b/recipes/libdivide/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..0eee35d285cde --- /dev/null +++ b/recipes/libdivide/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.settings): + bin_c_path = os.path.join("bin", "test_package_c") + self.run(bin_c_path, run_environment=True) + bin_cpp_path = os.path.join("bin", "test_package_cpp") + self.run(bin_cpp_path, run_environment=True) diff --git a/recipes/libdivide/all/test_v1_package/test_package.c b/recipes/libdivide/all/test_v1_package/test_package.c new file mode 100644 index 0000000000000..dc8a5151154fd --- /dev/null +++ b/recipes/libdivide/all/test_v1_package/test_package.c @@ -0,0 +1,12 @@ +#include + +#include +#include +#include + +int main() { + struct libdivide_s64_t fast_d = libdivide_s64_gen(30); + int64_t a = 60; + printf("%" PRId64 "\n", libdivide_s64_do(a, &fast_d)); + return 0; +} diff --git a/recipes/libdivide/config.yml b/recipes/libdivide/config.yml index c374cc0645132..042bc67b62f0b 100644 --- a/recipes/libdivide/config.yml +++ b/recipes/libdivide/config.yml @@ -1,4 +1,6 @@ versions: + "5.1": + folder: all "5.0": folder: all "3.0": diff --git a/recipes/libdrawille/all/conandata.yml b/recipes/libdrawille/all/conandata.yml new file mode 100644 index 0000000000000..7562384137dba --- /dev/null +++ b/recipes/libdrawille/all/conandata.yml @@ -0,0 +1,12 @@ +sources: + "cci.20160428": + url: "https://github.com/Huulivoide/libdrawille/archive/e7e366e739c80120690dd0ee9f41648d2556f800.tar.gz" + sha256: "c4f4e4b74d419bb06e8fdf4886421216d65eb095e69fb8bcdeb33960bbd7ae16" +patches: + "cci.20160428": + - patch_file: "patches/0001-fix-cmake.patch" + patch_description: "disable test, examples add installer, link mathlib only on Linux" + patch_type: "conan" + - patch_file: "patches/0002-support-msvc.patch" + patch_description: "rename restrict keyword for msvc" + patch_type: "portability" diff --git a/recipes/libdrawille/all/conanfile.py b/recipes/libdrawille/all/conanfile.py new file mode 100644 index 0000000000000..b6f2dc8f8a984 --- /dev/null +++ b/recipes/libdrawille/all/conanfile.py @@ -0,0 +1,74 @@ +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.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.microsoft import is_msvc +import os + +required_conan_version = ">=1.53.0" + +class LibdrawilleConan(ConanFile): + name = "libdrawille" + description = "C implementation of drawille library and extra drawing functionality" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/Huulivoide/libdrawille/" + topics = ("drawille") + settings = "os", "compiler", "build_type", "arch" + 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 validate(self): + if self.settings.arch not in ["x86", "x86_64"]: + raise ConanInvalidConfiguration(f"{self.ref} supports x86 and x86_64 only.") + if is_msvc(self): + raise ConanInvalidConfiguration(f"{self.ref} does not support MSVC.(yet)") + + 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() + + 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 = ["drawille"] + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") diff --git a/recipes/libdrawille/all/patches/0001-fix-cmake.patch b/recipes/libdrawille/all/patches/0001-fix-cmake.patch new file mode 100644 index 0000000000000..e45992f62132f --- /dev/null +++ b/recipes/libdrawille/all/patches/0001-fix-cmake.patch @@ -0,0 +1,55 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 8d225ed..dc1a1b3 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,7 +1,7 @@ + cmake_minimum_required(VERSION 3.4) + project(libdrawille VERSION 0.0.1 LANGUAGES C) + +-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror -pedantic") ++set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -pedantic") + set(CMAKE_C_STANDARD 11) + set(CMAKE_C_STANDARD_REQUIRED ON) + +@@ -12,6 +12,3 @@ elseif(${WIN32}) + endif() + + add_subdirectory(src) +-add_subdirectory(test) +-add_subdirectory(examples) +-add_subdirectory(benchmark) +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 3c74714..240ca8b 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -1,9 +1,26 @@ +-find_library(MATH m) +- + set(SOURCE_FILES Canvas.c stamp.c mat3.c polygon.c point.c utils.c x86/sse.c x86/avx2.c) + set_source_files_properties(x86/sse.c PROPERTIES COMPILE_FLAGS "-msse -msse2 -msse4") + set_source_files_properties(x86/avx2.c PROPERTIES COMPILE_FLAGS "-msse -msse2 -msse4 -mavx -mavx2") + +-add_library(libdrawille ${SOURCE_FILES}) +-target_link_libraries(libdrawille ${MATH}) ++add_library(drawille ${SOURCE_FILES}) ++ ++find_library(MATH m) ++if(MATH) ++ target_link_libraries(drawille ${MATH}) ++endif() ++ ++include(GNUInstallDirs) ++ ++install( ++ TARGETS drawille ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++) + ++install( ++ FILES ++ Canvas.h ++ mat3.h ++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/drawille ++) diff --git a/recipes/libdrawille/all/patches/0002-support-msvc.patch b/recipes/libdrawille/all/patches/0002-support-msvc.patch new file mode 100644 index 0000000000000..24685ef15d80a --- /dev/null +++ b/recipes/libdrawille/all/patches/0002-support-msvc.patch @@ -0,0 +1,95 @@ +diff --git a/src/stamp.c b/src/stamp.c +index 73c78d0..6da8910 100644 +--- a/src/stamp.c ++++ b/src/stamp.c +@@ -138,8 +138,13 @@ int draw_stamp_outline(Canvas* c, Color color, const Stamp* s) { + return 1; + } + ++#ifdef _MSC_VER ++void fill_triangle(Canvas* __restrict canvas, const Color color, ++ const Point v1, const Point v2, const Point v3) { ++#else + void fill_triangle(Canvas* restrict canvas, const Color color, + const Point v1, const Point v2, const Point v3) { ++#endif + // 28.4 fixed-point coordinates + const int Y1 = to_fixed(v1.y); + const int Y2 = to_fixed(v2.y); +diff --git a/src/stamp.h b/src/stamp.h +index 5132bd7..009fea9 100644 +--- a/src/stamp.h ++++ b/src/stamp.h +@@ -35,7 +35,12 @@ void apply_matrix(Stamp* s); + int draw_stamp_outline(Canvas* c, Color color, const Stamp* s); + int fill_shape(Canvas* c, Color color, const Stamp* s); + ++#ifdef _MSC_VER ++void fill_triangle(Canvas* __restrict canvas, const Color color, ++ const Point v1, const Point v2, const Point v3); ++#else + void fill_triangle(Canvas* restrict canvas, const Color color, + const Point v1, const Point v2, const Point v3); ++#endif + + #endif //LIBDRAWILLE_STAMP_H +diff --git a/src/x86/avx2.c b/src/x86/avx2.c +index 100c474..27870a8 100644 +--- a/src/x86/avx2.c ++++ b/src/x86/avx2.c +@@ -17,8 +17,13 @@ static inline __m256i to_fixed_avx2(const float a, const float b, const float c, + return _mm256_cvtps_epi32(m); + } + ++#ifdef _MSC_VER ++void fill_triangle_avx2(Canvas* __restrict canvas, const Color color, ++ const Point v1, const Point v2, const Point v3) { ++#else + void fill_triangle_avx2(Canvas* restrict canvas, const Color color, + const Point v1, const Point v2, const Point v3) { ++#endif + // Block size, standard 8x8 (must be power of two) + const int q = 8; + +diff --git a/src/x86/sse.c b/src/x86/sse.c +index 27a6380..5cf0b48 100644 +--- a/src/x86/sse.c ++++ b/src/x86/sse.c +@@ -10,8 +10,13 @@ static inline __m128i to_fixed_sse(const float a, const float b, const float c) + return _mm_cvtps_epi32(m); + } + ++#ifdef _MSC_VER ++void fill_triangle_sse4(Canvas* __restrict canvas, const Color color, ++ const Point v1, const Point v2, const Point v3) { ++#else + void fill_triangle_sse4(Canvas* restrict canvas, const Color color, + const Point v1, const Point v2, const Point v3) { ++#endif + // Block size, standard 8x8 (must be power of two) + const int q = 8; + +diff --git a/src/x86/x86.h b/src/x86/x86.h +index c31cd03..4d161cb 100644 +--- a/src/x86/x86.h ++++ b/src/x86/x86.h +@@ -36,10 +36,19 @@ static inline void printv8h(const char* prefix, vec8 v) { + } + + ++#ifdef _MSC_VER ++void fill_triangle_sse4(Canvas* __restrict canvas, const Color color, ++ const Point v1, const Point v2, const Point v3); ++ ++void fill_triangle_avx2(Canvas* __restrict canvas, const Color color, ++ const Point v1, const Point v2, const Point v3); ++#else + void fill_triangle_sse4(Canvas* restrict canvas, const Color color, + const Point v1, const Point v2, const Point v3); + + void fill_triangle_avx2(Canvas* restrict canvas, const Color color, + const Point v1, const Point v2, const Point v3); ++#endif ++ + + #endif //LIBDRAWILLE_X86_H diff --git a/recipes/libdrawille/all/test_package/CMakeLists.txt b/recipes/libdrawille/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..c756c82332027 --- /dev/null +++ b/recipes/libdrawille/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES C) + +find_package(libdrawille REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE libdrawille::libdrawille) diff --git a/recipes/libdrawille/all/test_package/conanfile.py b/recipes/libdrawille/all/test_package/conanfile.py new file mode 100644 index 0000000000000..78a82060a3202 --- /dev/null +++ b/recipes/libdrawille/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, src_folder=".") + + 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/libdrawille/all/test_package/test_package.c b/recipes/libdrawille/all/test_package/test_package.c new file mode 100644 index 0000000000000..e6581befbb41a --- /dev/null +++ b/recipes/libdrawille/all/test_package/test_package.c @@ -0,0 +1,10 @@ +#include "drawille/Canvas.h" + + +int main() { + Canvas* canvas = new_canvas(100, 100); + + free_canvas(canvas); + + return 0; +} diff --git a/recipes/libdrawille/all/test_v1_package/CMakeLists.txt b/recipes/libdrawille/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/libdrawille/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/libdrawille/all/test_v1_package/conanfile.py b/recipes/libdrawille/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/libdrawille/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/libdrawille/config.yml b/recipes/libdrawille/config.yml new file mode 100644 index 0000000000000..4478b307ea3a4 --- /dev/null +++ b/recipes/libdrawille/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20160428": + folder: all diff --git a/recipes/libdrm/all/conandata.yml b/recipes/libdrm/all/conandata.yml index 385cbe1979841..55110631134de 100644 --- a/recipes/libdrm/all/conandata.yml +++ b/recipes/libdrm/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "2.4.120": + url: "https://dri.freedesktop.org/libdrm/libdrm-2.4.120.tar.xz" + sha256: "3bf55363f76c7250946441ab51d3a6cc0ae518055c0ff017324ab76cdefb327a" + "2.4.119": + url: "https://dri.freedesktop.org/libdrm/libdrm-2.4.119.tar.xz" + sha256: "0a49f12f09b5b6e68eaaaff3f02ca7cff9aa926939b212d343161d3e8ac56291" + "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..be977e2be8299 100644 --- a/recipes/libdrm/all/conanfile.py +++ b/recipes/libdrm/all/conanfile.py @@ -1,19 +1,27 @@ 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.gnu import PkgConfigDeps +from conan.tools.layout import basic_layout +from conan.tools.meson import MesonToolchain, Meson +from conan.tools.scm import Version + +required_conan_version = ">=1.64.0 <2 || >=2.2.0" class LibdrmConan(ConanFile): name = "libdrm" - description = "User space library for accessing the Direct Rendering Manager, on operating systems that support the ioctl interface" - topics = ("libdrm", "graphics") + description = ("User space library for accessing the Direct Rendering Manager, " + "on operating systems that support the ioctl interface") + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://gitlab.freedesktop.org/mesa/drm" - license = "MIT" - generators = "PkgConfigDeps" + topics = ("graphics",) + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -32,7 +40,7 @@ class LibdrmConan(ConanFile): "etnaviv": [True, False], "valgrind": [True, False], "freedreno-kgsl": [True, False], - "udev": [True, False] + "udev": [True, False], } default_options = { "shared": False, @@ -51,90 +59,96 @@ class LibdrmConan(ConanFile): "etnaviv": False, "valgrind": False, "freedreno-kgsl": False, - "udev": False + "udev": False, } - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - - def build_requirements(self): - self.build_requires("meson/0.59.0") - def config_options(self): - if self.settings.os == 'Windows': + 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 - 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): + basic_layout(self, src_folder="src") def requirements(self): if self.options.intel: - self.requires("libpciaccess/0.16") + self.requires("libpciaccess/0.17") if self.settings.os == "Linux": - self.requires("linux-headers-generic/5.14.9") + self.requires("linux-headers-generic/6.5.9") def validate(self): if self.settings.os not in ["Linux", "FreeBSD"]: raise ConanInvalidConfiguration("libdrm supports only Linux or FreeBSD") + def build_requirements(self): + self.tool_requires("meson/1.4.0") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/2.2.0") + 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) + def generate(self): + tc = PkgConfigDeps(self) + tc.generate() + + tc = MesonToolchain(self) + tc.project_options["cairo-tests"] = "disabled" if Version(self.version) >= "2.4.113" else "false" + tc.project_options["install-test-programs"] = "false" - defs={ - "cairo-tests" : "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": + tc.project_options["libkms"] = "true" if self.options.libkms else "false" - defs["datadir"] = os.path.join(self.package_folder, "res") - defs["mandir"] = os.path.join(self.package_folder, "res", "man") + tc.project_options["freedreno-kgsl"] = "true" if getattr(self.options, "freedreno-kgsl") else "false" + tc.project_options["udev"] = "true" if self.options.udev else "false" - meson.configure( - defs = defs, - source_folder=self._source_subfolder, - build_folder=self._build_subfolder) - return meson + for o in ["intel", "radeon", "amdgpu", "nouveau", "vmwgfx", "omap", + "exynos", "freedreno", "tegra", "vc4", "etnaviv", "valgrind"]: + if Version(self.version) >= "2.4.113": + tc.project_options[o] = "enabled" if getattr(self.options, o) else "disabled" + else: + tc.project_options[o] = "true" if getattr(self.options, o) else "false" + + tc.project_options["datadir"] = "res" + tc.project_options["mandir"] = os.path.join("res", "man") + tc.project_options["man-pages"] = "disabled" if Version(self.version) >= "2.4.113" else "false" + tc.generate() def build(self): - meson = self._configure_meson() + meson = Meson(self) + meson.configure() meson.build() def package(self): - meson = self._configure_meson() + meson = Meson(self) 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")) - license_contents = re.search("\*\/.*(\/\*(\*(?!\/)|[^*])*\*\/)", tmp, re.DOTALL)[1] - tools.save(os.path.join(self.package_folder, "licenses", "LICENSE"), license_contents) + tmp = load(self, os.path.join(self.source_folder, "include", "drm", "drm.h")) + license_contents = re.search(r"\*/.*(/\*(\*(?!/)|[^*])*\*/)", tmp, re.DOTALL)[1] + save(self, os.path.join(self.package_folder, "licenses", "LICENSE"), license_contents) def package_info(self): self.cpp_info.components["libdrm_libdrm"].libs = ["drm"] - self.cpp_info.components["libdrm_libdrm"].includedirs.append(os.path.join('include', 'libdrm')) + self.cpp_info.components["libdrm_libdrm"].includedirs.append(os.path.join("include", "libdrm")) self.cpp_info.components["libdrm_libdrm"].set_property("pkg_config_name", "libdrm") 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"] @@ -142,32 +156,33 @@ def package_info(self): if self.options.freedreno: self.cpp_info.components["libdrm_freedreno"].libs = ["drm_freedreno"] - self.cpp_info.components["libdrm_freedreno"].includedirs.append(os.path.join('include', 'libdrm')) - self.cpp_info.components["libdrm_freedreno"].includedirs.append(os.path.join('include', 'freedreno')) + self.cpp_info.components["libdrm_freedreno"].includedirs.append(os.path.join("include", "libdrm")) + self.cpp_info.components["libdrm_freedreno"].includedirs.append(os.path.join("include", "freedreno")) self.cpp_info.components["libdrm_freedreno"].requires = ["libdrm_libdrm"] self.cpp_info.components["libdrm_freedreno"].set_property("pkg_config_name", "libdrm_freedreno") if self.options.amdgpu: self.cpp_info.components["libdrm_amdgpu"].libs = ["drm_amdgpu"] - self.cpp_info.components["libdrm_amdgpu"].includedirs.append(os.path.join('include', 'libdrm')) + self.cpp_info.components["libdrm_amdgpu"].includedirs.append(os.path.join("include", "libdrm")) self.cpp_info.components["libdrm_amdgpu"].requires = ["libdrm_libdrm"] self.cpp_info.components["libdrm_amdgpu"].set_property("pkg_config_name", "libdrm_amdgpu") if self.options.nouveau: self.cpp_info.components["libdrm_nouveau"].libs = ["drm_nouveau"] - self.cpp_info.components["libdrm_nouveau"].includedirs.append(os.path.join('include', 'libdrm')) + self.cpp_info.components["libdrm_nouveau"].includedirs.extend([os.path.join("include", "libdrm"), os.path.join("include", "libdrm", "nouveau")]) self.cpp_info.components["libdrm_nouveau"].requires = ["libdrm_libdrm"] self.cpp_info.components["libdrm_nouveau"].set_property("pkg_config_name", "libdrm_nouveau") + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["libdrm_nouveau"].system_libs = ["pthread"] if self.options.intel: self.cpp_info.components["libdrm_intel"].libs = ["drm_intel"] - self.cpp_info.components["libdrm_intel"].includedirs.append(os.path.join('include', 'libdrm')) + self.cpp_info.components["libdrm_intel"].includedirs.append(os.path.join("include", "libdrm")) self.cpp_info.components["libdrm_intel"].requires = ["libdrm_libdrm", "libpciaccess::libpciaccess"] self.cpp_info.components["libdrm_intel"].set_property("pkg_config_name", "libdrm_intel") if self.options.radeon: self.cpp_info.components["libdrm_radeon"].libs = ["drm_radeon"] - self.cpp_info.components["libdrm_radeon"].includedirs.append(os.path.join('include', 'libdrm')) + self.cpp_info.components["libdrm_radeon"].includedirs.append(os.path.join("include", "libdrm")) self.cpp_info.components["libdrm_radeon"].requires = ["libdrm_libdrm"] self.cpp_info.components["libdrm_radeon"].set_property("pkg_config_name", "libdrm_radeon") - diff --git a/recipes/libdrm/all/test_package/CMakeLists.txt b/recipes/libdrm/all/test_package/CMakeLists.txt index afa2476357074..0561a690e26c1 100644 --- a/recipes/libdrm/all/test_package/CMakeLists.txt +++ b/recipes/libdrm/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -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() +find_package(libdrm REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE libdrm::libdrm) diff --git a/recipes/libdrm/all/test_package/conanfile.py b/recipes/libdrm/all/test_package/conanfile.py index 8e9e5fdc7aa40..ef5d7042163ec 100644 --- a/recipes/libdrm/all/test_package/conanfile.py +++ b/recipes/libdrm/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,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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libdrm/all/test_v1_package/CMakeLists.txt b/recipes/libdrm/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/libdrm/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/libdrm/all/test_v1_package/conanfile.py b/recipes/libdrm/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..994065a757445 --- /dev/null +++ b/recipes/libdrm/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): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) + diff --git a/recipes/libdrm/config.yml b/recipes/libdrm/config.yml index 4beea198f8d48..a68056835f7b2 100644 --- a/recipes/libdrm/config.yml +++ b/recipes/libdrm/config.yml @@ -1,3 +1,9 @@ versions: + "2.4.120": + folder: all + "2.4.119": + folder: all + "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..bdb4e53c187f7 100644 --- a/recipes/libdwarf/all/conandata.yml +++ b/recipes/libdwarf/all/conandata.yml @@ -1,8 +1,64 @@ sources: - "20191104": - url: "https://www.prevanders.net/libdwarf-20191104.tar.gz" - sha256: "45f50a966314421b7dab525859853616df6c9680f0ccf2f44b030c505236eaba" + "0.11.0": + url: "https://github.com/davea42/libdwarf-code/archive/refs/tags/v0.11.0.tar.gz" + sha256: "5135af38dc202206538a3dcdc90675aa8b320e132156849c6855dea5ea0c0729" + "0.10.1": + url: "https://github.com/davea42/libdwarf-code/archive/refs/tags/v0.10.1.tar.gz" + sha256: "4ab8ae7b4b7aa42453725054b348f4fdb2460d5ba644199a1305311c718ff416" + "0.9.2": + url: "https://github.com/davea42/libdwarf-code/archive/refs/tags/v0.9.2.tar.gz" + sha256: "5371c68248c16a4a9cb071284c87c0cdb8f560d5277e0b86893fdc6576062f95" + "0.9.1": + url: "https://github.com/davea42/libdwarf-code/archive/refs/tags/v0.9.1.tar.gz" + sha256: "6da3f46a9f92b4e284c97c733851879d9b91b16642bede90c7614860a946824e" + "0.9.0": + url: "https://github.com/davea42/libdwarf-code/archive/refs/tags/v0.9.0.tar.gz" + sha256: "6d4c0ee8a869e68dfeb15c99b869cafca7a5f715ecfc699cbf4fd30729b33226" + "0.8.0": + url: "https://github.com/davea42/libdwarf-code/archive/refs/tags/v0.8.0.tar.gz" + sha256: "8ef0dbfb0816b02aac97b87426689ebaa4efb8ec2ca2c759ea34c5e4678dff3f" + "0.7.0": + url: "https://www.prevanders.net/libdwarf-0.7.0.tar.xz" + sha256: "23b71829de875fa5842e49f232c8ee1a5043805749738bc61424d9abc1189f38" + "0.5.0": + url: "https://www.prevanders.net/libdwarf-0.5.0.tar.xz" + sha256: "11fa822c60317fa00e1a01a2ac9e8388f6693e8662ab72d352c5f50c7e0112a9" patches: - "20191104": - - base_path: "source_subfolder" - patch_file: "patches/0001-patch.patch" + "0.11.0": + - patch_file: "patches/0.10.1-0001-fixes.patch" + patch_description: "fix DW_API definition and cmake" + patch_type: "portability" + "0.10.1": + - patch_file: "patches/0.10.1-0001-fixes.patch" + patch_description: "fix DW_API definition and cmake" + patch_type: "portability" + "0.9.2": + - patch_file: "patches/0.9.2-0001-fixes.patch" + patch_description: "fix DW_API definition and cmake" + patch_type: "portability" + "0.9.1": + - patch_file: "patches/0.9.1-0001-fixes.patch" + patch_description: "fix DW_API definition and cmake" + patch_type: "portability" + "0.9.0": + - patch_file: "patches/0.9.0-0001-fixes.patch" + patch_description: "fix DW_API definition and cmake" + patch_type: "portability" + "0.8.0": + - patch_file: "patches/0.8.0-0001-fixes.patch" + patch_description: "fix DW_API definition and cmake" + patch_type: "portability" + "0.7.0": + - patch_file: "patches/0.7.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" + "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" diff --git a/recipes/libdwarf/all/conanfile.py b/recipes/libdwarf/all/conanfile.py index f752998831935..7deafab14a912 100644 --- a/recipes/libdwarf/all/conanfile.py +++ b/recipes/libdwarf/all/conanfile.py @@ -1,42 +1,37 @@ -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 +from conan.tools.scm import Version 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", "GPL-2.0-only") 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") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], + "with_dwarfgen": [True, False], + "with_dwarfdump": [True, False], } default_options = { "shared": False, "fPIC": True, + "with_dwarfgen": False, + "with_dwarfdump": 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 +39,71 @@ 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 = (l for l in self.license if l != "BSD-2-Clause-Views") + if not self.options.with_dwarfdump: + self.license = (l for l in self.license if l != "GPL-2.0-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") + if self.options.with_dwarfgen: + self.requires("libelf/0.8.13") + self.requires("zlib/[>=1.2.11 <2]") + if Version(self.version) >= Version("0.9.0"): + self.requires("zstd/[~1.5]") 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_DWARFDUMP"] = self.options.with_dwarfdump + 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() + 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")) + if self.options.with_dwarfdump: + copy(self, pattern="GPL.txt", dst=os.path.join(self.package_folder, "licenses"), src=os.path.join(self.source_folder, "src", "bin", "dwarfdump")) + rename(self, os.path.join(self.package_folder, "licenses", "GPL.txt"), os.path.join(self.package_folder, "licenses", "COPYING-dwarfdump")) + 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) + self.cpp_info.libs.append("dwarfp") diff --git a/recipes/libdwarf/all/patches/0.10.1-0001-fixes.patch b/recipes/libdwarf/all/patches/0.10.1-0001-fixes.patch new file mode 100644 index 0000000000000..8b49c6af7451b --- /dev/null +++ b/recipes/libdwarf/all/patches/0.10.1-0001-fixes.patch @@ -0,0 +1,65 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f219f078..d8a78136 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -226,6 +226,12 @@ if (ENABLE_DECOMPRESSION) + set(HAVE_ZSTD_H TRUE) + set(BUILT_WITH_ZLIB_AND_ZSTD TRUE) + endif() ++ find_package(zstd CONFIG REQUIRED) ++ if(TARGET zstd::libzstd_shared) ++ set(ZSTD_LIB zstd::libzstd_shared) ++ else() ++ set(ZSTD_LIB zstd::libzstd_static) ++ endif() + endif () + + message(STATUS "CMAKE_SIZEOF_VOID_P ... " ${CMAKE_SIZEOF_VOID_P} ) +diff --git a/src/lib/libdwarf/CMakeLists.txt b/src/lib/libdwarf/CMakeLists.txt +index 02787555..862c97b8 100644 +--- a/src/lib/libdwarf/CMakeLists.txt ++++ b/src/lib/libdwarf/CMakeLists.txt +@@ -117,7 +117,7 @@ install(TARGETS dwarf + PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" + ) + +-configure_file(libdwarf.pc.in libdwarf.pc @ONLY) ++# configure_file(libdwarf.pc.in libdwarf.pc @ONLY) + + # The install has to be here, not in + # another CMakeLists.txt to make install work properly +@@ -135,5 +135,5 @@ install(EXPORT libdwarfTargets + FILE libdwarf-targets.cmake + NAMESPACE libdwarf:: + DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/libdwarf") +-install(FILES "${PROJECT_BINARY_DIR}/src/lib/libdwarf/libdwarf.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") ++# install(FILES "${PROJECT_BINARY_DIR}/src/lib/libdwarf/libdwarf.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") + install(FILES "${PROJECT_SOURCE_DIR}/cmake/Findzstd.cmake" DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/libdwarf") +index 380d2ef7..8c62ee7e 100644 +--- a/src/lib/libdwarf/libdwarf.h ++++ b/src/lib/libdwarf/libdwarf.h +@@ -51,7 +51,7 @@ + #endif /* DW_API */ + + #ifndef LIBDWARF_STATIC +-# 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/src/lib/libdwarf/libdwarf_private.h b/src/lib/libdwarf/libdwarf_private.h +index b37ae994..7fa89256 100644 +--- a/src/lib/libdwarf/libdwarf_private.h ++++ b/src/lib/libdwarf/libdwarf_private.h +@@ -26,11 +26,7 @@ + #ifdef _MSC_VER /* Macro to select VS compiler */ + #include + typedef SSIZE_T ssize_t; +-#ifdef _WIN64 +-typedef long long off_t; +-#else + typedef long off_t; +-#endif + #endif /* _MSC_VER */ + + #ifndef TRUE 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..cd8664d42f3dc --- /dev/null +++ b/recipes/libdwarf/all/patches/0.5.0-0001-fix-cmake.patch @@ -0,0 +1,115 @@ +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) + 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}) + +@@ -119,6 +121,9 @@ install( + ) + install(DIRECTORY libdwarf DESTINATION include/ + FILES_MATCHING PATTERN "*.h") ++install( ++ FILES ${CMAKE_CURRENT_SOURCE_DIR}/dwarf.h ++ DESTINATION include/libdwarf) + install( + FILES ${CMAKE_CURRENT_SOURCE_DIR}/libdwarf.h + DESTINATION include/libdwarf) diff --git a/recipes/libdwarf/all/patches/0.7.0-0001-fix-cmake.patch b/recipes/libdwarf/all/patches/0.7.0-0001-fix-cmake.patch new file mode 100644 index 0000000000000..bb0a859d8fd82 --- /dev/null +++ b/recipes/libdwarf/all/patches/0.7.0-0001-fix-cmake.patch @@ -0,0 +1,128 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index dd09dde8..8162a985 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -129,6 +129,9 @@ check_include_file( "libelf/libelf.h" HAVE_LIBELF_LIBELF_H) + + ### cmake provides no way to guarantee uint32_t present. + ### configure does guarantee that. ++if (BUILD_DWARFGEN) ++ find_package(libelf REQUIRED) ++endif() + if(HAVE_STDINT_H) + check_c_source_compiles(" + #include +@@ -192,7 +195,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 +220,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 +368,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 +390,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 507f761d..8ddb0d90 100644 +--- a/src/bin/dwarfdump/CMakeLists.txt ++++ b/src/bin/dwarfdump/CMakeLists.txt +@@ -64,7 +64,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 a7f5d78e..60293f6b 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 913274b8..8515e2b0 100644 +--- a/src/lib/libdwarf/CMakeLists.txt ++++ b/src/lib/libdwarf/CMakeLists.txt +@@ -70,7 +70,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() +@@ -88,13 +88,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}) + +@@ -105,7 +107,6 @@ foreach(i RANGE ${targetCount}) + endforeach() + + # add_library(libdwarf) +-configure_file(libdwarf.pc.cmake libdwarf.pc @ONLY ) + + # The install has to be here, not in + # another CMakeLists.txt to make install work properly +@@ -126,9 +127,9 @@ install( + ) + install(DIRECTORY libdwarf DESTINATION include/ + FILES_MATCHING PATTERN "*.h") ++install( ++ FILES ${CMAKE_CURRENT_SOURCE_DIR}/dwarf.h ++ DESTINATION include/libdwarf) + install( + FILES ${CMAKE_CURRENT_SOURCE_DIR}/libdwarf.h + DESTINATION include/libdwarf) +-install( FILES ${PROJECT_BINARY_DIR}/src/lib/libdwarf/libdwarf.pc +- DESTINATION lib/pkgconfig +-) diff --git a/recipes/libdwarf/all/patches/0.8.0-0001-fixes.patch b/recipes/libdwarf/all/patches/0.8.0-0001-fixes.patch new file mode 100644 index 0000000000000..0393ff627c4ca --- /dev/null +++ b/recipes/libdwarf/all/patches/0.8.0-0001-fixes.patch @@ -0,0 +1,57 @@ +diff --git src/bin/dwarfdump/CMakeLists.txt src/bin/dwarfdump/CMakeLists.txt +index 1b8aa3ae..72819160 100644 +--- src/bin/dwarfdump/CMakeLists.txt ++++ 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 src/lib/libdwarf/CMakeLists.txt src/lib/libdwarf/CMakeLists.txt +index 09908bba..a33f92c8 100644 +--- src/lib/libdwarf/CMakeLists.txt ++++ src/lib/libdwarf/CMakeLists.txt +@@ -109,7 +109,6 @@ foreach(i RANGE ${targetCount}) + + set_target_properties(${target} PROPERTIES OUTPUT_NAME dwarf) + +- set(SUFFIX $<$:64>) + set(LIBDIR lib${SUFFIX}) + set(BINDIR bin${SUFFIX}) + +@@ -119,7 +118,7 @@ foreach(i RANGE ${targetCount}) + ARCHIVE DESTINATION ${LIBDIR}) + endforeach() + +-configure_file(libdwarf.pc.cmake libdwarf.pc @ONLY ) ++#configure_file(libdwarf.pc.cmake libdwarf.pc @ONLY ) + + # The install has to be here, not in + # another CMakeLists.txt to make install work properly +@@ -144,6 +143,6 @@ install( + install( + FILES ${CMAKE_CURRENT_SOURCE_DIR}/dwarf.h + DESTINATION include/libdwarf) +-install( FILES ${PROJECT_BINARY_DIR}/src/lib/libdwarf/libdwarf.pc +- DESTINATION lib/pkgconfig +-) ++#install( FILES ${PROJECT_BINARY_DIR}/src/lib/libdwarf/libdwarf.pc ++# DESTINATION lib/pkgconfig ++#) +diff --git src/lib/libdwarf/libdwarf.h src/lib/libdwarf/libdwarf.h +index 9a0783e3..0bce4d09 100644 +--- src/lib/libdwarf/libdwarf.h ++++ src/lib/libdwarf/libdwarf.h +@@ -51,7 +51,7 @@ + #endif /* DW_API */ + + #ifndef LIBDWARF_STATIC +-# 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.9.0-0001-fixes.patch b/recipes/libdwarf/all/patches/0.9.0-0001-fixes.patch new file mode 100644 index 0000000000000..5c91298881e9c --- /dev/null +++ b/recipes/libdwarf/all/patches/0.9.0-0001-fixes.patch @@ -0,0 +1,105 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f444af27..5c9390d1 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -181,14 +181,20 @@ endif() + + # Zlib and ZSTD need to be found otherwise disable it + find_package(ZLIB) +-find_package(ZSTD) +-if (ZLIB_FOUND AND ZSTD_FOUND ) ++find_package(zstd) ++if (ZLIB_FOUND AND zstd_FOUND ) + set(HAVE_ZLIB TRUE) + set(HAVE_ZLIB_H TRUE) + set(HAVE_ZSTD TRUE) + set(HAVE_ZSTD_H TRUE) + endif() + ++if(TARGET zstd::libzstd_shared) ++ set(ZSTD_LIB zstd::libzstd_shared) ++else() ++ set(ZSTD_LIB zstd::libzstd_static) ++endif() ++ + message(STATUS "CMAKE_SIZEOF_VOID_P ... " ${CMAKE_SIZEOF_VOID_P} ) + + # DW_FWALLXX are gnu C++ options. +diff --git a/src/bin/dwarfdump/CMakeLists.txt b/src/bin/dwarfdump/CMakeLists.txt +index 6d2c328b..bc105813 100644 +--- a/src/bin/dwarfdump/CMakeLists.txt ++++ b/src/bin/dwarfdump/CMakeLists.txt +@@ -68,7 +68,7 @@ target_compile_options(dwarfdump PRIVATE ${DW_FWALL}) + + target_link_libraries(dwarfdump PRIVATE dwarf) + +-if(${CMAKE_SIZEOF_VOID_P} EQUAL 8) ++if(0) + set(SUFFIX 64) + endif() + set(LIBDIR lib${SUFFIX}) +diff --git a/src/lib/libdwarf/CMakeLists.txt b/src/lib/libdwarf/CMakeLists.txt +index 4ad5c4fb..052208a1 100644 +--- a/src/lib/libdwarf/CMakeLists.txt ++++ b/src/lib/libdwarf/CMakeLists.txt +@@ -107,11 +107,10 @@ target_include_directories(dwarf PUBLIC + $ + $ + ) +-if(ZLIB_FOUND AND ZSTD_FOUND) +- target_link_libraries(dwarf PRIVATE ZLIB::ZLIB ZSTD::ZSTD ) ++if(ZLIB_FOUND AND zstd_FOUND) ++ target_link_libraries(dwarf PRIVATE ZLIB::ZLIB ${ZSTD_LIB} ) + endif() + +-set(SUFFIX $<$:64>) + set(LIBDIR lib${SUFFIX}) + set(BINDIR bin${SUFFIX}) + +@@ -120,7 +119,7 @@ install(TARGETS dwarf + LIBRARY DESTINATION ${LIBDIR} + ARCHIVE DESTINATION ${LIBDIR}) + +-configure_file(libdwarf.pc.cmake libdwarf.pc @ONLY ) ++# configure_file(libdwarf.pc.cmake libdwarf.pc @ONLY ) + + # The install has to be here, not in + # another CMakeLists.txt to make install work properly +@@ -145,6 +144,8 @@ install( + install( + FILES ${CMAKE_CURRENT_SOURCE_DIR}/dwarf.h + DESTINATION include/libdwarf) ++if(0) + install( FILES ${PROJECT_BINARY_DIR}/src/lib/libdwarf/libdwarf.pc + DESTINATION lib/pkgconfig + ) ++endif() +diff --git a/src/lib/libdwarf/libdwarf.h b/src/lib/libdwarf/libdwarf.h +index ed3d1d0b..91f2fd8b 100644 +--- a/src/lib/libdwarf/libdwarf.h ++++ b/src/lib/libdwarf/libdwarf.h +@@ -51,7 +51,7 @@ + #endif /* DW_API */ + + #ifndef LIBDWARF_STATIC +-# 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/src/lib/libdwarf/libdwarf_private.h b/src/lib/libdwarf/libdwarf_private.h +index b37ae994..7fa89256 100644 +--- a/src/lib/libdwarf/libdwarf_private.h ++++ b/src/lib/libdwarf/libdwarf_private.h +@@ -26,11 +26,7 @@ + #ifdef _MSC_VER /* Macro to select VS compiler */ + #include + typedef SSIZE_T ssize_t; +-#ifdef _WIN64 +-typedef long long off_t; +-#else + typedef long off_t; +-#endif + #endif /* _MSC_VER */ + + #ifndef TRUE diff --git a/recipes/libdwarf/all/patches/0.9.1-0001-fixes.patch b/recipes/libdwarf/all/patches/0.9.1-0001-fixes.patch new file mode 100644 index 0000000000000..c7952f7107937 --- /dev/null +++ b/recipes/libdwarf/all/patches/0.9.1-0001-fixes.patch @@ -0,0 +1,86 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 70839abd..972a2b9e 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -188,14 +188,20 @@ if (ENABLE_DECOMPRESSION) + find_package(ZLIB) + endif() + if(NOT TARGET ZSTD::ZSTD) +- find_package(ZSTD) ++ find_package(zstd) + endif() +- if (ZLIB_FOUND AND ZSTD_FOUND ) ++ if (ZLIB_FOUND AND zstd_FOUND ) + set(HAVE_ZLIB TRUE) + set(HAVE_ZLIB_H TRUE) + set(HAVE_ZSTD TRUE) + set(HAVE_ZSTD_H TRUE) + endif() ++ find_package(zstd CONFIG REQUIRED) ++ if(TARGET zstd::libzstd_shared) ++ set(ZSTD_LIB zstd::libzstd_shared) ++ else() ++ set(ZSTD_LIB zstd::libzstd_static) ++ endif() + endif () + + message(STATUS "CMAKE_SIZEOF_VOID_P ... " ${CMAKE_SIZEOF_VOID_P} ) +diff --git a/src/lib/libdwarf/CMakeLists.txt b/src/lib/libdwarf/CMakeLists.txt +index 7500c9f4..ce1461fb 100644 +--- a/src/lib/libdwarf/CMakeLists.txt ++++ b/src/lib/libdwarf/CMakeLists.txt +@@ -104,8 +104,8 @@ target_include_directories(dwarf PUBLIC + $ + $ + ) +-if(ZLIB_FOUND AND ZSTD_FOUND) +- target_link_libraries(dwarf PRIVATE ZLIB::ZLIB ZSTD::ZSTD ) ++if(ZLIB_FOUND AND zstd_FOUND) ++ target_link_libraries(dwarf PRIVATE ZLIB::ZLIB ${ZSTD_LIB} ) + endif() + set_target_properties(dwarf PROPERTIES PUBLIC_HEADER "libdwarf.h;dwarf.h") + +@@ -116,7 +116,7 @@ install(TARGETS dwarf + PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" + ) + +-configure_file(libdwarf.pc.cmake libdwarf.pc @ONLY) ++# configure_file(libdwarf.pc.cmake libdwarf.pc @ONLY) + + # The install has to be here, not in + # another CMakeLists.txt to make install work properly +@@ -131,4 +131,4 @@ install(EXPORT libdwarfTargets + NAMESPACE libdwarf:: + DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/libdwarf") + install(FILES cmake/libdwarf-config.cmake DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/libdwarf") +-install(FILES "${PROJECT_BINARY_DIR}/src/lib/libdwarf/libdwarf.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") ++# install(FILES "${PROJECT_BINARY_DIR}/src/lib/libdwarf/libdwarf.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") +diff --git a/src/lib/libdwarf/libdwarf.h b/src/lib/libdwarf/libdwarf.h +index 380d2ef7..8c62ee7e 100644 +--- a/src/lib/libdwarf/libdwarf.h ++++ b/src/lib/libdwarf/libdwarf.h +@@ -51,7 +51,7 @@ + #endif /* DW_API */ + + #ifndef LIBDWARF_STATIC +-# 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/src/lib/libdwarf/libdwarf_private.h b/src/lib/libdwarf/libdwarf_private.h +index b37ae994..7fa89256 100644 +--- a/src/lib/libdwarf/libdwarf_private.h ++++ b/src/lib/libdwarf/libdwarf_private.h +@@ -26,11 +26,7 @@ + #ifdef _MSC_VER /* Macro to select VS compiler */ + #include + typedef SSIZE_T ssize_t; +-#ifdef _WIN64 +-typedef long long off_t; +-#else + typedef long off_t; +-#endif + #endif /* _MSC_VER */ + + #ifndef TRUE diff --git a/recipes/libdwarf/all/patches/0.9.2-0001-fixes.patch b/recipes/libdwarf/all/patches/0.9.2-0001-fixes.patch new file mode 100644 index 0000000000000..937423ef0cfb3 --- /dev/null +++ b/recipes/libdwarf/all/patches/0.9.2-0001-fixes.patch @@ -0,0 +1,66 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f219f078..d8a78136 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -225,6 +225,12 @@ if (ENABLE_DECOMPRESSION) + set(HAVE_ZSTD_H TRUE) + set(BUILT_WITH_ZLIB_AND_ZSTD TRUE) + endif() ++ find_package(zstd CONFIG REQUIRED) ++ if(TARGET zstd::libzstd_shared) ++ set(ZSTD_LIB zstd::libzstd_shared) ++ else() ++ set(ZSTD_LIB zstd::libzstd_static) ++ endif() + endif () + + message(STATUS "CMAKE_SIZEOF_VOID_P ... " ${CMAKE_SIZEOF_VOID_P} ) +diff --git a/src/lib/libdwarf/CMakeLists.txt b/src/lib/libdwarf/CMakeLists.txt +index 6cb0b24e..069343ba 100644 +--- a/src/lib/libdwarf/CMakeLists.txt ++++ b/src/lib/libdwarf/CMakeLists.txt +@@ -117,7 +117,7 @@ install(TARGETS dwarf + PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" + ) + +-configure_file(libdwarf.pc.cmake libdwarf.pc @ONLY) ++# configure_file(libdwarf.pc.cmake libdwarf.pc @ONLY) + + # The install has to be here, not in + # another CMakeLists.txt to make install work properly +@@ -135,5 +135,5 @@ install(EXPORT libdwarfTargets + FILE libdwarf-targets.cmake + NAMESPACE libdwarf:: + DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/libdwarf") +-install(FILES "${PROJECT_BINARY_DIR}/src/lib/libdwarf/libdwarf.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") ++# install(FILES "${PROJECT_BINARY_DIR}/src/lib/libdwarf/libdwarf.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") + install(FILES "${PROJECT_SOURCE_DIR}/cmake/Findzstd.cmake" DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/libdwarf") +diff --git a/src/lib/libdwarf/libdwarf.h b/src/lib/libdwarf/libdwarf.h +index 380d2ef7..8c62ee7e 100644 +--- a/src/lib/libdwarf/libdwarf.h ++++ b/src/lib/libdwarf/libdwarf.h +@@ -51,7 +51,7 @@ + #endif /* DW_API */ + + #ifndef LIBDWARF_STATIC +-# 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/src/lib/libdwarf/libdwarf_private.h b/src/lib/libdwarf/libdwarf_private.h +index b37ae994..7fa89256 100644 +--- a/src/lib/libdwarf/libdwarf_private.h ++++ b/src/lib/libdwarf/libdwarf_private.h +@@ -26,11 +26,7 @@ + #ifdef _MSC_VER /* Macro to select VS compiler */ + #include + typedef SSIZE_T ssize_t; +-#ifdef _WIN64 +-typedef long long off_t; +-#else + typedef long off_t; +-#endif + #endif /* _MSC_VER */ + + #ifndef TRUE 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/test_package/CMakeLists.txt b/recipes/libdwarf/all/test_package/CMakeLists.txt index d46ff25d16814..8abbd68a6f049 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(${libdwarf_VERSION} VERSION_LESS "0.9.1") + target_compile_definitions(${PROJECT_NAME} PRIVATE "LIBDWARF_NESTED_INCLUDE") +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..287828193ab29 100644 --- a/recipes/libdwarf/all/test_package/test_package.c +++ b/recipes/libdwarf/all/test_package/test_package.c @@ -3,8 +3,13 @@ #include #include -#include "dwarf.h" -#include "libdwarf.h" +#ifdef LIBDWARF_NESTED_INCLUDE + #include "libdwarf/dwarf.h" + #include "libdwarf/libdwarf.h" +#else + #include "dwarf.h" + #include "libdwarf.h" +#endif void example1(Dwarf_Die somedie) { Dwarf_Debug dbg = 0; @@ -16,6 +21,8 @@ void example1(Dwarf_Die somedie) { errv = dwarf_attrlist(somedie, &atlist, &atcount, &error); if (errv == DW_DLV_OK) { for (i = 0; i < atcount; ++i) { + Dwarf_Bool is_string; + dwarf_hasform(atlist[i], DW_FORM_string, &is_string, &error); dwarf_dealloc(dbg, atlist[i], DW_DLA_ATTR); } dwarf_dealloc(dbg, atlist, DW_DLA_LIST); 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..fcb658d2d4a9c 100644 --- a/recipes/libdwarf/config.yml +++ b/recipes/libdwarf/config.yml @@ -1,3 +1,17 @@ versions: - "20191104": + "0.11.0": + folder: all + "0.10.1": + folder: all + "0.9.2": + folder: all + "0.9.1": + folder: all + "0.9.0": + folder: all + "0.8.0": + folder: all + "0.7.0": + folder: all + "0.5.0": 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/conandata.yml b/recipes/libe57format/all/conandata.yml index 857bfbb53a2a6..22a85d05a2b6c 100644 --- a/recipes/libe57format/all/conandata.yml +++ b/recipes/libe57format/all/conandata.yml @@ -1,13 +1,7 @@ sources: - "2.2.0": - sha256: "19df04af07925bf43e1793534b0c77cb1346a2bee7746859d2fe1714a24f1c7d" - url: "https://github.com/asmaloney/libE57Format/archive/refs/tags/v2.2.0.tar.gz" + "3.1.1": + url: "https://github.com/asmaloney/libE57Format/archive/refs/tags/v3.1.1.tar.gz" + sha256: "949e73db3cb90ed7d286c49d12c6925813ead8d92ff9b84e0fba17fa015194d0" "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/0001-fix-pic.patch" - - patch_file: "patches/0002-missing-include.patch" - "2.3.0": - - patch_file: "patches/2.3.0-0001-fix-pic.patch" + sha256: "124cc8f7dda84e8686ff2bcffc524ee4677eba3183631ec847a5f4a6ea60b254" diff --git a/recipes/libe57format/all/conanfile.py b/recipes/libe57format/all/conanfile.py index 479e129d3bbf3..6b01ec8d3ecfa 100644 --- a/recipes/libe57format/all/conanfile.py +++ b/recipes/libe57format/all/conanfile.py @@ -1,11 +1,14 @@ +import os +import textwrap + 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 +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import copy, get, rmdir, save, replace_in_file +from conan.tools.scm import Version -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class LibE57FormatConan(ConanFile): @@ -16,6 +19,7 @@ class LibE57FormatConan(ConanFile): description = "Library for reading & writing the E57 file format" topics = ("e57", "io", "point-cloud") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -26,43 +30,53 @@ class LibE57FormatConan(ConanFile): "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: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("xerces-c/3.2.3") + self.requires("xerces-c/3.2.5") def validate(self): if self.info.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, "11") + def build_requirements(self): + self.tool_requires("cmake/[>=3.16.3 <4]") + 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): + venv = VirtualBuildEnv(self) + venv.generate() tc = CMakeToolchain(self) + tc.variables["E57_BUILD_SHARED"] = self.options.shared + tc.variables["E57_BUILD_TEST"] = False tc.variables["USING_STATIC_XERCES"] = not self.dependencies["xerces-c"].options.shared tc.generate() deps = CMakeDeps(self) deps.generate() + def _patch_sources(self): + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "POSITION_INDEPENDENT_CODE ON", "") + if Version(self.version) >= "3.0": + # Disable compiler warnings, which cause older versions of GCC to fail due to unrecognized flags + replace_in_file(self, os.path.join(self.source_folder, "cmake", "CompilerWarnings.cmake"), + " -W", " # -W") + # Disable warnings as errors + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "set_warning_as_error()", "") + def build(self): - apply_conandata_patches(self) + self._patch_sources() cmake = CMake(self) cmake.configure() cmake.build() diff --git a/recipes/libe57format/all/patches/0001-fix-pic.patch b/recipes/libe57format/all/patches/0001-fix-pic.patch deleted file mode 100644 index 76ed8c2509a69..0000000000000 --- a/recipes/libe57format/all/patches/0001-fix-pic.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -104,7 +104,6 @@ - CXX_STANDARD_REQUIRED YES - CXX_EXTENSIONS NO - DEBUG_POSTFIX "-d" -- POSITION_INDEPENDENT_CODE ON - ) - - # Target definitions diff --git a/recipes/libe57format/all/patches/0002-missing-include.patch b/recipes/libe57format/all/patches/0002-missing-include.patch deleted file mode 100644 index 50253b05d6c2a..0000000000000 --- a/recipes/libe57format/all/patches/0002-missing-include.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- 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 deleted file mode 100644 index a2ecc0de60e33..0000000000000 --- a/recipes/libe57format/all/patches/2.3.0-0001-fix-pic.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- 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/config.yml b/recipes/libe57format/config.yml index 137671316c059..79be4753bc883 100644 --- a/recipes/libe57format/config.yml +++ b/recipes/libe57format/config.yml @@ -1,5 +1,5 @@ versions: - "2.2.0": + "3.1.1": folder: all "2.3.0": folder: all diff --git a/recipes/libelf/all/conanfile.py b/recipes/libelf/all/conanfile.py index eb3ec50947bff..c93a47a212b33 100644 --- a/recipes/libelf/all/conanfile.py +++ b/recipes/libelf/all/conanfile.py @@ -8,7 +8,7 @@ from conan.tools.microsoft import unix_path import os -required_conan_version = ">=1.53.0" +required_conan_version = ">=1.54.0" class LibelfConan(ConanFile): @@ -18,7 +18,7 @@ class LibelfConan(ConanFile): homepage = "https://directory.fsf.org/wiki/Libelf" license = "LGPL-2.0" topics = ("elf", "fsf", "libelf", "object-file") - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -40,7 +40,10 @@ def config_options(self): del self.options.fPIC def configure(self): - if self.options.shared: + if self.settings.os not in ["Linux", "FreeBSD", "Windows"]: + self.options.rm_safe("shared") + self.package_type = "static-library" + if self.options.get_safe("shared"): self.options.rm_safe("fPIC") self.settings.rm_safe("compiler.cppstd") self.settings.rm_safe("compiler.libcxx") @@ -51,10 +54,6 @@ def layout(self): else: basic_layout(self, src_folder="src") - def validate(self): - if self.info.options.shared and self.info.settings.os not in ["Linux", "FreeBSD", "Windows"]: - raise ConanInvalidConfiguration("libelf can not be built as shared library on non linux/FreeBSD/windows platforms") - def build_requirements(self): if self.settings.os != "Windows": self.tool_requires("autoconf/2.71") @@ -65,8 +64,7 @@ def build_requirements(self): self.tool_requires("msys2/cci.latest") 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 self.settings.os == "Windows": @@ -112,10 +110,9 @@ def package(self): cmake.install() else: 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)}"]) + autotools.install() rmdir(self, os.path.join(self.package_folder, "lib", "locale")) - if self.options.shared: + if self.options.get_safe("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")) diff --git a/recipes/libelfin/all/CMakeLists.txt b/recipes/libelfin/all/CMakeLists.txt index eb2aa34b81ac8..98010e3796993 100644 --- a/recipes/libelfin/all/CMakeLists.txt +++ b/recipes/libelfin/all/CMakeLists.txt @@ -1,9 +1,6 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.12) project(libelfin CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - if(NOT CMAKE_CXX_STANDARD) set(CMAKE_CXX_STANDARD 11) endif() @@ -11,19 +8,21 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) find_package(PythonInterp 3 REQUIRED) -file(GLOB_RECURSE elf_sources source_subfolder/elf/*.cc) +set(src ${CMAKE_CURRENT_LIST_DIR}) + +file(GLOB_RECURSE elf_sources ${src}/elf/*.cc) set(elf_headers - source_subfolder/elf/common.hh - source_subfolder/elf/data.hh - source_subfolder/elf/elf++.hh) -file(GLOB_RECURSE dwarf_sources source_subfolder/dwarf/*.cc) + ${src}/elf/common.hh + ${src}/elf/data.hh + ${src}/elf/elf++.hh) +file(GLOB_RECURSE dwarf_sources ${src}/dwarf/*.cc) set(dwarf_headers - source_subfolder/dwarf/data.hh - source_subfolder/dwarf/dwarf++.hh - source_subfolder/dwarf/small_vector.hh) + ${src}/dwarf/data.hh + ${src}/dwarf/dwarf++.hh + ${src}/dwarf/small_vector.hh) add_custom_command( - OUTPUT source_subfolder/elf/to_string.cc + OUTPUT ${src}/elf/to_string.cc COMMAND ${CMAKE_COMMAND} -E echo '// Automatically generated' > to_string.cc COMMAND ${CMAKE_COMMAND} -E echo '// DO NOT EDIT' >> to_string.cc COMMAND ${CMAKE_COMMAND} -E echo >> to_string.cc @@ -34,11 +33,11 @@ add_custom_command( COMMAND ${CMAKE_COMMAND} -E echo >> to_string.cc COMMAND ${PYTHON_EXECUTABLE} enum-print.py -u --hex --no-type --mask shf --mask pf -x loos -x hios -x loproc -x hiproc < data.hh >> to_string.cc COMMAND ${CMAKE_COMMAND} -E echo 'ELFPP_END_NAMESPACE' >> to_string.cc - DEPENDS source_subfolder/elf/enum-print.py source_subfolder/elf/data.hh - WORKING_DIRECTORY source_subfolder/elf) + DEPENDS ${src}/elf/enum-print.py ${src}/elf/data.hh + WORKING_DIRECTORY ${src}/elf) add_custom_command( - OUTPUT source_subfolder/dwarf/to_string.cc + OUTPUT ${src}/dwarf/to_string.cc COMMAND ${CMAKE_COMMAND} -E echo '// Automatically generated' > to_string.cc COMMAND ${CMAKE_COMMAND} -E echo '// DO NOT EDIT' >> to_string.cc COMMAND ${CMAKE_COMMAND} -E echo >> to_string.cc @@ -49,29 +48,23 @@ add_custom_command( COMMAND ${PYTHON_EXECUTABLE} ../elf/enum-print.py < dwarf++.hh >> to_string.cc COMMAND ${PYTHON_EXECUTABLE} ../elf/enum-print.py -s _ -u --hex -x hi_user -x lo_user < data.hh >> to_string.cc COMMAND ${CMAKE_COMMAND} -E echo 'DWARFPP_END_NAMESPACE' >> to_string.cc - DEPENDS source_subfolder/elf/enum-print.py source_subfolder/dwarf/data.hh - WORKING_DIRECTORY source_subfolder/dwarf) + DEPENDS ${src}/elf/enum-print.py ${src}/dwarf/data.hh + WORKING_DIRECTORY ${src}/dwarf) -add_library(elf++ ${elf_sources} source_subfolder/elf/to_string.cc) +add_library(elf++ ${elf_sources} ${src}/elf/to_string.cc) set_target_properties(elf++ PROPERTIES PUBLIC_HEADER "${elf_headers}" - VERSION ${CONAN_PACKAGE_VERSION}) + VERSION ${libelfin_VERSION}) -add_library(dwarf++ ${dwarf_sources} source_subfolder/dwarf/to_string.cc) +add_library(dwarf++ ${dwarf_sources} ${src}/dwarf/to_string.cc) set_target_properties(dwarf++ PROPERTIES PUBLIC_HEADER "${dwarf_headers}" - VERSION ${CONAN_PACKAGE_VERSION}) + VERSION ${libelfin_VERSION}) include(GNUInstallDirs) install(TARGETS elf++ - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libelfin/elf) install(TARGETS dwarf++ - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libelfin/dwarf) -install(FILES source_subfolder/LICENSE DESTINATION licenses) +install(FILES ${src}/LICENSE DESTINATION licenses) diff --git a/recipes/libelfin/all/conandata.yml b/recipes/libelfin/all/conandata.yml index e1b6341e83185..c74c8954691d8 100644 --- a/recipes/libelfin/all/conandata.yml +++ b/recipes/libelfin/all/conandata.yml @@ -5,7 +5,6 @@ sources: patches: "0.3": - patch_file: "patches/commit-9d0db16d0a0b3c4f8aaa60a3e4dab295df34b6b2.patch" - base_path: "source_subfolder" - patch_file: "patches/const-fix.patch" - base_path: "source_subfolder" - # patch_source: https://github.com/aclements/libelfin/pull/54 + patch_source: "https://github.com/aclements/libelfin/pull/54" + patch_type: "bugfix" diff --git a/recipes/libelfin/all/conanfile.py b/recipes/libelfin/all/conanfile.py index d53acbbfd0abe..852c1494c8a65 100644 --- a/recipes/libelfin/all/conanfile.py +++ b/recipes/libelfin/all/conanfile.py @@ -1,64 +1,82 @@ -import os -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 + +required_conan_version = ">=1.53.0" class LibelfinConan(ConanFile): name = "libelfin" description = "C++11 library for reading ELF binaries and DWARFv4 debug information" + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/aclements/libelfin" - license = "MIT" - topics = ("conan", "elf", "dwarf", "libelfin") + topics = ("elf", "dwarf") + package_type = "library" settings = "os", "arch", "compiler", "build_type" - options = {"shared": [True, False], "fPIC": [True, False]} - default_options = {"shared": False, "fPIC": True} - - exports_sources = "CMakeLists.txt", "patches/*" - generators = "cmake" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } - _cmake = None - _source_subfolder = "source_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": del self.options.fPIC def configure(self): - if self.settings.compiler == "Visual Studio": - raise ConanInvalidConfiguration("libelfin doesn't support compiler: {} on OS: {}.". - format(self.settings.compiler, self.settings.os)) 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 validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) + if is_msvc(self): + raise ConanInvalidConfiguration(f"libelfin doesn't support compiler: {self.settings.compiler}.") 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 _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["libelfin_VERSION"] = self.version + tc.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + copy(self, "CMakeLists.txt", src=self.export_sources_folder, dst=self.source_folder) 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): - cmake = self._configure_cmake() + cmake = CMake(self) cmake.install() def package_info(self): - self.cpp_info.components["libelf++"].names["pkg_config"] = "libelf++" + self.cpp_info.components["libelf++"].set_property("pkg_config_name", "libelf++") self.cpp_info.components["libelf++"].libs = ["elf++"] - self.cpp_info.components["libdwarf++"].names["pkg_config"] = "libdwarf++" + self.cpp_info.components["libdwarf++"].set_property("pkg_config_name", "libdwarf++") self.cpp_info.components["libdwarf++"].libs = ["dwarf++"] self.cpp_info.components["libdwarf++"].requires = ["libelf++"] + + # TODO: Legacy, to be removed on Conan 2.0 + self.cpp_info.components["libelf++"].names["pkg_config"] = "libelf++" + self.cpp_info.components["libdwarf++"].names["pkg_config"] = "libdwarf++" diff --git a/recipes/libelfin/all/test_package/CMakeLists.txt b/recipes/libelfin/all/test_package/CMakeLists.txt index 36df85d833b7f..3d1d60bfa1834 100644 --- a/recipes/libelfin/all/test_package/CMakeLists.txt +++ b/recipes/libelfin/all/test_package/CMakeLists.txt @@ -1,11 +1,10 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(libelfin REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE libelfin::libelfin) set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED ON) diff --git a/recipes/libelfin/all/test_package/Makefile b/recipes/libelfin/all/test_package/Makefile deleted file mode 100644 index ccf962b53e8bc..0000000000000 --- a/recipes/libelfin/all/test_package/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -# From http://timelessname.com/elfbin/ - -hello: hello.asm - nasm -f elf hello.asm - gcc -m32 -s -o hello hello.o -nostartfiles -nostdlib -nodefaultlibs diff --git a/recipes/libelfin/all/test_package/conanfile.py b/recipes/libelfin/all/test_package/conanfile.py index e2a48eb337ec0..d7de1f914ce42 100644 --- a/recipes/libelfin/all/test_package/conanfile.py +++ b/recipes/libelfin/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_layout, CMake + 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,8 +22,6 @@ def build(self): cmake.build() def test(self): - if tools.cross_building(self.settings): - return - bin_path = os.path.join("bin", "test_package") - elf_path = os.path.join(self.source_folder, "hello") - self.run("{} {}".format(bin_path, elf_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/libelfin/all/test_package/hello b/recipes/libelfin/all/test_package/hello deleted file mode 100644 index 7202f6f7d512e..0000000000000 Binary files a/recipes/libelfin/all/test_package/hello and /dev/null differ diff --git a/recipes/libelfin/all/test_package/hello.asm b/recipes/libelfin/all/test_package/hello.asm deleted file mode 100644 index 0cc26b9d3a4a8..0000000000000 --- a/recipes/libelfin/all/test_package/hello.asm +++ /dev/null @@ -1,16 +0,0 @@ - SECTION .data -msg: db "Hi World",10 -len: equ $-msg - - SECTION .text - global main -main: - mov edx,len - mov ecx,msg - mov ebx,1 - mov eax,4 - int 0x80 - mov ebx,0 - mov eax,1 - int 0x80 - diff --git a/recipes/libelfin/all/test_package/test_package.cpp b/recipes/libelfin/all/test_package/test_package.cpp index 41843df23299f..4cec1bba9e2d9 100644 --- a/recipes/libelfin/all/test_package/test_package.cpp +++ b/recipes/libelfin/all/test_package/test_package.cpp @@ -1,29 +1,8 @@ -#include +#include #include -#include -#include -#include - -int -main(int argc, char** argv) -{ - using elf::to_string; - - int fd = open(argv[1], O_RDONLY); - elf::elf f(elf::create_mmap_loader(fd)); - - auto& hdr = f.get_hdr(); - std::cout << "ELF Header:\n"; - std::cout << " Magic: " << std::hex; - for (auto c : hdr.ei_magic) - std::cout << ' ' << static_cast(c); - std::cout << '\n'; - std::cout << " Class: " << to_string(hdr.ei_class) << '\n'; - std::cout << " Data: " << to_string(hdr.ei_data) << '\n'; - std::cout << " Version: " << static_cast(hdr.ei_version) << '\n'; - std::cout << " OS/ABI: " << to_string(hdr.ei_osabi) << '\n'; - std::cout << " ABI Version: " << static_cast(hdr.ei_abiversion) << '\n'; - std::cout << " Type: " << to_string(hdr.type) << '\n'; +int main() { + elf::pt pt_obj = elf::pt::load; + std::cout << elf::to_string(pt_obj) << std::endl; return 0; } diff --git a/recipes/libelfin/all/test_v1_package/CMakeLists.txt b/recipes/libelfin/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/libelfin/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/libelfin/all/test_v1_package/conanfile.py b/recipes/libelfin/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..fe9ecdf1845cc --- /dev/null +++ b/recipes/libelfin/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 tools.cross_building(self.settings): + return + bin_path = os.path.join("bin", "test_package") + elf_path = os.path.join(self.source_folder, os.pardir, "test_package", "hello") + self.run(f"{bin_path} {elf_path}", run_environment=True) diff --git a/recipes/libenvpp/all/conandata.yml b/recipes/libenvpp/all/conandata.yml new file mode 100644 index 0000000000000..81f905ac642ae --- /dev/null +++ b/recipes/libenvpp/all/conandata.yml @@ -0,0 +1,37 @@ +sources: + "1.5.0": + url: "https://github.com/ph3at/libenvpp/archive/refs/tags/v1.5.0.tar.gz" + sha256: "5318c43ea7e8197243c77c62f3a60564b0f8d9c46f547bbd01201ba104b76f6b" + "1.4.3": + url: "https://github.com/ph3at/libenvpp/archive/refs/tags/v1.4.3.tar.gz" + sha256: "affbd735b6f47615a54c9159baef9de206cc85badb5af4f662669f3789a13fa8" + "1.4.1": + url: "https://github.com/ph3at/libenvpp/archive/refs/tags/v1.4.1.tar.gz" + sha256: "1bcd0a1eb4eef32a53cbb410ae38d708ea662e491cc5536cb9b15d54cc8b5707" + "1.4.0": + url: "https://github.com/ph3at/libenvpp/archive/refs/tags/v1.4.0.tar.gz" + sha256: "3f9a4a4b62abc06522de76e3a999cc3cd6b60299dc26b28ccc2183aa614f10cd" + "1.3.0": + url: "https://github.com/ph3at/libenvpp/archive/refs/tags/v1.3.0.tar.gz" + sha256: "9201ae39dc67118ee46b4e60fe2e5d22b046faceae4a4b4eec6ab62bc48875dd" +patches: + "1.5.0": + - patch_file: "patches/1.5.0-0001-use-cci-fmt.patch" + patch_description: "use cci fmt package, remove static flag from add_library" + patch_type: "conan" + "1.4.3": + - patch_file: "patches/1.4.3-0001-use-cci-fmt.patch" + patch_description: "use cci fmt package, remove static flag from add_library" + patch_type: "conan" + "1.4.1": + - patch_file: "patches/1.3.0-0001-use-cci-fmt.patch" + patch_description: "use cci fmt package, remove static flag from add_library" + patch_type: "conan" + "1.4.0": + - patch_file: "patches/1.3.0-0001-use-cci-fmt.patch" + patch_description: "use cci fmt package, remove static flag from add_library" + patch_type: "conan" + "1.3.0": + - patch_file: "patches/1.3.0-0001-use-cci-fmt.patch" + patch_description: "use cci fmt package, remove static flag from add_library" + patch_type: "conan" diff --git a/recipes/libenvpp/all/conanfile.py b/recipes/libenvpp/all/conanfile.py new file mode 100644 index 0000000000000..752e254ee325f --- /dev/null +++ b/recipes/libenvpp/all/conanfile.py @@ -0,0 +1,93 @@ +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.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +import os + +required_conan_version = ">=1.53.0" + +class LibenvppConan(ConanFile): + name = "libenvpp" + description = "A modern C++ library for type-safe environment variable parsing" + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/ph3at/libenvpp" + topics = ("environment", "type-safe") + package_type = "static-library" + 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 { + "Visual Studio": "16", + "msvc": "191", + "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 requirements(self): + self.requires("fmt/10.2.1", transitive_headers=True) + + def build_requirements(self): + self.tool_requires("cmake/[>=3.16 <4]") + + 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["LIBENVPP_TESTS"] = False + tc.variables["LIBENVPP_EXAMPLES"] = False + tc.variables["LIBENVPP_CHECKS"] = False + tc.variables["LIBENVPP_INSTALL"] = True + tc.generate() + tc = CMakeDeps(self) + 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.libs = ["envpp" if self.settings.os != "Windows" else "libenvpp"] diff --git a/recipes/libenvpp/all/patches/1.3.0-0001-use-cci-fmt.patch b/recipes/libenvpp/all/patches/1.3.0-0001-use-cci-fmt.patch new file mode 100644 index 0000000000000..d89edb409485d --- /dev/null +++ b/recipes/libenvpp/all/patches/1.3.0-0001-use-cci-fmt.patch @@ -0,0 +1,30 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index e3ecffb..49cae57 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -54,6 +54,7 @@ function(libenvpp_set_compiler_parameters TARGET) + endfunction() + + # External dependencies. ++if(0) + if(LIBENVPP_INSTALL) + set(FMT_INSTALL ON CACHE BOOL "" FORCE) + endif() +@@ -63,6 +63,8 @@ FetchContent_Declare(fmt + GIT_TAG 9.1.0 + ) + FetchContent_MakeAvailable(fmt) ++endif() ++find_package(fmt REQUIRED CONFIG) + + if(LIBENVPP_TESTS) + FetchContent_Declare(Catch2 +@@ -133,6 +134,8 @@ endif() + + # Installation target. + if(LIBENVPP_INSTALL) ++ include(CMakePackageConfigHelpers) ++ + # Libenvpp installation. + set(LIBENVPP_PROJECT_CONFIG_OUT "${CMAKE_CURRENT_BINARY_DIR}/libenvpp-config.cmake") + set(LIBENVPP_VERSION_CONFIG_FILE "${CMAKE_CURRENT_BINARY_DIR}/libenvpp-config-version.cmake") diff --git a/recipes/libenvpp/all/patches/1.4.3-0001-use-cci-fmt.patch b/recipes/libenvpp/all/patches/1.4.3-0001-use-cci-fmt.patch new file mode 100644 index 0000000000000..1f86bff7a146b --- /dev/null +++ b/recipes/libenvpp/all/patches/1.4.3-0001-use-cci-fmt.patch @@ -0,0 +1,31 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 8aa4975..231e523 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -55,7 +55,7 @@ endfunction() + + # External dependencies. + include(FetchContent) +- ++if(0) + if(LIBENVPP_INSTALL) + set(FMT_INSTALL ON CACHE BOOL "" FORCE) + endif() +@@ -78,7 +78,8 @@ macro(fetch_content_from_submodule DEPNAME RELPATH) + endmacro() + + fetch_content_from_submodule(fmt external/fmt) +- ++endif() ++find_package(fmt REQUIRED CONFIG) + if(LIBENVPP_TESTS) + fetch_content_from_submodule(Catch2 external/Catch2) + list(APPEND CMAKE_MODULE_PATH ${catch2_SOURCE_DIR}/extras) +@@ -144,6 +145,7 @@ endif() + + # Installation target. + if(LIBENVPP_INSTALL) ++ include(CMakePackageConfigHelpers) + # Libenvpp installation. + set(LIBENVPP_PROJECT_CONFIG_OUT "${CMAKE_CURRENT_BINARY_DIR}/libenvpp-config.cmake") + set(LIBENVPP_VERSION_CONFIG_FILE "${CMAKE_CURRENT_BINARY_DIR}/libenvpp-config-version.cmake") diff --git a/recipes/libenvpp/all/patches/1.5.0-0001-use-cci-fmt.patch b/recipes/libenvpp/all/patches/1.5.0-0001-use-cci-fmt.patch new file mode 100644 index 0000000000000..6a1e7e6866da8 --- /dev/null +++ b/recipes/libenvpp/all/patches/1.5.0-0001-use-cci-fmt.patch @@ -0,0 +1,23 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 8729676..cc58853 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -55,7 +55,7 @@ endfunction() + + # External dependencies. + include(FetchContent) +- ++if(0) + if(LIBENVPP_INSTALL) + set(FMT_INSTALL ON CACHE BOOL "" FORCE) + endif() +@@ -78,7 +78,8 @@ macro(fetch_content_from_submodule DEPNAME RELPATH) + endmacro() + + fetch_content_from_submodule(fmt external/fmt) +- ++endif() ++find_package(fmt REQUIRED CONFIG) + if(LIBENVPP_TESTS) + fetch_content_from_submodule(Catch2 external/Catch2) + list(APPEND CMAKE_MODULE_PATH ${catch2_SOURCE_DIR}/extras) diff --git a/recipes/libenvpp/all/test_package/CMakeLists.txt b/recipes/libenvpp/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..59cf4056ecd20 --- /dev/null +++ b/recipes/libenvpp/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(libenvpp REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE libenvpp::libenvpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/libenvpp/all/test_package/conanfile.py b/recipes/libenvpp/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fb96656f203 --- /dev/null +++ b/recipes/libenvpp/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/libenvpp/all/test_package/test_package.cpp b/recipes/libenvpp/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..9be10c22b43a7 --- /dev/null +++ b/recipes/libenvpp/all/test_package/test_package.cpp @@ -0,0 +1,23 @@ +#include + +#include "libenvpp/env.hpp" + +int main() +{ + auto pre = env::prefix("MYPROG"); + + const auto num_threads_id = pre.register_required_variable("NUM_THREADS"); + + const auto parsed_and_validated_pre = pre.parse_and_validate(); + + if (parsed_and_validated_pre.ok()) { + const auto num_threads = parsed_and_validated_pre.get(num_threads_id); + + std::cout << "Num threads: " << num_threads << std::endl; + } else { + std::cout << parsed_and_validated_pre.warning_message(); + std::cout << parsed_and_validated_pre.error_message(); + } + + return 0; +} diff --git a/recipes/libenvpp/config.yml b/recipes/libenvpp/config.yml new file mode 100644 index 0000000000000..b7325931475d1 --- /dev/null +++ b/recipes/libenvpp/config.yml @@ -0,0 +1,11 @@ +versions: + "1.5.0": + folder: all + "1.4.3": + folder: all + "1.4.1": + folder: all + "1.4.0": + folder: all + "1.3.0": + folder: all diff --git a/recipes/libepoxy/all/conandata.yml b/recipes/libepoxy/all/conandata.yml index 8af7ed3d62897..89156c34887db 100644 --- a/recipes/libepoxy/all/conandata.yml +++ b/recipes/libepoxy/all/conandata.yml @@ -9,12 +9,7 @@ sources: url: "https://github.com/anholt/libepoxy/archive/1.5.8.tar.gz" sha256: "0cd80cb040b75cbe77fadd45c48282ebab82d845c597ce11ee5e8cb9c1efeabb" patches: - "1.5.10": - - patch_file: "patches/0001-fix-for-building-on-non-English-locale.patch" - base_path: "source_subfolder" "1.5.9": - patch_file: "patches/0001-fix-for-building-on-non-English-locale.patch" - base_path: "source_subfolder" "1.5.8": - patch_file: "patches/0001-fix-for-building-on-non-English-locale.patch" - base_path: "source_subfolder" diff --git a/recipes/libepoxy/all/conanfile.py b/recipes/libepoxy/all/conanfile.py index 7ed5cc659089e..d5969c6674838 100644 --- a/recipes/libepoxy/all/conanfile.py +++ b/recipes/libepoxy/all/conanfile.py @@ -1,63 +1,43 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools import files, build -from conans import Meson, 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 PkgConfigDeps +from conan.tools.layout import basic_layout +from conan.tools.meson import Meson, MesonToolchain import os -import glob -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" + class EpoxyConan(ConanFile): name = "libepoxy" description = "libepoxy is a library for handling OpenGL function pointer management" - topics = ("libepoxy", "opengl") + topics = ("opengl",) url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/anholt/libepoxy" license = "MIT" - generators = "pkg_config" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], "glx": [True, False], "egl": [True, False], - "x11": [True, False] + "x11": [True, False], } default_options = { "shared": False, "fPIC": True, "glx": True, "egl": True, - "x11": True + "x11": True, } - _meson = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) - - def configure(self): - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd - if self.options.shared: - del self.options.fPIC - - def validate(self): - if self.settings.os == "Windows": - if not self.options.shared: - raise ConanInvalidConfiguration("Static builds on Windows are not supported") - if hasattr(self, "settings_build") and build.cross_building(self): - raise ConanInvalidConfiguration("meson build helper cannot cross-compile. It has to be migrated to conan.tools.meson") + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -68,8 +48,14 @@ def config_options(self): del self.options.egl del self.options.x11 - def build_requirements(self): - self.build_requires("meson/0.63.1") + 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): self.requires("opengl/system") @@ -79,46 +65,49 @@ def requirements(self): if self.options.egl: self.requires("egl/system") + def validate(self): + if self.settings.os == "Windows" and not self.options.shared: + raise ConanInvalidConfiguration("Static builds on Windows are not supported") + + def build_requirements(self): + self.tool_requires("meson/1.3.1") + def source(self): - files.get(self, **self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_meson(self): - if self._meson: - return self._meson - self._meson = Meson(self) - defs = {} - defs["docs"] = "false" - defs["tests"] = "false" + 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["docs"] = "false" + tc.project_options["tests"] = "false" for opt in ["glx", "egl"]: - defs[opt] = "yes" if self.options.get_safe(opt, False) else "no" + tc.project_options[opt] = "yes" if self.options.get_safe(opt, False) else "no" for opt in ["x11"]: - defs[opt] = "true" if self.options.get_safe(opt, False) else "false" - args=[] - args.append("--wrap-mode=nofallback") - self._meson.configure(defs=defs, build_folder=self._build_subfolder, source_folder=self._source_subfolder, pkg_config_paths=[self.install_folder], args=args) - return self._meson + tc.project_options[opt] = "true" if self.options.get_safe(opt, False) else "false" + tc.generate() + deps = PkgConfigDeps(self) + deps.generate() def build(self): - files.apply_conandata_patches(self) - with tools.environment_append(tools.RunEnvironment(self).vars): - meson = self._configure_meson() - meson.build() + apply_conandata_patches(self) + 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() - files.rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) - 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")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + fix_apple_shared_install_name(self) def package_info(self): self.cpp_info.libs = ["epoxy"] if self.settings.os == "Linux": self.cpp_info.system_libs = ["dl"] - self.cpp_info.names["pkg_config"] = "epoxy" - + self.cpp_info.set_property("pkg_config_name", "epoxy") pkgconfig_variables = { 'epoxy_has_glx': '1' if self.options.get_safe("glx") else '0', 'epoxy_has_egl': '1' if self.options.get_safe("egl") else '0', @@ -126,4 +115,5 @@ def package_info(self): } self.cpp_info.set_property( "pkg_config_custom_content", - "\n".join(f"{key}={value}" for key,value in pkgconfig_variables.items())) + "\n".join(f"{key}={value}" for key,value in pkgconfig_variables.items()), + ) diff --git a/recipes/libepoxy/all/test_package/CMakeLists.txt b/recipes/libepoxy/all/test_package/CMakeLists.txt index 34af13462f44f..d5f3fa704d559 100644 --- a/recipes/libepoxy/all/test_package/CMakeLists.txt +++ b/recipes/libepoxy/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(libepoxy REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE libepoxy::libepoxy) diff --git a/recipes/libepoxy/all/test_package/conanfile.py b/recipes/libepoxy/all/test_package/conanfile.py index 07847b3d9465f..539e617675db7 100644 --- a/recipes/libepoxy/all/test_package/conanfile.py +++ b/recipes/libepoxy/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, run=True) 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/libepoxy/all/test_v1_package/CMakeLists.txt b/recipes/libepoxy/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libepoxy/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libepoxy/all/test_v1_package/conanfile.py b/recipes/libepoxy/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libepoxy/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/libest/all/conandata.yml b/recipes/libest/all/conandata.yml index b9d0db8b23c2b..eaebe131cc296 100644 --- a/recipes/libest/all/conandata.yml +++ b/recipes/libest/all/conandata.yml @@ -5,6 +5,4 @@ sources: patches: "3.2.0": - patch_file: "patches/0001-examples-are-broken-don-t-build-them.patch" - base_path: "source_subfolder" - patch_file: "patches/0002-add-extern.patch" - base_path: "source_subfolder" diff --git a/recipes/libest/all/conanfile.py b/recipes/libest/all/conanfile.py index c3b2b423c3d32..ba0d7ffd16a68 100644 --- a/recipes/libest/all/conanfile.py +++ b/recipes/libest/all/conanfile.py @@ -1,80 +1,100 @@ import os -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 is_apple_os +from conan.tools.build import cross_building +from conan.tools.env import VirtualRunEnv +from conan.tools.files import apply_conandata_patches, chdir, copy, export_conandata_patches, get, replace_in_file +from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps +from conan.tools.layout import basic_layout + +required_conan_version = ">=1.53.0" class LibEstConan(ConanFile): name = "libest" - license = "BSD-3-Clause" description = "EST is used for secure certificate enrollment" - topics = ("conan", "EST", "RFC 7030", "certificate enrollment") - homepage = "https://github.com/cisco/libest" + license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" - settings = "os", "compiler", "build_type", "arch" - exports_sources = "patches/**" - options = {"shared": [True, False], "fPIC": [True, False]} - default_options = {"shared": False, "fPIC": True} - - _autotools = None + homepage = "https://github.com/cisco/libest" + topics = ("EST", "RFC 7030", "certificate enrollment") - @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 _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.os in ("Windows", "Macos"): - raise ConanInvalidConfiguration( - "Platform is currently not supported by this recipe") + if self.settings.os == "Windows" or is_apple_os(self): + raise ConanInvalidConfiguration("Platform is currently not supported by this recipe") 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("openssl/1.1.1q") + self.requires("openssl/1.1.1w", transitive_headers=True, transitive_libs=True) + + def build_requirements(self): + self.tool_requires("libtool/2.4.7") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = self.name + "-r" + self.version - os.rename(extracted_dir, self._source_subfolder) - - def _configure_autotools(self): - if not self._autotools: - self._autotools = AutoToolsBuildEnvironment(self) - # TODO: - # - Static only build: https://github.com/cisco/libest/blob/70824ddc09bee661329b9416082d88566efefb32/intro.txt#L140 - # - Release build: https://github.com/cisco/libest/blob/70824ddc09bee661329b9416082d88566efefb32/intro.txt#L253 - args = [] - if self.options.shared: - args.extend(["--enable-shared", "--disable-static"]) - else: - args.extend(["--disable-shared", "--enable-static"]) - self._autotools.configure(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) + tc.generate() + deps = AutotoolsDeps(self) + deps.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + # Remove duplicate AM_INIT_AUTOMAKE + replace_in_file(self, os.path.join(self.source_folder, "configure.ac"), + "AM_INIT_AUTOMAKE\n", "") def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - with tools.chdir(self._source_subfolder): - autotools = self._configure_autotools() + self._patch_sources() + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.autoreconf() + autotools.configure() autotools.make() def package(self): - self.copy("*LICENSE", src=self._source_subfolder, dst="licenses") - with tools.chdir(self._source_subfolder): - autotools = self._configure_autotools() - autotools.install() + copy(self, "*LICENSE", + src=self.source_folder, + dst=os.path.join(self.package_folder, "licenses")) + with chdir(self, self.source_folder): + autotools = Autotools(self) + if self.settings.build_type in ["Release", "MinSizeRel"]: + # https://github.com/cisco/libest/blob/r3.2.0/intro.txt#L244-L254 + autotools.install(target="install-strip") + else: + autotools.install() os.unlink(os.path.join(self.package_folder, "lib", "libest.la")) def package_info(self): self.cpp_info.libs = ["est"] - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["dl", "pthread"] diff --git a/recipes/libest/all/test_package/CMakeLists.txt b/recipes/libest/all/test_package/CMakeLists.txt index 48b855b8a30aa..38cd9db26265b 100644 --- a/recipes/libest/all/test_package/CMakeLists.txt +++ b/recipes/libest/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(PackageTest C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(libest REQUIRED CONFIG) add_executable(example example.c) -target_link_libraries(example ${CONAN_LIBS}) +target_link_libraries(example PRIVATE libest::libest) diff --git a/recipes/libest/all/test_package/conanfile.py b/recipes/libest/all/test_package/conanfile.py index 9f2b070b59136..8d52b7021efe1 100644 --- a/recipes/libest/all/test_package/conanfile.py +++ b/recipes/libest/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 CAresTestConan(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) @@ -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.bindir, "example") + self.run(bin_path, env="conanrun") diff --git a/recipes/libest/all/test_v1_package/CMakeLists.txt b/recipes/libest/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/libest/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/libest/all/test_v1_package/conanfile.py b/recipes/libest/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..2978938836233 --- /dev/null +++ b/recipes/libest/all/test_v1_package/conanfile.py @@ -0,0 +1,16 @@ +from conans import ConanFile, CMake, tools +import os + +class CAresTestConan(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", "example") + 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 bb35d60681a03..87c991f808229 100644 --- a/recipes/libev/all/conanfile.py +++ b/recipes/libev/all/conanfile.py @@ -4,11 +4,12 @@ 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 +from conan.tools.microsoft import is_msvc import os -required_conan_version = ">=1.53.0" +required_conan_version = ">=1.54.0" class LibevConan(ConanFile): @@ -19,6 +20,7 @@ class LibevConan(ConanFile): homepage = "http://software.schmorp.de/pkg/libev.html" license = ["BSD-2-Clause", "GPL-2.0-or-later"] + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -33,6 +35,10 @@ class LibevConan(ConanFile): 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 @@ -47,41 +53,53 @@ def layout(self): basic_layout(self, src_folder="src") def validate(self): - if is_msvc(self): - raise ConanInvalidConfiguration(f"{self.ref} is not supported by Visual Studio") - if self.info.settings.os == "Windows" and self.info.options.shared: + if self.settings.os == "Windows" and not is_msvc(self) and self.options.shared: # libtool: error: can't build i686-pc-mingw32 shared library unless -no-undefined is specified - raise ConanInvalidConfiguration(f"{self.ref} can't be built as shared on Windows") + raise ConanInvalidConfiguration(f"{self.ref} can't be built as shared on Windows without Visual Studio") def build_requirements(self): - if self._settings_build.os == "Windows": + 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], - 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 = AutotoolsToolchain(self) - tc.generate() + 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): - autotools = Autotools(self) - autotools.configure() - 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): 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, "share")) - rm(self, "*.la", os.path.join(self.package_folder, "lib")) - fix_apple_shared_install_name(self) + if is_msvc(self): + cmake = CMake(self) + cmake.install() + 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 = ["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/libevdev/all/conandata.yml b/recipes/libevdev/all/conandata.yml new file mode 100644 index 0000000000000..36ae01fb48f05 --- /dev/null +++ b/recipes/libevdev/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.13.1": + url: "https://www.freedesktop.org/software/libevdev/libevdev-1.13.1.tar.xz" + sha256: "06a77bf2ac5c993305882bc1641017f5bec1592d6d1b64787bad492ab34f2f36" diff --git a/recipes/libevdev/all/conanfile.py b/recipes/libevdev/all/conanfile.py new file mode 100644 index 0000000000000..bd31989739c14 --- /dev/null +++ b/recipes/libevdev/all/conanfile.py @@ -0,0 +1,79 @@ +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 +from conan.tools.scm import Version +import os + + +required_conan_version = ">=1.53.0" + +class LibEvdevConan(ConanFile): + name = "libevdev" + description = "libevdev is a wrapper library for evdev devices." + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://www.freedesktop.org/wiki/Software/libevdev" + topics = ("device", "evdev", "freedesktop", "input") + 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.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + basic_layout(self, src_folder="src") + + def validate(self): + if not self.settings.os in ["FreeBSD", "Linux"]: + raise ConanInvalidConfiguration(f"{self.name} Only supports FreeBSD and Linux") + + def build_requirements(self): + self.tool_requires("meson/1.2.2") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = MesonToolchain(self) + tc.project_options["tests"] = "disabled" + tc.project_options["documentation"] = "disabled" + tc.project_options["coverity"] = "false" + tc.generate() + tc = VirtualBuildEnv(self) + tc.generate() + + def build(self): + 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() + 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 = ["evdev"] + self.cpp_info.includedirs = [os.path.join("include", f"libevdev-{Version(self.version).major}.0")] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["m", "rt"]) diff --git a/recipes/libevdev/all/test_package/conanfile.py b/recipes/libevdev/all/test_package/conanfile.py new file mode 100644 index 0000000000000..5aab0703e7a4e --- /dev/null +++ b/recipes/libevdev/all/test_package/conanfile.py @@ -0,0 +1,32 @@ +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): + 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/1.2.2") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/2.0.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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libevdev/all/test_package/meson.build b/recipes/libevdev/all/test_package/meson.build new file mode 100644 index 0000000000000..16df74e848742 --- /dev/null +++ b/recipes/libevdev/all/test_package/meson.build @@ -0,0 +1,5 @@ +project('test_package', 'c') +libevdev_dep = dependency('libevdev') +executable('test_package', + sources : ['test_package.c'], + dependencies : [libevdev_dep]) diff --git a/recipes/libevdev/all/test_package/test_package.c b/recipes/libevdev/all/test_package/test_package.c new file mode 100644 index 0000000000000..c8e6a5edda83f --- /dev/null +++ b/recipes/libevdev/all/test_package/test_package.c @@ -0,0 +1,8 @@ +#include + +#include + +int main(void) { + libevdev_new_from_fd(0, NULL); + return 0; +} diff --git a/recipes/libevdev/config.yml b/recipes/libevdev/config.yml new file mode 100644 index 0000000000000..aac1819cc10c0 --- /dev/null +++ b/recipes/libevdev/config.yml @@ -0,0 +1,3 @@ +versions: + "1.13.1": + folder: all diff --git a/recipes/libevent/all/conanfile.py b/recipes/libevent/all/conanfile.py index 8ae1637de9bc1..2d107e409da17 100644 --- a/recipes/libevent/all/conanfile.py +++ b/recipes/libevent/all/conanfile.py @@ -4,7 +4,7 @@ from conan.tools.microsoft import is_msvc, is_msvc_static_runtime import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class LibeventConan(ConanFile): @@ -14,7 +14,7 @@ class LibeventConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/libevent/libevent" license = "BSD-3-Clause" - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -38,29 +38,19 @@ def config_options(self): 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 + 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_openssl: - self.requires("openssl/1.1.1s") + self.requires("openssl/[>=1.1 <4]") 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/libevent/all/test_v1_package/CMakeLists.txt b/recipes/libevent/all/test_v1_package/CMakeLists.txt index a8d5eec5dd24d..0d20897301b68 100644 --- a/recipes/libevent/all/test_v1_package/CMakeLists.txt +++ b/recipes/libevent/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(Libevent REQUIRED core CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE libevent::core) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libexif/all/conandata.yml b/recipes/libexif/all/conandata.yml index ae774e1c9a024..32d97fe499da7 100644 --- a/recipes/libexif/all/conandata.yml +++ b/recipes/libexif/all/conandata.yml @@ -1,12 +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" + url: "https://github.com/libexif/libexif/releases/download/v0.6.24/libexif-0.6.24.tar.bz2" + sha256: "d47564c433b733d83b6704c70477e0a4067811d184ec565258ac563d8223f6ae" "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 + - patch_file: patches/replace_ssize_t_windows.patch "0.6.23": - - patch_file: patches/replace_ssize_t_windows.diff + - patch_file: patches/replace_ssize_t_windows.patch diff --git a/recipes/libexif/all/conanfile.py b/recipes/libexif/all/conanfile.py index 8b251e32d1238..91af84ac4770f 100644 --- a/recipes/libexif/all/conanfile.py +++ b/recipes/libexif/all/conanfile.py @@ -1,13 +1,13 @@ from conan import ConanFile -from conan.tools.layout import basic_layout +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.env import VirtualBuildEnv 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 +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.52.0" +required_conan_version = ">=1.57.0" class LibexifConan(ConanFile): @@ -18,6 +18,7 @@ class LibexifConan(ConanFile): description = "libexif is a library for parsing, editing, and saving EXIF data." topics = ("exif", "metadata", "parse", "edit") settings = "os", "arch", "compiler", "build_type" + package_type = "library" options = { "shared": [True, False], "fPIC": [True, False], @@ -31,13 +32,6 @@ class LibexifConan(ConanFile): 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 layout(self): - basic_layout(self, src_folder="src") - def export_sources(self): export_conandata_patches(self) @@ -47,49 +41,43 @@ 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): - 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 + 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() + tc = AutotoolsToolchain(self) - yes_no = lambda v: "yes" if v else "no" 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", ]) - 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"): + if is_msvc(self) and check_min_vs(self, "180", raise_invalid=False): 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("\\", "/") + compile_wrapper = unix_path(self, os.path.join(self.source_folder, "compile")) + ar_wrapper = unix_path(self, os.path.join(self.source_folder, "ar-lib")) 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): apply_conandata_patches(self) autotools = Autotools(self) @@ -99,17 +87,17 @@ def build(self): def package(self): 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)}"]) + autotools.install() 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")) 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.libs = ["exif"] - self.cpp_info.names["pkg_config"] = "libexif" self.cpp_info.set_property("pkg_config_name", "libexif") + self.cpp_info.libs = ["exif"] if self.settings.os in ("FreeBSD", "Linux"): self.cpp_info.system_libs = ["m"] diff --git a/recipes/libexif/all/patches/replace_ssize_t_windows.diff b/recipes/libexif/all/patches/replace_ssize_t_windows.patch similarity index 100% rename from recipes/libexif/all/patches/replace_ssize_t_windows.diff rename to recipes/libexif/all/patches/replace_ssize_t_windows.patch diff --git a/recipes/libexif/all/test_package/CMakeLists.txt b/recipes/libexif/all/test_package/CMakeLists.txt index 2a72bac29499f..66acda03b0317 100644 --- a/recipes/libexif/all/test_package/CMakeLists.txt +++ b/recipes/libexif/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(libexif REQUIRED CONFIG) -find_package(libexif REQUIRED) - -add_executable(${CMAKE_PROJECT_NAME} test_package.c) -target_link_libraries(${CMAKE_PROJECT_NAME} libexif::libexif) +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE libexif::libexif) diff --git a/recipes/libexif/all/test_package/conanfile.py b/recipes/libexif/all/test_package/conanfile.py index 0156618e96bf6..0a6bc68712d90 100644 --- a/recipes/libexif/all/test_package/conanfile.py +++ b/recipes/libexif/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/libexif/all/test_v1_package/CMakeLists.txt b/recipes/libexif/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libexif/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libexif/all/test_v1_package/conanfile.py b/recipes/libexif/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libexif/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/libfabric/all/conandata.yml b/recipes/libfabric/all/conandata.yml index 1eedb4da16c00..1488ae656448e 100644 --- a/recipes/libfabric/all/conandata.yml +++ b/recipes/libfabric/all/conandata.yml @@ -1,4 +1,4 @@ sources: - "1.12.1": - url: https://github.com/ofiwg/libfabric/releases/download/v1.12.1/libfabric-1.12.1.tar.bz2 - sha256: db3c8e0a495e6e9da6a7436adab905468aedfbd4579ee3da5232a5c111ba642c + "1.21.0": + url: "https://github.com/ofiwg/libfabric/releases/download/v1.21.0/libfabric-1.21.0.tar.bz2" + sha256: "0c1b7b830d9147f661e5d7f359250b85b5a9885c330464cd3b5e5d35b86551c7" diff --git a/recipes/libfabric/all/conanfile.py b/recipes/libfabric/all/conanfile.py index 96dbea392e3a6..9d5b8417f1cbd 100644 --- a/recipes/libfabric/all/conanfile.py +++ b/recipes/libfabric/all/conanfile.py @@ -1,99 +1,195 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, tools -from conans.errors import ConanInvalidConfiguration import os -required_conan_version = ">=1.35.0" +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 VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import copy, get, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps +from conan.tools.layout import basic_layout + +required_conan_version = ">=1.53.0" + class LibfabricConan(ConanFile): name = "libfabric" - description = "Open Fabric Interfaces" - topics = ("fabric", "communication", "framework", "service") + description = ("Libfabric, also known as Open Fabrics Interfaces (OFI), " + "defines a communication API for high-performance parallel and distributed applications.") + license = ("BSD-2-Clause", "GPL-2.0-or-later") url = "https://github.com/conan-io/conan-center-index" homepage = "http://libfabric.org" - license = "BSD-2-Clause", "GPL-2.0-or-later" + topics = ("fabric", "communication", "framework", "service") + + package_type = "library" settings = "os", "arch", "compiler", "build_type" - _providers = ['gni', 'psm', 'psm2', 'psm3', 'rxm', 'sockets', 'tcp', 'udp', 'usnic', 'verbs', 'bgq'] + _providers = [ + "dmabuf_peer_mem", + "efa", + "hook_debug", + "hook_hmem", + "mrail", + "perf", + "profile", + "rxd", + "rxm", + "shm", + "sm2", + "sockets", + "tcp", + "trace", + "ucx", + "udp", + "usnic", + "verbs", + ] options = { - **{ p: "ANY" for p in _providers }, - **{ - "shared": [True, False], - "fPIC": [True, False], - "with_libnl": "ANY", - "with_bgq_progress": [None, "auto", "manual"], - "with_bgq_mr": [None, "basic", "scalable"] - } + "shared": [True, False], + "fPIC": [True, False], + **{ p: [None, "ANY"] for p in _providers }, } default_options = { - **{ p: "auto" for p in _providers }, - **{ - "shared": False, - "fPIC": True, - "with_libnl": None, - "with_bgq_progress": None, - "with_bgq_mr": None - } + "shared": False, + "fPIC": True, + "dmabuf_peer_mem": "yes", + "efa": "yes", + "hook_debug": "yes", + "hook_hmem": "yes", + "mrail": "yes", + "perf": "no", + "profile": "yes", + "rxd": "yes", + "rxm": "yes", + "shm": "yes", + "sm2": "yes", + "sockets": "yes", + "tcp": "yes", + "trace": "yes", + "ucx": "no", + "udp": "yes", + "usnic": "no", + "verbs": "yes" } - @property - def _source_subfolder(self): - return "source_subfolder" - - _autotools = None - def config_options(self): - if self.settings.os == 'Windows': - del self.options.fPIC + if is_apple_os(self): + # Requires libnl, which is not available on macOS + del self.options.usnic + # Require Linux-specific process_vm_readv syscall + del self.options.shm + del self.options.sm2 + # rdma-core is not available on macOS + del self.options.efa + del self.options.verbs 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 _is_enabled(self, opt): + return str(self.options.get_safe(opt)) == "yes" or str(self.options.get_safe(opt)).startswith("dl") + + def requirements(self): + if self._is_enabled("usnic"): + self.requires("libnl/3.8.0") + if self._is_enabled("efa") or self._is_enabled("usnic") or self._is_enabled("verbs"): + self.requires("rdma-core/52.0") + + def layout(self): + basic_layout(self, src_folder="src") def validate(self): - if self.settings.os not in ["Linux", "FreeBSD", "Macos"]: - raise ConanInvalidConfiguration("libfabric only builds on Linux, Macos, and FreeBSD.") - for p in self._providers: - if self.options.get_safe(p) not in ["auto", "yes", "no", "dl"] and not os.path.isdir(str(self.options.get_safe(p))): - raise ConanInvalidConfiguration("Option {} can only be one of 'auto', 'yes', 'no', 'dl' or a directory path") - if self.options.get_safe('with_libnl') and not os.path.isdir(str(self.options.with_libnl)): - raise ConanInvalidConfiguration("Value of with_libnl must be an existing directory") + if self.settings.os == "Windows": + # FIXME: libfabric provides msbuild project files. + raise ConanInvalidConfiguration(f"{self.ref} Conan recipes is not supported on Windows. Contributions are welcome.") + + for provider in self._providers: + provider = str(self.options.get_safe(provider)) + if provider.lower() not in ["yes", "no", "dl", "none"] and \ + not os.path.isdir(provider) and \ + (not provider.startswith("dl:") and not os.path.isdir(provider[3:])): + raise ConanInvalidConfiguration(f"{self.ref} provider option '{provider}' is not valid. It must be 'yes', 'no', 'dl', 'dl:' or a directory path.") + + if self._is_enabled("verbs"): + if not self.dependencies["rdma-core"].options.build_librdmacm: + raise ConanInvalidConfiguration(f"{self.ref} '-o rdma-core/*:build_librdmacm=True' is required when '-o &:verbs=True'") + + def build_requirements(self): + # Used in ./configure tests and build + 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) - args = [] + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = AutotoolsToolchain(self) for p in self._providers: - args.append('--enable-{}={}'.format(p, self.options.get_safe(p))) - if self.options.with_libnl: - args.append('--with-libnl={}'.format(self.options.with_libnl)) - if self.options.with_bgq_progress: - args.append('--with-bgq-progress={}'.format(self.options.with_bgq_progress)) - if self.options.with_bgq_mr: - args.append('--with-bgq-mr={}'.format(self.options.with_bgq_mr)) - self._autotools.configure(args=args, configure_dir=self._source_subfolder) - return self._autotools + if p == "verbs" and self.options.get_safe(p, "no") != "no": + path = self.dependencies["rdma-core"].package_folder + if self.options.get_safe("verbs") == "dl": + tc.configure_args.append(f"--enable-verbs=dl:{path}") + else: + tc.configure_args.append(f"--enable-verbs={path}") + else: + tc.configure_args.append(f"--enable-{p}={self.options.get_safe(p, 'no')}") + if self.settings.build_type == "Debug": + tc.configure_args.append("--enable-debug") + tc.configure_args.append(f"--with-bgq-progress=no") + tc.configure_args.append(f"--with-bgq-mr=no") + tc.configure_args.append("--with-cassin-headers=no") + tc.configure_args.append("--with-cuda=no") # TODO + tc.configure_args.append("--with-curl=no") # TODO + tc.configure_args.append("--with-cxi-uapi-headers=no") + tc.configure_args.append("--with-dsa=no") + tc.configure_args.append("--with-gdrcopy=no") + tc.configure_args.append("--with-json-c=no") # TODO + if self._is_enabled("usnic"): + tc.configure_args.append(f"--with-libnl={self.dependencies['libnl'].package_folder}") + else: + tc.configure_args.append("--with-libnl=no") + tc.configure_args.append("--with-lttng=no") + tc.configure_args.append("--with-neuron=no") + tc.configure_args.append(f"--with-numa=no") + tc.configure_args.append("--with-psm2-src=no") + tc.configure_args.append("--with-psm3-rv=no") + tc.configure_args.append("--with-rocr=no") + tc.configure_args.append("--with-synapseai=no") + tc.configure_args.append("--with-uring=no") # TODO + tc.configure_args.append("--with-ze=no") + tc.configure_args.append("-enable-psm=no") + tc.configure_args.append("--enable-psm2=no") + tc.configure_args.append("--enable-psm3=no") + tc.configure_args.append("--enable-xpmem=no") + tc.configure_args.append("--enable-cxi=no") + tc.configure_args.append("--enable-opx=no") + tc.configure_args.append("--enable-bgq=no") + tc.generate() + + deps = AutotoolsDeps(self) + deps.generate() + + VirtualBuildEnv(self).generate() + VirtualRunEnv(self).generate(scope="build") def build(self): - autotools = self._configure_autotools() + 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, "COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + 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", self.package_folder, recursive=True) + fix_apple_shared_install_name(self) def package_info(self): - self.cpp_info.names["pkg_config"] = "libfabric" - self.cpp_info.libs = self.collect_libs() + self.cpp_info.set_property("pkg_config_name", "libfabric") + self.cpp_info.libs = ["fabric"] if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.system_libs = ["pthread", "m"] + self.cpp_info.system_libs = ["pthread", "m", "rt", "dl"] + if self.settings.compiler in ["gcc", "clang"]: + self.cpp_info.system_libs.append("atomic") diff --git a/recipes/libfabric/all/test_package/CMakeLists.txt b/recipes/libfabric/all/test_package/CMakeLists.txt index 196188113685c..09b7943e0c2de 100644 --- a/recipes/libfabric/all/test_package/CMakeLists.txt +++ b/recipes/libfabric/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() +find_package(libfabric REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE libfabric::libfabric) diff --git a/recipes/libfabric/all/test_package/conanfile.py b/recipes/libfabric/all/test_package/conanfile.py index bd7165a553cf4..ef5d7042163ec 100644 --- a/recipes/libfabric/all/test_package/conanfile.py +++ b/recipes/libfabric/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libfabric/all/test_v1_package/CMakeLists.txt b/recipes/libfabric/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/libfabric/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/libfabric/all/test_v1_package/conanfile.py b/recipes/libfabric/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..7e2dfe859bb27 --- /dev/null +++ b/recipes/libfabric/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/libfabric/config.yml b/recipes/libfabric/config.yml index daa3a213a56fa..09d8df06c28ff 100644 --- a/recipes/libfabric/config.yml +++ b/recipes/libfabric/config.yml @@ -1,3 +1,3 @@ versions: - "1.12.1": + "1.21.0": 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..516a736a8a125 100644 --- a/recipes/libfdk_aac/all/conandata.yml +++ b/recipes/libfdk_aac/all/conandata.yml @@ -1,10 +1,13 @@ sources: + "2.0.3": + url: "https://sourceforge.net/projects/opencore-amr/files/fdk-aac/fdk-aac-2.0.3.tar.gz" + sha256: "829b6b89eef382409cda6857fd82af84fabb63417b08ede9ea7a553f811cb79e" "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..63fd8a8038b15 100644 --- a/recipes/libfdk_aac/all/conanfile.py +++ b/recipes/libfdk_aac/all/conanfile.py @@ -1,9 +1,17 @@ -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.build import cross_building +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.55.0" class LibFDKAACConan(ConanFile): @@ -12,8 +20,8 @@ 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") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -24,24 +32,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 +46,105 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def validate_build(self): + if cross_building(self) and self.settings.os == "Android": + # https://github.com/mstorsjo/fdk-aac/issues/124#issuecomment-653473956 + # INFO: It's possible to inject a log.h to fix the error, but there is no official support. + raise ConanInvalidConfiguration(f"{self.ref} cross-building for Android is not supported. Please, try native build.") + + 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 +161,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/libfdk_aac/config.yml b/recipes/libfdk_aac/config.yml index e850754933d82..7529da0511999 100644 --- a/recipes/libfdk_aac/config.yml +++ b/recipes/libfdk_aac/config.yml @@ -1,4 +1,6 @@ versions: + "2.0.3": + folder: all "2.0.2": folder: all "2.0.1": diff --git a/recipes/libffi/all/conandata.yml b/recipes/libffi/all/conandata.yml index 869663acc18e9..4ae82714f72f8 100644 --- a/recipes/libffi/all/conandata.yml +++ b/recipes/libffi/all/conandata.yml @@ -1,24 +1,28 @@ 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.4.6": + url: "https://github.com/libffi/libffi/releases/download/v3.4.6/libffi-3.4.6.tar.gz" + sha256: "b0dea9df23c863a7a50e825440f3ebffabd65df1497108e5d437747843895a4e" + "3.4.4": + url: "https://github.com/libffi/libffi/releases/download/v3.4.4/libffi-3.4.4.tar.gz" + sha256: "d66c56ad259a82cf2a9dfc408b32bf5da52371500b84745f7fb8b645712df676" "3.3": url: "https://github.com/libffi/libffi/releases/download/v3.3/libffi-3.3.tar.gz" sha256: "72fba7922703ddfa7a028d513ac15a85c8d54c8d67f55fa5a4802885dc652056" patches: - "3.4.3": + "3.4.6": + - patch_file: "patches/0002-3.4.6-fix-libtool-path.patch" + - patch_file: "patches/0004-3.4.6-fix-complex-type-msvc.patch" + - patch_file: "patches/0005-3.4.4-do-not-install-libraries-to-arch-dependent-directories.patch" + - patch_file: "patches/0006-3.4.6-library-no-version-suffix.patch" + "3.4.4": - 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": - - 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" + - patch_file: "patches/0005-3.4.4-do-not-install-libraries-to-arch-dependent-directories.patch" + - patch_file: "patches/0006-3.4.4-library-no-version-suffix.patch" + - patch_file: "patches/0007-3.4.3-forward-declare-open_temp_exec_file.patch" + patch_type: "portability" + patch_source: "https://github.com/libffi/libffi/pull/764" + patch_description: "Forward declare the open_temp_exec_file function which is required by the C99 standard" "3.3": - patch_file: "patches/0002-3.3-fix-libtool-path.patch" - patch_file: "patches/0004-3.3-fix-complex-type-msvc.patch" diff --git a/recipes/libffi/all/conanfile.py b/recipes/libffi/all/conanfile.py index fca2894b5fa7b..cc062fca08904 100644 --- a/recipes/libffi/all/conanfile.py +++ b/recipes/libffi/all/conanfile.py @@ -1,16 +1,17 @@ from conan import ConanFile -from conan.tools.apple import fix_apple_shared_install_name +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, mkdir, replace_in_file, rm, rmdir +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, mkdir, 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, msvc_runtime_flag, unix_path +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.52.0" +required_conan_version = ">=1.57.0" class LibffiConan(ConanFile): @@ -21,6 +22,7 @@ class LibffiConan(ConanFile): homepage = "https://sourceware.org/libffi/" topics = ("runtime", "foreign-function-interface", "runtime-library") settings = "os", "arch", "compiler", "build_type" + package_type = "library" options = { "shared": [True, False], "fPIC": [True, False], @@ -41,21 +43,16 @@ def export_sources(self): def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + + def validate(self): + if is_apple_os(self) and self.settings.arch == "armv8" and Version(self.version) < "3.4.0": + raise ConanInvalidConfiguration(f"{self.ref} does not support Apple ARM CPUs") 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 + 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") @@ -69,8 +66,7 @@ def build_requirements(self): self.tool_requires("automake/1.16.5") 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) @@ -87,9 +83,12 @@ def generate(self): 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: tc.extra_defines.append("FFI_BUILDING_DLL") + if Version(self.version) < "3.4.6": + tc.extra_defines.append("FFI_BUILDING") + elif not self.options.shared: + tc.extra_defines.append("FFI_STATIC_BUILD") env = tc.environment() if self._settings_build.os == "Windows" and (is_msvc(self) or self.settings.compiler == "clang"): @@ -101,13 +100,13 @@ def generate(self): "x86_64" if self.settings.arch == "x86_64" else "i686", "pc" if self.settings.arch == "x86" else "win64", "mingw64") - tc.configure_args.extend([ - f"--build={build}", - f"--host={host}", - ]) + tc.update_configure_args({ + "--build": build, + "--host": host + }) - 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"): + 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): @@ -127,11 +126,8 @@ def generate(self): compile_wrapper = unix_path(self, os.path.join(self.source_folder, "msvcc.sh")) if architecture_flag: compile_wrapper = f"{compile_wrapper} {architecture_flag}" - # FIXME: Use the conf once https://github.com/conan-io/conan-center-index/pull/12898 is merged - # env.define("AR", f"{unix_path(self, self.conf.get('tools.automake:ar-lib'))}") - [version_major, version_minor, _] = self.dependencies.direct_build['automake'].ref.version.split(".", 2) - automake_version = f"{version_major}.{version_minor}" - ar_wrapper = unix_path(self, os.path.join(self.dependencies.direct_build['automake'].cpp_info.resdirs[0], f"automake-{automake_version}", "ar-lib")) + + 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") @@ -146,22 +142,9 @@ def generate(self): env.define("INSTALL", unix_path(self, os.path.join(self.source_folder, "install-sh"))) tc.generate(env=env) - def _patch_source(self): + def build(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_source() autotools = Autotools(self) autotools.configure() autotools.make() @@ -182,4 +165,5 @@ 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") if not self.options.shared: - self.cpp_info.defines = ["FFI_BUILDING"] + static_define = "FFI_STATIC_BUILD" if Version(self.version) >= "3.4.6" else "FFI_BUILDING" + self.cpp_info.defines = [static_define] diff --git a/recipes/libffi/all/patches/0002-3.4.2-fix-libtool-path.patch b/recipes/libffi/all/patches/0002-3.4.2-fix-libtool-path.patch deleted file mode 100644 index fad9e64adff17..0000000000000 --- a/recipes/libffi/all/patches/0002-3.4.2-fix-libtool-path.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- configure -+++ configure -@@ -8979,7 +8979,7 @@ - LIBTOOL_DEPS=$ltmain - - # Always use our own libtool. --LIBTOOL='$(SHELL) $(top_builddir)/libtool' -+LIBTOOL='$(SHELL) $(top_builddir)/libtool.sh' - - - -@@ -9072,7 +9072,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.6-fix-libtool-path.patch b/recipes/libffi/all/patches/0002-3.4.6-fix-libtool-path.patch new file mode 100644 index 0000000000000..e557baacf2699 --- /dev/null +++ b/recipes/libffi/all/patches/0002-3.4.6-fix-libtool-path.patch @@ -0,0 +1,20 @@ +--- configure ++++ configure +@@ -9882,7 +9882,7 @@ + LIBTOOL_DEPS=$ltmain + + # Always use our own libtool. +-LIBTOOL='$(SHELL) $(top_builddir)/libtool' ++LIBTOOL='$(SHELL) $(top_builddir)/libtool.sh' + + + +@@ -9974,7 +9974,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/0004-3.4.6-fix-complex-type-msvc.patch b/recipes/libffi/all/patches/0004-3.4.6-fix-complex-type-msvc.patch new file mode 100644 index 0000000000000..4779afe0a2e85 --- /dev/null +++ b/recipes/libffi/all/patches/0004-3.4.6-fix-complex-type-msvc.patch @@ -0,0 +1,56 @@ +diff --git a/src/types.c b/src/types.c +index c1c27f3..d5d52bb 100644 +--- a/src/types.c ++++ b/src/types.c +@@ -31,6 +31,8 @@ + #include + #include + ++#include ++ + /* Type definitions */ + + #define FFI_TYPEDEF(name, type, id, maybe_const)\ +@@ -45,17 +47,17 @@ maybe_const ffi_type ffi_type_##name = { \ + 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; \ + }; \ + FFI_EXTERN \ + 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 \ +@@ -99,8 +101,18 @@ const ffi_type ffi_type_longdouble = { 16, 16, 4, NULL }; + 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(longdouble, long double, FFI_LDBL_CONST); ++FFI_COMPLEX_TYPEDEF(float, FLOAT_COMPLEX, const); ++FFI_COMPLEX_TYPEDEF(double, DOUBLE_COMPLEX, const); ++FFI_COMPLEX_TYPEDEF(longdouble, LDOUBLE_COMPLEX, FFI_LDBL_CONST); + #endif diff --git a/recipes/libffi/all/patches/0005-3.4.2-do-not-install-libraries-to-arch-dependent-directories.patch b/recipes/libffi/all/patches/0005-3.4.2-do-not-install-libraries-to-arch-dependent-directories.patch deleted file mode 100644 index 8e14796ab662a..0000000000000 --- a/recipes/libffi/all/patches/0005-3.4.2-do-not-install-libraries-to-arch-dependent-directories.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- Makefile.in -+++ Makefile.in -@@ -517,7 +517,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@ 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 deleted file mode 100644 index e82abf24a4fb1..0000000000000 --- a/recipes/libffi/all/patches/0005-3.4.3-do-not-install-libraries-to-arch-dependent-directories.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- 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/0005-3.4.4-do-not-install-libraries-to-arch-dependent-directories.patch b/recipes/libffi/all/patches/0005-3.4.4-do-not-install-libraries-to-arch-dependent-directories.patch new file mode 100644 index 0000000000000..b97912cd6bba1 --- /dev/null +++ b/recipes/libffi/all/patches/0005-3.4.4-do-not-install-libraries-to-arch-dependent-directories.patch @@ -0,0 +1,13 @@ +diff --git a/Makefile.in b/Makefile.in +index 86eb4a5..450200a 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -521,7 +521,7 @@ target_os = @target_os@ + 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.4.2-library-no-version-suffix.patch b/recipes/libffi/all/patches/0006-3.4.2-library-no-version-suffix.patch deleted file mode 100644 index 80c36df06441e..0000000000000 --- a/recipes/libffi/all/patches/0006-3.4.2-library-no-version-suffix.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- Makefile.in -+++ Makefile.in -@@ -610,7 +610,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/patches/0006-3.4.3-library-no-version-suffix.patch b/recipes/libffi/all/patches/0006-3.4.3-library-no-version-suffix.patch deleted file mode 100644 index 0ad4d29b1c4ce..0000000000000 --- a/recipes/libffi/all/patches/0006-3.4.3-library-no-version-suffix.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- 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/patches/0006-3.4.4-library-no-version-suffix.patch b/recipes/libffi/all/patches/0006-3.4.4-library-no-version-suffix.patch new file mode 100644 index 0000000000000..3e7be9c15fb0d --- /dev/null +++ b/recipes/libffi/all/patches/0006-3.4.4-library-no-version-suffix.patch @@ -0,0 +1,13 @@ +diff --git a/Makefile.in b/Makefile.in +index 450200a..abcee85 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -616,7 +616,7 @@ AM_CFLAGS = $(am__append_3) + @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/patches/0006-3.4.6-library-no-version-suffix.patch b/recipes/libffi/all/patches/0006-3.4.6-library-no-version-suffix.patch new file mode 100644 index 0000000000000..726e8c1eb4a47 --- /dev/null +++ b/recipes/libffi/all/patches/0006-3.4.6-library-no-version-suffix.patch @@ -0,0 +1,13 @@ +diff --git a/Makefile.in b/Makefile.in +index 450200a..abcee85 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -618,7 +618,7 @@ AM_CFLAGS = $(am__append_3) + @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/patches/0007-3.4.3-forward-declare-open_temp_exec_file.patch b/recipes/libffi/all/patches/0007-3.4.3-forward-declare-open_temp_exec_file.patch new file mode 100644 index 0000000000000..a2e9d8e2661aa --- /dev/null +++ b/recipes/libffi/all/patches/0007-3.4.3-forward-declare-open_temp_exec_file.patch @@ -0,0 +1,30 @@ +diff --git a/include/ffi_common.h b/include/ffi_common.h +index 2bd31b0..c53a794 100644 +--- a/include/ffi_common.h ++++ b/include/ffi_common.h +@@ -128,6 +128,10 @@ void *ffi_data_to_code_pointer (void *data) FFI_HIDDEN; + static trampoline. */ + int ffi_tramp_is_present (void *closure) FFI_HIDDEN; + ++/* Return a file descriptor of a temporary zero-sized file in a ++ writable and executable filesystem. */ ++int open_temp_exec_file(void) FFI_HIDDEN; ++ + /* Extended cif, used in callback from assembly routine */ + typedef struct + { +diff --git a/src/tramp.c b/src/tramp.c +index b9d273a..c3f4c99 100644 +--- a/src/tramp.c ++++ b/src/tramp.c +@@ -39,6 +39,10 @@ + #ifdef __linux__ + #define _GNU_SOURCE 1 + #endif ++ ++#include ++#include ++ + #include + #include + #include diff --git a/recipes/libffi/config.yml b/recipes/libffi/config.yml index 7f562b85ed6ac..e6382ec734d6d 100644 --- a/recipes/libffi/config.yml +++ b/recipes/libffi/config.yml @@ -1,7 +1,7 @@ versions: - "3.4.3": + "3.4.6": folder: "all" - "3.4.2": + "3.4.4": folder: "all" "3.3": folder: "all" diff --git a/recipes/libfork/all/conandata.yml b/recipes/libfork/all/conandata.yml new file mode 100644 index 0000000000000..26ad554c10e51 --- /dev/null +++ b/recipes/libfork/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "3.8.0": + url: "https://github.com/conorwilliams/libfork/archive/v3.8.0.tar.gz" + sha256: "53f23f0d27bb0753c0b03132f3c17bf8099617f037a2389a04e85fdd6f2736e8" + "3.7.2": + url: "https://github.com/conorwilliams/libfork/archive/v3.7.2.tar.gz" + sha256: "0c4fbb7a6000c0a93b219b385d9834bd07bc5f19d89aa41ba8e27b5723694b15" diff --git a/recipes/libfork/all/conanfile.py b/recipes/libfork/all/conanfile.py new file mode 100644 index 0000000000000..f2a0617be709d --- /dev/null +++ b/recipes/libfork/all/conanfile.py @@ -0,0 +1,69 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.layout import basic_layout +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.scm import Version +import os + +required_conan_version = ">=1.53.0" + +class LibforkConan(ConanFile): + name = "libfork" + description = "A bleeding-edge, lock-free, wait-free, continuation-stealing tasking library." + license = "MPL-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/ConorWilliams/libfork" + topics = ("multithreading", + "fork-join", + "parallelism", + "framework", + "continuation-stealing", + "lockfree", + "wait-free", + "header-only") + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _min_cppstd(self): + return 20 + + @property + def _compilers_minimum_version(self): + # https://en.cppreference.com/w/cpp/utility/source_location requires new compilers + return { + "apple-clang": "15", + "clang": "15", + "gcc": "11", + "msvc": "192.10", + "Visual Studio": "16.10", + } + + 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, "LICENSE.md", 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 = [] + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs = ["pthread"] diff --git a/recipes/libfork/all/test_package/CMakeLists.txt b/recipes/libfork/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..01ecf1d73c686 --- /dev/null +++ b/recipes/libfork/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(libfork REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE libfork::libfork) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) diff --git a/recipes/libfork/all/test_package/conanfile.py b/recipes/libfork/all/test_package/conanfile.py new file mode 100644 index 0000000000000..8a476e09ae305 --- /dev/null +++ b/recipes/libfork/all/test_package/conanfile.py @@ -0,0 +1,27 @@ +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", "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.bindir, "test_package") + self.run(cmd, env="conanrun") diff --git a/recipes/libfork/all/test_package/test_package.cpp b/recipes/libfork/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..70ecda89a8887 --- /dev/null +++ b/recipes/libfork/all/test_package/test_package.cpp @@ -0,0 +1,24 @@ +#include +#include + +#include "libfork.hpp" + +namespace { + constexpr auto hello_async_world = [](auto /* self */) -> lf::task { + std::cout << "Hello, async world!" << std::endl; + co_return 0; + }; +} + +auto main() -> int { + try { + return lf::sync_wait(lf::lazy_pool{}, hello_async_world); + } catch (std::exception const &e) { + std::cerr << "Caught exception: " << e.what() << std::endl; + return EXIT_FAILURE; + } catch (...) { + std::cerr << "Caught unknown exception." << std::endl; + return EXIT_FAILURE; + } + return EXIT_SUCCESS; +} diff --git a/recipes/libfork/config.yml b/recipes/libfork/config.yml new file mode 100644 index 0000000000000..ee862d73f6252 --- /dev/null +++ b/recipes/libfork/config.yml @@ -0,0 +1,5 @@ +versions: + "3.8.0": + folder: all + "3.7.2": + folder: all diff --git a/recipes/libfreenect/all/CMakeLists.txt b/recipes/libfreenect/all/CMakeLists.txt deleted file mode 100644 index c986d294c7547..0000000000000 --- a/recipes/libfreenect/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/libfreenect/all/conandata.yml b/recipes/libfreenect/all/conandata.yml index 65a8f154a2543..5f576feee3083 100644 --- a/recipes/libfreenect/all/conandata.yml +++ b/recipes/libfreenect/all/conandata.yml @@ -1,8 +1,12 @@ sources: + "0.7.0": + url: "https://github.com/OpenKinect/libfreenect/archive/v0.7.0.tar.gz" + sha256: "adbfc6e7ce72f77cccb3341807a1e2cc6fe2ee62e1bc4d70a6c9b05fac83fe8f" "0.6.2": url: "https://github.com/OpenKinect/libfreenect/archive/refs/tags/v0.6.2.tar.gz" sha256: "e135f5e60ae290bf1aa403556211f0a62856a9e34f12f12400ec593620a36bfa" patches: + "0.7.0": + - patch_file: "patches/0.6.2-fix-cmake.patch" "0.6.2": - patch_file: "patches/0.6.2-fix-cmake.patch" - base_path: "source_subfolder" diff --git a/recipes/libfreenect/all/conanfile.py b/recipes/libfreenect/all/conanfile.py index a7a776679854a..66b03d96a8717 100644 --- a/recipes/libfreenect/all/conanfile.py +++ b/recipes/libfreenect/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 apply_conandata_patches, copy, export_conandata_patches, get, rmdir import os -import glob -import shutil + +required_conan_version = ">=1.53.0" class LibfreenectConan(ConanFile): @@ -11,7 +13,8 @@ class LibfreenectConan(ConanFile): homepage = "https://github.com/OpenKinect/libfreenect" description = "Drivers and libraries for the Xbox Kinect device." topics = ("usb", "camera", "kinect") - settings = "os", "compiler", "build_type", "arch" + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -20,18 +23,9 @@ class LibfreenectConan(ConanFile): "shared": False, "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" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -39,53 +33,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 + 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("libusb/1.0.24") + self.requires("libusb/1.0.26") 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) + 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_REDIST_PACKAGE"] = True - self._cmake.definitions["BUILD_EXAMPLES"] = False - self._cmake.definitions["BUILD_FAKENECT"] = False - self._cmake.definitions["BUILD_C_SYNC"] = False - self._cmake.definitions["BUILD_CPP"] = False - self._cmake.definitions["BUILD_CV"] = False - self._cmake.definitions["BUILD_AS3_SERVER"] = False - self._cmake.definitions["BUILD_PYTHON"] = False - self._cmake.definitions["BUILD_PYTHON2"] = False - self._cmake.definitions["BUILD_PYTHON3"] = False - self._cmake.definitions["BUILD_OPENNI2_DRIVER"] = False - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_REDIST_PACKAGE"] = True + tc.variables["BUILD_EXAMPLES"] = False + tc.variables["BUILD_FAKENECT"] = False + tc.variables["BUILD_C_SYNC"] = False + tc.variables["BUILD_CPP"] = False + tc.variables["BUILD_CV"] = False + tc.variables["BUILD_AS3_SERVER"] = False + tc.variables["BUILD_PYTHON"] = False + tc.variables["BUILD_PYTHON2"] = False + tc.variables["BUILD_PYTHON3"] = False + tc.variables["BUILD_OPENNI2_DRIVER"] = False + # Relocatable shared libs on macOS + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" + 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("APACHE20", src=self._source_subfolder, dst="licenses", keep_path=False) - self.copy("GPL", src=self._source_subfolder, dst="licenses", keep_path=False) - cmake = self._configure_cmake() + copy(self, "APACHE20", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "GPL", 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.names["pkg_config"] = "libfreenect" + self.cpp_info.set_property("pkg_config_name", "libfreenect") self.cpp_info.libs = ["freenect"] - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("m") diff --git a/recipes/libfreenect/all/test_package/CMakeLists.txt b/recipes/libfreenect/all/test_package/CMakeLists.txt index 172075b9703b7..46d01bd2584df 100644 --- a/recipes/libfreenect/all/test_package/CMakeLists.txt +++ b/recipes/libfreenect/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() - find_package(libfreenect REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} libfreenect::libfreenect) +target_link_libraries(${PROJECT_NAME} PRIVATE libfreenect::libfreenect) diff --git a/recipes/libfreenect/all/test_package/conanfile.py b/recipes/libfreenect/all/test_package/conanfile.py index 49a3a66ea5bad..539e617675db7 100644 --- a/recipes/libfreenect/all/test_package/conanfile.py +++ b/recipes/libfreenect/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, run=True) 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/libfreenect/all/test_v1_package/CMakeLists.txt b/recipes/libfreenect/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libfreenect/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libfreenect/all/test_v1_package/conanfile.py b/recipes/libfreenect/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libfreenect/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/libfreenect/config.yml b/recipes/libfreenect/config.yml index a09c617182ab2..d4f601d9832b3 100644 --- a/recipes/libfreenect/config.yml +++ b/recipes/libfreenect/config.yml @@ -1,3 +1,5 @@ versions: + "0.7.0": + folder: all "0.6.2": folder: all diff --git a/recipes/libfreenect2/all/CMakeLists.txt b/recipes/libfreenect2/all/CMakeLists.txt index c986d294c7547..ff20e4a7a17dd 100644 --- a/recipes/libfreenect2/all/CMakeLists.txt +++ b/recipes/libfreenect2/all/CMakeLists.txt @@ -1,7 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(cmake_wrapper) -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") +add_subdirectory(src) diff --git a/recipes/libfreenect2/all/conandata.yml b/recipes/libfreenect2/all/conandata.yml index 7fab4fd83db66..95824e496a47a 100644 --- a/recipes/libfreenect2/all/conandata.yml +++ b/recipes/libfreenect2/all/conandata.yml @@ -5,6 +5,4 @@ sources: patches: "0.2.1": - patch_file: "patches/0.2.1-fix-cmake.patch" - base_path: "source_subfolder" - patch_file: "patches/0.2.1-generate-resources.patch" - base_path: "source_subfolder" diff --git a/recipes/libfreenect2/all/conanfile.py b/recipes/libfreenect2/all/conanfile.py index dbb951cc733d9..b9a827fb5ffdb 100644 --- a/recipes/libfreenect2/all/conanfile.py +++ b/recipes/libfreenect2/all/conanfile.py @@ -1,21 +1,32 @@ -from conans import ConanFile, CMake, tools import os +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 apply_conandata_patches, collect_libs, copy, export_conandata_patches, get, rmdir, replace_in_file +from conan.tools.gnu import PkgConfigDeps + +required_conan_version = ">=1.53.0" + class Libfreenect2Conan(ConanFile): name = "libfreenect2" + description = "Open source drivers for the Kinect for Windows v2 device." license = ("Apache-2.0", "GPL-2.0") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/OpenKinect/libfreenect2" - description = "Open source drivers for the Kinect for Windows v2 device." topics = ("usb", "camera", "kinect") - settings = "os", "compiler", "build_type", "arch" + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], "with_opencl": [True, False], "with_opengl": [True, False], "with_vaapi": [True, False], + "with_cuda": [True, False], } default_options = { "shared": False, @@ -23,88 +34,133 @@ class Libfreenect2Conan(ConanFile): "with_opencl": True, "with_opengl": True, "with_vaapi": True, + "with_cuda": False, } - 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" + 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.with_vaapi + if self.settings.os not in ["Linux", "FreeBSD"]: + self.options.rm_safe("with_vaapi") 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("libusb/1.0.24") - self.requires("libjpeg-turbo/2.1.1") + self.requires("libusb/1.0.26") + self.requires("libjpeg-turbo/3.0.0") if self.options.with_opencl: - self.requires("opencl-headers/2021.04.29") - self.requires("opencl-icd-loader/2021.04.29") + # 2023.02.06 is the latest compatible version + self.requires("opencl-headers/2023.02.06") + self.requires("opencl-icd-loader/2023.02.06") if self.options.with_opengl: self.requires("opengl/system") - self.requires("glfw/3.3.4") + self.requires("glfw/3.3.8") if self.options.get_safe("with_vaapi"): self.requires("vaapi/system") + if self.options.with_cuda: + self.requires("cuda-samples/12.2") def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) + check_min_cppstd(self, 11) + if self.options.with_cuda: + self.output.warning("Conan package for CUDA is not available, will use system CUDA") 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): + tc = CMakeToolchain(self) + tc.variables["CMAKE_FIND_ROOT_PATH_MODE_PACKAGE"] = "NONE" + tc.variables["BUILD_EXAMPLES"] = False + tc.variables["BUILD_OPENNI2_DRIVER"] = False + tc.variables["ENABLE_CXX11"] = True + tc.variables["ENABLE_OPENCL"] = self.options.with_opencl + tc.variables["ENABLE_CUDA"] = self.options.with_cuda + tc.variables["ENABLE_OPENGL"] = self.options.with_opengl + tc.variables["ENABLE_VAAPI"] = self.options.get_safe("with_vaapi", False) + tc.variables["ENABLE_TEGRAJPEG"] = False # TODO: TegraJPEG + tc.variables["ENABLE_PROFILING"] = False + if self.options.with_cuda: + tc.variables["NVCUDASAMPLES_ROOT"] = os.path.join(self.dependencies["cuda-samples"].package_folder, "include") + # Required for deprecated FindCUDA support + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0146"] = "OLD" + tc.generate() + + deps = CMakeDeps(self) + deps.set_property("libusb", "cmake_file_name", "LibUSB") + deps.set_property("glfw3", "cmake_file_name", "GLFW3") + deps.set_property("libjpeg-turbo", "cmake_file_name", "TurboJPEG") + deps.generate() + + deps = PkgConfigDeps(self) + deps.generate() 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["BUILD_EXAMPLES"] = False - self._cmake.definitions["BUILD_OPENNI2_DRIVER"] = False - self._cmake.definitions["ENABLE_CXX11"] = True - self._cmake.definitions["ENABLE_OPENCL"] = self.options.with_opencl - self._cmake.definitions["ENABLE_CUDA"] = False # TODO: CUDA - self._cmake.definitions["ENABLE_OPENGL"] = self.options.with_opengl - self._cmake.definitions["ENABLE_VAAPI"] = self.options.get_safe("with_vaapi", False) - self._cmake.definitions["ENABLE_TEGRAJPEG"] = False # TODO: TegraJPEG - self._cmake.definitions["ENABLE_PROFILING"] = False - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + apply_conandata_patches(self) + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "FIND_PACKAGE(JPEG)", "FIND_PACKAGE(TurboJPEG REQUIRED CONFIG)") + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + " JPEG_FOUND", " TRUE") def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("APACHE20", src=self._source_subfolder, dst="licenses", keep_path=False) - self.copy("GPL2", src=self._source_subfolder, dst="licenses", keep_path=False) - cmake = self._configure_cmake() + copy(self, "APACHE20", + src=self.source_folder, + dst=os.path.join(self.package_folder, "licenses"), + keep_path=False) + copy(self, "GPL2", + src=self.source_folder, + dst=os.path.join(self.package_folder, "licenses"), + keep_path=False) + 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")) def package_info(self): - self.cpp_info.names["cmake_find_package"] = "freenect2" - self.cpp_info.names["cmake_find_package_multi"] = "freenect2" - self.cpp_info.names["pkg_config"] = "freenect2" - self.cpp_info.libs = tools.collect_libs(self) - if self.settings.os == "Linux": + self.cpp_info.set_property("cmake_file_name", "freenect2") + self.cpp_info.set_property("cmake_target_name", "freenect2::freenect2") + self.cpp_info.set_property("pkg_config_name", "freenect2") + self.cpp_info.libs = collect_libs(self) + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.extend(["m", "pthread", "dl"]) - elif self.settings.os == "Macos": + elif is_apple_os(self): self.cpp_info.frameworks.extend(["VideoToolbox", "CoreFoundation", "CoreMedia", "CoreVideo"]) + + self.cpp_info.requires += [ + "libusb::libusb", + "libjpeg-turbo::jpeg", + "libjpeg-turbo::turbojpeg", + ] + if self.options.with_opencl: + self.cpp_info.requires += [ + "opencl-headers::opencl-headers", + "opencl-icd-loader::opencl-icd-loader", + ] + if self.options.with_opengl: + self.cpp_info.requires += [ + "opengl::opengl", + "glfw::glfw", + ] + if self.options.get_safe("with_vaapi"): + self.cpp_info.requires += ["vaapi::vaapi"] + if self.options.with_cuda: + self.cpp_info.requires += ["cuda-samples::cuda-samples"] + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.names["cmake_find_package"] = "freenect2" + self.cpp_info.names["cmake_find_package_multi"] = "freenect2" diff --git a/recipes/libfreenect2/all/patches/0.2.1-fix-cmake.patch b/recipes/libfreenect2/all/patches/0.2.1-fix-cmake.patch index 93324460a3d71..fcc8f8dfa20e8 100644 --- a/recipes/libfreenect2/all/patches/0.2.1-fix-cmake.patch +++ b/recipes/libfreenect2/all/patches/0.2.1-fix-cmake.patch @@ -1,27 +1,6 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index d8ef047..a81aa8e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -90,8 +90,7 @@ SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) - SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) - - # dependencies --FIND_PACKAGE(PkgConfig) # try find PKGConfig as it will be used if found --FIND_PACKAGE(LibUSB REQUIRED) -+find_package(libusb REQUIRED) - - # Add includes - INCLUDE_DIRECTORIES( -@@ -99,7 +98,7 @@ INCLUDE_DIRECTORIES( - "${MY_DIR}/include/internal" - ${PROJECT_BINARY_DIR} # for generated headers - ${LIBFREENECT2_THREADING_INCLUDE_DIR} -- ${LibUSB_INCLUDE_DIRS} -+ # ${LibUSB_INCLUDE_DIRS} - ) - - SET(RESOURCES_INC_FILE "${PROJECT_BINARY_DIR}/resources.inc.h") -@@ -157,12 +156,12 @@ SET(SOURCES +@@ -157,7 +157,7 @@ ) SET(LIBRARIES @@ -30,174 +9,88 @@ index d8ef047..a81aa8e 100644 ${LIBFREENECT2_THREADING_LIBRARIES} ) - SET(LIBFREENECT2_DLLS -- ${LibUSB_DLL} -+ #${LibUSB_DLL} - ) - - SET(HAVE_VideoToolbox "no (Apple only)") -@@ -193,13 +192,14 @@ ENDIF(APPLE) - - SET(HAVE_VAAPI disabled) - IF(ENABLE_VAAPI) -- IF(PKG_CONFIG_FOUND) -- PKG_CHECK_MODULES(VAAPI libva libva-drm) -- ENDIF() -- FIND_PACKAGE(JPEG) -+ # IF(PKG_CONFIG_FOUND) -+ # PKG_CHECK_MODULES(VAAPI libva libva-drm) -+ # ENDIF() -+ find_package(vaapi REQUIRED) -+ find_package(libjpeg-turbo REQUIRED) - - SET(HAVE_VAAPI no) -- IF(VAAPI_FOUND AND JPEG_FOUND) -+ # IF(VAAPI_FOUND AND JPEG_FOUND) - SET(LIBFREENECT2_WITH_VAAPI_SUPPORT 1) - SET(HAVE_VAAPI yes) - -@@ -209,10 +209,10 @@ IF(ENABLE_VAAPI) - src/vaapi_rgb_packet_processor.cpp - ) - LIST(APPEND LIBRARIES -- ${VAAPI_LIBRARIES} -- ${JPEG_LIBRARY} -+ vaapi::vaapi -+ libjpeg-turbo::libjpeg-turbo - ) -- ENDIF() -+ # ENDIF() - ENDIF(ENABLE_VAAPI) - - SET(HAVE_TegraJPEG disabled) -@@ -237,38 +237,38 @@ IF(ENABLE_TEGRAJPEG) - ENDIF() - - IF(LIBFREENECT2_WITH_VT_SUPPORT) -- FIND_PACKAGE(TurboJPEG) -+ find_package(libjpeg-turbo REQUIRED) - ELSE() - # VAAPI can fail to start at runtime. It must have a fallback. -- FIND_PACKAGE(TurboJPEG REQUIRED) -+ find_package(libjpeg-turbo REQUIRED) - ENDIF() - - SET(HAVE_TurboJPEG no) --IF(TurboJPEG_FOUND) -+IF(libjpeg-turbo_FOUND) - SET(LIBFREENECT2_WITH_TURBOJPEG_SUPPORT 1) - SET(HAVE_TurboJPEG yes) - -- INCLUDE_DIRECTORIES(${TurboJPEG_INCLUDE_DIRS}) -+ #INCLUDE_DIRECTORIES(${TurboJPEG_INCLUDE_DIRS}) - - LIST(APPEND SOURCES - src/turbo_jpeg_rgb_packet_processor.cpp - ) - - LIST(APPEND LIBRARIES -- ${TurboJPEG_LIBRARIES} -+ libjpeg-turbo::libjpeg-turbo - ) - - LIST(APPEND LIBFREENECT2_DLLS -- ${TurboJPEG_DLL} -+ #${TurboJPEG_DLL} - ) - ENDIF() - - SET(HAVE_OpenGL disabled) - IF(ENABLE_OPENGL) -- FIND_PACKAGE(GLFW3) -- FIND_PACKAGE(OpenGL) -+ find_package(glfw3 REQUIRED) -+ find_package(opengl_system REQUIRED) - SET(HAVE_OpenGL no) -- IF(GLFW3_FOUND AND OPENGL_FOUND) -+ # IF(GLFW3_FOUND AND OPENGL_FOUND) - SET(LIBFREENECT2_WITH_OPENGL_SUPPORT 1) - SET(HAVE_OpenGL yes) - -@@ -276,8 +276,8 @@ IF(ENABLE_OPENGL) +@@ -276,8 +272,8 @@ LIST(APPEND LIBFREENECT2_DLLS ${GLFW3_DLL}) LIST(APPEND LIBRARIES - ${GLFW3_LIBRARIES} - ${OPENGL_gl_LIBRARY} -+ glfw::glfw -+ opengl::opengl ++ ${GLFW3_LIBRARIES} glfw ++ ${OPENGL_gl_LIBRARY} opengl::opengl ) LIST(APPEND SOURCES src/flextGL.cpp -@@ -292,19 +292,19 @@ IF(ENABLE_OPENGL) - src/shader/stage1.fs - src/shader/stage2.fs - ) -- ENDIF() -+ # ENDIF() - ENDIF(ENABLE_OPENGL) +@@ -297,10 +293,10 @@ SET(HAVE_OpenCL disabled) IF(ENABLE_OPENCL) - FIND_PACKAGE(OpenCL) -+ find_package(opencl-icd-loader REQUIRED) ++ find_package(OpenCLICDLoader REQUIRED) ++ find_package(OpenCLHeaders REQUIRED) SET(HAVE_OpenCL no) - IF(OpenCL_FOUND) -+ #IF(OpenCL_FOUND) SET(LIBFREENECT2_WITH_OPENCL_SUPPORT 1) SET(HAVE_OpenCL yes) -- IF(UNIX AND NOT APPLE) -+ IF(0) - INCLUDE(CheckOpenCLICDLoader) - IF(OpenCL_C_WORKS AND NOT OpenCL_CXX_WORKS) - SET(LIBFREENECT2_OPENCL_ICD_LOADER_IS_OLD 1) -@@ -312,7 +312,7 @@ IF(ENABLE_OPENCL) +@@ -312,7 +308,7 @@ MESSAGE(WARNING "Your libOpenCL.so is incompatible with CL/cl.h. Install ocl-icd-opencl-dev to update libOpenCL.so?") ENDIF() ENDIF() - INCLUDE_DIRECTORIES(${OpenCL_INCLUDE_DIRS}) -+ #INCLUDE_DIRECTORIES(${OpenCL_INCLUDE_DIRS}) ++ INCLUDE_DIRECTORIES(${OpenCLHeaders_INCLUDE_DIRS}) LIST(APPEND SOURCES src/opencl_depth_packet_processor.cpp -@@ -320,7 +320,7 @@ IF(ENABLE_OPENCL) +@@ -320,7 +316,7 @@ ) LIST(APPEND LIBRARIES - ${OpenCL_LIBRARIES} -+ opencl-icd-loader::opencl-icd-loader ++ OpenCL::Headers OpenCL::OpenCL ) LIST(APPEND RESOURCES -@@ -334,7 +334,7 @@ IF(ENABLE_OPENCL) +@@ -334,12 +330,11 @@ IF(UNIX AND NOT APPLE) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions") ENDIF() - ENDIF(OpenCL_FOUND) -+ #ENDIF(OpenCL_FOUND) ENDIF(ENABLE_OPENCL) SET(HAVE_CUDA disabled) -@@ -385,7 +385,7 @@ IF(ENABLE_CUDA) - ENDIF(ENABLE_CUDA) - - # RPATH handling for CUDA 8.0 libOpenCL.so conflict. See #804. --IF(HAVE_OpenCL STREQUAL yes AND UNIX AND NOT APPLE) -+IF(0) - FILE(GLOB CUDA_ld_so_conf /etc/ld.so.conf.d/cuda*.conf) - IF(CUDA_ld_so_conf) - MESSAGE(WARNING "Your CUDA installation overrides OpenCL system library path.") -@@ -403,9 +403,9 @@ ENDIF() + IF(ENABLE_CUDA) +- FIND_PACKAGE(CUDA) ++ FIND_PACKAGE(CUDA REQUIRED) + SET(HAVE_CUDA no) + IF(CUDA_FOUND AND MSVC14 AND CUDA_VERSION VERSION_LESS 8.0) + SET(HAVE_CUDA "no (VS2015 not supported)") +@@ -347,12 +342,15 @@ + SET(LIBFREENECT2_WITH_CUDA_SUPPORT 1) + SET(HAVE_CUDA yes) + +- STRING(REPLACE "\\" "/" NVCUDASAMPLES_ROOT "$ENV{NVCUDASAMPLES_ROOT}") ++ IF(NOT DEFINED NVCUDASAMPLES_ROOT) ++ STRING(REPLACE "\\" "/" NVCUDASAMPLES_ROOT "$ENV{NVCUDASAMPLES_ROOT}") ++ ENDIF() + STRING(REPLACE "\\" "/" NVCUDASAMPLES8_0_ROOT "$ENV{NVCUDASAMPLES8_0_ROOT}") + CUDA_INCLUDE_DIRECTORIES( + "${MY_DIR}/include/" + "${CUDA_TOOLKIT_ROOT_DIR}/samples/common/inc" + "${NVCUDASAMPLES_ROOT}/common/inc" ++ "${NVCUDASAMPLES_ROOT}/Common" + "${NVCUDASAMPLES8_0_ROOT}/common/inc" + ) + SET(CUDA_FLAGS -use_fast_math) +@@ -403,11 +401,6 @@ # Both command line -DCMAKE_INSTALL_RPATH=... and CMake GUI settings are accepted. # # Anyway if wrong versions of libusb is used, errors will be reported explicitly. -IF(NOT DEFINED CMAKE_INSTALL_RPATH AND NOT ${LibUSB_LIBDIR} MATCHES "^/usr/lib") -+IF(0 AND NOT DEFINED CMAKE_INSTALL_RPATH AND NOT ${LibUSB_LIBDIR} MATCHES "^/usr/lib") - SET(CMAKE_INSTALL_RPATH ${LibUSB_LIBDIR} CACHE STRING "Set RPATH for a private libusb") +- SET(CMAKE_INSTALL_RPATH ${LibUSB_LIBDIR} CACHE STRING "Set RPATH for a private libusb") -ELSEIF(DEFINED CMAKE_INSTALL_RPATH) -+ELSEIF(0 AND DEFINED CMAKE_INSTALL_RPATH) - SET(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_RPATH} CACHE STRING "Set RPATH for a private libusb") - ENDIF() +- SET(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_RPATH} CACHE STRING "Set RPATH for a private libusb") +-ENDIF() IF(DEFINED CMAKE_INSTALL_RPATH) + MESSAGE(STATUS "RPATH set to ${CMAKE_INSTALL_RPATH}") + ENDIF() diff --git a/recipes/libfreenect2/all/test_package/CMakeLists.txt b/recipes/libfreenect2/all/test_package/CMakeLists.txt index 5742a7e29c0d5..9acae9b976620 100644 --- a/recipes/libfreenect2/all/test_package/CMakeLists.txt +++ b/recipes/libfreenect2/all/test_package/CMakeLists.txt @@ -1,12 +1,14 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(freenect2 REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE ${freenect2_LIBRARIES}) -target_include_directories(${PROJECT_NAME} PRIVATE ${freenect2_INCLUDE_DIRS}) +target_link_libraries(${PROJECT_NAME} PRIVATE freenect2::freenect2) set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) + +if (WITH_CUDA) + cmake_minimum_required(VERSION 3.17) + find_package(CUDAToolkit REQUIRED) + target_link_libraries(${PROJECT_NAME} PRIVATE CUDA::cudart) +endif() diff --git a/recipes/libfreenect2/all/test_package/conanfile.py b/recipes/libfreenect2/all/test_package/conanfile.py index 3da371b660e0a..66cde37e06dd2 100644 --- a/recipes/libfreenect2/all/test_package/conanfile.py +++ b/recipes/libfreenect2/all/test_package/conanfile.py @@ -1,10 +1,24 @@ -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", "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["WITH_CUDA"] = self.dependencies[self.tested_reference_str].options.with_cuda + tc.generate() def build(self): cmake = CMake(self) @@ -12,6 +26,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/libfreenect2/all/test_v1_package/CMakeLists.txt b/recipes/libfreenect2/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/libfreenect2/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/libfreenect2/all/test_v1_package/conanfile.py b/recipes/libfreenect2/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..49a3a66ea5bad --- /dev/null +++ b/recipes/libfreenect2/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/libftdi/0.x/CMakeLists.txt b/recipes/libftdi/0.x/CMakeLists.txt index 5b33131a68c48..922dfc4a145e3 100644 --- a/recipes/libftdi/0.x/CMakeLists.txt +++ b/recipes/libftdi/0.x/CMakeLists.txt @@ -1,10 +1,9 @@ -cmake_minimum_required(VERSION 3.4) +cmake_minimum_required(VERSION 3.12) project(cmake_wrapper) -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +find_package(libusb-compat CONFIG REQUIRED) +find_package(Boost CONFIG REQUIRED) -link_libraries(CONAN_PKG::libusb-compat) -include_directories(${CONAN_INCLUDE_DIRS_BOOST}) +link_libraries(libusb-compat::libusb-compat Boost::boost) -add_subdirectory(source_subfolder) +add_subdirectory(src) diff --git a/recipes/libftdi/0.x/conandata.yml b/recipes/libftdi/0.x/conandata.yml index 87f1338e3ed67..362a6680a8215 100644 --- a/recipes/libftdi/0.x/conandata.yml +++ b/recipes/libftdi/0.x/conandata.yml @@ -5,4 +5,3 @@ sources: patches: "0.20": - patch_file: "patches/0001-cmake-fixes.patch" - base_path: "source_subfolder" diff --git a/recipes/libftdi/0.x/conanfile.py b/recipes/libftdi/0.x/conanfile.py index bdc298e883977..3ae320b47fbec 100644 --- a/recipes/libftdi/0.x/conanfile.py +++ b/recipes/libftdi/0.x/conanfile.py @@ -1,16 +1,22 @@ -from conans import CMake, ConanFile, tools -from contextlib import contextmanager import os +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.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir + +required_conan_version = ">=1.53.0" + class LibFtdi(ConanFile): name = "libftdi" description = "libFTDI - FTDI USB driver with bitbang mode" - topics = ("conan", "libconfuse", "configuration", "parser") + license = "LGPL-2.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.intra2net.com/en/developer/libftdi" - license = "LGPL-2.0" - exports_sources = "CMakeLists.txt", "patches/**" + topics = ("libconfuse", "configuration", "parser") + + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -22,17 +28,10 @@ class LibFtdi(ConanFile): "fPIC": True, "enable_cpp_wrapper": 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): + export_conandata_patches(self) + copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder) def config_options(self): if self.settings.os == "Windows": @@ -40,51 +39,55 @@ 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_cpp_wrapper: - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") - def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename("libftdi-{}".format(self.version), self._source_subfolder) + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("libusb-compat/0.1.7") + self.requires("libusb-compat/0.1.7", transitive_headers=True, transitive_libs=True) if self.options.enable_cpp_wrapper: - self.requires("boost/1.74.0") - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["FTDIPP"] = self.options.enable_cpp_wrapper - self._cmake.definitions["PYTHON_BINDINGS"] = False - self._cmake.definitions["EXAMPLES"] = False - self._cmake.definitions["DOCUMENTATION"] = False - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + self.requires("boost/1.83.0", transitive_headers=True) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["FTDIPP"] = self.options.enable_cpp_wrapper + tc.variables["PYTHON_BINDINGS"] = False + tc.variables["EXAMPLES"] = False + tc.variables["DOCUMENTATION"] = False + tc.generate() + tc = CMakeDeps(self) + tc.generate() 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, "CMakeLists.txt"), "CMAKE_BINARY_DIR", "PROJECT_BINARY_DIR") - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), "CMAKE_SOURCE_DIR", "PROJECT_SOURCE_DIR") - tools.replace_in_file(os.path.join(self._source_subfolder, "ftdipp", "CMakeLists.txt"), "CMAKE_SOURCE_DIR", "PROJECT_SOURCE_DIR") + apply_conandata_patches(self) + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "CMAKE_BINARY_DIR", "PROJECT_BINARY_DIR") + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "CMAKE_SOURCE_DIR", "PROJECT_SOURCE_DIR") + replace_in_file(self, os.path.join(self.source_folder, "ftdipp", "CMakeLists.txt"), + "CMAKE_SOURCE_DIR", "PROJECT_SOURCE_DIR") def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=self.source_path.parent) cmake.build() def package(self): - self.copy(pattern="COPYING*", src=self._source_subfolder, dst="licenses") - 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")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + fix_apple_shared_install_name(self) def package_info(self): + self.cpp_info.libs = ["ftdi"] + self.cpp_info.requires = ["libusb-compat::libusb-compat"] if self.options.enable_cpp_wrapper: self.cpp_info.libs.append("ftdipp") - self.cpp_info.libs.append("ftdi") + self.cpp_info.requires.append("boost::headers") diff --git a/recipes/libftdi/0.x/test_package/CMakeLists.txt b/recipes/libftdi/0.x/test_package/CMakeLists.txt index 7b9b613cbb24a..6f4e1992a2351 100644 --- a/recipes/libftdi/0.x/test_package/CMakeLists.txt +++ b/recipes/libftdi/0.x/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ -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() +find_package(libftdi REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE libftdi::libftdi) diff --git a/recipes/libftdi/0.x/test_package/conanfile.py b/recipes/libftdi/0.x/test_package/conanfile.py index 8c64bd2e6fd24..35930df6e35fd 100644 --- a/recipes/libftdi/0.x/test_package/conanfile.py +++ b/recipes/libftdi/0.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_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,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.bindir, "test_package") config_path = os.path.join(self.source_folder, "hello.conf") - self.run("{} {}".format(bin_path, config_path), run_environment=True) + self.run(f"{bin_path} {config_path}", env="conanrun") diff --git a/recipes/libftdi/0.x/test_v1_package/CMakeLists.txt b/recipes/libftdi/0.x/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/libftdi/0.x/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/libftdi/0.x/test_v1_package/conanfile.py b/recipes/libftdi/0.x/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..a86b3a5dad12e --- /dev/null +++ b/recipes/libftdi/0.x/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") + config_path = os.path.join(self.source_folder, "hello.conf") + self.run("{} {}".format(bin_path, config_path), run_environment=True) 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..93a939465107f 100644 --- a/recipes/libftdi/1.x/conanfile.py +++ b/recipes/libftdi/1.x/conanfile.py @@ -1,103 +1,117 @@ import os -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 CMakeToolchain, CMake, CMakeDeps, cmake_layout +from conan.tools.files import get, rmdir, export_conandata_patches, apply_conandata_patches, copy +from conan.tools.microsoft import is_msvc + +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") - homepage = "https://www.intra2net.com/en/developer/libftdi/" + license = ("LGPL-2.0-only", "GPLv2-or-later") url = "https://github.com/conan-io/conan-center-index" - exports_sources = ["CMakeLists.txt", "patches/*"] - generators = "cmake", "cmake_find_package", "pkg_config" + homepage = "https://www.intra2net.com/en/developer/libftdi/" + topics = "ftdi" + + package_type = "library" 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 source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = "libftdi1-" + self.version - os.rename(extracted_dir, self._source_subfolder) + def export_sources(self): + export_conandata_patches(self) 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 configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + if self.options.build_eeprom_tool or self.options.enable_cpp_wrapper: + self.license = ("LGPL-2.1-only", "GPL-2.0-only") + else: + self.license = "LGPL-2.1-only" - def _configure_cmake(self): - if self._cmake: - return self._cmake - - 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 layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("libusb/1.0.24") - self.requires("boost/1.75.0") + # libusb.h is used in public ftdi.h + self.requires("libusb/1.0.26", transitive_headers=True, transitive_libs=True) + if self.options.enable_cpp_wrapper: + # boost/shared_ptr.hpp is used in public ftdi.hpp + self.requires("boost/1.83.0", transitive_headers=True) 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 source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + 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 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" + self.cpp_info.set_property("cmake_file_name", "LibFTDI1") - self.cpp_info.components["ftdi"].names["pkg_config"] = "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["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"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["ftdipp"].system_libs.append("m") + + # TODO: 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" 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..40064cdad12f4 100644 --- a/recipes/libftdi/1.x/test_package/CMakeLists.txt +++ b/recipes/libftdi/1.x/test_package/CMakeLists.txt @@ -1,13 +1,10 @@ -cmake_minimum_required(VERSION 3.10) - +cmake_minimum_required(VERSION 3.15) 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..65f19e16d7a62 --- /dev/null +++ b/recipes/libftdi/1.x/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +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/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/libftp/all/conandata.yml b/recipes/libftp/all/conandata.yml new file mode 100644 index 0000000000000..fb2299e0d19a5 --- /dev/null +++ b/recipes/libftp/all/conandata.yml @@ -0,0 +1,16 @@ +sources: + "1.3.0": + url: "https://github.com/deniskovalchuk/libftp/archive/refs/tags/v1.3.0.tar.gz" + sha256: "e4861fccb5c67742db1aa8f1af98ac70888b54212b06a8366d84a040897ca749" + "1.1.0": + url: "https://github.com/deniskovalchuk/libftp/archive/refs/tags/v1.1.0.tar.gz" + sha256: "8d9ff413436b17eef225c4b12539965cdea786d02bb2c688b153992d36f88f48" + "0.5.1": + url: "https://github.com/deniskovalchuk/libftp/archive/refs/tags/v0.5.1.tar.gz" + sha256: "6cc6e80b50ba425b66175d3b0d22358db4ebeb4941edc33bba47d72442de5645" + "0.5.0": + url: "https://github.com/deniskovalchuk/libftp/archive/refs/tags/v0.5.0.tar.gz" + sha256: "566d4d176bf754571e01563c4c0182a9c54b90903cd958a609fa0d6bd4c2141e" + "0.4.1": + url: "https://github.com/deniskovalchuk/libftp/archive/refs/tags/v0.4.1.tar.gz" + sha256: "873dd7647234f72fecfe57150b0a4a60f4c16611d26ad7eb687e0561f54b9eec" diff --git a/recipes/libftp/all/conanfile.py b/recipes/libftp/all/conanfile.py new file mode 100644 index 0000000000000..7669d367c9256 --- /dev/null +++ b/recipes/libftp/all/conanfile.py @@ -0,0 +1,82 @@ +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, rmdir +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version +import os + +required_conan_version = ">=2.0" + + +class LibFTPConan(ConanFile): + name = "libftp" + description = "A cross-platform FTP/FTPS client library based on Boost.Asio" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/deniskovalchuk/libftp" + topics = ("ftp", "ftps", "boost", "ssl", "tls", "openssl") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + implements = ["auto_shared_fpic"] + + def configure(self): + if is_msvc(self): + del self.options.shared + self.package_type = "static-library" + if self.options.get_safe("shared"): + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires("boost/1.86.0", transitive_headers=True) + if Version(self.version) >= "0.5.0": + self.requires("openssl/[>=1.1 <4]", transitive_headers=True, transitive_libs=True) + + def validate(self): + check_min_cppstd(self, 17) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["LIBFTP_BUILD_TEST"] = False + tc.variables["LIBFTP_BUILD_EXAMPLE"] = False + tc.variables["LIBFTP_BUILD_CMDLINE_CLIENT"] = False + tc.generate() + deps = CMakeDeps(self) + deps.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE", self.source_folder, 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 = ["ftp"] + + self.cpp_info.set_property("cmake_file_name", "ftp") + self.cpp_info.set_property("cmake_target_name", "ftp::ftp") + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") + + if self.settings.os == "Windows": + self.cpp_info.system_libs.append("ws2_32") diff --git a/recipes/libftp/all/test_package/CMakeLists.txt b/recipes/libftp/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..d4b87e9e23e3a --- /dev/null +++ b/recipes/libftp/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(ftp REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE ftp::ftp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/libftp/all/test_package/conanfile.py b/recipes/libftp/all/test_package/conanfile.py new file mode 100644 index 0000000000000..ef5d7042163ec --- /dev/null +++ b/recipes/libftp/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libftp/all/test_package/test_package.cpp b/recipes/libftp/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..78760fc11e2a1 --- /dev/null +++ b/recipes/libftp/all/test_package/test_package.cpp @@ -0,0 +1,12 @@ +#include +#include "ftp/client.hpp" + +int main(void) { + try { + ftp::client client; + } + catch (const std::exception & ex) { + std::cerr << ex.what() << std::endl; + } + return 0; +} diff --git a/recipes/libftp/config.yml b/recipes/libftp/config.yml new file mode 100644 index 0000000000000..bcb0309be3cae --- /dev/null +++ b/recipes/libftp/config.yml @@ -0,0 +1,11 @@ +versions: + "1.3.0": + folder: all + "1.1.0": + folder: all + "0.5.1": + folder: all + "0.5.0": + folder: all + "0.4.1": + folder: all diff --git a/recipes/libfuse/2.x.x/conanfile.py b/recipes/libfuse/2.x.x/conanfile.py index 9859979728600..d233b32a70631 100644 --- a/recipes/libfuse/2.x.x/conanfile.py +++ b/recipes/libfuse/2.x.x/conanfile.py @@ -14,7 +14,9 @@ class LibfuseConan(ConanFile): homepage = "https://github.com/libfuse/libfuse" license = "LGPL-2.1" description = "The reference implementation of the Linux FUSE interface" - topics = ("fuse", "libfuse", "filesystem", "linux") + topics = ("fuse", "filesystem", "linux") + + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -25,9 +27,13 @@ class LibfuseConan(ConanFile): "fPIC": True, } + 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") self.settings.rm_safe("compiler.libcxx") self.settings.rm_safe("compiler.cppstd") @@ -35,12 +41,11 @@ def layout(self): basic_layout(self, src_folder="src") def validate(self): - if self.info.settings.os not in ("Linux", "FreeBSD"): + if self.settings.os not in ("Linux", "FreeBSD"): raise ConanInvalidConfiguration("libfuse supports only Linux and FreeBSD") 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 = AutotoolsToolchain(self) @@ -72,6 +77,5 @@ def package_info(self): self.cpp_info.system_libs = ["pthread"] # libfuse requires this define to compile successfully self.cpp_info.defines = ["_FILE_OFFSET_BITS=64"] - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("dl") - diff --git a/recipes/libfuse/2.x.x/test_package/CMakeLists.txt b/recipes/libfuse/2.x.x/test_package/CMakeLists.txt index 701d331873021..b328202f167f9 100644 --- a/recipes/libfuse/2.x.x/test_package/CMakeLists.txt +++ b/recipes/libfuse/2.x.x/test_package/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package LANGUAGES C) find_package(libfuse REQUIRED CONFIG) diff --git a/recipes/libfuse/2.x.x/test_v1_package/CMakeLists.txt b/recipes/libfuse/2.x.x/test_v1_package/CMakeLists.txt index 0d20897301b68..b21cc49efde95 100644 --- a/recipes/libfuse/2.x.x/test_v1_package/CMakeLists.txt +++ b/recipes/libfuse/2.x.x/test_v1_package/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) diff --git a/recipes/libfuse/all/conandata.yml b/recipes/libfuse/all/conandata.yml index c5d2a101abf4a..8a9ccf19ae441 100644 --- a/recipes/libfuse/all/conandata.yml +++ b/recipes/libfuse/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.16.2": + url: "https://github.com/libfuse/libfuse/releases/download/fuse-3.16.2/fuse-3.16.2.tar.gz" + sha256: "f797055d9296b275e981f5f62d4e32e089614fc253d1ef2985851025b8a0ce87" "3.10.5": url: "https://github.com/libfuse/libfuse/releases/download/fuse-3.10.5/fuse-3.10.5.tar.xz" sha256: "b2e283485d47404ac896dd0bb7f7ba81e1470838e677e45f659804c3a3b69666" diff --git a/recipes/libfuse/all/conanfile.py b/recipes/libfuse/all/conanfile.py index d9c14cd333993..2b5f67a4fee98 100644 --- a/recipes/libfuse/all/conanfile.py +++ b/recipes/libfuse/all/conanfile.py @@ -15,7 +15,8 @@ class LibfuseConan(ConanFile): homepage = "https://github.com/libfuse/libfuse" license = "LGPL-2.1" description = "The reference implementation of the Linux FUSE interface" - topics = ("fuse", "libfuse", "filesystem", "linux") + topics = ("fuse", "filesystem", "linux") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -26,9 +27,13 @@ class LibfuseConan(ConanFile): "fPIC": True, } + 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") self.settings.rm_safe("compiler.libcxx") self.settings.rm_safe("compiler.cppstd") @@ -36,15 +41,14 @@ def layout(self): basic_layout(self, src_folder="src") def validate(self): - if self.info.settings.os not in ("Linux", "FreeBSD"): + if self.settings.os not in ("Linux", "FreeBSD"): raise ConanInvalidConfiguration("libfuse supports only Linux and FreeBSD") def build_requirements(self): - self.tool_requires("meson/0.64.0") + self.tool_requires("meson/1.2.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) @@ -72,6 +76,5 @@ def package_info(self): self.cpp_info.libs = ["fuse3"] self.cpp_info.includedirs = [os.path.join("include", "fuse3")] self.cpp_info.system_libs = ["pthread"] - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: 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 c8bc174f2164d..2fd81a9f515e7 100644 --- a/recipes/libfuse/all/test_package/CMakeLists.txt +++ b/recipes/libfuse/all/test_package/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package LANGUAGES C) find_package(libfuse REQUIRED CONFIG) diff --git a/recipes/libfuse/all/test_v1_package/CMakeLists.txt b/recipes/libfuse/all/test_v1_package/CMakeLists.txt index 0d20897301b68..b21cc49efde95 100644 --- a/recipes/libfuse/all/test_v1_package/CMakeLists.txt +++ b/recipes/libfuse/all/test_v1_package/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) diff --git a/recipes/libfuse/config.yml b/recipes/libfuse/config.yml index 3f5d2920bcb10..44d31f4a5151a 100644 --- a/recipes/libfuse/config.yml +++ b/recipes/libfuse/config.yml @@ -1,4 +1,6 @@ versions: + "3.16.2": + folder: all "3.10.5": folder: all "2.9.9": diff --git a/recipes/libgcrypt/all/conandata.yml b/recipes/libgcrypt/all/conandata.yml index ec37a3b999a57..7c8e4799d8c00 100644 --- a/recipes/libgcrypt/all/conandata.yml +++ b/recipes/libgcrypt/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.10.3": + url: "https://gnupg.org/ftp/gcrypt/libgcrypt/libgcrypt-1.10.3.tar.gz" + sha256: "946f7e56f795ba2ea88b842a8c6b8f469360cda42c1d3d191f7ac7e9aa8239f8" "1.8.4": url: "https://gnupg.org/ftp/gcrypt/libgcrypt/libgcrypt-1.8.4.tar.gz" sha256: "fc3c49cc8611068e6008482c3bbee6c66b9287808bbb4e14a473f4cc347b78ce" diff --git a/recipes/libgcrypt/all/conanfile.py b/recipes/libgcrypt/all/conanfile.py index 7ebc509dad85e..eb8e63a9f7a93 100644 --- a/recipes/libgcrypt/all/conanfile.py +++ b/recipes/libgcrypt/all/conanfile.py @@ -2,7 +2,7 @@ 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.files import copy, get, rm, rmdir, save from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain from conan.tools.layout import basic_layout import os @@ -17,6 +17,7 @@ class LibgcryptConan(ConanFile): description = "Libgcrypt is a general purpose cryptographic library originally based on code from GnuPG" topics = ("gcrypt", "gnupg", "gpg", "crypto", "cryptography") license = "LGPL-2.1-or-later" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -37,16 +38,15 @@ def layout(self): basic_layout(self, src_folder="src") def requirements(self): - self.requires("libcap/2.65") - self.requires("libgpg-error/1.36") + self.requires("libcap/2.69") + self.requires("libgpg-error/1.36", transitive_headers=True) def validate(self): - if self.info.settings.os != "Linux": + if self.settings.os != "Linux": raise ConanInvalidConfiguration("This recipe only support Linux. You can contribute Windows and/or Macos 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): if not cross_building(self): @@ -63,7 +63,12 @@ def generate(self): deps = AutotoolsDeps(self) deps.generate() + def _patch_sources(self): + # Disable the tests subdir + save(self, os.path.join(self.source_folder, "tests", "Makefile.in"), "all:\ninstall:\n") + def build(self): + self._patch_sources() autotools = Autotools(self) autotools.configure() autotools.make() @@ -73,6 +78,7 @@ def package(self): 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")) rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): diff --git a/recipes/libgcrypt/config.yml b/recipes/libgcrypt/config.yml index f058837ee5cb1..629c9c832f1c5 100644 --- a/recipes/libgcrypt/config.yml +++ b/recipes/libgcrypt/config.yml @@ -1,3 +1,5 @@ versions: + "1.10.3": + folder: all "1.8.4": folder: all 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..1c4db40fa14b0 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,53 @@ 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" + - patch_file: "patches/2.3.3-use-cci.patch" + patch_description: "use cci's package" + patch_type: "conan" "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" + - patch_file: "patches/2.3.2-use-cci.patch" + patch_description: "use cci's package" + patch_type: "conan" "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..ffc0a4e68966c 100644 --- a/recipes/libgd/all/conanfile.py +++ b/recipes/libgd/all/conanfile.py @@ -1,22 +1,21 @@ 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") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -25,6 +24,10 @@ class LibgdConan(ConanFile): "with_jpeg": [True, False], "with_tiff": [True, False], "with_freetype": [True, False], + "with_xpm": [True, False], + "with_webp": [True, False], + "with_heif": [True, False], + "with_avif": [True, False], } default_options = { "shared": False, @@ -33,97 +36,117 @@ class LibgdConan(ConanFile): "with_jpeg": False, "with_tiff": False, "with_freetype": False, + "with_xpm": False, + "with_webp": False, + "with_heif": False, + "with_avif": 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": del self.options.fPIC + if Version(self.version) < "2.3.2": + del self.options.with_heif + del self.options.with_avif 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.11 <2]") if self.options.with_png: - self.requires("libpng/1.6.37") + self.requires("libpng/[>=1.6 <2]") 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") + self.requires("libtiff/4.6.0") if self.options.with_freetype: - self.requires("freetype/2.12.1") + self.requires("freetype/2.13.2") + if self.options.with_xpm: + self.requires("libxpm/3.5.13") + if self.options.with_webp: + self.requires("libwebp/1.3.2") + if self.options.get_safe("with_heif"): + self.requires("libheif/1.16.2") + if self.options.get_safe("with_avif"): + self.requires("libavif/1.0.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) + + 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"] = self.options.with_xpm + tc.variables["ENABLE_FREETYPE"] = self.options.with_freetype + tc.variables["ENABLE_FONTCONFIG"] = False + tc.variables["ENABLE_WEBP"] = self.options.with_webp + if Version(self.version) >= "2.3.2": + tc.variables["ENABLE_HEIF"] = self.options.get_safe("with_heif", False) + tc.variables["ENABLE_AVIF"] = self.options.get_safe("with_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.set_property("libheif", "cmake_file_name", "HEIF") + deps.set_property("webp", "cmake_file_name", "WEBP") + deps.set_property("libxpm", "cmake_file_name", "XPM") + deps.set_property("freetype", "cmake_file_name", "FREETYPE") + 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 +156,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.2-use-cci.patch b/recipes/libgd/all/patches/2.3.2-use-cci.patch new file mode 100644 index 0000000000000..57724df5d1cec --- /dev/null +++ b/recipes/libgd/all/patches/2.3.2-use-cci.patch @@ -0,0 +1,27 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 57cd95d..f7640c5 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -126,7 +126,7 @@ else (USE_EXT_GD) + ENDIF (ENABLE_HEIF) + + IF (ENABLE_AVIF) +- FIND_PACKAGE(libavif 0.8.2 REQUIRED CONFIG) ++ FIND_PACKAGE(libavif REQUIRED CONFIG) + SET(HAVE_LIBAVIF 1) + SET(AVIF_LIBRARIES avif) + SET(AVIF_FOUND 1) +@@ -212,11 +212,11 @@ else (USE_EXT_GD) + LIST(APPEND PKG_REQUIRES_PRIVATES xpm) + ENDIF(XPM_FOUND) + +- IF(JPEG_FOUND) ++ IF(ENABLE_JPEG AND JPEG_FOUND) + INCLUDE_DIRECTORIES(${JPEG_INCLUDE_DIR}) + SET(HAVE_LIBJPEG 1) + LIST(APPEND PKG_REQUIRES_PRIVATES libjpeg) +- ENDIF(JPEG_FOUND) ++ ENDIF() + + IF(TIFF_FOUND) + INCLUDE_DIRECTORIES(${TIFF_INCLUDE_DIR}) 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/patches/2.3.3-use-cci.patch b/recipes/libgd/all/patches/2.3.3-use-cci.patch new file mode 100644 index 0000000000000..561c4e9f127a0 --- /dev/null +++ b/recipes/libgd/all/patches/2.3.3-use-cci.patch @@ -0,0 +1,27 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 6b3e5b3..2b71c74 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -142,7 +142,7 @@ else (USE_EXT_GD) + ENDIF (ENABLE_HEIF) + + IF (ENABLE_AVIF) +- FIND_PACKAGE(libavif 0.8.2 REQUIRED CONFIG) ++ FIND_PACKAGE(libavif REQUIRED CONFIG) + SET(HAVE_LIBAVIF 1) + SET(AVIF_LIBRARIES avif) + SET(AVIF_FOUND 1) +@@ -228,11 +228,11 @@ else (USE_EXT_GD) + LIST(APPEND PKG_REQUIRES_PRIVATES xpm) + ENDIF(XPM_FOUND) + +- IF(JPEG_FOUND) ++ IF(ENABLE_JPEG AND JPEG_FOUND) + INCLUDE_DIRECTORIES(${JPEG_INCLUDE_DIR}) + SET(HAVE_LIBJPEG 1) + LIST(APPEND PKG_REQUIRES_PRIVATES libjpeg) +- ENDIF(JPEG_FOUND) ++ ENDIF() + + IF(TIFF_FOUND) + INCLUDE_DIRECTORIES(${TIFF_INCLUDE_DIR}) 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/conandata.yml b/recipes/libgeotiff/all/conandata.yml index 7f1d9af273208..d67cfa6fff858 100644 --- a/recipes/libgeotiff/all/conandata.yml +++ b/recipes/libgeotiff/all/conandata.yml @@ -1,16 +1,16 @@ 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" diff --git a/recipes/libgeotiff/all/conanfile.py b/recipes/libgeotiff/all/conanfile.py index cfb2f00d55368..557e23e5c4e53 100644 --- a/recipes/libgeotiff/all/conanfile.py +++ b/recipes/libgeotiff/all/conanfile.py @@ -4,7 +4,7 @@ import os import textwrap -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class LibgeotiffConan(ConanFile): @@ -15,7 +15,7 @@ class LibgeotiffConan(ConanFile): topics = ("geotiff", "tiff") homepage = "https://github.com/OSGeo/libgeotiff" url = "https://github.com/conan-io/conan-center-index" - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -35,29 +35,20 @@ def config_options(self): 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 + 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.4.0") - self.requires("proj/9.0.1") + # libgeotiff/include/xtiffio.h includes libtiff/include/tiffio.h + self.requires("libtiff/4.6.0", transitive_headers=True, transitive_libs=True) + self.requires("proj/9.3.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): tc = CMakeToolchain(self) @@ -70,11 +61,11 @@ def generate(self): def build(self): apply_conandata_patches(self) cmake = CMake(self) - cmake.configure(build_script_folder=os.path.join(self.source_folder, "libgeotiff")) + cmake.configure() cmake.build() def package(self): - copy(self, "LICENSE", src=os.path.join(self.source_folder, "libgeotiff"), 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, "cmake")) 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 8caed57981342..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,5 +1,5 @@ ---- a/libgeotiff/CMakeLists.txt -+++ b/libgeotiff/CMakeLists.txt +--- a/CMakeLists.txt ++++ b/CMakeLists.txt @@ -5,6 +5,7 @@ # Author: Mateusz Loskot # 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 7558274a78099..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,5 +1,5 @@ ---- a/libgeotiff/CMakeLists.txt -+++ b/libgeotiff/CMakeLists.txt +--- a/CMakeLists.txt ++++ b/CMakeLists.txt @@ -5,6 +5,7 @@ # Author: Mateusz Loskot # 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 7f0663e5d7198..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,5 @@ ---- a/libgeotiff/CMakeLists.txt -+++ b/libgeotiff/CMakeLists.txt +--- a/CMakeLists.txt ++++ b/CMakeLists.txt @@ -5,6 +5,7 @@ # Author: Mateusz Loskot # diff --git a/recipes/libgeotiff/all/test_v1_package/CMakeLists.txt b/recipes/libgeotiff/all/test_v1_package/CMakeLists.txt index b4636735c7425..0d20897301b68 100644 --- a/recipes/libgeotiff/all/test_v1_package/CMakeLists.txt +++ b/recipes/libgeotiff/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(geotiff REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE geotiff_library) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libgettext/all/conandata.yml b/recipes/libgettext/all/conandata.yml index 601a709179995..c7f8b2f8602a5 100644 --- a/recipes/libgettext/all/conandata.yml +++ b/recipes/libgettext/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.22": + url: "https://ftp.gnu.org/pub/gnu/gettext/gettext-0.22.tar.gz" + sha256: "49f089be11b490170bbf09ed2f51e5f5177f55be4cc66504a5861820e0fb06ab" "0.21": url: "https://ftp.gnu.org/pub/gnu/gettext/gettext-0.21.tar.gz" sha256: "c77d0da3102aec9c07f43671e60611ebff89a996ef159497ce8e59d075786b12" @@ -14,11 +17,9 @@ patches: - patch_file: "patches/0001-build-Fix-build-errors-with-MSVC.patch" patch_description: "Fix build errors with MSVC" patch_type: "portability" - - patch_file: "patches/0002-memmove-is-intrinsic-function-on-MSVC.patch" patch_description: "memmove is intrinsic function on MSVC" patch_type: "portability" - - patch_file: "patches/0003-Reported-by-Gabor-Z.-Papp-gzp-papp.hu.patch" 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 710d9c34780aa..9532952752a09 100644 --- a/recipes/libgettext/all/conanfile.py +++ b/recipes/libgettext/all/conanfile.py @@ -1,3 +1,4 @@ +import glob import os from conan import ConanFile @@ -25,24 +26,29 @@ class GetTextConan(ConanFile): topics = ("gettext", "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" + # Some parts of the project are GPL-3.0-or-later and some are LGPL-2.1-or-later. + # At this time, only libintl is packaged, which is licensed under the LGPL-2.1-or-later. + # If you modify this package to include other portions of the library, please configure the license accordingly. + # The licensing of the project is documented here: https://www.gnu.org/software/gettext/manual/gettext.html#Licenses + license = "LGPL-2.1-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 _is_clang_cl(self): - return (str(self.settings.compiler) in ["clang"] and str(self.settings.os) in ["Windows"]) or \ - self.settings.get_safe("compiler.toolset") == "ClangCL" + return self.settings.os == "Windows" and self.settings.compiler == "clang" and \ + self.settings.compiler.get_safe("runtime") @property def _gettext_folder(self): @@ -52,18 +58,17 @@ def export_sources(self): export_conandata_patches(self) def config_options(self): - if self.settings.os == 'Windows': + 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: 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") @@ -74,10 +79,6 @@ 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": self.win_bash = True @@ -87,7 +88,7 @@ def build_requirements(self): self.tool_requires("automake/1.16.5") 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): VirtualBuildEnv(self).generate() @@ -108,7 +109,7 @@ def generate(self): "--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.deps_cpp_info['libiconv'].rootpath)}" + f"--with-libiconv-prefix={unix_path(self, self.dependencies['libiconv'].package_folder)}", ] if is_msvc(self) or self._is_clang_cl: target = None @@ -120,40 +121,20 @@ def generate(self): if target is not None: tc.configure_args += [f"--host={target}", f"--build={target}"] - 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"): + 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"] + if self.settings.build_type == "Debug": + # Skip checking for the 'n' printf format directly + # in msvc, as it is known to not be available due to security concerns. + # Skipping it avoids a GUI prompt during ./configure for a debug build + # See https://github.com/conan-io/conan-center-index/issues/23698 + tc.configure_args.extend([ + 'gl_cv_func_printf_directive_n=no' + ]) tc.make_args += ["-C", "intl"] - tc.generate() - - deps = AutotoolsDeps(self) - - if is_msvc(self) or self._is_clang_cl: - # This mimics the v1 recipe, on the basis that it works and the defaults do not. - def lib_paths(): - for dep in self.deps_cpp_info.deps: - dep_info = self.deps_cpp_info[dep] - for lib_path in dep_info.lib_paths: - yield unix_path(self, lib_path) - - fixed_cppflags_args = deps.vars().get("CPPFLAGS").replace("/I", "-I") - deps.environment.define("CPPFLAGS", f"$CPPFLAGS {fixed_cppflags_args}") - if self._is_clang_cl: - fixed_ldflags_args = deps.vars().get("LDFLAGS").replace("/LIBPATH:", "-LIBPATH:") - else: - fixed_ldflags_args = deps.vars().get("LDFLAGS").replace("/LIBPATH:", "-L") - deps.environment.define("LDFLAGS", f"$LDFLAGS {fixed_ldflags_args}") - - libs = deps.vars().get("LIBS") - deps.environment.define("_LINK_", libs) - deps.environment.unset("LIBS") - - for lib_path in lib_paths(): - deps.environment.prepend_path("LIB", lib_path) - - deps.generate() - + env = tc.environment() if is_msvc(self) or self._is_clang_cl: def programs(): rc = None @@ -165,10 +146,9 @@ def programs(): 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 - - 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) + + 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}") @@ -180,13 +160,43 @@ def programs(): if rc is not None: env.define("RC", rc) env.define("WINDRES", rc) + tc.generate(env) - env.vars(self).save_script("conanbuild_msvc") + 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): apply_conandata_patches(self) autotools = Autotools(self) - autotools.configure("gettext-tools") + autotools.configure("gettext-runtime") autotools.make() def package(self): @@ -201,8 +211,7 @@ def package(self): 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")) - if (is_msvc(self) or self._is_clang_cl) and self.options.shared: - rename(self, os.path.join(dest_lib_dir, "gnuintl.dll.lib"), os.path.join(dest_lib_dir, "gnuintl.lib")) + fix_msvc_libname(self) def package_info(self): self.cpp_info.set_property("cmake_find_mode", "both") @@ -214,3 +223,17 @@ def package_info(self): 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 + 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/conanfile.py b/recipes/libgettext/all/test_package/conanfile.py index b9667f823f2c1..50e1b261c1fd4 100644 --- a/recipes/libgettext/all/test_package/conanfile.py +++ b/recipes/libgettext/all/test_package/conanfile.py @@ -1,8 +1,6 @@ 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 +from conan.tools.cmake import CMake, cmake_layout import os @@ -10,6 +8,7 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" test_type = "explicit" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" def requirements(self): self.requires(self.tested_reference_str) @@ -17,33 +16,12 @@ def requirements(self): 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) 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, "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 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}") + self.run(bin_path, env=f"conanrun") diff --git a/recipes/libgettext/all/test_package/po/en/conan.mo.workaround_git_ignore b/recipes/libgettext/all/test_package/po/en/conan.mo.workaround_git_ignore deleted file mode 100644 index f2f426b3ff66b..0000000000000 Binary files a/recipes/libgettext/all/test_package/po/en/conan.mo.workaround_git_ignore and /dev/null differ diff --git a/recipes/libgettext/all/test_package/po/en/conan.po b/recipes/libgettext/all/test_package/po/en/conan.po deleted file mode 100644 index 082414b2e22f6..0000000000000 --- a/recipes/libgettext/all/test_package/po/en/conan.po +++ /dev/null @@ -1,23 +0,0 @@ -# Conan 1.0. -# Copyright (C) Bincrafters -# This file is distributed under the same license as the Conan package. -# Bincrafters , 2019. -msgid "" -msgstr "" -"Project-Id-Version: conan 1.0\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-07-11 03:48-0700\n" -"PO-Revision-Date: 2019-07-11 03:57-0700\n" -"Last-Translator: U-DESKTOP-HHN0EAP\\sse4 \n" -"Language-Team: English\n" -"Language: en\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#. Example of i18n usage -#: hello.c:17 -#, c-format -msgid "hello" -msgstr "hello" diff --git a/recipes/libgettext/all/test_package/po/es/conan.mo.workaround_git_ignore b/recipes/libgettext/all/test_package/po/es/conan.mo.workaround_git_ignore deleted file mode 100644 index 941535abc76d2..0000000000000 Binary files a/recipes/libgettext/all/test_package/po/es/conan.mo.workaround_git_ignore and /dev/null differ diff --git a/recipes/libgettext/all/test_package/po/es/conan.po b/recipes/libgettext/all/test_package/po/es/conan.po deleted file mode 100644 index 29a2b6106de38..0000000000000 --- a/recipes/libgettext/all/test_package/po/es/conan.po +++ /dev/null @@ -1,23 +0,0 @@ -# Conan 1.0. -# Copyright (C) Bincrafters -# This file is distributed under the same license as the Conan package. -# Bincrafters , 2019. -msgid "" -msgstr "" -"Project-Id-Version: conan 1.0\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-07-11 03:48-0700\n" -"PO-Revision-Date: 2019-07-11 03:58-0700\n" -"Last-Translator: U-DESKTOP-HHN0EAP\\sse4 \n" -"Language-Team: Spanish\n" -"Language: es\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#. Example of i18n usage -#: hello.c:17 -#, c-format -msgid "hello" -msgstr "holla" diff --git a/recipes/libgettext/all/test_package/po/ru/conan.mo.workaround_git_ignore b/recipes/libgettext/all/test_package/po/ru/conan.mo.workaround_git_ignore deleted file mode 100644 index 8f1f836a04c91..0000000000000 Binary files a/recipes/libgettext/all/test_package/po/ru/conan.mo.workaround_git_ignore and /dev/null differ diff --git a/recipes/libgettext/all/test_package/po/ru/conan.po b/recipes/libgettext/all/test_package/po/ru/conan.po deleted file mode 100644 index 34ecc9f75cf1e..0000000000000 --- a/recipes/libgettext/all/test_package/po/ru/conan.po +++ /dev/null @@ -1,24 +0,0 @@ -# Conan 1.0. -# Copyright (C) Bincrafters -# This file is distributed under the same license as the Conan package. -# Bincrafters , 2019. -msgid "" -msgstr "" -"Project-Id-Version: conan 1.0\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-07-11 03:48-0700\n" -"PO-Revision-Date: 2019-07-11 03:58-0700\n" -"Last-Translator: U-DESKTOP-HHN0EAP\\sse4 \n" -"Language-Team: Russian\n" -"Language: ru\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" -"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" - -#. Example of i18n usage -#: hello.c:17 -#, c-format -msgid "hello" -msgstr "privet" diff --git a/recipes/libgettext/all/test_package/test_package.c b/recipes/libgettext/all/test_package/test_package.c index 615e9408bed47..262221a2aba6a 100644 --- a/recipes/libgettext/all/test_package/test_package.c +++ b/recipes/libgettext/all/test_package/test_package.c @@ -1,26 +1,8 @@ #include -#include -#include #include -int main(int argc, char * const argv[]) -{ - if (argc < 2) - return -1; - if(!bindtextdomain("conan", argv[1])) - { - printf("Warning: Could not bind text domain\n"); - } - if(!textdomain("conan")) - { - printf("Warning: Could not set text domain\n"); - } - if(!setlocale(LC_ALL, "")) - { - printf("Warning: could not set locale\n"); - } - const char * lang = getenv("LANG"); - lang = lang ? lang : ""; - printf("hello in %s: %s\n", lang, gettext("hello")); +int main() { + gettext("Hello, world!"); + return 0; } diff --git a/recipes/libgettext/all/test_v1_package/CMakeLists.txt b/recipes/libgettext/all/test_v1_package/CMakeLists.txt deleted file mode 100644 index f9bddeec6f96a..0000000000000 --- a/recipes/libgettext/all/test_v1_package/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -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 deleted file mode 100644 index 36bfb4bd5c2c9..0000000000000 --- a/recipes/libgettext/all/test_v1_package/conanfile.py +++ /dev/null @@ -1,31 +0,0 @@ -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/libgettext/config.yml b/recipes/libgettext/config.yml index dc03f51a1d462..c7ed4b0b0c8c1 100644 --- a/recipes/libgettext/config.yml +++ b/recipes/libgettext/config.yml @@ -1,4 +1,6 @@ versions: + "0.22": + folder: all "0.21": folder: all "0.20.1": diff --git a/recipes/libgit2/0.27.x/CMakeLists.txt b/recipes/libgit2/0.27.x/CMakeLists.txt deleted file mode 100644 index c502da172e7b8..0000000000000 --- a/recipes/libgit2/0.27.x/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper C) - -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory(source_subfolder) diff --git a/recipes/libgit2/0.27.x/conandata.yml b/recipes/libgit2/0.27.x/conandata.yml deleted file mode 100644 index dddcd1d95b8f4..0000000000000 --- a/recipes/libgit2/0.27.x/conandata.yml +++ /dev/null @@ -1,4 +0,0 @@ -sources: - "0.27.10": - url: "https://github.com/libgit2/libgit2/archive/v0.27.10.tar.gz" - sha256: "f6fd26378ff71bd7a4b17b576c82c774a2e9c2d6b74b24718a8fb29551e1c4a5" diff --git a/recipes/libgit2/0.27.x/conanfile.py b/recipes/libgit2/0.27.x/conanfile.py deleted file mode 100644 index 07e2765904500..0000000000000 --- a/recipes/libgit2/0.27.x/conanfile.py +++ /dev/null @@ -1,156 +0,0 @@ -from conan.tools.microsoft import is_msvc, is_msvc_static_runtime -from conans import ConanFile, tools, CMake -from conans.errors import ConanInvalidConfiguration -import functools -import os - -required_conan_version = ">=1.45.0" - - -class LibGit2Conan(ConanFile): - name = "libgit2" - description = ( - "libgit2 is a portable, pure C implementation of the Git core methods " - "provided as a re-entrant linkable library with a solid API" - ) - topics = ("libgit2", "git", "scm") - url = "https://github.com/conan-io/conan-center-index" - homepage = "https://libgit2.org/" - license = "GPL-2.0-linking-exception" - - settings = "os", "arch", "compiler", "build_type" - options = { - "shared": [True, False], - "fPIC": [True, False], - "threadsafe": [True, False], - "with_iconv": [True, False], - "with_libssh2": [True, False], - "with_https": [False, "openssl", "winhttp", "security"], - "with_sha1": ["collisiondetection", "commoncrypto", "openssl", "generic", "win32"], - } - default_options = { - "shared": False, - "fPIC": True, - "threadsafe": True, - "with_iconv": False, - "with_libssh2": True, - "with_https": "openssl", - "with_sha1": "collisiondetection", - } - - 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 - - if not tools.is_apple_os(self.settings.os): - del self.options.with_iconv - - def configure(self): - if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx - - @property - def _need_openssl(self): - return "openssl" in (self.options.with_https, self.options.with_sha1) - - def requirements(self): - self.requires("zlib/1.2.12") - self.requires("http_parser/2.9.4") - if self.options.with_libssh2: - self.requires("libssh2/1.10.0") - if self.settings.os != "Windows": - self.requires("libcurl/7.83.1") - if self._need_openssl: - self.requires("openssl/1.1.1o") - - def validate(self): - if self.options.with_https == "security": - if not tools.is_apple_os(self.settings.os): - raise ConanInvalidConfiguration("security is only valid for Apple products") - elif self.options.with_https == "winhttp": - if self.settings.os != "Windows": - raise ConanInvalidConfiguration("winhttp is only valid on Windows") - - if self.options.with_sha1 == "win32": - if self.settings.os != "Windows": - raise ConanInvalidConfiguration("win32 is only valid on Windows") - - def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - _cmake_https = { - "openssl": "OpenSSL", - "winhttp": "WinHTTP", - "security": "SecureTransport", - False: "OFF", - } - - _cmake_sha1 = { - "collisiondetection": "CollisionDetection", - "commoncrypto": "CommonCrypto", - "openssl": "OpenSSL", - "generic": "Generic", - "win32": "Win32", - } - - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["THREADSAFE"] = self.options.threadsafe - cmake.definitions["USE_SSH"] = self.options.with_libssh2 - - cmake.definitions["USE_ICONV"] = self.options.get_safe("with_iconv", False) - - cmake.definitions["USE_HTTPS"] = self._cmake_https[str(self.options.with_https)] - cmake.definitions["SHA1_BACKEND"] = self._cmake_sha1[str(self.options.with_sha1)] - - cmake.definitions["BUILD_CLAR"] = False - cmake.definitions["BUILD_EXAMPLES"] = False - - if is_msvc(self): - cmake.definitions["STATIC_CRT"] = is_msvc_static_runtime(self) - - cmake.configure() - return cmake - - def _patch_sources(self): - tools.replace_in_file(os.path.join(self._source_subfolder, "src", "CMakeLists.txt"), - "FIND_PKGLIBRARIES(LIBSSH2 libssh2)", - "FIND_PACKAGE(Libssh2 REQUIRED)\n" - "\tSET(LIBSSH2_FOUND ON)\n" - "\tSET(LIBSSH2_INCLUDE_DIRS ${Libssh2_INCLUDE_DIRS})\n" - "\tSET(LIBSSH2_LIBRARIES ${Libssh2_LIBRARIES})\n" - "\tSET(LIBSSH2_LIBRARY_DIRS ${Libssh2_LIB_DIRS})") - - tools.replace_in_file(os.path.join(self._source_subfolder, "src", "CMakeLists.txt"), - "FIND_PKGLIBRARIES(CURL libcurl)", - "FIND_PACKAGE(CURL REQUIRED)\n") - - def build(self): - self._patch_sources() - cmake = self._configure_cmake() - cmake.build() - - def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() - cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - - def package_info(self): - self.cpp_info.set_property("pkg_config_name", "libgit2") - self.cpp_info.libs = ["git2"] - if self.settings.os == "Windows": - self.cpp_info.system_libs.extend(["winhttp", "rpcrt4", "crypt32"]) - if self.settings.os in ["Linux", "FreeBSD"] and self.options.threadsafe: - self.cpp_info.system_libs.append("pthread") diff --git a/recipes/libgit2/0.27.x/test_package/CMakeLists.txt b/recipes/libgit2/0.27.x/test_package/CMakeLists.txt deleted file mode 100644 index 912bdc647f324..0000000000000 --- a/recipes/libgit2/0.27.x/test_package/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(libgit2 REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} libgit2::libgit2) diff --git a/recipes/libgit2/0.27.x/test_package/test_package.c b/recipes/libgit2/0.27.x/test_package/test_package.c deleted file mode 100644 index 1ea125101cdc8..0000000000000 --- a/recipes/libgit2/0.27.x/test_package/test_package.c +++ /dev/null @@ -1,34 +0,0 @@ -#include - -#include - -int main() -{ - git_libgit2_init(); - int versionMajor, versionMinor, versionRev; - git_libgit2_version(&versionMajor, &versionMinor, &versionRev); - - printf("libgit2 v%i.%i.%i\n", versionMajor, versionMinor, versionRev); - - printf("Compile Features:\n"); - - int features = git_libgit2_features(); - - if (features & GIT_FEATURE_THREADS) - printf(" - Thread safe\n"); - else - printf(" - Single thread only\n"); - - if (features & GIT_FEATURE_HTTPS) - printf(" - TLS (openssl, winhttp or security)\n"); - else - printf(" - No TLS\n"); - - if (features & GIT_FEATURE_SSH) - printf(" - SSH (libssh2)\n"); - else - printf(" - No SSH support\n"); - - git_libgit2_shutdown(); - return 0; -} diff --git a/recipes/libgit2/0.28.x/CMakeLists.txt b/recipes/libgit2/0.28.x/CMakeLists.txt deleted file mode 100644 index c502da172e7b8..0000000000000 --- a/recipes/libgit2/0.28.x/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper C) - -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory(source_subfolder) diff --git a/recipes/libgit2/0.28.x/conandata.yml b/recipes/libgit2/0.28.x/conandata.yml deleted file mode 100644 index 25994eed756a3..0000000000000 --- a/recipes/libgit2/0.28.x/conandata.yml +++ /dev/null @@ -1,4 +0,0 @@ -sources: - "0.28.5": - url: "https://github.com/libgit2/libgit2/archive/v0.28.5.tar.gz" - sha256: "2b7b68aee6f123bc84cc502a9c12738435b8054e7d628962e091cd2a25be4f42" diff --git a/recipes/libgit2/0.28.x/conanfile.py b/recipes/libgit2/0.28.x/conanfile.py deleted file mode 100644 index 7e3da960a3cb2..0000000000000 --- a/recipes/libgit2/0.28.x/conanfile.py +++ /dev/null @@ -1,160 +0,0 @@ -from conan.tools.microsoft import is_msvc, is_msvc_static_runtime -from conans import ConanFile, tools, CMake -from conans.errors import ConanInvalidConfiguration -import functools -import os - -required_conan_version = ">=1.45.0" - - -class LibGit2Conan(ConanFile): - name = "libgit2" - description = ( - "libgit2 is a portable, pure C implementation of the Git core methods " - "provided as a re-entrant linkable library with a solid API" - ) - topics = ("libgit2", "git", "scm") - url = "https://github.com/conan-io/conan-center-index" - homepage = "https://libgit2.org/" - license = "GPL-2.0-linking-exception" - - settings = "os", "arch", "compiler", "build_type" - options = { - "shared": [True, False], - "fPIC": [True, False], - "threadsafe": [True, False], - "with_iconv": [True, False], - "with_libssh2": [True, False], - "with_https": [False, "openssl", "mbedtls", "winhttp", "security"], - "with_sha1": ["collisiondetection", "commoncrypto", "openssl", "mbedtls", "generic", "win32"], - } - default_options = { - "shared": False, - "fPIC": True, - "threadsafe": True, - "with_iconv": False, - "with_libssh2": True, - "with_https": "openssl", - "with_sha1": "collisiondetection", - } - - 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 - - if not tools.is_apple_os(self.settings.os): - del self.options.with_iconv - - def configure(self): - if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx - - @property - def _need_openssl(self): - return "openssl" in (self.options.with_https, self.options.with_sha1) - - @property - def _need_mbedtls(self): - return "mbedtls" in (self.options.with_https, self.options.with_sha1) - - def requirements(self): - self.requires("zlib/1.2.12") - self.requires("http_parser/2.9.4") - if self.options.with_libssh2: - self.requires("libssh2/1.10.0") - if self._need_openssl: - self.requires("openssl/1.1.1o") - if self._need_mbedtls: - self.requires("mbedtls/3.1.0") - if tools.is_apple_os(self.settings.os) and self.options.with_iconv: - self.requires("libiconv/1.16") - - def validate(self): - if self.options.with_https == "security": - if not tools.is_apple_os(self.settings.os): - raise ConanInvalidConfiguration("security is only valid for Apple products") - elif self.options.with_https == "winhttp": - if self.settings.os != "Windows": - raise ConanInvalidConfiguration("winhttp is only valid on Windows") - - if self.options.with_sha1 == "win32": - if self.settings.os != "Windows": - raise ConanInvalidConfiguration("win32 is only valid on Windows") - - def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - _cmake_https = { - "openssl": "OpenSSL", - "winhttp": "WinHTTP", - "security": "SecureTransport", - "mbedtls": "mbedTLS", - False: "OFF", - } - - _cmake_sha1 = { - "collisiondetection": "CollisionDetection", - "commoncrypto": "CommonCrypto", - "openssl": "OpenSSL", - "mbedtls": "mbedTLS", - "generic": "Generic", - "win32": "Win32", - } - - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["THREADSAFE"] = self.options.threadsafe - cmake.definitions["USE_SSH"] = self.options.with_libssh2 - - cmake.definitions["USE_ICONV"] = self.options.get_safe("with_iconv", False) - - cmake.definitions["USE_HTTPS"] = self._cmake_https[str(self.options.with_https)] - cmake.definitions["SHA1_BACKEND"] = self._cmake_sha1[str(self.options.with_sha1)] - - cmake.definitions["BUILD_CLAR"] = False - cmake.definitions["BUILD_EXAMPLES"] = False - - if is_msvc(self): - cmake.definitions["STATIC_CRT"] = is_msvc_static_runtime(self) - - cmake.configure() - return cmake - - def _patch_sources(self): - tools.replace_in_file(os.path.join(self._source_subfolder, "src", "CMakeLists.txt"), - "FIND_PKGLIBRARIES(LIBSSH2 libssh2)", - "FIND_PACKAGE(Libssh2 REQUIRED)\n" - "\tSET(LIBSSH2_FOUND ON)\n" - "\tSET(LIBSSH2_INCLUDE_DIRS ${Libssh2_INCLUDE_DIRS})\n" - "\tSET(LIBSSH2_LIBRARIES ${Libssh2_LIBRARIES})\n" - "\tSET(LIBSSH2_LIBRARY_DIRS ${Libssh2_LIB_DIRS})") - - def build(self): - self._patch_sources() - cmake = self._configure_cmake() - cmake.build() - - def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() - cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - - def package_info(self): - self.cpp_info.set_property("pkg_config_name", "libgit2") - self.cpp_info.libs = ["git2"] - if self.settings.os == "Windows": - self.cpp_info.system_libs.extend(["winhttp", "rpcrt4", "crypt32"]) - if self.settings.os in ["Linux", "FreeBSD"] and self.options.threadsafe: - self.cpp_info.system_libs.append("pthread") diff --git a/recipes/libgit2/0.28.x/test_package/CMakeLists.txt b/recipes/libgit2/0.28.x/test_package/CMakeLists.txt deleted file mode 100644 index 912bdc647f324..0000000000000 --- a/recipes/libgit2/0.28.x/test_package/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(libgit2 REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} libgit2::libgit2) diff --git a/recipes/libgit2/0.28.x/test_package/test_package.c b/recipes/libgit2/0.28.x/test_package/test_package.c deleted file mode 100644 index 96e8eda89c73b..0000000000000 --- a/recipes/libgit2/0.28.x/test_package/test_package.c +++ /dev/null @@ -1,34 +0,0 @@ -#include - -#include - -int main() -{ - git_libgit2_init(); - int versionMajor, versionMinor, versionRev; - git_libgit2_version(&versionMajor, &versionMinor, &versionRev); - - printf("libgit2 v%i.%i.%i\n", versionMajor, versionMinor, versionRev); - - printf("Compile Features:\n"); - - int features = git_libgit2_features(); - - if (features & GIT_FEATURE_THREADS) - printf(" - Thread safe\n"); - else - printf(" - Single thread only\n"); - - if (features & GIT_FEATURE_HTTPS) - printf(" - TLS (openssl, mbedtls, winhttp or security)\n"); - else - printf(" - No TLS\n"); - - if (features & GIT_FEATURE_SSH) - printf(" - SSH (libssh2)\n"); - else - printf(" - No SSH support\n"); - - git_libgit2_shutdown(); - return 0; -} diff --git a/recipes/libgit2/all/CMakeLists.txt b/recipes/libgit2/all/CMakeLists.txt deleted file mode 100644 index c502da172e7b8..0000000000000 --- a/recipes/libgit2/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper C) - -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory(source_subfolder) diff --git a/recipes/libgit2/all/conandata.yml b/recipes/libgit2/all/conandata.yml index 7725b775b39de..966e9ed4a24c0 100644 --- a/recipes/libgit2/all/conandata.yml +++ b/recipes/libgit2/all/conandata.yml @@ -1,4 +1,19 @@ sources: + "1.8.4": + url: "https://github.com/libgit2/libgit2/archive/v1.8.4.tar.gz" + sha256: "49d0fc50ab931816f6bfc1ac68f8d74b760450eebdb5374e803ee36550f26774" + "1.8.3": + url: "https://github.com/libgit2/libgit2/archive/v1.8.3.tar.gz" + sha256: "868810a5508d41dd7033d41bdc55312561f3f916d64f5b7be92bc1ff4dcae02a" + "1.8.2": + url: "https://github.com/libgit2/libgit2/archive/v1.8.2.tar.gz" + sha256: "184699f0d9773f96eeeb5cb245ba2304400f5b74671f313240410f594c566a28" + "1.8.1": + url: "https://github.com/libgit2/libgit2/archive/v1.8.1.tar.gz" + sha256: "8c1eaf0cf07cba0e9021920bfba9502140220786ed5d8a8ec6c7ad9174522f8e" + "1.7.2": + url: "https://github.com/libgit2/libgit2/archive/v1.7.2.tar.gz" + sha256: "de384e29d7efc9330c6cdb126ebf88342b5025d920dcb7c645defad85195ea7f" "1.5.0": url: "https://github.com/libgit2/libgit2/archive/v1.5.0.tar.gz" sha256: "8de872a0f201b33d9522b817c92e14edb4efad18dae95cf156cf240b2efff93e" @@ -18,21 +33,47 @@ sources: url: "https://github.com/libgit2/libgit2/archive/v1.0.1.tar.gz" sha256: "1775427a6098f441ddbaa5bd4e9b8a043c7401e450ed761e69a415530fea81d2" patches: + "1.8.4": + - patch_file: "patches/1.8.1-0001-fix-cmake.patch" + patch_description: "use cci's packages" + patch_type: "conan" + "1.8.3": + - patch_file: "patches/1.8.1-0001-fix-cmake.patch" + patch_description: "use cci's packages" + patch_type: "conan" + "1.8.2": + - patch_file: "patches/1.8.1-0001-fix-cmake.patch" + patch_description: "use cci's packages" + patch_type: "conan" + "1.8.1": + - patch_file: "patches/1.8.1-0001-fix-cmake.patch" + patch_description: "use cci's packages" + patch_type: "conan" + "1.7.2": + - patch_file: "patches/1.7.2-0001-fix-cmake.patch" + patch_description: "use cci's packages" + patch_type: "conan" "1.5.0": - patch_file: "patches/1.4.3-0001-fix-cmake.patch" - base_path: "source_subfolder" + patch_description: "use cci's packages" + patch_type: "conan" "1.4.3": - patch_file: "patches/1.4.3-0001-fix-cmake.patch" - base_path: "source_subfolder" + patch_description: "use cci's packages" + patch_type: "conan" "1.3.0": - patch_file: "patches/1.3.0-0001-fix-cmake.patch" - base_path: "source_subfolder" + patch_description: "use cci's packages" + patch_type: "conan" "1.2.0": - patch_file: "patches/1.2.0-0001-fix-cmake.patch" - base_path: "source_subfolder" + patch_description: "use cci's packages" + patch_type: "conan" "1.1.1": - patch_file: "patches/1.1.1-0001-fix-cmake.patch" - base_path: "source_subfolder" + patch_description: "use cci's packages" + patch_type: "conan" "1.0.1": - patch_file: "patches/1.0.1-0001-fix-cmake.patch" - base_path: "source_subfolder" + patch_description: "use cci's packages" + patch_type: "conan" diff --git a/recipes/libgit2/all/conanfile.py b/recipes/libgit2/all/conanfile.py index c042b13f51df6..ac07d7f6dac70 100644 --- a/recipes/libgit2/all/conanfile.py +++ b/recipes/libgit2/all/conanfile.py @@ -1,10 +1,14 @@ -from conan.tools.microsoft import is_msvc, is_msvc_static_runtime -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.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.apple import is_apple_os import os -required_conan_version = ">=1.45.0" + +required_conan_version = ">=1.53.0" class LibGit2Conan(ConanFile): @@ -13,11 +17,11 @@ class LibGit2Conan(ConanFile): "libgit2 is a portable, pure C implementation of the Git core methods " "provided as a re-entrant linkable library with a solid API" ) - topics = ("libgit2", "git", "scm") + license = "GPL-2.0-linking-exception" url = "https://github.com/conan-io/conan-center-index" homepage = "https://libgit2.org/" - license = "GPL-2.0-linking-exception" - + topics = ("git", "scm") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -29,6 +33,7 @@ class LibGit2Conan(ConanFile): "with_sha1": ["collisiondetection", "commoncrypto", "openssl", "mbedtls", "generic", "win32"], "with_ntlmclient": [True, False], "with_regex": ["builtin", "pcre", "pcre2", "regcomp_l", "regcomp"], + "with_http_parser": ["http-parser", "llhttp"], } default_options = { "shared": False, @@ -40,23 +45,17 @@ class LibGit2Conan(ConanFile): "with_sha1": "collisiondetection", "with_ntlmclient": True, "with_regex": "builtin", + "with_http_parser": "http-parser", } - 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": del self.options.fPIC - if not tools.is_apple_os(self.settings.os): + if not is_apple_os(self): del self.options.with_iconv if self.settings.os == "Windows": @@ -65,27 +64,38 @@ def config_options(self): if self.settings.os == "Macos": self.options.with_regex = "regcomp_l" + # < 1.8.1 requries http_parser only. + if Version(self.version) < "1.8.1": + del self.options.with_http_parser + 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("http_parser/2.9.4") + self.requires("zlib/[>=1.2.11 <2]") + if Version(self.version) < "1.8.1" or self.options.get_safe("with_http_parser") == "http-parser": + self.requires("http_parser/2.9.4") + else: + self.requires("llhttp/9.1.3") + if self.options.with_libssh2: - self.requires("libssh2/1.10.0") + self.requires("libssh2/1.11.0") if self._need_openssl: - self.requires("openssl/1.1.1o") + self.requires("openssl/[>=1.1 <4]") if self._need_mbedtls: - self.requires("mbedtls/3.1.0") + self.requires("mbedtls/3.2.1") if self.options.get_safe("with_iconv"): - self.requires("libiconv/1.16") + self.requires("libiconv/1.17") if self.options.with_regex == "pcre": self.requires("pcre/8.45") elif self.options.with_regex == "pcre2": - self.requires("pcre2/10.40") + self.requires("pcre2/10.42") @property def _need_openssl(self): @@ -97,7 +107,7 @@ def _need_mbedtls(self): def validate(self): if self.options.with_https == "security": - if not tools.is_apple_os(self.settings.os): + if not is_apple_os(self): raise ConanInvalidConfiguration("security is only valid for Apple products") elif self.options.with_https == "winhttp": if self.settings.os != "Windows": @@ -108,22 +118,21 @@ def validate(self): raise ConanInvalidConfiguration("win32 is only valid on Windows") if self.options.with_regex == "regcomp" or self.options.with_regex == "regcomp_l": - if self.settings.compiler == "Visual Studio": + if is_msvc(self): raise ConanInvalidConfiguration("{} isn't supported by Visual Studio".format(self.options.with_regex)) if self.settings.os in ["iOS", "tvOS", "watchOS"] and self.options.with_regex == "regcomp_l": raise ConanInvalidConfiguration("regcomp_l isn't supported on {}".format(self.settings.os)) 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) _cmake_https = { "openssl": "OpenSSL", "winhttp": "WinHTTP", "security": "SecureTransport", "mbedtls": "mbedTLS", - False: "OFF", + "False": "OFF", } _cmake_sha1 = { @@ -133,49 +142,57 @@ def source(self): "mbedtls": "mbedTLS", "generic": "Generic", "win32": "Win32", + "False": "OFF", } - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["THREADSAFE"] = self.options.threadsafe - cmake.definitions["USE_SSH"] = self.options.with_libssh2 - - cmake.definitions["USE_ICONV"] = self.options.get_safe("with_iconv", False) - - cmake.definitions["USE_HTTPS"] = self._cmake_https[str(self.options.with_https)] - cmake.definitions["USE_SHA1"] = self._cmake_sha1[str(self.options.with_sha1)] - - if tools.Version(self.version) >= "1.4.0": - cmake.definitions["BUILD_TESTS"] = False - cmake.definitions["BUILD_CLAR"] = False - cmake.definitions["BUILD_EXAMPLES"] = False - cmake.definitions["USE_HTTP_PARSER"] = "system" - - cmake.definitions["REGEX_BACKEND"] = self.options.with_regex - + def generate(self): + tc = CMakeToolchain(self) + tc.variables["THREADSAFE"] = self.options.threadsafe + if Version(self.version) < "1.8.1": + tc.variables["USE_SSH"] = self.options.with_libssh2 + else: + tc.variables["USE_SSH"] = "libssh2" if self.options.with_libssh2 else False + tc.variables["USE_ICONV"] = self.options.get_safe("with_iconv", False) + tc.variables["USE_HTTPS"] = self._cmake_https[str(self.options.with_https)] + tc.variables["USE_SHA1"] = self._cmake_sha1[str(self.options.with_sha1)] + if Version(self.version) >= "1.4.0": + tc.variables["BUILD_TESTS"] = False + tc.variables["BUILD_CLAR"] = False + tc.variables["BUILD_CLI"] = False + tc.variables["BUILD_EXAMPLES"] = False + if Version(self.version) < "1.8.1": + tc.variables["USE_HTTP_PARSER"] = "system" + else: + tc.variables["USE_HTTP_PARSER"] = self.options.get_safe("with_http_parser") + tc.variables["REGEX_BACKEND"] = self.options.with_regex if is_msvc(self): - cmake.definitions["STATIC_CRT"] = is_msvc_static_runtime(self) - - cmake.configure() - return cmake + tc.variables["STATIC_CRT"] = is_msvc_static_runtime(self) + # REGEX_BACKEND is SET(), avoid options overriding it + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() + deps = CMakeDeps(self) + if self.options.get_safe("with_http_parser") == "llhttp": + deps.set_property("llhttp", "cmake_file_name", "LLHTTP") + 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") - 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", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): self.cpp_info.set_property("pkg_config_name", "libgit2") self.cpp_info.libs = ["git2"] if self.settings.os == "Windows": self.cpp_info.system_libs.extend(["winhttp", "rpcrt4", "crypt32"]) + if Version(self.version) >= "1.7.0": + self.cpp_info.system_libs.append("secur32") if self.settings.os in ["Linux", "FreeBSD"] and self.options.threadsafe: self.cpp_info.system_libs.append("pthread") diff --git a/recipes/libgit2/all/patches/1.0.1-0001-fix-cmake.patch b/recipes/libgit2/all/patches/1.0.1-0001-fix-cmake.patch index 2f0d05b998d5d..3c23186ba4771 100644 --- a/recipes/libgit2/all/patches/1.0.1-0001-fix-cmake.patch +++ b/recipes/libgit2/all/patches/1.0.1-0001-fix-cmake.patch @@ -1,5 +1,19 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 8264158..374a21c 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -11,8 +11,8 @@ + # Install: + # > cmake --build . --target install + +-PROJECT(libgit2 C) + CMAKE_MINIMUM_REQUIRED(VERSION 3.5.1) ++PROJECT(libgit2 C) + CMAKE_POLICY(SET CMP0015 NEW) + IF(POLICY CMP0051) + CMAKE_POLICY(SET CMP0051 NEW) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index dff1d94..abd9c45 100644 +index dff1d94..25652b7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -158,11 +158,11 @@ ENDIF() @@ -31,3 +45,15 @@ index dff1d94..abd9c45 100644 ENDIF() IF (LIBSSH2_FOUND) SET(GIT_SSH 1) +@@ -209,10 +213,7 @@ IF (LIBSSH2_FOUND) + LIST(APPEND LIBGIT2_LIBS ${LIBSSH2_LIBRARIES}) + LIST(APPEND LIBGIT2_PC_LIBS ${LIBSSH2_LDFLAGS}) + +- CHECK_LIBRARY_EXISTS("${LIBSSH2_LIBRARIES}" libssh2_userauth_publickey_frommemory "${LIBSSH2_LIBRARY_DIRS}" HAVE_LIBSSH2_MEMORY_CREDENTIALS) +- IF (HAVE_LIBSSH2_MEMORY_CREDENTIALS) +- SET(GIT_SSH_MEMORY_CREDENTIALS 1) +- ENDIF() ++ SET(GIT_SSH_MEMORY_CREDENTIALS 1) + ELSE() + MESSAGE(STATUS "LIBSSH2 not found. Set CMAKE_PREFIX_PATH if it is installed outside of the default search path.") + ENDIF() diff --git a/recipes/libgit2/all/patches/1.1.1-0001-fix-cmake.patch b/recipes/libgit2/all/patches/1.1.1-0001-fix-cmake.patch index 5dc56b1a31b92..3abde1ad5528a 100644 --- a/recipes/libgit2/all/patches/1.1.1-0001-fix-cmake.patch +++ b/recipes/libgit2/all/patches/1.1.1-0001-fix-cmake.patch @@ -1,5 +1,5 @@ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index d01cc64..0941cbd 100644 +index d01cc64..5691f7e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -167,11 +167,11 @@ ENDIF() @@ -31,3 +31,15 @@ index d01cc64..0941cbd 100644 ENDIF() IF (LIBSSH2_FOUND) SET(GIT_SSH 1) +@@ -218,10 +222,7 @@ IF (LIBSSH2_FOUND) + LIST(APPEND LIBGIT2_LIBS ${LIBSSH2_LIBRARIES}) + LIST(APPEND LIBGIT2_PC_LIBS ${LIBSSH2_LDFLAGS}) + +- CHECK_LIBRARY_EXISTS("${LIBSSH2_LIBRARIES}" libssh2_userauth_publickey_frommemory "${LIBSSH2_LIBRARY_DIRS}" HAVE_LIBSSH2_MEMORY_CREDENTIALS) +- IF (HAVE_LIBSSH2_MEMORY_CREDENTIALS) +- SET(GIT_SSH_MEMORY_CREDENTIALS 1) +- ENDIF() ++ SET(GIT_SSH_MEMORY_CREDENTIALS 1) + ELSE() + MESSAGE(STATUS "LIBSSH2 not found. Set CMAKE_PREFIX_PATH if it is installed outside of the default search path.") + ENDIF() diff --git a/recipes/libgit2/all/patches/1.2.0-0001-fix-cmake.patch b/recipes/libgit2/all/patches/1.2.0-0001-fix-cmake.patch index 0fbbd568d7b10..950bd6ff11e0a 100644 --- a/recipes/libgit2/all/patches/1.2.0-0001-fix-cmake.patch +++ b/recipes/libgit2/all/patches/1.2.0-0001-fix-cmake.patch @@ -1,5 +1,5 @@ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 45dec27..783c657 100644 +index 45dec27..d7652f7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -178,11 +178,11 @@ ENDIF() @@ -31,3 +31,15 @@ index 45dec27..783c657 100644 ENDIF() IF (LIBSSH2_FOUND) SET(GIT_SSH 1) +@@ -239,10 +243,7 @@ IF (LIBSSH2_FOUND) + LIST(APPEND LIBGIT2_LIBS ${LIBSSH2_LIBRARIES}) + LIST(APPEND LIBGIT2_PC_LIBS ${LIBSSH2_LDFLAGS}) + +- CHECK_LIBRARY_EXISTS("${LIBSSH2_LIBRARIES}" libssh2_userauth_publickey_frommemory "${LIBSSH2_LIBRARY_DIRS}" HAVE_LIBSSH2_MEMORY_CREDENTIALS) +- IF (HAVE_LIBSSH2_MEMORY_CREDENTIALS) +- SET(GIT_SSH_MEMORY_CREDENTIALS 1) +- ENDIF() ++ SET(GIT_SSH_MEMORY_CREDENTIALS 1) + ELSE() + MESSAGE(STATUS "LIBSSH2 not found. Set CMAKE_PREFIX_PATH if it is installed outside of the default search path.") + ENDIF() diff --git a/recipes/libgit2/all/patches/1.3.0-0001-fix-cmake.patch b/recipes/libgit2/all/patches/1.3.0-0001-fix-cmake.patch index 997b6dd7759b0..34d77da78eff1 100644 --- a/recipes/libgit2/all/patches/1.3.0-0001-fix-cmake.patch +++ b/recipes/libgit2/all/patches/1.3.0-0001-fix-cmake.patch @@ -1,5 +1,5 @@ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index fdb3673..783c657 100644 +index fdb3673..d7652f7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -178,11 +178,11 @@ ENDIF() @@ -38,3 +38,15 @@ index fdb3673..783c657 100644 ENDIF() IF (LIBSSH2_FOUND) SET(GIT_SSH 1) +@@ -246,10 +243,7 @@ IF (LIBSSH2_FOUND) + LIST(APPEND LIBGIT2_LIBS ${LIBSSH2_LIBRARIES}) + LIST(APPEND LIBGIT2_PC_LIBS ${LIBSSH2_LDFLAGS}) + +- CHECK_LIBRARY_EXISTS("${LIBSSH2_LIBRARIES}" libssh2_userauth_publickey_frommemory "${LIBSSH2_LIBRARY_DIRS}" HAVE_LIBSSH2_MEMORY_CREDENTIALS) +- IF (HAVE_LIBSSH2_MEMORY_CREDENTIALS) +- SET(GIT_SSH_MEMORY_CREDENTIALS 1) +- ENDIF() ++ SET(GIT_SSH_MEMORY_CREDENTIALS 1) + ELSE() + MESSAGE(STATUS "LIBSSH2 not found. Set CMAKE_PREFIX_PATH if it is installed outside of the default search path.") + ENDIF() diff --git a/recipes/libgit2/all/patches/1.4.3-0001-fix-cmake.patch b/recipes/libgit2/all/patches/1.4.3-0001-fix-cmake.patch index 459414c1a9584..66a17f3f7e869 100644 --- a/recipes/libgit2/all/patches/1.4.3-0001-fix-cmake.patch +++ b/recipes/libgit2/all/patches/1.4.3-0001-fix-cmake.patch @@ -18,7 +18,7 @@ index 955aea3..ff94eb8 100644 add_feature_info(http-parser ON "http-parser support (system)") else() diff --git a/cmake/SelectSSH.cmake b/cmake/SelectSSH.cmake -index 23dfc97..a094cc7 100644 +index 23dfc97..386f184 100644 --- a/cmake/SelectSSH.cmake +++ b/cmake/SelectSSH.cmake @@ -1,13 +1,10 @@ @@ -40,3 +40,15 @@ index 23dfc97..a094cc7 100644 if(NOT LIBSSH2_FOUND) message(FATAL_ERROR "LIBSSH2 not found. Set CMAKE_PREFIX_PATH if it is installed outside of the default search path.") +@@ -20,10 +17,7 @@ if(LIBSSH2_FOUND) + list(APPEND LIBGIT2_SYSTEM_LIBS ${LIBSSH2_LIBRARIES}) + list(APPEND LIBGIT2_PC_LIBS ${LIBSSH2_LDFLAGS}) + +- check_library_exists("${LIBSSH2_LIBRARIES}" libssh2_userauth_publickey_frommemory "${LIBSSH2_LIBRARY_DIRS}" HAVE_LIBSSH2_MEMORY_CREDENTIALS) +- if(HAVE_LIBSSH2_MEMORY_CREDENTIALS) +- set(GIT_SSH_MEMORY_CREDENTIALS 1) +- endif() ++ set(GIT_SSH_MEMORY_CREDENTIALS 1) + else() + message(STATUS "LIBSSH2 not found. Set CMAKE_PREFIX_PATH if it is installed outside of the default search path.") + endif() diff --git a/recipes/libgit2/all/patches/1.7.2-0001-fix-cmake.patch b/recipes/libgit2/all/patches/1.7.2-0001-fix-cmake.patch new file mode 100644 index 0000000000000..8705249e1247a --- /dev/null +++ b/recipes/libgit2/all/patches/1.7.2-0001-fix-cmake.patch @@ -0,0 +1,70 @@ +diff --git a/cmake/SelectHTTPParser.cmake b/cmake/SelectHTTPParser.cmake +index 955aea3..ff94eb8 100644 +--- a/cmake/SelectHTTPParser.cmake ++++ b/cmake/SelectHTTPParser.cmake +@@ -1,10 +1,10 @@ + # Optional external dependency: http-parser + if(USE_HTTP_PARSER STREQUAL "system") +- find_package(HTTPParser) ++ find_package(http_parser) + +- if(HTTP_PARSER_FOUND AND HTTP_PARSER_VERSION_MAJOR EQUAL 2) +- list(APPEND LIBGIT2_SYSTEM_INCLUDES ${HTTP_PARSER_INCLUDE_DIRS}) +- list(APPEND LIBGIT2_SYSTEM_LIBS ${HTTP_PARSER_LIBRARIES}) ++ if(http_parser_FOUND) ++ list(APPEND LIBGIT2_SYSTEM_INCLUDES ${http_parser_INCLUDE_DIRS}) ++ list(APPEND LIBGIT2_SYSTEM_LIBS ${http_parser_LIBRARIES}) + list(APPEND LIBGIT2_PC_LIBS "-lhttp_parser") + add_feature_info(http-parser ON "http-parser support (system)") + else() +diff --git a/cmake/SelectHTTPSBackend.cmake b/cmake/SelectHTTPSBackend.cmake +index d149416..33473ee 100644 +--- a/cmake/SelectHTTPSBackend.cmake ++++ b/cmake/SelectHTTPSBackend.cmake +@@ -9,6 +9,11 @@ if(CMAKE_SYSTEM_NAME MATCHES "Darwin") + endif() + + if(USE_HTTPS) ++ if(WIN32) ++ list(APPEND LIBGIT2_SYSTEM_LIBS "secur32") ++ list(APPEND LIBGIT2_PC_LIBS "-lsecur32") ++ endif() ++ + # Auto-select TLS backend + sanitizebool(USE_HTTPS) + if(USE_HTTPS STREQUAL ON) +diff --git a/cmake/SelectSSH.cmake b/cmake/SelectSSH.cmake +index 23dfc97..386f184 100644 +--- a/cmake/SelectSSH.cmake ++++ b/cmake/SelectSSH.cmake +@@ -1,13 +1,10 @@ + # Optional external dependency: libssh2 + if(USE_SSH) +- find_pkglibraries(LIBSSH2 libssh2) +- if(NOT LIBSSH2_FOUND) +- find_package(LibSSH2) +- set(LIBSSH2_INCLUDE_DIRS ${LIBSSH2_INCLUDE_DIR}) +- get_filename_component(LIBSSH2_LIBRARY_DIRS "${LIBSSH2_LIBRARY}" DIRECTORY) +- set(LIBSSH2_LIBRARIES ${LIBSSH2_LIBRARY}) +- set(LIBSSH2_LDFLAGS "-lssh2") +- endif() ++ FIND_PACKAGE(Libssh2 REQUIRED) ++ SET(LIBSSH2_FOUND ON) ++ SET(LIBSSH2_INCLUDE_DIRS ${Libssh2_INCLUDE_DIRS}) ++ SET(LIBSSH2_LIBRARIES ${Libssh2_LIBRARIES}) ++ SET(LIBSSH2_LIBRARY_DIRS ${Libssh2_LIB_DIRS}) + + if(NOT LIBSSH2_FOUND) + message(FATAL_ERROR "LIBSSH2 not found. Set CMAKE_PREFIX_PATH if it is installed outside of the default search path.") +@@ -20,10 +17,7 @@ if(LIBSSH2_FOUND) + list(APPEND LIBGIT2_SYSTEM_LIBS ${LIBSSH2_LIBRARIES}) + list(APPEND LIBGIT2_PC_LIBS ${LIBSSH2_LDFLAGS}) + +- check_library_exists("${LIBSSH2_LIBRARIES}" libssh2_userauth_publickey_frommemory "${LIBSSH2_LIBRARY_DIRS}" HAVE_LIBSSH2_MEMORY_CREDENTIALS) +- if(HAVE_LIBSSH2_MEMORY_CREDENTIALS) +- set(GIT_SSH_MEMORY_CREDENTIALS 1) +- endif() ++ set(GIT_SSH_MEMORY_CREDENTIALS 1) + else() + message(STATUS "LIBSSH2 not found. Set CMAKE_PREFIX_PATH if it is installed outside of the default search path.") + endif() diff --git a/recipes/libgit2/all/patches/1.8.1-0001-fix-cmake.patch b/recipes/libgit2/all/patches/1.8.1-0001-fix-cmake.patch new file mode 100644 index 0000000000000..7515a48158c94 --- /dev/null +++ b/recipes/libgit2/all/patches/1.8.1-0001-fix-cmake.patch @@ -0,0 +1,72 @@ +diff --git a/cmake/SelectHTTPParser.cmake b/cmake/SelectHTTPParser.cmake +index 4fc1f69..1e8d83e 100644 +--- a/cmake/SelectHTTPParser.cmake ++++ b/cmake/SelectHTTPParser.cmake +@@ -1,10 +1,10 @@ + # Optional external dependency: http-parser + if(USE_HTTP_PARSER STREQUAL "http-parser") +- find_package(HTTPParser) ++ find_package(http_parser) + +- if(HTTP_PARSER_FOUND AND HTTP_PARSER_VERSION_MAJOR EQUAL 2) +- list(APPEND LIBGIT2_SYSTEM_INCLUDES ${HTTP_PARSER_INCLUDE_DIRS}) +- list(APPEND LIBGIT2_SYSTEM_LIBS ${HTTP_PARSER_LIBRARIES}) ++ if(http_parser_FOUND) ++ list(APPEND LIBGIT2_SYSTEM_INCLUDES ${http_parser_INCLUDE_DIRS}) ++ list(APPEND LIBGIT2_SYSTEM_LIBS ${http_parser_LIBRARIES}) + list(APPEND LIBGIT2_PC_LIBS "-lhttp_parser") + set(GIT_HTTPPARSER_HTTPPARSER 1) + add_feature_info(http-parser ON "using http-parser (system)") +diff --git a/cmake/SelectHTTPSBackend.cmake b/cmake/SelectHTTPSBackend.cmake +index d293001..acffba9 100644 +--- a/cmake/SelectHTTPSBackend.cmake ++++ b/cmake/SelectHTTPSBackend.cmake +@@ -9,6 +9,11 @@ if(CMAKE_SYSTEM_NAME MATCHES "Darwin") + endif() + + if(USE_HTTPS) ++ if(WIN32) ++ list(APPEND LIBGIT2_SYSTEM_LIBS "secur32") ++ list(APPEND LIBGIT2_PC_LIBS "-lsecur32") ++ endif() ++ + # Auto-select TLS backend + sanitizebool(USE_HTTPS) + if(USE_HTTPS STREQUAL ON) +diff --git a/cmake/SelectSSH.cmake b/cmake/SelectSSH.cmake +index 079857f..652b310 100644 +--- a/cmake/SelectSSH.cmake ++++ b/cmake/SelectSSH.cmake +@@ -4,15 +4,11 @@ if(USE_SSH STREQUAL "exec") + + add_feature_info(SSH ON "using OpenSSH exec support") + elseif(USE_SSH STREQUAL ON OR USE_SSH STREQUAL "libssh2") +- find_pkglibraries(LIBSSH2 libssh2) +- +- if(NOT LIBSSH2_FOUND) +- find_package(LibSSH2) +- set(LIBSSH2_INCLUDE_DIRS ${LIBSSH2_INCLUDE_DIR}) +- get_filename_component(LIBSSH2_LIBRARY_DIRS "${LIBSSH2_LIBRARY}" DIRECTORY) +- set(LIBSSH2_LIBRARIES ${LIBSSH2_LIBRARY}) +- set(LIBSSH2_LDFLAGS "-lssh2") +- endif() ++ FIND_PACKAGE(Libssh2 REQUIRED) ++ SET(LIBSSH2_FOUND ON) ++ SET(LIBSSH2_INCLUDE_DIRS ${Libssh2_INCLUDE_DIRS}) ++ SET(LIBSSH2_LIBRARIES ${Libssh2_LIBRARIES}) ++ SET(LIBSSH2_LIBRARY_DIRS ${Libssh2_LIB_DIRS}) + + if(NOT LIBSSH2_FOUND) + message(FATAL_ERROR "LIBSSH2 not found. Set CMAKE_PREFIX_PATH if it is installed outside of the default search path.") +@@ -22,10 +18,7 @@ elseif(USE_SSH STREQUAL ON OR USE_SSH STREQUAL "libssh2") + list(APPEND LIBGIT2_SYSTEM_LIBS ${LIBSSH2_LIBRARIES}) + list(APPEND LIBGIT2_PC_LIBS ${LIBSSH2_LDFLAGS}) + +- check_library_exists("${LIBSSH2_LIBRARIES}" libssh2_userauth_publickey_frommemory "${LIBSSH2_LIBRARY_DIRS}" HAVE_LIBSSH2_MEMORY_CREDENTIALS) +- if(HAVE_LIBSSH2_MEMORY_CREDENTIALS) +- set(GIT_SSH_LIBSSH2_MEMORY_CREDENTIALS 1) +- endif() ++ set(GIT_SSH_MEMORY_CREDENTIALS 1) + + if(WIN32 AND EMBED_SSH_PATH) + file(GLOB SSH_SRC "${EMBED_SSH_PATH}/src/*.c") diff --git a/recipes/libgit2/all/test_package/CMakeLists.txt b/recipes/libgit2/all/test_package/CMakeLists.txt index 912bdc647f324..b2c8aa0ca7f27 100644 --- a/recipes/libgit2/all/test_package/CMakeLists.txt +++ b/recipes/libgit2/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(libgit2 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} libgit2::libgit2) +target_link_libraries(${PROJECT_NAME} PRIVATE libgit2::libgit2) diff --git a/recipes/libgit2/all/test_package/conanfile.py b/recipes/libgit2/all/test_package/conanfile.py index 38f4483872d47..ef5d7042163ec 100644 --- a/recipes/libgit2/all/test_package/conanfile.py +++ b/recipes/libgit2/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libgit2/config.yml b/recipes/libgit2/config.yml index c472349adb3cc..1a78cc1abe633 100644 --- a/recipes/libgit2/config.yml +++ b/recipes/libgit2/config.yml @@ -1,4 +1,14 @@ versions: + "1.8.4": + folder: "all" + "1.8.3": + folder: "all" + "1.8.2": + folder: "all" + "1.8.1": + folder: "all" + "1.7.2": + folder: "all" "1.5.0": folder: "all" "1.4.3": @@ -11,7 +21,3 @@ versions: folder: "all" "1.0.1": folder: "all" - "0.28.5": - folder: "0.28.x" - "0.27.10": - folder: "0.27.x" diff --git a/recipes/libglvnd/all/conandata.yml b/recipes/libglvnd/all/conandata.yml index 930441157c427..8d9b790ae637c 100644 --- a/recipes/libglvnd/all/conandata.yml +++ b/recipes/libglvnd/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.7.0": + url: "https://gitlab.freedesktop.org/glvnd/libglvnd/-/archive/v1.7.0/libglvnd-v1.7.0.tar.gz" + sha256: "2b6e15b06aafb4c0b6e2348124808cbd9b291c647299eaaba2e3202f51ff2f3d" "1.5.0": url: "https://gitlab.freedesktop.org/glvnd/libglvnd/-/archive/v1.5.0/libglvnd-v1.5.0.tar.gz" sha256: "8c246d573bdaabbab32874befa79c8b92b12c05d3eb4bbefbe62afa630842793" diff --git a/recipes/libglvnd/all/conanfile.py b/recipes/libglvnd/all/conanfile.py index 7d1919c184d04..422acffdcd2c7 100644 --- a/recipes/libglvnd/all/conanfile.py +++ b/recipes/libglvnd/all/conanfile.py @@ -1,21 +1,24 @@ from conan import ConanFile -from conan.tools.meson import Meson, MesonToolchain -from conan.tools.files import get, rmdir, save from conan.errors import ConanInvalidConfiguration +from conan.tools.files import get, rmdir, save +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 import textwrap -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.64.0 <2 || >=2.2.0" class LibGlvndConan(ConanFile): name = "libglvnd" description = "The GL Vendor-Neutral Dispatch library" - license = "LicenseRef-LICENSE" + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://gitlab.freedesktop.org/glvnd/libglvnd" - topics = ("gl", "vendor-neutral", "dispatch") + topics = ("dispatch", "egl", "gl", "gles", "glx", "glvnd", "opengl", "vendor-neutral") settings = "os", "arch", "compiler", "build_type" + package_type = "shared-library" options = { "asm": [True, False], "x11": [True, False], @@ -41,21 +44,9 @@ class LibGlvndConan(ConanFile): "entrypoint_patching": True, } - generators = "PkgConfigDeps" - - # don't use self.settings_build - @property - def _settings_build(self): - return getattr(self, "settings_build", self.settings) - - # don't use self.user_info_build - @property - def _user_info_build(self): - return getattr(self, "user_info_build", self.deps_user_info) - 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 requirements(self): if self.options.x11: @@ -65,20 +56,25 @@ def requirements(self): def validate(self): if self.settings.os not in ['Linux', 'FreeBSD']: - raise ConanInvalidConfiguration("libglvnd is only compatible with Linux and FreeBSD") + raise ConanInvalidConfiguration(f"{self.name} is only compatible with Linux and FreeBSD") def build_requirements(self): - self.build_requires("meson/0.63.2") - self.build_requires("pkgconf/1.9.3") + self.tool_requires("meson/1.4.0") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/2.1.0") def layout(self): - basic_layout(self) + basic_layout(self, src_folder="src") def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): + virtual_build_env = VirtualBuildEnv(self) + virtual_build_env.generate() + pkg_config_deps = PkgConfigDeps(self) + pkg_config_deps.generate() tc = MesonToolchain(self) tc.project_options["asm"] = "enabled" if self.options.asm else "disabled" tc.project_options["x11"] = "enabled" if self.options.x11 else "disabled" @@ -91,6 +87,10 @@ def generate(self): tc.project_options["headers"] = self.options.headers tc.project_options["entrypoint-patching"] = "enabled" if self.options.entrypoint_patching else "disabled" tc.project_options["libdir"] = "lib" + # Configure the data directory so that it defaults to the correct location for ICD discovery on the local system. + tc.project_options["datadir"] = os.path.join("usr", "share") if self.settings.os == "Linux" else os.path.join("usr", "local", "share") + if self.settings.os == "FreeBSD": + tc.project_options["sysconfdir"] = os.path.join("usr", "local", "etc") tc.generate() def build(self): @@ -141,7 +141,9 @@ def package_info(self): if self.options.egl: self.cpp_info.components['egl'].libs = ["EGL"] self.cpp_info.components['egl'].system_libs.extend(["pthread", "dl", "m"]) - self.cpp_info.components['egl'].requires.extend(["xorg::x11", "gldispatch"]) + self.cpp_info.components['egl'].requires.append("gldispatch") + if self.options.x11: + self.cpp_info.components['egl'].requires.append("xorg::x11") self.cpp_info.components['egl'].set_property("pkg_config_name", "egl") if self.options.glx: diff --git a/recipes/libglvnd/all/test_package/CMakeLists.txt b/recipes/libglvnd/all/test_package/CMakeLists.txt index 34af13462f44f..60cf6714783e8 100644 --- a/recipes/libglvnd/all/test_package/CMakeLists.txt +++ b/recipes/libglvnd/all/test_package/CMakeLists.txt @@ -1,8 +1,9 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.15) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +project(test_package LANGUAGES C) + +find_package(libglvnd REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE libglvnd::libglvnd) + diff --git a/recipes/libglvnd/all/test_package/conanfile.py b/recipes/libglvnd/all/test_package/conanfile.py index 8b7f471a280d5..ef5d7042163ec 100644 --- a/recipes/libglvnd/all/test_package/conanfile.py +++ b/recipes/libglvnd/all/test_package/conanfile.py @@ -1,12 +1,19 @@ 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_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) @@ -14,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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libglvnd/config.yml b/recipes/libglvnd/config.yml index bd6887e2cfe66..3283e92e6372f 100644 --- a/recipes/libglvnd/config.yml +++ b/recipes/libglvnd/config.yml @@ -1,4 +1,6 @@ versions: + "1.7.0": + folder: "all" "1.5.0": folder: "all" "1.4.0": diff --git a/recipes/libgpg-error/all/conandata.yml b/recipes/libgpg-error/all/conandata.yml index 0de00e71015c7..c6271e8ce4d72 100644 --- a/recipes/libgpg-error/all/conandata.yml +++ b/recipes/libgpg-error/all/conandata.yml @@ -1,8 +1,10 @@ sources: + "1.47": + url: "https://www.gnupg.org/ftp/gcrypt/libgpg-error/libgpg-error-1.47.tar.gz" + sha256: "685d4bd9d05576c4fc7f0870903dfdfbe41f2dd6a12e76fd8bd1717278f6b365" "1.36": url: "https://www.gnupg.org/ftp/gcrypt/libgpg-error/libgpg-error-1.36.tar.gz" sha256: "493a3a5e0ac0eb4df8501039f351459d8901d213a834d8c5a453a8ed94858ba5" patches: "1.36": - patch_file: "patches/0001-gawk-namespace.patch" - base_path: "source_subfolder" diff --git a/recipes/libgpg-error/all/conanfile.py b/recipes/libgpg-error/all/conanfile.py index 4563b0659c508..2ed23af2c2e5b 100644 --- a/recipes/libgpg-error/all/conanfile.py +++ b/recipes/libgpg-error/all/conanfile.py @@ -1,8 +1,12 @@ +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.33.0" +required_conan_version = ">=1.57.0" + class GPGErrorConan(ConanFile): name = "libgpg-error" @@ -12,6 +16,7 @@ class GPGErrorConan(ConanFile): description = "Libgpg-error is a small library that originally defined common error values for all GnuPG " \ "components." license = "GPL-2.0-or-later" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -21,65 +26,55 @@ class GPGErrorConan(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): - 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 layout(self): + basic_layout(self, src_folder="src") def validate(self): if self.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], strip_root=True) - def _configure(self): - if self._autotools: - return self._autotools - host = None - args = ["--disable-dependency-tracking", - "--disable-nls", - "--disable-languages", - "--disable-doc", - "--disable-tests"] + def generate(self): + tc = AutotoolsToolchain(self) + tc.configure_args.extend([ + "--disable-dependency-tracking", + "--disable-nls", + "--disable-languages", + "--disable-doc", + "--disable-tests", + ]) 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"]) - if self.settings.os == "Linux" and self.settings.arch == "x86": - host = "i686-linux-gnu" - - self._autotools = AutoToolsBuildEnvironment(self) - self._autotools.configure(args=args, host=host, configure_dir=self._source_subfolder) - return self._autotools + tc.configure_args.append("--with-pic") + tc.generate() def build(self): - for patch in self.conan_data["patches"][self.version]: - tools.patch(**patch) - env_build = self._configure() - env_build.make() + apply_conandata_patches(self) + 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, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): + self.cpp_info.set_property("pkg_config_name", "gpg-error") self.cpp_info.libs = ["gpg-error"] - self.cpp_info.names["pkg_config"] = "gpg-error" if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["pthread"] diff --git a/recipes/libgpg-error/all/test_package/CMakeLists.txt b/recipes/libgpg-error/all/test_package/CMakeLists.txt index 7b9b613cbb24a..9b783d3fcee67 100644 --- a/recipes/libgpg-error/all/test_package/CMakeLists.txt +++ b/recipes/libgpg-error/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(libgpg-error REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE libgpg-error::libgpg-error) diff --git a/recipes/libgpg-error/all/test_package/conanfile.py b/recipes/libgpg-error/all/test_package/conanfile.py index ea57a464900be..0a6bc68712d90 100644 --- a/recipes/libgpg-error/all/test_package/conanfile.py +++ b/recipes/libgpg-error/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/libgpg-error/all/test_v1_package/CMakeLists.txt b/recipes/libgpg-error/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libgpg-error/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libgpg-error/all/test_v1_package/conanfile.py b/recipes/libgpg-error/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libgpg-error/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/libgpg-error/config.yml b/recipes/libgpg-error/config.yml index f10713a7746e2..be46539e39213 100644 --- a/recipes/libgpg-error/config.yml +++ b/recipes/libgpg-error/config.yml @@ -1,3 +1,5 @@ versions: + "1.47": + folder: all "1.36": folder: all diff --git a/recipes/libgphoto2/all/conandata.yml b/recipes/libgphoto2/all/conandata.yml index 3e782abceeccf..aa37e732ae2d3 100644 --- a/recipes/libgphoto2/all/conandata.yml +++ b/recipes/libgphoto2/all/conandata.yml @@ -1,8 +1,10 @@ sources: + "2.5.31": + url: "https://github.com/gphoto/libgphoto2/releases/download/v2.5.31/libgphoto2-2.5.31.tar.xz" + sha256: "8fc7bf40f979459509b87dd4ff1aae9b6c1c2b4724d37db576081eec15406ace" "2.5.27": url: "https://github.com/gphoto/libgphoto2/releases/download/v2.5.27/libgphoto2-2.5.27.tar.xz" sha256: "a7253bd18c6ef65352150ac36a668f883a5ad2634eb6455b3ca9aa6ac98d0073" patches: "2.5.27": - - patch_file: patches/macos_snprintf_patch.diff - base_path: source_subfolder + - patch_file: "patches/2.5.27-0001-macos_snprintf.patch" diff --git a/recipes/libgphoto2/all/conanfile.py b/recipes/libgphoto2/all/conanfile.py index 7ea125f2cf4d0..f6d84c552b0a4 100644 --- a/recipes/libgphoto2/all/conanfile.py +++ b/recipes/libgphoto2/all/conanfile.py @@ -1,9 +1,15 @@ -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.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, 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.33.0" +required_conan_version = ">=1.54.0" class LibGphoto2(ConanFile): @@ -13,11 +19,9 @@ class LibGphoto2(ConanFile): homepage = "http://www.gphoto.org/" license = "LGPL-2.1" topics = ("gphoto2", "libgphoto2", "libgphoto", "photo") - exports_sources = "patches/*" - settings = "os", "compiler", "build_type", "arch" + package_type = "shared-library" + settings = "os", "arch", "compiler", "build_type" options = { - "shared": [True, False], - "fPIC": [True, False], "with_libusb": [True, False], "with_libcurl": [True, False], "with_libxml2": [True, False], @@ -25,110 +29,103 @@ class LibGphoto2(ConanFile): "with_libjpeg": [True, False], } default_options = { - "shared": True, - "fPIC": True, "with_libusb": True, "with_libcurl": True, "with_libxml2": True, "with_libexif": True, "with_libjpeg": True, } - generators = "pkg_config" - _autotools = None @property - def _source_subfolder(self): - return "source_subfolder" + def _settings_build(self): + return getattr(self, "settings_build", self.settings) - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - - def validate(self): - if not self.options.shared: - raise ConanInvalidConfiguration("building libgphoto2 as a static library is not supported") - if self.settings.os == "Windows": - raise ConanInvalidConfiguration("libgphoto2 does not support Windows") - - @contextlib.contextmanager - def _build_context(self): - if self.settings.os == "Linux" and not self.options["libtool"].shared: - env = { - "LIBLTDL": "-lltdl -ldl", - } - with tools.environment_append(env): - yield - else: - yield + def export_sources(self): + 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.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") - def build_requirements(self): - self.build_requires("pkgconf/1.7.4") + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - self.requires("libtool/2.4.6") + self.requires("libtool/2.4.7") if self.options.with_libusb: self.requires("libusb/1.0.26") if self.options.with_libcurl: - self.requires("libcurl/7.83.1") + self.requires("libcurl/[>=7.78.0 <9]") if self.options.with_libxml2: - self.requires("libxml2/2.9.14") + self.requires("libxml2/[>=2.12.5 <3]") if self.options.with_libexif: - self.requires("libexif/0.6.23") + self.requires("libexif/0.6.24") if self.options.with_libjpeg: - self.requires("libjpeg/9d") + self.requires("libjpeg/9e") + + def validate(self): + if is_msvc(self): + raise ConanInvalidConfiguration("Visual Studio not supported yet") + + def build_requirements(self): + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/[>=2.2 <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) - - 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" + 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 = AutotoolsToolchain(self) auto_no = lambda v: "auto" if v else "no" - args = [ - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - "--with-libcurl={}".format(auto_no(self.options.with_libcurl)), - "--with-libexif={}".format(auto_no(self.options.with_libexif)), - "--with-libxml-2.0={}".format(auto_no(self.options.with_libxml2)), + tc.configure_args.extend([ + f"--with-libcurl={auto_no(self.options.with_libcurl)}", + f"--with-libexif={auto_no(self.options.with_libexif)}", + f"--with-libxml-2.0={auto_no(self.options.with_libxml2)}", "--disable-nls", - "--datadir={}".format(tools.unix_path(os.path.join(self.package_folder, "res"))), - "udevscriptdir={}".format(tools.unix_path(os.path.join(self.package_folder, "res"))), - "utilsdir={}".format(tools.unix_path(os.path.join(self.package_folder, "bin"))), - ] + "--datadir=${prefix}/res", + "udevscriptdir=${prefix}/res", + "utilsdir=${prefix}/bin", + ]) if not self.options.with_libjpeg: - args.append("--without-jpeg") - self._autotools.configure(args=args, configure_dir=self._source_subfolder) - return self._autotools + tc.configure_args.append("--without-jpeg") + tc.generate() + + deps = AutotoolsDeps(self) + deps.generate() + deps = PkgConfigDeps(self) + deps.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() - 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")) + 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"), recursive=True) + 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", "libgphoto2") self.cpp_info.libs = ["gphoto2", "gphoto2_port"] - self.cpp_info.names["pkg_config"] = "libgphoto2" + self.cpp_info.includedirs.append(os.path.join("include", "gphoto2")) + self.cpp_info.resdirs = ["res"] if self.settings.os == "Linux": self.cpp_info.system_libs = ["dl"] if self.settings.os in ("FreeBSD", "Linux"): self.cpp_info.system_libs = ["m"] - diff --git a/recipes/libgphoto2/all/patches/macos_snprintf_patch.diff b/recipes/libgphoto2/all/patches/2.5.27-0001-macos_snprintf.patch similarity index 100% rename from recipes/libgphoto2/all/patches/macos_snprintf_patch.diff rename to recipes/libgphoto2/all/patches/2.5.27-0001-macos_snprintf.patch diff --git a/recipes/libgphoto2/all/test_package/CMakeLists.txt b/recipes/libgphoto2/all/test_package/CMakeLists.txt index 45b8296270d6c..55da1ef125aa5 100644 --- a/recipes/libgphoto2/all/test_package/CMakeLists.txt +++ b/recipes/libgphoto2/all/test_package/CMakeLists.txt @@ -1,11 +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(libgphoto2 REQUIRED) +find_package(libgphoto2 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} libgphoto2::libgphoto2) - +target_link_libraries(${PROJECT_NAME} PRIVATE libgphoto2::libgphoto2) diff --git a/recipes/libgphoto2/all/test_package/conanfile.py b/recipes/libgphoto2/all/test_package/conanfile.py index 76403a7b181c1..0a6bc68712d90 100644 --- a/recipes/libgphoto2/all/test_package/conanfile.py +++ b/recipes/libgphoto2/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,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/libgphoto2/all/test_package/test_package.c b/recipes/libgphoto2/all/test_package/test_package.c index 8b5a94ec8ca77..bda4b5344b90c 100644 --- a/recipes/libgphoto2/all/test_package/test_package.c +++ b/recipes/libgphoto2/all/test_package/test_package.c @@ -1,5 +1,5 @@ -#include -#include +#include +#include int main() { GPContext* context; @@ -17,7 +17,7 @@ int main() { return 1; } int count = gp_abilities_list_count(list); - if (count == 0) { + if (count < 0) { return 1; } gp_camera_new(&camera); diff --git a/recipes/libgphoto2/all/test_v1_package/CMakeLists.txt b/recipes/libgphoto2/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libgphoto2/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libgphoto2/all/test_v1_package/conanfile.py b/recipes/libgphoto2/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libgphoto2/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/libgphoto2/config.yml b/recipes/libgphoto2/config.yml index 5139145403d46..90c8118874b7e 100644 --- a/recipes/libgphoto2/config.yml +++ b/recipes/libgphoto2/config.yml @@ -1,3 +1,5 @@ versions: + "2.5.31": + folder: all "2.5.27": folder: all diff --git a/recipes/libgpiod/all/conandata.yml b/recipes/libgpiod/all/conandata.yml index 851ae98da0f81..e57f9b7713c5f 100644 --- a/recipes/libgpiod/all/conandata.yml +++ b/recipes/libgpiod/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "2.1": + url: "https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/snapshot/libgpiod-2.1.tar.gz" + sha256: "fd6ed4b2c674fe6cc3b481880f6cde1eea79e296e95a139b85401eaaea6de3fc" + "2.0.1": + url: "https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/snapshot/libgpiod-2.0.1.tar.gz" + sha256: "b6eda55356160a8e73906e3d48e959ef81296787d764975b10f257e9660668e9" + "1.6.4": + url: "https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/snapshot/libgpiod-1.6.4.tar.gz" + sha256: "829d4ac268df07853609d67cfc7f476e9aa736cb2a68a630be99e8fad197be0a" "1.6.3": url: "https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/snapshot/libgpiod-1.6.3.tar.gz" sha256: "eb446070be1444fd7d32d32bbca53c2f3bbb0a21193db86198cf6050b7a28441" diff --git a/recipes/libgpiod/all/conanfile.py b/recipes/libgpiod/all/conanfile.py index 99787ae3af1c0..f35d2c80dd4b3 100644 --- a/recipes/libgpiod/all/conanfile.py +++ b/recipes/libgpiod/all/conanfile.py @@ -1,8 +1,12 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +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.errors import ConanInvalidConfiguration import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.57.0" + class LibgpiodConan(ConanFile): name = "libgpiod" @@ -10,7 +14,8 @@ class LibgpiodConan(ConanFile): homepage = "https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/" license = "LGPL-2.1-or-later" description = "C library and tools for interacting with the linux GPIO character device" - topics = ("gpio", "libgpiod", "libgpiodcxx", "linux") + topics = ("gpio", "libgpiodcxx", "linux") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -24,12 +29,6 @@ class LibgpiodConan(ConanFile): "enable_bindings_cxx": False, "enable_tools": False, } - - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" def validate(self): if self.settings.os != "Linux": @@ -37,51 +36,51 @@ def validate(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") if not self.options.enable_bindings_cxx: - 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 requirements(self): + self.requires("linux-headers-generic/6.5.9") def build_requirements(self): - self.build_requires("libtool/2.4.6") - self.build_requires("pkgconf/1.7.4") - self.build_requires("autoconf-archive/2021.02.19") - self.build_requires("linux-headers-generic/5.13.9") + self.build_requires("libtool/2.4.7") + self.build_requires("pkgconf/2.0.3") + self.build_requires("autoconf-archive/2022.09.03") 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_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self) + 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-bindings-cxx={}".format(yes_no(self.options.enable_bindings_cxx)), - "--enable-tools={}".format(yes_no(self.options.enable_tools)), - ] - self._autotools.configure(args=args, configure_dir=self._source_subfolder) - return self._autotools + tc.configure_args.append("--enable-bindings-cxx={}".format(yes_no(self.options.enable_bindings_cxx))) + tc.configure_args.append("--enable-tools={}".format(yes_no(self.options.enable_tools))) + tc.generate() + deps = AutotoolsDeps(self) + deps.generate() def build(self): - with tools.chdir(os.path.join(self._source_subfolder)): - self.run("{} -fiv".format(tools.get_env("AUTORECONF")), run_environment=True) - autotools = self._configure_autotools() + 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() - tools.remove_files_by_mask(self.package_folder, "*.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")) def package_info(self): self.cpp_info.components["gpiod"].libs = ["gpiod"] - self.cpp_info.components["gpiod"].names["pkg_config"] = "gpiod" + self.cpp_info.components["gpiod"].set_property("pkg_config_name", "libgpiod") if self.options.enable_bindings_cxx: self.cpp_info.components["gpiodcxx"].libs = ["gpiodcxx"] - self.cpp_info.components["gpiodcxx"].names["pkg_config"] = "gpiodcxx" + self.cpp_info.components["gpiodcxx"].set_property("pkg_config_name", "libgpiodcxx") self.cpp_info.components["gpiodcxx"].requires = ["gpiod"] diff --git a/recipes/libgpiod/all/test_package/CMakeLists.txt b/recipes/libgpiod/all/test_package/CMakeLists.txt index a5ffd526aaea7..fe28114b7fac7 100644 --- a/recipes/libgpiod/all/test_package/CMakeLists.txt +++ b/recipes/libgpiod/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ -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() +find_package(libgpiod REQUIRED CONFIG) add_executable(${CMAKE_PROJECT_NAME} test_package.c) -target_link_libraries(${CMAKE_PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${CMAKE_PROJECT_NAME} libgpiod::gpiod) diff --git a/recipes/libgpiod/all/test_package/conanfile.py b/recipes/libgpiod/all/test_package/conanfile.py index db57f3bb0d17f..2325fb400694e 100644 --- a/recipes/libgpiod/all/test_package/conanfile.py +++ b/recipes/libgpiod/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 import os required_conan_version = ">=1.33.0" 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 +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/libgpiod/all/test_package/test_package.c b/recipes/libgpiod/all/test_package/test_package.c index 686dc9682cd7d..624c4536ecb0e 100644 --- a/recipes/libgpiod/all/test_package/test_package.c +++ b/recipes/libgpiod/all/test_package/test_package.c @@ -2,6 +2,6 @@ int main(int argc, char *argv[]) { struct gpiod_chip *chip; - chip = gpiod_chip_open_by_name("gpiochip0"); + chip = gpiod_chip_open("/dev/gpiochip0"); return 0; } diff --git a/recipes/libgpiod/config.yml b/recipes/libgpiod/config.yml index bfd56b0a1b59f..032322a67e7ab 100644 --- a/recipes/libgpiod/config.yml +++ b/recipes/libgpiod/config.yml @@ -1,3 +1,9 @@ versions: + "2.1": + folder: all + "2.0.1": + folder: all + "1.6.4": + folder: all "1.6.3": folder: all diff --git a/recipes/libgta/all/CMakeLists.txt b/recipes/libgta/all/CMakeLists.txt deleted file mode 100644 index 217b9530b904d..0000000000000 --- a/recipes/libgta/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/libgta/all/conanfile.py b/recipes/libgta/all/conanfile.py index a0064e504c27d..a15e741e867e1 100644 --- a/recipes/libgta/all/conanfile.py +++ b/recipes/libgta/all/conanfile.py @@ -1,69 +1,87 @@ import os -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 collect_libs, copy, get, replace_in_file, rmdir +from conan.tools.microsoft import is_msvc + +required_conan_version = ">=1.53.0" + class LibgtaConan(ConanFile): name = "libgta" description = "Library that reads and writes GTA (Generic Tagged Arrays) files." license = "LGPL-2.1-or-later" - topics = ("conan", "libgta", "gta") - homepage = "https://marlam.de/gta" 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]} - default_options = {"shared": False, "fPIC": True} - - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" + homepage = "https://marlam.de/gta" + topics = ("gta",) - @property - def _build_subfolder(self): - return "build_subfolder" + 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): - 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") + + def layout(self): + cmake_layout(self, src_folder="src") 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], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["GTA_BUILD_STATIC_LIB"] = not self.options.shared + tc.variables["GTA_BUILD_SHARED_LIB"] = self.options.shared + tc.variables["GTA_BUILD_DOCUMENTATION"] = False + tc.generate() + + tc = CMakeDeps(self) + tc.generate() + + def _patch_sources(self): + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "${CMAKE_SOURCE_DIR}", + "${CMAKE_CURRENT_SOURCE_DIR}") def build(self): - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "${CMAKE_SOURCE_DIR}", "${CMAKE_CURRENT_SOURCE_DIR}") - cmake = self._configure_cmake() + 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["GTA_BUILD_STATIC_LIB"] = not self.options.shared - self._cmake.definitions["GTA_BUILD_SHARED_LIB"] = self.options.shared - self._cmake.definitions["GTA_BUILD_DOCUMENTATION"] = 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", + 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): + # https://marlam.de/gta/documentation/ uses GTA as the package name + self.cpp_info.set_property("cmake_file_name", "GTA") + self.cpp_info.set_property("cmake_target_name", "GTA::GTA") + self.cpp_info.set_property("pkg_config_name", "gta") + self.cpp_info.libs = collect_libs(self) + if is_msvc(self) and not self.options.shared: + self.cpp_info.defines.append("GTA_STATIC") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.names["cmake_find_package"] = "GTA" self.cpp_info.names["cmake_find_package_multi"] = "GTA" - self.cpp_info.names["pkg_config"] = "gta" - self.cpp_info.libs = tools.collect_libs(self) - if self.settings.compiler == "Visual Studio" and not self.options.shared: - self.cpp_info.defines.append("GTA_STATIC") diff --git a/recipes/libgta/all/test_package/CMakeLists.txt b/recipes/libgta/all/test_package/CMakeLists.txt index 7b9b613cbb24a..3bb9ae06e8bb8 100644 --- a/recipes/libgta/all/test_package/CMakeLists.txt +++ b/recipes/libgta/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ -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() +find_package(GTA REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE GTA::GTA) diff --git a/recipes/libgta/all/test_package/conanfile.py b/recipes/libgta/all/test_package/conanfile.py index ea57a464900be..ef5d7042163ec 100644 --- a/recipes/libgta/all/test_package/conanfile.py +++ b/recipes/libgta/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" + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libgta/all/test_v1_package/CMakeLists.txt b/recipes/libgta/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/libgta/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/libgta/all/test_v1_package/conanfile.py b/recipes/libgta/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..84ee68733e516 --- /dev/null +++ b/recipes/libgta/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.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libhal/all/conandata.yml b/recipes/libhal/all/conandata.yml index 0a5fcff604fbd..c0ad6ccc7db62 100644 --- a/recipes/libhal/all/conandata.yml +++ b/recipes/libhal/all/conandata.yml @@ -1,4 +1,10 @@ sources: - "0.0.0": - url: "https://github.com/libhal/libhal/archive/refs/tags/0.0.0.tar.gz" - sha256: "f49d6cee9adfe9d98212ba77aa955c88994693185d4870b86a6e12bad4eb9915" + "2.2.0": + url: "https://github.com/libhal/libhal/archive/refs/tags/2.2.0.tar.gz" + sha256: "4a005cb45bd75662ca7d966a1a55f3570d2a0db01432e17eb1e9889ae7c90ee4" + "2.0.2": + url: "https://github.com/libhal/libhal/archive/refs/tags/2.0.2.tar.gz" + sha256: "bb69fffbff58ac9a91f71636422d81a4426fe70c3b47ca9b07c87fb074c989dc" + "2.0.1": + url: "https://github.com/libhal/libhal/archive/refs/tags/2.0.1.tar.gz" + sha256: "ba05f9d2172f7afbf816ab18f2dcd7c8cc4452df2b268a832e995a0321c1d2f9" diff --git a/recipes/libhal/all/conanfile.py b/recipes/libhal/all/conanfile.py index c9f4762f7af23..b711596878185 100644 --- a/recipes/libhal/all/conanfile.py +++ b/recipes/libhal/all/conanfile.py @@ -2,6 +2,7 @@ from conan.tools.files import get, copy from conan.tools.layout import basic_layout from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version from conan.errors import ConanInvalidConfiguration import os @@ -12,17 +13,15 @@ class LibHALConan(ConanFile): name = "libhal" license = "Apache-2.0" - url = "https://github.com/conan-io/conan-center-index" - homepage = "https://libhal.github.io/libhal" description = ("A collection of interfaces and abstractions for embedded " "peripherals and devices using modern C++") - topics = ("peripherals", "hardware", "abstraction", "devices", "hal") - settings = "os", "compiler", "arch", "build_type" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://libhal.github.io/" + topics = ("peripherals", "hardware", "abstraction", "devices", "hal", "header-only") + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - def package_id(self): - self.info.clear() - @property def _min_cppstd(self): return "20" @@ -34,9 +33,26 @@ def _compilers_minimum_version(self): "Visual Studio": "17", "msvc": "193", "clang": "13", - "apple-clang": "13.1.6" + "apple-clang": "14" } + @property + def _bare_metal(self): + return self.settings.os == "baremetal" + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("tl-function-ref/1.0.0") + # NOTE from the author, kammce, and CCI maintainers: + # although boost-leaf is deprecated, we've kept it for 2.x versions, + # don't update it as upstream code won't work with boost itself + self.requires("boost-leaf/1.81.0") + + def package_id(self): + self.info.clear() + def validate(self): if self.settings.get_safe("compiler.cppstd"): check_min_cppstd(self, self._min_cppstd) @@ -50,28 +66,49 @@ def lazy_lt_semver(v1, v2): 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") + f"{self.ref} 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def build(self): + pass def package(self): - copy(self, "LICENSE", 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")) + 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") + ) + 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.frameworkdirs = [] self.cpp_info.libdirs = [] self.cpp_info.resdirs = [] + + version = Version(self.version) + if self._bare_metal and version < "3.0.0": + self.cpp_info.defines = [ + "BOOST_LEAF_EMBEDDED", + "BOOST_LEAF_NO_THREADS" + ] + + # Note from CCI maintainers: Ensure users are aware of the deprecated + # dependency + if version < "3.0": + self.output.warning(f"{self.name} < 3.0.0 uses boost-leaf which is a deprecated recipe. " + f"Once 3.0 is released, 2.x will also be deprecated.") diff --git a/recipes/libhal/all/test_package/CMakeLists.txt b/recipes/libhal/all/test_package/CMakeLists.txt index e2cd1b5424ba3..1d38a74649aa2 100644 --- a/recipes/libhal/all/test_package/CMakeLists.txt +++ b/recipes/libhal/all/test_package/CMakeLists.txt @@ -3,7 +3,10 @@ project(test_package LANGUAGES CXX) find_package(libhal REQUIRED CONFIG) -add_executable(${PROJECT_NAME} main.cpp) +add_executable(${PROJECT_NAME} test_package.cpp) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) set_target_properties(${PROJECT_NAME} PROPERTIES CXX_EXTENSIONS OFF) target_link_libraries(${PROJECT_NAME} PRIVATE libhal::libhal) +if(libhal_VERSION VERSION_LESS "2.0.0") + target_compile_definitions(${PROJECT_NAME} PRIVATE LIBHAL_LESS_2) +endif() diff --git a/recipes/libhal/all/test_package/conanfile.py b/recipes/libhal/all/test_package/conanfile.py index 3a8c6c5442b33..0ab1977ef0330 100644 --- a/recipes/libhal/all/test_package/conanfile.py +++ b/recipes/libhal/all/test_package/conanfile.py @@ -7,7 +7,8 @@ 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/libhal/all/test_package/main.cpp b/recipes/libhal/all/test_package/main.cpp deleted file mode 100644 index 4fb5e3cdcdfd4..0000000000000 --- a/recipes/libhal/all/test_package/main.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include - -#include -#include - -class test_pwm : public hal::pwm -{ -private: - hal::status driver_frequency(hal::hertz p_frequency) noexcept override - { - std::printf("frequency = %f Hz\n", p_frequency); - return {}; - } - hal::status driver_duty_cycle(hal::percentage p_position) noexcept override - { - std::printf("duty cycle = %f %%\n", p_position.value()); - return {}; - } -}; - -int main() -{ - test_pwm pwm; - auto rc_servo = hal::rc_servo::create(pwm).value(); - rc_servo.position(0.25).value(); - rc_servo.position(0.50).value(); - rc_servo.position(-0.25).value(); - rc_servo.position(-1.0).value(); - return 0; -} diff --git a/recipes/libhal/all/test_package/test_package.cpp b/recipes/libhal/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..f702ac0fa8617 --- /dev/null +++ b/recipes/libhal/all/test_package/test_package.cpp @@ -0,0 +1,118 @@ +#include + +#ifdef LIBHAL_LESS_2 + +#include +#include + +class test_pwm : public hal::pwm +{ +private: + hal::status driver_frequency(hal::hertz p_frequency) noexcept override + { + std::printf("frequency = %f Hz\n", p_frequency); + return {}; + } + hal::status driver_duty_cycle(hal::percentage p_position) noexcept override + { + std::printf("duty cycle = %f %%\n", p_position.value()); + return {}; + } +}; + +int +main() +{ + test_pwm pwm; + auto rc_servo = hal::rc_servo::create(pwm).value(); + rc_servo.position(0.25).value(); + rc_servo.position(0.50).value(); + rc_servo.position(-0.25).value(); + rc_servo.position(-1.0).value(); + return 0; +} + +#else + +#include +#include +#include + +class test_pwm : public hal::pwm +{ +private: + hal::result driver_frequency(hal::hertz p_frequency) override + { + std::printf("frequency = %f Hz\n", p_frequency); + + return frequency_t{}; + } + hal::result driver_duty_cycle(float p_position) override + { + error_count_down--; + if (error_count_down == 0) { + return hal::new_error(std::errc::io_error); + } + + std::printf("duty cycle = %f %%\n", p_position); + + return duty_cycle_t{}; + } + int error_count_down = 2; +}; + +class test_timer : public hal::timer +{ +private: + hal::result driver_is_running() override + { + return is_running_t{}; + } + hal::result driver_cancel() override + { + return cancel_t{}; + } + hal::result driver_schedule( + hal::callback, + hal::time_duration) override + { + return schedule_t{}; + } +}; + +int +main() +{ + using namespace hal::literals; + using namespace std::literals; + + int status = 0; + test_pwm pwm; + test_timer timer; + hal::attempt_all( + [&pwm, &timer]() -> hal::status { + HAL_CHECK(pwm.frequency(10.0_kHz)); + + HAL_CHECK(pwm.duty_cycle(0.25)); + HAL_CHECK(pwm.duty_cycle(0.50)); + HAL_CHECK(pwm.duty_cycle(-0.25)); + HAL_CHECK(pwm.duty_cycle(-1.0)); + + HAL_CHECK(timer.schedule([]() {}, 1ms)); + + return hal::success(); + }, + [](std::errc p_errc) { + std::printf("Caught error successfully!\n"); + std::printf(" Error value: %s\n", + std::strerror(static_cast(p_errc))); + }, + [&status]() { + std::printf("Unknown error!\n"); + status = -1; + }); + + return status; +} + +#endif diff --git a/recipes/libhal/all/test_v1_package/CMakeLists.txt b/recipes/libhal/all/test_v1_package/CMakeLists.txt index 0c60d16c7a716..390a1bca7ce2f 100644 --- a/recipes/libhal/all/test_v1_package/CMakeLists.txt +++ b/recipes/libhal/all/test_v1_package/CMakeLists.txt @@ -6,7 +6,10 @@ conan_basic_setup(TARGETS) find_package(libhal REQUIRED CONFIG) -add_executable(${PROJECT_NAME} ../test_package/main.cpp) +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) set_target_properties(${PROJECT_NAME} PROPERTIES CXX_EXTENSIONS OFF) target_link_libraries(${PROJECT_NAME} PRIVATE libhal::libhal) +if(libhal_VERSION VERSION_LESS "2.0.0") + target_compile_definitions(${PROJECT_NAME} PRIVATE LIBHAL_LESS_2) +endif() diff --git a/recipes/libhal/config.yml b/recipes/libhal/config.yml index ecbb76a96ea8d..a5b4b5f8dd9a9 100644 --- a/recipes/libhal/config.yml +++ b/recipes/libhal/config.yml @@ -1,3 +1,7 @@ versions: - "0.0.0": + "2.2.0": + folder: "all" + "2.0.2": + folder: "all" + "2.0.1": folder: "all" diff --git a/recipes/libharu/all/conandata.yml b/recipes/libharu/all/conandata.yml index 29a286d695d61..0e549c3a82e1f 100644 --- a/recipes/libharu/all/conandata.yml +++ b/recipes/libharu/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.4.4": + url: "https://github.com/libharu/libharu/archive/v2.4.4.tar.gz" + sha256: "227ab0ae62979ad65c27a9bc36d85aa77794db3375a0a30af18acdf4d871aee6" "2.4.3": url: "https://github.com/libharu/libharu/archive/refs/tags/v2.4.3.tar.gz" sha256: "a2c3ae4261504a0fda25b09e7babe5df02b21803dd1308fdf105588f7589d255" diff --git a/recipes/libharu/all/conanfile.py b/recipes/libharu/all/conanfile.py index 84bfc9b3fd36d..172d75e65c04a 100644 --- a/recipes/libharu/all/conanfile.py +++ b/recipes/libharu/all/conanfile.py @@ -47,8 +47,8 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("zlib/1.2.13") - self.requires("libpng/1.6.38") + self.requires("zlib/[>=1.2.11 <2]") + self.requires("libpng/[>=1.6 <2]") def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) diff --git a/recipes/libharu/config.yml b/recipes/libharu/config.yml index 39ca57fe00f3b..be72156e0ef73 100644 --- a/recipes/libharu/config.yml +++ b/recipes/libharu/config.yml @@ -1,4 +1,6 @@ versions: + "2.4.4": + folder: "all" "2.4.3": folder: "all" "2.3.0": diff --git a/recipes/libheif/all/conandata.yml b/recipes/libheif/all/conandata.yml index c5668b6d3c93a..5dc100f24cce6 100644 --- a/recipes/libheif/all/conandata.yml +++ b/recipes/libheif/all/conandata.yml @@ -1,4 +1,19 @@ sources: + "1.19.5": + url: "https://github.com/strukturag/libheif/releases/download/v1.19.5/libheif-1.19.5.tar.gz" + sha256: "d3cf0a76076115a070f9bc87cf5259b333a1f05806500045338798486d0afbaf" + "1.19.0": + url: "https://github.com/strukturag/libheif/releases/download/v1.19.0/libheif-1.19.0.tar.gz" + sha256: "c0323638557994791c7bf939ee9752e8a0f3f5ce4f07328daefa0159e3530eb4" + "1.18.2": + url: "https://github.com/strukturag/libheif/releases/download/v1.18.2/libheif-1.18.2.tar.gz" + sha256: "c4002a622bec9f519f29d84bfdc6024e33fd67953a5fb4dc2c2f11f67d5e45bf" + "1.18.1": + url: "https://github.com/strukturag/libheif/releases/download/v1.18.1/libheif-1.18.1.tar.gz" + sha256: "8702564b0f288707ea72b260b3bf4ba9bf7abfa7dac01353def3a86acd6bbb76" + "1.16.2": + url: "https://github.com/strukturag/libheif/releases/download/v1.16.2/libheif-1.16.2.tar.gz" + sha256: "7f97e4205c0bd9f9b8560536c8bd2e841d1c9a6d610401eb3eb87ed9cdfe78ea" "1.13.0": url: "https://github.com/strukturag/libheif/releases/download/v1.13.0/libheif-1.13.0.tar.gz" sha256: "c20ae01bace39e89298f6352f1ff4a54b415b33b9743902da798e8a1e51d7ca1" @@ -12,6 +27,11 @@ sources: url: "https://github.com/strukturag/libheif/releases/download/v1.9.1/libheif-1.9.1.tar.gz" sha256: "5f65ca2bd2510eed4e13bdca123131c64067e9dd809213d7aef4dc5e37948bca" patches: + "1.18.1": + - patch_file: "patches/0001-cmake_1.18.1.patch" + "1.16.2": + - patch_file: "patches/0001-cmake_1.16.2.patch" + - patch_file: "patches/0002-plugins_cmake_1.16.2.patch" "1.13.0": - patch_file: "patches/0001-cmake_1.13.0.patch" "1.12.0": diff --git a/recipes/libheif/all/conanfile.py b/recipes/libheif/all/conanfile.py index d70912d7df209..03ba06e99d6ae 100644 --- a/recipes/libheif/all/conanfile.py +++ b/recipes/libheif/all/conanfile.py @@ -1,22 +1,22 @@ from conan import ConanFile -from conan.tools.build import check_min_cppstd +from conan.errors import ConanInvalidConfiguration +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.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 = ">=2.1" class LibheifConan(ConanFile): name = "libheif" description = "libheif is an HEIF and AVIF file format decoder and encoder." - topics = ("libheif", "heif", "codec", "video") + license = ("LGPL-3.0-only", "GPL-3.0-or-later", "MIT") 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") - + topics = ("heif", "codec", "video") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -25,6 +25,10 @@ class LibheifConan(ConanFile): "with_x265": [True, False], "with_libaomav1": [True, False], "with_dav1d": [True, False], + "with_jpeg": [True, False], + "with_openjpeg": [True, False], + "with_openjph": [True, False], + "with_openh264": [True, False], } default_options = { "shared": False, @@ -33,58 +37,98 @@ class LibheifConan(ConanFile): "with_x265": False, "with_libaomav1": False, "with_dav1d": False, + "with_jpeg": False, + "with_openjpeg": False, + "with_openjph": False, + "with_openh264": False, } + @property + def _min_cppstd(self): + return "20" if Version(self.version) >= "1.19.0" else "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": del self.options.fPIC + if Version(self.version) < "1.17.0": + del self.options.with_jpeg + del self.options.with_openjpeg + if Version(self.version) < "1.18.0": + del self.options.with_openjph + if Version(self.version) < "1.19.0": + del self.options.with_openh264 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.12") 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.6.1") if self.options.with_dav1d: - self.requires("dav1d/1.0.0") + self.requires("dav1d/1.2.1") + if self.options.get_safe("with_jpeg"): + self.requires("libjpeg/9f") + if self.options.get_safe("with_openjpeg"): + self.requires("openjpeg/2.5.2") + if self.options.get_safe("with_openjph"): + self.requires("openjph/0.16.0", transitive_headers=False) + if self.options.get_safe("with_openh264"): + self.requires("openh264/2.4.1") 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") + def build_requirements(self): + if Version(self.version) >= "1.18.0": + self.tool_requires("cmake/[>=3.16 <4]") 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) + apply_conandata_patches(self) def generate(self): tc = CMakeToolchain(self) + tc.variables["WITH_LIBSHARPYUV"] = False tc.variables["WITH_LIBDE265"] = self.options.with_libde265 tc.variables["WITH_X265"] = self.options.with_x265 tc.variables["WITH_AOM"] = self.options.with_libaomav1 + tc.variables["WITH_AOM_DECODER"] = self.options.with_libaomav1 + tc.variables["WITH_AOM_ENCODER"] = self.options.with_libaomav1 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.variables["WITH_GDK_PIXBUF"] = False + tc.variables["BUILD_TESTING"] = False + tc.variables["WITH_JPEG_DECODER"] = self.options.get_safe("with_jpeg", False) + tc.variables["WITH_JPEG_ENCODER"] = self.options.get_safe("with_jpeg", False) + tc.variables["WITH_OpenJPEG_DECODER"] = self.options.get_safe("with_openjpeg", False) + tc.variables["WITH_OpenJPEG_ENCODER"] = self.options.get_safe("with_openjpeg", False) + tc.variables["WITH_OPENJPH_ENCODER"] = self.options.get_safe("with_openjph", False) + tc.variables["WITH_OPENH264_DECODER"] = self.options.get_safe("with_openh264", False) + # Disable finding possible Doxygen in system, so no docs are built + tc.variables["CMAKE_DISABLE_FIND_PACKAGE_Doxygen"] = True + tc.cache_variables["CMAKE_COMPILE_WARNING_AS_ERROR"] = False tc.generate() deps = CMakeDeps(self) + if Version(self.version) >= "1.18.0": + deps.set_property("libde265", "cmake_file_name", "LIBDE265") + deps.set_property("openjph", "cmake_file_name", "OPENJPH") + if Version(self.version) >= "1.19.0": + deps.set_property("openh264", "cmake_file_name", "OpenH264") deps.generate() def build(self): - apply_conandata_patches(self) cmake = CMake(self) cmake.configure() cmake.build() @@ -100,26 +144,32 @@ def package_info(self): self.cpp_info.set_property("cmake_file_name", "libheif") self.cpp_info.set_property("cmake_target_name", "libheif::heif") self.cpp_info.set_property("pkg_config_name", "libheif") - # TODO: back to global scope in conan v2 once cmake_find_package_* generators removed - self.cpp_info.components["heif"].libs = ["heif"] + self.cpp_info.libs = ["heif"] + if not self.options.shared: - self.cpp_info.components["heif"].defines = ["LIBHEIF_STATIC_BUILD"] + self.cpp_info.defines = ["LIBHEIF_STATIC_BUILD"] if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.components["heif"].system_libs.extend(["m", "pthread"]) + self.cpp_info.system_libs.extend(["m", "pthread"]) + if Version(self.version) >= "1.18.0": + self.cpp_info.system_libs.append("dl") 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) + self.cpp_info.system_libs.append(libcxx) - # TODO: to remove in conan v2 once cmake_find_package_* generators removed - self.cpp_info.components["heif"].set_property("cmake_target_name", "libheif::heif") - self.cpp_info.components["heif"].set_property("pkg_config_name", "libheif") - self.cpp_info.components["heif"].requires = [] if self.options.with_libde265: - self.cpp_info.components["heif"].requires.append("libde265::libde265") + self.cpp_info.requires.append("libde265::libde265") if self.options.with_x265: - self.cpp_info.components["heif"].requires.append("libx265::libx265") + self.cpp_info.requires.append("libx265::libx265") if self.options.with_libaomav1: - self.cpp_info.components["heif"].requires.append("libaom-av1::libaom-av1") + self.cpp_info.requires.append("libaom-av1::libaom-av1") if self.options.with_dav1d: - self.cpp_info.components["heif"].requires.append("dav1d::dav1d") + self.cpp_info.requires.append("dav1d::dav1d") + if self.options.get_safe("with_jpeg"): + self.cpp_info.requires.append("libjpeg::libjpeg") + if self.options.get_safe("with_openjpeg"): + self.cpp_info.requires.append("openjpeg::openjpeg") + if self.options.get_safe("with_openjph"): + self.cpp_info.requires.append("openjph::openjph") + if self.options.get_safe("with_openh264"): + self.cpp_info.requires.append("openh264::openh264") diff --git a/recipes/libheif/all/patches/0001-cmake_1.16.2.patch b/recipes/libheif/all/patches/0001-cmake_1.16.2.patch new file mode 100644 index 0000000000000..957b6fe2587f2 --- /dev/null +++ b/recipes/libheif/all/patches/0001-cmake_1.16.2.patch @@ -0,0 +1,60 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index de15948..589eab5 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -41,7 +41,7 @@ set(CMAKE_CXX_EXTENSIONS OFF) + + set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) + +-set(CMAKE_POSITION_INDEPENDENT_CODE ON) ++# set(CMAKE_POSITION_INDEPENDENT_CODE ON) + + # Create the compile command database for clang by default + set(CMAKE_EXPORT_COMPILE_COMMANDS ON) +@@ -54,7 +54,7 @@ if (has_potentially_evaluated_expression) + add_definitions(-Wno-error=potentially-evaluated-expression) + endif() + +-LIST (APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/modules") ++# LIST (APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/modules") + + option(ENABLE_PLUGIN_LOADING "Support loading of plugins" ON) + set(PLUGIN_DIRECTORY "${CMAKE_INSTALL_FULL_LIBDIR}/libheif" CACHE STRING "Plugin install directory") +@@ -74,9 +74,9 @@ + find_package(${packageName}) + endif () + +- if (${variableName}_FOUND AND WITH_${variableName}_PLUGIN AND PLUGIN_LOADING_SUPPORTED_AND_ENABLED) ++ if (${packageName}_FOUND AND WITH_${packageName}_PLUGIN AND PLUGIN_LOADING_SUPPORTED_AND_ENABLED) + set(msg "found (plugin)") +- elseif (${variableName}_FOUND) ++ elseif (${packageName}_FOUND) + set(msg "found (built-in)") + elseif (WITH_${variableName}) + set(msg "not found") +@@ -88,11 +88,11 @@ macro(plugin_option variableName packageName displayName displayType defaultPlug + unset(msg) + endmacro() + +-plugin_option(LIBDE265 LIBDE265 "libde265" "HEIC decoder" OFF) +-plugin_option(X265 X265 "x265" "HEIC encoder" OFF) +-plugin_option(DAV1D DAV1D "Dav1d" "AVIF decoder" OFF) +-plugin_option(AOM_ENCODER AOM "aom" "AVIF encoder" OFF) +-plugin_option(AOM_DECODER AOM "aom" "AVIF decoder" OFF) ++plugin_option(LIBDE265 libde265 "libde265" "HEIC decoder" OFF) ++plugin_option(X265 libx265 "x265" "HEIC encoder" OFF) ++plugin_option(DAV1D dav1d "Dav1d" "AVIF decoder" OFF) ++plugin_option(AOM_ENCODER libaom-av1 "aom" "AVIF encoder" OFF) ++plugin_option(AOM_DECODER libaom-av1 "aom" "AVIF decoder" OFF) + plugin_option(SvtEnc SvtEnc "Svt-av1" "AVIF encoder" ON) + plugin_option(RAV1E RAV1E "Rav1e" "AVIF encoder" ON) + +@@ -219,7 +219,7 @@ if (WITH_GDK_PIXBUF) + add_subdirectory (gdk-pixbuf) + endif() + +-add_subdirectory (gnome) ++#add_subdirectory (gnome) + + + # --- packaging (source code) diff --git a/recipes/libheif/all/patches/0001-cmake_1.18.1.patch b/recipes/libheif/all/patches/0001-cmake_1.18.1.patch new file mode 100644 index 0000000000000..271d7b71513e3 --- /dev/null +++ b/recipes/libheif/all/patches/0001-cmake_1.18.1.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 12c4039..2ea1805 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -47,7 +47,7 @@ set(CMAKE_CXX_EXTENSIONS OFF) + + set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) + +-set(CMAKE_POSITION_INDEPENDENT_CODE ON) ++# set(CMAKE_POSITION_INDEPENDENT_CODE ON) + + # Create the compile command database for clang by default + set(CMAKE_EXPORT_COMPILE_COMMANDS ON) diff --git a/recipes/libheif/all/patches/0002-plugins_cmake_1.16.2.patch b/recipes/libheif/all/patches/0002-plugins_cmake_1.16.2.patch new file mode 100644 index 0000000000000..ca167755d4ece --- /dev/null +++ b/recipes/libheif/all/patches/0002-plugins_cmake_1.16.2.patch @@ -0,0 +1,31 @@ +--- a/libheif/plugins/CMakeLists.txt ++++ b/libheif/plugins/CMakeLists.txt +@@ -44,23 +44,23 @@ + + set(X265_sources encoder_x265.h encoder_x265.cc) + set(X265_extra_plugin_sources) +-plugin_compilation(x265 X265 X265 X265) ++plugin_compilation(x265 x265 X265 X265) + + set(LIBDE265_sources decoder_libde265.cc decoder_libde265.h) + set(LIBDE265_extra_plugin_sources ../error.cc) +-plugin_compilation(libde265 LIBDE265 LIBDE265 LIBDE265) ++plugin_compilation(libde265 libde265 LIBDE265 LIBDE265) + + set(DAV1D_sources decoder_dav1d.cc decoder_dav1d.h) + set(DAV1D_extra_plugin_sources ../common_utils.cc ../common_utils.h) +-plugin_compilation(dav1d DAV1D DAV1D DAV1D) ++plugin_compilation(dav1d Dav1d DAV1D DAV1D) + + set(AOM_DECODER_sources decoder_aom.cc decoder_aom.h) + set(AOM_DECODER_extra_plugin_sources) +-plugin_compilation(aomdec AOM AOM_DECODER AOM_DECODER) ++plugin_compilation(aomdec libaom-av1 AOM_DECODER AOM_DECODER) + + set(AOM_ENCODER_sources encoder_aom.cc encoder_aom.h) + set(AOM_ENCODER_extra_plugin_sources ../error.cc ../common_utils.cc ../common_utils.h) +-plugin_compilation(aomenc AOM AOM_ENCODER AOM_ENCODER) ++plugin_compilation(aomenc libaom-av1 AOM_ENCODER AOM_ENCODER) + + set(SvtEnc_sources encoder_svt.cc encoder_svt.h) + set(SvtEnc_extra_plugin_sources) diff --git a/recipes/libheif/all/test_package/CMakeLists.txt b/recipes/libheif/all/test_package/CMakeLists.txt index 13ebf8fab7134..f87ac8ae49013 100644 --- a/recipes/libheif/all/test_package/CMakeLists.txt +++ b/recipes/libheif/all/test_package/CMakeLists.txt @@ -5,4 +5,8 @@ find_package(libheif REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE libheif::heif) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +if(libheif_VERSION VERSION_GREATER_EQUAL "1.19.0") + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) +else() + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +endif() 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/libheif/config.yml b/recipes/libheif/config.yml index 1b1bac20e2e23..dfd934f80e6b2 100644 --- a/recipes/libheif/config.yml +++ b/recipes/libheif/config.yml @@ -1,4 +1,14 @@ versions: + "1.19.5": + folder: all + "1.19.0": + folder: all + "1.18.2": + folder: all + "1.18.1": + folder: all + "1.16.2": + folder: all "1.13.0": folder: all "1.12.0": diff --git a/recipes/libiberty/all/conanfile.py b/recipes/libiberty/all/conanfile.py index 3d6300e66678c..34588a0782655 100644 --- a/recipes/libiberty/all/conanfile.py +++ b/recipes/libiberty/all/conanfile.py @@ -16,6 +16,7 @@ class LibibertyConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://gcc.gnu.org/onlinedocs/libiberty" license = "LGPL-2.1" + package_type = "static-library" settings = "os", "arch", "compiler", "build_type" options = { "fPIC": [True, False], @@ -54,8 +55,7 @@ def build_requirements(self): self.tool_requires("msys2/cci.latest") 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) rmdir(self, os.path.join(self.source_folder, "gcc")) rmdir(self, os.path.join(self.source_folder, "libstdc++-v3")) diff --git a/recipes/libiconv/all/conanfile.py b/recipes/libiconv/all/conanfile.py index c2cbe29066cee..1c44ed6e67c02 100644 --- a/recipes/libiconv/all/conanfile.py +++ b/recipes/libiconv/all/conanfile.py @@ -1,24 +1,24 @@ 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 +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 + rmdir, + 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 from conan.tools.scm import Version -from conans.tools import get_gnu_triplet import os -required_conan_version = ">=1.53.0" +required_conan_version = ">=1.54.0" class LibiconvConan(ConanFile): @@ -28,6 +28,8 @@ class LibiconvConan(ConanFile): 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], @@ -40,8 +42,8 @@ class LibiconvConan(ConanFile): @property def _is_clang_cl(self): - return (self.settings.compiler == "clang" and self.settings.os == "Windows") \ - or self.settings.get_safe("compiler.toolset") == "ClangCL" + return self.settings.compiler == "clang" and self.settings.os == "Windows" and \ + self.settings.compiler.get_safe("runtime") @property def _msvc_tools(self): @@ -78,28 +80,45 @@ def build_requirements(self): self.win_bash = True 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 = 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"): + if self.settings.os == "Windows" and self.settings.compiler == "gcc": + if self.settings.arch == "x86": + tc.update_configure_args({ + "--host": "i686-w64-mingw32", + "RC": "windres --target=pe-i386", + "WINDRES": "windres --target=pe-i386", + }) + elif self.settings.arch == "x86_64": + tc.update_configure_args({ + "--host": "x86_64-w64-mingw32", + "RC": "windres --target=pe-x86-64", + "WINDRES": "windres --target=pe-x86-64", + }) + 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 = get_gnu_triplet(str(self.settings.os), str(self.settings.arch), "gcc") - build = get_gnu_triplet(str(self._settings_build.os), str(self._settings_build.arch), "gcc") - tc.configure_args.extend([ - f"--host={host}", - f"--build={build}", - ]) - tc.generate() - + 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: - env = Environment() 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")) @@ -112,17 +131,17 @@ def generate(self): env.define("RANLIB", ":") env.define("NM", "dumpbin -symbols") env.define("win32_target", "_WIN32_WINNT_VISTA") - env.vars(self).save_script("conanbuild_libiconv_msvc") + tc.generate(env) - def _patch_sources(self): - apply_conandata_patches(self) - # relocatable shared libs on macOS - for configure in ["configure", os.path.join("libcharset", "configure")]: - replace_in_file(self, os.path.join(self.source_folder, configure), - "-install_name \\$rpath/", "-install_name @rpath/") + def _apply_resource_patch(self): + if self.settings.arch == "x86": + windres_options_path = os.path.join(self.source_folder, "windows", "windres-options") + self.output.info("Applying {} resource patch: {}".format(self.settings.arch, windres_options_path)) + replace_in_file(self, windres_options_path, '# PACKAGE_VERSION_SUBMINOR', '# PACKAGE_VERSION_SUBMINOR\necho "--target=pe-i386"', strict=True) - def build(self): - self._patch_sources() + def build(self): + apply_conandata_patches(self) + self._apply_resource_patch() autotools = Autotools(self) autotools.configure() autotools.make() @@ -130,11 +149,10 @@ def build(self): def package(self): copy(self, "COPYING.LIB", self.source_folder, os.path.join(self.package_folder, "licenses")) autotools = Autotools(self) - autotools.install(args=[f"DESTDIR={unix_path(self, self.package_folder)}"]) - + 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", f"{import_lib}.dll.lib"), diff --git a/recipes/libid3tag/all/CMakeLists.txt b/recipes/libid3tag/all/CMakeLists.txt new file mode 100644 index 0000000000000..cbee8d19a93e7 --- /dev/null +++ b/recipes/libid3tag/all/CMakeLists.txt @@ -0,0 +1,21 @@ +cmake_minimum_required(VERSION 3.15) +project(libid3tag LANGUAGES C) + +file(GLOB SOURCES "*.c" "*.h") +add_library(libid3tag ${SOURCES} ${HEADERS}) +target_include_directories(libid3tag PRIVATE msvc++) + +# https://github.com/markjeee/libid3tag/blob/master/msvc%2B%2B/libid3tag.dsp#L43-L44 +target_compile_options(libid3tag PRIVATE /W2 "$<$:/Od;/GZ>" "$<$:/O2>") +target_compile_definitions(libid3tag PRIVATE HAVE_CONFIG_H "$<$:DEBUG;>" "$<$:NDEBUG>") +set_property(TARGET libid3tag PROPERTY WINDOWS_EXPORT_ALL_SYMBOLS ON) + +find_package(ZLIB REQUIRED CONFIG) +target_link_libraries(libid3tag PRIVATE ZLIB::ZLIB) + +install(TARGETS libid3tag + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin +) +install(FILES id3tag.h DESTINATION include) diff --git a/recipes/libid3tag/all/conanfile.py b/recipes/libid3tag/all/conanfile.py index ec346961d3ce4..39074d29616bc 100644 --- a/recipes/libid3tag/all/conanfile.py +++ b/recipes/libid3tag/all/conanfile.py @@ -1,28 +1,39 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment, MSBuild -from conans.errors import ConanInvalidConfiguration import os -import shutil -required_conan_version = ">=1.33.0" +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import cross_building +from conan.tools.cmake import CMakeToolchain, CMakeDeps, CMake, cmake_layout +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import chdir, copy, get, rm, replace_in_file +from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc + +required_conan_version = ">=1.53.0" class LibId3TagConan(ConanFile): name = "libid3tag" description = "ID3 tag manipulation library." - topics = ("conan", "mad", "id3", "MPEG", "audio", "decoder") + license = "GPL-2.0-or-later" url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.underbit.com/products/mad/" - 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} - generator = "pkg_config", "visual_studio" + topics = ("mad", "id3", "MPEG", "audio", "decoder") - _autotools = None - - @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, + } + + 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": @@ -30,95 +41,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 requirements(self): - self.requires("zlib/1.2.11") + def layout(self): + if is_msvc(self): + cmake_layout(self, src_folder="src") + else: + basic_layout(self, src_folder="src") - @property - def _is_msvc(self): - return self.settings.compiler == "Visual Studio" or ( - self.settings.compiler == "clang" and self.settings.os == "Windows" - ) + def requirements(self): + self.requires("zlib/[>=1.2.11 <2]") def validate(self): - if self._is_msvc and self.options.shared: - raise ConanInvalidConfiguration("libid3tag does not support shared library for MSVC") - - @property - def _settings_build(self): - return getattr(self, "settings_build", self.settings) + if cross_building(self) and self.settings.arch == "armv8" and self.options.shared: + # https://github.com/conan-io/conan-center-index/pull/18987#issuecomment-1668243831 + raise ConanInvalidConfiguration("shared library cross-building is not supported for armv8") 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") 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 = CMakeToolchain(self) + tc.preprocessor_definitions["ID3TAG_EXPORT"] = "__declspec(dllexport)" if self.options.shared else "" + tc.generate() + deps = CMakeDeps(self) + deps.generate() + else: + venv = VirtualBuildEnv(self) + venv.generate() + tc = AutotoolsToolchain(self) + tc.generate() + deps = AutotoolsDeps(self) + deps.generate() def build(self): - if self._is_msvc: - self._build_msvc() + if is_msvc(self): + # https://github.com/markjeee/libid3tag/blob/master/id3tag.h#L355-L358 + replace_in_file(self, os.path.join(self.source_folder, "id3tag.h"), + "extern char", "ID3TAG_EXPORT extern char") + cmake = CMake(self) + cmake.configure() + cmake.build() else: - self._build_autotools() - - def _build_msvc(self): - kwargs = {} - with tools.chdir(os.path.join(self._source_subfolder, "msvc++")): - # cl : Command line error D8016: '/ZI' and '/Gy-' command-line options are incompatible - tools.replace_in_file("libid3tag.dsp", "/ZI ", "") - if self.settings.compiler == "clang": - tools.replace_in_file("libid3tag.dsp", "CPP=cl.exe", "CPP=clang-cl.exe") - tools.replace_in_file("libid3tag.dsp", "RSC=rc.exe", "RSC=llvm-rc.exe") - kwargs["toolset"] = "ClangCl" - if self.settings.arch == "x86_64": - tools.replace_in_file("libid3tag.dsp", "Win32", "x64") - with tools.vcvars(self.settings): - self.run("devenv /Upgrade libid3tag.dsp") - msbuild = MSBuild(self) - msbuild.build(project_file="libid3tag.vcxproj", **kwargs) - - def _configure_autotools(self): - if not self._autotools: - if self.options.shared: - args = ["--disable-static", "--enable-shared"] - else: - args = ["--disable-shared", "--enable-static"] - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - self._autotools.configure(args=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) - - 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")) - autotools = self._configure_autotools() - autotools.make() - - def _install_autotools(self): - autotools = self._configure_autotools() - autotools.install() - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") + 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), os.path.dirname(gnu_config), self.source_folder) + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.configure() + autotools.make() def package(self): - self.copy("COPYRIGHT", dst="licenses", src=self._source_subfolder) - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - self.copy("CREDITS", dst="licenses", src=self._source_subfolder) - if self._is_msvc: - self.copy(pattern="*.lib", dst="lib", src=self._source_subfolder, keep_path=False) - self.copy(pattern="id3tag.h", dst="include", src=self._source_subfolder) + for license_file in ["COPYRIGHT", "COPYING", "CREDITS"]: + copy(self, license_file, self.source_folder, os.path.join(self.package_folder, "licenses")) + if is_msvc(self): + cmake = CMake(self) + cmake.install() else: - self._install_autotools() + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.install() + rm(self, "*.la", self.package_folder, recursive=True) def package_info(self): - self.cpp_info.libs = ["libid3tag" if self._is_msvc else "id3tag"] + if is_msvc(self): + self.cpp_info.libs = ["libid3tag"] + self.cpp_info.defines.append("ID3TAG_EXPORT=" + ("__declspec(dllimport)" if self.options.shared else "")) + else: + self.cpp_info.libs = ["id3tag"] diff --git a/recipes/libid3tag/all/test_package/CMakeLists.txt b/recipes/libid3tag/all/test_package/CMakeLists.txt index 7b9b613cbb24a..5735549609ad1 100644 --- a/recipes/libid3tag/all/test_package/CMakeLists.txt +++ b/recipes/libid3tag/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ -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() +find_package(libid3tag REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE libid3tag::libid3tag) diff --git a/recipes/libid3tag/all/test_package/conanfile.py b/recipes/libid3tag/all/test_package/conanfile.py index d4128b0450777..ef5d7042163ec 100644 --- a/recipes/libid3tag/all/test_package/conanfile.py +++ b/recipes/libid3tag/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): - bin_path = os.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/libid3tag/all/test_v1_package/CMakeLists.txt b/recipes/libid3tag/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/libid3tag/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/libid3tag/all/test_v1_package/conanfile.py b/recipes/libid3tag/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..49a3a66ea5bad --- /dev/null +++ b/recipes/libid3tag/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/libidn/all/conandata.yml b/recipes/libidn/all/conandata.yml index 8be8baf6f09f3..fcb454914799b 100644 --- a/recipes/libidn/all/conandata.yml +++ b/recipes/libidn/all/conandata.yml @@ -5,4 +5,3 @@ sources: patches: "1.36": - patch_file: "patches/0001-unconditional-system-stdint-h.patch" - base_path: "source_subfolder" diff --git a/recipes/libidn/all/conanfile.py b/recipes/libidn/all/conanfile.py index 6305a5795dac0..2512e8efab52b 100644 --- a/recipes/libidn/all/conanfile.py +++ b/recipes/libidn/all/conanfile.py @@ -1,10 +1,14 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, tools -from conans.errors import ConanInvalidConfiguration -import contextlib -import functools import os -required_conan_version = ">=1.33.0" +from conan import ConanFile +from conan.tools.build import cross_building +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv, Environment +from conan.tools.files import get, rmdir, export_conandata_patches, apply_conandata_patches, copy, replace_in_file, rm, save +from conan.tools.gnu import AutotoolsToolchain, Autotools, AutotoolsDeps +from conan.tools.layout import basic_layout +from conan.tools.microsoft import unix_path, is_msvc + +required_conan_version = ">=1.53.0" class LibIdnConan(ConanFile): @@ -14,6 +18,8 @@ class LibIdnConan(ConanFile): topics = ("libidn", "encode", "decode", "internationalized", "domain", "name") license = "GPL-3.0-or-later" url = "https://github.com/conan-io/conan-center-index" + + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -26,17 +32,12 @@ class LibIdnConan(ConanFile): "threads": True, } - @property - def _source_subfolder(self): - return "source_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"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -44,91 +45,120 @@ 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): - self.requires("libiconv/1.16") + def layout(self): + basic_layout(self, src_folder="src") - def validate(self): - if self.settings.os == "Windows" and self.options.shared: - raise ConanInvalidConfiguration("Shared libraries are not supported on Windows due to libtool limitation") + 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.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) - - @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 + 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) if not self.options.shared: - autotools.defines.append("LIBIDN_STATIC") - if self.settings.compiler == "Visual Studio": - if tools.Version(self.settings.compiler.version) >= "12": - autotools.flags.append("-FS") - autotools.link_flags.extend("-L{}".format(p.replace("\\", "/")) for p in self.deps_cpp_info.lib_paths) + tc.extra_defines.append("LIBIDN_STATIC") 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 += [ "--enable-threads={}".format(yes_no(self.options.threads)), - "--with-libiconv-prefix={}".format(tools.unix_path(self.deps_cpp_info["libiconv"].rootpath)), + "--with-libiconv-prefix={}".format(unix_path(self, self.dependencies["libiconv"].package_folder)), + "--disable-csharp", "--disable-nls", "--disable-rpath", ] - autotools.configure(args=conf_args, configure_dir=self._source_subfolder) - return autotools - - def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - if self.settings.compiler == "Visual Studio": + if is_msvc(self): + tc.extra_cflags.append("-FS") + tc.extra_cxxflags.append("-FS") + tc.generate() + + if is_msvc(self): + env = Environment() + dep_info = self.dependencies["libiconv"].cpp_info.aggregated_components() + env.append("CPPFLAGS", [f"-I{unix_path(self, p)}" for p in dep_info.includedirs] + [f"-D{d}" for d in dep_info.defines]) + env.append("_LINK_", [lib if lib.endswith(".lib") else f"{lib}.lib" for lib in (dep_info.libs + dep_info.system_libs)]) + env.append("LDFLAGS", [f"-L{unix_path(self, p)}" for p in dep_info.libdirs] + dep_info.sharedlinkflags + dep_info.exelinkflags) + env.append("CFLAGS", dep_info.cflags) + env.vars(self).save_script("conanautotoolsdeps_cl_workaround") + else: + deps = AutotoolsDeps(self) + deps.generate() + + if is_msvc(self): + env = Environment() + 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)) + # Workaround for iconv.lib not being found due to linker flag order + libiconv_libdir = unix_path(self, self.dependencies["libiconv"].cpp_info.aggregated_components().libdir) + env.define("CC", f"{compile_wrapper} cl -nologo -L{libiconv_libdir}") + env.define("CXX", f"{compile_wrapper} cl -nologo") + env.define("LD", "link -nologo") + env.define("AR", f'{ar_wrapper} lib') + env.vars(self).save_script("conanbuild_msvc") + + def _patch_sources(self): + apply_conandata_patches(self) + # Disable examples and tests + for subdir in ["examples", "tests", "fuzz", "gltests", os.path.join("lib", "gltests"), "doc"]: + save(self, os.path.join(self.source_folder, subdir, "Makefile.in"), "all:\ninstall:\n") + + if is_msvc(self): if self.settings.arch in ("x86_64", "armv8", "armv8.3"): ssize = "signed long long int" else: ssize = "signed long int" - tools.replace_in_file(os.path.join(self._source_subfolder, "lib", "stringprep.h"), - "ssize_t", ssize) - with self._build_context(): - autotools = self._configure_autotools() - autotools.make(args=["V=1"]) + replace_in_file(self, os.path.join(self.source_folder, "lib", "stringprep.h"), "ssize_t", ssize) + + if self.settings.os == "Windows": + # Otherwise tries to create a symlink from GNUmakefile to itself, which fails on Windows + replace_in_file(self, os.path.join(self.source_folder, "configure"), + '"$GNUmakefile") CONFIG_LINKS="$CONFIG_LINKS $GNUmakefile:$GNUmakefile" ;;', "") + replace_in_file(self, os.path.join(self.source_folder, "configure"), + 'ac_config_links="$ac_config_links $GNUmakefile:$GNUmakefile"', "") + + def build(self): + 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() + copy(self, "COPYING", self.source_folder, 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"), recursive=True) - 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") + if is_msvc(self) and self.options.shared: + os.rename(os.path.join(self.package_folder, "lib", "idn.dll.lib"), + os.path.join(self.package_folder, "lib", "idn-12.lib")) def package_info(self): - self.cpp_info.libs = ["idn"] - self.cpp_info.names["pkg_config"] = "libidn" + if is_msvc(self) and self.options.shared: + self.cpp_info.libs = ["idn-12"] + else: + self.cpp_info.libs = ["idn"] + self.cpp_info.set_property("pkg_config_name", "libidn") if self.settings.os in ["Linux", "FreeBSD"]: if self.options.threads: self.cpp_info.system_libs = ["pthread"] @@ -136,7 +166,6 @@ def package_info(self): if not self.options.shared: self.cpp_info.defines = ["LIBIDN_STATIC"] + # 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.env_info.PATH.append(bin_path) - diff --git a/recipes/libidn/all/test_package/CMakeLists.txt b/recipes/libidn/all/test_package/CMakeLists.txt index 7b9b613cbb24a..3482998466c6b 100644 --- a/recipes/libidn/all/test_package/CMakeLists.txt +++ b/recipes/libidn/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ -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() +find_package(libidn REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE libidn::libidn) diff --git a/recipes/libidn/all/test_package/conanfile.py b/recipes/libidn/all/test_package/conanfile.py index 07c965844de9b..441cef7471a37 100644 --- a/recipes/libidn/all/test_package/conanfile.py +++ b/recipes/libidn/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_layout, CMake + 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, run=True) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,8 +22,8 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - self.run("idn --help", run_environment=True) + if can_run(self): + self.run("idn --help", env="conanrun") - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libidn/all/test_v1_package/CMakeLists.txt b/recipes/libidn/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/libidn/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/libidn/all/test_v1_package/conanfile.py b/recipes/libidn/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..3eaa9f0102538 --- /dev/null +++ b/recipes/libidn/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): + self.run("idn --help", run_environment=True) + + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libidn2/all/conandata.yml b/recipes/libidn2/all/conandata.yml index b710e69645f11..d33653d85c4f6 100644 --- a/recipes/libidn2/all/conandata.yml +++ b/recipes/libidn2/all/conandata.yml @@ -5,4 +5,3 @@ sources: patches: "2.3.0": - patch_file: "patches/0001-no-versioning-of-symbols.patch" - base_path: "source_subfolder" diff --git a/recipes/libidn2/all/conanfile.py b/recipes/libidn2/all/conanfile.py index 0a83958ffe3fd..18257e8db29d2 100644 --- a/recipes/libidn2/all/conanfile.py +++ b/recipes/libidn2/all/conanfile.py @@ -1,18 +1,30 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, tools -from conans.errors import ConanInvalidConfiguration -from contextlib import contextmanager import os -required_conan_version = ">=1.33.0" +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, copy, export_conandata_patches, get, 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 + +required_conan_version = ">=1.53.0" class LibIdn(ConanFile): name = "libidn2" - description = "GNU Libidn is a fully documented implementation of the Stringprep, Punycode and IDNA 2003 specifications." - homepage = "https://www.gnu.org/software/libidn/" - topics = ("libidn", "encode", "decode", "internationalized", "domain", "name") + description = ( + "GNU Libidn is a fully documented implementation of the Stringprep, Punycode and IDNA 2003" + " specifications." + ) license = "GPL-3.0-or-later" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://www.gnu.org/software/libidn/" + topics = ("libidn", "encode", "decode", "internationalized", "domain", "name") + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -21,17 +33,13 @@ class LibIdn(ConanFile): "shared": False, "fPIC": True, } - settings = "os", "arch", "compiler", "build_type" - - _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): - 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,93 +47,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 requirements(self): - self.requires("libiconv/1.16") - - def validate(self): - if self.settings.os == "Windows" and self.options.shared: - raise ConanInvalidConfiguration("Shared libraries are not supported on Windows due to libtool limitation") + 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("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.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") 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.settings.compiler == "Visual Studio": - with tools.vcvars(self.settings): - 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 + 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") - 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 not self.options.shared: - self._autotools.defines.append("IDN2_STATIC") - if self.settings.compiler == "Visual Studio": - if tools.Version(self.settings.compiler.version) >= "12": - self._autotools.flags.append("-FS") - self._autotools.link_flags.extend("-L{}".format(p.replace("\\", "/")) for p in self.deps_cpp_info.lib_paths) - 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)), - "--with-libiconv-prefix={}".format(tools.unix_path(self.deps_cpp_info["libiconv"].rootpath)), + tc.extra_defines.append("IDN2_STATIC") + if is_msvc(self): + tc.extra_cflags.append("-FS") + tc.extra_cxxflags.append("-FS") + tc.configure_args += [ + f"--with-libiconv-prefix={unix_path(self, self.dependencies['libiconv'].package_folder)}", "--disable-nls", "--disable-rpath", ] - self._autotools.configure(args=conf_args, configure_dir=self._source_subfolder) - return self._autotools + tc.generate() + + if is_msvc(self): + env = Environment() + dep_info = self.dependencies["libiconv"].cpp_info.aggregated_components() + env.append("CPPFLAGS", [f"-I{unix_path(self, p)}" for p in dep_info.includedirs] + [f"-D{d}" for d in dep_info.defines]) + env.append("_LINK_", [lib if lib.endswith(".lib") else f"{lib}.lib" for lib in (dep_info.libs + dep_info.system_libs)]) + env.append("LDFLAGS", [f"-L{unix_path(self, p)}" for p in dep_info.libdirs] + dep_info.sharedlinkflags + dep_info.exelinkflags) + env.append("CFLAGS", dep_info.cflags) + env.vars(self).save_script("conanautotoolsdeps_cl_workaround") + else: + deps = AutotoolsDeps(self) + deps.generate() + + if is_msvc(self): + env = Environment() + 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)) + dumpbin_nm = unix_path(self, os.path.join(self.source_folder, "dumpbin_nm.py")) + 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.vars(self).save_script("conanbuild_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() - 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() + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + autotools.install() os.unlink(os.path.join(self.package_folder, "lib", "libidn2.la")) + 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) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) + if is_msvc(self) and self.options.shared: + os.rename(os.path.join(self.package_folder, "lib", "idn2.dll.lib"), + os.path.join(self.package_folder, "lib", "idn2-0.lib")) + copy(self, "idn2.exe", + os.path.join(self.build_folder, "src", ".libs"), + os.path.join(self.package_folder, "bin")) def package_info(self): - self.cpp_info.libs = ["idn2"] - self.cpp_info.names["pkg_config"] = "libidn2" + if is_msvc(self) and self.options.shared: + self.cpp_info.libs = ["idn2-0"] + else: + self.cpp_info.libs = ["idn2"] + self.cpp_info.set_property("pkg_config_name", "libidn2") if self.settings.os == "Windows": if not self.options.shared: self.cpp_info.defines = ["IDN2_STATIC"] 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/libidn2/all/test_package/CMakeLists.txt b/recipes/libidn2/all/test_package/CMakeLists.txt index 7b9b613cbb24a..2279e3cb07d2a 100644 --- a/recipes/libidn2/all/test_package/CMakeLists.txt +++ b/recipes/libidn2/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ -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() +find_package(libidn2 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE libidn2::libidn2) diff --git a/recipes/libidn2/all/test_package/conanfile.py b/recipes/libidn2/all/test_package/conanfile.py index ae0c2ab3c933c..f56ad0548e3d9 100644 --- a/recipes/libidn2/all/test_package/conanfile.py +++ b/recipes/libidn2/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, run=True) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,9 +21,8 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - self.run("idn2 --help", run_environment=True) - - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + self.run("idn2 --help", env="conanrun") + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libidn2/all/test_v1_package/CMakeLists.txt b/recipes/libidn2/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/libidn2/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/libidn2/all/test_v1_package/conanfile.py b/recipes/libidn2/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..a5e01055d3933 --- /dev/null +++ b/recipes/libidn2/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) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self.settings): + self.run("idn2 --help", run_environment=True) + + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) + diff --git a/recipes/libigl/2.x.x/CMakeLists.txt b/recipes/libigl/2.x.x/CMakeLists.txt deleted file mode 100644 index 64994fe16fd84..0000000000000 --- a/recipes/libigl/2.x.x/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 2.8) -project(conanlibigl) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -find_package(Eigen3 REQUIRED) - -add_subdirectory(source_subfolder) diff --git a/recipes/libigl/2.x.x/conandata.yml b/recipes/libigl/2.x.x/conandata.yml deleted file mode 100644 index 1ac5bf040c202..0000000000000 --- a/recipes/libigl/2.x.x/conandata.yml +++ /dev/null @@ -1,8 +0,0 @@ -sources: - "2.3.0": - sha256: 5124443c2657023394039fe56fb240d4f7a867723ee4ebba053eaeb881ed7455 - url: https://github.com/libigl/libigl/archive/refs/tags/v2.3.0.zip -patches: - "2.3.0": - - patch_file: "patches/0001-correct-fpic.patch" - base_path: "source_subfolder" diff --git a/recipes/libigl/2.x.x/conanfile.py b/recipes/libigl/2.x.x/conanfile.py deleted file mode 100644 index f5ac50b8841ac..0000000000000 --- a/recipes/libigl/2.x.x/conanfile.py +++ /dev/null @@ -1,140 +0,0 @@ -import os -from conans import ConanFile, tools, CMake -from conans.errors import ConanInvalidConfiguration - - -class LibiglConan(ConanFile): - name = "libigl" - description = ("Simple C++ geometry processing library") - topics = ("conan", "libigl", "geometry", "matrices", "algorithms") - url = "https://github.com/conan-io/conan-center-index" - exports_sources = ["CMakeLists.txt", "patches/**"] - homepage = "https://libigl.github.io/" - license = "MPL-2.0" - settings = "os", "arch", "compiler", "build_type" - options = {"header_only": [True, False], "fPIC": [True, False]} - default_options = {"header_only": True, "fPIC": True} - generators = "cmake", "cmake_find_package" - requires = ("eigen/3.3.9") - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - - @property - def _minimum_cpp_standard(self): - return 14 - - @property - def _minimum_compilers_version(self): - return { - "Visual Studio": "16", - "gcc": "6", - "clang": "3.4", - "apple-clang": "5.1", - } - - def validate(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)) - if self.settings.compiler == "Visual Studio" and "MT" in self.settings.compiler.runtime and not self.options.header_only: - raise ConanInvalidConfiguration("Visual Studio build with MT runtime is not supported") - if "arm" in self.settings.arch or "x86" is self.settings.arch: - raise ConanInvalidConfiguration("Not available for arm. Requested arch: {}".format(self.settings.arch)) - - def config_options(self): - if self.settings.os == "Windows": - del self.options.fPIC - - def configure(self): - if self.options.header_only: - del self.options.fPIC - - 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], strip_root=True, destination=self._source_subfolder) - - def _configure_cmake(self): - if not self._cmake: - self._cmake = CMake(self, parallel=False) - self._cmake.definitions["LIBIGL_EXPORT_TARGETS"] = True - self._cmake.definitions["LIBIGL_USE_STATIC_LIBRARY"] = not self.options.header_only - - # All these dependencies are needed to build the examples or the tests - self._cmake.definitions["LIBIGL_BUILD_TUTORIALS"] = "OFF" - self._cmake.definitions["LIBIGL_BUILD_TESTS"] = "OFF" - self._cmake.definitions["LIBIGL_BUILD_PYTHON"] = "OFF" - - self._cmake.definitions["LIBIGL_WITH_CGAL"] = False - self._cmake.definitions["LIBIGL_WITH_COMISO"] = False - self._cmake.definitions["LIBIGL_WITH_CORK"] = False - self._cmake.definitions["LIBIGL_WITH_EMBREE"] = False - self._cmake.definitions["LIBIGL_WITH_MATLAB"] = False - self._cmake.definitions["LIBIGL_WITH_MOSEK"] = False - self._cmake.definitions["LIBIGL_WITH_OPENGL"] = False - self._cmake.definitions["LIBIGL_WITH_OPENGL_GLFW"] = False - self._cmake.definitions["LIBIGL_WITH_OPENGL_GLFW_IMGUI"] = False - self._cmake.definitions["LIBIGL_WITH_PNG"] = False - self._cmake.definitions["LIBIGL_WITH_TETGEN"] = False - self._cmake.definitions["LIBIGL_WITH_TRIANGLE"] = False - self._cmake.definitions["LIBIGL_WITH_XML"] = False - self._cmake.definitions["LIBIGL_WITH_PYTHON"] = "OFF" - self._cmake.definitions["LIBIGL_WITH_PREDICATES"] = False - return self._cmake - - def build(self): - self._patch_sources() - cmake = self._configure_cmake() - cmake.configure() - cmake.build() - - def package(self): - cmake = self._configure_cmake() - cmake.install() - self.copy("LICENSE.GPL", dst="licenses", src=self._source_subfolder) - self.copy("LICENSE.MPL2", dst="licenses", src=self._source_subfolder) - - tools.rmdir(os.path.join(self.package_folder, "share")) - if not self.options.header_only: - tools.remove_files_by_mask(self.package_folder, "*.c") - tools.remove_files_by_mask(self.package_folder, "*.cpp") - - def package_id(self): - if self.options.header_only: - self.info.header_only() - - def package_info(self): - self.cpp_info.filenames["cmake_find_package"] = "libigl" - self.cpp_info.filenames["cmake_find_package_multi"] = "libigl" - self.cpp_info.names["cmake_find_package"] = "igl" - self.cpp_info.names["cmake_find_package_multi"] = "igl" - - self.cpp_info.components["igl_common"].names["cmake_find_package"] = "common" - self.cpp_info.components["igl_common"].names["cmake_find_package_multi"] = "common" - self.cpp_info.components["igl_common"].libs = [] - self.cpp_info.components["igl_common"].requires = ["eigen::eigen"] - if self.settings.os == "Linux": - self.cpp_info.components["igl_common"].system_libs = ["pthread"] - - self.cpp_info.components["igl_core"].names["cmake_find_package"] = "core" - self.cpp_info.components["igl_core"].names["cmake_find_package_multi"] = "core" - self.cpp_info.components["igl_core"].requires = ["igl_common"] - if not self.options.header_only: - self.cpp_info.components["igl_core"].libs = ["igl"] - self.cpp_info.components["igl_core"].defines.append("IGL_STATIC_LIBRARY") diff --git a/recipes/libigl/2.x.x/patches/0001-correct-fpic.patch b/recipes/libigl/2.x.x/patches/0001-correct-fpic.patch deleted file mode 100644 index 6a5a6c38650c0..0000000000000 --- a/recipes/libigl/2.x.x/patches/0001-correct-fpic.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/cmake/libigl.cmake b/cmake/libigl.cmake -index 6de1b418..0cc75fcd 100644 ---- a/cmake/libigl.cmake -+++ b/cmake/libigl.cmake -@@ -96,11 +96,6 @@ if(BUILD_SHARED_LIBS) - set_target_properties(igl_common PROPERTIES INTERFACE_POSITION_INDEPENDENT_CODE ON) - endif() - --if(UNIX AND NOT HUNTER_ENABLED) -- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") -- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") --endif() -- - if(HUNTER_ENABLED) - hunter_add_package(Eigen) - find_package(Eigen3 CONFIG REQUIRED) - diff --git a/recipes/libigl/2.x.x/test_package/CMakeLists.txt b/recipes/libigl/2.x.x/test_package/CMakeLists.txt deleted file mode 100644 index 174c1ae49d642..0000000000000 --- a/recipes/libigl/2.x.x/test_package/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(PackageTest CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(libigl REQUIRED CONFIG) - -add_executable(example example.cpp) -target_link_libraries(example igl::core) -target_compile_features(example PUBLIC cxx_std_11) diff --git a/recipes/libigl/all/conan_deps.cmake b/recipes/libigl/all/conan_deps.cmake new file mode 100644 index 0000000000000..4c824341569d9 --- /dev/null +++ b/recipes/libigl/all/conan_deps.cmake @@ -0,0 +1 @@ +find_package(Eigen3 REQUIRED) diff --git a/recipes/libigl/all/conandata.yml b/recipes/libigl/all/conandata.yml new file mode 100644 index 0000000000000..d6842af62c120 --- /dev/null +++ b/recipes/libigl/all/conandata.yml @@ -0,0 +1,13 @@ +sources: + "2.5.0": + url: "https://github.com/libigl/libigl/archive/refs/tags/v2.5.0.zip" + sha256: "84af6a5f9266a4c1ce530f9ef8028c8a3569318563012d72a753622f61ea2f68" + "2.3.0": + url: "https://github.com/libigl/libigl/archive/refs/tags/v2.3.0.zip" + sha256: "5124443c2657023394039fe56fb240d4f7a867723ee4ebba053eaeb881ed7455" +patches: + "2.3.0": + - patch_file: "patches/001-replace-random_shuffle.patch" + patch_type: "portability" + patch_description: "Replace std::random_shuffle that was removed in C++17" + patch_source: "https://github.com/libigl/libigl/commit/3f3d186db7c2f5ce79194c3439134ca5faf2818a" diff --git a/recipes/libigl/all/conanfile.py b/recipes/libigl/all/conanfile.py new file mode 100644 index 0000000000000..232115da3d96e --- /dev/null +++ b/recipes/libigl/all/conanfile.py @@ -0,0 +1,214 @@ +import os + +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration, ConanException +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, replace_in_file, export_conandata_patches, apply_conandata_patches +from conan.tools.microsoft import is_msvc_static_runtime +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" + + +class LibiglConan(ConanFile): + name = "libigl" + description = "Simple C++ geometry processing library" + # As per https://libigl.github.io/license/, the library itself is MPL-2, components are not + # No issue as we don't build them, but if done so in the future, please update this field! + license = "MPL-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://libigl.github.io/" + topics = ("geometry", "matrices", "algorithms", "header-only") + + package_type = "static-library" + settings = "os", "arch", "compiler", "build_type" + options = { + "fPIC": [True, False], + "header_only": [True, False], + } + default_options = { + "fPIC": True, + "header_only": False, + } + + @property + def _minimum_cpp_standard(self): + return 14 + + @property + def _minimum_compilers_version(self): + return { + "Visual Studio": "16", + "msvc": "192", + "gcc": "6", + "clang": "3.4", + "apple-clang": "5.1", + } + + def export_sources(self): + export_conandata_patches(self) + copy(self, "conan_deps.cmake", self.recipe_folder, os.path.join(self.export_sources_folder, "src")) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.header_only: + self.options.rm_safe("fPIC") + # No automatic detection for non "library" package-types, manually override + self.package_type = "header-library" + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + if Version(self.version) >= "2.5.0": + self.requires("eigen/3.4.0", transitive_headers=True) + else: + # 3.4.0 is not compatible with older versions + self.requires("eigen/3.3.9", transitive_headers=True) + + def build_requirements(self): + self.tool_requires("cmake/[>=3.16 <4]") + + def package_id(self): + if self.info.options.header_only: + self.info.clear() + + def validate_build(self): + if (os.getenv('CONAN_CENTER_BUILD_SERVICE') is not None and + Version(self.version) == "2.3.0" and self.settings.build_type == "Debug"): + raise ConanInvalidConfiguration("Debug build disabled from building in CCI due to excessive memory use in ConanCenter CI") + + def validate(self): + if Version(self.version) < "2.4.0" and "arm" in self.settings.arch: + raise ConanInvalidConfiguration(f"Old versions of this library do not support {self.settings.arch} architecture") + if self.settings.arch == "x86": + raise ConanInvalidConfiguration(f"Architecture {self.settings.arch} is not supported") + if is_msvc_static_runtime(self) and not self.options.header_only: + raise ConanInvalidConfiguration("Visual Studio build with MT runtime is not supported") + + def loose_lt_semver(v1, v2): + return all(int(p1) < int(p2) for p1, p2 in zip(str(v1).split("."), str(v2).split("."))) + + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._minimum_cpp_standard) + min_version = self._minimum_compilers_version.get(str(self.settings.compiler)) + if min_version and loose_lt_semver(self.settings.compiler.version, min_version): + raise ConanInvalidConfiguration( + f"{self.name} requires C++{self._minimum_cpp_standard} support. The current compiler" + f" {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 generate(self): + env = VirtualBuildEnv(self) + env.generate() + + tc = CMakeToolchain(self) + tc.variables["CMAKE_PROJECT_libigl_INCLUDE"] = "conan_deps.cmake" + tc.variables["LIBIGL_USE_STATIC_LIBRARY"] = not self.options.header_only + tc.variables["LIBIGL_POSITION_INDEPENDENT_CODE"] = self.options.get_safe("fPIC", True) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0048"] = "NEW" + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + + # All these dependencies are needed to build the examples or the tests + tc.variables["LIBIGL_BUILD_TUTORIALS"] = False + tc.variables["LIBIGL_BUILD_TESTS"] = False + tc.variables["LIBIGL_BUILD_PYTHON"] = False + + if Version(self.version) >= "2.4.0": + tc.variables["LIBIGL_EMBREE"] = False + tc.variables["LIBIGL_GLFW"] = False + tc.variables["LIBIGL_IMGUI"] = False + tc.variables["LIBIGL_OPENGL"] = False + tc.variables["LIBIGL_STB"] = False + tc.variables["LIBIGL_PREDICATES"] = False + tc.variables["LIBIGL_SPECTRA"] = False + tc.variables["LIBIGL_XML"] = False + tc.variables["LIBIGL_COPYLEFT_CORE"] = False + tc.variables["LIBIGL_COPYLEFT_CGAL"] = False + tc.variables["LIBIGL_COPYLEFT_COMISO"] = False + tc.variables["LIBIGL_COPYLEFT_TETGEN"] = False + tc.variables["LIBIGL_RESTRICTED_MATLAB"] = False + tc.variables["LIBIGL_RESTRICTED_MOSEK"] = False + tc.variables["LIBIGL_RESTRICTED_TRIANGLE"] = False + tc.variables["LIBIGL_GLFW_TESTS"] = False + else: + tc.variables["LIBIGL_EXPORT_TARGETS"] = True + tc.variables["LIBIGL_WITH_EMBREE"] = False + tc.variables["LIBIGL_WITH_OPENGL_GLFW"] = False + tc.variables["LIBIGL_WITH_OPENGL_GLFW_IMGUI"] = False + tc.variables["LIBIGL_WITH_OPENGL"] = False + tc.variables["LIBIGL_WITH_PNG"] = False + tc.variables["LIBIGL_WITH_PREDICATES"] = False + tc.variables["LIBIGL_WITH_XML"] = False + tc.variables["LIBIGL_WITH_CGAL"] = False + tc.variables["LIBIGL_WITH_COMISO"] = False + tc.variables["LIBIGL_WITH_CORK"] = False + tc.variables["LIBIGL_WITH_TETGEN"] = False + tc.variables["LIBIGL_WITH_MATLAB"] = False + tc.variables["LIBIGL_WITH_MOSEK"] = False + tc.variables["LIBIGL_WITH_TRIANGLE"] = False + tc.variables["LIBIGL_WITH_PYTHON"] = False + tc.generate() + + deps = CMakeDeps(self) + deps.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + if Version(self.version) < "2.4.0": + libigl_cmake = os.path.join(self.source_folder, "cmake", "libigl.cmake") + replace_in_file(self, libigl_cmake, "-fPIC", "") + replace_in_file(self, libigl_cmake, "INTERFACE_POSITION_INDEPENDENT_CODE ON", "") + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() + try: + cmake.build() + except ConanException: + # Workaround for C3I running out of memory during build + self.conf.define("tools.build:jobs", 1) + cmake.build() + + def package(self): + cmake = CMake(self) + cmake.install() + # If components are built and packaged in the future, uncomment this line, their license is different + # copy(self, "LICENSE.GPL", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, "LICENSE.MPL2", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + if not self.options.header_only: + rm(self, "*.c", self.package_folder, recursive=True) + rm(self, "*.cpp", self.package_folder, recursive=True) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "libigl") + self.cpp_info.set_property("cmake_target_name", "igl::igl") + + self.cpp_info.components["common"].set_property("cmake_target_name", "igl::common") + self.cpp_info.components["common"].requires = ["eigen::eigen"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["common"].system_libs = ["pthread"] + + self.cpp_info.components["core"].set_property("cmake_target_name", "igl::core") + self.cpp_info.components["core"].requires = ["common"] + if not self.options.header_only: + self.cpp_info.components["core"].libs = ["igl"] + self.cpp_info.components["core"].defines.append("IGL_STATIC_LIBRARY") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "libigl" + self.cpp_info.filenames["cmake_find_package_multi"] = "libigl" + self.cpp_info.names["cmake_find_package"] = "igl" + self.cpp_info.names["cmake_find_package_multi"] = "igl" diff --git a/recipes/libigl/all/patches/001-replace-random_shuffle.patch b/recipes/libigl/all/patches/001-replace-random_shuffle.patch new file mode 100644 index 0000000000000..fa53d862ad422 --- /dev/null +++ b/recipes/libigl/all/patches/001-replace-random_shuffle.patch @@ -0,0 +1,31 @@ +From 3f3d186db7c2f5ce79194c3439134ca5faf2818a Mon Sep 17 00:00:00 2001 +From: Jeremie Dumas +Date: Wed, 5 Jan 2022 11:26:47 -0800 +Subject: [PATCH] Fix blue noise random shuffle. + +--- + include/igl/blue_noise.cpp | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/include/igl/blue_noise.cpp b/include/igl/blue_noise.cpp +index ac447feb42..10df1ad1ba 100644 +--- a/include/igl/blue_noise.cpp ++++ b/include/igl/blue_noise.cpp +@@ -15,6 +15,7 @@ + #include + #include + #include ++#include + + namespace igl + { +@@ -209,7 +210,8 @@ namespace igl + } + //printf(" --------\n"); + // randomize order: this might be a little paranoid... +- std::random_shuffle(std::begin(N), std::end(N)); ++ std::mt19937 twister; ++ std::shuffle(std::begin(N), std::end(N), twister); + bool found = false; + for(const BlueNoiseKeyType & nk : N) + { diff --git a/recipes/libigl/all/test_package/CMakeLists.txt b/recipes/libigl/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..eba5d0a0a901d --- /dev/null +++ b/recipes/libigl/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(PackageTest CXX) + +find_package(libigl REQUIRED CONFIG) + +add_executable(example example.cpp) +target_link_libraries(example igl::core) +target_compile_features(example PUBLIC cxx_std_11) diff --git a/recipes/libigl/all/test_package/conanfile.py b/recipes/libigl/all/test_package/conanfile.py new file mode 100644 index 0000000000000..8d52b7021efe1 --- /dev/null +++ b/recipes/libigl/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.bindir, "example") + self.run(bin_path, env="conanrun") diff --git a/recipes/libigl/2.x.x/test_package/example.cpp b/recipes/libigl/all/test_package/example.cpp similarity index 100% rename from recipes/libigl/2.x.x/test_package/example.cpp rename to recipes/libigl/all/test_package/example.cpp diff --git a/recipes/libigl/all/test_v1_package/CMakeLists.txt b/recipes/libigl/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/libigl/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/libigl/2.x.x/test_package/conanfile.py b/recipes/libigl/all/test_v1_package/conanfile.py similarity index 100% rename from recipes/libigl/2.x.x/test_package/conanfile.py rename to recipes/libigl/all/test_v1_package/conanfile.py diff --git a/recipes/libigl/config.yml b/recipes/libigl/config.yml index 58d1203871eb7..7578fb2ee13b0 100644 --- a/recipes/libigl/config.yml +++ b/recipes/libigl/config.yml @@ -1,3 +1,5 @@ versions: + "2.5.0": + folder: "all" "2.3.0": - folder: "2.x.x" + folder: "all" diff --git a/recipes/libinput/all/conandata.yml b/recipes/libinput/all/conandata.yml new file mode 100644 index 0000000000000..541bad5e261c8 --- /dev/null +++ b/recipes/libinput/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.25.0": + url: "https://gitlab.freedesktop.org/libinput/libinput/-/archive/1.25.0/libinput-1.25.0.tar.bz2" + sha256: "193bd592298bd9e369c0ef3e5d83a6a9d68ddc4cd3dfc84bbe77920a8d0d57df" diff --git a/recipes/libinput/all/conanfile.py b/recipes/libinput/all/conanfile.py new file mode 100644 index 0000000000000..0b86139ccb90d --- /dev/null +++ b/recipes/libinput/all/conanfile.py @@ -0,0 +1,154 @@ +import os +import textwrap + +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import copy, get, rmdir, save +from conan.tools.gnu import PkgConfigDeps +from conan.tools.layout import basic_layout +from conan.tools.meson import Meson, MesonToolchain + + +required_conan_version = ">=1.60.0 <2.0 || >=2.0.5" + + +class LibinputConan(ConanFile): + name = "libinput" + description = "libinput is a library that handles input devices for display servers and other applications that need to directly deal with input devices." + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://www.freedesktop.org/wiki/Software/libinput/" + topics = ("device", "display", "event", "input") + package_type = "shared-library" + settings = "os", "arch", "compiler", "build_type" + options = { + "epoll_dir": [None, "ANY"], + "debug_gui": [True, False], + "with_libudev": ["eudev", "systemd"], + "with_libwacom": [True, False], + "with_wayland": [True, False], + "with_x11": [True, False], + } + default_options = { + "epoll_dir": None, + "debug_gui": False, + "with_libudev": "systemd", + # todo Package libwacom and enable this option by default. + "with_libwacom": False, + "with_wayland": True, + "with_x11": True, + } + + @property + def _has_build_profile(self): + return hasattr(self, "settings_build") + + def configure(self): + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + if not self.options.debug_gui: + self.options.rm_safe("with_wayland") + self.options.rm_safe("with_x11") + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("mtdev/1.1.6") + self.requires("libevdev/1.13.1") + + if self.options.debug_gui: + self.requires("cairo/1.18.0") + self.requires("glib/2.78.3") + self.requires("gtk/system") + if self.options.with_wayland: + self.requires("wayland/1.22.0") + if self.options.with_x11: + self.requires("xorg/system") + + if self.options.with_libudev == "systemd": + self.requires("libudev/system", transitive_libs=True) + elif self.options.with_libudev == "eudev": + self.requires("eudev/3.2.14", transitive_libs=True) + + def validate(self): + if self.settings.os not in ["FreeBSD", "Linux"]: + raise ConanInvalidConfiguration(f"{self.ref} is not supported on {self.settings.os}.") + if self.options.with_libwacom: + raise ConanInvalidConfiguration(f"The with_libwacom option for {self.ref} is not yet supported. Contributions welcome.") + + def build_requirements(self): + self.tool_requires("meson/1.3.2") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/2.1.0") + if self.options.get_safe("with_wayland"): + if self._has_build_profile: + self.tool_requires("wayland/") + self.tool_requires("wayland-protocols/1.33") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = VirtualBuildEnv(self) + tc.generate() + if self.options.get_safe("with_wayland") and not self._has_build_profile: + env = VirtualRunEnv(self) + env.generate(scope="build") + + tc = MesonToolchain(self) + tc.project_options["build.pkg_config_path"] = self.generators_folder + tc.project_options["coverity"] = False + tc.project_options["datadir"] = "res" + tc.project_options["documentation"] = False + tc.project_options["epoll-dir"] = '' if self.options.epoll_dir is None else str(self.options.epoll_dir) + tc.project_options["debug-gui"] = self.options.debug_gui + tc.project_options["install-tests"] = False + # Change libexecdir so that the libinput subdirectory in the bin directory doesn't conflict with the libinput executable. + tc.project_options["libexecdir"] = "libexec" + tc.project_options["libwacom"] = self.options.with_libwacom + tc.project_options["tests"] = False + tc.generate() + pkg_config_deps = PkgConfigDeps(self) + if self.options.get_safe("with_wayland"): + if self._has_build_profile: + pkg_config_deps.build_context_activated = ["wayland-protocols"] + else: + # Manually generate pkgconfig file of wayland-protocols since + # PkgConfigDeps.build_context_activated can't work with legacy 1 profile + wp_prefix = self.dependencies.build["wayland-protocols"].package_folder + wp_version = self.dependencies.build["wayland-protocols"].ref.version + wp_pkg_content = textwrap.dedent(f"""\ + prefix={wp_prefix} + datarootdir=${{prefix}}/res + pkgdatadir=${{datarootdir}}/wayland-protocols + Name: Wayland Protocols + Description: Wayland protocol files + Version: {wp_version} + """) + save(self, os.path.join(self.generators_folder, "wayland-protocols.pc"), wp_pkg_content) + pkg_config_deps.generate() + + def build(self): + 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() + + copy(self, f"{self.name}-*", os.path.join(self.package_folder, "libexec", self.name), os.path.join(self.package_folder, "bin")) + rmdir(self, os.path.join(self.package_folder, "libexec")) + + 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, "res", "zsh")) + rmdir(self, os.path.join(self.package_folder, "share")) + + def package_info(self): + self.cpp_info.libs = ["input"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["m", "rt"]) diff --git a/recipes/libinput/all/test_package/conanfile.py b/recipes/libinput/all/test_package/conanfile.py new file mode 100644 index 0000000000000..cdcf9b281723d --- /dev/null +++ b/recipes/libinput/all/test_package/conanfile.py @@ -0,0 +1,32 @@ +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): + 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/1.3.2") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/2.1.0") + + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libinput/all/test_package/meson.build b/recipes/libinput/all/test_package/meson.build new file mode 100644 index 0000000000000..2dea5d2c4a326 --- /dev/null +++ b/recipes/libinput/all/test_package/meson.build @@ -0,0 +1,5 @@ +project('test_package', 'c') +package_dep = dependency('libinput') +executable('test_package', + sources : ['test_package.c'], + dependencies : [package_dep]) diff --git a/recipes/libinput/all/test_package/test_package.c b/recipes/libinput/all/test_package/test_package.c new file mode 100644 index 0000000000000..6a8e1e6d99fe9 --- /dev/null +++ b/recipes/libinput/all/test_package/test_package.c @@ -0,0 +1,54 @@ +#include +#include +#include +#include +#include + +#include +#include + +static int +open_restricted(const char *path, int flags, void *user_data) +{ + int fd = open(path, flags); + return fd < 0 ? -1 : fd; +} + +static void +close_restricted(int fd, void *user_data) +{ + close(fd); +} + +static const struct libinput_interface interface = { + .open_restricted = open_restricted, + .close_restricted = close_restricted, +}; + +int main(void) { + bool grab = false; + struct libinput *li; + struct udev *udev = udev_new(); + if (!udev) { + fprintf(stderr, "Failed to initialize udev\n"); + return EXIT_FAILURE; + } + + li = libinput_udev_create_context(&interface, &grab, udev); + if (!li) { + fprintf(stderr, "Failed to initialize libinput context from udev\n"); + udev_unref(udev); + return EXIT_FAILURE; + } + + if (libinput_udev_assign_seat(li, "seat0")) { + fprintf(stderr, "Failed to set seat\n"); + libinput_unref(li); + li = NULL; + udev_unref(udev); + return EXIT_FAILURE; + } + + udev_unref(udev); + return EXIT_SUCCESS; +} diff --git a/recipes/libinput/config.yml b/recipes/libinput/config.yml new file mode 100644 index 0000000000000..3f07e920910b2 --- /dev/null +++ b/recipes/libinput/config.yml @@ -0,0 +1,3 @@ +versions: + "1.25.0": + folder: all diff --git a/recipes/libinterpolate/all/conandata.yml b/recipes/libinterpolate/all/conandata.yml new file mode 100644 index 0000000000000..a64f016c933a3 --- /dev/null +++ b/recipes/libinterpolate/all/conandata.yml @@ -0,0 +1,17 @@ +sources: + "2.7": + url: + - "https://github.com/CD3/libInterpolate/archive/refs/tags/2.7.tar.gz" + sha256: "a502a00d6aee13e9b8ae9af6fafbcb783d5380835e353a0fc85a586ca7e31e43" + "2.6.4": + url: + - "https://github.com/CD3/libInterpolate/archive/refs/tags/2.6.4.tar.gz" + sha256: "231a39fcc87ffc3e03936f7a21abc78ef309c2f1de79bd3ae72c24d78352d666" + "2.6.3": + url: + - "https://github.com/CD3/libInterpolate/archive/refs/tags/2.6.3.tar.gz" + sha256: "bb2f253c27594b4e56ed9349630086665f529100eac2cd3cba63d198c3a84ff9" + "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..711fe3eaa7335 --- /dev/null +++ b/recipes/libinterpolate/all/conanfile.py @@ -0,0 +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 + + +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") + package_type = "header-library" + 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": "191", + "gcc": "7", + "clang": "4", + "apple-clang": "10", + } + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("boost/1.85.0", transitive_headers=True) + self.requires("eigen/3.4.0", transitive_headers=True) + + def package_id(self): + self.info.clear() + + def validate(self): + if Version(self.version) < "2.6.4" and self.settings.os != "Linux": + raise ConanInvalidConfiguration(f"{self.ref} is not supported by {self.settings.os}; Try the version >= 2.6.4") + if Version(self.version) >= "2.6.4" and self.settings.os not in ["Linux", "Windows", "Macos"]: + raise ConanInvalidConfiguration(f"{self.ref} is not supported by {self.settings.os}.") + 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", "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..711c61c005037 --- /dev/null +++ b/recipes/libinterpolate/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +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) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/libinterpolate/all/test_package/conanfile.py b/recipes/libinterpolate/all/test_package/conanfile.py new file mode 100644 index 0000000000000..e845ae751a301 --- /dev/null +++ b/recipes/libinterpolate/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/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..45546f7415b6d --- /dev/null +++ b/recipes/libinterpolate/config.yml @@ -0,0 +1,9 @@ +versions: + "2.7": + folder: all + "2.6.4": + folder: all + "2.6.3": + folder: all + "2.6.2": + folder: all diff --git a/recipes/libipt/all/CMakeLists.txt b/recipes/libipt/all/CMakeLists.txt deleted file mode 100644 index f62f6ae283c5f..0000000000000 --- a/recipes/libipt/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/libipt/all/conandata.yml b/recipes/libipt/all/conandata.yml index 91a36f41590f6..702bec04ce824 100644 --- a/recipes/libipt/all/conandata.yml +++ b/recipes/libipt/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.0.6": + url: "https://github.com/intel/libipt/archive/v2.0.6.tar.gz" + sha256: "631f4ebc81e12c0493288af3cc307b0de5b65f018d3e3839c87014b0d26acd75" "2.0.5": url: https://github.com/intel/libipt/archive/refs/tags/v2.0.5.tar.gz sha256: 95acf499fdf0a0f5ebd07587bb443c702b1fd79f7d869749824234388b9bff80 diff --git a/recipes/libipt/all/conanfile.py b/recipes/libipt/all/conanfile.py index 73c8a14fe3622..e7687b6d7c00d 100644 --- a/recipes/libipt/all/conanfile.py +++ b/recipes/libipt/all/conanfile.py @@ -1,30 +1,34 @@ -from conans import ConanFile, CMake, tools +import os + +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 + +required_conan_version = ">=1.53.0" -required_conan_version = ">=1.33.0" class LibIptConan(ConanFile): name = "libipt" + description = "Intel(R) Processor Trace Decoder Library" license = "BSD-3-Clause" - homepage = "https://github.com/intel/libipt" url = "https://github.com/conan-io/conan-center-index" - description = "Intel(R) Processor Trace Decoder Library" + homepage = "https://github.com/intel/libipt" topics = ("profiling", "tracing") - settings = "os", "compiler", "build_type", "arch" + + package_type = "library" + 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" - _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": @@ -32,43 +36,35 @@ 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): - pass + 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) - - 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], strip_root=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"]) - - 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.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")) + cmake = CMake(self) cmake.install() def package_info(self): - self.cpp_info.libs = ["libipt"] if self.settings.os == "Windows" else ["ipt"] - self.cpp_info.set_property("cmake_file_name", "libipt") - self.cpp_info.set_property("cmake_target_name", "libipt::libipt") - + if self.settings.os == "Windows": + self.cpp_info.libs = ["libipt"] + else: + self.cpp_info.libs = ["ipt"] diff --git a/recipes/libipt/all/test_package/CMakeLists.txt b/recipes/libipt/all/test_package/CMakeLists.txt index 614fc23d88dda..9f56367278f32 100644 --- a/recipes/libipt/all/test_package/CMakeLists.txt +++ b/recipes/libipt/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(libipt REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/libipt/all/test_package/conanfile.py b/recipes/libipt/all/test_package/conanfile.py index a8c92dea63335..ef5d7042163ec 100644 --- a/recipes/libipt/all/test_package/conanfile.py +++ b/recipes/libipt/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 = "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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libipt/all/test_package/test_package.cpp b/recipes/libipt/all/test_package/test_package.cpp index 6b9e18b8eb133..26def6a295d25 100644 --- a/recipes/libipt/all/test_package/test_package.cpp +++ b/recipes/libipt/all/test_package/test_package.cpp @@ -1,9 +1,8 @@ #include -int main(int argc, char **argv) +int main() { pt_config cfg; pt_config_init(&cfg); - return 0; } diff --git a/recipes/libipt/all/test_v1_package/CMakeLists.txt b/recipes/libipt/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/libipt/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/libipt/all/test_v1_package/conanfile.py b/recipes/libipt/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..a8c92dea63335 --- /dev/null +++ b/recipes/libipt/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +import os + +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.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libipt/config.yml b/recipes/libipt/config.yml index 16ab573dd6bd3..c14d5aed738ae 100644 --- a/recipes/libipt/config.yml +++ b/recipes/libipt/config.yml @@ -1,3 +1,5 @@ versions: + "2.0.6": + folder: all "2.0.5": folder: all diff --git a/recipes/libjpeg-turbo/all/CMakeLists.txt b/recipes/libjpeg-turbo/all/CMakeLists.txt deleted file mode 100644 index 5ab4bc9f0265e..0000000000000 --- a/recipes/libjpeg-turbo/all/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -if(NOT CMAKE_SYSTEM_PROCESSOR) - set(CMAKE_SYSTEM_PROCESSOR ${CONAN_LIBJPEG_TURBO_SYSTEM_PROCESSOR}) -endif() - -add_subdirectory("src") diff --git a/recipes/libjpeg-turbo/all/conandata.yml b/recipes/libjpeg-turbo/all/conandata.yml index dd61b3782fc38..f4f8c634444a1 100644 --- a/recipes/libjpeg-turbo/all/conandata.yml +++ b/recipes/libjpeg-turbo/all/conandata.yml @@ -1,27 +1,22 @@ sources: - "2.1.4": - url: "https://github.com/libjpeg-turbo/libjpeg-turbo/archive/2.1.4.tar.gz" - sha256: "a78b05c0d8427a90eb5b4eb08af25309770c8379592bb0b8a863373128e6143f" - "2.1.3": - url: "https://github.com/libjpeg-turbo/libjpeg-turbo/archive/2.1.3.tar.gz" - sha256: "dbda0c685942aa3ea908496592491e5ec8160d2cf1ec9d5fd5470e50768e7859" - "2.1.2": - url: "https://github.com/libjpeg-turbo/libjpeg-turbo/archive/2.1.2.tar.gz" - sha256: "e7fdc8a255c45bc8fbd9aa11c1a49c23092fcd7379296aeaeb14d3343a3d1bed" - "2.1.1": - url: "https://github.com/libjpeg-turbo/libjpeg-turbo/archive/2.1.1.tar.gz" - sha256: "20e9cd3e5f517950dfb7a300ad344543d88719c254407ffb5ad88d891bf701c4" - "2.1.0": - url: "https://github.com/libjpeg-turbo/libjpeg-turbo/archive/2.1.0.tar.gz" - sha256: "d6b7790927d658108dfd3bee2f0c66a2924c51ee7f9dc930f62c452f4a638c52" + "3.0.4": + url: "https://github.com/libjpeg-turbo/libjpeg-turbo/releases/download/3.0.4/libjpeg-turbo-3.0.4.tar.gz" + sha256: "99130559e7d62e8d695f2c0eaeef912c5828d5b84a0537dcb24c9678c9d5b76b" + "3.0.3": + url: "https://github.com/libjpeg-turbo/libjpeg-turbo/releases/download/3.0.3/libjpeg-turbo-3.0.3.tar.gz" + sha256: "343e789069fc7afbcdfe44dbba7dbbf45afa98a15150e079a38e60e44578865d" + "3.0.2": + url: "https://github.com/libjpeg-turbo/libjpeg-turbo/releases/download/3.0.2/libjpeg-turbo-3.0.2.tar.gz" + sha256: "c2ce515a78d91b09023773ef2770d6b0df77d674e144de80d63e0389b3a15ca6" + "3.0.1": + url: "https://sourceforge.net/projects/libjpeg-turbo/files/3.0.1/libjpeg-turbo-3.0.1.tar.gz" + sha256: "22429507714ae147b3acacd299e82099fce5d9f456882fc28e252e4579ba2a75" + "3.0.0": + url: "https://sourceforge.net/projects/libjpeg-turbo/files/3.0.0/libjpeg-turbo-3.0.0.tar.gz" + sha256: "c77c65fcce3d33417b2e90432e7a0eb05f59a7fff884022a9d931775d583bfaa" + "2.1.5": + url: "https://sourceforge.net/projects/libjpeg-turbo/files/2.1.5/libjpeg-turbo-2.1.5.tar.gz" + sha256: "bc12bc9dce55300c6bf4342bc233bcc26bd38bf289eedf147360d731c668ddaf" "2.0.6": - url: "https://github.com/libjpeg-turbo/libjpeg-turbo/archive/2.0.6.tar.gz" - sha256: "005aee2fcdca252cee42271f7f90574dda64ca6505d9f8b86ae61abc2b426371" - "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" - "2.1.3": - - patch_file: "patches/2.1.3-0001-fix-cmake.patch" + url: "https://sourceforge.net/projects/libjpeg-turbo/files/2.0.6/libjpeg-turbo-2.0.6.tar.gz" + sha256: "d74b92ac33b0e3657123ddcf6728788c90dc84dcb6a52013d758af3c4af481bb" diff --git a/recipes/libjpeg-turbo/all/conanfile.py b/recipes/libjpeg-turbo/all/conanfile.py index 86caf639f776a..ebe4c40f12545 100644 --- a/recipes/libjpeg-turbo/all/conanfile.py +++ b/recipes/libjpeg-turbo/all/conanfile.py @@ -1,20 +1,19 @@ 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.env import VirtualBuildEnv -from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rm, rmdir +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 -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class LibjpegTurboConan(ConanFile): name = "libjpeg-turbo" description = "SIMD-accelerated libjpeg-compatible JPEG codec library" - license = "BSD-3-Clause, Zlib" + license = ("IJG", "BSD-3-Clause", "Zlib") url = "https://github.com/conan-io/conan-center-index" homepage = "https://libjpeg-turbo.org" topics = ("jpeg", "libjpeg", "image", "multimedia", "format", "graphics") @@ -47,49 +46,39 @@ class LibjpegTurboConan(ConanFile): "enable12bit": False, } - 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 + if Version(self.version) >= "3.0.0": + del self.options.enable12bit + del self.options.mem_src_dst 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 - - if self.options.enable12bit: + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + if self.options.get_safe("enable12bit"): del self.options.java del self.options.turbojpeg - if self.options.enable12bit or self.settings.os == "Emscripten": + if self.options.get_safe("enable12bit") or self.settings.os == "Emscripten": del self.options.SIMD - if self.options.enable12bit or self.options.libjpeg7_compatibility or self.options.libjpeg8_compatibility: + if self.options.get_safe("enable12bit") or self.options.libjpeg7_compatibility or self.options.libjpeg8_compatibility: del self.options.arithmetic_encoder del self.options.arithmetic_decoder if self.options.libjpeg8_compatibility: - del self.options.mem_src_dst + self.options.rm_safe("mem_src_dst") def layout(self): cmake_layout(self, src_folder="src") def validate(self): - if self.info.options.enable12bit and (self.info.options.libjpeg7_compatibility or self.info.options.libjpeg8_compatibility): + if self.options.get_safe("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.info.options.get_safe("java") and not self.info.options.shared: + if self.options.get_safe("java") and not self.options.shared: raise ConanInvalidConfiguration("java wrapper requires shared libjpeg-turbo") - 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"{self.ref} shared can't be built with static vc runtime") def build_requirements(self): @@ -97,8 +86,7 @@ def build_requirements(self): self.tool_requires("nasm/2.15.05") 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 _is_arithmetic_encoding_enabled(self): @@ -122,26 +110,18 @@ def generate(self): 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 Version(self.version) < "3.0.0": + tc.variables["WITH_MEM_SRCDST"] = self.options.get_safe("mem_src_dst", False) + tc.variables["WITH_12BIT"] = self.options.enable12bit if is_msvc(self): 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 - if 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)) - tc.variables["CONAN_LIBJPEG_TURBO_SYSTEM_PROCESSOR"] = cmake_system_processor tc.generate() def _patch_sources(self): - apply_conandata_patches(self) - # use standard GNUInstallDirs.cmake - custom one is broken replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "include(cmakescripts/GNUInstallDirs.cmake)", @@ -154,11 +134,12 @@ def _patch_sources(self): def build(self): self._patch_sources() cmake = CMake(self) - cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) + cmake.configure() cmake.build() def package(self): copy(self, "LICENSE.md", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "README.ijg", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) cmake = CMake(self) cmake.install() # remove unneeded directories 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/conanfile.py b/recipes/libjpeg-turbo/all/test_package/conanfile.py index fb5d85902cc52..0a6bc68712d90 100644 --- a/recipes/libjpeg-turbo/all/test_package/conanfile.py +++ b/recipes/libjpeg-turbo/all/test_package/conanfile.py @@ -23,5 +23,4 @@ def build(self): 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, "testimg.jpg") - self.run(f"{bin_path} {img_name}", env="conanrun") + self.run(bin_path, env="conanrun") diff --git a/recipes/libjpeg-turbo/all/test_package/test_package.c b/recipes/libjpeg-turbo/all/test_package/test_package.c index 2f94478d7ef6f..243a65f0efd44 100644 --- a/recipes/libjpeg-turbo/all/test_package/test_package.c +++ b/recipes/libjpeg-turbo/all/test_package/test_package.c @@ -1,528 +1,9 @@ -/* - * rdjpgcom.c - * - * Copyright (C) 1994-1997, Thomas G. Lane. - * Modified 2009 by Bill Allombert, Guido Vollbeding. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains a very simple stand-alone application that displays - * the text in COM (comment) markers in a JFIF file. - * This may be useful as an example of the minimum logic needed to parse - * JPEG markers. - */ - #include -#include -#include - -#define JPEG_CJPEG_DJPEG /* to get the command-line config symbols */ -#include "jpeglib.h" /* get auto-config symbols, */ - -#ifdef HAVE_LOCALE_H -#include /* Bill Allombert: use locale for isprint */ -#endif -#include /* to declare isupper(), tolower() */ -#ifdef USE_SETMODE -#include /* to declare setmode()'s parameter macros */ -/* If you have setmode() but not , just delete this line: */ -#include /* to declare setmode() */ -#endif - -#ifdef USE_CCOMMAND /* command-line reader for Macintosh */ -#ifdef __MWERKS__ -#include /* Metrowerks needs this */ -#include /* ... and this */ -#endif -#ifdef THINK_C -#include /* Think declares it here */ -#endif -#endif - -#ifdef DONT_USE_B_MODE /* define mode parameters for fopen() */ -#define READ_BINARY "r" -#else -#ifdef VMS /* VMS is very nonstandard */ -#define READ_BINARY "rb", "ctx=stm" -#else /* standard ANSI-compliant case */ -#define READ_BINARY "rb" -#endif -#endif - -#ifndef EXIT_FAILURE /* define exit() codes if not provided */ -#define EXIT_FAILURE 1 -#endif -#ifndef EXIT_SUCCESS -#ifdef VMS -#define EXIT_SUCCESS 1 /* VMS is very nonstandard */ -#else -#define EXIT_SUCCESS 0 -#endif -#endif - -/* - * These macros are used to read the input file. - * To reuse this code in another application, you might need to change these. - */ - -static FILE *infile; /* input JPEG file */ - -/* Return next input byte, or EOF if no more */ -#define NEXTBYTE() getc(infile) - -/* Error exit handler */ -#define ERREXIT(msg) (fprintf(stderr, "%s\n", msg), exit(EXIT_FAILURE)) - -/* Read one byte, testing for EOF */ -static int read_1_byte(void) { - int c; - - c = NEXTBYTE(); - if (c == EOF) - ERREXIT("Premature EOF in JPEG file"); - return c; -} - -/* Read 2 bytes, convert to unsigned int */ -/* All 2-byte quantities in JPEG markers are MSB first */ -static unsigned int read_2_bytes(void) { - int c1, c2; - - c1 = NEXTBYTE(); - if (c1 == EOF) - ERREXIT("Premature EOF in JPEG file"); - c2 = NEXTBYTE(); - if (c2 == EOF) - ERREXIT("Premature EOF in JPEG file"); - return (((unsigned int)c1) << 8) + ((unsigned int)c2); -} - -/* - * JPEG markers consist of one or more 0xFF bytes, followed by a marker - * code byte (which is not an FF). Here are the marker codes of interest - * in this program. (See jdmarker.c for a more complete list.) - */ - -#define M_SOF0 0xC0 /* Start Of Frame N */ -#define M_SOF1 0xC1 /* N indicates which compression process */ -#define M_SOF2 0xC2 /* Only SOF0-SOF2 are now in common use */ -#define M_SOF3 0xC3 -#define M_SOF5 0xC5 /* NB: codes C4 and CC are NOT SOF markers */ -#define M_SOF6 0xC6 -#define M_SOF7 0xC7 -#define M_SOF9 0xC9 -#define M_SOF10 0xCA -#define M_SOF11 0xCB -#define M_SOF13 0xCD -#define M_SOF14 0xCE -#define M_SOF15 0xCF -#define M_SOI 0xD8 /* Start Of Image (beginning of datastream) */ -#define M_EOI 0xD9 /* End Of Image (end of datastream) */ -#define M_SOS 0xDA /* Start Of Scan (begins compressed data) */ -#define M_APP0 0xE0 /* Application-specific marker, type N */ -#define M_APP12 0xEC /* (we don't bother to list all 16 APPn's) */ -#define M_COM 0xFE /* COMment */ - -/* - * Find the next JPEG marker and return its marker code. - * We expect at least one FF byte, possibly more if the compressor used FFs - * to pad the file. - * There could also be non-FF garbage between markers. The treatment of such - * garbage is unspecified; we choose to skip over it but emit a warning msg. - * NB: this routine must not be used after seeing SOS marker, since it will - * not deal correctly with FF/00 sequences in the compressed image data... - */ - -static int next_marker(void) { - int c; - int discarded_bytes = 0; - - /* Find 0xFF byte; count and skip any non-FFs. */ - c = read_1_byte(); - while (c != 0xFF) { - discarded_bytes++; - c = read_1_byte(); - } - /* Get marker code byte, swallowing any duplicate FF bytes. Extra FFs - * are legal as pad bytes, so don't count them in discarded_bytes. - */ - do { - c = read_1_byte(); - } while (c == 0xFF); - - if (discarded_bytes != 0) { - fprintf(stderr, "Warning: garbage data found in JPEG file\n"); - } - - return c; -} - -/* - * Read the initial marker, which should be SOI. - * For a JFIF file, the first two bytes of the file should be literally - * 0xFF M_SOI. To be more general, we could use next_marker, but if the - * input file weren't actually JPEG at all, next_marker might read the whole - * file and then return a misleading error message... - */ - -static int first_marker(void) { - int c1, c2; - - c1 = NEXTBYTE(); - c2 = NEXTBYTE(); - if (c1 != 0xFF || c2 != M_SOI) - { - ERREXIT("Not a JPEG file"); - } - return c2; -} - -/* - * Most types of marker are followed by a variable-length parameter segment. - * This routine skips over the parameters for any marker we don't otherwise - * want to process. - * Note that we MUST skip the parameter segment explicitly in order not to - * be fooled by 0xFF bytes that might appear within the parameter segment; - * such bytes do NOT introduce new markers. - */ - -static void skip_variable(void) -/* Skip over an unknown or uninteresting variable-length marker */ -{ - unsigned int length; - - /* Get the marker parameter length count */ - length = read_2_bytes(); - /* Length includes itself, so must be at least 2 */ - if (length < 2) - ERREXIT("Erroneous JPEG marker length"); - length -= 2; - /* Skip over the remaining bytes */ - while (length > 0) { - (void)read_1_byte(); - length--; - } -} - -/* - * Process a COM marker. - * We want to print out the marker contents as legible text; - * we must guard against non-text junk and varying newline representations. - */ - -static void process_COM(int raw) { - unsigned int length; - int ch; - int lastch = 0; - -/* Bill Allombert: set locale properly for isprint */ -#ifdef HAVE_LOCALE_H - setlocale(LC_CTYPE, ""); -#endif - - /* Get the marker parameter length count */ - length = read_2_bytes(); - /* Length includes itself, so must be at least 2 */ - if (length < 2) - ERREXIT("Erroneous JPEG marker length"); - length -= 2; - - while (length > 0) { - ch = read_1_byte(); - if (raw) { - putc(ch, stdout); - /* Emit the character in a readable form. - * Nonprintables are converted to \nnn form, - * while \ is converted to \\. - * Newlines in CR, CR/LF, or LF form will be printed as one newline. - */ - } else if (ch == '\r') { - printf("\n"); - } else if (ch == '\n') { - if (lastch != '\r') - printf("\n"); - } else if (ch == '\\') { - printf("\\\\"); - } else if (isprint(ch)) { - putc(ch, stdout); - } else { - printf("\\%03o", ch); - } - lastch = ch; - length--; - } - printf("\n"); - -/* Bill Allombert: revert to C locale */ -#ifdef HAVE_LOCALE_H - setlocale(LC_CTYPE, "C"); -#endif -} - -/* - * Process a SOFn marker. - * This code is only needed if you want to know the image dimensions... - */ - -static void process_SOFn(int marker) { - unsigned int length; - unsigned int image_height, image_width; - int data_precision, num_components; - const char *process; - int ci; - - length = read_2_bytes(); /* usual parameter length count */ - - data_precision = read_1_byte(); - image_height = read_2_bytes(); - image_width = read_2_bytes(); - num_components = read_1_byte(); - - switch (marker) { - case M_SOF0: - process = "Baseline"; - break; - case M_SOF1: - process = "Extended sequential"; - break; - case M_SOF2: - process = "Progressive"; - break; - case M_SOF3: - process = "Lossless"; - break; - case M_SOF5: - process = "Differential sequential"; - break; - case M_SOF6: - process = "Differential progressive"; - break; - case M_SOF7: - process = "Differential lossless"; - break; - case M_SOF9: - process = "Extended sequential, arithmetic coding"; - break; - case M_SOF10: - process = "Progressive, arithmetic coding"; - break; - case M_SOF11: - process = "Lossless, arithmetic coding"; - break; - case M_SOF13: - process = "Differential sequential, arithmetic coding"; - break; - case M_SOF14: - process = "Differential progressive, arithmetic coding"; - break; - case M_SOF15: - process = "Differential lossless, arithmetic coding"; - break; - default: - process = "Unknown"; - break; - } - - printf("JPEG image is %uw * %uh, %d color components, %d bits per sample\n", - image_width, image_height, num_components, data_precision); - printf("JPEG process: %s\n", process); - - if (length != (unsigned int)(8 + num_components * 3)) - ERREXIT("Bogus SOF marker length"); - - for (ci = 0; ci < num_components; ci++) { - (void)read_1_byte(); /* Component ID code */ - (void)read_1_byte(); /* H, V sampling factors */ - (void)read_1_byte(); /* Quantization table number */ - } -} - -/* - * Parse the marker stream until SOS or EOI is seen; - * display any COM markers. - * While the companion program wrjpgcom will always insert COM markers before - * SOFn, other implementations might not, so we scan to SOS before stopping. - * If we were only interested in the image dimensions, we would stop at SOFn. - * (Conversely, if we only cared about COM markers, there would be no need - * for special code to handle SOFn; we could treat it like other markers.) - */ - -static int scan_JPEG_header(int verbose, int raw) { - int marker; - /* Expect SOI at start of file */ - if (first_marker() != M_SOI) - ERREXIT("Expected SOI marker first"); - - /* Scan miscellaneous markers until we reach SOS. */ - for (;;) { - marker = next_marker(); - switch (marker) { - /* Note that marker codes 0xC4, 0xC8, 0xCC are not, and must not be, - * treated as SOFn. C4 in particular is actually DHT. - */ - case M_SOF0: /* Baseline */ - case M_SOF1: /* Extended sequential, Huffman */ - case M_SOF2: /* Progressive, Huffman */ - case M_SOF3: /* Lossless, Huffman */ - case M_SOF5: /* Differential sequential, Huffman */ - case M_SOF6: /* Differential progressive, Huffman */ - case M_SOF7: /* Differential lossless, Huffman */ - case M_SOF9: /* Extended sequential, arithmetic */ - case M_SOF10: /* Progressive, arithmetic */ - case M_SOF11: /* Lossless, arithmetic */ - case M_SOF13: /* Differential sequential, arithmetic */ - case M_SOF14: /* Differential progressive, arithmetic */ - case M_SOF15: /* Differential lossless, arithmetic */ - if (verbose) - process_SOFn(marker); - else - skip_variable(); - break; - - case M_SOS: /* stop before hitting compressed data */ - return marker; - - case M_EOI: /* in case it's a tables-only JPEG stream */ - return marker; - - case M_COM: - process_COM(raw); - break; - - case M_APP12: - /* Some digital camera makers put useful textual information into - * APP12 markers, so we print those out too when in -verbose mode. - */ - if (verbose) { - printf("APP12 contains:\n"); - process_COM(raw); - } else - skip_variable(); - break; - - default: /* Anything else just gets skipped */ - skip_variable(); /* we assume it has a parameter count... */ - break; - } - } /* end loop */ -} - -/* Command line parsing code */ - -static const char *progname; /* program name for error messages */ - -static void usage(void) -/* complain about bad command line */ -{ - fprintf(stderr, "rdjpgcom displays any textual comments in a JPEG file.\n"); - - fprintf(stderr, "Usage: %s [switches] [inputfile]\n", progname); - - fprintf(stderr, "Switches (names may be abbreviated):\n"); - fprintf( - stderr, - " -raw Display non-printable characters in comments (unsafe)\n"); - fprintf(stderr, " -verbose Also display dimensions of JPEG image\n"); - - exit(EXIT_FAILURE); -} - -static int keymatch(char *arg, const char *keyword, int minchars) -/* Case-insensitive matching of (possibly abbreviated) keyword switches. */ -/* keyword is the constant keyword (must be lower case already), */ -/* minchars is length of minimum legal abbreviation. */ -{ - register int ca, ck; - register int nmatched = 0; - - while ((ca = *arg++) != '\0') { - if ((ck = *keyword++) == '\0') - return 0; /* arg longer than keyword, no good */ - if (isupper(ca)) /* force arg to lcase (assume ck is already) */ - ca = tolower(ca); - if (ca != ck) - return 0; /* no good */ - nmatched++; /* count matched characters */ - } - /* reached end of argument; fail if it's too short for unique abbrev */ - if (nmatched < minchars) - return 0; - return 1; /* A-OK */ -} - -/* - * The main program. - */ - -int main(int argc, char **argv) { - int argn; - char *arg; - int verbose = 1, raw = 0; - -/* On Mac, fetch a command line. */ -#ifdef USE_CCOMMAND - argc = ccommand(&argv); -#endif - - progname = argv[0]; - if (progname == NULL || progname[0] == 0) - progname = "rdjpgcom"; /* in case C library doesn't provide it */ - - /* Parse switches, if any */ - for (argn = 1; argn < argc; argn++) - { - arg = argv[argn]; - if (arg[0] != '-') - break; /* not switch, must be file name */ - arg++; /* advance over '-' */ - if (keymatch(arg, "verbose", 1)) - { - verbose++; - } - else if (keymatch(arg, "raw", 1)) - { - raw = 1; - } - else - usage(); - } - - /* Open the input file. */ - /* Unix style: expect zero or one file name */ - if (argn < argc - 1) - { - fprintf(stderr, "%s: only one input file\n", progname); - usage(); - } - if (argn < argc) - { - if ((infile = fopen(argv[argn], READ_BINARY)) == NULL) - { - fprintf(stderr, "%s: can't open %s\n", progname, argv[argn]); - exit(EXIT_FAILURE); - } - } - else if ((infile = fopen("testimg.jpg", READ_BINARY)) == NULL) - { -/* default input file is stdin */ -#ifdef USE_SETMODE /* need to hack file mode? */ - setmode(fileno(stdin), O_BINARY); -#endif -#ifdef USE_FDOPEN /* need to re-open in binary mode? */ - if ((infile = fdopen(fileno(stdin), READ_BINARY)) == NULL) - { - fprintf(stderr, "%s: can't open stdin\n", progname); - exit(EXIT_FAILURE); - } -#else - infile = stdin; -#endif - } - - /* Scan the JPEG headers. */ - (void)scan_JPEG_header(verbose, raw); +#include "jpeglib.h" - /* All done. */ - exit(EXIT_SUCCESS); - return 0; /* suppress no-return-value warnings */ +int main() { + struct jpeg_decompress_struct info; + struct jpeg_error_mgr err; + info.err = jpeg_std_error(&err); + jpeg_create_decompress(&info); } diff --git a/recipes/libjpeg-turbo/all/test_package/testimg.jpg b/recipes/libjpeg-turbo/all/test_package/testimg.jpg deleted file mode 100644 index a026e486f57de..0000000000000 Binary files a/recipes/libjpeg-turbo/all/test_package/testimg.jpg and /dev/null differ diff --git a/recipes/libjpeg-turbo/all/test_package_module/conanfile.py b/recipes/libjpeg-turbo/all/test_package_module/conanfile.py index fd19bb1425057..0a6bc68712d90 100644 --- a/recipes/libjpeg-turbo/all/test_package_module/conanfile.py +++ b/recipes/libjpeg-turbo/all/test_package_module/conanfile.py @@ -23,5 +23,4 @@ def build(self): 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") + self.run(bin_path, env="conanrun") diff --git a/recipes/libjpeg-turbo/all/test_v1_package/conanfile.py b/recipes/libjpeg-turbo/all/test_v1_package/conanfile.py index a2b04c499e0ac..38f4483872d47 100644 --- a/recipes/libjpeg-turbo/all/test_v1_package/conanfile.py +++ b/recipes/libjpeg-turbo/all/test_v1_package/conanfile.py @@ -14,5 +14,4 @@ def build(self): 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) + self.run(bin_path, run_environment=True) diff --git a/recipes/libjpeg-turbo/all/test_v1_package_module/conanfile.py b/recipes/libjpeg-turbo/all/test_v1_package_module/conanfile.py index b6600e428515c..19e6a0c06e3d8 100644 --- a/recipes/libjpeg-turbo/all/test_v1_package_module/conanfile.py +++ b/recipes/libjpeg-turbo/all/test_v1_package_module/conanfile.py @@ -14,5 +14,4 @@ def build(self): 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) + self.run(bin_path, run_environment=True) diff --git a/recipes/libjpeg-turbo/config.yml b/recipes/libjpeg-turbo/config.yml index 8b2c022f29e5c..584908f335b17 100644 --- a/recipes/libjpeg-turbo/config.yml +++ b/recipes/libjpeg-turbo/config.yml @@ -1,15 +1,15 @@ versions: - "2.1.4": + "3.0.4": folder: all - "2.1.3": + "3.0.3": folder: all - "2.1.2": + "3.0.2": folder: all - "2.1.1": + "3.0.1": folder: all - "2.1.0": + "3.0.0": folder: all - "2.0.6": + "2.1.5": folder: all - "2.0.5": + "2.0.6": folder: all diff --git a/recipes/libjpeg/all/Win32.Mak b/recipes/libjpeg/all/Win32.Mak deleted file mode 100644 index d3345df3a31cf..0000000000000 --- a/recipes/libjpeg/all/Win32.Mak +++ /dev/null @@ -1,671 +0,0 @@ -# Win32.Mak - Win32 application master NMAKE definitions file for the -# Microsoft Windows SDK programming samples -# Copyright (C) Microsoft Corporation -# ------------------------------------------------------------------------- -# This files should be included at the top of all MAKEFILEs as follows: -# !include -# ------------------------------------------------------------------------- -# -# Define APPVER = [ 4.0 | 5.0 | 5.01 | 5.02 | 6.0 | 6.1] prior to including win32.mak to get -# build time checking for version dependencies and to mark the executable -# with version information. -# -# Define TARGETOS = [ WIN95 | WINNT | BOTH ] prior to including win32.mak -# to get some build time checking for platform dependencies. -# -# Define TARGETLANG = [ LANG_JAPANESE | LANG_CHINESE | LANG_KOREAN ] prior -# to including win32.mak to getcompile & link flags for building -# applications to run on Far-East Windows. (This is an optional parameter. -# The system locale is the default.) -# -# Define _WIN32_IE = [ 0x0300 | 0x0400 | 0x0500 | 0x0600 | 0x0700 | 0x0800] prior to including win32.mak to -# get compile and link flags for building applications and components to -# run on Internet Explorer. (This is an optional parameter. IE 4.0 is -# the default.) -# -# ------------------------------------------------------------------------- -# NMAKE Options -# -# Use the table below to determine the additional options for NMAKE to -# generate various application debugging, profiling and performance tuning -# information. -# -# Application Information Type Invoke NMAKE -# ---------------------------- ------------ -# For No Debugging Info nmake nodebug=1 -# For Working Set Tuner Info nmake tune=1 -# For Call Attributed Profiling Info nmake profile=1 -# -# Note: The three options above are mutually exclusive (you may use only -# one to compile/link the application). -# -# Note: creating the environment variables NODEBUG, TUNE, and PROFILE is an -# alternate method to setting these options via the nmake command line. -# -# Note: TUNE and PROFILE do nothing for 64bit compilation -# -# Additional NMAKE Options Invoke NMAKE -# ---------------------------- ------------ -# For No ANSI NULL Compliance nmake no_ansi=1 -# (ANSI NULL is defined as PVOID 0) -# -# ========================================================================= -# Build Rules Quick Start -# -# To build one of the following types of executables, use the specified -# compiler and linker command-line options. -# -# --------------------------------------------------------------------------- -# To build: | Compiler Options | Linker options (pick one -# | | line. con = console, -# | | gui = GUI, ole = GUI OLE) -# --------------------------------------------------------------------------- -# Single threaded | cdebug cflags cvars | ldebug guilflags guilibs -# app with static | | ldebug conlflags conlibs -# CRT | | ldebug guilflags olelibs -# --------------------------------------------------------------------------- -# Multithreaded app | cdebug cflags cvarsmt | ldebug guilflags guilibsmt -# with static CRT | | ldebug conlflags conlibsmt -# | | ldebug guilflags olelibsmt -# --------------------------------------------------------------------------- -# Single or multi- | cdebug cflags cvarsdll | ldebug guilflags guilibsdll -# threaded app with | | ldebug conlflags conlibsdll -# DLL version of CRT | | ldebug guilflags olelibsdll -# (MSVCRT.DLL) | | -# --------------------------------------------------------------------------- -# DLL with static | cdebug cflags cvarsmt | ldebug dlllflags guilibsmt -# CRT* | | ldebug dlllflags conlibsmt -# | | ldebug dlllflags olelibsmt -# --------------------------------------------------------------------------- -# DLL with DLL | cdebug cflags cvarsdll | ldebug dlllflags guilibsdll -# version of CRT | | ldebug dlllflags conlibsdll -# (MSVCRT.DLL) | | ldebug dlllflags olelibsdll -# --------------------------------------------------------------------------- -# -# * Always make DLLs multithreaded because a DLL has no way to know whether -# the calling application has multiple threads, and has no way to prevent -# multithreaded apps from loading it. -# -# To specify an Intel x86 build that defaults to stdcall, add scall to the -# list of compiler options. -# -# ========================================================================= - -!IFNDEF _WIN32_MAK_ -_WIN32_MAK_ = 1 - -# ------------------------------------------------------------------------- -# Get CPU Type - exit if CPU environment variable is not defined -# ------------------------------------------------------------------------- - -# Win95 does not define PROCESSOR_ARCHITECTURE - default to i386 - -!IF "$(PROCESSOR_ARCHITECTURE)" == "" -CPU=i386 -PROCESSOR_ARCHITECTURE=x86 -!endif - -!IF !DEFINED(CPU) || "$(CPU)" == "" -CPU = $(PROCESSOR_ARCHITECTURE) -!ENDIF # CPU - -# if PROCESSOR_ARCHITECTURE was x86 or X86 change CPU to i386 - -!IF ( "$(CPU)" == "X86" ) || ( "$(CPU)" == "x86" ) -CPU = i386 -!ENDIF # CPU == X86 - -!IF "$(CPU)" != "i386" -!IF "$(CPU)" != "IA64" -!IF "$(CPU)" != "AMD64" -!ERROR Must specify CPU environment variable ( CPU=i386, CPU=IA64, CPU=AMD64) -!ENDIF -!ENDIF -!ENDIF - - -# ------------------------------------------------------------------------- -# Get Target Operating System - Default to WINNT -# ------------------------------------------------------------------------- -!IFNDEF TARGETOS -TARGETOS = WINNT -!ENDIF - -!IF "$(TARGETOS)" != "WINNT" -!IF "$(TARGETOS)" != "WIN95" -!IF "$(TARGETOS)" != "BOTH" -!ERROR Must specify TARGETOS environment variable (BOTH, WIN95, WINNT) -!ENDIF -!ENDIF -!ENDIF - -# default to APPVER of 5.0 - -!IFNDEF APPVER -APPVER = 5.0 -!ENDIF - -!IF "$(APPVER)" != "6.1" -!IF "$(APPVER)" != "6.0" -!IF "$(APPVER)" != "5.02" -!IF "$(APPVER)" != "5.01" -!IF "$(APPVER)" != "5.0" -!IF "$(APPVER)" != "4.0" -!ERROR Must specify APPVER environment variable (4.0, 5.0, 5.01, 5.02, 6.0, 6.1) -!ENDIF -!ENDIF -!ENDIF -!ENDIF -!ENDIF -!ENDIF - -!IF "$(APPVER)" =="6.1" -!IFNDEF _WIN32_IE -_WIN32_IE = 0x0800 -!ENDIF # _WIN32_IE -!ENDIF # APPVER == 6.1 - -!IF "$(APPVER)" =="6.0" -!IFNDEF _WIN32_IE -_WIN32_IE = 0x0700 -!ENDIF # _WIN32_IE -!ENDIF # APPVER == 6.0 - -!IF "$(APPVER)" =="5.0" -!IFNDEF _WIN32_IE -_WIN32_IE = 0x0500 -!ENDIF # _WIN32_IE -!ENDIF # APPVER == 5.0 - -!IF "$(APPVER)" =="5.01" -!IFNDEF _WIN32_IE -_WIN32_IE = 0x0600 -!ENDIF # _WIN32_IE -!ENDIF # APPVER == 5.01 - -!IF "$(APPVER)" =="5.02" -!IFNDEF _WIN32_IE -_WIN32_IE = 0x0600 -!ENDIF # _WIN32_IE -!ENDIF # APPVER == 5.02 - -!IFNDEF _WIN32_IE -_WIN32_IE = 0x0400 -!ENDIF - -# ------------------------------------------------------------------------- -# Build tool declarations common to all platforms -# Check to see if Cole Porter is used, otherwise use C/C++ compiler -# ------------------------------------------------------------------------- - -cc = cl -link = link -implib = lib - -midl = midl -rc = Rc -hc = Start /Wait Hcrtf -mc = Mc - -hcvars = -xn - -# ------------------------------------------------------------------------- -# Platform Dependent Compile Flags - must be specified after $(cc) -# -# Note: Debug switches are on by default for current release -# -# These switches set code generation and debugging options for the compiler. -# They also set macros used for conditional compilation. -# -# The debugging switches allow for source level debugging with WinDebug or -# Microsoft Visual C++. -# -# Common compiler flags: -# -c - compile without linking -# -W3 - Set warning level to level 3 (-W4 for 64-bit compilations) -# -Zi - generate debugging information -# -Od - disable all optimizations -# -Ox - use maximum optimizations -# -Zd - generate only public symbols and line numbers for debugging -# -GS - enable security checks -# -# i386 specific compiler flags: -# -Gz - stdcall (only if scall is added to makefile's compiler build rules) -# -# ------------------------------------------------------------------------- - -# declarations common to all compiler options -ccommon = -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS - -# for compatibility with old source code, map {try, except, leave, finally} -# to their proper names (i.e. prefaced by "__") -!IFDEF SEHMAP -ccommon = $(ccommon) -FIsehmap.h -!ENDIF - -!IF "$(TARGETLANG)" == "LANG_JAPANESE" -ccommon = $(ccommon) -DJAPAN -DDBCS -DFE_IME -!ENDIF - -!IF "$(TARGETLANG)" == "LANG_CHINESE" -ccommon = $(ccommon) -DDBCS -DFE_IME -!ENDIF - -!IF "$(TARGETLANG)" == "LANG_KOREAN" -ccommon = $(ccommon) -DDBCS -DFE_IME -!ENDIF - -!IF "$(CPU)" == "i386" -cflags = $(ccommon) -D_X86_=1 -DWIN32 -D_WIN32 -W3 -scall = -Gz - -!ELSEIF "$(CPU)" == "IA64" -cflags = $(ccommon) -D_IA64_=1 -DWIN64 -D_WIN64 -DWIN32 -D_WIN32 -cflags = $(cflags) -W4 -scall = - -!ELSEIF "$(CPU)" == "AMD64" -cflags = $(ccommon) -D_AMD64_=1 -DWIN64 -D_WIN64 -DWIN32 -D_WIN32 -cflags = $(cflags) -W4 -scall = - -!ENDIF - - -!IF "$(APPVER)" == "4.0" -NMAKE_WINVER = 0x0400 -!ELSEIF "$(APPVER)" == "5.0" -NMAKE_WINVER = 0x0500 -!ELSEIF "$(APPVER)" == "5.01" -NMAKE_WINVER = 0x0501 -!ELSEIF "$(APPVER)" == "5.02" -NMAKE_WINVER = 0x0502 -!ELSEIF "$(APPVER)" == "6.0" -NMAKE_WINVER = 0x0600 -!ELSEIF "$(APPVER)" == "6.1" -NMAKE_WINVER = 0x0601 -!ENDIF - -!IF "$(TARGETOS)" == "WINNT" -cflags = $(cflags) -D_WINNT -D_WIN32_WINNT=$(NMAKE_WINVER) -DNTDDI_VERSION=$(NMAKE_WINVER)0000 -!ENDIF - -!IF "$(TARGETOS)" == "WIN95" -cflags = $(cflags) -D_WIN95 -D_WIN32_WINDOWS=$(NMAKE_WINVER) /D_WIN32_DCOM -!ENDIF - -# regardless of the TARGET OS, define compile time WINVER to match APPVER macro -cflags = $(cflags) -D_WIN32_IE=$(_WIN32_IE) -DWINVER=$(NMAKE_WINVER) - - -# Set debugging options - -!IF "$(CPU)" != "IA64" -!IFDEF NODEBUG -cdebug = -Ox -DNDEBUG -!ELSE IFDEF PROFILE -cdebug = -Gh -Ox -DNDEBUG -!ELSE IFDEF TUNE -cdebug = -Gh -Ox -DNDEBUG -!ELSE -cdebug = -Zi -Od -DDEBUG -Fdlibjpeg.pdb -!ENDIF - -!ELSE - -!IFDEF NODEBUG -cdebug = -Ox -DNDEBUG -!ELSE -cdebug = -Zi -Od -DDEBUG -Fdlibjpeg.pdb -!ENDIF - -!ENDIF - -# ------------------------------------------------------------------------- -# Target Module & Subsystem Dependent Compile Defined Variables - must be -# specified after $(cc) -# -# The following table indicates the various acceptable combinations of -# the C Run-Time libraries LIBC, LIBCMT, and MSVCRT respect to the creation -# of a EXE and/or DLL target object. The appropriate compiler flag macros -# that should be used for each combination are also listed. -# -# Executable Type C Runtime Lib Compiler switch -# ------------------------------------------------------------- -# Single threaded app static CRT CVARS * -# Single-threaded app DLL CRT CVARSDLL -# Multi-threaded app static CRT CVARSMT * -# Multi-threaded app DLL CRT CVARSDLL * -# -# Single threaded DLL static CRT CVARS -# Single-threaded DLL DLL CRT CVARSDLL -# Multi-threaded DLL static CRT CVARSMT * -# Multi-threaded DLL DLL CRT CVARSDLL * -# -# * - Denotes the Recommended Configuration -# -# When building single-threaded applications you can link your executable -# with either LIBC, LIBCMT, or MSVCRT, although LIBC will provide the best -# performance. -# -# When building multi-threaded applications, either LIBCMT or MSVCRT can -# be used as the C-Runtime library, as both are multi-thread safe. -# -# Note: Any executable which accesses a DLL linked with MSVCRT.LIB must -# also link with MSVCRT.LIB instead of LIBC.LIB or LIBCMT.LIB. -# When using DLLs, it is recommended that all of the modules be -# linked with MSVCRT.LIB. -# -# Note: The macros of the form xDLL are used when linking the object with -# the DLL version of the C Run-Time (that is, MSVCRT.LIB). They are -# not used when the target object is itself a DLL. -# -# ------------------------------------------------------------------------- - -!IFDEF NO_ANSI -noansi = -DNULL=0 -!ENDIF - - -# for Windows applications that use the C Run-Time libraries -!IFDEF NODEBUG -cvarsmt = $(noansi) -D_MT -MT -cvars = $(cvarsmt) -cvarsdll = $(noansi) -D_MT -D_DLL -MD -!ELSE -cvarsmt = $(noansi) -D_MT -MTd -cvars = $(cvarsmt) -cvarsdll = $(noansi) -D_MT -D_DLL -MDd -!ENDIF - - -# for compatibility with older-style makefiles -cvarsmtdll = $(cvarsdll) - -# for POSIX applications -psxvars = -D_POSIX_ - -# resource compiler -rcflags = /r -!ifdef NODEBUG -rcvars = -DWIN32 -D_WIN32 -DWINVER=$(NMAKE_WINVER) $(noansi) -!else -rcvars = -DWIN32 -D_WIN32 -DWINVER=$(NMAKE_WINVER) -DDEBUG -D_DEBUG $(noansi) -!endif - - -!IF "$(TARGETLANG)" == "LANG_JAPANESE" -rcflags = $(rcflags) /c932 -rcvars = $(rcvars) -DJAPAN -DDBCS -DFE_IME -!ENDIF - -!IF "$(TARGETLANG)" == "LANG_CHINESE" -rcvars = $(rcvars) -DDBCS -DFE_IME -!ENDIF - -!IF "$(TARGETLANG)" == "LANG_KOREAN" -rcvars = $(rcvars) -DDBCS -DFE_IME -!ENDIF - - -# ------------------------------------------------------------------------- -# Platform Dependent MIDL Flags - must be specified after midl -# -# -# ------------------------------------------------------------------------- -!IF "$(TARGETOS)" == "WIN95" -MIDL_OPTIMIZATION=-target NT40 -!ELSEIF "$(TARGETOS)" == "WINNT" -!IF "$(APPVER)" == "5.0" -MIDL_OPTIMIZATION=-target NT50 -!ELSEIF "$(APPVER)" == "6.0" -MIDL_OPTIMIZATION=-target NT60 -!ELSEIF "$(APPVER)" == "6.1" -MIDL_OPTIMIZATION=-target NT61 -!ELSEIF "$(APPVER)" == "5.01" -MIDL_OPTIMIZATION=-target NT51 -!ELSEIF "$(APPVER)" == "5.02" -MIDL_OPTIMIZATION=-target NT51 -!ELSEIF "$(APPVER)" == "4.0" -MIDL_OPTIMIZATION=-target NT40 -!ENDIF -!ENDIF - -!IF "$(CPU)" == "IA64" -MIDL_OPTIMIZATION = $(MIDL_OPTIMIZATION) /ia64 -!ELSEIF "$(CPU)" == "AMD64" -MIDL_OPTIMIZATION = $(MIDL_OPTIMIZATION) /x64 -!ELSE -MIDL_OPTIMIZATION = $(MIDL_OPTIMIZATION) /win32 -!ENDIF - -!IF ("$(TARGETOS)" == "WINNT" ) && ("$(APPVER)" != "4.0") -MIDL_OPTIMIZATION = $(MIDL_OPTIMIZATION) /robust -!ENDIF - - - -# ------------------------------------------------------------------------- -# Platform Dependent Link Flags - must be specified after $(link) -# -# Note: $(DLLENTRY) should be appended to each -entry: flag on the link -# line. -# -# Note: When creating a DLL that uses C Run-Time functions it is -# recommended to include the entry point function of the name DllMain -# in the DLL's source code. Also, the MAKEFILE should include the -# -entry:_DllMainCRTStartup$(DLLENTRY) option for the creation of -# this DLL. (The C Run-Time entry point _DllMainCRTStartup in turn -# calls the DLL defined DllMain entry point.) -# -# ------------------------------------------------------------------------- - -# declarations common to all linker options -lflags = $(lflags) /INCREMENTAL:NO /NOLOGO - -# declarations for use on Intel x86 systems -!IF "$(CPU)" == "i386" -DLLENTRY = @12 -!ENDIF - -# declarations for use on Intel Architecture 64-bit systems -!IF "$(CPU)" == "IA64" -DLLENTRY = -!ENDIF - -# declarations for use on AMD64 systems -!IF "$(CPU)" == "AMD64" -DLLENTRY = -!ENDIF - - -# ------------------------------------------------------------------------- -# Target Module Dependent Link Debug Flags - must be specified after $(link) -# -# These switches allow the inclusion of the necessary symbolic information -# for source level debugging with WinDebug, profiling and/or performance -# tuning. -# -# Note: Debug switches are on by default. -# ------------------------------------------------------------------------- - -!IF "$(CPU)" == "i386" - -!IFDEF NODEBUG -ldebug = /RELEASE -!ELSE -ldebug = /DEBUG /DEBUGTYPE:cv -!ENDIF - -!ELSE - -!IFDEF NODEBUG -ldebug = /RELEASE -!ELSE IFDEF PROFILE -ldebug = /DEBUG:mapped,partial /DEBUGTYPE:coff -!ELSE IFDEF TUNE -ldebug = /DEBUG:mapped,partial /DEBUGTYPE:coff -!ELSE -ldebug = /DEBUG /DEBUGTYPE:cv -!ENDIF - -!ENDIF - -# for compatibility with older-style makefiles -linkdebug = $(ldebug) - - -# ------------------------------------------------------------------------- -# Subsystem Dependent Link Flags - must be specified after $(link) -# -# These switches allow for source level debugging with WinDebug for local -# and global variables. They also provide the standard application type and -# entry point declarations. -# -# Note that on x86 screensavers have a WinMain entrypoint, but on RISC -# platforms it is main. This is a Win95 compatibility issue. -# -# ------------------------------------------------------------------------- - -# Windows 98 needs subsystem version set to 4.10 for version 5.0 features. -!IF ("$(APPVER)" == "5.0") && (("$(TARGETOS)" == "BOTH") || ("$(TARGETOS)" == "WIN95")) -EXEVER = 4.10 -!ELSE -EXEVER = $(APPVER) -!ENDIF - - -# --------------------------------------------- - -# for Windows applications -conlflags = $(lflags) -subsystem:console,$(EXEVER) -guilflags = $(lflags) -subsystem:windows,$(EXEVER) -dlllflags = $(lflags) -entry:_DllMainCRTStartup$(DLLENTRY) -dll - -# For screen savers -!IF "$(CPU)" == "i386" -savlflags = $(lflags) -subsystem:windows,$(EXEVER) -entry:WinMainCRTStartup -!ELSE -savlflags = $(lflags) -subsystem:windows,$(EXEVER) -entry:mainCRTStartup -!ENDIF - -# for POSIX applications -psxlflags = $(lflags) -subsystem:posix -entry:__PosixProcessStartup - -# for compatibility with older-style makefiles -conflags = $(conlflags) -guiflags = $(guilflags) -psxflags = $(psxlflags) - -# ------------------------------------------------------------------------- -# C Run-Time Target Module Dependent Link Libraries -# -# Note: For POSIX applications, link with $(psxlibs). -# ------------------------------------------------------------------------- - -# for POSIX applications -psxlibs = libcpsx.lib psxdll.lib psxrtl.lib oldnames.lib - - -# optional profiling and tuning libraries -!IF "$(CPU)" != "IA64" - -!IFDEF PROFILE -optlibs = cap.lib -!ELSE IFDEF TUNE -optlibs = wst.lib -!ELSE -optlibs = -!ENDIF - -!ELSE -optlibs = -!ENDIF - -# if building for basic Windows 95, use WinSock1, else use WinSock2 -!IF "$(TARGETOS)" == "WIN95" -!IF "$(APPVER)" == "4.0" -winsocklibs = wsock32.lib -!ELSE -winsocklibs = ws2_32.lib mswsock.lib -!ENDIF -!ELSE -winsocklibs = ws2_32.lib mswsock.lib -!ENDIF - - -# basic subsystem specific libraries, less the C Run-Time -baselibs = kernel32.lib $(optlibs) $(winsocklibs) advapi32.lib -winlibs = $(baselibs) user32.lib gdi32.lib comdlg32.lib winspool.lib - -# for Windows applications that use the C Run-Time libraries -conlibs = $(baselibs) -guilibs = $(winlibs) - -# for OLE applications -olelibs = ole32.lib uuid.lib oleaut32.lib $(guilibs) - -#for backwards compatibility -conlibsmt = $(conlibs) -conlibsdll = $(conlibs) -guilibsmt = $(guilibs) -guilibsdll = $(guilibs) -olelibsmt = $(olelibs) -olelibsdll = $(olelibs) - -# for backward compatibility -ole2libs = $(olelibs) -ole2libsmt = $(olelibsmt) -ole2libsdll = $(olelibsdll) - -# Visual Basic -bc = vb6 -bc_exe = /Make -bc_dll = /Makedll - -# Set the Output Directory -!IF ("$(APPVER)" == "6.1") -OUTDIR=WIN7 -!ELSEIF ("$(APPVER)" == "6.0") -OUTDIR=Vista -!ELSEIF "$(APPVER)" == "5.0" -OUTDIR=WIN2000 -!ELSEIF "$(APPVER)" == "5.01" -OUTDIR=XP32 -!ELSEIF "$(APPVER)" == "5.02" -OUTDIR=SRV2003 -!ELSEIF "$(APPVER)" == "4.0" -OUTDIR=NT4 -!ENDIF - -!IF "$(CPU)" == "AMD64" -OUTDIR=$(OUTDIR)_X64 -!ELSEIF "$(CPU)" == "IA64" -OUTDIR=$(OUTDIR)_64 -!ENDIF - -#set Prerelease Out directories -!IF "$(SDKPRERELEASE)" == "1" -OUTDIR=PRE_$(OUTDIR) -!ENDIF - -#Set DEBUG -!IF "$(NODEBUG)" == "" -OUTDIR=$(OUTDIR)_DEBUG -!ELSE -OUTDIR=$(OUTDIR)_RETAIL -!ENDIF - -!IF "$(OS)" == "Windows_NT" -CLEANUP=if exist $(OUTDIR)/$(NULL) rd /s /q $(OUTDIR) -!ELSE -CLEANUP=deltree /y $(OUTDIR) -!ENDIF - -VC6MSG=This sample only compiles with Microsoft Visual C++ 6.0. \ - To compile this run vcvars32.bat for Visual C++ 6.0, and setenv.bat in $(MSSDK). - -WIN64MSG=This sample is currently not supported on the 64 bit platform. - -#ENDIF _WIN32_MAK_ -!ENDIF diff --git a/recipes/libjpeg/all/conandata.yml b/recipes/libjpeg/all/conandata.yml index 772d543a52140..c16f5b9d9e4d8 100644 --- a/recipes/libjpeg/all/conandata.yml +++ b/recipes/libjpeg/all/conandata.yml @@ -1,17 +1,23 @@ sources: + "9f": + url: "https://ijg.org/files/jpegsrc.v9f.tar.gz" + sha256: "04705c110cb2469caa79fb71fba3d7bf834914706e9641a4589485c1f832565b" "9e": - url: "http://ijg.org/files/jpegsrc.v9e.tar.gz" + url: "https://ijg.org/files/jpegsrc.v9e.tar.gz" sha256: "4077d6a6a75aeb01884f708919d25934c93305e49f7e3f36db9129320e6f4f3d" "9d": - url: "http://ijg.org/files/jpegsrc.v9d.tar.gz" + url: "https://ijg.org/files/jpegsrc.v9d.tar.gz" sha256: "2303a6acfb6cc533e0e86e8a9d29f7e6079e118b9de3f96e07a71a11c082fa6a" - "9c": - url: "http://ijg.org/files/jpegsrc.v9c.tar.gz" - sha256: "682aee469c3ca857c4c38c37a6edadbfca4b04d42e56613b11590ec6aa4a278d" patches: + "9f": + - patch_file: "patches/0001-9f-libjpeg-add-msvc-dll-support.patch" + patch_description: "Add support to generate DLL on Windows" + patch_type: "portability" "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" - "9c": - - patch_file: "patches/0001-libjpeg-add-msvc-dll-support.patch" + 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 a3daa952b7fe2..e5205d93bc015 100644 --- a/recipes/libjpeg/all/conanfile.py +++ b/recipes/libjpeg/all/conanfile.py @@ -1,15 +1,16 @@ from conan import ConanFile +from conan.errors import ConanInvalidConfiguration from conan.tools.apple import fix_apple_shared_install_name -from conan.tools.env import Environment, VirtualBuildEnv +from conan.tools.env import 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, unix_path, VCVars +from conan.tools.microsoft import MSBuild, MSBuildToolchain import os import re -import shutil -required_conan_version = ">=1.53.0" + +required_conan_version = ">=1.55.0" class LibjpegConan(ConanFile): @@ -31,15 +32,14 @@ class LibjpegConan(ConanFile): } @property - def _is_clang_cl(self): - return self.settings.os == "Windows" and self.settings.compiler == "clang" + def _is_cl_like(self): + return self.settings.compiler.get_safe("runtime") is not None @property def _settings_build(self): return getattr(self, "settings_build", self.settings) def export_sources(self): - copy(self, "Win32.Mak", src=self.recipe_folder, dst=self.export_sources_folder) export_conandata_patches(self) def config_options(self): @@ -52,35 +52,29 @@ def configure(self): self.settings.rm_safe("compiler.cppstd") self.settings.rm_safe("compiler.libcxx") + def validate(self): + if self.version == "9d" and self.settings.os == "Windows" and self.settings.arch == "armv8": + raise ConanInvalidConfiguration("This version of libjpeg does not support ARM64, please use a newer version") + 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_clang_cl): + if self._settings_build.os == "Windows" and not self._is_cl_like: + self.win_bash = True 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): - 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 is_msvc(self) or self._is_clang_cl: - vc = VCVars(self) - vc.generate() - env = Environment() - env.define("PROFILE", None) - env.define("TUNE", None) - env.define("NODEBUG", None) - # FIXME: 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") - # TODO: there is probably something missing here - # Do we really honor everything from profile (build_type, tools.build:cflags etc)? + if self._is_cl_like: + tc = MSBuildToolchain(self) + tc.cflags.append("-DLIBJPEG_BUILDING") + if not self.options.shared: + tc.cflags.append(" -DLIBJPEG_STATIC") + tc.generate() else: env = VirtualBuildEnv(self) env.generate() @@ -88,45 +82,65 @@ def generate(self): tc.extra_defines.append("LIBJPEG_BUILDING") tc.generate() - def _build_nmake(self): - 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 "), - ) - # clean environment variables that might affect on the build (e.g. if set by Jenkins) - shutil.copy("jconfig.vc", "jconfig.h") - make_args = [ - "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") - 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 is_msvc_static_runtime(self): - replace_in_file(self, "makefile.vc", "(cvars)", "(cvarsmt)") - replace_in_file(self, "makefile.vc", "(conlibs)", "(conlibsmt)") - else: - 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): apply_conandata_patches(self) - if is_msvc(self) or self._is_clang_cl: - self._build_nmake() + if self._is_cl_like: + with chdir(self, self.source_folder): + self.run("nmake /f makefile.vs setupcopy-v16") + + # Rename target to 'libjpeg.lib' to match legacy behaviour (otherwise we break backwards compatibility) + # static: "libjpeg.lib" + # shared: "libjpeg.lib" (import), "libjpeg-9.dll" (DLL) + jpeg_vcxproj = os.path.join(self.source_folder, "jpeg.vcxproj") + target_name = "libjpeg-9" if self.options.shared else "libjpeg" + replace_in_file(self, jpeg_vcxproj, """""", + f""" {target_name} + """) + if self.options.shared: + replace_in_file(self, jpeg_vcxproj, "", + "$(OutDir)libjpeg.lib") + + # Support static/shared + if self.options.shared: + replace_in_file(self, jpeg_vcxproj, + "StaticLibrary", + "DynamicLibrary" + ) + + # Don't force LTO + replace_in_file(self, jpeg_vcxproj, "true", "") + + # Inject conan-generated .props file + # Note: importing it right before Microsoft.Cpp.props also ensures we correctly + # handle the toolset setting + conantoolchain_props = os.path.join(self.generators_folder, MSBuildToolchain.filename) + replace_in_file( + self, jpeg_vcxproj, + """""", + f"""""", + ) + + # Patch settings for a different build type + if self.settings.build_type is not "Release": + replacements = { + "Release": str(self.settings.build_type) + } + if self.settings.build_type == "Debug": + replacements.update({ + "Full": "Disabled", + "NDEBUG;": "_DEBUG;", + }) + for key, value in replacements.items(): + replace_in_file(self, jpeg_vcxproj, key, value) + + replace_in_file(self, os.path.join(self.source_folder, "jpeg.sln"), "Release", str(self.settings.build_type)) + + msbuild = MSBuild(self) + if self.settings.arch == "x86": + # This .sln uses "Win32" instead of the usual "x86" + # as the solution platform, so need to override this + msbuild.platform = "Win32" + msbuild.build(sln="jpeg.sln") else: autotools = Autotools(self) autotools.configure() @@ -134,7 +148,7 @@ def build(self): def package(self): copy(self, "README", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) - if is_msvc(self) or self._is_clang_cl: + if self._is_cl_like: for filename in ["jpeglib.h", "jerror.h", "jconfig.h", "jmorecfg.h"]: copy(self, filename, src=self.source_folder, dst=os.path.join(self.package_folder, "include"), keep_path=False) @@ -143,8 +157,7 @@ def package(self): copy(self, "*.dll", src=self.source_folder, dst=os.path.join(self.package_folder, "bin"), keep_path=False) else: 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)}"]) + autotools.install() if self.settings.os == "Windows" and self.options.shared: rm(self, "*[!.dll]", os.path.join(self.package_folder, "bin")) else: @@ -170,7 +183,7 @@ def package_info(self): 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 "" + prefix = "lib" if self._is_cl_like else "" self.cpp_info.libs = [f"{prefix}jpeg"] self.cpp_info.resdirs = ["res"] if not self.options.shared: diff --git a/recipes/libjpeg/all/patches/0001-9f-libjpeg-add-msvc-dll-support.patch b/recipes/libjpeg/all/patches/0001-9f-libjpeg-add-msvc-dll-support.patch new file mode 100644 index 0000000000000..ac2d14df61117 --- /dev/null +++ b/recipes/libjpeg/all/patches/0001-9f-libjpeg-add-msvc-dll-support.patch @@ -0,0 +1,31 @@ +--- 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. diff --git a/recipes/libjpeg/all/test_package/CMakeLists.txt b/recipes/libjpeg/all/test_package/CMakeLists.txt index f6e52def00111..2506f77d5cc66 100644 --- a/recipes/libjpeg/all/test_package/CMakeLists.txt +++ b/recipes/libjpeg/all/test_package/CMakeLists.txt @@ -1,18 +1,12 @@ cmake_minimum_required(VERSION 3.8) project(test_package LANGUAGES C) -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} PRIVATE JPEG::JPEG) target_compile_features(${PROJECT_NAME} PRIVATE c_std_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(${PROJECT_NAME} PRIVATE _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS) endif() + diff --git a/recipes/libjpeg/all/test_package/conanfile.py b/recipes/libjpeg/all/test_package/conanfile.py index 0243933ba22dd..4e22017cf1618 100644 --- a/recipes/libjpeg/all/test_package/conanfile.py +++ b/recipes/libjpeg/all/test_package/conanfile.py @@ -1,33 +1,20 @@ 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 +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "CMakeDeps", "VirtualRunEnv" + generators = "CMakeDeps", "VirtualRunEnv", "CMakeToolchain" test_type = "explicit" - @property - 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.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) cmake.configure() @@ -36,9 +23,4 @@ def build(self): 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, "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") + self.run(f"{bin_path}", env="conanrun") diff --git a/recipes/libjpeg/all/test_package/test_package.c b/recipes/libjpeg/all/test_package/test_package.c index 2f94478d7ef6f..d23690dd29b19 100644 --- a/recipes/libjpeg/all/test_package/test_package.c +++ b/recipes/libjpeg/all/test_package/test_package.c @@ -1,528 +1,11 @@ -/* - * rdjpgcom.c - * - * Copyright (C) 1994-1997, Thomas G. Lane. - * Modified 2009 by Bill Allombert, Guido Vollbeding. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains a very simple stand-alone application that displays - * the text in COM (comment) markers in a JFIF file. - * This may be useful as an example of the minimum logic needed to parse - * JPEG markers. - */ - #include -#include -#include - -#define JPEG_CJPEG_DJPEG /* to get the command-line config symbols */ -#include "jpeglib.h" /* get auto-config symbols, */ - -#ifdef HAVE_LOCALE_H -#include /* Bill Allombert: use locale for isprint */ -#endif -#include /* to declare isupper(), tolower() */ -#ifdef USE_SETMODE -#include /* to declare setmode()'s parameter macros */ -/* If you have setmode() but not , just delete this line: */ -#include /* to declare setmode() */ -#endif - -#ifdef USE_CCOMMAND /* command-line reader for Macintosh */ -#ifdef __MWERKS__ -#include /* Metrowerks needs this */ -#include /* ... and this */ -#endif -#ifdef THINK_C -#include /* Think declares it here */ -#endif -#endif - -#ifdef DONT_USE_B_MODE /* define mode parameters for fopen() */ -#define READ_BINARY "r" -#else -#ifdef VMS /* VMS is very nonstandard */ -#define READ_BINARY "rb", "ctx=stm" -#else /* standard ANSI-compliant case */ -#define READ_BINARY "rb" -#endif -#endif - -#ifndef EXIT_FAILURE /* define exit() codes if not provided */ -#define EXIT_FAILURE 1 -#endif -#ifndef EXIT_SUCCESS -#ifdef VMS -#define EXIT_SUCCESS 1 /* VMS is very nonstandard */ -#else -#define EXIT_SUCCESS 0 -#endif -#endif - -/* - * These macros are used to read the input file. - * To reuse this code in another application, you might need to change these. - */ - -static FILE *infile; /* input JPEG file */ - -/* Return next input byte, or EOF if no more */ -#define NEXTBYTE() getc(infile) - -/* Error exit handler */ -#define ERREXIT(msg) (fprintf(stderr, "%s\n", msg), exit(EXIT_FAILURE)) - -/* Read one byte, testing for EOF */ -static int read_1_byte(void) { - int c; - - c = NEXTBYTE(); - if (c == EOF) - ERREXIT("Premature EOF in JPEG file"); - return c; -} - -/* Read 2 bytes, convert to unsigned int */ -/* All 2-byte quantities in JPEG markers are MSB first */ -static unsigned int read_2_bytes(void) { - int c1, c2; - - c1 = NEXTBYTE(); - if (c1 == EOF) - ERREXIT("Premature EOF in JPEG file"); - c2 = NEXTBYTE(); - if (c2 == EOF) - ERREXIT("Premature EOF in JPEG file"); - return (((unsigned int)c1) << 8) + ((unsigned int)c2); -} - -/* - * JPEG markers consist of one or more 0xFF bytes, followed by a marker - * code byte (which is not an FF). Here are the marker codes of interest - * in this program. (See jdmarker.c for a more complete list.) - */ - -#define M_SOF0 0xC0 /* Start Of Frame N */ -#define M_SOF1 0xC1 /* N indicates which compression process */ -#define M_SOF2 0xC2 /* Only SOF0-SOF2 are now in common use */ -#define M_SOF3 0xC3 -#define M_SOF5 0xC5 /* NB: codes C4 and CC are NOT SOF markers */ -#define M_SOF6 0xC6 -#define M_SOF7 0xC7 -#define M_SOF9 0xC9 -#define M_SOF10 0xCA -#define M_SOF11 0xCB -#define M_SOF13 0xCD -#define M_SOF14 0xCE -#define M_SOF15 0xCF -#define M_SOI 0xD8 /* Start Of Image (beginning of datastream) */ -#define M_EOI 0xD9 /* End Of Image (end of datastream) */ -#define M_SOS 0xDA /* Start Of Scan (begins compressed data) */ -#define M_APP0 0xE0 /* Application-specific marker, type N */ -#define M_APP12 0xEC /* (we don't bother to list all 16 APPn's) */ -#define M_COM 0xFE /* COMment */ - -/* - * Find the next JPEG marker and return its marker code. - * We expect at least one FF byte, possibly more if the compressor used FFs - * to pad the file. - * There could also be non-FF garbage between markers. The treatment of such - * garbage is unspecified; we choose to skip over it but emit a warning msg. - * NB: this routine must not be used after seeing SOS marker, since it will - * not deal correctly with FF/00 sequences in the compressed image data... - */ - -static int next_marker(void) { - int c; - int discarded_bytes = 0; - - /* Find 0xFF byte; count and skip any non-FFs. */ - c = read_1_byte(); - while (c != 0xFF) { - discarded_bytes++; - c = read_1_byte(); - } - /* Get marker code byte, swallowing any duplicate FF bytes. Extra FFs - * are legal as pad bytes, so don't count them in discarded_bytes. - */ - do { - c = read_1_byte(); - } while (c == 0xFF); - - if (discarded_bytes != 0) { - fprintf(stderr, "Warning: garbage data found in JPEG file\n"); - } - - return c; -} - -/* - * Read the initial marker, which should be SOI. - * For a JFIF file, the first two bytes of the file should be literally - * 0xFF M_SOI. To be more general, we could use next_marker, but if the - * input file weren't actually JPEG at all, next_marker might read the whole - * file and then return a misleading error message... - */ - -static int first_marker(void) { - int c1, c2; - - c1 = NEXTBYTE(); - c2 = NEXTBYTE(); - if (c1 != 0xFF || c2 != M_SOI) - { - ERREXIT("Not a JPEG file"); - } - return c2; -} - -/* - * Most types of marker are followed by a variable-length parameter segment. - * This routine skips over the parameters for any marker we don't otherwise - * want to process. - * Note that we MUST skip the parameter segment explicitly in order not to - * be fooled by 0xFF bytes that might appear within the parameter segment; - * such bytes do NOT introduce new markers. - */ - -static void skip_variable(void) -/* Skip over an unknown or uninteresting variable-length marker */ -{ - unsigned int length; - - /* Get the marker parameter length count */ - length = read_2_bytes(); - /* Length includes itself, so must be at least 2 */ - if (length < 2) - ERREXIT("Erroneous JPEG marker length"); - length -= 2; - /* Skip over the remaining bytes */ - while (length > 0) { - (void)read_1_byte(); - length--; - } -} - -/* - * Process a COM marker. - * We want to print out the marker contents as legible text; - * we must guard against non-text junk and varying newline representations. - */ - -static void process_COM(int raw) { - unsigned int length; - int ch; - int lastch = 0; - -/* Bill Allombert: set locale properly for isprint */ -#ifdef HAVE_LOCALE_H - setlocale(LC_CTYPE, ""); -#endif - - /* Get the marker parameter length count */ - length = read_2_bytes(); - /* Length includes itself, so must be at least 2 */ - if (length < 2) - ERREXIT("Erroneous JPEG marker length"); - length -= 2; - - while (length > 0) { - ch = read_1_byte(); - if (raw) { - putc(ch, stdout); - /* Emit the character in a readable form. - * Nonprintables are converted to \nnn form, - * while \ is converted to \\. - * Newlines in CR, CR/LF, or LF form will be printed as one newline. - */ - } else if (ch == '\r') { - printf("\n"); - } else if (ch == '\n') { - if (lastch != '\r') - printf("\n"); - } else if (ch == '\\') { - printf("\\\\"); - } else if (isprint(ch)) { - putc(ch, stdout); - } else { - printf("\\%03o", ch); - } - lastch = ch; - length--; - } - printf("\n"); - -/* Bill Allombert: revert to C locale */ -#ifdef HAVE_LOCALE_H - setlocale(LC_CTYPE, "C"); -#endif -} - -/* - * Process a SOFn marker. - * This code is only needed if you want to know the image dimensions... - */ - -static void process_SOFn(int marker) { - unsigned int length; - unsigned int image_height, image_width; - int data_precision, num_components; - const char *process; - int ci; - - length = read_2_bytes(); /* usual parameter length count */ - - data_precision = read_1_byte(); - image_height = read_2_bytes(); - image_width = read_2_bytes(); - num_components = read_1_byte(); - - switch (marker) { - case M_SOF0: - process = "Baseline"; - break; - case M_SOF1: - process = "Extended sequential"; - break; - case M_SOF2: - process = "Progressive"; - break; - case M_SOF3: - process = "Lossless"; - break; - case M_SOF5: - process = "Differential sequential"; - break; - case M_SOF6: - process = "Differential progressive"; - break; - case M_SOF7: - process = "Differential lossless"; - break; - case M_SOF9: - process = "Extended sequential, arithmetic coding"; - break; - case M_SOF10: - process = "Progressive, arithmetic coding"; - break; - case M_SOF11: - process = "Lossless, arithmetic coding"; - break; - case M_SOF13: - process = "Differential sequential, arithmetic coding"; - break; - case M_SOF14: - process = "Differential progressive, arithmetic coding"; - break; - case M_SOF15: - process = "Differential lossless, arithmetic coding"; - break; - default: - process = "Unknown"; - break; - } - - printf("JPEG image is %uw * %uh, %d color components, %d bits per sample\n", - image_width, image_height, num_components, data_precision); - printf("JPEG process: %s\n", process); - - if (length != (unsigned int)(8 + num_components * 3)) - ERREXIT("Bogus SOF marker length"); - - for (ci = 0; ci < num_components; ci++) { - (void)read_1_byte(); /* Component ID code */ - (void)read_1_byte(); /* H, V sampling factors */ - (void)read_1_byte(); /* Quantization table number */ - } -} - -/* - * Parse the marker stream until SOS or EOI is seen; - * display any COM markers. - * While the companion program wrjpgcom will always insert COM markers before - * SOFn, other implementations might not, so we scan to SOS before stopping. - * If we were only interested in the image dimensions, we would stop at SOFn. - * (Conversely, if we only cared about COM markers, there would be no need - * for special code to handle SOFn; we could treat it like other markers.) - */ - -static int scan_JPEG_header(int verbose, int raw) { - int marker; - /* Expect SOI at start of file */ - if (first_marker() != M_SOI) - ERREXIT("Expected SOI marker first"); - - /* Scan miscellaneous markers until we reach SOS. */ - for (;;) { - marker = next_marker(); - switch (marker) { - /* Note that marker codes 0xC4, 0xC8, 0xCC are not, and must not be, - * treated as SOFn. C4 in particular is actually DHT. - */ - case M_SOF0: /* Baseline */ - case M_SOF1: /* Extended sequential, Huffman */ - case M_SOF2: /* Progressive, Huffman */ - case M_SOF3: /* Lossless, Huffman */ - case M_SOF5: /* Differential sequential, Huffman */ - case M_SOF6: /* Differential progressive, Huffman */ - case M_SOF7: /* Differential lossless, Huffman */ - case M_SOF9: /* Extended sequential, arithmetic */ - case M_SOF10: /* Progressive, arithmetic */ - case M_SOF11: /* Lossless, arithmetic */ - case M_SOF13: /* Differential sequential, arithmetic */ - case M_SOF14: /* Differential progressive, arithmetic */ - case M_SOF15: /* Differential lossless, arithmetic */ - if (verbose) - process_SOFn(marker); - else - skip_variable(); - break; - - case M_SOS: /* stop before hitting compressed data */ - return marker; - - case M_EOI: /* in case it's a tables-only JPEG stream */ - return marker; - - case M_COM: - process_COM(raw); - break; - - case M_APP12: - /* Some digital camera makers put useful textual information into - * APP12 markers, so we print those out too when in -verbose mode. - */ - if (verbose) { - printf("APP12 contains:\n"); - process_COM(raw); - } else - skip_variable(); - break; - - default: /* Anything else just gets skipped */ - skip_variable(); /* we assume it has a parameter count... */ - break; - } - } /* end loop */ -} - -/* Command line parsing code */ - -static const char *progname; /* program name for error messages */ - -static void usage(void) -/* complain about bad command line */ -{ - fprintf(stderr, "rdjpgcom displays any textual comments in a JPEG file.\n"); - - fprintf(stderr, "Usage: %s [switches] [inputfile]\n", progname); - - fprintf(stderr, "Switches (names may be abbreviated):\n"); - fprintf( - stderr, - " -raw Display non-printable characters in comments (unsafe)\n"); - fprintf(stderr, " -verbose Also display dimensions of JPEG image\n"); - - exit(EXIT_FAILURE); -} - -static int keymatch(char *arg, const char *keyword, int minchars) -/* Case-insensitive matching of (possibly abbreviated) keyword switches. */ -/* keyword is the constant keyword (must be lower case already), */ -/* minchars is length of minimum legal abbreviation. */ -{ - register int ca, ck; - register int nmatched = 0; - - while ((ca = *arg++) != '\0') { - if ((ck = *keyword++) == '\0') - return 0; /* arg longer than keyword, no good */ - if (isupper(ca)) /* force arg to lcase (assume ck is already) */ - ca = tolower(ca); - if (ca != ck) - return 0; /* no good */ - nmatched++; /* count matched characters */ - } - /* reached end of argument; fail if it's too short for unique abbrev */ - if (nmatched < minchars) - return 0; - return 1; /* A-OK */ -} - -/* - * The main program. - */ - -int main(int argc, char **argv) { - int argn; - char *arg; - int verbose = 1, raw = 0; - -/* On Mac, fetch a command line. */ -#ifdef USE_CCOMMAND - argc = ccommand(&argv); -#endif - - progname = argv[0]; - if (progname == NULL || progname[0] == 0) - progname = "rdjpgcom"; /* in case C library doesn't provide it */ - - /* Parse switches, if any */ - for (argn = 1; argn < argc; argn++) - { - arg = argv[argn]; - if (arg[0] != '-') - break; /* not switch, must be file name */ - arg++; /* advance over '-' */ - if (keymatch(arg, "verbose", 1)) - { - verbose++; - } - else if (keymatch(arg, "raw", 1)) - { - raw = 1; - } - else - usage(); - } - - /* Open the input file. */ - /* Unix style: expect zero or one file name */ - if (argn < argc - 1) - { - fprintf(stderr, "%s: only one input file\n", progname); - usage(); - } - if (argn < argc) - { - if ((infile = fopen(argv[argn], READ_BINARY)) == NULL) - { - fprintf(stderr, "%s: can't open %s\n", progname, argv[argn]); - exit(EXIT_FAILURE); - } - } - else if ((infile = fopen("testimg.jpg", READ_BINARY)) == NULL) - { -/* default input file is stdin */ -#ifdef USE_SETMODE /* need to hack file mode? */ - setmode(fileno(stdin), O_BINARY); -#endif -#ifdef USE_FDOPEN /* need to re-open in binary mode? */ - if ((infile = fdopen(fileno(stdin), READ_BINARY)) == NULL) - { - fprintf(stderr, "%s: can't open stdin\n", progname); - exit(EXIT_FAILURE); - } -#else - infile = stdin; -#endif - } - - /* Scan the JPEG headers. */ - (void)scan_JPEG_header(verbose, raw); - - /* All done. */ - exit(EXIT_SUCCESS); - return 0; /* suppress no-return-value warnings */ +#include "jpeglib.h" +#include "transupp.h" + +int main() { + struct jpeg_decompress_struct info; + struct jpeg_error_mgr err; + info.err = jpeg_std_error(&err); + jpeg_create_decompress(&info); + printf("libjpeg test successful\n"); } diff --git a/recipes/libjpeg/all/test_package/test_transupp.c b/recipes/libjpeg/all/test_package/test_transupp.c deleted file mode 100644 index 188c5655a0762..0000000000000 --- a/recipes/libjpeg/all/test_package/test_transupp.c +++ /dev/null @@ -1,96 +0,0 @@ -#include -#include -#include - -#include "jpeglib.h" -#include "jpegint.h" -#include "transupp.h" - -struct error_data { - struct jpeg_error_mgr pub; - const char *name; -}; - - -static void -my_error_handler(j_common_ptr cinfo) { - struct error_data *data = (struct error_data *) cinfo; - while(1) { - fprintf(stderr, "-"); - } - fprintf(stderr, "%s:\n", data->name); - fflush(stdout); - fflush(stderr); - (*cinfo->err->output_message) (cinfo); - exit(2); -} - -int main(int argc, char *argv[]) { - if (argc < 3) { - fprintf(stderr, "Usage: %s \n", argv[0]); - return 1; - } - - struct error_data err_in; - err_in.name = "input"; - err_in.pub.error_exit = my_error_handler; - - struct error_data err_out; - err_out.name = "output"; - err_out.pub.error_exit = my_error_handler; - - FILE *fin = fopen(argv[1], "rb"); - - struct jpeg_decompress_struct src; - struct jpeg_compress_struct dst; - - src.err = jpeg_std_error(&err_in.pub); - jpeg_create_decompress(&src); - - dst.err = jpeg_std_error(&err_in.pub); - jpeg_create_compress(&dst); - - jpeg_stdio_src(&src, fin); - - jcopy_markers_setup(&src, JCOPYOPT_ALL); - - (void)jpeg_read_header(&src, TRUE); - - jpeg_transform_info transform = { - .transform = JXFORM_ROT_180, - }; - - if ((src.image_width % 2) || (dst.image_height % 2)) { - fprintf(stderr, "The input image is odd-sized. The transform will not be correct.\n"); - } - - if (!jtransform_request_workspace(&src, &transform)) { - fprintf(stderr, "Can only transform odd-size images perfectly.\n"); - return 3; - } - - jvirt_barray_ptr *src_coeffs = jpeg_read_coefficients(&src); - jpeg_copy_critical_parameters(&src, &dst); - - jvirt_barray_ptr *dst_coefs = jtransform_adjust_parameters(&src, &dst, src_coeffs, &transform); - - - FILE *fout = fopen(argv[2], "wb"); - jpeg_stdio_dest(&dst, fout); - - jpeg_write_coefficients(&dst, dst_coefs); - - jcopy_markers_execute(&src, &dst, JCOPYOPT_ALL); - jtransform_execute_transformation(&src, &dst, src_coeffs, &transform); - - jpeg_finish_compress(&dst); - jpeg_destroy_compress(&dst); - fclose(fout); - - jpeg_finish_decompress(&src); - jpeg_destroy_decompress(&src); - fclose(fin); - - printf("Done\n"); - return 0; -} diff --git a/recipes/libjpeg/all/test_package/testimg.jpg b/recipes/libjpeg/all/test_package/testimg.jpg deleted file mode 100644 index a026e486f57de..0000000000000 Binary files a/recipes/libjpeg/all/test_package/testimg.jpg and /dev/null differ diff --git a/recipes/libjpeg/all/test_v1_package/CMakeLists.txt b/recipes/libjpeg/all/test_v1_package/CMakeLists.txt deleted file mode 100644 index e6eccdbfe8184..0000000000000 --- a/recipes/libjpeg/all/test_v1_package/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -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) - -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) - -add_executable(test_transupp ../test_package/test_transupp.c "${CONAN_LIBJPEG_ROOT}/res/transupp.c") -target_link_libraries(test_transupp PRIVATE JPEG::JPEG) -target_compile_features(test_transupp PRIVATE c_std_99) diff --git a/recipes/libjpeg/all/test_v1_package/conanfile.py b/recipes/libjpeg/all/test_v1_package/conanfile.py deleted file mode 100644 index d9893410defb6..0000000000000 --- a/recipes/libjpeg/all/test_v1_package/conanfile.py +++ /dev/null @@ -1,28 +0,0 @@ -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" - - @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.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 6c44911f307cd..182822cf7c426 100644 --- a/recipes/libjpeg/config.yml +++ b/recipes/libjpeg/config.yml @@ -1,7 +1,7 @@ versions: + "9f": + folder: all "9e": folder: all "9d": folder: all - "9c": - folder: all diff --git a/recipes/libjuice/all/conandata.yml b/recipes/libjuice/all/conandata.yml new file mode 100644 index 0000000000000..709595aa5dc9d --- /dev/null +++ b/recipes/libjuice/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.5.7": + url: "https://github.com/paullouisageneau/libjuice/archive/refs/tags/v1.5.7.tar.gz" + sha256: "6385c574f3c33f766ed25cddf919625b0ae8ca0d76871f70301e5a0cf2c93dc8" diff --git a/recipes/libjuice/all/conanfile.py b/recipes/libjuice/all/conanfile.py new file mode 100644 index 0000000000000..e759ffe21c47f --- /dev/null +++ b/recipes/libjuice/all/conanfile.py @@ -0,0 +1,85 @@ +import os + +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, rm, rmdir +from conan.tools.microsoft import is_msvc +from conan.tools.apple import fix_apple_shared_install_name + +required_conan_version = ">=2.1" + +class libjuiceConan(ConanFile): + name = "libjuice" + description = "JUICE is a UDP Interactive Connectivity Establishment library." + license = "MPL-2.0" + topics = ("webrtc", "ice") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/paullouisageneau/libjuice" + settings = "os", "compiler", "build_type", "arch" + package_type = "library" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + implements = ["auto_shared_fpic"] + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + check_min_cppstd(self, 11) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["NO_TESTS"] = True + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + fix_apple_shared_install_name(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, "*.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): + suffix = "" + if is_msvc(self) and self.settings.build_type == "Debug": + suffix = "d" + self.cpp_info.libs = ["juice" + suffix] + self.cpp_info.set_property("cmake_file_name", "LibJuice") + if self.options.shared: + self.cpp_info.set_property("cmake_target_name", "LibJuice::LibJuice") + else: + self.cpp_info.set_property("cmake_target_name", "LibJuice::LibJuiceStatic") + self.cpp_info.defines.append("JUICE_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.system_libs.append("dl") + + if self.settings.os == "Windows": + self.cpp_info.system_libs.extend(["ws2_32", "bcrypt"]) + + if is_msvc(self): + self.cpp_info.cxxflags.append("/bigobj") diff --git a/recipes/libjuice/all/test_package/CMakeLists.txt b/recipes/libjuice/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..adc79b68b2a92 --- /dev/null +++ b/recipes/libjuice/all/test_package/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.15) + +project(test_package LANGUAGES CXX) # if the project uses c++ + +find_package(LibJuice REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) + +if (BUILD_SHARED_LIBS) + target_link_libraries(${PROJECT_NAME} PRIVATE LibJuice::LibJuice) +else() + target_link_libraries(${PROJECT_NAME} PRIVATE LibJuice::LibJuiceStatic) +endif() diff --git a/recipes/libjuice/all/test_package/conanfile.py b/recipes/libjuice/all/test_package/conanfile.py new file mode 100644 index 0000000000000..b4cab38c13121 --- /dev/null +++ b/recipes/libjuice/all/test_package/conanfile.py @@ -0,0 +1,32 @@ +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", "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["BUILD_SHARED_LIBS"] = self.dependencies[self.tested_reference_str].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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libjuice/all/test_package/test_package.cpp b/recipes/libjuice/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..68cc9df88eee3 --- /dev/null +++ b/recipes/libjuice/all/test_package/test_package.cpp @@ -0,0 +1,8 @@ +#include +#include + +int main(void) { + juice_config config; + juice_set_log_level(JUICE_LOG_LEVEL_WARN); + return EXIT_SUCCESS; +} diff --git a/recipes/libjuice/config.yml b/recipes/libjuice/config.yml new file mode 100644 index 0000000000000..63812c2d2c8db --- /dev/null +++ b/recipes/libjuice/config.yml @@ -0,0 +1,3 @@ +versions: + "1.5.7": + folder: all diff --git a/recipes/libjxl/all/CMakeLists.txt b/recipes/libjxl/all/CMakeLists.txt deleted file mode 100644 index c986d294c7547..0000000000000 --- a/recipes/libjxl/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/libjxl/all/conan_deps.cmake b/recipes/libjxl/all/conan_deps.cmake new file mode 100644 index 0000000000000..e62d6fec8071b --- /dev/null +++ b/recipes/libjxl/all/conan_deps.cmake @@ -0,0 +1,24 @@ +find_package(Brotli REQUIRED CONFIG) +find_package(HWY REQUIRED CONFIG) +find_package(LCMS2 REQUIRED CONFIG) + +# Add wrapper targets for the project to link against +add_library(brotlicommon INTERFACE) +target_link_libraries(brotlicommon INTERFACE brotli::brotli) +set_target_properties(brotlicommon PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${Brotli_INCLUDE_DIRS}") +set_target_properties(brotlicommon PROPERTIES INCLUDE_DIRECTORIES "${Brotli_INCLUDE_DIRS}") +add_library(brotlidec ALIAS brotlicommon) +add_library(brotlienc ALIAS brotlicommon) +add_library(brotlicommon-static ALIAS brotlicommon) +add_library(brotlidec-static ALIAS brotlicommon) +add_library(brotlienc-static ALIAS brotlicommon) + +add_library(hwy INTERFACE) +target_link_libraries(hwy INTERFACE highway::highway) +set_target_properties(hwy PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${HWY_INCLUDE_DIRS}") +set_target_properties(hwy PROPERTIES INCLUDE_DIRECTORIES "${HWY_INCLUDE_DIRS}") + +add_library(lcms2 INTERFACE) +target_link_libraries(lcms2 INTERFACE lcms::lcms) +set_target_properties(lcms2 PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${LCMS2_INCLUDE_DIRS}") +set_target_properties(lcms2 PROPERTIES INCLUDE_DIRECTORIES "${LCMS2_INCLUDE_DIRS}") diff --git a/recipes/libjxl/all/conandata.yml b/recipes/libjxl/all/conandata.yml index 8a3abcae1301c..bfe21c7baaca3 100644 --- a/recipes/libjxl/all/conandata.yml +++ b/recipes/libjxl/all/conandata.yml @@ -1,18 +1,10 @@ sources: - "0.5.0": - url: "https://github.com/libjxl/libjxl/archive/v0.5.zip" - sha256: "a208be41542c6f81f10a82c6bb4bc75d3eceb9d4f7ecb6ea0ad2f2d236694c4b" - "0.6.1": - url: "https://github.com/libjxl/libjxl/archive/v0.6.1.zip" - sha256: "3e4877daef07724aa6f490bf80c45ada804f35fe3cce59c27e89c5ae3099535a" -patches: - "0.5.0": - - patch_file: "patches/0001-clean-targets-v0.5.patch" - base_path: "source_subfolder" - - patch_file: "patches/0002-fix-dependencies-v0.5.patch" - base_path: "source_subfolder" - "0.6.1": - - patch_file: "patches/0001-clean-targets-v0.6.patch" - base_path: "source_subfolder" - - patch_file: "patches/0002-fix-dependencies-v0.6.patch" - base_path: "source_subfolder" + "0.10.3": + url: "https://github.com/libjxl/libjxl/archive/v0.10.3.zip" + sha256: "a9e2103f61ab79f5561b506ad03fcba33207263284b1a796eba3ca826ab0a75f" + "0.10.2": + url: "https://github.com/libjxl/libjxl/archive/v0.10.2.zip" + sha256: "910ab4245eebe0fba801a057f5fbc4fe96dad7c9979880bb49ad3e2623a911a2" + "0.8.2": + url: "https://github.com/libjxl/libjxl/archive/v0.8.2.zip" + sha256: "1f2ccc06f07c4f6cf4aa6c7763ba0598f12a7544d597f02beb07f615eb08ccf0" diff --git a/recipes/libjxl/all/conanfile.py b/recipes/libjxl/all/conanfile.py index a8d214a9a78ab..e7c69a5172e12 100644 --- a/recipes/libjxl/all/conanfile.py +++ b/recipes/libjxl/all/conanfile.py @@ -1,9 +1,16 @@ -from conans import ConanFile, CMake, tools import os -import shutil -import glob -required_conan_version = ">=1.33.0" +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import cross_building, stdcpp_library, 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, rmdir, save, rm, replace_in_file +from conan.tools.gnu import PkgConfigDeps +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" class LibjxlConan(ConanFile): @@ -14,114 +21,201 @@ class LibjxlConan(ConanFile): homepage = "https://github.com/libjxl/libjxl" topics = ("image", "jpeg-xl", "jxl", "jpeg") - 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 - - @property - def _source_subfolder(self): - return "source_subfolder" + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "avx512": [True, False], + "avx512_spr": [True, False], + "avx512_zen4": [True, False], + "with_tcmalloc": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "avx512": False, + "avx512_spr": False, + "avx512_zen4": False, + "with_tcmalloc": False, + } + + def export_sources(self): + copy(self, "conan_deps.cmake", self.recipe_folder, os.path.join(self.export_sources_folder, "src")) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + if self.settings.arch not in ["x86", "x86_64"] or Version(self.version) < "0.9": + del self.options.avx512 + del self.options.avx512_spr + del self.options.avx512_zen4 + # https://github.com/libjxl/libjxl/blob/v0.9.1/CMakeLists.txt#L52-L59 + if self.settings.os in ["Linux", "FreeBSD"] and self.settings.arch == "x86_64": + self.options.with_tcmalloc = True 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("brotli/1.0.9") - self.requires("highway/0.12.2") - self.requires("lcms/2.11") + self.requires("brotli/1.1.0") + self.requires("highway/1.1.0") + self.requires("lcms/2.16") + if self.options.with_tcmalloc: + self.requires("gperftools/2.15") + + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, 11) + + def build_requirements(self): + # Require newer CMake, which allows INCLUDE_DIRECTORIES to be set on INTERFACE targets + # Also, v0.9+ require CMake 3.16 + self.tool_requires("cmake/[>=3.19 <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], strip_root=True) + + def generate(self): + VirtualBuildEnv(self).generate() + + tc = CMakeToolchain(self) + tc.variables["CMAKE_PROJECT_LIBJXL_INCLUDE"] = "conan_deps.cmake" + tc.variables["BUILD_TESTING"] = False + tc.variables["JPEGXL_STATIC"] = False + tc.variables["JPEGXL_BUNDLE_LIBPNG"] = False + tc.variables["JPEGXL_ENABLE_BENCHMARK"] = False + tc.variables["JPEGXL_ENABLE_DOXYGEN"] = False + tc.variables["JPEGXL_ENABLE_EXAMPLES"] = False + tc.variables["JPEGXL_ENABLE_JNI"] = False + tc.variables["JPEGXL_ENABLE_MANPAGES"] = False + tc.variables["JPEGXL_ENABLE_OPENEXR"] = False + tc.variables["JPEGXL_ENABLE_PLUGINS"] = False + tc.variables["JPEGXL_ENABLE_SJPEG"] = False + tc.variables["JPEGXL_ENABLE_SKCMS"] = False + tc.variables["JPEGXL_ENABLE_TCMALLOC"] = self.options.with_tcmalloc + tc.variables["JPEGXL_ENABLE_VIEWERS"] = False + tc.variables["JPEGXL_ENABLE_TOOLS"] = False + tc.variables["JPEGXL_FORCE_SYSTEM_BROTLI"] = True + tc.variables["JPEGXL_FORCE_SYSTEM_GTEST"] = True + tc.variables["JPEGXL_FORCE_SYSTEM_HWY"] = True + tc.variables["JPEGXL_FORCE_SYSTEM_LCMS2"] = True + tc.variables["JPEGXL_WARNINGS_AS_ERRORS"] = False + tc.variables["JPEGXL_FORCE_NEON"] = False + tc.variables["JPEGXL_ENABLE_AVX512"] = self.options.get_safe("avx512", False) + tc.variables["JPEGXL_ENABLE_AVX512_SPR"] = self.options.get_safe("avx512_spr", False) + tc.variables["JPEGXL_ENABLE_AVX512_ZEN4"] = self.options.get_safe("avx512_zen4", False) + if cross_building(self): + tc.variables["CMAKE_SYSTEM_PROCESSOR"] = str(self.settings.arch) + # Allow non-cache_variables to be used + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + # Skip the buggy custom FindAtomic and force the use of atomic library directly for libstdc++ + tc.variables["ATOMICS_LIBRARIES"] = "atomic" if self._atomic_required else "" + if Version(self.version) >= "0.8": + # TODO: add support for the jpegli JPEG encoder library + tc.variables["JPEGXL_ENABLE_JPEGLI"] = False + tc.variables["JPEGXL_ENABLE_JPEGLI_LIBJPEG"] = False + # TODO: can hopefully be removed in newer versions + # https://github.com/libjxl/libjxl/issues/3159 + if Version(self.version) >= "0.9" and self.settings.build_type == "Debug" and is_msvc(self): + tc.preprocessor_definitions["JXL_DEBUG_V_LEVEL"] = 1 + tc.generate() + + deps = CMakeDeps(self) + deps.set_property("brotli", "cmake_file_name", "Brotli") + deps.set_property("highway", "cmake_file_name", "HWY") + deps.set_property("lcms", "cmake_file_name", "LCMS2") + deps.generate() + + # For tcmalloc + deps = PkgConfigDeps(self) + deps.generate() + + @property + def _atomic_required(self): + return self.settings.get_safe("compiler.libcxx") in ["libstdc++", "libstdc++11"] 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_TESTING"] = False - self._cmake.definitions["JPEGXL_STATIC"] = not self.options.shared - self._cmake.definitions["JPEGXL_ENABLE_BENCHMARK"] = False - self._cmake.definitions["JPEGXL_ENABLE_EXAMPLES"] = False - self._cmake.definitions["JPEGXL_ENABLE_MANPAGES"] = False - self._cmake.definitions["JPEGXL_ENABLE_SJPEG"] = False - self._cmake.definitions["JPEGXL_ENABLE_OPENEXR"] = False - self._cmake.definitions["JPEGXL_ENABLE_SKCMS"] = False - self._cmake.definitions["JPEGXL_ENABLE_TCMALLOC"] = False - if tools.cross_building(self): - self._cmake.definitions["CMAKE_SYSTEM_PROCESSOR"] = \ - str(self.settings.arch) - self._cmake.configure() - return self._cmake + # Disable tools, extras and third_party + save(self, os.path.join(self.source_folder, "tools", "CMakeLists.txt"), "") + save(self, os.path.join(self.source_folder, "third_party", "CMakeLists.txt"), "") + # FindAtomics.cmake values are set by CMakeToolchain instead + save(self, os.path.join(self.source_folder, "cmake", "FindAtomics.cmake"), "") + + # Allow fPIC to be set by Conan + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)", "") + for cmake_file in ["jxl.cmake", "jxl_threads.cmake", "jxl_cms.cmake", "jpegli.cmake"]: + path = os.path.join(self.source_folder, "lib", cmake_file) + if os.path.exists(path): + fpic = "ON" if self.options.get_safe("fPIC", True) else "OFF" + replace_in_file(self, path, "POSITION_INDEPENDENT_CODE ON", f"POSITION_INDEPENDENT_CODE {fpic}") 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("LICENSE", src=self._source_subfolder, dst="licenses") - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) if self.options.shared: - libs_dir = os.path.join(self.package_folder, "lib") - tools.remove_files_by_mask(libs_dir, "*.a") - tools.remove_files_by_mask(libs_dir, "*-static.lib") - - if self.settings.os == "Windows": - self.copy("jxl_dec.dll", src="bin", dst="bin") - self.copy("jxl_dec.lib", src="lib", dst="lib") - for dll_path in glob.glob(os.path.join(libs_dir, "*.dll")): - shutil.move(dll_path, os.path.join(self.package_folder, - "bin", os.path.basename(dll_path))) - else: - self.copy("libjxl_dec.*", src="lib", dst="lib") + rm(self, "*.a", os.path.join(self.package_folder, "lib")) + rm(self, "*-static.lib", os.path.join(self.package_folder, "lib")) def _lib_name(self, name): - if not self.options.shared and self.settings.os == "Windows": + if Version(self.version) < "0.9" and not self.options.shared and self.settings.os == "Windows": return name + "-static" return name def package_info(self): + libcxx = stdcpp_library(self) + # jxl - self.cpp_info.components["jxl"].names["pkg_config"] = "libjxl" + self.cpp_info.components["jxl"].set_property("pkg_config_name", "libjxl") self.cpp_info.components["jxl"].libs = [self._lib_name("jxl")] - self.cpp_info.components["jxl"].requires = ["brotli::brotli", - "highway::highway", - "lcms::lcms"] + self.cpp_info.components["jxl"].requires = ["brotli::brotli", "highway::highway", "lcms::lcms"] + if self.options.with_tcmalloc: + self.cpp_info.components["jxl"].requires.append("gperftools::tcmalloc_minimal") + if self._atomic_required: + self.cpp_info.components["jxl"].system_libs.append("atomic") + if not self.options.shared: + self.cpp_info.components["jxl"].defines.append("JXL_STATIC_DEFINE") + if libcxx: + self.cpp_info.components["jxl"].system_libs.append(libcxx) + + # jxl_cms + if Version(self.version) >= "0.9.0": + self.cpp_info.components["jxl_cms"].set_property("pkg_config_name", "libjxl_cms") + self.cpp_info.components["jxl_cms"].libs = [self._lib_name("jxl_cms")] + self.cpp_info.components["jxl_cms"].requires = ["lcms::lcms", "highway::highway"] + if not self.options.shared: + self.cpp_info.components["jxl"].defines.append("JXL_CMS_STATIC_DEFINE") + if libcxx: + self.cpp_info.components["jxl_cms"].system_libs.append(libcxx) + # jxl_dec - self.cpp_info.components["jxl_dec"].names["pkg_config"] = "libjxl_dec" - self.cpp_info.components["jxl_dec"].libs = [self._lib_name("jxl_dec")] - self.cpp_info.components["jxl_dec"].requires = ["brotli::brotli", - "highway::highway", - "lcms::lcms"] + if Version(self.version) < "0.9.0": + if not self.options.shared: + self.cpp_info.components["jxl_dec"].set_property("pkg_config_name", "libjxl_dec") + self.cpp_info.components["jxl_dec"].libs = [self._lib_name("jxl_dec")] + self.cpp_info.components["jxl_dec"].requires = ["brotli::brotli", "highway::highway", "lcms::lcms"] + if libcxx: + self.cpp_info.components["jxl_dec"].system_libs.append(libcxx) + # jxl_threads - self.cpp_info.components["jxl_threads"].names["pkg_config"] = \ - "libjxl_threads" - self.cpp_info.components["jxl_threads"].libs = \ - [self._lib_name("jxl_threads")] - if self.settings.os == "Linux": + self.cpp_info.components["jxl_threads"].set_property("pkg_config_name", "libjxl_threads") + self.cpp_info.components["jxl_threads"].libs = [self._lib_name("jxl_threads")] + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["jxl_threads"].system_libs = ["pthread"] - - if not self.options.shared and tools.stdcpp_library(self): - self.cpp_info.components["jxl"].system_libs.append( - tools.stdcpp_library(self)) - self.cpp_info.components["jxl_dec"].system_libs.append( - tools.stdcpp_library(self)) - self.cpp_info.components["jxl_threads"].system_libs.append( - tools.stdcpp_library(self)) + if not self.options.shared: + self.cpp_info.components["jxl_threads"].defines.append("JXL_THREADS_STATIC_DEFINE") + if libcxx: + self.cpp_info.components["jxl_threads"].system_libs.append(libcxx) diff --git a/recipes/libjxl/all/patches/0001-clean-targets-v0.5.patch b/recipes/libjxl/all/patches/0001-clean-targets-v0.5.patch deleted file mode 100644 index 1f47c925782ce..0000000000000 --- a/recipes/libjxl/all/patches/0001-clean-targets-v0.5.patch +++ /dev/null @@ -1,38 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -150,8 +150,6 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) - if(JPEGXL_STATIC) - set(CMAKE_FIND_LIBRARY_SUFFIXES .a) - set(BUILD_SHARED_LIBS 0) -- set(CMAKE_EXE_LINKER_FLAGS -- "${CMAKE_EXE_LINKER_FLAGS} -static -static-libgcc -static-libstdc++") - if (MINGW) - # In MINGW libstdc++ uses pthreads directly. When building statically a - # program (regardless of whether the source code uses pthread or not) the -@@ -247,8 +245,6 @@ set(CMAKE_CXX_STANDARD 11) - set(CMAKE_CXX_EXTENSIONS OFF) - set(CMAKE_CXX_STANDARD_REQUIRED YES) - --add_subdirectory(third_party) -- - set(THREADS_PREFER_PTHREAD_FLAG YES) - find_package(Threads REQUIRED) - -@@ -331,6 +327,3 @@ endif () - if (${JPEGXL_ENABLE_PLUGINS}) - add_subdirectory(plugins) - endif () -- --# Binary tools --add_subdirectory(tools) - ---- a/lib/CMakeLists.txt -+++ b/lib/CMakeLists.txt -@@ -119,7 +119,6 @@ endif() #!MSVC - include(jxl.cmake) - - # Other libraries outside the core jxl library. --include(jxl_extras.cmake) - include(jxl_threads.cmake) - - # Install all the library headers from the source and the generated ones. There diff --git a/recipes/libjxl/all/patches/0001-clean-targets-v0.6.patch b/recipes/libjxl/all/patches/0001-clean-targets-v0.6.patch deleted file mode 100644 index e59af39610354..0000000000000 --- a/recipes/libjxl/all/patches/0001-clean-targets-v0.6.patch +++ /dev/null @@ -1,36 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -161,6 +161,4 @@ # ourselves; for real use case we don't care about stdlib, as it is "granted", - # so just linking all other libraries is fine. - if (NOT APPLE) -- set(CMAKE_EXE_LINKER_FLAGS -- "${CMAKE_EXE_LINKER_FLAGS} -static -static-libgcc -static-libstdc++") - endif() - endif() # JPEGXL_STATIC -@@ -278,8 +277,6 @@ set(CMAKE_CXX_STANDARD 11) - set(CMAKE_CXX_EXTENSIONS OFF) - set(CMAKE_CXX_STANDARD_REQUIRED YES) - --add_subdirectory(third_party) -- - # Copy the JXL license file to the output build directory. - configure_file("${CMAKE_CURRENT_SOURCE_DIR}/LICENSE" - ${PROJECT_BINARY_DIR}/LICENSE.jpeg-xl COPYONLY) -@@ -380,6 +376,3 @@ # Plugins for third-party software - if (${JPEGXL_ENABLE_PLUGINS}) - add_subdirectory(plugins) - endif () -- --# Binary tools --add_subdirectory(tools) - ---- a/lib/CMakeLists.txt -+++ b/lib/CMakeLists.txt -@@ -132,7 +132,6 @@ # The jxl library definition. - include(jxl.cmake) - - # Other libraries outside the core jxl library. --include(jxl_extras.cmake) - include(jxl_threads.cmake) - - # Install all the library headers from the source and the generated ones. There diff --git a/recipes/libjxl/all/patches/0002-fix-dependencies-v0.5.patch b/recipes/libjxl/all/patches/0002-fix-dependencies-v0.5.patch deleted file mode 100644 index 8ec6fc1cb0d9d..0000000000000 --- a/recipes/libjxl/all/patches/0002-fix-dependencies-v0.5.patch +++ /dev/null @@ -1,106 +0,0 @@ ---- a/lib/jxl.cmake -+++ b/lib/jxl.cmake -@@ -328,7 +328,7 @@ if (JPEGXL_ENABLE_SKCMS) - list(APPEND JPEGXL_INTERNAL_FLAGS -DJPEGXL_ENABLE_SKCMS=1) - list(APPEND JPEGXL_INTERNAL_LIBS skcms) - else () -- list(APPEND JPEGXL_INTERNAL_LIBS lcms2) -+ list(APPEND JPEGXL_INTERNAL_LIBS ${CONAN_LIBS_LCMS}) - endif () - - if (NOT JPEGXL_ENABLE_TRANSCODE_JPEG) -@@ -353,8 +353,6 @@ set_property(TARGET jxl_dec-obj PROPERTY POSITION_INDEPENDENT_CODE ON) - target_include_directories(jxl_dec-obj PUBLIC - ${PROJECT_SOURCE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/include -- $ -- $ - ) - target_compile_definitions(jxl_dec-obj PUBLIC - ${OBJ_COMPILE_DEFINITIONS} -@@ -371,8 +369,6 @@ set_property(TARGET jxl_enc-obj PROPERTY POSITION_INDEPENDENT_CODE ON) - target_include_directories(jxl_enc-obj PUBLIC - ${PROJECT_SOURCE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/include -- $ -- $ - ) - target_compile_definitions(jxl_enc-obj PUBLIC - ${OBJ_COMPILE_DEFINITIONS} -@@ -381,23 +377,6 @@ if (JPEGXL_ENABLE_PROFILER) - target_link_libraries(jxl_enc-obj PUBLIC jxl_profiler) - endif() - --#TODO(lode): don't depend on CMS for the core library --if (JPEGXL_ENABLE_SKCMS) -- target_include_directories(jxl_enc-obj PRIVATE -- $ -- ) -- target_include_directories(jxl_dec-obj PRIVATE -- $ -- ) --else () -- target_include_directories(jxl_enc-obj PRIVATE -- $ -- ) -- target_include_directories(jxl_dec-obj PRIVATE -- $ -- ) --endif () -- - # Headers for exporting/importing public headers - include(GenerateExportHeader) - # TODO(deymo): Add these visibility properties to the static dependencies of -@@ -416,9 +395,6 @@ set_target_properties(jxl_enc-obj PROPERTIES - VISIBILITY_INLINES_HIDDEN 1 - DEFINE_SYMBOL JXL_INTERNAL_LIBRARY_BUILD - ) --generate_export_header(jxl_enc-obj -- BASE_NAME JXL -- EXPORT_FILE_NAME include/jxl/jxl_export.h) - target_include_directories(jxl_enc-obj PUBLIC - ${CMAKE_CURRENT_BINARY_DIR}/include) - -@@ -496,9 +472,8 @@ if (((NOT DEFINED "${TARGET_SUPPORTS_SHARED_LIBS}") OR - add_library(jxl SHARED - $ - $) --strip_static(JPEGXL_INTERNAL_SHARED_LIBS JPEGXL_INTERNAL_LIBS) - target_link_libraries(jxl PUBLIC ${JPEGXL_COVERAGE_FLAGS}) --target_link_libraries(jxl PRIVATE ${JPEGXL_INTERNAL_SHARED_LIBS}) -+target_link_libraries(jxl PRIVATE ${JPEGXL_INTERNAL_LIBS}) - # Shared library include path contains only the "include/" paths. - target_include_directories(jxl PUBLIC - "${CMAKE_CURRENT_SOURCE_DIR}/include" -@@ -507,13 +482,13 @@ set_target_properties(jxl PROPERTIES - VERSION ${JPEGXL_LIBRARY_VERSION} - SOVERSION ${JPEGXL_LIBRARY_SOVERSION} - LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" -- RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}") -+ RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" -+ DEFINE_SYMBOL JXL_INTERNAL_LIBRARY_BUILD) - - # Public shared decoder library. - add_library(jxl_dec SHARED $) --strip_static(JPEGXL_DEC_INTERNAL_SHARED_LIBS JPEGXL_DEC_INTERNAL_LIBS) - target_link_libraries(jxl_dec PUBLIC ${JPEGXL_COVERAGE_FLAGS}) --target_link_libraries(jxl_dec PRIVATE ${JPEGXL_DEC_INTERNAL_SHARED_LIBS}) -+target_link_libraries(jxl_dec PRIVATE ${JPEGXL_DEC_INTERNAL_LIBS}) - # Shared library include path contains only the "include/" paths. - target_include_directories(jxl_dec PUBLIC - "${CMAKE_CURRENT_SOURCE_DIR}/include" -@@ -549,8 +524,14 @@ install(TARGETS jxl - else() - add_library(jxl ALIAS jxl-static) - add_library(jxl_dec ALIAS jxl_dec-static) -+set_target_properties(jxl-static PROPERTIES -+ DEFINE_SYMBOL JXL_INTERNAL_LIBRARY_BUILD) - endif() # TARGET_SUPPORTS_SHARED_LIBS AND NOT JPEGXL_STATIC - -+generate_export_header(jxl -+ BASE_NAME JXL -+ EXPORT_FILE_NAME include/jxl/jxl_export.h) -+ - # Add a pkg-config file for libjxl. - set(JPEGXL_LIBRARY_REQUIRES - "libhwy libbrotlicommon libbrotlienc libbrotlidec") diff --git a/recipes/libjxl/all/patches/0002-fix-dependencies-v0.6.patch b/recipes/libjxl/all/patches/0002-fix-dependencies-v0.6.patch deleted file mode 100644 index b4ff403da499f..0000000000000 --- a/recipes/libjxl/all/patches/0002-fix-dependencies-v0.6.patch +++ /dev/null @@ -1,126 +0,0 @@ ---- a/lib/jxl.cmake -+++ b/lib/jxl.cmake -@@ -334,7 +334,7 @@ if (JPEGXL_ENABLE_SKCMS) - list(APPEND JPEGXL_INTERNAL_LIBS skcms) - endif () - else () -- list(APPEND JPEGXL_INTERNAL_LIBS lcms2) -+ list(APPEND JPEGXL_INTERNAL_LIBS ${CONAN_LIBS_LCMS}) - endif () - - if (NOT JPEGXL_ENABLE_TRANSCODE_JPEG) -@@ -359,8 +359,6 @@ set_property(TARGET jxl_dec-obj PROPERTY POSITION_INDEPENDENT_CODE ON) - target_include_directories(jxl_dec-obj PUBLIC - ${PROJECT_SOURCE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/include -- $ -- $ - ) - target_compile_definitions(jxl_dec-obj PUBLIC - ${OBJ_COMPILE_DEFINITIONS} -@@ -377,8 +375,6 @@ set_property(TARGET jxl_enc-obj PROPERTY POSITION_INDEPENDENT_CODE ON) - target_include_directories(jxl_enc-obj PUBLIC - ${PROJECT_SOURCE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/include -- $ -- $ - ) - target_compile_definitions(jxl_enc-obj PUBLIC - ${OBJ_COMPILE_DEFINITIONS} -@@ -387,17 +383,6 @@ if (JPEGXL_ENABLE_PROFILER) - target_link_libraries(jxl_enc-obj PUBLIC jxl_profiler) - endif() - --#TODO(lode): don't depend on CMS for the core library --if (JPEGXL_ENABLE_SKCMS) -- target_include_directories(jxl_enc-obj PRIVATE -- $ -- ) --else () -- target_include_directories(jxl_enc-obj PRIVATE -- $ -- ) --endif () -- - # Headers for exporting/importing public headers - include(GenerateExportHeader) - set_target_properties(jxl_dec-obj PROPERTIES -@@ -413,9 +398,6 @@ set_target_properties(jxl_enc-obj PROPERTIES - VISIBILITY_INLINES_HIDDEN 1 - DEFINE_SYMBOL JXL_INTERNAL_LIBRARY_BUILD - ) --generate_export_header(jxl_enc-obj -- BASE_NAME JXL -- EXPORT_FILE_NAME include/jxl/jxl_export.h) - target_include_directories(jxl_enc-obj PUBLIC - ${CMAKE_CURRENT_BINARY_DIR}/include) - -@@ -495,9 +477,8 @@ if (((NOT DEFINED "${TARGET_SUPPORTS_SHARED_LIBS}") OR - - # Public shared library. - add_library(jxl SHARED ${JPEGXL_INTERNAL_OBJECTS}) --strip_static(JPEGXL_INTERNAL_SHARED_LIBS JPEGXL_INTERNAL_LIBS) - target_link_libraries(jxl PUBLIC ${JPEGXL_COVERAGE_FLAGS}) --target_link_libraries(jxl PRIVATE ${JPEGXL_INTERNAL_SHARED_LIBS}) -+target_link_libraries(jxl PRIVATE ${JPEGXL_INTERNAL_LIBS}) - # Shared library include path contains only the "include/" paths. - target_include_directories(jxl PUBLIC - "${CMAKE_CURRENT_SOURCE_DIR}/include" -@@ -506,13 +487,13 @@ set_target_properties(jxl PROPERTIES - VERSION ${JPEGXL_LIBRARY_VERSION} - SOVERSION ${JPEGXL_LIBRARY_SOVERSION} - LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" -- RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}") -+ RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" -+ DEFINE_SYMBOL JXL_INTERNAL_LIBRARY_BUILD) - - # Public shared decoder library. - add_library(jxl_dec SHARED $) --strip_static(JPEGXL_DEC_INTERNAL_SHARED_LIBS JPEGXL_DEC_INTERNAL_LIBS) - target_link_libraries(jxl_dec PUBLIC ${JPEGXL_COVERAGE_FLAGS}) --target_link_libraries(jxl_dec PRIVATE ${JPEGXL_DEC_INTERNAL_SHARED_LIBS}) -+target_link_libraries(jxl_dec PRIVATE ${JPEGXL_DEC_INTERNAL_LIBS}) - # Shared library include path contains only the "include/" paths. - target_include_directories(jxl_dec PUBLIC - "${CMAKE_CURRENT_SOURCE_DIR}/include" -@@ -523,6 +504,12 @@ set_target_properties(jxl_dec PROPERTIES - LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" - RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}") - -+set(LINKER_EXCLUDE_LIBS_FLAG "-Wl,--exclude-libs=ALL") -+include(CheckCSourceCompiles) -+list(APPEND CMAKE_EXE_LINKER_FLAGS ${LINKER_EXCLUDE_LIBS_FLAG}) -+check_c_source_compiles("int main(){return 0;}" LINKER_SUPPORT_EXCLUDE_LIBS) -+list(REMOVE_ITEM CMAKE_EXE_LINKER_FLAGS ${LINKER_EXCLUDE_LIBS_FLAG}) -+ - # Add a jxl.version file as a version script to tag symbols with the - # appropriate version number. This script is also used to limit what's exposed - # in the shared library from the static dependencies bundled here. -@@ -541,8 +528,10 @@ foreach(target IN ITEMS jxl jxl_dec) - # This hides the default visibility symbols from static libraries bundled into - # the shared library. In particular this prevents exposing symbols from hwy - # and skcms in the shared library. -- set_property(TARGET ${target} APPEND_STRING PROPERTY -- LINK_FLAGS " -Wl,--exclude-libs=ALL") -+ if(${LINKER_SUPPORT_EXCLUDE_LIBS}) -+ set_property(TARGET ${target} APPEND_STRING PROPERTY -+ LINK_FLAGS " ${LINKER_EXCLUDE_LIBS_FLAG}") -+ endif() - endforeach() - - # Only install libjxl shared library. The libjxl_dec is not installed since it -@@ -553,8 +542,14 @@ install(TARGETS jxl - else() - add_library(jxl ALIAS jxl-static) - add_library(jxl_dec ALIAS jxl_dec-static) -+set_target_properties(jxl-static PROPERTIES -+ DEFINE_SYMBOL JXL_INTERNAL_LIBRARY_BUILD) - endif() # TARGET_SUPPORTS_SHARED_LIBS AND NOT JPEGXL_STATIC - -+generate_export_header(jxl -+ BASE_NAME JXL -+ EXPORT_FILE_NAME include/jxl/jxl_export.h) -+ - # Add a pkg-config file for libjxl. - set(JPEGXL_LIBRARY_REQUIRES - "libhwy libbrotlicommon libbrotlienc libbrotlidec") diff --git a/recipes/libjxl/all/test_package/CMakeLists.txt b/recipes/libjxl/all/test_package/CMakeLists.txt index 7b9b613cbb24a..4cb796f1c09f2 100644 --- a/recipes/libjxl/all/test_package/CMakeLists.txt +++ b/recipes/libjxl/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ -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() +find_package(libjxl REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE libjxl::libjxl) diff --git a/recipes/libjxl/all/test_package/conanfile.py b/recipes/libjxl/all/test_package/conanfile.py index 138d4f5333429..ef5d7042163ec 100644 --- a/recipes/libjxl/all/test_package/conanfile.py +++ b/recipes/libjxl/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,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") - img_path = os.path.join(self.source_folder, "test.jxl") - self.run(bin_path + " " + img_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/libjxl/all/test_package/test.jxl b/recipes/libjxl/all/test_package/test.jxl deleted file mode 100644 index a0f419a98a426..0000000000000 Binary files a/recipes/libjxl/all/test_package/test.jxl and /dev/null differ diff --git a/recipes/libjxl/all/test_package/test_package.c b/recipes/libjxl/all/test_package/test_package.c index 2cb652aa9249a..3b65dffc293ab 100644 --- a/recipes/libjxl/all/test_package/test_package.c +++ b/recipes/libjxl/all/test_package/test_package.c @@ -4,87 +4,15 @@ #include "jxl/decode.h" #include "jxl/thread_parallel_runner.h" -static int ReadFile(const char filename[], uint8_t *data[], size_t *size) +int main() { - FILE *fp = fopen(filename, "rb"); - if (!fp) - return 0; - - if (fseek(fp, 0, SEEK_END) != 0) { - fclose(fp); - return 0; - } - - *size = ftell(fp); - if (fseek(fp, 0, SEEK_SET) != 0) { - fclose(fp); - return 0; - } - - *data = malloc(*size); - if (!*data) { - fclose(fp); - return 0; - } - - if (fread(*data, sizeof(uint8_t), *size, fp) != *size) { - free(*data); - fclose(fp); - return 0; - } - - if (fclose(fp) != 0) { - free(*data); - return 0; - } - - return 1; -} - -int main(int argc, char *argv[]) -{ - int ret = EXIT_FAILURE; - - if (argc < 2) { - fprintf(stderr, "Need at least one argument\n"); - return ret; - } - - uint8_t *data; - size_t size; - if (!ReadFile(argv[1], &data, &size)) - return ret; - JxlDecoder *dec = NULL; void *runner = NULL; - dec = JxlDecoderCreate(NULL); - if (JxlDecoderSubscribeEvents(dec, JXL_DEC_BASIC_INFO) != JXL_DEC_SUCCESS) - goto Exit; - - runner = JxlThreadParallelRunnerCreate( - NULL, JxlThreadParallelRunnerDefaultNumWorkerThreads()); - if (JxlDecoderSetParallelRunner(dec, JxlThreadParallelRunner, runner) - != JXL_DEC_SUCCESS) - goto Exit; - if (JxlDecoderSetInput(dec, data, size) != JXL_DEC_SUCCESS) - goto Exit; - - if (JxlDecoderProcessInput(dec) != JXL_DEC_BASIC_INFO) - goto Exit; - - JxlBasicInfo info; - if (JxlDecoderGetBasicInfo(dec, &info) != JXL_DEC_SUCCESS) - goto Exit; - - printf("Image size: %d x %d pixels\n", info.xsize, info.ysize); - - ret = EXIT_SUCCESS; - -Exit: - free(data); - JxlThreadParallelRunnerDestroy(runner); - JxlDecoderDestroy(dec); - return ret; + // Allways True + if (JxlDecoderSubscribeEvents(dec, JXL_DEC_BASIC_INFO) == JXL_DEC_SUCCESS) + { + printf("Test"); + } } diff --git a/recipes/libjxl/all/test_v1_package/CMakeLists.txt b/recipes/libjxl/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/libjxl/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/libjxl/all/test_v1_package/conanfile.py b/recipes/libjxl/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..49a3a66ea5bad --- /dev/null +++ b/recipes/libjxl/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/libjxl/config.yml b/recipes/libjxl/config.yml index c79a1af3be31f..040248cefb07f 100644 --- a/recipes/libjxl/config.yml +++ b/recipes/libjxl/config.yml @@ -1,5 +1,7 @@ versions: - "0.5.0": + "0.10.3": folder: all - "0.6.1": + "0.10.2": + folder: all + "0.8.2": folder: all diff --git a/recipes/libkml/all/CMakeLists.txt b/recipes/libkml/all/CMakeLists.txt deleted file mode 100644 index e174fe2ff60d5..0000000000000 --- a/recipes/libkml/all/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -cmake_minimum_required(VERSION 3.4.3) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS KEEP_RPATHS) - -if(WIN32 AND BUILD_SHARED_LIBS) - set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) -endif() - -add_subdirectory("source_subfolder") diff --git a/recipes/libkml/all/conandata.yml b/recipes/libkml/all/conandata.yml index 8d8c18cdc2663..018a7586f3180 100644 --- a/recipes/libkml/all/conandata.yml +++ b/recipes/libkml/all/conandata.yml @@ -1,14 +1,12 @@ +# NOTE: if a new version >1.3.0 is added, verify if it is +# compatible with C++17 and above to reflect this in recipe sources: "1.3.0": url: "https://github.com/libkml/libkml/archive/1.3.0.zip" sha256: "ac2a61b4bca105cbed9ad8d0d6d5536dc7c2a11abcecf86431d023e2f3ae96db" patches: "1.3.0": - - patch_file: "patches/conanize-cmakelists.patch" - base_path: "source_subfolder" - - patch_file: "patches/fix-for-mingw-and-empty-literal-for-vc.patch" - base_path: "source_subfolder" - - patch_file: "patches/export-extern-symbols-for-msvc.patch" - base_path: "source_subfolder" - - patch_file: "patches/minizip-no-crypt-header.patch" - base_path: "source_subfolder" + - patch_file: "patches/0001-fix-cmake.patch" + - patch_file: "patches/0002-fix-for-mingw-and-empty-literal-for-vc.patch" + - patch_file: "patches/0003-export-extern-symbols-for-msvc.patch" + - patch_file: "patches/0004-minizip-no-crypt-header.patch" diff --git a/recipes/libkml/all/conanfile.py b/recipes/libkml/all/conanfile.py index 70ba46ffc23ce..4ea7fb43e50c7 100644 --- a/recipes/libkml/all/conanfile.py +++ b/recipes/libkml/all/conanfile.py @@ -1,20 +1,22 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -import functools +from conan import ConanFile, conan_version +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, 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 LibkmlConan(ConanFile): name = "libkml" description = "Reference implementation of OGC KML 2.2" license = "BSD-3-Clause" - topics = ("libkml", "kml", "ogc", "geospatial") + topics = ("kml", "ogc", "geospatial") homepage = "https://github.com/libkml/libkml" url = "https://github.com/conan-io/conan-center-index" - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -25,20 +27,8 @@ class LibkmlConan(ConanFile): "fPIC": 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": @@ -46,46 +36,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("boost/1.78.0") - self.requires("expat/2.4.8") - self.requires("minizip/1.2.12") - self.requires("uriparser/0.9.6") - self.requires("zlib/1.2.12") + self.requires("boost/1.81.0", transitive_headers=True) + self.requires("expat/[>=2.6.2 <3]") + self.requires("minizip/1.2.13") + self.requires("uriparser/0.9.7") + self.requires("zlib/[>=1.2.11 <2]") def validate(self): - if self.options.shared and \ - ((self.settings.compiler == "Visual Studio" and "MT" in self.settings.compiler.runtime) or \ - (self.settings.compiler == "msvc" and self.settings.compiler.runtime == "static")): - raise ConanInvalidConfiguration("libkml shared with Visual Studio and MT runtime is not supported") + if self.options.shared and is_msvc(self) and is_msvc_static_runtime(self): + raise ConanInvalidConfiguration(f"{self.ref} shared with Visual Studio and MT runtime is not supported") + + def package_id(self): + cppstd = self.info.settings.get_safe("compiler.cppstd") + if cppstd and cppstd not in ['98', 'gnu98', '11', 'gnu11', '14', 'gnu14']: + prefix = "gnu" if str(cppstd).startswith("gnu") else "" + self.info.settings.compiler.cppstd = f"{prefix}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], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + + # Fallback to C++14 - the implementation uses + # functionality that is not compliant with C++17 + # See https://github.com/conan-io/conan/issues/16148 + cppstd = self.settings.get_safe("compiler.cppstd") + if cppstd and conan_version.major >= 2: + from conan.tools.build import valid_max_cppstd + if not valid_max_cppstd(self, "14"): + self.output.warning(f"Recipe not compatible with C++ {cppstd}, falling back to C++14") + use_gnu_extensions = str(cppstd).startswith("gnu") + tc.blocks.remove("cppstd") + tc.cache_variables["CMAKE_CXX_STANDARD"] = "14" + tc.cache_variables["CMAKE_CXX_EXTENSIONS"] = use_gnu_extensions - def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() - cmake.build() + # To install relocatable shared libs on Macos + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" + 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) - # To install relocatable shared libs on Macos - cmake.definitions["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" - cmake.configure(build_folder=self._build_subfolder) - return cmake + 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")) - 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", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "cmake")) self._create_cmake_module_alias_targets( os.path.join(self.package_folder, self._module_file_rel_path), { @@ -98,26 +109,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) - - @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", "LibKML") @@ -159,7 +164,6 @@ def _register_components(self, components): self.cpp_info.components[comp_cmake_lib_name].set_property("cmake_target_name", comp_cmake_lib_name) self.cpp_info.components[comp_cmake_lib_name].names["cmake_find_package"] = comp_cmake_lib_name self.cpp_info.components[comp_cmake_lib_name].names["cmake_find_package_multi"] = comp_cmake_lib_name - self.cpp_info.components[comp_cmake_lib_name].builddirs.append(self._module_subfolder) self.cpp_info.components[comp_cmake_lib_name].build_modules["cmake_find_package"] = [self._module_file_rel_path] self.cpp_info.components[comp_cmake_lib_name].build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] self.cpp_info.components[comp_cmake_lib_name].libs = [comp_cmake_lib_name] diff --git a/recipes/libkml/all/patches/0001-fix-cmake.patch b/recipes/libkml/all/patches/0001-fix-cmake.patch new file mode 100644 index 0000000000000..e7ab69a15ddc3 --- /dev/null +++ b/recipes/libkml/all/patches/0001-fix-cmake.patch @@ -0,0 +1,69 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -30,7 +30,6 @@ set(TEST_FLAGS "-Wall -Wextra -Wno-unused-parameter -fno-rtti -DGTEST_HAS_RTTI=0 + else() + if(MSVC) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /DUNICODE /D_UNICODE") +- set(BUILD_SHARED_LIBS OFF) + endif() + endif() + +@@ -93,7 +92,7 @@ set(MINIZIP_DEPENDS "" CACHE INTERNAL "MINIZIP_DEPENDS") + + set(LIBKML_TARGETS) + +-find_package(EXPAT) ++find_package(EXPAT REQUIRED MODULE) + if(EXPAT_FOUND) + include_directories(${EXPAT_INCLUDE_DIR}) + else() +@@ -110,16 +109,16 @@ else() + list(APPEND MINIZIP_DEPENDS ZLIB) + endif() + +-find_package(MiniZip) +-if(MINIZIP_FOUND) ++find_package(minizip REQUIRED CONFIG) ++if(minizip_FOUND) + include_directories(${MINIZIP_INCLUDE_DIR}) + else() + include(External_minizip) + list(APPEND KMLBASE_DEPENDS MINIZIP) + endif() + +-find_package(UriParser) +-if(URIPARSER_FOUND) ++find_package(uriparser REQUIRED CONFIG) ++if(uriparser_FOUND) + include_directories(${URIPARSER_INCLUDE_DIR}) + else() + include(External_uriparser) +@@ -149,10 +148,11 @@ if(WITH_SWIG) + endif() + endif() + +-list(APPEND KMLBASE_LINK_LIBS ${EXPAT_LIBRARY}) +-list(APPEND KMLBASE_LINK_LIBS ${ZLIB_LIBRARY}) +-list(APPEND KMLBASE_LINK_LIBS ${MINIZIP_LIBRARY}) +-list(APPEND KMLBASE_LINK_LIBS ${URIPARSER_LIBRARY}) ++list(APPEND KMLBASE_LINK_LIBS Boost::headers) ++list(APPEND KMLBASE_LINK_LIBS EXPAT::EXPAT) ++list(APPEND KMLBASE_LINK_LIBS ZLIB::ZLIB) ++list(APPEND KMLBASE_LINK_LIBS minizip::minizip) ++list(APPEND KMLBASE_LINK_LIBS uriparser::uriparser) + + include_directories(${CMAKE_SOURCE_DIR}/src) + +diff --git a/src/kml/base/CMakeLists.txt b/src/kml/base/CMakeLists.txt +index dc3e9c4..895930b 100644 +--- a/src/kml/base/CMakeLists.txt ++++ b/src/kml/base/CMakeLists.txt +@@ -3,7 +3,7 @@ if(HAVE_SYSTEM_EXPAT) + include_directories(${EXPAT_INCLUDE_DIR}) + endif() + +-list(APPEND KMLBASE_LINK_LIBS ${EXPAT_LIBRARY}) ++list(APPEND KMLBASE_LINK_LIBS EXPAT::EXPAT) + + file(GLOB SRCS "*.cc" + contrib/minizip/unzip.c diff --git a/recipes/libkml/all/patches/fix-for-mingw-and-empty-literal-for-vc.patch b/recipes/libkml/all/patches/0002-fix-for-mingw-and-empty-literal-for-vc.patch similarity index 100% rename from recipes/libkml/all/patches/fix-for-mingw-and-empty-literal-for-vc.patch rename to recipes/libkml/all/patches/0002-fix-for-mingw-and-empty-literal-for-vc.patch diff --git a/recipes/libkml/all/patches/export-extern-symbols-for-msvc.patch b/recipes/libkml/all/patches/0003-export-extern-symbols-for-msvc.patch similarity index 100% rename from recipes/libkml/all/patches/export-extern-symbols-for-msvc.patch rename to recipes/libkml/all/patches/0003-export-extern-symbols-for-msvc.patch diff --git a/recipes/libkml/all/patches/minizip-no-crypt-header.patch b/recipes/libkml/all/patches/0004-minizip-no-crypt-header.patch similarity index 100% rename from recipes/libkml/all/patches/minizip-no-crypt-header.patch rename to recipes/libkml/all/patches/0004-minizip-no-crypt-header.patch diff --git a/recipes/libkml/all/patches/conanize-cmakelists.patch b/recipes/libkml/all/patches/conanize-cmakelists.patch deleted file mode 100644 index b6a246c651e3a..0000000000000 --- a/recipes/libkml/all/patches/conanize-cmakelists.patch +++ /dev/null @@ -1,120 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -19,7 +19,7 @@ option(WITH_SWIG "Build all swig bindings" OFF) - option(WITH_PYTHON "Build python bindings" OFF) - option(WITH_JAVA "Build java bindings" OFF) - --set(LIBKML_DATA_DIR ${CMAKE_SOURCE_DIR}/testdata CACHE "Directory containing test data" PATH) -+set(LIBKML_DATA_DIR ${CMAKE_CURRENT_SOURCE_DIR}/testdata CACHE "Directory containing test data" PATH) - - #AM_CXXFLAGS = -Wall -Wextra -Wno-unused-parameter -pedantic -fno-rtti - #AM_TEST_CXXFLAGS = -Wall -Wextra -Wno-unused-parameter -Werror -fno-rtti -DGTEST_HAS_RTTI=0 -@@ -30,7 +30,6 @@ set(TEST_FLAGS "-Wall -Wextra -Wno-unused-parameter -fno-rtti -DGTEST_HAS_RTTI=0 - else() - if(MSVC) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /DUNICODE /D_UNICODE") -- set(BUILD_SHARED_LIBS OFF) - endif() - endif() - -@@ -80,7 +79,7 @@ set(INSTALL_DIR "${CMAKE_INSTALL_PREFIX}" CACHE "install directory " PATH) - - # Path to additional CMake modules - set(CMAKE_MODULE_PATH -- ${CMAKE_SOURCE_DIR}/cmake -+ ${CMAKE_CURRENT_SOURCE_DIR}/cmake - ${CMAKE_MODULE_PATH}) - - include(LibKMLHelper) -@@ -93,49 +92,7 @@ set(MINIZIP_DEPENDS "" CACHE INTERNAL "MINIZIP_DEPENDS") - - set(LIBKML_TARGETS) - --find_package(EXPAT) --if(EXPAT_FOUND) -- include_directories(${EXPAT_INCLUDE_DIR}) --else() -- include(External_expat) -- list(APPEND KMLBASE_DEPENDS EXPAT) --endif() -- --find_package(ZLIB 1.2.8) --if(ZLIB_FOUND) -- include_directories(${ZLIB_INCLUDE_DIR}) --else() -- include(External_zlib) -- list(APPEND KMLBASE_DEPENDS ZLIB) -- list(APPEND MINIZIP_DEPENDS ZLIB) --endif() -- --find_package(MiniZip) --if(MINIZIP_FOUND) -- include_directories(${MINIZIP_INCLUDE_DIR}) --else() -- include(External_minizip) -- list(APPEND KMLBASE_DEPENDS MINIZIP) --endif() -- --find_package(UriParser) --if(URIPARSER_FOUND) -- include_directories(${URIPARSER_INCLUDE_DIR}) --else() -- include(External_uriparser) -- list(APPEND KMLBASE_DEPENDS URIPARSER) --endif() -- --find_package(Boost) --if(Boost_FOUND) -- message(STATUS "Found Boost: ${Boost_VERSION}") --else() -- include(External_boost) -- list(APPEND KMLBASE_DEPENDS BOOST) -- message(STATUS "Found Boost includes: ${Boost_INCLUDE_DIRS}") --endif() -- --include_directories(${Boost_INCLUDE_DIRS}) -+include_directories(${CONAN_INCLUDE_DIRS_BOOST}) - - if(WITH_SWIG) - find_package(SWIG) -@@ -149,16 +106,16 @@ if(WITH_SWIG) - endif() - endif() - --list(APPEND KMLBASE_LINK_LIBS ${EXPAT_LIBRARY}) --list(APPEND KMLBASE_LINK_LIBS ${ZLIB_LIBRARY}) --list(APPEND KMLBASE_LINK_LIBS ${MINIZIP_LIBRARY}) --list(APPEND KMLBASE_LINK_LIBS ${URIPARSER_LIBRARY}) -+list(APPEND KMLBASE_LINK_LIBS "CONAN_PKG::expat") -+list(APPEND KMLBASE_LINK_LIBS "CONAN_PKG::zlib") -+list(APPEND KMLBASE_LINK_LIBS "CONAN_PKG::minizip") -+list(APPEND KMLBASE_LINK_LIBS "CONAN_PKG::uriparser") - --include_directories(${CMAKE_SOURCE_DIR}/src) -+include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src) - - add_subdirectory(src) - --configure_file("${CMAKE_SOURCE_DIR}/cmake/libkml.pc.in" -+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/libkml.pc.in" - "${CMAKE_BINARY_DIR}/libkml.pc" @ONLY) - - install(FILES ${CMAKE_BINARY_DIR}/libkml.pc -@@ -168,7 +125,7 @@ if(BUILD_TESTING) - enable_testing() - find_package(GoogleTest REQUIRED) - include_directories(${GTEST_INCLUDE_DIR}) -- include_directories(${CMAKE_SOURCE_DIR}/tests) -+ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/tests) - add_definitions("-DDATADIR=\"${LIBKML_DATA_DIR}\"") - add_subdirectory(tests) - endif() -@@ -195,7 +152,7 @@ file(RELATIVE_PATH REL_INCLUDE_DIR "${CMAKE_INSTALL_DIR}" - "${INCLUDE_INSTALL_DIR}") - - # ... for the build tree --set(CONF_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/src") -+set(CONF_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src") - configure_file(cmake/LibKMLConfig.cmake.in - "${PROJECT_BINARY_DIR}/LibKMLConfig.cmake" @ONLY) - diff --git a/recipes/libkml/all/test_package/CMakeLists.txt b/recipes/libkml/all/test_package/CMakeLists.txt index 1399066db6945..c68b8c6d04753 100644 --- a/recipes/libkml/all/test_package/CMakeLists.txt +++ b/recipes/libkml/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(LibKML REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} kmlbase kmlconvenience kmldom kmlengine) +target_link_libraries(${PROJECT_NAME} PRIVATE kmlbase kmlconvenience kmldom kmlengine) diff --git a/recipes/libkml/all/test_package/conanfile.py b/recipes/libkml/all/test_package/conanfile.py index 38f4483872d47..98ab55852ad56 100644 --- a/recipes/libkml/all/test_package/conanfile.py +++ b/recipes/libkml/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/libkml/all/test_v1_package/CMakeLists.txt b/recipes/libkml/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libkml/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libkml/all/test_v1_package/conanfile.py b/recipes/libkml/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libkml/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/libliftoff/all/conandata.yml b/recipes/libliftoff/all/conandata.yml new file mode 100644 index 0000000000000..18f54d8b034f2 --- /dev/null +++ b/recipes/libliftoff/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "0.5.0": + url: "https://gitlab.freedesktop.org/emersion/libliftoff/-/archive/v0.5.0/libliftoff-v0.5.0.tar.bz2" + sha256: "2ed21be3c563b129bd8f188195a23256017e15908c195f3edcd3697584caf1c8" + "0.4.1": + url: "https://gitlab.freedesktop.org/emersion/libliftoff/-/archive/v0.4.1/libliftoff-v0.4.1.tar.bz2" + sha256: "2ec4a6b467dda20476acb4d6bd864538ccdaa946e8666f96efa98156bf25cfb5" diff --git a/recipes/libliftoff/all/conanfile.py b/recipes/libliftoff/all/conanfile.py new file mode 100644 index 0000000000000..792e87c5ed4a9 --- /dev/null +++ b/recipes/libliftoff/all/conanfile.py @@ -0,0 +1,83 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +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 +import os + + +required_conan_version = ">=1.53.0" + + +class LibliftoffConan(ConanFile): + name = "libliftoff" + description = "Lightweight KMS plane library." + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://gitlab.freedesktop.org/emersion/libliftoff" + topics = ("drm", "KMS", "plane") + package_type = "library" + 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: + 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("libdrm/2.4.119") + + def validate(self): + if self.settings.os not in ["Linux", "FreeBSD"]: + raise ConanInvalidConfiguration(f"{self.name} only supports FreeBSD and Linux") + + def build_requirements(self): + self.tool_requires("meson/1.3.2") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/2.1.0") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = MesonToolchain(self) + tc.project_options["werror"] = False + tc.generate() + tc = PkgConfigDeps(self) + tc.generate() + tc = VirtualBuildEnv(self) + tc.generate() + + def _patch_sources(self): + replace_in_file(self, os.path.join(self.source_folder, "meson.build"), "subdir('test')", "#subdir('test')") + + def build(self): + self._patch_sources() + meson = Meson(self) + meson.configure() + meson.build() + + def package(self): + copy(self, "LICENSE", 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")) + + def package_info(self): + self.cpp_info.libs = ["liftoff"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["m", "pthread", "dl"]) diff --git a/recipes/libliftoff/all/test_package/conanfile.py b/recipes/libliftoff/all/test_package/conanfile.py new file mode 100644 index 0000000000000..cdcf9b281723d --- /dev/null +++ b/recipes/libliftoff/all/test_package/conanfile.py @@ -0,0 +1,32 @@ +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): + 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/1.3.2") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/2.1.0") + + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libliftoff/all/test_package/meson.build b/recipes/libliftoff/all/test_package/meson.build new file mode 100644 index 0000000000000..a943f09604a97 --- /dev/null +++ b/recipes/libliftoff/all/test_package/meson.build @@ -0,0 +1,5 @@ +project('test_package', 'c') +package_dep = dependency('libliftoff') +executable('test_package', + sources : ['test_package.c'], + dependencies : [package_dep]) diff --git a/recipes/libliftoff/all/test_package/test_package.c b/recipes/libliftoff/all/test_package/test_package.c new file mode 100644 index 0000000000000..82017ed512aff --- /dev/null +++ b/recipes/libliftoff/all/test_package/test_package.c @@ -0,0 +1,7 @@ +#include +#include + +int main(void) { + liftoff_log_set_priority(LIFTOFF_DEBUG); + return EXIT_SUCCESS; +} diff --git a/recipes/libliftoff/config.yml b/recipes/libliftoff/config.yml new file mode 100644 index 0000000000000..bdf259c14aca4 --- /dev/null +++ b/recipes/libliftoff/config.yml @@ -0,0 +1,5 @@ +versions: + "0.5.0": + folder: all + "0.4.1": + folder: all diff --git a/recipes/liblqr/all/CMakeLists.txt b/recipes/liblqr/all/CMakeLists.txt new file mode 100644 index 0000000000000..303355e779e6b --- /dev/null +++ b/recipes/liblqr/all/CMakeLists.txt @@ -0,0 +1,44 @@ +cmake_minimum_required(VERSION 3.15) +project(liblqr LANGUAGES C) + +find_package(glib REQUIRED CONFIG) + +set(LQR_SRC_SUBDIR ${LQR_SRC_DIR}/lqr) + +file(GLOB LQR_SRCS_FILES ${LQR_SRC_SUBDIR}/*.c) + +add_library(lqr-1 ${LQR_SRCS_FILES}) +target_include_directories(lqr-1 PUBLIC ${LQR_SRC_DIR} ${LQR_SRC_SUBDIR}) +target_link_libraries(lqr-1 PUBLIC glib::glib-2.0) +if(WIN32) + if(BUILD_SHARED_LIBS) + target_compile_definitions(lqr-1 PRIVATE LQR_EXPORTS) + else() + target_compile_definitions(lqr-1 PUBLIC LQR_DISABLE_DECLSPEC) + endif() +endif() + +install(FILES ${LQR_SRC_SUBDIR}/lqr.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/lqr-1) +install( + FILES + ${LQR_SRC_SUBDIR}/lqr_base.h + ${LQR_SRC_SUBDIR}/lqr_carver_bias_pub.h + ${LQR_SRC_SUBDIR}/lqr_carver_list_pub.h + ${LQR_SRC_SUBDIR}/lqr_carver_pub.h + ${LQR_SRC_SUBDIR}/lqr_carver_rigmask_pub.h + ${LQR_SRC_SUBDIR}/lqr_cursor_pub.h + ${LQR_SRC_SUBDIR}/lqr_energy_pub.h + ${LQR_SRC_SUBDIR}/lqr_gradient_pub.h + ${LQR_SRC_SUBDIR}/lqr_progress_pub.h + ${LQR_SRC_SUBDIR}/lqr_rwindow_pub.h + ${LQR_SRC_SUBDIR}/lqr_vmap_list_pub.h + ${LQR_SRC_SUBDIR}/lqr_vmap_pub.h + DESTINATION + ${CMAKE_INSTALL_INCLUDEDIR}/lqr-1/lqr +) +install( + TARGETS lqr-1 + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) diff --git a/recipes/liblqr/all/conandata.yml b/recipes/liblqr/all/conandata.yml new file mode 100644 index 0000000000000..d562db29a3a36 --- /dev/null +++ b/recipes/liblqr/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.4.3": + url: "http://liblqr.wdfiles.com/local--files/en:download-page/liblqr-1-0.4.3.tar.bz2" + sha256: "862fc5cecaa96d38d4d9279c8a6fbfc276393f0548909ee0912e41df59894471" diff --git a/recipes/liblqr/all/conanfile.py b/recipes/liblqr/all/conanfile.py new file mode 100644 index 0000000000000..56681e130e9e4 --- /dev/null +++ b/recipes/liblqr/all/conanfile.py @@ -0,0 +1,130 @@ +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.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 +import os + +required_conan_version = ">=1.54.0" + + +class LibLqrConan(ConanFile): + name = "liblqr" + description = ( + "The LiquidRescale (lqr) library provides a C/C++ API for performing " + "non-uniform resizing of images by the seam-carving technique." + ) + license = ("LGPL-3.0-or-later", "GPL-3.0-or-later") + url = "https://github.com/conan-io/conan-center-index" + homepage = "http://liblqr.wikidot.com" + topics = ("image", "resizing", "seam-carving") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + @property + def _is_cl_like(self): + return self.settings.compiler.get_safe("runtime") is not None + + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) + + 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") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + if self._is_cl_like: + cmake_layout(self, src_folder="src") + else: + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("glib/2.81.0", transitive_headers=True) + + def build_requirements(self): + if not self._is_cl_like: + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/[>=2.2 <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], strip_root=True) + + def generate(self): + if self._is_cl_like: + tc = CMakeToolchain(self) + tc.variables["LQR_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.generate() + deps = CMakeDeps(self) + deps.generate() + else: + env = VirtualBuildEnv(self) + env.generate() + + tc = AutotoolsToolchain(self) + yes_no = lambda v: "yes" if v else "no" + tc.configure_args.append("--disable-install-man") + if self.settings.os == "Windows": + # This option in upstream configure.ac must be disabled for static + # windows build, to avoid adding __declspec(dllexport) in front + # of declarations during build. + tc.configure_args.append(f"--enable-declspec={yes_no(self.options.shared)}") + tc.generate() + + deps = PkgConfigDeps(self) + deps.generate() + + def build(self): + if self._is_cl_like: + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) + cmake.build() + 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 self._is_cl_like: + cmake = CMake(self) + cmake.install() + 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", "lqr-1") + self.cpp_info.includedirs = [os.path.join("include", "lqr-1")] + self.cpp_info.libs = ["lqr-1"] + self.cpp_info.requires = ["glib::glib-2.0"] + if self.settings.os == "Windows" and not self.options.shared: + self.cpp_info.defines.append("LQR_DISABLE_DECLSPEC") + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") diff --git a/recipes/liblqr/all/test_package/CMakeLists.txt b/recipes/liblqr/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..fe1dadeb5b33a --- /dev/null +++ b/recipes/liblqr/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) + +find_package(liblqr REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE liblqr::liblqr) diff --git a/recipes/liblqr/all/test_package/conanfile.py b/recipes/liblqr/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0a6bc68712d90 --- /dev/null +++ b/recipes/liblqr/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/liblqr/all/test_package/test_package.c b/recipes/liblqr/all/test_package/test_package.c new file mode 100644 index 0000000000000..890b1df50ef9c --- /dev/null +++ b/recipes/liblqr/all/test_package/test_package.c @@ -0,0 +1,15 @@ +#include + +#include + +int main() { + gint channels = 3; + gint w = 100; + gint h = 100; + guchar *rgb_buffer = (guchar *) malloc(channels * w * h * sizeof(guchar)); + + LqrCarver *r = lqr_carver_new(rgb_buffer, w, h, channels); + lqr_carver_destroy(r); + + return 0; +} diff --git a/recipes/liblqr/config.yml b/recipes/liblqr/config.yml new file mode 100644 index 0000000000000..9be35d17501c4 --- /dev/null +++ b/recipes/liblqr/config.yml @@ -0,0 +1,3 @@ +versions: + "0.4.3": + folder: all diff --git a/recipes/liblsl/all/conandata.yml b/recipes/liblsl/all/conandata.yml index bc0d9ba4438b4..ee93b75bd818e 100644 --- a/recipes/liblsl/all/conandata.yml +++ b/recipes/liblsl/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "1.16.2": + url: "https://github.com/sccn/liblsl/archive/refs/tags/v1.16.2.tar.gz" + sha256: "923aa4c81c0fef651c325e3c27aa5b96771540ca2a0933d1b327db27c6dac839" + "1.16.1": + url: "https://github.com/sccn/liblsl/archive/refs/tags/v1.16.1.tar.gz" + sha256: "7410620c26f8e86ae431e7476bf685918e180bd676982a7f7a7817299c8707c5" "1.16.0": url: "https://github.com/sccn/liblsl/archive/refs/tags/v1.16.0.tar.gz" sha256: "57d9ab0451d6d1a2068f45e4609c67d52c9c0c76d06c07e625034bea4bc01720" diff --git a/recipes/liblsl/all/conanfile.py b/recipes/liblsl/all/conanfile.py index 556c55442cf44..706061d8712ff 100644 --- a/recipes/liblsl/all/conanfile.py +++ b/recipes/liblsl/all/conanfile.py @@ -1,8 +1,12 @@ -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.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, rm, rmdir, replace_in_file +from conan.tools.scm import Version import os -import textwrap -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.54.0" class LiblslConan(ConanFile): @@ -10,7 +14,7 @@ class LiblslConan(ConanFile): description = "Lab Streaming Layer is a C++ library for multi-modal " \ "time-synched data transmission over the local network" license = "MIT" - topics = ("labstreaminglayer", "lsl", "network", "stream", "signal", + topics = ("labstreaminglayer", "lsl", "network", "stream", "signal", "transmission") homepage = "https://github.com/sccn/liblsl" url = "https://github.com/conan-io/conan-center-index" @@ -25,21 +29,23 @@ class LiblslConan(ConanFile): "fPIC": True, } - exports_sources = "CMakeLists.txt" - generators = "cmake", "cmake_find_package_multi" - _cmake = None - @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return "14" @property - def _build_subfolder(self): - return "build_subfolder" + def _compilers_minimum_version(self): + return { + "Visual Studio": "15", + "msvc": "191", + "gcc": "5", + "clang": "3.5", + "apple-clang": "10", + } def requirements(self): - self.requires("boost/1.78.0") - self.requires("pugixml/1.11") + self.requires("boost/1.81.0") + self.requires("pugixml/1.13") def config_options(self): if self.settings.os == "Windows": @@ -47,84 +53,77 @@ 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, 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 generate(self): + tc = CMakeToolchain(self) + tc.variables["LSL_BUILD_STATIC"] = not self.options.shared + tc.variables["LSL_BUNDLED_BOOST"] = False + tc.variables["LSL_BUNDLED_PUGIXML"] = False + tc.variables["lslgitrevision"] = "v" + self.version + tc.variables["lslgitbranch"] = "master" + tc.generate() + cd = CMakeDeps(self) + cd.generate() def _patch_sources(self): if not self.options.shared: # Do not force PIC - 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_POSITION_INDEPENDENT_CODE ON)", "" ) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["LSL_BUILD_STATIC"] = not self.options.shared - self._cmake.definitions["LSL_BUNDLED_BOOST"] = False - self._cmake.definitions["LSL_BUNDLED_PUGIXML"] = False - self._cmake.definitions["lslgitrevision"] = "v" + self.version - self._cmake.definitions["lslgitbranch"] = "master" - 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() - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), "lslver*") - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + rm(self, "lslver*", os.path.join(self.package_folder, "bin")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) - self._create_cmake_module_alias_targets( - os.path.join(self.package_folder, self._module_file_rel_path), - {"lsl": "LSL::lsl"} - ) - - @staticmethod - def _create_cmake_module_alias_targets(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)) - tools.save(module_file, content) - - @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)) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) def package_info(self): - self.cpp_info.names["cmake_find_package"] = "lsl" - self.cpp_info.names["cmake_find_package_multi"] = "lsl" - 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] - self.cpp_info.defines = ["LSLNOAUTOLINK"] + self.cpp_info.set_property("cmake_file_name", "LSL") + self.cpp_info.set_property("cmake_target_name", "LSL::lsl") + # TODO: back to global scope in conan v2 + self.cpp_info.components["_liblsl"].requires = ["boost::boost", "pugixml::pugixml"] + self.cpp_info.components["_liblsl"].libs = ["lsl"] + self.cpp_info.components["_liblsl"].defines = ["LSLNOAUTOLINK"] if not self.options.shared: - self.cpp_info.defines.append("LIBLSL_STATIC") - self.cpp_info.libs = ["lsl"] + self.cpp_info.components["_liblsl"].defines.append("LIBLSL_STATIC") if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.system_libs = ["pthread"] + self.cpp_info.components["_liblsl"].system_libs = ["pthread"] elif self.settings.os == "Windows": - self.cpp_info.system_libs = ["iphlpapi", "winmm", "mswsock", "ws2_32"] + self.cpp_info.components["_liblsl"].system_libs = ["iphlpapi", "winmm", "mswsock", "ws2_32"] + + # TODO: to remove in conan v2 + self.cpp_info.names["cmake_find_package"] = "LSL" + self.cpp_info.names["cmake_find_package_multi"] = "LSL" + self.cpp_info.components["_liblsl"].names["cmake_find_package"] = "lsl" + self.cpp_info.components["_liblsl"].names["cmake_find_package_multi"] = "lsl" + self.cpp_info.components["_liblsl"].set_property("cmake_target_name", "LSL::lsl") diff --git a/recipes/liblsl/all/test_package/CMakeLists.txt b/recipes/liblsl/all/test_package/CMakeLists.txt index df6f46a77757b..0ebdf94800cf2 100644 --- a/recipes/liblsl/all/test_package/CMakeLists.txt +++ b/recipes/liblsl/all/test_package/CMakeLists.txt @@ -1,11 +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(lsl CONFIG REQUIRED) +find_package(LSL CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} lsl::lsl) +target_link_libraries(${PROJECT_NAME} PRIVATE LSL::lsl) set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14) diff --git a/recipes/liblsl/all/test_package/conanfile.py b/recipes/liblsl/all/test_package/conanfile.py index 38f4483872d47..3a8c6c5442b33 100644 --- a/recipes/liblsl/all/test_package/conanfile.py +++ b/recipes/liblsl/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", "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 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/liblsl/all/test_v1_package/CMakeLists.txt b/recipes/liblsl/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/liblsl/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/liblsl/all/test_v1_package/conanfile.py b/recipes/liblsl/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/liblsl/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/liblsl/config.yml b/recipes/liblsl/config.yml index c2f3886dc7353..4caf149a06ee6 100644 --- a/recipes/liblsl/config.yml +++ b/recipes/liblsl/config.yml @@ -1,3 +1,7 @@ versions: + "1.16.2": + folder: all + "1.16.1": + folder: all "1.16.0": folder: all diff --git a/recipes/libltc/all/conanfile.py b/recipes/libltc/all/conanfile.py index 51ff80df61859..0497fcf230bbe 100644 --- a/recipes/libltc/all/conanfile.py +++ b/recipes/libltc/all/conanfile.py @@ -1,18 +1,24 @@ -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 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 LibltcConan(ConanFile): name = "libltc" url = "https://github.com/conan-io/conan-center-index" homepage = "https://x42.github.io/libltc/" - description = "Linear/Logitudinal Time Code (LTC) Library" + description = "Linear/Longitudinal Time Code (LTC) Library" topics = ("timecode", "smpte", "ltc") license = "LGPL-3.0" - settings = "os", "compiler", "build_type", "arch" + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -22,12 +28,6 @@ class LibltcConan(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) @@ -37,75 +37,61 @@ def config_options(self): 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 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) - - @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)), - "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 - - 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)), - ] - if self.settings.compiler == "Visual Studio": - self._autotools.cxx_flags.append("-EHsc") - if tools.Version(self.settings.compiler.version) >= "12": - self._autotools.flags.append("-FS") - self._autotools.configure(args=args, configure_dir=self._source_subfolder) - 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) + if is_msvc(self) and check_min_vs(self, "180", raise_invalid=False): + tc.extra_cflags.append("-FS") + env = tc.environment() + if is_msvc(self): + compile_wrapper = unix_path(self, self.dependencies.build["automake"].conf_info.get("user.automake:compile-wrapper")) + lib_wrapper = unix_path(self, self.dependencies.build["automake"].conf_info.get("user.automake:lib-wrapper")) + env.define("CC", f"{compile_wrapper} cl -nologo") + env.define("CXX", f"{compile_wrapper} cl -nologo") + env.define("AR", f"{lib_wrapper} lib") + env.define("LD", f"{compile_wrapper} link -nologo") + 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(pattern="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")) - os.unlink(os.path.join(self.package_folder, "lib", "libltc.la")) - if self.settings.compiler == "Visual Studio" and self.options.shared: - tools.rename(os.path.join(self.package_folder, "lib", "ltc.dll.lib"), - os.path.join(self.package_folder, "lib", "ltc.lib")) + 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")) + 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) + if is_msvc(self) and self.options.shared: + rename(self, os.path.join(self.package_folder, "lib", "ltc.dll.lib"), + os.path.join(self.package_folder, "lib", "ltc.lib")) def package_info(self): - self.cpp_info.names["pkg_config"] = "ltc" + self.cpp_info.set_property("pkg_config_name", "ltc") self.cpp_info.libs = ["ltc"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["m"] diff --git a/recipes/libltc/all/test_package/CMakeLists.txt b/recipes/libltc/all/test_package/CMakeLists.txt index 7b9b613cbb24a..2e228217c2a41 100644 --- a/recipes/libltc/all/test_package/CMakeLists.txt +++ b/recipes/libltc/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(libltc REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE libltc::libltc) diff --git a/recipes/libltc/all/test_package/conanfile.py b/recipes/libltc/all/test_package/conanfile.py index d4128b0450777..0a6bc68712d90 100644 --- a/recipes/libltc/all/test_package/conanfile.py +++ b/recipes/libltc/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/libltc/all/test_v1_package/CMakeLists.txt b/recipes/libltc/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libltc/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libltc/all/test_v1_package/conanfile.py b/recipes/libltc/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libltc/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/liblzf/all/CMakeLists.txt b/recipes/liblzf/all/CMakeLists.txt new file mode 100644 index 0000000000000..c20ae859c1770 --- /dev/null +++ b/recipes/liblzf/all/CMakeLists.txt @@ -0,0 +1,30 @@ +cmake_minimum_required(VERSION 3.15) +project(liblzf LANGUAGES C) + +add_library(liblzf + lzf_c.c + lzf_d.c + liblzf.def +) +set_target_properties(liblzf PROPERTIES OUTPUT_NAME lzf) + +# The original autotools config specified -O3 -funroll-all-loops for GCC +if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR + CMAKE_C_COMPILER_ID STREQUAL "Clang") + target_compile_options(liblzf PRIVATE "$<$:-O3>") + target_compile_options(liblzf PRIVATE "$<$:-O3>") +elseif(CMAKE_C_COMPILER_ID STREQUAL "MSVC") + target_compile_options(liblzf PRIVATE "$<$:/O2>") + target_compile_options(liblzf PRIVATE "$<$:/O2>") +endif() +if(CMAKE_C_COMPILER_ID STREQUAL "GNU") + target_compile_options(liblzf PRIVATE "-funroll-all-loops") +endif() + +include(GNUInstallDirs) +install(TARGETS liblzf + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} +) +install(FILES lzf.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) diff --git a/recipes/liblzf/all/conandata.yml b/recipes/liblzf/all/conandata.yml new file mode 100644 index 0000000000000..4379b9bd34879 --- /dev/null +++ b/recipes/liblzf/all/conandata.yml @@ -0,0 +1,14 @@ +sources: + "3.6": + url: + - "http://dist.schmorp.de/liblzf/liblzf-3.6.tar.gz" + - "https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/liblzf/3.6-3/liblzf_3.6.orig.tar.gz" + sha256: "9c5de01f7b9ccae40c3f619d26a7abec9986c06c36d260c179cedd04b89fb46a" +patches: + "3.6": + - patch_file: "patches/0001-add-extern-c.patch" + patch_description: "C++: link using C symbol names by adding 'extern \"C\"'" + patch_type: "portability" + - patch_file: "patches/0002-fix-macro-expansion-ub.patch" + patch_description: "Clang: fix \"macro expansion producing 'defined' has undefined behaviour\" warning" + patch_type: "portability" diff --git a/recipes/liblzf/all/conanfile.py b/recipes/liblzf/all/conanfile.py new file mode 100644 index 0000000000000..0796e45c4ac60 --- /dev/null +++ b/recipes/liblzf/all/conanfile.py @@ -0,0 +1,68 @@ +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.53.0" + + +class LiblzfConan(ConanFile): + name = "liblzf" + description = ( + "LZF is an extremely fast (not that much slower than a pure memcpy) " + "compression algorithm. It is ideal for applications where you want to " + "save *some* space but not at the cost of speed." + ) + url = "https://github.com/conan-io/conan-center-index" + homepage = "http://software.schmorp.de/pkg/liblzf.html" + topics = ("lzf", "compression") + license = "BSD-2-Clause", "GPL-2.0-or-later" + 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): + copy(self, "CMakeLists.txt", self.recipe_folder, os.path.join(self.export_sources_folder, "src")) + copy(self, "liblzf.def", self.recipe_folder, os.path.join(self.export_sources_folder, "src")) + 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) + tc.generate() + + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() + 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 = ["lzf"] diff --git a/recipes/liblzf/all/liblzf.def b/recipes/liblzf/all/liblzf.def new file mode 100644 index 0000000000000..2d8efa48df7f7 --- /dev/null +++ b/recipes/liblzf/all/liblzf.def @@ -0,0 +1,3 @@ +EXPORTS + lzf_compress + lzf_decompress diff --git a/recipes/liblzf/all/patches/0001-add-extern-c.patch b/recipes/liblzf/all/patches/0001-add-extern-c.patch new file mode 100644 index 0000000000000..903705a40884d --- /dev/null +++ b/recipes/liblzf/all/patches/0001-add-extern-c.patch @@ -0,0 +1,23 @@ +--- a/lzf.h ++++ b/lzf.h +@@ -48,6 +48,10 @@ + + #define LZF_VERSION 0x0105 /* 1.5, API version */ + ++#ifdef __cplusplus ++extern "C" { ++#endif ++ + /* + * Compress in_len bytes stored at the memory block starting at + * in_data and write the result to out_data, up to a maximum length +@@ -96,5 +100,9 @@ unsigned int + lzf_decompress (const void *const in_data, unsigned int in_len, + void *out_data, unsigned int out_len); + ++#ifdef __cplusplus ++} ++#endif ++ + #endif + diff --git a/recipes/liblzf/all/patches/0002-fix-macro-expansion-ub.patch b/recipes/liblzf/all/patches/0002-fix-macro-expansion-ub.patch new file mode 100644 index 0000000000000..018c4e6810151 --- /dev/null +++ b/recipes/liblzf/all/patches/0002-fix-macro-expansion-ub.patch @@ -0,0 +1,15 @@ +--- a/lzfP.h ++++ b/lzfP.h +@@ -79,7 +79,11 @@ + * Unconditionally aligning does not cost very much, so do it if unsure + */ + #ifndef STRICT_ALIGN +-# define STRICT_ALIGN !(defined(__i386) || defined (__amd64)) ++# if !(defined(__i386) || defined (__amd64)) ++# define STRICT_ALIGN 1 ++# else ++# define STRICT_ALIGN 0 ++# endif + #endif + + /* diff --git a/recipes/liblzf/all/test_package/CMakeLists.txt b/recipes/liblzf/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..c587e08f822f4 --- /dev/null +++ b/recipes/liblzf/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(liblzf REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE liblzf::liblzf) diff --git a/recipes/liblzf/all/test_package/conanfile.py b/recipes/liblzf/all/test_package/conanfile.py new file mode 100644 index 0000000000000..02eb5ce439fb4 --- /dev/null +++ b/recipes/liblzf/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/liblzf/all/test_package/test_package.cpp b/recipes/liblzf/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..fa8baf612976d --- /dev/null +++ b/recipes/liblzf/all/test_package/test_package.cpp @@ -0,0 +1,16 @@ +#include +#include +#include + +int main(void) { + const char in_data[] = "AAAAAAAAAAAAAAAAAAAAA"; + const unsigned int buf_len = 100; + char compressed_data[buf_len]; + char decompressed_data[buf_len]; + unsigned int compressed_len = lzf_compress(in_data, sizeof(in_data), compressed_data, buf_len); + unsigned int decompressed_len = lzf_decompress(compressed_data, compressed_len, decompressed_data, buf_len); + if (compressed_len >= 10 || decompressed_len != sizeof(in_data)) { + return EXIT_FAILURE; + } + return EXIT_SUCCESS; +} diff --git a/recipes/liblzf/all/test_v1_package/CMakeLists.txt b/recipes/liblzf/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/liblzf/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/liblzf/all/test_v1_package/conanfile.py b/recipes/liblzf/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..c492184eec19c --- /dev/null +++ b/recipes/liblzf/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/liblzf/config.yml b/recipes/liblzf/config.yml new file mode 100644 index 0000000000000..86c7a0c01bf99 --- /dev/null +++ b/recipes/liblzf/config.yml @@ -0,0 +1,3 @@ +versions: + "3.6": + folder: all diff --git a/recipes/libmad/all/CMakeLists.txt b/recipes/libmad/all/CMakeLists.txt new file mode 100644 index 0000000000000..38a40c94acdd8 --- /dev/null +++ b/recipes/libmad/all/CMakeLists.txt @@ -0,0 +1,34 @@ +cmake_minimum_required(VERSION 3.15) +project(libmad LANGUAGES C) + +add_library(mad + ${LIBMAD_SRC_DIR}/bit.c + ${LIBMAD_SRC_DIR}/decoder.c + ${LIBMAD_SRC_DIR}/fixed.c + ${LIBMAD_SRC_DIR}/frame.c + ${LIBMAD_SRC_DIR}/huffman.c + ${LIBMAD_SRC_DIR}/layer12.c + ${LIBMAD_SRC_DIR}/layer3.c + ${LIBMAD_SRC_DIR}/stream.c + ${LIBMAD_SRC_DIR}/synth.c + ${LIBMAD_SRC_DIR}/timer.c + ${LIBMAD_SRC_DIR}/version.c + ${LIBMAD_SRC_DIR}/huffman.c +) + +target_include_directories(mad PUBLIC ${LIBMAD_SRC_DIR}/msvc++) +target_compile_definitions(mad PRIVATE FPM_DEFAULT ASO_ZEROCHECK HAVE_CONFIG_H) +set_target_properties(mad + PROPERTIES + VERSION ${LIBMAD_VERSION} + SOVERSION ${LIBMAD_VERSION_MAJOR} +) + +include(GNUInstallDirs) +install(FILES ${LIBMAD_SRC_DIR}/msvc++/mad.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +install( + TARGETS mad + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR} +) diff --git a/recipes/libmad/all/conandata.yml b/recipes/libmad/all/conandata.yml index 15cdb9fb19a6e..ef36d3264b7e2 100644 --- a/recipes/libmad/all/conandata.yml +++ b/recipes/libmad/all/conandata.yml @@ -1,4 +1,4 @@ sources: "0.15.1b": url: "https://sourceforge.net/projects/mad/files/libmad/0.15.1b/libmad-0.15.1b.tar.gz" - sha256: bbfac3ed6bfbc2823d3775ebb931087371e142bb0e9bb1bee51a76a6e0078690 + sha256: "bbfac3ed6bfbc2823d3775ebb931087371e142bb0e9bb1bee51a76a6e0078690" diff --git a/recipes/libmad/all/conanfile.py b/recipes/libmad/all/conanfile.py index fb912e50ed5eb..ddf1ee367e1b2 100644 --- a/recipes/libmad/all/conanfile.py +++ b/recipes/libmad/all/conanfile.py @@ -1,114 +1,75 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment, MSBuild -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, replace_in_file +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version import os -import shutil -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class LibmadConan(ConanFile): name = "libmad" description = "MAD is a high-quality MPEG audio decoder." - topics = ("conan", "mad", "MPEG", "audio", "decoder") + topics = ("mad", "MPEG", "audio", "decoder") url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.underbit.com/products/mad/" license = "GPL-2.0-or-later" + package_type = "library" settings = "os", "arch", "compiler", "build_type" - 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" - - @property - def _is_msvc(self): - return self.settings.compiler == "Visual Studio" + exports_sources = "CMakeLists.txt" 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.options.shared and self._is_msvc: - raise ConanInvalidConfiguration("libmad does not support shared library for MSVC") - - @property - def _settings_build(self): - return getattr(self, "settings_build", self.settings) + def layout(self): + cmake_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") + def validate(self): + if is_msvc(self) and self.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} shared not supported by msvc") 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: - self._build_msvc() - else: - self._build_autotools() - - def _build_msvc(self): - with tools.chdir(os.path.join(self._source_subfolder, "msvc++")): - # cl : Command line error D8016: '/ZI' and '/Gy-' command-line options are incompatible - tools.replace_in_file("libmad.dsp", "/ZI ", "") - if self.settings.arch == "x86_64": - tools.replace_in_file("libmad.dsp", "Win32", "x64") - tools.replace_in_file("libmad.dsp", "FPM_INTEL", "FPM_DEFAULT") - tools.replace_in_file("mad.h", "# define FPM_INTEL", "# define FPM_DEFAULT") - with tools.vcvars(self.settings): - self.run("devenv libmad.dsp /upgrade") - msbuild = MSBuild(self) - msbuild.build(project_file="libmad.vcxproj") - - @property - def _user_info_build(self): - return getattr(self, "user_info_build", self.deps_user_info) + def generate(self): + tc = CMakeToolchain(self) + tc.variables["LIBMAD_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.variables["LIBMAD_VERSION"] = self.version + tc.variables["LIBMAD_VERSION_MAJOR"] = Version(self.version).major + tc.generate() - 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")) - autotools = self._configure_autotools() - autotools.make() - - def _configure_autotools(self): - if self._autotools: - return self._autotools - args = [] - if self.options.shared: - args = ["--disable-static", "--enable-shared"] - else: - args = ["--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(self): + replace_in_file( + self, os.path.join(self.source_folder, "msvc++", "mad.h"), + "# define FPM_INTEL", "# define FPM_DEFAULT", + ) + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) + cmake.build() def package(self): - self.copy("COPYRIGHT", dst="licenses", src=self._source_subfolder) - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - self.copy("CREDITS", dst="licenses", src=self._source_subfolder) - if self._is_msvc: - self.copy(pattern="*.lib", dst="lib", src=self._source_subfolder, keep_path=False) - self.copy(pattern="mad.h", dst="include", src=os.path.join(self._source_subfolder, "msvc++")) - else: - autotools = self._configure_autotools() - autotools.install() - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") + for license_file in ("COPYRIGHT", "COPYING", "CREDITS"): + copy(self, license_file, 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 = ["libmad" if self._is_msvc else "mad"] + self.cpp_info.libs = ["mad"] diff --git a/recipes/libmad/all/test_package/CMakeLists.txt b/recipes/libmad/all/test_package/CMakeLists.txt index 7b9b613cbb24a..74d514ce40214 100644 --- a/recipes/libmad/all/test_package/CMakeLists.txt +++ b/recipes/libmad/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(libmad REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE libmad::libmad) diff --git a/recipes/libmad/all/test_package/conanfile.py b/recipes/libmad/all/test_package/conanfile.py index d4128b0450777..98ab55852ad56 100644 --- a/recipes/libmad/all/test_package/conanfile.py +++ b/recipes/libmad/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/libmad/all/test_v1_package/CMakeLists.txt b/recipes/libmad/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libmad/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libmad/all/test_v1_package/conanfile.py b/recipes/libmad/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libmad/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/libmagic/all/conandata.yml b/recipes/libmagic/all/conandata.yml new file mode 100644 index 0000000000000..f585a96bf81ba --- /dev/null +++ b/recipes/libmagic/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "5.45": + url: "http://ftp.astron.com/pub/file/file-5.45.tar.gz" + sha256: "fc97f51029bb0e2c9f4e3bffefdaf678f0e039ee872b9de5c002a6d09c784d82" diff --git a/recipes/libmagic/all/conanfile.py b/recipes/libmagic/all/conanfile.py new file mode 100644 index 0000000000000..6faae6cdf6502 --- /dev/null +++ b/recipes/libmagic/all/conanfile.py @@ -0,0 +1,102 @@ +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, rm, rmdir, rename +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +import os + +required_conan_version = ">=1.52.0" + +class LibmagicConan(ConanFile): + name = "libmagic" + description = "Magic number recognition library - detect files with data in particular fixed formats." + license = "DocumentRef-COPYING:LicenseRef-BSD-2-Clause-File" # Modified BSD 2-Clause that states no restrictions on US export + homepage = "https://www.darwinsys.com/file/" + url = "https://github.com/conan-io/conan-center-index" + topics = "file", "format", "magic" + + 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.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("bzip2/1.0.8") + self.requires("xz_utils/[>=5.4.5 <6]") + self.requires("zlib/[>=1.2.11 <2]") + self.requires("zstd/[^1.5]") + # TODO: Add lzlib recipe + # self.requires("lzlib/1.13") + + def validate(self): + if self.settings.os == "Windows": + raise ConanInvalidConfiguration("Windows is not supported yet") + + def build_requirements(self): + self.tool_requires("libtool/2.4.7") + if cross_building(self): + 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") + tc = AutotoolsToolchain(self) + # Set from 'auto' to explicitly enabled + tc.configure_args.append(f"--enable-bzlib={self.dependencies['bzip2'].package_folder}") + tc.configure_args.append(f"--enable-xzlib={self.dependencies['xz_utils'].package_folder}") + tc.configure_args.append(f"--enable-zlib={self.dependencies['zlib'].package_folder}") + tc.configure_args.append(f"--enable-zstdlib={self.dependencies['zstd'].package_folder}") + tc.configure_args.append(f"--disable-lzlib") + tc.generate() + + def build(self): + autotools = Autotools(self) + autotools.autoreconf() + autotools.configure() + autotools.make() + + def package(self): + copy(self, "COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + autotools = Autotools(self) + autotools.install() + fix_apple_shared_install_name(self) + rename(self, os.path.join(self.package_folder, "share", "misc"), + os.path.join(self.package_folder, "res")) + 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", "libmagic") + self.cpp_info.libs = ["magic"] + self.runenv_info.define_path("MAGIC", os.path.join(self.package_folder, "res", "magic.mgc")) + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") diff --git a/recipes/libmagic/all/test_package/CMakeLists.txt b/recipes/libmagic/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..c8e4d0491b35e --- /dev/null +++ b/recipes/libmagic/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package C) + +find_package(libmagic REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE libmagic::libmagic) diff --git a/recipes/libmagic/all/test_package/conanfile.py b/recipes/libmagic/all/test_package/conanfile.py new file mode 100644 index 0000000000000..fafe4ac251f83 --- /dev/null +++ b/recipes/libmagic/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, run=True) + + 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("file --version", env="conanrun") + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libmagic/all/test_package/test_package.c b/recipes/libmagic/all/test_package/test_package.c new file mode 100644 index 0000000000000..64afba96e3118 --- /dev/null +++ b/recipes/libmagic/all/test_package/test_package.c @@ -0,0 +1,31 @@ +#include + +#include +#include + +int main(int argc, char **argv) +{ + const char *magic_full; + magic_t magic_cookie; + + magic_cookie = magic_open(MAGIC_MIME); + + if (magic_cookie == NULL) { + printf("unable to initialize magic library\n"); + return 1; + } + + char *mgc_path = getenv("MAGIC"); + printf("Loading default magic database from %s\n", mgc_path); + + if (magic_load(magic_cookie, NULL) != 0) { + printf("cannot load magic database - %s\n", magic_error(magic_cookie)); + magic_close(magic_cookie); + return 1; + } + + magic_full = magic_file(magic_cookie, argv[0]); + printf("%s\n", magic_full); + magic_close(magic_cookie); + return 0; +} diff --git a/recipes/libmagic/config.yml b/recipes/libmagic/config.yml new file mode 100644 index 0000000000000..6655b3c6cb852 --- /dev/null +++ b/recipes/libmagic/config.yml @@ -0,0 +1,3 @@ +versions: + "5.45": + folder: all diff --git a/recipes/libmaxminddb/all/conandata.yml b/recipes/libmaxminddb/all/conandata.yml index 83c876364326d..673b071ef221d 100644 --- a/recipes/libmaxminddb/all/conandata.yml +++ b/recipes/libmaxminddb/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "1.10.0": + url: "https://github.com/maxmind/libmaxminddb/releases/download/1.10.0/libmaxminddb-1.10.0.tar.gz" + sha256: "5e6db72df423ae225bfe8897069f6def40faa8931f456b99d79b8b4d664c6671" + "1.9.1": + url: "https://github.com/maxmind/libmaxminddb/releases/download/1.9.1/libmaxminddb-1.9.1.tar.gz" + sha256: "a80682a89d915fdf60b35d316232fb04ebf36fff27fda9bd39fe8a38d3cd3f12" + "1.8.0": + url: "https://github.com/maxmind/libmaxminddb/releases/download/1.8.0/libmaxminddb-1.8.0.tar.gz" + sha256: "1107799f77be6aa3b9796ad0eed8ffcc334bf45f8bd18e6a984d8adf3e719c6d" "1.7.1": url: "https://github.com/maxmind/libmaxminddb/releases/download/1.7.1/libmaxminddb-1.7.1.tar.gz" sha256: "e8414f0dedcecbc1f6c31cb65cd81650952ab0677a4d8c49cab603b3b8fb083e" diff --git a/recipes/libmaxminddb/all/conanfile.py b/recipes/libmaxminddb/all/conanfile.py index 7afd56f70e087..866a4b5b085e7 100644 --- a/recipes/libmaxminddb/all/conanfile.py +++ b/recipes/libmaxminddb/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 export_conandata_patches, apply_conandata_patches, copy, get, rmdir +from conan.tools.scm import Version import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class LibmaxminddbConan(ConanFile): name = "libmaxminddb" @@ -13,13 +14,16 @@ class LibmaxminddbConan(ConanFile): homepage = "http://maxmind.github.io/libmaxminddb/" topics = ("maxmind", "geoip") settings = "os", "arch", "compiler", "build_type" + package_type = "library" options = { "shared": [True, False], "fPIC": [True, False], + "with_binaries": [True, False], } default_options = { "shared": False, "fPIC": True, + "with_binaries": True, } def export_sources(self): @@ -28,21 +32,14 @@ def export_sources(self): def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + if Version(self.version) < "1.10.0": + del self.options.with_binaries 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 + 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") @@ -54,6 +51,8 @@ def source(self): def generate(self): tc = CMakeToolchain(self) tc.variables["BUILD_TESTING"] = False + if "with_binaries" in self.options: + tc.variables["MAXMINDDB_BUILD_BINARIES"] = self.options.with_binaries # 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() @@ -79,9 +78,8 @@ def package_info(self): if self.settings.os == "Windows": self.cpp_info.system_libs = ["ws2_32"] - if self.settings.os != "Windows": + if self.settings.os != "Windows" and self.options.get_safe("with_binaries", True): 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 diff --git a/recipes/libmaxminddb/config.yml b/recipes/libmaxminddb/config.yml index 9efd2189b76e9..4c7c42eea0733 100644 --- a/recipes/libmaxminddb/config.yml +++ b/recipes/libmaxminddb/config.yml @@ -1,4 +1,10 @@ versions: + "1.10.0": + folder: all + "1.9.1": + folder: all + "1.8.0": + folder: all "1.7.1": folder: all "1.6.0": diff --git a/recipes/libmbus/all/CMakeLists.txt b/recipes/libmbus/all/CMakeLists.txt deleted file mode 100644 index 361b35d4c17d9..0000000000000 --- a/recipes/libmbus/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/libmbus/all/conanfile.py b/recipes/libmbus/all/conanfile.py index 5c3ff6e87aae2..841dbf22c8b0d 100644 --- a/recipes/libmbus/all/conanfile.py +++ b/recipes/libmbus/all/conanfile.py @@ -1,36 +1,31 @@ import os -from conans import CMake, ConanFile, 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 copy, get, rmdir + +required_conan_version = ">=1.53.0" class LibMbusConan(ConanFile): name = "libmbus" + description = "Meter-bus library and utility programs" license = "BSD-3-Clause" - homepage = "https://github.com/rscada/libmbus" url = "https://github.com/conan-io/conan-center-index" - description = """Meter-bus library and utility programs""" - topics = "conan", "mbus", "metering", "iot", "meter", "bus", "protocol" - exports_sources = "CMakeLists.txt" - settings = "os", "compiler", "build_type", "arch" + homepage = "https://github.com/rscada/libmbus" + topics = ("mbus", "metering", "iot", "meter", "bus", "protocol") + + 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, } - 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": @@ -38,43 +33,41 @@ 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 validate(self): if self.settings.os not in ["Linux"]: - raise ConanInvalidConfiguration("Only Linux supported") - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + raise ConanInvalidConfiguration("Only Linux is supported") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = self.name + "-" + \ - os.path.basename( - self.conan_data["sources"][self.version]["url"]).split(".")[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['LIBMBUS_ENABLE_COVERAGE'] = False - self._cmake.definitions['LIBMBUS_BUILD_TESTS'] = False - self._cmake.definitions['LIBMBUS_BUILD_EXAMPLES'] = False - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["LIBMBUS_ENABLE_COVERAGE"] = False + tc.variables["LIBMBUS_BUILD_TESTS"] = False + tc.variables["LIBMBUS_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", 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, "share")) - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, - "lib", "libmbus", "cmake")) + 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", "libmbus", "cmake")) def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) - if self.settings.os == "Linux": + self.cpp_info.libs = ["libmbus"] + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["pthread", "m"] diff --git a/recipes/libmbus/all/test_package/CMakeLists.txt b/recipes/libmbus/all/test_package/CMakeLists.txt index 34af13462f44f..076d1645a34b0 100644 --- a/recipes/libmbus/all/test_package/CMakeLists.txt +++ b/recipes/libmbus/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 C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(libmbus REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE libmbus::libmbus) diff --git a/recipes/libmbus/all/test_package/conanfile.py b/recipes/libmbus/all/test_package/conanfile.py index 933dbf96533ae..fae501d0afb9e 100644 --- a/recipes/libmbus/all/test_package/conanfile.py +++ b/recipes/libmbus/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" + test_type = "explicit" -class TestConan(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,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") - bin_path = 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/libmbus/all/test_v1_package/CMakeLists.txt b/recipes/libmbus/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/libmbus/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/libmbus/all/test_v1_package/conanfile.py b/recipes/libmbus/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..9de3689208f00 --- /dev/null +++ b/recipes/libmbus/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.settings): + bin_path = os.path.join("bin", "test_package") + bin_path = self.run(bin_path, run_environment=True) diff --git a/recipes/libmd/all/conandata.yml b/recipes/libmd/all/conandata.yml new file mode 100644 index 0000000000000..6433755dc3365 --- /dev/null +++ b/recipes/libmd/all/conandata.yml @@ -0,0 +1,6 @@ +sources: + "1.1.0": + url: + - "https://libbsd.freedesktop.org/releases/libmd-1.1.0.tar.xz" + - "https://archive.hadrons.org/software/libmd/libmd-1.1.0.tar.xz" + sha256: "1bd6aa42275313af3141c7cf2e5b964e8b1fd488025caf2f971f43b00776b332" diff --git a/recipes/libmd/all/conanfile.py b/recipes/libmd/all/conanfile.py new file mode 100644 index 0000000000000..b7ad5096688cd --- /dev/null +++ b/recipes/libmd/all/conanfile.py @@ -0,0 +1,114 @@ +import os + +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 chdir, rename, 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 + +required_conan_version = ">=1.53.0" + + +class LibMDConan(ConanFile): + name = "libmd" + description = "Message Digest functions from BSD systems" + license = "BSD-2-Clause AND BSD-3-Clause AND ISC AND Beerware AND DocumentRef-COPYING:LicenseRef-libmd-Public-Domain" + homepage = "https://gitlab.freedesktop.org/libbsd/libmd" + url = "https://github.com/conan-io/conan-center-index" + topics = ("message-digest", "hash", "bsd", + "md2", "md4", "md5", "ripemd", "rmd160", + "sha", "sha1", "sha2", "sha256", "sha512") + + 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) + + 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 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") + if is_msvc(self): + self.tool_requires("automake/1.16.5") + + def generate(self): + venv = VirtualBuildEnv(self) + venv.generate() + + tc = AutotoolsToolchain(self) + if is_msvc(self): + tc.extra_cflags.append("-FS") + tc.extra_cxxflags.append("-FS") + tc.generate() + + if is_msvc(self): + env = Environment() + 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") + env.define("NM", "dumpbin -symbols") + env.define("OBJDUMP", ":") + env.define("RANLIB", ":") + env.define("STRIP", ":") + env.vars(self).save_script("conanbuild_msvc") + + def layout(self): + basic_layout(self, src_folder="src") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def build(self): + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.configure() + autotools.make() + + def package(self): + copy(self, "COPYING", self.source_folder, os.path.join(self.package_folder, "licenses")) + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.install() + if self.settings.os == "Windows" and self.options.shared: + rename(self, os.path.join(self.package_folder, "lib", "md.dll.lib"), + os.path.join(self.package_folder, "lib", "md-0.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", "libmd") + + if self.settings.os == "Windows" and self.options.shared: + lib = "md-0" + else: + lib = "md" + self.cpp_info.libs = [lib] diff --git a/recipes/libmd/all/test_package/CMakeLists.txt b/recipes/libmd/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..6bdd5550a5b87 --- /dev/null +++ b/recipes/libmd/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package C) + +find_package(libmd REQUIRED) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE libmd::libmd) diff --git a/recipes/libmd/all/test_package/conanfile.py b/recipes/libmd/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0f2d20bbcb70a --- /dev/null +++ b/recipes/libmd/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", "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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libmd/all/test_package/test_package.c b/recipes/libmd/all/test_package/test_package.c new file mode 100644 index 0000000000000..a7d2d1ef0b245 --- /dev/null +++ b/recipes/libmd/all/test_package/test_package.c @@ -0,0 +1,12 @@ +#include +#include + +int main() { + const char data[] = "12345"; + uint8_t hash[MD5_DIGEST_LENGTH]; + MD5_CTX md5_ctx; + MD5Init(&md5_ctx); + MD5Update(&md5_ctx, (const uint8_t *)data, strlen(data)); + MD5Final(hash, &md5_ctx); + return 0; +} diff --git a/recipes/libmd/config.yml b/recipes/libmd/config.yml new file mode 100644 index 0000000000000..11b7aff3a5ac4 --- /dev/null +++ b/recipes/libmd/config.yml @@ -0,0 +1,3 @@ +versions: + "1.1.0": + folder: "all" diff --git a/recipes/libmediainfo/all/CMakeLists.txt b/recipes/libmediainfo/all/CMakeLists.txt deleted file mode 100644 index 8f32238b21da5..0000000000000 --- a/recipes/libmediainfo/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) - -add_definitions(${CONAN_DEFINES}) -set(ZenLib_LIBRARY ${CONAN_LIBS_LIBZEN}) -set(TinyXML_FOUND ON) - -add_subdirectory(source_subfolder/Project/CMake) diff --git a/recipes/libmediainfo/all/conandata.yml b/recipes/libmediainfo/all/conandata.yml index c54a0606f82a2..5a0b5059c5987 100644 --- a/recipes/libmediainfo/all/conandata.yml +++ b/recipes/libmediainfo/all/conandata.yml @@ -13,8 +13,37 @@ sources: sha256: "6848310eb7050efe7f90f18191dacfcc220c924390b8088fdf0d553274917f72" patches: "22.03": - - patch_file: "patches/0002-cmake-get-property-location.patch" - base_path: "source_subfolder" + - patch_file: "patches/21.09-0001-cmake-get-property-location.patch" + patch_description: "CMake: remove use of LOCATION property" + patch_type: "portability" + patch_source: "https://github.com/MediaArea/MediaInfoLib/pull/1526" + - patch_file: "patches/21.09-0002-cmake-handle-dependencies.patch" + patch_description: "CMake: robust discovery and link of dependencies" + patch_type: "conan" + "21.09": + - patch_file: "patches/21.09-0001-cmake-get-property-location.patch" + patch_description: "CMake: remove use of LOCATION property" + patch_type: "portability" + patch_source: "https://github.com/MediaArea/MediaInfoLib/pull/1526" + - patch_file: "patches/21.09-0002-cmake-handle-dependencies.patch" + patch_description: "CMake: robust discovery and link of dependencies" + patch_type: "conan" + "21.03": + - patch_file: "patches/21.03-0001-cmake-get-property-location.patch" + patch_description: "CMake: remove use of LOCATION property" + patch_type: "portability" + patch_source: "https://github.com/MediaArea/MediaInfoLib/pull/1526" + - patch_file: "patches/21.03-0002-cmake-handle-dependencies.patch" + patch_description: "CMake: robust discovery and link of dependencies" + patch_type: "conan" "20.03": - - patch_file: "patches/0001-cmakelists-CMAKE_MODULE_PATH-find_package.patch" - base_path: "source_subfolder" + - patch_file: "patches/20.03-0001-cmake-get-property-location.patch" + patch_description: "CMake: remove use of LOCATION property" + patch_type: "portability" + patch_source: "https://github.com/MediaArea/MediaInfoLib/pull/1526" + - patch_file: "patches/20.03-0002-cmake-handle-dependencies.patch" + patch_description: "CMake: robust discovery and link of dependencies" + patch_type: "conan" + - patch_file: "patches/20.03-0003-cmake-minimum-required.patch" + patch_description: "CMake: fix cmake_minimum_required()" + patch_type: "conan" diff --git a/recipes/libmediainfo/all/conanfile.py b/recipes/libmediainfo/all/conanfile.py index 37d62638387b4..29fb127a8927a 100644 --- a/recipes/libmediainfo/all/conanfile.py +++ b/recipes/libmediainfo/all/conanfile.py @@ -1,11 +1,16 @@ -from conan.tools.files import rename -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, 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 import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class LibmediainfoConan(ConanFile): @@ -13,9 +18,12 @@ class LibmediainfoConan(ConanFile): license = ("BSD-2-Clause", "Apache-2.0", "GLPL-2.1+", "GPL-2.0-or-later", "MPL-2.0") homepage = "https://mediaarea.net/en/MediaInfo" url = "https://github.com/conan-io/conan-center-index" - description = "MediaInfo is a convenient unified display of the most relevant technical and tag data for video and audio files" - topics = ("libmediainfo", "video", "audio", "metadata", "tag") - + description = ( + "MediaInfo is a convenient unified display of the most relevant " + "technical and tag data for video and audio files" + ) + topics = ("video", "audio", "metadata", "tag") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -26,16 +34,8 @@ class LibmediainfoConan(ConanFile): "fPIC": True, } - 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": @@ -43,67 +43,64 @@ 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("libcurl/7.82.0") - self.requires("libzen/0.4.38") + self.requires("libcurl/[>=7.78.0 <9]") + self.requires("libzen/0.4.38", transitive_headers=True, transitive_libs=True) self.requires("tinyxml2/9.0.0") - self.requires("zlib/1.2.12") + self.requires("zlib/[>=1.2.11 <2]") def validate(self): - if not self.options["libzen"].enable_unicode: + if not self.dependencies["libzen"].options.enable_unicode: raise ConanInvalidConfiguration("This package requires libzen with unicode 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["BUILD_ZENLIB"] = False - cmake.definitions["BUILD_ZLIB"] = False - # Generate a relocatable shared lib on Macos - cmake.definitions["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" - cmake.configure() - return cmake + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_ZENLIB"] = False + tc.variables["BUILD_ZLIB"] = False + if Version(self.version) < "22.03": + # Generate a relocatable shared lib on Macos + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "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) - - rename(self, "Findtinyxml2.cmake", "FindTinyXML.cmake") - tools.replace_in_file("FindTinyXML.cmake", "tinyxml2_LIBRARIES", "TinyXML_LIBRARIES") + apply_conandata_patches(self) - # TODO: move this to a patch (see how https://github.com/MediaArea/MediaInfoLib/issues/1408 if addressed by upstream) + # TODO: move this to a patch (see how https://github.com/MediaArea/MediaInfoLib/issues/1408 is addressed by upstream) postfix = "" if self.settings.build_type == "Debug": if self.settings.os == "Windows": postfix += "d" - elif tools.is_apple_os(self.settings.os): + elif is_apple_os(self): postfix += "_debug" - tools.replace_in_file(os.path.join(self._source_subfolder, "Source", "MediaInfoDLL", "MediaInfoDLL.h"), - "MediaInfo.dll", - "MediaInfo{}.dll".format(postfix)) - tools.replace_in_file(os.path.join(self._source_subfolder, "Source", "MediaInfoDLL", "MediaInfoDLL.h"), - "libmediainfo.0.dylib", - "libmediainfo{}.0.dylib".format(postfix)) + mediainfodll_h = os.path.join(self.source_folder, "Source", "MediaInfoDLL", "MediaInfoDLL.h") + replace_in_file(self, mediainfodll_h, "MediaInfo.dll", f"MediaInfo{postfix}.dll") + replace_in_file(self, mediainfodll_h, "libmediainfo.0.dylib", f"libmediainfo{postfix}.0.dylib") def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, "Project", "CMake")) cmake.build() def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - self.copy("License.html", 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, "License.html", 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, "bin"), "*.pdb") - 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")) + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + 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( @@ -111,21 +108,20 @@ def package(self): {"mediainfo": "MediaInfoLib::MediaInfoLib"} ) - @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", "MediaInfoLib") @@ -135,9 +131,9 @@ def package_info(self): if self.settings.build_type == "Debug": if self.settings.os == "Windows": postfix += "d" - elif tools.is_apple_os(self.settings.os): + elif is_apple_os(self): postfix += "_debug" - self.cpp_info.libs = ["mediainfo" + postfix] + self.cpp_info.libs = [f"mediainfo{postfix}"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.extend(["dl", "m", "pthread"]) @@ -146,4 +142,3 @@ def package_info(self): self.cpp_info.names["cmake_find_package_multi"] = "MediaInfoLib" 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"] = "libmediainfo" diff --git a/recipes/libmediainfo/all/patches/0001-cmakelists-CMAKE_MODULE_PATH-find_package.patch b/recipes/libmediainfo/all/patches/0001-cmakelists-CMAKE_MODULE_PATH-find_package.patch deleted file mode 100644 index 0a6c4f7b41354..0000000000000 --- a/recipes/libmediainfo/all/patches/0001-cmakelists-CMAKE_MODULE_PATH-find_package.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- Project/CMake/CMakeLists.txt -+++ Project/CMake/CMakeLists.txt -@@ -2,7 +2,7 @@ - - cmake_minimum_required(VERSION 2.8.11) - --set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules") -+list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules") - - set(MediaInfoLib_MAJOR_VERSION 20) - set(MediaInfoLib_MINOR_VERSION 03) -@@ -85,10 +85,10 @@ - endif() - - # use bundled tinyxml only if no system --find_package(TinyXML) -+find_package(TinyXML REQUIRED) - - # use system curl if is present --find_package(CURL) -+find_package(CURL REQUIRED) - - include_directories(${MediaInfoLib_SOURCES_PATH}) - include_directories(${MediaInfoLib_SOURCES_PATH}/ThirdParty/md5/) diff --git a/recipes/libmediainfo/all/patches/20.03-0001-cmake-get-property-location.patch b/recipes/libmediainfo/all/patches/20.03-0001-cmake-get-property-location.patch new file mode 100644 index 0000000000000..d4cf8aa8336f4 --- /dev/null +++ b/recipes/libmediainfo/all/patches/20.03-0001-cmake-get-property-location.patch @@ -0,0 +1,29 @@ +--- a/Project/CMake/CMakeLists.txt ++++ b/Project/CMake/CMakeLists.txt +@@ -56,10 +56,8 @@ if (NOT BUILD_ZLIB) + find_package(ZLIB REQUIRED) + else() + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../../zlib ${CMAKE_CURRENT_BINARY_DIR}/zlib) +- get_target_property(ZLIB_LIBRARIES zlibstatic LOCATION) + if(NOT BUILD_SHARED_LIBS) +- get_filename_component(ZLIB_LIBRARIES ${ZLIB_LIBRARIES} NAME) +- set(ZLIB_LIBRARIES "${LIB_INSTALL_DIR}/${ZLIB_LIBRARIES}") ++ set(ZLIB_LIBRARIES "${LIB_INSTALL_DIR}/$") + endif() + if(UNIX AND BUILD_SHARED_LIBS) + target_compile_options(zlibstatic PRIVATE -fPIC) +@@ -398,13 +396,7 @@ endif() + target_link_libraries(mediainfo ${ZenLib_LIBRARY} ${ZLIB_LIBRARIES}) + + if(MSVC AND BUILD_SHARED_LIBS) +- get_target_property(LOCATION mediainfo LOCATION_DEBUG) +- string(REGEX REPLACE "\\.[^.]*$" ".pdb" LOCATION "${LOCATION}") +- install(FILES ${LOCATION} DESTINATION ${BIN_INSTALL_DIR} CONFIGURATIONS Debug) +- +- get_target_property(LOCATION mediainfo LOCATION_RELWITHDEBINFO) +- string(REGEX REPLACE "\\.[^.]*$" ".pdb" LOCATION "${LOCATION}") +- install(FILES ${LOCATION} DESTINATION ${BIN_INSTALL_DIR} CONFIGURATIONS RelWithDebInfo) ++ install(FILES $ DESTINATION ${BIN_INSTALL_DIR} OPTIONAL) + endif() + + if (APPLE) diff --git a/recipes/libmediainfo/all/patches/20.03-0002-cmake-handle-dependencies.patch b/recipes/libmediainfo/all/patches/20.03-0002-cmake-handle-dependencies.patch new file mode 100644 index 0000000000000..0cfa50f5d6096 --- /dev/null +++ b/recipes/libmediainfo/all/patches/20.03-0002-cmake-handle-dependencies.patch @@ -0,0 +1,59 @@ +--- a/Project/CMake/CMakeLists.txt ++++ b/Project/CMake/CMakeLists.txt +@@ -2,7 +2,7 @@ project(MediaInfoLib) + + cmake_minimum_required(VERSION 2.8.11) + +-set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules") ++list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules") + + set(MediaInfoLib_MAJOR_VERSION 20) + set(MediaInfoLib_MINOR_VERSION 03) +@@ -83,7 +83,7 @@ elseif(APPLE) + endif() + + # use bundled tinyxml only if no system +-find_package(TinyXML) ++find_package(tinyxml2 REQUIRED CONFIG) + + # use system curl if is present + find_package(CURL) +@@ -350,7 +350,7 @@ if(WIN32) + set(MediaInfoLib_SRCS ${MediaInfoLib_SRCS} ${MediaInfoLib_SOURCES_PATH}/ThirdParty/aes-gladman/aes_ni.c) + endif() + +-if(NOT TinyXML_FOUND) ++if(NOT tinyxml2_FOUND) + include_directories(${MediaInfoLib_SOURCES_PATH}/ThirdParty/tinyxml2/) + list(APPEND MediaInfoLib_SRCS ${MediaInfoLib_SOURCES_PATH}/ThirdParty/tinyxml2/tinyxml2.cpp) + endif() +@@ -368,7 +368,7 @@ if(NOT CURL_FOUND) + target_compile_definitions(mediainfo PRIVATE MEDIAINFO_LIBCURL_NO) + else() + include_directories(${CURL_INCLUDE_DIRS}) +- target_link_libraries(mediainfo ${CURL_LIBRARIES}) ++ target_link_libraries(mediainfo CURL::libcurl) + set(CURL_PC " libcurl") + set(CURL_LIB " -lcurl") + endif() +@@ -383,17 +383,17 @@ target_include_directories(mediainfo PRIVATE + ${MediaInfoLib_SOURCES_PATH}/ThirdParty/sha2-gladman/ + ${MediaInfoLib_SOURCES_PATH}/ThirdParty/hmac-gladman/) + +-if(NOT TinyXML_FOUND) ++if(NOT tinyxml2_FOUND) + target_include_directories(mediainfo PRIVATE ${MediaInfoLib_SOURCES_PATH}/ThirdParty/tinyxml2/) + else() +- target_link_libraries(mediainfo "${TinyXML_LIBRARIES}") ++ target_link_libraries(mediainfo tinyxml2::tinyxml2) + endif() + + if(BUILD_ZENLIB) + target_include_directories(mediainfo PRIVATE ${ZLIB_INCLUDE_DIRS}) + endif() + +-target_link_libraries(mediainfo ${ZenLib_LIBRARY} ${ZLIB_LIBRARIES}) ++target_link_libraries(mediainfo zen ZLIB::ZLIB) + + if(MSVC AND BUILD_SHARED_LIBS) + install(FILES $ DESTINATION ${BIN_INSTALL_DIR} OPTIONAL) diff --git a/recipes/libmediainfo/all/patches/20.03-0003-cmake-minimum-required.patch b/recipes/libmediainfo/all/patches/20.03-0003-cmake-minimum-required.patch new file mode 100644 index 0000000000000..c5d841d99efb7 --- /dev/null +++ b/recipes/libmediainfo/all/patches/20.03-0003-cmake-minimum-required.patch @@ -0,0 +1,10 @@ +--- a/Project/CMake/CMakeLists.txt ++++ b/Project/CMake/CMakeLists.txt +@@ -1,6 +1,6 @@ ++cmake_minimum_required(VERSION 2.8.11) + project(MediaInfoLib) + +-cmake_minimum_required(VERSION 2.8.11) + + list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules") + diff --git a/recipes/libmediainfo/all/patches/21.03-0001-cmake-get-property-location.patch b/recipes/libmediainfo/all/patches/21.03-0001-cmake-get-property-location.patch new file mode 100644 index 0000000000000..5b2da1594d4ef --- /dev/null +++ b/recipes/libmediainfo/all/patches/21.03-0001-cmake-get-property-location.patch @@ -0,0 +1,29 @@ +--- a/Project/CMake/CMakeLists.txt ++++ b/Project/CMake/CMakeLists.txt +@@ -56,10 +56,8 @@ if (NOT BUILD_ZLIB) + find_package(ZLIB REQUIRED) + else() + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../../zlib ${CMAKE_CURRENT_BINARY_DIR}/zlib) +- get_target_property(ZLIB_LIBRARIES zlibstatic LOCATION) + if(NOT BUILD_SHARED_LIBS) +- get_filename_component(ZLIB_LIBRARIES ${ZLIB_LIBRARIES} NAME) +- set(ZLIB_LIBRARIES "${LIB_INSTALL_DIR}/${ZLIB_LIBRARIES}") ++ set(ZLIB_LIBRARIES "${LIB_INSTALL_DIR}/$") + endif() + if(UNIX AND BUILD_SHARED_LIBS) + target_compile_options(zlibstatic PRIVATE -fPIC) +@@ -400,13 +398,7 @@ endif() + target_link_libraries(mediainfo ${ZenLib_LIBRARY} ${ZLIB_LIBRARIES}) + + if(MSVC AND BUILD_SHARED_LIBS) +- get_target_property(LOCATION mediainfo LOCATION_DEBUG) +- string(REGEX REPLACE "\\.[^.]*$" ".pdb" LOCATION "${LOCATION}") +- install(FILES ${LOCATION} DESTINATION ${BIN_INSTALL_DIR} CONFIGURATIONS Debug) +- +- get_target_property(LOCATION mediainfo LOCATION_RELWITHDEBINFO) +- string(REGEX REPLACE "\\.[^.]*$" ".pdb" LOCATION "${LOCATION}") +- install(FILES ${LOCATION} DESTINATION ${BIN_INSTALL_DIR} CONFIGURATIONS RelWithDebInfo) ++ install(FILES $ DESTINATION ${BIN_INSTALL_DIR} OPTIONAL) + endif() + + if (APPLE) diff --git a/recipes/libmediainfo/all/patches/21.03-0002-cmake-handle-dependencies.patch b/recipes/libmediainfo/all/patches/21.03-0002-cmake-handle-dependencies.patch new file mode 100644 index 0000000000000..2c573df236311 --- /dev/null +++ b/recipes/libmediainfo/all/patches/21.03-0002-cmake-handle-dependencies.patch @@ -0,0 +1,50 @@ +--- a/Project/CMake/CMakeLists.txt ++++ b/Project/CMake/CMakeLists.txt +@@ -83,7 +83,7 @@ elseif(APPLE) + endif() + + # use bundled tinyxml only if no system +-find_package(TinyXML) ++find_package(tinyxml2 REQUIRED CONFIG) + + # use system curl if is present + find_package(CURL) +@@ -352,7 +352,7 @@ if(WIN32) + set(MediaInfoLib_SRCS ${MediaInfoLib_SRCS} ${MediaInfoLib_SOURCES_PATH}/ThirdParty/aes-gladman/aes_ni.c) + endif() + +-if(NOT TinyXML_FOUND) ++if(NOT tinyxml2_FOUND) + include_directories(${MediaInfoLib_SOURCES_PATH}/ThirdParty/tinyxml2/) + list(APPEND MediaInfoLib_SRCS ${MediaInfoLib_SOURCES_PATH}/ThirdParty/tinyxml2/tinyxml2.cpp) + endif() +@@ -370,7 +370,7 @@ if(NOT CURL_FOUND) + target_compile_definitions(mediainfo PRIVATE MEDIAINFO_LIBCURL_NO) + else() + include_directories(${CURL_INCLUDE_DIRS}) +- target_link_libraries(mediainfo ${CURL_LIBRARIES}) ++ target_link_libraries(mediainfo CURL::libcurl) + set(CURL_PC " libcurl") + set(CURL_LIB " -lcurl") + endif() +@@ -385,17 +385,17 @@ target_include_directories(mediainfo PRIVATE + ${MediaInfoLib_SOURCES_PATH}/ThirdParty/sha2-gladman/ + ${MediaInfoLib_SOURCES_PATH}/ThirdParty/hmac-gladman/) + +-if(NOT TinyXML_FOUND) ++if(NOT tinyxml2_FOUND) + target_include_directories(mediainfo PRIVATE ${MediaInfoLib_SOURCES_PATH}/ThirdParty/tinyxml2/) + else() +- target_link_libraries(mediainfo "${TinyXML_LIBRARIES}") ++ target_link_libraries(mediainfo tinyxml2::tinyxml2) + endif() + + if(BUILD_ZENLIB) + target_include_directories(mediainfo PRIVATE ${ZLIB_INCLUDE_DIRS}) + endif() + +-target_link_libraries(mediainfo ${ZenLib_LIBRARY} ${ZLIB_LIBRARIES}) ++target_link_libraries(mediainfo zen ZLIB::ZLIB) + + if(MSVC AND BUILD_SHARED_LIBS) + install(FILES $ DESTINATION ${BIN_INSTALL_DIR} OPTIONAL) diff --git a/recipes/libmediainfo/all/patches/0002-cmake-get-property-location.patch b/recipes/libmediainfo/all/patches/21.09-0001-cmake-get-property-location.patch similarity index 100% rename from recipes/libmediainfo/all/patches/0002-cmake-get-property-location.patch rename to recipes/libmediainfo/all/patches/21.09-0001-cmake-get-property-location.patch diff --git a/recipes/libmediainfo/all/patches/21.09-0002-cmake-handle-dependencies.patch b/recipes/libmediainfo/all/patches/21.09-0002-cmake-handle-dependencies.patch new file mode 100644 index 0000000000000..5c11938fdfdda --- /dev/null +++ b/recipes/libmediainfo/all/patches/21.09-0002-cmake-handle-dependencies.patch @@ -0,0 +1,50 @@ +--- a/Project/CMake/CMakeLists.txt ++++ b/Project/CMake/CMakeLists.txt +@@ -83,7 +83,7 @@ elseif(APPLE) + endif() + + # use bundled tinyxml only if no system +-find_package(TinyXML) ++find_package(tinyxml2 REQUIRED CONFIG) + + # use system curl if is present + find_package(CURL) +@@ -357,7 +357,7 @@ if(WIN32) + set(MediaInfoLib_SRCS ${MediaInfoLib_SRCS} ${MediaInfoLib_SOURCES_PATH}/ThirdParty/aes-gladman/aes_ni.c) + endif() + +-if(NOT TinyXML_FOUND) ++if(NOT tinyxml2_FOUND) + include_directories(${MediaInfoLib_SOURCES_PATH}/ThirdParty/tinyxml2/) + list(APPEND MediaInfoLib_SRCS ${MediaInfoLib_SOURCES_PATH}/ThirdParty/tinyxml2/tinyxml2.cpp) + endif() +@@ -375,7 +375,7 @@ if(NOT CURL_FOUND) + target_compile_definitions(mediainfo PRIVATE MEDIAINFO_LIBCURL_NO) + else() + include_directories(${CURL_INCLUDE_DIRS}) +- target_link_libraries(mediainfo ${CURL_LIBRARIES}) ++ target_link_libraries(mediainfo CURL::libcurl) + set(CURL_PC " libcurl") + set(CURL_LIB " -lcurl") + endif() +@@ -390,17 +390,17 @@ target_include_directories(mediainfo PRIVATE + ${MediaInfoLib_SOURCES_PATH}/ThirdParty/sha2-gladman/ + ${MediaInfoLib_SOURCES_PATH}/ThirdParty/hmac-gladman/) + +-if(NOT TinyXML_FOUND) ++if(NOT tinyxml2_FOUND) + target_include_directories(mediainfo PRIVATE ${MediaInfoLib_SOURCES_PATH}/ThirdParty/tinyxml2/) + else() +- target_link_libraries(mediainfo "${TinyXML_LIBRARIES}") ++ target_link_libraries(mediainfo tinyxml2::tinyxml2) + endif() + + if(BUILD_ZENLIB) + target_include_directories(mediainfo PRIVATE ${ZLIB_INCLUDE_DIRS}) + endif() + +-target_link_libraries(mediainfo ${ZenLib_LIBRARY} ${ZLIB_LIBRARIES}) ++target_link_libraries(mediainfo zen ZLIB::ZLIB) + + if(MSVC AND BUILD_SHARED_LIBS) + install(FILES $ DESTINATION ${BIN_INSTALL_DIR} OPTIONAL) diff --git a/recipes/libmediainfo/all/test_package/CMakeLists.txt b/recipes/libmediainfo/all/test_package/CMakeLists.txt index ddd72d9a23de2..c81192f5719cd 100644 --- a/recipes/libmediainfo/all/test_package/CMakeLists.txt +++ b/recipes/libmediainfo/all/test_package/CMakeLists.txt @@ -1,13 +1,10 @@ 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(MediaInfoLib REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} mediainfo) +target_link_libraries(${PROJECT_NAME} PRIVATE mediainfo) option(LIBMEDIAINFO_SHARED "Is libmediainfo a shared library?") if(LIBMEDIAINFO_SHARED) diff --git a/recipes/libmediainfo/all/test_package/conanfile.py b/recipes/libmediainfo/all/test_package/conanfile.py index f658082513f60..181c93b2a88a0 100644 --- a/recipes/libmediainfo/all/test_package/conanfile.py +++ b/recipes/libmediainfo/all/test_package/conanfile.py @@ -1,4 +1,6 @@ -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 # testsrc.mp4 generated with: @@ -6,17 +8,27 @@ 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["LIBMEDIAINFO_SHARED"] = self.dependencies["libmediainfo"].options.shared + tc.generate() def build(self): cmake = CMake(self) - cmake.definitions["LIBMEDIAINFO_SHARED"] = self.options["libmediainfo"].shared cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - testsrc = os.path.join(self.source_folder, "testsrc.mp4") - self.run("{} {}".format(bin_path, testsrc), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libmediainfo/all/test_package/test_package.cpp b/recipes/libmediainfo/all/test_package/test_package.cpp index d4de9d263a0bc..5aa26cc3025e5 100644 --- a/recipes/libmediainfo/all/test_package/test_package.cpp +++ b/recipes/libmediainfo/all/test_package/test_package.cpp @@ -10,22 +10,18 @@ #include int main(int argc, const char *argv[]) { - if (argc < 2) { - std::cerr << "Need at least one argument\n"; - return 1; - } MEDIAINFO_NS::MediaInfo mediainfo; #if defined(LIBMEDIAINFO_SHARED) std::cout << "Is MediaInfo ready? " << mediainfo.IsReady() << "\n"; #endif - ZenLib::Ztring videofile(argv[1]); - size_t opened = mediainfo.Open(videofile.To_Unicode()); - if (!opened) { - std::cerr << "Open failed\n"; - return 1; - } + std::string fakeVideoData = "FAKE DATA FOR TESTING\n"; + + mediainfo.Open_Buffer_Init(fakeVideoData.size(), 0); + mediainfo.Open_Buffer_Continue((unsigned char*)fakeVideoData.data(), fakeVideoData.size()); + mediainfo.Open_Buffer_Finalize(); + MEDIAINFO_NS::String info = mediainfo.Inform(); #ifdef UNICODE std::wcout << info; diff --git a/recipes/libmediainfo/all/test_package/testsrc.mp4 b/recipes/libmediainfo/all/test_package/testsrc.mp4 deleted file mode 100644 index 7e12ea126587e..0000000000000 Binary files a/recipes/libmediainfo/all/test_package/testsrc.mp4 and /dev/null differ diff --git a/recipes/libmediainfo/all/test_v1_package/CMakeLists.txt b/recipes/libmediainfo/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libmediainfo/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libmediainfo/all/test_v1_package/conanfile.py b/recipes/libmediainfo/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..c3c864d919d33 --- /dev/null +++ b/recipes/libmediainfo/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["LIBMEDIAINFO_SHARED"] = self.options["libmediainfo"].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/libmemcached/all/conandata.yml b/recipes/libmemcached/all/conandata.yml new file mode 100644 index 0000000000000..10b3ba148bd9a --- /dev/null +++ b/recipes/libmemcached/all/conandata.yml @@ -0,0 +1,9 @@ +sources: + "1.0.18": + url: "https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz" + sha256: "e22c0bb032fde08f53de9ffbc5a128233041d9f33b5de022c0978a2149885f82" + +patches: + "1.0.18": + - patch_file: "patches/01-compile-fix.patch" + patch_description: "fix compilation on MacOS" diff --git a/recipes/libmemcached/all/conanfile.py b/recipes/libmemcached/all/conanfile.py new file mode 100644 index 0000000000000..0288b9bb0fd69 --- /dev/null +++ b/recipes/libmemcached/all/conanfile.py @@ -0,0 +1,99 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps +from conan.tools.build import cross_building +from conan.tools.files import apply_conandata_patches, get, copy, export_conandata_patches, rm, rmdir +from conan.tools.layout import basic_layout +from conan.tools.apple import fix_apple_shared_install_name, is_apple_os + +import os + +required_conan_version = ">=1.54.0" + +class LibmemcachedConan(ConanFile): + name = "libmemcached" + + # Optional metadata + license = "BSD License" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://libmemcached.org/" + description = "libmemcached is a C client library for interfacing to a memcached server" + topics = ("cache", "network", "cloud") + # package_type should usually be "library" (if there is shared option) + package_type = "library" + + # Binary configuration + settings = "os", "compiler", "build_type", "arch" + options = { + "shared": [True, False], + "fPIC": [True, False], + "sasl": [True, False] + } + default_options = {"shared": False, + "fPIC": True, + "sasl": False} + + def source(self): + get(self, **self.conan_data["sources"][self.version], + strip_root=True, destination=self.source_folder) + + def export_sources(self): + export_conandata_patches(self) + + 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): + # src_folder must use the same source folder name the project + basic_layout(self, src_folder="src") + + def validate(self): + if self.settings.os not in ["Linux", "FreeBSD"] and not is_apple_os(self): + raise ConanInvalidConfiguration(f"{self.ref} is not supported on {self.settings.os}.") + + def _patch_source(self): + apply_conandata_patches(self) + + 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('--disable-dependency-tracking') + if not self.options.sasl: + tc.configure_args.append("--disable-sasl") + tc.generate() + + AutotoolsDeps(self).generate() + + def build(self): + self._patch_source() + + 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")) + + autotools = Autotools(self) + autotools.install() + + # some files extensions and folders are not allowed. Please, read the FAQs to get informed. + 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")) + + # 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 = ["memcached"] + self.cpp_info.system_libs = ["m"] + diff --git a/recipes/libmemcached/all/patches/01-compile-fix.patch b/recipes/libmemcached/all/patches/01-compile-fix.patch new file mode 100644 index 0000000000000..368bfda4321ab --- /dev/null +++ b/recipes/libmemcached/all/patches/01-compile-fix.patch @@ -0,0 +1,218 @@ +diff --git a/clients/memflush.cc b/clients/memflush.cc +index 8bd0dbf..cdba743 100644 +--- a/clients/memflush.cc ++++ b/clients/memflush.cc +@@ -39,7 +39,7 @@ int main(int argc, char *argv[]) + { + options_parse(argc, argv); + +- if (opt_servers == false) ++ if (opt_servers == NULL) + { + char *temp; + +@@ -48,7 +48,7 @@ int main(int argc, char *argv[]) + opt_servers= strdup(temp); + } + +- if (opt_servers == false) ++ if (opt_servers == NULL) + { + std::cerr << "No Servers provided" << std::endl; + exit(EXIT_FAILURE); +diff --git a/example/byteorder.cc b/example/byteorder.cc +index fdfa021..8c03d35 100644 +--- a/example/byteorder.cc ++++ b/example/byteorder.cc +@@ -42,27 +42,59 @@ + #include + + /* Byte swap a 64-bit number. */ +-#ifndef swap64 +-static inline uint64_t swap64(uint64_t in) +-{ +-#ifndef WORDS_BIGENDIAN +- /* Little endian, flip the bytes around until someone makes a faster/better ++#if !defined(htonll) && !defined(ntohll) ++#if __BYTE_ORDER == __LITTLE_ENDIAN ++# if defined(__FreeBSD__) ++# include ++# define htonll(x) bswap64(x) ++# define ntohll(x) bswap64(x) ++# elif defined(__APPLE__) ++# include ++# define htonll(x) OSSwapInt64(x) ++# define ntohll(x) OSSwapInt64(x) ++# elif defined(__OpenBSD__) ++# include ++# define htonll(x) swap64(x) ++# define ntohll(x) swap64(x) ++# elif defined(__NetBSD__) ++# include ++# include ++# if defined(__BSWAP_RENAME) && !defined(__bswap_32) ++# define htonll(x) bswap64(x) ++# define ntohll(x) bswap64(x) ++# endif ++# elif defined(__sun) || defined(sun) ++# include ++# define htonll(x) BSWAP_64(x) ++# define ntohll(x) BSWAP_64(x) ++# elif defined(_MSC_VER) ++# include ++# define htonll(x) _byteswap_uint64(x) ++# define ntohll(x) _byteswap_uint64(x) ++# else ++# include ++# ifndef bswap_64 ++ /* Little endian, flip the bytes around until someone makes a faster/better + * way to do this. */ +- uint64_t rv= 0; +- for (uint8_t x= 0; x < 8; x++) +- { +- rv= (rv << 8) | (in & 0xff); +- in >>= 8; +- } +- return rv; ++ static inline uint64_t bswap_64(uint64_t in) ++ { ++ uint64_t rv= 0; ++ for (uint8_t x= 0; x < 8; x++) ++ { ++ rv= (rv << 8) | (in & 0xff); ++ in >>= 8; ++ } ++ return rv; ++ } ++# endif ++# define htonll(x) bswap_64(x) ++# define ntohll(x) bswap_64(x) ++# endif + #else +- /* big-endian machines don't need byte swapping */ +- return in; +-#endif // WORDS_BIGENDIAN +-} ++# define htonll(x) (x) ++# define ntohll(x) (x) ++#endif + #endif +- +-#ifdef HAVE_HTONLL + + uint64_t example_ntohll(uint64_t value) + { +@@ -73,17 +105,3 @@ uint64_t example_htonll(uint64_t value) + { + return htonll(value); + } +- +-#else // HAVE_HTONLL +- +-uint64_t example_ntohll(uint64_t value) +-{ +- return swap64(value); +-} +- +-uint64_t example_htonll(uint64_t value) +-{ +- return swap64(value); +-} +- +-#endif // HAVE_HTONLL +diff --git a/libmemcached/byteorder.cc b/libmemcached/byteorder.cc +index 9f11aa8..f167822 100644 +--- a/libmemcached/byteorder.cc ++++ b/libmemcached/byteorder.cc +@@ -39,41 +39,66 @@ + #include "libmemcached/byteorder.h" + + /* Byte swap a 64-bit number. */ +-#ifndef swap64 +-static inline uint64_t swap64(uint64_t in) +-{ +-#ifndef WORDS_BIGENDIAN +- /* Little endian, flip the bytes around until someone makes a faster/better ++#if !defined(htonll) && !defined(ntohll) ++#if __BYTE_ORDER == __LITTLE_ENDIAN ++# if defined(__FreeBSD__) ++# include ++# define htonll(x) bswap64(x) ++# define ntohll(x) bswap64(x) ++# elif defined(__APPLE__) ++# include ++# define htonll(x) OSSwapInt64(x) ++# define ntohll(x) OSSwapInt64(x) ++# elif defined(__OpenBSD__) ++# include ++# define htonll(x) swap64(x) ++# define ntohll(x) swap64(x) ++# elif defined(__NetBSD__) ++# include ++# include ++# if defined(__BSWAP_RENAME) && !defined(__bswap_32) ++# define htonll(x) bswap64(x) ++# define ntohll(x) bswap64(x) ++# endif ++# elif defined(__sun) || defined(sun) ++# include ++# define htonll(x) BSWAP_64(x) ++# define ntohll(x) BSWAP_64(x) ++# elif defined(_MSC_VER) ++# include ++# define htonll(x) _byteswap_uint64(x) ++# define ntohll(x) _byteswap_uint64(x) ++# else ++# include ++# ifndef bswap_64 ++ /* Little endian, flip the bytes around until someone makes a faster/better + * way to do this. */ +- uint64_t rv= 0; +- for (uint8_t x= 0; x < 8; ++x) +- { +- rv= (rv << 8) | (in & 0xff); +- in >>= 8; +- } +- return rv; ++ static inline uint64_t bswap_64(uint64_t in) ++ { ++ uint64_t rv= 0; ++ for (uint8_t x= 0; x < 8; x++) ++ { ++ rv= (rv << 8) | (in & 0xff); ++ in >>= 8; ++ } ++ return rv; ++ } ++# endif ++# define htonll(x) bswap_64(x) ++# define ntohll(x) bswap_64(x) ++# endif + #else +- /* big-endian machines don't need byte swapping */ +- return in; +-#endif // WORDS_BIGENDIAN +-} ++# define htonll(x) (x) ++# define ntohll(x) (x) ++#endif + #endif +- + + uint64_t memcached_ntohll(uint64_t value) + { +-#ifdef HAVE_HTONLL + return ntohll(value); +-#else +- return swap64(value); +-#endif + } + + uint64_t memcached_htonll(uint64_t value) + { +-#ifdef HAVE_HTONLL + return htonll(value); +-#else +- return swap64(value); +-#endif + } diff --git a/recipes/libmemcached/all/test_package/CMakeLists.txt b/recipes/libmemcached/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..453e1be414e2c --- /dev/null +++ b/recipes/libmemcached/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package CXX) +set(CMAKE_CXX_STANDARD 11) + +find_package(libmemcached REQUIRED) + +add_executable(${PROJECT_NAME} src/example.cpp) +#target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} libmemcached::libmemcached) diff --git a/recipes/libmemcached/all/test_package/conanfile.py b/recipes/libmemcached/all/test_package/conanfile.py new file mode 100644 index 0000000000000..6bf32dfafa72f --- /dev/null +++ b/recipes/libmemcached/all/test_package/conanfile.py @@ -0,0 +1,28 @@ +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.bindir, "test_package") + self.run(bin_path, env="conanrun") + diff --git a/recipes/libmemcached/all/test_package/src/example.cpp b/recipes/libmemcached/all/test_package/src/example.cpp new file mode 100644 index 0000000000000..5f730988f2265 --- /dev/null +++ b/recipes/libmemcached/all/test_package/src/example.cpp @@ -0,0 +1,7 @@ +#include +#include + +int main() { + std::cout << memcached_lib_version() << '\n'; + return 0; +} diff --git a/recipes/libmemcached/all/test_v1_package/CMakeLists.txt b/recipes/libmemcached/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..8b0d38c4a2f57 --- /dev/null +++ b/recipes/libmemcached/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +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/libmemcached/all/test_v1_package/conanfile.py b/recipes/libmemcached/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..395686390e2f2 --- /dev/null +++ b/recipes/libmemcached/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): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) + diff --git a/recipes/libmemcached/config.yml b/recipes/libmemcached/config.yml new file mode 100644 index 0000000000000..701bdddc9bca6 --- /dev/null +++ b/recipes/libmemcached/config.yml @@ -0,0 +1,3 @@ +versions: + "1.0.18": + folder: all diff --git a/recipes/libmeshb/all/conandata.yml b/recipes/libmeshb/all/conandata.yml new file mode 100644 index 0000000000000..dd9233505c3f3 --- /dev/null +++ b/recipes/libmeshb/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "7.80": + url: "https://github.com/LoicMarechal/libMeshb/archive/refs/tags/v7.80.tar.gz" + sha256: "3026e84fa7c5c14428b1e0d1484038b0cf24921814e9cd0b6e0f13a34b0f1248" diff --git a/recipes/libmeshb/all/conanfile.py b/recipes/libmeshb/all/conanfile.py new file mode 100644 index 0000000000000..4f0284a48ab3d --- /dev/null +++ b/recipes/libmeshb/all/conanfile.py @@ -0,0 +1,81 @@ +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 + +required_conan_version = ">=1.53.0" + +class LibmeshbConan(ConanFile): + name = "libmeshb" + description = "A library to handle the *.meshb file format." + license = "MPL-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/LoicMarechal/libMeshb" + topics = ("3d", "mesh", "geometry") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_gmf_asio": [True, False] + } + default_options = { + "shared": False, + "fPIC": True, + "with_gmf_asio": False + } + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + del self.options.with_gmf_asio + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def configure(self): + # Windows shared build doesn't seems supported because code doesn't include dllexport + # See https://www.kitware.com/create-dlls-on-windows-without-declspec-using-new-cmake-export-all-feature/ + if self.settings.os == "Windows": + del self.options.shared + self.package_type = "static-library" + if self.options.get_safe("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["WITH_GMF_AIO"] = self.options.get_safe("with_gmf_asio", False) + tc.generate() + + def _patch_sources(self): + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "add_subdirectory (examples)", "") + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "install (FILES LICENSE.txt copyright.txt DESTINATION share/libMeshb)", "") + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "install (DIRECTORY sample_meshes DESTINATION share/libMeshb)", "") + replace_in_file(self, os.path.join(self.source_folder, "sources/CMakeLists.txt"), "install(DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/ DESTINATION include)", "") + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE.txt", self.source_folder, 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", "libMeshb") + self.cpp_info.set_property("cmake_target_name", "libMeshb::Meshb.7") + self.cpp_info.libs = ["Meshb.7"] + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("rt") + self.cpp_info.system_libs.append("m") \ No newline at end of file diff --git a/recipes/libmeshb/all/test_package/CMakeLists.txt b/recipes/libmeshb/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..5cc1c2f79e98d --- /dev/null +++ b/recipes/libmeshb/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) + +project(test_package LANGUAGES C) + +find_package(libMeshb REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE libMeshb::Meshb.7) diff --git a/recipes/libmeshb/all/test_package/conanfile.py b/recipes/libmeshb/all/test_package/conanfile.py new file mode 100644 index 0000000000000..f5cf204295e19 --- /dev/null +++ b/recipes/libmeshb/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libmeshb/all/test_package/test_package.c b/recipes/libmeshb/all/test_package/test_package.c new file mode 100644 index 0000000000000..ab27c830995fa --- /dev/null +++ b/recipes/libmeshb/all/test_package/test_package.c @@ -0,0 +1,7 @@ +#include + +int main() { + int ver, dim; + int64_t LibIdx = GmfOpenMesh("/dev/null", GmfRead, &ver, &dim); + return 0; +} diff --git a/recipes/libmeshb/config.yml b/recipes/libmeshb/config.yml new file mode 100644 index 0000000000000..d51cd95e8905e --- /dev/null +++ b/recipes/libmeshb/config.yml @@ -0,0 +1,3 @@ +versions: + "7.80": + folder: all diff --git a/recipes/libmetalink/all/conanfile.py b/recipes/libmetalink/all/conanfile.py index 26b6f8a3d9655..57b9b280bec17 100644 --- a/recipes/libmetalink/all/conanfile.py +++ b/recipes/libmetalink/all/conanfile.py @@ -53,9 +53,9 @@ def layout(self): def requirements(self): if self.options.xml_backend == "expat": - self.requires("expat/2.4.9") + self.requires("expat/[>=2.6.2 <3]") elif self.options.xml_backend == "libxml2": - self.requires("libxml2/2.9.14") + self.requires("libxml2/[>=2.12.5 <3]") def validate(self): if is_msvc(self): @@ -63,7 +63,7 @@ def validate(self): def build_requirements(self): self.tool_requires("gnu-config/cci.20210814") - self.tool_requires("pkgconf/1.9.3") + self.tool_requires("pkgconf/2.1.0") if self._settings_build.os == "Windows": self.win_bash = True if not self.conf.get("tools.microsoft.bash:path", check_type=str): diff --git a/recipes/libmicrohttpd/all/conandata.yml b/recipes/libmicrohttpd/all/conandata.yml index 0276eb4f1e40e..f20a5496c465e 100644 --- a/recipes/libmicrohttpd/all/conandata.yml +++ b/recipes/libmicrohttpd/all/conandata.yml @@ -1,12 +1,12 @@ sources: + "0.9.77": + url: "https://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-0.9.77.tar.gz" + sha256: "9e7023a151120060d2806a6ea4c13ca9933ece4eacfc5c9464d20edddb76b0a0" "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-msbuild-RuntimeLibrary.patch" - patch_description: "Remove RuntimeLibrary from vcxproject + use conantoolchain.props" - patch_type: "conan" - - patch_file: "patches/0.9.75-0002-allow-release-with-debug-runtime.patch" - patch_description: "Remove RuntimeLibrary from vcxproject + use conantoolchain.props" + - 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 index 1811e1503e36c..93b7eea08cff3 100644 --- a/recipes/libmicrohttpd/all/conanfile.py +++ b/recipes/libmicrohttpd/all/conanfile.py @@ -1,12 +1,15 @@ -from conan import ConanFile, Version -from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir -from conan.tools.gnu import Autotools, AutotoolsToolchain, PkgConfigDeps -from conan.tools.microsoft import MSBuild, MSBuildToolchain, is_msvc, vs_layout -from conan.tools.layout import basic_layout +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.52.0" +required_conan_version = ">=1.54.0" class LibmicrohttpdConan(ConanFile): @@ -42,12 +45,13 @@ class LibmicrohttpdConan(ConanFile): 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": - try: - del self.options.fPIC - except Exception: - pass del self.options.epoll if is_msvc(self): del self.options.with_https @@ -58,62 +62,45 @@ def config_options(self): 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 + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") - def validate(self): - if is_msvc(self): - if self.info.settings.arch not in ("x86", "x86_64"): - raise ConanInvalidConfiguration("Unsupported architecture (only x86 and x86_64 are supported)") - if self.info.settings.build_type not in ("Release", "Debug"): - raise ConanInvalidConfiguration("Unsupported build type (only Release and Debug are supported)") + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - if self.options.get_safe("with_zlib", False): - self.requires("zlib/1.2.13") - if self.options.get_safe("with_https", False): + if self.options.get_safe("with_zlib"): + self.requires("zlib/[>=1.2.11 <2]") + + 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", default=False, check_type=str): + 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_folder, strip_root=True) - - def export_sources(self): - export_conandata_patches(self) - - def layout(self): - if is_msvc(self): - vs_layout(self) - else: - basic_layout(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" - pkg = PkgConfigDeps(self) - pkg.generate() - autotools = AutotoolsToolchain(self) - autotools.configure_args.extend([ + 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)}", @@ -125,44 +112,48 @@ def generate(self): "--disable-examples", "--disable-curl", ]) - if self.settings.os == "Windows": - if self.options.with_zlib: - # This fixes libtool refusing to build a shared library when it sees `-lz` - libdir = self.deps_cpp_info["zlib"].lib_paths[0] - autotools.extra_ldflags.extend([os.path.join(libdir, lib).replace("\\", "/") for lib in os.listdir(libdir)]) - autotools.generate() + tc.generate() + AutotoolsDeps(self).generate() @property def _msvc_configuration(self): - return f"{self.settings.build_type}-{'dll' if self.options.shared else 'static'}" + 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): - if self.settings.compiler == "Visual Studio": - if Version(self.settings.compiler.version) >= 16: - subdir = "VS-Any-Version" - else: - subdir = "VS2017" - else: - subdir = "VS-Any-Version" - return os.path.join("w32", subdir) - - @property - def _msvc_platform(self): - return { - "x86": "Win32", - "x86_64": "x64", - }[str(self.settings.arch)] - - def _patch_sources(self): - apply_conandata_patches(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): - self._patch_sources() + 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 = self._msvc_platform + 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) @@ -170,25 +161,21 @@ def build(self): autotools.make() def package(self): - copy(self, "COPYING", os.path.join(self.source_folder), os.path.join(self.package_folder, "licenses")) + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) if is_msvc(self): - # 32-bit (x86) libraries are stored in the root - output_dir = os.path.join(self.build_folder, self._msvc_sln_folder, "Output") - if self.settings.arch in ("x86_64", ): - # 64-bit (x64) libraries are stored in a subfolder - output_dir = os.path.join(output_dir, self._msvc_platform) - copy(self, "*.lib", output_dir, os.path.join(self.package_folder, "lib")) - copy(self, "*.dll", output_dir, os.path.join(self.package_folder, "bin")) - copy(self, "*.h", output_dir, os.path.join(self.package_folder, "include")) + 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") + self.cpp_info.set_property("pkg_config_name", "libmicrohttpd") libname = "microhttpd" if is_msvc(self): libname = "libmicrohttpd" 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/patches/0.9.75-0001-msbuild-RuntimeLibrary.patch b/recipes/libmicrohttpd/all/patches/0.9.75-0001-msbuild-RuntimeLibrary.patch deleted file mode 100644 index b3dc82df26fa9..0000000000000 --- a/recipes/libmicrohttpd/all/patches/0.9.75-0001-msbuild-RuntimeLibrary.patch +++ /dev/null @@ -1,35 +0,0 @@ ---- w32/common/common-build-settings.vcxproj -+++ w32/common/common-build-settings.vcxproj -@@ -5,7 +5,7 @@ - Only 0 and 1 are used currently --> - 0 - 1 -- -+ - - $(SolutionDir);$(MhdW32Common);$(MhdSrc)include;$(IncludePath) - ---- w32/common/libmicrohttpd-build-settings.vcxproj -+++ w32/common/libmicrohttpd-build-settings.vcxproj -@@ -31,8 +31,8 @@ - - - _LIB;MHD_W32LIB;%(PreprocessorDefinitions) -- MultiThreadedDebug -- MultiThreaded -+ - - - Ws2_32.lib -@@ -45,8 +45,8 @@ - - - _USRDLL;MHD_W32DLL;%(PreprocessorDefinitions) -- MultiThreadedDebugDLL -- MultiThreadedDLL -+ - - - Ws2_32.lib;%(AdditionalDependencies) diff --git a/recipes/libmicrohttpd/all/patches/0.9.75-0002-allow-release-with-debug-runtime.patch b/recipes/libmicrohttpd/all/patches/0.9.75-0002-allow-release-with-debug-runtime.patch deleted file mode 100644 index c833862d3cee1..0000000000000 --- a/recipes/libmicrohttpd/all/patches/0.9.75-0002-allow-release-with-debug-runtime.patch +++ /dev/null @@ -1,12 +0,0 @@ -This patch allows building libmicrohttpd in Release configuration with a debug runtime (e.g. MTd) ---- 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/conanfile.py b/recipes/libmicrohttpd/all/test_package/conanfile.py index f72d1f660e19f..98ab55852ad56 100644 --- a/recipes/libmicrohttpd/all/test_package/conanfile.py +++ b/recipes/libmicrohttpd/all/test_package/conanfile.py @@ -1,12 +1,12 @@ from conan import ConanFile from conan.tools.build import can_run -from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "CMakeDeps", "VirtualRunEnv" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" test_type = "explicit" def layout(self): @@ -15,10 +15,6 @@ def 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() diff --git a/recipes/libmicrohttpd/all/test_v1_package/CMakeLists.txt b/recipes/libmicrohttpd/all/test_v1_package/CMakeLists.txt index 0b95e58322269..0d20897301b68 100644 --- a/recipes/libmicrohttpd/all/test_v1_package/CMakeLists.txt +++ b/recipes/libmicrohttpd/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(libmicrohttpd REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE libmicrohttpd::libmicrohttpd) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libmicrohttpd/config.yml b/recipes/libmicrohttpd/config.yml index 48e6a23d34df6..a945bee94f12c 100644 --- a/recipes/libmicrohttpd/config.yml +++ b/recipes/libmicrohttpd/config.yml @@ -1,3 +1,5 @@ versions: + "0.9.77": + folder: all "0.9.75": folder: all diff --git a/recipes/libmikmod/all/CMakeLists.txt b/recipes/libmikmod/all/CMakeLists.txt deleted file mode 100644 index 8bdaa1e47bfa0..0000000000000 --- a/recipes/libmikmod/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.5) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/libmikmod/all/conandata.yml b/recipes/libmikmod/all/conandata.yml index 8104d18a62f26..9580f44fe8c20 100644 --- a/recipes/libmikmod/all/conandata.yml +++ b/recipes/libmikmod/all/conandata.yml @@ -4,5 +4,6 @@ sources: sha256: "ad9d64dfc8f83684876419ea7cd4ff4a41d8bcd8c23ef37ecb3a200a16b46d19" patches: "3.3.11.1": - - base_path: "source_subfolder" - patch_file: "patches/0001-CMakeLists.txt.patch" + - patch_file: "patches/0001-fix-cmake.patch" + patch_description: "Fix cmake_minimum_required() position and dll installation, and build either static or shared" + patch_type: "conan" diff --git a/recipes/libmikmod/all/conanfile.py b/recipes/libmikmod/all/conanfile.py index 1d04522f0806a..b2f6c5dadec51 100644 --- a/recipes/libmikmod/all/conanfile.py +++ b/recipes/libmikmod/all/conanfile.py @@ -1,17 +1,20 @@ -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, collect_libs, copy, export_conandata_patches, get, replace_in_file, rmdir import os +required_conan_version = ">=1.53.0" + class LibmikmodConan(ConanFile): name = "libmikmod" description = "Module player and library supporting many formats, including mod, s3m, it, and xm." - topics = ("libmikmod", "audio") + topics = ("audio",) url = "https://github.com/conan-io/conan-center-index" homepage = "http://mikmod.sourceforge.net" license = "LGPL-2.1-or-later" - exports_sources = ["patches/*", "CMakeLists.txt"] - generators = "cmake" - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -21,7 +24,7 @@ class LibmikmodConan(ConanFile): "with_alsa": [True, False], "with_oss": [True, False], "with_pulse": [True, False], - "with_coreaudio": [True, False] + "with_coreaudio": [True, False], } default_options = { "shared": False, @@ -31,13 +34,11 @@ class LibmikmodConan(ConanFile): "with_alsa": True, "with_oss": True, "with_pulse": True, - "with_coreaudio": True + "with_coreaudio": True, } - _source_subfolder = "source_subfolder" - _build_subfolder = "build_subfolder" - - _cmake = None + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -52,76 +53,78 @@ def config_options(self): del self.options.with_oss del self.options.with_pulse # Apple - if tools.is_apple_os(self.settings.os): + if is_apple_os(self): del self.options.with_coreaudio 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.settings.os == "Linux": if self.options.with_alsa: - self.requires("libalsa/1.2.7.2") + self.requires("libalsa/1.2.10") if self.options.with_pulse: self.requires("pulseaudio/14.2") 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, set_cmake_flags=True) - self._cmake.definitions["ENABLE_STATIC"] = not self.options.shared - self._cmake.definitions["ENABLE_DOC"] = False - self._cmake.definitions["ENABLE_DSOUND"] = self.options.get_safe("with_dsound", False) - self._cmake.definitions["ENABLE_MMSOUND"] = self.options.get_safe("with_mmsound", False) - self._cmake.definitions["ENABLE_ALSA"] = self.options.get_safe("with_alsa", False) - self._cmake.definitions["ENABLE_OSS"] = self.options.get_safe("with_oss", False) - self._cmake.definitions["ENABLE_PULSE"] = self.options.get_safe("with_pulse", False) - self._cmake.definitions["ENABLE_COREAUDIO"] = self.options.get_safe("with_coreaudio", 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) - - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "CMAKE_SOURCE_DIR", - "PROJECT_SOURCE_DIR") + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["ENABLE_STATIC"] = not self.options.shared + tc.variables["ENABLE_DOC"] = False + tc.variables["ENABLE_DSOUND"] = self.options.get_safe("with_dsound", False) + tc.variables["ENABLE_MMSOUND"] = self.options.get_safe("with_mmsound", False) + tc.variables["ENABLE_ALSA"] = self.options.get_safe("with_alsa", False) + tc.variables["ENABLE_OSS"] = self.options.get_safe("with_oss", False) + tc.variables["ENABLE_PULSE"] = self.options.get_safe("with_pulse", False) + tc.variables["ENABLE_COREAUDIO"] = self.options.get_safe("with_coreaudio", False) + # Relocatable shared libs on macOS + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" + tc.generate() + + deps = CMakeDeps(self) + deps.generate() + + def _patch_sources(self): + apply_conandata_patches(self) # Ensure missing dependencies yields errors - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "MESSAGE(WARNING", "MESSAGE(FATAL_ERROR") - tools.replace_in_file(os.path.join(self._source_subfolder, "drivers", "drv_alsa.c"), + replace_in_file(self, os.path.join(self.source_folder, "drivers", "drv_alsa.c"), "alsa_pcm_close(pcm_h);", "if (pcm_h) alsa_pcm_close(pcm_h);") - cmake = self._configure_cmake() + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="COPYING.LESSER", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "COPYING.LESSER", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - os.remove(os.path.join(self.package_folder, "bin", "libmikmod-config")) - if not self.options.shared: - tools.rmdir(os.path.join(self.package_folder, "bin")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + if self.settings.os == "Windows" and self.options.shared: + os.remove(os.path.join(self.package_folder, "bin", "libmikmod-config")) + else: + rmdir(self, os.path.join(self.package_folder, "bin")) + 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", "libmikmod") + self.cpp_info.libs = collect_libs(self) if not self.options.shared: self.cpp_info.defines = ["MIKMOD_STATIC"] - self.cpp_info.filenames["pkg_config"] = "libmikmod" if self.options.get_safe("with_dsound"): self.cpp_info.system_libs.append("dsound") diff --git a/recipes/libmikmod/all/patches/0001-CMakeLists.txt.patch b/recipes/libmikmod/all/patches/0001-CMakeLists.txt.patch deleted file mode 100644 index a6c87e4f1e4da..0000000000000 --- a/recipes/libmikmod/all/patches/0001-CMakeLists.txt.patch +++ /dev/null @@ -1,56 +0,0 @@ -avoid building shared lib when shared=False, -and a fix to install .dlls correctly on Windows ---- "CMakeLists.txt" 2017-04-07 16:55:00.000000000 +0200 -+++ CMakeLists.txt 2017-07-21 20:01:33.330845600 +0200 -@@ -389,12 +391,6 @@ - - SET (LIBMIKMOD_LIBS) - --ADD_LIBRARY (mikmod -- SHARED -- ${MIKMOD_LIB_MODULES} -- ) -- --LIST (APPEND LIBMIKMOD_LIBS "mikmod") - IF (ENABLE_STATIC) - ADD_LIBRARY (mikmod-static - STATIC -@@ -410,16 +406,22 @@ - ${LIBMIKMOD_LIBS} - PROPERTIES CLEAN_DIRECT_OUTPUT 1 - ) --ENDIF (ENABLE_STATIC) -- --SET_TARGET_PROPERTIES(mikmod -- PROPERTIES VERSION 3.3.0 SOVERSION 3 --) --IF(WIN32) -+ELSE (ENABLE_STATIC) -+ ADD_LIBRARY (mikmod -+ SHARED -+ ${MIKMOD_LIB_MODULES} -+ ) -+ LIST (APPEND LIBMIKMOD_LIBS "mikmod") - SET_TARGET_PROPERTIES(mikmod -- PROPERTIES DEFINE_SYMBOL DLL_EXPORT -+ PROPERTIES VERSION 3.3.0 SOVERSION 3 - ) --ENDIF(WIN32) -+ IF(WIN32) -+ SET_TARGET_PROPERTIES(mikmod -+ PROPERTIES DEFINE_SYMBOL DLL_EXPORT -+ ) -+ ENDIF(WIN32) -+ENDIF (ENABLE_STATIC) -+ - - IF(DISABLE_HQMIXER) - SET(NO_HQMIXER 1) -@@ -854,6 +856,7 @@ - TARGETS ${LIBMIKMOD_LIBS} - LIBRARY DESTINATION "lib${LIB_SUFFIX}" - ARCHIVE DESTINATION "lib${LIB_SUFFIX}" -+ RUNTIME DESTINATION "bin${LIB_SUFFIX}" - ) - - INSTALL( diff --git a/recipes/libmikmod/all/patches/0001-fix-cmake.patch b/recipes/libmikmod/all/patches/0001-fix-cmake.patch new file mode 100644 index 0000000000000..8ccb9c4721dde --- /dev/null +++ b/recipes/libmikmod/all/patches/0001-fix-cmake.patch @@ -0,0 +1,63 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -23,8 +23,8 @@ + # + # (This copyright notice applies only to this file) + +-PROJECT(libmikmod C) + CMAKE_MINIMUM_REQUIRED(VERSION 2.8) ++PROJECT(libmikmod C) + LIST(APPEND CMAKE_MODULE_PATH "${libmikmod_SOURCE_DIR}/cmake") + + SET(LIBMIKMOD_MAJOR_VERSION 3) +@@ -389,12 +389,6 @@ REPLACE_FUNCTIONS_FROMDIR(MIKMOD_LIB_MODULES + + SET (LIBMIKMOD_LIBS) + +-ADD_LIBRARY (mikmod +- SHARED +- ${MIKMOD_LIB_MODULES} +- ) +- +-LIST (APPEND LIBMIKMOD_LIBS "mikmod") + IF (ENABLE_STATIC) + ADD_LIBRARY (mikmod-static + STATIC +@@ -410,16 +404,21 @@ IF (ENABLE_STATIC) + ${LIBMIKMOD_LIBS} + PROPERTIES CLEAN_DIRECT_OUTPUT 1 + ) +-ENDIF (ENABLE_STATIC) +- +-SET_TARGET_PROPERTIES(mikmod +- PROPERTIES VERSION 3.3.0 SOVERSION 3 +-) +-IF(WIN32) ++ELSE (ENABLE_STATIC) ++ ADD_LIBRARY (mikmod ++ SHARED ++ ${MIKMOD_LIB_MODULES} ++ ) ++ LIST (APPEND LIBMIKMOD_LIBS "mikmod") + SET_TARGET_PROPERTIES(mikmod +- PROPERTIES DEFINE_SYMBOL DLL_EXPORT ++ PROPERTIES VERSION 3.3.0 SOVERSION 3 + ) +-ENDIF(WIN32) ++ IF(WIN32) ++ SET_TARGET_PROPERTIES(mikmod ++ PROPERTIES DEFINE_SYMBOL DLL_EXPORT ++ ) ++ ENDIF(WIN32) ++ENDIF (ENABLE_STATIC) + + IF(DISABLE_HQMIXER) + SET(NO_HQMIXER 1) +@@ -854,6 +853,7 @@ INSTALL( + TARGETS ${LIBMIKMOD_LIBS} + LIBRARY DESTINATION "lib${LIB_SUFFIX}" + ARCHIVE DESTINATION "lib${LIB_SUFFIX}" ++ RUNTIME DESTINATION "bin${LIB_SUFFIX}" + ) + + INSTALL( diff --git a/recipes/libmikmod/all/test_package/CMakeLists.txt b/recipes/libmikmod/all/test_package/CMakeLists.txt index afa2476357074..9da3bc41b4793 100644 --- a/recipes/libmikmod/all/test_package/CMakeLists.txt +++ b/recipes/libmikmod/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(libmikmod REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE libmikmod::libmikmod) diff --git a/recipes/libmikmod/all/test_package/conanfile.py b/recipes/libmikmod/all/test_package/conanfile.py index bd7165a553cf4..98ab55852ad56 100644 --- a/recipes/libmikmod/all/test_package/conanfile.py +++ b/recipes/libmikmod/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/libmikmod/all/test_v1_package/CMakeLists.txt b/recipes/libmikmod/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libmikmod/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libmikmod/all/test_v1_package/conanfile.py b/recipes/libmikmod/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libmikmod/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/libmnl/all/conandata.yml b/recipes/libmnl/all/conandata.yml index bde6a08f3c7d1..11d5c387c466f 100644 --- a/recipes/libmnl/all/conandata.yml +++ b/recipes/libmnl/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.0.5": + url: "https://www.netfilter.org/projects/libmnl/files/libmnl-1.0.5.tar.bz2" + sha256: "274b9b919ef3152bfb3da3a13c950dd60d6e2bcd54230ffeca298d03b40d0525" "1.0.4": - sha256: 171f89699f286a5854b72b91d06e8f8e3683064c5901fb09d954a9ab6f551f81 - url: https://www.netfilter.org/projects/libmnl/files/libmnl-1.0.4.tar.bz2 + url: "https://www.netfilter.org/projects/libmnl/files/libmnl-1.0.4.tar.bz2" + sha256: "171f89699f286a5854b72b91d06e8f8e3683064c5901fb09d954a9ab6f551f81" diff --git a/recipes/libmnl/all/conanfile.py b/recipes/libmnl/all/conanfile.py index 14628c1889b0d..4542e12fe1d34 100644 --- a/recipes/libmnl/all/conanfile.py +++ b/recipes/libmnl/all/conanfile.py @@ -1,8 +1,12 @@ import os -from conans import ConanFile, tools, AutoToolsBuildEnvironment -from conans.errors import ConanInvalidConfiguration -required_conan_version = ">=1.29.1" +from conan import ConanFile +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.files import copy, get, rmdir, rm +from conan.tools.layout import basic_layout +from conan.errors import ConanInvalidConfiguration + +required_conan_version = ">=1.53.0" class LibmnlConan(ConanFile): name = "libmnl" @@ -14,50 +18,40 @@ class LibmnlConan(ConanFile): settings = "os", "compiler", "build_type", "arch" options = {"shared": [True, False], "fPIC": [True, False]} default_options = {"shared": False, "fPIC": True} - _autotools = None + package_type = "library" - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def configure(self): if self.settings.os != "Linux": raise ConanInvalidConfiguration("libmnl is only supported on Linux") if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd - - 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 + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def generate(self): + tc = AutotoolsToolchain(self) + 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(os.path.join(self.package_folder, "lib"), "*.la") - 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")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + 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")) def package_info(self): self.cpp_info.libs = ["mnl"] diff --git a/recipes/libmnl/all/test_package/CMakeLists.txt b/recipes/libmnl/all/test_package/CMakeLists.txt index d4fdee1a8a79c..941d5b3d99ff8 100644 --- a/recipes/libmnl/all/test_package/CMakeLists.txt +++ b/recipes/libmnl/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) project(PackageTest CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(libmnl REQUIRED) add_executable(example example.cpp) -target_link_libraries(example ${CONAN_LIBS}) +target_link_libraries(example libmnl::libmnl) diff --git a/recipes/libmnl/all/test_package/conanfile.py b/recipes/libmnl/all/test_package/conanfile.py index 58e0d68615142..39ac1b7b50008 100644 --- a/recipes/libmnl/all/test_package/conanfile.py +++ b/recipes/libmnl/all/test_package/conanfile.py @@ -1,11 +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 class LibmnlTestConan(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 +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], "example") + self.run(bin_path, env="conanrun") diff --git a/recipes/libmnl/config.yml b/recipes/libmnl/config.yml index 33bdc0114d503..4e7eb0116387e 100644 --- a/recipes/libmnl/config.yml +++ b/recipes/libmnl/config.yml @@ -1,3 +1,5 @@ versions: + 1.0.5: + folder: all 1.0.4: folder: all diff --git a/recipes/libmodbus/all/conandata.yml b/recipes/libmodbus/all/conandata.yml index 176711066e07f..ed5ad22d14ff2 100644 --- a/recipes/libmodbus/all/conandata.yml +++ b/recipes/libmodbus/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.1.10": + url: "https://github.com/stephane/libmodbus/releases/download/v3.1.10/libmodbus-3.1.10.tar.gz" + sha256: "899be4e25ab7fe5799d43f9567510d6f063d2e8f56136dd726b6fd976f9b2253" "3.1.8": url: "https://github.com/stephane/libmodbus/releases/download/v3.1.8/libmodbus-3.1.8.tar.gz" sha256: "b122f2bc29f749702a22c0a760a7ca2182d541f5fa26bf25e3431f907b606f3c" @@ -6,6 +9,8 @@ sources: url: "https://libmodbus.org/releases/libmodbus-3.1.6.tar.gz" sha256: "d7d9fa94a16edb094e5fdf5d87ae17a0dc3f3e3d687fead81835d9572cf87c16" patches: + "3.1.10": + - patch_file: "patches/3.1.10-0001-msvc-fixes.patch" "3.1.8": - patch_file: "patches/3.1.8-0001-msvc-fixes.patch" "3.1.6": diff --git a/recipes/libmodbus/all/conanfile.py b/recipes/libmodbus/all/conanfile.py index 6ec4cc6934e03..a83ac1acd367a 100644 --- a/recipes/libmodbus/all/conanfile.py +++ b/recipes/libmodbus/all/conanfile.py @@ -1,15 +1,14 @@ from conan import ConanFile from conan.tools.apple import fix_apple_shared_install_name -from conan.tools.env import Environment, VirtualBuildEnv +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, unix_path +from conan.tools.microsoft import check_min_vs, is_msvc, unix_path from conan.tools.scm import Version import os - -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.57.0" class LibmodbusConan(ConanFile): @@ -20,6 +19,7 @@ class LibmodbusConan(ConanFile): license = "LGPL-2.1" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -34,10 +34,6 @@ class LibmodbusConan(ConanFile): 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) @@ -47,18 +43,9 @@ def config_options(self): 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 + 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") @@ -67,13 +54,12 @@ def build_requirements(self): 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 + 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_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): env = VirtualBuildEnv(self) @@ -83,15 +69,12 @@ def generate(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"): + if is_msvc(self) and check_min_vs(self, "180", raise_invalid=False): tc.extra_cflags.append("-FS") - tc.generate() - + env = tc.environment() 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) + 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") @@ -100,7 +83,7 @@ def generate(self): env.define("OBJDUMP", ":") env.define("RANLIB", ":") env.define("STRIP", ":") - env.vars(self).save_script("conanbuild_libmodbus_msvc") + tc.generate(env) def _patch_sources(self): apply_conandata_patches(self) @@ -117,8 +100,7 @@ def build(self): def package(self): 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)}"]) + 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")) @@ -133,4 +115,4 @@ def package_info(self): 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 = ["ws2_32"] + self.cpp_info.system_libs = ["ws2_32", "wsock32"] diff --git a/recipes/libmodbus/all/patches/3.1.10-0001-msvc-fixes.patch b/recipes/libmodbus/all/patches/3.1.10-0001-msvc-fixes.patch new file mode 100644 index 0000000000000..876ce8dc08eca --- /dev/null +++ b/recipes/libmodbus/all/patches/3.1.10-0001-msvc-fixes.patch @@ -0,0 +1,20 @@ +--- 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 +@@ -14,5 +14,5 @@ + #else + # include "stdint.h" + # include +-typedef int ssize_t; ++//typedef int ssize_t; + #endif diff --git a/recipes/libmodbus/all/test_v1_package/CMakeLists.txt b/recipes/libmodbus/all/test_v1_package/CMakeLists.txt index d03cbd8daf516..0d20897301b68 100644 --- a/recipes/libmodbus/all/test_v1_package/CMakeLists.txt +++ b/recipes/libmodbus/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package) 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) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libmodbus/config.yml b/recipes/libmodbus/config.yml index 49c098a9b7d41..98dbf2345aa1e 100644 --- a/recipes/libmodbus/config.yml +++ b/recipes/libmodbus/config.yml @@ -1,4 +1,6 @@ versions: + "3.1.10": + folder: all "3.1.8": folder: all "3.1.6": diff --git a/recipes/libmodplug/all/CMakeLists.txt b/recipes/libmodplug/all/CMakeLists.txt deleted file mode 100644 index e9bf7db516381..0000000000000 --- a/recipes/libmodplug/all/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_definitions("-DHAVE_STDINT_H") -add_definitions("-DHAVE_SINF") - -add_subdirectory("source_subfolder") diff --git a/recipes/libmodplug/all/conandata.yml b/recipes/libmodplug/all/conandata.yml index 1e46cfd6924a1..73d80ebfe882c 100644 --- a/recipes/libmodplug/all/conandata.yml +++ b/recipes/libmodplug/all/conandata.yml @@ -5,4 +5,6 @@ sources: patches: "0.8.9.0": - patch_file: "patches/0001-cmake-install-dll.patch" - base_path: "source_subfolder" + - patch_file: "patches/0002-cpp17-compat.patch" + patch_description: "C++17 support" + patch_type: portability diff --git a/recipes/libmodplug/all/conanfile.py b/recipes/libmodplug/all/conanfile.py index 572c3a203d05d..93a23cc96d6aa 100644 --- a/recipes/libmodplug/all/conanfile.py +++ b/recipes/libmodplug/all/conanfile.py @@ -1,33 +1,32 @@ -from conans import ConanFile, CMake, tools +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, rmdir import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.54.0" class LibmodplugConan(ConanFile): name = "libmodplug" description = "libmodplug - the library which was part of the Modplug-xmms project" - topics = ("conan", "libmodplug", "auduo", "multimedia", "sound", "music", "mod", "mod music", - "tracket music") + topics = ("auduo", "multimedia", "sound", "music", "mod", "mod music", "tracket music") url = "https://github.com/conan-io/conan-center-index" homepage = "http://modplug-xmms.sourceforge.net" - license = "Unlicense" # public domain - + license = "Unlicense" + package_type = "library" settings = "os", "arch", "compiler", "build_type" - options = {"shared": [True, False], "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" + 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": @@ -35,39 +34,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 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(build_folder=self._build_subfolder) - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.preprocessor_definitions["HAVE_STDINT_H"] = 1 + tc.preprocessor_definitions["HAVE_SINF"] = 1 + # 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(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() - 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"] = "libmodplug" + self.cpp_info.set_property("pkg_config_name", "libmodplug") self.cpp_info.libs = ["modplug"] self.cpp_info.includedirs.append(os.path.join("include", "libmodplug")) - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.extend(["m"]) if not self.options.shared: self.cpp_info.defines.append("MODPLUG_STATIC") - stdcpp_library = tools.stdcpp_library(self) - if stdcpp_library: - self.cpp_info.system_libs.extend([stdcpp_library]) + libcxx = stdcpp_library(self) + if libcxx: + self.cpp_info.system_libs.append(libcxx) diff --git a/recipes/libmodplug/all/patches/0002-cpp17-compat.patch b/recipes/libmodplug/all/patches/0002-cpp17-compat.patch new file mode 100644 index 0000000000000..599cdcc293536 --- /dev/null +++ b/recipes/libmodplug/all/patches/0002-cpp17-compat.patch @@ -0,0 +1,20 @@ +--- a/src/fastmix.cpp ++++ b/src/fastmix.cpp +@@ -288,7 +288,7 @@ CzWINDOWEDFIR sfir; + // MIXING MACROS + // ---------------------------------------------------------------------------- + #define SNDMIX_BEGINSAMPLELOOP8\ +- register MODCHANNEL * const pChn = pChannel;\ ++ MODCHANNEL * const pChn = pChannel;\ + nPos = pChn->nPosLo;\ + const signed char *p = (signed char *)(pChn->pCurrentSample+pChn->nPos);\ + if (pChn->dwFlags & CHN_STEREO) p += pChn->nPos;\ +@@ -296,7 +296,7 @@ CzWINDOWEDFIR sfir; + do { + + #define SNDMIX_BEGINSAMPLELOOP16\ +- register MODCHANNEL * const pChn = pChannel;\ ++ MODCHANNEL * const pChn = pChannel;\ + nPos = pChn->nPosLo;\ + const signed short *p = (signed short *)(pChn->pCurrentSample+(pChn->nPos*2));\ + if (pChn->dwFlags & CHN_STEREO) p += pChn->nPos;\ diff --git a/recipes/libmodplug/all/test_package/CMakeLists.txt b/recipes/libmodplug/all/test_package/CMakeLists.txt index f8b971e2db377..2701aecd76f11 100644 --- a/recipes/libmodplug/all/test_package/CMakeLists.txt +++ b/recipes/libmodplug/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(libmodplug REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE libmodplug::libmodplug) diff --git a/recipes/libmodplug/all/test_package/conanfile.py b/recipes/libmodplug/all/test_package/conanfile.py index bd7165a553cf4..0a6bc68712d90 100644 --- a/recipes/libmodplug/all/test_package/conanfile.py +++ b/recipes/libmodplug/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/libmodplug/all/test_v1_package/CMakeLists.txt b/recipes/libmodplug/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libmodplug/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libmodplug/all/test_v1_package/conanfile.py b/recipes/libmodplug/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libmodplug/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/libmorton/all/conandata.yml b/recipes/libmorton/all/conandata.yml index b2711e5d1b695..db08154a617a3 100644 --- a/recipes/libmorton/all/conandata.yml +++ b/recipes/libmorton/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "0.2.12": + url: "https://github.com/Forceflow/libmorton/archive/v0.2.12.tar.gz" + sha256: "48ec3e4ad1d9348052dcb64bff012ff95db226da3fec5522ae6e674fabbd686f" + "0.2.11": + url: "https://github.com/Forceflow/libmorton/archive/refs/tags/v0.2.11.tar.gz" + sha256: "3650ce8eb3deee28bc580e5bb1594fe07f7a33aa2531490bf09b5ab8207d55f6" "0.2.10": url: "https://github.com/Forceflow/libmorton/archive/refs/tags/v0.2.10.tar.gz" sha256: "5f4a8dbf350222b0bec35ad1bee6b76fa22e16ea364e1e80ca47d8f5a7210d6f" diff --git a/recipes/libmorton/all/conanfile.py b/recipes/libmorton/all/conanfile.py index 2d5d75fd6eb1b..3c93b1613e056 100644 --- a/recipes/libmorton/all/conanfile.py +++ b/recipes/libmorton/all/conanfile.py @@ -1,10 +1,10 @@ from conan import ConanFile -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 LibmortonConan(ConanFile): @@ -12,25 +12,23 @@ class LibmortonConan(ConanFile): description = "C++ header-only library with methods to efficiently " \ "encode/decode 64, 32 and 16-bit Morton codes and coordinates, in 2D and 3D." license = "MIT" - topics = ("libmorton", "morton", "encoding", "decoding") + topics = ("morton", "encoding", "decoding") homepage = "https://github.com/Forceflow/libmorton" url = "https://github.com/conan-io/conan-center-index" - + package_type = "header-library" 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 package_id(self): - self.info.clear() + export_conandata_patches(self) 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): apply_conandata_patches(self) @@ -50,8 +48,6 @@ def package_info(self): self.cpp_info.set_property("cmake_target_name", "libmorton::libmorton") self.cpp_info.set_property("pkg_config_name", "libmorton") 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 = ["m"] diff --git a/recipes/libmorton/all/test_package/conanfile.py b/recipes/libmorton/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/libmorton/all/test_package/conanfile.py +++ b/recipes/libmorton/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/libmorton/all/test_v1_package/CMakeLists.txt b/recipes/libmorton/all/test_v1_package/CMakeLists.txt index eae8e7086d06f..0d20897301b68 100644 --- a/recipes/libmorton/all/test_v1_package/CMakeLists.txt +++ b/recipes/libmorton/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(libmorton REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE libmorton::libmorton) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libmorton/config.yml b/recipes/libmorton/config.yml index a6dfd9ecb4855..056827a88e63b 100644 --- a/recipes/libmorton/config.yml +++ b/recipes/libmorton/config.yml @@ -1,4 +1,8 @@ versions: + "0.2.12": + folder: all + "0.2.11": + folder: all "0.2.10": folder: all "0.2.9": diff --git a/recipes/libmount/all/conandata.yml b/recipes/libmount/all/conandata.yml index 5bf946443eb38..876a74600fc50 100644 --- a/recipes/libmount/all/conandata.yml +++ b/recipes/libmount/all/conandata.yml @@ -1,10 +1,16 @@ sources: + "2.40.2": + url: "https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/v2.40/util-linux-2.40.2.tar.xz" + sha256: "d78b37a66f5922d70edf3bdfb01a6b33d34ed3c3cafd6628203b2a2b67c8e8b3" + "2.39.2": + url: "https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/v2.39/util-linux-2.39.2.tar.xz" + sha256: "87abdfaa8e490f8be6dde976f7c80b9b5ff9f301e1b67e3899e1f05a59a1531f" + "2.39": + url: "https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/v2.39/util-linux-2.39.tar.xz" + sha256: "32b30a336cda903182ed61feb3e9b908b762a5e66fe14e43efb88d37162075cb" "2.36.2": url: "https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/v2.36/util-linux-2.36.2.tar.xz" sha256: "f7516ba9d8689343594356f0e5e1a5f0da34adfbc89023437735872bb5024c5f" "2.36": url: "https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/v2.36/util-linux-2.36.tar.xz" sha256: "9e4b1c67eb13b9b67feb32ae1dc0d50e08ce9e5d82e1cccd0ee771ad2fa9e0b1" - "2.33.1": - url: "https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/v2.33/util-linux-2.33.1.tar.xz" - sha256: "c14bd9f3b6e1792b90db87696e87ec643f9d63efa0a424f092a5a6b2f2dbef21" diff --git a/recipes/libmount/all/conanfile.py b/recipes/libmount/all/conanfile.py index 301b7a46d28de..ea963a9965bfc 100644 --- a/recipes/libmount/all/conanfile.py +++ b/recipes/libmount/all/conanfile.py @@ -17,8 +17,9 @@ class LibmountConan(ConanFile): 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" + license = "LGPL-2.1-or-later" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -39,12 +40,11 @@ def layout(self): basic_layout(self, src_folder="src") def validate(self): - if self.info.settings.os != "Linux": + if self.settings.os != "Linux": raise ConanInvalidConfiguration(f"{self.ref} only supports Linux") 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 = AutotoolsToolchain(self) @@ -61,7 +61,8 @@ def build(self): autotools.make() def package(self): - copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "COPYING", src=os.path.join(self.source_folder, "libmount"), dst=os.path.join(self.package_folder, "licenses")) + copy(self, "COPYING.LGPL-2.1-or-later", src=os.path.join(self.source_folder, "Documentation", "licenses"), dst=os.path.join(self.package_folder, "licenses")) autotools = Autotools(self) autotools.install() rmdir(self, os.path.join(self.package_folder, "sbin")) @@ -71,7 +72,11 @@ def package(self): 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") + self.cpp_info.components["libblkid"].libs = ["blkid"] + self.cpp_info.components["libblkid"].set_property("pkg_config_name", "blkid") + + self.cpp_info.components["libmount"].libs = ["mount"] + self.cpp_info.components["libmount"].system_libs = ["rt"] + self.cpp_info.components["libmount"].includedirs.append(os.path.join("include", "libmount")) + self.cpp_info.components["libmount"].set_property("pkg_config_name", "mount") + self.cpp_info.components["libmount"].requires = ["libblkid"] diff --git a/recipes/libmount/config.yml b/recipes/libmount/config.yml index c0f9ff233a2c0..d10bf81ca7041 100644 --- a/recipes/libmount/config.yml +++ b/recipes/libmount/config.yml @@ -1,7 +1,11 @@ versions: + "2.40.2": + folder: all + "2.39.2": + folder: all + "2.39": + folder: all "2.36.2": folder: all "2.36": folder: all - "2.33.1": - folder: all diff --git a/recipes/libmp3lame/all/conanfile.py b/recipes/libmp3lame/all/conanfile.py index a7f412633c3e7..d8a366c7eb019 100644 --- a/recipes/libmp3lame/all/conanfile.py +++ b/recipes/libmp3lame/all/conanfile.py @@ -1,13 +1,14 @@ from conan import ConanFile -from conan.tools.env import Environment, VirtualBuildEnv +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, unix_path, VCVars +from conan.tools.microsoft import is_msvc, NMakeToolchain import os import shutil -required_conan_version = ">=1.53.0" +required_conan_version = ">=1.55.0" class LibMP3LameConan(ConanFile): @@ -61,33 +62,20 @@ def build_requirements(self): self.tool_requires("msys2/cci.latest") def source(self): - get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - - def _generate_vs(self): - tc = VCVars(self) - tc.generate() - # FIXME: 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 = Environment() - env.define("CL", c_flags) - env.vars(self).save_script("conanbuildenv_nmake") - - def _generate_autotools(self): - 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() + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): if is_msvc(self) or self._is_clang_cl: - self._generate_vs() + tc = NMakeToolchain(self) + tc.generate() else: - self._generate_autotools() + 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 chdir(self, self.source_folder): @@ -100,8 +88,10 @@ def _build_vs(self): 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") + 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 @@ -151,10 +141,10 @@ def package(self): os.path.join(self.package_folder, "lib", "mp3lame.lib")) else: 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)}"]) + 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 = ["mp3lame"] diff --git a/recipes/libmp3lame/all/test_package/conanfile.py b/recipes/libmp3lame/all/test_package/conanfile.py index 48499fa0989d9..e845ae751a301 100644 --- a/recipes/libmp3lame/all/test_package/conanfile.py +++ b/recipes/libmp3lame/all/test_package/conanfile.py @@ -4,7 +4,6 @@ import os -# It will become the standard on Conan 2.x class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" diff --git a/recipes/libmpdclient/all/conandata.yml b/recipes/libmpdclient/all/conandata.yml new file mode 100644 index 0000000000000..45f3be3daf711 --- /dev/null +++ b/recipes/libmpdclient/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "2.22": + url: "https://www.musicpd.org/download/libmpdclient/2/libmpdclient-2.22.tar.xz" + sha256: "eac15b82b5ba5ed0648af580221eb74657394f7fe768e966d9e9ebb27435429f" + "2.20": + url: "https://www.musicpd.org/download/libmpdclient/2/libmpdclient-2.20.tar.xz" + sha256: "18793f68e939c3301e34d8fcadea1f7daa24143941263cecadb80126194e277d" diff --git a/recipes/libmpdclient/all/conanfile.py b/recipes/libmpdclient/all/conanfile.py new file mode 100644 index 0000000000000..7df400a892ea8 --- /dev/null +++ b/recipes/libmpdclient/all/conanfile.py @@ -0,0 +1,115 @@ +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, rmdir +from conan.tools.layout import basic_layout +from conan.tools.meson import Meson, MesonToolchain +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version +import os + +required_conan_version = ">=1.53.0" + + +class LibmpdclientConan(ConanFile): + name = "libmpdclient" + description = "libmpdclient is a C library which implements the Music Player Daemon protocol." + license = "BSD-2-Clause", "BSD-3-Clause" + topics = ("music", "music-player-demon", "sound") + homepage = "https://www.musicpd.org/libs/libmpdclient" + 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_socket": ["ANY"], + "default_host": ["ANY"], + "default_port": ["ANY"], + "tcp": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "default_socket": "/var/run/mpd/socket", + "default_host": "localhost", + "default_port": "6600", + "tcp": True, + } + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + del self.options.default_socket + + 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 validate(self): + if is_msvc(self) and self.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} doesn't support build of shared lib with msvc") + + def build_requirements(self): + self.tool_requires("meson/1.2.1") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + tc = MesonToolchain(self) + if self.settings.os != "Windows": + tc.project_options["default_socket"] = str(self.options.default_socket) + tc.project_options["default_host"] = str(self.options.default_host) + tc.project_options["default_port"] = str(self.options.default_port) + tc.project_options["tcp"] = self.options.tcp + tc.project_options["documentation"] = False + tc.project_options["test"] = False + tc.generate() + + def build(self): + meson = Meson(self) + meson.configure() + meson.build() + + def package(self): + if Version(self.version) >= "2.22": + copy(self, "*", os.path.join(self.source_folder, "LICENSES"), os.path.join(self.package_folder, "licenses")) + else: + copy(self, "COPYING", 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")) + 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("pkg_config_name", "libmpdclient") + self.cpp_info.libs = ["mpdclient"] + if self.settings.os == "Windows": + self.cpp_info.system_libs.append("ws2_32") + +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/libmpdclient/all/test_package/CMakeLists.txt b/recipes/libmpdclient/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..f00d9cb1c388c --- /dev/null +++ b/recipes/libmpdclient/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +find_package(libmpdclient CONFIG REQUIRED) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE libmpdclient::libmpdclient) diff --git a/recipes/libmpdclient/all/test_package/conanfile.py b/recipes/libmpdclient/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0a6bc68712d90 --- /dev/null +++ b/recipes/libmpdclient/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/libmpdclient/all/test_package/test_package.c b/recipes/libmpdclient/all/test_package/test_package.c new file mode 100644 index 0000000000000..bb53ebecfee6d --- /dev/null +++ b/recipes/libmpdclient/all/test_package/test_package.c @@ -0,0 +1,25 @@ +#include +#include + +#include +#include + +int main() +{ + struct mpd_connection *conn = mpd_connection_new(NULL, 0, 0); + + if (conn == NULL) { + fprintf(stderr, "Out of memory\n"); + return 1; + } + if (mpd_connection_get_error(conn) != MPD_ERROR_SUCCESS) { + fprintf(stderr, "%s\n", mpd_connection_get_error_message(conn)); + mpd_connection_free(conn); + return 0; + } + + mpd_run_next(conn); + mpd_connection_free(conn); + + return 0; +} diff --git a/recipes/libmpdclient/all/test_v1_package/CMakeLists.txt b/recipes/libmpdclient/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libmpdclient/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libmpdclient/all/test_v1_package/conanfile.py b/recipes/libmpdclient/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libmpdclient/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/libmpdclient/config.yml b/recipes/libmpdclient/config.yml new file mode 100644 index 0000000000000..76913be25172d --- /dev/null +++ b/recipes/libmpdclient/config.yml @@ -0,0 +1,5 @@ +versions: + "2.22": + folder: "all" + "2.20": + folder: "all" 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 3284d28321c06..78b5ed97e3e15 100644 --- a/recipes/libmysqlclient/all/conandata.yml +++ b/recipes/libmysqlclient/all/conandata.yml @@ -1,36 +1,40 @@ sources: + "8.1.0": + url: "https://dev.mysql.com/get/Downloads/MySQL-8.1/mysql-8.1.0.tar.gz" + sha256: "3dd017a940734aa90796a4c65e125e6712f64bbbbe3388d36469deaa87b599eb" + "8.0.34": + url: "https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.34.tar.gz" + sha256: "e65d03a3c42618b5fbf99042aed33209402e9b27aa62c7c8743ffd4788d8db1d" + "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" - - "https://mirrors.huaweicloud.com/mysql/Downloads/MySQL-8.0/mysql-8.0.30.tar.gz" + 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" - - "https://mirrors.huaweicloud.com/mysql/Downloads/MySQL-8.0/mysql-8.0.29.tar.gz" - sha256: "512170fa6f78a694d6f18d197e999d2716ee68dc541d7644dd922a3663407266" "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.30": + "8.1.0": + - patch_file: "patches/0006-fix-cpp20-build-8.1.0.patch" + patch_description: "Fix C++20 compilation" + patch_type: "portability" + "8.0.34": + - patch_file: "patches/0006-fix-cpp20-build-8.0.29.patch" + patch_description: "Fix C++20 compilation" + patch_type: "portability" + "8.0.31": - patch_file: "patches/0006-fix-cpp20-build-8.0.29.patch" - base_path: "source_subfolder" - "8.0.29": + patch_description: "Fix C++20 compilation" + patch_type: "portability" + "8.0.30": - 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 5e8d487675d90..deb913588e58e 100644 --- a/recipes/libmysqlclient/all/conanfile.py +++ b/recipes/libmysqlclient/all/conanfile.py @@ -1,15 +1,16 @@ -from conan.tools.microsoft import is_msvc, msvc_runtime_flag -from conan.tools.files import rename, get, apply_conandata_patches, replace_in_file, rmdir, rm -from conan.tools.build import cross_building from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.scm import Version from conan.tools.apple import is_apple_os -from conans import CMake, tools -import functools +from conan.tools.build import check_min_cppstd, 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, 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.51.3" +required_conan_version = ">=1.55.0" class LibMysqlClientCConan(ConanFile): @@ -24,43 +25,30 @@ class LibMysqlClientCConan(ConanFile): options = { "shared": [True, False], "fPIC": [True, False], - "with_ssl": [True, False, "deprecated"], - "with_zlib": [True, False, "deprecated"], } default_options = { "shared": False, "fPIC": True, - "with_ssl": "deprecated", - "with_zlib": "deprecated", } + package_type = "library" short_paths = True - generators = "cmake", "pkg_config" - - @property - def _source_subfolder(self): - return "source_subfolder" @property - def _with_zstd(self): - return Version(self.version) > "8.0.17" - - @property - def _with_lz4(self): - return Version(self.version) > "8.0.17" + def _min_cppstd(self): + return "17" if Version(self.version) >= "8.0.27" else "11" @property def _compilers_minimum_version(self): return { - "Visual Studio": "16" if Version(self.version) > "8.0.17" else "15", + "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": @@ -68,25 +56,28 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - if self.options.with_ssl != "deprecated": - self.output.warn("with_ssl option is deprecated, do not use anymore. SSL cannot be disabled") - if self.options.with_zlib != "deprecated": - self.output.warn("with_zlib option is deprecated, do not use anymore. Zlib cannot be disabled") + self.options.rm_safe("fPIC") - def package_id(self): - del self.info.options.with_ssl - del self.info.options.with_zlib + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("openssl/1.1.1s") - self.requires("zlib/1.2.13") - if self._with_zstd: - self.requires("zstd/1.5.2") - if self._with_lz4: - self.requires("lz4/1.9.4") + if Version(self.version) < "8.0.30": + self.requires("openssl/1.1.1w") + else: + self.requires("openssl/[>=1.1 <4]") + self.requires("zlib/[>=1.2.11 <2]") + self.requires("zstd/1.5.5") + self.requires("lz4/1.9.4") if self.settings.os == "FreeBSD": - self.requires("libunwind/1.6.2") + self.requires("libunwind/1.7.2") + + def validate_build(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + + 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 welcomed.") def validate(self): def loose_lt_semver(v1, v2): @@ -97,187 +88,198 @@ 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 {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 \ - Version(self.settings.compiler.version) >= "12.0": - raise ConanInvalidConfiguration("libmysqlclient 8.0.17 doesn't support apple-clang >= 12.0") - - # mysql>=8.0.17 doesn't support shared library on MacOS. - # https://github.com/mysql/mysql-server/blob/mysql-8.0.17/cmake/libutils.cmake#L333-L335 - if Version(self.version) >= "8.0.17" and self.settings.compiler == "apple-clang" and \ - self.options.shared: - raise ConanInvalidConfiguration(f"{self.name}/{self.version} doesn't support shared library") + raise ConanInvalidConfiguration(f"{self.ref} requires {self.settings.compiler} {minimum_version} or newer") # 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 Version(self.version) < "8.0.29": - raise ConanInvalidConfiguration(f"{self.name}/{self.version} doesn't support C++20") + raise ConanInvalidConfiguration(f"{self.ref} doesn't support C++20") def build_requirements(self): - if Version(self.version) >= "8.0.25" and is_apple_os(self): - # CMake 3.18 or higher is required if Apple, but CI of CCI may run CMake 3.15 - self.build_requires("cmake/3.24.2") - if self.settings.os == "FreeBSD": - self.build_requires("pkgconf/1.9.3") + if is_apple_os(self): + self.tool_requires("cmake/[>=3.18 <4]") + if self.settings.os == "FreeBSD" and not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/2.0.3") 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) - def _patch_files(self): + 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: - replace_in_file(self, os.path.join(self._source_subfolder, "CMakeLists.txt"), - f"MYSQL_CHECK_{lib.upper()}()\n", - "", - strict=False) - replace_in_file(self, os.path.join(self._source_subfolder, "CMakeLists.txt"), - f"INCLUDE({lib})\n", - "", - strict=False) - replace_in_file(self, os.path.join(self._source_subfolder, "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_subfolder, "CMakeLists.txt"), - f"SET({lib.upper()}_WARN_GIVEN)", - f"# SET({lib.upper()}_WARN_GIVEN)", - strict=False) - - rmdir(self, 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) + + if lib != "libevent" or Version(self.version) < "8.0.34": + 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) + for folder in ["client", "man", "mysql-test", "libbinlogstandalone"]: - rmdir(self, os.path.join(self._source_subfolder, folder)) - replace_in_file(self, os.path.join(self._source_subfolder, "CMakeLists.txt"), - f"ADD_SUBDIRECTORY({folder})\n", - "", - strict=False) - rmdir(self, os.path.join(self._source_subfolder, "storage", "ndb")) + 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"]: - replace_in_file(self, os.path.join(self._source_subfolder, "CMakeLists.txt"), - t, - "", - strict=False) - if self._with_zstd: - replace_in_file(self, os.path.join(self._source_subfolder, "cmake", "zstd.cmake"), - "NAMES zstd", - "NAMES zstd %s" % self.deps_cpp_info["zstd"].libs[0]) - - replace_in_file(self, os.path.join(self._source_subfolder, "cmake", "ssl.cmake"), - "NAMES ssl", - "NAMES ssl %s" % self.deps_cpp_info["openssl"].components["ssl"].libs[0]) - - replace_in_file(self, 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_subfolder, "cmake", "ssl.cmake"), - "IF(NOT OPENSSL_APPLINK_C)\n", - "IF(FALSE AND NOT OPENSSL_APPLINK_C)\n", - strict=False) + 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 + if Version(self.version) < "8.0.34": + 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.aggregated_components().libs[0]}") + + # Fix discovery & link to OpenSSL + ssl_cmake = os.path.join(self.source_folder, "cmake", "ssl.cmake") + replace_in_file(self, ssl_cmake, + "NAMES ssl", + f"NAMES ssl {self.dependencies['openssl'].cpp_info.components['ssl'].libs[0]}") + + replace_in_file(self, ssl_cmake, + "NAMES crypto", + f"NAMES crypto {self.dependencies['openssl'].cpp_info.components['crypto'].libs[0]}") + + replace_in_file(self, ssl_cmake, + "IF(NOT OPENSSL_APPLINK_C)\n", + "IF(FALSE AND NOT OPENSSL_APPLINK_C)\n", + strict=False) + + replace_in_file(self, ssl_cmake, + "SET(SSL_LIBRARIES ${MY_OPENSSL_LIBRARY} ${MY_CRYPTO_LIBRARY})", + "find_package(OpenSSL REQUIRED MODULE)\nset(SSL_LIBRARIES OpenSSL::SSL OpenSSL::Crypto)") + + # And do not merge OpenSSL libs into mysqlclient lib + replace_in_file(self, os.path.join(self.source_folder, "cmake", "libutils.cmake"), + 'IF(WIN32 AND ${TARGET} STREQUAL "mysqlclient")', + "if(0)") # Do not copy shared libs of dependencies to package folder - deps_shared = ["SSL"] - if Version(self.version) > "8.0.17": - deps_shared.extend(["KERBEROS", "SASL", "LDAP", "PROTOBUF", "CURL"]) + deps_shared = ["SSL", "KERBEROS", "SASL", "LDAP", "PROTOBUF"] + if Version(self.version) < "8.0.34": + deps_shared.append("CURL") for dep in deps_shared: - replace_in_file(self, os.path.join(self._source_subfolder, "CMakeLists.txt"), - f"MYSQL_CHECK_{dep}_DLLS()", - "") - - 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": - replace_in_file(self, os.path.join(self._source_subfolder, "libmysql", "CMakeLists.txt"), - "COMMAND %s" % ("$" if 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"))) - replace_in_file(self, 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 + # Disable additional Linux distro-specific compiler checks. + # The recipe already checks for minimum versions of supported + # compilers. + tc.cache_variables["FORCE_UNSUPPORTED_COMPILER"] = True + + 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) + + tc.cache_variables["WITH_SSL"] = self.dependencies["openssl"].package_folder.replace("\\", "/") + + tc.cache_variables["WITH_ZLIB"] = "system" - cmake.definitions["WITH_SSL"] = self.deps_cpp_info["openssl"].rootpath + # Remove to ensure reproducible build, this only affects docs generation + tc.cache_variables["CMAKE_DISABLE_FIND_PACKAGE_Doxygen"] = True + tc.generate() - cmake.definitions["WITH_ZLIB"] = "system" - cmake.configure(source_dir=self._source_subfolder) - return cmake + 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")) + 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, "lib", "plugin")) 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) - if self.options.shared: - rm(self, "*.a", self.package_folder, recursive=True) + if self.settings.os == "Windows": + if self.options.shared: + rename(self, os.path.join(self.package_folder, "lib", "libmysql.dll"), + os.path.join(self.package_folder, "bin", "libmysql.dll")) + rm(self, "*mysqlclient.*", os.path.join(self.package_folder, "lib")) + else: + rm(self, "*.dll", os.path.join(self.package_folder, "lib")) + rm(self, "*libmysql.*", os.path.join(self.package_folder, "lib")) else: - rm(self, "*.dll", self.package_folder, recursive=True) - rm(self, "*.dylib", self.package_folder, recursive=True) - rm(self, "*.so*", self.package_folder, recursive=True) + if self.options.shared: + rm(self, "*.a", os.path.join(self.package_folder, "lib")) + else: + rm(self, "*.dylib", os.path.join(self.package_folder, "lib")) + rm(self, "*.so*", os.path.join(self.package_folder, "lib")) 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"] + self.cpp_info.includedirs.append(os.path.join("include", "mysql")) 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 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 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/patches/0001-find-cmake.patch b/recipes/libmysqlclient/all/patches/0001-find-cmake.patch deleted file mode 100644 index 6330159ebb12b..0000000000000 --- a/recipes/libmysqlclient/all/patches/0001-find-cmake.patch +++ /dev/null @@ -1,33 +0,0 @@ -diff --git a/cmake/zlib.cmake b/cmake/zlib.cmake ---- a/cmake/zlib.cmake -+++ b/cmake/zlib.cmake -@@ -51,28 +51,6 @@ MACRO (MYSQL_CHECK_ZLIB_WITH_COMPRESS) - IF(WITH_ZLIB STREQUAL "bundled") - MYSQL_USE_BUNDLED_ZLIB() - ELSE() -- SET(ZLIB_FIND_QUIETLY TRUE) -- INCLUDE(FindZLIB) -- IF(ZLIB_FOUND) -- INCLUDE(CheckFunctionExists) -- SET(SAVE_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}) -- SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} z) -- CHECK_FUNCTION_EXISTS(crc32 HAVE_CRC32) -- CHECK_FUNCTION_EXISTS(compressBound HAVE_COMPRESSBOUND) -- CHECK_FUNCTION_EXISTS(deflateBound HAVE_DEFLATEBOUND) -- SET(CMAKE_REQUIRED_LIBRARIES ${SAVE_CMAKE_REQUIRED_LIBRARIES}) -- IF(HAVE_CRC32 AND HAVE_COMPRESSBOUND AND HAVE_DEFLATEBOUND) -- SET(ZLIB_LIBRARY ${ZLIB_LIBRARIES} CACHE INTERNAL "System zlib library") -- SET(WITH_ZLIB "system" CACHE STRING -- "Which zlib to use (possible values are 'bundled' or 'system')") -- SET(ZLIB_SOURCES "") -- ELSE() -- SET(ZLIB_FOUND FALSE CACHE INTERNAL "Zlib found but not usable") -- MESSAGE(STATUS "system zlib found but not usable") -- ENDIF() -- ENDIF() -- IF(NOT ZLIB_FOUND) -- MYSQL_USE_BUNDLED_ZLIB() -- ENDIF() -+ SET(ZLIB_LIBRARY "${CONAN_LIBS_ZLIB}" CACHE INTERNAL "System zlib library") - ENDIF() - ENDMACRO() diff --git a/recipes/libmysqlclient/all/patches/0002-dont-install-static-libraries+fix-mysql-config.patch b/recipes/libmysqlclient/all/patches/0002-dont-install-static-libraries+fix-mysql-config.patch deleted file mode 100644 index 76cbe2744f14a..0000000000000 --- a/recipes/libmysqlclient/all/patches/0002-dont-install-static-libraries+fix-mysql-config.patch +++ /dev/null @@ -1,30 +0,0 @@ ---- libmysql/CMakeLists.txt -+++ libmysql/CMakeLists.txt -@@ -245,7 +245,12 @@ - ADD_SUBDIRECTORY(authentication_ldap) - - # Merge several convenience libraries into one big mysqlclient --MERGE_CONVENIENCE_LIBRARIES(mysqlclient ${LIBS_TO_MERGE} COMPONENT Development) -+SET(EXTRA_ARGS) -+IF(NOT DISABLE_SHARED) -+ SET(EXTRA_ARGS "SKIP_INSTALL") -+ENDIF() -+ -+MERGE_CONVENIENCE_LIBRARIES(mysqlclient ${LIBS_TO_MERGE} COMPONENT Development ${EXTRA_ARGS}) - TARGET_LINK_LIBRARIES(mysqlclient PRIVATE ${LIBS_TO_LINK}) - - # Visual Studio users need debug static library for debug projects ---- scripts/CMakeLists.txt -+++ scripts/CMakeLists.txt -@@ -388,7 +388,7 @@ - - EXTRACT_LINK_LIBRARIES(mysqlclient CLIENT_LIBS) - --IF(MSVC) -+IF(DISABLE_SHARED) - GET_TARGET_PROPERTY(LIBMYSQL_OS_SHLIB_VERSION mysqlclient VERSION) - GET_TARGET_PROPERTY(LIBMYSQL_OS_OUTPUT_NAME mysqlclient OUTPUT_NAME) - ELSE() --- -2.21.1 - diff --git a/recipes/libmysqlclient/all/patches/0003-msvc-install-no-pdb.patch b/recipes/libmysqlclient/all/patches/0003-msvc-install-no-pdb.patch deleted file mode 100644 index 1404c64d626e4..0000000000000 --- a/recipes/libmysqlclient/all/patches/0003-msvc-install-no-pdb.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- cmake/install_macros.cmake -+++ cmake/install_macros.cmake -@@ -25,7 +25,7 @@ - - # For windows: install .pdf file for each target. - MACRO (INSTALL_DEBUG_SYMBOLS targets) -- IF(MSVC) -+ IF(FALSE) - FOREACH(target ${targets}) - GET_TARGET_PROPERTY(type ${target} TYPE) - IF(NOT INSTALL_LOCATION) -@@ -115,7 +115,7 @@ - IF(ARG_COMPONENT) - SET(COMP COMPONENT ${ARG_COMPONENT}) - ENDIF() -- INSTALL(TARGETS ${TARGETS} DESTINATION ${ARG_DESTINATION} ${COMP}) -+ INSTALL(TARGETS ${TARGETS} RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ${COMP}) - SET(INSTALL_LOCATION ${ARG_DESTINATION} ) - INSTALL_DEBUG_SYMBOLS("${TARGETS}") - SET(INSTALL_LOCATION) diff --git a/recipes/libmysqlclient/all/patches/0006-fix-cpp20-build-8.1.0.patch b/recipes/libmysqlclient/all/patches/0006-fix-cpp20-build-8.1.0.patch new file mode 100644 index 0000000000000..ebaba58ec7fab --- /dev/null +++ b/recipes/libmysqlclient/all/patches/0006-fix-cpp20-build-8.1.0.patch @@ -0,0 +1,17 @@ +diff --git a/sql/sql_bitmap.h b/sql/sql_bitmap.h +index 0f4a540..bd81a40 100644 +--- a/sql/sql_bitmap.h ++++ b/sql/sql_bitmap.h +@@ -145,10 +145,10 @@ class Bitmap<64> { + ulonglong map; + + public: +- Bitmap<64>() { init(); } ++ Bitmap() { init(); } + enum { ALL_BITS = 64 }; + +- explicit Bitmap<64>(uint prefix_to_set) { set_prefix(prefix_to_set); } ++ explicit Bitmap(uint prefix_to_set) { set_prefix(prefix_to_set); } + void init() { clear_all(); } + void init(uint prefix_to_set) { set_prefix(prefix_to_set); } + uint length() const { return 64; } 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 33b7ea062fadb..1b617851b7de6 100644 --- a/recipes/libmysqlclient/config.yml +++ b/recipes/libmysqlclient/config.yml @@ -1,9 +1,11 @@ versions: - "8.0.30": + "8.1.0": folder: all - "8.0.29": + "8.0.34": folder: all - "8.0.25": + "8.0.31": folder: all - "8.0.17": + "8.0.30": + folder: all + "8.0.25": folder: all diff --git a/recipes/libnabo/all/conandata.yml b/recipes/libnabo/all/conandata.yml new file mode 100644 index 0000000000000..7eb0f0c7c45e1 --- /dev/null +++ b/recipes/libnabo/all/conandata.yml @@ -0,0 +1,16 @@ +sources: + "1.1.0": + url: "https://github.com/ethz-asl/libnabo/archive/refs/tags/1.1.0.tar.gz" + sha256: "b69aa15cfe6baf77ae20eadd5ada9f71c725895a8983b72afb0439a1308dea5a" + "1.0.7": + url: "https://github.com/ethz-asl/libnabo/archive/refs/tags/1.0.7.tar.gz" + sha256: "817f43ba77668a7fab2834e78f0a9ff80e294d69c9818142084a32040547d10a" +patches: + "1.1.0": + - patch_file: "patches/1.1.0-0001-fix-cmake.patch" + patch_description: "use cci's eigen, disable fPIC on static build" + patch_type: "conan" + "1.0.7": + - patch_file: "patches/1.0.7-0001-fix-cmake.patch" + patch_description: "Fix upstream CMakeLists" + patch_type: "conan" diff --git a/recipes/libnabo/all/conanfile.py b/recipes/libnabo/all/conanfile.py new file mode 100644 index 0000000000000..fd6030eb858fa --- /dev/null +++ b/recipes/libnabo/all/conanfile.py @@ -0,0 +1,98 @@ +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.build import check_min_cppstd +from conan.tools.scm import Version +import os + +required_conan_version = ">=1.53.0" + + +class LibnaboConan(ConanFile): + name = "libnabo" + description = "A fast K Nearest Neighbor library for low-dimensional spaces" + license = "BSD-3-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/ethz-asl/libnabo" + topics = ("nearest-neighbor", "kd-tree") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_openmp": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_openmp": False, + } + short_paths = 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("eigen/3.4.0", transitive_headers=True) + + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["USE_OPEN_MP"] = self.options.with_openmp + tc.cache_variables["USE_OPEN_CL"] = False + tc.cache_variables["SHARED_LIBS"] = self.options.shared + if Version(self.version) >= "1.1.0": + tc.variables["LIBNABO_BUILD_DOXYGEN"] = False + tc.variables["LIBNABO_BUILD_EXAMPLES"] = False + tc.variables["LIBNABO_BUILD_TESTS"] = False + tc.variables["LIBNABO_BUILD_PYTHON"] = False + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = 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, "copyright", src=os.path.join(self.source_folder, "debian"), + 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", "libnabo") + self.cpp_info.set_property("cmake_target_name", "libnabo::nabo") + # TODO: back to global scope in conan v2 + self.cpp_info.components["nabo"].libs = ["nabo"] + + # TODO: to remove in conan v2 + self.cpp_info.components["nabo"].names["cmake_find_package"] = "nabo" + self.cpp_info.components["nabo"].names["cmake_find_package_multi"] = "nabo" + self.cpp_info.components["nabo"].set_property("cmake_target_name", "libnabo::nabo") + self.cpp_info.components["nabo"].requires = ["eigen::eigen"] diff --git a/recipes/libnabo/all/patches/1.0.7-0001-fix-cmake.patch b/recipes/libnabo/all/patches/1.0.7-0001-fix-cmake.patch new file mode 100644 index 0000000000000..8efc965410dc9 --- /dev/null +++ b/recipes/libnabo/all/patches/1.0.7-0001-fix-cmake.patch @@ -0,0 +1,94 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,4 +1,4 @@ +-cmake_minimum_required(VERSION 2.6) ++cmake_minimum_required(VERSION 3.15) + + if (NOT CMAKE_VERSION VERSION_LESS "3.1") + cmake_policy(SET CMP0054 NEW) +@@ -7,6 +7,10 @@ endif () + set(LIB_NAME nabo) + project("lib${LIB_NAME}") + ++file(READ "nabo/nabo.h" NABO_HEADER_CONTENT) ++string(REGEX MATCH "#define NABO_VERSION \"([0-9]+\.[0-9]+\.[0-9]+)\"" _ ${NABO_HEADER_CONTENT}) ++set(PROJECT_VERSION ${CMAKE_MATCH_1}) ++if(0) + # Extract version from header + set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}) + execute_process( +@@ -86,6 +90,7 @@ if (CMAKE_VERSION VERSION_LESS "3.1") + else () + set (CMAKE_CXX_STANDARD 11) + endif () ++endif() + + # openmp + set(USE_OPEN_MP TRUE CACHE BOOL "Set to FALSE to not use OpenMP") +@@ -101,15 +106,7 @@ if (USE_OPEN_MP) + endif (USE_OPEN_MP) + + # eigen 2 or 3 +-find_path(EIGEN_INCLUDE_DIR Eigen/Core +- /usr/local/include/eigen3 +- /usr/local/include/eigen2 +- /usr/local/include/eigen +- /usr/include/eigen3 +- /usr/include/eigen2 +- /usr/include/eigen +- /opt/local/include/eigen3 +-) ++find_package(Eigen3 REQUIRED CONFIG) + + # optionally, opencl + # OpenCL disabled as its code is not up-to-date with API +@@ -141,7 +138,6 @@ else (USE_OPEN_CL) + endif (USE_OPEN_CL) + + # include all libs so far +-include_directories(${CMAKE_SOURCE_DIR} ${EIGEN_INCLUDE_DIR}) + + # main nabo lib + set(NABO_SRC +@@ -153,12 +149,14 @@ set(NABO_SRC + set(SHARED_LIBS FALSE CACHE BOOL "Set to TRUE to build shared library") + if (SHARED_LIBS) + add_library(${LIB_NAME} SHARED ${NABO_SRC}) +- install(TARGETS ${LIB_NAME} LIBRARY DESTINATION lib) ++ install(TARGETS ${LIB_NAME} LIBRARY DESTINATION lib ARCHIVE DESTINATION lib RUNTIME DESTINATION bin) ++ set_target_properties(${LIB_NAME} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON) + else (SHARED_LIBS) + add_library(${LIB_NAME} ${NABO_SRC}) +- add_definitions(-fPIC) + install(TARGETS ${LIB_NAME} ARCHIVE DESTINATION lib) + endif (SHARED_LIBS) ++target_link_libraries(${LIB_NAME} PUBLIC Eigen3::Eigen) ++target_compile_features(${LIB_NAME} PUBLIC cxx_std_11) + set_target_properties(${LIB_NAME} PROPERTIES VERSION "${PROJECT_VERSION}" SOVERSION 1) + + # create doc before installing +@@ -170,11 +168,7 @@ if (DOXYGEN_FOUND) + install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc/html DESTINATION ${DOC_INSTALL_TARGET}) + endif (DOXYGEN_FOUND) + +-enable_testing() + +-add_subdirectory(examples) +-add_subdirectory(tests) +-add_subdirectory(python) + + # Install catkin package.xml + install(FILES package.xml DESTINATION share/libnabo) +@@ -195,6 +189,7 @@ install(FILES package.xml DESTINATION share/libnabo) + # 1- local build # + + # Register the local build in case one doesn't use "make install" ++if(0) + export(PACKAGE libnabo) + + # Create variable with the library location +@@ -244,3 +239,4 @@ configure_file( + + add_custom_target(uninstall + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) ++endif() diff --git a/recipes/libnabo/all/patches/1.1.0-0001-fix-cmake.patch b/recipes/libnabo/all/patches/1.1.0-0001-fix-cmake.patch new file mode 100644 index 0000000000000..763b4f0a33bce --- /dev/null +++ b/recipes/libnabo/all/patches/1.1.0-0001-fix-cmake.patch @@ -0,0 +1,51 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 7ba5fb7..36ab3a0 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -91,17 +91,17 @@ endif () + include(GNUInstallDirs) + + # eigen 2 or 3 +-find_path(EIGEN_INCLUDE_DIR NAMES signature_of_eigen3_matrix_library +- HINTS ENV EIGEN3_INC_DIR +- ENV EIGEN3_DIR +- PATHS Eigen/Core +- /usr/local/include +- /usr/include +- /opt/local/include +- PATH_SUFFIXES include eigen3 eigen2 eigen +- DOC "Directory containing the Eigen3 header files" +-) +- ++# find_path(EIGEN_INCLUDE_DIR NAMES signature_of_eigen3_matrix_library ++# HINTS ENV EIGEN3_INC_DIR ++# ENV EIGEN3_DIR ++# PATHS Eigen/Core ++# /usr/local/include ++# /usr/include ++# /opt/local/include ++# PATH_SUFFIXES include eigen3 eigen2 eigen ++# DOC "Directory containing the Eigen3 header files" ++# ) ++find_package(Eigen3 REQUIRED CONFIG) + # optionally, opencl + # OpenCL disabled as its code is not up-to-date with API + set(USE_OPEN_CL FALSE CACHE BOOL "Set to TRUE to look for OpenCL") +@@ -146,14 +146,14 @@ if (SHARED_LIBS) + else () + add_library(${LIB_NAME} STATIC ${NABO_SRC}) + if (NOT MSVC) +- target_compile_options(${LIB_NAME} PRIVATE -fPIC) ++# target_compile_options(${LIB_NAME} PRIVATE -fPIC) + endif() + install(TARGETS ${LIB_NAME} ARCHIVE DESTINATION lib) + endif () + set_target_properties(${LIB_NAME} PROPERTIES VERSION "${PROJECT_VERSION}" SOVERSION 1) +- ++target_link_libraries(${LIB_NAME} PUBLIC Eigen3::Eigen) + target_include_directories(${LIB_NAME} PUBLIC +- ${EIGEN_INCLUDE_DIR} ++# ${EIGEN_INCLUDE_DIR} + $ + $ + ) diff --git a/recipes/libnabo/all/test_package/CMakeLists.txt b/recipes/libnabo/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..6398a814018da --- /dev/null +++ b/recipes/libnabo/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(libnabo REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE libnabo::nabo) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/libnabo/all/test_package/conanfile.py b/recipes/libnabo/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0a6bc68712d90 --- /dev/null +++ b/recipes/libnabo/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/libnabo/all/test_package/test_package.cpp b/recipes/libnabo/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..7f61223412edc --- /dev/null +++ b/recipes/libnabo/all/test_package/test_package.cpp @@ -0,0 +1,17 @@ +#include + +#include + +int main() +{ + Eigen::MatrixXf M = Eigen::MatrixXf::Random(3, 100); + Eigen::VectorXf q = Eigen::VectorXf::Random(3); + auto nns = std::unique_ptr(Nabo::NNSearchF::createKDTreeLinearHeap(M)); + + const int K = 5; + Eigen::VectorXi indices(K); + Eigen::VectorXf dists2(K); + nns->knn(q, indices, dists2, K); + + return 0; +} diff --git a/recipes/libnabo/all/test_v1_package/CMakeLists.txt b/recipes/libnabo/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libnabo/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libnabo/all/test_v1_package/conanfile.py b/recipes/libnabo/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libnabo/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/libnabo/config.yml b/recipes/libnabo/config.yml new file mode 100644 index 0000000000000..5150f4a01606f --- /dev/null +++ b/recipes/libnabo/config.yml @@ -0,0 +1,5 @@ +versions: + "1.1.0": + folder: all + "1.0.7": + folder: all diff --git a/recipes/libnet/all/conandata.yml b/recipes/libnet/all/conandata.yml index 56c7fdd2f75d8..b6160ca826334 100644 --- a/recipes/libnet/all/conandata.yml +++ b/recipes/libnet/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.3": + url: "https://github.com/libnet/libnet/releases/download/v1.3/libnet-1.3.tar.gz" + sha256: "ad1e2dd9b500c58ee462acd839d0a0ea9a2b9248a1287840bc601e774fb6b28f" "1.2": - sha256: caa4868157d9e5f32e9c7eac9461efeff30cb28357f7f6bf07e73933fb4edaa7 - url: https://github.com/libnet/libnet/releases/download/v1.2/libnet-1.2.tar.gz + url: "https://github.com/libnet/libnet/releases/download/v1.2/libnet-1.2.tar.gz" + sha256: "caa4868157d9e5f32e9c7eac9461efeff30cb28357f7f6bf07e73933fb4edaa7" diff --git a/recipes/libnet/config.yml b/recipes/libnet/config.yml index a0777b5aa931c..81d0457bb64a7 100644 --- a/recipes/libnet/config.yml +++ b/recipes/libnet/config.yml @@ -1,3 +1,5 @@ versions: + "1.3": + folder: all "1.2": folder: all diff --git a/recipes/libnetfilter_conntrack/all/conandata.yml b/recipes/libnetfilter_conntrack/all/conandata.yml index 15ebea6f3f76c..dbaef81342d93 100644 --- a/recipes/libnetfilter_conntrack/all/conandata.yml +++ b/recipes/libnetfilter_conntrack/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.0.9": + url: "https://www.netfilter.org/projects/libnetfilter_conntrack/files/libnetfilter_conntrack-1.0.9.tar.bz2" + sha256: "67bd9df49fe34e8b82144f6dfb93b320f384a8ea59727e92ff8d18b5f4b579a8" "1.0.8": - sha256: 0cd13be008923528687af6c6b860f35392d49251c04ee0648282d36b1faec1cf - url: https://www.netfilter.org/projects/libnetfilter_conntrack/files/libnetfilter_conntrack-1.0.8.tar.bz2 + url: "https://www.netfilter.org/projects/libnetfilter_conntrack/files/libnetfilter_conntrack-1.0.8.tar.bz2" + sha256: "0cd13be008923528687af6c6b860f35392d49251c04ee0648282d36b1faec1cf" diff --git a/recipes/libnetfilter_conntrack/all/conanfile.py b/recipes/libnetfilter_conntrack/all/conanfile.py index b4f68103f83c1..838c21aea601b 100644 --- a/recipes/libnetfilter_conntrack/all/conanfile.py +++ b/recipes/libnetfilter_conntrack/all/conanfile.py @@ -1,67 +1,78 @@ import os -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, PkgConfigDeps +from conan.tools.layout import basic_layout + +required_conan_version = ">=1.53.0" + class Libnetfilter_conntrackConan(ConanFile): name = "libnetfilter_conntrack" + description = "userspace library that provides an API to the in-kernel connection tracking state table" license = "GPL-2.0-or-later" url = "https://github.com/conan-io/conan-center-index" homepage = "https://netfilter.org/projects/libnetfilter_conntrack/index.html" - description = "userspace library that provides an API to the in-kernel connection tracking state table" - topics = ("libnetfilter_conntrack", "netfilter") - settings = "os", "compiler", "build_type", "arch" - options = {"shared": [True, False], "fPIC": [True, False]} - default_options = {"shared": False, "fPIC": True} - generators = "pkg_config" - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" + topics = ("netfilter",) - def requirements(self): - self.requires("libmnl/1.0.4") - self.requires("libnfnetlink/1.0.1") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": 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 config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC def configure(self): - if self.settings.os != "Linux": + if self.settings.os not in ["Linux", "FreeBSD"]: raise ConanInvalidConfiguration("libnetfilter_conntrack is only supported on Linux") 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 _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 layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("libmnl/1.0.4", transitive_headers=True, transitive_libs=True) + self.requires("libnfnetlink/1.0.2", transitive_headers=True) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = AutotoolsToolchain(self) + tc.generate() + deps = PkgConfigDeps(self) + deps.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", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder) + 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, "share")) - tools.rmdir(os.path.join(self.package_folder, "etc")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.la", self.package_folder, recursive=True) + 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")) def package_info(self): self.cpp_info.libs = ["netfilter_conntrack"] - self.cpp_info.names["pkg_config"] = "libnetfilter_conntrack" + self.cpp_info.set_property("pkg_config_name", "libnetfilter_conntrack") diff --git a/recipes/libnetfilter_conntrack/all/test_package/CMakeLists.txt b/recipes/libnetfilter_conntrack/all/test_package/CMakeLists.txt index 4dbc40cd2c4d9..133b0de001670 100644 --- a/recipes/libnetfilter_conntrack/all/test_package/CMakeLists.txt +++ b/recipes/libnetfilter_conntrack/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ -cmake_minimum_required(VERSION 3.10) -project(PackageTest) +cmake_minimum_required(VERSION 3.15) +project(PackageTest LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(libnetfilter_conntrack REQUIRED CONFIG) add_executable(example example.c) -target_link_libraries(example ${CONAN_LIBS}) +target_link_libraries(example libnetfilter_conntrack::libnetfilter_conntrack) diff --git a/recipes/libnetfilter_conntrack/all/test_package/conanfile.py b/recipes/libnetfilter_conntrack/all/test_package/conanfile.py index 4959660649186..cf3b9d75009a7 100644 --- a/recipes/libnetfilter_conntrack/all/test_package/conanfile.py +++ b/recipes/libnetfilter_conntrack/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 Libnetfilter_conntrackTestConan(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): - bin_path = os.path.join("bin", "example") - self.run("{} {}".format(bin_path, 0), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindir, "example") + self.run(f"{bin_path} 0", env="conanrun") diff --git a/recipes/libnetfilter_conntrack/all/test_package/example.c b/recipes/libnetfilter_conntrack/all/test_package/example.c index 331a7d9d4f854..ccdf8593d195f 100644 --- a/recipes/libnetfilter_conntrack/all/test_package/example.c +++ b/recipes/libnetfilter_conntrack/all/test_package/example.c @@ -1,12 +1,12 @@ +#include +#include + #include #include #include #include #include -#include -#include - static int data_cb(const struct nlmsghdr *nlh, void *data) { struct nf_conntrack *ct; diff --git a/recipes/libnetfilter_conntrack/all/test_v1_package/CMakeLists.txt b/recipes/libnetfilter_conntrack/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/libnetfilter_conntrack/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/libnetfilter_conntrack/all/test_v1_package/conanfile.py b/recipes/libnetfilter_conntrack/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..ebd551d13e399 --- /dev/null +++ b/recipes/libnetfilter_conntrack/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +import os + +from conans import ConanFile, CMake, tools + +class Libnetfilter_conntrackTestConan(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", "example") + self.run("{} {}".format(bin_path, 0), run_environment=True) diff --git a/recipes/libnetfilter_conntrack/config.yml b/recipes/libnetfilter_conntrack/config.yml index 3d5953260054d..f02198b44e348 100644 --- a/recipes/libnetfilter_conntrack/config.yml +++ b/recipes/libnetfilter_conntrack/config.yml @@ -1,3 +1,5 @@ versions: + 1.0.9: + folder: all 1.0.8: folder: all diff --git a/recipes/libnetfilter_queue/all/conanfile.py b/recipes/libnetfilter_queue/all/conanfile.py index 56576ded262ce..3552a30ecc625 100644 --- a/recipes/libnetfilter_queue/all/conanfile.py +++ b/recipes/libnetfilter_queue/all/conanfile.py @@ -1,69 +1,83 @@ import os -from conans import ConanFile, tools, AutoToolsBuildEnvironment -from conans.errors import ConanInvalidConfiguration -required_conan_version = ">=1.29.1" +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, PkgConfigDeps +from conan.tools.layout import basic_layout + +required_conan_version = ">=1.53.0" + class Libnetfilter_queueConan(ConanFile): name = "libnetfilter_queue" + description = ("userspace library that provides an API to packets" + " that have been queued by the kernel packet filter") license = "GPL-2.0-or-later" url = "https://github.com/conan-io/conan-center-index" homepage = "https://netfilter.org/projects/libnetfilter_queue/index.html" - description = "userspace library that provides an API to packets that have been queued by the kernel packet filter" - topics = ("libnetfilter_queue", "netfilter") - settings = "os", "compiler", "build_type", "arch" - options = {"shared": [True, False], "fPIC": [True, False]} - default_options = {"shared": False, "fPIC": True} - generators = "pkg_config" - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" + topics = "netfilter" - def requirements(self): - self.requires("libmnl/1.0.4") - self.requires("libnfnetlink/1.0.1") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": 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 config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC - def configure(self): + def validate(self): if self.settings.os != "Linux": - raise ConanInvalidConfiguration("libnetfilter_queue is only supported on Linux") - if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self) - conf_args = [] + raise ConanInvalidConfiguration(f"{self.ref} is only supported on Linux.") + + def configure(self): 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 + 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("libmnl/1.0.4", transitive_headers=True, transitive_libs=True) + self.requires("libnfnetlink/1.0.2", transitive_headers=True) + + def build_requirements(self): + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/2.0.3") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = AutotoolsToolchain(self) + tc.generate() + deps = PkgConfigDeps(self) + deps.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", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + 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, "share")) - tools.rmdir(os.path.join(self.package_folder, "etc")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.la", self.package_folder, recursive=True) + 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")) def package_info(self): self.cpp_info.libs = ["netfilter_queue"] - self.cpp_info.names["pkg_config"] = "libnetfilter_queue" + self.cpp_info.set_property("pkg_config_name", "libnetfilter_queue") diff --git a/recipes/libnetfilter_queue/all/test_package/CMakeLists.txt b/recipes/libnetfilter_queue/all/test_package/CMakeLists.txt index 4dbc40cd2c4d9..58e2406eaac64 100644 --- a/recipes/libnetfilter_queue/all/test_package/CMakeLists.txt +++ b/recipes/libnetfilter_queue/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ -cmake_minimum_required(VERSION 3.10) -project(PackageTest) +cmake_minimum_required(VERSION 3.15) +project(PackageTest LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(libnetfilter_queue REQUIRED CONFIG) add_executable(example example.c) -target_link_libraries(example ${CONAN_LIBS}) +target_link_libraries(example libnetfilter_queue::libnetfilter_queue) diff --git a/recipes/libnetfilter_queue/all/test_package/conanfile.py b/recipes/libnetfilter_queue/all/test_package/conanfile.py index 1097433829a7c..cf3b9d75009a7 100644 --- a/recipes/libnetfilter_queue/all/test_package/conanfile.py +++ b/recipes/libnetfilter_queue/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 Libnetfilter_queueTestConan(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,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("{} {}".format(bin_path, 0), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindir, "example") + self.run(f"{bin_path} 0", env="conanrun") diff --git a/recipes/libnetfilter_queue/all/test_package/example.c b/recipes/libnetfilter_queue/all/test_package/example.c index f229443f228aa..6260070d87080 100644 --- a/recipes/libnetfilter_queue/all/test_package/example.c +++ b/recipes/libnetfilter_queue/all/test_package/example.c @@ -1,17 +1,17 @@ +#include #include #include #include -#include #include #include -#include +#include #include #include #include -#include #include +#include #include @@ -20,153 +20,149 @@ static struct mnl_socket *nl; -static void -nfq_send_verdict(int queue_num, uint32_t id) -{ - char buf[MNL_SOCKET_BUFFER_SIZE]; - struct nlmsghdr *nlh; - struct nlattr *nest; +static void nfq_send_verdict(int queue_num, uint32_t id) { + char buf[MNL_SOCKET_BUFFER_SIZE]; + struct nlmsghdr *nlh; + struct nlattr *nest; - nlh = nfq_nlmsg_put(buf, NFQNL_MSG_VERDICT, queue_num); - nfq_nlmsg_verdict_put(nlh, id, NF_ACCEPT); + nlh = nfq_nlmsg_put(buf, NFQNL_MSG_VERDICT, queue_num); + nfq_nlmsg_verdict_put(nlh, id, NF_ACCEPT); - /* example to set the connmark. First, start NFQA_CT section: */ - nest = mnl_attr_nest_start(nlh, NFQA_CT); + /* example to set the connmark. First, start NFQA_CT section: */ + nest = mnl_attr_nest_start(nlh, NFQA_CT); - /* then, add the connmark attribute: */ - mnl_attr_put_u32(nlh, CTA_MARK, htonl(42)); - /* more conntrack attributes, e.g. CTA_LABELS could be set here */ + /* then, add the connmark attribute: */ + mnl_attr_put_u32(nlh, CTA_MARK, htonl(42)); + /* more conntrack attributes, e.g. CTA_LABELS could be set here */ - /* end conntrack section */ - mnl_attr_nest_end(nlh, nest); + /* end conntrack section */ + mnl_attr_nest_end(nlh, nest); - if (mnl_socket_sendto(nl, nlh, nlh->nlmsg_len) < 0) { - perror("mnl_socket_send"); - exit(EXIT_FAILURE); - } + if (mnl_socket_sendto(nl, nlh, nlh->nlmsg_len) < 0) { + perror("mnl_socket_send"); + exit(EXIT_FAILURE); + } } -static int queue_cb(const struct nlmsghdr *nlh, void *data) -{ - struct nfqnl_msg_packet_hdr *ph = NULL; - struct nlattr *attr[NFQA_MAX+1] = {}; - uint32_t id = 0, skbinfo; - struct nfgenmsg *nfg; - uint16_t plen; +static int queue_cb(const struct nlmsghdr *nlh, void *data) { + struct nfqnl_msg_packet_hdr *ph = NULL; + struct nlattr *attr[NFQA_MAX + 1] = {}; + uint32_t id = 0, skbinfo; + struct nfgenmsg *nfg; + uint16_t plen; - if (nfq_nlmsg_parse(nlh, attr) < 0) { - perror("problems parsing"); - return MNL_CB_ERROR; - } + if (nfq_nlmsg_parse(nlh, attr) < 0) { + perror("problems parsing"); + return MNL_CB_ERROR; + } - nfg = mnl_nlmsg_get_payload(nlh); + nfg = mnl_nlmsg_get_payload(nlh); - if (attr[NFQA_PACKET_HDR] == NULL) { - fputs("metaheader not set\n", stderr); - return MNL_CB_ERROR; - } + if (attr[NFQA_PACKET_HDR] == NULL) { + fputs("metaheader not set\n", stderr); + return MNL_CB_ERROR; + } - ph = mnl_attr_get_payload(attr[NFQA_PACKET_HDR]); + ph = mnl_attr_get_payload(attr[NFQA_PACKET_HDR]); - plen = mnl_attr_get_payload_len(attr[NFQA_PAYLOAD]); - /* void *payload = mnl_attr_get_payload(attr[NFQA_PAYLOAD]); */ + plen = mnl_attr_get_payload_len(attr[NFQA_PAYLOAD]); + /* void *payload = mnl_attr_get_payload(attr[NFQA_PAYLOAD]); */ - skbinfo = attr[NFQA_SKB_INFO] ? ntohl(mnl_attr_get_u32(attr[NFQA_SKB_INFO])) : 0; + skbinfo = attr[NFQA_SKB_INFO] ? ntohl(mnl_attr_get_u32(attr[NFQA_SKB_INFO])) : 0; - if (attr[NFQA_CAP_LEN]) { - uint32_t orig_len = ntohl(mnl_attr_get_u32(attr[NFQA_CAP_LEN])); - if (orig_len != plen) - printf("truncated "); - } + if (attr[NFQA_CAP_LEN]) { + uint32_t orig_len = ntohl(mnl_attr_get_u32(attr[NFQA_CAP_LEN])); + if (orig_len != plen) + printf("truncated "); + } - if (skbinfo & NFQA_SKB_GSO) - printf("GSO "); + if (skbinfo & NFQA_SKB_GSO) + printf("GSO "); - id = ntohl(ph->packet_id); - printf("packet received (id=%u hw=0x%04x hook=%u, payload len %u", - id, ntohs(ph->hw_protocol), ph->hook, plen); + id = ntohl(ph->packet_id); + printf("packet received (id=%u hw=0x%04x hook=%u, payload len %u", id, ntohs(ph->hw_protocol), + ph->hook, plen); - /* - * ip/tcp checksums are not yet valid, e.g. due to GRO/GSO. - * The application should behave as if the checksums are correct. - * - * If these packets are later forwarded/sent out, the checksums will - * be corrected by kernel/hardware. - */ - if (skbinfo & NFQA_SKB_CSUMNOTREADY) - printf(", checksum not ready"); - puts(")"); + /* + * ip/tcp checksums are not yet valid, e.g. due to GRO/GSO. + * The application should behave as if the checksums are correct. + * + * If these packets are later forwarded/sent out, the checksums will + * be corrected by kernel/hardware. + */ + if (skbinfo & NFQA_SKB_CSUMNOTREADY) + printf(", checksum not ready"); + puts(")"); - nfq_send_verdict(ntohs(nfg->res_id), id); + nfq_send_verdict(ntohs(nfg->res_id), id); - return MNL_CB_OK; + return MNL_CB_OK; } -int main(int argc, char *argv[]) -{ - char *buf; - /* largest possible packet payload, plus netlink data overhead: */ - size_t sizeof_buf = 0xffff + (MNL_SOCKET_BUFFER_SIZE/2); - struct nlmsghdr *nlh; - int ret; - unsigned int portid, queue_num; - - if (argc != 2) { - printf("Usage: %s [queue_num]\n", argv[0]); - exit(EXIT_FAILURE); - } - queue_num = atoi(argv[1]); - - nl = mnl_socket_open(NETLINK_NETFILTER); - if (nl == NULL) { - perror("mnl_socket_open"); - exit(EXIT_FAILURE); - } - - if (mnl_socket_bind(nl, 0, MNL_SOCKET_AUTOPID) < 0) { - perror("mnl_socket_bind"); - exit(EXIT_FAILURE); - } - portid = mnl_socket_get_portid(nl); - - buf = malloc(sizeof_buf); - if (!buf) { - perror("allocate receive buffer"); - exit(EXIT_FAILURE); - } - - nlh = nfq_nlmsg_put(buf, NFQNL_MSG_CONFIG, queue_num); - nfq_nlmsg_cfg_put_cmd(nlh, AF_INET, NFQNL_CFG_CMD_BIND); - - if (mnl_socket_sendto(nl, nlh, nlh->nlmsg_len) < 0) { - perror("mnl_socket_send"); - exit(EXIT_FAILURE); - } - - nlh = nfq_nlmsg_put(buf, NFQNL_MSG_CONFIG, queue_num); - nfq_nlmsg_cfg_put_params(nlh, NFQNL_COPY_PACKET, 0xffff); - - mnl_attr_put_u32(nlh, NFQA_CFG_FLAGS, htonl(NFQA_CFG_F_GSO)); - mnl_attr_put_u32(nlh, NFQA_CFG_MASK, htonl(NFQA_CFG_F_GSO)); - - if (mnl_socket_sendto(nl, nlh, nlh->nlmsg_len) < 0) { - perror("mnl_socket_send"); - exit(EXIT_FAILURE); - } - - /* ENOBUFS is signalled to userspace when packets were lost - * on kernel side. In most cases, userspace isn't interested - * in this information, so turn it off. - */ - ret = 1; - mnl_socket_setsockopt(nl, NETLINK_NO_ENOBUFS, &ret, sizeof(int)); - ret = mnl_socket_recvfrom(nl, buf, sizeof_buf); - if (ret == -1) { - perror("mnl_socket_recvfrom"); - exit(EXIT_FAILURE); - } - - mnl_socket_close(nl); - - return 0; +int main(int argc, char *argv[]) { + char *buf; + /* largest possible packet payload, plus netlink data overhead: */ + size_t sizeof_buf = 0xffff + (MNL_SOCKET_BUFFER_SIZE / 2); + struct nlmsghdr *nlh; + int ret; + unsigned int portid, queue_num; + + if (argc != 2) { + printf("Usage: %s [queue_num]\n", argv[0]); + exit(EXIT_FAILURE); + } + queue_num = atoi(argv[1]); + + nl = mnl_socket_open(NETLINK_NETFILTER); + if (nl == NULL) { + perror("mnl_socket_open"); + exit(EXIT_FAILURE); + } + + if (mnl_socket_bind(nl, 0, MNL_SOCKET_AUTOPID) < 0) { + perror("mnl_socket_bind"); + exit(EXIT_FAILURE); + } + portid = mnl_socket_get_portid(nl); + + buf = malloc(sizeof_buf); + if (!buf) { + perror("allocate receive buffer"); + exit(EXIT_FAILURE); + } + + nlh = nfq_nlmsg_put(buf, NFQNL_MSG_CONFIG, queue_num); + nfq_nlmsg_cfg_put_cmd(nlh, AF_INET, NFQNL_CFG_CMD_BIND); + + if (mnl_socket_sendto(nl, nlh, nlh->nlmsg_len) < 0) { + perror("mnl_socket_send"); + exit(EXIT_FAILURE); + } + + nlh = nfq_nlmsg_put(buf, NFQNL_MSG_CONFIG, queue_num); + nfq_nlmsg_cfg_put_params(nlh, NFQNL_COPY_PACKET, 0xffff); + + mnl_attr_put_u32(nlh, NFQA_CFG_FLAGS, htonl(NFQA_CFG_F_GSO)); + mnl_attr_put_u32(nlh, NFQA_CFG_MASK, htonl(NFQA_CFG_F_GSO)); + + if (mnl_socket_sendto(nl, nlh, nlh->nlmsg_len) < 0) { + perror("mnl_socket_send"); + exit(EXIT_FAILURE); + } + + /* ENOBUFS is signalled to userspace when packets were lost + * on kernel side. In most cases, userspace isn't interested + * in this information, so turn it off. + */ + ret = 1; + mnl_socket_setsockopt(nl, NETLINK_NO_ENOBUFS, &ret, sizeof(int)); + ret = mnl_socket_recvfrom(nl, buf, sizeof_buf); + if (ret == -1) { + perror("mnl_socket_recvfrom"); + exit(EXIT_FAILURE); + } + + mnl_socket_close(nl); + + return 0; } diff --git a/recipes/libnetfilter_queue/all/test_v1_package/CMakeLists.txt b/recipes/libnetfilter_queue/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/libnetfilter_queue/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/libnetfilter_queue/all/test_v1_package/conanfile.py b/recipes/libnetfilter_queue/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..528904ad9f959 --- /dev/null +++ b/recipes/libnetfilter_queue/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +import os + +from conans import ConanFile, CMake, tools + + +class Libnetfilter_queueTestConan(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", "example") + self.run("{} {}".format(bin_path, 0), run_environment=True) diff --git a/recipes/libnfnetlink/all/conanfile.py b/recipes/libnfnetlink/all/conanfile.py index 10540d39fbf9c..3797ae3ceea3a 100644 --- a/recipes/libnfnetlink/all/conanfile.py +++ b/recipes/libnfnetlink/all/conanfile.py @@ -1,67 +1,70 @@ import os -import functools -from conans import ConanFile, tools, AutoToolsBuildEnvironment -from conans.errors import ConanInvalidConfiguration -required_conan_version = ">=1.43.0" +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 + +required_conan_version = ">=1.53.0" + class LibnfnetlinkConan(ConanFile): name = "libnfnetlink" + description = "low-level library for netfilter related kernel/userspace communication" license = "GPL-2.0-or-later" url = "https://github.com/conan-io/conan-center-index" homepage = "https://netfilter.org/projects/libnfnetlink/index.html" - description = "low-level library for netfilter related kernel/userspace communication" - topics = ("libnfnetlink", "netlink", "netfilter") - settings = "os", "compiler", "build_type", "arch" - options = {"shared": [True, False], "fPIC": [True, False]} - default_options = {"shared": False, "fPIC": True} + topics = ("netlink", "netfilter") - @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, + } - def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + 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.settings.os != "Linux": + if self.settings.os not in ["Linux", "FreeBSD"]: raise ConanInvalidConfiguration("libnfnetlink is only supported on Linux") - def configure(self): - if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) - @functools.lru_cache(1) - def _configure_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"]) - autotools.configure(configure_dir=self._source_subfolder, args=conf_args) - return autotools + def generate(self): + tc = AutotoolsToolchain(self) + 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", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder) + 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, "share")) - tools.rmdir(os.path.join(self.package_folder, "etc")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.la", self.package_folder, recursive=True) + 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")) def package_info(self): self.cpp_info.libs = ["nfnetlink"] - self.cpp_info.set_property("pkg_config_name", "libnfnetlink") - - # TODO: to remove in conan v2 once pkg_config generator is removed - self.cpp_info.names["pkg_config"] = "libnfnetlink" + self.cpp_info.set_property("pkg_config_name", "libnfnetlink") diff --git a/recipes/libnfnetlink/all/test_package/CMakeLists.txt b/recipes/libnfnetlink/all/test_package/CMakeLists.txt index d4fdee1a8a79c..7e1aa1808dfd5 100644 --- a/recipes/libnfnetlink/all/test_package/CMakeLists.txt +++ b/recipes/libnfnetlink/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(PackageTest CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(libnfnetlink REQUIRED CONFIG) add_executable(example example.cpp) -target_link_libraries(example ${CONAN_LIBS}) +target_link_libraries(example libnfnetlink::libnfnetlink) diff --git a/recipes/libnfnetlink/all/test_package/conanfile.py b/recipes/libnfnetlink/all/test_package/conanfile.py index e4f1965959dec..e0f447388fa1b 100644 --- a/recipes/libnfnetlink/all/test_package/conanfile.py +++ b/recipes/libnfnetlink/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" + test_type = "explicit" -class LibnfnetlinkTestConan(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,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.bindir, "example") + self.run(bin_path, env="conanrun") diff --git a/recipes/libnfnetlink/all/test_package/example.cpp b/recipes/libnfnetlink/all/test_package/example.cpp index 95153d8532f51..395453bdde08a 100644 --- a/recipes/libnfnetlink/all/test_package/example.cpp +++ b/recipes/libnfnetlink/all/test_package/example.cpp @@ -1,7 +1,8 @@ -#include -#include #include +#include +#include + int main() { struct nfnl_handle *nl = nfnl_open(); if (nl == NULL) { diff --git a/recipes/libnfnetlink/all/test_v1_package/CMakeLists.txt b/recipes/libnfnetlink/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/libnfnetlink/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/libnfnetlink/all/test_v1_package/conanfile.py b/recipes/libnfnetlink/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..c8689f282274d --- /dev/null +++ b/recipes/libnfnetlink/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +import os + +from conans import ConanFile, CMake, tools + + +class LibnfnetlinkTestConan(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", "example") + self.run(bin_path, run_environment=True) diff --git a/recipes/libnfs/all/conandata.yml b/recipes/libnfs/all/conandata.yml index 5c9b795165455..782953e21dab6 100644 --- a/recipes/libnfs/all/conandata.yml +++ b/recipes/libnfs/all/conandata.yml @@ -1,8 +1,24 @@ sources: + "5.0.3": + url: "https://github.com/sahlberg/libnfs/archive/refs/tags/libnfs-5.0.3.tar.gz" + sha256: "d945cb4f4c8f82ee1f3640893a168810f794a28e1010bb007ec5add345e9df3e" + "5.0.2": + url: "https://github.com/sahlberg/libnfs/archive/refs/tags/libnfs-5.0.2.tar.gz" + sha256: "637e56643b19da9fba98f06847788c4dad308b723156a64748041035dcdf9bd3" "5.0.1": url: "https://github.com/sahlberg/libnfs/archive/refs/tags/libnfs-5.0.1.tar.gz" sha256: "7ef445410b42f36b9bad426608b53ccb9ccca4101e545c383f564c11db672ca8" patches: + "5.0.3": + - 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" + "5.0.2": + - 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" "5.0.1": - patch_file: "patches/5.0.1-0001-remove-exports.patch" patch_description: "Fix installation" diff --git a/recipes/libnfs/all/conanfile.py b/recipes/libnfs/all/conanfile.py index 3b943c080be1a..12b83841bd97e 100644 --- a/recipes/libnfs/all/conanfile.py +++ b/recipes/libnfs/all/conanfile.py @@ -13,6 +13,7 @@ class LibnfsConan(ConanFile): license = "LGPL-2.1" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/sahlberg/libnfs" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -40,8 +41,7 @@ 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/libnfs/config.yml b/recipes/libnfs/config.yml index 12fc1d264fabb..7ec3cb9fcf03a 100644 --- a/recipes/libnfs/config.yml +++ b/recipes/libnfs/config.yml @@ -1,3 +1,7 @@ versions: + "5.0.3": + folder: "all" + "5.0.2": + folder: "all" "5.0.1": folder: "all" diff --git a/recipes/libnghttp2/all/conandata.yml b/recipes/libnghttp2/all/conandata.yml index b58b621d4ded7..c95a58d3fe33d 100644 --- a/recipes/libnghttp2/all/conandata.yml +++ b/recipes/libnghttp2/all/conandata.yml @@ -1,63 +1,37 @@ sources: + "1.61.0": + url: "https://github.com/nghttp2/nghttp2/releases/download/v1.61.0/nghttp2-1.61.0.tar.bz2" + sha256: "4e8cf7ec32d4c5a430966242d72035d255cd9470a8766d61eed7a0190dd544fd" + "1.60.0": + url: "https://github.com/nghttp2/nghttp2/archive/v1.60.0.tar.gz" + sha256: "3cc9403c64e0a133868f62132ff0884cd5dc567eee5bd7b2d03ac81293695d6b" + "1.59.0": + url: "https://github.com/nghttp2/nghttp2/archive/v1.59.0.tar.gz" + sha256: "0dd5c980f1262ff5f03676fd99f46f250b66c842f7d864fa1ca9f8453e5f8868" + "1.58.0": + url: "https://github.com/nghttp2/nghttp2/archive/v1.58.0.tar.gz" + sha256: "7da19947b33a07ddcf97b9791331bfee8a8545e6b394275a9971f43cae9d636b" + "1.57.0": + url: "https://github.com/nghttp2/nghttp2/archive/v1.57.0.tar.gz" + sha256: "3c0b4e023dddf2afa087aa4409f7dbe03c099b4c63655e7545a607035085848a" + "1.56.0": + url: "https://github.com/nghttp2/nghttp2/archive/v1.56.0.tar.gz" + sha256: "63dd705b524eec3c843b8e4e24914600a30c2804a113e8e5baeeb9695d09590a" + "1.55.1": + url: "https://github.com/nghttp2/nghttp2/archive/v1.55.1.tar.gz" + sha256: "b89dece5bc3382b82c22db8dc8d1e062258cb7af8e4ad55278fa7149645a588d" + "1.55.0": + url: "https://github.com/nghttp2/nghttp2/archive/v1.55.0.tar.gz" + sha256: "6d2a4d246e84cb1e3e581591bd1c50ecc085e50090bc068ed5a67f87c6b4a06e" + "1.54.0": + url: "https://github.com/nghttp2/nghttp2/archive/v1.54.0.tar.gz" + sha256: "aae8bda9e06d7c51a12488175086edc44a46c230561dc7c45d779e00e43d4b8e" + "1.53.0": + url: "https://github.com/nghttp2/nghttp2/releases/download/v1.53.0/nghttp2-1.53.0.tar.xz" + sha256: "b867184254e5a29b0ba68413aa14f8b0ce1142a371761374598dec092dabb809" "1.51.0": - url: "https://github.com/nghttp2/nghttp2/archive/v1.51.0.tar.gz" - sha256: "dfcf41e0b093765a79c9f1fc0ba6dc3d524555e94483ea9ba8b87a6d454971ba" + 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/archive/v1.50.0.tar.gz" - sha256: "6de469efc8e9d47059327a6736aebe0a7d73f57e5e37ab4c4f838fb1eebd7889" - "1.49.0": - url: "https://github.com/nghttp2/nghttp2/archive/v1.49.0.tar.gz" - sha256: "744f38f8d6e400a424bf62df449c91e3ffacbae11b5fab99e44a480f5c735ab9" - "1.48.0": - url: "https://github.com/nghttp2/nghttp2/archive/v1.48.0.tar.gz" - sha256: "946a8fa490548b67fc6074553cb225279cc6404bae96cf74551f2ad4453be637" - "1.47.0": - url: "https://github.com/nghttp2/nghttp2/archive/v1.47.0.tar.gz" - sha256: "db98735b30f1586edf3212ada57f85feaceff483a1c0f1c1c8285abcf37e3444" - "1.46.0": - url: "https://github.com/nghttp2/nghttp2/archive/v1.46.0.tar.gz" - sha256: "0875a638d319cd28b06dcc410e6dc2add1a52f7cab6f62b26025c448f8ae8f43" - "1.45.1": - url: "https://github.com/nghttp2/nghttp2/archive/v1.45.1.tar.gz" - sha256: "6289eed7e83988428c6b24e46ada52a37fab82f20d4afa257b5627267c2a141b" - "1.43.0": - url: "https://github.com/nghttp2/nghttp2/archive/v1.43.0.tar.gz" - sha256: "f4a9be08d22f5ad9b4bf36c491f1be58e54dc35a1592eaf4e3f79567e4894d0c" - "1.42.0": - url: "https://github.com/nghttp2/nghttp2/releases/download/v1.42.0/nghttp2-1.42.0.tar.bz2" - sha256: "10473848c2636fa9de6b469b04d0a0336cf8268486f7a6bde7cb2d0634736624" - "1.40.0": - url: "https://github.com/nghttp2/nghttp2/releases/download/v1.40.0/nghttp2-1.40.0.tar.bz2" - sha256: "82758e13727945f2408d0612762e4655180b039f058d5ff40d055fa1497bd94f" - "1.39.2": - url: "https://github.com/nghttp2/nghttp2/releases/download/v1.39.2/nghttp2-1.39.2.tar.bz2" - sha256: "92a23e4522328c8565028ee0c7270e74add7990614fd1148f2a79d873bc2a1d0" -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" - - patch_file: "patches/fix-findLibevent.cmake" - "1.47.0": - - patch_file: "patches/fix-findJemalloc.cmake" - - patch_file: "patches/fix-findLibevent.cmake" - "1.46.0": - - patch_file: "patches/fix-findJemalloc.cmake" - - patch_file: "patches/fix-findLibevent.cmake" - "1.45.1": - - patch_file: "patches/fix-findJemalloc.cmake" - - patch_file: "patches/fix-findLibevent.cmake" - "1.43.0": - - patch_file: "patches/fix-findJemalloc.cmake" - - patch_file: "patches/fix-findLibevent.cmake" - "1.42.0": - - patch_file: "patches/fix-findJemalloc.cmake" - - patch_file: "patches/fix-findLibevent.cmake" - "1.40.0": - - patch_file: "patches/fix-findJemalloc.cmake" - - patch_file: "patches/fix-findLibevent.cmake" - "1.39.2": - - patch_file: "patches/fix-addNghttp2IncludesPathCMake.patch" - - patch_file: "patches/fix-findJemalloc.cmake" - - patch_file: "patches/fix-findLibevent.cmake" + url: "https://github.com/nghttp2/nghttp2/releases/download/v1.50.0/nghttp2-1.50.0.tar.xz" + sha256: "af24007e34c18c782393a1dc3685f8fd5b50283e90a9191d25488eb50aa2c825" diff --git a/recipes/libnghttp2/all/conanfile.py b/recipes/libnghttp2/all/conanfile.py index b3b58ce1c61eb..8fa456dd4d783 100644 --- a/recipes/libnghttp2/all/conanfile.py +++ b/recipes/libnghttp2/all/conanfile.py @@ -1,24 +1,25 @@ 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 get, save, replace_in_file, rmdir, copy from conan.tools.gnu import PkgConfigDeps -from conan.tools.scm import Version -from conan.tools.files import export_conandata_patches, apply_conandata_patches, get, save, replace_in_file, rmdir, copy from conan.tools.microsoft import is_msvc -from conan.tools.apple import is_apple_os -from conan.errors import ConanInvalidConfiguration +from conan.tools.scm import Version import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class Nghttp2Conan(ConanFile): name = "libnghttp2" description = "HTTP/2 C Library and tools" - topics = ("http", "http2") + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://nghttp2.org" - license = "MIT" + topics = ("http", "http2") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -37,77 +38,70 @@ class Nghttp2Conan(ConanFile): "with_asio": 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: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") if not (self.options.with_app or self.options.with_hpack or self.options.with_asio): - try: - del self.settings.compiler.cppstd - except Exception: - pass - try: - del self.settings.compiler.libcxx - except Exception: - pass + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") if not self.options.with_app: del self.options.with_jemalloc + if Version(self.version) >= "1.52.0": + del self.options.with_asio 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") + if self.options.with_app or self.options.get_safe("with_asio"): + self.requires("openssl/[>=1.1 <4]") if self.options.with_app: - self.requires("c-ares/1.18.1") + self.requires("c-ares/1.25.0") self.requires("libev/4.33") self.requires("libevent/2.1.12") - self.requires("libxml2/2.9.14") - self.requires("zlib/1.2.13") + self.requires("libxml2/2.12.4") + self.requires("zlib/[>=1.2.11 <2]") if self.options.with_jemalloc: 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.80.0") + if self.options.get_safe("with_asio"): + self.requires("boost/1.84.0") def validate(self): - if self.info.options.with_asio and is_msvc(self): + if self.options.get_safe("with_asio") and is_msvc(self): raise ConanInvalidConfiguration("Build with asio and MSVC is not supported yet, see upstream bug #589") - if self.info.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "6": + if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "6": raise ConanInvalidConfiguration(f"{self.ref} requires GCC >= 6.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): tc = CMakeToolchain(self) - tc.variables["ENABLE_SHARED_LIB"] = self.options.shared - tc.variables["ENABLE_STATIC_LIB"] = not self.options.shared + if Version(self.version) < "1.60.0": + tc.variables["ENABLE_SHARED_LIB"] = self.options.shared + tc.variables["ENABLE_STATIC_LIB"] = not self.options.shared + else: + tc.variables["BUILD_STATIC_LIBS"] = 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 + if Version(self.version) < "1.52.0": + tc.variables["ENABLE_PYTHON_BINDINGS"] = False tc.variables["ENABLE_FAILMALLOC"] = False # disable unneeded auto-picked dependencies 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 Version(self.version) >= "1.42.0": - # backward-incompatible change in 1.42.0 - tc.variables["STATIC_LIB_SUFFIX"] = "_static" + if Version(self.version) < "1.52.0": + tc.variables["ENABLE_ASIO_LIB"] = self.options.with_asio + # To avoid overwriting dll import lib by static lib + if Version(self.version) >= "1.60.0" and self.options.shared: + tc.variables["STATIC_LIB_SUFFIX"] = "-static" if is_apple_os(self): # workaround for: install TARGETS given no BUNDLE DESTINATION for MACOSX_BUNDLE executable tc.cache_variables["CMAKE_MACOSX_BUNDLE"] = False @@ -119,8 +113,7 @@ def generate(self): tc.generate() def _patch_sources(self): - apply_conandata_patches(self) - if not self.options.shared: + if not self.options.shared and Version(self.version) < "1.60.0": # easier to patch here rather than have patch 'nghttp_static_include_directories' for each version save(self, os.path.join(self.source_folder, "lib", "CMakeLists.txt"), "target_include_directories(nghttp2_static INTERFACE\n" @@ -135,7 +128,7 @@ def _patch_sources(self): "\n" "link_libraries(\n" " {} ${{CONAN_LIBS}}\n".format(target_libnghttp2)) - if not self.options.shared: + if not self.options.shared and Version(self.version) < "1.52.0": replace_in_file(self, os.path.join(self.source_folder, "src", "CMakeLists.txt"), "\n" " add_library(nghttp2_asio SHARED\n", @@ -148,6 +141,8 @@ def _patch_sources(self): "\n" " target_link_libraries(nghttp2_asio\n" f" {target_libnghttp2}\n") + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "add_subdirectory(examples)", "") + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "add_subdirectory(tests)", "") def build(self): self._patch_sources() @@ -161,15 +156,15 @@ def package(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.components["nghttp2"].set_property("pkg_config_name", "libnghttp2") - suffix = "_static" if Version(self.version) > "1.39.2" and not self.options.shared else "" - self.cpp_info.components["nghttp2"].libs = [f"nghttp2{suffix}"] + 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: + if self.options.get_safe("with_asio"): self.cpp_info.components["nghttp2_asio"].set_property("pkg_config_name", "libnghttp2_asio") self.cpp_info.components["nghttp2_asio"].libs = ["nghttp2_asio"] self.cpp_info.components["nghttp2_asio"].requires = [ @@ -188,9 +183,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") + self.cpp_info.set_property("pkg_config_name", "libnghttp2_asio" if self.options.get_safe("with_asio") else "libnghttp2") diff --git a/recipes/libnghttp2/all/patches/fix-addNghttp2IncludesPathCMake.patch b/recipes/libnghttp2/all/patches/fix-addNghttp2IncludesPathCMake.patch deleted file mode 100644 index f3458ec8b39b9..0000000000000 --- a/recipes/libnghttp2/all/patches/fix-addNghttp2IncludesPathCMake.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- CMakeLists.txt.orig 2019-12-12 20:23:38.855819744 +0100 -+++ CMakeLists.txt 2019-12-12 20:22:54.194563670 +0100 -@@ -449,6 +449,8 @@ - - install(FILES README.rst DESTINATION "${CMAKE_INSTALL_DOCDIR}") - -+include_directories(lib/includes) -+ - add_subdirectory(lib) - #add_subdirectory(lib/includes) - add_subdirectory(third-party) diff --git a/recipes/libnghttp2/all/patches/fix-findJemalloc.cmake b/recipes/libnghttp2/all/patches/fix-findJemalloc.cmake deleted file mode 100644 index f072d3a7f8d5a..0000000000000 --- a/recipes/libnghttp2/all/patches/fix-findJemalloc.cmake +++ /dev/null @@ -1,14 +0,0 @@ ---- cmake/FindJemalloc.cmake -+++ cmake/FindJemalloc.cmake -@@ -10,10 +10,10 @@ - find_path(JEMALLOC_INCLUDE_DIR - NAMES jemalloc/jemalloc.h - HINTS ${PC_JEMALLOC_INCLUDE_DIRS} - ) - find_library(JEMALLOC_LIBRARY -- NAMES jemalloc -+ NAMES jemalloc jemalloc_s jemalloc_pic - HINTS ${PC_JEMALLOC_LIBRARY_DIRS} - ) - - if(JEMALLOC_INCLUDE_DIR) diff --git a/recipes/libnghttp2/all/patches/fix-findLibevent.cmake b/recipes/libnghttp2/all/patches/fix-findLibevent.cmake deleted file mode 100644 index b58cd730c3bff..0000000000000 --- a/recipes/libnghttp2/all/patches/fix-findLibevent.cmake +++ /dev/null @@ -1,11 +0,0 @@ ---- cmake/FindLibevent.cmake -+++ cmake/FindLibevent.cmake -@@ -35,7 +35,7 @@ - ) - - if(LIBEVENT_INCLUDE_DIR) -- set(_version_regex "^#define[ \t]+_EVENT_VERSION[ \t]+\"([^\"]+)\".*") -+ set(_version_regex "^#define[ \t]+EVENT__VERSION[ \t]+\"([^\"]+)\".*") - if(EXISTS "${LIBEVENT_INCLUDE_DIR}/event2/event-config.h") - # Libevent 2.0 - file(STRINGS "${LIBEVENT_INCLUDE_DIR}/event2/event-config.h" diff --git a/recipes/libnghttp2/all/test_package/CMakeLists.txt b/recipes/libnghttp2/all/test_package/CMakeLists.txt index eb7f9cd8b9769..f359e60515137 100644 --- a/recipes/libnghttp2/all/test_package/CMakeLists.txt +++ b/recipes/libnghttp2/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(libnghttp2 REQUIRED CONFIG) diff --git a/recipes/libnghttp2/config.yml b/recipes/libnghttp2/config.yml index 486aa86ed0090..99922e9441daf 100644 --- a/recipes/libnghttp2/config.yml +++ b/recipes/libnghttp2/config.yml @@ -1,23 +1,25 @@ versions: - "1.51.0": + "1.61.0": folder: all - "1.50.0": + "1.60.0": folder: all - "1.49.0": + "1.59.0": folder: all - "1.48.0": + "1.58.0": folder: all - "1.47.0": + "1.57.0": folder: all - "1.46.0": + "1.56.0": folder: all - "1.45.1": + "1.55.1": folder: all - "1.43.0": + "1.55.0": folder: all - "1.42.0": + "1.54.0": folder: all - "1.40.0": + "1.53.0": folder: all - "1.39.2": + "1.51.0": + folder: all + "1.50.0": folder: all diff --git a/recipes/libnice/all/conandata.yml b/recipes/libnice/all/conandata.yml new file mode 100644 index 0000000000000..603d8d4fc1235 --- /dev/null +++ b/recipes/libnice/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + 0.1.21: + url: https://libnice.freedesktop.org/releases/libnice-0.1.21.tar.gz + sha256: 72e73a2acf20f59093e21d5601606e405873503eb35f346fa621de23e99b3b39 diff --git a/recipes/libnice/all/conanfile.py b/recipes/libnice/all/conanfile.py new file mode 100644 index 0000000000000..e35ebe0fd7925 --- /dev/null +++ b/recipes/libnice/all/conanfile.py @@ -0,0 +1,117 @@ +import os +from conan import ConanFile +from conan.tools.meson import Meson, MesonToolchain +from conan.tools.files import copy, get, rmdir, rename, chdir, rm +from conan.tools.layout import basic_layout +from conan.tools.gnu import PkgConfigDeps +from conan.tools.microsoft import is_msvc_static_runtime +from conan.tools.apple import fix_apple_shared_install_name +from conan.errors import ConanInvalidConfiguration + +required_conan_version = ">=1.60.0 <2 || >=2.0.6" + +class LibniceConan(ConanFile): + name = "libnice" + homepage = "https://libnice.freedesktop.org/" + license = ("MPL-1.1", "LGPL-2.1-only") + url = "https://github.com/conan-io/conan-center-index" + description = "a GLib ICE implementation" + topics = ("ice", "stun", "turn") + package_type = "library" + settings = "os", "compiler", "build_type", "arch" + options = { + "shared": [True, False], + "fPIC": [True, False], + "crypto_library": ["openssl", "win32"], + "with_gstreamer": [True, False], + "with_gtk_doc": [True, False], + "with_introspection": [True, False]} + default_options = { + "shared": False, + "fPIC": True, + "with_gstreamer": False, + "with_gtk_doc": False, + "with_introspection": False} + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + self.options.crypto_library = "win32" + else: + self.options.crypto_library = "openssl" + + 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.settings.os != "Windows" and self.options.crypto_library == "win32": + raise ConanInvalidConfiguration( + f"-o {self.ref}:crypto_library=win32 is not supported on non-Windows") + if self.settings.os == "Windows" and self.options.with_gtk_doc: + raise ConanInvalidConfiguration( + f"-o {self.ref}:with_gtk_doc=True is not support on Windows") + if is_msvc_static_runtime(self) and self.dependencies["glib"].options.shared: + raise ConanInvalidConfiguration( + "-o glib/*:shared=True with static runtime is not supported") + + def requirements(self): + self.requires("glib/2.78.1", transitive_headers=True, transitive_libs=True) + if self.options.crypto_library == "openssl": + self.requires("openssl/[>=1.1 <4]") + if self.options.with_gstreamer: + self.requires("gstreamer/1.22.3") + + def build_requirements(self): + self.tool_requires("meson/1.2.3") + self.tool_requires("pkgconf/2.0.3") + self.tool_requires("glib/") # for glib-mkenums + if self.options.with_introspection: + self.tool_requires("gobject-introspection/1.72.0") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = PkgConfigDeps(self) + tc.generate() + tc = MesonToolchain(self) + tc.project_options["gupnp"] = "disabled" + tc.project_options["gstreamer"] = "enabled" if self.options.with_gstreamer else "disabled" + tc.project_options["crypto-library"] = "auto" if self.options.crypto_library == "win32" else str( + self.options.crypto_library) + + tc.project_options["examples"] = "disabled" + tc.project_options["tests"] = "disabled" + tc.project_options["gtk_doc"] = "disabled" if self.options.with_gtk_doc else "disabled" + tc.project_options["introspection"] = "enabled" if self.options.with_introspection else "disabled" + tc.generate() + + def build(self): + meson = Meson(self) + meson.configure() + meson.build() + + def package(self): + copy(self, pattern="COPYING*", dst=os.path.join(self.package_folder, + "licenses"), src=self.source_folder) + meson = Meson(self) + meson.install() + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.pdb", os.path.join(self.package_folder, "lib")) + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + if self.settings.os == "Windows": + if not self.options.shared: + with chdir(self, os.path.join(self.package_folder, "lib")): + rename(self, "libnice.a", "nice.lib") + fix_apple_shared_install_name(self) + + def package_info(self): + self.cpp_info.libs = ["nice"] + if self.settings.os == "Windows": + self.cpp_info.system_libs.append("advapi32") diff --git a/recipes/libnice/all/test_package/CMakeLists.txt b/recipes/libnice/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..d61c442b074a4 --- /dev/null +++ b/recipes/libnice/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(example LANGUAGES C) + +find_package(libnice REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} src/example.c) +target_link_libraries(${PROJECT_NAME} PRIVATE libnice::libnice) diff --git a/recipes/libnice/all/test_package/conanfile.py b/recipes/libnice/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a91756abf0bec --- /dev/null +++ b/recipes/libnice/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 LibniceTestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + 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 can_run(self): + cmd = os.path.join(self.cpp.build.bindirs[0], "example") + self.run(cmd, env="conanrun") diff --git a/recipes/libnice/all/test_package/src/example.c b/recipes/libnice/all/test_package/src/example.c new file mode 100644 index 0000000000000..de04a569af0f5 --- /dev/null +++ b/recipes/libnice/all/test_package/src/example.c @@ -0,0 +1,7 @@ +#include + +int main() +{ + NiceAgent *agent = nice_agent_new(NULL, NICE_COMPATIBILITY_RFC5245); + g_object_unref(agent); +} diff --git a/recipes/libnice/all/test_v1_package/CMakeLists.txt b/recipes/libnice/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/libnice/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/libnice/all/test_v1_package/conanfile.py b/recipes/libnice/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..ecf464197e0a5 --- /dev/null +++ b/recipes/libnice/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +import os +from conans import ConanFile, CMake, tools + + +class LibniceTestConan(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", "example") + self.run(bin_path, run_environment=True) diff --git a/recipes/libnice/config.yml b/recipes/libnice/config.yml new file mode 100644 index 0000000000000..68b088642e3c7 --- /dev/null +++ b/recipes/libnice/config.yml @@ -0,0 +1,3 @@ +versions: + "0.1.21": + folder: all diff --git a/recipes/libnl/all/conandata.yml b/recipes/libnl/all/conandata.yml index edfebcd8dad20..9db76cae21f37 100644 --- a/recipes/libnl/all/conandata.yml +++ b/recipes/libnl/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "3.9.0": + url: "https://github.com/thom311/libnl/releases/download/libnl3_9_0/libnl-3.9.0.tar.gz" + sha256: "aed507004d728a5cf11eab48ca4bf9e6e1874444e33939b9d3dfed25018ee9bb" + "3.8.0": + url: "https://github.com/thom311/libnl/releases/download/libnl3_8_0/libnl-3.8.0.tar.gz" + sha256: "bb726c6d7a08b121978d73ff98425bf313fa26a27a331d465e4f1d7ec5b838c6" + "3.7.0": + url: "https://github.com/thom311/libnl/releases/download/libnl3_7_0/libnl-3.7.0.tar.gz" + sha256: "9fe43ccbeeea72c653bdcf8c93332583135cda46a79507bfd0a483bb57f65939" "3.2.25": - sha256: 8beb7590674957b931de6b7f81c530b85dc7c1ad8fbda015398bc1e8d1ce8ec5 - url: https://www.infradead.org/~tgr/libnl/files/libnl-3.2.25.tar.gz + url: "https://github.com/thom311/libnl/releases/download/libnl3_2_25/libnl-3.2.25.tar.gz" + sha256: "8beb7590674957b931de6b7f81c530b85dc7c1ad8fbda015398bc1e8d1ce8ec5" diff --git a/recipes/libnl/all/conanfile.py b/recipes/libnl/all/conanfile.py index 1bd02b2f42194..a6e8ec2b93bbb 100644 --- a/recipes/libnl/all/conanfile.py +++ b/recipes/libnl/all/conanfile.py @@ -1,85 +1,100 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.tools.files import get, rmdir, copy, rm +from conan.tools.layout import basic_layout +from conan.tools.gnu import AutotoolsToolchain, Autotools +from conan.errors import ConanInvalidConfiguration +from conan.tools.env import VirtualBuildEnv +from conan.tools.scm import Version import os -required_conan_version = ">=1.33.0" - +required_conan_version = ">=1.53.0" class LibNlConan(ConanFile): name = "libnl" description = "A collection of libraries providing APIs to netlink protocol based Linux kernel interfaces." - topics = ("netlink") - url = "https://github.com/conan-io/conan-center-index" - homepage = "https://www.infradead.org/~tgr/libnl/" license = "LGPL-2.1-only" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/thom311/libnl" + topics = ("netlink") settings = "os", "arch", "compiler", "build_type" - options = {"fPIC": [True, False], "shared": [True, False]} - default_options = {"fPIC": True, "shared": False} - build_requires = ( "flex/2.6.4", "bison/3.7.6" ) - - _autotools = None - - @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) + package_type = "library" + options = { + "fPIC": [True, False], + "shared": [True, False], + } + default_options = { + "fPIC": True, + "shared": False, + } 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.settings.os != "Linux": - raise ConanInvalidConfiguration("Libnl is only supported on Linux") - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self) - config_args = [ - "--prefix={}".format(tools.unix_path(self.package_folder)), - ] - if self.options.shared: - config_args.extend(["--enable-shared=yes", "--enable-static=no"]) - else: - config_args.extend(["--enable-shared=no", "--enable-static=yes"]) + raise ConanInvalidConfiguration(f"{self.ref} is only supported on Linux") - self._autotools.configure(configure_dir=self._source_subfolder, args=config_args) - return self._autotools + def build_requirements(self): + self.tool_requires("bison/3.8.2") + self.tool_requires("flex/2.6.4") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + tc = AutotoolsToolchain(self) + tc.generate() 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("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, "share")) - tools.rmdir(os.path.join(self.package_folder, "etc")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - - @property - def _settings_build(self): - return getattr(self, "settings_build", self.settings) + copy(self, "COPYING", src=self.source_folder, dst=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, "share")) + rmdir(self, os.path.join(self.package_folder, "etc")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): self.cpp_info.components["nl"].libs = ["nl-3"] self.cpp_info.components["nl"].includedirs = [os.path.join('include', 'libnl3')] - if self._settings_build.os != "Windows": - self.cpp_info.components["nl"].system_libs = ["pthread", "m"] + self.cpp_info.components["nl"].system_libs = ["pthread", "m"] + self.cpp_info.components["nl"].set_property("pkg_config_name", "libnl-3.0") + self.cpp_info.components["nl-route"].libs = ["nl-route-3"] self.cpp_info.components["nl-route"].requires = ["nl"] + self.cpp_info.components["nl-route"].set_property("pkg_config_name", "libnl-route-3.0") + self.cpp_info.components["nl-genl"].libs = ["nl-genl-3"] self.cpp_info.components["nl-genl"].requires = ["nl"] + self.cpp_info.components["nl-genl"].set_property("pkg_config_name", "libnl-genl-3.0") + self.cpp_info.components["nl-nf"].libs = ["nl-nf-3"] self.cpp_info.components["nl-nf"].requires = ["nl-route"] + self.cpp_info.components["nl-nf"].set_property("pkg_config_name", "libnl-nf-3.0") + self.cpp_info.components["nl-cli"].libs = ["nl-cli-3"] self.cpp_info.components["nl-cli"].requires = ["nl-nf", "nl-genl"] + self.cpp_info.components["nl-cli"].system_libs = ["dl"] + self.cpp_info.components["nl-cli"].set_property("pkg_config_name", "libnl-cli-3.0") + self.cpp_info.components["nl-idiag"].libs = ["nl-idiag-3"] self.cpp_info.components["nl-idiag"].requires = ["nl"] + self.cpp_info.components["nl-idiag"].set_property("pkg_config_name", "libnl-idiag-3.0") + + if Version(self.version) >= "3.3.0": + self.cpp_info.components["nl-xfrm"].libs = ["nl-xfrm-3"] + self.cpp_info.components["nl-xfrm"].requires = ["nl"] + self.cpp_info.components["nl-xfrm"].set_property("pkg_config_name", "libnl-xfrm-3.0") diff --git a/recipes/libnl/all/test_package/CMakeLists.txt b/recipes/libnl/all/test_package/CMakeLists.txt index df9446e8809cf..f6ba7c21f8d96 100644 --- a/recipes/libnl/all/test_package/CMakeLists.txt +++ b/recipes/libnl/all/test_package/CMakeLists.txt @@ -1,8 +1,18 @@ -cmake_minimum_required(VERSION 3.5) -project(netlink_example) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +include(FindPkgConfig) -add_executable(show_links show_links.c) -target_link_libraries(show_links ${CONAN_LIBS}) +find_package(libnl REQUIRED CONFIG) + +find_package(PkgConfig REQUIRED) +pkg_check_modules(libnl-3.0 REQUIRED IMPORTED_TARGET libnl-3.0) +pkg_check_modules(libnl-route-3.0 REQUIRED IMPORTED_TARGET libnl-route-3.0) +pkg_check_modules(libnl-genl-3.0 REQUIRED IMPORTED_TARGET libnl-genl-3.0) +pkg_check_modules(libnl-nf-3.0 REQUIRED IMPORTED_TARGET libnl-nf-3.0) +pkg_check_modules(libnl-cli-3.0 REQUIRED IMPORTED_TARGET libnl-cli-3.0) +pkg_check_modules(libnl-idiag-3.0 REQUIRED IMPORTED_TARGET libnl-idiag-3.0) +pkg_check_modules(libnl-xfrm-3.0 QUIET IMPORTED_TARGET libnl-xfrm-3.0) + +add_executable(${PROJECT_NAME} ${PROJECT_NAME}.c) +target_link_libraries(${PROJECT_NAME} PRIVATE libnl::nl libnl::nl-route libnl::nl-genl libnl::nl-nf libnl::nl-cli libnl::nl-idiag $<$:libnl::nl-xfrm>) diff --git a/recipes/libnl/all/test_package/conanfile.py b/recipes/libnl/all/test_package/conanfile.py index c130487451ae0..813661a00f9e6 100644 --- a/recipes/libnl/all/test_package/conanfile.py +++ b/recipes/libnl/all/test_package/conanfile.py @@ -1,11 +1,23 @@ -import os.path - -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 NetlinkTestConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv", "PkgConfigDeps", "VirtualBuildEnv" + 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/[>=2.2 <3]") def build(self): cmake = CMake(self) @@ -13,6 +25,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join(self.build_folder, "bin", "show_links") - self.run(bin_path, cwd=self.source_folder, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libnl/all/test_package/show_links.c b/recipes/libnl/all/test_package/test_package.c similarity index 100% rename from recipes/libnl/all/test_package/show_links.c rename to recipes/libnl/all/test_package/test_package.c diff --git a/recipes/libnl/config.yml b/recipes/libnl/config.yml index 992cfb9a265e6..4e17fb9e83226 100644 --- a/recipes/libnl/config.yml +++ b/recipes/libnl/config.yml @@ -1,3 +1,9 @@ versions: + 3.9.0: + folder: all + 3.8.0: + folder: all + 3.7.0: + folder: all 3.2.25: folder: all 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/libnop/all/conanfile.py b/recipes/libnop/all/conanfile.py index 88ce3b75bc45e..75343526d3c90 100644 --- a/recipes/libnop/all/conanfile.py +++ b/recipes/libnop/all/conanfile.py @@ -15,11 +15,12 @@ class LibnopConan(ConanFile): "deserializing C++ data types without external code " \ "generators or runtime support libraries." license = "Apache-2.0" - topics = ("libnop", "header-only", "serializer") + topics = ("header-only", "serializer") homepage = "https://github.com/google/libnop" url = "https://github.com/conan-io/conan-center-index" - no_copy_source = True + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" + no_copy_source = True @property def _min_cppstd(self): @@ -29,9 +30,13 @@ def _min_cppstd(self): def _compilers_minimum_version(self): return { "Visual Studio": "15", + "msvc": "191", "gcc": "5", } + def layout(self): + basic_layout(self, src_folder="src") + def package_id(self): self.info.clear() @@ -44,12 +49,8 @@ def validate(self): 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def build(self): pass @@ -59,7 +60,5 @@ def package(self): 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.libdirs = [] - self.cpp_info.resdirs = [] self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/libnop/all/test_package/conanfile.py b/recipes/libnop/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/libnop/all/test_package/conanfile.py +++ b/recipes/libnop/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/libnop/all/test_v1_package/CMakeLists.txt b/recipes/libnop/all/test_v1_package/CMakeLists.txt index a9fc5bd47b8bf..0d20897301b68 100644 --- a/recipes/libnop/all/test_v1_package/CMakeLists.txt +++ b/recipes/libnop/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(libnop REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE libnop::libnop) -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/libnova/all/conanfile.py b/recipes/libnova/all/conanfile.py index fceb0ec7133ab..cd98651eacb6f 100644 --- a/recipes/libnova/all/conanfile.py +++ b/recipes/libnova/all/conanfile.py @@ -1,11 +1,11 @@ from conan import ConanFile from conan.errors import ConanException 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 import requests -required_conan_version = ">=1.46.0" +required_conan_version = ">=1.53.0" class LibnovaConan(ConanFile): @@ -15,10 +15,11 @@ class LibnovaConan(ConanFile): "astrometry and astrodynamics library." ) license = "LGPL-2.0-only" - topics = ("libnova", "celestial-mechanics", "astrometry", "astrodynamics") + topics = ("celestial-mechanics", "astrometry", "astrodynamics") homepage = "https://sourceforge.net/projects/libnova" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -30,8 +31,7 @@ class LibnovaConan(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 +39,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") @@ -69,8 +63,7 @@ def source(self): self._generate_git_tag_archive_sourceforge(self.conan_data["sources"][self.version]["post"]["url"]) # Download archive - get(self, **self.conan_data["sources"][self.version]["archive"], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version]["archive"], strip_root=True) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/libnova/all/test_package/conanfile.py b/recipes/libnova/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/libnova/all/test_package/conanfile.py +++ b/recipes/libnova/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/libnova/all/test_v1_package/CMakeLists.txt b/recipes/libnova/all/test_v1_package/CMakeLists.txt index 171b2322a6708..0d20897301b68 100644 --- a/recipes/libnova/all/test_v1_package/CMakeLists.txt +++ b/recipes/libnova/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(libnova REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE libnova::libnova) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libnpy/all/conandata.yml b/recipes/libnpy/all/conandata.yml new file mode 100644 index 0000000000000..f7c435c55da39 --- /dev/null +++ b/recipes/libnpy/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.0.1": + url: "https://github.com/llohse/libnpy/archive/refs/tags/v1.0.1.tar.gz" + sha256: "43452a4db1e8c1df606c64376ea1e32789124051d7640e7e4e8518ab4f0fba44" diff --git a/recipes/libnpy/all/conanfile.py b/recipes/libnpy/all/conanfile.py new file mode 100644 index 0000000000000..1a453076924de --- /dev/null +++ b/recipes/libnpy/all/conanfile.py @@ -0,0 +1,68 @@ +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 LibNPYConan(ConanFile): + name = "libnpy" + description = "C++ library for reading and writing of numpy's .npy files" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/llohse/libnpy" + topics = ("python", "numpy", "npy", "header-only") + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _min_cppstd(self): + # Author didn't explicitly make it C++11 compatible, but turns out it is, + # maybe this changes in a future version but for now it's set to C++11 + # See https://github.com/llohse/libnpy/issues/35#issuecomment-1727327678 + return 11 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "6", + "clang": "5", + "apple-clang": "10", + "Visual Studio": "15", + "msvc": "191", + } + + 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/libnpy/all/test_package/CMakeLists.txt b/recipes/libnpy/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..d8ff7a7d07435 --- /dev/null +++ b/recipes/libnpy/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(libnpy REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE libnpy::libnpy) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/libnpy/all/test_package/conanfile.py b/recipes/libnpy/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/libnpy/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libnpy/all/test_package/test_package.cpp b/recipes/libnpy/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..896ab340a0523 --- /dev/null +++ b/recipes/libnpy/all/test_package/test_package.cpp @@ -0,0 +1,15 @@ +#include "npy.hpp" +#include +#include + +int main() { + const std::vector data{1, 2, 3, 4, 5, 6}; + + npy::npy_data d; + d.data = data; + d.shape = {2, 3}; + d.fortran_order = false; + + const std::string path{"out.npy"}; + npy::write_npy(path, d); +} diff --git a/recipes/libnpy/config.yml b/recipes/libnpy/config.yml new file mode 100644 index 0000000000000..715e55357a17b --- /dev/null +++ b/recipes/libnpy/config.yml @@ -0,0 +1,3 @@ +versions: + "1.0.1": + folder: all diff --git a/recipes/libnuma/all/conandata.yml b/recipes/libnuma/all/conandata.yml index 0c573279e69f1..a2f4fdcdf22c7 100644 --- a/recipes/libnuma/all/conandata.yml +++ b/recipes/libnuma/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "2.0.19": + url: "https://github.com/numactl/numactl/releases/download/v2.0.19/numactl-2.0.19.tar.gz" + sha256: "f2672a0381cb59196e9c246bf8bcc43d5568bc457700a697f1a1df762b9af884" + "2.0.16": + url: "https://github.com/numactl/numactl/releases/download/v2.0.16/numactl-2.0.16.tar.gz" + sha256: "1b242f893af977a1d31af6ce9d6b8dafdd2d8ec3dc9207f7c2dc0d3446e7c7c8" "2.0.14": url: "https://github.com/numactl/numactl/releases/download/v2.0.14/numactl-2.0.14.tar.gz" sha256: "826bd148c1b6231e1284e42a4db510207747484b112aee25ed6b1078756bcff6" diff --git a/recipes/libnuma/all/conanfile.py b/recipes/libnuma/all/conanfile.py index 3234c3cbc8e68..949eef6d498c5 100644 --- a/recipes/libnuma/all/conanfile.py +++ b/recipes/libnuma/all/conanfile.py @@ -12,10 +12,11 @@ class LibnumaConan(ConanFile): name = "libnuma" description = "NUMA support for Linux." license = "LGPL-2.1-or-later" - topics = ("numa") + topics = ("numa",) homepage = "https://github.com/numactl/numactl" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -39,12 +40,11 @@ def layout(self): basic_layout(self, src_folder="src") def validate(self): - if self.info.settings.os != "Linux": + if self.settings.os != "Linux": raise ConanInvalidConfiguration("libnuma is only supported on Linux") 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 = AutotoolsToolchain(self) diff --git a/recipes/libnuma/config.yml b/recipes/libnuma/config.yml index 819ebd6fb8395..96481d820a1e4 100644 --- a/recipes/libnuma/config.yml +++ b/recipes/libnuma/config.yml @@ -1,3 +1,7 @@ versions: + "2.0.19": + folder: all + "2.0.16": + folder: all "2.0.14": folder: all diff --git a/recipes/liboping/all/conandata.yml b/recipes/liboping/all/conandata.yml index 383d4f884713f..a9da5ce81e695 100644 --- a/recipes/liboping/all/conandata.yml +++ b/recipes/liboping/all/conandata.yml @@ -5,5 +5,3 @@ sources: patches: "1.10.0": - patch_file: "patches/1.10.0-suppress_truncate.patch" - base_path: "source_subfolder" - diff --git a/recipes/liboping/all/conanfile.py b/recipes/liboping/all/conanfile.py index 21125770e672e..811729afcf6e2 100644 --- a/recipes/liboping/all/conanfile.py +++ b/recipes/liboping/all/conanfile.py @@ -1,19 +1,26 @@ -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 is_apple_os, fix_apple_shared_install_name +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 + +required_conan_version = ">=1.47.0" class LibopingConan(ConanFile): name = "liboping" description = "A multi server ping library" - topics = ("oping", "ping", "icmp") + license = ["LGPL-2.1", "GPL-2.0"] url = "https://github.com/conan-io/conan-center-index" homepage = "https://noping.cc" - license = ["LGPL-2.1", "GPL-2.0"] + topics = ("oping", "ping", "icmp", "pre-built") + + package_type = "library" settings = "os", "arch", "compiler", "build_type" - exports_sources = ["patches/**"] options = { "shared": [True, False], "fPIC": [True, False], @@ -23,81 +30,77 @@ class LibopingConan(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) + 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.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + basic_layout(self, src_folder="src") def validate(self): - if self.settings.os == "Windows" and self.settings.compiler == "Visual Studio": + if is_msvc(self): raise ConanInvalidConfiguration("liboping is not supported by Visual Studio") if self.settings.os == "Windows" and self.options.shared: - raise ConanInvalidConfiguration("Liboping could not be built on {} as shared library".format(self.settings.os)) - if self.settings.os == "Macos" and self.settings.arch == "armv8": + raise ConanInvalidConfiguration( + f"Liboping could not be built on {self.settings.os} as shared library" + ) + if is_apple_os(self) and self.settings.arch == "armv8": # Build error - NO Access to a Mac/M1 - please fix when possible - see issue 8634 raise ConanInvalidConfiguration("Liboping cannot be built on a Mac/M1 at this time") 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) - 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)), + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = AutotoolsToolchain(self) + tc.configure_args += [ "--without-ncurses", "--without-perl-bindings", ] - self._autotools.configure(args=args, configure_dir=self._source_subfolder) - return self._autotools - - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + 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(pattern="COPYING", dst="licenses", src=self._source_subfolder) - autotools = self._configure_autotools() + copy(self, "COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + 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")) + rm(self, "*.la", self.package_folder, recursive=True) + 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): - 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.libs = ["oping"] 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") + + # TODO: Legacy, to be removed on Conan 2.0 + 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/liboping/all/test_package/CMakeLists.txt b/recipes/liboping/all/test_package/CMakeLists.txt index 30961cdb0ded2..76c10855ad585 100644 --- a/recipes/liboping/all/test_package/CMakeLists.txt +++ b/recipes/liboping/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ -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(liboping CONFIG REQUIRED) +find_package(liboping REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) target_link_libraries(${PROJECT_NAME} liboping::liboping) diff --git a/recipes/liboping/all/test_package/conanfile.py b/recipes/liboping/all/test_package/conanfile.py index b7bbf79eba926..ef5d7042163ec 100644 --- a/recipes/liboping/all/test_package/conanfile.py +++ b/recipes/liboping/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", "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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/liboping/all/test_v1_package/CMakeLists.txt b/recipes/liboping/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/liboping/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/liboping/all/test_v1_package/conanfile.py b/recipes/liboping/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..b7bbf79eba926 --- /dev/null +++ b/recipes/liboping/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "arch", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if 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/conandata.yml b/recipes/libpcap/all/conandata.yml index c909e32c74890..776adccb0ef4d 100644 --- a/recipes/libpcap/all/conandata.yml +++ b/recipes/libpcap/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.10.4": + url: "https://github.com/the-tcpdump-group/libpcap/archive/libpcap-1.10.4.tar.gz" + sha256: "1783ff39f2a6eb99a7625c7ea471782614c94965ea934b6b22ac6eb38db266bc" "1.10.1": url: "https://github.com/the-tcpdump-group/libpcap/archive/libpcap-1.10.1.tar.gz" sha256: "7b650c9e0ce246aa41ba5463fe8e903efc444c914a3ccb986547350bed077ed6" diff --git a/recipes/libpcap/all/conanfile.py b/recipes/libpcap/all/conanfile.py index b2ff6d95b30ce..9023196f55440 100644 --- a/recipes/libpcap/all/conanfile.py +++ b/recipes/libpcap/all/conanfile.py @@ -5,7 +5,7 @@ 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.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain, PkgConfigDeps from conan.tools.layout import basic_layout from conan.tools.microsoft import is_msvc, is_msvc_static_runtime from conan.tools.scm import Version @@ -23,24 +23,27 @@ class LibPcapConan(ConanFile): description = "libpcap is an API for capturing network traffic" license = "BSD-3-Clause" topics = ("networking", "pcap", "sniffing", "network-traffic") - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], + "enable_dbus": [True, False], + "enable_libnl": [True, False], "enable_libusb": [True, False], + "enable_rdma": [True, False], + "with_snf": [True, False], } default_options = { "shared": False, "fPIC": True, + "enable_dbus": False, + "enable_libnl": False, "enable_libusb": False, + "enable_rdma": False, + "with_snf": False, } - # TODO: Add dbus-glib when available - # TODO: Add libnl-genl when available - # TODO: Add libbluetooth when available - # TODO: Add libibverbs when available - @property def _settings_build(self): return getattr(self, "settings_build", self.settings) @@ -50,6 +53,8 @@ def config_options(self): del self.options.fPIC if self.settings.os != "Linux": del self.options.enable_libusb + del self.options.enable_libnl + del self.options.enable_rdma def configure(self): if self.options.shared: @@ -66,6 +71,13 @@ def layout(self): def requirements(self): if self.options.get_safe("enable_libusb"): self.requires("libusb/1.0.26") + if self.options.get_safe("enable_libnl"): + self.requires("libnl/3.8.0") + if self.options.get_safe("enable_rdma"): + self.requires("rdma-core/52.0") + if self.options.get_safe("enable_dbus"): + self.requires("dbus/1.15.8") + # TODO: Add libbluetooth when available def validate(self): if Version(self.version) < "1.10.0" and self.settings.os == "Macos" and self.options.shared: @@ -77,15 +89,14 @@ def validate(self): raise ConanInvalidConfiguration(f"{self.ref} can not be built static on Windows") def build_requirements(self): - if is_msvc(self, build_context=True): - self.tool_requires("winflexbison/2.5.24") + if self._settings_build.os == "Windows": + self.tool_requires("winflexbison/2.5.25") else: self.tool_requires("bison/3.8.2") self.tool_requires("flex/2.6.4") 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): VirtualBuildEnv(self).generate() @@ -108,22 +119,26 @@ def generate(self): 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-universal", # don't build universal binaries on macOS + "--enable-usb" if self.options.get_safe("enable_libusb") else "--disable-usb", + "--enable-dbus" if self.options.get_safe("enable_dbus") else "--disable-dbus", + "--enable-rdma" if self.options.get_safe("enable_rdma") else "--disable-rdma", + "--with-libnl" if self.options.get_safe("enable_libnl") else "--without-libnl", "--disable-bluetooth", - "--disable-packet-ring", - "--disable-dbus", - "--disable-rdma", + f"--with-snf={yes_no(self.options.get_safe('with_snf'))}", ]) + if Version(self.version) < "1.10": + tc.configure_args.append("--disable-packet-ring") if cross_building(self): - target_os = "linux" if self.settings.os == "Linux" else "null" + target_os = "linux" if self.settings.os in ["Linux", "Android"] 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() + deps = PkgConfigDeps(self) + deps.generate() def build(self): if self.settings.os == "Windows": @@ -172,3 +187,13 @@ def package_info(self): self.cpp_info.libs = [f"pcap{suffix}"] if self.settings.os == "Windows": self.cpp_info.system_libs = ["ws2_32"] + if self.options.get_safe("enable_libusb"): + self.cpp_info.requires.append("libusb::libusb") + if self.options.get_safe("enable_libnl"): + self.cpp_info.requires.append("libnl::nl-genl") + if self.options.get_safe("enable_rdma"): + self.cpp_info.requires.append("rdma-core::libibverbs") + if self.options.get_safe("enable_dbus"): + self.cpp_info.requires.append("dbus::dbus") + if self.options.get_safe("with_snf"): + self.cpp_info.system_libs.append("snf") diff --git a/recipes/libpcap/config.yml b/recipes/libpcap/config.yml index 102e778434a57..704c5ae57304e 100644 --- a/recipes/libpcap/config.yml +++ b/recipes/libpcap/config.yml @@ -1,4 +1,6 @@ versions: + "1.10.4": + folder: all "1.10.1": folder: all "1.10.0": 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/conanfile.py b/recipes/libpciaccess/all/conanfile.py index 8991eccca99f0..a97b5318a1c30 100644 --- a/recipes/libpciaccess/all/conanfile.py +++ b/recipes/libpciaccess/all/conanfile.py @@ -7,7 +7,7 @@ import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class LibPciAccessConan(ConanFile): @@ -18,6 +18,7 @@ class LibPciAccessConan(ConanFile): homepage = "https://gitlab.freedesktop.org/xorg/lib/libpciaccess" license = "MIT", "X11" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -34,15 +35,12 @@ 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): def is_supported(settings): @@ -53,22 +51,19 @@ def is_supported(settings): raise ConanInvalidConfiguration("Unsupported architecture.") def build_requirements(self): - self.tool_requires("libtool/2.4.6") - self.tool_requires("pkgconf/1.7.4") + self.tool_requires("libtool/2.4.7") self.tool_requires("xorg-macros/1.19.3") - - 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/2.0.3") def source(self): - get(self, **self.conan_data["sources"][str(self.version)], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): + ms = VirtualBuildEnv(self) + ms.generate() tc = AutotoolsToolchain(self) tc.generate() - ms = VirtualBuildEnv(self) - ms.generate(scope="build") def build(self): autotools = Autotools(self) diff --git a/recipes/libpciaccess/all/test_package/conanfile.py b/recipes/libpciaccess/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/libpciaccess/all/test_package/conanfile.py +++ b/recipes/libpciaccess/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/libpciaccess/all/test_v1_package/CMakeLists.txt b/recipes/libpciaccess/all/test_v1_package/CMakeLists.txt index e01755e70e68b..0d20897301b68 100644 --- a/recipes/libpciaccess/all/test_v1_package/CMakeLists.txt +++ b/recipes/libpciaccess/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(libpciaccess REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE libpciaccess::libpciaccess) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) 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 index ccfa567e2963b..c6534c2a7319f 100644 --- a/recipes/libpfm4/all/conandata.yml +++ b/recipes/libpfm4/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "4.13.0": + url: "https://versaweb.dl.sourceforge.net/project/perfmon2/libpfm4/libpfm-4.13.0.tar.gz" + sha256: "d18b97764c755528c1051d376e33545d0eb60c6ebf85680436813fa5b04cc3d1" "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 index 89894d3e1796e..563971fb81a95 100644 --- a/recipes/libpfm4/all/conanfile.py +++ b/recipes/libpfm4/all/conanfile.py @@ -1,7 +1,7 @@ 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.tools.files import get, rmdir, copy, replace_in_file, rm from conan.errors import ConanInvalidConfiguration import os @@ -11,11 +11,12 @@ class Libpfm4Conan(ConanFile): 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") + 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} + package_type = "library" def validate(self): # The library doesn't really make much sense without perf_events API @@ -23,28 +24,14 @@ def validate(self): 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 + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): - basic_layout(self) + basic_layout(self, src_folder="src") def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=self.source_folder) @@ -54,16 +41,19 @@ def generate(self): tc.generate() def _patch_sources(self): - if not self.options.shared: + if self.options.get_safe("fPIC"): # 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 _yes_no(self, option): + return "y" if option else "n" + def build(self): self._patch_sources() args = [ 'DBG=', - 'CONFIG_PFMLIB_SHARED={}'.format("y" if self.options.shared else "n"), + f'CONFIG_PFMLIB_SHARED={self._yes_no(self.options.shared)}', f'-C {self.source_folder}' ] autotools = Autotools(self) @@ -71,25 +61,24 @@ def build(self): def package(self): copy(self, "COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) - args = [ + 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=[ 'DBG=', 'LDCONFIG=true', - 'CONFIG_PFMLIB_SHARED={}'.format("y" if self.options.shared else "n"), + f'CONFIG_PFMLIB_SHARED={self._yes_no(self.options.shared)}', 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")) + if self.options.shared: + rm(self, "*.a", os.path.join(self.package_folder, "lib")) def package_info(self): self.cpp_info.libs = ["pfm"] - if self.settings.os in ("Linux", "FreeBSD"): - self.cpp_info.system_libs = ["pthread", "m"] + # This currently only compiles on Linux, so always add the libs + self.cpp_info.system_libs = ["pthread", "m"] + diff --git a/recipes/libpfm4/config.yml b/recipes/libpfm4/config.yml index b06c46e0f08f9..c296be9e946ca 100644 --- a/recipes/libpfm4/config.yml +++ b/recipes/libpfm4/config.yml @@ -1,3 +1,5 @@ versions: + "4.13.0": + folder: all "4.12.0": folder: all diff --git a/recipes/libphonenumber/all/conandata.yml b/recipes/libphonenumber/all/conandata.yml new file mode 100644 index 0000000000000..11c4aae27deb2 --- /dev/null +++ b/recipes/libphonenumber/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "8.13.42": + url: "https://github.com/google/libphonenumber/archive/refs/tags/v8.13.42.tar.gz" + sha256: "7fac3a3c5f37607108ea2ca4c334000a6c29fe1cd6b30db31505cba73ab96c7d" diff --git a/recipes/libphonenumber/all/conanfile.py b/recipes/libphonenumber/all/conanfile.py new file mode 100644 index 0000000000000..9a88f82447a58 --- /dev/null +++ b/recipes/libphonenumber/all/conanfile.py @@ -0,0 +1,184 @@ +import os + +from conan import ConanFile, conan_version +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os +from conan.tools.build import check_min_cppstd, valid_min_cppstd, can_run +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, rm, rmdir, replace_in_file +from conan.tools.gnu import PkgConfigDeps +from conan.tools.scm import Version + +required_conan_version = ">=1.56.0 <2 || >=2.0.6" + + +class LibphonenumberConan(ConanFile): + name = "libphonenumber" + description = "Google's common C++ library for parsing, formatting, and validating international phone numbers" + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/google/libphonenumber" + topics = ("phone-numbers", "phone") + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "build_geocoder": [True, False], + "use_alternate_formats": [True, False], + "use_boost": [True, False], + "use_icu_regexp": [True, False], + "use_lite_metadata": [True, False], + "use_posix_thread": [True, False], + "use_std_mutex": [True, False], + #re2 is not an option, because using it crashes + } + default_options = { + "shared": False, + "fPIC": True, + "build_geocoder": True, + "use_alternate_formats": True, + "use_boost": False, + "use_icu_regexp": True, + "use_lite_metadata": False, + "use_posix_thread": False, + "use_std_mutex": True, + } + options_description = { + "build_geocoder": "Build the offline phone number geocoder", + "use_alternate_formats": "Use alternate formats for the phone number matcher.", + "use_icu_regexp": "Use ICU regexp engine", + "use_lite_metadata": "Generates smaller metadata that doesn't include example numbers", + "use_posix_thread": "Use Posix thread for multi-threading", + "use_std_mutex": "use C++ 2011 std::mutex for multi-threading", + } + + @property + def _min_cppstd(self): + return 11 if Version(self.dependencies["abseil"].ref.version) < "20230125.0" else 14 + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + # TODO: could use pthread4w + del self.options.use_posix_thread + if not can_run(self): + # otherwise fails when trying to build and run generate_geocoding_data + del self.options.build_geocoder + + 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://github.com/google/libphonenumber/blob/v8.13.35/cpp/src/phonenumbers/phonenumberutil.h#L33-L34 + self.requires("abseil/20240116.2", transitive_headers=True) + self.requires("protobuf/5.27.0", transitive_headers=True, transitive_libs=True) + if self.options.use_boost: + # https://github.com/google/libphonenumber/blob/v8.13.35/cpp/src/phonenumbers/base/synchronization/lock_boost.h + self.requires("boost/1.85.0", transitive_headers=True, transitive_libs=True) + if self.options.use_icu_regexp or self.options.get_safe("build_geocoder"): + # https://github.com/google/libphonenumber/blob/v8.13.35/cpp/src/phonenumbers/geocoding/phonenumber_offline_geocoder.h#L23 + self.requires("icu/75.1", transitive_headers=True, transitive_libs=True) + + def validate(self): + if self.settings.os == "Windows": + raise ConanInvalidConfiguration(f"{self.name} not supported in Windows yet, contributions welcome\n" + "https://github.com/google/libphonenumber/blob/master/FAQ.md#what-about-windows") + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + + if not self.options.use_std_mutex and not self.options.use_boost and not self.options.get_safe("use_posix_thread"): + raise ConanInvalidConfiguration("At least one of use_std_mutex, use_boost or use_posix_thread must be enabled") + + if not self.options.use_icu_regexp: + # Fails with 'undefined reference to `vtable for i18n::phonenumbers::ICURegExpFactory'' + raise ConanInvalidConfiguration("use_icu_regexp=False is not supported") + + if conan_version.major == 1: + raise ConanInvalidConfiguration("Conan 1.x is not supported. Contributions are welcome!") + + def build_requirements(self): + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/2.2.0") + self.tool_requires("protobuf/") + + def source(self): + 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["BUILD_STATIC_LIB"] = not self.options.shared + tc.variables["BUILD_GEOCODER"] = self.options.get_safe("build_geocoder", False) + tc.variables["USE_ALTERNATE_FORMATS"] = self.options.use_alternate_formats + tc.variables["USE_BOOST"] = self.options.use_boost + tc.variables["USE_ICU_REGEXP"] = self.options.use_icu_regexp + tc.variables["USE_LITE_METADATA"] = self.options.use_lite_metadata + tc.variables["USE_POSIX_THREAD"] = self.options.get_safe("use_posix_thread", False) + tc.variables["USE_PROTOBUF_LITE"] = self.dependencies["protobuf"].options.lite + tc.variables["USE_RE2"] = False # Hardcoded, attempt to use it crashed + tc.variables["USE_STDMUTEX"] = self.options.use_std_mutex + tc.variables["BUILD_TESTING"] = False + tc.variables["BUILD_TOOLS_ONLY"] = False + tc.variables["REGENERATE_METADATA"] = False # Requires a Java runtime + # Otherwise tries to use , and requires the recipe to export a define accordingly. + # The define can be set based only on a compilation test. + tc.variables["USE_STD_MAP"] = True + if not valid_min_cppstd(self, self._min_cppstd): + tc.variables["CMAKE_CXX_STANDARD"] = self._min_cppstd + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.cache_variables["CMAKE_TRY_COMPILE_CONFIGURATION"] = str(self.settings.build_type) + tc.generate() + deps = CMakeDeps(self) + deps.generate() + deps = PkgConfigDeps(self) + deps.generate() + + def _patch_sources(self): + # (failed) attempt to make it work in windows/msvc, patching some build scripts + # https://github.com/conan-io/conan-center-index/pull/23689/commits/c5e7091d134174fb590218ed066c074f45274a93 + replace_in_file(self, os.path.join(self.source_folder, "cpp", "CMakeLists.txt"), " -Werror", "") + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, "cpp")) + cmake.build() + + def package(self): + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rm(self, "*.pdb", self.package_folder, recursive=True) + + def package_info(self): + if self.options.shared: + self.cpp_info.components["phonenumber"].set_property("cmake_target_aliases", ["libphonenumber::phonenumber-shared"]) + self.cpp_info.components["phonenumber"].libs = ["phonenumber"] + if self.settings.os in ["Linux", "FreeBSD"] and self.options.use_posix_thread: + self.cpp_info.components["phonenumber"].system_libs.append("pthread") + elif is_apple_os(self): + self.cpp_info.components["phonenumber"].frameworks.extend(["CoreFoundation", "Foundation"]) + + requires = ["abseil::absl_node_hash_set", "abseil::absl_strings", "abseil::absl_synchronization"] + if self.dependencies["protobuf"].options.lite: + requires.append("protobuf::libprotobuf-lite") + else: + requires.append("protobuf::libprotobuf") + if self.options.use_boost: + requires.extend(["boost::headers", "boost::thread"]) + if self.options.use_icu_regexp: + requires.extend(["icu::icu-uc", "icu::icu-i18n"]) + self.cpp_info.components["phonenumber"].requires = requires + + if self.options.get_safe("build_geocoder"): + if self.options.shared: + self.cpp_info.components["geocoding"].set_property("cmake_target_aliases", ["libphonenumber::geocoding-shared"]) + self.cpp_info.components["geocoding"].libs.append("geocoding") + self.cpp_info.components["geocoding"].requires = ["abseil::absl_synchronization", "icu::icu-uc"] diff --git a/recipes/libphonenumber/all/test_package/CMakeLists.txt b/recipes/libphonenumber/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..f3619ef8d61cf --- /dev/null +++ b/recipes/libphonenumber/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(libphonenumber REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE libphonenumber::libphonenumber) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/libphonenumber/all/test_package/conanfile.py b/recipes/libphonenumber/all/test_package/conanfile.py new file mode 100644 index 0000000000000..ef5d7042163ec --- /dev/null +++ b/recipes/libphonenumber/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libphonenumber/all/test_package/test_package.cpp b/recipes/libphonenumber/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..7bcbdb54c0b0f --- /dev/null +++ b/recipes/libphonenumber/all/test_package/test_package.cpp @@ -0,0 +1,11 @@ +#include +#include + +int main() { + using namespace i18n::phonenumbers; + PhoneNumber number; + number.set_country_code(1); + number.set_national_number(uint64{650}); + auto util = PhoneNumberUtil::GetInstance(); + util->GetLengthOfGeographicalAreaCode(number); +} diff --git a/recipes/libphonenumber/config.yml b/recipes/libphonenumber/config.yml new file mode 100644 index 0000000000000..2d7b667f12200 --- /dev/null +++ b/recipes/libphonenumber/config.yml @@ -0,0 +1,3 @@ +versions: + "8.13.42": + folder: all diff --git a/recipes/libplist/all/conandata.yml b/recipes/libplist/all/conandata.yml new file mode 100644 index 0000000000000..848c190b77593 --- /dev/null +++ b/recipes/libplist/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "2.6.0": + url: "https://github.com/libimobiledevice/libplist/releases/download/2.6.0/libplist-2.6.0.tar.bz2" + sha256: "67be9ee3169366589c92dc7c22809b90f51911dd9de22520c39c9a64fb047c9c" diff --git a/recipes/libplist/all/conanfile.py b/recipes/libplist/all/conanfile.py new file mode 100644 index 0000000000000..2b02e49b20629 --- /dev/null +++ b/recipes/libplist/all/conanfile.py @@ -0,0 +1,95 @@ +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 VirtualRunEnv +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 = ">=2.1" + +class PackageConan(ConanFile): + name = "libplist" + description = "A small portable C library to handle Apple Property List files in binary, XML, JSON, or OpenStep format." + license = "LGPL-2.1" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/libimobiledevice/libplist" + topics = ("plist", "apple", "property list", "binary", "xml", "json", "openstep") + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + implements = ["auto_shared_fpic"] + languages = ["C", "C++"] + + def layout(self): + basic_layout(self, src_folder="src") + + def validate(self): + if self.settings.compiler == "msvc": + raise ConanInvalidConfiguration("libplist does not support MSVC - use MinGW instead") + + def build_requirements(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): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + if not cross_building(self): + VirtualRunEnv(self).generate(scope="build") + tc = AutotoolsToolchain(self) + + tc.configure_args.extend([ + # No need for python bindings + "--without-cython", + ]) + tc.generate() + + def build(self): + autotools = Autotools(self) + autotools.configure() + autotools.make() + + def package(self): + copy(self, "COPYING.LESSER", 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, "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["plist"].libs = ["plist-2.0"] + self.cpp_info.components["plist"].set_property("pkg_config_name", "plist-2.0") + self.cpp_info.components["plist"].set_property("cmake_target_name", "libplist::libplist") + + self.cpp_info.components["plist++"].libs = ["plist++-2.0"] + self.cpp_info.components["plist++"].requires = ["plist"] + self.cpp_info.components["plist++"].set_property("pkg_config_name", "plist++-2.0") + self.cpp_info.components["plist++"].set_property("cmake_target_name", "libplist::libplist++") + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["plist"].system_libs.extend(["m", "pthread"]) + self.cpp_info.components["plist++"].system_libs.extend(["m", "pthread"]) + + if not self.options.shared: + self.cpp_info.components["plist"].defines.append("LIBPLIST_STATIC") + self.cpp_info.components["plist++"].defines.append("LIBPLIST_STATIC") diff --git a/recipes/libplist/all/test_package/CMakeLists.txt b/recipes/libplist/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..3f75fcc0f5158 --- /dev/null +++ b/recipes/libplist/all/test_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C CXX) + +find_package(libplist REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE libplist::libplist) + +add_executable(${PROJECT_NAME}++ test_package.cpp) +target_link_libraries(${PROJECT_NAME}++ PRIVATE libplist::libplist++) diff --git a/recipes/libplist/all/test_package/conanfile.py b/recipes/libplist/all/test_package/conanfile.py new file mode 100644 index 0000000000000..d36f1e75d8481 --- /dev/null +++ b/recipes/libplist/all/test_package/conanfile.py @@ -0,0 +1,28 @@ +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" + + 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") + + bin_path_cxx = os.path.join(self.cpp.build.bindir, "test_package++") + self.run(bin_path_cxx, env="conanrun") diff --git a/recipes/libplist/all/test_package/test_package.c b/recipes/libplist/all/test_package/test_package.c new file mode 100644 index 0000000000000..0779b29e8d1c4 --- /dev/null +++ b/recipes/libplist/all/test_package/test_package.c @@ -0,0 +1,10 @@ +#include +#include +#include + + +int main(void) { + printf("plist version: %s\n", libplist_version()); + + return EXIT_SUCCESS; +} diff --git a/recipes/libplist/all/test_package/test_package.cpp b/recipes/libplist/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..234f532803d69 --- /dev/null +++ b/recipes/libplist/all/test_package/test_package.cpp @@ -0,0 +1,11 @@ +#include +#include +#include + + +int main(void) { + auto node = new PList::Boolean(true); + printf("node value: %d\n", node->GetValue()); + + return EXIT_SUCCESS; +} diff --git a/recipes/libplist/config.yml b/recipes/libplist/config.yml new file mode 100644 index 0000000000000..fd1c6521f3d05 --- /dev/null +++ b/recipes/libplist/config.yml @@ -0,0 +1,3 @@ +versions: + "2.6.0": + folder: all diff --git a/recipes/libpng/all/conan_cmake_project_include.cmake b/recipes/libpng/all/conan_cmake_project_include.cmake new file mode 100644 index 0000000000000..e70fb28d5bf7d --- /dev/null +++ b/recipes/libpng/all/conan_cmake_project_include.cmake @@ -0,0 +1,7 @@ +# Older versions of libpng's CMakeLists reference the ZLIB_LIBRARy +# varible which was never officially documented. +# This was fixed in which first went into version 1.6.38. +# This can be deleted once the recipe no longer supports versions older than that. +# https://github.com/glennrp/libpng/commit/9f734b13f4ea062af98652c4c7678f667d2d85c7 +find_package(ZLIB CONFIG REQUIRED) +set(ZLIB_LIBRARY "${ZLIB_LIBRARIES}") diff --git a/recipes/libpng/all/conandata.yml b/recipes/libpng/all/conandata.yml index c3684c2f1a2bc..0861bf8b1062b 100644 --- a/recipes/libpng/all/conandata.yml +++ b/recipes/libpng/all/conandata.yml @@ -1,24 +1,31 @@ sources: + "1.6.44": + url: "https://sourceforge.net/projects/libpng/files/libpng16/1.6.44/libpng-1.6.44.tar.xz" + sha256: "60c4da1d5b7f0aa8d158da48e8f8afa9773c1c8baa5d21974df61f1886b8ce8e" + "1.6.43": + url: "https://sourceforge.net/projects/libpng/files/libpng16/1.6.43/libpng-1.6.43.tar.xz" + sha256: "6a5ca0652392a2d7c9db2ae5b40210843c0bbc081cbd410825ab00cc59f14a6c" + "1.6.42": + url: "https://sourceforge.net/projects/libpng/files/libpng16/1.6.42/libpng-1.6.42.tar.xz" + sha256: "c919dbc11f4c03b05aba3f8884d8eb7adfe3572ad228af972bb60057bdb48450" + "1.6.41": + url: "https://sourceforge.net/projects/libpng/files/libpng16/1.6.41/libpng-1.6.41.tar.xz" + sha256: "d6a49a7a4abca7e44f72542030e53319c081fea508daccf4ecc7c6d9958d190f" + "1.6.40": + url: "https://sourceforge.net/projects/libpng/files/libpng16/1.6.40/libpng-1.6.40.tar.xz" + sha256: "535b479b2467ff231a3ec6d92a525906fb8ef27978be4f66dbe05d3f3a01b3a1" "1.6.39": - url: "https://github.com/glennrp/libpng/archive/v1.6.39.tar.gz" - sha256: "a00e9d2f2f664186e4202db9299397f851aea71b36a35e74910b8820e380d441" + url: "https://sourceforge.net/projects/libpng/files/libpng16/1.6.39/libpng-1.6.39.tar.xz" + sha256: "1f4696ce70b4ee5f85f1e1623dc1229b210029fa4b7aee573df3e2ba7b036937" "1.6.38": - url: "https://github.com/glennrp/libpng/archive/v1.6.38.tar.gz" - sha256: "d4160037fa5d09fa7cff555037f2a7f2fefc99ca01e21723b19bfcda33015234" + 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" + url: "https://sourceforge.net/projects/libpng/files/libpng16/1.6.37/libpng-1.6.37.tar.xz" + sha256: "505e70834d35383537b6491e7ae8641f1a4bed1876dbfe361201fc80868d88ca" + "1.6.32": + url: "https://sourceforge.net/projects/libpng/files/libpng16/older-releases/1.6.32/libpng-1.6.32.tar.xz" + sha256: "c918c3113de74a692f0a1526ce881dc26067763eb3915c57ef3a0f7b6886f59b" "1.5.30": - url: "https://github.com/glennrp/libpng/archive/v1.5.30.tar.gz" - sha256: "738e2eb31abc1140f2d6c914f0f69748b49f2ae7ffc05e7a073abafc08f37441" -patches: - "1.6.37": - - 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" + url: "https://sourceforge.net/projects/libpng/files/libpng15/1.5.30/libpng-1.5.30.tar.xz" + sha256: "7d76275fad2ede4b7d87c5fd46e6f488d2a16b5a69dc968ffa840ab39ba756ed" diff --git a/recipes/libpng/all/conanfile.py b/recipes/libpng/all/conanfile.py index 7132f93ea7ab3..d41cc8f49d2bb 100644 --- a/recipes/libpng/all/conanfile.py +++ b/recipes/libpng/all/conanfile.py @@ -1,9 +1,8 @@ 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.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.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir from conan.tools.microsoft import is_msvc from conan.tools.scm import Version import os @@ -38,6 +37,11 @@ class LibpngConan(ConanFile): "api_prefix": "", } + @property + def _is_clang_cl(self): + return self.settings.os == "Windows" and self.settings.compiler == "clang" and \ + self.settings.compiler.get_safe("runtime") + @property def _has_neon_support(self): return "arm" in self.settings.arch @@ -54,8 +58,17 @@ def _has_sse_support(self): def _has_vsx_support(self): return "ppc" in self.settings.arch + @property + def _neon_msa_sse_vsx_mapping(self): + return { + "True": "on", + "False": "off", + "check": "check", + } + def export_sources(self): export_conandata_patches(self) + copy(self, "conan_cmake_project_include.cmake", self.recipe_folder, os.path.join(self.export_sources_folder, "src")) def config_options(self): if self.settings.os == "Windows": @@ -79,45 +92,24 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("zlib/1.2.13") + self.requires("zlib/[>=1.2.11 <2]") def validate(self): - if Version(self.version) < "1.6" and self.info.settings.arch == "armv8" and is_apple_os(self): - raise ConanInvalidConfiguration(f"{self.ref} currently does not building for {self.info.settings.os} {self.info.settings.arch}. Contributions are welcomed") + 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_folder, strip_root=True) - - @property - def _neon_msa_sse_vsx_mapping(self): - return { - "True": "on", - "False": "off", - "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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) 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 cross_building(self): - system_processor = self.conf.get("tools.cmake.cmaketoolchain:system_processor", - self._libpng_cmake_system_processor, check_type=str) - tc.cache_variables["CMAKE_SYSTEM_PROCESSOR"] = system_processor + tc.cache_variables["PNG_TESTS"] = False + tc.cache_variables["PNG_SHARED"] = self.options.shared + tc.cache_variables["PNG_STATIC"] = not self.options.shared + tc.cache_variables["PNG_DEBUG"] = self.settings.build_type == "Debug" + tc.cache_variables["PNG_PREFIX"] = self.options.api_prefix + if Version(self.version) < "1.6.38": + tc.cache_variables["CMAKE_PROJECT_libpng_INCLUDE"] = os.path.join(self.source_folder, "conan_cmake_project_include.cmake") if self._has_neon_support: tc.variables["PNG_ARM_NEON"] = self._neon_msa_sse_vsx_mapping[str(self.options.neon)] if self._has_msa_support: @@ -126,7 +118,10 @@ def generate(self): tc.variables["PNG_INTEL_SSE"] = self._neon_msa_sse_vsx_mapping[str(self.options.sse)] if self._has_vsx_support: tc.variables["PNG_POWERPC_VSX"] = self._neon_msa_sse_vsx_mapping[str(self.options.vsx)] - if Version(self.version) >= "1.6.38": + if Version(self.version) >= "1.6.41": + tc.variables["PNG_FRAMEWORK"] = False # changed from False to True by default in PNG 1.6.41 + tc.variables["PNG_TOOLS"] = False + elif Version(self.version) >= "1.6.38": tc.variables["PNG_EXECUTABLES"] = False tc.cache_variables["CMAKE_MACOSX_BUNDLE"] = False @@ -136,26 +131,6 @@ def generate(self): def _patch_sources(self): apply_conandata_patches(self) - 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() @@ -174,6 +149,7 @@ def package(self): rmdir(self, os.path.join(self.package_folder, "lib", "libpng")) rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "*.cmake", os.path.join(self.package_folder, "lib", "cmake", "PNG")) def package_info(self): major_min_version = f"{Version(self.version).major}{Version(self.version).minor}" @@ -184,8 +160,10 @@ def package_info(self): 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 "" + prefix = "lib" if (is_msvc(self) or self._is_clang_cl) else "" suffix = major_min_version if self.settings.os == "Windows" else "" + if is_msvc(self) or self._is_clang_cl: + suffix += "_static" if not self.options.shared 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"]: 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 deleted file mode 100644 index d78bd326e5e4c..0000000000000 --- a/recipes/libpng/all/patches/0001-1.5.30-cmakefile-zlib.patch +++ /dev/null @@ -1,49 +0,0 @@ -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/0001-1.6.37-cmakefile-zlib.patch b/recipes/libpng/all/patches/0001-1.6.37-cmakefile-zlib.patch deleted file mode 100644 index aaf8fda5cb495..0000000000000 --- a/recipes/libpng/all/patches/0001-1.6.37-cmakefile-zlib.patch +++ /dev/null @@ -1,56 +0,0 @@ ---- CMakeLists.txt 2019-04-14 20:10:32.000000000 +0200 -+++ CMakeLists.txt 2019-07-04 11:25:33.862280292 +0200 -@@ -40,7 +40,7 @@ - - if(NOT PNG_BUILD_ZLIB) - find_package(ZLIB REQUIRED) -- include_directories(${ZLIB_INCLUDE_DIR}) -+ include_directories(${ZLIB_INCLUDE_DIRS}) - endif() - - if(UNIX AND NOT APPLE AND NOT BEOS AND NOT HAIKU) -@@ -522,7 +522,7 @@ - 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) - -@@ -536,7 +536,7 @@ - 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) -@@ -571,7 +571,7 @@ - # 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) -@@ -588,7 +588,7 @@ - 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) -@@ -753,7 +753,7 @@ - set(PNG_BIN_TARGETS pngfix) - - add_executable(png-fix-itxt ${png_fix_itxt_sources}) -- target_link_libraries(png-fix-itxt ${ZLIB_LIBRARY} ${M_LIBRARY}) -+ target_link_libraries(png-fix-itxt ${ZLIB_LIBRARIES} ${M_LIBRARY}) - list(APPEND PNG_BIN_TARGETS png-fix-itxt) - endif() - diff --git a/recipes/libpng/all/test_package/CMakeLists.txt b/recipes/libpng/all/test_package/CMakeLists.txt index 59e144e90a535..171081056d70e 100644 --- a/recipes/libpng/all/test_package/CMakeLists.txt +++ b/recipes/libpng/all/test_package/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package LANGUAGES C) find_package(PNG REQUIRED) diff --git a/recipes/libpng/config.yml b/recipes/libpng/config.yml index feabbd00c1919..72e85034a3407 100644 --- a/recipes/libpng/config.yml +++ b/recipes/libpng/config.yml @@ -1,9 +1,21 @@ versions: + "1.6.44": + folder: all + "1.6.43": + folder: all + "1.6.42": + folder: all + "1.6.41": + folder: all + "1.6.40": + folder: all "1.6.39": folder: all "1.6.38": folder: all "1.6.37": folder: all + "1.6.32": + folder: all "1.5.30": folder: all diff --git a/recipes/libpointmatcher/all/conandata.yml b/recipes/libpointmatcher/all/conandata.yml new file mode 100644 index 0000000000000..90e42a2d1fa6b --- /dev/null +++ b/recipes/libpointmatcher/all/conandata.yml @@ -0,0 +1,13 @@ +sources: + "1.4.3": + url: "https://github.com/ethz-asl/libpointmatcher/archive/refs/tags/1.4.3.tar.gz" + sha256: "7f8f56d4e561206fb5720ece6fecf6d27e9fd214d4dd326d228fddbea8289cda" +patches: + "1.4.3": + - patch_file: "patches/1.4.3-0001-fix-cmake.patch" + patch_description: "Fix upstream CMakeLists" + patch_type: "conan" + - patch_file: "patches/1.4.3-0002-fix-const-error.patch" + patch_description: "Fix ScalarType const_cast compile error" + patch_type: "bugfix" + patch_source: "https://github.com/norlab-ulaval/libpointmatcher/pull/580" diff --git a/recipes/libpointmatcher/all/conanfile.py b/recipes/libpointmatcher/all/conanfile.py new file mode 100644 index 0000000000000..a55b2ee1013f1 --- /dev/null +++ b/recipes/libpointmatcher/all/conanfile.py @@ -0,0 +1,126 @@ +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, 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 + +required_conan_version = ">=1.53.0" + + +class LibpointmatcherConan(ConanFile): + name = "libpointmatcher" + description = ( + "An Iterative Closest Point (ICP) library for 2D and 3D mapping in Robotics" + ) + license = "BSD-3-Clause" + topics = ("robotics", "lidar", "point-cloud") + homepage = "https://github.com/ethz-asl/libpointmatcher" + 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_openmp": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_openmp": False, + } + short_paths = True + + @property + def _min_cppstd(self): + return "17" + + @property + def _compilers_minimum_version(self): + # https://github.com/norlab-ulaval/libpointmatcher/blob/1.4.3/CMakeLists.txt#L240 + return { + "gcc": "9", + "clang": "5", + "apple-clang": "7", + "msvc": "190", + "Visual Studio": "14", + } + + 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 is_msvc(self): + # Only static for msvc + del self.options.shared + self.package_type = "static-library" + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires("boost/1.81.0", transitive_headers=True) + self.requires("eigen/3.4.0", transitive_headers=True) + self.requires("libnabo/1.0.7") + self.requires("yaml-cpp/0.7.0", transitive_headers=True) + + 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.cache_variables["USE_OPEN_MP"] = self.options.with_openmp + tc.cache_variables["USE_OPEN_CL"] = False + tc.cache_variables["SHARED_LIBS"] = self.options.get_safe("shared") + tc.cache_variables["BUILD_EXAMPLES"] = False + tc.cache_variables["BUILD_EVALUATIONS"] = False + tc.cache_variables["BUILD_TESTS"] = False + if not self.settings.compiler.cppstd: + tc.variables["CMAKE_CXX_STANDARD"] = self._min_cppstd + 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, + "copyright", + src=os.path.join(self.source_folder, "debian"), + 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", "libpointmatcher") + self.cpp_info.set_property("pkg_config_name", "libpointmatcher") + sufix = "d" if self.settings.build_type == "Debug" else "" + self.cpp_info.libs = [f"pointmatcher{sufix}"] + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs = ["pthread", "m", "rt"] diff --git a/recipes/libpointmatcher/all/patches/1.4.3-0001-fix-cmake.patch b/recipes/libpointmatcher/all/patches/1.4.3-0001-fix-cmake.patch new file mode 100644 index 0000000000000..50590958948df --- /dev/null +++ b/recipes/libpointmatcher/all/patches/1.4.3-0001-fix-cmake.patch @@ -0,0 +1,109 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 0acebe3..b17f3d5 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,4 +1,4 @@ +-cmake_minimum_required(VERSION 3.10.2) ++cmake_minimum_required(VERSION 3.15) + + include(GNUInstallDirs) # populate CMAKE_INSTALL_{LIB,BIN}DIR + include(CheckSymbolExists) +@@ -9,8 +9,6 @@ include(CMakePackageConfigHelpers) + # Project details / setup + #======================== + +-set(CMAKE_POSITION_INDEPENDENT_CODE ON) # add -fPIC as required +- + # Extract version from header, done first to satisfy CMP0048, + # see `cmake --help-policy CMP0048` for more information. + file( +@@ -51,6 +49,7 @@ if( BUILD_32 ) + endif() + + # Ensure proper build type ++if(0) + if (NOT CMAKE_BUILD_TYPE) + message("-- No build type specified; defaulting to CMAKE_BUILD_TYPE=Release.") + set(CMAKE_BUILD_TYPE Release CACHE STRING +@@ -64,6 +63,7 @@ else () + message("\n=================================================================================") + endif () + endif () ++endif() + + + #================= extra building definitions ============================== +@@ -110,9 +110,6 @@ endforeach() + # initially + set(EXTERNAL_LIBS "") + +-# compile local version of gtest +-add_subdirectory(contrib) +- + #--------------------------- + # DEPENDENCY: POSIX Threads + #--------------------------- +@@ -134,22 +131,10 @@ endif () + #-------------------- + # DEPENDENCY: eigen 3 + #-------------------- +-find_path(EIGEN_INCLUDE_DIR NAMES signature_of_eigen3_matrix_library +- HINTS ENV EIGEN3_INC_DIR +- ENV EIGEN3_DIR +- PATHS Eigen/Core +- /usr/local/include +- /usr/include +- PATH_SUFFIXES include eigen3 eigen +- DOC "Directory containing the Eigen3 header files" +-) + + # Suppress Eigen's warning by adding it to the system's library +-include_directories(SYSTEM "${EIGEN_INCLUDE_DIR}") +- +-#TODO: this should be a more standard way +-#find_package(Eigen3 REQUIRED) +-#message("-- eigen3 , version ${EIGEN_VERSION}") ++find_package(Eigen3 REQUIRED) ++set(EXTERNAL_LIBS ${EXTERNAL_LIBS} Eigen3::Eigen ) + + + +@@ -158,7 +143,7 @@ include_directories(SYSTEM "${EIGEN_INCLUDE_DIR}") + #-------------------- + if (NOT TARGET nabo) + # Find libnabo: +- find_package(libnabo REQUIRED PATHS ${LIBNABO_INSTALL_DIR}) ++ find_package(libnabo REQUIRED PATHS) + if (TARGET libnabo::nabo) + set(libnabo_LIBRARIES libnabo::nabo) + message(STATUS "libnabo found, version ${libnabo_VERSION} (Config mode, libs=${libnabo_LIBRARIES})") +@@ -238,6 +223,7 @@ check_symbol_exists(_POSIX_TIMERS "unistd.h;time.h" POSIX_TIMERS) + #========================== libpointmatcher itself ============================== + + # Check the compiler version as we need full C++17 support. ++if(0) + if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + # using Clang + if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5") +@@ -273,6 +259,7 @@ if (CMAKE_VERSION VERSION_LESS "3.8") + else () + set (CMAKE_CXX_STANDARD 17) + endif () ++endif () + + # SOURCE + +@@ -483,7 +470,7 @@ endif() + # include_directories(${libpointmatcher_INCLUDE_DIRS}) + # target_link_libraries(executableName ${libpointmatcher_LIBRARIES}) + # ... +- ++if(0) + # 1- local build # + + # Install cmake config module +@@ -574,3 +561,4 @@ if (NOT TARGET uninstall) + add_custom_target(uninstall + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) + endif() ++endif() diff --git a/recipes/libpointmatcher/all/patches/1.4.3-0002-fix-const-error.patch b/recipes/libpointmatcher/all/patches/1.4.3-0002-fix-const-error.patch new file mode 100644 index 0000000000000..1dd09a84875d2 --- /dev/null +++ b/recipes/libpointmatcher/all/patches/1.4.3-0002-fix-const-error.patch @@ -0,0 +1,13 @@ +diff --git a/pointmatcher/PointCloudGenerator.cpp b/pointmatcher/PointCloudGenerator.cpp +index d084dd2..739995b 100644 +--- a/pointmatcher/PointCloudGenerator.cpp ++++ b/pointmatcher/PointCloudGenerator.cpp +@@ -170,7 +170,7 @@ typename PointMatcher::DataPoints PointMatcher::PointCloudGenerator::gener + { + // Sample random values of theta and phi. + const ScalarType phi{ 2.0f * pi * uniformDistribution(randomNumberGenerator) }; +- const ScalarType radiusSample{ radius * sqrt(uniformDistribution(randomNumberGenerator)) }; ++ const ScalarType radiusSample{ static_cast(radius * sqrt(uniformDistribution(randomNumberGenerator))) }; + + // Pre-compute values, such as sine and cosine of phi and theta. + const ScalarType sinPhi{ std::sin(phi) }; diff --git a/recipes/libpointmatcher/all/test_package/CMakeLists.txt b/recipes/libpointmatcher/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..b3a37d353b52c --- /dev/null +++ b/recipes/libpointmatcher/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(libpointmatcher REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE libpointmatcher::libpointmatcher) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/libpointmatcher/all/test_package/conanfile.py b/recipes/libpointmatcher/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0a6bc68712d90 --- /dev/null +++ b/recipes/libpointmatcher/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/libpointmatcher/all/test_package/test_package.cpp b/recipes/libpointmatcher/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..ec1d2ba86285d --- /dev/null +++ b/recipes/libpointmatcher/all/test_package/test_package.cpp @@ -0,0 +1,7 @@ +#include + +int main() +{ + auto rigidTrans = PointMatcher::get().REG(Transformation).create("RigidTransformation"); + return 0; +} diff --git a/recipes/libpointmatcher/all/test_v1_package/CMakeLists.txt b/recipes/libpointmatcher/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libpointmatcher/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libpointmatcher/all/test_v1_package/conanfile.py b/recipes/libpointmatcher/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libpointmatcher/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/libpointmatcher/config.yml b/recipes/libpointmatcher/config.yml new file mode 100644 index 0000000000000..91b545dcd8ee8 --- /dev/null +++ b/recipes/libpointmatcher/config.yml @@ -0,0 +1,3 @@ +versions: + "1.4.3": + folder: all diff --git a/recipes/libpopcnt/all/conandata.yml b/recipes/libpopcnt/all/conandata.yml new file mode 100644 index 0000000000000..b0127ac4b8ec5 --- /dev/null +++ b/recipes/libpopcnt/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "3.1": + url: "https://github.com/kimwalisch/libpopcnt/archive/refs/tags/v3.1.tar.gz" + sha256: "b4ea061f4c2e5385dff0dd032ad5a16c60dc0dd050391283afb463c0d62c19bd" diff --git a/recipes/libpopcnt/all/conanfile.py b/recipes/libpopcnt/all/conanfile.py new file mode 100644 index 0000000000000..5f7a42a3c6d34 --- /dev/null +++ b/recipes/libpopcnt/all/conanfile.py @@ -0,0 +1,44 @@ +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.52.0" + +class LibPopcntConan(ConanFile): + name = "libpopcnt" + description = "Fast C/C++ bit population count library" + license = "BSD-2-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/kimwalisch/libpopcnt" + topics = ("popcnt", "popcount", "neon", "avx2", "avx512", "header-only") + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + 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], 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, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/libpopcnt/all/test_package/CMakeLists.txt b/recipes/libpopcnt/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..999d497c63aec --- /dev/null +++ b/recipes/libpopcnt/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) + +find_package(libpopcnt REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE libpopcnt::libpopcnt) diff --git a/recipes/libpopcnt/all/test_package/conanfile.py b/recipes/libpopcnt/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/libpopcnt/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libpopcnt/all/test_package/test_package.c b/recipes/libpopcnt/all/test_package/test_package.c new file mode 100644 index 0000000000000..6faee9c998607 --- /dev/null +++ b/recipes/libpopcnt/all/test_package/test_package.c @@ -0,0 +1,10 @@ +#include +#include +#include + +int main() { + const char data = 0xff; + uint64_t bits = popcnt(&data, sizeof(char)); + printf("popcnt(0xff) = %" PRIu64 " (expected 8) - Test package successful \n", bits); + return 0; +} diff --git a/recipes/libpopcnt/config.yml b/recipes/libpopcnt/config.yml new file mode 100644 index 0000000000000..992d10eb37c11 --- /dev/null +++ b/recipes/libpopcnt/config.yml @@ -0,0 +1,3 @@ +versions: + "3.1": + folder: all diff --git a/recipes/libpq/all/conandata.yml b/recipes/libpq/all/conandata.yml index aee7eccdfda63..0850907d22d64 100644 --- a/recipes/libpq/all/conandata.yml +++ b/recipes/libpq/all/conandata.yml @@ -1,26 +1,39 @@ 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" - "12.10": - url: "https://ftp.postgresql.org/pub/source/v12.10/postgresql-12.10.tar.gz" - sha256: "987e008699d52d5de4bae0580416f6c75aa28016b11543c42f5fbde5efbdfb56" - "11.15": - url: "https://ftp.postgresql.org/pub/source/v11.15/postgresql-11.15.tar.gz" - sha256: "5f6ef2add1acb93d69012a55c3f276b91f4f0c91aa9a91243d9c5737ed5b5541" - "10.20": - url: "https://ftp.postgresql.org/pub/source/v10.20/postgresql-10.20.tar.gz" - sha256: "403bdad47101f7c0a15824627dd0fa0ad4abf1fa26d2bde77dea8921da25a48e" - "9.6.24": - url: "https://ftp.postgresql.org/pub/source/v9.6.24/postgresql-9.6.24.tar.gz" - sha256: "52947ecc119846eace5164399d173576c0d4a47ec116ae58a46a8fd0c576c7c3" + "15.5": + url: "https://ftp.postgresql.org/pub/source/v15.5/postgresql-15.5.tar.bz2" + sha256: "8f53aa95d78eb8e82536ea46b68187793b42bba3b4f65aa342f540b23c9b10a6" + "15.4": + url: "https://ftp.postgresql.org/pub/source/v15.4/postgresql-15.4.tar.bz2" + sha256: "baec5a4bdc4437336653b6cb5d9ed89be5bd5c0c58b94e0becee0a999e63c8f9" + "15.3": + url: "https://ftp.postgresql.org/pub/source/v15.3/postgresql-15.3.tar.bz2" + sha256: "ffc7d4891f00ffbf5c3f4eab7fbbced8460b8c0ee63c5a5167133b9e6599d932" + "14.9": + url: "https://ftp.postgresql.org/pub/source/v14.9/postgresql-14.9.tar.bz2" + sha256: "b1fe3ba9b1a7f3a9637dd1656dfdad2889016073fd4d35f13b50143cbbb6a8ef" patches: - "13.3": - - patch_file: "patches/13.3/001-Remove-thread-safety-check.patch" - base_path: "source_subfolder" + "15.5": + - patch_file: "patches/15/001-mingw-build-static-libraries.patch" + patch_description: "port MinGW: Enable building static libraries in MinGW." + patch_type: "portability" + - patch_file: "patches/15.5/0001-Use-BIO_-get-set-_app_data-instead-of-BIO_-get-se.patch" + patch_description: "Fix libpq w/ openssl >=3.2.x" + patch_type: "backport" + "15.4": + - patch_file: "patches/15/001-mingw-build-static-libraries.patch" + patch_description: "port MinGW: Enable building static libraries in MinGW." + patch_type: "portability" + - patch_file: "patches/15/0001-Use-BIO_-get-set-_app_data-instead-of-BIO_-get-se.patch" + patch_description: "Fix libpq w/ openssl >=3.2.x" + patch_type: "backport" + "15.3": + - patch_file: "patches/15/001-mingw-build-static-libraries.patch" + patch_description: "port MinGW: Enable building static libraries in MinGW." + patch_type: "portability" + - patch_file: "patches/15/0001-Use-BIO_-get-set-_app_data-instead-of-BIO_-get-se.patch" + patch_description: "Fix libpq w/ openssl >=3.2.x" + patch_type: "backport" + "14.9": + - patch_file: "patches/14/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..1573938ad29da 100644 --- a/recipes/libpq/all/conanfile.py +++ b/recipes/libpq/all/conanfile.py @@ -1,19 +1,27 @@ -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): name = "libpq" description = "The library used by all the standard PostgreSQL tools." - topics = ("libpq", "postgresql", "database", "db") + topics = ("postgresql", "database", "db") url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.postgresql.org/docs/current/static/libpq.html" license = "PostgreSQL" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -28,16 +36,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 +48,208 @@ 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 <4]") 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", + "") + # When linking to static openssl, it comes with static pthread library too, failing with: + # libpq.so.5.15: U pthread_exit@GLIBC_2.2.5: libpq must not be calling any function which invokes exit + # https://www.postgresql.org/message-id/20210703001639.GB2374652%40rfd.leadboat.com + if Version(self.version) >= "15": + replace_in_file(self, os.path.join(self.source_folder, "src", "interfaces", "libpq", "Makefile"), + "-v __cxa_atexit", + "-v __cxa_atexit -e pthread_exit") + + 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.build_folder)): + autotools.configure() + with chdir(self, os.path.join(self.build_folder, "src", "backend")): + autotools.make(target="generated-headers") + with chdir(self, os.path.join(self.build_folder, "src", "common")): + autotools.make() + with chdir(self, os.path.join(self.build_folder, "src", "include")): + autotools.make() + with chdir(self, os.path.join(self.build_folder, "src", "interfaces", "libpq")): + autotools.make() + if Version(self.version) >= 12: + with chdir(self, os.path.join(self.build_folder, "src", "port")): + autotools.make() + with chdir(self, os.path.join(self.build_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.build_folder, "src", "common")): + autotools.install() + with chdir(self, os.path.join(self.build_folder, "src", "include")): + autotools.install() + with chdir(self, os.path.join(self.build_folder, "src", "interfaces", "libpq")): + autotools.install() + if Version(self.version) >= 12: + with chdir(self, os.path.join(self.build_folder, "src", "port")): + autotools.install() + with chdir(self, os.path.join(self.build_folder, "src", "bin", "pg_config")): + autotools.install() + copy(self, "*.h", src=os.path.join(self.source_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.source_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 +257,32 @@ 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: - self.cpp_info.components["pgcommon"].libs = ["libpgcommon"] - self.cpp_info.components["pgport"].libs = ["libpgport"] - self.cpp_info.components["pq"].requires.extend(["pgport", "pgcommon"]) + if is_msvc(self): + self.cpp_info.components["pgport"].libs = ["libpgport"] + self.cpp_info.components["pq"].requires.append("pgport") + self.cpp_info.components["pgcommon"].libs = ["libpgcommon"] + 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["pgport"].libs = ["pgport", "pgport_shlib"] - self.cpp_info.components["pq"].requires.extend(["pgport", "pgcommon"]) + self.cpp_info.components["pgcommon"].libs = ["pgcommon"] + self.cpp_info.components["pq"].requires.append("pgcommon") + self.cpp_info.components["pgcommon"].libs.append("pgcommon_shlib") + self.cpp_info.components["pgport"].libs = ["pgport", "pgport_shlib"] + 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/13.3/001-Remove-thread-safety-check.patch b/recipes/libpq/all/patches/13.3/001-Remove-thread-safety-check.patch deleted file mode 100644 index c650bf767f6d5..0000000000000 --- a/recipes/libpq/all/patches/13.3/001-Remove-thread-safety-check.patch +++ /dev/null @@ -1,65 +0,0 @@ -diff --git a/configure b/configure -index cbbaf77..f723154 100755 ---- a/configure -+++ b/configure -@@ -18836,60 +18836,6 @@ fi - fi - fi - --# Thread testing -- --# We have to run the thread test near the end so we have all our symbols --# defined. Cross compiling throws a warning. --# --if test "$enable_thread_safety" = yes; then --if test "$PORTNAME" != "win32" --then --{ $as_echo "$as_me:${as_lineno-$LINENO}: checking thread safety of required library functions" >&5 --$as_echo_n "checking thread safety of required library functions... " >&6; } -- --_CFLAGS="$CFLAGS" --_LIBS="$LIBS" --CFLAGS="$CFLAGS $PTHREAD_CFLAGS -DIN_CONFIGURE" --LIBS="$LIBS $PTHREAD_LIBS" --if test "$cross_compiling" = yes; then : -- { $as_echo "$as_me:${as_lineno-$LINENO}: result: maybe" >&5 --$as_echo "maybe" >&6; } -- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: --*** Skipping thread test program because of cross-compile build. --*** Run the program in src/test/thread on the target machine. --" >&5 --$as_echo "$as_me: WARNING: --*** Skipping thread test program because of cross-compile build. --*** Run the program in src/test/thread on the target machine. --" >&2;} --else -- cat confdefs.h - <<_ACEOF >conftest.$ac_ext --/* end confdefs.h. */ --#include "$srcdir/src/test/thread/thread_test.c" --_ACEOF --if ac_fn_c_try_run "$LINENO"; then : -- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 --$as_echo "yes" >&6; } --else -- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 --$as_echo "no" >&6; } -- as_fn_error $? "thread test program failed --This platform is not thread-safe. Check the file 'config.log' or compile --and run src/test/thread/thread_test for the exact reason. --Use --disable-thread-safety to disable thread safety." "$LINENO" 5 --fi --rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ -- conftest.$ac_objext conftest.beam conftest.$ac_ext --fi -- --CFLAGS="$_CFLAGS" --LIBS="$_LIBS" --else --{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** skipping thread test on Win32" >&5 --$as_echo "$as_me: WARNING: *** skipping thread test on Win32" >&2;} --fi --fi -- - # If compiler will take -Wl,--as-needed (or various platform-specific - # spellings thereof) then add that to LDFLAGS. This is much easier than - # trying to filter LIBS to the minimum for each executable. diff --git a/recipes/libpq/all/patches/14/002-mingw-build-static-libraries.patch b/recipes/libpq/all/patches/14/002-mingw-build-static-libraries.patch new file mode 100644 index 0000000000000..ce58850706373 --- /dev/null +++ b/recipes/libpq/all/patches/14/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/15.5/0001-Use-BIO_-get-set-_app_data-instead-of-BIO_-get-se.patch b/recipes/libpq/all/patches/15.5/0001-Use-BIO_-get-set-_app_data-instead-of-BIO_-get-se.patch new file mode 100644 index 0000000000000..03514f3a2bc18 --- /dev/null +++ b/recipes/libpq/all/patches/15.5/0001-Use-BIO_-get-set-_app_data-instead-of-BIO_-get-se.patch @@ -0,0 +1,193 @@ +From 672103a67aaf0dae5be6c5adcc5ce19e5b6d7676 Mon Sep 17 00:00:00 2001 +From: Tristan Partin +Date: Mon, 27 Nov 2023 11:49:52 -0600 +Subject: [PATCH v1] Use BIO_{get,set}_app_data() instead of + BIO_{get,set}_data() + +Compiling Postgres against OpenSSL 3.2 exposed a regression: + +$ psql "postgresql://$DB?sslmode=require" +psql: error: connection to server at "redacted" (redacted), port 5432 failed: ERROR: Parameter 'user' is missing in startup packet. +double free or corruption (out) +Aborted (core dumped) + +Analyzing the backtrace, openssl was overwriting heap-allocated data in +our PGconn struct because it thought BIO::ptr was a struct bss_sock_st +*. OpenSSL then called a memset() on a member of that struct, and we +zeroed out data in our PGconn struct. + +BIO_get_data(3) says the following: + +> These functions are mainly useful when implementing a custom BIO. +> +> The BIO_set_data() function associates the custom data pointed to by ptr +> with the BIO a. This data can subsequently be retrieved via a call to +> BIO_get_data(). This can be used by custom BIOs for storing +> implementation specific information. + +If you take a look at my_BIO_s_socket(), we create a partially custom +BIO, but for the most part are defaulting to the methods defined by +BIO_s_socket(). We need to set application-specific data and not BIO +private data, so that the BIO implementation we rely on, can properly +assert that its private data is what it expects. + +Rebased against libpq15 + +Co-authored-by: Bo Andreson +--- + src/backend/libpq/be-secure-openssl.c | 11 +++-------- + src/include/pg_config.h.in | 3 --- + src/interfaces/libpq/fe-secure-openssl.c | 20 +++----------------- + src/tools/msvc/Solution.pm | 2 -- + 4 files changed, 6 insertions(+), 30 deletions(-) + +diff --git a/configure b/configure +index d83a402ea1..d55440cd6a 100755 +--- a/configure ++++ b/configure +@@ -13239,7 +13239,7 @@ done + # defines OPENSSL_VERSION_NUMBER to claim version 2.0.0, even though it + # doesn't have these OpenSSL 1.1.0 functions. So check for individual + # functions. +- for ac_func in OPENSSL_init_ssl BIO_get_data BIO_meth_new ASN1_STRING_get0_data HMAC_CTX_new HMAC_CTX_free ++ for ac_func in OPENSSL_init_ssl BIO_meth_new ASN1_STRING_get0_data HMAC_CTX_new HMAC_CTX_free + do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` + ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +diff --git a/configure.ac b/configure.ac +index 570daced81..2bc752ca1a 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1347,7 +1347,7 @@ if test "$with_ssl" = openssl ; then + # defines OPENSSL_VERSION_NUMBER to claim version 2.0.0, even though it + # doesn't have these OpenSSL 1.1.0 functions. So check for individual + # functions. +- AC_CHECK_FUNCS([OPENSSL_init_ssl BIO_get_data BIO_meth_new ASN1_STRING_get0_data HMAC_CTX_new HMAC_CTX_free]) ++ AC_CHECK_FUNCS([OPENSSL_init_ssl BIO_meth_new ASN1_STRING_get0_data HMAC_CTX_new HMAC_CTX_free]) + # OpenSSL versions before 1.1.0 required setting callback functions, for + # thread-safety. In 1.1.0, it's no longer required, and CRYPTO_lock() + # function was removed. +diff --git a/src/backend/libpq/be-secure-openssl.c b/src/backend/libpq/be-secure-openssl.c +index f5c5ed210e..aed8a75345 100644 +--- a/src/backend/libpq/be-secure-openssl.c ++++ b/src/backend/libpq/be-secure-openssl.c +@@ -839,11 +839,6 @@ be_tls_write(Port *port, void *ptr, size_t len, int *waitfor) + * to retry; do we need to adopt their logic for that? + */ + +-#ifndef HAVE_BIO_GET_DATA +-#define BIO_get_data(bio) (bio->ptr) +-#define BIO_set_data(bio, data) (bio->ptr = data) +-#endif +- + static BIO_METHOD *my_bio_methods = NULL; + + static int +@@ -853,7 +848,7 @@ my_sock_read(BIO *h, char *buf, int size) + + if (buf != NULL) + { +- res = secure_raw_read(((Port *) BIO_get_data(h)), buf, size); ++ res = secure_raw_read(((Port *) BIO_get_app_data(h)), buf, size); + BIO_clear_retry_flags(h); + if (res <= 0) + { +@@ -873,7 +868,7 @@ my_sock_write(BIO *h, const char *buf, int size) + { + int res = 0; + +- res = secure_raw_write(((Port *) BIO_get_data(h)), buf, size); ++ res = secure_raw_write(((Port *) BIO_get_app_data(h)), buf, size); + BIO_clear_retry_flags(h); + if (res <= 0) + { +@@ -949,7 +944,7 @@ my_SSL_set_fd(Port *port, int fd) + SSLerr(SSL_F_SSL_SET_FD, ERR_R_BUF_LIB); + goto err; + } +- BIO_set_data(bio, port); ++ BIO_set_app_data(bio, port); + + BIO_set_fd(bio, fd, BIO_NOCLOSE); + SSL_set_bio(port->ssl, bio, bio); +diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in +index d09e9f9a1c..768e3d719c 100644 +--- a/src/include/pg_config.h.in ++++ b/src/include/pg_config.h.in +@@ -77,9 +77,6 @@ + /* Define to 1 if you have the `backtrace_symbols' function. */ + #undef HAVE_BACKTRACE_SYMBOLS + +-/* Define to 1 if you have the `BIO_get_data' function. */ +-#undef HAVE_BIO_GET_DATA +- + /* Define to 1 if you have the `BIO_meth_new' function. */ + #undef HAVE_BIO_METH_NEW + +diff --git a/src/interfaces/libpq/fe-secure-openssl.c b/src/interfaces/libpq/fe-secure-openssl.c +index af59ff49f7..8d68d023e9 100644 +--- a/src/interfaces/libpq/fe-secure-openssl.c ++++ b/src/interfaces/libpq/fe-secure-openssl.c +@@ -1800,11 +1800,6 @@ PQsslAttribute(PGconn *conn, const char *attribute_name) + * to retry; do we need to adopt their logic for that? + */ + +-#ifndef HAVE_BIO_GET_DATA +-#define BIO_get_data(bio) (bio->ptr) +-#define BIO_set_data(bio, data) (bio->ptr = data) +-#endif +- + static BIO_METHOD *my_bio_methods; + + static int +@@ -1812,7 +1807,7 @@ my_sock_read(BIO *h, char *buf, int size) + { + int res; + +- res = pqsecure_raw_read((PGconn *) BIO_get_data(h), buf, size); ++ res = pqsecure_raw_read((PGconn *) BIO_get_app_data(h), buf, size); + BIO_clear_retry_flags(h); + if (res < 0) + { +@@ -1842,7 +1837,7 @@ my_sock_write(BIO *h, const char *buf, int size) + { + int res; + +- res = pqsecure_raw_write((PGconn *) BIO_get_data(h), buf, size); ++ res = pqsecure_raw_write((PGconn *) BIO_get_app_data(h), buf, size); + BIO_clear_retry_flags(h); + if (res < 0) + { +@@ -1933,7 +1928,7 @@ my_SSL_set_fd(PGconn *conn, int fd) + SSLerr(SSL_F_SSL_SET_FD, ERR_R_BUF_LIB); + goto err; + } +- BIO_set_data(bio, conn); ++ BIO_set_app_data(bio, conn); + + SSL_set_bio(conn->ssl, bio, bio); + BIO_set_fd(bio, fd, BIO_NOCLOSE); +diff --git a/src/tools/msvc/Solution.pm b/src/tools/msvc/Solution.pm +index 790f03b05e..a53239fa28 100644 +--- a/src/tools/msvc/Solution.pm ++++ b/src/tools/msvc/Solution.pm +@@ -226,7 +226,6 @@ sub GenerateFiles + HAVE_ATOMICS => 1, + HAVE_ATOMIC_H => undef, + HAVE_BACKTRACE_SYMBOLS => undef, +- HAVE_BIO_GET_DATA => undef, + HAVE_BIO_METH_NEW => undef, + HAVE_CLOCK_GETTIME => undef, + HAVE_COMPUTED_GOTO => undef, +@@ -566,7 +565,6 @@ sub GenerateFiles + || ($digit1 >= '1' && $digit2 >= '1' && $digit3 >= '0')) + { + $define{HAVE_ASN1_STRING_GET0_DATA} = 1; +- $define{HAVE_BIO_GET_DATA} = 1; + $define{HAVE_BIO_METH_NEW} = 1; + $define{HAVE_HMAC_CTX_FREE} = 1; + $define{HAVE_HMAC_CTX_NEW} = 1; +-- +Tristan Partin +Neon (https://neon.tech) + diff --git a/recipes/libpq/all/patches/15/0001-Use-BIO_-get-set-_app_data-instead-of-BIO_-get-se.patch b/recipes/libpq/all/patches/15/0001-Use-BIO_-get-set-_app_data-instead-of-BIO_-get-se.patch new file mode 100644 index 0000000000000..31cf4e85b1aa6 --- /dev/null +++ b/recipes/libpq/all/patches/15/0001-Use-BIO_-get-set-_app_data-instead-of-BIO_-get-se.patch @@ -0,0 +1,193 @@ +From 672103a67aaf0dae5be6c5adcc5ce19e5b6d7676 Mon Sep 17 00:00:00 2001 +From: Tristan Partin +Date: Mon, 27 Nov 2023 11:49:52 -0600 +Subject: [PATCH v1] Use BIO_{get,set}_app_data() instead of + BIO_{get,set}_data() + +Compiling Postgres against OpenSSL 3.2 exposed a regression: + +$ psql "postgresql://$DB?sslmode=require" +psql: error: connection to server at "redacted" (redacted), port 5432 failed: ERROR: Parameter 'user' is missing in startup packet. +double free or corruption (out) +Aborted (core dumped) + +Analyzing the backtrace, openssl was overwriting heap-allocated data in +our PGconn struct because it thought BIO::ptr was a struct bss_sock_st +*. OpenSSL then called a memset() on a member of that struct, and we +zeroed out data in our PGconn struct. + +BIO_get_data(3) says the following: + +> These functions are mainly useful when implementing a custom BIO. +> +> The BIO_set_data() function associates the custom data pointed to by ptr +> with the BIO a. This data can subsequently be retrieved via a call to +> BIO_get_data(). This can be used by custom BIOs for storing +> implementation specific information. + +If you take a look at my_BIO_s_socket(), we create a partially custom +BIO, but for the most part are defaulting to the methods defined by +BIO_s_socket(). We need to set application-specific data and not BIO +private data, so that the BIO implementation we rely on, can properly +assert that its private data is what it expects. + +Rebased against libpq15 + +Co-authored-by: Bo Andreson +--- + src/backend/libpq/be-secure-openssl.c | 11 +++-------- + src/include/pg_config.h.in | 3 --- + src/interfaces/libpq/fe-secure-openssl.c | 20 +++----------------- + src/tools/msvc/Solution.pm | 2 -- + 4 files changed, 6 insertions(+), 30 deletions(-) + +diff --git a/configure b/configure +index d733a59..c13ad3d 100755 +--- a/configure ++++ b/configure +@@ -13237,7 +13237,7 @@ done + # defines OPENSSL_VERSION_NUMBER to claim version 2.0.0, even though it + # doesn't have these OpenSSL 1.1.0 functions. So check for individual + # functions. +- for ac_func in OPENSSL_init_ssl BIO_get_data BIO_meth_new ASN1_STRING_get0_data HMAC_CTX_new HMAC_CTX_free ++ for ac_func in OPENSSL_init_ssl BIO_meth_new ASN1_STRING_get0_data HMAC_CTX_new HMAC_CTX_free + do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` + ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +diff --git a/configure.ac b/configure.ac +index 44868ba..77e59a2 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1347,7 +1347,7 @@ if test "$with_ssl" = openssl ; then + # defines OPENSSL_VERSION_NUMBER to claim version 2.0.0, even though it + # doesn't have these OpenSSL 1.1.0 functions. So check for individual + # functions. +- AC_CHECK_FUNCS([OPENSSL_init_ssl BIO_get_data BIO_meth_new ASN1_STRING_get0_data HMAC_CTX_new HMAC_CTX_free]) ++ AC_CHECK_FUNCS([OPENSSL_init_ssl BIO_meth_new ASN1_STRING_get0_data HMAC_CTX_new HMAC_CTX_free]) + # OpenSSL versions before 1.1.0 required setting callback functions, for + # thread-safety. In 1.1.0, it's no longer required, and CRYPTO_lock() + # function was removed. +diff --git a/src/backend/libpq/be-secure-openssl.c b/src/backend/libpq/be-secure-openssl.c +index 8f9b81c..9abee50 100644 +--- a/src/backend/libpq/be-secure-openssl.c ++++ b/src/backend/libpq/be-secure-openssl.c +@@ -830,11 +830,6 @@ be_tls_write(Port *port, void *ptr, size_t len, int *waitfor) + * to retry; do we need to adopt their logic for that? + */ + +-#ifndef HAVE_BIO_GET_DATA +-#define BIO_get_data(bio) (bio->ptr) +-#define BIO_set_data(bio, data) (bio->ptr = data) +-#endif +- + static BIO_METHOD *my_bio_methods = NULL; + + static int +@@ -844,7 +839,7 @@ my_sock_read(BIO *h, char *buf, int size) + + if (buf != NULL) + { +- res = secure_raw_read(((Port *) BIO_get_data(h)), buf, size); ++ res = secure_raw_read(((Port *) BIO_get_app_data(h)), buf, size); + BIO_clear_retry_flags(h); + if (res <= 0) + { +@@ -864,7 +859,7 @@ my_sock_write(BIO *h, const char *buf, int size) + { + int res = 0; + +- res = secure_raw_write(((Port *) BIO_get_data(h)), buf, size); ++ res = secure_raw_write(((Port *) BIO_get_app_data(h)), buf, size); + BIO_clear_retry_flags(h); + if (res <= 0) + { +@@ -940,7 +935,7 @@ my_SSL_set_fd(Port *port, int fd) + SSLerr(SSL_F_SSL_SET_FD, ERR_R_BUF_LIB); + goto err; + } +- BIO_set_data(bio, port); ++ BIO_set_app_data(bio, port); + + BIO_set_fd(bio, fd, BIO_NOCLOSE); + SSL_set_bio(port->ssl, bio, bio); +diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in +index d09e9f9..768e3d7 100644 +--- a/src/include/pg_config.h.in ++++ b/src/include/pg_config.h.in +@@ -77,9 +77,6 @@ + /* Define to 1 if you have the `backtrace_symbols' function. */ + #undef HAVE_BACKTRACE_SYMBOLS + +-/* Define to 1 if you have the `BIO_get_data' function. */ +-#undef HAVE_BIO_GET_DATA +- + /* Define to 1 if you have the `BIO_meth_new' function. */ + #undef HAVE_BIO_METH_NEW + +diff --git a/src/interfaces/libpq/fe-secure-openssl.c b/src/interfaces/libpq/fe-secure-openssl.c +index af59ff4..8d68d02 100644 +--- a/src/interfaces/libpq/fe-secure-openssl.c ++++ b/src/interfaces/libpq/fe-secure-openssl.c +@@ -1800,11 +1800,6 @@ PQsslAttribute(PGconn *conn, const char *attribute_name) + * to retry; do we need to adopt their logic for that? + */ + +-#ifndef HAVE_BIO_GET_DATA +-#define BIO_get_data(bio) (bio->ptr) +-#define BIO_set_data(bio, data) (bio->ptr = data) +-#endif +- + static BIO_METHOD *my_bio_methods; + + static int +@@ -1812,7 +1807,7 @@ my_sock_read(BIO *h, char *buf, int size) + { + int res; + +- res = pqsecure_raw_read((PGconn *) BIO_get_data(h), buf, size); ++ res = pqsecure_raw_read((PGconn *) BIO_get_app_data(h), buf, size); + BIO_clear_retry_flags(h); + if (res < 0) + { +@@ -1842,7 +1837,7 @@ my_sock_write(BIO *h, const char *buf, int size) + { + int res; + +- res = pqsecure_raw_write((PGconn *) BIO_get_data(h), buf, size); ++ res = pqsecure_raw_write((PGconn *) BIO_get_app_data(h), buf, size); + BIO_clear_retry_flags(h); + if (res < 0) + { +@@ -1933,7 +1928,7 @@ my_SSL_set_fd(PGconn *conn, int fd) + SSLerr(SSL_F_SSL_SET_FD, ERR_R_BUF_LIB); + goto err; + } +- BIO_set_data(bio, conn); ++ BIO_set_app_data(bio, conn); + + SSL_set_bio(conn->ssl, bio, bio); + BIO_set_fd(bio, fd, BIO_NOCLOSE); +diff --git a/src/tools/msvc/Solution.pm b/src/tools/msvc/Solution.pm +index 790f03b..a53239f 100644 +--- a/src/tools/msvc/Solution.pm ++++ b/src/tools/msvc/Solution.pm +@@ -226,7 +226,6 @@ sub GenerateFiles + HAVE_ATOMICS => 1, + HAVE_ATOMIC_H => undef, + HAVE_BACKTRACE_SYMBOLS => undef, +- HAVE_BIO_GET_DATA => undef, + HAVE_BIO_METH_NEW => undef, + HAVE_CLOCK_GETTIME => undef, + HAVE_COMPUTED_GOTO => undef, +@@ -566,7 +565,6 @@ sub GenerateFiles + || ($digit1 >= '1' && $digit2 >= '1' && $digit3 >= '0')) + { + $define{HAVE_ASN1_STRING_GET0_DATA} = 1; +- $define{HAVE_BIO_GET_DATA} = 1; + $define{HAVE_BIO_METH_NEW} = 1; + $define{HAVE_HMAC_CTX_FREE} = 1; + $define{HAVE_HMAC_CTX_NEW} = 1; +-- +Tristan Partin +Neon (https://neon.tech) + diff --git a/recipes/libpq/all/patches/15/001-mingw-build-static-libraries.patch b/recipes/libpq/all/patches/15/001-mingw-build-static-libraries.patch new file mode 100644 index 0000000000000..8bbd59c7ada00 --- /dev/null +++ b/recipes/libpq/all/patches/15/001-mingw-build-static-libraries.patch @@ -0,0 +1,39 @@ +--- a/src/Makefile.shlib ++++ b/src/Makefile.shlib +@@ -322,7 +322,10 @@ else # PORTNAME == aix + # AIX 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 $@ + + $(shlib): $(OBJS) | $(SHLIB_PREREQS) +@@ -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') + +@@ -457,6 +460,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..b9f4d7ab61bce 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) - +cmake_minimum_required(VERSION 3.15) +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..2f11d9b196ef7 --- /dev/null +++ b/recipes/libpq/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +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 a2b649a937afd..19b1302f9490d 100644 --- a/recipes/libpq/config.yml +++ b/recipes/libpq/config.yml @@ -1,15 +1,9 @@ versions: - "14.5": + "15.5": folder: all - "14.2": + "15.4": folder: all - "13.6": + "15.3": folder: all - "12.10": - folder: all - "11.15": - folder: all - "10.20": - folder: all - "9.6.24": + "14.9": folder: all diff --git a/recipes/libpqxx/all/conandata.yml b/recipes/libpqxx/all/conandata.yml index 2c06aed5e9bb9..50ce1231a555d 100644 --- a/recipes/libpqxx/all/conandata.yml +++ b/recipes/libpqxx/all/conandata.yml @@ -1,22 +1,25 @@ sources: - "7.7.4": - url: "https://github.com/jtv/libpqxx/archive/refs/tags/7.7.4.tar.gz" - sha256: "65b0a06fffd565a19edacedada1dcfa0c1ecd782cead0ee067b19e2464875c36" - "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.9.2": + url: "https://github.com/jtv/libpqxx/archive/refs/tags/7.9.2.tar.gz" + sha256: "e37d5774c39f6c802e32d7f418e88b8e530404fb54758516e884fc0ebdee6da4" + "7.9.1": + url: "https://github.com/jtv/libpqxx/archive/refs/tags/7.9.1.tar.gz" + sha256: "4fafd63009b1d6c2b64b8c184c04ae4d1f7aa99d8585154832d28012bae5b0b6" + "7.9.0": + url: "https://github.com/jtv/libpqxx/archive/refs/tags/7.9.0.tar.gz" + sha256: "a1fafd5f6455f6c66241fca1f35f5cb603251580b99f9a0cf1b5d0a586006f16" + "7.8.1": + url: "https://github.com/jtv/libpqxx/archive/refs/tags/7.8.1.tar.gz" + sha256: "0f4c0762de45a415c9fd7357ce508666fa88b9a4a463f5fb76c235bc80dd6a84" + "7.8.0": + url: "https://github.com/jtv/libpqxx/archive/refs/tags/7.8.0.tar.gz" + sha256: "bc471d8d34588f820f38e19e1cc217f399212eef900416cf12f90fab293628af" + "7.7.5": + url: "https://github.com/jtv/libpqxx/archive/refs/tags/7.7.5.tar.gz" + sha256: "c7dc3e8fa2eee656f2b6a8179d72f15db10e97a80dc4f173f806e615ea990973" "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" @@ -26,50 +29,75 @@ sources: "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": + "7.9.2": - patch_file: "patches/0001-cmake-fix-module.patch" - "7.7.3": + patch_description: "Keep `CMAKE_MODULE_PATH` to be changed by conan." + patch_type: "conan" + "7.9.1": - patch_file: "patches/0001-cmake-fix-module.patch" - "7.7.2": + patch_description: "Keep `CMAKE_MODULE_PATH` to be changed by conan." + patch_type: "conan" + "7.9.0": - patch_file: "patches/0001-cmake-fix-module.patch" - - patch_file: "patches/fix-install-library-symlink-7.7.2.patch" - "7.7.0": + patch_description: "Keep `CMAKE_MODULE_PATH` to be changed by conan." + patch_type: "conan" + "7.8.1": - patch_file: "patches/0001-cmake-fix-module.patch" - - patch_file: "patches/fix-clang-compilation-7.7.0.patch" - "7.6.1": + patch_description: "Keep `CMAKE_MODULE_PATH` to be changed by conan." + patch_type: "conan" + "7.8.0": - patch_file: "patches/0001-cmake-fix-module.patch" - - patch_file: "patches/fix-inline-constexpr-local-variable-problem-7.6.0.patch" - - patch_file: "patches/fix-remove-unlikely-annotation-before-return-7.6.0_to_7.6.1.patch" - "7.6.0": + patch_description: "Keep `CMAKE_MODULE_PATH` to be changed by conan." + patch_type: "conan" + - patch_file: "patches/fix-alternative-operator-error-7.8.0.patch" + patch_source: "https://github.com/jtv/libpqxx/pull/714" + patch_description: "Fix a bug undeclared identifier alternative operator." + patch_type: "bugfix" + "7.7.5": + - patch_file: "patches/0001-cmake-fix-module.patch" + patch_description: "Keep `CMAKE_MODULE_PATH` to be changed by conan." + patch_type: "conan" + "7.6.1": - patch_file: "patches/0001-cmake-fix-module.patch" + patch_description: "Keep `CMAKE_MODULE_PATH` to be changed by conan." + patch_type: "conan" - patch_file: "patches/fix-inline-constexpr-local-variable-problem-7.6.0.patch" + patch_source: "https://github.com/jtv/libpqxx/pull/468" + patch_description: "Fixed a problem that some compilers did not allow `inline constexpr` local variable declarations." + patch_type: "bugfix" - patch_file: "patches/fix-remove-unlikely-annotation-before-return-7.6.0_to_7.6.1.patch" + patch_source: "https://github.com/jtv/libpqxx/pull/476" + patch_description: "fix: Remove `unlikely` annotation before `return`" + patch_type: "bugfix" "7.5.3": - patch_file: "patches/0001-cmake-fix-module.patch" + patch_description: "Keep `CMAKE_MODULE_PATH` to be changed by conan." + patch_type: "conan" "7.4.2": - patch_file: "patches/0001-cmake-fix-module.patch" + patch_description: "Keep `CMAKE_MODULE_PATH` to be changed by conan." + patch_type: "conan" + - patch_file: "patches/stop-using-strnlen-7.4.2.patch" + patch_source: "https://github.com/jtv/libpqxx/commit/df30e186e148acb031244ed0ab1151731d3501a4" + patch_description: "Fix MSVC 2022 compile error: '<': no operator found which takes a right-hand operand of type 'std::_String_view_iterator<_Traits>'" + patch_type: "bugfix" "7.3.2": - patch_file: "patches/0001-cmake-fix-module.patch" + patch_description: "Keep `CMAKE_MODULE_PATH` to be changed by conan." + patch_type: "conan" - 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" - "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" + patch_source: "https://github.com/jtv/libpqxx/pull/406" + patch_description: "Fix a bug that syntax error on Visual Studio 2017" + patch_type: "bugfix" + - patch_file: "patches/stop-using-strnlen-7.3.2.patch" + patch_source: "https://github.com/jtv/libpqxx/commit/df30e186e148acb031244ed0ab1151731d3501a4" + patch_description: "Fix MSVC 2022 compile error: '<': no operator found which takes a right-hand operand of type 'std::_String_view_iterator<_Traits>'" + patch_type: "bugfix" "6.4.8": - patch_file: "patches/0001-cmake-fix-module-6.4.8.patch" + patch_description: "Keep `CMAKE_MODULE_PATH` to be changed by conan." + patch_type: "conan" diff --git a/recipes/libpqxx/all/conanfile.py b/recipes/libpqxx/all/conanfile.py index ef9bfe326bc0a..078a64288a676 100644 --- a/recipes/libpqxx/all/conanfile.py +++ b/recipes/libpqxx/all/conanfile.py @@ -66,7 +66,7 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("libpq/14.5") + self.requires("libpq/15.4") def validate(self): if self.settings.compiler.get_safe("cppstd"): @@ -104,6 +104,12 @@ def generate(self): tc.variables["BUILD_TEST"] = False # Set `-mmacosx-version-min` to enable C++17 standard library support. tc.variables["CMAKE_OSX_DEPLOYMENT_TARGET"] = self._mac_os_minimum_required_version + if Version(self.version) < "7.0": + if self.options.shared: + tc.variables["SKIP_PQXX_STATIC"] = True + else: + tc.variables["SKIP_PQXX_SHARED"] = True + tc.generate() deps = CMakeDeps(self) diff --git a/recipes/libpqxx/all/patches/fix-alternative-operator-error-7.8.0.patch b/recipes/libpqxx/all/patches/fix-alternative-operator-error-7.8.0.patch new file mode 100644 index 0000000000000..9a792a2cc015e --- /dev/null +++ b/recipes/libpqxx/all/patches/fix-alternative-operator-error-7.8.0.patch @@ -0,0 +1,24 @@ +Fix a bug undeclared identifier alternative operator (https://github.com/jtv/libpqxx/pull/714) +diff --git a/include/pqxx/internal/header-pre.hxx b/include/pqxx/internal/header-pre.hxx +index 595a53b4..9d4c60e7 100644 +--- a/include/pqxx/internal/header-pre.hxx ++++ b/include/pqxx/internal/header-pre.hxx +@@ -58,6 +58,18 @@ + // Workarounds & definitions that need to be included even in library's headers + #include "pqxx/config-public-compiler.h" + ++#if defined(_MSC_VER) ++# define PQXX_CPLUSPLUS _MSVC_LANG ++#else ++# define PQXX_CPLUSPLUS __cplusplus ++#endif ++ ++// C++20: No longer needed. ++// Enable ISO-646 alternative operaotr representations: "and" instead of "&&" ++// etc. on older compilers. C++20 removes this header. ++#if PQXX_CPLUSPLUS <= 201703L && __has_include() ++# include ++#endif + + #if defined(PQXX_HAVE_GCC_PURE) + /// Declare function "pure": no side effects, only reads globals and its args. diff --git a/recipes/libpqxx/all/patches/fix-apple-clang-compilation-7.4.0.patch b/recipes/libpqxx/all/patches/fix-apple-clang-compilation-7.4.0.patch deleted file mode 100644 index f09c9055d160c..0000000000000 --- a/recipes/libpqxx/all/patches/fix-apple-clang-compilation-7.4.0.patch +++ /dev/null @@ -1,25 +0,0 @@ -Fix Apple clang compilation 7.4.0 only (https://github.com/jtv/libpqxx/commit/cbd2b35ef5bce8a1fc8bfd1efd804d965976ce23) -diff --git a/include/pqxx/connection.hxx b/include/pqxx/connection.hxx -index b44daa18..21dc1fd3 100644 ---- a/include/pqxx/connection.hxx -+++ b/include/pqxx/connection.hxx -@@ -33,6 +33,7 @@ - #include "pqxx/errorhandler.hxx" - #include "pqxx/except.hxx" - #include "pqxx/prepared_statement.hxx" -+#include "pqxx/separated_list.hxx" - #include "pqxx/strconv.hxx" - #include "pqxx/util.hxx" - #include "pqxx/zview.hxx" -diff --git a/include/pqxx/stream_to.hxx b/include/pqxx/stream_to.hxx -index 96ddbf56..5ed91b23 100644 ---- a/include/pqxx/stream_to.hxx -+++ b/include/pqxx/stream_to.hxx -@@ -16,6 +16,7 @@ - #include "pqxx/compiler-public.hxx" - #include "pqxx/internal/compiler-internal-pre.hxx" - -+#include "pqxx/separated_list.hxx" - #include "pqxx/transaction_base.hxx" - - diff --git a/recipes/libpqxx/all/patches/fix-clang-compilation-7.7.0.patch b/recipes/libpqxx/all/patches/fix-clang-compilation-7.7.0.patch deleted file mode 100644 index ad9d3eeea1da7..0000000000000 --- a/recipes/libpqxx/all/patches/fix-clang-compilation-7.7.0.patch +++ /dev/null @@ -1,25 +0,0 @@ -Fix clang compile error 7.7.0 (https://github.com/jtv/libpqxx/pull/519) -diff --git a/src/strconv.cxx b/src/strconv.cxx -index 36758307..824d0d28 100644 ---- a/src/strconv.cxx -+++ b/src/strconv.cxx -@@ -438,7 +438,8 @@ template - if (pqxx::internal::is_digit(initial)) - { - for (; pqxx::internal::is_digit(data[i]); ++i) -- result = absorb_digit_positive(result, digit_to_number(data[i])); -+ result = absorb_digit_positive( -+ result, pqxx::internal::digit_to_number(data[i])); - } - else if (initial == '-') - { -@@ -452,7 +453,8 @@ template - "Converting string to " + pqxx::type_name + - ", but it contains only a sign."}; - for (; i < std::size(text) and pqxx::internal::is_digit(data[i]); ++i) -- result = absorb_digit_negative(result, digit_to_number(data[i])); -+ result = absorb_digit_negative( -+ result, pqxx::internal::digit_to_number(data[i])); - } - else - { diff --git a/recipes/libpqxx/all/patches/fix-install-library-symlink-7.7.2.patch b/recipes/libpqxx/all/patches/fix-install-library-symlink-7.7.2.patch deleted file mode 100644 index 076ad6cc874e3..0000000000000 --- a/recipes/libpqxx/all/patches/fix-install-library-symlink-7.7.2.patch +++ /dev/null @@ -1,14 +0,0 @@ -Fix install library symlink error 7.7.2 (https://github.com/jtv/libpqxx/pull/552) -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 6eafd7b3..1d697ab7 100644 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -58,7 +58,7 @@ macro(library_target_setup tgt) - VERBATIM - COMMAND_EXPAND_LISTS - ) -- install(FILES $/${library_prefix}${name}${library_suffix} -+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${library_prefix}${name}${library_suffix} - DESTINATION ${CMAKE_INSTALL_LIBDIR} - ) - endif() diff --git a/recipes/libpqxx/all/patches/fix-missing-limits-include.patch b/recipes/libpqxx/all/patches/fix-missing-limits-include.patch deleted file mode 100644 index 7e3e49e4fe91c..0000000000000 --- a/recipes/libpqxx/all/patches/fix-missing-limits-include.patch +++ /dev/null @@ -1,13 +0,0 @@ -Fix the bug that `` is missing in versions less than 7.0.5 (https://github.com/jtv/libpqxx/commit/143e139fafadfb153a5d0c84c429e6ced3ed06fc) -diff --git a/include/pqxx/util.hxx b/include/pqxx/util.hxx -index d91d978e..c589a42c 100644 ---- a/include/pqxx/util.hxx -+++ b/include/pqxx/util.hxx -@@ -17,6 +17,7 @@ - #include - #include - #include -+#include - #include - #include - #include diff --git a/recipes/libpqxx/all/patches/fix-not-declared-dumb_stringstream-7.0.1_to_7.0.5.patch b/recipes/libpqxx/all/patches/fix-not-declared-dumb_stringstream-7.0.1_to_7.0.5.patch deleted file mode 100644 index c32258155f947..0000000000000 --- a/recipes/libpqxx/all/patches/fix-not-declared-dumb_stringstream-7.0.1_to_7.0.5.patch +++ /dev/null @@ -1,21 +0,0 @@ -Fix 'dumb_stringstream' was not declared (https://github.com/jtv/libpqxx/commit/0e81d36f522093d7215b3792f1c62dcd06a34ad1) -diff --git a/src/strconv.cxx b/src/strconv.cxx -index 66276802..390192ac 100644 ---- a/src/strconv.cxx -+++ b/src/strconv.cxx -@@ -587,6 +587,7 @@ template char * - float_traits::into_buf(char *, char *, long double const &); - - -+#if !defined(PQXX_HAVE_CHARCONV_FLOAT) - template - inline std::string to_dumb_stringstream(dumb_stringstream &s, F value) - { -@@ -594,6 +595,7 @@ inline std::string to_dumb_stringstream(dumb_stringstream &s, F value) - s << value; - return s.str(); - } -+#endif - - - /// Floating-point implementations for @c pqxx::to_string(). diff --git a/recipes/libpqxx/all/patches/fix-not-declared-dumb_stringstream-7.0.6_to_7.0.7.patch b/recipes/libpqxx/all/patches/fix-not-declared-dumb_stringstream-7.0.6_to_7.0.7.patch deleted file mode 100644 index e372b90444861..0000000000000 --- a/recipes/libpqxx/all/patches/fix-not-declared-dumb_stringstream-7.0.6_to_7.0.7.patch +++ /dev/null @@ -1,21 +0,0 @@ -Fix 'dumb_stringstream' was not declared (https://github.com/jtv/libpqxx/commit/0e81d36f522093d7215b3792f1c62dcd06a34ad1) -diff --git a/src/strconv.cxx b/src/strconv.cxx -index 72217455..b34bd394 100644 ---- a/src/strconv.cxx -+++ b/src/strconv.cxx -@@ -591,6 +591,7 @@ template char * - float_traits::into_buf(char *, char *, long double const &); - - -+#if !defined(PQXX_HAVE_CHARCONV_FLOAT) - template - inline std::string to_dumb_stringstream(dumb_stringstream &s, F value) - { -@@ -598,6 +599,7 @@ inline std::string to_dumb_stringstream(dumb_stringstream &s, F value) - s << value; - return s.str(); - } -+#endif - - - /// Floating-point implementations for @c pqxx::to_string(). diff --git a/recipes/libpqxx/all/patches/fix-not-declared-dumb_stringstream-7.1.1.patch b/recipes/libpqxx/all/patches/fix-not-declared-dumb_stringstream-7.1.1.patch deleted file mode 100644 index acc981628428c..0000000000000 --- a/recipes/libpqxx/all/patches/fix-not-declared-dumb_stringstream-7.1.1.patch +++ /dev/null @@ -1,21 +0,0 @@ -Fix 'dumb_stringstream' was not declared (https://github.com/jtv/libpqxx/commit/0e81d36f522093d7215b3792f1c62dcd06a34ad1) -diff --git a/src/strconv.cxx b/src/strconv.cxx -index 13b0b9ab..c0b7510d 100644 ---- a/src/strconv.cxx -+++ b/src/strconv.cxx -@@ -591,6 +591,7 @@ template char * - float_traits::into_buf(char *, char *, long double const &); - - -+#if !defined(PQXX_HAVE_CHARCONV_FLOAT) - template - inline std::string to_dumb_stringstream(dumb_stringstream &s, F value) - { -@@ -598,6 +599,7 @@ inline std::string to_dumb_stringstream(dumb_stringstream &s, F value) - s << value; - return s.str(); - } -+#endif - - - /// Floating-point implementations for @c pqxx::to_string(). diff --git a/recipes/libpqxx/all/patches/stop-using-strnlen-7.3.2.patch b/recipes/libpqxx/all/patches/stop-using-strnlen-7.3.2.patch new file mode 100644 index 0000000000000..5602c77e030c6 --- /dev/null +++ b/recipes/libpqxx/all/patches/stop-using-strnlen-7.3.2.patch @@ -0,0 +1,28 @@ +diff --git a/src/strconv.cxx b/src/strconv.cxx +index d82e5c53..ee1628ff 100644 +--- a/src/strconv.cxx ++++ b/src/strconv.cxx +@@ -264,18 +264,18 @@ namespace + template + [[maybe_unused]] inline TYPE from_string_arithmetic(std::string_view in) + { +- char const *begin; ++ char const *here; ++ auto const end{in.data() + std::size(in)}; + + // Skip whitespace. This is not the proper way to do it, but I see no way + // that any of the supported encodings could ever produce a valid character + // whose byte sequence would confuse this code. +- for (begin = in.data(); +- begin < std::end(in) and (*begin == ' ' or *begin == '\t'); ++begin) ++ for (here = in.data(); ++ here < end and (*here == ' ' or *here == '\t'); ++here) + ; + +- auto const end{in.data() + std::size(in)}; + TYPE out; +- auto const res{std::from_chars(begin, end, out)}; ++ auto const res{std::from_chars(here, end, out)}; + if (res.ec == std::errc() and res.ptr == end) + return out; + diff --git a/recipes/libpqxx/all/patches/stop-using-strnlen-7.4.2.patch b/recipes/libpqxx/all/patches/stop-using-strnlen-7.4.2.patch new file mode 100644 index 0000000000000..0c628fb55fdff --- /dev/null +++ b/recipes/libpqxx/all/patches/stop-using-strnlen-7.4.2.patch @@ -0,0 +1,28 @@ +diff --git a/src/strconv.cxx b/src/strconv.cxx +index ea4d3c82..08d645eb 100644 +--- a/src/strconv.cxx ++++ b/src/strconv.cxx +@@ -264,18 +264,18 @@ namespace + template + [[maybe_unused]] inline TYPE from_string_arithmetic(std::string_view in) + { +- char const *begin; ++ char const *here; ++ auto const end{in.data() + std::size(in)}; + + // Skip whitespace. This is not the proper way to do it, but I see no way + // that any of the supported encodings could ever produce a valid character + // whose byte sequence would confuse this code. +- for (begin = in.data(); +- begin < std::end(in) and (*begin == ' ' or *begin == '\t'); ++begin) ++ for (here = in.data(); ++ here < end and (*here == ' ' or *here == '\t'); ++here) + ; + +- auto const end{in.data() + std::size(in)}; + TYPE out; +- auto const res{std::from_chars(begin, end, out)}; ++ auto const res{std::from_chars(here, end, out)}; + if (res.ec == std::errc() and res.ptr == end) + return out; + diff --git a/recipes/libpqxx/config.yml b/recipes/libpqxx/config.yml index 386cd99b2403f..5c0e478232496 100644 --- a/recipes/libpqxx/config.yml +++ b/recipes/libpqxx/config.yml @@ -1,15 +1,17 @@ versions: - "7.7.4": + "7.9.2": folder: all - "7.7.3": + "7.9.1": folder: all - "7.7.2": + "7.9.0": folder: all - "7.7.0": + "7.8.1": folder: all - "7.6.1": + "7.8.0": + folder: all + "7.7.5": folder: all - "7.6.0": + "7.6.1": folder: all "7.5.3": folder: all @@ -17,11 +19,5 @@ versions: folder: all "7.3.2": folder: all - "7.2.1": - folder: all - "7.1.2": - folder: all - "7.0.7": - folder: all "6.4.8": folder: all diff --git a/recipes/libproperties/all/CMakeLists.txt b/recipes/libproperties/all/CMakeLists.txt deleted file mode 100644 index 8b8af47ecdb56..0000000000000 --- a/recipes/libproperties/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() - -add_subdirectory(source_subfolder) diff --git a/recipes/libproperties/all/conandata.yml b/recipes/libproperties/all/conandata.yml index bff2c33335401..19d12f5955d4a 100644 --- a/recipes/libproperties/all/conandata.yml +++ b/recipes/libproperties/all/conandata.yml @@ -5,4 +5,3 @@ sources: patches: "1.1.2": - patch_file: "patches/0001-set-CMAKE_C_STANDARD.patch" - base_path: "source_subfolder" diff --git a/recipes/libproperties/all/conanfile.py b/recipes/libproperties/all/conanfile.py index 5741d7e7fb2c6..a124a4b81218b 100644 --- a/recipes/libproperties/all/conanfile.py +++ b/recipes/libproperties/all/conanfile.py @@ -1,28 +1,36 @@ -from conans import ConanFile, CMake, tools 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 + +required_conan_version = ">=1.53.0" + + class LibpropertiesConan(ConanFile): name = "libproperties" + description = ( + "libproperties is a library to parse the Java .properties files. " + "It was writen in pure C and is fully compatible with the Java .properties file format." + ) license = "Apache-2.0" - homepage = "https://github.com/tinyhubs/libproperties" url = "https://github.com/conan-io/conan-center-index" - description = "libproperties is a library to parse the Java .properties files. It was writen in pure C. And fully compatible with the Java .properties file format." + homepage = "https://github.com/tinyhubs/libproperties" topics = ("properties", "java", "pure-c") - 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", "patches/**" - _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_package_tag(self): - return "{}-{}".format(self.name, self.version) - - @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": @@ -30,36 +38,36 @@ 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]) - source_dir = "{}-{}".format(self.name, self.version) - os.rename(source_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["LIBPROPERTIES_INSTALL"] = True - self._cmake.definitions["LIBPROPERTIES_TEST"] = False - self._cmake.configure() - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["BUILD_SHARED_LIBS"] = self.options.shared + tc.cache_variables["LIBPROPERTIES_INSTALL"] = True + tc.cache_variables["LIBPROPERTIES_TEST"] = 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", 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): if not self.options.shared: diff --git a/recipes/libproperties/all/test_package/CMakeLists.txt b/recipes/libproperties/all/test_package/CMakeLists.txt index 1db6320d425c2..d44b2bb585185 100644 --- a/recipes/libproperties/all/test_package/CMakeLists.txt +++ b/recipes/libproperties/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.15) project(test_package C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(libproperties REQUIRED) +find_package(libproperties REQUIRED CONFIG) add_executable("${PROJECT_NAME}" test_package.c) target_link_libraries("${PROJECT_NAME}" PRIVATE libproperties::libproperties) diff --git a/recipes/libproperties/all/test_package/conanfile.py b/recipes/libproperties/all/test_package/conanfile.py index e55cd6197c257..ef5d7042163ec 100644 --- a/recipes/libproperties/all/test_package/conanfile.py +++ b/recipes/libproperties/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 LibpropertiesTestConan(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,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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libproperties/all/test_package/test_package.c b/recipes/libproperties/all/test_package/test_package.c index f06e9d786d768..69876248ecfa9 100644 --- a/recipes/libproperties/all/test_package/test_package.c +++ b/recipes/libproperties/all/test_package/test_package.c @@ -17,7 +17,7 @@ int check_handler(void* context, char* key, int key_len, char* val, int val_len) } -int main(int argc, char* argv[]) +int main(int argc, char* argv[]) { char str[] = "aaa=bbb"; struct properties_source_string_t source = @@ -27,5 +27,5 @@ int main(int argc, char* argv[]) }; properties_parse(&source, properties_source_string_read, NULL, check_handler); - return 0; + return 0; } diff --git a/recipes/libproperties/all/test_v1_package/CMakeLists.txt b/recipes/libproperties/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/libproperties/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/libproperties/all/test_v1_package/conanfile.py b/recipes/libproperties/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a71089bfc92a --- /dev/null +++ b/recipes/libproperties/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class LibpropertiesTestConan(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/libprotobuf-mutator/all/CMakeLists.txt b/recipes/libprotobuf-mutator/all/CMakeLists.txt index 694038520f556..54f184da6c63a 100644 --- a/recipes/libprotobuf-mutator/all/CMakeLists.txt +++ b/recipes/libprotobuf-mutator/all/CMakeLists.txt @@ -1,13 +1,9 @@ -cmake_minimum_required(VERSION 2.8.11) -project(cmake_wrapper) +cmake_minimum_required(VERSION 3.15) +project(cmake_wrapper CXX) -include(conanbuildinfo.cmake) -conan_basic_setup() +find_package(Protobuf REQUIRED) +find_package(absl CONFIG REQUIRED) -add_subdirectory(source_subfolder) +add_subdirectory(src) -if(MSVC) - # Should be added because of - # https://docs.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-initonceexecuteonce - add_definitions(-D_WIN32_WINNT=0x0600) -endif() +target_link_libraries(protobuf-mutator PUBLIC protobuf::libprotobuf absl::strings) diff --git a/recipes/libprotobuf-mutator/all/conandata.yml b/recipes/libprotobuf-mutator/all/conandata.yml index 813688d3f74a5..1152bb8579584 100644 --- a/recipes/libprotobuf-mutator/all/conandata.yml +++ b/recipes/libprotobuf-mutator/all/conandata.yml @@ -1,4 +1,4 @@ sources: - "cci.20210831": - url: "https://github.com/google/libprotobuf-mutator/archive/ffd86a32874e5c08a143019aad1aaf0907294c9f.zip" - sha256: "14f595863452808483776ce1964209db00cdac79e649b31eb4d4b06ca72912d8" + "1.3": + url: "https://github.com/google/libprotobuf-mutator/archive/refs/tags/v1.3.tar.gz" + sha256: "1ee3473a6b0274494fce599539605bb19305c0efadc62b58d645812132c31baa" diff --git a/recipes/libprotobuf-mutator/all/conanfile.py b/recipes/libprotobuf-mutator/all/conanfile.py index f0419a2397845..b03de6dbf5696 100644 --- a/recipes/libprotobuf-mutator/all/conanfile.py +++ b/recipes/libprotobuf-mutator/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.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 +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +from conan.tools.env import VirtualBuildEnv +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.54.0" class LibProtobufMutatorConan(ConanFile): @@ -13,76 +19,117 @@ class LibProtobufMutatorConan(ConanFile): description = "A library to randomly mutate protobuffers." topics = ("test", "fuzzing", "protobuf") settings = "os", "compiler", "build_type", "arch" - generators = "cmake" - exports_sources = ["CMakeLists.txt"] - - _cmake = None + package_type = "library" + options = { + "shared": [True, False], + "fPIC": [True, False] + } + default_options = { + "shared": False, + "fPIC": True + } @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 14 @property - def _build_subfolder(self): - return "build_subfolder" + def _compilers_minimum_version(self): + return { + "apple-clang": "10", + "clang": "7", + "gcc": "5", + "msvc": "191", + "Visual Studio": "15", + } + + 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.get_safe("shared"): + self.options.rm_safe("fPIC") + if is_msvc(self): + self.options.rm_safe("shared") + self.package_type = "static-library" + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("protobuf/3.17.1") - - def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + # Protobuf headers are required by public src/binary_format.h and + self.requires("protobuf/4.25.3", transitive_headers=True) + # Abseil headers are required by public src/field_instance.h + self.requires("abseil/20240116.2") def validate(self): - if self.settings.compiler != "clang": - raise ConanInvalidConfiguration("Only clang allowed") - if self.settings.compiler.libcxx != "libstdc++11": - raise ConanInvalidConfiguration("Requires either compiler.libcxx=libstdc++11") if self.settings.compiler.cppstd: - tools.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 build_requirements(self): + self.tool_requires("cmake/[>=3.24 <4]") + + def source(self): + 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'), - """include_directories(${PROTOBUF_INCLUDE_DIRS})""", - """include_directories(${protobuf_INCLUDE_DIRS})""") - tools.replace_in_file( - os.path.join(self._source_subfolder, 'CMakeLists.txt'), - """set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/external)""", - """# (disabled by conan) set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/external)""") - tools.replace_in_file( - os.path.join(self._source_subfolder, 'CMakeLists.txt'), - """add_subdirectory(examples EXCLUDE_FROM_ALL)""", - """# (disabled by conan) add_subdirectory(examples EXCLUDE_FROM_ALL)""") - - def _configure_cmake(self): - if self._cmake: - return self._cmake - - self._cmake = CMake(self) - self._cmake.definitions["LIB_PROTO_MUTATOR_TESTING"] = "OFF" - self._cmake.definitions["LIB_PROTO_MUTATOR_DOWNLOAD_PROTOBUF"] = "OFF" - self._cmake.definitions["LIB_PROTO_MUTATOR_WITH_ASAN"] = "OFF" - self._cmake.definitions["LIB_PROTO_MUTATOR_FUZZER_LIBRARIES"] = "" - # todo: check option(LIB_PROTO_MUTATOR_MSVC_STATIC_RUNTIME "Link static runtime libraries" ON) - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + # Preserves Conan as dependency manager + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/external)", + "", + ) + # Fix libprotobuf-mutator.pc installation origin path + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "${CMAKE_BINARY_DIR}/libprotobuf-mutator.pc", + "${CMAKE_CURRENT_BINARY_DIR}/libprotobuf-mutator.pc", + ) + # Do not include examples when running CMake configure to avoid more dependencies + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "add_subdirectory(examples EXCLUDE_FROM_ALL)", + "", + ) + + def generate(self): + tc = VirtualBuildEnv(self) + tc.generate() + tc = CMakeToolchain(self) + tc.variables["LIB_PROTO_MUTATOR_TESTING"] = False + tc.variables["LIB_PROTO_MUTATOR_DOWNLOAD_PROTOBUF"] = False + tc.variables["LIB_PROTO_MUTATOR_WITH_ASAN"] = False + tc.variables["PKG_CONFIG_PATH"] = "share" + if is_msvc(self): + tc.variables["LIB_PROTO_MUTATOR_MSVC_STATIC_RUNTIME"] = is_msvc_static_runtime(self) + tc.generate() + tc = CMakeDeps(self) + tc.generate() 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", 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, "OFF")) - 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", "cmake")) def package_info(self): - self.cpp_info.names["cmake_find_package"] = "libprotobuf-mutator" - self.cpp_info.names["cmake_find_package_multi"] = "libprotobuf-mutator" - - self.cpp_info.libs = ['protobuf-mutator-libfuzzer', 'protobuf-mutator'] - self.cpp_info.includedirs.append(os.path.join("include", "libprotobuf-mutator")) + self.cpp_info.components["mutator"].libs = ["protobuf-mutator"] + self.cpp_info.components["mutator"].set_property("cmake_target_name", "libprotobuf-mutator::protobuf-mutator") + self.cpp_info.components["mutator"].includedirs.append("include/libprotobuf-mutator") + self.cpp_info.components["mutator"].requires = ["protobuf::libprotobuf", "abseil::absl_strings"] + + self.cpp_info.components["fuzzer"].libs = ['protobuf-mutator-libfuzzer'] + self.cpp_info.components["fuzzer"].set_property("cmake_target_name", "libprotobuf-mutator::protobuf-mutator-libfuzzer") + self.cpp_info.components["fuzzer"].includedirs.append("include/libprotobuf-mutator") + self.cpp_info.components["fuzzer"].requires = ["mutator", "protobuf::libprotobuf"] diff --git a/recipes/libprotobuf-mutator/all/test_package/CMakeLists.txt b/recipes/libprotobuf-mutator/all/test_package/CMakeLists.txt index 00520b9489805..70a0e97ac972f 100644 --- a/recipes/libprotobuf-mutator/all/test_package/CMakeLists.txt +++ b/recipes/libprotobuf-mutator/all/test_package/CMakeLists.txt @@ -1,19 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) find_package(libprotobuf-mutator REQUIRED CONFIG) - -protobuf_generate_cpp( - MSG_PROTO_SRCS - MSG_PROTO_HDRS - msg.proto -) - - -add_executable(${PROJECT_NAME} ${MSG_PROTO_SRCS} test_package.cpp) -target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) -target_link_libraries(${PROJECT_NAME} libprotobuf-mutator::libprotobuf-mutator) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE libprotobuf-mutator::protobuf-mutator libprotobuf-mutator::protobuf-mutator-libfuzzer) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/libprotobuf-mutator/all/test_package/conanfile.py b/recipes/libprotobuf-mutator/all/test_package/conanfile.py index 38f4483872d47..ef5d7042163ec 100644 --- a/recipes/libprotobuf-mutator/all/test_package/conanfile.py +++ b/recipes/libprotobuf-mutator/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libprotobuf-mutator/all/test_package/msg.proto b/recipes/libprotobuf-mutator/all/test_package/msg.proto deleted file mode 100644 index cb25c9d008352..0000000000000 --- a/recipes/libprotobuf-mutator/all/test_package/msg.proto +++ /dev/null @@ -1,11 +0,0 @@ -syntax = "proto2"; -package libfuzzer_example; - -import "google/protobuf/any.proto"; - -message Msg { - optional float optional_float = 1; - optional uint64 optional_uint64 = 2; - optional string optional_string = 3; - optional google.protobuf.Any any = 4; -} diff --git a/recipes/libprotobuf-mutator/all/test_package/test_package.cpp b/recipes/libprotobuf-mutator/all/test_package/test_package.cpp index c169f66031176..f7273ed21de60 100644 --- a/recipes/libprotobuf-mutator/all/test_package/test_package.cpp +++ b/recipes/libprotobuf-mutator/all/test_package/test_package.cpp @@ -1,23 +1,11 @@ -#include -#include +#include -#include "msg.pb.h" -#include +#include -DEFINE_PROTO_FUZZER(const libfuzzer_example::Msg& message) { - protobuf_mutator::protobuf::FileDescriptorProto file; - - // Emulate a bug. - if (message.optional_uint64() == std::hash{}(message.optional_string()) && - message.optional_string() == "abcdefghijklmnopqrstuvwxyz" && - !std::isnan(message.optional_float()) && - std::fabs(message.optional_float()) > 1000 && - message.any().UnpackTo(&file) && !file.name().empty()) - { - std::cerr << message.DebugString() << "\n"; - } -} int main() { - return 0; + protobuf_mutator::Mutator mutator{}; + const auto seed_value{42}; + mutator.Seed(seed_value); + return EXIT_SUCCESS; } diff --git a/recipes/libprotobuf-mutator/config.yml b/recipes/libprotobuf-mutator/config.yml index 9d5b0e4c50569..d2eb4ed4a511f 100644 --- a/recipes/libprotobuf-mutator/config.yml +++ b/recipes/libprotobuf-mutator/config.yml @@ -1,3 +1,3 @@ versions: - "cci.20210831": + "1.3": folder: all diff --git a/recipes/libpsl/all/conandata.yml b/recipes/libpsl/all/conandata.yml index 348d74be7d0fd..e5c0466a70cd9 100644 --- a/recipes/libpsl/all/conandata.yml +++ b/recipes/libpsl/all/conandata.yml @@ -1,8 +1,10 @@ sources: + "0.21.5": + url: "https://github.com/rockdaboot/libpsl/releases/download/0.21.5/libpsl-0.21.5.tar.gz" + sha256: "1dcc9ceae8b128f3c0b3f654decd0e1e891afc6ff81098f227ef260449dae208" "0.21.1": url: "https://github.com/rockdaboot/libpsl/releases/download/0.21.1/libpsl-0.21.1.tar.gz" sha256: "ac6ce1e1fbd4d0254c4ddb9d37f1fa99dec83619c1253328155206b896210d4c" patches: "0.21.1": - patch_file: "patches/0001-0.21.2-meson-no-tests.patch" - base_path: "source_subfolder" diff --git a/recipes/libpsl/all/conanfile.py b/recipes/libpsl/all/conanfile.py index 3348119027c03..cb6be159c755e 100644 --- a/recipes/libpsl/all/conanfile.py +++ b/recipes/libpsl/all/conanfile.py @@ -1,15 +1,25 @@ -from conans import ConanFile, Meson, tools import os -required_conan_version = ">=1.29.1" +from conan import ConanFile +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, 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.scm import Version + +required_conan_version = ">=2.0" + class LibPslConan(ConanFile): name = "libpsl" description = "C library for the Public Suffix List" homepage = "https://github.com/rockdaboot/libpsl" - topics = ("conan", "psl", "suffix", "TLD", "gTLD", ".com", ".net") + topics = ("psl", "suffix", "TLD", "gTLD", ".com", ".net") license = "GPL-2.0-or-later" 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], @@ -20,19 +30,9 @@ class LibPslConan(ConanFile): "fPIC": True, "with_idna": "icu", } - settings = "os", "arch", "compiler", "build_type" - exports_sources = "patches/**" - generators = "pkg_config" - _meson = 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": @@ -40,27 +40,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 + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") - def build_requirements(self): - self.build_requires("meson/0.55.3") - self.build_requires("pkgconf/1.7.3") + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): if self.options.with_idna == "icu": - self.requires("icu/68.1") + self.requires("icu/74.1") elif self.options.with_idna == "libidn": self.requires("libidn/1.36") elif self.options.with_idna == "libidn2": self.requires("libidn2/2.3.0") if self.options.with_idna in ("libidn", "libidn2"): - self.requires("libunistring/0.9.10") + self.requires("libunistring/1.1") + + def build_requirements(self): + self.tool_requires("meson/[>=1.2.3 <2]") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/[>=2.2.0 <3]") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename("libpsl-{}".format(self.version), self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) @property def _idna_option(self): @@ -69,38 +72,57 @@ def _idna_option(self): "icu": "libicu", }.get(str(self.options.with_idna), str(self.options.with_idna)) - def _configure_meson(self): - if self._meson: - return self._meson - self._meson = Meson(self) - self._meson.options["runtime"] = self._idna_option - self._meson.options["builtin"] = self._idna_option - self._meson.configure(source_folder=self._source_subfolder, build_folder=self._build_subfolder, pkg_config_paths=[self.install_folder]) - return self._meson + def generate(self): + tc = MesonToolchain(self) + tc.project_options["runtime"] = self._idna_option + if Version(self.version) >= "0.21.5": + tc.project_options["builtin"] = "true" if self.options.with_idna else "false" + tc.project_options["tests"] = "false" # disable tests and fuzzes + else: + tc.project_options["builtin"] = self._idna_option + if not self.options.shared: + tc.preprocessor_definitions["PSL_STATIC"] = "1" + tc.generate() + deps = PkgConfigDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - meson = self._configure_meson() + apply_conandata_patches(self) + meson = Meson(self) + meson.configure() meson.build() def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - meson = self._configure_meson() + 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")) + meson = Meson(self) meson.install() - - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), "*.pdb") - if not self.options.shared and self.settings.compiler == "Visual Studio": - os.rename(os.path.join(self.package_folder, "lib", "libpsl.a"), - os.path.join(self.package_folder, "lib", "psl.lib")) - - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + 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")) + fix_apple_shared_install_name(self) + fix_msvc_libname(self) def package_info(self): + self.cpp_info.set_property("pkg_config_name", "libpsl") self.cpp_info.libs = ["psl"] - self.cpp_info.names["pkg_config"] = "libpsl" if self.settings.os == "Windows": self.cpp_info.system_libs = ["ws2_32"] if not self.options.shared: self.cpp_info.defines = ["PSL_STATIC"] + +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/libpsl/all/test_package/CMakeLists.txt b/recipes/libpsl/all/test_package/CMakeLists.txt index 7b9b613cbb24a..cd12a8bc8d580 100644 --- a/recipes/libpsl/all/test_package/CMakeLists.txt +++ b/recipes/libpsl/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(libpsl REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE libpsl::libpsl) diff --git a/recipes/libpsl/all/test_package/conanfile.py b/recipes/libpsl/all/test_package/conanfile.py index bd7165a553cf4..539e617675db7 100644 --- a/recipes/libpsl/all/test_package/conanfile.py +++ b/recipes/libpsl/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, run=True) 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/libpsl/config.yml b/recipes/libpsl/config.yml index 079bf2c67f869..00068fd9ad17d 100644 --- a/recipes/libpsl/config.yml +++ b/recipes/libpsl/config.yml @@ -1,3 +1,5 @@ versions: + "0.21.5": + folder: "all" "0.21.1": folder: "all" diff --git a/recipes/libq/all/conandata.yml b/recipes/libq/all/conandata.yml new file mode 100644 index 0000000000000..10ff9b4c84e7a --- /dev/null +++ b/recipes/libq/all/conandata.yml @@ -0,0 +1,9 @@ +sources: + "0.0.0.cci.20180504": + url: "https://github.com/grantila/q/archive/0117848bb3e6f0b130b546bc5851caf5f95f8b7e.zip" + sha256: "f5e51c1abbbec8e6da2155740917d7f1f60628745363ebd4e2aadfd7ef2ff682" +patches: + "0.0.0.cci.20180504": + - patch_file: "patches/0001-cmake-remove-hardcoded-flags.patch" + patch_description: "Remove hardcoded flags from CMakeLists.txt" + patch_type: "conan" diff --git a/recipes/libq/all/conanfile.py b/recipes/libq/all/conanfile.py new file mode 100644 index 0000000000000..b6fe5082c71c6 --- /dev/null +++ b/recipes/libq/all/conanfile.py @@ -0,0 +1,90 @@ +import os + +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, rm, rmdir, export_conandata_patches, apply_conandata_patches +from conan.tools.microsoft import is_msvc +from conan.tools.apple import fix_apple_shared_install_name + +required_conan_version = ">=2.1" + +class libqConan(ConanFile): + name = "libq" + description = "A platform-independent promise library for C++, implementing asynchronous continuations." + license = "Apache-2.0" + topics = ("async", "promises") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/grantila/q" + settings = "os", "compiler", "build_type", "arch" + package_type = "library" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + implements = ["auto_shared_fpic"] + + def layout(self): + cmake_layout(self, src_folder="src") + + def export_sources(self): + export_conandata_patches(self) + + def configure(self): + if self.settings.os == "Windows": + self.package_type = "static-library" + del self.options.shared + if self.options.get_safe("shared"): + self.options.rm_safe("fPIC") + + def validate(self): + check_min_cppstd(self, 11) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + apply_conandata_patches(self) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["q_BUILD_TESTS"] = False + tc.variables["q_BUILD_APPS"] = False + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE.txt", self.source_folder, os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + fix_apple_shared_install_name(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, "*.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): + suffix = "" + if is_msvc(self) and self.settings.build_type == "Debug": + suffix = "d" + self.cpp_info.libs = ["q" + suffix] + self.cpp_info.set_property("cmake_file_name", "libq") + self.cpp_info.set_property("cmake_target_name", "libq::libq") + + 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") + + if is_msvc(self): + self.cpp_info.cxxflags.append("/bigobj") diff --git a/recipes/libq/all/patches/0001-cmake-remove-hardcoded-flags.patch b/recipes/libq/all/patches/0001-cmake-remove-hardcoded-flags.patch new file mode 100644 index 0000000000000..228613f851cb1 --- /dev/null +++ b/recipes/libq/all/patches/0001-cmake-remove-hardcoded-flags.patch @@ -0,0 +1,22 @@ +diff --git a/cmake/compilersetup.cmake b/cmake/compilersetup.cmake +index e550442..8ee19f7 100644 +--- a/cmake/compilersetup.cmake ++++ b/cmake/compilersetup.cmake +@@ -15,7 +15,6 @@ set( CMAKE_CXX_EXTENSIONS OFF ) + if ( CMAKE_CXX_COMPILER_ID MATCHES "GNU" ) + + if ( CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9 ) +- set( CMAKE_CXX_FLAGS "-std=c++11 -Wall -pipe -pthread" ) + endif ( ) + + if ( NOT CMAKE_CXX_FLAGS ) +@@ -82,9 +81,6 @@ elseif ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" ) + set( CMAKE_DEBUG_POSTFIX "d" ) + add_definitions( "/bigobj" ) + +- set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd" ) +- set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT" ) +- + else ( ) + + q_warning( "untested compiler: ${CMAKE_CXX_COMPILER}" ) diff --git a/recipes/libq/all/test_package/CMakeLists.txt b/recipes/libq/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..72178581766a4 --- /dev/null +++ b/recipes/libq/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.15) + +project(test_package LANGUAGES CXX) # if the project uses c++ + +find_package(libq REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE libq::libq) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/libq/all/test_package/conanfile.py b/recipes/libq/all/test_package/conanfile.py new file mode 100644 index 0000000000000..02eb5ce439fb4 --- /dev/null +++ b/recipes/libq/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libq/all/test_package/test_package.cpp b/recipes/libq/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..52347690f10f3 --- /dev/null +++ b/recipes/libq/all/test_package/test_package.cpp @@ -0,0 +1,11 @@ +#include +#include +#include + + +int main(void) { + q::initialize(); + std::cout << "q initialized correctly" << std::endl; + q::uninitialize(); + return EXIT_SUCCESS; +} diff --git a/recipes/libq/config.yml b/recipes/libq/config.yml new file mode 100644 index 0000000000000..209de68dc5235 --- /dev/null +++ b/recipes/libq/config.yml @@ -0,0 +1,3 @@ +versions: + "0.0.0.cci.20180504": + folder: all diff --git a/recipes/libqasm/all/conandata.yml b/recipes/libqasm/all/conandata.yml new file mode 100644 index 0000000000000..4c6694628c66f --- /dev/null +++ b/recipes/libqasm/all/conandata.yml @@ -0,0 +1,16 @@ +sources: + "0.6.9": + url: "https://github.com/QuTech-Delft/libqasm/releases/download/0.6.9/libqasm-0.6.9.tar.gz" + sha256: "23c5d0e4e506e1974668408f8018034d1b1303e65c6d2d28639eae9499759c4d" + "0.6.8": + url: "https://github.com/QuTech-Delft/libqasm/releases/download/0.6.8/libqasm-0.6.8.tar.gz" + sha256: "b98ff44f0c569a0cc20b3728ba7d4711299aaac07d4dadfe52e638b366b91251" + "0.6.7": + url: "https://github.com/QuTech-Delft/libqasm/releases/download/0.6.7/libqasm-0.6.7.tar.gz" + sha256: "3e85be4f433b178b89e32bc738bd4f69266cd1c4ad0ed12b5367381ac6e44eb2" + "0.6.6": + url: "https://github.com/QuTech-Delft/libqasm/releases/download/0.6.6/libqasm-0.6.6.tar.gz" + sha256: "b3a2d1670f8865ce22bcc62c6a696ee7e0764a7b76901a4f082efa2287e0cbad" + "0.6.5": + url: "https://github.com/QuTech-Delft/libqasm/releases/download/0.6.5/libqasm-0.6.5.tar.gz" + sha256: "0577622a512d1f64892949af02abe3d0b53195ad454045715a0ebf837ecde0d6" diff --git a/recipes/libqasm/all/conanfile.py b/recipes/libqasm/all/conanfile.py new file mode 100644 index 0000000000000..142f8f4210203 --- /dev/null +++ b/recipes/libqasm/all/conanfile.py @@ -0,0 +1,131 @@ +import os + +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.cmake import CMakeToolchain, CMakeDeps, CMake, cmake_layout +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import copy, get, rm, replace_in_file +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version + +required_conan_version = ">=1.60.0 <2 || >=2.0.6" + + +class LibqasmConan(ConanFile): + name = "libqasm" + license = "Apache-2.0" + homepage = "https://github.com/QuTech-Delft/libqasm" + url = "https://github.com/conan-io/conan-center-index" + description = "Library to parse cQASM files" + topics = ("code generation", "parser", "compiler", "quantum compilation", "quantum simulation") + settings = "os", "compiler", "build_type", "arch" + package_type = "library" + options = { + "shared": [True, False], + "fPIC": [True, False], + "build_python": [True, False] + } + default_options = { + "shared": False, + "fPIC": True, + "build_python": False + } + + @property + def _should_build_test(self): + return not self.conf.get("tools.build:skip_test", default=True, check_type=bool) + + @property + def _min_cppstd(self): + return "20" + + @property + def _compilers_minimum_version(self): + return { + "gcc": "10", + "clang": "13", + "apple-clang": "14", + "Visual Studio": "16", + "msvc": "192" + } + + 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.settings.arch == "wasm": + self.options["antlr4-cppruntime"].shared = self.options.shared + + def layout(self): + cmake_layout(self, src_folder="src") + + def build_requirements(self): + self.tool_requires("tree-gen/") + self.tool_requires("zulu-openjdk/21.0.1") + if self.settings.arch == "wasm": + self.tool_requires("emsdk/3.1.50") + if self._should_build_test: + self.test_requires("gtest/1.15.0") + if self.options.build_python: + self.tool_requires("cpython/3.12.2") + + 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}," + f"which your compiler does not support.") + + if self.settings.arch != "wasm" and self.dependencies["antlr4-cppruntime"].options.shared != self.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} requires antlr4-cppruntime to be built with the same shared option value.") + + def requirements(self): + if Version(self.version) < "0.6.7": + self.requires("fmt/10.2.1", transitive_headers=True) + self.requires("tree-gen/1.0.7", transitive_headers=True, transitive_libs=True) + else: + self.requires("fmt/11.0.2", transitive_headers=True) + self.requires("tree-gen/1.0.8", transitive_headers=True, transitive_libs=True) + self.requires("range-v3/0.12.0", transitive_headers=True) + if not self.settings.arch == "wasm": + self.requires("antlr4-cppruntime/4.13.1", transitive_headers=True) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + deps = CMakeDeps(self) + deps.generate() + tc = CMakeToolchain(self) + tc.variables["LIBQASM_BUILD_PYTHON"] = self.options.build_python + tc.variables["LIBQASM_BUILD_TESTS"] = self._should_build_test + tc.generate() + env = VirtualBuildEnv(self) + env.generate() + + def _patch_sources(self): + werror = "/WX" if is_msvc(self) else "-Werror" + replace_in_file(self, os.path.join(self.source_folder, "src", "CMakeLists.txt"), werror, "") + replace_in_file(self, os.path.join(self.source_folder, "test", "CMakeLists.txt"), werror, "") + + 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() + fix_apple_shared_install_name(self) + rm(self, "*.pdb", self.package_folder, recursive=True) + + def package_info(self): + self.cpp_info.libs = ["cqasm"] diff --git a/recipes/libqasm/all/test_package/CMakeLists.txt b/recipes/libqasm/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..528ff39eb1365 --- /dev/null +++ b/recipes/libqasm/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(PackageTest CXX) + +find_package(libqasm REQUIRED CONFIG) + +add_executable(test_package "${CMAKE_CURRENT_SOURCE_DIR}/src/test_package.cpp") +target_compile_features(test_package PRIVATE cxx_std_20) +target_link_libraries(test_package PRIVATE libqasm::libqasm) diff --git a/recipes/libqasm/all/test_package/conanfile.py b/recipes/libqasm/all/test_package/conanfile.py new file mode 100644 index 0000000000000..6ad8a48ce8086 --- /dev/null +++ b/recipes/libqasm/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 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 build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def layout(self): + cmake_layout(self) + + 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/libqasm/all/test_package/src/test_package.cpp b/recipes/libqasm/all/test_package/src/test_package.cpp new file mode 100644 index 0000000000000..07ad803c4364b --- /dev/null +++ b/recipes/libqasm/all/test_package/src/test_package.cpp @@ -0,0 +1,13 @@ +#if __has_include("cqasm.hpp") +#include "cqasm.hpp" +#else +#include "libqasm/cqasm.hpp" +#endif + +#include + +int main() { + auto analyzer = cqasm::v3x::default_analyzer(); + auto result = analyzer.analyze_string("version 3.0; qubit[2] q; H q[0]; CNOT q[0], q[1]; measure q", ""); + std::cout << result.to_json(); +} diff --git a/recipes/libqasm/config.yml b/recipes/libqasm/config.yml new file mode 100644 index 0000000000000..6279f9f461edf --- /dev/null +++ b/recipes/libqasm/config.yml @@ -0,0 +1,11 @@ +versions: + "0.6.9": + folder: all + "0.6.8": + folder: all + "0.6.7": + folder: all + "0.6.6": + folder: all + "0.6.5": + folder: all diff --git a/recipes/libqrencode/all/conanfile.py b/recipes/libqrencode/all/conanfile.py index 04ae81a7d1841..85ea6578aaa01 100644 --- a/recipes/libqrencode/all/conanfile.py +++ b/recipes/libqrencode/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, 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 import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.54.0" class LibqrencodeConan(ConanFile): @@ -15,6 +15,7 @@ class LibqrencodeConan(ConanFile): license = "LGPL-2.1-or-later" topics = ("qr-code", "encoding") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -26,8 +27,7 @@ class LibqrencodeConan(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,29 +35,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["WITH_TOOLS"] = False tc.variables["WITH_TESTS"] = 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): diff --git a/recipes/libqrencode/all/test_package/conanfile.py b/recipes/libqrencode/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/libqrencode/all/test_package/conanfile.py +++ b/recipes/libqrencode/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/libqrencode/all/test_v1_package/CMakeLists.txt b/recipes/libqrencode/all/test_v1_package/CMakeLists.txt index d3795115e353f..0d20897301b68 100644 --- a/recipes/libqrencode/all/test_v1_package/CMakeLists.txt +++ b/recipes/libqrencode/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(libqrencode REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE libqrencode::libqrencode) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/librasterlite/all/conandata.yml b/recipes/librasterlite/all/conandata.yml index 8e05bde05f4df..83f1191432129 100644 --- a/recipes/librasterlite/all/conandata.yml +++ b/recipes/librasterlite/all/conandata.yml @@ -5,6 +5,4 @@ sources: patches: "1.1g": - patch_file: "patches/0001-fix-autotools.patch" - base_path: "source_subfolder" - patch_file: "patches/0002-nmake-honor-flags.patch" - base_path: "source_subfolder" diff --git a/recipes/librasterlite/all/conanfile.py b/recipes/librasterlite/all/conanfile.py index 5fbfd045b9808..f454426605362 100644 --- a/recipes/librasterlite/all/conanfile.py +++ b/recipes/librasterlite/all/conanfile.py @@ -1,8 +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, save +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 import os -required_conan_version = ">=1.36.0" +required_conan_version = ">=1.58.0" class LibrasterliteConan(ConanFile): @@ -15,7 +21,7 @@ class LibrasterliteConan(ConanFile): topics = ("rasterlite", "raster", "spatialite") homepage = "https://www.gaia-gis.it/fossil/librasterlite" url = "https://github.com/conan-io/conan-center-index" - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -26,23 +32,12 @@ class LibrasterliteConan(ConanFile): "fPIC": True, } - 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) 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,98 +45,86 @@ 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("libgeotiff/1.7.0") - self.requires("libjpeg/9d") - self.requires("libpng/1.6.37") + self.requires("libgeotiff/1.7.1") + self.requires("libjpeg/9e") + self.requires("libpng/1.6.40") self.requires("libspatialite/5.0.1") - self.requires("libtiff/4.3.0") - self.requires("sqlite3/3.38.1") + self.requires("libtiff/4.5.1") + self.requires("sqlite3/3.42.0") 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 = 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") - def _build_msvc(self): - target = "rasterlite_i.lib" if self.options.shared else "rasterlite.lib" - optflags = ["-D_USE_MATH_DEFINES"] - system_libs = [lib + ".lib" for lib in self.deps_cpp_info.system_libs] - if self.options.shared: - optflags.append("-DDLL_EXPORT") - with tools.chdir(self._source_subfolder): - tools.save(os.path.join("headers", "config.h"), "#define VERSION \"{}\"\n".format(self.version)) - with tools.vcvars(self): - with tools.environment_append(VisualStudioBuildEnvironment(self).vars): - self.run("nmake -f makefile.vc {} OPTFLAGS=\"{}\" SYSTEM_LIBS=\"{}\"".format(target, - " ".join(optflags), - " ".join(system_libs))) - - 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 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), - ) - with tools.run_environment(self): - autotools = self._configure_autotools() - autotools.make() - - @functools.lru_cache(1) - def _configure_autotools(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)), - "--disable-gcov", - ] - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - autotools.configure(args=args) - return autotools + tc = AutotoolsToolchain(self) + tc.configure_args.append("--disable-gcov") + tc.generate() + + deps = AutotoolsDeps(self) + deps.generate() + deps = PkgConfigDeps(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): + target = "rasterlite_i.lib" if self.options.shared else "rasterlite.lib" + optflags = ["-D_USE_MATH_DEFINES"] + if self.options.shared: + optflags.append("-DDLL_EXPORT") + save(self, os.path.join(self.source_folder, "headers", "config.h"), f"#define VERSION \"{self.version}\"\n") + with chdir(self, self.source_folder): + self.run(f"nmake -f makefile.vc {target} OPTFLAGS=\"{' '.join(optflags)}\"") else: - self._build_autotools() + autotools = Autotools(self) + autotools.autoreconf() + autotools.configure() + autotools.make() def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - if self._is_msvc: - self.copy("rasterlite.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, "rasterlite.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: - with tools.chdir(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")) + 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", "rasterlite") - suffix = "_i" if self._is_msvc and self.options.shared else "" - self.cpp_info.libs = ["rasterlite{}".format(suffix)] - - # TODO: to remove in conan v2 once pkg_config generator removed - self.cpp_info.names["pkg_config"] = "rasterlite" + suffix = "_i" if is_msvc(self) and self.options.shared else "" + self.cpp_info.libs = [f"rasterlite{suffix}"] diff --git a/recipes/librasterlite/all/patches/0002-nmake-honor-flags.patch b/recipes/librasterlite/all/patches/0002-nmake-honor-flags.patch index ff434e3cfd949..b9711900f2f71 100644 --- a/recipes/librasterlite/all/patches/0002-nmake-honor-flags.patch +++ b/recipes/librasterlite/all/patches/0002-nmake-honor-flags.patch @@ -1,6 +1,5 @@ This patch for msvc build allows to: * define OPTFLAG ourself from conanfile (allow to honor profile) -* inject a custom SYSTEM_LIBS variable from conanfile (allow robust shared build) * not hardcode this very specific C:\OSGeo4W environment * define rasterliteGetVersion() to be compliant with autotools build @@ -37,7 +36,7 @@ This patch for msvc build allows to: - C:\OSGeo4W\lib\libpng13.lib C:\OSGeo4W\lib\zlib.lib \ - C:\OSGeo4W\lib\geotiff_i.lib C:\OSGeo4W\lib\spatialite_i.lib + link /dll /out:$(RASTERLITE_DLL) \ -+ /implib:rasterlite_i.lib $(LIBOBJ) $(SYSTEM_LIBS) ++ /implib:rasterlite_i.lib $(LIBOBJ) if exist $(RASTERLITE_DLL).manifest mt -manifest \ $(RASTERLITE_DLL).manifest -outputresource:$(RASTERLITE_DLL);2 diff --git a/recipes/librasterlite/all/test_package/CMakeLists.txt b/recipes/librasterlite/all/test_package/CMakeLists.txt index 66ed4461774cf..5678137a1cf88 100644 --- a/recipes/librasterlite/all/test_package/CMakeLists.txt +++ b/recipes/librasterlite/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(librasterlite REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} librasterlite::librasterlite) +target_link_libraries(${PROJECT_NAME} PRIVATE librasterlite::librasterlite) diff --git a/recipes/librasterlite/all/test_package/conanfile.py b/recipes/librasterlite/all/test_package/conanfile.py index 79178ce11469e..0a6bc68712d90 100644 --- a/recipes/librasterlite/all/test_package/conanfile.py +++ b/recipes/librasterlite/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.3") + 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/librasterlite/all/test_v1_package/CMakeLists.txt b/recipes/librasterlite/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/librasterlite/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/librasterlite/all/test_v1_package/conanfile.py b/recipes/librasterlite/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/librasterlite/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/librasterlite2/all/conanfile.py b/recipes/librasterlite2/all/conanfile.py index f7a1b69c371ae..91ae265228d72 100644 --- a/recipes/librasterlite2/all/conanfile.py +++ b/recipes/librasterlite2/all/conanfile.py @@ -1,5 +1,7 @@ -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 get, rmdir +from conans import AutoToolsBuildEnvironment, tools import functools import os @@ -66,41 +68,41 @@ def configure(self): del self.settings.compiler.cppstd def requirements(self): - self.requires("cairo/1.17.4") - self.requires("freetype/2.11.1") + self.requires("cairo/1.17.6") + self.requires("freetype/2.13.0") self.requires("giflib/5.2.1") - self.requires("libcurl/7.80.0") + self.requires("libcurl/8.1.2") self.requires("libgeotiff/1.7.1") - self.requires("libjpeg/9d") - self.requires("libpng/1.6.37") + self.requires("libjpeg/9e") + self.requires("libpng/1.6.40") self.requires("libspatialite/5.0.1") - self.requires("libtiff/4.3.0") - self.requires("libxml2/2.9.13") - self.requires("sqlite3/3.38.1") - self.requires("zlib/1.2.12") + self.requires("libtiff/4.5.1") + self.requires("libxml2/2.11.4") + self.requires("sqlite3/3.42.0") + self.requires("zlib/1.2.13") 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.3.1") if self.options.with_lzma: - self.requires("xz_utils/5.2.5") + self.requires("xz_utils/5.4.2") if self.options.with_lz4: - self.requires("lz4/1.9.3") + self.requires("lz4/1.9.4") if self.options.with_zstd: - self.requires("zstd/1.5.2") + self.requires("zstd/1.5.5") def validate(self): if self._is_msvc: raise ConanInvalidConfiguration("Visual Studio not supported yet") def build_requirements(self): - self.build_requires("libtool/2.4.6") - self.build_requires("pkgconf/1.7.4") + self.build_requires("libtool/2.4.7") + self.build_requires("pkgconf/1.9.5") 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], + get(self, **self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) def _patch_sources(self): @@ -157,7 +159,7 @@ def package(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")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): self.cpp_info.set_property("pkg_config_name", "rasterlite2") diff --git a/recipes/libraw/all/CMakeLists.txt b/recipes/libraw/all/CMakeLists.txt index 2022d590fa2a2..f6b105c027f9d 100644 --- a/recipes/libraw/all/CMakeLists.txt +++ b/recipes/libraw/all/CMakeLists.txt @@ -1,57 +1,83 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.8) +project(LibRaw LANGUAGES CXX) -project(LibRaw) +option(LIBRAW_BUILD_THREAD_SAFE "Build raw_r library with -pthread enabled" OFF) +option(LIBRAW_WITH_JPEG "Build with libjpeg" ON) +option(LIBRAW_WITH_LCMS "Build with LCMS" ON) +option(LIBRAW_WITH_JASPER "Build with Jasper" ON) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +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") -file(GLOB_RECURSE headers "source_subfolder/libraw/*.h") + # 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() -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" -) +if(LIBRAW_WITH_JPEG) + find_package(JPEG REQUIRED) +endif() +if(LIBRAW_WITH_LCMS) + find_package(lcms REQUIRED CONFIG) +endif() +if(LIBRAW_WITH_JASPER) + find_package(Jasper REQUIRED) +endif() +add_library(raw ${libraw_LIB_SRCS}) +target_compile_features(raw PUBLIC cxx_std_11) +target_include_directories(raw PUBLIC "${LIBRAW_SRC_DIR}") if(WIN32) - add_definitions(-DWIN32) - + target_link_libraries(raw PUBLIC ws2_32) if(BUILD_SHARED_LIBS) - add_definitions(-DLIBRAW_BUILDLIB) + target_compile_definitions(raw PUBLIC LIBRAW_BUILDLIB) else() - add_definitions(-DLIBRAW_NODLL) + target_compile_definitions(raw PUBLIC LIBRAW_NODLL) endif() endif() - -if (TARGET CONAN_PKG::libjpeg OR TARGET CONAN_PKG::libjpeg-turbo) - add_definitions(-DUSE_JPEG -DUSE_JPEG8) +if(MSVC) + target_compile_options(raw PUBLIC /wd4018 /wd4101 /wd4244 /wd4251 /wd4267 /wd4996) +endif() +if(LIBRAW_WITH_JPEG) + target_compile_definitions(raw PUBLIC USE_JPEG USE_JPEG8) + target_link_libraries(raw PUBLIC JPEG::JPEG) endif () -if (TARGET CONAN_PKG::lcms) - add_definitions(-DUSE_LCMS2) +if (LIBRAW_WITH_LCMS) + target_compile_definitions(raw PUBLIC USE_LCMS2) + target_link_libraries(raw PUBLIC lcms::lcms) endif () -if (TARGET CONAN_PKG::jasper) - add_definitions(-DUSE_JASPER) +if (LIBRAW_WITH_JASPER) + target_compile_definitions(raw PUBLIC USE_JASPER) + target_link_libraries(raw PUBLIC Jasper::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/") -target_compile_options(raw PUBLIC $<$:/W0>) -if (TARGET CONAN_PKG::libjpeg) - target_link_libraries(raw PUBLIC CONAN_PKG::libjpeg) -endif () -if (TARGET CONAN_PKG::libjpeg-turbo) - target_link_libraries(raw PUBLIC CONAN_PKG::libjpeg-turbo) -endif () -if (TARGET CONAN_PKG::lcms) - target_link_libraries(raw PUBLIC CONAN_PKG::lcms) -endif () -if (TARGET CONAN_PKG::jasper) - target_link_libraries(raw PUBLIC CONAN_PKG::jasper) -endif () +include(GNUInstallDirs) +if(LIBRAW_BUILD_THREAD_SAFE) + add_library(raw_r ${libraw_LIB_SRCS}) + target_link_libraries(raw_r INTERFACE raw) + target_compile_options(raw_r PRIVATE -pthread) + target_link_options(raw_r PRIVATE -pthread) + target_include_directories(raw_r PUBLIC "${LIBRAW_SRC_DIR}") + install( + TARGETS raw_r + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ) +endif() -install(DIRECTORY "source_subfolder/libraw" DESTINATION include) -install(TARGETS raw ARCHIVE DESTINATION lib RUNTIME DESTINATION bin LIBRARY DESTINATION lib) +install(DIRECTORY "${LIBRAW_SRC_DIR}/libraw" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +install( + TARGETS raw + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) diff --git a/recipes/libraw/all/conandata.yml b/recipes/libraw/all/conandata.yml index 47981769832c6..1b7daa83fdaae 100644 --- a/recipes/libraw/all/conandata.yml +++ b/recipes/libraw/all/conandata.yml @@ -1,10 +1,16 @@ 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.3": + url: "https://github.com/LibRaw/LibRaw/archive/0.21.3.tar.gz" + sha256: "dc3d8b54e333d9d5441336049db255d14b27f19bd326a306cf5aea866806780a" + "0.21.2": + url: "https://github.com/LibRaw/LibRaw/archive/0.21.2.tar.gz" + sha256: "7ac056e0d9e814d808f6973a950bbf45e71b53283eed07a7ea87117a6c0ced96" + "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" diff --git a/recipes/libraw/all/conanfile.py b/recipes/libraw/all/conanfile.py index 47b1f62f9d69b..d77cb1f6c1d38 100644 --- a/recipes/libraw/all/conanfile.py +++ b/recipes/libraw/all/conanfile.py @@ -1,89 +1,134 @@ -from conans import ConanFile, tools, CMake import os +from conan import ConanFile +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 copy, get +from conan.tools.microsoft import is_msvc + +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") + package_type = "library" settings = "os", "arch", "compiler", "build_type" - options = { "shared": [True, False], "fPIC": [True, False], - "with_jpeg": [False, "libjpeg", "libjpeg-turbo"], + "build_thread_safe": [True, False], + "with_jpeg": [False, "libjpeg", "libjpeg-turbo", "mozjpeg"], "with_lcms": [True, False], - "with_jasper": [True, False] + "with_jasper": [True, False], } default_options = { "shared": False, "fPIC": True, + "build_thread_safe": False, "with_jpeg": "libjpeg", "with_lcms": True, - "with_jasper": 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": del self.options.fPIC + if is_msvc(self): + del self.options.build_thread_safe 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/3.0.0") + elif self.options.with_jpeg == "mozjpeg": + self.requires("mozjpeg/4.1.3") if self.options.with_lcms: - self.requires("lcms/2.12") + self.requires("lcms/2.16") 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.variables["LIBRAW_BUILD_THREAD_SAFE"] = self.options.get_safe("build_thread_safe", False) + tc.variables["LIBRAW_WITH_JPEG"] = bool(self.options.with_jpeg) + tc.variables["LIBRAW_WITH_LCMS"] = self.options.with_lcms + tc.variables["LIBRAW_WITH_JASPER"] = self.options.with_jasper + 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.components["libraw_"].set_property("pkg_config_name", "libraw") + self.cpp_info.components["libraw_"].libs = ["raw"] + self.cpp_info.components["libraw_"].includedirs.append(os.path.join("include", "libraw")) if self.settings.os == "Windows": - self.cpp_info.defines.append("WIN32") + self.cpp_info.components["libraw_"].system_libs.append("ws2_32") + if not self.options.shared: + self.cpp_info.components["libraw_"].defines.append("LIBRAW_NODLL") - if not self.options.shared: - self.cpp_info.defines.append("LIBRAW_NODLL") + requires = [] + if self.options.with_jpeg == "libjpeg": + requires.append("libjpeg::libjpeg") + elif self.options.with_jpeg == "libjpeg-turbo": + requires.append("libjpeg-turbo::jpeg") + elif self.options.with_jpeg == "mozjpeg": + requires.append("mozjpeg::libjpeg") + if self.options.with_lcms: + requires.append("lcms::lcms") + if self.options.with_jasper: + requires.append("jasper::jasper") + self.cpp_info.components["libraw_"].requires = requires + + if self.options.get_safe("build_thread_safe"): + self.cpp_info.components["libraw_r"].set_property("pkg_config_name", "libraw_r") + self.cpp_info.components["libraw_r"].libs = ["raw_r"] + self.cpp_info.components["libraw_r"].includedirs.append(os.path.join("include", "libraw")) + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["libraw_r"].system_libs.append("pthread") + self.cpp_info.components["libraw_r"].requires = requires + + if not self.options.shared and stdcpp_library(self): + self.cpp_info.components["libraw_"].system_libs.append(stdcpp_library(self)) + if self.options.get_safe("build_thread_safe"): + self.cpp_info.components["libraw_r"].system_libs.append(stdcpp_library(self)) 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..5756010f50007 100644 --- a/recipes/libraw/config.yml +++ b/recipes/libraw/config.yml @@ -1,7 +1,11 @@ versions: - "0.19.5": + "0.21.3": folder: all - "0.20.0": + "0.21.2": + folder: all + "0.21.1": folder: all "0.20.2": folder: all + "0.20.0": + folder: all diff --git a/recipes/librdkafka/all/conandata.yml b/recipes/librdkafka/all/conandata.yml index 9bb10a3ea1457..f4429a7e57f9f 100644 --- a/recipes/librdkafka/all/conandata.yml +++ b/recipes/librdkafka/all/conandata.yml @@ -1,50 +1,96 @@ sources: + "2.6.1": + url: "https://github.com/edenhill/librdkafka/archive/v2.6.1.tar.gz" + sha256: "0ddf205ad8d36af0bc72a2fec20639ea02e1d583e353163bf7f4683d949e901b" + "2.6.0": + url: "https://github.com/edenhill/librdkafka/archive/v2.6.0.tar.gz" + sha256: "abe0212ecd3e7ed3c4818a4f2baf7bf916e845e902bb15ae48834ca2d36ac745" + "2.5.3": + url: "https://github.com/edenhill/librdkafka/archive/v2.5.3.tar.gz" + sha256: "eaa1213fdddf9c43e28834d9a832d9dd732377d35121e42f875966305f52b8ff" + "2.5.0": + url: "https://github.com/edenhill/librdkafka/archive/v2.5.0.tar.gz" + sha256: "3dc62de731fd516dfb1032861d9a580d4d0b5b0856beb0f185d06df8e6c26259" + "2.4.0": + url: "https://github.com/edenhill/librdkafka/archive/v2.4.0.tar.gz" + sha256: "d645e47d961db47f1ead29652606a502bdd2a880c85c1e060e94eea040f1a19a" + "2.3.0": + url: "https://github.com/edenhill/librdkafka/archive/v2.3.0.tar.gz" + sha256: "2d49c35c77eeb3d42fa61c43757fcbb6a206daa560247154e60642bcdcc14d12" + "2.2.0": + url: "https://github.com/edenhill/librdkafka/archive/v2.2.0.tar.gz" + sha256: "af9a820cbecbc64115629471df7c7cecd40403b6c34bfdbb9223152677a47226" + "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" - sha256: "3a54cf375218977b7af4716ed9738378e37fe400a6c5ddb9d622354ca31fdc79" - "1.8.2": - url: "https://github.com/edenhill/librdkafka/archive/refs/tags/v1.8.2.tar.gz" - sha256: "6a747d293a7a4613bd2897e28e8791476fbe1ae7361f2530a876e0fd483482a6" - "1.8.0": - url: "https://github.com/edenhill/librdkafka/archive/v1.8.0.tar.gz" - sha256: "93b12f554fa1c8393ce49ab52812a5f63e264d9af6a50fd6e6c318c481838b7f" - "1.7.0": - url: "https://github.com/edenhill/librdkafka/archive/v1.7.0.tar.gz" - sha256: "c71b8c5ff419da80c31bb8d3036a408c87ad523e0c7588e7660ee5f3c8973057" - "1.6.1": - url: "https://github.com/edenhill/librdkafka/archive/v1.6.1.tar.gz" - sha256: "689028b5fdfdce026f396fc2f3bfe9e38947210d9bd22be28c3159cc8c41b57e" - "1.6.0": - url: "https://github.com/edenhill/librdkafka/archive/v1.6.0.tar.gz" - sha256: "3130cbd391ef683dc9acf9f83fe82ff93b8730a1a34d0518e93c250929be9f6b" - "1.5.3": - url: "https://github.com/edenhill/librdkafka/archive/v1.5.3.tar.gz" - sha256: "2105ca01fef5beca10c9f010bc50342b15d5ce6b73b2489b012e6d09a008b7bf" patches: - "1.9.2": + "2.6.1": - patch_file: patches/0001-Change-library-names-1-9-1.patch - - patch_file: patches/0002-Change-library-targets-and-result-variables-1-9-1.patch - "1.9.1": + patch_description: "find_package conan packages" + patch_type: "conan" + - patch_file: patches/0002-Change-library-targets-and-result-variables-2-5-0.patch + patch_description: "refer conan package names" + patch_type: "conan" + "2.6.0": + - 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-5-0.patch + patch_description: "refer conan package names" + patch_type: "conan" + "2.5.3": + - 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-5-0.patch + patch_description: "refer conan package names" + patch_type: "conan" + "2.5.0": + - 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-5-0.patch + patch_description: "refer conan package names" + patch_type: "conan" + - patch_file: patches/0003-add-forward-declaration-2-5-0.patch + patch_description: "add forward declarations to fix compilation without ssl" + patch_type: "official" + patch_source: "https://github.com/confluentinc/librdkafka/pull/4794/" + "2.4.0": + - 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-3-0.patch + patch_description: "refer conan package names" + patch_type: "conan" + "2.3.0": + - 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-3-0.patch + patch_description: "refer conan package names" + patch_type: "conan" + "2.2.0": + - 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" + "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 - "1.8.2": - - patch_file: patches/0001-Change-library-names-1-7-0.patch - - patch_file: patches/0002-Change-library-targets-and-result-variables-1-7-0.patch - "1.8.0": - - patch_file: patches/0001-Change-library-names-1-7-0.patch - - patch_file: patches/0002-Change-library-targets-and-result-variables-1-7-0.patch - "1.7.0": - - patch_file: patches/0001-Change-library-names-1-7-0.patch - - patch_file: patches/0002-Change-library-targets-and-result-variables-1-7-0.patch - "1.6.1": - - patch_file: patches/0001-Change-library-names-1-5-2.patch - - patch_file: patches/0002-Change-library-targets-and-result-variables-1-6-1.patch - "1.6.0": - - patch_file: patches/0001-Change-library-names-1-5-2.patch - - patch_file: patches/0002-Change-library-targets-and-result-variables-1-6-0.patch - "1.5.3": - - patch_file: patches/0001-Change-library-names-1-5-2.patch - - 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 1497ac09fe62a..d7bc2435f6766 100644 --- a/recipes/librdkafka/all/conanfile.py +++ b/recipes/librdkafka/all/conanfile.py @@ -1,12 +1,13 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout -from conan.tools.env import Environment, VirtualBuildEnv +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 PkgConfigDeps from conan.tools.scm import Version +from conan.tools.microsoft import is_msvc import os -required_conan_version = ">=1.53.0" +required_conan_version = ">=1.55.0" class LibrdkafkaConan(ConanFile): @@ -19,6 +20,7 @@ class LibrdkafkaConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/edenhill/librdkafka" topics = ("kafka", "consumer", "producer") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -29,6 +31,7 @@ class LibrdkafkaConan(ConanFile): "ssl": [True, False], "sasl": [True, False], "curl": [True, False], + "syslog": [True, False], } default_options = { "shared": False, @@ -39,6 +42,7 @@ class LibrdkafkaConan(ConanFile): "ssl": False, "sasl": False, "curl": False, + "syslog": False, } @property @@ -51,8 +55,8 @@ def export_sources(self): def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - if Version(self.version) < "1.9.0": - del self.options.curl + if is_msvc(self): + del self.options.syslog def configure(self): if self.options.shared: @@ -64,25 +68,27 @@ def layout(self): def requirements(self): self.requires("lz4/1.9.4") if self.options.zlib: - self.requires("zlib/1.2.13") + self.requires("zlib/[>=1.2.11 <2]") if self.options.zstd: - self.requires("zstd/1.5.2") + self.requires("zstd/1.5.5") if self.options.ssl: - self.requires("openssl/1.1.1s") + self.requires("openssl/[>=1.1 <4]") if self._depends_on_cyrus_sasl: - self.requires("cyrus-sasl/2.1.27") - if self.options.get_safe("curl", False): - self.requires("libcurl/7.85.0") + self.requires("cyrus-sasl/2.1.28") + if self.options.curl: + self.requires("libcurl/[>=7.78.0 <9]") def build_requirements(self): if self._depends_on_cyrus_sasl: - self.tool_requires("pkgconf/1.9.3") + self.tool_requires("pkgconf/2.1.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 = CMakeToolchain(self) tc.variables["WITHOUT_OPTIMIZATION"] = self.settings.build_type == "Debug" tc.variables["ENABLE_DEVEL"] = self.settings.build_type == "Debug" @@ -97,8 +103,9 @@ def generate(self): tc.variables["WITH_SSL"] = self.options.ssl tc.variables["WITH_SASL"] = self.options.sasl tc.variables["ENABLE_LZ4_EXT"] = True - if Version(self.version) >= "1.9.0": - tc.variables["WITH_CURL"] = self.options.curl + tc.variables["WITH_CURL"] = self.options.curl + tc.variables["WITH_SNAPPY"] = True + tc.preprocessor_definitions["WITH_SYSLOG"] = "1" if self.options.get_safe("syslog") else "0" tc.generate() cd = CMakeDeps(self) @@ -107,14 +114,6 @@ def generate(self): if self._depends_on_cyrus_sasl: pc = PkgConfigDeps(self) pc.generate() - # inject pkgconf env vars in build context - ms = VirtualBuildEnv(self) - ms.generate(scope="build") - # also need to inject generators folder into PKG_CONFIG_PATH - env = Environment() - env.prepend_path("PKG_CONFIG_PATH", self.generators_folder) - envvars = env.vars(self, scope="build") - envvars.save_script("conanbuildenv_pkg_config_path") def build(self): apply_conandata_patches(self) @@ -167,15 +166,6 @@ def package_info(self): self.cpp_info.components["rdkafka++"].libs = ["rdkafka++"] self.cpp_info.components["rdkafka++"].requires = ["rdkafka"] - # 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["rdkafka"].includedirs = ["include"] - self.cpp_info.components["rdkafka"].libdirs= ["lib"] - self.cpp_info.components["rdkafka"].bindirs = ["bin"] - self.cpp_info.components["rdkafka++"].includedirs = ["include"] - self.cpp_info.components["rdkafka++"].libdirs = ["lib"] - self.cpp_info.components["rdkafka++"].bindirs = ["bin"] - # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.names["cmake_find_package"] = "RdKafka" self.cpp_info.names["cmake_find_package_multi"] = "RdKafka" diff --git a/recipes/librdkafka/all/patches/0001-Change-library-names-1-5-2.patch b/recipes/librdkafka/all/patches/0001-Change-library-names-1-5-2.patch deleted file mode 100644 index 63c4787d111f3..0000000000000 --- a/recipes/librdkafka/all/patches/0001-Change-library-names-1-5-2.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -54,7 +54,7 @@ endif() - # } - - # ZSTD { --find_package(ZSTD QUIET) -+find_package(zstd QUIET CONFIG) - if(ZSTD_FOUND) - set(with_zstd_default ON) - else() -@@ -133,6 +133,9 @@ else() - endif() - option(WITH_SASL "With SASL" ${with_sasl_default}) - if(WITH_SASL) -+ if(SASL_FOUND) -+ link_directories(${SASL_LIBRARY_DIRS}) -+ endif() - if(WITH_SSL) - set(WITH_SASL_SCRAM ON) - set(WITH_SASL_OAUTHBEARER ON) -@@ -149,7 +152,8 @@ endif() - option(ENABLE_LZ4_EXT "Enable external LZ4 library support" ON) - set(WITH_LZ4_EXT OFF) - if(ENABLE_LZ4_EXT) -- find_package(LZ4) -+ find_package(lz4 REQUIRED CONFIG) -+ set(LZ4_FOUND ON) - if(LZ4_FOUND) - set(WITH_LZ4_EXT ON) - list(APPEND BUILT_WITH "LZ4_EXT") diff --git a/recipes/librdkafka/all/patches/0001-Change-library-names-1-7-0.patch b/recipes/librdkafka/all/patches/0001-Change-library-names-1-7-0.patch deleted file mode 100644 index 966ba38247ca4..0000000000000 --- a/recipes/librdkafka/all/patches/0001-Change-library-names-1-7-0.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 07bd30c67a532be3c1f31aa383a1061c832a034d Mon Sep 17 00:00:00 2001 -From: Alejandro Colomar -Date: Sun, 30 May 2021 11:02:57 +0200 -Subject: [PATCH] Change library names - ---- - CMakeLists.txt | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index d1129bce..14d9e7f0 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -54,7 +54,7 @@ endif() - # } - - # ZSTD { --find_package(ZSTD QUIET) -+find_package(zstd QUIET CONFIG) - if(ZSTD_FOUND) - set(with_zstd_default ON) - else() -@@ -152,7 +152,8 @@ endif() - option(ENABLE_LZ4_EXT "Enable external LZ4 library support" ON) - set(WITH_LZ4_EXT OFF) - if(ENABLE_LZ4_EXT) -- find_package(LZ4) -+ find_package(lz4 REQUIRED CONFIG) -+ set(LZ4_FOUND ON) - if(LZ4_FOUND) - set(WITH_LZ4_EXT ON) - list(APPEND BUILT_WITH "LZ4_EXT") --- -2.32.0.rc0 - diff --git a/recipes/librdkafka/all/patches/0002-Change-library-targets-and-result-variables-1-5-2.patch b/recipes/librdkafka/all/patches/0002-Change-library-targets-and-result-variables-1-5-2.patch deleted file mode 100644 index 2c6f62c68a478..0000000000000 --- a/recipes/librdkafka/all/patches/0002-Change-library-targets-and-result-variables-1-5-2.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -209,9 +209,7 @@ if(WITH_ZLIB) - endif() - - if(WITH_ZSTD) -- target_link_libraries(rdkafka PUBLIC ${ZSTD_LIBRARY}) -- target_include_directories(rdkafka PUBLIC ${ZSTD_INCLUDE_DIR}) -- message(STATUS "Found ZSTD: ${ZSTD_LIBRARY}") -+ target_link_libraries(rdkafka PUBLIC $,zstd::libzstd_shared,zstd::libzstd_static>) - endif() - - if(WITH_SSL) -@@ -246,8 +244,7 @@ if(WITH_LIBDL) - endif() - - if(WITH_LZ4_EXT) -- target_include_directories(rdkafka PUBLIC ${LZ4_INCLUDE_DIRS}) -- target_link_libraries(rdkafka PUBLIC LZ4::LZ4) -+ target_link_libraries(rdkafka PUBLIC lz4::lz4) - endif() - - # Set up path to these sources for other sub-projects (tests, examples) diff --git a/recipes/librdkafka/all/patches/0002-Change-library-targets-and-result-variables-1-6-0.patch b/recipes/librdkafka/all/patches/0002-Change-library-targets-and-result-variables-1-6-0.patch deleted file mode 100644 index 71155e468786f..0000000000000 --- a/recipes/librdkafka/all/patches/0002-Change-library-targets-and-result-variables-1-6-0.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -212,9 +212,7 @@ if(WITH_ZLIB) - endif() - - if(WITH_ZSTD) -- target_link_libraries(rdkafka PUBLIC ${ZSTD_LIBRARY}) -- target_include_directories(rdkafka PUBLIC ${ZSTD_INCLUDE_DIR}) -- message(STATUS "Found ZSTD: ${ZSTD_LIBRARY}") -+ target_link_libraries(rdkafka PUBLIC $,zstd::libzstd_shared,zstd::libzstd_static>) - endif() - - if(WITH_SSL) -@@ -249,8 +247,7 @@ if(WITH_LIBDL) - endif() - - if(WITH_LZ4_EXT) -- target_include_directories(rdkafka PUBLIC ${LZ4_INCLUDE_DIRS}) -- target_link_libraries(rdkafka PUBLIC LZ4::LZ4) -+ target_link_libraries(rdkafka PUBLIC lz4::lz4) - endif() - - # Set up path to these sources for other sub-projects (tests, examples) diff --git a/recipes/librdkafka/all/patches/0002-Change-library-targets-and-result-variables-1-6-1.patch b/recipes/librdkafka/all/patches/0002-Change-library-targets-and-result-variables-1-6-1.patch deleted file mode 100644 index 0a478997b2373..0000000000000 --- a/recipes/librdkafka/all/patches/0002-Change-library-targets-and-result-variables-1-6-1.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -212,9 +212,7 @@ if(WITH_ZLIB) - endif() - - if(WITH_ZSTD) -- target_link_libraries(rdkafka PUBLIC ${ZSTD_LIBRARY}) -- target_include_directories(rdkafka PUBLIC ${ZSTD_INCLUDE_DIR}) -- message(STATUS "Found ZSTD: ${ZSTD_LIBRARY}") -+ target_link_libraries(rdkafka PUBLIC $,zstd::libzstd_shared,zstd::libzstd_static>) - endif() - - if(WITH_SSL) -@@ -253,8 +251,7 @@ if(WITH_LIBDL) - endif() - - if(WITH_LZ4_EXT) -- target_include_directories(rdkafka PUBLIC ${LZ4_INCLUDE_DIRS}) -- target_link_libraries(rdkafka PUBLIC LZ4::LZ4) -+ target_link_libraries(rdkafka PUBLIC lz4::lz4) - endif() - - # Set up path to these sources for other sub-projects (tests, examples) diff --git a/recipes/librdkafka/all/patches/0002-Change-library-targets-and-result-variables-1-7-0.patch b/recipes/librdkafka/all/patches/0002-Change-library-targets-and-result-variables-1-7-0.patch deleted file mode 100644 index 377bc8af8e437..0000000000000 --- a/recipes/librdkafka/all/patches/0002-Change-library-targets-and-result-variables-1-7-0.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 994ad21e1a136e11d1dc5870d991b034e41e6a4c Mon Sep 17 00:00:00 2001 -From: Alejandro Colomar -Date: Sun, 30 May 2021 11:08:36 +0200 -Subject: [PATCH] Change library targets and result variables - ---- - src/CMakeLists.txt | 7 ++----- - 1 file changed, 2 insertions(+), 5 deletions(-) - -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 6e24a238..4379c060 100644 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -198,9 +198,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) -@@ -239,8 +237,7 @@ if(WITH_LIBDL) - 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) --- -2.32.0.rc0 - 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/patches/0002-Change-library-targets-and-result-variables-2-3-0.patch b/recipes/librdkafka/all/patches/0002-Change-library-targets-and-result-variables-2-3-0.patch new file mode 100644 index 0000000000000..169e5bb94d3b2 --- /dev/null +++ b/recipes/librdkafka/all/patches/0002-Change-library-targets-and-result-variables-2-3-0.patch @@ -0,0 +1,24 @@ +iff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index cbcff50..38ad38e 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -215,9 +215,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) +@@ -257,7 +255,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/patches/0002-Change-library-targets-and-result-variables-2-5-0.patch b/recipes/librdkafka/all/patches/0002-Change-library-targets-and-result-variables-2-5-0.patch new file mode 100644 index 0000000000000..a862544f4da08 --- /dev/null +++ b/recipes/librdkafka/all/patches/0002-Change-library-targets-and-result-variables-2-5-0.patch @@ -0,0 +1,26 @@ +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index bbe63cf..44df7d1 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -224,9 +224,9 @@ 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>) ++# target_include_directories(rdkafka PRIVATE ${ZSTD_INCLUDE_DIR}) ++# message(STATUS "Found ZSTD: ${ZSTD_LIBRARY}") + endif() + + if(WITH_SSL) +@@ -266,7 +266,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/patches/0003-add-forward-declaration-2-5-0.patch b/recipes/librdkafka/all/patches/0003-add-forward-declaration-2-5-0.patch new file mode 100644 index 0000000000000..dbaef7d2d154f --- /dev/null +++ b/recipes/librdkafka/all/patches/0003-add-forward-declaration-2-5-0.patch @@ -0,0 +1,13 @@ +diff --git a/src/rdkafka_op.h b/src/rdkafka_op.h +index d79121e..d410a2b 100644 +--- a/src/rdkafka_op.h ++++ b/src/rdkafka_op.h +@@ -39,7 +39,7 @@ + typedef struct rd_kafka_q_s rd_kafka_q_t; + typedef struct rd_kafka_toppar_s rd_kafka_toppar_t; + typedef struct rd_kafka_op_s rd_kafka_op_t; +- ++typedef struct rd_kafka_broker_s rd_kafka_broker_t; + /* One-off reply queue + reply version. + * All APIs that take a rd_kafka_replyq_t makes a copy of the + * struct as-is and grabs hold of the existing .q refcount. diff --git a/recipes/librdkafka/config.yml b/recipes/librdkafka/config.yml index 6ba7bbcf8c0bf..fdc866ea2efee 100644 --- a/recipes/librdkafka/config.yml +++ b/recipes/librdkafka/config.yml @@ -1,17 +1,19 @@ versions: - "1.9.2": + "2.6.1": + folder: all + "2.6.0": folder: all - "1.9.1": + "2.5.3": folder: all - "1.8.2": + "2.5.0": folder: all - "1.8.0": + "2.4.0": folder: all - "1.7.0": + "2.3.0": folder: all - "1.6.1": + "2.2.0": folder: all - "1.6.0": + "2.0.2": folder: all - "1.5.3": + "1.9.2": folder: all diff --git a/recipes/librealsense/all/CMakeLists.txt b/recipes/librealsense/all/CMakeLists.txt deleted file mode 100644 index c70003c936d89..0000000000000 --- a/recipes/librealsense/all/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -find_package(libusb REQUIRED) -set(USB_FOUND TRUE) -add_library(usb INTERFACE IMPORTED GLOBAL) -target_link_libraries(usb INTERFACE libusb::libusb) - -add_subdirectory("source_subfolder") diff --git a/recipes/librealsense/all/conandata.yml b/recipes/librealsense/all/conandata.yml index 15076b23713cf..1f042ec677a64 100644 --- a/recipes/librealsense/all/conandata.yml +++ b/recipes/librealsense/all/conandata.yml @@ -1,4 +1,19 @@ sources: + "2.53.1": + source: + url: "https://github.com/IntelRealSense/librealsense/archive/refs/tags/v2.53.1.tar.gz" + sha256: "e09d0cca0316fa02427ce749c4e9cc8d34e3a86c127b32a8dca3ef483e71e908" + firmware: + - url: "https://librealsense.intel.com/Releases/RS4xx/FW/D4XX_FW_Image-5.14.0.0.bin" + sha256: "c956a583ee3fcea105c00164eb3a0aad28643f62d54c99ad80724dd7a6c038e8" + - url: "https://librealsense.intel.com/Releases/SR300/FW/SR3XX_FW_Image-3.26.1.0.bin" + sha256: "c4ac2144df13c3a64fca9d16c175595c903e6e45f02f0f238630a223b07c14d1" + - url: "https://librealsense.intel.com/Releases/TM2/FW/target/0.2.0.951/target-0.2.0.951.mvcmd" + sha256: "0265fd111611908b822cdaf4a3fe5b631c50539b2805d2f364c498aa71c007c0" + - url: "https://librealsense.intel.com/Releases/L5xx/FW/L51X_FW_Image-1.5.8.1.bin" + sha256: "87a9a91b613d9d807b2bfc424abe9cac63cad75dfc04718592c44777cb0b4452" + - url: "https://librealsense.intel.com/Releases/L5xx/FW/L53X_FW_Image-3.5.5.1.bin" + sha256: "b837b2cff2b270b89eed3c0b212ab4108389a20b6e07c19dd5957918ff9ce7e0" "2.49.0": source: url: "https://github.com/IntelRealSense/librealsense/archive/refs/tags/v2.49.0.tar.gz" @@ -15,10 +30,18 @@ sources: - url: "https://librealsense.intel.com/Releases/L5xx/FW/L53X_FW_Image-3.5.5.1.bin" sha256: "b837b2cff2b270b89eed3c0b212ab4108389a20b6e07c19dd5957918ff9ce7e0" patches: + "2.53.1": + - patch_file: "patches/2.53.1-0001-fix-cmake.patch" + - patch_file: "patches/2.53.1-0002-fix-avx-check.patch" + - patch_file: "patches/2.53.1-0003-fix-GUID_DEVINTERFACE_USB_DEVICE.patch" + patch_description: "Fix undefined ref to GUID_DEVINTERFACE_USB_DEVICE on Windows" + patch_type: "conan" "2.49.0": - - patch_file: "patches/2.49.0-fix-cmake.patch" - base_path: "source_subfolder" - - patch_file: "patches/2.49.0-fix-avx-check.patch" - base_path: "source_subfolder" - - patch_file: "patches/2.49.0-atlstr-removal.patch" - base_path: "source_subfolder" + - patch_file: "patches/2.49.0-0001-fix-cmake.patch" + - patch_file: "patches/2.49.0-0002-fix-avx-check.patch" + - patch_file: "patches/2.49.0-0003-atlstr-removal.patch" + patch_description: "Remove Windows ATL libraries usage because it's missing in CI of conancenter" + patch_type: "conan" + - patch_file: "patches/2.49.0-0004-fix-GUID_DEVINTERFACE_USB_DEVICE.patch" + patch_description: "Fix undefined ref to GUID_DEVINTERFACE_USB_DEVICE on Windows" + patch_type: "conan" diff --git a/recipes/librealsense/all/conanfile.py b/recipes/librealsense/all/conanfile.py index 31f48b1512211..3bc7e1c733c5a 100644 --- a/recipes/librealsense/all/conanfile.py +++ b/recipes/librealsense/all/conanfile.py @@ -1,7 +1,13 @@ -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, download, export_conandata_patches, get, rm, rmdir +from conan.tools.microsoft import is_msvc import os import urllib +required_conan_version = ">=1.53.0" + class LibrealsenseConan(ConanFile): name = "librealsense" @@ -10,7 +16,8 @@ class LibrealsenseConan(ConanFile): homepage = "https://github.com/IntelRealSense/librealsense" description = "Intel(R) RealSense(tm) Cross Platform API for accessing Intel RealSense cameras." topics = ("usb", "camera") - settings = "os", "compiler", "build_type", "arch" + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -23,19 +30,11 @@ class LibrealsenseConan(ConanFile): "tools": True, "rsusb_backend": True, # TODO: change to False when CI gets MSVC ATL support } - short_paths = True - generators = "cmake", "cmake_find_package" - exports_sources = ["CMakeLists.txt", "patches/*"] - _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": @@ -45,100 +44,103 @@ 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("libusb/1.0.24") + self.requires("libusb/1.0.26") def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 14) + check_min_cppstd(self, 14) def source(self): sources = self.conan_data["sources"][self.version] - tools.get(**sources["source"], strip_root=True, destination=self._source_subfolder) + get(self, **sources["source"], strip_root=True) for firmware in sources["firmware"]: filename = os.path.basename(urllib.parse.urlparse(firmware["url"]).path) - tools.download(filename=filename, **firmware) - - 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["CHECK_FOR_UPDATES"] = False - self._cmake.definitions["BUILD_WITH_STATIC_CRT"] = False - self._cmake.definitions["BUILD_EASYLOGGINGPP"] = False - self._cmake.definitions["BUILD_TOOLS"] = self.options.tools - self._cmake.definitions["BUILD_EXAMPLES"] = False - self._cmake.definitions["BUILD_GLSL_EXTENSIONS"] = False - self._cmake.definitions["BUILD_GRAPHICAL_EXAMPLES"] = False - self._cmake.definitions["BUILD_INTERNAL_UNIT_TESTS"] = False - self._cmake.definitions["BUILD_NETWORK_DEVICE"] = False - self._cmake.definitions["BUILD_UNIT_TESTS"] = False - self._cmake.definitions["BUILD_WITH_CUDA"] = False - self._cmake.definitions["BUILD_WITH_OPENMP"] = False - self._cmake.definitions["BUILD_WITH_TM2"] = True - self._cmake.definitions["BUILD_PYTHON_BINDINGS"] = False - self._cmake.definitions["BUILD_PYTHON_DOCS"] = False - self._cmake.definitions["BUILD_NODEJS_BINDINGS"] = False - self._cmake.definitions["BUILD_CV_EXAMPLES"] = False - self._cmake.definitions["BUILD_DLIB_EXAMPLES"] = False - self._cmake.definitions["BUILD_OPENVINO_EXAMPLES"] = False - self._cmake.definitions["BUILD_OPEN3D_EXAMPLES"] = False - self._cmake.definitions["BUILD_MATLAB_BINDINGS"] = False - self._cmake.definitions["BUILD_PCL_EXAMPLES"] = False - self._cmake.definitions["BUILD_UNITY_BINDINGS"] = False - self._cmake.definitions["BUILD_CSHARP_BINDINGS"] = False - self._cmake.definitions["BUILD_OPENNI2_BINDINGS"] = False - self._cmake.definitions["BUILD_CV_KINFU_EXAMPLE"] = False + download(self, filename=filename, **firmware) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CHECK_FOR_UPDATES"] = False + tc.variables["BUILD_WITH_STATIC_CRT"] = False + tc.variables["BUILD_EASYLOGGINGPP"] = False + tc.variables["BUILD_TOOLS"] = self.options.tools + tc.variables["BUILD_EXAMPLES"] = False + tc.variables["BUILD_GLSL_EXTENSIONS"] = False + tc.variables["BUILD_GRAPHICAL_EXAMPLES"] = False + tc.variables["BUILD_INTERNAL_UNIT_TESTS"] = False + tc.variables["BUILD_NETWORK_DEVICE"] = False + tc.variables["BUILD_UNIT_TESTS"] = False + tc.variables["BUILD_WITH_CUDA"] = False + tc.variables["BUILD_WITH_OPENMP"] = False + tc.variables["BUILD_WITH_TM2"] = True + tc.variables["BUILD_PYTHON_BINDINGS"] = False + tc.variables["BUILD_PYTHON_DOCS"] = False + tc.variables["BUILD_NODEJS_BINDINGS"] = False + tc.variables["BUILD_CV_EXAMPLES"] = False + tc.variables["BUILD_DLIB_EXAMPLES"] = False + tc.variables["BUILD_OPENVINO_EXAMPLES"] = False + tc.variables["BUILD_OPEN3D_EXAMPLES"] = False + tc.variables["BUILD_MATLAB_BINDINGS"] = False + tc.variables["BUILD_PCL_EXAMPLES"] = False + tc.variables["BUILD_UNITY_BINDINGS"] = False + tc.variables["BUILD_CSHARP_BINDINGS"] = False + tc.variables["BUILD_OPENNI2_BINDINGS"] = False + tc.variables["BUILD_CV_KINFU_EXAMPLE"] = False if self.settings.os == "Windows": - self._cmake.definitions["FORCE_RSUSB_BACKEND"] = self.options.rsusb_backend + tc.variables["FORCE_RSUSB_BACKEND"] = self.options.rsusb_backend + tc.generate() - self._cmake.configure(build_folder=self._build_subfolder) - 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("LICENSE", src=self._source_subfolder, dst="licenses", 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: - postfix = "d" if self.settings.compiler == "Visual Studio" and self.settings.build_type == "Debug" else "" - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "libfw{}.*".format(postfix)) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "librealsense-file{}.*".format(postfix)) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + postfix = "d" if is_msvc(self) and self.settings.build_type == "Debug" else "" + rm(self, f"libfw{postfix}.*", os.path.join(self.package_folder, "lib")) + rm(self, f"librealsense-file{postfix}.*", 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, "lib", "cmake")) def package_info(self): - postfix = "d" if self.settings.compiler == "Visual Studio" and self.settings.build_type == "Debug" else "" - - self.cpp_info.names["cmake_find_package"] = "realsense2" - self.cpp_info.names["cmake_find_package_multi"] = "realsense2" + self.cpp_info.set_property("cmake_file_name", "realsense2") + postfix = "d" if is_msvc(self) and self.settings.build_type == "Debug" else "" if not self.options.shared: - self.cpp_info.components["fw"].libs = ["fw" + postfix] - self.cpp_info.components["file"].libs = ["realsense-file" + postfix] - - self.cpp_info.components["realsense2"].libs = ["realsense2" + postfix] + self.cpp_info.components["fw"].set_property("cmake_target_name", "realsense2::fw") + self.cpp_info.components["fw"].libs = [f"fw{postfix}"] + self.cpp_info.components["realsense-file"].set_property("cmake_target_name", "realsense2::realsense-file") + self.cpp_info.components["realsense-file"].libs = [f"realsense-file{postfix}"] + + self.cpp_info.components["realsense2"].set_property("cmake_target_name", "realsense2::realsense2") + self.cpp_info.components["realsense2"].set_property("pkg_config_name", "realsense2") + self.cpp_info.components["realsense2"].libs = [f"realsense2{postfix}"] self.cpp_info.components["realsense2"].requires = ["libusb::libusb"] if not self.options.shared: - self.cpp_info.components["realsense2"].requires.extend(["file", "fw"]) - self.cpp_info.components["realsense2"].names["pkg_config"] = "realsense2" + self.cpp_info.components["realsense2"].requires.extend(["realsense-file", "fw"]) if self.settings.os == "Linux": self.cpp_info.components["realsense2"].system_libs.extend(["m", "pthread", "udev"]) elif self.settings.os == "Windows": self.cpp_info.components["realsense2"].system_libs.extend([ "cfgmgr32", "setupapi", - "sensorsapi", "PortableDeviceGuids", + "sensorsapi", "portabledeviceguids", "winusb", "shlwapi", "mf", "mfplat", "mfreadwrite", "mfuuid" ]) + + # TODO: to remove in conan v2 + self.cpp_info.names["cmake_find_package"] = "realsense2" + self.cpp_info.names["cmake_find_package_multi"] = "realsense2" diff --git a/recipes/librealsense/all/patches/2.49.0-0001-fix-cmake.patch b/recipes/librealsense/all/patches/2.49.0-0001-fix-cmake.patch new file mode 100644 index 0000000000000..19e6de7bccc77 --- /dev/null +++ b/recipes/librealsense/all/patches/2.49.0-0001-fix-cmake.patch @@ -0,0 +1,82 @@ +--- a/CMake/install_config.cmake ++++ b/CMake/install_config.cmake +@@ -48,4 +48,4 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/config/realsense2.pc" + DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig" + ) + +-install(CODE "execute_process(COMMAND ldconfig)") ++# install(CODE "execute_process(COMMAND ldconfig)") +--- a/CMake/libusb_config.cmake ++++ b/CMake/libusb_config.cmake +@@ -1,14 +1,5 @@ + if (NOT TARGET usb) +- find_library(LIBUSB_LIB usb-1.0) +- find_path(LIBUSB_INC libusb.h HINTS PATH_SUFFIXES libusb-1.0) +- include(FindPackageHandleStandardArgs) +- find_package_handle_standard_args(usb "libusb not found; using internal version" LIBUSB_LIB LIBUSB_INC) +- if (USB_FOUND AND NOT USE_EXTERNAL_USB) +- add_library(usb INTERFACE) +- target_include_directories(usb INTERFACE ${LIBUSB_INC}) +- target_link_libraries(usb INTERFACE ${LIBUSB_LIB}) +- else() +- include(CMake/external_libusb.cmake) +- endif() +- install(TARGETS usb EXPORT realsense2Targets) ++ find_package(libusb REQUIRED CONFIG) ++ add_library(usb INTERFACE IMPORTED) ++ set_property(TARGET usb PROPERTY INTERFACE_LINK_LIBRARIES libusb::libusb) + endif() +--- a/CMake/windows_config.cmake ++++ b/CMake/windows_config.cmake +@@ -57,8 +57,9 @@ macro(os_target_config) + if (NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR) + message("Preparing Windows 7 drivers" ) + make_directory(${CMAKE_CURRENT_BINARY_DIR}/drivers/) +- file(GLOB DRIVERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/src/win7/drivers/" "${CMAKE_CURRENT_SOURCE_DIR}/src/win7/drivers/*") +- foreach(item IN LISTS DRIVERS) ++ file(GLOB DRIVERS "${CMAKE_CURRENT_SOURCE_DIR}/src/win7/drivers/" "${CMAKE_CURRENT_SOURCE_DIR}/src/win7/drivers/*") ++ foreach(_driver_path IN LISTS DRIVERS) ++ get_filename_component(item ${_driver_path} NAME) + message("Copying ${CMAKE_CURRENT_SOURCE_DIR}/src/win7/drivers/${item} to ${CMAKE_CURRENT_BINARY_DIR}/drivers/" ) + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/win7/drivers/${item}" "${CMAKE_CURRENT_BINARY_DIR}/drivers/${item}" COPYONLY) + endforeach() +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.1.0) + project(librealsense2 LANGUAGES CXX C) + + include(CMake/lrs_options.cmake) +-include(CMake/connectivity_check.cmake) ++set(INTERNET_CONNECTION ON) + + #Deprecation message, should be removed in future releases + if(${FORCE_LIBUVC} OR ${FORCE_WINUSB_UVC} OR ${ANDROID_USB_HOST_UVC}) +--- a/common/fw/CMakeLists.txt ++++ b/common/fw/CMakeLists.txt +@@ -57,16 +57,16 @@ set_target_properties (${PROJECT_NAME} PROPERTIES FOLDER Resources) + + function(target_binary url version sha1 symbol ext) + set(binary "${CMAKE_CURRENT_BINARY_DIR}/${symbol}-${version}${ext}") +- message(STATUS "${url}/${symbol}-${version}${ext}") +- file(DOWNLOAD "${url}/${symbol}-${version}${ext}" "${binary}" +- EXPECTED_HASH SHA1=${sha1} +- STATUS status) +- list(GET status 0 error_code) +- if (NOT ${error_code} EQUAL 0) +- message(FATAL_ERROR "Download firmwnare (${status}) - ${url}") +- else() +- message(STATUS "Download firmware ${status} for ${symbol}-${version}${ext}") +- endif() ++ # message(STATUS "${url}/${symbol}-${version}${ext}") ++ file(COPY "${CMAKE_SOURCE_DIR}/${symbol}-${version}${ext}" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") ++ # EXPECTED_HASH SHA1=${sha1} ++ # STATUS status) ++ # list(GET status 0 error_code) ++ # if (NOT ${error_code} EQUAL 0) ++ # message(FATAL_ERROR "Download firmwnare (${status}) - ${url}") ++ # else() ++ # message(STATUS "Download firmware ${status} for ${symbol}-${version}${ext}") ++ # endif() + string(TOUPPER ${symbol} SYMBOL) + string(REPLACE "." "," version_commas ${version}) + string(REPLACE "\\" "\\\\" binary_escaped "${binary}") diff --git a/recipes/librealsense/all/patches/2.49.0-fix-avx-check.patch b/recipes/librealsense/all/patches/2.49.0-0002-fix-avx-check.patch similarity index 100% rename from recipes/librealsense/all/patches/2.49.0-fix-avx-check.patch rename to recipes/librealsense/all/patches/2.49.0-0002-fix-avx-check.patch diff --git a/recipes/librealsense/all/patches/2.49.0-atlstr-removal.patch b/recipes/librealsense/all/patches/2.49.0-0003-atlstr-removal.patch similarity index 100% rename from recipes/librealsense/all/patches/2.49.0-atlstr-removal.patch rename to recipes/librealsense/all/patches/2.49.0-0003-atlstr-removal.patch diff --git a/recipes/librealsense/all/patches/2.49.0-0004-fix-GUID_DEVINTERFACE_USB_DEVICE.patch b/recipes/librealsense/all/patches/2.49.0-0004-fix-GUID_DEVINTERFACE_USB_DEVICE.patch new file mode 100644 index 0000000000000..5993f3e0d4e20 --- /dev/null +++ b/recipes/librealsense/all/patches/2.49.0-0004-fix-GUID_DEVINTERFACE_USB_DEVICE.patch @@ -0,0 +1,14 @@ +--- a/src/win/win-helpers.cpp ++++ b/src/win/win-helpers.cpp +@@ -26,9 +26,9 @@ + #include // DEVPKEY_... + + //https://docs.microsoft.com/en-us/windows-hardware/drivers/usbcon/supported-usb-classes#microsoft-provided-usb-device-class-drivers +-#ifndef WITH_TRACKING ++// #ifndef WITH_TRACKING + DEFINE_GUID(GUID_DEVINTERFACE_USB_DEVICE, 0xA5DCBF10L, 0x6530, 0x11D2, 0x90, 0x1F, 0x00, 0xC0, 0x4F, 0xB9, 0x51, 0xED); +-#endif ++// #endif + DEFINE_GUID(GUID_DEVINTERFACE_IMAGE_WIN10, 0x6bdd1fc6L, 0x810f, 0x11d0, 0xbe, 0xc7, 0x08, 0x00, 0x2b, 0xe2, 0x09, 0x2f); + DEFINE_GUID(GUID_DEVINTERFACE_CAMERA_WIN10, 0xca3e7ab9, 0xb4c3, 0x4ae6, 0x82, 0x51, 0x57, 0x9e, 0xf9, 0x33, 0x89, 0x0f); + diff --git a/recipes/librealsense/all/patches/2.49.0-fix-cmake.patch b/recipes/librealsense/all/patches/2.49.0-fix-cmake.patch deleted file mode 100644 index a571906e24eca..0000000000000 --- a/recipes/librealsense/all/patches/2.49.0-fix-cmake.patch +++ /dev/null @@ -1,54 +0,0 @@ -diff --git a/CMake/install_config.cmake b/CMake/install_config.cmake -index 9f5666611..2ca5625ce 100644 ---- a/CMake/install_config.cmake -+++ b/CMake/install_config.cmake -@@ -48,4 +48,4 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/config/realsense2.pc" - DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig" - ) - --install(CODE "execute_process(COMMAND ldconfig)") -+# install(CODE "execute_process(COMMAND ldconfig)") -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 0c15d9510..2c55dbe7b 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.1.0) - project(librealsense2 LANGUAGES CXX C) - - include(CMake/lrs_options.cmake) --include(CMake/connectivity_check.cmake) -+set(INTERNET_CONNECTION ON) - - #Deprecation message, should be removed in future releases - if(${FORCE_LIBUVC} OR ${FORCE_WINUSB_UVC} OR ${ANDROID_USB_HOST_UVC}) -diff --git a/common/fw/CMakeLists.txt b/common/fw/CMakeLists.txt -index 2772f59d8..8214145fc 100644 ---- a/common/fw/CMakeLists.txt -+++ b/common/fw/CMakeLists.txt -@@ -57,16 +57,16 @@ set_target_properties (${PROJECT_NAME} PROPERTIES FOLDER Resources) - - function(target_binary url version sha1 symbol ext) - set(binary "${CMAKE_CURRENT_BINARY_DIR}/${symbol}-${version}${ext}") -- message(STATUS "${url}/${symbol}-${version}${ext}") -- file(DOWNLOAD "${url}/${symbol}-${version}${ext}" "${binary}" -- EXPECTED_HASH SHA1=${sha1} -- STATUS status) -- list(GET status 0 error_code) -- if (NOT ${error_code} EQUAL 0) -- message(FATAL_ERROR "Download firmwnare (${status}) - ${url}") -- else() -- message(STATUS "Download firmware ${status} for ${symbol}-${version}${ext}") -- endif() -+ # message(STATUS "${url}/${symbol}-${version}${ext}") -+ file(COPY "${CMAKE_SOURCE_DIR}/${symbol}-${version}${ext}" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") -+ # EXPECTED_HASH SHA1=${sha1} -+ # STATUS status) -+ # list(GET status 0 error_code) -+ # if (NOT ${error_code} EQUAL 0) -+ # message(FATAL_ERROR "Download firmwnare (${status}) - ${url}") -+ # else() -+ # message(STATUS "Download firmware ${status} for ${symbol}-${version}${ext}") -+ # endif() - string(TOUPPER ${symbol} SYMBOL) - string(REPLACE "." "," version_commas ${version}) - string(REPLACE "\\" "\\\\" binary_escaped "${binary}") diff --git a/recipes/librealsense/all/patches/2.53.1-0001-fix-cmake.patch b/recipes/librealsense/all/patches/2.53.1-0001-fix-cmake.patch new file mode 100644 index 0000000000000..b36abfb210bed --- /dev/null +++ b/recipes/librealsense/all/patches/2.53.1-0001-fix-cmake.patch @@ -0,0 +1,82 @@ +--- a/CMake/install_config.cmake ++++ b/CMake/install_config.cmake +@@ -48,4 +48,4 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/config/realsense2.pc" + DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig" + ) + +-install(CODE "execute_process(COMMAND ldconfig)") ++# install(CODE "execute_process(COMMAND ldconfig)") +--- a/CMake/libusb_config.cmake ++++ b/CMake/libusb_config.cmake +@@ -1,14 +1,5 @@ + if (NOT TARGET usb) +- find_library(LIBUSB_LIB usb-1.0) +- find_path(LIBUSB_INC libusb.h HINTS PATH_SUFFIXES libusb-1.0) +- include(FindPackageHandleStandardArgs) +- find_package_handle_standard_args(usb "libusb not found; using internal version" LIBUSB_LIB LIBUSB_INC) +- if (USB_FOUND AND NOT USE_EXTERNAL_USB) +- add_library(usb INTERFACE) +- target_include_directories(usb INTERFACE ${LIBUSB_INC}) +- target_link_libraries(usb INTERFACE ${LIBUSB_LIB}) +- else() +- include(CMake/external_libusb.cmake) +- endif() +- install(TARGETS usb EXPORT realsense2Targets) ++ find_package(libusb REQUIRED CONFIG) ++ add_library(usb INTERFACE IMPORTED) ++ set_property(TARGET usb PROPERTY INTERFACE_LINK_LIBRARIES libusb::libusb) + endif() +--- a/CMake/windows_config.cmake ++++ b/CMake/windows_config.cmake +@@ -57,8 +57,9 @@ macro(os_target_config) + if (NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR) + message("Preparing Windows 7 drivers" ) + make_directory(${CMAKE_CURRENT_BINARY_DIR}/drivers/) +- file(GLOB DRIVERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/src/win7/drivers/" "${CMAKE_CURRENT_SOURCE_DIR}/src/win7/drivers/*") +- foreach(item IN LISTS DRIVERS) ++ file(GLOB DRIVERS "${CMAKE_CURRENT_SOURCE_DIR}/src/win7/drivers/" "${CMAKE_CURRENT_SOURCE_DIR}/src/win7/drivers/*") ++ foreach(_driver_path IN LISTS DRIVERS) ++ get_filename_component(item ${_driver_path} NAME) + message("Copying ${CMAKE_CURRENT_SOURCE_DIR}/src/win7/drivers/${item} to ${CMAKE_CURRENT_BINARY_DIR}/drivers/" ) + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/win7/drivers/${item}" "${CMAKE_CURRENT_BINARY_DIR}/drivers/${item}" COPYONLY) + endforeach() +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -7,7 +7,7 @@ set(REPO_ROOT ${CMAKE_CURRENT_SOURCE_DIR}) + include_directories(${REPO_ROOT}) + + include(CMake/lrs_options.cmake) +-include(CMake/connectivity_check.cmake) ++set(INTERNET_CONNECTION ON) + #Deprecation message, should be removed in future releases + if(${FORCE_LIBUVC} OR ${FORCE_WINUSB_UVC} OR ${ANDROID_USB_HOST_UVC}) + MESSAGE(DEPRECATION "FORCE_LIBUVC, FORCE_WINUSB_UVC and ANDROID_USB_HOST_UVC are deprecated, use FORCE_RSUSB_BACKEND instead") +--- a/common/fw/CMakeLists.txt ++++ b/common/fw/CMakeLists.txt +@@ -64,16 +64,16 @@ set_target_properties (${PROJECT_NAME} PROPERTIES FOLDER Resources) + + function(target_binary url version sha1 symbol ext) + set(binary "${CMAKE_CURRENT_BINARY_DIR}/${symbol}-${version}${ext}") +- message(STATUS "${url}/${symbol}-${version}${ext}") +- file(DOWNLOAD "${url}/${symbol}-${version}${ext}" "${binary}" +- EXPECTED_HASH SHA1=${sha1} +- STATUS status) +- list(GET status 0 error_code) +- if (NOT ${error_code} EQUAL 0) +- message(FATAL_ERROR "Download firmwnare (${status}) - ${url}") +- else() +- message(STATUS "Download firmware ${status} for ${symbol}-${version}${ext}") +- endif() ++# message(STATUS "${url}/${symbol}-${version}${ext}") ++file(COPY "${CMAKE_SOURCE_DIR}/${symbol}-${version}${ext}" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") ++# EXPECTED_HASH SHA1=${sha1} ++# STATUS status) ++# list(GET status 0 error_code) ++# if (NOT ${error_code} EQUAL 0) ++# message(FATAL_ERROR "Download firmwnare (${status}) - ${url}") ++# else() ++# message(STATUS "Download firmware ${status} for ${symbol}-${version}${ext}") ++# endif() + string(TOUPPER ${symbol} SYMBOL) + string(REPLACE "." "," version_commas ${version}) + string(REPLACE "\\" "\\\\" binary_escaped "${binary}") diff --git a/recipes/librealsense/all/patches/2.53.1-0002-fix-avx-check.patch b/recipes/librealsense/all/patches/2.53.1-0002-fix-avx-check.patch new file mode 100644 index 0000000000000..f572d1d03056b --- /dev/null +++ b/recipes/librealsense/all/patches/2.53.1-0002-fix-avx-check.patch @@ -0,0 +1,13 @@ +diff --git a/src/proc/color-formats-converter.cpp b/src/proc/color-formats-converter.cpp +index cc0146a04..920b06c31 100644 +--- a/src/proc/color-formats-converter.cpp ++++ b/src/proc/color-formats-converter.cpp +@@ -18,7 +18,7 @@ + #include // For SSSE3 intrinsics + #endif + +-#if defined (ANDROID) || (defined (__linux__) && !defined (__x86_64__)) || (defined (__APPLE__) && !defined (__x86_64__)) ++#if defined (ANDROID) || !(defined (_M_IX86) || defined (__i386__)) || (defined (__APPLE__) && !defined (__x86_64__)) + + bool has_avx() { return false; } + diff --git a/recipes/librealsense/all/patches/2.53.1-0003-fix-GUID_DEVINTERFACE_USB_DEVICE.patch b/recipes/librealsense/all/patches/2.53.1-0003-fix-GUID_DEVINTERFACE_USB_DEVICE.patch new file mode 100644 index 0000000000000..5993f3e0d4e20 --- /dev/null +++ b/recipes/librealsense/all/patches/2.53.1-0003-fix-GUID_DEVINTERFACE_USB_DEVICE.patch @@ -0,0 +1,14 @@ +--- a/src/win/win-helpers.cpp ++++ b/src/win/win-helpers.cpp +@@ -26,9 +26,9 @@ + #include // DEVPKEY_... + + //https://docs.microsoft.com/en-us/windows-hardware/drivers/usbcon/supported-usb-classes#microsoft-provided-usb-device-class-drivers +-#ifndef WITH_TRACKING ++// #ifndef WITH_TRACKING + DEFINE_GUID(GUID_DEVINTERFACE_USB_DEVICE, 0xA5DCBF10L, 0x6530, 0x11D2, 0x90, 0x1F, 0x00, 0xC0, 0x4F, 0xB9, 0x51, 0xED); +-#endif ++// #endif + DEFINE_GUID(GUID_DEVINTERFACE_IMAGE_WIN10, 0x6bdd1fc6L, 0x810f, 0x11d0, 0xbe, 0xc7, 0x08, 0x00, 0x2b, 0xe2, 0x09, 0x2f); + DEFINE_GUID(GUID_DEVINTERFACE_CAMERA_WIN10, 0xca3e7ab9, 0xb4c3, 0x4ae6, 0x82, 0x51, 0x57, 0x9e, 0xf9, 0x33, 0x89, 0x0f); + diff --git a/recipes/librealsense/all/test_package/CMakeLists.txt b/recipes/librealsense/all/test_package/CMakeLists.txt index 3bf9e7c362597..9853eeb40e1a1 100644 --- a/recipes/librealsense/all/test_package/CMakeLists.txt +++ b/recipes/librealsense/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(realsense2 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} realsense2::realsense2) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE realsense2::realsense2) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/librealsense/all/test_package/conanfile.py b/recipes/librealsense/all/test_package/conanfile.py index 49a3a66ea5bad..98ab55852ad56 100644 --- a/recipes/librealsense/all/test_package/conanfile.py +++ b/recipes/librealsense/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 = "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/librealsense/all/test_v1_package/CMakeLists.txt b/recipes/librealsense/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/librealsense/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/librealsense/all/test_v1_package/conanfile.py b/recipes/librealsense/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/librealsense/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/librealsense/config.yml b/recipes/librealsense/config.yml index 3505cc5770e1a..28458effcc8e9 100644 --- a/recipes/librealsense/config.yml +++ b/recipes/librealsense/config.yml @@ -1,3 +1,5 @@ versions: + "2.53.1": + folder: all "2.49.0": folder: all diff --git a/recipes/libressl/all/CMakeLists.txt b/recipes/libressl/all/CMakeLists.txt deleted file mode 100644 index de350ebd519a2..0000000000000 --- a/recipes/libressl/all/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -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/libressl/all/conandata.yml b/recipes/libressl/all/conandata.yml index 8d70158fca32f..c4fc1016c6f77 100644 --- a/recipes/libressl/all/conandata.yml +++ b/recipes/libressl/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.9.1": + url: "https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-3.9.1.tar.gz" + sha256: "6da0b954695f7ee62b03f64200a8a4f02af93717b60cce04ab6c8df262c07a51" "3.5.3": url: "https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-3.5.3.tar.gz" sha256: "3ab5e5eaef69ce20c6b170ee64d785b42235f48f2e62b095fca5d7b6672b8b28" diff --git a/recipes/libressl/all/conanfile.py b/recipes/libressl/all/conanfile.py index 9a8502155e59c..01fe7dba222cd 100644 --- a/recipes/libressl/all/conanfile.py +++ b/recipes/libressl/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.cmake import CMake, CMakeToolchain, cmake_layout +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 glob import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class LibreSSLConan(ConanFile): @@ -21,6 +24,7 @@ class LibreSSLConan(ConanFile): provides = "openssl" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -31,68 +35,62 @@ class LibreSSLConan(ConanFile): "fPIC": True, } - exports_sources = "CMakeLists.txt" - 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 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): + cmake_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("Static runtime linked into shared LibreSSL not supported") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - if tools.Version(self.version) >= "3.1.1": - tools.replace_in_file( - os.path.join(self._source_subfolder, "CMakeLists.txt"), - "cmake_minimum_required (VERSION 3.16.4)", - "cmake_minimum_required (VERSION 3.15.6)" + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["LIBRESSL_SKIP_INSTALL"] = False + tc.variables["LIBRESSL_APPS"] = False # Warning: if enabled, do not use cmake installation, to avoid installing files in OPENSSLDIR + tc.variables["LIBRESSL_TESTS"] = False + tc.variables["ENABLE_ASM"] = True + tc.variables["ENABLE_EXTRATESTS"] = False + tc.variables["ENABLE_NC"] = False + tc.variables["OPENSSLDIR"] = "res" + if is_msvc(self): + tc.preprocessor_definitions["_CRT_SUPPRESS_RESTRICT"] = 1 + tc.generate() + + def _patch_sources(self): + if Version(self.version) >= "3.1.1": + replace_in_file( + self, os.path.join(self.source_folder, "CMakeLists.txt"), + "cmake_minimum_required (VERSION 3.16.4)", + "cmake_minimum_required (VERSION 3.15.6)", ) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["LIBRESSL_SKIP_INSTALL"] = False - self._cmake.definitions["LIBRESSL_APPS"] = False # Warning: if enabled, do not use cmake installation, to avoid installing files in OPENSSLDIR - self._cmake.definitions["LIBRESSL_TESTS"] = False - self._cmake.definitions["ENABLE_ASM"] = True - self._cmake.definitions["ENABLE_EXTRATESTS"] = False - self._cmake.definitions["ENABLE_NC"] = False - self._cmake.definitions["OPENSSLDIR"] = os.path.join(self.package_folder, "res") - self._cmake.configure() - return self._cmake - def build(self): - cmake = self._configure_cmake() + self._patch_sources() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("*COPYING", dst="licenses", keep_path=False) - 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.remove_files_by_mask(os.path.join(self.package_folder, "include"), "*.cmake") - tools.rmdir(os.path.join(self.package_folder, "include", "CMakeFiles")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) + rm(self, "*.cmake", os.path.join(self.package_folder, "include")) + rmdir(self, os.path.join(self.package_folder, "include", "CMakeFiles")) + 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_find_mode", "both") @@ -103,25 +101,28 @@ def package_info(self): self.cpp_info.components["crypto"].set_property("cmake_target_name", "LibreSSL::Crypto") self.cpp_info.components["crypto"].set_property("pkg_config_name", "libcrypto") self.cpp_info.components["crypto"].libs = [self._lib_name("crypto")] + self.cpp_info.components["crypto"].resdirs = ["res"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["crypto"].system_libs = ["pthread", "rt"] elif self.settings.os == "SunOS": self.cpp_info.components["crypto"].system_libs = ["nsl", "socket"] elif self.settings.os == "Windows": self.cpp_info.components["crypto"].system_libs = ["ws2_32"] - if tools.Version(self.version) >= "3.3.0": + if Version(self.version) >= "3.3.0": self.cpp_info.components["crypto"].system_libs.append("bcrypt") # SSL self.cpp_info.components["ssl"].set_property("cmake_target_name", "LibreSSL::SSL") self.cpp_info.components["ssl"].set_property("pkg_config_name", "libssl") self.cpp_info.components["ssl"].libs = [self._lib_name("ssl")] + self.cpp_info.components["ssl"].resdirs = ["res"] self.cpp_info.components["ssl"].requires = ["crypto"] # TLS self.cpp_info.components["tls"].set_property("cmake_target_name", "LibreSSL::TLS") self.cpp_info.components["tls"].set_property("pkg_config_name", "libtls") self.cpp_info.components["tls"].libs = [self._lib_name("tls")] + self.cpp_info.components["tls"].resdirs = ["res"] self.cpp_info.components["tls"].requires = ["crypto", "ssl"] # TODO: to remove in conan v2 once cmake_find_package_* generators removed @@ -136,10 +137,10 @@ def package_info(self): self.cpp_info.components["tls"].names["cmake_find_package_multi"] = "TLS" def _lib_name(self, name): - libressl_version = tools.Version(self.version) + libressl_version = Version(self.version) if self.settings.os == "Windows" and \ (libressl_version >= "3.1.0" or (libressl_version < "3.1.0" and self.options.shared)): - lib_fullpath = glob.glob(os.path.join(self.package_folder, "lib", "*{}*".format(name)))[0] + lib_fullpath = glob.glob(os.path.join(self.package_folder, "lib", f"*{name}*"))[0] lib_name = os.path.basename(lib_fullpath).split(".")[0].replace("lib", "") return lib_name return name diff --git a/recipes/libressl/all/test_package/CMakeLists.txt b/recipes/libressl/all/test_package/CMakeLists.txt index 7bc887201a50d..af51f6d63a4cc 100644 --- a/recipes/libressl/all/test_package/CMakeLists.txt +++ b/recipes/libressl/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(LibreSSL REQUIRED) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} LibreSSL::SSL) +target_link_libraries(${PROJECT_NAME} PRIVATE LibreSSL::SSL) diff --git a/recipes/libressl/all/test_package/conanfile.py b/recipes/libressl/all/test_package/conanfile.py index 19e6a0c06e3d8..0a6bc68712d90 100644 --- a/recipes/libressl/all/test_package/conanfile.py +++ b/recipes/libressl/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/libressl/all/test_v1_package/CMakeLists.txt b/recipes/libressl/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libressl/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/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-loader/all/test_v1_package/conanfile.py b/recipes/libressl/all/test_v1_package/conanfile.py similarity index 100% rename from recipes/vulkan-loader/all/test_v1_package/conanfile.py rename to recipes/libressl/all/test_v1_package/conanfile.py diff --git a/recipes/libressl/config.yml b/recipes/libressl/config.yml index bfca6d19b58d7..10de737dfb8f5 100644 --- a/recipes/libressl/config.yml +++ b/recipes/libressl/config.yml @@ -1,4 +1,6 @@ versions: + "3.9.1": + folder: all "3.5.3": folder: all "3.5.2": diff --git a/recipes/librhash/all/CMakeLists.txt b/recipes/librhash/all/CMakeLists.txt new file mode 100644 index 0000000000000..5a8989c04fb68 --- /dev/null +++ b/recipes/librhash/all/CMakeLists.txt @@ -0,0 +1,48 @@ +# Based on https://github.com/rhash/RHash/pull/103 +cmake_minimum_required(VERSION 3.15) +project(rhash LANGUAGES C) + +file(READ "${CMAKE_CURRENT_SOURCE_DIR}/../version.h" versionfile) +string(REGEX MATCH "#define VERSION \"([0-9]*)\.([0-9]*)\.([0-9]*)\"" _ ${versionfile}) +set(RHASH_VERSION_MAJOR ${CMAKE_MATCH_1}) +set(RHASH_VERSION_MINOR ${CMAKE_MATCH_2}) +set(RHASH_VERSION_PATCH ${CMAKE_MATCH_3}) +set(RHASH_VERSION "${RHASH_VERSION_MAJOR}.${RHASH_VERSION_MINOR}.${RHASH_VERSION_PATCH}") + +option(USE_OPENSSL "Enable OpenSSL (optimized hash functions) support" ON) + +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) + +# Get the list of source files from the Makefile +# https://github.com/rhash/RHash/blob/v1.4.4/librhash/Makefile#L6 +file(READ Makefile MAKEFILE_CONTENTS) +if("${MAKEFILE_CONTENTS}" MATCHES "SOURCES *= *([^\n]+)") + string(REPLACE " " ";" SOURCE_FILES ${CMAKE_MATCH_1}) +else() + message(FATAL_ERROR "SOURCES line not found in Makefile") +endif() + +add_library(rhash ${SOURCE_FILES}) + +if(USE_OPENSSL) + find_package(OpenSSL REQUIRED) + target_link_libraries(rhash OpenSSL::Crypto) + target_compile_definitions(rhash PUBLIC USE_OPENSSL) +endif() + +if(MSVC) + target_compile_definitions(rhash PRIVATE _CRT_SECURE_NO_DEPRECATE) +endif() + +set_target_properties(rhash PROPERTIES + COMPILE_DEFINITIONS IN_RHASH + DEFINE_SYMBOL RHASH_EXPORTS + VERSION ${RHASH_VERSION} + SOVERSION ${RHASH_VERSION_MAJOR}) + +install(TARGETS rhash + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) + +install(FILES "rhash.h" "rhash_torrent.h" DESTINATION include) diff --git a/recipes/librhash/all/conandata.yml b/recipes/librhash/all/conandata.yml index 7551a33f27039..86c6f3d9822c3 100644 --- a/recipes/librhash/all/conandata.yml +++ b/recipes/librhash/all/conandata.yml @@ -1,11 +1,10 @@ sources: + "1.4.4": + url: "https://downloads.sourceforge.net/project/rhash/rhash/1.4.4/rhash-1.4.4-src.tar.gz" + sha256: "8e7d1a8ccac0143c8fe9b68ebac67d485df119ea17a613f4038cda52f84ef52a" "1.4.2": url: "https://downloads.sourceforge.net/project/rhash/rhash/1.4.2/rhash-1.4.2-src.tar.gz" sha256: "600d00f5f91ef04194d50903d3c79412099328c42f28ff43a0bdb777b00bec62" "1.3.9": url: "https://downloads.sourceforge.net/project/rhash/rhash/1.3.9/rhash-1.3.9-src.tar.gz" sha256: "42b1006f998adb189b1f316bf1a60e3171da047a85c4aaded2d0d26c1476c9f6" -patches: - "1.4.2": - - patch_file: "patches/0001-1.4.2-fix-compiler-detection.patch" - base_path: "source_subfolder" diff --git a/recipes/librhash/all/conanfile.py b/recipes/librhash/all/conanfile.py index 5528b9c183b00..a7af280fa7f51 100644 --- a/recipes/librhash/all/conanfile.py +++ b/recipes/librhash/all/conanfile.py @@ -1,17 +1,23 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, tools -from conans.errors import ConanInvalidConfiguration import os -required_conan_version = ">=1.33.0" +from conan import ConanFile +from conan.tools.cmake import CMakeToolchain, CMakeDeps, CMake +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" class LibRHashConan(ConanFile): name = "librhash" description = "Great utility for computing hash sums" - topics = ("rhash", "hash", "checksum") + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "http://rhash.sourceforge.net/" - license = "MIT" + topics = ("rhash", "hash", "checksum") + + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -24,98 +30,64 @@ class LibRHashConan(ConanFile): "with_openssl": 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) + def export_sources(self): + copy(self, "CMakeLists.txt", self.recipe_folder, os.path.join(self.export_sources_folder, "src", "librhash")) + 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 requirements(self): if self.options.with_openssl: - self.requires("openssl/1.1.1q") - - 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 validate(self): - if self.settings.compiler == "Visual Studio": - raise ConanInvalidConfiguration("Visual Studio is not supported") + self.requires("openssl/[>=1.1 <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, win_bash=tools.os_info.is_windows) - if self.settings.compiler in ("apple-clang", ): - if self.settings.arch in ("armv7", ): - self._autotools.link_flags.append("-arch armv7") - elif self.settings.arch in ("armv8", ): - self._autotools.link_flags.append("-arch arm64") - vars = self._autotools.vars - conf_args = [ - # librhash's configure script does not understand `--enable-opt1=yes` - "--enable-openssl" if self.options.with_openssl else "--disable-openssl", - "--disable-gettext", - # librhash's configure script is custom and does not understand "--bindir=${prefix}/bin" arguments - "--prefix={}".format(tools.unix_path(self.package_folder)), - "--bindir={}".format(tools.unix_path(os.path.join(self.package_folder, "bin"))), - "--libdir={}".format(tools.unix_path(os.path.join(self.package_folder, "lib"))), - # the configure script does not use CPPFLAGS, so add it to CFLAGS/CXXFLAGS - "--extra-cflags={}".format("{} {}".format(vars["CFLAGS"], vars["CPPFLAGS"])), - "--extra-ldflags={}".format(vars["LDFLAGS"]), - ] - if self.options.shared: - conf_args.extend(["--enable-lib-shared", "--disable-lib-static"]) - else: - conf_args.extend(["--disable-lib-shared", "--enable-lib-static"]) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - with tools.environment_append({ - "BUILD_TARGET": tools.get_gnu_triplet(str(self.settings.os), str(self.settings.arch), str(self.settings.compiler)), - }): - self._autotools.configure(args=conf_args, use_default_install_dirs=False, build=False, host=False) - return self._autotools + @property + def _xversion(self): + # https://github.com/rhash/RHash/blob/v1.4.4/configure#L339 + version = Version(self.version) + return f"0x{version.major.value:02x}{version.minor.value:02x}{version.patch.value:02x}{0:02x}" + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["USE_OPENSSL"] = self.options.with_openssl + tc.preprocessor_definitions["RHASH_XVERSION"] = self._xversion + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - with tools.chdir(self._source_subfolder): - autotools = self._configure_autotools() - autotools.make() + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, "librhash")) + cmake.build() def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") - with tools.chdir(self._source_subfolder): - autotools = self._configure_autotools() - autotools.install() - autotools.make(target="install-lib-headers") - with tools.chdir("librhash"): - if self.options.shared: - autotools.make(target="install-so-link") - tools.rmdir(os.path.join(self.package_folder, "bin")) - tools.rmdir(os.path.join(self.package_folder, "etc")) - tools.rmdir(os.path.join(self.package_folder, "share")) + 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.set_property("cmake_file_name", "LibRHash") + self.cpp_info.set_property("cmake_target_name", "LibRHash::LibRHash") + self.cpp_info.set_property("pkg_config_name", "librhash") + self.cpp_info.libs = ["rhash"] + self.cpp_info.defines.append(f"RHASH_XVERSION={self._xversion}") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.names["cmake_find_package"] = "LibRHash" self.cpp_info.names["cmake_find_package_multi"] = "LibRHash" - self.cpp_info.names["pkg_config"] = "librhash" - self.cpp_info.libs = ["rhash"] diff --git a/recipes/librhash/all/patches/0001-1.4.2-fix-compiler-detection.patch b/recipes/librhash/all/patches/0001-1.4.2-fix-compiler-detection.patch deleted file mode 100644 index f6e51246e4dea..0000000000000 --- a/recipes/librhash/all/patches/0001-1.4.2-fix-compiler-detection.patch +++ /dev/null @@ -1,29 +0,0 @@ -Revert compiler detection to state of 1.3.9 - ---- configure -+++ configure -@@ -513,14 +513,9 @@ - CC_TMP="$CC" - test -n "$OPT_CC" && OTHER_CC= || OTHER_CC="gcc cc" - for CC in "$CC_TMP" $OTHER_CC; do -- cc_name_tmp= - if run_cmd "$CC -v"; then - cc_name_tmp=$($CC -v 2>&1 | tail -n 1 | cut -d ' ' -f 1) -- elif run_cmd "$CC --version"; then -- cc_name_tmp=$($CC --version 2>&1 | head -n 1 | cut -d ' ' -f 1) -- fi -- if test -n "${cc_name_tmp}"; then -- if echo "$cc_name_tmp" | grep -q "gcc"; then -+ if test "$cc_name_tmp" = "gcc"; then - cc_name=$cc_name_tmp - start_check "$CC version" - cc_vendor=gnu -@@ -544,7 +539,7 @@ - finish_check "$cc_name $cc_version" - break - fi -- if echo "$cc_name_tmp" | grep -q "clang"; then -+ if $CC -v 2>&1 | grep -q "clang"; then - start_check "$CC version" - cc_vendor=clang - cc_version=$($CC -dumpversion 2>&1) diff --git a/recipes/librhash/all/test_package/CMakeLists.txt b/recipes/librhash/all/test_package/CMakeLists.txt index 80f208bb6a15a..f1b9a5e0be249 100644 --- a/recipes/librhash/all/test_package/CMakeLists.txt +++ b/recipes/librhash/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ -cmake_minimum_required(VERSION 3.3) +cmake_minimum_required(VERSION 3.15) project(test_package C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(LibRHash CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.c) diff --git a/recipes/librhash/all/test_package/conanfile.py b/recipes/librhash/all/test_package/conanfile.py index 2c7657d70d5d9..ef5d7042163ec 100644 --- a/recipes/librhash/all/test_package/conanfile.py +++ b/recipes/librhash/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 SolaceTestConan(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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/librhash/all/test_v1_package/CMakeLists.txt b/recipes/librhash/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/librhash/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/librhash/all/test_v1_package/conanfile.py b/recipes/librhash/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..2c7657d70d5d9 --- /dev/null +++ b/recipes/librhash/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class SolaceTestConan(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/librhash/config.yml b/recipes/librhash/config.yml index 24eb5d89c9135..334d34ca8c5c1 100644 --- a/recipes/librhash/config.yml +++ b/recipes/librhash/config.yml @@ -1,4 +1,6 @@ versions: + 1.4.4: + folder: all 1.4.2: folder: all 1.3.9: diff --git a/recipes/librttopo/all/conanfile.py b/recipes/librttopo/all/conanfile.py index 542adb14927a1..a6752906fedc2 100644 --- a/recipes/librttopo/all/conanfile.py +++ b/recipes/librttopo/all/conanfile.py @@ -4,7 +4,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.0" class LibrttopoConan(ConanFile): @@ -14,10 +14,11 @@ class LibrttopoConan(ConanFile): "standard (ISO 13249 aka SQL/MM) topologies." ) license = "GPL-2.0-or-later" - topics = ("librttopo", "topology", "geospatial", "gis") + topics = ("topology", "geospatial", "gis") homepage = "https://git.osgeo.org/gitea/rttopo/librttopo" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -36,25 +37,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 requirements(self): - self.requires("geos/3.11.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): + self.requires("geos/3.12.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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/librttopo/all/test_package/conanfile.py b/recipes/librttopo/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/librttopo/all/test_package/conanfile.py +++ b/recipes/librttopo/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/librttopo/all/test_v1_package/CMakeLists.txt b/recipes/librttopo/all/test_v1_package/CMakeLists.txt index 9f3cc8b4782d6..0d20897301b68 100644 --- a/recipes/librttopo/all/test_v1_package/CMakeLists.txt +++ b/recipes/librttopo/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(librttopo REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE librttopo::librttopo) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libsafec/all/conandata.yml b/recipes/libsafec/all/conandata.yml index 469b7183d9644..35e3bff5ed08e 100644 --- a/recipes/libsafec/all/conandata.yml +++ b/recipes/libsafec/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.7.1": + url: "https://github.com/rurban/safeclib/archive/v3.7.1.tar.gz" + sha256: "baac28b60f8f46ae0f273155f4968b20e84380016629247ed2a4d7e3fbeb4d98" "3.6.0": url: "https://github.com/rurban/safeclib/archive/v3.6.tar.gz" sha256: "bd99d4555030719a83807649b3749bc483143b3548278daaa0a4af0fed5dc4de" diff --git a/recipes/libsafec/all/conanfile.py b/recipes/libsafec/all/conanfile.py index 5e2784dc36adc..5d916353ec3b4 100644 --- a/recipes/libsafec/all/conanfile.py +++ b/recipes/libsafec/all/conanfile.py @@ -1,112 +1,131 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, tools -from conans.errors import ConanInvalidConfiguration import os -required_conan_version = ">=1.33.0" +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration, ConanException +from conan.tools.apple import is_apple_os, fix_apple_shared_install_name +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import chdir, 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 +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" class LibSafeCConan(ConanFile): name = "libsafec" - description = "This library implements the secure C11 Annex K[^5] functions" \ - " on top of most libc implementations, which are missing from them." + description = ("This library implements the secure C11 Annex K functions" + " on top of most libc implementations, which are missing from them.") + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/rurban/safeclib" - license = "MIT" - topics = ("safec", "libc", "bounds-checking") + topics = ("safec", "libc", "bounds-checking", "pre-built") + package_type = "library" settings = "os", "arch", "compiler", "build_type" 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 - def _source_subfolder(self): - return "source_subfolder" - @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 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("libtool/2.4.6") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_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 return 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): + basic_layout(self, src_folder="src") + 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)") + if is_apple_os(self) and self.settings.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 build_requirements(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) + 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, 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" - args = [ - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - "--enable-debug={}".format(yes_no(self.settings.build_type == "Debug")), + tc.configure_args += [ + f"--enable-debug={yes_no(self.settings.build_type == 'Debug')}", "--disable-doc", "--disable-Werror", + f"--enable-strmax={self.options.strmax}", + f"--enable-memmax={self.options.memmax}", ] - self._autotools.configure(args=args, configure_dir=self._source_subfolder) - return self._autotools + tc.generate() def build(self): - 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.make() + with chdir(self, self.source_folder): + 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() - 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", 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, "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.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") + + if Version(self.version) >= "3.7.0": + self.cpp_info.includedirs.append(os.path.join("include", "safeclib")) + self.cpp_info.libs = ["safec"] + else: + self.cpp_info.includedirs.append(os.path.join("include", "libsafec")) + self.cpp_info.libs = [f"safec-{self.version}"] bin_dir = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_dir)) self.env_info.PATH.append(bin_dir) diff --git a/recipes/libsafec/all/test_package/CMakeLists.txt b/recipes/libsafec/all/test_package/CMakeLists.txt index 31762006efa77..2a28db28a9c5d 100644 --- a/recipes/libsafec/all/test_package/CMakeLists.txt +++ b/recipes/libsafec/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ -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() +find_package(libsafec REQUIRED CONFIG) add_executable(test_package test_package.c) -target_link_libraries(test_package ${CONAN_LIBS}) +target_link_libraries(test_package PRIVATE libsafec::libsafec) diff --git a/recipes/libsafec/all/test_package/conanfile.py b/recipes/libsafec/all/test_package/conanfile.py index b7cd0e8fa4f62..ef5d7042163ec 100644 --- a/recipes/libsafec/all/test_package/conanfile.py +++ b/recipes/libsafec/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_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): - bin_path = os.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/libsafec/all/test_v1_package/CMakeLists.txt b/recipes/libsafec/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/libsafec/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/libsafec/all/test_v1_package/conanfile.py b/recipes/libsafec/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..043b77522562f --- /dev/null +++ b/recipes/libsafec/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import CMake, ConanFile, 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/libsafec/config.yml b/recipes/libsafec/config.yml index 31ef12415e244..a68f215fba33a 100644 --- a/recipes/libsafec/config.yml +++ b/recipes/libsafec/config.yml @@ -1,3 +1,5 @@ versions: + "3.7.1": + folder: all "3.6.0": folder: all 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..5342c615e4072 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): @@ -16,10 +16,11 @@ class LibsamplerateConan(ConanFile): "performing sample rate conversion of audio data." ) license = "BSD-2-Clause" - topics = ("libsamplerate", "audio", "resample-audio-files") + topics = ("audio", "resample-audio-files") homepage = "https://github.com/libsndfile/libsamplerate" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -36,38 +37,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 - - 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") + 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 build_requirements(self): + if is_apple_os(self) and self.options.shared and Version(self.version) >= "0.2.2": + # see https://github.com/libsndfile/libsamplerate/blob/0.2.2/src/CMakeLists.txt#L110-L119 + self.tool_requires("cmake/[>=3.17 <4]") + 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/conandata.yml b/recipes/libsass/all/conandata.yml index a3583eec521db..0d7398fa561ea 100644 --- a/recipes/libsass/all/conandata.yml +++ b/recipes/libsass/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.6.6": + url: "https://github.com/sass/libsass/archive/3.6.6.tar.gz" + sha256: "11f0bb3709a4f20285507419d7618f3877a425c0131ea8df40fe6196129df15d" "3.6.5": url: "https://github.com/sass/libsass/archive/3.6.5.tar.gz" sha256: "89d8f2c46ae2b1b826b58ce7dde966a176bac41975b82e84ad46b01a55080582" diff --git a/recipes/libsass/all/conanfile.py b/recipes/libsass/all/conanfile.py index 374c7b2afb2fd..9bc7cc167e99f 100644 --- a/recipes/libsass/all/conanfile.py +++ b/recipes/libsass/all/conanfile.py @@ -1,36 +1,34 @@ 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 +from conan.tools.build import stdcpp_library +from conan.tools.files import chdir, copy, get, 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 MSBuild, MSBuildToolchain, is_msvc import os import re -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class LibsassConan(ConanFile): name = "libsass" + description = "A C/C++ implementation of a Sass compiler" license = "MIT" - homepage = "libsass.org" url = "https://github.com/conan-io/conan-center-index" - description = "A C/C++ implementation of a Sass compiler" - topics = ("Sass", "LibSass", "compiler") - settings = "os", "compiler", "build_type", "arch" + homepage = "libsass.org" + topics = ("Sass", "compiler") + + 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, } - _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" @@ -41,107 +39,134 @@ 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.os != "Windows": self.tool_requires("libtool/2.4.7") def source(self): - get(self, **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) - args = [] - args.append("--disable-tests") - args.append("--enable-%s" % ("shared" if self.options.shared else "static")) - args.append("--disable-%s" % ("static" if self.options.shared else "shared")) - self._autotools.configure(args=args) - return self._autotools - - def _build_autotools(self): - 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() + get(self, **self.conan_data["sources"][self.version], strip_root=True) @property - def _make_program(self): - return tools.get_env("CONAN_MAKE_PROGRAM", tools.which("make") or tools.which("mingw32-make")) - - def _build_mingw(self): - makefile = os.path.join(self._source_subfolder, "Makefile") - 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", - "PREFIX": tools.unix_path(os.path.join(self.package_folder)), + def _msbuild_configuration(self): + return "Debug" if self.settings.build_type == "Debug" else "Release" + + def generate(self): + if not is_msvc(self): + tc = AutotoolsToolchain(self) + tc.configure_args += ["--disable-tests"] + env = tc.environment() + if self._is_mingw: + env.define("BUILD", "shared" if self.options.shared else "static") # Don't force static link to mingw libs, leave this decision to consumer (through LDFLAGS in env) - "STATIC_ALL": "0", - "STATIC_LIBGCC": "0", - "STATIC_LIBSTDCPP": "0", - }) - with tools.environment_append(env_vars): - self.run(f"{self._make_program} -f Makefile") - - def _build_visual_studio(self): - 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", - } - platforms = { - "x86": "Win32", - "x86_64": "Win64" - } - msbuild = MSBuild(self) - msbuild.build(os.path.join("win", "libsass.sln"), platforms=platforms, properties=properties) + env.define("STATIC_ALL", "0") + env.define("STATIC_LIBGCC", "0") + env.define("STATIC_LIBSTDCPP", "0") + tc.generate(env) + else: + with chdir(self, self.source_folder): + tc = MSBuildToolchain(self) + tc.configuration = self._msbuild_configuration + tc.platform = "Win32" if self.settings.arch == "x86" else "Win64" + tc.properties["LIBSASS_STATIC_LIB"] = "" if self.options.shared else "true" + wpo_enabled = any(re.finditer("(^| )[/-]GL($| )", os.environ.get("CFLAGS", ""))) + tc.properties["WholeProgramOptimization"] = "true" if wpo_enabled else "false" + tc.generate() + + def _patch_sources(self): + if is_msvc(self): + # TODO: to remove once https://github.com/conan-io/conan/pull/12817 available in conan client + 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'' + vcxproj_file = os.path.join(self.source_folder, "win", "libsass.vcxproj") + for exiting_toolset in ["v120", "v140", "v141", "v142", "v143"]: + replace_in_file(self, vcxproj_file, + f"{exiting_toolset}", + f"{platform_toolset}", strict=False) + # Inject VS 2022 support + replace_in_file(self, vcxproj_file, + '\n' + f' {platform_toolset}\n' + '\n' + '', + f'msbuild/2003">\n{import_conan_generators}') + else: + makefile = os.path.join(self.source_folder, "Makefile") + replace_in_file(self, makefile, "+= -O2", "+=") def build(self): - if self._is_mingw: - self._build_mingw() - elif is_msvc(self): - self._build_visual_studio() - else: - self._build_autotools() + self._patch_sources() + with chdir(self, self.source_folder): + if is_msvc(self): + msbuild = MSBuild(self) + msbuild.build_type = self._msbuild_configuration + msbuild.platform = "Win32" if self.settings.arch == "x86" else "Win64" + msbuild.build(sln=os.path.join("win", "libsass.sln")) + else: + save(self, path="VERSION", content=f"{self.version}") + autotools = Autotools(self) + autotools.autoreconf() + autotools.configure() + autotools.make() def _install_autotools(self): - with chdir(self, self._source_subfolder): - autotools = self._configure_autotools() + with chdir(self, self.source_folder): + autotools = Autotools(self) autotools.install() 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")) - self.copy("*.dll", dst="bin", src=os.path.join(self._source_subfolder, "lib")) - self.copy("*.a", dst="lib", src=os.path.join(self._source_subfolder, "lib")) - - def _install_visual_studio(self): - self.copy("*.h", dst="include", src=os.path.join(self._source_subfolder, "include")) - self.copy("*.dll", dst="bin", src=os.path.join(self._source_subfolder, "win", "bin"), keep_path=False) - self.copy("*.lib", dst="lib", src=os.path.join(self._source_subfolder, "win", "bin"), keep_path=False) + copy(self, "*.h", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include")) + copy(self, "*.dll", + dst=os.path.join(self.package_folder, "bin"), + src=os.path.join(self.source_folder, "lib")) + copy(self, "*.a", + dst=os.path.join(self.package_folder, "lib"), + src=os.path.join(self.source_folder, "lib")) + + def _install_msvc(self): + copy(self, "*.h", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include")) + copy(self, "*.dll", + dst=os.path.join(self.package_folder, "bin"), + src=os.path.join(self.source_folder, "win", "bin"), + keep_path=False) + copy(self, "*.lib", + dst=os.path.join(self.package_folder, "lib"), + src=os.path.join(self.source_folder, "win", "bin"), + keep_path=False) 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._is_mingw: self._install_mingw() elif is_msvc(self): - self._install_visual_studio() + self._install_msvc() else: self._install_autotools() def package_info(self): - self.cpp_info.names["pkg_config"] = "libsass" + self.cpp_info.set_property("pkg_config_name", "libsass") 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): - self.cpp_info.system_libs.append(tools.stdcpp_library(self)) + if not self.options.shared and stdcpp_library(self): + self.cpp_info.system_libs.append(stdcpp_library(self)) diff --git a/recipes/libsass/all/test_package/CMakeLists.txt b/recipes/libsass/all/test_package/CMakeLists.txt index 2c3751c7f5fee..fc8049a7834b9 100644 --- a/recipes/libsass/all/test_package/CMakeLists.txt +++ b/recipes/libsass/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(libsass REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) diff --git a/recipes/libsass/all/test_package/conanfile.py b/recipes/libsass/all/test_package/conanfile.py index 814aa7bbb26c7..ef5d7042163ec 100644 --- a/recipes/libsass/all/test_package/conanfile.py +++ b/recipes/libsass/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 LibsassTestConan(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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libsass/all/test_v1_package/CMakeLists.txt b/recipes/libsass/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/libsass/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/libsass/all/test_v1_package/conanfile.py b/recipes/libsass/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..814aa7bbb26c7 --- /dev/null +++ b/recipes/libsass/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class LibsassTestConan(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/libsass/config.yml b/recipes/libsass/config.yml index dad090706c27e..58097450a200c 100644 --- a/recipes/libsass/config.yml +++ b/recipes/libsass/config.yml @@ -1,4 +1,6 @@ versions: + "3.6.6": + folder: all "3.6.5": folder: all "3.6.4": diff --git a/recipes/libschrift/all/conanfile.py b/recipes/libschrift/all/conanfile.py index 949296527320a..403894f67a231 100644 --- a/recipes/libschrift/all/conanfile.py +++ b/recipes/libschrift/all/conanfile.py @@ -12,8 +12,8 @@ class LibschriftConan(ConanFile): topics = ("truetype", "suckless", ) url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/tomolt/libschrift" - license = "ISC", - + license = ("ISC",) + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], diff --git a/recipes/libschrift/all/test_package/OpenSans-Bold.ttf b/recipes/libschrift/all/test_package/OpenSans-Bold.ttf deleted file mode 100644 index fd79d43bea029..0000000000000 Binary files a/recipes/libschrift/all/test_package/OpenSans-Bold.ttf and /dev/null differ diff --git a/recipes/libschrift/all/test_package/conanfile.py b/recipes/libschrift/all/test_package/conanfile.py index d4c18b77de306..0a6bc68712d90 100644 --- a/recipes/libschrift/all/test_package/conanfile.py +++ b/recipes/libschrift/all/test_package/conanfile.py @@ -23,5 +23,4 @@ def build(self): 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, "OpenSans-Bold.ttf") - self.run(f"{bin_path} {font_path}", env="conanrun") + self.run(bin_path, env="conanrun") diff --git a/recipes/libschrift/all/test_package/test_package.c b/recipes/libschrift/all/test_package/test_package.c index 154c09dca4013..3217d119826cb 100644 --- a/recipes/libschrift/all/test_package/test_package.c +++ b/recipes/libschrift/all/test_package/test_package.c @@ -1,7 +1,10 @@ +#include +#include + #include "schrift.h" -int main(int argc, char* argv[]) { - sft_loadfile(argv[1]); +int main(void) { + printf("Schrift version: %s\n", sft_version()); - return 0; + return EXIT_SUCCESS; } diff --git a/recipes/libseat/all/conandata.yml b/recipes/libseat/all/conandata.yml new file mode 100644 index 0000000000000..119dc8ef93144 --- /dev/null +++ b/recipes/libseat/all/conandata.yml @@ -0,0 +1,9 @@ +sources: + "0.8.0": + url: "https://git.sr.ht/~kennylevinsen/seatd/archive/0.8.0.tar.gz" + sha256: "a562a44ee33ccb20954a1c1ec9a90ecb2db7a07ad6b18d0ac904328efbcf65a0" +patches: + "0.8.0": + - patch_file: "patches/0001-Disable-building-tests.patch" + patch_description: "Disable building tests" + patch_type: "conan" diff --git a/recipes/libseat/all/conanfile.py b/recipes/libseat/all/conanfile.py new file mode 100644 index 0000000000000..4131ba65c629a --- /dev/null +++ b/recipes/libseat/all/conanfile.py @@ -0,0 +1,113 @@ +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, rmdir +from conan.tools.gnu import PkgConfigDeps +from conan.tools.layout import basic_layout +from conan.tools.meson import Meson, MesonToolchain +import os + +required_conan_version = ">=1.53.0" + + +class LibseatConan(ConanFile): + name = "libseat" + description = ("A minimal seat management daemon, and a universal seat management library") + topics = ("login", "session", "seat", "seatd") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://sr.ht/~kennylevinsen/seatd/" + license = "MIT" + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "builtin": [True, False], + "defaultpath": [None, "ANY"], + "logind": [False, "elogind", "systemd"], + "seatd": [True, False], + "server": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "defaultpath": None, + "builtin": False, + "logind": False, + "seatd": True, + "server": True, + } + + def export_sources(self): + export_conandata_patches(self) + + 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.logind == "systemd": + self.requires("libsystemd/253.10") + + def validate(self): + if not self.settings.os in ["FreeBSD", "Linux"]: + raise ConanInvalidConfiguration(f"{self.ref} only supports FreeBSD and Linux") + if self.options.logind == "elogind": + raise ConanInvalidConfiguration(f"{self.ref} may not be built with elogind support since there is no elogind Conan package yet") + + def build_requirements(self): + self.tool_requires("meson/1.2.2") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/2.0.3") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = MesonToolchain(self) + tc.project_options["libseat-builtin"] = "enabled" if self.options.builtin else "disabled" + tc.project_options["libseat-logind"] = str(self.options.logind) if self.options.logind else "disabled" + tc.project_options["libseat-seatd"] = "enabled" if self.options.seatd else "disabled" + tc.project_options["server"] = "enabled" if self.options.server else "disabled" + tc.project_options["examples"] = "disabled" + tc.project_options["man-pages"] = "disabled" + tc.project_options["defaultpath"] = "" if self.options.defaultpath is None else str(self.options.defaultpath) + tc.c_args.append("-Wno-error") + tc.generate() + pkg_config_deps = PkgConfigDeps(self) + pkg_config_deps.generate() + env = VirtualBuildEnv(self) + env.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + + def build(self): + self._patch_sources() + meson = Meson(self) + meson.configure() + meson.build() + + def package(self): + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + meson = Meson(self) + meson.install() + pkg_config_dir = os.path.join(self.package_folder, "lib", "pkgconfig") + rmdir(self, pkg_config_dir) + + def package_info(self): + self.cpp_info.libs = ["seat"] + self.cpp_info.system_libs.append("rt") + pkgconfig_variables = { + "have_builtin": self.options.builtin, + "have_logind": "true" if self.options.logind else "false", + "have_seatd": self.options.seatd, + } + self.cpp_info.set_property( + "pkg_config_custom_content", + "\n".join(f"{key}={value}" for key,value in pkgconfig_variables.items())) diff --git a/recipes/libseat/all/patches/0001-Disable-building-tests.patch b/recipes/libseat/all/patches/0001-Disable-building-tests.patch new file mode 100644 index 0000000000000..8a62a0a48cda0 --- /dev/null +++ b/recipes/libseat/all/patches/0001-Disable-building-tests.patch @@ -0,0 +1,33 @@ +From 5f4738e980b688b26522603a9173a72b007968d3 Mon Sep 17 00:00:00 2001 +From: Jordan Williams +Date: Thu, 28 Sep 2023 15:25:30 -0500 +Subject: [PATCH] Disable building tests + +--- + meson.build | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/meson.build b/meson.build +index 516d7d2..f37109e 100644 +--- a/meson.build ++++ b/meson.build +@@ -241,11 +241,11 @@ if get_option('examples') == 'enabled' + ) + endif + +-tests = { +- 'linked_list': ['common/linked_list.c'], +- 'connection': ['common/connection.c'], +- 'poller': ['common/linked_list.c', 'seatd/poller.c'], +-} ++tests = {} ++# 'linked_list': ['common/linked_list.c'], ++# 'connection': ['common/connection.c'], ++# 'poller': ['common/linked_list.c', 'seatd/poller.c'], ++#} + + foreach name, value : tests + test(name, executable( +-- +2.41.0 + diff --git a/recipes/libseat/all/test_package/CMakeLists.txt b/recipes/libseat/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..027296c50f1b3 --- /dev/null +++ b/recipes/libseat/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) + +find_package(libseat COMPONENTS libseat REQUIRED) + +add_executable(test_package test_package.c) +target_link_libraries(test_package PRIVATE libseat::libseat) diff --git a/recipes/libseat/all/test_package/conanfile.py b/recipes/libseat/all/test_package/conanfile.py new file mode 100644 index 0000000000000..433561157a413 --- /dev/null +++ b/recipes/libseat/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", "VirtualBuildEnv", "VirtualRunEnv" + 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/libseat/all/test_package/test_package.c b/recipes/libseat/all/test_package/test_package.c new file mode 100644 index 0000000000000..3f2ecd791512e --- /dev/null +++ b/recipes/libseat/all/test_package/test_package.c @@ -0,0 +1,6 @@ +#include "libseat.h" + +int main(int argc, char *argv[]) { + libseat_set_log_level(LIBSEAT_LOG_LEVEL_DEBUG); + return 0; +} diff --git a/recipes/libseat/config.yml b/recipes/libseat/config.yml new file mode 100644 index 0000000000000..675f954f2770e --- /dev/null +++ b/recipes/libseat/config.yml @@ -0,0 +1,3 @@ +versions: + "0.8.0": + folder: all diff --git a/recipes/libsecret/all/conandata.yml b/recipes/libsecret/all/conandata.yml index 55e19d25249c5..66c4f8677d553 100644 --- a/recipes/libsecret/all/conandata.yml +++ b/recipes/libsecret/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.21.4": + url: "https://download.gnome.org/sources/libsecret/0.21/libsecret-0.21.4.tar.xz" + sha256: "163d08d783be6d4ab9a979ceb5a4fecbc1d9660d3c34168c581301cd53912b20" "0.20.5": url: "https://download.gnome.org/sources/libsecret/0.20/libsecret-0.20.5.tar.xz" sha256: "3fb3ce340fcd7db54d87c893e69bfc2b1f6e4d4b279065ffe66dac9f0fd12b4d" diff --git a/recipes/libsecret/all/conanfile.py b/recipes/libsecret/all/conanfile.py index 08f938b935f7f..2090a9010ba96 100644 --- a/recipes/libsecret/all/conanfile.py +++ b/recipes/libsecret/all/conanfile.py @@ -1,111 +1,122 @@ -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, is_apple_os +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import copy, get, 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.33.0" +required_conan_version = ">=1.60.0 <2.0 || >=2.0.6" class LibsecretConan(ConanFile): name = "libsecret" description = "A library for storing and retrieving passwords and other secrets" - topics = ("libsecret", "gobject", "password", "secret") + topics = ("gobject", "password", "secret") url = "https://github.com/conan-io/conan-center-index" homepage = "https://wiki.gnome.org/Projects/Libsecret" license = "LGPL-2.1-or-later" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], - "with_libgcrypt": [True, False], + "crypto": [False, "libgcrypt", "gnutls"], + "with_libgcrypt": [True, False, "deprecated"], } default_options = { "shared": False, "fPIC": True, - "with_libgcrypt": True, + "crypto": "libgcrypt", + "with_libgcrypt": "deprecated", } - generators = "pkg_config" - _meson = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - - @property - def _use_gcrypt(self): - return self.options.get_safe("with_libgcrypt", False) - def config_options(self): - if self.settings.os == "Windows": - del self.options.fPIC if self.settings.os != "Linux": # libgcrypt recipe is currently only available on Linux - del self.options.with_libgcrypt + self.options.crypto = False 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.with_libgcrypt != "deprecated": + self.output.warning(f"The '{self.ref}:with_libgcrypt' option is deprecated. Use '{self.ref}:crypto' instead.") + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - self.requires("glib/2.70.1") - if self._use_gcrypt: - self.requires("libgcrypt/1.8.4") + self.requires("glib/2.78.3", transitive_headers=True, transitive_libs=True) + if self.options.get_safe("crypto") == "libgcrypt": + self.requires("libgcrypt/1.10.3") + elif self.options.get_safe("crypto") == "gnutls": + self.requires("gnutls/3.8.2") def validate(self): if self.settings.os == "Windows": - raise ConanInvalidConfiguration( - "libsecret recipe is not yet compatible with Windows." - ) + raise ConanInvalidConfiguration(f"{self.ref} recipe is not yet compatible with Windows.") + if self.options.crypto == "gnutls" and Version(self.version) < "0.21.2": + raise ConanInvalidConfiguration(f"{self.ref} does not support GnuTLS before version 0.21.2. Use -o '&:crypto=libgcrypt' instead.") + + def package_id(self): + del self.info.options.with_libgcrypt def build_requirements(self): - self.build_requires("meson/0.60.2") - self.build_requires("pkgconf/1.7.4") + self.tool_requires("meson/1.4.1") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/2.2.0") + self.tool_requires("glib/") + + if is_apple_os(self): + # Avoid using gettext from homebrew which may be linked against + # a different/incompatible libiconv than the one being exposed + # in the runtime environment (DYLD_LIBRARY_PATH) + # See https://github.com/conan-io/conan-center-index/pull/17502#issuecomment-1542492466 + self.tool_requires("gettext/0.22.5") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_meson(self): - if self._meson: - return self._meson - self._meson = Meson(self) - defs = {} - defs["introspection"] = False - defs["manpage"] = False - defs["gtk_doc"] = False - defs["gcrypt"] = self._use_gcrypt - self._meson.configure( - defs=defs, - build_folder=self._build_subfolder, - source_folder=self._source_subfolder, - pkg_config_paths=[self.install_folder], - ) - return self._meson + 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["introspection"] = "false" + tc.project_options["manpage"] = "false" + tc.project_options["gtk_doc"] = "false" + if Version(self.version) >= "0.21.2": + tc.project_options["crypto"] = str(self.options.crypto) if self.options.crypto else "disabled" + else: + tc.project_options["gcrypt"] = "true" if self.options.crypto == "libgcrypt" else "false" + tc.generate() + deps = PkgConfigDeps(self) + deps.generate() def build(self): - with tools.run_environment(self): - meson = self._configure_meson() - meson.build() + meson = Meson(self) + meson.configure() + meson.build() def package(self): - self.copy(pattern="COPYING", dst="licenses", src=self._source_subfolder) - with tools.run_environment(self): - meson = self._configure_meson() - meson.install() - 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")) + meson = Meson(self) + meson.install() + 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"] = "libsecret-1" - self.cpp_info.requires = ["glib::glib-2.0", "glib::gobject-2.0"] - if self._use_gcrypt: - self.cpp_info.requires.append("libgcrypt::libgcrypt") + self.cpp_info.set_property("pkg_config_name", "libsecret-1") self.cpp_info.includedirs = [os.path.join("include", "libsecret-1")] self.cpp_info.libs = ["secret-1"] + self.cpp_info.requires = ["glib::glib-2.0", "glib::gobject-2.0", "glib::gio-2.0"] + if self.options.get_safe("crypto") == "libgcrypt": + self.cpp_info.requires.append("libgcrypt::libgcrypt") + elif self.options.get_safe("crypto") == "gnutls": + self.cpp_info.requires.append("gnutls::gnutls") diff --git a/recipes/libsecret/all/test_package/CMakeLists.txt b/recipes/libsecret/all/test_package/CMakeLists.txt index 196188113685c..12e42237d500c 100644 --- a/recipes/libsecret/all/test_package/CMakeLists.txt +++ b/recipes/libsecret/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() +find_package(libsecret REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE libsecret::libsecret) diff --git a/recipes/libsecret/all/test_package/conanfile.py b/recipes/libsecret/all/test_package/conanfile.py index 5c09494bc67c0..539e617675db7 100644 --- a/recipes/libsecret/all/test_package/conanfile.py +++ b/recipes/libsecret/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, run=True) 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/libsecret/all/test_v1_package/CMakeLists.txt b/recipes/libsecret/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libsecret/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libsecret/all/test_v1_package/conanfile.py b/recipes/libsecret/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libsecret/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/libsecret/config.yml b/recipes/libsecret/config.yml index 470f4b110022f..f624806eaea4d 100644 --- a/recipes/libsecret/config.yml +++ b/recipes/libsecret/config.yml @@ -1,4 +1,6 @@ versions: + "0.21.4": + folder: all "0.20.5": folder: all "0.20.4": diff --git a/recipes/libselinux/all/conandata.yml b/recipes/libselinux/all/conandata.yml index bc06101ad2d72..6ec0dbf8b0f22 100644 --- a/recipes/libselinux/all/conandata.yml +++ b/recipes/libselinux/all/conandata.yml @@ -1,4 +1,14 @@ sources: + "3.6": + - url: "https://github.com/SELinuxProject/selinux/releases/download/3.6/libselinux-3.6.tar.gz" + sha256: "ba4e0ef34b270e7672a5e5f1b523fe2beab3a40bb33d9389f4ad3a8728f21b52" + - url: "https://github.com/SELinuxProject/selinux/releases/download/3.6/libsepol-3.6.tar.gz" + sha256: "c9dc585ea94903d784d597c861cd5dce6459168f95e22b31a0eab1cdd800975a" + "3.5": + - url: "https://github.com/SELinuxProject/selinux/releases/download/3.5/libselinux-3.5.tar.gz" + sha256: "9a3a3705ac13a2ccca2de6d652b6356fead10f36fb33115c185c5ccdf29eec19" + - url: "https://github.com/SELinuxProject/selinux/releases/download/3.5/libsepol-3.5.tar.gz" + sha256: "78fdaf69924db780bac78546e43d9c44074bad798c2c415d0b9bb96d065ee8a2" "3.3": - url: "https://github.com/SELinuxProject/selinux/releases/download/3.3/libselinux-3.3.tar.gz" sha256: "acfdee27633d2496508c28727c3d41d3748076f66d42fccde2e6b9f3463a7057" @@ -25,6 +35,23 @@ sources: - url: "https://github.com/SELinuxProject/selinux/releases/download/20190315/libsepol-2.9.tar.gz" sha256: "a34b12b038d121e3e459b1cbaca3c9202e983137819c16baf63658390e3f1d5d" patches: + "3.6": + - patch_file: patches/0003-fix-missing-include-3.6.patch + base_path: libselinux-3.6 + patch_description: "Fix a missing #include " + patch_type: "portability" + - patch_file: patches/0004-libsepol-src-Makefile-fix-reallocarray-detection.patch + patch_description: "libsepol/src/Makefile: fix reallocarray detection" + patch_source: "https://lore.kernel.org/selinux/20240108210314.339682-1-fontaine.fabrice@gmail.com/" + patch_type: "portability" + base_path: libsepol-3.6 + - patch_file: patches/0005-libselinux-libsepol-Add-CFLAGS-and-LDFLAGS.patch + patch_description: "libselinux, libsepol: Add CFLAGS and LDFLAGS to Makefile checks" + patch_source: "https://lore.kernel.org/selinux/20240313224806.2859045-1-jwcart2@gmail.com/T/#u" + patch_type: "portability" + "3.3": + - patch_file: patches/0003-fix-link-pcre.patch + base_path: libselinux-3.3 "3.0": - patch_file: patches/0001-fix-fno-common-3.0.patch base_path: libsepol-3.0 diff --git a/recipes/libselinux/all/conanfile.py b/recipes/libselinux/all/conanfile.py index 28dbcacbb8260..19bf1f194402c 100644 --- a/recipes/libselinux/all/conanfile.py +++ b/recipes/libselinux/all/conanfile.py @@ -1,11 +1,13 @@ +import os + from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import cross_building from conan.tools.env import VirtualBuildEnv -from conan.tools.files import apply_conandata_patches, chdir, copy, export_conandata_patches, get +from conan.tools.files import apply_conandata_patches, chdir, copy, export_conandata_patches, get, rename, replace_in_file, save 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.53.0" @@ -20,7 +22,15 @@ class LibSELinuxConan(ConanFile): topics = ("linux", "selinux", "security", "security-enhanced") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/SELinuxProject/selinux" - license = "Unlicense" + license = ( + # https://github.com/SELinuxProject/selinux/blob/main/libselinux/LICENSE + # For the libselinux component: public domain with a limited liability clause + "libselinux-1.0", + # https://github.com/SELinuxProject/selinux/blob/main/libsepol/LICENSE + # For the libsepol component: LGPL-2.1 + "LGPL-2.1-or-later", + ) + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -40,40 +50,24 @@ def configure(self): 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.info.settings.os != "Linux": + if self.settings.os not in ["Linux", "FreeBSD"]: raise ConanInvalidConfiguration(f"{self.ref} only supports Linux") def build_requirements(self): 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 layout(self): - basic_layout(self, src_folder="src") + self.tool_requires("pkgconf/2.2.0") def source(self): for download in self.conan_data["sources"][self.version]: - get(self, **download, destination=self.source_folder) - - @property - def _sepol_soversion(self): - return "2" if Version(self.version) >= "3.2" else "1" - - @property - def _selinux_soversion(self): - return "1" - - @property - 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" + get(self, **download) @property def _sepol_source_folder(self): @@ -94,18 +88,39 @@ def generate(self): 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() + env = tc.environment() + if cross_building(self): + env.append_path("PKG_CONFIG_LIBDIR", self.generators_folder) + tc.generate(env=env) def build(self): 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() + for subdir in [self._sepol_source_folder, self._selinux_source_folder]: + with chdir(self, subdir): + # Build only .a or .so, not both + replace_in_file(self, os.path.join("src", "Makefile"), + "all: $(LIBA) $(LIBSO) $(LIBPC)", + "all: $(LIBSO)" if self.options.shared else "all: $(LIBA)") + # Skip utils dir by truncating its Makefile + save(self, os.path.join("utils", "Makefile"), "all:\n") + autotools.make() + + def _copy_licenses(self): + copy(self, "LICENSE", self._selinux_source_folder, os.path.join(self.package_folder, "licenses")) + rename(self, os.path.join(self.package_folder, "licenses", "LICENSE"), + os.path.join(self.package_folder, "licenses", "LICENSE-libselinux")) + if Version(self.version) >= "3.5": + copy(self, "LICENSE", self._sepol_source_folder, os.path.join(self.package_folder, "licenses")) + rename(self, os.path.join(self.package_folder, "licenses", "LICENSE"), + os.path.join(self.package_folder, "licenses", "LICENSE-libsepol")) + else: + copy(self, "COPYING", self._sepol_source_folder, os.path.join(self.package_folder, "licenses")) + rename(self, os.path.join(self.package_folder, "licenses", "COPYING"), + os.path.join(self.package_folder, "licenses", "LICENSE-libsepol")) def package(self): - copy(self, "LICENSE", self._selinux_source_folder, os.path.join(self.package_folder, "licenses")) + self._copy_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: @@ -115,12 +130,10 @@ def package(self): def package_info(self): self.cpp_info.components["selinux"].set_property("pkg_config_name", "libselinux") - self.cpp_info.components["selinux"].names["pkg_config"] = "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"].set_property("pkg_config_name", "libsepol") - self.cpp_info.components["sepol"].names["pkg_config"] = "libsepol" self.cpp_info.components["sepol"].libs = ["sepol"] diff --git a/recipes/libselinux/all/patches/0003-fix-link-pcre.patch b/recipes/libselinux/all/patches/0003-fix-link-pcre.patch new file mode 100644 index 0000000000000..993246d09e0ea --- /dev/null +++ b/recipes/libselinux/all/patches/0003-fix-link-pcre.patch @@ -0,0 +1,11 @@ +--- a/utils/Makefile ++++ b/utils/Makefile +@@ -43,7 +43,7 @@ endif + + override CFLAGS += -I../include -D_GNU_SOURCE $(DISABLE_FLAGS) $(PCRE_CFLAGS) + override LDFLAGS += -L../src +-override LDLIBS += -lselinux $(FTS_LDLIBS) ++override LDLIBS += -lselinux $(FTS_LDLIBS) $(PCRE_LDLIBS) + PCRE_LDLIBS ?= -lpcre + + ifeq ($(ANDROID_HOST),y) diff --git a/recipes/libselinux/all/patches/0003-fix-missing-include-3.6.patch b/recipes/libselinux/all/patches/0003-fix-missing-include-3.6.patch new file mode 100644 index 0000000000000..8d2025e18034b --- /dev/null +++ b/recipes/libselinux/all/patches/0003-fix-missing-include-3.6.patch @@ -0,0 +1,10 @@ +--- src/selinux_internal.c ++++ src/selinux_internal.c +@@ -1,6 +5,7 @@ + #include "selinux_internal.h" + + #include + #include + #include ++#include + diff --git a/recipes/libselinux/all/patches/0004-libsepol-src-Makefile-fix-reallocarray-detection.patch b/recipes/libselinux/all/patches/0004-libsepol-src-Makefile-fix-reallocarray-detection.patch new file mode 100644 index 0000000000000..c9a5ee550ab55 --- /dev/null +++ b/recipes/libselinux/all/patches/0004-libsepol-src-Makefile-fix-reallocarray-detection.patch @@ -0,0 +1,48 @@ +From a520f972bce9ec267f4e76b729bc3b7c1bdf13e6 Mon Sep 17 00:00:00 2001 +From: Fabrice Fontaine +Date: Mon, 8 Jan 2024 22:03:14 +0100 +Subject: [PATCH 1/3] libsepol/src/Makefile: fix reallocarray detection + +Pass LDFLAGS when checking for reallocarray to avoid the following +static build failure with musl raised since version 3.4 and +https://github.com/SELinuxProject/selinux/commit/f0a5f6e33084bd83d409bb7c932256139f471e71 +because -static is not passed when checking for reallocarray: + +/home/autobuild/autobuild/instance-9/output-1/host/bin/armeb-buildroot-linux-musleabi-gcc -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -O0 -g0 -static -I. -I../include -D_GNU_SOURCE -I../cil/include -fPIC -c -o assertion.o assertion.c +In file included from assertion.c:28: +private.h:88:21: error: static declaration of 'reallocarray' follows non-static declaration + 88 | static inline void* reallocarray(void *ptr, size_t nmemb, size_t size) { + | ^~~~~~~~~~~~ +In file included from ../include/sepol/policydb/mls_types.h:35, + from ../include/sepol/policydb/context.h:23, + from ../include/sepol/policydb/policydb.h:62, + from assertion.c:24: +/home/autobuild/autobuild/instance-9/output-1/host/armeb-buildroot-linux-musleabi/sysroot/usr/include/stdlib.h:150:7: note: previous declaration of 'reallocarray' with type 'void *(void *, size_t, size_t)' {aka 'void *(void *, unsigned int, unsigned int)'} + 150 | void *reallocarray (void *, size_t, size_t); + | ^~~~~~~~~~~~ + +Fixes: + - http://autobuild.buildroot.org/results/0170032548a38e2c991d62dc5823808458ad03b3 + +Signed-off-by: Fabrice Fontaine +Acked-by: James Carter +--- +src/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/Makefile b/src/Makefile +index d80a941f..16b9bd5e 100644 +--- a/src/Makefile ++++ b/src/Makefile +@@ -31,7 +31,7 @@ endif + + # check for reallocarray(3) availability + H := \# +-ifeq (yes,$(shell printf '${H}define _GNU_SOURCE\n${H}include \nint main(void){void*p=reallocarray(NULL, 1, sizeof(char));return 0;}' | $(CC) -x c -o /dev/null - >/dev/null 2>&1 && echo yes)) ++ifeq (yes,$(shell printf '${H}define _GNU_SOURCE\n${H}include \nint main(void){void*p=reallocarray(NULL, 1, sizeof(char));return 0;}' | $(CC) $(LDFLAGS) -x c -o /dev/null - >/dev/null 2>&1 && echo yes)) + override CFLAGS += -DHAVE_REALLOCARRAY + endif + +-- +2.44.0 + diff --git a/recipes/libselinux/all/patches/0005-libselinux-libsepol-Add-CFLAGS-and-LDFLAGS.patch b/recipes/libselinux/all/patches/0005-libselinux-libsepol-Add-CFLAGS-and-LDFLAGS.patch new file mode 100644 index 0000000000000..bea3664ddd66d --- /dev/null +++ b/recipes/libselinux/all/patches/0005-libselinux-libsepol-Add-CFLAGS-and-LDFLAGS.patch @@ -0,0 +1,61 @@ +[PATCH] libselinux, libsepol: Add CFLAGS and LDFLAGS to Makefile checks +@ 2024-03-13 22:48 James Carter + 0 siblings, 0 replies; only message in thread +From: James Carter @ 2024-03-13 22:48 UTC (permalink / raw) + To: selinux; +Cc: jordan, winfried_mb2, James Carter + +In libselinux there is an availability check for strlcpy() and +in both libselinux and libsepol there are availability checks for +reallocarray() in the src Makfiles. CFLAGS and LDFLAGS are needed +for cross-compiling, but, unfortunately, the default CFLAGS cause +all of these availability checks to fail to compile because of +compilationerrors (rather than just the function not being available). + +Add CFLAGS and LDFLAGS to the availibility checks, update the checks +so that a compilation error will only happen if the function being +checked for is not available, and make checks for the same function +the same in both libselinux and libsepol. + +Suggested-by: Jordan Williams +Suggested-by: Winfried Dobbe +Signed-off-by: James Carter +--- + libselinux/src/Makefile | 4 ++-- + libsepol/src/Makefile | 2 +- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/libselinux-3.6/src/Makefile b/libselinux-3.6/src/Makefile +index d3b981fc..41cfbdca 100644 +--- a/libselinux-3.6/src/Makefile ++++ b/libselinux-3.6/src/Makefile +@@ -104,13 +104,13 @@ override CFLAGS += -I../include -D_GNU_SOURCE $(DISABLE_FLAGS) $(PCRE_CFLAGS) + + # check for strlcpy(3) availability + H := \# +-ifeq (yes,$(shell printf '${H}include \nint main(void){char*d,*s;strlcpy(d, s, 0);return 0;}' | $(CC) -x c -o /dev/null - >/dev/null 2>&1 && echo yes)) ++ifeq (yes,$(shell printf '${H}include \nint main(void){char d[2];const char *s="a";return (size_t)strlcpy(d,s,sizeof(d))>=sizeof(d);}' | $(CC) $(CFLAGS) $(LDFLAGS) -x c -o /dev/null - >/dev/null 2>&1 && echo yes)) + override CFLAGS += -DHAVE_STRLCPY + endif + + # check for reallocarray(3) availability + H := \# +-ifeq (yes,$(shell printf '${H}include \nint main(void){reallocarray(NULL, 0, 0);return 0;}' | $(CC) -x c -o /dev/null - >/dev/null 2>&1 && echo yes)) ++ifeq (yes,$(shell printf '${H}include \nint main(void){return reallocarray(NULL,0,0)==NULL;}' | $(CC) $(CFLAGS) $(LDFLAGS) -x c -o /dev/null - >/dev/null 2>&1 && echo yes)) + override CFLAGS += -DHAVE_REALLOCARRAY + endif + +diff --git a/libsepol-3.6/src/Makefile b/libsepol-3.6/src/Makefile +index 16b9bd5e..7b0e8446 100644 +--- a/libsepol-3.6/src/Makefile ++++ b/libsepol-3.6/src/Makefile +@@ -31,7 +31,7 @@ endif + + # check for reallocarray(3) availability + H := \# +-ifeq (yes,$(shell printf '${H}define _GNU_SOURCE\n${H}include \nint main(void){void*p=reallocarray(NULL, 1, sizeof(char));return 0;}' | $(CC) $(LDFLAGS) -x c -o /dev/null - >/dev/null 2>&1 && echo yes)) ++ifeq (yes,$(shell printf '${H}include \nint main(void){return reallocarray(NULL,0,0)==NULL;}' | $(CC) $(CFLAGS) $(LDFLAGS) -x c -o /dev/null - >/dev/null 2>&1 && echo yes)) + override CFLAGS += -DHAVE_REALLOCARRAY + endif + +-- +2.44.0 diff --git a/recipes/libselinux/all/test_package/CMakeLists.txt b/recipes/libselinux/all/test_package/CMakeLists.txt index 7a316858398f3..a2c8fc569bb2f 100644 --- a/recipes/libselinux/all/test_package/CMakeLists.txt +++ b/recipes/libselinux/all/test_package/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package LANGUAGES C) find_package(libselinux REQUIRED CONFIG) diff --git a/recipes/libselinux/all/test_v1_package/CMakeLists.txt b/recipes/libselinux/all/test_v1_package/CMakeLists.txt index 925ecbe19e448..91630d79f4abb 100644 --- a/recipes/libselinux/all/test_v1_package/CMakeLists.txt +++ b/recipes/libselinux/all/test_v1_package/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) diff --git a/recipes/libselinux/config.yml b/recipes/libselinux/config.yml index 3fc66eb377b84..901df00682822 100644 --- a/recipes/libselinux/config.yml +++ b/recipes/libselinux/config.yml @@ -1,4 +1,8 @@ versions: + "3.6": + folder: all + "3.5": + folder: all "3.3": folder: all "3.2": diff --git a/recipes/libserial/all/conandata.yml b/recipes/libserial/all/conandata.yml new file mode 100644 index 0000000000000..3c560a2bb697e --- /dev/null +++ b/recipes/libserial/all/conandata.yml @@ -0,0 +1,12 @@ +sources: + "cci.20230909": + url: "https://github.com/crayzeewulf/libserial/archive/ee1992dc3c5dc41a0e18e2d1dad18c103eb405ec.tar.gz" + sha256: "2b83141630c76e119b19d85958c8685efab6eff3e2af3435933b8f2ac147f62a" + "cci.20200930": + url: "https://github.com/crayzeewulf/libserial/archive/1d1e47a2faae0470f93eb291263b0ce7ea119a81.tar.gz" + sha256: "a433b04bd42e8b4504e5e1fbe7ec22b648f2872d3d125e58c17b9c6c1b171bba" +patches: + "cci.20200930": + - patch_file: "patches/0001-add-cstdint.patch" + patch_description: "add cstdint for uint8_t" + patch_type: "portability" diff --git a/recipes/libserial/all/conanfile.py b/recipes/libserial/all/conanfile.py new file mode 100644 index 0000000000000..647fb6e4c8381 --- /dev/null +++ b/recipes/libserial/all/conanfile.py @@ -0,0 +1,97 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +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, 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" + package_type = "library" + 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 export_sources(self): + export_conandata_patches(self) + + 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], 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): + apply_conandata_patches(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/patches/0001-add-cstdint.patch b/recipes/libserial/all/patches/0001-add-cstdint.patch new file mode 100644 index 0000000000000..1ffc6faea2d33 --- /dev/null +++ b/recipes/libserial/all/patches/0001-add-cstdint.patch @@ -0,0 +1,12 @@ +diff --git a/src/libserial/SerialPortConstants.h b/src/libserial/SerialPortConstants.h +index f9d5dc1..0588e3e 100644 +--- a/src/libserial/SerialPortConstants.h ++++ b/src/libserial/SerialPortConstants.h +@@ -38,6 +38,7 @@ + #include + #include + #include ++#include + + namespace LibSerial + { 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..3318e67617d62 --- /dev/null +++ b/recipes/libserial/config.yml @@ -0,0 +1,5 @@ +versions: + "cci.20230909": + folder: all + "cci.20200930": + folder: all diff --git a/recipes/libsgp4/all/conandata.yml b/recipes/libsgp4/all/conandata.yml index acdc9ee85a453..427372b5ece50 100644 --- a/recipes/libsgp4/all/conandata.yml +++ b/recipes/libsgp4/all/conandata.yml @@ -1,7 +1,12 @@ sources: + "1.0": + url: "https://github.com/dnwrnr/sgp4/archive/refs/tags/v1.0.tar.gz" + sha256: "34cdcce25adbe25234b5113b06537bec9d6e6c2a74f70919c9d71710dc3773f4" "20191207": - url: "https://github.com/dnwrnr/sgp4/archive/f5cb54b382a5b4787432ab5b9a1e83de1a224610.zip" - sha256: "e8ce05b5e62ffe81e2e07020ac693cb5f3eb7dd90587e9c2203639564c030495" + url: "https://github.com/dnwrnr/sgp4/archive/f5cb54b382a5b4787432ab5b9a1e83de1a224610.tar.gz" + sha256: "260f3524ead05c191bdf19c2f018376394b4856d2fbcc1ed63bcdd475b81c338" patches: + "1.0": + - patch_file: "patches/1.0-fix-cmake-files.patch" "20191207": - - patch_file: "patches/fix-cmake-files.patch" + - patch_file: "patches/20191207-fix-cmake-files.patch" diff --git a/recipes/libsgp4/all/conanfile.py b/recipes/libsgp4/all/conanfile.py index f2f49822e5c2a..740a3e58743e5 100644 --- a/recipes/libsgp4/all/conanfile.py +++ b/recipes/libsgp4/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 +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 Libsgp4Conan(ConanFile): name = "libsgp4" description = "C++11 library for SGP4 Simplified perturbations model." license = "Apache-2.0" - topics = ("libsgp4", "sgp4", "orbit", "satellite", "perturbation") + topics = ("sgp4", "orbit", "satellite", "perturbation") homepage = "https://github.com/dnwrnr/sgp4" 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 Libsgp4Conan(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,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) @@ -66,3 +65,5 @@ def package(self): def package_info(self): self.cpp_info.libs = ["sgp4s" if self.options.shared else "sgp4"] self.cpp_info.includedirs.append(os.path.join("include", "SGP4")) + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") diff --git a/recipes/libsgp4/all/patches/1.0-fix-cmake-files.patch b/recipes/libsgp4/all/patches/1.0-fix-cmake-files.patch new file mode 100644 index 0000000000000..0b0946d73305a --- /dev/null +++ b/recipes/libsgp4/all/patches/1.0-fix-cmake-files.patch @@ -0,0 +1,27 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -27,8 +27,3 @@ + include_directories(libsgp4) + + add_subdirectory(libsgp4) +-add_subdirectory(sattrack) +-add_subdirectory(runtest) +-add_subdirectory(passpredict) +- +-file(COPY SGP4-VER.TLE DESTINATION ${PROJECT_BINARY_DIR}) +--- a/libsgp4/CMakeLists.txt ++++ b/libsgp4/CMakeLists.txt +@@ -35,7 +35,10 @@ + Vector.h + ) + +-add_library(sgp4 STATIC ${SRCS} ${INCS}) +-add_library(sgp4s SHARED ${SRCS} ${INCS}) +-install( TARGETS sgp4s LIBRARY DESTINATION lib ) ++add_library(sgp4 ${SRCS}) ++if(BUILD_SHARED_LIBS) ++ set_target_properties(sgp4 PROPERTIES OUTPUT_NAME sgp4s) ++endif() ++include(GNUInstallDirs) ++install(TARGETS sgp4) + install( FILES ${INCS} DESTINATION include/SGP4 ) diff --git a/recipes/libsgp4/all/patches/20191207-fix-cmake-files.patch b/recipes/libsgp4/all/patches/20191207-fix-cmake-files.patch new file mode 100644 index 0000000000000..7874f13bef92a --- /dev/null +++ b/recipes/libsgp4/all/patches/20191207-fix-cmake-files.patch @@ -0,0 +1,52 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,16 +1,7 @@ +-CMAKE_MINIMUM_REQUIRED(VERSION 2.8) ++CMAKE_MINIMUM_REQUIRED(VERSION 3.15) + PROJECT(SGP4) + +-include(CheckCXXCompilerFlag) +-CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) +-if(COMPILER_SUPPORTS_CXX11) +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") +-else() +- message(SEND_ERROR "The compiler ${CMAKE_CXX_COMPILER} doesnt support C++11.") +-endif() +- +-set(CMAKE_EXPORT_COMPILE_COMMANDS ON) +- ++if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshadow") +@@ -19,12 +10,8 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-long-long") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wcast-align") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsign-conversion") ++endif() + + include_directories(libsgp4) + + add_subdirectory(libsgp4) +-add_subdirectory(sattrack) +-add_subdirectory(runtest) +-add_subdirectory(passpredict) +- +-file(COPY SGP4-VER.TLE DESTINATION ${PROJECT_BINARY_DIR}) +--- a/libsgp4/CMakeLists.txt ++++ b/libsgp4/CMakeLists.txt +@@ -35,7 +35,11 @@ set(SRCS + Vector.h + ) + +-add_library(sgp4 STATIC ${SRCS} ${INCS}) +-add_library(sgp4s SHARED ${SRCS} ${INCS}) +-install( TARGETS sgp4s LIBRARY DESTINATION lib ) ++add_library(sgp4 ${SRCS}) ++set_target_properties(sgp4 PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE) ++if(BUILD_SHARED_LIBS) ++ set_target_properties(sgp4 PROPERTIES OUTPUT_NAME sgp4s) ++endif() ++target_compile_features(sgp4 PRIVATE cxx_std_11) ++install( TARGETS sgp4 RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) + install( FILES ${INCS} DESTINATION include/SGP4 ) diff --git a/recipes/libsgp4/all/patches/fix-cmake-files.patch b/recipes/libsgp4/all/patches/fix-cmake-files.patch deleted file mode 100644 index c465c32853439..0000000000000 --- a/recipes/libsgp4/all/patches/fix-cmake-files.patch +++ /dev/null @@ -1,52 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -1,16 +1,7 @@ --CMAKE_MINIMUM_REQUIRED(VERSION 2.8) -+CMAKE_MINIMUM_REQUIRED(VERSION 3.8) - PROJECT(SGP4) - --include(CheckCXXCompilerFlag) --CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) --if(COMPILER_SUPPORTS_CXX11) -- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") --else() -- message(SEND_ERROR "The compiler ${CMAKE_CXX_COMPILER} doesnt support C++11.") --endif() -- --set(CMAKE_EXPORT_COMPILE_COMMANDS ON) -- -+if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshadow") -@@ -19,12 +10,8 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-long-long") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wcast-align") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsign-conversion") -+endif() - - include_directories(libsgp4) - - add_subdirectory(libsgp4) --add_subdirectory(sattrack) --add_subdirectory(runtest) --add_subdirectory(passpredict) -- --file(COPY SGP4-VER.TLE DESTINATION ${PROJECT_BINARY_DIR}) ---- a/libsgp4/CMakeLists.txt -+++ b/libsgp4/CMakeLists.txt -@@ -35,7 +35,11 @@ set(SRCS - Vector.h - ) - --add_library(sgp4 STATIC ${SRCS} ${INCS}) --add_library(sgp4s SHARED ${SRCS} ${INCS}) --install( TARGETS sgp4s LIBRARY DESTINATION lib ) -+add_library(sgp4 ${SRCS}) -+set_target_properties(sgp4 PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE) -+if(BUILD_SHARED_LIBS) -+ set_target_properties(sgp4 PROPERTIES OUTPUT_NAME sgp4s) -+endif() -+target_compile_features(sgp4 PRIVATE cxx_std_11) -+install( TARGETS sgp4 RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) - install( FILES ${INCS} DESTINATION include/SGP4 ) diff --git a/recipes/libsgp4/all/test_package/conanfile.py b/recipes/libsgp4/all/test_package/conanfile.py index c861d41a6d58c..9c4155c807a23 100644 --- a/recipes/libsgp4/all/test_package/conanfile.py +++ b/recipes/libsgp4/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/libsgp4/all/test_v1_package/CMakeLists.txt b/recipes/libsgp4/all/test_v1_package/CMakeLists.txt index a84c36978ba7f..0d20897301b68 100644 --- a/recipes/libsgp4/all/test_v1_package/CMakeLists.txt +++ b/recipes/libsgp4/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(libsgp4 REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE libsgp4::libsgp4) -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/libsgp4/config.yml b/recipes/libsgp4/config.yml index 72af20020d59f..323fde5efbec2 100644 --- a/recipes/libsgp4/config.yml +++ b/recipes/libsgp4/config.yml @@ -1,3 +1,5 @@ versions: + "1.0": + folder: all "20191207": folder: all diff --git a/recipes/libsigcpp/2.x.x/conanfile.py b/recipes/libsigcpp/2.x.x/conanfile.py index 9cb40725e278e..b771abcbf3d00 100644 --- a/recipes/libsigcpp/2.x.x/conanfile.py +++ b/recipes/libsigcpp/2.x.x/conanfile.py @@ -45,7 +45,7 @@ def validate(self): check_min_cppstd(self, 11) def build_requirements(self): - self.tool_requires("meson/0.64.1") + self.tool_requires("meson/1.2.3") def source(self): get(self, **self.conan_data["sources"][self.version], diff --git a/recipes/libsigcpp/2.x.x/test_package/conanfile.py b/recipes/libsigcpp/2.x.x/test_package/conanfile.py index d5daeb4ad5467..0401e0f4d83ce 100644 --- a/recipes/libsigcpp/2.x.x/test_package/conanfile.py +++ b/recipes/libsigcpp/2.x.x/test_package/conanfile.py @@ -18,7 +18,7 @@ def requirements(self): def build_requirements(self): if not self.conf.get("tools.gnu:pkg_config", check_type=str): - self.tool_requires("pkgconf/1.9.3") + self.tool_requires("pkgconf/2.0.3") def generate(self): # TODO: to remove once conan 1.55.0 deployed in c3i (see https://github.com/conan-io/conan/pull/12513) diff --git a/recipes/libsigcpp/2.x.x/test_v1_package/conanfile.py b/recipes/libsigcpp/2.x.x/test_v1_package/conanfile.py index e6b0fdb8110e8..b3607270e232e 100644 --- a/recipes/libsigcpp/2.x.x/test_v1_package/conanfile.py +++ b/recipes/libsigcpp/2.x.x/test_v1_package/conanfile.py @@ -7,7 +7,7 @@ class TestPackageConan(ConanFile): generators = "cmake", "pkg_config" def build_requirements(self): - self.build_requires("pkgconf/1.9.3") + self.build_requires("pkgconf/2.0.3") def build(self): cmake = CMake(self) diff --git a/recipes/libsixel/all/conanfile.py b/recipes/libsixel/all/conanfile.py index 8748a8a951d30..2dd78a289a478 100644 --- a/recipes/libsixel/all/conanfile.py +++ b/recipes/libsixel/all/conanfile.py @@ -1,18 +1,28 @@ import os -import functools -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.files import copy, get, rmdir, rm +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 -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" + class LibSixelConan(ConanFile): name = "libsixel" - description = "A SIXEL encoder/decoder implementation derived from kmiya's sixel (https://github.com/saitoha/sixel)." - topics = ("sixel") + description = ("A SIXEL encoder/decoder implementation derived from kmiya's sixel" + " (https://github.com/saitoha/sixel).") license = "MIT" - homepage = "https://github.com/libsixel/libsixel" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/libsixel/libsixel" + topics = "sixel" + + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -32,75 +42,80 @@ class LibSixelConan(ConanFile): "with_jpeg": True, "with_png": True, } - generators = "cmake", "pkg_config" - - @property - def _source_subfolder(self): - return "source_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 - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx - - def validate(self): - if hasattr(self, "settings_build") and tools.cross_building(self): - raise ConanInvalidConfiguration("Cross-building not implemented") - if is_msvc(self): - raise ConanInvalidConfiguration("{}/{} does not support Visual Studio".format(self.name, self.version)) + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") - def build_requirements(self): - self.build_requires("meson/0.62.2") - self.build_requires("pkgconf/1.7.4") + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): if self.options.with_curl: - self.requires("libcurl/7.83.1") + self.requires("libcurl/[>=7.78.0 <9]") if self.options.with_gd: - self.requires("libgd/2.3.2") + self.requires("libgd/2.3.3") if self.options.with_gdk_pixbuf2: - self.requires("gdk-pixbuf/2.42.6") + self.requires("gdk-pixbuf/2.42.10") if self.options.with_jpeg: - self.requires("libjpeg/9d") + self.requires("libjpeg/9e") if self.options.with_png: - self.requires("libpng/1.6.37") + self.requires("libpng/[>=1.6 <2]") + + def validate(self): + if hasattr(self, "settings_build") and cross_building(self): + raise ConanInvalidConfiguration("Cross-building not implemented") + if is_msvc(self): + raise ConanInvalidConfiguration(f"{self.ref} does not support Visual Studio") + + def build_requirements(self): + self.tool_requires("meson/[>=1.2.3 <2]") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/[>=2.2 <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) - @functools.lru_cache(1) - def _configure_meson(self): - meson = Meson(self) - defs = { + def generate(self): + tc = MesonToolchain(self) + tc.project_options = { "libcurl": "enabled" if self.options.with_curl else "disabled", "gd": "enabled" if self.options.with_gd else "disabled", "gdk-pixbuf2": "enabled" if self.options.with_gdk_pixbuf2 else "disabled", "img2sixel": "disabled", "sixel2png": "disabled", "python2": "disabled", + "libdir": "lib", } - meson.configure( - defs=defs, - source_folder=self._source_subfolder, - ) - return meson + tc.generate() + tc = PkgConfigDeps(self) + 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*", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + meson = Meson(self) meson.install() - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + fix_apple_shared_install_name(self) + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + if self.options.shared: + rm(self, "*.a", os.path.join(self.package_folder, "lib")) + rm(self, "*.lib", os.path.join(self.package_folder, "lib")) + else: + rm(self, "*.dll", os.path.join(self.package_folder, "bin")) + rm(self, "*.so*", os.path.join(self.package_folder, "lib")) + rm(self, "*.dylib", os.path.join(self.package_folder, "lib")) def package_info(self): self.cpp_info.libs = ["sixel"] diff --git a/recipes/libsixel/all/test_package/CMakeLists.txt b/recipes/libsixel/all/test_package/CMakeLists.txt index 199ae95ae65fc..9bb9b6871d67d 100644 --- a/recipes/libsixel/all/test_package/CMakeLists.txt +++ b/recipes/libsixel/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(libsixel REQUIRED CONFIG) add_executable(${PROJECT_NAME} ${PROJECT_NAME}.c) diff --git a/recipes/libsixel/all/test_package/conanfile.py b/recipes/libsixel/all/test_package/conanfile.py index e556cc050d509..ef5d7042163ec 100644 --- a/recipes/libsixel/all/test_package/conanfile.py +++ b/recipes/libsixel/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 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) @@ -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/libsixel/all/test_v1_package/CMakeLists.txt b/recipes/libsixel/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/libsixel/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/libsixel/all/test_v1_package/conanfile.py b/recipes/libsixel/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..e556cc050d509 --- /dev/null +++ b/recipes/libsixel/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +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/libslz/all/CMakeLists.txt b/recipes/libslz/all/CMakeLists.txt index 3086b45fa1be2..84ba240aba82b 100644 --- a/recipes/libslz/all/CMakeLists.txt +++ b/recipes/libslz/all/CMakeLists.txt @@ -1,24 +1,17 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.12) project(slz LANGUAGES C) -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -include(GNUInstallDirs) - -add_library(slz source_subfolder/src/slz.c) -include_directories(source_subfolder/src) +add_library(slz src/src/slz.c) +include_directories(src/src) set_target_properties(slz PROPERTIES - PUBLIC_HEADER source_subfolder/src/slz.h + PUBLIC_HEADER src/src/slz.h WINDOWS_EXPORT_ALL_SYMBOLS ON C_STANDARD 11 C_EXTENSIONS ON ) +include(GNUInstallDirs) install( TARGETS slz - 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/libslz/all/conanfile.py b/recipes/libslz/all/conanfile.py index b33407244e1eb..56bb34708956f 100644 --- a/recipes/libslz/all/conanfile.py +++ b/recipes/libslz/all/conanfile.py @@ -1,17 +1,23 @@ -import functools -from conans import ConanFile, CMake, tools -from conans.tools import ConanInvalidConfiguration +import os + +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 -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" + class LibslzConan(ConanFile): name = "libslz" description = "Simple, modern libpng alternative " - topics = ("zlib", "compression",) license = "X11" url = "https://github.com/conan-io/conan-center-index" homepage = "http://www.libslz.org/" + topics = ("zlib", "compression") + + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -21,14 +27,9 @@ class LibslzConan(ConanFile): "shared": False, "fPIC": True, } - generators = "cmake" - - @property - def _source_subfolder(self): - return "source_subfolder" 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,31 +37,34 @@ 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 validate(self): if is_msvc(self): - raise ConanInvalidConfiguration("{}/{} does not support Visual Studio.".format(self.name, self.version)) + raise ConanInvalidConfiguration(f"{self.ref} does not support MSVC.") 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.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=self.export_sources_folder) 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"), keep_path=False) + cmake = CMake(self) cmake.install() def package_info(self): diff --git a/recipes/libslz/all/test_package/CMakeLists.txt b/recipes/libslz/all/test_package/CMakeLists.txt index 13e3af8ad2791..14c66f6f3d628 100644 --- a/recipes/libslz/all/test_package/CMakeLists.txt +++ b/recipes/libslz/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ -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(libslz REQUIRED) +find_package(libslz REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) target_link_libraries(${PROJECT_NAME} libslz::libslz) diff --git a/recipes/libslz/all/test_package/conanfile.py b/recipes/libslz/all/test_package/conanfile.py index 19e6a0c06e3d8..fae501d0afb9e 100644 --- a/recipes/libslz/all/test_package/conanfile.py +++ b/recipes/libslz/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" + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libslz/all/test_v1_package/CMakeLists.txt b/recipes/libslz/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/libslz/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/libslz/all/test_v1_package/conanfile.py b/recipes/libslz/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libslz/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/libsmacker/all/conanfile.py b/recipes/libsmacker/all/conanfile.py index 9e27911242b4d..a26d4116c39b3 100644 --- a/recipes/libsmacker/all/conanfile.py +++ b/recipes/libsmacker/all/conanfile.py @@ -1,14 +1,13 @@ from conan import ConanFile from conan.tools.apple import fix_apple_shared_install_name -from conan.tools.env import Environment, VirtualBuildEnv +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 is_msvc, unix_path -from conan.tools.scm import Version +from conan.tools.microsoft import check_min_vs, is_msvc import os -required_conan_version = ">=1.53.0" +required_conan_version = ">=1.57.0" class LibsmackerConan(ConanFile): @@ -19,6 +18,7 @@ class LibsmackerConan(ConanFile): license = "LGPL-2.1-or-later" description = "A C library for decoding .smk Smacker Video files" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -57,25 +57,21 @@ def build_requirements(self): self.tool_requires("msys2/cci.latest") 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 = 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"): + if is_msvc(self) and check_min_vs(self, "180", raise_invalid=False): tc.extra_cflags.append("-FS") - tc.generate() - + env = tc.environment() 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") + tc.generate(env) def build(self): apply_conandata_patches(self) @@ -87,8 +83,7 @@ def build(self): def package(self): 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)}"]) + autotools.install() rm(self, "*.la", os.path.join(self.package_folder, "lib")) fix_apple_shared_install_name(self) if is_msvc(self) and self.options.shared: diff --git a/recipes/libsndfile/all/conandata.yml b/recipes/libsndfile/all/conandata.yml index 9c03d46a973d3..cc9d3fa6bc38c 100644 --- a/recipes/libsndfile/all/conandata.yml +++ b/recipes/libsndfile/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "1.2.2": + url: "https://github.com/libsndfile/libsndfile/releases/download/1.2.2/libsndfile-1.2.2.tar.xz" + sha256: "3799ca9924d3125038880367bf1468e53a1b7e3686a934f098b7e1d286cdb80e" + "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 +15,19 @@ sources: url: "https://github.com/libsndfile/libsndfile/releases/download/v1.0.29/libsndfile-1.0.29.tar.bz2" sha256: "2ba20d44817c8176f097ab25eff44ef0aeec9e00973def5a7174c5ae0764b22f" patches: + "1.2.2": + - patch_file: "patches/1.0.31-0001-fix-msvc-runtime-logic.patch" + patch_description: "always set CMP0091" + patch_type: "portability" + "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..d59d2e8b609fe 100644 --- a/recipes/libsndfile/all/conanfile.py +++ b/recipes/libsndfile/all/conanfile.py @@ -1,11 +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, 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.50.0" +required_conan_version = ">=1.54.0" class LibsndfileConan(ConanFile): @@ -17,8 +18,8 @@ class LibsndfileConan(ConanFile): "Libsndfile is a library of C routines for reading and writing files " "containing sampled audio data." ) - topics = ("audio") - + topics = ("audio",) + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -27,6 +28,8 @@ class LibsndfileConan(ConanFile): "experimental": [True, False], "with_alsa": [True, False], "with_external_libs": [True, False], + "with_mpeg": [True, False], + "with_sndio": [True, False], } default_options = { "shared": False, @@ -35,41 +38,54 @@ class LibsndfileConan(ConanFile): "experimental": False, "with_alsa": False, "with_external_libs": True, + "with_mpeg": True, + "with_sndio": False, } 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.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") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def validate(self): + if self.options.with_sndio: + if self.dependencies["libsndio"].options.get_safe("with_alsa") and not self.options.get_safe("with_alsa"): + raise ConanInvalidConfiguration(f"{self.ref} 'with_alsa' option should be True when the libsndio 'with_alsa' one is True") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): + if self.options.with_sndio: + self.requires("libsndio/1.9.0", options={"with_alsa": self.options.get_safe("with_alsa")}) if self.options.get_safe("with_alsa"): - self.requires("libalsa/1.2.7.2") + self.requires("libalsa/1.2.10") 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("opus/1.3.1") - - def layout(self): - cmake_layout(self, src_folder="src") + self.requires("flac/1.4.2") + self.requires("opus/1.4") + if self.options.get_safe("with_mpeg"): + self.requires("mpg123/1.31.2") + self.requires("libmp3lame/3.100") 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_DISABLE_FIND_PACKAGE_Sndio"] = True # FIXME: missing sndio cci recipe (check whether it is really required) - tc.variables["CMAKE_DISABLE_FIND_PACKAGE_Speex"] = True # FIXME: missing sndio cci recipe (check whether it is really required) + tc.variables["CMAKE_DISABLE_FIND_PACKAGE_Speex"] = True # FIXME: missing speex cci recipe (check whether it is really required) tc.variables["CMAKE_DISABLE_FIND_PACKAGE_SQLite3"] = True # only used for regtest tc.variables["ENABLE_EXTERNAL_LIBS"] = self.options.with_external_libs if not self.options.with_external_libs: @@ -87,10 +103,11 @@ 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 + # https://github.com/libsndfile/libsndfile/commit/663a59aa6ea5e24cf5159b8e1c2b0735712ea74e#diff-1e7de1ae2d059d21e1dd75d5812d5a34b0222cef273b7c3a2af62eb747f9d20a + if Version(self.version) >= "1.1.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) - tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" tc.generate() deps = CMakeDeps(self) deps.generate() @@ -114,27 +131,21 @@ def package_info(self): self.cpp_info.set_property("cmake_file_name", "SndFile") self.cpp_info.set_property("cmake_target_name", "SndFile::sndfile") self.cpp_info.set_property("pkg_config_name", "sndfile") - # TODO: back to global scope in conan v2 once cmake_find_package_* generators removed - self.cpp_info.components["sndfile"].libs = ["sndfile"] + self.cpp_info.libs = ["sndfile"] + if self.options.with_sndio: + self.cpp_info.requires.append("libsndio::libsndio") if self.options.with_external_libs: - self.cpp_info.components["sndfile"].requires.extend([ + self.cpp_info.requires.extend([ "ogg::ogg", "vorbis::vorbismain", "vorbis::vorbisenc", "flac::flac", "opus::opus", ]) + if self.options.get_safe("with_mpeg", False): + self.cpp_info.requires.append("mpg123::mpg123") + self.cpp_info.requires.append("libmp3lame::libmp3lame") if self.options.get_safe("with_alsa"): - self.cpp_info.components["sndfile"].requires.append("libalsa::libalsa") + self.cpp_info.requires.append("libalsa::libalsa") if not self.options.shared: if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.components["sndfile"].system_libs = ["m", "dl", "pthread", "rt"] + self.cpp_info.system_libs = ["m", "dl", "pthread", "rt"] elif self.settings.os == "Windows": - self.cpp_info.components["sndfile"].system_libs.append("winmm") - - if self.options.programs: - 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"] = "SndFile" - self.cpp_info.names["cmake_find_package_multi"] = "SndFile" - self.cpp_info.components["sndfile"].set_property("cmake_target_name", "SndFile::sndfile") + self.cpp_info.system_libs.append("winmm") \ No newline at end of file diff --git a/recipes/libsndfile/all/test_package/CMakeLists.txt b/recipes/libsndfile/all/test_package/CMakeLists.txt index 3fb4ef12f8bc8..c6050edfee50e 100644 --- a/recipes/libsndfile/all/test_package/CMakeLists.txt +++ b/recipes/libsndfile/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(SndFile REQUIRED CONFIG) -add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE SndFile::sndfile) +add_executable(${PROJECT_NAME}_c test_package.c) +target_link_libraries(${PROJECT_NAME}_c PRIVATE SndFile::sndfile) + +add_executable(${PROJECT_NAME}_cxx test_package.cpp) +target_link_libraries(${PROJECT_NAME}_cxx PRIVATE SndFile::sndfile) diff --git a/recipes/libsndfile/all/test_package/conanfile.py b/recipes/libsndfile/all/test_package/conanfile.py index d120a992c06a6..cc3db8ee5d1af 100644 --- a/recipes/libsndfile/all/test_package/conanfile.py +++ b/recipes/libsndfile/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() @@ -21,5 +22,7 @@ def build(self): def test(self): if can_run(self): - bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + bin_path = os.path.join(self.cpp.build.bindir, "test_package_c") + self.run(bin_path, env="conanrun") + bin_path = os.path.join(self.cpp.build.bindir, "test_package_cxx") self.run(bin_path, env="conanrun") diff --git a/recipes/libsndfile/all/test_package/test_package.c b/recipes/libsndfile/all/test_package/test_package.c new file mode 100644 index 0000000000000..ef4f2a16fbf4e --- /dev/null +++ b/recipes/libsndfile/all/test_package/test_package.c @@ -0,0 +1,14 @@ +#include "sndfile.h" + +#include + +int main(int argc, char *argv[]) { + if (argc < 2) { + puts("Usage: example \n"); + return 0; + } + SF_INFO sfinfo; + SNDFILE *infile = sf_open (argv[1], SFM_READ, &sfinfo); + printf("Sample rate: %d\n", sfinfo.samplerate); + return 0; +} diff --git a/recipes/libsndfile/all/test_package/test_package.cpp b/recipes/libsndfile/all/test_package/test_package.cpp index 2f577c46055c5..c21e7e86b6c71 100644 --- a/recipes/libsndfile/all/test_package/test_package.cpp +++ b/recipes/libsndfile/all/test_package/test_package.cpp @@ -9,9 +9,9 @@ int main(int argc, char *argv[]) { if (argc < 2) { std::cout << "Usage: example \n"; - } else { - SndfileHandle handle(argv[1]); - std::cout << "Sample rate: " << handle.samplerate() << "\n"; + return 0; } + SndfileHandle handle(argv[1]); + std::cout << "Sample rate: " << handle.samplerate() << "\n"; return 0; } 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/all/test_v1_package/conanfile.py b/recipes/libsndfile/all/test_v1_package/conanfile.py index 38f4483872d47..84595c5cac284 100644 --- a/recipes/libsndfile/all/test_v1_package/conanfile.py +++ b/recipes/libsndfile/all/test_v1_package/conanfile.py @@ -13,5 +13,7 @@ def build(self): def test(self): if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") + 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/libsndfile/config.yml b/recipes/libsndfile/config.yml index c83c8ed241a58..47a9d6a6d063e 100644 --- a/recipes/libsndfile/config.yml +++ b/recipes/libsndfile/config.yml @@ -1,4 +1,8 @@ versions: + "1.2.2": + folder: "all" + "1.2.0": + folder: "all" "1.0.31": folder: "all" "1.0.30": diff --git a/recipes/libsndio/all/conandata.yml b/recipes/libsndio/all/conandata.yml new file mode 100644 index 0000000000000..17fe5ab522e62 --- /dev/null +++ b/recipes/libsndio/all/conandata.yml @@ -0,0 +1,8 @@ +sources: + "1.9.0": + "source": + url: "https://github.com/ratchov/sndio/archive/refs/tags/v1.9.0.tar.gz" + sha256: "4e8d77069b651d7c4bb2a50ba49004bd7fcfdfec1516f88a76457f831c17a546" + "license": + url: "https://raw.githubusercontent.com/ratchov/sndio/e10e4f836b88f8d5ea2864845e3712f560e6bed6/LICENSE" + sha256: "4ae392ab9cfbf2d6ac8522f5f4b025685d60c824979fad783aaf72d55165730f" diff --git a/recipes/libsndio/all/conanfile.py b/recipes/libsndio/all/conanfile.py new file mode 100644 index 0000000000000..8275a8426bd82 --- /dev/null +++ b/recipes/libsndio/all/conanfile.py @@ -0,0 +1,147 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import chdir, copy, get, rmdir, replace_in_file, download +from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps +from conan.tools.scm import Version +from conan.tools.build import cross_building +import os + +required_conan_version = ">=1.53.0" + + +class LibsndioConan(ConanFile): + name = "libsndio" + license = "ISC" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://sndio.org/" + topics = ("sndio", "sound", "audio", "midi") + description = ("A small audio and MIDI framework that provides a lightweight audio & MIDI server " + "and a user-space API to access either the server or the hardware directly in a uniform way.") + package_type = "shared-library" + settings = "os", "arch", "compiler", "build_type" + options = { + "with_alsa": [True, False] + } + default_options = { + "with_alsa": False, + } + + def configure(self): + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def validate(self): + if self.settings.os not in ["Linux", "FreeBSD"]: + raise ConanInvalidConfiguration(f"Unsupported OS for {self.ref}") + + if self.options.with_alsa and not self.dependencies["libalsa"].options.get_safe("shared", False): + raise ConanInvalidConfiguration(f"{self.ref} requires libalsa to be built as a shared library") + + def requirements(self): + if self.options.get_safe("with_alsa"): + self.requires("libalsa/1.2.10", options={"shared": True}) + + def build_requirements(self): + self.tool_requires("libtool/2.4.7") + + def source(self): + get(self, **self.conan_data["sources"][self.version]["source"], strip_root=True) + download(self, **self.conan_data["sources"][self.version]["license"], filename="LICENSE") + + # Remove all targets other than libsndio + lines = [ + "cd sndiod && ${MAKE} install", + "cd sndioctl && ${MAKE} install", + "cd aucat && ${MAKE} install", + "cd midicat && ${MAKE} install", + "cd sndiod && ${MAKE}", + "cd sndioctl && ${MAKE}", + "cd aucat && ${MAKE}", + "cd midicat && ${MAKE}" + ] + for line in lines: + replace_in_file(self, os.path.join(self.source_folder, "Makefile.in"), line, "") + + def generate(self): + virtual_build_env = VirtualBuildEnv(self) + virtual_build_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") + + tc = AutotoolsToolchain(self) + + # Set expected config + tc.configure_args.append("--datadir=${prefix}/res") + + # Bundled `configure` script does not support these options, so remove + exclusions = ["--enable-shared", "--disable-shared", "--disable-static", "--enable-static", "--sbindir", "--oldincludedir"] + tc.configure_args = [arg for arg in tc.configure_args if not any(exclusion in arg for exclusion in exclusions)] + + # Add alsa support + if self.options.get_safe("with_alsa"): + tc.configure_args.append("--enable-alsa") + else: + tc.configure_args.append("--disable-alsa") + + # The original project source has a hand-written `configure` script that does not expose + # many hooks for specifying additional build flags and library dependencies. Because the script is + # not auto-generated with Autotools, the standard Conan workflow of using AutoolsDeps is not possible. + # The one hook the script does provide is a command line arg: `CC=*|CFLAGS=*|LDFLAGS=*|AR=*)`. + # We use this to inject the various flags, paths, and libraries that the Conan dependency tree specifies. + dep_cflags = [] + dep_ldflags = [] + for dependency in reversed(self.dependencies.host.topological_sort.values()): + deps_cpp_info = dependency.cpp_info.aggregated_components() + + dep_cflags.extend(deps_cpp_info.cflags + deps_cpp_info.defines) + for path in deps_cpp_info.includedirs: + dep_cflags.append(f"-I{path}") + + dep_ldflags.extend(deps_cpp_info.sharedlinkflags + deps_cpp_info.exelinkflags) + for path in deps_cpp_info.libdirs: + dep_ldflags.append(f"-L{path}") + for lib in deps_cpp_info.libs + deps_cpp_info.system_libs: + dep_ldflags.append(f"-l{lib}") + + cflags = ' '.join([flag for flag in dep_cflags]) + ldflags = ' '.join([flag for flag in dep_ldflags]) + tc.configure_args.extend([ + f"CFLAGS={cflags}", + f"LDFLAGS={ldflags}" + ]) + + tc.generate() + + tc = AutotoolsDeps(self) + tc.generate() + + def build(self): + autotools = Autotools(self) + autotools.configure() + autotools.make() + + def package(self): + 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, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, 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_file_name", "sndio") + self.cpp_info.set_property("cmake_target_name", "sndio::sndio") + self.cpp_info.set_property("pkg_config_name", "sndio") + self.cpp_info.libs = ["sndio"] + self.cpp_info.system_libs = ["dl", "m", "rt"] + + # TODO: to remove in conan v2? + self.cpp_info.names["cmake_find_package"] = "sndio" + self.cpp_info.names["cmake_find_package_multi"] = "sndio" + self.cpp_info.names["pkg_config"] = "sndio" diff --git a/recipes/libsndio/all/test_package/CMakeLists.txt b/recipes/libsndio/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..29d5d52c61281 --- /dev/null +++ b/recipes/libsndio/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +find_package(sndio REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE sndio::sndio) diff --git a/recipes/libsndio/all/test_package/conanfile.py b/recipes/libsndio/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0a6bc68712d90 --- /dev/null +++ b/recipes/libsndio/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/libsndio/all/test_package/test_package.c b/recipes/libsndio/all/test_package/test_package.c new file mode 100644 index 0000000000000..03387869c0a9d --- /dev/null +++ b/recipes/libsndio/all/test_package/test_package.c @@ -0,0 +1,24 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +int main(int argc, char *argv[]) { + int ch; + unsigned mode = SIO_PLAY | SIO_REC; + struct sio_hdl *hdl; + + hdl = sio_open(NULL, mode, 0); + if (hdl == NULL) { + fprintf(stderr, "sio_open() failed, but test is ok\n"); + exit(0); + } else { + printf("sio_open() success" ); + } + sio_close(hdl); + return 0; +} diff --git a/recipes/libsndio/config.yml b/recipes/libsndio/config.yml new file mode 100644 index 0000000000000..95efce85442dd --- /dev/null +++ b/recipes/libsndio/config.yml @@ -0,0 +1,3 @@ +versions: + "1.9.0": + folder: "all" diff --git a/recipes/libsodium/all/conandata.yml b/recipes/libsodium/all/conandata.yml index d0974216f8865..011a9515014e0 100644 --- a/recipes/libsodium/all/conandata.yml +++ b/recipes/libsodium/all/conandata.yml @@ -1,6 +1,12 @@ # To update the version on CCI, add a new cci.date entry from the stable branch: # https://github.com/jedisct1/libsodium/commits/stable sources: + "1.0.20": + url: "https://github.com/jedisct1/libsodium/archive/1.0.20-RELEASE.tar.gz" + sha256: "8e5aeca07a723a27bbecc3beef14b0068d37e7fc0e97f51b3f1c82d2a58005c1" + "1.0.19": + url: "https://github.com/jedisct1/libsodium/releases/download/1.0.19-RELEASE/libsodium-1.0.19.tar.gz" + sha256: "018d79fe0a045cca07331d37bd0cb57b2e838c51bc48fd837a1472e50068bbea" "1.0.18": url: "https://github.com/jedisct1/libsodium/releases/download/1.0.18-RELEASE/libsodium-1.0.18.tar.gz" sha256: "6f504490b342a4f8a4c4a02fc9b866cbef8622d5df4e5452b46be121e46636c1" diff --git a/recipes/libsodium/all/conanfile.py b/recipes/libsodium/all/conanfile.py index 48c328202cd68..f895ac1f52b3c 100644 --- a/recipes/libsodium/all/conanfile.py +++ b/recipes/libsodium/all/conanfile.py @@ -1,13 +1,14 @@ from conan import ConanFile -from conan.errors import ConanInvalidConfiguration, ConanException +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 export_conandata_patches, apply_conandata_patches, get, rmdir, copy, rm, replace_in_file +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, MSBuildDeps, MSBuildToolchain, MSBuild, VCVars, unix_path, msvc_runtime_flag, vs_layout +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime, MSBuild, MSBuildToolchain import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.54.0" class LibsodiumConan(ConanFile): @@ -49,24 +50,12 @@ def config_options(self): 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 + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): - if is_msvc(self): - vs_layout(self) - else: - basic_layout(self, src_folder="src") + basic_layout(self, src_folder="src") def validate(self): if self.options.shared and is_msvc(self) and is_msvc_static_runtime(self): @@ -81,136 +70,87 @@ def build_requirements(self): 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.generate() - tc = MSBuildDeps(self) - tc.generate() - tc = VCVars(self) + tc.configuration = "{}{}".format( + "Debug" if self.settings.build_type == "Debug" else "Release", + "DLL" if self.options.shared else "LIB", + ) tc.generate() else: - tc = AutotoolsToolchain(self) + 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))) - - env = tc.environment() - - # if self._is_mingw: - # add libssp (gcc support library) for some missing symbols (e.g. __strcpy_chk) - # FIXME how do I do this in conan v2? - # autotools.libs.append("ssp") - + 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(env) - - env = VirtualBuildEnv(self) - env.generate() - - def source(self): - get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + 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", - } - elif self.settings.compiler == "msvc": - folder = { + }, + "msvc": { + "170": "vs2012", + "180": "vs2013", "190": "vs2015", "191": "vs2017", "192": "vs2019", - } - else: - raise ConanException("Should not call this function with any other compiler") - + }, + } + 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) - @property - def _msvc_platform(self): - return { - "x86": "Win32", - "x86_64": "x64", - }[str(self.settings.arch)] - - # Method copied from xz_utils - def _fix_msvc_platform_toolset(self, vcxproj_file, old_toolset): - platform_toolset = { - "Visual Studio": { - "8": "v80", - "9": "v90", - "10": "v100", - "11": "v110", - "12": "v120", - "14": "v140", - "15": "v141", - "16": "v142", - "17": "v143", - }, - "msvc": { - "170": "v110", - "180": "v120", - "190": "v140", - "191": "v141", - "192": "v142", - "193": "v143", - } - }.get(str(self.settings.compiler), {}).get(str(self.settings.compiler.version)) - if not platform_toolset: - raise ConanException( - f"Unknown platform toolset for {self.settings.compiler} {self.settings.compiler.version}", + def _build_msvc(self): + 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, - vcxproj_file, - f"{old_toolset}", - f"{platform_toolset}", + self, os.path.join(msvc_sln_folder, "libsodium", "libsodium.vcxproj"), + "", + f"", ) + #============================== - def _build_msvc(self): - msvc_ver_subfolder = self._msvc_sln_folder or ("vs2022" if self.version != "1.0.18" else "vs2019") - msvc_sln_folder = os.path.join(self.build_folder, self.source_folder, "builds", "msvc", msvc_ver_subfolder) - - msvc_sln_path = os.path.join(msvc_sln_folder, "libsodium.sln") - - # 1.0.18 only supported up to vs2019. Add support for newer toolsets. - if self.version == "1.0.18" and msvc_ver_subfolder == "vs2019": - vcxproj_path = os.path.join(msvc_sln_folder, "libsodium", "libsodium.vcxproj") - self._fix_msvc_platform_toolset(vcxproj_path, "v142") - - build_type = "{}{}".format( + msbuild = MSBuild(self) + msbuild.build_type = "{}{}".format( "Dyn" if self.options.shared else "Static", "Debug" if self.settings.build_type == "Debug" else "Release", ) - - platform = { - "x86": "Win32", - "x86_64": "x64", - }[str(self.settings.arch)] - - msbuild = MSBuild(self) - msbuild.build_type = build_type - msbuild.platform = platform - msbuild.build(msvc_sln_path) - + msbuild.platform = "Win32" if self.settings.arch == "x86" else msbuild.platform + msbuild.build(os.path.join(msvc_sln_folder, "libsodium.sln")) def build(self): apply_conandata_patches(self) @@ -218,22 +158,25 @@ def build(self): self._build_msvc() else: autotools = Autotools(self) + if self._is_mingw: + autotools.autoreconf() autotools.configure() autotools.make() def package(self): - copy(self, "*LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"), keep_path=False) + copy(self, "*LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) if is_msvc(self): - 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) - inc_src = os.path.join(self.source_folder, "src", self.name, "include") - copy(self, "*.h", src=inc_src, dst=os.path.join(self.package_folder, "include"), keep_path=True, excludes=("*/private/*")) + 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 = 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)}"]) + autotools.install() 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") diff --git a/recipes/libsodium/all/test_package/CMakeLists.txt b/recipes/libsodium/all/test_package/CMakeLists.txt index b1d5e6b147fa4..ffb72d743454e 100644 --- a/recipes/libsodium/all/test_package/CMakeLists.txt +++ b/recipes/libsodium/all/test_package/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) find_package(libsodium REQUIRED CONFIG) diff --git a/recipes/libsodium/all/test_v1_package/CMakeLists.txt b/recipes/libsodium/all/test_v1_package/CMakeLists.txt index b8e19e1fbee26..0d20897301b68 100644 --- a/recipes/libsodium/all/test_v1_package/CMakeLists.txt +++ b/recipes/libsodium/all/test_v1_package/CMakeLists.txt @@ -1,8 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +conan_basic_setup(TARGETS) -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -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/libsodium/all/test_v1_package/conanfile.py b/recipes/libsodium/all/test_v1_package/conanfile.py index 5a299b64446c9..38f4483872d47 100644 --- a/recipes/libsodium/all/test_v1_package/conanfile.py +++ b/recipes/libsodium/all/test_v1_package/conanfile.py @@ -3,8 +3,8 @@ class TestPackageConan(ConanFile): - settings = "os", "compiler", "arch", "build_type" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" def build(self): cmake = CMake(self) diff --git a/recipes/libsodium/config.yml b/recipes/libsodium/config.yml index 819e72ce10826..124484cdfba0a 100644 --- a/recipes/libsodium/config.yml +++ b/recipes/libsodium/config.yml @@ -1,4 +1,8 @@ versions: + "1.0.20": + folder: all + "1.0.19": + folder: all "1.0.18": folder: all "cci.20220430": diff --git a/recipes/libsolace/all/conandata.yml b/recipes/libsolace/all/conandata.yml index f0faad0897234..4f59b4c769d25 100644 --- a/recipes/libsolace/all/conandata.yml +++ b/recipes/libsolace/all/conandata.yml @@ -1,11 +1,7 @@ sources: - "0.3.6": - sha256: ea9847005d0a680264986ddab5b1c077b04b80f02a2529cc38e8191b64ea97c7 - url: https://github.com/abbyssoul/libsolace/archive/v0.3.6.zip - "0.3.7": - sha256: 7f9790f850a0d7209f95be03e1c58e67f91faeec2e12709893cf32e5f09aa6d0 - url: https://github.com/abbyssoul/libsolace/archive/v0.3.7.zip + "0.4.1": + url: "https://github.com/abbyssoul/libsolace/archive/v0.4.1.zip" + sha256: "56d91ff180223322e0a93d62eb9f3974555f085d8e4e6e8435708d2bed0dfa0e" "0.3.9": - sha256: 5a91cc000d0ef5c51fb58197a8e3ef003fa191926f4f2511b7e8940648f007ce - url: https://github.com/abbyssoul/libsolace/archive/v0.3.9.zip - + url: "https://github.com/abbyssoul/libsolace/archive/v0.3.9.zip" + sha256: "5a91cc000d0ef5c51fb58197a8e3ef003fa191926f4f2511b7e8940648f007ce" diff --git a/recipes/libsolace/all/conanfile.py b/recipes/libsolace/all/conanfile.py index ba37d1a345156..e1bc3a637dd18 100644 --- a/recipes/libsolace/all/conanfile.py +++ b/recipes/libsolace/all/conanfile.py @@ -1,66 +1,98 @@ import os -from conans import CMake, 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.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, replace_in_file +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" + class LibsolaceConan(ConanFile): name = "libsolace" - description = "High performance components for mission critical applications" - topics = ("HPC", "High reliability", "P10", "solace", "performance", "c++", "conan") + description = "High-performance components for mission-critical applications" + license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/abbyssoul/libsolace" - license = "Apache-2.0" - settings = "os", "compiler", "build_type", "arch" + topics = ("HPC", "High reliability", "P10", "solace", "performance", "c++") + + 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, } - default_options = {"shared": False, "fPIC": True} - generators = "cmake" @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 17 @property - def _supported_cppstd(self): - return ["17", "gnu17", "20", "gnu20"] + def _compilers_minimum_version(self): + return { + "gcc": "7", + "clang": "5", + "apple-clang": "9", + } + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC def configure(self): - compiler_version = tools.Version(str(self.settings.compiler.version)) + 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 == "Windows": - raise ConanInvalidConfiguration("This library is not yet compatible with Windows") - # Exclude compilers that claims to support C++17 but do not in practice - if (self.settings.compiler == "gcc" and compiler_version < "7") or \ - (self.settings.compiler == "clang" and compiler_version < "5") or \ - (self.settings.compiler == "apple-clang" and compiler_version < "9"): - raise ConanInvalidConfiguration("This library requires C++17 or higher support standard. {} {} is not supported".format(self.settings.compiler, self.settings.compiler.version)) - if self.settings.compiler.cppstd and not self.settings.compiler.cppstd in self._supported_cppstd: - raise ConanInvalidConfiguration("This library requires c++17 standard or higher. {} required".format(self.settings.compiler.cppstd)) + raise ConanInvalidConfiguration("This library is not yet compatible with Windows") + + 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]) - 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 generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["PKG_CONFIG"] = False + tc.cache_variables["SOLACE_GTEST_SUPPORT"] = False + tc.generate() - def _configure_cmake(self): - cmake = CMake(self, parallel=True) - cmake.definitions["PKG_CONFIG"] = "OFF" - cmake.definitions["SOLACE_GTEST_SUPPORT"] = "OFF" - cmake.configure(source_folder=self._source_subfolder) - return cmake + def _patch_sources(self): + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)\nconan_basic_setup()", + "") def build(self): - cmake = self._configure_cmake() + self._patch_sources() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - cmake = self._configure_cmake() + cmake = CMake(self) cmake.install() - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) + copy(self, "LICENSE", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder) def package_info(self): self.cpp_info.libs = ["solace"] - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("m") diff --git a/recipes/libsolace/all/test_package/CMakeLists.txt b/recipes/libsolace/all/test_package/CMakeLists.txt index a4b980e0e807c..8301614166c20 100644 --- a/recipes/libsolace/all/test_package/CMakeLists.txt +++ b/recipes/libsolace/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ -cmake_minimum_required(VERSION 3.3) +cmake_minimum_required(VERSION 3.15) project(PackageTest CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(libsolace REQUIRED CONFIG) set(CMAKE_CXX_STANDARD_REQUIRED on) @@ -10,4 +9,4 @@ add_executable(example example.cpp) # libsolace requires at least C++17 set_target_properties(example PROPERTIES CXX_STANDARD 17) -target_link_libraries(example ${CONAN_LIBS}) +target_link_libraries(example libsolace::libsolace) diff --git a/recipes/libsolace/all/test_package/conanfile.py b/recipes/libsolace/all/test_package/conanfile.py index ce9505669ad4f..8d52b7021efe1 100644 --- a/recipes/libsolace/all/test_package/conanfile.py +++ b/recipes/libsolace/all/test_package/conanfile.py @@ -1,19 +1,26 @@ +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 SolaceTestConan(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) - # 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): - with tools.chdir("bin"): - self.run(".%sexample" % os.sep, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindir, "example") + self.run(bin_path, env="conanrun") diff --git a/recipes/libsolace/all/test_v1_package/CMakeLists.txt b/recipes/libsolace/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/libsolace/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/libsolace/all/test_v1_package/conanfile.py b/recipes/libsolace/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..890f8e01b2489 --- /dev/null +++ b/recipes/libsolace/all/test_v1_package/conanfile.py @@ -0,0 +1,19 @@ +import os +from conans import ConanFile, CMake, tools + + +class SolaceTestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + 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): + with tools.chdir("bin"): + self.run(".%sexample" % os.sep, run_environment=True) diff --git a/recipes/libsolace/config.yml b/recipes/libsolace/config.yml index e3af7d3426c10..c9e2a428688a9 100644 --- a/recipes/libsolace/config.yml +++ b/recipes/libsolace/config.yml @@ -1,7 +1,5 @@ versions: - 0.3.6: - folder: all - 0.3.7: + 0.4.1: folder: all 0.3.9: folder: all 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..f0e08820bfdc4 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 = "library" 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/libspatialite/all/conandata.yml b/recipes/libspatialite/all/conandata.yml index 0aae59d1f7126..d34eec9877d84 100644 --- a/recipes/libspatialite/all/conandata.yml +++ b/recipes/libspatialite/all/conandata.yml @@ -1,12 +1,14 @@ sources: + "5.1.0": + url: "https://www.gaia-gis.it/gaia-sins/libspatialite-sources/libspatialite-5.1.0.tar.gz" + sha256: "43be2dd349daffe016dd1400c5d11285828c22fea35ca5109f21f3ed50605080" "5.0.1": url: "https://www.gaia-gis.it/gaia-sins/libspatialite-sources/libspatialite-5.0.1.tar.gz" sha256: "eecbc94311c78012d059ebc0fae86ea5ef6eecb13303e6e82b3753c1b3409e98" patches: + "5.1.0": + - patch_file: "patches/5.1.0/0002-nmake-honor-flags.patch" + - patch_file: "patches/5.0.1/0003-msvc-minizip.patch" "5.0.1": - - patch_file: "patches/0001-autotools-no-geos-config.patch" - base_path: "source_subfolder" - - patch_file: "patches/0002-nmake-honor-flags.patch" - base_path: "source_subfolder" - - patch_file: "patches/0003-msvc-minizip.patch" - base_path: "source_subfolder" + - patch_file: "patches/5.0.1/0002-nmake-honor-flags.patch" + - patch_file: "patches/5.0.1/0003-msvc-minizip.patch" diff --git a/recipes/libspatialite/all/conanfile.py b/recipes/libspatialite/all/conanfile.py index f8d65b6681064..f232307e3ab5e 100644 --- a/recipes/libspatialite/all/conanfile.py +++ b/recipes/libspatialite/all/conanfile.py @@ -1,8 +1,17 @@ -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, + 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 import os -required_conan_version = ">=1.36.0" +required_conan_version = ">=1.58.0" class LibspatialiteConan(ConanFile): @@ -15,7 +24,7 @@ class LibspatialiteConan(ConanFile): topics = ("spatialite", "database", "sql", "sqlite", "ogc") homepage = "https://www.gaia-gis.it/fossil/libspatialite" url = "https://github.com/conan-io/conan-center-index" - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -52,23 +61,12 @@ class LibspatialiteConan(ConanFile): "with_minizip": True, } - 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) 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": @@ -76,174 +74,192 @@ 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") if not self.options.with_geos: del self.options.with_rttopo del self.options.gcp + def layout(self): + basic_layout(self, src_folder="src") + def requirements(self): - self.requires("sqlite3/3.38.1") - self.requires("zlib/1.2.12") + # Included in public spatialite/sqlite.h + # https://www.gaia-gis.it/fossil/libspatialite/file?name=src/headers/spatialite/sqlite.h&ci=tip + self.requires("sqlite3/3.44.2", transitive_headers=True, transitive_libs=True) + self.requires("zlib/[>=1.2.11 <2]") if self.options.with_proj: - self.requires("proj/9.0.0") + self.requires("proj/9.3.1") if self.options.with_iconv: - self.requires("libiconv/1.16") + self.requires("libiconv/1.17") if self.options.with_freexl: - self.requires("freexl/1.0.6") + self.requires("freexl/2.0.0") if self.options.with_geos: - self.requires("geos/3.10.2") + self.requires("geos/3.12.0") if self.options.get_safe("with_rttopo"): self.requires("librttopo/1.1.0") if self.options.with_libxml2: - self.requires("libxml2/2.9.13") + self.requires("libxml2/2.12.4") if self.options.with_minizip: - self.requires("minizip/1.2.12") + self.requires("minizip/1.2.13") 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/2.1.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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + if is_msvc(self): + tc = NMakeToolchain(self) + tc.extra_defines.append("YY_NO_UNISTD_H") + if self.options.shared: + tc.extra_defines.append("DLL_EXPORT") + 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) + yes_no = lambda v: "yes" if v else "no" + tc.configure_args.extend([ + f"--enable-mathsql={yes_no(self.options.mathsql)}", + f"--enable-geocallbacks={yes_no(self.options.geocallbacks)}", + f"--enable-knn={yes_no(self.options.knn)}", + f"--enable-proj={yes_no(self.options.with_proj)}", + f"--enable-iconv={yes_no(self.options.with_iconv)}", + f"--enable-freexl={yes_no(self.options.with_freexl)}", + f"--enable-epsg={yes_no(self.options.epsg)}", + f"--enable-geos={yes_no(self.options.with_geos)}", + f"--enable-libxml2={yes_no(self.options.with_libxml2)}", + f"--enable-minizip={yes_no(self.options.with_minizip)}", + f"--enable-geopackage={yes_no(self.options.geopackage)}", + "--disable-gcov", + "--disable-examples", + "--disable-module-only", + ]) + if self.options.with_geos: + tc.configure_args.extend([ + f"--enable-gcp={yes_no(self.options.gcp)}", + "--enable-geosadvanced=yes", + "--enable-geosreentrant=yes", + "--enable-geosonlyreentrant=no", + "--enable-geos370=yes", + f"--enable-rttopo={yes_no(self.options.with_rttopo)}", + "--with-geosconfig=true", # Using `true` command for a no-op + ]) + tc.generate() + + deps = AutotoolsDeps(self) + deps.generate() + deps = PkgConfigDeps(self) + deps.generate() def _build_msvc(self): # Visual Studio build doesn't provide options, we need to manually edit gaiaconfig-msvc.h - gaiaconfig_msvc = os.path.join(self._source_subfolder, "src", "headers", "spatialite", "gaiaconfig-msvc.h") + gaiaconfig_msvc = os.path.join(self.source_folder, "src", "headers", "spatialite", "gaiaconfig-msvc.h") if not self.options.mathsql: - tools.replace_in_file(gaiaconfig_msvc, "/* #undef OMIT_MATHSQL */", "#define OMIT_MATHSQL 1") + replace_in_file(self, gaiaconfig_msvc, "/* #undef OMIT_MATHSQL */", "#define OMIT_MATHSQL 1") if self.options.geocallbacks: - tools.replace_in_file(gaiaconfig_msvc, "#define OMIT_GEOCALLBACKS 1", "") + replace_in_file(self, gaiaconfig_msvc, "#define OMIT_GEOCALLBACKS 1", "") if not self.options.knn: - tools.replace_in_file(gaiaconfig_msvc, "/* #undef OMIT_KNN */", "#define OMIT_KNN 1") + replace_in_file(self, gaiaconfig_msvc, "/* #undef OMIT_KNN */", "#define OMIT_KNN 1") if not self.options.epsg: - tools.replace_in_file(gaiaconfig_msvc, "/* #undef OMIT_EPSG */", "#define OMIT_EPSG 1") + replace_in_file(self, gaiaconfig_msvc, "/* #undef OMIT_EPSG */", "#define OMIT_EPSG 1") if not self.options.geopackage: - tools.replace_in_file(gaiaconfig_msvc, "#define ENABLE_GEOPACKAGE 1", "") + replace_in_file(self, gaiaconfig_msvc, "#define ENABLE_GEOPACKAGE 1", "") if not self.options.get_safe("gcp", False): - tools.replace_in_file(gaiaconfig_msvc, "#define ENABLE_GCP 1", "") + replace_in_file(self, gaiaconfig_msvc, "#define ENABLE_GCP 1", "") if not self.options.with_proj: - tools.replace_in_file(gaiaconfig_msvc, "/* #undef OMIT_PROJ */", "#define OMIT_PROJ 1") + replace_in_file(self, gaiaconfig_msvc, "/* #undef OMIT_PROJ */", "#define OMIT_PROJ 1") if not self.options.with_iconv: - tools.replace_in_file(gaiaconfig_msvc, "/* #undef OMIT_ICONV */", "#define OMIT_ICONV 1") + replace_in_file(self, gaiaconfig_msvc, "/* #undef OMIT_ICONV */", "#define OMIT_ICONV 1") if not self.options.with_freexl: - tools.replace_in_file(gaiaconfig_msvc, "/* #undef OMIT_FREEXL */", "#define OMIT_FREEXL 1") + replace_in_file(self, gaiaconfig_msvc, "/* #undef OMIT_FREEXL */", "#define OMIT_FREEXL 1") if not self.options.with_geos: - tools.replace_in_file(gaiaconfig_msvc, "/* #undef OMIT_GEOS */", "#define OMIT_GEOS 1") + replace_in_file(self, gaiaconfig_msvc, "/* #undef OMIT_GEOS */", "#define OMIT_GEOS 1") if not self.options.get_safe("with_rttopo", False): - tools.replace_in_file(gaiaconfig_msvc, "#define ENABLE_RTTOPO 1", "") + replace_in_file(self, gaiaconfig_msvc, "#define ENABLE_RTTOPO 1", "") if not self.options.with_libxml2: - tools.replace_in_file(gaiaconfig_msvc, "#define ENABLE_LIBXML2 1", "") + replace_in_file(self, gaiaconfig_msvc, "#define ENABLE_LIBXML2 1", "") if not self.options.with_minizip: - tools.replace_in_file(gaiaconfig_msvc, "#define ENABLE_MINIZIP 1", "") + replace_in_file(self, gaiaconfig_msvc, "#define ENABLE_MINIZIP 1", "") + + # Workaround for a NMakeDeps define quoting issue: + # https://github.com/conan-io/conan/issues/13603 + replace_in_file(self, os.path.join(self.generators_folder, "conannmakedeps.bat"), + r'/DSQLITE_API#\"__declspec(dllimport)\"', + "/DSQLITE_API#__declspec(dllimport)", strict=False) target = "spatialite_i.lib" if self.options.shared else "spatialite.lib" - optflags = ["-DYY_NO_UNISTD_H"] - system_libs = [lib + ".lib" for lib in self.deps_cpp_info.system_libs] - if self.options.shared: - optflags.append("-DDLL_EXPORT") - with tools.chdir(self._source_subfolder): - with tools.vcvars(self): - with tools.environment_append(VisualStudioBuildEnvironment(self).vars): - self.run("nmake -f makefile.vc {} OPTFLAGS=\"{}\" SYSTEM_LIBS=\"{}\"".format(target, - " ".join(optflags), - " ".join(system_libs))) + with chdir(self, self.source_folder): + self.run(f"nmake -f makefile.vc {target}") - def _build_autotools(self): + def _patch_autotools(self): # fix MinGW - tools.replace_in_file(os.path.join(self._source_subfolder, "configure.ac"), - "AC_CHECK_LIB(z,", - "AC_CHECK_LIB({},".format(self.deps_cpp_info["zlib"].libs[0])) + replace_in_file( + self, os.path.join(self.source_folder, "configure.ac"), + "AC_CHECK_LIB(z,", + "AC_CHECK_LIB({},".format(self.dependencies["zlib"].cpp_info.aggregated_components().libs[0]), + ) # Disable tests - tools.replace_in_file(os.path.join(self._source_subfolder, "Makefile.am"), - "SUBDIRS = src test $(EXAMPLES)", - "SUBDIRS = src $(EXAMPLES)") - - with tools.chdir(self._source_subfolder): - self.run("{} -fiv".format(tools.get_env("AUTORECONF")), win_bash=tools.os_info.is_windows) - # 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), - ) - with tools.run_environment(self): - autotools = self._configure_autotools() - autotools.make() - - @functools.lru_cache(1) - def _configure_autotools(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)), - "--enable-mathsql={}".format(yes_no(self.options.mathsql)), - "--enable-geocallbacks={}".format(yes_no(self.options.geocallbacks)), - "--enable-knn={}".format(yes_no(self.options.knn)), - "--enable-proj={}".format(yes_no(self.options.with_proj)), - "--enable-iconv={}".format(yes_no(self.options.with_iconv)), - "--enable-freexl={}".format(yes_no(self.options.with_freexl)), - "--enable-epsg={}".format(yes_no(self.options.epsg)), - "--enable-geos={}".format(yes_no(self.options.with_geos)), - "--enable-libxml2={}".format(yes_no(self.options.with_libxml2)), - "--enable-minizip={}".format(yes_no(self.options.with_minizip)), - "--enable-geopackage={}".format(yes_no(self.options.geopackage)), - "--disable-gcov", - "--disable-examples", - "--disable-module-only", - ] - if self.options.with_geos: - args.extend([ - "--enable-gcp={}".format(yes_no(self.options.gcp)), - "--enable-geosadvanced=yes", - "--enable-geosreentrant=yes", - "--enable-geosonlyreentrant=no", - "--enable-geos370=yes", - "--enable-rttopo={}".format(yes_no(self.options.with_rttopo)), - ]) + replace_in_file(self, os.path.join(self.source_folder, "Makefile.am"), + "SUBDIRS = src test $(EXAMPLES)", + "SUBDIRS = src $(EXAMPLES)") + # We can't use geos-config file in conan because it's a non-relocatable file, + # therefore not packaged by geos recipe of conan-center-index. + # Instead, we rely on AutoToolsBuildEnvironment helper to inject proper flags. + configure_ac = os.path.join(self.source_folder, "configure.ac") + replace_in_file(self, configure_ac, "AC_MSG_ERROR([the user-specified geos-config", "echo # ") + replace_in_file(self, configure_ac, "AC_CHECK_HEADERS([geos_c.h", "# ") + replace_in_file(self, configure_ac, "AC_SEARCH_LIBS(GEOSCoveredBy", "# ") - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - autotools.configure(args=args) - return autotools + def _build_autotools(self): + self._patch_autotools() + autotools = Autotools(self) + autotools.autoreconf() + autotools.configure() + autotools.make() 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: self._build_autotools() def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - if self._is_msvc: - self.copy("spatialite.h", dst="include", src=os.path.join(self._source_subfolder, "src", "headers")) - self.copy("*.h", dst=os.path.join("include", "spatialite"), src=os.path.join(self._source_subfolder, "src", "headers", "spatialite")) - 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, "spatialite.h", src=os.path.join(self.source_folder, "src", "headers"), + dst=os.path.join(self.package_folder, "include")) + copy(self, "*.h", src=os.path.join(self.source_folder, "src", "headers", "spatialite"), + dst=os.path.join(self.package_folder, "include", "spatialite")) + 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: - with tools.chdir(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")) + 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", "spatialite") - suffix = "_i" if self._is_msvc and self.options.shared else "" - self.cpp_info.libs = ["spatialite{}".format(suffix)] + suffix = "_i" if is_msvc(self) and self.options.shared else "" + self.cpp_info.libs = [f"spatialite{suffix}"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.extend(["m", "pthread"]) - - # TODO: to remove in conan v2 once pkg_config generator removed - self.cpp_info.names["pkg_config"] = "spatialite" diff --git a/recipes/libspatialite/all/patches/0001-autotools-no-geos-config.patch b/recipes/libspatialite/all/patches/0001-autotools-no-geos-config.patch deleted file mode 100644 index 0da26fe7f8512..0000000000000 --- a/recipes/libspatialite/all/patches/0001-autotools-no-geos-config.patch +++ /dev/null @@ -1,22 +0,0 @@ -We can't use geos-config file in conan because it's a non-relocatable file, -therefore not packaged by geos recipe of conan-center-index. -Instead we rely on AutoToolsBuildEnvironment helper to inject proper flags. - ---- a/configure.ac -+++ b/configure.ac -@@ -311,6 +311,7 @@ AC_ARG_ENABLE(geos, [AS_HELP_STRING( - [--enable-geos], [enables GEOS inclusion [default=yes]])], - [], [enable_geos=yes]) - if test x"$enable_geos" != "xno"; then -+ if false; then - #----------------------------------------------------------------------- - # --with-geosconfig - # -@@ -352,6 +353,7 @@ if test x"$enable_geos" != "xno"; then - AC_SEARCH_LIBS(GEOSCoveredBy,geos_c,,AC_MSG_ERROR([could not find libgeos_c (or obsolete 'libgeos_c' < v.3.3.0 found) - you may need to specify the directory of a geos-config file using --with-geosconfig])) - LIBS="$LIBS_SAVE" - LIBS="$LIBS $GEOS_LDFLAGS -lgeos_c" -+ fi - - #----------------------------------------------------------------------- - # --enable-controlpoints diff --git a/recipes/libspatialite/all/patches/0002-nmake-honor-flags.patch b/recipes/libspatialite/all/patches/0002-nmake-honor-flags.patch deleted file mode 100644 index e58e6153c5dbb..0000000000000 --- a/recipes/libspatialite/all/patches/0002-nmake-honor-flags.patch +++ /dev/null @@ -1,37 +0,0 @@ -This patch for msvc build allows to: -* define OPTFLAG ourself from conanfile (allow to honor profile) -* inject a custom SYSTEM_LIBS variable from conanfile (allow robust shared build) -* not hardcode this very specific C:\OSGeo4W environment - ---- a/makefile.vc -+++ b/makefile.vc -@@ -2,7 +2,6 @@ - # - # NMAKE Makefile to build libspatialite on Windows - # --!INCLUDE nmake.opt - - LIBOBJ = src\gaiaaux\gg_sqlaux.obj src\gaiaaux\gg_utf8.obj \ - src\gaiaexif\gaia_exif.obj src\gaiageo\gg_advanced.obj \ -@@ -93,7 +92,7 @@ LIBOBJ = src\gaiaaux\gg_sqlaux.obj src\gaiaaux\gg_utf8.obj \ - SPATIALITE_DLL = spatialite$(VERSION).dll - - CFLAGS = /nologo -I.\src\headers -I.\src\topology \ -- -I. -IC:\OSGeo4W\include $(OPTFLAGS) -+ -I. $(CFLAGS) $(OPTFLAGS) - - default: all - -@@ -108,11 +107,7 @@ $(SPATIALITE_DLL): spatialite_i.lib - - spatialite_i.lib: $(LIBOBJ) - link /dll /out:$(SPATIALITE_DLL) \ -- /implib:spatialite_i.lib $(LIBOBJ) \ -- C:\OSGeo4W\lib\proj_i.lib C:\OSGeo4W\lib\geos_c.lib \ -- C:\OSGeo4w\lib\freexl_i.lib C:\OSGeo4w\lib\iconv.lib \ -- C:\OSGeo4W\lib\sqlite3_i.lib C:\OSGeo4W\lib\zlib.lib \ -- C:\OSGeo4W\lib\libxml2.lib C:\OSGeo4W\lib\librttopo.lib -+ /implib:spatialite_i.lib $(LIBOBJ) $(SYSTEM_LIBS) - if exist $(SPATIALITE_DLL).manifest mt -manifest \ - $(SPATIALITE_DLL).manifest -outputresource:$(SPATIALITE_DLL);2 - diff --git a/recipes/libspatialite/all/patches/5.0.1/0002-nmake-honor-flags.patch b/recipes/libspatialite/all/patches/5.0.1/0002-nmake-honor-flags.patch new file mode 100644 index 0000000000000..d879bcc3f22dc --- /dev/null +++ b/recipes/libspatialite/all/patches/5.0.1/0002-nmake-honor-flags.patch @@ -0,0 +1,36 @@ +This patch for msvc build allows to: +* define OPTFLAG ourself from conanfile (allow to honor profile) +* not hardcode this very specific C:\OSGeo4W environment + +--- a/makefile.vc ++++ b/makefile.vc +@@ -2,7 +2,6 @@ + # + # NMAKE Makefile to build libspatialite on Windows + # +-!INCLUDE nmake.opt + + LIBOBJ = src\gaiaaux\gg_sqlaux.obj src\gaiaaux\gg_utf8.obj \ + src\gaiaexif\gaia_exif.obj src\gaiageo\gg_advanced.obj \ +@@ -93,7 +92,7 @@ LIBOBJ = src\gaiaaux\gg_sqlaux.obj src\gaiaaux\gg_utf8.obj \ + SPATIALITE_DLL = spatialite$(VERSION).dll + + CFLAGS = /nologo -I.\src\headers -I.\src\topology \ +- -I. -IC:\OSGeo4W\include $(OPTFLAGS) ++ -I. $(CFLAGS) $(OPTFLAGS) + + default: all + +@@ -108,11 +107,7 @@ $(SPATIALITE_DLL): spatialite_i.lib + + spatialite_i.lib: $(LIBOBJ) + link /dll /out:$(SPATIALITE_DLL) \ +- /implib:spatialite_i.lib $(LIBOBJ) \ +- C:\OSGeo4W\lib\proj_i.lib C:\OSGeo4W\lib\geos_c.lib \ +- C:\OSGeo4w\lib\freexl_i.lib C:\OSGeo4w\lib\iconv.lib \ +- C:\OSGeo4W\lib\sqlite3_i.lib C:\OSGeo4W\lib\zlib.lib \ +- C:\OSGeo4W\lib\libxml2.lib C:\OSGeo4W\lib\librttopo.lib ++ /implib:spatialite_i.lib $(LIBOBJ) + if exist $(SPATIALITE_DLL).manifest mt -manifest \ + $(SPATIALITE_DLL).manifest -outputresource:$(SPATIALITE_DLL);2 + diff --git a/recipes/libspatialite/all/patches/0003-msvc-minizip.patch b/recipes/libspatialite/all/patches/5.0.1/0003-msvc-minizip.patch similarity index 100% rename from recipes/libspatialite/all/patches/0003-msvc-minizip.patch rename to recipes/libspatialite/all/patches/5.0.1/0003-msvc-minizip.patch diff --git a/recipes/libspatialite/all/patches/5.1.0/0002-nmake-honor-flags.patch b/recipes/libspatialite/all/patches/5.1.0/0002-nmake-honor-flags.patch new file mode 100644 index 0000000000000..23016b01dd132 --- /dev/null +++ b/recipes/libspatialite/all/patches/5.1.0/0002-nmake-honor-flags.patch @@ -0,0 +1,36 @@ +This patch for msvc build allows to: +* define OPTFLAG ourself from conanfile (allow to honor profile) +* not hardcode this very specific C:\OSGeo4W environment + +--- a/makefile.vc ++++ b/makefile.vc +@@ -2,7 +2,6 @@ + # + # NMAKE Makefile to build libspatialite on Windows + # +-!INCLUDE nmake.opt + + LIBOBJ = src\gaiaaux\gg_sqlaux.obj src\gaiaaux\gg_utf8.obj \ + src\gaiaexif\gaia_exif.obj src\gaiageo\gg_advanced.obj \ +@@ -96,7 +95,7 @@ + SPATIALITE_DLL = spatialite$(VERSION).dll + + CFLAGS = /nologo -I.\src\headers -I.\src\topology \ +- -I. -IC:\OSGeo4W\include $(OPTFLAGS) ++ -I. $(CFLAGS) $(OPTFLAGS) + + default: all + +@@ -111,11 +110,7 @@ + + spatialite_i.lib: $(LIBOBJ) + link /dll /out:$(SPATIALITE_DLL) \ +- /implib:spatialite_i.lib $(LIBOBJ) \ +- C:\OSGeo4W\lib\proj_i.lib C:\OSGeo4W\lib\geos_c.lib \ +- C:\OSGeo4w\lib\freexl_i.lib C:\OSGeo4w\lib\iconv.lib \ +- C:\OSGeo4W\lib\sqlite3_i.lib C:\OSGeo4W\lib\zlib.lib \ +- C:\OSGeo4W\lib\libxml2.lib C:\OSGeo4W\lib\librttopo.lib ++ /implib:spatialite_i.lib $(LIBOBJ) + if exist $(SPATIALITE_DLL).manifest mt -manifest \ + $(SPATIALITE_DLL).manifest -outputresource:$(SPATIALITE_DLL);2 + diff --git a/recipes/libspatialite/all/test_package/CMakeLists.txt b/recipes/libspatialite/all/test_package/CMakeLists.txt index 3e0f638e21270..9e65e602672c8 100644 --- a/recipes/libspatialite/all/test_package/CMakeLists.txt +++ b/recipes/libspatialite/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(libspatialite REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} libspatialite::libspatialite) +target_link_libraries(${PROJECT_NAME} PRIVATE libspatialite::libspatialite) diff --git a/recipes/libspatialite/all/test_package/conanfile.py b/recipes/libspatialite/all/test_package/conanfile.py index 697dfef261b53..0a6bc68712d90 100644 --- a/recipes/libspatialite/all/test_package/conanfile.py +++ b/recipes/libspatialite/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/libspatialite/all/test_v1_package/CMakeLists.txt b/recipes/libspatialite/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libspatialite/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libspatialite/all/test_v1_package/conanfile.py b/recipes/libspatialite/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libspatialite/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/libspatialite/config.yml b/recipes/libspatialite/config.yml index 5787f28e91cf3..5da3767a58773 100644 --- a/recipes/libspatialite/config.yml +++ b/recipes/libspatialite/config.yml @@ -1,3 +1,5 @@ versions: + "5.1.0": + folder: all "5.0.1": folder: all diff --git a/recipes/libspng/all/conandata.yml b/recipes/libspng/all/conandata.yml index 20e5a777bfee5..39fc43e8152e7 100644 --- a/recipes/libspng/all/conandata.yml +++ b/recipes/libspng/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.7.4": + url: "https://github.com/randy408/libspng/archive/refs/tags/v0.7.4.tar.gz" + sha256: "47ec02be6c0a6323044600a9221b049f63e1953faf816903e7383d4dc4234487" "0.7.3": url: "https://github.com/randy408/libspng/archive/refs/tags/v0.7.3.tar.gz" sha256: "a50cadbe808ffda1a7fab17d145f52a23b163f34b3eb3696c7ecb5a52340fc1d" @@ -6,6 +9,13 @@ sources: url: "https://github.com/randy408/libspng/archive/refs/tags/v0.7.2.tar.gz" sha256: "4acf25571d31f540d0b7ee004f5461d68158e0a13182505376805da99f4ccc4e" patches: + "0.7.4": + - patch_file: "patches/0.7.4-0001-allow-miniz.patch" + # Miniz is supported by the project, but does not currently expose a CMake + # option to toggle it. This can be removed once the project supports it + # or when the recipe moves to use Meson instead + patch_description: "add miniz option which is written in docs/BUILD.md" + patch_type: "portability" "0.7.3": - patch_file: "patches/0.7.3-0001-fix-dll-install.patch" patch_description: "fix install path" diff --git a/recipes/libspng/all/conanfile.py b/recipes/libspng/all/conanfile.py index fda5245bb07eb..f151ee813b219 100644 --- a/recipes/libspng/all/conanfile.py +++ b/recipes/libspng/all/conanfile.py @@ -1,6 +1,7 @@ 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.scm import Version import os required_conan_version = ">=1.53.0" @@ -13,6 +14,7 @@ class LibspngConan(ConanFile): license = "BSD-2-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/randy408/libspng/" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -43,13 +45,12 @@ def layout(self): def requirements(self): if self.options.with_miniz: - self.requires("miniz/3.0.1") + self.requires("miniz/3.0.2") else: - self.requires("zlib/1.2.13") + self.requires("zlib/[>=1.2.11 <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 = CMakeToolchain(self) @@ -72,6 +73,8 @@ def package(self): cmake = CMake(self) cmake.install() rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + if Version(self.version) >= "0.7.4": + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): self.cpp_info.set_property("pkg_config_name", "libspng") @@ -80,3 +83,7 @@ def package_info(self): 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") + + if Version(self.version) >= "0.7.4": + self.cpp_info.set_property("cmake_file_name", "SPNG") + self.cpp_info.set_property("cmake_target_name", "spng::spng{}".format("" if self.options.shared else "_static")) diff --git a/recipes/libspng/all/patches/0.7.4-0001-allow-miniz.patch b/recipes/libspng/all/patches/0.7.4-0001-allow-miniz.patch new file mode 100644 index 0000000000000..05e6f905e4d1e --- /dev/null +++ b/recipes/libspng/all/patches/0.7.4-0001-allow-miniz.patch @@ -0,0 +1,39 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index da1917e..30c220d 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) +@@ -47,14 +48,24 @@ if(SPNG_STATIC) + list(APPEND spng_TARGETS spng_static) + endif() + +-find_package(ZLIB REQUIRED) ++if(SPNG_USE_MINIZ) ++ find_package(miniz REQUIRED) ++ set(compress_LIBS miniz::miniz) ++else() ++ find_package(ZLIB REQUIRED) ++ set(compress_LIBS ZLIB::ZLIB) ++endif() ++ + foreach(spng_TARGET ${spng_TARGETS}) + target_include_directories(${spng_TARGET} PUBLIC + $ + $ + ) +- target_link_libraries(${spng_TARGET} PRIVATE ZLIB::ZLIB) ++ target_link_libraries(${spng_TARGET} PRIVATE ${compress_LIBS}) + target_link_libraries(${spng_TARGET} PRIVATE ${MATH_LIBRARY}) ++ if (SPNG_USE_MINIZ) ++ target_compile_definitions(${spng_TARGET} PRIVATE SPNG_USE_MINIZ) ++ endif() + endforeach() + + set(project_config "${CMAKE_CURRENT_BINARY_DIR}/SPNGConfig.cmake") diff --git a/recipes/libspng/all/test_package/CMakeLists.txt b/recipes/libspng/all/test_package/CMakeLists.txt index c8aa2ff46daf5..37a57f5a95869 100644 --- a/recipes/libspng/all/test_package/CMakeLists.txt +++ b/recipes/libspng/all/test_package/CMakeLists.txt @@ -1,7 +1,16 @@ cmake_minimum_required(VERSION 3.1) project(test_package LANGUAGES C) -find_package(libspng REQUIRED CONFIG) +find_package(libspng CONFIG) +if (NOT libspng_FOUND) + find_package(SPNG REQUIRED CONFIG) +endif() add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE libspng::libspng) +if (TARGET libspng::libspng) + target_link_libraries(${PROJECT_NAME} PRIVATE libspng::libspng) +elseif(TARGET spng::spng) + target_link_libraries(${PROJECT_NAME} PRIVATE spng::spng) +else() + target_link_libraries(${PROJECT_NAME} PRIVATE spng::spng_static) +endif() diff --git a/recipes/libspng/config.yml b/recipes/libspng/config.yml index ed848445a96cc..f0510efbdd19d 100644 --- a/recipes/libspng/config.yml +++ b/recipes/libspng/config.yml @@ -1,4 +1,6 @@ versions: + "0.7.4": + folder: all "0.7.3": folder: all "0.7.2": diff --git a/recipes/libsquish/all/conanfile.py b/recipes/libsquish/all/conanfile.py index 712e4727a04db..7275e4df15734 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, 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) @@ -81,6 +81,6 @@ def package(self): cmake.install() def package_info(self): - self.cpp_info.libs = collect_libs(self) + self.cpp_info.libs = ["squishd" if self.settings.build_type == "Debug" else "squish"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("m") 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/libsrtp/all/CMakeLists.txt b/recipes/libsrtp/all/CMakeLists.txt deleted file mode 100644 index a69305eb3971f..0000000000000 --- a/recipes/libsrtp/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/libsrtp/all/conandata.yml b/recipes/libsrtp/all/conandata.yml index c81f6d3838710..04f0998b86517 100644 --- a/recipes/libsrtp/all/conandata.yml +++ b/recipes/libsrtp/all/conandata.yml @@ -1,10 +1,16 @@ sources: + "2.6.0": + url: "https://github.com/cisco/libsrtp/archive/v2.6.0.tar.gz" + sha256: "bf641aa654861be10570bfc137d1441283822418e9757dc71ebb69a6cf84ea6b" + "2.5.0": + url: "https://github.com/cisco/libsrtp/archive/v2.5.0.tar.gz" + sha256: "8a43ef8e9ae2b665292591af62aa1a4ae41e468b6d98d8258f91478735da4e09" "2.4.2": url: "https://github.com/cisco/libsrtp/archive/v2.4.2.tar.gz" sha256: "3b1bcb14ebda572b04b9bdf07574a449c84cb924905414e4d94e62837d22b628" "2.4.0": url: "https://github.com/cisco/libsrtp/archive/v2.4.0.tar.gz" sha256: "713c5c1dc740707422307f39834c0b0fbb76769168d87e92c438a3cca8233d3d" - 2.3.0: + "2.3.0": url: "https://github.com/cisco/libsrtp/archive/v2.3.0.tar.gz" sha256: "94093a5d04c5f4743e8d81182b76938374df6d393b45322f24960d250b0110e8" diff --git a/recipes/libsrtp/all/conanfile.py b/recipes/libsrtp/all/conanfile.py index d1587d82b27e6..38334eef95695 100644 --- a/recipes/libsrtp/all/conanfile.py +++ b/recipes/libsrtp/all/conanfile.py @@ -1,21 +1,25 @@ -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 collect_libs, copy, get, save, rmdir +from conan.tools.scm import Version +from conan.tools.env import VirtualBuildEnv import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" -class ConanRecipe(ConanFile): +class LibsrtpRecipe(ConanFile): name = "libsrtp" description = ( "This package provides an implementation of the Secure Real-time Transport" "Protocol (SRTP), the Universal Security Transform (UST), and a supporting" "cryptographic kernel." ) - topics = ("conan", "libsrtp", "srtp") - homepage = "https://github.com/cisco/libsrtp" - 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/cisco/libsrtp" + topics = ("srtp",) + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -28,64 +32,71 @@ class ConanRecipe(ConanFile): "with_openssl": False, } - 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 + 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_openssl: - self.requires("openssl/1.1.1q") + self.requires("openssl/[>=1.1 <4]") + + def build_requirements(self): + if Version(self.version) >= "2.6.0": + self.tool_requires("cmake/[>=3.21 <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], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["ENABLE_OPENSSL"] = self.options.with_openssl + if Version(self.version) < "2.6.0": + tc.variables["TEST_APPS"] = False + else: + tc.variables["LIBSRTP_TEST_APPS"] = False + if Version(self.version) < "2.4.0": + # Relocatable shared libs on Macos + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" + if "2.5.0" <= Version(self.version) < "2.6.0": + tc.cache_variables["BUILD_WITH_WARNINGS"] = False + if "2.6.0" <= Version(self.version): + tc.cache_variables["ENABLE_WARNINGS"] = False + tc.cache_variables["ENABLE_WARNINGS_AS_ERRORS"] = False + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() + deps = CMakeDeps(self) + deps.generate() + venv = VirtualBuildEnv(self) + venv.generate(scope="build") - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["ENABLE_OPENSSL"] = self.options.with_openssl - self._cmake.definitions["TEST_APPS"] = False - self._cmake.configure() - return self._cmake + def _patch_sources(self): + save(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "\ninstall(TARGETS srtp2 RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)\n", + append=True) def build(self): - tools.replace_in_file( - os.path.join(self._source_subfolder, "CMakeLists.txt"), - "install(TARGETS srtp2 DESTINATION lib)", - ( - "include(GNUInstallDirs)\n" - "install(TARGETS srtp2\n" - "RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}\n" - "LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}\n" - "ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})" - ), - ) - 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() + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): - libsrtp_major = tools.Version(self.version).major - self.cpp_info.names["pkg_config"] = "libsrtp{}".format(libsrtp_major if int(libsrtp_major) > 1 else "") - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.set_property("pkg_config_name", f"libsrtp{Version(self.version).major}") + self.cpp_info.libs = collect_libs(self) if self.settings.os == "Windows": self.cpp_info.system_libs = ["ws2_32"] diff --git a/recipes/libsrtp/all/test_package/CMakeLists.txt b/recipes/libsrtp/all/test_package/CMakeLists.txt index 7e6857eea56cb..88bdca8976ea9 100644 --- a/recipes/libsrtp/all/test_package/CMakeLists.txt +++ b/recipes/libsrtp/all/test_package/CMakeLists.txt @@ -1,11 +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(libsrtp REQUIRED CONFIG) add_executable(test_package test_package.c) - target_link_libraries(test_package PRIVATE libsrtp::libsrtp) diff --git a/recipes/libsrtp/all/test_package/conanfile.py b/recipes/libsrtp/all/test_package/conanfile.py index 84ee68733e516..98ab55852ad56 100644 --- a/recipes/libsrtp/all/test_package/conanfile.py +++ b/recipes/libsrtp/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 = "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/libsrtp/all/test_v1_package/CMakeLists.txt b/recipes/libsrtp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libsrtp/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libsrtp/all/test_v1_package/conanfile.py b/recipes/libsrtp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libsrtp/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/libsrtp/config.yml b/recipes/libsrtp/config.yml index 75f515b1ca5ea..8daa9e28d8c53 100644 --- a/recipes/libsrtp/config.yml +++ b/recipes/libsrtp/config.yml @@ -1,7 +1,11 @@ versions: + "2.6.0": + folder: all + "2.5.0": + folder: all "2.4.2": folder: all "2.4.0": folder: all - 2.3.0: + "2.3.0": folder: all diff --git a/recipes/libssh/all/conandata.yml b/recipes/libssh/all/conandata.yml new file mode 100644 index 0000000000000..87451579acb9c --- /dev/null +++ b/recipes/libssh/all/conandata.yml @@ -0,0 +1,16 @@ +sources: + "0.10.6": + url: "https://www.libssh.org/files/0.10/libssh-0.10.6.tar.xz" + sha256: "1861d498f5b6f1741b6abc73e608478491edcf9c9d4b6630eef6e74596de9dc1" +patches: + "0.10.6": + - patch_file: patches/0.10.6-0001-fix-cmake.patch + patch_description: "cmake: fix OpenSSL compatibility checks, fix ZLIB targets" + patch_type: "conan" + - patch_file: patches/0.10.6-0002-fix-cmake.patch + patch_description: "cmake: fix MbedTLS and GCrypt compatibility" + patch_type: "conan" + - patch_file: patches/0.10.6-0003-fix-mbedtls-private-struct.patch + patch_description: "Fix mbedTLS issues caused by v3 API changes" + patch_type: "bugfix" + patch_source: "https://gitlab.com/libssh/libssh-mirror/-/merge_requests/480" diff --git a/recipes/libssh/all/conanfile.py b/recipes/libssh/all/conanfile.py new file mode 100644 index 0000000000000..048a5fb46c2ed --- /dev/null +++ b/recipes/libssh/all/conanfile.py @@ -0,0 +1,125 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir +from conan.tools.microsoft import is_msvc_static_runtime, is_msvc +import os + + +required_conan_version = ">=1.54.0" + + +class LibSSHRecipe(ConanFile): + name = "libssh" + license = "LGPL-2.1" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://www.libssh.org/" + description = "multiplatform C library implementing the SSHv2 protocol on client and server side" + topics = ("ssh", "shell", "ssh2", "connection") + package_type = "library" + settings = "os", "compiler", "build_type", "arch" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_zlib": [True, False], + "crypto_backend": ["openssl", "gcrypt", "mbedtls"], + "with_symbol_versioning": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_zlib": True, + "crypto_backend": "openssl", + "with_symbol_versioning": True, + } + + 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_symbol_versioning + + 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_zlib: + self.requires("zlib/[>=1.2.11 <2]") + if self.options.crypto_backend =="openssl": + self.requires("openssl/[>=1.1 <4]") + elif self.options.crypto_backend == "gcrypt": + self.requires("libgcrypt/1.8.4") + elif self.options.crypto_backend == "mbedtls": + self.requires("mbedtls/3.6.0") + + def validate(self): + if self.options.crypto_backend == "mbedtls" and not self.dependencies["mbedtls"].options.enable_threading: + raise ConanInvalidConfiguration(f"{self.ref} requires '-o mbedtls/*:enable_threading=True' when using '-o libssh/*:crypto_backend=mbedtls'") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CLIENT_TESTING"] = False + tc.variables["SERVER_TESTING"] = False + tc.variables["WITH_EXAMPLES"] = False + tc.variables["WITH_GCRYPT"] = self.options.crypto_backend == "gcrypt" + tc.variables["WITH_GSSAPI"] = False + tc.variables["WITH_MBEDTLS"] = self.options.crypto_backend == "mbedtls" + tc.variables["WITH_NACL"] = False + tc.variables["WITH_SYMBOL_VERSIONING"] = self.options.get_safe("with_symbol_versioning", True) + tc.variables["WITH_ZLIB"] = self.options.with_zlib + 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.cache_variables["CMAKE_TRY_COMPILE_CONFIGURATION"] = str(self.settings.build_type) + 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, 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, "lib", "pkgconfig")) + + def package_info(self): + self.cpp_info.libs = ["ssh"] + if not self.options.shared: + self.cpp_info.defines.append("LIBSSH_STATIC=ON") + if self.settings.os == "Windows": + self.cpp_info.system_libs.extend(["ws2_32", "iphlpapi"]) + + self.cpp_info.set_property("cmake_file_name", "libssh") + # target and alias names defined at: + # ssh https://git.libssh.org/projects/libssh.git/tree/src/CMakeLists.txt?h=libssh-0.10.6#n351 + # ssh::ssh https://git.libssh.org/projects/libssh.git/tree/src/CMakeLists.txt?h=libssh-0.10.6#n371 + # ssh-static https://git.libssh.org/projects/libssh.git/tree/src/CMakeLists.txt?h=libssh-0.10.6#n413 + # ssh::static https://git.libssh.org/projects/libssh.git/tree/src/CMakeLists.txt?h=libssh-0.10.6#n428 + self.cpp_info.set_property("cmake_target_name", "ssh::ssh") + self.cpp_info.set_property( + "cmake_target_aliases", + ["ssh"] if self.options.shared else ["ssh", "ssh-static", "ssh::static"], + ) + # pkg-config defined at https://git.libssh.org/projects/libssh.git/tree/CMakeLists.txt?h=libssh-0.10.6#n124 + self.cpp_info.set_property("pkg_config_name", "libssh") + diff --git a/recipes/libssh/all/patches/0.10.6-0001-fix-cmake.patch b/recipes/libssh/all/patches/0.10.6-0001-fix-cmake.patch new file mode 100644 index 0000000000000..22ccde99a9073 --- /dev/null +++ b/recipes/libssh/all/patches/0.10.6-0001-fix-cmake.patch @@ -0,0 +1,110 @@ +diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake +index 9de10225..6f881775 100644 +--- a/ConfigureChecks.cmake ++++ b/ConfigureChecks.cmake +@@ -101,41 +101,41 @@ if (OPENSSL_FOUND) + check_include_file(openssl/ecdsa.h HAVE_OPENSSL_ECDSA_H) + + set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR}) +- set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_CRYPTO_LIBRARIES}) ++ set(CMAKE_REQUIRED_LIBRARIES OpenSSL::Crypto) + check_function_exists(EVP_KDF_CTX_new_id HAVE_OPENSSL_EVP_KDF_CTX_NEW_ID) + + set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR}) +- set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_CRYPTO_LIBRARIES}) ++ set(CMAKE_REQUIRED_LIBRARIES OpenSSL::Crypto) + check_function_exists(EVP_KDF_CTX_new HAVE_OPENSSL_EVP_KDF_CTX_NEW) + + set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR}) +- set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_CRYPTO_LIBRARIES}) ++ set(CMAKE_REQUIRED_LIBRARIES OpenSSL::Crypto) + check_function_exists(FIPS_mode HAVE_OPENSSL_FIPS_MODE) + + set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR}) +- set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_CRYPTO_LIBRARIES}) ++ set(CMAKE_REQUIRED_LIBRARIES OpenSSL::Crypto) + check_function_exists(RAND_priv_bytes HAVE_OPENSSL_RAND_PRIV_BYTES) + + set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR}) +- set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_CRYPTO_LIBRARIES}) ++ set(CMAKE_REQUIRED_LIBRARIES OpenSSL::Crypto) + check_function_exists(EVP_DigestSign HAVE_OPENSSL_EVP_DIGESTSIGN) + + set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR}) +- set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_CRYPTO_LIBRARIES}) ++ set(CMAKE_REQUIRED_LIBRARIES OpenSSL::Crypto) + check_function_exists(EVP_DigestVerify HAVE_OPENSSL_EVP_DIGESTVERIFY) + + check_function_exists(OPENSSL_ia32cap_loc HAVE_OPENSSL_IA32CAP_LOC) + + set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR}) +- set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_CRYPTO_LIBRARIES}) ++ set(CMAKE_REQUIRED_LIBRARIES OpenSSL::Crypto) + check_symbol_exists(EVP_PKEY_ED25519 "openssl/evp.h" FOUND_OPENSSL_ED25519) + + set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR}) +- set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_CRYPTO_LIBRARIES}) ++ set(CMAKE_REQUIRED_LIBRARIES OpenSSL::Crypto) + check_function_exists(EVP_chacha20 HAVE_OPENSSL_EVP_CHACHA20) + + set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR}) +- set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_CRYPTO_LIBRARIES}) ++ set(CMAKE_REQUIRED_LIBRARIES OpenSSL::Crypto) + check_symbol_exists(EVP_PKEY_POLY1305 "openssl/evp.h" HAVE_OPENSSL_EVP_POLY1305) + + if (HAVE_OPENSSL_EVP_DIGESTSIGN AND HAVE_OPENSSL_EVP_DIGESTVERIFY AND +@@ -144,7 +144,7 @@ if (OPENSSL_FOUND) + endif() + + set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR}) +- set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_CRYPTO_LIBRARIES}) ++ set(CMAKE_REQUIRED_LIBRARIES OpenSSL::Crypto) + check_symbol_exists(EVP_PKEY_X25519 "openssl/evp.h" HAVE_OPENSSL_X25519) + + unset(CMAKE_REQUIRED_INCLUDES) +@@ -494,7 +494,7 @@ if (WITH_PKCS11_URI) + message(FATAL_ERROR "PKCS #11 is not supported for mbedcrypto") + set(WITH_PKCS11_URI 0) + endif() +- if (HAVE_OPENSSL AND NOT OPENSSL_VERSION VERSION_GREATER_EQUAL "1.1.1") ++ if (HAVE_OPENSSL AND NOT OpenSSL_VERSION VERSION_GREATER_EQUAL "1.1.1") + message(FATAL_ERROR "PKCS #11 requires at least OpenSSL 1.1.1") + set(WITH_PKCS11_URI 0) + endif() +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 807313b5..91f85094 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -17,7 +17,7 @@ if (OPENSSL_CRYPTO_LIBRARIES) + + set(LIBSSH_LINK_LIBRARIES + ${LIBSSH_LINK_LIBRARIES} +- ${OPENSSL_CRYPTO_LIBRARIES} ++ OpenSSL::Crypto + ) + endif (OPENSSL_CRYPTO_LIBRARIES) + +@@ -46,12 +46,12 @@ endif() + if (WITH_ZLIB) + set(LIBSSH_PRIVATE_INCLUDE_DIRS + ${LIBSSH_PRIVATE_INCLUDE_DIRS} +- ${ZLIB_INCLUDE_DIR} ++ ${ZLIB_INCLUDE_DIRS} + ) + + set(LIBSSH_LINK_LIBRARIES + ${LIBSSH_LINK_LIBRARIES} +- ${ZLIB_LIBRARY} ++ ${ZLIB_LIBRARIES} + ) + endif (WITH_ZLIB) + +@@ -257,7 +257,7 @@ else (WITH_GCRYPT) + chachapoly.c + ) + endif (NOT (HAVE_OPENSSL_EVP_CHACHA20 AND HAVE_OPENSSL_EVP_POLY1305)) +- if(OPENSSL_VERSION VERSION_LESS "1.1.0") ++ if(OpenSSL_VERSION VERSION_LESS "1.1.0") + set(libssh_SRCS ${libssh_SRCS} libcrypto-compat.c) + endif() + endif (WITH_GCRYPT) diff --git a/recipes/libssh/all/patches/0.10.6-0002-fix-cmake.patch b/recipes/libssh/all/patches/0.10.6-0002-fix-cmake.patch new file mode 100644 index 0000000000000..53b9b66c536c7 --- /dev/null +++ b/recipes/libssh/all/patches/0.10.6-0002-fix-cmake.patch @@ -0,0 +1,123 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index a64b7708..6647076b 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -48,15 +48,15 @@ if (WITH_ZLIB) + endif (WITH_ZLIB) + + if (WITH_GCRYPT) +- find_package(GCrypt 1.5.0 REQUIRED) +- if (NOT GCRYPT_FOUND) ++ find_package(libgcrypt 1.5.0 REQUIRED) ++ if (NOT libgcrypt_FOUND) + message(FATAL_ERROR "Could not find GCrypt") +- endif (NOT GCRYPT_FOUND) ++ endif (NOT libgcrypt_FOUND) + elseif(WITH_MBEDTLS) + find_package(MbedTLS REQUIRED) +- if (NOT MBEDTLS_FOUND) ++ if (NOT MbedTLS_FOUND) + message(FATAL_ERROR "Could not find mbedTLS") +- endif (NOT MBEDTLS_FOUND) ++ endif (NOT MbedTLS_FOUND) + else (WITH_GCRYPT) + find_package(OpenSSL 1.0.1) + if (OPENSSL_FOUND) +@@ -66,13 +66,13 @@ else (WITH_GCRYPT) + set(OPENSSL_CRYPTO_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY}) + endif (NOT DEFINED OPENSSL_CRYPTO_LIBRARIES) + else (OPENSSL_FOUND) +- find_package(GCrypt) +- if (NOT GCRYPT_FOUND) ++ find_package(libgcrypt) ++ if (NOT libgcrypt_FOUND) + find_package(MbedTLS) +- if (NOT MBEDTLS_FOUND) ++ if (NOT MbedTLS_FOUND) + message(FATAL_ERROR "Could not find OpenSSL, GCrypt or mbedTLS") +- endif (NOT MBEDTLS_FOUND) +- endif (NOT GCRYPT_FOUND) ++ endif (NOT MbedTLS_FOUND) ++ endif (NOT libgcrypt_FOUND) + endif (OPENSSL_FOUND) + endif(WITH_GCRYPT) + +diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake +index 6f881775..12585117 100644 +--- a/ConfigureChecks.cmake ++++ b/ConfigureChecks.cmake +@@ -267,27 +267,27 @@ if (OPENSSL_FOUND) + set(HAVE_LIBCRYPTO 1) + endif (OPENSSL_FOUND) + +-if (GCRYPT_FOUND) ++if (libgcrypt_FOUND) + set(HAVE_LIBGCRYPT 1) +- if (GCRYPT_VERSION VERSION_GREATER "1.4.6") ++ if (libgcrypt_VERSION VERSION_GREATER "1.4.6") + set(HAVE_GCRYPT_ECC 1) + set(HAVE_ECC 1) +- endif (GCRYPT_VERSION VERSION_GREATER "1.4.6") +- if (NOT GCRYPT_VERSION VERSION_LESS "1.7.0") ++ endif (libgcrypt_VERSION VERSION_GREATER "1.4.6") ++ if (NOT libgcrypt_VERSION VERSION_LESS "1.7.0") + set(HAVE_GCRYPT_CHACHA_POLY 1) +- endif (NOT GCRYPT_VERSION VERSION_LESS "1.7.0") +-endif (GCRYPT_FOUND) ++ endif (NOT libgcrypt_VERSION VERSION_LESS "1.7.0") ++endif (libgcrypt_FOUND) + +-if (MBEDTLS_FOUND) ++if (MbedTLS_FOUND) + set(HAVE_LIBMBEDCRYPTO 1) + set(HAVE_ECC 1) + +- set(CMAKE_REQUIRED_INCLUDES "${MBEDTLS_INCLUDE_DIR}/mbedtls") ++ set(CMAKE_REQUIRED_INCLUDES "${MbedTLS_INCLUDE_DIR}/mbedtls") + check_include_file(chacha20.h HAVE_MBEDTLS_CHACHA20_H) + check_include_file(poly1305.h HAVE_MBEDTLS_POLY1305_H) + unset(CMAKE_REQUIRED_INCLUDES) + +-endif (MBEDTLS_FOUND) ++endif (MbedTLS_FOUND) + + if (CMAKE_USE_PTHREADS_INIT) + set(HAVE_PTHREAD 1) +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 91f85094..839271ad 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -21,27 +21,13 @@ if (OPENSSL_CRYPTO_LIBRARIES) + ) + endif (OPENSSL_CRYPTO_LIBRARIES) + +-if (MBEDTLS_CRYPTO_LIBRARY) +- set(LIBSSH_PRIVATE_INCLUDE_DIRS +- ${LIBSSH_PRIVATE_INCLUDE_DIRS} +- ${MBEDTLS_INCLUDE_DIR} +- ) +- set(LIBSSH_LINK_LIBRARIES +- ${LIBSSH_LINK_LIBRARIES} +- ${MBEDTLS_CRYPTO_LIBRARY} +- ) +-endif (MBEDTLS_CRYPTO_LIBRARY) +- +-if (GCRYPT_LIBRARIES) +- set(LIBSSH_PRIVATE_INCLUDE_DIRS +- ${LIBSSH_PRIVATE_INCLUDE_DIRS} +- ${GCRYPT_INCLUDE_DIR} +- ) ++if (TARGET MbedTLS::mbedcrypto) ++ list(APPEND LIBSSH_LINK_LIBRARIES MbedTLS::mbedcrypto) ++endif () + +- set(LIBSSH_LINK_LIBRARIES +- ${LIBSSH_LINK_LIBRARIES} +- ${GCRYPT_LIBRARIES}) +-endif() ++if (TARGET libgcrypt::libgcrypt) ++ list(APPEND LIBSSH_LINK_LIBRARIES libgcrypt::libgcrypt) ++endif () + + if (WITH_ZLIB) + set(LIBSSH_PRIVATE_INCLUDE_DIRS diff --git a/recipes/libssh/all/patches/0.10.6-0003-fix-mbedtls-private-struct.patch b/recipes/libssh/all/patches/0.10.6-0003-fix-mbedtls-private-struct.patch new file mode 100644 index 0000000000000..b71b2c3e3e4ee --- /dev/null +++ b/recipes/libssh/all/patches/0.10.6-0003-fix-mbedtls-private-struct.patch @@ -0,0 +1,13 @@ +diff --git a/src/libmbedcrypto.c b/src/libmbedcrypto.c +index caa3b6e9..69910a24 100644 +--- a/src/libmbedcrypto.c ++++ b/src/libmbedcrypto.c +@@ -119,7 +119,7 @@ int hmac_update(HMACCTX c, const void *data, size_t len) + int hmac_final(HMACCTX c, unsigned char *hashmacbuf, size_t *len) + { + int rc; +- *len = (unsigned int)mbedtls_md_get_size(c->md_info); ++ *len = (unsigned int)mbedtls_md_get_size(c->MBEDTLS_PRIVATE(md_info)); + rc = !mbedtls_md_hmac_finish(c, hashmacbuf); + mbedtls_md_free(c); + SAFE_FREE(c); diff --git a/recipes/libssh/all/test_package/CMakeLists.txt b/recipes/libssh/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..028fc38762145 --- /dev/null +++ b/recipes/libssh/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) + +project(test_package LANGUAGES C) + +find_package(libssh CONFIG REQUIRED) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE ssh) diff --git a/recipes/libssh/all/test_package/conanfile.py b/recipes/libssh/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fb96656f203 --- /dev/null +++ b/recipes/libssh/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/libssh/all/test_package/test_package.c b/recipes/libssh/all/test_package/test_package.c new file mode 100644 index 0000000000000..a6b34889b0652 --- /dev/null +++ b/recipes/libssh/all/test_package/test_package.c @@ -0,0 +1,10 @@ +#include + +int main(int argc, char *argv[]) { + ssh_session session = ssh_new(); + if (session == NULL) { + return -1; + } + + return 0; +} diff --git a/recipes/libssh/config.yml b/recipes/libssh/config.yml new file mode 100644 index 0000000000000..e9995a4dcd5e9 --- /dev/null +++ b/recipes/libssh/config.yml @@ -0,0 +1,3 @@ +versions: + "0.10.6": + folder: all diff --git a/recipes/libssh2/all/CMakeLists.txt b/recipes/libssh2/all/CMakeLists.txt deleted file mode 100644 index 8315062fd31ee..0000000000000 --- a/recipes/libssh2/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/libssh2/all/conandata.yml b/recipes/libssh2/all/conandata.yml index 710cae0e7118d..c8e5373109020 100644 --- a/recipes/libssh2/all/conandata.yml +++ b/recipes/libssh2/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "1.11.1": + sha256: 9954cb54c4f548198a7cbebad248bdc87dd64bd26185708a294b2b50771e3769 + url: https://github.com/libssh2/libssh2/releases/download/libssh2-1.11.1/libssh2-1.11.1.tar.xz + "1.11.0": + sha256: a488a22625296342ddae862de1d59633e6d446eff8417398e06674a49be3d7c2 + url: https://github.com/libssh2/libssh2/releases/download/libssh2-1.11.0/libssh2-1.11.0.tar.xz "1.10.0": sha256: 2d64e90f3ded394b91d3a2e774ca203a4179f69aebee03003e5a6fa621e41d51 url: https://github.com/libssh2/libssh2/releases/download/libssh2-1.10.0/libssh2-1.10.0.tar.gz @@ -11,16 +17,3 @@ sources: "1.8.0": sha256: 39f34e2f6835f4b992cafe8625073a88e5a28ba78f83e8099610a7b3af4676d4 url: https://github.com/libssh2/libssh2/releases/download/libssh2-1.8.0/libssh2-1.8.0.tar.gz -patches: - "1.10.0": - - patch_file: "patches/0001-threads.patch" - base_path: "source_subfolder" - "1.9.0": - - patch_file: "patches/0001-threads.patch" - base_path: "source_subfolder" - "1.8.2": - - patch_file: "patches/0001-threads.patch" - base_path: "source_subfolder" - "1.8.0": - - patch_file: "patches/0001-threads.patch" - base_path: "source_subfolder" diff --git a/recipes/libssh2/all/conanfile.py b/recipes/libssh2/all/conanfile.py index bb49ef120e615..693bcb37db269 100644 --- a/recipes/libssh2/all/conanfile.py +++ b/recipes/libssh2/all/conanfile.py @@ -1,8 +1,12 @@ -from conans import ConanFile, CMake, tools -import functools +from conan import ConanFile +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir, collect_libs, replace_in_file +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=2.7" class Libssh2Conan(ConanFile): @@ -12,7 +16,7 @@ class Libssh2Conan(ConanFile): homepage = "https://libssh2.org" topics = ("libssh", "ssh", "shell", "ssh2", "connection") license = "BSD-3-Clause" - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -33,16 +37,43 @@ class Libssh2Conan(ConanFile): "enable_debug_logging": False, } - generators = "cmake", "cmake_find_package" + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + cmake_layout(self, src_folder="src") @property - def _source_subfolder(self): - return "source_subfolder" + def _mbedtls_cmake_package_name(self): + pkg_name = "mbedTLS" if Version(self.version) < "1.11.1" else "MbedTLS" + return pkg_name + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["ENABLE_ZLIB_COMPRESSION"] = self.options.with_zlib + tc.cache_variables["ENABLE_CRYPT_NONE"] = self.options.enable_crypt_none + tc.cache_variables["ENABLE_MAC_NONE"] = self.options.enable_mac_none + tc.cache_variables["ENABLE_DEBUG_LOGGING"] = self.options.enable_debug_logging + if self.options.crypto_backend == "openssl": + tc.cache_variables["CRYPTO_BACKEND"] = "OpenSSL" + tc.cache_variables["OPENSSL_ROOT_DIR"] = self.dependencies["openssl"].package_folder.replace("\\", "/") + elif self.options.crypto_backend == "mbedtls": + tc.cache_variables["CRYPTO_BACKEND"] = "mbedTLS" + tc.cache_variables["BUILD_EXAMPLES"] = False + tc.cache_variables['BUILD_TESTING'] = not self.conf.get("tools.build:skip_test", default=True, check_type=bool) + tc.cache_variables["BUILD_STATIC_LIBS"] = not self.options.shared + tc.cache_variables["BUILD_SHARED_LIBS"] = self.options.shared + # To install relocatable shared lib on Macos by default + tc.variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" + # Workaround until github.com/conan-io/conan/pull/12600 is merged + if is_msvc(self): + tc.cache_variables["CMAKE_TRY_COMPILE_CONFIGURATION"] = str(self.settings.build_type) + tc.generate() - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + deps = CMakeDeps(self) + deps.set_property("mbedtls", "cmake_file_name", self._mbedtls_cmake_package_name) + deps.set_property("mbedtls", "cmake_additional_variables_prefixes", ["MBEDTLS"]) + deps.generate() def config_options(self): if self.settings.os == "Windows": @@ -50,78 +81,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") + # This is a pure C library + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") def requirements(self): if self.options.with_zlib: - self.requires("zlib/1.2.12") + self.requires("zlib/[>=1.2.11 <2]") if self.options.crypto_backend == "openssl": - self.requires("openssl/1.1.1q") + self.requires("openssl/[>=1.1 <4]") elif self.options.crypto_backend == "mbedtls": - # libssh2/<=1.10.0 doesn't support mbedtls/3.x.x - self.requires("mbedtls/2.25.0") + if Version(self.version) >= "1.11": + self.requires("mbedtls/3.5.0") + else: + self.requires("mbedtls/2.28.4") + + def build_requirements(self): + self.tool_requires("cmake/[>=3.20 <4]") 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) - 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)") - - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["ENABLE_ZLIB_COMPRESSION"] = self.options.with_zlib - cmake.definitions["ENABLE_CRYPT_NONE"] = self.options.enable_crypt_none - cmake.definitions["ENABLE_MAC_NONE"] = self.options.enable_mac_none - cmake.definitions["ENABLE_DEBUG_LOGGING"] = self.options.enable_debug_logging - if self.options.crypto_backend == "openssl": - cmake.definitions["CRYPTO_BACKEND"] = "OpenSSL" - cmake.definitions["OPENSSL_ROOT_DIR"] = self.deps_cpp_info["openssl"].rootpath - elif self.options.crypto_backend == "mbedtls": - cmake.definitions["CRYPTO_BACKEND"] = "mbedTLS" - cmake.definitions["BUILD_EXAMPLES"] = False - cmake.definitions["BUILD_TESTING"] = False - # To install relocatable shared lib on Macos by default - cmake.definitions["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" - cmake.configure() - return cmake + get(self, **self.conan_data["sources"][self.version], strip_root=True) + apply_conandata_patches(self) + + cmakelists = os.path.join("src", "CMakeLists.txt") if Version(self.version) <= "1.10" else "CMakeLists.txt" + replace_in_file(self, os.path.join(self.source_folder, cmakelists), "MBEDTLS_FOUND", f"{self._mbedtls_cmake_package_name}_FOUND") 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("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", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + rmdir(self, os.path.join(self.package_folder, "share")) # only docs and manpages + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + 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("cmake_file_name", "Libssh2") self.cpp_info.set_property("cmake_target_name", "Libssh2::libssh2") self.cpp_info.set_property("pkg_config_name", "libssh2") # TODO: back to global scope in conan v2 once cmake_find_package_* generators removed - self.cpp_info.components["_libssh2"].libs = tools.collect_libs(self) + self.cpp_info.components["_libssh2"].libs = collect_libs(self) if self.settings.os == "Windows": self.cpp_info.components["_libssh2"].system_libs.append("ws2_32") elif self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["_libssh2"].system_libs.extend(["pthread", "dl"]) # TODO: to remove in conan v2 once cmake_find_package_* generators removed - self.cpp_info.names["cmake_find_package"] = "Libssh2" - self.cpp_info.names["cmake_find_package_multi"] = "Libssh2" - self.cpp_info.components["_libssh2"].names["cmake_find_package"] = "libssh2" - self.cpp_info.components["_libssh2"].names["cmake_find_package_multi"] = "libssh2" self.cpp_info.components["_libssh2"].set_property("cmake_target_name", "Libssh2::libssh2") self.cpp_info.components["_libssh2"].set_property("pkg_config_name", "libssh2") if self.options.with_zlib: diff --git a/recipes/libssh2/all/patches/0001-threads.patch b/recipes/libssh2/all/patches/0001-threads.patch deleted file mode 100644 index 05985dac07a46..0000000000000 --- a/recipes/libssh2/all/patches/0001-threads.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index eee1a80..3373f2a 100644 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -42,6 +42,11 @@ include(CheckSymbolExists) - include(CheckNonblockingSocketSupport) - include(SocketLibraries) - -+if(UNIX AND NOT APPLE) -+ find_package(Threads REQUIRED) -+ list(APPEND LIBRARIES ${CMAKE_THREAD_LIBS_INIT}) -+endif() -+ - ## Cryptography backend choice - - set(CRYPTO_BACKEND diff --git a/recipes/libssh2/all/test_package/CMakeLists.txt b/recipes/libssh2/all/test_package/CMakeLists.txt index dfda6b6e8ad0d..92f94a36409ed 100644 --- a/recipes/libssh2/all/test_package/CMakeLists.txt +++ b/recipes/libssh2/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) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) find_package(Libssh2 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} Libssh2::libssh2) +target_link_libraries(${PROJECT_NAME} PRIVATE Libssh2::libssh2) diff --git a/recipes/libssh2/all/test_package/conanfile.py b/recipes/libssh2/all/test_package/conanfile.py index 49a3a66ea5bad..a9bc449b529dc 100644 --- a/recipes/libssh2/all/test_package/conanfile.py +++ b/recipes/libssh2/all/test_package/conanfile.py @@ -1,17 +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", "VirtualRunEnv" + 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", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libssh2/config.yml b/recipes/libssh2/config.yml index 42bce17ced607..344cf19e3fd11 100644 --- a/recipes/libssh2/config.yml +++ b/recipes/libssh2/config.yml @@ -1,4 +1,8 @@ versions: + "1.11.1": + folder: all + "1.11.0": + folder: all "1.10.0": folder: all "1.9.0": diff --git a/recipes/libstudxml/1.1.x/conanfile.py b/recipes/libstudxml/1.1.x/conanfile.py index 42db9e71046d4..f5228bce1c824 100644 --- a/recipes/libstudxml/1.1.x/conanfile.py +++ b/recipes/libstudxml/1.1.x/conanfile.py @@ -38,7 +38,7 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("expat/2.5.0", transitive_headers=True, transitive_libs=True) + self.requires("expat/[>=2.6.2 <3]", transitive_headers=True, transitive_libs=True) def source(self): get(self, **self.conan_data["sources"][self.version], diff --git a/recipes/libsvm/all/conandata.yml b/recipes/libsvm/all/conandata.yml index 5712311441eb3..0567d38d76228 100644 --- a/recipes/libsvm/all/conandata.yml +++ b/recipes/libsvm/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "333": + url: "https://github.com/cjlin1/libsvm/archive/v333.tar.gz" + sha256: "ee898ca11cef85b09e059b278b3ab4ff58cd38f70169829e75b4a3cb9ddc5013" + "332": + url: "https://github.com/cjlin1/libsvm/archive/v332.tar.gz" + sha256: "e1d7d316112d199ebd69c9695f79226d236b86e2c8d88e70cfe35fd383954ed8" "330": url: "https://github.com/cjlin1/libsvm/archive/v330.tar.gz" sha256: "e4fe41308c87cc210aec73e4f5f0fb4da14234d90e7a131763fbad3788ca2d80" diff --git a/recipes/libsvm/all/conanfile.py b/recipes/libsvm/all/conanfile.py index 897e5749def0c..3b312ef9f419c 100644 --- a/recipes/libsvm/all/conanfile.py +++ b/recipes/libsvm/all/conanfile.py @@ -1,28 +1,35 @@ 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.52.0" +required_conan_version = ">=1.54.0" + class libsvmConan(ConanFile): name = "libsvm" description = "Libsvm is a simple, easy-to-use, and efficient software for SVM classification and regression" + license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.csie.ntu.edu.tw/~cjlin/libsvm/" - license = "BSD-3-Clause" - topics = "svm", "vector" + topics = ("svm", "vector") + + 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, + } + + def export_sources(self): + copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) def config_options(self): if self.settings.os == "Windows": @@ -30,27 +37,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 - "MT" in self.settings.compiler.runtime and - self.options.shared - ): - raise ConanInvalidConfiguration( - f"{self.name} can not be built as shared library + runtime {self.settings.compiler.runtime}." - ) + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") - def export_sources(self): - copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) + def validate(self): + if self.options.shared and is_msvc(self) and is_msvc_static_runtime(self): + raise ConanInvalidConfiguration( + f"{self.ref} can not be built as shared library with Visual Studio and static 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) @@ -69,5 +68,9 @@ def package(self): def package_info(self): self.cpp_info.libs = ["svm"] - if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.system_libs = ["m"] + 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 40fb8732f7ba3..dca2cfa3e609e 100644 --- a/recipes/libsvm/all/test_package/CMakeLists.txt +++ b/recipes/libsvm/all/test_package/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(PackageTest CXX) +project(test_package LANGUAGES C) find_package(libsvm CONFIG REQUIRED) -add_executable(test_package test_package.cpp) +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 1a65f5a41c626..70b80fc025616 100644 --- a/recipes/libsvm/all/test_package/conanfile.py +++ b/recipes/libsvm/all/test_package/conanfile.py @@ -5,16 +5,16 @@ 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 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/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 index 053cf33af70e5..0d20897301b68 100644 --- a/recipes/libsvm/all/test_v1_package/CMakeLists.txt +++ b/recipes/libsvm/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(PackageTest CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(libsvm CONFIG REQUIRED) - -add_executable(test_package ../test_package/test_package.cpp) -target_link_libraries(test_package PRIVATE libsvm::libsvm) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libsvm/config.yml b/recipes/libsvm/config.yml index 026fbb9e30356..c8909e199de65 100644 --- a/recipes/libsvm/config.yml +++ b/recipes/libsvm/config.yml @@ -1,4 +1,8 @@ versions: + "333": + folder: all + "332": + folder: all "330": folder: all "325": diff --git a/recipes/libsvtav1/all/conandata.yml b/recipes/libsvtav1/all/conandata.yml new file mode 100644 index 0000000000000..8c117ffecbdcd --- /dev/null +++ b/recipes/libsvtav1/all/conandata.yml @@ -0,0 +1,27 @@ +sources: + "2.2.1": + url: "https://gitlab.com/AOMediaCodec/SVT-AV1/-/archive/v2.2.1/SVT-AV1-v2.2.1.tar.gz" + sha256: "d02b54685542de0236bce4be1b50912aba68aff997c43b350d84a518df0cf4e5" + "2.1.2": + url: "https://gitlab.com/AOMediaCodec/SVT-AV1/-/archive/v2.1.2/SVT-AV1-v2.1.2.tar.gz" + sha256: "65e90af18f31f8c8d2e9febf909a7d61f36172536abb25a7089f152210847cd9" + "2.1.0": + url: "https://gitlab.com/AOMediaCodec/SVT-AV1/-/archive/v2.1.0/SVT-AV1-v2.1.0.tar.gz" + sha256: "72a076807544f3b269518ab11656f77358284da7782cece497781ab64ed4cb8a" + "1.7.0": + url: "https://gitlab.com/AOMediaCodec/SVT-AV1/-/archive/v1.7.0/SVT-AV1-v1.7.0.tar.gz" + sha256: "ce0973584f1a187aa4abf63f509ff8464397120878e322a3153f87e9c161fc4f" + "1.6.0": + url: https://gitlab.com/AOMediaCodec/SVT-AV1/-/archive/v1.6.0/SVT-AV1-v1.6.0.tar.bz2 + sha256: c6b49111a2d4c5113f1ada0c2f716d94bd4a8db704623d453066826401ecdab5 +patches: + "1.7.0": + - patch_file: "patches/external-cpuinfo-1.7.0.patch" + patch_type: "portability" + patch_source: https://gitlab.com/AOMediaCodec/SVT-AV1/-/merge_requests/2178 + patch_description: "Allow compiling with external cpuinfo" + "1.6.0": + - patch_file: "patches/external-cpuinfo-1.6.0.patch" + patch_type: "portability" + patch_source: https://gitlab.com/AOMediaCodec/SVT-AV1/-/merge_requests/2178 + patch_description: "Allow compiling with external cpuinfo" diff --git a/recipes/libsvtav1/all/conanfile.py b/recipes/libsvtav1/all/conanfile.py new file mode 100644 index 0000000000000..a9af58bd0bf79 --- /dev/null +++ b/recipes/libsvtav1/all/conanfile.py @@ -0,0 +1,146 @@ +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 +from conan.errors import ConanInvalidConfiguration + +required_conan_version = ">=1.54.0" + + +class SVTAV1Conan(ConanFile): + name = "libsvtav1" + description = "An AV1-compliant software encoder/decoder library" + license = "BSD-3-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://gitlab.com/AOMediaCodec/SVT-AV1" + topics = ("av1", "codec", "encoder", "decoder", "video") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "build_encoder": [True, False], + "build_decoder": [True, False], + "minimal_build": [True, False], + "with_neon": [True, False], + "with_arm_crc32": [True, False], + "with_neon_dotprod": [True, False], + "with_neon_i8mm": [True, False], + "with_neon_sve": [True, False], + "with_neon_sve2": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "build_encoder": True, + "build_decoder": True, + "minimal_build": False, + "with_neon": True, + "with_arm_crc32": True, + "with_neon_dotprod": True, + "with_neon_i8mm": True, + "with_neon_sve": True, + "with_neon_sve2": True, + } + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + self.options.rm_safe("fPIC") + if Version(self.version) < "2.0.0": + del self.options.minimal_build + if Version(self.version) >= "2.1.1": + # https://gitlab.com/AOMediaCodec/SVT-AV1/-/blob/c949fe4f14fe288a9b2b47aa3e61335422a83645/CHANGELOG.md#211---2024-06-25 + del self.options.build_decoder + if Version(self.version) < "2.2.1" or self.settings.arch not in ("armv8", "armv8.3"): + del self.options.with_neon + del self.options.with_arm_crc32 + del self.options.with_neon_dotprod + del self.options.with_neon_i8mm + del self.options.with_neon_sve + del self.options.with_neon_sve2 + + 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("cpuinfo/cci.20231129") + + def validate(self): + # https://gitlab.com/AOMediaCodec/SVT-AV1/-/issues/2081 + # https://gitlab.com/AOMediaCodec/SVT-AV1/-/commit/800a81b09db1cf8c9c289ecf6f70381d7888b98c + if Version(self.version) < "1.9.0" and self.settings.os == "Android": + raise ConanInvalidConfiguration(f"{self.ref} does not support Android before version 1.9.0.") + + def build_requirements(self): + if Version(self.version) >= "1.3.0": + self.tool_requires("cmake/[>=3.16 <4]") + if self.settings.arch in ("x86", "x86_64"): + self.tool_requires("nasm/2.16.01") + + 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 + if Version(self.version) < "2.1.1": + tc.variables["BUILD_DEC"] = self.options.build_decoder + tc.variables["BUILD_ENC"] = self.options.build_encoder + tc.variables["USE_EXTERNAL_CPUINFO"] = True + if self.settings.arch in ("x86", "x86_64"): + tc.variables["ENABLE_NASM"] = True + tc.variables["MINIMAL_BUILD"] = self.options.get_safe("minimal_build", False) + if "with_neon" in self.options: + tc.variables["ENABLE_NEON"] = self.options.with_neon + if "with_arm_crc32" in self.options: + tc.variables["ENABLE_ARM_CRC32"] = self.options.with_arm_crc32 + if "with_neon_dotprod" in self.options: + tc.variables["ENABLE_NEON_DOTPROD"] = self.options.with_neon_dotprod + if "with_neon_i8mm" in self.options: + tc.variables["ENABLE_NEON_i8MM"] = self.options.with_neon_i8mm + if "with_sve" in self.options: + tc.variables["ENABLE_SVE"] = self.options.with_sve + if "with_sve2" in self.options: + tc.variables["ENABLE_SVE2"] = self.options.with_sve2 + + 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 ("LICENSE.md", "PATENTS.md"): + copy(self, license_file, 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"].requires = ["cpuinfo::cpuinfo"] + if self.settings.os in ("FreeBSD", "Linux"): + self.cpp_info.components["encoder"].system_libs = ["pthread", "dl", "m"] + if self.options.get_safe("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"].requires = ["cpuinfo::cpuinfo"] + if self.settings.os in ("FreeBSD", "Linux"): + self.cpp_info.components["encoder"].system_libs = ["pthread", "dl", "m"] diff --git a/recipes/libsvtav1/all/patches/external-cpuinfo-1.6.0.patch b/recipes/libsvtav1/all/patches/external-cpuinfo-1.6.0.patch new file mode 100644 index 0000000000000..02c89e25a93f1 --- /dev/null +++ b/recipes/libsvtav1/all/patches/external-cpuinfo-1.6.0.patch @@ -0,0 +1,68 @@ +diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt +index f98c8675acc06b3c998f29fcc712ac8befcda129..f464ead3ea55bacd71451a24252cbaf33194292c 100644 +--- a/test/CMakeLists.txt ++++ b/test/CMakeLists.txt +@@ -151,7 +151,7 @@ set(lib_list + $ + $ + $ +- cpuinfo_public ++ $,cpuinfo::cpuinfo,cpuinfo_public> + gtest_all) + if(UNIX) + # App Source Files +diff --git a/CMakeLists.txt b/CMakeLists.txt +index b651306f208f2ff0e577e89ce37fed3e80eea0ce..25df70551b8db09becab23cfa5000f03b90a9c77 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -41,6 +41,11 @@ if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8) + endif() + + option(COMPILE_C_ONLY "Compile only C code with no simds (autodetect, default off for x86)" OFF) ++option(USE_EXTERNAL_CPUINFO "Consume system cpuinfo library only" OFF) ++ ++if(USE_EXTERNAL_CPUINFO) ++ find_package(cpuinfo CONFIG REQUIRED) ++endif() + + include(CheckCSourceCompiles) + +@@ -590,7 +595,7 @@ endif() + + add_subdirectory(third_party/fastfeat) + +-if(NOT COMPILE_C_ONLY AND HAVE_X86_PLATFORM) ++if(NOT USE_EXTERNAL_CPUINFO AND NOT COMPILE_C_ONLY AND HAVE_X86_PLATFORM) + add_subdirectory(third_party/cpuinfo) + endif() + +diff --git a/Source/Lib/Encoder/CMakeLists.txt b/Source/Lib/Encoder/CMakeLists.txt +index 88553bfc4511ffcd5571300d1d45c9302d9316a6..a587e7c6ba15f7528482f476b46506b09c12cf2e 100644 +--- a/Source/Lib/Encoder/CMakeLists.txt ++++ b/Source/Lib/Encoder/CMakeLists.txt +@@ -129,7 +129,9 @@ set_target_properties(SvtAv1Enc PROPERTIES VERSION ${ENC_VERSION}) + set_target_properties(SvtAv1Enc PROPERTIES SOVERSION ${ENC_VERSION_MAJOR}) + set_target_properties(SvtAv1Enc PROPERTIES C_VISIBILITY_PRESET hidden) + target_link_libraries(SvtAv1Enc PUBLIC ${PLATFORM_LIBS}) +-if(NOT COMPILE_C_ONLY AND HAVE_X86_PLATFORM) ++if(USE_EXTERNAL_CPUINFO) ++ target_link_libraries(SvtAv1Enc PRIVATE cpuinfo::cpuinfo) ++elseif(NOT COMPILE_C_ONLY AND HAVE_X86_PLATFORM) + target_link_libraries(SvtAv1Enc PRIVATE cpuinfo_public) + endif() + +diff --git a/Source/Lib/Decoder/CMakeLists.txt b/Source/Lib/Decoder/CMakeLists.txt +index 0f220a78a6db783ef2b5d6dd6cc182766c4362a3..8fb88f1c958fa965bc8f9ed9c1d563ee3858baee 100644 +--- a/Source/Lib/Decoder/CMakeLists.txt ++++ b/Source/Lib/Decoder/CMakeLists.txt +@@ -147,7 +147,9 @@ set_target_properties(SvtAv1Dec PROPERTIES SOVERSION ${DEC_VERSION_MAJOR}) + set_target_properties(SvtAv1Dec PROPERTIES C_VISIBILITY_PRESET hidden) + add_dependencies(SvtAv1Dec EbVersionHeaderGen) + target_link_libraries(SvtAv1Dec PUBLIC ${PLATFORM_LIBS}) +-if(NOT COMPILE_C_ONLY AND HAVE_X86_PLATFORM) ++if(USE_EXTERNAL_CPUINFO) ++ target_link_libraries(SvtAv1Dec PRIVATE cpuinfo::cpuinfo) ++elseif(NOT COMPILE_C_ONLY AND HAVE_X86_PLATFORM) + target_link_libraries(SvtAv1Dec PRIVATE cpuinfo_public) + endif() + diff --git a/recipes/libsvtav1/all/patches/external-cpuinfo-1.7.0.patch b/recipes/libsvtav1/all/patches/external-cpuinfo-1.7.0.patch new file mode 100644 index 0000000000000..c6d38c46f187f --- /dev/null +++ b/recipes/libsvtav1/all/patches/external-cpuinfo-1.7.0.patch @@ -0,0 +1,68 @@ +diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt +index 3ed7c05a28ad1b46f2a79e23630d6ad17e6c6741..251a592a46046ae1878e2913683f3417db0260ad 100644 +--- a/test/CMakeLists.txt ++++ b/test/CMakeLists.txt +@@ -152,7 +152,7 @@ set(lib_list + $ + $ + $ +- cpuinfo_public ++ $,cpuinfo::cpuinfo,cpuinfo_public> + gtest_all) + if(UNIX) + # App Source Files +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 58642d108e2a4b042e2f7a66180e1ba2d06f043e..5b7d001473af01305d396b3d2f312adc0b3f5b81 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -41,6 +41,11 @@ if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8) + endif() + + option(COMPILE_C_ONLY "Compile only C code with no simds (autodetect, default off for x86)" OFF) ++option(USE_EXTERNAL_CPUINFO "Consume system cpuinfo library only" OFF) ++ ++if(USE_EXTERNAL_CPUINFO) ++ find_package(cpuinfo CONFIG REQUIRED) ++endif() + + include(CheckCSourceCompiles) + +@@ -590,7 +595,7 @@ endif() + + add_subdirectory(third_party/fastfeat) + +-if(NOT COMPILE_C_ONLY AND HAVE_X86_PLATFORM) ++if(NOT USE_EXTERNAL_CPUINFO AND NOT COMPILE_C_ONLY AND HAVE_X86_PLATFORM) + add_subdirectory(third_party/cpuinfo) + endif() + +diff --git a/Source/Lib/Decoder/CMakeLists.txt b/Source/Lib/Decoder/CMakeLists.txt +index 0f220a78a6db783ef2b5d6dd6cc182766c4362a3..8fb88f1c958fa965bc8f9ed9c1d563ee3858baee 100644 +--- a/Source/Lib/Decoder/CMakeLists.txt ++++ b/Source/Lib/Decoder/CMakeLists.txt +@@ -147,7 +147,9 @@ set_target_properties(SvtAv1Dec PROPERTIES SOVERSION ${DEC_VERSION_MAJOR}) + set_target_properties(SvtAv1Dec PROPERTIES C_VISIBILITY_PRESET hidden) + add_dependencies(SvtAv1Dec EbVersionHeaderGen) + target_link_libraries(SvtAv1Dec PUBLIC ${PLATFORM_LIBS}) +-if(NOT COMPILE_C_ONLY AND HAVE_X86_PLATFORM) ++if(USE_EXTERNAL_CPUINFO) ++ target_link_libraries(SvtAv1Dec PRIVATE cpuinfo::cpuinfo) ++elseif(NOT COMPILE_C_ONLY AND HAVE_X86_PLATFORM) + target_link_libraries(SvtAv1Dec PRIVATE cpuinfo_public) + endif() + +diff --git a/Source/Lib/Encoder/CMakeLists.txt b/Source/Lib/Encoder/CMakeLists.txt +index e2a1348aa2c07a7283266323bcf58d15dc278555..13be1227444afa74055cd5172ded084de4474b91 100644 +--- a/Source/Lib/Encoder/CMakeLists.txt ++++ b/Source/Lib/Encoder/CMakeLists.txt +@@ -129,7 +129,9 @@ set_target_properties(SvtAv1Enc PROPERTIES VERSION ${ENC_VERSION}) + set_target_properties(SvtAv1Enc PROPERTIES SOVERSION ${ENC_VERSION_MAJOR}) + set_target_properties(SvtAv1Enc PROPERTIES C_VISIBILITY_PRESET hidden) + target_link_libraries(SvtAv1Enc PUBLIC ${PLATFORM_LIBS}) +-if(NOT COMPILE_C_ONLY AND HAVE_X86_PLATFORM) ++if(USE_EXTERNAL_CPUINFO) ++ target_link_libraries(SvtAv1Enc PRIVATE cpuinfo::cpuinfo) ++elseif(NOT COMPILE_C_ONLY AND HAVE_X86_PLATFORM) + target_link_libraries(SvtAv1Enc PRIVATE cpuinfo_public) + endif() + 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..f94af5af73744 --- /dev/null +++ b/recipes/libsvtav1/all/patches/llvm-clang-macos.patch @@ -0,0 +1,21 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 25a40f09..9c861554 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -203,10 +203,12 @@ endif() + if(UNIX) + if(APPLE) + 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(CMAKE_C_COMPILER_ID MATCHES "AppleClang") ++ 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 ") ++ 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..9a816703844c2 --- /dev/null +++ b/recipes/libsvtav1/all/test_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(libsvtav1 REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE libsvtav1::encoder) +if (TARGET libsvtav1::decoder) + target_link_libraries(${PROJECT_NAME} PRIVATE libsvtav1::decoder) + target_compile_definitions(${PROJECT_NAME} PRIVATE HAVE_DECODER) +endif() 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..bb98a869a2556 --- /dev/null +++ b/recipes/libsvtav1/all/test_package/test_package.cpp @@ -0,0 +1,8 @@ +#include "EbSvtAv1Enc.h" +#ifdef HAVE_DECODER +# include "EbSvtAv1Dec.h" +#endif + +#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..b7b7bfc2cde82 --- /dev/null +++ b/recipes/libsvtav1/config.yml @@ -0,0 +1,11 @@ +versions: + "2.2.1": + folder: all + "2.1.2": + folder: all + "2.1.0": + folder: all + "1.7.0": + folder: all + "1.6.0": + folder: all diff --git a/recipes/libsystemd/all/conandata.yml b/recipes/libsystemd/all/conandata.yml index bad16940c7037..ebdc4097aca58 100644 --- a/recipes/libsystemd/all/conandata.yml +++ b/recipes/libsystemd/all/conandata.yml @@ -1,54 +1,72 @@ sources: - "246.16": - url: "https://github.com/systemd/systemd-stable/archive/v246.16.tar.gz" - sha256: "b69f9940d65870f090269a28f1047a633d4b80d0001e091d53a031dd40a822d2" - "247.11": - url: "https://github.com/systemd/systemd-stable/archive/v247.11.tar.gz" - sha256: "99537ecf15815d5bac2f8f75b4e04635e1f8e95e7c857c711e42483aa2744f7f" - "248.10": - url: "https://github.com/systemd/systemd-stable/archive/v248.10.tar.gz" - sha256: "dab015c2ccd5cb0427b1c3ec85ac0f02974b38ca643de31932f198a8b60de8da" - "249.12": - url: "https://github.com/systemd/systemd-stable/archive/v249.12.tar.gz" - sha256: "cf8851e94cbd82c65a86ab122747f3e0018b04cd991c7daccbacb4a3ef149b68" - "251.4": - url: "https://github.com/systemd/systemd-stable/archive/v251.4.tar.gz" - sha256: "3459239979f52b8c4ace33734d31c2fb69fa13cf81d04b1b982f7d8d4651e015" + "255.10": + url: "https://github.com/systemd/systemd-stable/archive/v255.10.tar.gz" + sha256: "1747b848e68223597abb90ca2758b25230ac4c19e252e9ec77c8518750f621ed" + "255.7": + url: "https://github.com/systemd/systemd-stable/archive/v255.7.tar.gz" + sha256: "da29f2490c192ca743511098b1d15e385b1b5e7744979661dc30514c1ac61f0e" + "255.2": + url: "https://github.com/systemd/systemd-stable/archive/v255.2.tar.gz" + sha256: "ba7354a742dc9a8bb7dbeaa40cbf7cf2ca84f506d5b7ae5ab8d14c8eecb7aca0" + "255": + url: "https://github.com/systemd/systemd-stable/archive/v255.tar.gz" + sha256: "a3eb766ee96eb9f4cc25c2a6c933f3299e1b7ae22e72507dade0a5c86d92534f" + "253.14": + url: "https://github.com/systemd/systemd-stable/archive/v253.14.tar.gz" + sha256: "9c83ac26f691ff2c482659884f01f1155ef5e1bd202204f9e3076a31e54ab155" + "253.10": + url: "https://github.com/systemd/systemd-stable/archive/v253.10.tar.gz" + sha256: "7c869513b2ad015568e8e35304942f84378b0c59972cb44de5ac905b8eea08d4" + "253.6": + url: "https://github.com/systemd/systemd-stable/archive/v253.6.tar.gz" + sha256: "a0aebcfaa2e001a4d846691631d1722c4cfa1a175e4ea62db6edca0ea3cf1e3e" 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_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_source: "https://github.com/systemd/systemd-stable/commit/3d0666d9091dd097022f02fae79890b5746285c1" - - patch_file: "patches/246.16/0003-Remove-dependency-from-coreutils.patch" + "255.10": + - patch_file: "patches/251.18/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" - "247.11": - - patch_file: "patches/247.11/0001-Remove-dependency-from-coreutils.patch" + "255.7": + - patch_file: "patches/251.18/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" - "248.10": - - patch_file: "patches/248.10/0001-missing_syscalls.py-Replace-unicode-with-ascii.patch" + "255.2": + - patch_file: "patches/251.18/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" + "255": + - patch_file: "patches/251.18/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" + "253.14": + - patch_file: "patches/253.6/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/247.11/0001-Remove-dependency-from-coreutils.patch" + - patch_file: "patches/251.18/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" - "249.12": - - patch_file: "patches/248.10/0001-missing_syscalls.py-Replace-unicode-with-ascii.patch" + - patch_file: "patches/253.3/0002-meson-use-c_args-in-generator-scripts.patch" + patch_source: "https://patch-diff.githubusercontent.com/raw/systemd/systemd/pull/29538" + patch_description: "fixes cross-compilation by passing necessary compiler arguments to generator scripts" + patch_type: "portability" + "253.10": + - patch_file: "patches/253.6/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/249.12/0001-Remove-dependency-from-coreutils.patch" + - patch_file: "patches/251.18/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" - "251.4": - - patch_file: "patches/248.10/0001-missing_syscalls.py-Replace-unicode-with-ascii.patch" + - patch_file: "patches/253.3/0002-meson-use-c_args-in-generator-scripts.patch" + patch_source: "https://patch-diff.githubusercontent.com/raw/systemd/systemd/pull/29538" + patch_description: "fixes cross-compilation by passing necessary compiler arguments to generator scripts" + patch_type: "portability" + "253.6": + - patch_file: "patches/253.6/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_file: "patches/251.18/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" + - patch_file: "patches/253.3/0002-meson-use-c_args-in-generator-scripts.patch" + patch_source: "https://patch-diff.githubusercontent.com/raw/systemd/systemd/pull/29538" + patch_description: "fixes cross-compilation by passing necessary compiler arguments to generator scripts" + patch_type: "portability" diff --git a/recipes/libsystemd/all/conanfile.py b/recipes/libsystemd/all/conanfile.py index 6ea4caf383334..2f7cbdaadba28 100644 --- a/recipes/libsystemd/all/conanfile.py +++ b/recipes/libsystemd/all/conanfile.py @@ -1,15 +1,17 @@ import os import re +import tarfile from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.files import apply_conandata_patches, copy, get, \ - replace_in_file +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, replace_in_file, download, move_folder_contents +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 -required_conan_version = ">=1.50.2" +required_conan_version = ">=1.64.0" class LibsystemdConan(ConanFile): @@ -18,8 +20,9 @@ class LibsystemdConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.freedesktop.org/wiki/Software/systemd/" description = "System and Service Manager API library" - topics = ("systemd", "libsystemd", "service", "manager") - settings = "os", "compiler", "build_type", "arch" + topics = ("systemd", "service", "manager") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -36,53 +39,67 @@ class LibsystemdConan(ConanFile): "with_xz": True, "with_zstd": True, } - generators = "PkgConfigDeps", "VirtualBuildEnv" - 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 + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") - def validate(self): - if self.info.settings.os != "Linux": - raise ConanInvalidConfiguration("Only Linux supported") + def layout(self): + basic_layout(self, src_folder="src") - def build_requirements(self): - self.tool_requires("meson/0.63.1") - self.tool_requires("m4/1.4.19") - self.tool_requires("gperf/3.1") - self.tool_requires("pkgconf/1.7.4") + @property + def _compilers_minimum_version(self): + return { + "gcc": "7", # gcc 5 is failing + "clang": "10" + } def requirements(self): - self.requires("libcap/2.65") - self.requires("libmount/2.36.2") + self.requires("libcap/2.69") + self.requires("libmount/2.39.2") + self.requires("libxcrypt/4.4.36") if self.options.with_selinux: - self.requires("libselinux/3.3") + self.requires("libselinux/3.6") if self.options.with_lz4: - self.requires("lz4/1.9.3") + self.requires("lz4/1.9.4") if self.options.with_xz: - self.requires("xz_utils/5.2.5") + self.requires("xz_utils/5.4.5") if self.options.with_zstd: - self.requires("zstd/1.5.2") + self.requires("zstd/1.5.5") - def layout(self): - basic_layout(self, src_folder="source") + def validate(self): + if self.settings.os != "Linux": + raise ConanInvalidConfiguration("Only Linux supported") + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if Version(self.version) >= "255.0" and minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires {str(self.settings.compiler)} >= {minimum_version}." + ) + + def build_requirements(self): + self.tool_requires("meson/1.4.0") + self.tool_requires("m4/1.4.19") + self.tool_requires("gperf/3.1") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/2.1.0") def source(self): - get(self, **self.conan_data["sources"][self.version], strip_root=True) + # Extract using standard Python tools due to Conan's unzip() not handling backslashes in + # 'units/system-systemd\x2dcryptsetup.slice', etc. correctly. + download(self, **self.conan_data["sources"][self.version], filename="sources.tar.gz") + with tarfile.open("sources.tar.gz", "r:gz") as tar: + tar.extractall() + move_folder_contents(self, os.path.join(self.source_folder, f"systemd-stable-{self.version}"), self.source_folder) @property def _so_version(self): meson_build = os.path.join(self.source_folder, "meson.build") - with open(meson_build, "r") as build_file: + with open(meson_build, "r", encoding="utf-8") as build_file: for line in build_file: match = re.match(r"^libsystemd_version = '(.*)'$", line) if match: @@ -90,6 +107,9 @@ def _so_version(self): return "" def generate(self): + env = VirtualBuildEnv(self) + env.generate() + tc = MesonToolchain(self) tc.project_options["selinux"] = ("true" if self.options.with_selinux else "false") @@ -123,21 +143,24 @@ def generate(self): "link-udev-shared", "link-systemctl-shared", "analyze", "pam", "link-networkd-shared", "link-timesyncd-shared", "kernel-install", "libiptc", "elfutils", "repart", "homed", "importd", "acl", - "dns-over-tls", "gnu-efi", "valgrind", "log-trace"] - - if Version(self.version) >= "247.1": - unrelated.append("oomd") - if Version(self.version) >= "248.1": - unrelated.extend(["sysext", "nscd"]) - if Version(self.version) >= "251.1": - unrelated.append("link-boot-shared") + "dns-over-tls", "log-trace"] + + unrelated.append("oomd") + unrelated.extend(["sysext", "nscd"]) + unrelated.append("link-boot-shared") + unrelated.append("link-journalctl-shared") + if Version(self.version) < "254.7": + unrelated.extend(["gnu-efi", "valgrind"]) + else: + unrelated.extend(["passwdqc", "bootloader", "link-portabled-shared"]) for opt in unrelated: tc.project_options[opt] = "false" - # 'rootprefix' is unused during libsystemd packaging but systemd > v247 - # build files require 'prefix' to be a subdirectory of 'rootprefix'. - tc.project_options["rootprefix"] = self.package_folder + if Version(self.version) < "255": + # 'rootprefix' is unused during libsystemd packaging but systemd > v247 + # build files require 'prefix' to be a subdirectory of 'rootprefix'. + tc.project_options["rootprefix"] = "/" # Since, Conan 1.64 # There are a few places in libsystemd where pkgconfig dependencies are # not used in compile time and only used in link time. And because of @@ -145,17 +168,18 @@ def generate(self): # is also required to provide a path to the header files directly to # the compiler. for dependency in self.dependencies.values(): - for includedir in dependency.cpp_info.includedirs: - tc.c_args.append("-I{}".format(includedir)) + for includedir in dependency.cpp_info.aggregated_components().includedirs: + tc.c_args.append(f"-I{includedir}") tc.generate() + deps = PkgConfigDeps(self) + deps.generate() + def _patch_sources(self): apply_conandata_patches(self) - meson_build = os.path.join(self.source_folder, "meson.build") - replace_in_file(self, meson_build, "@CONAN_SRC_REL_PATH@", - "'../{}'".format(os.path.basename(self.source_folder))) + replace_in_file(self, meson_build, "@CONAN_SRC_REL_PATH@", f"'../{self.source_path.name}'") def build(self): self._patch_sources() @@ -164,7 +188,7 @@ def build(self): meson.configure() target = ("systemd:shared_library" if self.options.shared else "systemd:static_library") - meson.build(target="version.h {}".format(target)) + meson.build(target=f"version.h {target}") def package(self): copy(self, "LICENSE.LGPL2.1", self.source_folder, @@ -184,23 +208,10 @@ def package(self): os.path.join(self.package_folder, "lib")) def package_info(self): + self.cpp_info.set_property("pkg_config_name", "libsystemd") + self.cpp_info.set_property("component_version", str(Version(self.version).major)) self.cpp_info.libs = ["systemd"] - # 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 = str(Version(self.version).major) - self.cpp_info.set_property("component_version", - 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 - # (see https://github.com/conan-io/conan/pull/11790) - self.cpp_info.requires = ["libcap::libcap", "libmount::libmount"] - if self.options.with_selinux: - self.cpp_info.requires.append("libselinux::libselinux") - if self.options.with_lz4: - self.cpp_info.requires.append("lz4::lz4") - if self.options.with_xz: - self.cpp_info.requires.append("xz_utils::xz_utils") - if self.options.with_zstd: - self.cpp_info.requires.append("zstd::zstd") + # TODO: to remove in conan v2 + self.cpp_info.version = str(Version(self.version).major) diff --git a/recipes/libsystemd/all/patches/246.16/0001-Drop-bundled-copy-of-linux-if_arp.h.patch b/recipes/libsystemd/all/patches/246.16/0001-Drop-bundled-copy-of-linux-if_arp.h.patch deleted file mode 100644 index cb77bf0883880..0000000000000 --- a/recipes/libsystemd/all/patches/246.16/0001-Drop-bundled-copy-of-linux-if_arp.h.patch +++ /dev/null @@ -1,223 +0,0 @@ -From 00ff923c28498dad77c1705c3699a21bcc941329 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= -Date: Wed, 15 Sep 2021 16:33:05 +0200 -Subject: [PATCH 1/2] Drop bundled copy of linux/if_arp.h -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -As far as I can see, we use this to get a list of ARPHRD_* defines (used in -particular for Type= in .link files). If we drop our copy, and build against -old kernel headers, the user will have a shorter list of types available. This -seems OK, and I don't think it's worth carrying our own version of this file -just to have newest possible entries. - -7c5b9952c4f6e2b72f90edbe439982528b7cf223 recently updated this file, but we'd -have to update it every time the kernel adds new entries. But if we look at -the failure carefully: - -src/basic/arphrd-from-name.gperf:65:16: error: ‘ARPHRD_MCTP’ undeclared (first use in this function); did you mean ‘ARPHRD_FCPP’? - 65 | MCTP, ARPHRD_MCTP - | ^~ - | ARPHRD_FCPP - -we see that the list we were generating was from the system headers, so it was -only as good as the system headers anyway, without the newer entries in our -bundled copy, if there were any. So let's make things simpler by always using -system headers. - -And if somebody wants to fix things so that we always have the newest list, -then we should just generate and store the converted list, not the full header. - -(cherry picked from commit e7f46ee3ae1cc66a94b293957721d68dc09d7449) ---- - src/basic/linux/if_arp.h | 164 --------------------------------------- - src/basic/meson.build | 1 - - 2 files changed, 165 deletions(-) - delete mode 100644 src/basic/linux/if_arp.h - -diff --git a/src/basic/linux/if_arp.h b/src/basic/linux/if_arp.h -deleted file mode 100644 -index c3cc5a9e5e..0000000000 ---- a/src/basic/linux/if_arp.h -+++ /dev/null -@@ -1,164 +0,0 @@ --/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ --/* -- * INET An implementation of the TCP/IP protocol suite for the LINUX -- * operating system. INET is implemented using the BSD Socket -- * interface as the means of communication with the user level. -- * -- * Global definitions for the ARP (RFC 826) protocol. -- * -- * Version: @(#)if_arp.h 1.0.1 04/16/93 -- * -- * Authors: Original taken from Berkeley UNIX 4.3, (c) UCB 1986-1988 -- * Portions taken from the KA9Q/NOS (v2.00m PA0GRI) source. -- * Ross Biro -- * Fred N. van Kempen, -- * Florian La Roche, -- * Jonathan Layes -- * Arnaldo Carvalho de Melo ARPHRD_HWX25 -- * -- * This program is free software; you can redistribute it and/or -- * modify it under the terms of the GNU General Public License -- * as published by the Free Software Foundation; either version -- * 2 of the License, or (at your option) any later version. -- */ --#ifndef _UAPI_LINUX_IF_ARP_H --#define _UAPI_LINUX_IF_ARP_H -- --#include -- --/* ARP protocol HARDWARE identifiers. */ --#define ARPHRD_NETROM 0 /* from KA9Q: NET/ROM pseudo */ --#define ARPHRD_ETHER 1 /* Ethernet 10Mbps */ --#define ARPHRD_EETHER 2 /* Experimental Ethernet */ --#define ARPHRD_AX25 3 /* AX.25 Level 2 */ --#define ARPHRD_PRONET 4 /* PROnet token ring */ --#define ARPHRD_CHAOS 5 /* Chaosnet */ --#define ARPHRD_IEEE802 6 /* IEEE 802.2 Ethernet/TR/TB */ --#define ARPHRD_ARCNET 7 /* ARCnet */ --#define ARPHRD_APPLETLK 8 /* APPLEtalk */ --#define ARPHRD_DLCI 15 /* Frame Relay DLCI */ --#define ARPHRD_ATM 19 /* ATM */ --#define ARPHRD_METRICOM 23 /* Metricom STRIP (new IANA id) */ --#define ARPHRD_IEEE1394 24 /* IEEE 1394 IPv4 - RFC 2734 */ --#define ARPHRD_EUI64 27 /* EUI-64 */ --#define ARPHRD_INFINIBAND 32 /* InfiniBand */ -- --/* Dummy types for non ARP hardware */ --#define ARPHRD_SLIP 256 --#define ARPHRD_CSLIP 257 --#define ARPHRD_SLIP6 258 --#define ARPHRD_CSLIP6 259 --#define ARPHRD_RSRVD 260 /* Notional KISS type */ --#define ARPHRD_ADAPT 264 --#define ARPHRD_ROSE 270 --#define ARPHRD_X25 271 /* CCITT X.25 */ --#define ARPHRD_HWX25 272 /* Boards with X.25 in firmware */ --#define ARPHRD_CAN 280 /* Controller Area Network */ --#define ARPHRD_PPP 512 --#define ARPHRD_CISCO 513 /* Cisco HDLC */ --#define ARPHRD_HDLC ARPHRD_CISCO --#define ARPHRD_LAPB 516 /* LAPB */ --#define ARPHRD_DDCMP 517 /* Digital's DDCMP protocol */ --#define ARPHRD_RAWHDLC 518 /* Raw HDLC */ --#define ARPHRD_RAWIP 519 /* Raw IP */ -- --#define ARPHRD_TUNNEL 768 /* IPIP tunnel */ --#define ARPHRD_TUNNEL6 769 /* IP6IP6 tunnel */ --#define ARPHRD_FRAD 770 /* Frame Relay Access Device */ --#define ARPHRD_SKIP 771 /* SKIP vif */ --#define ARPHRD_LOOPBACK 772 /* Loopback device */ --#define ARPHRD_LOCALTLK 773 /* Localtalk device */ --#define ARPHRD_FDDI 774 /* Fiber Distributed Data Interface */ --#define ARPHRD_BIF 775 /* AP1000 BIF */ --#define ARPHRD_SIT 776 /* sit0 device - IPv6-in-IPv4 */ --#define ARPHRD_IPDDP 777 /* IP over DDP tunneller */ --#define ARPHRD_IPGRE 778 /* GRE over IP */ --#define ARPHRD_PIMREG 779 /* PIMSM register interface */ --#define ARPHRD_HIPPI 780 /* High Performance Parallel Interface */ --#define ARPHRD_ASH 781 /* Nexus 64Mbps Ash */ --#define ARPHRD_ECONET 782 /* Acorn Econet */ --#define ARPHRD_IRDA 783 /* Linux-IrDA */ --/* ARP works differently on different FC media .. so */ --#define ARPHRD_FCPP 784 /* Point to point fibrechannel */ --#define ARPHRD_FCAL 785 /* Fibrechannel arbitrated loop */ --#define ARPHRD_FCPL 786 /* Fibrechannel public loop */ --#define ARPHRD_FCFABRIC 787 /* Fibrechannel fabric */ -- /* 787->799 reserved for fibrechannel media types */ --#define ARPHRD_IEEE802_TR 800 /* Magic type ident for TR */ --#define ARPHRD_IEEE80211 801 /* IEEE 802.11 */ --#define ARPHRD_IEEE80211_PRISM 802 /* IEEE 802.11 + Prism2 header */ --#define ARPHRD_IEEE80211_RADIOTAP 803 /* IEEE 802.11 + radiotap header */ --#define ARPHRD_IEEE802154 804 --#define ARPHRD_IEEE802154_MONITOR 805 /* IEEE 802.15.4 network monitor */ -- --#define ARPHRD_PHONET 820 /* PhoNet media type */ --#define ARPHRD_PHONET_PIPE 821 /* PhoNet pipe header */ --#define ARPHRD_CAIF 822 /* CAIF media type */ --#define ARPHRD_IP6GRE 823 /* GRE over IPv6 */ --#define ARPHRD_NETLINK 824 /* Netlink header */ --#define ARPHRD_6LOWPAN 825 /* IPv6 over LoWPAN */ --#define ARPHRD_VSOCKMON 826 /* Vsock monitor header */ -- --#define ARPHRD_VOID 0xFFFF /* Void type, nothing is known */ --#define ARPHRD_NONE 0xFFFE /* zero header length */ -- --/* ARP protocol opcodes. */ --#define ARPOP_REQUEST 1 /* ARP request */ --#define ARPOP_REPLY 2 /* ARP reply */ --#define ARPOP_RREQUEST 3 /* RARP request */ --#define ARPOP_RREPLY 4 /* RARP reply */ --#define ARPOP_InREQUEST 8 /* InARP request */ --#define ARPOP_InREPLY 9 /* InARP reply */ --#define ARPOP_NAK 10 /* (ATM)ARP NAK */ -- -- --/* ARP ioctl request. */ --struct arpreq { -- struct sockaddr arp_pa; /* protocol address */ -- struct sockaddr arp_ha; /* hardware address */ -- int arp_flags; /* flags */ -- struct sockaddr arp_netmask; /* netmask (only for proxy arps) */ -- char arp_dev[IFNAMSIZ]; --}; -- --struct arpreq_old { -- struct sockaddr arp_pa; /* protocol address */ -- struct sockaddr arp_ha; /* hardware address */ -- int arp_flags; /* flags */ -- struct sockaddr arp_netmask; /* netmask (only for proxy arps) */ --}; -- --/* ARP Flag values. */ --#define ATF_COM 0x02 /* completed entry (ha valid) */ --#define ATF_PERM 0x04 /* permanent entry */ --#define ATF_PUBL 0x08 /* publish entry */ --#define ATF_USETRAILERS 0x10 /* has requested trailers */ --#define ATF_NETMASK 0x20 /* want to use a netmask (only -- for proxy entries) */ --#define ATF_DONTPUB 0x40 /* don't answer this addresses */ -- --/* -- * This structure defines an ethernet arp header. -- */ -- --struct arphdr { -- __be16 ar_hrd; /* format of hardware address */ -- __be16 ar_pro; /* format of protocol address */ -- unsigned char ar_hln; /* length of hardware address */ -- unsigned char ar_pln; /* length of protocol address */ -- __be16 ar_op; /* ARP opcode (command) */ -- --#if 0 -- /* -- * Ethernet looks like this : This bit is variable sized however... -- */ -- unsigned char ar_sha[ETH_ALEN]; /* sender hardware address */ -- unsigned char ar_sip[4]; /* sender IP address */ -- unsigned char ar_tha[ETH_ALEN]; /* target hardware address */ -- unsigned char ar_tip[4]; /* target IP address */ --#endif -- --}; -- -- --#endif /* _UAPI_LINUX_IF_ARP_H */ -diff --git a/src/basic/meson.build b/src/basic/meson.build -index ae01beaeaa..feb4e75b74 100644 ---- a/src/basic/meson.build -+++ b/src/basic/meson.build -@@ -95,7 +95,6 @@ basic_sources = files(''' - linux/fou.h - linux/if.h - linux/if_addr.h -- linux/if_arp.h - linux/if_bonding.h - linux/if_bridge.h - linux/if_ether.h --- -2.37.2 - diff --git a/recipes/libsystemd/all/patches/246.16/0002-meson.build-change-operator-combining-bools-from-to-.patch b/recipes/libsystemd/all/patches/246.16/0002-meson.build-change-operator-combining-bools-from-to-.patch deleted file mode 100644 index 8ad824a0820d5..0000000000000 --- a/recipes/libsystemd/all/patches/246.16/0002-meson.build-change-operator-combining-bools-from-to-.patch +++ /dev/null @@ -1,34 +0,0 @@ -From eda62b3f67ce3ae5d1ddf281034a66bcf6c74933 Mon Sep 17 00:00:00 2001 -From: Dan Streetman -Date: Fri, 3 Sep 2021 12:43:33 -0400 -Subject: [PATCH 2/2] meson.build: change operator combining bools from + to - and - -upstream meson stopped allowing combining boolean with the plus -operator, and now requires using the logical and operator - -reference: -https://github.com/mesonbuild/meson/commit/43302d3296baff6aeaf8e03f5d701b0402e37a6c - -Fixes: #20632 -(cherry picked from commit c29537f39e4f413a6cbfe9669fa121bdd6d8b36f) ---- - meson.build | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/meson.build b/meson.build -index 77da8a4504..3754e89c24 100644 ---- a/meson.build -+++ b/meson.build -@@ -40,7 +40,7 @@ conf.set_quoted('RELATIVE_SOURCE_PATH', relative_source_path) - - want_ossfuzz = get_option('oss-fuzz') - want_libfuzzer = get_option('llvm-fuzz') --if want_ossfuzz + want_libfuzzer > 1 -+if want_ossfuzz and want_libfuzzer - error('only one of oss-fuzz or llvm-fuzz can be specified') - endif - --- -2.37.2 - diff --git a/recipes/libsystemd/all/patches/246.16/0003-Remove-dependency-from-coreutils.patch b/recipes/libsystemd/all/patches/246.16/0003-Remove-dependency-from-coreutils.patch deleted file mode 100644 index 9aa5388102343..0000000000000 --- a/recipes/libsystemd/all/patches/246.16/0003-Remove-dependency-from-coreutils.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 39d419d89e069213ec3bce9390df26de68f41135 Mon Sep 17 00:00:00 2001 -From: Sergey Bobrenok -Date: Thu, 18 Aug 2022 21:51:58 +0300 -Subject: [PATCH] Remove dependency from coreutils - -In a conan recipe we already know the relative path to the source directory. We -can simply replace '@CONAN_SRC_REL_PATH@' with the actual path there. ---- - meson.build | 4 +--- - 1 file changed, 1 insertion(+), 3 deletions(-) - -diff --git a/meson.build b/meson.build -index 77da8a4504..08560292a1 100644 ---- a/meson.build -+++ b/meson.build -@@ -33,9 +33,7 @@ substs.set('PROJECT_VERSION', meson.project_version(), - # the wrong result when systemd is being built as a meson subproject - project_source_root = meson.current_source_dir() - project_build_root = meson.current_build_dir() --relative_source_path = run_command('realpath', -- '--relative-to=@0@'.format(project_build_root), -- project_source_root).stdout().strip() -+relative_source_path = @CONAN_SRC_REL_PATH@ - conf.set_quoted('RELATIVE_SOURCE_PATH', relative_source_path) - - want_ossfuzz = get_option('oss-fuzz') --- -2.37.2 - diff --git a/recipes/libsystemd/all/patches/247.11/0001-Remove-dependency-from-coreutils.patch b/recipes/libsystemd/all/patches/247.11/0001-Remove-dependency-from-coreutils.patch deleted file mode 100644 index ef33b45cc2799..0000000000000 --- a/recipes/libsystemd/all/patches/247.11/0001-Remove-dependency-from-coreutils.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 319900054fb800f3f3c57806176a71e5f5cff5bd Mon Sep 17 00:00:00 2001 -From: Sergey Bobrenok -Date: Thu, 18 Aug 2022 21:51:58 +0300 -Subject: [PATCH] Remove dependency from coreutils - -In a conan recipe we already know the relative path to the source directory. We -can simply replace '@CONAN_SRC_REL_PATH@' with the actual path there. ---- - meson.build | 4 +--- - 1 file changed, 1 insertion(+), 3 deletions(-) - -diff --git a/meson.build b/meson.build -index 177cd4fb66..869c2352f6 100644 ---- a/meson.build -+++ b/meson.build -@@ -33,9 +33,7 @@ substs.set('PROJECT_VERSION', meson.project_version(), - # the wrong result when systemd is being built as a meson subproject - project_source_root = meson.current_source_dir() - project_build_root = meson.current_build_dir() --relative_source_path = run_command('realpath', -- '--relative-to=@0@'.format(project_build_root), -- project_source_root).stdout().strip() -+relative_source_path = @CONAN_SRC_REL_PATH@ - conf.set_quoted('RELATIVE_SOURCE_PATH', relative_source_path) - - conf.set('BUILD_MODE', 'BUILD_MODE_' + get_option('mode').to_upper(), --- -2.37.2 - diff --git a/recipes/libsystemd/all/patches/249.12/0001-Remove-dependency-from-coreutils.patch b/recipes/libsystemd/all/patches/249.12/0001-Remove-dependency-from-coreutils.patch deleted file mode 100644 index de0ae81a2b1a0..0000000000000 --- a/recipes/libsystemd/all/patches/249.12/0001-Remove-dependency-from-coreutils.patch +++ /dev/null @@ -1,29 +0,0 @@ -From dd758e85278e15db6e66e9802744f120eeb2285c Mon Sep 17 00:00:00 2001 -From: Sergey Bobrenok -Date: Thu, 18 Aug 2022 21:51:58 +0300 -Subject: [PATCH] Remove dependency from coreutils - -In a conan recipe we already know the relative path to the source directory. We -can simply replace '@CONAN_SRC_REL_PATH@' with the actual path there. ---- - meson.build | 4 +--- - 1 file changed, 1 insertion(+), 3 deletions(-) - -diff --git a/meson.build b/meson.build -index b9b8ebef45..30c5b6efa1 100644 ---- a/meson.build -+++ b/meson.build -@@ -25,9 +25,7 @@ conf.set('PROJECT_VERSION', meson.project_version(), - # the wrong result when systemd is being built as a meson subproject - project_source_root = meson.current_source_dir() - project_build_root = meson.current_build_dir() --relative_source_path = run_command('realpath', -- '--relative-to=@0@'.format(project_build_root), -- project_source_root).stdout().strip() -+relative_source_path = @CONAN_SRC_REL_PATH@ - conf.set_quoted('RELATIVE_SOURCE_PATH', relative_source_path) - - conf.set10('BUILD_MODE_DEVELOPER', get_option('mode') == 'developer', --- -2.37.2 - diff --git a/recipes/libsystemd/all/patches/251.18/0001-Remove-dependency-from-coreutils.patch b/recipes/libsystemd/all/patches/251.18/0001-Remove-dependency-from-coreutils.patch new file mode 100644 index 0000000000000..d186a13d30fbb --- /dev/null +++ b/recipes/libsystemd/all/patches/251.18/0001-Remove-dependency-from-coreutils.patch @@ -0,0 +1,32 @@ +From 0cd72ba5fc1e0b7927522e91d4a1b5172bbc818e Mon Sep 17 00:00:00 2001 +From: Sergey Bobrenok +Date: Thu, 18 Aug 2022 21:51:58 +0300 +Subject: [PATCH] Remove dependency from coreutils + +In a conan recipe we already know the relative path to the source directory. We +can simply replace '@CONAN_SRC_REL_PATH@' with the actual path there. +--- + meson.build | 5 +---- + 1 file changed, 1 insertion(+), 4 deletions(-) + +diff --git a/meson.build b/meson.build +index d27796e85e..1a31824c8c 100644 +--- a/meson.build ++++ b/meson.build +@@ -25,10 +25,7 @@ conf.set('PROJECT_VERSION', meson.project_version(), + # the wrong result when systemd is being built as a meson subproject + project_source_root = meson.current_source_dir() + project_build_root = meson.current_build_dir() +-relative_source_path = run_command('realpath', +- '--relative-to=@0@'.format(project_build_root), +- project_source_root, +- check : true).stdout().strip() ++relative_source_path = @CONAN_SRC_REL_PATH@ + conf.set_quoted('RELATIVE_SOURCE_PATH', relative_source_path) + + conf.set10('BUILD_MODE_DEVELOPER', get_option('mode') == 'developer', + +base-commit: a6422b7bd7001dc38d658f3197073a3e22ca9f1b +-- +2.40.1 + diff --git a/recipes/libsystemd/all/patches/251.4/0001-Remove-dependency-from-coreutils.patch b/recipes/libsystemd/all/patches/251.4/0001-Remove-dependency-from-coreutils.patch deleted file mode 100644 index 466e1bb85a6ce..0000000000000 --- a/recipes/libsystemd/all/patches/251.4/0001-Remove-dependency-from-coreutils.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 9c20566484b758204215f945dfa8a1242b8bff8c Mon Sep 17 00:00:00 2001 -From: Sergey Bobrenok -Date: Thu, 18 Aug 2022 21:51:58 +0300 -Subject: [PATCH] Remove dependency from coreutils - -In a conan recipe we already know the relative path to the source directory. We -can simply replace '@CONAN_SRC_REL_PATH@' with the actual path there. ---- - meson.build | 5 +---- - 1 file changed, 1 insertion(+), 4 deletions(-) - -diff --git a/meson.build b/meson.build -index dbba108ad1..035869fb0d 100644 ---- a/meson.build -+++ b/meson.build -@@ -25,10 +25,7 @@ conf.set('PROJECT_VERSION', meson.project_version(), - # the wrong result when systemd is being built as a meson subproject - project_source_root = meson.current_source_dir() - project_build_root = meson.current_build_dir() --relative_source_path = run_command('realpath', -- '--relative-to=@0@'.format(project_build_root), -- project_source_root, -- check : true).stdout().strip() -+relative_source_path = @CONAN_SRC_REL_PATH@ - conf.set_quoted('RELATIVE_SOURCE_PATH', relative_source_path) - - conf.set10('BUILD_MODE_DEVELOPER', get_option('mode') == 'developer', --- -2.37.2 - diff --git a/recipes/libsystemd/all/patches/253.3/0002-meson-use-c_args-in-generator-scripts.patch b/recipes/libsystemd/all/patches/253.3/0002-meson-use-c_args-in-generator-scripts.patch new file mode 100644 index 0000000000000..478910e9a3aeb --- /dev/null +++ b/recipes/libsystemd/all/patches/253.3/0002-meson-use-c_args-in-generator-scripts.patch @@ -0,0 +1,33 @@ +From 7b110183b2607d57d399e977a96cb453aed37265 Mon Sep 17 00:00:00 2001 +From: Jordan Williams +Date: Fri, 13 Oct 2023 09:41:00 -0500 +Subject: [PATCH] Revert "Revert "meson: use c_args in generator scripts + (#10289)"" + +This reverts commit 0e3cc902faec4f18d5fa606396f602b08bc94e27. + +Fixes #10288. +I have confirmed that this does now fix cross-compilation. +It appears that changes upstream in Meson, probably mesonbuild/meson#5263, have made the original MR, #10289, work now. + +This needs to be tested to ensure that it doesn't break Travis CI like when it was reverted in #10361. +--- + meson.build | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/meson.build b/meson.build +index d79263ea8b..87b5a76082 100644 +--- a/meson.build ++++ b/meson.build +@@ -498,7 +498,7 @@ if cxx_cmd != '' + add_project_arguments(cxx.get_supported_arguments(basic_disabled_warnings), language : 'cpp') + endif + +-cpp = ' '.join(cc.cmd_array()) + ' -E' ++cpp = ' '.join(cc.cmd_array() + get_option('c_args')) + ' -E' + + has_wstringop_truncation = cc.has_argument('-Wstringop-truncation') + +-- +2.41.0 + diff --git a/recipes/libsystemd/all/patches/248.10/0001-missing_syscalls.py-Replace-unicode-with-ascii.patch b/recipes/libsystemd/all/patches/253.6/0001-missing_syscalls.py-Replace-unicode-with-ascii.patch similarity index 81% rename from recipes/libsystemd/all/patches/248.10/0001-missing_syscalls.py-Replace-unicode-with-ascii.patch rename to recipes/libsystemd/all/patches/253.6/0001-missing_syscalls.py-Replace-unicode-with-ascii.patch index 93bb5224d5833..c6abf3d61d056 100644 --- a/recipes/libsystemd/all/patches/248.10/0001-missing_syscalls.py-Replace-unicode-with-ascii.patch +++ b/recipes/libsystemd/all/patches/253.6/0001-missing_syscalls.py-Replace-unicode-with-ascii.patch @@ -1,4 +1,4 @@ -From 512223a1ada207304787fb24a6da9e844b381239 Mon Sep 17 00:00:00 2001 +From da3472d677dd30065f8745a124d580e5c24d3868 Mon Sep 17 00:00:00 2001 From: Sergey Bobrenok Date: Wed, 17 Aug 2022 22:31:13 +0300 Subject: [PATCH] missing_syscalls.py: Replace unicode with ascii @@ -13,10 +13,10 @@ fail with error: 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/basic/missing_syscalls.py b/src/basic/missing_syscalls.py -index 1bfa31ba37..cc353fe723 100644 +index 5ccf02adec..14169e67f3 100644 --- a/src/basic/missing_syscalls.py +++ b/src/basic/missing_syscalls.py -@@ -32,7 +32,7 @@ def dictify(f): +@@ -31,7 +31,7 @@ def dictify(f): @dictify def parse_syscall_table(filename): @@ -25,6 +25,8 @@ index 1bfa31ba37..cc353fe723 100644 for line in open(filename): items = line.split() if len(items) >= 2: + +base-commit: ed18c2ab79e8b94182d5dcf31d58457763f3e3e1 -- -2.37.2 +2.40.1 diff --git a/recipes/libsystemd/all/test_package/CMakeLists.txt b/recipes/libsystemd/all/test_package/CMakeLists.txt index 16f08025b6a67..63d72a88f1cb3 100644 --- a/recipes/libsystemd/all/test_package/CMakeLists.txt +++ b/recipes/libsystemd/all/test_package/CMakeLists.txt @@ -1,8 +1,8 @@ -cmake_minimum_required(VERSION 3.15) -project(PackageTest LANGUAGES C) +cmake_minimum_required(VERSION 3.6) +project(test_package LANGUAGES C) find_package(PkgConfig REQUIRED) pkg_check_modules(SYSTEMD REQUIRED IMPORTED_TARGET libsystemd) -add_executable(example example.c) -target_link_libraries(example PRIVATE PkgConfig::SYSTEMD) +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE PkgConfig::SYSTEMD) diff --git a/recipes/libsystemd/all/test_package/conanfile.py b/recipes/libsystemd/all/test_package/conanfile.py index 0aeda735af009..0e275799b53e7 100644 --- a/recipes/libsystemd/all/test_package/conanfile.py +++ b/recipes/libsystemd/all/test_package/conanfile.py @@ -3,30 +3,22 @@ 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 -required_conan_version = ">=1.38.0" - -class LibsystemdTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "PkgConfigDeps", "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("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") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/2.0.3") def build(self): cmake = CMake(self) @@ -35,5 +27,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/libsystemd/all/test_package/example.c b/recipes/libsystemd/all/test_package/test_package.c similarity index 100% rename from recipes/libsystemd/all/test_package/example.c rename to recipes/libsystemd/all/test_package/test_package.c diff --git a/recipes/libsystemd/all/test_v1_package/CMakeLists.txt b/recipes/libsystemd/all/test_v1_package/CMakeLists.txt index 4729ae06ab8cf..0d20897301b68 100644 --- a/recipes/libsystemd/all/test_v1_package/CMakeLists.txt +++ b/recipes/libsystemd/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.15) -project(PackageTest LANGUAGES C) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(PkgConfig REQUIRED) -pkg_check_modules(SYSTEMD REQUIRED IMPORTED_TARGET libsystemd) - -add_executable(example ../test_package/example.c) -target_link_libraries(example PRIVATE PkgConfig::SYSTEMD) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libsystemd/all/test_v1_package/conanfile.py b/recipes/libsystemd/all/test_v1_package/conanfile.py index 1db9d3daee488..b3607270e232e 100644 --- a/recipes/libsystemd/all/test_v1_package/conanfile.py +++ b/recipes/libsystemd/all/test_v1_package/conanfile.py @@ -1,16 +1,13 @@ +from conans import ConanFile, CMake, tools import os -from conan import ConanFile -from conan.tools.build import can_run -from conans import CMake - -class LibsystemdTestConan(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/2.0.3") def build(self): cmake = CMake(self) @@ -18,6 +15,6 @@ def build(self): cmake.build() def test(self): - if can_run(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/libsystemd/config.yml b/recipes/libsystemd/config.yml index 46dd6c53cbb3c..f9ba7f3698786 100644 --- a/recipes/libsystemd/config.yml +++ b/recipes/libsystemd/config.yml @@ -1,11 +1,15 @@ versions: - "246.16": + "255.10": folder: all - "247.11": + "255.7": folder: all - "248.10": + "255.2": folder: all - "249.12": + "255": folder: all - "251.4": + "253.14": + folder: all + "253.10": + folder: all + "253.6": folder: all diff --git a/recipes/libtar/all/conanfile.py b/recipes/libtar/all/conanfile.py index 60120c5cb3ca8..18b7b52de3166 100644 --- a/recipes/libtar/all/conanfile.py +++ b/recipes/libtar/all/conanfile.py @@ -1,5 +1,6 @@ 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 VirtualRunEnv from conan.tools.files import copy, get, replace_in_file, rm, rmdir @@ -7,16 +8,17 @@ from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.53.0" +required_conan_version = ">=1.54.0" class LibTarConan(ConanFile): name = "libtar" description = "libtar is a library for manipulating tar files from within C programs." - topics = ("tar") + topics = ("tar",) license = "BSD-3-Clause" homepage = "https://repo.or.cz/libtar.git" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -44,20 +46,22 @@ def layout(self): def requirements(self): if self.options.with_zlib: - self.requires("zlib/1.2.13") + self.requires("zlib/[>=1.2.11 <2]") def validate(self): - if self.info.settings.os == "Windows": + if self.settings.os == "Windows": raise ConanInvalidConfiguration("libtar does not support Windows") def build_requirements(self): self.tool_requires("libtool/2.4.7") 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 cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") tc = AutotoolsToolchain(self) tc.configure_args.extend([ "--with-zlib" if self.options.with_zlib else "--without-zlib", @@ -65,9 +69,6 @@ def generate(self): 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: @@ -75,15 +76,13 @@ def _patch_sources(self): 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]), + "AC_CHECK_LIB([{}], [gzread])".format(self.dependencies["zlib"].cpp_info.aggregated_components().libs[0]), ) def build(self): self._patch_sources() 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() @@ -93,11 +92,10 @@ def package(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 = ["tar"] # 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.deps_env_info.PATH.append(bin_path) + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/libtar/all/test_package/conanfile.py b/recipes/libtar/all/test_package/conanfile.py index cdb17258fdda1..3ca1fe65b7b4d 100644 --- a/recipes/libtar/all/test_package/conanfile.py +++ b/recipes/libtar/all/test_package/conanfile.py @@ -16,7 +16,7 @@ def layout(self): cmake_layout(self) def requirements(self): - self.requires(self.tested_reference_str) + self.requires(self.tested_reference_str, run=True) def build(self): cmake = CMake(self) @@ -46,4 +46,4 @@ def test(self): 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) + self.run("libtar -t test.tar", env="conanrun") diff --git a/recipes/libtasn1/all/conanfile.py b/recipes/libtasn1/all/conanfile.py index 9ec3d89cded7e..d1eea1562324a 100644 --- a/recipes/libtasn1/all/conanfile.py +++ b/recipes/libtasn1/all/conanfile.py @@ -1,23 +1,25 @@ 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.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.microsoft import is_msvc import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.54.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 = ("libtasn", "ASN.1", "cryptography") + topics = ("ASN.1", "cryptography") url = "https://github.com/conan-io/conan-center-index" license = "LGPL-2.1-or-later" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -41,18 +43,9 @@ def config_options(self): 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 + 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") @@ -62,15 +55,18 @@ def validate(self): raise ConanInvalidConfiguration(f"{self.ref} doesn't support Visual Studio") def build_requirements(self): - self.tool_requires("bison/3.8.2") + if self._settings_build.os == "Windows": + self.tool_requires("winflexbison/2.5.25") + else: + 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): + 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_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): env = VirtualBuildEnv(self) @@ -85,15 +81,8 @@ def generate(self): 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): - self._patch_sources() + apply_conandata_patches(self) autotools = Autotools(self) autotools.configure() autotools.make() @@ -101,10 +90,10 @@ def build(self): def package(self): 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)}"]) + autotools.install() 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", "libtasn1") @@ -113,6 +102,4 @@ def package_info(self): self.cpp_info.defines = ["ASN1_STATIC"] # TODO: to remove in conan v2 - bindir = os.path.join(self.package_folder, "bin") - self.output.info(f"Appending PATH environment variable: {bindir}") - self.env_info.PATH.append(bindir) + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/libtasn1/all/test_package/conanfile.py b/recipes/libtasn1/all/test_package/conanfile.py index 8214a95b5bd16..dd6d9808a7b5d 100644 --- a/recipes/libtasn1/all/test_package/conanfile.py +++ b/recipes/libtasn1/all/test_package/conanfile.py @@ -1,22 +1,31 @@ from conan import ConanFile -from conan.tools.build import can_run +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 = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv", "VirtualBuildEnv" + generators = "CMakeToolchain", "CMakeDeps" test_type = "explicit" def layout(self): cmake_layout(self) def requirements(self): - self.requires(self.tested_reference_str) + self.requires(self.tested_reference_str, run=not cross_building(self)) def build_requirements(self): - self.tool_requires(self.tested_reference_str) + if cross_building(self): + self.tool_requires(self.tested_reference_str) + + def generate(self): + VirtualRunEnv(self).generate() + if cross_building(self): + VirtualBuildEnv(self).generate() + else: + VirtualRunEnv(self).generate(scope="build") def build(self): cmake = CMake(self) diff --git a/recipes/libtasn1/all/test_v1_package/conanfile.py b/recipes/libtasn1/all/test_v1_package/conanfile.py index 4056b294e223c..efc9236407184 100644 --- a/recipes/libtasn1/all/test_v1_package/conanfile.py +++ b/recipes/libtasn1/all/test_v1_package/conanfile.py @@ -11,12 +11,14 @@ def requirements(self): self.requires(self.tested_reference_str) def build_requirements(self): - self.build_requires(self.tested_reference_str) + if hasattr(self, "settings_build"): + self.build_requires(self.tested_reference_str) def build(self): - cmake = CMake(self) - cmake.configure() - cmake.build() + 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): diff --git a/recipes/libtiff/all/conandata.yml b/recipes/libtiff/all/conandata.yml index ed109970ab657..72d0f547b3861 100644 --- a/recipes/libtiff/all/conandata.yml +++ b/recipes/libtiff/all/conandata.yml @@ -1,52 +1,44 @@ sources: + "4.7.0": + url: "https://download.osgeo.org/libtiff/tiff-4.7.0.tar.xz" + sha256: "273a0a73b1f0bed640afee4a5df0337357ced5b53d3d5d1c405b936501f71017" + "4.6.0": + url: "https://download.osgeo.org/libtiff/tiff-4.6.0.tar.gz" + sha256: "88b3979e6d5c7e32b50d7ec72fb15af724f6ab2cbf7e10880c360a77e4b5d99a" + "4.5.1": + url: "https://download.osgeo.org/libtiff/tiff-4.5.1.tar.gz" + sha256: "d7f38b6788e4a8f5da7940c5ac9424f494d8a79eba53d555f4a507167dca5e2b" + "4.5.0": + url: "https://download.osgeo.org/libtiff/tiff-4.5.0.tar.gz" + sha256: "c7a1d9296649233979fa3eacffef3fa024d73d05d589cb622727b5b08c423464" "4.4.0": - url: "http://download.osgeo.org/libtiff/tiff-4.4.0.tar.gz" + url: "https://download.osgeo.org/libtiff/tiff-4.4.0.tar.gz" sha256: "917223b37538959aca3b790d2d73aa6e626b688e02dcda272aec24c2f498abed" "4.3.0": - url: "http://download.osgeo.org/libtiff/tiff-4.3.0.tar.gz" + url: "https://download.osgeo.org/libtiff/tiff-4.3.0.tar.gz" sha256: "0e46e5acb087ce7d1ac53cf4f56a09b221537fc86dfc5daaad1c2e89e1b37ac8" - "4.2.0": - url: "http://download.osgeo.org/libtiff/tiff-4.2.0.tar.gz" - sha256: "eb0484e568ead8fa23b513e9b0041df7e327f4ee2d22db5a533929dfc19633cb" - "4.1.0": - url: "http://download.osgeo.org/libtiff/tiff-4.1.0.tar.gz" - sha256: "5d29f32517dadb6dbcd1255ea5bbc93a2b54b94fbf83653b4d65c7d6775b8634" - "4.0.9": - url: "http://download.osgeo.org/libtiff/tiff-4.0.9.tar.gz" - sha256: "6e7bdeec2c310734e734d19aae3a71ebe37a4d842e0e23dbb1b8921c0026cfcd" - "4.0.8": - url: "http://download.osgeo.org/libtiff/tiff-4.0.8.tar.gz" - sha256: "59d7a5a8ccd92059913f246877db95a2918e6c04fb9d43fd74e5c3390dac2910" patches: - "4.4.0": - - patch_file: "patches/4.4.0-0001-cmake-dependencies.patch" + "4.7.0": + - patch_file: "patches/4.5.1-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-dependencies.patch" + "4.6.0": + - patch_file: "patches/4.5.1-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-dependencies.patch" + "4.5.1": + - patch_file: "patches/4.5.1-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-dependencies.patch" + "4.5.0": + - patch_file: "patches/4.5.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-dependencies.patch" + "4.4.0": + - patch_file: "patches/4.4.0-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-dependencies.patch" + "4.3.0": + - patch_file: "patches/4.3.0-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 a288f9366d76a..52a5afb9847a5 100644 --- a/recipes/libtiff/all/conanfile.py +++ b/recipes/libtiff/all/conanfile.py @@ -1,7 +1,7 @@ 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.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 import os @@ -13,10 +13,11 @@ class LibtiffConan(ConanFile): name = "libtiff" description = "Library for Tag Image File Format (TIFF)" url = "https://github.com/conan-io/conan-center-index" - license = "MIT" + license = "libtiff" homepage = "http://www.simplesystems.org/libtiff" topics = ("tiff", "image", "bigtiff", "tagged-image-file-format") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -43,30 +44,12 @@ class LibtiffConan(ConanFile): "cxx": True, } - @property - def _has_webp_option(self): - return Version(self.version) >= "4.0.10" - - @property - def _has_zstd_option(self): - return Version(self.version) >= "4.0.10" - - @property - def _has_libdeflate_option(self): - return Version(self.version) >= "4.2.0" - def export_sources(self): export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - if not self._has_webp_option: - del self.options.webp - if not self._has_zstd_option: - del self.options.zstd - if not self._has_libdeflate_option: - del self.options.libdeflate def configure(self): if self.options.shared: @@ -80,31 +63,35 @@ def layout(self): def requirements(self): if self.options.zlib: - self.requires("zlib/1.2.13") - if self.options.get_safe("libdeflate"): - self.requires("libdeflate/1.15") + self.requires("zlib/[>=1.2.11 <2]") + if self.options.libdeflate: + self.requires("libdeflate/1.19") if self.options.lzma: - self.requires("xz_utils/5.2.5") + self.requires("xz_utils/[>=5.4.5 <6]") if self.options.jpeg == "libjpeg": self.requires("libjpeg/9e") elif self.options.jpeg == "libjpeg-turbo": - self.requires("libjpeg-turbo/2.1.4") + self.requires("libjpeg-turbo/3.0.2") elif self.options.jpeg == "mozjpeg": - self.requires("mozjpeg/4.1.1") + self.requires("mozjpeg/4.1.5") 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.4") + if self.options.zstd: + self.requires("zstd/1.5.5") + if self.options.webp: + self.requires("libwebp/1.3.2") def validate(self): - if self.options.get_safe("libdeflate") and not self.options.zlib: + if self.options.libdeflate and not self.options.zlib: raise ConanInvalidConfiguration("libtiff:libdeflate=True requires libtiff:zlib=True") + def build_requirements(self): + if Version(self.version) >= "4.5.1": + # https://github.com/conan-io/conan/issues/3482#issuecomment-662284561 + self.tool_requires("cmake/[>=3.18 <4]") + 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) @@ -113,33 +100,46 @@ def generate(self): 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["libdeflate"] = self.options.libdeflate + tc.variables["zstd"] = self.options.zstd + tc.variables["webp"] = self.options.webp + tc.variables["lerc"] = False # TODO: add lerc support for libtiff versions >= 4.3.0 + if Version(self.version) >= "4.5.0": + # Disable tools, test, contrib, man & html generation + tc.variables["tiff-tools"] = False + tc.variables["tiff-tests"] = False + tc.variables["tiff-contrib"] = False + tc.variables["tiff-docs"] = False 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.cache_variables["CMAKE_FIND_PACKAGE_PREFER_CONFIG"] = True tc.generate() deps = CMakeDeps(self) + if Version(self.version) >= "4.5.1": + deps.set_property("jbig", "cmake_target_name", "JBIG::JBIG") + deps.set_property("xz_utils", "cmake_target_name", "liblzma::liblzma") + deps.set_property("libdeflate", "cmake_file_name", "Deflate") + deps.set_property("libdeflate", "cmake_target_name", "Deflate::Deflate") deps.generate() def _patch_sources(self): apply_conandata_patches(self) + # remove FindXXXX for conan dependencies + for module in ["Deflate", "JBIG", "JPEG", "LERC", "WebP", "ZSTD", "liblzma", "LibLZMA"]: + rm(self, f"Find{module}.cmake", os.path.join(self.source_folder, "cmake")) + # 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)", "") + if Version(self.version) < "4.5.0": + 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 build(self): self._patch_sources() @@ -148,7 +148,8 @@ def build(self): cmake.build() def package(self): - copy(self, "COPYRIGHT", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"), ignore_case=True, keep_path=False) + license_file = "COPYRIGHT" if Version(self.version) < "4.5.0" else "LICENSE.md" + copy(self, license_file, 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")) @@ -169,7 +170,7 @@ def package_info(self): self.cpp_info.requires = [] if self.options.zlib: self.cpp_info.requires.append("zlib::zlib") - if self.options.get_safe("libdeflate"): + if self.options.libdeflate: self.cpp_info.requires.append("libdeflate::libdeflate") if self.options.lzma: self.cpp_info.requires.append("xz_utils::xz_utils") @@ -181,9 +182,9 @@ def package_info(self): self.cpp_info.requires.append("mozjpeg::libjpeg") if self.options.jbig: self.cpp_info.requires.append("jbig::jbig") - if self.options.get_safe("zstd"): + if self.options.zstd: self.cpp_info.requires.append("zstd::zstd") - if self.options.get_safe("webp"): + if self.options.webp: self.cpp_info.requires.append("libwebp::libwebp") # TODO: to remove in conan v2 once cmake_find_package* & pkg_config generators removed 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 deleted file mode 100644 index 7b7979045b5a1..0000000000000 --- a/recipes/libtiff/all/patches/4.0.8-0001-cmake-dependencies.patch +++ /dev/null @@ -1,38 +0,0 @@ ---- 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 deleted file mode 100644 index 216911511380b..0000000000000 --- a/recipes/libtiff/all/patches/4.0.8-0002-no-libm-mingw.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- 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 deleted file mode 100644 index 44a861121db9c..0000000000000 --- a/recipes/libtiff/all/patches/4.0.8-0003-file-offsets-bits-mingw.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- 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-dependencies.patch b/recipes/libtiff/all/patches/4.1.0-0001-cmake-dependencies.patch deleted file mode 100644 index b8a3ec4a4b033..0000000000000 --- a/recipes/libtiff/all/patches/4.1.0-0001-cmake-dependencies.patch +++ /dev/null @@ -1,85 +0,0 @@ ---- 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 deleted file mode 100644 index 0fcf8f5711810..0000000000000 --- a/recipes/libtiff/all/patches/4.1.0-0002-no-libm-mingw.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- 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-dependencies.patch b/recipes/libtiff/all/patches/4.2.0-0001-cmake-dependencies.patch deleted file mode 100644 index 7b04f533eb0f4..0000000000000 --- a/recipes/libtiff/all/patches/4.2.0-0001-cmake-dependencies.patch +++ /dev/null @@ -1,102 +0,0 @@ ---- 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.5.0-0001-cmake-dependencies.patch b/recipes/libtiff/all/patches/4.5.0-0001-cmake-dependencies.patch new file mode 100644 index 0000000000000..7780017230ea1 --- /dev/null +++ b/recipes/libtiff/all/patches/4.5.0-0001-cmake-dependencies.patch @@ -0,0 +1,116 @@ +--- a/cmake/DeflateCodec.cmake ++++ b/cmake/DeflateCodec.cmake +@@ -35,7 +35,10 @@ set(LIBDEFLATE_SUPPORT FALSE) + + # 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 @@ set(JBIG_SUPPORT FALSE) + # 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/JPEGCodec.cmake ++++ b/cmake/JPEGCodec.cmake +@@ -47,19 +47,7 @@ + cmake_push_check_state(RESET) + set(CMAKE_REQUIRED_INCLUDES "${JPEG_INCLUDE_DIRS}") + set(CMAKE_REQUIRED_LIBRARIES "${JPEG_LIBRARIES}") +- check_c_source_compiles( +- " +- #include +- #include +- #include \"jpeglib.h\" +- int main() +- { +- jpeg_read_scanlines(0,0,0); +- jpeg12_read_scanlines(0,0,0); +- return 0; +- } +- " +- HAVE_JPEGTURBO_DUAL_MODE_8_12) ++ set(HAVE_JPEGTURBO_DUAL_MODE_8_12 FALSE) + cmake_pop_check_state() + endif() + +--- a/cmake/ZSTDCodec.cmake ++++ b/cmake/ZSTDCodec.cmake +@@ -28,7 +28,10 @@ set(ZSTD_USABLE FALSE) + 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) + if(NOT DEFINED ZSTD_HAVE_DECOMPRESS_STREAM) +@@ -36,7 +39,7 @@ if(ZSTD_FOUND) + 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_HAVE_DECOMPRESS_STREAM) ++ set(ZSTD_HAVE_DECOMPRESS_STREAM TRUE) + set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE}) + set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES_SAVE}) + endif() +--- a/libtiff/CMakeLists.txt ++++ b/libtiff/CMakeLists.txt +@@ -116,7 +116,7 @@ if(ZIP_SUPPORT AND LIBDEFLATE_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) +@@ -130,7 +130,7 @@ if(JBIG_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) +@@ -145,11 +145,11 @@ if(ZSTD_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() + if(CMath_LIBRARY) diff --git a/recipes/libtiff/all/patches/4.5.1-0001-cmake-dependencies.patch b/recipes/libtiff/all/patches/4.5.1-0001-cmake-dependencies.patch new file mode 100644 index 0000000000000..761950e496109 --- /dev/null +++ b/recipes/libtiff/all/patches/4.5.1-0001-cmake-dependencies.patch @@ -0,0 +1,31 @@ +diff --git a/cmake/JPEGCodec.cmake b/cmake/JPEGCodec.cmake +index 8455a3ec..09fe975a 100644 +--- a/cmake/JPEGCodec.cmake ++++ b/cmake/JPEGCodec.cmake +@@ -42,25 +42,7 @@ endif() + if (JPEG_SUPPORT) + # Check for jpeg12_read_scanlines() which has been added in libjpeg-turbo 2.2 + # for dual 8/12 bit mode. +- include(CheckCSourceCompiles) +- include(CMakePushCheckState) +- cmake_push_check_state(RESET) +- set(CMAKE_REQUIRED_INCLUDES "${JPEG_INCLUDE_DIRS}") +- set(CMAKE_REQUIRED_LIBRARIES "${JPEG_LIBRARIES}") +- check_c_source_compiles( +- " +- #include +- #include +- #include \"jpeglib.h\" +- int main() +- { +- jpeg_read_scanlines(0,0,0); +- jpeg12_read_scanlines(0,0,0); +- return 0; +- } +- " +- HAVE_JPEGTURBO_DUAL_MODE_8_12) +- cmake_pop_check_state() ++ set(HAVE_JPEGTURBO_DUAL_MODE_8_12 FALSE) + endif() + + if (NOT HAVE_JPEGTURBO_DUAL_MODE_8_12) diff --git a/recipes/libtiff/config.yml b/recipes/libtiff/config.yml index 0ca17e7b3017c..3209eca1a3fa1 100644 --- a/recipes/libtiff/config.yml +++ b/recipes/libtiff/config.yml @@ -1,13 +1,13 @@ versions: - "4.4.0": + "4.7.0": folder: all - "4.3.0": + "4.6.0": folder: all - "4.2.0": + "4.5.1": folder: all - "4.1.0": + "4.5.0": folder: all - "4.0.9": + "4.4.0": folder: all - "4.0.8": + "4.3.0": folder: all diff --git a/recipes/libtins/all/CMakeLists.txt b/recipes/libtins/all/CMakeLists.txt deleted file mode 100644 index 61f3d3b039e2b..0000000000000 --- a/recipes/libtins/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/libtins/all/conandata.yml b/recipes/libtins/all/conandata.yml index d565c818eeabe..ee42178c90b26 100644 --- a/recipes/libtins/all/conandata.yml +++ b/recipes/libtins/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "4.5": + url: "https://github.com/mfontanini/libtins/archive/v4.5.tar.gz" + sha256: "6ff5fe1ada10daef8538743dccb9c9b3e19d05d028ffdc24838e62ff3fc55841" "4.4": url: "https://github.com/mfontanini/libtins/archive/v4.4.tar.gz" sha256: "ff0121b4ec070407e29720c801b7e1a972042300d37560a62c57abadc9635634" diff --git a/recipes/libtins/all/conanfile.py b/recipes/libtins/all/conanfile.py index 27984b1647f64..c84ea4afb38c0 100644 --- a/recipes/libtins/all/conanfile.py +++ b/recipes/libtins/all/conanfile.py @@ -1,18 +1,29 @@ -from conans import tools, CMake, ConanFile import os -import textwrap -required_conan_version = ">=1.43.0" +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, rmdir + +required_conan_version = ">=1.53.0" class LibTinsConan(ConanFile): name = "libtins" - url = "https://github.com/conan-io/conan-center-index" - homepage = "https://github.com/mfontanini/libtins" description = "High-level, multiplatform C++ network packet sniffing and crafting library." license = "BSD-2-Clause" - topics = ("pcap", "packets", "network", "packet-analyser", "packet-parsing", "libpcap", "sniffing") - + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/mfontanini/libtins" + topics = ( + "pcap", + "packets", + "network", + "packet-analyser", + "packet-parsing", + "libpcap", + "sniffing", + ) + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -20,6 +31,7 @@ class LibTinsConan(ConanFile): "with_ack_tracker": [True, False], "with_wpa2": [True, False], "with_dot11": [True, False], + "with_tcp_stream_custom_data": [True, False], } default_options = { "shared": False, @@ -27,19 +39,12 @@ class LibTinsConan(ConanFile): "with_ack_tracker": True, "with_wpa2": True, "with_dot11": True, + "with_tcp_stream_custom_data": 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 _min_cppstd(self): + return 11 def config_options(self): if self.settings.os == "Windows": @@ -47,88 +52,71 @@ 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("libpcap/1.10.1") - if self.options.with_ack_tracker: - self.requires("boost/1.79.0") + self.requires("libpcap/1.10.4", transitive_headers=True, transitive_libs=True) + if self.options.with_ack_tracker or self.options.with_tcp_stream_custom_data: + # Used in two public headers: + # - https://github.com/mfontanini/libtins/blob/v4.4/include/tins/tcp_ip/ack_tracker.h#L38 + # - https://github.com/mfontanini/libtins/blob/v4.4/include/tins/tcp_ip/stream.h#L48 + self.requires("boost/1.83.0", transitive_headers=True) if self.options.with_wpa2: - self.requires("openssl/1.1.1q") + self.requires("openssl/[>=1.1 <4]") + + 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], - destination=self._source_subfolder, strip_root=True) - - def _patch_sources(self): - # Use Findlibpcap.cmake from cmake_find_package - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "FIND_PACKAGE(PCAP REQUIRED)", - "find_package(libpcap REQUIRED)") - tools.replace_in_file(os.path.join(self._source_subfolder, "src", "CMakeLists.txt"), - "${PCAP_LIBRARY}", - "libpcap::libpcap") - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["LIBTINS_BUILD_EXAMPLES"] = False - self._cmake.definitions["LIBTINS_BUILD_TESTS"] = False - - self._cmake.definitions["LIBTINS_BUILD_SHARED"] = self.options.shared - self._cmake.definitions["LIBTINS_ENABLE_CXX11"] = tools.valid_min_cppstd(self, 11) - self._cmake.definitions["LIBTINS_ENABLE_ACK_TRACKER"] = self.options.with_ack_tracker - self._cmake.definitions["LIBTINS_ENABLE_WPA2"] = self.options.with_wpa2 - self._cmake.definitions["LIBTINS_ENABLE_DOT11"] = self.options.with_dot11 - - 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["LIBTINS_BUILD_EXAMPLES"] = False + tc.variables["LIBTINS_BUILD_TESTS"] = False + tc.variables["LIBTINS_BUILD_SHARED"] = self.options.shared + tc.variables["LIBTINS_ENABLE_CXX11"] = True + tc.variables["LIBTINS_ENABLE_ACK_TRACKER"] = self.options.with_ack_tracker + tc.variables["LIBTINS_ENABLE_TCP_STREAM_CUSTOM_DATA"] = self.options.with_tcp_stream_custom_data + tc.variables["LIBTINS_ENABLE_WPA2"] = self.options.with_wpa2 + tc.variables["LIBTINS_ENABLE_DOT11"] = self.options.with_dot11 + tc.variables["PCAP_LIBRARY"] = "libpcap::libpcap" + tc.generate() + deps = CMakeDeps(self) + deps.set_property("libpcap", "cmake_file_name", "PCAP") + deps.generate() def build(self): - self._patch_sources() - cmake = self._configure_cmake() + 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() - 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")) - - # 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), - {"libtins": "libtins::libtins"} + copy( + self, + pattern="LICENSE", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder, ) + cmake = CMake(self) + cmake.install() - @staticmethod - def _create_cmake_module_alias_targets(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)) - tools.save(module_file, content) - - @property - def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + 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")) + rm(self, "*.pdb", os.path.join(self.package_folder, "lib"), recursive=True) def package_info(self): - self.cpp_info.set_property("cmake_file_name", "libtins") - self.cpp_info.set_property("cmake_target_name", "libtins") - self.cpp_info.set_property("pkg_config_name", "libtins") self.cpp_info.libs = ["tins"] + self.cpp_info.set_property("pkg_config_name", "libtins") + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") + if self.settings.os == "Windows" and not self.options.shared: self.cpp_info.defines.append("TINS_STATIC") self.cpp_info.system_libs.extend(["ws2_32", "iphlpapi"]) - - # 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/libtins/all/test_package/CMakeLists.txt b/recipes/libtins/all/test_package/CMakeLists.txt index e785b2b7bd437..9df74f0fcf532 100644 --- a/recipes/libtins/all/test_package/CMakeLists.txt +++ b/recipes/libtins/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.15) +project(test_package LANGUAGES CXX) find_package(libtins REQUIRED CONFIG) -add_executable(test_package test_package.cpp) -target_link_libraries(test_package libtins) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE libtins::libtins) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/libtins/all/test_package/conanfile.py b/recipes/libtins/all/test_package/conanfile.py index a4f1e01b10ec3..ef5d7042163ec 100644 --- a/recipes/libtins/all/test_package/conanfile.py +++ b/recipes/libtins/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import tools, ConanFile, CMake +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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libtins/all/test_package/test_package.cpp b/recipes/libtins/all/test_package/test_package.cpp index 54d999bafa1ac..7f4d391a27813 100644 --- a/recipes/libtins/all/test_package/test_package.cpp +++ b/recipes/libtins/all/test_package/test_package.cpp @@ -6,5 +6,5 @@ int main() { SnifferConfiguration config; config.set_filter("port 80"); config.set_promisc_mode(true); - config.set_snap_len(400); + config.set_snap_len(50); } diff --git a/recipes/libtins/config.yml b/recipes/libtins/config.yml index ce55c187fafe1..a962f30c14fe9 100644 --- a/recipes/libtins/config.yml +++ b/recipes/libtins/config.yml @@ -1,4 +1,6 @@ versions: + "4.5": + folder: all "4.4": folder: all "4.3": 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..ff73256ddebc0 100644 --- a/recipes/libtool/all/conanfile.py +++ b/recipes/libtool/all/conanfile.py @@ -1,21 +1,29 @@ -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, VirtualBuildEnv, VirtualRunEnv +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.60.0 <2 || >=2.0.5" 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 +34,12 @@ class LibtoolConan(ConanFile): "fPIC": True, } - exports_sources = "patches/**" - _autotools = None - @property - def _source_subfolder(self): - return "source_subfolder" + def _has_dual_profiles(self): + return hasattr(self, "settings_build") 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 +47,107 @@ 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") + if self._has_dual_profiles: + self.tool_requires("automake/") + 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], 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): + VirtualBuildEnv(self).generate() + if not self._has_dual_profiles: + VirtualRunEnv(self).generate(scope="build") + + 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 +158,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 +181,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 +202,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 +231,15 @@ def package_info(self): if self.settings.os == "Linux": self.cpp_info.system_libs = ["dl"] - bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH env: {}".format(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 + # Define environment variables such that libtool m4 files are seen by Automake + libtool_aclocal_dir = os.path.join(self._datarootdir, "aclocal") - 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.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) - 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) + # For Conan 1.x downstream consumers, can be removed once recipe is Conan 1.x only: + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) + 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)) 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..f3e1e6a5c8ef1 100644 --- a/recipes/libtorrent/all/conandata.yml +++ b/recipes/libtorrent/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "2.0.10": + url: "https://github.com/arvidn/libtorrent/releases/download/v2.0.10/libtorrent-rasterbar-2.0.10.tar.gz" + sha256: "fc935b8c1daca5c0a4d304bff59e64e532be16bb877c012aea4bda73d9ca885d" + "2.0.9": + url: "https://github.com/arvidn/libtorrent/releases/download/v2.0.9/libtorrent-rasterbar-2.0.9.tar.gz" + sha256: "90cd92b6061c5b664840c3d5e151d43fedb24f5b2b24e14425ffbb884ef1798e" + "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 +15,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..35190c929ad49 100644 --- a/recipes/libtorrent/all/conanfile.py +++ b/recipes/libtorrent/all/conanfile.py @@ -1,9 +1,14 @@ -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.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, rmdir, replace_in_file +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.53.0" class LibtorrentConan(ConanFile): @@ -12,11 +17,12 @@ class LibtorrentConan(ConanFile): "libtorrent is a feature complete C++ bittorrent implementation " "focusing on efficiency and scalability" ) - topics = ("libtorrent", "p2p", "network", "mesh") + topics = ("p2p", "network", "mesh") url = "https://github.com/conan-io/conan-center-index" homepage = "http://libtorrent.org" license = ("BSD-3-clause", "ZLIB", "BSL-1.0") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -45,21 +51,24 @@ class LibtorrentConan(ConanFile): "enable_mutable_torrents": True, } - generators = "cmake" - _cmake = None - @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return "11" if Version(self.version) < "2.0.0" else "14" @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] + def _compilers_minimum_version(self): + return { + "14": { + "Visual Studio": "15", + "msvc": "191", + "gcc": "5" if Version(self.version) < "2.0.8" else "6", + "clang": "5", + "apple-clang": "5", + }, + }.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": @@ -67,104 +76,100 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - - def _check_compiler_supports_cxx14(self): - min_compiler_version = { - "Visual Studio": "15", - "gcc": "5", - "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: - raise ConanInvalidConfiguration("This compiler (version) does not support c++ 14.") - return True, None + self.options.rm_safe("fPIC") - def validate(self): - if tools.Version(self.version) < "2.0": - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) - else: - self._check_compiler_supports_cxx14() - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 14) + def layout(self): + cmake_layout(self, src_folder="src") 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 Version(self.version) >= "2.0.7": + self.requires("boost/1.81.0", transitive_headers=True) else: - self.requires("boost/1.76.0") + self.requires("boost/1.76.0", transitive_headers=True) if self.options.enable_encryption: - self.requires("openssl/1.1.1q") + self.requires("openssl/[>=1.1 <4]", transitive_headers=True, transitive_libs=True) 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 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." + ) + + 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 build_requirements(self): + if Version(self.version) >= "2.0.4": + self.tool_requires("cmake/[>=3.16 <4]") 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): + env = VirtualBuildEnv(self) + env.generate() + + tc = CMakeToolchain(self) + tc.variables["Boost_USE_STATIC_LIBS"] = not self.dependencies["boost"].options.get_safe("shared", False) + 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") @@ -175,16 +180,16 @@ def package_info(self): self.cpp_info.components["libtorrent-rasterbar"].includedirs = ["include", os.path.join("include", "libtorrent")] self.cpp_info.components["libtorrent-rasterbar"].libs = ["torrent-rasterbar"] - self.cpp_info.components["libtorrent-rasterbar"].requires = ["boost::boost"] + self.cpp_info.components["libtorrent-rasterbar"].requires = ["boost::headers", "boost::system"] if self.options.enable_encryption: self.cpp_info.components["libtorrent-rasterbar"].requires.append("openssl::openssl") if self.options.enable_iconv: self.cpp_info.components["libtorrent-rasterbar"].requires.append("libiconv::libiconv") if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.components["libtorrent-rasterbar"].system_libs = ["dl", "pthread"] + self.cpp_info.components["libtorrent-rasterbar"].system_libs = ["dl", "pthread", "m"] elif self.settings.os == "Windows": - self.cpp_info.components["libtorrent-rasterbar"].system_libs = ["wsock32", "ws2_32", "iphlpapi", "dbghelp"] + self.cpp_info.components["libtorrent-rasterbar"].system_libs = ["wsock32", "ws2_32", "iphlpapi", "dbghelp", "mswsock"] elif self.settings.os == "Macos": self.cpp_info.components["libtorrent-rasterbar"].frameworks = ["CoreFoundation", "SystemConfiguration"] 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..debcafe432f02 100644 --- a/recipes/libtorrent/config.yml +++ b/recipes/libtorrent/config.yml @@ -1,4 +1,10 @@ versions: + "2.0.10": + folder: "all" + "2.0.9": + folder: "all" + "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..656cf543d7403 100644 --- a/recipes/libucl/all/conandata.yml +++ b/recipes/libucl/all/conandata.yml @@ -1,12 +1,54 @@ sources: + "0.9.0": + url: "https://github.com/vstakhov/libucl/archive/refs/tags/0.9.0.tar.gz" + sha256: "87b233048bca7d307b14cffb882d3c198dc3fff96b19e0c3515428f027b3ebfe" + "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.9.0": + - 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.9.0-cmake-add-install+use-find_package.patch" + patch_description: "improve installation, use cci package" + patch_type: "conan" + - patch_file: "patches/0006-0.9.0-remove-glib-types.patch" + patch_description: "remove glib types, use char and size_t instead." + patch_type: "portability" + patch_source: "https://github.com/vstakhov/libucl/pull/283" + "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..30bc268f05071 100644 --- a/recipes/libucl/all/conanfile.py +++ b/recipes/libucl/all/conanfile.py @@ -1,17 +1,19 @@ -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 +from conan.tools.scm import Version +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 +29,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 +38,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.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.78.0 <9]") if self.options.enable_url_sign: - self.requires("openssl/1.1.1q") + self.requires("openssl/[>=1.1 <4]") if self.options.with_lua == "lua": - self.requires("lua/5.4.4") + self.requires("lua/5.4.6") 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" + + if Version(self.version) >= "0.9.0" and self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") 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/0002-0.9.0-cmake-add-install+use-find_package.patch b/recipes/libucl/all/patches/0002-0.9.0-cmake-add-install+use-find_package.patch new file mode 100644 index 0000000000000..139c3e606a3ba --- /dev/null +++ b/recipes/libucl/all/patches/0002-0.9.0-cmake-add-install+use-find_package.patch @@ -0,0 +1,119 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 1e23994..c67a5b8 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -5,12 +5,15 @@ SET(LIBUCL_VERSION_MAJOR 0) + SET(LIBUCL_VERSION_MINOR 9) + 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(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,8 +278,11 @@ ENDIF(UNIX) + SET_TARGET_PROPERTIES(ucl PROPERTIES + PUBLIC_HEADER "${UCLHDR}") + +-INSTALL(TARGETS ucl EXPORT uclConfig DESTINATION ${CMAKE_INSTALL_LIBDIR} +- PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) ++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") + ADD_SUBDIRECTORY(utils) 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/patches/0006-0.9.0-remove-glib-types.patch b/recipes/libucl/all/patches/0006-0.9.0-remove-glib-types.patch new file mode 100644 index 0000000000000..f63df8c3abd20 --- /dev/null +++ b/recipes/libucl/all/patches/0006-0.9.0-remove-glib-types.patch @@ -0,0 +1,32 @@ +diff --git a/lua/lua_ucl.c b/lua/lua_ucl.c +index c2e39c4..d6be69e 100644 +--- a/lua/lua_ucl.c ++++ b/lua/lua_ucl.c +@@ -406,7 +406,6 @@ ucl_object_lua_fromtable (lua_State *L, int idx, ucl_string_flags_t flags) + + /* Table iterate */ + if (is_array) { +- int i; + + if (!is_implicit) { + top = ucl_object_typed_new (UCL_ARRAY); +@@ -416,7 +415,7 @@ ucl_object_lua_fromtable (lua_State *L, int idx, ucl_string_flags_t flags) + top = NULL; + } + +- for (i = 1; i <= max; i ++) { ++ for (size_t i = 1; i <= max; i ++) { + lua_pushinteger (L, i); + lua_gettable (L, idx); + +@@ -886,8 +885,8 @@ lua_ucl_parser_parse_text (lua_State *L) + t = lua_touserdata (L, 2); + } + else if (lua_type (L, 2) == LUA_TSTRING) { +- const gchar *s; +- gsize len; ++ const char *s; ++ size_t len; + static struct _rspamd_lua_text st_t; + + s = lua_tolstring (L, 2, &len); 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..fa8c302279f91 100644 --- a/recipes/libucl/config.yml +++ b/recipes/libucl/config.yml @@ -1,3 +1,7 @@ versions: + "0.9.0": + folder: all + "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 bb1bde611d37b..0a4056812ce72 100644 --- a/recipes/libudev/all/conanfile.py +++ b/recipes/libudev/all/conanfile.py @@ -1,9 +1,9 @@ from conan import ConanFile -from conan.errors import ConanException, ConanInvalidConfiguration +from conan.errors import ConanInvalidConfiguration from conan.tools.system import package_manager -from conans import tools +from conan.tools.gnu import PkgConfig -required_conan_version = ">=1.47" +required_conan_version = ">=1.50.0" class LibUDEVConan(ConanFile): @@ -14,34 +14,18 @@ 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" + package_type = "shared-library" settings = "os", "arch", "compiler", "build_type" + def layout(self): + pass + 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): dnf = package_manager.Dnf(self) @@ -57,9 +41,14 @@ def system_requirements(self): pacman.install(["systemd-libs"], update=True, check=True) zypper = package_manager.Zypper(self) - zypper.install(["libudev-devel"], update=True, check=True) + zypper.install_substitutes(["libudev-devel"], ["systemd-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) + self.cpp_info.set_property("system_package_version", str(pkg_config.version)) + + # todo Remove this workaround for Conan v1 + self.cpp_info.set_property("component_version", str(pkg_config.version)) 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/libunifex/all/CMakeLists.txt b/recipes/libunifex/all/CMakeLists.txt deleted file mode 100644 index 4beb13671fe5e..0000000000000 --- a/recipes/libunifex/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8) -project(cmake_wrapper) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/libunifex/all/conandata.yml b/recipes/libunifex/all/conandata.yml index 2eaea0e7a17a7..f0f7328af9c2a 100644 --- a/recipes/libunifex/all/conandata.yml +++ b/recipes/libunifex/all/conandata.yml @@ -1,4 +1,4 @@ sources: - "cci.20220430": - url: "https://github.com/facebookexperimental/libunifex/archive/c359fd8e7d97d91359cf4a6c1dbef99b0b1767b6.tar.gz" - sha256: "c306891967fa4cc1a22f3401581d35ceea41eb1dbdac3e6157ecf3defaa4b15d" + "0.4.0": + url: "https://github.com/facebookexperimental/libunifex/archive/refs/tags/v0.4.0.tar.gz" + sha256: "d5ce3b616e166da31e6b4284764a1feeba52aade868bcbffa94cfd86b402716e" diff --git a/recipes/libunifex/all/conanfile.py b/recipes/libunifex/all/conanfile.py index 49d7f959dc539..4bcd35d16f99c 100644 --- a/recipes/libunifex/all/conanfile.py +++ b/recipes/libunifex/all/conanfile.py @@ -1,110 +1,143 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -import functools 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, valid_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, rmdir, replace_in_file, export_conandata_patches, apply_conandata_patches +from conan.tools.microsoft import is_msvc + +required_conan_version = ">=1.52.0" class LibunifexConan(ConanFile): name = "libunifex" + description = "A prototype implementation of the C++ sender/receiver async programming model" license = ("Apache-2.0", "LLVM-exception") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/facebookexperimental/libunifex" - description = "A prototype implementation of the C++ sender/receiver async programming model" topics = ("async", "cpp") + package_type = "static-library" settings = "os", "arch", "compiler", "build_type" - - generators = "cmake", "cmake_find_package_multi" - no_copy_source = True - exports_sources = ["CMakeLists.txt"] + options = { + "fPIC": [True, False], + "with_liburing": [True, False], + } + default_options = { + "fPIC": True, + "with_liburing": False, # Enabled by default in the project, but incompatible with the Linux version used in C3I + } @property - def _source_subfolder(self): - return "source_subfolder" + def _minimum_standard(self): + if is_msvc(self): + # Otherwise a forward declaration `extern const _schedule::_fn schedule;` + # conflicts with the implementation `inline constexpr _schedule::_fn schedule {};` + # https://github.com/facebookexperimental/libunifex/issues/591 + return 20 + return 17 @property def _compilers_minimum_version(self): return { "gcc": "9", - "Visual Studio": "16", "clang": "10", "apple-clang": "11", + "Visual Studio": "17", + "msvc": "193", } - @property - def _minimum_standard(self): - return "17" + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + if not self.settings.os == "Linux": + del self.options.with_liburing + + def layout(self): + cmake_layout(self, src_folder="src") - # FIXME: Add support for liburing - # def requirements(self): - # TODO: Make an option to opt-out of liburing for old kernel versions - # if self.settings.os == "Linux": - # self.requires("liburing/2.1") + def requirements(self): + if self.options.get_safe("with_liburing"): + self.requires("liburing/2.4", transitive_headers=True, transitive_libs=True) def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd( - self, self._minimum_standard) + check_min_cppstd(self, self._minimum_standard) 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( - "{0} {1} requires C++{2}. Your compiler is unknown. Assuming it supports C++{2}." - .format(self.name, self.version, self._minimum_standard)) - elif lazy_lt_semver(str(self.settings.compiler.version), minimum_version): + return all(int(p1) < int(p2) for p1, p2 in zip(str(v1).split("."), str(v2).split("."))) + + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and lazy_lt_semver(self.settings.compiler.version, minimum_version): raise ConanInvalidConfiguration( - "{} {} requires C++{}, which your compiler does not support." - .format(self.name, self.version, self._minimum_standard)) + f"{self.ref} requires C++{self._minimum_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], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTING"] = False + tc.variables["UNIFEX_BUILD_EXAMPLES"] = False + tc.variables["UNIFEX_NO_LIBURING"] = not self.options.get_safe("with_liburing", False) + if not valid_min_cppstd(self, self._minimum_standard): + tc.variables["CMAKE_CXX_STANDARD"] = self._minimum_standard + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() + deps = CMakeDeps(self) + deps.set_property("liburing", "cmake_file_name", "LIBURING") + deps.generate() - @functools.lru_cache(1) - def _configure_cmake(self): + def build(self): + self._patch_sources() cmake = CMake(self) - cmake.definitions["BUILD_TESTING"] = "OFF" cmake.configure() - return cmake - - def build(self): - cmake = self._configure_cmake() cmake.build() + def _patch_sources(self): + apply_conandata_patches(self) + # Ensure liburing from the system is not used and that uuper-case variables are generated + required = "REQUIRED" if self.settings.os == "Linux" else "" + replace_in_file(self, os.path.join(self.source_folder, "cmake", "unifex_flags.cmake"), + "find_package(LibUring COMPONENTS)", + f"find_package(LIBURING {required} CONFIG NO_DEFAULT_PATH PATHS ${{CMAKE_PREFIX_PATH}})") + replace_in_file(self, os.path.join(self.source_folder, "cmake", "unifex_env.cmake"), "-Werror", "") + replace_in_file(self, os.path.join(self.source_folder, "cmake", "unifex_env.cmake"), "/WX", "") + # Allow cppstd to be overridden + replace_in_file(self, os.path.join(self.source_folder, "source", "CMakeLists.txt"), + "target_compile_features(unifex PUBLIC cxx_std_17)", "") + 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")) - 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.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.set_property("cmake_file_name", "unifex") self.cpp_info.set_property("cmake_target_name", "unifex::unifex") self.cpp_info.set_property("pkg_config_name", "unifex") + self.cpp_info.components["unifex"].libs = ["unifex"] + self.cpp_info.components["unifex"].set_property("cmake_target_name", "unifex::unifex") + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["unifex"].system_libs = ["pthread"] + if self.options.get_safe("with_liburing"): + self.cpp_info.components["unifex"].requires.append("liburing::liburing") + # TODO: to remove in conan v2 once cmake_find_package_* generators removed - self.cpp_info.filenames["cmake_find_package"] = "unifex" - self.cpp_info.filenames["cmake_find_package_multi"] = "unifex" self.cpp_info.names["cmake_find_package"] = "unifex" self.cpp_info.names["cmake_find_package_multi"] = "unifex" - self.cpp_info.names["pkg_config"] = "unifex" self.cpp_info.components["unifex"].names["cmake_find_package"] = "unifex" self.cpp_info.components["unifex"].names["cmake_find_package_multi"] = "unifex" - self.cpp_info.components["unifex"].set_property( - "cmake_target_name", "unifex::unifex") - self.cpp_info.components["unifex"].libs = ["unifex"] - - if self.settings.os == "Linux": - self.cpp_info.components["unifex"].system_libs = ["pthread"] - # self.cpp_info.components["unifex"].requires.append( - # "liburing::liburing") diff --git a/recipes/libunifex/all/test_package/CMakeLists.txt b/recipes/libunifex/all/test_package/CMakeLists.txt index a487dfdf2b7ad..7c04e7b0b4280 100644 --- a/recipes/libunifex/all/test_package/CMakeLists.txt +++ b/recipes/libunifex/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.15) +project(test_package LANGUAGES CXX) find_package(unifex REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE unifex::unifex) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17) +if(MSVC) + set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 20) +else() + set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17) +endif() diff --git a/recipes/libunifex/all/test_package/conanfile.py b/recipes/libunifex/all/test_package/conanfile.py index 38f4483872d47..ef5d7042163ec 100644 --- a/recipes/libunifex/all/test_package/conanfile.py +++ b/recipes/libunifex/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libunifex/all/test_v1_package/CMakeLists.txt b/recipes/libunifex/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/libunifex/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/libunifex/all/test_v1_package/conanfile.py b/recipes/libunifex/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libunifex/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/libunifex/config.yml b/recipes/libunifex/config.yml index 1bf3ed95d8368..af29e78bd9b25 100644 --- a/recipes/libunifex/config.yml +++ b/recipes/libunifex/config.yml @@ -1,3 +1,3 @@ versions: - "cci.20220430": - folder: "all" + "0.4.0": + folder: all diff --git a/recipes/libunistring/all/conandata.yml b/recipes/libunistring/all/conandata.yml index c22acd0ca0e42..60207a8f26db0 100644 --- a/recipes/libunistring/all/conandata.yml +++ b/recipes/libunistring/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.1": + url: "https://ftp.gnu.org/gnu/libunistring/libunistring-1.1.tar.xz" + sha256: "827c1eb9cb6e7c738b171745dac0888aa58c5924df2e59239318383de0729b98" "0.9.10": - url: "https://ftp.gnu.org/gnu/libunistring/libunistring-0.9.10.tar.gz" - sha256: "a82e5b333339a88ea4608e4635479a1cfb2e01aafb925e1290b65710d43f610b" + url: "https://ftp.gnu.org/gnu/libunistring/libunistring-0.9.10.tar.xz" + sha256: "eb8fb2c3e4b6e2d336608377050892b54c3c983b646c561836550863003c05d7" diff --git a/recipes/libunistring/config.yml b/recipes/libunistring/config.yml index b2646e05f90e5..1418b6cb6cc09 100644 --- a/recipes/libunistring/config.yml +++ b/recipes/libunistring/config.yml @@ -1,3 +1,5 @@ versions: + "1.1": + folder: all "0.9.10": folder: all diff --git a/recipes/libunwind/all/conandata.yml b/recipes/libunwind/all/conandata.yml index 3379c640096e5..efd030d0bf16c 100644 --- a/recipes/libunwind/all/conandata.yml +++ b/recipes/libunwind/all/conandata.yml @@ -1,4 +1,16 @@ sources: + "1.8.1": + url: "https://github.com/libunwind/libunwind/releases/download/v1.8.1/libunwind-1.8.1.tar.gz" + sha256: "ddf0e32dd5fafe5283198d37e4bf9decf7ba1770b6e7e006c33e6df79e6a6157" + "1.8.0": + url: "https://github.com/libunwind/libunwind/releases/download/v1.8.0/libunwind-1.8.0.tar.gz" + sha256: "b6b3df40a0970c8f2865fb39aa2af7b5d6f12ad6c5774e266ccca4d6b8b72268" + "1.7.2": + url: "https://github.com/libunwind/libunwind/releases/download/v1.7.2/libunwind-1.7.2.tar.gz" + sha256: "a18a6a24307443a8ace7a8acc2ce79fbbe6826cd0edf98d6326d0225d6a5d6e6" + "1.7.0": + url: "https://github.com/libunwind/libunwind/releases/download/v1.7.0/libunwind-1.70.tar.gz" + sha256: "c24c913d2337d6eff851b6ab32aadfb683a86fee48d28fe1fc9cd56c8e9dfa58" "1.6.2": url: "https://github.com/libunwind/libunwind/releases/download/v1.6.2/libunwind-1.6.2.tar.gz" sha256: "4a6aec666991fb45d0889c44aede8ad6eb108071c3554fcdff671f9c94794976" diff --git a/recipes/libunwind/all/conanfile.py b/recipes/libunwind/all/conanfile.py index ffee26f9f1853..d96b4cec23a07 100644 --- a/recipes/libunwind/all/conanfile.py +++ b/recipes/libunwind/all/conanfile.py @@ -2,7 +2,14 @@ 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.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 @@ -11,6 +18,7 @@ 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." @@ -18,6 +26,7 @@ class LiunwindConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/libunwind/libunwind" topics = ("unwind", "debuggers", "exception-handling", "introspection", "setjmp") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -52,16 +61,18 @@ def layout(self): def requirements(self): if self.options.minidebuginfo: - self.requires("xz_utils/5.2.5") + self.requires("xz_utils/5.4.5") if self.options.zlibdebuginfo: - self.requires("zlib/1.2.13") + self.requires("zlib/[>=1.2.11 <2]") def validate(self): - if self.info.settings.os not in ["Linux", "FreeBSD"]: - raise ConanInvalidConfiguration("libunwind is only supported on Linux and FreeBSD") + if self.settings.os not in ["Linux", "FreeBSD"]: + raise ConanInvalidConfiguration( + "libunwind is only supported on Linux and FreeBSD" + ) 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 cross_building(self): @@ -70,15 +81,17 @@ def generate(self): 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.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) @@ -91,7 +104,12 @@ def build(self): autotools.make() def package(self): - copy(self, pattern="COPYING", 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"), + ) autotools = Autotools(self) autotools.install() rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) @@ -101,13 +119,15 @@ def package(self): # 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) + 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") @@ -115,18 +135,26 @@ 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/config.yml b/recipes/libunwind/config.yml index 26cf6b32aa2bf..2132c142d0b3f 100644 --- a/recipes/libunwind/config.yml +++ b/recipes/libunwind/config.yml @@ -1,4 +1,12 @@ versions: + "1.8.1": + folder: all + "1.8.0": + folder: all + "1.7.2": + folder: all + "1.7.0": + folder: all "1.6.2": folder: all "1.5.0": diff --git a/recipes/liburing/all/conandata.yml b/recipes/liburing/all/conandata.yml index ca85945754398..903fcbb9911ba 100644 --- a/recipes/liburing/all/conandata.yml +++ b/recipes/liburing/all/conandata.yml @@ -1,4 +1,22 @@ sources: + "2.8": + url: "https://github.com/axboe/liburing/archive/liburing-2.8.tar.gz" + sha256: "3ed7891d1b2bbe743ef3fb6d0a4970e630aa02d7c7bd3b0212791fb7be815984" + "2.7": + url: "https://github.com/axboe/liburing/archive/liburing-2.7.tar.gz" + sha256: "56202ad443c50e684dde3692819be3b91bbe003e1c14bf5abfa11973669978c1" + "2.6": + url: "https://github.com/axboe/liburing/archive/liburing-2.6.tar.gz" + sha256: "682f06733e6db6402c1f904cbbe12b94942a49effc872c9e01db3d7b180917cc" + "2.5": + url: "https://github.com/axboe/liburing/archive/liburing-2.5.tar.gz" + sha256: "456f5f882165630f0dc7b75e8fd53bd01a955d5d4720729b4323097e6e9f2a98" + "2.4": + url: "https://github.com/axboe/liburing/archive/liburing-2.4.tar.gz" + sha256: "2398ec82d967a6f903f3ae1fd4541c754472d3a85a584dc78c5da2fabc90706b" + "2.3": + url: "https://github.com/axboe/liburing/archive/liburing-2.3.tar.gz" + sha256: "60b367dbdc6f2b0418a6e0cd203ee0049d9d629a36706fcf91dfb9428bae23c8" "2.2": url: "https://github.com/axboe/liburing/archive/liburing-2.2.tar.gz" sha256: "e092624af6aa244ade2d52181cc07751ac5caba2f3d63e9240790db9ed130bbc" @@ -11,8 +29,45 @@ sources: "0.7": url: "https://github.com/axboe/liburing/archive/liburing-0.7.tar.gz" sha256: "8e2842cfe947f3a443af301bdd6d034455536c38a455c7a700d0c1ad165a7543" - patches: + "2.8": + - patch_file: "patches/liburing-2.4-disable_samples_and_tests.patch" + patch_description: "Disable tests and samples as it might not work while cross-compiling" + patch_type: "conan" + "2.7": + - patch_file: "patches/liburing-2.4-disable_samples_and_tests.patch" + patch_description: "Disable tests and samples as it might not work while cross-compiling" + patch_type: "conan" + "2.6": + - patch_file: "patches/liburing-2.4-disable_samples_and_tests.patch" + patch_description: "Disable tests and samples as it might not work while cross-compiling" + patch_type: "conan" + "2.5": + - patch_file: "patches/liburing-2.4-disable_samples_and_tests.patch" + patch_description: "Disable tests and samples as it might not work while cross-compiling" + patch_type: "conan" + "2.4": + - patch_file: "patches/liburing-2.4-disable_samples_and_tests.patch" + patch_description: "Disable tests and samples as it might not work while cross-compiling" + patch_type: "conan" + "2.3": + - patch_file: "patches/liburing-2.2-disable_samples_and_tests.patch" + patch_description: "Disable tests and samples as it might not work while cross-compiling" + patch_type: "conan" + "2.2": + - patch_file: "patches/liburing-2.2-disable_samples_and_tests.patch" + patch_description: "Disable tests and samples as it might not work while cross-compiling" + patch_type: "conan" "2.1": - - base_path: "source_subfolder" - patch_file: "patches/0001-liburing-2.1-memfd-create.patch" + - patch_file: "patches/0001-liburing-2.1-memfd-create.patch" + - patch_file: "patches/liburing-2.0-disable_samples_and_tests.patch" + patch_description: "Disable tests and samples as it might not work while cross-compiling" + patch_type: "conan" + "2.0": + - patch_file: "patches/liburing-2.0-disable_samples_and_tests.patch" + patch_description: "Disable tests and samples as it might not work while cross-compiling" + patch_type: "conan" + "0.7": + - patch_file: "patches/liburing-0.7-disable_samples_and_tests.patch" + patch_description: "Disable tests and samples as it might not work while cross-compiling" + patch_type: "conan" diff --git a/recipes/liburing/all/conanfile.py b/recipes/liburing/all/conanfile.py index 9035e2b799208..d9633472c289d 100644 --- a/recipes/liburing/all/conanfile.py +++ b/recipes/liburing/all/conanfile.py @@ -1,23 +1,24 @@ -from conans import AutoToolsBuildEnvironment from conan import ConanFile -from conan.tools.files import get, patch, chdir, rmdir, copy +from conan.tools.files import get, rmdir, copy, apply_conandata_patches, chdir, export_conandata_patches, rm from conan.tools.scm import Version +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout from conan.errors import ConanInvalidConfiguration import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.54.0" -class LiburingConan(ConanFile): +class Liburing(ConanFile): name = "liburing" - license = "GPL-2.0-or-later" - homepage = "https://github.com/axboe/liburing" - url = "https://github.com/conan-io/conan-center-index" description = ("helpers to setup and teardown io_uring instances, and also a simplified interface for " "applications that don't need (or want) to deal with the full kernel side implementation.") + license = ("GPL-2.0-or-later", "MIT", "LGPL-2.1-or-later") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/axboe/liburing" topics = ("asynchronous-io", "async", "kernel") - settings = "os", "arch", "compiler", "build_type" + package_type = "library" options = { "fPIC": [True, False], "shared": [True, False], @@ -29,13 +30,12 @@ class LiburingConan(ConanFile): "with_libc": True, } - exports_sources = ["patches/*"] - - _autotools = None + def export_sources(self): + export_conandata_patches(self) - @property - def _source_subfolder(self): - return "source_subfolder" + def requirements(self): + if Version(self.version) < "2.3": + self.requires("linux-headers-generic/5.13.9") def config_options(self): if self.settings.os == "Windows": @@ -45,64 +45,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 - - def requirements(self): - self.requires("linux-headers-generic/5.13.9") + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") def validate(self): # FIXME: use kernel version of build/host machine. # kernel version should be encoded in profile if self.settings.os != "Linux": - raise ConanInvalidConfiguration( - "liburing is supported only on linux") + raise ConanInvalidConfiguration(f"{self.ref} is supported only on linux") - def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + def layout(self): + basic_layout(self, src_folder='src') - def _configure_autotools(self): - if self._autotools: - return self._autotools - - self._autotools = AutoToolsBuildEnvironment(self) - args = [] - if self.options.get_safe("with_libc") == False: - args.append("--nolibc") - self._autotools.configure(args=args) - self._autotools.flags.append("-std=gnu99") - return self._autotools - - def _patch_sources(self): - for data in self.conan_data.get("patches", {}).get(self.version, []): - patch(self, **data) + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = AutotoolsToolchain(self) + + if Version(self.version) >= "2.5": + if self.options.with_libc: + tc.configure_args.append("--use-libc") + elif Version(self.version) >= "2.2": + if not self.options.with_libc: + tc.configure_args.append("--nolibc") + + tc.update_configure_args({ + "--host": None, + "--build": None, + "--enable-shared": None, + "--disable-shared": None, + "--enable-static": None, + "--disable-static": None, + "--bindir": None, + "--sbindir": None, + "--oldincludedir": None, + "--libdevdir": "${prefix}/lib", # pointing to libdir + }) + tc.generate() def build(self): - self._patch_sources() - with chdir(self, self._source_subfolder): - autotools = self._configure_autotools() - autotools.make() + apply_conandata_patches(self) + with chdir(self, self.source_folder): + at = Autotools(self) + at.configure() + at.make(target="src") def package(self): - copy(self, "COPYING*", src=self._source_subfolder, dst=os.path.join(self.package_folder, "licenses")) - copy(self, "LICENSE", src=self._source_subfolder, dst=os.path.join(self.package_folder, "licenses")) + 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")) - with chdir(self, self._source_subfolder): - autotools = self._configure_autotools() - install_args = [ - "ENABLE_SHARED={}".format(1 if self.options.shared else 0) - ] - autotools.install(args=install_args) + with chdir(self, self.source_folder): + at = Autotools(self) + at.install( + args=[f"ENABLE_SHARED={1 if self.options.shared else 0}"] + ) rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) rmdir(self, os.path.join(self.package_folder, "man")) if self.options.shared: - os.remove(os.path.join(self.package_folder, "lib", "liburing.a")) + rm(self, "*.a", os.path.join(self.package_folder, "lib")) def package_info(self): - self.cpp_info.names["pkg_config"] = "liburing" + self.cpp_info.set_property("pkg_config_name", "liburing") self.cpp_info.libs = ["uring"] diff --git a/recipes/liburing/all/patches/liburing-0.7-disable_samples_and_tests.patch b/recipes/liburing/all/patches/liburing-0.7-disable_samples_and_tests.patch new file mode 100644 index 0000000000000..dc56cd825cb84 --- /dev/null +++ b/recipes/liburing/all/patches/liburing-0.7-disable_samples_and_tests.patch @@ -0,0 +1,13 @@ +diff --git a/Makefile b/Makefile +index 948e004..d4cff97 100644 +--- a/Makefile ++++ b/Makefile +@@ -10,8 +10,6 @@ default: all + + all: + @$(MAKE) -C src +- @$(MAKE) -C test +- @$(MAKE) -C examples + + partcheck: all + @echo "make partcheck => TODO add tests with out kernel support" diff --git a/recipes/liburing/all/patches/liburing-2.0-disable_samples_and_tests.patch b/recipes/liburing/all/patches/liburing-2.0-disable_samples_and_tests.patch new file mode 100644 index 0000000000000..4f4983d0c9070 --- /dev/null +++ b/recipes/liburing/all/patches/liburing-2.0-disable_samples_and_tests.patch @@ -0,0 +1,13 @@ +diff --git a/Makefile b/Makefile +index 5d9c4dc..66ee81e 100644 +--- a/Makefile ++++ b/Makefile +@@ -10,8 +10,6 @@ default: all + + all: + @$(MAKE) -C src +- @$(MAKE) -C test +- @$(MAKE) -C examples + + .PHONY: all install default clean test + .PHONY: FORCE cscope diff --git a/recipes/liburing/all/patches/liburing-2.2-disable_samples_and_tests.patch b/recipes/liburing/all/patches/liburing-2.2-disable_samples_and_tests.patch new file mode 100644 index 0000000000000..7faef951af755 --- /dev/null +++ b/recipes/liburing/all/patches/liburing-2.2-disable_samples_and_tests.patch @@ -0,0 +1,13 @@ +diff --git a/Makefile b/Makefile +index 686be4f..28d0a7f 100644 +--- a/Makefile ++++ b/Makefile +@@ -8,8 +8,6 @@ default: all + + all: + @$(MAKE) -C src +- @$(MAKE) -C test +- @$(MAKE) -C examples + + .PHONY: all install default clean test + .PHONY: FORCE cscope diff --git a/recipes/liburing/all/patches/liburing-2.4-disable_samples_and_tests.patch b/recipes/liburing/all/patches/liburing-2.4-disable_samples_and_tests.patch new file mode 100644 index 0000000000000..beb6f175e2861 --- /dev/null +++ b/recipes/liburing/all/patches/liburing-2.4-disable_samples_and_tests.patch @@ -0,0 +1,12 @@ +diff --git a/Makefile b/Makefile +index 73d021c..74aa8d7 100644 +--- a/Makefile ++++ b/Makefile +@@ -8,6 +8,4 @@ default: all + + all: + @$(MAKE) -C src +- @$(MAKE) -C test +- @$(MAKE) -C examples + + \ No newline at end of file diff --git a/recipes/liburing/all/test_package/CMakeLists.txt b/recipes/liburing/all/test_package/CMakeLists.txt index b8135611cec52..7ccf5415cdb07 100644 --- a/recipes/liburing/all/test_package/CMakeLists.txt +++ b/recipes/liburing/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(liburing REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) diff --git a/recipes/liburing/all/test_package/conanfile.py b/recipes/liburing/all/test_package/conanfile.py index 6fbb963afebbd..ead8e42a0dc6d 100644 --- a/recipes/liburing/all/test_package/conanfile.py +++ b/recipes/liburing/all/test_package/conanfile.py @@ -1,6 +1,6 @@ -from conans import CMake 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 from conan.tools.scm import Version import platform import re @@ -9,7 +9,13 @@ 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 requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -23,6 +29,6 @@ def _sufficient_linux_kernel_version(self): return Version(linux_kernel_version) >= "5.1" def test(self): - if not cross_building(self) and self._sufficient_linux_kernel_version: - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self) and self._sufficient_linux_kernel_version: + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/liburing/all/test_v1_package/CMakeLists.txt b/recipes/liburing/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..de3b75d9538de --- /dev/null +++ b/recipes/liburing/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/liburing/all/test_v1_package/conanfile.py b/recipes/liburing/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..49a3a66ea5bad --- /dev/null +++ b/recipes/liburing/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/liburing/config.yml b/recipes/liburing/config.yml index 7c72c93d4edcd..a350e9cf0e598 100644 --- a/recipes/liburing/config.yml +++ b/recipes/liburing/config.yml @@ -1,4 +1,16 @@ versions: + "2.8": + folder: all + "2.7": + folder: all + "2.6": + folder: all + "2.5": + folder: all + "2.4": + folder: all + "2.3": + folder: all "2.2": folder: all "2.1": diff --git a/recipes/libusb-compat/all/CMakeLists.txt.in b/recipes/libusb-compat/all/CMakeLists.txt.in index 36dea026beea9..f7d86f158ac89 100644 --- a/recipes/libusb-compat/all/CMakeLists.txt.in +++ b/recipes/libusb-compat/all/CMakeLists.txt.in @@ -1,8 +1,7 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(cmake_wrapper) -include("${{CMAKE_BINARY_DIR}}/conanbuildinfo.cmake") -conan_basic_setup(TARGETS) +find_package(libusb REQUIRED CONFIG) # autotools project does not allow building a shared mpfr library (because of libtool limitation) @@ -14,10 +13,11 @@ if(BUILD_SHARED_LIBS) else() target_compile_definitions(usb PRIVATE LIBUSB_COMPAT_STATIC) endif() -target_link_libraries(usb PRIVATE $) +target_link_libraries(usb PRIVATE $) if(MSVC) + find_package(dirent REQUIRED CONFIG) target_compile_definitions(usb PRIVATE _CRT_SECURE_NO_WARNINGS) - target_link_libraries(usb PRIVATE CONAN_PKG::dirent) + target_link_libraries(usb PRIVATE dirent::dirent) endif() install(TARGETS usb diff --git a/recipes/libusb-compat/all/conandata.yml b/recipes/libusb-compat/all/conandata.yml index 8e55c99a4d6e0..3be5eb4b77caf 100644 --- a/recipes/libusb-compat/all/conandata.yml +++ b/recipes/libusb-compat/all/conandata.yml @@ -5,6 +5,4 @@ sources: patches: "0.1.7": - patch_file: "patches/0001-fix-autoconf-msvc-mingw.patch" - base_path: "source_subfolder" - patch_file: "patches/0002-fix-msvc-linkage-and-fix-msvc-vararg-macros.patch" - base_path: "source_subfolder" diff --git a/recipes/libusb-compat/all/conanfile.py b/recipes/libusb-compat/all/conanfile.py index 0319dc88794d1..a4a005540368d 100644 --- a/recipes/libusb-compat/all/conanfile.py +++ b/recipes/libusb-compat/all/conanfile.py @@ -1,23 +1,29 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, CMake, tools -from conans.errors import ConanException -from contextlib import contextmanager import os import re import shlex -import shutil -required_conan_version = ">=1.33.0" +from conan import ConanFile +from conan.errors import ConanException +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.env import Environment +from conan.tools.files import apply_conandata_patches, chdir, copy, export_conandata_patches, get, load, replace_in_file, rmdir, save +from conan.tools.gnu import Autotools, AutotoolsToolchain, PkgConfigDeps +from conan.tools.microsoft import is_msvc, unix_path + +required_conan_version = ">=1.53.0" class LibUSBCompatConan(ConanFile): name = "libusb-compat" description = "A compatibility layer allowing applications written for libusb-0.1 to work with libusb-1.0" license = ("LGPL-2.1", "BSD-3-Clause") - homepage = "https://github.com/libusb/libusb-compat-0.1" url = "https://github.com/conan-io/conan-center-index" - exports_sources = "patches/**", "CMakeLists.txt.in" - topics = ("conan", "libusb", "compatibility", "usb") - settings = "os", "compiler", "build_type", "arch" + homepage = "https://github.com/libusb/libusb-compat-0.1" + topics = ("libusb", "compatibility", "usb") + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -28,14 +34,14 @@ class LibUSBCompatConan(ConanFile): "fPIC": True, "enable_logging": False, } - generators = "cmake", "pkg_config" - - _autotools = None - _cmake = None @property - def _source_subfolder(self): - return "source_subfolder" + def _settings_build(self): + return self.settings_build if hasattr(self, "settings_build") else self.settings + + def export_sources(self): + export_conandata_patches(self) + copy(self, "CMakeLists.txt.in", src=self.recipe_folder, dst=self.export_sources_folder) def config_options(self): if self.settings.os == "Windows": @@ -43,44 +49,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.libcxx") + self.settings.rm_safe("compiler.cppstd") - def requirements(self): - self.requires("libusb/1.0.24") - if self.settings.compiler == "Visual Studio": - self.requires("dirent/1.23.2") + def layout(self): + cmake_layout(self, src_folder="src") - @property - def _settings_build(self): - return self.settings_build if hasattr(self, "settings_build") else self.settings + def requirements(self): + self.requires("libusb/1.0.26") + if is_msvc(self): + self.requires("dirent/1.24", transitive_headers=True, transitive_libs=True) def build_requirements(self): - self.build_requires("gnu-config/cci.20201022") - 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("gnu-config/cci.20210814") + 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/2.0.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 _iterate_lib_paths_win(self, lib): """Return all possible library paths for lib""" - for lib_path in self.deps_cpp_info.lib_paths: + libdirs = sum([dep.cpp_info.libdirs for dep in self.dependencies.values()], []) + for lib_path in libdirs: for prefix in "", "lib": for suffix in "", ".a", ".dll.a", ".lib", ".dll.lib": - fn = os.path.join(lib_path, "{}{}{}".format(prefix, lib, suffix)) + fn = os.path.join(lib_path, f"{prefix}{lib}{suffix}") if not fn.endswith(".a") and not fn.endswith(".lib"): continue yield fn @property def _absolute_dep_libs_win(self): + libs = sum([dep.cpp_info.libs for dep in self.dependencies.values()], []) absolute_libs = [] - for lib in self.deps_cpp_info.libs: + for lib in libs: for fn in self._iterate_lib_paths_win(lib): if not os.path.isfile(fn): continue @@ -88,122 +97,128 @@ def _absolute_dep_libs_win(self): break return absolute_libs - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.configure(source_dir=os.path.join(self._source_subfolder, "libusb")) - return self._cmake - - 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": + def generate(self): + tc = CMakeToolchain(self) + tc.generate() + tc = CMakeDeps(self) + tc.generate() + tc = PkgConfigDeps(self) + tc.generate() + + tc = AutotoolsToolchain(self) + if is_msvc(self): # Use absolute paths of the libraries instead of the library names only. # Otherwise, the configure script will say that the compiler not working # (because it interprets the libs as input source files) - self._autotools.libs = list(tools.unix_path(l) for l in self._absolute_dep_libs_win) + self.deps_cpp_info.system_libs - conf_args = [ + tc.libs = list(unix_path(self, l) for l in self._absolute_dep_libs_win) + tc.libs += sum([dep.cpp_info.system_libs for dep in self.dependencies.values()], []) + tc.configure_args += [ "--disable-examples-build", "--enable-log" if self.options.enable_logging else "--disable-log", ] - if self.options.shared: - conf_args.extend(["--enable-shared", "--disable-static"]) - else: - conf_args.extend(["--disable-shared", "--enable-static"]) - pkg_config_paths = [tools.unix_path(os.path.abspath(self.install_folder))] - self._autotools.configure(args=conf_args, configure_dir=self._source_subfolder, pkg_config_paths=pkg_config_paths) - return self._autotools - - @contextmanager - def _build_context(self): - if self.settings.compiler == "Visual Studio": - with tools.vcvars(self.settings): - 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", - "AR": "{} lib".format(tools.unix_path(self.deps_user_info["automake"].ar_lib)), - "DLLTOOL": ":", - "OBJDUMP": ":", - "RANLIB": ":", - "STRIP": ":", - } - with tools.environment_append(env): - yield - else: - yield + tc.generate() + + if is_msvc(self): + env = Environment() + 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 _extract_makefile_variable(self, makefile, variable): - makefile_contents = tools.load(makefile) - match = re.search("{}[ \t]*=[ \t]*((?:(?:[a-zA-Z0-9 \t.=/_-])|(?:\\\\\"))*(?:\\\\\n(?:(?:[a-zA-Z0-9 \t.=/_-])|(?:\\\"))*)*)\n".format(variable), makefile_contents) + makefile_contents = load(self, makefile) + match = re.search( + fr'^{variable}\s*=\s*((?:[\w \t.=/-]|\")*(?:\\\n(?:[\w \t.=/-]|\")*)*)$', + makefile_contents, + flags=re.MULTILINE, + ) if not match: - raise ConanException("Cannot extract variable {} from {}".format(variable, makefile_contents)) + raise ConanException(f"Cannot extract variable {variable} from {makefile_contents}") lines = [line.strip(" \t\\") for line in match.group(1).split()] return [item for line in lines for item in shlex.split(line) if item] def _extract_autotools_variables(self): - makefile = os.path.join(self._source_subfolder, "libusb", "Makefile.am") + makefile = os.path.join(self.source_folder, "libusb", "Makefile.am") sources = self._extract_makefile_variable(makefile, "libusb_la_SOURCES") headers = self._extract_makefile_variable(makefile, "include_HEADERS") return sources, headers 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")) + 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=self.source_folder) if self.settings.os == "Windows": api = "__declspec(dllexport)" if self.options.shared else "" - tools.replace_in_file(os.path.join(self._source_subfolder, "configure.ac"), - "\nAC_DEFINE([API_EXPORTED]", - "\nAC_DEFINE([API_EXPORTED], [{}], [API])\n#".format(api)) + replace_in_file( + self, + os.path.join(self.source_folder, "configure.ac"), + "\nAC_DEFINE([API_EXPORTED]", + f"\nAC_DEFINE([API_EXPORTED], [{api}], [API])\n#", + ) # libtool disallows building shared libraries that link to static libraries # This will override this and add the dependency - tools.replace_in_file(os.path.join(self._source_subfolder, "ltmain.sh"), - "droppeddeps=yes", "droppeddeps=no && func_append newdeplibs \" $a_deplib\"") - - @property - def _user_info_build(self): - return getattr(self, "user_info_build", None) or self.deps_user_info + replace_in_file( + self, + os.path.join(self.source_folder, "ltmain.sh"), + "droppeddeps=yes", + 'droppeddeps=no && func_append newdeplibs " $a_deplib"', + ) def build(self): self._patch_sources() - with self._build_context(): - autotools = self._configure_autotools() + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.autoreconf() + autotools.configure() if self.settings.os == "Windows": - cmakelists_in = tools.load("CMakeLists.txt.in") + cmakelists_in = load(self, os.path.join(self.export_sources_folder, "CMakeLists.txt.in")) sources, headers = self._extract_autotools_variables() - tools.save(os.path.join(self._source_subfolder, "libusb", "CMakeLists.txt"), cmakelists_in.format( + save(self, os.path.join(self.source_folder, "libusb", "CMakeLists.txt"), cmakelists_in.format( libusb_sources=" ".join(sources), libusb_headers=" ".join(headers), )) - tools.replace_in_file("config.h", "\n#define API_EXPORTED", "\n#define API_EXPORTED //") - cmake = self._configure_cmake() + replace_in_file(self, os.path.join(self.source_folder, "config.h"), + "\n#define API_EXPORTED", "\n#define API_EXPORTED //") + copy(self, "config.h", self.source_folder, os.path.join(self.source_folder, "libusb")) + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, "libusb")) cmake.build() else: - with self._build_context(): + with chdir(self, self.source_folder): 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() else: - with self._build_context(): - autotools = self._configure_autotools() + with chdir(self, self.source_folder): + autotools = Autotools(self) autotools.install() - os.unlink(os.path.join(self.package_folder, "bin", "libusb-config")) os.unlink(os.path.join(self.package_folder, "lib", "libusb.la")) - 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.names["pkg_config"] = "libusb" + self.cpp_info.set_property("pkg_config_name", "libusb") self.cpp_info.libs = ["usb"] if not self.options.shared: self.cpp_info.defines = ["LIBUSB_COMPAT_STATIC"] diff --git a/recipes/libusb-compat/all/test_package/CMakeLists.txt b/recipes/libusb-compat/all/test_package/CMakeLists.txt index a5ffd526aaea7..016043e24e629 100644 --- a/recipes/libusb-compat/all/test_package/CMakeLists.txt +++ b/recipes/libusb-compat/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ -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() +find_package(libusb-compat REQUIRED CONFIG) add_executable(${CMAKE_PROJECT_NAME} test_package.c) -target_link_libraries(${CMAKE_PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${CMAKE_PROJECT_NAME} libusb-compat::libusb-compat) diff --git a/recipes/libusb-compat/all/test_package/conanfile.py b/recipes/libusb-compat/all/test_package/conanfile.py index 4fdc223664bd8..ef5d7042163ec 100644 --- a/recipes/libusb-compat/all/test_package/conanfile.py +++ b/recipes/libusb-compat/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" + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libusb-compat/all/test_package/test_package.c b/recipes/libusb-compat/all/test_package/test_package.c index 6cdda7a4a359c..bd44d95c27b01 100644 --- a/recipes/libusb-compat/all/test_package/test_package.c +++ b/recipes/libusb-compat/all/test_package/test_package.c @@ -2,8 +2,7 @@ #include - -int main(int argc, char *argv[]) { +int main() { usb_init(); usb_find_busses(); usb_find_devices(); diff --git a/recipes/libusb-compat/all/test_v1_package/CMakeLists.txt b/recipes/libusb-compat/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/libusb-compat/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/libusb-compat/all/test_v1_package/conanfile.py b/recipes/libusb-compat/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..852f062fd4f80 --- /dev/null +++ b/recipes/libusb-compat/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.settings): + bin_path = os.path.join("bin","test_package") + self.run(bin_path, run_environment=True) 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 0c93d90aac203..0ec668083cf4e 100644 --- a/recipes/libusb/all/conanfile.py +++ b/recipes/libusb/all/conanfile.py @@ -1,13 +1,14 @@ from conan import ConanFile from conan.tools.apple import fix_apple_shared_install_name -from conan.tools.microsoft import is_msvc -from conan.tools.files import get, chdir, rmdir, rm, replace_in_file +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 -from conans import AutoToolsBuildEnvironment, MSBuild, tools import os -import re -required_conan_version = ">=1.51.3" +required_conan_version = ">=1.54.0" class LibUSBConan(ConanFile): @@ -16,8 +17,9 @@ 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") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -28,11 +30,6 @@ class LibUSBConan(ConanFile): "fPIC": True, "enable_udev": True, } - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" @property def _is_mingw(self): @@ -40,7 +37,14 @@ def _is_mingw(self): @property def _settings_build(self): - return self.settings_build if hasattr(self, "settings_build") else self.settings + 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": @@ -53,97 +57,86 @@ 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): - pass - - 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") + 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): - get(self, **self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _build_visual_studio(self): - with chdir(self, 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 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): + apply_conandata_patches(self) if is_msvc(self): - if 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) - replace_in_file(self, vcxproj_path, "10.0.16299.0", "") - self._build_visual_studio() - else: - autotools = self._configure_autotools() - autotools.make() + 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) + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) if is_msvc(self): - self._package_visual_studio() + 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() rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) rm(self, "*.la", os.path.join(self.package_folder, "lib")) @@ -151,7 +144,8 @@ def package(self): def package_info(self): self.cpp_info.set_property("pkg_config_name", "libusb-1.0") - self.cpp_info.libs = tools.collect_libs(self) + 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/conanfile.py b/recipes/libuuid/all/conanfile.py index 83191c7fd1923..7d995adb8138c 100644 --- a/recipes/libuuid/all/conanfile.py +++ b/recipes/libuuid/all/conanfile.py @@ -17,6 +17,7 @@ class LibuuidConan(ConanFile): homepage = "https://sourceforge.net/projects/libuuid/" license = "BSD-3-Clause" topics = "id", "identifier", "unique", "uuid" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -27,11 +28,15 @@ class LibuuidConan(ConanFile): "fPIC": True, } + @property + def _has_sys_file_header(self): + return self.settings.os in ["FreeBSD", "Linux", "Macos"] + 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): @@ -44,23 +49,24 @@ def layout(self): basic_layout(self, src_folder="src") def validate(self): - if self.info.settings.os == "Windows": + if self.settings.os == "Windows": raise ConanInvalidConfiguration(f"{self.ref} is not supported on Windows") def build_requirements(self): self.tool_requires("libtool/2.4.7") 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 = AutotoolsToolchain(self) + if self._has_sys_file_header: + tc.extra_defines.append("HAVE_SYS_FILE_H") if "x86" in self.settings.arch: tc.extra_cflags.append("-mstackrealign") tc.generate() - env = VirtualBuildEnv(self) - env.generate() def build(self): apply_conandata_patches(self) diff --git a/recipes/libuv/all/conandata.yml b/recipes/libuv/all/conandata.yml index e251d497e772d..d0ee02e78c23d 100644 --- a/recipes/libuv/all/conandata.yml +++ b/recipes/libuv/all/conandata.yml @@ -1,65 +1,72 @@ sources: + "1.49.2": + url: "https://github.com/libuv/libuv/archive/v1.49.2.tar.gz" + sha256: "388ffcf3370d4cf7c4b3a3205504eea06c4be5f9e80d2ab32d19f8235accc1cf" + "1.49.1": + url: "https://github.com/libuv/libuv/archive/v1.49.1.tar.gz" + sha256: "94312ede44c6cae544ae316557e2651aea65efce5da06f8d44685db08392ec5d" + "1.49.0": + url: "https://github.com/libuv/libuv/archive/v1.49.0.tar.gz" + sha256: "a10656a0865e2cff7a1b523fa47d0f5a9c65be963157301f814d1cc5dbd4dc1d" + "1.48.0": + url: "https://github.com/libuv/libuv/archive/v1.48.0.tar.gz" + sha256: "8c253adb0f800926a6cbd1c6576abae0bc8eb86a4f891049b72f9e5b7dc58f33" + "1.47.0": + url: "https://github.com/libuv/libuv/archive/v1.47.0.tar.gz" + sha256: "d50af7e6d72526db137e66fad812421c8a1cae09d146b0ec2bb9a22c5f23ba93" + "1.46.0": + url: "https://github.com/libuv/libuv/archive/v1.46.0.tar.gz" + sha256: "7aa66be3413ae10605e1f5c9ae934504ffe317ef68ea16fdaa83e23905c681bd" + "1.45.0": + url: "https://github.com/libuv/libuv/archive/v1.45.0.tar.gz" + sha256: "458e34d5ef7f3c0394a2bfd8c39d757cb1553baa5959b9b4b45df63aa027a228" "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" "1.43.0": 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" + "1.49.2": + - patch_file: "patches/1.49.0/fix-cmake.patch" patch_description: "separate shared and static library build" patch_type: "conan" - "1.44.1": - - patch_file: "patches/1.44.1/fix-cmake.patch" + "1.49.1": + - patch_file: "patches/1.49.0/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" + "1.49.0": + - patch_file: "patches/1.49.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" + "1.48.0": + - patch_file: "patches/1.48.0/fix-cmake.patch" + patch_description: "separate shared and static library build" + patch_type: "conan" + "1.47.0": + - patch_file: "patches/1.47.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" + "1.46.0": + - patch_file: "patches/1.45.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" + "1.45.0": + - patch_file: "patches/1.45.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" + "1.44.2": + - patch_file: "patches/1.44.2/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" - - 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" + "1.42.0": + - patch_file: "patches/1.42.0/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 a147f0a7124e2..d9bda835cdea0 100644 --- a/recipes/libuv/all/conanfile.py +++ b/recipes/libuv/all/conanfile.py @@ -2,20 +2,21 @@ 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 +from conan.tools.scm import Version import os import textwrap -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class LibuvConan(ConanFile): name = "libuv" + description = "A multi-platform support library with a focus on asynchronous I/O" license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://libuv.org" - description = "A multi-platform support library with a focus on asynchronous I/O" - topics = ("libuv", "asynchronous", "io", "networking", "multi-platform") - + topics = ("asynchronous", "io", "networking", "multi-platform") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -35,18 +36,9 @@ def config_options(self): 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 + 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") @@ -56,12 +48,13 @@ 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) tc.variables["LIBUV_BUILD_TESTS"] = False + if Version(self.version) >= "1.45.0": + tc.variables["LIBUV_BUILD_SHARED"] = self.options.shared tc.generate() def build(self): @@ -82,7 +75,7 @@ def package(self): # 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._target_lib_name: "libuv::libuv"} + {self._target_name: "libuv::libuv"} ) def _create_cmake_module_alias_targets(self, module_file, targets): @@ -101,20 +94,32 @@ def _module_file_rel_path(self): return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") @property - def _target_lib_name(self): - return "uv" if self.options.shared else "uv_a" + def _target_name(self): + if Version(self.version) < "1.45.0": + return "uv" if self.options.shared else "uv_a" + return "uv" + + @property + def _lib_name(self): + if Version(self.version) < "1.45.0": + return "uv" if self.options.shared else "uv_a" + if is_msvc(self) and not self.options.shared: + return "libuv" + return "uv" def package_info(self): self.cpp_info.set_property("cmake_file_name", "libuv") - self.cpp_info.set_property("cmake_target_name", self._target_lib_name) + self.cpp_info.set_property("cmake_target_name", self._target_name) self.cpp_info.set_property("pkg_config_name", "libuv" if self.options.shared else "libuv-static") - self.cpp_info.libs = [self._target_lib_name] + self.cpp_info.libs = [self._lib_name] if self.options.shared: self.cpp_info.defines = ["USING_UV_SHARED=1"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["dl", "pthread", "rt"] if self.settings.os == "Windows": self.cpp_info.system_libs = ["iphlpapi", "psapi", "userenv", "ws2_32"] + if Version(self.version) >= "1.45.0": + self.cpp_info.system_libs.append("dbghelp") # TODO: to remove in conan v2 once cmake_find_package* & pkg_config generators removed self.cpp_info.names["pkg_config"] = "libuv" if self.options.shared else "libuv-static" diff --git a/recipes/libuv/all/patches/1.38.1/fix-cmake.patch b/recipes/libuv/all/patches/1.38.1/fix-cmake.patch deleted file mode 100644 index 752d2ecdc5cea..0000000000000 --- a/recipes/libuv/all/patches/1.38.1/fix-cmake.patch +++ /dev/null @@ -1,80 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 2518c747..05b5add1 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -297,13 +297,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 -@@ -313,17 +319,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.40.0/fix-cmake.patch b/recipes/libuv/all/patches/1.40.0/fix-cmake.patch deleted file mode 100644 index 194123f2f2d1b..0000000000000 --- a/recipes/libuv/all/patches/1.40.0/fix-cmake.patch +++ /dev/null @@ -1,77 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index e648b00..080f403 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -326,13 +326,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 -@@ -342,17 +348,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. -@@ -595,19 +590,18 @@ if(UNIX OR MINGW) - configure_file(libuv-static.pc.in libuv-static.pc @ONLY) - - install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) -- install(FILES LICENSE DESTINATION ${CMAKE_INSTALL_DOCDIR}) -- install(FILES ${PROJECT_BINARY_DIR}/libuv.pc ${PROJECT_BINARY_DIR}/libuv-static.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(MSVC) - 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.40.0/fix-ios.patch b/recipes/libuv/all/patches/1.40.0/fix-ios.patch deleted file mode 100644 index 616e7c2083eea..0000000000000 --- a/recipes/libuv/all/patches/1.40.0/fix-ios.patch +++ /dev/null @@ -1,28 +0,0 @@ -patch from https://github.com/libuv/libuv/commit/1addf9b88a17bc32d009d377a14d540ccddd06db -fixed in 1.42.0 - ---- a/src/unix/darwin.c -+++ b/src/unix/darwin.c -@@ -33,9 +33,7 @@ - #include - #include /* sysconf */ - --#if !TARGET_OS_IPHONE - #include "darwin-stub.h" --#endif - - static uv_once_t once = UV_ONCE_INIT; - static uint64_t (*time_func)(void); -@@ -223,10 +221,10 @@ static int uv__get_cpu_speed(uint64_t* speed) { - err = UV_ENOENT; - core_foundation_handle = dlopen("/System/Library/Frameworks/" - "CoreFoundation.framework/" -- "Versions/A/CoreFoundation", -+ "CoreFoundation", - RTLD_LAZY | RTLD_LOCAL); - iokit_handle = dlopen("/System/Library/Frameworks/IOKit.framework/" -- "Versions/A/IOKit", -+ "IOKit", - RTLD_LAZY | RTLD_LOCAL); - - if (core_foundation_handle == NULL || iokit_handle == NULL) diff --git a/recipes/libuv/all/patches/1.41.0/fix-cmake.patch b/recipes/libuv/all/patches/1.41.0/fix-cmake.patch deleted file mode 100644 index 08dd6f34be1b3..0000000000000 --- a/recipes/libuv/all/patches/1.41.0/fix-cmake.patch +++ /dev/null @@ -1,77 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index c8e881d1..82daa0d2 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -335,13 +335,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 -@@ -351,17 +357,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. -@@ -605,19 +600,18 @@ if(UNIX OR MINGW) - configure_file(libuv-static.pc.in libuv-static.pc @ONLY) - - install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) -- install(FILES LICENSE DESTINATION ${CMAKE_INSTALL_DOCDIR}) -- install(FILES ${PROJECT_BINARY_DIR}/libuv.pc ${PROJECT_BINARY_DIR}/libuv-static.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(MSVC) - 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.45.0/fix-cmake.patch b/recipes/libuv/all/patches/1.45.0/fix-cmake.patch new file mode 100644 index 0000000000000..17b69ef2b4959 --- /dev/null +++ b/recipes/libuv/all/patches/1.45.0/fix-cmake.patch @@ -0,0 +1,58 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 93733dd..d9e7acc 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -460,8 +460,7 @@ if(LIBUV_BUILD_SHARED) + endif() + target_link_libraries(uv ${uv_libraries}) + set_target_properties(uv PROPERTIES OUTPUT_NAME "uv") +-endif() +- ++else() + add_library(uv_a STATIC ${uv_sources}) + target_compile_definitions(uv_a PRIVATE ${uv_defines}) + target_compile_options(uv_a PRIVATE ${uv_cflags}) +@@ -480,6 +479,8 @@ set_target_properties(uv_a PROPERTIES OUTPUT_NAME "uv") + if(MSVC) + set_target_properties(uv_a PROPERTIES PREFIX "lib") + endif() ++endif() ++ + + if(LIBUV_BUILD_TESTS) + # Small hack: use ${uv_test_sources} now to get the runner skeleton, +@@ -732,18 +733,10 @@ set(UV_VERSION_MAJOR "${CMAKE_MATCH_1}") + set(includedir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}) + set(libdir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}) + set(prefix ${CMAKE_INSTALL_PREFIX}) +-configure_file(libuv-static.pc.in libuv-static.pc @ONLY) + + install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + install(FILES LICENSE DESTINATION ${CMAKE_INSTALL_DOCDIR}) + install(FILES LICENSE-extra DESTINATION ${CMAKE_INSTALL_DOCDIR}) +-install(FILES ${PROJECT_BINARY_DIR}/libuv-static.pc +- DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) +-install(TARGETS uv_a EXPORT libuvConfig +- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) +-install(EXPORT libuvConfig +- DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libuv +- NAMESPACE libuv::) + + if(LIBUV_BUILD_SHARED) + # The version in the filename is mirroring the behaviour of autotools. +@@ -757,6 +750,15 @@ if(LIBUV_BUILD_SHARED) + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) ++else() ++ configure_file(libuv-static.pc.in libuv-static.pc @ONLY) ++ install(FILES ${PROJECT_BINARY_DIR}/libuv-static.pc ++ DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) ++ install(TARGETS uv_a EXPORT libuvConfig ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) ++ install(EXPORT libuvConfig ++ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libuv ++ NAMESPACE libuv::) + endif() + + if(MSVC) diff --git a/recipes/libuv/all/patches/1.47.0/fix-cmake.patch b/recipes/libuv/all/patches/1.47.0/fix-cmake.patch new file mode 100644 index 0000000000000..9a4ee2265047a --- /dev/null +++ b/recipes/libuv/all/patches/1.47.0/fix-cmake.patch @@ -0,0 +1,65 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 7237785..3707621 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -461,7 +461,7 @@ if(LIBUV_BUILD_SHARED) + endif() + target_link_libraries(uv ${uv_libraries}) + set_target_properties(uv PROPERTIES OUTPUT_NAME "uv") +-endif() ++else() + + add_library(uv_a STATIC ${uv_sources}) + target_compile_definitions(uv_a PRIVATE ${uv_defines}) +@@ -481,7 +481,7 @@ set_target_properties(uv_a PROPERTIES OUTPUT_NAME "uv") + if(WIN32) + set_target_properties(uv_a PROPERTIES PREFIX "lib") + endif() +- ++endif() + if(LIBUV_BUILD_TESTS) + # Small hack: use ${uv_test_sources} now to get the runner skeleton, + # before the actual tests are added. +@@ -733,18 +733,18 @@ set(UV_VERSION_MAJOR "${CMAKE_MATCH_1}") + set(includedir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}) + set(libdir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}) + set(prefix ${CMAKE_INSTALL_PREFIX}) +-configure_file(libuv-static.pc.in libuv-static.pc @ONLY) ++# configure_file(libuv-static.pc.in libuv-static.pc @ONLY) + + install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + install(FILES LICENSE DESTINATION ${CMAKE_INSTALL_DOCDIR}) + install(FILES LICENSE-extra DESTINATION ${CMAKE_INSTALL_DOCDIR}) +-install(FILES ${PROJECT_BINARY_DIR}/libuv-static.pc +- DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) +-install(TARGETS uv_a EXPORT libuvConfig +- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) +-install(EXPORT libuvConfig +- DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libuv +- NAMESPACE libuv::) ++#install(FILES ${PROJECT_BINARY_DIR}/libuv-static.pc ++# DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) ++#install(TARGETS uv_a EXPORT libuvConfig ++# ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) ++#install(EXPORT libuvConfig ++# DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libuv ++# NAMESPACE libuv::) + + if(LIBUV_BUILD_SHARED) + # The version in the filename is mirroring the behaviour of autotools. +@@ -758,6 +758,15 @@ if(LIBUV_BUILD_SHARED) + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) ++else() ++ configure_file(libuv-static.pc.in libuv-static.pc @ONLY) ++ install(FILES ${PROJECT_BINARY_DIR}/libuv-static.pc ++ DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) ++ install(TARGETS uv_a EXPORT libuvConfig ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) ++ install(EXPORT libuvConfig ++ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libuv ++ NAMESPACE libuv::) + endif() + + if(MSVC) diff --git a/recipes/libuv/all/patches/1.48.0/fix-cmake.patch b/recipes/libuv/all/patches/1.48.0/fix-cmake.patch new file mode 100644 index 0000000000000..4fbe54ddf91e7 --- /dev/null +++ b/recipes/libuv/all/patches/1.48.0/fix-cmake.patch @@ -0,0 +1,65 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 5e8e016..427bd86 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -465,7 +465,7 @@ if(LIBUV_BUILD_SHARED) + endif() + target_link_libraries(uv ${uv_libraries}) + set_target_properties(uv PROPERTIES OUTPUT_NAME "uv") +-endif() ++else() + + add_library(uv_a STATIC ${uv_sources}) + target_compile_definitions(uv_a PRIVATE ${uv_defines}) +@@ -485,7 +485,7 @@ set_target_properties(uv_a PROPERTIES OUTPUT_NAME "uv") + if(WIN32) + set_target_properties(uv_a PROPERTIES PREFIX "lib") + endif() +- ++endif() + if(LIBUV_BUILD_TESTS) + # Small hack: use ${uv_test_sources} now to get the runner skeleton, + # before the actual tests are added. +@@ -750,18 +750,18 @@ set(UV_VERSION_MAJOR "${CMAKE_MATCH_1}") + set(includedir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}) + set(libdir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}) + set(prefix ${CMAKE_INSTALL_PREFIX}) +-configure_file(libuv-static.pc.in libuv-static.pc @ONLY) ++# configure_file(libuv-static.pc.in libuv-static.pc @ONLY) + + install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + install(FILES LICENSE DESTINATION ${CMAKE_INSTALL_DOCDIR}) + install(FILES LICENSE-extra DESTINATION ${CMAKE_INSTALL_DOCDIR}) +-install(FILES ${PROJECT_BINARY_DIR}/libuv-static.pc +- DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) +-install(TARGETS uv_a EXPORT libuvConfig +- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) +-install(EXPORT libuvConfig +- DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libuv +- NAMESPACE libuv::) ++# install(FILES ${PROJECT_BINARY_DIR}/libuv-static.pc ++# DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) ++# install(TARGETS uv_a EXPORT libuvConfig ++# ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) ++# install(EXPORT libuvConfig ++# DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libuv ++# NAMESPACE libuv::) + + if(LIBUV_BUILD_SHARED) + # The version in the filename is mirroring the behaviour of autotools. +@@ -775,6 +775,15 @@ if(LIBUV_BUILD_SHARED) + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) ++else() ++ configure_file(libuv-static.pc.in libuv-static.pc @ONLY) ++ install(FILES ${PROJECT_BINARY_DIR}/libuv-static.pc ++ DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) ++ install(TARGETS uv_a EXPORT libuvConfig ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) ++ install(EXPORT libuvConfig ++ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libuv ++ NAMESPACE libuv::) + endif() + + if(MSVC) diff --git a/recipes/libuv/all/patches/1.49.0/fix-cmake.patch b/recipes/libuv/all/patches/1.49.0/fix-cmake.patch new file mode 100644 index 0000000000000..6d9a35e21bcd5 --- /dev/null +++ b/recipes/libuv/all/patches/1.49.0/fix-cmake.patch @@ -0,0 +1,67 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 28c6df2..608d0f7 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -471,7 +471,7 @@ if(LIBUV_BUILD_SHARED) + endif() + target_link_libraries(uv ${uv_libraries}) + set_target_properties(uv PROPERTIES OUTPUT_NAME "uv") +-endif() ++else() + + add_library(uv_a STATIC ${uv_sources}) + target_compile_definitions(uv_a PRIVATE ${uv_defines}) +@@ -491,7 +491,7 @@ set_target_properties(uv_a PROPERTIES OUTPUT_NAME "uv") + if(WIN32) + set_target_properties(uv_a PROPERTIES PREFIX "lib") + endif() +- ++endif() + if(LIBUV_BUILD_TESTS) + # Small hack: use ${uv_test_sources} now to get the runner skeleton, + # before the actual tests are added. +@@ -759,18 +759,18 @@ set(UV_VERSION_MAJOR "${CMAKE_MATCH_1}") + set(includedir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}) + set(libdir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}) + set(prefix ${CMAKE_INSTALL_PREFIX}) +-configure_file(libuv-static.pc.in libuv-static.pc @ONLY) ++# configure_file(libuv-static.pc.in libuv-static.pc @ONLY) + + install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + install(FILES LICENSE DESTINATION ${CMAKE_INSTALL_DOCDIR}) + install(FILES LICENSE-extra DESTINATION ${CMAKE_INSTALL_DOCDIR}) +-install(FILES ${PROJECT_BINARY_DIR}/libuv-static.pc +- DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) +-install(TARGETS uv_a EXPORT libuvConfig +- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) +-install(EXPORT libuvConfig +- DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libuv +- NAMESPACE libuv::) ++# install(FILES ${PROJECT_BINARY_DIR}/libuv-static.pc ++# DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) ++# install(TARGETS uv_a EXPORT libuvConfig ++# ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) ++# install(EXPORT libuvConfig ++# DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libuv ++# NAMESPACE libuv::) + + if(LIBUV_BUILD_SHARED) + # The version in the filename is mirroring the behaviour of autotools. +@@ -784,8 +784,16 @@ if(LIBUV_BUILD_SHARED) + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) ++else() ++ configure_file(libuv-static.pc.in libuv-static.pc @ONLY) ++ install(FILES ${PROJECT_BINARY_DIR}/libuv-static.pc ++ DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) ++ install(TARGETS uv_a EXPORT libuvConfig ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) ++ install(EXPORT libuvConfig ++ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libuv ++ NAMESPACE libuv::) + endif() +- + if(MSVC) + set(CMAKE_DEBUG_POSTFIX d) + get_filename_component(CMAKE_C_COMPILER_DIR ${CMAKE_C_COMPILER} DIRECTORY) diff --git a/recipes/libuv/config.yml b/recipes/libuv/config.yml index cc83d80cfe19b..341ae1de60810 100644 --- a/recipes/libuv/config.yml +++ b/recipes/libuv/config.yml @@ -1,17 +1,21 @@ versions: - "1.44.2": + "1.49.2": folder: all - "1.44.1": + "1.49.1": folder: all - "1.43.0": + "1.49.0": folder: all - "1.42.0": + "1.48.0": + folder: all + "1.47.0": folder: all - "1.41.1": + "1.46.0": folder: all - "1.41.0": + "1.45.0": folder: all - "1.40.0": + "1.44.2": + folder: all + "1.43.0": folder: all - "1.38.1": + "1.42.0": 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..9ed43ec234a2c 100644 --- a/recipes/libuvc/all/conandata.yml +++ b/recipes/libuvc/all/conandata.yml @@ -1,10 +1,19 @@ sources: + "0.0.7": + url: "https://github.com/libuvc/libuvc/archive/v0.0.7.tar.gz" + sha256: "7c6ba79723ad5d0ccdfbe6cadcfbd03f9f75b701d7ba96631eb1fd929a86ee72" "0.0.6": url: "https://github.com/libuvc/libuvc/archive/v0.0.6.tar.gz" sha256: "42175a53c1c704365fdc782b44233925e40c9344fbb7f942181c1090f06e2873" patches: + "0.0.7": + - patch_file: "patches/0.0.7-0001-fix-cci-packagename.patch" + patch_description: "use cci package name" + patch_type: "conan" "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..b0897cfc1830a 100644 --- a/recipes/libuvc/all/conanfile.py +++ b/recipes/libuvc/all/conanfile.py @@ -1,49 +1,38 @@ -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 +from conan.tools.scm import Version 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" - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], - "jpeg_turbo": [True, False], + "with_jpeg": [False, "libjpeg", "libjpeg-turbo", "mozjpeg"], } default_options = { "shared": False, "fPIC": True, - "jpeg_turbo": False, + "with_jpeg": "libjpeg", } - 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 +40,83 @@ 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("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/3.0.0") + elif self.options.with_jpeg == "mozjpeg": + self.requires("mozjpeg/4.1.3") 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/2.0.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) + if Version(self.version) >= "0.0.7": + tc.variables["BUILD_EXAMPLE"] = False + + # 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 +125,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/0.0.7-0001-fix-cci-packagename.patch b/recipes/libuvc/all/patches/0.0.7-0001-fix-cci-packagename.patch new file mode 100644 index 0000000000000..06c70b926bb50 --- /dev/null +++ b/recipes/libuvc/all/patches/0.0.7-0001-fix-cci-packagename.patch @@ -0,0 +1,13 @@ +diff --git a/a/CMakeLists.txt b/b/CMakeLists.txt +index fbaffc9..e14daf4 100644 +--- a/a/CMakeLists.txt ++++ b/b/CMakeLists.txt +@@ -116,7 +116,7 @@ foreach(target_name IN LISTS UVC_TARGETS) + ) + target_link_libraries(${target_name} + # libusb-1.0 used internally so we link to it privately. +- PRIVATE LibUSB::LibUSB ${threads} ++ PRIVATE libusb::libusb ${threads} + ) + if(JPEG_FOUND) + target_link_libraries(${target_name} 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/libuvc/config.yml b/recipes/libuvc/config.yml index d33b2d9ed7a85..8915eeb6ead5c 100644 --- a/recipes/libuvc/config.yml +++ b/recipes/libuvc/config.yml @@ -1,3 +1,5 @@ versions: + "0.0.7": + folder: all "0.0.6": folder: all diff --git a/recipes/libva/all/conandata.yml b/recipes/libva/all/conandata.yml new file mode 100644 index 0000000000000..b9410dc0ab2cf --- /dev/null +++ b/recipes/libva/all/conandata.yml @@ -0,0 +1,13 @@ +sources: + "2.21.0": + url: "https://github.com/intel/libva/archive/refs/tags/2.21.0.tar.gz" + sha256: "f7c3fffef3f04eb146e036dad2587d852bfb70e4926d014bf437244915ef7425" + "2.20.0": + url: "https://github.com/intel/libva/archive/refs/tags/2.20.0.tar.gz" + sha256: "117f8d658a5fc9ea406ca80a3eb4ae1d70b15a54807c9ed77199c812bed73b60" +patches: + "2.20.0": + - patch_file: "patches/0001-fix-win32-debug.patch" + patch_description: "Fix win32 debug build break" + patch_type: "backport" + patch_source: "https://github.com/intel/libva/pull/759" diff --git a/recipes/libva/all/conanfile.py b/recipes/libva/all/conanfile.py new file mode 100644 index 0000000000000..d92edb9da1d88 --- /dev/null +++ b/recipes/libva/all/conanfile.py @@ -0,0 +1,165 @@ +import os + +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 PkgConfigDeps +from conan.tools.layout import basic_layout +from conan.tools.meson import Meson, MesonToolchain + + +required_conan_version = ">=1.60.0 <2 || >=2.0.6" + + +class PackageConan(ConanFile): + name = "libva" + description = "Libva is an implementation for VA-API" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/intel/libva" + topics = ("VA-API", "Video", "Acceleration") + provides = "vaapi" + package_type = "shared-library" + settings = "os", "arch", "compiler", "build_type" + options = { + "with_drm": [True, False], + "with_x11": [True, False], + "with_glx": [True, False], + "with_wayland": [True, False], + "with_win32": [True, False], + } + default_options = { + "with_drm": True, + "with_x11": True, + "with_glx": True, + "with_wayland": True, + "with_win32": True, + } + + @property + def _has_build_profile(self): + return hasattr(self, "settings_build") + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os != "Windows": + del self.options.with_win32 + + if self.settings.os not in ["Linux", "FreeBSD"]: + del self.options.with_x11 + del self.options.with_glx + del self.options.with_drm + + if self.settings.os != "Linux": + del self.options.with_wayland + + def configure(self): + 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_x11"): + self.requires("xorg/system") + if self.options.get_safe("with_drm"): + self.requires("libdrm/2.4.119") + if self.options.get_safe("with_wayland"): + self.requires("wayland/1.22.0") + if self.options.get_safe("with_glx"): + self.requires("opengl/system") + + def validate(self): + if self.options.get_safe("with_glx") and not self.options.get_safe("with_x11"): + raise ConanInvalidConfiguration(f"{self.ref} requires x11 when glx is enabled") + if not self.options.get_safe("with_drm") and not self.options.get_safe("with_x11") and not self.options.get_safe("with_wayland") and not self.options.get_safe("with_win32"): + raise ConanInvalidConfiguration(f"{self.ref} can not be built without at least one backend dev files.") + + def build_requirements(self): + if self.options.get_safe("with_wayland") and self._has_build_profile: + self.tool_requires("wayland/") + self.tool_requires("meson/1.3.2") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/2.1.0") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = MesonToolchain(self) + tc.project_options["disable_drm"] = not self.options.get_safe("with_drm") + for opt in ['with_x11', 'with_glx', 'with_wayland', 'with_win32']: + tc.project_options[opt] = "yes" if self.options.get_safe(opt) else "no" + tc.project_options["build.pkg_config_path"] = self.generators_folder + tc.generate() + pkg_config_deps = PkgConfigDeps(self) + if self.options.get_safe("with_wayland") and self._has_build_profile: + pkg_config_deps.build_context_activated = ["wayland"] + pkg_config_deps.build_context_suffix = {"wayland": "_BUILD"} + pkg_config_deps.generate() + tc = VirtualBuildEnv(self) + tc.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + if self.options.get_safe("with_wayland") and self._has_build_profile: + # Patch the build system to use the pkg-config files generated for 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',", + "wayland_scanner_dep = dependency('wayland-scanner_BUILD',", + ) + + def build(self): + self._patch_sources() + 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() + + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + 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")) + + fix_apple_shared_install_name(self) + + def package_info(self): + self.cpp_info.components["libva_"].libs = ["va"] + self.cpp_info.components["libva_"].set_property("pkg_config_name", "libva") + + if self.options.get_safe("with_drm"): + self.cpp_info.components["libva-drm"].libs = ["va-drm"] + self.cpp_info.components["libva-drm"].set_property("pkg_config_name", "libva-drm") + self.cpp_info.components["libva-drm"].requires = ["libva_", "libdrm::libdrm"] + + if self.options.get_safe("with_x11"): + self.cpp_info.components["libva-x11"].libs = ["va-x11"] + self.cpp_info.components["libva-x11"].set_property("pkg_config_name", "libva-x11") + self.cpp_info.components["libva-x11"].requires = ["libva_", "xorg::xorg"] + + if self.options.get_safe("with_glx"): + self.cpp_info.components["libva-glx"].libs = ["va-glx"] + self.cpp_info.components["libva-glx"].set_property("pkg_config_name", "libva-glx") + self.cpp_info.components["libva-glx"].requires = ["libva_", "opengl::opengl"] + + if self.options.get_safe("with_wayland"): + self.cpp_info.components["libva-wayland"].libs = ["va-wayland"] + self.cpp_info.components["libva-wayland"].set_property("pkg_config_name", "libva-wayland") + self.cpp_info.components["libva-wayland"].requires = ["libva_", "wayland::wayland-client"] + + if self.options.get_safe("with_win32"): + self.cpp_info.components["libva-win32"].libs = ["va_win32"] + self.cpp_info.components["libva-win32"].set_property("pkg_config_name", "libva-win32") + self.cpp_info.components["libva-win32"].requires = ["libva_"] diff --git a/recipes/libva/all/patches/0001-fix-win32-debug.patch b/recipes/libva/all/patches/0001-fix-win32-debug.patch new file mode 100644 index 0000000000000..9a323b9c3f71a --- /dev/null +++ b/recipes/libva/all/patches/0001-fix-win32-debug.patch @@ -0,0 +1,27 @@ +From 2a1536a7d87eee3de17c27d07a40d8578cbf7cc0 Mon Sep 17 00:00:00 2001 +From: Sil Vilerino +Date: Wed, 27 Sep 2023 11:50:16 -0400 +Subject: [PATCH] win32: Fix debug build break + +Fixes: 484f128 ("win32: remove duplicate adapter_luid entry") +Signed-off-by: Sil Vilerino +--- + va/win32/va_win32.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/va/win32/va_win32.c b/va/win32/va_win32.c +index 7a6a895d3..350ee3a27 100644 +--- a/va/win32/va_win32.c ++++ b/va/win32/va_win32.c +@@ -183,9 +183,9 @@ VADisplay vaGetDisplayWin32( + LoadDriverNameFromRegistry(adapter_luid, pWin32Ctx); + #ifdef _DEBUG + if (pWin32Ctx->registry_driver_available_flag) { +- fprintf(stderr, "VA_Win32: Found driver %s in the registry for LUID %ld %ld \n", pWin32Ctx->registry_driver_name, adapter_luid.LowPart, adapter_luid.HighPart); ++ fprintf(stderr, "VA_Win32: Found driver %s in the registry for LUID %ld %ld \n", pWin32Ctx->registry_driver_name, adapter_luid->LowPart, adapter_luid->HighPart); + } else { +- fprintf(stderr, "VA_Win32: Couldn't find a driver in the registry for LUID %ld %ld. Using default driver: %s \n", adapter_luid.LowPart, adapter_luid.HighPart, VAAPI_DEFAULT_DRIVER_NAME); ++ fprintf(stderr, "VA_Win32: Couldn't find a driver in the registry for LUID %ld %ld. Using default driver: %s \n", adapter_luid->LowPart, adapter_luid->HighPart, VAAPI_DEFAULT_DRIVER_NAME); + } + #endif // _DEBUG + } diff --git a/recipes/libva/all/test_package/CMakeLists.txt b/recipes/libva/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..7b1b0ee21235e --- /dev/null +++ b/recipes/libva/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +find_package(libva REQUIRED CONFIG) + +add_executable(test_package test_package.c) +target_link_libraries(test_package PRIVATE libva::libva) diff --git a/recipes/libva/all/test_package/conanfile.py b/recipes/libva/all/test_package/conanfile.py new file mode 100644 index 0000000000000..d0b998814a4e8 --- /dev/null +++ b/recipes/libva/all/test_package/conanfile.py @@ -0,0 +1,27 @@ +import os + +from conan import ConanFile +from conan.tools.build import cross_building +from conan.tools.cmake import CMake, cmake_layout + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "CMakeToolchain", "CMakeDeps", "VirtualBuildEnv", "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 not cross_building(self): + cmd = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(cmd, env="conanrun") diff --git a/recipes/libva/all/test_package/test_package.c b/recipes/libva/all/test_package/test_package.c new file mode 100644 index 0000000000000..2731d8afc64df --- /dev/null +++ b/recipes/libva/all/test_package/test_package.c @@ -0,0 +1,10 @@ +#include + +#include + +int main() +{ + VADisplay va_display; + printf("Display is valid: %d", vaDisplayIsValid(0)); + return 0; +} diff --git a/recipes/libva/config.yml b/recipes/libva/config.yml new file mode 100644 index 0000000000000..d0c85671c9e11 --- /dev/null +++ b/recipes/libva/config.yml @@ -0,0 +1,5 @@ +versions: + "2.21.0": + folder: all + "2.20.0": + folder: all diff --git a/recipes/libvault/all/CMakeLists.txt b/recipes/libvault/all/CMakeLists.txt deleted file mode 100644 index 217b9530b904d..0000000000000 --- a/recipes/libvault/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/libvault/all/conandata.yml b/recipes/libvault/all/conandata.yml index c828fc89b0560..bfc950b624ab9 100644 --- a/recipes/libvault/all/conandata.yml +++ b/recipes/libvault/all/conandata.yml @@ -1,23 +1,4 @@ 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" - patch_type: "conan" - patch_description: "use libcurl from conan center" + "0.59.0": + url: "https://github.com/abedra/libvault/archive/refs/tags/0.59.0.zip" + sha256: 668e71e1689f6142735387989042945e42fd6e0483f223ce3a08121887a335ce diff --git a/recipes/libvault/all/conanfile.py b/recipes/libvault/all/conanfile.py index 659305c5f732b..98c9c4d3f5c6b 100644 --- a/recipes/libvault/all/conanfile.py +++ b/recipes/libvault/all/conanfile.py @@ -1,15 +1,15 @@ import os -from conan import ConanFile, Version +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 -from conan.tools.env import VirtualBuildEnv -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 copy, get, rmdir, replace_in_file from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +from conan.tools.scm import Version -required_conan_version = ">=1.53.0" +required_conan_version = ">=1.54.0" class LibvaultConan(ConanFile): @@ -19,15 +19,35 @@ class LibvaultConan(ConanFile): homepage = "https://github.com/abedra/libvault" description = "A C++ library for Hashicorp Vault" topics = ("vault", "libvault", "secrets", "passwords") + package_type = "library" settings = "os", "arch", "compiler", "build_type" - exports_sources = ["CMakeLists.txt", "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, + } @property def _mac_os_minimum_required_version(self): return "10.15" + @property + def _min_cppstd(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "Visual Studio": "16", + "msvc": "192", + "gcc": "8", + "clang": "7.0", + "apple-clang": "12", + } + def config_options(self): if self.settings.os == "Windows": del self.options.fPIC @@ -36,64 +56,59 @@ 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") - self.requires("catch2/3.2.0") + # public header VaultClient.h includes curl/curl.h and use several functions + self.requires("libcurl/[>=7.78.0 <9]", transitive_headers=True) def validate(self): - 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", - } - - minimum_cpp_standard = 17 - - if compiler in minimum_compiler_version and \ - compiler_version < minimum_compiler_version[compiler]: + 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.name} requires a compiler that supports at least C++{minimum_cpp_standard}. " - f"{compiler} {compiler_version} is not supported.") + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) - if compiler == "clang" and self.settings.compiler.libcxx in ["libstdc++", "libstdc++11"] and self.settings.compiler.version == "11": + if self.settings.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 is_apple_os(self): - os_version = self.info.settings.get_safe("os.version") + os_version = self.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"): - check_min_cppstd(self, minimum_cpp_standard) - 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["ENABLE_TEST"] = "OFF" - tc.variables["ENABLE_INTEGRATION_TEST"] = "OFF" - tc.variables["ENABLE_COVERAGE"] = "OFF" - tc.variables["LINK_CURL"] = "OFF" + tc.variables["ENABLE_TEST"] = False + tc.variables["ENABLE_INTEGRATION_TEST"] = False + tc.variables["ENABLE_COVERAGE"] = False + tc.variables["LINK_CURL"] = True 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 _patch_sources(self): + # INFO: https://github.com/abedra/libvault/pull/123 + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "target_link_libraries(vault curl)", + "target_link_libraries(vault CURL::libcurl)") def build(self): - apply_conandata_patches(self) + self._patch_sources() cmake = CMake(self) - cmake.configure(build_script_folder=self.build_folder) + cmake.configure() cmake.build() def package(self): @@ -105,12 +120,11 @@ def package(self): def package_info(self): self.cpp_info.libs = ["vault"] - self.cpp_info.system_libs = ["m"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("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.set_property("pkg_config_name", "vault") self.cpp_info.set_property("cmake_file_name", "libvault") diff --git a/recipes/libvault/all/patches/fix-cmake-0.48.0.patch b/recipes/libvault/all/patches/fix-cmake-0.48.0.patch deleted file mode 100644 index 510090973c349..0000000000000 --- a/recipes/libvault/all/patches/fix-cmake-0.48.0.patch +++ /dev/null @@ -1,63 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -4,7 +4,6 @@ - set(CMAKE_CXX_STANDARD 17) - set(CMAKE_CXX_STANDARD_REQUIRED ON) - set(CMAKE_CXX_EXTENSIONS OFF) --set(CMAKE_CXX_FLAGS_DEBUG --coverage) - set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) - - option(ENABLE_TEST "Enable tests?" ON) -@@ -14,13 +13,6 @@ - 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") - -@@ -120,11 +112,20 @@ - - 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) - - if (ENABLE_COVERAGE) -+ set(CMAKE_CXX_FLAGS_DEBUG --coverage) - target_link_libraries(vault gcov) - endif () - -@@ -155,7 +156,7 @@ - "${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_BINARY_DIR}/vault.pc" @ONLY) - install(FILES "${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc" - DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") - endif (INSTALL) -@@ -176,7 +177,7 @@ - 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) - - include(CTest) diff --git a/recipes/libvault/all/patches/fix-cmake-0.51.0.patch b/recipes/libvault/all/patches/fix-cmake-0.51.0.patch deleted file mode 100644 index 74ce9e72d06db..0000000000000 --- a/recipes/libvault/all/patches/fix-cmake-0.51.0.patch +++ /dev/null @@ -1,49 +0,0 @@ ---- 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/config.yml b/recipes/libvault/config.yml index 327b1962634e5..06bedb729ed91 100644 --- a/recipes/libvault/config.yml +++ b/recipes/libvault/config.yml @@ -1,7 +1,3 @@ versions: - "0.52.0": - folder: "all" - "0.51.0": - folder: "all" - "0.48.0": + "0.59.0": folder: "all" diff --git a/recipes/libvdpau/all/conandata.yml b/recipes/libvdpau/all/conandata.yml new file mode 100644 index 0000000000000..8273f43ccd712 --- /dev/null +++ b/recipes/libvdpau/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.5": + url: "https://gitlab.freedesktop.org/vdpau/libvdpau/-/archive/1.5/libvdpau-1.5.tar.bz2" + sha256: "a5d50a42b8c288febc07151ab643ac8de06a18446965c7241f89b4e810821913" diff --git a/recipes/libvdpau/all/conanfile.py b/recipes/libvdpau/all/conanfile.py new file mode 100644 index 0000000000000..0ef3234f8182e --- /dev/null +++ b/recipes/libvdpau/all/conanfile.py @@ -0,0 +1,85 @@ +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 is_msvc +from conan.tools.scm import Version +import os + + +required_conan_version = ">=1.53.0" + + +class PackageConan(ConanFile): + name = "libvdpau" + description = "Video Decode and Presentation API for UNIX" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://www.freedesktop.org/wiki/Software/VDPAU/" + topics = ("video", "decode", "presentation") + package_type = "shared-library" + provides = "vdpau" + settings = "os", "arch", "compiler", "build_type" + options = { + "with_dri2": [True, False], + } + default_options = { + "with_dri2": False, + } + + def export_sources(self): + export_conandata_patches(self) + + def configure(self): + 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") + + def build_requirements(self): + self.tool_requires("meson/1.3.1") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/2.1.0") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = MesonToolchain(self) + tc.project_options["dri2"] = "true" if self.options.with_dri2 else "false" + tc.project_options["documentation"] = "false" + tc.project_options["sysconfdir"] = "share" + tc.generate() + tc = PkgConfigDeps(self) + tc.generate() + + def build(self): + apply_conandata_patches(self) + 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() + + # 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, "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.libs = ["vdpau"] + self.cpp_info.set_property("pkg_config_name", "vdpau") + self.cpp_info.system_libs.extend(["pthread", "dl"]) diff --git a/recipes/libvdpau/all/test_package/CMakeLists.txt b/recipes/libvdpau/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..d19c6aa2e9305 --- /dev/null +++ b/recipes/libvdpau/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +find_package(libvdpau REQUIRED CONFIG) + +add_executable(test_package test_package.c) +target_link_libraries(test_package PRIVATE libvdpau::libvdpau) diff --git a/recipes/libvdpau/all/test_package/conanfile.py b/recipes/libvdpau/all/test_package/conanfile.py new file mode 100644 index 0000000000000..abc9920da73b3 --- /dev/null +++ b/recipes/libvdpau/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +import os + +from conan import ConanFile +from conan.tools.build import cross_building +from conan.tools.cmake import CMake, cmake_layout + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "CMakeToolchain", "CMakeDeps", "VirtualBuildEnv", "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 not cross_building(self): + cmd = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(cmd, env="conanrun") diff --git a/recipes/libvdpau/all/test_package/test_package.c b/recipes/libvdpau/all/test_package/test_package.c new file mode 100644 index 0000000000000..f3468bb4d0800 --- /dev/null +++ b/recipes/libvdpau/all/test_package/test_package.c @@ -0,0 +1,46 @@ +#include +#include + +#include + +#include + +int main() +{ + VdpDevice device; + VdpGetProcAddress * get_proc_address; + VdpGetInformationString * get_information_string; + VdpGetApiVersion * get_api_version; + VdpStatus status; + Display * display = XOpenDisplay(NULL); + if (!display) + { + printf("XOpenDisplay failed!\n"); + return 0; + } + status = vdp_device_create_x11(display, 0, &device, &get_proc_address); + if (status != VDP_STATUS_OK) + { + XCloseDisplay(display); + printf("vdp_device_create_x11 failed\n"); + return 0; + } + status = get_proc_address(device, VDP_FUNC_ID_GET_INFORMATION_STRING, (void**) &get_information_string); + if (status == VDP_STATUS_OK) + { + char const * information_string; + status = get_information_string(&information_string); + if (status == VDP_STATUS_OK) + printf("VDPAU information string: %s\n", information_string); + } + status = get_proc_address(device, VDP_FUNC_ID_GET_API_VERSION, (void**) &get_api_version); + if (status == VDP_STATUS_OK) + { + uint32_t api_version; + status = get_api_version(&api_version); + if (status == VDP_STATUS_OK) + printf("VDPAU API version: %d\n", api_version); + } + XCloseDisplay(display); + return 0; +} diff --git a/recipes/libvdpau/config.yml b/recipes/libvdpau/config.yml new file mode 100644 index 0000000000000..289ff2f2a0c3c --- /dev/null +++ b/recipes/libvdpau/config.yml @@ -0,0 +1,3 @@ +versions: + "1.5": + folder: all diff --git a/recipes/libversion/all/conandata.yml b/recipes/libversion/all/conandata.yml new file mode 100644 index 0000000000000..7acd1fda14fab --- /dev/null +++ b/recipes/libversion/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "3.0.3": + url: "https://github.com/repology/libversion/archive/refs/tags/3.0.3.tar.gz" + sha256: "bb49d745a0c8e692007af6d928046d1ab6b9189f8dbba834cdf3c1d251c94a1d" diff --git a/recipes/libversion/all/conanfile.py b/recipes/libversion/all/conanfile.py new file mode 100644 index 0000000000000..350b19652c4dc --- /dev/null +++ b/recipes/libversion/all/conanfile.py @@ -0,0 +1,91 @@ +import os + +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout, CMakeDeps +from conan.tools.files import copy, get, replace_in_file, rm, rmdir, save +from conan.tools.microsoft import is_msvc + +required_conan_version = ">=1.53.0" + + +class LibversionConan(ConanFile): + name = "libversion" + description = "Advanced version string comparison library" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/repology/libversion" + topics = ("versioning", "version") + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "build_tools": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "build_tools": False, + } + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + # Requires getopt.h and unistd.h + del self.options.build_tools + + 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.generate() + + def _patch_sources(self): + # Disable tests + save(self, os.path.join(self.source_folder, "tests", "CMakeLists.txt"), "") + # Disable tools + if not self.options.get_safe("build_tools"): + save(self, os.path.join(self.source_folder, "utils", "CMakeLists.txt"), "") + # Install only the appropriate target + target = "libversion" if self.options.shared else "libversion_static" + replace_in_file(self, os.path.join(self.source_folder, "libversion", "CMakeLists.txt"), + "install(TARGETS libversion libversion_static EXPORT libversion)", + f"install(TARGETS {target} EXPORT libversion)") + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "COPYING", self.source_folder, os.path.join(self.package_folder, "licenses")) + 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")) + rm(self, "*.pdb", self.package_folder, recursive=True) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "libversion") + self.cpp_info.set_property("cmake_target_name", "libversion::libversion") + self.cpp_info.set_property("pkg_config_name", "libversion") + + if is_msvc(self) and self.options.shared: + self.cpp_info.libs = ["libversion"] + else: + self.cpp_info.libs = ["version"] + + if not self.options.shared: + self.cpp_info.defines.append("LIBVERSION_STATIC_DEFINE") diff --git a/recipes/libversion/all/test_package/CMakeLists.txt b/recipes/libversion/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..83cab1b5e13a3 --- /dev/null +++ b/recipes/libversion/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) + +find_package(libversion REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE libversion::libversion) diff --git a/recipes/libversion/all/test_package/conanfile.py b/recipes/libversion/all/test_package/conanfile.py new file mode 100644 index 0000000000000..ef5d7042163ec --- /dev/null +++ b/recipes/libversion/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libversion/all/test_package/test_package.c b/recipes/libversion/all/test_package/test_package.c new file mode 100644 index 0000000000000..1fde3fd757058 --- /dev/null +++ b/recipes/libversion/all/test_package/test_package.c @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2017-2019 Dmitry Marakasov + * + * 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. + */ + +#include +#include + +int main() { + /* 0.99 < 1.11 */ + assert(version_compare2("0.99", "1.11") == -1); + + /* 1.0 == 1.0.0 */ + assert(version_compare2("1.0", "1.0.0") == 0); + + /* 1.0alpha1 < 1.0.rc1 */ + assert(version_compare2("1.0alpha1", "1.0.rc1") == -1); + + /* 1.0 > 1.0.rc1 */ + assert(version_compare2("1.0", "1.0-rc1") == 1); + + /* 1.2.3alpha4 is the same as 1.2.3~a4 */ + assert(version_compare2("1.2.3alpha4", "1.2.3~a4") == 0); + + /* by default, `p' is treated as `pre'... */ + assert(version_compare2("1.0p1", "1.0pre1") == 0); + assert(version_compare2("1.0p1", "1.0post1") == -1); + assert(version_compare2("1.0p1", "1.0patch1") == -1); + + /* ...but this is tunable: here it's handled as `patch` */ + assert(version_compare4("1.0p1", "1.0pre1", VERSIONFLAG_P_IS_PATCH, 0) == 1); + assert(version_compare4("1.0p1", "1.0post1", VERSIONFLAG_P_IS_PATCH, 0) == 0); + assert(version_compare4("1.0p1", "1.0patch1", VERSIONFLAG_P_IS_PATCH, 0) == 0); + + /* a way to check that the version belongs to a given release */ + assert( + (version_compare4("1.0alpha1", "1.0", 0, VERSIONFLAG_LOWER_BOUND) == 1) && + (version_compare4("1.0alpha1", "1.0", 0, VERSIONFLAG_UPPER_BOUND) == -1) && + (version_compare4("1.0.1", "1.0", 0, VERSIONFLAG_LOWER_BOUND) == 1) && + (version_compare4("1.0.1", "1.0", 0, VERSIONFLAG_UPPER_BOUND) == -1) + /* 1.0alpha1 and 1.0.1 belong to 1.0 release, e.g. they lie between + (lowest possible version in 1.0) and (highest possible version in 1.0) */ + ); +} diff --git a/recipes/libversion/config.yml b/recipes/libversion/config.yml new file mode 100644 index 0000000000000..9542a01cf889e --- /dev/null +++ b/recipes/libversion/config.yml @@ -0,0 +1,3 @@ +versions: + "3.0.3": + folder: all diff --git a/recipes/libverto/all/conanfile.py b/recipes/libverto/all/conanfile.py index 8e6ade5b45b3c..a7c33c03726fe 100644 --- a/recipes/libverto/all/conanfile.py +++ b/recipes/libverto/all/conanfile.py @@ -1,19 +1,26 @@ -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.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, PkgConfigDeps +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.54.0" class LibVertoConan(ConanFile): name = "libverto" description = "An async event loop abstraction library." homepage = "https://github.com/latchset/libverto" - topics = ("libverto", "async", "eventloop") + topics = ("async", "eventloop") license = "MIT" 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], @@ -34,16 +41,6 @@ class LibVertoConan(ConanFile): "with_tevent": False, "default": "libevent", } - 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 +55,9 @@ def _backend_dict(self): "tevent": self.options.with_tevent, } + def export_sources(self): + export_conandata_patches(self) + def config_options(self): if self.settings.os == "Windows": del self.options.fPIC @@ -66,18 +66,32 @@ 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_glib: + self.requires("glib/2.78.1") + if self.options.with_libevent: + self.requires("libevent/2.1.12") + if self.options.with_libev: + self.requires("libev/4.33") + + def package_id(self): + del self.info.options.default 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") if not self._backend_dict[str(self.options.default)]: - raise ConanInvalidConfiguration("Default backend({}) must be available".format(self.options.default)) + raise ConanInvalidConfiguration(f"Default backend({self.options.default}) must be available") count = lambda iterable: sum(1 if it else 0 for it in iterable) count_builtins = count(str(opt) == "builtin" for opt in self._backend_dict.values()) @@ -89,86 +103,58 @@ def validate(self): raise ConanInvalidConfiguration("Cannot have an external backend when building a static libverto") if count_builtins > 0 and count_externals > 0: raise ConanInvalidConfiguration("Cannot combine builtin and external backends") - - def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def requirements(self): - if self.options.with_glib: - self.requires("glib/2.69.2") - if self.options.with_libevent: - self.requires("libevent/2.1.12") - if self.options.with_libev: - self.requires("libev/4.33") if self.options.with_tevent: # FIXME: missing tevent recipe 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/2.0.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 source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + 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")) - - def package_id(self): - del self.info.options.default + 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.components["verto"].set_property("pkg_config_name", "libverto") self.cpp_info.components["verto"].libs = ["verto"] - self.cpp_info.components["verto"].names["pkg_config"] = "libverto" if self.settings.os == "Linux": self.cpp_info.components["verto"].system_libs.append("dl") if self.options.pthread: @@ -177,27 +163,25 @@ def package_info(self): if self.options.with_glib == "builtin": self.cpp_info.components["verto"].requires.append("glib::glib") elif self.options.with_glib: + self.cpp_info.components["verto-glib"].set_property("pkg_config_name", "libverto-glib") self.cpp_info.components["verto-glib"].libs = ["verto-glib"] - self.cpp_info.components["verto-glib"].names["pkg_config"] = "libverto-glib" self.cpp_info.components["verto-glib"].requires = ["verto", "glib::glib"] if self.options.with_libev == "builtin": self.cpp_info.components["verto"].requires.append("libev::libev") elif self.options.with_libev: + self.cpp_info.components["verto-libev"].set_property("pkg_config_name", "libverto-libev") self.cpp_info.components["verto-libev"].libs = ["verto-libev"] - self.cpp_info.components["verto-libev"].names["pkg_config"] = "libverto-libev" self.cpp_info.components["verto-libev"].requires = ["verto", "libev::libev"] if self.options.with_libevent == "builtin": self.cpp_info.components["verto"].requires.append("libevent::libevent") elif self.options.with_libevent: + self.cpp_info.components["verto-libevent"].set_property("pkg_config_name", "libverto-libevent") self.cpp_info.components["verto-libevent"].libs = ["verto-libevent"] - self.cpp_info.components["verto-libevent"].names["pkg_config"] = "libverto-libevent" self.cpp_info.components["verto-libevent"].requires = ["verto", "libevent::libevent"] if self.options.with_tevent: + self.cpp_info.components["verto-tevent"].set_property("pkg_config_name", "libverto-tevent") self.cpp_info.components["verto-tevent"].libs = ["verto-tevent"] - self.cpp_info.components["verto-tevent"].names["pkg_config"] = "libverto-tevent" self.cpp_info.components["verto-tevent"].requires = ["verto", "tevent::tevent"] - - self.user_info.backends = ",".join(tuple(backend for backend, opt in self._backend_dict.items() if opt != False)) diff --git a/recipes/libverto/all/test_package/CMakeLists.txt b/recipes/libverto/all/test_package/CMakeLists.txt index 7b9b613cbb24a..78d37a6a36d00 100644 --- a/recipes/libverto/all/test_package/CMakeLists.txt +++ b/recipes/libverto/all/test_package/CMakeLists.txt @@ -1,8 +1,22 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +enable_testing() + +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) + +if(LIBVERTO_WITH_GLIB) + add_test(NAME libverto_with_glib COMMAND ${PROJECT_NAME} glib) +endif() +if(LIBVERTO_WITH_LIBEV) + add_test(NAME libverto_with_libev COMMAND ${PROJECT_NAME} libev) +endif() +if(LIBVERTO_WITH_LIBEVENT) + add_test(NAME libverto_with_libevent COMMAND ${PROJECT_NAME} libevent) +endif() +if(LIBVERTO_WITH_TEVENT) + add_test(NAME libverto_with_tevent COMMAND ${PROJECT_NAME} tevent) +endif() diff --git a/recipes/libverto/all/test_package/conanfile.py b/recipes/libverto/all/test_package/conanfile.py index 8ceb9511ce02d..010f253d06fa3 100644 --- a/recipes/libverto/all/test_package/conanfile.py +++ b/recipes/libverto/all/test_package/conanfile.py @@ -1,10 +1,28 @@ -from conans import ConanFile, CMake, tools -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" + 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) + libverto_options = self.dependencies["libverto"].options + tc.variables["LIBVERTO_WITH_GLIB"] = bool(libverto_options.with_glib) + tc.variables["LIBVERTO_WITH_LIBEV"] = bool(libverto_options.with_libev) + tc.variables["LIBVERTO_WITH_LIBEVENT"] = bool(libverto_options.with_libevent) + tc.variables["LIBVERTO_WITH_TEVENT"] = bool(libverto_options.with_tevent) + tc.generate() def build(self): cmake = CMake(self) @@ -12,9 +30,6 @@ def build(self): 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) - + 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/libverto/all/test_v1_package/CMakeLists.txt b/recipes/libverto/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..c23ed5cfe6d98 --- /dev/null +++ b/recipes/libverto/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/libverto/all/test_v1_package/conanfile.py b/recipes/libverto/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..dba2a86154e1e --- /dev/null +++ b/recipes/libverto/all/test_v1_package/conanfile.py @@ -0,0 +1,19 @@ +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.definitions["LIBVERTO_WITH_GLIB"] = bool(self.options["libverto"].with_glib) + cmake.definitions["LIBVERTO_WITH_LIBEV"] = bool(self.options["libverto"].with_libev) + cmake.definitions["LIBVERTO_WITH_LIBEVENT"] = bool(self.options["libverto"].with_libevent) + cmake.definitions["LIBVERTO_WITH_TEVENT"] = bool(self.options["libverto"].with_tevent) + 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/libvips/all/conandata.yml b/recipes/libvips/all/conandata.yml new file mode 100644 index 0000000000000..83aa22c513b0b --- /dev/null +++ b/recipes/libvips/all/conandata.yml @@ -0,0 +1,19 @@ +sources: + "8.15.3": + url: "https://github.com/libvips/libvips/releases/download/v8.15.3/vips-8.15.3.tar.xz" + sha256: "3e27d9f536eafad64013958fe9e8a1964c90b564c731d49db7c1a1c11b1052a0" + "8.15.2": + url: "https://github.com/libvips/libvips/releases/download/v8.15.2/vips-8.15.2.tar.xz" + sha256: "a2ab15946776ca7721d11cae3215f20f1f097b370ff580cd44fc0f19387aee84" + "8.15.1": + url: "https://github.com/libvips/libvips/releases/download/v8.15.1/vips-8.15.1.tar.xz" + sha256: "06811f5aed3e7bc03e63d05537ff4b501de5283108c8ee79396c60601a00830c" + "8.14.2": + url: "https://github.com/libvips/libvips/releases/download/v8.14.2/vips-8.14.2.tar.xz" + sha256: "27dad021f0835a5ab14e541d02abd41e4c3bd012d2196438df5a9e754984f7ce" +patches: + "8.15.3": + - patch_file: "patches/0001-fix-8-15-3-msvc-build.patch" + patch_description: "Fix broken msvc build due to ssize_t" + patch_type: "portability" + patch_source: "https://github.com/libvips/libvips/pull/4153" diff --git a/recipes/libvips/all/conanfile.py b/recipes/libvips/all/conanfile.py new file mode 100644 index 0000000000000..559a6bbfdb975 --- /dev/null +++ b/recipes/libvips/all/conanfile.py @@ -0,0 +1,415 @@ +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 copy, get, replace_in_file, rm, rmdir, apply_conandata_patches, export_conandata_patches +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, is_msvc_static_runtime +from conan.tools.scm import Version +import os + +required_conan_version = ">=1.60.0 <2.0 || >=2.0.6" + + +class LibvipsConan(ConanFile): + name = "libvips" + description = "libvips is a demand-driven, horizontally threaded image processing library." + license = "LGPL-2.1-or-later" + topics = ("image", "image-processing") + homepage = "https://www.libvips.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], + "deprecated": [True, False], + "cpp": [True, False], + "introspection": [True, False], + "vapi": [True, False], + "with_archive": [True, False], + "with_cfitsio": [True, False], + "with_cgif": [True, False], + "with_exif": [True, False], + "with_fftw": [True, False], + "with_fontconfig": [True, False], + "with_heif": [True, False], + "with_highway": [True, False], + "with_imagequant": [True, False], + "with_jpeg": ["libjpeg", "libjpeg-turbo", "mozjpeg", False], + "with_jpeg_xl": [True, False], + "with_lcms": [True, False], + "with_magick": [True, False], + "with_matio": [True, False], + "with_nifti": [True, False], + "with_openexr": [True, False], + "with_openjpeg": [True, False], + "with_openslide": [True, False], + "with_orc": [True, False], + "with_pangocairo": [True, False], + "with_pdfium": [True, False], + "with_png": ["libpng", "libspng", False], + "with_poppler": [True, False], + "with_quantizr": [True, False], + "with_rsvg": [True, False], + "with_tiff": [True, False], + "with_webp": [True, False], + "with_zlib": [True, False], + "with_nsgif": [True, False], + "with_ppm": [True, False], + "with_analyse": [True, False], + "with_radiance": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "deprecated": True, + "cpp": True, + "introspection": False, + "vapi": False, + "with_archive": False, + "with_cfitsio": False, + "with_cgif": False, + "with_exif": False, + "with_fftw": True, + "with_fontconfig": False, + "with_heif": False, + "with_highway": False, + "with_imagequant": False, + "with_jpeg": "libjpeg", + "with_jpeg_xl": False, + "with_lcms": True, + "with_magick": False, + "with_matio": False, + "with_nifti": False, + "with_openexr": False, + "with_openjpeg": False, + "with_openslide": False, + "with_orc": False, + "with_pangocairo": False, + "with_pdfium": False, + "with_png": "libspng", + "with_poppler": False, + "with_quantizr": False, + "with_rsvg": False, + "with_tiff": True, + "with_webp": True, + "with_zlib": True, + "with_nsgif": True, + "with_ppm": True, + "with_analyse": True, + "with_radiance": True, + } + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + if Version(self.version) < "8.15": + del self.options.with_archive + del self.options.with_highway + if is_msvc(self): + # deprecated build fails with + # vips7compat.h(1661): error C2016: C requires that a struct or union have at least one member + self.options.deprecated = False + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + if not self.options.cpp: + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("expat/[>=2.6.2 <3]") + self.requires("glib/2.78.3", transitive_headers=True, transitive_libs=True) + if self.options.get_safe("with_archive"): + self.requires("libarchive/3.7.2") + if self.options.with_cfitsio: + self.requires("cfitsio/4.3.0") + if self.options.with_cgif: + self.requires("cgif/0.3.2") + if self.options.with_exif: + self.requires("libexif/0.6.24") + if self.options.with_fftw: + self.requires("fftw/3.3.10") + if self.options.with_fontconfig: + self.requires("fontconfig/2.15.0") + if self.options.with_heif: + self.requires("libheif/1.16.2") + if self.options.get_safe("with_highway"): + self.requires("highway/1.0.7") + if self.options.with_jpeg == "libjpeg": + self.requires("libjpeg/9e") + elif self.options.with_jpeg == "libjpeg-turbo": + self.requires("libjpeg-turbo/3.0.2") + elif self.options.with_jpeg == "mozjpeg": + self.requires("mozjpeg/4.1.5") + if self.options.with_jpeg_xl: + self.requires("libjxl/0.6.1") + if self.options.with_lcms: + self.requires("lcms/2.16") + if self.options.with_magick: + self.requires("imagemagick/7.0.11-14") + if self.options.with_matio: + self.requires("matio/1.5.24") + if self.options.with_openexr: + self.requires("openexr/3.2.3") + if self.options.with_openjpeg: + self.requires("openjpeg/2.5.2") + if self.options.with_pangocairo: + self.requires("pango/1.50.10") + if self.options.with_pdfium: + self.requires("pdfium/95.0.4629") + if self.options.with_png == "libpng": + self.requires("libpng/[>=1.6 <2]") + elif self.options.with_png == "libspng": + self.requires("libspng/0.7.4") + if self.options.with_poppler: + self.requires("poppler/21.07.0") + if self.options.with_tiff: + self.requires("libtiff/4.6.0") + if self.options.with_webp: + self.requires("libwebp/1.3.2") + if self.options.with_zlib: + self.requires("zlib/[>=1.2.11 <2]") + + def validate(self): + if self.options.vapi and not self.options.introspection: + raise ConanInvalidConfiguration("vapi requires introspection") + if self.options.with_pangocairo and not self.dependencies["pango"].options.with_cairo: + raise ConanInvalidConfiguration(f"{self.ref}:with_pangocairo=True requires pango/*:with_cairo=True") + if self.options.with_pdfium and self.options.with_poppler: + raise ConanInvalidConfiguration("pdf support is enabled either with pdfium or poppler") + if self.options.with_cgif and not (self.options.with_imagequant or self.options.with_quantizr): + raise ConanInvalidConfiguration("with_cgif requires either with_imagequant or with_quantizr") + + if Version(self.version) >= "8.15" and self.settings.compiler.cppstd: + check_min_cppstd(self, 11) + + # Visual Studio < 2019 doesn't seem to like pointer restrict of pointer restrict in libnsgif + check_min_vs(self, "192") + + if is_msvc(self) and is_msvc_static_runtime(self) and not self.options.shared and \ + self.dependencies["glib"].options.shared: + raise ConanInvalidConfiguration( + f"{self.ref} static with MT runtime not supported if glib shared due to conancenter CI limitations" + ) + + if self.options.with_imagequant: + raise ConanInvalidConfiguration("libimagequant recipe not available in conancenter yet") + if self.options.with_nifti: + raise ConanInvalidConfiguration("nifti recipe not available in conancenter yet") + if self.options.with_openslide: + raise ConanInvalidConfiguration("openslide recipe not available in conancenter yet") + if self.options.with_orc: + raise ConanInvalidConfiguration("orc recipe not available in conancenter yet") + if self.options.with_quantizr: + raise ConanInvalidConfiguration("quantizr recipe not available in conancenter yet") + if self.options.with_rsvg: + raise ConanInvalidConfiguration("librsvg recipe not available in conancenter yet") + + def build_requirements(self): + self.tool_requires("meson/1.4.0") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/2.1.0") + if self.options.introspection: + self.tool_requires("gobject-introspection/1.72.0") + self.tool_requires("glib/") + + if self.settings.os == "Macos": + # Avoid using gettext from homebrew which may be linked against + # a different/incompatible libiconv than the one being exposed + # in the runtime environment (DYLD_LIBRARY_PATH) + # See https://github.com/conan-io/conan-center-index/pull/17502#issuecomment-1542492466 + self.tool_requires("gettext/0.22.5") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + + tc = MesonToolchain(self) + true_false = lambda v: "true" if v else "false" + enabled_disabled = lambda v: "enabled" if v else "disabled" + tc.project_options["deprecated"] = true_false(self.options.deprecated) + tc.project_options["examples"] = "false" + tc.project_options["cplusplus"] = true_false(self.options.cpp) + tc.project_options["doxygen"] = "false" + tc.project_options["gtk_doc"] = "false" + tc.project_options["modules"] = "disabled" + tc.project_options["introspection"] = ( + enabled_disabled(self.options.introspection) + if Version(self.version) >= "8.15" else + true_false(self.options.introspection) + ) + tc.project_options["vapi"] = true_false(self.options.vapi) + # External libraries + if Version(self.version) >= "8.15": + tc.project_options["archive"] = enabled_disabled(self.options.get_safe("with_archive")) + tc.project_options["cfitsio"] = enabled_disabled(self.options.with_cfitsio) + tc.project_options["cgif"] = enabled_disabled(self.options.with_cgif) + tc.project_options["exif"] = enabled_disabled(self.options.with_exif) + tc.project_options["fftw"] = enabled_disabled(self.options.with_fftw) + tc.project_options["fontconfig"] = enabled_disabled(self.options.with_fontconfig) + tc.project_options["heif"] = enabled_disabled(self.options.with_heif) + tc.project_options["heif-module"] = "disabled" + if Version(self.version) >= "8.15": + tc.project_options["highway"] = enabled_disabled(self.options.with_highway) + tc.project_options["imagequant"] = enabled_disabled(self.options.with_imagequant) + tc.project_options["jpeg"] = enabled_disabled(bool(self.options.with_jpeg)) + tc.project_options["jpeg-xl"] = enabled_disabled(self.options.with_jpeg_xl) + tc.project_options["jpeg-xl-module"] = "disabled" + tc.project_options["lcms"] = enabled_disabled(self.options.with_lcms) + tc.project_options["magick"] = enabled_disabled(self.options.with_magick) + tc.project_options["magick-module"] = "disabled" + tc.project_options["matio"] = enabled_disabled(self.options.with_matio) + tc.project_options["nifti"] = enabled_disabled(self.options.with_nifti) + tc.project_options["openexr"] = enabled_disabled(self.options.with_openexr) + tc.project_options["openjpeg"] = enabled_disabled(self.options.with_openjpeg) + tc.project_options["openslide"] = enabled_disabled(self.options.with_openslide) + tc.project_options["openslide-module"] = "disabled" + tc.project_options["orc"] = enabled_disabled(self.options.with_orc) + tc.project_options["pangocairo"] = enabled_disabled(self.options.with_pangocairo) + tc.project_options["pdfium"] = enabled_disabled(self.options.with_pdfium) + tc.project_options["png"] = enabled_disabled(self.options.with_png == "libpng") + tc.project_options["poppler"] = enabled_disabled(self.options.with_poppler) + tc.project_options["poppler-module"] = "disabled" + tc.project_options["quantizr"] = enabled_disabled(self.options.with_quantizr) + tc.project_options["rsvg"] = enabled_disabled(self.options.with_rsvg) + tc.project_options["spng"] = enabled_disabled(self.options.with_png == "libspng") + tc.project_options["tiff"] = enabled_disabled(self.options.with_tiff) + tc.project_options["webp"] = enabled_disabled(self.options.with_webp) + tc.project_options["zlib"] = enabled_disabled(self.options.with_zlib) + # Other supported formats without external libs + tc.project_options["nsgif"] = true_false(self.options.with_nsgif) + tc.project_options["ppm"] = true_false(self.options.with_ppm) + tc.project_options["analyze"] = true_false(self.options.with_analyse) + tc.project_options["radiance"] = true_false(self.options.with_radiance) + tc.generate() + + deps = PkgConfigDeps(self) + deps.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + + # Disable tests + meson_build = os.path.join(self.source_folder, "meson.build") + replace_in_file(self, meson_build, "subdir('test')", "") + replace_in_file(self, meson_build, "subdir('fuzz')", "") + + # workaround https://github.com/conan-io/conan/issues/14213 + replace_in_file(self, meson_build, + "cfg_var.set_quoted('VIPS_PREFIX', prefix_dir)", + "cfg_var.set_quoted('VIPS_PREFIX', prefix_dir.replace('\\\\', '/'))" + ) + + def build(self): + self._patch_sources() + meson = Meson(self) + meson.configure() + meson.build() + + def package(self): + copy(self, "LICENSE", 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")) + 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.components["vips"].set_property("pkg_config_name", "vips") + self.cpp_info.components["vips"].libs = ["vips"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["vips"].system_libs.extend(["m", "pthread"]) + self.cpp_info.components["vips"].requires = [ + "expat::expat", "glib::glib-2.0", "glib::gio-2.0", "glib::gobject-2.0", + ] + if self.options.get_safe("with_archive"): + self.cpp_info.components["vips"].requires.append("libarchive::libarchive") + if self.options.with_cfitsio: + self.cpp_info.components["vips"].requires.append("cfitsio::cfitsio") + if self.options.with_cgif: + self.cpp_info.components["vips"].requires.append("cgif::cgif") + if self.options.with_exif: + self.cpp_info.components["vips"].requires.append("libexif::libexif") + if self.options.with_fftw: + self.cpp_info.components["vips"].requires.append("fftw::fftw") + if self.options.with_fontconfig: + self.cpp_info.components["vips"].requires.append("fontconfig::fontconfig") + if self.options.with_heif: + self.cpp_info.components["vips"].requires.append("libheif::libheif") + if self.options.get_safe("with_highway"): + self.cpp_info.components["vips"].requires.append("highway::highway") + if self.options.with_jpeg == "libjpeg": + self.cpp_info.components["vips"].requires.append("libjpeg::libjpeg") + elif self.options.with_jpeg == "libjpeg-turbo": + self.cpp_info.components["vips"].requires.append("libjpeg-turbo::jpeg") + elif self.options.with_jpeg == "mozjpeg": + self.cpp_info.components["vips"].requires.append("mozjpeg::libjpeg") + if self.options.with_jpeg_xl: + self.cpp_info.components["vips"].requires.append("libjxl::libjxl") + if self.options.with_lcms: + self.cpp_info.components["vips"].requires.append("lcms::lcms") + if self.options.with_magick: + self.cpp_info.components["vips"].requires.append("imagemagick::MagickCore") + if self.options.with_matio: + self.cpp_info.components["vips"].requires.append("matio::matio") + if self.options.with_openexr: + self.cpp_info.components["vips"].requires.append("openexr::openexr") + if self.options.with_openjpeg: + self.cpp_info.components["vips"].requires.append("openjpeg::openjpeg") + if self.options.with_pangocairo: + self.cpp_info.components["vips"].requires.append("pango::pangocairo") + if self.options.with_pdfium: + self.cpp_info.components["vips"].requires.append("pdfium::pdfium") + if self.options.with_png == "libpng": + self.cpp_info.components["vips"].requires.append("libpng::libpng") + elif self.options.with_png == "libspng": + self.cpp_info.components["vips"].requires.append("libspng::libspng") + if self.options.with_poppler: + self.cpp_info.components["vips"].requires.append("poppler::poppler") + if self.options.with_tiff: + self.cpp_info.components["vips"].requires.append("libtiff::libtiff") + if self.options.with_webp: + self.cpp_info.components["vips"].requires.append("libwebp::libwebp") + if self.options.with_zlib: + self.cpp_info.components["vips"].requires.append("zlib::zlib") + + if self.options.cpp: + self.cpp_info.components["vips-cpp"].set_property("pkg_config_name", "vips-cpp") + self.cpp_info.components["vips-cpp"].libs = ["vips-cpp"] + self.cpp_info.components["vips-cpp"].requires = ["vips"] + + # TODO: to remove once conan v1 support dropped + 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 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/libvips/all/patches/0001-fix-8-15-3-msvc-build.patch b/recipes/libvips/all/patches/0001-fix-8-15-3-msvc-build.patch new file mode 100644 index 0000000000000..fb781f613a9aa --- /dev/null +++ b/recipes/libvips/all/patches/0001-fix-8-15-3-msvc-build.patch @@ -0,0 +1,36 @@ +From a1f3bf3c98d21b09a75f57682cdb12a6e48ebb08 Mon Sep 17 00:00:00 2001 +From: Julianiolo <50519317+Julianiolo@users.noreply.github.com> +Date: Fri, 13 Sep 2024 21:31:02 +0200 +Subject: [PATCH] replace ssize_t with gint64 + +--- + libvips/iofuncs/generate.c | 2 +- + libvips/iofuncs/util.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/libvips/iofuncs/generate.c b/libvips/iofuncs/generate.c +index bb3d1b2d7..8941762f7 100644 +--- a/libvips/iofuncs/generate.c ++++ b/libvips/iofuncs/generate.c +@@ -638,7 +638,7 @@ write_vips(VipsRegion *region, VipsRect *area, void *a) + // write() uses int not size_t on windows, so we need to chunk + // ... max 1gb, why not + int chunk_size = VIPS_MIN(1024 * 1024 * 1024, count); +- ssize_t nwritten = write(region->im->fd, buf, chunk_size); ++ gint64 nwritten = write(region->im->fd, buf, chunk_size); + + /* n == 0 isn't strictly an error, but we treat it as + * one to make sure we don't get stuck in this loop. +diff --git a/libvips/iofuncs/util.c b/libvips/iofuncs/util.c +index 46976ef42..acf78ade8 100644 +--- a/libvips/iofuncs/util.c ++++ b/libvips/iofuncs/util.c +@@ -541,7 +541,7 @@ vips__write(int fd, const void *buf, size_t count) + // write() uses int not size_t on windows, so we need to chunk + // ... max 1gb, why not + int chunk_size = VIPS_MIN(1024 * 1024 * 1024, count); +- ssize_t nwritten = write(fd, buf, chunk_size); ++ gint64 nwritten = write(fd, buf, chunk_size); + + /* n == 0 isn't strictly an error, but we treat it as + * one to make sure we don't get stuck in this loop. diff --git a/recipes/libvips/all/test_package/CMakeLists.txt b/recipes/libvips/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..a0c5a27965e1f --- /dev/null +++ b/recipes/libvips/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +find_package(libvips REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE libvips::vips) diff --git a/recipes/libvips/all/test_package/conanfile.py b/recipes/libvips/all/test_package/conanfile.py new file mode 100644 index 0000000000000..ea70607af0172 --- /dev/null +++ b/recipes/libvips/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") + img_path = os.path.join(self.source_folder, "testimg.jpg") + self.run(f"{bin_path} {img_path}", env="conanrun") diff --git a/recipes/libvips/all/test_package/test_package.c b/recipes/libvips/all/test_package/test_package.c new file mode 100644 index 0000000000000..4218e858f81db --- /dev/null +++ b/recipes/libvips/all/test_package/test_package.c @@ -0,0 +1,29 @@ +#include + +#include + +int main(int argc, char **argv) { + VipsImage *in; + double mean; + VipsImage *out; + + if (VIPS_INIT(argv[0])) vips_error_exit(NULL); + + if (argc < 2) vips_error_exit("usage: %s infile", argv[0]); + + if (!(in = vips_image_new_from_file(argv[1], NULL))) vips_error_exit(NULL); + + printf("image width = %d\n", vips_image_get_width(in)); + + if (vips_avg(in, &mean, NULL)) vips_error_exit(NULL); + + if (vips_invert(in, &out, NULL)) vips_error_exit(NULL); + + g_object_unref(in); + + if (vips_image_write_to_file(out, "out.jpg", NULL)) vips_error_exit(NULL); + + g_object_unref(out); + + return 0; +} diff --git a/recipes/jpeg-compressor/all/test_package/testimg.jpg b/recipes/libvips/all/test_package/testimg.jpg similarity index 100% rename from recipes/jpeg-compressor/all/test_package/testimg.jpg rename to recipes/libvips/all/test_package/testimg.jpg diff --git a/recipes/libvips/all/test_v1_package/CMakeLists.txt b/recipes/libvips/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libvips/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libvips/all/test_v1_package/conanfile.py b/recipes/libvips/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..ff285a92f9ca9 --- /dev/null +++ b/recipes/libvips/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/libvips/config.yml b/recipes/libvips/config.yml new file mode 100644 index 0000000000000..3f10cc1059b5d --- /dev/null +++ b/recipes/libvips/config.yml @@ -0,0 +1,9 @@ +versions: + "8.15.3": + folder: all + "8.15.2": + folder: all + "8.15.1": + folder: all + "8.14.2": + folder: all diff --git a/recipes/libvpx/all/conandata.yml b/recipes/libvpx/all/conandata.yml index 16a335bc9457b..556d9f33bcae4 100644 --- a/recipes/libvpx/all/conandata.yml +++ b/recipes/libvpx/all/conandata.yml @@ -1,22 +1,27 @@ sources: + "1.14.1": + url: "https://github.com/webmproject/libvpx/archive/refs/tags/v1.14.1.tar.gz" + sha256: "901747254d80a7937c933d03bd7c5d41e8e6c883e0665fadcb172542167c7977" + "1.14.0": + url: "https://github.com/webmproject/libvpx/archive/refs/tags/v1.14.0.tar.gz" + sha256: "5f21d2db27071c8a46f1725928a10227ae45c5cd1cad3727e4aafbe476e321fa" + "1.13.1": + url: "https://github.com/webmproject/libvpx/archive/refs/tags/v1.13.1.tar.gz" + sha256: "00dae80465567272abd077f59355f95ac91d7809a2d3006f9ace2637dd429d14" "1.11.0": - url: "https://github.com/webmproject/libvpx/archive/v1.11.0.tar.gz" + url: "https://github.com/webmproject/libvpx/archive/refs/tags/v1.11.0.tar.gz" sha256: "965e51c91ad9851e2337aebcc0f517440c637c506f3a03948062e3d5ea129a83" "1.10.0": - url: "https://github.com/webmproject/libvpx/archive/v1.10.0.tar.gz" + url: "https://github.com/webmproject/libvpx/archive/refs/tags/v1.10.0.tar.gz" sha256: "85803ccbdbdd7a3b03d930187cb055f1353596969c1f92ebec2db839fa4f834a" - "1.9.0": - url: "https://github.com/webmproject/libvpx/archive/v1.9.0.tar.gz" - sha256: "d279c10e4b9316bf11a570ba16c3d55791e1ad6faa4404c67422eb631782c80a" 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" + patch_source: "https://github.com/webmproject/libvpx/commit/cafe7cc1f10cfea74edb2ded7c3df2d69fcf1eee" "1.10.0": - patch_file: "patches/0001-extended-support-1.10.0.patch" - base_path: "source_subfolder" - "1.9.0": - - patch_file: "patches/0001-extended-support-1.9.0.patch" - base_path: "source_subfolder" - - patch_file: "patches/0002-msvc_conan_build.patch" - base_path: "source_subfolder" + patch_type: "portability" + patch_description: "Add support for more compilers" + patch_source: "https://github.com/webmproject/libvpx/commit/cafe7cc1f10cfea74edb2ded7c3df2d69fcf1eee" diff --git a/recipes/libvpx/all/conanfile.py b/recipes/libvpx/all/conanfile.py index 4c8ca454f41e5..babc16fe80346 100644 --- a/recipes/libvpx/all/conanfile.py +++ b/recipes/libvpx/all/conanfile.py @@ -1,12 +1,19 @@ -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 import os import re -required_conan_version = ">=1.43.0" +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.build import stdcpp_library +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, is_msvc_static_runtime, msvc_runtime_flag +from conan.tools.scm import Version + +required_conan_version = ">=1.57.0" class LibVPXConan(ConanFile): @@ -14,9 +21,10 @@ 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" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -33,16 +41,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': @@ -52,95 +55,73 @@ def config_options(self): delattr(self.options, name) def configure(self): - if self.options.shared: - del self.options.fPIC + if self.settings.os == "Windows": + del self.options.shared + self.package_type = "static-library" + if self.options.get_safe("shared"): + self.options.rm_safe("fPIC") + if self.settings.os == "Android": + del self.options.shared + self.package_type = "static-library" + + def layout(self): + basic_layout(self, src_folder="src") 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) + if self.settings.os == "iOS" and (self.settings.os.sdk != "iphonesimulator" and self.settings.arch in ["x86_64", "x86"]): + raise ConanInvalidConfiguration("iOS platform with x86/x86_64 architectures only supports 'iphonesimulator' SDK option") 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) + 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) - # 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", - ) - - @functools.lru_cache(1) - def _configure_autotools(self): - args = [ - "--prefix={}".format(tools.unix_path(self.package_folder)), - "--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') - 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') + @property + def _install_tmp_folder(self): + return "tmp_install" + @property + def _target_name(self): arch = {'x86': 'x86', 'x86_64': 'x86_64', 'armv7': 'armv7', + 'armv7s': 'armv7s', 'armv8': 'arm64', '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) + compiler = str(self.settings.compiler) + os_name = str(self.settings.os) + if str(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", "194": "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": - os_name = 'darwin20' + if self.settings.os == "Macos": + os_name = f'darwin11' + else: + os_name = 'iphonesimulator' + elif self.settings.arch == "armv8": + os_name = 'darwin21' else: - # Unrecognized toolchain 'arm64-darwin11-gcc', see list of toolchains in ./configure --help os_name = 'darwin' elif host_os == 'Linux': os_name = 'linux' @@ -148,53 +129,146 @@ 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) + return f"{arch}-{os_name}-{compiler}" + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + 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++ + tc.extra_ldflags.append("-stdlib=libc++") + + tc.configure_args.extend([ + "--disable-examples", + "--disable-unit-tests", + "--disable-tools", + "--disable-docs", + "--enable-vp9-highbitdepth", + "--as=yasm", + ]) + # 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": + tc.configure_args.extend([ + "--enable-debug" + ]) + if is_msvc(self) and is_msvc_static_runtime(self): + tc.configure_args.append("--enable-static-msvcrt") 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: + tc.configure_args.append(f"--disable-{name}") + + tc.update_configure_args({ + # 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 + "--prefix": f"/{self._install_tmp_folder}", + "--libdir": f"/{self._install_tmp_folder}/lib", + # Needed to let libvpx use the correct toolchain for the target platform + "--target": self._target_name, + # several options must not be injected as custom configure doesn't like them + "--host": None, + "--build": None, + "--bindir": None, + "--sbindir": None, + "--includedir": None, + "--oldincludedir": None, + "--datarootdir": None, + }) + + if is_msvc(self): # 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 + env = Environment() + env.define("CC", "") + else: + env = tc.environment() + tc.generate(env) + + def _patch_sources(self): + 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") + + # 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 +""" + ) def build(self): self._patch_sources() - with tools.vcvars(self) if self._is_msvc else tools.no_op(): - autotools = self._configure_autotools() - autotools.make() + autotools = Autotools(self) + autotools.configure() + autotools.make() + + @property + def _lib_name(self): + suffix = msvc_runtime_flag(self).lower() if is_msvc(self) else "" + return f"vpx{suffix}" 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", - ) - self.copy("vpx*.lib", src=libdir, dst="lib") + copy(self, pattern="LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + autotools.install() + + # The workaround requires us to move the outputs into place now + rename(self, + os.path.join(self.package_folder, self._install_tmp_folder, "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, self._install_tmp_folder, "lib") + rename(self, libs_from, os.path.join(self.package_folder, "lib")) + + rmdir(self, os.path.join(self.package_folder, self._install_tmp_folder)) + 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}"] - if not self.options.shared: - libcxx = tools.stdcpp_library(self) + self.cpp_info.libs = [self._lib_name] + if not self.options.get_safe("shared"): + libcxx = stdcpp_library(self) if libcxx: self.cpp_info.system_libs.append(libcxx) - - # TODO: to remove in conan v2 once pkg_config generator removed - self.cpp_info.names["pkg_config"] = "vpx" + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["m", "pthread"]) diff --git a/recipes/libvpx/all/patches/0001-extended-support-1.9.0.patch b/recipes/libvpx/all/patches/0001-extended-support-1.9.0.patch deleted file mode 100644 index 7e10a765c149c..0000000000000 --- a/recipes/libvpx/all/patches/0001-extended-support-1.9.0.patch +++ /dev/null @@ -1,58 +0,0 @@ ---- a/build/make/gen_msvs_sln.sh -+++ b/build/make/gen_msvs_sln.sh -@@ -219,6 +219,7 @@ for opt in "$@"; do - 14) vs_year=2015 ;; - 15) vs_year=2017 ;; - 16) vs_year=2019 ;; -+ 17) vs_year=2022 ;; - *) die Unrecognized Visual Studio Version in $opt ;; - esac - ;; -@@ -232,7 +233,7 @@ done - outfile=${outfile:-/dev/stdout} - mkoutfile=${mkoutfile:-/dev/stdout} - case "${vs_ver}" in -- 1[4-6]) -+ 1[4-7]) - # VS has used Format Version 12.00 continuously since vs11. - sln_vers="12.00" - sln_vers_str="Visual Studio ${vs_year}" ---- a/build/make/gen_msvs_vcxproj.sh -+++ b/build/make/gen_msvs_vcxproj.sh -@@ -168,7 +168,7 @@ for opt in "$@"; do - --ver=*) - vs_ver="$optval" - case "$optval" in -- 1[4-6]) -+ 1[4-7]) - ;; - *) die Unrecognized Visual Studio Version in $opt - ;; -@@ -342,6 +342,9 @@ generate_vcxproj() { - if [ "$vs_ver" = "16" ]; then - tag_content PlatformToolset v142 - fi -+ if [ "$vs_ver" = "17" ]; then -+ tag_content PlatformToolset v143 -+ fi - tag_content CharacterSet Unicode - if [ "$config" = "Release" ]; then - tag_content WholeProgramOptimization true ---- a/configure -+++ b/configure -@@ -138,6 +138,7 @@ all_platforms="${all_platforms} x86-win32-gcc" - all_platforms="${all_platforms} x86-win32-vs14" - all_platforms="${all_platforms} x86-win32-vs15" - all_platforms="${all_platforms} x86-win32-vs16" -+all_platforms="${all_platforms} x86-win32-vs17" - all_platforms="${all_platforms} x86_64-android-gcc" - all_platforms="${all_platforms} x86_64-darwin9-gcc" - all_platforms="${all_platforms} x86_64-darwin10-gcc" -@@ -158,6 +159,7 @@ all_platforms="${all_platforms} x86_64-win64-gcc" - all_platforms="${all_platforms} x86_64-win64-vs14" - all_platforms="${all_platforms} x86_64-win64-vs15" - all_platforms="${all_platforms} x86_64-win64-vs16" -+all_platforms="${all_platforms} x86_64-win64-vs17" - all_platforms="${all_platforms} generic-gnu" - - # all_targets is a list of all targets that can be configured diff --git a/recipes/libvpx/all/patches/0002-msvc_conan_build.patch b/recipes/libvpx/all/patches/0002-msvc_conan_build.patch deleted file mode 100644 index 28885c1c83394..0000000000000 --- a/recipes/libvpx/all/patches/0002-msvc_conan_build.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/build/make/msvs_common.sh b/build/make/msvs_common.sh -index 27ddf7f..da462ec 100644 ---- a/build/make/msvs_common.sh -+++ b/build/make/msvs_common.sh -@@ -9,7 +9,7 @@ - ## be found in the AUTHORS file in the root of the source tree. - ## - --if [ "$(uname -o 2>/dev/null)" = "Cygwin" ] \ -+if [ "$(uname -o 2>/dev/null)" = "Cygwin" ] || [ "$(uname -o 2>/dev/null)" = "Msys" ]\ - && cygpath --help >/dev/null 2>&1; then - FIXPATH='cygpath -m' - else diff --git a/recipes/libvpx/all/test_package/CMakeLists.txt b/recipes/libvpx/all/test_package/CMakeLists.txt index 657b40cd58a00..2cd854f46c254 100644 --- a/recipes/libvpx/all/test_package/CMakeLists.txt +++ b/recipes/libvpx/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(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..e845ae751a301 100644 --- a/recipes/libvpx/all/test_package/conanfile.py +++ b/recipes/libvpx/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/openh264/all/test_v1_package/CMakeLists.txt b/recipes/libvpx/all/test_v1_package/CMakeLists.txt similarity index 100% rename from recipes/openh264/all/test_v1_package/CMakeLists.txt rename to recipes/libvpx/all/test_v1_package/CMakeLists.txt 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/libvpx/config.yml b/recipes/libvpx/config.yml index 460cf69bd04b2..33ef774be6ba3 100644 --- a/recipes/libvpx/config.yml +++ b/recipes/libvpx/config.yml @@ -1,7 +1,11 @@ versions: + "1.14.1": + folder: all + "1.14.0": + folder: all + "1.13.1": + folder: all "1.11.0": folder: all "1.10.0": folder: all - "1.9.0": - folder: all diff --git a/recipes/libwebm/all/conandata.yml b/recipes/libwebm/all/conandata.yml new file mode 100644 index 0000000000000..db15e75e26a4f --- /dev/null +++ b/recipes/libwebm/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "1.0.0.31": + url: "https://github.com/webmproject/libwebm/archive/refs/tags/libwebm-1.0.0.31.tar.gz" + sha256: "616cfdca1c869222dc60d5a49d112c1464040390e3876afca4d385347c6ce55e" + "1.0.0.30": + url: "https://github.com/webmproject/libwebm/archive/refs/tags/libwebm-1.0.0.30.tar.gz" + sha256: "6c1381fd1a66e86e095b76028ede696724e198ea0e39957c9649af5f0718b96a" diff --git a/recipes/libwebm/all/conanfile.py b/recipes/libwebm/all/conanfile.py new file mode 100644 index 0000000000000..e295fe0e53c02 --- /dev/null +++ b/recipes/libwebm/all/conanfile.py @@ -0,0 +1,73 @@ +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 LibwebmConan(ConanFile): + name = "libwebm" + description = "Library for muxing and demuxing WebM media container files" + topics = ("webm", "container", "demuxing", "muxing", "media", "audio", "video") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://chromium.googlesource.com/webm/libwebm/" + license = "BSD-3-Clause" + + settings = "os", "arch", "compiler", "build_type" + + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_pes_ts": [True, False], + "with_new_parser_api": [True, False], + } + + default_options = { + "shared": False, + "fPIC": True, + "with_pes_ts": True, + "with_new_parser_api": 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], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["ENABLE_WEBMTS"] = self.options.with_pes_ts + tc.variables["ENABLE_WEBM_PARSER"] = self.options.with_new_parser_api + tc.variables["ENABLE_WEBMINFO"] = False + tc.variables["ENABLE_SAMPLE_PROGRAMS"] = False + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + cmake = CMake(self) + cmake.install() + 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", "webm") + self.cpp_info.set_property("cmake_target_name", "webm::webm") + self.cpp_info.set_property("pkg_config_name", "webm") + self.cpp_info.libs = ["webm"] + self.cpp_info.includedirs.append("include/webm") + + if self.settings.os in ["Linux", "FreeBSD", "Android"]: + self.cpp_info.system_libs.append("m") diff --git a/recipes/libwebm/all/test_package/CMakeLists.txt b/recipes/libwebm/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..4a896b2300ca0 --- /dev/null +++ b/recipes/libwebm/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES CXX) + +find_package(webm REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE webm::webm) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/libwebm/all/test_package/conanfile.py b/recipes/libwebm/all/test_package/conanfile.py new file mode 100644 index 0000000000000..b02549cdf82ed --- /dev/null +++ b/recipes/libwebm/all/test_package/conanfile.py @@ -0,0 +1,34 @@ +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) + # Later versions of the library use prefixed headers, 1.0.0.30 is the only + # version supported by this recipe that does not. + if self.dependencies[self.tested_reference_str].ref.version == "1.0.0.30": + tc.preprocessor_definitions["UNPREFIXED_HEADERS"] = "1" + + 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/libwebm/all/test_package/test_package.cpp b/recipes/libwebm/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..07d201d6d4f51 --- /dev/null +++ b/recipes/libwebm/all/test_package/test_package.cpp @@ -0,0 +1,22 @@ +#include +#include + +#ifdef UNPREFIXED_HEADERS +#include +#include +#else +#include +#include +#endif // UNPREFIXED_HEADERS + +int main(void) { + int32_t major, minor, build, revision; + + mkvparser::GetVersion(major, minor, build, revision); + printf("Mkv Parser version: %d.%d.%d.%d\n", major, minor, build, revision); + + mkvmuxer::GetVersion(&major, &minor, &build, &revision); + printf("Mkv Muxer version: %d.%d.%d.%d\n", major, minor, build, revision); + + return 0; +} diff --git a/recipes/libwebm/config.yml b/recipes/libwebm/config.yml new file mode 100644 index 0000000000000..c6c0e669617aa --- /dev/null +++ b/recipes/libwebm/config.yml @@ -0,0 +1,5 @@ +versions: + "1.0.0.31": + folder: all + "1.0.0.30": + folder: all diff --git a/recipes/libwebp/all/conandata.yml b/recipes/libwebp/all/conandata.yml index 73b2540022f74..a68caa1df2fd9 100644 --- a/recipes/libwebp/all/conandata.yml +++ b/recipes/libwebp/all/conandata.yml @@ -1,41 +1,44 @@ sources: + "1.4.0": + url: "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.4.0.tar.gz" + sha256: "61f873ec69e3be1b99535634340d5bde750b2e4447caa1db9f61be3fd49ab1e5" + "1.3.2": + url: "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.3.2.tar.gz" + sha256: "2a499607df669e40258e53d0ade8035ba4ec0175244869d1025d460562aa09b4" + "1.3.1": + url: "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.3.1.tar.gz" + sha256: "b3779627c2dfd31e3d8c4485962c2efe17785ef975e2be5c8c0c9e6cd3c4ef66" "1.2.4": - url: "https://github.com/webmproject/libwebp/archive/v1.2.4.tar.gz" - sha256: "dfe7bff3390cd4958da11e760b65318f0a48c32913e4d5bc5e8d55abaaa2d32e" - "1.2.3": - url: "https://github.com/webmproject/libwebp/archive/v1.2.3.tar.gz" - sha256: "021169407825d7ad918ff4554c6af885e7cf116d9b641cfd7f04c1173ffb9eb0" - "1.2.2": - url: "https://github.com/webmproject/libwebp/archive/v1.2.2.tar.gz" - sha256: "51e9297aadb7d9eb99129fe0050f53a11fcce38a0848fb2b0389e385ad93695e" - "1.2.1": - url: "https://github.com/webmproject/libwebp/archive/refs/tags/v1.2.1.tar.gz" - sha256: "01bcde6a40a602294994050b81df379d71c40b7e39c819c024d079b3c56307f4" - "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.4.tar.gz" + sha256: "7bf5a8a28cc69bcfa8cb214f2c3095703c6b73ac5fba4d5480c205331d9494df" "1.1.0": - url: "https://github.com/webmproject/libwebp/archive/v1.1.0.tar.gz" - sha256: "424faab60a14cb92c2a062733b6977b4cc1e875a6398887c5911b3a1a6c56c51" - "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.1.0.tar.gz" + sha256: "98a052268cc4d5ece27f76572a7f50293f439c17a98e67c4ea0c7ed6f50ef043" patches: + "1.4.0": + - patch_file: "patches/1.4.0-0001-fix-cmake.patch" + patch_description: "disable PIC, disable prefix library name on MSVC" + patch_type: "conan" + "1.3.2": + - patch_file: "patches/1.3.1-0001-fix-cmake.patch" + patch_description: "disable PIC, disable prefix library name on MSVC" + patch_type: "conan" + "1.3.1": + - patch_file: "patches/1.3.1-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" - "1.2.3": - - patch_file: "patches/0001-fix-dll-export.patch" - "1.2.2": - - patch_file: "patches/0001-fix-dll-export.patch" - "1.2.1": - - patch_file: "patches/0001-fix-dll-export.patch" - "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.1.0-0001-fix-dll-export.patch" + patch_description: "define WEBP_EXTERN for windows shared build" + patch_type: "portability" "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" - "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.1.0-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" diff --git a/recipes/libwebp/all/conanfile.py b/recipes/libwebp/all/conanfile.py index ad6abd49e96eb..5e7c1354176a4 100644 --- a/recipes/libwebp/all/conanfile.py +++ b/recipes/libwebp/all/conanfile.py @@ -12,7 +12,7 @@ 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" @@ -49,17 +49,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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) # should be an option but it doesn't work yet tc.variables["WEBP_ENABLE_SIMD"] = self.options.with_simd - if Version(self.version) >= "1.0.0": - tc.variables["WEBP_NEAR_LOSSLESS"] = self.options.near_lossless - else: - tc.variables["WEBP_ENABLE_NEAR_LOSSLESS"] = self.options.near_lossless + tc.variables["WEBP_NEAR_LOSSLESS"] = self.options.near_lossless tc.variables["WEBP_ENABLE_SWAP_16BIT_CSP"] = self.options.swap_16bit_csp # avoid finding system libs tc.variables["CMAKE_DISABLE_FIND_PACKAGE_GIF"] = True @@ -78,8 +74,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): @@ -104,7 +100,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") @@ -113,6 +109,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/0003-build-libwebpmux-1.0.3.patch b/recipes/libwebp/all/patches/0003-build-libwebpmux-1.0.3.patch deleted file mode 100644 index 0892ee3bdacd9..0000000000000 --- a/recipes/libwebp/all/patches/0003-build-libwebpmux-1.0.3.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -401,7 +401,7 @@ if(WEBP_BUILD_CWEBP) - install(TARGETS cwebp RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) - endif() - --if(WEBP_BUILD_GIF2WEBP OR WEBP_BUILD_IMG2WEBP) -+if(1) - parse_makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/src/mux "WEBP_MUX_SRCS" "") - add_library(libwebpmux ${WEBP_MUX_SRCS}) - target_link_libraries(libwebpmux webp) diff --git a/recipes/libwebp/all/patches/0003-build-libwebpmux-1.2.0.patch b/recipes/libwebp/all/patches/0003-build-libwebpmux-1.2.0.patch deleted file mode 100644 index 5f228670d57c8..0000000000000 --- a/recipes/libwebp/all/patches/0003-build-libwebpmux-1.2.0.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -449,7 +449,7 @@ if(WEBP_BUILD_CWEBP) - install(TARGETS cwebp RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) - endif() - --if(WEBP_BUILD_GIF2WEBP OR WEBP_BUILD_IMG2WEBP) -+if(1) - parse_makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/src/mux "WEBP_MUX_SRCS" "") - add_library(libwebpmux ${WEBP_MUX_SRCS}) - target_link_libraries(libwebpmux webp) diff --git a/recipes/libwebp/all/patches/0001-fix-dll-export.patch b/recipes/libwebp/all/patches/1.1.0-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.1.0-0001-fix-dll-export.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/1.3.1-0001-fix-cmake.patch b/recipes/libwebp/all/patches/1.3.1-0001-fix-cmake.patch new file mode 100644 index 0000000000000..72ee3a1218366 --- /dev/null +++ b/recipes/libwebp/all/patches/1.3.1-0001-fix-cmake.patch @@ -0,0 +1,21 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index ad5e14c3..89c836f3 100644 +--- a/CMakeLists.txt ++++ 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) +@@ -153,7 +152,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/patches/1.4.0-0001-fix-cmake.patch b/recipes/libwebp/all/patches/1.4.0-0001-fix-cmake.patch new file mode 100644 index 0000000000000..f819b1e43d235 --- /dev/null +++ b/recipes/libwebp/all/patches/1.4.0-0001-fix-cmake.patch @@ -0,0 +1,21 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index ad5e14c3..89c836f3 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -60,7 +60,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) +@@ -155,7 +154,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/config.yml b/recipes/libwebp/config.yml index 2a1d6bc5117bc..c2fa30e005fdd 100644 --- a/recipes/libwebp/config.yml +++ b/recipes/libwebp/config.yml @@ -1,15 +1,11 @@ versions: - "1.2.4": - folder: all - "1.2.3": + "1.4.0": folder: all - "1.2.2": + "1.3.2": folder: all - "1.2.1": + "1.3.1": folder: all - "1.2.0": + "1.2.4": folder: all "1.1.0": folder: all - "1.0.3": - folder: all diff --git a/recipes/libwebsockets/all/CMakeLists.txt b/recipes/libwebsockets/all/CMakeLists.txt deleted file mode 100644 index f3c9da822bfbd..0000000000000 --- a/recipes/libwebsockets/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/libwebsockets/all/conandata.yml b/recipes/libwebsockets/all/conandata.yml index 119725ef837be..8032d01c8d8b8 100644 --- a/recipes/libwebsockets/all/conandata.yml +++ b/recipes/libwebsockets/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "4.3.3": + url: "https://github.com/warmcat/libwebsockets/archive/v4.3.3.tar.gz" + sha256: "6fd33527b410a37ebc91bb64ca51bdabab12b076bc99d153d7c5dd405e4bdf90" "4.3.2": url: "https://github.com/warmcat/libwebsockets/archive/v4.3.2.tar.gz" sha256: "6a85a1bccf25acc7e8e5383e4934c9b32a102880d1e4c37c70b27ae2a42406e1" @@ -11,12 +14,3 @@ sources: "4.2.0": url: "https://github.com/warmcat/libwebsockets/archive/v4.2.0.tar.gz" sha256: "a57e9a4765dbcd4d880feba8089b43ed69995eaf10d5d61a07981d9ddd975f40" - "4.1.6": - url: "https://github.com/warmcat/libwebsockets/archive/v4.1.6.tar.gz" - sha256: "402e9a8df553c9cd2aff5d7a9758e9e5285bf3070c82539082864633db3deb83" - "4.1.4": - url: "https://github.com/warmcat/libwebsockets/archive/v4.1.4.tar.gz" - sha256: "00da77b4b89db3e0b1a2778f756f08d55d7f6b1632e18d981fc399c412866147" - "4.0.15": - url: "https://github.com/warmcat/libwebsockets/archive/v4.0.15.tar.gz" - sha256: "adce8152c3e802b8fe71b26d7252944944c49954ba6b5ba9fbb7fa5c4aad93dc" diff --git a/recipes/libwebsockets/all/conanfile.py b/recipes/libwebsockets/all/conanfile.py index c2dfe332c1332..21f493452d927 100644 --- a/recipes/libwebsockets/all/conanfile.py +++ b/recipes/libwebsockets/all/conanfile.py @@ -1,9 +1,13 @@ -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.cmake import cmake_layout, CMake, CMakeToolchain, CMakeDeps +from conan.tools.files import get, replace_in_file, rmdir, copy, save, collect_libs +from conan.tools.microsoft import check_min_vs, is_msvc +from conan.tools.scm import Version import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.56.0" class LibwebsocketsConan(ConanFile): @@ -12,8 +16,9 @@ class LibwebsocketsConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/warmcat/libwebsockets" license = "MIT" - topics = ("libwebsockets", "websocket") + topics = ("websocket") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -25,6 +30,7 @@ class LibwebsocketsConan(ConanFile): "with_sqlite3": [True, False], "with_libmount": [True, False], "with_hubbub": [True, False], + "with_netlink": [True, False], "ssl_client_use_os_ca_certs": [True, False], # SSL support should make use of the OS-installed CA root certs "ssl_server_with_ecdh_cert": [True, False], # Include SSL server use ECDH certificate @@ -109,6 +115,7 @@ class LibwebsocketsConan(ConanFile): "with_sqlite3": False, "with_libmount": False, "with_hubbub": False, + "with_netlink": False, "ssl_client_use_os_ca_certs": True, "ssl_server_with_ecdh_cert": False, @@ -185,17 +192,8 @@ class LibwebsocketsConan(ConanFile): "enable_spawn": False } - exports_sources = "CMakeLists.txt" - 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 layout(self): + cmake_layout(self, src_folder="src") def config_options(self): if self.settings.os == "Windows": @@ -203,13 +201,13 @@ 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.with_libuv: - self.requires("libuv/1.44.1") + self.requires("libuv/1.47.0") if self.options.with_libevent == "libevent": self.requires("libevent/2.1.12") @@ -217,44 +215,41 @@ def requirements(self): self.requires("libev/4.33") if self.options.with_zlib == "zlib": - self.requires("zlib/1.2.12") + self.requires("zlib/[>=1.2.11 <2]") elif self.options.with_zlib == "miniz": - self.requires("miniz/2.2.0") + self.requires("miniz/3.0.2") if self.options.with_libmount: - self.requires("libmount/2.36.2") + self.requires("libmount/2.39.2") if self.options.with_sqlite3: - self.requires("sqlite3/3.37.2") + self.requires("sqlite3/3.44.2") if self.options.with_ssl == "openssl": - self.requires("openssl/1.1.1o") + self.requires("openssl/[>=1.1.1w <4]", transitive_headers=True) elif self.options.with_ssl == "mbedtls": - self.requires("mbedtls/2.25.0") + self.requires("mbedtls/3.5.0") elif self.options.with_ssl == "wolfssl": - self.requires("wolfssl/4.8.1") + self.requires("wolfssl/5.6.3") def validate(self): - if self.options.shared and self.settings.compiler == "gcc" and tools.Version(self.settings.compiler.version) < "5": + if self.options.shared and self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "5": # https://github.com/conan-io/conan-center-index/pull/5321#issuecomment-826367276 raise ConanInvalidConfiguration("{}/{} shared=True with gcc<5 does not build. Please submit a PR with a fix.".format(self.name, self.version)) - if tools.Version(self.version) <= "4.0.15" and self.settings.compiler == "apple-clang" and tools.Version(self.settings.compiler.version) >= "12": - raise ConanInvalidConfiguration("{}/{} with apple-clang>=12 does not build. Please submit a PR with a fix.".format(self.name, self.version)) - if self.settings.compiler == "Visual Studio" and tools.Version(self.settings.compiler.version) < 16 and tools.Version(self.version) >= "4.3.2": - raise ConanInvalidConfiguration ("{}/{} requires at least Visual Studio 2019".format(self.name, self.version)) + if Version(self.version) >= "4.3.2": + check_min_vs(self, "192") if self.options.with_hubbub: raise ConanInvalidConfiguration("Library hubbub not implemented (yet) in CCI") # TODO - Add hubbub package when available. 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 _get_library_extension(self, dep): - if self.options[dep].shared: + if self.dependencies[dep].options.shared: if self.settings.os == "Windows" : - if self._is_msvc: + if is_msvc(self): return ".lib" else: return ".dll.a" @@ -263,212 +258,208 @@ def _get_library_extension(self, dep): else: return ".so" else: - if self.settings.os == "Windows" and self._is_msvc: + if self.settings.os == "Windows" and is_msvc(self): return ".lib" else: return ".a" - @property - def _get_library_prefix(self): - if self.settings.os == "Windows" : - return "" - return "lib" - def _cmakify_path_list(self, paths): return ";".join(paths).replace("\\", "/") def _find_library(self, libname, dep): - for path in self.deps_cpp_info[dep].lib_paths: - lib_fullpath = os.path.join(path, self._get_library_prefix + libname + self._get_library_extension(dep)) - - print("Test : " + str(lib_fullpath)) + prefix = "lib" if self.settings.os != "Windows" else "" + for path in self.dependencies[dep].cpp_info.libdirs: + lib_fullpath = os.path.join(path, prefix + libname + self._get_library_extension(dep)) + self.output.info("Dependency library full path : " + str(lib_fullpath)) if os.path.isfile(lib_fullpath): return lib_fullpath raise ConanException("Library {} not found".format(lib_fullpath)) def _find_libraries(self, dep): - return [self._find_library(lib, dep) for lib in self.deps_cpp_info[dep].libs] - - def _configure_cmake(self): - if self._cmake is not None: - return self._cmake - - self._cmake = CMake(self) - self._cmake.definitions["LWS_WITHOUT_TESTAPPS"] = True - self._cmake.definitions["LWS_WITHOUT_TEST_SERVER"] = True - self._cmake.definitions["LWS_WITHOUT_TEST_SERVER_EXTPOLL"] = True - self._cmake.definitions["LWS_WITHOUT_TEST_PING"] = True - self._cmake.definitions["LWS_WITHOUT_TEST_CLIENT"] = True - - self._cmake.definitions["LWS_LINK_TESTAPPS_DYNAMIC"] = True - self._cmake.definitions["LWS_WITH_SHARED"] = self.options.shared - self._cmake.definitions["LWS_WITH_STATIC"] = not self.options.shared - self._cmake.definitions["LWS_WITH_SSL"] = bool(self.options.with_ssl) + aggregated = self.dependencies[dep].cpp_info.aggregated_components() + result = [self._find_library(lib, dep) for lib in aggregated.libs] + return result + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["LWS_WITHOUT_TESTAPPS"] = True + tc.variables["LWS_WITHOUT_TEST_SERVER"] = True + tc.variables["LWS_WITHOUT_TEST_SERVER_EXTPOLL"] = True + tc.variables["LWS_WITHOUT_TEST_PING"] = True + tc.variables["LWS_WITHOUT_TEST_CLIENT"] = True + + tc.variables["LWS_LINK_TESTAPPS_DYNAMIC"] = True + tc.variables["LWS_WITH_SHARED"] = self.options.shared + tc.variables["LWS_WITH_STATIC"] = not self.options.shared + tc.variables["LWS_WITH_SSL"] = bool(self.options.with_ssl) + tc.variables["LWS_WITH_NETLINK"] = self.options.with_netlink + + # Allow forwarding project targets to try_compile and derivatives + tc.variables["CMAKE_TRY_COMPILE_CONFIGURATION"] = self.settings.build_type if self.options.with_ssl == "openssl": - self._cmake.definitions["LWS_OPENSSL_LIBRARIES"] = self._cmakify_path_list(self._find_libraries("openssl")) - self._cmake.definitions["LWS_OPENSSL_INCLUDE_DIRS"] = self._cmakify_path_list(self.deps_cpp_info["openssl"].include_paths) - elif self.options.with_ssl == "mbedtls": - self._cmake.definitions["LWS_WITH_MBEDTLS"] = True - self._cmake.definitions["LWS_MBEDTLS_LIBRARIES"] = self._cmakify_path_list(self._find_libraries("mbedtls")) - self._cmake.definitions["LWS_MBEDTLS_INCLUDE_DIRS"] = self._cmakify_path_list(self.deps_cpp_info["mbedtls"].include_paths) + # Ensure find_package(OpenSSL) is called early + tc.variables["CMAKE_PROJECT_libwebsockets_INCLUDE"] = os.path.join(self.source_folder, "project_include.cmake").replace('\\','/') + + if self.options.with_ssl == "mbedtls": + tc.variables["LWS_WITH_MBEDTLS"] = True + tc.variables["LWS_MBEDTLS_LIBRARIES"] = self._cmakify_path_list(self._find_libraries("mbedtls")) + tc.variables["LWS_MBEDTLS_INCLUDE_DIRS"] = self._cmakify_path_list(self.dependencies["mbedtls"].cpp_info.includedirs) elif self.options.with_ssl == "wolfssl": - self._cmake.definitions["LWS_WITH_WOLFSSL"] = True - self._cmake.definitions["LWS_WOLFSSL_LIBRARIES"] = self._cmakify_path_list(self._find_libraries("wolfssl")) - self._cmake.definitions["LWS_WOLFSSL_INCLUDE_DIRS"] = self._cmakify_path_list(self.deps_cpp_info["wolfssl"].include_paths) + tc.variables["LWS_WITH_WOLFSSL"] = True + tc.variables["LWS_WOLFSSL_LIBRARIES"] = self._cmakify_path_list(self._find_libraries("wolfssl")) + tc.variables["LWS_WOLFSSL_INCLUDE_DIRS"] = self._cmakify_path_list(self.dependencies["wolfssl"].cpp_info.includedirs) else: - self._cmake.definitions["LWS_WITH_WOLFSSL"] = False + tc.variables["LWS_WITH_WOLFSSL"] = False - self._cmake.definitions["LWS_WITH_LIBEV"] = self.options.with_libevent == "libev" + tc.variables["LWS_WITH_LIBEV"] = self.options.with_libevent == "libev" if self.options.with_libevent == "libev": - self._cmake.definitions["LWS_LIBEV_LIBRARIES"] = self._cmakify_path_list(self._find_libraries("libev")) - self._cmake.definitions["LWS_LIBEV_INCLUDE_DIRS"] = self._cmakify_path_list(self.deps_cpp_info["libev"].include_paths).replace("\\", "/") + tc.variables["LWS_LIBEV_LIBRARIES"] = self._cmakify_path_list(self._find_libraries("libev")) + tc.variables["LWS_LIBEV_INCLUDE_DIRS"] = self._cmakify_path_list(self.dependencies["libev"].cpp_info.includedirs).replace("\\", "/") - self._cmake.definitions["LWS_WITH_LIBUV"] = self.options.with_libuv + tc.variables["LWS_WITH_LIBUV"] = self.options.with_libuv if self.options.with_libuv: - self._cmake.definitions["LWS_LIBUV_LIBRARIES"] = self._cmakify_path_list(self._find_libraries("libuv")) - self._cmake.definitions["LWS_LIBUV_INCLUDE_DIRS"] = self._cmakify_path_list(self.deps_cpp_info["libuv"].include_paths) + tc.variables["LWS_LIBUV_LIBRARIES"] = self._cmakify_path_list(self._find_libraries("libuv")) + tc.variables["LWS_LIBUV_INCLUDE_DIRS"] = self._cmakify_path_list(self.dependencies["libuv"].cpp_info.includedirs) - self._cmake.definitions["LWS_WITH_LIBEVENT"] = self.options.with_libevent == "libevent" + tc.variables["LWS_WITH_LIBEVENT"] = self.options.with_libevent == "libevent" if self.options.with_libevent == "libevent": - self._cmake.definitions["LWS_LIBEVENT_LIBRARIES"] = self._cmakify_path_list(self._find_libraries("libevent")) - self._cmake.definitions["LWS_LIBEVENT_INCLUDE_DIRS"] = self._cmakify_path_list(self.deps_cpp_info["libevent"].include_paths) + tc.variables["LWS_LIBEVENT_LIBRARIES"] = self._cmakify_path_list(self._find_libraries("libevent")) + tc.variables["LWS_LIBEVENT_INCLUDE_DIRS"] = self._cmakify_path_list(self.dependencies["libevent"].cpp_info.includedirs) - self._cmake.definitions["LWS_WITH_ZLIB"] = self.options.with_zlib != False - self._cmake.definitions["LWS_WITH_MINIZ"] = self.options.with_zlib == "miniz" - self._cmake.definitions["LWS_WITH_BUNDLED_ZLIB"] = self.options.with_zlib == "bundled" + tc.variables["LWS_WITH_ZLIB"] = self.options.with_zlib != False + tc.variables["LWS_WITH_MINIZ"] = self.options.with_zlib == "miniz" + tc.variables["LWS_WITH_BUNDLED_ZLIB"] = self.options.with_zlib == "bundled" if self.options.with_zlib == "zlib": - self._cmake.definitions["LWS_ZLIB_LIBRARIES"] = self._cmakify_path_list(self._find_libraries("zlib")) - self._cmake.definitions["LWS_ZLIB_INCLUDE_DIRS"] = self._cmakify_path_list(self.deps_cpp_info["zlib"].include_paths) + tc.variables["LWS_ZLIB_LIBRARIES"] = self._cmakify_path_list(self._find_libraries("zlib")) + tc.variables["LWS_ZLIB_INCLUDE_DIRS"] = self._cmakify_path_list(self.dependencies["zlib"].cpp_info.includedirs) elif self.options.with_zlib == "miniz": - self._cmake.definitions["MINIZ_LIBRARIES"] = self._cmakify_path_list(self._find_libraries("miniz")) - self._cmake.definitions["MINIZ_INCLUDE_DIRS"] = self._cmakify_path_list(self.deps_cpp_info["miniz"].include_paths) + tc.variables["MINIZ_LIBRARIES"] = self._cmakify_path_list(self._find_libraries("miniz")) + tc.variables["MINIZ_INCLUDE_DIRS"] = self._cmakify_path_list(self.dependencies["miniz"].cpp_info.includedirs) - self._cmake.definitions["LWS_WITH_SQLITE3"] = self.options.with_sqlite3 + tc.variables["LWS_WITH_SQLITE3"] = self.options.with_sqlite3 if self.options.with_sqlite3: - self._cmake.definitions["LWS_SQLITE3_LIBRARIES"] = self._cmakify_path_list(self._find_libraries("sqlite3")) - self._cmake.definitions["LWS_SQLITE3_INCLUDE_DIRS"] = self._cmakify_path_list(self.deps_cpp_info["sqlite3"].include_paths) + tc.variables["LWS_SQLITE3_LIBRARIES"] = self._cmakify_path_list(self._find_libraries("sqlite3")) + tc.variables["LWS_SQLITE3_INCLUDE_DIRS"] = self._cmakify_path_list(self.dependencies["sqlite3"].cpp_info.includedirs) - self._cmake.definitions["LWS_WITH_FSMOUNT"] = self.options.with_libmount + tc.variables["LWS_WITH_FSMOUNT"] = self.options.with_libmount if self.options.with_libmount: - self._cmake.definitions["LWS_LIBMOUNT_LIBRARIES"] = self._cmakify_path_list(self._find_libraries("libmount")) - self._cmake.definitions["LWS_LIBMOUNT_INCLUDE_DIRS"] = self._cmakify_path_list(self.deps_cpp_info["libmount"].include_paths) - - self._cmake.definitions["LWS_WITH_HUBBUB"] = self.options.with_hubbub - - self._cmake.definitions["LWS_SSL_CLIENT_USE_OS_CA_CERTS"] = self.options.ssl_client_use_os_ca_certs - self._cmake.definitions["LWS_SSL_SERVER_WITH_ECDH_CERT"] = self.options.ssl_server_with_ecdh_cert - - self._cmake.definitions["LWS_WITH_NETWORK"] = self.options.enable_network - self._cmake.definitions["LWS_ROLE_H1"] = self.options.role_h1 - self._cmake.definitions["LWS_ROLE_WS"] = self.options.role_ws - self._cmake.definitions["LWS_ROLE_MQTT"] = self.options.role_mqtt - self._cmake.definitions["LWS_ROLE_DBUS"] = self.options.role_dbus - self._cmake.definitions["LWS_ROLE_RAW_PROXY"] = self.options.role_raw_proxy - self._cmake.definitions["LWS_ROLE_RAW_FILE"] = self.options.role_raw_file - self._cmake.definitions["LWS_WITH_HTTP2"] = self.options.enable_http2 - self._cmake.definitions["LWS_WITH_LWSWS"] = self.options.enable_lwsws - self._cmake.definitions["LWS_WITH_CGI"] = self.options.enable_cgi - self._cmake.definitions["LWS_IPV6"] = self.options.enable_ipv6 - self._cmake.definitions["LWS_UNIX_SOCK"] = self.options.enable_unix_sock - self._cmake.definitions["LWS_WITH_PLUGINS"] = self.options.enable_plugins - self._cmake.definitions["LWS_WITH_HTTP_PROXY"] = self.options.enable_http_proxy - self._cmake.definitions["LWS_WITH_ZIP_FOPS"] = self.options.enable_zip_fops - self._cmake.definitions["LWS_WITH_SOCKS5"] = self.options.enable_socks5 - self._cmake.definitions["LWS_WITH_GENERIC_SESSIONS"] = self.options.enable_generic_sessions - self._cmake.definitions["LWS_WITH_PEER_LIMITS"] = self.options.enable_peer_limits - self._cmake.definitions["LWS_WITH_ACCESS_LOG"] = self.options.enable_access_log - self._cmake.definitions["LWS_WITH_RANGES"] = self.options.enable_ranges - self._cmake.definitions["LWS_WITH_SERVER_STATUS"] = self.options.enable_server_status - self._cmake.definitions["LWS_WITH_THREADPOOL"] = self.options.enable_threadpool - self._cmake.definitions["LWS_WITH_HTTP_STREAM_COMPRESSION"] = self.options.enable_http_stream_compression - self._cmake.definitions["LWS_WITH_HTTP_BROTLI"] = self.options.enable_http_brotli - self._cmake.definitions["LWS_WITH_ACME"] = self.options.enable_acme - self._cmake.definitions["LWS_WITH_FTS"] = self.options.enable_fts - self._cmake.definitions["LWS_WITH_SYS_ASYNC_DNS"] = self.options.enable_sys_async_dns - self._cmake.definitions["LWS_WITH_SYS_NTPCLIENT"] = self.options.enable_sys_ntpclient - self._cmake.definitions["LWS_WITH_SYS_DHCP_CLIENT"] = self.options.enable_sys_dhcp_client - self._cmake.definitions["LWS_WITH_HTTP_BASIC_AUTH"] = self.options.enable_http_basic_auth - self._cmake.definitions["LWS_WITH_HTTP_UNCOMMON_HEADERS"] = self.options.enable_http_uncommon_headers - - self._cmake.definitions["LWS_WITHOUT_EXTENSIONS"] = not self.options.enable_extensions - self._cmake.definitions["LWS_WITHOUT_BUILTIN_GETIFADDRS"] = not self.options.enable_builtin_getifaddrs - self._cmake.definitions["LWS_FALLBACK_GETHOSTBYNAME"] = self.options.enable_fallback_gethostbyname - self._cmake.definitions["LWS_WITHOUT_BUILTIN_SHA1"] = not self.options.enable_builtin_sha1 - self._cmake.definitions["LWS_WITHOUT_DAEMONIZE"] = not self.options.enable_daemonize - self._cmake.definitions["LWS_WITH_LEJP"] = self.options.enable_lejp - self._cmake.definitions["LWS_WITH_STRUCT_JSON"] = self.options.enable_struct_json - self._cmake.definitions["LWS_WITH_STRUCT_SQLITE3"] = self.options.enable_struct_sqlite3 - - self._cmake.definitions["LWS_WITH_NO_LOGS"] = self.options.disable_logs - self._cmake.definitions["LWS_LOGS_TIMESTAMP"] = self.options.logs_timestamp - self._cmake.definitions["LWS_AVOID_SIGPIPE_IGN"] = self.options.avoid_sigpipe_ign - self._cmake.definitions["LWS_WITH_STATS"] = self.options.enable_stats - self._cmake.definitions["LWS_WITH_JOSE"] = self.options.enable_jose - self._cmake.definitions["LWS_WITH_GENCRYPTO"] = self.options.enable_gencrypto - self._cmake.definitions["LWS_WITH_SELFTESTS"] = self.options.enable_selftests - self._cmake.definitions["LWS_WITH_GCOV"] = self.options.enable_gcov - self._cmake.definitions["LWS_WITH_LWSAC"] = self.options.enable_lwsac - self._cmake.definitions["LWS_WITH_CUSTOM_HEADERS"] = self.options.enable_custom_headers - self._cmake.definitions["LWS_WITH_DISKCACHE"] = self.options.enable_diskcache - self._cmake.definitions["LWS_WITH_DIR"] = self.options.enable_dir - self._cmake.definitions["LWS_WITH_LEJP_CONF"] = self.options.enable_lejp_conf - self._cmake.definitions["LWS_WITH_DEPRECATED_LWS_DLL"] = self.options.enable_deprecated_lws_dll - self._cmake.definitions["LWS_WITH_SEQUENCER"] = self.options.enable_sequencer - self._cmake.definitions["LWS_WITH_EXTERNAL_POLL"] = self.options.enable_external_poll - self._cmake.definitions["LWS_WITH_LWS_DSH"] = self.options.enable_lws_dsh - self._cmake.definitions["LWS_CLIENT_HTTP_PROXYING"] = self.options.enable_external_http_proxying - self._cmake.definitions["LWS_WITH_FILE_OPS"] = self.options.enable_file_ops - self._cmake.definitions["LWS_WITH_DETAILED_LATENCY"] = self.options.enable_detailed_latency - self._cmake.definitions["LWS_WITH_UDP"] = self.options.enable_udp - self._cmake.definitions["LWS_WITH_SPAWN"] = self.options.enable_spawn - - self._cmake.definitions["LWS_WITH_ALSA"] = False - self._cmake.definitions["LWS_WITH_GTK"] = False - - if tools.Version(self.version) >= "4.1.0": - self._cmake.definitions["LWS_WITH_SYS_SMD"] = self.settings.os != "Windows" - self._cmake.definitions["DISABLE_WERROR"] = True - - # Temporary override Windows 10 SDK for Visual Studio 2019, see issue #4450 - # CCI worker has 10.0.17763.0 SDK installed alongside with 10.0.20348 but only 20348 can be used with Visual Studio 2019 - if self.settings.compiler == "Visual Studio" and tools.Version(self.settings.compiler.version) == 16: - self._cmake.definitions["CMAKE_SYSTEM_VERSION"] = "10.0.20348" - - self._cmake.configure() - return self._cmake + tc.variables["LWS_LIBMOUNT_LIBRARIES"] = self._cmakify_path_list(self._find_libraries("libmount")) + tc.variables["LWS_LIBMOUNT_INCLUDE_DIRS"] = self._cmakify_path_list(self.dependencies["libmount"].cpp_info.includedirs) + + tc.variables["LWS_WITH_HUBBUB"] = self.options.with_hubbub + + tc.variables["LWS_SSL_CLIENT_USE_OS_CA_CERTS"] = self.options.ssl_client_use_os_ca_certs + tc.variables["LWS_SSL_SERVER_WITH_ECDH_CERT"] = self.options.ssl_server_with_ecdh_cert + + tc.variables["LWS_WITH_NETWORK"] = self.options.enable_network + tc.variables["LWS_ROLE_H1"] = self.options.role_h1 + tc.variables["LWS_ROLE_WS"] = self.options.role_ws + tc.variables["LWS_ROLE_MQTT"] = self.options.role_mqtt + tc.variables["LWS_ROLE_DBUS"] = self.options.role_dbus + tc.variables["LWS_ROLE_RAW_PROXY"] = self.options.role_raw_proxy + tc.variables["LWS_ROLE_RAW_FILE"] = self.options.role_raw_file + tc.variables["LWS_WITH_HTTP2"] = self.options.enable_http2 + tc.variables["LWS_WITH_LWSWS"] = self.options.enable_lwsws + tc.variables["LWS_WITH_CGI"] = self.options.enable_cgi + tc.variables["LWS_IPV6"] = self.options.enable_ipv6 + tc.variables["LWS_UNIX_SOCK"] = self.options.enable_unix_sock + tc.variables["LWS_WITH_PLUGINS"] = self.options.enable_plugins + tc.variables["LWS_WITH_HTTP_PROXY"] = self.options.enable_http_proxy + tc.variables["LWS_WITH_ZIP_FOPS"] = self.options.enable_zip_fops + tc.variables["LWS_WITH_SOCKS5"] = self.options.enable_socks5 + tc.variables["LWS_WITH_GENERIC_SESSIONS"] = self.options.enable_generic_sessions + tc.variables["LWS_WITH_PEER_LIMITS"] = self.options.enable_peer_limits + tc.variables["LWS_WITH_ACCESS_LOG"] = self.options.enable_access_log + tc.variables["LWS_WITH_RANGES"] = self.options.enable_ranges + tc.variables["LWS_WITH_SERVER_STATUS"] = self.options.enable_server_status + tc.variables["LWS_WITH_THREADPOOL"] = self.options.enable_threadpool + tc.variables["LWS_WITH_HTTP_STREAM_COMPRESSION"] = self.options.enable_http_stream_compression + tc.variables["LWS_WITH_HTTP_BROTLI"] = self.options.enable_http_brotli + tc.variables["LWS_WITH_ACME"] = self.options.enable_acme + tc.variables["LWS_WITH_FTS"] = self.options.enable_fts + tc.variables["LWS_WITH_SYS_ASYNC_DNS"] = self.options.enable_sys_async_dns + tc.variables["LWS_WITH_SYS_NTPCLIENT"] = self.options.enable_sys_ntpclient + tc.variables["LWS_WITH_SYS_DHCP_CLIENT"] = self.options.enable_sys_dhcp_client + tc.variables["LWS_WITH_HTTP_BASIC_AUTH"] = self.options.enable_http_basic_auth + tc.variables["LWS_WITH_HTTP_UNCOMMON_HEADERS"] = self.options.enable_http_uncommon_headers + + tc.variables["LWS_WITHOUT_EXTENSIONS"] = not self.options.enable_extensions + tc.variables["LWS_WITHOUT_BUILTIN_GETIFADDRS"] = not self.options.enable_builtin_getifaddrs + tc.variables["LWS_FALLBACK_GETHOSTBYNAME"] = self.options.enable_fallback_gethostbyname + tc.variables["LWS_WITHOUT_BUILTIN_SHA1"] = not self.options.enable_builtin_sha1 + tc.variables["LWS_WITHOUT_DAEMONIZE"] = not self.options.enable_daemonize + tc.variables["LWS_WITH_LEJP"] = self.options.enable_lejp + tc.variables["LWS_WITH_STRUCT_JSON"] = self.options.enable_struct_json + tc.variables["LWS_WITH_STRUCT_SQLITE3"] = self.options.enable_struct_sqlite3 + + tc.variables["LWS_WITH_NO_LOGS"] = self.options.disable_logs + tc.variables["LWS_LOGS_TIMESTAMP"] = self.options.logs_timestamp + tc.variables["LWS_AVOID_SIGPIPE_IGN"] = self.options.avoid_sigpipe_ign + tc.variables["LWS_WITH_STATS"] = self.options.enable_stats + tc.variables["LWS_WITH_JOSE"] = self.options.enable_jose + tc.variables["LWS_WITH_GENCRYPTO"] = self.options.enable_gencrypto + tc.variables["LWS_WITH_SELFTESTS"] = self.options.enable_selftests + tc.variables["LWS_WITH_GCOV"] = self.options.enable_gcov + tc.variables["LWS_WITH_LWSAC"] = self.options.enable_lwsac + tc.variables["LWS_WITH_CUSTOM_HEADERS"] = self.options.enable_custom_headers + tc.variables["LWS_WITH_DISKCACHE"] = self.options.enable_diskcache + tc.variables["LWS_WITH_DIR"] = self.options.enable_dir + tc.variables["LWS_WITH_LEJP_CONF"] = self.options.enable_lejp_conf + tc.variables["LWS_WITH_DEPRECATED_LWS_DLL"] = self.options.enable_deprecated_lws_dll + tc.variables["LWS_WITH_SEQUENCER"] = self.options.enable_sequencer + tc.variables["LWS_WITH_EXTERNAL_POLL"] = self.options.enable_external_poll + tc.variables["LWS_WITH_LWS_DSH"] = self.options.enable_lws_dsh + tc.variables["LWS_CLIENT_HTTP_PROXYING"] = self.options.enable_external_http_proxying + tc.variables["LWS_WITH_FILE_OPS"] = self.options.enable_file_ops + tc.variables["LWS_WITH_DETAILED_LATENCY"] = self.options.enable_detailed_latency + tc.variables["LWS_WITH_UDP"] = self.options.enable_udp + tc.variables["LWS_WITH_SPAWN"] = self.options.enable_spawn + + tc.variables["LWS_WITH_ALSA"] = False + tc.variables["LWS_WITH_GTK"] = False + + tc.variables["LWS_WITH_SYS_SMD"] = self.settings.os != "Windows" + tc.variables["DISABLE_WERROR"] = True + + tc.generate() + deps = CMakeDeps(self) + deps.generate() def _patch_sources(self): - cmakelists = os.path.join(self._source_subfolder, "CMakeLists.txt") - tools.replace_in_file( + cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") + replace_in_file(self, cmakelists, "SET(CMAKE_INSTALL_NAME_DIR \"${CMAKE_INSTALL_PREFIX}/${LWS_INSTALL_LIB_DIR}${LIB_SUFFIX}\")", "", ) - if tools.Version(self.version) == "4.0.15" and self.options.with_ssl: - tools.replace_in_file( - cmakelists, - "list(APPEND LIB_LIST ws2_32.lib userenv.lib psapi.lib iphlpapi.lib)", - "list(APPEND LIB_LIST ws2_32.lib userenv.lib psapi.lib iphlpapi.lib crypt32.lib)" - ) - if tools.Version(self.version) < "4.1.0": - tools.replace_in_file(cmakelists, "-Werror", "") - if tools.Version(self.version) >= "4.1.4": - tools.replace_in_file(cmakelists, "add_compile_options(/W3 /WX)", "add_compile_options(/W3)") + + # Early call to find_package(OpenSSL) because its referenced in different places + if self.options.with_ssl == "openssl": + project_include_file = os.path.join(self.source_folder, "project_include.cmake") + save(self, project_include_file, 'find_package(OpenSSL REQUIRED)\nset(OPENSSL_INCLUDE_DIRS ${OPENSSL_INCLUDE_DIR})') + + # Prevent locating and copying OpenSSL binaries (not needed by the recipe) + replace_in_file(self, + os.path.join(self.source_folder, "cmake", "FindOpenSSLbins.cmake"), + "if(OPENSSL_FOUND)", "if(FALSE)") + + replace_in_file(self, cmakelists, "add_compile_options(/W3 /WX)", "add_compile_options(/W3)") 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", 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.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, "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, "lib", "pkgconfig")) # TODO: to remove in conan v2 once cmake_find_package* generators removed self._create_cmake_module_alias_targets( @@ -476,8 +467,7 @@ def package(self): {self._cmake_target: "Libwebsockets::{}".format(self._cmake_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("""\ @@ -486,7 +476,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): @@ -502,7 +492,7 @@ def package_info(self): pkgconfig_name = "libwebsockets" if self.options.shared else "libwebsockets_static" self.cpp_info.set_property("pkg_config_name", pkgconfig_name) # TODO: back to global scope in conan v2 once cmake_find_package* generators removed - self.cpp_info.components["_libwebsockets"].libs = tools.collect_libs(self) + self.cpp_info.components["_libwebsockets"].libs = collect_libs(self) if self.settings.os == "Windows": self.cpp_info.components["_libwebsockets"].system_libs.extend(["ws2_32", "crypt32"]) elif self.settings.os in ["Linux", "FreeBSD"]: diff --git a/recipes/libwebsockets/all/test_package/CMakeLists.txt b/recipes/libwebsockets/all/test_package/CMakeLists.txt index 7ca319a6f6da7..6aa87cfd3d013 100644 --- a/recipes/libwebsockets/all/test_package/CMakeLists.txt +++ b/recipes/libwebsockets/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(Libwebsockets REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) diff --git a/recipes/libwebsockets/all/test_package/conanfile.py b/recipes/libwebsockets/all/test_package/conanfile.py index 9b63bd176646b..bff3c734cea93 100644 --- a/recipes/libwebsockets/all/test_package/conanfile.py +++ b/recipes/libwebsockets/all/test_package/conanfile.py @@ -1,10 +1,24 @@ -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 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.generate() def build(self): cmake = CMake(self) @@ -12,5 +26,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/libwebsockets/all/test_package/test_package.c b/recipes/libwebsockets/all/test_package/test_package.c index e09bc89a8abe9..a76a8da0d85c5 100644 --- a/recipes/libwebsockets/all/test_package/test_package.c +++ b/recipes/libwebsockets/all/test_package/test_package.c @@ -4,89 +4,8 @@ #include "libwebsockets.h" -static struct lws *web_socket = NULL; - -#define EXAMPLE_RX_BUFFER_BYTES (10) - -static int callback_example( struct lws *wsi, enum lws_callback_reasons reason, void *user, void *in, size_t len ) -{ - switch( reason ) - { - case LWS_CALLBACK_CLIENT_ESTABLISHED: - lws_callback_on_writable( wsi ); - break; - - case LWS_CALLBACK_CLIENT_RECEIVE: - /* Handle incomming messages here. */ - break; - - case LWS_CALLBACK_CLIENT_WRITEABLE: - { - unsigned char buf[LWS_SEND_BUFFER_PRE_PADDING + EXAMPLE_RX_BUFFER_BYTES + LWS_SEND_BUFFER_POST_PADDING]; - unsigned char *p = &buf[LWS_SEND_BUFFER_PRE_PADDING]; - size_t n = sprintf( (char *)p, "%u", rand() ); - lws_write( wsi, p, n, LWS_WRITE_TEXT ); - break; - } - - case LWS_CALLBACK_CLOSED: - case LWS_CALLBACK_CLIENT_CONNECTION_ERROR: - web_socket = NULL; - break; - - default: - break; - } - - return 0; -} - -enum protocols -{ - PROTOCOL_EXAMPLE = 0, - PROTOCOL_COUNT -}; - -static struct lws_protocols protocols[] = -{ - { - "example-protocol", - callback_example, - 0, - EXAMPLE_RX_BUFFER_BYTES, - }, - { NULL, NULL, 0, 0 } /* terminator */ -}; - -int main( int argc, char *argv[] ) -{ - struct lws_context_creation_info info; - memset( &info, 0, sizeof(info) ); - - info.port = CONTEXT_PORT_NO_LISTEN; - info.protocols = protocols; - info.gid = -1; - info.uid = -1; - - struct lws_context *context = lws_create_context( &info ); - - /* Connect if we are not connected to the server. */ - struct lws_client_connect_info ccinfo = {0}; - ccinfo.context = context; - ccinfo.address = "localhost"; - ccinfo.port = 8000; - ccinfo.path = "/"; - ccinfo.host = lws_canonical_hostname( context ); - ccinfo.origin = "origin"; - ccinfo.protocol = protocols[PROTOCOL_EXAMPLE].name; - web_socket = lws_client_connect_via_info(&ccinfo); - - /* Send a random number to the server every second. */ - lws_callback_on_writable( web_socket ); - - lws_service( context, /* timeout_ms = */ 250 ); - - lws_context_destroy( context ); - +int main() { + const char* lws_version = lws_get_library_version(); + printf("libwebsocket version: %s\n", lws_version); return 0; } diff --git a/recipes/libwebsockets/config.yml b/recipes/libwebsockets/config.yml index 76fbd6a7ba025..35cfe962e4082 100644 --- a/recipes/libwebsockets/config.yml +++ b/recipes/libwebsockets/config.yml @@ -1,4 +1,6 @@ versions: + "4.3.3": + folder: all "4.3.2": folder: all "4.3.0": @@ -7,9 +9,3 @@ versions: folder: all "4.2.0": folder: all - "4.1.6": - folder: all - "4.1.4": - folder: all - "4.0.15": - folder: all diff --git a/recipes/libx264/all/conandata.yml b/recipes/libx264/all/conandata.yml index 394a54354a73d..f92af6ff75c03 100644 --- a/recipes/libx264/all/conandata.yml +++ b/recipes/libx264/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "cci.20240224": + url: "https://code.videolan.org/videolan/x264/-/archive/7241d020118bb09cc0ad119d7bc9f630a1caad10/x264-7241d020118bb09cc0ad119d7bc9f630a1caad10.tar.bz2" + sha256: "5417c167a69cc19db044c227163f9b9b1dface9fca361a3e83d5417f8e304dd6" "cci.20220602": url: "https://code.videolan.org/videolan/x264/-/archive/baee400fa9ced6f5481a728138fed6e867b0ff7f/x264-baee400fa9ced6f5481a728138fed6e867b0ff7f.tar.bz2" sha256: "ce6623b8b289765daee04a297c2fd1a293cb2565a1749c76d66c8d72c7ddc1ab" diff --git a/recipes/libx264/all/conanfile.py b/recipes/libx264/all/conanfile.py index fcaf19f43215d..90e54c1a8e8b6 100644 --- a/recipes/libx264/all/conanfile.py +++ b/recipes/libx264/all/conanfile.py @@ -1,12 +1,14 @@ from conan import ConanFile -from conan.tools.apple import is_apple_os +from conan.tools.apple import is_apple_os, XCRun, fix_apple_shared_install_name from conan.tools.build import cross_building -from conan.tools.files import get, rename, rmdir -from conans import tools, AutoToolsBuildEnvironment -import contextlib +from conan.tools.env import Environment, VirtualBuildEnv +from conan.tools.files import copy, rename, get, 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.51.3" +required_conan_version = ">=1.57.0" class LibX264Conan(ConanFile): @@ -15,7 +17,7 @@ class LibX264Conan(ConanFile): homepage = "https://www.videolan.org/developers/x264.html" description = "x264 is a free software library and application for encoding video streams into the " \ "H.264/MPEG-4 AVC compression format" - topics = ("libx264", "video", "encoding") + topics = ("video", "encoding") license = "GPL-2.0" settings = "os", "arch", "compiler", "build_type" @@ -23,167 +25,163 @@ class LibX264Conan(ConanFile): "shared": [True, False], "fPIC": [True, False], "bit_depth": [8, 10, "all"], + "with_opencl": [True, False], + "with_asm": [True, False] } + # The project by default enables opencl and asm, it can be opted-out default_options = { "shared": False, "fPIC": True, "bit_depth": "all", + "with_opencl": True, + "with_asm": True } - _autotools = None - _override_env = {} - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - - @property - def _source_subfolder(self): - return "source_subfolder" - - @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 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") @property def _with_nasm(self): return self.settings.arch in ("x86", "x86_64") + def layout(self): + basic_layout(self, src_folder="src") + def build_requirements(self): if self._with_nasm: - 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", 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): - with tools.vcvars(self) if self._is_msvc else tools.no_op(): - yield + def generate(self): + tc = AutotoolsToolchain(self) - @property - def env(self): - ret = super(LibX264Conan, self).env - ret.update(self._override_env) - return ret - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - self._autotools.libs = [] extra_asflags = [] extra_cflags = [] extra_ldflags = [] - args = [ - "--bit-depth=%s" % str(self.options.bit_depth), - "--disable-cli", - "--prefix={}".format(tools.unix_path(self.package_folder)), - ] + args = { + "--bit-depth": self.options.bit_depth, + "--disable-cli": "", + "--sbindir": None, # Not understood by configure + "--oldincludedir": None # Not understood by configure + } + args["--disable-shared"] = None # --disable-shared is not understood if self.options.shared: - args.append("--enable-shared") + args["--enable-shared"] = "" else: - args.append("--enable-static") + args["--enable-static"] = "" + if not self.options.with_opencl: + args["--disable-opencl"] = "" + if not self.options.with_asm: + args["--disable-asm"] = "" if self.options.get_safe("fPIC", self.settings.os != "Windows"): - args.append("--enable-pic") + args["--enable-pic"] = "" if self.settings.build_type == "Debug": - args.append("--enable-debug") + args["--enable-debug"] = "" + 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] + args["--host"] = "aarch64-apple-darwin" + if self.settings.os != "Macos": # TODO not sure why this is != "Macos" ... shouldn't it be == ?? + xcrun = XCRun(self) + platform_flags = ["-isysroot", xcrun.sdk_path] + apple_min_version_flag = AutotoolsToolchain(self).apple_min_version_flag + if apple_min_version_flag: + platform_flags.append(apple_min_version_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("\\", "/") + env = Environment() + env.define("AS", unix_path(self, os.path.join(self.dependencies.build["nasm"].package_folder, "bin", "nasm{}".format(".exe" if self.settings.os == "Windows" else "")))) + env.vars(self).save_script("conanbuild_nasm") + if cross_building(self): if self.settings.os == "Android": + buildenv_vars = VirtualBuildEnv(self).vars() + ndk_root = self.conf.get("tools.android:ndk_path", buildenv_vars.get("NDK_ROOT")) + + # INFO: Conan package android-ndk does not expose toolchain path. Looks fragile but follows always same for Android NDK + build_os = {"Linux": "linux", "Macos": "darwin", "Windows": "windows"}.get(str(self._settings_build.os)) + toolchain = os.path.join(ndk_root, "toolchains", "llvm", "prebuilt", f"{build_os}-{self._settings_build.arch}") + + sysroot = self.conf.get("tools.build:sysroot", buildenv_vars.get("SYSROOT", f"{toolchain}/sysroot")) + # INFO: x264 will look for strings appended to the cross prefix + cross_prefix = os.path.join(toolchain, "bin", "llvm-") + + compilers_from_conf = self.conf.get("tools.build:compiler_executables", default={}, check_type=dict) + + args["--build"] = None # --build is not recognized + args["--cross-prefix"] = cross_prefix + args["--sysroot"] = sysroot + # the as of ndk does not work well for building libx264 - self._override_env["AS"] = os.environ["CC"] - ndk_root = tools.unix_path(os.environ["NDK_ROOT"]) - arch = { - "armv7": "arm", - "armv8": "aarch64", - "x86": "i686", - "x86_64": "x86_64", - }.get(str(self.settings.arch)) - abi = "androideabi" if self.settings.arch == "armv7" else "android" - args.append("--cross-prefix={}".format("{}/bin/{}-linux-{}-".format(ndk_root, arch, abi))) - if self._is_msvc: - self._override_env["CC"] = "cl -nologo" - extra_cflags.extend(self._autotools.flags) - if not (self.settings.compiler == "Visual Studio" and tools.Version(self.settings.compiler.version) < "12"): - extra_cflags.append("-FS") - build_canonical_name = None - host_canonical_name = None - if self._is_msvc or self.settings.os in ["iOS", "watchOS", "tvOS"]: + env = Environment() + cc_as = compilers_from_conf.get("c", buildenv_vars.get("AS", "clang")) + env.define("AS", cc_as) + env_vars = env.vars(self, scope="build") + env_vars.save_script("conanbuild_android") + + if is_msvc(self): + env = Environment() + env.define("CC", "cl -nologo") + env.vars(self).save_script("conanbuild_msvc") + + if is_msvc(self) 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 + args["--build"] = None + args["--host"] = None + + # The finite-math-only optimization has no effect and can cause linking errors + # when linked against glibc >= 2.31 + extra_cflags += ["-fno-finite-math-only"] + if extra_asflags: - args.append("--extra-asflags={}".format(" ".join(extra_asflags))) + args["--extra-asflags"] = " ".join(extra_asflags) if extra_cflags: - args.append("--extra-cflags={}".format(" ".join(extra_cflags))) + args["--extra-cflags"] = " ".join(extra_cflags) if extra_ldflags: - args.append("--extra-ldflags={}".format(" ".join(extra_ldflags))) - self._autotools.configure(args=args, vars=self._override_env, configure_dir=self._source_subfolder, build=build_canonical_name, host=host_canonical_name) - return self._autotools + args["--extra-ldflags"] = " ".join(extra_ldflags) + tc.update_configure_args(args) + tc.generate() def build(self): - with self._build_context(): - # relocatable shared lib on macOS - tools.replace_in_file(os.path.join(self._source_subfolder, "configure"), - "-install_name \\$(DESTDIR)\\$(libdir)/", - "-install_name @rpath/") - autotools = self._configure_autotools() - autotools.make() + 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() + copy(self, pattern="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, "lib", "pkgconfig")) - if self._is_msvc: + if is_msvc(self): ext = ".dll.lib" if self.options.shared else ".lib" - rename(self, os.path.join(self.package_folder, "lib", "libx264{}".format(ext)), + rename(self, os.path.join(self.package_folder, "lib", f"libx264{ext}"), os.path.join(self.package_folder, "lib", "x264.lib")) + fix_apple_shared_install_name(self) def package_info(self): self.cpp_info.set_property("pkg_config_name", "x264") self.cpp_info.libs = ["x264"] - if self._is_msvc and self.options.shared: + if is_msvc(self) and self.options.shared: self.cpp_info.defines.append("X264_API_IMPORTS") - if self.settings.os in ("FreeBSD", "Linux"): + if self.settings.os in ["FreeBSD", "Linux"]: self.cpp_info.system_libs.extend(["dl", "pthread", "m"]) elif self.settings.os == "Android": self.cpp_info.system_libs.extend(["dl", "m"]) - - # TODO: to remove in conan v2 once pkg_config generator removed - self.cpp_info.names["pkg_config"] = "x264" diff --git a/recipes/libx264/all/test_package/CMakeLists.txt b/recipes/libx264/all/test_package/CMakeLists.txt index a98d4c1157e7e..9ef0da2dea968 100644 --- a/recipes/libx264/all/test_package/CMakeLists.txt +++ b/recipes/libx264/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(libx264 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} libx264::libx264) +target_link_libraries(${PROJECT_NAME} PRIVATE libx264::libx264) diff --git a/recipes/libx264/all/test_package/conanfile.py b/recipes/libx264/all/test_package/conanfile.py index 697dfef261b53..e845ae751a301 100644 --- a/recipes/libx264/all/test_package/conanfile.py +++ b/recipes/libx264/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/libx264/config.yml b/recipes/libx264/config.yml index be7607c4d1266..cce887c4b4859 100644 --- a/recipes/libx264/config.yml +++ b/recipes/libx264/config.yml @@ -1,4 +1,6 @@ versions: + "cci.20240224": + folder: all "cci.20220602": folder: all "20191217": diff --git a/recipes/libx265/all/CMakeLists.txt b/recipes/libx265/all/CMakeLists.txt deleted file mode 100644 index 4a7467ebe3dd1..0000000000000 --- a/recipes/libx265/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_LIBX265_SYSTEM_PROCESSOR}) -endif() - -add_subdirectory(source_subfolder/source) diff --git a/recipes/libx265/all/conandata.yml b/recipes/libx265/all/conandata.yml index 359a25270e5ee..c3b14b8a74194 100644 --- a/recipes/libx265/all/conandata.yml +++ b/recipes/libx265/all/conandata.yml @@ -1,16 +1,15 @@ sources: "3.4": - url: "https://github.com/videolan/x265/archive/3.4.tar.gz" + url: "https://github.com/videolan/x265/archive/refs/tags/3.4.tar.gz" sha256: "544d147bf146f8994a7bf8521ed878c93067ea1c7c6e93ab602389be3117eaaf" "3.2.1": - url: "https://github.com/videolan/x265/archive/3.2.1.tar.gz" - sha256: "b5ee7ea796a664d6e2763f9c0ae281fac5d25892fc2cb134698547103466a06a" + url: "https://bitbucket.org/multicoreware/x265_git/downloads/x265_3.2.1.tar.gz" + sha256: "b68939625356459e7055b9589451689924f236bac8deba3db21e3c2fb062d328" patches: "3.4": - - patch_file: "patches/0001-remove_register_classifier.patch" - base_path: "source_subfolder" - - patch_file: "patches/0002-numa.patch" - base_path: "source_subfolder" + - patch_file: "patches/3.2.1-0001-remove_register_classifier.patch" + - patch_file: "patches/3.2.1-0002-cmake-min-required.patch" + - patch_file: "patches/3.4-0001-numa.patch" "3.2.1": - - patch_file: "patches/0001-remove_register_classifier.patch" - base_path: "source_subfolder" + - patch_file: "patches/3.2.1-0001-remove_register_classifier.patch" + - patch_file: "patches/3.2.1-0002-cmake-min-required.patch" diff --git a/recipes/libx265/all/conanfile.py b/recipes/libx265/all/conanfile.py index 7da8c688857c1..313852081c905 100644 --- a/recipes/libx265/all/conanfile.py +++ b/recipes/libx265/all/conanfile.py @@ -1,20 +1,24 @@ -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.build import cross_building, stdcpp_library +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, replace_in_file, rename, rm, rmdir +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime import os -import shutil -required_conan_version = ">=1.36.0" +required_conan_version = ">=1.53.0" class Libx265Conan(ConanFile): name = "libx265" description = "x265 is the leading H.265 / HEVC encoder software library" - topics = ("libx265", "codec", "video", "H.265") + topics = ("x265", "codec", "video", "H.265") url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.videolan.org/developers/x265.html" license = ("GPL-2.0-only", "commercial") # https://bitbucket.org/multicoreware/x265/src/default/COPYING + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -35,25 +39,8 @@ class Libx265Conan(ConanFile): "with_numa": 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 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,101 +49,117 @@ def config_options(self): del self.options.with_numa # FIXME: Disable assembly by default if host is arm and compiler apple-clang for the moment. # Indeed, apple-clang is not able to understand some asm instructions of libx265 - if self.settings.compiler == "apple-clang" and "arm" in self.settings.arch: + # FIXME: Disable assembly by default if host is Android for the moment. It fails to build + if (self.settings.compiler == "apple-clang" and "arm" in self.settings.arch) or self.settings.os == "Android": self.options.assembly = False 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_numa", False): self.requires("libnuma/2.0.14") + def validate_build(self): + if cross_building(self) and self.settings.os == "Android" and self.options.assembly: + # FIXME: x265 uses custom command to invoke clang to compile assembly files. + # clang++ -fPIC -c src/source/common/aarch64/mc-a.S -o mc-a.S.o + # FAILED: mc-a.S.o libx2f309356bd8526/b/build/Release/mc-a.S.o + # clang++ -fPIC -c src/source/common/aarch64/mc-a.S -o mc-a.S.o + # :11:9: error: unknown directive + # .func x265_pixel_avg_pp_4x4_neon + raise ConanInvalidConfiguration(f"{self.ref} fails to build with '&:assembly=True' for Android. Contributions are welcome.") + def validate(self): - if self._is_msvc and self.options.shared and "MT" in msvc_runtime_flag(self): + if self.options.shared and is_msvc(self) and is_msvc_static_runtime(self): raise ConanInvalidConfiguration("shared not supported with static runtime") + if self.settings.compiler == "apple-clang" and "arm" in self.settings.arch and self.options.assembly: + # Undefined symbols for architecture arm64: + # "x265::setupAssemblyPrimitives(x265::EncoderPrimitives&, int)", referenced from: + # x265::x265_setup_primitives(x265_param*) in libx265.a[20](primitives.cpp.o) + # ld: symbol(s) not found for architecture arm64 + raise ConanInvalidConfiguration(f"{self.ref} fails to build for Mac M1. Contributions are welcome.") + def build_requirements(self): if self.options.assembly: if self.settings.arch in ["x86", "x86_64"]: - 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) - self._cmake.definitions["ENABLE_PIC"] = self.options.get_safe("fPIC", True) - self._cmake.definitions["ENABLE_SHARED"] = self.options.shared - self._cmake.definitions["ENABLE_ASSEMBLY"] = self.options.assembly - self._cmake.definitions["ENABLE_LIBNUMA"] = self.options.get_safe("with_numa", False) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + tc = CMakeToolchain(self) + tc.variables["ENABLE_PIC"] = self.options.get_safe("fPIC", True) + tc.variables["ENABLE_SHARED"] = self.options.shared + tc.variables["ENABLE_ASSEMBLY"] = self.options.assembly + tc.variables["ENABLE_LIBNUMA"] = self.options.get_safe("with_numa", False) if self.settings.os == "Macos": - self._cmake.definitions["CMAKE_SHARED_LINKER_FLAGS"] = "-Wl,-read_only_relocs,suppress" - self._cmake.definitions["HIGH_BIT_DEPTH"] = self.options.bit_depth != 8 - self._cmake.definitions["MAIN12"] = self.options.bit_depth == 12 - self._cmake.definitions["ENABLE_HDR10_PLUS"] = self.options.HDR10 - self._cmake.definitions["ENABLE_SVT_HEVC"] = self.options.SVG_HEVC_encoder - if self._is_msvc: - self._cmake.definitions["STATIC_LINK_CRT"] = "MT" in msvc_runtime_flag(self) + tc.variables["CMAKE_SHARED_LINKER_FLAGS"] = "-Wl,-read_only_relocs,suppress" + tc.variables["HIGH_BIT_DEPTH"] = self.options.bit_depth != 8 + tc.variables["MAIN12"] = self.options.bit_depth == 12 + tc.variables["ENABLE_HDR10_PLUS"] = self.options.HDR10 + tc.variables["ENABLE_SVT_HEVC"] = self.options.SVG_HEVC_encoder + if is_msvc(self): + tc.variables["STATIC_LINK_CRT"] = is_msvc_static_runtime(self) if self.settings.os == "Linux": - self._cmake.definitions["PLATFORM_LIBS"] = "dl" - if tools.cross_building(self.settings): - # 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_LIBX265_SYSTEM_PROCESSOR"] = cmake_system_processor + tc.variables["PLATFORM_LIBS"] = "dl" if "arm" in self.settings.arch: - self._cmake.definitions["CROSS_COMPILE_ARM"] = tools.cross_building(self.settings) - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + tc.variables["CROSS_COMPILE_ARM"] = cross_building(self) + tc.generate() + deps = CMakeDeps(self) + deps.generate() def _patch_sources(self): - cmakelists = os.path.join(self._source_subfolder, "source", "CMakeLists.txt") - tools.replace_in_file(cmakelists, + apply_conandata_patches(self) + cmakelists = os.path.join(self.source_folder, "source", "CMakeLists.txt") + replace_in_file(self, cmakelists, "if((WIN32 AND ENABLE_CLI) OR (WIN32 AND ENABLE_SHARED))", "if(FALSE)") if self.settings.os == "Android": - tools.replace_in_file(cmakelists, - "list(APPEND PLATFORM_LIBS pthread)", "") - tools.replace_in_file(cmakelists, - "list(APPEND PLATFORM_LIBS rt)", "") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + replace_in_file(self, cmakelists, "list(APPEND PLATFORM_LIBS pthread)", "") + replace_in_file(self, cmakelists, "list(APPEND PLATFORM_LIBS rt)", "") + # The finite-math-only optimization has no effect and can cause linking errors + # when linked against glibc >= 2.31 + replace_in_file(self, cmakelists, + "add_definitions(-ffast-math)", + "add_definitions(-ffast-math -fno-finite-math-only)") def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, "source")) 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() if self.options.shared: - if self._is_msvc: + if is_msvc(self): static_lib = "x265-static.lib" else: static_lib = "libx265.a" os.unlink(os.path.join(self.package_folder, "lib", static_lib)) - if self._is_msvc: + if is_msvc(self): name = "libx265.lib" if self.options.shared else "x265-static.lib" - shutil.move(os.path.join(self.package_folder, "lib", name), - os.path.join(self.package_folder, "lib", "x265.lib")) + rename(self, os.path.join(self.package_folder, "lib", name), + os.path.join(self.package_folder, "lib", "x265.lib")) - if self.settings.os != "Windows" or not self.options.shared: - tools.rmdir(os.path.join(self.package_folder, "bin")) + if self.settings.os == "Windows" and self.options.shared: + rm(self, "*[!.dll]", os.path.join(self.package_folder, "bin")) else: - for file in os.listdir(os.path.join(self.package_folder, "bin")): - if not file.endswith(".dll"): - os.unlink(os.path.join(self.package_folder, "bin", file)) - 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, "lib", "pkgconfig")) def package_info(self): self.cpp_info.set_property("pkg_config_name", "x265") @@ -165,15 +168,14 @@ def package_info(self): if self.options.shared: self.cpp_info.defines.append("X265_API_IMPORTS") elif self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.system_libs.extend(["dl", "pthread", "m"]) + self.cpp_info.system_libs.extend(["dl", "pthread", "m", "rt"]) if not self.options.shared: - if not self._is_msvc: - self.cpp_info.sharedlinkflags = ["-Wl,-Bsymbolic,-znoexecstack"] + self.cpp_info.sharedlinkflags = ["-Wl,-Bsymbolic,-znoexecstack"] elif self.settings.os == "Android": - self.cpp_info.libs.extend(["dl", "m"]) - libcxx = tools.stdcpp_library(self) - if libcxx: - self.cpp_info.system_libs.append(libcxx) - - # TODO: to remove in conan v2 once pkg_config generator removed - self.cpp_info.names["pkg_config"] = "x265" + self.cpp_info.system_libs.extend(["dl", "m"]) + if not self.options.shared: + libcxx = stdcpp_library(self) + if libcxx: + if self.settings.os == "Android" and self.settings.compiler.libcxx == "c++_static": + self.cpp_info.system_libs.append("c++abi") + self.cpp_info.system_libs.append(libcxx) diff --git a/recipes/libx265/all/patches/0002-numa.patch b/recipes/libx265/all/patches/0002-numa.patch deleted file mode 100644 index 7a150fbc7f008..0000000000000 --- a/recipes/libx265/all/patches/0002-numa.patch +++ /dev/null @@ -1,29 +0,0 @@ -diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt -index 1d1a613aa..43e1820c4 100644 ---- a/source/CMakeLists.txt -+++ b/source/CMakeLists.txt -@@ -97,20 +97,10 @@ if(UNIX) - endif() - option(ENABLE_LIBNUMA "Enable libnuma usage (Linux only)" ON) - if(ENABLE_LIBNUMA) -- find_package(Numa) -- if(NUMA_FOUND) -- link_directories(${NUMA_LIBRARY_DIR}) -- list(APPEND CMAKE_REQUIRED_LIBRARIES numa) -- list(APPEND CMAKE_REQUIRED_INCLUDES ${NUMA_INCLUDE_DIR}) -- list(APPEND CMAKE_REQUIRED_LINK_OPTIONS "-L${NUMA_LIBRARY_DIR}") -- check_symbol_exists(numa_node_of_cpu numa.h NUMA_V2) -- if(NUMA_V2) -- add_definitions(-DHAVE_LIBNUMA) -- message(STATUS "libnuma found, building with support for NUMA nodes") -- list(APPEND PLATFORM_LIBS numa) -- include_directories(${NUMA_INCLUDE_DIR}) -- endif() -- endif() -+ find_package(libnuma REQUIRED) -+ list(APPEND PLATFORM_LIBS ${libnuma_LIBRARIES}) -+ include_directories(${libnuma_INCLUDE_DIR}) -+ add_definitions(-DHAVE_LIBNUMA) - mark_as_advanced(NUMA_FOUND) - endif(ENABLE_LIBNUMA) - option(NO_ATOMICS "Use a slow mutex to replace atomics" OFF) diff --git a/recipes/libx265/all/patches/0001-remove_register_classifier.patch b/recipes/libx265/all/patches/3.2.1-0001-remove_register_classifier.patch similarity index 100% rename from recipes/libx265/all/patches/0001-remove_register_classifier.patch rename to recipes/libx265/all/patches/3.2.1-0001-remove_register_classifier.patch diff --git a/recipes/libx265/all/patches/3.2.1-0002-cmake-min-required.patch b/recipes/libx265/all/patches/3.2.1-0002-cmake-min-required.patch new file mode 100644 index 0000000000000..93f9560bd7156 --- /dev/null +++ b/recipes/libx265/all/patches/3.2.1-0002-cmake-min-required.patch @@ -0,0 +1,22 @@ +--- a/source/CMakeLists.txt ++++ b/source/CMakeLists.txt +@@ -1,10 +1,4 @@ +-# vim: syntax=cmake +-if(NOT CMAKE_BUILD_TYPE) +- # default to Release build for GCC builds +- set(CMAKE_BUILD_TYPE Release CACHE STRING +- "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." +- FORCE) +-endif() ++cmake_minimum_required(VERSION 3.1) + message(STATUS "cmake version ${CMAKE_VERSION}") + if(POLICY CMP0025) + cmake_policy(SET CMP0025 OLD) # report Apple's Clang as just Clang +@@ -17,7 +11,6 @@ if(POLICY CMP0054) + endif() + + project (x265) +-cmake_minimum_required (VERSION 2.8.8) # OBJECT libraries require 2.8.8 + include(CheckIncludeFiles) + include(CheckFunctionExists) + include(CheckSymbolExists) diff --git a/recipes/libx265/all/patches/3.4-0001-numa.patch b/recipes/libx265/all/patches/3.4-0001-numa.patch new file mode 100644 index 0000000000000..789c574f674fc --- /dev/null +++ b/recipes/libx265/all/patches/3.4-0001-numa.patch @@ -0,0 +1,27 @@ +--- a/source/CMakeLists.txt ++++ b/source/CMakeLists.txt +@@ -90,20 +90,10 @@ if(UNIX) + endif() + option(ENABLE_LIBNUMA "Enable libnuma usage (Linux only)" ON) + if(ENABLE_LIBNUMA) +- find_package(Numa) +- if(NUMA_FOUND) +- link_directories(${NUMA_LIBRARY_DIR}) +- list(APPEND CMAKE_REQUIRED_LIBRARIES numa) +- list(APPEND CMAKE_REQUIRED_INCLUDES ${NUMA_INCLUDE_DIR}) +- list(APPEND CMAKE_REQUIRED_LINK_OPTIONS "-L${NUMA_LIBRARY_DIR}") +- check_symbol_exists(numa_node_of_cpu numa.h NUMA_V2) +- if(NUMA_V2) +- add_definitions(-DHAVE_LIBNUMA) +- message(STATUS "libnuma found, building with support for NUMA nodes") +- list(APPEND PLATFORM_LIBS numa) +- include_directories(${NUMA_INCLUDE_DIR}) +- endif() +- endif() ++ find_package(libnuma REQUIRED) ++ list(APPEND PLATFORM_LIBS ${libnuma_LIBRARIES}) ++ include_directories(${libnuma_INCLUDE_DIR}) ++ add_definitions(-DHAVE_LIBNUMA) + mark_as_advanced(NUMA_FOUND) + endif(ENABLE_LIBNUMA) + option(NO_ATOMICS "Use a slow mutex to replace atomics" OFF) diff --git a/recipes/libx265/all/test_package/CMakeLists.txt b/recipes/libx265/all/test_package/CMakeLists.txt index 9e59bba65386c..b8fa451c9e6c3 100644 --- a/recipes/libx265/all/test_package/CMakeLists.txt +++ b/recipes/libx265/all/test_package/CMakeLists.txt @@ -1,21 +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(libx265 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) target_link_libraries(${PROJECT_NAME} PRIVATE libx265::libx265) - -option(TEST_LIBRARY "Build test library") -if(TEST_LIBRARY) - # Test building a shared library. - # a static libx265.a on Linux requires linker flags to avoid PIC related relocation errors. - add_library(test_library SHARED test_library.c) - target_link_libraries(test_library PRIVATE libx265::libx265) - - target_compile_definitions(${PROJECT_NAME} PRIVATE WITH_LIB) - target_link_libraries(${PROJECT_NAME} PRIVATE test_library) -endif() diff --git a/recipes/libx265/all/test_package/conanfile.py b/recipes/libx265/all/test_package/conanfile.py index be66599572010..539e617675db7 100644 --- a/recipes/libx265/all/test_package/conanfile.py +++ b/recipes/libx265/all/test_package/conanfile.py @@ -1,37 +1,26 @@ -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, cmake_layout import os -import glob -import shutil class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" - @property - def _test_shared_library(self): - # shared library linking with static libnuma is not supported - if "with_numa" in self.options["libx265"] and \ - bool(self.options["libx265"].with_numa) and \ - not bool(self.options["libnuma"].shared): - return False - try: - return self.options["libx265"].fPIC - except ConanException: - return True + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str, run=True) def build(self): cmake = CMake(self) - cmake.definitions["TEST_LIBRARY"] = self._test_shared_library cmake.configure() cmake.build() def test(self): - # Copy all libraries to current and bin folderso we don't need any LD_LIBRARY_PATH/DYLD_LIBRARY_PATH/PATH (which might conflict with run_environment argument of self.run) - for fn in glob.glob(os.path.join("lib", "*")): - shutil.copy(src=fn, dst="bin") - shutil.copy(src=fn, dst=".") - 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/libx265/all/test_package/test_library.c b/recipes/libx265/all/test_package/test_library.c deleted file mode 100644 index 417ff8e89ed90..0000000000000 --- a/recipes/libx265/all/test_package/test_library.c +++ /dev/null @@ -1,25 +0,0 @@ -#include "x265.h" - -#include - -#ifdef _WIN32 -# define TEST_EXPORT __declspec(dllexport) -#else -# define TEST_EXPORT __attribute__ ((visibility("default"))) -#endif - -TEST_EXPORT const char *test_library_version(void) { - return x265_version_str; -} - -TEST_EXPORT void test_library_something(void) { - x265_param * param = x265_param_alloc(); - x265_param_default(param); - param->sourceWidth = 640; - param->sourceHeight = 480; - param->fpsNum = 25; - param->fpsDenom = 1; - x265_encoder * encoder = x265_encoder_open(param); - x265_encoder_close(encoder); - x265_param_free(param); -} diff --git a/recipes/libx265/all/test_v1_package/CMakeLists.txt b/recipes/libx265/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libx265/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libx265/all/test_v1_package/conanfile.py b/recipes/libx265/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libx265/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/libxcrypt/all/conandata.yml b/recipes/libxcrypt/all/conandata.yml index df7c72ca12c22..fb3a279cbaa17 100644 --- a/recipes/libxcrypt/all/conandata.yml +++ b/recipes/libxcrypt/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "4.4.36": + url: "https://github.com/besser82/libxcrypt/archive/v4.4.36.tar.gz" + sha256: "b979838d5f1f238869d467484793b72b8bca64c4eae696fdbba0a9e0b6c28453" + "4.4.35": + url: "https://github.com/besser82/libxcrypt/archive/v4.4.35.tar.gz" + sha256: "15981f2ffb82d70f07285f9683c485c4774083057564a2e7e74236c19e8e9f7b" + "4.4.34": + url: "https://github.com/besser82/libxcrypt/archive/v4.4.34.tar.gz" + sha256: "8888bbe9f8530bbd9f8063d65288018d419f91e9b3e3349abb8cb4d0a0397cc5" "4.4.28": url: "https://github.com/besser82/libxcrypt/archive/v4.4.28.tar.gz" sha256: "db7e37901969cb1d1e8020cb73a991ef81e48e31ea5b76a101862c806426b457" diff --git a/recipes/libxcrypt/all/conanfile.py b/recipes/libxcrypt/all/conanfile.py index 7f1e95bcfd907..9535c01222b44 100644 --- a/recipes/libxcrypt/all/conanfile.py +++ b/recipes/libxcrypt/all/conanfile.py @@ -19,6 +19,7 @@ class LibxcryptConan(ConanFile): topics = ("hash", "password", "one-way", "bcrypt", "md5", "sha256", "sha512") license = ("LGPL-2.1-or-later", ) settings = "os", "arch", "compiler", "build_type" + package_type = "library" options = { "shared": [True, False], "fPIC": [True, False], diff --git a/recipes/libxcrypt/config.yml b/recipes/libxcrypt/config.yml index 5f226d94e67a1..e6406af656d46 100644 --- a/recipes/libxcrypt/config.yml +++ b/recipes/libxcrypt/config.yml @@ -1,4 +1,10 @@ versions: + "4.4.36": + folder: all + "4.4.35": + folder: all + "4.4.34": + folder: all "4.4.28": folder: all "4.4.27": diff --git a/recipes/libxft/all/conandata.yml b/recipes/libxft/all/conandata.yml index e56e888b5fdb6..83115b8c226aa 100644 --- a/recipes/libxft/all/conandata.yml +++ b/recipes/libxft/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.3.8": + url: "https://www.x.org/archive/individual/lib/libXft-2.3.8.tar.xz" + sha256: "5e8c3c4bc2d4c0a40aef6b4b38ed2fb74301640da29f6528154b5009b1c6dd49" "2.3.6": url: "https://www.x.org/archive/individual/lib/libXft-2.3.6.tar.gz" sha256: "b7e59f69e0bbabe9438088775f7e5a7c16a572e58b11f9722519385d38192df5" @@ -11,4 +14,3 @@ patches: 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 5bb077b0fdb7a..1fef477064c1e 100644 --- a/recipes/libxft/all/conanfile.py +++ b/recipes/libxft/all/conanfile.py @@ -1,78 +1,86 @@ +import os + from conan import ConanFile -from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, chdir, rm, rmdir -from conans import AutoToolsBuildEnvironment -import functools +from conan.tools.files import apply_conandata_patches, chdir, copy, export_conandata_patches, get, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain, PkgConfigDeps +from conan.tools.layout import basic_layout + +required_conan_version = ">=1.53.0" -required_conan_version = ">=1.52.0" class libxftConan(ConanFile): name = "libxft" - description = 'X FreeType library' - topics = ("libxft", "x11", "xorg") + description = "X FreeType library" + license = "X11" url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.x.org/wiki/" - license = "X11" + topics = ("x11", "xorg") + package_type = "library" settings = "os", "arch", "compiler", "build_type" - options = {"shared": [True, False], "fPIC": [True, False]} - default_options = {"shared": False, "fPIC": True} - generators = "pkg_config" - - @property - def _source_subfolder(self): - return "source_subfolder" + 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): + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + basic_layout(self, src_folder="src") + def requirements(self): self.requires("xorg/system") - self.requires("freetype/2.12.1") - self.requires("fontconfig/2.13.93") + self.requires("freetype/2.13.2", transitive_headers=True) + self.requires("fontconfig/2.15.0", transitive_headers=True) def build_requirements(self): - self.build_requires("pkgconf/1.7.4") - self.build_requires("xorg-macros/1.19.3") - self.build_requires("libtool/2.4.7") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/2.1.0") + self.tool_requires("xorg-macros/1.20.0") + self.tool_requires("libtool/2.4.7") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def configure(self): - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd - if self.options.shared: - del self.options.fPIC + get(self, **self.conan_data["sources"][self.version], strip_root=True) - @functools.lru_cache(1) - def _configure_autotools(self): - args = ["--disable-dependency-tracking"] - if self.options.shared: - args.extend(["--disable-static", "--enable-shared"]) - else: - args.extend(["--disable-shared", "--enable-static"]) - autotools = AutoToolsBuildEnvironment(self) - autotools.configure(args=args, pkg_config_paths=self.build_folder) - return autotools + def generate(self): + tc = AutotoolsToolchain(self) + tc.configure_args.append("--disable-dependency-tracking") + tc.generate() + tc = PkgConfigDeps(self) + tc.generate() def build(self): apply_conandata_patches(self) - with chdir(self, self._source_subfolder): - autotools = self._configure_autotools() + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.configure() 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 chdir(self, self._source_subfolder): - autotools = self._configure_autotools() + 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) + with chdir(self, self.source_folder): + autotools = Autotools(self) autotools.install(args=["-j1"]) 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" self.cpp_info.set_property("pkg_config_name", "xft") self.cpp_info.libs = ["Xft"] diff --git a/recipes/libxft/all/test_package/CMakeLists.txt b/recipes/libxft/all/test_package/CMakeLists.txt index e55ad61e844f5..71362aacc231a 100644 --- a/recipes/libxft/all/test_package/CMakeLists.txt +++ b/recipes/libxft/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(libxft REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) diff --git a/recipes/libxft/all/test_package/conanfile.py b/recipes/libxft/all/test_package/conanfile.py index 49a3a66ea5bad..ef5d7042163ec 100644 --- a/recipes/libxft/all/test_package/conanfile.py +++ b/recipes/libxft/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libxft/all/test_v1_package/CMakeLists.txt b/recipes/libxft/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/libxft/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/libxft/all/test_v1_package/conanfile.py b/recipes/libxft/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..49a3a66ea5bad --- /dev/null +++ b/recipes/libxft/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/libxft/config.yml b/recipes/libxft/config.yml index 6caf25620b5dc..d3f36d4632aef 100644 --- a/recipes/libxft/config.yml +++ b/recipes/libxft/config.yml @@ -1,4 +1,6 @@ versions: + "2.3.8": + folder: all "2.3.6": folder: all "2.3.4": 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..32c04966aac0e --- /dev/null +++ b/recipes/libxls/all/conanfile.py @@ -0,0 +1,117 @@ +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 apply_conandata_patches, copy, export_conandata_patches, get, 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 + +import os + +required_conan_version = ">=1.54.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") + package_type = "library" + 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, + } + + @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.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 is_msvc(self): + raise ConanInvalidConfiguration(f"{self.ref} doesn't support Visual Studio (yet). Contributions are always welcomed") + + 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): + 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) + if cross_building(self): + tc.configure_args.append("ac_cv_func_malloc_0_nonnull=yes") + tc.configure_args.append("ac_cv_func_realloc_0_nonnull=yes") + tc.generate() + deps = AutotoolsDeps(self) + deps.generate() + + def _patch_sources(self): + apply_conandata_patches(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) + + 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")) + fix_apple_shared_install_name(self) + + def package_info(self): + self.cpp_info.set_property("pkg_config_name", "libxls") + self.cpp_info.libs = ["xlsreader"] + if is_apple_os(self): + self.cpp_info.system_libs.append("iconv") 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/conandata.yml b/recipes/libxlsxwriter/all/conandata.yml index b6ef8ccb7684d..0ea86bf27abee 100644 --- a/recipes/libxlsxwriter/all/conandata.yml +++ b/recipes/libxlsxwriter/all/conandata.yml @@ -1,4 +1,16 @@ sources: + "1.1.9": + url: "https://github.com/jmcnamara/libxlsxwriter/archive/v1.1.9.tar.gz" + sha256: "03ae330d50f74c8a70be0b06b52bd50868f7cd1251ed040fe3b68d1ad6fd11dc" + "1.1.8": + url: "https://github.com/jmcnamara/libxlsxwriter/archive/v1.1.8.tar.gz" + sha256: "122c98353e5b69284a1cd782be7ae67bdefde2146f8197ef89a1aaf886058e86" + "1.1.7": + url: "https://github.com/jmcnamara/libxlsxwriter/archive/RELEASE_1.1.7.tar.gz" + sha256: "1f378e25d8bb5be258d3e04d3d24b8c23ff21bf206e6e206661844a96ca25eda" + "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,6 +21,23 @@ sources: url: "https://github.com/jmcnamara/libxlsxwriter/archive/RELEASE_1.0.0.tar.gz" sha256: "8b353379333c323d14a9d265cd2491d3a6c0032c8d6ec2141f10b82ab66a087c" patches: + "1.1.9": + - patch_file: "patches/1.1.9-0001-fix-cmake.patch" + patch_description: "Fix CMake: disable pkgconfig & avoid some hardcoded flags" + patch_type: "conan" + "1.1.8": + - patch_file: "patches/1.1.7-0001-fix-cmake.patch" + patch_description: "Fix CMake: robust dependencies discovery & avoid some hardcoded flags" + patch_type: "conan" + "1.1.7": + - patch_file: "patches/1.1.7-0001-fix-cmake.patch" + patch_description: "Fix CMake: robust dependencies discovery & avoid some hardcoded flags" + patch_type: "conan" + "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": - patch_file: "patches/1.1.3-0001-fix-cmake.patch" patch_description: "Fix CMake: robust dependencies discovery & avoid some hardcoded flags" diff --git a/recipes/libxlsxwriter/all/conanfile.py b/recipes/libxlsxwriter/all/conanfile.py index 467437938757a..fa8e3e538ed45 100644 --- a/recipes/libxlsxwriter/all/conanfile.py +++ b/recipes/libxlsxwriter/all/conanfile.py @@ -6,17 +6,18 @@ from conan.tools.scm import Version import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class LibxlsxwriterConan(ConanFile): name = "libxlsxwriter" + description = "A C library for creating Excel XLSX files" license = "BSD-2-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/jmcnamara/libxlsxwriter" topics = ("excel", "xlsx") - description = "A C library for creating Excel XLSX files" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -46,35 +47,25 @@ def config_options(self): 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 + 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("minizip/1.2.13") - self.requires("zlib/1.2.13") + self.requires("zlib/[>=1.2.11 <2]") if self.options.md5 == "openssl": - self.requires("openssl/1.1.1s") + self.requires("openssl/[>=1.1 <4]") 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}") 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) @@ -91,6 +82,8 @@ def generate(self): tc.variables["USE_STATIC_MSVC_RUNTIME"] = is_msvc_static_runtime(self) tc.generate() deps = CMakeDeps(self) + if Version(self.version) >= "1.1.9": + deps.set_property("minizip", "cmake_additional_variables_prefixes", ["MINIZIP"]) deps.generate() def build(self): 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/patches/1.1.7-0001-fix-cmake.patch b/recipes/libxlsxwriter/all/patches/1.1.7-0001-fix-cmake.patch new file mode 100644 index 0000000000000..715f102673099 --- /dev/null +++ b/recipes/libxlsxwriter/all/patches/1.1.7-0001-fix-cmake.patch @@ -0,0 +1,39 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 0e855c7..f38f37a 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -183,9 +183,9 @@ endif() + + if(NOT BUILD_SHARED_LIBS) + if(UNIX) +- set(CMAKE_POSITION_INDEPENDENT_CODE ON) ++# 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\"") +@@ -224,7 +224,7 @@ enable_language(CXX) + list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) + + # ZLIB +-find_package(ZLIB "1.0" REQUIRED) ++find_package(ZLIB REQUIRED CONFIG) + list(APPEND LXW_PRIVATE_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS}) + message("zlib version: " ${ZLIB_VERSION}) + +@@ -294,9 +294,11 @@ 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. + # In CMake 3.7 and above, we can use (MSVC_VERSION GREATER_EQUAL 1900) here. + if(MSVC AND NOT (MSVC_VERSION LESS 1900)) diff --git a/recipes/libxlsxwriter/all/patches/1.1.9-0001-fix-cmake.patch b/recipes/libxlsxwriter/all/patches/1.1.9-0001-fix-cmake.patch new file mode 100644 index 0000000000000..629e8a20aa61d --- /dev/null +++ b/recipes/libxlsxwriter/all/patches/1.1.9-0001-fix-cmake.patch @@ -0,0 +1,25 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index e444dcc..44a638d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -183,9 +183,9 @@ endif() + + if(NOT BUILD_SHARED_LIBS) + if(UNIX) +- set(CMAKE_POSITION_INDEPENDENT_CODE ON) ++# 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\"") +@@ -208,7 +208,7 @@ if(MSVC AND USE_STATIC_MSVC_RUNTIME) + endif() + + # Configure pkg-config +-find_package(PkgConfig) ++# find_package(PkgConfig) + file(READ "include/xlsxwriter.h" ver) + + string(REGEX MATCH "LXW_VERSION \"([^\"]+)\"" _ ${ver}) diff --git a/recipes/libxlsxwriter/config.yml b/recipes/libxlsxwriter/config.yml index 3e62b328f7fc7..62ca2e89bd627 100644 --- a/recipes/libxlsxwriter/config.yml +++ b/recipes/libxlsxwriter/config.yml @@ -1,4 +1,12 @@ versions: + "1.1.9": + folder: "all" + "1.1.8": + folder: "all" + "1.1.7": + folder: "all" + "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 bf398536e5842..c069bc0bd33b1 100644 --- a/recipes/libxml2/all/conandata.yml +++ b/recipes/libxml2/all/conandata.yml @@ -1,19 +1,37 @@ sources: + "2.13.4": + url: "https://download.gnome.org/sources/libxml2/2.13/libxml2-2.13.4.tar.xz" + sha256: "65d042e1c8010243e617efb02afda20b85c2160acdbfbcb5b26b80cec6515650" + "2.12.9": + url: "https://download.gnome.org/sources/libxml2/2.12/libxml2-2.12.9.tar.xz" + sha256: "59912db536ab56a3996489ea0299768c7bcffe57169f0235e7f962a91f483590" + "2.12.4": + url: "https://download.gnome.org/sources/libxml2/2.12/libxml2-2.12.4.tar.xz" + sha256: "497360e423cf0bd99eacdb7c6215dea92e6d6e89ee940393c2bae0e77cb9b7d0" + "2.12.3": + url: "https://download.gnome.org/sources/libxml2/2.12/libxml2-2.12.3.tar.xz" + sha256: "8c8f1092340a89ff32bc44ad5c9693aff9bc8a7a3e161bb239666e5d15ac9aaa" + "2.11.9": + url: "https://download.gnome.org/sources/libxml2/2.11/libxml2-2.11.9.tar.xz" + sha256: "780157a1efdb57188ec474dca87acaee67a3a839c2525b2214d318228451809f" + "2.11.6": + url: "https://download.gnome.org/sources/libxml2/2.11/libxml2-2.11.6.tar.xz" + sha256: "c90eee7506764abbe07bb616b82da452529609815aefef423d66ef080eb0c300" + "2.11.4": + url: "https://download.gnome.org/sources/libxml2/2.11/libxml2-2.11.4.tar.xz" + sha256: "737e1d7f8ab3f139729ca13a2494fd17bf30ddb4b7a427cf336252cab57f57f7" + "2.10.4": + url: "https://download.gnome.org/sources/libxml2/2.10/libxml2-2.10.4.tar.xz" + sha256: "ed0c91c5845008f1936739e4eee2035531c1c94742c6541f44ee66d885948d45" "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" - "2.9.13": - url: "https://download.gnome.org/sources/libxml2/2.9/libxml2-2.9.13.tar.xz" - sha256: "276130602d12fe484ecc03447ee5e759d0465558fbc9d6bd144e3745306ebf0e" "2.9.12": url: "https://download.gnome.org/sources/libxml2/2.9/libxml2-2.9.12.tar.xz" sha256: "28a92f6ab1f311acf5e478564c49088ef0ac77090d9c719bbc5d518f1fe62eb9" "2.9.10": url: "https://download.gnome.org/sources/libxml2/2.9/libxml2-2.9.10.tar.xz" sha256: "593b7b751dd18c2d6abcd0c4bcb29efc203d0b4373a6df98e3a455ea74ae2813" - "2.9.9": - url: "https://download.gnome.org/sources/libxml2/2.9/libxml2-2.9.9.tar.xz" - sha256: "58a5c05a2951f8b47656b676ce1017921a29f6b1419c45e3baed0d6435ba03f5" diff --git a/recipes/libxml2/all/conanfile.py b/recipes/libxml2/all/conanfile.py index c183f8d0d6e08..6ab1df68617ff 100644 --- a/recipes/libxml2/all/conanfile.py +++ b/recipes/libxml2/all/conanfile.py @@ -1,27 +1,28 @@ from conan import ConanFile -from conan.tools.env import Environment, VirtualBuildEnv, VirtualRunEnv -from conan.tools.scm import Version +from conan.tools.apple import fix_apple_shared_install_name from conan.tools.build import cross_building, build_jobs +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv 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 +from conan.tools.microsoft import is_msvc, msvc_runtime_flag, unix_path, NMakeDeps, NMakeToolchain +from conan.tools.scm import Version import os import itertools import textwrap -required_conan_version = ">=1.53.0" +required_conan_version = ">=1.55.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" homepage = "https://gitlab.gnome.org/GNOME/libxml2/-/wikis/" license = "MIT" - settings = "os", "arch", "compiler", "build_type" # from ./configure and ./win32/configure.js default_options = { @@ -63,8 +64,9 @@ class Libxml2Conan(ConanFile): options = {name: [True, False] for name in default_options.keys()} @property - def _option_names(self): - return [name for name in self.info.options.keys() if name not in ["shared", "fPIC", "include_utils"]] + 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): @@ -79,6 +81,10 @@ def config_options(self): del self.options.fPIC if Version(self.version) >= "2.10.3": del self.options.docbook + if Version(self.version) >= "2.11.0": + self.options.rm_safe("run-debug") + if Version(self.version) >= "2.13.0": + self.options.rm_safe("mem-debug") def configure(self): if self.options.shared: @@ -91,37 +97,33 @@ def layout(self): def requirements(self): if self.options.zlib: - self.requires("zlib/1.2.13") + self.requires("zlib/[>=1.2.11 <2]") if self.options.lzma: - self.requires("xz_utils/5.2.5") + self.requires("xz_utils/5.4.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/72.1") + self.requires("icu/73.2") def build_requirements(self): if not (is_msvc(self) or self._is_mingw_windows): if self.options.zlib or self.options.lzma or self.options.icu: - self.tool_requires("pkgconf/1.9.3") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/2.1.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): - 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 is_msvc(self): - tc = VCVars(self) + tc = NMakeToolchain(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") + deps = NMakeDeps(self) + deps.generate() elif self._is_mingw_windows: pass # nothing to do for mingw? it calls mingw-make directly else: @@ -139,7 +141,7 @@ def generate(self): f"--enable-shared={yes_no(self.options.shared)}", f"--enable-static={yes_no(not self.options.shared)}", ]) - for option_name in self._option_names: + 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)}") @@ -171,7 +173,7 @@ def _build_msvc(self): args.append(f"include=\"{';'.join(incdirs)}\"") args.append(f"lib=\"{';'.join(libdirs)}\"") - for name in self._option_names: + for name in self._configure_option_names: cname = {"mem-debug": "mem_debug", "run-debug": "run_debug", "docbook": "docb"}.get(name, name) @@ -187,7 +189,8 @@ def _build_msvc(self): def fix_library(option, package, old_libname): if option: libs = [] - for lib in itertools.chain(self.dependencies[package].cpp_info.libs, self.dependencies[package].cpp_info.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' @@ -232,7 +235,7 @@ def _build_mingw(self): args.append(f"include=\"{' -I'.join(incdirs)}\"") args.append(f"lib=\"{' -L'.join(libdirs)}\"") - for name in self._option_names: + for name in self._configure_option_names: cname = { "mem-debug": "mem_debug", "run-debug": "run_debug", @@ -246,10 +249,11 @@ def _build_mingw(self): # build def fix_library(option, package, old_libname): if option: + aggregated_cpp_info = self.dependencies[package].cpp_info.aggregated_components() replace_in_file(self, "Makefile.mingw", f"LIBS += -l{old_libname}", - f"LIBS += -l{' -l'.join(self.dependencies[package].cpp_info.libs)}", + f"LIBS += -l{' -l'.join(aggregated_cpp_info.libs)}", ) fix_library(self.options.iconv, "libiconv", "iconv") @@ -273,10 +277,6 @@ def _patch_sources(self): replace_in_file(self, os.path.join(self.source_folder, "win32", makefile), "install-libs : all", "install-libs :") - # relocatable shared lib 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() @@ -329,6 +329,7 @@ def package(self): 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")) + fix_apple_shared_install_name(self) for header in ["win32config.h", "wsockcompat.h"]: copy(self, pattern=header, src=os.path.join(self.source_folder, "include"), @@ -340,33 +341,31 @@ def package(self): def _create_cmake_module_variables(self, module_file): # FIXME: also define LIBXML2_XMLLINT_EXECUTABLE variable - content = textwrap.dedent("""\ + content = textwrap.dedent(f"""\ 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}) + 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}) + set(LIBXML2_INCLUDE_DIR ${{libxml2_INCLUDE_DIRS}}) + set(LIBXML2_INCLUDE_DIRS ${{libxml2_INCLUDE_DIRS}}) endif() if(DEFINED LibXml2_LIBRARIES) - set(LIBXML2_LIBRARIES ${LibXml2_LIBRARIES}) - set(LIBXML2_LIBRARY ${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}) + set(LIBXML2_LIBRARIES ${{libxml2_LIBRARIES}}) + set(LIBXML2_LIBRARY ${{libxml2_LIBRARIES}}) endif() if(DEFINED LibXml2_DEFINITIONS) - set(LIBXML2_DEFINITIONS ${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}) + set(LIBXML2_DEFINITIONS ${{libxml2_DEFINITIONS}}) + else() + set(LIBXML2_DEFINITIONS "") endif() + set(LIBXML2_VERSION_STRING "{self.version}") """) save(self, module_file, content) @@ -401,6 +400,10 @@ def package_info(self): elif self.settings.os == "Windows": if self.options.ftp or self.options.http: self.cpp_info.system_libs.extend(["ws2_32", "wsock32"]) + if Version(self.version) >= "2.13.4": + # https://gitlab.gnome.org/GNOME/libxml2/-/issues/791 + # https://gitlab.gnome.org/GNOME/libxml2/-/blob/2.13/win32/Makefile.msvc?ref_type=heads#L84 + self.cpp_info.system_libs.append("bcrypt") # TODO: to remove in conan v2 once cmake_find_package* & pkg_config generators removed self.cpp_info.filenames["cmake_find_package"] = "LibXml2" diff --git a/recipes/libxml2/all/test_cmake_module_package/CMakeLists.txt b/recipes/libxml2/all/test_cmake_module_package/CMakeLists.txt index 90d37ee9afb23..de255480513cc 100644 --- a/recipes/libxml2/all/test_cmake_module_package/CMakeLists.txt +++ b/recipes/libxml2/all/test_cmake_module_package/CMakeLists.txt @@ -18,7 +18,7 @@ set(_custom_vars LIBXML2_VERSION_STRING ) foreach(_custom_var ${_custom_vars}) - if(DEFINED _custom_var) + if(DEFINED ${_custom_var}) message(STATUS "${_custom_var}: ${${_custom_var}}") else() message(FATAL_ERROR "${_custom_var} not defined") diff --git a/recipes/libxml2/all/test_package/test_package.c b/recipes/libxml2/all/test_package/test_package.c index b4b977f00d342..01dc455ced597 100644 --- a/recipes/libxml2/all/test_package/test_package.c +++ b/recipes/libxml2/all/test_package/test_package.c @@ -1,4 +1,5 @@ #include +#include #include #include #include diff --git a/recipes/libxml2/config.yml b/recipes/libxml2/config.yml index 6e02d8e0c9b1d..bf2c99b1007bf 100644 --- a/recipes/libxml2/config.yml +++ b/recipes/libxml2/config.yml @@ -1,13 +1,25 @@ versions: + "2.13.4": + folder: all + "2.12.9": + folder: all + "2.12.4": + folder: all + "2.12.3": + folder: all + "2.11.9": + folder: all + "2.11.6": + folder: all + "2.11.4": + folder: all + "2.10.4": + folder: all "2.10.3": folder: all "2.9.14": folder: all - "2.9.13": - folder: all "2.9.12": folder: all "2.9.10": folder: all - "2.9.9": - folder: all diff --git a/recipes/libxmlpp/2.x.x/conandata.yml b/recipes/libxmlpp/2.x.x/conandata.yml deleted file mode 100644 index c28f5a99de926..0000000000000 --- a/recipes/libxmlpp/2.x.x/conandata.yml +++ /dev/null @@ -1,15 +0,0 @@ -sources: - "5.0.1": - url: "https://github.com/libxmlplusplus/libxmlplusplus/releases/download/5.0.1/libxml++-5.0.1.tar.xz" - sha256: "15c38307a964fa6199f4da6683a599eb7e63cc89198545b36349b87cf9aa0098" - "2.42.1": - url: "https://github.com/libxmlplusplus/libxmlplusplus/releases/download/2.42.1/libxml++-2.42.1.tar.xz" - sha256: "9b59059abe5545d28ceb388a55e341095f197bd219c73e6623aeb6d801e00be8" - -patches: - "5.0.1": - - patch_file: "patches/5.0.1-0001-enable_static_builds_on_msvc.patch" - base_path: "source_subfolder" - "2.42.1": - - patch_file: "patches/2.42.1-0001-enable_static_builds_on_msvc.patch" - base_path: "source_subfolder" diff --git a/recipes/libxmlpp/2.x.x/conanfile.py b/recipes/libxmlpp/2.x.x/conanfile.py deleted file mode 100644 index 1297a686c1b40..0000000000000 --- a/recipes/libxmlpp/2.x.x/conanfile.py +++ /dev/null @@ -1,155 +0,0 @@ -from conans import ConanFile, Meson, tools -from conan.tools.files import rename -from conans.errors import ConanInvalidConfiguration -from conan.tools.microsoft import is_msvc -import shutil -import os -import functools - -required_conan_version = ">=1.45.0" - -class LibXMLPlusPlus(ConanFile): - # FIXME: naming the library "libxml++" causes conan not to add it to the - # environment path on windows - name = "libxmlpp" - description = "libxml++ (a.k.a. libxmlplusplus) provides a C++ interface to XML files" - license = "LGPL-2.1" - url = "https://github.com/conan-io/conan-center-index" - homepage = "https://github.com/libxmlplusplus/libxmlplusplus" - topics = ["xml", "parser", "wrapper"] - settings = "os", "arch", "compiler", "build_type" - options = { - "shared": [True, False], - "fPIC": [True, False], - } - default_options = { - "shared": False, - "fPIC": True, - } - generators = "pkg_config" - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - - 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 - - def requirements(self): - self.requires("libxml2/2.9.14") - if tools.Version(self.version) <= "2.42.1": - self.requires("glibmm/2.66.4") - else: - self.requires("glibmm/2.72.1") - - 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) - - def build_requirements(self): - self.build_requires("meson/0.63.0") - self.build_requires("pkgconf/1.7.4") - - 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 is_msvc(self): - # 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 the Windows SDK isn't standard conformant! - # see: - # https://developercommunity.visualstudio.com/t/error-c2760-in-combaseapih-with-windows-sdk-81-and/185399 - tools.replace_in_file( - os.path.join(self._source_subfolder, "meson.build"), - "cpp_std=c++", "cpp_std=vc++") - - @functools.lru_cache(1) - def _configure_meson(self): - meson = Meson(self) - defs = { - "build-examples": "false", - "build-tests": "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 - - def build(self): - self._patch_sources() - with tools.environment_append(tools.RunEnvironment(self).vars): - meson = self._configure_meson() - meson.build() - - def package(self): - lib_version = "2.6" if tools.Version(self.version) <= "2.42.1" else "5.0" - - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - meson = self._configure_meson() - meson.install() - - shutil.move( - os.path.join(self.package_folder, "lib", f"libxml++-{lib_version}", "include", "libxml++config.h"), - os.path.join(self.package_folder, "include", f"libxml++-{lib_version}", "libxml++config.h")) - - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "lib", f"libxml++-{lib_version}")) - - if is_msvc(self): - 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", f"libxml++-{lib_version}.a"), - os.path.join(self.package_folder, "lib", f"xml++-{lib_version}.lib")) - - def package_info(self): - lib_version = "2.6" if tools.Version(self.version) <= "2.42.1" else "5.0" - - self.cpp_info.set_property("cmake_module_file_name", "libxml++") - self.cpp_info.set_property("cmake_module_target_name", "libxml++::libxml++") - self.cpp_info.set_property("pkg_config_name", "libxml++") - self.cpp_info.components[f"libxml++-{lib_version}"].set_property("pkg_config_name", f"libxml++-{lib_version}") - self.cpp_info.components[f"libxml++-{lib_version}"].libs = [f"xml++-{lib_version}"] - self.cpp_info.components[f"libxml++-{lib_version}"].includedirs = [ - os.path.join("include", f"libxml++-{lib_version}") - ] - self.cpp_info.components[f"libxml++-{lib_version}"].requires = [ - "glibmm::glibmm", "libxml2::libxml2" - ] - - self.cpp_info.names["cmake_find_package"] = "libxml++" - self.cpp_info.names["cmake_find_package_multi"] = "libxml++" - self.cpp_info.names["pkg_config"] = "libxml++" - self.cpp_info.components[f"libxml++-{lib_version}"].names["pkg_config"] = f"libxml++-{lib_version}" diff --git a/recipes/libxmlpp/2.x.x/patches/2.42.1-0001-enable_static_builds_on_msvc.patch b/recipes/libxmlpp/2.x.x/patches/2.42.1-0001-enable_static_builds_on_msvc.patch deleted file mode 100644 index 32d4ca9bbdc42..0000000000000 --- a/recipes/libxmlpp/2.x.x/patches/2.42.1-0001-enable_static_builds_on_msvc.patch +++ /dev/null @@ -1,47 +0,0 @@ -diff --git a/libxml++config.h.meson b/libxml++config.h.meson -index fdae143..5d853c2 100755 ---- a/libxml++config.h.meson -+++ b/libxml++config.h.meson -@@ -21,9 +21,16 @@ - /* Micro version number of libxml++. */ - #mesondefine LIBXMLXX_MICRO_VERSION - --#if defined (GLIBMM_DLL) && !defined (LIBXMLXX_STATIC) -+/* Defined if libxml++ is built as a static library. */ -+#mesondefine LIBXMLXX_STATIC -+ -+#if !defined (LIBXMLXX_STATIC) - #ifdef LIBXMLPP_BUILD -- #define LIBXMLPP_API __declspec(dllexport) -+ #ifdef __GNUC__ -+ #define LIBXMLPP_API __attribute__((visibility("default"))) -+ #else -+ #define LIBXMLPP_API __declspec(dllexport) -+ #endif - #elif !defined (__GNUC__) - #define LIBXMLPP_API __declspec(dllimport) - #else /* don't dllimport classes/methods on GCC/MinGW */ -diff --git a/meson.build b/meson.build -index e89f2c6..20d66ed 100644 ---- a/meson.build -+++ b/meson.build -@@ -292,15 +292,13 @@ endif - # Always set for backwards compatibility. - pkg_conf_data.set('LIBXMLCPP_EXCEPTIONS_ENABLED', 1) - -+if get_option('default_library') == 'static' -+ pkg_conf_data.set('LIBXMLXX_STATIC', 1) -+endif -+ - # Static library? - 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 -- - configure_file( - input: 'libxml++-2.6.pc.in', - output: '@BASENAME@', diff --git a/recipes/libxmlpp/2.x.x/test_package/CMakeLists.txt b/recipes/libxmlpp/2.x.x/test_package/CMakeLists.txt deleted file mode 100644 index acd4c1ac2441b..0000000000000 --- a/recipes/libxmlpp/2.x.x/test_package/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(libxml++ REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} test_package.cpp) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) -if(TARGET libxml++::libxml++-2.6) - target_link_libraries(${PROJECT_NAME} libxml++::libxml++-2.6) -else() - target_link_libraries(${PROJECT_NAME} libxml++::libxml++-5.0) -endif() diff --git a/recipes/libxmlpp/2.x.x/test_package/conanfile.py b/recipes/libxmlpp/2.x.x/test_package/conanfile.py deleted file mode 100644 index 8aaecaac427e8..0000000000000 --- a/recipes/libxmlpp/2.x.x/test_package/conanfile.py +++ /dev/null @@ -1,18 +0,0 @@ -from conans import ConanFile, CMake, tools -import os - - -class TestPackageConan(ConanFile): - settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" - - def build(self): - cmake = CMake(self) - cmake.configure() - cmake.build() - - def test(self): - if not tools.cross_building(self): - bin_path = f'{os.path.join("bin", "test_package")} \ - {os.path.join(self.source_folder, "example.xml")}' - self.run(bin_path, run_environment=True) diff --git a/recipes/libxmlpp/all/conandata.yml b/recipes/libxmlpp/all/conandata.yml new file mode 100644 index 0000000000000..9676ddd7ccf09 --- /dev/null +++ b/recipes/libxmlpp/all/conandata.yml @@ -0,0 +1,29 @@ +sources: + "5.4.0": + url: "https://github.com/libxmlplusplus/libxmlplusplus/releases/download/5.4.0/libxml++-5.4.0.tar.xz" + sha256: "e9a23c436686a94698d2138e6bcbaf849121d63bfa0f50dc34fefbfd79566848" + "5.2.0": + url: "https://github.com/libxmlplusplus/libxmlplusplus/releases/download/5.2.0/libxml++-5.2.0.tar.xz" + sha256: "e41b8eae55210511585ae638615f00db7f982c0edea94699865f582daf03b44f" + "5.0.3": + url: "https://github.com/libxmlplusplus/libxmlplusplus/releases/download/5.0.3/libxml++-5.0.3.tar.xz" + sha256: "13074f59e3288a378cafe9e6847df17f764c23fa29bc94f3305b8bf81efb2cf7" + "5.0.1": + url: "https://github.com/libxmlplusplus/libxmlplusplus/releases/download/5.0.1/libxml++-5.0.1.tar.xz" + sha256: "15c38307a964fa6199f4da6683a599eb7e63cc89198545b36349b87cf9aa0098" +patches: + "5.2.0": + - patch_file: "patches/5.2.0-0001-enable_static_builds_on_msvc.patch" + patch_type: "portability" + patch_description: "Manage dllexport correctly to be able to build static libraries on MSVC" + patch_source: "https://github.com/libxmlplusplus/libxmlplusplus/commit/2a2825c67a30ea34f3514659bfd91111db8e009d.patch" + "5.0.3": + - patch_file: "patches/5.0.3-0001-enable_static_builds_on_msvc.patch" + patch_type: "portability" + patch_description: "Manage dllexport correctly to be able to build static libraries on MSVC" + patch_source: "https://github.com/libxmlplusplus/libxmlplusplus/commit/2a2825c67a30ea34f3514659bfd91111db8e009d.patch" + "5.0.1": + - patch_file: "patches/5.0.1-0001-enable_static_builds_on_msvc.patch" + patch_type: "portability" + patch_description: "Manage dllexport correctly to be able to build static libraries on MSVC" + patch_source: "https://github.com/libxmlplusplus/libxmlplusplus/commit/2a2825c67a30ea34f3514659bfd91111db8e009d.patch" diff --git a/recipes/libxmlpp/all/conanfile.py b/recipes/libxmlpp/all/conanfile.py new file mode 100644 index 0000000000000..8c526bf0e516c --- /dev/null +++ b/recipes/libxmlpp/all/conanfile.py @@ -0,0 +1,150 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.meson import Meson, MesonToolchain +from conan.tools.gnu import PkgConfigDeps +from conan.tools.scm import Version +from conan.tools.env import VirtualBuildEnv +from conan.tools.microsoft import is_msvc +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, rmdir, rename, get, rm, replace_in_file +from conan.tools.build import cross_building, check_min_cppstd +from conan.tools.layout import basic_layout +import shutil +import os + + +required_conan_version = ">=1.53.0" + + +class LibXMLPlusPlus(ConanFile): + name = "libxmlpp" + description = "libxml++ (a.k.a. libxmlplusplus) provides a C++ interface to XML files" + license = "LGPL-2.1" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/libxmlplusplus/libxmlplusplus" + topics = ("xml", "parser", "wrapper") + package_type = "library" + 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" if Version(self.version) >= "5.4.0" else "11" + + @property + def _compilers_minimum_version(self): + return { + "17": { + "gcc": "8", + "clang": "7", + "apple-clang": "12", + "Visual Studio": "16", + "msvc": "192", + }, + }.get(self._min_cppstd, {}) + + @property + def _lib_version(self): + return "5.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: + self.options.rm_safe("fPIC") + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("libxml2/[>=2.12.5 <3]") + self.requires("glibmm/2.75.0") + + def validate(self): + if hasattr(self, "settings_build") and cross_building(self): + raise ConanInvalidConfiguration("Cross-building not implemented") + 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 build_requirements(self): + self.tool_requires("meson/[>=1.2.3 <2]") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/[>=2.2 <3]") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def _patch_sources(self): + apply_conandata_patches(self) + + if is_msvc(self): + # 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 the Windows SDK isn't standard conformant! + # see: + # https://developercommunity.visualstudio.com/t/error-c2760-in-combaseapih-with-windows-sdk-81-and/185399 + replace_in_file(self, + os.path.join(self.source_folder, "meson.build"), + "cpp_std=c++", "cpp_std=vc++") + + def generate(self): + virtual_build_env = VirtualBuildEnv(self) + virtual_build_env.generate() + tc = MesonToolchain(self) + tc.project_options["build-examples"] = "false" + tc.project_options["build-tests"] = "false" + tc.project_options["build-documentation"] = "false" + tc.project_options["msvc14x-parallel-installable"] = "false" + tc.project_options["default_library"] = "shared" if self.options.shared else "static" + tc.generate() + td = PkgConfigDeps(self) + td.generate() + + def build(self): + self._patch_sources() + meson = Meson(self) + meson.configure() + meson.build() + + def package(self): + copy(self, "COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + meson = Meson(self) + meson.install() + + shutil.move( + os.path.join(self.package_folder, "lib", f"libxml++-{self._lib_version}", "include", "libxml++config.h"), + os.path.join(self.package_folder, "include", f"libxml++-{self._lib_version}", "libxml++config.h")) + + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", f"libxml++-{self._lib_version}")) + fix_apple_shared_install_name(self) + + if is_msvc(self): + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + if not self.options.shared: + rename( + self, + os.path.join(self.package_folder, "lib", f"libxml++-{self._lib_version}.a"), + os.path.join(self.package_folder, "lib", f"xml++-{self._lib_version}.lib")) + + def package_info(self): + self.cpp_info.set_property("pkg_config_name", f"libxml++-{self._lib_version}") + self.cpp_info.libs = [f"xml++-{self._lib_version}"] + self.cpp_info.includedirs = [os.path.join("include", f"libxml++-{self._lib_version}")] diff --git a/recipes/libxmlpp/2.x.x/patches/5.0.1-0001-enable_static_builds_on_msvc.patch b/recipes/libxmlpp/all/patches/5.0.1-0001-enable_static_builds_on_msvc.patch similarity index 100% rename from recipes/libxmlpp/2.x.x/patches/5.0.1-0001-enable_static_builds_on_msvc.patch rename to recipes/libxmlpp/all/patches/5.0.1-0001-enable_static_builds_on_msvc.patch diff --git a/recipes/libxmlpp/all/patches/5.0.3-0001-enable_static_builds_on_msvc.patch b/recipes/libxmlpp/all/patches/5.0.3-0001-enable_static_builds_on_msvc.patch new file mode 100644 index 0000000000000..1359f7eb0c90c --- /dev/null +++ b/recipes/libxmlpp/all/patches/5.0.3-0001-enable_static_builds_on_msvc.patch @@ -0,0 +1,17 @@ +diff --git a/meson.build b/meson.build +index 935aece..5e7180e 100644 +--- a/meson.build ++++ b/meson.build +@@ -371,12 +371,6 @@ library_build_type = get_option('default_library') + pkg_conf_data.set('LIBXMLXX_STATIC', library_build_type == 'static') + + +-if cpp_compiler.get_argument_syntax() == 'msvc' +- if library_build_type == 'both' +- error('Dynamic+Static builds are not supported by MSVC-style builds') +- endif +-endif +- + configure_file( + input: 'libxml++.pc.in', + output: xmlxx_pcname + '.pc', diff --git a/recipes/libxmlpp/all/patches/5.2.0-0001-enable_static_builds_on_msvc.patch b/recipes/libxmlpp/all/patches/5.2.0-0001-enable_static_builds_on_msvc.patch new file mode 100644 index 0000000000000..f95ca04ba12f6 --- /dev/null +++ b/recipes/libxmlpp/all/patches/5.2.0-0001-enable_static_builds_on_msvc.patch @@ -0,0 +1,21 @@ +diff --git a/meson.build b/meson.build +index e4b27ed..1e7288c 100644 +--- a/meson.build ++++ b/meson.build +@@ -356,11 +356,11 @@ library_build_type = get_option('default_library') + pkg_conf_data.set('LIBXMLXX_STATIC', library_build_type == 'static') + + +-if cpp_compiler.get_argument_syntax() == 'msvc' +- if library_build_type == 'both' +- error('Dynamic+Static builds are not supported by MSVC-style builds') +- endif +-endif ++#if cpp_compiler.get_argument_syntax() == 'msvc' ++# if library_build_type == 'both' ++# error('Dynamic+Static builds are not supported by MSVC-style builds') ++# endif ++#endif + + configure_file( + input: 'libxml++.pc.in', diff --git a/recipes/libxmlpp/all/test_package/CMakeLists.txt b/recipes/libxmlpp/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..0e449196b865f --- /dev/null +++ b/recipes/libxmlpp/all/test_package/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(libxmlpp REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE libxmlpp::libxmlpp) +if(libxmlpp_VERSION VERSION_GREATER_EQUAL "5.4.0") + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +else() + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +endif() diff --git a/recipes/libxmlpp/all/test_package/conanfile.py b/recipes/libxmlpp/all/test_package/conanfile.py new file mode 100644 index 0000000000000..5110568f15e67 --- /dev/null +++ b/recipes/libxmlpp/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.bindir, "test_package") + xml_path = os.path.join(self.source_folder, "example.xml") + self.run(f"{bin_path} {xml_path}", env="conanrun") diff --git a/recipes/libxmlpp/2.x.x/test_package/example.xml b/recipes/libxmlpp/all/test_package/example.xml similarity index 100% rename from recipes/libxmlpp/2.x.x/test_package/example.xml rename to recipes/libxmlpp/all/test_package/example.xml diff --git a/recipes/libxmlpp/2.x.x/test_package/test_package.cpp b/recipes/libxmlpp/all/test_package/test_package.cpp similarity index 100% rename from recipes/libxmlpp/2.x.x/test_package/test_package.cpp rename to recipes/libxmlpp/all/test_package/test_package.cpp diff --git a/recipes/libxmlpp/config.yml b/recipes/libxmlpp/config.yml index 4976ee096e564..f9ffdcfd89507 100644 --- a/recipes/libxmlpp/config.yml +++ b/recipes/libxmlpp/config.yml @@ -1,5 +1,9 @@ versions: + "5.4.0": + folder: all + "5.2.0": + folder: all + "5.0.3": + folder: all "5.0.1": - folder: "2.x.x" - "2.42.1": - folder: "2.x.x" + folder: all diff --git a/recipes/libxpm/all/CMakeLists.txt b/recipes/libxpm/all/CMakeLists.txt index 77475adeda3d9..94c9cd557b1f0 100644 --- a/recipes/libxpm/all/CMakeLists.txt +++ b/recipes/libxpm/all/CMakeLists.txt @@ -1,10 +1,7 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(libXpm VERSION "${CONAN_libXpm_VERSION}" LANGUAGES C) -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup(TARGETS) - # ---- X11 dependency ---- if(NOT WIN32) @@ -19,8 +16,7 @@ endif() # ---- Library ---- -add_library( - Xpm +add_library(Xpm src/Attrib.c src/CrBufFrI.c src/CrDatFrI.c @@ -44,15 +40,15 @@ add_library( src/WrFFrI.c ) -if(WIN32) - target_sources(Xpm PRIVATE windows/libXpm.def) - target_compile_definitions(Xpm PRIVATE FOR_MSW) -else() - target_sources( - Xpm PRIVATE +if(UNIX) + # Pixmap-related functions require X11 and are not available on Windows + target_sources(Xpm PRIVATE src/CrBufFrP.c src/CrDatFrP.c src/CrIFrP.c + src/CrPFrBuf.c + src/CrPFrDat.c + src/CrPFrI.c src/RdFToP.c src/WrFFrP.c ) @@ -60,6 +56,11 @@ else() target_link_libraries(Xpm PRIVATE "${X11_LIBRARY}") endif() +if(WIN32) + set_target_properties(Xpm PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE) + target_compile_definitions(Xpm PRIVATE FOR_MSW) +endif() + if(MSVC) target_compile_definitions( Xpm PRIVATE @@ -71,6 +72,14 @@ endif() target_include_directories(Xpm PRIVATE include/X11) +if(NOT WIN32) + target_compile_definitions(Xpm PRIVATE + # Build without the --enable-open-zfile option: + # https://gitlab.freedesktop.org/xorg/lib/libxpm/-/blob/libXpm-3.5.17/configure.ac?ref_type=tags#L67-88 + NO_ZPIPE + ) +endif() + set_target_properties( Xpm PROPERTIES VERSION "${PROJECT_VERSION}" diff --git a/recipes/libxpm/all/conandata.yml b/recipes/libxpm/all/conandata.yml index 3db82178c2eeb..0c9046c699ed9 100644 --- a/recipes/libxpm/all/conandata.yml +++ b/recipes/libxpm/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.5.17": + url: "https://gitlab.freedesktop.org/xorg/lib/libxpm/-/archive/libXpm-3.5.17/libxpm-libXpm-3.5.17.tar.gz" + sha256: "c63123e2de511edac5df33425a3a3b292e06973198c94470c454a9c973f211f6" "3.5.13": + url: "https://gitlab.freedesktop.org/xorg/lib/libxpm/-/archive/libXpm-3.5.13/libxpm-libXpm-3.5.13.tar.gz" sha256: "516fcb7a3cc5b491ca2b95df29018b1643c40649d72473d3c62379d8fdc472ff" - url: https://gitlab.freedesktop.org/xorg/lib/libxpm/-/archive/libXpm-3.5.13/libxpm-libXpm-3.5.13.tar.gz diff --git a/recipes/libxpm/all/conanfile.py b/recipes/libxpm/all/conanfile.py index 63d51162a71f7..19a22b67425e0 100644 --- a/recipes/libxpm/all/conanfile.py +++ b/recipes/libxpm/all/conanfile.py @@ -1,19 +1,22 @@ -import functools import os -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 copy, get -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class LibXpmConan(ConanFile): name = "libxpm" description = "X Pixmap (XPM) image file format library" + license = "MIT-open-group" url = "https://github.com/conan-io/conan-center-index" homepage = "https://gitlab.freedesktop.org/xorg/lib/libxpm" - topics = "xpm" - license = "MIT-open-group" + topics = ("xpm",) + + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -23,18 +26,9 @@ class LibXpmConan(ConanFile): "shared": False, "fPIC": True, } - generators = "cmake" - exports_sources = "CMakeLists.txt", "windows/*" - no_copy_source = True - - def validate(self): - if self.settings.os not in ("Windows", "Linux", "FreeBSD"): - raise ConanInvalidConfiguration( - "libXpm is supported only on Windows, Linux and FreeBSD" - ) - def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True) + 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": @@ -42,28 +36,43 @@ 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.settings.os != "Windows": self.requires("xorg/system") - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["CONAN_libXpm_VERSION"] = self.version - cmake.configure() - return cmake + def validate(self): + if self.settings.os not in ("Windows", "Linux", "FreeBSD"): + raise ConanInvalidConfiguration("libXpm is supported only on Windows, Linux and FreeBSD") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["CONAN_libXpm_VERSION"] = self.version + tc.generate() def build(self): - self._configure_cmake().build() + cmake = CMake(self) + cmake.configure() + cmake.build() def package(self): - self.copy("COPYING", "licenses") - self.copy("COPYRIGHT", "licenses") - self._configure_cmake().install() + copy(self, "COPYING", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder) + copy(self, "COPYRIGHT", + 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 = ["Xpm"] diff --git a/recipes/libxpm/all/test_package/CMakeLists.txt b/recipes/libxpm/all/test_package/CMakeLists.txt index 0ea6d5bc37b28..1f28dfc6ff753 100644 --- a/recipes/libxpm/all/test_package/CMakeLists.txt +++ b/recipes/libxpm/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(libxpm REQUIRED CONFIG) add_executable(test_package test_package.c) diff --git a/recipes/libxpm/all/test_package/conanfile.py b/recipes/libxpm/all/test_package/conanfile.py index a8c92dea63335..ef5d7042163ec 100644 --- a/recipes/libxpm/all/test_package/conanfile.py +++ b/recipes/libxpm/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 = "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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libxpm/all/test_package/test_package.c b/recipes/libxpm/all/test_package/test_package.c index ed1efad8c383c..925df166533ce 100644 --- a/recipes/libxpm/all/test_package/test_package.c +++ b/recipes/libxpm/all/test_package/test_package.c @@ -1,12 +1,8 @@ #include #include -int main(int argc, char const* argv[]) +int main() { - (void)argc; - (void)argv; - XpmFree(NULL); - return 0; } diff --git a/recipes/libxpm/all/test_v1_package/CMakeLists.txt b/recipes/libxpm/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/libxpm/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/libxpm/all/test_v1_package/conanfile.py b/recipes/libxpm/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..a8c92dea63335 --- /dev/null +++ b/recipes/libxpm/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +import os + +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.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libxpm/all/windows/libXpm.def b/recipes/libxpm/all/windows/libXpm.def deleted file mode 100644 index 5381386ee75ee..0000000000000 --- a/recipes/libxpm/all/windows/libXpm.def +++ /dev/null @@ -1,29 +0,0 @@ -EXPORTS - -XpmCreateImageFromData -XpmCreateDataFromImage -XpmReadFileToImage -XpmWriteFileFromImage -XpmCreateImageFromBuffer -XpmReadFileToBuffer -XpmWriteFileFromBuffer -XpmReadFileToData -XpmWriteFileFromData -XpmAttributesSize -XpmFreeAttributes -XpmFreeExtensions -XpmFreeXpmImage -XpmFreeXpmInfo -XpmGetErrorString -XpmLibraryVersion - -XpmReadFileToXpmImage -XpmWriteFileFromXpmImage -XpmCreateImageFromXpmImage -XpmCreateXpmImageFromImage -XpmCreateDataFromXpmImage -XpmCreateXpmImageFromData -XpmCreateXpmImageFromBuffer -XpmCreateBufferFromXpmImage - -XpmFree diff --git a/recipes/libxpm/config.yml b/recipes/libxpm/config.yml index 96f25a4bd1d23..9876f21755330 100644 --- a/recipes/libxpm/config.yml +++ b/recipes/libxpm/config.yml @@ -1,3 +1,5 @@ versions: + "3.5.17": + folder: all "3.5.13": folder: all diff --git a/recipes/libxshmfence/all/conandata.yml b/recipes/libxshmfence/all/conandata.yml index 8c16f251fa486..21938ecba1296 100644 --- a/recipes/libxshmfence/all/conandata.yml +++ b/recipes/libxshmfence/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.3.2": + url: "https://www.x.org/archive/individual/lib/libxshmfence-1.3.2.tar.gz" + sha256: "e93a85099604beb244ee756dcaf70e18b08701c1ca84c4de0126cd71bd6c8181" "1.3": - url: "https://www.x.org/archive//individual/lib/libxshmfence-1.3.tar.gz" + url: "https://www.x.org/archive/individual/lib/libxshmfence-1.3.tar.gz" sha256: "7eb3d46ad91bab444f121d475b11b39273142d090f7e9ac43e6a87f4ff5f902c" diff --git a/recipes/libxshmfence/all/conanfile.py b/recipes/libxshmfence/all/conanfile.py index a4136cd3cae48..486b79c2c29b4 100644 --- a/recipes/libxshmfence/all/conanfile.py +++ b/recipes/libxshmfence/all/conanfile.py @@ -1,18 +1,28 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment -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.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, copy, export_conandata_patches, 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 + +required_conan_version = ">=1.53.0" + class LibxshmfenceConan(ConanFile): name = "libxshmfence" + description = "Shared memory 'SyncFence' synchronization primitive" license = "X11" - homepage = "https://gitlab.freedesktop.org/xorg/lib/libxshmfence" url = "https://github.com/conan-io/conan-center-index" - description = "Shared memory 'SyncFence' synchronization primitive" + homepage = "https://gitlab.freedesktop.org/xorg/lib/libxshmfence" topics = ("shared", "memory", "syncfence", "synchronization", "interprocess") - settings = "os", "compiler", "build_type", "arch" + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -22,89 +32,80 @@ class LibxshmfenceConan(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) - @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): 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 layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("xorg-proto/2022.2", transitive_headers=True) + 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") - 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.tool_requires("automake/1.16.5") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/2.0.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) - - @contextlib.contextmanager - def _build_context(self): - if self.settings.compiler == "Visual Studio": - with tools.vcvars(self): - 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 = [] - 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)), - ] - self._autotools.configure(args=configure_args, configure_dir=self._source_subfolder) - return self._autotools + 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 = AutotoolsToolchain(self) + tc.generate() + tc = PkgConfigDeps(self) + tc.generate() + + if is_msvc(self): + env = Environment() + automake_conf = self.dependencies.build["automake"].conf_info + compile_wrapper = unix_path(self, automake_conf.get("user.automake:compile-wrapper", check_type=str)) + env.define("CC", f"{compile_wrapper} cl -nologo") + env.vars(self).save_script("conanbuild_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() - 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, "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) + autotools.install() + 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.libs = ["xshmfence"] - self.cpp_info.names["pkg_config"] = "xshmfence" + self.cpp_info.set_property("pkg_config_name", "xshmfence") diff --git a/recipes/libxshmfence/all/test_package/CMakeLists.txt b/recipes/libxshmfence/all/test_package/CMakeLists.txt index b08d77d4e4328..c48db83ea9231 100644 --- a/recipes/libxshmfence/all/test_package/CMakeLists.txt +++ b/recipes/libxshmfence/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ -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(libxshmfence REQUIRED) +find_package(libxshmfence REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) target_link_libraries(${PROJECT_NAME} libxshmfence::libxshmfence) diff --git a/recipes/libxshmfence/all/test_package/conanfile.py b/recipes/libxshmfence/all/test_package/conanfile.py index 19e6a0c06e3d8..ef5d7042163ec 100644 --- a/recipes/libxshmfence/all/test_package/conanfile.py +++ b/recipes/libxshmfence/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libxshmfence/all/test_package/test_package.c b/recipes/libxshmfence/all/test_package/test_package.c index 2dc0779250663..6b5dd2b42332c 100644 --- a/recipes/libxshmfence/all/test_package/test_package.c +++ b/recipes/libxshmfence/all/test_package/test_package.c @@ -1,15 +1,14 @@ #include "X11/xshmfence.h" int main() { - int fd; - struct xshmfence *x; + int fd; + struct xshmfence *x; fd = xshmfence_alloc_shm(); if (fd < 0) { return 1; } - x = xshmfence_map_shm(fd); if (!x) { return 1; diff --git a/recipes/libxshmfence/all/test_v1_package/CMakeLists.txt b/recipes/libxshmfence/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/libxshmfence/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/libxshmfence/all/test_v1_package/conanfile.py b/recipes/libxshmfence/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libxshmfence/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/libxshmfence/config.yml b/recipes/libxshmfence/config.yml index d2eb4ed4a511f..5fbc1fce7e8d6 100644 --- a/recipes/libxshmfence/config.yml +++ b/recipes/libxshmfence/config.yml @@ -1,3 +1,5 @@ versions: + "1.3.2": + folder: all "1.3": folder: all diff --git a/recipes/libxslt/all/conandata.yml b/recipes/libxslt/all/conandata.yml index e1f22d6ae5d44..d43b2343523d6 100644 --- a/recipes/libxslt/all/conandata.yml +++ b/recipes/libxslt/all/conandata.yml @@ -1,10 +1,17 @@ sources: + "1.1.42": + sha256: "85ca62cac0d41fc77d3f6033da9df6fd73d20ea2fc18b0a3609ffb4110e1baeb" + url: "https://download.gnome.org/sources/libxslt/1.1/libxslt-1.1.42.tar.xz" + "1.1.39": + sha256: "2a20ad621148339b0759c4d4e96719362dee64c9a096dbba625ba053846349f0" + url: "https://download.gnome.org/sources/libxslt/1.1/libxslt-1.1.39.tar.xz" + "1.1.37": + sha256: "3a4b27dc8027ccd6146725950336f1ec520928f320f144eb5fa7990ae6123ab4" + url: "https://download.gnome.org/sources/libxslt/1.1/libxslt-1.1.37.tar.xz" "1.1.34": sha256: "28c47db33ab4daefa6232f31ccb3c65260c825151ec86ec461355247f3f56824" url: "https://download.gnome.org/sources/libxslt/1.1/libxslt-1.1.34.tar.xz" patches: "1.1.34": - patch_file: "patches/0001-allow-xsltproc-link-shared-mt.patch" - base_path: "source_subfolder" - patch_file: "patches/0002-Add-configuration-for-profiler.patch" - base_path: "source_subfolder" diff --git a/recipes/libxslt/all/conanfile.py b/recipes/libxslt/all/conanfile.py index 5dce7dca31dee..5e1f29e0b7b60 100644 --- a/recipes/libxslt/all/conanfile.py +++ b/recipes/libxslt/all/conanfile.py @@ -1,20 +1,26 @@ -from conan.tools.microsoft import is_msvc, msvc_runtime_flag -from conans import ConanFile, tools, AutoToolsBuildEnvironment, VisualStudioBuildEnvironment -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.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, 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, msvc_runtime_flag, unix_path, NMakeDeps, NMakeToolchain +from conan.tools.scm import Version import os -required_conan_version = ">=1.45.0" +required_conan_version = ">=1.55.0" class LibxsltConan(ConanFile): name = "libxslt" url = "https://github.com/conan-io/conan-center-index" description = "libxslt is a software library implementing XSLT processor, based on libxml2" - topics = ("XSLT", "processor") + topics = ("xslt", "processor") homepage = "https://xmlsoft.org" license = "MIT" - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -33,21 +39,12 @@ class LibxsltConan(ConanFile): "plugins": False, } - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _settings_build(self): return getattr(self, "settings_build", self.settings) - @property - def _option_names(self): - return [name for name in self.default_options.keys() if name not in ["shared", "fPIC"]] - 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": @@ -55,145 +52,156 @@ 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.14") + if Version(self.version) >= "1.1.42": + self.requires("libxml2/[>=2.12.5 <3]", transitive_headers=True, transitive_libs=True) + elif Version(self.version) >= "1.1.39": + # see https://github.com/conan-io/conan-center-index/pull/16205#discussion_r1149570846 + # Older versions use deprecated functions that were removed in libxml2 2.13 + self.requires("libxml2/[>=2.12.5 <2.13]", transitive_headers=True, transitive_libs=True) + else: + self.requires("libxml2/2.11.6", transitive_headers=True, transitive_libs=True) def validate(self): if self.options.plugins and not self.options.shared: raise ConanInvalidConfiguration("plugins require shared") 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") + 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): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + def generate(self): if is_msvc(self): - self._build_msvc() + tc = NMakeToolchain(self) + tc.generate() + deps = NMakeDeps(self) + deps.generate() else: - # Relocatable shared libs 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() + 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([ + "--with-python=no", + f"--with-libxml-src={unix_path(self, self.dependencies['libxml2'].package_folder)}", + f"--with-debugger={yes_no(self.options.debugger)}", + f"--with-crypto={yes_no(self.options.crypto)}", + f"--with-profiler={yes_no(self.options.profiler)}", + f"--with-plugins={yes_no(self.options.plugins)}", + ]) + tc.generate() + + deps = AutotoolsDeps(self) + deps.generate() def _build_msvc(self): - with tools.chdir(os.path.join(self._source_subfolder, "win32")): - debug = "yes" if self.settings.build_type == "Debug" else "no" - static = "no" if self.options.shared else "yes" - - with tools.vcvars(self): - args = [ - "cscript", - "configure.js", - "compiler=msvc", - "prefix={}".format(self.package_folder), - "cruntime=/{}".format(msvc_runtime_flag(self)), - "debug={}".format(debug), - "static={}".format(static), - "include=\"{}\"".format(";".join(self.deps_cpp_info.include_paths)), - "lib=\"{}\"".format(";".join(self.deps_cpp_info.lib_paths)), - "iconv=no", - "xslt_debug=no", - ] - for name in self._option_names: - cname = {"plugins": "modules"}.get(name, name) - value = getattr(self.options, name) - value = "yes" if value else "no" - args.append("%s=%s" % (cname, value)) - configure_command = ' '.join(args) - self.output.info(configure_command) - self.run(configure_command) - - # Fix library names because they can be not just zlib.lib - 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) - return ' '.join(libs) - - def fix_library(option, package, old_libname): - if option: - tools.replace_in_file("Makefile.msvc", - "LIBS = %s" % old_libname, - "LIBS = %s" % format_libs(package)) - - if "icu" in self.deps_cpp_info.deps: - fix_library(True, 'icu', 'wsock32.lib') - - tools.replace_in_file("Makefile.msvc", "libxml2.lib", format_libs("libxml2")) - tools.replace_in_file("Makefile.msvc", "libxml2_a.lib", format_libs("libxml2")) - - # Avoid to indirectly build both static & shared when we build utils - tools.replace_in_file( - "Makefile.msvc", - "$(UTILS) : $(UTILS_INTDIR) $(BINDIR) libxslt libxslta libexslt libexslta", - "$(UTILS) : $(UTILS_INTDIR) $(BINDIR) libxslt{0} libexslt{0}".format("" if self.options.shared else "a"), - ) - - with tools.environment_append(VisualStudioBuildEnvironment(self).vars): - targets = "libxslt{0} libexslt{0} utils".format("" if self.options.shared else "a") - self.run("nmake /f Makefile.msvc {}".format(targets)) - - @functools.lru_cache(1) - def _configure_autotools(self): - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) + # 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) + 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-python=no", - "--with-libxml-src={}".format(tools.unix_path(self.deps_cpp_info["libxml2"].rootpath)), + "compiler=msvc", + 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)), + "iconv=no", + "xslt_debug=no", + f"debugger={yes_no(self.options.debugger)}", + f"crypto={yes_no(self.options.crypto)}", + f"profiler={yes_no(self.options.profiler)}", + f"modules={yes_no(self.options.plugins)}", ] - for name in self._option_names: - value = getattr(self.options, name) - args.append("--with-{}={}".format(name, yes_no(value))) - autotools.configure(args=args, configure_dir=self._source_subfolder) - return autotools + + with chdir(self, os.path.join(self.source_folder, "win32")): + self.run(f"cscript configure.js {' '.join(args)}") + + # Fix library names in generated Makefile.msvc + def format_libs(package): + libs = [] + dep_cpp_info = self.dependencies[package].cpp_info.aggregated_components() + for lib in dep_cpp_info.libs + dep_cpp_info.system_libs: + libname = lib + if not libname.endswith(".lib"): + libname += ".lib" + libs.append(libname) + return " ".join(libs) + + 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.dependencies["libxml2"].options.get_safe("icu"): + replace_in_file(self, makefile_msvc, "LIBS = wsock32.lib", f"LIBS = {format_libs('icu')}") + + # Avoid to indirectly build both static & shared when we build utils + lib_suffix = "" if self.options.shared else "a" + replace_in_file( + self, makefile_msvc, + "$(UTILS) : $(UTILS_INTDIR) $(BINDIR) libxslt libxslta libexslt libexslta", + f"$(UTILS) : $(UTILS_INTDIR) $(BINDIR) libxslt{lib_suffix} libexslt{lib_suffix}", + ) + + # Build with NMake + with chdir(self, os.path.join(self.source_folder, "win32")): + targets = f"libxslt{lib_suffix} libexslt{lib_suffix} utils" + self.run(f"nmake -f Makefile.msvc {targets}") + + def build(self): + apply_conandata_patches(self) + if is_msvc(self): + self._build_msvc() + else: + autotools = Autotools(self) + 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.copy("*.h", src=os.path.join(self._source_subfolder, "libxslt"), - dst=os.path.join("include", "libxslt")) - self.copy("*.h", src=os.path.join(self._source_subfolder, "libexslt"), - dst=os.path.join("include", "libexslt")) - build_dir = os.path.join(self._source_subfolder, "win32", "bin.msvc") - self.copy("*.exe", src=build_dir, dst="bin") + copy(self, "*.h", src=os.path.join(self.source_folder, "libxslt"), + dst=os.path.join(self.package_folder, "include", "libxslt")) + copy(self, "*.h", src=os.path.join(self.source_folder, "libexslt"), + dst=os.path.join(self.package_folder, "include", "libexslt")) + build_dir = os.path.join(self.source_folder, "win32", "bin.msvc") + copy(self, "*.exe", src=build_dir, dst=os.path.join(self.package_folder, "bin"), keep_path=False) if self.options.shared: - self.copy("*xslt.lib", src=build_dir, dst="lib") - self.copy("*xslt.dll", src=build_dir, dst="bin") + copy(self, "*xslt.lib", src=build_dir, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, "*xslt.dll", src=build_dir, dst=os.path.join(self.package_folder, "bin"), keep_path=False) else: - self.copy("*xslt_a.lib", src=build_dir, dst="lib") + copy(self, "*xslt_a.lib", src=build_dir, dst=os.path.join(self.package_folder, "lib"), keep_path=False) else: - autotools = self._configure_autotools() + autotools = Autotools(self) autotools.install() os.remove(os.path.join(self.package_folder, "bin", "xslt-config")) - 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, "lib"), "*.sh") - 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")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + rm(self, "*.sh", 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.set_property("cmake_find_mode", "both") @@ -206,7 +214,7 @@ def package_info(self): # xslt self.cpp_info.components["xslt"].set_property("cmake_target_name", "LibXslt::LibXslt") self.cpp_info.components["xslt"].set_property("pkg_config_name", "libxslt") - self.cpp_info.components["xslt"].libs = ["{}xslt{}".format(prefix, suffix)] + self.cpp_info.components["xslt"].libs = [f"{prefix}xslt{suffix}"] if not self.options.shared: self.cpp_info.components["xslt"].defines = ["LIBXSLT_STATIC"] if self.settings.os in ["Linux", "FreeBSD", "Android"]: @@ -218,12 +226,10 @@ def package_info(self): # exslt self.cpp_info.components["exslt"].set_property("cmake_target_name", "LibXslt::LibExslt") self.cpp_info.components["exslt"].set_property("pkg_config_name", "libexslt") - self.cpp_info.components["exslt"].libs = ["{}exslt{}".format(prefix, suffix)] + self.cpp_info.components["exslt"].libs = [f"{prefix}exslt{suffix}"] self.cpp_info.components["exslt"].requires = ["xslt"] - - 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 not self.options.shared: + self.cpp_info.components["exslt"].defines = ["LIBEXSLT_STATIC"] # TODO: to remove in conan v2 once cmake_find_package* & pkg_config generators removed self.cpp_info.names["cmake_find_package"] = "LibXslt" @@ -235,3 +241,4 @@ def package_info(self): self.cpp_info.components["exslt"].names["cmake_find_package"] = "LibExslt" self.cpp_info.components["exslt"].names["cmake_find_package_multi"] = "LibExslt" self.cpp_info.components["exslt"].names["pkg_config"] = "libexslt" + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/libxslt/all/test_package/CMakeLists.txt b/recipes/libxslt/all/test_package/CMakeLists.txt index fac7ef3b53790..8ca93bd0e8116 100644 --- a/recipes/libxslt/all/test_package/CMakeLists.txt +++ b/recipes/libxslt/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(LibXslt REQUIRED) +find_package(LibXml2 REQUIRED) add_executable(${PROJECT_NAME} libxslt_tutorial.c) -target_link_libraries(${PROJECT_NAME} LibXslt::LibXslt) +target_link_libraries(${PROJECT_NAME} PRIVATE LibXslt::LibXslt LibXml2::LibXml2) diff --git a/recipes/libxslt/all/test_package/conanfile.py b/recipes/libxslt/all/test_package/conanfile.py index d46fa057e427f..749c8c5fab90e 100644 --- a/recipes/libxslt/all/test_package/conanfile.py +++ b/recipes/libxslt/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, run=can_run(self)) def build(self): cmake = CMake(self) @@ -12,10 +21,9 @@ def build(self): 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, "example.xml") + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") xsl_path = os.path.join(self.source_folder, "example.xsl") - cmd = "%s %s %s" % (bin_path, xsl_path, xml_path) - self.run(cmd, run_environment=True) - self.run("xsltproc -V", run_environment=True) + xml_path = os.path.join(self.source_folder, "example.xml") + self.run(f"{bin_path} {xsl_path} {xml_path}", env="conanrun") + self.run("xsltproc -V", env="conanrun") diff --git a/recipes/libxslt/all/test_package/libxslt_tutorial.c b/recipes/libxslt/all/test_package/libxslt_tutorial.c index 6b5d5c8748554..c107811f3048c 100644 --- a/recipes/libxslt/all/test_package/libxslt_tutorial.c +++ b/recipes/libxslt/all/test_package/libxslt_tutorial.c @@ -9,13 +9,7 @@ */ #include -#include -#include -#include -#include -#include -#include -#include +#include #include #include #include @@ -33,52 +27,51 @@ static void usage(const char *name) { int main(int argc, char **argv) { - int i; - const char *params[16 + 1]; - int nbparams = 0; - xsltStylesheetPtr cur = NULL; - xmlDocPtr doc, res; + int i; + const char *params[16 + 1]; + int nbparams = 0; + xsltStylesheetPtr cur = NULL; + xmlDocPtr doc, res; - if (argc <= 1) { - usage(argv[0]); - return(1); - } - + if (argc <= 1) { + usage(argv[0]); + return(1); + } - for (i = 1; i < argc; i++) { + for (i = 1; i < argc; i++) { if (argv[i][0] != '-') break; - if ((!strcmp(argv[i], "-param")) || - (!strcmp(argv[i], "--param"))) { - i++; - params[nbparams++] = argv[i++]; - params[nbparams++] = argv[i]; - if (nbparams >= 16) { - fprintf(stderr, "too many params\n"); - return (1); - } - } else { + if ((!strcmp(argv[i], "-param")) || + (!strcmp(argv[i], "--param"))) { + i++; + params[nbparams++] = argv[i++]; + params[nbparams++] = argv[i]; + if (nbparams >= 16) { + fprintf(stderr, "too many params\n"); + return (1); + } + } else { fprintf(stderr, "Unknown option %s\n", argv[i]); usage(argv[0]); return (1); } } - params[nbparams] = NULL; - xmlSubstituteEntitiesDefault(1); - xmlLoadExtDtdDefaultValue = 1; - cur = xsltParseStylesheetFile((const xmlChar *)argv[i]); - i++; - doc = xmlParseFile(argv[i]); - res = xsltApplyStylesheet(cur, doc, params); - xsltSaveResultToFile(stdout, res, cur); + params[nbparams] = NULL; + xmlSubstituteEntitiesDefault(1); + xmlLoadExtDtdDefaultValue = 1; + cur = xsltParseStylesheetFile((const xmlChar *)argv[i]); + i++; + doc = xmlParseFile(argv[i]); + res = xsltApplyStylesheet(cur, doc, params); + xsltSaveResultToFile(stdout, res, cur); - xsltFreeStylesheet(cur); - xmlFreeDoc(res); - xmlFreeDoc(doc); + xsltFreeStylesheet(cur); + xmlFreeDoc(res); + xmlFreeDoc(doc); - xsltCleanupGlobals(); - xmlCleanupParser(); - return(0); + xsltCleanupGlobals(); + xmlCleanupParser(); + return(0); } diff --git a/recipes/libxslt/all/test_v1_package/CMakeLists.txt b/recipes/libxslt/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libxslt/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libxslt/all/test_v1_package/conanfile.py b/recipes/libxslt/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..1529b5e368db7 --- /dev/null +++ b/recipes/libxslt/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" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + xsl_path = os.path.join(self.source_folder, os.pardir, "test_package", "example.xsl") + xml_path = os.path.join(self.source_folder, os.pardir, "test_package", "example.xml") + self.run(f"{bin_path} {xsl_path} {xml_path}", run_environment=True) + self.run("xsltproc -V", run_environment=True) diff --git a/recipes/libxslt/config.yml b/recipes/libxslt/config.yml index 9aafb604e965b..8628ebacf1c45 100644 --- a/recipes/libxslt/config.yml +++ b/recipes/libxslt/config.yml @@ -1,3 +1,9 @@ versions: + "1.1.42": + folder: all + "1.1.39": + folder: all + "1.1.37": + folder: all "1.1.34": folder: all 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/libyang/all/conandata.yml b/recipes/libyang/all/conandata.yml new file mode 100644 index 0000000000000..f8459393ddff0 --- /dev/null +++ b/recipes/libyang/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "2.1.148": + url: "https://github.com/CESNET/libyang/archive/refs/tags/v2.1.148.tar.gz" + sha256: "77a0aaaeb3df720aeb70d6896e32e2c2be099d48df73e3cfb52567051af3e44b" diff --git a/recipes/libyang/all/conanfile.py b/recipes/libyang/all/conanfile.py new file mode 100644 index 0000000000000..2567464f94618 --- /dev/null +++ b/recipes/libyang/all/conanfile.py @@ -0,0 +1,82 @@ +import os + +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout, CMakeDeps +from conan.tools.files import get, rmdir, copy +from conan.errors import ConanInvalidConfiguration + +required_conan_version = ">=1.53.0" + + +class LibYangConan(ConanFile): + name = "libyang" + license = "BSD-3-Clause" + url = "https://github.com/conan-io/conan-center-index" + description = "YANG data modeling language library" + homepage = "https://github.com/CESNET/libyang" + topics = ("yang", "bsd", "netconf", "restconf", "yin") + settings = "os", "compiler", "build_type", "arch" + options = {"shared": [True, False], + "fPIC": [True, False]} + default_options = { + "shared": False, + "fPIC": True + } + + + def validate(self): + # TODO For Windows support: https://github.com/CESNET/libyang?tab=readme-ov-file#windows-build-requirements + # CMake Error at CMakeLists.txt:386 (find_package): + # By not providing "Findpthreads.cmake" in CMAKE_MODULE_PATH this project has + if self.settings.os == "Windows": + raise ConanInvalidConfiguration( + f"{self.ref} Conan recipe is not prepared to work on Windows. Contributions are welcome.") + + def requirements(self): + self.requires("pcre2/10.42", transitive_headers=True) + + 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["ENABLE_TESTS"] = False + tc.variables["ENABLE_VALGRIND_TESTS"] = False + tc.variables["ENABLE_STATIC"] = not self.options.shared + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() + tc = CMakeDeps(self) + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE", self.source_folder, + os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + # move *.yang files from /share to /res + copy(self, "*.yang", os.path.join(self.package_folder, "share"), + os.path.join(self.package_folder, "res", "share")) + rmdir(self, os.path.join(self.package_folder, "share")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "LibYANG") + self.cpp_info.libs = ["yang"] + self.cpp_info.resdirs = ["res"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["pthread", "dl", "m"]) diff --git a/recipes/libyang/all/test_package/CMakeLists.txt b/recipes/libyang/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..2a5a447e67b6b --- /dev/null +++ b/recipes/libyang/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package C) + +find_package(LibYANG REQUIRED) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE libyang::libyang) diff --git a/recipes/libyang/all/test_package/conanfile.py b/recipes/libyang/all/test_package/conanfile.py new file mode 100644 index 0000000000000..ec1844a785913 --- /dev/null +++ b/recipes/libyang/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", "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/libyang/all/test_package/test_package.c b/recipes/libyang/all/test_package/test_package.c new file mode 100644 index 0000000000000..b892125a1218e --- /dev/null +++ b/recipes/libyang/all/test_package/test_package.c @@ -0,0 +1,11 @@ +#include + +int main() +{ + struct ly_ctx *ctx = NULL; + if ( ly_ctx_new( NULL, 0, &ctx ) ) + { + return 1; + } + return 0; +} diff --git a/recipes/libyang/config.yml b/recipes/libyang/config.yml new file mode 100644 index 0000000000000..78864b67abe0f --- /dev/null +++ b/recipes/libyang/config.yml @@ -0,0 +1,3 @@ +versions: + "2.1.148": + folder: "all" diff --git a/recipes/libyuv/all/conandata.yml b/recipes/libyuv/all/conandata.yml index 0096cb0d06e2f..753108fbfb79d 100644 --- a/recipes/libyuv/all/conandata.yml +++ b/recipes/libyuv/all/conandata.yml @@ -1,6 +1,12 @@ # Versions from LIBYUV_VERSION definition in include/libyuv/version.h # Pay attention to package commits incrementing this definition sources: + "1892": + url: "https://chromium.googlesource.com/libyuv/libyuv/+archive/4cd90347e78ff76755df2107009e900374aee9cd.tar.gz" + "1880": + url: "https://chromium.googlesource.com/libyuv/libyuv/+archive/fb6341d326846fbbe669ad5173e520f66b339621.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": @@ -8,15 +14,30 @@ sources: "1768": url: "https://chromium.googlesource.com/libyuv/libyuv/+archive/dfaf7534e0e536f7e5ef8ddd7326797bd09b8622.tar.gz" patches: + "1892": + - patch_file: "patches/1892-0001-fix-cmake.patch" + patch_description: "Fix CMake to be more robust & predictable" + patch_type: "conan" + - patch_file: "patches/1892-0002-check-arm-sve.patch" + patch_description: "Check if -march=armv9-a+sve2 is supported" + patch_type: "conan" + "1880": + - patch_file: "patches/1880-0001-fix-cmake.patch" + patch_description: "Fix CMake to be more robust & predictable" + patch_type: "conan" + "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/0001-fix-cmake-1841.patch" + - patch_file: "patches/1841-0001-fix-cmake.patch" patch_description: "Fix CMake to be more robust & predictable" - patch_type: "compatibility" + patch_type: "conan" "1841": - - patch_file: "patches/0001-fix-cmake-1841.patch" + - patch_file: "patches/1841-0001-fix-cmake.patch" patch_description: "Fix CMake to be more robust & predictable" - patch_type: "compatibility" + patch_type: "conan" "1768": - - patch_file: "patches/0001-fix-cmake-1768.patch" + - patch_file: "patches/1768-0001-fix-cmake.patch" patch_description: "Fix CMake to be more robust & predictable" - patch_type: "compatibility" + patch_type: "conan" diff --git a/recipes/libyuv/all/conanfile.py b/recipes/libyuv/all/conanfile.py index 3c7a9857e98ba..900430a0c20d0 100644 --- a/recipes/libyuv/all/conanfile.py +++ b/recipes/libyuv/all/conanfile.py @@ -1,10 +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, export_conandata_patches, get +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=2.1" class LibyuvConan(ConanFile): @@ -14,12 +15,12 @@ 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" - + 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"], } default_options = { "shared": False, @@ -35,11 +36,13 @@ def config_options(self): del self.options.fPIC def configure(self): - if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + if is_msvc(self): + # Only static for msvc + # Injecting CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS is not sufficient since there are global symbols + del self.options.shared + self.package_type = "static-library" + if self.options.get_safe("shared"): + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") @@ -48,27 +51,26 @@ def requirements(self): if self.options.with_jpeg == "libjpeg": self.requires("libjpeg/9e") elif self.options.with_jpeg == "libjpeg-turbo": - self.requires("libjpeg-turbo/2.0.5") - - def validate(self): - if self.info.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.requires("libjpeg-turbo/[>=3.0.3 <4]") + elif self.options.with_jpeg == "mozjpeg": + self.requires("mozjpeg/4.1.5") def source(self): - get(self, **self.conan_data["sources"][self.version], destination=self.source_folder) + get(self, **self.conan_data["sources"][self.version]) + apply_conandata_patches(self) def generate(self): tc = CMakeToolchain(self) - tc.variables["TEST"] = False - tc.variables["LIBYUV_WITH_JPEG"] = bool(self.options.with_jpeg) + tc.cache_variables["TEST"] = False + tc.cache_variables["LIBYUV_WITH_JPEG"] = bool(self.options.with_jpeg) + if self.options.get_safe("shared"): + # Force FPIC for shared, Conan does not set it + tc.cache_variables["CMAKE_POSITION_INDEPENDENT_CODE"] = True tc.generate() deps = CMakeDeps(self) deps.generate() def build(self): - apply_conandata_patches(self) cmake = CMake(self) cmake.configure() cmake.build() @@ -80,8 +82,14 @@ def package(self): def package_info(self): self.cpp_info.libs = ["yuv"] - - # 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.cpp_info.requires = [] + if self.settings.compiler == "msvc": + self.cpp_info.defines.append("_CRT_SECURE_NO_WARNINGS") + 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") + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") diff --git a/recipes/libyuv/all/patches/0001-fix-cmake-1768.patch b/recipes/libyuv/all/patches/0001-fix-cmake-1768.patch deleted file mode 100644 index c5cf6a86be66a..0000000000000 --- a/recipes/libyuv/all/patches/0001-fix-cmake-1768.patch +++ /dev/null @@ -1,59 +0,0 @@ ---- 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/0001-fix-cmake-1841.patch b/recipes/libyuv/all/patches/0001-fix-cmake-1841.patch deleted file mode 100644 index aa4506b3d1cac..0000000000000 --- a/recipes/libyuv/all/patches/0001-fix-cmake-1841.patch +++ /dev/null @@ -1,62 +0,0 @@ ---- 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/1768-0001-fix-cmake.patch b/recipes/libyuv/all/patches/1768-0001-fix-cmake.patch new file mode 100644 index 0000000000000..d3f63b9343331 --- /dev/null +++ b/recipes/libyuv/all/patches/1768-0001-fix-cmake.patch @@ -0,0 +1,58 @@ +--- 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,22 @@ 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) + + # 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..2ec00308ee93f --- /dev/null +++ b/recipes/libyuv/all/patches/1841-0001-fix-cmake.patch @@ -0,0 +1,61 @@ +--- 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,22 @@ 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) + + # 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..e6f0d06d43a39 --- /dev/null +++ b/recipes/libyuv/all/patches/1854-0001-fix-cmake.patch @@ -0,0 +1,68 @@ +--- 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,10 @@ 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) + + # 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/patches/1880-0001-fix-cmake.patch b/recipes/libyuv/all/patches/1880-0001-fix-cmake.patch new file mode 100644 index 0000000000000..b44803ec7ecf3 --- /dev/null +++ b/recipes/libyuv/all/patches/1880-0001-fix-cmake.patch @@ -0,0 +1,68 @@ +--- 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( UNIT_TEST "Built unit tests" OFF ) + + SET ( ly_base_dir ${PROJECT_SOURCE_DIR} ) +@@ -27,15 +27,10 @@ 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) + + # 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 +39,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(UNIT_TEST) +@@ -94,11 +95,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/patches/1892-0001-fix-cmake.patch b/recipes/libyuv/all/patches/1892-0001-fix-cmake.patch new file mode 100644 index 0000000000000..de39c3870ab6c --- /dev/null +++ b/recipes/libyuv/all/patches/1892-0001-fix-cmake.patch @@ -0,0 +1,81 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index a021623..e0e25db 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -4,8 +4,8 @@ + + include(CheckCSourceCompiles) + ++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( UNIT_TEST "Built unit tests" OFF ) + + SET ( ly_base_dir ${PROJECT_SOURCE_DIR} ) +@@ -74,8 +74,6 @@ if(MSVC) + ADD_DEFINITIONS ( -D_CRT_SECURE_NO_WARNINGS ) + endif() + +-# Need to set PIC to allow creating shared libraries from object file libraries. +-SET(CMAKE_POSITION_INDEPENDENT_CODE ON) + + # Build the set of objects that do not need to be compiled with flags to enable + # particular architecture features. +@@ -139,15 +137,10 @@ int main(void) { return 0; } + endif() + + # this creates the static library (.a) +-ADD_LIBRARY( ${ly_lib_static} STATIC ${ly_lib_parts}) ++ADD_LIBRARY( ${ly_lib_static} ${ly_lib_parts}) ++target_compile_features(${ly_lib_static} PUBLIC cxx_std_11) + + # this creates the shared library (.so) +-ADD_LIBRARY( ${ly_lib_shared} SHARED ${ly_lib_parts}) +-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 cpuid tool + ADD_EXECUTABLE ( cpuid ${ly_base_dir}/util/cpuid.c ) +@@ -160,12 +153,20 @@ 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_link_libraries(${ly_lib_name}_common_objects JPEG::JPEG ) ++ target_compile_definitions(${ly_lib_static} PRIVATE HAVE_JPEG) ++ target_compile_definitions(yuvconvert PRIVATE HAVE_JPEG) ++ target_compile_definitions(${ly_lib_name}_common_objects PRIVATE HAVE_JPEG) + endif() + + if(UNIT_TEST) +@@ -211,11 +212,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/patches/1892-0002-check-arm-sve.patch b/recipes/libyuv/all/patches/1892-0002-check-arm-sve.patch new file mode 100644 index 0000000000000..6a03c04446bcb --- /dev/null +++ b/recipes/libyuv/all/patches/1892-0002-check-arm-sve.patch @@ -0,0 +1,40 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index e0e25db..c0d9399 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -105,16 +105,28 @@ if(NOT MSVC) + TARGET_COMPILE_OPTIONS(${ly_lib_name}_neon64 PRIVATE -march=armv8-a+dotprod+i8mm) + LIST(APPEND ly_lib_parts $) + +- # Enable AArch64 SVE kernels. +- ADD_LIBRARY(${ly_lib_name}_sve OBJECT +- ${ly_src_dir}/row_sve.cc) +- TARGET_COMPILE_OPTIONS(${ly_lib_name}_sve PRIVATE -march=armv9-a+sve2) +- LIST(APPEND ly_lib_parts $) +- + set(OLD_CMAKE_REQURED_FLAGS ${CMAKE_REQUIRED_FLAGS}) + set(OLD_CMAKE_TRY_COMPILE_TARGET_TYPE ${CMAKE_TRY_COMPILE_TARGET_TYPE}) +- set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -march=armv9-a+sme") ++ ++ set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -march=armv9-a+sve2") + set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) ++ # Check whether the compiler can compile SVE functions; this fails ++ # with Clang for macOS. ++ check_c_source_compiles(" ++int main(void) { return 0; } ++ " CAN_COMPILE_SVE) ++ ++ if (CAN_COMPILE_SVE) ++ # Enable AArch64 SVE kernels. ++ ADD_LIBRARY(${ly_lib_name}_sve OBJECT ++ ${ly_src_dir}/row_sve.cc) ++ TARGET_COMPILE_OPTIONS(${ly_lib_name}_sve PRIVATE -march=armv9-a+sve2) ++ LIST(APPEND ly_lib_parts $) ++ else() ++ ADD_DEFINITIONS(-DLIBYUV_DISABLE_SVE) ++ endif() ++ ++ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQURED_FLAGS} -march=armv9-a+sme) + # Check whether the compiler can compile SME functions; this fails + # with Clang for Windows. + check_c_source_compiles(" diff --git a/recipes/libyuv/all/test_package/CMakeLists.txt b/recipes/libyuv/all/test_package/CMakeLists.txt index 639163e3b7c5c..edb97e8c8e00c 100644 --- a/recipes/libyuv/all/test_package/CMakeLists.txt +++ b/recipes/libyuv/all/test_package/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.15) project(test_package LANGUAGES CXX) find_package(libyuv REQUIRED CONFIG) diff --git a/recipes/libyuv/all/test_package/conanfile.py b/recipes/libyuv/all/test_package/conanfile.py index 0a6bc68712d90..1a000b9447dd6 100644 --- a/recipes/libyuv/all/test_package/conanfile.py +++ b/recipes/libyuv/all/test_package/conanfile.py @@ -1,12 +1,12 @@ from conan import ConanFile from conan.tools.build import can_run -from conan.tools.cmake import CMake, cmake_layout +from conan.tools.cmake import CMake, cmake_layout, CMakeToolchain import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + generators = "CMakeDeps", "VirtualRunEnv" test_type = "explicit" def layout(self): @@ -15,6 +15,11 @@ def layout(self): def requirements(self): self.requires(self.tested_reference_str) + def generate(self): + tc = CMakeToolchain(self) + tc.preprocessor_definitions["HAS_JPEG"] = bool(self.dependencies[self.tested_reference_str].options.with_jpeg) + tc.generate() + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/libyuv/all/test_package/test_package.cpp b/recipes/libyuv/all/test_package/test_package.cpp index c8f607bc623dd..0350128ece349 100644 --- a/recipes/libyuv/all/test_package/test_package.cpp +++ b/recipes/libyuv/all/test_package/test_package.cpp @@ -1,9 +1,17 @@ #include "libyuv.h" +#if HAS_JPEG +#include "libyuv/mjpeg_decoder.h" +#endif int main() { uint8_t in[16] = {}; uint8_t out[16] = {}; libyuv::ConvertToARGB(in, 16, out, 0, 0, 0, 1, 1, 0, 0, libyuv::RotationMode::kRotate0, 0); +#if HAS_JPEG + // Test jpeg implementaiton is correctly linked + libyuv::MJpegDecoder decoder; + decoder.LoadFrame(in, 0); +#endif return 0; } diff --git a/recipes/libyuv/all/test_v1_package/CMakeLists.txt b/recipes/libyuv/all/test_v1_package/CMakeLists.txt deleted file mode 100644 index a044d49d31fde..0000000000000 --- a/recipes/libyuv/all/test_v1_package/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(libyuv REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE libyuv::libyuv) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/libyuv/config.yml b/recipes/libyuv/config.yml index 336e0262a0b45..9b10304af3038 100644 --- a/recipes/libyuv/config.yml +++ b/recipes/libyuv/config.yml @@ -1,4 +1,10 @@ versions: + "1892": + folder: all + "1880": + folder: all + "1854": + folder: all "1845": folder: all "1841": diff --git a/recipes/libzen/all/conandata.yml b/recipes/libzen/all/conandata.yml index c0b761db1ccf7..13b7a5a289581 100644 --- a/recipes/libzen/all/conandata.yml +++ b/recipes/libzen/all/conandata.yml @@ -1,8 +1,12 @@ sources: + "0.4.41": + url: "https://mediaarea.net/download/source/libzen/0.4.41/libzen_0.4.41.tar.bz2" + sha256: "eb237d7d3dca6dc6ba068719420a27de0934a783ccaeb2867562b35af3901e2d" "0.4.38": url: "https://mediaarea.net/download/source/libzen/0.4.38/libzen_0.4.38.tar.bz2" sha256: "594e07bb4a0472cd9da258b3c4e050e9a37a39cccd85e3d8b5bf597d027b7eda" patches: + "0.4.41": + - patch_file: "patches/0002-export-data-in-windows-dlls.patch" "0.4.38": - - patch_file: "patches/0001-enable-WIN32-shared-libraries.patch" - patch_file: "patches/0002-export-data-in-windows-dlls.patch" diff --git a/recipes/libzen/all/conanfile.py b/recipes/libzen/all/conanfile.py index 1a994b7d1e470..76f22e86e9164 100644 --- a/recipes/libzen/all/conanfile.py +++ b/recipes/libzen/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, copy, export_conandata_patches, get, rmdir, save +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, save, replace_in_file import os import textwrap -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.54.0" class LibzenConan(ConanFile): @@ -15,7 +15,7 @@ class LibzenConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" description = "Small C++ derivate classes to have an easier life" topics = ("c++", "helper", "util") - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -39,17 +39,13 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + 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) @@ -59,12 +55,16 @@ def generate(self): tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True # 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): + def _patch_sources(self): apply_conandata_patches(self) + # Enable WIN32 shared libraries + replace_in_file(self, os.path.join(self.source_folder, "Project", "CMake", "CMakeLists.txt"), + "set(BUILD_SHARED_LIBS OFF)", "") + + def build(self): + self._patch_sources() cmake = CMake(self) cmake.configure(build_script_folder=os.path.join(self.source_folder, "Project", "CMake")) cmake.build() diff --git a/recipes/libzen/all/patches/0001-enable-WIN32-shared-libraries.patch b/recipes/libzen/all/patches/0001-enable-WIN32-shared-libraries.patch deleted file mode 100644 index f40a66c0fca2f..0000000000000 --- a/recipes/libzen/all/patches/0001-enable-WIN32-shared-libraries.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- Project/CMake/CMakeLists.txt -+++ Project/CMake/CMakeLists.txt -@@ -7,7 +7,7 @@ - set(ZenLib_PATCH_VERSION 38) - set(ZenLib_VERSION ${ZenLib_MAJOR_VERSION}.${ZenLib_MINOR_VERSION}.${ZenLib_PATCH_VERSION}) - --if(WIN32) -+if(0) - set(BUILD_SHARED_LIBS OFF) - else() - option(BUILD_SHARED_LIBS "Build shared libs" ON) diff --git a/recipes/libzen/all/patches/0002-export-data-in-windows-dlls.patch b/recipes/libzen/all/patches/0002-export-data-in-windows-dlls.patch index 17b22fd745f02..75e09bd7ab6b7 100644 --- a/recipes/libzen/all/patches/0002-export-data-in-windows-dlls.patch +++ b/recipes/libzen/all/patches/0002-export-data-in-windows-dlls.patch @@ -1,18 +1,3 @@ ---- Source/ZenLib/Conf.cpp -+++ Source/ZenLib/Conf.cpp -@@ -24,8 +24,8 @@ - - //End of line - #ifdef WINDOWS -- const Char* EOL=__T("\r\n"); -- const Char PathSeparator=__T('\\'); -+ ZEN_IMPEXP const Char* EOL=__T("\r\n"); -+ ZEN_IMPEXP const Char PathSeparator=__T('\\'); - #endif - #ifdef UNIX - const Char* EOL=__T("\n"); -diff --git a/source_subfolder/Source/ZenLib/Conf.h b/source_subfolder/Source/ZenLib/Conf.h -index 18264cf..d989fdb 100644 --- Source/ZenLib/Conf.h +++ Source/ZenLib/Conf.h @@ -234,9 +234,22 @@ diff --git a/recipes/libzen/config.yml b/recipes/libzen/config.yml index 49eb7f8b8da5a..ced5a558f9a53 100644 --- a/recipes/libzen/config.yml +++ b/recipes/libzen/config.yml @@ -1,3 +1,5 @@ versions: + "0.4.41": + folder: "all" "0.4.38": folder: "all" diff --git a/recipes/libzip/all/conandata.yml b/recipes/libzip/all/conandata.yml index 567f243d79a98..9567df4b1e773 100644 --- a/recipes/libzip/all/conandata.yml +++ b/recipes/libzip/all/conandata.yml @@ -1,26 +1,80 @@ sources: + "1.11.2": + url: + - "https://libzip.org/download/libzip-1.11.2.tar.gz" + - "https://github.com/nih-at/libzip/releases/download/v1.11.2/libzip-1.11.2.tar.gz" + sha256: "6b2a43837005e1c23fdfee532b78f806863e412d2089b9c42b49ab08cbcd7665" + "1.11.1": + url: + - "https://libzip.org/download/libzip-1.11.1.tar.gz" + - "https://github.com/nih-at/libzip/releases/download/v1.11.1/libzip-1.11.1.tar.gz" + sha256: "c0e6fa52a62ba11efd30262290dc6970947aef32e0cc294ee50e9005ceac092a" + "1.10.1": + url: + - "https://libzip.org/download/libzip-1.10.1.tar.gz" + - "https://github.com/nih-at/libzip/releases/download/v1.10.1/libzip-1.10.1.tar.gz" + sha256: "9669ae5dfe3ac5b3897536dc8466a874c8cf2c0e3b1fdd08d75b273884299363" "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", - ] + 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", - "https://github.com/nih-at/libzip/releases/download/v1.8.0/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", - "https://github.com/nih-at/libzip/releases/download/v1.7.3/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.11.2": + - patch_file: "patches/1.7.3-0001-cmake-install-bundle.patch" + patch_description: "fix installation path of utilities" + patch_type: "conan" + - patch_file: "patches/1.11.2-0002-remove-rpath.patch" + patch_description: "remove rpath feature" + patch_type: "conan" + "1.11.1": + - patch_file: "patches/1.7.3-0001-cmake-install-bundle.patch" + patch_description: "fix installation path of utilities" + patch_type: "conan" + - patch_file: "patches/1.11.1-0002-remove-rpath.patch" + patch_description: "remove rpath feature" + patch_type: "conan" + "1.10.1": + - patch_file: "patches/1.7.3-0001-cmake-install-bundle.patch" + patch_description: "fix installation path of utilities" + patch_type: "conan" + - patch_file: "patches/1.10.1-0002-remove-rpath.patch" + patch_description: "remove rpath feature" + patch_type: "conan" "1.9.2": - - patch_file: "patches/0001-cmake-install-bundle.patch" + - patch_file: "patches/1.7.3-0001-cmake-install-bundle.patch" + patch_description: "fix installation path of utilities" + patch_type: "conan" + - patch_file: "patches/1.9.2-0002-remove-rpath.patch" + patch_description: "remove rpath feature" + patch_type: "conan" + - patch_file: "patches/1.9.2-0003-fix-zstd-name.patch" + patch_description: "fix zstd name" + patch_type: "portability" "1.8.0": - - patch_file: "patches/0001-cmake-install-bundle.patch" + - patch_file: "patches/1.7.3-0001-cmake-install-bundle.patch" + patch_description: "fix installation path of utilities" + patch_type: "conan" + - patch_file: "patches/1.8.0-0002-remove-rpath.patch" + patch_description: "remove rpath feature" + patch_type: "conan" + - patch_file: "patches/1.8.0-0003-fix-zstd-name.patch" + patch_description: "fix zstd name" + patch_type: "portability" "1.7.3": - - patch_file: "patches/0001-cmake-install-bundle.patch" + - patch_file: "patches/1.7.3-0001-cmake-install-bundle.patch" + patch_description: "fix installation path of utilities" + patch_type: "conan" + - patch_file: "patches/1.7.3-0002-remove-rpath.patch" + patch_description: "remove rpath feature" + patch_type: "conan" diff --git a/recipes/libzip/all/conanfile.py b/recipes/libzip/all/conanfile.py index aa51f4e16ed75..f6403b2c2308d 100644 --- a/recipes/libzip/all/conanfile.py +++ b/recipes/libzip/all/conanfile.py @@ -1,21 +1,21 @@ 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.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" +required_conan_version = ">=1.54.0" class LibZipConan(ConanFile): name = "libzip" description = "A C library for reading, creating, and modifying zip archives" + license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/nih-at/libzip" - license = "BSD-3-Clause" topics = ("zip", "zip-archives", "zip-editing") - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -47,7 +47,7 @@ def config_options(self): if self.settings.os == "Windows": del self.options.fPIC if not self._has_zstd_support: - del self.options.zstd + del self.options.with_zstd # Default crypto backend on windows if self.settings.os == "Windows": self.options.crypto = "win32" @@ -62,29 +62,28 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("zlib/1.2.13") + self.requires("zlib/[>=1.2.11 <2]") 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.5") if self.options.get_safe("with_zstd"): - self.requires("zstd/1.5.2") + self.requires("zstd/1.5.5") if self.options.crypto == "openssl": - self.requires("openssl/1.1.1s") + self.requires("openssl/[>=1.1 <4]") elif self.options.crypto == "mbedtls": - self.requires("mbedtls/3.2.1") + self.requires("mbedtls/3.5.0") def validate(self): - if self.info.options.crypto == "win32" and self.info.settings.os != "Windows": + if self.options.crypto == "win32" and self.settings.os != "Windows": raise ConanInvalidConfiguration("Windows is required to use win32 crypto libraries") 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) @@ -101,49 +100,13 @@ def generate(self): 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): - apply_conandata_patches(self) - - top_cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") - # Honor zstd enabled - if self._has_zstd_support: - 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 - replace_in_file( - self, - top_cmakelists, - "set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})", - "", - ) - replace_in_file( - self, - top_cmakelists, - "set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)", - "", - ) - def build(self): - self._patch_sources() + apply_conandata_patches(self) cmake = CMake(self) cmake.configure() cmake.build() diff --git a/recipes/libzip/all/patches/1.10.1-0002-remove-rpath.patch b/recipes/libzip/all/patches/1.10.1-0002-remove-rpath.patch new file mode 100644 index 0000000000000..6385883376739 --- /dev/null +++ b/recipes/libzip/all/patches/1.10.1-0002-remove-rpath.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index b2e7724..d33fbd8 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -285,7 +285,7 @@ if(WIN32) + endif(WIN32) + + # rpath handling: use rpath in installed binaries +-if(NOT CMAKE_SYSTEM_NAME MATCHES Linux) ++if(0) + set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}) + set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + endif() diff --git a/recipes/libzip/all/patches/1.11.1-0002-remove-rpath.patch b/recipes/libzip/all/patches/1.11.1-0002-remove-rpath.patch new file mode 100644 index 0000000000000..6ee1d37d42f37 --- /dev/null +++ b/recipes/libzip/all/patches/1.11.1-0002-remove-rpath.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 8d019b9..5cd6a81 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -290,7 +290,7 @@ if(WIN32) + endif(WIN32) + + # rpath handling: use rpath in installed binaries +-if(NOT CMAKE_SYSTEM_NAME MATCHES Linux) ++if(0) + set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}) + set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + endif() diff --git a/recipes/libzip/all/patches/1.11.2-0002-remove-rpath.patch b/recipes/libzip/all/patches/1.11.2-0002-remove-rpath.patch new file mode 100644 index 0000000000000..2d5c920bd02c6 --- /dev/null +++ b/recipes/libzip/all/patches/1.11.2-0002-remove-rpath.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 23e0f0f..85dec3d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -293,7 +293,7 @@ if(WIN32) + endif(WIN32) + + # rpath handling: use rpath in installed binaries +-if(NOT CMAKE_SYSTEM_NAME MATCHES Linux) ++if(0) + set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}) + set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + endif() diff --git a/recipes/libzip/all/patches/0001-cmake-install-bundle.patch b/recipes/libzip/all/patches/1.7.3-0001-cmake-install-bundle.patch similarity index 100% rename from recipes/libzip/all/patches/0001-cmake-install-bundle.patch rename to recipes/libzip/all/patches/1.7.3-0001-cmake-install-bundle.patch diff --git a/recipes/libzip/all/patches/1.7.3-0002-remove-rpath.patch b/recipes/libzip/all/patches/1.7.3-0002-remove-rpath.patch new file mode 100644 index 0000000000000..2682986aa602f --- /dev/null +++ b/recipes/libzip/all/patches/1.7.3-0002-remove-rpath.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 017f7cf..e9dd8d9 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -237,7 +237,7 @@ if(WIN32) + endif(WIN32) + + # rpath handling: use rpath in installed binaries +-if(NOT CMAKE_SYSTEM_NAME MATCHES Linux) ++if(0) + set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}) + set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + endif() diff --git a/recipes/libzip/all/patches/1.8.0-0002-remove-rpath.patch b/recipes/libzip/all/patches/1.8.0-0002-remove-rpath.patch new file mode 100644 index 0000000000000..511a8497170f9 --- /dev/null +++ b/recipes/libzip/all/patches/1.8.0-0002-remove-rpath.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 93b46a6..577865f 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -237,7 +237,7 @@ if(WIN32) + endif(WIN32) + + # rpath handling: use rpath in installed binaries +-if(NOT CMAKE_SYSTEM_NAME MATCHES Linux) ++if(0) + set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}) + set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + endif() diff --git a/recipes/libzip/all/patches/1.8.0-0003-fix-zstd-name.patch b/recipes/libzip/all/patches/1.8.0-0003-fix-zstd-name.patch new file mode 100644 index 0000000000000..d3a2faebb601a --- /dev/null +++ b/recipes/libzip/all/patches/1.8.0-0003-fix-zstd-name.patch @@ -0,0 +1,33 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 93b46a6..577865f 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -196,12 +196,12 @@ if(ENABLE_LZMA) + endif(ENABLE_LZMA) + + if(ENABLE_ZSTD) +- find_package(Zstd) +- if(Zstd_FOUND) ++ find_package(zstd) ++ if(zstd_FOUND) + set(HAVE_LIBZSTD 1) + else() + message(WARNING "-- zstd library not found; zstandard support disabled") +- endif(Zstd_FOUND) ++ endif(zstd_FOUND) + endif(ENABLE_ZSTD) + + if (COMMONCRYPTO_FOUND) +diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt +index 1069cec..c0148b9 100644 +--- a/lib/CMakeLists.txt ++++ b/lib/CMakeLists.txt +@@ -148,7 +148,7 @@ endif() + + if(HAVE_LIBZSTD) + target_sources(zip PRIVATE zip_algorithm_zstd.c) +- target_link_libraries(zip PRIVATE Zstd::Zstd) ++ target_link_libraries(zip PRIVATE $,zstd::libzstd_shared,zstd::libzstd_static>) + endif() + + if(HAVE_COMMONCRYPTO) diff --git a/recipes/libzip/all/patches/1.9.2-0002-remove-rpath.patch b/recipes/libzip/all/patches/1.9.2-0002-remove-rpath.patch new file mode 100644 index 0000000000000..24aeef7d82680 --- /dev/null +++ b/recipes/libzip/all/patches/1.9.2-0002-remove-rpath.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index d00a4f9..bc45784 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -238,7 +238,7 @@ if(WIN32) + endif(WIN32) + + # rpath handling: use rpath in installed binaries +-if(NOT CMAKE_SYSTEM_NAME MATCHES Linux) ++if(0) + set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}) + set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + endif() diff --git a/recipes/libzip/all/patches/1.9.2-0003-fix-zstd-name.patch b/recipes/libzip/all/patches/1.9.2-0003-fix-zstd-name.patch new file mode 100644 index 0000000000000..bbc20c6fe9ebe --- /dev/null +++ b/recipes/libzip/all/patches/1.9.2-0003-fix-zstd-name.patch @@ -0,0 +1,33 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index d00a4f9..bc45784 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -197,12 +197,12 @@ if(ENABLE_LZMA) + endif(ENABLE_LZMA) + + if(ENABLE_ZSTD) +- find_package(Zstd 1.3.6) +- if(Zstd_FOUND) ++ find_package(zstd) ++ if(zstd_FOUND) + set(HAVE_LIBZSTD 1) + else() + message(WARNING "-- zstd library not found; zstandard support disabled") +- endif(Zstd_FOUND) ++ endif(zstd_FOUND) + endif(ENABLE_ZSTD) + + if (COMMONCRYPTO_FOUND) +diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt +index 1213fa0..b6446cb 100644 +--- a/lib/CMakeLists.txt ++++ b/lib/CMakeLists.txt +@@ -147,7 +147,7 @@ endif() + + if(HAVE_LIBZSTD) + target_sources(zip PRIVATE zip_algorithm_zstd.c) +- target_link_libraries(zip PRIVATE Zstd::Zstd) ++ target_link_libraries(zip PRIVATE $,zstd::libzstd_shared,zstd::libzstd_static>) + endif() + + if(HAVE_COMMONCRYPTO) diff --git a/recipes/libzip/config.yml b/recipes/libzip/config.yml index 63ddbcf63ff11..4c71d7dcc950f 100644 --- a/recipes/libzip/config.yml +++ b/recipes/libzip/config.yml @@ -1,4 +1,10 @@ versions: + "1.11.2": + folder: all + "1.11.1": + folder: all + "1.10.1": + folder: all "1.9.2": folder: all "1.8.0": 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..8419667338e92 100644 --- a/recipes/libzippp/all/conandata.yml +++ b/recipes/libzippp/all/conandata.yml @@ -1,4 +1,16 @@ sources: + "7.1-1.10.1": + url: "https://github.com/ctabin/libzippp/archive/libzippp-v7.1-1.10.1.tar.gz" + sha256: "9ded3c4b5641e65d2b3a3dd0cbc4106209ee17c17df70e5187e7171420752546" + "7.0-1.10.1": + url: "https://github.com/ctabin/libzippp/archive/libzippp-v7.0-1.10.1.tar.gz" + sha256: "67d6808406b4fc255016ede52c7b5105e2d0e43899a3331de9ed86da5dea07a1" + "6.1-1.9.2": + url: "https://github.com/ctabin/libzippp/archive/libzippp-v6.1-1.9.2.tar.gz" + sha256: "3796f174780f23938749da493cf4cbc4c55f84a568ec395f2c256dfe10129305" + "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..b6ec87350a23e 100644 --- a/recipes/libzippp/all/conanfile.py +++ b/recipes/libzippp/all/conanfile.py @@ -1,33 +1,37 @@ -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") + package_type = "library" + 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,56 +39,79 @@ 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.11 <2]") + 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.get_safe("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 build_requirements(self): + self.tool_requires("cmake/[>=3.16 <4]") 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_BUILD_TESTS"] = False + tc.variables["LIBZIPPP_ENABLE_ENCRYPTION"] = self.options.with_encryption + tc.variables["LIBZIPPP_CMAKE_CONFIG_MODE"] = True + 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)') + if Version(self.version) <= "6.0": + 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) - 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") + self.cpp_info.set_property("cmake_target_name", "libzippp::libzippp") + 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") + if self.options.with_encryption: self.cpp_info.defines.append("LIBZIPPP_WITH_ENCRYPTION") 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..eb03fe8bdec4f 100644 --- a/recipes/libzippp/config.yml +++ b/recipes/libzippp/config.yml @@ -1,4 +1,12 @@ versions: + "7.1-1.10.1": + folder: all + "7.0-1.10.1": + folder: all + "6.1-1.9.2": + folder: all + "6.0-1.9.2": + folder: all "5.0-1.8.0": folder: all "4.0": diff --git a/recipes/lief/all/conandata.yml b/recipes/lief/all/conandata.yml index 322361c8a5bce..957438b147a11 100644 --- a/recipes/lief/all/conandata.yml +++ b/recipes/lief/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "0.13.1": + url: "https://github.com/lief-project/LIEF/archive/0.13.1.tar.gz" + sha256: "a3a846e9b6ce2acf89ef4687e870f41ca703f18fee3e7f501ebb05ee1aeb1847" + "0.13.0": + url: "https://github.com/lief-project/LIEF/archive/0.13.0.tar.gz" + sha256: "8834e2ccfeefd1003527887357950173fe55e9a712004aa638af67378e28ef55" "0.12.3": url: "https://github.com/lief-project/LIEF/archive/0.12.3.tar.gz" sha256: "762925ad2eed642a6e7ef2cc899bcd3e93a40a2ce1dd2391d9b9ecadfe6438cf" @@ -9,6 +15,14 @@ sources: url: "https://github.com/lief-project/LIEF/archive/0.10.1.tar.gz" sha256: "6f30c98a559f137e08b25bcbb376c0259914b33c307b8b901e01ca952241d00a" patches: + "0.13.1": + - patch_file: "patches/0.13.0-001_link_to_conan.patch" + patch_description: "find conan package and link these" + patch_type: "conan" + "0.13.0": + - patch_file: "patches/0.13.0-001_link_to_conan.patch" + patch_description: "find conan package and link these" + patch_type: "conan" "0.12.3": - patch_file: "patches/0.12.3-001_link_to_conan.patch" patch_description: "find conan package and link these" diff --git a/recipes/lief/all/conanfile.py b/recipes/lief/all/conanfile.py index eed55b5ff591b..7a69bb5dfa4c4 100644 --- a/recipes/lief/all/conanfile.py +++ b/recipes/lief/all/conanfile.py @@ -1,14 +1,14 @@ 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 +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 import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.57.0" class LiefConan(ConanFile): name = "lief" @@ -17,6 +17,7 @@ class LiefConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/lief-project/LIEF" topics = ("executable", "elf", "pe", "mach-o") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -48,8 +49,20 @@ class LiefConan(ConanFile): } @property - def _minimum_cpp_standard(self): - return 11 + def _min_cppstd(self): + return "14" if self.options.with_frozen else "11" + + @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): export_conandata_patches(self) @@ -60,50 +73,43 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass - - 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++") + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("rang/3.2") self.requires("mbedtls/3.2.1") - if self.options.with_json: - self.requires("nlohmann_json/3.11.2") - if self.options.with_frozen: - self.requires("frozen/1.1.1") - if Version(self.version) < "0.12.2": self.requires("rang/3.2") - self.requires("mbedtls/3.2.1") + else: + self.requires("utfcpp/3.2.3") + # 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", transitive_headers=True) + self.requires("tcb-span/cci.20220616", transitive_headers=True) if self.options.with_json: self.requires("nlohmann_json/3.11.2") if self.options.with_frozen: self.requires("frozen/1.1.1") - if Version(self.version) >= "0.12.2": - self.requires("utfcpp/3.2.1") - self.requires("spdlog/1.10.0") - self.requires("boost/1.80.0") - self.requires("tcb-span/cci.20220616") + + 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." + ) + + if self.options.shared and is_msvc(self) and not check_min_vs(self, "191", raise_invalid=False): + raise ConanInvalidConfiguration(f"{self.ref} does not support Visual Studio < 15 with shared:True") + + if self.settings.compiler.get_safe("libcxx") == "libstdc++": + raise ConanInvalidConfiguration(f"{self.ref} does not support libstdc++") 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) @@ -131,6 +137,10 @@ def generate(self): tc.variables["LIEF_EXTERNAL_SPDLOG"] = True tc.variables["LIEF_OPT_EXTERNAL_LEAF"] = True tc.variables["LIEF_OPT_EXTERNAL_SPAN"] = True + if Version(self.version) >= "0.13.0": + tc.variables["LIEF_INSTALL"] = True + tc.variables["LIEF_EXTERNAL_SPAN_DIR"] = self.dependencies["tcb-span"].cpp_info.includedirs[0].replace("\\", "/") + tc.variables["LIEF_EXTERNAL_LEAF_DIR"] = self.dependencies["boost"].cpp_info.includedirs[0].replace("\\", "/") tc.generate() deps = CMakeDeps(self) @@ -166,8 +176,5 @@ def package_info(self): 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.13.0-001_link_to_conan.patch b/recipes/lief/all/patches/0.13.0-001_link_to_conan.patch new file mode 100644 index 0000000000000..a5a1b2657ba0d --- /dev/null +++ b/recipes/lief/all/patches/0.13.0-001_link_to_conan.patch @@ -0,0 +1,56 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 774c479..5aec5cb 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -99,8 +99,12 @@ endif() + + # Dependencies + # ============ +-set(THIRD_PARTY_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/third-party/") + include(LIEFDependencies) ++set(LIEF_FROZEN_ENABLED 0) ++if (LIEF_SUPPORT_CXX14 AND NOT LIEF_DISABLE_FROZEN) ++ message(STATUS "Enable Frozen (C++14 support)") ++ set(LIEF_FROZEN_ENABLED 1) ++endif() + + # iOS specific config + # =================== +@@ -479,8 +483,7 @@ endif() + # 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) +@@ -682,9 +685,9 @@ if (LIEF_INSTALL) + + # Installation + # ====================== +- ++ include(GNUInstallDirs) ++ if(0) + if(UNIX) +- include(GNUInstallDirs) + set(CMAKE_INSTALL_LIBDIR "lib") + else() + if(WIN32) +@@ -698,13 +701,14 @@ if (LIEF_INSTALL) + 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( diff --git a/recipes/lief/all/test_v1_package/CMakeLists.txt b/recipes/lief/all/test_v1_package/CMakeLists.txt index 6b1097615e03a..9d54a092e0a67 100644 --- a/recipes/lief/all/test_v1_package/CMakeLists.txt +++ b/recipes/lief/all/test_v1_package/CMakeLists.txt @@ -4,11 +4,5 @@ project(test_package LANGUAGES CXX) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(LIEF REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/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) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/lief/config.yml b/recipes/lief/config.yml index f24eac175f18c..8c2e3de0a3a96 100644 --- a/recipes/lief/config.yml +++ b/recipes/lief/config.yml @@ -1,4 +1,8 @@ versions: + "0.13.1": + folder: "all" + "0.13.0": + folder: "all" "0.12.3": folder: "all" "0.12.2": diff --git a/recipes/lielab/all/conandata.yml b/recipes/lielab/all/conandata.yml new file mode 100644 index 0000000000000..6803bdea9abab --- /dev/null +++ b/recipes/lielab/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "0.4.1": + url: "https://github.com/sandialabs/Lielab/archive/refs/tags/v0.4.1.tar.gz" + sha256: "862BEC2114B9E554F77ECB2F7B3D5CEABF7374A9A0E7F80BCB94A868F3D9F51C" + "0.4.0": + url: "https://github.com/sandialabs/Lielab/archive/refs/tags/v0.4.0.tar.gz" + sha256: "5CABF2D31D7D38EEEF525ADEE5D22C0359E9C043884D4AB5FBA219D3CB217A5C" diff --git a/recipes/lielab/all/conanfile.py b/recipes/lielab/all/conanfile.py new file mode 100644 index 0000000000000..ecc16c01755a9 --- /dev/null +++ b/recipes/lielab/all/conanfile.py @@ -0,0 +1,83 @@ +from conan import ConanFile +from conan.tools.cmake import CMakeToolchain, CMake +from conan.tools.files import copy, get, rmdir +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration +import os + +required_conan_version = ">=1.52.0" + +class LielabConan(ConanFile): + name = "lielab" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/sandialabs/Lielab" + description = "Lielab is a C++ library for numerical Lie-theory: Lie groups," \ + " Lie algebras, homogeneous manifolds, and various functions and algorithms" \ + " on these spaces." + topics = ("Lie-theory", "Lie-group", "Lie-algebra", "numerical", "header-only") + package_type = "header-library" + license = "MIT" + + settings = "os", "arch", "compiler", "build_type" + + no_copy_source = True + + def requirements(self): + self.requires("eigen/3.4.0") + + @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 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.") + + def build_requirements(self): + self.tool_requires("cmake/[>=3.23 <4]") + + 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["LIELAB_INSTALL_LIBRARY"] = True + tc.variables["LIELAB_BUILD_TESTS"] = False + tc.variables["LIELAB_BUILD_PYTHON"] = False + tc.generate() + + def package(self): + copy(self, "LICENSE", 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, "share")) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + self.cpp_info.set_property("cmake_file_name", "Lielab") + self.cpp_info.set_property("cmake_target_name", "Lielab::Lielab") + + self.cpp_info.names["cmake_find_package"] = "Lielab" + self.cpp_info.names["cmake_find_package_multi"] = "Lielab" + + def package_id(self): + self.info.clear() + diff --git a/recipes/lielab/all/test_package/CMakeLists.txt b/recipes/lielab/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..c13d8b918525c --- /dev/null +++ b/recipes/lielab/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(Lielab REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE Lielab::Lielab) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) diff --git a/recipes/lielab/all/test_package/conanfile.py b/recipes/lielab/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/lielab/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/lielab/all/test_package/test_package.cpp b/recipes/lielab/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..81a29ab2a8a75 --- /dev/null +++ b/recipes/lielab/all/test_package/test_package.cpp @@ -0,0 +1,12 @@ +#include +#include +#include + + +int main(void) { + std::cout << "Lielab v" << Lielab::VERSION << std::endl; + std::cout << Lielab::AUTHOR << std::endl; + std::cout << Lielab::LOCATION << std::endl; + + return EXIT_SUCCESS; +} diff --git a/recipes/lielab/config.yml b/recipes/lielab/config.yml new file mode 100644 index 0000000000000..bf6438ecd493c --- /dev/null +++ b/recipes/lielab/config.yml @@ -0,0 +1,5 @@ +versions: + "0.4.1": + folder: "all" + "0.4.0": + folder: "all" diff --git a/recipes/lightgbm/all/CMakeLists.txt b/recipes/lightgbm/all/CMakeLists.txt index 61f3d3b039e2b..d250cd86d5991 100644 --- a/recipes/lightgbm/all/CMakeLists.txt +++ b/recipes/lightgbm/all/CMakeLists.txt @@ -1,7 +1,20 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) +cmake_minimum_required(VERSION 3.15) +project(cmake_wrapper LANGUAGES CXX) -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) +find_package(Eigen3 REQUIRED CONFIG) +find_package(fast_double_parser REQUIRED CONFIG) +find_package(fmt REQUIRED CONFIG) -add_subdirectory("source_subfolder") +add_subdirectory(src) + +if(_MAJOR_VERSION GREATER_EQUAL 4) + set(TARGETS lightgbm_objs lightgbm_capi_objs) + set(VISIBILITY PRIVATE) +else() + set(TARGETS lightgbm _lightgbm) + set(VISIBILITY "") +endif() + +foreach(target ${TARGETS}) + target_link_libraries(${target} ${VISIBILITY} Eigen3::Eigen fast_double_parser::fast_double_parser fmt::fmt) +endforeach() diff --git a/recipes/lightgbm/all/conandata.yml b/recipes/lightgbm/all/conandata.yml index bd0b8937e4a98..8355ba2b45e51 100644 --- a/recipes/lightgbm/all/conandata.yml +++ b/recipes/lightgbm/all/conandata.yml @@ -1,10 +1,29 @@ sources: + "4.3.0": + url: "https://github.com/microsoft/LightGBM/archive/refs/tags/v4.3.0.tar.gz" + sha256: "9e5a88bc231addfe4a0e57aa5ceb157f045103cd69ad8c2f393ef941ef52a9ac" + "4.2.0": + url: "https://github.com/microsoft/LightGBM/archive/refs/tags/v4.2.0.tar.gz" + sha256: "4b2df6e3c5fa345a2fac6cefff65dd08cbe2fa4717cd8335c2a58c1a0c7c6b02" + "4.1.0": + url: "https://github.com/microsoft/LightGBM/archive/refs/tags/v4.1.0.tar.gz" + sha256: "eb896dc21c7afec95d10327777f6e77163b5bcd35f6ce5d152e6feefbe3328a5" + "3.3.5": + url: "https://github.com/microsoft/LightGBM/archive/refs/tags/v3.3.5.tar.gz" + sha256: "16fb9e299ced37be5ac69dd510e7323337e623019c9c578628c43b285f764be7" "3.3.2": url: "https://github.com/microsoft/LightGBM/archive/refs/tags/v3.3.2.tar.gz" sha256: "d7c0f842e94165578d5a0c046ca942838d1574149f98c84400ce511239d17b9f" patches: + "4.1.0": + - patch_file: "patches/4.1.0-0001-fix-openmp-clang.patch" + patch_type: "portability" + patch_description: "Fix OpenMP support for Clang" + "3.3.5": + - patch_file: "patches/3.3.5-0001-fix-openmp-clang.patch" + patch_type: "portability" + patch_description: "Fix OpenMP support for Clang" "3.3.2": - - patch_file: "patches/0001-fix-includes.patch" - base_path: "source_subfolder" - - patch_file: "patches/0002-fix-openmp-clang.patch" - base_path: "source_subfolder" + - patch_file: "patches/3.3.2-0001-fix-openmp-clang.patch" + patch_type: "portability" + patch_description: "Fix OpenMP support for Clang" diff --git a/recipes/lightgbm/all/conanfile.py b/recipes/lightgbm/all/conanfile.py index d00e21c352364..e84bccaa188bb 100644 --- a/recipes/lightgbm/all/conanfile.py +++ b/recipes/lightgbm/all/conanfile.py @@ -1,82 +1,114 @@ -from conans import CMake, ConanFile, tools +import os + +from conan import ConanFile, conan_version +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, export_conandata_patches, apply_conandata_patches from conan.tools.microsoft import is_msvc -import functools +from conan.tools.env import VirtualBuildEnv +from conan.tools.scm import Version -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class LightGBMConan(ConanFile): name = "lightgbm" - description = "A fast, distributed, high performance gradient boosting (GBT, GBDT, GBRT, GBM or MART) framework based on decision tree algorithms, used for ranking, classification and many other machine learning tasks." - topics = ("machine-learning", "boosting") + description = ( + "A fast, distributed, high performance gradient boosting " + "(GBT, GBDT, GBRT, GBM or MART) framework based on decision tree algorithms, " + "used for ranking, classification and many other machine learning tasks." + ) + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/microsoft/LightGBM" - license = "MIT" + topics = ("machine-learning", "boosting") + 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], - "with_openmp": [True, False] + "with_openmp": [True, False], } default_options = { "shared": False, "fPIC": True, - "with_openmp": True + "with_openmp": True, } - @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 + if conan_version.major == 1 and self.settings.compiler == "apple-clang": + # https://github.com/conan-io/conan-center-index/pull/18759#issuecomment-1817470331 + del self.options.with_openmp 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") - self.requires("fast_double_parser/0.6.0") - self.requires("fmt/9.0.0") - if self.options.with_openmp and self.settings.compiler in ("clang", "apple-clang"): - self.requires("llvm-openmp/11.1.0") + self.requires("fast_double_parser/0.7.0", transitive_headers=True, transitive_libs=True) + self.requires("fmt/10.1.1", transitive_headers=True, transitive_libs=True) + if self.options.get_safe("with_openmp") and self.settings.compiler in ["clang", "apple-clang"]: + self.requires("llvm-openmp/17.0.4", transitive_headers=True, transitive_libs=True) def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) + check_min_cppstd(self, 11) + + def build_requirements(self): + if Version(self.version) >= "4.3.0": + self.tool_requires("cmake/[>=3.18 <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], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["BUILD_STATIC_LIB"] = not self.options.shared + tc.cache_variables["USE_DEBUG"] = self.settings.build_type in ["Debug", "RelWithDebInfo"] + tc.cache_variables["USE_OPENMP"] = self.options.get_safe("with_openmp", False) + tc.cache_variables["BUILD_CLI"] = False + if is_apple_os(self): + tc.cache_variables["APPLE_OUTPUT_DYLIB"] = True + tc.variables["_MAJOR_VERSION"] = Version(self.version).major + tc.generate() + deps = CMakeDeps(self) + deps.generate() + venv = VirtualBuildEnv(self) + venv.generate(scope="build") 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["BUILD_STATIC_LIB"] = not self.options.shared - cmake.definitions["USE_DEBUG"] = self.settings.build_type == "Debug" - cmake.definitions["USE_OPENMP"] = self.options.with_openmp - if self.settings.os == "Macos": - cmake.definitions["APPLE_OUTPUT_DYLIB"] = True - cmake.configure() - return cmake + apply_conandata_patches(self) + # Fix vendored dependency includes + common_h = os.path.join(self.source_folder, "include", "LightGBM", "utils", "common.h") + for lib in ["fmt", "fast_double_parser"]: + replace_in_file(self, common_h, f"../../../external_libs/{lib}/include/", "") + # Unvendor Eigen3 + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "include_directories(${EIGEN_DIR})", "") def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=self.source_path.parent) 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() def package_info(self): @@ -90,16 +122,19 @@ def package_info(self): self.cpp_info.libs = ["lib_lightgbm"] if is_msvc(self) else ["_lightgbm"] if self.settings.os == "Windows": self.cpp_info.system_libs.extend(["ws2_32", "iphlpapi"]) - elif self.settings.os == "Linux": + elif self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("pthread") - if not self.options.shared and self.options.with_openmp: + + # OpenMP preprocessor directives are used in a number of public headers, such as: + # https://github.com/microsoft/LightGBM/blob/master/include/LightGBM/tree.h#L188 + if self.options.get_safe("with_openmp"): + openmp_flags = [] if is_msvc(self): openmp_flags = ["-openmp"] elif self.settings.compiler == "gcc": openmp_flags = ["-fopenmp"] - elif self.settings.compiler in ("clang", "apple-clang"): + elif self.settings.compiler in ["clang", "apple-clang"]: openmp_flags = ["-Xpreprocessor", "-fopenmp"] - else: - openmp_flags = [] + self.cpp_info.cxxflags.extend(openmp_flags) self.cpp_info.exelinkflags.extend(openmp_flags) self.cpp_info.sharedlinkflags.extend(openmp_flags) diff --git a/recipes/lightgbm/all/patches/0001-fix-includes.patch b/recipes/lightgbm/all/patches/0001-fix-includes.patch deleted file mode 100644 index 13fa0fe43a998..0000000000000 --- a/recipes/lightgbm/all/patches/0001-fix-includes.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff --git a/include/LightGBM/utils/common.h b/include/LightGBM/utils/common.h -index af981062..097f20d4 100644 ---- a/include/LightGBM/utils/common.h -+++ b/include/LightGBM/utils/common.h -@@ -33,9 +33,9 @@ - - #if (!((defined(sun) || defined(__sun)) && (defined(__SVR4) || defined(__svr4__)))) - #define FMT_HEADER_ONLY --#include "../../../external_libs/fmt/include/fmt/format.h" -+#include - #endif --#include "../../../external_libs/fast_double_parser/include/fast_double_parser.h" -+#include - - #ifdef _MSC_VER - #include diff --git a/recipes/lightgbm/all/patches/0002-fix-openmp-clang.patch b/recipes/lightgbm/all/patches/3.3.2-0001-fix-openmp-clang.patch similarity index 100% rename from recipes/lightgbm/all/patches/0002-fix-openmp-clang.patch rename to recipes/lightgbm/all/patches/3.3.2-0001-fix-openmp-clang.patch diff --git a/recipes/lightgbm/all/patches/3.3.5-0001-fix-openmp-clang.patch b/recipes/lightgbm/all/patches/3.3.5-0001-fix-openmp-clang.patch new file mode 100644 index 0000000000000..0fbe29eced0c4 --- /dev/null +++ b/recipes/lightgbm/all/patches/3.3.5-0001-fix-openmp-clang.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 95610d55..2b48507d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -444,7 +444,7 @@ if(USE_MPI) + endif(USE_MPI) + + if(USE_OPENMP) +- if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") ++ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|AppleClang") + TARGET_LINK_LIBRARIES(lightgbm OpenMP::OpenMP_CXX) + TARGET_LINK_LIBRARIES(_lightgbm OpenMP::OpenMP_CXX) + endif() diff --git a/recipes/lightgbm/all/patches/4.1.0-0001-fix-openmp-clang.patch b/recipes/lightgbm/all/patches/4.1.0-0001-fix-openmp-clang.patch new file mode 100644 index 0000000000000..4de5b0a2d1c8e --- /dev/null +++ b/recipes/lightgbm/all/patches/4.1.0-0001-fix-openmp-clang.patch @@ -0,0 +1,11 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -526,7 +526,7 @@ + endif() + + if(USE_OPENMP) +- if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") ++ if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang|AppleClang") + target_link_libraries(lightgbm_objs PUBLIC OpenMP::OpenMP_CXX) + # c_api headers also includes OpenMP headers, thus compiling + # lightgbm_capi_objs needs include directory for OpenMP. diff --git a/recipes/lightgbm/all/test_package/CMakeLists.txt b/recipes/lightgbm/all/test_package/CMakeLists.txt index 12b8a397ff5d3..1fc3dbaef1eaa 100644 --- a/recipes/lightgbm/all/test_package/CMakeLists.txt +++ b/recipes/lightgbm/all/test_package/CMakeLists.txt @@ -1,10 +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) - -find_package(LightGBM CONFIG REQUIRED) +find_package(LightGBM REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} LightGBM::LightGBM) diff --git a/recipes/lightgbm/all/test_package/conanfile.py b/recipes/lightgbm/all/test_package/conanfile.py index 746d011e4501a..ef5d7042163ec 100644 --- a/recipes/lightgbm/all/test_package/conanfile.py +++ b/recipes/lightgbm/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 LightGBMTestConan(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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/lightgbm/all/test_v1_package/CMakeLists.txt b/recipes/lightgbm/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/lightgbm/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/lightgbm/all/test_v1_package/conanfile.py b/recipes/lightgbm/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..746d011e4501a --- /dev/null +++ b/recipes/lightgbm/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class LightGBMTestConan(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/lightgbm/config.yml b/recipes/lightgbm/config.yml index 82ecde9973a8b..e59972b46cebb 100644 --- a/recipes/lightgbm/config.yml +++ b/recipes/lightgbm/config.yml @@ -1,3 +1,11 @@ versions: + "4.3.0": + folder: all + "4.2.0": + folder: all + "4.1.0": + folder: all + "3.3.5": + folder: all "3.3.2": folder: all diff --git a/recipes/lightpcapng/all/CMakeLists.txt b/recipes/lightpcapng/all/CMakeLists.txt deleted file mode 100644 index 5cfb924ad4de7..0000000000000 --- a/recipes/lightpcapng/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/lightpcapng/all/conanfile.py b/recipes/lightpcapng/all/conanfile.py index ea6e74e5ca99f..3625228ec2534 100644 --- a/recipes/lightpcapng/all/conanfile.py +++ b/recipes/lightpcapng/all/conanfile.py @@ -1,15 +1,21 @@ -from conans import ConanFile, CMake, tools import os -required_conan_version = ">=1.33.0" +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get + +required_conan_version = ">=1.53.0" + class LightPcapNgConan(ConanFile): name = "lightpcapng" - homepage = "https://github.com/Technica-Engineering/LightPcapNg" description = "Library for general-purpose tracing based on PCAPNG file format" - topics = ("pcapng", "pcap") - url = "https://github.com/conan-io/conan-center-index" license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/Technica-Engineering/LightPcapNg" + topics = ("pcapng", "pcap") + + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -21,17 +27,6 @@ class LightPcapNgConan(ConanFile): "fPIC": True, "with_zstd": True, } - generators = "cmake", "cmake_paths", "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 config_options(self): if self.settings.os == "Windows": @@ -40,43 +35,50 @@ def config_options(self): def configure(self): if self.options.with_zstd: self.options["zstd"].shared = self.options.shared - 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): + cmake_layout(self, src_folder="src") def requirements(self): if self.options.with_zstd: - self.requires("zstd/1.4.5") + self.requires("zstd/1.5.5") 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): + tc = CMakeToolchain(self) + tc.variables["LIGHT_USE_ZSTD"] = self.options.with_zstd + tc.variables["BUILD_TESTING"] = False + tc.generate() + tc = CMakeDeps(self) + tc.generate() def build(self): - 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["LIGHT_USE_ZSTD"] = self.options.with_zstd - self._cmake.definitions["BUILD_TESTING"] = False - 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", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder) + cmake = CMake(self) cmake.install() def package_info(self): - self.cpp_info.names["cmake_find_package"] = "light_pcapng" - self.cpp_info.names["cmake_find_package_multi"] = "light_pcapng" - self.cpp_info.components["liblight_pcapng"].names["cmake_find_package"] = "light_pcapng" - self.cpp_info.components["liblight_pcapng"].names["cmake_find_package_multi"] = "light_pcapng" + self.cpp_info.set_property("cmake_file_name", "light_pcapng") + self.cpp_info.set_property("cmake_target_name", "light_pcapng::light_pcapng") self.cpp_info.components["liblight_pcapng"].libs = ["light_pcapng"] - if self.options.with_zstd: self.cpp_info.components["liblight_pcapng"].requires = ["zstd::zstd"] + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.names["cmake_find_package"] = "light_pcapng" + self.cpp_info.names["cmake_find_package_multi"] = "light_pcapng" + self.cpp_info.components["liblight_pcapng"].names["cmake_find_package"] = "light_pcapng" + self.cpp_info.components["liblight_pcapng"].names["cmake_find_package_multi"] = "light_pcapng" diff --git a/recipes/lightpcapng/all/test_package/CMakeLists.txt b/recipes/lightpcapng/all/test_package/CMakeLists.txt index 8927c32d3f4ef..f7eaac4f3f950 100644 --- a/recipes/lightpcapng/all/test_package/CMakeLists.txt +++ b/recipes/lightpcapng/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ -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(TARGETS) - -find_package(light_pcapng REQUIRED) +find_package(light_pcapng REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) target_link_libraries(${PROJECT_NAME} light_pcapng::light_pcapng) diff --git a/recipes/lightpcapng/all/test_package/conanfile.py b/recipes/lightpcapng/all/test_package/conanfile.py index 3da371b660e0a..ef5d7042163ec 100644 --- a/recipes/lightpcapng/all/test_package/conanfile.py +++ b/recipes/lightpcapng/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/lightpcapng/all/test_v1_package/CMakeLists.txt b/recipes/lightpcapng/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/lightpcapng/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/lightpcapng/all/test_v1_package/conanfile.py b/recipes/lightpcapng/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..49a3a66ea5bad --- /dev/null +++ b/recipes/lightpcapng/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/limereport/all/conandata.yml b/recipes/limereport/all/conandata.yml new file mode 100644 index 0000000000000..a6aa17992b336 --- /dev/null +++ b/recipes/limereport/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.7.4": + url: "https://github.com/fralx/LimeReport/archive/refs/tags/1.7.4.tar.gz" + sha256: 5e16ffa4f1f6c9175ef00be95029d5dda57287236ef8529582e1df1366c8dc30 diff --git a/recipes/limereport/all/conanfile.py b/recipes/limereport/all/conanfile.py new file mode 100644 index 0000000000000..60455f5993eb1 --- /dev/null +++ b/recipes/limereport/all/conanfile.py @@ -0,0 +1,119 @@ +from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout +from conan.tools.files import copy, get, replace_in_file +from conan.tools.build import check_min_cppstd +from conan import ConanFile +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration +import os + + +class LimereportConan(ConanFile): + name = "limereport" + description = "Report generator for Qt Framework" + homepage = "https://limereport.ru" + topics = ("limereport", "pdf", "report","qt") + license = "LGPL-3.0", "GPL-3.0" + 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_zint": [True, False] + } + default_options = { + "shared": False, + "fPIC": True, + "with_zint": False, + } + + @property + def _min_cppstd(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "Visual Studio": "16", + "msvc": "192", + "gcc": "8", + "clang": "8", + "apple-clang": "9.1", + } + + @property + def _qt_version_major(self): + return Version(self.dependencies["qt"].ref.version).major + + 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): + # QString included in Irglobal.h and Limereport expects be running Qt on customer side + self.requires("qt/[>=5.15 <7]", transitive_headers=True, transitive_libs=True) + if self.options.with_zint: + self.requires("zint/2.10.0") + + 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 not (self.dependencies["qt"].options.qtdeclarative): + raise ConanInvalidConfiguration(f"{self.ref} requires -o='qt/*:qtdeclarative=True'") + if not (self.dependencies["qt"].options.qtsvg and self.dependencies["qt"].options.qttools): + raise ConanInvalidConfiguration(f"{self.ref} requires -o='qt/*:qtsvg=True' and -o='qt/*:qttools=True'") + if self.options.with_zint and not self.dependencies["zint"].options.with_qt: + raise ConanInvalidConfiguration(f"{self.ref} option with_zint=True requires -o 'zint/*:with_qt=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.cache_variables["LIMEREPORT_STATIC"] = not self.options.shared + if is_msvc(self): + tc.variables["WINDOWS_BUILD"] = True + tc.cache_variables["USE_QT6"] = self._qt_version_major == 6 + tc.cache_variables["ENABLE_ZINT"] = self.options.with_zint + tc.generate() + tc = CMakeDeps(self) + tc.generate() + + def _patch_sources(self): + # Avoid using vendozied zint + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "add_subdirectory(3rdparty)", "") + + 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")) + 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.libs = [f"limereport-qt{self._qt_version_major}"] + self.cpp_info.requires = ["qt::qtCore", "qt::qtWidgets", "qt::qtQml", "qt::qtXml", "qt::qtSql", + "qt::qtPrintSupport", "qt::qtSvg", "qt::qtUiTools"] + if self.options.with_zint: + self.cpp_info.requires.append("zint::zint") + if self.options.shared: + self.cpp_info.defines.append("LIMEREPORT_IMPORTS") diff --git a/recipes/limereport/all/test_package/CMakeLists.txt b/recipes/limereport/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..08e6667600f91 --- /dev/null +++ b/recipes/limereport/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package CXX) + +find_package(limereport CONFIG REQUIRED) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} limereport::limereport) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/limereport/all/test_package/conanfile.py b/recipes/limereport/all/test_package/conanfile.py new file mode 100644 index 0000000000000..76ff27872680a --- /dev/null +++ b/recipes/limereport/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, cmake_layout, CMakeToolchain +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/limereport/all/test_package/test_package.cpp b/recipes/limereport/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..a10ab64ab7245 --- /dev/null +++ b/recipes/limereport/all/test_package/test_package.cpp @@ -0,0 +1,15 @@ +#include +#include +#include +#include + +int main(int argc, char* argv[]) +{ + auto report = new LimeReport::ReportEngine(); + + std::cout << "limereport: " << report->reportName().toStdString() << std::endl; + std::cout << "LIMEREPORT_VERSION_STR: " << LIMEREPORT_VERSION_STR << std::endl; + + delete report; + return EXIT_SUCCESS; +} diff --git a/recipes/limereport/config.yml b/recipes/limereport/config.yml new file mode 100644 index 0000000000000..41f47d462d189 --- /dev/null +++ b/recipes/limereport/config.yml @@ -0,0 +1,3 @@ +versions: + "1.7.4": + folder: "all" diff --git a/recipes/linmath.h/all/conanfile.py b/recipes/linmath.h/all/conanfile.py index 72dbc48e507a8..aeda5df97ec0f 100644 --- a/recipes/linmath.h/all/conanfile.py +++ b/recipes/linmath.h/all/conanfile.py @@ -16,18 +16,18 @@ class LinmathConan(ConanFile): topics = ("math", "graphics", "linear-algebra", "vector", "matrix", "quaternion") homepage = "https://github.com/datenwolf/linmath.h" url = "https://github.com/conan-io/conan-center-index" + package_type = "header-library" 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 diff --git a/recipes/linux-headers-generic/all/conandata.yml b/recipes/linux-headers-generic/all/conandata.yml index ecc5fdb03690f..5ce5b2106b7c8 100644 --- a/recipes/linux-headers-generic/all/conandata.yml +++ b/recipes/linux-headers-generic/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "6.5.9": + url: "https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.5.9.tar.gz" + sha256: "3c269612220746ba87dc9063bec2afcb2df04b4fdaa9f7e1f67751284966cf37" + "5.19.9": + url: "https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.19.9.tar.gz" + sha256: "1f01b0ee846547737793103f23cc46a382e4694e7728e8cb8c48ea51a2bb7a8d" + "5.15.128": + url: "https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.15.128.tar.gz" + sha256: "4ce1331bb3877bc92581ec5faff76d63d19e7b1fa174acdda1f5cba4a8f2abf7" "5.14.9": url: "https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.14.9.tar.gz" sha256: "b5cd37e6d193c8f6a98e41ce6f9d97260d178e0a3cfc43d7ff684f67c6c25f29" diff --git a/recipes/linux-headers-generic/all/conanfile.py b/recipes/linux-headers-generic/all/conanfile.py index 32a14abb318da..5b72ec11402d0 100644 --- a/recipes/linux-headers-generic/all/conanfile.py +++ b/recipes/linux-headers-generic/all/conanfile.py @@ -1,43 +1,62 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, 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.files import chdir, copy, get +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout + +required_conan_version = ">=1.53.0" class LinuxHeadersGenericConan(ConanFile): name = "linux-headers-generic" + description = "Generic Linux kernel headers" + license = "GPL-2.0-only" url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.kernel.org/" - license = "GPL-2.0-only" - description = "Generic Linux kernel headers" - topics = ("linux", "headers", "generic") - settings = "os", "arch", "build_type", "compiler" + topics = ("linux", "headers", "generic", "header-only") - @property - def _source_subfolder(self): - return "source_subfolder" + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + def layout(self): + basic_layout(self, src_folder="src") def package_id(self): del self.info.settings.os del self.info.settings.build_type del self.info.settings.compiler + @property + def _is_legacy_one_profile(self): + return not hasattr(self, "settings_build") + def validate(self): - if self.settings.os != "Linux": + if self.settings.os != "Linux" or (not self._is_legacy_one_profile and self.settings_build.os != "Linux"): raise ConanInvalidConfiguration("linux-headers-generic supports only Linux") - if hasattr(self, "settings_build") and tools.cross_building(self): - raise ConanInvalidConfiguration("linux-headers-generic can not be cross-compiled") 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) + tc.generate() def build(self): - with tools.chdir(os.path.join(self._source_subfolder)): - autotools = AutoToolsBuildEnvironment(self) + with chdir(self, self.source_folder): + autotools = Autotools(self) autotools.make(target="headers") def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - self.copy("include/*.h", src=os.path.join(self._source_subfolder, "usr")) + copy(self, "COPYING", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder) + copy(self, "include/*.h", + dst=self.package_folder, + src=os.path.join(self.source_folder, "usr")) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/linux-headers-generic/all/test_package/CMakeLists.txt b/recipes/linux-headers-generic/all/test_package/CMakeLists.txt index 34af13462f44f..486ec186a2730 100644 --- a/recipes/linux-headers-generic/all/test_package/CMakeLists.txt +++ b/recipes/linux-headers-generic/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 C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(linux-headers-generic REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE linux-headers-generic::linux-headers-generic) diff --git a/recipes/linux-headers-generic/all/test_package/conanfile.py b/recipes/linux-headers-generic/all/test_package/conanfile.py index 92074169bcc74..fae501d0afb9e 100644 --- a/recipes/linux-headers-generic/all/test_package/conanfile.py +++ b/recipes/linux-headers-generic/all/test_package/conanfile.py @@ -1,11 +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 -required_conan_version = ">=1.33.0" class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake" + generators = "CMakeDeps", "CMakeToolchain" + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/linux-headers-generic/config.yml b/recipes/linux-headers-generic/config.yml index a8d9d5e7bbfa8..461cdf02e1d8f 100644 --- a/recipes/linux-headers-generic/config.yml +++ b/recipes/linux-headers-generic/config.yml @@ -1,4 +1,10 @@ versions: + "6.5.9": + folder: all + "5.19.9": + folder: all + "5.15.128": + folder: all "5.14.9": folder: all "5.13.9": diff --git a/recipes/linux-syscall-support/all/conandata.yml b/recipes/linux-syscall-support/all/conandata.yml index e2cbe519dc5b7..ca4a399974573 100644 --- a/recipes/linux-syscall-support/all/conandata.yml +++ b/recipes/linux-syscall-support/all/conandata.yml @@ -1,3 +1,5 @@ sources: + "2022.10.12": + url: "https://chromium.googlesource.com/linux-syscall-support/+archive/refs/tags/v2022.10.12.tar.gz" "cci.20200813": url: "https://chromium.googlesource.com/linux-syscall-support/+archive/29f7c7e018f4ce706a709f0b0afbf8bacf869480.tar.gz" diff --git a/recipes/linux-syscall-support/all/conanfile.py b/recipes/linux-syscall-support/all/conanfile.py index cf1a5361651ae..4f6891e057476 100644 --- a/recipes/linux-syscall-support/all/conanfile.py +++ b/recipes/linux-syscall-support/all/conanfile.py @@ -1,15 +1,21 @@ import os -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, save +from conan.tools.layout import basic_layout + +required_conan_version = ">=1.50.0" class LinuxSyscallSupportConan(ConanFile): name = "linux-syscall-support" description = "Linux Syscall Support provides a header file that can be included into your application whenever you need to make direct system calls." + license = "BSD-3-Clause" + topics = ("linux", "syscall", "chromium") homepage = "https://chromium.googlesource.com/linux-syscall-support" url = "https://github.com/conan-io/conan-center-index" - topics = ("conan", "linux", "syscall", "chromium") - license = "BSD-3-Clause" + + package_type = "header-library" settings = "os" no_copy_source = True @@ -17,11 +23,14 @@ def configure(self): if self.settings.os != "Linux": raise ConanInvalidConfiguration("{} supported only on Linux".format(self.name)) + def layout(self): + basic_layout(self, src_folder="src") + def source(self): - tools.get(**self.conan_data["sources"][self.version]) + get(self, **self.conan_data["sources"][self.version]) def package_id(self): - self.info.header_only() + self.info.clear() def _extract_license(self): with open(os.path.join(self.source_folder, "linux_syscall_support.h")) as f: @@ -29,9 +38,12 @@ def _extract_license(self): license_content = [] for i in range(0, 29): license_content.append(content_lines[i][3:-1]) - tools.save("LICENSE", "\n".join(license_content)) + return "\n".join(license_content) def package(self): - self.copy(pattern="linux_syscall_support.h", dst="include") - self._extract_license() - self.copy(pattern="LICENSE", dst="licenses", keep_path=False) + save(self, os.path.join(self.package_folder, "licenses", "LICENSE"), self._extract_license()) + copy(self, "linux_syscall_support.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/linux-syscall-support/all/test_package/CMakeLists.txt b/recipes/linux-syscall-support/all/test_package/CMakeLists.txt index 4e6705f7300ba..d0ccff7dbe735 100644 --- a/recipes/linux-syscall-support/all/test_package/CMakeLists.txt +++ b/recipes/linux-syscall-support/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 C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(linux-syscall-support 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 linux-syscall-support::linux-syscall-support) diff --git a/recipes/linux-syscall-support/all/test_package/conanfile.py b/recipes/linux-syscall-support/all/test_package/conanfile.py index 7b99c9826a2c7..e845ae751a301 100644 --- a/recipes/linux-syscall-support/all/test_package/conanfile.py +++ b/recipes/linux-syscall-support/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 BlazeTestConan(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", "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/linux-syscall-support/all/test_package/example.c b/recipes/linux-syscall-support/all/test_package/test_package.c similarity index 100% rename from recipes/linux-syscall-support/all/test_package/example.c rename to recipes/linux-syscall-support/all/test_package/test_package.c diff --git a/recipes/linux-syscall-support/all/test_v1_package/CMakeLists.txt b/recipes/linux-syscall-support/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..961b416af6b07 --- /dev/null +++ b/recipes/linux-syscall-support/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/linux-syscall-support/all/test_v1_package/conanfile.py b/recipes/linux-syscall-support/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/linux-syscall-support/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/linux-syscall-support/config.yml b/recipes/linux-syscall-support/config.yml index 701f50987ccf0..13c1a01d76262 100644 --- a/recipes/linux-syscall-support/config.yml +++ b/recipes/linux-syscall-support/config.yml @@ -1,3 +1,5 @@ versions: + "2022.10.12": + folder: all "cci.20200813": folder: all diff --git a/recipes/liquid-dsp/all/conandata.yml b/recipes/liquid-dsp/all/conandata.yml index 23e1bf444316a..e94d8d3d73cb9 100644 --- a/recipes/liquid-dsp/all/conandata.yml +++ b/recipes/liquid-dsp/all/conandata.yml @@ -1,8 +1,7 @@ sources: + "1.6.0": + url: "https://github.com/jgaeddert/liquid-dsp/archive/v1.6.0.tar.gz" + sha256: "6ee6a5dfb48e047b118cf613c0b9f43e34356a5667a77a72a55371d2c8c53bf5" "1.3.2": url: "https://github.com/jgaeddert/liquid-dsp/archive/refs/tags/v1.3.2.tar.gz" sha256: "85093624EF9CB90EAD64C836D2F42690197EDACE1A86257D6524C4E4DC870483" -patches: - "1.3.2": - - patch_file: "patches/1.3.2/0001-Remove-headers-check.patch" - base_path: "source_subfolder" diff --git a/recipes/liquid-dsp/all/conanfile.py b/recipes/liquid-dsp/all/conanfile.py index 26e149f068f7a..131fb07babeea 100644 --- a/recipes/liquid-dsp/all/conanfile.py +++ b/recipes/liquid-dsp/all/conanfile.py @@ -1,45 +1,42 @@ -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration -from contextlib import contextmanager import os -required_conan_version = ">=1.33.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 +from conan.tools.env import Environment, VirtualBuildEnv +from conan.tools.files import chdir, copy, get, rename +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc + +required_conan_version = ">=1.53.0" + class LiquidDspConan(ConanFile): name = "liquid-dsp" - description = ( - "Digital signal processing library for software-defined radios (and more)" - ) - topics = ("dsp", "sdr", "liquid-dsp") + description = "Digital signal processing library for software-defined radios (and more)" + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/jgaeddert/liquid-dsp" - license = ("MIT",) - settings = "os", "arch", "build_type", "compiler" - exports_sources = ["generate_link_library.bat"] + topics = ("dsp", "sdr") + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], + "fPIC": [True, False], "simdoverride": [True, False], } default_options = { "shared": False, + "fPIC": True, "simdoverride": False, } - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _libname(self): - if self.settings.os == "Windows": - return "libliquid" - return "liquid" - @property def _target_name(self): - if self.settings.os == "Macos": + if is_apple_os(self): if not self.options.shared: return "libliquid.ar" return "libliquid.dylib" @@ -49,138 +46,81 @@ def _target_name(self): @property def _lib_pattern(self): - if self.settings.os == "Macos" and not self.options.shared: + if is_apple_os(self) and not self.options.shared: return "libliquid.a" - if self.settings.os != "Windows": - return self._target_name - return "libliquid.lib" + return self._target_name - def configure(self): - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC - @property - def _settings_build(self): - return getattr(self, "settings_build", self.settings) + def configure(self): + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + if self.options.shared: + self.options.rm_safe("fPIC") - 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("mingw-w64/8.1") - self.build_requires("automake/1.16.4") - - def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + def layout(self): + basic_layout(self, src_folder="src") def validate(self): - if hasattr(self, "settings_build") and tools.cross_building(self): + if cross_building(self): raise ConanInvalidConfiguration("Cross building is not yet supported. Contributions are welcome") + if is_msvc(self): + raise ConanInvalidConfiguration("MSVC is not supported due to missing 'complex' data type support") + + def build_requirements(self): + # For ./bootstrap.sh + self.tool_requires("autoconf/2.71") + 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 _patch_sources(self): - if self.settings.os == "Windows": - for patch in self.conan_data["patches"][self.version]: - tools.patch(**patch) - - def _gen_link_library(self): - if self.settings.compiler != "Visual Studio" or (not self.options.shared): - return - self.run("cmd /c generate_link_library.bat") - with tools.chdir(self._source_subfolder): - self.run( - "{} /def:libliquid.def /out:libliquid.lib /machine:{}".format( - os.getenv("AR"), "X86" if self.settings.arch == "x86" else "X64" - ), - win_bash=tools.os_info.is_windows, - ) + def generate(self): + venv = VirtualBuildEnv(self) + venv.generate() - def _rename_libraries(self): - with tools.chdir(self._source_subfolder): - if self.settings.os == "Windows" and self.options.shared: - tools.rename("libliquid.so", "libliquid.dll") - elif self.settings.os == "Windows" and not self.options.shared: - tools.rename("libliquid.a", "libliquid.lib") - elif self.settings.os == "Macos" and not self.options.shared: - tools.rename("libliquid.ar", "libliquid.a") - - @contextmanager - def _build_context(self): - if self.settings.compiler == "Visual Studio": - env = { - "CC": "gcc", - "CXX": "g++", - "LD": "ld", - "AR": "ar", - } - with tools.environment_append(env): - yield - else: - yield - - @contextmanager - def _msvc_context(self): - if self.settings.compiler == "Visual Studio": - with tools.vcvars(self.settings): - env = { - "CC": "cl -nologo", - "CXX": "cl -nologo", - "AR": "lib", - "LD": "link", - } - with tools.environment_append(env): - yield + gcc_env = Environment() + if self.settings.build_type == "Debug": + cflags = "-g -O0" else: - yield + cflags = "-s -O2 -DNDEBUG" + gcc_env.append("CFLAGS", cflags) + gcc_env.vars(self, scope="gcc").save_script("conan_gcc_env") - def build(self): - self._patch_sources() - ncpus = tools.cpu_count() - configure_args = [] - cflags = ["-static-libgcc"] + tc = AutotoolsToolchain(self) if self.settings.build_type == "Debug": - configure_args.append("--enable-debug-messages") - cflags.extend(["-g", "-O0"]) - else: - cflags.extend(["-s", "-O2", "-DNDEBUG"]) + tc.configure_args.append("--enable-debug-messages") if self.options.simdoverride: - configure_args.append("--enable-simdoverride") - if self.settings.compiler == "Visual Studio": - configure_args.append("CFLAGS='{}'".format(" ".join(cflags))) - configure_args_str = " ".join(configure_args) - with self._build_context(): - with tools.chdir(self._source_subfolder): - self.run("./bootstrap.sh", win_bash=tools.os_info.is_windows) - self.run( - "./configure {}".format(configure_args_str), - win_bash=tools.os_info.is_windows, - ) - self.run( - "make {} -j{}".format(self._target_name, ncpus), - win_bash=tools.os_info.is_windows, - ) + tc.configure_args.append("--enable-simdoverride") + tc.generate(gcc_env) + + def _rename_libraries(self): + with chdir(self, self.source_folder): + if is_apple_os(self) and not self.options.shared: + rename(self, "libliquid.ar", "libliquid.a") + + def build(self): + with chdir(self, self.source_folder): + self.run("./bootstrap.sh", env=["conanbuild", "gcc"]) + autotools = Autotools(self) + autotools.configure() + autotools.make(self._target_name) self._rename_libraries() - with self._msvc_context(): - self._gen_link_library() def package(self): - self.copy(pattern="LICENSE", src=self._source_subfolder, dst="licenses") - self.copy( - pattern="liquid.h", - dst=os.path.join("include", "liquid"), - src=os.path.join(self._source_subfolder, "include"), - ) - self.copy(pattern="libliquid.dll", dst="bin", src=self._source_subfolder) - self.copy(pattern=self._lib_pattern, dst="lib", src=self._source_subfolder) + copy(self, "LICENSE", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder) + copy(self, "liquid.h", + dst=os.path.join(self.package_folder, "include", "liquid"), + src=os.path.join(self.source_folder, "include")) + copy(self, self._lib_pattern, + dst=os.path.join(self.package_folder, "lib"), + src=self.source_folder) def package_info(self): - self.cpp_info.libs = [self._libname] - if self.settings.os == "Linux": + self.cpp_info.libs = ["liquid"] + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("m") diff --git a/recipes/liquid-dsp/all/generate_link_library.bat b/recipes/liquid-dsp/all/generate_link_library.bat deleted file mode 100644 index fb20541a4c46c..0000000000000 --- a/recipes/liquid-dsp/all/generate_link_library.bat +++ /dev/null @@ -1,4 +0,0 @@ -@echo off -echo Generating link library for MSVC... -echo EXPORTS >> source_subfolder\libliquid.def -for /f "skip=19 tokens=4" %%A in ('%LD% /dump /EXPORTS source_subfolder\libliquid.dll') do echo %%A >> source_subfolder\libliquid.def diff --git a/recipes/liquid-dsp/all/patches/1.3.2/0001-Remove-headers-check.patch b/recipes/liquid-dsp/all/patches/1.3.2/0001-Remove-headers-check.patch deleted file mode 100644 index ad10a374ed0d9..0000000000000 --- a/recipes/liquid-dsp/all/patches/1.3.2/0001-Remove-headers-check.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 8a99b1c6853193c1f518bc81b705d7094225e114 Mon Sep 17 00:00:00 2001 -From: Rui Oliveira -Date: Fri, 18 Jun 2021 09:37:46 +0100 -Subject: [PATCH] Remove headers check - ---- - configure.ac | 8 -------- - 1 file changed, 8 deletions(-) - -diff --git a/configure.ac b/configure.ac -index e6bc297e..5b591c87 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -81,20 +81,12 @@ AC_FUNC_ERROR_AT_LINE - AC_FUNC_MALLOC - AC_FUNC_REALLOC - --# AC_CHECK_LIB (library, function, [action-if-found], [action-if-not-found], [other-libraries]) --AC_CHECK_LIB([c],[main],[],[AC_MSG_ERROR(Could not use standard C library)], []) --AC_CHECK_LIB([m],[main],[],[AC_MSG_ERROR(Could not use standard math library)],[]) -- - # AC_CHECK_FUNC(function, [action-if-found], [action-if-not-found]) - AC_CHECK_FUNCS([malloc realloc free memset memmove],[], - [AC_MSG_ERROR(Could not use memory allocation functions)]) - AC_CHECK_FUNCS([sinf cosf expf cargf cexpf crealf cimagf sqrtf],[], - [AC_MSG_ERROR(Could not use special math functions)],) - --# Check for necessary header files --AC_CHECK_HEADERS([stdio.h stdlib.h complex.h string.h getopt.h sys/resource.h float.h inttypes.h limits.h stdlib.h string.h unistd.h],[], -- [AC_MSG_ERROR(Could not use standard headers)]) -- - # Check for optional header files, libraries, programs - AC_CHECK_HEADERS(fec.h fftw3.h) - AC_CHECK_LIB([fftw3f], [fftwf_plan_dft_1d], [], --- -2.32.0.windows.1 - diff --git a/recipes/liquid-dsp/all/test_package/CMakeLists.txt b/recipes/liquid-dsp/all/test_package/CMakeLists.txt index 2859677acfc5b..a71be24831850 100644 --- a/recipes/liquid-dsp/all/test_package/CMakeLists.txt +++ b/recipes/liquid-dsp/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ -cmake_minimum_required(VERSION 3.0) -project(test_package) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(liquid-dsp REQUIRED CONFIG) add_executable(${CMAKE_PROJECT_NAME} test_package.cpp) -target_link_libraries(${CMAKE_PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${CMAKE_PROJECT_NAME} liquid-dsp::liquid-dsp) diff --git a/recipes/liquid-dsp/all/test_package/conanfile.py b/recipes/liquid-dsp/all/test_package/conanfile.py index bd7165a553cf4..ef5d7042163ec 100644 --- a/recipes/liquid-dsp/all/test_package/conanfile.py +++ b/recipes/liquid-dsp/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/liquid-dsp/config.yml b/recipes/liquid-dsp/config.yml index 906e859d7afd8..6d49f977901cf 100644 --- a/recipes/liquid-dsp/config.yml +++ b/recipes/liquid-dsp/config.yml @@ -1,3 +1,5 @@ versions: + "1.6.0": + folder: "all" "1.3.2": folder: "all" diff --git a/recipes/litehtml/all/conandata.yml b/recipes/litehtml/all/conandata.yml index db5e01516c1d0..e50621e5200ff 100644 --- a/recipes/litehtml/all/conandata.yml +++ b/recipes/litehtml/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.8": + url: "https://github.com/litehtml/litehtml/archive/refs/tags/v0.8.tar.gz" + sha256: "b19edc049c0174f53941469a3c13f1f3210e8877c9c022ace93ac9cd6566b9f0" "cci.20211028": url: "https://github.com/litehtml/litehtml/archive/b095539f8dc5a723c2226b353e6815423b36e0c8.tar.gz" sha256: "c3795594fabeb060e21b9128ff22051986b393bd0b4e6000a5e171c71cabe224" diff --git a/recipes/litehtml/all/conanfile.py b/recipes/litehtml/all/conanfile.py index c3158edb62025..e5ccd7b936201 100644 --- a/recipes/litehtml/all/conanfile.py +++ b/recipes/litehtml/all/conanfile.py @@ -43,6 +43,8 @@ def export_sources(self): def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + if self.version != "cci.20211028": + del self.options.with_icu def configure(self): if self.options.shared: @@ -53,8 +55,8 @@ def layout(self): def requirements(self): # FIXME: add gumbo requirement (it is vendored right now) - if self.options.with_icu: - self.requires("icu/72.1") + if self.options.get_safe("with_icu"): + self.requires("icu/73.2") def validate(self): if self.info.settings.compiler.get_safe("cppstd"): @@ -74,7 +76,7 @@ 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["USE_ICU"] = self.options.get_safe("with_icu", False) 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() @@ -124,7 +126,7 @@ def package_info(self): self.cpp_info.components["litehtml_litehtml"].set_property("cmake_target_name", "litehtml") self.cpp_info.components["litehtml_litehtml"].libs = ["litehtml"] self.cpp_info.components["litehtml_litehtml"].requires = ["gumbo"] - if self.options.with_icu: + if self.options.get_safe("with_icu"): self.cpp_info.components["litehtml_litehtml"].requires.append("icu::icu") if True: # FIXME: remove once we use a vendored gumbo library diff --git a/recipes/litehtml/all/test_package/test_package.cpp b/recipes/litehtml/all/test_package/test_package.cpp index cce35fe42eaa9..a9b9bff01672e 100644 --- a/recipes/litehtml/all/test_package/test_package.cpp +++ b/recipes/litehtml/all/test_package/test_package.cpp @@ -2,16 +2,9 @@ #include "litehtml/tstring_view.h" #include +#include -int main() { - constexpr size_t offset = 5; - constexpr size_t length = 10; - - litehtml::tstring string = _t("the quick brown fox jumps over the lazy dog"); - litehtml::tstring_view view(string.data() + offset, length); - - for (auto c : view) { - std::cout << c << std::endl; - } +int main() { + litehtml::tstring_view view; return 0; } diff --git a/recipes/litehtml/config.yml b/recipes/litehtml/config.yml index 6a05e08e87321..d45793cdd8277 100644 --- a/recipes/litehtml/config.yml +++ b/recipes/litehtml/config.yml @@ -1,3 +1,5 @@ versions: + "0.8": + folder: all "cci.20211028": folder: all diff --git a/recipes/lksctp-tools/all/conandata.yml b/recipes/lksctp-tools/all/conandata.yml new file mode 100644 index 0000000000000..d3fd074d21dd3 --- /dev/null +++ b/recipes/lksctp-tools/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.0.19": + url: "https://github.com/sctp/lksctp-tools/archive/refs/tags/v1.0.19.tar.gz" + sha256: "9251b1368472fb55aaeafe4787131bdde4e96758f6170620bc75b638449cef01" diff --git a/recipes/lksctp-tools/all/conanfile.py b/recipes/lksctp-tools/all/conanfile.py new file mode 100644 index 0000000000000..00f9a40b4e58b --- /dev/null +++ b/recipes/lksctp-tools/all/conanfile.py @@ -0,0 +1,80 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import get, chdir, copy, 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 LKSCTPToolsConan(ConanFile): + name = "lksctp-tools" + settings = "os", "arch", "compiler", "build_type" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/sctp/lksctp-tools" + description = "The Linux Kernel Stream Control Transmission Protocol (lksctp) project" + package_type = "library" + topics = ("sctp") + license = ("GPL-2.0", "LGPL-2.1") + + options = { + "shared": [True, False], + "fPIC": [True, False], + } + + default_options = { + "shared": False, + "fPIC": True, + } + + 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 validate(self): + if self.settings.os != "Linux": + raise ConanInvalidConfiguration(f"{self.ref} is only available on Linux") + + def build_requirements(self): + self.tool_requires("libtool/2.4.7") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + VirtualBuildEnv(self).generate() + tc = AutotoolsToolchain(self) + tc.configure_args.extend([ + "--disable-tests", + ]) + tc.generate() + + def build(self): + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.autoreconf() + autotools.configure() + autotools.make() + + def package(self): + with chdir(self, self.source_folder): + autools = Autotools(self) + autools.install() + + 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, "lib", "lksctp-tools")) + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + + copy(self, pattern="COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + + def package_info(self): + self.cpp_info.libs = ["sctp"] diff --git a/recipes/lksctp-tools/all/test_package/CMakeLists.txt b/recipes/lksctp-tools/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..964f83ff15d38 --- /dev/null +++ b/recipes/lksctp-tools/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) + +find_package(lksctp-tools REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} lksctp-tools::lksctp-tools) diff --git a/recipes/lksctp-tools/all/test_package/conanfile.py b/recipes/lksctp-tools/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0a6bc68712d90 --- /dev/null +++ b/recipes/lksctp-tools/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/lksctp-tools/all/test_package/test_package.c b/recipes/lksctp-tools/all/test_package/test_package.c new file mode 100644 index 0000000000000..3a004853d676d --- /dev/null +++ b/recipes/lksctp-tools/all/test_package/test_package.c @@ -0,0 +1,14 @@ +#include +#include +#include +#include +#include + +int main() { + int sockfd; + + sockfd = socket(AF_INET, SOCK_STREAM, IPPROTO_SCTP); + close(sockfd); + + return 0; +} diff --git a/recipes/lksctp-tools/config.yml b/recipes/lksctp-tools/config.yml new file mode 100644 index 0000000000000..682394be2990b --- /dev/null +++ b/recipes/lksctp-tools/config.yml @@ -0,0 +1,3 @@ +versions: + "1.0.19": + folder: all diff --git a/recipes/llama-cpp/all/cmake/llama-cpp-cuda-static.cmake b/recipes/llama-cpp/all/cmake/llama-cpp-cuda-static.cmake new file mode 100644 index 0000000000000..2e9b341b77e42 --- /dev/null +++ b/recipes/llama-cpp/all/cmake/llama-cpp-cuda-static.cmake @@ -0,0 +1,7 @@ +find_dependency(CUDAToolkit REQUIRED) +if (WIN32) + # As of 12.3.1 CUDA Toolkit for Windows does not offer a static cublas library + target_link_libraries(llama-cpp::common INTERFACE CUDA::cudart_static CUDA::cublas CUDA::cublasLt CUDA::cuda_driver) +else () + target_link_libraries(llama-cpp::common INTERFACE CUDA::cudart_static CUDA::cublas_static CUDA::cublasLt_static CUDA::cuda_driver) +endif() diff --git a/recipes/llama-cpp/all/conandata.yml b/recipes/llama-cpp/all/conandata.yml new file mode 100755 index 0000000000000..f31f9bb9e4c75 --- /dev/null +++ b/recipes/llama-cpp/all/conandata.yml @@ -0,0 +1,12 @@ +sources: + "b3542": + url: "https://github.com/ggerganov/llama.cpp/archive/refs/tags/b3542.tar.gz" + sha256: "6f8b23d930400fce5708d2c85022ef33f1083af8f6ac395abefadacee0942e78" + "b3040": + url: "https://github.com/ggerganov/llama.cpp/archive/refs/tags/b3040.tar.gz" + sha256: "020e040139660eb40113503bb1057d5387677d249b990e008e04821532f7cd62" +patches: + "b3542": + - patch_file: "patches/b3542-001-curl-patch-targets.patch" + "b3040": + - patch_file: "patches/b3040-001-curl-patch-targets.patch" diff --git a/recipes/llama-cpp/all/conanfile.py b/recipes/llama-cpp/all/conanfile.py new file mode 100755 index 0000000000000..06fe2b68724c2 --- /dev/null +++ b/recipes/llama-cpp/all/conanfile.py @@ -0,0 +1,136 @@ +import os + +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, cross_building +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +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 LlamaCppConan(ConanFile): + name = "llama-cpp" + description = "Inference of LLaMA model in pure C/C++" + topics = ("llama", "llm", "ai") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/ggerganov/llama.cpp" + license = "MIT" + settings = "os", "arch", "compiler", "build_type" + package_type = "library" + + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_examples": [True, False], + "with_cuda": [True, False], + "with_curl": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_examples": False, + "with_cuda": False, + "with_curl": False, + } + + @property + def _min_cppstd(self): + return "11" + + @property + def _compilers_minimum_version(self): + return { + "gcc": "8" + } + + def export_sources(self): + export_conandata_patches(self) + copy(self, "cmake/*", dst=self.export_sources_folder, src=self.recipe_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") + + 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.get_safe("compiler.version")) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires {str(self.settings.compiler)}>={minimum_version}." + ) + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + if self.options.with_curl: + self.requires("libcurl/[>=7.78 <9]") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + deps = CMakeDeps(self) + deps.generate() + + tc = CMakeToolchain(self) + tc.variables["LLAMA_STANDALONE"] = False + tc.variables["LLAMA_BUILD_TESTS"] = False + tc.variables["LLAMA_BUILD_EXAMPLES"] = self.options.get_safe("with_examples") + tc.variables["LLAMA_CURL"] = self.options.get_safe("with_curl") + tc.variables["BUILD_SHARED_LIBS"] = bool(self.options.shared) + tc.variables["GGML_CUDA"] = self.options.get_safe("with_cuda") + if hasattr(self, "settings_build") and cross_building(self): + tc.variables["LLAMA_NATIVE"] = False + 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, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + copy(self, "*", os.path.join(self.source_folder, "models"), os.path.join(self.package_folder, "res", "models")) + copy(self, "*.h*", os.path.join(self.source_folder, "common"), os.path.join(self.package_folder, "include", "common")) + copy(self, "*common*.lib", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, "*common*.dll", src=self.build_folder, dst=os.path.join(self.package_folder, "bin"), keep_path=False) + copy(self, "*common*.so", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, "*common*.dylib", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, "*common*.a", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, "*.cmake", src=os.path.join(self.export_sources_folder, "cmake"), dst=os.path.join(self.package_folder, "lib", "cmake")) + + def package_info(self): + self.cpp_info.components["common"].includedirs = [os.path.join("include", "common")] + self.cpp_info.components["common"].libs = ["common"] + self.cpp_info.components["common"].libdirs = ["lib"] + if self.version >= Version("b3240"): + self.cpp_info.components["common"].libs.append("ggml") + + self.cpp_info.components["llama"].libs = ["llama"] + self.cpp_info.components["llama"].resdirs = ["res"] + self.cpp_info.components["llama"].libdirs = ["lib"] + + if self.options.with_cuda and not self.options.shared: + self.cpp_info.builddirs.append(os.path.join("lib", "cmake")) + module_path = os.path.join("lib", "cmake", "llama-cpp-cuda-static.cmake") + self.cpp_info.set_property("cmake_build_modules", [module_path]) + + if is_apple_os(self): + self.cpp_info.components["common"].frameworks.extend(["Foundation", "Accelerate", "Metal"]) + elif self.settings.os in ("Linux", "FreeBSD"): + self.cpp_info.components["common"].system_libs.extend(["dl", "m", "pthread", "gomp"]) diff --git a/recipes/llama-cpp/all/patches/b3040-001-curl-patch-targets.patch b/recipes/llama-cpp/all/patches/b3040-001-curl-patch-targets.patch new file mode 100755 index 0000000000000..454fe46b32c1f --- /dev/null +++ b/recipes/llama-cpp/all/patches/b3040-001-curl-patch-targets.patch @@ -0,0 +1,15 @@ +diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt +index 0ec8d6d8..647ef30b 100644 +--- a/common/CMakeLists.txt ++++ b/common/CMakeLists.txt +@@ -77,9 +77,7 @@ set(LLAMA_COMMON_EXTRA_LIBS build_info) + if (LLAMA_CURL) + find_package(CURL REQUIRED) + add_definitions(-DLLAMA_USE_CURL) +- include_directories(${CURL_INCLUDE_DIRS}) +- find_library(CURL_LIBRARY curl REQUIRED) +- set(LLAMA_COMMON_EXTRA_LIBS ${LLAMA_COMMON_EXTRA_LIBS} ${CURL_LIBRARY}) ++ list(APPEND LLAMA_COMMON_EXTRA_LIBS CURL::libcurl) + endif () + + target_include_directories(${TARGET} PUBLIC .) diff --git a/recipes/llama-cpp/all/patches/b3542-001-curl-patch-targets.patch b/recipes/llama-cpp/all/patches/b3542-001-curl-patch-targets.patch new file mode 100755 index 0000000000000..dcb0f491566b5 --- /dev/null +++ b/recipes/llama-cpp/all/patches/b3542-001-curl-patch-targets.patch @@ -0,0 +1,26 @@ +diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt +index 761971d6..3afd9759 100644 +--- a/common/CMakeLists.txt ++++ b/common/CMakeLists.txt +@@ -66,7 +66,7 @@ add_library(${TARGET} STATIC + train.cpp + ngram-cache.h + ngram-cache.cpp +- ) ++) + + if (BUILD_SHARED_LIBS) + set_target_properties(${TARGET} PROPERTIES POSITION_INDEPENDENT_CODE ON) +@@ -78,10 +78,8 @@ set(LLAMA_COMMON_EXTRA_LIBS build_info) + if (LLAMA_CURL) + find_package(CURL REQUIRED) + add_definitions(-DLLAMA_USE_CURL) +- include_directories(${CURL_INCLUDE_DIRS}) +- find_library(CURL_LIBRARY curl REQUIRED) +- set(LLAMA_COMMON_EXTRA_LIBS ${LLAMA_COMMON_EXTRA_LIBS} ${CURL_LIBRARY}) +-endif () ++ list(APPEND LLAMA_COMMON_EXTRA_LIBS CURL::libcurl) ++endif() + + target_include_directories(${TARGET} PUBLIC .) + target_compile_features (${TARGET} PUBLIC cxx_std_11) diff --git a/recipes/llama-cpp/all/test_package/CMakeLists.txt b/recipes/llama-cpp/all/test_package/CMakeLists.txt new file mode 100755 index 0000000000000..fa2157e90aaa3 --- /dev/null +++ b/recipes/llama-cpp/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.15) + +project(test_package CXX) + +find_package(llama-cpp REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE llama-cpp::llama llama-cpp::common) +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) diff --git a/recipes/llama-cpp/all/test_package/conanfile.py b/recipes/llama-cpp/all/test_package/conanfile.py new file mode 100644 index 0000000000000..6cd089d783d39 --- /dev/null +++ b/recipes/llama-cpp/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 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/llama-cpp/all/test_package/test_package.cpp b/recipes/llama-cpp/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..1201d51a3f7ee --- /dev/null +++ b/recipes/llama-cpp/all/test_package/test_package.cpp @@ -0,0 +1,8 @@ +#include "llama.h" +#include +int main() { + llama_model_params params = llama_model_default_params(); + std::cout << "Main GPU: " << params.main_gpu << std::endl; + + return 0; +} diff --git a/recipes/llama-cpp/config.yml b/recipes/llama-cpp/config.yml new file mode 100644 index 0000000000000..80c3c72b8c4f3 --- /dev/null +++ b/recipes/llama-cpp/config.yml @@ -0,0 +1,5 @@ +versions: + "b3542": + folder: "all" + "b3040": + folder: "all" diff --git a/recipes/llhttp/all/CMakeLists.txt b/recipes/llhttp/all/CMakeLists.txt deleted file mode 100644 index 881b1cb39250b..0000000000000 --- a/recipes/llhttp/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/llhttp/all/conandata.yml b/recipes/llhttp/all/conandata.yml index c2671d44c5a50..20fe56b5f368c 100644 --- a/recipes/llhttp/all/conandata.yml +++ b/recipes/llhttp/all/conandata.yml @@ -1,8 +1,17 @@ sources: + "9.1.3": + url: https://github.com/nodejs/llhttp/archive/refs/tags/release/v9.1.3.tar.gz + sha256: "49405a7bcb4312b29b91408ee1395de3bc3b29e3bdd10380dc4eb8210912f295" + "8.1.0": + url: https://github.com/nodejs/llhttp/archive/refs/tags/release/v8.1.0.tar.gz + sha256: "9da0d23453e8e242cf3b2bc5d6fb70b1517b8a70520065fcbad6be787e86638e" "6.0.6": url: https://github.com/nodejs/llhttp/archive/refs/tags/release/v6.0.6.tar.gz sha256: "14023d0efce07a996a197d3b6b15020b26526605277e521f5aa10dacc3af67ad" patches: + "9.1.3": + - patch_file: "patches/v9.1.3-cmake_remove_pcfiles.patch" + "8.1.0": + - patch_file: "patches/cmake_remove_pcfiles.patch" "6.0.6": - patch_file: "patches/cmake_install_dirs.patch" - base_path: "source_subfolder" diff --git a/recipes/llhttp/all/conanfile.py b/recipes/llhttp/all/conanfile.py index df6177221446b..8b1f11d122f18 100644 --- a/recipes/llhttp/all/conanfile.py +++ b/recipes/llhttp/all/conanfile.py @@ -1,19 +1,20 @@ -from conans import ConanFile, tools, CMake -from conan.tools.files import patch +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.43.0" +required_conan_version = ">=1.53.0" class LlhttpParserConan(ConanFile): name = "llhttp" - description = "http request/response parser for c " + description = "http request/response parser for c" topics = ("http", "parser") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/nodejs/llhttp" - license = ("MIT",) - generators = ("cmake",) - settings = "os", "compiler", "build_type", "arch" + license = "MIT" + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -22,17 +23,9 @@ class LlhttpParserConan(ConanFile): "shared": False, "fPIC": True, } - exports_sources = "CMakeLists.txt", "patches/*" - _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": @@ -40,48 +33,37 @@ 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 _configure_cmake(self): - if self._cmake: - return self._cmake - - self._cmake = CMake(self) - self._cmake.configure() - return self._cmake + 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) + apply_conandata_patches(self) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + if not self.options.shared: + tc.variables["BUILD_STATIC_LIBS"] = True + 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-MIT", - src=os.path.join(self.source_folder, self._source_subfolder), - dst="licenses", - ) - cmake = self._configure_cmake() + copy(self, "LICENSE-MIT", 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", "llhttp") self.cpp_info.set_property("cmake_target_name", "llhttp::llhttp") self.cpp_info.set_property("pkg_config_name", "libllhttp") self.cpp_info.libs = ["llhttp"] - - # TODO: to remove in conan v2 once cmake_find_package_* generators removed - self.cpp_info.names["cmake_find_package"] = "llhttp" - self.cpp_info.names["cmake_find_package_multi"] = "llhttp" - self.cpp_info.names["pkg_config"] = "libllhttp" diff --git a/recipes/llhttp/all/patches/cmake_remove_pcfiles.patch b/recipes/llhttp/all/patches/cmake_remove_pcfiles.patch new file mode 100644 index 0000000000000..f6cab456c7e6f --- /dev/null +++ b/recipes/llhttp/all/patches/cmake_remove_pcfiles.patch @@ -0,0 +1,18 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt.new +@@ -62,14 +62,10 @@ + EXPORT llhttp + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + ) + +- install(FILES +- ${CMAKE_CURRENT_SOURCE_DIR}/libllhttp.pc +- DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig +- ) +- + # This is required to work with FetchContent + install(EXPORT llhttp + FILE llhttp-config.cmake diff --git a/recipes/llhttp/all/patches/v9.1.3-cmake_remove_pcfiles.patch b/recipes/llhttp/all/patches/v9.1.3-cmake_remove_pcfiles.patch new file mode 100644 index 0000000000000..7d7c1649ff686 --- /dev/null +++ b/recipes/llhttp/all/patches/v9.1.3-cmake_remove_pcfiles.patch @@ -0,0 +1,18 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -63,14 +63,10 @@ + EXPORT llhttp + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + ) + +- install(FILES +- ${CMAKE_CURRENT_SOURCE_DIR}/libllhttp.pc +- DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig +- ) +- + # This is required to work with FetchContent + install(EXPORT llhttp + FILE llhttp-config.cmake diff --git a/recipes/llhttp/all/test_package/CMakeLists.txt b/recipes/llhttp/all/test_package/CMakeLists.txt index e55d928fc7b95..100d91bba1f4c 100644 --- a/recipes/llhttp/all/test_package/CMakeLists.txt +++ b/recipes/llhttp/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) +project(test_package LANGUAGES C) find_package(llhttp REQUIRED CONFIG) - add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} llhttp::llhttp) +target_link_libraries(${PROJECT_NAME} PRIVATE llhttp::llhttp) diff --git a/recipes/llhttp/all/test_package/conanfile.py b/recipes/llhttp/all/test_package/conanfile.py index 49a3a66ea5bad..0a6bc68712d90 100644 --- a/recipes/llhttp/all/test_package/conanfile.py +++ b/recipes/llhttp/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/llhttp/all/test_v1_package/CMakeLists.txt b/recipes/llhttp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/llhttp/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/llhttp/all/test_v1_package/conanfile.py b/recipes/llhttp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/llhttp/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/llhttp/config.yml b/recipes/llhttp/config.yml index 158212133c56d..bd0d914a57968 100644 --- a/recipes/llhttp/config.yml +++ b/recipes/llhttp/config.yml @@ -1,3 +1,7 @@ versions: + "9.1.3": + folder: all + "8.1.0": + folder: all "6.0.6": folder: all diff --git a/recipes/llnl-units/all/conandata.yml b/recipes/llnl-units/all/conandata.yml new file mode 100644 index 0000000000000..61314f6985693 --- /dev/null +++ b/recipes/llnl-units/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.9.1": + url: "https://github.com/LLNL/units/archive/refs/tags/v0.9.1.tar.gz" + sha256: "7edb83613a07cf55873f22d61c0062e46db6f8cb27d137866858811ec2e1ad4f" diff --git a/recipes/llnl-units/all/conanfile.py b/recipes/llnl-units/all/conanfile.py new file mode 100644 index 0000000000000..62478d1b6985f --- /dev/null +++ b/recipes/llnl-units/all/conanfile.py @@ -0,0 +1,103 @@ +import os + +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain +from conan.tools.files import copy, rm, rmdir, get + + +class UnitsConan(ConanFile): + name = "llnl-units" + license = "BSD-3-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://units.readthedocs.io" + description = ( + "A run-time C++ library for working with units " + "of measurement and conversions between them " + "and with string representations of units " + "and measurements" + ) + topics = ( + "units", + "dimensions", + "quantities", + "physical-units", + "dimensional-analysis", + "run-time", + ) + settings = "os", "compiler", "build_type", "arch" + package_type = "library" + 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 { + "apple-clang": "10", + "clang": "7", + "gcc": "7", + "msvc": "191", + "Visual Studio": "15", + } + + 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 source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.preprocessor_definitions["UNITS_CMAKE_PROJECT_NAME"] = "LLNL-UNITS" + tc.preprocessor_definitions["UNITS_ENABLE_TESTS"] = "OFF" + tc.preprocessor_definitions["UNITS_BUILD_SHARED_LIBRARY"] = self.options.shared + tc.preprocessor_definitions[ + "UNITS_BUILD_STATIC_LIBRARY" + ] = not self.options.shared + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy( + self, + "LICENSE", + self.source_folder, + os.path.join(self.package_folder, "licenses"), + ) + 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 = ["units"] + namespace = self.conf.get("user.llnl-units:namespace", check_type=str) + base_type = self.conf.get("user.llnl-units:base_type", check_type=str, default="uint32_t") + self.cpp_info.defines = [f"UNITS_BASE_TYPE={base_type}"] + if namespace: + self.cpp_info.defines.append(f"UNITS_NAMESPACE={units_namespace}") + + self.cpp_info.set_property("cmake_file_name", "units") + self.cpp_info.set_property("cmake_target_name", "units::units") diff --git a/recipes/llnl-units/all/test_package/CMakeLists.txt b/recipes/llnl-units/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..32484e5b71ec5 --- /dev/null +++ b/recipes/llnl-units/all/test_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.15) + +project(test_package LANGUAGES CXX) + +find_package(units REQUIRED CONFIG) + +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/llnl-units/all/test_package/conanfile.py b/recipes/llnl-units/all/test_package/conanfile.py new file mode 100644 index 0000000000000..02eb5ce439fb4 --- /dev/null +++ b/recipes/llnl-units/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/llnl-units/all/test_package/test_package.cpp b/recipes/llnl-units/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..875f7bb1c1123 --- /dev/null +++ b/recipes/llnl-units/all/test_package/test_package.cpp @@ -0,0 +1,20 @@ +#include +#include +#include "units/units.hpp" +using namespace units; + +int main(void) { + auto new_unit=m/s; + auto another=new_unit*s; + bool test = another == m; + std::cout << test << std::endl; + + measurement length1=45.0*m; + measurement length2=20.0*m; + measurement result=900.0*m*m; + measurement area=length1*length2; + bool test2 = area == result; + std::cout << test2 << std::endl; + + return EXIT_SUCCESS; +} diff --git a/recipes/llnl-units/config.yml b/recipes/llnl-units/config.yml new file mode 100644 index 0000000000000..6895ae8f05494 --- /dev/null +++ b/recipes/llnl-units/config.yml @@ -0,0 +1,3 @@ +versions: + "0.9.1": + folder: all diff --git a/recipes/llvm-core/all/CMakeLists.txt b/recipes/llvm-core/all/CMakeLists.txt deleted file mode 100644 index e88dcfa953495..0000000000000 --- a/recipes/llvm-core/all/CMakeLists.txt +++ /dev/null @@ -1,26 +0,0 @@ -cmake_minimum_required(VERSION 3.13.4) -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/conandata.yml b/recipes/llvm-core/all/conandata.yml index 331f5f3a1903f..763714460b800 100644 --- a/recipes/llvm-core/all/conandata.yml +++ b/recipes/llvm-core/all/conandata.yml @@ -10,18 +10,60 @@ sources: sha256: ce8508e318a01a63d4e8b3090ab2ded3c598a50258cc49e2625b9120d4c03ea5 patches: - "11.1.0": - - base_path: "source" - patch_file: "patches/11x/11.1.0-cmake.patch" - - base_path: "source" - patch_file: "patches/11x/11.1.0-native.patch" - "12.0.0": - - base_path: "source" - patch_file: "patches/12x/12.0.0-cmake.patch" - - base_path: "source" - patch_file: "patches/12x/12.0.0-native.patch" "13.0.0": - - base_path: "source" - patch_file: "patches/13x/13.0.0-cmake.patch" - - base_path: "source" - patch_file: "patches/13x/13.0.0-native.patch" + - patch_file: patches/13x/0000-cmake-dependencies.patch + patch_description: fix references to third party libs to match conan variables and targets + patch_type: conan + - patch_file: patches/13x/0001-calculate-job-pools.patch + patch_description: calculate resource limits for compiling LLVM + patch_type: portability + patch_source: https://github.com/llvm/llvm-project/pull/65274 + - patch_file: patches/13x/0002-missing-includes.patch + patch_description: fix missing header files + patch_type: portability + patch_source: https://github.com/llvm/llvm-project-release-prs/pull/3 + - patch_file: patches/13x/0003-no-build-with-install-rpath.patch + patch_description: do not build shared libs with install rpath + patch_type: conan + - patch_file: patches/13x/0004-remove-lto-exports.patch + patch_description: remove LTO exports causing link error with lld + patch_source: https://github.com/llvm/llvm-project-release-prs/pull/279 + patch_type: portability + "12.0.0": + - patch_file: patches/12x/0000-cmake-dependencies.patch + patch_description: fix references to third party libs to match conan variables and targets + patch_type: conan + - patch_file: patches/12x/0001-calculate-job-pools.patch + patch_description: calculate resource limits for compiling LLVM + patch_type: portability + patch_source: https://github.com/llvm/llvm-project/pull/65274 + - patch_file: patches/12x/0002-missing-includes.patch + patch_description: fix missing header files + patch_type: portability + patch_source: https://github.com/llvm/llvm-project-release-prs/pull/3 + - patch_file: patches/12x/0003-no-build-with-install-rpath.patch + patch_description: do not build shared libs with install rpath + patch_type: conan + - patch_file: patches/12x/0004-remove-lto-exports.patch + patch_description: remove LTO exports causing link error with lld + patch_source: https://github.com/llvm/llvm-project-release-prs/pull/279 + patch_type: portability + "11.1.0": + - patch_file: patches/11x/0000-cmake-dependencies.patch + patch_description: fix references to third party libs to match conan variables and targets + patch_type: conan + - patch_file: "patches/11x/0001-calculate-job-pools.patch" + patch_description: calculate resource limits for compiling LLVM + patch_type: portability + patch_source: https://github.com/llvm/llvm-project/pull/65274 + - patch_file: patches/11x/0002-missing-includes.patch + patch_description: fix missing header files + patch_type: portability + patch_source: https://github.com/llvm/llvm-project-release-prs/pull/3 + - patch_file: patches/11x/0003-no-build-with-install-rpath.patch + patch_description: do not build shared libs with install rpath + patch_type: conan + - patch_file: patches/11x/0004-remove-lto-exports.patch + patch_description: remove LTO exports causing link error with lld + patch_source: https://github.com/llvm/llvm-project-release-prs/pull/279 + patch_type: portability diff --git a/recipes/llvm-core/all/conanfile.py b/recipes/llvm-core/all/conanfile.py index 263cb7360506c..172f48102fc18 100644 --- a/recipes/llvm-core/all/conanfile.py +++ b/recipes/llvm-core/all/conanfile.py @@ -1,429 +1,477 @@ -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.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os +from conan.tools.build import check_min_cppstd, cross_building +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import ( + apply_conandata_patches, + collect_libs, + get, + rmdir, + save, + copy, + export_conandata_patches, + rm, + rename, + replace_in_file +) +from conan.tools.microsoft import is_msvc, msvc_runtime_flag from conan.tools.scm import Version -from conans import CMake -from collections import defaultdict + import json -import re -import os.path import os +from pathlib import Path +import re import textwrap -required_conan_version = ">=1.50.2" # Due to conan.tools.scm.Version + +required_conan_version = ">=1.62.0" + +# LLVM's default config is to enable all targets, but end users can significantly reduce +# build times for the package by specifying only the targets they need as a +# semi-colon delimited string in the value of the 'targets' option +LLVM_TARGETS = { + "AArch64", + "AMDGPU", + "ARM", + "AVR", + "BPF", + "Hexagon", + "Lanai", + "LoongArch", + "Mips", + "MSP430", + "NVPTX", + "PowerPC", + "RISCV", + "Sparc", + "SystemZ", + "VE", + "WebAssembly", + "X86", + "XCore" +} class LLVMCoreConan(ConanFile): - name = 'llvm-core' + name = "llvm-core" description = ( - 'A toolkit for the construction of highly optimized compilers,' - 'optimizers, and runtime environments.' + "A toolkit for the construction of highly optimized compilers," + "optimizers, and runtime environments." ) - license = 'Apache-2.0 WITH LLVM-exception' - topics = ('llvm', 'compiler') - homepage = 'https://llvm.org' - url = 'https://github.com/conan-io/conan-center-index' - - settings = ('os', 'arch', 'compiler', 'build_type') + license = "Apache-2.0 WITH LLVM-exception" + topics = ("llvm", "compiler") + homepage = "https://llvm.org" + url = "https://github.com/conan-io/conan-center-index" + settings = "os", "arch", "compiler", "build_type" options = { - 'shared': [True, False], - 'fPIC': [True, False], - 'components': 'ANY', - 'targets': 'ANY', - 'exceptions': [True, False], - 'rtti': [True, False], - 'threads': [True, False], - 'lto': ['On', 'Off', 'Full', 'Thin'], - 'static_stdlib': [True, False], - 'unwind_tables': [True, False], - 'expensive_checks': [True, False], - 'use_perf': [True, False], - 'use_sanitizer': [ - 'Address', - 'Memory', - 'MemoryWithOrigins', - 'Undefined', - 'Thread', - 'DataFlow', - 'Address;Undefined', - 'None' + "shared": [True, False], + "fPIC": [True, False], + "components": ["ANY"], + "targets": ["ANY"], + "exceptions": [True, False], + "rtti": [True, False], + "threads": [True, False], + "lto": ["On", "Off", "Full", "Thin"], + "static_stdlib": [True, False], + "unwind_tables": [True, False], + "expensive_checks": [True, False], + "use_perf": [True, False], + "use_sanitizer": [ + "Address", + "Memory", + "MemoryWithOrigins", + "Undefined", + "Thread", + "DataFlow", + "Address;Undefined", + "None" ], - 'with_ffi': [True, False], - 'with_zlib': [True, False], - 'with_xml2': [True, False], - 'use_llvm_cmake_files': [True, False], + "with_ffi": [True, False], + "with_libedit": [True, False], + "with_terminfo": [True, False], + "with_zlib": [True, False], + "with_xml2": [True, False], + "with_z3": [True, False], } default_options = { - 'shared': False, - 'fPIC': True, - 'components': 'all', - 'targets': 'all', - 'exceptions': True, - 'rtti': True, - 'threads': True, - 'lto': 'Off', - 'static_stdlib': False, - 'unwind_tables': True, - 'expensive_checks': False, - 'use_perf': False, - 'use_sanitizer': 'None', - 'with_ffi': False, - 'with_zlib': True, - 'with_xml2': True, - 'use_llvm_cmake_files': False, + "shared": False, + "fPIC": True, + "components": "all", + "targets": "all", + "exceptions": True, + "rtti": True, + "threads": True, + "lto": "Off", + "static_stdlib": False, + "unwind_tables": True, + "expensive_checks": False, + "use_perf": False, + "use_sanitizer": "None", + "with_libedit": True, + "with_ffi": False, + "with_terminfo": False, # differs from LLVM default + "with_xml2": True, + "with_z3": True, + "with_zlib": True, } - # Older cmake versions may have issues generating the graphviz output used - # to model the components - build_requires = [ - 'cmake/3.20.5' - ] - - generators = 'cmake', 'cmake_find_package' - no_copy_source = True - short_paths = True - @property - def _source_subfolder(self): - return 'source' - - def _supports_compiler(self): - compiler = self.settings.compiler.value - 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], - [compiler == 'gcc', major_rev < 5], - [compiler == 'clang', major_rev < 4], - [compiler == 'apple-clang', major_rev < 9], - [compiler == 'Visual Studio', major_rev < 15] - ] - if any(all(combination) for combination in unsupported_combinations): - message = 'unsupported compiler: "{}", version "{}"' - raise ConanInvalidConfiguration(message.format(compiler, version)) - - def _patch_sources(self): - apply_conandata_patches(self) - - def _patch_build(self): - if os.path.exists('FindIconv.cmake'): - replace_in_file(self, 'FindIconv.cmake', 'iconv charset', 'iconv') + def _min_cppstd(self): + return 14 - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions['BUILD_SHARED_LIBS'] = False - cmake.definitions['CMAKE_SKIP_RPATH'] = True - cmake.definitions['CMAKE_POSITION_INDEPENDENT_CODE'] = \ - self.options.get_safe('fPIC', default=False) or self.options.shared - - if not self.options.shared: - cmake.definitions['DISABLE_LLVM_LINK_LLVM_DYLIB'] = True - # cmake.definitions['LLVM_LINK_DYLIB'] = self.options.shared - - cmake.definitions['LLVM_TARGET_ARCH'] = 'host' - cmake.definitions['LLVM_TARGETS_TO_BUILD'] = self.options.targets - cmake.definitions['LLVM_BUILD_LLVM_DYLIB'] = self.options.shared - cmake.definitions['LLVM_DYLIB_COMPONENTS'] = self.options.components - cmake.definitions['LLVM_ENABLE_PIC'] = \ - self.options.get_safe('fPIC', default=False) - - if self.settings.compiler == 'Visual Studio': - build_type = str(self.settings.build_type).upper() - cmake.definitions['LLVM_USE_CRT_{}'.format(build_type)] = \ - self.settings.compiler.runtime - - cmake.definitions['LLVM_ABI_BREAKING_CHECKS'] = 'WITH_ASSERTS' - cmake.definitions['LLVM_ENABLE_WARNINGS'] = True - cmake.definitions['LLVM_ENABLE_PEDANTIC'] = True - cmake.definitions['LLVM_ENABLE_WERROR'] = False - - cmake.definitions['LLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN'] = True - cmake.definitions['LLVM_USE_RELATIVE_PATHS_IN_DEBUG_INFO'] = False - cmake.definitions['LLVM_BUILD_INSTRUMENTED_COVERAGE'] = False - cmake.definitions['LLVM_OPTIMIZED_TABLEGEN'] = True - cmake.definitions['LLVM_REVERSE_ITERATION'] = False - cmake.definitions['LLVM_ENABLE_BINDINGS'] = False - cmake.definitions['LLVM_CCACHE_BUILD'] = False - - cmake.definitions['LLVM_INCLUDE_TOOLS'] = self.options.shared - cmake.definitions['LLVM_INCLUDE_EXAMPLES'] = False - cmake.definitions['LLVM_INCLUDE_TESTS'] = False - cmake.definitions['LLVM_INCLUDE_BENCHMARKS'] = False - cmake.definitions['LLVM_APPEND_VC_REV'] = False - cmake.definitions['LLVM_BUILD_DOCS'] = False - cmake.definitions['LLVM_ENABLE_IDE'] = False - cmake.definitions['LLVM_ENABLE_TERMINFO'] = False - - cmake.definitions['LLVM_ENABLE_EH'] = self.options.exceptions - cmake.definitions['LLVM_ENABLE_RTTI'] = self.options.rtti - cmake.definitions['LLVM_ENABLE_THREADS'] = self.options.threads - cmake.definitions['LLVM_ENABLE_LTO'] = self.options.lto - cmake.definitions['LLVM_STATIC_LINK_CXX_STDLIB'] = \ - self.options.static_stdlib - cmake.definitions['LLVM_ENABLE_UNWIND_TABLES'] = \ - self.options.unwind_tables - cmake.definitions['LLVM_ENABLE_EXPENSIVE_CHECKS'] = \ - self.options.expensive_checks - cmake.definitions['LLVM_ENABLE_ASSERTIONS'] = \ - self.settings.build_type == 'Debug' - - cmake.definitions['LLVM_USE_NEWPM'] = False - cmake.definitions['LLVM_USE_OPROFILE'] = False - cmake.definitions['LLVM_USE_PERF'] = self.options.use_perf - if self.options.use_sanitizer == 'None': - cmake.definitions['LLVM_USE_SANITIZER'] = '' - else: - cmake.definitions['LLVM_USE_SANITIZER'] = \ - self.options.use_sanitizer - - cmake.definitions['LLVM_ENABLE_Z3_SOLVER'] = False - 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'] = "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 + @property + def _compilers_minimum_version(self): + return { + "apple-clang": "10", + "clang": "7", + "gcc": "7", + "msvc": "191", + "Visual Studio": "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': + if self.settings.os == "Windows": del self.options.fPIC - del self.options.with_xml2 + del self.options.with_libedit # not supported on windows + + 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_ffi: - self.requires('libffi/3.3') - if self.options.get_safe('with_zlib', False): - self.requires('zlib/1.2.12') - if self.options.get_safe('with_xml2', False): - self.requires('libxml2/2.9.10') - - def package_id(self): - del self.info.options.use_llvm_cmake_files + self.requires("libffi/3.4.4") + if self.options.get_safe("with_libedit"): + self.requires("editline/3.1") + if self.options.with_zlib: + self.requires("zlib/[>=1.2.11 <2]") + if self.options.with_xml2: + self.requires("libxml2/[>=2.12.5 <3]") + if self.options.with_z3: + self.requires("z3/4.13.0") + + def build_requirements(self): + self.tool_requires("ninja/[>=1.10.2 <2]") def validate(self): - if self.options.shared: # Shared builds disabled just due to the CI - message = 'Shared builds not currently supported' - raise ConanInvalidConfiguration(message) - # del self.options.fPIC - # if self.settings.os == 'Windows' and self.options.shared: - # message = 'Shared builds not supported on Windows' - # raise ConanInvalidConfiguration(message) + 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: + if self.settings.os == "Windows": + raise ConanInvalidConfiguration("Shared builds are currently not supported on Windows") + if is_apple_os(self): + # FIXME iconv contains duplicate symbols in the libiconv and libcharset libraries (both of which are + # provided by libiconv). This may be an issue with how conan packages libiconv + iconv_dep = self.dependencies.get("libiconv") + if iconv_dep and not iconv_dep.options.shared: + raise ConanInvalidConfiguration("Static iconv cannot be linked into a shared library on macos " + "due to duplicate symbols. Use libxml2/*:iconv=False.") + if self.options.exceptions and not self.options.rtti: - message = 'Cannot enable exceptions without rtti support' - raise ConanInvalidConfiguration(message) - self._supports_compiler() - if cross_building(self, skip_x64_x86=True): - raise ConanInvalidConfiguration('Cross-building not implemented') + raise ConanInvalidConfiguration("Cannot enable exceptions without rtti support") + + if cross_building(self): + # FIXME support cross compilation + # For Cross Building, LLVM builds a "native" toolchain in a subdirectory of the main build directory. + # This subdirectory would need to have the conan cmake configuration files for the build platform + # installed into it for a cross build to be successful. + # see also https://llvm.org/docs/HowToCrossCompileLLVM.html + raise ConanInvalidConfiguration("Cross compilation is not supported. Contributions are welcome!") + + def validate_build(self): + if os.getenv("CONAN_CENTER_BUILD_SERVICE") and self.settings.build_type == "Debug": + if self.settings.os == "Linux": + raise ConanInvalidConfiguration("Debug build is not supported on CCI due to resource limitations") + elif self.options.shared: + raise ConanInvalidConfiguration("Shared Debug build is not supported on CCI due to resource limitations") def source(self): - get(self, **self.conan_data["sources"][self.version], strip_root=True, - destination=self._source_subfolder) - self._patch_sources() + get(self, **self.conan_data["sources"][self.version], strip_root=True) - def build(self): - self._patch_build() - cmake = self._configure_cmake() - cmake.configure() - cmake.build() + def _apply_resource_limits(self, cmake_definitions): + if os.getenv("CONAN_CENTER_BUILD_SERVICE"): + self.output.info("Applying CCI Resource Limits") + default_ram_per_compile_job = 16384 + default_ram_per_link_job = 2048 + else: + default_ram_per_compile_job = None + default_ram_per_link_job = None - @property - def _module_subfolder(self): - return os.path.join("lib", "cmake", "llvm") + ram_per_compile_job = self.conf.get("user.llvm-core:ram_per_compile_job", default_ram_per_compile_job) + if ram_per_compile_job: + cmake_definitions["LLVM_RAM_PER_COMPILE_JOB"] = ram_per_compile_job + + ram_per_link_job = self.conf.get("user.llvm-core:ram_per_link_job", default_ram_per_link_job) + if ram_per_link_job: + cmake_definitions["LLVM_RAM_PER_LINK_JOB"] = ram_per_link_job @property - def _alias_module_file_rel_path(self): - return os.path.join(self._module_subfolder, "conan-official-{}-targets.cmake".format(self.name)) + def _targets_to_build(self): + return self.options.targets if self.options.targets != "all" else self._all_targets @property - def _old_alias_module_file_rel_path(self): - return os.path.join(self._module_subfolder, "conan-official-{}-old-targets.cmake".format(self.name)) - - 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) + def _all_targets(self): + targets = LLVM_TARGETS if Version(self.version) >= 14 else LLVM_TARGETS - {"LoongArch", "VE"} + return ";".join(targets) + + def generate(self): + tc = CMakeToolchain(self, generator="Ninja") + # https://releases.llvm.org/12.0.0/docs/CMake.html + # https://releases.llvm.org/13.0.0/docs/CMake.html + cmake_variables = { + # Enables LLVM to find conan libraries during try_compile + "CMAKE_TRY_COMPILE_CONFIGURATION": str(self.settings.build_type), + # LLVM has two separate concepts of a "shared library build". + # "BUILD_SHARED_LIBS" builds shared versions of all the static components + # "LLVM_BUILD_LLVM_DYLIB" builds a single shared library containing all components. + # It is likely the latter that the user expects by a "shared library" build. + "BUILD_SHARED_LIBS": False, + "LLVM_BUILD_LLVM_DYLIB": self.options.shared, + "LLVM_LINK_LLVM_DYLIB": self.options.shared, + "LLVM_DYLIB_COMPONENTS": self.options.components, + "LLVM_ABI_BREAKING_CHECKS": "WITH_ASSERTS", + "LLVM_INCLUDE_TOOLS": True, + "LLVM_INCLUDE_EXAMPLES": False, + "LLVM_INCLUDE_TESTS": False, + "LLVM_ENABLE_IDE": False, + "LLVM_ENABLE_EH": self.options.exceptions, + "LLVM_ENABLE_RTTI": self.options.rtti, + "LLVM_ENABLE_THREADS": self.options.threads, + "LLVM_ENABLE_LTO": self.options.lto, + "LLVM_STATIC_LINK_CXX_STDLIB": self.options.static_stdlib, + "LLVM_ENABLE_UNWIND_TABLES": self.options.unwind_tables, + "LLVM_ENABLE_EXPENSIVE_CHECKS": self.options.expensive_checks, + "LLVM_ENABLE_ASSERTIONS": str(self.settings.build_type), + "LLVM_USE_PERF": self.options.use_perf, + "LLVM_ENABLE_LIBEDIT": self.options.get_safe("with_libedit", False), + "LLVM_ENABLE_Z3_SOLVER": self.options.with_z3, + "LLVM_ENABLE_FFI": self.options.with_ffi, + "LLVM_ENABLE_ZLIB": "FORCE_ON" if self.options.with_zlib else False, + "LLVM_ENABLE_LIBXML2": "FORCE_ON" if self.options.with_xml2 else False, + "LLVM_ENABLE_TERMINFO": self.options.with_terminfo + } + if self.options.targets != "all": + cmake_variables["LLVM_TARGETS_TO_BUILD"] = self.options.targets - def package(self): - self.copy('LICENSE.TXT', dst='licenses', src=self._source_subfolder) - lib_path = os.path.join(self.package_folder, 'lib') + self._apply_resource_limits(cmake_variables) - cmake = self._configure_cmake() - cmake.install() + if is_msvc(self): + build_type = str(self.settings.build_type).upper() + cmake_variables[f"LLVM_USE_CRT_{build_type}"] = msvc_runtime_flag(self) if not self.options.shared: - for ext in ['.a', '.lib']: - lib = '**/lib/*LLVMTableGenGlobalISel{}'.format(ext) - self.copy(lib, dst='lib', keep_path=False) - lib = '*LLVMTableGenGlobalISel{}'.format(ext) - self.copy(lib, dst='lib', src='lib') - - CMake(self).configure(args=['--graphviz=graph/llvm.dot'], source_dir='.', build_dir='.') - 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) - - dummy_targets = defaultdict(list) - for target, dep in deps: - if not target.startswith('LLVM'): - dummy_targets[target].append(dep) - - cmake_targets = { - 'libffi::libffi': 'ffi', - 'ZLIB::ZLIB': 'z', - 'Iconv::Iconv': 'iconv', - 'LibXml2::LibXml2': 'xml2' - } + cmake_variables.update({ + "DISABLE_LLVM_LINK_LLVM_DYLIB": True, + "LLVM_ENABLE_PIC": self.options.get_safe("fPIC", default=True) + }) - components = defaultdict(list) - for lib, dep in deps: - if not lib.startswith('LLVM'): - continue - elif dep.startswith('-delayload:'): + if self.options.use_sanitizer == "None": + cmake_variables["LLVM_USE_SANITIZER"] = "" + else: + cmake_variables["LLVM_USE_SANITIZER"] = self.options.use_sanitizer + + if self.settings.os == "Linux": + # Workaround for: https://github.com/conan-io/conan/issues/13560 + libdirs_host = [l for dependency in self.dependencies.host.values() for l in dependency.cpp_info.aggregated_components().libdirs] + tc.variables["CMAKE_BUILD_RPATH"] = ";".join(libdirs_host) + + tc.cache_variables.update(cmake_variables) + tc.generate() + + tc = CMakeDeps(self) + tc.generate() + + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() + cmake.build() + + @property + def _package_folder_path(self): + return Path(self.package_folder) + + def _update_component_dependencies(self, components): + def _sanitized_components(deps_list): + match_genex = re.compile(r"""\\\$""") + replacements = { + "LibXml2::LibXml2": "libxml2::libxml2", + "ZLIB::ZLIB": "zlib::zlib" + } + for dep in deps_list.split(";"): + match = match_genex.search(dep) + if match: + yield match.group(1) + else: + replacement = replacements.get(dep) + if replacement: + yield replacement + elif dep.startswith("-l"): + yield dep[2:] + else: + yield dep + + def _parse_deps(deps_list): + data = { + "requires": [], + "system_libs": [] + } + windows_system_libs = [ + "ole32", + "delayimp", + "shell32", + "advapi32", + "-delayload:shell32.dll", + "uuid", + "psapi", + "-delayload:ole32.dll" + ] + for component in _sanitized_components(deps_list): + if component in windows_system_libs: continue - elif dep.startswith('LLVM'): - components[dep] - elif dep in cmake_targets: - dep = cmake_targets[dep] - elif os.path.exists(dep): - dep = os.path.splitext(os.path.basename(dep))[0] - dep = dep.replace('lib', '') - dep = dep.replace('-l', '') - - if dep in dummy_targets.keys(): - components[lib].extend(dummy_targets[dep]) - components[lib] = list(set(components[lib])) + if component in ["rt", "m", "dl", "pthread"]: + data["system_libs"].append(component) else: - components[lib].append(dep) - - alias_targets = {} - old_alias_targets = {} - for component, _ in components.items(): - alias_targets[component] = "LLVM::{}".format(component) - old_alias_targets["llvm-core::{}".format(component[4:].replace('LLVM', '').lower())] = "LLVM::{}".format(component) - - # 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._alias_module_file_rel_path), - alias_targets - ) + data["requires"].append(component) + return data - self._create_cmake_module_alias_targets( - os.path.join(self.package_folder, self._old_alias_module_file_rel_path), - old_alias_targets - ) + # Can't use tools.files.load due to CRLF endings on Windows causing issues with Regular Expressions + cmake_exports = (self._package_folder_path / "lib" / "cmake" / "llvm" / "LLVMExports.cmake").read_text("utf-8") + match_dependencies = re.compile( + r'''^set_target_properties\((\w+).*\n?\s*INTERFACE_LINK_LIBRARIES\s+"(\S+)"''', re.MULTILINE) - rmdir(self, os.path.join(self.package_folder, 'share')) + for llvm_lib, dependencies in match_dependencies.findall(cmake_exports): + if llvm_lib in components: + components[llvm_lib].update(_parse_deps(dependencies)) - 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')) + def _llvm_build_info(self): + cmake_config = (self._package_folder_path / "lib" / "cmake" / "llvm" / "LLVMConfig.cmake").read_text("utf-8") - 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") + match_cmake_var = re.compile(r"""^set\(LLVM_AVAILABLE_LIBS (?P.*)\)$""", re.MULTILINE) + match = match_cmake_var.search(cmake_config) + if match is None: + self.output.warning("Could not find components in LLVMConfig.cmake") + return None - for mask in ["Find*.cmake", "*Config.cmake", "*-config.cmake"]: - rm(self, mask, self.package_folder, recursive=True) + components = {component: {} for component in match.groupdict()["components"].split(";")} + self._update_component_dependencies(components) - for name in os.listdir(lib_path): - fullname = os.path.join(lib_path, name) - if 'LLVM' not in name and os.path.isfile(fullname): - os.remove(fullname) + return { + "components": components, + "native_arch": re.search(r"""^set\(LLVM_NATIVE_ARCH (\S*)\)$""", cmake_config, re.MULTILINE).group(1) + } - if not self.options.shared: - if self.options.get_safe('with_zlib', False): - if not 'z' in components['LLVMSupport']: - components['LLVMSupport'].append('z') - components_path = \ - os.path.join(self.package_folder, 'lib', 'components.json') - with open(components_path, 'w') as components_file: - json.dump(components, components_file, indent=4) - else: - suffixes = ['.dylib', '.so'] - for name in os.listdir(lib_path): - if not any(suffix in name for suffix in suffixes): - os.remove(os.path.join(lib_path, name)) + @property + def _cmake_module_path(self): + return Path("lib") / "cmake" / "llvm" - def package_info(self): - self.cpp_info.set_property("cmake_file_name", "LLVM") + @property + def _build_info_file(self): + return self._package_folder_path / self._cmake_module_path / "conan_llvm_build_info.json" - if self.options.shared: - 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': - self.cpp_info.system_libs = ['m'] - return - - components_path = \ - os.path.join(self.package_folder, 'lib', 'components.json') - with open(components_path, 'r') as components_file: - components = json.load(components_file) - - dependencies = ['ffi', 'z', 'iconv', 'xml2'] - targets = { - 'ffi': 'libffi::libffi', - 'z': 'zlib::zlib', - 'xml2': 'libxml2::libxml2' - } + @property + def _build_module_file_rel_path(self): + return self._cmake_module_path / f"conan-official-{self.name}-variables.cmake" + + def _create_cmake_build_module(self, build_info, module_file): + targets_with_jit = ["X86", "PowerPC", "AArch64", "ARM", "Mips", "SystemZ"] + content = textwrap.dedent(f"""\ + set(LLVM_TOOLS_BINARY_DIR "${{CMAKE_CURRENT_LIST_DIR}}/../../../bin") + cmake_path(NORMAL_PATH LLVM_TOOLS_BINARY_DIR) + set(LLVM_PACKAGE_VERSION "{self.version}") + set(LLVM_AVAILABLE_LIBS "{';'.join(build_info['components'].keys())}") + set(LLVM_BUILD_TYPE "{self.settings.build_type}") + set(LLVM_CMAKE_DIR "${{CMAKE_CURRENT_LIST_DIR}}") + set(LLVM_ALL_TARGETS "{self._all_targets}") + set(LLVM_TARGETS_TO_BUILD "{self._targets_to_build}") + set(LLVM_TARGETS_WITH_JIT "{';'.join(targets_with_jit)}") + set(LLVM_NATIVE_ARCH "{build_info['native_arch']}") + set_property(GLOBAL PROPERTY LLVM_TARGETS_CONFIGURED On) + set_property(GLOBAL PROPERTY LLVM_COMPONENT_LIBS ${{LLVM_AVAILABLE_LIBS}}) + if (NOT TARGET intrinsics_gen) + add_custom_target(intrinsics_gen) + endif() + if (NOT TARGET omp_gen) + add_custom_target(omp_gen) + endif() + if (NOT TARGET acc_gen) + add_custom_target(acc_gen) + endif() + """) + save(self, module_file, content) - for component, deps in components.items(): - self.cpp_info.components[component].libs = [component] - self.cpp_info.components[component].requires.extend(dep for dep in deps if dep.startswith('LLVM')) + def _write_build_info(self): + build_info = self._llvm_build_info() + with open(self._build_info_file, "w", encoding="utf-8") as fp: + json.dump(build_info, fp, indent=2) - for lib, target in targets.items(): - if lib in deps: - self.cpp_info.components[component].requires.append(target) + return build_info - self.cpp_info.components[component].system_libs = [ - dep for dep in deps - if not dep.startswith('LLVM') and dep not in dependencies - ] + def _read_build_info(self) -> dict: + with open(self._build_info_file, encoding="utf-8") as fp: + return json.load(fp) - self.cpp_info.components[component].set_property("cmake_target_name", component) - self.cpp_info.components[component].builddirs.append(self._module_subfolder) - - self.cpp_info.components[component].names["cmake_find_package"] = component - self.cpp_info.components[component].names["cmake_find_package_multi"] = component - self.cpp_info.components[component].build_modules["cmake_find_package"].extend([ - self._alias_module_file_rel_path, - self._old_alias_module_file_rel_path, - ]) - self.cpp_info.components[component].build_modules["cmake_find_package_multi"].extend([ - self._alias_module_file_rel_path, - self._old_alias_module_file_rel_path, - ]) - - if self.options.use_llvm_cmake_files: - self.cpp_info.components[component].build_modules["cmake_find_package"].append( - os.path.join(self._module_subfolder, "LLVMConfigInternal.cmake") - ) - self.cpp_info.components[component].build_modules["cmake_find_package_multi"].append( - os.path.join(self._module_subfolder, "LLVMConfigInternal.cmake") - ) - - # TODO: to remove in conan v2 once cmake_find_package* generators removed - self.cpp_info.names["cmake_find_package"] = "LLVM" - self.cpp_info.names["cmake_find_package_multi"] = "LLVM" + def package(self): + copy(self, "LICENSE.TXT", self.source_folder, (self._package_folder_path / "licenses").as_posix()) + cmake = CMake(self) + cmake.install() + + build_info = self._write_build_info() + + cmake_folder = self._package_folder_path / "lib" / "cmake" / "llvm" + cmake_folder_posix = cmake_folder.as_posix() + rm(self, "LLVMConfig.cmake", cmake_folder_posix) + rm(self, "LLVMExports*", cmake_folder_posix) + rm(self, "Find*", cmake_folder_posix) + rm(self, "*.pdb", (self._package_folder_path / "lib").as_posix()) + rm(self, "*.pdb", (self._package_folder_path / "bin").as_posix()) + # need to rename this as Conan will flag it, but it's not actually a Config file and is needed by + # downstream packages + rename(self, (cmake_folder / "LLVM-Config.cmake").as_posix(), (cmake_folder / "LLVM-ConfigInternal.cmake").as_posix()) + replace_in_file(self, (cmake_folder / "AddLLVM.cmake").as_posix(), "LLVM-Config", "LLVM-ConfigInternal") + rmdir(self, (self._package_folder_path / "share").as_posix()) + if self.options.shared: + rm(self, "*.a", (self._package_folder_path / "lib").as_posix()) + + self._create_cmake_build_module( + build_info, + (self._package_folder_path / self._build_module_file_rel_path).as_posix() + ) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "LLVM") + self.cpp_info.set_property("cmake_build_modules", + [self._build_module_file_rel_path, + (self._cmake_module_path / "LLVM-ConfigInternal.cmake").as_posix()] + ) + self.cpp_info.builddirs.append(self._cmake_module_path) + + if not self.options.shared: + build_info = self._read_build_info() + components = build_info["components"] + + for component_name, data in components.items(): + self.cpp_info.components[component_name].set_property("cmake_target_name", component_name) + self.cpp_info.components[component_name].libs = [component_name] + requires = data.get("requires") + if requires is not None: + self.cpp_info.components[component_name].requires += requires + system_libs = data.get("system_libs") + if system_libs is not None: + self.cpp_info.components[component_name].system_libs += system_libs + else: + self.cpp_info.set_property("cmake_target_name", "LLVM") + self.cpp_info.libs = collect_libs(self) diff --git a/recipes/llvm-core/all/patches/11x/0000-cmake-dependencies.patch b/recipes/llvm-core/all/patches/11x/0000-cmake-dependencies.patch new file mode 100644 index 0000000000000..3da6ed6f9b317 --- /dev/null +++ b/recipes/llvm-core/all/patches/11x/0000-cmake-dependencies.patch @@ -0,0 +1,118 @@ +diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake +index 90e5d327c75..c8bcb1afb76 100644 +--- a/cmake/config-ix.cmake ++++ b/cmake/config-ix.cmake +@@ -5,6 +5,7 @@ endif() + + include(CheckIncludeFile) + include(CheckLibraryExists) ++include(CMakePushCheckState) + include(CheckSymbolExists) + include(CheckFunctionExists) + include(CheckStructHasMember) +@@ -56,13 +57,27 @@ check_include_file(sys/types.h HAVE_SYS_TYPES_H) + check_include_file(termios.h HAVE_TERMIOS_H) + check_include_file(unistd.h HAVE_UNISTD_H) + check_include_file(valgrind/valgrind.h HAVE_VALGRIND_VALGRIND_H) +-check_include_file(zlib.h HAVE_ZLIB_H) ++ ++if(LLVM_ENABLE_ZLIB) ++ find_package(ZLIB REQUIRED) ++ cmake_push_check_state() ++ list(APPEND CMAKE_REQUIRED_INCLUDES ${ZLIB_INCLUDE_DIRS}) ++ check_include_file(zlib.h HAVE_ZLIB_H) ++ cmake_pop_check_state() ++endif() ++ + check_include_file(fenv.h HAVE_FENV_H) + check_symbol_exists(FE_ALL_EXCEPT "fenv.h" HAVE_DECL_FE_ALL_EXCEPT) + check_symbol_exists(FE_INEXACT "fenv.h" HAVE_DECL_FE_INEXACT) + + check_include_file(mach/mach.h HAVE_MACH_MACH_H) +-check_include_file(histedit.h HAVE_HISTEDIT_H) ++if(LLVM_ENABLE_LIBEDIT) ++ find_package(editline REQUIRED) ++ cmake_push_check_state() ++ list(APPEND CMAKE_REQUIRED_INCLUDES ${editline_INCLUDE_DIRS}) ++ check_include_file(histedit.h HAVE_HISTEDIT_H) ++ cmake_pop_check_state() ++endif() + check_include_file(CrashReporterClient.h HAVE_CRASHREPORTERCLIENT_H) + if(APPLE) + include(CheckCSourceCompiles) +@@ -118,24 +133,21 @@ endif() + # Don't look for these libraries if we're using MSan, since uninstrumented third + # party code may call MSan interceptors like strlen, leading to false positives. + if(NOT LLVM_USE_SANITIZER MATCHES "Memory.*") +- set(HAVE_LIBZ 0) + if(LLVM_ENABLE_ZLIB) +- foreach(library z zlib_static zlib) +- string(TOUPPER ${library} library_suffix) +- check_library_exists(${library} compress2 "" HAVE_LIBZ_${library_suffix}) +- if(HAVE_LIBZ_${library_suffix}) +- set(HAVE_LIBZ 1) +- set(ZLIB_LIBRARIES "${library}") +- break() +- endif() +- endforeach() ++ cmake_push_check_state() ++ list(APPEND CMAKE_REQUIRED_INCLUDES ${ZLIB_INCLUDE_DIRS}) ++ list(APPEND CMAKE_REQUIRED_LIBRARIES ${ZLIB_LIBRARIES}) ++ check_symbol_exists(compress2 zlib.h HAVE_LIBZ) ++ cmake_pop_check_state() + endif() + +- # Don't look for these libraries on Windows. +- if (NOT PURE_WINDOWS) + # Skip libedit if using ASan as it contains memory leaks. + if (LLVM_ENABLE_LIBEDIT AND HAVE_HISTEDIT_H AND NOT LLVM_USE_SANITIZER MATCHES ".*Address.*") ++ cmake_push_check_state() ++ list(APPEND CMAKE_REQUIRED_INCLUDES ${editline_INCLUDE_DIRS}) ++ list(APPEND CMAKE_REQUIRED_LIBRARIES ${editline_LIBRARIES}) + check_library_exists(edit el_init "" HAVE_LIBEDIT) ++ cmake_pop_check_state() + else() + set(HAVE_LIBEDIT 0) + endif() +@@ -157,19 +169,11 @@ if(NOT LLVM_USE_SANITIZER MATCHES "Memory.*") + find_library(ICONV_LIBRARY_PATH NAMES iconv libiconv libiconv-2 c) + set(LLVM_LIBXML2_ENABLED 0) + set(LIBXML2_FOUND 0) +- if((LLVM_ENABLE_LIBXML2) AND ((CMAKE_SYSTEM_NAME MATCHES "Linux") AND (ICONV_LIBRARY_PATH) OR APPLE)) +- find_package(LibXml2) +- if (LIBXML2_FOUND) ++ if(LLVM_ENABLE_LIBXML2) ++ find_package(LibXml2 REQUIRED) + set(LLVM_LIBXML2_ENABLED 1) +- if ((CMAKE_OSX_SYSROOT) AND (EXISTS ${CMAKE_OSX_SYSROOT}/${LIBXML2_INCLUDE_DIR})) +- include_directories(${CMAKE_OSX_SYSROOT}/${LIBXML2_INCLUDE_DIR}) +- else() +- include_directories(${LIBXML2_INCLUDE_DIR}) +- endif() +- endif() + endif() + endif() +-endif() + + if (LLVM_ENABLE_LIBXML2 STREQUAL "FORCE_ON" AND NOT LLVM_LIBXML2_ENABLED) + message(FATAL_ERROR "Failed to congifure libxml2") +@@ -517,7 +521,7 @@ else( LLVM_ENABLE_THREADS ) + message(STATUS "Threads disabled.") + endif() + +-if (LLVM_ENABLE_ZLIB ) ++if (LLVM_ENABLE_ZLIB STREQUAL "FORCE_ON") + # Check if zlib is available in the system. + if ( NOT HAVE_ZLIB_H OR NOT HAVE_LIBZ ) + set(LLVM_ENABLE_ZLIB 0) +diff --git a/lib/LineEditor/CMakeLists.txt b/lib/LineEditor/CMakeLists.txt +index 59190379406..3952bf0144f 100644 +--- a/lib/LineEditor/CMakeLists.txt ++++ b/lib/LineEditor/CMakeLists.txt +@@ -1,5 +1,5 @@ + if(HAVE_LIBEDIT) +- set(link_libs edit) ++ set(link_libs editline::editline) + endif() + + add_llvm_component_library(LLVMLineEditor diff --git a/recipes/llvm-core/all/patches/11x/0001-calculate-job-pools.patch b/recipes/llvm-core/all/patches/11x/0001-calculate-job-pools.patch new file mode 100644 index 0000000000000..b00101aa4e526 --- /dev/null +++ b/recipes/llvm-core/all/patches/11x/0001-calculate-job-pools.patch @@ -0,0 +1,42 @@ +diff --git a/cmake/modules/HandleLLVMOptions.cmake b/cmake/modules/HandleLLVMOptions.cmake +index 5ef22eb493b..3478c7ef6eb 100644 +--- a/cmake/modules/HandleLLVMOptions.cmake ++++ b/cmake/modules/HandleLLVMOptions.cmake +@@ -27,6 +27,19 @@ string(TOUPPER "${LLVM_ENABLE_LTO}" uppercase_LLVM_ENABLE_LTO) + # The following only works with the Ninja generator in CMake >= 3.0. + set(LLVM_PARALLEL_COMPILE_JOBS "" CACHE STRING + "Define the maximum number of concurrent compilation jobs (Ninja only).") ++cmake_host_system_information(RESULT AVAILABLE_PHYSICAL_MEMORY QUERY AVAILABLE_PHYSICAL_MEMORY) ++cmake_host_system_information(RESULT NUMBER_OF_LOGICAL_CORES QUERY NUMBER_OF_LOGICAL_CORES) ++if(LLVM_RAM_PER_COMPILE_JOB) ++ math(EXPR memory_available_jobs "${AVAILABLE_PHYSICAL_MEMORY} / ${LLVM_RAM_PER_COMPILE_JOB}" OUTPUT_FORMAT DECIMAL) ++ if (memory_available_jobs LESS 1) ++ set(memory_available_jobs 1) ++ endif() ++ if (memory_available_jobs LESS NUMBER_OF_LOGICAL_CORES) ++ set(LLVM_PARALLEL_COMPILE_JOBS "${memory_available_jobs}") ++ else() ++ set(LLVM_PARALLEL_COMPILE_JOBS "${NUMBER_OF_LOGICAL_CORES}") ++ endif() ++endif() + if(LLVM_PARALLEL_COMPILE_JOBS) + if(NOT CMAKE_GENERATOR STREQUAL "Ninja") + message(WARNING "Job pooling is only available with Ninja generators.") +@@ -38,6 +51,17 @@ endif() + + set(LLVM_PARALLEL_LINK_JOBS "" CACHE STRING + "Define the maximum number of concurrent link jobs (Ninja only).") ++if(LLVM_RAM_PER_LINK_JOB) ++ math(EXPR memory_available_jobs "${AVAILABLE_PHYSICAL_MEMORY} / ${LLVM_RAM_PER_LINK_JOB}" OUTPUT_FORMAT DECIMAL) ++ if (memory_available_jobs LESS 1) ++ set(memory_available_jobs 1) ++ endif() ++ if (memory_available_jobs LESS NUMBER_OF_LOGICAL_CORES) ++ set(LLVM_PARALLEL_LINK_JOBS "${memory_available_jobs}") ++ else() ++ set(LLVM_PARALLEL_LINK_JOBS "${NUMBER_OF_LOGICAL_CORES}") ++ endif() ++endif() + if(CMAKE_GENERATOR STREQUAL "Ninja") + if(NOT LLVM_PARALLEL_LINK_JOBS AND uppercase_LLVM_ENABLE_LTO STREQUAL "THIN") + message(STATUS "ThinLTO provides its own parallel linking - limiting parallel link jobs to 2.") diff --git a/recipes/llvm-core/all/patches/11x/0002-missing-includes.patch b/recipes/llvm-core/all/patches/11x/0002-missing-includes.patch new file mode 100644 index 0000000000000..929a539e77369 --- /dev/null +++ b/recipes/llvm-core/all/patches/11x/0002-missing-includes.patch @@ -0,0 +1,24 @@ +diff --git a/include/llvm/Support/Signals.h b/include/llvm/Support/Signals.h +index e0a18e72f2a..148216b8f87 100644 +--- a/include/llvm/Support/Signals.h ++++ b/include/llvm/Support/Signals.h +@@ -14,6 +14,7 @@ + #ifndef LLVM_SUPPORT_SIGNALS_H + #define LLVM_SUPPORT_SIGNALS_H + ++#include + #include + + namespace llvm { +diff --git a/utils/benchmark/src/benchmark_register.h b/utils/benchmark/src/benchmark_register.h +index 0705e219f2f..4caa5ad4da0 100644 +--- a/utils/benchmark/src/benchmark_register.h ++++ b/utils/benchmark/src/benchmark_register.h +@@ -1,6 +1,7 @@ + #ifndef BENCHMARK_REGISTER_H + #define BENCHMARK_REGISTER_H + ++#include + #include + + #include "check.h" diff --git a/recipes/llvm-core/all/patches/11x/0003-no-build-with-install-rpath.patch b/recipes/llvm-core/all/patches/11x/0003-no-build-with-install-rpath.patch new file mode 100644 index 0000000000000..e56177aab947f --- /dev/null +++ b/recipes/llvm-core/all/patches/11x/0003-no-build-with-install-rpath.patch @@ -0,0 +1,13 @@ +diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake +index b74adc11ade9..8c70fe15d2a0 100644 +--- a/cmake/modules/AddLLVM.cmake ++++ b/cmake/modules/AddLLVM.cmake +@@ -2081,7 +2081,7 @@ function(llvm_setup_rpath name) + endif() + + set_target_properties(${name} PROPERTIES +- BUILD_WITH_INSTALL_RPATH On ++ BUILD_WITH_INSTALL_RPATH OFF + INSTALL_RPATH "${_install_rpath}" + ${_install_name_dir}) + endfunction() diff --git a/recipes/llvm-core/all/patches/11x/0004-remove-lto-exports.patch b/recipes/llvm-core/all/patches/11x/0004-remove-lto-exports.patch new file mode 100644 index 0000000000000..6dea8a2419a11 --- /dev/null +++ b/recipes/llvm-core/all/patches/11x/0004-remove-lto-exports.patch @@ -0,0 +1,32 @@ +diff --git a/tools/lto/lto.exports b/tools/lto/lto.exports +index 1f0a6b23d3fd..2871abd34e40 100644 +--- a/tools/lto/lto.exports ++++ b/tools/lto/lto.exports +@@ -43,12 +43,6 @@ lto_codegen_optimize + lto_codegen_compile_optimized + lto_codegen_set_should_internalize + lto_codegen_set_should_embed_uselists +-LLVMCreateDisasm +-LLVMCreateDisasmCPU +-LLVMDisasmDispose +-LLVMDisasmInstruction +-LLVMSetDisasmOptions +-LLVMCreateDisasmCPUFeatures + thinlto_create_codegen + thinlto_codegen_dispose + thinlto_codegen_add_module +diff --git a/tools/remarks-shlib/CMakeLists.txt b/tools/remarks-shlib/CMakeLists.txt +index e948496c603a..97bc45e110dc 100644 +--- a/tools/remarks-shlib/CMakeLists.txt ++++ b/tools/remarks-shlib/CMakeLists.txt +@@ -6,7 +6,9 @@ set(SOURCES + libremarks.cpp + ) + +-set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/Remarks.exports) ++if (NOT (BUILD_SHARED_LIBS OR LLVM_LINK_LLVM_DYLIB)) ++ set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/Remarks.exports) ++endif() + + add_llvm_library(Remarks SHARED INSTALL_WITH_TOOLCHAIN ${SOURCES}) + diff --git a/recipes/llvm-core/all/patches/11x/11.1.0-cmake.patch b/recipes/llvm-core/all/patches/11x/11.1.0-cmake.patch deleted file mode 100644 index 6f2c7682aa4e0..0000000000000 --- a/recipes/llvm-core/all/patches/11x/11.1.0-cmake.patch +++ /dev/null @@ -1,57 +0,0 @@ ---- cmake/config-ix.cmake -+++ cmake/config-ix.cmake -@@ -159,6 +159,9 @@ - set(LIBXML2_FOUND 0) - if((LLVM_ENABLE_LIBXML2) AND ((CMAKE_SYSTEM_NAME MATCHES "Linux") AND (ICONV_LIBRARY_PATH) OR APPLE)) - find_package(LibXml2) -+ set(LIBXML2_FOUND 1) -+ list(GET LibXml2_INCLUDE_DIRS -1 LIBXML2_INCLUDE_DIR) -+ set(LIBXML2_LIBRARIES ${LibXml2_LIBRARIES}) - if (LIBXML2_FOUND) - set(LLVM_LIBXML2_ENABLED 1) - if ((CMAKE_OSX_SYSROOT) AND (EXISTS ${CMAKE_OSX_SYSROOT}/${LIBXML2_INCLUDE_DIR})) -@@ -321,7 +321,7 @@ - message(FATAL_ERROR "libffi includes are not found.") - endif() - -- find_library(FFI_LIBRARY_PATH ffi PATHS ${FFI_LIBRARY_DIR}) -+ find_library(FFI_LIBRARY_PATH NAMES ffi libffi PATHS ${FFI_LIBRARY_DIR}) - if( NOT FFI_LIBRARY_PATH ) - message(FATAL_ERROR "libffi is not found.") - endif() ---- cmake/modules/TableGen.cmake -+++ cmake/modules/TableGen.cmake -@@ -138,12 +138,7 @@ - macro(add_tablegen target project) - set(${target}_OLD_LLVM_LINK_COMPONENTS ${LLVM_LINK_COMPONENTS}) - set(LLVM_LINK_COMPONENTS ${LLVM_LINK_COMPONENTS} TableGen) -- -- # CMake-3.9 doesn't let compilation units depend on their dependent libraries. -- if(NOT (CMAKE_GENERATOR STREQUAL "Ninja" AND NOT CMAKE_VERSION VERSION_LESS 3.9) AND NOT XCODE) -- # FIXME: It leaks to user, callee of add_tablegen. -- set(LLVM_ENABLE_OBJLIB ON) -- endif() -+ set(LLVM_ENABLE_OBJLIB OFF) - - add_llvm_executable(${target} DISABLE_LLVM_LINK_LLVM_DYLIB ${ARGN}) - set(LLVM_LINK_COMPONENTS ${${target}_OLD_LLVM_LINK_COMPONENTS}) ---- lib/WindowsManifest/CMakeLists.txt -+++ lib/WindowsManifest/CMakeLists.txt -@@ -8,16 +8,6 @@ - if(LIBXML2_LIBRARIES) - target_link_libraries(LLVMWindowsManifest PUBLIC ${LIBXML2_LIBRARIES}) - -- get_filename_component(xml2_library ${LIBXML2_LIBRARIES} NAME) -- if (CMAKE_STATIC_LIBRARY_PREFIX AND -- xml2_library MATCHES "^${CMAKE_STATIC_LIBRARY_PREFIX}.*${CMAKE_STATIC_LIBRARY_SUFFIX}$") -- string(REGEX REPLACE "^${CMAKE_STATIC_LIBRARY_PREFIX}" "" xml2_library ${xml2_library}) -- string(REGEX REPLACE "${CMAKE_STATIC_LIBRARY_SUFFIX}$" "" xml2_library ${xml2_library}) -- elseif (CMAKE_SHARED_LIBRARY_PREFIX AND -- xml2_library MATCHES "^${CMAKE_SHARED_LIBRARY_PREFIX}.*${CMAKE_SHARED_LIBRARY_SUFFIX}$") -- string(REGEX REPLACE "^${CMAKE_SHARED_LIBRARY_PREFIX}" "" xml2_library ${xml2_library}) -- string(REGEX REPLACE "${CMAKE_SHARED_LIBRARY_SUFFIX}$" "" xml2_library ${xml2_library}) -- endif() - set_property(TARGET LLVMWindowsManifest PROPERTY -- LLVM_SYSTEM_LIBS ${xml2_library}) -+ LLVM_SYSTEM_LIBS ${LIBXML2_LIBRARIES}) - endif() diff --git a/recipes/llvm-core/all/patches/11x/11.1.0-native.patch b/recipes/llvm-core/all/patches/11x/11.1.0-native.patch deleted file mode 100644 index c541a76820341..0000000000000 --- a/recipes/llvm-core/all/patches/11x/11.1.0-native.patch +++ /dev/null @@ -1,81 +0,0 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -942,10 +942,6 @@ - include_directories( ${LLVM_INCLUDE_DIR} ${LLVM_MAIN_INCLUDE_DIR}) - - # when crosscompiling import the executable targets from a file --if(LLVM_USE_HOST_TOOLS) -- include(CrossCompile) -- llvm_create_cross_target(LLVM NATIVE "" Release) --endif(LLVM_USE_HOST_TOOLS) - if(LLVM_TARGET_IS_CROSSCOMPILE_HOST) - # Dummy use to avoid CMake Warning: Manually-specified variables were not used - # (this is a variable that CrossCompile sets on recursive invocations) ---- cmake/modules/TableGen.cmake -+++ cmake/modules/TableGen.cmake -@@ -150,33 +150,6 @@ - set(${project}_TABLEGEN_EXE ${${project}_TABLEGEN} PARENT_SCOPE) - set(${project}_TABLEGEN_TARGET ${${project}_TABLEGEN} PARENT_SCOPE) - -- if(LLVM_USE_HOST_TOOLS) -- if( ${${project}_TABLEGEN} STREQUAL "${target}" ) -- # The NATIVE tablegen executable *must* depend on the current target one -- # otherwise the native one won't get rebuilt when the tablgen sources -- # change, and we end up with incorrect builds. -- build_native_tool(${target} ${project}_TABLEGEN_EXE DEPENDS ${target}) -- set(${project}_TABLEGEN_EXE ${${project}_TABLEGEN_EXE} PARENT_SCOPE) -- -- add_custom_target(${project}-tablegen-host DEPENDS ${${project}_TABLEGEN_EXE}) -- set(${project}_TABLEGEN_TARGET ${project}-tablegen-host PARENT_SCOPE) -- -- # Create an artificial dependency between tablegen projects, because they -- # compile the same dependencies, thus using the same build folders. -- # FIXME: A proper fix requires sequentially chaining tablegens. -- if (NOT ${project} STREQUAL LLVM AND TARGET ${project}-tablegen-host AND -- TARGET LLVM-tablegen-host) -- add_dependencies(${project}-tablegen-host LLVM-tablegen-host) -- endif() -- -- # If we're using the host tablegen, and utils were not requested, we have no -- # need to build this tablegen. -- if ( NOT LLVM_BUILD_UTILS ) -- set_target_properties(${target} PROPERTIES EXCLUDE_FROM_ALL ON) -- endif() -- endif() -- endif() -- - if ((${project} STREQUAL LLVM OR ${project} STREQUAL MLIR) AND NOT LLVM_INSTALL_TOOLCHAIN_ONLY AND LLVM_BUILD_UTILS) - set(export_to_llvmexports) - if(${target} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR ---- tools/llvm-config/CMakeLists.txt -+++ tools/llvm-config/CMakeLists.txt -@@ -77,11 +77,3 @@ - - # Add the dependency on the generation step. - add_file_dependencies(${CMAKE_CURRENT_SOURCE_DIR}/llvm-config.cpp ${BUILDVARIABLES_OBJPATH}) -- --if(CMAKE_CROSSCOMPILING AND NOT LLVM_CONFIG_PATH) -- build_native_tool(llvm-config LLVM_CONFIG_PATH) -- set(LLVM_CONFIG_PATH "${LLVM_CONFIG_PATH}" CACHE STRING "") -- -- add_custom_target(NativeLLVMConfig DEPENDS ${LLVM_CONFIG_PATH}) -- add_dependencies(llvm-config NativeLLVMConfig) --endif() ---- tools/llvm-shlib/CMakeLists.txt -+++ tools/llvm-shlib/CMakeLists.txt -@@ -155,13 +155,8 @@ - - set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/libllvm-c.exports) - if(NOT LLVM_NM) -- if(CMAKE_CROSSCOMPILING) -- build_native_tool(llvm-nm llvm_nm) -- set(llvm_nm_target "${llvm_nm}") -- else() -- set(llvm_nm $) -- set(llvm_nm_target llvm-nm) -- endif() -+ set(llvm_nm $) -+ set(llvm_nm_target llvm-nm) - else() - set(llvm_nm ${LLVM_NM}) - set(llvm_nm_target "") diff --git a/recipes/llvm-core/all/patches/12x/0000-cmake-dependencies.patch b/recipes/llvm-core/all/patches/12x/0000-cmake-dependencies.patch new file mode 100644 index 0000000000000..319d08bc1921c --- /dev/null +++ b/recipes/llvm-core/all/patches/12x/0000-cmake-dependencies.patch @@ -0,0 +1,92 @@ +diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake +index 818fafbce14..8ef381257b6 100644 +--- a/cmake/config-ix.cmake ++++ b/cmake/config-ix.cmake +@@ -63,7 +63,13 @@ check_symbol_exists(FE_ALL_EXCEPT "fenv.h" HAVE_DECL_FE_ALL_EXCEPT) + check_symbol_exists(FE_INEXACT "fenv.h" HAVE_DECL_FE_INEXACT) + + check_include_file(mach/mach.h HAVE_MACH_MACH_H) +-check_include_file(histedit.h HAVE_HISTEDIT_H) ++if (LLVM_ENABLE_LIBEDIT) ++ find_package(editline REQUIRED) ++ cmake_push_check_state() ++ list(APPEND CMAKE_REQUIRED_INCLUDES ${editline_INCLUDE_DIRS}) ++ check_include_file(histedit.h HAVE_HISTEDIT_H) ++ cmake_pop_check_state() ++endif() + check_include_file(CrashReporterClient.h HAVE_CRASHREPORTERCLIENT_H) + if(APPLE) + include(CheckCSourceCompiles) +@@ -127,7 +133,7 @@ if(LLVM_ENABLE_ZLIB) + # library on a 64-bit system which would result in a link-time failure. + cmake_push_check_state() + list(APPEND CMAKE_REQUIRED_INCLUDES ${ZLIB_INCLUDE_DIRS}) +- list(APPEND CMAKE_REQUIRED_LIBRARIES ${ZLIB_LIBRARY}) ++ list(APPEND CMAKE_REQUIRED_LIBRARIES ${ZLIB_LIBRARIES}) + check_symbol_exists(compress2 zlib.h HAVE_ZLIB) + cmake_pop_check_state() + if(LLVM_ENABLE_ZLIB STREQUAL FORCE_ON AND NOT HAVE_ZLIB) +@@ -165,7 +171,11 @@ if(NOT LLVM_USE_SANITIZER MATCHES "Memory.*") + if (NOT PURE_WINDOWS) + # Skip libedit if using ASan as it contains memory leaks. + if (LLVM_ENABLE_LIBEDIT AND HAVE_HISTEDIT_H AND NOT LLVM_USE_SANITIZER MATCHES ".*Address.*") ++ cmake_push_check_state() ++ list(APPEND CMAKE_REQUIRED_INCLUDES ${editline_INCLUDE_DIRS}) ++ list(APPEND CMAKE_REQUIRED_LIBRARIES ${editline_LIBRARIES}) + check_library_exists(edit el_init "" HAVE_LIBEDIT) ++ cmake_pop_check_state() + else() + set(HAVE_LIBEDIT 0) + endif() +diff --git a/lib/LineEditor/CMakeLists.txt b/lib/LineEditor/CMakeLists.txt +index 61328f76905..b95d073d972 100644 +--- a/lib/LineEditor/CMakeLists.txt ++++ b/lib/LineEditor/CMakeLists.txt +@@ -1,5 +1,5 @@ + if(HAVE_LIBEDIT) +- set(link_libs edit) ++ set(link_libs editline::editline) + endif() + + add_llvm_component_library(LLVMLineEditor +diff --git a/lib/Support/CMakeLists.txt b/lib/Support/CMakeLists.txt +index cdee11412eb..f32a7b7909d 100644 +--- a/lib/Support/CMakeLists.txt ++++ b/lib/Support/CMakeLists.txt +@@ -236,14 +236,7 @@ set(llvm_system_libs ${system_libs}) + # This block is only needed for llvm-config. When we deprecate llvm-config and + # move to using CMake export, this block can be removed. + if(LLVM_ENABLE_ZLIB) +- # CMAKE_BUILD_TYPE is only meaningful to single-configuration generators. +- if(CMAKE_BUILD_TYPE) +- string(TOUPPER ${CMAKE_BUILD_TYPE} build_type) +- get_property(zlib_library TARGET ZLIB::ZLIB PROPERTY LOCATION_${build_type}) +- endif() +- if(NOT zlib_library) +- get_property(zlib_library TARGET ZLIB::ZLIB PROPERTY LOCATION) +- endif() ++ set(zlib_library ${ZLIB_LIBRARIES}) + get_library_name(${zlib_library} zlib_library) + set(llvm_system_libs ${llvm_system_libs} "${zlib_library}") + endif() +diff --git a/lib/WindowsManifest/CMakeLists.txt b/lib/WindowsManifest/CMakeLists.txt +index 8134ac8c815..652062f7fb9 100644 +--- a/lib/WindowsManifest/CMakeLists.txt ++++ b/lib/WindowsManifest/CMakeLists.txt +@@ -21,14 +21,8 @@ add_llvm_component_library(LLVMWindowsManifest + # This block is only needed for llvm-config. When we deprecate llvm-config and + # move to using CMake export, this block can be removed. + if(LLVM_ENABLE_LIBXML2) +- # CMAKE_BUILD_TYPE is only meaningful to single-configuration generators. +- if(CMAKE_BUILD_TYPE) +- string(TOUPPER ${CMAKE_BUILD_TYPE} build_type) +- get_property(libxml2_library TARGET LibXml2::LibXml2 PROPERTY LOCATION_${build_type}) +- endif() +- if(NOT zlib_library) +- get_property(libxml2_library TARGET LibXml2::LibXml2 PROPERTY LOCATION) +- endif() ++ find_package(libxml2 REQUIRED CONFIG) ++ set(libxml2_library ${libxml2_LIBRARIES}) + get_library_name(${libxml2_library} libxml2_library) + set_property(TARGET LLVMWindowsManifest PROPERTY LLVM_SYSTEM_LIBS ${libxml2_library}) + endif() diff --git a/recipes/llvm-core/all/patches/12x/0001-calculate-job-pools.patch b/recipes/llvm-core/all/patches/12x/0001-calculate-job-pools.patch new file mode 100644 index 0000000000000..ab29c3a894ccd --- /dev/null +++ b/recipes/llvm-core/all/patches/12x/0001-calculate-job-pools.patch @@ -0,0 +1,42 @@ +diff --git a/cmake/modules/HandleLLVMOptions.cmake b/cmake/modules/HandleLLVMOptions.cmake +index 5d4d692a70a..5776a85b747 100644 +--- a/cmake/modules/HandleLLVMOptions.cmake ++++ b/cmake/modules/HandleLLVMOptions.cmake +@@ -27,6 +27,19 @@ string(TOUPPER "${LLVM_ENABLE_LTO}" uppercase_LLVM_ENABLE_LTO) + # The following only works with the Ninja generator in CMake >= 3.0. + set(LLVM_PARALLEL_COMPILE_JOBS "" CACHE STRING + "Define the maximum number of concurrent compilation jobs (Ninja only).") ++cmake_host_system_information(RESULT AVAILABLE_PHYSICAL_MEMORY QUERY AVAILABLE_PHYSICAL_MEMORY) ++cmake_host_system_information(RESULT NUMBER_OF_LOGICAL_CORES QUERY NUMBER_OF_LOGICAL_CORES) ++if(LLVM_RAM_PER_COMPILE_JOB) ++ math(EXPR memory_available_jobs "${AVAILABLE_PHYSICAL_MEMORY} / ${LLVM_RAM_PER_COMPILE_JOB}" OUTPUT_FORMAT DECIMAL) ++ if (memory_available_jobs LESS 1) ++ set(memory_available_jobs 1) ++ endif() ++ if (memory_available_jobs LESS NUMBER_OF_LOGICAL_CORES) ++ set(LLVM_PARALLEL_COMPILE_JOBS "${memory_available_jobs}") ++ else() ++ set(LLVM_PARALLEL_COMPILE_JOBS "${NUMBER_OF_LOGICAL_CORES}") ++ endif() ++endif() + if(LLVM_PARALLEL_COMPILE_JOBS) + if(NOT CMAKE_GENERATOR STREQUAL "Ninja") + message(WARNING "Job pooling is only available with Ninja generators.") +@@ -38,6 +51,17 @@ endif() + + set(LLVM_PARALLEL_LINK_JOBS "" CACHE STRING + "Define the maximum number of concurrent link jobs (Ninja only).") ++if(LLVM_RAM_PER_LINK_JOB) ++ math(EXPR memory_available_jobs "${AVAILABLE_PHYSICAL_MEMORY} / ${LLVM_RAM_PER_LINK_JOB}" OUTPUT_FORMAT DECIMAL) ++ if (memory_available_jobs LESS 1) ++ set(memory_available_jobs 1) ++ endif() ++ if (memory_available_jobs LESS NUMBER_OF_LOGICAL_CORES) ++ set(LLVM_PARALLEL_LINK_JOBS "${memory_available_jobs}") ++ else() ++ set(LLVM_PARALLEL_LINK_JOBS "${NUMBER_OF_LOGICAL_CORES}") ++ endif() ++endif() + if(CMAKE_GENERATOR STREQUAL "Ninja") + if(NOT LLVM_PARALLEL_LINK_JOBS AND uppercase_LLVM_ENABLE_LTO STREQUAL "THIN") + message(STATUS "ThinLTO provides its own parallel linking - limiting parallel link jobs to 2.") diff --git a/recipes/llvm-core/all/patches/12x/0002-missing-includes.patch b/recipes/llvm-core/all/patches/12x/0002-missing-includes.patch new file mode 100644 index 0000000000000..c7cfb90318b49 --- /dev/null +++ b/recipes/llvm-core/all/patches/12x/0002-missing-includes.patch @@ -0,0 +1,12 @@ +diff --git a/include/llvm/Support/Signals.h b/include/llvm/Support/Signals.h +index 44f5a750ff5..937e0572d4a 100644 +--- a/include/llvm/Support/Signals.h ++++ b/include/llvm/Support/Signals.h +@@ -14,6 +14,7 @@ + #ifndef LLVM_SUPPORT_SIGNALS_H + #define LLVM_SUPPORT_SIGNALS_H + ++#include + #include + + namespace llvm { diff --git a/recipes/llvm-core/all/patches/12x/0003-no-build-with-install-rpath.patch b/recipes/llvm-core/all/patches/12x/0003-no-build-with-install-rpath.patch new file mode 100644 index 0000000000000..df143f02d6491 --- /dev/null +++ b/recipes/llvm-core/all/patches/12x/0003-no-build-with-install-rpath.patch @@ -0,0 +1,13 @@ +diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake +index 97c9980c7de3..23fead47c2d7 100644 +--- a/cmake/modules/AddLLVM.cmake ++++ b/cmake/modules/AddLLVM.cmake +@@ -2118,7 +2118,7 @@ function(llvm_setup_rpath name) + + # Enable BUILD_WITH_INSTALL_RPATH unless CMAKE_BUILD_RPATH is set. + if("${CMAKE_BUILD_RPATH}" STREQUAL "") +- set_property(TARGET ${name} PROPERTY BUILD_WITH_INSTALL_RPATH ON) ++ set_property(TARGET ${name} PROPERTY BUILD_WITH_INSTALL_RPATH OFF) + endif() + + set_target_properties(${name} PROPERTIES diff --git a/recipes/llvm-core/all/patches/12x/0004-remove-lto-exports.patch b/recipes/llvm-core/all/patches/12x/0004-remove-lto-exports.patch new file mode 100644 index 0000000000000..60db5a636b646 --- /dev/null +++ b/recipes/llvm-core/all/patches/12x/0004-remove-lto-exports.patch @@ -0,0 +1,32 @@ +diff --git a/tools/lto/lto.exports b/tools/lto/lto.exports +index 1f0a6b23d3fd..2871abd34e40 100644 +--- a/tools/lto/lto.exports ++++ b/tools/lto/lto.exports +@@ -43,12 +43,6 @@ lto_codegen_optimize + lto_codegen_compile_optimized + lto_codegen_set_should_internalize + lto_codegen_set_should_embed_uselists +-LLVMCreateDisasm +-LLVMCreateDisasmCPU +-LLVMDisasmDispose +-LLVMDisasmInstruction +-LLVMSetDisasmOptions +-LLVMCreateDisasmCPUFeatures + thinlto_create_codegen + thinlto_codegen_dispose + thinlto_codegen_add_module +diff --git a/tools/remarks-shlib/CMakeLists.txt b/tools/remarks-shlib/CMakeLists.txt +index 865436247270..aa11669d9a75 100644 +--- a/tools/remarks-shlib/CMakeLists.txt ++++ b/tools/remarks-shlib/CMakeLists.txt +@@ -9,7 +9,9 @@ if(LLVM_ENABLE_PIC) + libremarks.cpp + ) + +- set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/Remarks.exports) ++ if (NOT (BUILD_SHARED_LIBS OR LLVM_LINK_LLVM_DYLIB)) ++ set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/Remarks.exports) ++ endif() + + add_llvm_library(Remarks SHARED INSTALL_WITH_TOOLCHAIN ${SOURCES}) + diff --git a/recipes/llvm-core/all/patches/12x/12.0.0-cmake.patch b/recipes/llvm-core/all/patches/12x/12.0.0-cmake.patch deleted file mode 100644 index 8d3f7dbf7cf98..0000000000000 --- a/recipes/llvm-core/all/patches/12x/12.0.0-cmake.patch +++ /dev/null @@ -1,55 +0,0 @@ ---- cmake/config-ix.cmake -+++ cmake/config-ix.cmake -@@ -143,6 +143,9 @@ - elseif(NOT LLVM_USE_SANITIZER MATCHES "Memory.*") - find_package(LibXml2) - endif() -+ set(LIBXML2_FOUND 1) -+ list(GET LibXml2_INCLUDE_DIRS -1 LIBXML2_INCLUDE_DIR) -+ set(LIBXML2_LIBRARIES ${LibXml2_LIBRARIES}) - if(LibXml2_FOUND) - # Check if libxml2 we found is usable; for example, we may have found a 32-bit - # library on a 64-bit system which would result in a link-time failure. -@@ -335,7 +335,7 @@ - message(FATAL_ERROR "libffi includes are not found.") - endif() - -- find_library(FFI_LIBRARY_PATH ffi PATHS ${FFI_LIBRARY_DIR}) -+ find_library(FFI_LIBRARY_PATH NAMES ffi libffi PATHS ${FFI_LIBRARY_DIR}) - if( NOT FFI_LIBRARY_PATH ) - message(FATAL_ERROR "libffi is not found.") - endif() ---- cmake/modules/TableGen.cmake -+++ cmake/modules/TableGen.cmake -@@ -132,12 +132,7 @@ - macro(add_tablegen target project) - set(${target}_OLD_LLVM_LINK_COMPONENTS ${LLVM_LINK_COMPONENTS}) - set(LLVM_LINK_COMPONENTS ${LLVM_LINK_COMPONENTS} TableGen) -- -- # CMake doesn't let compilation units depend on their dependent libraries on some generators. -- if(NOT CMAKE_GENERATOR STREQUAL "Ninja" AND NOT XCODE) -- # FIXME: It leaks to user, callee of add_tablegen. -- set(LLVM_ENABLE_OBJLIB ON) -- endif() -+ set(LLVM_ENABLE_OBJLIB OFF) - - add_llvm_executable(${target} DISABLE_LLVM_LINK_LLVM_DYLIB ${ARGN}) - set(LLVM_LINK_COMPONENTS ${${target}_OLD_LLVM_LINK_COMPONENTS}) ---- lib/WindowsManifest/CMakeLists.txt -+++ lib/WindowsManifest/CMakeLists.txt -@@ -21,14 +21,5 @@ - # This block is only needed for llvm-config. When we deprecate llvm-config and - # move to using CMake export, this block can be removed. - if(LLVM_ENABLE_LIBXML2) -- # CMAKE_BUILD_TYPE is only meaningful to single-configuration generators. -- if(CMAKE_BUILD_TYPE) -- string(TOUPPER ${CMAKE_BUILD_TYPE} build_type) -- get_property(libxml2_library TARGET LibXml2::LibXml2 PROPERTY LOCATION_${build_type}) -- endif() -- if(NOT zlib_library) -- get_property(libxml2_library TARGET LibXml2::LibXml2 PROPERTY LOCATION) -- endif() -- get_library_name(${libxml2_library} libxml2_library) -- set_property(TARGET LLVMWindowsManifest PROPERTY LLVM_SYSTEM_LIBS ${libxml2_library}) -+ set_property(TARGET LLVMWindowsManifest PROPERTY LLVM_SYSTEM_LIBS ${LIBXML2_LIBRARIES}) - endif() diff --git a/recipes/llvm-core/all/patches/12x/12.0.0-native.patch b/recipes/llvm-core/all/patches/12x/12.0.0-native.patch deleted file mode 100644 index f5c6d542fab8f..0000000000000 --- a/recipes/llvm-core/all/patches/12x/12.0.0-native.patch +++ /dev/null @@ -1,81 +0,0 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -891,10 +891,6 @@ - include_directories( ${LLVM_INCLUDE_DIR} ${LLVM_MAIN_INCLUDE_DIR}) - - # when crosscompiling import the executable targets from a file --if(LLVM_USE_HOST_TOOLS) -- include(CrossCompile) -- llvm_create_cross_target(LLVM NATIVE "" Release) --endif(LLVM_USE_HOST_TOOLS) - if(LLVM_TARGET_IS_CROSSCOMPILE_HOST) - # Dummy use to avoid CMake Warning: Manually-specified variables were not used - # (this is a variable that CrossCompile sets on recursive invocations) ---- cmake/modules/TableGen.cmake -+++ cmake/modules/TableGen.cmake -@@ -144,33 +144,6 @@ - set(${project}_TABLEGEN_EXE ${${project}_TABLEGEN} PARENT_SCOPE) - set(${project}_TABLEGEN_TARGET ${${project}_TABLEGEN} PARENT_SCOPE) - -- if(LLVM_USE_HOST_TOOLS) -- if( ${${project}_TABLEGEN} STREQUAL "${target}" ) -- # The NATIVE tablegen executable *must* depend on the current target one -- # otherwise the native one won't get rebuilt when the tablgen sources -- # change, and we end up with incorrect builds. -- build_native_tool(${target} ${project}_TABLEGEN_EXE DEPENDS ${target}) -- set(${project}_TABLEGEN_EXE ${${project}_TABLEGEN_EXE} PARENT_SCOPE) -- -- add_custom_target(${project}-tablegen-host DEPENDS ${${project}_TABLEGEN_EXE}) -- set(${project}_TABLEGEN_TARGET ${project}-tablegen-host PARENT_SCOPE) -- -- # Create an artificial dependency between tablegen projects, because they -- # compile the same dependencies, thus using the same build folders. -- # FIXME: A proper fix requires sequentially chaining tablegens. -- if (NOT ${project} STREQUAL LLVM AND TARGET ${project}-tablegen-host AND -- TARGET LLVM-tablegen-host) -- add_dependencies(${project}-tablegen-host LLVM-tablegen-host) -- endif() -- -- # If we're using the host tablegen, and utils were not requested, we have no -- # need to build this tablegen. -- if ( NOT LLVM_BUILD_UTILS ) -- set_target_properties(${target} PROPERTIES EXCLUDE_FROM_ALL ON) -- endif() -- endif() -- endif() -- - if ((${project} STREQUAL LLVM OR ${project} STREQUAL MLIR) AND NOT LLVM_INSTALL_TOOLCHAIN_ONLY AND LLVM_BUILD_UTILS) - set(export_to_llvmexports) - if(${target} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR ---- tools/llvm-config/CMakeLists.txt -+++ tools/llvm-config/CMakeLists.txt -@@ -75,11 +75,3 @@ - - # Add the dependency on the generation step. - add_file_dependencies(${CMAKE_CURRENT_SOURCE_DIR}/llvm-config.cpp ${BUILDVARIABLES_OBJPATH}) -- --if(CMAKE_CROSSCOMPILING AND NOT LLVM_CONFIG_PATH) -- build_native_tool(llvm-config LLVM_CONFIG_PATH) -- set(LLVM_CONFIG_PATH "${LLVM_CONFIG_PATH}" CACHE STRING "") -- -- add_custom_target(NativeLLVMConfig DEPENDS ${LLVM_CONFIG_PATH}) -- add_dependencies(llvm-config NativeLLVMConfig) --endif() ---- tools/llvm-shlib/CMakeLists.txt -+++ tools/llvm-shlib/CMakeLists.txt -@@ -155,13 +155,8 @@ - - set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/libllvm-c.exports) - if(NOT LLVM_NM) -- if(CMAKE_CROSSCOMPILING) -- build_native_tool(llvm-nm llvm_nm) -- set(llvm_nm_target "${llvm_nm}") -- else() -- set(llvm_nm $) -- set(llvm_nm_target llvm-nm) -- endif() -+ set(llvm_nm $) -+ set(llvm_nm_target llvm-nm) - else() - set(llvm_nm ${LLVM_NM}) - set(llvm_nm_target "") diff --git a/recipes/llvm-core/all/patches/13x/0000-cmake-dependencies.patch b/recipes/llvm-core/all/patches/13x/0000-cmake-dependencies.patch new file mode 100644 index 0000000000000..a49abd15efa6c --- /dev/null +++ b/recipes/llvm-core/all/patches/13x/0000-cmake-dependencies.patch @@ -0,0 +1,84 @@ +diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake +index dd0aaadb47c..790a0b27a49 100644 +--- a/cmake/config-ix.cmake ++++ b/cmake/config-ix.cmake +@@ -63,7 +63,13 @@ check_symbol_exists(FE_ALL_EXCEPT "fenv.h" HAVE_DECL_FE_ALL_EXCEPT) + check_symbol_exists(FE_INEXACT "fenv.h" HAVE_DECL_FE_INEXACT) + + check_include_file(mach/mach.h HAVE_MACH_MACH_H) +-check_include_file(histedit.h HAVE_HISTEDIT_H) ++if(LLVM_ENABLE_LIBEDIT) ++ find_package(editline REQUIRED) ++ cmake_push_check_state() ++ list(APPEND CMAKE_REQUIRED_INCLUDES ${editline_INCLUDE_DIRS}) ++ check_include_file(histedit.h HAVE_HISTEDIT_H) ++ cmake_pop_check_state() ++endif() + check_include_file(CrashReporterClient.h HAVE_CRASHREPORTERCLIENT_H) + if(APPLE) + include(CheckCSourceCompiles) +@@ -127,7 +133,7 @@ if(LLVM_ENABLE_ZLIB) + # library on a 64-bit system which would result in a link-time failure. + cmake_push_check_state() + list(APPEND CMAKE_REQUIRED_INCLUDES ${ZLIB_INCLUDE_DIRS}) +- list(APPEND CMAKE_REQUIRED_LIBRARIES ${ZLIB_LIBRARY}) ++ list(APPEND CMAKE_REQUIRED_LIBRARIES ${ZLIB_LIBRARIES}) + check_symbol_exists(compress2 zlib.h HAVE_ZLIB) + cmake_pop_check_state() + if(LLVM_ENABLE_ZLIB STREQUAL FORCE_ON AND NOT HAVE_ZLIB) +@@ -166,7 +172,11 @@ if(NOT LLVM_USE_SANITIZER MATCHES "Memory.*") + if (NOT PURE_WINDOWS) + # Skip libedit if using ASan as it contains memory leaks. + if (LLVM_ENABLE_LIBEDIT AND HAVE_HISTEDIT_H AND NOT LLVM_USE_SANITIZER MATCHES ".*Address.*") ++ cmake_push_check_state() ++ list(APPEND CMAKE_REQUIRED_INCLUDES ${editline_INCLUDE_DIRS}) ++ list(APPEND CMAKE_REQUIRED_LIBRARIES ${editline_LIBRARIES}) + check_library_exists(edit el_init "" HAVE_LIBEDIT) ++ cmake_pop_check_state() + else() + set(HAVE_LIBEDIT 0) + endif() +diff --git a/lib/LineEditor/CMakeLists.txt b/lib/LineEditor/CMakeLists.txt +index 61328f76905..b95d073d972 100644 +--- a/lib/LineEditor/CMakeLists.txt ++++ b/lib/LineEditor/CMakeLists.txt +@@ -1,5 +1,5 @@ + if(HAVE_LIBEDIT) +- set(link_libs edit) ++ set(link_libs editline::editline) + endif() + + add_llvm_component_library(LLVMLineEditor +diff --git a/lib/Support/CMakeLists.txt b/lib/Support/CMakeLists.txt +index 014b4a2caf1..486e4f39642 100644 +--- a/lib/Support/CMakeLists.txt ++++ b/lib/Support/CMakeLists.txt +@@ -267,7 +267,7 @@ if(LLVM_ENABLE_ZLIB) + # CMAKE_BUILD_TYPE is only meaningful to single-configuration generators. + if(CMAKE_BUILD_TYPE) + string(TOUPPER ${CMAKE_BUILD_TYPE} build_type) +- get_property(zlib_library TARGET ZLIB::ZLIB PROPERTY LOCATION_${build_type}) ++ set(zlib_library ${ZLIB_LIBRARIES}) + endif() + if(NOT zlib_library) + get_property(zlib_library TARGET ZLIB::ZLIB PROPERTY LOCATION) +diff --git a/lib/WindowsManifest/CMakeLists.txt b/lib/WindowsManifest/CMakeLists.txt +index 8134ac8c815..ccd772f6176 100644 +--- a/lib/WindowsManifest/CMakeLists.txt ++++ b/lib/WindowsManifest/CMakeLists.txt +@@ -21,12 +21,13 @@ add_llvm_component_library(LLVMWindowsManifest + # This block is only needed for llvm-config. When we deprecate llvm-config and + # move to using CMake export, this block can be removed. + if(LLVM_ENABLE_LIBXML2) ++ find_package(libxml2 REQUIRED CONFIG) + # CMAKE_BUILD_TYPE is only meaningful to single-configuration generators. + if(CMAKE_BUILD_TYPE) + string(TOUPPER ${CMAKE_BUILD_TYPE} build_type) +- get_property(libxml2_library TARGET LibXml2::LibXml2 PROPERTY LOCATION_${build_type}) ++ set(libxml2_library ${libxml2_LIBRARIES}) + endif() +- if(NOT zlib_library) ++ if(NOT libxml2_library) + get_property(libxml2_library TARGET LibXml2::LibXml2 PROPERTY LOCATION) + endif() + get_library_name(${libxml2_library} libxml2_library) diff --git a/recipes/llvm-core/all/patches/13x/0001-calculate-job-pools.patch b/recipes/llvm-core/all/patches/13x/0001-calculate-job-pools.patch new file mode 100644 index 0000000000000..ec100e4785349 --- /dev/null +++ b/recipes/llvm-core/all/patches/13x/0001-calculate-job-pools.patch @@ -0,0 +1,42 @@ +diff --git a/cmake/modules/HandleLLVMOptions.cmake b/cmake/modules/HandleLLVMOptions.cmake +index 0c3419390c2..eb234109e88 100644 +--- a/cmake/modules/HandleLLVMOptions.cmake ++++ b/cmake/modules/HandleLLVMOptions.cmake +@@ -33,6 +33,19 @@ string(TOUPPER "${LLVM_ENABLE_LTO}" uppercase_LLVM_ENABLE_LTO) + # The following only works with the Ninja generator in CMake >= 3.0. + set(LLVM_PARALLEL_COMPILE_JOBS "" CACHE STRING + "Define the maximum number of concurrent compilation jobs (Ninja only).") ++cmake_host_system_information(RESULT AVAILABLE_PHYSICAL_MEMORY QUERY AVAILABLE_PHYSICAL_MEMORY) ++cmake_host_system_information(RESULT NUMBER_OF_LOGICAL_CORES QUERY NUMBER_OF_LOGICAL_CORES) ++if(LLVM_RAM_PER_COMPILE_JOB) ++ math(EXPR memory_available_jobs "${AVAILABLE_PHYSICAL_MEMORY} / ${LLVM_RAM_PER_COMPILE_JOB}" OUTPUT_FORMAT DECIMAL) ++ if (memory_available_jobs LESS 1) ++ set(memory_available_jobs 1) ++ endif() ++ if (memory_available_jobs LESS NUMBER_OF_LOGICAL_CORES) ++ set(LLVM_PARALLEL_COMPILE_JOBS "${memory_available_jobs}") ++ else() ++ set(LLVM_PARALLEL_COMPILE_JOBS "${NUMBER_OF_LOGICAL_CORES}") ++ endif() ++endif() + if(LLVM_PARALLEL_COMPILE_JOBS) + if(NOT CMAKE_GENERATOR STREQUAL "Ninja") + message(WARNING "Job pooling is only available with Ninja generators.") +@@ -44,6 +57,17 @@ endif() + + set(LLVM_PARALLEL_LINK_JOBS "" CACHE STRING + "Define the maximum number of concurrent link jobs (Ninja only).") ++if(LLVM_RAM_PER_LINK_JOB) ++ math(EXPR memory_available_jobs "${AVAILABLE_PHYSICAL_MEMORY} / ${LLVM_RAM_PER_LINK_JOB}" OUTPUT_FORMAT DECIMAL) ++ if (memory_available_jobs LESS 1) ++ set(memory_available_jobs 1) ++ endif() ++ if (memory_available_jobs LESS NUMBER_OF_LOGICAL_CORES) ++ set(LLVM_PARALLEL_LINK_JOBS "${memory_available_jobs}") ++ else() ++ set(LLVM_PARALLEL_LINK_JOBS "${NUMBER_OF_LOGICAL_CORES}") ++ endif() ++endif() + if(CMAKE_GENERATOR STREQUAL "Ninja") + if(NOT LLVM_PARALLEL_LINK_JOBS AND uppercase_LLVM_ENABLE_LTO STREQUAL "THIN") + message(STATUS "ThinLTO provides its own parallel linking - limiting parallel link jobs to 2.") diff --git a/recipes/llvm-core/all/patches/13x/0002-missing-includes.patch b/recipes/llvm-core/all/patches/13x/0002-missing-includes.patch new file mode 100644 index 0000000000000..c7cfb90318b49 --- /dev/null +++ b/recipes/llvm-core/all/patches/13x/0002-missing-includes.patch @@ -0,0 +1,12 @@ +diff --git a/include/llvm/Support/Signals.h b/include/llvm/Support/Signals.h +index 44f5a750ff5..937e0572d4a 100644 +--- a/include/llvm/Support/Signals.h ++++ b/include/llvm/Support/Signals.h +@@ -14,6 +14,7 @@ + #ifndef LLVM_SUPPORT_SIGNALS_H + #define LLVM_SUPPORT_SIGNALS_H + ++#include + #include + + namespace llvm { diff --git a/recipes/llvm-core/all/patches/13x/0003-no-build-with-install-rpath.patch b/recipes/llvm-core/all/patches/13x/0003-no-build-with-install-rpath.patch new file mode 100644 index 0000000000000..05560e5a0c714 --- /dev/null +++ b/recipes/llvm-core/all/patches/13x/0003-no-build-with-install-rpath.patch @@ -0,0 +1,13 @@ +diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake +index 29e40f45fef8..bde9a02b3432 100644 +--- a/cmake/modules/AddLLVM.cmake ++++ b/cmake/modules/AddLLVM.cmake +@@ -2143,7 +2143,7 @@ function(llvm_setup_rpath name) + + # Enable BUILD_WITH_INSTALL_RPATH unless CMAKE_BUILD_RPATH is set. + if("${CMAKE_BUILD_RPATH}" STREQUAL "") +- set_property(TARGET ${name} PROPERTY BUILD_WITH_INSTALL_RPATH ON) ++ set_property(TARGET ${name} PROPERTY BUILD_WITH_INSTALL_RPATH OFF) + endif() + + set_target_properties(${name} PROPERTIES diff --git a/recipes/llvm-core/all/patches/13x/0004-remove-lto-exports.patch b/recipes/llvm-core/all/patches/13x/0004-remove-lto-exports.patch new file mode 100644 index 0000000000000..46cb2cbbecf38 --- /dev/null +++ b/recipes/llvm-core/all/patches/13x/0004-remove-lto-exports.patch @@ -0,0 +1,32 @@ +diff --git a/tools/lto/lto.exports b/tools/lto/lto.exports +index 1948bba29b67..8fdbd3522b9b 100644 +--- a/tools/lto/lto.exports ++++ b/tools/lto/lto.exports +@@ -44,12 +44,6 @@ lto_codegen_compile_optimized + lto_codegen_set_should_internalize + lto_codegen_set_should_embed_uselists + lto_set_debug_options +-LLVMCreateDisasm +-LLVMCreateDisasmCPU +-LLVMDisasmDispose +-LLVMDisasmInstruction +-LLVMSetDisasmOptions +-LLVMCreateDisasmCPUFeatures + thinlto_create_codegen + thinlto_codegen_dispose + thinlto_codegen_add_module +diff --git a/tools/remarks-shlib/CMakeLists.txt b/tools/remarks-shlib/CMakeLists.txt +index 865436247270..aa11669d9a75 100644 +--- a/tools/remarks-shlib/CMakeLists.txt ++++ b/tools/remarks-shlib/CMakeLists.txt +@@ -9,7 +9,9 @@ if(LLVM_ENABLE_PIC) + libremarks.cpp + ) + +- set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/Remarks.exports) ++ if (NOT (BUILD_SHARED_LIBS OR LLVM_LINK_LLVM_DYLIB)) ++ set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/Remarks.exports) ++ endif() + + add_llvm_library(Remarks SHARED INSTALL_WITH_TOOLCHAIN ${SOURCES}) + diff --git a/recipes/llvm-core/all/patches/13x/13.0.0-cmake.patch b/recipes/llvm-core/all/patches/13x/13.0.0-cmake.patch deleted file mode 100644 index 981f067a21505..0000000000000 --- a/recipes/llvm-core/all/patches/13x/13.0.0-cmake.patch +++ /dev/null @@ -1,54 +0,0 @@ ---- cmake/config-ix.cmake -+++ cmake/config-ix.cmake -@@ -143,6 +143,9 @@ if(LLVM_ENABLE_LIBXML2) - elseif(NOT LLVM_USE_SANITIZER MATCHES "Memory.*") - find_package(LibXml2) - endif() -+ set(LIBXML2_FOUND 1) -+ list(GET LibXml2_INCLUDE_DIRS -1 LIBXML2_INCLUDE_DIR) -+ set(LIBXML2_LIBRARIES ${LibXml2_LIBRARIES}) - if(LibXml2_FOUND) - # Check if libxml2 we found is usable; for example, we may have found a 32-bit - # library on a 64-bit system which would result in a link-time failure. -@@ -343,7 +346,7 @@ if( LLVM_ENABLE_FFI ) - message(FATAL_ERROR "libffi includes are not found.") - endif() - -- find_library(FFI_LIBRARY_PATH ffi PATHS ${FFI_LIBRARY_DIR}) -+ find_library(FFI_LIBRARY_PATH NAMES ffi libffi PATHS ${FFI_LIBRARY_DIR}) - if( NOT FFI_LIBRARY_PATH ) - message(FATAL_ERROR "libffi is not found.") - endif() ---- cmake/modules/TableGen.cmake -+++ cmake/modules/TableGen.cmake -@@ -135,11 +135,7 @@ macro(add_tablegen target project) - set(${target}_OLD_LLVM_LINK_COMPONENTS ${LLVM_LINK_COMPONENTS}) - set(LLVM_LINK_COMPONENTS ${LLVM_LINK_COMPONENTS} TableGen) - -- # CMake doesn't let compilation units depend on their dependent libraries on some generators. -- if(NOT CMAKE_GENERATOR STREQUAL "Ninja" AND NOT XCODE) -- # FIXME: It leaks to user, callee of add_tablegen. -- set(LLVM_ENABLE_OBJLIB ON) -- endif() -+ set(LLVM_ENABLE_OBJLIB OFF) - - add_llvm_executable(${target} DISABLE_LLVM_LINK_LLVM_DYLIB ${ARGN}) - set(LLVM_LINK_COMPONENTS ${${target}_OLD_LLVM_LINK_COMPONENTS}) ---- lib/WindowsManifest/CMakeLists.txt -+++ lib/WindowsManifest/CMakeLists.txt -@@ -21,14 +21,5 @@ add_llvm_component_library(LLVMWindowsManifest - # This block is only needed for llvm-config. When we deprecate llvm-config and - # move to using CMake export, this block can be removed. - if(LLVM_ENABLE_LIBXML2) -- # CMAKE_BUILD_TYPE is only meaningful to single-configuration generators. -- if(CMAKE_BUILD_TYPE) -- string(TOUPPER ${CMAKE_BUILD_TYPE} build_type) -- get_property(libxml2_library TARGET LibXml2::LibXml2 PROPERTY LOCATION_${build_type}) -- endif() -- if(NOT zlib_library) -- get_property(libxml2_library TARGET LibXml2::LibXml2 PROPERTY LOCATION) -- endif() -- get_library_name(${libxml2_library} libxml2_library) -- set_property(TARGET LLVMWindowsManifest PROPERTY LLVM_SYSTEM_LIBS ${libxml2_library}) -+ set_property(TARGET LLVMWindowsManifest PROPERTY LLVM_SYSTEM_LIBS ${LIBXML2_LIBRARIES}) - endif() diff --git a/recipes/llvm-core/all/patches/13x/13.0.0-native.patch b/recipes/llvm-core/all/patches/13x/13.0.0-native.patch deleted file mode 100644 index fa8482ce0493b..0000000000000 --- a/recipes/llvm-core/all/patches/13x/13.0.0-native.patch +++ /dev/null @@ -1,78 +0,0 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -931,10 +931,6 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) - include_directories( ${LLVM_INCLUDE_DIR} ${LLVM_MAIN_INCLUDE_DIR}) - - # when crosscompiling import the executable targets from a file --if(LLVM_USE_HOST_TOOLS) -- include(CrossCompile) -- llvm_create_cross_target(LLVM NATIVE "" Release) --endif(LLVM_USE_HOST_TOOLS) - if(LLVM_TARGET_IS_CROSSCOMPILE_HOST) - # Dummy use to avoid CMake Warning: Manually-specified variables were not used - # (this is a variable that CrossCompile sets on recursive invocations) ---- cmake/modules/TableGen.cmake -+++ cmake/modules/TableGen.cmake -@@ -147,32 +147,6 @@ macro(add_tablegen target project) - set(${project}_TABLEGEN_EXE ${${project}_TABLEGEN} PARENT_SCOPE) - set(${project}_TABLEGEN_TARGET ${${project}_TABLEGEN} PARENT_SCOPE) - -- if(LLVM_USE_HOST_TOOLS) -- if( ${${project}_TABLEGEN} STREQUAL "${target}" ) -- # The NATIVE tablegen executable *must* depend on the current target one -- # otherwise the native one won't get rebuilt when the tablgen sources -- # change, and we end up with incorrect builds. -- build_native_tool(${target} ${project}_TABLEGEN_EXE DEPENDS ${target}) -- set(${project}_TABLEGEN_EXE ${${project}_TABLEGEN_EXE} PARENT_SCOPE) -- -- add_custom_target(${project}-tablegen-host DEPENDS ${${project}_TABLEGEN_EXE}) -- set(${project}_TABLEGEN_TARGET ${project}-tablegen-host PARENT_SCOPE) -- -- # Create an artificial dependency between tablegen projects, because they -- # compile the same dependencies, thus using the same build folders. -- # FIXME: A proper fix requires sequentially chaining tablegens. -- if (NOT ${project} STREQUAL LLVM AND TARGET ${project}-tablegen-host AND -- TARGET LLVM-tablegen-host) -- add_dependencies(${project}-tablegen-host LLVM-tablegen-host) -- endif() -- -- # If we're using the host tablegen, and utils were not requested, we have no -- # need to build this tablegen. -- if ( NOT LLVM_BUILD_UTILS ) -- set_target_properties(${target} PROPERTIES EXCLUDE_FROM_ALL ON) -- endif() -- endif() -- endif() - - if ((${project} STREQUAL LLVM OR ${project} STREQUAL MLIR) AND NOT LLVM_INSTALL_TOOLCHAIN_ONLY AND LLVM_BUILD_UTILS) - set(export_to_llvmexports) ---- tools/llvm-config/CMakeLists.txt -+++ tools/llvm-config/CMakeLists.txt -@@ -75,11 +75,3 @@ endif() - - # Add the dependency on the generation step. - add_file_dependencies(${CMAKE_CURRENT_SOURCE_DIR}/llvm-config.cpp ${BUILDVARIABLES_OBJPATH}) -- --if(CMAKE_CROSSCOMPILING AND NOT LLVM_CONFIG_PATH) -- build_native_tool(llvm-config LLVM_CONFIG_PATH) -- set(LLVM_CONFIG_PATH "${LLVM_CONFIG_PATH}" CACHE STRING "") -- -- add_custom_target(NativeLLVMConfig DEPENDS ${LLVM_CONFIG_PATH}) -- add_dependencies(llvm-config NativeLLVMConfig) --endif() ---- tools/llvm-shlib/CMakeLists.txt -+++ tools/llvm-shlib/CMakeLists.txt -@@ -162,13 +162,6 @@ if(LLVM_BUILD_LLVM_C_DYLIB AND MSVC) - - set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/libllvm-c.exports) - if(NOT LLVM_NM) -- if(CMAKE_CROSSCOMPILING) -- build_native_tool(llvm-nm llvm_nm) -- set(llvm_nm_target "${llvm_nm}") -- else() -- set(llvm_nm $) -- set(llvm_nm_target llvm-nm) -- endif() - else() - set(llvm_nm ${LLVM_NM}) - set(llvm_nm_target "") diff --git a/recipes/llvm-core/all/test_package/CMakeLists.txt b/recipes/llvm-core/all/test_package/CMakeLists.txt index 726aa5975f221..4de3810296f19 100644 --- a/recipes/llvm-core/all/test_package/CMakeLists.txt +++ b/recipes/llvm-core/all/test_package/CMakeLists.txt @@ -1,20 +1,31 @@ -cmake_minimum_required(VERSION 3.13.4) -project(test_package) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - -find_package(LLVM REQUIRED) +macro(test_llvm_cmake_variable VARIABLE) + if(NOT DEFINED ${VARIABLE}) + message(FATAL_ERROR "${VARIABLE} is not defined") + endif() + message(STATUS "${VARIABLE}: ${${VARIABLE}}") +endmacro() +set(CMAKE_CXX_STANDARD 17) add_executable(${PROJECT_NAME} test_package.cpp) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) -if(TARGET LLVMInterpreter) # static libraries - target_link_libraries(${PROJECT_NAME} PRIVATE - LLVMInterpreter - LLVMIRReader - LLVMX86CodeGen - ) -else() # shared library - target_link_libraries(${PROJECT_NAME} LLVM) +if (LLVM_SHARED) + find_package(LLVM REQUIRED) + target_link_libraries(${PROJECT_NAME} PRIVATE LLVM) +else() + find_package(LLVM REQUIRED) + llvm_map_components_to_libnames(llvm_libs interpreter nativecodegen irreader) + target_link_libraries(${PROJECT_NAME} PRIVATE ${llvm_libs}) endif() + +message(STATUS "Testing LLVM Build Module Variables") +test_llvm_cmake_variable(LLVM_PACKAGE_VERSION) +test_llvm_cmake_variable(LLVM_BUILD_TYPE) +test_llvm_cmake_variable(LLVM_CMAKE_DIR) +test_llvm_cmake_variable(LLVM_TOOLS_BINARY_DIR) +test_llvm_cmake_variable(LLVM_ALL_TARGETS) +test_llvm_cmake_variable(LLVM_TARGETS_TO_BUILD) +test_llvm_cmake_variable(LLVM_TARGETS_WITH_JIT) +test_llvm_cmake_variable(LLVM_NATIVE_ARCH) diff --git a/recipes/llvm-core/all/test_package/conanfile.py b/recipes/llvm-core/all/test_package/conanfile.py index e0ca8f6b664cb..5ae2ff91c80a2 100644 --- a/recipes/llvm-core/all/test_package/conanfile.py +++ b/recipes/llvm-core/all/test_package/conanfile.py @@ -1,39 +1,43 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import cmake_layout, CMakeDeps, CMakeToolchain, CMake +from conan.tools.env import VirtualRunEnv +from conan.tools.build import can_run -import os.path +import os -class LLVMCoreTestPackageConan(ConanFile): - settings = ('os', 'arch', 'compiler', 'build_type') - generators = ('cmake', 'cmake_find_package') +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build_requirements(self): + # required for cmake_path support + self.tool_requires("cmake/[>=3.20 <4]") + + def generate(self): + deps = CMakeDeps(self) + deps.check_components_exist = True + deps.generate() + + tc = CMakeToolchain(self) + if self.dependencies[self.tested_reference_str].options.shared: + tc.variables["LLVM_SHARED"] = True + tc.generate() + + VirtualRunEnv(self).generate() def build(self): - build_system = CMake(self) - build_system.configure() - build_system.build() + cmake = CMake(self) + cmake.configure() + cmake.build() def test(self): - test_package = not tools.cross_building(self.settings) - if 'x86' not in str(self.settings.arch).lower(): - test_package = False - elif str(self.options['llvm-core'].targets) not in ['all', 'X86']: - test_package = False - elif self.options['llvm-core'].shared: - if self.options['llvm-core'].components != 'all': - requirements = ['interpreter', 'irreader', 'x86codegen'] - targets = str(self.options['llvm-core'].components) - if self.settings.os == 'Windows': - requirements.append('demangle') - if not all([target in components for target in requirements]): - test_package = False - - if test_package: - command = [ - os.path.join('bin', 'test_package'), - os.path.join(os.path.dirname(__file__), 'test_function.ll') - ] - self.run(command, run_environment=True) - - llvm_path = self.deps_cpp_info['llvm-core'].rootpath - license_path = os.path.join(llvm_path, 'licenses', 'LICENSE.TXT') - assert os.path.exists(license_path) + if can_run(self): + cmd = os.path.join(self.cpp.build.bindir, "test_package") + args = os.path.join(os.path.dirname(__file__), "test_function.ll") + self.run(f"{cmd} {args}", env="conanrun") diff --git a/recipes/llvm-openmp/all/CMakeLists.txt b/recipes/llvm-openmp/all/CMakeLists.txt deleted file mode 100644 index 61f3d3b039e2b..0000000000000 --- a/recipes/llvm-openmp/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/llvm-openmp/all/conandata.yml b/recipes/llvm-openmp/all/conandata.yml index 499e8f40e5c34..cb5f1104f3fc9 100644 --- a/recipes/llvm-openmp/all/conandata.yml +++ b/recipes/llvm-openmp/all/conandata.yml @@ -1,4 +1,38 @@ sources: + "17.0.6": + openmp: + url: "https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/openmp-17.0.6.src.tar.xz" + sha256: "74334cbb4dc8b73a768448a7561d5a3540404940b2267b1fb9813a6464b320de" + cmake: + url: "https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/cmake-17.0.6.src.tar.xz" + sha256: "807f069c54dc20cb47b21c1f6acafdd9c649f3ae015609040d6182cab01140f4" + "17.0.4": + openmp: + url: "https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.4/openmp-17.0.4.src.tar.xz" + sha256: "535cbcca075430cb2d4e54a8062cb9646938170aeb72d359f13183f2a31b701a" + cmake: + url: "https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.4/cmake-17.0.4.src.tar.xz" + sha256: "1a5cbe4a1fcda56ecdd80f42c3437060a28c97ec31de1748f6ba6aa84948fb0f" + "16.0.6": + openmp: + url: "https://github.com/llvm/llvm-project/releases/download/llvmorg-16.0.6/openmp-16.0.6.src.tar.xz" + sha256: "a2536f06373774f2829d892b72eea5f97bab20e69b26b03042d947f992eb8e38" + cmake: + url: "https://github.com/llvm/llvm-project/releases/download/llvmorg-16.0.6/cmake-16.0.6.src.tar.xz" + sha256: "39d342a4161095d2f28fb1253e4585978ac50521117da666e2b1f6f28b62f514" + "15.0.7": + openmp: + url: "https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.7/openmp-15.0.7.src.tar.xz" + sha256: "3f168d38e7a37b928dcb94b33ce947f75d81eef6fa6a4f9d16b6dc5511c07358" + cmake: + url: "https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.7/cmake-15.0.7.src.tar.xz" + sha256: "8986f29b634fdaa9862eedda78513969fe9788301c9f2d938f4c10a3e7a3e7ea" + "14.0.6": + url: "https://github.com/llvm/llvm-project/releases/download/llvmorg-14.0.6/openmp-14.0.6.src.tar.xz" + sha256: "4f731ff202add030d9d68d4c6daabd91d3aeed9812e6a5b4968815cfdff0eb1f" + "13.0.1": + url: "https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.1/openmp-13.0.1.src.tar.xz" + sha256: "6b79261371616c31fea18cd3ee1797c79ee38bcaf8417676d4fa366a24c96b4f" "12.0.1": url: "https://github.com/llvm/llvm-project/releases/download/llvmorg-12.0.1/openmp-12.0.1.src.tar.xz" sha256: "60fe79440eaa9ebf583a6ea7f81501310388c02754dbe7dc210776014d06b091" @@ -15,22 +49,46 @@ sources: url: "https://github.com/llvm/llvm-project/releases/download/llvmorg-8.0.1/openmp-8.0.1.src.tar.xz" sha256: "3e85dd3cad41117b7c89a41de72f2e6aa756ea7b4ef63bb10dcddf8561a7722c" patches: + "17.0.4": + - patch_file: "patches/17/0001-disable-build-testing.patch" + patch_description: "Disable building of tools, gdb-plugin, tests and docs" + patch_type: "conan" + "16.0.6": + - patch_file: "patches/16/0001-disable-build-testing.patch" + patch_description: "Disable building of tools, gdb-plugin, tests and docs" + patch_type: "conan" + "15.0.7": + - patch_file: "patches/15/0001-disable-build-testing.patch" + patch_description: "Disable building of tools, gdb-plugin, tests and docs" + patch_type: "conan" + "14.0.6": + - patch_file: "patches/14/0001-disable-build-testing.patch" + patch_description: "Disable building of tools, gdb-plugin, tests and docs" + patch_type: "conan" + "13.0.1": + - patch_file: "patches/13/0001-disable-build-testing.patch" + patch_description: "Disable building of tools, gdb-plugin, tests and docs" + patch_type: "conan" "12.0.1": - - patch_file: "patches/0001-disable-build-testing_12.0.1.patch" - base_path: "source_subfolder" - - patch_file: "patches/0002-disable-omp-target_12.0.1.patch" - base_path: "source_subfolder" + - patch_file: "patches/12/0001-disable-build-testing.patch" + patch_description: "Disable building of tools, gdb-plugin, tests and docs" + patch_type: "conan" "11.1.0": - - patch_file: "patches/0001-disable-build-testing_11.1.0.patch" - base_path: "source_subfolder" - - patch_file: "patches/0003-fix-armv8-build_11.1.0.patch" - base_path: "source_subfolder" + - patch_file: "patches/11/0001-disable-build-testing.patch" + patch_description: "Disable building of tools, gdb-plugin, tests and docs" + patch_type: "conan" + - patch_file: "patches/11/0002-fix-armv8-build.patch" + patch_description: "Fix build issues on armv8 architecture" + patch_type: "portability" "10.0.0": - - patch_file: "patches/0001-disable-build-testing_10.0.0.patch" - base_path: "source_subfolder" + - patch_file: "patches/10/0001-disable-build-testing.patch" + patch_description: "Disable building of tools, gdb-plugin, tests and docs" + patch_type: "conan" "9.0.1": - - patch_file: "patches/0001-disable-build-testing.patch" - base_path: "source_subfolder" + - patch_file: "patches/8/0001-disable-build-testing.patch" + patch_description: "Disable building of tools, gdb-plugin, tests and docs" + patch_type: "conan" "8.0.1": - - patch_file: "patches/0001-disable-build-testing.patch" - base_path: "source_subfolder" + - patch_file: "patches/8/0001-disable-build-testing.patch" + patch_description: "Disable building of tools, gdb-plugin, tests and docs" + patch_type: "conan" diff --git a/recipes/llvm-openmp/all/conanfile.py b/recipes/llvm-openmp/all/conanfile.py index 4f1ee354a647e..c1412f45efbaa 100644 --- a/recipes/llvm-openmp/all/conanfile.py +++ b/recipes/llvm-openmp/all/conanfile.py @@ -1,141 +1,196 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration import os -import functools import textwrap -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 check_min_cppstd +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, save, move_folder_contents, rmdir +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" class LLVMOpenMpConan(ConanFile): name = "llvm-openmp" - description = ("The OpenMP (Open Multi-Processing) specification " - "is a standard for a set of compiler directives, " - "library routines, and environment variables that " - "can be used to specify shared memory parallelism " - "in Fortran and C/C++ programs. This is the LLVM " - "implementation.") + description = ("The OpenMP (Open Multi-Processing) specification is a standard for a set of compiler directives, " + "library routines, and environment variables that can be used to specify shared memory parallelism " + "in Fortran and C/C++ programs. This is the LLVM implementation.") license = "Apache-2.0 WITH LLVM-exception" - topics = ("conan", "llvm", "openmp", "parallelism") - homepage = "https://github.com/llvm/llvm-project/tree/master/openmp" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/llvm/llvm-project/blob/main/openmp" + topics = ("llvm", "openmp", "parallelism") + + package_type = "library" settings = "os", "arch", "compiler", "build_type" - options = {"shared": [True, False], - "fPIC": [True, False]} - default_options = {"shared": False, - "fPIC": True} - generators = "cmake" + options = { + "shared": [True, False], + "fPIC": [True, False], + "build_libomptarget": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "build_libomptarget": False, + } + options_description = { + "build_libomptarget": ( + "Build the LLVM OpenMP Offloading Runtime Library (libomptarget) " + "in addition to the OpenMP Runtime Library (libomp)." + ) + } @property - def _source_subfolder(self): - return "source_subfolder" + def _compilers_minimum_version(self): + return { + "gcc": "7", + "clang": "6", + "apple-clang": "10", + } + + @property + def _version_major(self): + return Version(self.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": del self.options.fPIC - def _supports_compiler(self): - supported_compilers_by_os = \ - {"Linux": ["clang", "gcc", "intel"], - "Macos": ["apple-clang", "clang", "gcc", "intel"], - "Windows": ["intel"]} - the_compiler, the_os = self.settings.compiler.value, self.settings.os.value - return the_compiler in supported_compilers_by_os.get(the_os, []) - def configure(self): if self.options.shared: - del self.options.fPIC - if not self._supports_compiler(): - raise ConanInvalidConfiguration("llvm-openmp doesn't support compiler: {} on OS: {}.". - format(self.settings.compiler, self.settings.os)) + self.options.rm_safe("fPIC") + + def requirements(self): + if self.options.build_libomptarget and self._version_major >= 13: + self.requires(f"llvm-core/{self.version}") + + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): - if ( - tools.Version(self.version) <= "10.0.0" - and self.settings.os == "Macos" - and self.settings.arch == "armv8" - ): - raise ConanInvalidConfiguration("ARM v8 not supported") + if is_msvc(self): + raise ConanInvalidConfiguration("llvm-openmp is not compatible with MSVC") + if self.settings.compiler not in ["apple-clang", "clang", "gcc", "intel-cc"]: + raise ConanInvalidConfiguration( + f"{self.settings.compiler} is not supported by this recipe. Contributions are welcome!" + ) + if self._version_major >= 17: + if self.settings.compiler.cppstd: + check_min_cppstd(self, 17) + 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++17, which your compiler does not support.") + if is_apple_os(self) and self.settings.arch == "armv8": + if self._version_major <= 10: + raise ConanInvalidConfiguration("ARM v8 not supported") + if self._version_major != 11 and self.settings.build_type == "Debug": + # All versions except for v11 crash with a segfault for the simple test_package.cpp test + raise ConanInvalidConfiguration("Debug mode not supported for ARM v8") + + def build_requirements(self): + if self._version_major >= 17: + self.tool_requires("cmake/[>=3.20 <4]") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = "openmp-{}.src".format(self.version) - os.rename(extracted_dir, self._source_subfolder) + if self._version_major >= 15: + get(self, **self.conan_data["sources"][self.version]["openmp"], strip_root=True) + get(self, **self.conan_data["sources"][self.version]["cmake"], strip_root=True, destination=self.export_sources_folder) + copy(self, "*.cmake", + src=os.path.join(self.export_sources_folder, "Modules"), + dst=os.path.join(self.source_folder, "cmake")) + elif self._version_major == 14: + # v14 source archives also includes a cmake/ directory in the archive root + get(self, **self.conan_data["sources"][self.version], destination=self.export_sources_folder) + move_folder_contents(self, os.path.join(self.export_sources_folder, f"openmp-{self.version}.src"), self.source_folder) + copy(self, "*.cmake", + src=os.path.join(self.export_sources_folder, "cmake", "Modules"), + dst=os.path.join(self.source_folder, "cmake")) + else: + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + tc = CMakeToolchain(self) + tc.variables["OPENMP_STANDALONE_BUILD"] = True + tc.variables["LIBOMP_ENABLE_SHARED"] = self.options.shared + tc.variables["OPENMP_ENABLE_LIBOMPTARGET"] = self.options.build_libomptarget + # Do not buidl OpenMP Tools Interface (OMPT) + tc.variables["LIBOMP_OMPT_SUPPORT"] = False + tc.generate() 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["OPENMP_STANDALONE_BUILD"] = True - cmake.definitions["LIBOMP_ENABLE_SHARED"] = self.options.shared - if self.settings.os == "Linux": - cmake.definitions["OPENMP_ENABLE_LIBOMPTARGET"] = self.options.shared - cmake.configure() - return cmake + apply_conandata_patches(self) + replace_in_file(self, os.path.join(self.source_folder, "runtime", "CMakeLists.txt"), + "add_subdirectory(test)", "") + if self._version_major == 12: + # v12 can be built without LLVM includes + replace_in_file(self, os.path.join(self.source_folder, "libomptarget", "CMakeLists.txt"), + "if (NOT LIBOMPTARGET_LLVM_INCLUDE_DIRS)", "if (FALSE)") def build(self): self._patch_sources() - tools.replace_in_file(os.path.join(self._source_subfolder, "runtime/CMakeLists.txt"), - "add_subdirectory(test)", "") - cmake = self._configure_cmake() + 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() + 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), { "OpenMP::OpenMP_C": "OpenMP::OpenMP", - "OpenMP::OpenMP_CXX": "OpenMP::OpenMP" - } + "OpenMP::OpenMP_CXX": "OpenMP::OpenMP", + }, ) - @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", "OpenMP") self.cpp_info.set_property("cmake_target_name", "OpenMP::OpenMP") self.cpp_info.set_property("cmake_target_aliases", ["OpenMP::OpenMP_C", "OpenMP::OpenMP_CXX"]) + if self.settings.compiler in ("clang", "apple-clang"): + self.cpp_info.cxxflags = ["-Xpreprocessor", "-fopenmp"] + elif self.settings.compiler == "gcc": + self.cpp_info.cxxflags = ["-fopenmp"] + elif self.settings.compiler == "intel-cc": + self.cpp_info.cxxflags = ["/Qopenmp"] if self.settings.os == "Windows" else ["-Qopenmp"] + self.cpp_info.cflags = self.cpp_info.cxxflags + self.cpp_info.libs = ["omp"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs = ["dl", "m", "pthread", "rt"] + # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.names["cmake_find_package"] = "OpenMP" self.cpp_info.names["cmake_find_package_multi"] = "OpenMP" - self.cpp_info.builddirs.append(os.path.join(self.package_folder, 'lib', 'cmake')) + self.cpp_info.builddirs.append(os.path.join(self.package_folder, "lib", "cmake")) 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 self.settings.compiler in ("clang", "apple-clang"): - self.cpp_info.cxxflags = ["-Xpreprocessor", "-fopenmp"] - elif self.settings.compiler == 'gcc': - self.cpp_info.cxxflags = ["-fopenmp"] - elif self.settings.compiler == 'intel': - self.cpp_info.cxxflags = ["/Qopenmp"] if self.settings.os == 'Windows' else ["-Qopenmp"] - self.cpp_info.libs = tools.collect_libs(self) - if self.settings.os == "Linux": - self.cpp_info.system_libs = ["dl", "m", "pthread", "rt"] diff --git a/recipes/llvm-openmp/all/patches/0001-disable-build-testing.patch b/recipes/llvm-openmp/all/patches/0001-disable-build-testing.patch deleted file mode 100644 index 2266bee5e1d73..0000000000000 --- a/recipes/llvm-openmp/all/patches/0001-disable-build-testing.patch +++ /dev/null @@ -1,38 +0,0 @@ -diff --git a/openmp/CMakeLists.txt b/openmp/CMakeLists.txt -index 597eedcec0b..4395761dac4 100644 ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -21,12 +21,6 @@ if (OPENMP_STANDALONE_BUILD OR "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_S - # Do not use OPENMP_LIBDIR_SUFFIX directly, use OPENMP_INSTALL_LIBDIR. - set(OPENMP_INSTALL_LIBDIR "lib${OPENMP_LIBDIR_SUFFIX}") - -- # Group test settings. -- set(OPENMP_TEST_C_COMPILER ${CMAKE_C_COMPILER} CACHE STRING -- "C compiler to use for testing OpenMP runtime libraries.") -- set(OPENMP_TEST_CXX_COMPILER ${CMAKE_CXX_COMPILER} CACHE STRING -- "C++ compiler to use for testing OpenMP runtime libraries.") -- set(OPENMP_LLVM_TOOLS_DIR "" CACHE PATH "Path to LLVM tools for testing.") - else() - set(OPENMP_ENABLE_WERROR ${LLVM_ENABLE_WERROR}) - # If building in tree, we honor the same install suffix LLVM uses. -@@ -45,14 +39,6 @@ endif() - include(config-ix) - include(HandleOpenMPOptions) - --# Set up testing infrastructure. --include(OpenMPTesting) -- --set(OPENMP_TEST_FLAGS "" CACHE STRING -- "Extra compiler flags to send to the test compiler.") --set(OPENMP_TEST_OPENMP_FLAGS ${OPENMP_TEST_COMPILER_OPENMP_FLAGS} CACHE STRING -- "OpenMP compiler flag to use for testing OpenMP runtime libraries.") -- - - # Build host runtime library. - add_subdirectory(runtime) -@@ -79,5 +65,3 @@ if (OPENMP_ENABLE_LIBOMPTARGET) - add_subdirectory(libomptarget) - endif() - --# Now that we have seen all testuites, create the check-openmp target. --construct_check_openmp_target() diff --git a/recipes/llvm-openmp/all/patches/0001-disable-build-testing_10.0.0.patch b/recipes/llvm-openmp/all/patches/0001-disable-build-testing_10.0.0.patch deleted file mode 100644 index 09c16d7b0bef6..0000000000000 --- a/recipes/llvm-openmp/all/patches/0001-disable-build-testing_10.0.0.patch +++ /dev/null @@ -1,50 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt_dum -index 9825183..4b4359b 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -21,12 +21,6 @@ if (OPENMP_STANDALONE_BUILD OR "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_S - # Do not use OPENMP_LIBDIR_SUFFIX directly, use OPENMP_INSTALL_LIBDIR. - set(OPENMP_INSTALL_LIBDIR "lib${OPENMP_LIBDIR_SUFFIX}") - -- # Group test settings. -- set(OPENMP_TEST_C_COMPILER ${CMAKE_C_COMPILER} CACHE STRING -- "C compiler to use for testing OpenMP runtime libraries.") -- set(OPENMP_TEST_CXX_COMPILER ${CMAKE_CXX_COMPILER} CACHE STRING -- "C++ compiler to use for testing OpenMP runtime libraries.") -- set(OPENMP_LLVM_TOOLS_DIR "" CACHE PATH "Path to LLVM tools for testing.") - else() - set(OPENMP_ENABLE_WERROR ${LLVM_ENABLE_WERROR}) - # If building in tree, we honor the same install suffix LLVM uses. -@@ -45,14 +39,6 @@ endif() - include(config-ix) - include(HandleOpenMPOptions) - --# Set up testing infrastructure. --include(OpenMPTesting) -- --set(OPENMP_TEST_FLAGS "" CACHE STRING -- "Extra compiler flags to send to the test compiler.") --set(OPENMP_TEST_OPENMP_FLAGS ${OPENMP_TEST_COMPILER_OPENMP_FLAGS} CACHE STRING -- "OpenMP compiler flag to use for testing OpenMP runtime libraries.") -- - - # Build host runtime library. - add_subdirectory(runtime) -@@ -79,17 +65,3 @@ if (OPENMP_ENABLE_LIBOMPTARGET) - add_subdirectory(libomptarget) - endif() - --set(ENABLE_OMPT_TOOLS ON) --# Currently tools are not tested well on Windows or MacOS X. --if (APPLE OR WIN32) -- set(ENABLE_OMPT_TOOLS OFF) --endif() -- --option(OPENMP_ENABLE_OMPT_TOOLS "Enable building ompt based tools for OpenMP." -- ${ENABLE_OMPT_TOOLS}) --if (OPENMP_ENABLE_OMPT_TOOLS) -- add_subdirectory(tools) --endif() -- --# Now that we have seen all testuites, create the check-openmp target. --construct_check_openmp_target() diff --git a/recipes/llvm-openmp/all/patches/0001-disable-build-testing_11.1.0.patch b/recipes/llvm-openmp/all/patches/0001-disable-build-testing_11.1.0.patch deleted file mode 100644 index 910ab03dc90e1..0000000000000 --- a/recipes/llvm-openmp/all/patches/0001-disable-build-testing_11.1.0.patch +++ /dev/null @@ -1,52 +0,0 @@ -diff --git a/openmp/CMakeLists.txt b/openmp/CMakeLists.txt -index 6f0d9e728002..cf7bd7590f43 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -21,12 +21,6 @@ if (OPENMP_STANDALONE_BUILD OR "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_S - # Do not use OPENMP_LIBDIR_SUFFIX directly, use OPENMP_INSTALL_LIBDIR. - set(OPENMP_INSTALL_LIBDIR "lib${OPENMP_LIBDIR_SUFFIX}") - -- # Group test settings. -- set(OPENMP_TEST_C_COMPILER ${CMAKE_C_COMPILER} CACHE STRING -- "C compiler to use for testing OpenMP runtime libraries.") -- set(OPENMP_TEST_CXX_COMPILER ${CMAKE_CXX_COMPILER} CACHE STRING -- "C++ compiler to use for testing OpenMP runtime libraries.") -- set(OPENMP_LLVM_TOOLS_DIR "" CACHE PATH "Path to LLVM tools for testing.") - else() - set(OPENMP_ENABLE_WERROR ${LLVM_ENABLE_WERROR}) - # If building in tree, we honor the same install suffix LLVM uses. -@@ -45,15 +39,6 @@ endif() - include(config-ix) - include(HandleOpenMPOptions) - --# Set up testing infrastructure. --include(OpenMPTesting) -- --set(OPENMP_TEST_FLAGS "" CACHE STRING -- "Extra compiler flags to send to the test compiler.") --set(OPENMP_TEST_OPENMP_FLAGS ${OPENMP_TEST_COMPILER_OPENMP_FLAGS} CACHE STRING -- "OpenMP compiler flag to use for testing OpenMP runtime libraries.") -- -- - # Build host runtime library. - add_subdirectory(runtime) - -@@ -78,18 +63,3 @@ if (OPENMP_ENABLE_LIBOMPTARGET) - - add_subdirectory(libomptarget) - endif() -- --set(ENABLE_OMPT_TOOLS ON) --# Currently tools are not tested well on Windows or MacOS X. --if (APPLE OR WIN32) -- set(ENABLE_OMPT_TOOLS OFF) --endif() -- --option(OPENMP_ENABLE_OMPT_TOOLS "Enable building ompt based tools for OpenMP." -- ${ENABLE_OMPT_TOOLS}) --if (OPENMP_ENABLE_OMPT_TOOLS) -- add_subdirectory(tools) --endif() -- --# Now that we have seen all testsuites, create the check-openmp target. --construct_check_openmp_target() diff --git a/recipes/llvm-openmp/all/patches/0001-disable-build-testing_12.0.1.patch b/recipes/llvm-openmp/all/patches/0001-disable-build-testing_12.0.1.patch deleted file mode 100644 index a1716382cf4d8..0000000000000 --- a/recipes/llvm-openmp/all/patches/0001-disable-build-testing_12.0.1.patch +++ /dev/null @@ -1,55 +0,0 @@ -diff --git a/CMakeLists_orig.txt b/CMakeLists.txt -index b8a2822..7950dde 100644 ---- a/CMakeLists_orig.txt -+++ b/CMakeLists.txt -@@ -21,12 +21,6 @@ if (OPENMP_STANDALONE_BUILD OR "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_S - # Do not use OPENMP_LIBDIR_SUFFIX directly, use OPENMP_INSTALL_LIBDIR. - set(OPENMP_INSTALL_LIBDIR "lib${OPENMP_LIBDIR_SUFFIX}") - -- # Group test settings. -- set(OPENMP_TEST_C_COMPILER ${CMAKE_C_COMPILER} CACHE STRING -- "C compiler to use for testing OpenMP runtime libraries.") -- set(OPENMP_TEST_CXX_COMPILER ${CMAKE_CXX_COMPILER} CACHE STRING -- "C++ compiler to use for testing OpenMP runtime libraries.") -- set(OPENMP_LLVM_TOOLS_DIR "" CACHE PATH "Path to LLVM tools for testing.") - else() - set(OPENMP_ENABLE_WERROR ${LLVM_ENABLE_WERROR}) - # If building in tree, we honor the same install suffix LLVM uses. -@@ -47,14 +41,6 @@ endif() - include(config-ix) - include(HandleOpenMPOptions) - --# Set up testing infrastructure. --include(OpenMPTesting) -- --set(OPENMP_TEST_FLAGS "" CACHE STRING -- "Extra compiler flags to send to the test compiler.") --set(OPENMP_TEST_OPENMP_FLAGS ${OPENMP_TEST_COMPILER_OPENMP_FLAGS} CACHE STRING -- "OpenMP compiler flag to use for testing OpenMP runtime libraries.") -- - set(ENABLE_LIBOMPTARGET ON) - # Currently libomptarget cannot be compiled on Windows or MacOS X. - # Since the device plugins are only supported on Linux anyway, -@@ -97,22 +83,3 @@ if (OPENMP_ENABLE_LIBOMPTARGET) - - add_subdirectory(libomptarget) - endif() -- --set(ENABLE_OMPT_TOOLS ON) --# Currently tools are not tested well on Windows or MacOS X. --if (APPLE OR WIN32) -- set(ENABLE_OMPT_TOOLS OFF) --endif() -- --option(OPENMP_ENABLE_OMPT_TOOLS "Enable building ompt based tools for OpenMP." -- ${ENABLE_OMPT_TOOLS}) --if (OPENMP_ENABLE_OMPT_TOOLS) -- add_subdirectory(tools) --endif() -- -- --# Build documentation --add_subdirectory(docs) -- --# Now that we have seen all testsuites, create the check-openmp target. --construct_check_openmp_target() diff --git a/recipes/llvm-openmp/all/patches/0002-disable-omp-target_12.0.1.patch b/recipes/llvm-openmp/all/patches/0002-disable-omp-target_12.0.1.patch deleted file mode 100644 index cd1c4ba9b8096..0000000000000 --- a/recipes/llvm-openmp/all/patches/0002-disable-omp-target_12.0.1.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/libomptarget/CMakeLists.txt b/libomptarget/CMakeLists.txt -index 6c90ced..629e20a 100644 ---- a/libomptarget/CMakeLists.txt -+++ b/libomptarget/CMakeLists.txt -@@ -30,10 +30,6 @@ include(LibomptargetUtils) - # Get dependencies for the different components of the project. - include(LibomptargetGetDependencies) - --# LLVM source tree is required at build time for libomptarget --if (NOT LIBOMPTARGET_LLVM_INCLUDE_DIRS) -- message(FATAL_ERROR "Missing definition for LIBOMPTARGET_LLVM_INCLUDE_DIRS") --endif() - - # This is a list of all the targets that are supported/tested right now. - set (LIBOMPTARGET_ALL_TARGETS "${LIBOMPTARGET_ALL_TARGETS} aarch64-unknown-linux-gnu") diff --git a/recipes/llvm-openmp/all/patches/10/0001-disable-build-testing.patch b/recipes/llvm-openmp/all/patches/10/0001-disable-build-testing.patch new file mode 100644 index 0000000000000..65692e0ed9c15 --- /dev/null +++ b/recipes/llvm-openmp/all/patches/10/0001-disable-build-testing.patch @@ -0,0 +1,35 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -45,14 +39,6 @@ endif() + include(config-ix) + include(HandleOpenMPOptions) + +-# Set up testing infrastructure. +-include(OpenMPTesting) +- +-set(OPENMP_TEST_FLAGS "" CACHE STRING +- "Extra compiler flags to send to the test compiler.") +-set(OPENMP_TEST_OPENMP_FLAGS ${OPENMP_TEST_COMPILER_OPENMP_FLAGS} CACHE STRING +- "OpenMP compiler flag to use for testing OpenMP runtime libraries.") +- + + # Build host runtime library. + add_subdirectory(runtime) +@@ -79,17 +65,3 @@ if (OPENMP_ENABLE_LIBOMPTARGET) + add_subdirectory(libomptarget) + endif() + +-set(ENABLE_OMPT_TOOLS ON) +-# Currently tools are not tested well on Windows or MacOS X. +-if (APPLE OR WIN32) +- set(ENABLE_OMPT_TOOLS OFF) +-endif() +- +-option(OPENMP_ENABLE_OMPT_TOOLS "Enable building ompt based tools for OpenMP." +- ${ENABLE_OMPT_TOOLS}) +-if (OPENMP_ENABLE_OMPT_TOOLS) +- add_subdirectory(tools) +-endif() +- +-# Now that we have seen all testuites, create the check-openmp target. +-construct_check_openmp_target() diff --git a/recipes/llvm-openmp/all/patches/11/0001-disable-build-testing.patch b/recipes/llvm-openmp/all/patches/11/0001-disable-build-testing.patch new file mode 100644 index 0000000000000..dde4403117078 --- /dev/null +++ b/recipes/llvm-openmp/all/patches/11/0001-disable-build-testing.patch @@ -0,0 +1,37 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -45,15 +39,6 @@ endif() + include(config-ix) + include(HandleOpenMPOptions) + +-# Set up testing infrastructure. +-include(OpenMPTesting) +- +-set(OPENMP_TEST_FLAGS "" CACHE STRING +- "Extra compiler flags to send to the test compiler.") +-set(OPENMP_TEST_OPENMP_FLAGS ${OPENMP_TEST_COMPILER_OPENMP_FLAGS} CACHE STRING +- "OpenMP compiler flag to use for testing OpenMP runtime libraries.") +- +- + # Build host runtime library. + add_subdirectory(runtime) + +@@ -78,18 +63,3 @@ if (OPENMP_ENABLE_LIBOMPTARGET) + + add_subdirectory(libomptarget) + endif() +- +-set(ENABLE_OMPT_TOOLS ON) +-# Currently tools are not tested well on Windows or MacOS X. +-if (APPLE OR WIN32) +- set(ENABLE_OMPT_TOOLS OFF) +-endif() +- +-option(OPENMP_ENABLE_OMPT_TOOLS "Enable building ompt based tools for OpenMP." +- ${ENABLE_OMPT_TOOLS}) +-if (OPENMP_ENABLE_OMPT_TOOLS) +- add_subdirectory(tools) +-endif() +- +-# Now that we have seen all testsuites, create the check-openmp target. +-construct_check_openmp_target() diff --git a/recipes/llvm-openmp/all/patches/0003-fix-armv8-build_11.1.0.patch b/recipes/llvm-openmp/all/patches/11/0002-fix-armv8-build.patch similarity index 100% rename from recipes/llvm-openmp/all/patches/0003-fix-armv8-build_11.1.0.patch rename to recipes/llvm-openmp/all/patches/11/0002-fix-armv8-build.patch diff --git a/recipes/llvm-openmp/all/patches/12/0001-disable-build-testing.patch b/recipes/llvm-openmp/all/patches/12/0001-disable-build-testing.patch new file mode 100644 index 0000000000000..f455aa8e37168 --- /dev/null +++ b/recipes/llvm-openmp/all/patches/12/0001-disable-build-testing.patch @@ -0,0 +1,40 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -47,14 +41,6 @@ endif() + include(config-ix) + include(HandleOpenMPOptions) + +-# Set up testing infrastructure. +-include(OpenMPTesting) +- +-set(OPENMP_TEST_FLAGS "" CACHE STRING +- "Extra compiler flags to send to the test compiler.") +-set(OPENMP_TEST_OPENMP_FLAGS ${OPENMP_TEST_COMPILER_OPENMP_FLAGS} CACHE STRING +- "OpenMP compiler flag to use for testing OpenMP runtime libraries.") +- + set(ENABLE_LIBOMPTARGET ON) + # Currently libomptarget cannot be compiled on Windows or MacOS X. + # Since the device plugins are only supported on Linux anyway, +@@ -97,22 +83,3 @@ if (OPENMP_ENABLE_LIBOMPTARGET) + + add_subdirectory(libomptarget) + endif() +- +-set(ENABLE_OMPT_TOOLS ON) +-# Currently tools are not tested well on Windows or MacOS X. +-if (APPLE OR WIN32) +- set(ENABLE_OMPT_TOOLS OFF) +-endif() +- +-option(OPENMP_ENABLE_OMPT_TOOLS "Enable building ompt based tools for OpenMP." +- ${ENABLE_OMPT_TOOLS}) +-if (OPENMP_ENABLE_OMPT_TOOLS) +- add_subdirectory(tools) +-endif() +- +- +-# Build documentation +-add_subdirectory(docs) +- +-# Now that we have seen all testsuites, create the check-openmp target. +-construct_check_openmp_target() diff --git a/recipes/llvm-openmp/all/patches/13/0001-disable-build-testing.patch b/recipes/llvm-openmp/all/patches/13/0001-disable-build-testing.patch new file mode 100644 index 0000000000000..d319a4099d212 --- /dev/null +++ b/recipes/llvm-openmp/all/patches/13/0001-disable-build-testing.patch @@ -0,0 +1,40 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -44,14 +39,6 @@ + # Check and set up common compiler flags. + include(config-ix) + include(HandleOpenMPOptions) +- +-# Set up testing infrastructure. +-include(OpenMPTesting) +- +-set(OPENMP_TEST_FLAGS "" CACHE STRING +- "Extra compiler flags to send to the test compiler.") +-set(OPENMP_TEST_OPENMP_FLAGS ${OPENMP_TEST_COMPILER_OPENMP_FLAGS} CACHE STRING +- "OpenMP compiler flag to use for testing OpenMP runtime libraries.") + + set(ENABLE_LIBOMPTARGET ON) + # Currently libomptarget cannot be compiled on Windows or MacOS X. +@@ -81,22 +68,3 @@ + + add_subdirectory(libomptarget) + endif() +- +-set(ENABLE_OMPT_TOOLS ON) +-# Currently tools are not tested well on Windows or MacOS X. +-if (APPLE OR WIN32) +- set(ENABLE_OMPT_TOOLS OFF) +-endif() +- +-option(OPENMP_ENABLE_OMPT_TOOLS "Enable building ompt based tools for OpenMP." +- ${ENABLE_OMPT_TOOLS}) +-if (OPENMP_ENABLE_OMPT_TOOLS) +- add_subdirectory(tools) +-endif() +- +- +-# Build documentation +-add_subdirectory(docs) +- +-# Now that we have seen all testsuites, create the check-openmp target. +-construct_check_openmp_target() diff --git a/recipes/llvm-openmp/all/patches/14/0001-disable-build-testing.patch b/recipes/llvm-openmp/all/patches/14/0001-disable-build-testing.patch new file mode 100644 index 0000000000000..464d6918a7551 --- /dev/null +++ b/recipes/llvm-openmp/all/patches/14/0001-disable-build-testing.patch @@ -0,0 +1,62 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -50,25 +45,12 @@ + include(config-ix) + include(HandleOpenMPOptions) + +-# Set up testing infrastructure. +-include(OpenMPTesting) +- +-set(OPENMP_TEST_FLAGS "" CACHE STRING +- "Extra compiler flags to send to the test compiler.") +-set(OPENMP_TEST_OPENMP_FLAGS ${OPENMP_TEST_COMPILER_OPENMP_FLAGS} CACHE STRING +- "OpenMP compiler flag to use for testing OpenMP runtime libraries.") +- + set(ENABLE_LIBOMPTARGET ON) + # Currently libomptarget cannot be compiled on Windows or MacOS X. + # Since the device plugins are only supported on Linux anyway, + # there is no point in trying to compile libomptarget on other OSes. + if (APPLE OR WIN32 OR NOT OPENMP_HAVE_STD_CPP14_FLAG) + set(ENABLE_LIBOMPTARGET OFF) +-endif() +- +-set(ENABLE_LIBOMPTARGET_PROFILING OFF) +-if (ENABLE_LIBOMPTARGET AND NOT LLVM_RUNTIMES_BUILD) +- set(ENABLE_LIBOMPTARGET_PROFILING ON) + endif() + + option(OPENMP_ENABLE_LIBOMPTARGET "Enable building libomptarget for offloading." +@@ -81,9 +63,6 @@ + # to enable time profiling support in the OpenMP runtime. + add_subdirectory(runtime) + +-# Build libompd.so +-add_subdirectory(libompd) +- + if (OPENMP_ENABLE_LIBOMPTARGET) + # Check that the library can actually be built. + if (APPLE OR WIN32) +@@ -94,23 +73,3 @@ + + add_subdirectory(libomptarget) + endif() +- +-set(ENABLE_OMPT_TOOLS ON) +-# Currently tools are not tested well on Windows or MacOS X. +-if (APPLE OR WIN32) +- set(ENABLE_OMPT_TOOLS OFF) +-endif() +- +-option(OPENMP_ENABLE_OMPT_TOOLS "Enable building ompt based tools for OpenMP." +- ${ENABLE_OMPT_TOOLS}) +-if (OPENMP_ENABLE_OMPT_TOOLS) +- add_subdirectory(tools) +-endif() +- +-option(OPENMP_MSVC_NAME_SCHEME "Build dll with MSVC naming scheme." OFF) +- +-# Build documentation +-add_subdirectory(docs) +- +-# Now that we have seen all testsuites, create the check-openmp target. +-construct_check_openmp_target() diff --git a/recipes/llvm-openmp/all/patches/15/0001-disable-build-testing.patch b/recipes/llvm-openmp/all/patches/15/0001-disable-build-testing.patch new file mode 100644 index 0000000000000..0a0b868b908cb --- /dev/null +++ b/recipes/llvm-openmp/all/patches/15/0001-disable-build-testing.patch @@ -0,0 +1,62 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -55,25 +51,12 @@ + include(config-ix) + include(HandleOpenMPOptions) + +-# Set up testing infrastructure. +-include(OpenMPTesting) +- +-set(OPENMP_TEST_FLAGS "" CACHE STRING +- "Extra compiler flags to send to the test compiler.") +-set(OPENMP_TEST_OPENMP_FLAGS ${OPENMP_TEST_COMPILER_OPENMP_FLAGS} CACHE STRING +- "OpenMP compiler flag to use for testing OpenMP runtime libraries.") +- + set(ENABLE_LIBOMPTARGET ON) + # Currently libomptarget cannot be compiled on Windows or MacOS X. + # Since the device plugins are only supported on Linux anyway, + # there is no point in trying to compile libomptarget on other OSes. + if (APPLE OR WIN32 OR NOT OPENMP_HAVE_STD_CPP14_FLAG) + set(ENABLE_LIBOMPTARGET OFF) +-endif() +- +-set(ENABLE_LIBOMPTARGET_PROFILING OFF) +-if (ENABLE_LIBOMPTARGET AND NOT LLVM_RUNTIMES_BUILD) +- set(ENABLE_LIBOMPTARGET_PROFILING ON) + endif() + + option(OPENMP_ENABLE_LIBOMPTARGET "Enable building libomptarget for offloading." +@@ -86,9 +69,6 @@ + # to enable time profiling support in the OpenMP runtime. + add_subdirectory(runtime) + +-# Build libompd.so +-add_subdirectory(libompd) +- + if (OPENMP_ENABLE_LIBOMPTARGET) + # Check that the library can actually be built. + if (APPLE OR WIN32) +@@ -99,23 +79,3 @@ + + add_subdirectory(libomptarget) + endif() +- +-set(ENABLE_OMPT_TOOLS ON) +-# Currently tools are not tested well on Windows or MacOS X. +-if (APPLE OR WIN32) +- set(ENABLE_OMPT_TOOLS OFF) +-endif() +- +-option(OPENMP_ENABLE_OMPT_TOOLS "Enable building ompt based tools for OpenMP." +- ${ENABLE_OMPT_TOOLS}) +-if (OPENMP_ENABLE_OMPT_TOOLS) +- add_subdirectory(tools) +-endif() +- +-option(OPENMP_MSVC_NAME_SCHEME "Build dll with MSVC naming scheme." OFF) +- +-# Build documentation +-add_subdirectory(docs) +- +-# Now that we have seen all testsuites, create the check-openmp target. +-construct_check_openmp_target() diff --git a/recipes/llvm-openmp/all/patches/16/0001-disable-build-testing.patch b/recipes/llvm-openmp/all/patches/16/0001-disable-build-testing.patch new file mode 100644 index 0000000000000..5c9f08ac35cca --- /dev/null +++ b/recipes/llvm-openmp/all/patches/16/0001-disable-build-testing.patch @@ -0,0 +1,44 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -61,14 +57,6 @@ + # Check and set up common compiler flags. + include(config-ix) + include(HandleOpenMPOptions) +- +-# Set up testing infrastructure. +-include(OpenMPTesting) +- +-set(OPENMP_TEST_FLAGS "" CACHE STRING +- "Extra compiler flags to send to the test compiler.") +-set(OPENMP_TEST_OPENMP_FLAGS ${OPENMP_TEST_COMPILER_OPENMP_FLAGS} CACHE STRING +- "OpenMP compiler flag to use for testing OpenMP runtime libraries.") + + set(ENABLE_LIBOMPTARGET ON) + # Currently libomptarget cannot be compiled on Windows or MacOS X. +@@ -107,26 +95,3 @@ + + add_subdirectory(libomptarget) + endif() +- +-set(ENABLE_OMPT_TOOLS ON) +-# Currently tools are not tested well on Windows or MacOS X. +-if (APPLE OR WIN32) +- set(ENABLE_OMPT_TOOLS OFF) +-endif() +- +-option(OPENMP_ENABLE_OMPT_TOOLS "Enable building ompt based tools for OpenMP." +- ${ENABLE_OMPT_TOOLS}) +-if (OPENMP_ENABLE_OMPT_TOOLS) +- add_subdirectory(tools) +-endif() +- +-option(OPENMP_MSVC_NAME_SCHEME "Build dll with MSVC naming scheme." OFF) +- +-# Build libompd.so +-add_subdirectory(libompd) +- +-# Build documentation +-add_subdirectory(docs) +- +-# Now that we have seen all testsuites, create the check-openmp target. +-construct_check_openmp_target() diff --git a/recipes/llvm-openmp/all/patches/17/0001-disable-build-testing.patch b/recipes/llvm-openmp/all/patches/17/0001-disable-build-testing.patch new file mode 100644 index 0000000000000..afda1c6a0da19 --- /dev/null +++ b/recipes/llvm-openmp/all/patches/17/0001-disable-build-testing.patch @@ -0,0 +1,44 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -64,14 +60,6 @@ + # Check and set up common compiler flags. + include(config-ix) + include(HandleOpenMPOptions) +- +-# Set up testing infrastructure. +-include(OpenMPTesting) +- +-set(OPENMP_TEST_FLAGS "" CACHE STRING +- "Extra compiler flags to send to the test compiler.") +-set(OPENMP_TEST_OPENMP_FLAGS ${OPENMP_TEST_COMPILER_OPENMP_FLAGS} CACHE STRING +- "OpenMP compiler flag to use for testing OpenMP runtime libraries.") + + set(ENABLE_LIBOMPTARGET ON) + # Currently libomptarget cannot be compiled on Windows or MacOS X. +@@ -110,26 +98,3 @@ + + add_subdirectory(libomptarget) + endif() +- +-set(ENABLE_OMPT_TOOLS ON) +-# Currently tools are not tested well on Windows or MacOS X. +-if (APPLE OR WIN32) +- set(ENABLE_OMPT_TOOLS OFF) +-endif() +- +-option(OPENMP_ENABLE_OMPT_TOOLS "Enable building ompt based tools for OpenMP." +- ${ENABLE_OMPT_TOOLS}) +-if (OPENMP_ENABLE_OMPT_TOOLS) +- add_subdirectory(tools) +-endif() +- +-option(OPENMP_MSVC_NAME_SCHEME "Build dll with MSVC naming scheme." OFF) +- +-# Build libompd.so +-add_subdirectory(libompd) +- +-# Build documentation +-add_subdirectory(docs) +- +-# Now that we have seen all testsuites, create the check-openmp target. +-construct_check_openmp_target() diff --git a/recipes/llvm-openmp/all/patches/8/0001-disable-build-testing.patch b/recipes/llvm-openmp/all/patches/8/0001-disable-build-testing.patch new file mode 100644 index 0000000000000..3215d61a23b9f --- /dev/null +++ b/recipes/llvm-openmp/all/patches/8/0001-disable-build-testing.patch @@ -0,0 +1,25 @@ +diff --git a/openmp/CMakeLists.txt b/openmp/CMakeLists.txt +index 597eedcec0b..4395761dac4 100644 +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -45,14 +39,6 @@ endif() + include(config-ix) + include(HandleOpenMPOptions) + +-# Set up testing infrastructure. +-include(OpenMPTesting) +- +-set(OPENMP_TEST_FLAGS "" CACHE STRING +- "Extra compiler flags to send to the test compiler.") +-set(OPENMP_TEST_OPENMP_FLAGS ${OPENMP_TEST_COMPILER_OPENMP_FLAGS} CACHE STRING +- "OpenMP compiler flag to use for testing OpenMP runtime libraries.") +- + + # Build host runtime library. + add_subdirectory(runtime) +@@ -79,5 +65,3 @@ if (OPENMP_ENABLE_LIBOMPTARGET) + add_subdirectory(libomptarget) + endif() + +-# Now that we have seen all testuites, create the check-openmp target. +-construct_check_openmp_target() diff --git a/recipes/llvm-openmp/all/test_package/CMakeLists.txt b/recipes/llvm-openmp/all/test_package/CMakeLists.txt index 2d9a8574cc4d4..491aa7ec1f5d3 100644 --- a/recipes/llvm-openmp/all/test_package/CMakeLists.txt +++ b/recipes/llvm-openmp/all/test_package/CMakeLists.txt @@ -1,10 +1,10 @@ -cmake_minimum_required(VERSION 3.1) -project(PackageTest CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.15) +project(PackageTest CXX C) find_package(OpenMP CONFIG REQUIRED) -add_executable(test_package test_package.cpp) -target_link_libraries(test_package OpenMP::OpenMP_CXX) +add_executable(test_package_cxx test_package.cpp) +target_link_libraries(test_package_cxx OpenMP::OpenMP_CXX) + +add_executable(test_package_c test_package.c) +target_link_libraries(test_package_c OpenMP::OpenMP_C) diff --git a/recipes/llvm-openmp/all/test_package/conanfile.py b/recipes/llvm-openmp/all/test_package/conanfile.py index 5ac3af772bdc0..b9c17185d658e 100644 --- a/recipes/llvm-openmp/all/test_package/conanfile.py +++ b/recipes/llvm-openmp/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 LLVMOpenMpTestConan(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) @@ -12,6 +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) + if can_run(self): + for executable in ["test_package_cxx", "test_package_c"]: + bin_path = os.path.join(self.cpp.build.bindir, executable) + self.run(bin_path, env="conanrun") diff --git a/recipes/llvm-openmp/all/test_package/test_package.c b/recipes/llvm-openmp/all/test_package/test_package.c new file mode 100644 index 0000000000000..103d724f00fcd --- /dev/null +++ b/recipes/llvm-openmp/all/test_package/test_package.c @@ -0,0 +1,25 @@ +#include + +#include + +int main() +{ + int num_threads = omp_get_num_procs(); + if (num_threads < 5) + num_threads = 5; + omp_set_num_threads(num_threads); + int actual_number; + #pragma omp parallel + { + #pragma omp single + { + actual_number = omp_get_num_threads(); + } + } + if(actual_number != num_threads){ + printf("Something went wrong. Expecting %d threads but found %d.\n", num_threads, actual_number); + printf("There are probably missing compiler flags.\n"); + return 1; + } + return 0; +} diff --git a/recipes/llvm-openmp/all/test_package/test_package.cpp b/recipes/llvm-openmp/all/test_package/test_package.cpp index f6316471238aa..b602ec5a096c9 100644 --- a/recipes/llvm-openmp/all/test_package/test_package.cpp +++ b/recipes/llvm-openmp/all/test_package/test_package.cpp @@ -1,4 +1,5 @@ #include + #include int main() @@ -15,7 +16,7 @@ int main() } if(actual_number != num_threads){ std::cout << "Something went wrong. Expecting " << num_threads << " threads but found " << actual_number << ".\n"; - std::cout << "There are probably missing compiler flags.\n" ; + std::cout << "There are probably missing compiler flags.\n"; return 1; } return 0; diff --git a/recipes/llvm-openmp/all/test_v1_package/CMakeLists.txt b/recipes/llvm-openmp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/llvm-openmp/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/llvm-openmp/all/test_v1_package/conanfile.py b/recipes/llvm-openmp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..b6e98e149af12 --- /dev/null +++ b/recipes/llvm-openmp/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class LLVMOpenMpTestConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + for executable in ["test_package_cxx", "test_package_c"]: + bin_path = os.path.join("bin", executable) + self.run(bin_path, run_environment=True) diff --git a/recipes/llvm-openmp/config.yml b/recipes/llvm-openmp/config.yml index 5f6a2e2df9402..2f6f02e2e7d3f 100644 --- a/recipes/llvm-openmp/config.yml +++ b/recipes/llvm-openmp/config.yml @@ -1,4 +1,16 @@ versions: + "17.0.6": + folder: all + "17.0.4": + folder: all + "16.0.6": + folder: all + "15.0.7": + folder: all + "14.0.6": + folder: all + "13.0.1": + folder: all "12.0.1": folder: all "11.1.0": diff --git a/recipes/lmdb/all/conandata.yml b/recipes/lmdb/all/conandata.yml index 924b591216793..3d8d01ecc53e6 100644 --- a/recipes/lmdb/all/conandata.yml +++ b/recipes/lmdb/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "0.9.32": + url: "https://git.openldap.org/openldap/openldap/-/archive/LMDB_0.9.32/openldap-LMDB_0.9.32.tar.gz" + sha256: "c0937223bba3c37c896809883a3c9b43049354578b239d6ed2476236a87f40c9" + "0.9.31": + url: "https://git.openldap.org/openldap/openldap/-/archive/LMDB_0.9.31/openldap-LMDB_0.9.31.tar.gz" + sha256: "f7aecdd1bcc69fb32bb33d8544cfe50f8e9e916f366d598a268e1f43ee9c7603" "0.9.29": url: "https://git.openldap.org/openldap/openldap/-/archive/LMDB_0.9.29/openldap-LMDB_0.9.29.tar.gz" - sha256: "d4c668167a2d703ef91db733b4069b8b74dbc374405855be6626b45e2a7e2dd3" + sha256: "e4d9f32dba4e15fcc66e0085a03432ff40a8065848d352ea47b1cb717e7369a4" diff --git a/recipes/lmdb/config.yml b/recipes/lmdb/config.yml index 34b7a75931b22..0014799ccef1f 100644 --- a/recipes/lmdb/config.yml +++ b/recipes/lmdb/config.yml @@ -1,3 +1,7 @@ "versions": + "0.9.32": + "folder": "all" + "0.9.31": + "folder": "all" "0.9.29": "folder": "all" diff --git a/recipes/lodepng/all/conandata.yml b/recipes/lodepng/all/conandata.yml index bc34ea30306f5..c67c30a9939fd 100644 --- a/recipes/lodepng/all/conandata.yml +++ b/recipes/lodepng/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "cci.20230410": + url: "https://github.com/lvandeve/lodepng/archive/c18b949b71f45e78b1f9a28c5d458bce0da505d6.tar.gz" + sha256: "915d1bf834e67632b87bd18c932e6041ed0ca46a7e3493f5e3290980092cf2d9" "cci.20200615": url: "https://github.com/lvandeve/lodepng/archive/34628e89e80cd007179b25b0b2695e6af0f57fac.tar.gz" sha256: "486ece0b661e83e509f1c6c9a05ca8dd1dd0008eec47d2aad9359e3609ab44a9" diff --git a/recipes/lodepng/all/conanfile.py b/recipes/lodepng/all/conanfile.py index 46fefaf886180..cf5e7257fe6f8 100644 --- a/recipes/lodepng/all/conanfile.py +++ b/recipes/lodepng/all/conanfile.py @@ -5,7 +5,7 @@ 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 LodepngConan(ConanFile): @@ -16,6 +16,7 @@ class LodepngConan(ConanFile): homepage = "https://github.com/lvandeve/lodepng" 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 + 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("lodepng shared doesn't support Visual Studio with static 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) @@ -64,3 +64,5 @@ def package(self): def package_info(self): self.cpp_info.libs = ["lodepng"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") diff --git a/recipes/lodepng/all/test_package/bees.png b/recipes/lodepng/all/test_package/bees.png deleted file mode 100644 index 11640c7488fb1..0000000000000 Binary files a/recipes/lodepng/all/test_package/bees.png and /dev/null differ diff --git a/recipes/lodepng/all/test_package/conanfile.py b/recipes/lodepng/all/test_package/conanfile.py index ad9ad50d2e692..0a6bc68712d90 100644 --- a/recipes/lodepng/all/test_package/conanfile.py +++ b/recipes/lodepng/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,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") - bees = os.path.join(self.source_folder, "bees.png") - self.run(f"{bin_path} {bees}", env="conanrun") + self.run(bin_path, env="conanrun") diff --git a/recipes/lodepng/all/test_package/test_package.cpp b/recipes/lodepng/all/test_package/test_package.cpp index 744f347b97c7b..9f83682fff5cd 100644 --- a/recipes/lodepng/all/test_package/test_package.cpp +++ b/recipes/lodepng/all/test_package/test_package.cpp @@ -1,31 +1,12 @@ #include -#include -#include -#include - #include "lodepng.h" int main(int argc, const char *argv[]) { - if (argc < 2) { - std::cerr << "Need at least one argument\n"; - } - std::ifstream stream(argv[1], std::ios::in | std::ios::binary); - std::vector data((std::istreambuf_iterator(stream)), std::istreambuf_iterator()); - - std::cout << "file name " << argv[1] << "\n"; - std::cout << "file size " << data.size() << " bytes\n"; - - std::vector decoded; - unsigned width = 0, height = 0; - unsigned error = lodepng::decode(decoded, width, height, data); - if (error != 0) { - std::cerr << "lodepng::decode returned with error code " << error << "\n"; - return 1; - } - std::cout << "image size: " << width << " x " << height << " pixels.\n"; + LodePNGCompressSettings compress_settings; + lodepng_compress_settings_init(&compress_settings); - stream.close(); + printf("compress_settings.btype = %d\n", compress_settings.btype); return 0; } diff --git a/recipes/lodepng/all/test_v1_package/CMakeLists.txt b/recipes/lodepng/all/test_v1_package/CMakeLists.txt index 54224af3ae67e..0d20897301b68 100644 --- a/recipes/lodepng/all/test_v1_package/CMakeLists.txt +++ b/recipes/lodepng/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(lodepng REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE lodepng::lodepng) -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/lodepng/all/test_v1_package/conanfile.py b/recipes/lodepng/all/test_v1_package/conanfile.py index 4441530a937ba..38f4483872d47 100644 --- a/recipes/lodepng/all/test_v1_package/conanfile.py +++ b/recipes/lodepng/all/test_v1_package/conanfile.py @@ -14,5 +14,4 @@ def build(self): 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", "bees.png") - self.run(f"{bin_path} {bees}", run_environment=True) + self.run(bin_path, run_environment=True) diff --git a/recipes/lodepng/config.yml b/recipes/lodepng/config.yml index 4b29d9b93e715..7d5d008d1120b 100644 --- a/recipes/lodepng/config.yml +++ b/recipes/lodepng/config.yml @@ -1,3 +1,5 @@ versions: + "cci.20230410": + folder: all "cci.20200615": folder: all 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..806ae51d2f04e 100644 --- a/recipes/log4cplus/all/conandata.yml +++ b/recipes/log4cplus/all/conandata.yml @@ -1,13 +1,44 @@ 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.0.6": - url: "https://github.com/log4cplus/log4cplus/releases/download/REL_2_0_6/log4cplus-2.0.6.tar.bz2" - sha256: "1a963afd0f883d62de946b18927d238051fd47936e415eabeffe2b1397f16eca" + "2.1.2": + url: "https://github.com/log4cplus/log4cplus/releases/download/REL_2_1_2/log4cplus-2.1.2.tar.bz2" + sha256: "2450dfbb4ab35dd2c9e64d8c750c514bf7293b81d8f32af7ab124417f70adfad" + "2.1.1": + url: "https://github.com/log4cplus/log4cplus/releases/download/REL_2_1_1/log4cplus-2.1.1.tar.bz2" + sha256: "6597de782775e4e0fba8fdcad938c3709fd839a8084c4b6edfae3cc5046e2688" + "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" + sha256: "8fadbafee2ba4e558a0f78842613c9fb239c775d83f23340d091084c0e1b12ab" + "1.2.2": + url: "https://github.com/log4cplus/log4cplus/releases/download/REL_1_2_2/log4cplus-1.2.2.tar.bz2" + sha256: "853efd919f9ca76c518c0944e6b0ced1174523a86b6db046ed4f23fe695167bd" +patches: + "2.1.2": + - patch_file: "patches/2.1.2-0001-fix-cmake.patch" + patch_description: "disable fPIC" + patch_type: "conan" + "2.1.1": + - patch_file: "patches/2.0.6-0001-fix-cmake.patch" + patch_description: "disable fPIC, move cmake_minimum_version to front" + patch_type: "conan" + "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": + - patch_file: "patches/2.0.6-0001-fix-cmake.patch" + patch_description: "disable fPIC, move cmake_minimum_version to front" + patch_type: "conan" + "1.2.2": + - patch_file: "patches/1.2.2-0001-fix-cmake.patch" + patch_description: "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..e874b2d20f4c6 100644 --- a/recipes/log4cplus/all/conanfile.py +++ b/recipes/log4cplus/all/conanfile.py @@ -1,51 +1,51 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir, collect_libs +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 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" 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") + package_type = "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 +53,71 @@ 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) + if Version(self.version) < 2 and valid_min_cppstd(self, 17): + raise ConanInvalidConfiguration(f"${self.ref} does not support C++17") + if Version(self.version) >= "2.1.2" and \ + is_msvc(self) and Version(self.settings.compiler.version) < 192: + raise ConanInvalidConfiguration(f"${self.ref} requires Visual Studio 2019 or newer") 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/1.2.2-0001-fix-cmake.patch b/recipes/log4cplus/all/patches/1.2.2-0001-fix-cmake.patch new file mode 100644 index 0000000000000..29c239101f640 --- /dev/null +++ b/recipes/log4cplus/all/patches/1.2.2-0001-fix-cmake.patch @@ -0,0 +1,12 @@ +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -11,8 +11,8 @@ + # Remove when CMake >= 2.8.4 is required + set (CMAKE_LEGACY_CYGWIN_WIN32 0) + ++cmake_minimum_required (VERSION 3.15) + project (log4cplus) +-cmake_minimum_required (VERSION 2.8.12) + + enable_language (CXX) + include(GNUInstallDirs) 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/patches/2.1.2-0001-fix-cmake.patch b/recipes/log4cplus/all/patches/2.1.2-0001-fix-cmake.patch new file mode 100644 index 0000000000000..9bec3910bc1e9 --- /dev/null +++ b/recipes/log4cplus/all/patches/2.1.2-0001-fix-cmake.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 9dcbb8a..f80d3b9 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -15,7 +15,7 @@ cmake_minimum_required (VERSION 3.12) + project (log4cplus) + + # Use "-fPIC" / "-fPIE" for all targets by default, including static libs. +-set (CMAKE_POSITION_INDEPENDENT_CODE ON) ++# 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..0a50a283c1bb4 100644 --- a/recipes/log4cplus/all/test_package/CMakeLists.txt +++ b/recipes/log4cplus/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() +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) +if(log4cplus_VERSION VERSION_GREATER_EQUAL 2) + add_executable(${PROJECT_NAME} test_package.cpp) +else() + add_executable(${PROJECT_NAME} test_package_v1.cpp) +endif() +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_package/test_package_v1.cpp b/recipes/log4cplus/all/test_package/test_package_v1.cpp new file mode 100644 index 0000000000000..bd0d86df7ec39 --- /dev/null +++ b/recipes/log4cplus/all/test_package/test_package_v1.cpp @@ -0,0 +1,16 @@ +#include +#include +#include + +int main() +{ + log4cplus::initialize(); + + log4cplus::BasicConfigurator config; + config.configure(); + + log4cplus::Logger logger = log4cplus::Logger::getInstance(LOG4CPLUS_TEXT("main")); + LOG4CPLUS_WARN(logger, LOG4CPLUS_TEXT("Hello, World!")); + + return 0; +} 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..bd3466aea568e 100644 --- a/recipes/log4cplus/config.yml +++ b/recipes/log4cplus/config.yml @@ -1,9 +1,15 @@ versions: - "2.0.4": + "2.1.2": folder: all - "2.0.5": + # 2.1.1 is the last version for Visual Studio 2017 + "2.1.1": folder: all - "2.0.6": + "2.1.0": + folder: all + "2.0.8": folder: all "2.0.7": folder: all + # v1 is required for the openvdb recipe + "1.2.2": + folder: all diff --git a/recipes/log4cxx/all/CMakeLists.txt b/recipes/log4cxx/all/CMakeLists.txt deleted file mode 100644 index b83949de59dc5..0000000000000 --- a/recipes/log4cxx/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.13) -project(cmake_wrapper CXX) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/log4cxx/all/conandata.yml b/recipes/log4cxx/all/conandata.yml index 4d9c222f7d839..5f5b6f75de86a 100644 --- a/recipes/log4cxx/all/conandata.yml +++ b/recipes/log4cxx/all/conandata.yml @@ -1,14 +1,46 @@ sources: + "1.2.0": + url: "https://archive.apache.org/dist/logging/log4cxx/1.2.0/apache-log4cxx-1.2.0.tar.gz" + sha256: "09f4748aa5675ef5c0770bedbf5e00488668933c5a935a43ac5b85be2436c48a" + "1.1.0": + url: "https://archive.apache.org/dist/logging/log4cxx/1.1.0/apache-log4cxx-1.1.0.tar.gz" + sha256: "1fc7d82697534184bc0f757348d969d24852b948f63d6b17283fd1ee29c2c28a" + "0.13.0": + url: "https://archive.apache.org/dist/logging/log4cxx/0.13.0/apache-log4cxx-0.13.0.tar.gz" + sha256: "4e5be64b6b1e6de8525f8b87635270b81f772a98902d20d7ac646fdf1ac08284" "0.12.1": url: "https://archive.apache.org/dist/logging/log4cxx/0.12.1/apache-log4cxx-0.12.1.tar.gz" sha256: "7bea5cb477f0e31c838f0e1f4f498cc3b30c2eae74703ddda923e7e8c2268d22" - "0.12.0": - url: "https://archive.apache.org/dist/logging/log4cxx/0.12.0/apache-log4cxx-0.12.0.tar.gz" - sha256: "bd5b5009ca914c8fa7944b92ea6b4ca6fb7d146f65d526f21bf8b3c6a0520e44" patches: + "1.2.0": + - patch_file: "patches/1.2.0-0001-find-apr.patch" + patch_description: "use cci's package name" + patch_type: "conan" + "1.1.0": + - patch_file: "patches/1.1.0-0001-find-apr.patch" + patch_description: "use cci's package name" + patch_type: "conan" + "0.13.0": + - patch_file: "patches/0.13.0-0001-find-apr.patch" + patch_type: "conan" + patch_description: "Use conan generated apr, apr-util target names" + - patch_file: "patches/0.13.0-0001-logchar-type.patch" + patch_type: "bugfix" + patch_description: "Prevent compilation errors when with_wchar_t=False" + patch_source: "https://github.com/apache/logging-log4cxx/commit/5109466a844d1e5fb8b455a23077765a30325a24" + - patch_file: "patches/0.13.0-0001-visual-studio-15.patch" + patch_type: "bugfix" + patch_description: "Prevent Visual Studio 2017 compilation error" + patch_source: "https://github.com/apache/logging-log4cxx/commit/f59bf53f831b8b68ef3a2f3a6705ae626090758e" + - patch_file: "patches/0.13.0-0001-fix-static-library-compilation.patch" + patch_type: "bugfix" + patch_description: "Prevent compilation error when shared=False" + patch_source: "https://github.com/apache/logging-log4cxx/commit/09b5b723a1a210c28bf8b05b0676bb2b104359ba" "0.12.1": - - base_path: "source_subfolder" - patch_file: "patches/0001-find-apr.patch" - "0.12.0": - - base_path: "source_subfolder" - patch_file: "patches/0001-find-apr.patch" + - patch_file: "patches/0.12.1-0001-find-apr.patch" + patch_description: "use cci's package name" + patch_type: "conan" + - patch_file: "patches/0.12.1-0001-logchar-type.patch" + patch_type: "bugfix" + patch_description: "Prevent compilation errors when with_wchar_t=False" + patch_source: "https://github.com/apache/logging-log4cxx/commit/5109466a844d1e5fb8b455a23077765a30325a24" diff --git a/recipes/log4cxx/all/conanfile.py b/recipes/log4cxx/all/conanfile.py index ac48eb45fc460..2a819c7258550 100644 --- a/recipes/log4cxx/all/conanfile.py +++ b/recipes/log4cxx/all/conanfile.py @@ -1,133 +1,185 @@ -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.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.scm import Version + +required_conan_version = ">=1.53.0" class Log4cxxConan(ConanFile): name = "log4cxx" description = "Logging framework for C++ patterned after Apache log4j" - url = "https://github.com/conan-io/conan-center-index" license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" homepage = "https://logging.apache.org/log4cxx" topics = ("logging", "log") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], + "char_type": ["utf-8", "wchar_t", "unichar"], + "char_encoding": ["utf-8", "locale"], + "with_networking": [True, False], + "with_wchar_t": [True, False], + "with_fmt_layout": [True, False], + "with_odbc_appender": [True, False], + "with_multiprocess_rolling_file_appender": [True, False], + "with_smtp_appender": [True, False], + "with_qt": [True, False], + } + options_description = { + "char_type": "The log4cxx internal character type (selects the std::basic_string template parameter used by log4cxx::LogString)", + "char_encoding": "The external character set used when writing to files", + "with_networking": "Include appenders that use network i/o", + "with_wchar_t": "Include wchar_t API methods in class interfaces", + "with_fmt_layout": "Include the log4cxx::FMTLayout class that uses libfmt to layout messages", + "with_odbc_appender": "Include the log4cxx::ODBCAppender that sends log events to a database", + "with_multiprocess_rolling_file_appender": "Include the appender that allows multiple applications to log to the same file", + "with_smtp_appender": "Include the appender that sends an e-mail when a specific logging event occurs", + "with_qt": "Allow QString values in the LOG4CXX_WARN, LOG4CXX_INFO, LOG4CXX_DEBUG etc. macros", } default_options = { "shared": False, "fPIC": True, + "char_type": "utf-8", + "char_encoding": "utf-8", + "with_networking": True, + "with_wchar_t": False, + "with_fmt_layout": False, + "with_odbc_appender": False, + "with_multiprocess_rolling_file_appender": False, + "with_smtp_appender": False, + "with_qt": False, } - generators = "cmake", "cmake_find_package", "pkg_config" - _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 { + "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": - del self.options.fPIC + self.options.rm_safe("fPIC") + self.options.rm_safe("with_smtp_appender") # *nix only + elif Version(self.version) <= "1.0.0": # SMTP appender is broken in version 0.12 through 1.0.0 + self.options.rm_safe("with_smtp_appender") + if Version(self.version) < "1.0.0": + self.options.rm_safe("with_multiprocess_rolling_file_appender") + self.options.rm_safe("with_networking") + self.options.rm_safe("with_fmt_layout") 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("apr/1.7.0") + self.requires("apr/1.7.4") self.requires("apr-util/1.6.1") - self.requires("expat/2.4.2") - if self.settings.os != "Windows": - self.requires("odbc/2.3.9") - - @property - def _compilers_minimum_version(self): - return { - "gcc": "7", - "Visual Studio": "15", - "clang": "5", - "apple-clang": "10", - } + if self.options.get_safe("with_odbc_appender") and self.settings.os != "Windows": + self.requires("odbc/2.3.11") + if self.options.get_safe("with_smtp_appender"): + self.requires("libesmtp/1.1.0") + if self.options.get_safe("with_fmt_layout"): + self.requires("fmt/10.2.1") + if self.options.get_safe("with_qt"): + self.requires("qt/[~5.15]") def validate(self): - # TODO: if compiler doesn't support C++17, boost can be used instead - 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("log4cxx requires C++17. Your compiler is unknown. Assuming it supports C++17.") - elif tools.Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration("log4cxx requires a compiler that supports at least C++17") + if Version(self.version) < "1.0.0" or self.options.get_safe("with_multiprocess_rolling_file_appender"): + # TODO: if compiler doesn't support C++17, boost can be used instead + if Version(self.version) < "1.0.0": + self.output.info(f"Version {self.version} requires C++17. log4cxx version 1.x does not.") + else: + self.output.info("multiprocess rolling file appender requires C++17.") + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + compiler_version = Version(self.settings.compiler.version) + if compiler_version < minimum_version: + raise ConanInvalidConfiguration(f"{self.settings.compiler} {compiler_version} does not support C++17: {minimum_version} required.") + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, "17") + + def _patch_sources(self): + apply_conandata_patches(self) def build_requirements(self): if self.settings.os != "Windows": - self.build_requires("pkgconf/1.7.4") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/2.0.3") def source(self): - #OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: - #'source_subfolder\\src\\test\\resources\\output\\xyz\\:' - pattern = "*[!:]" - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True, - pattern=pattern) - - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - - def _configure_cmake(self): - if not self._cmake: - self._cmake = CMake(self) - self._cmake.definitions["BUILD_TESTING"] = False - if self.settings.os == "Windows": - self._cmake.definitions["LOG4CXX_INSTALL_PDB"] = False - 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_TESTING"] = False + tc.variables["LOG4CXX_INSTALL_PDB"] = False + if Version(self.version) >= "1.0.0": + tc.variables["LOG4CXX_NETWORKING_SUPPORT"] = self.options.with_networking + tc.variables["LOG4CXX_MULTIPROCESS_ROLLING_FILE_APPENDER"] = self.options.with_multiprocess_rolling_file_appender + tc.variables["ENABLE_FMT_LAYOUT"] = self.options.with_fmt_layout + if Version(self.version) > "1.0.0" and self.settings.os != "Windows": + tc.variables["LOG4CXX_ENABLE_ESMTP"] = self.options.with_smtp_appender + tc.variables["LOG4CXX_ENABLE_ODBC"] = self.options.with_odbc_appender + tc.variables["LOG4CXX_CHAR"] = self.options.char_type + tc.variables["LOG4CXX_CHARSET"] = self.options.char_encoding + tc.variables["LOG4CXX_WCHAR_T"] = self.options.with_wchar_t + tc.variables["LOG4CXX_QT_SUPPORT"] = self.options.with_qt + 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 package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - self.copy("NOTICE", 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, "NOTICE", 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")) + 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* generators removed self._create_cmake_module_alias_targets( - os.path.join(self.package_folder, self._module_file_rel_path), - {"log4cxx": "log4cxx::log4cxx"} + os.path.join(self.package_folder, self._module_file_rel_path), {"log4cxx": "log4cxx::log4cxx"} ) - @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): @@ -137,6 +189,7 @@ def package_info(self): self.cpp_info.set_property("cmake_file_name", "log4cxx") self.cpp_info.set_property("cmake_target_name", "log4cxx") self.cpp_info.set_property("pkg_config_name", "liblog4cxx") + if not self.options.shared: self.cpp_info.defines = ["LOG4CXX_STATIC"] self.cpp_info.libs = ["log4cxx"] @@ -146,4 +199,4 @@ def package_info(self): # 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"] = "liblog4cxx" + diff --git a/recipes/log4cxx/all/patches/0.12.1-0001-find-apr.patch b/recipes/log4cxx/all/patches/0.12.1-0001-find-apr.patch new file mode 100644 index 0000000000000..9b75430996d18 --- /dev/null +++ b/recipes/log4cxx/all/patches/0.12.1-0001-find-apr.patch @@ -0,0 +1,20 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -25,12 +25,14 @@ if(NOT BUILD_SHARED_LIBS) + endif() + + # Find Apache Runtime +-find_package(APR REQUIRED) ++find_package(apr REQUIRED) ++set(APR_LIBRARIES apr::apr) + + # Find Apache Runtime Utilities +-find_package(APR-Util REQUIRED) ++find_package(apr-util REQUIRED) ++set(APR_UTIL_LIBRARIES apr-util::apr-util) + + find_package( Threads REQUIRED ) + + # Find expat for XML parsing +-find_package(EXPAT REQUIRED) ++find_package(EXPAT REQUIRED MODULE) diff --git a/recipes/log4cxx/all/patches/0.12.1-0001-logchar-type.patch b/recipes/log4cxx/all/patches/0.12.1-0001-logchar-type.patch new file mode 100644 index 0000000000000..a59e3639553ae --- /dev/null +++ b/recipes/log4cxx/all/patches/0.12.1-0001-logchar-type.patch @@ -0,0 +1,21 @@ +--- a/src/main/include/CMakeLists.txt ++++ b/src/main/include/CMakeLists.txt +@@ -22,9 +22,18 @@ endif() + + if(${LOG4CXX_CHAR} STREQUAL "unichar") + set(LOGCHAR_IS_UNICHAR 1) ++ set(LOGCHAR_IS_WCHAR 0) ++ set(LOGCHAR_IS_UTF8 0) + elseif(${LOG4CXX_CHAR} STREQUAL "wchar_t") + set(LOGCHAR_IS_WCHAR 1) ++ set(LOGCHAR_IS_UNICHAR 0) ++ set(LOGCHAR_IS_UTF8 0) ++elseif(${LOG4CXX_CHAR} STREQUAL "utf-8") ++ set(LOGCHAR_IS_UNICHAR 0) ++ set(LOGCHAR_IS_WCHAR 0) ++ set(LOGCHAR_IS_UTF8 1) + endif() ++ + option(LOG4CXX_WCHAR_T "Enable wchar_t API methods" ON) + option(LOG4CXX_UNICHAR "Enable UniChar API methods" OFF) + set(INIT_IOS_BASE 0) diff --git a/recipes/log4cxx/all/patches/0.13.0-0001-find-apr.patch b/recipes/log4cxx/all/patches/0.13.0-0001-find-apr.patch new file mode 100644 index 0000000000000..174331cfd2a57 --- /dev/null +++ b/recipes/log4cxx/all/patches/0.13.0-0001-find-apr.patch @@ -0,0 +1,17 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -41,10 +41,12 @@ if(NOT BUILD_SHARED_LIBS) + endif() + + # Find Apache Runtime +-find_package(APR REQUIRED) ++find_package(apr REQUIRED) ++set(APR_LIBRARIES apr::apr) + + # Find Apache Runtime Utilities +-find_package(APR-Util REQUIRED) ++find_package(apr-util REQUIRED) ++set(APR_UTIL_LIBRARIES apr-util::apr-util) + + find_package( Threads REQUIRED ) + diff --git a/recipes/log4cxx/all/patches/0.13.0-0001-fix-static-library-compilation.patch b/recipes/log4cxx/all/patches/0.13.0-0001-fix-static-library-compilation.patch new file mode 100644 index 0000000000000..53bcabf38e8da --- /dev/null +++ b/recipes/log4cxx/all/patches/0.13.0-0001-fix-static-library-compilation.patch @@ -0,0 +1,12 @@ +--- a/src/main/cpp/threadutility.cpp ++++ b/src/main/cpp/threadutility.cpp +@@ -16,6 +16,9 @@ + */ + + #include "log4cxx/helpers/threadutility.h" ++#if !defined(LOG4CXX) ++ #define LOG4CXX 1 ++#endif + #include "log4cxx/private/log4cxx_private.h" + #include "log4cxx/helpers/loglog.h" + diff --git a/recipes/log4cxx/all/patches/0.13.0-0001-logchar-type.patch b/recipes/log4cxx/all/patches/0.13.0-0001-logchar-type.patch new file mode 100644 index 0000000000000..cb4669d6873b4 --- /dev/null +++ b/recipes/log4cxx/all/patches/0.13.0-0001-logchar-type.patch @@ -0,0 +1,44 @@ +diff --git a/src/main/cpp/threadutility.cpp b/src/main/cpp/threadutility.cpp +index c14c12fd..057ecd86 100644 +--- a/src/main/cpp/threadutility.cpp ++++ b/src/main/cpp/threadutility.cpp +@@ -113,11 +113,13 @@ void ThreadUtility::threadStartedNameThread(LogString threadName, + std::thread::id /*threadId*/, + std::thread::native_handle_type nativeHandle){ + #if LOG4CXX_HAS_PTHREAD_SETNAME +- if( pthread_setname_np( static_cast( nativeHandle ), threadName.c_str() ) < 0 ){ +- LOGLOG_ERROR( LOG4CXX_STR("unable to set thread name") ); ++ LOG4CXX_ENCODE_CHAR(sthreadName, threadName); ++ if (pthread_setname_np(static_cast(nativeHandle), sthreadName.c_str()) < 0) { ++ LOGLOG_ERROR(LOG4CXX_STR("unable to set thread name")); + } + #elif LOG4CXX_HAS_SETTHREADDESCRIPTION +- HRESULT hr = SetThreadDescription(static_cast(nativeHandle), threadName.c_str()); ++ LOG4CXX_ENCODE_WCHAR(wthreadName, threadName); ++ HRESULT hr = SetThreadDescription(static_cast(nativeHandle), wthreadName.c_str()); + if(FAILED(hr)){ + LOGLOG_ERROR( LOG4CXX_STR("unable to set thread name") ); + } +diff --git a/src/main/include/CMakeLists.txt b/src/main/include/CMakeLists.txt +index e31443fb..32122e41 100644 +--- a/src/main/include/CMakeLists.txt ++++ b/src/main/include/CMakeLists.txt +@@ -39,9 +39,18 @@ endif() + + if(${LOG4CXX_CHAR} STREQUAL "unichar") + set(LOGCHAR_IS_UNICHAR 1) ++ set(LOGCHAR_IS_WCHAR 0) ++ set(LOGCHAR_IS_UTF8 0) + elseif(${LOG4CXX_CHAR} STREQUAL "wchar_t") + set(LOGCHAR_IS_WCHAR 1) ++ set(LOGCHAR_IS_UNICHAR 0) ++ set(LOGCHAR_IS_UTF8 0) ++elseif(${LOG4CXX_CHAR} STREQUAL "utf-8") ++ set(LOGCHAR_IS_UNICHAR 0) ++ set(LOGCHAR_IS_WCHAR 0) ++ set(LOGCHAR_IS_UTF8 1) + endif() ++ + option(LOG4CXX_WCHAR_T "Enable wchar_t API methods" ON) + option(LOG4CXX_UNICHAR "Enable UniChar API methods" OFF) + set(INIT_IOS_BASE 0) diff --git a/recipes/log4cxx/all/patches/0.13.0-0001-visual-studio-15.patch b/recipes/log4cxx/all/patches/0.13.0-0001-visual-studio-15.patch new file mode 100644 index 0000000000000..0c491ee579c3b --- /dev/null +++ b/recipes/log4cxx/all/patches/0.13.0-0001-visual-studio-15.patch @@ -0,0 +1,52 @@ +diff --git a/src/main/cpp/threadutility.cpp b/src/main/cpp/threadutility.cpp +index b57ab66..ef48704 100644 +--- a/src/main/cpp/threadutility.cpp ++++ b/src/main/cpp/threadutility.cpp +@@ -27,7 +27,11 @@ + #include + #endif + +-using log4cxx::helpers::ThreadUtility; ++namespace log4cxx ++{ ++namespace helpers ++{ ++ + + struct ThreadUtility::priv_data{ + priv_data(){ +@@ -36,9 +40,9 @@ struct ThreadUtility::priv_data{ + start_post = nullptr; + } + +- log4cxx::helpers::ThreadStartPre start_pre; +- log4cxx::helpers::ThreadStarted started; +- log4cxx::helpers::ThreadStartPost start_post; ++ ThreadStartPre start_pre; ++ ThreadStarted started; ++ ThreadStartPost start_post; + }; + + #if LOG4CXX_HAS_PTHREAD_SIGMASK +@@ -138,14 +142,18 @@ void ThreadUtility::postThreadUnblockSignals(){ + } + + +-log4cxx::helpers::ThreadStartPre ThreadUtility::preStartFunction(){ ++ThreadStartPre ThreadUtility::preStartFunction(){ + return m_priv->start_pre; + } + +-log4cxx::helpers::ThreadStarted ThreadUtility::threadStartedFunction(){ ++ThreadStarted ThreadUtility::threadStartedFunction(){ + return m_priv->started; + } + +-log4cxx::helpers::ThreadStartPost ThreadUtility::postStartFunction(){ ++ThreadStartPost ThreadUtility::postStartFunction(){ + return m_priv->start_post; + } ++ ++} //namespace helpers ++} //namespace log4cxx ++ diff --git a/recipes/log4cxx/all/patches/0001-find-apr.patch b/recipes/log4cxx/all/patches/0001-find-apr.patch deleted file mode 100644 index 11635d23e734f..0000000000000 --- a/recipes/log4cxx/all/patches/0001-find-apr.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -25,10 +25,12 @@ if(NOT BUILD_SHARED_LIBS) - endif() - - # Find Apache Runtime --find_package(APR REQUIRED) -+find_package(apr REQUIRED) -+set(APR_LIBRARIES apr::apr) - - # Find Apache Runtime Utilities --find_package(APR-Util REQUIRED) -+find_package(apr-util REQUIRED) -+set(APR_UTIL_LIBRARIES apr-util::apr-util) - - find_package( Threads REQUIRED ) - diff --git a/recipes/log4cxx/all/patches/1.1.0-0001-find-apr.patch b/recipes/log4cxx/all/patches/1.1.0-0001-find-apr.patch new file mode 100644 index 0000000000000..5b8a283a6e00a --- /dev/null +++ b/recipes/log4cxx/all/patches/1.1.0-0001-find-apr.patch @@ -0,0 +1,44 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 61c0479..6ac3e77 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -51,16 +51,18 @@ endif() + + # Find Apache Runtime + option(APR_STATIC "Link to the APR static library" OFF) +-find_package(APR REQUIRED) ++find_package(apr REQUIRED) ++set(APR_LIBRARIES apr::apr) + + # Find Apache Runtime Utilities + option(APU_STATIC "Link to the APR-Util static library" OFF) +-find_package(APR-Util REQUIRED) ++find_package(apr-util REQUIRED) ++set(APR_UTIL_LIBRARIES apr-util::apr-util) + + find_package( Threads REQUIRED ) + + # Find expat for XML parsing +-find_package(EXPAT REQUIRED) ++find_package(EXPAT REQUIRED MODULE) + if(TARGET EXPAT::EXPAT) + set(EXPAT_LIBRARIES EXPAT::EXPAT) + elseif(TARGET expat::expat) +@@ -134,7 +136,7 @@ install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/main/include/log4cxx + ) + + install(TARGETS log4cxx EXPORT log4cxxTargets +- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +@@ -171,7 +173,7 @@ if(UNIX) + "${CMAKE_CURRENT_BINARY_DIR}/liblog4cxx.pc" + ) + +- install(FILES "${CMAKE_CURRENT_BINARY_DIR}/liblog4cxx.pc" ++ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/liblog4cxx.pc" + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) + + if(LOG4CXX_QT_SUPPORT) diff --git a/recipes/log4cxx/all/patches/1.2.0-0001-find-apr.patch b/recipes/log4cxx/all/patches/1.2.0-0001-find-apr.patch new file mode 100644 index 0000000000000..03f1b1478ec0e --- /dev/null +++ b/recipes/log4cxx/all/patches/1.2.0-0001-find-apr.patch @@ -0,0 +1,26 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 61c0479..6ac3e77 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -51,16 +51,18 @@ endif() + + # Find Apache Runtime + option(APR_STATIC "Link to the APR static library" OFF) +-find_package(APR REQUIRED) ++find_package(apr REQUIRED) ++set(APR_LIBRARIES apr::apr) + + # Find Apache Runtime Utilities + option(APU_STATIC "Link to the APR-Util static library" OFF) +-find_package(APR-Util REQUIRED) ++find_package(apr-util REQUIRED) ++set(APR_UTIL_LIBRARIES apr-util::apr-util) + + find_package( Threads REQUIRED ) + + # Find expat for XML parsing +-find_package(EXPAT REQUIRED) ++find_package(EXPAT REQUIRED MODULE) + if(TARGET EXPAT::EXPAT) + set(EXPAT_LIBRARIES EXPAT::EXPAT) + elseif(TARGET expat::expat) diff --git a/recipes/log4cxx/all/test_package/CMakeLists.txt b/recipes/log4cxx/all/test_package/CMakeLists.txt index 4b7ef0dd16dbb..da8e02ac1cd82 100644 --- a/recipes/log4cxx/all/test_package/CMakeLists.txt +++ b/recipes/log4cxx/all/test_package/CMakeLists.txt @@ -1,11 +1,9 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) find_package(log4cxx REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} log4cxx) target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_17) +target_include_directories(${PROJECT_NAME} PRIVATE ${log4cxx_INCLUDE_DIR}) +target_link_libraries(${PROJECT_NAME} PRIVATE log4cxx ) diff --git a/recipes/log4cxx/all/test_package/conanfile.py b/recipes/log4cxx/all/test_package/conanfile.py index 0aa45c8d4db18..c27e4673f4ff9 100644 --- a/recipes/log4cxx/all/test_package/conanfile.py +++ b/recipes/log4cxx/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,7 +20,8 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): + if can_run(self): config_xml_name = os.path.join(self.source_folder, "log4cxx_config.xml") - bin_path = os.path.join("bin", "test_package") - self.run("{} {}".format(bin_path, config_xml_name), run_environment=True) + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run("{} {}".format(bin_path, config_xml_name), env="conanrun") + diff --git a/recipes/log4cxx/all/test_package/test_package.cpp b/recipes/log4cxx/all/test_package/test_package.cpp index 4e52b04611957..41abd554c33f4 100644 --- a/recipes/log4cxx/all/test_package/test_package.cpp +++ b/recipes/log4cxx/all/test_package/test_package.cpp @@ -1,20 +1,18 @@ -#include "log4cxx/logger.h" +#include "log4cxx/logmanager.h" #include "log4cxx/xml/domconfigurator.h" #include -using namespace log4cxx; -using namespace log4cxx::xml; - int main(int argc, const char* argv[]) { - LoggerPtr logger(Logger::getLogger("TEST")); if (argc < 2) { - std::cerr << "Expected path to config xml\n"; + std::cerr << "Usage error. Expected an argument, the path to a xml configuration file\n"; return -1; } - DOMConfigurator::configure(argv[1]); - LOG4CXX_INFO(logger, "App started!"); - LOG4CXX_ERROR(logger, "Some error!"); + log4cxx::xml::DOMConfigurator::configure(argv[1]); + auto logger = log4cxx::LogManager::getLogger("TEST"); + LOG4CXX_INFO(logger, "App started"); + LOG4CXX_ERROR(logger, "Information message"); + log4cxx::LogManager::shutdown(); return 0; } diff --git a/recipes/log4cxx/all/test_v1_package/CMakeLists.txt b/recipes/log4cxx/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/log4cxx/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/log4cxx/all/test_v1_package/conanfile.py b/recipes/log4cxx/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..0aa45c8d4db18 --- /dev/null +++ b/recipes/log4cxx/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): + config_xml_name = os.path.join(self.source_folder, "log4cxx_config.xml") + bin_path = os.path.join("bin", "test_package") + self.run("{} {}".format(bin_path, config_xml_name), run_environment=True) diff --git a/recipes/log4cxx/config.yml b/recipes/log4cxx/config.yml index f5578f6ffba14..fb792fbdf460c 100644 --- a/recipes/log4cxx/config.yml +++ b/recipes/log4cxx/config.yml @@ -1,5 +1,9 @@ versions: - "0.12.1": + "1.2.0": + folder: all + "1.1.0": folder: all - "0.12.0": + "0.13.0": + folder: all + "0.12.1": folder: all diff --git a/recipes/logfault/all/conandata.yml b/recipes/logfault/all/conandata.yml new file mode 100644 index 0000000000000..4ef9e5e9edbe3 --- /dev/null +++ b/recipes/logfault/all/conandata.yml @@ -0,0 +1,5 @@ +sources: + 0.5.2: + url: + - https://github.com/jgaa/logfault/archive/refs/tags/v0.5.2.tar.gz + sha256: b6c7a4faca340bb7e3105c2094acd2afd52ce1bcfbe7e3ed2233c1ec933a904f diff --git a/recipes/logfault/all/conanfile.py b/recipes/logfault/all/conanfile.py new file mode 100644 index 0000000000000..d93b9976fa00f --- /dev/null +++ b/recipes/logfault/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 copy, get +from conan.tools.layout import basic_layout +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeToolchain +import os + + +required_conan_version = ">=1.52.0" + + +class PackageConan(ConanFile): + name = "logfault" + description = "Simple to use, header only C++ library for application-logging on all major platforms." + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/jgaa/logfault" + topics = ("logging", "header-only") + package_type = "header-library" + 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": "191", + "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, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + copy( + self, + "*.h", + os.path.join(self.source_folder, "include"), + os.path.join(self.package_folder, "include"), + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + diff --git a/recipes/logfault/all/test_package/CMakeLists.txt b/recipes/logfault/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..fcdef5afc6817 --- /dev/null +++ b/recipes/logfault/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(LOGFAULT REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE logfault::logfault) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/logfault/all/test_package/conanfile.py b/recipes/logfault/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0a808db45f245 --- /dev/null +++ b/recipes/logfault/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/logfault/all/test_package/test_package.cpp b/recipes/logfault/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..a80ce4ba7c1ff --- /dev/null +++ b/recipes/logfault/all/test_package/test_package.cpp @@ -0,0 +1,13 @@ + +// General tests for manual testing during development + +#include +#include "logfault/logfault.h" + +using namespace std; + +int main( int argc, char *argv[]) { + + logfault::LogManager::Instance().AddHandler(std::make_unique(clog, logfault::LogLevel::DEBUGGING)); + LFLOG_INFO << "Testing" << 1 << 2 << 3; +} diff --git a/recipes/logfault/config.yml b/recipes/logfault/config.yml new file mode 100644 index 0000000000000..ccf525f369b0e --- /dev/null +++ b/recipes/logfault/config.yml @@ -0,0 +1,3 @@ +versions: + "0.5.2": + folder: all diff --git a/recipes/logr/0.1.0/CMakeLists.txt b/recipes/logr/0.1.0/CMakeLists.txt deleted file mode 100644 index c21cb501798d1..0000000000000 --- a/recipes/logr/0.1.0/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.14) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder/logr) diff --git a/recipes/logr/0.1.0/conandata.yml b/recipes/logr/0.1.0/conandata.yml index 368303bc2a36c..bd261e654fa90 100644 --- a/recipes/logr/0.1.0/conandata.yml +++ b/recipes/logr/0.1.0/conandata.yml @@ -2,3 +2,8 @@ sources: "0.1.0": url: "https://github.com/ngrodzitski/logr/archive/v0.1.0.tar.gz" sha256: "6b2e68b6425362f678b7485cd2c8cef7db377ac8ccd45646c84941b189b0b82d" +patches: + "0.1.0": + - patch_file: "patches/0001-fix-cmake.patch" + patch_description: "correct the order of cmake min and project" + patch_type: "conan" diff --git a/recipes/logr/0.1.0/conanfile.py b/recipes/logr/0.1.0/conanfile.py index a3500eef56a0a..81afa6869020b 100644 --- a/recipes/logr/0.1.0/conanfile.py +++ b/recipes/logr/0.1.0/conanfile.py @@ -1,97 +1,104 @@ -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, 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 LogrConan(ConanFile): name = "logr" - license = "BSD 3-Clause License" - homepage = "https://github.com/ngrodzitski/logr" - url = "https://github.com/conan-io/conan-center-index" description = "Logger frontend substitution for spdlog, glog, etc for server/desktop applications" + license = "BSD-3-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/ngrodzitski/logr" topics = ("logger", "development", "util", "utils") - generators = "cmake" - settings = "os", "compiler", "build_type", "arch" - exports_sources = ["CMakeLists.txt"] - - options = { "backend": ["spdlog", "glog", "log4cplus", "log4cplus-unicode", None] } - default_options = { "backend": "spdlog"} - - _cmake = None + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + options = { + "backend": ["spdlog", "glog", "log4cplus", "log4cplus-unicode", None], + } + default_options = { + "backend": "spdlog", + } @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 17 @property - def _build_subfolder(self): - return "build_subfolder" - - def requirements(self): - self.requires("fmt/7.1.2") - - if self.options.backend == "spdlog": - self.requires("spdlog/1.8.0") - elif self.options.backend == "glog": - self.requires("glog/0.4.0") - elif self.options.backend == "log4cplus": - self.requires("log4cplus/2.0.5") - elif self.options.backend == "log4cplus-unicode": - self.requires("log4cplus/2.0.5") - - def configure(self): - minimal_cpp_standard = "17" - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, minimal_cpp_standard) - minimal_version = { + def _compilers_minimum_version(self): + return { "gcc": "7", "clang": "7", "apple-clang": "10", - "Visual Studio": "16" + "Visual Studio": "16", + "msvc": "192", } - 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 export_sources(self): + export_conandata_patches(self) - def _configure_cmake(self): - if self._cmake: - return self._cmake + def layout(self): + cmake_layout(self, src_folder="src") - self._cmake = CMake(self) - self._cmake.definitions["LOGR_WITH_SPDLOG_BACKEND"] = self.options.backend == "spdlog" - self._cmake.definitions["LOGR_WITH_GLOG_BACKEND"] = self.options.backend == "glog" - self._cmake.definitions["LOGR_WITH_LOG4CPLUS_BACKEND"] = self.options.backend in ["log4cplus", "log4cplus-unicode"] - - self._cmake.definitions["LOGR_INSTALL"] = True - - self._cmake.configure( build_folder=self._build_subfolder ) - return self._cmake - - 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 requirements(self): + self.requires("fmt/10.2.0") + if self.options.backend == "spdlog": + self.requires("spdlog/1.13.0") + elif self.options.backend == "glog": + self.requires("glog/0.6.0") + elif self.options.backend in ["log4cplus", "log4cplus-unicode"]: + self.requires("log4cplus/2.1.1") - def build(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) + 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.backend == "log4cplus" and self.options["log4cplus"].unicode: raise ConanInvalidConfiguration("backend='log4cplus' requires log4cplus:unicode=False") elif self.options.backend == "log4cplus-unicode" and not self.options["log4cplus"].unicode: raise ConanInvalidConfiguration("backend='log4cplus-unicode' requires log4cplus:unicode=True") + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["LOGR_WITH_SPDLOG_BACKEND"] = self.options.backend == "spdlog" + tc.cache_variables["LOGR_WITH_GLOG_BACKEND"] = self.options.backend == "glog" + tc.cache_variables["LOGR_WITH_LOG4CPLUS_BACKEND"] = self.options.backend in ["log4cplus", "log4cplus-unicode"] + tc.cache_variables["LOGR_INSTALL"] = True + tc.cache_variables["LOGR_BUILD_TESTS"] = False + tc.cache_variables["LOGR_BUILD_EXAMPLES"] = False + tc.cache_variables["LOGR_BUILD_BENCHMARKS"] = False + tc.generate() + dpes = CMakeDeps(self) + dpes.generate() + + def build(self): + 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")) + rmdir(self, os.path.join(self.package_folder, "lib")) - def package_id(self): - self.info.header_only() + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/logr/0.1.0/patches/0001-fix-cmake.patch b/recipes/logr/0.1.0/patches/0001-fix-cmake.patch new file mode 100644 index 0000000000000..e806e32f6aa85 --- /dev/null +++ b/recipes/logr/0.1.0/patches/0001-fix-cmake.patch @@ -0,0 +1,61 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index e8c2ce1..be74c3d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -4,13 +4,6 @@ cmake_minimum_required(VERSION 3.14) + + set(logr_root_prj logr_root) + +-include("${CMAKE_CURRENT_SOURCE_DIR}/cmake-scripts/cpp_standard.cmake") +-include("${CMAKE_CURRENT_SOURCE_DIR}/cmake-scripts/libcxx.cmake") +-include( "${CMAKE_CURRENT_SOURCE_DIR}/cmake-scripts/static_runtime.cmake" ) +- +-message(STATUS "ENABLE C++17") +-cxx_17() +- + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + + # ------------------------------------------------------------------------------ +@@ -30,8 +23,6 @@ message( STATUS "Use package manager: ${LOGR_PKG_PROVIDER}") + + + if( "${logr_pkg_provider_lowercase}" STREQUAL "conan" ) +- set(CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR} ${CMAKE_MODULE_PATH}) +- set(CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR} ${CMAKE_PREFIX_PATH}) + elseif ( "${logr_pkg_provider_lowercase}" STREQUAL "vcpkg" ) + if( NOT CMAKE_TOOLCHAIN_FILE ) + message( FATAL_ERROR "CMAKE_TOOLCHAIN_FILE must be defined when using vcpkg") +@@ -65,18 +56,6 @@ option(LOGR_WITH_LOG4CPLUS_BACKEND "Provide logr with log4cplus backend" ON) + # ------------------------------------------------------------------------------ + + project(${logr_root_prj} CXX) +-handle_explicit_libcxx_if_necessary() +-handle_explicit_static_runtime_if_necessary() +- +-# ------------------------------------------------------------------------------ +-# Various helpers: +-include("${CMAKE_CURRENT_SOURCE_DIR}/cmake-scripts/common_options.cmake") +-include("${CMAKE_CURRENT_SOURCE_DIR}/cmake-scripts/compiler_flags.cmake") +-include("${CMAKE_CURRENT_SOURCE_DIR}/cmake-scripts/find_program_required.cmake") +-include("${CMAKE_CURRENT_SOURCE_DIR}/cmake-scripts/append_src_files.cmake") +-include("${CMAKE_CURRENT_SOURCE_DIR}/cmake-scripts/link_threads_if_necessary.cmake") +-include( "${CMAKE_CURRENT_SOURCE_DIR}/cmake-scripts/static_analysis.cmake" ) +-# ------------------------------------------------------------------------------ + + # ------------------------------------------------------------------------------ + # A piece to define hint for pretty source files paths. +@@ -98,6 +77,14 @@ else () + endif () + # ------------------------------------------------------------------------------ + ++ ++message(STATUS "*** dump start cmake variables ***") ++get_cmake_property(_variableNames VARIABLES) ++foreach(_variableName ${_variableNames}) ++ message(STATUS "${_variableName}=${${_variableName}}") ++endforeach() ++message(STATUS "*** dump end ***") ++ + find_package(fmt REQUIRED) + + if (LOGR_WITH_SPDLOG_BACKEND) diff --git a/recipes/logr/0.1.0/test_package/CMakeLists.txt b/recipes/logr/0.1.0/test_package/CMakeLists.txt index cd3eca474d6d3..f0b27f088f57f 100644 --- a/recipes/logr/0.1.0/test_package/CMakeLists.txt +++ b/recipes/logr/0.1.0/test_package/CMakeLists.txt @@ -1,13 +1,8 @@ -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) -set(CMAKE_CXX_STANDARD 17) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS OFF) +find_package(logr REQUIRED CONFIG) -project(PackageTest CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - -add_executable(example example.cpp) -target_link_libraries(example ${CONAN_LIBS}) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE logr::logr) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/logr/0.1.0/test_package/conanfile.py b/recipes/logr/0.1.0/test_package/conanfile.py index b862d3bd0137e..ef5d7042163ec 100644 --- a/recipes/logr/0.1.0/test_package/conanfile.py +++ b/recipes/logr/0.1.0/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" + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/logr/0.1.0/test_package/example.cpp b/recipes/logr/0.1.0/test_package/example.cpp deleted file mode 100644 index e80e0e10f0233..0000000000000 --- a/recipes/logr/0.1.0/test_package/example.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include - -#include - -#include -#include - -auto make_logger() -{ - auto sink = std::make_shared< spdlog::sinks::stdout_sink_st >(); - sink->set_pattern("[%Y-%m-%d %T][%n][%l] %v [%g]"); - - return logr::spdlog_logger_t<>{ - "console", - std::move( sink ), - logr::log_message_level::trace - }; -} - -int main() -{ - auto logger = make_logger(); - - logger.info( []( auto & out ){ - fmt::format_to( out, - "Welcome to logr (v{}.{}.{}), package is provided by Conan!", - LOGR_VERSION_MAJOR, - LOGR_VERSION_MINOR, - LOGR_VERSION_PATCH ); - } ); -} diff --git a/recipes/logr/0.1.0/test_package/test_package.cpp b/recipes/logr/0.1.0/test_package/test_package.cpp new file mode 100644 index 0000000000000..de16c1837fbb2 --- /dev/null +++ b/recipes/logr/0.1.0/test_package/test_package.cpp @@ -0,0 +1,30 @@ +#include +#include + +#include +#include + +auto make_logger() +{ + auto sink = std::make_shared< spdlog::sinks::stdout_sink_st >(); + sink->set_pattern("[%Y-%m-%d %T][%n][%l] %v [%g]"); + + return logr::spdlog_logger_t<>{ + "console", + std::move( sink ), + logr::log_message_level::trace + }; +} + +int main() +{ + auto logger = make_logger(); + + logger.info( []( auto & out ){ + format_to( std::back_inserter(out), + "Welcome to logr (v{}.{}.{}), package is provided by Conan!", + LOGR_VERSION_MAJOR, + LOGR_VERSION_MINOR, + LOGR_VERSION_PATCH ); + } ); +} diff --git a/recipes/logr/all/conandata.yml b/recipes/logr/all/conandata.yml index 9076e1decadad..3a291a696ec11 100644 --- a/recipes/logr/all/conandata.yml +++ b/recipes/logr/all/conandata.yml @@ -1,16 +1,19 @@ sources: - "0.2.0": - url: "https://github.com/ngrodzitski/logr/archive/v0.2.0.tar.gz" - sha256: "4e1707f9450f12b0752d8ef4d72a3f38a2e6be0014ca7edde049f22e9b9119a4" - "0.2.1": - url: "https://github.com/ngrodzitski/logr/archive/v0.2.1.tar.gz" - sha256: "411282bb03d678d7266951b979102392dbf7e5e14b629bccfb2c4e74cfa758c6" - "0.3.0": - url: "https://github.com/ngrodzitski/logr/archive/v0.3.0.tar.gz" - sha256: "21eea6cce32e3ccf3769f66211143b17f8b36891e79ec3ef5209f849d9e79ad7" - "0.4.0": - url: "https://github.com/ngrodzitski/logr/archive/v0.4.0.tar.gz" - sha256: "c355aa455d0a9c6d1d3bc168a2db0cd7f3c9706b382088e96948ec3a4cf1286f" + "0.6.0": + url: "https://github.com/ngrodzitski/logr/archive/v0.6.0.tar.gz" + sha256: "2ecb40396add33f2120a79957633533381f3df13cb3b53278eb9dec3a1230eb2" "0.5.1": url: "https://github.com/ngrodzitski/logr/archive/v0.5.1.tar.gz" sha256: "674be6a53d5b3f40273b1b5710ac9e32d870827032b5008c41621db47f4b3b0e" + "0.4.0": + url: "https://github.com/ngrodzitski/logr/archive/v0.4.0.tar.gz" + sha256: "c355aa455d0a9c6d1d3bc168a2db0cd7f3c9706b382088e96948ec3a4cf1286f" + "0.3.0": + url: "https://github.com/ngrodzitski/logr/archive/v0.3.0.tar.gz" + sha256: "21eea6cce32e3ccf3769f66211143b17f8b36891e79ec3ef5209f849d9e79ad7" + "0.2.1": + url: "https://github.com/ngrodzitski/logr/archive/v0.2.1.tar.gz" + sha256: "411282bb03d678d7266951b979102392dbf7e5e14b629bccfb2c4e74cfa758c6" + "0.2.0": + url: "https://github.com/ngrodzitski/logr/archive/v0.2.0.tar.gz" + sha256: "4e1707f9450f12b0752d8ef4d72a3f38a2e6be0014ca7edde049f22e9b9119a4" diff --git a/recipes/logr/all/conanfile.py b/recipes/logr/all/conanfile.py index ee7363a51c446..7f984ac3075da 100644 --- a/recipes/logr/all/conanfile.py +++ b/recipes/logr/all/conanfile.py @@ -1,122 +1,119 @@ -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" - license = "BSD-3-Clause" - homepage = "https://github.com/ngrodzitski/logr" - url = "https://github.com/conan-io/conan-center-index" description = ( "Logger frontend substitution for spdlog, glog, etc " "for server/desktop applications" ) + license = "BSD-3-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/ngrodzitski/logr" 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 + settings = "os", "arch", "compiler", "build_type" + options = { + "backend": ["spdlog", "glog", "log4cplus", "boostlog", None], + } + default_options = { + "backend": "spdlog", + } - @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 self.options.backend != "spdlog": + fmt_ref = "fmt/10.0.0" + elif 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.10.0" + + 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") + self.requires("log4cplus/2.1.0") elif self.options.backend == "boostlog": - self.requires("boost/1.77.0") + self.requires("boost/1.82.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..5e62d2b8b4d92 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 LANGUAGES CXX) find_package(logr REQUIRED) -add_executable(example example.cpp) -target_link_libraries(example logr::logr) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE 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..f5cf204295e19 100644 --- a/recipes/logr/all/test_package/conanfile.py +++ b/recipes/logr/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 LogrTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/logr/all/test_package/example.cpp b/recipes/logr/all/test_package/test_package.cpp similarity index 100% rename from recipes/logr/all/test_package/example.cpp rename to recipes/logr/all/test_package/test_package.cpp 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..77c0a1e824e62 --- /dev/null +++ b/recipes/logr/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(logr REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.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 c1a11eb732221..afa3309f2914c 100644 --- a/recipes/logr/config.yml +++ b/recipes/logr/config.yml @@ -1,13 +1,17 @@ versions: - "0.1.0": - folder: 0.1.0 - "0.2.0": + "0.7.0": + folder: v0.7 + "0.6.0": folder: all - "0.2.1": + "0.5.1": + folder: all + "0.4.0": folder: all "0.3.0": folder: all - "0.4.0": + "0.2.1": folder: all - "0.5.1": + "0.2.0": folder: all + "0.1.0": + folder: 0.1.0 diff --git a/recipes/logr/v0.7/conandata.yml b/recipes/logr/v0.7/conandata.yml new file mode 100644 index 0000000000000..745404ba635bc --- /dev/null +++ b/recipes/logr/v0.7/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.7.0": + url: "https://github.com/ngrodzitski/logr/archive/v0.7.0.tar.gz" + sha256: "b43b6624a9223bcb0a11c83afb3df69ef4388d42abef9abb1b80fbc85b890287" diff --git a/recipes/logr/v0.7/conanfile.py b/recipes/logr/v0.7/conanfile.py new file mode 100644 index 0000000000000..7eee46ae5d249 --- /dev/null +++ b/recipes/logr/v0.7/conanfile.py @@ -0,0 +1,140 @@ +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy, rm +from conan.tools.layout import basic_layout +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import check_min_vs +import os + +required_conan_version = ">=1.50.0" + + +class LogrConan(ConanFile): + name = "logr" + description = ( + "Logger frontend substitution for spdlog, glog, etc " + "for server/desktop applications" + ) + license = "BSD-3-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/ngrodzitski/logr" + topics = ("logger", "development", "util", "utils", "header-only") + settings = "os", "arch", "compiler", "build_type" + package_type = "header-library" + options = { + "with_spdlog": [True, False], + "with_glog": [True, False], + "with_log4cplus": [True, False], + "with_boostlog": [True, False], + } + default_options = { + "with_spdlog": True, + "with_glog": False, + "with_log4cplus": False, + "with_boostlog": False, + } + + @property + def _min_cppstd(self): + return 17 + + @property + def _minimum_compilers_version(self): + return { + "gcc": "10", + "clang": "11", + "apple-clang": "12", + } + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("fmt/10.2.1") + + if self.options.with_spdlog: + self.requires("spdlog/1.12.0") + + if self.options.with_glog: + self.requires("glog/0.6.0") + + if self.options.with_log4cplus: + self.requires("log4cplus/2.1.0") + + if self.options.with_boostlog: + self.requires("boost/1.83.0") + + def package_id(self): + self.info.settings.clear() + + def validate(self): + if self.settings.get_safe("compiler.cppstd"): + check_min_cppstd(self, self._min_cppstd) + + check_min_vs(self, 192) + + 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 minimum {self.settings.compiler} version of {minimum_version}" + ) + + def build(self): + pass + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def package(self): + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*.*pp", src=os.path.join(self.source_folder, "logr", "include"), dst=os.path.join(self.package_folder, "include")) + + include_folder = os.path.join(self.package_folder, "include", "logr") + if not self.options.with_spdlog: + rm(self, "spdlog_backend.hpp", include_folder) + + if not self.options.with_glog: + rm(self, "glog_backend.hpp", include_folder) + + if not self.options.with_log4cplus: + rm(self, "log4cplus_backend.hpp", include_folder) + + if not self.options.with_boostlog: + rm(self, "boostlog_backend.hpp", include_folder) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + self.cpp_info.components["logr_base"].includedirs = ["include"] + self.cpp_info.components["logr_base"].requires = ["fmt::fmt"] + + if self.options.with_spdlog: + self.cpp_info.components["logr_spdlog"].includedirs = [] + self.cpp_info.components["logr_spdlog"].requires = [ + "logr_base", + "spdlog::spdlog", + ] + + if self.options.with_glog: + self.cpp_info.components["logr_glog"].includedirs = [] + self.cpp_info.components["logr_glog"].requires = [ + "logr_base", + "glog::glog", + ] + + if self.options.with_log4cplus: + self.cpp_info.components["logr_log4cplus"].includedirs = [] + self.cpp_info.components["logr_log4cplus"].requires = [ + "logr_base", + "log4cplus::log4cplus", + ] + + if self.options.with_boostlog: + self.cpp_info.components["logr_boostlog"].includedirs = [] + self.cpp_info.components["logr_boostlog"].requires = [ + "logr_base", + "boost::log", + ] diff --git a/recipes/logr/v0.7/test_package/CMakeLists.txt b/recipes/logr/v0.7/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..5e62d2b8b4d92 --- /dev/null +++ b/recipes/logr/v0.7/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(logr REQUIRED) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE logr::logr) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/logr/v0.7/test_package/conanfile.py b/recipes/logr/v0.7/test_package/conanfile.py new file mode 100644 index 0000000000000..f5cf204295e19 --- /dev/null +++ b/recipes/logr/v0.7/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/logr/v0.7/test_package/test_package.cpp b/recipes/logr/v0.7/test_package/test_package.cpp new file mode 100644 index 0000000000000..27d9ac363797b --- /dev/null +++ b/recipes/logr/v0.7/test_package/test_package.cpp @@ -0,0 +1,46 @@ +// Logger frontend library for C++. +// +// Copyright (c) 2020 - present, Nicolai Grodzitski +// See LICENSE file in the root of the project. + + +#include + +#include +#include + + +int main() { + auto logger = logr::basic_ostream_logger_t<1024u>(std::cout); + + logger.info( "Hello World! [raw message]" ); + logger.info( LOGR_SRC_LOCATION, "Hello World! [raw message]" ); + + logger.info( []() { return "Hello World! [cb]"; } ); + logger.info( LOGR_SRC_LOCATION, []() { return "Hello World! [cb]"; } ); + + logger.info( []( auto out ) { + format_to( out, "Hello {}! [{}]", "World", "cb with explicit out" ); + } ); + + logger.info( LOGR_SRC_LOCATION, []( auto out ) { + format_to( out, "Hello {}! [{}]", "World", "cb with explicit out" ); + } ); + logger.info( LOGR_SRC_LOCATION, []( auto out ) { + format_to( out, + FMT_STRING( "Hello {}! [{}]" ), + "World", + "cb with explicit out and FMT_STRING" ); + } ); + + logger.info( LOGR_SRC_LOCATION, []( auto out ) { + format_to( out, + fmt::runtime( "Hello {}! [{}]" ), + "World", + "cb with explicit out and runtime-string" ); + } ); + + logger.flush(); + + return 0; +} diff --git a/recipes/loguru/all/conandata.yml b/recipes/loguru/all/conandata.yml new file mode 100644 index 0000000000000..779d9ad6aa366 --- /dev/null +++ b/recipes/loguru/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "cci.20230406": + url: "https://github.com/emilk/loguru/archive/4adaa185883e3c04da25913579c451d3c32cfac1.tar.gz" + sha256: "1424f3ce814fa413e5fbdf2949994d455e3914560f958d2931ba869349a686a8" diff --git a/recipes/loguru/all/conanfile.py b/recipes/loguru/all/conanfile.py new file mode 100644 index 0000000000000..8f740c8665ca6 --- /dev/null +++ b/recipes/loguru/all/conanfile.py @@ -0,0 +1,145 @@ +import os + +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout +from conan.tools.microsoft import is_msvc +from conan.tools.files import get, load, save, rmdir, rm +from conan.tools.build import check_min_cppstd + + +required_conan_version = ">=1.53.0" + + +class LoguruConan(ConanFile): + name = "loguru" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/emilk/loguru" + license = "Unlicense" + topics = ("logging", "log", "fmt") + description = "Loguru is a C++11 logging library." + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_fmt": [True, False], + "verbose_scope_endings": [True, False], + "redefine_assert": [True, False], + "enable_streams": [True, False], + "enable_fileabs": [True, False], + "replace_glog": [True, False], + + "scope_text_size": [None, "ANY"], + "scope_time_precision": [None, "ANY"], + "filename_width": [None, "ANY"], + "threadname_width": [None, "ANY"], + } + + default_options = { + "shared": False, + "fPIC": True, + "with_fmt": False, + "verbose_scope_endings": True, + "redefine_assert": False, + "enable_streams": False, + "enable_fileabs": False, + "replace_glog": False, + "scope_text_size": 196, + "scope_time_precision": 3, + "filename_width": 23, + "threadname_width": 16, + } + + 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): + if self.options.with_fmt: + self.requires("fmt/9.1.0", transitive_headers=True) + + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, 11) + + if self.options.replace_glog and not self.options.enable_streams: + # https://github.com/emilk/loguru/blob/4adaa185883e3c04da25913579c451d3c32cfac1/docs/index.html#L692 + raise ConanInvalidConfiguration(f"{self.ref}:replace_glog needs {self.ref}:enable_streams=True") + + def source(self): + 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["LOGURU_USE_FMTLIB"] = self.options.with_fmt + tc.variables["LOGURU_VERBOSE_SCOPE_ENDINGS"] = self.options.verbose_scope_endings + tc.variables["LOGURU_REDEFINE_ASSERT"] = self.options.redefine_assert + tc.variables["LOGURU_WITH_STREAMS"] = self.options.enable_streams + tc.variables["LOGURU_WITH_FILEABS"] = self.options.enable_fileabs + tc.variables["LOGURU_REPLACE_GLOG"] = self.options.replace_glog + + tc.variables["LOGURU_SCOPE_TEXT_SIZE"] = self.options.scope_text_size + tc.variables["LOGURU_SCOPE_TIME_PRECISION"] = self.options.scope_time_precision + tc.variables["LOGURU_FILENAME_WIDTH"] = self.options.filename_width + tc.variables["LOGURU_THREADNAME_WIDTH"] = self.options.threadname_width + + if is_msvc(self) and self.options.shared: + tc.preprocessor_definitions["LOGURU_EXPORT"] = "__declspec(dllexport)" + tc.generate() + + deps = CMakeDeps(self) + deps.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + @property + def _extracted_license(self): + tmp = load(self, os.path.join(self.source_folder, 'loguru.hpp')) + return tmp[2:tmp.find("# Inspiration", 0)].strip() + + def package(self): + save(self, os.path.join(self.package_folder, 'licenses', 'LICENSE'), self._extracted_license) + 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")) + rm(self, "*.pdb", os.path.join(self.package_folder, "lib")) + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + + def package_info(self): + suffix = "d" if self.settings.build_type == "Debug" else "" + self.cpp_info.libs = [f"loguru{suffix}"] + self.cpp_info.includedirs = [os.path.join("include", "loguru")] + # https://github.com/emilk/loguru/blob/4adaa185883e3c04da25913579c451d3c32cfac1/CMakeLists.txt#L301 + self.cpp_info.set_property("cmake_file_name", "loguru") + self.cpp_info.set_property("cmake_target_name", "loguru::loguru") + + # render each option as either 0 or 1 for loguru's #if preprocessor commands + self.cpp_info.defines.append(f"LOGURU_USE_FMTLIB={bool(self.options.with_fmt)*1}") + self.cpp_info.defines.append(f"LOGURU_VERBOSE_SCOPE_ENDINGS={bool(self.options.verbose_scope_endings)*1}") + self.cpp_info.defines.append(f"LOGURU_REDEFINE_ASSERT={bool(self.options.redefine_assert)*1}") + self.cpp_info.defines.append(f"LOGURU_WITH_STREAMS={bool(self.options.enable_streams)*1}") + self.cpp_info.defines.append(f"LOGURU_WITH_FILEABS={bool(self.options.enable_fileabs)*1}") + self.cpp_info.defines.append(f"LOGURU_REPLACE_GLOG={bool(self.options.replace_glog)*1}") + + self.cpp_info.defines.append(f"LOGURU_SCOPE_TEXT_SIZE={self.options.scope_text_size}") + self.cpp_info.defines.append(f"LOGURU_SCOPE_TIME_PRECISION={self.options.scope_time_precision}") + self.cpp_info.defines.append(f"LOGURU_FILENAME_WIDTH={self.options.filename_width}") + self.cpp_info.defines.append(f"LOGURU_THREADNAME_WIDTH={self.options.threadname_width}") + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs = ["pthread", "dl", "m"] diff --git a/recipes/loguru/all/test_package/CMakeLists.txt b/recipes/loguru/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..aba0bad284220 --- /dev/null +++ b/recipes/loguru/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(loguru REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PUBLIC loguru::loguru) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/loguru/all/test_package/conanfile.py b/recipes/loguru/all/test_package/conanfile.py new file mode 100644 index 0000000000000..543315cd0fbb8 --- /dev/null +++ b/recipes/loguru/all/test_package/conanfile.py @@ -0,0 +1,31 @@ +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 = "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/loguru/all/test_package/test_package.cpp b/recipes/loguru/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..58460d1478be0 --- /dev/null +++ b/recipes/loguru/all/test_package/test_package.cpp @@ -0,0 +1,29 @@ +// Partially taken from: https://github.com/emilk/loguru/tree/master/loguru_example + +#include +#include +#include +#include + +inline void sleep_ms(int ms) +{ + VLOG_F(2, "Sleeping for %d ms", ms); + std::this_thread::sleep_for(std::chrono::milliseconds(ms)); +} + +inline void complex_calculation() +{ + LOG_SCOPE_F(INFO, "complex_calculation"); + LOG_F(INFO, "Starting time machine..."); + LOG_F(WARNING, "The flux capacitor is not getting enough power!"); + LOG_F(INFO, "Lighting strike!"); + VLOG_F(1, "Found 1.21 gigawatts..."); +} + +int main(int argc, char *argv[]) +{ + loguru::init(argc, argv); + LOG_F(INFO, "Hello from main.cpp!"); + complex_calculation(); + LOG_F(INFO, "main function about to end!"); +} diff --git a/recipes/loguru/all/test_v1_package/CMakeLists.txt b/recipes/loguru/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/loguru/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/loguru/all/test_v1_package/conanfile.py b/recipes/loguru/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/loguru/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/loguru/config.yml b/recipes/loguru/config.yml new file mode 100644 index 0000000000000..82675897e9768 --- /dev/null +++ b/recipes/loguru/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20230406": + folder: all diff --git a/recipes/ls-qpack/all/CMakeLists.txt b/recipes/ls-qpack/all/CMakeLists.txt new file mode 100644 index 0000000000000..6db820d134e2e --- /dev/null +++ b/recipes/ls-qpack/all/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.15) +project(cmake_wrapper) + +add_subdirectory(src) + +install( + TARGETS ls-qpack + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +) +install(FILES src/lsqpack.h DESTINATION include) + +if(WIN32) + install(DIRECTORY src/wincompat DESTINATION include) +endif() diff --git a/recipes/ls-qpack/all/conandata.yml b/recipes/ls-qpack/all/conandata.yml new file mode 100644 index 0000000000000..e0937f2a8bc1f --- /dev/null +++ b/recipes/ls-qpack/all/conandata.yml @@ -0,0 +1,23 @@ +sources: + "2.5.4": + url: "https://github.com/litespeedtech/ls-qpack/archive/refs/tags/v2.5.4.tar.gz" + sha256: "56b96190a1943d75ef8d384b13cd4592a72e3e2d84284f78d7f8adabbc717f3e" + "2.5.3": + url: "https://github.com/litespeedtech/ls-qpack/archive/refs/tags/v2.5.3.tar.gz" + sha256: "075a05efee27961eac5ac92a12a6e28a61bcd6c122a0276938ef993338577337" + "2.5.1": + url: "https://github.com/litespeedtech/ls-qpack/archive/refs/tags/v2.5.1.tar.gz" + sha256: "dae1c159afc8541d51c12f5ad78209fe092815d37cb621b5ee46a9db049a283f" +patches: + "2.5.4": + - patch_file: "patches/2.5.1-0001-use-cci-package.patch" + patch_description: "use cci packages" + patch_type: "conan" + "2.5.3": + - patch_file: "patches/2.5.1-0001-use-cci-package.patch" + patch_description: "use cci packages" + patch_type: "conan" + "2.5.1": + - patch_file: "patches/2.5.1-0001-use-cci-package.patch" + patch_description: "use cci packages" + 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..d1d1a2870f42b --- /dev/null +++ b/recipes/ls-qpack/all/conanfile.py @@ -0,0 +1,78 @@ +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) + 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: + 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.2") + + 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(build_script_folder=self.source_path.parent) + 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/2.5.1-0001-use-cci-package.patch b/recipes/ls-qpack/all/patches/2.5.1-0001-use-cci-package.patch new file mode 100644 index 0000000000000..4dd248246392c --- /dev/null +++ b/recipes/ls-qpack/all/patches/2.5.1-0001-use-cci-package.patch @@ -0,0 +1,12 @@ +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -20,7 +20,7 @@ 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() 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..7b62b895ae661 --- /dev/null +++ b/recipes/ls-qpack/config.yml @@ -0,0 +1,7 @@ +versions: + "2.5.4": + folder: all + "2.5.3": + folder: all + "2.5.1": + folder: all diff --git a/recipes/lua/all/CMakeLists.txt b/recipes/lua/all/CMakeLists.txt index 5c9c34c634730..e3f4b3962a3a1 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") @@ -68,46 +63,36 @@ IF (UNIX) ENDIF () ENDIF () +include(GNUInstallDirs) + INSTALL ( TARGETS lua - RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin - LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib - ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ) -IF (NOT DEFINED SKIP_INSTALL_TOOLS) +IF (NOT SKIP_INSTALL_TOOLS) ADD_EXECUTABLE ( luac ${SRC_LUAC} ${SRC_LIBLUA} ) # compiler uses non-exported APIs, so must include sources directly. ADD_EXECUTABLE ( luai ${SRC_LUAI} ) # interpreter TARGET_LINK_LIBRARIES ( luai lua ) SET_TARGET_PROPERTIES ( luai PROPERTIES OUTPUT_NAME lua PDB_NAME luai ) - IF (UNIX) - IF (CMAKE_SYSTEM_NAME STREQUAL FreeBSD) - SET (_LIB_READLINE_NAME edit) - ELSE () - SET (_LIB_READLINE_NAME readline) - ENDIF () - FIND_LIBRARY (LIB_READLINE NAMES ${_LIB_READLINE_NAME}) - IF (LIB_READLINE) - TARGET_COMPILE_DEFINITIONS (luai PUBLIC -DLUA_USE_READLINE) - TARGET_LINK_LIBRARIES(luai ${LIB_READLINE}) - IF (_LIB_READLINE_NAME STREQUAL edit) - TARGET_INCLUDE_DIRECTORIES (luai PUBLIC /usr/include/edit) - ENDIF () - ENDIF () + IF (WITH_READLINE) + find_package(readline REQUIRED CONFIG) + TARGET_COMPILE_DEFINITIONS (luai PUBLIC -DLUA_USE_READLINE) + TARGET_LINK_LIBRARIES(luai readline::readline) ENDIF () - INSTALL ( TARGETS luai luac RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/tools/lua ) + INSTALL ( TARGETS luai luac RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) ENDIF () -IF (NOT DEFINED SKIP_INSTALL_HEADERS) - INSTALL( - FILES - ${SOURCE_DIR}/src/lualib.h - ${SOURCE_DIR}/src/lua.h - ${SOURCE_DIR}/src/luaconf.h - ${SOURCE_DIR}/src/lauxlib.h - DESTINATION include - ) - # If using C++, don't install extern "C" wrapper. - IF (NOT COMPILE_AS_CPP) - INSTALL(FILES ${SOURCE_DIR}/src/lua.hpp DESTINATION include) - ENDIF () +INSTALL( + FILES + ${SOURCE_DIR}/src/lualib.h + ${SOURCE_DIR}/src/lua.h + ${SOURCE_DIR}/src/luaconf.h + ${SOURCE_DIR}/src/lauxlib.h + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +) +# If using C++, don't install extern "C" wrapper. +IF (NOT COMPILE_AS_CPP) + INSTALL(FILES ${SOURCE_DIR}/src/lua.hpp DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) ENDIF () diff --git a/recipes/lua/all/conandata.yml b/recipes/lua/all/conandata.yml index b67859f85a77d..c45d4283f1442 100644 --- a/recipes/lua/all/conandata.yml +++ b/recipes/lua/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "5.4.7": + url: "https://www.lua.org/ftp/lua-5.4.7.tar.gz" + sha256: "9fbf5e28ef86c69858f6d3d34eccc32e911c1a28b4120ff3e84aaa70cfbf1e30" + "5.4.6": + url: "https://www.lua.org/ftp/lua-5.4.6.tar.gz" + sha256: "7d5ea1b9cb6aa0b59ca3dde1c6adcb57ef83a1ba8e5432c0ecd06bf439b3ad88" "5.4.4": url: "https://www.lua.org/ftp/lua-5.4.4.tar.gz" sha256: "164c7849653b80ae67bec4b7473b884bf5cc8d2dca05653475ec2ed27b9ebf61" @@ -8,10 +14,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..0214442bfcf23 100644 --- a/recipes/lua/all/conanfile.py +++ b/recipes/lua/all/conanfile.py @@ -1,30 +1,42 @@ -from conans import ConanFile, CMake, tools import os -required_conan_version = ">=1.33.0" +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMake, CMakeDeps, 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" description = "Lua is a powerful, efficient, lightweight, embeddable scripting language." + license = "MIT" 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" + topics = ("embed", "scripting") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [False, True], + "fPIC": [True, False], + "compile_as_cpp": [True, False], + "with_tools": [True, False], + "with_readline": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "compile_as_cpp": False, + "with_tools": False, + "with_readline": 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 +44,52 @@ 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 layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + if self.options.with_tools and self.options.with_readline: + self.requires("readline/8.2") + + def validate(self): + if not self.options.with_tools and self.options.with_readline: + raise ConanInvalidConfiguration(f"{self.ref} requires readline only with with_tools=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["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 + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["LUA_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.variables["COMPILE_AS_CPP"] = self.options.compile_as_cpp + tc.variables["SKIP_INSTALL_TOOLS"] = not self.options.with_tools + tc.variables["WITH_READLINE"] = self.options.with_readline + 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): # 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..452e652d03775 100644 --- a/recipes/lua/all/test_package/CMakeLists.txt +++ b/recipes/lua/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(lua REQUIRED CONFIG) 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..00a91f7d773a9 100644 --- a/recipes/lua/config.yml +++ b/recipes/lua/config.yml @@ -1,9 +1,15 @@ versions: + "5.4.7": + folder: all + "5.4.6": + folder: all "5.4.4": folder: all "5.4.3": 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..0617a7db6d602 100644 --- a/recipes/luajit/all/conandata.yml +++ b/recipes/luajit/all/conandata.yml @@ -1,4 +1,13 @@ +# INFO: Upstream moved to rolling releases and removed all tarballs. +# The Github mirror (https://github.com/LuaJIT/LuaJIT) does not match the checksums and have missing header files. +# Conan will consume the backup sources from the Conan Center Artifactory instead, which are the original tarballs (same checksums). +# Read the issue https://github.com/conan-io/conan-center-index/issues/25032 for more information. sources: - "2.0.5": - url: "http://luajit.org/download/LuaJIT-2.0.5.tar.gz" - sha256: "874b1f8297c697821f561f9b73b57ffd419ed8f4278c82e05b48806d30c1e979" + "2.1.0-beta3": + url: "https://c3i.jfrog.io/artifactory/conan-center-backup-sources/1ad2e34b111c802f9d0cdf019e986909123237a28c746b21295b63c9e785d9c3" + sha256: "1ad2e34b111c802f9d0cdf019e986909123237a28c746b21295b63c9e785d9c3" +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..1a87a46c223ac 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,126 @@ 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") + provides = "lua" 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): + filename = f"LuaJIT-{self.version}.tar.gz" + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, filename=filename, 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/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..72c6723e528aa 100644 --- a/recipes/luajit/config.yml +++ b/recipes/luajit/config.yml @@ -1,3 +1,3 @@ versions: - "2.0.5": + "2.1.0-beta3": folder: "all" diff --git a/recipes/luau/all/conandata.yml b/recipes/luau/all/conandata.yml index 4afd6c2c668c4..a75ea6a2148a0 100644 --- a/recipes/luau/all/conandata.yml +++ b/recipes/luau/all/conandata.yml @@ -1,93 +1,22 @@ sources: - "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" - -patches: - "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" - 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.544": - - patch_file: "patches/0.536-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.541": - - patch_file: "patches/0.536-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.540": - - patch_file: "patches/0.536-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.539": - - patch_file: "patches/0.536-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.538": - - patch_file: "patches/0.536-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.537": - - patch_file: "patches/0.536-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.650": + url: "https://github.com/Roblox/luau/archive/0.650.tar.gz" + sha256: "a605ae7a188455844ab131ff0d2df6f38c088142d6bd5eebb87795e619c3d7aa" + "0.645": + url: "https://github.com/Roblox/luau/archive/0.645.tar.gz" + sha256: "28aaa3e57e7adc44debedc6be9802f2625334eef0124ff722c8ab340dc6bbe1c" + "0.640": + url: "https://github.com/Roblox/luau/archive/0.640.tar.gz" + sha256: "63ada3e4c8c17e5aff8964b16951bfd1b567329dd81c11ae1144b6e95f354762" + "0.635": + url: "https://github.com/Roblox/luau/archive/0.635.tar.gz" + sha256: "b2ec66070bb53ab9c26e41608dd75c9672c942cf0738c4b965c5eb956a954910" + "0.630": + url: "https://github.com/Roblox/luau/archive/0.630.tar.gz" + sha256: "601938ebd428d37c2bb10697500bff4fe304f7c0651cf64721b9dc5600a30ed9" + "0.625": + url: "https://github.com/Roblox/luau/archive/0.625.tar.gz" + sha256: "4dd9295a67c2de6536b6e1208ea81cebfc5caefadcdacd7e09341c7a1dbbb9e2" + "0.620": + url: "https://github.com/Roblox/luau/archive/0.620.tar.gz" + sha256: "a6ae1f0396334e72b1241dabb73aa123037613f3276bf2e71d0dc75568b1eb52" diff --git a/recipes/luau/all/conanfile.py b/recipes/luau/all/conanfile.py index 6545f6caa610f..dda97f96ca72a 100644 --- a/recipes/luau/all/conanfile.py +++ b/recipes/luau/all/conanfile.py @@ -1,14 +1,13 @@ 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, replace_in_file +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, CMakeToolchain, cmake_layout import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class LuauConan(ConanFile): name = "luau" @@ -17,17 +16,14 @@ class LuauConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://luau-lang.org/" topics = ("lua", "scripting", "typed", "embed") + package_type = "static-library" settings = "os", "arch", "compiler", "build_type" options = { - "shared": [False, True], - "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, @@ -40,46 +36,30 @@ def _minimum_cpp_standard(self): @property def _compilers_minimum_version(self): return { - "gcc": "8" if Version(self.version) < "0.549" else "9", + "gcc": "9", "clang": "7", "apple-clang": "12", + "Visual Studio": "15", + "msvc": "191", } 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 - - def configure(self): - if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass - if Version(self.version) < "0.549": - del self.options.native_code_gen def layout(self): cmake_layout(self, src_folder="src") def validate(self): - if self.info.settings.compiler.cppstd: + if self.settings.compiler.cppstd: check_min_cppstd(self, self._minimum_cpp_standard) - check_min_vs(self, 191) - 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: + 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 ConanInvalidConfiguration(f"{self.ref} does not support shared build in MSVC") - 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) @@ -88,20 +68,11 @@ def generate(self): 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_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): - self._patch_sources() cmake = CMake(self) cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() @@ -140,8 +111,7 @@ 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") + self.cpp_info.components["CodeGen"].requires.append("VM") if self.options.with_cli: bin_path = os.path.join(self.package_folder, "bin") diff --git a/recipes/luau/all/patches/0.536-0001-fix-cmake.patch b/recipes/luau/all/patches/0.536-0001-fix-cmake.patch deleted file mode 100644 index 00dcf66617205..0000000000000 --- a/recipes/luau/all/patches/0.536-0001-fix-cmake.patch +++ /dev/null @@ -1,23 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 9200634..c1cca12 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -21,12 +21,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/patches/0.536-0002-rename-lerp.patch b/recipes/luau/all/patches/0.536-0002-rename-lerp.patch deleted file mode 100644 index 324b7d737bf16..0000000000000 --- a/recipes/luau/all/patches/0.536-0002-rename-lerp.patch +++ /dev/null @@ -1,28 +0,0 @@ -diff --git a/VM/src/lmathlib.cpp b/VM/src/lmathlib.cpp -index a6e7b49..7c3e3c6 100644 ---- a/VM/src/lmathlib.cpp -+++ b/VM/src/lmathlib.cpp -@@ -300,7 +300,7 @@ static float fade(float t) - return t * t * t * (t * (t * 6 - 15) + 10); - } - --static float lerp(float t, float a, float b) -+static float lerp_l(float t, float a, float b) - { - return a + t * (b - a); - } -@@ -342,10 +342,10 @@ static float perlin(float x, float y, float z) - int ba = p[b] + zi; - int bb = p[b + 1] + zi; - -- return lerp(w, -- lerp(v, lerp(u, grad(p[aa], xf, yf, zf), grad(p[ba], xf - 1, yf, zf)), lerp(u, grad(p[ab], xf, yf - 1, zf), grad(p[bb], xf - 1, yf - 1, zf))), -- lerp(v, lerp(u, grad(p[aa + 1], xf, yf, zf - 1), grad(p[ba + 1], xf - 1, yf, zf - 1)), -- lerp(u, grad(p[ab + 1], xf, yf - 1, zf - 1), grad(p[bb + 1], xf - 1, yf - 1, zf - 1)))); -+ return lerp_l(w, -+ lerp_l(v, lerp_l(u, grad(p[aa], xf, yf, zf), grad(p[ba], xf - 1, yf, zf)), lerp_l(u, grad(p[ab], xf, yf - 1, zf), grad(p[bb], xf - 1, yf - 1, zf))), -+ lerp_l(v, lerp_l(u, grad(p[aa + 1], xf, yf, zf - 1), grad(p[ba + 1], xf - 1, yf, zf - 1)), -+ lerp_l(u, grad(p[ab + 1], xf, yf - 1, zf - 1), grad(p[bb + 1], xf - 1, yf - 1, zf - 1)))); - } - - static int math_noise(lua_State* L) diff --git a/recipes/luau/all/patches/0.552-0001-fix-cmake.patch b/recipes/luau/all/patches/0.552-0001-fix-cmake.patch deleted file mode 100644 index aaff66adb45b9..0000000000000 --- a/recipes/luau/all/patches/0.552-0001-fix-cmake.patch +++ /dev/null @@ -1,23 +0,0 @@ -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_v1_package/CMakeLists.txt b/recipes/luau/all/test_v1_package/CMakeLists.txt index cbcc5c4d88390..9d54a092e0a67 100644 --- a/recipes/luau/all/test_v1_package/CMakeLists.txt +++ b/recipes/luau/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(Luau REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE Luau::Luau) -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/luau/config.yml b/recipes/luau/config.yml index 2aa48d7676634..f2a2b8d31f2e5 100644 --- a/recipes/luau/config.yml +++ b/recipes/luau/config.yml @@ -1,19 +1,15 @@ versions: - "0.556": + "0.650": folder: all - "0.552": + "0.645": folder: all - "0.548": + "0.640": folder: all - "0.544": + "0.635": folder: all - "0.541": + "0.630": folder: all - "0.540": + "0.625": folder: all - "0.539": - folder: all - "0.538": - folder: all - "0.537": + "0.620": folder: all diff --git a/recipes/lunasvg/all/conandata.yml b/recipes/lunasvg/all/conandata.yml index e504366930815..01f4784f10bfe 100644 --- a/recipes/lunasvg/all/conandata.yml +++ b/recipes/lunasvg/all/conandata.yml @@ -1,4 +1,22 @@ sources: + "3.0.1": + url: "https://github.com/sammycage/lunasvg/archive/v3.0.1.tar.gz" + sha256: "39e3f47d4e40f7992d7958123ca1993ff1a02887539af2af1c638da2855a603c" + "3.0.0": + url: "https://github.com/sammycage/lunasvg/archive/v3.0.0.tar.gz" + sha256: "075f0a049ff205ce059feb1fe3ac0e826a1ac62d2360cb72463395f68c4c8764" + "2.4.1": + url: "https://github.com/sammycage/lunasvg/archive/v2.4.1.tar.gz" + sha256: "db9d2134c8c2545694e71e62fb0772a7d089fe53e1ace1e08c2279a89e450534" + "2.4.0": + url: "https://github.com/sammycage/lunasvg/archive/v2.4.0.tar.gz" + sha256: "0682c60501c91d75f4261d9c1a5cd44c2c9da8dba76f8402eab628448c9a4591" + "2.3.9": + url: "https://github.com/sammycage/lunasvg/archive/v2.3.9.tar.gz" + sha256: "088bc9fd1191a004552c65bdcc260989b83da441b0bdaa965e79d984feba88fa" + "2.3.8": + url: "https://github.com/sammycage/lunasvg/archive/v2.3.8.tar.gz" + sha256: "54d697e271a5aca36f9999d546b1b346e98a8183140027330f69a3eb0c184194" "2.3.5": url: "https://github.com/sammycage/lunasvg/archive/v2.3.5.tar.gz" sha256: "350ff56aa1acdedefe2ad8a4241a9fb8f9b232868adc7bd36dfb3dbdd57e2e93" @@ -11,8 +29,35 @@ sources: "2.3.1": url: "https://github.com/sammycage/lunasvg/archive/refs/tags/v2.3.1.tar.gz" sha256: "6492bf0f51982f5382f83f1a42f247bb1bbcbaef4a15963bbd53073cd4944a25" - patches: + "3.0.1": + - patch_file: "patches/3.0.0-0001-use-cci-package.patch" + patch_description: "use cci plutovg" + patch_type: "conan" + "3.0.0": + - patch_file: "patches/3.0.0-0001-use-cci-package.patch" + patch_description: "use cci plutovg" + patch_type: "conan" + "2.4.1": + - patch_file: "patches/2.4.1-0001-fix-cmake.patch" + patch_description: "use external plutovg and fix installation path for conan" + patch_type: "conan" + "2.4.0": + - patch_file: "patches/2.3.9-0001-fix-cmake.patch" + patch_description: "use external plutovg and fix installation path for conan" + patch_type: "conan" + "2.3.9": + - patch_file: "patches/2.3.9-0001-fix-cmake.patch" + patch_description: "use external plutovg and fix installation path for conan" + patch_type: "conan" + - patch_file: "patches/2.3.9-0002-rename-inner-selector.patch" + patch_description: "rename inner selector to subselector" + patch_type: "portability" + patch_source: "https://github.com/sammycage/lunasvg/pull/147" + "2.3.8": + - 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.5": - patch_file: "patches/2.3.5-0001-fix-cmake.patch" patch_description: "use external plutovg and fix installation path for conan" diff --git a/recipes/lunasvg/all/conanfile.py b/recipes/lunasvg/all/conanfile.py index faebad4a7c975..002cef7926081 100644 --- a/recipes/lunasvg/all/conanfile.py +++ b/recipes/lunasvg/all/conanfile.py @@ -1,14 +1,13 @@ 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.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.52.0" +required_conan_version = ">=1.53.0" class LunaSVGConan(ConanFile): name = "lunasvg" @@ -17,6 +16,7 @@ class LunaSVGConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/sammycage/lunasvg" topics = ("svg", "renderer", ) + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -28,26 +28,33 @@ class LunaSVGConan(ConanFile): } @property - def _minimum_cpp_standard(self): + def _min_cppstd(self): if Version(self.version) <= "2.3.2": - return 14 - else: - return 17 + return "14" + if Version(self.version) <= "2.3.8": + return "17" + if Version(self.version) >= "3.0.0": + return "17" + return "11" @property def _compilers_minimum_version(self): - if Version(self.version) <= "2.3.2": - return { + return { + "14": { "gcc": "5", "clang": "3.5", - "apple-clang": "10" - } - else: - return { + "apple-clang": "10", + "Visual Studio": "15", + "msvc": "191", + }, + "17": { "gcc": "7.1", "clang": "7", - "apple-clang": "12.0" - } + "apple-clang": "12.0", + "Visual Studio": "16", + "msvc": "192", + }, + }.get(self._min_cppstd, {}) def export_sources(self): export_conandata_patches(self) @@ -58,10 +65,7 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") @@ -69,31 +73,30 @@ def layout(self): def requirements(self): if Version(self.version) < "2.3.5": self.requires("plutovg/cci.20220103") - else: + elif Version(self.version) < "3.0.0": self.requires("plutovg/cci.20221030") + else: + self.requires("plutovg/0.0.7") def validate(self): 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." - ) + 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) + 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["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + if Version(self.version) < "2.4.1": + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True tc.generate() + tc.variables["LUNASVG_BUILD_EXAMPLES"] = False tc = CMakeDeps(self) tc.generate() @@ -109,7 +112,11 @@ def package(self): cmake = CMake(self) cmake.install() + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + def package_info(self): self.cpp_info.libs = ["lunasvg"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["m"] + if Version(self.version) >= "2.4.1" and not self.options.shared: + self.cpp_info.defines = ["LUNASVG_BUILD_STATIC"] diff --git a/recipes/lunasvg/all/patches/2.3.9-0001-fix-cmake.patch b/recipes/lunasvg/all/patches/2.3.9-0001-fix-cmake.patch new file mode 100644 index 0000000000000..63725e4f5ca8c --- /dev/null +++ b/recipes/lunasvg/all/patches/2.3.9-0001-fix-cmake.patch @@ -0,0 +1,38 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index bed8895..4698501 100755 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -12,8 +12,8 @@ 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) + target_compile_definitions(lunasvg PRIVATE LUNASVG_EXPORT) +@@ -25,16 +25,16 @@ if(LUNASVG_BUILD_EXAMPLES) + target_include_directories(svg2png PRIVATE 3rdparty/stb) + endif() + +-set(LUNASVG_LIBDIR ${CMAKE_INSTALL_PREFIX}/lib) +-set(LUNASVG_INCDIR ${CMAKE_INSTALL_PREFIX}/include) ++#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/patches/2.3.9-0002-rename-inner-selector.patch b/recipes/lunasvg/all/patches/2.3.9-0002-rename-inner-selector.patch new file mode 100644 index 0000000000000..bb8abc7dace76 --- /dev/null +++ b/recipes/lunasvg/all/patches/2.3.9-0002-rename-inner-selector.patch @@ -0,0 +1,26 @@ +diff --git a/source/parser.cpp b/source/parser.cpp +index 714228b..3ade738 100644 +--- a/source/parser.cpp ++++ b/source/parser.cpp +@@ -1226,8 +1226,8 @@ bool RuleData::matchPseudoClassSelector(const PseudoClassSelector& selector, con + return element->parent == nullptr; + + if(selector.type == PseudoClassSelector::Type::Is) { +- for(auto& selector : selector.subSelectors) { +- for(auto& sel : selector) { ++ for(auto& subselector : selector.subSelectors) { ++ for(auto& sel : subselector) { + if(!matchSimpleSelector(sel, element)) { + return false; + } +@@ -1238,8 +1238,8 @@ bool RuleData::matchPseudoClassSelector(const PseudoClassSelector& selector, con + } + + if(selector.type == PseudoClassSelector::Type::Not) { +- for(auto& selector : selector.subSelectors) { +- for(auto& sel : selector) { ++ for(auto& subselector : selector.subSelectors) { ++ for(auto& sel : subselector) { + if(matchSimpleSelector(sel, element)) { + return false; + } diff --git a/recipes/lunasvg/all/patches/2.4.1-0001-fix-cmake.patch b/recipes/lunasvg/all/patches/2.4.1-0001-fix-cmake.patch new file mode 100644 index 0000000000000..190bb9b65c6b5 --- /dev/null +++ b/recipes/lunasvg/all/patches/2.4.1-0001-fix-cmake.patch @@ -0,0 +1,38 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 3565911..e33555e 100755 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -12,8 +12,8 @@ add_library(lunasvg) + + add_subdirectory(include) + add_subdirectory(source) +-add_subdirectory(3rdparty/plutovg) +- ++find_package(plutovg CONFIG REQUIRED) ++target_link_libraries(lunasvg plutovg::plutovg) + target_compile_definitions(lunasvg PRIVATE LUNASVG_BUILD) + if(NOT BUILD_SHARED_LIBS) + target_compile_definitions(lunasvg PRIVATE LUNASVG_BUILD_STATIC) +@@ -25,16 +25,16 @@ if(LUNASVG_BUILD_EXAMPLES) + target_include_directories(svg2png PRIVATE 3rdparty/stb) + endif() + +-set(LUNASVG_LIBDIR ${CMAKE_INSTALL_PREFIX}/lib) +-set(LUNASVG_INCDIR ${CMAKE_INSTALL_PREFIX}/include) ++# 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/patches/3.0.0-0001-use-cci-package.patch b/recipes/lunasvg/all/patches/3.0.0-0001-use-cci-package.patch new file mode 100644 index 0000000000000..8e3b94580b37c --- /dev/null +++ b/recipes/lunasvg/all/patches/3.0.0-0001-use-cci-package.patch @@ -0,0 +1,44 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 0e7ed4b..9c4f8c7 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -6,16 +6,16 @@ set(LUNASVG_VERSION_MICRO 0) + + project(lunasvg LANGUAGES CXX VERSION ${LUNASVG_VERSION_MAJOR}.${LUNASVG_VERSION_MINOR}.${LUNASVG_VERSION_MICRO}) + +-include(FetchContent) +-FetchContent_Declare(plutovg +- GIT_REPOSITORY https://github.com/sammycage/plutovg.git +- GIT_TAG main +- GIT_SHALLOW ON +- FIND_PACKAGE_ARGS 0.0.4 +-) +- +-FetchContent_MakeAvailable(plutovg) +- ++# include(FetchContent) ++# FetchContent_Declare(plutovg ++# GIT_REPOSITORY https://github.com/sammycage/plutovg.git ++# GIT_TAG main ++# GIT_SHALLOW ON ++# FIND_PACKAGE_ARGS 0.0.4 ++# ) ++ ++# FetchContent_MakeAvailable(plutovg) ++find_package(plutovg CONFIG REQUIRED) + set(lunasvg_sources + source/lunasvg.cpp + source/graphics.cpp +diff --git a/source/graphics.h b/source/graphics.h +index 775f53c..5676f01 100644 +--- a/source/graphics.h ++++ b/source/graphics.h +@@ -1,7 +1,7 @@ + #ifndef LUNASVG_GRAPHICS_H + #define LUNASVG_GRAPHICS_H + +-#include ++#include + + #include + #include diff --git a/recipes/lunasvg/all/test_package/CMakeLists.txt b/recipes/lunasvg/all/test_package/CMakeLists.txt index 1c8a5ea6697c7..94475f0604f5d 100644 --- a/recipes/lunasvg/all/test_package/CMakeLists.txt +++ b/recipes/lunasvg/all/test_package/CMakeLists.txt @@ -1,8 +1,20 @@ cmake_minimum_required(VERSION 3.8) -project(test_package CXX) +project(test_package LANGUAGES CXX) find_package(lunasvg REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE lunasvg::lunasvg) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) +if (lunasvg_VERSION VERSION_LESS_EQUAL "2.3.2") + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) +elseif (lunasvg_VERSION VERSION_LESS_EQUAL "2.3.8") + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +elseif (lunasvg_VERSION VERSION_GREATER_EQUAL "3.0.0") + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +else() + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +endif() + +if (lunasvg_VERSION VERSION_LESS "3.0.0") + target_compile_definitions(${PROJECT_NAME} PRIVATE LUNASVG_BEFORE_3_0_0) +endif() diff --git a/recipes/lunasvg/all/test_package/test_package.cpp b/recipes/lunasvg/all/test_package/test_package.cpp index 1e47dd43f1e9a..9c72aef23c7d4 100644 --- a/recipes/lunasvg/all/test_package/test_package.cpp +++ b/recipes/lunasvg/all/test_package/test_package.cpp @@ -1,4 +1,8 @@ +#ifdef LUNASVG_BEFORE_3_0_0 #include "lunasvg.h" +#else +#include "lunasvg/lunasvg.h" +#endif #include int main() { diff --git a/recipes/lunasvg/all/test_v1_package/CMakeLists.txt b/recipes/lunasvg/all/test_v1_package/CMakeLists.txt index 596ce1fb31ebb..3e7d5abf87992 100644 --- a/recipes/lunasvg/all/test_v1_package/CMakeLists.txt +++ b/recipes/lunasvg/all/test_v1_package/CMakeLists.txt @@ -8,4 +8,14 @@ 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) +if (lunasvg_VERSION VERSION_LESS_EQUAL "2.3.2") + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) +elseif (lunasvg_VERSION VERSION_LESS_EQUAL "2.3.8") + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +else() + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +endif() + +if (lunasvg_VERSION VERSION_LESS "3.0.0") + target_compile_definitions(${PROJECT_NAME} PRIVATE LUNASVG_BEFORE_3_0_0) +endif() diff --git a/recipes/lunasvg/config.yml b/recipes/lunasvg/config.yml index d8c968c29bee6..36b14539bcd19 100644 --- a/recipes/lunasvg/config.yml +++ b/recipes/lunasvg/config.yml @@ -1,4 +1,16 @@ versions: + "3.0.1": + folder: all + "3.0.0": + folder: all + "2.4.1": + folder: all + "2.4.0": + folder: all + "2.3.9": + folder: all + "2.3.8": + folder: all "2.3.5": folder: all "2.3.4": diff --git a/recipes/luple/all/conandata.yml b/recipes/luple/all/conandata.yml index c2dbecf43978d..37619e3ffc243 100644 --- a/recipes/luple/all/conandata.yml +++ b/recipes/luple/all/conandata.yml @@ -2,5 +2,3 @@ sources: "1.2": - url: "https://github.com/alexpolt/luple/archive/1.2.tar.gz" sha256: "810e622b656fa4f1cae5b299db94f550262eb49c81d373cfe770edcea3e8a68b" - - url: "https://unlicense.org/UNLICENSE" - sha256: "7e12e5df4bae12cb21581ba157ced20e1986a0508dd10d0e8a4ab9a4cf94e85c" diff --git a/recipes/luple/all/conanfile.py b/recipes/luple/all/conanfile.py index 9334773f3ff8a..2170039c6be4b 100644 --- a/recipes/luple/all/conanfile.py +++ b/recipes/luple/all/conanfile.py @@ -10,13 +10,14 @@ class LupleConan(ConanFile): name = "luple" - license = "Unlicense" + license = "Public-domain" 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 = ("loophole", "luple", "nuple", "struct", "intern") settings = "os", "arch", "compiler", "build_type" no_copy_source = True + package_type = "header-library" @property def _min_cppstd(self): @@ -57,13 +58,13 @@ def loose_lt_semver(v1, v2): def source(self): 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 build(self): pass def package(self): - copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + # This package doesn't have a license file, it is public domain declared in the Readme + copy(self, "README.md", 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): diff --git a/recipes/lyra/all/conandata.yml b/recipes/lyra/all/conandata.yml index f6627e78699fe..8d693ef2d527d 100644 --- a/recipes/lyra/all/conandata.yml +++ b/recipes/lyra/all/conandata.yml @@ -1,28 +1,16 @@ sources: - "1.0.0": - sha256: ede5446cdd2b74a8cbaa12b998e820d0a1489574649bd76e7e67e69cb841ae22 - url: https://github.com/bfgroup/Lyra/archive/lyra-1.0.tar.gz - "1.1.0": - sha256: c2d70a926f698fb7decb99c7215bb55ab770100f9574c290998bf91416bd8217 - url: https://github.com/bfgroup/Lyra/archive/1.1.tar.gz - "1.2.0": - sha256: 3134fb6d170ba78d139068232b12ca9948082fafc54a3373193c8b8d6e760cd9 - url: https://github.com/bfgroup/Lyra/archive/1.2.tar.gz - "1.3.0": - sha256: 1e9757b850d1afc14413ceb9eb47af5693f6f03a0f1231617fac39df8534db2b - url: https://github.com/bfgroup/Lyra/archive/1.3.tar.gz - "1.4.0": - sha256: 86cc0c4978312582393e196d534011a1f186db9e3e09ba34fd250c2a59ebf814 - url: https://github.com/bfgroup/Lyra/archive/1.4.tar.gz - "1.5.0": - sha256: 5a251ba8c1082875a6655cdcd11c3a7771cd9c40011f1b0e5ac8636054f27dfd - url: https://github.com/bfgroup/Lyra/archive/1.5.tar.gz - "1.5.1": - sha256: 11ccdfc6f776b9a2ebe987d9b4e492981f88f3642546fd1c2e1115741863cae0 - url: https://github.com/bfgroup/Lyra/archive/1.5.1.tar.gz - "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 + "1.6.0": + sha256: 919e92a9c02fea3f365a3a7bdccd8b306311a28a7f2044dac8e7651106d7b644 + url: https://github.com/bfgroup/Lyra/archive/1.6.tar.gz + "1.5.1": + sha256: 11ccdfc6f776b9a2ebe987d9b4e492981f88f3642546fd1c2e1115741863cae0 + url: https://github.com/bfgroup/Lyra/archive/1.5.1.tar.gz + "1.4.0": + sha256: 86cc0c4978312582393e196d534011a1f186db9e3e09ba34fd250c2a59ebf814 + url: https://github.com/bfgroup/Lyra/archive/1.4.tar.gz + "1.3.0": + sha256: 1e9757b850d1afc14413ceb9eb47af5693f6f03a0f1231617fac39df8534db2b + url: https://github.com/bfgroup/Lyra/archive/1.3.tar.gz diff --git a/recipes/lyra/all/conanfile.py b/recipes/lyra/all/conanfile.py index 184573a6e3fe9..c094e45b8f49c 100644 --- a/recipes/lyra/all/conanfile.py +++ b/recipes/lyra/all/conanfile.py @@ -1,8 +1,9 @@ import os + from conan import ConanFile -import conan.tools.files -import conan.tools.layout -import conan.tools.build +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout required_conan_version = ">=1.50.0" @@ -13,33 +14,28 @@ class LyraConan(ConanFile): description = "A simple to use, composing, header only, command line arguments parser for C++ 11 and beyond." topics = ("cli", "cli-parser", "argparse", "commandline", "flags", "header-only", "no-dependencies", "c++11") - no_copy_source = True - settings = "compiler" url = "https://github.com/conan-io/conan-center-index" license = "MIT" + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True - def validate(self): - if self.settings.compiler.get_safe("cppstd"): - conan.tools.build.check_min_cppstd(self, 11) + def layout(self): + basic_layout(self, src_folder="src") def package_id(self): self.info.clear() - def layout(self): - conan.tools.layout.basic_layout(self, src_folder="root") + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) def source(self): - conan.tools.files.get( - self, - **self.conan_data["sources"][self.version], - strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): - conan.tools.files.copy( - self, "LICENSE.txt", - dst=os.path.join(self.package_folder, "licenses"), - src=self.source_folder) - conan.tools.files.copy( + copy(self, "LICENSE.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy( self, "*.h*", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self.source_folder, "include")) @@ -47,6 +43,8 @@ def package(self): def package_info(self): self.cpp_info.set_property("cmake_file_name", "lyra") self.cpp_info.set_property("cmake_target_name", "bfg::lyra") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.components["_lyra"].set_property( @@ -57,3 +55,5 @@ def package_info(self): self.cpp_info.names["cmake_find_package_multi"] = "bfg" self.cpp_info.components["_lyra"].names["cmake_find_package"] = "lyra" self.cpp_info.components["_lyra"].names["cmake_find_package_multi"] = "lyra" + self.cpp_info.components["_lyra"].bindirs = [] + self.cpp_info.components["_lyra"].libdirs = [] diff --git a/recipes/lyra/all/test_package/CMakeLists.txt b/recipes/lyra/all/test_package/CMakeLists.txt index 294a9afb37677..8b31e74af3444 100644 --- a/recipes/lyra/all/test_package/CMakeLists.txt +++ b/recipes/lyra/all/test_package/CMakeLists.txt @@ -1,8 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) 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) +target_link_libraries(${PROJECT_NAME} PRIVATE bfg::lyra) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/lyra/all/test_package/conanfile.py b/recipes/lyra/all/test_package/conanfile.py index 0b275b10a2f3c..98ab55852ad56 100644 --- a/recipes/lyra/all/test_package/conanfile.py +++ b/recipes/lyra/all/test_package/conanfile.py @@ -1,26 +1,26 @@ from conan import ConanFile -import conan.tools.build -import conan.tools.cmake +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): - conan.tools.cmake.cmake_layout(self) + cmake_layout(self) def requirements(self): self.requires(self.tested_reference_str) def build(self): - cmake = conan.tools.cmake.CMake(self) + cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if conan.tools.build.can_run(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/lyra/all/test_v1_package/CMakeLists.txt b/recipes/lyra/all/test_v1_package/CMakeLists.txt deleted file mode 100644 index b200e21129c40..0000000000000 --- a/recipes/lyra/all/test_v1_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(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/test_package.cpp b/recipes/lyra/all/test_v1_package/test_package.cpp deleted file mode 100644 index 5298875e31c6a..0000000000000 --- a/recipes/lyra/all/test_v1_package/test_package.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#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 425271e9a388e..839c2a460a6e7 100644 --- a/recipes/lyra/config.yml +++ b/recipes/lyra/config.yml @@ -1,19 +1,11 @@ versions: - "1.0.0": - folder: all - "1.1.0": - folder: all - "1.2.0": - folder: all - "1.3.0": - folder: all - "1.4.0": + "1.6.1": folder: all - "1.5.0": + "1.6.0": folder: all "1.5.1": folder: all - "1.6.0": + "1.4.0": folder: all - "1.6.1": + "1.3.0": folder: all diff --git a/recipes/lz4/all/conandata.yml b/recipes/lz4/all/conandata.yml index b795699823646..27dd4979a6d6f 100644 --- a/recipes/lz4/all/conandata.yml +++ b/recipes/lz4/all/conandata.yml @@ -1,17 +1,20 @@ sources: + "1.10.0": + url: "https://github.com/lz4/lz4/archive/v1.10.0.tar.gz" + sha256: "537512904744b35e232912055ccf8ec66d768639ff3abe5788d90d792ec5f48b" "1.9.4": - sha256: 0b0e3aa07c8c063ddf40b082bdf7e37a1562bda40a0ff5272957f3e987e0e54b - url: https://github.com/lz4/lz4/archive/v1.9.4.tar.gz + url: "https://github.com/lz4/lz4/archive/v1.9.4.tar.gz" + sha256: "0b0e3aa07c8c063ddf40b082bdf7e37a1562bda40a0ff5272957f3e987e0e54b" "1.9.3": - sha256: 030644df4611007ff7dc962d981f390361e6c97a34e5cbc393ddfbe019ffe2c1 - url: https://github.com/lz4/lz4/archive/v1.9.3.tar.gz - "1.9.2": - sha256: 658ba6191fa44c92280d4aa2c271b0f4fbc0e34d249578dd05e50e76d0e5efcc - url: https://github.com/lz4/lz4/archive/v1.9.2.tar.gz + url: "https://github.com/lz4/lz4/archive/v1.9.3.tar.gz" + sha256: "030644df4611007ff7dc962d981f390361e6c97a34e5cbc393ddfbe019ffe2c1" patches: + "1.9.4": + - patch_file: "patches/0004-Added-namespace-declaration-for-xxhash-in-CMake.patch" + patch_description: "Added namespace/prefix for xxHash functions by altering CMakeLists.txt" + patch_type: official + patch_source: "https://github.com/lz4/lz4/pull/1258" "1.9.3": - patch_file: "patches/0003-cmake-minimum-required-first-1.9.3.patch" - "1.9.2": - - patch_file: "patches/0001-cmake-add-shared-DEFINE_SYMBOL.patch" - - patch_file: "patches/0002-cmake-optional-cli.patch" - - 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 0f12071b01ef2..ea0b3ac51007a 100644 --- a/recipes/lz4/all/conanfile.py +++ b/recipes/lz4/all/conanfile.py @@ -1,12 +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, save +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): @@ -15,8 +15,8 @@ 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") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -28,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": @@ -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") @@ -57,7 +50,8 @@ def source(self): def generate(self): tc = CMakeToolchain(self) tc.variables["LZ4_BUILD_CLI"] = False - tc.variables["LZ4_BUILD_LEGACY_LZ4C"] = False + if Version(self.version) < "1.10.0": + tc.variables["LZ4_BUILD_LEGACY_LZ4C"] = False tc.variables["LZ4_BUNDLED_MODE"] = False tc.variables["LZ4_POSITION_INDEPENDENT_LIB"] = self.options.get_safe("fPIC", True) # Generate a relocatable shared lib on Macos @@ -68,10 +62,7 @@ def generate(self): @property def _cmakelists_folder(self): - if Version(self.version) < "1.9.3": - subfolder = os.path.join("contrib", "cmake_unofficial") - else: - subfolder = os.path.join("build", "cmake") + subfolder = os.path.join("build", "cmake") return os.path.join(self.source_folder, subfolder) def build(self): diff --git a/recipes/lz4/all/patches/0001-cmake-add-shared-DEFINE_SYMBOL.patch b/recipes/lz4/all/patches/0001-cmake-add-shared-DEFINE_SYMBOL.patch deleted file mode 100644 index 5de5fbc440858..0000000000000 --- a/recipes/lz4/all/patches/0001-cmake-add-shared-DEFINE_SYMBOL.patch +++ /dev/null @@ -1,16 +0,0 @@ ---- contrib/cmake_unofficial/CMakeLists.txt -+++ contrib/cmake_unofficial/CMakeLists.txt -@@ -103,9 +103,13 @@ - if(BUILD_SHARED_LIBS) - add_library(lz4_shared SHARED ${LZ4_SOURCES}) - set_target_properties(lz4_shared PROPERTIES - OUTPUT_NAME lz4 - SOVERSION "${LZ4_VERSION_MAJOR}" - VERSION "${LZ4_VERSION_STRING}") - list(APPEND LZ4_LIBRARIES_BUILT lz4_shared) -+ if(MSVC) -+ set_target_properties(lz4_shared PROPERTIES -+ DEFINE_SYMBOL LZ4_DLL_EXPORT=1) -+ endif() - endif() - if(BUILD_STATIC_LIBS) diff --git a/recipes/lz4/all/patches/0002-cmake-optional-cli.patch b/recipes/lz4/all/patches/0002-cmake-optional-cli.patch deleted file mode 100644 index b2fe91a0e8bf9..0000000000000 --- a/recipes/lz4/all/patches/0002-cmake-optional-cli.patch +++ /dev/null @@ -1,41 +0,0 @@ ---- a/contrib/cmake_unofficial/CMakeLists.txt -+++ b/contrib/cmake_unofficial/CMakeLists.txt -@@ -12,6 +12,7 @@ - - set(LZ4_TOP_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../..") - -+option(LZ4_BUILD_CLI "Build lz4 program" ON) - option(LZ4_BUILD_LEGACY_LZ4C "Build lz4c progam with legacy argument support" ON) - - # Parse version information -@@ -128,10 +129,12 @@ else() - endif() - - # lz4 -+if(LZ4_BUILD_CLI) - set(LZ4_PROGRAMS_BUILT lz4cli) - add_executable(lz4cli ${LZ4_CLI_SOURCES}) - set_target_properties(lz4cli PROPERTIES OUTPUT_NAME lz4) - target_link_libraries(lz4cli ${LZ4_LINK_LIBRARY}) -+endif() - - # lz4c - if (LZ4_BUILD_LEGACY_LZ4C) -@@ -193,7 +196,7 @@ if(NOT LZ4_BUNDLED_MODE) - DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") - - # install lz4cat and unlz4 symlinks on *nix -- if(UNIX) -+ if(UNIX AND LZ4_BUILD_CLI) - install(CODE " - foreach(f lz4cat unlz4) - set(dest \"\$ENV{DESTDIR}${CMAKE_INSTALL_FULL_BINDIR}/\${f}\") -@@ -209,7 +212,7 @@ if(NOT LZ4_BUNDLED_MODE) - install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${f}.1" - DESTINATION "${CMAKE_INSTALL_MANDIR}/man1") - endforeach() -- endif(UNIX) -+ endif(UNIX AND LZ4_BUILD_CLI) - endif(NOT LZ4_BUNDLED_MODE) - - # pkg-config diff --git a/recipes/lz4/all/patches/0003-cmake-minimum-required-first-1.9.2.patch b/recipes/lz4/all/patches/0003-cmake-minimum-required-first-1.9.2.patch deleted file mode 100644 index 2333a27871ed9..0000000000000 --- a/recipes/lz4/all/patches/0003-cmake-minimum-required-first-1.9.2.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- a/contrib/cmake_unofficial/CMakeLists.txt -+++ b/contrib/cmake_unofficial/CMakeLists.txt -@@ -9,11 +9,10 @@ - # - # LZ4's CMake support is maintained by Evan Nemerson; when filing - # bugs please mention @nemequ to make sure I see it. -+cmake_minimum_required (VERSION 2.8.6) - - set(LZ4_TOP_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../..") - --option(LZ4_BUILD_CLI "Build lz4 program" ON) --option(LZ4_BUILD_LEGACY_LZ4C "Build lz4c progam with legacy argument support" ON) - - # Parse version information - file(STRINGS "${LZ4_TOP_SOURCE_DIR}/lib/lz4.h" LZ4_VERSION_MAJOR REGEX "^#define LZ4_VERSION_MAJOR +([0-9]+) +.*$") -@@ -34,7 +33,8 @@ else() - LANGUAGES C) - endif() - --cmake_minimum_required (VERSION 2.8.6) -+option(LZ4_BUILD_CLI "Build lz4 program" ON) -+option(LZ4_BUILD_LEGACY_LZ4C "Build lz4c progam with legacy argument support" ON) - - # If LZ4 is being bundled in another project, we don't want to - # install anything. However, we want to let people override this, so diff --git a/recipes/lz4/all/patches/0004-Added-namespace-declaration-for-xxhash-in-CMake.patch b/recipes/lz4/all/patches/0004-Added-namespace-declaration-for-xxhash-in-CMake.patch new file mode 100644 index 0000000000000..04a888ec1c444 --- /dev/null +++ b/recipes/lz4/all/patches/0004-Added-namespace-declaration-for-xxhash-in-CMake.patch @@ -0,0 +1,19 @@ +--- a/build/cmake/CMakeLists.txt ++++ b/build/cmake/CMakeLists.txt +@@ -131,6 +131,16 @@ if(BUILD_STATIC_LIBS) + list(APPEND LZ4_LIBRARIES_BUILT lz4_static) + endif() + ++# xxhash namesapce ++if(BUILD_SHARED_LIBS) ++ target_compile_definitions(lz4_shared PRIVATE ++ XXH_NAMESPACE=LZ4_) ++endif() ++if(BUILD_STATIC_LIBS) ++ target_compile_definitions(lz4_static PRIVATE ++ XXH_NAMESPACE=LZ4_) ++endif() ++ + if(BUILD_STATIC_LIBS) + set(LZ4_LINK_LIBRARY lz4_static) + else() diff --git a/recipes/lz4/all/test_v1_package/conanfile.py b/recipes/lz4/all/test_v1_package/conanfile.py index a2c12d9cb383d..77061a2f84fa0 100644 --- a/recipes/lz4/all/test_v1_package/conanfile.py +++ b/recipes/lz4/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake from conan.tools.build import cross_building import os diff --git a/recipes/lz4/config.yml b/recipes/lz4/config.yml index f96920e268df8..7af8322c88129 100644 --- a/recipes/lz4/config.yml +++ b/recipes/lz4/config.yml @@ -1,7 +1,7 @@ versions: + "1.10.0": + folder: all "1.9.4": folder: all "1.9.3": folder: all - "1.9.2": - folder: all 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..42a7472a117cb --- /dev/null +++ b/recipes/lzham/all/conanfile.py @@ -0,0 +1,191 @@ +import os + +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 +) +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 validate(self): + if self.settings.os == "Windows" and self.settings.arch not in ["x86", "x86_64"]: + raise ConanInvalidConfiguration("On Windows, only x86 and x86_64 are supported") + + def _msvc_libs(self, targets=False): + arch = "x86" if self.settings.arch == "x86" else "x64" + suffix = f"{arch}D" if self.settings.build_type == "Debug" else arch + if self.options.shared == True: + if targets: + # Note: this causes its dependencies to be built too + return ['lzhamdll'] + + files = [f"lzham_{suffix}.dll", f"lzham_{suffix}.lib"] + else: + libs = ['lzhamcomp', 'lzhamdecomp', 'lzhamlib'] + if targets: + return libs + + files = [f"{lib}_{suffix}.lib" for lib in libs] + + return files + + 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" + + # Build relocatable shared libraries on Apple OSs + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" + tc.generate() + + def build(self): + apply_conandata_patches(self) + for project in ['lzhamcomp', 'lzhamdecomp', 'lzhamdll', 'lzhamlib']: + filename = 'lzham' if project == 'lzhamdll' else project + vcxproj_file = os.path.join(self.source_folder, project, f"{filename}.vcxproj") + # Avoid errors when the toolset on the consumer side is not exactly the same version + replace_in_file(self, vcxproj_file, "WholeProgramOptimization>true", "WholeProgramOptimization>false") + # Don't override the runtime library set by Conan's MSBuildToolchain + replace_in_file(self, vcxproj_file, "MultiThreaded", "") + replace_in_file(self, vcxproj_file, "MultiThreadedDebug", "") + 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", targets=self._msvc_libs(targets=True)) + 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): + arch = "x86" if self.settings.arch == "x86" else "x64" + for target in self._msvc_libs(): + self.output.warning(target) + debug_suffix = "D" if self.settings.build_type == "Debug" and not self.options.shared else "" + arch_folder = f"{arch}{debug_suffix}" + subfolder = "lib" if not target.endswith('dll') else "bin" + subfolder_src = os.path.join("lib", arch_folder) if not target.endswith('dll') else "bin" + self.output.warning(subfolder_src) + copy( + self, + pattern=target, + dst=os.path.join(self.package_folder, subfolder), + src=os.path.join(self.build_folder, subfolder_src), + 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): + libs = list(set([filename[:-4] for filename in self._msvc_libs()])) + self.cpp_info.libs = libs + 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..33155f701528a --- /dev/null +++ b/recipes/lzham/all/test_package/test_package.cpp @@ -0,0 +1,13 @@ +#include +#include + +#include + +int main() { + const std::string version(lzham_z_version()); + + std::cout << "lzham version: " << version << std::endl; + + + 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/lzip/all/conandata.yml b/recipes/lzip/all/conandata.yml index 2b81d53f9b8e1..f3b143bd6541b 100644 --- a/recipes/lzip/all/conandata.yml +++ b/recipes/lzip/all/conandata.yml @@ -1,20 +1,23 @@ sources: + "1.23": + url: + - "http://download.savannah.gnu.org/releases/lzip/lzip-1.23.tar.gz" + - "https://download-mirror.savannah.gnu.org/releases/lzip/lzip-1.23.tar.gz" + sha256: "4792c047ddf15ef29d55ba8e68a1a21e0cb7692d87ecdf7204419864582f280d" "1.22": - url: [ - "http://download.savannah.gnu.org/releases/lzip/lzip-1.22.tar.gz", - "https://download-mirror.savannah.gnu.org/releases/lzip/lzip-1.22.tar.gz", - ] + url: + - "http://download.savannah.gnu.org/releases/lzip/lzip-1.22.tar.gz" + - "https://download-mirror.savannah.gnu.org/releases/lzip/lzip-1.22.tar.gz" sha256: "c3342d42e67139c165b8b128d033b5c96893a13ac5f25933190315214e87a948" "1.21": - url: [ - "http://download.savannah.gnu.org/releases/lzip/lzip-1.21.tar.gz", - "https://download-mirror.savannah.gnu.org/releases/lzip/lzip-1.21.tar.gz", - ] + url: + - "http://download.savannah.gnu.org/releases/lzip/lzip-1.21.tar.gz" + - "https://download-mirror.savannah.gnu.org/releases/lzip/lzip-1.21.tar.gz" sha256: "e48b5039d3164d670791f9c5dbaa832bf2df080cb1fbb4f33aa7b3300b670d8b" patches: + "1.23": + - patch_file: "patches/1.23-0001-any-compiler.patch" "1.22": - - base_path: "source_subfolder" - patch_file: "patches/1.22-0001-any-compiler.patch" + - patch_file: "patches/1.22-0001-any-compiler.patch" "1.21": - - base_path: "source_subfolder" - patch_file: "patches/1.21-0001-any-compiler.patch" + - patch_file: "patches/1.21-0001-any-compiler.patch" diff --git a/recipes/lzip/all/conanfile.py b/recipes/lzip/all/conanfile.py index 96c8fbac3cb58..3a29086521b1e 100644 --- a/recipes/lzip/all/conanfile.py +++ b/recipes/lzip/all/conanfile.py @@ -1,102 +1,59 @@ -from conans import AutoToolsBuildEnvironment, CMake, ConanFile, tools -from conans.errors import ConanInvalidConfiguration -import contextlib +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.files import copy, get, replace_in_file, rmdir, patch, apply_conandata_patches, export_conandata_patches +from conan.tools.layout import basic_layout import os -import textwrap -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class LzipConan(ConanFile): name = "lzip" description = "Lzip is a lossless data compressor with a user interface similar to the one of gzip or bzip2" - topics = ("lzip", "compressor", "lzma") license = "GPL-v2-or-later" - homepage = "https://www.nongnu.org/lzip/" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://www.nongnu.org/lzip/" + topics = ("compressor", "lzma") + package_type = "application" settings = "os", "arch", "compiler", "build_type" - 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) + 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 validate(self): - if self.settings.compiler == "Visual Studio": - raise ConanInvalidConfiguration("Visual Studio is not supported") + if self.settings.os == "Windows" and self.settings.compiler != "gcc": + raise ConanInvalidConfiguration("Only gcc supported for windows builds") def package_id(self): del self.info.settings.compiler - - def _detect_compilers(self): - tools.rmdir("detectdir") - tools.mkdir("detectdir") - with tools.chdir("detectdir"): - tools.save("CMakeLists.txt", textwrap.dedent("""\ - cmake_minimum_required(VERSION 2.8) - project(test C CXX) - message(STATUS "CC=${CMAKE_C_COMPILER}") - message(STATUS "CXX=${CMAKE_CXX_COMPILER}") - file(WRITE cc.txt "${CMAKE_C_COMPILER}") - file(WRITE cxx.txt "${CMAKE_CXX_COMPILER}") - """)) - CMake(self).configure(source_folder="detectdir", build_folder="detectdir") - cc = tools.load("cc.txt").strip() - cxx = tools.load("cxx.txt").strip() - return cc, cxx + del self.info.settings.build_type 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 = {} - cc, cxx = self._detect_compilers() - if not tools.get_env("CC"): - env["CC"] = cc - if not tools.get_env("CXX"): - env["CXX"] = cxx - with tools.environment_append(env): - yield + 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, win_bash=tools.os_info.is_windows) - conf_args = [ - ] - self._autotools.configure(args=conf_args, configure_dir=self._source_subfolder) - return self._autotools + def generate(self): + tc = AutotoolsToolchain(self) + tc.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) - def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") - with self._build_context(): - autotools = self._configure_autotools() - with tools.environment_append({"CONAN_CPU_COUNT": "1"}): - autotools.install() + autotools = Autotools(self) + autotools.configure() + autotools.make() - tools.rmdir(os.path.join(self.package_folder, "share")) + def package(self): + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + autotools.install(target="install-bin") 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.includedirs = [] + self.cpp_info.libdirs = [] + + bindir = os.path.join(self.package_folder, "bin") + self.runenv_info.prepend_path("PATH", bindir) diff --git a/recipes/lzip/all/patches/1.21-0001-any-compiler.patch b/recipes/lzip/all/patches/1.21-0001-any-compiler.patch index 68dcb6f524644..594395a65c8c3 100644 --- a/recipes/lzip/all/patches/1.21-0001-any-compiler.patch +++ b/recipes/lzip/all/patches/1.21-0001-any-compiler.patch @@ -1,25 +1,66 @@ ---- configure -+++ configure -@@ -21,7 +21,7 @@ +--- configure 2018-12-31 23:47:09.000000000 +0100 ++++ configure 2023-08-20 17:40:14.170994800 +0200 +@@ -9,6 +9,7 @@ + pkgversion=1.21 + progname=lzip + srctrigger=doc/${pkgname}.texi ++extension= + + # clear some things potentially inherited from environment. + LC_ALL=C +@@ -20,7 +21,7 @@ + datarootdir='$(prefix)/share' infodir='$(datarootdir)/info' mandir='$(datarootdir)/man' -CXX=g++ --CPPFLAGS= --CXXFLAGS='-Wall -W -O2' --LDFLAGS= -+#CXX=g++ -+#CPPFLAGS= -+#CXXFLAGS='-Wall -W -O2' -+#LDFLAGS= ++CXX="${CXX:-g++}" + CPPFLAGS= + CXXFLAGS='-Wall -W -O2' + LDFLAGS= +@@ -118,6 +119,19 @@ + fi + done + ++rm -f dummy* ++cat << EOT > dummy.c ++int main(int argc, char ** argv) { ++ return 0; ++} ++EOT ++ ++${CXX} -o dummy dummy.c ++ ++if [ -f dummy.exe ] ; then ++ extension=".exe" ++fi ++ + # Find the source files, if location was not specified. + srcdirtext= + if [ -z "${srcdir}" ] ; then +@@ -158,6 +172,7 @@ + echo "creating Makefile" + echo "VPATH = ${srcdir}" + echo "prefix = ${prefix}" ++echo "executable extension = ${extension}" + echo "exec_prefix = ${exec_prefix}" + echo "bindir = ${bindir}" + echo "datarootdir = ${datarootdir}" +@@ -179,6 +194,7 @@ + pkgname = ${pkgname} + pkgversion = ${pkgversion} + progname = ${progname} ++extension = ${extension} + VPATH = ${srcdir} + prefix = ${prefix} + exec_prefix = ${exec_prefix} +--- Makefile.in 2018-03-21 13:21:16.000000000 +0100 ++++ Makefile.in 2023-08-20 17:32:44.011055100 +0200 +@@ -64,7 +64,7 @@ -@@ -28,8 +28,8 @@ - # checking whether we are using GNU C++. - /bin/sh -c "${CXX} --version" > /dev/null 2>&1 || - { -- CXX=c++ -- CXXFLAGS=-O2 -+ echo "hello" # CXX=c++ -+ echo "hello" # CXXFLAGS=-O2 - } + install-bin : all + if [ ! -d "$(DESTDIR)$(bindir)" ] ; then $(INSTALL_DIR) "$(DESTDIR)$(bindir)" ; fi +- $(INSTALL_PROGRAM) ./$(progname) "$(DESTDIR)$(bindir)/$(progname)" ++ $(INSTALL_PROGRAM) ./$(progname)$(extension) "$(DESTDIR)$(bindir)/$(progname)$(extension)" - # Loop over all args + install-bin-strip : all + $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install-bin diff --git a/recipes/lzip/all/patches/1.22-0001-any-compiler.patch b/recipes/lzip/all/patches/1.22-0001-any-compiler.patch index 50311f5627b8c..9388ec1d5dc3d 100644 --- a/recipes/lzip/all/patches/1.22-0001-any-compiler.patch +++ b/recipes/lzip/all/patches/1.22-0001-any-compiler.patch @@ -1,18 +1,78 @@ ---- configure -+++ configure -@@ -24,7 +24,7 @@ +--- configure 2021-01-01 14:06:33.000000000 +0100 ++++ configure 2023-08-20 17:48:10.569541300 +0200 +@@ -9,6 +9,7 @@ + pkgversion=1.22 + progname=lzip + srctrigger=doc/${pkgname}.texi ++extension= + + # clear some things potentially inherited from environment. + LC_ALL=C +@@ -23,7 +24,7 @@ + build=no check=no installdir= -CXX=g++ --CPPFLAGS= --CXXFLAGS='-Wall -W -O2' --LDFLAGS= -+#CXX=g++ -+#CPPFLAGS= -+#CXXFLAGS='-Wall -W -O2' -+#LDFLAGS= ++CXX="${CXX:-g++}" + CPPFLAGS= + CXXFLAGS='-Wall -W -O2' + LDFLAGS= +@@ -125,6 +126,19 @@ + fi + done + ++rm -f dummy* ++cat << EOT > dummy.c ++int main(int argc, char ** argv) { ++ return 0; ++} ++EOT ++ ++${CXX} -o dummy dummy.c ++ ++if [ -f dummy.exe ] ; then ++ extension=".exe" ++fi ++ + # Find the source files, if location was not specified. + srcdirtext= + if [ -z "${srcdir}" ] ; then +@@ -161,9 +175,9 @@ + "${srcdir}/testsuite/check.sh" "${srcdir}/testsuite" ${pkgversion} || exit 1 + fi + if [ -n "${installdir}" ] ; then +- echo "installing ${progname} in ${installdir}" ++ echo "installing ${progname}${extension} in ${installdir}" + [ -d "${installdir}" ] || mkdir -p "${installdir}" || exit 1 +- cp -fp ${progname} "${installdir}/${progname}" || exit 1 ++ cp -fp "${progname}${extension}" "${installdir}/${progname}${extension}" || exit 1 + fi + exit 0 + fi +@@ -188,6 +202,7 @@ + echo "creating Makefile" + echo "VPATH = ${srcdir}" + echo "prefix = ${prefix}" ++echo "executable extension = ${extension}" + echo "exec_prefix = ${exec_prefix}" + echo "bindir = ${bindir}" + echo "datarootdir = ${datarootdir}" +@@ -209,6 +224,7 @@ + pkgname = ${pkgname} + pkgversion = ${pkgversion} + progname = ${progname} ++extension = ${extension} + VPATH = ${srcdir} + prefix = ${prefix} + exec_prefix = ${exec_prefix} +--- Makefile.in 2020-05-02 00:06:48.000000000 +0200 ++++ Makefile.in 2023-08-20 17:46:52.265608300 +0200 +@@ -64,7 +64,7 @@ + + install-bin : all + if [ ! -d "$(DESTDIR)$(bindir)" ] ; then $(INSTALL_DIR) "$(DESTDIR)$(bindir)" ; fi +- $(INSTALL_PROGRAM) ./$(progname) "$(DESTDIR)$(bindir)/$(progname)" ++ $(INSTALL_PROGRAM) ./$(progname)$(extension) "$(DESTDIR)$(bindir)/$(progname)$(extension)" -@@ -31,2 +31,2 @@ - # checking whether we are using GNU C++. --/bin/sh -c "${CXX} --version" > /dev/null 2>&1 || { CXX=c++ ; CXXFLAGS=-O2 ; } -+# /bin/sh -c "${CXX} --version" > /dev/null 2>&1 || { CXX=c++ ; CXXFLAGS=-O2 ; } + install-bin-strip : all + $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install-bin diff --git a/recipes/lzip/all/patches/1.23-0001-any-compiler.patch b/recipes/lzip/all/patches/1.23-0001-any-compiler.patch new file mode 100644 index 0000000000000..ad4c3f5cc843d --- /dev/null +++ b/recipes/lzip/all/patches/1.23-0001-any-compiler.patch @@ -0,0 +1,78 @@ +--- configure 2022-01-22 01:11:01.000000000 +0100 ++++ configure 2023-08-20 17:51:18.537172800 +0200 +@@ -9,6 +9,7 @@ + pkgversion=1.23 + progname=lzip + srctrigger=doc/${pkgname}.texi ++extension= + + # clear some things potentially inherited from environment. + LC_ALL=C +@@ -23,7 +24,7 @@ + build=no + check=no + installdir= +-CXX=g++ ++CXX="${CXX:-g++}" + CPPFLAGS= + CXXFLAGS='-Wall -W -O2' + LDFLAGS= +@@ -125,6 +126,19 @@ + fi + done + ++rm -f dummy* ++cat << EOT > dummy.c ++int main(int argc, char ** argv) { ++ return 0; ++} ++EOT ++ ++${CXX} -o dummy dummy.c ++ ++if [ -f dummy.exe ] ; then ++ extension=".exe" ++fi ++ + # Find the source files, if location was not specified. + srcdirtext= + if [ -z "${srcdir}" ] ; then +@@ -161,9 +175,9 @@ + "${srcdir}/testsuite/check.sh" "${srcdir}/testsuite" ${pkgversion} || exit 1 + fi + if [ -n "${installdir}" ] ; then +- echo "installing ${progname} in ${installdir}" ++ echo "installing ${progname}${extension} in ${installdir}" + [ -d "${installdir}" ] || mkdir -p "${installdir}" || exit 1 +- cp -fp ${progname} "${installdir}/${progname}" || exit 1 ++ cp -fp "${progname}${extension}" "${installdir}/${progname}${extension}" || exit 1 + fi + exit 0 + fi +@@ -188,6 +202,7 @@ + echo "creating Makefile" + echo "VPATH = ${srcdir}" + echo "prefix = ${prefix}" ++echo "executable extension = ${extension}" + echo "exec_prefix = ${exec_prefix}" + echo "bindir = ${bindir}" + echo "datarootdir = ${datarootdir}" +@@ -209,6 +224,7 @@ + pkgname = ${pkgname} + pkgversion = ${pkgversion} + progname = ${progname} ++extension = ${extension} + VPATH = ${srcdir} + prefix = ${prefix} + exec_prefix = ${exec_prefix} +--- Makefile.in 2021-10-07 01:01:07.000000000 +0200 ++++ Makefile.in 2023-08-20 17:18:35.382705100 +0200 +@@ -64,7 +64,7 @@ + + install-bin : all + if [ ! -d "$(DESTDIR)$(bindir)" ] ; then $(INSTALL_DIR) "$(DESTDIR)$(bindir)" ; fi +- $(INSTALL_PROGRAM) ./$(progname) "$(DESTDIR)$(bindir)/$(progname)" ++ $(INSTALL_PROGRAM) ./$(progname)$(extension) "$(DESTDIR)$(bindir)/$(progname)$(extension)" + + install-bin-strip : all + $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install-bin diff --git a/recipes/lzip/all/test_package/conanfile.py b/recipes/lzip/all/test_package/conanfile.py index 84ae9d8826de5..16e19ad7002bc 100644 --- a/recipes/lzip/all/test_package/conanfile.py +++ b/recipes/lzip/all/test_package/conanfile.py @@ -1,27 +1,53 @@ -from conans import ConanFile, 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.files import rm, save, check_sha256 import os -import shutil - +from io import StringIO 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, skip_x64_x86=True): - lzip = os.path.join(self.deps_cpp_info["lzip"].bin_paths[0], "lzip") - self.run("{} --version".format(lzip)) - - shutil.copy(os.path.join(self.source_folder, "conanfile.py"), - "conanfile.py") - - sha256_original = tools.sha256sum("conanfile.py") - self.run("{} conanfile.py".format(lzip), run_environment=True) - if not os.path.exists("conanfile.py.lz"): - raise ConanException("conanfile.py.lz does not exist") - if os.path.exists("conanfile.py"): - raise ConanException("copied conanfile.py should not exist anymore") - - self.run("{} -d conanfile.py.lz".format(lzip), run_environment=True) - if tools.sha256sum("conanfile.py") != sha256_original: - raise ConanException("sha256 from extracted conanfile.py does not match original") + if not can_run(self): + return + + cmd_output = StringIO() + self.run(f"lzip --version", cmd_output, env="conanrun") + + #Create input test file + input_file_sha256 = "6a7ef9d581b577bbe8415d69ccc2549287eb99b5d856a213df742f8b89986a6a" + input_file = "input.txt" + if os.path.exists(input_file): + rm(self, input_file, ".") + + save(self, input_file, "Klaus is king!") + + #Ensure output test file does not exist + output_file = input_file + ".lz" + if os.path.exists(output_file): + rm(self, output_file, ".") + + #Zip the input file + self.run(f"lzip {input_file}", env="conanrun") + if not os.path.exists(f"{output_file}"): + raise ConanException(f"{output_file} does not exist") + + if os.path.exists(f"{input_file}"): + raise ConanException(f"{input_file} does exist") + + #Unzip the input file + self.run(f"lzip -d {output_file}", env="conanrun") + if os.path.exists(f"{output_file}"): + raise ConanException(f"{output_file} does not exist") + + if not os.path.exists(f"{input_file}"): + raise ConanException(f"{input_file} does exist") + + #Compare checksum of unzipped file with expected value + check_sha256(self, input_file, input_file_sha256) diff --git a/recipes/lzip/config.yml b/recipes/lzip/config.yml index e027a6bc18156..fe52638d1ec86 100644 --- a/recipes/lzip/config.yml +++ b/recipes/lzip/config.yml @@ -1,4 +1,6 @@ versions: + "1.23": + folder: "all" "1.22": folder: "all" "1.21": diff --git a/recipes/lzma_sdk/9.20/conanfile.py b/recipes/lzma_sdk/9.20/conanfile.py index 66f4dfa40693b..27fc9f6331b8f 100644 --- a/recipes/lzma_sdk/9.20/conanfile.py +++ b/recipes/lzma_sdk/9.20/conanfile.py @@ -1,9 +1,12 @@ from conan import ConanFile -from conan.tools.files import get, chdir, replace_in_file, rm -from conans import tools, AutoToolsBuildEnvironment, VisualStudioBuildEnvironment +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import get, chdir, copy, replace_in_file, rm +from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, NMakeToolchain import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.55.0" """ This older lzma release is used to build 7zip (to extract its sources). @@ -25,36 +28,51 @@ class LzmaSdkConan(ConanFile): license = ("LZMA-exception",) homepage = "https://www.7-zip.org/sdk.html" topics = ("lzma", "zip", "compression", "decompression") - settings = "os", "arch", "compiler" - - @property - def _source_subfolder(self): - return "source_subfolder" + package_type = "application" + 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.compiler != "Visual Studio" and 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 self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.build_requires("msys2/cci.latest") + + def layout(self): + basic_layout(self, src_folder="src") def package_id(self): + del self.info.settings.build_type del self.info.settings.compiler def source(self): - 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) + get(self, **self.conan_data["sources"][self.version]) + rm(self, "7zr.exe", self.source_folder) + rm(self, "lzma.exe", self.source_folder) + + def generate(self): + if is_msvc(self): + tc = NMakeToolchain(self) + tc.generate() + else: + env = VirtualBuildEnv(self) + env.generate() + tc = AutotoolsToolchain(self) + tc.generate() + deps = AutotoolsDeps(self) + deps.generate() @property def _msvc_build_dirs(self): return ( - (os.path.join(self._source_subfolder, "C", "Util", "7z"), "7zDec.exe"), - (os.path.join(self._source_subfolder, "C", "Util", "Lzma"), "LZMAc.exe"), - (os.path.join(self._source_subfolder, "CPP", "7zip", "UI", "Console"), "7z.exe"), - (os.path.join(self._source_subfolder, "CPP", "7zip","Bundles", "Alone7z"), "7zr.exe"), - (os.path.join(self._source_subfolder, "CPP", "7zip", "Bundles", "LzmaCon"), "lzma.exe"), + (os.path.join(self.source_folder, "C", "Util", "7z"), "7zDec.exe"), + (os.path.join(self.source_folder, "C", "Util", "Lzma"), "LZMAc.exe"), + (os.path.join(self.source_folder, "CPP", "7zip", "UI", "Console"), "7z.exe"), + (os.path.join(self.source_folder, "CPP", "7zip","Bundles", "Alone7z"), "7zr.exe"), + (os.path.join(self.source_folder, "CPP", "7zip", "Bundles", "LzmaCon"), "lzma.exe"), ) @property @@ -68,69 +86,64 @@ 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"), f"7zDec{es}"), - (os.path.join(self._source_subfolder, "CPP", "7zip", "Bundles", "LzmaCon"), f"lzma{es}"), + (os.path.join(self.source_folder, "C", "Util", "7z"), f"7zDec{es}"), + (os.path.join(self.source_folder, "CPP", "7zip", "Bundles", "LzmaCon"), f"lzma{es}"), ) def _build_msvc(self): for make_dir, _ in self._msvc_build_dirs: - with tools.vcvars(self): - with tools.environment_append(VisualStudioBuildEnvironment(self).vars): - with tools.chdir(make_dir): - self.run(f"nmake /f makefile NEW_COMPILER=1 CPU={self._msvc_cpu} NO_BUFFEROVERFLOWU=1") + self.run(f"nmake /f makefile NEW_COMPILER=1 CPU={self._msvc_cpu} NO_BUFFEROVERFLOWU=1", cwd=make_dir) def _build_autotools(self): - env_build = AutoToolsBuildEnvironment(self) - with tools.environment_append(env_build.vars): - for make_dir, _ in self._autotools_build_dirs: - with chdir(self, make_dir): - args = [ - "-f", "makefile.gcc", - ] - if self.settings.os == "Windows": - args.append("IS_MINGW=1") - autotools = AutoToolsBuildEnvironment(self) - autotools.make(args=args) + autotools = Autotools(self) + for make_dir, _ in self._autotools_build_dirs: + with chdir(self, make_dir): + args = [ + "-f", "makefile.gcc", + ] + if self.settings.os == "Windows": + args.append("IS_MINGW=1") + autotools.make(args=args) def _patch_sources(self): - if self.settings.compiler == "Visual Studio": - replace_in_file(self, os.path.join(self._source_subfolder, "CPP", "Build.mak"), + if is_msvc(self): + replace_in_file(self, os.path.join(self.source_folder, "CPP", "Build.mak"), "-MT\r", "-" + str(self.settings.compiler.runtime)) - replace_in_file(self, os.path.join(self._source_subfolder, "CPP", "Build.mak"), + replace_in_file(self, os.path.join(self.source_folder, "CPP", "Build.mak"), "-MD\r", "-" + str(self.settings.compiler.runtime)) - replace_in_file(self, os.path.join(self._source_subfolder, "CPP", "Build.mak"), + replace_in_file(self, os.path.join(self.source_folder, "CPP", "Build.mak"), " -WX ", " ") # Patches for other build systems - replace_in_file(self, os.path.join(self._source_subfolder, "C", "Util", "7z", "makefile.gcc"), + replace_in_file(self, os.path.join(self.source_folder, "C", "Util", "7z", "makefile.gcc"), "CFLAGS = ", - "CFLAGS = -fpermissive ") - replace_in_file(self, os.path.join(self._source_subfolder, "C", "Util", "7z", "makefile.gcc"), + "CFLAGS += -fpermissive ") + replace_in_file(self, os.path.join(self.source_folder, "C", "Util", "7z", "makefile.gcc"), ": 7zAlloc.c", ": ../../7zAlloc.c") - replace_in_file(self, os.path.join(self._source_subfolder, "C", "Util", "Lzma", "makefile.gcc"), + replace_in_file(self, os.path.join(self.source_folder, "CPP", "7zip", "Bundles", "LzmaCon", "makefile.gcc"), "CFLAGS = ", - "CFLAGS = -fpermissive ") - replace_in_file(self, os.path.join(self._source_subfolder, "CPP", "Common", "MyString.h"), + "CFLAGS += -fpermissive ") + replace_in_file(self, os.path.join(self.source_folder, "CPP", "Common", "MyString.h"), "#ifdef _WIN32\r\n", "#ifdef _WIN32\r\n#ifndef UNDER_CE\r\n#include \r\n#endif\r\n") def build(self): self._patch_sources() - if self.settings.compiler == "Visual Studio": + if is_msvc(self): self._build_msvc() else: self._build_autotools() def package(self): - self.copy("lzma.txt", src=self._source_subfolder, dst="licenses") - self.copy("7zC.txt", src=self._source_subfolder, dst="licenses") - if self.settings.compiler == "Visual Studio": + copy(self, "lzma.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, "7zC.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + if is_msvc(self): for make_dir, exe in self._msvc_build_dirs: - self.copy(exe, src=os.path.join(make_dir, self._msvc_cpu), dst="bin", keep_path=False) + copy(self, exe, dst=os.path.join(self.package_folder, "bin"), src=os.path.join(make_dir, self._msvc_cpu), keep_path=False) else: for make_dir, exe in self._autotools_build_dirs: - self.copy(exe, src=os.path.join(make_dir), dst="bin", keep_path=False) + copy(self, exe, dst=os.path.join(self.package_folder, "bin"), src=os.path.join(make_dir), keep_path=False) def package_info(self): self.cpp_info.libdirs = [] diff --git a/recipes/lzma_sdk/9.20/test_package/conanfile.py b/recipes/lzma_sdk/9.20/test_package/conanfile.py index d956ede854042..8ba1177d3f022 100644 --- a/recipes/lzma_sdk/9.20/test_package/conanfile.py +++ b/recipes/lzma_sdk/9.20/test_package/conanfile.py @@ -1,10 +1,16 @@ -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("7zDec", run_environment=True) - self.run("lzma", run_environment=True) + if can_run(self): + self.run("7zDec") + self.run("lzma") diff --git a/recipes/lzma_sdk/9.20/test_v1_package/conanfile.py b/recipes/lzma_sdk/9.20/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..d956ede854042 --- /dev/null +++ b/recipes/lzma_sdk/9.20/test_v1_package/conanfile.py @@ -0,0 +1,10 @@ +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("7zDec", run_environment=True) + self.run("lzma", run_environment=True) diff --git a/recipes/lzo/all/conanfile.py b/recipes/lzo/all/conanfile.py index 1babfd0e8f2d7..2daa81c92934c 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): @@ -12,8 +12,9 @@ class LZOConan(ConanFile): license = "GPL-v2.0" url = "https://github.com/conan-io/conan-center-index" homepage = "http://www.oberhumer.com/opensource/lzo/" - topics = ("lzo", "compression") + topics = ("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 3b25f4d23294d..6dc3bb1b5c347 100644 --- a/recipes/m4/all/conandata.yml +++ b/recipes/m4/all/conandata.yml @@ -1,14 +1,14 @@ sources: "1.4.19": 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" + - "https://ftp.gnu.org/gnu/m4/m4-1.4.19.tar.xz" + - "https://ftpmirror.gnu.org/gnu/m4/m4-1.4.19.tar.xz" + sha256: "63aede5c6d33b6d9b13511cd0be2cac046f2e70fd0a07aa9573a04a82783af96" "1.4.18": 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" + - "https://ftp.gnu.org/gnu/m4/m4-1.4.18.tar.xz" + - "https://ftpmirror.gnu.org/gnu/m4/m4-1.4.18.tar.xz" + sha256: "f2c1e86ca0a404ff281631bdc8377638992744b175afb806e25871a24a934e07" patches: "1.4.19": - patch_file: "patches/1.4.19-0001-open-files-in-binary-mode.patch" diff --git a/recipes/m4/all/conanfile.py b/recipes/m4/all/conanfile.py index ceb7e83548ca8..dadcf2b1794c2 100644 --- a/recipes/m4/all/conanfile.py +++ b/recipes/m4/all/conanfile.py @@ -1,4 +1,5 @@ from conan import ConanFile +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, rmdir, save from conan.tools.gnu import Autotools, AutotoolsToolchain @@ -6,12 +7,14 @@ from conan.tools.microsoft import is_msvc, unix_path from conan.tools.scm import Version import os +import shutil -required_conan_version = ">=1.52.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/" @@ -34,13 +37,12 @@ def package_id(self): def build_requirements(self): 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 + 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_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): env = VirtualBuildEnv(self) @@ -61,11 +63,23 @@ def generate(self): ]) if self.settings.build_type in ("Debug", "RelWithDebInfo"): tc.extra_ldflags.append("-PDB") - elif self.settings.compiler == "clang": - if Version(self.version) < "1.4.19": - tc.extra_cflags.extend([ - "-rtlib=compiler-rt", - "-Wno-unused-command-line-argument", + elif self.settings.compiler == "clang" and Version(self.version) < "1.4.19": + tc.extra_cflags.extend([ + "-rtlib=compiler-rt", + "-Wno-unused-command-line-argument", + ]) + if cross_building(self) and is_msvc(self): + triplet_arch_windows = {"x86_64": "x86_64", "x86": "i686", "armv8": "aarch64"} + + 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}", ]) if self.settings.os == "Windows": tc.configure_args.append("ac_cv_func__set_invalid_parameter_handler=yes") @@ -87,11 +101,12 @@ def generate(self): def _patch_sources(self): apply_conandata_patches(self) - # 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) + 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): self._patch_sources() @@ -102,8 +117,7 @@ def build(self): def package(self): 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)}"]) + autotools.install() rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): @@ -117,7 +131,5 @@ def package_info(self): self.buildenv_info.define_path("M4", 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.PATH.append(os.path.join(self.package_folder, "bin")) self.env_info.M4 = m4_bin diff --git a/recipes/m4/all/patches/1.4.18-0003-secure_snprintf.patch b/recipes/m4/all/patches/1.4.18-0003-secure_snprintf.patch deleted file mode 100644 index 0afa4da0a47d0..0000000000000 --- a/recipes/m4/all/patches/1.4.18-0003-secure_snprintf.patch +++ /dev/null @@ -1,16 +0,0 @@ -patch taken from https://github.com/macports/macports-ports/blob/master/devel/m4/files/secure_snprintf.patch -to fix invalid instruction error on OSX when running m4 - -diff --git a/lib/vasnprintf.c b/lib/vasnprintf.c -index 246831f..ae47ebf 100644 ---- a/lib/vasnprintf.c -+++ b/lib/vasnprintf.c -@@ -4858,7 +4858,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, - #endif - *fbp = dp->conversion; - #if USE_SNPRINTF --# if !(((__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && !defined __UCLIBC__) || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)) -+#if !defined(__APPLE__) && !(((__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && !defined __UCLIBC__) || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)) - fbp[1] = '%'; - fbp[2] = 'n'; - fbp[3] = '\0'; diff --git a/recipes/m4/all/test_package/conanfile.py b/recipes/m4/all/test_package/conanfile.py index 22e16b15f8118..54ca0966a46f1 100644 --- a/recipes/m4/all/test_package/conanfile.py +++ b/recipes/m4/all/test_package/conanfile.py @@ -1,8 +1,4 @@ from conan import ConanFile -from conan.tools.files import save -from io import StringIO -import os -import textwrap class TestPackageConan(ConanFile): @@ -10,27 +6,9 @@ class TestPackageConan(ConanFile): 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): - save(self, 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): - self.run("m4 --version") - self.run(f"m4 -P {self._m4_input_path}") - - self.run(f"m4 -R {self.source_folder}/frozen.m4f {self.source_folder}/test.m4") - - output = StringIO() - self.run(f"m4 -P {self._m4_input_path}", output=output) - assert "Harry, Jr. met Sally" in output.getvalue() + extension = ".exe" if self.settings.os == "Windows" else "" + self.run(f"m4{extension} --version") diff --git a/recipes/m4/all/test_package/frozen.m4f b/recipes/m4/all/test_package/frozen.m4f deleted file mode 100644 index 26431a17d4fd6..0000000000000 --- a/recipes/m4/all/test_package/frozen.m4f +++ /dev/null @@ -1,11 +0,0 @@ -# This is a frozen state file generated by GNU M4 1.4.18 -V1 -Q1,1 -[] -T9,27 -say_hello[Hello ]conanize_name([$1]) -T11,203 -all_letters -  !"#*%&'()$+,./0123456789:;<=>?@[\]^_`{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ- -T13,10 -conanize_name[Conan $1] diff --git a/recipes/m4/all/test_package/test.m4 b/recipes/m4/all/test_package/test.m4 deleted file mode 100644 index a04483498966a..0000000000000 --- a/recipes/m4/all/test_package/test.m4 +++ /dev/null @@ -1,2 +0,0 @@ -say_hello([World]) -[All letters: ]all_letters diff --git a/recipes/m4/all/test_v1_package/conanfile.py b/recipes/m4/all/test_v1_package/conanfile.py deleted file mode 100644 index 23409570c2d3d..0000000000000 --- a/recipes/m4/all/test_v1_package/conanfile.py +++ /dev/null @@ -1,41 +0,0 @@ -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/macdylibbundler/all/conandata.yml b/recipes/macdylibbundler/all/conandata.yml new file mode 100644 index 0000000000000..014ef59305c05 --- /dev/null +++ b/recipes/macdylibbundler/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.0.5": + url: "https://github.com/auriamg/macdylibbundler/archive/refs/tags/1.0.5.tar.gz" + sha256: "13384ebe7ca841ec392ac49dc5e50b1470190466623fa0e5cd30f1c634858530" diff --git a/recipes/macdylibbundler/all/conanfile.py b/recipes/macdylibbundler/all/conanfile.py new file mode 100644 index 0000000000000..774cb3deaaf5d --- /dev/null +++ b/recipes/macdylibbundler/all/conanfile.py @@ -0,0 +1,50 @@ +from conan import ConanFile +from conan.tools.apple import is_apple_os +from conan.tools.files import copy, get +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.errors import ConanInvalidConfiguration + +import os + +required_conan_version = ">=1.53.0" + + +class MacDylibBundlerConan(ConanFile): + name = "macdylibbundler" + package_type = "application" + description = ( + "mac dylib bundler is a tool for use when bundling mac applications" + ) + topics = ("build", "dylib", "installer", "mac") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/auriamg/macdylibbundler" + license = "MIT" + settings = "os", "arch", "build_type" + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + if not is_apple_os(self): + raise ConanInvalidConfiguration("This tool is for macOS only") + + 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, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + # The CMakeLists.txt misses the install command, so for simplicity the executable is copied manually + copy(self, "dylibbundler", src=self.build_folder, dst=os.path.join(self.package_folder, "bin")) + + def package_info(self): + self.cpp_info.includedirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/macdylibbundler/all/test_package/conanfile.py b/recipes/macdylibbundler/all/test_package/conanfile.py new file mode 100644 index 0000000000000..7909754cbfd68 --- /dev/null +++ b/recipes/macdylibbundler/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", "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("dylibbundler -h") diff --git a/recipes/macdylibbundler/config.yml b/recipes/macdylibbundler/config.yml new file mode 100644 index 0000000000000..84f5016ed4a14 --- /dev/null +++ b/recipes/macdylibbundler/config.yml @@ -0,0 +1,3 @@ +versions: + "1.0.5": + folder: all diff --git a/recipes/maddy/all/conandata.yml b/recipes/maddy/all/conandata.yml index 91359378f2072..b4bf9474c36c1 100644 --- a/recipes/maddy/all/conandata.yml +++ b/recipes/maddy/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "1.3.0": + url: "https://github.com/progsource/maddy/archive/refs/tags/1.3.0.tar.gz" + sha256: "561681f8c8d2b998c153cda734107a0bc1dea4bb0df69fd813922da63fa9f3e7" + "1.2.1": + url: "https://github.com/progsource/maddy/archive/refs/tags/1.2.1.tar.gz" + sha256: "b6058bce7ca32506969633ee7a4042e75b07464489f1c44be00913543cd687ef" "1.1.2": - sha256: ce66e1ee63bda3a6ab9c814edc0ed818abecca1c2218307ff87fb9ec1fc970fc - url: https://github.com/progsource/maddy/archive/refs/tags/1.1.2.tar.gz + url: "https://github.com/progsource/maddy/archive/refs/tags/1.1.2.tar.gz" + sha256: "ce66e1ee63bda3a6ab9c814edc0ed818abecca1c2218307ff87fb9ec1fc970fc" diff --git a/recipes/maddy/all/conanfile.py b/recipes/maddy/all/conanfile.py index 7bcdd1cec24d5..b023f2456bef0 100644 --- a/recipes/maddy/all/conanfile.py +++ b/recipes/maddy/all/conanfile.py @@ -1,47 +1,63 @@ -from conans import ConanFile, tools import os -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.files import copy, get +from conan.tools.layout import basic_layout +from conan.tools.scm import Version + +required_conan_version = ">=1.52.0" class MaddyConan(ConanFile): name = "maddy" + description = "open-source, maddy is a C++ Markdown to HTML header-only parser library." + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/progsource/maddy" - description = ( - "open-source, maddy is a C++ Markdown to HTML header-only parser library." - ) - topics = ("maddy", "markdown", "header-only") - license = "MIT" + topics = ("markdown", "header-only") + + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 14 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "6", + "clang": "5", + "apple-clang": "10", + "Visual Studio": "15", + "msvc": "191", + } + + 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, 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.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 package_id(self): - self.info.header_only() + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): - self.copy( - "LICENSE", - src=os.path.join(self.source_folder, self._source_subfolder), - dst="licenses", - ) - self.copy( - pattern="maddy/*.h", - src=os.path.join(self.source_folder, self._source_subfolder, "include"), - dst="include", - ) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, pattern="maddy/*.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/maddy/all/test_package/CMakeLists.txt b/recipes/maddy/all/test_package/CMakeLists.txt index b85bbd5581573..9b4b9a74cb47a 100755 --- a/recipes/maddy/all/test_package/CMakeLists.txt +++ b/recipes/maddy/all/test_package/CMakeLists.txt @@ -1,12 +1,8 @@ -cmake_minimum_required(VERSION 3.5) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) find_package(maddy REQUIRED CONFIG) add_executable(${PROJECT_NAME} example.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE maddy::maddy) -set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 14 CXX_STANDARD_REQUIRED - ON) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/maddy/all/test_package/conanfile.py b/recipes/maddy/all/test_package/conanfile.py index 38f4483872d47..ef5d7042163ec 100755 --- a/recipes/maddy/all/test_package/conanfile.py +++ b/recipes/maddy/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/maddy/all/test_package/example.cpp b/recipes/maddy/all/test_package/example.cpp old mode 100755 new mode 100644 diff --git a/recipes/maddy/all/test_v1_package/CMakeLists.txt b/recipes/maddy/all/test_v1_package/CMakeLists.txt new file mode 100755 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/maddy/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/maddy/all/test_v1_package/conanfile.py b/recipes/maddy/all/test_v1_package/conanfile.py new file mode 100755 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/maddy/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/maddy/config.yml b/recipes/maddy/config.yml index 8d13aefb6b4fb..90c91d00495eb 100644 --- a/recipes/maddy/config.yml +++ b/recipes/maddy/config.yml @@ -1,3 +1,7 @@ versions: + "1.3.0": + folder: all + "1.2.1": + folder: all "1.1.2": folder: all diff --git a/recipes/magic_enum/all/conandata.yml b/recipes/magic_enum/all/conandata.yml index f1eb6c3e30073..e5f6eb2e8377e 100644 --- a/recipes/magic_enum/all/conandata.yml +++ b/recipes/magic_enum/all/conandata.yml @@ -1,28 +1,34 @@ sources: - "0.6.5": - sha256: "37A69482517C8976CB48CD271DA8C6BA92E07EE2AB2BDD7CAEF4C8158AF77359" - url: "https://github.com/Neargye/magic_enum/archive/v0.6.5.tar.gz" - "0.6.6": - sha256: "1033f9a9315023feebb48f20d5a572149ec72c1e95a52bcf7042a412ff9d2e28" - url: "https://github.com/Neargye/magic_enum/archive/v0.6.6.tar.gz" - "0.7.0": - sha256: "4fe6627407a656d0d73879c0346b251ccdcfb718c37bef5410ba172c7c7d5f9a" - url: "https://github.com/Neargye/magic_enum/archive/v0.7.0.tar.gz" - "0.7.1": - url: "https://github.com/Neargye/magic_enum/archive/v0.7.1.tar.gz" - sha256: "11bb590dd055194e92936fa4d0652084c14bd23ac8e4b5a02271b6259a05cec9" - "0.7.2": - url: "https://github.com/Neargye/magic_enum/archive/v0.7.2.tar.gz" - sha256: "a77895ebc684f7a4dd2e4e06529b22e9ae694037f6dee0753d3ce0bbcd5b3e38" - "0.7.3": - url: "https://github.com/Neargye/magic_enum/archive/v0.7.3.tar.gz" - sha256: "b8d0cd848546fee136dc1fa4bb021a1e4dc8fe98e44d8c119faa3ef387636bf7" - "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.9.7": + url: "https://github.com/Neargye/magic_enum/archive/v0.9.7.tar.gz" + sha256: "b403d3dad4ef542fdc3024fa37d3a6cedb4ad33c72e31b6d9bab89dcaf69edf7" + "0.9.6": + url: "https://github.com/Neargye/magic_enum/archive/v0.9.6.tar.gz" + sha256: "fcda8295256a2084f1f98a63b3d2c66b3d7140eea008e1ef94ea015b2f6d3034" + "0.9.5": + url: "https://github.com/Neargye/magic_enum/archive/v0.9.5.tar.gz" + sha256: "44ad80db5a72f5047e01d90e18315751d9ac90c0ab42cbea7a6f9ec66a4cd679" + "0.9.4": + url: "https://github.com/Neargye/magic_enum/archive/v0.9.4.tar.gz" + sha256: "0ffc840d881a377a520e999b79ec2823b3b8ffadccad5d94084cc37fcf6fe2c9" + "0.9.3": + url: "https://github.com/Neargye/magic_enum/archive/v0.9.3.tar.gz" + sha256: "3cadd6a05f1bffc5141e5e731c46b2b73c2dbff025e723c8abaa659e0a24f072" + "0.9.2": + url: "https://github.com/Neargye/magic_enum/archive/v0.9.2.tar.gz" + sha256: "7887d6a2dfdec65acb7a529a620b3c6f53f30cca55b419ac8ca688a089149e1a" + "0.9.1": + url: "https://github.com/Neargye/magic_enum/archive/v0.9.1.tar.gz" + sha256: "864798f3146de2bb0da766f87d9a64b1742a5d109661b5bf4fdf839040b854d7" + "0.9.0": + url: "https://github.com/Neargye/magic_enum/archive/v0.9.0.tar.gz" + sha256: "2fb2f602b4660f8af539ee00958132a397e138bda19aa1ceae546de3a143386b" "0.8.2": url: "https://github.com/Neargye/magic_enum/archive/v0.8.2.tar.gz" sha256: "62bd7034bbbfc3d7806001767d5775ab42f3ff33bb38366e1ceb21102f0dff9a" + "0.8.1": + url: "https://github.com/Neargye/magic_enum/archive/v0.8.1.tar.gz" + sha256: "6b948d1680f02542d651fc82154a9e136b341ce55c5bf300736b157e23f9df11" + "0.8.0": + url: "https://github.com/Neargye/magic_enum/archive/v0.8.0.tar.gz" + sha256: "5e7680e877dd4cf68d9d0c0e3c2a683b432a9ba84fc1993c4da3de70db894c3c" diff --git a/recipes/magic_enum/all/conanfile.py b/recipes/magic_enum/all/conanfile.py index ad2dd7598a2f6..5a5f4c8dfc750 100644 --- a/recipes/magic_enum/all/conanfile.py +++ b/recipes/magic_enum/all/conanfile.py @@ -1,8 +1,8 @@ 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.files import copy, get, rmdir +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout from conan.tools.scm import Version import os @@ -15,11 +15,12 @@ class MagicEnumConan(ConanFile): "Header-only C++17 library provides static reflection for enums, work " "with any enum type without any macro or boilerplate code." ) - topics = ("cplusplus", "enum-to-string", "string-to-enum", "serialization", - "reflection", "header-only", "compile-time") + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/Neargye/magic_enum" - license = "MIT" + topics = ("cplusplus", "enum-to-string", "string-to-enum", "serialization", + "reflection", "header-only", "compile-time") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -32,12 +33,13 @@ def _compilers_minimum_version(self): return { "gcc": "9", "Visual Studio": "15", + "msvc": "191", "clang": "5", "apple-clang": "10", } def layout(self): - basic_layout(self, src_folder="src") + cmake_layout(self, src_folder="src") def package_id(self): self.info.clear() @@ -52,20 +54,31 @@ def validate(self): ) 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.cache_variables["MAGIC_ENUM_OPT_BUILD_EXAMPLES"] = False + tc.cache_variables["MAGIC_ENUM_OPT_BUILD_TESTS"] = False + tc.generate() def build(self): - pass + cmake = CMake(self) + cmake.configure() + cmake.build() 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")) + cmake = CMake(self) + cmake.install() + if "0.9.4" <= Version(self.version) <= "0.9.6": + copy(self, "*", os.path.join(self.package_folder, "include"), os.path.join(self.package_folder, "include", "magic_enum")) + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + rmdir(self, os.path.join(self.package_folder, "lib")) + rmdir(self, os.path.join(self.package_folder, "share")) 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.set_property("pkg_config_name", "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 c185d76435a4f..b1f5d91d96ce3 100644 --- a/recipes/magic_enum/all/test_package/CMakeLists.txt +++ b/recipes/magic_enum/all/test_package/CMakeLists.txt @@ -6,3 +6,6 @@ find_package(magic_enum REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE magic_enum::magic_enum) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +if(magic_enum_VERSION VERSION_LESS "0.9.7") + target_compile_definitions(${PROJECT_NAME} PRIVATE MAGIC_ENUM_TOP_LEVEL_HEADER) +endif() diff --git a/recipes/magic_enum/all/test_package/test_package.cpp b/recipes/magic_enum/all/test_package/test_package.cpp index fcb911e1f966e..65c32ced2f74c 100644 --- a/recipes/magic_enum/all/test_package/test_package.cpp +++ b/recipes/magic_enum/all/test_package/test_package.cpp @@ -1,4 +1,8 @@ +#ifdef MAGIC_ENUM_TOP_LEVEL_HEADER #include +#else +#include +#endif #include #include diff --git a/recipes/magic_enum/all/test_v1_package/CMakeLists.txt b/recipes/magic_enum/all/test_v1_package/CMakeLists.txt index de886ea1bc291..be00a8c7f57c7 100644 --- a/recipes/magic_enum/all/test_v1_package/CMakeLists.txt +++ b/recipes/magic_enum/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(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) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/magic_enum/config.yml b/recipes/magic_enum/config.yml index affbfa65ae445..6d1028c96eda4 100644 --- a/recipes/magic_enum/config.yml +++ b/recipes/magic_enum/config.yml @@ -1,19 +1,23 @@ versions: - "0.6.5": + "0.9.7": folder: all - "0.6.6": + "0.9.6": folder: all - "0.7.0": + "0.9.5": folder: all - "0.7.1": + "0.9.4": folder: all - "0.7.2": + "0.9.3": folder: all - "0.7.3": + "0.9.2": folder: all - "0.8.0": + "0.9.1": folder: all - "0.8.1": + "0.9.0": folder: all "0.8.2": folder: all + "0.8.1": + folder: all + "0.8.0": + 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..2dff6b32eec93 100644 --- a/recipes/mailio/all/conandata.yml +++ b/recipes/mailio/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "0.24.1": + url: "https://github.com/karastojko/mailio/archive/refs/tags/0.24.1.tar.gz" + sha256: "52d5ced35b6a87677d897010fb2e7c2d2ddbd834d59aab991c65c0c6627af40f" + "0.23.0": + url: "https://github.com/karastojko/mailio/archive/refs/tags/0.23.0.tar.gz" + sha256: "9fc3f1f803a85170c2081cbbef2e301473a400683fc1dffefa2d6707598206a5" + "0.22.0": + url: "https://github.com/karastojko/mailio/archive/refs/tags/0.22.0.tar.gz" + sha256: "e177522f0479f33b6cbc7085268ca385140457eb752b45f07e5d6b41e314ece9" "0.21.0": url: "https://github.com/karastojko/mailio/archive/refs/tags/0.21.0.tar.gz" sha256: "8f58dfc8bcbe01224c788f22c544c27611e3c411ed5a2097488fbb32a3c0fb3d" @@ -6,9 +15,23 @@ sources: url: "https://github.com/karastojko/mailio/archive/refs/tags/0.20.0.tar.gz" sha256: "073d6b1ff891444b54a01c2a3f17074fd612f9e2e14d9ebd61863c70737b1882" patches: + "0.24.1": + - patch_file: "patches/0.24.1-adapt-cmakelists.patch" + patch_description: "fix install path" + patch_type: "conan" + "0.23.0": + - patch_file: "patches/0.23.0-adapt-cmakelists.patch" + patch_description: "fix install path" + patch_type: "conan" + "0.22.0": + - patch_file: "patches/0.22.0-adapt-cmakelists.patch" + patch_description: "fix install path" + patch_type: "conan" "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..62a3f2aa9e52a 100644 --- a/recipes/mailio/all/conanfile.py +++ b/recipes/mailio/all/conanfile.py @@ -1,100 +1,93 @@ -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, CMakeDeps, 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.scm import Version import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=2.0.9" -class mailioConan(ConanFile): +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" + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "fPIC": [True, False], - "shared": [True, False] + "shared": [True, False], } default_options = { "fPIC": True, - "shared": False + "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" - - @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 + implements = ["auto_shared_fpic"] 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 + export_conandata_patches(self) - def configure(self): - if self.options.shared: - del self.options.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.86.0", transitive_headers=True, transitive_libs=True) + self.requires("openssl/[>=1.1 <4]", transitive_headers=True, transitive_libs=True) def validate(self): - if self.settings.get_safe("compiler.cppstd"): - tools.check_min_cppstd(self, "17") - 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.") - except KeyError: - self.output.warn("This recipe has no support for the current compiler. Please consider adding it.") + check_min_cppstd(self, 17) def build_requirements(self): - # mailio requires cmake >= 3.16.3 - self.build_requires("cmake/3.23.2") + self.tool_requires("cmake/[>=3.16.3 <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], strip_root=True) + apply_conandata_patches(self) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + + tc = CMakeToolchain(self) + if Version(self.version) < "0.24.0": + tc.variables["MAILIO_BUILD_SHARED_LIBRARY"] = self.options.shared + tc.variables["MAILIO_BUILD_DOCUMENTATION"] = False + tc.variables["MAILIO_BUILD_EXAMPLES"] = False + if Version(self.version) >= "0.22.0": + tc.variables["MAILIO_BUILD_TESTS"] = 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() + 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")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): self.cpp_info.libs = ["mailio"] - self.cpp_info.requires = ["boost::system", "boost::date_time", "boost::regex", "openssl::openssl"] + self.cpp_info.requires = [ + "boost::system", + "boost::date_time", + "boost::regex", + "openssl::openssl", + ] + if self.dependencies["boost"].options.get_safe("with_stacktrace_backtrace"): + self.cpp_info.requires.append("boost::stacktrace_backtrace") + + self.cpp_info.set_property("pkg_config_name", "mailio") + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") diff --git a/recipes/mailio/all/patches/0.22.0-adapt-cmakelists.patch b/recipes/mailio/all/patches/0.22.0-adapt-cmakelists.patch new file mode 100644 index 0000000000000..417d346368830 --- /dev/null +++ b/recipes/mailio/all/patches/0.22.0-adapt-cmakelists.patch @@ -0,0 +1,30 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index a79e042..9306cba 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -145,7 +145,7 @@ configure_file(mailio.pc.in ${CMAKE_BINARY_DIR}/mailio.pc IMMEDIATE @ONLY) + install(FILES ${CMAKE_BINARY_DIR}/mailio.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) + + configure_file(${PROJECT_SOURCE_DIR}/include/version.hpp.in version.hpp) +-install(FILES ${CMAKE_BINARY_DIR}/version.hpp DESTINATION ${INCLUDE_INSTALL_DIR}/${PROJECT_NAME}) ++install(FILES ${PROJECT_BINARY_DIR}/version.hpp DESTINATION ${INCLUDE_INSTALL_DIR}/${PROJECT_NAME}) + + # generate the export header for exporting symbols + # this is needed to generate a shared library. +@@ -181,16 +181,11 @@ endif() + install(DIRECTORY include/mailio DESTINATION ${INCLUDE_INSTALL_DIR}) + + install(TARGETS ${PROJECT_NAME} +- EXPORT ${PROJECT_NAME}Config + LIBRARY DESTINATION ${LIB_INSTALL_DIR} + ARCHIVE DESTINATION ${LIB_INSTALL_DIR} + RUNTIME DESTINATION ${BIN_INSTALL_DIR} + ) + +-export(TARGETS ${PROJECT_NAME} FILE ${PROJECT_NAME}Config.cmake) +- +-install(EXPORT ${PROJECT_NAME}Config DESTINATION share/${PROJECT_NAME}/cmake) +- + # optionally build examples + if(${MAILIO_BUILD_EXAMPLES}) + add_subdirectory(examples) diff --git a/recipes/mailio/all/patches/0.23.0-adapt-cmakelists.patch b/recipes/mailio/all/patches/0.23.0-adapt-cmakelists.patch new file mode 100644 index 0000000000000..a29154c581b87 --- /dev/null +++ b/recipes/mailio/all/patches/0.23.0-adapt-cmakelists.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index e3b30fd..d1adcab 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -146,7 +146,7 @@ configure_file(mailio.pc.in ${CMAKE_BINARY_DIR}/mailio.pc IMMEDIATE @ONLY) + install(FILES ${CMAKE_BINARY_DIR}/mailio.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) + + configure_file(${PROJECT_SOURCE_DIR}/include/version.hpp.in version.hpp) +-install(FILES ${CMAKE_BINARY_DIR}/version.hpp DESTINATION ${INCLUDE_INSTALL_DIR}/${PROJECT_NAME}) ++install(FILES ${PROJECT_BINARY_DIR}/version.hpp DESTINATION ${INCLUDE_INSTALL_DIR}/${PROJECT_NAME}) + + # generate the export header for exporting symbols + # this is needed to generate a shared library. diff --git a/recipes/mailio/all/patches/0.24.1-adapt-cmakelists.patch b/recipes/mailio/all/patches/0.24.1-adapt-cmakelists.patch new file mode 100644 index 0000000000000..455368841fccc --- /dev/null +++ b/recipes/mailio/all/patches/0.24.1-adapt-cmakelists.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 30d4e0d..747cfab 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -144,7 +144,7 @@ configure_file(mailio.pc.in ${CMAKE_BINARY_DIR}/mailio.pc IMMEDIATE @ONLY) + install(FILES ${CMAKE_BINARY_DIR}/mailio.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) + + configure_file(${PROJECT_SOURCE_DIR}/include/version.hpp.in version.hpp) +-install(FILES ${CMAKE_BINARY_DIR}/version.hpp DESTINATION ${INCLUDE_INSTALL_DIR}/${PROJECT_NAME}) ++install(FILES ${PROJECT_BINARY_DIR}/version.hpp DESTINATION ${INCLUDE_INSTALL_DIR}/${PROJECT_NAME}) + + # generate the export header for exporting symbols + # this is needed to generate a shared library. 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..a9fb96656f203 100644 --- a/recipes/mailio/all/test_package/conanfile.py +++ b/recipes/mailio/all/test_package/conanfile.py @@ -1,28 +1,26 @@ +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 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_package/test_package.cpp b/recipes/mailio/all/test_package/test_package.cpp index ffc54c18c0369..43678d207e054 100644 --- a/recipes/mailio/all/test_package/test_package.cpp +++ b/recipes/mailio/all/test_package/test_package.cpp @@ -8,7 +8,4 @@ int main() { msg.add_recipient(mailio::mail_address("mailio library", "mailio@gmail.com")); msg.subject("smtps simple message"); msg.content("Hello, World!"); - - mailio::smtps conn("smtp.gmail.com", 587); - std::cout << msg.content() << "\n";; } diff --git a/recipes/mailio/config.yml b/recipes/mailio/config.yml index ad2748292fb8c..b5b8a58f15492 100644 --- a/recipes/mailio/config.yml +++ b/recipes/mailio/config.yml @@ -1,4 +1,10 @@ versions: + "0.24.1": + folder: all + "0.23.0": + folder: all + "0.22.0": + folder: all "0.21.0": folder: all "0.20.0": diff --git a/recipes/make/all/conandata.yml b/recipes/make/all/conandata.yml index fb6e6264363e7..e1b821e38a6db 100644 --- a/recipes/make/all/conandata.yml +++ b/recipes/make/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "4.4.1": + url: "http://ftpmirror.gnu.org/gnu/make/make-4.4.1.tar.gz" + sha256: "dd16fb1d67bfab79a72f5e8390735c49e3e8e70b4945a15ab1f81ddb78658fb3" + "4.4": + url: "http://ftpmirror.gnu.org/gnu/make/make-4.4.tar.gz" + sha256: "581f4d4e872da74b3941c874215898a7d35802f03732bdccee1d4a7979105d18" "4.3": url: "http://ftpmirror.gnu.org/gnu/make/make-4.3.tar.gz" sha256: "e05fdde47c5f7ca45cb697e973894ff4f5d79e13b750ed57d7b66d8defc78e19" @@ -6,6 +12,10 @@ sources: url: "http://ftpmirror.gnu.org/gnu/make/make-4.2.1.tar.bz2" sha256: "d6e262bf3601b42d2b1e4ef8310029e1dcf20083c5446b4b7aa67081fdffc589" patches: + "4.4.1": + - patch_file: "patches/4.4.1-0001-clang.patch" + "4.4": + - patch_file: "patches/4.3-0001-clang.patch" "4.3": - patch_file: "patches/4.3-0001-clang.patch" "4.2.1": diff --git a/recipes/make/all/patches/4.4.1-0001-clang.patch b/recipes/make/all/patches/4.4.1-0001-clang.patch new file mode 100644 index 0000000000000..3e884bebdc9ef --- /dev/null +++ b/recipes/make/all/patches/4.4.1-0001-clang.patch @@ -0,0 +1,5 @@ +--- lib/glob.c ++++ lib/glob.c +@@ -139,1 +139,1 @@ +-#if !defined __alloca && !defined __GNU_LIBRARY__ ++#if (!defined __alloca && defined __GNU_LIBRARY__ && __linux__) || (!defined __alloca && !defined __GNU_LIBRARY__) diff --git a/recipes/make/config.yml b/recipes/make/config.yml index 0260fd9e5313f..6c7e54ea2509c 100644 --- a/recipes/make/config.yml +++ b/recipes/make/config.yml @@ -1,4 +1,8 @@ versions: + "4.4.1": + folder: all + "4.4": + folder: all "4.3": folder: all "4.2.1": diff --git a/recipes/makefile-project-workspace-creator/all/conanfile.py b/recipes/makefile-project-workspace-creator/all/conanfile.py index c3268efeaebb0..4a70766451e93 100644 --- a/recipes/makefile-project-workspace-creator/all/conanfile.py +++ b/recipes/makefile-project-workspace-creator/all/conanfile.py @@ -1,37 +1,51 @@ import os -from conans import ConanFile, tools + +from conan import ConanFile +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout + +required_conan_version = ">=1.53.0" class MPCGeneratorConan(ConanFile): name = "makefile-project-workspace-creator" description = "The Makefile, Project and Workspace Creator" license = "BSD-3-Clause" - homepage = "https://objectcomputing.com/" url = "https://github.com/conan-io/conan-center-index" - topics = ("conan", "makefile-project-workspace-creator", "objectcomputing", "installer") - settings = "os" + homepage = "https://github.com/objectcomputing/MPC" + topics = ("objectcomputing", "installer") - @property - def _source_subfolder(self): - return "source_subfolder" + package_type = "build-scripts" + settings = "os", "arch", "compiler", "build_type" - def requirements(self): - if self.settings.os == "Windows": - self.requires("strawberryperl/5.30.0.1") + def layout(self): + basic_layout(self, src_folder="src") - def build(self): - pass + def package_id(self): + self.info.clear() - def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename("MPC-MPC_" + self.version.replace(".", "_"), self._source_subfolder) + def build(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): - self.copy(pattern="*", src=self._source_subfolder, dst="bin") - self.copy(pattern="LICENSE", src=os.path.join(self._source_subfolder, "docs"), dst="licenses") + copy(self, "*", + src=self.build_folder, + dst=os.path.join(self.package_folder, "bin"), + excludes=["history", "docs", "rpm", "MPC.ico", "PROBLEM-REPORT-FORM", "azure-pipelines.yml", "ChangeLog"]) + copy(self, "LICENSE", + src=os.path.join(self.build_folder, "docs"), + dst=os.path.join(self.package_folder, "licenses")) def package_info(self): + self.cpp_info.frameworkdirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] + self.cpp_info.includedirs = [] + bin_path = os.path.join(self.package_folder, "bin") - self.output.info('Appending PATH environment variable: %s' % bin_path) + # MPC_ROOT: https://github.com/objectcomputing/MPC/blob/5b4c2443871e5e9b6267edef17fed66afc125fa4/docs/USAGE#L243 + self.buildenv_info.define("MPC_ROOT", bin_path) + + # TODO: Remove after dropping Conan 1.x self.env_info.PATH.append(bin_path) self.env_info.MPC_ROOT = bin_path diff --git a/recipes/makefile-project-workspace-creator/all/test_package/conanfile.py b/recipes/makefile-project-workspace-creator/all/test_package/conanfile.py index d02d604b53d44..a57997b529e79 100644 --- a/recipes/makefile-project-workspace-creator/all/test_package/conanfile.py +++ b/recipes/makefile-project-workspace-creator/all/test_package/conanfile.py @@ -1,12 +1,25 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.layout import basic_layout +from conan.tools.files import save, load +import os -class DefaultNameConan(ConanFile): - settings = "os" +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "VirtualBuildEnv", "VirtualRunEnv" + test_type = "explicit" - def build(self): - pass + def layout(self): + basic_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def generate(self): + build_vars = self.dependencies[self.tested_reference_str].buildenv_info.vars(self, scope="build") + mpc_root = build_vars["MPC_ROOT"] + save(self, os.path.join(self.build_folder, "mpc_root.txt"), mpc_root) def test(self): - if not tools.cross_building(self.settings): - self.run("perl -S mpc.pl --version", run_environment=True) + mpc_root = load(self, os.path.join(self.build_folder, "mpc_root.txt")) + assert os.path.exists(os.path.join(mpc_root, 'mpc.pl')) diff --git a/recipes/manif/all/conandata.yml b/recipes/manif/all/conandata.yml new file mode 100644 index 0000000000000..5d0f0b0b2a6f2 --- /dev/null +++ b/recipes/manif/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.0.5": + url: "https://github.com/artivis/manif/archive/refs/tags/0.0.5.tar.gz" + sha256: "246a781c54a5c57179d48096faca0d108944e120f69d8fd7fb69e3cb4a0a67fb" diff --git a/recipes/manif/all/conanfile.py b/recipes/manif/all/conanfile.py new file mode 100644 index 0000000000000..f0f62f808f152 --- /dev/null +++ b/recipes/manif/all/conanfile.py @@ -0,0 +1,66 @@ +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.52.0" + + +class PackageConan(ConanFile): + name = "manif" + description = "A small C++11 header-only library for Lie theory" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://artivis.github.io/manif" + topics = ("lie-groups", "state-estimation", "geometry", "robotics", "computer-vision", "header-only") + + package_type = "header-library" + 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 requirements(self): + self.requires("eigen/3.4.0") + self.requires("tl-optional/1.1.0") + + def package_id(self): + self.info.clear() + + 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." + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def package(self): + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + copy(self, "*.h", os.path.join(self.source_folder, "include"), os.path.join(self.package_folder, "include")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "manif") + self.cpp_info.set_property("cmake_target_name", "MANIF::manif") + + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/manif/all/test_package/CMakeLists.txt b/recipes/manif/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..84ba50bb17606 --- /dev/null +++ b/recipes/manif/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(manif REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE MANIF::manif) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/manif/all/test_package/conanfile.py b/recipes/manif/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/manif/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/manif/all/test_package/test_package.cpp b/recipes/manif/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..c82dc520226c0 --- /dev/null +++ b/recipes/manif/all/test_package/test_package.cpp @@ -0,0 +1,10 @@ +#include + +using namespace manif; + +int main() { + SE3d X = SE3d::Random(); + SE3Tangentd w = SE3Tangentd::Random(); + SE3d::Jacobian J_o_x, J_o_w; + auto X_plus_w = X.plus(w, J_o_x, J_o_w); +} diff --git a/recipes/manif/config.yml b/recipes/manif/config.yml new file mode 100644 index 0000000000000..6506e357707be --- /dev/null +++ b/recipes/manif/config.yml @@ -0,0 +1,3 @@ +versions: + "0.0.5": + folder: all diff --git a/recipes/mapbox-geometry/all/conanfile.py b/recipes/mapbox-geometry/all/conanfile.py index 9edf42d2b8db1..38350b712a514 100644 --- a/recipes/mapbox-geometry/all/conanfile.py +++ b/recipes/mapbox-geometry/all/conanfile.py @@ -13,10 +13,11 @@ class MapboxGeometryConan(ConanFile): "Provides header-only, generic C++ interfaces for geometry types, " "geometry collections, and features." ) - topics = ("geometry") + topics = ("geometry",) license = "ISC" homepage = "https://github.com/mapbox/geometry.hpp" url = "https://github.com/conan-io/conan-center-index" + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -24,7 +25,7 @@ def layout(self): basic_layout(self, src_folder="src") def requirements(self): - self.requires("mapbox-variant/1.2.0", transitive_headers=True) + self.requires("mapbox-variant/1.2.0") def package_id(self): self.info.clear() @@ -34,8 +35,7 @@ def validate(self): check_min_cppstd(self, 14) 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 diff --git a/recipes/mapbox-geometry/all/test_v1_package/CMakeLists.txt b/recipes/mapbox-geometry/all/test_v1_package/CMakeLists.txt index e4046b86f9232..b21cc49efde95 100644 --- a/recipes/mapbox-geometry/all/test_v1_package/CMakeLists.txt +++ b/recipes/mapbox-geometry/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.15) +project(test_package) 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) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/mapbox-variant/all/conanfile.py b/recipes/mapbox-variant/all/conanfile.py index dd51a969a8f23..e84afc0329042 100644 --- a/recipes/mapbox-variant/all/conanfile.py +++ b/recipes/mapbox-variant/all/conanfile.py @@ -10,13 +10,17 @@ class MapboxVariantConan(ConanFile): name = "mapbox-variant" description = "An header-only alternative to boost::variant for C++11 and C++14" - topics = ("variant") + topics = ("variant",) license = "BSD-3-Clause" homepage = "https://github.com/mapbox/variant" url = "https://github.com/conan-io/conan-center-index" + package_type = "header-library" 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,12 +28,8 @@ 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def build(self): pass @@ -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/mapbox-variant/all/test_package/conanfile.py b/recipes/mapbox-variant/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/mapbox-variant/all/test_package/conanfile.py +++ b/recipes/mapbox-variant/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/mapbox-variant/all/test_v1_package/CMakeLists.txt b/recipes/mapbox-variant/all/test_v1_package/CMakeLists.txt index 5f12dfeb0954a..b21cc49efde95 100644 --- a/recipes/mapbox-variant/all/test_v1_package/CMakeLists.txt +++ b/recipes/mapbox-variant/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.15) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(mapbox-variant REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE mapbox-variant::mapbox-variant) -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/mapbox-wagyu/all/conandata.yml b/recipes/mapbox-wagyu/all/conandata.yml new file mode 100644 index 0000000000000..b9f6cbffdb795 --- /dev/null +++ b/recipes/mapbox-wagyu/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.5.0": + url: "https://github.com/mapbox/wagyu/archive/refs/tags/0.5.0.tar.gz" + sha256: "88c41eaba03107ebe79052fdbd66e419e903d331a2616a51849018e13648ab83" diff --git a/recipes/mapbox-wagyu/all/conanfile.py b/recipes/mapbox-wagyu/all/conanfile.py new file mode 100644 index 0000000000000..c742efbc4dde0 --- /dev/null +++ b/recipes/mapbox-wagyu/all/conanfile.py @@ -0,0 +1,68 @@ +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.52.0" + +class MapboxWagyuConan(ConanFile): + name = "mapbox-wagyu" + description = "A general library for geometry operations of union, intersections, difference, and xor" + license = "LicenseRef-mapbox-wagyu" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/mapbox/wagyu/" + topics = ("geometry", "clipping", "header-only") + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _min_cppstd(self): + return 14 + + @property + def _compilers_minimum_version(self): + return { + "apple-clang": "10", + "clang": "7", + "gcc": "7", + "msvc": "191", + "Visual Studio": "15", + } + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("mapbox-geometry/2.0.3") + + 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, "LICENSE", 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_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/mapbox-wagyu/all/test_package/CMakeLists.txt b/recipes/mapbox-wagyu/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..84fec480cbc2c --- /dev/null +++ b/recipes/mapbox-wagyu/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(mapbox-wagyu REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE mapbox-wagyu::mapbox-wagyu) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/mapbox-wagyu/all/test_package/conanfile.py b/recipes/mapbox-wagyu/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/mapbox-wagyu/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/mapbox-wagyu/all/test_package/test_package.cpp b/recipes/mapbox-wagyu/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..0cd92638b261b --- /dev/null +++ b/recipes/mapbox-wagyu/all/test_package/test_package.cpp @@ -0,0 +1,28 @@ +#include + +#include +#include + +int main() { + mapbox::geometry::point< std::int64_t> p1 = { 0, 0 }; + mapbox::geometry::point< std::int64_t> p2 = { 100, 100 }; + mapbox::geometry::box< std::int64_t> bbox(p1, p2); + + mapbox::geometry::linear_ring< std::int64_t> lr; + lr.push_back(mapbox::geometry::point< std::int64_t>(25, 25)); + lr.push_back(mapbox::geometry::point< std::int64_t>(175, 25)); + lr.push_back(mapbox::geometry::point< std::int64_t>(175, 75)); + lr.push_back(mapbox::geometry::point< std::int64_t>(25, 75)); + lr.push_back(mapbox::geometry::point< std::int64_t>(25, 25)); + + auto out = mapbox::geometry::wagyu::quick_clip::quick_lr_clip(lr, bbox); + + mapbox::geometry::linear_ring< std::int64_t> want; + want.push_back(mapbox::geometry::point< std::int64_t>(25, 25)); + want.push_back(mapbox::geometry::point< std::int64_t>(100, 25)); + want.push_back(mapbox::geometry::point< std::int64_t>(100, 75)); + want.push_back(mapbox::geometry::point< std::int64_t>(25, 75)); + want.push_back(mapbox::geometry::point< std::int64_t>(25, 25)); + + assert(out == want); +} diff --git a/recipes/mapbox-wagyu/config.yml b/recipes/mapbox-wagyu/config.yml new file mode 100644 index 0000000000000..ca7b2c3985d5e --- /dev/null +++ b/recipes/mapbox-wagyu/config.yml @@ -0,0 +1,3 @@ +versions: + "0.5.0": + folder: all diff --git a/recipes/mariadb-connector-c/all/conandata.yml b/recipes/mariadb-connector-c/all/conandata.yml index a74dc266f2982..599405bd8a89f 100644 --- a/recipes/mariadb-connector-c/all/conandata.yml +++ b/recipes/mariadb-connector-c/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "3.3.8": + url: "https://downloads.mariadb.com/Connectors/c/connector-c-3.3.8/mariadb-connector-c-3.3.8-src.tar.gz" + sha256: "f9f076b4aa9fb22cc94b24f82c80f9ef063805ecd6533a2eb5d5060cf93833e8" + "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 +15,64 @@ 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.8": + - patch_file: "patches/3.3.8-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-0004-include-mysqld_error-header.patch" + patch_description: "always include mysqld_error.h" + patch_type: "portability" + "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.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.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 c754d56ff28d9..28811d8017067 100644 --- a/recipes/mariadb-connector-c/all/conanfile.py +++ b/recipes/mariadb-connector-c/all/conanfile.py @@ -2,6 +2,7 @@ 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 +from conan.tools.scm import Version import os required_conan_version = ">=1.53.0" @@ -16,6 +17,7 @@ class MariadbConnectorcConan(ConanFile): homepage = "https://mariadb.com/kb/en/mariadb-connector-c" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -53,23 +55,25 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("zlib/1.2.13") + self.requires("zlib/[>=1.2.11 <2]") if self.options.get_safe("with_iconv"): self.requires("libiconv/1.17") if self.options.with_curl: - self.requires("libcurl/7.85.0") + self.requires("libcurl/[>=7.78.0 <9]") if self.options.with_ssl == "openssl": - self.requires("openssl/1.1.1s") + self.requires("openssl/[>=1.1 <4]") + if Version(self.version) >= "3.3": + # INFO: https://mariadb.com/kb/en/mariadb-connector-c-330-release-notes + self.requires("zstd/1.5.5") def validate(self): - if self.info.settings.os != "Windows" and self.info.options.with_ssl == "schannel": + if self.settings.os != "Windows" and self.options.with_ssl == "schannel": raise ConanInvalidConfiguration("schannel only supported on Windows") - if self.info.options.with_ssl == "gnutls": + if self.options.with_ssl == "gnutls": raise ConanInvalidConfiguration("gnutls not yet available in CCI") 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) @@ -88,17 +92,20 @@ def generate(self): tc.variables["INSTALL_BINDIR"] = "bin" tc.variables["INSTALL_LIBDIR"] = "lib" tc.variables["INSTALL_PLUGINDIR"] = os.path.join("lib", "plugin").replace("\\", "/") + tc.variables["ZLIB_LIBRARY"] = "ZLIB::ZLIB" # To install relocatable shared libs on Macos tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" tc.generate() deps = CMakeDeps(self) + if Version(self.version) >= "3.3": + deps.set_property("zstd", "cmake_file_name", "ZSTD") deps.generate() def _patch_sources(self): apply_conandata_patches(self) root_cmake = os.path.join(self.source_folder, "CMakeLists.txt") - replace_in_file(self, root_cmake, "${ZLIB_LIBRARY}", "${ZLIB_LIBRARIES}") + libmariadb_cmake = os.path.join(self.source_folder, "libmariadb", "CMakeLists.txt") replace_in_file(self, root_cmake, "SET(SSL_LIBRARIES ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY})", @@ -107,6 +114,14 @@ def _patch_sources(self): replace_in_file(self, root_cmake, "${CURL_LIBRARIES}", "CURL::libcurl") plugins_io_cmake = os.path.join(self.source_folder, "plugins", "io", "CMakeLists.txt") replace_in_file(self, plugins_io_cmake, "${CURL_LIBRARIES}", "CURL::libcurl") + if Version(self.version) >= "3.3.6": + replace_in_file(self, root_cmake, "${WARNING_AS_ERROR}", "") + elif Version(self.version) >= "3.1.18": + replace_in_file(self, root_cmake, " -WX", "") + if Version(self.version) >= "3.3": + replace_in_file(self, root_cmake, + "INCLUDE(${CC_SOURCE_DIR}/cmake/FindZStd.cmake)", + "find_package(ZSTD REQUIRED CONFIG)") def build(self): self._patch_sources() @@ -120,6 +135,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): @@ -134,9 +150,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.runenv_info.prepend_path("MARIADB_PLUGIN_DIR", plugin_dir) - # TODO: to remove in conan v2? - self.cpp_info.names["pkg_config"] = "libmariadb" + # TODO: to remove in conan v2 self.env_info.MARIADB_PLUGIN_DIR.append(plugin_dir) 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.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..31844dd32529b --- /dev/null +++ b/recipes/mariadb-connector-c/all/patches/3.3.3-0001-fix-install-and-static-or-shared.patch @@ -0,0 +1,118 @@ +diff --git a/libmariadb/CMakeLists.txt b/libmariadb/CMakeLists.txt +index 070fdc9..77584e6 100644 +--- a/libmariadb/CMakeLists.txt ++++ b/libmariadb/CMakeLists.txt +@@ -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/patches/3.3.8-0001-fix-install-and-static-or-shared.patch b/recipes/mariadb-connector-c/all/patches/3.3.8-0001-fix-install-and-static-or-shared.patch new file mode 100644 index 0000000000000..0dfadf76c0436 --- /dev/null +++ b/recipes/mariadb-connector-c/all/patches/3.3.8-0001-fix-install-and-static-or-shared.patch @@ -0,0 +1,117 @@ +--- libmariadb/CMakeLists.txt ++++ libmariadb/CMakeLists.txt +@@ -414,7 +414,7 @@ + ENDIF() + + +-IF(CMAKE_VERSION VERSION_GREATER 2.8.7) ++IF(FALSE) + # CREATE OBJECT LIBRARY + ADD_LIBRARY(mariadb_obj OBJECT ${LIBMARIADB_SOURCES}) + IF(UNIX) +@@ -443,21 +443,24 @@ + "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} ${CRYPTO_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} ${CRYPTO_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") +@@ -466,11 +469,14 @@ + 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 +@@ -490,11 +496,15 @@ + 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}") +@@ -502,20 +512,33 @@ + + 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) +@@ -524,3 +547,4 @@ + CONFIGURATIONS Debug RelWithDebInfo + COMPONENT Development) + ENDIF() ++ENDIF() diff --git a/recipes/mariadb-connector-c/config.yml b/recipes/mariadb-connector-c/config.yml index 74d65343f6ebd..4b9cbb0316174 100644 --- a/recipes/mariadb-connector-c/config.yml +++ b/recipes/mariadb-connector-c/config.yml @@ -1,4 +1,10 @@ versions: + "3.3.8": + folder: all + "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 deleted file mode 100644 index 84887fbda2ddf..0000000000000 --- a/recipes/marisa/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -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 index 087e45138b499..6f5b0ae3b7c45 100644 --- a/recipes/marisa/all/conandata.yml +++ b/recipes/marisa/all/conandata.yml @@ -5,4 +5,3 @@ sources: 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 index 13b534d613bd9..05b8f1775310a 100644 --- a/recipes/marisa/all/conanfile.py +++ b/recipes/marisa/all/conanfile.py @@ -1,20 +1,22 @@ 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" +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 + +required_conan_version = ">=1.53.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") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/s-yata/marisa-trie" topics = ("algorithm", "dictionary", "marisa") - exports_sources = "patches/**", "CMakeLists.txt" - settings = "os", "compiler", "build_type", "arch" + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -26,16 +28,8 @@ class MarisaConan(ConanFile): "tools": 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): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -43,45 +37,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.libcxx") + self.settings.rm_safe("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) + def layout(self): + cmake_layout(self, src_folder="src") - self._cmake.definitions["BUILD_TOOLS"] = self.options.tools + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TOOLS"] = self.options.tools + tc.generate() + tc = CMakeDeps(self) + tc.generate() def build(self): apply_conandata_patches(self) - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="COPYING.md", dst="licenses", - src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="COPYING.md", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + 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.names["cmake_find_package"] = "marisa" - self.cpp_info.names["cmake_find_package_multi"] = "marisa" - self.cpp_info.names["pkgconfig"] = "marisa" + self.cpp_info.set_property("pkg_config_name", "marisa") self.cpp_info.libs = ["marisa"] - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["m"] + # TODO: to remove in conan v2 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/test_package/CMakeLists.txt b/recipes/marisa/all/test_package/CMakeLists.txt index 9bae1c0958b76..8f42c91d450ee 100644 --- a/recipes/marisa/all/test_package/CMakeLists.txt +++ b/recipes/marisa/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) 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) diff --git a/recipes/marisa/all/test_package/conanfile.py b/recipes/marisa/all/test_package/conanfile.py index 251bf8ae3e3dd..fae501d0afb9e 100644 --- a/recipes/marisa/all/test_package/conanfile.py +++ b/recipes/marisa/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 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" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain" + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/marisa/all/test_package/test_package.cpp b/recipes/marisa/all/test_package/test_package.cpp index ba90951dd5e1b..5180045c1a180 100644 --- a/recipes/marisa/all/test_package/test_package.cpp +++ b/recipes/marisa/all/test_package/test_package.cpp @@ -1,6 +1,6 @@ -#include #include "marisa.h" +#include int main() { int x = 100; diff --git a/recipes/marisa/all/test_v1_package/CMakeLists.txt b/recipes/marisa/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/marisa/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/marisa/all/test_v1_package/conanfile.py b/recipes/marisa/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..251bf8ae3e3dd --- /dev/null +++ b/recipes/marisa/all/test_v1_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/matchit/all/conanfile.py b/recipes/matchit/all/conanfile.py index 95876b752dd5b..55b20c25e3456 100644 --- a/recipes/matchit/all/conanfile.py +++ b/recipes/matchit/all/conanfile.py @@ -18,39 +18,45 @@ class MatchitConan(ConanFile): " library for C++17 with macro-free APIs.") topics = ("lightweight", "cpp17", "header-only", "pattern-matching") no_copy_source = True - settings = "arch", "build_type", "compiler", "os" + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" - _compiler_required_cpp17 = { - "Visual Studio": "16", - "gcc": "8", - "clang": "7", - "apple-clang": "12.0", - } + @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.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, "17") + check_min_cppstd(self, self._min_cppstd) - minimum_version = self._compiler_required_cpp17.get( - str(self.settings.compiler), False) - if minimum_version: - if 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)) + 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, - destination=self.source_folder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def build(self): pass - def layout(self): - basic_layout(self, src_folder="src") - def package(self): copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) @@ -58,13 +64,8 @@ def package(self): src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) - def package_id(self): - self.info.clear() - def package_info(self): - # TODO: Remove after Conan 2.0 - self.cpp_info.names["cmake_find_package"] = "matchit" - self.cpp_info.names["cmake_find_package_multi"] = "matchit" - - self.cpp_info.set_property("cmake_target_name", "matchit::matchit") self.cpp_info.set_property("cmake_file_name", "matchit") + self.cpp_info.set_property("cmake_target_name", "matchit::matchit") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/matchit/all/test_package/CMakeLists.txt b/recipes/matchit/all/test_package/CMakeLists.txt index fd89193f305ec..8898d12cfc675 100644 --- a/recipes/matchit/all/test_package/CMakeLists.txt +++ b/recipes/matchit/all/test_package/CMakeLists.txt @@ -1,8 +1,8 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.8) project(test_package LANGUAGES CXX) find_package(matchit REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE matchit::matchit) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/matchit/all/test_package/conanfile.py b/recipes/matchit/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/matchit/all/test_package/conanfile.py +++ b/recipes/matchit/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/matchit/all/test_v1_package/CMakeLists.txt b/recipes/matchit/all/test_v1_package/CMakeLists.txt index 0645f6d856074..0d20897301b68 100644 --- a/recipes/matchit/all/test_v1_package/CMakeLists.txt +++ b/recipes/matchit/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(matchit REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE matchit::matchit) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/matchit/all/test_v1_package/conanfile.py b/recipes/matchit/all/test_v1_package/conanfile.py index c492184eec19c..0f735b51a2642 100644 --- a/recipes/matchit/all/test_v1_package/conanfile.py +++ b/recipes/matchit/all/test_v1_package/conanfile.py @@ -1,9 +1,7 @@ -from conans import ConanFile, CMake -from conan.tools.build import cross_building +from conans import ConanFile, CMake, tools import os -# legacy validation with Conan 1.x class TestPackageV1Conan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "cmake", "cmake_find_package_multi" @@ -14,6 +12,6 @@ def build(self): cmake.build() def test(self): - if not cross_building(self): + if not tools.cross_building(self): bin_path = os.path.join("bin", "test_package") self.run(bin_path, run_environment=True) diff --git a/recipes/materialx/all/conandata.yml b/recipes/materialx/all/conandata.yml new file mode 100644 index 0000000000000..f0f8336613f73 --- /dev/null +++ b/recipes/materialx/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "1.39.1": + url: "https://github.com/AcademySoftwareFoundation/MaterialX/archive/refs/tags/v1.39.1.tar.gz" + sha256: "a392fd0aa372bbea7a6f27d20160829ec9380a801976ff467949a90e6555258d" + "1.38.10": + url: "https://github.com/AcademySoftwareFoundation/MaterialX/archive/refs/tags/v1.38.10.tar.gz" + sha256: "706f44100188bc283a135ad24b348e55b405ac9e70cb64b7457c381383cc2887" diff --git a/recipes/materialx/all/conanfile.py b/recipes/materialx/all/conanfile.py new file mode 100644 index 0000000000000..910d0145067ce --- /dev/null +++ b/recipes/materialx/all/conanfile.py @@ -0,0 +1,203 @@ +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, export_conandata_patches, get, rm, rmdir, replace_in_file +from conan.tools.apple import is_apple_os +from conan.tools.scm import Version +import os + +required_conan_version = ">=1.53.0" + +class MaterialXConan(ConanFile): + name = "materialx" + description = "MaterialX is an open standard for the exchange of rich material and look-development content across applications and renderers." + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/AcademySoftwareFoundation/MaterialX" + topics = ("vfx", "3d", "graphics", "aswf") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_openimageio": [True, False], + "build_gen_msl": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_openimageio": False, + "build_gen_msl": True + } + + short_paths = True + + @property + def _min_cppstd(self): + if Version(self.version) >= "1.39.0": + return 17 + else: + return 14 + + @property + def _compilers_minimum_version(self): + return { + "apple-clang": "10", + "clang": "7", + "gcc": "7", + "msvc": "191", + "Visual Studio": "15", + } + + 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_openimageio: + self.requires("openimageio/2.5.14.0") + if self.settings.os in ["Linux", "FreeBSD"]: + self.requires("xorg/system") + self.requires("opengl/system") + + def validate(self): + # validate the minimum cpp standard supported. For C++ projects only + 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 build_requirements(self): + self.tool_requires("cmake/[>=3.24 <4]") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["MATERIALX_BUILD_TESTS"] = False + tc.variables["MATERIALX_TEST_RENDER"] = False + tc.variables["MATERIALX_BUILD_SHARED_LIBS"] = self.options.shared + tc.variables["MATERIALX_BUILD_GEN_MSL"] = self.options.build_gen_msl and is_apple_os + # TODO: Remove when Conan 1 support is dropped + if not self.settings.compiler.cppstd: + tc.variables["MATERIALX_BUILD_USE_CCACHE"] = self._min_cppstd + tc.variables["MATERIALX_BUILD_USE_CCACHE"] = False + tc.generate() + + tc = CMakeDeps(self) + tc.generate() + + def _patch_sources(self): + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "set(CMAKE_CXX_STANDARD", + "# set(CMAKE_CXX_STANDARD") + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "set(CMAKE_POSITION_INDEPENDENT_CODE", + "# set(CMAKE_POSITION_INDEPENDENT_CODE") + + def build(self): + + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + + rmdir(self, os.path.join(self.package_folder, "resources")) + rmdir(self, os.path.join(self.package_folder, "libraries")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rm(self, "README.md", self.package_folder) + rm(self, "CHANGELOG.md", self.package_folder) + rm(self, "THIRD-PARTY.md", self.package_folder) + rm(self, "LICENSE", self.package_folder) + 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): + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") + self.cpp_info.system_libs.append("dl") + + self.cpp_info.components["MaterialXCore"].libs = ["MaterialXCore"] + + self.cpp_info.components["MaterialXFormat"].libs = ["MaterialXFormat"] + self.cpp_info.components["MaterialXFormat"].requires = ["MaterialXCore"] + + self.cpp_info.components["MaterialXGenGlsl"].libs = ["MaterialXGenGlsl"] + self.cpp_info.components["MaterialXGenGlsl"].requires = ["MaterialXCore", "MaterialXGenShader"] + + self.cpp_info.components["MaterialXGenMdl"].libs = ["MaterialXGenMdl"] + self.cpp_info.components["MaterialXGenMdl"].requires = ["MaterialXCore", "MaterialXGenShader"] + + self.cpp_info.components["MaterialXGenMsl"].libs = ["MaterialXGenMsl"] + self.cpp_info.components["MaterialXGenMsl"].requires = ["MaterialXCore", "MaterialXGenShader"] + + self.cpp_info.components["MaterialXGenOsl"].libs = ["MaterialXGenOsl"] + self.cpp_info.components["MaterialXGenOsl"].requires = ["MaterialXCore", "MaterialXGenShader"] + + self.cpp_info.components["MaterialXGenShader"].libs = ["MaterialXGenShader"] + self.cpp_info.components["MaterialXGenShader"].requires = ["MaterialXCore", "MaterialXFormat"] + + self.cpp_info.components["MaterialXRender"].libs = ["MaterialXRender"] + self.cpp_info.components["MaterialXRender"].requires = ["MaterialXGenShader"] + if self.options.with_openimageio: + self.cpp_info.components["MaterialXRender"].requires.append("openimageio::openimageio") + + self.cpp_info.components["MaterialXRenderGlsl"].libs = ["MaterialXRenderGlsl"] + self.cpp_info.components["MaterialXRenderGlsl"].requires = ["MaterialXRenderHw", "MaterialXGenGlsl"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["MaterialXRenderGlsl"].requires.append("opengl::opengl") + elif self.settings.os in ["Macos", "iOS"]: + self.cpp_info.frameworks.extend(["Foundation", "Cocoa", "OpenGL"]) + if self.settings.os == "Macos": + self.cpp_info.includedirs.extend(["include/compat/osx"]) + else: + self.cpp_info.includedirs.extend(["include/compat/ios"]) + elif self.settings.os == "Windows": + self.cpp_info.system_libs.append("opengl32") + + self.cpp_info.components["MaterialXRenderHw"].libs = ["MaterialXRenderHw"] + self.cpp_info.components["MaterialXRenderHw"].requires = ["MaterialXRender"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["MaterialXRenderHw"].requires.append("xorg::xorg") + elif self.settings.os in ["Macos", "iOS"]: + self.cpp_info.frameworks.extend(["Foundation", "Cocoa", "AppKit", "Metal"]) + if self.settings.os == "Macos": + self.cpp_info.includedirs.extend(["include/compat/osx"]) + else: + self.cpp_info.includedirs.extend(["include/compat/ios"]) + + self.cpp_info.components["MaterialXRenderOsl"].libs = ["MaterialXRenderOsl"] + self.cpp_info.components["MaterialXRenderOsl"].requires = ["MaterialXRender"] + + if self.options.build_gen_msl: + self.cpp_info.components["MaterialXGenMsl"].libs = ["MaterialXGenMsl"] + self.cpp_info.components["MaterialXGenMsl"].requires = ["MaterialXCore", "MaterialXGenShader"] + + if self.options.build_gen_msl and self.settings.os == "Macos": + self.cpp_info.components["MaterialXRenderMsl"].libs = ["MaterialXRenderMsl"] + self.cpp_info.components["MaterialXRenderMsl"].requires = ["MaterialXRenderHw", "MaterialXGenMsl"] + self.cpp_info.frameworks.extend(["CoreFoundation", "OpenGL", "AppKit", "Metal"]) + if self.settings.os == "Macos": + self.cpp_info.includedirs.extend(["include/compat/osx"]) + else: + self.cpp_info.includedirs.extend(["include/compat/ios"]) diff --git a/recipes/materialx/all/test_package/CMakeLists.txt b/recipes/materialx/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..54a09a6c2e591 --- /dev/null +++ b/recipes/materialx/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.15) + +project(test_package LANGUAGES CXX) # if the project uses c++ + +find_package(materialx REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE materialx::MaterialXCore materialx::MaterialXFormat) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/materialx/all/test_package/conanfile.py b/recipes/materialx/all/test_package/conanfile.py new file mode 100644 index 0000000000000..311e7c4a81341 --- /dev/null +++ b/recipes/materialx/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 TestMaterialXConan(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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/materialx/all/test_package/test_package.cpp b/recipes/materialx/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..f7a9e7cefee90 --- /dev/null +++ b/recipes/materialx/all/test_package/test_package.cpp @@ -0,0 +1,42 @@ +#include + +#include +#include +#include +#include +#include + +namespace mx = MaterialX; + +int main(void) { + + mx::DocumentPtr doc = mx::createDocument(); + + // Create a base shader nodedef. + mx::NodeDefPtr simpleSrf = doc->addNodeDef("ND_simpleSrf", mx::SURFACE_SHADER_TYPE_STRING, "simpleSrf"); + simpleSrf->setInputValue("diffColor", mx::Color3(1.0f)); + simpleSrf->setInputValue("specColor", mx::Color3(0.0f)); + simpleSrf->setInputValue("roughness", 0.25f); + simpleSrf->setTokenValue("texId", "01"); + + // Create an inherited shader nodedef. + mx::NodeDefPtr anisoSrf = doc->addNodeDef("ND_anisoSrf", mx::SURFACE_SHADER_TYPE_STRING, "anisoSrf"); + anisoSrf->setInheritsFrom(simpleSrf); + anisoSrf->setInputValue("anisotropy", 0.0f); + + // Instantiate shader and material nodes. + mx::NodePtr shaderNode = doc->addNode(anisoSrf->getNodeString(), "", anisoSrf->getType()); + mx::NodePtr materialNode = doc->addMaterialNode("", shaderNode); + + // Set nodedef and shader node qualifiers. + shaderNode->setVersionString("2.0"); + anisoSrf->setVersionString("2"); + shaderNode->setVersionString("2"); + shaderNode->setType(mx::VOLUME_SHADER_TYPE_STRING); + shaderNode->setType(mx::SURFACE_SHADER_TYPE_STRING); + + // Bind a shader input to a value. + mx::InputPtr instanceSpecColor = shaderNode->setInputValue("specColor", mx::Color3(1.0f)); + + return EXIT_SUCCESS; +} diff --git a/recipes/materialx/config.yml b/recipes/materialx/config.yml new file mode 100644 index 0000000000000..a0bedf2527f55 --- /dev/null +++ b/recipes/materialx/config.yml @@ -0,0 +1,5 @@ +versions: + "1.39.1": + folder: all + "1.38.10": + folder: all diff --git a/recipes/mathfu/all/conanfile.py b/recipes/mathfu/all/conanfile.py index 1b35d3c154c77..ec12916dc298b 100644 --- a/recipes/mathfu/all/conanfile.py +++ b/recipes/mathfu/all/conanfile.py @@ -13,6 +13,7 @@ class MathfuConan(ConanFile): license = "Apache-2.0" homepage = "https://github.com/google/mathfu" url = "https://github.com/conan-io/conan-center-index" + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -20,14 +21,13 @@ def layout(self): basic_layout(self, src_folder="src") def requirements(self): - self.requires("vectorial/cci.20190628", transitive_headers=True, transitive_libs=True) + self.requires("vectorial/cci.20190628") 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 diff --git a/recipes/mathter/1.x.x/conandata.yml b/recipes/mathter/1.x.x/conandata.yml new file mode 100644 index 0000000000000..f12b02f2c9224 --- /dev/null +++ b/recipes/mathter/1.x.x/conandata.yml @@ -0,0 +1,13 @@ +sources: + "1.1.1": + url: "https://github.com/petiaccja/Mathter/archive/v1.1.1.tar.gz" + sha256: "510e6aa198cd7b207a44d319e4471021f207cba8c4d2d7e40086f1f042fe13ab" + "1.1.0": + url: "https://github.com/petiaccja/Mathter/archive/v1.1.0.tar.gz" + sha256: "a9a82126ecd80112854098a5646d38f72f0af03e9655b28ab8fa38b4c03b0870" + "1.0.1": + url: "https://github.com/petiaccja/Mathter/archive/v1.0.1.tar.gz" + sha256: "ab90736abfa8774103b53fe2b8962981c5f117dc582b01698c18d66cd2398b8c" + "1.0.0": + url: "https://github.com/petiaccja/Mathter/archive/v1.0.0.tar.gz" + sha256: "c75cca8d8aec627935250908f2c0f9f1839561e7596a4199bcf80e12b0e6c53b" diff --git a/recipes/mathter/1.x.x/conanfile.py b/recipes/mathter/1.x.x/conanfile.py new file mode 100644 index 0000000000000..82cdb44fbd38a --- /dev/null +++ b/recipes/mathter/1.x.x/conanfile.py @@ -0,0 +1,84 @@ +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.52.0" + + +class MathterConan(ConanFile): + name = "mathter" + description = "Powerful 3D math and small-matrix linear algebra library for games and science." + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/petiaccja/Mathter" + topics = ("game-dev", "linear-algebra", "vector-math", "matrix-library", "header-only") + + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + options = { + "with_xsimd": [True, False] # XSimd is optionally used for hand-rolled vectorization. + } + default_options = { + "with_xsimd": True + } + no_copy_source = True + + @property + def _min_cppstd(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "apple-clang": 10, + "clang": 6, + "gcc": 7, + "Visual Studio": 16, + } + + def config_options(self): + if Version(self.version) < "1.1": + del self.options.with_xsimd + + 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._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} 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 requirements(self): + if self.options.get_safe("with_xsimd"): + self.requires("xsimd/11.1.0") + + def package(self): + if self.version == "1.0.0": + copy(self, "LICENCE", self.source_folder, os.path.join(self.package_folder, "licenses")) + include_dir = os.path.join(self.source_folder, "Mathter") + else: + copy(self, "LICENCE.md", self.source_folder, os.path.join(self.package_folder, "licenses")) + include_dir = os.path.join(self.source_folder, "include", "Mathter") + copy(self, "*.hpp", include_dir, os.path.join(self.package_folder, "include", "Mathter")) + copy(self, "*.natvis", include_dir, os.path.join(self.package_folder, "include", "Mathter")) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + if self.options.get_safe("with_xsimd"): + self.cpp_info.defines = ["MATHTER_USE_XSIMD=1"] diff --git a/recipes/mathter/1.x.x/test_package/CMakeLists.txt b/recipes/mathter/1.x.x/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..e6eb2612386c1 --- /dev/null +++ b/recipes/mathter/1.x.x/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(TestPackage CXX) + +find_package(mathter REQUIRED CONFIG) + +add_executable(test_package test_package.cpp) +target_link_libraries(test_package PRIVATE mathter::mathter) +target_compile_features(test_package PRIVATE cxx_std_17) diff --git a/recipes/mathter/1.x.x/test_package/conanfile.py b/recipes/mathter/1.x.x/test_package/conanfile.py new file mode 100644 index 0000000000000..fae501d0afb9e --- /dev/null +++ b/recipes/mathter/1.x.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_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain" + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/mathter/1.x.x/test_package/test_package.cpp b/recipes/mathter/1.x.x/test_package/test_package.cpp new file mode 100644 index 0000000000000..c46788d9d6a1c --- /dev/null +++ b/recipes/mathter/1.x.x/test_package/test_package.cpp @@ -0,0 +1,16 @@ +#include +#include + +int main() { + using Vec3 = mathter::Vector; + Vec3 v1 = {1, 0, 3}; + Vec3 v2 = {2, 5, 3}; + auto r = v1 + v2; + std::cout << "Mathter installation works." << std::endl; +#ifdef MATHTER_USE_XSIMD + std::cout << "XSimd enabled." << std::endl; +#else + std::cout << "XSimd disabled." << std::endl; +#endif + return 0; +} diff --git a/recipes/mathter/1.x.x/test_v1_package/CMakeLists.txt b/recipes/mathter/1.x.x/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/mathter/1.x.x/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/mathter/1.x.x/test_v1_package/conanfile.py b/recipes/mathter/1.x.x/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..7177bb22dc3a9 --- /dev/null +++ b/recipes/mathter/1.x.x/test_v1_package/conanfile.py @@ -0,0 +1,16 @@ +from conans import ConanFile, CMake, tools +import os + +class MathterTestConan(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/mathter/all/conandata.yml b/recipes/mathter/all/conandata.yml index dc5d0897e2e04..72315af7bccd3 100644 --- a/recipes/mathter/all/conandata.yml +++ b/recipes/mathter/all/conandata.yml @@ -1,4 +1,4 @@ sources: - "1.0.0": - url: "https://github.com/petiaccja/Mathter/archive/v1.0.0.tar.gz" - sha256: "c75cca8d8aec627935250908f2c0f9f1839561e7596a4199bcf80e12b0e6c53b" + "2.0.0": + url: "https://github.com/petiaccja/Mathter/archive/v2.0.0.tar.gz" + sha256: "cec8472d3a56613d4815d1a14e5bf42976884177cc5283c5ad5aba0710cc4bab" \ No newline at end of file diff --git a/recipes/mathter/all/conanfile.py b/recipes/mathter/all/conanfile.py index be28b561bbcae..ec3643caaab0d 100644 --- a/recipes/mathter/all/conanfile.py +++ b/recipes/mathter/all/conanfile.py @@ -1,49 +1,97 @@ -from conans import ConanFile, 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.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import copy, get, rmdir +from conan.tools.scm import Version + +required_conan_version = ">=1.52.0" + + class MathterConan(ConanFile): name = "mathter" + description = "Powerful 3D math and small-matrix linear algebra library for games and science." license = "MIT" + url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/petiaccja/Mathter" - url = "https://github.com/conan-io/conan-center-index/" - description = "Powerful 3D math and small-matrix linear algebra library for games and science." - topics = ("game-dev", "linear-algebra", "vector-math", "matrix-library") + topics = ("game-dev", "linear-algebra", "vector-math", "matrix-library", "header-only") + + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + options = { + "with_xsimd": [True, False] # XSimd is optionally used for hand-rolled vectorization. + } + default_options = { + "with_xsimd": True + } no_copy_source = True - settings = "compiler" @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 17 @property def _compilers_minimum_version(self): return { "apple-clang": 10, "clang": 6, - "gcc": 7, + "gcc": 9, "Visual Studio": 16, } - def configure(self): + def layout(self): + cmake_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, "17") + 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("mathter requires C++17, which your compiler does not support.") - else: - self.output.warn("mathter 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.name} requires C++{self._min_cppstd}, " + "which your compiler does not support.") + + def requirements(self): + if self.options.get_safe("with_xsimd"): + self.requires("xsimd/13.0.0") + + def build_requirements(self): + self.tool_requires("cmake/[>=3.25 <4]") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename("Mathter-" + self.version, self._source_subfolder) - + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["MATHTER_BUILD_TESTS"] = "OFF" + tc.variables["MATHTER_BUILD_BENCHMARKS"] = "OFF" + tc.variables["MATHTER_BUILD_EXAMPLES"] = "OFF" + tc.variables["MATHTER_ENABLE_SIMD"] = "ON" if self.options.get_safe("with_xsimd") else "OFF" + tc.generate() + cmake_deps = CMakeDeps(self) + cmake_deps.generate() + venv = VirtualBuildEnv(self) + venv.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + def package(self): - self.copy("*.hpp", dst=os.path.join("include", "Mathter"), src=os.path.join(self._source_subfolder, "Mathter")) - self.copy("*.natvis", dst=os.path.join("include", "Mathter"), src=os.path.join(self._source_subfolder, "Mathter")) - self.copy("LICENCE", dst="licenses", src=self._source_subfolder) + cmake = CMake(self) + cmake.install() + copy(self, "LICENCE.md", self.source_folder, os.path.join(self.package_folder, "licenses")) + rmdir(self, os.path.join(self.package_folder, "lib")) - def package_id(self): - self.info.header_only() + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + if self.options.get_safe("with_xsimd"): + self.cpp_info.defines = ["MATHTER_ENABLE_SIMD=1"] diff --git a/recipes/mathter/all/test_package/CMakeLists.txt b/recipes/mathter/all/test_package/CMakeLists.txt index 27af59f1d203b..e6eb2612386c1 100644 --- a/recipes/mathter/all/test_package/CMakeLists.txt +++ b/recipes/mathter/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.15) project(TestPackage CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(mathter REQUIRED CONFIG) add_executable(test_package test_package.cpp) -target_link_libraries(test_package ${CONAN_LIBS}) -target_compile_features(test_package PUBLIC cxx_std_17) +target_link_libraries(test_package PRIVATE mathter::mathter) +target_compile_features(test_package PRIVATE cxx_std_17) diff --git a/recipes/mathter/all/test_package/conanfile.py b/recipes/mathter/all/test_package/conanfile.py index 30d42d996e79e..fae501d0afb9e 100644 --- a/recipes/mathter/all/test_package/conanfile.py +++ b/recipes/mathter/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 MathterTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain" + 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/mathter/all/test_package/test_package.cpp b/recipes/mathter/all/test_package/test_package.cpp index 9452f0f208fc1..d451c56acac71 100644 --- a/recipes/mathter/all/test_package/test_package.cpp +++ b/recipes/mathter/all/test_package/test_package.cpp @@ -1,11 +1,32 @@ +#include +#include +#include +#include +#include +#include #include + #include +using namespace mathter; + + int main() { - using Vec3 = mathter::Vector; - Vec3 v1 = {1, 0, 3}; - Vec3 v2 = {2, 5, 3}; - auto r = v1 + v2; - std::cout << "Mathter installation works." << std::endl; - return 0; + const auto u = Vector(1, 2, 3); + const auto v = Vector(4, 6, 8); + const auto r = u + v; + if (r[0] != 5) { + std::cout << "Mathter installation failing." << std::endl; + return 1; + } + else { + std::cout << "Mathter installation works." << std::endl; + std::cout << "Options:" << std::endl; +#ifdef MATHTER_ENABLE_SIMD + std::cout << " with_xsimd = True" << std::endl; +#else + std::cout << " with_xsimd = False" << std::endl; +#endif + return 0; + } } diff --git a/recipes/mathter/config.yml b/recipes/mathter/config.yml index 40341aa3db6cd..64c627fda4753 100644 --- a/recipes/mathter/config.yml +++ b/recipes/mathter/config.yml @@ -1,3 +1,11 @@ versions: - "1.0.0": + "2.0.0": folder: all + "1.1.1": + folder: 1.x.x + "1.1.0": + folder: 1.x.x + "1.0.1": + folder: 1.x.x + "1.0.0": + folder: 1.x.x diff --git a/recipes/matio/all/CMakeLists.txt b/recipes/matio/all/CMakeLists.txt deleted file mode 100644 index bd3083b512cb9..0000000000000 --- a/recipes/matio/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/matio/all/conandata.yml b/recipes/matio/all/conandata.yml index 8a659653f91f9..2c7850edc678c 100644 --- a/recipes/matio/all/conandata.yml +++ b/recipes/matio/all/conandata.yml @@ -1,42 +1,26 @@ sources: - "1.5.18": - url: "https://downloads.sourceforge.net/project/matio/matio/1.5.18/matio-1.5.18.tar.gz" - sha256: "5fad71a63a854d821cc6f4e8c84da837149dd5fb57e1e2baeffd85fa0f28fe25" - "1.5.19": - url: "https://downloads.sourceforge.net/project/matio/matio/1.5.19/matio-1.5.19.tar.gz" - sha256: "a4fa4d248b0414fc72f3d6155f710c470d5628d3c31af834f8d5ccf06b60286f" - "1.5.21": - url: "https://downloads.sourceforge.net/project/matio/matio/1.5.21/matio-1.5.21.tar.gz" - sha256: "21809177e55839e7c94dada744ee55c1dea7d757ddaab89605776d50122fb065" "1.5.23": url: "https://downloads.sourceforge.net/project/matio/matio/1.5.23/matio-1.5.23.tar.gz" sha256: "9f91eae661df46ea53c311a1b2dcff72051095b023c612d7cbfc09406c9f4d6e" + "1.5.24": + url: "https://downloads.sourceforge.net/project/matio/matio/1.5.24/matio-1.5.24.tar.gz" + sha256: "5106ebed5b40d02a2bb968b57bef8876701c566e039e6ebe134bab779c436f7c" + "1.5.26": + url: "https://downloads.sourceforge.net/project/matio/matio/1.5.26/matio-1.5.26.tar.gz" + sha256: "8b47c29f58e468dba7a5555371c6a72ad4c6aa8b15f459b2b0b65a303c063933" + "1.5.27": + url: "https://downloads.sourceforge.net/project/matio/matio/1.5.27/matio-1.5.27.tar.gz" + sha256: "0a6aa00b18c4512b63a8d27906b079c8c6ed41d4b2844f7a4ae598e18d22d3b3" patches: - "1.5.18": + "1.5.23": - patch_file: "patches/require-cmake-3.10.patch" - base_path: "source_subfolder" - - patch_file: "patches/disable-hdf5-target.patch" - base_path: "source_subfolder" - - patch_file: "patches/patch-apple-no-undefined.patch" - base_path: "source_subfolder" - patch_file: "patches/cmake-install-bundle.patch" - base_path: "source_subfolder" - "1.5.19": + "1.5.24": - patch_file: "patches/require-cmake-3.10.patch" - base_path: "source_subfolder" - - patch_file: "patches/patch-apple-no-undefined.patch" - base_path: "source_subfolder" - patch_file: "patches/cmake-install-bundle.patch" - base_path: "source_subfolder" - "1.5.21": + "1.5.26": - patch_file: "patches/require-cmake-3.10.patch" - base_path: "source_subfolder" - - patch_file: "patches/patch-apple-no-undefined.patch" - base_path: "source_subfolder" - patch_file: "patches/cmake-install-bundle.patch" - base_path: "source_subfolder" - "1.5.23": + "1.5.27": - patch_file: "patches/require-cmake-3.10.patch" - base_path: "source_subfolder" - - patch_file: "patches/cmake-install-bundle.patch" - base_path: "source_subfolder" + - patch_file: "patches/cmake-install-bundle-1.5.27.patch" diff --git a/recipes/matio/all/conanfile.py b/recipes/matio/all/conanfile.py index 213dcdf0eba5b..d5369f6dca220 100644 --- a/recipes/matio/all/conanfile.py +++ b/recipes/matio/all/conanfile.py @@ -1,42 +1,43 @@ -from conans import ConanFile, CMake, 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.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get +from conan.tools.microsoft import is_msvc + +required_conan_version = ">=1.53.0" class MatioConan(ConanFile): name = "matio" + description = "Matio is a C library for reading and writing binary MATLAB MAT files." license = "BSD-2-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://sourceforge.net/projects/matio/" - description = "Matio is a C library for reading and writing binary MATLAB MAT files." - topics = ("conan", "matlab", "mat-file", "file-format", "hdf5") - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" - exports_sources = "CMakeLists.txt", "patches/*" + topics = ("matlab", "mat-file", "file-format", "hdf5") + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], - "extended_sparse": [True, False], "fPIC": [True, False], + "extended_sparse": [True, False], "mat73": [True, False], "with_hdf5": [True, False], "with_zlib": [True, False], } default_options = { "shared": False, - "extended_sparse": True, "fPIC": True, + "extended_sparse": True, "mat73": True, "with_hdf5": True, "with_zlib": 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": @@ -44,61 +45,65 @@ 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.with_hdf5: - self.requires("hdf5/1.12.1") + self.requires("hdf5/1.14.3") if self.options.with_zlib: - self.requires("zlib/1.2.12") + self.requires("zlib/[>=1.2.11 <2]") def validate(self): if not self.options.with_hdf5 and self.options.mat73: raise ConanInvalidConfiguration("Support of version 7.3 MAT files requires HDF5") 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) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - - self._cmake = CMake(self) - self._cmake.definitions["MATIO_EXTENDED_SPARSE"] = self.options.extended_sparse - self._cmake.definitions["MATIO_PIC"] = self.options.get_safe("fPIC", True) - self._cmake.definitions["MATIO_SHARED"] = self.options.shared - self._cmake.definitions["MATIO_MAT73"] = self.options.mat73 - self._cmake.definitions["MATIO_WITH_HDF5"] = self.options.with_hdf5 - self._cmake.definitions["MATIO_WITH_ZLIB"] = self.options.with_zlib - self._cmake.definitions["HDF5_USE_STATIC_LIBRARIES"] = self.options.with_hdf5 and not self.options["hdf5"].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["MATIO_ENABLE_CPPCHECK"] = False + tc.variables["MATIO_EXTENDED_SPARSE"] = self.options.extended_sparse + tc.variables["MATIO_PIC"] = self.options.get_safe("fPIC", True) + tc.variables["MATIO_SHARED"] = self.options.shared + tc.variables["MATIO_MAT73"] = self.options.mat73 + tc.variables["MATIO_WITH_HDF5"] = self.options.with_hdf5 + tc.variables["MATIO_WITH_ZLIB"] = self.options.with_zlib + tc.variables["HDF5_USE_STATIC_LIBRARIES"] = ( + self.options.with_hdf5 and not self.dependencies["hdf5"].options.shared + ) + 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 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): - if self.settings.compiler == "Visual Studio": + if is_msvc(self): self.cpp_info.libs = ["libmatio"] else: self.cpp_info.libs = ["matio"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["m"] + # TODO: 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/matio/all/patches/cmake-install-bundle-1.5.27.patch b/recipes/matio/all/patches/cmake-install-bundle-1.5.27.patch new file mode 100644 index 0000000000000..9d320dedb44ec --- /dev/null +++ b/recipes/matio/all/patches/cmake-install-bundle-1.5.27.patch @@ -0,0 +1,14 @@ +Fix CMake configuration errors while cross-building to iOS/tvOS/watchOS + +--- a/cmake/tools.cmake ++++ b/cmake/tools.cmake +@@ -8,8 +8,5 @@ if(NOT HAVE_GETOPT) + endif() + + install(TARGETS matdump +- PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ DESTINATION ${CMAKE_INSTALL_BINDIR} + ) diff --git a/recipes/matio/all/patches/disable-hdf5-target.patch b/recipes/matio/all/patches/disable-hdf5-target.patch deleted file mode 100644 index 8f9c45cb87de8..0000000000000 --- a/recipes/matio/all/patches/disable-hdf5-target.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/cmake/thirdParties.cmake -+++ b/cmake/thirdParties.cmake -@@ -29,8 +29,8 @@ if(MATIO_WITH_HDF5) - endif() - endif() - --if(HDF5_FOUND) - set(HAVE_HDF5 1) -+if(0) - add_library(HDF5::HDF5 INTERFACE IMPORTED) - if(MATIO_USE_CONAN AND TARGET CONAN_PKG::hdf5) - # target from Conan diff --git a/recipes/matio/all/patches/patch-apple-no-undefined.patch b/recipes/matio/all/patches/patch-apple-no-undefined.patch deleted file mode 100644 index 6dbb97ff53471..0000000000000 --- a/recipes/matio/all/patches/patch-apple-no-undefined.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- a/cmake/src.cmake -+++ b/cmake/src.cmake -@@ -37,8 +37,12 @@ if(STDINT_MSVC) - endif() - - if(NOT MSVC) -- set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined") -- set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--retain-symbols-file,${PROJECT_SOURCE_DIR}/src/matio.sym") -+ if(APPLE) -+ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-undefined,error") -+ else() -+ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined") -+ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--retain-symbols-file,${PROJECT_SOURCE_DIR}/src/matio.sym") -+ endif() - endif() - - if(MATIO_SHARED) diff --git a/recipes/matio/all/test_package/CMakeLists.txt b/recipes/matio/all/test_package/CMakeLists.txt index f8b971e2db377..e5b668ec22178 100644 --- a/recipes/matio/all/test_package/CMakeLists.txt +++ b/recipes/matio/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(matio REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE matio::matio) diff --git a/recipes/matio/all/test_package/conanfile.py b/recipes/matio/all/test_package/conanfile.py index f96969845ae24..fae501d0afb9e 100644 --- a/recipes/matio/all/test_package/conanfile.py +++ b/recipes/matio/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools -import os.path +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os -class MatioTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain" + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/matio/all/test_v1_package/CMakeLists.txt b/recipes/matio/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/matio/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/matio/all/test_v1_package/conanfile.py b/recipes/matio/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..3053c8502b32d --- /dev/null +++ b/recipes/matio/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os.path + + +class MatioTestConan(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/matio/config.yml b/recipes/matio/config.yml index 5ec8ba010e8ec..71576cf31a76e 100644 --- a/recipes/matio/config.yml +++ b/recipes/matio/config.yml @@ -1,9 +1,9 @@ versions: - "1.5.18": + "1.5.27": folder: all - "1.5.19": + "1.5.26": folder: all - "1.5.21": + "1.5.24": folder: all "1.5.23": folder: all diff --git a/recipes/mattiasgustavsson-libs/all/conanfile.py b/recipes/mattiasgustavsson-libs/all/conanfile.py index bfba3abb27bab..064ab9c964c61 100644 --- a/recipes/mattiasgustavsson-libs/all/conanfile.py +++ b/recipes/mattiasgustavsson-libs/all/conanfile.py @@ -1,37 +1,53 @@ -from conans import ConanFile, tools -import os.path -import glob +import os + +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get, load, save +from conan.tools.layout import basic_layout + +required_conan_version = ">=1.52.0" + class MattiasgustavssonLibsConan(ConanFile): name = "mattiasgustavsson-libs" description = "Single-file public domain libraries for C/C++" - homepage = "https://github.com/mattiasgustavsson/libs" - url = "https://github.com/conan-io/conan-center-index" license = ("Unlicense", "MIT") - topics = ("utilities", "mattiasgustavsson", "libs") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/mattiasgustavsson/libs" + topics = ("utilities", "mattiasgustavsson", "libs", "header-only") + + package_type = "header-library" + 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 _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.cppstd: + check_min_cppstd(self, self._min_cppstd) def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = glob.glob('libs-*/')[0] - os.rename(extracted_dir, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def _extract_licenses(self): - header = tools.load(os.path.join(self._source_subfolder, "thread.h")) - mit_content = header[header.find("ALTERNATIVE A - "):header.find("ALTERNATIVE B -")] - tools.save("LICENSE_MIT", mit_content) - unlicense_content = header[header.find("ALTERNATIVE B - "):header.rfind("*/", 1)] - tools.save("LICENSE_UNLICENSE", unlicense_content) + header = load(self, os.path.join(self.source_folder, "thread.h")) + mit_content = header[header.find("ALTERNATIVE A - ") : header.find("ALTERNATIVE B -")] + save(self, os.path.join(self.package_folder, "licenses", "LICENSE_MIT"), mit_content) + unlicense_content = header[header.find("ALTERNATIVE B - ") : header.rfind("*/", 1)] + save(self, os.path.join(self.package_folder, "licenses", "LICENSE_UNLICENSE"), unlicense_content) def package(self): - self.copy(pattern="*.h", dst="include", src=self._source_subfolder) self._extract_licenses() - self.copy("LICENSE_MIT", dst="licenses") - self.copy("LICENSE_UNLICENSE", dst="licenses") + copy(self, pattern="*.h", dst=os.path.join(self.package_folder, "include"), src=self.source_folder) - def package_id(self): - self.info.header_only() + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/mattiasgustavsson-libs/all/test_package/CMakeLists.txt b/recipes/mattiasgustavsson-libs/all/test_package/CMakeLists.txt index 7557711b6dc83..fe3e7c23a7d9b 100644 --- a/recipes/mattiasgustavsson-libs/all/test_package/CMakeLists.txt +++ b/recipes/mattiasgustavsson-libs/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(mattiasgustavsson-libs REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE mattiasgustavsson-libs::mattiasgustavsson-libs) diff --git a/recipes/mattiasgustavsson-libs/all/test_package/conanfile.py b/recipes/mattiasgustavsson-libs/all/test_package/conanfile.py index bd7165a553cf4..fae501d0afb9e 100644 --- a/recipes/mattiasgustavsson-libs/all/test_package/conanfile.py +++ b/recipes/mattiasgustavsson-libs/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" + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/maven/all/conandata.yml b/recipes/maven/all/conandata.yml new file mode 100644 index 0000000000000..f03488696f01d --- /dev/null +++ b/recipes/maven/all/conandata.yml @@ -0,0 +1,14 @@ +sources: + "3.9.6": + url: + - "https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.tar.gz" + - "https://archive.apache.org/dist/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.tar.gz" + sha256: "6eedd2cae3626d6ad3a5c9ee324bd265853d64297f07f033430755bd0e0c3a4b" + "3.9.4": + url: + - "https://dlcdn.apache.org/maven/maven-3/3.9.4/binaries/apache-maven-3.9.4-bin.tar.gz" + - "https://archive.apache.org/dist/maven/maven-3/3.9.4/binaries/apache-maven-3.9.4-bin.tar.gz" + sha256: "ff66b70c830a38d331d44f6c25a37b582471def9a161c93902bac7bea3098319" + "3.9.2": + url: "https://archive.apache.org/dist/maven/maven-3/3.9.2/binaries/apache-maven-3.9.2-bin.tar.gz" + sha256: "809ef3220c6d179195c06c324cb9a6d34d8ecba566c5cfd8eb83167bc034117d" diff --git a/recipes/maven/all/conanfile.py b/recipes/maven/all/conanfile.py new file mode 100644 index 0000000000000..4a59f21e6ca9c --- /dev/null +++ b/recipes/maven/all/conanfile.py @@ -0,0 +1,40 @@ +from conan import ConanFile +from conan.tools.files import copy, get +import os + +required_conan_version = ">=1.47.0" + +class MavenConan(ConanFile): + name = "maven" + description = "Apache Maven is a software project management and comprehension tool." + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://maven.apache.org/" + topics = ("build", "project management") + package_type = "application" + settings = "os", "arch", "compiler", "build_type" + + def layout(self): + pass + + def requirements(self): + self.requires("zulu-openjdk/21.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): + 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) + for target in ("bin", "boot", "conf", "lib"): + copy(self, pattern="*", dst=os.path.join(self.package_folder, target), src=os.path.join(self.source_folder, target)) + + def package_info(self): + self.cpp_info.frameworkdirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] + self.cpp_info.includedirs = [] diff --git a/recipes/maven/all/test_package/conanfile.py b/recipes/maven/all/test_package/conanfile.py new file mode 100644 index 0000000000000..8a44299cfabc6 --- /dev/null +++ b/recipes/maven/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 = "VirtualBuildEnv" + test_type = "explicit" + + def build_requirements(self): + self.tool_requires(self.tested_reference_str) + + def test(self): + if can_run(self): + self.run("mvn --version") diff --git a/recipes/maven/config.yml b/recipes/maven/config.yml new file mode 100644 index 0000000000000..8e2950a3cb156 --- /dev/null +++ b/recipes/maven/config.yml @@ -0,0 +1,7 @@ +versions: + "3.9.6": + folder: all + "3.9.4": + folder: all + "3.9.2": + folder: all diff --git a/recipes/mawk/all/conandata.yml b/recipes/mawk/all/conandata.yml new file mode 100644 index 0000000000000..fb6b329064d57 --- /dev/null +++ b/recipes/mawk/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.3.4-20230404": + url: "https://invisible-island.net/archives/mawk/mawk-1.3.4-20230404.tgz" + sha256: "5a8260b1adda00bad8e40ba89fa20860c5b6e1393089dd1c7a6126aa023e9f63" diff --git a/recipes/mawk/all/conanfile.py b/recipes/mawk/all/conanfile.py new file mode 100644 index 0000000000000..dee1c14a1a666 --- /dev/null +++ b/recipes/mawk/all/conanfile.py @@ -0,0 +1,93 @@ +from conan import ConanFile +from conan.tools.build import cross_building +from conan.tools.env import Environment, VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import copy, get, rmdir, replace_in_file +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc +import os + + +required_conan_version = ">=1.54.0" + + +class PackageConan(ConanFile): + name = "mawk" + description = "mawk is an interpreter for the AWK Programming Language." + license = "GPL-2.0-or-later" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://invisible-island.net/mawk/mawk.html" + topics = ("awk", "app", "interpreter", "programming-language") + package_type = "application" + settings = "os", "arch", "compiler", "build_type" + + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) + + 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 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): + # INFO: The certificate of the website is expired/invalid + get(self, **self.conan_data["sources"][self.version], strip_root=True, verify=False) + + 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() + + if is_msvc(self): + env = Environment() + env.define("CC", "cl -nologo") + env.define("CXX", "cl -nologo") + env.define("LD", "link -nologo") + env.define("AR", "lib -nologo") + env.define("NM", "dumpbin -symbols") + env.define("OBJDUMP", ":") + env.define("RANLIB", ":") + env.define("STRIP", ":") + # INFO: It's not able to find lib math on Windows without passing its path. + env.define("MATHLIB", os.path.join(self.dependencies.build["msys2"].package_folder, "usr", "lib", "libm.a")) + env.vars(self).save_script("conanbuild_msvc") + + def _patch_sources(self): + if is_msvc(self): + # INFO: MAWK_RAND_MAX is not defined when building on Windows. Use system RAND_MAX instead. + replace_in_file(self, os.path.join(self.source_folder, 'bi_funct.c'), 'MAWK_RAND_MAX', 'RAND_MAX') + + def build(self): + self._patch_sources() + autotools = Autotools(self) + autotools.configure() + autotools.make() + + def package(self): + copy(self, pattern="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.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/mawk/all/test_package/conanfile.py b/recipes/mawk/all/test_package/conanfile.py new file mode 100644 index 0000000000000..4029c07de3be7 --- /dev/null +++ b/recipes/mawk/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 = "VirtualBuildEnv" + test_type = "explicit" + + def build_requirements(self): + self.tool_requires(self.tested_reference_str) + + def test(self): + if can_run(self): + self.run("mawk --version") diff --git a/recipes/mawk/config.yml b/recipes/mawk/config.yml new file mode 100644 index 0000000000000..5f91386891e08 --- /dev/null +++ b/recipes/mawk/config.yml @@ -0,0 +1,3 @@ +versions: + "1.3.4-20230404": + folder: all diff --git a/recipes/mbedtls/all/CMakeLists.txt b/recipes/mbedtls/all/CMakeLists.txt deleted file mode 100644 index 3d32ee21cb1d7..0000000000000 --- a/recipes/mbedtls/all/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -if(MSVC) - if(MSVC_VERSION LESS 1900) - add_definitions(-DMBEDTLS_PLATFORM_SNPRINTF_MACRO=MBEDTLS_PLATFORM_STD_SNPRINTF) - else() - add_definitions(-DMBEDTLS_PLATFORM_SNPRINTF_MACRO=snprintf) - endif() - if(BUILD_SHARED_LIBS) - add_definitions(-DX509_BUILD_SHARED) - set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) - endif() -endif() - -add_subdirectory(src) diff --git a/recipes/mbedtls/all/conandata.yml b/recipes/mbedtls/all/conandata.yml index 2e2a89aefe311..fadcef127351e 100644 --- a/recipes/mbedtls/all/conandata.yml +++ b/recipes/mbedtls/all/conandata.yml @@ -1,19 +1,28 @@ sources: + "3.6.2": + url: "https://github.com/Mbed-TLS/mbedtls/releases/download/mbedtls-3.6.2/mbedtls-3.6.2.tar.bz2" + sha256: "8b54fb9bcf4d5a7078028e0520acddefb7900b3e66fec7f7175bb5b7d85ccdca" + "3.6.1": + url: "https://github.com/Mbed-TLS/mbedtls/releases/download/mbedtls-3.6.1/mbedtls-3.6.1.tar.bz2" + sha256: "fc8bef0991b43629b7e5319de6f34f13359011105e08e3e16eed3a9fe6ffd3a3" + "3.6.0": + url: "https://github.com/Mbed-TLS/mbedtls/releases/download/v3.6.0/mbedtls-3.6.0.tar.bz2" + sha256: "3ecf94fcfdaacafb757786a01b7538a61750ebd85c4b024f56ff8ba1490fcd38" + "3.5.2": + url: "https://github.com/Mbed-TLS/mbedtls/archive/mbedtls-3.5.2.tar.gz" + sha256: "eedecc468b3f8d052ef05a9d42bf63f04c8a1c50d1c5a94c251c681365a2c723" + "3.5.0": + url: "https://github.com/Mbed-TLS/mbedtls/archive/refs/tags/v3.5.0.tar.gz" + sha256: "bdee0e3e45bbf360541306cac0cc27e00402c7a46b9bdf2d24787d5107f008f2" "3.2.1": - url: "https://github.com/ARMmbed/mbedtls/archive/mbedtls-3.2.1.tar.gz" + url: "https://github.com/Mbed-TLS/mbedtls/archive/mbedtls-3.2.1.tar.gz" sha256: "5850089672560eeaca03dc36678ee8573bb48ef6e38c94f5ce349af60c16da33" - "3.1.0": - url: "https://github.com/ARMmbed/mbedtls/archive/mbedtls-3.1.0.tar.gz" - sha256: "64d01a3b22b91cf3a25630257f268f11bc7bfa37981ae6d397802dd4ccec4690" - "3.0.0": - url: "https://github.com/ARMmbed/mbedtls/archive/mbedtls-3.0.0.tar.gz" - sha256: "377d376919be19f07c7e7adeeded088a525be40353f6d938a78e4f986bce2ae0" + "2.28.4": + url: "https://github.com/Mbed-TLS/mbedtls/archive/refs/tags/v2.28.4.tar.gz" + sha256: "578c4dcd15bbff3f5cd56aa07cd4f850fc733634e3d5947be4f7157d5bfd81ac" "2.25.0": url: "https://github.com/ARMmbed/mbedtls/archive/mbedtls-2.25.0.tar.gz" sha256: "ea2049c2dd4868693998d5a9780e198194be5aea1706ff4a9d4f882f18c0a101" - "2.24.0": - url: "https://github.com/ARMmbed/mbedtls/archive/mbedtls-2.24.0.tar.gz" - sha256: "b5a779b5f36d5fc4cba55faa410685f89128702423ad07b36c5665441a06a5f3" - "2.23.0": - url: "https://github.com/ARMmbed/mbedtls/archive/mbedtls-2.23.0.tar.gz" - sha256: "5c8998217402aa1fc734f4afaeac38fad2421470fac4b3abc112bd46391054fe" + "2.16.12": + url: "https://github.com/Mbed-TLS/mbedtls/archive/refs/tags/mbedtls-2.16.12.tar.gz" + sha256: "0afb4a4ce5b771f2fb86daee786362fbe48285f05b73cd205f46a224ec031783" diff --git a/recipes/mbedtls/all/conanfile.py b/recipes/mbedtls/all/conanfile.py index 78c7bf30e76ae..d2eb38dbb504c 100644 --- a/recipes/mbedtls/all/conanfile.py +++ b/recipes/mbedtls/all/conanfile.py @@ -1,7 +1,8 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, 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 @@ -14,25 +15,26 @@ class MBedTLSConan(ConanFile): "mbed TLS makes it trivially easy for developers to include " "cryptographic and SSL/TLS capabilities in their (embedded) products" ) - topics = ("polarssl", "tls", "security") + license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://tls.mbed.org" - license = "Apache-2.0" + topics = ("polarssl", "tls", "security") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], "with_zlib": [True, False], + "enable_threading": [True, False], } default_options = { "shared": False, "fPIC": True, "with_zlib": True, + "enable_threading": False, } - exports_sources = "CMakeLists.txt" - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC @@ -51,24 +53,30 @@ def layout(self): def requirements(self): if self.options.get_safe("with_zlib"): - self.requires("zlib/1.2.13") + self.requires("zlib/[>=1.2.11 <2]") def validate(self): - if self.info.settings.os == "Windows" and self.info.options.shared: - raise ConanInvalidConfiguration(f"{self.ref} does not support shared build on Windows") + if self.settings.os == "Windows": + if self.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} does not support shared build on Windows") + if self.options.enable_threading: + # INFO: Planned: https://github.com/Mbed-TLS/mbedtls/issues/8455 + raise ConanInvalidConfiguration(f"{self.ref} does not support the option enable_threading 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": # The command line flags set are not supported on older versions of gcc raise ConanInvalidConfiguration( - f"{self.ref} does not support {self.info.settings.compiler}-{self.info.settings.compiler.version}" + f"{self.ref} does not support {self.settings.compiler}-{self.settings.compiler.version}" ) 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) + if self.options.shared: + tc.preprocessor_definitions["X509_BUILD_SHARED"] = "1" + tc.cache_variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True 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": @@ -79,6 +87,17 @@ def generate(self): if Version(self.version) < "3.0.0": # relocatable shared libs on macOS tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" + if is_msvc(self): + if check_min_vs(self, 190, raise_invalid=False): + tc.preprocessor_definitions["MBEDTLS_PLATFORM_SNPRINTF_MACRO"] = "snprintf" + else: + tc.preprocessor_definitions["MBEDTLS_PLATFORM_SNPRINTF_MACRO"] = "MBEDTLS_PLATFORM_STD_SNPRINTF" + if self.options.enable_threading: + tc.preprocessor_definitions["MBEDTLS_THREADING_C"] = True + tc.preprocessor_definitions["MBEDTLS_THREADING_PTHREAD"] = True + + tc.generate() + tc = CMakeDeps(self) tc.generate() def build(self): @@ -90,6 +109,8 @@ 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")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) rmdir(self, os.path.join(self.package_folder, "cmake")) def package_info(self): @@ -98,14 +119,28 @@ def package_info(self): self.cpp_info.components["mbedcrypto"].set_property("cmake_target_name", "MbedTLS::mbedcrypto") self.cpp_info.components["mbedcrypto"].libs = ["mbedcrypto"] + if self.settings.os == "Windows": + self.cpp_info.components["mbedcrypto"].system_libs = ["bcrypt"] + if Version(self.version) >= "3.6.0": + self.cpp_info.components["mbedcrypto"].set_property("pkg_config_name", "mbedcrypto") + if self.options.enable_threading: + self.cpp_info.components["mbedcrypto"].defines.extend(["MBEDTLS_THREADING_C=1", "MBEDTLS_THREADING_PTHREAD=1"]) + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["mbedcrypto"].system_libs.append("pthread") self.cpp_info.components["mbedx509"].set_property("cmake_target_name", "MbedTLS::mbedx509") self.cpp_info.components["mbedx509"].libs = ["mbedx509"] + if self.settings.os == "Windows": + self.cpp_info.components["mbedx509"].system_libs = ["ws2_32"] self.cpp_info.components["mbedx509"].requires = ["mbedcrypto"] + if Version(self.version) >= "3.6.0": + self.cpp_info.components["mbedx509"].set_property("pkg_config_name", "mbedx509") self.cpp_info.components["libembedtls"].set_property("cmake_target_name", "MbedTLS::mbedtls") self.cpp_info.components["libembedtls"].libs = ["mbedtls"] self.cpp_info.components["libembedtls"].requires = ["mbedx509"] + if Version(self.version) >= "3.6.0": + self.cpp_info.components["libembedtls"].set_property("pkg_config_name", "embedtls") if self.options.get_safe("with_zlib"): for component in self.cpp_info.components: diff --git a/recipes/mbedtls/all/test_package/CMakeLists.txt b/recipes/mbedtls/all/test_package/CMakeLists.txt index 708448e53f170..5fa9b94ca1217 100644 --- a/recipes/mbedtls/all/test_package/CMakeLists.txt +++ b/recipes/mbedtls/all/test_package/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package LANGUAGES C) find_package(MbedTLS REQUIRED CONFIG) diff --git a/recipes/mbedtls/all/test_v1_package/CMakeLists.txt b/recipes/mbedtls/all/test_v1_package/CMakeLists.txt index 0d20897301b68..b21cc49efde95 100644 --- a/recipes/mbedtls/all/test_v1_package/CMakeLists.txt +++ b/recipes/mbedtls/all/test_v1_package/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) diff --git a/recipes/mbedtls/config.yml b/recipes/mbedtls/config.yml index 114a3e62d619d..c59faa366d45d 100644 --- a/recipes/mbedtls/config.yml +++ b/recipes/mbedtls/config.yml @@ -1,13 +1,24 @@ versions: - "3.2.1": + "3.6.2": folder: all - "3.1.0": + "3.6.1": folder: all - "3.0.0": + "3.6.0": folder: all - "2.25.0": + "3.5.2": folder: all - "2.24.0": + # keep 3.5.0 for libcurl, libssh2, libwebsockets, libzip + "3.5.0": + folder: all + # keep 3.2.1 for libcoap, libgit2, lief + "3.2.1": + folder: all + # keep 2.28.4 for libssh2 + "2.28.4": + folder: all + # keep 2.25.0 for ixwebsocket, nng, open62541, yojimbo, mdnsresponder + "2.25.0": folder: all - "2.23.0": + # keep 2.6.12 for cose-c + "2.16.12": folder: all diff --git a/recipes/mbits-diags/all/conandata.yml b/recipes/mbits-diags/all/conandata.yml new file mode 100644 index 0000000000000..3bca84056e5f0 --- /dev/null +++ b/recipes/mbits-diags/all/conandata.yml @@ -0,0 +1,10 @@ +sources: + "0.9.6": + url: "https://github.com/mbits-libs/diags/archive/v0.9.6.tar.gz" + sha256: "db86aa0c4ce1bbfa548a39e046b7872e6f369d668ee433dc5a57cf2a026deb4c" + "0.9.5": + url: "https://github.com/mbits-libs/diags/archive/v0.9.5.tar.gz" + sha256: "5594ad477a9a23012faf50ce0c007351f5073908cf84a3507fc539b74878dd55" + "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..c23670e616dd0 --- /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/10.2.1") + 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..9ac73bad7edeb --- /dev/null +++ b/recipes/mbits-diags/config.yml @@ -0,0 +1,7 @@ +versions: + "0.9.6": + folder: all + "0.9.5": + folder: all + "0.9.4": + folder: all diff --git a/recipes/mbits-lngs/all/conandata.yml b/recipes/mbits-lngs/all/conandata.yml new file mode 100644 index 0000000000000..a85ddd2561b52 --- /dev/null +++ b/recipes/mbits-lngs/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.7.6": + url: "https://github.com/mbits-os/lngs/archive/v0.7.6.tar.gz" + sha256: "85c9fd3afd5b6d5446a294f4de11221ae7fa160a62d1115a7ea0c1af17633a0b" diff --git a/recipes/mbits-lngs/all/conanfile.py b/recipes/mbits-lngs/all/conanfile.py new file mode 100644 index 0000000000000..3558c49245302 --- /dev/null +++ b/recipes/mbits-lngs/all/conanfile.py @@ -0,0 +1,142 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import check_min_vs, is_msvc +from conan.tools.files import get, copy, save, 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 textwrap + + +required_conan_version = ">=1.53.0" + + +class MBitsLngsConan(ConanFile): + name = "mbits-lngs" + description = "Language strings support" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/mbits-os/lngs" + topics = ("gettext", "locale",) + settings = "os", "arch", "compiler", "build_type" + package_type = "static-library" + 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 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/10.2.1") + self.requires("mbits-utfconv/1.0.3") + self.requires("mbits-diags/0.9.6") + self.requires("mbits-mstch/1.0.4") + self.requires("mbits-args/0.12.3") + + 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) + + @property + def _settings_build(self): + return self.settings_build if hasattr(self, "settings_build") else self.settings + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["LNGS_TESTING"] = False + tc.variables["LNGS_LITE"] = False + tc.variables["LNGS_LINKED_RESOURCES"] = True + tc.variables["LNGS_NO_PKG_CONFIG"] = True + if cross_building(self) and hasattr(self, "settings_build"): + tc.variables["LNGS_REBUILD_RESOURCES"] = False + tc.generate() + tc = CMakeDeps(self) + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + @property + def _cmake_install_base_path(self): + return os.path.join("lib", "cmake") + + @property + def _cmake_targets_module_file(self): + return os.path.join(self._cmake_install_base_path, "mbits-lngs-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() + rmdir(self, os.path.join(self.package_folder, self._cmake_install_base_path)) + + + # Provide relocatable mbits::lngs target and Mbitslngs_LNGS_EXECUTABLE cache variable + # TODO: some of the following logic might be disabled when conan will + # allow to create executable imported targets in package_info() + module_folder_depth = len(os.path.normpath(self._cmake_install_base_path).split(os.path.sep)) + lngs_rel_path = "{}bin/{}".format("".join(["../"] * module_folder_depth), "lngs") + save(self, os.path.join(self.package_folder, self._cmake_targets_module_file), + textwrap.dedent( + f"""\ + if(NOT TARGET mbits::lngs) + if(CMAKE_CROSSCOMPILING) + find_program(LNGS_PROGRAM lngs PATHS ENV PATH NO_DEFAULT_PATH) + endif() + if(NOT LNGS_PROGRAM) + set(LNGS_PROGRAM "${{CMAKE_CURRENT_LIST_DIR}}/{lngs_rel_path}") + endif() + get_filename_component(LNGS_PROGRAM "${{LNGS_PROGRAM}}" ABSOLUTE) + set(Mbitslngs_LNGS_EXECUTABLE ${{LNGS_PROGRAM}} CACHE FILEPATH "The lngs tool") + add_executable(mbits::lngs IMPORTED) + set_property(TARGET mbits::lngs PROPERTY IMPORTED_LOCATION ${{Mbitslngs_LNGS_EXECUTABLE}}) + endif() + """) + ) + + def package_info(self): + self.cpp_info.builddirs = [self._cmake_install_base_path ] + self.cpp_info.set_property("cmake_build_modules", [self._cmake_targets_module_file]) + self.cpp_info.set_property("cmake_file_name", "mbits-lngs") + + comp = self.cpp_info.components["liblngs"] + comp.set_property("cmake_target_name", "mbits::liblngs") + comp.libs = ["lngs"] diff --git a/recipes/mbits-lngs/all/test_package/CMakeLists.txt b/recipes/mbits-lngs/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..de4330a77c2a6 --- /dev/null +++ b/recipes/mbits-lngs/all/test_package/CMakeLists.txt @@ -0,0 +1,22 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package CXX) + +find_package(mbits-lngs REQUIRED CONFIG) + +set(IDL ${CMAKE_CURRENT_SOURCE_DIR}/translations.idl) +set(CPP ${CMAKE_CURRENT_BINARY_DIR}/translations.cpp) +set(HPP ${CMAKE_CURRENT_BINARY_DIR}/translations.hpp) + +add_custom_target( + make_lngs + COMMAND mbits::lngs res ${IDL} -o ${CPP} --include "translations.hpp" + COMMAND mbits::lngs enums -r ${IDL} -o ${HPP} + BYPRODUCTS ${CPP} ${HPP} + DEPENDS ${IDL} +) + +add_executable(${PROJECT_NAME} test_package.cpp ${CPP} ${HPP}) +target_link_libraries(${PROJECT_NAME} PRIVATE mbits::liblngs) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) +add_dependencies(${PROJECT_NAME} make_lngs) diff --git a/recipes/mbits-lngs/all/test_package/conanfile.py b/recipes/mbits-lngs/all/test_package/conanfile.py new file mode 100644 index 0000000000000..e3b64136d43e7 --- /dev/null +++ b/recipes/mbits-lngs/all/test_package/conanfile.py @@ -0,0 +1,43 @@ +from conan import ConanFile +from conan.tools.build import can_run, cross_building +from conan.tools.cmake import cmake_layout, CMake, CMakeDeps, CMakeToolchain +from conan.tools.env import VirtualRunEnv, VirtualBuildEnv +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def build_requirements(self): + if cross_building(self) and hasattr(self, "settings_build"): + self.tool_requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def generate(self): + tc = VirtualRunEnv(self) + tc.generate() + tc = VirtualBuildEnv(self) + if cross_building(self) and hasattr(self, "settings_build"): + tc.generate() + else: + tc.generate(scope="build") + tc = CMakeToolchain(self) + tc.generate() + tc = CMakeDeps(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/mbits-lngs/all/test_package/test_package.cpp b/recipes/mbits-lngs/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..54cfa70731d8d --- /dev/null +++ b/recipes/mbits-lngs/all/test_package/test_package.cpp @@ -0,0 +1,10 @@ +#include "translations.hpp" +#include + +int main() { + lngs::test::Strings tr{}; + tr.init_builtin(); + tr.path_manager(".", "example"); + + std::cout << tr(lngs::test::lng::MESSAGE) << '\n'; +} diff --git a/recipes/mbits-lngs/all/test_package/translations.idl b/recipes/mbits-lngs/all/test_package/translations.idl new file mode 100644 index 0000000000000..52b142116a700 --- /dev/null +++ b/recipes/mbits-lngs/all/test_package/translations.idl @@ -0,0 +1,9 @@ +[ + project("lngs-test"), + namespace("lngs::test"), + version("0.1"), + serial(1) +] strings { + [help("Hello world string"), id(1001)] + MESSAGE = "Hello, world!"; +} diff --git a/recipes/mbits-lngs/config.yml b/recipes/mbits-lngs/config.yml new file mode 100644 index 0000000000000..1d3599e3efc2e --- /dev/null +++ b/recipes/mbits-lngs/config.yml @@ -0,0 +1,3 @@ +versions: + "0.7.6": + folder: all diff --git a/recipes/mbits-mstch/all/conanfile.py b/recipes/mbits-mstch/all/conanfile.py index a06f83e964b39..a8cfe1d7dd5a7 100644 --- a/recipes/mbits-mstch/all/conanfile.py +++ b/recipes/mbits-mstch/all/conanfile.py @@ -33,7 +33,7 @@ def _min_cppstd(self): @property def _compilers_minimum_version(self): return { - "gcc": "11", + "gcc": "10", "clang": "12", "msvc": "192", "apple-clang": "11.0.3", diff --git a/recipes/mbits-utfconv/all/conandata.yml b/recipes/mbits-utfconv/all/conandata.yml new file mode 100644 index 0000000000000..321d37c79ca7e --- /dev/null +++ b/recipes/mbits-utfconv/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "1.0.4": + url: "https://github.com/mbits-libs/utfconv/archive/v1.0.4.tar.gz" + sha256: "cd4b6cbed75d67a02399add312b93c4c1de9ac53cf33a8bf44baece038fabb60" + "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..20b5bf02cf8c7 --- /dev/null +++ b/recipes/mbits-utfconv/config.yml @@ -0,0 +1,5 @@ +versions: + "1.0.4": + folder: all + "1.0.3": + folder: all diff --git a/recipes/mcap/all/conandata.yml b/recipes/mcap/all/conandata.yml index 2c7f690cbdc21..d6df7ac1df80a 100644 --- a/recipes/mcap/all/conandata.yml +++ b/recipes/mcap/all/conandata.yml @@ -1,19 +1,43 @@ 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.1.2: - url: https://github.com/foxglove/mcap/archive/refs/tags/releases/cpp/v0.1.2/main.tar.gz - sha256: 0f456d6c53730445c3dbf57afd285493cf748c66a02f77d6e48c075128fd0896 - 0.3.0: - url: https://github.com/foxglove/mcap/archive/refs/tags/releases/cpp/v0.3.0/main.tar.gz - sha256: ef29ea4c09520b8aaa2d78ce5e79cbbcd87511ed14d6abf3c4b249ae67a4153b - 0.4.0: - url: https://github.com/foxglove/mcap/archive/refs/tags/releases/cpp/v0.4.0/main.tar.gz - sha256: c0ab99e51005fa8b74fe9ca1ed23b205cf532b8b0723eedd243f35a28d7b466b - 0.5.0: - url: https://github.com/foxglove/mcap/archive/refs/tags/releases/cpp/v0.5.0/main.tar.gz - sha256: 408e255a6c6419b16de38a9ecbdd9729d60adc657767b2d52a234d1da1185349 + "1.4.1": + url: "https://github.com/foxglove/mcap/archive/refs/tags/releases/cpp/v1.4.1.tar.gz" + sha256: "69bcd33e1590201ea180e9e6ba8a22f3e8e7e2283e9ebcbff6a2c7134d8341db" + "1.4.0": + url: "https://github.com/foxglove/mcap/archive/refs/tags/releases/cpp/v1.4.0.tar.gz" + sha256: "64ff3e51119f37ffcfaf9deecbd987a7cb4d4d9035d74a3fd3773395a470fda1" + "1.3.0": + url: "https://github.com/foxglove/mcap/archive/releases/cpp/v1.3.0.tar.gz" + sha256: "41acf6e85d75556c64407f077e05492d31db1f099e07242ef04364bb2939acf1" + "1.2.1": + url: "https://github.com/foxglove/mcap/archive/releases/cpp/v1.2.1.tar.gz" + sha256: "fdc0c351bbcf8883fec0047ff84fed74da88446859083beb6624a584e2cde669" + "1.2.0": + url: "https://github.com/foxglove/mcap/archive/refs/tags/releases/cpp/v1.2.0/main.tar.gz" + sha256: "11a6badecac2b10e9687e912648a6e9679ef8731e4ab9570346ae9845ae64a65" + "1.1.0": + url: "https://github.com/foxglove/mcap/archive/refs/tags/releases/cpp/v1.1.0/main.tar.gz" + sha256: "1cb2ae9f2e910eeb2e93b3ab722744d1805b9da45764e4fd88703b669413350d" + "1.0.0": + url: "https://github.com/foxglove/mcap/archive/refs/tags/releases/cpp/v1.0.0/main.tar.gz" + sha256: "e36169e46a67a9431f73df335f67488461817bc423f9af63ac0af7f29e0bd696" + "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" + "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 52080826200a5..1089c7a6c48f9 100644 --- a/recipes/mcap/all/conanfile.py +++ b/recipes/mcap/all/conanfile.py @@ -1,60 +1,80 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools import files 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.47.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 = "MIT" - topics = ("mcap", "serialization", "deserialization", "recording") + topics = ("serialization", "deserialization", "recording", "header-only") + package_type = "header-library" + 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): - files.get(self, **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("zstd/1.5.2") + self.requires("lz4/1.9.4") + self.requires("zstd/1.5.5") if Version(self.version) < "0.1.1": - self.requires("fmt/8.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"): - check_min_cppstd(self, "17") - if self.settings.compiler == "apple-clang" and Version(self.settings.compiler.version) <= "11": - raise ConanInvalidConfiguration("Compiler version is not supported, c++17 support is required") - if (self.settings.compiler in ("gcc", "clang")) and Version(self.settings.compiler.version) <= "8": - raise ConanInvalidConfiguration("Compiler version is not supported, c++17 support is required") - if 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 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 configure(self): - if Version(self.version) < "0.3.0": - self.license = "Apache-2.0" + 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 9d5e985915dd3..fa5c6d575b8ef 100644 --- a/recipes/mcap/all/test_package/CMakeLists.txt +++ b/recipes/mcap/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(mcap REQUIRED CONFIG) diff --git a/recipes/mcap/all/test_package/conanfile.py b/recipes/mcap/all/test_package/conanfile.py index 14c16cdc02a92..8749556609d86 100644 --- a/recipes/mcap/all/test_package/conanfile.py +++ b/recipes/mcap/all/test_package/conanfile.py @@ -7,10 +7,14 @@ 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() diff --git a/recipes/mcap/all/test_v1_package/CMakeLists.txt b/recipes/mcap/all/test_v1_package/CMakeLists.txt index f9cbae78f78b9..be00a8c7f57c7 100644 --- a/recipes/mcap/all/test_v1_package/CMakeLists.txt +++ b/recipes/mcap/all/test_v1_package/CMakeLists.txt @@ -1,12 +1,8 @@ cmake_minimum_required(VERSION 3.8) - -project(test_package CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(mcap REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE mcap::mcap) -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/mcap/all/test_v1_package/conanfile.py b/recipes/mcap/all/test_v1_package/conanfile.py index c492184eec19c..20d4d2e28d57e 100644 --- a/recipes/mcap/all/test_v1_package/conanfile.py +++ b/recipes/mcap/all/test_v1_package/conanfile.py @@ -2,8 +2,6 @@ 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" diff --git a/recipes/mcap/config.yml b/recipes/mcap/config.yml index af633986f7d13..0b63fa5acf0da 100644 --- a/recipes/mcap/config.yml +++ b/recipes/mcap/config.yml @@ -1,13 +1,29 @@ versions: - 0.1.0: + "1.4.1": folder: all - 0.1.1: + "1.4.0": folder: all - 0.1.2: + "1.3.0": folder: all - 0.3.0: + "1.2.1": folder: all - 0.4.0: + "1.2.0": folder: all - 0.5.0: + "1.1.0": + folder: all + "1.0.0": + folder: all + "0.9.0": + folder: all + "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/conandata.yml b/recipes/md4c/all/conandata.yml index 013088e384ddf..9b548aabb3a3f 100644 --- a/recipes/md4c/all/conandata.yml +++ b/recipes/md4c/all/conandata.yml @@ -1,8 +1,23 @@ sources: + "0.5.2": + url: "https://github.com/mity/md4c/archive/refs/tags/release-0.5.2.tar.gz" + sha256: "55d0111d48fb11883aaee91465e642b8b640775a4d6993c2d0e7a8092758ef21" + "0.5.1": + url: "https://github.com/mity/md4c/archive/refs/tags/release-0.5.1.tar.gz" + sha256: "2dca17c6175a7f11182943079c2a4f9adb5071433e3d3d05ba801ff794993f34" "0.4.8": url: "https://github.com/mity/md4c/archive/refs/tags/release-0.4.8.tar.gz" sha256: "4a457df853425b6bb6e3457aa1d1a13bccec587a04c38c622b1013a0da41439f" patches: + "0.5.2": + - patch_file: "patches/0.5.2-0001-honor-vc-runtime.patch" + patch_description: "Honor msvc runtime from profile" + patch_type: "conan" + "0.5.1": + - patch_file: "patches/0.5.1-0001-honor-vc-runtime.patch" + patch_description: "Honor msvc runtime from profile" + patch_type: "conan" "0.4.8": - - patch_file: "patches/0001-honor-vc-runtime.patch" + - patch_file: "patches/0.4.8-0001-honor-vc-runtime.patch" patch_description: "Honor msvc runtime from profile" + patch_type: "conan" diff --git a/recipes/md4c/all/conanfile.py b/recipes/md4c/all/conanfile.py index 4b5bb25a31a26..40333503038dd 100644 --- a/recipes/md4c/all/conanfile.py +++ b/recipes/md4c/all/conanfile.py @@ -5,25 +5,28 @@ import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.54.0" class Md4cConan(ConanFile): name = "md4c" description = "C Markdown parser. Fast. SAX-like interface. Compliant to CommonMark specification." license = "MIT" - topics = ("markdown-parser", "markdown") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/mity/md4c" + topics = ("markdown-parser", "markdown") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], + "md2html": [True, False], "encoding": ["utf-8", "utf-16", "ascii"], } default_options = { "shared": False, "fPIC": True, + "md2html": True, "encoding": "utf-8", } @@ -36,40 +39,29 @@ def config_options(self): 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 + 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.settings.os != "Windows" and self.info.options.encoding == "utf-16": + if self.settings.os != "Windows" and self.options.encoding == "utf-16": raise ConanInvalidConfiguration(f"{self.ref} doesn't support utf-16 options on non-Windows platforms") 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_MD2HTML_EXECUTABLE"] = self.options.md2html 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": 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): @@ -120,6 +112,4 @@ def package_info(self): 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) + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/md4c/all/patches/0001-honor-vc-runtime.patch b/recipes/md4c/all/patches/0.4.8-0001-honor-vc-runtime.patch similarity index 100% rename from recipes/md4c/all/patches/0001-honor-vc-runtime.patch rename to recipes/md4c/all/patches/0.4.8-0001-honor-vc-runtime.patch diff --git a/recipes/md4c/all/patches/0.5.1-0001-honor-vc-runtime.patch b/recipes/md4c/all/patches/0.5.1-0001-honor-vc-runtime.patch new file mode 100644 index 0000000000000..a6ad62492c9da --- /dev/null +++ b/recipes/md4c/all/patches/0.5.1-0001-honor-vc-runtime.patch @@ -0,0 +1,29 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index be781e5..c60da0a 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -46,15 +46,15 @@ elseif(MSVC) + # Disable warnings about the so-called unsecured functions: + add_definitions(/D_CRT_SECURE_NO_WARNINGS /W3) + +- # 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") ++# # 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/patches/0.5.2-0001-honor-vc-runtime.patch b/recipes/md4c/all/patches/0.5.2-0001-honor-vc-runtime.patch new file mode 100644 index 0000000000000..5e8fb995033c5 --- /dev/null +++ b/recipes/md4c/all/patches/0.5.2-0001-honor-vc-runtime.patch @@ -0,0 +1,27 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index aec8293..f24e654 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -53,14 +53,14 @@ elseif(MSVC) + add_compile_options(/W3) + + # 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") ++ # 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 dd82268d730c4..afe8788f52c1d 100644 --- a/recipes/md4c/all/test_package/CMakeLists.txt +++ b/recipes/md4c/all/test_package/CMakeLists.txt @@ -1,6 +1,5 @@ -cmake_minimum_required(VERSION 3.8) - -project(test_package C) +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) find_package(md4c CONFIG REQUIRED) diff --git a/recipes/md4c/all/test_v1_package/CMakeLists.txt b/recipes/md4c/all/test_v1_package/CMakeLists.txt index a7e30d5cc2c2d..0d20897301b68 100644 --- a/recipes/md4c/all/test_v1_package/CMakeLists.txt +++ b/recipes/md4c/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.8) - -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(md4c CONFIG REQUIRED) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE md4c::md4c) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/md4c/config.yml b/recipes/md4c/config.yml index e89d9145fbd26..684aad3078ab7 100644 --- a/recipes/md4c/config.yml +++ b/recipes/md4c/config.yml @@ -1,3 +1,7 @@ versions: + "0.5.2": + folder: all + "0.5.1": + folder: all "0.4.8": folder: all diff --git a/recipes/md4qt/all/conandata.yml b/recipes/md4qt/all/conandata.yml index 3e89e46b3e63a..9d1d364030dad 100644 --- a/recipes/md4qt/all/conandata.yml +++ b/recipes/md4qt/all/conandata.yml @@ -1,13 +1,13 @@ sources: - "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" + "3.0.0": + url: "https://github.com/igormironchik/md4qt/archive/refs/tags/3.0.0.tar.gz" + sha256: "757f94ce1818123abe899729bba00aa1d99150d4cbe934ab57a95b308fd536dd" + "2.8.2": + url: "https://github.com/igormironchik/md4qt/archive/refs/tags/2.8.2.tar.gz" + sha256: "4f560d752ead3aba4983bd09d87e9e32a8313770d7fde0374988785d193b386a" + "2.7.4": + url: "https://github.com/igormironchik/md4qt/archive/refs/tags/2.7.4.tar.gz" + sha256: "adef8e96e71f13cb9f4450eee7bb02a43694682dc67519323f8e23f7bf10d0d1" + "2.6.0": + url: "https://github.com/igormironchik/md4qt/archive/refs/tags/2.6.0.tar.gz" + sha256: "8884a3b18fd923dd49994190e0b11c1882e409fce59fb6e5ee8e866dd889b8d0" diff --git a/recipes/md4qt/all/conanfile.py b/recipes/md4qt/all/conanfile.py index ce75e30212e5e..8e13c7e378f4f 100644 --- a/recipes/md4qt/all/conanfile.py +++ b/recipes/md4qt/all/conanfile.py @@ -16,6 +16,7 @@ class Md4QtConan(ConanFile): license = "MIT" description = "Header-only C++ library for parsing Markdown." topics = ("markdown", "gfm", "parser", "icu", "ast", "commonmark", "md", "qt6", "stl", "cpp17") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -33,13 +34,16 @@ def _compilers_minimum_version(self): "apple-clang": "14", } - def package_id(self): - self.info.clear() + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - self.requires("icu/72.1") + self.requires("icu/74.1") self.requires("uriparser/0.9.7") + def package_id(self): + self.info.clear() + def validate(self): if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, self._min_cppstd) @@ -49,24 +53,21 @@ def validate(self): 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) + 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")) + if Version(self.version) <= "2.8.1": + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + else: + copy(self, "MIT.txt", src=os.path.join(self.source_folder, "LICENSES"), 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/conanfile.py b/recipes/md4qt/all/test_package/conanfile.py index c78095722f7aa..b5553413c7eed 100644 --- a/recipes/md4qt/all/test_package/conanfile.py +++ b/recipes/md4qt/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() @@ -23,4 +24,4 @@ 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") + self.run(f"{bin_path} \"{md_path}\"", env="conanrun") diff --git a/recipes/md4qt/all/test_v1_package/CMakeLists.txt b/recipes/md4qt/all/test_v1_package/CMakeLists.txt index b24e1b03fbf83..b21cc49efde95 100644 --- a/recipes/md4qt/all/test_v1_package/CMakeLists.txt +++ b/recipes/md4qt/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.15) +project(test_package) 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) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/md4qt/all/test_v1_package/conanfile.py b/recipes/md4qt/all/test_v1_package/conanfile.py index df702b6f48d7c..e62a3cb2d7440 100644 --- a/recipes/md4qt/all/test_v1_package/conanfile.py +++ b/recipes/md4qt/all/test_v1_package/conanfile.py @@ -15,4 +15,4 @@ 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) + self.run(f"{bin_path} \"{md_path}\"", run_environment=True) diff --git a/recipes/md4qt/config.yml b/recipes/md4qt/config.yml index 7529da0511999..233405139e945 100644 --- a/recipes/md4qt/config.yml +++ b/recipes/md4qt/config.yml @@ -1,9 +1,9 @@ versions: - "2.0.3": + "3.0.0": folder: all - "2.0.2": + "2.8.2": folder: all - "2.0.1": + "2.7.4": folder: all - "2.0.0": + "2.6.0": folder: all diff --git a/recipes/mdns/all/conandata.yml b/recipes/mdns/all/conandata.yml index ef0896308dfb2..67326bafe7dd9 100644 --- a/recipes/mdns/all/conandata.yml +++ b/recipes/mdns/all/conandata.yml @@ -1,22 +1,13 @@ sources: - "1.0": - sha256: e06ed954b4705f0e48f3e6bd44b75c115ee03f745c62394ee615f466e44e9373 - url: https://github.com/mjansson/mdns/archive/1.0.tar.gz - "1.1": - sha256: a0d170bc88151235b9f2dea10a9ffd1d538e4ce3b098426893fd45890efcbffb - url: https://github.com/mjansson/mdns/archive/1.1.tar.gz - "1.2": - sha256: 1919f8fd01b2b7e1128e51d51e4bd9e48fd4f2ef4ade88c152970a35d2084bae - url: https://github.com/mjansson/mdns/archive/1.2.tar.gz - "1.3": - url: "https://github.com/mjansson/mdns/archive/1.3.tar.gz" - sha256: "d3bfd684ef07beadca71c426586be88a10a92026fe6fe5355609d9e805ff5f85" - "1.4": - url: "https://github.com/mjansson/mdns/archive/1.4.tar.gz" - sha256: "413af72a6ce655dc96d35584dd0134f4ba87534ff78471b5b578e175b9f58dd5" - "1.4.1": - url: "https://github.com/mjansson/mdns/archive/1.4.1.tar.gz" - sha256: "decaf007376c62389712dda67c0eaa8ffb682e7be32ece816b1646119f061be3" + "1.4.3": + url: "https://github.com/mjansson/mdns/archive/1.4.3.tar.gz" + sha256: "be1fd8e35599cb7de179decbd0633c121d11a2dcb9cc193ff5c590bd0d480483" "1.4.2": url: "https://github.com/mjansson/mdns/archive/1.4.2.tar.gz" sha256: "c69cfdebe28a489c85f33744f7811c40572a9769a81cd57ecc09ef95802347f2" + "1.3": + url: "https://github.com/mjansson/mdns/archive/1.3.tar.gz" + sha256: "d3bfd684ef07beadca71c426586be88a10a92026fe6fe5355609d9e805ff5f85" + "1.2": + url: "https://github.com/mjansson/mdns/archive/1.2.tar.gz" + sha256: "1919f8fd01b2b7e1128e51d51e4bd9e48fd4f2ef4ade88c152970a35d2084bae" diff --git a/recipes/mdns/all/conanfile.py b/recipes/mdns/all/conanfile.py index aa012f43092fc..6842da5a57847 100644 --- a/recipes/mdns/all/conanfile.py +++ b/recipes/mdns/all/conanfile.py @@ -1,38 +1,45 @@ import os -from conans import CMake, ConanFile, tools -required_conan_version = ">=1.43.0" +from conan import ConanFile +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout + +required_conan_version = ">=1.52.0" + class MdnsConan(ConanFile): name = "mdns" + description = "Public domain mDNS/DNS-SD library in C" license = "Unlicense" - homepage = "https://github.com/mjansson/mdns" url = "https://github.com/conan-io/conan-center-index" - description = "Public domain mDNS/DNS-SD library in C" - topics = ("mdns", "dns", "dns-sd", "multicast discovery", "discovery") - settings = "os", "compiler", "build_type", "arch" + homepage = "https://github.com/mjansson/mdns" + topics = ("dns", "dns-sd", "multicast discovery", "discovery", "header-only") + + 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.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", dst="licenses", src=self._source_subfolder) - self.copy(pattern="*.h", dst="include", src=self._source_subfolder) + copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, "*.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.os == "Windows": self.cpp_info.system_libs = ["iphlpapi", "ws2_32"] - if str(self.settings.os) in ["Linux", "Android"]: - self.cpp_info.system_libs.append('pthread') + if str(self.settings.os) in ["Linux", "FreeBSD", "Android"]: + self.cpp_info.system_libs.append("pthread") self.cpp_info.set_property("cmake_file_name", "mdns") self.cpp_info.set_property("cmake_target_name", "mdns::mdns") diff --git a/recipes/mdns/all/test_package/CMakeLists.txt b/recipes/mdns/all/test_package/CMakeLists.txt index c7366be61abf1..351413082436f 100644 --- a/recipes/mdns/all/test_package/CMakeLists.txt +++ b/recipes/mdns/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -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() +find_package(mdns REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE mdns::mdns) set_target_properties(${PROJECT_NAME} PROPERTIES C_STANDARD 99) diff --git a/recipes/mdns/all/test_package/conanfile.py b/recipes/mdns/all/test_package/conanfile.py index 6c0a50e0f7678..ef5d7042163ec 100644 --- a/recipes/mdns/all/test_package/conanfile.py +++ b/recipes/mdns/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 TestConan(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", "test_package") - bin_path = 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/mdns/all/test_package/test_package.c b/recipes/mdns/all/test_package/test_package.c index b27d9acd4f04b..57ae843c7e0c0 100644 --- a/recipes/mdns/all/test_package/test_package.c +++ b/recipes/mdns/all/test_package/test_package.c @@ -15,8 +15,7 @@ # include #endif -int -main(int argc, const char* const* argv) { +int test() { #ifdef _WIN32 WORD versionWanted = MAKEWORD(1, 1); WSADATA wsaData; @@ -26,8 +25,7 @@ main(int argc, const char* const* argv) { } #endif - int port = 0; - int sock = mdns_socket_open_ipv4(port); + int sock = mdns_socket_open_ipv4(NULL); if (sock < 0) { printf("Failed to open socket: %s\n", strerror(errno)); return -1; @@ -35,9 +33,15 @@ main(int argc, const char* const* argv) { printf("socket cleanup\n"); mdns_socket_close(sock); + #ifdef _WIN32 WSACleanup(); #endif +} + +int main() { + // Do not run test() to not open a socket unnecessarily. + // Verifying that the function compiles is sufficient. return 0; } diff --git a/recipes/mdns/all/test_v1_package/CMakeLists.txt b/recipes/mdns/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/mdns/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/mdns/all/test_v1_package/conanfile.py b/recipes/mdns/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..6dffe66394a26 --- /dev/null +++ b/recipes/mdns/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.settings): + bin_path = os.path.join("bin", "test_package") + bin_path = self.run(bin_path, run_environment=True) diff --git a/recipes/mdns/config.yml b/recipes/mdns/config.yml index cdb4b7bded43e..59538424539ea 100644 --- a/recipes/mdns/config.yml +++ b/recipes/mdns/config.yml @@ -1,15 +1,9 @@ versions: - "1.0": + "1.4.3": folder: "all" - "1.1": - folder: "all" - "1.2": + "1.4.2": folder: "all" "1.3": folder: "all" - "1.4": - folder: "all" - "1.4.1": - folder: "all" - "1.4.2": + "1.2": folder: "all" diff --git a/recipes/mdnsresponder/all/conandata.yml b/recipes/mdnsresponder/all/conandata.yml index cadda75d51e61..c11cf45776081 100644 --- a/recipes/mdnsresponder/all/conandata.yml +++ b/recipes/mdnsresponder/all/conandata.yml @@ -5,23 +5,29 @@ sources: "1310.140.1": url: "https://github.com/apple-oss-distributions/mDNSResponder/archive/mDNSResponder-1310.140.1.tar.gz" sha256: "ecb0043ffc5a3cbf4f43da0298e351d787654d980b291d1cb567c6ddee9dc983" + "1790.80.10": + url: "https://github.com/apple-oss-distributions/mDNSResponder/archive/mDNSResponder-1790.80.10.tar.gz" + sha256: "ffb990231639dfe8c7f0b15d0665206a9013f1aacfb2cbb934eb87f6a57f38b7" patches: "878.200.35": - - base_path: "source_subfolder" - patch_file: "patches/878.200.35/DLLStub.c.patch" - - base_path: "source_subfolder" - patch_file: "patches/878.200.35/mDNSResponder.sln.patch" - - base_path: "source_subfolder" - patch_file: "patches/878.200.35/mDNSWin32.c.patch" - - base_path: "source_subfolder" - patch_file: "patches/878.200.35/Service.c.patch" + - patch_file: "patches/878.200.35/DLLStub.c.patch" + - patch_file: "patches/878.200.35/mDNSResponder.sln.patch" + - patch_file: "patches/878.200.35/mDNSWin32.c.patch" + - patch_file: "patches/878.200.35/Service.c.patch" + - patch_file: "patches/878.200.35/upgrade-windows-toolset.patch" "878.200.35-opt": - - base_path: "source_subfolder" - patch_file: "patches/878.200.35/opt/permit-over-long-service-types.patch" - - base_path: "source_subfolder" - patch_file: "patches/878.200.35/opt/poll-rather-than-select.patch" - - base_path: "source_subfolder" - patch_file: "patches/878.200.35/opt/unicast.patch" + - patch_file: "patches/878.200.35/opt/permit-over-long-service-types.patch" + - patch_file: "patches/878.200.35/opt/poll-rather-than-select.patch" + - patch_file: "patches/878.200.35/opt/unicast.patch" "1310.140.1": - - base_path: "source_subfolder" - patch_file: "patches/1310.140.1/dns_sd.c.patch" + - patch_file: "patches/1310.140.1/dns_sd.c.patch" + "1790.80.10": + - patch_file: "patches/1790.80.10/Resolve-compile-problem-on-linux-platform.patch" + patch_description: "ensure the compilation passes on Linux: update mDNS.c, mbedtls.c and uds_daemon.c to resolve compilation errors." + patch_type: "bugfix" + - patch_file: "patches/1790.80.10/Support-cross-building.patch" + patch_description: "allow dependencies provided by conan and support cross-building for linux:update Makefile to use dependencies provided by conan and support cross-building." + patch_type: "conan" + - patch_file: "patches/1790.80.10/Add-unicast-disabled-flag.patch" + patch_description: "add missing unicast cropping option: update Makefile to add missing cropping option, and update uDNS.c to resolve related compilation errors." + patch_type: "bugfix" diff --git a/recipes/mdnsresponder/all/conanfile.py b/recipes/mdnsresponder/all/conanfile.py index 5e0b8a3e6f765..9200f80247bf5 100644 --- a/recipes/mdnsresponder/all/conanfile.py +++ b/recipes/mdnsresponder/all/conanfile.py @@ -1,14 +1,19 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment, MSBuild -from conans.errors import ConanInvalidConfiguration -from conan.tools.files.symlinks import absolute_to_relative_symlinks +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import symlinks, rmdir, get, replace_in_file, rename, chdir, patch, mkdir, copy, apply_conandata_patches +from conan.tools.scm import Version +from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps +from conan.tools.layout import basic_layout +from conan.tools.microsoft import MSBuild, is_msvc, MSBuildToolchain, VCVars import os -required_conan_version = ">=1.33.0" + +required_conan_version = ">=1.53.0" class MdnsResponderConan(ConanFile): name = "mdnsresponder" - description = "Conan package for Apple's mDNSResponder" + description = "Apple Open Source DNS Service Discovery Collection" topics = ("Bonjour", "DNS-SD", "mDNS") url = "https://github.com/conan-io/conan-center-index" homepage = "https://opensource.apple.com/tarballs/mDNSResponder/" @@ -16,52 +21,75 @@ class MdnsResponderConan(ConanFile): settings = "os", "arch", "compiler", "build_type" options = { "with_opt_patches": [True, False], + "use_tls": [True, False], + "unicast_disabled": [True, False], } default_options = { "with_opt_patches": False, + "use_tls": False, + "unicast_disabled": False, } - exports_sources = ["patches/**"] - _autotools = None + def export_sources(self): + # INFO: export_conandata_patches will not export optional patches + copy(self, "*.patch", dst=os.path.join(self.export_sources_folder, "patches"), src=os.path.join(self.recipe_folder, "patches")) - @property - def _source_subfolder(self): - return "source_subfolder" + def configure(self): + if self.options.use_tls: + #The target(libdns_sd) is a shared lib, so mbedtls enable 'shared' option + self.options['mbedtls'].shared = True + + def requirements(self): + if self.options.use_tls: + self.requires("mbedtls/2.25.0") + + def layout(self): + basic_layout(self, src_folder="src") def validate(self): if self.settings.os not in ["Linux", "Windows"]: raise ConanInvalidConfiguration("Only Linux and Windows are supported for this package.") - if tools.Version(self.version) >= "1096.0.2": + if Version(self.version) >= "1096.0.2": # recent tarballs (since 1096.0.2) are missing mDNSWindows, so for now, Linux only if self.settings.os == "Windows": raise ConanInvalidConfiguration("Windows is not supported for version {}.".format(self.version)) # TCP_NOTSENT_LOWAT is causing build failures for packages built with gcc 4.9 # the best check would probably be for Linux kernel v3.12, but for now... - 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("Only gcc 5 or higher is supported for this package.") # __has_c_attribute is not available in Clang 5 - if self.settings.compiler == "clang" and tools.Version(self.settings.compiler.version) < "6": + if self.settings.compiler == "clang" and Version(self.settings.compiler.version) < "6": raise ConanInvalidConfiguration("Only Clang 6 or higher is supported for this package.") # FIXME: Migration of the project files fails with VS 2017 on c3i (conan-center-index's infrastructure) # though works OK with VS 2015 and VS 2019, and works with VS 2017 in my local environment - if self.settings.compiler == "Visual Studio" and tools.Version(self.settings.compiler.version) == "15": + if is_msvc(self) and (Version(self.settings.compiler.version) == "15" or "1910" <= Version(self.settings.compiler.version) <= "1916"): raise ConanInvalidConfiguration("Visual Studio 2017 is not supported in CCI (yet).") + if self.options.use_tls and (not self.dependencies["mbedtls"].options.shared): + raise ConanInvalidConfiguration("The dependency 'mbedtls' must be built as a shared library.") 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 _posix_folder(self): - return os.path.join(self._source_subfolder, "mDNSPosix") + return os.path.join(self.source_folder, "mDNSPosix") @property def _make_build_args(self): # the Makefile does not support parallel builds - return [ + build_args = [ "os=linux", "-j1", ] + if not self.options.use_tls: + build_args.append("tls=no") + #FIXME: 878.200.35 and 1310.140.1 will fail to compile when DEBUG=1 + if self.settings.build_type == "Debug" and Version(self.version) != "878.200.35" and Version(self.version) != "1310.140.1": + build_args.append("DEBUG=1") + if self.options.unicast_disabled: + build_args.append("unicast_disabled=y") + + return build_args @property def _make_build_targets(self): @@ -80,17 +108,9 @@ def _make_install_targets(self): # not installing man pages, NSS plugin return " ".join(["setup", "InstalledDaemon", "InstalledLib", "InstalledClients"]) - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self) - # fix for error: 'for' loop initial declarations are only allowed in C99 or C11 mode - self._autotools.flags.append("-std=gnu99") - return self._autotools - def _build_make(self): - with tools.chdir(self._posix_folder): - autotools = self._configure_autotools() + with chdir(self, self._posix_folder): + autotools = Autotools(self) autotools.make(args=self._make_build_args, target=self._make_build_targets) @property @@ -110,31 +130,48 @@ def _msvc_platform(self): return self._msvc_platforms[str(self.settings.arch)] def _build_msvc(self): - sln = os.path.join(self._source_subfolder, "mDNSResponder.sln") + sln = os.path.join(self.source_folder, "mDNSResponder.sln") if "MD" in self.settings.compiler.runtime: # could use glob and replace_in_file(strict=False, ...) - dll_vcxproj = os.path.join(self._source_subfolder, "mDNSWindows", "DLL", "dnssd.vcxproj") - dllstub_vcxproj = os.path.join(self._source_subfolder, "mDNSWindows", "DLLStub", "DLLStub.vcxproj") - dns_sd_vcxproj = os.path.join(self._source_subfolder, "Clients", "DNS-SD.VisualStudio", "dns-sd.vcxproj") + dll_vcxproj = os.path.join(self.source_folder, "mDNSWindows", "DLL", "dnssd.vcxproj") + dllstub_vcxproj = os.path.join(self.source_folder, "mDNSWindows", "DLLStub", "DLLStub.vcxproj") + dns_sd_vcxproj = os.path.join(self.source_folder, "Clients", "DNS-SD.VisualStudio", "dns-sd.vcxproj") for vcxproj in [dll_vcxproj, dllstub_vcxproj, dns_sd_vcxproj]: - tools.replace_in_file(vcxproj, "MultiThreaded", "MultiThreadedDLL") - tools.replace_in_file(vcxproj, "MultiThreadedDebug", "MultiThreadedDebugDLL") + replace_in_file(self, vcxproj, "MultiThreaded", "MultiThreadedDLL") + replace_in_file(self, vcxproj, "MultiThreadedDebug", "MultiThreadedDebugDLL") # could use glob and replace_in_file(strict=False, ...) - dll_rc = os.path.join(self._source_subfolder, "mDNSWindows", "DLL", "dll.rc") - dns_sd_rc = os.path.join(self._source_subfolder, "Clients", "DNS-SD.VisualStudio", "dns-sd.rc") + dll_rc = os.path.join(self.source_folder, "mDNSWindows", "DLL", "dll.rc") + dns_sd_rc = os.path.join(self.source_folder, "Clients", "DNS-SD.VisualStudio", "dns-sd.rc") for rc in [dll_rc, dns_sd_rc]: - tools.replace_in_file(rc, "afxres.h", "winres.h") + replace_in_file(self, rc, "afxres.h", "winres.h") msbuild = MSBuild(self) - msbuild.build(sln, targets=self._msvc_targets, platforms=self._msvc_platforms, definitions=self._msvc_definitions) + # use Win32 instead of the default value when building x86 + msbuild.platform = "Win32" if self.settings.arch == "x86" else msbuild.platform + #TODO: How to add _msvc_definitions to msbuild.build + msbuild.build(sln, targets=self._msvc_targets) + + def generate(self): + if self.settings.os == "Linux": + tc = AutotoolsToolchain(self) + # fix for error: 'for' loop initial declarations are only allowed in C99 or C11 mode + tc.extra_cflags.append("-std=gnu99") + tc.generate() + tc = AutotoolsDeps(self) + tc.generate() + elif is_msvc(self): + tc = MSBuildToolchain(self) + tc.configuration = "Debug" if self.settings.build_type == "Debug" else "Release" + tc.generate() + tc = VCVars(self) + 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.with_opt_patches: - for patch in self.conan_data.get("patches", {}).get("{}-opt".format(self.version), []): - tools.patch(**patch) + for patchfile in self.conan_data.get("patches", {}).get("{}-opt".format(self.version), []): + patch(self, **patchfile) if self.settings.os == "Linux": self._build_make() elif self.settings.os == "Windows": @@ -142,31 +179,31 @@ def build(self): def _install_make(self): for dir in ["bin", "include", "lib", "sbin"]: - tools.mkdir(os.path.join(self.package_folder, dir)) - with tools.chdir(self._posix_folder): - autotools = self._configure_autotools() + mkdir(self, os.path.join(self.package_folder, dir)) + with chdir(self, self._posix_folder): + autotools = Autotools(self) autotools.make(args=self._make_install_args, target=self._make_install_targets) # package the daemon in bin too - tools.rename(os.path.join(self.package_folder, "sbin", "mdnsd"), + rename(self, os.path.join(self.package_folder, "sbin", "mdnsd"), os.path.join(self.package_folder, "bin", "mdnsd")) - tools.rmdir(os.path.join(self.package_folder, "sbin")) - absolute_to_relative_symlinks(self, self.package_folder) + rmdir(self, os.path.join(self.package_folder, "sbin")) + symlinks.absolute_to_relative_symlinks(self, self.package_folder) def _msvc_build_folder(self, *argv): - return os.path.join(self._source_subfolder, *argv, self._msvc_platform, str(self.settings.build_type)) + return os.path.join(self.source_folder, *argv, self._msvc_platform, str(self.settings.build_type)) def _install_msvc(self): - self.copy("mDNSResponder.exe", dst="bin", src=self._msvc_build_folder("mDNSWindows", "SystemService")) - self.copy("dns_sd.h", dst="include", src=os.path.join(self._source_subfolder, "mDNSShared")) - self.copy("dnssd.dll", dst="bin", src=self._msvc_build_folder("mDNSWindows", "DLL")) - self.copy("dnssdStatic.lib", dst="lib", src=self._msvc_build_folder("mDNSWindows", "DLLStub")) + copy(self, "mDNSResponder.exe", dst=os.path.join(self.package_folder, "bin"), src=self._msvc_build_folder("mDNSWindows", "SystemService")) + copy(self, "dns_sd.h", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self.source_folder, "mDNSShared")) + copy(self, "dnssd.dll", dst=os.path.join(self.package_folder, "bin"), src=self._msvc_build_folder("mDNSWindows", "DLL")) + copy(self, "dnssdStatic.lib", dst=os.path.join(self.package_folder, "lib"), src=self._msvc_build_folder("mDNSWindows", "DLLStub")) # rename consistently with Bonjour SDK - tools.rename(src=os.path.join(self.package_folder, "lib", "dnssdStatic.lib"), + rename(self, src=os.path.join(self.package_folder, "lib", "dnssdStatic.lib"), dst=os.path.join(self.package_folder, "lib", "dnssd.lib")) - self.copy("dns-sd.exe", dst="bin", src=self._msvc_build_folder("Clients", "DNS-SD.VisualStudio")) + copy(self, "dns-sd.exe", dst=os.path.join(self.package_folder, "bin"), src=self._msvc_build_folder("Clients", "DNS-SD.VisualStudio")) 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) if self.settings.os == "Linux": self._install_make() elif self.settings.os == "Windows": @@ -176,6 +213,9 @@ def package_info(self): # although not one of the find-modules in the CMake distribution, FindDNSSD.cmake is commonly used for this package self.cpp_info.names["cmake_find_package"] = "DNSSD" self.cpp_info.names["cmake_find_package_multi"] = "DNSSD" + self.cpp_info.set_property("cmake_find_mode", "both") + self.cpp_info.set_property("cmake_file_name", "DNSSD") + self.cpp_info.set_property("cmake_target_name", "DNSSD::DNSSD") if self.settings.os == "Linux": self.cpp_info.libs = ["dns_sd"] diff --git a/recipes/mdnsresponder/all/patches/1790.80.10/Add-unicast-disabled-flag.patch b/recipes/mdnsresponder/all/patches/1790.80.10/Add-unicast-disabled-flag.patch new file mode 100644 index 0000000000000..a0817cef24722 --- /dev/null +++ b/recipes/mdnsresponder/all/patches/1790.80.10/Add-unicast-disabled-flag.patch @@ -0,0 +1,28 @@ +diff --git a/mDNSCore/uDNS.c b/mDNSCore/uDNS.c +index 5611517..cfbc7b4 100644 +--- a/mDNSCore/uDNS.c ++++ b/mDNSCore/uDNS.c +@@ -7243,7 +7243,7 @@ mDNSexport mStatus mDNS_SetSecretForDomain(mDNS *m, DomainAuthInfo *info, const + return mStatus_UnsupportedErr; + } + +-mDNSexport domainname *uDNS_GetNextSearchDomain(mDNSInterfaceID InterfaceID, mDNSs8 *searchIndex, mDNSBool ignoreDotLocal) ++mDNSexport domainname *uDNS_GetNextSearchDomain(mDNSInterfaceID InterfaceID, int *searchIndex, mDNSBool ignoreDotLocal) + { + (void) InterfaceID; + (void) searchIndex; +diff --git a/mDNSPosix/Makefile b/mDNSPosix/Makefile +index f695228..179ab8d 100755 +--- a/mDNSPosix/Makefile ++++ b/mDNSPosix/Makefile +@@ -81,6 +81,10 @@ LINKOPTS_PTHREAD = -lpthread + LDSUFFIX = so + JAVACFLAGS_OS = -fPIC -shared -ldns_sd + ++ifeq ($(unicast_disabled), y) ++CFLAGS_COMMON += -DUNICAST_DISABLED ++endif ++ + # Set up diverging paths for debug vs. prod builds + ifeq "$(DEBUG)" "1" + CFLAGS_DEBUGGING = -g -DMDNS_DEBUGMSGS=2 diff --git a/recipes/mdnsresponder/all/patches/1790.80.10/Resolve-compile-problem-on-linux-platform.patch b/recipes/mdnsresponder/all/patches/1790.80.10/Resolve-compile-problem-on-linux-platform.patch new file mode 100644 index 0000000000000..11a00e0f60c5f --- /dev/null +++ b/recipes/mdnsresponder/all/patches/1790.80.10/Resolve-compile-problem-on-linux-platform.patch @@ -0,0 +1,58 @@ +diff --git a/mDNSCore/mDNS.c b/mDNSCore/mDNS.c +index 9466634..d60c6f2 100644 +--- a/mDNSCore/mDNS.c ++++ b/mDNSCore/mDNS.c +@@ -9849,7 +9849,7 @@ mDNSlocal void mDNSCoreReceiveNoUnicastAnswers(mDNS *const m, const DNSMessage * + #else + const DNSServRef dnsserv = qptr->qDNSServer; + #endif +- debugf("mDNSCoreReceiveNoUnicastAnswers making negative cache entry TTL %d for %##s (%s)", negttl, name->c, DNSTypeName(q.qtype)); ++ debugf("mDNSCoreReceiveNoUnicastAnswers making negative cache entry TTL %d for %##s (%s)", negttl, currentQName->c, DNSTypeName(q.qtype)); + // Create a negative record for the current name in the CNAME chain. + MakeNegativeCacheRecord(m, &m->rec.r, currentQName, currentQNameHash, q.qtype, q.qclass, negttl, mDNSInterface_Any, + dnsserv, response->h.flags); +diff --git a/mDNSPosix/mbedtls.c b/mDNSPosix/mbedtls.c +index a73681b..dba44b9 100644 +--- a/mDNSPosix/mbedtls.c ++++ b/mDNSPosix/mbedtls.c +@@ -218,10 +218,12 @@ mDNSPosixTLSRead(TCPSocket *sock, void *buf, unsigned long buflen, mDNSBool *clo + // and then re-enable read events. What we don't want is to keep calling + // read, because that will spin. + return 0; ++#ifdef MBEDTLS_ERR_SSL_ASYNC_IN_PROGRESS + case MBEDTLS_ERR_SSL_ASYNC_IN_PROGRESS: + LogRedact(MDNS_LOG_CATEGORY_DEFAULT, MDNS_LOG_ERROR, "Got async in progress in TLS read!"); + // No idea how to handle this yet. + return 0; ++#endif + #ifdef MBEDTLS_ERR_SSL_CRYPTO_IN_PROGRESS + case MBEDTLS_ERR_SSL_CRYPTO_IN_PROGRESS: + LogRedact(MDNS_LOG_CATEGORY_DEFAULT, MDNS_LOG_ERROR, "Got crypto in progress in TLS read!"); +@@ -259,9 +261,11 @@ mDNSPosixTLSWrite(TCPSocket *sock, const void *buf, unsigned long buflen) + case MBEDTLS_ERR_SSL_WANT_WRITE: + LogRedact(MDNS_LOG_CATEGORY_DEFAULT, MDNS_LOG_ERROR, "Got SSL want write in TLS read!"); + return 0; ++#ifdef MBEDTLS_ERR_SSL_ASYNC_IN_PROGRESS + case MBEDTLS_ERR_SSL_ASYNC_IN_PROGRESS: + LogRedact(MDNS_LOG_CATEGORY_DEFAULT, MDNS_LOG_ERROR, "Got async in progress in TLS read!"); + return 0; ++#endif + #ifdef MBEDTLS_ERR_SSL_CRYPTO_IN_PROGRESS + case MBEDTLS_ERR_SSL_CRYPTO_IN_PROGRESS: + LogRedact(MDNS_LOG_CATEGORY_DEFAULT, MDNS_LOG_ERROR, "Got crypto in progress in TLS read!"); +diff --git a/mDNSShared/uds_daemon.c b/mDNSShared/uds_daemon.c +index bfcb5d8..7475784 100644 +--- a/mDNSShared/uds_daemon.c ++++ b/mDNSShared/uds_daemon.c +@@ -2913,7 +2913,11 @@ exit: + mDNSlocal mStatus add_domain_to_browser(request_state *info, const domainname *d) + { + browser_t *b, *p; ++#if MDNSRESPONDER_PLATFORM_APPLE + __block mStatus err; ++#else ++ mStatus err; ++#endif + + for (p = info->u.browser.browsers; p; p = p->next) + { diff --git a/recipes/mdnsresponder/all/patches/1790.80.10/Support-cross-building.patch b/recipes/mdnsresponder/all/patches/1790.80.10/Support-cross-building.patch new file mode 100644 index 0000000000000..e74fc81741998 --- /dev/null +++ b/recipes/mdnsresponder/all/patches/1790.80.10/Support-cross-building.patch @@ -0,0 +1,158 @@ +diff --git a/mDNSPosix/Makefile b/mDNSPosix/Makefile +index 802a13d..440b4b2 100755 +--- a/mDNSPosix/Makefile ++++ b/mDNSPosix/Makefile +@@ -37,7 +37,13 @@ + + ############################################################################# + +-LIBVERS = 1 ++ ++ ++LIB_MAJOR_VER = 1 ++LIB_MINOR_VER = 0 ++LIB_PATCH_VER = 0 ++LIBVERS = $(LIB_MAJOR_VER).$(LIB_MINOR_VER).$(LIB_PATCH_VER) ++ + + COREDIR = ../mDNSCore + SHAREDDIR ?= ../mDNSShared +@@ -53,18 +59,24 @@ else ifeq ($(SYSTEM), Linux) + os=linux + endif + +-CC = cc ++ifneq ($(findstring $(os),solaris x),) ++CC ?= gcc ++LD ?= gcc ++else ++CC ?= cc ++LD ?= ld ++endif ++ + BISON = bison + FLEX = flex +-ST = strip +-LD = ld ++STRIP ?= strip + SOOPTS = -shared + CP = cp + RM = rm + LN = ln -s -f + CFLAGS_COMMON = -I$(COREDIR) -I$(SHAREDDIR) -I$(UTILDIR) -I$(DSODIR) -I$(SERVICEREGISTRATIONDIR) -I$(OBJDIR) -fwrapv -W -Wall -DPOSIX_BUILD -DPID_FILE=\"/var/run/mdnsd.pid\" -DMDNS_UDS_SERVERPATH=\"/var/run/mdnsd\" + CFLAGS_PTHREAD = +-LINKOPTS = ++LINKOPTS += ${LDFLAGS} -Wl,--as-needed $(LIBS) + LINKOPTS_PTHREAD = -lpthread + LDSUFFIX = so + JAVACFLAGS_OS = -fPIC -shared -ldns_sd +@@ -74,13 +86,13 @@ ifeq "$(DEBUG)" "1" + CFLAGS_DEBUGGING = -g -DMDNS_DEBUGMSGS=2 + OBJDIR = objects/debug + BUILDDIR = build/debug +-STRIP = echo ++MDNS_STRIP = echo + else + ifeq "$(DEBUGSYMS)" "1" + CFLAGS_DEBUGGING = -g -DMDNS_DEBUGMSGS=0 + OBJDIR = objects/prod + BUILDDIR = build/prod +-STRIP = echo ++MDNS_STRIP = echo + else + # We use -Os for two reasons: + # 1. We want to make small binaries, suitable for putting into hardware devices +@@ -88,7 +100,7 @@ else + CFLAGS_DEBUGGING = -g -DMDNS_DEBUGMSGS=0 + OBJDIR ?= objects/prod + BUILDDIR ?= build/prod +-STRIP = $(ST) -S ++MDNS_STRIP = $(STRIP) -S + endif + endif + +@@ -97,13 +109,11 @@ ifeq ($(os),solaris) + CFLAGS_DEBUGGING = -O0 -DMDNS_DEBUGMSGS=0 + CFLAGS_OS = -DNOT_HAVE_DAEMON -DNOT_HAVE_SA_LEN -DNOT_HAVE_SOCKLEN_T -DNOT_HAVE_IF_NAMETOINDEX \ + -DLOG_PERROR=0 -D_XPG4_2 -D__EXTENSIONS__ -DHAVE_BROKEN_RECVIF_NAME -DTARGET_OS_SOLARIS +-CC = gcc +-LD = gcc + SOOPTS = -shared +-LINKOPTS = -lsocket -lnsl -lresolv ++LINKOPTS += -lsocket -lnsl -lresolv + JAVACFLAGS_OS += -I$(JDK)/include/solaris + ifneq ($(DEBUG),1) +-STRIP = $(ST) ++MDNS_STRIP = $(STRIP) + endif + else + +@@ -114,7 +124,7 @@ CFLAGS_OS = -D_GNU_SOURCE -DHAVE_IPV6 -DNOT_HAVE_SA_LEN -DUSES_NETLINK -DHAVE_LI + TLSOBJS = + else + CFLAGS_OS = -D_GNU_SOURCE -DHAVE_IPV6 -DNOT_HAVE_SA_LEN -DUSES_NETLINK -DHAVE_LINUX -DTARGET_OS_LINUX -DPOSIX_HAS_TLS -ftabstop=4 -Wno-expansion-to-defined +-TLSOBJS = $(OBJDIR)/mbedtls.c.o -lmbedtls -lmbedcrypto ++TLSOBJS = $(OBJDIR)/mbedtls.c.o + endif + LD = $(CC) + SOOPTS = -shared +@@ -162,10 +172,9 @@ CFLAGS_OS = -DHAVE_IPV6 -no-cpp-precomp -Werror -Wdeclaration-after-statement \ + -D__MAC_OS_X_VERSION_MIN_REQUIRED=__MAC_OS_X_VERSION_10_4 \ + -DHAVE_STRLCPY=1 -DTARGET_OS_MAC \ + -D__APPLE_USE_RFC_2292 #-Wunreachable-code +-CC = gcc + LD = $(CC) + SOOPTS = -dynamiclib +-LINKOPTS = -lSystem ++LINKOPTS += -lSystem + LDSUFFIX = dylib + JDK = /System/Library/Frameworks/JavaVM.framework/Home + JAVACFLAGS_OS = -dynamiclib -I/System/Library/Frameworks/JavaVM.framework/Headers -framework JavaVM +@@ -229,7 +238,7 @@ endif + endif + endif + +-MDNSCFLAGS = $(CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_OS) $(CFLAGS_DEBUGGING) ++MDNSCFLAGS = $(CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_OS) $(CFLAGS_DEBUGGING) $(CPPFLAGS) $(CXXFLAGS) + + ############################################################################# + +@@ -267,7 +276,7 @@ Daemon: setup $(BUILDDIR)/mdnsd + + $(BUILDDIR)/mdnsd: $(DAEMONOBJS) + $(CC) -o $@ $+ $(LINKOPTS) +- $(STRIP) $@ ++ $(MDNS_STRIP) $@ + + # libdns_sd target builds the client library + libdns_sd: setup $(BUILDDIR)/libdns_sd.$(LDSUFFIX) +@@ -276,8 +285,8 @@ libdns_sd: setup $(BUILDDIR)/libdns_sd.$(LDSUFFIX) + CLIENTLIBOBJS = $(OBJDIR)/dnssd_clientlib.c.so.o $(OBJDIR)/dnssd_clientstub.c.so.o $(OBJDIR)/dnssd_ipc.c.so.o $(OBJDIR)/dnssd_errstring.c.so.o + + $(BUILDDIR)/libdns_sd.$(LDSUFFIX): $(CLIENTLIBOBJS) +- $(LD) $(SOOPTS) $(LINKOPTS) -o $@ $+ +- $(STRIP) $@ ++ $(LD) $(SOOPTS) $(LINKOPTS) -Wl,-soname,libdns_sd.$(LDSUFFIX).$(LIB_MAJOR_VER) -o $@ $+ ++ $(MDNS_STRIP) $@ + + Clients: setup libdns_sd ../Clients/build/dns-sd + @echo "Clients done" +@@ -291,7 +300,7 @@ nss_mdns: setup $(BUILDDIR)/$(NSSLIBFILE) + + $(BUILDDIR)/$(NSSLIBFILE): $(CLIENTLIBOBJS) $(OBJDIR)/nss_mdns.c.so.o + $(LD) $(SOOPTS) $(LINKOPTS) -o $@ $+ +- $(STRIP) $@ ++ $(MDNS_STRIP) $@ + + ############################################################################# + +@@ -322,7 +331,8 @@ $(INSTBASE)/sbin/mdnsd: $(BUILDDIR)/mdnsd $(STARTUPSCRIPTDIR)/$(STARTUPSCRIPTNAM + + $(INSTBASE)/lib/libdns_sd.$(LDSUFFIX).$(LIBVERS): $(BUILDDIR)/libdns_sd.$(LDSUFFIX) + $(CP) $< $@ +- $(LN) $@ $(INSTBASE)/lib/libdns_sd.$(LDSUFFIX) ++ $(LN) libdns_sd.$(LDSUFFIX).$(LIBVERS) $(INSTBASE)/lib/libdns_sd.$(LDSUFFIX).$(LIB_MAJOR_VER) ++ $(LN) libdns_sd.$(LDSUFFIX).$(LIB_MAJOR_VER) $(INSTBASE)/lib/libdns_sd.$(LDSUFFIX) + ifdef LDCONFIG + # -m means 'merge into existing database', -R means 'rescan directories' + $(LDCONFIG) -mR diff --git a/recipes/mdnsresponder/all/patches/878.200.35/upgrade-windows-toolset.patch b/recipes/mdnsresponder/all/patches/878.200.35/upgrade-windows-toolset.patch new file mode 100644 index 0000000000000..082e2a6d8b4d6 --- /dev/null +++ b/recipes/mdnsresponder/all/patches/878.200.35/upgrade-windows-toolset.patch @@ -0,0 +1,570 @@ +diff --git a/Clients/DNS-SD.VisualStudio/dns-sd.vcxproj b/Clients/DNS-SD.VisualStudio/dns-sd.vcxproj +index 8ed154a..e21d9de 100755 +--- a/Clients/DNS-SD.VisualStudio/dns-sd.vcxproj ++++ b/Clients/DNS-SD.VisualStudio/dns-sd.vcxproj +@@ -26,18 +26,22 @@ + + Application + MultiByte ++ v142 + + + Application + MultiByte ++ v142 + + + Application + MultiByte ++ v142 + + + Application + MultiByte ++ v142 + + + +diff --git a/Clients/ExplorerPlugin/ExplorerPlugin.vcxproj b/Clients/ExplorerPlugin/ExplorerPlugin.vcxproj +index 810c90e..87fe301 100755 +--- a/Clients/ExplorerPlugin/ExplorerPlugin.vcxproj ++++ b/Clients/ExplorerPlugin/ExplorerPlugin.vcxproj +@@ -34,24 +34,32 @@ + DynamicLibrary + Static + Unicode ++ v142 + + + DynamicLibrary + Static + Unicode ++ v142 + + + Application ++ v142 + + + DynamicLibrary + Static + Unicode ++ v142 + + + DynamicLibrary + Static + Unicode ++ v142 ++ ++ ++ v142 + + + +diff --git a/Clients/ExplorerPlugin/ExplorerPluginLocRes.vcxproj b/Clients/ExplorerPlugin/ExplorerPluginLocRes.vcxproj +index fb96fd3..faef74e 100755 +--- a/Clients/ExplorerPlugin/ExplorerPluginLocRes.vcxproj ++++ b/Clients/ExplorerPlugin/ExplorerPluginLocRes.vcxproj +@@ -35,24 +35,32 @@ + DynamicLibrary + Static + Unicode ++ v142 + + + DynamicLibrary + Static + Unicode ++ v142 + + + Application ++ v142 + + + DynamicLibrary + Static + Unicode ++ v142 + + + DynamicLibrary + Static + Unicode ++ v142 ++ ++ ++ v142 + + + +diff --git a/Clients/ExplorerPlugin/ExplorerPluginRes.vcxproj b/Clients/ExplorerPlugin/ExplorerPluginRes.vcxproj +index 4fb6490..9471cec 100755 +--- a/Clients/ExplorerPlugin/ExplorerPluginRes.vcxproj ++++ b/Clients/ExplorerPlugin/ExplorerPluginRes.vcxproj +@@ -34,24 +34,32 @@ + DynamicLibrary + Static + Unicode ++ v142 + + + DynamicLibrary + Static + Unicode ++ v142 + + + Application ++ v142 + + + DynamicLibrary + Static + Unicode ++ v142 + + + DynamicLibrary + Static + Unicode ++ v142 ++ ++ ++ v142 + + + +diff --git a/Clients/FirefoxExtension/FirefoxExtension.vcxproj b/Clients/FirefoxExtension/FirefoxExtension.vcxproj +index 1d02a4e..3999920 100755 +--- a/Clients/FirefoxExtension/FirefoxExtension.vcxproj ++++ b/Clients/FirefoxExtension/FirefoxExtension.vcxproj +@@ -18,11 +18,13 @@ + DynamicLibrary + false + MultiByte ++ v142 + + + DynamicLibrary + false + MultiByte ++ v142 + + + +diff --git a/Clients/PrinterSetupWizard/PrinterSetupWizard.vcxproj b/Clients/PrinterSetupWizard/PrinterSetupWizard.vcxproj +index 563597e..558320e 100755 +--- a/Clients/PrinterSetupWizard/PrinterSetupWizard.vcxproj ++++ b/Clients/PrinterSetupWizard/PrinterSetupWizard.vcxproj +@@ -35,24 +35,32 @@ + Application + Static + MultiByte ++ v142 + + + Application + Static + MultiByte ++ v142 + + + Application ++ v142 + + + Application + Static + MultiByte ++ v142 + + + Application + Static + MultiByte ++ v142 ++ ++ ++ v142 + + + +diff --git a/Clients/PrinterSetupWizard/PrinterSetupWizardLocRes.vcxproj b/Clients/PrinterSetupWizard/PrinterSetupWizardLocRes.vcxproj +index 86affb8..efbb143 100755 +--- a/Clients/PrinterSetupWizard/PrinterSetupWizardLocRes.vcxproj ++++ b/Clients/PrinterSetupWizard/PrinterSetupWizardLocRes.vcxproj +@@ -35,24 +35,32 @@ + DynamicLibrary + Static + MultiByte ++ v142 + + + DynamicLibrary + Static + MultiByte ++ v142 + + + Application ++ v142 + + + DynamicLibrary + Static + MultiByte ++ v142 + + + DynamicLibrary + Static + MultiByte ++ v142 ++ ++ ++ v142 + + + +diff --git a/Clients/PrinterSetupWizard/PrinterSetupWizardRes.vcxproj b/Clients/PrinterSetupWizard/PrinterSetupWizardRes.vcxproj +index 16befa7..3cf521c 100755 +--- a/Clients/PrinterSetupWizard/PrinterSetupWizardRes.vcxproj ++++ b/Clients/PrinterSetupWizard/PrinterSetupWizardRes.vcxproj +@@ -35,24 +35,32 @@ + DynamicLibrary + Static + MultiByte ++ v142 + + + DynamicLibrary + Static + MultiByte ++ v142 + + + Application ++ v142 + + + DynamicLibrary + Static + MultiByte ++ v142 + + + DynamicLibrary + Static + MultiByte ++ v142 ++ ++ ++ v142 + + + +diff --git a/Clients/mDNSNetMonitor.VisualStudio/mDNSNetMonitor.vcxproj b/Clients/mDNSNetMonitor.VisualStudio/mDNSNetMonitor.vcxproj +index 89a27a4..a26a972 100755 +--- a/Clients/mDNSNetMonitor.VisualStudio/mDNSNetMonitor.vcxproj ++++ b/Clients/mDNSNetMonitor.VisualStudio/mDNSNetMonitor.vcxproj +@@ -28,19 +28,23 @@ + Application + Unicode + true ++ v142 + + + Application + Unicode + true ++ v142 + + + Application + Unicode ++ v142 + + + Application + Unicode ++ v142 + + + +diff --git a/mDNSWindows/ControlPanel/ControlPanel.vcxproj b/mDNSWindows/ControlPanel/ControlPanel.vcxproj +index c341d42..0b82bea 100755 +--- a/mDNSWindows/ControlPanel/ControlPanel.vcxproj ++++ b/mDNSWindows/ControlPanel/ControlPanel.vcxproj +@@ -28,19 +28,23 @@ + Application + Static + MultiByte ++ v142 + + + Application + Static ++ v142 + + + Application + Static + MultiByte ++ v142 + + + Application + Static ++ v142 + + + +diff --git a/mDNSWindows/ControlPanel/ControlPanelLocRes.vcxproj b/mDNSWindows/ControlPanel/ControlPanelLocRes.vcxproj +index bc51708..4633fe4 100755 +--- a/mDNSWindows/ControlPanel/ControlPanelLocRes.vcxproj ++++ b/mDNSWindows/ControlPanel/ControlPanelLocRes.vcxproj +@@ -36,24 +36,32 @@ + DynamicLibrary + Static + Unicode ++ v142 + + + DynamicLibrary + Static + Unicode ++ v142 + + + Application ++ v142 + + + DynamicLibrary + Static + Unicode ++ v142 + + + DynamicLibrary + Static + Unicode ++ v142 ++ ++ ++ v142 + + + +diff --git a/mDNSWindows/ControlPanel/ControlPanelRes.vcxproj b/mDNSWindows/ControlPanel/ControlPanelRes.vcxproj +index 321e5ee..37fd041 100755 +--- a/mDNSWindows/ControlPanel/ControlPanelRes.vcxproj ++++ b/mDNSWindows/ControlPanel/ControlPanelRes.vcxproj +@@ -34,24 +34,32 @@ + DynamicLibrary + Static + Unicode ++ v142 + + + DynamicLibrary + Static + Unicode ++ v142 + + + Application ++ v142 + + + DynamicLibrary + Static + Unicode ++ v142 + + + DynamicLibrary + Static + Unicode ++ v142 ++ ++ ++ v142 + + + +diff --git a/mDNSWindows/DLL/dnssd.vcxproj b/mDNSWindows/DLL/dnssd.vcxproj +index 7438a3a..0a6a50e 100755 +--- a/mDNSWindows/DLL/dnssd.vcxproj ++++ b/mDNSWindows/DLL/dnssd.vcxproj +@@ -28,18 +28,22 @@ + + DynamicLibrary + MultiByte ++ v142 + + + DynamicLibrary + MultiByte ++ v142 + + + DynamicLibrary + MultiByte ++ v142 + + + DynamicLibrary + MultiByte ++ v142 + + + +diff --git a/mDNSWindows/DLLStub/DLLStub.vcxproj b/mDNSWindows/DLLStub/DLLStub.vcxproj +index 292d931..0f3fd11 100755 +--- a/mDNSWindows/DLLStub/DLLStub.vcxproj ++++ b/mDNSWindows/DLLStub/DLLStub.vcxproj +@@ -29,24 +29,28 @@ + false + Unicode + false ++ v142 + + + StaticLibrary + false + Unicode + false ++ v142 + + + StaticLibrary + false + Unicode + false ++ v142 + + + StaticLibrary + false + Unicode + false ++ v142 + + + +diff --git a/mDNSWindows/DLLX/DLLX.vcxproj b/mDNSWindows/DLLX/DLLX.vcxproj +index a57e4ed..6c414b7 100755 +--- a/mDNSWindows/DLLX/DLLX.vcxproj ++++ b/mDNSWindows/DLLX/DLLX.vcxproj +@@ -28,23 +28,27 @@ + DynamicLibrary + Static + Unicode ++ v142 + + + DynamicLibrary + false + Static + Unicode ++ v142 + + + DynamicLibrary + Static + Unicode ++ v142 + + + DynamicLibrary + false + Static + Unicode ++ v142 + + + +diff --git a/mDNSWindows/NSPTool/NSPTool.vcxproj b/mDNSWindows/NSPTool/NSPTool.vcxproj +index 7c86852..f676f42 100755 +--- a/mDNSWindows/NSPTool/NSPTool.vcxproj ++++ b/mDNSWindows/NSPTool/NSPTool.vcxproj +@@ -26,18 +26,22 @@ + + Application + MultiByte ++ v142 + + + Application + MultiByte ++ v142 + + + Application + MultiByte ++ v142 + + + Application + MultiByte ++ v142 + + + +diff --git a/mDNSWindows/SystemService/Service.vcxproj b/mDNSWindows/SystemService/Service.vcxproj +index c0eb7a0..4a9ee1c 100755 +--- a/mDNSWindows/SystemService/Service.vcxproj ++++ b/mDNSWindows/SystemService/Service.vcxproj +@@ -28,18 +28,22 @@ + + Application + MultiByte ++ v142 + + + Application + MultiByte ++ v142 + + + Application + MultiByte ++ v142 + + + Application + MultiByte ++ v142 + + + +diff --git a/mDNSWindows/mdnsNSP/mdnsNSP.vcxproj b/mDNSWindows/mdnsNSP/mdnsNSP.vcxproj +index 71b2b98..e844f9a 100755 +--- a/mDNSWindows/mdnsNSP/mdnsNSP.vcxproj ++++ b/mDNSWindows/mdnsNSP/mdnsNSP.vcxproj +@@ -26,18 +26,22 @@ + + DynamicLibrary + MultiByte ++ v142 + + + DynamicLibrary + MultiByte ++ v142 + + + DynamicLibrary + MultiByte ++ v142 + + + DynamicLibrary + MultiByte ++ v142 + + + diff --git a/recipes/mdnsresponder/all/test_package/CMakeLists.txt b/recipes/mdnsresponder/all/test_package/CMakeLists.txt index 34af13462f44f..5814f8fe93b5d 100644 --- a/recipes/mdnsresponder/all/test_package/CMakeLists.txt +++ b/recipes/mdnsresponder/all/test_package/CMakeLists.txt @@ -1,8 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) +project(test_package LANGUAGES C) + +find_package(DNSSD REQUIRED CONFIG) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE DNSSD::DNSSD) diff --git a/recipes/mdnsresponder/all/test_package/conanfile.py b/recipes/mdnsresponder/all/test_package/conanfile.py index fdb9f346a1da9..e845ae751a301 100644 --- a/recipes/mdnsresponder/all/test_package/conanfile.py +++ b/recipes/mdnsresponder/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 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/mdnsresponder/all/test_v1_package/CMakeLists.txt b/recipes/mdnsresponder/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..a4d5a242ce134 --- /dev/null +++ b/recipes/mdnsresponder/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/mdnsresponder/all/test_v1_package/conanfile.py b/recipes/mdnsresponder/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/mdnsresponder/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/mdnsresponder/config.yml b/recipes/mdnsresponder/config.yml index a8ca75314b5a1..a7592a4b20916 100644 --- a/recipes/mdnsresponder/config.yml +++ b/recipes/mdnsresponder/config.yml @@ -3,3 +3,5 @@ versions: folder: all "1310.140.1": folder: all + "1790.80.10": + folder: all diff --git a/recipes/mdspan/all/conandata.yml b/recipes/mdspan/all/conandata.yml index e435ba267f905..e43d2577da38b 100644 --- a/recipes/mdspan/all/conandata.yml +++ b/recipes/mdspan/all/conandata.yml @@ -1,4 +1,10 @@ sources: - "0.1.0": - url: https://github.com/kokkos/mdspan/archive/refs/tags/mdspan-0.1.0.tar.gz - sha256: 24c1e4be4870436c6c5e80d38870721b0b6252185b8288d00d8f3491dfba754b + "0.6.0": + url: "https://github.com/kokkos/mdspan/archive/refs/tags/mdspan-0.6.0.tar.gz" + sha256: "79f94d7f692cbabfbaff6cd0d3434704435c853ee5087b182965fa929a48a592" + "0.5.0": + url: "https://github.com/kokkos/mdspan/archive/refs/tags/mdspan-0.5.0.tar.gz" + sha256: "ffa73e5e0dcd78e5279cd3b51a4d983a1fbef696e630fd1287ce32d93d6642d1" + "0.4.0": + url: https://github.com/kokkos/mdspan/archive/refs/tags/mdspan-0.4.0.tar.gz + sha256: 7b89db3c7a9c206c8447499456fdea9c9c1b3a34f58fd0b4c4dd87176b3fe20b diff --git a/recipes/mdspan/all/conanfile.py b/recipes/mdspan/all/conanfile.py index 2e8201c6f1d4d..e3006cfddddbd 100644 --- a/recipes/mdspan/all/conanfile.py +++ b/recipes/mdspan/all/conanfile.py @@ -1,66 +1,97 @@ -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 MDSpanConan(ConanFile): name = "mdspan" - homepage = "https://github.com/kokkos/mdspan" description = "Production-quality reference implementation of mdspan" - topics = ("multi-dimensional", "array", "span") license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" - settings = "compiler" + homepage = "https://github.com/kokkos/mdspan" + topics = ("multi-dimensional", "array", "span", "header-only") + 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 14 + def _min_cppstd(self): + return "14" if Version(self.version) < "0.6.0" else "17" @property def _minimum_compilers_version(self): return { - "Visual Studio": "15", - "gcc": "5", - "clang": "3.4", - "apple-clang": "5.1" - } + "14": { + "Visual Studio": "15" if Version(self.version) < "0.2.0" else "16", + "msvc": "191" if Version(self.version) < "0.2.0" else "192", + "gcc": "5", + "clang": "3.4", + "apple-clang": "5.1" + }, + "17": { + "Visual Studio": "16", + "msvc": "192", + "gcc": "8", + "clang": "7", + "apple-clang": "12", + } + }.get(self._min_cppstd, {}) + + 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.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.warning(f"{self.ref} recipe lacks information about the {self.settings.compiler} " + "compiler support.") 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)) + f"{self.ref} requires C++{self._min_cppstd} support. " + f"The current compiler {self.settings.compiler} {self.settings.compiler.version} does not support it.") + + if str(self.settings.compiler) == "Visual Studio" and "16.6" <= Version(self.settings.compiler.version) < "17.0": + raise ConanInvalidConfiguration( + "Unsupported Visual Studio version due to upstream bug. The supported Visual Studio versions are (< 16.6 or 17.0 <=)." + "See upstream issue https://github.com/kokkos/mdspan/issues/26 for details.") + # TODO: check msvcc version more precisely + if self.settings.compiler == "msvc" and Version(self.settings.compiler.version) == "192": + raise ConanInvalidConfiguration( + "Unsupported MSVC version due to upstream bug. The supported MSVC versions are (< 192 or 193 <=)." + "See upstream issue https://github.com/kokkos/mdspan/issues/26 for details.") 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="*", dst="include", src=os.path.join(self._source_subfolder, "include")) - self.copy("*LICENSE", dst="licenses", keep_path=False) - - 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="*", + 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", "mdspan") + self.cpp_info.set_property("cmake_target_name", "std::mdspan") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.filenames["cmake_find_package"] = "mdspan" self.cpp_info.filenames["cmake_find_package_multi"] = "mdspan" self.cpp_info.names["cmake_find_package"] = "std" diff --git a/recipes/mdspan/all/test_package/CMakeLists.txt b/recipes/mdspan/all/test_package/CMakeLists.txt index 0de9b0f00dc25..ec6ceb3022ff8 100644 --- a/recipes/mdspan/all/test_package/CMakeLists.txt +++ b/recipes/mdspan/all/test_package/CMakeLists.txt @@ -1,11 +1,20 @@ -cmake_minimum_required(VERSION 3.5) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.12) +project(test_package LANGUAGES CXX) find_package(mdspan REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE std::mdspan) target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_14) + +if(mdspan_VERSION VERSION_GREATER_EQUAL "0.2.0") + target_compile_definitions(${PROJECT_NAME} PRIVATE "MDSPAN_ENABLE_SUBMDSPAN") +endif() + +if(MSVC) + target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_20) +elseif(mdspan_VERSION VERSION_GREATER_EQUAL "0.6.0") + target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_17) +else() + target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_14) +endif() diff --git a/recipes/mdspan/all/test_package/conanfile.py b/recipes/mdspan/all/test_package/conanfile.py index 2afebb9c93770..b9d7f11e89dcd 100644 --- a/recipes/mdspan/all/test_package/conanfile.py +++ b/recipes/mdspan/all/test_package/conanfile.py @@ -1,16 +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_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) 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/mdspan/all/test_package/test_package.cpp b/recipes/mdspan/all/test_package/test_package.cpp index 5fde94d7a2dec..21dfdf2403d14 100644 --- a/recipes/mdspan/all/test_package/test_package.cpp +++ b/recipes/mdspan/all/test_package/test_package.cpp @@ -1,14 +1,23 @@ #include -#include #include +#include namespace stdex = std::experimental; int main() { double buffer[2 * 3 * 4] = {}; +#ifdef MDSPAN_ENABLE_SUBMDSPAN + auto s1 = stdex::mdspan>(buffer, 2, 3, 4); +#else auto s1 = stdex::mdspan(buffer); +#endif s1(1, 1, 1) = 42; + +#ifdef MDSPAN_ENABLE_SUBMDSPAN + auto sub1 = stdex::submdspan(s1, 1, 1, stdex::full_extent); +#else auto sub1 = stdex::subspan(s1, 1, 1, stdex::all); +#endif std::cout << std::boolalpha << (sub1[1] == 42) << std::endl; } diff --git a/recipes/mdspan/all/test_v1_package/CMakeLists.txt b/recipes/mdspan/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..be00a8c7f57c7 --- /dev/null +++ b/recipes/mdspan/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/mdspan/all/test_v1_package/conanfile.py b/recipes/mdspan/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/mdspan/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/mdspan/config.yml b/recipes/mdspan/config.yml index 6c11a439d0bc2..babcbfb79d964 100644 --- a/recipes/mdspan/config.yml +++ b/recipes/mdspan/config.yml @@ -1,3 +1,7 @@ versions: - "0.1.0": + "0.6.0": + folder: all + "0.5.0": + folder: all + "0.4.0": folder: all diff --git a/recipes/melon/all/conandata.yml b/recipes/melon/all/conandata.yml new file mode 100644 index 0000000000000..9550cdb9601e7 --- /dev/null +++ b/recipes/melon/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.0.0-alpha.1": + url: "https://github.com/fhamonic/melon/archive/refs/tags/v1.0.0-alpha.1.tar.gz" + sha256: "370f6bb1fddc68f1ab771c8b659fed6d9dc8da51290897ed72fd87589143220c" diff --git a/recipes/melon/all/conanfile.py b/recipes/melon/all/conanfile.py new file mode 100644 index 0000000000000..0d83d36ecc529 --- /dev/null +++ b/recipes/melon/all/conanfile.py @@ -0,0 +1,76 @@ +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.52.0" + +class PackageConan(ConanFile): + name = "melon" + description = "A modern and efficient graph library using C++20 ranges and concepts." + license = "BSL-1.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/fhamonic/melon" + topics = ("graph", "algorithm", "ranges", "c++20", "header-only") + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _min_cppstd(self): + return 20 + + @property + def _compilers_minimum_version(self): + return { + "apple-clang": "14", + "clang": "17", + "gcc": "12", + "msvc": "192", + "Visual Studio": "17", + } + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("range-v3/0.12.0") + self.requires("fmt/10.2.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) + 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", 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_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["pthread"]) diff --git a/recipes/melon/all/test_package/CMakeLists.txt b/recipes/melon/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..17e2b8206c6aa --- /dev/null +++ b/recipes/melon/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(melon REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE melon::melon) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) diff --git a/recipes/melon/all/test_package/conanfile.py b/recipes/melon/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0a808db45f245 --- /dev/null +++ b/recipes/melon/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/melon/all/test_package/test_package.cpp b/recipes/melon/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..f0417c2d7cc52 --- /dev/null +++ b/recipes/melon/all/test_package/test_package.cpp @@ -0,0 +1,47 @@ +#include "melon/algorithm/bidirectional_dijkstra.hpp" +#include "melon/utility/static_digraph_builder.hpp" +#include "melon/container/static_digraph.hpp" + +using namespace fhamonic::melon; + +// test_package with bidirectional dijkstra because it condenses range-v3 uses +// shown to overwhelm some compilers + +int main(int argc, char *argv[]) +{ + static_digraph_builder builder(6); + + builder.add_arc(0u, 1u, 7); // 0 + builder.add_arc(0u, 2u, 9); // 1 + builder.add_arc(0u, 5u, 14); // 2 + builder.add_arc(1u, 0u, 7); // 3 + builder.add_arc(1u, 2u, 10); // 4 + builder.add_arc(1u, 3u, 15); // 5 + builder.add_arc(2u, 0u, 9); // 6 + builder.add_arc(2u, 1u, 10); // 7 + builder.add_arc(2u, 3u, 12); // 8 + builder.add_arc(2u, 5u, 2); // 9 + builder.add_arc(3u, 1u, 15); // 10 + builder.add_arc(3u, 2u, 12); // 11 + builder.add_arc(3u, 4u, 6); // 12 + builder.add_arc(4u, 3u, 6); // 13 + builder.add_arc(4u, 5u, 9); // 14 + builder.add_arc(5u, 0u, 14); // 15 + builder.add_arc(5u, 2u, 2); // 16 + builder.add_arc(5u, 4u, 9); // 17 + + auto [graph, length_map] = builder.build(); + + bidirectional_dijkstra alg(graph, length_map, 0u, 3u); + + int dist = alg.run(); + if (dist != 21) return EXIT_FAILURE; + + if (!alg.path_found()) return EXIT_FAILURE; + auto path = alg.path(); + if (std::ranges::distance(path) != 2) return EXIT_FAILURE; + if (std::ranges::find(path, 1u) == path.end()) return EXIT_FAILURE; + if (std::ranges::find(path, 8u) == path.end()) return EXIT_FAILURE; + + return EXIT_SUCCESS; +} diff --git a/recipes/melon/config.yml b/recipes/melon/config.yml new file mode 100644 index 0000000000000..6aee52e82f90c --- /dev/null +++ b/recipes/melon/config.yml @@ -0,0 +1,3 @@ +versions: + "1.0.0-alpha.1": + folder: all diff --git a/recipes/mesa-glu/all/conandata.yml b/recipes/mesa-glu/all/conandata.yml new file mode 100644 index 0000000000000..777327d35cae6 --- /dev/null +++ b/recipes/mesa-glu/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "9.0.3": + url: "https://gitlab.freedesktop.org/mesa/glu/-/archive/glu-9.0.3/glu-glu-9.0.3.tar.bz2" + sha256: "38044ee4f255578165a54eaeb089b67fb64f7f7c0ce5fa690cd47c9df10b263c" diff --git a/recipes/mesa-glu/all/conanfile.py b/recipes/mesa-glu/all/conanfile.py new file mode 100644 index 0000000000000..116b5d7d6af29 --- /dev/null +++ b/recipes/mesa-glu/all/conanfile.py @@ -0,0 +1,103 @@ +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, export_conandata_patches, get, load, rm, rmdir, save +from conan.tools.gnu import PkgConfigDeps +from conan.tools.layout import basic_layout +from conan.tools.meson import Meson, MesonToolchain +import os + + +required_conan_version = ">=1.53.0" + + +class MesaGluConan(ConanFile): + name = "mesa-glu" + description = "Mesa's implementation of the OpenGL utility library" + license = ("SGI-B-1.1", "SGI-B-2.0", "MIT") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://www.mesa3d.org/" + topics = ("gl", "glu", "mesa", "opengl") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + provides = "glu" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + @property + def _with_libglvnd(self): + return self.settings.os in ["FreeBSD", "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: + self.options.rm_safe("fPIC") + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + # The glu headers include OpenGL headers. + if self._with_libglvnd: + self.requires("libglvnd/1.7.0", transitive_headers=True) + + def validate(self): + if is_apple_os(self) or self.settings.os == "Windows": + raise ConanInvalidConfiguration(f"{self.ref} is not supported on {self.settings.os}") + + def build_requirements(self): + self.tool_requires("meson/1.2.3") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/2.0.3") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = MesonToolchain(self) + tc.project_options["gl_provider"] = "glvnd" if self._with_libglvnd else "gl" + tc.generate() + tc = PkgConfigDeps(self) + tc.generate() + tc = VirtualBuildEnv(self) + tc.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + + def build(self): + self._patch_sources() + meson = Meson(self) + meson.configure() + meson.build() + + def _extract_license(self): + glu_header = load(self, os.path.join(self.source_folder, "include", "GL", "glu.h")) + begin = glu_header.find("/*") + end = glu_header.find("*/", begin) + return glu_header[begin:end] + + def package(self): + save(self, os.path.join(self.package_folder, "licenses", "LICENSE"), self._extract_license()) + meson = Meson(self) + meson.install() + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + 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 = ["GLU"] + self.cpp_info.set_property("pkg_config_name", "glu") diff --git a/recipes/mesa-glu/all/test_package/conanfile.py b/recipes/mesa-glu/all/test_package/conanfile.py new file mode 100644 index 0000000000000..2e3df45816e5a --- /dev/null +++ b/recipes/mesa-glu/all/test_package/conanfile.py @@ -0,0 +1,32 @@ +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): + 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/1.2.3") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/2.0.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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/mesa-glu/all/test_package/meson.build b/recipes/mesa-glu/all/test_package/meson.build new file mode 100644 index 0000000000000..4b86ab32d1e30 --- /dev/null +++ b/recipes/mesa-glu/all/test_package/meson.build @@ -0,0 +1,5 @@ +project('test_package', 'c') +package_dep = dependency('glu') +executable('test_package', + sources : ['test_package.c'], + dependencies : [package_dep]) diff --git a/recipes/mesa-glu/all/test_package/test_package.c b/recipes/mesa-glu/all/test_package/test_package.c new file mode 100644 index 0000000000000..1edc7d437e36b --- /dev/null +++ b/recipes/mesa-glu/all/test_package/test_package.c @@ -0,0 +1,9 @@ +#include + +#include + +int main() +{ + printf("GLU %s\n", gluGetString(GLU_VERSION)); + return 0; +} diff --git a/recipes/mesa-glu/config.yml b/recipes/mesa-glu/config.yml new file mode 100644 index 0000000000000..55cef0386047b --- /dev/null +++ b/recipes/mesa-glu/config.yml @@ -0,0 +1,3 @@ +versions: + "9.0.3": + folder: all diff --git a/recipes/meshoptimizer/all/conandata.yml b/recipes/meshoptimizer/all/conandata.yml index 1132907df3841..1cf565e7dd285 100644 --- a/recipes/meshoptimizer/all/conandata.yml +++ b/recipes/meshoptimizer/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "0.22": + url: "https://github.com/zeux/meshoptimizer/archive/refs/tags/v0.22.tar.gz" + sha256: "e296cf0685b6421f84bd8a44d0a3cca82a219500f11c793dfbb6087ec86bb1a3" + "0.21": + url: "https://github.com/zeux/meshoptimizer/archive/refs/tags/v0.21.tar.gz" + sha256: "050A5438E4644833FF69F35110FCF4E37038A89C5FDC8AED45D8CD848ECB3A20" + "0.20": + url: "https://github.com/zeux/meshoptimizer/archive/refs/tags/v0.20.tar.gz" + sha256: "CF1077A83958BED3D8DA28A841CA53A6A42D871E49023EDCE64E37002A0F5A48" "0.17": url: "https://github.com/zeux/meshoptimizer/archive/refs/tags/v0.17.tar.gz" sha256: "50f134da6739702d4398f2a3c614acb1d80afb73afed27ac68bc55c9edae64e2" diff --git a/recipes/meshoptimizer/all/conanfile.py b/recipes/meshoptimizer/all/conanfile.py index 174a3955a5f63..ee4c17ba67a7c 100644 --- a/recipes/meshoptimizer/all/conanfile.py +++ b/recipes/meshoptimizer/all/conanfile.py @@ -1,10 +1,11 @@ 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 -from conans import tools as tools_legacy +from conan.tools.scm import Version import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.54.0" class MeshOptimizerConan(ConanFile): @@ -15,6 +16,7 @@ class MeshOptimizerConan(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], @@ -34,17 +36,13 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + 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) @@ -53,10 +51,11 @@ def generate(self): def _patch_sources(self): 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", "") + # No warnings as errors - now fine in 0.19 and up + if Version(self.version) < "0.19": + 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() @@ -76,7 +75,7 @@ def package_info(self): self.cpp_info.set_property("cmake_target_name", "meshoptimizer::meshoptimizer") self.cpp_info.libs = ["meshoptimizer"] if not self.options.shared: - libcxx = tools_legacy.stdcpp_library(self) + libcxx = stdcpp_library(self) if libcxx: self.cpp_info.system_libs.append(libcxx) if self.options.shared and self.settings.os == "Windows": diff --git a/recipes/meshoptimizer/all/test_v1_package/CMakeLists.txt b/recipes/meshoptimizer/all/test_v1_package/CMakeLists.txt index b49461acc50ec..0d20897301b68 100644 --- a/recipes/meshoptimizer/all/test_v1_package/CMakeLists.txt +++ b/recipes/meshoptimizer/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(meshoptimizer REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE meshoptimizer::meshoptimizer) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/meshoptimizer/config.yml b/recipes/meshoptimizer/config.yml index 301a8d09f5b3a..908fa671378b7 100644 --- a/recipes/meshoptimizer/config.yml +++ b/recipes/meshoptimizer/config.yml @@ -1,4 +1,10 @@ versions: + "0.22": + folder: all + "0.21": + folder: all + "0.20": + folder: all "0.17": folder: all "0.16": diff --git a/recipes/meson/all/conandata.yml b/recipes/meson/all/conandata.yml index 0195431f99164..ad55ba8f8a439 100644 --- a/recipes/meson/all/conandata.yml +++ b/recipes/meson/all/conandata.yml @@ -1,49 +1,60 @@ sources: - "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" - "0.63.1": - url: "https://github.com/mesonbuild/meson/archive/0.63.1.tar.gz" - sha256: "f355829f0e8c714423f03a06604c04c216d4cbe3586f3154cb2181076b19207a" - "0.63.0": - url: "https://github.com/mesonbuild/meson/archive/0.63.0.tar.gz" - sha256: "77808d47fa05875c2553d66cb6c6140c2f687b46256dc537eeb8a63889e0bea2" + "1.6.0": + url: "https://github.com/mesonbuild/meson/archive/1.6.0.tar.gz" + sha256: "342300656bfdafb6cc09325bdd0fd507366ecaa6be25fa4525f50889adf7c606" + "1.5.1": + url: "https://github.com/mesonbuild/meson/archive/1.5.1.tar.gz" + sha256: "55f6acd5bf72c14d4aa5a781993633f84a1d117bdf2c2057735902ced9b81390" + "1.5.0": + url: "https://github.com/mesonbuild/meson/archive/1.5.0.tar.gz" + sha256: "781913826fb6f478eb7d77e1942ab3df39444e4c90e9a3523737e215171db469" + "1.4.1": + url: "https://github.com/mesonbuild/meson/archive/1.4.1.tar.gz" + sha256: "a7efc72ecb873c5a62031ade1921a7177b67cfdcb2e9410a7ab023f9e8192f4b" + "1.4.0": + url: "https://github.com/mesonbuild/meson/archive/1.4.0.tar.gz" + sha256: "61382f295378bddcd9bebb3a9a9065b1cbc671fa41b80964ab02726f9a5f3a88" + "1.3.2": + url: "https://github.com/mesonbuild/meson/archive/1.3.2.tar.gz" + sha256: "683082fb3c5cddf203b21d29bdf4c227e2f7964da5324a15e1a5f7db94322b4b" + "1.3.1": + url: "https://github.com/mesonbuild/meson/archive/1.3.1.tar.gz" + sha256: "274c121edb859602eb4589d31d8791e980748bb19950fc6f611a21d76dc22cc6" + "1.3.0": + url: "https://github.com/mesonbuild/meson/releases/download/1.3.0/meson-1.3.0.tar.gz" + sha256: "4ba253ef60e454e23234696119cbafa082a0aead0bd3bbf6991295054795f5dc" + "1.2.3": + url: "https://github.com/mesonbuild/meson/releases/download/1.2.3/meson-1.2.3.tar.gz" + sha256: "4533a43c34548edd1f63a276a42690fce15bde9409bcf20c4b8fa3d7e4d7cac1" + "1.2.2": + url: "https://github.com/mesonbuild/meson/releases/download/1.2.2/meson-1.2.2.tar.gz" + sha256: "4a0f04de331fbc7af3b802a844fc8838f4ccd1ded1e792ba4f8f2faf8c5fe4d6" + "1.2.1": + url: "https://github.com/mesonbuild/meson/releases/download/1.2.1/meson-1.2.1.tar.gz" + sha256: "b1db3a153087549497ee52b1c938d2134e0338214fe14f7efd16fecd57b639f5" + "1.2.0": + url: "https://github.com/mesonbuild/meson/archive/1.2.0.tar.gz" + sha256: "603489f0aaa6305f806c6cc4a4455a965f22290fc74f65871f589b002110c790" + "1.1.1": + url: "https://github.com/mesonbuild/meson/releases/download/1.1.1/meson-1.1.1.tar.gz" + sha256: "d04b541f97ca439fb82fab7d0d480988be4bd4e62563a5ca35fadb5400727b1c" + # qt requires 1.1.0 + "1.1.0": + url: "https://github.com/mesonbuild/meson/archive/1.1.0.tar.gz" + sha256: "f29a3e14062043d75e82d16f1e41856e6b1ed7a7c016e10c7b13afa7ee6364cc" + # wayland-protocols requires 1.0.0 + "1.0.0": + url: "https://github.com/mesonbuild/meson/releases/download/1.0.0/meson-1.0.0.tar.gz" + sha256: "aa50a4ba4557c25e7d48446abfde857957dcdf58385fffbe670ba0e8efacce05" + # gtk requires 0.62.2 "0.62.2": url: "https://github.com/mesonbuild/meson/archive/0.62.2.tar.gz" sha256: "97108f4d9bb16bc758c44749bd25ec7d42c6a762961efbed8b7589a2a3551ea6" - "0.62.1": - url: "https://github.com/mesonbuild/meson/archive/0.62.1.tar.gz" - sha256: "9fb52e66dbc613479a5f70e46cc2e8faf5aa65e09313f2c71fa63b8afd018107" - "0.62.0": - url: "https://github.com/mesonbuild/meson/archive/0.62.0.tar.gz" - sha256: "72ac3bab701dfd597604de29cc74baaa1cc0ad8ca26ae23d5288de26abfe1c80" + # gst-plugins-base requires 0.61.2 "0.61.2": url: "https://github.com/mesonbuild/meson/archive/0.61.2.tar.gz" sha256: "33cd555314a94d52acfbb3f6f44d4e61c4ad0bfec7acf4301be7e40bb969b3a8" - "0.60.2": - url: "https://github.com/mesonbuild/meson/archive/0.60.2.tar.gz" - sha256: "fc7c2f315b5b63fee0414b0b94b5a7d0e9c71c8c9bb8487314eb5a9a33984b8d" + # gobject-introspection requires 0.59.3 "0.59.3": url: "https://github.com/mesonbuild/meson/archive/0.59.3.tar.gz" sha256: "b2c5bfd5032189a66cf6a32d98ba82d94d7d314577d8efe4d9dc159c4073f282" - "0.58.1": - url: "https://github.com/mesonbuild/meson/archive/0.58.1.tar.gz" - sha256: "78e0f553dd3bc632d5f96ab943b1bbccb599c2c84ff27c5fb7f7fff9c8a3f6b4" - "0.57.2": - url: "https://github.com/mesonbuild/meson/archive/0.57.2.tar.gz" - sha256: "cd3773625253df4fd1c380faf03ffae3d02198d6301e7c8bc7bba6c66af66096" - "0.56.2": - url: "https://github.com/mesonbuild/meson/archive/0.56.2.tar.gz" - sha256: "aaae961c3413033789248ffe6762589e80b6cf487c334d0b808e31a32c48f35f" - "0.55.3": - url: "https://github.com/mesonbuild/meson/archive/0.55.3.tar.gz" - sha256: "2b276df50c5b13ccdbfb14d3333141e9e7985aca31b60400b3f3e0be2ee6897e" diff --git a/recipes/meson/all/conanfile.py b/recipes/meson/all/conanfile.py index a39345f1cb657..1f193b4c68fed 100644 --- a/recipes/meson/all/conanfile.py +++ b/recipes/meson/all/conanfile.py @@ -2,7 +2,7 @@ import textwrap from conan import ConanFile, conan_version -from conan.tools.files import copy, get, rmdir, save +from conan.tools.files import copy, get, rmdir, save, replace_in_file from conan.tools.layout import basic_layout from conan.tools.scm import Version @@ -11,11 +11,12 @@ class MesonConan(ConanFile): name = "meson" - description = "Meson is a project to create the best possible next-generation build system" - topics = ("meson", "mesonbuild", "build-system") + description = "a project to create the best possible next-generation build system" + license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/mesonbuild/meson" - license = "Apache-2.0" + topics = ("mesonbuild", "build-system") + package_type = "application" no_copy_source = True def layout(self): @@ -23,17 +24,15 @@ def layout(self): def requirements(self): if self.conf.get("tools.meson.mesontoolchain:backend", default="ninja", check_type=str) == "ninja": - self.requires("ninja/1.11.1") + # Meson requires >=1.8.2 as of 1.5 + # https://github.com/mesonbuild/meson/blob/b6b634ad33e5ca9ad4a9d6139dba4244847cc0e8/mesonbuild/backend/ninjabackend.py#L625 + self.requires("ninja/[>=1.10.2 <2]") 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 + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) @@ -43,14 +42,26 @@ def package(self): # create wrapper scripts save(self, os.path.join(self.package_folder, "bin", "meson.cmd"), textwrap.dedent("""\ @echo off + set PYTHONDONTWRITEBYTECODE=1 CALL python %~dp0/meson.py %* """)) save(self, os.path.join(self.package_folder, "bin", "meson"), textwrap.dedent("""\ #!/usr/bin/env bash meson_dir=$(dirname "$0") + export PYTHONDONTWRITEBYTECODE=1 exec "$meson_dir/meson.py" "$@" """)) + def finalize(self): + copy(self, "*", src=self.immutable_package_folder, dst=self.package_folder) + replace_in_file(self, os.path.join(self.package_folder, "bin", "meson.cmd"), + "set PYTHONDONTWRITEBYTECODE=1", + "") + + replace_in_file(self, os.path.join(self.package_folder, "bin", "meson"), + "export PYTHONDONTWRITEBYTECODE=1", + "") + @staticmethod def _chmod_plus_x(filename): if os.name == "posix": diff --git a/recipes/meson/config.yml b/recipes/meson/config.yml index 3c331d990af96..d2e19a97433c1 100644 --- a/recipes/meson/config.yml +++ b/recipes/meson/config.yml @@ -1,33 +1,37 @@ versions: - "0.64.1": + "1.6.0": folder: all - "0.64.0": + "1.5.1": folder: all - "0.63.3": + "1.5.0": folder: all - "0.63.2": + "1.4.1": folder: all - "0.63.1": + "1.4.0": folder: all - "0.63.0": + "1.3.2": folder: all - "0.62.2": + "1.3.1": folder: all - "0.62.1": + "1.3.0": folder: all - "0.62.0": + "1.2.3": folder: all - "0.61.2": + "1.2.2": folder: all - "0.60.2": + "1.2.1": folder: all - "0.59.3": + "1.2.0": + folder: all + "1.1.1": folder: all - "0.58.1": + "1.1.0": folder: all - "0.57.2": + "1.0.0": folder: all - "0.56.2": + "0.62.2": + folder: all + "0.61.2": folder: all - "0.55.3": + "0.59.3": folder: all diff --git a/recipes/metal-cpp/all/conandata.yml b/recipes/metal-cpp/all/conandata.yml new file mode 100644 index 0000000000000..45ddf13fce349 --- /dev/null +++ b/recipes/metal-cpp/all/conandata.yml @@ -0,0 +1,37 @@ +sources: + "15": + url: "https://developer.apple.com/metal/cpp/files/metal-cpp_macOS15_iOS18.zip" + sha256: "0433df1e0ab13c2b0becbd78665071e3fa28381e9714a3fce28a497892b8a184" + "14.2": + url: "https://developer.apple.com/metal/cpp/files/metal-cpp_macOS14.2_iOS17.2.zip" + sha256: "d800ddbc3fccabce3a513f975eeafd4057e07a29e905ad5aaef8c1f4e12d9ada" + "14": + url: "https://developer.apple.com/metal/cpp/files/metal-cpp_macOS14_iOS17-beta.zip" + sha256: "2009a339ecbd56b36601435fe08c415749f8ad09145755472bb637b319003367" + "13.3": + url: "https://developer.apple.com/metal/cpp/files/metal-cpp_macOS13.3_iOS16.4.zip" + sha256: "0afd87ca851465191ae4e3980aa036c7e9e02fe32e7c760ac1a74244aae6023b" + "13": + url: "https://developer.apple.com/metal/cpp/files/metal-cpp_macOS13_iOS16.zip" + sha256: "6f741894229e9c750add1afc3797274fc008c7507e2ae726370c17c34b7c6a68" +minimum_os_version: + "15": + "Macos": "15" + "iOS": "18" + "tvOS": "18" + "14.2": + "Macos": "14.2" + "iOS": "17.2" + "tvOS": "17.2" + "14": + "Macos": "14" + "iOS": "17" + "tvOS": "17" + "13.3": + "Macos": "13.3" + "iOS": "16.4" + "tvOS": "16.4" + "13": + "Macos": "13" + "iOS": "16" + "tvOS": "16" diff --git a/recipes/metal-cpp/all/conanfile.py b/recipes/metal-cpp/all/conanfile.py new file mode 100644 index 0000000000000..2efbdaef9686f --- /dev/null +++ b/recipes/metal-cpp/all/conanfile.py @@ -0,0 +1,92 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import XCRun +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 +import platform + +required_conan_version = ">=1.53.0" + + +class MetalcppConan(ConanFile): + name = "metal-cpp" + description = ( + "Library for the usage of Apple Metal GPU programming in C++ applications - " + "Header-only library to wrap Metal in C++ classes" + ) + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://developer.apple.com/metal/cpp/" + topics = ("metal", "gpu", "apple", "header-only") + + package_type = "header-library" + 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], strip_root=True) + + def validate(self): + os_name = str(self.settings.os) + if not os_name in ["Macos", "iOS", "tvOS"]: + raise ConanInvalidConfiguration("Metal can only be used on an Macos, iOS or tvOS platform.") + + if self.settings.compiler.get_safe("cppstd"): + min_cppstd = "17" + check_min_cppstd(self, min_cppstd) + + minimum_os_version = self.conan_data["minimum_os_version"][self.version][os_name] + + xcrun = XCRun(self) + os_version = self.settings.get_safe("os.version") + sdk_version = self.settings.get_safe("os.sdk_version") + visible_sdk_version = xcrun.sdk_version if platform.system() == "Darwin" else None + + sdk_version = sdk_version or os_version or visible_sdk_version + + if sdk_version is None: + # Will raise when `os.version` or `os.sdk_version` are not defined + # and we are *NOT* running this on macOS + raise ConanInvalidConfiguration(f"metal-cpp {self.version} requires the os.version or sdk.version settings, but the are not defined") + + if sdk_version < Version(minimum_os_version): + raise ConanInvalidConfiguration(f"metal-cpp {self.version} requires {os_name} SDK version {minimum_os_version} but {sdk_version} is the target.") + + def package(self): + copy( + self, + pattern="LICENSE.txt", + dst=os.path.join(self.package_folder, "licenses"), + src=os.path.join(self.source_folder) + ) + copy( + self, + pattern="**.hpp", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder), + keep_path=True + ) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "metal-cpp") + self.cpp_info.set_property("cmake_target_name", "metal-cpp::metal-cpp") + self.cpp_info.set_property("pkg_config_name", "metal-cpp") + self.cpp_info.bindirs = [] + self.cpp_info.frameworkdirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] + + self.cpp_info.frameworks = ["Foundation", "Metal", "MetalKit", "QuartzCore"] + if self.version >= Version('14'): + self.cpp_info.frameworks.append("MetalFX") diff --git a/recipes/metal-cpp/all/test_package/CMakeLists.txt b/recipes/metal-cpp/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..640984ec9c7f0 --- /dev/null +++ b/recipes/metal-cpp/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.12) +project(test_package LANGUAGES CXX) + +find_package(metal-cpp REQUIRED) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE metal-cpp::metal-cpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/metal-cpp/all/test_package/conanfile.py b/recipes/metal-cpp/all/test_package/conanfile.py new file mode 100644 index 0000000000000..e28de31d33b1c --- /dev/null +++ b/recipes/metal-cpp/all/test_package/conanfile.py @@ -0,0 +1,32 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os +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 validate(self): + if not is_apple_os(self): + raise ConanInvalidConfiguration("Metal can only be used on an Apple OS.") + + 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/metal-cpp/all/test_package/test_package.cpp b/recipes/metal-cpp/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..bb32b01f0db92 --- /dev/null +++ b/recipes/metal-cpp/all/test_package/test_package.cpp @@ -0,0 +1,18 @@ +#include + +#define NS_PRIVATE_IMPLEMENTATION +#define MTL_PRIVATE_IMPLEMENTATION + +#include +#include + + +int main() +{ + // Create a metal device to check the library functions + MTL::Device* metalDevice = MTL::CreateSystemDefaultDevice(); + + std::cout << "Metal device detected: " << metalDevice->name()->cString(NS::ASCIIStringEncoding) << std::endl; + + return EXIT_SUCCESS; +} diff --git a/recipes/metal-cpp/config.yml b/recipes/metal-cpp/config.yml new file mode 100644 index 0000000000000..e0067f6f5cf55 --- /dev/null +++ b/recipes/metal-cpp/config.yml @@ -0,0 +1,11 @@ +versions: + "15": + folder: all + "14.2": + folder: all + "14": + folder: all + "13.3": + folder: all + "13": + folder: all diff --git a/recipes/metall/all/conandata.yml b/recipes/metall/all/conandata.yml index 788ef5da15507..72fbcaef70e39 100644 --- a/recipes/metall/all/conandata.yml +++ b/recipes/metall/all/conandata.yml @@ -1,10 +1,25 @@ sources: + "0.28": + url: "https://github.com/LLNL/metall/archive/refs/tags/v0.28.tar.gz" + sha256: "770dedb7f8220c333688b232a22104ca9d8d5823e7a8a21152b58ef970eb85d0" + "0.27": + url: "https://github.com/LLNL/metall/archive/refs/tags/v0.27.tar.gz" + sha256: "6e6f17a760778f9162def939701f9381a75e5275fd1eb1b2af4b2e89e86e1c58" + "0.26": + url: "https://github.com/LLNL/metall/archive/refs/tags/v0.26.tar.gz" + sha256: "7453c87d99708be8542e354e582cbeefac1e5ba65e609cd85d7126c5b25a6d7b" + "0.25": + url: "https://github.com/LLNL/metall/archive/refs/tags/v0.25.tar.gz" + sha256: "223cb54543b62a62fdbbe6274b02ddcc14b29806e344ee7e2fd3f055c2374295" + "0.24": + url: "https://github.com/LLNL/metall/archive/refs/tags/v0.24.tar.gz" + sha256: "872de2a1b76d44e6876c0b672c0cc518c6f334959e4a229f2f18cc7e01edf477" + "0.23.1": + url: "https://github.com/LLNL/metall/archive/refs/tags/v0.23.1.tar.gz" + sha256: "25e8fbc424e66d09e0faf60029288e4612685675bfd947cc142bd9d6d0645ac4" "0.21": url: "https://github.com/LLNL/metall/archive/refs/tags/v0.21.tar.gz" sha256: "feaff7a935f98d3cc1e2b21f6eae40edc674a5bd0133306afd3851148aaed026" "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/conanfile.py b/recipes/metall/all/conanfile.py index 957ba5421027f..6017c84ad4f89 100644 --- a/recipes/metall/all/conanfile.py +++ b/recipes/metall/all/conanfile.py @@ -5,6 +5,7 @@ from conan.tools.layout import basic_layout from conan.tools.scm import Version import os +import platform required_conan_version = ">=1.50.0" @@ -16,6 +17,7 @@ class MetallConan(ConanFile): description = "Meta allocator for persistent memory" license = "MIT", "Apache-2.0" topics = "cpp", "allocator", "memory-allocator", "persistent-memory", "ecp", "exascale-computing" + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -26,19 +28,27 @@ def _compilers_minimum_version(self): "clang": "9", } + def layout(self): + basic_layout(self, src_folder="src") + def requirements(self): - self.requires("boost/1.79.0") + self.requires("boost/1.81.0") def package_id(self): self.info.clear() + @property + def _is_glibc_older_than_2_27(self): + libver = platform.libc_ver() + return self.settings.os == 'Linux' and libver[0] == 'glibc' and Version(libver[1]) < "2.27" + def validate(self): if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, 17) if self.settings.os not in ["Linux", "Macos"]: raise ConanInvalidConfiguration( - "Metall requires some POSIX functionalities like mmap.") + f"{self.ref} requires some POSIX functionalities like mmap.") def lazy_lt_semver(v1, v2): lv1 = [int(v) for v in v1.split(".")] @@ -52,12 +62,13 @@ def lazy_lt_semver(v1, v2): raise ConanInvalidConfiguration( "{} {} requires C++17, which your compiler does not support.".format(self.name, self.version)) - def layout(self): - basic_layout(self, src_folder="src") + def validate_build(self): + if Version(self.version) >= "0.28" and self._is_glibc_older_than_2_27: + raise ConanInvalidConfiguration( + f"{self.ref} requires copy_file_range() which is available since glibc 2.27.") 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 @@ -75,9 +86,7 @@ def package_info(self): self.cpp_info.names["cmake_find_package_multi"] = "Metall" 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.append("pthread") diff --git a/recipes/metall/all/test_package/conanfile.py b/recipes/metall/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/metall/all/test_package/conanfile.py +++ b/recipes/metall/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/metall/all/test_v1_package/CMakeLists.txt b/recipes/metall/all/test_v1_package/CMakeLists.txt index 90ab90a88d549..b21cc49efde95 100644 --- a/recipes/metall/all/test_v1_package/CMakeLists.txt +++ b/recipes/metall/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.15) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(Metall REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE Metall::Metall) -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/metall/config.yml b/recipes/metall/config.yml index e3fb6e5067c49..1984e8dcd4850 100644 --- a/recipes/metall/config.yml +++ b/recipes/metall/config.yml @@ -1,7 +1,17 @@ versions: - "0.21": + "0.28": folder: all - "0.20": + "0.27": + folder: all + "0.26": + folder: all + "0.25": + folder: all + "0.24": folder: all "0.23.1": folder: all + "0.21": + folder: all + "0.20": + folder: all diff --git a/recipes/metis/all/CMakeLists.txt b/recipes/metis/all/CMakeLists.txt index 15cbde395086d..b311c024ef0c5 100644 --- a/recipes/metis/all/CMakeLists.txt +++ b/recipes/metis/all/CMakeLists.txt @@ -1,10 +1,17 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper LANGUAGES C) +cmake_minimum_required(VERSION 3.15) +project(METIS C) -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) -set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) -set(GKLIB_PATH "${CMAKE_CURRENT_LIST_DIR}/source_subfolder/GKlib" CACHE PATH "") +include(gkbuild.cmake) -add_subdirectory(source_subfolder) +find_package(gklib REQUIRED) + +file(GLOB metis_sources libmetis/*.c) +add_library(metis ${metis_sources}) +target_include_directories(metis PRIVATE libmetis include) +target_link_libraries(metis PRIVATE gklib::gklib) + +include(GNUInstallDirs) +install(TARGETS metis) +install(DIRECTORY include/ DESTINATION include) diff --git a/recipes/metis/all/conandata.yml b/recipes/metis/all/conandata.yml index 396a06387b94f..2250bb8608a80 100644 --- a/recipes/metis/all/conandata.yml +++ b/recipes/metis/all/conandata.yml @@ -1,16 +1,21 @@ sources: + "5.2.1": + url: "https://github.com/KarypisLab/METIS/archive/refs/tags/v5.2.1.tar.gz" + sha256: "1a4665b2cd07edc2f734e30d7460afb19c1217c2547c2ac7bf6e1848d50aff7a" "5.1.1": url: "https://github.com/KarypisLab/METIS/archive/refs/tags/v5.1.1-DistDGL-v0.5.tar.gz" sha256: "cedf0b32d32a8496bac7eb078b2b8260fb00ddb8d50c27e4082968a01bc33331" patches: "5.1.1": - - patch_file: "patches/001-add-gklib-system-cmake.patch" - base_path: "source_subfolder" - - patch_file: "patches/002-support-pure-cmake.patch" - base_path: "source_subfolder" - - patch_file: "patches/003-remove-programs.patch" - base_path: "source_subfolder" - - patch_file: "patches/004-use-conan-gklib.patch" - base_path: "source_subfolder" - - patch_file: "patches/005-fix-install.patch" - base_path: "source_subfolder" + - patch_file: "patches/5.1.1-001-fix-coarse-graph-memory-bugs.patch" + patch_type: "bugfix" + patch_source: "https://github.com/KarypisLab/METIS/commit/36262adecaa9720a4417a67124428061c367fd3f" + patch_description: "Fix memory bug when coarser graph stays the same" + - patch_file: "patches/5.1.1-002-fix-out-out-of-bounds-errors.patch" + patch_type: "bugfix" + patch_source: "https://github.com/KarypisLab/METIS/commit/b9e8609ea16d27cf61e1ad8a38af1bfd6185eca5" + patch_description: "Fix out out-of-bounds memory errors" + - patch_file: "patches/5.1.1-003-reduce-maximum-memory-use.patch" + patch_type: "bugfix" + patch_source: "https://github.com/KarypisLab/METIS/commit/aef54c5b2a72f9d0c3c91b008c35271560b79cac" + patch_description: "Small changes to reduce maximum memory use" diff --git a/recipes/metis/all/conanfile.py b/recipes/metis/all/conanfile.py index 7e077e7ea6112..d935fb4c025d2 100644 --- a/recipes/metis/all/conanfile.py +++ b/recipes/metis/all/conanfile.py @@ -1,101 +1,139 @@ -from conans import ConanFile, CMake, tools -from conan.tools.files import apply_conandata_patches import os -required_conan_version = ">=1.43.0" +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import get, copy, rm, export_conandata_patches, apply_conandata_patches +from conan.tools.microsoft import is_msvc + +required_conan_version = ">=1.53.0" class METISConan(ConanFile): name = "metis" + description = ( + "Set of serial programs for partitioning graphs, " + "partitioning finite element meshes, and producing " + "fill reducing orderings for sparse matrices" + ) license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/KarypisLab/METIS" - description = "set of serial programs for partitioning graphs," \ - " partitioning finite element meshes, and producing" \ - " fill reducing orderings for sparse matrices" topics = ("karypislab", "graph", "partitioning-algorithms") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], + "with_64bit_types": [True, False], + "enable_gkrand": [True, False], + "enable_gkregex": [True, False], + "with_openmp": [True, False], + "with_pcre": [True, False], + "with_valgrind": [True, False], } default_options = { "shared": False, "fPIC": True, + "with_64bit_types": False, + "enable_gkrand": False, + "enable_gkregex": False, + "with_openmp": False, + "with_pcre": False, + "with_valgrind": 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"] - - @property - def _is_mingw(self): - return self.settings.os == "Windows" and self.settings.compiler == "gcc" 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) + copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) + copy(self, "gkbuild.cmake", self.recipe_folder, os.path.join(self.export_sources_folder, "src")) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + del self.options.enable_gkregex 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("gklib/5.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) + rm(self, "*.pdf", self.source_folder, recursive=True) + copy(self, "CMakeLists.txt", self.export_sources_folder, self.source_folder) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["VALGRIND"] = self.options.with_valgrind + tc.variables["OPENMP"] = self.options.with_openmp + tc.variables["PCRE"] = self.options.with_pcre + tc.variables["GKREGEX"] = self.settings.os == "Windows" or self.options.enable_gkregex + tc.variables["GKRAND"] = self.options.enable_gkrand + if self.settings.build_type == "Debug": + tc.preprocessor_definitions["DEBUG"] = "" + else: + # NDEBUG is defined by default by CMake + # tc.preprocessor_definitions["NDEBUG"] = "" + tc.preprocessor_definitions["NDEBUG2"] = "" + bits = 64 if self.options.with_64bit_types else 32 + tc.preprocessor_definitions["IDXTYPEWIDTH"] = str(bits) + tc.preprocessor_definitions["REALTYPEWIDTH"] = str(bits) + tc.generate() + tc = CMakeDeps(self) + tc.generate() def _patch_sources(self): apply_conandata_patches(self) - def _configure_cmake(self): - if not self._cmake: - self._cmake = CMake(self) - self._cmake.definitions["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" - self._cmake.definitions["SHARED"] = self.options.shared - self._cmake.definitions["METIS_INSTALL"] = True - self._cmake.definitions["ASSERT"] = self.settings.build_type == "Debug" - self._cmake.definitions["ASSERT2"] = self.settings.build_type == "Debug" - self._cmake.definitions["METIS_IDX64"] = True - self._cmake.definitions["METIS_REAL64"] = True - 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() + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") + rm(self, "*.cmake", self.package_folder, recursive=True) + rm(self, "*.pc", self.package_folder, recursive=True) + rm(self, "*.pdb", self.package_folder, recursive=True) def package_info(self): self.cpp_info.libs = ["metis"] - self.cpp_info.requires.append("gklib::gklib") + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("m") - if self._is_msvc or self._is_mingw: - self.cpp_info.defines.append("USE_GKREGEX") - if self._is_msvc: + self.cpp_info.defines.append("LINUX") + elif self.settings.os == "Windows": + self.cpp_info.defines.append("WIN32") + self.cpp_info.defines.append("MSC") + self.cpp_info.defines.append("_CRT_SECURE_NO_DEPRECATE") + elif self.settings.os == "Macos": + self.cpp_info.defines.append("MACOS") + elif self.settings.os == "SunOS": + self.cpp_info.defines.append("SUNOS") + + if is_msvc(self): self.cpp_info.defines.append("__thread=__declspec(thread)") + + bits = 64 if self.options.with_64bit_types else 32 + self.cpp_info.defines.append(f"IDXTYPEWIDTH={bits}") + self.cpp_info.defines.append(f"REALTYPEWIDTH={bits}") + + # Defines for GKLib headers + if self.settings.os == "Windows" or self.options.enable_gkregex: + self.cpp_info.defines.append("USE_GKREGEX") + if self.options.enable_gkrand: + self.cpp_info.defines.append("USE_GKRAND") + if self.options.with_pcre: + self.cpp_info.defines.append("__WITHPCRE__") + if self.options.with_openmp: + self.cpp_info.defines.append("__OPENMP__") diff --git a/recipes/metis/all/gkbuild.cmake b/recipes/metis/all/gkbuild.cmake new file mode 100644 index 0000000000000..c5f8ebbaa39fe --- /dev/null +++ b/recipes/metis/all/gkbuild.cmake @@ -0,0 +1,121 @@ +# Source:https://github.com/KarypisLab/METIS/blob/e0f1b88/conf/gkbuild.cmake +# With some of the config moved to conanfile.py. + +# Helper modules. +include(CheckFunctionExists) +include(CheckIncludeFile) + +# Setup options. +option(GPROF "add gprof support" OFF) +option(VALGRIND "add valgrind support" OFF) +option(OPENMP "enable OpenMP support" OFF) +option(PCRE "enable PCRE support" OFF) +option(GKREGEX "enable GKREGEX support" OFF) +option(GKRAND "enable GKRAND support" OFF) + +# Add compiler flags. +if(MSVC) + set(GK_COPTS "/Ox") + set(GK_COPTIONS "-DWIN32 -DMSC -D_CRT_SECURE_NO_DEPRECATE -DUSE_GKREGEX") +elseif(MINGW) + set(GK_COPTS "-DUSE_GKREGEX") +else() + set(GK_COPTIONS "-DLINUX -D_FILE_OFFSET_BITS=64") +endif() +if(CYGWIN) + set(GK_COPTIONS "${GK_COPTIONS} -DCYGWIN") +endif() +if(CMAKE_C_COMPILER_ID STREQUAL "GNU") + # GCC opts. + set(GK_COPTIONS "${GK_COPTIONS} -std=c99 -fno-strict-aliasing") + if(VALGRIND) + set(GK_COPTIONS "${GK_COPTIONS} -march=x86-64 -mtune=generic") + else() + # -march=native is not a valid flag on PPC: + if(CMAKE_SYSTEM_PROCESSOR MATCHES "power|ppc|powerpc|ppc64|powerpc64" OR (APPLE AND CMAKE_OSX_ARCHITECTURES MATCHES "ppc|ppc64")) + set(GK_COPTIONS "${GK_COPTIONS} -mtune=native") + else() + set(GK_COPTIONS "${GK_COPTIONS} -march=native") + endif() + endif() + # GCC warnings. + set(GK_COPTIONS "${GK_COPTIONS} -Werror -Wall -pedantic -Wno-unused-function -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unknown-pragmas -Wno-unused-label") +elseif(${CMAKE_C_COMPILER_ID} MATCHES "Sun") + # Sun insists on -xc99. + set(GK_COPTIONS "${GK_COPTIONS} -xc99") +endif() + +if(${CMAKE_C_COMPILER_ID} STREQUAL "Intel") + set(GK_COPTIONS "${GK_COPTIONS} -xHost") + # set(GK_COPTIONS "${GK_COPTIONS} -fast") +endif() + +# Add support for MacOS items +if(APPLE) + set(GK_COPTIONS "${GK_COPTIONS} -DMACOS") +endif() + +# Find OpenMP if it is requested. +if(OPENMP) + include(FindOpenMP) + if(OPENMP_FOUND) + set(GK_COPTIONS "${GK_COPTIONS} -D__OPENMP__ ${OpenMP_C_FLAGS}") + else() + message(WARNING "OpenMP was requested but support was not found") + endif() +endif() + +if(GPROF) + set(GK_COPTS "-pg") +endif() + +# Add various options +if(PCRE) + set(GK_COPTIONS "${GK_COPTIONS} -D__WITHPCRE__") +endif() + +if(GKREGEX) + set(GK_COPTIONS "${GK_COPTIONS} -DUSE_GKREGEX") +endif() + +if(GKRAND) + set(GK_COPTIONS "${GK_COPTIONS} -DUSE_GKRAND") +endif() + + +# Check for features. +check_include_file(execinfo.h HAVE_EXECINFO_H) +if(HAVE_EXECINFO_H) + set(GK_COPTIONS "${GK_COPTIONS} -DHAVE_EXECINFO_H") +endif() + +check_function_exists(getline HAVE_GETLINE) +if(HAVE_GETLINE) + set(GK_COPTIONS "${GK_COPTIONS} -DHAVE_GETLINE") +endif() + + +# Custom check for TLS. +if(MSVC) + set(GK_COPTIONS "${GK_COPTIONS} -D__thread=__declspec(thread)") + + # This if checks if that value is cached or not. + if("${HAVE_THREADLOCALSTORAGE}" MATCHES "^${HAVE_THREADLOCALSTORAGE}$") + file(WRITE ${CMAKE_SOURCE_DIR}/check_thread_storage.c + "extern __thread int x; int main() { return 0; }") + try_compile(HAVE_THREADLOCALSTORAGE + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/check_thread_storage.c) + if(HAVE_THREADLOCALSTORAGE) + message(STATUS "checking for thread-local storage - found") + else() + message(STATUS "checking for thread-local storage - not found") + endif() + endif() + if(NOT HAVE_THREADLOCALSTORAGE) + set(GK_COPTIONS "${GK_COPTIONS} -D__thread=") + endif() +endif() + +# Finally set the official C flags. +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GK_COPTIONS} ${GK_COPTS}") diff --git a/recipes/metis/all/patches/001-add-gklib-system-cmake.patch b/recipes/metis/all/patches/001-add-gklib-system-cmake.patch deleted file mode 100644 index 2c6798304339e..0000000000000 --- a/recipes/metis/all/patches/001-add-gklib-system-cmake.patch +++ /dev/null @@ -1,151 +0,0 @@ -Add gklib system cmake ---- /dev/null -+++ b/GKlib/GKlibSystem.cmake -@@ -0,0 +1,133 @@ -+# Helper modules. -+include(CheckFunctionExists) -+include(CheckIncludeFile) -+ -+# Setup options. -+option(GDB "enable use of GDB" OFF) -+option(ASSERT "turn asserts on" OFF) -+option(ASSERT2 "additional assertions" OFF) -+option(DEBUG "add debugging support" OFF) -+option(GPROF "add gprof support" OFF) -+option(OPENMP "enable OpenMP support" OFF) -+option(PCRE "enable PCRE support" OFF) -+option(GKREGEX "enable GKREGEX support" OFF) -+option(GKRAND "enable GKRAND support" OFF) -+ -+ -+# Add compiler flags. -+if(MSVC) -+ set(GKlib_COPTS "/Ox") -+ set(GKlib_COPTIONS "-DWIN32 -DMSC -D_CRT_SECURE_NO_DEPRECATE -DUSE_GKREGEX") -+elseif(MINGW) -+ set(GKlib_COPTS "-DUSE_GKREGEX") -+else() -+ set(GKlib_COPTIONS "-DLINUX -D_FILE_OFFSET_BITS=64") -+endif(MSVC) -+if(CYGWIN) -+ set(GKlib_COPTIONS "${GKlib_COPTIONS} -DCYGWIN") -+endif(CYGWIN) -+if(CMAKE_COMPILER_IS_GNUCC) -+# GCC opts. -+ set(GKlib_COPTIONS "${GKlib_COPTIONS} -std=c99 -fno-strict-aliasing") -+ set(GKlib_COPTIONS "${GKlib_COPTIONS} -march=native") -+ if(NOT MINGW) -+ set(GKlib_COPTIONS "${GKlib_COPTIONS} -fPIC") -+ endif(NOT MINGW) -+# GCC warnings. -+ set(GKlib_COPTIONS "${GKlib_COPTIONS} -Werror -Wall -pedantic -Wno-unused-function -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unknown-pragmas -Wno-unused-label") -+elseif(${CMAKE_C_COMPILER_ID} MATCHES "Sun") -+# Sun insists on -xc99. -+ set(GKlib_COPTIONS "${GKlib_COPTIONS} -xc99") -+endif(CMAKE_COMPILER_IS_GNUCC) -+ -+# Intel compiler -+if(${CMAKE_C_COMPILER_ID} MATCHES "Intel") -+ set(GKlib_COPTIONS "${GKlib_COPTIONS} -xHost -std=c99") -+endif() -+ -+# Find OpenMP if it is requested. -+if(OPENMP) -+ include(FindOpenMP) -+ if(OPENMP_FOUND) -+ set(GKlib_COPTIONS "${GKlib_COPTIONS} -D__OPENMP__ ${OpenMP_C_FLAGS}") -+ else() -+ message(WARNING "OpenMP was requested but support was not found") -+ endif(OPENMP_FOUND) -+endif(OPENMP) -+ -+ -+# Add various definitions. -+if(GDB) -+ set(GKlib_COPTS "${GKlib_COPTS} -g") -+ set(GKlib_COPTIONS "${GKlib_COPTIONS} -Werror") -+else() -+ set(GKlib_COPTS "-O3") -+endif(GDB) -+ -+ -+if(DEBUG) -+ set(GKlib_COPTS "-g") -+ set(GKlib_COPTIONS "${GKlib_COPTIONS} -DDEBUG") -+endif(DEBUG) -+ -+if(GPROF) -+ set(GKlib_COPTS "-pg") -+endif(GPROF) -+ -+if(NOT ASSERT) -+ set(GKlib_COPTIONS "${GKlib_COPTIONS} -DNDEBUG") -+endif(NOT ASSERT) -+ -+if(NOT ASSERT2) -+ set(GKlib_COPTIONS "${GKlib_COPTIONS} -DNDEBUG2") -+endif(NOT ASSERT2) -+ -+ -+# Add various options -+if(PCRE) -+ set(GKlib_COPTIONS "${GKlib_COPTIONS} -D__WITHPCRE__") -+endif(PCRE) -+ -+if(GKREGEX) -+ set(GKlib_COPTIONS "${GKlib_COPTIONS} -DUSE_GKREGEX") -+endif(GKREGEX) -+ -+if(GKRAND) -+ set(GKlib_COPTIONS "${GKlib_COPTIONS} -DUSE_GKRAND") -+endif(GKRAND) -+ -+ -+# Check for features. -+check_include_file(execinfo.h HAVE_EXECINFO_H) -+if(HAVE_EXECINFO_H) -+ set(GKlib_COPTIONS "${GKlib_COPTIONS} -DHAVE_EXECINFO_H") -+endif(HAVE_EXECINFO_H) -+ -+check_function_exists(getline HAVE_GETLINE) -+if(HAVE_GETLINE) -+ set(GKlib_COPTIONS "${GKlib_COPTIONS} -DHAVE_GETLINE") -+endif(HAVE_GETLINE) -+ -+ -+# Custom check for TLS. -+if(MSVC) -+ set(GKlib_COPTIONS "${GKlib_COPTIONS} -D__thread=__declspec(thread)") -+ -+ # This if checks if that value is cached or not. -+ if("${HAVE_THREADLOCALSTORAGE}" MATCHES "^${HAVE_THREADLOCALSTORAGE}$") -+ try_compile(HAVE_THREADLOCALSTORAGE -+ ${CMAKE_BINARY_DIR} -+ ${GKLIB_PATH}/conf/check_thread_storage.c) -+ if(HAVE_THREADLOCALSTORAGE) -+ message(STATUS "checking for thread-local storage - found") -+ else() -+ message(STATUS "checking for thread-local storage - not found") -+ endif() -+ endif() -+ if(NOT HAVE_THREADLOCALSTORAGE) -+ set(GKlib_COPTIONS "${GKlib_COPTIONS} -D__thread=") -+ endif() -+endif() -+ -+# Finally set the official C flags. -+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GKlib_COPTIONS} ${GKlib_COPTS}") -diff --git a/GKlib/conf/check_thread_storage.c b/GKlib/conf/check_thread_storage.c -new file mode 100644 -index 0000000..e6e1e98 ---- /dev/null -+++ b/GKlib/conf/check_thread_storage.c -@@ -0,0 +1,5 @@ -+extern __thread int x; -+ -+int main(int argc, char **argv) { -+ return 0; -+} --- -2.33.1.windows.1 - diff --git a/recipes/metis/all/patches/002-support-pure-cmake.patch b/recipes/metis/all/patches/002-support-pure-cmake.patch deleted file mode 100644 index 7fc0e8b45ccb7..0000000000000 --- a/recipes/metis/all/patches/002-support-pure-cmake.patch +++ /dev/null @@ -1,771 +0,0 @@ -Generate metis.h based on CMake options ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -20,26 +20,28 @@ endif(SHARED) - include(${GKLIB_PATH}/GKlibSystem.cmake) - - # METIS' custom options --#option(IDX64 "enable 64 bit ints" OFF) --#option(REAL64 "enable 64 bit floats (i.e., double)" OFF) --#if(IDX64) --# set(METIS_COPTIONS "${METIS_COPTIONS} -DIDXTYPEWIDTH=64") --#else() --# set(METIS_COPTIONS "${METIS_COPTIONS} -DIDXTYPEWIDTH=32") --#endif(IDX64) --#if(REAL64) --# set(METIS_COPTIONS "${METIS_COPTIONS} -DREALTYPEWIDTH=64") --#else() --# set(METIS_COPTIONS "${METIS_COPTIONS} -DREALTYPEWIDTH=32") --#endif(REAL64) --# --#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${METIS_COPTIONS}") -- -+option(METIS_IDX64 "enable 64 bit ints" OFF) -+option(METIS_REAL64 "enable 64 bit floats (i.e., double)" OFF) -+if (METIS_IDX64) -+ set(METIS_IDXTYPEWIDTH 64) -+else () -+ set(METIS_IDXTYPEWIDTH 32) -+endif () -+if (METIS_REAL64) -+ set(METIS_REALTYPEWIDTH 64) -+else () -+ set(METIS_REALTYPEWIDTH 32) -+endif () - - # Add include directories. - include_directories(${GKLIB_PATH}) --include_directories(build/xinclude) -+configure_file(${PROJECT_SOURCE_DIR}/include/metis.h.in -+ ${PROJECT_BINARY_DIR}/include/metis.h) -+include_directories(${PROJECT_BINARY_DIR}/include) -+if (METIS_INSTALL) -+ install(FILES ${PROJECT_BINARY_DIR}/include/metis.h DESTINATION include) -+endif () -+ - # Recursively look for CMakeLists.txt in subdirs. --add_subdirectory("build/xinclude") - add_subdirectory("libmetis") - add_subdirectory("programs") ---- a/include/metis.h -+++ /dev/null -@@ -1,358 +0,0 @@ --/*! --\file metis.h --\brief This file contains function prototypes and constant definitions for METIS -- * --\author George --\date Started 8/9/02 --\version\verbatim $Id$\endverbatim --*/ -- --#ifndef _METIS_H_ --#define _METIS_H_ -- --/**************************************************************************** --* A set of defines that can be modified by the user --*****************************************************************************/ -- --/*-------------------------------------------------------------------------- -- Specifies the width of the elementary data type that will hold information -- about vertices and their adjacency lists. -- -- Possible values: -- 32 : Use 32 bit signed integers -- 64 : Use 64 bit signed integers -- -- A width of 64 should be specified if the number of vertices or the total -- number of edges in the graph exceed the limits of a 32 bit signed integer -- i.e., 2^31-1. -- Proper use of 64 bit integers requires that the c99 standard datatypes -- int32_t and int64_t are supported by the compiler. -- GCC does provides these definitions in stdint.h, but it may require some -- modifications on other architectures. ----------------------------------------------------------------------------*/ --//#define IDXTYPEWIDTH 32 -- -- --/*-------------------------------------------------------------------------- -- Specifies the data type that will hold floating-point style information. -- -- Possible values: -- 32 : single precission floating point (float) -- 64 : double precission floating point (double) ----------------------------------------------------------------------------*/ --//#define REALTYPEWIDTH 32 -- -- -- --/**************************************************************************** --* In principle, nothing needs to be changed beyond this point, unless the --* int32_t and int64_t cannot be found in the normal places. --*****************************************************************************/ -- --/* Uniform definitions for various compilers */ --#if defined(_MSC_VER) -- #define COMPILER_MSC --#endif --#if defined(__ICC) -- #define COMPILER_ICC --#endif --#if defined(__GNUC__) -- #define COMPILER_GCC --#endif -- --/* Include c99 int definitions and need constants. When building the library, -- * these are already defined by GKlib; hence the test for _GKLIB_H_ */ --#ifndef _GKLIB_H_ --#ifdef COMPILER_MSC --#include -- --typedef __int32 int32_t; --typedef __int64 int64_t; --#define PRId32 "I32d" --#define PRId64 "I64d" --#define SCNd32 "ld" --#define SCNd64 "I64d" --#define INT32_MIN ((int32_t)_I32_MIN) --#define INT32_MAX _I32_MAX --#define INT64_MIN ((int64_t)_I64_MIN) --#define INT64_MAX _I64_MAX --#else --#include --#endif --#endif -- -- --/*------------------------------------------------------------------------ --* Setup the basic datatypes --*-------------------------------------------------------------------------*/ --#if IDXTYPEWIDTH == 32 -- typedef int32_t idx_t; -- -- #define IDX_MAX INT32_MAX -- #define IDX_MIN INT32_MIN -- -- #define SCIDX SCNd32 -- #define PRIDX PRId32 -- -- #define strtoidx strtol -- #define iabs abs --#elif IDXTYPEWIDTH == 64 -- typedef int64_t idx_t; -- -- #define IDX_MAX INT64_MAX -- #define IDX_MIN INT64_MIN -- -- #define SCIDX SCNd64 -- #define PRIDX PRId64 -- --#ifdef COMPILER_MSC -- #define strtoidx _strtoi64 --#else -- #define strtoidx strtoll --#endif -- #define iabs labs --#else -- #error "Incorrect user-supplied value fo IDXTYPEWIDTH" --#endif -- -- --#if REALTYPEWIDTH == 32 -- typedef float real_t; -- -- #define SCREAL "f" -- #define PRREAL "f" -- #define REAL_MAX FLT_MAX -- #define REAL_MIN FLT_MIN -- #define REAL_EPSILON FLT_EPSILON -- -- #define rabs fabsf -- #define REALEQ(x,y) ((rabs((x)-(y)) <= FLT_EPSILON)) -- --#ifdef COMPILER_MSC -- #define strtoreal (float)strtod --#else -- #define strtoreal strtof --#endif --#elif REALTYPEWIDTH == 64 -- typedef double real_t; -- -- #define SCREAL "lf" -- #define PRREAL "lf" -- #define REAL_MAX DBL_MAX -- #define REAL_MIN DBL_MIN -- #define REAL_EPSILON DBL_EPSILON -- -- #define rabs fabs -- #define REALEQ(x,y) ((rabs((x)-(y)) <= DBL_EPSILON)) -- -- #define strtoreal strtod --#else -- #error "Incorrect user-supplied value for REALTYPEWIDTH" --#endif -- -- --/*------------------------------------------------------------------------ --* Constant definitions --*-------------------------------------------------------------------------*/ --/* Metis's version number */ --#define METIS_VER_MAJOR 5 --#define METIS_VER_MINOR 1 --#define METIS_VER_SUBMINOR 0 -- --/* The maximum length of the options[] array */ --#define METIS_NOPTIONS 40 -- -- -- --/*------------------------------------------------------------------------ --* Function prototypes --*-------------------------------------------------------------------------*/ -- --#ifdef _WINDLL --#define METIS_API(type) __declspec(dllexport) type __cdecl --#elif defined(__cdecl) --#define METIS_API(type) type __cdecl --#else --#define METIS_API(type) type --#endif -- -- -- --#ifdef __cplusplus --extern "C" { --#endif -- --METIS_API(int) METIS_PartGraphRecursive(idx_t *nvtxs, idx_t *ncon, idx_t *xadj, -- idx_t *adjncy, idx_t *vwgt, idx_t *vsize, idx_t *adjwgt, -- idx_t *nparts, real_t *tpwgts, real_t *ubvec, idx_t *options, -- idx_t *edgecut, idx_t *part); -- --METIS_API(int) METIS_PartGraphKway(idx_t *nvtxs, idx_t *ncon, idx_t *xadj, -- idx_t *adjncy, idx_t *vwgt, idx_t *vsize, idx_t *adjwgt, -- idx_t *nparts, real_t *tpwgts, real_t *ubvec, idx_t *options, -- idx_t *edgecut, idx_t *part); -- --METIS_API(int) METIS_MeshToDual(idx_t *ne, idx_t *nn, idx_t *eptr, idx_t *eind, -- idx_t *ncommon, idx_t *numflag, idx_t **r_xadj, idx_t **r_adjncy); -- --METIS_API(int) METIS_MeshToNodal(idx_t *ne, idx_t *nn, idx_t *eptr, idx_t *eind, -- idx_t *numflag, idx_t **r_xadj, idx_t **r_adjncy); -- --METIS_API(int) METIS_PartMeshNodal(idx_t *ne, idx_t *nn, idx_t *eptr, idx_t *eind, -- idx_t *vwgt, idx_t *vsize, idx_t *nparts, real_t *tpwgts, -- idx_t *options, idx_t *objval, idx_t *epart, idx_t *npart); -- --METIS_API(int) METIS_PartMeshDual(idx_t *ne, idx_t *nn, idx_t *eptr, idx_t *eind, -- idx_t *vwgt, idx_t *vsize, idx_t *ncommon, idx_t *nparts, -- real_t *tpwgts, idx_t *options, idx_t *objval, idx_t *epart, -- idx_t *npart); -- --METIS_API(int) METIS_NodeND(idx_t *nvtxs, idx_t *xadj, idx_t *adjncy, idx_t *vwgt, -- idx_t *options, idx_t *perm, idx_t *iperm); -- --METIS_API(int) METIS_Free(void *ptr); -- --METIS_API(int) METIS_SetDefaultOptions(idx_t *options); -- -- --/* These functions are used by ParMETIS */ -- --METIS_API(int) METIS_NodeNDP(idx_t nvtxs, idx_t *xadj, idx_t *adjncy, idx_t *vwgt, -- idx_t npes, idx_t *options, idx_t *perm, idx_t *iperm, -- idx_t *sizes); -- --METIS_API(int) METIS_ComputeVertexSeparator(idx_t *nvtxs, idx_t *xadj, idx_t *adjncy, -- idx_t *vwgt, idx_t *options, idx_t *sepsize, idx_t *part); -- --METIS_API(int) METIS_NodeRefine(idx_t nvtxs, idx_t *xadj, idx_t *vwgt, idx_t *adjncy, -- idx_t *where, idx_t *hmarker, real_t ubfactor); -- -- --/* These functions are used by DGL */ -- --METIS_API(int) METIS_CacheFriendlyReordering(idx_t nvtxs, idx_t *xadj, idx_t *adjncy, -- idx_t *part, idx_t *old2new); -- --#ifdef __cplusplus --} --#endif -- -- -- --/*------------------------------------------------------------------------ --* Enum type definitions --*-------------------------------------------------------------------------*/ --/*! Return codes */ --typedef enum { -- METIS_OK = 1, /*!< Returned normally */ -- METIS_ERROR_INPUT = -2, /*!< Returned due to erroneous inputs and/or options */ -- METIS_ERROR_MEMORY = -3, /*!< Returned due to insufficient memory */ -- METIS_ERROR = -4 /*!< Some other errors */ --} rstatus_et; -- -- --/*! Operation type codes */ --typedef enum { -- METIS_OP_PMETIS, -- METIS_OP_KMETIS, -- METIS_OP_OMETIS --} moptype_et; -- -- --/*! Options codes (i.e., options[]) */ --typedef enum { -- METIS_OPTION_PTYPE, -- METIS_OPTION_OBJTYPE, -- METIS_OPTION_CTYPE, -- METIS_OPTION_IPTYPE, -- METIS_OPTION_RTYPE, -- METIS_OPTION_DBGLVL, -- METIS_OPTION_NIPARTS, -- METIS_OPTION_NITER, -- METIS_OPTION_NCUTS, -- METIS_OPTION_SEED, -- METIS_OPTION_NO2HOP, -- METIS_OPTION_ONDISK, -- METIS_OPTION_MINCONN, -- METIS_OPTION_CONTIG, -- METIS_OPTION_COMPRESS, -- METIS_OPTION_CCORDER, -- METIS_OPTION_PFACTOR, -- METIS_OPTION_NSEPS, -- METIS_OPTION_UFACTOR, -- METIS_OPTION_NUMBERING, -- METIS_OPTION_DROPEDGES, -- -- /* Used for command-line parameter purposes */ -- METIS_OPTION_HELP, -- METIS_OPTION_TPWGTS, -- METIS_OPTION_NCOMMON, -- METIS_OPTION_NOOUTPUT, -- METIS_OPTION_BALANCE, -- METIS_OPTION_GTYPE, -- METIS_OPTION_UBVEC --} moptions_et; -- -- --/*! Partitioning Schemes */ --typedef enum { -- METIS_PTYPE_RB, -- METIS_PTYPE_KWAY --} mptype_et; -- --/*! Graph types for meshes */ --typedef enum { -- METIS_GTYPE_DUAL, -- METIS_GTYPE_NODAL --} mgtype_et; -- --/*! Coarsening Schemes */ --typedef enum { -- METIS_CTYPE_RM, -- METIS_CTYPE_SHEM --} mctype_et; -- --/*! Initial partitioning schemes */ --typedef enum { -- METIS_IPTYPE_GROW, -- METIS_IPTYPE_RANDOM, -- METIS_IPTYPE_EDGE, -- METIS_IPTYPE_NODE, -- METIS_IPTYPE_METISRB --} miptype_et; -- -- --/*! Refinement schemes */ --typedef enum { -- METIS_RTYPE_FM, -- METIS_RTYPE_GREEDY, -- METIS_RTYPE_SEP2SIDED, -- METIS_RTYPE_SEP1SIDED --} mrtype_et; -- -- --/*! Debug Levels */ --typedef enum { -- METIS_DBG_INFO = 1, /*!< Shows various diagnostic messages */ -- METIS_DBG_TIME = 2, /*!< Perform timing analysis */ -- METIS_DBG_COARSEN = 4, /*!< Show the coarsening progress */ -- METIS_DBG_REFINE = 8, /*!< Show the refinement progress */ -- METIS_DBG_IPART = 16, /*!< Show info on initial partitioning */ -- METIS_DBG_MOVEINFO = 32, /*!< Show info on vertex moves during refinement */ -- METIS_DBG_SEPINFO = 64, /*!< Show info on vertex moves during sep refinement */ -- METIS_DBG_CONNINFO = 128, /*!< Show info on minimization of subdomain connectivity */ -- METIS_DBG_CONTIGINFO = 256, /*!< Show info on elimination of connected components */ -- METIS_DBG_MEMORY = 2048, /*!< Show info related to wspace allocation */ --} mdbglvl_et; -- -- --/* Types of objectives */ --typedef enum { -- METIS_OBJTYPE_CUT, -- METIS_OBJTYPE_VOL, -- METIS_OBJTYPE_NODE --} mobjtype_et; -- -- -- --#endif /* _METIS_H_ */ ---- /dev/null -+++ b/include/metis.h.in -@@ -0,0 +1,358 @@ -+/*! -+\file metis.h -+\brief This file contains function prototypes and constant definitions for METIS -+ * -+\author George -+\date Started 8/9/02 -+\version\verbatim $Id$\endverbatim -+*/ -+ -+#ifndef _METIS_H_ -+#define _METIS_H_ -+ -+/**************************************************************************** -+* A set of defines that can be modified by the user -+*****************************************************************************/ -+ -+/*-------------------------------------------------------------------------- -+ Specifies the width of the elementary data type that will hold information -+ about vertices and their adjacency lists. -+ -+ Possible values: -+ 32 : Use 32 bit signed integers -+ 64 : Use 64 bit signed integers -+ -+ A width of 64 should be specified if the number of vertices or the total -+ number of edges in the graph exceed the limits of a 32 bit signed integer -+ i.e., 2^31-1. -+ Proper use of 64 bit integers requires that the c99 standard datatypes -+ int32_t and int64_t are supported by the compiler. -+ GCC does provides these definitions in stdint.h, but it may require some -+ modifications on other architectures. -+--------------------------------------------------------------------------*/ -+#define IDXTYPEWIDTH @METIS_IDXTYPEWIDTH@ -+ -+ -+/*-------------------------------------------------------------------------- -+ Specifies the data type that will hold floating-point style information. -+ -+ Possible values: -+ 32 : single precission floating point (float) -+ 64 : double precission floating point (double) -+--------------------------------------------------------------------------*/ -+#define REALTYPEWIDTH @METIS_REALTYPEWIDTH@ -+ -+ -+ -+/**************************************************************************** -+* In principle, nothing needs to be changed beyond this point, unless the -+* int32_t and int64_t cannot be found in the normal places. -+*****************************************************************************/ -+ -+/* Uniform definitions for various compilers */ -+#if defined(_MSC_VER) -+ #define COMPILER_MSC -+#endif -+#if defined(__ICC) -+ #define COMPILER_ICC -+#endif -+#if defined(__GNUC__) -+ #define COMPILER_GCC -+#endif -+ -+/* Include c99 int definitions and need constants. When building the library, -+ * these are already defined by GKlib; hence the test for _GKLIB_H_ */ -+#ifndef _GKLIB_H_ -+#ifdef COMPILER_MSC -+#include -+ -+typedef __int32 int32_t; -+typedef __int64 int64_t; -+#define PRId32 "I32d" -+#define PRId64 "I64d" -+#define SCNd32 "ld" -+#define SCNd64 "I64d" -+#define INT32_MIN ((int32_t)_I32_MIN) -+#define INT32_MAX _I32_MAX -+#define INT64_MIN ((int64_t)_I64_MIN) -+#define INT64_MAX _I64_MAX -+#else -+#include -+#endif -+#endif -+ -+ -+/*------------------------------------------------------------------------ -+* Setup the basic datatypes -+*-------------------------------------------------------------------------*/ -+#if IDXTYPEWIDTH == 32 -+ typedef int32_t idx_t; -+ -+ #define IDX_MAX INT32_MAX -+ #define IDX_MIN INT32_MIN -+ -+ #define SCIDX SCNd32 -+ #define PRIDX PRId32 -+ -+ #define strtoidx strtol -+ #define iabs abs -+#elif IDXTYPEWIDTH == 64 -+ typedef int64_t idx_t; -+ -+ #define IDX_MAX INT64_MAX -+ #define IDX_MIN INT64_MIN -+ -+ #define SCIDX SCNd64 -+ #define PRIDX PRId64 -+ -+#ifdef COMPILER_MSC -+ #define strtoidx _strtoi64 -+#else -+ #define strtoidx strtoll -+#endif -+ #define iabs labs -+#else -+ #error "Incorrect user-supplied value fo IDXTYPEWIDTH" -+#endif -+ -+ -+#if REALTYPEWIDTH == 32 -+ typedef float real_t; -+ -+ #define SCREAL "f" -+ #define PRREAL "f" -+ #define REAL_MAX FLT_MAX -+ #define REAL_MIN FLT_MIN -+ #define REAL_EPSILON FLT_EPSILON -+ -+ #define rabs fabsf -+ #define REALEQ(x,y) ((rabs((x)-(y)) <= FLT_EPSILON)) -+ -+#ifdef COMPILER_MSC -+ #define strtoreal (float)strtod -+#else -+ #define strtoreal strtof -+#endif -+#elif REALTYPEWIDTH == 64 -+ typedef double real_t; -+ -+ #define SCREAL "lf" -+ #define PRREAL "lf" -+ #define REAL_MAX DBL_MAX -+ #define REAL_MIN DBL_MIN -+ #define REAL_EPSILON DBL_EPSILON -+ -+ #define rabs fabs -+ #define REALEQ(x,y) ((rabs((x)-(y)) <= DBL_EPSILON)) -+ -+ #define strtoreal strtod -+#else -+ #error "Incorrect user-supplied value for REALTYPEWIDTH" -+#endif -+ -+ -+/*------------------------------------------------------------------------ -+* Constant definitions -+*-------------------------------------------------------------------------*/ -+/* Metis's version number */ -+#define METIS_VER_MAJOR 5 -+#define METIS_VER_MINOR 1 -+#define METIS_VER_SUBMINOR 0 -+ -+/* The maximum length of the options[] array */ -+#define METIS_NOPTIONS 40 -+ -+ -+ -+/*------------------------------------------------------------------------ -+* Function prototypes -+*-------------------------------------------------------------------------*/ -+ -+#ifdef _WINDLL -+#define METIS_API(type) __declspec(dllexport) type __cdecl -+#elif defined(__cdecl) -+#define METIS_API(type) type __cdecl -+#else -+#define METIS_API(type) type -+#endif -+ -+ -+ -+#ifdef __cplusplus -+extern "C" { -+#endif -+ -+METIS_API(int) METIS_PartGraphRecursive(idx_t *nvtxs, idx_t *ncon, idx_t *xadj, -+ idx_t *adjncy, idx_t *vwgt, idx_t *vsize, idx_t *adjwgt, -+ idx_t *nparts, real_t *tpwgts, real_t *ubvec, idx_t *options, -+ idx_t *edgecut, idx_t *part); -+ -+METIS_API(int) METIS_PartGraphKway(idx_t *nvtxs, idx_t *ncon, idx_t *xadj, -+ idx_t *adjncy, idx_t *vwgt, idx_t *vsize, idx_t *adjwgt, -+ idx_t *nparts, real_t *tpwgts, real_t *ubvec, idx_t *options, -+ idx_t *edgecut, idx_t *part); -+ -+METIS_API(int) METIS_MeshToDual(idx_t *ne, idx_t *nn, idx_t *eptr, idx_t *eind, -+ idx_t *ncommon, idx_t *numflag, idx_t **r_xadj, idx_t **r_adjncy); -+ -+METIS_API(int) METIS_MeshToNodal(idx_t *ne, idx_t *nn, idx_t *eptr, idx_t *eind, -+ idx_t *numflag, idx_t **r_xadj, idx_t **r_adjncy); -+ -+METIS_API(int) METIS_PartMeshNodal(idx_t *ne, idx_t *nn, idx_t *eptr, idx_t *eind, -+ idx_t *vwgt, idx_t *vsize, idx_t *nparts, real_t *tpwgts, -+ idx_t *options, idx_t *objval, idx_t *epart, idx_t *npart); -+ -+METIS_API(int) METIS_PartMeshDual(idx_t *ne, idx_t *nn, idx_t *eptr, idx_t *eind, -+ idx_t *vwgt, idx_t *vsize, idx_t *ncommon, idx_t *nparts, -+ real_t *tpwgts, idx_t *options, idx_t *objval, idx_t *epart, -+ idx_t *npart); -+ -+METIS_API(int) METIS_NodeND(idx_t *nvtxs, idx_t *xadj, idx_t *adjncy, idx_t *vwgt, -+ idx_t *options, idx_t *perm, idx_t *iperm); -+ -+METIS_API(int) METIS_Free(void *ptr); -+ -+METIS_API(int) METIS_SetDefaultOptions(idx_t *options); -+ -+ -+/* These functions are used by ParMETIS */ -+ -+METIS_API(int) METIS_NodeNDP(idx_t nvtxs, idx_t *xadj, idx_t *adjncy, idx_t *vwgt, -+ idx_t npes, idx_t *options, idx_t *perm, idx_t *iperm, -+ idx_t *sizes); -+ -+METIS_API(int) METIS_ComputeVertexSeparator(idx_t *nvtxs, idx_t *xadj, idx_t *adjncy, -+ idx_t *vwgt, idx_t *options, idx_t *sepsize, idx_t *part); -+ -+METIS_API(int) METIS_NodeRefine(idx_t nvtxs, idx_t *xadj, idx_t *vwgt, idx_t *adjncy, -+ idx_t *where, idx_t *hmarker, real_t ubfactor); -+ -+ -+/* These functions are used by DGL */ -+ -+METIS_API(int) METIS_CacheFriendlyReordering(idx_t nvtxs, idx_t *xadj, idx_t *adjncy, -+ idx_t *part, idx_t *old2new); -+ -+#ifdef __cplusplus -+} -+#endif -+ -+ -+ -+/*------------------------------------------------------------------------ -+* Enum type definitions -+*-------------------------------------------------------------------------*/ -+/*! Return codes */ -+typedef enum { -+ METIS_OK = 1, /*!< Returned normally */ -+ METIS_ERROR_INPUT = -2, /*!< Returned due to erroneous inputs and/or options */ -+ METIS_ERROR_MEMORY = -3, /*!< Returned due to insufficient memory */ -+ METIS_ERROR = -4 /*!< Some other errors */ -+} rstatus_et; -+ -+ -+/*! Operation type codes */ -+typedef enum { -+ METIS_OP_PMETIS, -+ METIS_OP_KMETIS, -+ METIS_OP_OMETIS -+} moptype_et; -+ -+ -+/*! Options codes (i.e., options[]) */ -+typedef enum { -+ METIS_OPTION_PTYPE, -+ METIS_OPTION_OBJTYPE, -+ METIS_OPTION_CTYPE, -+ METIS_OPTION_IPTYPE, -+ METIS_OPTION_RTYPE, -+ METIS_OPTION_DBGLVL, -+ METIS_OPTION_NIPARTS, -+ METIS_OPTION_NITER, -+ METIS_OPTION_NCUTS, -+ METIS_OPTION_SEED, -+ METIS_OPTION_NO2HOP, -+ METIS_OPTION_ONDISK, -+ METIS_OPTION_MINCONN, -+ METIS_OPTION_CONTIG, -+ METIS_OPTION_COMPRESS, -+ METIS_OPTION_CCORDER, -+ METIS_OPTION_PFACTOR, -+ METIS_OPTION_NSEPS, -+ METIS_OPTION_UFACTOR, -+ METIS_OPTION_NUMBERING, -+ METIS_OPTION_DROPEDGES, -+ -+ /* Used for command-line parameter purposes */ -+ METIS_OPTION_HELP, -+ METIS_OPTION_TPWGTS, -+ METIS_OPTION_NCOMMON, -+ METIS_OPTION_NOOUTPUT, -+ METIS_OPTION_BALANCE, -+ METIS_OPTION_GTYPE, -+ METIS_OPTION_UBVEC -+} moptions_et; -+ -+ -+/*! Partitioning Schemes */ -+typedef enum { -+ METIS_PTYPE_RB, -+ METIS_PTYPE_KWAY -+} mptype_et; -+ -+/*! Graph types for meshes */ -+typedef enum { -+ METIS_GTYPE_DUAL, -+ METIS_GTYPE_NODAL -+} mgtype_et; -+ -+/*! Coarsening Schemes */ -+typedef enum { -+ METIS_CTYPE_RM, -+ METIS_CTYPE_SHEM -+} mctype_et; -+ -+/*! Initial partitioning schemes */ -+typedef enum { -+ METIS_IPTYPE_GROW, -+ METIS_IPTYPE_RANDOM, -+ METIS_IPTYPE_EDGE, -+ METIS_IPTYPE_NODE, -+ METIS_IPTYPE_METISRB -+} miptype_et; -+ -+ -+/*! Refinement schemes */ -+typedef enum { -+ METIS_RTYPE_FM, -+ METIS_RTYPE_GREEDY, -+ METIS_RTYPE_SEP2SIDED, -+ METIS_RTYPE_SEP1SIDED -+} mrtype_et; -+ -+ -+/*! Debug Levels */ -+typedef enum { -+ METIS_DBG_INFO = 1, /*!< Shows various diagnostic messages */ -+ METIS_DBG_TIME = 2, /*!< Perform timing analysis */ -+ METIS_DBG_COARSEN = 4, /*!< Show the coarsening progress */ -+ METIS_DBG_REFINE = 8, /*!< Show the refinement progress */ -+ METIS_DBG_IPART = 16, /*!< Show info on initial partitioning */ -+ METIS_DBG_MOVEINFO = 32, /*!< Show info on vertex moves during refinement */ -+ METIS_DBG_SEPINFO = 64, /*!< Show info on vertex moves during sep refinement */ -+ METIS_DBG_CONNINFO = 128, /*!< Show info on minimization of subdomain connectivity */ -+ METIS_DBG_CONTIGINFO = 256, /*!< Show info on elimination of connected components */ -+ METIS_DBG_MEMORY = 2048, /*!< Show info related to wspace allocation */ -+} mdbglvl_et; -+ -+ -+/* Types of objectives */ -+typedef enum { -+ METIS_OBJTYPE_CUT, -+ METIS_OBJTYPE_VOL, -+ METIS_OBJTYPE_NODE -+} mobjtype_et; -+ -+ -+ -+#endif /* _METIS_H_ */ diff --git a/recipes/metis/all/patches/003-remove-programs.patch b/recipes/metis/all/patches/003-remove-programs.patch deleted file mode 100644 index 73a59f03ddbac..0000000000000 --- a/recipes/metis/all/patches/003-remove-programs.patch +++ /dev/null @@ -1,8 +0,0 @@ -Do not build programs ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -44,4 +44,3 @@ endif () - - # Recursively look for CMakeLists.txt in subdirs. - add_subdirectory("libmetis") --add_subdirectory("programs") diff --git a/recipes/metis/all/patches/004-use-conan-gklib.patch b/recipes/metis/all/patches/004-use-conan-gklib.patch deleted file mode 100644 index 60a824f3c58d1..0000000000000 --- a/recipes/metis/all/patches/004-use-conan-gklib.patch +++ /dev/null @@ -1,17 +0,0 @@ -find gklib from conan ---- a/libmetis/CMakeLists.txt -+++ b/libmetis/CMakeLists.txt -@@ -3,9 +3,11 @@ include_directories(.) - # Find sources. - file(GLOB metis_sources *.c) - # Build libmetis. --add_library(metis ${METIS_LIBRARY_TYPE} ${GKlib_sources} ${metis_sources}) -+add_library(metis ${METIS_LIBRARY_TYPE} ${metis_sources}) -+find_package(gklib REQUIRED) -+target_link_libraries(metis PRIVATE gklib::gklib) - if(UNIX) -- target_link_libraries(metis m) -+ target_link_libraries(metis PRIVATE m) - endif() - - if(METIS_INSTALL) diff --git a/recipes/metis/all/patches/005-fix-install.patch b/recipes/metis/all/patches/005-fix-install.patch deleted file mode 100644 index 0ddb28f482535..0000000000000 --- a/recipes/metis/all/patches/005-fix-install.patch +++ /dev/null @@ -1,28 +0,0 @@ -Always install and fix runtime destination ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -4,11 +4,7 @@ project(METIS C) - set(GKLIB_PATH "${CMAKE_SOURCE_DIR}/GKlib" CACHE PATH "path to GKlib") - set(SHARED FALSE CACHE BOOL "build a shared library") - --if(MSVC) -- set(METIS_INSTALL FALSE) --else() -- set(METIS_INSTALL TRUE) --endif() -+set(METIS_INSTALL TRUE) - - # Configure libmetis library. - if(SHARED) -diff --git a/libmetis/CMakeLists.txt b/libmetis/CMakeLists.txt -index b577360..e9c7825 100644 ---- a/libmetis/CMakeLists.txt -+++ b/libmetis/CMakeLists.txt -@@ -13,6 +13,6 @@ endif() - if(METIS_INSTALL) - install(TARGETS metis - LIBRARY DESTINATION lib -- RUNTIME DESTINATION lib -+ RUNTIME DESTINATION bin - ARCHIVE DESTINATION lib) - endif() diff --git a/recipes/metis/all/patches/5.1.1-001-fix-coarse-graph-memory-bugs.patch b/recipes/metis/all/patches/5.1.1-001-fix-coarse-graph-memory-bugs.patch new file mode 100644 index 0000000000000..d1640f063425d --- /dev/null +++ b/recipes/metis/all/patches/5.1.1-001-fix-coarse-graph-memory-bugs.patch @@ -0,0 +1,246 @@ +From 36262adecaa9720a4417a67124428061c367fd3f Mon Sep 17 00:00:00 2001 +From: George Karypis +Date: Fri, 27 Nov 2020 23:17:52 +0000 +Subject: [PATCH] fixed a memory bug that appears when the coarser graph stayed + the same size as the original graph + +diff --git a/libmetis/coarsen.c b/libmetis/coarsen.c +--- a/libmetis/coarsen.c ++++ b/libmetis/coarsen.c +@@ -629,7 +629,7 @@ + idx_t *xadj, *vwgt, *adjncy, *adjwgt, *maxvwgt; + idx_t *match, *cmap, *degrees, *perm, *tperm, *vec, *marker; + idx_t mytwgt, xtwgt, ctwgt; +- float bscore, score; ++ real_t bscore, score; + + WCOREPUSH; + +@@ -817,6 +817,7 @@ + printf(" ]\n"); + } + ++#if 0 + + /*************************************************************************/ + /*! This function creates the coarser graph. It uses a simple hash-table +@@ -1327,6 +1328,7 @@ + WCOREPOP; + } + ++#endif + + /*************************************************************************/ + /*! This function creates the coarser graph. Depending on the size of the +@@ -1340,11 +1342,11 @@ + idx_t j, jj, k, kk, l, m, istart, iend, nvtxs, nedges, ncon, + cnedges, v, u, mask; + idx_t *xadj, *vwgt, *vsize, *adjncy, *adjwgt; +- idx_t *cmap, *htable, *table; ++ idx_t *cmap, *htable, *dtable; + idx_t *cxadj, *cvwgt, *cvsize, *cadjncy, *cadjwgt; + graph_t *cgraph; + int dovsize, dropedges; +- idx_t cv, nkeep, droppedewgt; ++ idx_t cv, nkeys, droppedewgt; + idx_t *keys=NULL, *medianewgts=NULL, *noise=NULL; + + WCOREPUSH; +@@ -1367,12 +1369,13 @@ + + /* Setup structures for dropedges */ + if (dropedges) { +- for (nkeep=-1, v=0; vadjncy; + cadjwgt = cgraph->adjwgt; + +- htable = iset(gk_min(cnvtxs+1, mask+1), -1, iwspacemalloc(ctrl, mask+1)); +- table = iset(cnvtxs, -1, iwspacemalloc(ctrl, cnvtxs)); ++ htable = iset(mask+1, -1, iwspacemalloc(ctrl, mask+1)); /* hash table */ ++ dtable = iset(cnvtxs, -1, iwspacemalloc(ctrl, cnvtxs)); /* direct table */ + + cxadj[0] = cnvtxs = cnedges = 0; + for (v=0; v=0; j--) { + k = cadjncy[j]; +- for (kk=k&mask; cadjncy[htable[kk]]!=k; kk=((kk+1)%mask)); ++ for (kk=k&mask; cadjncy[htable[kk]]!=k; kk=((kk+1)&mask)); + htable[kk] = -1; + } + +@@ -1474,10 +1478,10 @@ + iend = xadj[v+1]; + for (j=istart; j= min(medianewgts[u], medianewgts[v]) */ + if (dropedges) { +- for (j=0; j>1)]; ++ ASSERTP(nedges < nkeys, ("%"PRIDX", %"PRIDX"\n", nkeys, nedges)); ++ medianewgts[cnvtxs] = 8; /* default for island nodes */ ++ if (nedges > 0) { ++ for (j=0; j>1))]; ++ } + } + + cadjncy += nedges; +@@ -1542,6 +1550,8 @@ + iend = cxadj[u+1]; + for (j=istart; j= 0, ("%"PRIDX" %"PRIDX"\n", u, medianewgts[u])); ++ ASSERTP(medianewgts[v] >= 0, ("%"PRIDX" %"PRIDX" %"PRIDX"\n", v, medianewgts[v], cnvtxs)); + if ((cadjwgt[j]<<8) + noise[u] + noise[v] >= gk_min(medianewgts[u], medianewgts[v])) { + cadjncy[cnedges] = cadjncy[j]; + cadjwgt[cnedges++] = cadjwgt[j]; +@@ -1573,6 +1583,7 @@ + WCOREPOP; + } + ++#if 0 + + /*************************************************************************/ + /*! This function creates the coarser graph. It uses a full-size array +@@ -1925,6 +1936,7 @@ + WCOREPOP; + } + ++#endif + + /*************************************************************************/ + /*! Setup the various arrays for the coarse graph +@@ -1942,10 +1954,14 @@ + cgraph->finer = graph; + graph->coarser = cgraph; + +- /* Allocate memory for the coarser graph */ ++ /* Allocate memory for the coarser graph. ++ NOTE: The +1 in the adjwgt/adjncy is to allow the optimization of self-loop ++ detection by adding ahead of time the self-loop. That optimization ++ requires a +1 adjncy/adjwgt array for the limit case where the ++ coarser graph is of the same size of the previous graph. */ + cgraph->xadj = imalloc(cnvtxs+1, "SetupCoarseGraph: xadj"); +- cgraph->adjncy = imalloc(graph->nedges, "SetupCoarseGraph: adjncy"); +- cgraph->adjwgt = imalloc(graph->nedges, "SetupCoarseGraph: adjwgt"); ++ cgraph->adjncy = imalloc(graph->nedges+1, "SetupCoarseGraph: adjncy"); ++ cgraph->adjwgt = imalloc(graph->nedges+1, "SetupCoarseGraph: adjwgt"); + cgraph->vwgt = imalloc(cgraph->ncon*cnvtxs, "SetupCoarseGraph: vwgt"); + cgraph->tvwgt = imalloc(cgraph->ncon, "SetupCoarseGraph: tvwgt"); + cgraph->invtvwgt = rmalloc(cgraph->ncon, "SetupCoarseGraph: invtvwgt"); +diff --git a/libmetis/proto.h b/libmetis/proto.h +--- a/libmetis/proto.h ++++ b/libmetis/proto.h +@@ -51,10 +51,6 @@ + void PrintCGraphStats(ctrl_t *ctrl, graph_t *graph); + void CreateCoarseGraph(ctrl_t *ctrl, graph_t *graph, idx_t cnvtxs, + idx_t *match); +-void CreateCoarseGraphNoMask(ctrl_t *ctrl, graph_t *graph, idx_t cnvtxs, +- idx_t *match); +-void CreateCoarseGraphPerm(ctrl_t *ctrl, graph_t *graph, idx_t cnvtxs, +- idx_t *match, idx_t *perm); + graph_t *SetupCoarseGraph(graph_t *graph, idx_t cnvtxs, int dovsize); + void ReAdjustMemory(ctrl_t *ctrl, graph_t *graph, graph_t *cgraph); + +diff --git a/libmetis/rename.h b/libmetis/rename.h +--- a/libmetis/rename.h ++++ b/libmetis/rename.h +@@ -41,8 +41,6 @@ + #define Match_JC libmetis__Match_JC + #define PrintCGraphStats libmetis__PrintCGraphStats + #define CreateCoarseGraph libmetis__CreateCoarseGraph +-#define CreateCoarseGraphNoMask libmetis__CreateCoarseGraphNoMask +-#define CreateCoarseGraphPerm libmetis__CreateCoarseGraphPerm + #define SetupCoarseGraph libmetis__SetupCoarseGraph + #define ReAdjustMemory libmetis__ReAdjustMemory + diff --git a/recipes/metis/all/patches/5.1.1-002-fix-out-out-of-bounds-errors.patch b/recipes/metis/all/patches/5.1.1-002-fix-out-out-of-bounds-errors.patch new file mode 100644 index 0000000000000..2e67aa23bc3a8 --- /dev/null +++ b/recipes/metis/all/patches/5.1.1-002-fix-out-out-of-bounds-errors.patch @@ -0,0 +1,199 @@ +Fix out out-of-bounds memory errors + +Squashed commits: +- Avoid out-of-bound memory access for empty graphs +- Fixed incorrect part[] vector when nparts == 1 +- issue #46: fixed the out-of-bound with mdeg+delta + +diff --git a/libmetis/checkgraph.c b/libmetis/checkgraph.c +--- a/libmetis/checkgraph.c ++++ b/libmetis/checkgraph.c +@@ -45,9 +45,11 @@ + + htable = ismalloc(nvtxs, 0, "htable"); + +- minedge = maxedge = adjncy[0]; +- if (adjwgt) +- minewgt = maxewgt = adjwgt[0]; ++ if (graph->nedges > 0) { ++ minedge = maxedge = adjncy[0]; ++ if (adjwgt) ++ minewgt = maxewgt = adjwgt[0]; ++ } + + for (i=0; idbglvl, METIS_DBG_TIME, InitTimers(ctrl)); + IFSET(ctrl->dbglvl, METIS_DBG_TIME, gk_startcputimer(ctrl->TotalTmr)); + +- if (ctrl->dbglvl&512) { +- *objval = BlockKWayPartitioning(ctrl, graph, part); +- } +- else { +- *objval = MlevelKWayPartitioning(ctrl, graph, part); +- } ++ iset(*nvtxs, 0, part); ++ if (ctrl->dbglvl&512) ++ *objval = (*nparts == 1 ? 0 : BlockKWayPartitioning(ctrl, graph, part)); ++ else ++ *objval = (*nparts == 1 ? 0 : MlevelKWayPartitioning(ctrl, graph, part)); + + IFSET(ctrl->dbglvl, METIS_DBG_TIME, gk_stopcputimer(ctrl->TotalTmr)); + IFSET(ctrl->dbglvl, METIS_DBG_TIME, PrintTimers(ctrl)); +diff --git a/libmetis/mmd.c b/libmetis/mmd.c +--- a/libmetis/mmd.c ++++ b/libmetis/mmd.c +@@ -59,24 +59,24 @@ + if (neqns <= 0) + return; + +- /* Adjust from C to Fortran */ ++ /* adjust from C to Fortran */ + xadj--; adjncy--; invp--; perm--; head--; qsize--; list--; marker--; + +- /* initialization for the minimum degree algorithm. */ ++ /* initialization for the minimum degree algorithm */ + *ncsub = 0; + mmdint(neqns, xadj, adjncy, head, invp, perm, qsize, list, marker); + +- /* 'num' counts the number of ordered nodes plus 1. */ ++ /* 'num' counts the number of ordered nodes plus 1 */ + num = 1; + +- /* eliminate all isolated nodes. */ ++ /* eliminate all isolated nodes */ + nextmd = head[1]; + while (nextmd > 0) { + mdeg_node = nextmd; + nextmd = invp[mdeg_node]; + marker[mdeg_node] = maxint; + invp[mdeg_node] = -num; +- num = num + 1; ++ num++; + } + + /* search for node of the minimum degree. 'mdeg' is the current */ +@@ -87,14 +87,16 @@ + head[1] = 0; + mdeg = 2; + +- /* infinite loop here ! */ ++ /* infinite loop here */ + while (1) { + while (head[mdeg] <= 0) + mdeg++; + + /* use value of 'delta' to set up 'mdlmt', which governs */ + /* when a degree update is to be performed. */ +- mdlmt = mdeg + delta; ++ //mdlmt = mdeg + delta; ++ // the need for gk_min() was identified by jsf67 ++ mdlmt = gk_min(neqns, mdeg+delta); + ehead = 0; + + n500: +@@ -107,7 +109,7 @@ + mdeg_node = head[mdeg]; + }; + +- /* remove 'mdeg_node' from the degree structure. */ ++ /* remove 'mdeg_node' from the degree structure */ + nextmd = invp[mdeg_node]; + head[mdeg] = nextmd; + if (nextmd > 0) +@@ -140,7 +142,7 @@ + /* minimum degree nodes elimination. */ + if (num > neqns) + goto n1000; +- mmdupd( ehead, neqns, xadj, adjncy, delta, &mdeg, head, invp, perm, qsize, list, marker, maxint, &tag); ++ mmdupd(ehead, neqns, xadj, adjncy, delta, &mdeg, head, invp, perm, qsize, list, marker, maxint, &tag); + }; /* end of -- while ( 1 ) -- */ + + n1000: +@@ -289,6 +291,7 @@ + return; + } + ++ + /*************************************************************************** + * mmdint ---- mult minimum degree initialization + * purpose -- this routine performs initialization for the +@@ -305,33 +308,30 @@ + idx_t mmdint(idx_t neqns, idx_t *xadj, idx_t *adjncy, idx_t *head, idx_t *forward, + idx_t *backward, idx_t *qsize, idx_t *list, idx_t *marker) + { +- idx_t fnode, ndeg, node; ++ idx_t fnode, ndeg, node; + +- for ( node = 1; node <= neqns; node++ ) { +- head[node] = 0; +- qsize[node] = 1; +- marker[node] = 0; +- list[node] = 0; +- }; ++ for (node=1; node<=neqns; node++) { ++ head[node] = 0; ++ qsize[node] = 1; ++ marker[node] = 0; ++ list[node] = 0; ++ }; + +- /* initialize the degree doubly linked lists. */ +- for ( node = 1; node <= neqns; node++ ) { +- // The following is something that Olaf Schenk identified as potentially a +- // bug that I introduced in the original code. For now, I reverted back +- // to the original code until I have some time to check. +- // ndeg = xadj[node+1] - xadj[node]/* + 1*/; /* george */ +- ndeg = xadj[node+1] - xadj[node] + 1; +- if (ndeg == 0) +- ndeg = 1; +- fnode = head[ndeg]; +- forward[node] = fnode; +- head[ndeg] = node; +- if ( fnode > 0 ) backward[fnode] = node; +- backward[node] = -ndeg; +- }; +- return 0; ++ /* initialize the degree doubly linked lists. */ ++ for (node=1; node<=neqns; node++) { ++ ndeg = xadj[node+1]-xadj[node]+1; ++ fnode = head[ndeg]; ++ forward[node] = fnode; ++ head[ndeg] = node; ++ if (fnode > 0) ++ backward[fnode] = node; ++ backward[node] = -ndeg; ++ }; ++ ++ return 0; + } + ++ + /**************************************************************************** + * mmdnum --- multi minimum degree numbering + * purpose -- this routine performs the final step in producing +@@ -395,6 +395,7 @@ + return; + } + ++ + /**************************************************************************** + * mmdupd ---- multiple minimum degree update + * purpose -- this routine updates the degrees of nodes after a +diff --git a/libmetis/pmetis.c b/libmetis/pmetis.c +--- a/libmetis/pmetis.c ++++ b/libmetis/pmetis.c +@@ -130,7 +130,8 @@ + IFSET(ctrl->dbglvl, METIS_DBG_TIME, InitTimers(ctrl)); + IFSET(ctrl->dbglvl, METIS_DBG_TIME, gk_startcputimer(ctrl->TotalTmr)); + +- *objval = MlevelRecursiveBisection(ctrl, graph, *nparts, part, ctrl->tpwgts, 0); ++ iset(*nvtxs, 0, part); ++ *objval = (*nparts == 1 ? 0 : MlevelRecursiveBisection(ctrl, graph, *nparts, part, ctrl->tpwgts, 0)); + + IFSET(ctrl->dbglvl, METIS_DBG_TIME, gk_stopcputimer(ctrl->TotalTmr)); + IFSET(ctrl->dbglvl, METIS_DBG_TIME, PrintTimers(ctrl)); diff --git a/recipes/metis/all/patches/5.1.1-003-reduce-maximum-memory-use.patch b/recipes/metis/all/patches/5.1.1-003-reduce-maximum-memory-use.patch new file mode 100644 index 0000000000000..93745cf28bbb4 --- /dev/null +++ b/recipes/metis/all/patches/5.1.1-003-reduce-maximum-memory-use.patch @@ -0,0 +1,197 @@ +From aef54c5b2a72f9d0c3c91b008c35271560b79cac Mon Sep 17 00:00:00 2001 +From: George Karypis +Date: Fri, 7 Jan 2022 14:01:46 +0000 +Subject: [PATCH] Small changes to reduce maximum memory use + +diff --git a/libmetis/checkgraph.c b/libmetis/checkgraph.c +--- a/libmetis/checkgraph.c ++++ b/libmetis/checkgraph.c +@@ -45,9 +45,11 @@ + + htable = ismalloc(nvtxs, 0, "htable"); + +- minedge = maxedge = adjncy[0]; +- if (adjwgt) +- minewgt = maxewgt = adjwgt[0]; ++ if (graph->nedges > 0) { ++ minedge = maxedge = adjncy[0]; ++ if (adjwgt) ++ minewgt = maxewgt = adjwgt[0]; ++ } + + for (i=0; idbglvl, METIS_DBG_TIME, InitTimers(ctrl)); + IFSET(ctrl->dbglvl, METIS_DBG_TIME, gk_startcputimer(ctrl->TotalTmr)); + +- if (ctrl->dbglvl&512) { +- *objval = BlockKWayPartitioning(ctrl, graph, part); +- } +- else { +- *objval = MlevelKWayPartitioning(ctrl, graph, part); +- } ++ iset(*nvtxs, 0, part); ++ if (ctrl->dbglvl&512) ++ *objval = (*nparts == 1 ? 0 : BlockKWayPartitioning(ctrl, graph, part)); ++ else ++ *objval = (*nparts == 1 ? 0 : MlevelKWayPartitioning(ctrl, graph, part)); + + IFSET(ctrl->dbglvl, METIS_DBG_TIME, gk_stopcputimer(ctrl->TotalTmr)); + IFSET(ctrl->dbglvl, METIS_DBG_TIME, PrintTimers(ctrl)); +diff --git a/libmetis/mmd.c b/libmetis/mmd.c +--- a/libmetis/mmd.c ++++ b/libmetis/mmd.c +@@ -59,24 +59,24 @@ + if (neqns <= 0) + return; + +- /* Adjust from C to Fortran */ ++ /* adjust from C to Fortran */ + xadj--; adjncy--; invp--; perm--; head--; qsize--; list--; marker--; + +- /* initialization for the minimum degree algorithm. */ ++ /* initialization for the minimum degree algorithm */ + *ncsub = 0; + mmdint(neqns, xadj, adjncy, head, invp, perm, qsize, list, marker); + +- /* 'num' counts the number of ordered nodes plus 1. */ ++ /* 'num' counts the number of ordered nodes plus 1 */ + num = 1; + +- /* eliminate all isolated nodes. */ ++ /* eliminate all isolated nodes */ + nextmd = head[1]; + while (nextmd > 0) { + mdeg_node = nextmd; + nextmd = invp[mdeg_node]; + marker[mdeg_node] = maxint; + invp[mdeg_node] = -num; +- num = num + 1; ++ num++; + } + + /* search for node of the minimum degree. 'mdeg' is the current */ +@@ -87,14 +87,16 @@ + head[1] = 0; + mdeg = 2; + +- /* infinite loop here ! */ ++ /* infinite loop here */ + while (1) { + while (head[mdeg] <= 0) + mdeg++; + + /* use value of 'delta' to set up 'mdlmt', which governs */ + /* when a degree update is to be performed. */ +- mdlmt = mdeg + delta; ++ //mdlmt = mdeg + delta; ++ // the need for gk_min() was identified by jsf67 ++ mdlmt = gk_min(neqns, mdeg+delta); + ehead = 0; + + n500: +@@ -107,7 +109,7 @@ + mdeg_node = head[mdeg]; + }; + +- /* remove 'mdeg_node' from the degree structure. */ ++ /* remove 'mdeg_node' from the degree structure */ + nextmd = invp[mdeg_node]; + head[mdeg] = nextmd; + if (nextmd > 0) +@@ -140,7 +142,7 @@ + /* minimum degree nodes elimination. */ + if (num > neqns) + goto n1000; +- mmdupd( ehead, neqns, xadj, adjncy, delta, &mdeg, head, invp, perm, qsize, list, marker, maxint, &tag); ++ mmdupd(ehead, neqns, xadj, adjncy, delta, &mdeg, head, invp, perm, qsize, list, marker, maxint, &tag); + }; /* end of -- while ( 1 ) -- */ + + n1000: +@@ -289,6 +291,7 @@ + return; + } + ++ + /*************************************************************************** + * mmdint ---- mult minimum degree initialization + * purpose -- this routine performs initialization for the +@@ -305,33 +308,30 @@ + idx_t mmdint(idx_t neqns, idx_t *xadj, idx_t *adjncy, idx_t *head, idx_t *forward, + idx_t *backward, idx_t *qsize, idx_t *list, idx_t *marker) + { +- idx_t fnode, ndeg, node; ++ idx_t fnode, ndeg, node; + +- for ( node = 1; node <= neqns; node++ ) { +- head[node] = 0; +- qsize[node] = 1; +- marker[node] = 0; +- list[node] = 0; +- }; ++ for (node=1; node<=neqns; node++) { ++ head[node] = 0; ++ qsize[node] = 1; ++ marker[node] = 0; ++ list[node] = 0; ++ }; + +- /* initialize the degree doubly linked lists. */ +- for ( node = 1; node <= neqns; node++ ) { +- // The following is something that Olaf Schenk identified as potentially a +- // bug that I introduced in the original code. For now, I reverted back +- // to the original code until I have some time to check. +- // ndeg = xadj[node+1] - xadj[node]/* + 1*/; /* george */ +- ndeg = xadj[node+1] - xadj[node] + 1; +- if (ndeg == 0) +- ndeg = 1; +- fnode = head[ndeg]; +- forward[node] = fnode; +- head[ndeg] = node; +- if ( fnode > 0 ) backward[fnode] = node; +- backward[node] = -ndeg; +- }; +- return 0; ++ /* initialize the degree doubly linked lists. */ ++ for (node=1; node<=neqns; node++) { ++ ndeg = xadj[node+1]-xadj[node]+1; ++ fnode = head[ndeg]; ++ forward[node] = fnode; ++ head[ndeg] = node; ++ if (fnode > 0) ++ backward[fnode] = node; ++ backward[node] = -ndeg; ++ }; ++ ++ return 0; + } + ++ + /**************************************************************************** + * mmdnum --- multi minimum degree numbering + * purpose -- this routine performs the final step in producing +@@ -395,6 +395,7 @@ + return; + } + ++ + /**************************************************************************** + * mmdupd ---- multiple minimum degree update + * purpose -- this routine updates the degrees of nodes after a +diff --git a/libmetis/pmetis.c b/libmetis/pmetis.c +--- a/libmetis/pmetis.c ++++ b/libmetis/pmetis.c +@@ -130,7 +130,8 @@ + IFSET(ctrl->dbglvl, METIS_DBG_TIME, InitTimers(ctrl)); + IFSET(ctrl->dbglvl, METIS_DBG_TIME, gk_startcputimer(ctrl->TotalTmr)); + +- *objval = MlevelRecursiveBisection(ctrl, graph, *nparts, part, ctrl->tpwgts, 0); ++ iset(*nvtxs, 0, part); ++ *objval = (*nparts == 1 ? 0 : MlevelRecursiveBisection(ctrl, graph, *nparts, part, ctrl->tpwgts, 0)); + + IFSET(ctrl->dbglvl, METIS_DBG_TIME, gk_stopcputimer(ctrl->TotalTmr)); + IFSET(ctrl->dbglvl, METIS_DBG_TIME, PrintTimers(ctrl)); diff --git a/recipes/metis/all/test_package/CMakeLists.txt b/recipes/metis/all/test_package/CMakeLists.txt index 04b6e4c9401dc..54194f54c0961 100644 --- a/recipes/metis/all/test_package/CMakeLists.txt +++ b/recipes/metis/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ cmake_minimum_required(VERSION 3.15) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(metis REQUIRED CONFIG) add_executable(${PROJECT_NAME} test.cpp) diff --git a/recipes/metis/all/test_package/conanfile.py b/recipes/metis/all/test_package/conanfile.py index 46d71712aba54..02eb5ce439fb4 100644 --- a/recipes/metis/all/test_package/conanfile.py +++ b/recipes/metis/all/test_package/conanfile.py @@ -1,17 +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_multi" + 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": - # 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 requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -19,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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/metis/all/test_package/test.cpp b/recipes/metis/all/test_package/test.cpp index df955f7eb7be3..6a150009d25d4 100644 --- a/recipes/metis/all/test_package/test.cpp +++ b/recipes/metis/all/test_package/test.cpp @@ -1,10 +1,9 @@ #include #include -#include - -int main(){ +#include +int main() { idx_t nVertices = 6; idx_t nEdges = 7; idx_t nWeights = 1; @@ -14,10 +13,10 @@ int main(){ idx_t part[6]; // Indexes of starting points in adjacent array - idx_t xadj[6+1] = {0,2,5,7,9,12,14}; + idx_t xadj[6 + 1] = {0, 2, 5, 7, 9, 12, 14}; // Adjacent vertices in consecutive index order - idx_t adjncy[2 * 7] = {1,3,0,4,2,1,5,0,4,3,1,5,4,2}; + idx_t adjncy[2 * 7] = {1, 3, 0, 4, 2, 1, 5, 0, 4, 3, 1, 5, 4, 2}; // Weights of vertices // if all weights are equal then can be set to NULL @@ -29,7 +28,7 @@ int main(){ std::cout << ret << std::endl; - for(unsigned part_i = 0; part_i < nVertices; part_i++){ + for (unsigned part_i = 0; part_i < nVertices; part_i++) { std::cout << part_i << " " << part[part_i] << std::endl; } diff --git a/recipes/metis/config.yml b/recipes/metis/config.yml index e7148244c2a2f..bf774fe223f43 100644 --- a/recipes/metis/config.yml +++ b/recipes/metis/config.yml @@ -1,3 +1,5 @@ versions: + "5.2.1": + folder: all "5.1.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..dbdf62474df2d 100644 --- a/recipes/mfast/all/conanfile.py +++ b/recipes/mfast/all/conanfile.py @@ -1,24 +1,30 @@ -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): name = "mfast" - license = "LGPL-3.0" - url = "https://github.com/conan-io/conan-center-index" - homepage = "https://objectcomputing.com/" description = ( "mFAST is a high performance C++ encoding/decoding library for FAST " "(FIX Adapted for STreaming) protocol" ) - topics = ("mfast", "fast", "fix", "fix-adapted-for-streaming", + license = "LGPL-3.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://objectcomputing.github.io/mFAST/" + topics = ("fast", "fix", "fix-adapted-for-streaming", "financial-information-exchange", "libraries", "cpp") - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -30,32 +36,27 @@ class mFASTConan(ConanFile): "fPIC": True, "with_sqlite3": False, } - 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 +64,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("boost/1.75.0") + # transitive_headers=True because mfast/mfast_export.h includes boost/config.hpp + self.requires("boost/1.75.0", transitive_headers=True) self.requires("tinyxml2/9.0.0") if self.options.with_sqlite3: - self.requires("sqlite3/3.37.2") + self.requires("sqlite3/3.43.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,56 +154,62 @@ 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 "" fast_type_filename = "fast_type_gen" + extension module_folder_depth = len(os.path.normpath(self._new_mfast_config_dir).split(os.path.sep)) fast_type_rel_path = "{}bin/{}".format("".join(["../"] * module_folder_depth), fast_type_filename) - exec_target_content = textwrap.dedent("""\ + exec_target_content = textwrap.dedent(f"""\ if(NOT TARGET fast_type_gen) + # Locate fast_type_gen executable + ## Workaround for legacy "cmake" generator in case of cross-build if(CMAKE_CROSSCOMPILING) - find_program(MFAST_EXECUTABLE fast_type_gen PATHS ENV PATH NO_DEFAULT_PATH) + find_program(MFAST_EXECUTABLE NAMES fast_type_gen PATHS ENV PATH NO_DEFAULT_PATH) endif() + ## And here this will work fine with "CMakeToolchain" (for native & cross-build) + ## and legacy "cmake" generator in case of native build + if(NOT MFAST_EXECUTABLE) + find_program(MFAST_EXECUTABLE NAMES fast_type_gen) + endif() + ## Last resort: we search in package folder directly if(NOT MFAST_EXECUTABLE) get_filename_component(MFAST_EXECUTABLE "${{CMAKE_CURRENT_LIST_DIR}}/{fast_type_rel_path}" ABSOLUTE) endif() + + # Create executable imported target fast_type_gen add_executable(fast_type_gen IMPORTED) set_property(TARGET fast_type_gen PROPERTY IMPORTED_LOCATION ${{MFAST_EXECUTABLE}}) 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 +261,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 +286,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..6f661e72969a0 100644 --- a/recipes/mfast/all/test_package/conanfile.py +++ b/recipes/mfast/all/test_package/conanfile.py @@ -1,14 +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", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "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 hasattr(self, "settings_build") and tools.cross_building(self): - self.build_requires(str(self.requires["mfast"])) + self.tool_requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -16,6 +24,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/mgclient/all/conandata.yml b/recipes/mgclient/all/conandata.yml new file mode 100644 index 0000000000000..d3dddbce027d5 --- /dev/null +++ b/recipes/mgclient/all/conandata.yml @@ -0,0 +1,16 @@ +sources: + "1.4.3": + url: "https://github.com/memgraph/mgclient/archive/refs/tags/v1.4.3.tar.gz" + sha256: "f446b469532cd5154b8fb986ac57ca9880763e34c77e564d2c4c948989b0244e" + "1.4.2": + url: "https://github.com/memgraph/mgclient/archive/refs/tags/v1.4.2.tar.gz" + sha256: "aa89422636b1e25b8f9f34453f331e15d32a5957a9b2381c3598fc3644dbc043" +patches: + "1.4.3": + - patch_file: "patches/1.4.2-0001-static-shared.build.patch" + patch_description: "make static and shared build separated" + patch_type: "conan" + "1.4.2": + - patch_file: "patches/1.4.2-0001-static-shared.build.patch" + patch_description: "make static and shared build separated" + patch_type: "conan" diff --git a/recipes/mgclient/all/conanfile.py b/recipes/mgclient/all/conanfile.py new file mode 100644 index 0000000000000..958881a323221 --- /dev/null +++ b/recipes/mgclient/all/conanfile.py @@ -0,0 +1,100 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.scm import Version +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, CMakeDeps, CMakeToolchain, cmake_layout +import os + + +required_conan_version = ">=1.53.0" + +class MGClientConan(ConanFile): + name = "mgclient" + description = "C/C++ Memgraph Client" + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/memgraph/mgclient" + topics = ("memgraph", "client") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_cpp": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_cpp": True, + } + + @property + def _min_cppstd(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "7", + "clang": "7", + "apple-clang": "10", + "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") + 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("openssl/[>=1.1 <4]") + + def validate(self): + if self.options.with_cpp: + 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["BUILD_CPP_BINDINGS"] = self.options.with_cpp + 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 = ["mgclient"] + + if self.settings.os == "Windows": + self.cpp_info.system_libs.append("ws2_32") diff --git a/recipes/mgclient/all/patches/1.4.2-0001-static-shared.build.patch b/recipes/mgclient/all/patches/1.4.2-0001-static-shared.build.patch new file mode 100644 index 0000000000000..efba4fc8b2bb4 --- /dev/null +++ b/recipes/mgclient/all/patches/1.4.2-0001-static-shared.build.patch @@ -0,0 +1,43 @@ +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index e905e85..85a6b0a 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -50,6 +50,7 @@ else() + find_package(OpenSSL REQUIRED) + include(GenerateExportHeader) + ++ if(NOT BUILD_SHARED_LIBS) + add_library(mgclient-static STATIC ${mgclient_src_files}) + + generate_export_header(mgclient-static +@@ -74,6 +75,7 @@ else() + target_link_libraries(mgclient-static PUBLIC ws2_32) + endif() + ++ else() + add_library(mgclient-shared SHARED ${mgclient_src_files}) + + generate_export_header(mgclient-shared +@@ -102,13 +104,21 @@ else() + generate_export_header(mgclient-shared + BASE_NAME "mgclient" + EXPORT_FILE_NAME "mgclient-export.h") ++ endif() + + include(GNUInstallDirs) + +- install(TARGETS mgclient-static mgclient-shared ++ if(NOT BUILD_SHARED_LIBS) ++ install(TARGETS mgclient-static + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}) ++ else() ++ install(TARGETS mgclient-shared ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) ++ endif() + install(DIRECTORY + "${PROJECT_SOURCE_DIR}/include/" + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) diff --git a/recipes/mgclient/all/test_package/CMakeLists.txt b/recipes/mgclient/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..cbe32d3f6014a --- /dev/null +++ b/recipes/mgclient/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) + +find_package(mgclient REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE mgclient::mgclient) diff --git a/recipes/mgclient/all/test_package/conanfile.py b/recipes/mgclient/all/test_package/conanfile.py new file mode 100644 index 0000000000000..ef5d7042163ec --- /dev/null +++ b/recipes/mgclient/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/mgclient/all/test_package/test_package.c b/recipes/mgclient/all/test_package/test_package.c new file mode 100644 index 0000000000000..078593ee4c3ab --- /dev/null +++ b/recipes/mgclient/all/test_package/test_package.c @@ -0,0 +1,22 @@ +#include +#include + +#include "mgclient.h" + +int main(int argc, char *argv[]) { + mg_init(); + printf("mgclient version: %s\n", mg_client_version()); + + mg_session_params *params = mg_session_params_make(); + if (!params) { + fprintf(stderr, "failed to allocate session parameters\n"); + exit(1); + } + mg_session_params_set_host(params, "localhsot"); + mg_session_params_set_port(params, 8888); + mg_session_params_set_sslmode(params, MG_SSLMODE_DISABLE); + + mg_finalize(); + + return 0; +} diff --git a/recipes/mgclient/config.yml b/recipes/mgclient/config.yml new file mode 100644 index 0000000000000..af4203f05155e --- /dev/null +++ b/recipes/mgclient/config.yml @@ -0,0 +1,5 @@ +versions: + "1.4.3": + folder: all + "1.4.2": + folder: all diff --git a/recipes/mgs/all/conandata.yml b/recipes/mgs/all/conandata.yml index c3099b0d8bf72..803396c03189b 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.0: - url: https://github.com/theodelrieu/mgs/releases/download/v0.2.0/mgs.zip - sha256: aa057a4096da9451bef1950a3e784350df590f09f6bad0c0ca59ed1874df4a36 + "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" + "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..a1fe1d56d19c7 100644 --- a/recipes/mgs/all/conanfile.py +++ b/recipes/mgs/all/conanfile.py @@ -1,49 +1,94 @@ -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.53.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") + package_type = "header-library" + 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): - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 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) 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.") - else: - self.output.warn("mgs requires C++14. Your compiler is unknown. Assuming it supports C++14.") + 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): - 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() + copy(self, "*", 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 +97,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..0f735b51a2642 --- /dev/null +++ b/recipes/mgs/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/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/microprofile/all/CMakeLists.txt b/recipes/microprofile/all/CMakeLists.txt index ff45b79a8420c..c54dc9657fda8 100644 --- a/recipes/microprofile/all/CMakeLists.txt +++ b/recipes/microprofile/all/CMakeLists.txt @@ -1,7 +1,63 @@ -cmake_minimum_required(VERSION 3.10) -project(cmake_wrapper) +cmake_minimum_required(VERSION 3.4) +project(microprofile) -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +option(MICROPROFILE_USE_CONFIG_FILE "Use user provided configuration in microprofile.config.h file." ON) -add_subdirectory("source_subfolder") +set(MICROPROFILE_EXPORT_FILENAME microprofile.export.h) +set(MICROPROFILE_CONFIG_HEADER ${PROJECT_SOURCE_DIR}/microprofile.config.h) +set(MICROPROFILE_PUBLIC_HEADERS + ${PROJECT_SOURCE_DIR}/microprofile.h + ${CMAKE_CURRENT_BINARY_DIR}/${MICROPROFILE_EXPORT_FILENAME} +) + +set(THREADS_PREFER_PTHREAD_FLAG ON) +find_package(Threads REQUIRED) + +add_library(${PROJECT_NAME} microprofile.h microprofile.cpp) + +include(GenerateExportHeader) +generate_export_header(${PROJECT_NAME} + EXPORT_MACRO_NAME MICROPROFILE_API + EXPORT_FILE_NAME ${MICROPROFILE_EXPORT_FILENAME} +) + +target_include_directories(${PROJECT_NAME} PUBLIC + $ + $ + $ +) + +if (MICROPROFILE_USE_CONFIG_FILE) + target_compile_definitions(${PROJECT_NAME} PUBLIC MICROPROFILE_USE_CONFIG) +endif() + +target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_11) + +target_link_libraries(${PROJECT_NAME} PRIVATE Threads::Threads) + +if (WIN32) + target_link_libraries(${PROJECT_NAME} PRIVATE ws2_32) +endif() + +if (MP_MINIZ) + find_package(miniz REQUIRED CONFIG) + target_link_libraries(${PROJECT_NAME} PRIVATE miniz::miniz) +endif() + +if (MP_GPU_TIMERS_VULKAN) + find_package(Vulkan REQUIRED) + target_link_libraries(${PROJECT_NAME} PRIVATE Vulkan::Vulkan) +endif() + +set_target_properties(${PROJECT_NAME} PROPERTIES PUBLIC_HEADER "${MICROPROFILE_PUBLIC_HEADERS}") + +include(GNUInstallDirs) +install(TARGETS ${PROJECT_NAME} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME} +) +if (MICROPROFILE_USE_CONFIG_FILE) + install(FILES ${MICROPROFILE_CONFIG_HEADER} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME} + PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ + ) +endif() diff --git a/recipes/microprofile/all/conandata.yml b/recipes/microprofile/all/conandata.yml index 6715d7fabbe05..8c86f1a660d74 100644 --- a/recipes/microprofile/all/conandata.yml +++ b/recipes/microprofile/all/conandata.yml @@ -1,12 +1,10 @@ sources: - "3.1": - - url: "https://github.com/jonasmr/microprofile/archive/refs/tags/v3.1.tar.gz" - sha256: "300e1d0d21e4c13ad1de72c5309ba02fbdb3bcbbe26e5ad9ff8b798380781527" - - url: "https://unlicense.org/UNLICENSE" - sha256: "7e12e5df4bae12cb21581ba157ced20e1986a0508dd10d0e8a4ab9a4cf94e85c" + "4.0": + url: "https://github.com/jonasmr/microprofile/archive/refs/tags/v4.0.tar.gz" + sha256: "59cd3ee7afd3ce5cfeb7599db62ccc0611818985a8e649353bec157122902a5c" + "3.1": + url: "https://github.com/jonasmr/microprofile/archive/refs/tags/v3.1.tar.gz" + sha256: "300e1d0d21e4c13ad1de72c5309ba02fbdb3bcbbe26e5ad9ff8b798380781527" patches: - "3.1": - - patch_file: "patches/sources_fix.patch" - base_path: "source_subfolder" - - patch_file: "patches/cmake.patch" - base_path: "source_subfolder" + "3.1": + - patch_file: "patches/sources_fix.patch" diff --git a/recipes/microprofile/all/conanfile.py b/recipes/microprofile/all/conanfile.py index 9f23e3872db58..b3d0644be3113 100644 --- a/recipes/microprofile/all/conanfile.py +++ b/recipes/microprofile/all/conanfile.py @@ -1,54 +1,62 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration import os +from collections import OrderedDict -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, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, collect_libs, copy, export_conandata_patches, get, save, load +from conan.tools.gnu import PkgConfigDeps +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" class MicroprofileConan(ConanFile): name = "microprofile" - license = "Unlicense" + license = "DocumentRef-README.md:LicenseRef-Unlicense" + description = "Microprofile is a embeddable profiler in a few files, written in C++" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/jonasmr/microprofile" - description = "Microprofile is a embeddable profiler in a few files, written in C++" topics = ("profiler", "embedded", "timer") - exports_sources = ["CMakeLists.txt", "patches/**"] - generators = "cmake" - settings = "os", "compiler", "build_type", "arch" + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], "microprofile_enabled": [True, False], "with_miniz": [True, False], - "thread_buffer_size": "ANY", - "thread_gpu_buffer_size": "ANY", - "max_frame_history": "ANY", - "webserver_port": "ANY", - "webserver_maxframes": "ANY", - "webserver_socket_buffer_size": "ANY", - "gpu_frame_delay": "ANY", - "name_max_length": "ANY", - "max_timers": "ANY", - "max_threads": "ANY", - "max_string_length": "ANY", - "timeline_max_tokens": "ANY", - "thread_log_frames_reuse": "ANY", - "max_groups": "ANY", + "thread_buffer_size": ["ANY"], + "thread_gpu_buffer_size": ["ANY"], + "max_frame_history": ["ANY"], + "webserver_port": ["ANY"], + "webserver_maxframes": ["ANY"], + "webserver_socket_buffer_size": ["ANY"], + "gpu_frame_delay": ["ANY"], + "name_max_length": ["ANY"], + "max_timers": ["ANY"], + "max_threads": ["ANY"], + "max_string_length": ["ANY"], + "timeline_max_tokens": ["ANY"], + "thread_log_frames_reuse": ["ANY"], + "max_groups": ["ANY"], "use_big_endian": [True, False], "enable_gpu_timer_callbacks": [True, False], - "enable_timer": [None, "gl", "d3d11", "d3d12", "vulkan"] + "enable_timer": [None, "gl", "d3d11", "d3d12", "vulkan"], } default_options = { "shared": False, "fPIC": True, "microprofile_enabled": True, "with_miniz": False, - "thread_buffer_size": 2048 << 10, - "thread_gpu_buffer_size": 128 << 10, + "thread_buffer_size": 2097152, + "thread_gpu_buffer_size": 131072, "max_frame_history": 512, "webserver_port": 1338, "webserver_maxframes": 30, - "webserver_socket_buffer_size": 16 << 10, + "webserver_socket_buffer_size": 16384, "gpu_frame_delay": 5, "name_max_length": 64, "max_timers": 1024, @@ -59,23 +67,41 @@ class MicroprofileConan(ConanFile): "max_groups": 128, "use_big_endian": False, "enable_gpu_timer_callbacks": False, - "enable_timer": None + "enable_timer": None, } - _cmake = None + def export_sources(self): + export_conandata_patches(self) + copy(self, "CMakeLists.txt", + src=self.recipe_folder, + dst=os.path.join(self.export_sources_folder, "src")) - @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: + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + if self.options.with_miniz: + self.requires("miniz/3.0.2") + if self.options.enable_timer == "gl": + self.requires("opengl/system") + if self.options.enable_timer == "vulkan": + self.requires("vulkan-loader/1.3.268.0") + if Version(self.version) >= "4.0": + self.requires("stb/cci.20230920") + + def build_requirements(self): + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/2.1.0") + def _validate_int_options(self): positive_int_options = [ "thread_buffer_size", @@ -91,19 +117,19 @@ def _validate_int_options(self): "max_string_length", "timeline_max_tokens", "thread_log_frames_reuse", - "max_groups" + "max_groups", ] for opt in positive_int_options: try: - value = int(getattr(self.options, opt)) + value = int(self.options.get_safe(opt)) if value < 0: raise ValueError except ValueError: - raise ConanInvalidConfiguration("microprofile:{} must be a positive integer".format(opt)) + raise ConanInvalidConfiguration(f"microprofile:{opt} must be a positive integer") def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) + check_min_cppstd(self, 11) if self.settings.os != "Windows" and self.options.enable_timer in ["d3d11", "d3d12"]: raise ConanInvalidConfiguration("DirectX timers can only be used in Windows.") if self.options.enable_timer and self.options.enable_gpu_timer_callbacks: @@ -113,91 +139,91 @@ def validate(self): if int(self.options.max_groups) % 32 != 0: raise ConanInvalidConfiguration("microprofile:max_groups must be multiple of 32.") - if int(self.options.webserver_port) > 2 ** 16 - 1: + if int(self.options.webserver_port) > 2**16 - 1: raise ConanInvalidConfiguration("microprofile:webserver_port must be between 0 and 65535.") - 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) - def requirements(self): - if self.options.with_miniz: - self.requires("miniz/2.2.0") - if self.options.enable_timer == "gl": - self.requires("opengl/system") - if self.options.enable_timer == "vulkan": - self.requires("vulkan-loader/1.2.182") + def generate(self): + VirtualBuildEnv(self).generate() - def source(self): - tools.get(**self.conan_data["sources"][self.version][0], strip_root=True, destination=self._source_subfolder) - tools.download(filename="LICENSE", **self.conan_data["sources"][self.version][1]) + tc = CMakeToolchain(self) + tc.variables["MP_MINIZ"] = self.options.with_miniz + tc.variables["MP_GPU_TIMERS_VULKAN"] = self.options.enable_timer == "vulkan" + tc.variables["MICROPROFILE_USE_CONFIG_FILE"] = True + tc.preprocessor_definitions["STB_SPRINTF_IMPLEMENTATION"] = 1 + tc.generate() + + deps = CMakeDeps(self) + deps.generate() + + deps = PkgConfigDeps(self) + deps.generate() def build(self): - self._create_defines_file(os.path.join(self._source_subfolder, "microprofile.config.h")) - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + self._create_defines_file(os.path.join(self.source_folder, "microprofile.config.h")) + 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["MP_MINIZ"] = self.options.with_miniz - self._cmake.definitions["MP_GPU_TIMERS_VULKAN"] = self.options.enable_timer == "vulkan" - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def _extract_license(self): + readme = load(self, os.path.join(self.source_folder, "README.md"),) + return readme[readme.find("# License"):] def package(self): - 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() def _create_defines(self): - return [ - "MICROPROFILE_EXPORT", - ("MICROPROFILE_ENABLED", ("1" if self.options.microprofile_enabled else "0")), - ("MICROPROFILE_DEBUG", ("1" if self.settings.build_type == "Debug" else "0")), - ("MICROPROFILE_MINIZ", ("1" if self.options.with_miniz else "0")), - ("MICROPROFILE_BIG_ENDIAN", ("1" if self.options.use_big_endian else "0")), - ("MICROPROFILE_GPU_TIMERS", ("1" if self.options.enable_timer else "0")), - ("MICROPROFILE_GPU_TIMER_CALLBACKS", ("1" if self.options.enable_gpu_timer_callbacks else "0")), - ("MICROPROFILE_GPU_TIMERS_GL", ("1" if self.options.enable_timer == "gl" else "0")), - ("MICROPROFILE_GPU_TIMERS_D3D11", ("1" if self.options.enable_timer == "d3d11" else "0")), - ("MICROPROFILE_GPU_TIMERS_D3D12", ("1" if self.options.enable_timer == "d3d12" else "0")), - ("MICROPROFILE_GPU_TIMERS_VULKAN", ("1" if self.options.enable_timer == "vulkan" else "0")), - ("MICROPROFILE_PER_THREAD_BUFFER_SIZE", str(self.options.thread_buffer_size)), - ("MICROPROFILE_PER_THREAD_GPU_BUFFER_SIZE", str(self.options.thread_gpu_buffer_size)), - ("MICROPROFILE_MAX_FRAME_HISTORY", str(self.options.max_frame_history)), - ("MICROPROFILE_WEBSERVER_PORT", str(self.options.webserver_port)), - ("MICROPROFILE_WEBSERVER_MAXFRAMES", str(self.options.webserver_maxframes)), - ("MICROPROFILE_WEBSERVER_SOCKET_BUFFER_SIZE", str(self.options.webserver_socket_buffer_size)), - ("MICROPROFILE_GPU_FRAME_DELAY", str(self.options.gpu_frame_delay)), - ("MICROPROFILE_NAME_MAX_LEN", str(self.options.name_max_length)), - ("MICROPROFILE_MAX_TIMERS", str(self.options.max_timers)), - ("MICROPROFILE_MAX_THREADS", str(self.options.max_threads)), - ("MICROPROFILE_MAX_STRING", str(self.options.max_string_length)), - ("MICROPROFILE_TIMELINE_MAX_TOKENS", str(self.options.timeline_max_tokens)), - ("MICROPROFILE_THREAD_LOG_FRAMES_REUSE", str(self.options.thread_log_frames_reuse)), - ("MICROPROFILE_MAX_GROUPS", str(self.options.max_groups)) - ] + defines = OrderedDict() + defines["MICROPROFILE_EXPORT"] = None + defines["MICROPROFILE_ENABLED"] = bool(self.options.microprofile_enabled) + defines["MICROPROFILE_DEBUG"] = bool(self.settings.build_type == "Debug") + defines["MICROPROFILE_MINIZ"] = bool(self.options.with_miniz) + defines["MICROPROFILE_BIG_ENDIAN"] = bool(self.options.use_big_endian) + defines["MICROPROFILE_GPU_TIMERS"] = bool(self.options.enable_timer) + defines["MICROPROFILE_GPU_TIMER_CALLBACKS"] = bool(self.options.enable_gpu_timer_callbacks) + defines["MICROPROFILE_GPU_TIMERS_GL"] = bool(self.options.enable_timer == "gl") + defines["MICROPROFILE_GPU_TIMERS_D3D11"] = bool(self.options.enable_timer == "d3d11") + defines["MICROPROFILE_GPU_TIMERS_D3D12"] = bool(self.options.enable_timer == "d3d12") + defines["MICROPROFILE_GPU_TIMERS_VULKAN"] = bool(self.options.enable_timer == "vulkan") + defines["MICROPROFILE_PER_THREAD_BUFFER_SIZE"] = self.options.thread_buffer_size + defines["MICROPROFILE_PER_THREAD_GPU_BUFFER_SIZE"] = self.options.thread_gpu_buffer_size + defines["MICROPROFILE_MAX_FRAME_HISTORY"] = self.options.max_frame_history + defines["MICROPROFILE_WEBSERVER_PORT"] = self.options.webserver_port + defines["MICROPROFILE_WEBSERVER_MAXFRAMES"] = self.options.webserver_maxframes + defines["MICROPROFILE_WEBSERVER_SOCKET_BUFFER_SIZE"] = self.options.webserver_socket_buffer_size + defines["MICROPROFILE_GPU_FRAME_DELAY"] = self.options.gpu_frame_delay + defines["MICROPROFILE_NAME_MAX_LEN"] = self.options.name_max_length + defines["MICROPROFILE_MAX_TIMERS"] = self.options.max_timers + defines["MICROPROFILE_MAX_THREADS"] = self.options.max_threads + defines["MICROPROFILE_MAX_STRING"] = self.options.max_string_length + defines["MICROPROFILE_TIMELINE_MAX_TOKENS"] = self.options.timeline_max_tokens + defines["MICROPROFILE_THREAD_LOG_FRAMES_REUSE"] = self.options.thread_log_frames_reuse + defines["MICROPROFILE_MAX_GROUPS"] = self.options.max_groups + return defines def _create_defines_file(self, filename): defines = self._create_defines() defines_list = ["#pragma once\n"] - for define in defines: - if isinstance(define, tuple) or isinstance(define, list): - defines_list.append("#define {} {}\n".format(define[0], define[1])) + for define, value in defines.items(): + if value is None or value == "": + defines_list.append(f"#define {define}\n") + elif value in [True, False]: + defines_list.append(f"#define {define} {'1' if value else '0'}\n") else: - defines_list.append("#define {}\n".format(define)) - tools.save(filename, "".join(defines_list)) + defines_list.append(f"#define {define} {value}\n") + save(self, filename, "".join(defines_list)) def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) - self.cpp_info.names["cmake_find_package"] = self.name - self.cpp_info.names["cmake_find_package_multi"] = self.name + self.cpp_info.libs = collect_libs(self) + if Version(self.version) < "4.0": + self.cpp_info.includedirs.append(os.path.join("include", "microprofile")) if self.settings.os == "Windows": self.cpp_info.system_libs = ["ws2_32"] - elif self.settings.os == "Linux": - self.cpp_info.system_libs = ["pthread"] + elif self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs = ["pthread", "m"] self.cpp_info.defines.append("MICROPROFILE_USE_CONFIG") diff --git a/recipes/microprofile/all/patches/cmake.patch b/recipes/microprofile/all/patches/cmake.patch deleted file mode 100644 index b92ba025b0a43..0000000000000 --- a/recipes/microprofile/all/patches/cmake.patch +++ /dev/null @@ -1,67 +0,0 @@ ---- /dev/null -+++ b/CMakeLists.txt -@@ -0,0 +1,64 @@ -+cmake_minimum_required(VERSION 3.4) -+project(microprofile) -+ -+option(MICROPROFILE_USE_CONFIG_FILE "Use user provided configuration in microprofile.config.h file." ON) -+ -+set(MICROPROFILE_EXPORT_FILENAME microprofile.export.h) -+set(MICROPROFILE_CONFIG_HEADER ${PROJECT_SOURCE_DIR}/microprofile.config.h) -+set(MICROPROFILE_PUBLIC_HEADERS -+ ${PROJECT_SOURCE_DIR}/microprofile.h -+ ${CMAKE_CURRENT_BINARY_DIR}/${MICROPROFILE_EXPORT_FILENAME} -+) -+ -+set(THREADS_PREFER_PTHREAD_FLAG ON) -+find_package(Threads REQUIRED) -+ -+add_library(${PROJECT_NAME} microprofile.h microprofile.cpp) -+ -+include(GenerateExportHeader) -+generate_export_header(${PROJECT_NAME} -+ EXPORT_MACRO_NAME MICROPROFILE_API -+ EXPORT_FILE_NAME ${MICROPROFILE_EXPORT_FILENAME} -+) -+ -+target_include_directories(${PROJECT_NAME} PUBLIC -+ $ -+ $ -+ $ -+) -+ -+if (MICROPROFILE_USE_CONFIG_FILE) -+ target_compile_definitions(${PROJECT_NAME} PUBLIC MICROPROFILE_USE_CONFIG) -+endif() -+ -+target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_11) -+ -+target_link_libraries(${PROJECT_NAME} PRIVATE Threads::Threads) -+ -+if (WIN32) -+ target_link_libraries(${PROJECT_NAME} PRIVATE ws2_32) -+endif() -+ -+if (MP_MINIZ) -+ target_link_libraries(${PROJECT_NAME} PRIVATE CONAN_PKG::miniz) -+endif() -+ -+if (MP_GPU_TIMERS_VULKAN) -+ target_link_libraries(${PROJECT_NAME} PRIVATE CONAN_PKG::vulkan-loader) -+endif() -+ -+set_target_properties(${PROJECT_NAME} PROPERTIES PUBLIC_HEADER "${MICROPROFILE_PUBLIC_HEADERS}") -+ -+include(GNUInstallDirs) -+install(TARGETS ${PROJECT_NAME} -+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} -+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} -+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} -+ PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME} -+) -+if (MICROPROFILE_USE_CONFIG_FILE) -+ install(FILES ${MICROPROFILE_CONFIG_HEADER} -+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME} -+ PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ -+ ) -+endif() diff --git a/recipes/microprofile/all/test_package/CMakeLists.txt b/recipes/microprofile/all/test_package/CMakeLists.txt index ed091dc6c1aee..34366c2d4346f 100644 --- a/recipes/microprofile/all/test_package/CMakeLists.txt +++ b/recipes/microprofile/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(microprofile REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/microprofile/all/test_package/conanfile.py b/recipes/microprofile/all/test_package/conanfile.py index 30f8c8cfb0975..ef5d7042163ec 100644 --- a/recipes/microprofile/all/test_package/conanfile.py +++ b/recipes/microprofile/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 MicroprofileTestConan(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 +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/microprofile/all/test_package/test_package.cpp b/recipes/microprofile/all/test_package/test_package.cpp index 2a13e33f9ca1d..ef555a9511bfa 100644 --- a/recipes/microprofile/all/test_package/test_package.cpp +++ b/recipes/microprofile/all/test_package/test_package.cpp @@ -1,6 +1,6 @@ #include -#include +#include int main() { #if MICROPROFILE_ENABLED diff --git a/recipes/microprofile/all/test_v1_package/CMakeLists.txt b/recipes/microprofile/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/microprofile/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/microprofile/all/test_v1_package/conanfile.py b/recipes/microprofile/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..30f8c8cfb0975 --- /dev/null +++ b/recipes/microprofile/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +import os + +from conans import ConanFile, CMake, tools + + +class MicroprofileTestConan(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/microprofile/config.yml b/recipes/microprofile/config.yml index 992d10eb37c11..d0751e6458e77 100644 --- a/recipes/microprofile/config.yml +++ b/recipes/microprofile/config.yml @@ -1,3 +1,5 @@ versions: + "4.0": + folder: all "3.1": folder: all diff --git a/recipes/microservice-essentials/all/conandata.yml b/recipes/microservice-essentials/all/conandata.yml new file mode 100644 index 0000000000000..79b465764338c --- /dev/null +++ b/recipes/microservice-essentials/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.1.0": + url: "https://github.com/seboste/microservice-essentials/archive/refs/tags/0.1.0.tar.gz" + sha256: "9739f7052ee9de96c4b206e0d345d6de5594dcf2bd6f8d3364d44788e83fbe58" diff --git a/recipes/microservice-essentials/all/conanfile.py b/recipes/microservice-essentials/all/conanfile.py new file mode 100644 index 0000000000000..86c82be4f2a4f --- /dev/null +++ b/recipes/microservice-essentials/all/conanfile.py @@ -0,0 +1,105 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain +from conan.tools.files import get, copy +from conan.tools.build import check_min_cppstd +import os + +required_conan_version = ">=1.53.0" + +class MicroserviceEssentials(ConanFile): + name = "microservice-essentials" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/seboste/microservice-essentials" + license = "MIT" + description = """microservice-essentials is a portable, independent C++ library that takes care of typical recurring concerns that occur in microservice development.""" + topics = ("microservices", "cloud-native", "request-handling") + settings = "os", "compiler", "arch", "build_type" + package_type = "library" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_tests": [True, False], + "with_examples": [True, False] + } + default_options = { + "shared": False, + "fPIC": True, + "with_tests": False, + "with_examples": False + } + + @property + def _compilers_minimum_version(self): + return { + "gcc": "7", + "clang": "5", + "apple-clang": "10", + "Visual Studio": "15.7", + "msvc": "191", + } + + def build_requirements(self): + self.tool_requires("cmake/[>=3.16.3 <4]") + + def requirements(self): + if self.options.with_examples: + self.requires("cpp-httplib/0.14.1") + self.requires("nlohmann_json/3.11.2") + self.requires("openssl/[>=3 <4]") + self.requires("grpc/1.54.3") + if self.options.with_tests: + self.requires("catch2/3.4.0") + self.requires("nlohmann_json/3.11.2") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + tc.variables["BUILD_TESTING"] = self.options.with_tests + tc.variables["BUILD_EXAMPLES"] = self.options.with_examples + tc.generate() + deps = CMakeDeps(self) + deps.generate() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, "17") + + 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( + "{} requires C++17, which your compiler does not support.".format(self.name) + ) + + 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 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 = ["microservice-essentials"] + self.cpp_info.bindirs.extend(["lib"]) + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["m", "pthread"]) diff --git a/recipes/microservice-essentials/all/test_package/CMakeLists.txt b/recipes/microservice-essentials/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..f5945294e9935 --- /dev/null +++ b/recipes/microservice-essentials/all/test_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package CXX) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED True) + +find_package(microservice-essentials REQUIRED) + +add_executable(test_package main.cpp) +target_link_libraries(test_package microservice-essentials::microservice-essentials) diff --git a/recipes/microservice-essentials/all/test_package/conanfile.py b/recipes/microservice-essentials/all/test_package/conanfile.py new file mode 100644 index 0000000000000..27bfec4efb0d4 --- /dev/null +++ b/recipes/microservice-essentials/all/test_package/conanfile.py @@ -0,0 +1,25 @@ +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan import ConanFile +from conan.tools.build import cross_building +import os + +class TestPckage(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 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/microservice-essentials/all/test_package/main.cpp b/recipes/microservice-essentials/all/test_package/main.cpp new file mode 100644 index 0000000000000..bb1a1722bce6b --- /dev/null +++ b/recipes/microservice-essentials/all/test_package/main.cpp @@ -0,0 +1,13 @@ +#include +#include +#include + +int main() +{ + mse::Context ctx; + std::cout << "context created" << std::endl; + // SignalHandler requires pthread. Check if it builds. + mse::SignalHandler signal_handler(mse::Signal::SIG_SHUTDOWN, []() {}); + std::cout << "signal_handler created" << std::endl; + return 0; +} diff --git a/recipes/microservice-essentials/config.yml b/recipes/microservice-essentials/config.yml new file mode 100644 index 0000000000000..5e5e3d8a61814 --- /dev/null +++ b/recipes/microservice-essentials/config.yml @@ -0,0 +1,3 @@ +versions: + "0.1.0": + folder: "all" 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..d62613b715193 --- /dev/null +++ b/recipes/mikelankamp-fpm/all/conanfile.py @@ -0,0 +1,58 @@ +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.50.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") + package_type = "header-library" + 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..e845ae751a301 --- /dev/null +++ b/recipes/mikelankamp-fpm/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/mikelankamp-fpm/all/test_package/test_package.cpp b/recipes/mikelankamp-fpm/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..207d30e1d5418 --- /dev/null +++ b/recipes/mikelankamp-fpm/all/test_package/test_package.cpp @@ -0,0 +1,12 @@ +#include +#include +#include + +#include + +int main() { + fpm::fixed_16_16 x {0.0}; + 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/mimalloc/all/conandata.yml b/recipes/mimalloc/all/conandata.yml index a4ff4095992ef..879d39b04284b 100644 --- a/recipes/mimalloc/all/conandata.yml +++ b/recipes/mimalloc/all/conandata.yml @@ -1,71 +1,63 @@ sources: - "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" - "2.0.5": - url: "https://github.com/microsoft/mimalloc/archive/v2.0.5.tar.gz" - sha256: "fb000a017c289ddc0df749f16fef854e033e496276d8426bdd066b59c476f6cf" - "2.0.3": - url: "https://github.com/microsoft/mimalloc/archive/v2.0.3.tar.gz" - sha256: "5af497f360879bf9d07a5146961d275a25f4177fbe21ee6c437db604422acd60" - "2.0.2": - url: "https://github.com/microsoft/mimalloc/archive/v2.0.2.tar.gz" - sha256: "c81a5f443f72373e3105172d6a935e29b0dabd13ba387c080bc444586cbe3021" - "1.7.7": - url: "https://github.com/microsoft/mimalloc/archive/v1.7.7.tar.gz" - sha256: "0f6663be1e1764851bf9563fcf7a6b3330e23b933eb4737dd07e3289b87895fe" + "2.1.7": + url: "https://github.com/microsoft/mimalloc/archive/v2.1.7.tar.gz" + sha256: "0eed39319f139afde8515010ff59baf24de9e47ea316a315398e8027d198202d" + "2.1.2": + url: "https://github.com/microsoft/mimalloc/archive/v2.1.2.tar.gz" + sha256: "2b1bff6f717f9725c70bf8d79e4786da13de8a270059e4ba0bdd262ae7be46eb" + "2.0.9": + url: "https://github.com/microsoft/mimalloc/archive/v2.0.9.tar.gz" + sha256: "4a29edae32a914a706715e2ac8e7e4109e25353212edeed0888f4e3e15db5850" + "1.8.7": + url: "https://github.com/microsoft/mimalloc/archive/v1.8.7.tar.gz" + sha256: "347793a2c614e525edc4e286ab5cbc4c7a5efc12503e2dafca276d78394c4f07" + "1.8.2": + url: "https://github.com/microsoft/mimalloc/archive/v1.8.2.tar.gz" + sha256: "4058d53d6ceb75862f32c30a6ee686c3cbb5e965b2c324b828ca454f7fe064f9" + "1.7.9": + url: "https://github.com/microsoft/mimalloc/archive/v1.7.9.tar.gz" + sha256: "45e05be518363d32b2cdcce1a1fac3580895ea2e4524e1a3c7e71145cb58659f" "1.7.6": url: "https://github.com/microsoft/mimalloc/archive/v1.7.6.tar.gz" sha256: "d74f86ada2329016068bc5a243268f1f555edd620b6a7d6ce89295e7d6cf18da" - "1.7.5": - url: "https://github.com/microsoft/mimalloc/archive/v1.7.5.tar.gz" - sha256: "4f9ed087fc1804a8a77c4225ffc3337468f18d6c4f060c4d44f3a3eff85bc5b6" - "1.6.7": - url: "https://github.com/microsoft/mimalloc/archive/v1.6.7.tar.gz" - sha256: "111b718b496f297f128d842880e72e90e33953cf00b45ba0ccd2167e7340ed17" patches: - "2.0.7": - - patch_file: "patches/2.0.7-0001-change-install-paths.patch" + "2.1.7": + - patch_file: "patches/2.1.7-0002-support-older-compiler.patch" + patch_description: "fix compilation errors on older compilers" + patch_type: "portability" + "2.1.2": + - patch_file: "patches/2.1.2-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" + - patch_file: "patches/2.1.2-0002-support-older-compiler.patch" + patch_description: "fix compilation errors on older compilers" + patch_type: "portability" + "2.0.9": + - patch_file: "patches/2.0.9-0001-change-install-paths.patch" patch_description: "fix install paths" patch_type: "conan" - "2.0.5": - - patch_file: "patches/2.0.6-0001-change-install-paths.patch" + - patch_file: "patches/2.0.9-0002-support-older-compiler.patch" + patch_description: "fix compilation errors on older compilers" + patch_type: "portability" + "1.8.7": + - patch_file: "patches/1.8.7-0002-support-older-compiler.patch" + patch_description: "fix compilation errors on older compilers" + patch_type: "portability" + "1.8.2": + - patch_file: "patches/1.8.2-0001-change-install-paths.patch" patch_description: "fix install paths" patch_type: "conan" - "2.0.3": - - patch_file: "patches/2.0.3-0001-change-install-paths-avoid-symlink.patch" - 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" - 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" - patch_description: "include stddef" + - patch_file: "patches/1.8.2-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" + "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.6": - 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.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" - 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" - patch_description: "include stddef" - patch_type: "portability" diff --git a/recipes/mimalloc/all/conanfile.py b/recipes/mimalloc/all/conanfile.py index 47efa6d568998..1d36b7541ab29 100644 --- a/recipes/mimalloc/all/conanfile.py +++ b/recipes/mimalloc/all/conanfile.py @@ -1,25 +1,24 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.microsoft import check_min_vs, 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 +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rm, rmdir, replace_in_file, collect_libs +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime, VCVars +from conan.tools.env import VirtualBuildEnv +from conan.tools.scm import Version import os import shutil -import textwrap -required_conan_version = ">=1.53.0" +required_conan_version = ">=2" class MimallocConan(ConanFile): name = "mimalloc" + description = "mimalloc is a compact general purpose allocator with excellent performance." license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/microsoft/mimalloc" - description = "mimalloc is a compact general purpose allocator with excellent performance." topics = ("mimalloc", "allocator", "performance", "microsoft") - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -38,20 +37,6 @@ class MimallocConan(ConanFile): "single_object": False, } - - @property - def _min_cppstd(self): - return 17 - - @property - def _compilers_minimum_version(self): - return { - "gcc": "7", - "Visual Studio": "15", - "clang": "5", - "apple-clang": "10", - } - def export_sources(self): export_conandata_patches(self) @@ -89,18 +74,18 @@ def layout(self): def validate(self): # 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", "1.7.7", "2.0.6", "2.0.7"] and \ + if Version(self.version) == "1.7.6" and \ self.options.shared and \ is_msvc(self) and \ - "MD" in msvc_runtime_flag(self): + not is_msvc_static_runtime(self): raise ConanInvalidConfiguration( 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.info.options.override and \ - self.info.options.shared and \ + if self.options.override and \ + self.options.shared and \ is_msvc(self) and \ - "MT" in msvc_runtime_flag(self): + is_msvc_static_runtime(self): raise ConanInvalidConfiguration( "Dynamic runtime (MD/MDd) is required when using mimalloc as a shared library for override") @@ -109,18 +94,11 @@ def validate(self): self.options.get_safe("inject"): raise ConanInvalidConfiguration("Single object is incompatible with library injection") - if self.info.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.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 build_requirements(self): + self.tool_requires("cmake/[>=3.18 <4]") 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,9 +108,11 @@ def generate(self): 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.variables["MI_WIN_REDIRECT"] = "OFF" + tc.variables["MI_INSTALL_TOPLEVEL"] = "ON" tc.generate() + venv = VirtualBuildEnv(self) + venv.generate(scope="build") if is_msvc(self): vcvars = VCVars(self) @@ -140,7 +120,7 @@ def generate(self): def build(self): apply_conandata_patches(self) - if is_msvc(self) and self.settings.arch == "x86": + if is_msvc(self) and self.settings.arch == "x86" and self.options.shared: replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "mimalloc-redirect.lib", "mimalloc-redirect32.lib") @@ -159,8 +139,6 @@ def package(self): if self.options.get_safe("single_object"): 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"), os.path.join(self.package_folder, "lib", self._obj_name)) @@ -176,32 +154,6 @@ def package(self): 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( - os.path.join(self.package_folder, self._module_file_rel_path), - {cmake_target: "mimalloc::mimalloc"} - ) - - 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_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)) - @property def _obj_name(self): name = "mimalloc" @@ -227,12 +179,6 @@ def package_info(self): self.cpp_info.set_property("cmake_file_name", "mimalloc") self.cpp_info.set_property("cmake_target_name", "mimalloc" if self.options.shared else "mimalloc-static") - self.cpp_info.names["cmake_find_package"] = "mimalloc" - self.cpp_info.names["cmake_find_package_multi"] = "mimalloc" - 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 self.options.get_safe("inject"): self.cpp_info.includedirs = [] self.cpp_info.libdirs = [] diff --git a/recipes/mimalloc/all/patches/1.6.7-0001-change-install-paths-avoid-symlink.patch b/recipes/mimalloc/all/patches/1.6.7-0001-change-install-paths-avoid-symlink.patch deleted file mode 100644 index 6fa2c822d32ef..0000000000000 --- a/recipes/mimalloc/all/patches/1.6.7-0001-change-install-paths-avoid-symlink.patch +++ /dev/null @@ -1,40 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 35460e8..e5340d5 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -206,7 +206,7 @@ endif() - # Install and output names - # ----------------------------------------------------------------------------- - --set(mi_install_dir "${CMAKE_INSTALL_PREFIX}/lib/mimalloc-${mi_version}") -+set(mi_install_dir ".") - if(MI_SECURE MATCHES "ON") - set(mi_basename "mimalloc-secure") - else() -@@ -263,7 +263,7 @@ if(MI_BUILD_SHARED) - COMMENT "Copy mimalloc-redirect.dll to output directory") - endif() - -- install(TARGETS mimalloc EXPORT mimalloc DESTINATION ${mi_install_dir} LIBRARY) -+ install(TARGETS mimalloc EXPORT mimalloc RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) - install(EXPORT mimalloc DESTINATION ${mi_install_dir}/cmake) - endif() - -@@ -287,7 +287,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_dir}) -+ install(TARGETS mimalloc-static EXPORT mimalloc RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) - endif() - - # install include files -@@ -297,7 +297,7 @@ install(FILES include/mimalloc-new-delete.h DESTINATION ${mi_install_dir}/includ - install(FILES cmake/mimalloc-config.cmake DESTINATION ${mi_install_dir}/cmake) - install(FILES cmake/mimalloc-config-version.cmake DESTINATION ${mi_install_dir}/cmake) - --if(NOT WIN32 AND MI_BUILD_SHARED) -+if(FALSE) - # install a symlink in the /usr/local/lib to the versioned library - set(mi_symlink "${CMAKE_SHARED_MODULE_PREFIX}${mi_basename}${CMAKE_SHARED_LIBRARY_SUFFIX}") - set(mi_soname "mimalloc-${mi_version}/${mi_symlink}.${mi_version}") diff --git a/recipes/mimalloc/all/patches/1.6.7-0002-include-cstddef-to-get-std-size-t.patch b/recipes/mimalloc/all/patches/1.6.7-0002-include-cstddef-to-get-std-size-t.patch deleted file mode 100644 index b6a13ceb0fb42..0000000000000 --- a/recipes/mimalloc/all/patches/1.6.7-0002-include-cstddef-to-get-std-size-t.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/include/mimalloc.h b/include/mimalloc.h -index 254a7d9..3c3142b 100644 ---- a/include/mimalloc.h -+++ b/include/mimalloc.h -@@ -377,6 +377,7 @@ mi_decl_nodiscard mi_decl_export void* mi_new_reallocn(void* p, size_t newcount, - #ifdef __cplusplus - - #include // PTRDIFF_MAX -+#include // std::size_t - #if (__cplusplus >= 201103L) || (_MSC_VER > 1900) // C++11 - #include // std::true_type - #include // std::forward 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 deleted file mode 100644 index 108558a1f1922..0000000000000 --- a/recipes/mimalloc/all/patches/1.7.7-0001-change-install-paths.patch +++ /dev/null @@ -1,22 +0,0 @@ -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/1.8.2-0001-change-install-paths.patch b/recipes/mimalloc/all/patches/1.8.2-0001-change-install-paths.patch new file mode 100644 index 0000000000000..fb5aaa8360791 --- /dev/null +++ b/recipes/mimalloc/all/patches/1.8.2-0001-change-install-paths.patch @@ -0,0 +1,22 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 2bcd1ef..615cec9 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -415,7 +415,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() + +@@ -439,7 +439,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.8.2-0002-support-older-compiler.patch b/recipes/mimalloc/all/patches/1.8.2-0002-support-older-compiler.patch new file mode 100644 index 0000000000000..139ede7a8c43a --- /dev/null +++ b/recipes/mimalloc/all/patches/1.8.2-0002-support-older-compiler.patch @@ -0,0 +1,22 @@ +diff --git a/include/mimalloc.h b/include/mimalloc.h +index 368c22c..fb19939 100644 +--- a/include/mimalloc.h ++++ b/include/mimalloc.h +@@ -505,7 +505,7 @@ template struct _mi_heap_stl_allocator_common : publi + #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; +@@ -516,7 +516,7 @@ protected: + this->heap.reset(hp, (_mi_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/1.8.7-0002-support-older-compiler.patch b/recipes/mimalloc/all/patches/1.8.7-0002-support-older-compiler.patch new file mode 100644 index 0000000000000..4b1890b784ff9 --- /dev/null +++ b/recipes/mimalloc/all/patches/1.8.7-0002-support-older-compiler.patch @@ -0,0 +1,22 @@ +diff --git a/include/mimalloc.h b/include/mimalloc.h +index ae6f99b..773424e 100644 +--- a/include/mimalloc.h ++++ b/include/mimalloc.h +@@ -511,7 +511,7 @@ template struct _mi_heap_stl_allocator_common : publi + #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; +@@ -522,7 +522,7 @@ protected: + this->heap.reset(hp, (_mi_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.2-0001-change-install-paths-avoid-symlink.patch b/recipes/mimalloc/all/patches/2.0.2-0001-change-install-paths-avoid-symlink.patch deleted file mode 100644 index ffbc799da2d8e..0000000000000 --- a/recipes/mimalloc/all/patches/2.0.2-0001-change-install-paths-avoid-symlink.patch +++ /dev/null @@ -1,30 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt ---- a/CMakeLists.txt 2021-06-18 00:05:40.000000000 -0300 -+++ b/CMakeLists.txt 2021-07-14 18:02:10.941935678 -0300 -@@ -281,7 +281,7 @@ - COMMENT "Copy mimalloc-redirect${MIMALLOC_REDIRECT_SUFFIX}.dll to output directory") - 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() - -@@ -305,7 +305,7 @@ - set_target_properties(mimalloc-static PROPERTIES OUTPUT_NAME ${mi_basename}) - endif() - -- install(TARGETS mimalloc-static EXPORT mimalloc DESTINATION ${mi_install_libdir} LIBRARY) -+ install(TARGETS mimalloc-static EXPORT mimalloc RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) - endif() - - # install include files -@@ -315,7 +315,7 @@ - install(FILES cmake/mimalloc-config.cmake DESTINATION ${mi_install_cmakedir}) - install(FILES cmake/mimalloc-config-version.cmake DESTINATION ${mi_install_cmakedir}) - --if(NOT WIN32 AND MI_BUILD_SHARED AND NOT MI_INSTALL_TOPLEVEL) -+if(FALSE) - # install a symlink in the /usr/local/lib to the versioned library - # note: use delayed prefix expansion as \${CMAKE_INSTALL_PREFIX} - set(mi_symlink "${CMAKE_SHARED_MODULE_PREFIX}${mi_basename}${CMAKE_SHARED_LIBRARY_SUFFIX}") diff --git a/recipes/mimalloc/all/patches/2.0.2-0002-include-cstddef-to-get-std-size-t.patch b/recipes/mimalloc/all/patches/2.0.2-0002-include-cstddef-to-get-std-size-t.patch deleted file mode 100644 index fc8068130bf11..0000000000000 --- a/recipes/mimalloc/all/patches/2.0.2-0002-include-cstddef-to-get-std-size-t.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/include/mimalloc.h b/include/mimalloc.h -index 254a7d9..3c3142b 100644 ---- a/include/mimalloc.h -+++ b/include/mimalloc.h -@@ -387,6 +387,7 @@ mi_decl_nodiscard mi_decl_export void* mi_new_reallocn(void* p, size_t newcount, - #ifdef __cplusplus - - #include // PTRDIFF_MAX -+#include // std::size_t - #if (__cplusplus >= 201103L) || (_MSC_VER > 1900) // C++11 - #include // std::true_type - #include // std::forward diff --git a/recipes/mimalloc/all/patches/2.0.3-0001-change-install-paths-avoid-symlink.patch b/recipes/mimalloc/all/patches/2.0.3-0001-change-install-paths-avoid-symlink.patch deleted file mode 100644 index 00b059ccae3db..0000000000000 --- a/recipes/mimalloc/all/patches/2.0.3-0001-change-install-paths-avoid-symlink.patch +++ /dev/null @@ -1,31 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 580e38c..19fce47 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -305,7 +305,7 @@ if(MI_BUILD_SHARED) - COMMENT "Copy mimalloc-redirect${MIMALLOC_REDIRECT_SUFFIX}.dll to output directory") - 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() - -@@ -329,7 +329,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_libdir} LIBRARY) -+ install(TARGETS mimalloc-static EXPORT mimalloc RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) - endif() - - # install include files -@@ -339,7 +339,7 @@ install(FILES include/mimalloc-new-delete.h DESTINATION ${mi_install_incdir}) - install(FILES cmake/mimalloc-config.cmake DESTINATION ${mi_install_cmakedir}) - install(FILES cmake/mimalloc-config-version.cmake DESTINATION ${mi_install_cmakedir}) - --if(NOT WIN32 AND MI_BUILD_SHARED AND NOT MI_INSTALL_TOPLEVEL) -+if(FALSE) - # install a symlink in the /usr/local/lib to the versioned library - # note: use delayed prefix expansion as \${CMAKE_INSTALL_PREFIX} - set(mi_symlink "${CMAKE_SHARED_MODULE_PREFIX}${mi_basename}${CMAKE_SHARED_LIBRARY_SUFFIX}") diff --git a/recipes/mimalloc/all/patches/2.0.6-0001-change-install-paths.patch b/recipes/mimalloc/all/patches/2.0.6-0001-change-install-paths.patch deleted file mode 100644 index bb266a46ce3f6..0000000000000 --- a/recipes/mimalloc/all/patches/2.0.6-0001-change-install-paths.patch +++ /dev/null @@ -1,22 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 8127e09..af459af 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/2.0.7-0001-change-install-paths.patch b/recipes/mimalloc/all/patches/2.0.7-0001-change-install-paths.patch deleted file mode 100644 index adf1e00f9607c..0000000000000 --- a/recipes/mimalloc/all/patches/2.0.7-0001-change-install-paths.patch +++ /dev/null @@ -1,22 +0,0 @@ -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/patches/2.1.2-0001-change-install-paths.patch b/recipes/mimalloc/all/patches/2.1.2-0001-change-install-paths.patch new file mode 100644 index 0000000000000..eb6660f83dccc --- /dev/null +++ b/recipes/mimalloc/all/patches/2.1.2-0001-change-install-paths.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 2bcd1ef..37eee49 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -415,7 +415,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() + diff --git a/recipes/mimalloc/all/patches/2.1.2-0002-support-older-compiler.patch b/recipes/mimalloc/all/patches/2.1.2-0002-support-older-compiler.patch new file mode 100644 index 0000000000000..58a4298ac30b4 --- /dev/null +++ b/recipes/mimalloc/all/patches/2.1.2-0002-support-older-compiler.patch @@ -0,0 +1,22 @@ +diff --git a/include/mimalloc.h b/include/mimalloc.h +index f77c2ea..4c9594f 100644 +--- a/include/mimalloc.h ++++ b/include/mimalloc.h +@@ -508,7 +508,7 @@ template struct _mi_heap_stl_allocator_common : publi + #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; +@@ -519,7 +519,7 @@ protected: + this->heap.reset(hp, (_mi_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.1.7-0002-support-older-compiler.patch b/recipes/mimalloc/all/patches/2.1.7-0002-support-older-compiler.patch new file mode 100644 index 0000000000000..34149f1737e9e --- /dev/null +++ b/recipes/mimalloc/all/patches/2.1.7-0002-support-older-compiler.patch @@ -0,0 +1,22 @@ +diff --git a/include/mimalloc.h b/include/mimalloc.h +index c41bcc8..cc4929e 100644 +--- a/include/mimalloc.h ++++ b/include/mimalloc.h +@@ -512,7 +512,7 @@ template struct _mi_heap_stl_allocator_common : publi + #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; +@@ -523,7 +523,7 @@ protected: + this->heap.reset(hp, (_mi_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 f0ee34e277443..65c3184e9021a 100644 --- a/recipes/mimalloc/all/test_package/CMakeLists.txt +++ b/recipes/mimalloc/all/test_package/CMakeLists.txt @@ -1,43 +1,8 @@ -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) -option(BUILD_MI_API "Build mi_api sources" ON) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) find_package(mimalloc REQUIRED CONFIG) -if(TARGET mimalloc-static) - set(MIMALLOC_LIBS mimalloc-static) -else() - set(MIMALLOC_LIBS mimalloc) -endif() - -if (BUILD_NO_CHANGES) - add_executable(no_changes no_changes.c) - target_link_libraries(no_changes ${MIMALLOC_LIBS}) - target_compile_features(no_changes PUBLIC c_std_11) - - add_executable(no_changes_cpp no_changes.cpp) - target_link_libraries(no_changes_cpp ${MIMALLOC_LIBS}) - target_compile_features(no_changes_cpp PUBLIC cxx_std_17) -endif (BUILD_NO_CHANGES) - -if (BUILD_INCLUDE_OVERRIDE) - add_executable(include_override include_override.c) - target_link_libraries(include_override ${MIMALLOC_LIBS}) - target_compile_features(include_override PUBLIC c_std_11) - - add_executable(include_override_cpp include_override.cpp) - target_link_libraries(include_override_cpp ${MIMALLOC_LIBS}) - target_compile_features(include_override_cpp PUBLIC cxx_std_17) -endif (BUILD_INCLUDE_OVERRIDE) - -if (BUILD_MI_API) - add_executable(mi_api mi_api.c) - target_link_libraries(mi_api ${MIMALLOC_LIBS}) - target_compile_features(mi_api PUBLIC c_std_11) - add_executable(mi_api_cpp mi_api.cpp) - target_link_libraries(mi_api_cpp ${MIMALLOC_LIBS}) - target_compile_features(mi_api_cpp PUBLIC cxx_std_17) -endif (BUILD_MI_API) +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE $,mimalloc,mimalloc-static>) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) diff --git a/recipes/mimalloc/all/test_package/conanfile.py b/recipes/mimalloc/all/test_package/conanfile.py index 9e32697b3c0e4..81b2d147a96f2 100644 --- a/recipes/mimalloc/all/test_package/conanfile.py +++ b/recipes/mimalloc/all/test_package/conanfile.py @@ -1,109 +1,25 @@ 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 - +from conan.tools.cmake import CMake, cmake_layout import os -import functools -class MimallocTestConan(ConanFile): - settings = "os", "arch", "compiler", "build_type" - test_type = "explicit" - def requirements(self): - self.requires(self.tested_reference_str) +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" def layout(self): cmake_layout(self) - @functools.lru_cache(1) - def _test_files(self): - test_files = [] - - # No override: - if not self.options["mimalloc"].override: - test_files = ["mi_api"] - - # Visual Studio overriding: - elif self.settings.compiler == "Visual Studio" and self.options["mimalloc"].shared: - test_files = ["include_override", "mi_api"] - elif self.settings.compiler == "Visual Studio" and not self.options["mimalloc"].shared: - 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: - 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: - test_files = [] - - # Unix-like non injected override: - else: - 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 requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) 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 - def test(self): - if not can_run(self): - return - - 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(self.cpp.build.bindirs[0], f"{file}_cpp") - self.output.info("test: {}".format(test_package_cpp)) - self.run(test_package_cpp, 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/mimalloc/all/test_package/include_override.c b/recipes/mimalloc/all/test_package/include_override.c deleted file mode 100644 index 5e54990b98f79..0000000000000 --- a/recipes/mimalloc/all/test_package/include_override.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "mimalloc-override.h" - -#include - -int main() { - void *data = malloc(1024); - free(data); - - printf("mimalloc version %d\n", mi_version()); - return 0; -} diff --git a/recipes/mimalloc/all/test_package/include_override.cpp b/recipes/mimalloc/all/test_package/include_override.cpp deleted file mode 100644 index edcb49e3434ee..0000000000000 --- a/recipes/mimalloc/all/test_package/include_override.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#ifdef _WIN32 -#include -#else -#include -#endif - -#include -#include - -int main() { - auto *data = new int(1024); - delete data; - - std::cout << "mimalloc version " << mi_version() << "\n"; - return 0; -} diff --git a/recipes/mimalloc/all/test_package/mi_api.c b/recipes/mimalloc/all/test_package/mi_api.c deleted file mode 100644 index 804f582034b95..0000000000000 --- a/recipes/mimalloc/all/test_package/mi_api.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "mimalloc.h" - -#include -#include - -int main() { - void *data = mi_malloc(1024); - - printf("mimalloc version %d\n", mi_version()); - return 0; -} diff --git a/recipes/mimalloc/all/test_package/mi_api.cpp b/recipes/mimalloc/all/test_package/mi_api.cpp deleted file mode 100644 index a361ab757bf42..0000000000000 --- a/recipes/mimalloc/all/test_package/mi_api.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include "mimalloc.h" - -#include -#include - -int main() { - std::vector> vec; - vec.push_back(1); - vec.pop_back(); - - std::cout << "mimalloc version " << mi_version() << "\n"; - return 0; -} diff --git a/recipes/mimalloc/all/test_package/no_changes.c b/recipes/mimalloc/all/test_package/no_changes.c deleted file mode 100644 index 51737c1ac50f0..0000000000000 --- a/recipes/mimalloc/all/test_package/no_changes.c +++ /dev/null @@ -1,12 +0,0 @@ -#include -#include - -int main() { - void *data = malloc(1024); - - memset(data, '6', 1024); - - free(data); - - return 0; -} diff --git a/recipes/mimalloc/all/test_package/no_changes.cpp b/recipes/mimalloc/all/test_package/no_changes.cpp deleted file mode 100644 index 7a5ad3df0f22c..0000000000000 --- a/recipes/mimalloc/all/test_package/no_changes.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include - -int main() { - auto *data = new int(1024); - delete data; - - return 0; -} diff --git a/recipes/mimalloc/all/test_package/test_package.c b/recipes/mimalloc/all/test_package/test_package.c new file mode 100644 index 0000000000000..f73b12d64f5d5 --- /dev/null +++ b/recipes/mimalloc/all/test_package/test_package.c @@ -0,0 +1,11 @@ +#include "mimalloc.h" + +#include +#include + +int main() { + void *data = mi_malloc(32); + + printf("mimalloc version %d\n", mi_version()); + return EXIT_SUCCESS; +} diff --git a/recipes/mimalloc/all/test_v1_package/conanfile.py b/recipes/mimalloc/all/test_v1_package/conanfile.py deleted file mode 100644 index 4702c7a3df51b..0000000000000 --- a/recipes/mimalloc/all/test_v1_package/conanfile.py +++ /dev/null @@ -1,91 +0,0 @@ -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 81997d06f09a4..8b0873bb9cd4c 100644 --- a/recipes/mimalloc/config.yml +++ b/recipes/mimalloc/config.yml @@ -1,19 +1,17 @@ versions: - "2.0.7": + "2.1.7": folder: all - "2.0.6": + # mold requires 2.1.2 + "2.1.2": folder: all - "2.0.5": + "2.0.9": folder: all - "2.0.3": + "1.8.7": folder: all - "2.0.2": + "1.8.2": folder: all - "1.7.7": + "1.7.9": folder: all + # arrow requires 1.7.6 "1.7.6": folder: all - "1.7.5": - folder: all - "1.6.7": - folder: all diff --git a/recipes/mingw-builds/all/conandata.yml b/recipes/mingw-builds/all/conandata.yml index 6703f0f20681d..4f44c4f767124 100644 --- a/recipes/mingw-builds/all/conandata.yml +++ b/recipes/mingw-builds/all/conandata.yml @@ -1,4 +1,26 @@ sources: + "13.2.0": + mcf: + seh: + ucrt: + url: "https://github.com/niXman/mingw-builds-binaries/releases/download/13.2.0-rt_v11-rev1/x86_64-13.2.0-release-mcf-seh-ucrt-rt_v11-rev1.7z" + sha256: "9ae11d0b00f4deae7246471193191de62d9e0318917d3577b568e0974c3069bc" + posix: + seh: + ucrt: + url: "https://github.com/niXman/mingw-builds-binaries/releases/download/13.2.0-rt_v11-rev1/x86_64-13.2.0-release-posix-seh-ucrt-rt_v11-rev1.7z" + sha256: "475ee72c5ce1bd54a3e3c334bdd3be5e6575334184fd9718013aa362c9819d2f" + msvcrt: + url: "https://github.com/niXman/mingw-builds-binaries/releases/download/13.2.0-rt_v11-rev1/x86_64-13.2.0-release-posix-seh-msvcrt-rt_v11-rev1.7z" + sha256: "7d3f84b17b235aa233f0fb5df9765bf79dbea950177a69ff99f8ad1d75b0aa6e" + win32: + seh: + ucrt: + url: "https://github.com/niXman/mingw-builds-binaries/releases/download/13.2.0-rt_v11-rev1/x86_64-13.2.0-release-win32-seh-ucrt-rt_v11-rev1.7z" + sha256: "74ca64c55220edd3196681782fbff653c2b9cb4f427f9e532ab6e9a0823dc997" + msvcrt: + url: "https://github.com/niXman/mingw-builds-binaries/releases/download/13.2.0-rt_v11-rev1/x86_64-13.2.0-release-win32-seh-msvcrt-rt_v11-rev1.7z" + sha256: "15b914f38f2f2e2d6f7b9b8425ff22b7e406878b01920190b09ce0dd8259c6aa" "12.2.0": posix: seh: diff --git a/recipes/mingw-builds/all/conanfile.py b/recipes/mingw-builds/all/conanfile.py index 74c63e1305ee9..913b244a11774 100644 --- a/recipes/mingw-builds/all/conanfile.py +++ b/recipes/mingw-builds/all/conanfile.py @@ -1,96 +1,123 @@ import os -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, download, rmdir +from conan.tools.scm import Version +required_conan_version = ">=1.47.0" + class MingwConan(ConanFile): name = "mingw-builds" description = "MinGW is a contraction of Minimalist GNU for Windows" url = "https://github.com/conan-io/conan-center-index" - homepage = "https://github.com/ericLemanissier/mingw-builds" + homepage = "https://github.com/niXman/mingw-builds" license = "ZPL-2.1", "MIT", "GPL-2.0-or-later" topics = ("gcc", "gnu", "unix", "mingw32", "binutils") settings = "os", "arch" - options = {"threads": ["posix", "win32"], "exception": ["seh", "sjlj"]} - default_options = {"threads": "posix", "exception": "seh"} - + options = { + "threads": ["posix", "win32", "mcf"], + "exception": ["seh", "sjlj"], + "runtime": ["msvcrt", "ucrt"] + } + default_options = { + "threads": "posix", + "exception": "seh", + "runtime": "ucrt" + } provides = "mingw-w64" @property def _settings_build(self): return getattr(self, "settings_build", self.settings) + def config_options(self): + # Before version 12 (included) the only possible runtime was msvcrt + if Version(self.version) <= Version("12.2.0"): + del self.options.runtime + def validate(self): valid_os = ["Windows"] if str(self.settings.os) not in valid_os: - raise ConanInvalidConfiguration("MinGW {} is only supported for the following operating systems: {}" - .format(self.version, valid_os)) + raise ConanInvalidConfiguration(f"MinGW {self.version} is only supported for the following operating systems: {valid_os}") valid_arch = ["x86_64"] if str(self.settings.arch) not in valid_arch: - raise ConanInvalidConfiguration("MinGW {} is only supported for the following architectures on {}: {}" - .format(self.version, str(self.settings.os), valid_arch)) - + raise ConanInvalidConfiguration(f"MinGW {self.version} is only supported for the following architectures on {self.settings.os}: {valid_arch}") + if getattr(self, "settings_target", None): if str(self.settings_target.os) not in valid_os: - raise ConanInvalidConfiguration("MinGW {} is only supported for the following operating systems: {}" - .format(self.version, valid_os)) + raise ConanInvalidConfiguration(f"MinGW {self.version} is only supported for the following operating systems: {valid_os}") valid_arch = ["x86_64"] if str(self.settings_target.arch) not in valid_arch: - raise ConanInvalidConfiguration("MinGW {} is only supported for the following architectures on {}: {}" - .format(self.version, str(self.settings.os), valid_arch)) + raise ConanInvalidConfiguration(f"MinGW {self.version} is only supported for the following architectures on {self.settings.os}: {valid_arch}") if self.settings_target.compiler != "gcc": - raise ConanInvalidConfiguration("Only GCC is allowed as compiler.") - if str(self.settings_target.compiler.threads) != str(self.options.threads): - raise ConanInvalidConfiguration("Build requires 'mingw' provides binaries for gcc " - "with threads={}, your profile:host declares " - "threads={}, please use the same value for both." - .format(self.options.threads, - self.settings_target.compiler.threads)) - if str(self.settings_target.compiler.exception) != str(self.options.exception): - raise ConanInvalidConfiguration("Build requires 'mingw' provides binaries for gcc " - "with exception={}, your profile:host declares " - "exception={}, please use the same value for both." - .format(self.options.exception, - self.settings_target.compiler.exception)) + self.output.warning("Only GCC is allowed as compiler. Make sure you are using the right compiler with this package!") + threads_value = self.settings_target.compiler.get_safe("threads") + if str(threads_value) != str(self.options.threads): + self.output.warning("Tool require 'mingw-builds' provides binaries for gcc " + f"with options.threads={self.options.threads}, but your profile:host declares " + f"settings.compiler.threads={threads_value}, please use the same value for both.") + exception_value = self.settings_target.compiler.get_safe("exception") + if str(exception_value) != str(self.options.exception): + self.output.warning("Tool require 'mingw-builds' provides binaries for gcc " + f"with options.exception={self.options.exception}, your profile:host declares " + f"settings.compiler.exception={exception_value}, please use the same value for both.") def build_requirements(self): self.build_requires("7zip/19.00") + def _get_source(self): + if Version(self.version) <= Version("12.2.0"): + return self.conan_data["sources"][self.version][str(self.options.threads)][str(self.options.exception)] + else: + return self.conan_data["sources"][self.version][str(self.options.threads)][str(self.options.exception)][str(self.options.runtime)] + def build(self): # Source should be downloaded in the build step since it depends on specific options - url = self.conan_data["sources"][self.version][str(self.options.threads)][str(self.options.exception)] - self.output.info("Downloading: %s" % url["url"]) - tools.download(url["url"], "file.7z", sha256=url["sha256"]) + url = self._get_source() + self.output.info(f"Downloading: {url['url']}") + download(self, url["url"], "file.7z", sha256=url["sha256"]) self.run("7z x file.7z") os.remove('file.7z') - def package(self): target = "mingw64" if self.settings.arch == "x86_64" else "mingw32" - self.copy("*", dst="", src=target) - tools.rmdir(target) - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.rmdir(os.path.join(self.package_folder, "opt", "lib", "cmake")) + copy(self, "*", src=target, dst=self.package_folder) + rmdir(self, target) + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "opt", "lib", "cmake")) def package_info(self): if getattr(self, "settings_target", None): if self.settings_target.compiler != "gcc": - raise ConanInvalidConfiguration("Only GCC is allowed as compiler.") - if str(self.settings_target.compiler.threads) != str(self.options.threads): - raise ConanInvalidConfiguration("Build requires 'mingw' provides binaries for gcc " - "with threads={}, your profile:host declares " - "threads={}, please use the same value for both." - .format(self.options.threads, - self.settings_target.compiler.threads)) - if str(self.settings_target.compiler.exception) != str(self.options.exception): - raise ConanInvalidConfiguration("Build requires 'mingw' provides binaries for gcc " - "with exception={}, your profile:host declares " - "exception={}, please use the same value for both." - .format(self.options.exception, - self.settings_target.compiler.exception)) + self.output.warning("Only GCC is allowed as compiler. Make sure you are using the right compiler with this package!") + threads_value = self.settings_target.compiler.get_safe("threads") + if str(threads_value) != str(self.options.threads): + self.output.warning("Tool require 'mingw-builds' provides binaries for gcc " + f"with options.threads={self.options.threads}, but your profile:host declares " + f"settings.compiler.threads={threads_value}, please use the same value for both.") + exception_value = self.settings_target.compiler.get_safe("exception") + if str(exception_value) != str(self.options.exception): + self.output.warning("Tool require 'mingw-builds' provides binaries for gcc " + f"with options.exception={self.options.exception}, your profile:host declares " + f"settings.compiler.exception={exception_value}, please use the same value for both.") + + self.buildenv_info.define("MINGW_HOME", str(self.package_folder)) + self.buildenv_info.define("CONAN_CMAKE_GENERATOR", "MinGW Makefiles") + self.buildenv_info.define("CXX", os.path.join(self.package_folder, "bin", "g++.exe").replace("\\", "/")) + self.buildenv_info.define("CC", os.path.join(self.package_folder, "bin", "gcc.exe").replace("\\", "/")) + self.buildenv_info.define("LD", os.path.join(self.package_folder, "bin", "ld.exe").replace("\\", "/")) + self.buildenv_info.define("NM", os.path.join(self.package_folder, "bin", "nm.exe").replace("\\", "/")) + self.buildenv_info.define("AR", os.path.join(self.package_folder, "bin", "ar.exe").replace("\\", "/")) + self.buildenv_info.define("AS", os.path.join(self.package_folder, "bin", "as.exe").replace("\\", "/")) + self.buildenv_info.define("STRIP", os.path.join(self.package_folder, "bin", "strip.exe").replace("\\", "/")) + self.buildenv_info.define("RANLIB", os.path.join(self.package_folder, "bin", "ranlib.exe").replace("\\", "/")) + self.buildenv_info.define("STRINGS", os.path.join(self.package_folder, "bin", "strings.exe").replace("\\", "/")) + self.buildenv_info.define("OBJDUMP", os.path.join(self.package_folder, "bin", "objdump.exe").replace("\\", "/")) + self.buildenv_info.define("GCOV", os.path.join(self.package_folder, "bin", "gcov.exe").replace("\\", "/")) + # TODO: Remove this after conan v1 support is dropped 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.env_info.MINGW_HOME = str(self.package_folder) diff --git a/recipes/mingw-builds/all/test_package/conanfile.py b/recipes/mingw-builds/all/test_package/conanfile.py index fde2fbd35a165..dbf3513dc9ad8 100644 --- a/recipes/mingw-builds/all/test_package/conanfile.py +++ b/recipes/mingw-builds/all/test_package/conanfile.py @@ -1,16 +1,14 @@ import os -from conans import ConanFile, tools +from conan import ConanFile class MinGWTestConan(ConanFile): - generators = "gcc" - settings = "os", "arch", "compiler", "build_type" + generators = "VirtualBuildEnv" + settings = "os", "arch" + test_type = "explicit" - def build(self): - source_file = os.path.join(self.source_folder, "main.cpp") - self.run("gcc.exe {} @conanbuildinfo.gcc -lstdc++ -o main".format(source_file), run_environment=True) + def build_requirements(self): + self.tool_requires(self.tested_reference_str) def test(self): - if not tools.cross_building(self): - self.run("gcc.exe --version", run_environment=True) - self.run("main") + self.run("gcc.exe --version") diff --git a/recipes/mingw-builds/all/test_package/main.cpp b/recipes/mingw-builds/all/test_package/main.cpp deleted file mode 100644 index b5597569f64e0..0000000000000 --- a/recipes/mingw-builds/all/test_package/main.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include -#include // test if we can include one of MinGW bundled header - -int main(void) { - std::cout << "Hello world!" << std::endl; - return 0; -} diff --git a/recipes/mingw-builds/config.yml b/recipes/mingw-builds/config.yml index 6ceaf5fe4c164..337b953faeff9 100644 --- a/recipes/mingw-builds/config.yml +++ b/recipes/mingw-builds/config.yml @@ -1,4 +1,6 @@ versions: + "13.2.0": + folder: "all" "12.2.0": folder: "all" "12.1.0": diff --git a/recipes/mingw-w64/linux/conandata.yml b/recipes/mingw-w64/linux/conandata.yml index 4c165fd2e4f36..e6c1adc158693 100644 --- a/recipes/mingw-w64/linux/conandata.yml +++ b/recipes/mingw-w64/linux/conandata.yml @@ -4,9 +4,15 @@ sources: url: "https://sourceforge.net/projects/mingw-w64/files/mingw-w64/mingw-w64-release/mingw-w64-v8.0.2.tar.bz2" sha256: "f00cf50951867a356d3dc0dcc7a9a9b422972302e23d54a33fc05ee7f73eee4d" binutils: - url: "http://ftp.gnu.org/gnu/binutils/binutils-2.35.2.tar.bz2" - sha256: "cfa7644dbecf4591e136eb407c1c1da16578bd2b03f0c2e8acdceba194bb9d61" + url: + - "https://mirrors.dotsrc.org/gnu/binutils/binutils-2.35.2.tar.xz" + - "https://mirror.kumi.systems/gnu/binutils/binutils-2.35.2.tar.xz" + - "https://ftpmirror.gnu.org/binutils/binutils-2.35.2.tar.xz" + sha256: "dcd5b0416e7b0a9b24bed76cd8c6c132526805761863150a26d016415b8bdc7b" gcc: - "10.3.0": - url: "http://ftp.gnu.org/gnu/gcc/gcc-10.3.0/gcc-10.3.0.tar.xz" - sha256: "64f404c1a650f27fc33da242e1f2df54952e3963a49e06e73f6940f3223ac344" + "10.5.0": + url: + - "https://mirrors.dotsrc.org/gnu/gcc/gcc-10.5.0/gcc-10.5.0.tar.xz" + - "https://mirror.kumi.systems/gnu/gcc/gcc-10.5.0/gcc-10.5.0.tar.xz" + - "https://ftpmirror.gnu.org/gcc/gcc-10.5.0/gcc-10.5.0.tar.xz" + sha256: "25109543fdf46f397c347b5d8b7a2c7e5694a5a51cce4b9c6e1ea8a71ca307c1" diff --git a/recipes/mingw-w64/linux/conanfile.py b/recipes/mingw-w64/linux/conanfile.py index 1e781d08b3204..bd2c407d5a633 100644 --- a/recipes/mingw-w64/linux/conanfile.py +++ b/recipes/mingw-w64/linux/conanfile.py @@ -1,83 +1,114 @@ import os +from contextlib import contextmanager + from conan import ConanFile -from conan.tools.files import get, mkdir, chdir, rm, rmdir from conan.errors import ConanInvalidConfiguration -from conans import tools, AutoToolsBuildEnvironment - +from conan.tools.env import Environment, VirtualBuildEnv +from conan.tools.files import chdir, copy, get, mkdir, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain, PkgConfigDeps +from conan.tools.layout import basic_layout -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class MingwConan(ConanFile): name = "mingw-w64" - description = "MinGW is a contraction of Minimalist GNU for Windows" + description = ("This package provides a MinGW-w64 environment with a GCC toolchain " + "for cross-compilation of native Windows binaries from Linux.") + license = ("ZPL-2.1", "MIT", "GPL-2.0-or-later") url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.mingw-w64.org/" - license = "ZPL-2.1", "MIT", "GPL-2.0-or-later" topics = ("gcc", "gnu", "unix", "mingw32", "binutils") - settings = "os", "arch", "build_type", "compiler" - options = {"threads": ["posix", "win32"], "exception": ["seh", "sjlj"], "gcc": ["10.3.0"]} - default_options = {"threads": "posix", "exception": "seh", "gcc": "10.3.0"} - no_copy_source = True + + package_type = "application" + settings = "os", "arch", "compiler", "build_type" + options = { + "threads": ["posix", "win32"], + "exception": ["seh", "sjlj"], + "gcc": ["10.5.0"], + } + default_options = { + "threads": "posix", + "exception": "seh", + "gcc": "10.5.0", + } + options_description = { + "threads": "Threading model: posix or win32", + "exception": "Exception model: seh (Structured Exception Handling) or sjlj (setjmp/longjmp)", + "gcc": "GCC version provided by MinGW-w64", + } + + short_paths = True @property def _settings_build(self): return getattr(self, "settings_build", self.settings) + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + del self.info.settings.compiler + del self.info.settings.build_type + def validate(self): - valid_os = ["Linux"] + valid_os = ["Linux", "FreeBSD"] if str(self.settings.os) not in valid_os: - raise ConanInvalidConfiguration("MinGW {} is only supported for the following operating systems: {}" - .format(self.version, valid_os)) + raise ConanInvalidConfiguration( + f"MinGW {self.version} is only supported for the following operating systems: {valid_os}" + ) valid_arch = ["x86_64"] if str(self.settings.arch) not in valid_arch: - raise ConanInvalidConfiguration("MinGW {} is only supported for the following architectures on {}: {}" - .format(self.version, str(self.settings.os), valid_arch)) - - if "gcc" in self.conan_data["sources"][self.version]: - valid_gcc = self.conan_data["sources"][self.version]["gcc"].keys() - if str(self.options.gcc) not in valid_gcc: - raise ConanInvalidConfiguration("gcc version {} is not in the list of valid versions: {}" - .format(str(self.options.gcc), valid_gcc)) + raise ConanInvalidConfiguration( + f"MinGW {self.version} is only supported for the following architectures on {str(self.settings.os)}: {valid_arch}" + ) def build_requirements(self): - self.build_requires("m4/1.4.19") - self.build_requires("gmp/6.2.1") - self.build_requires("mpfr/4.1.0") - self.build_requires("mpc/1.2.0") + self.tool_requires("m4/1.4.19") + self.tool_requires("gmp/6.3.0") + self.tool_requires("mpfr/4.2.0") + self.tool_requires("mpc/1.3.1") - def package_id(self): - del self.info.settings.compiler - del self.info.settings.build_type + def source(self): + # Source is downloaded in the build step since it depends on specific option values + pass - def _download_source(self): - arch_data = self.conan_data["sources"][self.version] + def _download_source(self, package): + self.output.info(f"Downloading {package} ...") + info = self.conan_data["sources"][self.version][package] + if package == "gcc": + info = info[str(self.options.gcc)] + destination = os.path.join(self.source_folder, package) + get(self, **info, strip_root=True, destination=destination) + return destination - for package in arch_data: - if package == "gcc": - continue - self.output.info("Downloading {} from {}".format(package, arch_data[package]['url'])) - get(self, **arch_data[package], strip_root=True, destination=os.path.join(self.build_folder, "sources", package)) - # Download gcc version - gcc_data = arch_data["gcc"][str(self.options.gcc)] - get(self, **gcc_data, strip_root=True, destination=os.path.join(self.build_folder, "sources", "gcc")) + @property + def _build_multilib(self): + # We currently cannot build with multilib and threads=posix. Otherwise we get the gcc compile error: + # checking for ld that supports -Wl,--gc-sections... configure: error: Link tests are not allowed after GCC_NO_EXECUTABLES. + # Makefile:11275: recipe for target 'configure-target-libstdc++-v3' failed + return False + + @property + def _host_tag(self): + return "x86_64-linux-gnu" @property def _target_tag(self): return "x86_64-w64-mingw32" - def build(self): - # Source should be downloaded in the build step since it depends on specific options - self._download_source() - - target_tag = self._target_tag - host_tag = "x86_64-linux-gnu" + def _get_package_root(self, p): + return self.dependencies.build[p].package_folder.replace("\\", "/") - # We currently cannot build with multilib and threads=posix. Otherwise we get the gcc compile error: - # checking for ld that supports -Wl,--gc-sections... configure: error: Link tests are not allowed after GCC_NO_EXECUTABLES. - # Makefile:11275: recipe for target 'configure-target-libstdc++-v3' failed - build_multilib = False + @property + def _with_gmp_mpfr_mpc(self): + return [ + f"--with-gmp={self._get_package_root('gmp')}", + f"--with-mpfr={self._get_package_root('mpfr')}", + f"--with-mpc={self._get_package_root('mpc')}", + ] + def generate(self): # Instructions see: # https://sourceforge.net/p/mingw-w64/code/HEAD/tree/trunk/mingw-w64-doc/howto-build/mingw-w64-howto-build.txt # and @@ -85,202 +116,228 @@ def build(self): # also good to see specific commands: # https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/+/lollipop-dev/build-mingw64-toolchain.sh - # add binutils to path. Required for gcc build - env = {"PATH": os.environ["PATH"] + ":" + os.path.join(self.package_folder, "bin")} + # Add binutils to path. Required for gcc build. + env = Environment() + env.append_path("PATH", os.path.join(self.package_folder, "bin")) + env.vars(self).save_script("conanbuild_package_bin_path") - with tools.environment_append(env): - with_gmp_mpfc_mpc = [ - "--with-gmp={}".format(self.deps_cpp_info["gmp"].rootpath.replace("\\", "/")), - "--with-mpfr={}".format(self.deps_cpp_info["mpfr"].rootpath.replace("\\", "/")), - "--with-mpc={}".format(self.deps_cpp_info["mpc"].rootpath.replace("\\", "/")) + venv = VirtualBuildEnv(self) + venv.generate() + + deps = PkgConfigDeps(self) + deps.generate() + + self.output.info("Generating for binutils ...") + tc = AutotoolsToolchain(self, namespace="binutils") + tc.configure_args += [ + f"--target={self._target_tag}", + f"--with-sysroot={self.package_folder}", + "--enable-silent-rules", + "--disable-nls", + "--disable-shared", + ] + if self._build_multilib: + tc.configure_args.append("--enable-targets=x86_64-w64-mingw32,i686-w64-mingw32") + tc.configure_args.extend(self._with_gmp_mpfr_mpc) + tc.generate() + + self.output.info("Generating for mingw-w64-tools ...") + tc = AutotoolsToolchain(self, namespace="mingw-w64-tools") + tc.configure_args += [ + f"--target={self._target_tag}" + ] + tc.generate() + + self.output.info("Generating for mingw-w64-headers ...") + tc = AutotoolsToolchain(self, namespace="mingw-w64-headers") + tc.configure_args += [ + f"--host={self._target_tag}", + f"--build={self._host_tag}", + f"--prefix=/{self._target_tag}", + f"--with-widl={os.path.join(self.package_folder, 'bin')}", + "--enable-silent-rules", + "--enable-sdk=all", + ] + tc.generate() + + self.output.info("Generating for core gcc ...") + tc = AutotoolsToolchain(self, namespace="gcc") + tc.configure_args += [ + f"--target={self._target_tag}", + f"--with-sysroot={self.package_folder}", + "--disable-shared", + "--enable-silent-rules", + "--enable-languages=c,c++", + ] + if self._build_multilib: + tc.configure_args.append("--enable-targets=all") + tc.configure_args.append("--enable-multilib") + else: + tc.configure_args.append("--disable-multilib") + tc.configure_args.extend(self._with_gmp_mpfr_mpc) + if self.options.exception == "sjlj": + tc.configure_args.append("--enable-sjlj-exceptions") + if self.options.threads == "posix": + # Some specific options which need to be set for posix thread. Otherwise it fails to compile. + tc.configure_args.extend([ + "--enable-silent-rules", + "--enable-threads=posix", + # Not 100% sure why, but the following options are required, otherwise + # gcc fails to build with posix threads + ]) + tc.libs = [] + tc.generate() + + self.output.info("Generating for mingw-w64-crt ...") + tc = AutotoolsToolchain(self, namespace="mingw-w64-crt") + tc.configure_args += [ + f"--host={self._target_tag}", + f"--prefix=/{self._target_tag}", + f"--with-sysroot={self.package_folder}", + f"CC={self._target_tag}-gcc", + f"CXX={self._target_tag}-g++", + "--enable-silent-rules", + ] + if self._build_multilib: + tc.configure_args.append("--enable-lib32") + tc.generate() + + if self.options.threads == "posix": + self.output.info("Generating for mingw-w64-libraries-winpthreads ...") + tc = AutotoolsToolchain(self, namespace="mingw-w64-libraries-winpthreads") + tc.configure_args += [ + f"--host={self._target_tag}", + f"--prefix=/{self._target_tag}", + f"CC={self._target_tag}-gcc", + f"CXX={self._target_tag}-g++", + "--enable-silent-rules", + "--disable-shared", ] + tc.generate() - self.output.info("Building binutils ...") - mkdir(self, os.path.join(self.build_folder, "binutils")) - with chdir(self, os.path.join(self.build_folder, "binutils")): - autotools = AutoToolsBuildEnvironment(self) - conf_args = [ - "--enable-silent-rules", - "--with-sysroot={}".format(self.package_folder), - "--disable-nls", - "--disable-shared" - ] - if build_multilib: - conf_args.append("--enable-targets=x86_64-w64-mingw32,i686-w64-mingw32") - conf_args.extend(with_gmp_mpfc_mpc) - autotools.configure(configure_dir=os.path.join(self.build_folder, "sources", "binutils"), - args=conf_args, target=target_tag, host=False, build=False) - autotools.make() - autotools.install() + @contextmanager + def _build_namespace(self, namespace): + self.output.info(f"Building {namespace} ...") + build_dir = os.path.join(self.build_folder, namespace) + mkdir(self, build_dir) + with chdir(self, build_dir): + yield Autotools(self, namespace=namespace) - self.output.info("Building mingw-w64-tools ...") - mkdir(self, os.path.join(self.build_folder, "mingw-w64-tools")) - with chdir(self, os.path.join(self.build_folder, "mingw-w64-tools")): - autotools = AutoToolsBuildEnvironment(self) - conf_args = [] - autotools.configure(configure_dir=os.path.join(self.build_folder, "sources", "mingw-w64", "mingw-w64-tools", "widl"), - args=conf_args, target=target_tag, host=False, build=False) - autotools.make() - autotools.install() + def build(self): + binutils_source = self._download_source("binutils") + with self._build_namespace("binutils") as autotools: + autotools.configure(binutils_source) + autotools.make() + autotools.install() - self.output.info("Building mingw-w64-headers ...") - mkdir(self, os.path.join(self.build_folder, "mingw-w64-headers")) - with chdir(self, os.path.join(self.build_folder, "mingw-w64-headers")): - autotools = AutoToolsBuildEnvironment(self) - conf_args = [ - "--enable-silent-rules", - "--with-widl={}".format(os.path.join(self.package_folder, "bin")), - "--enable-sdk=all", - "--prefix={}".format(os.path.join(self.package_folder, target_tag)) - ] - autotools.configure(configure_dir=os.path.join(self.build_folder, "sources", "mingw-w64", "mingw-w64-headers"), - args=conf_args, target=False, host=target_tag, build=host_tag) + mingw_w64_source = self._download_source("mingw-w64") + with self._build_namespace("mingw-w64-tools") as autotools: + autotools.configure(os.path.join(mingw_w64_source, "mingw-w64-tools", "widl")) + autotools.make() + autotools.install() + + with self._build_namespace("mingw-w64-headers") as autotools: + autotools.configure(os.path.join(mingw_w64_source, "mingw-w64-headers")) + autotools.make() + autotools.install() + + # Step 3) GCC requires the x86_64-w64-mingw32 directory be mirrored as a + # directory 'mingw' in the same root. So, if using configure default + # /usr/local, type: + # ln -s /usr/local/x86_64-w64-mingw32 /usr/local/mingw + # or, for sysroot, type: + # ln -s /mypath/x86_64-w64-mingw32 /mypath/mingw + with chdir(self, self.package_folder): + os.symlink(self._target_tag, "mingw") + + # Step 5) Symlink x86_64-w64-mingw32/lib directory as x86_64-w64-mingw32/lib64: + # ln -s /usr/local/x86_64-w64-mingw32/lib /usr/local/x86_64-w64-mingw32/lib64 + # or, for sysroot: + # ln -s /mypath/x86_64-w64-mingw32/lib /mypath/x86_64-w64-mingw32/lib64 + with chdir(self, os.path.join(self.package_folder, self._target_tag)): + os.symlink("lib", "lib64") + + gcc_source = self._download_source("gcc") + with self._build_namespace("gcc") as autotools: + autotools.configure(gcc_source) + autotools.make(target="all-gcc") + autotools.install(target="install-gcc") + + with self._build_namespace("mingw-w64-crt") as autotools: + autotools.configure(os.path.join(mingw_w64_source, "mingw-w64-crt")) + autotools.make() + autotools.install() + + if self.options.threads == "posix": + with self._build_namespace("mingw-w64-libraries-winpthreads") as autotools: + autotools.configure(os.path.join(mingw_w64_source, "mingw-w64-libraries", "winpthreads")) autotools.make() autotools.install() - # Step 3) GCC requires the x86_64-w64-mingw32 directory be mirrored as a - # directory 'mingw' in the same root. So, if using configure default - # /usr/local, type: - # ln -s /usr/local/x86_64-w64-mingw32 /usr/local/mingw - # or, for sysroot, type: - # ln -s /mypath/x86_64-w64-mingw32 /mypath/mingw - self.run("ln -s {} {}".format(os.path.join(self.package_folder, target_tag), - os.path.join(self.package_folder, 'mingw'))) - # Step 5) Symlink x86_64-w64-mingw32/lib directory as x86_64-w64-mingw32/lib64: - # ln -s /usr/local/x86_64-w64-mingw32/lib /usr/local/x86_64-w64-mingw32/lib64 - # or, for sysroot: - # ln -s /mypath/x86_64-w64-mingw32/lib /mypath/x86_64-w64-mingw32/lib64 - self.run("ln -s {} {}".format(os.path.join(self.package_folder, target_tag, 'lib'), - os.path.join(self.package_folder, target_tag, 'lib64'))) - - self.output.info("Building core gcc ...") - mkdir(self, os.path.join(self.build_folder, "gcc")) - with chdir(self, os.path.join(self.build_folder, "gcc")): - autotools_gcc = AutoToolsBuildEnvironment(self) - conf_args = [ - "--enable-silent-rules", - "--enable-languages=c,c++", - "--with-sysroot={}".format(self.package_folder), - "--disable-shared" - ] - if build_multilib: - conf_args.append("--enable-targets=all") - conf_args.append("--enable-multilib") - else: - conf_args.append("--disable-multilib") - conf_args.extend(with_gmp_mpfc_mpc) - if self.options.exception == "sjlj": - conf_args.append("--enable-sjlj-exceptions") - if self.options.threads == "posix": - # Some specific options which need to be set for posix thread. Otherwise it fails compiling. - conf_args.extend([ - "--enable-silent-rules", - "--enable-threads=posix", - # Not 100% sure why, but the following options are required, otherwise - # gcc fails to build with posix threads - ]) - autotools_gcc.libs = [] - autotools_gcc.configure(configure_dir=os.path.join(self.build_folder, "sources", "gcc"), - args=conf_args, target=target_tag, host=False, build=False) - autotools_gcc.make(target="all-gcc") - autotools_gcc.make(target="install-gcc") - - env_compiler = dict(env) - # The CC and CXX compiler must be set to the mingw compiler. Conan already sets CC and CXX, therefore we need to overwrite it. - # If the wrong compiler is used for mingw-w64-crt, then you will get the error - # configure: Please check if the mingw-w64 header set and the build/host option are set properly. - env_compiler["CC"] = target_tag + "-gcc" - env_compiler["CXX"] = target_tag + "-g++" - with tools.environment_append(env_compiler): - self.output.info("Building mingw-w64-crt ...") - mkdir(self, os.path.join(self.build_folder, "mingw-w64-crt")) - with chdir(self, os.path.join(self.build_folder, "mingw-w64-crt")): - autotools = AutoToolsBuildEnvironment(self) - conf_args = [ - "--enable-silent-rules", - "--prefix={}".format(os.path.join(self.package_folder, target_tag)), - "--with-sysroot={}".format(self.package_folder) - ] - if build_multilib: - conf_args.append("--enable-lib32") - autotools.configure(configure_dir=os.path.join(self.build_folder, "sources", "mingw-w64", "mingw-w64-crt"), - args=conf_args, target=False, host=target_tag, build=False, - use_default_install_dirs=False) - autotools.make() - autotools.install() - - if self.options.threads == "posix": - self.output.info("Building mingw-w64-libraries-winpthreads ...") - mkdir(self, os.path.join(self.build_folder, "mingw-w64-libraries-winpthreads")) - with chdir(self, os.path.join(self.build_folder, "mingw-w64-libraries-winpthreads")): - autotools = AutoToolsBuildEnvironment(self) - conf_args = [ - "--enable-silent-rules", - "--disable-shared", - "--prefix={}".format(os.path.join(self.package_folder, target_tag)) - ] - autotools.configure(configure_dir=os.path.join(self.build_folder, "sources", "mingw-w64", "mingw-w64-libraries", "winpthreads"), - args=conf_args, target=False, host=target_tag, build=False) - autotools.make() - autotools.install() - - self.output.info("Building libgcc ...") - with chdir(self, os.path.join(self.build_folder, "gcc")): - autotools_gcc.make() - autotools_gcc.install() + + with self._build_namespace("gcc") as autotools: + autotools.make() + autotools.install() self.output.info("Building done!") def package(self): - self.copy("COPYING", src=os.path.join(self.build_folder, "sources", "mingw-w64"), dst="licenses") + copy(self, "COPYING", + src=os.path.join(self.source_folder, "mingw-w64"), + dst=os.path.join(self.package_folder, "licenses")) rm(self, "*.la", self.package_folder, recursive=True) rmdir(self, os.path.join(self.package_folder, "share", "man")) rmdir(self, os.path.join(self.package_folder, "share", "doc")) rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) - # replace with relative symlinks so they'll resolve correctly on consumer's machine - os.unlink(os.path.join(self.package_folder, 'mingw')) - os.unlink(os.path.join(self.package_folder, self._target_tag, 'lib64')) - self.run("ln -s {} {}".format(os.path.join(os.curdir, self._target_tag), - os.path.join(self.package_folder, 'mingw'))) - self.run("ln -s {} {}".format(os.path.join(os.curdir, 'lib'), - os.path.join(self.package_folder, self._target_tag, 'lib64'))) def package_info(self): + self.cpp_info.frameworkdirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] + self.cpp_info.includedirs = [] + if getattr(self, "settings_target", None): if self.settings_target.compiler != "gcc": - raise ConanInvalidConfiguration("Only GCC is allowed as compiler.") + self.output.warning("Only GCC is allowed as the compiler.") if str(self.settings_target.compiler.threads) != str(self.options.threads): - raise ConanInvalidConfiguration("Build requires 'mingw' provides binaries for gcc " - "with threads={}, your profile:host declares " - "threads={}, please use the same value for both." - .format(self.options.threads, - self.settings_target.compiler.threads)) + self.output.warning( + f"Build requires 'mingw' provides binaries for gcc with threads={self.options.threads}," + f" your profile:host declares threads={self.settings_target.compiler.threads}," + " please use the same value for both." + ) if str(self.settings_target.compiler.exception) != str(self.options.exception): - raise ConanInvalidConfiguration("Build requires 'mingw' provides binaries for gcc " - "with exception={}, your profile:host declares " - "exception={}, please use the same value for both." - .format(self.options.exception, - self.settings_target.compiler.exception)) + self.output.warning( + f"Build requires 'mingw' provides binaries for gcc with exception={self.options.exception}," + f" your profile:host declares exception={self.settings_target.compiler.exception}," + " please use the same value for both." + ) bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH env var with : {}".format(bin_path)) + prefix = os.path.join(bin_path, self._target_tag + "-") + + self.buildenv_info.prepend_path("PATH", bin_path) self.env_info.PATH.append(bin_path) - self.env_info.MINGW_HOME = str(self.package_folder) - - prefix = os.path.join(self.package_folder, "bin", self._target_tag + "-") - self.env_info.CC = prefix + "gcc" - self.env_info.CXX = prefix + "g++" - self.env_info.CPP = prefix + "cpp" - self.env_info.AR = prefix + "ar" - self.env_info.AS = prefix + "as" - self.env_info.GDB = prefix + "gdb" - self.env_info.LD = prefix + "ld" - self.env_info.NM = prefix + "nm" - self.env_info.OBJCOPY = prefix + "objcopy" - self.env_info.OBJDUMP = prefix + "objdump" - self.env_info.RANLIB = prefix + "ranlib" - self.env_info.SIZE = prefix + "size" - self.env_info.STRINGS = prefix + "strings" - self.env_info.STRIP = prefix + "strip" - self.env_info.GCOV = prefix + "gcov" - self.env_info.RC = prefix + "windres" - self.env_info.DLLTOOL = prefix + "dlltool" + + self.buildenv_info.define_path("MINGW_HOME", self.package_folder) + self.env_info.MINGW_HOME = self.package_folder + + def define_tool_env(var, name): + self.buildenv_info.define_path(var, prefix + name) + setattr(self.env_info, var, prefix + name) + + define_tool_env("CC", "gcc") + define_tool_env("CXX", "g++") + define_tool_env("CPP", "cpp") + define_tool_env("AR", "ar") + define_tool_env("AS", "as") + define_tool_env("GDB", "gdb") + define_tool_env("LD", "ld") + define_tool_env("NM", "nm") + define_tool_env("OBJCOPY", "objcopy") + define_tool_env("OBJDUMP", "objdump") + define_tool_env("RANLIB", "ranlib") + define_tool_env("SIZE", "size") + define_tool_env("STRINGS", "strings") + define_tool_env("STRIP", "strip") + define_tool_env("GCOV", "gcov") + define_tool_env("RC", "windres") + define_tool_env("DLLTOOL", "dlltool") diff --git a/recipes/mingw-w64/linux/test_package/conanfile.py b/recipes/mingw-w64/linux/test_package/conanfile.py index b6ef323de8d96..300783c0da9a5 100644 --- a/recipes/mingw-w64/linux/test_package/conanfile.py +++ b/recipes/mingw-w64/linux/test_package/conanfile.py @@ -1,16 +1,19 @@ import os from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run class MinGWTestConan(ConanFile): - generators = "gcc" settings = "os", "arch", "compiler", "build_type" + generators = "VirtualBuildEnv" + + def build_requirements(self): + self.tool_requires(self.tested_reference_str) def build(self): source_file = os.path.join(self.source_folder, "main.cpp") - self.run("x86_64-w64-mingw32-g++ {} @conanbuildinfo.gcc -lstdc++ -o main".format(source_file), run_environment=True) + self.run(f"x86_64-w64-mingw32-g++ {source_file} -lstdc++ -o main", env="conanbuild") def test(self): - if not cross_building(self): - self.run("x86_64-w64-mingw32-g++ --version", run_environment=True) + if can_run(self): + self.run("x86_64-w64-mingw32-g++ --version", env="conanbuild") diff --git a/recipes/mingw-w64/linux/test_v1_package/conanfile.py b/recipes/mingw-w64/linux/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..13c18e19957ac --- /dev/null +++ b/recipes/mingw-w64/linux/test_v1_package/conanfile.py @@ -0,0 +1,16 @@ +import os +from conan import ConanFile +from conan.tools.build import cross_building + + +class MinGWTestConan(ConanFile): + generators = "gcc" + settings = "os", "arch", "compiler", "build_type" + + def build(self): + source_file = os.path.join(self.source_folder, os.pardir, "test_package", "main.cpp") + self.run(f"x86_64-w64-mingw32-g++ {source_file} @conanbuildinfo.gcc -lstdc++ -o main", run_environment=True) + + def test(self): + if not cross_building(self): + self.run("x86_64-w64-mingw32-g++ --version", run_environment=True) diff --git a/recipes/minhook/all/conandata.yml b/recipes/minhook/all/conandata.yml new file mode 100644 index 0000000000000..9fbac6aa78698 --- /dev/null +++ b/recipes/minhook/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.3.3.cci.20240629": + url: "https://github.com/TsudaKageyu/minhook/archive/91cc9466e383d13a43d7cf33c7c8fdccb27095d3.tar.gz" + sha256: "b84b2ff19afe5fb9430948680146bee2e198392ee6333a71f81e339c36a819f1" diff --git a/recipes/minhook/all/conanfile.py b/recipes/minhook/all/conanfile.py new file mode 100644 index 0000000000000..73c08a93a80d6 --- /dev/null +++ b/recipes/minhook/all/conanfile.py @@ -0,0 +1,69 @@ +import os + +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, rmdir + +required_conan_version = ">=1.53.0" + + +class PackageConan(ConanFile): + name = "minhook" + description = "The Minimalistic x86/x64 API Hooking Library for Windows" + license = "BSD-2-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/TsudaKageyu/minhook" + topics = ("hook", "windows") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + } + default_options = { + "shared": False, + } + + def configure(self): + # minhook is a plain C projects + 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": + raise ConanInvalidConfiguration(f"{self.ref} can only be built on Windows.") + + if self.settings.arch not in ["x86", "x86_64"]: + raise ConanInvalidConfiguration(f"{self.ref} can only be built on x86 or x86_64 architectures.") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + deps = CMakeDeps(self) + deps.generate() + tc = CMakeToolchain(self) + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE.txt", self.source_folder, os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + + rmdir(self, os.path.join(self.package_folder, "lib", "minhook")) + + def package_info(self): + if self.settings.arch == "x86_64": + postfix = ".x64d" if self.settings.build_type == "Debug" else ".x64" + else: + postfix = ".x32d" if self.settings.build_type == "Debug" else ".x32" + + self.cpp_info.libs = [f"minhook{postfix}"] diff --git a/recipes/minhook/all/test_package/CMakeLists.txt b/recipes/minhook/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..a090c65f0323b --- /dev/null +++ b/recipes/minhook/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) + +project(test_package LANGUAGES CXX) + +find_package(minhook REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE minhook::minhook) diff --git a/recipes/minhook/all/test_package/conanfile.py b/recipes/minhook/all/test_package/conanfile.py new file mode 100644 index 0000000000000..d7de1f914ce42 --- /dev/null +++ b/recipes/minhook/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/minhook/all/test_package/test_package.cpp b/recipes/minhook/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..95ccf7f207da6 --- /dev/null +++ b/recipes/minhook/all/test_package/test_package.cpp @@ -0,0 +1,75 @@ +#include + +#include + +#include "MinHook.h" + +typedef int(WINAPI *MESSAGEBOXW)(HWND, LPCWSTR, LPCWSTR, UINT); + +// Pointer for calling original MessageBoxW. +MESSAGEBOXW fpMessageBoxW = NULL; + +// Dummy MessageBox function for testing. +int WINAPI DummyMessageBoxW(HWND hWnd, LPCWSTR lpText, LPCWSTR lpCaption, UINT uType) +{ + const int box_width = 40; + std::wstring text(lpText); + std::wstring caption(lpCaption); + + // Top border + std::wcout << "+" << std::wstring(box_width - 2, '-') << "+\n"; + + // Caption + std::wcout << "| " << caption << std::wstring(box_width - 3 - caption.size(), ' ') << "|\n"; + std::wcout << "| " << std::wstring(box_width - 4, '=') << " |\n"; + + // Text + std::wcout << "| " << text << std::wstring(box_width - 3 - text.size(), ' ') << "|\n"; + + // Bottom border + std::wcout << "+" << std::wstring(box_width - 2, '-') << "+\n"; + + return IDOK; // The OK button was selected. +} + +// Detour function which overrides MessageBoxW. +int WINAPI DetourMessageBoxW(HWND hWnd, LPCWSTR lpText, LPCWSTR lpCaption, UINT uType) +{ + return fpMessageBoxW(hWnd, L"Hooked!", lpCaption, uType); +} + +int main() +{ + // Initialize MinHook. + if (MH_Initialize() != MH_OK) { + return 1; + } + + // Create a hook for MessageBoxW, in disabled state. + if (MH_CreateHook(&DummyMessageBoxW, &DetourMessageBoxW, reinterpret_cast(&fpMessageBoxW)) != MH_OK) { + return 1; + } + + // Enable the hook for MessageBoxW. + if (MH_EnableHook(&DummyMessageBoxW) != MH_OK) { + return 1; + } + + // Expected to tell "Hooked!". + DummyMessageBoxW(NULL, L"Not hooked...", L"MinHook Sample", MB_OK); + + // Disable the hook for MessageBoxW. + if (MH_DisableHook(&DummyMessageBoxW) != MH_OK) { + return 1; + } + + // Expected to tell "Not hooked...". + DummyMessageBoxW(NULL, L"Not hooked...", L"MinHook Sample", MB_OK); + + // Uninitialize MinHook. + if (MH_Uninitialize() != MH_OK) { + return 1; + } + + return 0; +} diff --git a/recipes/minhook/config.yml b/recipes/minhook/config.yml new file mode 100644 index 0000000000000..36b74a86356a1 --- /dev/null +++ b/recipes/minhook/config.yml @@ -0,0 +1,3 @@ +versions: + "1.3.3.cci.20240629": + folder: all diff --git a/recipes/mini/all/conandata.yml b/recipes/mini/all/conandata.yml new file mode 100644 index 0000000000000..5c54e75793e6e --- /dev/null +++ b/recipes/mini/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "0.9.16": + url: "https://github.com/metayeti/mINI/archive/refs/tags/0.9.16.tar.gz" + sha256: "ce20e12b1e3bcd79d6eaa47bf8d4bb319e843dfa3585e069e73d581bdf0a81ec" + "0.9.15": + url: "https://github.com/metayeti/mINI/archive/refs/tags/0.9.15.tar.gz" + sha256: "241e105ab074827ab8b40582aa7b04c6191f84b244603969965c0874ad4f942c" diff --git a/recipes/mini/all/conanfile.py b/recipes/mini/all/conanfile.py new file mode 100644 index 0000000000000..938a8179ad53f --- /dev/null +++ b/recipes/mini/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.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 MiniConan(ConanFile): + name = "mini" + description = "INI file reader and writer" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/metayeti/mINI" + topics = ("ini", "writer", "reader", "header-only") + package_type = "header-library" + 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": "191", + "gcc": "5", + "clang": "5", + "apple-clang": "5.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"): + 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="*.h", + 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/mini/all/test_package/CMakeLists.txt b/recipes/mini/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..b1d6d15b13411 --- /dev/null +++ b/recipes/mini/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(mini REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE mini::mini) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/mini/all/test_package/conanfile.py b/recipes/mini/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/mini/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/mini/all/test_package/test_package.cpp b/recipes/mini/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..ee74c82e08d01 --- /dev/null +++ b/recipes/mini/all/test_package/test_package.cpp @@ -0,0 +1,10 @@ +#include + +#include "mini/ini.h" + +int main(void) { + mINI::INIFile file("test_package.ini"); + + std::cout << "mini test successful \n"; + return 0; +} diff --git a/recipes/mini/config.yml b/recipes/mini/config.yml new file mode 100644 index 0000000000000..8e233bb2eb4ca --- /dev/null +++ b/recipes/mini/config.yml @@ -0,0 +1,5 @@ +versions: + "0.9.16": + folder: all + "0.9.15": + folder: all diff --git a/recipes/miniaudio/all/conandata.yml b/recipes/miniaudio/all/conandata.yml index 49cc53a5d3381..061502ec47da0 100644 --- a/recipes/miniaudio/all/conandata.yml +++ b/recipes/miniaudio/all/conandata.yml @@ -1,4 +1,16 @@ sources: + "0.11.21": + url: "https://github.com/mackron/miniaudio/archive/0.11.21.tar.gz" + sha256: "6afb5c231613d2fab4f1c668b7243ff9a7d6d78a7f5a2692c133f026fe508506" + "0.11.18": + url: "https://github.com/mackron/miniaudio/archive/0.11.18.tar.gz" + sha256: "85ca916266d809b39902e180a6d16f82caea9c2ea1cea6d374413641b7ba48c3" + "0.11.17": + url: "https://github.com/mackron/miniaudio/archive/0.11.17.tar.gz" + sha256: "4b139065f7068588b73d507d24e865060e942eb731f988ee5a8f1828155b9480" + "0.11.16": + url: "https://github.com/mackron/miniaudio/archive/refs/tags/0.11.16.tar.gz" + sha256: "13320464820491c61bd178b95818fecb7cd0e68f9677d61e1345df6be8d4d77e" "0.11.11": url: "https://github.com/mackron/miniaudio/archive/a0dc1037f99a643ff5fad7272cd3d6461f2d63fa.tar.gz" sha256: "4821e2f796d95b772fd4ef1274181d5302854bfe55680125a5cd9b24b8542dcf" diff --git a/recipes/miniaudio/all/conanfile.py b/recipes/miniaudio/all/conanfile.py index 599f3c0195bdc..7eabe4511f13d 100644 --- a/recipes/miniaudio/all/conanfile.py +++ b/recipes/miniaudio/all/conanfile.py @@ -13,6 +13,7 @@ class MiniaudioConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/mackron/miniaudio" topics = ("audio", "header-only", "sound") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -47,11 +48,11 @@ def layout(self): cmake_layout(self, src_folder="src") def package_id(self): - if self.options.header_only: + if self.info.options.header_only: 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): if self.options.header_only: @@ -113,4 +114,3 @@ def package_info(self): self.cpp_info.libs = ["miniaudio"] if self.options.shared: self.cpp_info.defines.append("MA_DLL") - diff --git a/recipes/miniaudio/all/test_package/CMakeLists.txt b/recipes/miniaudio/all/test_package/CMakeLists.txt index b334a63d0191a..a7a69182169b3 100644 --- a/recipes/miniaudio/all/test_package/CMakeLists.txt +++ b/recipes/miniaudio/all/test_package/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.1) project(test_package LANGUAGES C) -find_package(miniaudio REQUIRED) +find_package(miniaudio REQUIRED CONFIG) -add_executable(${PROJECT_NAME} example.c) -target_link_libraries(${PROJECT_NAME} miniaudio::miniaudio) +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE miniaudio::miniaudio) diff --git a/recipes/miniaudio/all/test_package/example.c b/recipes/miniaudio/all/test_package/test_package.c similarity index 100% rename from recipes/miniaudio/all/test_package/example.c rename to recipes/miniaudio/all/test_package/test_package.c diff --git a/recipes/miniaudio/all/test_v1_package/conanfile.py b/recipes/miniaudio/all/test_v1_package/conanfile.py index 5a05af3c2dfd2..0f735b51a2642 100644 --- a/recipes/miniaudio/all/test_v1_package/conanfile.py +++ b/recipes/miniaudio/all/test_v1_package/conanfile.py @@ -1,5 +1,4 @@ -from conans import ConanFile, CMake -from conan.tools.build import cross_building +from conans import ConanFile, CMake, tools import os @@ -13,6 +12,6 @@ def build(self): cmake.build() def test(self): - if not cross_building(self): + if not tools.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 52824dc107878..4db3fb9d24db2 100644 --- a/recipes/miniaudio/config.yml +++ b/recipes/miniaudio/config.yml @@ -1,4 +1,12 @@ versions: + "0.11.21": + folder: all + "0.11.18": + folder: all + "0.11.17": + folder: all + "0.11.16": + folder: all "0.11.11": folder: all "0.11.9": diff --git a/recipes/minicoro/all/conandata.yml b/recipes/minicoro/all/conandata.yml new file mode 100644 index 0000000000000..26ecba7b50b2a --- /dev/null +++ b/recipes/minicoro/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.1.3": + url: "https://github.com/edubart/minicoro/archive/refs/tags/v0.1.3.tar.gz" + sha256: "4f9d4c3b5f6473f8141ee45e9947a6e7e7ee6665b4d9a8c373c0602495c5f6c9" diff --git a/recipes/minicoro/all/conanfile.py b/recipes/minicoro/all/conanfile.py new file mode 100644 index 0000000000000..77385609248b9 --- /dev/null +++ b/recipes/minicoro/all/conanfile.py @@ -0,0 +1,40 @@ +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 PackageConan(ConanFile): + name = "minicoro" + description = "Single header stackful cross-platform coroutine library in pure C" + license = ("Unlicense", "MIT-0") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/edubart/minicoro" + topics = ("lua", "coroutine", "fibers", "header-only") + package_type = "header-library" + 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], 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, "*.h", self.source_folder, os.path.join(self.package_folder, "include", "minicoro")) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.includedirs.append(os.path.join("include", "minicoro")) diff --git a/recipes/minicoro/all/test_package/CMakeLists.txt b/recipes/minicoro/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..2862cc4744006 --- /dev/null +++ b/recipes/minicoro/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) + +find_package(minicoro REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE minicoro::minicoro) diff --git a/recipes/minicoro/all/test_package/conanfile.py b/recipes/minicoro/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/minicoro/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/minicoro/all/test_package/test_package.c b/recipes/minicoro/all/test_package/test_package.c new file mode 100644 index 0000000000000..5c333058e9350 --- /dev/null +++ b/recipes/minicoro/all/test_package/test_package.c @@ -0,0 +1,22 @@ +#define MINICORO_IMPL +#include "minicoro.h" + +#include +#include +#include + +void coro_entry(mco_coro* co) { + printf("coroutine 1\n"); + mco_yield(co); + printf("coroutine 2\n"); +} + +int main(void) { + mco_desc desc = mco_desc_init(coro_entry, 0); + desc.user_data = NULL; + mco_coro* co; + mco_create(&co, &desc); + mco_destroy(co); + + return EXIT_SUCCESS; +} diff --git a/recipes/minicoro/config.yml b/recipes/minicoro/config.yml new file mode 100644 index 0000000000000..b7f57204004e4 --- /dev/null +++ b/recipes/minicoro/config.yml @@ -0,0 +1,3 @@ +versions: + "0.1.3": + folder: all diff --git a/recipes/minimp3/all/conandata.yml b/recipes/minimp3/all/conandata.yml index f86679db763b3..f9521b04b54c6 100644 --- a/recipes/minimp3/all/conandata.yml +++ b/recipes/minimp3/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "cci.20211201": + url: "https://github.com/lieff/minimp3/archive/afb604c06bc8beb145fecd42c0ceb5bda8795144.zip" + sha256: "94f847efbb83349ed38dd05888e54bdd8dc6d7bbc3616efd4a1ac899a16bb82e" "20200304": url: "https://github.com/lieff/minimp3/archive/55da78cbeea5fb6757f8df672567714e1e8ca3e9.zip" sha256: "108074684c080a34f0d08f23a709128ea518d48651c8381bce91b73b29185479" diff --git a/recipes/minimp3/all/conanfile.py b/recipes/minimp3/all/conanfile.py index 6886956b3c461..b188314ed0522 100644 --- a/recipes/minimp3/all/conanfile.py +++ b/recipes/minimp3/all/conanfile.py @@ -10,21 +10,21 @@ class Minimp3Conan(ConanFile): name = "minimp3" description = "Minimalistic MP3 decoder single header library." license = "CC0-1.0" - topics = ("minimp3", "decoder", "mp3", "header-only") - homepage = "https://github.com/lieff/minimp3" + topics = ("decoder", "mp3", "header-only") url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/lieff/minimp3" + package_type = "header-library" 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 @@ -35,6 +35,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/minimp3/all/test_package/conanfile.py b/recipes/minimp3/all/test_package/conanfile.py index d120a992c06a6..8a5bb47f50c4c 100644 --- a/recipes/minimp3/all/test_package/conanfile.py +++ b/recipes/minimp3/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/minimp3/config.yml b/recipes/minimp3/config.yml index d49b70495df47..242cda7011c1f 100644 --- a/recipes/minimp3/config.yml +++ b/recipes/minimp3/config.yml @@ -1,4 +1,6 @@ versions: + "cci.20211201": + folder: all "20200304": folder: all "20200221": diff --git a/recipes/minio-cpp/all/conandata.yml b/recipes/minio-cpp/all/conandata.yml new file mode 100644 index 0000000000000..22b7a6392d759 --- /dev/null +++ b/recipes/minio-cpp/all/conandata.yml @@ -0,0 +1,9 @@ +sources: + "0.3.0": + url: "https://github.com/minio/minio-cpp/archive/refs/tags/v0.3.0.tar.gz" + sha256: "da0f2f54bf169ad9e5e9368cc9143df4db056fc5c05bb55d8c1d9065e7211f7c" +patches: + "0.3.0": + - patch_file: "patches/0.3.0-0001-fix-fpic-cmake.patch" + patch_description: "Honor fPIC option in CMakeLists.txt" + patch_type: "conan" diff --git a/recipes/minio-cpp/all/conanfile.py b/recipes/minio-cpp/all/conanfile.py new file mode 100644 index 0000000000000..4a2fe5179d9aa --- /dev/null +++ b/recipes/minio-cpp/all/conanfile.py @@ -0,0 +1,106 @@ +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 MinioCppConan(ConanFile): + name = "minio-cpp" + description = "MinIO C++ Client SDK for Amazon S3 Compatible Cloud Storage" + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/minio/minio-cpp" + topics = ("minio", "s3", "storage") + package_type = "static-library" + 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": "8", + "clang": "7", + "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 layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires("curlpp/0.8.1.cci.20240530", transitive_headers=True) + self.requires("inih/58") + self.requires("nlohmann_json/3.11.3", transitive_headers=True) + self.requires("openssl/[>=1.1 <4]") + self.requires("pugixml/1.14") + self.requires("zlib/[>=1.2.11 <2]") + + 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." + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.generate() + deps = CMakeDeps(self) + deps.set_property("curlpp", "cmake_file_name", "unofficial-curlpp") + deps.set_property("curlpp", "cmake_target_name", "unofficial::curlpp::curlpp") + deps.set_property("inih", "cmake_file_name", "unofficial-inih") + deps.set_property("inih", "cmake_target_name", "unofficial::inih::inireader") + deps.set_property("pugixml", "cmake_target_name", "pugixml") + deps.generate() + + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + 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")) + + def package_info(self): + self.cpp_info.libs = ["miniocpp"] + + self.cpp_info.set_property("cmake_file_name", "miniocpp") + self.cpp_info.set_property("cmake_target_name", "miniocpp::miniocpp") + + if self.settings.os == "Windows": + self.cpp_info.system_libs.append("wsock32") + self.cpp_info.system_libs.append("ws2_32") diff --git a/recipes/minio-cpp/all/patches/0.3.0-0001-fix-fpic-cmake.patch b/recipes/minio-cpp/all/patches/0.3.0-0001-fix-fpic-cmake.patch new file mode 100644 index 0000000000000..5c39cf7208f2e --- /dev/null +++ b/recipes/minio-cpp/all/patches/0.3.0-0001-fix-fpic-cmake.patch @@ -0,0 +1,12 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index c2610db..52bbffa 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -124,7 +124,6 @@ target_include_directories(miniocpp PUBLIC + ) + target_link_libraries(miniocpp PUBLIC ${MINIO_CPP_LIBS}) + set_target_properties(miniocpp PROPERTIES VERSION "${MINIO_CPP_VERSION_STRING}") +-set_target_properties(miniocpp PROPERTIES POSITION_INDEPENDENT_CODE ON) + + # Add a cmake alias - this is how users should use minio-cpp in their cmake projects. + add_library(miniocpp::miniocpp ALIAS miniocpp) diff --git a/recipes/minio-cpp/all/test_package/CMakeLists.txt b/recipes/minio-cpp/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..0c450d7efed7e --- /dev/null +++ b/recipes/minio-cpp/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(miniocpp REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE miniocpp::miniocpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/minio-cpp/all/test_package/conanfile.py b/recipes/minio-cpp/all/test_package/conanfile.py new file mode 100644 index 0000000000000..ef5d7042163ec --- /dev/null +++ b/recipes/minio-cpp/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/minio-cpp/all/test_package/test_package.cpp b/recipes/minio-cpp/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..76e98c39d2ecf --- /dev/null +++ b/recipes/minio-cpp/all/test_package/test_package.cpp @@ -0,0 +1,9 @@ +#include + +int main(int argc, char* argv[]) { + minio::s3::BaseUrl base_url("example.com"); + + minio::creds::StaticProvider provider("access_key", "secret_key"); + + minio::s3::Client client(base_url, &provider); +} diff --git a/recipes/minio-cpp/config.yml b/recipes/minio-cpp/config.yml new file mode 100644 index 0000000000000..d126790212e0c --- /dev/null +++ b/recipes/minio-cpp/config.yml @@ -0,0 +1,3 @@ +versions: + "0.3.0": + folder: all diff --git a/recipes/minisat/all/CMakeLists.txt b/recipes/minisat/all/CMakeLists.txt new file mode 100644 index 0000000000000..b2a136daf4fdb --- /dev/null +++ b/recipes/minisat/all/CMakeLists.txt @@ -0,0 +1,27 @@ +cmake_minimum_required(VERSION 3.15) +project(minisat LANGUAGES CXX) + +find_package(ZLIB REQUIRED) + +# no Main.cc as these are the command line tools +add_library(minisat + ${MINISAT_SRC_DIR}/core/Solver.cc + ${MINISAT_SRC_DIR}/simp/SimpSolver.cc + ${MINISAT_SRC_DIR}/utils/Options.cc + ${MINISAT_SRC_DIR}/utils/System.cc +) +target_include_directories(minisat PUBLIC ${MINISAT_SRC_DIR}) +target_link_libraries(minisat PUBLIC ZLIB::ZLIB) +set_target_properties(minisat PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON) + +include(GNUInstallDirs) +install( + TARGETS minisat + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) +install(DIRECTORY ${MINISAT_SRC_DIR}/mtl ${MINISAT_SRC_DIR}/utils ${MINISAT_SRC_DIR}/core ${MINISAT_SRC_DIR}/simp + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/minisat + FILES_MATCHING PATTERN "*.h" +) diff --git a/recipes/minisat/all/conandata.yml b/recipes/minisat/all/conandata.yml new file mode 100644 index 0000000000000..640607063ff26 --- /dev/null +++ b/recipes/minisat/all/conandata.yml @@ -0,0 +1,14 @@ +sources: + "2.2.0": + url: "https://github.com/niklasso/minisat/archive/refs/tags/releases/2.2.0.tar.gz" + sha256: "3ed44da999744c0a1be269df23c3ed8731cdb83c44a4f3aa29b3d6859bb2a4da" +patches: + "2.2.0": + - patch_file: "patches/0001-drop-default-arg-in-friend-declaration-2.2.0.patch" + patch_description: "drop default argument in friend declaration" + patch_type: portability + patch_source: "https://github.com/niklasso/minisat/commit/9256ff36d29cee13fc806dec212ba4309d1cb0d4" + - patch_file: "patches/0002-suffix-literal-2.2.0.patch" + patch_description: "add spaces before user literals" + patch_type: portability + patch_source: "https://github.com/conp-solutions/mergesat/commit/18e138e0b9130833549070dcff9de64ca6ae1f7a" diff --git a/recipes/minisat/all/conanfile.py b/recipes/minisat/all/conanfile.py new file mode 100644 index 0000000000000..fdfbb6316a963 --- /dev/null +++ b/recipes/minisat/all/conanfile.py @@ -0,0 +1,71 @@ +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 MiniSatConan(ConanFile): + name = "minisat" + description = "minimalistic SAT solver" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "http://minisat.se" + topics = ("satisfiability", "solver") + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + package_type = "library" + + def export_sources(self): + export_conandata_patches(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") + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + # https://github.com/niklasso/minisat/blob/37dc6c67e2af26379d88ce349eb9c4c6160e8543/minisat/utils/ParseUtils.h#L27 + self.requires("zlib/[>=1.2.11 <2]", transitive_headers=True, transitive_libs=True) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["MINISAT_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.generate() + deps = CMakeDeps(self) + deps.generate() + + def build(self): + 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): + copy(self, pattern="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 = ["minisat"] + self.cpp_info.includedirs.append(os.path.join("include", "minisat")) + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") diff --git a/recipes/minisat/all/patches/0001-drop-default-arg-in-friend-declaration-2.2.0.patch b/recipes/minisat/all/patches/0001-drop-default-arg-in-friend-declaration-2.2.0.patch new file mode 100644 index 0000000000000..4b496704fc5f3 --- /dev/null +++ b/recipes/minisat/all/patches/0001-drop-default-arg-in-friend-declaration-2.2.0.patch @@ -0,0 +1,22 @@ +diff --git a/core/SolverTypes.h b/core/SolverTypes.h +index 1ebcc73..7b1d16a 100644 +--- a/core/SolverTypes.h ++++ b/core/SolverTypes.h +@@ -47,7 +47,7 @@ struct Lit { + int x; + + // Use this as a constructor: +- friend Lit mkLit(Var var, bool sign = false); ++ //friend Lit mkLit(Var var, bool sign = false); + + bool operator == (Lit p) const { return x == p.x; } + bool operator != (Lit p) const { return x != p.x; } +@@ -55,7 +55,7 @@ struct Lit { + }; + + +-inline Lit mkLit (Var var, bool sign) { Lit p; p.x = var + var + (int)sign; return p; } ++inline Lit mkLit (Var var, bool sign = false) { Lit p; p.x = var + var + (int)sign; return p; } + inline Lit operator ~(Lit p) { Lit q; q.x = p.x ^ 1; return q; } + inline Lit operator ^(Lit p, bool b) { Lit q; q.x = p.x ^ (unsigned int)b; return q; } + inline bool sign (Lit p) { return p.x & 1; } diff --git a/recipes/minisat/all/patches/0002-suffix-literal-2.2.0.patch b/recipes/minisat/all/patches/0002-suffix-literal-2.2.0.patch new file mode 100644 index 0000000000000..7b88d7fab9ef1 --- /dev/null +++ b/recipes/minisat/all/patches/0002-suffix-literal-2.2.0.patch @@ -0,0 +1,23 @@ +diff --git a/minisat/utils/Options.h b/minisat/utils/Options.h +index 2dba10f..ea7c185 100644 +--- a/utils/Options.h ++++ b/utils/Options.h +@@ -282,15 +282,15 @@ class Int64Option : public Option + if (range.begin == INT64_MIN) + fprintf(stderr, "imin"); + else +- fprintf(stderr, "%4"PRIi64, range.begin); ++ fprintf(stderr, "%4" PRIi64, range.begin); + + fprintf(stderr, " .. "); + if (range.end == INT64_MAX) + fprintf(stderr, "imax"); + else +- fprintf(stderr, "%4"PRIi64, range.end); ++ fprintf(stderr, "%4" PRIi64, range.end); + +- fprintf(stderr, "] (default: %"PRIi64")\n", value); ++ fprintf(stderr, "] (default: %" PRIi64")\n", value); + if (verbose){ + fprintf(stderr, "\n %s\n", description); + fprintf(stderr, "\n"); diff --git a/recipes/minisat/all/test_package/CMakeLists.txt b/recipes/minisat/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..ca1a47d74810a --- /dev/null +++ b/recipes/minisat/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(minisat REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE minisat::minisat) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/minisat/all/test_package/conanfile.py b/recipes/minisat/all/test_package/conanfile.py new file mode 100644 index 0000000000000..8a5bb47f50c4c --- /dev/null +++ b/recipes/minisat/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/minisat/all/test_package/test_package.cpp b/recipes/minisat/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..d6ff1a72443c3 --- /dev/null +++ b/recipes/minisat/all/test_package/test_package.cpp @@ -0,0 +1,37 @@ +// example from https://accu.org/journals/overload/27/150/horenovsky_2640/ +#include +#include + +using namespace Minisat; + +int main() { + Solver solver; + // Create variables + Var A = solver.newVar(); + Var B = solver.newVar(); + Var C = solver.newVar(); + // Create the clauses + solver.addClause( mkLit(A), mkLit(B), mkLit(C)); + solver.addClause(~mkLit(A), mkLit(B), mkLit(C)); + solver.addClause( mkLit(A), ~mkLit(B), mkLit(C)); + solver.addClause( mkLit(A), mkLit(B), ~mkLit(C)); + // Check for solution and retrieve model if found + bool sat = solver.solve(); + if (sat) { + std::clog << "SAT\n" + << "Model found:\n"; + std::clog << "A := " + << (solver.modelValue(A) == l_True) + << '\n'; + std::clog << "B := " + << (solver.modelValue(B) == l_True) + << '\n'; + std::clog << "C := " + << (solver.modelValue(C) == l_True) + << '\n'; + return 0; + } else { + std::clog << "UNSAT\n"; + return 1; + } +} diff --git a/recipes/minisat/all/test_v1_package/CMakeLists.txt b/recipes/minisat/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/minisat/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/minisat/all/test_v1_package/conanfile.py b/recipes/minisat/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/minisat/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/minisat/config.yml b/recipes/minisat/config.yml new file mode 100644 index 0000000000000..1979b3114ab95 --- /dev/null +++ b/recipes/minisat/config.yml @@ -0,0 +1,3 @@ +versions: + "2.2.0": + 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/conandata.yml b/recipes/minitrace/all/conandata.yml index f0c32e1045bb8..04665f845d5e3 100644 --- a/recipes/minitrace/all/conandata.yml +++ b/recipes/minitrace/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "cci.20230905": + url: "https://github.com/hrydgard/minitrace/archive/bc377c921f8c7da38f2beab355245222a01efc1a.tar.gz" + sha256: "f77633c9244834229ffbcbdf2b87c0893055e42ed0721f4b5dc1753738bdb547" "cci.20210321": url: "https://github.com/hrydgard/minitrace/archive/020f42b189e8d6ad50e4d8f45d69edee0a6b3f23.tar.gz" sha256: "314bcab4dc069c61f2eb813c9bd649efb2bd1fd75f91205a269a4c5abcd3d66b" diff --git a/recipes/minitrace/all/conanfile.py b/recipes/minitrace/all/conanfile.py index 1c39ada6eb865..731c80a714d09 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, rmdir 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) @@ -64,6 +57,7 @@ def package(self): copy(self, "LICENSE", self.source_folder, 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 = ["minitrace"] 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/minitrace/config.yml b/recipes/minitrace/config.yml index 384492f581d34..fcb3fb2b98f24 100644 --- a/recipes/minitrace/config.yml +++ b/recipes/minitrace/config.yml @@ -1,3 +1,5 @@ versions: + "cci.20230905": + folder: all "cci.20210321": folder: all diff --git a/recipes/miniupnpc/all/conandata.yml b/recipes/miniupnpc/all/conandata.yml index c414f1ae3f3a4..a75cdc40ec5d3 100644 --- a/recipes/miniupnpc/all/conandata.yml +++ b/recipes/miniupnpc/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.2.5": + url: "https://github.com/miniupnp/miniupnp/archive/refs/tags/miniupnpc_2_2_5.tar.gz" + sha256: "feb2ce11c548115f6e7dead7a523790aceeca92b9fca718f26e5b22303af313c" "2.2.2": url: "https://github.com/miniupnp/miniupnp/archive/refs/tags/miniupnpc_2_2_2.tar.gz" sha256: "a598890cad635170dfce6281d71fc3052dee5c8220da0109281542156267c762" diff --git a/recipes/miniupnpc/all/conanfile.py b/recipes/miniupnpc/all/conanfile.py index 23ce55638aada..46bacdb3551ec 100644 --- a/recipes/miniupnpc/all/conanfile.py +++ b/recipes/miniupnpc/all/conanfile.py @@ -1,6 +1,7 @@ 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, rmdir +from conan.tools.scm import Version import os required_conan_version = ">=1.53.0" @@ -41,8 +42,7 @@ 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) @@ -67,11 +67,17 @@ def build(self): cmake.build() def package(self): - copy(self, "LICENSE", src=os.path.join(self.source_folder, "miniupnpc"), - dst=os.path.join(self.package_folder, "licenses")) + if Version(self.version) >= "2.2.4": + copy(self, "LICENSE", src=self.source_folder, + dst=os.path.join(self.package_folder, "licenses")) + else: + copy(self, "LICENSE", src=os.path.join(self.source_folder, "miniupnpc"), + 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", "miniupnpc") diff --git a/recipes/miniupnpc/all/test_package/test_package.c b/recipes/miniupnpc/all/test_package/test_package.c index b7ba38ffbf1f2..43b44d24b83f2 100644 --- a/recipes/miniupnpc/all/test_package/test_package.c +++ b/recipes/miniupnpc/all/test_package/test_package.c @@ -7,6 +7,8 @@ int main(void) { int ipv6 = 0; unsigned char ttl = 2; int error = 0; - struct UPNPDev *devlist = upnpDiscover(2000, multicastif, minissdpdpath, localport, ipv6, ttl, &error); + if (0) { + struct UPNPDev *devlist = upnpDiscover(2000, multicastif, minissdpdpath, localport, ipv6, ttl, &error); + } return 0; } diff --git a/recipes/miniupnpc/config.yml b/recipes/miniupnpc/config.yml index 6d6cfc66eae07..e89bcaea7727b 100644 --- a/recipes/miniupnpc/config.yml +++ b/recipes/miniupnpc/config.yml @@ -1,3 +1,5 @@ versions: + "2.2.5": + folder: all "2.2.2": folder: all diff --git a/recipes/miniz/all/conandata.yml b/recipes/miniz/all/conandata.yml index 809f38f903343..5be42f3eada37 100644 --- a/recipes/miniz/all/conandata.yml +++ b/recipes/miniz/all/conandata.yml @@ -1,4 +1,7 @@ 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" 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/config.yml b/recipes/miniz/config.yml index 0ccfce284e89c..7c99dc2de1035 100644 --- a/recipes/miniz/config.yml +++ b/recipes/miniz/config.yml @@ -1,4 +1,6 @@ versions: + "3.0.2": + folder: all "3.0.1": folder: all "2.2.0": diff --git a/recipes/minizip-ng/all/conandata.yml b/recipes/minizip-ng/all/conandata.yml index 3c2038ac4c087..5c7d70a9a8713 100644 --- a/recipes/minizip-ng/all/conandata.yml +++ b/recipes/minizip-ng/all/conandata.yml @@ -1,77 +1,55 @@ sources: + "4.0.6": + url: "https://github.com/zlib-ng/minizip-ng/archive/4.0.6.tar.gz" + sha256: "e96ed3866706a67dbed05bf035e26ef6b60f408e1381bf0fe9af17fe2c0abebc" + "4.0.5": + url: "https://github.com/zlib-ng/minizip-ng/archive/4.0.5.tar.gz" + sha256: "9bb636474b8a4269280d32aca7de4501f5c24cc642c9b4225b4ed7b327f4ee73" + "4.0.4": + url: "https://github.com/zlib-ng/minizip-ng/archive/4.0.4.tar.gz" + sha256: "955800fe39f9d830fcb84e60746952f6a48e41093ec7a233c63ad611b5fcfe9f" + "4.0.3": + url: "https://github.com/zlib-ng/minizip-ng/archive/4.0.3.tar.gz" + sha256: "e39a736d4f55c22fa548e68225b2e92bc22aedd9ab90d002b0c5851e3a7bdace" + "4.0.2": + url: "https://github.com/zlib-ng/minizip-ng/archive/4.0.2.tar.gz" + sha256: "22008b4639197edfc3c5797c8bd1d7a3b2e684bf669a26834faf12b4026dba1c" + "4.0.1": + url: "https://github.com/zlib-ng/minizip-ng/archive/4.0.1.tar.gz" + sha256: "63e47a2b4dbac0da501f43f4da74f118dfb3ef0dee0ffbbe89428271002260f8" + "4.0.0": + url: "https://github.com/zlib-ng/minizip-ng/archive/4.0.0.tar.gz" + sha256: "f9062e576de026fd5026d65597de3b05263cd4d91400cacdbbe36dfa8a642fff" + "3.0.10": + url: "https://github.com/zlib-ng/minizip-ng/archive/3.0.10.tar.gz" + sha256: "d4a549731d8c7074e421dbab6d8b8ad0a93067752fe767c464f0f40fa5f0a80d" + "3.0.9": + url: "https://github.com/zlib-ng/minizip-ng/archive/3.0.9.tar.gz" + sha256: "992693a532eb15b20d306e6aeea1a1a6501bd19dca993ebe9a95fd22d6b7fd74" + "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" - "3.0.5": - url: "https://github.com/zlib-ng/minizip-ng/archive/3.0.5.tar.gz" - sha256: "1a248c378fdf4ef6c517024bb65577603d5146cffaebe81900bec9c0a5035d4d" - "3.0.4": - url: "https://github.com/zlib-ng/minizip-ng/archive/3.0.4.tar.gz" - sha256: "2ab219f651901a337a7d3c268128711b80330a99ea36bdc528c76b591a624c3c" - "3.0.3": - url: "https://github.com/zlib-ng/minizip-ng/archive/3.0.3.tar.gz" - sha256: "5f1dd0d38adbe9785cb9c4e6e47738c109d73a0afa86e58c4025ce3e2cc504ed" - "3.0.2": - url: "https://github.com/zlib-ng/minizip-ng/archive/3.0.2.tar.gz" - sha256: "6ba4b6629c107c27ab526e517bdb105612232f0965a6747f60150e5a04c2fe5a" - "3.0.1": - url: "https://github.com/zlib-ng/minizip-ng/archive/3.0.1.tar.gz" - sha256: "96c95b274dd535984ce0e87691691388f2b976106e8cf8d527b15da552ac94e4" patches: - "3.0.7": - - patch_file: "patches/3.0.7-0001-fix-cmake-project.patch" + "3.0.10": + - patch_file: "patches/3.0.10-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" + "3.0.9": + - patch_file: "patches/3.0.9-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" + "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.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" + "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.1-0002-fix-lzma-libdir.patch" + - 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" diff --git a/recipes/minizip-ng/all/conanfile.py b/recipes/minizip-ng/all/conanfile.py index 5b4369c3f4103..6185768b2d0c8 100644 --- a/recipes/minizip-ng/all/conanfile.py +++ b/recipes/minizip-ng/all/conanfile.py @@ -14,11 +14,11 @@ class MinizipNgConan(ConanFile): name = "minizip-ng" description = "Fork of the popular zip manipulation library found in the zlib distribution." - topics = ("compression", "zip") + license = "Zlib" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/zlib-ng/minizip-ng" - license = "Zlib" - + topics = ("compression", "zip") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -71,8 +71,6 @@ def configure(self): 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 @@ -81,26 +79,27 @@ def layout(self): def requirements(self): if self.options.get_safe("with_zlib"): - self.requires("zlib/1.2.13") + self.requires("zlib/[>=1.2.11 <2]") 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.5") if self.options.with_zstd: - self.requires("zstd/1.5.2") + self.requires("zstd/1.5.5") if self.options.with_openssl: - self.requires("openssl/1.1.1s") + self.requires("openssl/[>=1.1 <4]") if self.settings.os != "Windows": if self.options.get_safe("with_iconv"): self.requires("libiconv/1.17") def build_requirements(self): if self._needs_pkg_config: - self.tool_requires("pkgconf/1.9.3") + self.tool_requires("pkgconf/2.1.0") + if Version(self.version) >= "4.0.0": + self.tool_requires("cmake/[>=3.19 <4]") 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 self._needs_pkg_config: @@ -135,9 +134,14 @@ def generate(self): def _patch_sources(self): 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)", - "") + if Version(self.version) < "4.0.0": + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "set_target_properties(${PROJECT_NAME} PROPERTIES POSITION_INDEPENDENT_CODE 1)", + "") + elif Version(self.version) == "4.0.0": + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "set_target_properties(${MINIZIP_TARGET} PROPERTIES POSITION_INDEPENDENT_CODE 1)", + "") def build(self): self._patch_sources() @@ -159,7 +163,7 @@ 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 Version(self.version) < "3.0.5" or self.options.mz_compatibility else "-ng" + suffix = "" if 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") @@ -168,6 +172,10 @@ def package_info(self): if self.options.with_bzip2: self.cpp_info.components["minizip"].defines.append("HAVE_BZIP2") + if Version(self.version) >= "4.0.0": + minizip_dir = "minizip" if self.options.mz_compatibility else "minizip-ng" + self.cpp_info.components["minizip"].includedirs.append(os.path.join(self.package_folder, "include", minizip_dir)) + # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.filenames["cmake_find_package"] = "minizip" self.cpp_info.filenames["cmake_find_package_multi"] = "minizip" @@ -187,5 +195,10 @@ def package_info(self): self.cpp_info.components["minizip"].requires.append("zstd::zstd") if self.options.with_openssl: self.cpp_info.components["minizip"].requires.append("openssl::openssl") + elif is_apple_os(self): + self.cpp_info.components["minizip"].frameworks.extend(["CoreFoundation", "Security"]) + elif self.settings.os == "Windows": + self.cpp_info.components["minizip"].system_libs.append("crypt32") if self.settings.os != "Windows" and self.options.with_iconv: self.cpp_info.components["minizip"].requires.append("libiconv::libiconv") + 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 deleted file mode 100644 index c44b1784ce620..0000000000000 --- a/recipes/minizip-ng/all/patches/3.0.1-0001-fix-cmake-project.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- 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 deleted file mode 100644 index cb1ecba6e8149..0000000000000 --- a/recipes/minizip-ng/all/patches/3.0.1-0002-fix-lzma-libdir.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- 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.10-0001-fix-cmake-project.patch b/recipes/minizip-ng/all/patches/3.0.10-0001-fix-cmake-project.patch new file mode 100644 index 0000000000000..59a38a7b64d6f --- /dev/null +++ b/recipes/minizip-ng/all/patches/3.0.10-0001-fix-cmake-project.patch @@ -0,0 +1,18 @@ +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -80,6 +80,7 @@ + + # Library version + set(VERSION "3.0.10") ++project(minizip${MZ_PROJECT_SUFFIX} LANGUAGES C VERSION ${VERSION}) + + # API version + set(SOVERSION "3") +@@ -662,7 +663,6 @@ + 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.2-0001-fix-cmake-project.patch b/recipes/minizip-ng/all/patches/3.0.2-0001-fix-cmake-project.patch deleted file mode 100644 index 8cfa267f8cff7..0000000000000 --- a/recipes/minizip-ng/all/patches/3.0.2-0001-fix-cmake-project.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- 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 deleted file mode 100644 index 484eb23a91671..0000000000000 --- a/recipes/minizip-ng/all/patches/3.0.3-0001-fix-cmake-project.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- 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 deleted file mode 100644 index 5ae134194c263..0000000000000 --- a/recipes/minizip-ng/all/patches/3.0.4-0001-fix-cmake-project.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- 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 deleted file mode 100644 index bc28f8055105e..0000000000000 --- a/recipes/minizip-ng/all/patches/3.0.5-0001-fix-cmake-project.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- 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 deleted file mode 100644 index 0e4b01050297b..0000000000000 --- a/recipes/minizip-ng/all/patches/3.0.5-0002-fix-lzma-libdir.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- 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 deleted file mode 100644 index e08990e93540e..0000000000000 --- a/recipes/minizip-ng/all/patches/3.0.6-0001-fix-cmake-project.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- 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.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/patches/3.0.9-0001-fix-cmake-project.patch b/recipes/minizip-ng/all/patches/3.0.9-0001-fix-cmake-project.patch new file mode 100644 index 0000000000000..d91daa9764fda --- /dev/null +++ b/recipes/minizip-ng/all/patches/3.0.9-0001-fix-cmake-project.patch @@ -0,0 +1,20 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index be7205c..cad8d50 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -80,6 +80,7 @@ enable_language(C) + + # Library version + set(VERSION "3.0.9") ++project(minizip${MZ_PROJECT_SUFFIX} VERSION ${VERSION} LANGUAGES C) + + # API version + set(SOVERSION "3") +@@ -665,7 +666,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/config.yml b/recipes/minizip-ng/config.yml index 60ae0e8c451f8..580a769b6b0a8 100644 --- a/recipes/minizip-ng/config.yml +++ b/recipes/minizip-ng/config.yml @@ -1,15 +1,23 @@ versions: - "3.0.7": + "4.0.6": + folder: all + "4.0.5": + folder: all + "4.0.4": folder: all - "3.0.6": + "4.0.3": folder: all - "3.0.5": + "4.0.2": folder: all - "3.0.4": + "4.0.1": folder: all - "3.0.3": + "4.0.0": folder: all - "3.0.2": + "3.0.10": folder: all - "3.0.1": + "3.0.9": + folder: all + "3.0.8": + folder: all + "3.0.7": folder: all diff --git a/recipes/minizip/all/conandata.yml b/recipes/minizip/all/conandata.yml index 9a323696f005f..f8773fd58975f 100644 --- a/recipes/minizip/all/conandata.yml +++ b/recipes/minizip/all/conandata.yml @@ -1,14 +1,19 @@ sources: + "1.3.1": + url: "https://zlib.net/fossils/zlib-1.3.1.tar.gz" + sha256: "9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23" "1.2.13": - url: "https://github.com/madler/zlib/archive/refs/tags/v1.2.13.tar.gz" - sha256: "1525952a0a567581792613a9723333d7f8cc20b87a81f920fb8bc7e3f2251428" + 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.3.1": + - patch_file: "patches/minizip.patch" "1.2.13": - patch_file: "patches/minizip.patch" "1.2.12": diff --git a/recipes/minizip/all/conanfile.py b/recipes/minizip/all/conanfile.py index 8786a7f6a46e7..cec7c823f0429 100644 --- a/recipes/minizip/all/conanfile.py +++ b/recipes/minizip/all/conanfile.py @@ -3,7 +3,7 @@ from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, load, save import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class MinizipConan(ConanFile): @@ -13,7 +13,7 @@ class MinizipConan(ConanFile): license = "Zlib" description = "An experimental package to read and write files in .zip format, written on top of zlib" topics = ("zip", "compression", "inflate") - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -38,36 +38,29 @@ def config_options(self): 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 + 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") + self.requires("zlib/[>=1.2.11 <2]", 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): - 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["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() diff --git a/recipes/minizip/config.yml b/recipes/minizip/config.yml index 351c06f68201f..bd5341271951d 100644 --- a/recipes/minizip/config.yml +++ b/recipes/minizip/config.yml @@ -1,4 +1,6 @@ versions: + "1.3.1": + folder: all "1.2.13": folder: all "1.2.12": diff --git a/recipes/minmea/all/conandata.yml b/recipes/minmea/all/conandata.yml new file mode 100644 index 0000000000000..f6a2a3a0d5950 --- /dev/null +++ b/recipes/minmea/all/conandata.yml @@ -0,0 +1,12 @@ +sources: + "0.3.0.cci.20230620": + url: "https://github.com/kosma/minmea/archive/e368d847d75abd891c651f7d30ce5efb6681adb7.tar.gz" + sha256: "9b845dfc7f4475c17710a0ac0823b11a6946df7b20dfacd02b03921826eeab3a" +patches: + "0.3.0.cci.20230620": + - patch_file: "patches/001-disable-pkgconfig-libcheck.patch" + patch_description: "Do not search for libcheck - Exclusive for testing" + patch_type: "conan" + - patch_file: "patches/002-windows-support.patch" + patch_description: "Manage compat header file for Windows" + patch_type: "portability" diff --git a/recipes/minmea/all/conanfile.py b/recipes/minmea/all/conanfile.py new file mode 100644 index 0000000000000..30eb575863037 --- /dev/null +++ b/recipes/minmea/all/conanfile.py @@ -0,0 +1,82 @@ +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, apply_conandata_patches, export_conandata_patches +from conan.tools.microsoft import is_msvc +from conan.errors import ConanInvalidConfiguration +import os + +required_conan_version = ">=1.53.0" + +class MinmeaConan(ConanFile): + name = "minmea" + description = "a lightweight GPS NMEA 0183 parser library in pure C" + license = ("WTFPL", "MIT", "LGPL-3.0-or-later") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/kosma/minmea" + topics = ("gps", "NMEA", "parser") + 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") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + # INFO: Windows mingw supported: https://github.com/kosma/minmea?tab=readme-ov-file#compatibility + # INFO: MSVC fails with error C2011: 'timespec': 'struct' type redefinition + if is_msvc(self): + raise ConanInvalidConfiguration(f"{self.ref} can not be built on Visual Studio and msvc. Use mingw instead or similar.") + + 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.preprocessor_definitions["MINMEA_INCLUDE_COMPAT"] = "1" + tc.generate() + + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() + cmake.build(target="minmea") + + def package(self): + copy(self, "COPYING", self.source_folder, os.path.join(self.package_folder, "licenses")) + copy(self, "LICENSE.*", self.source_folder, os.path.join(self.package_folder, "licenses")) + copy(self, "minmea.h", self.source_folder, os.path.join(self.package_folder, "include")) + copy(self, "libminmea.a", self.build_folder, os.path.join(self.package_folder, "lib")) + copy(self, "libminmea.so", self.build_folder, os.path.join(self.package_folder, "lib")) + copy(self, "libminmea.dylib", self.build_folder, os.path.join(self.package_folder, "lib")) + if self.settings.os == "Windows": + copy(self, "libminmea.dll.a", self.build_folder, os.path.join(self.package_folder, "lib")) + copy(self, "libminmea.dll", self.build_folder, os.path.join(self.package_folder, "bin")) + copy(self, "minmea_compat.h", self.source_folder, os.path.join(self.package_folder, "include")) + + def package_info(self): + self.cpp_info.libs = ["minmea"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs = ["m"] + if self.settings.os == "Windows": + self.cpp_info.defines = ["MINMEA_INCLUDE_COMPAT=1"] diff --git a/recipes/minmea/all/patches/001-disable-pkgconfig-libcheck.patch b/recipes/minmea/all/patches/001-disable-pkgconfig-libcheck.patch new file mode 100644 index 0000000000000..7e3f4636a811b --- /dev/null +++ b/recipes/minmea/all/patches/001-disable-pkgconfig-libcheck.patch @@ -0,0 +1,12 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index b96e1d7..4674f49 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -6,7 +6,6 @@ project(minmea) + + find_package(Threads REQUIRED) # Workaround for https://github.com/libcheck/check/issues/48#issuecomment-322965461 + find_package(PkgConfig) +-pkg_check_modules(CHECK REQUIRED check) + link_directories(${CHECK_LIBRARY_DIRS}) + + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -Wall -Wextra -Werror -std=c99") diff --git a/recipes/minmea/all/patches/002-windows-support.patch b/recipes/minmea/all/patches/002-windows-support.patch new file mode 100644 index 0000000000000..8f7360ca6288d --- /dev/null +++ b/recipes/minmea/all/patches/002-windows-support.patch @@ -0,0 +1,16 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 4674f49..895b835 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -13,6 +13,11 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE -D_D + + set(minmea_SRCS minmea.c minmea.h) + add_library(minmea ${minmea_SRCS}) ++target_include_directories(minmea PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) ++if (WIN32) ++ configure_file(compat/minmea_compat_windows.h ${CMAKE_CURRENT_SOURCE_DIR}/minmea_compat.h COPYONLY) ++ target_compile_definitions(minmea PRIVATE MINMEA_INCLUDE_COMPAT) ++endif() + + add_executable(example example.c) + target_link_libraries(example minmea) diff --git a/recipes/minmea/all/test_package/CMakeLists.txt b/recipes/minmea/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..62bf6147b6fb5 --- /dev/null +++ b/recipes/minmea/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) + +find_package(minmea REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE minmea::minmea) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) diff --git a/recipes/minmea/all/test_package/conanfile.py b/recipes/minmea/all/test_package/conanfile.py new file mode 100644 index 0000000000000..ef5d7042163ec --- /dev/null +++ b/recipes/minmea/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/minmea/all/test_package/test_package.c b/recipes/minmea/all/test_package/test_package.c new file mode 100644 index 0000000000000..9c222e438c9ae --- /dev/null +++ b/recipes/minmea/all/test_package/test_package.c @@ -0,0 +1,16 @@ +#include +#include "minmea.h" + + +int main(void) { + char* nmea_data = "$GPGGA,155246.585,5231.171,N,01321.830,E,1,12,1.0,0.0,M,0.0,M,,*6F"; + + if (minmea_sentence_id(nmea_data, false) == MINMEA_SENTENCE_GGA) { + struct minmea_sentence_gga frame; + if (minmea_parse_gga(&frame, nmea_data)) { + printf("$GGA: fix quality: %d\n", frame.fix_quality); + } + } + + return 0; +} diff --git a/recipes/minmea/config.yml b/recipes/minmea/config.yml new file mode 100644 index 0000000000000..85c5d6a070371 --- /dev/null +++ b/recipes/minmea/config.yml @@ -0,0 +1,3 @@ +versions: + "0.3.0.cci.20230620": + folder: all diff --git a/recipes/mio/all/conandata.yml b/recipes/mio/all/conandata.yml index 397893683b684..6e7bb1d711691 100644 --- a/recipes/mio/all/conandata.yml +++ b/recipes/mio/all/conandata.yml @@ -1,8 +1,13 @@ sources: + "cci.20230303": + url: "https://github.com/mandreyel/mio/archive/8b6b7d878c89e81614d05edca7936de41ccdd2da.tar.gz" + sha256: "86248113bb2f1484f9cd44a260fe09beaa911307073c6f21fa9e765588d54b4b" "cci.20201220": url: "https://github.com/mandreyel/mio/archive/3f86a95c0784d73ce6815237ec33ed25f233b643.tar.gz" sha256: "056ae59d63c5d7f34dd90510adf2996ef1c4c17ec2b26ba9c9cb9974025b2c2c" patches: "cci.20201220": - patch_file: "patches/0001-fix-include-windows.patch" + patch_description: "Add missing includes for Windows" + patch_type: "portability" patch_source: "https://github.com/mandreyel/mio/pull/73" diff --git a/recipes/mio/all/conanfile.py b/recipes/mio/all/conanfile.py index 469a34156ae79..a91c01d248f09 100644 --- a/recipes/mio/all/conanfile.py +++ b/recipes/mio/all/conanfile.py @@ -1,24 +1,27 @@ 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 import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.52.0" class MioConan(ConanFile): name = "mio" description = "Cross-platform C++11 header-only library for memory mapped file IO." license = "MIT" - topics = ("mio", "mmap", "memory-mapping", "fileviewer") + topics = ("mmap", "memory-mapping", "fileviewer") homepage = "https://github.com/mandreyel/mio" url = "https://github.com/conan-io/conan-center-index" + package_type = "header-library" 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) + export_conandata_patches(self) + + def layout(self): + basic_layout(self, src_folder="src") def package_id(self): self.info.clear() @@ -27,12 +30,8 @@ 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def build(self): apply_conandata_patches(self) @@ -45,26 +44,18 @@ def package_info(self): self.cpp_info.set_property("cmake_file_name", "mio") self.cpp_info.set_property("cmake_target_name", "mio::mio") self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] self.cpp_info.components["mio-headers"].set_property("cmake_target_name", "mio::mio-headers") self.cpp_info.components["mio-headers"].bindirs = [] - self.cpp_info.components["mio-headers"].frameworkdirs = [] self.cpp_info.components["mio-headers"].libdirs = [] - self.cpp_info.components["mio-headers"].resdirs = [] if self.settings.os == "Windows": self.cpp_info.components["mio_full_winapi"].set_property("cmake_target_name", "mio::mio_full_winapi") self.cpp_info.components["mio_full_winapi"].bindirs = [] - self.cpp_info.components["mio_full_winapi"].frameworkdirs = [] self.cpp_info.components["mio_full_winapi"].libdirs = [] - self.cpp_info.components["mio_full_winapi"].resdirs = [] self.cpp_info.components["mio_min_winapi"].set_property("cmake_target_name", "mio::mio_min_winapi") self.cpp_info.components["mio_min_winapi"].defines = ["WIN32_LEAN_AND_MEAN", "NOMINMAX"] self.cpp_info.components["mio_min_winapi"].bindirs = [] - self.cpp_info.components["mio_min_winapi"].frameworkdirs = [] self.cpp_info.components["mio_min_winapi"].libdirs = [] - self.cpp_info.components["mio_min_winapi"].resdirs = [] diff --git a/recipes/mio/all/test_package/conanfile.py b/recipes/mio/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/mio/all/test_package/conanfile.py +++ b/recipes/mio/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/mio/all/test_v1_package/CMakeLists.txt b/recipes/mio/all/test_v1_package/CMakeLists.txt index 84deeaa812c31..b21cc49efde95 100644 --- a/recipes/mio/all/test_v1_package/CMakeLists.txt +++ b/recipes/mio/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.15) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(mio REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE mio::mio) -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/mio/config.yml b/recipes/mio/config.yml index 98dc4e2902c05..023d02b706f66 100644 --- a/recipes/mio/config.yml +++ b/recipes/mio/config.yml @@ -1,3 +1,5 @@ versions: + "cci.20230303": + folder: all "cci.20201220": folder: all diff --git a/recipes/mlpack/all/conandata.yml b/recipes/mlpack/all/conandata.yml new file mode 100644 index 0000000000000..13e81aa865d9c --- /dev/null +++ b/recipes/mlpack/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "4.4.0": + url: "https://github.com/mlpack/mlpack/archive/refs/tags/4.4.0.tar.gz" + sha256: "61c604026d05af26c244b0e47024698bbf150dfcc9d77b64057941d7d64d6cf6" + "4.3.0": + url: "https://github.com/mlpack/mlpack/archive/refs/tags/4.3.0.tar.gz" + sha256: "08cd54f711fde66fc3b6c9db89dc26776f9abf1a6256c77cfa3556e2a56f1a3d" diff --git a/recipes/mlpack/all/conanfile.py b/recipes/mlpack/all/conanfile.py new file mode 100644 index 0000000000000..a09b0e5a3296c --- /dev/null +++ b/recipes/mlpack/all/conanfile.py @@ -0,0 +1,119 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +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 +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version +import os + +required_conan_version = ">=1.54.0" + + +class MlpackConan(ConanFile): + name = "mlpack" + description = "mlpack: a fast, header-only C++ machine learning library" + license = "BSD-3-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/mlpack/mlpack" + topics = ("machine-learning", "deep-learning", "regression", "nearest-neighbor-search", "scientific-computing", "header-only") + + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _min_cppstd(self): + if Version(self.version) >= "4.4.0": + return 17 + if is_msvc(self): + return 17 + return 14 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "5", + "clang": "5", + "apple-clang": "5", + "msvc": "191", + "Visual Studio": "15", + } + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("armadillo/12.6.4") + self.requires("cereal/1.3.2") + self.requires("ensmallen/2.21.0") + self.requires("stb/cci.20230920") + # TODO: MSVC OpenMP is not compatible, enable for MSVC after #22353 + if not is_msvc(self): + self.requires("llvm-openmp/17.0.6") + + 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." + ) + + if not self.dependencies["armadillo"].options.use_blas or not self.dependencies["armadillo"].options.use_lapack: + raise ConanInvalidConfiguration("mlpack requires armadillo to be built with BLAS and LAPACK support.") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def _configure_headers(self): + # https://github.com/mlpack/mlpack/blob/4.3.0/src/mlpack/config.hpp + config_hpp = os.path.join(self.package_folder, "include", "mlpack", "config.hpp") + replace_in_file(self, config_hpp, "// #define MLPACK_HAS_STB", "#define MLPACK_HAS_STB") + replace_in_file(self, config_hpp, "// #define MLPACK_HAS_NO_STB_DIR", "// #define MLPACK_HAS_NO_STB_DIR") + + def package(self): + copy(self, "LICENSE.txt", self.source_folder, os.path.join(self.package_folder, "licenses")) + copy(self, "*", + os.path.join(self.source_folder, "src"), + os.path.join(self.package_folder, "include"), + excludes=["mlpack/bindings/*", "mlpack/tests/*", "mlpack/CMakeLists.txt"]) + self._configure_headers() + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "mlpack") + self.cpp_info.set_property("cmake_target_name", "mlpack::mlpack") + self.cpp_info.set_property("pkg_config_name", "mlpack") + + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["m", "pthread"]) + + if self.settings.get_safe("compiler.libcxx") in ["libstdc++", "libstdc++11"]: + self.cpp_info.system_libs.append("atomic") + + # FIXME: Review this flags assignment. LLVM-OpenMP is already defining these ones. + # Do we want to depend on llvm-openmp? Only for apple-clang? + # For more info, see this comment https://github.com/conan-io/conan-center-index/pull/22353#issuecomment-2214593855 + flags = [] + # Based on https://github.com/Kitware/CMake/blob/v3.28.1/Modules/FindOpenMP.cmake#L104-L135 + if self.settings.compiler == "clang": + flags = ["-fopenmp=libomp"] + elif self.settings.compiler == "gcc": + flags = ["-fopenmp"] + if self.settings.os == "Windows": + flags.append("-Wa,-mbig-obj") + elif self.settings.compiler == "sun-cc": + flags = ["-xopenmp"] + elif is_msvc(self): + # https://github.com/mlpack/mlpack/blob/4.3.0/CMakeLists.txt#L164-L175 + flags = ["-openmp:llvm", "/bigobj", "/Zm200", "/Zc:__cplusplus"] + if flags: + self.cpp_info.cflags = flags + self.cpp_info.cxxflags = flags diff --git a/recipes/mlpack/all/test_package/CMakeLists.txt b/recipes/mlpack/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..a68462fb67d65 --- /dev/null +++ b/recipes/mlpack/all/test_package/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(mlpack REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE mlpack::mlpack) +if(MSVC OR mlpack_VERSION VERSION_GREATER_EQUAL 4.4.0) + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +else() + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) +endif() diff --git a/recipes/mlpack/all/test_package/conanfile.py b/recipes/mlpack/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/mlpack/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/mlpack/all/test_package/test_package.cpp b/recipes/mlpack/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..b5b09f906a9df --- /dev/null +++ b/recipes/mlpack/all/test_package/test_package.cpp @@ -0,0 +1,15 @@ +#include + +using namespace mlpack; + +int main() +{ + const size_t numClasses = 2; + const size_t minimumLeafSize = 5; + const size_t numTrees = 10; + + arma::mat dataset; + arma::Row labels, predictions; + RandomForest rf(dataset, labels, numClasses, numTrees, minimumLeafSize); + rf.Classify(dataset, predictions); +} diff --git a/recipes/mlpack/config.yml b/recipes/mlpack/config.yml new file mode 100644 index 0000000000000..e9bbd51f309ab --- /dev/null +++ b/recipes/mlpack/config.yml @@ -0,0 +1,5 @@ +versions: + "4.4.0": + folder: all + "4.3.0": + folder: all diff --git a/recipes/mm_file/all/conandata.yml b/recipes/mm_file/all/conandata.yml new file mode 100644 index 0000000000000..2e4260fa45c64 --- /dev/null +++ b/recipes/mm_file/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.0.0": + url: "https://github.com/jermp/mm_file/archive/refs/tags/v1.0.0.tar.gz" + sha256: "1bb1b057ea1f1b06366513a198c39277740f743b59a0e5669f2694698f52018b" diff --git a/recipes/mm_file/all/conanfile.py b/recipes/mm_file/all/conanfile.py new file mode 100644 index 0000000000000..781246e7dfea4 --- /dev/null +++ b/recipes/mm_file/all/conanfile.py @@ -0,0 +1,51 @@ +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 MMFileConan(ConanFile): + name = "mm_file" + description = "A self-contained, header-only, implementation of memory-mapped files in C++ for fast integration into larger projects." + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/jermp/mm_file" + topics = ("memory-mapped-file", "header-only") + package_type = "header-library" + 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.cppstd: + check_min_cppstd(self, self._min_cppstd) + if self.settings.os == "Windows": + raise ConanInvalidConfiguration(f"{self.ref} doesn't support Windows") + + 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/mm_file/all/test_package/CMakeLists.txt b/recipes/mm_file/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..5c2d17e17789e --- /dev/null +++ b/recipes/mm_file/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(mm_file REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE mm_file::mm_file) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/mm_file/all/test_package/conanfile.py b/recipes/mm_file/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/mm_file/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/mm_file/all/test_package/test_package.cpp b/recipes/mm_file/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..708d34f560ee3 --- /dev/null +++ b/recipes/mm_file/all/test_package/test_package.cpp @@ -0,0 +1,31 @@ +#include +#include + +#include "mm_file/mm_file.hpp" + +int main() { + std::string filename("tmp.bin"); + static const size_t n = 13; + + { + // write n uint32_t integers + mm::file_sink fout(filename, n); + std::cout << "mapped " << fout.bytes() << " bytes " + << "for " << fout.size() << " integers" << std::endl; + + auto *data = fout.data(); + for (uint32_t i = 0; i != fout.size(); ++i) { + data[i] = i; + std::cout << "written " << data[i] << std::endl; + } + + // test iterator + for (auto x : fout) { + std::cout << "written " << x << std::endl; + } + + fout.close(); + } + + return 0; +} diff --git a/recipes/mm_file/config.yml b/recipes/mm_file/config.yml new file mode 100644 index 0000000000000..40341aa3db6cd --- /dev/null +++ b/recipes/mm_file/config.yml @@ -0,0 +1,3 @@ +versions: + "1.0.0": + folder: all diff --git a/recipes/mocknetworkaccessmanager/all/conandata.yml b/recipes/mocknetworkaccessmanager/all/conandata.yml new file mode 100644 index 0000000000000..74e9cd9518faf --- /dev/null +++ b/recipes/mocknetworkaccessmanager/all/conandata.yml @@ -0,0 +1,14 @@ +sources: + "0.12.0": + url: "https://gitlab.com/julrich/MockNetworkAccessManager/-/archive/0.12.0/MockNetworkAccessManager-0.12.0.tar.gz" + sha256: "ac9ffb5e6e5ccdc1b7c76da7a92b5d845ec12eb48a39b0423005da4f6431b09f" +patches: + "0.12.0": + - patch_file: "patches/0.12.0-0001-add-install-step.patch" + patch_description: "Add install step" + patch_type: "conan" + patch_source: "https://gitlab.com/julrich/MockNetworkAccessManager/-/merge_requests/75" + - patch_file: "patches/0.12.0-0002-fix-target-without-location.patch" + patch_description: "Fix target without location" + patch_type: "conan" + patch_source: "https://gitlab.com/julrich/MockNetworkAccessManager/-/merge_requests/75" diff --git a/recipes/mocknetworkaccessmanager/all/conanfile.py b/recipes/mocknetworkaccessmanager/all/conanfile.py new file mode 100644 index 0000000000000..11510320e6ea3 --- /dev/null +++ b/recipes/mocknetworkaccessmanager/all/conanfile.py @@ -0,0 +1,72 @@ +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.52.0" + + +class MockNetworkAccessManagerConan(ConanFile): + name = "mocknetworkaccessmanager" + description = "Mocking network communication for Qt applications" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://gitlab.com/julrich/MockNetworkAccessManager" + topics = ("qt", "mock", "network", "QNetworkAccessManager", "unit test", "test") + package_type = "static-library" + settings = "os", "arch", "compiler", "build_type" + options = { + "fPIC": [True, False], + "with_qt": [5, 6], + } + default_options = { + "fPIC": True, + "with_qt": 5, + } + + 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): + if self.options.with_qt == 5: + self.requires("qt/[~5.15]", transitive_headers=True) + else: + self.requires("qt/[>=6.6 <7]", transitive_headers=True) + + 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], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTING"] = False + tc.variables["FORCE_QT5"] = self.options.with_qt == 5 + tc.generate() + tc = CMakeDeps(self) + tc.generate() + + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() + 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 = ["MockNetworkAccessManager"] diff --git a/recipes/mocknetworkaccessmanager/all/patches/0.12.0-0001-add-install-step.patch b/recipes/mocknetworkaccessmanager/all/patches/0.12.0-0001-add-install-step.patch new file mode 100644 index 0000000000000..5ab7046d5c273 --- /dev/null +++ b/recipes/mocknetworkaccessmanager/all/patches/0.12.0-0001-add-install-step.patch @@ -0,0 +1,15 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 61ed3ed..6d0de20 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -107,3 +107,10 @@ add_library( MockNetworkAccessManager STATIC EXCLUDE_FROM_ALL "MockNetworkAccess + target_include_directories( MockNetworkAccessManager PUBLIC "${PROJECT_SOURCE_DIR}" ) + target_link_libraries( MockNetworkAccessManager Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Network ) + ++install(TARGETS MockNetworkAccessManager ++ LIBRARY DESTINATION lib ++ ARCHIVE DESTINATION lib) ++ ++install(FILES "${PROJECT_SOURCE_DIR}/MockNetworkAccessManager.hpp" ++ DESTINATION include) ++ diff --git a/recipes/mocknetworkaccessmanager/all/patches/0.12.0-0002-fix-target-without-location.patch b/recipes/mocknetworkaccessmanager/all/patches/0.12.0-0002-fix-target-without-location.patch new file mode 100644 index 0000000000000..30e7bf6374a71 --- /dev/null +++ b/recipes/mocknetworkaccessmanager/all/patches/0.12.0-0002-fix-target-without-location.patch @@ -0,0 +1,20 @@ +commit e28d1f3868db8c7f5ff654a205d80d5d7ed203c4 +Author: Martin Delille +Date: Fri Jan 19 18:06:56 2024 +0100 + + Fix target without LOCATION property + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 6d0de20..dbfbed3 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -26,8 +26,7 @@ if( NOT Qt5_FOUND OR NOT Qt6_FOUND ) + find_package( Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Network ) + endif() + +-get_target_property( QTCORE_LOCATION Qt${QT_VERSION_MAJOR}::Core LOCATION ) +-get_filename_component( QT_BIN_DIR ${QTCORE_LOCATION} DIRECTORY ) ++get_filename_component(QT_BIN_DIR "$" ABSOLUTE) + set( CMAKE_MSVCIDE_RUN_PATH ${QT_BIN_DIR} ) + set_property( DIRECTORY "." APPEND PROPERTY COMPILE_DEFINITIONS "QT_DEPRECATED_WARNINGS" ) + diff --git a/recipes/mocknetworkaccessmanager/all/test_package/CMakeLists.txt b/recipes/mocknetworkaccessmanager/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..679b5058fe4c8 --- /dev/null +++ b/recipes/mocknetworkaccessmanager/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(mocknetworkaccessmanager REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE mocknetworkaccessmanager::mocknetworkaccessmanager) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/mocknetworkaccessmanager/all/test_package/conanfile.py b/recipes/mocknetworkaccessmanager/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/mocknetworkaccessmanager/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/mocknetworkaccessmanager/all/test_package/test_package.cpp b/recipes/mocknetworkaccessmanager/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..16d39eccc870f --- /dev/null +++ b/recipes/mocknetworkaccessmanager/all/test_package/test_package.cpp @@ -0,0 +1,15 @@ +#include + +#include "MockNetworkAccessManager.hpp" + +int main(int argc, char *argv[]) { + QCoreApplication app(argc, argv); + MockNetworkAccess::Manager< QNetworkAccessManager > mnam; + + mnam.whenGet( QUrl( "http://example.com/hello" ) ) + .has( MockNetworkAccess::Predicates::HeaderMatching( QNetworkRequest::UserAgentHeader, + QRegularExpression( ".*MyNetworkClient/.*" ) ) ) + .reply().withBody( QJsonDocument::fromJson( "{\"hello\":\"world\"}" ) ); + + return 0; +} diff --git a/recipes/mocknetworkaccessmanager/config.yml b/recipes/mocknetworkaccessmanager/config.yml new file mode 100644 index 0000000000000..bd3e719c29dbd --- /dev/null +++ b/recipes/mocknetworkaccessmanager/config.yml @@ -0,0 +1,3 @@ +versions: + "0.12.0": + folder: all diff --git a/recipes/modern-cpp-kafka/all/conandata.yml b/recipes/modern-cpp-kafka/all/conandata.yml index 41a95649ec345..9477b5d2f991b 100644 --- a/recipes/modern-cpp-kafka/all/conandata.yml +++ b/recipes/modern-cpp-kafka/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "2024.07.03": + url: "https://github.com/morganstanley/modern-cpp-kafka/archive/v2024.07.03.tar.gz" + sha256: "06b89b5f2757d2107761d65869b98c3ec71e3c8c7e2cb2ab49277f3272044f02" + "2023.03.07": + url: "https://github.com/morganstanley/modern-cpp-kafka/archive/v2023.03.07.tar.gz" + sha256: "4685527a9768d44ed769ec6e502c3edde0b5cf4d341d8f9b476474955c61bba4" + "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" diff --git a/recipes/modern-cpp-kafka/all/conanfile.py b/recipes/modern-cpp-kafka/all/conanfile.py index 623a7a9a942f9..404038dfda2d5 100644 --- a/recipes/modern-cpp-kafka/all/conanfile.py +++ b/recipes/modern-cpp-kafka/all/conanfile.py @@ -4,7 +4,6 @@ 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.52.0" @@ -16,6 +15,7 @@ class ModernCppKafkaConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/morganstanley/modern-cpp-kafka" topics = ("kafka", "librdkafka", "kafkaproducer", "kafkaconsumer", "header-only") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -29,13 +29,15 @@ def _compilers_minimum_version(self): "gcc": "8", "clang": "7", "apple-clang": "12", + "msvc": "192", + "Visual Studio": "16", } def layout(self): basic_layout(self, src_folder="src") def requirements(self): - self.requires("librdkafka/1.9.2") + self.requires("librdkafka/2.3.0") def package_id(self): self.info.clear() @@ -43,17 +45,15 @@ def package_id(self): 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) + 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) @@ -65,11 +65,7 @@ def package(self): ) 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" - self.cpp_info.names["cmake_find_package_multi"] = "ModernCppKafka" - - if self.settings.os in ["Linux", "Macos"]: - self.cpp_info.system_libs.append("pthread") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("pthread") diff --git a/recipes/modern-cpp-kafka/all/test_package/CMakeLists.txt b/recipes/modern-cpp-kafka/all/test_package/CMakeLists.txt index e00b58eaa4743..2b86f2fbd7132 100644 --- a/recipes/modern-cpp-kafka/all/test_package/CMakeLists.txt +++ b/recipes/modern-cpp-kafka/all/test_package/CMakeLists.txt @@ -1,8 +1,8 @@ cmake_minimum_required(VERSION 3.8) project(test_package LANGUAGES CXX) -find_package(ModernCppKafka REQUIRED CONFIG) +find_package(modern-cpp-kafka REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE ModernCppKafka::ModernCppKafka) +target_link_libraries(${PROJECT_NAME} PRIVATE modern-cpp-kafka::modern-cpp-kafka) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/modern-cpp-kafka/all/test_v1_package/CMakeLists.txt b/recipes/modern-cpp-kafka/all/test_v1_package/CMakeLists.txt index 925ecbe19e448..91630d79f4abb 100644 --- a/recipes/modern-cpp-kafka/all/test_v1_package/CMakeLists.txt +++ b/recipes/modern-cpp-kafka/all/test_v1_package/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) diff --git a/recipes/modern-cpp-kafka/config.yml b/recipes/modern-cpp-kafka/config.yml index bc103feea5090..0f76703e92e08 100644 --- a/recipes/modern-cpp-kafka/config.yml +++ b/recipes/modern-cpp-kafka/config.yml @@ -1,4 +1,10 @@ versions: + "2024.07.03": + folder: all + "2023.03.07": + folder: all + "2023.01.05": + folder: all "2022.12.07": folder: all "2022.10.12": diff --git a/recipes/mold/1.3.1/conandata.yml b/recipes/mold/1.3.1/conandata.yml deleted file mode 100644 index 5d89f31c243f2..0000000000000 --- a/recipes/mold/1.3.1/conandata.yml +++ /dev/null @@ -1,4 +0,0 @@ -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 deleted file mode 100644 index 132186858b019..0000000000000 --- a/recipes/mold/1.3.1/conanfile.py +++ /dev/null @@ -1,104 +0,0 @@ -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 deleted file mode 100644 index f4c00d1c189e7..0000000000000 --- a/recipes/mold/1.3.1/test_package/conanfile.py +++ /dev/null @@ -1,9 +0,0 @@ -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/README.md b/recipes/mold/README.md new file mode 100644 index 0000000000000..8a1ee68e8c4ed --- /dev/null +++ b/recipes/mold/README.md @@ -0,0 +1,22 @@ +# mold: A Modern Linker + +mold is a faster drop-in replacement for existing Unix linkers. It is several +times quicker than the LLVM lld linker, the second-fastest open-source linker. +mold aims to enhance developer productivity by minimizing build time, +particularly in rapid debug-edit-rebuild cycles. + +You can configure Conan to download the latest version of `mold` and use it as the linker +when building your dependencies and projects from source. Currently only supported +when targeting Linux as the platform. + +To use mold automatically as the linker, you can add the following section to your +_host_ profile that targets Linux. When using gcc, please note that the following +flags require gcc 12.1 or greater. + +``` +[tool_requires] +*:mold/[*] +[conf] +tools.build:exelinkflags=['-fuse-ld=mold'] +tools.build:sharedlinkflags=['-fuse-ld=mold'] +``` diff --git a/recipes/mold/all/conandata.yml b/recipes/mold/all/conandata.yml index b90f73007307f..6ca00d3d20d1b 100644 --- a/recipes/mold/all/conandata.yml +++ b/recipes/mold/all/conandata.yml @@ -1,7 +1,25 @@ sources: - "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" + "2.34.1": + url: "https://github.com/rui314/mold/archive/refs/tags/v2.34.1.tar.gz" + sha256: "a8cf638045b4a4b2697d0bcc77fd96eae93d54d57ad3021bf03b0333a727a59d" + "2.33.0": + url: "https://github.com/rui314/mold/archive/refs/tags/v2.33.0.tar.gz" + sha256: "37b3aacbd9b6accf581b92ba1a98ca418672ae330b78fe56ae542c2dcb10a155" + "2.32.1": + url: "https://github.com/rui314/mold/archive/refs/tags/v2.32.1.tar.gz" + sha256: "f3c9a527d884c635834fe7d79b3de959b00783bf9446280ea274d996f0335825" + "2.32.0": + url: "https://github.com/rui314/mold/archive/refs/tags/v2.32.0.tar.gz" + sha256: "4b7e4146ea0f52be9adae8b417399f3676a041e65b55e3f25f088120d30a320b" + "2.31.0": + url: "https://github.com/rui314/mold/archive/refs/tags/v2.31.0.tar.gz" + sha256: "3dc3af83a5d22a4b29971bfad17261851d426961c665480e2ca294e5c74aa1e5" + "2.4.0": + url: "https://github.com/rui314/mold/archive/refs/tags/v2.4.0.tar.gz" + sha256: "be65f3d785d32ece7b3204ecaa57810847fdd25c232cf704cbfff2dafb1ac107" + "2.0.0": + url: "https://github.com/rui314/mold/archive/refs/tags/v2.0.0.tar.gz" + sha256: "2ae8a22db09cbff626df74c945079fa29c1e5f60bbe02502dcf69191cf43527b" + "1.11.0": + url: "https://github.com/rui314/mold/archive/refs/tags/v1.11.0.tar.gz" + sha256: "99318eced81b09a77e4c657011076cc8ec3d4b6867bd324b8677974545bc4d6f" diff --git a/recipes/mold/all/conanfile.py b/recipes/mold/all/conanfile.py index fde5b3dec3293..141a8d5af4387 100644 --- a/recipes/mold/all/conanfile.py +++ b/recipes/mold/all/conanfile.py @@ -1,19 +1,27 @@ import os from conan import ConanFile +from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps from conan.tools.files import copy, get, rmdir from conan.errors import ConanInvalidConfiguration from conan.tools.scm import Version from conan.tools.env import VirtualBuildEnv +required_conan_version = ">=1.47.0" + + class MoldConan(ConanFile): name = "mold" + description = ( + "mold is a faster drop-in replacement for existing Unix linkers. " + "It is several times faster than the LLVM lld linker." + ) + license = ("AGPL-3.0", "MIT") 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") + topics = ("ld", "linkage", "compilation", "pre-built") + package_type = "application" settings = "os", "arch", "compiler", "build_type" options = { "with_mimalloc": [True, False], @@ -22,7 +30,55 @@ class MoldConan(ConanFile): "with_mimalloc": False, } + @property + def _min_cppstd(self): + return 20 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "11", + "clang": "12", + "apple-clang": "14", + "Visual Studio": "16", + "msvc": "192", + } + + def configure(self): + if Version(self.version) < "2.0.0": + self.license = "AGPL-3.0" + else: + self.license = "MIT" + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires("zlib/[>=1.2.11 <2]") + self.requires("xxhash/0.8.2") + if self.options.with_mimalloc: + self.requires("mimalloc/2.1.2") + if Version(self.version) < "2.2.0": + # Newer versions use vendored-in BLAKE3 + self.requires("openssl/[>=1.1 <4]") + + def package_id(self): + del self.info.settings.compiler + def validate(self): + # mold has required C+20 since 1.4.1. However, C++20 features are used for the first time in 2.34.0. + if Version(self.version) >= "2.34.0": + # validate the minimum cpp standard supported. For C++ projects only + 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." + ) + + # 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": @@ -35,39 +91,28 @@ def validate(self): 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.') - - def layout(self): - cmake_layout(self, src_folder="src") - - def package_id(self): - del self.info.settings.compiler + if Version(self.version) == "2.33.0" and self.settings.compiler == "apple-clang" and Version(self.settings.compiler.version) < "14": + raise ConanInvalidConfiguration(f'{self.ref} doesn\'t support Apple-Clang < 14.') def build_requirements(self): - self.tool_requires("cmake/3.24.1") - - 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") - if self.options.with_mimalloc: - self.requires("mimalloc/2.0.6") + self.tool_requires("cmake/[>=3.18.0 <4]") 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["MOLD_USE_MIMALLOC"] = self.options.with_mimalloc tc.variables["MOLD_USE_SYSTEM_MIMALLOC"] = True - tc.variables["MOLD_USE_SYSTEM_TBB"] = True + tc.variables["MOLD_USE_SYSTEM_TBB"] = False # see https://github.com/conan-io/conan-center-index/pull/23575#issuecomment-2059154281 + tc.variables["CMAKE_INSTALL_LIBEXECDIR"] = "libexec" tc.generate() cd = CMakeDeps(self) cd.generate() - tc = VirtualBuildEnv(self) - tc.generate() + + vbe = VirtualBuildEnv(self) + vbe.generate() def build(self): cmake = CMake(self) @@ -81,19 +126,23 @@ def package(self): 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") - 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) + def package_info(self): 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"]) + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs = ["m", "pthread", "dl"] + + bindir = os.path.join(self.package_folder, "bin") + mold_executable = os.path.join(bindir, "mold") + self.conf_info.define("user.mold:path", mold_executable) + self.buildenv_info.define_path("MOLD_ROOT", bindir) + self.buildenv_info.define("LD", mold_executable) + + # For legacy Conan 1.x consumers only: + self.env_info.PATH.append(bindir) + self.env_info.MOLD_ROOT = bindir + self.env_info.LD = mold_executable diff --git a/recipes/mold/all/test_package/conanfile.py b/recipes/mold/all/test_package/conanfile.py index 60e9ac3ecf6ee..551d50ce9428a 100644 --- a/recipes/mold/all/test_package/conanfile.py +++ b/recipes/mold/all/test_package/conanfile.py @@ -13,4 +13,3 @@ def build_requirements(self): def test(self): if can_run(self): self.run("mold -v") - diff --git a/recipes/mold/config.yml b/recipes/mold/config.yml index 73995b17f00b1..bd00ef151054f 100644 --- a/recipes/mold/config.yml +++ b/recipes/mold/config.yml @@ -1,7 +1,17 @@ versions: - "1.3.1": - folder: 1.3.1 - "1.4.2": + "2.34.1": folder: all - "1.5.1": + "2.33.0": + folder: all + "2.32.1": + folder: all + "2.32.0": + folder: all + "2.31.0": + folder: all + "2.4.0": + folder: all + "2.0.0": + folder: all + "1.11.0": folder: all diff --git a/recipes/moltenvk/all/conandata.yml b/recipes/moltenvk/all/conandata.yml index 2f8e73cdf6613..f00f13232e63f 100644 --- a/recipes/moltenvk/all/conandata.yml +++ b/recipes/moltenvk/all/conandata.yml @@ -1,73 +1,40 @@ sources: + "1.2.2": + url: "https://github.com/KhronosGroup/MoltenVK/archive/refs/tags/v1.2.2.tar.gz" + sha256: "8065a10c2d70b561f48475dedb118e643176527b162d6e439fa127270c2a07dd" + "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" - "1.1.9": - url: "https://github.com/KhronosGroup/MoltenVK/archive/refs/tags/v1.1.9.tar.gz" - sha256: "ea455a14decb85ec4bc66ffd2b963492afa7b53297b7064a11ca47ca8d2464ea" - "1.1.8": - url: "https://github.com/KhronosGroup/MoltenVK/archive/refs/tags/v1.1.8.tar.gz" - sha256: "f316c814d0cb6d60a0e8ad164d8cafa64010dee9dd41748b038b6b67fa40f08a" - "1.1.6": - url: "https://github.com/KhronosGroup/MoltenVK/archive/refs/tags/v1.1.6.tar.gz" - sha256: "b60df3ac93b943eb14377019445533b5c451fffd6b1df86187b1b9ac7d6dba6b" - "1.1.5": - url: "https://github.com/KhronosGroup/MoltenVK/archive/refs/tags/v1.1.5.tar.gz" - sha256: "2cdcb8dbf2acdcd8cbe70b109dadc05a901038c84970afbe4863e5e23f33deae" - "1.1.4": - url: "https://github.com/KhronosGroup/MoltenVK/archive/refs/tags/v1.1.4.tar.gz" - sha256: "f9bba6d3bf3648e7685c247cb6d126d62508af614bc549cedd5859a7da64967e" - "1.1.1": - url: "https://github.com/KhronosGroup/MoltenVK/archive/v1.1.1.tar.gz" - sha256: "cd1712c571d4155f4143c435c8551a5cb8cbb311ad7fff03595322ab971682c0" - "1.1.0": - url: "https://github.com/KhronosGroup/MoltenVK/archive/v1.1.0.tar.gz" - sha256: "0538fa1c23ddae495c7f82ccd0db90790a90b7017a258ca7575fbae8021f3058" patches: + "1.2.2": + - patch_file: "patches/1.2.2-0001-MVKSmallVector-Make-iterator-const-correct.patch" + patch_description: "Fix build errors in Xcode 15.3 beta" + patch_type: "portability" + patch_source: "https://github.com/KhronosGroup/MoltenVK/issues/2156" + "1.2.1": + - patch_file: "patches/1.2.2-0001-MVKSmallVector-Make-iterator-const-correct.patch" + patch_description: "Fix build errors in Xcode 15.3 beta" + patch_type: "portability" + patch_source: "https://github.com/KhronosGroup/MoltenVK/issues/2156" "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: "backport" + patch_type: "portability" patch_source: "https://github.com/KhronosGroup/MoltenVK/pull/1747" - sha256: "80387a47d24c12b538bdcb60d6aa7c402af0800519ce55385abdfbf3d304ee07" + - patch_file: "patches/1.2.2-0001-MVKSmallVector-Make-iterator-const-correct.patch" + patch_description: "Fix build errors in Xcode 15.3 beta" + patch_type: "portability" + patch_source: "https://github.com/KhronosGroup/MoltenVK/issues/2156" "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/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/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/1.1.5-0001-allow-c++11-std.patch" - patch_description: "Allow to compile with C++11" + - patch_file: "patches/1.1.11-fix-MVKSmallVector.patch" + patch_description: "Fix MVKSmallVector build errors for Xcode 15.3" patch_type: "portability" - "1.1.1": - - 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/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 1bdfb7c033f01..4a3969113c5a1 100644 --- a/recipes/moltenvk/all/conanfile.py +++ b/recipes/moltenvk/all/conanfile.py @@ -23,6 +23,7 @@ class MoltenVKConan(ConanFile): homepage = "https://github.com/KhronosGroup/MoltenVK" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -84,7 +85,7 @@ def requirements(self): self.requires("cereal/1.3.2") self.requires(self._require("glslang")) self.requires(self._require("spirv-cross")) - self.requires(self._require("vulkan-headers")) + self.requires(self._require("vulkan-headers"), transitive_headers=True) if self.options.with_spirv_tools: self.requires(self._require("spirv-tools")) @@ -93,34 +94,21 @@ def _require(self, recipe_name): raise ConanException(f"{recipe_name} is missing in {self._dependencies_filename}") return f"{recipe_name}/{self._dependencies_versions[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 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.info.settings.compiler.get_safe("cppstd"): + if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, self._min_cppstd) - if self.info.settings.os not in ["Macos", "iOS", "tvOS"]: + if self.settings.os not in ["Macos", "iOS", "tvOS"]: raise ConanInvalidConfiguration(f"{self.ref} only supported on MacOS, iOS and tvOS") - if self.info.settings.compiler != "apple-clang": + if self.settings.compiler != "apple-clang": raise ConanInvalidConfiguration(f"{self.ref} requires apple-clang") - if Version(self.version) >= "1.0.42": - if Version(self.info.settings.compiler.version) < "12.0": - raise ConanInvalidConfiguration(f"{self.ref} requires XCode 12.0 or higher at build time") - - def validate_build(self): + if Version(self.settings.compiler.version) < "12.0": + raise ConanInvalidConfiguration(f"{self.ref} requires XCode 12.0 or higher") spirv_cross = self.dependencies["spirv-cross"] - if spirv_cross.options.shared or not spirv_cross.options.msl or not spirv_cross.options.reflect: + if spirv_cross.options.shared or not (spirv_cross.options.msl and spirv_cross.options.reflect): raise ConanInvalidConfiguration(f"{self.ref} requires spirv-cross static with msl & reflect enabled") 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) @@ -162,8 +150,10 @@ def package_info(self): if self.options.shared: moltenvk_icd_path = os.path.join(self.package_folder, "lib", "MoltenVK_icd.json") + 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: diff --git a/recipes/moltenvk/all/dependencies/dependencies-1.1.0.yml b/recipes/moltenvk/all/dependencies/dependencies-1.1.0.yml deleted file mode 100644 index d8c73818a1f7e..0000000000000 --- a/recipes/moltenvk/all/dependencies/dependencies-1.1.0.yml +++ /dev/null @@ -1,4 +0,0 @@ -glslang: "8.13.3559" -spirv-cross: "20200917" -spirv-tools: "2020.5" -vulkan-headers: "1.2.154.0" diff --git a/recipes/moltenvk/all/dependencies/dependencies-1.1.1.yml b/recipes/moltenvk/all/dependencies/dependencies-1.1.1.yml deleted file mode 100644 index 3dd4ee92f5875..0000000000000 --- a/recipes/moltenvk/all/dependencies/dependencies-1.1.1.yml +++ /dev/null @@ -1,4 +0,0 @@ -glslang: "8.13.3559" -spirv-cross: "20210115" -spirv-tools: "2020.5" -vulkan-headers: "1.2.162.0" diff --git a/recipes/moltenvk/all/dependencies/dependencies-1.1.10.yml b/recipes/moltenvk/all/dependencies/dependencies-1.1.10.yml deleted file mode 100644 index 056b9e003fb57..0000000000000 --- a/recipes/moltenvk/all/dependencies/dependencies-1.1.10.yml +++ /dev/null @@ -1,4 +0,0 @@ -glslang: "1.3.216.0" -spirv-cross: "1.3.216.0" -spirv-tools: "1.3.216.0" -vulkan-headers: "1.3.216.0" diff --git a/recipes/moltenvk/all/dependencies/dependencies-1.1.4.yml b/recipes/moltenvk/all/dependencies/dependencies-1.1.4.yml deleted file mode 100644 index b1f4555c6b74e..0000000000000 --- a/recipes/moltenvk/all/dependencies/dependencies-1.1.4.yml +++ /dev/null @@ -1,4 +0,0 @@ -glslang: "11.5.0" -spirv-cross: "cci.20210621" -spirv-tools: "2021.2" -vulkan-headers: "1.2.182" diff --git a/recipes/moltenvk/all/dependencies/dependencies-1.1.5.yml b/recipes/moltenvk/all/dependencies/dependencies-1.1.5.yml deleted file mode 100644 index f358857867637..0000000000000 --- a/recipes/moltenvk/all/dependencies/dependencies-1.1.5.yml +++ /dev/null @@ -1,4 +0,0 @@ -glslang: "11.6.0" -spirv-cross: "cci.20210823" -spirv-tools: "2021.3" -vulkan-headers: "1.2.189" diff --git a/recipes/moltenvk/all/dependencies/dependencies-1.1.6.yml b/recipes/moltenvk/all/dependencies/dependencies-1.1.6.yml deleted file mode 100644 index 50da3fc9cd75d..0000000000000 --- a/recipes/moltenvk/all/dependencies/dependencies-1.1.6.yml +++ /dev/null @@ -1,4 +0,0 @@ -glslang: "11.7.0" -spirv-cross: "cci.20211113" -spirv-tools: "2021.4" -vulkan-headers: "1.2.198.0" diff --git a/recipes/moltenvk/all/dependencies/dependencies-1.1.8.yml b/recipes/moltenvk/all/dependencies/dependencies-1.1.8.yml deleted file mode 100644 index a215ca2513dd4..0000000000000 --- a/recipes/moltenvk/all/dependencies/dependencies-1.1.8.yml +++ /dev/null @@ -1,4 +0,0 @@ -glslang: "1.3.204.0" -spirv-cross: "1.3.204.0" -spirv-tools: "1.3.204.0" -vulkan-headers: "1.3.204.1" diff --git a/recipes/moltenvk/all/dependencies/dependencies-1.1.9.yml b/recipes/moltenvk/all/dependencies/dependencies-1.1.9.yml deleted file mode 100644 index d62197eb0b30f..0000000000000 --- a/recipes/moltenvk/all/dependencies/dependencies-1.1.9.yml +++ /dev/null @@ -1,4 +0,0 @@ -glslang: "1.3.211.0" -spirv-cross: "1.3.211.0" -spirv-tools: "1.3.211.0" -vulkan-headers: "1.3.211.0" diff --git a/recipes/moltenvk/all/dependencies/dependencies-1.2.0.yml b/recipes/moltenvk/all/dependencies/dependencies-1.2.0.yml index 33e0cb279be8b..5d099aa6f64ae 100644 --- a/recipes/moltenvk/all/dependencies/dependencies-1.2.0.yml +++ b/recipes/moltenvk/all/dependencies/dependencies-1.2.0.yml @@ -1,4 +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" +glslang: "1.3.239.0" +spirv-cross: "1.3.239.0" +spirv-tools: "1.3.239.0" +vulkan-headers: "1.3.239.0" 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..5d099aa6f64ae --- /dev/null +++ b/recipes/moltenvk/all/dependencies/dependencies-1.2.1.yml @@ -0,0 +1,4 @@ +glslang: "1.3.239.0" +spirv-cross: "1.3.239.0" +spirv-tools: "1.3.239.0" +vulkan-headers: "1.3.239.0" diff --git a/recipes/moltenvk/all/dependencies/dependencies-1.2.2.yml b/recipes/moltenvk/all/dependencies/dependencies-1.2.2.yml new file mode 100644 index 0000000000000..5d099aa6f64ae --- /dev/null +++ b/recipes/moltenvk/all/dependencies/dependencies-1.2.2.yml @@ -0,0 +1,4 @@ +glslang: "1.3.239.0" +spirv-cross: "1.3.239.0" +spirv-tools: "1.3.239.0" +vulkan-headers: "1.3.239.0" diff --git a/recipes/moltenvk/all/patches/1.1.0-0001-fix-spirv-cross-includes.patch b/recipes/moltenvk/all/patches/1.1.0-0001-fix-spirv-cross-includes.patch deleted file mode 100644 index 5280ed8ddc361..0000000000000 --- a/recipes/moltenvk/all/patches/1.1.0-0001-fix-spirv-cross-includes.patch +++ /dev/null @@ -1,54 +0,0 @@ -see https://github.com/KhronosGroup/MoltenVK/pull/1287 - ---- a/MoltenVK/MoltenVK/GPUObjects/MVKPixelFormats.h -+++ b/MoltenVK/MoltenVK/GPUObjects/MVKPixelFormats.h -@@ -22,7 +22,7 @@ - #include "MVKEnvironment.h" - #include "MVKOSExtensions.h" - #include "MVKBaseObject.h" --#include -+#include - #include - - #import ---- a/MoltenVKShaderConverter/Common/SPIRVSupport.cpp -+++ b/MoltenVKShaderConverter/Common/SPIRVSupport.cpp -@@ -18,7 +18,7 @@ - - #include "SPIRVSupport.h" - #include "MVKStrings.h" --#include -+#include - #include - - #import ---- a/MoltenVKShaderConverter/MoltenVKShaderConverter/SPIRVReflection.h -+++ b/MoltenVKShaderConverter/MoltenVKShaderConverter/SPIRVReflection.h -@@ -19,10 +19,10 @@ - #ifndef __SPIRVReflection_h_ - #define __SPIRVReflection_h_ 1 - --#include --#include --#include --#include -+#include -+#include -+#include -+#include - #include - #include - ---- a/MoltenVKShaderConverter/MoltenVKShaderConverter/SPIRVToMSLConverter.h -+++ b/MoltenVKShaderConverter/MoltenVKShaderConverter/SPIRVToMSLConverter.h -@@ -19,8 +19,8 @@ - #ifndef __SPIRVToMSLConverter_h_ - #define __SPIRVToMSLConverter_h_ 1 - --#include --#include -+#include -+#include - #include - #include - #include diff --git a/recipes/moltenvk/all/patches/1.1.11-fix-MVKSmallVector.patch b/recipes/moltenvk/all/patches/1.1.11-fix-MVKSmallVector.patch new file mode 100644 index 0000000000000..6a11e5548351f --- /dev/null +++ b/recipes/moltenvk/all/patches/1.1.11-fix-MVKSmallVector.patch @@ -0,0 +1,48 @@ +diff --git a/MoltenVK/MoltenVK/Utility/MVKSmallVector.h b/MoltenVK/MoltenVK/Utility/MVKSmallVector.h +index ca19169..39a46dc 100755 +--- a/MoltenVK/MoltenVK/Utility/MVKSmallVector.h ++++ b/MoltenVK/MoltenVK/Utility/MVKSmallVector.h +@@ -85,9 +85,9 @@ public: + return *this; + } + +- Type *operator->() { return &vector->alc.ptr[index]; } +- Type &operator*() { return vector->alc.ptr[index]; } +- operator Type*() { return &vector->alc.ptr[index]; } ++ Type *operator->() const { return &vector->alc.ptr[index]; } ++ Type &operator*() const { return vector->alc.ptr[index]; } ++ operator Type*() const { return &vector->alc.ptr[index]; } + + bool operator==( const iterator &it ) const { return vector == it.vector && index == it.index; } + bool operator!=( const iterator &it ) const { return vector != it.vector || index != it.index; } +@@ -97,20 +97,19 @@ public: + iterator& operator--() { --index; return *this; } + iterator operator--( int ) { auto t = *this; --index; return t; } + +- iterator operator+ (const diff_type n) { return iterator( index + n, *vector ); } +- iterator& operator+= (const diff_type n) { index += n; return *this; } +- iterator operator- (const diff_type n) { return iterator( index - n, *vector ); } +- iterator& operator-= (const diff_type n) { index -= n; return *this; } ++ iterator operator+ (const diff_type n) const { return iterator( index + n, *vector ); } ++ iterator& operator+= (const diff_type n) { index += n; return *this; } ++ iterator operator- (const diff_type n) const { return iterator( index - n, *vector ); } ++ iterator& operator-= (const diff_type n) { index -= n; return *this; } + +- diff_type operator- (const iterator& it) { return index - it.index; } ++ diff_type operator- (const iterator& it) const { return index - it.index; } + +- bool operator< (const iterator& it) { return index < it.index; } +- bool operator<= (const iterator& it) { return index <= it.index; } +- bool operator> (const iterator& it) { return index > it.index; } +- bool operator>= (const iterator& it) { return index >= it.index; } ++ bool operator< (const iterator& it) const { return index < it.index; } ++ bool operator<= (const iterator& it) const { return index <= it.index; } ++ bool operator> (const iterator& it) const { return index > it.index; } ++ bool operator>= (const iterator& it) const { return index >= it.index; } + +- const Type &operator[]( const diff_type i ) const { return vector->alc.ptr[index + i]; } +- Type &operator[]( const diff_type i ) { return vector->alc.ptr[index + i]; } ++ Type &operator[]( const diff_type i ) const { return vector->alc.ptr[index + i]; } + + bool is_valid() const { return index < vector->alc.size(); } + size_t get_position() const { return index; } diff --git a/recipes/moltenvk/all/patches/1.1.5-0001-allow-c++11-std.patch b/recipes/moltenvk/all/patches/1.1.5-0001-allow-c++11-std.patch deleted file mode 100644 index 283e7edc667aa..0000000000000 --- a/recipes/moltenvk/all/patches/1.1.5-0001-allow-c++11-std.patch +++ /dev/null @@ -1,16 +0,0 @@ -upstream issue: https://github.com/KhronosGroup/MoltenVK/issues/1474 - ---- a/MoltenVK/MoltenVK/Commands/MVKCommandBuffer.mm -+++ b/MoltenVK/MoltenVK/Commands/MVKCommandBuffer.mm -@@ -769,7 +769,10 @@ void MVKCommandEncoder::markTimestamp(MVKTimestampQueryPool* pQueryPool, uint32_ - if (sampPts) { - for (uint32_t qOfst = 0; qOfst < queryCount; qOfst++) { - if (mvkIsAnyFlagEnabled(sampPts, MVK_COUNTER_SAMPLING_AT_PIPELINE_STAGE)) { -- _timestampStageCounterQueries.push_back({ pQueryPool, query + qOfst }); -+ GPUCounterQuery timestampCounterQuery = {}; -+ timestampCounterQuery.queryPool = pQueryPool; -+ timestampCounterQuery.query = query + qOfst; -+ _timestampStageCounterQueries.push_back(timestampCounterQuery); - } else { - encodeGPUCounterSample(pQueryPool, query + qOfst, sampPts); - } diff --git a/recipes/moltenvk/all/patches/1.1.6-0001-allow-c++11-std.patch b/recipes/moltenvk/all/patches/1.1.6-0001-allow-c++11-std.patch deleted file mode 100644 index 65bfadc2ebffe..0000000000000 --- a/recipes/moltenvk/all/patches/1.1.6-0001-allow-c++11-std.patch +++ /dev/null @@ -1,16 +0,0 @@ -upstream issue: https://github.com/KhronosGroup/MoltenVK/issues/1474 - ---- a/MoltenVK/MoltenVK/Commands/MVKCommandBuffer.mm -+++ b/MoltenVK/MoltenVK/Commands/MVKCommandBuffer.mm -@@ -772,7 +772,10 @@ void MVKCommandEncoder::markTimestamp(MVKTimestampQueryPool* pQueryPool, uint32_ - MVKCounterSamplingFlags sampPts = _device->_pMetalFeatures->counterSamplingPoints; - for (uint32_t qOfst = 0; qOfst < queryCount; qOfst++) { - if (mvkIsAnyFlagEnabled(sampPts, MVK_COUNTER_SAMPLING_AT_PIPELINE_STAGE)) { -- _timestampStageCounterQueries.push_back({ pQueryPool, query + qOfst }); -+ GPUCounterQuery timestampCounterQuery = {}; -+ timestampCounterQuery.queryPool = pQueryPool; -+ timestampCounterQuery.query = query + qOfst; -+ _timestampStageCounterQueries.push_back(timestampCounterQuery); - } else { - encodeGPUCounterSample(pQueryPool, query + qOfst, sampPts); - } diff --git a/recipes/moltenvk/all/patches/1.1.8-0001-allow-c++11-std.patch b/recipes/moltenvk/all/patches/1.1.8-0001-allow-c++11-std.patch deleted file mode 100644 index 420e890ccf5f4..0000000000000 --- a/recipes/moltenvk/all/patches/1.1.8-0001-allow-c++11-std.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- a/MoltenVK/MoltenVK/Commands/MVKCommandBuffer.mm -+++ b/MoltenVK/MoltenVK/Commands/MVKCommandBuffer.mm -@@ -774,7 +774,10 @@ void MVKCommandEncoder::markTimestamp(MVKTimestampQueryPool* pQueryPool, uint32_ - MVKCounterSamplingFlags sampPts = _device->_pMetalFeatures->counterSamplingPoints; - for (uint32_t qOfst = 0; qOfst < queryCount; qOfst++) { - if (mvkIsAnyFlagEnabled(sampPts, MVK_COUNTER_SAMPLING_AT_PIPELINE_STAGE)) { -- _timestampStageCounterQueries.push_back({ pQueryPool, query + qOfst }); -+ GPUCounterQuery timestampCounterQuery = {}; -+ timestampCounterQuery.queryPool = pQueryPool; -+ timestampCounterQuery.query = query + qOfst; -+ _timestampStageCounterQueries.push_back(timestampCounterQuery); - } else { - encodeGPUCounterSample(pQueryPool, query + qOfst, sampPts); - } 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 deleted file mode 100644 index e488faca8335a..0000000000000 --- a/recipes/moltenvk/all/patches/1.1.8-0002-vulkan-alias-private-extern.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- 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.2-0001-MVKSmallVector-Make-iterator-const-correct.patch b/recipes/moltenvk/all/patches/1.2.2-0001-MVKSmallVector-Make-iterator-const-correct.patch new file mode 100644 index 0000000000000..77fa33557e448 --- /dev/null +++ b/recipes/moltenvk/all/patches/1.2.2-0001-MVKSmallVector-Make-iterator-const-correct.patch @@ -0,0 +1,51 @@ +see https://github.com/KhronosGroup/MoltenVK/pull/2157 + +diff --git a/MoltenVK/MoltenVK/Utility/MVKSmallVector.h b/MoltenVK/MoltenVK/Utility/MVKSmallVector.h +index 93bcb7fc..9649f2b2 100755 +--- a/MoltenVK/MoltenVK/Utility/MVKSmallVector.h ++++ b/MoltenVK/MoltenVK/Utility/MVKSmallVector.h +@@ -86,9 +86,9 @@ public: + return *this; + } + +- Type *operator->() { return &vector->alc.ptr[index]; } +- Type &operator*() { return vector->alc.ptr[index]; } +- operator Type*() { return &vector->alc.ptr[index]; } ++ Type *operator->() const { return &vector->alc.ptr[index]; } ++ Type &operator*() const { return vector->alc.ptr[index]; } ++ operator Type*() const { return &vector->alc.ptr[index]; } + + bool operator==( const iterator &it ) const { return vector == it.vector && index == it.index; } + bool operator!=( const iterator &it ) const { return vector != it.vector || index != it.index; } +@@ -98,20 +98,19 @@ public: + iterator& operator--() { --index; return *this; } + iterator operator--( int ) { auto t = *this; --index; return t; } + +- iterator operator+ (const diff_type n) { return iterator( index + n, *vector ); } +- iterator& operator+= (const diff_type n) { index += n; return *this; } +- iterator operator- (const diff_type n) { return iterator( index - n, *vector ); } +- iterator& operator-= (const diff_type n) { index -= n; return *this; } ++ iterator operator+ (const diff_type n) const { return iterator( index + n, *vector ); } ++ iterator& operator+= (const diff_type n) { index += n; return *this; } ++ iterator operator- (const diff_type n) const { return iterator( index - n, *vector ); } ++ iterator& operator-= (const diff_type n) { index -= n; return *this; } + +- diff_type operator- (const iterator& it) { return index - it.index; } ++ diff_type operator- (const iterator& it) const { return index - it.index; } + +- bool operator< (const iterator& it) { return index < it.index; } +- bool operator<= (const iterator& it) { return index <= it.index; } +- bool operator> (const iterator& it) { return index > it.index; } +- bool operator>= (const iterator& it) { return index >= it.index; } ++ bool operator< (const iterator& it) const { return index < it.index; } ++ bool operator<= (const iterator& it) const { return index <= it.index; } ++ bool operator> (const iterator& it) const { return index > it.index; } ++ bool operator>= (const iterator& it) const { return index >= it.index; } + +- const Type &operator[]( const diff_type i ) const { return vector->alc.ptr[index + i]; } +- Type &operator[]( const diff_type i ) { return vector->alc.ptr[index + i]; } ++ Type &operator[]( const diff_type i ) const { return vector->alc.ptr[index + i]; } + + bool is_valid() const { return index < vector->alc.size(); } + size_t get_position() const { return index; } +-- diff --git a/recipes/moltenvk/config.yml b/recipes/moltenvk/config.yml index df5b0f8614cc4..e368ebecaad4f 100644 --- a/recipes/moltenvk/config.yml +++ b/recipes/moltenvk/config.yml @@ -1,21 +1,9 @@ versions: - "1.2.0": - folder: all - "1.1.11": - folder: all - "1.1.10": - folder: all - "1.1.9": + "1.2.2": folder: all - "1.1.8": + "1.2.1": folder: all - "1.1.6": - folder: all - "1.1.5": - folder: all - "1.1.4": - folder: all - "1.1.1": + "1.2.0": folder: all - "1.1.0": + "1.1.11": folder: all diff --git a/recipes/mongo-c-driver/all/conandata.yml b/recipes/mongo-c-driver/all/conandata.yml index 2546c26f4700e..2decfe8254982 100644 --- a/recipes/mongo-c-driver/all/conandata.yml +++ b/recipes/mongo-c-driver/all/conandata.yml @@ -1,29 +1,24 @@ sources: - "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" - "1.17.6": - url: "https://github.com/mongodb/mongo-c-driver/releases/download/1.17.6/mongo-c-driver-1.17.6.tar.gz" - sha256: "8644deec7ae585e8d12566978f2017181e883f303a028b5b3ccb83c91248b150" - "1.17.4": - url: "https://github.com/mongodb/mongo-c-driver/releases/download/1.17.4/mongo-c-driver-1.17.4.tar.gz" - sha256: "9ec8fe7fb54d636886fa823460658ccf660e3d82520d10810fb7c9d302ac974f" - "1.17.3": - url: "https://github.com/mongodb/mongo-c-driver/releases/download/1.17.3/mongo-c-driver-1.17.3.tar.gz" - sha256: "6594cbae17389005bcac5a8d4091af3be4894d5314a519504d4b4509effcc0df" - "1.17.2": - url: "https://github.com/mongodb/mongo-c-driver/releases/download/1.17.2/mongo-c-driver-1.17.2.tar.gz" - sha256: "bc53d5f72ab628a1ae549db6888325d6dc34db3ca31c5e16e550c1bb4266d864" + "1.29.0": + url: "https://github.com/mongodb/mongo-c-driver/releases/download/1.29.0/mongo-c-driver-1.29.0.tar.gz" + sha256: "e3dbe86e1f40e100344c48a4c0e39d2da360d2b12a54f16031fa8f90ff16fe5e" + "1.28.1": + url: "https://github.com/mongodb/mongo-c-driver/archive/refs/tags/1.28.1.tar.gz" + sha256: "249fd66d8d12aac2aec7dea1456e1bf24908c87971016c391a1a82a636029a87" + "1.27.6": + url: "https://github.com/mongodb/mongo-c-driver/archive/refs/tags/1.27.6.tar.gz" + sha256: "7dee166dd106e3074582dd107f62815aa29311520149cda52efb69590b2cae7a" + "1.26.2": + url: "https://github.com/mongodb/mongo-c-driver/archive/refs/tags/1.26.2.tar.gz" + sha256: "7084c488a758bf226cc0b3d500e7e001f0e2e37391cbeecd341050a9a899857d" + "1.24.3": + url: "https://github.com/mongodb/mongo-c-driver/releases/download/1.24.3/mongo-c-driver-1.24.3.tar.gz" + sha256: "cc0ad1006447ded21bbefecf57d6fef61afe6f0d56a4e28da73805d50fdb81b5" patches: - "1.22.0": - - patch_file: "patches/1.22.0-0001-disable-shared-when-static.patch" - - patch_file: "patches/1.22.0-0002-fix-uninitialized-warning.patch" - - patch_file: "patches/1.22.0-0003-disable-warning-errors.patch" - "1.17.6": - - patch_file: "patches/1.17.6-0001-disable-shared-when-static.patch" - "1.17.4": - - patch_file: "patches/1.17.2-0001-disable-shared-when-static.patch" - "1.17.3": - - patch_file: "patches/1.17.2-0001-disable-shared-when-static.patch" - "1.17.2": - - patch_file: "patches/1.17.2-0001-disable-shared-when-static.patch" + "1.24.3": + - patch_file: "patches/1.24.1-0001-disable-shared-when-static.patch" + patch_description: "separate static and shared builds" + patch_type: "conan" + - patch_file: "patches/1.24.1-0002-fix-uninitialized-warning.patch" + patch_description: "fix uninitialized variable warning" + patch_type: "portability" diff --git a/recipes/mongo-c-driver/all/conanfile.py b/recipes/mongo-c-driver/all/conanfile.py index e77d7e3ce949c..d3e733eb6de05 100644 --- a/recipes/mongo-c-driver/all/conanfile.py +++ b/recipes/mongo-c-driver/all/conanfile.py @@ -2,14 +2,14 @@ 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.env import Environment, VirtualBuildEnv +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.microsoft import is_msvc from conan.tools.scm import Version import os -required_conan_version = ">=1.53.0" +required_conan_version = ">=1.55.0" class MongoCDriverConan(ConanFile): @@ -20,6 +20,7 @@ class MongoCDriverConan(ConanFile): homepage = "https://mongoc.org/" topics = ("libbson", "libmongoc", "mongo", "mongodb", "database", "db") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -65,36 +66,35 @@ def layout(self): def requirements(self): if self.options.with_ssl == "openssl": - self.requires("openssl/1.1.1s") + self.requires("openssl/[>=1.1 <4]") elif self.options.with_ssl == "libressl": self.requires("libressl/3.5.3") if self.options.with_sasl == "cyrus": - self.requires("cyrus-sasl/2.1.27") + self.requires("cyrus-sasl/2.1.28") if self.options.with_snappy: - self.requires("snappy/1.1.9") + self.requires("snappy/1.1.10") if self.options.with_zlib: - self.requires("zlib/1.2.13") + self.requires("zlib/[>=1.2.11 <2]") if self.options.with_zstd: - self.requires("zstd/1.5.2") + self.requires("zstd/[^1.5]") if self.options.with_icu: - self.requires("icu/71.1") + self.requires("icu/74.2") def validate(self): - if self.info.options.with_ssl == "darwin" and not is_apple_os(self.settings.os): + if self.options.with_ssl == "darwin" and not is_apple_os(self): raise ConanInvalidConfiguration("with_ssl=darwin only allowed on Apple os family") - if self.info.options.with_ssl == "windows" and self.info.settings.os != "Windows": + if self.options.with_ssl == "windows" and self.settings.os != "Windows": raise ConanInvalidConfiguration("with_ssl=windows only allowed on Windows") - if self.info.options.with_sasl == "sspi" and self.info.settings.os != "Windows": + if self.options.with_sasl == "sspi" and self.settings.os != "Windows": raise ConanInvalidConfiguration("with_sasl=sspi only allowed on Windows") def build_requirements(self): if self.options.with_ssl == "libressl" or self.options.with_zstd: if not self.conf.get("tools.gnu:pkg_config", check_type=str): - self.tool_requires("pkgconf/1.9.3") + self.tool_requires("pkgconf/2.1.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) @property def _ssl_cmake_value(self): @@ -118,10 +118,11 @@ def generate(self): # therefore it defeats conan_toolchain variables, but it works fine with cache_variables tc.cache_variables["ENABLE_SSL"] = self._ssl_cmake_value tc.cache_variables["ENABLE_SASL"] = self._sasl_cmake_value - tc.cache_variables["ENABLE_STATIC"] = "OFF" if self.options.shared else "ON" + tc.cache_variables["ENABLE_SHARED"] = self.options.shared + tc.cache_variables["ENABLE_STATIC"] = not self.options.shared tc.cache_variables["ENABLE_TESTS"] = "OFF" tc.cache_variables["ENABLE_EXAMPLES"] = "OFF" - tc.cache_variables["ENABLE_SRV"] = "ON" if self.options.srv else "OFF" + tc.cache_variables["ENABLE_SRV"] = self.options.srv tc.cache_variables["ENABLE_MAINTAINER_FLAGS"] = "OFF" tc.cache_variables["ENABLE_AUTOMATIC_INIT_AND_CLEANUP"] = "ON" tc.cache_variables["ENABLE_CRYPTO_SYSTEM_PROFILE"] = "OFF" @@ -130,29 +131,34 @@ def generate(self): tc.cache_variables["ENABLE_SHM_COUNTERS"] = "OFF" tc.cache_variables["ENABLE_MONGOC"] = "ON" tc.cache_variables["ENABLE_BSON"] = "ON" - tc.cache_variables["ENABLE_SNAPPY"] = "ON" if self.options.with_snappy else "OFF" + tc.cache_variables["ENABLE_SNAPPY"] = self.options.with_snappy tc.cache_variables["ENABLE_ZLIB"] = "SYSTEM" if self.options.with_zlib else "OFF" - tc.cache_variables["ENABLE_ZSTD"] = "ON" if self.options.with_zstd else "OFF" + tc.cache_variables["ENABLE_ZSTD"] = self.options.with_zstd tc.cache_variables["ENABLE_MAN_PAGES"] = "OFF" tc.cache_variables["ENABLE_HTML_DOCS"] = "OFF" tc.cache_variables["ENABLE_EXTRA_ALIGNMENT"] = "ON" tc.cache_variables["ENABLE_RDTSCP"] = "OFF" tc.cache_variables["ENABLE_APPLE_FRAMEWORK"] = "OFF" - tc.cache_variables["ENABLE_ICU"] = "ON" if self.options.with_icu else "OFF" + tc.cache_variables["ENABLE_ICU"] = self.options.with_icu tc.cache_variables["ENABLE_UNINSTALL"] = "OFF" tc.cache_variables["ENABLE_CLIENT_SIDE_ENCRYPTION"] = "OFF" # libmongocrypt recipe not yet in CCI tc.cache_variables["ENABLE_MONGODB_AWS_AUTH"] = "AUTO" - tc.cache_variables["ENABLE_PIC"] = "ON" if self.options.get_safe("fPIC", True) else "OFF" + tc.cache_variables["ENABLE_PIC"] = self.options.get_safe("fPIC", True) # Avoid to install vc runtime stuff tc.variables["CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP"] = "TRUE" if self.options.with_ssl == "openssl": tc.variables["OPENSSL_ROOT_DIR"] = self.dependencies["openssl"].package_folder.replace("\\", "/") - if Version(self.version) >= "1.20.0": - tc.variables["MONGO_USE_CCACHE"] = False + tc.variables["MONGO_USE_CCACHE"] = False if is_msvc(self): # Should be added because of # https://docs.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-initonceexecuteonce tc.preprocessor_definitions["_WIN32_WINNT"] = "0x0600" + tc.cache_variables["BUILD_VERSION"] = self.version + # Skip some fragile checks + # https://github.com/mongodb/mongo-c-driver/blob/1.25.3/src/libmongoc/CMakeLists.txt#L266-L276 + tc.variables["HAVE_ASN1_STRING_GET0_DATA"] = True # Requires OpenSSL 1.1.0+ + # https://github.com/mongodb/mongo-c-driver/blob/1.25.3/src/libmongoc/CMakeLists.txt#L366-L375 + tc.variables["SASL2_HAVE_SASL_CLIENT_DONE"] = True # Requires Cyrus-SASL 2.1.23+ tc.generate() deps = CMakeDeps(self) @@ -163,26 +169,17 @@ def generate(self): deps.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) - envvars = env.vars(self) - envvars.save_script("conanbuildenv_pkg_config_path") def _patch_sources(self): apply_conandata_patches(self) - to_replace_old_new = [ - # Fix Snappy - {"old": "include (FindSnappy)\nif (SNAPPY_INCLUDE_DIRS)", - "new": "if(ENABLE_SNAPPY MATCHES \"ON\")\n find_package(Snappy REQUIRED)"}, - {"old": "SNAPPY_LIBRARIES", "new": "Snappy_LIBRARIES"}, - {"old": "SNAPPY_INCLUDE_DIRS", "new": "Snappy_INCLUDE_DIRS"}, - # Fix LibreSSL - {"old": "set (SSL_LIBRARIES -ltls -lcrypto)", "new": ""}, - ] - for old_new in to_replace_old_new: - replace_in_file(self, os.path.join(self.source_folder, "src", "libmongoc", "CMakeLists.txt"), - old_new["old"], old_new["new"]) + libmongoc_cmake = os.path.join(self.source_folder, "src", "libmongoc", "CMakeLists.txt") + replace_in_file(self, libmongoc_cmake, + "include (FindSnappy)\nif (SNAPPY_INCLUDE_DIRS)", + 'if(ENABLE_SNAPPY MATCHES "ON")\n find_package(Snappy REQUIRED)') + replace_in_file(self, libmongoc_cmake, "SNAPPY_LIBRARIES", "Snappy_LIBRARIES") + replace_in_file(self, libmongoc_cmake, "SNAPPY_INCLUDE_DIRS", "Snappy_INCLUDE_DIRS") + if Version(self.version) < "1.25": + replace_in_file(self, libmongoc_cmake, "set (SSL_LIBRARIES -ltls -lcrypto)", "") # cleanup rpath replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "set (CMAKE_INSTALL_RPATH_USE_LINK_PATH ON)", "") diff --git a/recipes/mongo-c-driver/all/patches/1.17.2-0001-disable-shared-when-static.patch b/recipes/mongo-c-driver/all/patches/1.17.2-0001-disable-shared-when-static.patch deleted file mode 100644 index 8767b278cd009..0000000000000 --- a/recipes/mongo-c-driver/all/patches/1.17.2-0001-disable-shared-when-static.patch +++ /dev/null @@ -1,77 +0,0 @@ ---- a/src/libbson/CMakeLists.txt -+++ b/src/libbson/CMakeLists.txt -@@ -230,6 +230,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 PRIVATE BSON_COMPILATION JSONSL_PARSE_NAN) -@@ -272,6 +273,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}) -@@ -330,7 +332,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 () ---- a/src/libmongoc/CMakeLists.txt -+++ b/src/libmongoc/CMakeLists.txt -@@ -725,6 +725,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}) -@@ -744,6 +745,7 @@ target_compile_definitions (mongoc_shared PRIVATE MONGOC_COMPILATION ${KMS_MSG_D - - 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}) -@@ -766,6 +768,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 -@@ -776,9 +779,14 @@ 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") -@@ -1040,7 +1048,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/patches/1.17.6-0001-disable-shared-when-static.patch b/recipes/mongo-c-driver/all/patches/1.17.6-0001-disable-shared-when-static.patch deleted file mode 100644 index dad7659403d2b..0000000000000 --- a/recipes/mongo-c-driver/all/patches/1.17.6-0001-disable-shared-when-static.patch +++ /dev/null @@ -1,77 +0,0 @@ ---- a/src/libbson/CMakeLists.txt -+++ b/src/libbson/CMakeLists.txt -@@ -230,6 +230,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 PRIVATE BSON_COMPILATION JSONSL_PARSE_NAN) -@@ -279,6 +280,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}) -@@ -337,7 +339,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 () ---- a/src/libmongoc/CMakeLists.txt -+++ b/src/libmongoc/CMakeLists.txt -@@ -725,6 +725,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}) -@@ -744,6 +745,7 @@ target_compile_definitions (mongoc_shared PRIVATE MONGOC_COMPILATION ${KMS_MSG_D - - 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}) -@@ -766,6 +768,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 -@@ -776,9 +779,14 @@ 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") -@@ -1040,7 +1048,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/patches/1.22.0-0001-disable-shared-when-static.patch b/recipes/mongo-c-driver/all/patches/1.22.0-0001-disable-shared-when-static.patch deleted file mode 100644 index 23d005b89467b..0000000000000 --- a/recipes/mongo-c-driver/all/patches/1.22.0-0001-disable-shared-when-static.patch +++ /dev/null @@ -1,77 +0,0 @@ ---- 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 () ---- 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,14 @@ 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") -@@ -1161,7 +1169,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/patches/1.22.0-0002-fix-uninitialized-warning.patch b/recipes/mongo-c-driver/all/patches/1.22.0-0002-fix-uninitialized-warning.patch deleted file mode 100644 index 3c24ab717c0d5..0000000000000 --- a/recipes/mongo-c-driver/all/patches/1.22.0-0002-fix-uninitialized-warning.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/src/libbson/src/bson/bson-iter.c b/src/libbson/src/bson/bson-iter.c -index 7b4630f..ee70f12 100644 ---- a/src/libbson/src/bson/bson-iter.c -+++ b/src/libbson/src/bson/bson-iter.c -@@ -2141,7 +2141,7 @@ bson_iter_visit_all (bson_iter_t *iter, /* INOUT */ - - if (iter->err_off) { - if (unsupported && visitor->visit_unsupported_type && -- bson_utf8_validate (key, strlen (key), false)) { -+ key != NULL && bson_utf8_validate (key, strlen (key), false)) { - visitor->visit_unsupported_type (iter, key, bson_type, data); - return false; - } diff --git a/recipes/mongo-c-driver/all/patches/1.22.0-0003-disable-warning-errors.patch b/recipes/mongo-c-driver/all/patches/1.22.0-0003-disable-warning-errors.patch deleted file mode 100644 index 2ade48e877823..0000000000000 --- a/recipes/mongo-c-driver/all/patches/1.22.0-0003-disable-warning-errors.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/build/cmake/MongoC-Warnings.cmake b/build/cmake/MongoC-Warnings.cmake -index 4784c93..99745c3 100644 ---- a/build/cmake/MongoC-Warnings.cmake -+++ b/build/cmake/MongoC-Warnings.cmake -@@ -58,10 +58,6 @@ mongoc_add_platform_compile_options ( - gnu-like:$<${is_c_lang}:-Werror=implicit> msvc:/we4013 msvc:/we4431 - # Missing return types/statements - gnu-like:-Werror=return-type msvc:/we4716 -- # Incompatible pointer types -- gnu-like:$<$:-Werror=incompatible-pointer-types> msvc:/we4113 -- # Integral/pointer conversions -- gnu-like:$<$:-Werror=int-conversion> msvc:/we4047 - # Discarding qualifiers - gnu:$<$:-Werror=discarded-qualifiers> - clang:$<${is_c_lang}:-Werror=ignored-qualifiers> diff --git a/recipes/mongo-c-driver/all/patches/1.24.1-0001-disable-shared-when-static.patch b/recipes/mongo-c-driver/all/patches/1.24.1-0001-disable-shared-when-static.patch new file mode 100644 index 0000000000000..2ec7380ba4806 --- /dev/null +++ b/recipes/mongo-c-driver/all/patches/1.24.1-0001-disable-shared-when-static.patch @@ -0,0 +1,82 @@ +diff --git a/src/libbson/CMakeLists.txt b/src/libbson/CMakeLists.txt +index 61e9267..ff26474 100644 +--- a/src/libbson/CMakeLists.txt ++++ b/src/libbson/CMakeLists.txt +@@ -205,6 +205,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}) + if (MSVC AND MSVC_VERSION VERSION_LESS 1900) + message (STATUS "Disabling warning C4756 for VS 2013 and older") +@@ -282,6 +283,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}) +@@ -367,7 +369,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 bf95bd0..03a0f51 100644 +--- a/src/libmongoc/CMakeLists.txt ++++ b/src/libmongoc/CMakeLists.txt +@@ -745,6 +745,7 @@ if (MONGOC_ENABLE_STATIC_BUILD) + set_target_properties (mcd_rpc PROPERTIES OUTPUT_NAME "mcd-rpc") + 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}) +@@ -785,6 +786,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}) +@@ -828,6 +830,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 +@@ -838,9 +841,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) +@@ -1150,7 +1159,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/patches/1.24.1-0002-fix-uninitialized-warning.patch b/recipes/mongo-c-driver/all/patches/1.24.1-0002-fix-uninitialized-warning.patch new file mode 100644 index 0000000000000..7f59dea94d008 --- /dev/null +++ b/recipes/mongo-c-driver/all/patches/1.24.1-0002-fix-uninitialized-warning.patch @@ -0,0 +1,13 @@ +diff --git a/src/libbson/src/bson/bson-iter.c b/src/libbson/src/bson/bson-iter.c +index 00aa5c5..38e9c2b 100644 +--- a/src/libbson/src/bson/bson-iter.c ++++ b/src/libbson/src/bson/bson-iter.c +@@ -2146,7 +2146,7 @@ bson_iter_visit_all (bson_iter_t *iter, /* INOUT */ + + if (iter->err_off) { + if (unsupported && visitor->visit_unsupported_type && +- bson_utf8_validate (key, strlen (key), false)) { ++ key != NULL && bson_utf8_validate (key, strlen (key), false)) { + visitor->visit_unsupported_type (iter, key, bson_type, data); + return false; + } diff --git a/recipes/mongo-c-driver/config.yml b/recipes/mongo-c-driver/config.yml index 59ca0a1a54b12..4bae708190ef5 100644 --- a/recipes/mongo-c-driver/config.yml +++ b/recipes/mongo-c-driver/config.yml @@ -1,11 +1,11 @@ versions: - "1.22.0": + "1.29.0": folder: all - "1.17.6": + "1.28.1": folder: all - "1.17.4": + "1.27.6": folder: all - "1.17.3": + "1.26.2": folder: all - "1.17.2": + "1.24.3": folder: all diff --git a/recipes/mongo-cxx-driver/all/conandata.yml b/recipes/mongo-cxx-driver/all/conandata.yml index 9c36439157a9b..cb586c6f2a1f1 100644 --- a/recipes/mongo-cxx-driver/all/conandata.yml +++ b/recipes/mongo-cxx-driver/all/conandata.yml @@ -1,26 +1,82 @@ sources: + "3.11.0": + url: "https://github.com/mongodb/mongo-cxx-driver/releases/download/r3.11.0/mongo-cxx-driver-r3.11.0.tar.gz" + sha256: "cb4263229d769ec44aa66563e2dd2d70c6384c85d93840a52fe26b15436c54f1" + "3.10.2": + url: "https://github.com/mongodb/mongo-cxx-driver/releases/download/r3.10.2/mongo-cxx-driver-r3.10.2.tar.gz" + sha256: "52b99b2866019b5ea25d15c5a39e2a88c70fe1259c40f1091deff8bfae0194be" + "3.10.1": + url: "https://github.com/mongodb/mongo-cxx-driver/releases/download/r3.10.1/mongo-cxx-driver-r3.10.1.tar.gz" + sha256: "0297d9d1a513f09438cc05254b14baa49edd1fa64a6ce5d7a80a1eb7677cf2be" + "3.8.1": + url: "https://github.com/mongodb/mongo-cxx-driver/releases/download/r3.8.1/mongo-cxx-driver-r3.8.1.tar.gz" + sha256: "b12c96670e1e68bae1a6f5cb08541f3da52f5ddeb5def274d2cf5d662ef73160" + "3.8.0": + url: "https://github.com/mongodb/mongo-cxx-driver/releases/download/r3.8.0/mongo-cxx-driver-r3.8.0.tar.gz" + sha256: "60c7a53a0f6b984aab0b231dc0b31c85c8950059f42a354fb522672b059d5089" + "3.7.2": + url: "https://github.com/mongodb/mongo-cxx-driver/releases/download/r3.7.2/mongo-cxx-driver-r3.7.2.tar.gz" + sha256: "bc0f5193a8184db47a75685b58acd484b0e489eb0476b4d931d1bf4f5fc2186e" + "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" - "3.6.6": - url: "https://github.com/mongodb/mongo-cxx-driver/archive/r3.6.6.tar.gz" - sha256: "f989c371800458ae45ef69f6d9566e010f9420435a01bf5eb14db77fc024662e" - "3.6.2": - url: "https://github.com/mongodb/mongo-cxx-driver/archive/r3.6.2.tar.gz" - sha256: "f50a1acb98a473f0850e2766dc7e84c05415dc63b1a2f851b77b12629ac14d62" - "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.7/mongo-cxx-driver-r3.6.7.tar.gz" + sha256: "2c58005d4fe46f1973352fba821f7bb37e818cefc922377ce979a9fd1bff38ac" patches: - "3.6.7": - - patch_file: "patches/dirs_and_tests.patch" - - patch_file: "patches/poly_use_std_define.patch" - "3.6.6": - - patch_file: "patches/dirs_and_tests.patch" + "3.11.0": + - patch_file: "patches/3.10.2-0001-dirs.patch" + patch_description: "disable documentation features, fix directories" + patch_type: "conan" + - patch_file: "patches/3.10.1-0002-remove-abi-suffixes.patch" + patch_description: "remove abi suffixes for MSVC" + patch_type: "conan" + "3.10.2": + - patch_file: "patches/3.10.2-0001-dirs.patch" + patch_description: "disable documentation features, fix directories" + patch_type: "conan" + - patch_file: "patches/3.10.1-0002-remove-abi-suffixes.patch" + patch_description: "remove abi suffixes for MSVC" + patch_type: "conan" + "3.10.1": + - patch_file: "patches/3.10.1-0001-dirs.patch" + patch_description: "disable documentation features, fix directories" + patch_type: "conan" + - patch_file: "patches/3.10.1-0002-remove-abi-suffixes.patch" + patch_description: "remove abi suffixes for MSVC" + patch_type: "conan" + "3.8.1": + - patch_file: "patches/3.8.1-0001-dirs.patch" + patch_description: "disable documentation features, fix directories" + patch_type: "conan" + - patch_file: "patches/3.7.2-0002-poly_use_std_define.patch" + patch_description: "use poly macro instead __cplusplus" + patch_type: "portability" + "3.8.0": + - patch_file: "patches/3.8.0-0001-dirs.patch" + patch_description: "disable documentation features, fix directories" + patch_type: "conan" + - patch_file: "patches/3.7.2-0002-poly_use_std_define.patch" + patch_description: "use poly macro instead __cplusplus" + patch_type: "portability" + "3.7.2": + - patch_file: "patches/3.7.2-0001-dirs.patch" + patch_description: "disable documentation features, fix directories" + patch_type: "conan" + - patch_file: "patches/3.7.2-0002-poly_use_std_define.patch" + patch_description: "use poly macro instead __cplusplus" + patch_type: "portability" + "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" - "3.6.2": - - patch_file: "patches/dirs_and_tests.patch" - - patch_file: "patches/poly_use_std_define.patch" - "3.6.1": - - patch_file: "patches/dirs_and_tests.patch" + patch_description: "use poly macro instead __cplusplus" + patch_type: "portability" + "3.6.7": + - 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..92bb53ee8c6ee 100644 --- a/recipes/mongo-cxx-driver/all/conanfile.py +++ b/recipes/mongo-cxx-driver/all/conanfile.py @@ -2,22 +2,23 @@ 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 +from conan.tools.microsoft import is_msvc import os import shutil -required_conan_version = ">=1.51.1" +required_conan_version = ">=1.54.0" class MongoCxxConan(ConanFile): name = "mongo-cxx-driver" + description = "C++ Driver for MongoDB" license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" homepage = "http://mongocxx.org" - description = "C++ Driver for MongoDB" topics = ("libbsoncxx", "libmongocxx", "mongo", "mongodb", "database", "db") - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -33,8 +34,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 +42,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.28.0") if self.options.polyfill == "boost": - self.requires("boost/1.79.0") + self.requires("boost/1.82.0", transitive_headers=True) @property def _minimal_std_version(self): @@ -90,33 +93,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 +129,9 @@ 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 + if Version(self.version) >= "3.10.1" and is_msvc(self): + tc.variables["ENABLE_ABI_TAG_IN_LIBRARY_FILENAMES"] = False tc.generate() deps = CMakeDeps(self) @@ -185,6 +185,8 @@ def package_info(self): if not self.options.shared: self.cpp_info.components["mongocxx"].defines.append("MONGOCXX_STATIC") self.cpp_info.components["mongocxx"].requires = ["mongo-c-driver::mongoc", "bsoncxx"] + if Version(self.version) >= "3.10.1": + self.cpp_info.components["mongocxx"].includedirs.append(os.path.join("include", "mongocxx", "v_noabi")) # bsoncxx bsoncxx_target = "bsoncxx_shared" if self.options.shared else "bsoncxx_static" @@ -200,3 +202,5 @@ def package_info(self): self.cpp_info.components["bsoncxx"].requires = ["mongo-c-driver::bson"] if self.options.polyfill == "boost": self.cpp_info.components["bsoncxx"].requires.append("boost::headers") + if Version(self.version) >= "3.10.1": + self.cpp_info.components["bsoncxx"].includedirs.append(os.path.join("include", "bsoncxx", "v_noabi")) diff --git a/recipes/mongo-cxx-driver/all/patches/3.10.1-0001-dirs.patch b/recipes/mongo-cxx-driver/all/patches/3.10.1-0001-dirs.patch new file mode 100644 index 0000000000000..41a672d93964e --- /dev/null +++ b/recipes/mongo-cxx-driver/all/patches/3.10.1-0001-dirs.patch @@ -0,0 +1,61 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 2a960f7..f809b6c 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -315,7 +315,7 @@ unset(dist_generated_depends CACHE) + set(BUILD_SOURCE_DIR ${CMAKE_BINARY_DIR}) + + include(MakeDistFiles) +- ++if(FALSE) + add_custom_target(hugo_dir + COMMAND ${CMAKE_COMMAND} -E make_directory hugo + ) +@@ -371,7 +371,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) + set(DATA_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/data) + +@@ -381,13 +381,13 @@ option(ENABLE_MACRO_GUARD_TESTS "Enable targets for macro guard compile tests." + 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) + +-add_subdirectory(examples EXCLUDE_FROM_ALL) +- +-add_subdirectory(benchmark EXCLUDE_FROM_ALL) +- ++# add_subdirectory(benchmark EXCLUDE_FROM_ALL) ++if(FALSE) + # Implement 'dist' target + # + # CMake does not implement anything like 'dist' from autotools. +@@ -525,3 +525,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 ce53a71..bcd0a61 100644 +--- a/src/bsoncxx/CMakeLists.txt ++++ b/src/bsoncxx/CMakeLists.txt +@@ -93,8 +93,8 @@ if(TARGET bson_shared OR TARGET bson_static) + set(BSONCXX_PKG_DEP "find_dependency(bson-${LIBBSON_REQUIRED_ABI_VERSION} REQUIRED)") + 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(STATUS "found libbson version ${bson-${LIBBSON_REQUIRED_ABI_VERSION}_VERSION}") + diff --git a/recipes/mongo-cxx-driver/all/patches/3.10.1-0002-remove-abi-suffixes.patch b/recipes/mongo-cxx-driver/all/patches/3.10.1-0002-remove-abi-suffixes.patch new file mode 100644 index 0000000000000..f1fdc639b41ea --- /dev/null +++ b/recipes/mongo-cxx-driver/all/patches/3.10.1-0002-remove-abi-suffixes.patch @@ -0,0 +1,26 @@ +diff --git a/cmake/BsoncxxUtil.cmake b/cmake/BsoncxxUtil.cmake +index c72f98e..5f977e1 100644 +--- a/cmake/BsoncxxUtil.cmake ++++ b/cmake/BsoncxxUtil.cmake +@@ -76,7 +76,7 @@ function(bsoncxx_add_library TARGET OUTPUT_NAME LINK_TYPE) + endif() + + # MSVC-specific ABI tag suffixes. +- if(MSVC) ++ if(0) + set(vs_suffix "") + + # Include the target architecture if applicable (Win32, x64, etc.). +diff --git a/cmake/MongocxxUtil.cmake b/cmake/MongocxxUtil.cmake +index de9210c..f9937f4 100644 +--- a/cmake/MongocxxUtil.cmake ++++ b/cmake/MongocxxUtil.cmake +@@ -63,7 +63,7 @@ function(mongocxx_add_library TARGET OUTPUT_NAME LINK_TYPE) + endif() + + # MSVC-specific ABI tag suffixes. Inherit from bsoncxx. +- if(MSVC) ++ if(0) + get_target_property(vs_suffix ${bsoncxx_target} BSONCXX_ABI_TAG_VS_SUFFIX) + set_target_properties(${TARGET} PROPERTIES + BSONCXX_ABI_TAG_VS_SUFFIX ${vs_suffix} diff --git a/recipes/mongo-cxx-driver/all/patches/3.10.2-0001-dirs.patch b/recipes/mongo-cxx-driver/all/patches/3.10.2-0001-dirs.patch new file mode 100644 index 0000000000000..360b25feaf147 --- /dev/null +++ b/recipes/mongo-cxx-driver/all/patches/3.10.2-0001-dirs.patch @@ -0,0 +1,57 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 6d612a4..5b3f872 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -279,7 +279,7 @@ unset(dist_generated_depends CACHE) + set(BUILD_SOURCE_DIR ${CMAKE_BINARY_DIR}) + + include(MakeDistFiles) +- ++if(FALSE) + add_custom_target(hugo_dir + COMMAND ${CMAKE_COMMAND} -E make_directory hugo + ) +@@ -335,7 +335,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) + set(DATA_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/data) + +@@ -348,10 +348,10 @@ endif() + + add_subdirectory(src) + +-add_subdirectory(examples EXCLUDE_FROM_ALL) +- +-add_subdirectory(benchmark EXCLUDE_FROM_ALL) ++# add_subdirectory(examples EXCLUDE_FROM_ALL) + ++# add_subdirectory(benchmark EXCLUDE_FROM_ALL) ++if(FALSE) + # Implement 'dist' target + # + # CMake does not implement anything like 'dist' from autotools. +@@ -489,3 +489,4 @@ endif() + if(CMAKE_GENERATOR_TOOLSET) + message(STATUS "\tinstance: ${CMAKE_GENERATOR_TOOLSET}") + endif() ++endif() +\ No newline at end of file +diff --git a/src/bsoncxx/CMakeLists.txt b/src/bsoncxx/CMakeLists.txt +index ce53a71..90c4fd2 100644 +--- a/src/bsoncxx/CMakeLists.txt ++++ b/src/bsoncxx/CMakeLists.txt +@@ -93,8 +93,8 @@ if(TARGET bson_shared OR TARGET bson_static) + set(BSONCXX_PKG_DEP "find_dependency(bson-${LIBBSON_REQUIRED_ABI_VERSION} REQUIRED)") + 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(STATUS "found libbson version ${bson-${LIBBSON_REQUIRED_ABI_VERSION}_VERSION}") + 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/patches/3.7.2-0001-dirs.patch b/recipes/mongo-cxx-driver/all/patches/3.7.2-0001-dirs.patch new file mode 100644 index 0000000000000..f1c52fb2f96e1 --- /dev/null +++ b/recipes/mongo-cxx-driver/all/patches/3.7.2-0001-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 a7e6ded..4fb9027 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.22.1) + set(LIBMONGOC_REQUIRED_ABI_VERSION 1.0) diff --git a/recipes/mongo-cxx-driver/all/patches/3.7.2-0002-poly_use_std_define.patch b/recipes/mongo-cxx-driver/all/patches/3.7.2-0002-poly_use_std_define.patch new file mode 100644 index 0000000000000..1105c439eae72 --- /dev/null +++ b/recipes/mongo-cxx-driver/all/patches/3.7.2-0002-poly_use_std_define.patch @@ -0,0 +1,13 @@ +diff --git a/src/bsoncxx/stdx/make_unique.hpp b/src/bsoncxx/stdx/make_unique.hpp +index fe8bb2d..737e76b 100644 +--- a/src/bsoncxx/stdx/make_unique.hpp ++++ b/src/bsoncxx/stdx/make_unique.hpp +@@ -48,7 +48,7 @@ using ::boost::make_unique; + BSONCXX_INLINE_NAMESPACE_END + } // namespace bsoncxx + +-#elif __cplusplus >= 201402L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201402L) ++#elif defined(BSONCXX_POLY_USE_STD) + + #include + diff --git a/recipes/mongo-cxx-driver/all/patches/3.8.0-0001-dirs.patch b/recipes/mongo-cxx-driver/all/patches/3.8.0-0001-dirs.patch new file mode 100644 index 0000000000000..e057a4548d890 --- /dev/null +++ b/recipes/mongo-cxx-driver/all/patches/3.8.0-0001-dirs.patch @@ -0,0 +1,82 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 20254fa..98add65 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 f30aea8..09e907c 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.24.0) + set(LIBBSON_REQUIRED_ABI_VERSION 1.0) +@@ -95,8 +95,9 @@ 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}") + if(NOT BSONCXX_LINK_WITH_STATIC_MONGOC) +diff --git a/src/mongocxx/CMakeLists.txt b/src/mongocxx/CMakeLists.txt +index 45fd3ad..3248655 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.24.0) + set(LIBMONGOC_REQUIRED_ABI_VERSION 1.0) diff --git a/recipes/mongo-cxx-driver/all/patches/3.8.1-0001-dirs.patch b/recipes/mongo-cxx-driver/all/patches/3.8.1-0001-dirs.patch new file mode 100644 index 0000000000000..d7084612ddc1d --- /dev/null +++ b/recipes/mongo-cxx-driver/all/patches/3.8.1-0001-dirs.patch @@ -0,0 +1,80 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index d09a395ce..93992709e 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -209,6 +209,7 @@ set (BUILD_SOURCE_DIR ${CMAKE_BINARY_DIR}) + + include (MakeDistFiles) + ++if(FALSE) + add_custom_target(hugo_dir + COMMAND ${CMAKE_COMMAND} -E make_directory hugo + ) +@@ -264,6 +265,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) + +@@ -273,6 +275,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) +@@ -284,6 +289,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) +@@ -385,3 +391,5 @@ 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 f30aea836..f51e76bca 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.24.0) + set(LIBBSON_REQUIRED_ABI_VERSION 1.0) +@@ -95,7 +95,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 45fd3ad4f..324865543 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.24.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_package/test_package.cpp b/recipes/mongo-cxx-driver/all/test_package/test_package.cpp index 57282320fb7a6..d44d69617b5ba 100644 --- a/recipes/mongo-cxx-driver/all/test_package/test_package.cpp +++ b/recipes/mongo-cxx-driver/all/test_package/test_package.cpp @@ -6,8 +6,6 @@ #include // Compilation check -#include -#include #include int main() { 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..9198272a479a9 100644 --- a/recipes/mongo-cxx-driver/config.yml +++ b/recipes/mongo-cxx-driver/config.yml @@ -1,9 +1,19 @@ versions: - "3.6.7": + "3.11.0": + folder: all + "3.10.2": + folder: all + "3.10.1": folder: all - "3.6.6": + # keep 3.8.1 for gdal + "3.8.1": folder: all - "3.6.2": + "3.8.0": folder: all - "3.6.1": + "3.7.2": + folder: all + "3.7.0": + folder: all + # keep 3.6.7 for gdal + "3.6.7": folder: all diff --git a/recipes/morton-nd/all/conandata.yml b/recipes/morton-nd/all/conandata.yml index 41b2951c67096..da7e41c780c0c 100644 --- a/recipes/morton-nd/all/conandata.yml +++ b/recipes/morton-nd/all/conandata.yml @@ -5,3 +5,10 @@ sources: "3.0.0": url: "https://github.com/kevinhartman/morton-nd/archive/v3.0.0.tar.gz" sha256: "ba57df04a2e1e73709f55fd3fee71082750013c5792de3c6eb84a8c87d40d781" +patches: + "4.0.0": + - patch_file: "patches/0001-v4.0.0-fix-include-cstdint.patch" + patch_type: "portability" + "3.0.0": + - patch_file: "patches/0001-v3.0.0-fix-include-cstdint.patch" + patch_type: "portability" diff --git a/recipes/morton-nd/all/conanfile.py b/recipes/morton-nd/all/conanfile.py index 5e3263ed60dd4..9558cedb497f2 100644 --- a/recipes/morton-nd/all/conanfile.py +++ b/recipes/morton-nd/all/conanfile.py @@ -1,7 +1,7 @@ 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 from conan.tools.scm import Version import os @@ -14,9 +14,10 @@ class MortonndConan(ConanFile): description = "A header-only Morton encode/decode library (C++14) capable " \ "of encoding from and decoding to N-dimensional space." license = "MIT" - topics = ("morton-nd", "morton", "encoding", "decoding", "n-dimensional") + topics = ("morton", "encoding", "decoding", "n-dimensional") homepage = "https://github.com/kevinhartman/morton-nd" url = "https://github.com/conan-io/conan-center-index" + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -34,6 +35,9 @@ def _compilers_minimum_version(self): "apple-clang": "5.1", } + def layout(self): + basic_layout(self, src_folder="src") + def package_id(self): self.info.clear() @@ -45,13 +49,13 @@ def validate(self): 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 export_sources(self): + export_conandata_patches(self) 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) + apply_conandata_patches(self) def build(self): pass @@ -64,9 +68,7 @@ def package_info(self): self.cpp_info.set_property("cmake_file_name", "morton-nd") self.cpp_info.set_property("cmake_target_name", "morton-nd::MortonND") 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"] = "morton-nd" @@ -75,6 +77,4 @@ def package_info(self): self.cpp_info.components["mortonnd"].names["cmake_find_package_multi"] = "MortonND" self.cpp_info.components["mortonnd"].set_property("cmake_target_name", "morton-nd::MortonND") self.cpp_info.components["mortonnd"].bindirs = [] - self.cpp_info.components["mortonnd"].frameworkdirs = [] self.cpp_info.components["mortonnd"].libdirs = [] - self.cpp_info.components["mortonnd"].resdirs = [] diff --git a/recipes/morton-nd/all/patches/0001-v3.0.0-fix-include-cstdint.patch b/recipes/morton-nd/all/patches/0001-v3.0.0-fix-include-cstdint.patch new file mode 100644 index 0000000000000..52cd77981fa28 --- /dev/null +++ b/recipes/morton-nd/all/patches/0001-v3.0.0-fix-include-cstdint.patch @@ -0,0 +1,24 @@ +diff --git a/include/morton-nd/mortonND_BMI2.h b/include/morton-nd/mortonND_BMI2.h +index b99d2c0..63d89f2 100644 +--- a/include/morton-nd/mortonND_BMI2.h ++++ b/include/morton-nd/mortonND_BMI2.h +@@ -17,6 +17,7 @@ + #include + #include + #include ++#include + + namespace mortonnd { + +diff --git a/include/morton-nd/mortonND_LUT_encoder.h b/include/morton-nd/mortonND_LUT_encoder.h +index 5d75cb2..575c898 100644 +--- a/include/morton-nd/mortonND_LUT_encoder.h ++++ b/include/morton-nd/mortonND_LUT_encoder.h +@@ -13,6 +13,7 @@ + #include + #include + #include ++#include + + namespace mortonnd { + diff --git a/recipes/morton-nd/all/patches/0001-v4.0.0-fix-include-cstdint.patch b/recipes/morton-nd/all/patches/0001-v4.0.0-fix-include-cstdint.patch new file mode 100644 index 0000000000000..0cc25573d036f --- /dev/null +++ b/recipes/morton-nd/all/patches/0001-v4.0.0-fix-include-cstdint.patch @@ -0,0 +1,24 @@ +diff --git a/include/morton-nd/mortonND_BMI2.h b/include/morton-nd/mortonND_BMI2.h +index b99d2c0..63d89f2 100644 +--- a/include/morton-nd/mortonND_BMI2.h ++++ b/include/morton-nd/mortonND_BMI2.h +@@ -17,6 +17,7 @@ + #include + #include + #include ++#include + + namespace mortonnd { + +diff --git a/include/morton-nd/mortonND_LUT.h b/include/morton-nd/mortonND_LUT.h +index 110ad63..fb3777b 100644 +--- a/include/morton-nd/mortonND_LUT.h ++++ b/include/morton-nd/mortonND_LUT.h +@@ -13,6 +13,7 @@ + #include + #include + #include ++#include + + namespace mortonnd { + diff --git a/recipes/morton-nd/all/test_package/conanfile.py b/recipes/morton-nd/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/morton-nd/all/test_package/conanfile.py +++ b/recipes/morton-nd/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/morton-nd/all/test_v1_package/CMakeLists.txt b/recipes/morton-nd/all/test_v1_package/CMakeLists.txt index 07fa1c30a5235..b21cc49efde95 100644 --- a/recipes/morton-nd/all/test_v1_package/CMakeLists.txt +++ b/recipes/morton-nd/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.15) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(morton-nd REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE morton-nd::MortonND) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) -if(morton-nd_VERSION VERSION_LESS "4.0.0") - target_compile_definitions(${PROJECT_NAME} PRIVATE "MORTONND_LESS_4_0_0") -endif() +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) 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..030bc9686278b 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,63 @@ 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") + # uses deprecated functions in openssl/3.0.0 + self.requires("openssl/1.1.1w") 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 +105,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/CMakeLists.txt b/recipes/mosquitto/2.x/CMakeLists.txt deleted file mode 100644 index 0afabb3cbe2e0..0000000000000 --- a/recipes/mosquitto/2.x/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(conan_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/mosquitto/2.x/conandata.yml b/recipes/mosquitto/2.x/conandata.yml index 622f72a77af8b..8200a378ca1b5 100644 --- a/recipes/mosquitto/2.x/conandata.yml +++ b/recipes/mosquitto/2.x/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.0.18": + url: "https://github.com/eclipse/mosquitto/archive/v2.0.18.tar.gz" + sha256: "25499231664bc5338f9f05eb1815f4d5878f0c6c97e03afb3463a7b139a7e775" "2.0.15": url: "https://github.com/eclipse/mosquitto/archive/v2.0.15.tar.gz" sha256: "26dc3f1758b00c1725a0e4dd32f40c61f374375717f09b6af2bac62c5b44f1eb" diff --git a/recipes/mosquitto/2.x/conanfile.py b/recipes/mosquitto/2.x/conanfile.py index a2b39f2d1e5d0..c221f41ff8ca8 100644 --- a/recipes/mosquitto/2.x/conanfile.py +++ b/recipes/mosquitto/2.x/conanfile.py @@ -1,20 +1,23 @@ import os + from conan import ConanFile -from conan.tools.files import get, replace_in_file, rmdir, rm +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, rmdir, rm +from conan.tools.microsoft import is_msvc from conan.tools.scm import Version -from conans import CMake -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.53.0" class Mosquitto(ConanFile): name = "mosquitto" + description = """Eclipse Mosquitto MQTT library, broker and more""" license = "EPL-2.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://mosquitto.org" - description = """Eclipse Mosquitto MQTT library, broker and more""" topics = ("MQTT", "IoT", "eclipse") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -40,113 +43,93 @@ class Mosquitto(ConanFile): "websockets": False, "threading": 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" + generators = "CMakeDeps" 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.clients: - del self.options.cjson + self.options.rm_safe("cjson") if not self.options.broker: - del self.options.websockets + self.options.rm_safe("websockets") if not self.options.build_cpp: - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("compiler.libcxx") + self.options.rm_safe("compiler.cppstd") + + 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 <4]") if self.options.get_safe("cjson"): - self.requires("cjson/1.7.14") + self.requires("cjson/1.7.16") if self.options.get_safe("websockets"): - self.requires("libwebsockets/4.2.0") + self.requires("libwebsockets/4.3.2") def source(self): - 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["WITH_STATIC_LIBRARIES"] = not self.options.shared - self._cmake.definitions["WITH_PIC"] = self.options.get_safe("fPIC", False) - self._cmake.definitions["WITH_TLS"] = self.options.ssl - self._cmake.definitions["WITH_CLIENTS"] = self.options.clients + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["WITH_STATIC_LIBRARIES"] = not self.options.shared + tc.variables["WITH_PIC"] = self.options.get_safe("fPIC", True) + tc.variables["WITH_TLS"] = self.options.ssl + tc.variables["WITH_CLIENTS"] = self.options.clients if Version(self.version) < "2.0.6": - self._cmake.definitions["CMAKE_DISABLE_FIND_PACKAGE_cJSON"] = not self.options.get_safe("cjson") + tc.variables["CMAKE_DISABLE_FIND_PACKAGE_cJSON"] = not self.options.get_safe("cjson") else: - self._cmake.definitions["WITH_CJSON"] = self.options.get_safe("cjson") - self._cmake.definitions["WITH_BROKER"] = self.options.broker - 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" 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 - self._cmake.definitions["CMAKE_INSTALL_SYSCONFDIR"] = os.path.join(self.package_folder, "res").replace("\\", "/") - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake - - def _patch_sources(self): - replace_in_file(self, os.path.join(self._source_subfolder, "client", "CMakeLists.txt"), "static)", "static ${CONAN_LIBS})") - replace_in_file(self, os.path.join(self._source_subfolder, "client", "CMakeLists.txt"), "quitto)", "quitto ${CONAN_LIBS})") - replace_in_file(self, os.path.join(self._source_subfolder, "apps", "mosquitto_ctrl", "CMakeLists.txt"), "static)", "static ${CONAN_LIBS})") - replace_in_file(self, os.path.join(self._source_subfolder, "apps", "mosquitto_ctrl", "CMakeLists.txt"), "quitto)", "quitto ${CONAN_LIBS})") - replace_in_file(self, os.path.join(self._source_subfolder, "apps", "mosquitto_passwd", "CMakeLists.txt"), "OPENSSL_LIBRARIES", "CONAN_LIBS") - replace_in_file(self, os.path.join(self._source_subfolder, "apps", "mosquitto_ctrl", "CMakeLists.txt"), "OPENSSL_LIBRARIES", "CONAN_LIBS") - replace_in_file(self, os.path.join(self._source_subfolder, "src", "CMakeLists.txt"), "OPENSSL_LIBRARIES", "CONAN_LIBS") - replace_in_file(self, os.path.join(self._source_subfolder, "lib", "CMakeLists.txt"), "OPENSSL_LIBRARIES", "CONAN_LIBS") - replace_in_file(self, os.path.join(self._source_subfolder, "src", "CMakeLists.txt"), "MOSQ_LIBS", "CONAN_LIBS") - replace_in_file(self, os.path.join(self._source_subfolder, "include", "mosquitto.h"), "__declspec(dllimport)", "") - replace_in_file(self, os.path.join(self._source_subfolder, "lib", "cpp", "mosquittopp.h"), "__declspec(dllimport)", "") - # dynlibs for apple mobile want code signatures and that will not work here - # this would actually be the right patch for static builds also, but this would have other side effects, so - if(self.settings.os in ["iOS", "watchOS", "tvOS"]): - replace_in_file(self, os.path.join(self._source_subfolder, "lib", "CMakeLists.txt"), "SHARED", "") - replace_in_file(self, os.path.join(self._source_subfolder, "lib", "cpp", "CMakeLists.txt"), "SHARED", "") + tc.variables["WITH_CJSON"] = self.options.get_safe("cjson") + tc.variables["WITH_BROKER"] = self.options.broker + tc.variables["WITH_APPS"] = self.options.apps + tc.variables["WITH_PLUGINS"] = False + tc.variables["WITH_LIB_CPP"] = self.options.build_cpp + tc.variables["WITH_THREADING"] = not is_msvc(self) and self.options.threading + tc.variables["WITH_WEBSOCKETS"] = self.options.get_safe("websockets", False) + tc.variables["STATIC_WEBSOCKETS"] = self.options.get_safe("websockets", False) and not self.dependencies["libwebsockets"].options.shared + tc.variables["DOCUMENTATION"] = False + tc.variables["CMAKE_INSTALL_SYSCONFDIR"] = os.path.join(self.package_folder, "res").replace("\\", "/") + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + tc.generate() def build(self): - self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("edl-v10", src=self._source_subfolder, dst="licenses") - self.copy("epl-v20", src=self._source_subfolder, dst="licenses") - self.copy("LICENSE.txt", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + for license_file in ("LICENSE.txt", "edl-v10", "epl-v20"): + copy(self, license_file, self.source_folder, os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) rm(self, "*.example", os.path.join(self.package_folder, "res")) + package_lib_folder = os.path.join(self.package_folder, "lib") if not self.options.shared: - rm(self, "*.so*", os.path.join(self.package_folder, "lib")) - rm(self, "*.dylib", os.path.join(self.package_folder, "lib")) rm(self, "*.dll", os.path.join(self.package_folder, "bin")) - elif self.options.shared and self.settings.compiler == "Visual Studio": - self.copy("mosquitto.lib", src=os.path.join(self._build_subfolder, "lib"), dst="lib") + rm(self, "mosquitto.lib", package_lib_folder) + rm(self, "mosquittopp.lib", package_lib_folder) + rm(self, "*.dll.a", package_lib_folder) + rm(self, "*.so*", package_lib_folder) + rm(self, "*.dylib", package_lib_folder) + elif self.options.shared and is_msvc(self): + lib_folder = os.path.join(self.build_folder, "lib", str(self.settings.build_type)) + copy(self, "mosquitto.lib", lib_folder, package_lib_folder) if self.options.build_cpp: - self.copy("mosquittopp.lib", src=os.path.join(self._build_subfolder, "lib"), dst="lib") + libpp_folder = os.path.join(self.build_folder, "lib", "cpp", str(self.settings.build_type)) + copy(self, "mosquittopp.lib", libpp_folder, package_lib_folder) def package_info(self): - libsuffix = "" if self.options.shared else "_static" - self.cpp_info.components["libmosquitto"].names["pkg_config"] = "libmosquitto" - self.cpp_info.components["libmosquitto"].libs = ["mosquitto" + libsuffix] + lib_suffix = "" if self.options.shared else "_static" + 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 = ["LIBMOSQUITTO_STATIC"] if self.options.ssl: self.cpp_info.components["libmosquitto"].requires = ["openssl::openssl"] if self.settings.os == "Linux": @@ -155,22 +138,17 @@ def package_info(self): self.cpp_info.components["libmosquitto"].system_libs = ["ws2_32"] if self.options.build_cpp: - self.cpp_info.components["libmosquittopp"].names["pkg_config"] = "libmosquittopp" - self.cpp_info.components["libmosquittopp"].libs = ["mosquittopp" + libsuffix] + 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"] if self.settings.os == "Linux": self.cpp_info.components["libmosquittopp"].system_libs = ["pthread", "m"] elif self.settings.os == "Windows": self.cpp_info.components["libmosquittopp"].system_libs = ["ws2_32"] - if self.options.broker or self.options.get_safe("apps") or self.options.get_safe("clients"): - 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) - if self.options.broker: self.cpp_info.components["mosquitto_broker"].libdirs = [] - self.cpp_info.components["mosquitto_broker"].include_dirs = [] + self.cpp_info.components["mosquitto_broker"].includedirs = [] if self.options.websockets: self.cpp_info.components["mosquitto_broker"].requires.append("libwebsockets::libwebsockets") if self.settings.os in ("FreeBSD", "Linux"): @@ -182,7 +160,13 @@ def package_info(self): if self.options.get_safe(option): option_comp_name = "mosquitto_{}".format(option) self.cpp_info.components[option_comp_name].libdirs = [] - self.cpp_info.components[option_comp_name].include_dirs = [] + self.cpp_info.components[option_comp_name].includedirs = [] self.cpp_info.components[option_comp_name].requires = ["openssl::openssl", "libmosquitto"] if self.options.cjson: self.cpp_info.components[option_comp_name].requires.append("cjson::cjson") + + # TODO: to remove in conan v2 + if self.options.broker or self.options.get_safe("apps") or self.options.get_safe("clients"): + 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/mosquitto/2.x/test_package/CMakeLists.txt b/recipes/mosquitto/2.x/test_package/CMakeLists.txt index e4946381ed96d..d1e99239bfe10 100644 --- a/recipes/mosquitto/2.x/test_package/CMakeLists.txt +++ b/recipes/mosquitto/2.x/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) +project(test_package LANGUAGES C) find_package(mosquitto REQUIRED CONFIG) + add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} mosquitto::mosquitto) +target_link_libraries(${PROJECT_NAME} PRIVATE mosquitto::libmosquitto) diff --git a/recipes/mosquitto/2.x/test_package/conanfile.py b/recipes/mosquitto/2.x/test_package/conanfile.py index 9963f7a997273..98ab55852ad56 100644 --- a/recipes/mosquitto/2.x/test_package/conanfile.py +++ b/recipes/mosquitto/2.x/test_package/conanfile.py @@ -1,11 +1,19 @@ 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", "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 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/mosquitto/2.x/test_package/test_package.c b/recipes/mosquitto/2.x/test_package/test_package.c index de500c81909be..53439ed97c364 100644 --- a/recipes/mosquitto/2.x/test_package/test_package.c +++ b/recipes/mosquitto/2.x/test_package/test_package.c @@ -1,19 +1,59 @@ -#include +#include #include +#ifdef WIN32 +# include +#endif +#include "mosquitto.h" -int main(int argc, char *argv[]) -{ - struct mosquitto *mosq; - int rc; +/* Hostname and port for the MQTT broker. */ +#define BROKER_HOSTNAME "localhost" +#define BROKER_PORT 1883 - mosquitto_lib_init(); - mosq = mosquitto_new(NULL, true, NULL); - if(mosq == NULL){ - fprintf(stderr, "Error: Out of memory.\n"); - return 1; - } - mosquitto_lib_cleanup(); - return 0; -} +void connect_callback(struct mosquitto *mosq, void *obj, int result) {} +void message_callback(struct mosquitto *mosq, void *obj, const struct mosquitto_message *message) {} + +int main(int argc, char * argv []) { + struct mosquitto* st_mosquitto = NULL; + + #ifdef WIN32 + WORD wVersionRequested = MAKEWORD(2, 2); + WSADATA wsaData; + WSAStartup(wVersionRequested, &wsaData); + #endif + + puts("mosquitto_lib_init"); + if (mosquitto_lib_init() != MOSQ_ERR_SUCCESS) { + return EXIT_FAILURE; + } + + puts("mosquitto_new"); + st_mosquitto = mosquitto_new("foobar", true, NULL); + if (!st_mosquitto) { + return EXIT_FAILURE; + } + + puts("mosquitto_connect_callback_set"); + mosquitto_connect_callback_set(st_mosquitto, connect_callback); + mosquitto_message_callback_set(st_mosquitto, message_callback); + puts("mosquitto_connect"); + if (mosquitto_connect(st_mosquitto, BROKER_HOSTNAME, BROKER_PORT, 60) != MOSQ_ERR_SUCCESS) { + fprintf(stderr, "Could not connect to MQTT broker\n"); + } + + puts("mosquitto_subscribe"); + if (mosquitto_subscribe(st_mosquitto, NULL, "#", 0) != MOSQ_ERR_SUCCESS) { + fprintf(stderr, "Could not suscribe to MQTT broker\n"); + } + + puts("mosquitto_destroy"); + mosquitto_destroy(st_mosquitto); + + puts("mosquitto_lib_cleanup"); + if (mosquitto_lib_cleanup() != MOSQ_ERR_SUCCESS) { + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; +} diff --git a/recipes/mosquitto/2.x/test_v1_package/CMakeLists.txt b/recipes/mosquitto/2.x/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..f113bcd8a8b0e --- /dev/null +++ b/recipes/mosquitto/2.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/mosquitto/2.x/test_v1_package/conanfile.py b/recipes/mosquitto/2.x/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..9963f7a997273 --- /dev/null +++ b/recipes/mosquitto/2.x/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +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_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/mosquitto/config.yml b/recipes/mosquitto/config.yml index 7627743e2625f..0e19ca6c8d04b 100644 --- a/recipes/mosquitto/config.yml +++ b/recipes/mosquitto/config.yml @@ -1,4 +1,6 @@ versions: + "2.0.18": + folder: "2.x" "2.0.15": folder: "2.x" "2.0.14": diff --git a/recipes/mozilla-build/all/conandata.yml b/recipes/mozilla-build/all/conandata.yml index 5311816d69140..170e338726163 100644 --- a/recipes/mozilla-build/all/conandata.yml +++ b/recipes/mozilla-build/all/conandata.yml @@ -1,4 +1,9 @@ sources: + "4.0.2": + - url: "https://ftp.mozilla.org/pub/mozilla/libraries/win32/MozillaBuildSetup-4.0.2.exe" + sha256: "a7b84c266fc8908a925f6a788f46226aa76507e1b43230f7a63db6e1b1384ed1" + - url: "https://www.mozilla.org/media/MPL/2.0/index.815ca599c9df.txt" + sha256: "fab3dd6bdab226f1c08630b1dd917e11fcb4ec5e1e020e2c16f83a0a13863e85" "3.3": - url: "https://ftp.mozilla.org/pub/mozilla/libraries/win32/MozillaBuildSetup-3.3.exe" sha256: "ac86e5794c6a99c25dee0b60720c7cfd9833ec64785c74838723179830749c9c" diff --git a/recipes/mozilla-build/all/conanfile.py b/recipes/mozilla-build/all/conanfile.py index c13282cd3e215..6bed83f899cf8 100644 --- a/recipes/mozilla-build/all/conanfile.py +++ b/recipes/mozilla-build/all/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.files import download +from conan.tools.files import download, copy from conan.errors import ConanInvalidConfiguration import os @@ -19,18 +19,18 @@ def validate(self): raise ConanInvalidConfiguration("Only Windows supported") def build_requirements(self): - self.build_requires("7zip/19.00") + self.build_requires("7zip/22.01") def build(self): filename = "mozilla-build.exe" 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) + self.run(f"7z x {filename}") def package(self): - self.copy("LICENSE", dst="licenses") - self.copy("nsinstall.exe", src="bin", dst="bin") + copy(self, "LICENSE", src=self.build_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "nsinstall.exe", src=os.path.join(self.build_folder, "bin"), dst=os.path.join(self.package_folder, "bin")) def package_id(self): del self.info.settings.build_type diff --git a/recipes/mozilla-build/all/test_package/conanfile.py b/recipes/mozilla-build/all/test_package/conanfile.py index 73fd3540bb387..dd7e8af7bf77d 100644 --- a/recipes/mozilla-build/all/test_package/conanfile.py +++ b/recipes/mozilla-build/all/test_package/conanfile.py @@ -1,15 +1,21 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.files import save import os 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): - tools.save("file.txt", "some text") + save(self, "file.txt", "some text") assert not os.path.isdir("destionation") self.run("nsinstall -D destination") assert os.path.isdir("destination") assert not os.path.isfile(os.path.join("destination", "file.txt")) self.run("nsinstall -t -m 644 file.txt destination") assert os.path.isfile(os.path.join("destination", "file.txt")) - diff --git a/recipes/mozilla-build/config.yml b/recipes/mozilla-build/config.yml index e5e834cfda633..2bc9098fbced7 100644 --- a/recipes/mozilla-build/config.yml +++ b/recipes/mozilla-build/config.yml @@ -1,3 +1,5 @@ versions: + "4.0.2": + folder: all "3.3": folder: all diff --git a/recipes/mozjpeg/all/conandata.yml b/recipes/mozjpeg/all/conandata.yml index b3cb941ad21eb..16c60131167b1 100644 --- a/recipes/mozjpeg/all/conandata.yml +++ b/recipes/mozjpeg/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "4.1.5": + url: "https://github.com/mozilla/mozjpeg/archive/v4.1.5.tar.gz" + sha256: "9fcbb7171f6ac383f5b391175d6fb3acde5e64c4c4727274eade84ed0998fcc1" + "4.1.3": + url: "https://github.com/mozilla/mozjpeg/archive/v4.1.3.tar.gz" + sha256: "f6ce89f616b30c498d1fb3b0f0940914557d8393a79c9e7aafff72032446bca0" "4.1.1": url: "https://github.com/mozilla/mozjpeg/archive/v4.1.1.tar.gz" sha256: "66b1b8d6b55d263f35f27f55acaaa3234df2a401232de99b6d099e2bb0a9d196" @@ -9,6 +15,14 @@ sources: url: "https://github.com/mozilla/mozjpeg/archive/v3.3.1.tar.gz" sha256: "aebbea60ea038a84a2d1ed3de38fdbca34027e2e54ee2b7d08a97578be72599d" patches: + "4.1.5": + - patch_file: "patches/4.1.5-0001-cmake-fixes.patch" + patch_description: "fix install folder and disable /NODEFAULT in MSVC" + patch_type: "conan" + "4.1.3": + - patch_file: "patches/4.1.3-0001-cmake-fixes.patch" + patch_description: "fix install folder and disable /NODEFAULT in MSVC" + patch_type: "conan" "4.1.1": - patch_file: "patches/4.1.1-0001-cmake-fixes.patch" patch_description: "fix install folder and disable /NODEFAULT in MSVC" diff --git a/recipes/mozjpeg/all/conanfile.py b/recipes/mozjpeg/all/conanfile.py index 3dcf78b0f0e8e..117852b445d53 100644 --- a/recipes/mozjpeg/all/conanfile.py +++ b/recipes/mozjpeg/all/conanfile.py @@ -82,7 +82,7 @@ def build_requirements(self): if not self._use_cmake: 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") + self.tool_requires("pkgconf/2.0.3") if self.options.get_safe("SIMD"): self.tool_requires("nasm/2.15.05") diff --git a/recipes/mozjpeg/all/patches/4.1.3-0001-cmake-fixes.patch b/recipes/mozjpeg/all/patches/4.1.3-0001-cmake-fixes.patch new file mode 100644 index 0000000000000..b9d6dd16f33f3 --- /dev/null +++ b/recipes/mozjpeg/all/patches/4.1.3-0001-cmake-fixes.patch @@ -0,0 +1,34 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 82ce902..bde4aba 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1492,7 +1492,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() +@@ -1510,16 +1510,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/patches/4.1.5-0001-cmake-fixes.patch b/recipes/mozjpeg/all/patches/4.1.5-0001-cmake-fixes.patch new file mode 100644 index 0000000000000..d3dd3fde8807b --- /dev/null +++ b/recipes/mozjpeg/all/patches/4.1.5-0001-cmake-fixes.patch @@ -0,0 +1,34 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 939625d..c234c44 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1518,7 +1518,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() +@@ -1536,16 +1536,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/conanfile.py b/recipes/mozjpeg/all/test_package/conanfile.py index 2494f49b77c0d..e845ae751a301 100644 --- a/recipes/mozjpeg/all/test_package/conanfile.py +++ b/recipes/mozjpeg/all/test_package/conanfile.py @@ -23,5 +23,4 @@ def build(self): 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, "testimg.jpg") - self.run(f"{bin_path} {img_name}", env="conanrun") + self.run(bin_path, env="conanrun") diff --git a/recipes/mozjpeg/all/test_package/test_package.c b/recipes/mozjpeg/all/test_package/test_package.c index 2f94478d7ef6f..243a65f0efd44 100644 --- a/recipes/mozjpeg/all/test_package/test_package.c +++ b/recipes/mozjpeg/all/test_package/test_package.c @@ -1,528 +1,9 @@ -/* - * rdjpgcom.c - * - * Copyright (C) 1994-1997, Thomas G. Lane. - * Modified 2009 by Bill Allombert, Guido Vollbeding. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains a very simple stand-alone application that displays - * the text in COM (comment) markers in a JFIF file. - * This may be useful as an example of the minimum logic needed to parse - * JPEG markers. - */ - #include -#include -#include - -#define JPEG_CJPEG_DJPEG /* to get the command-line config symbols */ -#include "jpeglib.h" /* get auto-config symbols, */ - -#ifdef HAVE_LOCALE_H -#include /* Bill Allombert: use locale for isprint */ -#endif -#include /* to declare isupper(), tolower() */ -#ifdef USE_SETMODE -#include /* to declare setmode()'s parameter macros */ -/* If you have setmode() but not , just delete this line: */ -#include /* to declare setmode() */ -#endif - -#ifdef USE_CCOMMAND /* command-line reader for Macintosh */ -#ifdef __MWERKS__ -#include /* Metrowerks needs this */ -#include /* ... and this */ -#endif -#ifdef THINK_C -#include /* Think declares it here */ -#endif -#endif - -#ifdef DONT_USE_B_MODE /* define mode parameters for fopen() */ -#define READ_BINARY "r" -#else -#ifdef VMS /* VMS is very nonstandard */ -#define READ_BINARY "rb", "ctx=stm" -#else /* standard ANSI-compliant case */ -#define READ_BINARY "rb" -#endif -#endif - -#ifndef EXIT_FAILURE /* define exit() codes if not provided */ -#define EXIT_FAILURE 1 -#endif -#ifndef EXIT_SUCCESS -#ifdef VMS -#define EXIT_SUCCESS 1 /* VMS is very nonstandard */ -#else -#define EXIT_SUCCESS 0 -#endif -#endif - -/* - * These macros are used to read the input file. - * To reuse this code in another application, you might need to change these. - */ - -static FILE *infile; /* input JPEG file */ - -/* Return next input byte, or EOF if no more */ -#define NEXTBYTE() getc(infile) - -/* Error exit handler */ -#define ERREXIT(msg) (fprintf(stderr, "%s\n", msg), exit(EXIT_FAILURE)) - -/* Read one byte, testing for EOF */ -static int read_1_byte(void) { - int c; - - c = NEXTBYTE(); - if (c == EOF) - ERREXIT("Premature EOF in JPEG file"); - return c; -} - -/* Read 2 bytes, convert to unsigned int */ -/* All 2-byte quantities in JPEG markers are MSB first */ -static unsigned int read_2_bytes(void) { - int c1, c2; - - c1 = NEXTBYTE(); - if (c1 == EOF) - ERREXIT("Premature EOF in JPEG file"); - c2 = NEXTBYTE(); - if (c2 == EOF) - ERREXIT("Premature EOF in JPEG file"); - return (((unsigned int)c1) << 8) + ((unsigned int)c2); -} - -/* - * JPEG markers consist of one or more 0xFF bytes, followed by a marker - * code byte (which is not an FF). Here are the marker codes of interest - * in this program. (See jdmarker.c for a more complete list.) - */ - -#define M_SOF0 0xC0 /* Start Of Frame N */ -#define M_SOF1 0xC1 /* N indicates which compression process */ -#define M_SOF2 0xC2 /* Only SOF0-SOF2 are now in common use */ -#define M_SOF3 0xC3 -#define M_SOF5 0xC5 /* NB: codes C4 and CC are NOT SOF markers */ -#define M_SOF6 0xC6 -#define M_SOF7 0xC7 -#define M_SOF9 0xC9 -#define M_SOF10 0xCA -#define M_SOF11 0xCB -#define M_SOF13 0xCD -#define M_SOF14 0xCE -#define M_SOF15 0xCF -#define M_SOI 0xD8 /* Start Of Image (beginning of datastream) */ -#define M_EOI 0xD9 /* End Of Image (end of datastream) */ -#define M_SOS 0xDA /* Start Of Scan (begins compressed data) */ -#define M_APP0 0xE0 /* Application-specific marker, type N */ -#define M_APP12 0xEC /* (we don't bother to list all 16 APPn's) */ -#define M_COM 0xFE /* COMment */ - -/* - * Find the next JPEG marker and return its marker code. - * We expect at least one FF byte, possibly more if the compressor used FFs - * to pad the file. - * There could also be non-FF garbage between markers. The treatment of such - * garbage is unspecified; we choose to skip over it but emit a warning msg. - * NB: this routine must not be used after seeing SOS marker, since it will - * not deal correctly with FF/00 sequences in the compressed image data... - */ - -static int next_marker(void) { - int c; - int discarded_bytes = 0; - - /* Find 0xFF byte; count and skip any non-FFs. */ - c = read_1_byte(); - while (c != 0xFF) { - discarded_bytes++; - c = read_1_byte(); - } - /* Get marker code byte, swallowing any duplicate FF bytes. Extra FFs - * are legal as pad bytes, so don't count them in discarded_bytes. - */ - do { - c = read_1_byte(); - } while (c == 0xFF); - - if (discarded_bytes != 0) { - fprintf(stderr, "Warning: garbage data found in JPEG file\n"); - } - - return c; -} - -/* - * Read the initial marker, which should be SOI. - * For a JFIF file, the first two bytes of the file should be literally - * 0xFF M_SOI. To be more general, we could use next_marker, but if the - * input file weren't actually JPEG at all, next_marker might read the whole - * file and then return a misleading error message... - */ - -static int first_marker(void) { - int c1, c2; - - c1 = NEXTBYTE(); - c2 = NEXTBYTE(); - if (c1 != 0xFF || c2 != M_SOI) - { - ERREXIT("Not a JPEG file"); - } - return c2; -} - -/* - * Most types of marker are followed by a variable-length parameter segment. - * This routine skips over the parameters for any marker we don't otherwise - * want to process. - * Note that we MUST skip the parameter segment explicitly in order not to - * be fooled by 0xFF bytes that might appear within the parameter segment; - * such bytes do NOT introduce new markers. - */ - -static void skip_variable(void) -/* Skip over an unknown or uninteresting variable-length marker */ -{ - unsigned int length; - - /* Get the marker parameter length count */ - length = read_2_bytes(); - /* Length includes itself, so must be at least 2 */ - if (length < 2) - ERREXIT("Erroneous JPEG marker length"); - length -= 2; - /* Skip over the remaining bytes */ - while (length > 0) { - (void)read_1_byte(); - length--; - } -} - -/* - * Process a COM marker. - * We want to print out the marker contents as legible text; - * we must guard against non-text junk and varying newline representations. - */ - -static void process_COM(int raw) { - unsigned int length; - int ch; - int lastch = 0; - -/* Bill Allombert: set locale properly for isprint */ -#ifdef HAVE_LOCALE_H - setlocale(LC_CTYPE, ""); -#endif - - /* Get the marker parameter length count */ - length = read_2_bytes(); - /* Length includes itself, so must be at least 2 */ - if (length < 2) - ERREXIT("Erroneous JPEG marker length"); - length -= 2; - - while (length > 0) { - ch = read_1_byte(); - if (raw) { - putc(ch, stdout); - /* Emit the character in a readable form. - * Nonprintables are converted to \nnn form, - * while \ is converted to \\. - * Newlines in CR, CR/LF, or LF form will be printed as one newline. - */ - } else if (ch == '\r') { - printf("\n"); - } else if (ch == '\n') { - if (lastch != '\r') - printf("\n"); - } else if (ch == '\\') { - printf("\\\\"); - } else if (isprint(ch)) { - putc(ch, stdout); - } else { - printf("\\%03o", ch); - } - lastch = ch; - length--; - } - printf("\n"); - -/* Bill Allombert: revert to C locale */ -#ifdef HAVE_LOCALE_H - setlocale(LC_CTYPE, "C"); -#endif -} - -/* - * Process a SOFn marker. - * This code is only needed if you want to know the image dimensions... - */ - -static void process_SOFn(int marker) { - unsigned int length; - unsigned int image_height, image_width; - int data_precision, num_components; - const char *process; - int ci; - - length = read_2_bytes(); /* usual parameter length count */ - - data_precision = read_1_byte(); - image_height = read_2_bytes(); - image_width = read_2_bytes(); - num_components = read_1_byte(); - - switch (marker) { - case M_SOF0: - process = "Baseline"; - break; - case M_SOF1: - process = "Extended sequential"; - break; - case M_SOF2: - process = "Progressive"; - break; - case M_SOF3: - process = "Lossless"; - break; - case M_SOF5: - process = "Differential sequential"; - break; - case M_SOF6: - process = "Differential progressive"; - break; - case M_SOF7: - process = "Differential lossless"; - break; - case M_SOF9: - process = "Extended sequential, arithmetic coding"; - break; - case M_SOF10: - process = "Progressive, arithmetic coding"; - break; - case M_SOF11: - process = "Lossless, arithmetic coding"; - break; - case M_SOF13: - process = "Differential sequential, arithmetic coding"; - break; - case M_SOF14: - process = "Differential progressive, arithmetic coding"; - break; - case M_SOF15: - process = "Differential lossless, arithmetic coding"; - break; - default: - process = "Unknown"; - break; - } - - printf("JPEG image is %uw * %uh, %d color components, %d bits per sample\n", - image_width, image_height, num_components, data_precision); - printf("JPEG process: %s\n", process); - - if (length != (unsigned int)(8 + num_components * 3)) - ERREXIT("Bogus SOF marker length"); - - for (ci = 0; ci < num_components; ci++) { - (void)read_1_byte(); /* Component ID code */ - (void)read_1_byte(); /* H, V sampling factors */ - (void)read_1_byte(); /* Quantization table number */ - } -} - -/* - * Parse the marker stream until SOS or EOI is seen; - * display any COM markers. - * While the companion program wrjpgcom will always insert COM markers before - * SOFn, other implementations might not, so we scan to SOS before stopping. - * If we were only interested in the image dimensions, we would stop at SOFn. - * (Conversely, if we only cared about COM markers, there would be no need - * for special code to handle SOFn; we could treat it like other markers.) - */ - -static int scan_JPEG_header(int verbose, int raw) { - int marker; - /* Expect SOI at start of file */ - if (first_marker() != M_SOI) - ERREXIT("Expected SOI marker first"); - - /* Scan miscellaneous markers until we reach SOS. */ - for (;;) { - marker = next_marker(); - switch (marker) { - /* Note that marker codes 0xC4, 0xC8, 0xCC are not, and must not be, - * treated as SOFn. C4 in particular is actually DHT. - */ - case M_SOF0: /* Baseline */ - case M_SOF1: /* Extended sequential, Huffman */ - case M_SOF2: /* Progressive, Huffman */ - case M_SOF3: /* Lossless, Huffman */ - case M_SOF5: /* Differential sequential, Huffman */ - case M_SOF6: /* Differential progressive, Huffman */ - case M_SOF7: /* Differential lossless, Huffman */ - case M_SOF9: /* Extended sequential, arithmetic */ - case M_SOF10: /* Progressive, arithmetic */ - case M_SOF11: /* Lossless, arithmetic */ - case M_SOF13: /* Differential sequential, arithmetic */ - case M_SOF14: /* Differential progressive, arithmetic */ - case M_SOF15: /* Differential lossless, arithmetic */ - if (verbose) - process_SOFn(marker); - else - skip_variable(); - break; - - case M_SOS: /* stop before hitting compressed data */ - return marker; - - case M_EOI: /* in case it's a tables-only JPEG stream */ - return marker; - - case M_COM: - process_COM(raw); - break; - - case M_APP12: - /* Some digital camera makers put useful textual information into - * APP12 markers, so we print those out too when in -verbose mode. - */ - if (verbose) { - printf("APP12 contains:\n"); - process_COM(raw); - } else - skip_variable(); - break; - - default: /* Anything else just gets skipped */ - skip_variable(); /* we assume it has a parameter count... */ - break; - } - } /* end loop */ -} - -/* Command line parsing code */ - -static const char *progname; /* program name for error messages */ - -static void usage(void) -/* complain about bad command line */ -{ - fprintf(stderr, "rdjpgcom displays any textual comments in a JPEG file.\n"); - - fprintf(stderr, "Usage: %s [switches] [inputfile]\n", progname); - - fprintf(stderr, "Switches (names may be abbreviated):\n"); - fprintf( - stderr, - " -raw Display non-printable characters in comments (unsafe)\n"); - fprintf(stderr, " -verbose Also display dimensions of JPEG image\n"); - - exit(EXIT_FAILURE); -} - -static int keymatch(char *arg, const char *keyword, int minchars) -/* Case-insensitive matching of (possibly abbreviated) keyword switches. */ -/* keyword is the constant keyword (must be lower case already), */ -/* minchars is length of minimum legal abbreviation. */ -{ - register int ca, ck; - register int nmatched = 0; - - while ((ca = *arg++) != '\0') { - if ((ck = *keyword++) == '\0') - return 0; /* arg longer than keyword, no good */ - if (isupper(ca)) /* force arg to lcase (assume ck is already) */ - ca = tolower(ca); - if (ca != ck) - return 0; /* no good */ - nmatched++; /* count matched characters */ - } - /* reached end of argument; fail if it's too short for unique abbrev */ - if (nmatched < minchars) - return 0; - return 1; /* A-OK */ -} - -/* - * The main program. - */ - -int main(int argc, char **argv) { - int argn; - char *arg; - int verbose = 1, raw = 0; - -/* On Mac, fetch a command line. */ -#ifdef USE_CCOMMAND - argc = ccommand(&argv); -#endif - - progname = argv[0]; - if (progname == NULL || progname[0] == 0) - progname = "rdjpgcom"; /* in case C library doesn't provide it */ - - /* Parse switches, if any */ - for (argn = 1; argn < argc; argn++) - { - arg = argv[argn]; - if (arg[0] != '-') - break; /* not switch, must be file name */ - arg++; /* advance over '-' */ - if (keymatch(arg, "verbose", 1)) - { - verbose++; - } - else if (keymatch(arg, "raw", 1)) - { - raw = 1; - } - else - usage(); - } - - /* Open the input file. */ - /* Unix style: expect zero or one file name */ - if (argn < argc - 1) - { - fprintf(stderr, "%s: only one input file\n", progname); - usage(); - } - if (argn < argc) - { - if ((infile = fopen(argv[argn], READ_BINARY)) == NULL) - { - fprintf(stderr, "%s: can't open %s\n", progname, argv[argn]); - exit(EXIT_FAILURE); - } - } - else if ((infile = fopen("testimg.jpg", READ_BINARY)) == NULL) - { -/* default input file is stdin */ -#ifdef USE_SETMODE /* need to hack file mode? */ - setmode(fileno(stdin), O_BINARY); -#endif -#ifdef USE_FDOPEN /* need to re-open in binary mode? */ - if ((infile = fdopen(fileno(stdin), READ_BINARY)) == NULL) - { - fprintf(stderr, "%s: can't open stdin\n", progname); - exit(EXIT_FAILURE); - } -#else - infile = stdin; -#endif - } - - /* Scan the JPEG headers. */ - (void)scan_JPEG_header(verbose, raw); +#include "jpeglib.h" - /* All done. */ - exit(EXIT_SUCCESS); - return 0; /* suppress no-return-value warnings */ +int main() { + struct jpeg_decompress_struct info; + struct jpeg_error_mgr err; + info.err = jpeg_std_error(&err); + jpeg_create_decompress(&info); } diff --git a/recipes/mozjpeg/all/test_package/testimg.jpg b/recipes/mozjpeg/all/test_package/testimg.jpg deleted file mode 100644 index a026e486f57de..0000000000000 Binary files a/recipes/mozjpeg/all/test_package/testimg.jpg and /dev/null differ diff --git a/recipes/mozjpeg/all/test_package_module/conanfile.py b/recipes/mozjpeg/all/test_package_module/conanfile.py index fd19bb1425057..0a6bc68712d90 100644 --- a/recipes/mozjpeg/all/test_package_module/conanfile.py +++ b/recipes/mozjpeg/all/test_package_module/conanfile.py @@ -23,5 +23,4 @@ def build(self): 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") + self.run(bin_path, env="conanrun") diff --git a/recipes/mozjpeg/all/test_v1_package/conanfile.py b/recipes/mozjpeg/all/test_v1_package/conanfile.py index cf6e3a0371de5..5a05af3c2dfd2 100644 --- a/recipes/mozjpeg/all/test_v1_package/conanfile.py +++ b/recipes/mozjpeg/all/test_v1_package/conanfile.py @@ -15,5 +15,4 @@ def build(self): 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) + self.run(bin_path, run_environment=True) diff --git a/recipes/mozjpeg/all/test_v1_package_module/conanfile.py b/recipes/mozjpeg/all/test_v1_package_module/conanfile.py index b6600e428515c..19e6a0c06e3d8 100644 --- a/recipes/mozjpeg/all/test_v1_package_module/conanfile.py +++ b/recipes/mozjpeg/all/test_v1_package_module/conanfile.py @@ -14,5 +14,4 @@ def build(self): 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) + self.run(bin_path, run_environment=True) diff --git a/recipes/mozjpeg/config.yml b/recipes/mozjpeg/config.yml index c5a4dbb215dd3..ae34a5e9040b3 100644 --- a/recipes/mozjpeg/config.yml +++ b/recipes/mozjpeg/config.yml @@ -1,4 +1,8 @@ versions: + "4.1.5": + folder: all + "4.1.3": + folder: all "4.1.1": folder: all "4.0.0": diff --git a/recipes/mp-units/0.6.0/conandata.yml b/recipes/mp-units/0.6.0/conandata.yml deleted file mode 100644 index b8636a96910a4..0000000000000 --- a/recipes/mp-units/0.6.0/conandata.yml +++ /dev/null @@ -1,4 +0,0 @@ -sources: - "0.6.0": - url: https://github.com/mpusz/units/archive/v0.6.0.tar.gz - sha256: 7102d2c4460c87525d385b5f1488ac0ef9755b7f7984076bcc64d1506e1bdfd8 diff --git a/recipes/mp-units/0.6.0/conanfile.py b/recipes/mp-units/0.6.0/conanfile.py deleted file mode 100644 index d3b064aae5a00..0000000000000 --- a/recipes/mp-units/0.6.0/conanfile.py +++ /dev/null @@ -1,69 +0,0 @@ -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration -from conans.tools import Version, check_min_cppstd -import os - - -class MPUnitsConan(ConanFile): - name = "mp-units" - homepage = "https://github.com/mpusz/units" - description = "Physical Units library for C++" - topics = ("units", "dimensions", "quantities", "dimensional-analysis", "physical-quantities", "physical-units", "system-of-units", "cpp23", "cpp20", "library", "quantity-manipulation") - license = "MIT" - url = "https://github.com/conan-io/conan-center-index" - settings = "os", "arch", "compiler", "build_type" - requires = ( - "fmt/7.0.3", - "ms-gsl/3.1.0" - ) - generators = "cmake" - no_copy_source = True - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - - def _validate_compiler_settings(self): - compiler = self.settings.compiler - version = Version(self.settings.compiler.version) - if compiler == "gcc": - if version < "10.0": - raise ConanInvalidConfiguration("mp-units requires at least g++-10") - elif compiler == "Visual Studio": - if version < "16": - raise ConanInvalidConfiguration("mp-units requires at least MSVC 16.7") - else: - raise ConanInvalidConfiguration("mp-units is supported only by gcc and Visual Studio so far") - if compiler.get_safe("cppstd"): - check_min_cppstd(self, "20") - - def configure(self): - self._validate_compiler_settings() - - def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = "units-" + self.version - os.rename(extracted_dir, self._source_subfolder) - - def package(self): - self.copy(pattern="*", dst="include", src=os.path.join(self._source_subfolder, "src", "include")) - self.copy("LICENSE.md", dst="licenses", src=self._source_subfolder) - - def package_id(self): - self.info.header_only() - - def package_info(self): - compiler = self.settings.compiler - version = Version(self.settings.compiler.version) - if compiler == "gcc": - self.cpp_info.cxxflags = [ - "-Wno-non-template-friend" - ] - elif compiler == "Visual Studio": - self.cpp_info.cxxflags = [ - "/utf-8" - ] diff --git a/recipes/mp-units/0.6.0/test_package/CMakeLists.txt b/recipes/mp-units/0.6.0/test_package/CMakeLists.txt deleted file mode 100644 index 9276c30bd7348..0000000000000 --- a/recipes/mp-units/0.6.0/test_package/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 3.5) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE CONAN_PKG::mp-units) -target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_20) diff --git a/recipes/mp-units/0.6.0/test_package/conanfile.py b/recipes/mp-units/0.6.0/test_package/conanfile.py deleted file mode 100644 index 0109b151054b5..0000000000000 --- a/recipes/mp-units/0.6.0/test_package/conanfile.py +++ /dev/null @@ -1,25 +0,0 @@ -from conans import ConanFile, CMake, tools -from conans.tools import Version -import os - - -class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" - - # TODO remove when https://github.com/conan-io/conan/issues/7680 is solved (or VS2019 is updated to at least 16.7) - def _skip_check(self): - return self.settings.compiler == "Visual Studio" and Version(self.settings.compiler.version) <= "16" - - def build(self): - if self._skip_check(): - return - cmake = CMake(self) - cmake.configure() - cmake.build() - - def test(self): - if self._skip_check(): - return - if not tools.cross_building(self.settings): - self.run(os.path.join("bin", "test_package"), run_environment=True) diff --git a/recipes/mp-units/0.6.0/test_package/test_package.cpp b/recipes/mp-units/0.6.0/test_package/test_package.cpp deleted file mode 100644 index 08d749317da70..0000000000000 --- a/recipes/mp-units/0.6.0/test_package/test_package.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include -#include - -int main() -{ - using namespace units::physical::si::literals; - std::cout << "Speed = " << 240._q_km / 2_q_h << '\n'; -} diff --git a/recipes/mp-units/0.7.0/conandata.yml b/recipes/mp-units/0.7.0/conandata.yml deleted file mode 100644 index 9986b435619c5..0000000000000 --- a/recipes/mp-units/0.7.0/conandata.yml +++ /dev/null @@ -1,4 +0,0 @@ -sources: - "0.7.0": - url: https://github.com/mpusz/units/archive/v0.7.0.tar.gz - sha256: 7ff4bc3537e1bd09630fefae513796686a3f97e509283ad658e1ae81fe49de67 diff --git a/recipes/mp-units/0.7.0/conanfile.py b/recipes/mp-units/0.7.0/conanfile.py deleted file mode 100644 index 71d2cc465a52e..0000000000000 --- a/recipes/mp-units/0.7.0/conanfile.py +++ /dev/null @@ -1,84 +0,0 @@ -from conans import ConanFile, CMake, tools -from conans.tools import Version, check_min_cppstd -from conans.errors import ConanInvalidConfiguration -import os - -required_conan_version = ">=1.33.0" - -class MPUnitsConan(ConanFile): - name = "mp-units" - homepage = "https://github.com/mpusz/units" - description = "Physical Units library for C++" - topics = ("units", "dimensions", "quantities", "dimensional-analysis", "physical-quantities", "physical-units", "system-of-units", "cpp23", "cpp20", "library", "quantity-manipulation") - license = "MIT" - url = "https://github.com/conan-io/conan-center-index" - settings = "os", "arch", "compiler", "build_type" - generators = "cmake_find_package_multi" - no_copy_source = True - - @property - def _source_subfolder(self): - return "source_subfolder" - - def requirements(self): - compiler = self.settings.compiler - self.requires("fmt/7.1.3") - self.requires("gsl-lite/0.38.0") - if compiler == "clang" and compiler.libcxx == "libc++": - self.requires("range-v3/0.11.0") - - def validate(self): - compiler = self.settings.compiler - version = Version(self.settings.compiler.version) - if compiler == "gcc": - if version < "10.0": - raise ConanInvalidConfiguration("mp-units requires at least g++-10") - elif compiler == "clang": - if version < "12": - raise ConanInvalidConfiguration("mp-units requires at least clang++-12") - elif compiler == "Visual Studio": - if version < "16": - raise ConanInvalidConfiguration("mp-units requires at least Visual Studio 16.9") - else: - raise ConanInvalidConfiguration("Unsupported compiler") - if compiler.get_safe("cppstd"): - check_min_cppstd(self, "20") - - def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) - - def package(self): - self.copy("LICENSE.md", dst="licenses", src=self._source_subfolder) - cmake = CMake(self) - cmake.configure(source_folder=os.path.join(self._source_subfolder, "src")) - cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - - def package_id(self): - self.info.header_only() - - def package_info(self): - compiler = self.settings.compiler - - # core - self.cpp_info.components["core"].requires = ["gsl-lite::gsl-lite"] - if compiler == "Visual Studio": - self.cpp_info.components["core"].cxxflags = ["/utf-8"] - elif compiler == "clang" and compiler.libcxx == "libc++": - self.cpp_info.components["core"].requires.append("range-v3::range-v3") - - # rest - self.cpp_info.components["core-io"].requires = ["core"] - self.cpp_info.components["core-fmt"].requires = ["core", "fmt::fmt"] - self.cpp_info.components["isq"].requires = ["core"] - self.cpp_info.components["isq-natural"].requires = ["isq"] - self.cpp_info.components["si"].requires = ["isq"] - self.cpp_info.components["si-cgs"].requires = ["si"] - self.cpp_info.components["si-fps"].requires = ["si"] - self.cpp_info.components["si-iau"].requires = ["si"] - self.cpp_info.components["si-imperial"].requires = ["si"] - self.cpp_info.components["si-international"].requires = ["si"] - self.cpp_info.components["si-typographic"].requires = ["si"] - self.cpp_info.components["si-uscs"].requires = ["si"] - self.cpp_info.components["isq-iec80000"].requires = ["si"] - self.cpp_info.components["systems"].requires = ["isq", "isq-natural", "si", "si-cgs", "si-fps", "si-iau", "si-imperial", "si-international", "si-typographic", "si-uscs", "isq-iec80000"] diff --git a/recipes/mp-units/0.8.0/conandata.yml b/recipes/mp-units/0.8.0/conandata.yml new file mode 100644 index 0000000000000..7b20912030889 --- /dev/null +++ b/recipes/mp-units/0.8.0/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.8.0": + url: https://github.com/mpusz/units/archive/v0.8.0.tar.gz + sha256: 4081c75e5f2763bb95a6514d952f187519591e594b8fb93ddc9943741827e8c9 diff --git a/recipes/mp-units/0.8.0/conanfile.py b/recipes/mp-units/0.8.0/conanfile.py new file mode 100644 index 0000000000000..147e52908bb8c --- /dev/null +++ b/recipes/mp-units/0.8.0/conanfile.py @@ -0,0 +1,155 @@ +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, cmake_layout +from conan.tools.files import copy, get, rmdir +from conan.tools.scm import Version + +required_conan_version = ">=1.59.0" + + +class MPUnitsConan(ConanFile): + name = "mp-units" + homepage = "https://github.com/mpusz/mp-units" + description = "A Physical Quantities and Units library for C++" + topics = ( + "units", + "dimensions", + "quantities", + "dimensional-analysis", + "physical-quantities", + "physical-units", + "system-of-units", + "system-of-quantities", + "isq", + "si", + "library", + "quantity-manipulation", + ) + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + settings = "os", "arch", "compiler", "build_type" + tool_requires = "cmake/[>=3.19 <4]" + package_type = "header-library" + no_copy_source = True + + @property + def _min_cppstd(self): + return "20" + + @property + def _minimum_compilers_version(self): + return {"gcc": "10.3", "clang": "12", "apple-clang": "13", "msvc": "192"} + + @property + def _use_libfmt(self): + compiler = self.settings.compiler + version = Version(self.settings.compiler.version) + std_support = compiler == "msvc" and version >= 193 and compiler.cppstd == 23 + return not std_support + + @property + def _use_range_v3(self): + compiler = self.settings.compiler + version = Version(self.settings.compiler.version) + return "clang" in compiler and compiler.libcxx == "libc++" and version < 14 + + def requirements(self): + self.requires("gsl-lite/0.40.0") + if self._use_libfmt: + self.requires("fmt/10.2.1") + if self._use_range_v3: + self.requires("range-v3/0.12.0") + + def validate(self): + 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(".")] + 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 + 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 at least {compiler} {min_version} ({compiler.version} in use)" + ) + + 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["UNITS_USE_LIBFMT"] = self._use_libfmt + tc.generate() + deps = CMakeDeps(self) + deps.generate() + + def build(self): + cmake = CMake(self) + cmake.configure(build_script_folder="src") + cmake.build() + + def package_id(self): + self.info.clear() + + def package(self): + copy( + self, + "LICENSE.md", + self.source_folder, + 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): + compiler = self.settings.compiler + + # core + self.cpp_info.components["core"].requires = ["gsl-lite::gsl-lite"] + if compiler == "msvc": + self.cpp_info.components["core"].cxxflags = ["/utf-8"] + if self._use_range_v3: + self.cpp_info.components["core"].requires.append("range-v3::range-v3") + + # rest + self.cpp_info.components["core-io"].requires = ["core"] + self.cpp_info.components["core-fmt"].requires = ["core"] + if self._use_libfmt: + self.cpp_info.components["core-fmt"].requires.append("fmt::fmt") + self.cpp_info.components["isq"].requires = ["core"] + self.cpp_info.components["isq-natural"].requires = ["isq"] + self.cpp_info.components["si"].requires = ["isq"] + self.cpp_info.components["si-cgs"].requires = ["si"] + self.cpp_info.components["si-fps"].requires = ["si-international"] + self.cpp_info.components["si-hep"].requires = ["si"] + self.cpp_info.components["si-iau"].requires = ["si"] + self.cpp_info.components["si-imperial"].requires = ["si"] + self.cpp_info.components["si-international"].requires = ["si"] + self.cpp_info.components["si-typographic"].requires = ["si"] + self.cpp_info.components["si-uscs"].requires = ["si"] + self.cpp_info.components["isq-iec80000"].requires = ["si"] + self.cpp_info.components["systems"].requires = [ + "isq", + "isq-natural", + "si", + "si-cgs", + "si-fps", + "si-hep", + "si-iau", + "si-imperial", + "si-international", + "si-typographic", + "si-uscs", + "isq-iec80000", + ] diff --git a/recipes/mp-units/0.7.0/test_package/CMakeLists.txt b/recipes/mp-units/0.8.0/test_package/CMakeLists.txt similarity index 100% rename from recipes/mp-units/0.7.0/test_package/CMakeLists.txt rename to recipes/mp-units/0.8.0/test_package/CMakeLists.txt diff --git a/recipes/mp-units/0.8.0/test_package/conanfile.py b/recipes/mp-units/0.8.0/test_package/conanfile.py new file mode 100644 index 0000000000000..e418ee7701960 --- /dev/null +++ b/recipes/mp-units/0.8.0/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 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/mp-units/0.7.0/test_package/test_package.cpp b/recipes/mp-units/0.8.0/test_package/test_package.cpp similarity index 100% rename from recipes/mp-units/0.7.0/test_package/test_package.cpp rename to recipes/mp-units/0.8.0/test_package/test_package.cpp diff --git a/recipes/mp-units/0.8.0/test_v1_package/CMakeLists.txt b/recipes/mp-units/0.8.0/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..07f3e7cd91e8a --- /dev/null +++ b/recipes/mp-units/0.8.0/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package + LANGUAGES CXX +) + +find_package(mp-units CONFIG REQUIRED) + +add_executable(test_package test_package.cpp) +target_link_libraries(test_package PRIVATE mp-units::mp-units) +target_compile_features(test_package PUBLIC cxx_std_20) diff --git a/recipes/mp-units/0.7.0/test_package/conanfile.py b/recipes/mp-units/0.8.0/test_v1_package/conanfile.py similarity index 100% rename from recipes/mp-units/0.7.0/test_package/conanfile.py rename to recipes/mp-units/0.8.0/test_v1_package/conanfile.py diff --git a/recipes/mp-units/0.8.0/test_v1_package/test_package.cpp b/recipes/mp-units/0.8.0/test_v1_package/test_package.cpp new file mode 100644 index 0000000000000..cd9ed5c7a0227 --- /dev/null +++ b/recipes/mp-units/0.8.0/test_v1_package/test_package.cpp @@ -0,0 +1,19 @@ +#include +#include +#include +#include +#include + +using namespace units; + +template +constexpr auto avg_speed(Length d, Time t) +{ + return d / t; +} + +int main() +{ + using namespace units::isq::si::references; + std::cout << "Average speed = " << avg_speed(240 * km, 2 * h) << '\n'; +} diff --git a/recipes/mp-units/2.0.0/conandata.yml b/recipes/mp-units/2.0.0/conandata.yml new file mode 100644 index 0000000000000..a3b955f5397c3 --- /dev/null +++ b/recipes/mp-units/2.0.0/conandata.yml @@ -0,0 +1,10 @@ +sources: + "2.1.1": + url: https://github.com/mpusz/units/archive/v2.1.1.tar.gz + sha256: 881070fd9a15a8954a4e38d991e398dc9638907bbc13961a530519596c9783f9 + "2.1.0": + url: https://github.com/mpusz/units/archive/v2.1.0.tar.gz + sha256: a42057492f5a8e80442cf13602b97bb48b9c3a408bc91bdb60d86aadc84c95cc + "2.0.0": + url: https://github.com/mpusz/units/archive/v2.0.0.tar.gz + sha256: c04cda9fdaeca3ae42886552658e8bde3b608a24a4a921a621a5db41ec416e0e diff --git a/recipes/mp-units/2.0.0/conanfile.py b/recipes/mp-units/2.0.0/conanfile.py new file mode 100644 index 0000000000000..655d918b9aed6 --- /dev/null +++ b/recipes/mp-units/2.0.0/conanfile.py @@ -0,0 +1,156 @@ +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, 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.59.0" + + +class MPUnitsConan(ConanFile): + name = "mp-units" + homepage = "https://github.com/mpusz/mp-units" + description = "A Quantities and Units library for C++" + topics = ( + "units", + "dimensions", + "quantities", + "dimensional-analysis", + "physical-quantities", + "physical-units", + "system-of-units", + "system-of-quantities", + "isq", + "si", + "library", + "quantity-manipulation", + ) + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + settings = "os", "arch", "compiler", "build_type" + tool_requires = "cmake/[>=3.19 <4]" + package_type = "header-library" + no_copy_source = True + + @property + def _min_cppstd(self): + return "20" + + @property + def _minimum_compilers_version(self): + # Note that msvc is disabled for now, its C++20 implementation are not up to speed + return {"gcc": "12", "clang": "16", "apple-clang": "15"} + + @property + def _use_libfmt(self): + compiler = self.settings.compiler + version = Version(self.settings.compiler.version) + std_support = compiler == "msvc" and version >= 193 and compiler.cppstd == 23 + return not std_support + + def requirements(self): + self.requires("gsl-lite/0.40.0") + if self._use_libfmt: + self.requires("fmt/10.2.1") + + def validate(self): + 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(".")] + 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 + 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 at least {compiler} {min_version} ({compiler.version} in use)" + ) + + # Re-enable once newer versions with better support come out + if is_msvc(self): + raise ConanInvalidConfiguration( + f"{self.ref} disabled for {compiler} as their C++20 implementation is not up to speed yet" + ) + + 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["MP_UNITS_USE_LIBFMT"] = self._use_libfmt + tc.generate() + deps = CMakeDeps(self) + deps.generate() + + def build(self): + cmake = CMake(self) + cmake.configure(build_script_folder="src") + cmake.build() + + def package_id(self): + self.info.clear() + + def package(self): + copy( + self, + "LICENSE.md", + self.source_folder, + 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): + compiler = self.settings.compiler + + # core + self.cpp_info.components["core"].requires = ["gsl-lite::gsl-lite"] + if compiler == "msvc": + self.cpp_info.components["core"].cxxflags = ["/utf-8"] + + # rest + self.cpp_info.components["core-io"].requires = ["core"] + self.cpp_info.components["core-fmt"].requires = ["core"] + if self._use_libfmt: + self.cpp_info.components["core-fmt"].requires.append("fmt::fmt") + self.cpp_info.components["utility"].requires = ["core", "isq", "si", "angular"] + self.cpp_info.components["isq"].requires = ["core"] + self.cpp_info.components["angular"].requires = ["isq"] + self.cpp_info.components["isq_angular"].requires = ["isq", "angular"] + self.cpp_info.components["natural"].requires = ["isq"] + self.cpp_info.components["si"].requires = ["isq"] + self.cpp_info.components["cgs"].requires = ["si"] + self.cpp_info.components["hep"].requires = ["si"] + self.cpp_info.components["iau"].requires = ["si"] + self.cpp_info.components["imperial"].requires = ["si"] + self.cpp_info.components["international"].requires = ["si"] + self.cpp_info.components["typographic"].requires = ["usc"] + self.cpp_info.components["usc"].requires = ["international"] + self.cpp_info.components["iec80000"].requires = ["isq", "si"] + self.cpp_info.components["systems"].requires = [ + "isq", + "angular", + "isq_angular", + "natural", + "si", + "cgs", + "hep", + "iau", + "imperial", + "international", + "typographic", + "usc", + "iec80000", + ] diff --git a/recipes/mp-units/2.0.0/test_package/CMakeLists.txt b/recipes/mp-units/2.0.0/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..07f3e7cd91e8a --- /dev/null +++ b/recipes/mp-units/2.0.0/test_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package + LANGUAGES CXX +) + +find_package(mp-units CONFIG REQUIRED) + +add_executable(test_package test_package.cpp) +target_link_libraries(test_package PRIVATE mp-units::mp-units) +target_compile_features(test_package PUBLIC cxx_std_20) diff --git a/recipes/mp-units/2.0.0/test_package/conanfile.py b/recipes/mp-units/2.0.0/test_package/conanfile.py new file mode 100644 index 0000000000000..e418ee7701960 --- /dev/null +++ b/recipes/mp-units/2.0.0/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 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/mp-units/2.0.0/test_package/test_package.cpp b/recipes/mp-units/2.0.0/test_package/test_package.cpp new file mode 100644 index 0000000000000..f7a82eba1d2de --- /dev/null +++ b/recipes/mp-units/2.0.0/test_package/test_package.cpp @@ -0,0 +1,16 @@ +#include +#include +#include + +using namespace mp_units; + +constexpr auto avg_speed(QuantityOf auto d, QuantityOf auto t) +{ + return d / t; +} + +int main() +{ + using namespace mp_units::si::unit_symbols; + std::cout << "Average speed = " << avg_speed(240 * km, 2 * h) << '\n'; +} diff --git a/recipes/mp-units/2.0.0/test_v1_package/CMakeLists.txt b/recipes/mp-units/2.0.0/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..07f3e7cd91e8a --- /dev/null +++ b/recipes/mp-units/2.0.0/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package + LANGUAGES CXX +) + +find_package(mp-units CONFIG REQUIRED) + +add_executable(test_package test_package.cpp) +target_link_libraries(test_package PRIVATE mp-units::mp-units) +target_compile_features(test_package PUBLIC cxx_std_20) diff --git a/recipes/mp-units/2.0.0/test_v1_package/conanfile.py b/recipes/mp-units/2.0.0/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..048e0f9557d47 --- /dev/null +++ b/recipes/mp-units/2.0.0/test_v1_package/conanfile.py @@ -0,0 +1,25 @@ +from conans import ConanFile, CMake, tools +from conans.tools import Version +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake_find_package_multi" + + # TODO remove when https://github.com/conan-io/conan/issues/7680 is solved (or VS2019 is updated to at least 16.9) + def _skip_check(self): + return self.settings.compiler == "Visual Studio" and Version(self.settings.compiler.version) <= "16" + + def build(self): + if self._skip_check(): + return + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if self._skip_check(): + return + if not tools.cross_building(self.settings): + self.run("test_package", run_environment=True) diff --git a/recipes/mp-units/2.0.0/test_v1_package/test_package.cpp b/recipes/mp-units/2.0.0/test_v1_package/test_package.cpp new file mode 100644 index 0000000000000..f7a82eba1d2de --- /dev/null +++ b/recipes/mp-units/2.0.0/test_v1_package/test_package.cpp @@ -0,0 +1,16 @@ +#include +#include +#include + +using namespace mp_units; + +constexpr auto avg_speed(QuantityOf auto d, QuantityOf auto t) +{ + return d / t; +} + +int main() +{ + using namespace mp_units::si::unit_symbols; + std::cout << "Average speed = " << avg_speed(240 * km, 2 * h) << '\n'; +} diff --git a/recipes/mp-units/2.2.0/conandata.yml b/recipes/mp-units/2.2.0/conandata.yml new file mode 100644 index 0000000000000..2aee126e2e782 --- /dev/null +++ b/recipes/mp-units/2.2.0/conandata.yml @@ -0,0 +1,4 @@ +sources: + "2.2.1": + url: https://github.com/mpusz/units/archive/v2.2.1.tar.gz + sha256: ce5edb27fad9c54b388040341a03d7f2462d61dcedad85b4c983c0e648a91bac diff --git a/recipes/mp-units/2.2.0/conanfile.py b/recipes/mp-units/2.2.0/conanfile.py new file mode 100644 index 0000000000000..89060efea4041 --- /dev/null +++ b/recipes/mp-units/2.2.0/conanfile.py @@ -0,0 +1,274 @@ +import os + +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import default_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 + +required_conan_version = ">=1.59.0" + + +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] + + +class MPUnitsConan(ConanFile): + name = "mp-units" + homepage = "https://github.com/mpusz/mp-units" + description = "The quantities and units library for C++" + topics = ( + "units", + "dimensions", + "quantities", + "dimensional-analysis", + "physical-quantities", + "physical-units", + "system-of-units", + "system-of-quantities", + "isq", + "si", + "library", + "quantity-manipulation", + ) + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + settings = "os", "arch", "compiler", "build_type" + options = { + "cxx_modules": [True, False], + "std_format": [True, False], + "string_view_ret": [True, False], + "no_crtp": [True, False], + "contracts": ["none", "gsl-lite", "ms-gsl"], + "freestanding": [True, False], + } + default_options = { + # "cxx_modules" default set in config_options() + # "std_format" default set in config_options() + # "string_view_ret" default set in config_options() + # "no_crtp" default set in config_options() + "contracts": "gsl-lite", + "freestanding": False, + } + package_type = "header-library" + no_copy_source = True + + @property + def _feature_compatibility(self): + return { + "minimum_support": { + "min_cppstd": "20", + "compiler": { + "gcc": "12", + "clang": "16", + "apple-clang": "15", + "msvc": "", + "Visual Studio": "", + }, + }, + "std_format": { + "min_cppstd": "20", + "compiler": { + "gcc": "13", + "clang": "17", + "apple-clang": "", + "msvc": "", + "Visual Studio": "", + }, + }, + "cxx_modules": { + "min_cppstd": "20", + "compiler": { + "gcc": "", + "clang": "17", + "apple-clang": "", + "msvc": "", + "Visual Studio": "", + }, + }, + "static_constexpr_vars_in_constexpr_func": { + "min_cppstd": "23", + "compiler": { + "gcc": "13", + "clang": "17", + "apple-clang": "", + "msvc": "", + "Visual Studio": "", + }, + }, + "explicit_this": { + "min_cppstd": "23", + "compiler": { + "gcc": "14", + "clang": "18", + "apple-clang": "", + "msvc": "", + "Visual Studio": "", + }, + }, + } + + @property + def _option_feature_map(self): + return { + "std_format": "std_format", + "cxx_modules": "cxx_modules", + "string_view_ret": "static_constexpr_vars_in_constexpr_func", + "no_crtp": "explicit_this", + } + + def _set_default_option(self, name): + compiler = self.settings.compiler + feature_name = self._option_feature_map[name] + feature = self._feature_compatibility[feature_name] + min_version = feature["compiler"].get(str(compiler)) + setattr( + self.options, + name, + bool( + min_version + and Version(compiler.version) >= min_version + and valid_min_cppstd(self, feature["min_cppstd"]) + ), + ) + + def _check_feature_supported(self, name, feature_name=name): + compiler = self.settings.compiler + cppstd = compiler.get_safe("cppstd") + feature = self._feature_compatibility[feature_name] + + # check C++ version + if cppstd and not valid_min_cppstd(self, feature["min_cppstd"]): + raise ConanInvalidConfiguration( + f"'{name}' requires at least cppstd={feature['min_cppstd']} ({cppstd} in use)", + ) + + # check compiler version + min_version = feature["compiler"].get(str(compiler)) + if min_version == None: + # not tested compiler being used - use at your own risk + return + if min_version == "": + raise ConanInvalidConfiguration( + f"'{name}' is not yet supported by any known {compiler} version" + ) + if loose_lt_semver(str(compiler.version), min_version): + raise ConanInvalidConfiguration( + f"'{name}' requires at least {compiler}-{min_version} ({compiler}-{compiler.version} in use)" + ) + + def config_options(self): + for key in self._option_feature_map.keys(): + self._set_default_option(key) + + def configure(self): + if self.options.freestanding: + self.options.rm_safe("std_format") + + def requirements(self): + if not self.options.freestanding: + if self.options.contracts == "gsl-lite": + self.requires("gsl-lite/0.41.0") + elif self.options.contracts == "ms-gsl": + self.requires("ms-gsl/4.0.0") + if not self.options.std_format: + self.requires("fmt/10.2.1") + + def build_requirements(self): + self.tool_requires("cmake/[>=3.29 <4]") + + def validate(self): + self._check_feature_supported("mp-units", "minimum_support") + for key, value in self._option_feature_map.items(): + if self.options.get_safe(key) == True: + self._check_feature_supported(key, value) + if self.options.freestanding and self.options.contracts != "none": + raise ConanInvalidConfiguration( + "'contracts' should be set to 'none' for a freestanding build" + ) + + 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.options.cxx_modules: + tc.cache_variables["CMAKE_CXX_SCAN_FOR_MODULES"] = True + tc.cache_variables["MP_UNITS_BUILD_CXX_MODULES"] = self.options.cxx_modules + if self.options.freestanding: + tc.cache_variables["MP_UNITS_API_FREESTANDING"] = True + else: + tc.cache_variables["MP_UNITS_API_STD_FORMAT"] = self.options.std_format + tc.cache_variables["MP_UNITS_API_STRING_VIEW_RET"] = ( + self.options.string_view_ret + ) + tc.cache_variables["MP_UNITS_API_NO_CRTP"] = self.options.no_crtp + tc.cache_variables["MP_UNITS_API_CONTRACTS"] = str( + self.options.contracts + ).upper() + tc.generate() + deps = CMakeDeps(self) + deps.generate() + + def build(self): + cmake = CMake(self) + cmake.configure(build_script_folder="src") + if self.options.cxx_modules: + cmake.build() + + def package_id(self): + self.info.clear() + + def package(self): + copy( + self, + "LICENSE.md", + self.source_folder, + 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): + compiler = self.settings.compiler + + # handle contracts + if self.options.contracts == "none": + self.cpp_info.components["core"].defines.append("MP_UNITS_API_CONTRACTS=0") + elif self.options.contracts == "gsl-lite": + self.cpp_info.components["core"].requires.append("gsl-lite::gsl-lite") + self.cpp_info.components["core"].defines.append("MP_UNITS_API_CONTRACTS=2") + elif self.options.contracts == "ms-gsl": + self.cpp_info.components["core"].requires.append("ms-gsl::ms-gsl") + self.cpp_info.components["core"].defines.append("MP_UNITS_API_CONTRACTS=3") + + # handle API options + self.cpp_info.components["core"].defines.append( + "MP_UNITS_API_STRING_VIEW_RET=" + + str(int(self.options.string_view_ret == True)) + ) + self.cpp_info.components["core"].defines.append( + "MP_UNITS_API_NO_CRTP=" + str(int(self.options.no_crtp == True)) + ) + self.cpp_info.components["core"].defines.append( + "MP_UNITS_API_STD_FORMAT=" + str(int(self.options.std_format == True)) + ) + if not self.options.std_format: + self.cpp_info.components["core"].requires.append("fmt::fmt") + + # handle hosted configuration + if not self.options.freestanding: + self.cpp_info.components["core"].defines.append("MP_UNITS_HOSTED=1") + + if compiler == "msvc": + self.cpp_info.components["core"].cxxflags = ["/utf-8"] + + self.cpp_info.components["systems"].requires = ["core"] diff --git a/recipes/mp-units/2.2.0/test_package/CMakeLists.txt b/recipes/mp-units/2.2.0/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..07f3e7cd91e8a --- /dev/null +++ b/recipes/mp-units/2.2.0/test_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package + LANGUAGES CXX +) + +find_package(mp-units CONFIG REQUIRED) + +add_executable(test_package test_package.cpp) +target_link_libraries(test_package PRIVATE mp-units::mp-units) +target_compile_features(test_package PUBLIC cxx_std_20) diff --git a/recipes/mp-units/2.2.0/test_package/conanfile.py b/recipes/mp-units/2.2.0/test_package/conanfile.py new file mode 100644 index 0000000000000..e418ee7701960 --- /dev/null +++ b/recipes/mp-units/2.2.0/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 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/mp-units/2.2.0/test_package/test_package.cpp b/recipes/mp-units/2.2.0/test_package/test_package.cpp new file mode 100644 index 0000000000000..1182e75d816e4 --- /dev/null +++ b/recipes/mp-units/2.2.0/test_package/test_package.cpp @@ -0,0 +1,16 @@ +#include +#include +#include + +using namespace mp_units; + +constexpr auto avg_speed(QuantityOf auto d, QuantityOf auto t) +{ + return d / t; +} + +int main() +{ + using namespace mp_units::si::unit_symbols; + std::cout << "Average speed = " << avg_speed(240 * km, 2 * h) << '\n'; +} diff --git a/recipes/mp-units/2.3.0/conandata.yml b/recipes/mp-units/2.3.0/conandata.yml new file mode 100644 index 0000000000000..bde86ac17bc97 --- /dev/null +++ b/recipes/mp-units/2.3.0/conandata.yml @@ -0,0 +1,7 @@ +sources: + "2.4.0": + url: https://github.com/mpusz/units/archive/v2.4.0.tar.gz + sha256: 777e53ba8da891161e90a93b90b92fa66951d49aaae1b0203ddf934532bbeb56 + "2.3.0": + url: https://github.com/mpusz/units/archive/v2.3.0.tar.gz + sha256: ce2f167ff788ae769e73ea7676f15302827cd37908da3928dcae048f916898d6 diff --git a/recipes/mp-units/2.3.0/conanfile.py b/recipes/mp-units/2.3.0/conanfile.py new file mode 100644 index 0000000000000..22e718ebd0955 --- /dev/null +++ b/recipes/mp-units/2.3.0/conanfile.py @@ -0,0 +1,325 @@ +import os + +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import 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 + +required_conan_version = ">=1.59.0" + + +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] + + +class MPUnitsConan(ConanFile): + name = "mp-units" + homepage = "https://github.com/mpusz/mp-units" + description = "The quantities and units library for C++" + topics = ( + "units", + "dimensions", + "quantities", + "dimensional-analysis", + "physical-quantities", + "physical-units", + "system-of-units", + "system-of-quantities", + "isq", + "si", + "library", + "quantity-manipulation", + ) + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + settings = "os", "arch", "compiler", "build_type" + options = { + "cxx_modules": [True, False], + "import_std": [True, False], + "std_format": [True, False], + "string_view_ret": [True, False], + "no_crtp": [True, False], + "contracts": ["none", "gsl-lite", "ms-gsl"], + "freestanding": [True, False], + } + default_options = { + # "cxx_modules" default set in config_options() + # "import_std" default set in config_options() + # "std_format" default set in config_options() + # "string_view_ret" default set in config_options() + # "no_crtp" default set in config_options() + "contracts": "gsl-lite", + "freestanding": False, + } + no_copy_source = True + + @property + def _feature_compatibility(self): + return { + "minimum_support": { + "min_cppstd": "20", + "compiler": { + "gcc": "12", + "clang": "16", + "apple-clang": "15", + "msvc": "194", + "Visual Studio": "17", + }, + }, + "std_format": { + "min_cppstd": "20", + "compiler": { + "gcc": "13", + "clang": "17", + "apple-clang": "", + "msvc": "194", + "Visual Studio": "17", + }, + }, + "cxx_modules": { + "min_cppstd": "20", + "compiler": { + "gcc": "", + "clang": "17", + "apple-clang": "", + "msvc": "", + "Visual Studio": "", + }, + }, + "import_std": { + "min_cppstd": "23", + "compiler": {"gcc": "", "clang": "18", "apple-clang": "", "msvc": ""}, + }, + "static_constexpr_vars_in_constexpr_func": { + "min_cppstd": "23", + "compiler": { + "gcc": "13", + "clang": "17", + "apple-clang": "", + "msvc": "", + "Visual Studio": "", + }, + }, + "explicit_this": { + "min_cppstd": "23", + "compiler": { + "gcc": "14", + "clang": "18", + "apple-clang": "", + "msvc": "", + "Visual Studio": "", + }, + }, + } + + @property + def _option_feature_map(self): + return { + "std_format": "std_format", + "cxx_modules": "cxx_modules", + "import_std": "import_std", + "string_view_ret": "static_constexpr_vars_in_constexpr_func", + "no_crtp": "explicit_this", + } + + def _set_default_option(self, name): + compiler = self.settings.compiler + feature_name = self._option_feature_map[name] + feature = self._feature_compatibility[feature_name] + min_version = feature["compiler"].get(str(compiler)) + setattr( + self.options, + name, + bool( + min_version + and Version(compiler.version) >= min_version + and valid_min_cppstd(self, feature["min_cppstd"]) + ), + ) + + def _check_feature_supported(self, name, feature_name=name): + compiler = self.settings.compiler + cppstd = compiler.get_safe("cppstd") + feature = self._feature_compatibility[feature_name] + + # check C++ version + if cppstd and not valid_min_cppstd(self, feature["min_cppstd"]): + raise ConanInvalidConfiguration( + f"'{name}' requires at least cppstd={feature['min_cppstd']} ({cppstd} in use)", + ) + + # check compiler version + min_version = feature["compiler"].get(str(compiler)) + if min_version == None: + # not tested compiler being used - use at your own risk + return + if min_version == "": + raise ConanInvalidConfiguration( + f"'{name}' is not yet supported by any known {compiler} version" + ) + if loose_lt_semver(str(compiler.version), min_version): + raise ConanInvalidConfiguration( + f"'{name}' requires at least {compiler}-{min_version} ({compiler}-{compiler.version} in use)" + ) + + def config_options(self): + for key in self._option_feature_map.keys(): + self._set_default_option(key) + # TODO mixing of `import std;` and regular header files includes does not work for now + if self.options.import_std: + self.options.contracts = "none" + + def configure(self): + if self.options.cxx_modules: + self.package_type = "static-library" + else: + self.package_type = "header-library" + if self.options.freestanding: + self.options.rm_safe("std_format") + + def requirements(self): + if not self.options.freestanding: + if self.options.contracts == "gsl-lite": + self.requires("gsl-lite/0.41.0", transitive_headers=True) + elif self.options.contracts == "ms-gsl": + self.requires("ms-gsl/4.0.0", transitive_headers=True) + if not self.options.std_format: + self.requires("fmt/11.0.1", transitive_headers=True) + + def build_requirements(self): + self.tool_requires("cmake/[>=3.30 <4]") + + def validate(self): + self._check_feature_supported("mp-units", "minimum_support") + for key, value in self._option_feature_map.items(): + if self.options.get_safe(key) == True: + self._check_feature_supported(key, value) + if self.options.freestanding and self.options.contracts != "none": + raise ConanInvalidConfiguration( + "'contracts' should be set to 'none' for a freestanding build" + ) + # TODO mixing of `import std;` and regular header files includes does not work for now + if self.options.import_std: + if self.options.contracts != "none": + raise ConanInvalidConfiguration( + "'contracts' should be set to 'none' to use `import std;`" + ) + if not self.options.get_safe("std_format", default=True): + raise ConanInvalidConfiguration( + "'std_format' should be enabled to use `import std;`" + ) + + 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): + opt = self.options + tc = CMakeToolchain(self) + if opt.cxx_modules: + tc.cache_variables["CMAKE_CXX_SCAN_FOR_MODULES"] = True + if opt.import_std: + tc.cache_variables["CMAKE_CXX_MODULE_STD"] = True + # TODO current experimental support according to `Help/dev/experimental.rst` + tc.cache_variables["CMAKE_EXPERIMENTAL_CXX_IMPORT_STD"] = ( + "0e5b6991-d74f-4b3d-a41c-cf096e0b2508" + ) + + # TODO remove the below when Conan will learn to handle C++ modules + if opt.freestanding: + tc.cache_variables["MP_UNITS_API_FREESTANDING"] = True + else: + tc.cache_variables["MP_UNITS_API_STD_FORMAT"] = opt.std_format + tc.cache_variables["MP_UNITS_API_CONTRACTS"] = str(opt.contracts).upper() + + tc.generate() + deps = CMakeDeps(self) + deps.generate() + + def build(self): + cmake = CMake(self) + cmake.configure(build_script_folder="src") + if self.options.cxx_modules: + cmake.build() + + def package_id(self): + if self.package_type == "header-library": + self.info.clear() + + def package(self): + copy( + self, + "LICENSE.md", + self.source_folder, + os.path.join(self.package_folder, "licenses"), + ) + cmake = CMake(self) + cmake.install() + # TODO remove the below when Conan will learn to handle C++ modules + if not self.options.cxx_modules: + # We have to preserve those files for C++ modules build as Conan + # can't generate such CMake targets for now + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + + def package_info(self): + compiler = self.settings.compiler + # TODO remove the branch when Conan will learn to handle C++ modules + if self.options.cxx_modules: + # CMakeDeps does not generate C++ modules definitions for now + # Skip the Conan-generated files and use the mp-unitsConfig.cmake bundled with mp-units + self.cpp_info.set_property("cmake_find_mode", "none") + self.cpp_info.builddirs = ["."] + else: + # handle contracts + if self.options.contracts == "none": + self.cpp_info.components["core"].defines.append( + "MP_UNITS_API_CONTRACTS=0" + ) + elif self.options.contracts == "gsl-lite": + self.cpp_info.components["core"].requires.append("gsl-lite::gsl-lite") + self.cpp_info.components["core"].defines.append( + "MP_UNITS_API_CONTRACTS=2" + ) + elif self.options.contracts == "ms-gsl": + self.cpp_info.components["core"].requires.append("ms-gsl::ms-gsl") + self.cpp_info.components["core"].defines.append( + "MP_UNITS_API_CONTRACTS=3" + ) + + # handle API options + self.cpp_info.components["core"].defines.append( + "MP_UNITS_API_STRING_VIEW_RET=" + + str(int(self.options.string_view_ret == True)) + ) + self.cpp_info.components["core"].defines.append( + "MP_UNITS_API_NO_CRTP=" + str(int(self.options.no_crtp == True)) + ) + self.cpp_info.components["core"].defines.append( + "MP_UNITS_API_STD_FORMAT=" + str(int(self.options.std_format == True)) + ) + if not self.options.std_format: + self.cpp_info.components["core"].requires.append("fmt::fmt") + + # handle hosted configuration + if not self.options.freestanding: + self.cpp_info.components["core"].defines.append("MP_UNITS_HOSTED=1") + + # handle import std + if self.options.import_std: + self.cpp_info.components["core"].defines.append("MP_UNITS_IMPORT_STD") + if compiler == "clang" and Version(compiler.version) < 19: + self.cpp_info.components["core"].cxxflags.append( + "-Wno-deprecated-declarations" + ) + + if compiler == "msvc": + self.cpp_info.components["core"].cxxflags.append("/utf-8") + + self.cpp_info.components["systems"].requires = ["core"] diff --git a/recipes/mp-units/2.3.0/test_package/CMakeLists.txt b/recipes/mp-units/2.3.0/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..0938e502d546b --- /dev/null +++ b/recipes/mp-units/2.3.0/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.25) +project(test_package LANGUAGES CXX) + +find_package(mp-units REQUIRED) + +add_executable(test_package test_package.cpp) +target_link_libraries(test_package PRIVATE mp-units::mp-units) +target_compile_features(test_package PUBLIC cxx_std_20) diff --git a/recipes/mp-units/2.3.0/test_package/conanfile.py b/recipes/mp-units/2.3.0/test_package/conanfile.py new file mode 100644 index 0000000000000..b2ed4344df2cb --- /dev/null +++ b/recipes/mp-units/2.3.0/test_package/conanfile.py @@ -0,0 +1,46 @@ +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 = "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) + opt = self.dependencies["mp-units"].options + if opt.cxx_modules: + tc.cache_variables["CMAKE_CXX_SCAN_FOR_MODULES"] = True + if opt.import_std: + tc.cache_variables["CMAKE_CXX_MODULE_STD"] = True + # Current experimental support according to `Help/dev/experimental.rst` + tc.cache_variables[ + "CMAKE_EXPERIMENTAL_CXX_IMPORT_STD" + ] = "0e5b6991-d74f-4b3d-a41c-cf096e0b2508" + # TODO remove the below when Conan will learn to handle C++ modules + if opt.freestanding: + tc.cache_variables["MP_UNITS_API_FREESTANDING"] = True + else: + tc.cache_variables["MP_UNITS_API_STD_FORMAT"] = opt.std_format + tc.cache_variables["MP_UNITS_API_CONTRACTS"] = str(opt.contracts).upper() + 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/mp-units/2.3.0/test_package/test_package.cpp b/recipes/mp-units/2.3.0/test_package/test_package.cpp new file mode 100644 index 0000000000000..5cdfe02de428f --- /dev/null +++ b/recipes/mp-units/2.3.0/test_package/test_package.cpp @@ -0,0 +1,30 @@ +#include +#include +#ifdef MP_UNITS_IMPORT_STD +import std; +#else +#include +#endif +#ifdef MP_UNITS_MODULES +import mp_units; +#else +#include +#include +#include +#include +#endif + +using namespace mp_units; + +constexpr QuantityOf auto avg_speed( + QuantityOf auto d, + QuantityOf auto t) +{ + return d / t; +} + +int main() +{ + using namespace mp_units::si::unit_symbols; + std::cout << MP_UNITS_STD_FMT::format("Average speed = {}\n", avg_speed(240 * km, 2 * h)); +} diff --git a/recipes/mp-units/config.yml b/recipes/mp-units/config.yml index 7ad903a9673a0..65cd632824585 100644 --- a/recipes/mp-units/config.yml +++ b/recipes/mp-units/config.yml @@ -1,5 +1,15 @@ versions: - "0.7.0": - folder: 0.7.0 - "0.6.0": - folder: 0.6.0 + "2.4.0": + folder: 2.3.0 + "2.3.0": + folder: 2.3.0 + "2.2.1": + folder: 2.2.0 + "2.1.1": + folder: 2.0.0 + "2.1.0": + folder: 2.0.0 + "2.0.0": + folder: 2.0.0 + "0.8.0": + folder: 0.8.0 diff --git a/recipes/mpark-variant/all/conanfile.py b/recipes/mpark-variant/all/conanfile.py index e015db951bf2d..1796ef9e9cc74 100644 --- a/recipes/mpark-variant/all/conanfile.py +++ b/recipes/mpark-variant/all/conanfile.py @@ -15,6 +15,7 @@ class MparkVariantConan(ConanFile): description = "C++17 std::variant for C++11/14/17" license = "BSL-1.0" topics = ("variant", "mpark-variant") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -29,8 +30,7 @@ def validate(self): 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 build(self): pass diff --git a/recipes/mpc/all/conandata.yml b/recipes/mpc/all/conandata.yml index 007c14f9a1cc4..8f24801eccbac 100644 --- a/recipes/mpc/all/conandata.yml +++ b/recipes/mpc/all/conandata.yml @@ -1,11 +1,15 @@ sources: + "1.3.1": + url: "https://ftp.gnu.org/gnu/mpc/mpc-1.3.1.tar.gz" + sha256: "ab642492f5cf882b74aa0cb730cd410a81edcdbec895183ce930e706c1c759b8" "1.2.0": - url: https://ftp.gnu.org/gnu/mpc/mpc-1.2.0.tar.gz - sha256: e90f2d99553a9c19911abdb4305bf8217106a957e3994436428572c8dfe8fda6 + url: "https://ftp.gnu.org/gnu/mpc/mpc-1.2.0.tar.gz" + sha256: "e90f2d99553a9c19911abdb4305bf8217106a957e3994436428572c8dfe8fda6" "1.1.0": - url: https://ftp.gnu.org/gnu/mpc/mpc-1.1.0.tar.gz - sha256: 6985c538143c1208dcb1ac42cedad6ff52e267b47e5f970183a3e75125b43c2e + url: "https://ftp.gnu.org/gnu/mpc/mpc-1.1.0.tar.gz" + sha256: "6985c538143c1208dcb1ac42cedad6ff52e267b47e5f970183a3e75125b43c2e" 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..820b8fd1588b8 100644 --- a/recipes/mpc/all/conanfile.py +++ b/recipes/mpc/all/conanfile.py @@ -1,80 +1,106 @@ -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" 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") - url = "https://github.com/conan-io/conan-center-index" - homepage = "http://www.multiprecision.org/mpc/home.html" license = "LGPL-3.0-or-later" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://www.multiprecision.org/" + topics = ("multiprecision", "math", "mathematics") settings = "os", "arch", "compiler", "build_type" - options = {"shared": [True, False], "fPIC": [True, False]} - default_options = {"shared": False, "fPIC": True} - exports_sources = "patches/**" - _autotools = None + package_type = "library" + 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': - 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 layout(self): + basic_layout(self, src_folder="src") def requirements(self): - self.requires("mpfr/4.1.0") + self.requires("gmp/6.3.0", transitive_headers=True) + self.requires("mpfr/4.2.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(f"{self.ref} 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 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, 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..3a407d4714c49 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) +project(test_package LANGUAGES 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..45240bc874229 100644 --- a/recipes/mpc/all/test_package/conanfile.py +++ b/recipes/mpc/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 cross_building 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 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/mpc/config.yml b/recipes/mpc/config.yml index d07c95e596619..ad477c94d0d7a 100644 --- a/recipes/mpc/config.yml +++ b/recipes/mpc/config.yml @@ -1,4 +1,6 @@ versions: + "1.3.1": + folder: all "1.2.0": folder: all "1.1.0": diff --git a/recipes/mpdecimal/2.4.2/conandata.yml b/recipes/mpdecimal/2.4.2/conandata.yml index 41a874b9a4e1b..c08ade0abc061 100644 --- a/recipes/mpdecimal/2.4.2/conandata.yml +++ b/recipes/mpdecimal/2.4.2/conandata.yml @@ -4,7 +4,5 @@ sources: url: "http://www.bytereef.org/software/mpdecimal/releases/mpdecimal-2.4.2.tar.gz" patches: "2.4.2": - - base_path: "source_subfolder" - patch_file: "patches/0001-msvc-fixes.patch" - - base_path: "source_subfolder" - patch_file: "patches/0002-disable-vcstdint-h-vs2015.patch" + - patch_file: "patches/0001-msvc-fixes.patch" + - patch_file: "patches/0002-disable-vcstdint-h-vs2015.patch" diff --git a/recipes/mpdecimal/2.4.2/conanfile.py b/recipes/mpdecimal/2.4.2/conanfile.py index e0edbd2d2f318..c1e944ec6366b 100644 --- a/recipes/mpdecimal/2.4.2/conanfile.py +++ b/recipes/mpdecimal/2.4.2/conanfile.py @@ -1,19 +1,30 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, tools -from conans.errors import ConanInvalidConfiguration import os -import shutil + +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.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, replace_in_file, rmdir, mkdir, rename +from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, VCVars, NMakeDeps, NMakeToolchain + +required_conan_version = ">=1.53.0" class MpdecimalConan(ConanFile): name = "mpdecimal" - version = "2.4.2" - description = "mpdecimal is a package for correctly-rounded arbitrary precision decimal floating point arithmetic." + description = ( + "mpdecimal is a package for correctly-rounded arbitrary precision decimal floating point arithmetic." + ) license = "BSD-2-Clause" - topics = ("mpdecimal", "multiprecision", "library") url = "https://github.com/conan-io/conan-center-index" homepage = "http://www.bytereef.org/mpdecimal" - settings = "os", "compiler", "build_type", "arch" - exports_sources = "patches/**" + topics = ("multiprecision", "library") + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -23,42 +34,72 @@ class MpdecimalConan(ConanFile): "fPIC": True, } - _autotools = None - @property - def _source_subfolder(self): - return "source_subfolder" + def _settings_build(self): + return getattr(self, "setings_build", self.settings) - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - - def configure(self): - if self._is_msvc and self.settings.arch not in ("x86", "x86_64"): - raise ConanInvalidConfiguration("Arch is unsupported") - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd - if self.options.shared: - del self.options.fPIC + def export_sources(self): + 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.libcxx") + self.settings.rm_safe("compiler.cppstd") + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + basic_layout(self, src_folder="src") + + def validate(self): + if is_msvc(self) and self.settings.arch not in ("x86", "x86_64"): + raise ConanInvalidConfiguration( + f"{self.ref} currently does not supported {self.settings.arch}. Contributions are welcomed") + + def build_requirements(self): + if is_msvc(self): + self.tool_requires("automake/1.16.5") + else: + 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) - _shared_ext_mapping = { - "Linux": ".so", - "Windows": ".dll", - "Macos": ".dylib", - } + def generate(self): + if is_msvc(self): + vcvars = VCVars(self) + vcvars.generate() + + deps = NMakeDeps(self) + deps.generate() + + tc = NMakeToolchain(self) + tc.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) + if is_apple_os(self) and self.settings.arch == "armv8": + deps.environment.append("LDFLAGS", ["-arch arm64"]) + deps.environment.append("LDXXFLAGS", ["-arch arm64"]) + deps.generate() def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - if not self._is_msvc: + apply_conandata_patches(self) + if not is_msvc(self): """ Using autotools: - Build only shared libraries when shared == True @@ -66,142 +107,140 @@ def _patch_sources(self): ! This is more complicated on Windows because when shared=True, an implicit static library has to be built """ - shared_ext = self._shared_ext_mapping[str(self.settings.os)] + shared_ext_mapping = { + "Linux": ".so", + "Windows": ".dll", + "Macos": ".dylib", + } + shared_ext = shared_ext_mapping[str(self.settings.os)] static_ext = ".a" main_version, _ = self.version.split(".", 1) - tools.replace_in_file(os.path.join(self._source_subfolder, "configure"), - "libmpdec.a", - "libmpdec{}".format(static_ext)) - tools.replace_in_file(os.path.join(self._source_subfolder, "configure"), - "libmpdec.so", - "libmpdec{}".format(shared_ext)) - - makefile_in = os.path.join(self._source_subfolder, "Makefile.in") - mpdec_makefile_in = os.path.join(self._source_subfolder, "libmpdec", "Makefile.in") - tools.replace_in_file(makefile_in, - "libdir = @libdir@", - "libdir = @libdir@\n" - "bindir = @bindir@") + replace_in_file(self, os.path.join(self.source_folder, "configure"), + "libmpdec.a", f"libmpdec{static_ext}") + replace_in_file(self, os.path.join(self.source_folder, "configure"), + "libmpdec.so", f"libmpdec{shared_ext}") + + makefile_in = os.path.join(self.source_folder, "Makefile.in") + mpdec_makefile_in = os.path.join(self.source_folder, "libmpdec", "Makefile.in") + replace_in_file(self, makefile_in, "libdir = @libdir@", "libdir = @libdir@\nbindir = @bindir@") if self.options.shared: if self.settings.os == "Windows": - tools.replace_in_file(makefile_in, - "LIBSHARED = @LIBSHARED@", - "LIBSHARED = libmpdec-{}{}".format(main_version, shared_ext)) - tools.replace_in_file(makefile_in, - "install: FORCE", - "install: FORCE\n" - "\t$(INSTALL) -d -m 755 $(DESTDIR)$(bindir)") - tools.replace_in_file(makefile_in, - "\t$(INSTALL) -m 755 libmpdec/$(LIBSHARED) $(DESTDIR)$(libdir)\n", - "\t$(INSTALL) -m 755 libmpdec/$(LIBSHARED) $(DESTDIR)$(bindir)\n") - tools.replace_in_file(makefile_in, - "\tcd $(DESTDIR)$(libdir) && ln -sf $(LIBSHARED) $(LIBSONAME) && ln -sf $(LIBSHARED) libmpdec.so\n", - "") + replace_in_file(self, makefile_in, + "LIBSHARED = @LIBSHARED@", + f"LIBSHARED = libmpdec-{main_version}{shared_ext}") + replace_in_file(self, makefile_in, + "install: FORCE", + "install: FORCE\n\t$(INSTALL) -d -m 755 $(DESTDIR)$(bindir)") + replace_in_file(self, makefile_in, + "\t$(INSTALL) -m 755 libmpdec/$(LIBSHARED) $(DESTDIR)$(libdir)\n", + "\t$(INSTALL) -m 755 libmpdec/$(LIBSHARED) $(DESTDIR)$(bindir)\n") + replace_in_file(self, makefile_in, + "\tcd $(DESTDIR)$(libdir) && ln -sf $(LIBSHARED) $(LIBSONAME) && ln -sf $(LIBSHARED) libmpdec.so\n", + "") else: - tools.replace_in_file(makefile_in, - "\t$(INSTALL) -m 644 libmpdec/$(LIBSTATIC) $(DESTDIR)$(libdir)\n", - "") - tools.replace_in_file(makefile_in, - "\tcd $(DESTDIR)$(libdir) && ln -sf $(LIBSHARED) $(LIBSONAME) && ln -sf $(LIBSHARED) libmpdec.so", - "\tcd $(DESTDIR)$(libdir) && ln -sf $(LIBSHARED) $(LIBSONAME) && ln -sf $(LIBSHARED) libmpdec{}".format(shared_ext)) + replace_in_file(self, makefile_in, + "\t$(INSTALL) -m 644 libmpdec/$(LIBSTATIC) $(DESTDIR)$(libdir)\n", + "") + replace_in_file(self, makefile_in, + "\tcd $(DESTDIR)$(libdir) && ln -sf $(LIBSHARED) $(LIBSONAME) && ln -sf $(LIBSHARED) libmpdec.so", + f"\tcd $(DESTDIR)$(libdir) && ln -sf $(LIBSHARED) $(LIBSONAME) && ln -sf $(LIBSHARED) libmpdec{shared_ext}") else: - tools.replace_in_file(makefile_in, - "\t$(INSTALL) -m 755 libmpdec/$(LIBSHARED) $(DESTDIR)$(libdir)\n", - "") - tools.replace_in_file(makefile_in, - "\tcd $(DESTDIR)$(libdir) && ln -sf $(LIBSHARED) $(LIBSONAME) && ln -sf $(LIBSHARED) libmpdec.so\n", - "") + replace_in_file(self, makefile_in, + "\t$(INSTALL) -m 755 libmpdec/$(LIBSHARED) $(DESTDIR)$(libdir)\n", + "") + replace_in_file(self, makefile_in, + "\tcd $(DESTDIR)$(libdir) && ln -sf $(LIBSHARED) $(LIBSONAME) && ln -sf $(LIBSHARED) libmpdec.so\n", + "") - tools.replace_in_file(mpdec_makefile_in, - "default: $(LIBSTATIC) $(LIBSHARED)", - "default: $({})".format("LIBSHARED" if self.options.shared else "LIBSTATIC")) + replace_in_file(self, mpdec_makefile_in, + "default: $(LIBSTATIC) $(LIBSHARED)", + "default: $({})".format("LIBSHARED" if self.options.shared else "LIBSTATIC")) if self.settings.os == "Windows": - tools.replace_in_file(mpdec_makefile_in, - "LIBSHARED = @LIBSHARED@", - "LIBSHARED = libmpdec-{}{}".format(main_version, shared_ext)) - tools.replace_in_file(mpdec_makefile_in, - "\tln -sf $(LIBSHARED) libmpdec.so", - "") - tools.replace_in_file(mpdec_makefile_in, - "\tln -sf $(LIBSHARED) $(LIBSONAME)", - "") - tools.replace_in_file(mpdec_makefile_in, - "CONFIGURE_LDFLAGS =", - "CONFIGURE_LDFLAGS = -Wl,--out-implib,libmpdec{}".format(static_ext)) + replace_in_file(self, mpdec_makefile_in, + "LIBSHARED = @LIBSHARED@", + f"LIBSHARED = libmpdec-{main_version}{shared_ext}") + replace_in_file(self, mpdec_makefile_in, "\tln -sf $(LIBSHARED) libmpdec.so", "") + replace_in_file(self, mpdec_makefile_in, "\tln -sf $(LIBSHARED) $(LIBSONAME)", "") + replace_in_file(self, mpdec_makefile_in, + "CONFIGURE_LDFLAGS =", + f"CONFIGURE_LDFLAGS = -Wl,--out-implib,libmpdec{static_ext}") else: - tools.replace_in_file(mpdec_makefile_in, - "libmpdec.so", - "libmpdec{}".format(shared_ext)) + replace_in_file(self, mpdec_makefile_in, "libmpdec.so", f"libmpdec{shared_ext}") - def _build_msvc(self): - libmpdec_folder = os.path.join(self.build_folder, self._source_subfolder, "libmpdec") - vcbuild_folder = os.path.join(self.build_folder, self._source_subfolder, "vcbuild") - arch_ext = "{}".format(32 if self.settings.arch == "x86" else 64) - dist_folder = os.path.join(vcbuild_folder, "dist{}".format(arch_ext)) - os.mkdir(dist_folder) - - shutil.copy(os.path.join(libmpdec_folder, "Makefile.vc"), os.path.join(libmpdec_folder, "Makefile")) - - autotools = AutoToolsBuildEnvironment(self) - - with tools.chdir(libmpdec_folder): - with tools.vcvars(self.settings): - self.run("""nmake /nologo MACHINE={machine} DLL={dll} CONAN_CFLAGS="{cflags}" CONAN_LDFLAGS="{ldflags}" """.format( - machine="ppro" if self.settings.arch == "x86" else "x64", - dll="1" if self.options.shared else "0", - cflags=" ".join(autotools.flags), - ldflags=" ".join(autotools.link_flags), - )) - - shutil.copy("mpdecimal.h", dist_folder) - if self.options.shared: - shutil.copy("libmpdec-{}.dll".format(self.version), os.path.join(dist_folder, "libmpdec-{}.dll".format(self.version))) - shutil.copy("libmpdec-{}.dll.exp".format(self.version), os.path.join(dist_folder, "libmpdec-{}.exp".format(self.version))) - shutil.copy("libmpdec-{}.dll.lib".format(self.version), os.path.join(dist_folder, "libmpdec-{}.lib".format(self.version))) - else: - shutil.copy("libmpdec-{}.lib".format(self.version), dist_folder) + @property + def _libmpdec_folder(self): + return self.source_path / "libmpdec" + + @property + def _dist_folder(self): + vcbuild_folder = self.build_path / "vcbuild" + arch_ext = "32" if self.settings.arch == "x86" else "64" + return vcbuild_folder / f"dist{arch_ext}" - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - if self.settings.os == "Macos" and self.settings.arch == "armv8": - self._autotools.link_flags.append("-arch arm64") - self._autotools .configure() - return self._autotools + def _build_msvc(self): + libmpdec_folder = self._libmpdec_folder + copy(self, "Makefile.vc", libmpdec_folder, self.build_path) + rename(self, self.build_path / "Makefile.vc", libmpdec_folder / "Makefile") + + ext = "dll" if self.options.shared else "lib" + mpdec_target = f"libmpdec-{self.version}.{ext}" + + with chdir(self, libmpdec_folder): + self.run("nmake -f Makefile.vc {target} MACHINE={machine} DEBUG={debug} DLL={dll}".format( + target=mpdec_target, + machine={"x86": "ppro", "x86_64": "x64"}[str(self.settings.arch)], + # FIXME: else, use ansi32 and ansi64 + debug="1" if self.settings.build_type == "Debug" else "0", + dll="1" if self.options.shared else "0", + )) + + dist_folder = self._dist_folder + mkdir(self, dist_folder) + copy(self, "mpdecimal.h", libmpdec_folder, dist_folder) + if self.options.shared: + copy(self, "*.dll", libmpdec_folder, dist_folder) + copy(self, "*.dll.exp", libmpdec_folder, dist_folder) + copy(self, "*.dll.lib", libmpdec_folder, dist_folder) + else: + copy(self, "*.lib", libmpdec_folder, dist_folder) def build(self): self._patch_sources() - if self._is_msvc: + if is_msvc(self): self._build_msvc() else: - with tools.chdir(self._source_subfolder): - autotools = self._configure_autotools() + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.configure() autotools.make() def package(self): - self.copy("LICENSE.txt", src=self._source_subfolder, dst="licenses") - if self._is_msvc: - distfolder = os.path.join(self.build_folder, self._source_subfolder, "vcbuild", "dist{}".format(32 if self.settings.arch == "x86" else 64)) - self.copy("vc*.h", src=os.path.join(self.build_folder, self._source_subfolder, "libmpdec"), dst="include") - self.copy("*.h", src=distfolder, dst="include") - self.copy("*.lib", src=distfolder, dst="lib") - self.copy("*.dll", src=distfolder, dst="bin") + copy(self, "LICENSE.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + if is_msvc(self): + dist_folder = self._dist_folder + copy(self, "vc*.h", src=self._libmpdec_folder, dst=os.path.join(self.package_folder, "include")) + copy(self, "*.h", src=dist_folder, dst=os.path.join(self.package_folder, "include")) + copy(self, "*.lib", src=dist_folder, dst=os.path.join(self.package_folder, "lib")) + copy(self, "*.dll", src=dist_folder, dst=os.path.join(self.package_folder, "bin")) else: - with tools.chdir(os.path.join(self.build_folder, self._source_subfolder)): - autotools = self._configure_autotools() + with chdir(self, os.path.join(self.source_folder)): + autotools = Autotools(self) autotools.install() - tools.rmdir(os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "share")) + fix_apple_shared_install_name(self) def package_info(self): - if self._is_msvc: - self.cpp_info.libs = ["libmpdec-{}".format(self.version)] + if is_msvc(self): + if self.options.shared: + self.cpp_info.libs = [f"libmpdec-{self.version}.dll"] + else: + self.cpp_info.libs = [f"libmpdec-{self.version}"] else: self.cpp_info.libs = ["mpdec"] if self.options.shared: - if self._is_msvc: + if is_msvc(self): self.cpp_info.defines = ["USE_DLL"] else: if self.settings.os in ["Linux", "FreeBSD"]: diff --git a/recipes/mpdecimal/2.4.2/test_package/CMakeLists.txt b/recipes/mpdecimal/2.4.2/test_package/CMakeLists.txt index 3a403dc404b41..fecc277bff235 100644 --- a/recipes/mpdecimal/2.4.2/test_package/CMakeLists.txt +++ b/recipes/mpdecimal/2.4.2/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ -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() +find_package(mpdecimal REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE mpdecimal::mpdecimal) diff --git a/recipes/mpdecimal/2.4.2/test_package/conanfile.py b/recipes/mpdecimal/2.4.2/test_package/conanfile.py index 97c415cdb0a2a..694bc86329208 100644 --- a/recipes/mpdecimal/2.4.2/test_package/conanfile.py +++ b/recipes/mpdecimal/2.4.2/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" + 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("{} 13 100".format(os.path.join("bin", "test_package")), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + self.run(f"{bin_path} 13 100", env="conanrun") diff --git a/recipes/mpdecimal/2.4.2/test_v1_package/CMakeLists.txt b/recipes/mpdecimal/2.4.2/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/mpdecimal/2.4.2/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/mpdecimal/2.4.2/test_v1_package/conanfile.py b/recipes/mpdecimal/2.4.2/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..fa100896a6cfb --- /dev/null +++ b/recipes/mpdecimal/2.4.2/test_v1_package/conanfile.py @@ -0,0 +1,16 @@ +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.settings): + self.run("{} 13 100".format(os.path.join("bin", "test_package")), run_environment=True) diff --git a/recipes/mpdecimal/2.5.x/conandata.yml b/recipes/mpdecimal/2.5.x/conandata.yml deleted file mode 100644 index 4f956a8c3d9a5..0000000000000 --- a/recipes/mpdecimal/2.5.x/conandata.yml +++ /dev/null @@ -1,20 +0,0 @@ -sources: - "2.5.1": - sha256: "9f9cd4c041f99b5c49ffb7b59d9f12d95b683d88585608aa56a6307667b2b21f" - url: "http://www.bytereef.org/software/mpdecimal/releases/mpdecimal-2.5.1.tar.gz" - "2.5.0": - sha256: "15417edc8e12a57d1d9d75fa7e3f22b158a3b98f44db9d694cfd2acde8dfa0ca" - url: "http://www.bytereef.org/software/mpdecimal/releases/mpdecimal-2.5.0.tar.gz" -patches: - "2.5.1": - - base_path: "source_subfolder" - patch_file: "patches/2.5.1-0001-msvc-fixes.patch" - - base_path: "source_subfolder" - patch_file: "patches/2.5.1-0002-add-mingw-to-configure-ac.patch" - - base_path: "source_subfolder" - patch_file: "patches/2.5.1-0003-use-MPDECIMAL_DLL.patch" - "2.5.0": - - base_path: "source_subfolder" - patch_file: "patches/0001-2.5.0-msvc-fixes.patch" - - base_path: "source_subfolder" - patch_file: "patches/0002-add-mingw-to-configure-ac.patch" diff --git a/recipes/mpdecimal/2.5.x/conanfile.py b/recipes/mpdecimal/2.5.x/conanfile.py deleted file mode 100644 index a1cb1a8ead8ec..0000000000000 --- a/recipes/mpdecimal/2.5.x/conanfile.py +++ /dev/null @@ -1,223 +0,0 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, tools -from conans.errors import ConanInvalidConfiguration -import os -import shutil - -required_conan_version = ">=1.33.0" - - -class MpdecimalConan(ConanFile): - name = "mpdecimal" - description = "mpdecimal is a package for correctly-rounded arbitrary precision decimal floating point arithmetic." - license = "BSD-2-Clause" - topics = ("mpdecimal", "multiprecision", "library") - url = "https://github.com/conan-io/conan-center-index" - homepage = "http://www.bytereef.org/mpdecimal" - settings = "os", "compiler", "build_type", "arch" - options = { - "shared": [True, False], - "fPIC": [True, False], - "cxx": [True, False], - } - default_options = { - "shared": False, - "fPIC": True, - "cxx": True, - } - - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _settings_build(self): - return getattr(self, "setings_build", self.settings) - - @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"]) - - 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 not self.options.cxx: - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd - - def build_requirements(self): - if self._is_msvc: - 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") - - def validate(self): - if self._is_msvc and self.settings.arch not in ("x86", "x86_64"): - raise ConanInvalidConfiguration("Arch is unsupported") - if self.options.cxx: - if self.options.shared and self.settings.os == "Windows": - raise ConanInvalidConfiguration("A shared libmpdec++ is not possible on Windows (due to non-exportable thread local storage)") - - 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) - - def _build_msvc(self): - libmpdec_folder = os.path.join(self.build_folder, self._source_subfolder, "libmpdec") - libmpdecpp_folder = os.path.join(self.build_folder, self._source_subfolder, "libmpdec++") - vcbuild_folder = os.path.join(self.build_folder, self._source_subfolder, "vcbuild") - arch_ext = "{}".format(32 if self.settings.arch == "x86" else 64) - dist_folder = os.path.join(vcbuild_folder, "dist{}".format(arch_ext)) - os.mkdir(dist_folder) - - shutil.copy(os.path.join(libmpdec_folder, "Makefile.vc"), os.path.join(libmpdec_folder, "Makefile")) - - autotools = AutoToolsBuildEnvironment(self) - mpdec_extra_flags = [] - mpdecxx_extra_flags = [] - if tools.Version(self.version) >= "2.5.1": - if self.options.shared: - mpdec_extra_flags = ["-DMPDECIMAL_DLL"] - mpdecxx_extra_flags = ["-DLIBMPDECXX_DLL"] - - mpdec_target = "libmpdec-{}.{}".format(self.version, "dll" if self.options.shared else "lib") - mpdecpp_target = "libmpdec++-{}.{}".format(self.version, "dll" if self.options.shared else "lib") - - builds = [[libmpdec_folder, mpdec_target, mpdec_extra_flags] ] - if self.options.cxx: - builds.append([libmpdecpp_folder, mpdecpp_target, mpdecxx_extra_flags]) - with tools.vcvars(self): - for build_dir, target, extra_flags in builds: - with tools.chdir(build_dir): - self.run("""nmake /nologo /f Makefile.vc {target} MACHINE={machine} DEBUG={debug} DLL={dll} CONAN_CFLAGS="{cflags}" CONAN_CXXFLAGS="{cxxflags}" CONAN_LDFLAGS="{ldflags}" """.format( - target=target, - machine={"x86": "ppro", "x86_64": "x64"}[str(self.settings.arch)], # FIXME: else, use ansi32 and ansi64 - debug="1" if self.settings.build_type == "Debug" else "0", - dll="1" if self.options.shared else "0", - cflags=" ".join(autotools.flags + extra_flags), - cxxflags=" ".join(autotools.cxx_flags + extra_flags), - ldflags=" ".join(autotools.link_flags), - )) - - with tools.chdir(libmpdec_folder): - shutil.copy("mpdecimal.h", dist_folder) - if self.options.shared: - shutil.copy("libmpdec-{}.dll".format(self.version), os.path.join(dist_folder, "libmpdec-{}.dll".format(self.version))) - shutil.copy("libmpdec-{}.dll.exp".format(self.version), os.path.join(dist_folder, "libmpdec-{}.exp".format(self.version))) - shutil.copy("libmpdec-{}.dll.lib".format(self.version), os.path.join(dist_folder, "libmpdec-{}.lib".format(self.version))) - else: - shutil.copy("libmpdec-{}.lib".format(self.version), os.path.join(dist_folder, "libmpdec-{}.lib".format(self.version))) - if self.options.cxx: - with tools.chdir(libmpdecpp_folder): - shutil.copy("decimal.hh", dist_folder) - shutil.copy("libmpdec++-{}.lib".format(self.version), os.path.join(dist_folder, "libmpdec++-{}.lib".format(self.version))) - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - conf_vars = self._autotools.vars - if self.settings.os == "Macos" and self.settings.arch == "armv8": - conf_vars["LDFLAGS"] += " -arch arm64" - conf_vars["LDXXFLAGS"] = "-arch arm64" - conf_args = [ - "--enable-cxx" if self.options.cxx else "--disable-cxx" - ] - self._autotools.configure(args=conf_args, vars=conf_vars) - return self._autotools - - @property - def _shared_suffix(self): - if tools.is_apple_os(self.settings.os): - return ".dylib" - return { - "Windows": ".dll", - }.get(str(self.settings.os), ".so") - - @property - def _target_names(self): - libsuffix = self._shared_suffix if self.options.shared else ".a" - versionsuffix = ".{}".format(self.version) if self.options.shared else "" - suffix = "{}{}".format(versionsuffix, libsuffix) if tools.is_apple_os(self.settings.os) or self.settings.os == "Windows" else "{}{}".format(libsuffix, versionsuffix) - return "libmpdec{}".format(suffix), "libmpdec++{}".format(suffix) - - def build(self): - self._patch_sources() - if self._is_msvc: - self._build_msvc() - else: - with tools.chdir(self._source_subfolder): - self.run("autoreconf -fiv", win_bash=tools.os_info.is_windows) - autotools = self._configure_autotools() - self.output.info(tools.load(os.path.join("libmpdec", "Makefile"))) - libmpdec, libmpdecpp = self._target_names - with tools.chdir("libmpdec"): - autotools.make(target=libmpdec) - if self.options.cxx: - with tools.chdir("libmpdec++"): - autotools.make(target=libmpdecpp) - - def package(self): - self.copy("LICENSE.txt", src=self._source_subfolder, dst="licenses") - if self._is_msvc: - distfolder = os.path.join(self.build_folder, self._source_subfolder, "vcbuild", "dist{}".format(32 if self.settings.arch == "x86" else 64)) - self.copy("vc*.h", src=os.path.join(self.build_folder, self._source_subfolder, "libmpdec"), dst="include") - self.copy("*.h", src=distfolder, dst="include") - if self.options.cxx: - self.copy("*.hh", src=distfolder, dst="include") - self.copy("*.lib", src=distfolder, dst="lib") - self.copy("*.dll", src=distfolder, dst="bin") - else: - mpdecdir = os.path.join(self._source_subfolder, "libmpdec") - mpdecppdir = os.path.join(self._source_subfolder, "libmpdec++") - self.copy("mpdecimal.h", src=mpdecdir, dst="include") - if self.options.cxx: - self.copy("decimal.hh", src=mpdecppdir, dst="include") - builddirs = [mpdecdir] - if self.options.cxx: - builddirs.append(mpdecppdir) - for builddir in builddirs: - self.copy("*.a", src=builddir, dst="lib") - self.copy("*.so", src=builddir, dst="lib") - self.copy("*.so.*", src=builddir, dst="lib") - self.copy("*.dylib", src=builddir, dst="lib") - self.copy("*.dll", src=builddir, dst="bin") - - def package_info(self): - lib_pre_suf = ("", "") - if self._is_msvc: - lib_pre_suf = ("lib", "-{}".format(self.version)) - elif self.settings.os == "Windows": - if self.options.shared: - lib_pre_suf = ("", ".dll") - - self.cpp_info.components["libmpdecimal"].libs = ["{}mpdec{}".format(*lib_pre_suf)] - if self.options.shared: - if self._is_msvc: - if tools.Version(self.version) >= "2.5.1": - self.cpp_info.components["libmpdecimal"].defines = ["MPDECIMAL_DLL"] - else: - self.cpp_info.components["libmpdecimal"].defines = ["USE_DLL"] - else: - if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.components["libmpdecimal"].system_libs = ["m"] - - if self.options.cxx: - self.cpp_info.components["libmpdecimal++"].libs = ["{}mpdec++{}".format(*lib_pre_suf)] - self.cpp_info.components["libmpdecimal++"].requires = ["libmpdecimal"] - if self.options.shared: - if tools.Version(self.version) >= "2.5.1": - self.cpp_info.components["libmpdecimal"].defines = ["MPDECIMALXX_DLL"] diff --git a/recipes/mpdecimal/2.5.x/test_package/CMakeLists.txt b/recipes/mpdecimal/2.5.x/test_package/CMakeLists.txt deleted file mode 100644 index f452aa64e4430..0000000000000 --- a/recipes/mpdecimal/2.5.x/test_package/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup(TARGETS) - -# Workaround for -rpath on arm64: https://cmake.org/cmake/help/latest/release/3.20.html#id2 -if(CMAKE_VERSION VERSION_LESS "3.20.1" AND CMAKE_OSX_ARCHITECTURES STREQUAL "arm64") - set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") -endif() - -# This is a non-official mpdecimal module! -find_package(mpdecimal REQUIRED) - -add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE mpdecimal::libmpdecimal) - -if(MPDECIMAL_CXX ) - add_executable(${PROJECT_NAME}_cpp test_package.cpp) - set_propertY(TARGET ${PROJECT_NAME}_cpp PROPERTY CXX_STANDARD 11) - target_link_libraries(${PROJECT_NAME}_cpp PRIVATE mpdecimal::libmpdecimal++) -endif() diff --git a/recipes/mpdecimal/2.5.x/test_package/conanfile.py b/recipes/mpdecimal/2.5.x/test_package/conanfile.py deleted file mode 100644 index 9cdba214e6fb9..0000000000000 --- a/recipes/mpdecimal/2.5.x/test_package/conanfile.py +++ /dev/null @@ -1,19 +0,0 @@ -import os -from conans import ConanFile, CMake, tools - - -class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" - - def build(self): - cmake = CMake(self) - cmake.definitions["MPDECIMAL_CXX"] = self.options["mpdecimal"].cxx - cmake.configure() - cmake.build() - - def test(self): - if not tools.cross_building(self): - self.run("{} 13 100".format(os.path.join("bin", "test_package")), run_environment=True) - if self.options["mpdecimal"].cxx: - self.run("{} 13 100".format(os.path.join("bin", "test_package_cpp")), run_environment=True) diff --git a/recipes/mpdecimal/all/conandata.yml b/recipes/mpdecimal/all/conandata.yml new file mode 100644 index 0000000000000..687ee85812e98 --- /dev/null +++ b/recipes/mpdecimal/all/conandata.yml @@ -0,0 +1,21 @@ +sources: + "4.0.0": + sha256: "942445c3245b22730fd41a67a7c5c231d11cb1b9936b9c0f76334fb7d0b4468c" + url: "http://www.bytereef.org/software/mpdecimal/releases/mpdecimal-4.0.0.tar.gz" + "2.5.1": + sha256: "9f9cd4c041f99b5c49ffb7b59d9f12d95b683d88585608aa56a6307667b2b21f" + url: "http://www.bytereef.org/software/mpdecimal/releases/mpdecimal-2.5.1.tar.gz" + "2.5.0": + sha256: "15417edc8e12a57d1d9d75fa7e3f22b158a3b98f44db9d694cfd2acde8dfa0ca" + url: "http://www.bytereef.org/software/mpdecimal/releases/mpdecimal-2.5.0.tar.gz" +patches: + "4.0.0": + - patch_file: "patches/4.0.0-0001-msvc-fixes.patch" + - patch_file: "patches/4.0.0-0003-use-MPDECIMAL_DLL.patch" + "2.5.1": + - patch_file: "patches/2.5.1-0001-msvc-fixes.patch" + - patch_file: "patches/2.5.1-0002-add-mingw-to-configure-ac.patch" + - patch_file: "patches/2.5.1-0003-use-MPDECIMAL_DLL.patch" + "2.5.0": + - patch_file: "patches/0001-2.5.0-msvc-fixes.patch" + - patch_file: "patches/0002-add-mingw-to-configure-ac.patch" diff --git a/recipes/mpdecimal/all/conanfile.py b/recipes/mpdecimal/all/conanfile.py new file mode 100644 index 0000000000000..92620feb51411 --- /dev/null +++ b/recipes/mpdecimal/all/conanfile.py @@ -0,0 +1,237 @@ +from conan import ConanFile +from conan.tools.gnu import AutotoolsToolchain, Autotools +from conan.tools.files import get, chdir, copy, export_conandata_patches, apply_conandata_patches, mkdir, rename +from conan.tools.layout import basic_layout +from conan.tools.build import cross_building +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.microsoft import VCVars, is_msvc, NMakeDeps, NMakeToolchain +from conan.tools.apple import is_apple_os +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration + +required_conan_version = ">=1.55.0" + + +class MpdecimalConan(ConanFile): + name = "mpdecimal" + description = "mpdecimal is a package for correctly-rounded arbitrary precision decimal floating point arithmetic." + license = "BSD-2-Clause" + topics = ("multiprecision", "library") + url = "https://github.com/conan-io/conan-center-index" + homepage = "http://www.bytereef.org/mpdecimal" + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "cxx": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "cxx": 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") + if not self.options.cxx: + 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 is_msvc(self) and self.settings.arch not in ("x86", "x86_64"): + raise ConanInvalidConfiguration( + f"{self.ref} currently does not supported {self.settings.arch}. Contributions are welcomed") + if self.options.cxx and Version(self.version) < "2.5.1": + if self.options.shared and self.settings.os == "Windows": + raise ConanInvalidConfiguration( + "A shared libmpdec++ is not possible on Windows (due to non-exportable thread local storage)") + + def build_requirements(self): + 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) + + def generate(self): + if is_msvc(self): + vcvars = VCVars(self) + vcvars.generate() + + deps = NMakeDeps(self) + deps.generate() + + tc = NMakeToolchain(self) + if Version(self.version) >= "2.5.1": + if self.options.shared: + tc.extra_cflags.append("-DMPDECIMAL_DLL") + if self.options.cxx: + tc.extra_cxxflags.append("-DLIBMPDECXX_DLL") + tc.generate() + else: + # 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") + + tc = AutotoolsToolchain(self) + tc.configure_args.append("--enable-cxx" if self.options.cxx else "--disable-cxx") + tc_env = tc.environment() + tc_env.append("LDXXFLAGS", ["$LDFLAGS"]) + tc.generate(tc_env) + + @property + def _dist_folder(self): + vcbuild_folder = self.build_path / "vcbuild" + arch_ext = "32" if self.settings.arch == "x86" else "64" + return vcbuild_folder / f"dist{arch_ext}" + + def _build_msvc(self): + libmpdec_folder = self.source_path / "libmpdec" + libmpdecpp_folder = self.source_path / "libmpdec++" + + copy(self, "Makefile.vc", libmpdec_folder, self.build_path) + rename(self, self.build_path / "Makefile.vc", libmpdec_folder / "Makefile") + + mpdec_target = "libmpdec-{}.{}".format(self.version, "dll" if self.options.shared else "lib") + mpdecpp_target = "libmpdec++-{}.{}".format(self.version, "dll" if self.options.shared else "lib") + + builds = [[libmpdec_folder, mpdec_target]] + if self.options.cxx: + builds.append([libmpdecpp_folder, mpdecpp_target]) + + for build_dir, target in builds: + with chdir(self, build_dir): + self.run("""nmake -f Makefile.vc {target} MACHINE={machine} DEBUG={debug} DLL={dll}""".format( + target=target, + machine={"x86": "ppro", "x86_64": "x64"}[str(self.settings.arch)], + # FIXME: else, use ansi32 and ansi64 + debug="1" if self.settings.build_type == "Debug" else "0", + dll="1" if self.options.shared else "0", + )) + + dist_folder = self._dist_folder + mkdir(self, dist_folder) + copy(self, "mpdecimal.h", libmpdec_folder, dist_folder) + if self.options.shared: + copy(self, f"libmpdec-{self.version}.dll", libmpdec_folder, dist_folder) + copy(self, f"libmpdec-{self.version}.dll.lib", libmpdec_folder, dist_folder) + else: + copy(self, f"libmpdec-{self.version}.lib", libmpdec_folder, dist_folder) + if self.options.cxx: + if self.options.shared: + copy(self, f"libmpdec++-{self.version}.dll", libmpdecpp_folder, dist_folder) + copy(self, f"libmpdec++-{self.version}.dll.lib", libmpdecpp_folder, dist_folder) + else: + copy(self, f"libmpdec++-{self.version}.lib", libmpdecpp_folder, dist_folder) + copy(self, "decimal.hh", libmpdecpp_folder, dist_folder) + + @property + def _shared_suffix(self): + if is_apple_os(self): + return ".dylib" + return { + "Windows": ".dll", + }.get(str(self.settings.os), ".so") + + @property + def _target_names(self): + libsuffix = self._shared_suffix if self.options.shared else ".a" + versionsuffix = f".{self.version}" if self.options.shared else "" + suffix = ( + f"{versionsuffix}{libsuffix}" + if is_apple_os(self) or self.settings.os == "Windows" + else f"{libsuffix}{versionsuffix}" + ) + return f"libmpdec{suffix}", f"libmpdec++{suffix}" + + def build(self): + apply_conandata_patches(self) + if is_msvc(self): + self._build_msvc() + else: + autotools = Autotools(self) + autotools.configure() + # self.output.info(load(self, pathlib.Path("libmpdec", "Makefile"))) + libmpdec, libmpdecpp = self._target_names + copy(self, "*", self.source_path / "libmpdec", self.build_path / "libmpdec") + with chdir(self, "libmpdec"): + autotools.make(target=libmpdec) + if self.options.cxx: + copy(self, "*", self.source_path / "libmpdec++", self.build_path / "libmpdec++") + with chdir(self, "libmpdec++"): + autotools.make(target=libmpdecpp) + + def package(self): + pkg_dir = self.package_path + copy(self, "LICENSE.txt", src=self.source_folder, dst=pkg_dir / "licenses") + if is_msvc(self): + distfolder = self._dist_folder + copy(self, "vc*.h", src=self.source_path / "libmpdec", dst=pkg_dir / "include") + copy(self, "*.h", src=distfolder, dst=pkg_dir / "include") + if self.options.cxx: + copy(self, "*.hh", src=distfolder, dst=pkg_dir / "include") + copy(self, "*.lib", src=distfolder, dst=pkg_dir / "lib") + copy(self, "*.dll", src=distfolder, dst=pkg_dir / "bin") + else: + mpdecdir = self.build_path / "libmpdec" + mpdecppdir = self.build_path / "libmpdec++" + copy(self, "mpdecimal.h", src=mpdecdir, dst=pkg_dir / "include") + if self.options.cxx: + copy(self, "decimal.hh", src=self.source_path / "libmpdec++", dst=pkg_dir / "include") + builddirs = [mpdecdir] + if self.options.cxx: + builddirs.append(mpdecppdir) + for builddir in builddirs: + copy(self, "*.a", src=builddir, dst=pkg_dir / "lib") + copy(self, "*.so", src=builddir, dst=pkg_dir / "lib") + copy(self, "*.so.*", src=builddir, dst=pkg_dir / "lib") + copy(self, "*.dylib", src=builddir, dst=pkg_dir / "lib") + copy(self, "*.dll", src=builddir, dst=pkg_dir / "bin") + + def package_info(self): + lib_pre_suf = ("", "") + if is_msvc(self): + if self.options.shared: + lib_pre_suf = ("lib", f"-{self.version}.dll") + else: + lib_pre_suf = ("lib", f"-{self.version}") + elif self.settings.os == "Windows": + if self.options.shared: + lib_pre_suf = ("", ".dll") + + self.cpp_info.components["libmpdecimal"].libs = ["{}mpdec{}".format(*lib_pre_suf)] + if self.options.shared and is_msvc(self): + if Version(self.version) >= "2.5.1": + self.cpp_info.components["libmpdecimal"].defines = ["MPDECIMAL_DLL"] + else: + self.cpp_info.components["libmpdecimal"].defines = ["USE_DLL"] + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["libmpdecimal"].system_libs = ["m"] + + if self.options.cxx: + self.cpp_info.components["libmpdecimal++"].libs = ["{}mpdec++{}".format(*lib_pre_suf)] + self.cpp_info.components["libmpdecimal++"].requires = ["libmpdecimal"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["libmpdecimal++"].system_libs = ["pthread"] + if self.options.shared and Version(self.version) >= "2.5.1": + self.cpp_info.components["libmpdecimal++"].defines = ["MPDECIMALXX_DLL"] diff --git a/recipes/mpdecimal/2.5.x/patches/0001-2.5.0-msvc-fixes.patch b/recipes/mpdecimal/all/patches/0001-2.5.0-msvc-fixes.patch similarity index 100% rename from recipes/mpdecimal/2.5.x/patches/0001-2.5.0-msvc-fixes.patch rename to recipes/mpdecimal/all/patches/0001-2.5.0-msvc-fixes.patch diff --git a/recipes/mpdecimal/2.5.x/patches/0002-add-mingw-to-configure-ac.patch b/recipes/mpdecimal/all/patches/0002-add-mingw-to-configure-ac.patch similarity index 100% rename from recipes/mpdecimal/2.5.x/patches/0002-add-mingw-to-configure-ac.patch rename to recipes/mpdecimal/all/patches/0002-add-mingw-to-configure-ac.patch diff --git a/recipes/mpdecimal/2.5.x/patches/2.5.1-0001-msvc-fixes.patch b/recipes/mpdecimal/all/patches/2.5.1-0001-msvc-fixes.patch similarity index 100% rename from recipes/mpdecimal/2.5.x/patches/2.5.1-0001-msvc-fixes.patch rename to recipes/mpdecimal/all/patches/2.5.1-0001-msvc-fixes.patch diff --git a/recipes/mpdecimal/2.5.x/patches/2.5.1-0002-add-mingw-to-configure-ac.patch b/recipes/mpdecimal/all/patches/2.5.1-0002-add-mingw-to-configure-ac.patch similarity index 100% rename from recipes/mpdecimal/2.5.x/patches/2.5.1-0002-add-mingw-to-configure-ac.patch rename to recipes/mpdecimal/all/patches/2.5.1-0002-add-mingw-to-configure-ac.patch diff --git a/recipes/mpdecimal/2.5.x/patches/2.5.1-0003-use-MPDECIMAL_DLL.patch b/recipes/mpdecimal/all/patches/2.5.1-0003-use-MPDECIMAL_DLL.patch similarity index 100% rename from recipes/mpdecimal/2.5.x/patches/2.5.1-0003-use-MPDECIMAL_DLL.patch rename to recipes/mpdecimal/all/patches/2.5.1-0003-use-MPDECIMAL_DLL.patch diff --git a/recipes/mpdecimal/all/patches/4.0.0-0001-msvc-fixes.patch b/recipes/mpdecimal/all/patches/4.0.0-0001-msvc-fixes.patch new file mode 100644 index 0000000000000..aa95ccd087f71 --- /dev/null +++ b/recipes/mpdecimal/all/patches/4.0.0-0001-msvc-fixes.patch @@ -0,0 +1,97 @@ +diff --git a/libmpdec++/Makefile.vc b/libmpdec++/Makefile.vc +index 5985c33..bc2bdac 100644 +--- a/libmpdec++/Makefile.vc ++++ b/libmpdec++/Makefile.vc +@@ -14,11 +14,11 @@ LIBIMPORT_CXX = libmpdec++-4.0.0.dll.lib + LIBSHARED_CXX = libmpdec++-4.0.0.dll + + !if "$(DEBUG)" == "1" +-OPT = /MTd /Od /Zi /EHsc +-OPT_SHARED = /MDd /Od /Zi /EHsc ++OPT = /Od /Zi /EHsc ++OPT_SHARED = /Od /Zi /EHsc + !else +-OPT = /MT /O2 /GS /EHsc /DNDEBUG +-OPT_SHARED = /MD /O2 /GS /EHsc /DNDEBUG ++OPT = /O2 /GS /EHsc /DNDEBUG ++OPT_SHARED = /O2 /GS /EHsc /DNDEBUG + !endif + + !if "$(CC)" == "clang-cl" +@@ -27,9 +27,9 @@ WARN = /W4 -Wno-undefined-inline + WARN = /W4 + !endif + +-MPD_CXXFLAGS = $(WARN) /nologo $(OPT) +-MPD_CXXFLAGS_SHARED = /DBUILD_LIBMPDECXX $(WARN) /nologo $(OPT_SHARED) $(PGOFLAGS) +-MPD_BIN_CXXFLAGS_SHARED = $(WARN) /nologo $(OPT_SHARED) $(PGOFLAGS) ++MPD_CXXFLAGS = $(WARN) /nologo $(OPT) $(CONAN_CXXFLAGS) $(CONAN_CFLAGS) ++MPD_CXXFLAGS_SHARED = /DBUILD_LIBMPDECXX $(WARN) /nologo $(OPT_SHARED) $(PGOFLAGS) $(CONAN_LDFLAGS) ++MPD_BIN_CXXFLAGS_SHARED = $(WARN) /nologo $(OPT_SHARED) $(PGOFLAGS) $(CONAN_LDFLAGS) + + MPD_LDXXFLAGS= /DLL /MANIFEST $(LDXXFLAGS) + +@@ -42,22 +42,22 @@ OBJS = decimal.obj + SHARED_OBJS = .objs\decimal.obj + + +-$(LIBSTATIC_CXX): Makefile $(OBJS) ++$(LIBSTATIC_CXX): Makefile.vc $(OBJS) + -@if exist $@ del $(LIBSTATIC_CXX) + lib /out:$(LIBSTATIC_CXX) $(OBJS) + +-$(LIBSHARED_CXX): Makefile $(SHARED_OBJS) ++$(LIBSHARED_CXX): Makefile.vc $(SHARED_OBJS) + -@if exist $@ del $(LIBSHARED_CXX) + link $(MPD_LDXXFLAGS) /out:$(LIBSHARED_CXX) /implib:$(LIBIMPORT_CXX) /LIBPATH:$(SRCDIR) $(SHARED_OBJS) $(LIBIMPORT) + mt -manifest $(LIBSHARED_CXX).manifest -outputresource:$(LIBSHARED_CXX);2 + + + decimal.obj:\ +-Makefile decimal.cc ..\libmpdec\mpdecimal.h decimal.hh ++Makefile.vc decimal.cc ..\libmpdec\mpdecimal.h decimal.hh + $(CXX) "-I." "-I$(SRCDIR)" $(MPD_CXXFLAGS) -c decimal.cc + + .objs\decimal.obj:\ +-Makefile decimal.cc ..\libmpdec\mpdecimal.h decimal.hh ++Makefile.vc decimal.cc ..\libmpdec\mpdecimal.h decimal.hh + $(CXX) "-I." "-I$(SRCDIR)" $(MPD_CXXFLAGS_SHARED) -c decimal.cc /Fo.objs\decimal.obj + + +diff --git a/libmpdec/Makefile.vc b/libmpdec/Makefile.vc +index 7f72a4b..2ee3ddb 100644 +--- a/libmpdec/Makefile.vc ++++ b/libmpdec/Makefile.vc +@@ -31,11 +31,11 @@ CONFIG = /DCONFIG_32 /DANSI + !endif + + !if "$(DEBUG)" == "1" +-OPT = /MTd /Od /Zi /EHsc +-OPT_SHARED = /MDd /Od /Zi /EHsc ++OPT = /Od /Zi /EHsc ++OPT_SHARED = /Od /Zi /EHsc + !else +-OPT = /MT /O2 /GS /EHsc /DNDEBUG +-OPT_SHARED = /MD /O2 /GS /EHsc /DNDEBUG ++OPT = /O2 /GS /EHsc /DNDEBUG ++OPT_SHARED = /O2 /GS /EHsc /DNDEBUG + !endif + + !if "$(CC)" == "clang-cl" +@@ -44,13 +44,13 @@ WARN = /W4 /wd4200 /wd4204 /wd4221 -Wno-unknown-pragmas -Wno-undefined-inline /D + WARN = /W4 /wd4200 /wd4204 /wd4221 /D_CRT_SECURE_NO_WARNINGS + !endif + +-MPD_CFLAGS = $(WARN) /nologo $(CONFIG) $(OPT) +-MPD_CFLAGS_SHARED = /DBUILD_LIBMPDEC $(WARN) /nologo $(CONFIG) $(OPT_SHARED) $(PGOFLAGS) ++MPD_CFLAGS = $(WARN) /nologo $(CONFIG) $(OPT) $(CONAN_CFLAGS) ++MPD_CFLAGS_SHARED = /DBUILD_LIBMPDEC $(WARN) /nologo $(CONFIG) $(OPT_SHARED) $(PGOFLAGS) $(CONAN_CFLAGS) + + MPD_BIN_CFLAGS = $(WARN) /nologo $(OPT) + MPD_BIN_CFLAGS_SHARED = $(WARN) /nologo $(OPT_SHARED) $(PGOFLAGS) + +-MPD_LDFLAGS= /DLL /MANIFEST $(LDFLAGS) ++MPD_LDFLAGS= /DLL /MANIFEST $(LDFLAGS) $(CONAN_LDFLAGS) + + + default: $(LIBSTATIC) $(LIBSHARED) diff --git a/recipes/mpdecimal/all/patches/4.0.0-0003-use-MPDECIMAL_DLL.patch b/recipes/mpdecimal/all/patches/4.0.0-0003-use-MPDECIMAL_DLL.patch new file mode 100644 index 0000000000000..eaef16aab1800 --- /dev/null +++ b/recipes/mpdecimal/all/patches/4.0.0-0003-use-MPDECIMAL_DLL.patch @@ -0,0 +1,39 @@ +diff --git a/libmpdec++/decimal.hh b/libmpdec++/decimal.hh +index 9040290..5e057cb 100644 +--- a/libmpdec++/decimal.hh ++++ b/libmpdec++/decimal.hh +@@ -58,7 +58,7 @@ + #ifdef _MSC_VER + #if defined (BUILD_LIBMPDECXX) + #define IMPORTEXPORT __declspec(dllexport) +- #elif defined(_DLL) ++ #elif defined(MPDECIMAL_DLL) + #define IMPORTEXPORT __declspec(dllimport) + #else + #define IMPORTEXPORT +diff --git a/libmpdec/mpdecimal32vc.h b/libmpdec/mpdecimal32vc.h +index 6a35951..43e5631 100644 +--- a/libmpdec/mpdecimal32vc.h ++++ b/libmpdec/mpdecimal32vc.h +@@ -59,7 +59,7 @@ extern "C" { + #if defined (BUILD_LIBMPDEC) + #undef IMPORTEXPORT + #define IMPORTEXPORT __declspec(dllexport) +-#elif defined(_DLL) ++#elif defined(MPDECIMAL_DLL) + #undef IMPORTEXPORT + #define IMPORTEXPORT __declspec(dllimport) + #endif +diff --git a/libmpdec/mpdecimal64vc.h b/libmpdec/mpdecimal64vc.h +index 9320176..a9944fc 100644 +--- a/libmpdec/mpdecimal64vc.h ++++ b/libmpdec/mpdecimal64vc.h +@@ -59,7 +59,7 @@ extern "C" { + #if defined (BUILD_LIBMPDEC) + #undef IMPORTEXPORT + #define IMPORTEXPORT __declspec(dllexport) +-#elif defined(_DLL) ++#elif defined(MPDECIMAL_DLL) + #undef IMPORTEXPORT + #define IMPORTEXPORT __declspec(dllimport) + #endif diff --git a/recipes/mpdecimal/all/test_package/CMakeLists.txt b/recipes/mpdecimal/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..fd62443b2dbe5 --- /dev/null +++ b/recipes/mpdecimal/all/test_package/CMakeLists.txt @@ -0,0 +1,18 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX C) + +enable_testing() + +# This is a non-official mpdecimal module! +find_package(mpdecimal REQUIRED) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE mpdecimal::libmpdecimal) +add_test(NAME test_package COMMAND test_package 10 13) + +if(TARGET mpdecimal::libmpdecimal++) + add_executable(${PROJECT_NAME}_cpp test_package.cpp) + set_propertY(TARGET ${PROJECT_NAME}_cpp PROPERTY CXX_STANDARD 11) + target_link_libraries(${PROJECT_NAME}_cpp PRIVATE mpdecimal::libmpdecimal++) + add_test(NAME test_package_cpp COMMAND test_package_cpp 10 13) +endif() diff --git a/recipes/mpdecimal/all/test_package/conanfile.py b/recipes/mpdecimal/all/test_package/conanfile.py new file mode 100644 index 0000000000000..24cabf72b9327 --- /dev/null +++ b/recipes/mpdecimal/all/test_package/conanfile.py @@ -0,0 +1,24 @@ +from conan import ConanFile +from conan.tools.cmake import CMake, cmake_layout +from conan.tools.build import can_run, build_jobs + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + 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): + self.run(f"ctest --output-on-failure -C {self.settings.build_type} -j {build_jobs(self)}", env="conanrun") diff --git a/recipes/mpdecimal/2.5.x/test_package/test_package.c b/recipes/mpdecimal/all/test_package/test_package.c similarity index 100% rename from recipes/mpdecimal/2.5.x/test_package/test_package.c rename to recipes/mpdecimal/all/test_package/test_package.c diff --git a/recipes/mpdecimal/2.5.x/test_package/test_package.cpp b/recipes/mpdecimal/all/test_package/test_package.cpp similarity index 100% rename from recipes/mpdecimal/2.5.x/test_package/test_package.cpp rename to recipes/mpdecimal/all/test_package/test_package.cpp diff --git a/recipes/mpdecimal/all/test_v1_package/CMakeLists.txt b/recipes/mpdecimal/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..4c6b75fcc1914 --- /dev/null +++ b/recipes/mpdecimal/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.15) +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/mpdecimal/all/test_v1_package/conanfile.py b/recipes/mpdecimal/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..9f63e99aff76f --- /dev/null +++ b/recipes/mpdecimal/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +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.definitions["MPDECIMAL_CXX"] = self.options["mpdecimal"].cxx + 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/mpdecimal/config.yml b/recipes/mpdecimal/config.yml index 24b096a4ce8a6..713582dc93cec 100644 --- a/recipes/mpdecimal/config.yml +++ b/recipes/mpdecimal/config.yml @@ -1,7 +1,9 @@ versions: + "4.0.0": + folder: "all" "2.5.1": - folder: "2.5.x" + folder: "all" "2.5.0": - folder: "2.5.x" + folder: "all" "2.4.2": folder: "2.4.2" diff --git a/recipes/mpfr/all/CMakeLists.txt.in b/recipes/mpfr/all/CMakeLists.txt.in index 53ae087a53626..d9812e3e8e5cf 100644 --- a/recipes/mpfr/all/CMakeLists.txt.in +++ b/recipes/mpfr/all/CMakeLists.txt.in @@ -1,15 +1,14 @@ -cmake_minimum_required(VERSION 2.8.11) +cmake_minimum_required(VERSION 3.19) project(cmake_wrapper) -include("${{CMAKE_BINARY_DIR}}/conanbuildinfo.cmake") -conan_basic_setup() - # autotools project does not allow building a shared mpfr library (because of libtool limitation) +find_package(gmp REQUIRED CONFIG) + add_library(mpfr {mpfr_sources}) target_compile_definitions(mpfr PRIVATE {definitions}) -target_include_directories(mpfr PRIVATE "${{CMAKE_BINARY_DIR}}" "${{CMAKE_BINARY_DIR}}/src" "${{CMAKE_CURRENT_SOURCE_DIR}}") -target_link_libraries(mpfr PRIVATE ${{CONAN_LIBS}}) +target_include_directories(mpfr PRIVATE "${{CMAKE_BINARY_DIR}}" "${{CMAKE_BINARY_DIR}}/src" "${{CMAKE_CURRENT_SOURCE_DIR}}/src") +target_link_libraries(mpfr PRIVATE gmp::gmp) if(BUILD_SHARED_LIBS) target_compile_definitions(mpfr PRIVATE MPFR_DLL) endif() diff --git a/recipes/mpfr/all/conandata.yml b/recipes/mpfr/all/conandata.yml index 8d5358c6e2d5b..afd84455cac46 100644 --- a/recipes/mpfr/all/conandata.yml +++ b/recipes/mpfr/all/conandata.yml @@ -1,18 +1,30 @@ sources: + "4.2.1": + url: "https://ftp.gnu.org/gnu/mpfr/mpfr-4.2.1.tar.xz" + sha256: "277807353a6726978996945af13e52829e3abd7a9a5b7fb2793894e18f1fcbb2" + "4.2.0": + url: "https://ftp.gnu.org/gnu/mpfr/mpfr-4.2.0.tar.xz" + sha256: "06a378df13501248c1b2db5aa977a2c8126ae849a9d9b7be2546fb4a9c26d993" "4.1.0": - sha256: 3127fe813218f3a1f0adf4e8899de23df33b4cf4b4b3831a5314f78e65ffa2d6 - url: https://ftp.gnu.org/gnu/mpfr/mpfr-4.1.0.tar.gz + url: "https://ftp.gnu.org/gnu/mpfr/mpfr-4.1.0.tar.xz" + sha256: "0c98a3f1732ff6ca4ea690552079da9c597872d30e96ec28414ee23c95558a7f" "4.0.2": - sha256: ae26cace63a498f07047a784cd3b0e4d010b44d2b193bab82af693de57a19a78 - url: https://ftp.gnu.org/gnu/mpfr/mpfr-4.0.2.tar.gz + url: "https://ftp.gnu.org/gnu/mpfr/mpfr-4.0.2.tar.xz" + sha256: "1d3be708604eae0e42d578ba93b390c2a145f17743a744d8f3f8c2ad5855a38a" patches: + "4.2.1": + - patch_file: "patches/4.2.0-0002-windows-header-dll.patch" + patch_description: "Windows header DLL" + patch_type: "portability" + "4.2.0": + - patch_file: "patches/4.2.0-0002-windows-header-dll.patch" + patch_description: "Windows header DLL" + patch_type: "portability" "4.1.0": - - base_path: "source_subfolder" - patch_file: "patches/4.1.0-0001-windows-allow-mixed-shared-static.patch" - - base_path: "source_subfolder" - patch_file: "patches/4.1.0-0002-windows-header-dll.patch" + - patch_file: "patches/4.1.0-0002-windows-header-dll.patch" + patch_description: "Windows header DLL" + patch_type: "portability" "4.0.2": - - base_path: "source_subfolder" - patch_file: "patches/4.0.2-0001-windows-allow-mixed-shared-static.patch" - - base_path: "source_subfolder" - patch_file: "patches/4.0.2-0002-windows-header-dll.patch" + - patch_file: "patches/4.0.2-0002-windows-header-dll.patch" + patch_description: "Windows header DLL" + patch_type: "portability" diff --git a/recipes/mpfr/all/conanfile.py b/recipes/mpfr/all/conanfile.py index ebf83bf0baf23..77727bc0de638 100644 --- a/recipes/mpfr/all/conanfile.py +++ b/recipes/mpfr/all/conanfile.py @@ -1,26 +1,38 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, CMake, tools -from conans.errors import ConanException -import contextlib import os import re import shlex -required_conan_version = ">=1.33.0" +from conan import ConanFile +from conan.errors import ConanException +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.build import cross_building +from conan.tools.cmake import CMakeToolchain, CMakeDeps, CMake, cmake_layout +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import ( + apply_conandata_patches, copy, export_conandata_patches, get, load, + 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, check_min_vs, unix_path + +required_conan_version = ">=1.58.0" class MpfrConan(ConanFile): name = "mpfr" description = "The MPFR library is a C library for multiple-precision floating-point computations with " \ "correct rounding" - topics = ("mpfr", "multiprecision", "math", "mathematics") + license = "LGPL-3.0-or-later" url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.mpfr.org/" - license = "LGPL-3.0-or-later" + topics = ("multiprecision", "math", "mathematics") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], - "exact_int": ["mpir", "gmp",] + "exact_int": ["mpir", "gmp"], } default_options = { "shared": False, @@ -28,149 +40,157 @@ class MpfrConan(ConanFile): "exact_int": "gmp", } - exports_sources = "CMakeLists.txt.in", "patches/**" - generators = "cmake" - - _autotools = None - _cmake = 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): + copy(self, "CMakeLists.txt.in", 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 + 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 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.exact_int == "gmp": - self.requires("gmp/6.2.1") + self.requires("gmp/6.3.0", transitive_headers=True) elif self.options.exact_int == "mpir": self.requires("mpir/3.0.0") 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) - yes_no = lambda v: "yes" if v else "no" - args = [ - "--enable-thread-safe", - "--with-gmp-include={}".format(tools.unix_path(os.path.join(self.deps_cpp_info[str(self.options.exact_int)].rootpath, "include"))), - "--with-gmp-lib={}".format(tools.unix_path(os.path.join(self.deps_cpp_info[str(self.options.exact_int)].rootpath, "lib"))), - "--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) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") + if self.settings.os == "Windows": + if is_msvc(self) and not check_min_vs(self, 193, raise_invalid=False) and \ + not self.conf.get("tools.cmake.cmaketoolchain:generator", check_type=str): + # 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() + else: # Even with multiple toolchains (see below), can only have one "deps" generator as multiple ones will collide + tc = AutotoolsDeps(self) + tc.generate() + + # Setup autotools on all platforms because we need to run autotools.configure when using CMake + tc = AutotoolsToolchain(self) + tc.configure_args.append("--enable-thread-safe") + tc.configure_args.append(f'--with-gmp={unix_path(self, self.dependencies[str(self.options.exact_int)].package_folder)}') if self.settings.compiler == "clang": # warning: optimization flag '-ffloat-store' is not supported - args.append("mpfr_cv_gcc_floatconv_bug=no") + tc.configure_args.append("mpfr_cv_gcc_floatconv_bug=no") if self.settings.arch == "x86": # fatal error: error in backend: Unsupported library call operation! - args.append("--disable-float128") + tc.configure_args.append("--disable-float128") + if self.options.exact_int == "mpir": - self._autotools.include_paths.append(self.build_folder) - if self.settings.compiler == "Visual Studio": - self._autotools.flags.append("-FS") - self._autotools.libs = [] - self._autotools.configure(args=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.configure(source_dir=os.path.join(self._source_subfolder, "src")) - return self._cmake + tc.extra_cflags.append(f"-I{self.build_folder}") + if is_msvc(self) and check_min_vs(self, "180", raise_invalid=False): + tc.extra_cflags.append("-FS") + + env = tc.environment() + if is_msvc(self): + env.define("CC", "cl -nologo") + env.define("CXX", "cl -nologo") + tc.generate(env) # Create conanbuild.conf def _extract_makefile_variable(self, makefile, variable): - makefile_contents = tools.load(makefile) - match = re.search("{}[ \t]*=[ \t]*((?:(?:[a-zA-Z0-9 \t.=/_-])|(?:\\\\\"))*(?:\\\\\n(?:(?:[a-zA-Z0-9 \t.=/_-])|(?:\\\"))*)*)\n".format(variable), makefile_contents) + makefile_contents = load(self, makefile) + match = re.search(f'{variable}[ \t]*=[ \t]*((?:(?:[a-zA-Z0-9 \t.=/_-])|(?:\\\\\"))*(?:\\\\\n(?:(?:[a-zA-Z0-9 \t.=/_-])|(?:\\\"))*)*)\n', makefile_contents) if not match: - raise ConanException("Cannot extract variable {} from {}".format(variable, makefile_contents)) + raise ConanException(f"Cannot extract variable {variable} from {makefile_contents}") lines = [line.strip(" \t\\") for line in match.group(1).split()] return [item for line in lines for item in shlex.split(line) if item] def _extract_mpfr_autotools_variables(self): - makefile_am = os.path.join(self._source_subfolder, "src", "Makefile.am") + makefile_am = os.path.join(self.source_folder, "src", "Makefile.am") # src/src/Makefile.am makefile = os.path.join("src", "Makefile") sources = self._extract_makefile_variable(makefile_am, "libmpfr_la_SOURCES") headers = self._extract_makefile_variable(makefile_am, "include_HEADERS") defs = self._extract_makefile_variable(makefile, "DEFS") return sources, headers, defs - @contextlib.contextmanager - def _build_context(self): - if self.settings.compiler == "Visual Studio": - with tools.vcvars(self): - env = { - "AR": "lib", - "CC": "cl -nologo", - "CXX": "cl -nologo", - "LD": "link", - "NM": "dumpbin -symbols", - "OBJDUMP": ":", - "RANLIB": ":", - "STRIP": ":", - } - with tools.environment_append(env): - yield - else: - yield + def _patch_sources(self): + apply_conandata_patches(self) + if self.settings.os == "Windows": # Allow mixed shared and static libs + replace_in_file(self, os.path.join(self.source_folder, "configure"), + 'as_fn_error $? "libgmp isn\'t provided as a DLL: use --enable-static --disable-shared" "$LINENO" 5', + '# as_fn_error $? "libgmp isn\'t provided as a DLL: use --enable-static --disable-shared" "$LINENO" 5') + replace_in_file(self, os.path.join(self.source_folder, "configure"), + 'as_fn_error $? "libgmp is provided as a DLL: use --disable-static --enable-shared" "$LINENO" 5', + '# as_fn_error $? "libgmp is provided as a DLL: use --disable-static --enable-shared" "$LINENO" 5') - def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) if self.options.exact_int == "mpir": - tools.replace_in_file(os.path.join(self._source_subfolder, "configure"), + replace_in_file(self, os.path.join(self.source_folder, "configure"), "-lgmp", "-lmpir") - tools.replace_in_file(os.path.join(self._source_subfolder, "src", "mpfr.h"), + replace_in_file(self, os.path.join(self.source_folder, "src", "mpfr.h"), "", "") - tools.save("gmp.h", "#pragma once\n#include \n") - with self._build_context(): - autotools = self._configure_autotools() + save(self, "gmp.h", "#pragma once\n#include \n") + + def build(self): + self._patch_sources() + autotools = Autotools(self) + autotools.configure() # Need to generate Makefile to extract variables for CMake below + if self.settings.os == "Windows": - cmakelists_in = tools.load("CMakeLists.txt.in") + cmakelists_in = load(self, os.path.join(self.export_sources_folder, "CMakeLists.txt.in")) sources, headers, definitions = self._extract_mpfr_autotools_variables() - tools.save(os.path.join(self._source_subfolder, "src", "CMakeLists.txt"), cmakelists_in.format( + sources = ["src/" + src for src in sources] + headers = ["src/" + hdr for hdr in headers] + save(self, os.path.join(self.source_folder, "CMakeLists.txt"), cmakelists_in.format( mpfr_sources=" ".join(sources), mpfr_headers=" ".join(headers), definitions=" ".join(definitions), )) - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() else: autotools.make(args=["V=0"]) def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) + copy(self, "COPYING.LESSER", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) if self.settings.os == "Windows": - cmake = self._configure_cmake() + cmake = CMake(self) cmake.install() else: - autotools = self._configure_autotools() + autotools = Autotools(self) autotools.install() - os.unlink(os.path.join(self.package_folder, "lib", "libmpfr.la")) - 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")) + 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", "mpfr") self.cpp_info.libs = ["mpfr"] if self.settings.os == "Windows" and self.options.shared: self.cpp_info.defines = ["MPFR_DLL"] diff --git a/recipes/mpfr/all/patches/4.0.2-0001-windows-allow-mixed-shared-static.patch b/recipes/mpfr/all/patches/4.0.2-0001-windows-allow-mixed-shared-static.patch deleted file mode 100644 index 49ef48c13e1bd..0000000000000 --- a/recipes/mpfr/all/patches/4.0.2-0001-windows-allow-mixed-shared-static.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- configure -+++ configure -@@ -16982,7 +16982,7 @@ - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: static" >&5 - $as_echo "static" >&6; } -- as_fn_error $? "libgmp isn't provided as a DLL: use --enable-static --disable-shared" "$LINENO" 5 -+ # as_fn_error $? "libgmp isn't provided as a DLL: use --enable-static --disable-shared" "$LINENO" 5 - fi - rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - else -@@ -17010,7 +17010,7 @@ - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: DLL" >&5 - $as_echo "DLL" >&6; } -- as_fn_error $? "libgmp is provided as a DLL: use --disable-static --enable-shared" "$LINENO" 5 -+ # as_fn_error $? "libgmp is provided as a DLL: use --disable-static --enable-shared" "$LINENO" 5 - fi - rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - diff --git a/recipes/mpfr/all/patches/4.1.0-0001-windows-allow-mixed-shared-static.patch b/recipes/mpfr/all/patches/4.1.0-0001-windows-allow-mixed-shared-static.patch deleted file mode 100644 index 9d6c892b32673..0000000000000 --- a/recipes/mpfr/all/patches/4.1.0-0001-windows-allow-mixed-shared-static.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- configure -+++ configure -@@ -17533,7 +17533,7 @@ - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: static" >&5 - $as_echo "static" >&6; } -- as_fn_error $? "libgmp isn't provided as a DLL: use --enable-static --disable-shared" "$LINENO" 5 -+ # as_fn_error $? "libgmp isn't provided as a DLL: use --enable-static --disable-shared" "$LINENO" 5 - fi - rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - else -@@ -17561,7 +17561,7 @@ - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: DLL" >&5 - $as_echo "DLL" >&6; } -- as_fn_error $? "libgmp is provided as a DLL: use --disable-static --enable-shared" "$LINENO" 5 -+ # as_fn_error $? "libgmp is provided as a DLL: use --disable-static --enable-shared" "$LINENO" 5 - fi - rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi diff --git a/recipes/mpfr/all/patches/4.2.0-0002-windows-header-dll.patch b/recipes/mpfr/all/patches/4.2.0-0002-windows-header-dll.patch new file mode 100644 index 0000000000000..8bd309400c5a6 --- /dev/null +++ b/recipes/mpfr/all/patches/4.2.0-0002-windows-header-dll.patch @@ -0,0 +1,27 @@ +--- src/mpfr.h ++++ src/mpfr.h +@@ -319,16 +319,15 @@ + # endif + #endif + +-/* Support for WINDOWS Dll: +- Check if we are inside a MPFR build, and if so export the functions. +- Otherwise does the same thing as GMP */ +-#if defined(__MPFR_WITHIN_MPFR) && __GMP_LIBGMP_DLL +-# define __MPFR_DECLSPEC __GMP_DECLSPEC_EXPORT +-#else +-# ifndef __GMP_DECLSPEC +-# define __GMP_DECLSPEC ++/* Support for WINDOWS Dll */ ++#if defined(MPFR_DLL) ++# if defined(__MPFR_WITHIN_MPFR) ++# define __MPFR_DECLSPEC __GMP_DECLSPEC_EXPORT ++# else ++# define __MPFR_DECLSPEC __GMP_DECLSPEC_IMPORT + # endif +-# define __MPFR_DECLSPEC __GMP_DECLSPEC ++#else ++# define __MPFR_DECLSPEC + #endif + + /* Use MPFR_DEPRECATED to mark MPFR functions, types or variables as diff --git a/recipes/mpfr/all/test_package/CMakeLists.txt b/recipes/mpfr/all/test_package/CMakeLists.txt index b37af695804dd..734c455f60d09 100644 --- a/recipes/mpfr/all/test_package/CMakeLists.txt +++ b/recipes/mpfr/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ -cmake_minimum_required(VERSION 3.3.0) -project(test_package C) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup() +find_package(mpfr REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE mpfr::mpfr) diff --git a/recipes/mpfr/all/test_package/conanfile.py b/recipes/mpfr/all/test_package/conanfile.py index d4128b0450777..862d248f1946f 100644 --- a/recipes/mpfr/all/test_package/conanfile.py +++ b/recipes/mpfr/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" + 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/mpfr/all/test_v1_package/CMakeLists.txt b/recipes/mpfr/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/mpfr/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/mpfr/all/test_v1_package/conanfile.py b/recipes/mpfr/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..49a3a66ea5bad --- /dev/null +++ b/recipes/mpfr/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/mpfr/config.yml b/recipes/mpfr/config.yml index 72132855c0cf8..f3d9d2b90378d 100644 --- a/recipes/mpfr/config.yml +++ b/recipes/mpfr/config.yml @@ -1,4 +1,8 @@ versions: + "4.2.1": + folder: all + "4.2.0": + folder: all "4.1.0": folder: all "4.0.2": 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..a4d19cd12463a 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,171 @@ 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.10") 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/2.0.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"] + # The finite-math-only optimization has no effect and will cause linking errors + # when linked against glibc >= 2.31 + tc.extra_cflags += ["-fno-finite-math-only"] + 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"] + if self.settings.arch in ["x86", "x86_64"]: + self.cpp_info.components["libsyn123"].system_libs = ["mvec"] elif self.settings.os == "Windows": self.cpp_info.components["libmpg123"].system_libs = ["shlwapi"] @@ -200,6 +226,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/mpir/all/conandata.yml b/recipes/mpir/all/conandata.yml index c5a67d7b84dca..815ad473b44e7 100644 --- a/recipes/mpir/all/conandata.yml +++ b/recipes/mpir/all/conandata.yml @@ -1,4 +1,10 @@ sources: "3.0.0": - url: "http://mpir.org/mpir-3.0.0.zip" - sha256: "6277d3cc36ff39c98e4d4cc17b46b5a6ff42a22d30a4130b2d49255f98dd8c1f" + url: "https://github.com/wbhart/mpir/archive/refs/tags/mpir-3.0.0.tar.gz" + sha256: "86a5039badc3e6738219a262873a1db5513405e15ece9527b718fcd0fac09bb2" +patches: + "3.0.0": + - patch_file: "patches/fix_xcode_12_configure.patch" + patch_type: "backport" + patch_source: https://github.com/wbhart/mpir/commit/bbc43ca6ae0bec4f64e69c9cd4c967005d6470eb + patch_description: "Fix warnings (turned to errors) that causes XCode 12+ configure to fail" diff --git a/recipes/mpir/all/conanfile.py b/recipes/mpir/all/conanfile.py index 3c6c16a085f0b..d9ae778b935b2 100644 --- a/recipes/mpir/all/conanfile.py +++ b/recipes/mpir/all/conanfile.py @@ -1,26 +1,28 @@ +import os + from conan import ConanFile -from conan.tools.microsoft import msvc_runtime_flag, is_msvc -from conan.tools.build import cross_building -from conan.tools.files import get, copy, replace_in_file, chdir, rmdir, rm -from conan.tools.scm import Version -from conans import tools, AutoToolsBuildEnvironment, MSBuild from conan.errors import ConanInvalidConfiguration -import contextlib -import os +from conan.tools.apple import XCRun, to_apple_arch +from conan.tools.build import cross_building +from conan.tools.env import VirtualBuildEnv +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 +from conan.tools.layout import basic_layout +from conan.tools.microsoft import MSBuild, MSBuildToolchain, is_msvc, is_msvc_static_runtime, msvc_runtime_flag + +required_conan_version = ">=1.53.0" -required_conan_version = ">=1.50.0" class MpirConan(ConanFile): name = "mpir" - description = "MPIR is a highly optimised library for bignum arithmetic" \ - "forked from the GMP bignum library." - topics = ("mpir", "multiprecision", "math", "mathematics") - url = "https://github.com/conan-io/conan-center-index" - homepage = "http://mpir.org/" + description = ("MPIR is a highly optimised library for bignum arithmetic " + "forked from the GMP bignum library.") license = "LGPL-3.0-or-later" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/wbhart/mpir" + topics = ("multiprecision", "math", "mathematics") - provides = [] - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -35,45 +37,84 @@ class MpirConan(ConanFile): "enable_gmpcompat": 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: - del self.options.fPIC + self.options.rm_safe("fPIC") if is_msvc(self) and self.options.shared: del self.options.enable_cxx if not self.options.get_safe("enable_cxx", False): - 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.enable_gmpcompat: - self.provides.append("gmp") + self.provides = ["gmp"] + + def layout(self): + basic_layout(self, src_folder="src") def validate(self): if hasattr(self, "settings_build") and cross_building(self, skip_x64_x86=True): raise ConanInvalidConfiguration("Cross-building doesn't work (yet)") def build_requirements(self): + self.tool_requires("libtool/2.4.7") self.tool_requires("yasm/1.3.0") if not is_msvc(self): self.tool_requires("m4/1.4.19") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.tool_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): - get(self, keep_permissions=True, **self.conan_data["sources"][self.version], - strip_root=True, destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True, keep_permissions=True) + + def _generate_msvc(self): + env = VirtualBuildEnv(self) + env.generate() + tc = MSBuildToolchain(self) + tc.generate() + + def _generate_autotools(self): + env = VirtualBuildEnv(self) + env.generate() + + tc = AutotoolsToolchain(self) + tc.configure_args.append("--disable-silent-rules") + tc.configure_args.append("--enable-cxx" if self.options.get_safe("enable_cxx") else "--disable-cxx") + tc.configure_args.append("--enable-gmpcompat" if self.options.enable_gmpcompat else "--disable-gmpcompat") + + # compiler checks are written for C89 but compilers that default to C99 treat implicit functions as error + tc.extra_cxxflags.append("-Wno-implicit-function-declaration") + + if self.settings.compiler == "apple-clang": + if hasattr(self, "settings_build"): + # there is no CFLAGS_FOR_BUILD/CXXFLAGS_FOR_BUILD + sdk_path = XCRun(self).sdk_path + tc.extra_cxxflags += [ + "-Wno-implicit-function-declaration", + "-isysroot", sdk_path, + "-arch", to_apple_arch(self), + ] + # Disable docs + tc.make_args.append("MAKEINFO=true") + tc.generate() + + def generate(self): + if is_msvc(self): + self._generate_msvc() + else: + self._generate_autotools() @property def _platforms(self): @@ -83,75 +124,41 @@ def _platforms(self): def _dll_or_lib(self): return "dll" if self.options.shared else "lib" + @property + def _vs_ide_version(self): + if str(self.settings.compiler) == "Visual Studio": + return self.settings.compiler.version + msvc_to_ide = {"170": "11", "180": "12", "190": "14", "191": "15", "192": "16", "193": "17"} + return msvc_to_ide.get(str(self.settings.compiler.version), "17") + @property def _vcxproj_paths(self): - compiler_version = self.settings.compiler.version if Version(self.settings.compiler.version) <= "17" else "17" - build_subdir = "build.vc{}".format(compiler_version) + build_subdir = f"build.vc{self._vs_ide_version}" vcxproj_paths = [ - os.path.join(self._source_subfolder, build_subdir, - "{}_mpir_gc".format(self._dll_or_lib), - "{}_mpir_gc.vcxproj".format(self._dll_or_lib)) + os.path.join(self.source_folder, build_subdir, f"{self._dll_or_lib}_mpir_gc", f"{self._dll_or_lib}_mpir_gc.vcxproj") ] if self.options.get_safe("enable_cxx"): - vcxproj_paths.append(os.path.join(self._source_subfolder, build_subdir, + vcxproj_paths.append(os.path.join(self.source_folder, build_subdir, "lib_mpir_cxx", "lib_mpir_cxx.vcxproj")) return vcxproj_paths - def _build_visual_studio(self): - if not self.options.shared: # RuntimeLibrary only defined in lib props files + def _build_msvc(self): + if not self.options.shared: # RuntimeLibrary only defined in lib props files build_type = "debug" if self.settings.build_type == "Debug" else "release" - props_path = os.path.join(self._source_subfolder, "build.vc", - "mpir_{}_lib.props".format(build_type)) - old_runtime = "MultiThreaded{}".format( - "Debug" if build_type == "debug" else "", - ) + props_path = os.path.join(self.source_folder, "build.vc", f"mpir_{build_type}_lib.props") + old_runtime = "MultiThreaded{}".format("Debug" if build_type == "debug" else "") new_runtime = "MultiThreaded{}{}".format( "Debug" if "d" in msvc_runtime_flag(self) else "", - "DLL" if "MD" in msvc_runtime_flag(self) else "", + "DLL" if not is_msvc_static_runtime(self) else "", ) replace_in_file(self, props_path, old_runtime, new_runtime) msbuild = MSBuild(self) for vcxproj_path in self._vcxproj_paths: - msbuild.build(vcxproj_path, platforms=self._platforms, upgrade_project=False) - - @contextlib.contextmanager - def _build_context(self): - if self.settings.compiler == "apple-clang": - env_build = {"CC": tools.XCRun(self.settings).cc, - "CXX": tools.XCRun(self.settings).cxx} - if hasattr(self, "settings_build"): - # there is no CFLAGS_FOR_BUILD/CXXFLAGS_FOR_BUILD - xcrun = tools.XCRun(self.settings_build) - flags = " -Wno-implicit-function-declaration -isysroot {} -arch {}".format(xcrun.sdk_path, tools.to_apple_arch(self.settings_build.arch)) - env_build["CC_FOR_BUILD"] = xcrun.cc + flags - env_build["CXX_FOR_BUILD"] = xcrun.cxx + flags - with tools.environment_append(env_build): - yield - else: - yield - - def _configure_autotools(self): - if not 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"]) - args.append("--with-pic" if self.options.get_safe("fPIC", True) else "--without-pic") - - args.append("--disable-silent-rules") - args.append("--enable-cxx" if self.options.get_safe("enable_cxx") else "--disable-cxx") - args.append("--enable-gmpcompat" if self.options.enable_gmpcompat else "--disable-gmpcompat") - - # compiler checks are written for C89 but compilers that default to C99 treat implicit functions as error - self._autotools.flags.append("-Wno-implicit-function-declaration") - self._autotools.configure(args=args) - return self._autotools + msbuild.build(vcxproj_path) def _patch_new_msvc_version(self, ver, toolset): - new_dir = os.path.join(self._source_subfolder, f'build.vc{ver}') - copy(self, pattern="*", src=os.path.join(self._source_subfolder, 'build.vc15'), dst=new_dir) + new_dir = os.path.join(self.source_folder, f"build.vc{ver}") + copy(self, pattern="*", src=os.path.join(self.source_folder, "build.vc15"), dst=new_dir) for root, _, files in os.walk(new_dir): for file in files: @@ -167,6 +174,7 @@ def _patch_new_msvc_version(self, ver, toolset): replace_in_file(self, full_file, 'check_config $(Platform) $(Configuration) 15', f'check_config $(Platform) $(Configuration) {ver}', strict=False) def _patch_sources(self): + apply_conandata_patches(self) if is_msvc(self): self._patch_new_msvc_version(16, "v142") self._patch_new_msvc_version(17, "v143") @@ -174,20 +182,25 @@ def _patch_sources(self): def build(self): self._patch_sources() if is_msvc(self): - self._build_visual_studio() + self._build_msvc() else: - with chdir(self, self._source_subfolder), self._build_context(): + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.autoreconf() # relocatable shared lib on macOS replace_in_file(self, "configure", "-install_name \\$rpath/", "-install_name @rpath/") - autotools = self._configure_autotools() + autotools.configure() autotools.make() def package(self): - copy(self, "COPYING*", dst=os.path.join(self.package_folder, "licenses"), src=os.path.join(self.source_folder, self._source_subfolder)) + copy(self, "COPYING*", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) if is_msvc(self): - lib_folder = os.path.join(self.build_folder, self._source_subfolder, self._dll_or_lib, - self._platforms.get(str(self.settings.arch)), - str(self.settings.build_type)) + lib_folder = os.path.join( + self.source_folder, + self._dll_or_lib, + self._platforms.get(str(self.settings.arch)), + str(self.settings.build_type), + ) include_folder = os.path.join(self.package_folder, "include") copy(self, "mpir.h", dst=include_folder, src=lib_folder, keep_path=True) if self.options.enable_gmpcompat: @@ -196,11 +209,11 @@ def package(self): copy(self, "mpirxx.h", dst=include_folder, src=lib_folder, keep_path=True) if self.options.enable_gmpcompat: copy(self, "gmpxx.h", dst=include_folder, src=lib_folder, keep_path=True) - copy(self, pattern="*.dll*", dst=os.path.join(self.package_folder, "bin"), src=lib_folder, keep_path=False) - copy(self, pattern="*.lib", dst=os.path.join(self.package_folder, "lib"), src=lib_folder, keep_path=False) + copy(self, "*.dll*", dst=os.path.join(self.package_folder, "bin"), src=lib_folder, keep_path=False) + copy(self, "*.lib", dst=os.path.join(self.package_folder, "lib"), src=lib_folder, keep_path=False) else: - with chdir(self, self._source_subfolder), self._build_context(): - autotools = self._configure_autotools() + with chdir(self, self.source_folder): + autotools = Autotools(self) autotools.install() rmdir(self, os.path.join(self.package_folder, "share")) rm(self, "*.la", os.path.join(self.package_folder, "lib")) diff --git a/recipes/mpir/all/patches/fix_xcode_12_configure.patch b/recipes/mpir/all/patches/fix_xcode_12_configure.patch new file mode 100644 index 0000000000000..13454c5f7d321 --- /dev/null +++ b/recipes/mpir/all/patches/fix_xcode_12_configure.patch @@ -0,0 +1,113 @@ +From bbc43ca6ae0bec4f64e69c9cd4c967005d6470eb Mon Sep 17 00:00:00 2001 +From: Mitchell Blank Jr +Date: Mon, 21 Dec 2020 12:05:19 +0000 +Subject: [PATCH] Fix configure failures with Xcode12 + +Changes are needed becuase Xcode12 includes a default of +-Werror,-Wimplicit-function-declaration which means that +even something like calling "exit(0);" is a compile failure +if you haven't done a "#include " first (as C99 +requires, but most other compilers will just warn about) + +I don't know if the "long long reliability test 2" test which +tries to provoke a crash on a particular gcc 3.3 build still +does what it was originally intended to do with my change. +Of course, I doubt anyone has tried to use that compiler in +years. + +Fixes #290 +--- + acinclude.m4 | 24 +++++++++++++----------- + 1 file changed, 13 insertions(+), 11 deletions(-) + +diff --git a/acinclude.m4 b/acinclude.m4 +index 91c35bc23..620a629ef 100644 +--- a/acinclude.m4 ++++ b/acinclude.m4 +@@ -589,9 +589,9 @@ extern + #endif + __inline__ t1 e(t2 rp,t2 up,int n,t1 v0) + {t1 c,x,r;int i;if(v0){c=1;for(i=1;iconftest.c <conftest.c < + int + main () + { +- exit(0); ++ return 0; + } + double d; + double diff --git a/recipes/mpir/all/test_package/CMakeLists.txt b/recipes/mpir/all/test_package/CMakeLists.txt index d64654ce1f75a..532d088505a3e 100644 --- a/recipes/mpir/all/test_package/CMakeLists.txt +++ b/recipes/mpir/all/test_package/CMakeLists.txt @@ -1,10 +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) - -find_package(mpir CONFIG REQUIRED) +find_package(mpir REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} mpir::mpir) diff --git a/recipes/mpir/all/test_package/conanfile.py b/recipes/mpir/all/test_package/conanfile.py index 2490acfa82ff8..ef5d7042163ec 100644 --- a/recipes/mpir/all/test_package/conanfile.py +++ b/recipes/mpir/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/mpir/all/test_v1_package/CMakeLists.txt b/recipes/mpir/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/mpir/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/mpir/all/test_v1_package/conanfile.py b/recipes/mpir/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..2490acfa82ff8 --- /dev/null +++ b/recipes/mpir/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/mpmcqueue/all/conanfile.py b/recipes/mpmcqueue/all/conanfile.py index f31d795bc0cc2..956244df07486 100644 --- a/recipes/mpmcqueue/all/conanfile.py +++ b/recipes/mpmcqueue/all/conanfile.py @@ -13,12 +13,16 @@ class MpmcqueueConan(ConanFile): name = "mpmcqueue" description = "A bounded multi-producer multi-consumer concurrent queue written in C++11." license = "MIT" - topics = ("mpmcqueue", "queue", "concurrency") + topics = ("queue", "concurrency") homepage = "https://github.com/rigtorp/MPMCQueue" url = "https://github.com/conan-io/conan-center-index" + package_type = "header-library" 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() @@ -28,12 +32,8 @@ def validate(self): if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "5": raise ConanInvalidConfiguration("gcc < 5 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def build(self): pass @@ -46,9 +46,7 @@ def package_info(self): self.cpp_info.set_property("cmake_file_name", "MPMCQueue") self.cpp_info.set_property("cmake_target_name", "MPMCQueue::MPMCQueue") 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"] = "MPMCQueue" diff --git a/recipes/mpmcqueue/all/test_package/conanfile.py b/recipes/mpmcqueue/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/mpmcqueue/all/test_package/conanfile.py +++ b/recipes/mpmcqueue/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/mpmcqueue/all/test_v1_package/CMakeLists.txt b/recipes/mpmcqueue/all/test_v1_package/CMakeLists.txt index e299736630b60..b21cc49efde95 100644 --- a/recipes/mpmcqueue/all/test_v1_package/CMakeLists.txt +++ b/recipes/mpmcqueue/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.15) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(MPMCQueue REQUIRED CONFIG) -find_package(Threads REQUIRED) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE MPMCQueue::MPMCQueue Threads::Threads) -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/mppp/all/conandata.yml b/recipes/mppp/all/conandata.yml index 9e4f3e0e2fcbe..65c8b63bf0804 100644 --- a/recipes/mppp/all/conandata.yml +++ b/recipes/mppp/all/conandata.yml @@ -1,16 +1,52 @@ sources: + "1.0.3": + url: "https://github.com/bluescarni/mppp/archive/v1.0.3.tar.gz" + sha256: "d5beb0002910de4ea96dc15dc0d80d759afeb2c5e68716523d519d66a7dfe423" + "1.0.2": + url: "https://github.com/bluescarni/mppp/archive/v1.0.2.tar.gz" + sha256: "2a537bc339726388fdda39905692d3df92fceee51d264e720e0e7ab7570bcdaf" + "1.0.0": + url: "https://github.com/bluescarni/mppp/archive/v1.0.0.tar.gz" + sha256: "e58b1a5fb8bdf095261eeb0861c3f46f96c71c4b043d19700e73ce3e4e639268" "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: + "1.0.3": + - patch_file: "patches/1.0.3-0001-disable-warning-error.patch" + patch_description: "disable the flag for treats warning as errors" + patch_type: "portability" + - patch_file: "patches/1.0.3-0002-remove-fmt-version.patch" + # https://github.com/conan-io/conan/issues/14172 + patch_description: "remove fmt version number from find_package" + patch_type: "conan" + "1.0.2": + - patch_file: "patches/1.0.0-0001-disable-warning-error.patch" + patch_description: "disable the flag for treats warning as errors" + patch_type: "portability" + - patch_file: "patches/1.0.0-0002-remove-fmt-version.patch" + # https://github.com/conan-io/conan/issues/14172 + patch_description: "remove fmt version number from find_package" + patch_type: "conan" + "1.0.0": + - patch_file: "patches/1.0.0-0001-disable-warning-error.patch" + patch_description: "disable the flag for treats warning as errors" + patch_type: "portability" + - patch_file: "patches/1.0.0-0002-remove-fmt-version.patch" + # https://github.com/conan-io/conan/issues/14172 + patch_description: "remove fmt version number from find_package" + patch_type: "conan" "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" + - patch_file: "patches/0.27-0002-remove-fmt-version.patch" + # https://github.com/conan-io/conan/issues/14172 + patch_description: "remove fmt version number from find_package" + patch_type: "conan" "0.26": - patch_file: "patches/0.26-0001-disable-warning-error.patch" patch_description: "disable the flag for treats warning as errors" diff --git a/recipes/mppp/all/conanfile.py b/recipes/mppp/all/conanfile.py index b81c5b84c795c..9510faa71b6c8 100644 --- a/recipes/mppp/all/conanfile.py +++ b/recipes/mppp/all/conanfile.py @@ -1,13 +1,14 @@ 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.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir +from conan.tools.microsoft import is_msvc_static_runtime +from conan.tools.scm import Version import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class MpppConan(ConanFile): name = "mppp" @@ -16,6 +17,7 @@ class MpppConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/bluescarni/mppp/" topics = ("multiprecision", "gmp", "math-bignum", "computer-algebra") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -25,6 +27,7 @@ class MpppConan(ConanFile): "with_mpc": [True, False], "with_quadmath": [True, False], "with_boost": [True, False], + "with_fmt": [True, False], } default_options = { "shared": False, @@ -34,10 +37,11 @@ class MpppConan(ConanFile): "with_mpc": False, "with_quadmath": False, "with_boost": False, + "with_fmt": False, } @property - def _minimum_cpp_standard(self): + def _min_cppstd(self): return 11 def export_sources(self): @@ -49,35 +53,36 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + 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") - if self.options.with_mpfr == True: - self.requires("mpfr/4.1.0") - if self.options.with_mpc == True: + self.requires("gmp/6.3.0", transitive_headers=True) + if self.options.with_mpfr: + self.requires("mpfr/4.2.0") + if self.options.with_mpc: self.requires("mpc/1.2.0") - if self.options.with_boost == True: - self.requires("boost/1.80.0") + if self.options.with_boost: + self.requires("boost/1.83.0") + if self.options.get_safe("with_fmt"): + self.requires("fmt/10.2.1", transitive_headers=True) def validate(self): if self.settings.compiler.get_safe("cppstd"): - check_min_cppstd(self, self._minimum_cpp_standard) + check_min_cppstd(self, self._min_cppstd) if self.options.with_arb: 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(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(f"{self.name}:with_boost=True requires boost::without_serialization=False") + 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.dependencies["boost"].options.without_serialization: + raise ConanInvalidConfiguration(f"{self.ref}:with_boost=True requires boost:without_serialization=False") 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) @@ -88,10 +93,11 @@ def generate(self): 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: tc.variables["MPPP_BUILD_STATIC_LIBRARY_WITH_DYNAMIC_MSVC_RUNTIME"] = not is_msvc_static_runtime(self) tc.generate() - deps = CMakeDeps(self) deps.generate() @@ -115,6 +121,9 @@ def package_info(self): 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.27-0002-remove-fmt-version.patch b/recipes/mppp/all/patches/0.27-0002-remove-fmt-version.patch new file mode 100644 index 0000000000000..28109b89756fd --- /dev/null +++ b/recipes/mppp/all/patches/0.27-0002-remove-fmt-version.patch @@ -0,0 +1,15 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 22e275f..1a97423 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -414,9 +414,8 @@ endif() + + # NOTE: need at least version 6.2 + # to print 128-bit integers. +-set(_MPPP_MIN_FMT_VERSION "6.2") + if(MPPP_WITH_FMT) +- find_package(fmt ${_MPPP_MIN_FMT_VERSION} REQUIRED CONFIG) ++ find_package(fmt REQUIRED CONFIG) + message(STATUS "fmt version: ${fmt_VERSION}") + target_link_libraries(mp++ PUBLIC fmt::fmt) + endif() diff --git a/recipes/mppp/all/patches/1.0.0-0001-disable-warning-error.patch b/recipes/mppp/all/patches/1.0.0-0001-disable-warning-error.patch new file mode 100644 index 0000000000000..20284714ba410 --- /dev/null +++ b/recipes/mppp/all/patches/1.0.0-0001-disable-warning-error.patch @@ -0,0 +1,22 @@ +diff --git a/cmake/yacma/YACMACompilerLinkerSettings.cmake b/cmake/yacma/YACMACompilerLinkerSettings.cmake +index edafe6d..218dc1c 100644 +--- a/cmake/yacma/YACMACompilerLinkerSettings.cmake ++++ b/cmake/yacma/YACMACompilerLinkerSettings.cmake +@@ -95,7 +95,7 @@ if(NOT _YACMACompilerLinkerSettingsRun) + # 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") ++# 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) +@@ -191,7 +191,7 @@ if(NOT _YACMACompilerLinkerSettingsRun) + # Enable higher warning level than usual. + _YACMA_CHECK_ENABLE_DEBUG_CXX_FLAG(/W4) + # Treat warnings as errors. +- _YACMA_CHECK_ENABLE_DEBUG_CXX_FLAG(/WX) ++# _YACMA_CHECK_ENABLE_DEBUG_CXX_FLAG(/WX) + endif() + + # Set the cache variables. diff --git a/recipes/mppp/all/patches/1.0.0-0002-remove-fmt-version.patch b/recipes/mppp/all/patches/1.0.0-0002-remove-fmt-version.patch new file mode 100644 index 0000000000000..b05a5e6c9a442 --- /dev/null +++ b/recipes/mppp/all/patches/1.0.0-0002-remove-fmt-version.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 5cea04c..81337b2 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -419,7 +419,7 @@ endif() + # to print 128-bit integers. + set(_MPPP_MIN_FMT_VERSION "6.2") + if(MPPP_WITH_FMT) +- find_package(fmt ${_MPPP_MIN_FMT_VERSION} REQUIRED CONFIG) ++ find_package(fmt REQUIRED CONFIG) + message(STATUS "fmt version: ${fmt_VERSION}") + target_link_libraries(mp++ PUBLIC fmt::fmt) + endif() diff --git a/recipes/mppp/all/patches/1.0.3-0001-disable-warning-error.patch b/recipes/mppp/all/patches/1.0.3-0001-disable-warning-error.patch new file mode 100644 index 0000000000000..2bbd6313a54a7 --- /dev/null +++ b/recipes/mppp/all/patches/1.0.3-0001-disable-warning-error.patch @@ -0,0 +1,22 @@ +diff --git a/cmake/yacma/YACMACompilerLinkerSettings.cmake b/cmake/yacma/YACMACompilerLinkerSettings.cmake +index 3d9cd9d..2b8cf7b 100644 +--- a/cmake/yacma/YACMACompilerLinkerSettings.cmake ++++ b/cmake/yacma/YACMACompilerLinkerSettings.cmake +@@ -96,7 +96,7 @@ if(NOT _YACMACompilerLinkerSettingsRun) + # 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") ++ # 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) +@@ -197,7 +197,7 @@ if(NOT _YACMACompilerLinkerSettingsRun) + # Enable higher warning level than usual. + _YACMA_CHECK_ENABLE_DEBUG_CXX_FLAG(/W4) + # Treat warnings as errors. +- _YACMA_CHECK_ENABLE_DEBUG_CXX_FLAG(/WX) ++ #_YACMA_CHECK_ENABLE_DEBUG_CXX_FLAG(/WX) + endif() + + # Set the cache variables. diff --git a/recipes/mppp/all/patches/1.0.3-0002-remove-fmt-version.patch b/recipes/mppp/all/patches/1.0.3-0002-remove-fmt-version.patch new file mode 100644 index 0000000000000..33106dff23d74 --- /dev/null +++ b/recipes/mppp/all/patches/1.0.3-0002-remove-fmt-version.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 6fd31fe..503cedf 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -430,7 +430,7 @@ endif() + # to print 128-bit integers. + set(_MPPP_MIN_FMT_VERSION "6.2") + if(MPPP_WITH_FMT) +- find_package(fmt ${_MPPP_MIN_FMT_VERSION} REQUIRED CONFIG) ++ find_package(fmt REQUIRED CONFIG) + message(STATUS "fmt version: ${fmt_VERSION}") + target_link_libraries(mp++ PUBLIC fmt::fmt) + endif() diff --git a/recipes/mppp/config.yml b/recipes/mppp/config.yml index d4d8ae20a50d8..518666119a0f9 100644 --- a/recipes/mppp/config.yml +++ b/recipes/mppp/config.yml @@ -1,4 +1,10 @@ versions: + "1.0.3": + folder: all + "1.0.2": + folder: all + "1.0.0": + folder: all "0.27": folder: all "0.26": diff --git a/recipes/ms-gsl/all/conandata.yml b/recipes/ms-gsl/all/conandata.yml index 00aab19c60dba..3469e0134c7e0 100644 --- a/recipes/ms-gsl/all/conandata.yml +++ b/recipes/ms-gsl/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "4.1.0": + url: "https://github.com/microsoft/GSL/archive/v4.1.0.tar.gz" + sha256: "0a227fc9c8e0bf25115f401b9a46c2a68cd28f299d24ab195284eb3f1d7794bd" "4.0.0": url: "https://github.com/microsoft/GSL/archive/v4.0.0.tar.gz" sha256: "f0e32cb10654fea91ad56bde89170d78cfbf4363ee0b01d8f097de2ba49f6ce9" diff --git a/recipes/ms-gsl/all/conanfile.py b/recipes/ms-gsl/all/conanfile.py index 1f2447a4480af..e4e94a29cb26c 100644 --- a/recipes/ms-gsl/all/conanfile.py +++ b/recipes/ms-gsl/all/conanfile.py @@ -5,7 +5,6 @@ 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 check_min_vs, is_msvc from conan.tools.scm import Version required_conan_version = ">=1.50.0" @@ -14,11 +13,11 @@ class MicrosoftGslConan(ConanFile): name = "ms-gsl" description = "Microsoft's implementation of the Guidelines Support Library" + license = "MIT" 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 + topics = ("gsl", "guidelines", "core", "span", "header-only") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" options = { "on_contract_violation": ["terminate", "throw", "unenforced"] @@ -26,6 +25,7 @@ class MicrosoftGslConan(ConanFile): default_options = { "on_contract_violation": "terminate" } + no_copy_source = True @property def _minimum_cpp_standard(self): @@ -45,6 +45,8 @@ def _compilers_minimum_version(self): "gcc": "5", "clang": "3.4", "apple-clang": "3.4", + "msvc": "190", + "Visual Studio": "14", } def config_options(self): @@ -58,24 +60,17 @@ def validate(self): if self.settings.compiler.cppstd: check_min_cppstd(self, self._minimum_cpp_standard) - check_min_vs(self, "190") - - if not is_msvc(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( - f"{self.ref} requires C++{self._minimum_cpp_standard}, which your compiler does not fully support.") - else: - self.output.warn(f"{self.ref} requires C++{self._minimum_cpp_standard}. " - "Your compiler is unknown. Assuming it supports C++{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 fully 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): pass @@ -90,16 +85,21 @@ def package(self): def package_info(self): self.cpp_info.set_property("cmake_file_name", "Microsoft.GSL") self.cpp_info.set_property("cmake_target_name", "Microsoft.GSL::GSL") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] - self.cpp_info.filenames["cmake_find_package"] = "Microsoft.GSL" - self.cpp_info.filenames["cmake_find_package_multi"] = "Microsoft.GSL" + # TODO: back to global scope once support for legacy generators dropped + if Version(self.version) < "3.0.0": + self.cpp_info.components["_ms-gsl"].defines = [ + self._contract_map[str(self.options.on_contract_violation)] + ] + + # TODO: to remove once support for legacy generators dropped self.cpp_info.names["cmake_find_package"] = "Microsoft.GSL" self.cpp_info.names["cmake_find_package_multi"] = "Microsoft.GSL" self.cpp_info.components["_ms-gsl"].names["cmake_find_package"] = "GSL" self.cpp_info.components["_ms-gsl"].names["cmake_find_package_multi"] = "GSL" - - if Version(self.version) < "3.0.0": - self.cpp_info.components["_ms-gsl"].defines = [ - self._contract_map[str(self.options.on_contract_violation)] - ] + self.cpp_info.components["_ms-gsl"].set_property("cmake_target_name", "Microsoft.GSL::GSL") + self.cpp_info.components["_ms-gsl"].bindirs = [] + self.cpp_info.components["_ms-gsl"].libdirs = [] diff --git a/recipes/ms-gsl/config.yml b/recipes/ms-gsl/config.yml index b00b1020b4e16..9d7804e501efd 100644 --- a/recipes/ms-gsl/config.yml +++ b/recipes/ms-gsl/config.yml @@ -1,4 +1,6 @@ versions: + "4.1.0": + folder: all "4.0.0": folder: all "3.1.0": diff --git a/recipes/msdf-atlas-gen/all/CMakeLists.txt b/recipes/msdf-atlas-gen/all/CMakeLists.txt deleted file mode 100644 index 39b22c5320bd6..0000000000000 --- a/recipes/msdf-atlas-gen/all/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -cmake_minimum_required(VERSION 3.10) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -find_package(msdfgen REQUIRED) - -add_subdirectory(source_subfolder) - diff --git a/recipes/msdf-atlas-gen/all/conandata.yml b/recipes/msdf-atlas-gen/all/conandata.yml index 20e043a17e6cd..3ce2299e54ce1 100644 --- a/recipes/msdf-atlas-gen/all/conandata.yml +++ b/recipes/msdf-atlas-gen/all/conandata.yml @@ -1,4 +1,16 @@ sources: + "1.3": + url: "https://github.com/Chlumsky/msdf-atlas-gen/archive/refs/tags/v1.3.tar.gz" + sha256: "5d3d58e8bc92836baf23ce3a80ef79cc4c2d022fb86b7f160b11cc06cd62fe78" "1.2.2": url: "https://github.com/Chlumsky/msdf-atlas-gen/archive/refs/tags/v1.2.2.tar.gz" sha256: "7D2EA46F66E21AB9A205BF7703D520F209B9A035EE13CBB266A3B8322F62FA28" +patches: + "1.3": + - patch_file: "patches/1.3.0-0001-fix-cmake.patch" + patch_description: "Fix CMakeLists.txt to get libraries from Conan and install in bin dir" + patch_type: "conan" + "1.2.2": + - patch_file: "patches/1.2.2-0001-fix-cmake.patch" + patch_description: "Fix CMakeLists.txt to get libraries from Conan and install in bin dir" + patch_type: "conan" diff --git a/recipes/msdf-atlas-gen/all/conanfile.py b/recipes/msdf-atlas-gen/all/conanfile.py index a6c7d8b9a0b2a..d26eb8ef19f91 100644 --- a/recipes/msdf-atlas-gen/all/conanfile.py +++ b/recipes/msdf-atlas-gen/all/conanfile.py @@ -1,71 +1,86 @@ -from conans import ConanFile, CMake, tools import os -required_conan_version = ">=1.33.0" +from conan import ConanFile +from conan.tools.files import get, copy, apply_conandata_patches, export_conandata_patches, 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 +from conan.tools.microsoft import is_msvc + +required_conan_version = ">=1.53.0" class MsdfAtlasGenConan(ConanFile): name = "msdf-atlas-gen" + description = "MSDF font atlas generator" license = "MIT" - homepage = "https://github.com/Chlumsky/msdf-atlas-gen" url = "https://github.com/conan-io/conan-center-index" - description = "MSDF font atlas generator" + homepage = "https://github.com/Chlumsky/msdf-atlas-gen" topics = ("msdf-atlas-gen", "msdf", "font", "atlas") + package_type = "application" settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" - exports_sources = ["CMakeLists.txt"] - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + export_conandata_patches(self) - def requirements(self): - self.requires("artery-font-format/1.0") - self.requires("msdfgen/1.9.1") + def layout(self): + cmake_layout(self, src_folder="src") - def validate(self): + def validate_build(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) + check_min_cppstd(self, 11) + + def requirements(self): + if Version(self.version) < "1.3": + self.requires("msdfgen/1.9.1") + self.requires("artery-font-format/1.0") + self.requires("lodepng/cci.20200615") + else: + self.requires("msdfgen/1.12") + self.requires("artery-font-format/1.1") + self.requires("libpng/[>=1.6 <2]") def package_id(self): del self.info.settings.compiler + del self.info.settings.build_type def source(self): - tools.get(**self.conan_data["sources"][self.version], - strip_root=True, destination=self._source_subfolder) - - def _patch_sources(self): - cmakelists = os.path.join( - self._source_subfolder, "CMakeLists.txt") - - tools.replace_in_file(cmakelists, - "add_subdirectory(msdfgen)", "") - tools.save_append(cmakelists, - "install(TARGETS msdf-atlas-gen-standalone DESTINATION bin)") - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["MSDF_ATLAS_GEN_BUILD_STANDALONE"] = True - self._cmake.configure() - return self._cmake + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["MSDF_ATLAS_GEN_BUILD_STANDALONE"] = True + tc.cache_variables["MSDF_ATLAS_USE_VCPKG"] = False + tc.cache_variables["MSDF_ATLAS_USE_SKIA"] = False + tc.cache_variables["MSDF_ATLAS_NO_ARTERY_FONT"] = False + tc.cache_variables["MSDF_ATLAS_MSDFGEN_EXTERNAL"] = True + tc.cache_variables["MSDF_ATLAS_INSTALL"] = True + if Version(self.version) >= "1.3": + tc.preprocessor_definitions["MSDFGEN_USE_LIBPNG"] = 1 + if is_msvc(self): + tc.cache_variables["MSDF_ATLAS_DYNAMIC_RUNTIME"] = "dynamic" in str(self.settings.compiler.runtime) or "MD" in str(self.settings.compiler.runtime) + 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 package(self): - self.copy("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() + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): + self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] + 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) + # 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/msdf-atlas-gen/all/patches/1.2.2-0001-fix-cmake.patch b/recipes/msdf-atlas-gen/all/patches/1.2.2-0001-fix-cmake.patch new file mode 100644 index 0000000000000..f4f985352e174 --- /dev/null +++ b/recipes/msdf-atlas-gen/all/patches/1.2.2-0001-fix-cmake.patch @@ -0,0 +1,53 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index b1ec605..6b6277a 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -7,10 +7,11 @@ set(MSDFGEN_BUILD_MSDFGEN_STANDALONE OFF CACHE BOOL "Build the msdfgen standalon + set(MSDFGEN_USE_OPENMP OFF CACHE INTERNAL "Build with OpenMP support for multithreaded code (disabled for atlas gen)" FORCE) + set(MSDFGEN_USE_CPP11 ON CACHE INTERNAL "Build with C++11 enabled (always enabled for atlas gen)" FORCE) + set(MSDFGEN_INSTALL OFF CACHE BOOL "Generate installation target for msdfgen") +-add_subdirectory(msdfgen) +- ++# add_subdirectory(msdfgen) + find_package(Threads REQUIRED) +- ++find_package(msdfgen REQUIRED) ++find_package(artery-font-format REQUIRED) ++find_package(lodepng REQUIRED CONFIG) + file(GLOB_RECURSE msdf-atlas-gen_HEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} + "msdf-atlas-gen/*.h" + "msdf-atlas-gen/*.hpp" +@@ -24,19 +25,19 @@ file(GLOB_RECURSE msdf-atlas-gen_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} + add_library(msdf-atlas-gen ${msdf-atlas-gen_SOURCES} ${msdf-atlas-gen_HEADERS}) + add_library(msdf-atlas-gen::msdf-atlas-gen ALIAS msdf-atlas-gen) + set_target_properties(msdf-atlas-gen PROPERTIES PUBLIC_HEADER "${msdf-atlas-gen_HEADERS}") +-target_include_directories(msdf-atlas-gen +-INTERFACE +- $ +-PRIVATE +- ${CMAKE_CURRENT_SOURCE_DIR}/msdfgen/include # for lodepng.h +- ${CMAKE_CURRENT_SOURCE_DIR}/artery-font-format +-) ++# target_include_directories(msdf-atlas-gen ++# INTERFACE ++# $ ++# PRIVATE ++# ${CMAKE_CURRENT_SOURCE_DIR}/msdfgen/include # for lodepng.h ++# ${CMAKE_CURRENT_SOURCE_DIR}/artery-font-format ++# ) + + if (MSVC) + target_compile_definitions(msdf-atlas-gen PUBLIC _CRT_SECURE_NO_WARNINGS) + endif() + target_compile_features(msdf-atlas-gen PUBLIC cxx_std_11) +-target_link_libraries(msdf-atlas-gen PUBLIC Threads::Threads msdfgen::msdfgen msdfgen::msdfgen-ext) ++target_link_libraries(msdf-atlas-gen PUBLIC Threads::Threads msdfgen::msdfgen msdfgen::msdfgen-ext artery-font-format::artery-font-format lodepng::lodepng) + + # TODO make these public in msdfgen so that this doesn't have to be repeated here + if(FREETYPE_WITH_PNG) +@@ -58,3 +59,5 @@ if(MSDF_ATLAS_GEN_BUILD_STANDALONE) + target_compile_features(msdf-atlas-gen-standalone PUBLIC cxx_std_11) + target_link_libraries(msdf-atlas-gen-standalone PUBLIC msdf-atlas-gen::msdf-atlas-gen) + endif() ++ ++install(TARGETS msdf-atlas-gen-standalone DESTINATION bin) diff --git a/recipes/msdf-atlas-gen/all/patches/1.3.0-0001-fix-cmake.patch b/recipes/msdf-atlas-gen/all/patches/1.3.0-0001-fix-cmake.patch new file mode 100644 index 0000000000000..80d3825982383 --- /dev/null +++ b/recipes/msdf-atlas-gen/all/patches/1.3.0-0001-fix-cmake.patch @@ -0,0 +1,23 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 5b7f6db..1936ca5 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -109,7 +109,8 @@ target_include_directories(msdf-atlas-gen INTERFACE + if(MSDF_ATLAS_NO_ARTERY_FONT) + target_compile_definitions(msdf-atlas-gen PUBLIC MSDF_ATLAS_NO_ARTERY_FONT) + else() +- target_include_directories(msdf-atlas-gen PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/artery-font-format) ++ find_package(artery-font-format REQUIRED CONFIG) ++ target_link_libraries(msdf-atlas-gen PRIVATE artery-font-format::artery-font-format) + endif() + set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT msdf-atlas-gen) + +@@ -118,7 +119,7 @@ target_link_libraries(msdf-atlas-gen PRIVATE Threads::Threads) + if(NOT MSDFGEN_DISABLE_PNG) + target_link_libraries(msdf-atlas-gen PRIVATE PNG::PNG) + endif() +-target_link_libraries(msdf-atlas-gen PUBLIC msdfgen::msdfgen) ++target_link_libraries(msdf-atlas-gen PUBLIC msdfgen::msdfgen msdfgen::msdfgen-ext) + + if(BUILD_SHARED_LIBS AND WIN32) + target_compile_definitions(msdf-atlas-gen PRIVATE "MSDF_ATLAS_PUBLIC=__declspec(dllexport)") diff --git a/recipes/msdf-atlas-gen/all/test_package/Sacramento-Regular.ttf b/recipes/msdf-atlas-gen/all/test_package/Sacramento-Regular.ttf deleted file mode 100644 index cfd2eabc8699f..0000000000000 Binary files a/recipes/msdf-atlas-gen/all/test_package/Sacramento-Regular.ttf and /dev/null differ diff --git a/recipes/msdf-atlas-gen/all/test_package/conanfile.py b/recipes/msdf-atlas-gen/all/test_package/conanfile.py index 0e314c3e127bb..ff5302d78bc18 100644 --- a/recipes/msdf-atlas-gen/all/test_package/conanfile.py +++ b/recipes/msdf-atlas-gen/all/test_package/conanfile.py @@ -1,28 +1,17 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.build import can_run + import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" + generators = "VirtualRunEnv" + test_type = "explicit" - @property - def _atlas_texture_file(self): - return os.path.join(self.build_folder, "atlas_texture.png") - - @property - def _atlas_desc_file(self): - return os.path.join(self.build_folder, "atlas_desc.json") + def requirements(self): + self.requires(self.tested_reference_str) def test(self): - if not tools.cross_building(self): - ttf_path = os.path.join( - self.source_folder, "Sacramento-Regular.ttf") - charset_path = os.path.join( - self.source_folder, "uppercase_charset") - - ret_code = self.run( - "msdf-atlas-gen -font {} -charset {} -imageout {} -json {}".format(ttf_path, charset_path, self._atlas_texture_file, self._atlas_desc_file), run_environment=True) - - assert ret_code == 0 - assert os.path.isfile(self._atlas_texture_file) - assert os.path.isfile(self._atlas_desc_file) + if can_run(self): + self.run("msdf-atlas-gen -help", env="conanrun") diff --git a/recipes/msdf-atlas-gen/all/test_package/uppercase_charset b/recipes/msdf-atlas-gen/all/test_package/uppercase_charset deleted file mode 100644 index c3c76b7e894ab..0000000000000 --- a/recipes/msdf-atlas-gen/all/test_package/uppercase_charset +++ /dev/null @@ -1 +0,0 @@ -['A', 'Z'] diff --git a/recipes/msdf-atlas-gen/config.yml b/recipes/msdf-atlas-gen/config.yml index af40d9653a378..297a337077654 100644 --- a/recipes/msdf-atlas-gen/config.yml +++ b/recipes/msdf-atlas-gen/config.yml @@ -1,3 +1,5 @@ versions: + "1.3": + folder: all "1.2.2": folder: all diff --git a/recipes/msdfgen/all/conandata.yml b/recipes/msdfgen/all/conandata.yml index f43fd3e983ea6..6943aebeb6690 100644 --- a/recipes/msdfgen/all/conandata.yml +++ b/recipes/msdfgen/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "1.12": + url: "https://github.com/Chlumsky/msdfgen/archive/refs/tags/v1.12.tar.gz" + sha256: "f058117496097217d12e4ea86adbff8467adaf6f12af793925d243b86b0c4f57" + "1.11": + url: "https://github.com/Chlumsky/msdfgen/archive/refs/tags/v1.11.tar.gz" + sha256: "fad74e33274f591e72511bc0546189e7aec439f2a512ef1b2fde243554d457cb" + "1.10": + url: "https://github.com/Chlumsky/msdfgen/archive/refs/tags/v1.10.tar.gz" + sha256: "2754d1687bfb80968d9c682e0c4c04c8fcf72df1421d076baf44ea0d87aa3662" "1.9.1": url: "https://github.com/Chlumsky/msdfgen/archive/refs/tags/v1.9.1.tar.gz" sha256: "0d2cf3113eea97776731888c711ff836b2be7ff35966a2aa86f3dc57103d0740" @@ -6,6 +15,10 @@ sources: url: "https://github.com/Chlumsky/msdfgen/archive/refs/tags/v1.9.tar.gz" sha256: "909eb88c71268dc00cdda244a1fa40a0feefae45f68a779fbfddd5463559fa40" patches: + "1.10": + - patch_file: "patches/1.10-0001-honor-msvc-runtime.patch" + patch_description: "Remove hardcoded vc runtime" + patch_type: "conan" "1.9.1": - patch_file: "patches/1.9-0001-unvendor-external-libs.patch" patch_description: "Use external libs from conan instead of vendored ones" diff --git a/recipes/msdfgen/all/conanfile.py b/recipes/msdfgen/all/conanfile.py index fa5bc750fd043..2094d2f1bfe2c 100644 --- a/recipes/msdfgen/all/conanfile.py +++ b/recipes/msdfgen/all/conanfile.py @@ -2,21 +2,21 @@ 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 +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 +from conan.tools.scm import Version import os required_conan_version = ">=1.53.0" - class MsdfgenConan(ConanFile): name = "msdfgen" description = "Multi-channel signed distance field generator" license = "MIT" - topics = ("msdf", "shape", "glyph", "font") - homepage = "https://github.com/Chlumsky/msdfgen" url = "https://github.com/conan-io/conan-center-index" - + homepage = "https://github.com/Chlumsky/msdfgen" + topics = ("msdf", "shape", "glyph", "font") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -48,9 +48,13 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("freetype/2.12.1") - self.requires("lodepng/cci.20200615") - self.requires("tinyxml2/9.0.0") + self.requires("freetype/2.13.2") + if Version(self.version) < "1.10": + self.requires("lodepng/cci.20200615") + else: + self.requires("libpng/[>=1.6 <2]") + self.requires("tinyxml2/10.0.0") + def validate(self): if self.settings.compiler.get_safe("cppstd"): @@ -61,36 +65,45 @@ def validate(self): raise ConanInvalidConfiguration("skia recipe not available yet in CCI") 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["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.cache_variables["MSDFGEN_BUILD_MSDFGEN_STANDALONE"] = self.options.utility + tc.cache_variables["MSDFGEN_USE_OPENMP"] = self.options.with_openmp + tc.cache_variables["MSDFGEN_USE_CPP11"] = True + tc.cache_variables["MSDFGEN_USE_SKIA"] = self.options.with_skia + tc.cache_variables["MSDFGEN_INSTALL"] = True + if Version(self.version) >= "1.10": + tc.cache_variables["MSDFGEN_USE_VCPKG"] = False + # Because in upstream CMakeLists, project() is called after some logic based on BUILD_SHARED_LIBS + tc.cache_variables["BUILD_SHARED_LIBS"] = self.options.shared + if Version(self.version) >= "1.11": + tc.cache_variables["MSDFGEN_DYNAMIC_RUNTIME"] = not is_msvc_static_runtime(self) + if self.settings.os == "Linux": + # Workaround for https://github.com/conan-io/conan/issues/13560 + libdirs_host = [l for dependency in self.dependencies.host.values() for l in dependency.cpp_info.aggregated_components().libdirs] + tc.variables["CMAKE_BUILD_RPATH"] = ";".join(libdirs_host) tc.generate() deps = CMakeDeps(self) deps.generate() def _patch_sources(self): 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 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)", - ) + + if Version(self.version) < "1.10": + # 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 is_msvc(self): + replace_in_file( + self, + os.path.join(self.source_folder, "CMakeLists.txt"), + "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() @@ -103,6 +116,7 @@ def package(self): cmake = CMake(self) cmake.install() 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", "msdfgen") @@ -118,8 +132,13 @@ def package_info(self): self.cpp_info.components["_msdfgen"].names["cmake_find_package"] = "msdfgen" self.cpp_info.components["_msdfgen"].names["cmake_find_package_multi"] = "msdfgen" self.cpp_info.components["_msdfgen"].includedirs.append(includedir) - self.cpp_info.components["_msdfgen"].libs = ["msdfgen"] + self.cpp_info.components["_msdfgen"].libs = ["msdfgen" if Version(self.version) < "1.10" else "msdfgen-core"] self.cpp_info.components["_msdfgen"].defines = ["MSDFGEN_USE_CPP11"] + if Version(self.version) >= "1.10": + if self.options.shared and is_msvc(self): + self.cpp_info.components["_msdfgen"].defines.append("MSDFGEN_PUBLIC=__declspec(dllimport)") + else: + self.cpp_info.components["_msdfgen"].defines.append("MSDFGEN_PUBLIC=") self.cpp_info.components["msdfgen-ext"].set_property("cmake_target_name", "msdfgen::msdfgen-ext") self.cpp_info.components["msdfgen-ext"].names["cmake_find_package"] = "msdfgen-ext" @@ -128,12 +147,13 @@ def package_info(self): self.cpp_info.components["msdfgen-ext"].libs = ["msdfgen-ext"] self.cpp_info.components["msdfgen-ext"].requires = [ "_msdfgen", "freetype::freetype", - "lodepng::lodepng", "tinyxml2::tinyxml2", + "lodepng::lodepng" if Version(self.version) < "1.10" else "libpng::libpng", + "tinyxml2::tinyxml2", ] + if self.options.with_skia: self.cpp_info.components["msdfgen-ext"].defines.append("MSDFGEN_USE_SKIA") + # TODO: to remove once conan v1 support dropped 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) + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/msdfgen/all/patches/1.10-0001-honor-msvc-runtime.patch b/recipes/msdfgen/all/patches/1.10-0001-honor-msvc-runtime.patch new file mode 100644 index 0000000000000..c0f9784ad23cf --- /dev/null +++ b/recipes/msdfgen/all/patches/1.10-0001-honor-msvc-runtime.patch @@ -0,0 +1,26 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -79,7 +79,6 @@ file(GLOB_RECURSE MSDFGEN_EXT_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "ext/ + add_library(msdfgen-core "${CMAKE_CURRENT_SOURCE_DIR}/msdfgen.h" ${MSDFGEN_CORE_HEADERS} ${MSDFGEN_CORE_SOURCES}) + add_library(msdfgen::msdfgen-core ALIAS msdfgen-core) + set_target_properties(msdfgen-core PROPERTIES PUBLIC_HEADER "${MSDFGEN_CORE_HEADERS}") +-set_property(TARGET msdfgen-core PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + target_compile_definitions(msdfgen-core PUBLIC + MSDFGEN_VERSION=${MSDFGEN_VERSION} + MSDFGEN_VERSION_MAJOR=${MSDFGEN_VERSION_MAJOR} +@@ -127,7 +126,6 @@ if(NOT MSDFGEN_CORE_ONLY) + add_library(msdfgen-ext "${CMAKE_CURRENT_SOURCE_DIR}/msdfgen-ext.h" ${MSDFGEN_EXT_HEADERS} ${MSDFGEN_EXT_SOURCES}) + add_library(msdfgen::msdfgen-ext ALIAS msdfgen-ext) + set_target_properties(msdfgen-ext PROPERTIES PUBLIC_HEADER "${MSDFGEN_EXT_HEADERS}") +- set_property(TARGET msdfgen-ext PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + target_compile_definitions(msdfgen-ext PUBLIC MSDFGEN_USE_LIBPNG) + target_link_libraries(msdfgen-ext PRIVATE msdfgen::msdfgen-core Freetype::Freetype tinyxml2::tinyxml2 PNG::PNG) + target_include_directories(msdfgen-ext +@@ -171,7 +169,6 @@ if(MSDFGEN_BUILD_STANDALONE) + add_executable(msdfgen ${MSDFGEN_STANDALONE_SOURCES}) + target_compile_definitions(msdfgen PUBLIC MSDFGEN_STANDALONE) + target_compile_definitions(msdfgen PRIVATE MSDFGEN_VERSION_UNDERLINE=${MSDFGEN_VERSION_UNDERLINE}) +- set_property(TARGET msdfgen PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + target_link_libraries(msdfgen PRIVATE msdfgen::msdfgen) + set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT msdfgen) + endif() diff --git a/recipes/msdfgen/all/test_package/OpenSans-Bold.ttf b/recipes/msdfgen/all/test_package/OpenSans-Bold.ttf deleted file mode 100644 index fd79d43bea029..0000000000000 Binary files a/recipes/msdfgen/all/test_package/OpenSans-Bold.ttf and /dev/null differ diff --git a/recipes/msdfgen/all/test_package/conanfile.py b/recipes/msdfgen/all/test_package/conanfile.py index c4fdfb4dbdc98..0a6bc68712d90 100644 --- a/recipes/msdfgen/all/test_package/conanfile.py +++ b/recipes/msdfgen/all/test_package/conanfile.py @@ -23,5 +23,4 @@ def build(self): def test(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") - self.run(f"{bin_path} {ttf_path}", env="conanrun") + self.run(bin_path, env="conanrun") diff --git a/recipes/msdfgen/all/test_package/test_package.cpp b/recipes/msdfgen/all/test_package/test_package.cpp index d169064c206c2..fc8e183067d7e 100644 --- a/recipes/msdfgen/all/test_package/test_package.cpp +++ b/recipes/msdfgen/all/test_package/test_package.cpp @@ -4,26 +4,9 @@ #include int main(int argc, char **argv) { - if (argc < 2) { - std::cerr << "Need at least one argument\n"; - return 1; - } - msdfgen::FreetypeHandle *ft = msdfgen::initializeFreetype(); if (ft) { - msdfgen::FontHandle *font = msdfgen::loadFont(ft, argv[1]); - if (font) { - msdfgen::Shape shape; - if (msdfgen::loadGlyph(shape, font, 'A')) { - shape.normalize(); - msdfgen::edgeColoringSimple(shape, 3.0); - msdfgen::Bitmap msdf(32, 32); - msdfgen::generateMSDF(msdf, shape, 4.0, 1.0, msdfgen::Vector2(4.0, 4.0)); - msdfgen::savePng(msdf, "output.png"); - } - msdfgen::destroyFont(font); - } - msdfgen::deinitializeFreetype(ft); + std::cout << "Test" << std::endl; // This should be printed } return 0; } diff --git a/recipes/msdfgen/all/test_v1_package/conanfile.py b/recipes/msdfgen/all/test_v1_package/conanfile.py index 7b775db727c08..38f4483872d47 100644 --- a/recipes/msdfgen/all/test_v1_package/conanfile.py +++ b/recipes/msdfgen/all/test_v1_package/conanfile.py @@ -14,5 +14,4 @@ def build(self): 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) + self.run(bin_path, run_environment=True) diff --git a/recipes/msdfgen/config.yml b/recipes/msdfgen/config.yml index 9843a08c19d0c..aa26d962008db 100644 --- a/recipes/msdfgen/config.yml +++ b/recipes/msdfgen/config.yml @@ -1,4 +1,10 @@ versions: + "1.12": + folder: all + "1.11": + folder: all + "1.10": + folder: all "1.9.1": folder: all "1.9": 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..9326cc90f6718 100644 --- a/recipes/msgpack-c/all/conandata.yml +++ b/recipes/msgpack-c/all/conandata.yml @@ -1,4 +1,16 @@ sources: + "6.1.0": + url: "https://github.com/msgpack/msgpack-c/releases/download/c-6.1.0/msgpack-c-6.1.0.tar.gz" + sha256: "674119f1a85b5f2ecc4c7d5c2859edf50c0b05e0c10aa0df85eefa2c8c14b796" + "6.0.0": + url: "https://github.com/msgpack/msgpack-c/releases/download/c-6.0.0/msgpack-c-6.0.0.tar.gz" + sha256: "3654f5e2c652dc52e0a993e270bb57d5702b262703f03771c152bba51602aeba" + "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" + "3.3.0": + url: "https://github.com/msgpack/msgpack-c/releases/download/cpp-3.3.0/msgpack-3.3.0.tar.gz" + sha256: "6e114d12a5ddb8cb11f669f83f32246e484a8addd0ce93f274996f1941c1f07b" diff --git a/recipes/msgpack-c/all/conanfile.py b/recipes/msgpack-c/all/conanfile.py index b46a9fad94eec..eac066163d085 100644 --- a/recipes/msgpack-c/all/conanfile.py +++ b/recipes/msgpack-c/all/conanfile.py @@ -1,19 +1,20 @@ -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 +from conan.tools.scm import Version 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" + package_type = "library" settings = "os", "arch", "build_type", "compiler" options = { "fPIC": [True, False], @@ -24,60 +25,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.cache_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,17 +76,21 @@ 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") - self.cpp_info.set_property("cmake_target_name", "msgpackc") self.cpp_info.set_property("pkg_config_name", "msgpack") - self.cpp_info.libs = ["msgpackc"] + if Version(self.version) < "6.0.0": + self.cpp_info.libs = ["msgpackc"] + self.cpp_info.set_property("cmake_target_name", "msgpackc") + else: + self.cpp_info.libs = ["msgpack-c"] + self.cpp_info.set_property("cmake_target_name", "msgpack-c") # TODO: to remove in conan v2 once cmake_find_package* & pkg_config generators removed self.cpp_info.names["cmake_find_package"] = "msgpack" diff --git a/recipes/msgpack-c/all/test_package/CMakeLists.txt b/recipes/msgpack-c/all/test_package/CMakeLists.txt index 03402926ba00c..8fda341f88c80 100644 --- a/recipes/msgpack-c/all/test_package/CMakeLists.txt +++ b/recipes/msgpack-c/all/test_package/CMakeLists.txt @@ -1,10 +1,11 @@ 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) +if(TARGET msgpackc) + target_link_libraries(${PROJECT_NAME} PRIVATE msgpackc) +else() + target_link_libraries(${PROJECT_NAME} PRIVATE msgpack-c) +endif() 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..3267291611670 100644 --- a/recipes/msgpack-c/config.yml +++ b/recipes/msgpack-c/config.yml @@ -1,3 +1,11 @@ versions: + "6.1.0": + folder: all + "6.0.0": + folder: all + "5.0.0": + folder: all "4.0.0": folder: all + "3.3.0": + folder: all diff --git a/recipes/msgpack-cxx/all/conandata.yml b/recipes/msgpack-cxx/all/conandata.yml index a29da06b01237..3aadf7df1811f 100644 --- a/recipes/msgpack-cxx/all/conandata.yml +++ b/recipes/msgpack-cxx/all/conandata.yml @@ -1,16 +1,31 @@ sources: + "7.0.0": + url: "https://github.com/msgpack/msgpack-c/releases/download/cpp-7.0.0/msgpack-cxx-7.0.0.tar.gz" + sha256: "7504b7af7e7b9002ce529d4f941e1b7fb1fb435768780ce7da4abaac79bb156f" + "6.1.1": + url: "https://github.com/msgpack/msgpack-c/releases/download/cpp-6.1.1/msgpack-cxx-6.1.1.tar.gz" + sha256: "5fd555742e37bbd58d166199e669f01f743c7b3c6177191dd7b31fb0c37fa191" + "6.1.0": + url: "https://github.com/msgpack/msgpack-c/releases/download/cpp-6.1.0/msgpack-cxx-6.1.0.tar.gz" + sha256: "23ede7e93c8efee343ad8c6514c28f3708207e5106af3b3e4969b3a9ed7039e7" + "6.0.0": + url: "https://github.com/msgpack/msgpack-c/releases/download/cpp-6.0.0/msgpack-cxx-6.0.0.tar.gz" + sha256: "0948d2db98245fb97b9721cfbc3e44c1b832e3ce3b8cfd7485adc368dc084d14" + "5.0.0": + url: "https://github.com/msgpack/msgpack-c/releases/download/cpp-5.0.0/msgpack-cxx-5.0.0.tar.gz" + sha256: "80f997575acff12b1b64158ef9dbad4cff32595f985532e16c6ea67e317452d5" "4.1.3": - url: "https://github.com/msgpack/msgpack-c/archive/cpp-4.1.3.tar.gz" - sha256: "fd0a685656f11b8aa09ed33bcbdcad3105d25d0034ca3dba9fe957623a42d253" + url: "https://github.com/msgpack/msgpack-c/releases/download/cpp-4.1.3/msgpack-cxx-4.1.3.tar.gz" + sha256: "2539075ea2f35c15cab5c50ecba00d76fc4cbdcd485840257f15ebb04e8e3e1a" "4.1.2": - url: "https://github.com/msgpack/msgpack-c/archive/cpp-4.1.2.tar.gz" - sha256: "7460ad43552c9d9b56a75f20e1f4fedf18fff1c48715d6cfa91d779b26ca3795" + url: "https://github.com/msgpack/msgpack-c/releases/download/cpp-4.1.2/msgpack-cxx-4.1.2.tar.gz" + sha256: "eeddd7faeacbc12e10052bd1e3ec78bd26c69bfbbea9f9264c7ffce9b1ede7b1" "4.1.1": - url: "https://github.com/msgpack/msgpack-c/archive/cpp-4.1.1.tar.gz" - sha256: "221cc539e77f5ca02f4f0bbb1edafa9ca8c08de7ba8072d7baf2139930d99182" + url: "https://github.com/msgpack/msgpack-c/releases/download/cpp-4.1.1/msgpack-cxx-4.1.1.tar.gz" + sha256: "8115c5edcf20bc1408c798a6bdaec16c1e52b1c34859d4982a0fb03300438f0b" "4.1.0": - url: "https://github.com/msgpack/msgpack-c/archive/cpp-4.1.0.tar.gz" - sha256: "634762502a192026bd5db773f9e18d900ad04cfc312b52faee350a5c76e5ccfb" + url: "https://github.com/msgpack/msgpack-c/releases/download/cpp-4.1.0/msgpack-cxx-4.1.0.tar.gz" + sha256: "11e042ffdafda6fc4ebdc5f4f63b352229b89796c2f8aa3e813116ec1dd8377d" "4.0.3": - url: "https://github.com/msgpack/msgpack-c/archive/cpp-4.0.3.tar.gz" - sha256: "23d737b1e959dfb6ca420564563f098e758adacc0b18003c56abf1b945bd1d4a" + url: "https://github.com/msgpack/msgpack-c/releases/download/cpp-4.0.3/msgpack-cxx-4.0.3.tar.gz" + sha256: "9b3c1803b9855b7b023d7f181f66ebb0d6941275ba41d692037e0aa27736443f" diff --git a/recipes/msgpack-cxx/all/conanfile.py b/recipes/msgpack-cxx/all/conanfile.py index bffb037fb91b7..8112274e3a237 100644 --- a/recipes/msgpack-cxx/all/conanfile.py +++ b/recipes/msgpack-cxx/all/conanfile.py @@ -1,73 +1,83 @@ -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") + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" options = { "use_boost": [True, False], } default_options = { - "use_boost": True + "use_boost": True, } + no_copy_source = True - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - - def configure_options(self): - # No boost was added in 4.1.0 - if tools.Version(self.version) < "4.1.0": + def config_options(self): + # Boost was not optional until 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): + # Boost was not optional until 4.1.0 if self.options.get_safe("use_boost", True): - self.requires("boost/1.78.0") + self.requires("boost/1.83.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")) - self._create_cmake_module_alias_targets( - os.path.join(self.package_folder, self._module_file_rel_path), - {"msgpackc-cxx": "msgpackc-cxx::msgpackc-cxx"} + 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"), ) - - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + copy( + self, + pattern="*.hpp", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include"), + ) + if Version(self.version) >= "6.0.0": + self._create_cmake_module_alias_targets( + os.path.join(self.package_folder, self._module_file_rel_path), + {"msgpack-cxx": "msgpack-cxx::msgpack-cxx"} + ) + else: + self._create_cmake_module_alias_targets( + os.path.join(self.package_folder, self._module_file_rel_path), + {"msgpackc-cxx": "msgpackc-cxx::msgpackc-cxx"} + ) + + 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_subfolder(self): @@ -75,20 +85,41 @@ 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.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) + if Version(self.version) > "6.1.1": + self.cpp_info.set_property("cmake_file_name", "msgpack-cxx") + else: + # The README is wrong, the correct name is msgpack-cxx, + # but keep it for old published versions not to break the consumers + self.cpp_info.set_property("cmake_file_name", "msgpack") + + if Version(self.version) >= "6.0.0": + self.cpp_info.set_property("cmake_target_name", "msgpack-cxx") + self.cpp_info.names["cmake_find_package"] = "msgpack-cxx" + self.cpp_info.names["cmake_find_package_multi"] = "msgpack-cxx" + else: + self.cpp_info.set_property("cmake_target_name", "msgpackc-cxx") + self.cpp_info.names["cmake_find_package"] = "msgpackc-cxx" + self.cpp_info.names["cmake_find_package_multi"] = "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 + if Version(self.version) > "6.1.1": + self.cpp_info.filenames["cmake_find_package"] = "msgpack-cxx" + self.cpp_info.filenames["cmake_find_package_multi"] = "msgpack-cxx" + else: + # The README is wrong, the correct name is msgpack-cxx, + # but keep it for old published versions not to break the consumers + self.cpp_info.filenames["cmake_find_package"] = "msgpack" + self.cpp_info.filenames["cmake_find_package_multi"] = "msgpack" 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..c74139de33ea0 100644 --- a/recipes/msgpack-cxx/all/test_package/CMakeLists.txt +++ b/recipes/msgpack-cxx/all/test_package/CMakeLists.txt @@ -1,11 +1,17 @@ -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(msgpack REQUIRED CONFIG) +if (MSGPACK_VERSION_LESS_EQ_6_1_1) + find_package(msgpack REQUIRED CONFIG) + set(msgpack-cxx_VERSION ${msgpack_VERSION}) +else() + find_package(msgpack-cxx REQUIRED CONFIG) +endif() add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} msgpackc-cxx) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +if(msgpack-cxx_VERSION VERSION_GREATER_EQUAL "6.0.0") + target_link_libraries(${PROJECT_NAME} msgpack-cxx) +else() + target_link_libraries(${PROJECT_NAME} msgpackc-cxx) +endif() +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..4f7740cb3125f 100644 --- a/recipes/msgpack-cxx/all/test_package/conanfile.py +++ b/recipes/msgpack-cxx/all/test_package/conanfile.py @@ -1,10 +1,24 @@ -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_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["MSGPACK_VERSION_LESS_EQ_6_1_1"] = self.dependencies[self.tested_reference_str].ref.version <= "6.1.1" + tc.generate() def build(self): cmake = CMake(self) @@ -12,6 +26,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/config.yml b/recipes/msgpack-cxx/config.yml index c71b61d3f47b2..5aecc7725d45b 100644 --- a/recipes/msgpack-cxx/config.yml +++ b/recipes/msgpack-cxx/config.yml @@ -1,4 +1,14 @@ versions: + "7.0.0": + folder: all + "6.1.1": + folder: all + "6.1.0": + folder: all + "6.0.0": + folder: all + "5.0.0": + folder: all "4.1.3": folder: all "4.1.2": diff --git a/recipes/msix/all/CMakeLists.txt b/recipes/msix/all/CMakeLists.txt deleted file mode 100644 index c477e0c1e565e..0000000000000 --- a/recipes/msix/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.0) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -add_subdirectory("source_subfolder") diff --git a/recipes/msix/all/conandata.yml b/recipes/msix/all/conandata.yml index ef22231170ffe..0de96c69cb0d4 100644 --- a/recipes/msix/all/conandata.yml +++ b/recipes/msix/all/conandata.yml @@ -4,7 +4,8 @@ sources: sha256: "23179d577d0b9d34e93374ae38284ab9f1247ff6cc9175851983fb114ab00087" patches: "1.7": - - base_path: "source_subfolder" - patch_file: "patches/1.7/cmake.patch" - - base_path: "source_subfolder" - patch_file: "patches/1.7/signaturevalidator.patch" + - patch_file: "patches/1.7/cmake.patch" + - patch_file: "patches/1.7/signaturevalidator.patch" + - patch_file: "patches/1.7/001-fix-missing-include.patch" + patch_description: "Fix missing #include " + patch_type: "portability" diff --git a/recipes/msix/all/conanfile.py b/recipes/msix/all/conanfile.py index 0c62a718f8c29..9a1d7b90fe8e0 100644 --- a/recipes/msix/all/conanfile.py +++ b/recipes/msix/all/conanfile.py @@ -1,19 +1,26 @@ -from conans import CMake, ConanFile, tools -from conans.errors import ConanInvalidConfiguration +import os +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, collect_libs, copy, export_conandata_patches, get +from conan.tools.scm import Version -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class MsixConan(ConanFile): name = "msix" + description = "An SDK for creating MSIX packages" license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/microsoft/msix-packaging" - description = "An SDK for creating MSIX packages" - topics = ("msix", "sdk", "packaging", "conan-recipe") + topics = ("sdk", "packaging", "conan-recipe") - settings = "os", "compiler", "build_type", "arch" + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -22,7 +29,7 @@ class MsixConan(ConanFile): "skip_bundles": [True, False], "use_external_zlib": [True, False], "use_validation_parser": [True, False], - "xml_parser": ["applexml", "javaxml", "msxml6", "xerces"] + "with_xerces": [True, False], } default_options = { "shared": False, @@ -32,126 +39,134 @@ class MsixConan(ConanFile): "skip_bundles": False, "use_external_zlib": True, "use_validation_parser": False, - "xml_parser": "msxml6" + "with_xerces": False, } - generators = "cmake" - exports_sources = "CMakeLists.txt", "patches/**" - - _cmake = None + @property + def _min_cppstd(self): + return 14 @property - def _minimum_compilers_version(self): + def _compilers_minimum_version(self): return { - "Visual Studio": "15" + "apple-clang": "10", + "clang": "7", + "msvc": "191", + "Visual Studio": "15", } - @property - def _source_subfolder(self): - return "source_subfolder" - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - if self.settings.os == "Android": - self._cmake.definitions["AOSP"] = True - if self.settings.os == "Linux": - self._cmake.definitions["LINUX"] = True - if self.settings.os == "Macos": - self._cmake.definitions["MACOS"] = True - self._cmake.definitions["CRYPTO_LIB"] = self.options.crypto_lib - self._cmake.definitions["MSIX_PACK"] = self.options.pack - self._cmake.definitions["MSIX_SAMPLES"] = False - self._cmake.definitions["MSIX_TESTS"] = False - self._cmake.definitions["SKIP_BUNDLES"] = self.options.skip_bundles - self._cmake.definitions["USE_MSIX_SDK_ZLIB"] = self.options.use_external_zlib - self._cmake.definitions["USE_SHARED_ZLIB"] = self.options["zlib"].shared - self._cmake.definitions["USE_VALIDATION_PARSER"] = self.options.use_validation_parser - self._cmake.definitions["XML_PARSER"] = self.options.xml_parser - self._cmake.definitions["CALCULATE_VERSION"] = False - self._cmake.definitions["ENABLE_NUGET_PACKAGING"] = False - self._cmake.configure() - return self._cmake - - def _validate_compiler_settings(self): - compiler = self.settings.compiler - if compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, "17") - - 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)) - elif 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)) + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - self.options.crypto_lib = "crypt32" + if self.settings.os != "Windows": + del self.options.crypto_lib + if not is_apple_os(self) and self.settings.os not in ["Windows", "Android"]: + # with_xerces is required + del self.options.with_xerces 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.settings.os == "Linux" and not self.options.skip_bundles: - self.requires("icu/71.1") - if self.options.crypto_lib == "openssl": - self.requires("openssl/1.1.1q") + if self.settings.os in ["Linux", "FreeBSD"] and not self.options.skip_bundles: + self.requires("icu/74.2") + if self.options.get_safe("crypto_lib", "openssl") == "openssl": + self.requires("openssl/[>=1.1 <4]") if self.options.use_external_zlib: - self.requires("zlib/1.2.12") - if self.options.xml_parser == "xerces": - self.requires("xerces-c/3.2.3") + self.requires("zlib/[>=1.2.11 <2]") + if self.options.get_safe("with_xerces", True): + self.requires("xerces-c/3.2.5") + + def _validate_compiler_settings(self): + compiler = self.settings.compiler + if compiler.get_safe("cppstd"): + check_min_cppstd(self, 14) + 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 validate(self): - if self.settings.os != "Android" and self.options.xml_parser == "javaxml": - raise ConanInvalidConfiguration("javaxml is supported only for Android") - if self.settings.os == "Linux" and self.settings.compiler != "clang": - raise ConanInvalidConfiguration("Only clang is supported on Linux") - if self.settings.os != "Macos" and self.options.xml_parser == "applexml": - raise ConanInvalidConfiguration("applexml is supported only for MacOS") - if self.settings.os != "Windows" and self.options.crypto_lib == "crypt32": - raise ConanInvalidConfiguration("crypt32 is supported only for Windows") - if self.settings.os != "Windows" and self.options.xml_parser == "msxml6": - raise ConanInvalidConfiguration("msxml6 is supported only for Windows") + if self.settings.os in ["Linux", "FreeBSD"] and self.settings.compiler != "clang": + raise ConanInvalidConfiguration(f"Only clang is supported on {self.settings.os}") + if self.settings.compiler == "clang" and Version(self.settings.compiler.version) >= "12" and self.version == "1.7": + # AppxPackaging.hpp:706:5: error: templates must have C++ linkage + raise ConanInvalidConfiguration("Clang 12 and newer are not supported") if self.options.pack: - if self.settings.os == "Macos": + if is_apple_os(self): if not self.options.use_external_zlib: raise ConanInvalidConfiguration("Using libCompression APIs and packaging features is not supported") - if self.options.xml_parser != "xerces": + if not self.options.get_safe("with_xerces", True): raise ConanInvalidConfiguration("Xerces is the only supported parser for MacOS pack") if not self.options.use_validation_parser: raise ConanInvalidConfiguration("Packaging requires validation parser") - if (self.options.xml_parser == "xerces" and - self.options["xerces-c"].char_type != "char16_t"): - raise ConanInvalidConfiguration("Only char16_t is supported for xerces-c") - + if self.options.get_safe("with_xerces", True) and self.dependencies["xerces-c"].options.char_type != "char16_t": + raise ConanInvalidConfiguration("Only char16_t is supported for xerces-c") + self._validate_compiler_settings() 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 self.settings.os == "Android": + tc.variables["AOSP"] = True + if self.settings.os in ["Linux", "FreeBSD"]: + tc.variables["LINUX"] = True + if is_apple_os(self): + tc.variables["MACOS"] = True + tc.variables["CRYPTO_LIB"] = self.options.get_safe("crypto_lib", "openssl") + tc.variables["MSIX_PACK"] = self.options.pack + tc.variables["MSIX_SAMPLES"] = False + tc.variables["MSIX_TESTS"] = False + tc.variables["SKIP_BUNDLES"] = self.options.skip_bundles + tc.variables["USE_MSIX_SDK_ZLIB"] = self.options.use_external_zlib + tc.variables["USE_VALIDATION_PARSER"] = self.options.use_validation_parser + if self.options.get_safe("with_xerces", True): + tc.variables["XML_PARSER"] = "xerces" + elif self.settings.os == "Android": + tc.variables["XML_PARSER"] = "javaxml" + elif is_apple_os(self): + tc.variables["XML_PARSER"] = "applexml" + elif self.settings.os == "Windows": + tc.variables["XML_PARSER"] = "msxml6" + tc.variables["CALCULATE_VERSION"] = False + tc.variables["ENABLE_NUGET_PACKAGING"] = False + 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 package(self): - cmake = self._configure_cmake() + cmake = CMake(self) cmake.install() - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) 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 = ["runtimeobject"] - if self.settings.compiler == "Visual Studio": - self.cpp_info.system_libs.append("delayimp") - if self.options.crypto_lib == "crypt32": - self.cpp_info.system_libs.extend(["bcrypt", "crypt32", "wintrust"]) - if self.options.xml_parser == "msxml6": + # https://github.com/microsoft/msix-packaging/blob/v1.7/src/msix/CMakeLists.txt#L271 + self.cpp_info.system_libs.extend(["bcrypt", "crypt32", "wintrust", "runtimeobject", "delayimp"]) + if not self.options.with_xerces: self.cpp_info.system_libs.append("msxml6") + if is_apple_os(self): + # https://github.com/microsoft/msix-packaging/blob/v1.7/src/msix/CMakeLists.txt#L364 + self.cpp_info.frameworks.extend(["CoreFoundation", "Foundation"]) + if not self.options.use_external_zlib: + # https://github.com/microsoft/msix-packaging/blob/v1.7/src/msix/CMakeLists.txt#L285 + self.cpp_info.frameworks.append("Compression") diff --git a/recipes/msix/all/patches/1.7/001-fix-missing-include.patch b/recipes/msix/all/patches/1.7/001-fix-missing-include.patch new file mode 100644 index 0000000000000..60cdf07427a6c --- /dev/null +++ b/recipes/msix/all/patches/1.7/001-fix-missing-include.patch @@ -0,0 +1,11 @@ +Fixes https://github.com/microsoft/msix-packaging/issues/596 +--- src/inc/Encoding.hpp ++++ src/inc/Encoding.hpp +@@ -5,6 +5,7 @@ + #pragma once + ++#include + #include + + namespace MSIX { namespace Encoding { + diff --git a/recipes/msix/all/patches/1.7/cmake.patch b/recipes/msix/all/patches/1.7/cmake.patch index b64f3d1cd79c0..6f72f3b88aaf0 100644 --- a/recipes/msix/all/patches/1.7/cmake.patch +++ b/recipes/msix/all/patches/1.7/cmake.patch @@ -103,31 +103,29 @@ index 92b082e6..ebae9789 100644 +# define installing rules for target files +install(TARGETS ${PROJECT_NAME}) diff --git a/src/msix/CMakeLists.txt b/src/msix/CMakeLists.txt -index 75d3afdf..e1fb2984 100644 --- a/src/msix/CMakeLists.txt +++ b/src/msix/CMakeLists.txt -@@ -6,6 +6,11 @@ cmake_minimum_required(VERSION 3.8.0 FATAL_ERROR) +@@ -5,6 +5,11 @@ + cmake_minimum_required(VERSION 3.8.0 FATAL_ERROR) project(msix) - ++ +# Define the library +add_library(${PROJECT_NAME} + msix.cpp +) -+ + # Handle exports and flags we need to set list(APPEND MSIX_UNPACK_EXPORTS - "UnpackPackage" -@@ -144,7 +149,7 @@ if(NOT SKIP_BUNDLES) - if (WIN32) +@@ -145,6 +150,7 @@ list(APPEND MsixSrc PAL/Applicability/Win32/Applicability.cpp) elseif(LINUX) -- find_package(ICU REQUIRED COMPONENTS uc) -+ target_link_libraries(${PROJECT_NAME} PRIVATE CONAN_PKG::icu) + find_package(ICU REQUIRED COMPONENTS uc) ++ target_link_libraries(${PROJECT_NAME} PRIVATE ICU::uc) list(APPEND MsixSrc PAL/Applicability/Linux/Applicability.cpp) elseif(AOSP) list(APPEND MsixSrc PAL/Applicability/AOSP/Applicability.cpp) -@@ -195,14 +200,16 @@ if(CRYPTO_LIB MATCHES crypt32) +@@ -195,14 +201,17 @@ PAL/Signature/Win32/SignatureValidator.cpp ) elseif(CRYPTO_LIB MATCHES openssl) @@ -136,22 +134,23 @@ index 75d3afdf..e1fb2984 100644 - PAL/Crypto/OpenSSL/Crypto.cpp - PAL/Signature/OpenSSL/SignatureValidator.cpp - ) ++ find_package(OpenSSL REQUIRED CONFIG) + list(APPEND MsixSrc + PAL/Crypto/OpenSSL/Crypto.cpp + PAL/Signature/OpenSSL/SignatureValidator.cpp + ) + if((IOS) OR (MACOS)) -+ target_link_libraries(${PROJECT_NAME} PRIVATE CONAN_PKG::openssl -Wl,-dead_strip) ++ target_link_libraries(${PROJECT_NAME} PRIVATE OpenSSL::SSL -Wl,-dead_strip) + elseif(NOT MSVC) -+ target_link_libraries(${PROJECT_NAME} PRIVATE CONAN_PKG::openssl -Wl,--gc-sections) ++ target_link_libraries(${PROJECT_NAME} PRIVATE OpenSSL::SSL -Wl,--gc-sections) else() - # ... and were done here... :/ - message(FATAL_ERROR "OpenSSL NOT FOUND!") -+ target_link_libraries(${PROJECT_NAME} PRIVATE CONAN_PKG::openssl) ++ target_link_libraries(${PROJECT_NAME} PRIVATE OpenSSL::SSL) endif() endif() -@@ -220,14 +227,7 @@ foreach(FILE ${MsixSrc}) +@@ -220,14 +229,7 @@ message(STATUS "\t${FILE}") endforeach() @@ -167,7 +166,7 @@ index 75d3afdf..e1fb2984 100644 # Copy out public headers to /src/unpack configure_file(../inc/MSIXWindows.hpp ${CMAKE_CURRENT_BINARY_DIR}/MSIXWindows.hpp ) -@@ -260,7 +260,7 @@ if(WIN32) +@@ -260,7 +262,7 @@ "/DELAYLOAD:api-ms-win-core-winrt-l1-1-0.dll") string(REPLACE ";" " " DELAYFLAGS "${DELAYFLAGS}") set_property(TARGET ${PROJECT_NAME} APPEND_STRING PROPERTY LINK_FLAGS "${DELAYFLAGS} /LTCG") @@ -176,48 +175,44 @@ index 75d3afdf..e1fb2984 100644 if(USE_STATIC_MSVC) if(CMAKE_BUILD_TYPE MATCHES Debug) set_property(TARGET ${PROJECT_NAME} APPEND_STRING PROPERTY LINK_FLAGS " /NODEFAULTLIB:MSVCRTD") -@@ -285,29 +285,20 @@ if(((IOS) OR (MACOS)) AND (NOT USE_MSIX_SDK_ZLIB)) - target_link_libraries(${PROJECT_NAME} PRIVATE libcompression.dylib) - elseif((AOSP) AND (NOT USE_MSIX_SDK_ZLIB)) - # for AOSP, use the libz.so from the android ndk. -- find_package(ZLIB REQUIRED) +@@ -288,17 +290,8 @@ + find_package(ZLIB REQUIRED) target_link_libraries(${PROJECT_NAME} PRIVATE -lz) --else() # WIN32 or USE_MSIX_SDK_ZLIB + else() # WIN32 or USE_MSIX_SDK_ZLIB - target_include_directories(${PROJECT_NAME} PRIVATE - ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/zlib - ${MSIX_PROJECT_ROOT}/lib/zlib - ) -+else() - if(USE_SHARED_ZLIB) - message(STATUS "MSIX takes a dynamic dependency on zlib") +- if(USE_SHARED_ZLIB) +- message(STATUS "MSIX takes a dynamic dependency on zlib") - target_link_libraries(${PROJECT_NAME} PRIVATE zlib) -+ target_link_libraries(${PROJECT_NAME} PRIVATE CONAN_PKG::zlib) - else() - message(STATUS "MSIX takes a static dependency on zlib") +- else() +- message(STATUS "MSIX takes a static dependency on zlib") - target_link_libraries(${PROJECT_NAME} PRIVATE zlibstatic) -+ target_link_libraries(${PROJECT_NAME} PRIVATE CONAN_PKG::zlib) - endif() +- endif() ++ find_package(ZLIB REQUIRED CONFIG) ++ target_link_libraries(${PROJECT_NAME} PRIVATE ZLIB::ZLIB) endif() # Parser - if(XML_PARSER MATCHES xerces) -- target_include_directories(${PROJECT_NAME} PRIVATE -- ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/xerces/src -- ${MSIX_PROJECT_ROOT}/lib/xerces/src -- ) +@@ -307,7 +299,8 @@ + ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/xerces/src + ${MSIX_PROJECT_ROOT}/lib/xerces/src + ) - target_link_libraries(${PROJECT_NAME} PRIVATE xerces-c) -+ target_link_libraries(${PROJECT_NAME} PRIVATE CONAN_PKG::xerces-c) ++ find_package(XercesC REQUIRED CONFIG) ++ target_link_libraries(${PROJECT_NAME} PRIVATE XercesC::XercesC) endif() if(XML_PARSER MATCHES applexml) -@@ -363,18 +354,6 @@ endif() +@@ -363,18 +356,6 @@ if((IOS) OR (MACOS)) target_link_libraries(${PROJECT_NAME} PRIVATE ${COREFOUNDATION_LIBRARY} ${FOUNDATION_LIBRARY}) endif() -if(LINUX) - target_link_libraries(${PROJECT_NAME} PRIVATE ${ICU_LIBRARIES}) -endif() - +- -if(OpenSSL_FOUND) - # include the libraries needed to use OpenSSL - target_include_directories(${PROJECT_NAME} PRIVATE ${OpenSSL_INCLUDE_PATH}) @@ -229,5 +224,6 @@ index 75d3afdf..e1fb2984 100644 - target_link_libraries(${PROJECT_NAME} PRIVATE crypto) - endif() -endif() ++ +# define installing rules for target files +install(TARGETS ${PROJECT_NAME}) diff --git a/recipes/msix/all/patches/1.7/signaturevalidator.patch b/recipes/msix/all/patches/1.7/signaturevalidator.patch index bc8cdf9e699db..06071e85ee658 100644 --- a/recipes/msix/all/patches/1.7/signaturevalidator.patch +++ b/recipes/msix/all/patches/1.7/signaturevalidator.patch @@ -22,7 +22,7 @@ index 1cc34b20..ccbf68dc 100644 if (!X509V3_EXT_print(extbio.get(), ext, 0, 0)) { - M_ASN1_OCTET_STRING_print(extbio.get(), ext->value); -+ M_ASN1_OCTET_STRING_print(extbio.get(), X509_EXTENSION_get_data(ext)); ++ ASN1_STRING_print(extbio.get(), X509_EXTENSION_get_data(ext)); } // null terminate the string. BIO_write(extbio.get(), "", 1); diff --git a/recipes/msix/all/test_package/CMakeLists.txt b/recipes/msix/all/test_package/CMakeLists.txt index e28b2e2b66dd9..5ad357dd7587a 100644 --- a/recipes/msix/all/test_package/CMakeLists.txt +++ b/recipes/msix/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +find_package(msix REQUIRED CONFIG) add_executable(${PROJECT_NAME} example.cpp) - -conan_target_link_libraries(${PROJECT_NAME}) +target_link_libraries(${PROJECT_NAME} PRIVATE msix::msix) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/msix/all/test_package/conanfile.py b/recipes/msix/all/test_package/conanfile.py index bee328a3e1aa7..ef5d7042163ec 100644 --- a/recipes/msix/all/test_package/conanfile.py +++ b/recipes/msix/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 MsixTestConan(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): - bin_path = os.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/msix/all/test_v1_package/CMakeLists.txt b/recipes/msix/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/msix/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/msix/all/test_v1_package/conanfile.py b/recipes/msix/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..28b18e54620ea --- /dev/null +++ b/recipes/msix/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +import os +from conans import ConanFile, CMake, tools + + +class MsixTestConan(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/msys2/all/conandata.yml b/recipes/msys2/all/conandata.yml index 01aa597548f23..1485bf6ada2af 100644 --- a/recipes/msys2/all/conandata.yml +++ b/recipes/msys2/all/conandata.yml @@ -1,8 +1,7 @@ sources: "cci.latest": - url: [ - "https://github.com/msys2/msys2-installer/releases/download/2022-01-18/msys2-base-x86_64-20220118.tar.xz", - "http://repo.msys2.org/distrib/x86_64/msys2-base-x86_64-20220118.tar.xz", - "https://sourceforge.net/projects/msys2/files/Base/x86_64/msys2-base-x86_64-20220118.tar.xz", - ] - sha256: "2ec6fe9c3e01ecba10b9ffa708ea13bf1f8c9739e5ce9da853b77f1f3e270034" + url: + - "https://github.com/msys2/msys2-installer/releases/download/2023-10-26/msys2-base-x86_64-20231026.tar.xz" + - "http://repo.msys2.org/distrib/x86_64/msys2-base-x86_64-20231026.tar.xz" + - "https://sourceforge.net/projects/msys2/files/Base/x86_64/msys2-base-x86_64-20231026.tar.xz" + sha256: "fa75120560563a311241c05882016978bd35612692c7f0d39815a27837bff27d" diff --git a/recipes/msys2/all/conanfile.py b/recipes/msys2/all/conanfile.py index 3025b93ffd61d..7c023fcf2b203 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" @@ -53,15 +47,23 @@ class MSYS2Conan(ConanFile): "exclude_files": ["ANY"], "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.options.no_kill + def validate(self): if self.settings.os != "Windows": raise ConanInvalidConfiguration("Only Windows supported") @@ -69,8 +71,8 @@ def validate(self): 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")): @@ -90,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') @@ -98,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): @@ -114,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() @@ -140,7 +142,8 @@ def _do_build(self): for package in packages: self.run(f'bash -l -c "pacman -S {package} --noconfirm"') for package in ['pkgconf']: - self.run(f'bash -l -c "pacman -Rs -d -d $(pacman -Qsq {package}) --noconfirm"') + if self.run(f'bash -l -c "pacman -Qq {package}"', ignore_errors=True, quiet=True) == 0: + self.run(f'bash -l -c "pacman -Rs -d -d {package} --noconfirm"') self._kill_pacman() @@ -150,40 +153,38 @@ 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 + # Note: this is no longer needed when we exclusively support Conan 2 integrations replace_in_file(self, os.path.join(self._msys_dir, "etc", "profile"), - 'PKG_CONFIG_PATH="', 'PKG_CONFIG_PATH="$PKG_CONFIG_PATH:') + 'PKG_CONFIG_PATH="', 'PKG_CONFIG_PATH="${PKG_CONFIG_PATH:+${PKG_CONFIG_PATH}:}') 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") @@ -192,5 +193,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 fa7d81b8ee739..e9550182abfe7 100644 --- a/recipes/msys2/all/test_package/conanfile.py +++ b/recipes/msys2/all/test_package/conanfile.py @@ -31,5 +31,4 @@ def test(self): output = StringIO() self.run('bash.exe -c "echo $PKG_CONFIG_PATH"', output) - print(output.getvalue()) assert self._secret_value in output.getvalue() diff --git a/recipes/msys2/all/test_v1_package/conanfile.py b/recipes/msys2/all/test_v1_package/conanfile.py index 9278b74eeb27b..97f1e665d30ac 100644 --- a/recipes/msys2/all/test_v1_package/conanfile.py +++ b/recipes/msys2/all/test_v1_package/conanfile.py @@ -25,5 +25,4 @@ def test(self): with tools.environment_append({"PKG_CONFIG_PATH": secret_value}): output = StringIO() self.run('bash.exe -c "echo $PKG_CONFIG_PATH"', output=output) - print(output.getvalue()) assert secret_value in output.getvalue() diff --git a/recipes/msys2/config.yml b/recipes/msys2/config.yml index 608a5b0c8a900..807ada4348c72 100644 --- a/recipes/msys2/config.yml +++ b/recipes/msys2/config.yml @@ -1,4 +1,3 @@ versions: - "cci.latest": - folder: "all" - + "cci.latest": + folder: "all" diff --git a/recipes/mtdev/all/conandata.yml b/recipes/mtdev/all/conandata.yml new file mode 100644 index 0000000000000..62fe05ee3b518 --- /dev/null +++ b/recipes/mtdev/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.1.6": + url: "https://bitmath.org/code/mtdev/mtdev-1.1.6.tar.gz" + sha256: "1325f389a2f25cd5f5a8ea4d29aad24aa7c3ec30401d679400dd79eb9c0a8dbb" diff --git a/recipes/mtdev/all/conanfile.py b/recipes/mtdev/all/conanfile.py new file mode 100644 index 0000000000000..530c1ccfb8d10 --- /dev/null +++ b/recipes/mtdev/all/conanfile.py @@ -0,0 +1,70 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +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 +import os + + +required_conan_version = ">=1.54.0" + + +class MtdevConan(ConanFile): + name = "mtdev" + description = "The mtdev library transforms all variants of kernel MT events to the slotted type B protocol." + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://bitmath.org/code/mtdev/" + topics = ("device", "freedesktop", "input", "mt", "multitouch", "touch") + package_type = "library" + 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: + 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("libtool/2.4.7") + + def validate(self): + if self.settings.os not in ["Linux", "FreeBSD"]: + raise ConanInvalidConfiguration(f"{self.ref} is not supported on {self.settings.os}.") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = AutotoolsToolchain(self) + tc.generate() + virtual_build_env = VirtualBuildEnv(self) + virtual_build_env.generate() + + def build(self): + autotools = Autotools(self) + autotools.autoreconf() + autotools.configure() + autotools.make() + + def package(self): + copy(self, "COPYING", 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, "lib", "pkgconfig")) + + def package_info(self): + self.cpp_info.libs = ["mtdev"] diff --git a/recipes/mtdev/all/test_package/CMakeLists.txt b/recipes/mtdev/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..bfa4f8ba62c05 --- /dev/null +++ b/recipes/mtdev/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) + +find_package(mtdev REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE mtdev::mtdev) diff --git a/recipes/mtdev/all/test_package/conanfile.py b/recipes/mtdev/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/mtdev/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/mtdev/all/test_package/test_package.c b/recipes/mtdev/all/test_package/test_package.c new file mode 100644 index 0000000000000..8cce2788bfac4 --- /dev/null +++ b/recipes/mtdev/all/test_package/test_package.c @@ -0,0 +1,8 @@ +#include +#include "mtdev.h" + + +int main(void) { + mtdev_close(NULL); + return EXIT_SUCCESS; +} diff --git a/recipes/mtdev/config.yml b/recipes/mtdev/config.yml new file mode 100644 index 0000000000000..42b92d9f27e7f --- /dev/null +++ b/recipes/mtdev/config.yml @@ -0,0 +1,3 @@ +versions: + "1.1.6": + folder: all diff --git a/recipes/mtfmt/all/conandata.yml b/recipes/mtfmt/all/conandata.yml new file mode 100644 index 0000000000000..479a84d9ef5a9 --- /dev/null +++ b/recipes/mtfmt/all/conandata.yml @@ -0,0 +1,10 @@ +sources: + # Newer versions at the top + "0.1.3": + url: "https://github.com/MtFmT-Lib/mtfmt/archive/refs/tags/v0.1.3.tar.gz" + sha256: "767a9b85b79d915ce7f1e43f0d24dc14942c07af24d6e96f7ff60ee522f1c1ce" +patches: + "0.1.3": + - patch_file: "patches/0.1.3-0001-remove-hardcoded-stds.patch" + patch_description: "Remove hardcoded C/CXX standards" + patch_type: "conan" diff --git a/recipes/mtfmt/all/conanfile.py b/recipes/mtfmt/all/conanfile.py new file mode 100644 index 0000000000000..7f72f34a57527 --- /dev/null +++ b/recipes/mtfmt/all/conanfile.py @@ -0,0 +1,111 @@ +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, rm, rmdir +from conan.tools.microsoft import is_msvc +import os + + +required_conan_version = ">=1.53.0" + + +class MtFmtConan(ConanFile): + name = "mtfmt" + description = "mtfmt (Mini template formatter) is a formatting library designed for embedded systems" + license = "LGPL-3.0-only" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/MtFmT-Lib/mtfmt" + topics = ("formatting", "embedded") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "use_div": [True, False], + "use_malloc": [True, False], + "use_stdout": [True, False], + "use_assert": [True, False], + "use_utf8": [True, False], + "use_fp32": [True, False], + "use_fp64": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "use_div": False, + "use_malloc": False, + "use_stdout": False, + "use_assert": False, + "use_utf8": True, + "use_fp32": False, + "use_fp64": 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") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + # Windows always builds as release, debug is not supported + if is_msvc(self) and self.settings.build_type == "Debug": + raise ConanInvalidConfiguration(f"{self.ref} does not support MSVC debug builds") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["MTFMT_BUILD_SHARED"] = self.options.shared + tc.cache_variables["MTFMT_RT_USE_DIV"] = self.options.use_div + tc.cache_variables["MTFMT_RT_USE_MALLOC"] = self.options.use_malloc + tc.cache_variables["MTFMT_RT_USE_STDOUT"] = self.options.use_stdout + tc.cache_variables["MTFMT_RT_USE_ASSERT"] = self.options.use_assert + tc.cache_variables["MTFMT_RT_USE_UTF8"] = self.options.use_utf8 + tc.cache_variables["MTFMT_RT_USE_FP32"] = self.options.use_fp32 + tc.cache_variables["MTFMT_RT_USE_FP64"] = self.options.use_fp64 + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.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", self.source_folder, os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + rmdir(self, os.path.join(self.package_folder, "mtfmt", "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "mtfmt", "share")) + rm(self, "*.la", os.path.join(self.package_folder, "mtfmt", "lib")) + rm(self, "*.pdb", os.path.join(self.package_folder, "mtfmt", "lib")) + rm(self, "*.pdb", os.path.join(self.package_folder, "mtfmt", "bin")) + + def package_info(self): + suffix = "_d" if self.settings.build_type == "Debug" else "" + self.cpp_info.libs = ["mtfmt" + suffix] + + libdir = os.path.join("mtfmt", "lib") + + if not self.options.shared or self.settings.os == "Windows": + libdir = os.path.join(libdir, "static") + + self.cpp_info.libdirs = [libdir] + self.cpp_info.includedirs = [os.path.join("mtfmt", "include")] + self.cpp_info.bindirs = [os.path.join("mtfmt", "bin")] diff --git a/recipes/mtfmt/all/patches/0.1.3-0001-remove-hardcoded-stds.patch b/recipes/mtfmt/all/patches/0.1.3-0001-remove-hardcoded-stds.patch new file mode 100644 index 0000000000000..272d9f3d83b9f --- /dev/null +++ b/recipes/mtfmt/all/patches/0.1.3-0001-remove-hardcoded-stds.patch @@ -0,0 +1,27 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 2d4ffcd..293cf7e 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -2,8 +2,8 @@ cmake_minimum_required(VERSION 3.10) + + project(mtfmt) + +-set(CMAKE_C_STANDARD 11) +-set(CMAKE_CXX_STANDARD 11) ++#set(CMAKE_C_STANDARD 11) ++#set(CMAKE_CXX_STANDARD 11) + + # debug版的åŽç¼€ + set(CMAKE_DEBUG_POSTFIX "_d") +@@ -50,6 +50,11 @@ endif() + # including path + target_include_directories(${TARGET_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc") + ++# Standards ++target_compile_features(${TARGET_NAME} PRIVATE cxx_std_11) ++target_compile_features(${TARGET_NAME} PRIVATE c_std_11) ++ ++ + # debug? + if(NOT MSVC) + if(NOT CMAKE_BUILD_TYPE) diff --git a/recipes/mtfmt/all/test_package/CMakeLists.txt b/recipes/mtfmt/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..db0d350d8ebe1 --- /dev/null +++ b/recipes/mtfmt/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) + +project(test_package LANGUAGES C) + +find_package(mtfmt REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE mtfmt::mtfmt) diff --git a/recipes/mtfmt/all/test_package/conanfile.py b/recipes/mtfmt/all/test_package/conanfile.py new file mode 100644 index 0000000000000..ef5d7042163ec --- /dev/null +++ b/recipes/mtfmt/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/mtfmt/all/test_package/test_package.c b/recipes/mtfmt/all/test_package/test_package.c new file mode 100644 index 0000000000000..29545fce88b63 --- /dev/null +++ b/recipes/mtfmt/all/test_package/test_package.c @@ -0,0 +1,97 @@ +// SPDX-License-Identifier: LGPL-3.0 +/** + * @file example_build_config.c + * @author å‘阳 (hinata.hoshino@foxmail.com) + * @brief ä¸åŒå¯¹é½æ–¹å¼ä¸‹çš„æ ¼å¼åŒ–çš„ä¾‹å­ + * @version 1.0 + * @date 2023-07-23 + * + * @copyright Copyright (c) å‘阳, all rights reserved. + * + */ +#include "mtfmt.h" +#include +#include + +/** + * @brief 测试1个ä½æ˜¯å¦è¢«set + * + */ +#define BIT_TEST(v, b) (!!(((v) & (b)) == (b))) + +/** + * @brief 把booleanå˜æˆC字符串 + * + */ +#define BOOL2STR(b) ((b) ? "true" : "false") + +int main(void) +{ + uint32_t cfg = MSTR_CONFIGURE_CFG_VAL(mstr_configure()); + uint32_t compiler = MSTR_CONFIGURE_CC_VAL(cfg); + + puts("+-----------+--------------------------+-------+"); + + const char* compiler_name = "unknown"; + switch (compiler) { + case MSTR_BUILD_CC_MSVC: compiler_name = "msvc"; break; + case MSTR_BUILD_CC_GNUC: compiler_name = "gcc"; break; + case MSTR_BUILD_CC_ARMCC: compiler_name = "armcc"; break; + case MSTR_BUILD_CC_ARMCLANG: compiler_name = "armclang"; break; + case MSTR_BUILD_CC_EMSCRIPTEN: compiler_name = "emscripten"; break; + case MSTR_BUILD_CC_OTHER: compiler_name = "unknown"; break; + } + printf("| Compiler | %-24s | --- |\n", compiler_name); + + puts("+-----------+--------------------------+-------+"); + + printf( + "| Configure | %-24s | %5s |\n", + "_MSTR_USE_MALLOC", + BOOL2STR(BIT_TEST(cfg, MSTRCFG_USE_MALLOC_BIT)) + ); + printf( + "| | %-24s | %5s |\n", + "_MSTR_BUILD_DLL", + BOOL2STR(BIT_TEST(cfg, MSTRCFG_BUILD_DLL_BIT)) + ); + printf( + "| | %-24s | %5s |\n", + "_MSTR_USE_HARDWARE_DIV", + BOOL2STR(BIT_TEST(cfg, MSTRCFG_BUILD_HARDWARE_DIV)) + ); + printf( + "| | %-24s | %5s |\n", + "_MSTR_USE_STD_IO", + BOOL2STR(BIT_TEST(cfg, MSTRCFG_USE_STD_IO)) + ); + printf( + "| | %-24s | %5s |\n", + "_MSTR_USE_UTF_8", + BOOL2STR(BIT_TEST(cfg, MSTRCFG_USE_UTF_8)) + ); + printf( + "| | %-24s | %5s |\n", + "_MSTR_USE_CPP_EXCEPTION", + BOOL2STR(BIT_TEST(cfg, MSTRCFG_USE_CXX_EXCEPTION)) + ); + printf( + "| | %-24s | %5s |\n", + "_MSTR_USE_FP_FLOAT32", + BOOL2STR(BIT_TEST(cfg, MSTRCFG_USE_FLOAT32)) + ); + printf( + "| | %-24s | %5s |\n", + "_MSTR_USE_FP_FLOAT64", + BOOL2STR(BIT_TEST(cfg, MSTRCFG_USE_FLOAT64)) + ); + printf( + "| | %-24s | %5s |\n", + "_MSTR_USE_ALLOC", + BOOL2STR(BIT_TEST(cfg, MSTRCFG_USE_ALLOCATOR)) + ); + + puts("+-----------+--------------------------+-------+"); + + return 0; +} diff --git a/recipes/mtfmt/config.yml b/recipes/mtfmt/config.yml new file mode 100644 index 0000000000000..b7f57204004e4 --- /dev/null +++ b/recipes/mtfmt/config.yml @@ -0,0 +1,3 @@ +versions: + "0.1.3": + folder: all diff --git a/recipes/mujs/all/conandata.yml b/recipes/mujs/all/conandata.yml index 8b8c95eb04cf4..eb2092fbfdd74 100644 --- a/recipes/mujs/all/conandata.yml +++ b/recipes/mujs/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "1.3.5": + url: "https://mujs.com/downloads/mujs-1.3.5.tar.gz" + sha256: "78a311ae4224400774cb09ef5baa2633c26971513f8b931d3224a0eb85b13e0b" + "1.3.4": + url: "https://mujs.com/downloads/mujs-1.3.4.tar.gz" + sha256: "c015475880f6a382e706169c94371a7dd6cc22078832f6e0865af8289c2ef42b" "1.1.2": url: "https://mujs.com/downloads/mujs-1.1.2.tar.xz" sha256: "719e882bb7d98640efa163381e9b68ef1ce35c87a422e2aa4190c9e40225875d" diff --git a/recipes/mujs/all/conanfile.py b/recipes/mujs/all/conanfile.py index b9be736a9eeb6..9a9dbc2ba3805 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,10 @@ 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") - homepage = "https://mujs.com" url = "https://github.com/conan-io/conan-center-index" - + homepage = "https://mujs.com" + topics = ("interpreter", "javascript") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -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/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/mujs/config.yml b/recipes/mujs/config.yml index 8d13aefb6b4fb..233cb2080473e 100644 --- a/recipes/mujs/config.yml +++ b/recipes/mujs/config.yml @@ -1,3 +1,7 @@ versions: + "1.3.5": + folder: all + "1.3.4": + folder: all "1.1.2": folder: all diff --git a/recipes/muparser/all/conanfile.py b/recipes/muparser/all/conanfile.py index e0e300577d42b..2de9bbd1cb080 100644 --- a/recipes/muparser/all/conanfile.py +++ b/recipes/muparser/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.53.0" +required_conan_version = ">=1.54.0" class MuParserConan(ConanFile): @@ -17,6 +16,7 @@ class MuParserConan(ConanFile): topics = ("math", "parser",) description = "Fast Math Parser Library" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -41,21 +41,16 @@ def layout(self): cmake_layout(self, src_folder="src") def validate(self): - if self.info.settings.compiler.get_safe("cppstd"): + if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, 11) - if self.info.options.with_openmp: - self.output.warn("Conan package for OpenMP is not available, this package will be used from system.") 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["ENABLE_SAMPLES"] = False tc.variables["ENABLE_OPENMP"] = self.options.with_openmp - # 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): @@ -78,6 +73,8 @@ def package_info(self): self.cpp_info.libs = ["muparser"] if not self.options.shared: self.cpp_info.defines = ["MUPARSER_STATIC=1"] - libcxx = tools_legacy.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/muparserx/all/conandata.yml b/recipes/muparserx/all/conandata.yml index 9f14a4951a1b8..10adc43806fcb 100644 --- a/recipes/muparserx/all/conandata.yml +++ b/recipes/muparserx/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "4.0.12": + url: "https://github.com/beltoforion/muparserx/archive/v4.0.12.tar.gz" + sha256: "941c79f9b8b924f2f22406af8587177b4b185da3c968dbe8dc371b9dbe117f6e" "4.0.8": 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 565601842d1b8..c9fef57283987 100644 --- a/recipes/muparserx/all/conanfile.py +++ b/recipes/muparserx/all/conanfile.py @@ -1,6 +1,7 @@ from conan import ConanFile 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 required_conan_version = ">=1.53.0" @@ -11,9 +12,10 @@ class MuparserxConan(ConanFile): description = "A C++ Library for Parsing Expressions with Strings, Complex Numbers, Vectors, Matrices and more" license = "BSD-2-Clause" topics = ("math", "parser") - homepage = "https://beltoforion.de/article.php?a=muparserx" + homepage = "https://beltoforion.de/en/muparserx" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -36,8 +38,7 @@ 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,7 +63,10 @@ def build(self): cmake.build() def package(self): - copy(self, "License.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + if Version(self.version) < "4.0.10": + copy(self, "License.txt", self.source_folder, os.path.join(self.package_folder, "licenses")) + else: + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) cmake = CMake(self) cmake.install() rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) diff --git a/recipes/muparserx/config.yml b/recipes/muparserx/config.yml index 5bcadc3524910..fe34cc95b4902 100644 --- a/recipes/muparserx/config.yml +++ b/recipes/muparserx/config.yml @@ -1,3 +1,5 @@ versions: + "4.0.12": + folder: all "4.0.8": folder: all diff --git a/recipes/naive-tsearch/all/CMakeLists.txt b/recipes/naive-tsearch/all/CMakeLists.txt deleted file mode 100644 index bd3083b512cb9..0000000000000 --- a/recipes/naive-tsearch/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/naive-tsearch/all/conandata.yml b/recipes/naive-tsearch/all/conandata.yml index fe6850061cde2..f2b6946fce0e4 100644 --- a/recipes/naive-tsearch/all/conandata.yml +++ b/recipes/naive-tsearch/all/conandata.yml @@ -1,7 +1,7 @@ sources: - "0.1.0": - url: "https://github.com/kulp/naive-tsearch/releases/download/v0.1.0/naive-tsearch-0.1.0.tar.xz" - sha256: "0e45b7ffb5ff98dce56c4e01365905158843f4c75e6bf1061774153f3c63a2a4" "0.1.1": url: "https://github.com/kulp/naive-tsearch/releases/download/v0.1.1/naive-tsearch-0.1.1.tar.xz" sha256: "cb779326a8748fb527ab2f4d199923c92dc7d120988b45400d4b31fd77288a1b" + "0.1.0": + url: "https://github.com/kulp/naive-tsearch/releases/download/v0.1.0/naive-tsearch-0.1.0.tar.xz" + sha256: "0e45b7ffb5ff98dce56c4e01365905158843f4c75e6bf1061774153f3c63a2a4" diff --git a/recipes/naive-tsearch/all/conanfile.py b/recipes/naive-tsearch/all/conanfile.py index 18e7d263339e4..d8bcafaf23b02 100644 --- a/recipes/naive-tsearch/all/conanfile.py +++ b/recipes/naive-tsearch/all/conanfile.py @@ -1,16 +1,19 @@ -from conans import CMake, ConanFile, tools +from conan import ConanFile +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 NaiveTsearchConan(ConanFile): name = "naive-tsearch" description = "A simple tsearch() implementation for platforms without one" - topics = ("conan", "naive-tsearch", "tsearch", "search", "tree", "msvc") license = "MIT" - homepage = "https://github.com/kulp/naive-tsearch" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/kulp/naive-tsearch" + topics = ("tsearch", "search", "tree", "msvc") + package_type = 'static-library' settings = "os", "arch", "compiler", "build_type" - exports_sources = ["CMakeLists.txt"] options = { "fPIC": [True, False], "header_only": [True, False], @@ -19,60 +22,73 @@ class NaiveTsearchConan(ConanFile): "fPIC": True, "header_only": 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 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.header_only: + self.package_type = 'header-library' + + def layout(self): + cmake_layout(self, src_folder="src") + + def package_id(self): + if self.info.options.header_only: + self.info.clear() + else: + del self.info.options.header_only 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 _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["NAIVE_TSEARCH_INSTALL"] = True - self._cmake.configure() - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["NAIVE_TSEARCH_INSTALL"] = True + tc.variables["NAIVE_TSEARCH_TESTS"] = False + tc.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, 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")) - - def package_id(self): - del self.info.options.header_only + rmdir(self, os.path.join(self.package_folder, "share")) + if self.options.header_only: + rmdir(self, os.path.join(self.package_folder, "lib")) + rm(self, "tsearch.h", os.path.join(self.package_folder, "include", "naive-tsearch")) + else: + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "tsearch_hdronly.h", os.path.join(self.package_folder, "include", "naive-tsearch")) + rm(self, "tsearch.c.inc", os.path.join(self.package_folder, "include", "naive-tsearch")) def package_info(self): if self.options.header_only: self.cpp_info.components["header_only"].libs = [] self.cpp_info.components["header_only"].libdirs = [] + self.cpp_info.components["header_only"].bindirs = [] self.cpp_info.components["header_only"].includedirs.append(os.path.join("include", "naive-tsearch")) self.cpp_info.components["header_only"].defines = ["NAIVE_TSEARCH_HDRONLY"] - self.cpp_info.components["header_only"].names["cmake_find_package"] = "naive-tsearch-hdronly" - self.cpp_info.components["header_only"].names["cmake_find_package_multi"] = "naive-tsearch-hdronly" + self.cpp_info.components["header_only"].set_property("cmake_target_name", "naive-tsearch::naive-tsearch-hdronly") + self.cpp_info.components["header_only"].set_property("pkg_config_name", "naive-tsearch") else: self.cpp_info.components["naive_tsearch"].libs = ["naive-tsearch"] self.cpp_info.components["naive_tsearch"].includedirs.append(os.path.join("include", "naive-tsearch")) + self.cpp_info.components["naive_tsearch"].set_property("cmake_target_name", "naive-tsearch::naive-tsearch") + self.cpp_info.components["naive_tsearch"].set_property("pkg_config_name", "naive-tsearch") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + if self.options.header_only: + self.cpp_info.components["header_only"].names["cmake_find_package"] = "naive-tsearch-hdronly" + self.cpp_info.components["header_only"].names["cmake_find_package_multi"] = "naive-tsearch-hdronly" + else: self.cpp_info.components["naive_tsearch"].names["cmake_find_package"] = "naive-tsearch" self.cpp_info.components["naive_tsearch"].names["cmake_find_package_multi"] = "naive-tsearch" diff --git a/recipes/naive-tsearch/all/test_package/CMakeLists.txt b/recipes/naive-tsearch/all/test_package/CMakeLists.txt index 3a403dc404b41..23cf15ed79338 100644 --- a/recipes/naive-tsearch/all/test_package/CMakeLists.txt +++ b/recipes/naive-tsearch/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(naive-tsearch REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +if(TARGET naive-tsearch::naive-tsearch-hdronly) + target_link_libraries(${PROJECT_NAME} PRIVATE naive-tsearch::naive-tsearch-hdronly) +else() + target_link_libraries(${PROJECT_NAME} PRIVATE naive-tsearch::naive-tsearch) +endif() diff --git a/recipes/naive-tsearch/all/test_package/conanfile.py b/recipes/naive-tsearch/all/test_package/conanfile.py index bd7165a553cf4..e845ae751a301 100644 --- a/recipes/naive-tsearch/all/test_package/conanfile.py +++ b/recipes/naive-tsearch/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/naive-tsearch/all/test_v1_package/CMakeLists.txt b/recipes/naive-tsearch/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..be00a8c7f57c7 --- /dev/null +++ b/recipes/naive-tsearch/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/naive-tsearch/all/test_v1_package/conanfile.py b/recipes/naive-tsearch/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/naive-tsearch/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/naive-tsearch/config.yml b/recipes/naive-tsearch/config.yml index 06eee83c5fb24..2b7d871e4c96b 100644 --- a/recipes/naive-tsearch/config.yml +++ b/recipes/naive-tsearch/config.yml @@ -1,5 +1,5 @@ versions: - "0.1.0": - folder: "all" "0.1.1": folder: "all" + "0.1.0": + folder: "all" diff --git a/recipes/namedtype/all/conanfile.py b/recipes/namedtype/all/conanfile.py index 4844119896966..14c646bee4f47 100644 --- a/recipes/namedtype/all/conanfile.py +++ b/recipes/namedtype/all/conanfile.py @@ -1,7 +1,13 @@ -import glob +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 NamedTypeConan(ConanFile): @@ -11,53 +17,61 @@ class NamedTypeConan(ConanFile): homepage = "https://github.com/joboccara/NamedType" description = "Implementation of strong types in C++" topics = ("strong types", "header-only") - settings = "compiler" + package_type = "header-library" + 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]) - extracted_dir = glob.glob("NamedType-*")[0] - os.rename(extracted_dir, self._source_subfolder) - - @property - def _minimum_cpp_standard(self): + def _min_cppstd(self): return 14 @property - def _minimum_compilers_version(self): + def _compilers_minimum_version(self): return { "Visual Studio": "15", + "msvc": "191", "gcc": "5", "clang": "3.4", "apple-clang": "5.1", } - 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.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)) + 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) if self.version == "20190324": - self.copy("*.hpp", dst=os.path.join("include", "NamedType"), src=self._source_subfolder) + copy( + self, + pattern="*.hpp", + dst=os.path.join(self.package_folder, "include", "NamedType"), + src=self.source_folder, + ) else: - 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", + 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.version == "20190324": self.cpp_info.includedirs.append(os.path.join("include", "NamedType")) - - def package_id(self): - self.info.header_only() diff --git a/recipes/namedtype/all/test_package/CMakeLists.txt b/recipes/namedtype/all/test_package/CMakeLists.txt index 028621de157e0..c88bbff306fb5 100644 --- a/recipes/namedtype/all/test_package/CMakeLists.txt +++ b/recipes/namedtype/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(namedtype REQUIRED CONFIG) -add_executable(main main.cpp) -target_link_libraries(main ${CONAN_LIBS}) -set_property(TARGET main PROPERTY CXX_STANDARD 14) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE namedtype::namedtype) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/namedtype/all/test_package/conanfile.py b/recipes/namedtype/all/test_package/conanfile.py index 19d05dfdde2b7..e845ae751a301 100644 --- a/recipes/namedtype/all/test_package/conanfile.py +++ b/recipes/namedtype/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/namedtype/all/test_package/main.cpp b/recipes/namedtype/all/test_package/test_package.cpp similarity index 100% rename from recipes/namedtype/all/test_package/main.cpp rename to recipes/namedtype/all/test_package/test_package.cpp diff --git a/recipes/namedtype/all/test_v1_package/CMakeLists.txt b/recipes/namedtype/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..9d54a092e0a67 --- /dev/null +++ b/recipes/namedtype/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/namedtype/all/test_v1_package/conanfile.py b/recipes/namedtype/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/namedtype/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/nameof/all/conandata.yml b/recipes/nameof/all/conandata.yml index c80396081f89b..53cdec57f34dc 100644 --- a/recipes/nameof/all/conandata.yml +++ b/recipes/nameof/all/conandata.yml @@ -1,13 +1,19 @@ sources: - "0.9.4": - sha256: d23505104ce94474318976af8ce334e6891ef0b3927dfa1bc64484f701072aae - url: https://github.com/Neargye/nameof/archive/v0.9.4.tar.gz - "0.10.0": - sha256: 9c4eaaa795ebbdb5d87952b5280d9eb0ca2d1eaab3bac98a296cb1b74f8e673c - url: https://github.com/Neargye/nameof/archive/v0.10.0.tar.gz - "0.10.1": - url: "https://github.com/Neargye/nameof/archive/v0.10.1.tar.gz" - sha256: "000a55de58fb57cd77043ab9e91a3c91dbea5947b2cb0034cddf869ecf16e86d" + "0.10.4": + url: "https://github.com/Neargye/nameof/archive/v0.10.4.tar.gz" + sha256: "b67ed2155a32760067eee0d33c727b9badfd8c12393ebbe3b7ab219b4faa0149" + "0.10.3": + url: "https://github.com/Neargye/nameof/archive/v0.10.3.tar.gz" + sha256: "f31dd02841adfbb98949454005a308174645957d2b8d4dc06a7c15e1039e46e6" "0.10.2": url: "https://github.com/Neargye/nameof/archive/v0.10.2.tar.gz" sha256: "b596fd0804c61781bc8d87d9b8e448e2450debddb52c70ed3e89bf02c6c16f4f" + "0.10.1": + url: "https://github.com/Neargye/nameof/archive/v0.10.1.tar.gz" + sha256: "000a55de58fb57cd77043ab9e91a3c91dbea5947b2cb0034cddf869ecf16e86d" + "0.10.0": + url: "https://github.com/Neargye/nameof/archive/v0.10.0.tar.gz" + sha256: "9c4eaaa795ebbdb5d87952b5280d9eb0ca2d1eaab3bac98a296cb1b74f8e673c" + "0.9.4": + url: "https://github.com/Neargye/nameof/archive/v0.9.4.tar.gz" + sha256: "d23505104ce94474318976af8ce334e6891ef0b3927dfa1bc64484f701072aae" diff --git a/recipes/nameof/all/conanfile.py b/recipes/nameof/all/conanfile.py index 640713e2839c3..eeff71754920a 100644 --- a/recipes/nameof/all/conanfile.py +++ b/recipes/nameof/all/conanfile.py @@ -1,60 +1,78 @@ +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 CMake, ConanFile, tools -from conans.errors import ConanInvalidConfiguration -from conans.tools import Version +required_conan_version = ">=1.52.0" class NameofConan(ConanFile): name = "nameof" + description = "Header-only C++17 library provides nameof macros and functions to simply obtain the name of a variable, type, function, macro, and enum." + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/Neargye/nameof" - license = "MIT" - description = "Header-only C++17 library provides nameof macros and functions to simply obtain the name of a variable, type, function, macro, and enum." topics = ( - "conan", - "nameof", - "cplusplus", "enum-to-string", "serialization", "reflection", "header-only", "compile-time" ) + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - settings = "compiler" @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 14 @property - def _supported_compiler(self): - compiler = str(self.settings.compiler) - version = tools.Version(self.settings.compiler.version) - if compiler == "Visual Studio" and version >= "15": - return True - if compiler == "gcc" and version >= "7.4": - return True - if compiler == "clang" and version >= "5": - return True - if compiler == "apple-clang" and version >= "9": - return True - return False + def _compilers_minimum_version(self): + return { + "gcc": "9", + "clang": "5", + "apple-clang": "9", + "Visual Studio": "15.3", + "msvc": "191", + } - 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 layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() - def configure(self): + def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, "17") - if not self._supported_compiler: - raise ConanInvalidConfiguration("nameof: Unsupported compiler (https://github.com/Neargye/nameof#compiler-compatibility).") + 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 package(self): - self.copy("nameof.hpp", dst="include", src=os.path.join(self._source_subfolder, "include")) - 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) + copy( + self, + pattern="nameof.hpp", + 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/nameof/all/test_package/CMakeLists.txt b/recipes/nameof/all/test_package/CMakeLists.txt index 6c1d84c7e3d82..0e0eb7cf71e17 100644 --- a/recipes/nameof/all/test_package/CMakeLists.txt +++ b/recipes/nameof/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(nameof 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 nameof::nameof) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/nameof/all/test_package/conanfile.py b/recipes/nameof/all/test_package/conanfile.py index a59a26a52c8dc..b4ff34dc80ca1 100644 --- a/recipes/nameof/all/test_package/conanfile.py +++ b/recipes/nameof/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" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self, src_folder=".") + + 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 can_run(self): + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/nameof/all/test_v1_package/CMakeLists.txt b/recipes/nameof/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..be00a8c7f57c7 --- /dev/null +++ b/recipes/nameof/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/nameof/all/test_v1_package/conanfile.py b/recipes/nameof/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/nameof/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/nameof/config.yml b/recipes/nameof/config.yml index da915b86fd4a9..480d6a637aced 100644 --- a/recipes/nameof/config.yml +++ b/recipes/nameof/config.yml @@ -1,9 +1,13 @@ versions: - "0.9.4": + "0.10.4": folder: "all" - "0.10.0": + "0.10.3": + folder: "all" + "0.10.2": folder: "all" "0.10.1": folder: "all" - "0.10.2": + "0.10.0": + folder: "all" + "0.9.4": folder: "all" diff --git a/recipes/nanobench/all/conandata.yml b/recipes/nanobench/all/conandata.yml index b2980ea2da211..3806111c8079d 100644 --- a/recipes/nanobench/all/conandata.yml +++ b/recipes/nanobench/all/conandata.yml @@ -1,16 +1,29 @@ 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.11": + url: "https://github.com/martinus/nanobench/archive/v4.3.11.tar.gz" + sha256: "53a5a913fa695c23546661bf2cd22b299e10a3e994d9ed97daf89b5cada0da70" + "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..7697075d83fd1 100644 --- a/recipes/nanobench/all/conanfile.py +++ b/recipes/nanobench/all/conanfile.py @@ -1,33 +1,54 @@ +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") + package_type = "header-library" + 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..226032b8ed3b2 100644 --- a/recipes/nanobench/config.yml +++ b/recipes/nanobench/config.yml @@ -1,11 +1,15 @@ versions: - "4.0.0": + "4.3.11": folder: "all" - "4.3.0": + "4.3.9": folder: "all" - "4.3.5": + "4.3.7": folder: "all" "4.3.6": folder: "all" - "4.3.7": + "4.3.5": + folder: "all" + "4.3.0": + folder: "all" + "4.0.0": folder: "all" diff --git a/recipes/nanodbc/all/CMakeLists.txt b/recipes/nanodbc/all/CMakeLists.txt deleted file mode 100644 index 6ba47d078b389..0000000000000 --- a/recipes/nanodbc/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/nanodbc/all/conandata.yml b/recipes/nanodbc/all/conandata.yml index 60ad84e0835de..c6835a8c270b4 100644 --- a/recipes/nanodbc/all/conandata.yml +++ b/recipes/nanodbc/all/conandata.yml @@ -1,26 +1,25 @@ sources: - "cci.20200807": - url: "https://github.com/nanodbc/nanodbc/archive/ab8d176262f92d5f75aa2d441bfce27041032201.zip" - sha256: "9de057ae6e8d0b9192df1d16ccc70ce7525ca9fe52e56fa8d13cfae9206f8286" - "2.13.0": - url: "https://github.com/nanodbc/nanodbc/archive/v2.13.0.zip" - sha256: "1287869b6ca82728cb6cc53c54f836c72cde15370c16f32d81c9ef6c257f7e43" "2.14.0": url: "https://github.com/nanodbc/nanodbc/archive/v2.14.0.tar.gz" sha256: "56228372042b689beccd96b0ac3476643ea85b3f57b3f23fb11ca4314e68b9a5" + "2.13.0": + url: "https://github.com/nanodbc/nanodbc/archive/v2.13.0.zip" + sha256: "1287869b6ca82728cb6cc53c54f836c72cde15370c16f32d81c9ef6c257f7e43" patches: - "cci.20200807": + "2.14.0": - patch_file: "patches/0001-odbc-from-cci.patch" - base_path: "source_subfolder" + patch_description: "Allow compilation on CI with ODBC library" + patch_type: "portability" - patch_file: "patches/0002-allow-windows-shared.patch" - base_path: "source_subfolder" + patch_description: "Allow windows to compile shared libraries" + patch_type: "portability" "2.13.0": - patch_file: "patches/0001-odbc-from-cci.patch" - base_path: "source_subfolder" - - patch_file: "patches/0002-allow-windows-shared.patch" - base_path: "source_subfolder" - "2.14.0": - - patch_file: "patches/0001-odbc-from-cci.patch" - base_path: "source_subfolder" + patch_description: "Allow compilation on CI with ODBC library" + patch_type: "portability" - patch_file: "patches/0002-allow-windows-shared.patch" - base_path: "source_subfolder" + patch_description: "Allow windows to compile shared libraries" + patch_type: "portability" + - patch_file: "patches/0003-add-missing-include.patch" + patch_description: "Add missing include to fix compilation" + patch_type: "portability" diff --git a/recipes/nanodbc/all/conanfile.py b/recipes/nanodbc/all/conanfile.py index 44cbf934e3a4d..c0ece80748978 100644 --- a/recipes/nanodbc/all/conanfile.py +++ b/recipes/nanodbc/all/conanfile.py @@ -1,18 +1,23 @@ -from conans import CMake, ConanFile, tools -from conans.errors import ConanInvalidConfiguration -import glob +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMakeToolchain, CMakeDeps, CMake, 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.53.0" + class NanodbcConan(ConanFile): name = "nanodbc" description = "A small C++ wrapper for the native C ODBC API" - topics = ("conan", "nanodbc", "odbc", "database") + topics = ("odbc", "database") license = "MIT" homepage = "https://github.com/nanodbc/nanodbc/" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" - exports_sources = "CMakeLists.txt", "patches/**" options = { "shared": [True, False], "fPIC": [True, False], @@ -27,78 +32,99 @@ class NanodbcConan(ConanFile): "unicode": False, "with_boost": False, } - 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": del self.options.fPIC - _compiler_cxx14 = { - "gcc": 5, - "clang": "3.4", - "Visual Studio": 14, - "apple-clang": "9.1", # FIXME: wild guess - } - def configure(self): if self.options.shared: - del self.options.fPIC - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 14) - _minimum_compiler = self._compiler_cxx14.get(str(self.settings.compiler)) - if _minimum_compiler: - if tools.Version(self.settings.compiler.version) < _minimum_compiler: - raise ConanInvalidConfiguration("nanodbc requires c++14, which your compiler does not support") - else: - self.output.warn("nanodbc requires c++14, but is unknown to this recipe. Assuming your compiler supports c++14.") + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + + @property + def _min_cppstd(self): + return 14 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "5", + "clang": "3.4", + "Visual Studio": "14", + "msvc": "190", + "apple-clang": "9.1", # FIXME: this is a guess + } def requirements(self): if self.options.with_boost: - self.requires("boost/1.76.0") + self.requires("boost/1.83.0") if self.settings.os != "Windows": - self.requires("odbc/2.3.9") + self.requires("odbc/2.3.11") + + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, 14) + + 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.compiler == "apple-clang" and Version(self.version) < "2.14.0": + raise ConanInvalidConfiguration(""" + `apple-clang` compilation is supported only for version 2.14.0 and up. + See https://github.com/nanodbc/nanodbc/issues/274 for more details. + """) def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename(glob.glob("nanodbc-*")[0], self._source_subfolder) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["NANODBC_DISABLE_ASYNC"] = not self.options.get_safe("async") - self._cmake.definitions["NANODBC_ENABLE_UNICODE"] = self.options.unicode - self._cmake.definitions["NANODBC_ENABLE_BOOST"] = self.options.with_boost - self._cmake.definitions["NANODBC_DISABLE_LIBCXX"] = self.settings.get_safe("compiler.libcxx") != "libc++" - - self._cmake.definitions["NANODBC_DISABLE_INSTALL"] = False - self._cmake.definitions["NANODBC_DISABLE_EXAMPLES"] = True - self._cmake.definitions["NANODBC_DISABLE_TESTS"] = True - self._cmake.configure() - return self._cmake + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["NANODBC_DISABLE_ASYNC"] = not self.options.get_safe("async") + tc.cache_variables["NANODBC_ENABLE_UNICODE"] = self.options.unicode + tc.cache_variables["NANODBC_ENABLE_BOOST"] = self.options.with_boost + tc.cache_variables["NANODBC_DISABLE_LIBCXX"] = self.settings.get_safe("compiler.libcxx") != "libc++" + tc.cache_variables["NANODBC_DISABLE_INSTALL"] = False + tc.cache_variables["NANODBC_DISABLE_EXAMPLES"] = True + tc.cache_variables["NANODBC_DISABLE_TESTS"] = True + tc.cache_variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + tc.generate() + + deps = CMakeDeps(self) + deps.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + # No warnings as errors + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "-Werror", "") 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() + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + + rmdir(self, os.path.join(self.package_folder, "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): + self.cpp_info.set_property("cmake_file_name", "nanodbc") + self.cpp_info.set_property("cmake_target_name", "nanodbc::nanodbc") self.cpp_info.libs = ["nanodbc"] - if not self.options.shared: - if self.settings.os == "Windows": - self.cpp_info.system_libs = ["odbc32"] + + if not self.options.shared and self.settings.os == "Windows": + self.cpp_info.system_libs = ["odbc32"] diff --git a/recipes/nanodbc/all/patches/0001-odbc-from-cci.patch b/recipes/nanodbc/all/patches/0001-odbc-from-cci.patch index f5a355e45690b..5ab0d54e37333 100644 --- a/recipes/nanodbc/all/patches/0001-odbc-from-cci.patch +++ b/recipes/nanodbc/all/patches/0001-odbc-from-cci.patch @@ -9,18 +9,19 @@ # Try to find unixODBC first via odbc_config program. find_program(ODBC_CONFIG odbc_config PATHS $ENV{ODBC_PATH}/bin /usr/bin /usr/local/bin) -@@ -171,8 +171,8 @@ +@@ -171,8 +171,9 @@ ## find ODBC libraries to link ######################################## if(UNIX) - set(ODBC_LIBRARIES ${ODBCLIB}) - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${ODBC_LINK_FLAGS}") -+ set(ODBC_LIBRARIES CONAN_PKG::odbc) ++ find_package(ODBC REQUIRED CONFIG) ++ set(ODBC_LIBRARIES ODBC::ODBC) + #set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${ODBC_LINK_FLAGS}") elseif(MSVC OR CMAKE_CXX_COMPILER_ID MATCHES "Intel") set(ODBC_LIBRARIES odbc32.lib odbccp32.lib Ws2_32.lib) elseif(MINGW) -@@ -188,7 +188,7 @@ +@@ -188,7 +189,7 @@ find_package(Boost COMPONENTS locale REQUIRED) if(Boost_FOUND) include_directories(${Boost_INCLUDE_DIRS}) diff --git a/recipes/nanodbc/all/patches/0002-allow-windows-shared.patch b/recipes/nanodbc/all/patches/0002-allow-windows-shared.patch index 5ab2c375b7053..5c996393bca3b 100644 --- a/recipes/nanodbc/all/patches/0002-allow-windows-shared.patch +++ b/recipes/nanodbc/all/patches/0002-allow-windows-shared.patch @@ -1,6 +1,6 @@ --- CMakeLists.txt +++ CMakeLists.txt -@@ -215,9 +215,9 @@ else() +@@ -216,9 +216,9 @@ else() message(STATUS "nanodbc build: Enable nanodbc target - STATIC") endif() diff --git a/recipes/nanodbc/all/patches/0003-add-missing-include.patch b/recipes/nanodbc/all/patches/0003-add-missing-include.patch new file mode 100644 index 0000000000000..6c70a6f9a9d0b --- /dev/null +++ b/recipes/nanodbc/all/patches/0003-add-missing-include.patch @@ -0,0 +1,10 @@ +--- a/nanodbc/nanodbc.cpp ++++ b/nanodbc/nanodbc.cpp +@@ -23,6 +23,7 @@ + #include + #include + #include ++#include + #include + #include + diff --git a/recipes/nanodbc/all/test_package/CMakeLists.txt b/recipes/nanodbc/all/test_package/CMakeLists.txt index f6bbde9919354..0f37b02603638 100644 --- a/recipes/nanodbc/all/test_package/CMakeLists.txt +++ b/recipes/nanodbc/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup() +find_package(nanodbc 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 nanodbc::nanodbc) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/nanodbc/all/test_package/conanfile.py b/recipes/nanodbc/all/test_package/conanfile.py index bd7165a553cf4..9153dc938c484 100644 --- a/recipes/nanodbc/all/test_package/conanfile.py +++ b/recipes/nanodbc/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", "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 +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/nanodbc/config.yml b/recipes/nanodbc/config.yml index 35d045402c05f..ccdd596aaff35 100644 --- a/recipes/nanodbc/config.yml +++ b/recipes/nanodbc/config.yml @@ -1,7 +1,5 @@ versions: - "cci.20200807": + "2.14.0": folder: "all" "2.13.0": folder: "all" - "2.14.0": - folder: "all" diff --git a/recipes/nanoflann/all/conandata.yml b/recipes/nanoflann/all/conandata.yml index c3fd08f9f02f0..9d51335bc5f52 100644 --- a/recipes/nanoflann/all/conandata.yml +++ b/recipes/nanoflann/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "1.6.0": + url: "https://github.com/jlblancoc/nanoflann/archive/v1.6.0.tar.gz" + sha256: "f889026fbcb241e1e9d71bab5dfb9cc35775bf18a6466a283e2cbcd60edb2705" + "1.5.2": + url: "https://github.com/jlblancoc/nanoflann/archive/v1.5.2.tar.gz" + sha256: "2adcea7821445119a7a4f83c27abd56dba963e1e9c05a3f58bdb2273ae1b4698" + "1.5.0": + url: "https://github.com/jlblancoc/nanoflann/archive/v1.5.0.tar.gz" + sha256: "89aecfef1a956ccba7e40f24561846d064f309bc547cc184af7f4426e42f8e65" "1.4.3": url: "https://github.com/jlblancoc/nanoflann/archive/v1.4.3.tar.gz" sha256: "cbcecf22bec528a8673a113ee9b0e134f91f1f96be57e913fa1f74e98e4449fa" diff --git a/recipes/nanoflann/all/conanfile.py b/recipes/nanoflann/all/conanfile.py index 5e499d9aae48d..90669ce351aaf 100644 --- a/recipes/nanoflann/all/conanfile.py +++ b/recipes/nanoflann/all/conanfile.py @@ -9,17 +9,20 @@ class NanoflannConan(ConanFile): name = "nanoflann" - description = """nanoflann is a C++11 header-only library for building KD-Trees - of datasets with different topologies: R2, R3 (point clouds), - SO(2) and SO(3) (2D and 3D rotation groups). - """ - topics = ("nanoflann", "nearest-neighbor", "kd-trees") + description = ("nanoflann is a C++11 header-only library for building KD-Trees" + " of datasets with different topologies: R2, R3 (point clouds)," + " SO(2) and SO(3) (2D and 3D rotation groups).") + topics = ("flann", "nearest-neighbor", "kd-trees") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/jlblancoc/nanoflann" license = "BSD-2-Clause" + package_type = "header-library" 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() @@ -27,12 +30,8 @@ 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def build(self): pass @@ -47,6 +46,7 @@ def package_info(self): self.cpp_info.set_property("cmake_target_name", "nanoflann::nanoflann") self.cpp_info.set_property("pkg_config_name", "nanoflann") self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] + if self.settings.os in ("Linux", "FreeBSD"): + # If we ever support NANOFLANN_NO_THREADS, there would be no need to add this if set + self.cpp_info.system_libs.append("pthread") diff --git a/recipes/nanoflann/all/test_package/conanfile.py b/recipes/nanoflann/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/nanoflann/all/test_package/conanfile.py +++ b/recipes/nanoflann/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/nanoflann/config.yml b/recipes/nanoflann/config.yml index abdc53043545d..43ca2b954f0dc 100644 --- a/recipes/nanoflann/config.yml +++ b/recipes/nanoflann/config.yml @@ -1,4 +1,10 @@ versions: + "1.6.0": + folder: "all" + "1.5.2": + folder: "all" + "1.5.0": + folder: "all" "1.4.3": folder: "all" "1.4.2": diff --git a/recipes/nanomsg/all/conandata.yml b/recipes/nanomsg/all/conandata.yml new file mode 100644 index 0000000000000..dbc431024b1fd --- /dev/null +++ b/recipes/nanomsg/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "1.2.1": + url: "https://github.com/nanomsg/nanomsg/archive/refs/tags/1.2.1.tar.gz" + sha256: "2e6c20dbfcd4882e133c819ac77501e9b323cb17ae5b3376702c4446261fbc23" + "1.2": + url: "https://github.com/nanomsg/nanomsg/archive/refs/tags/1.2.tar.gz" + sha256: "6ef7282e833df6a364f3617692ef21e59d5c4878acea4f2d7d36e21c8858de67" diff --git a/recipes/nanomsg/all/conanfile.py b/recipes/nanomsg/all/conanfile.py new file mode 100644 index 0000000000000..851ab78f2038e --- /dev/null +++ b/recipes/nanomsg/all/conanfile.py @@ -0,0 +1,102 @@ +from conan import ConanFile +from conan.tools.files import get, copy, rm, rmdir +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.env import VirtualBuildEnv +import os + + +required_conan_version = ">=1.53.0" + +class NanomsgConan(ConanFile): + name = "nanomsg" + description = "A socket library that provides several common communication patterns." + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/nanomsg/nanomsg" + topics = ("socket", "protocols", "communication") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "enable_coverage": [True, False], + "enable_getaddrinfo_a":[True, False], + "enable_tools": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "enable_coverage": False, + "enable_getaddrinfo_a":True, + "enable_tools": 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") + 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) + tc.variables["NN_STATIC_LIB"] = not self.options.shared + tc.variables["NN_ENABLE_COVERAGE"] = self.options.enable_coverage + tc.variables["NN_ENABLE_GETADDRINFO_A"] = self.options.enable_getaddrinfo_a + tc.variables["NN_ENABLE_DOC"] = False + tc.variables["NN_TESTS"] = False + tc.variables["NN_TOOLS"] = self.options.enable_tools + tc.generate() + tc = CMakeDeps(self) + tc.generate() + tc = VirtualBuildEnv(self) + tc.generate(scope="build") + + def build(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() + + 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 = ["nanomsg"] + self.cpp_info.set_property("cmake_file_name", "nanomsg") + self.cpp_info.set_property("cmake_target_name", "nanomsg::nanomsg") + self.cpp_info.set_property("pkg_config_name", "nanomsg") + + if self.settings.os == "Windows" and not self.options.shared: + self.cpp_info.system_libs.extend(["mswsock", "ws2_32", "advapi32"]) + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("pthread") + self.cpp_info.system_libs.append("anl") + self.cpp_info.system_libs.append("rt") + self.cpp_info.system_libs.append("nsl") + + if not self.options.shared: + self.cpp_info.defines.append("NN_STATIC_LIB") + if self.options.enable_coverage: + self.cpp_info.defines.append("NN_ENABLE_COVERAGE") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.names["cmake_find_package"] = "nanomsg" + self.cpp_info.names["cmake_find_package_multi"] = "nanomsg" diff --git a/recipes/nanomsg/all/test_package/CMakeLists.txt b/recipes/nanomsg/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..5ea217a77048d --- /dev/null +++ b/recipes/nanomsg/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package CXX) + +find_package(nanomsg REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE nanomsg::nanomsg) diff --git a/recipes/nanomsg/all/test_package/conanfile.py b/recipes/nanomsg/all/test_package/conanfile.py new file mode 100644 index 0000000000000..f5cf204295e19 --- /dev/null +++ b/recipes/nanomsg/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/nanomsg/all/test_package/test_package.cpp b/recipes/nanomsg/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..38d120fc8ced4 --- /dev/null +++ b/recipes/nanomsg/all/test_package/test_package.cpp @@ -0,0 +1,11 @@ +#include +#include +#include "nanomsg/nn.h" + + +int main(void) { + void *msg = nn_allocmsg(32, 0); + nn_freemsg(msg); + + return EXIT_SUCCESS; +} diff --git a/recipes/nanomsg/config.yml b/recipes/nanomsg/config.yml new file mode 100644 index 0000000000000..faec73d798c80 --- /dev/null +++ b/recipes/nanomsg/config.yml @@ -0,0 +1,5 @@ +versions: + "1.2.1": + folder: all + "1.2": + folder: all diff --git a/recipes/nanorange/all/conandata.yml b/recipes/nanorange/all/conandata.yml index ff7f4d4e2eece..dd45d10d26868 100644 --- a/recipes/nanorange/all/conandata.yml +++ b/recipes/nanorange/all/conandata.yml @@ -1,7 +1,7 @@ sources: - "20191001": - url: "https://github.com/tcbrindle/NanoRange/archive/abc34279d71369527e4da43cc4d02cf77446f79a.tar.gz" - sha256: "799431094ab784eb3cdbcd6de6681ff5d8b2b28e1a1e26e0a3a94fbfbfcd7e75" - "20200505": + "cci.20200706": + url: "https://github.com/tcbrindle/NanoRange/archive/bf32251d65673fe170d602777c087786c529ead8.tar.gz" + sha256: "28cf187174b3097c00aa12cc2a3b554f8f768a3b50a9703174af03ee99c3397c" + "cci.20200505": url: "https://github.com/tcbrindle/NanoRange/archive/a536e2747ba6124f1485dfa6acabca35326b1c5b.tar.gz" sha256: "9c4b71e6d26cbb85c9bf6751e6c0404922f75701984a85c312c4cf5838f89e2c" diff --git a/recipes/nanorange/all/conanfile.py b/recipes/nanorange/all/conanfile.py index f67c20f8d2db7..5cab7bccc7168 100644 --- a/recipes/nanorange/all/conanfile.py +++ b/recipes/nanorange/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 -from conans.tools import Version + +required_conan_version = ">=1.50.0" class NanorangeConan(ConanFile): @@ -11,50 +16,55 @@ class NanorangeConan(ConanFile): homepage = "https://github.com/tcbrindle/NanoRange" description = "NanoRange is a C++17 implementation of the C++20 Ranges proposals (formerly the Ranges TS)." topics = ("ranges", "C++17", "Ranges TS") + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - settings = "compiler" - options = {"deprecation_warnings": [True, False], "std_forward_declarations": [True, False]} - default_options = {"deprecation_warnings": True, "std_forward_declarations": True} @property - def _source_subfolder(self): - return os.path.join(self.source_folder, "source_subfolder") - - def configure(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("nanoRange requires at least c++17") - elif compiler == "Visual Studio": - if version < "16": - raise ConanInvalidConfiguration("NanoRange requires at least Visual Studio version 15.9, please use 16") - if not any([self.settings.compiler.cppstd == std for std in ["17", "20"]]): - raise ConanInvalidConfiguration("nanoRange requires at least c++17") - else: - if ( compiler == "gcc" and version < "7" ) or ( compiler == "clang" and version < "5" ): - raise ConanInvalidConfiguration("NanoRange requires a compiler that supports at least C++17") - elif compiler == "apple-clang": - self.output.warn("NanoRange is not tested with apple-clang") - if version < "10": - raise ConanInvalidConfiguration("NanoRange requires a compiler that supports at least C++17") + def _min_cppstd(self): + return 17 - def source(self): - tools.get(**self.conan_data["sources"][self.version]) - url = self.conan_data["sources"][self.version]["url"] - commit = url[url.rfind("/")+1:url.find(".tar.gz")] - extracted_folder = "NanoRange-" + commit - os.rename(extracted_folder, self._source_subfolder) + @property + def _compilers_minimum_version(self): + return { + "Visual Studio": "16", + "msvc": "192", + "gcc": "7", + "clang": "5", + "apple-clang": "10", + } - def package(self): - self.copy("*.hpp", src=os.path.join(self._source_subfolder, "include"), dst="include") - self.copy("LICENSE_1_0.txt", src=self._source_subfolder, dst="licenses") + 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): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def package(self): + copy(self, pattern="LICENSE_1_0.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): - if not self.options.deprecation_warnings: - self.cpp_info.defines.append("NANORANGE_NO_DEPRECATION_WARNINGS") - if not self.options.std_forward_declarations: - self.cpp_info.defines.append("NANORANGE_NO_STD_FORWARD_DECLARATIONS") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + # https://github.com/tcbrindle/NanoRange/blob/bf32251d65673fe170d602777c087786c529ead8/CMakeLists.txt#L216 + self.cpp_info.set_property("cmake_file_name", "nanorange") + self.cpp_info.set_property("cmake_target_name", "nanorange::nanorange") diff --git a/recipes/nanorange/all/test_package/CMakeLists.txt b/recipes/nanorange/all/test_package/CMakeLists.txt index 49b2a8e3a5ab0..a3383209f6f68 100644 --- a/recipes/nanorange/all/test_package/CMakeLists.txt +++ b/recipes/nanorange/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(PackageTest CXX) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) # if the project uses c++ -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - -add_executable(example example.cpp) -target_link_libraries(example ${CONAN_LIBS}) -set_property( TARGET example PROPERTY CXX_STANDARD 17) -set_property( TARGET example PROPERTY CXX_STANDARD_REQUIRED ON ) +find_package(nanorange REQUIRED CONFIG) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE nanorange::nanorange) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/nanorange/all/test_package/conanfile.py b/recipes/nanorange/all/test_package/conanfile.py index 09e6bcda90f8a..e845ae751a301 100644 --- a/recipes/nanorange/all/test_package/conanfile.py +++ b/recipes/nanorange/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_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 NanorangeTestConan(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) - # 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 = 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/nanorange/all/test_package/example.cpp b/recipes/nanorange/all/test_package/test_package.cpp similarity index 100% rename from recipes/nanorange/all/test_package/example.cpp rename to recipes/nanorange/all/test_package/test_package.cpp diff --git a/recipes/nanorange/all/test_v1_package/CMakeLists.txt b/recipes/nanorange/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..cd41ac7f45757 --- /dev/null +++ b/recipes/nanorange/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +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/nanorange/all/test_v1_package/conanfile.py b/recipes/nanorange/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/nanorange/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/nanorange/config.yml b/recipes/nanorange/config.yml index de48711a5644d..f8f01f0c1204d 100644 --- a/recipes/nanorange/config.yml +++ b/recipes/nanorange/config.yml @@ -1,5 +1,5 @@ versions: - "20191001": + "cci.20200706": folder: all - "20200505": + "cci.20200505": folder: all diff --git a/recipes/nanort/all/conandata.yml b/recipes/nanort/all/conandata.yml new file mode 100644 index 0000000000000..8dcd77657a999 --- /dev/null +++ b/recipes/nanort/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "cci.20230207": + url: "https://github.com/lighttransport/nanort/archive/0bb8ab5284ee8ab7e75705aaedeaea7d7e63e1fe.zip" + sha256: "08b22d1a8bd3ec2667a71cb71281c08d37d72a81baa0c3272e01db24ef191db5" diff --git a/recipes/nanort/all/conanfile.py b/recipes/nanort/all/conanfile.py new file mode 100644 index 0000000000000..934e494b287de --- /dev/null +++ b/recipes/nanort/all/conanfile.py @@ -0,0 +1,44 @@ +from conan import ConanFile +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout +from conan.tools.build import check_min_cppstd + + +import os + + +class NanoRTConan(ConanFile): + name = "nanort" + description = "Single header only modern ray tracing kernel" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/lighttransport/nanort" + topics = ("graphics", "raytracing", "header-only") + license = "MIT" + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + 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): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + 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, "nanort.h", self.source_folder, os.path.join(self.package_folder, "include")) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/nanort/all/test_package/CMakeLists.txt b/recipes/nanort/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..358520baebdbd --- /dev/null +++ b/recipes/nanort/all/test_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.15) + +project(test_package LANGUAGES CXX) + +find_package(nanort REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE nanort::nanort) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) + diff --git a/recipes/nanort/all/test_package/conanfile.py b/recipes/nanort/all/test_package/conanfile.py new file mode 100644 index 0000000000000..f5cf204295e19 --- /dev/null +++ b/recipes/nanort/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/nanort/all/test_package/test_package.cpp b/recipes/nanort/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..76b9d8b357488 --- /dev/null +++ b/recipes/nanort/all/test_package/test_package.cpp @@ -0,0 +1,27 @@ +#include +#include +#include + +#include "nanort.h" + + +int main(void) { + const std::array vertices = {0.0f, 0.0f, 0.0f, + 1.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f}; + const std::array faces = {0, 1, 2}; + + nanort::TriangleMesh triangle_mesh(vertices.data(), faces.data(), sizeof(float) * 3); + nanort::TriangleSAHPred triangle_pred(vertices.data(), faces.data(), sizeof(float) * 3); + + nanort::BVHAccel accel; + const auto ret = accel.Build(1, triangle_mesh, triangle_pred); + + if (!ret) { + std::cerr << "Failed to build BVH" << std::endl; + return EXIT_FAILURE; + } + + std::cout << "Successfully built simple BVH with nanort" << std::endl; + return EXIT_SUCCESS; +} diff --git a/recipes/nanort/config.yml b/recipes/nanort/config.yml new file mode 100644 index 0000000000000..42394be2d8324 --- /dev/null +++ b/recipes/nanort/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20230207": + folder: all diff --git a/recipes/nanosvg/all/conandata.yml b/recipes/nanosvg/all/conandata.yml index 8191482a0d600..2efbe78b92b51 100644 --- a/recipes/nanosvg/all/conandata.yml +++ b/recipes/nanosvg/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "cci.20231025": + url: "https://github.com/memononen/nanosvg/archive/cb0ae54e6b147ccdf85401ef3ef20f2c761252c0.tar.gz" + sha256: "33d743c4e6a2c2cd223c2d9a0ceffe9fb735198fc52ea1ac6140bed10959fdcd" "cci.20210904": url: "https://github.com/memononen/nanosvg/archive/ccdb1995134d340a93fb20e3a3d323ccb3838dd0.zip" sha256: "d45fb75b9652f45f3ab4e23e76d77c4a4db02939702d36def6fcd244fb0a44c6" diff --git a/recipes/nanosvg/all/conanfile.py b/recipes/nanosvg/all/conanfile.py index 907d8771861b8..5e4dbdbbe3aa8 100644 --- a/recipes/nanosvg/all/conanfile.py +++ b/recipes/nanosvg/all/conanfile.py @@ -10,21 +10,21 @@ class NanosvgConan(ConanFile): name = "nanosvg" description = "NanoSVG is a simple stupid single-header-file SVG parser." license = "Zlib" - topics = ("nanosvg", "svg", "parser", "header-only") - homepage = "https://github.com/memononen/nanosvg" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/memononen/nanosvg" + topics = ("nanosvg", "svg", "parser", "header-only") + package_type = "header-library" 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 @@ -36,8 +36,6 @@ def package(self): def package_info(self): self.cpp_info.includedirs.append(os.path.join("include", "nanosvg")) 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.append("m") diff --git a/recipes/nanosvg/all/test_package/conanfile.py b/recipes/nanosvg/all/test_package/conanfile.py index 621a8ff8e6daf..959fb3ca5317a 100644 --- a/recipes/nanosvg/all/test_package/conanfile.py +++ b/recipes/nanosvg/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/nanosvg/config.yml b/recipes/nanosvg/config.yml index 4cfe8bfdf0bc4..376415f6ab6cf 100644 --- a/recipes/nanosvg/config.yml +++ b/recipes/nanosvg/config.yml @@ -1,4 +1,6 @@ versions: + "cci.20231025": + folder: all "cci.20210904": folder: all "20190405": 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..5a3dcf12eeb77 100644 --- a/recipes/nas/all/conanfile.py +++ b/recipes/nas/all/conanfile.py @@ -1,8 +1,14 @@ -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.env import VirtualBuildEnv +from conan.tools.files import chdir, get, export_conandata_patches, apply_conandata_patches, rm, copy, load, save +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): @@ -11,7 +17,7 @@ class NasRecipe(ConanFile): topics = ("audio", "sound") url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.radscan.com/nas.html" - license = "Unlicense" + license = "DocumentRef-wave.h:LicenseRef-MIT-advertising" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -22,51 +28,57 @@ 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"): raise ConanInvalidConfiguration("Recipe supports Linux only") + if self.settings.compiler == "clang": + # See https://github.com/conan-io/conan-center-index/pull/16267#issuecomment-1469824504 + raise ConanInvalidConfiguration("Recipe cannot be built with clang") 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") + self.tool_requires("gnu-config/cci.20210814") 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) @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() + + buildenv = VirtualBuildEnv(self) + buildenv.generate() @property def _imake_irulesrc(self): - return self._user_info_build["xorg-cf-files"].CONFIG_PATH + return self.conf.get("user.xorg-cf-files:config-path") @property def _imake_defines(self): @@ -77,36 +89,57 @@ 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): - 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) + 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: + config_folder = os.path.join(self.source_folder, "config") + copy(self, os.path.basename(gnu_config), src=os.path.dirname(gnu_config), dst=config_folder) + + with chdir(self, self.source_folder): + self.run("imake -DUseInstalled -I{} {}".format(self._imake_irulesrc, self._imake_defines), env="conanbuild") + autotools = Autotools(self) + # j1 avoids some errors while trying to run this target + autotools.make(target="World", args=["-j1"] + self._imake_make_args) + + def _extract_license(self): + header = "Copyright 1995" + footer = "Translation: You can do whatever you want with this software!" + nas_audio = load(self, os.path.join(self.source_folder, "README")) + begin = nas_audio.find(header) + end = nas_audio.find(footer, begin) + return nas_audio[begin:end] 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 + save(self, os.path.join(self.package_folder, "licenses", "LICENSE"), self._extract_license()) + + 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 c97415979c9f2..86a26c26eef1a 100644 --- a/recipes/nasm/all/conandata.yml +++ b/recipes/nasm/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.16.01": + sha256: "c77745f4802375efeee2ec5c0ad6b7f037ea9c87c92b149a9637ff099f162558" + url: "https://www.nasm.us/pub/nasm/releasebuilds/2.16.01/nasm-2.16.01.tar.xz" "2.15.05": sha256: "3caf6729c1073bf96629b57cee31eeb54f4f8129b01902c73428836550b30a3f" url: "https://www.nasm.us/pub/nasm/releasebuilds/2.15.05/nasm-2.15.05.tar.xz" @@ -12,5 +15,7 @@ sources: sha256: "aa0213008f0433ecbe07bb628506a5c4be8079be20fc3532a5031fd639db9a5e" url: "https://www.nasm.us/pub/nasm/releasebuilds/2.13.01/nasm-2.13.01.tar.xz" patches: + "2.16.01": + - patch_file: "patches/2.16.01-0001-disable-newly-integrated-dependency-tracking.patch" "2.15.05": - patch_file: "patches/2.15.05-0001-disable-newly-integrated-dependency-tracking.patch" diff --git a/recipes/nasm/all/conanfile.py b/recipes/nasm/all/conanfile.py index 871a6f66ea436..16c994e86edd0 100644 --- a/recipes/nasm/all/conanfile.py +++ b/recipes/nasm/all/conanfile.py @@ -3,20 +3,21 @@ 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 is_msvc, unix_path, VCVars +from conan.tools.microsoft import NMakeToolchain, is_msvc import os import shutil -required_conan_version = ">=1.53.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" - topics = ("nasm", "installer", "assembler") + topics = ("asm", "installer", "assembler",) settings = "os", "arch", "compiler", "build_type" @@ -24,6 +25,20 @@ class NASMConan(ConanFile): def _settings_build(self): return getattr(self, "settings_build", self.settings) + @property + def _nasm(self): + suffix = "w.exe" if is_msvc(self) else "" + return os.path.join(self.package_folder, "bin", f"nasm{suffix}") + + @property + def _ndisasm(self): + suffix = "w.exe" if is_msvc(self) else "" + return os.path.join(self.package_folder, "bin", f"ndisasm{suffix}") + + def _chmod_plus_x(self, filename): + if os.name == "posix": + os.chmod(filename, os.stat(filename).st_mode | 0o111) + def export_sources(self): export_conandata_patches(self) @@ -46,42 +61,42 @@ def build_requirements(self): self.tool_requires("msys2/cci.latest") 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 = AutotoolsToolchain(self) if is_msvc(self): - VCVars(self).generate() - tc.configure_args.append("-nologo") - if self.settings.arch == "x86": - tc.extra_cflags.append("-m32") - elif self.settings.arch == "x86_64": - tc.extra_cflags.append("-m64") - tc.generate() + 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): apply_conandata_patches(self) - if is_msvc(self): with chdir(self, self.source_folder): - self.run("nmake /f {}".format(os.path.join("Mkfiles", "msvc.mak"))) + self.run(f'nmake /f {os.path.join("Mkfiles", "msvc.mak")}') else: - autotools = Autotools(self) - autotools.configure() + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.configure() - # GCC9 - "pure" attribute on function returning "void" - replace_in_file(self, "Makefile", "-Werror=attributes", "") + # 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() + # 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): copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) @@ -91,14 +106,25 @@ def package(self): shutil.copy2("nasm.exe", "nasmw.exe") shutil.copy2("ndisasm.exe", "ndisasmw.exe") else: - 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)}"]) + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.install() rmdir(self, os.path.join(self.package_folder, "share")) + self._chmod_plus_x(self._nasm) + self._chmod_plus_x(self._ndisasm) def package_info(self): self.cpp_info.libdirs = [] self.cpp_info.includedirs = [] + compiler_executables = {"asm": self._nasm} + self.conf_info.update("tools.build:compiler_executables", compiler_executables) + self.buildenv_info.define_path("NASM", self._nasm) + self.buildenv_info.define_path("NDISASM", self._ndisasm) + self.buildenv_info.define_path("AS", self._nasm) + # TODO: Legacy, to be removed on Conan 2.0 self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) + self.env_info.NASM = self._nasm + self.env_info.NDISASM = self._ndisasm + self.env_info.AS = self._nasm diff --git a/recipes/nasm/all/patches/2.16.01-0001-disable-newly-integrated-dependency-tracking.patch b/recipes/nasm/all/patches/2.16.01-0001-disable-newly-integrated-dependency-tracking.patch new file mode 100644 index 0000000000000..b65e6fbc40d86 --- /dev/null +++ b/recipes/nasm/all/patches/2.16.01-0001-disable-newly-integrated-dependency-tracking.patch @@ -0,0 +1,34 @@ +--- Mkfiles/msvc.mak ++++ Mkfiles/msvc.mak +@@ -226,7 +226,7 @@ + x86\regs.h: x86\regs.dat x86\regs.pl + $(RUNPERL) $(srcdir)\x86\regs.pl h \ + $(srcdir)\x86\regs.dat > x86\regs.h +- ++!IF 0 + # Extract warnings from source code. This is done automatically if any + # C files have changed; the script is fast enough that that is + # reasonable, but doesn't update the time stamp if the files aren't +@@ -262,7 +262,7 @@ + + doc\warnings.src : doc\warnings.src.time + @: Side effect +- ++!ENDIF + # Assembler token hash + asm\tokhash.c: x86\insns.dat x86\insnsn.c asm\tokens.dat asm\tokhash.pl \ + perllib\phash.ph +@@ -402,7 +402,7 @@ + # @exclude: "config/config.h" + # @external: "msvc.dep" + # @selfrule: "1" +-#-- Everything below is generated by mkdep.pl - do not edit --# ++!IF 0 + asm\assemble.$(O): asm\assemble.c asm\assemble.h asm\directiv.h \ + asm\listing.h asm\pptok.h asm\preproc.h asm\srcfile.h asm\tokens.h \ + config\msvc.h config\unconfig.h config\unknown.h config\watcom.h \ +@@ -854,3 +854,4 @@ + x86\regvals.$(O): x86\regvals.c config\msvc.h config\unconfig.h \ + config\unknown.h config\watcom.h include\compiler.h include\nasmint.h \ + include\tables.h x86\insnsi.h ++!ENDIF diff --git a/recipes/nasm/all/test_package/conanfile.py b/recipes/nasm/all/test_package/conanfile.py index 95d517d9ebe3b..87cdd6462f79f 100644 --- a/recipes/nasm/all/test_package/conanfile.py +++ b/recipes/nasm/all/test_package/conanfile.py @@ -1,6 +1,8 @@ +import os + from conan import ConanFile from conan.tools.build import can_run -import os +from conan.tools.cmake import cmake_layout class TestPackageConan(ConanFile): @@ -11,15 +13,18 @@ class TestPackageConan(ConanFile): def build_requirements(self): self.tool_requires(self.tested_reference_str) + def layout(self): + cmake_layout(self) + 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 can_run(self): - self.run("nasm --version", env="conanbuild") - 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(f"nasm -felf64 {asm_file} -o {out_file}", env="conanbuild") if self.settings.os == "Linux" and self.settings.arch == "x86_64": # TODO was tools.get_env, what should it be? ld = os.getenv("LD", "ld") - self.run(f"{ld} hello_linux.o -o {bin_file}", env="conanbuild") + 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 index e044b0e4f83c5..ea9bfae804ef3 100644 --- a/recipes/nasm/all/test_v1_package/conanfile.py +++ b/recipes/nasm/all/test_v1_package/conanfile.py @@ -4,15 +4,19 @@ 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): - 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(f"nasm -felf64 {asm_file} -o {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 not tools.cross_building(self): if self.settings.os == "Linux" and self.settings.arch == "x86_64": ld = tools.get_env("LD", "ld") - self.run(f"{ld} hello_linux.o -o {bin_file}", run_environment=True) + 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 index c219477df732c..82a250faaa6a6 100644 --- a/recipes/nasm/all/test_v1_package/hello_linux.asm +++ b/recipes/nasm/all/test_v1_package/hello_linux.asm @@ -13,4 +13,4 @@ _start: mov rax, 1 ; system call for write syscall ; invoke operating system to exit section .data -message: db "Hello, Conan", 10 ; note the newline at the end \ No newline at end of file +message: db "Hello, Conan", 10 ; note the newline at the end diff --git a/recipes/nasm/config.yml b/recipes/nasm/config.yml index 2034e05cda1be..70e3f3ec75d45 100644 --- a/recipes/nasm/config.yml +++ b/recipes/nasm/config.yml @@ -1,4 +1,6 @@ versions: + "2.16.01": + folder: all "2.15.05": folder: all "2.14": diff --git a/recipes/ncurses/all/cmake/conan-official-ncurses-targets.cmake b/recipes/ncurses/all/cmake/conan-official-ncurses-targets.cmake new file mode 100644 index 0000000000000..c890b5d0ddfab --- /dev/null +++ b/recipes/ncurses/all/cmake/conan-official-ncurses-targets.cmake @@ -0,0 +1,36 @@ +# Reproduces the variables set by https://cmake.org/cmake/help/latest/module/FindCurses.html +set(CURSES_FOUND ON) +set(CURSES_INCLUDE_DIRS ${Curses_INCLUDE_DIRS}) +set(CURSES_CFLAGS ${Curses_DEFINITIONS} ${Curses_COMPILE_OPTIONS_C}) +set(CURSES_HAVE_CURSES_H OFF) +set(CURSES_HAVE_NCURSES_H OFF) +if(CURSES_NEED_NCURSES) + set(CURSES_HAVE_NCURSES_CURSES_H ON) + set(CURSES_HAVE_NCURSES_NCURSES_H ON) +endif() + +# For backward compatibility with Conan v1 +string(TOUPPER "${CMAKE_BUILD_TYPE}" _CONFIG) +set(CURSES_INCLUDE_DIRS ${CURSES_INCLUDE_DIRS} + ${ncurses_INCLUDE_DIRS_${_CONFIG}} + ${Curses_INCLUDE_DIRS_${_CONFIG}} +) +set(CURSES_CFLAGS ${CURSES_CFLAGS} + ${ncurses_DEFINITIONS_${_CONFIG}} ${ncurses_COMPILE_OPTIONS_C_${_CONFIG}} + ${Curses_DEFINITIONS_${_CONFIG}} ${Curses_COMPILE_OPTIONS_C_${_CONFIG}} +) + +# CURSES_LIBRARIES output from CMake uses absolute paths for the libraries +list (GET CURSES_INCLUDE_DIRS 0 _first_include_dir) +get_filename_component(CURSES_LIB_DIRS "${_first_include_dir}/../lib" ABSOLUTE) +foreach(_LIB ${Curses_LIBRARIES} ${ncurses_LIBRARIES_${_CONFIG}} ${Curses_LIBRARIES_${_CONFIG}}) + if(TARGET ${_LIB} OR IS_ABSOLUTE ${_LIB}) + list(APPEND CURSES_LIBRARIES ${_LIB}) + else() + find_library(_LIB ${_LIB} PATHS ${CURSES_LIB_DIRS}) + list(APPEND CURSES_LIBRARIES ${_LIB}) + endif() +endforeach() + +set(CURSES_INCLUDE_DIR ${CURSES_INCLUDE_DIRS}) +set(CURSES_LIBRARY ${CURSES_LIBRARIES}) diff --git a/recipes/ncurses/all/conandata.yml b/recipes/ncurses/all/conandata.yml index d8543569369b7..6777bbc70de06 100644 --- a/recipes/ncurses/all/conandata.yml +++ b/recipes/ncurses/all/conandata.yml @@ -1,51 +1,16 @@ sources: + "6.5": + url: + - "https://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.5.tar.gz" + - "https://invisible-mirror.net/archives/ncurses/ncurses-6.5.tar.gz" + sha256: "136d91bc269a9a5785e5f9e980bc76ab57428f604ce3e5a5a90cebc767971cc6" + "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", - ] - 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_file: "patches/6.2.0-0002-Optionally-include-sys-time.h.patch" - base_path: "source_subfolder" - - patch_file: "patches/6.2.0-0003-Do-not-redeclare-exit.patch" - base_path: "source_subfolder" - - patch_file: "patches/6.2.0-0004-fix-win32con.patch" - base_path: "source_subfolder" - - patch_file: "patches/6.2.0-0005-api-must-be-placed-next-to-variable-name.patch" - base_path: "source_subfolder" - - patch_file: "patches/6.2.0-0006-Add-potentially-missing-STDOUT_FILENO.patch" - base_path: "source_subfolder" - - patch_file: "patches/6.2.0-0007-No-import-export-declaration-on-class-members.patch" - base_path: "source_subfolder" - - patch_file: "patches/6.2.0-0008-Add-include-file-to-add-export-annotation.patch" - base_path: "source_subfolder" - - patch_file: "patches/6.2.0-0010-Pass-BUILDING_XXX-compile-definition-while-building-.patch" - base_path: "source_subfolder" - - patch_file: "patches/6.2.0-0011-Let-each-sublibrary-do-its-own-import-exporting.patch" - base_path: "source_subfolder" - - patch_file: "patches/6.2.0-0012-Learn-configure-about-msvc.patch" - base_path: "source_subfolder" - - patch_file: "patches/6.2.0-0013-Fix-lib_gen.c.patch" - base_path: "source_subfolder" - - patch_file: "patches/6.2.0-0014-avoid-macro-expansion-in-args-by-defining-NCURSES_NO.patch" - base_path: "source_subfolder" - - patch_file: "patches/6.2.0-0015-MSVC-access-does-not-support-X_OK.patch" - base_path: "source_subfolder" - - patch_file: "patches/6.2.0-0016-msvc-has-wchar-support.patch" - base_path: "source_subfolder" - - patch_file: "patches/6.2.0-0017-msvc-fix-tests.patch" - base_path: "source_subfolder" - - patch_file: "patches/6.2.0-0018-missing-functions-c-linkage.patch" - base_path: "source_subfolder" - - patch_file: "patches/6.2.0-0019-Run-autoreconf.patch" - base_path: "source_subfolder" diff --git a/recipes/ncurses/all/conanfile.py b/recipes/ncurses/all/conanfile.py index 3adc44c41e54c..0e692c25e7249 100644 --- a/recipes/ncurses/all/conanfile.py +++ b/recipes/ncurses/all/conanfile.py @@ -1,21 +1,29 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, tools -from conans.errors import ConanInvalidConfiguration -import contextlib -import functools import os -import textwrap -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, stdcpp_library +from conan.tools.env import Environment +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get +from conan.tools.gnu import Autotools, AutotoolsToolchain, PkgConfigDeps +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime, unix_path +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" class NCursesConan(ConanFile): name = "ncurses" description = "The ncurses (new curses) library is a free software emulation of curses in System V Release 4.0 (SVr4), and more" - topics = ("ncurses", "terminal", "screen", "tui") + license = "X11" url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.gnu.org/software/ncurses" - license = "X11" - settings = "os", "compiler", "build_type", "arch" + topics = ("terminal", "screen", "tui") + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -41,90 +49,85 @@ class NCursesConan(ConanFile): "with_pcre2": False, } - generators = "pkg_config" - exports_sources = "patches/*" - - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _settings_build(self): return getattr(self, "settings_build", self.settings) @property - def _with_ticlib(self): - if self.options.with_ticlib == "auto": - return self.settings.os != "Windows" - else: - return self.options.with_ticlib + def _is_mingw(self): + return self.settings.os == "Windows" and self.settings.compiler == "gcc" - @property - def _with_tinfo(self): - if self.options.with_tinfo == "auto": - return self.settings.os != "Windows" - else: - return self.options.with_tinfo + def export_sources(self): + export_conandata_patches(self) + copy(self, "*.cmake", src=self.recipe_folder, dst=self.export_sources_folder) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + # Set the default value based on OS + self.options.with_ticlib = self.settings.os != "Windows" + self.options.with_tinfo = self.settings.os != "Windows" def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") if not self.options.with_cxx: - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") if not self.options.with_widec: - del self.options.with_extended_colors + self.options.rm_safe("with_extended_colors") + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): if self.options.with_pcre2: - self.requires("pcre2/10.37") - if self.settings.compiler == "Visual Studio": + self.requires("pcre2/10.42") + if is_msvc(self): self.requires("getopt-for-visual-studio/20200201") - self.requires("dirent/1.23.2") - if self.options.get_safe("with_extended_colors", False): + self.requires("dirent/1.24") + if self.options.get_safe("with_extended_colors"): self.requires("naive-tsearch/0.1.1") - 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 validate(self): - if any("arm" in arch for arch in (self.settings.arch, self._settings_build.arch)) and tools.cross_building(self): + if cross_building(self) and ("arm" in str(self.settings.arch) or "arm" in str(self._settings_build.arch)): # FIXME: Cannot build ncurses from x86_64 to armv8 (Apple M1). Cross building from Linux/x86_64 to Mingw/x86_64 works flawless. # FIXME: Need access to environment of build profile to set build compiler (BUILD_CC/CC_FOR_BUILD) raise ConanInvalidConfiguration("Cross building to/from arm is (currently) not supported") - if self.options.shared and self.settings.compiler == "Visual Studio" and "MT" in self.settings.compiler.runtime: + if self.options.shared and is_msvc_static_runtime(self): raise ConanInvalidConfiguration("Cannot build shared libraries with static (MT) runtime") if self.settings.os == "Windows": - if self._with_tinfo: + if self.options.with_tinfo: raise ConanInvalidConfiguration("terminfo cannot be built on Windows because it requires a term driver") - if self.options.shared and self._with_ticlib: + if self.options.shared and self.options.with_ticlib: raise ConanInvalidConfiguration("ticlib cannot be built separately as a shared library on Windows") + 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") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/2.0.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) - @functools.lru_cache(1) - def _configure_autotools(self): - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) + def generate(self): + tc = AutotoolsToolchain(self) yes_no = lambda v: "yes" if v else "no" - conf_args = [ + tc.configure_args += [ "--with-shared={}".format(yes_no(self.options.shared)), "--with-cxx-shared={}".format(yes_no(self.options.shared)), "--with-normal={}".format(yes_no(not self.options.shared)), "--enable-widec={}".format(yes_no(self.options.with_widec)), - "--enable-ext-colors={}".format(yes_no(self.options.get_safe("with_extended_colors", False))), + "--enable-ext-colors={}".format(yes_no(self.options.get_safe("with_extended_colors"))), "--enable-reentrant={}".format(yes_no(self.options.with_reentrant)), "--with-pcre2={}".format(yes_no(self.options.with_pcre2)), "--with-cxx-binding={}".format(yes_no(self.options.with_cxx)), "--with-progs={}".format(yes_no(self.options.with_progs)), - "--with-termlib={}".format(yes_no(self._with_tinfo)), - "--with-ticlib={}".format(yes_no(self._with_ticlib)), + "--with-termlib={}".format(yes_no(self.options.with_tinfo)), + "--with-ticlib={}".format(yes_no(self.options.with_ticlib)), "--without-libtool", "--without-ada", "--without-manpages", @@ -134,108 +137,118 @@ def _configure_autotools(self): "--without-profile", "--with-sp-funcs", "--disable-rpath", - "--datarootdir={}".format(tools.unix_path(os.path.join(self.package_folder, "res"))), "--disable-pc-files", + "--datarootdir=${prefix}/res", ] build = None host = None if self.settings.os == "Windows": - conf_args.extend([ + tc.configure_args += [ "--disable-macros", "--disable-termcap", "--enable-database", "--enable-sp-funcs", "--enable-term-driver", "--enable-interop", - ]) - if self.settings.compiler == "Visual Studio": - build = host = "{}-w64-mingw32-msvc".format(self.settings.arch) - conf_args.extend([ + ] + if is_msvc(self): + build = host = f"{self.settings.arch}-w64-mingw32-msvc" + tc.configure_args += [ "ac_cv_func_getopt=yes", "ac_cv_func_setvbuf_reversed=no", - ]) - autotools.cxx_flags.append("-EHsc") - if tools.Version(self.settings.compiler.version) >= 12: - autotools.flags.append("-FS") - if (self.settings.os, self.settings.compiler) == ("Windows", "gcc"): + ] + # The env vars below are used by ./configure, but not during make + tc.make_args += [ + "CC=cl -nologo", + "CPP=cl -nologo -E", + ] + tc.extra_cflags.append("-FS") + tc.extra_cxxflags.append("-FS") + tc.extra_cxxflags.append("-EHsc") + if self.options.get_safe("with_extended_colors"): + tc.extra_cflags.append(" ".join(f"-I{dir}" for dir in self.dependencies["naive-tsearch"].cpp_info.includedirs)) + tc.extra_ldflags.append(" ".join(f"-l{lib}" for lib in self.dependencies["naive-tsearch"].cpp_info.libs)) + if self._is_mingw: # add libssp (gcc support library) for some missing symbols (e.g. __strcpy_chk) - autotools.libs.extend(["mingwex", "ssp"]) + tc.extra_ldflags.extend(["-lmingwex", "-lssp"]) if build: - conf_args.append(f"ac_cv_build={build}") + tc.configure_args.append(f"ac_cv_build={build}") if host: - conf_args.append(f"ac_cv_host={host}") - conf_args.append(f"ac_cv_target={host}") - autotools.configure(args=conf_args, configure_dir=self._source_subfolder, host=host, build=build) - return autotools - - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - - @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", - "LDFLAGS": "", - "NM": "dumpbin -symbols", - "STRIP": ":", - "AR": "lib -nologo", - "RANLIB": ":", - } - with tools.environment_append(env): - yield - else: - yield + tc.configure_args.append(f"ac_cv_host={host}") + tc.configure_args.append(f"ac_cv_target={host}") + # Allow ncurses to set the include dir with an appropriate subdir + tc.configure_args.remove("--includedir=${prefix}/include") + tc.generate() + + if is_msvc(self): + env = Environment() + env.define("CC", "cl -nologo -FS") + env.define("CXX", "cl -nologo -FS") + env.define("LD", "link") + env.define("AR", "lib") + env.define("NM", "dumpbin -symbols") + env.define("OBJDUMP", ":") + env.define("RANLIB", ":") + env.define("STRIP", ":") + env.vars(self).save_script("conanbuild_msvc") + + 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") + + deps = PkgConfigDeps(self) + deps.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() @property def _major_version(self): - return tools.Version(self.version).major - - @staticmethod - def _create_cmake_module_alias_targets(module_file): - tools.save(module_file, textwrap.dedent("""\ - set(CURSES_FOUND ON) - set(CURSES_INCLUDE_DIRS ${ncurses_libcurses_INCLUDE_DIRS}) - set(CURSES_LIBRARIES ${ncurses_libcurses_LINK_LIBS}) - set(CURSES_CFLAGS ${ncurses_DEFINITIONS} ${ncurses_COMPILE_OPTIONS_C}) - set(CURSES_HAVE_CURSES_H OFF) - set(CURSES_HAVE_NCURSES_H OFF) - if(CURSES_NEED_NCURSES) - set(CURSES_HAVE_NCURSES_CURSES_H ON) - set(CURSES_HAVE_NCURSES_NCURSES_H ON) - endif() - - # Backward Compatibility - set(CURSES_INCLUDE_DIR ${CURSES_INCLUDE_DIRS}) - set(CURSES_LIBRARY ${CURSES_LIBRARIES}) - """)) + return Version(self.version).major def package(self): - # return - self.copy("COPYING", src=self._source_subfolder, dst="licenses") - with self._build_context(): - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - autotools.install() - - os.unlink(os.path.join(self.package_folder, "bin", "ncurses{}{}-config".format(self._suffix, self._major_version))) - - self._create_cmake_module_alias_targets(os.path.join(self.package_folder, self._module_subfolder, self._module_file)) + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + autotools.install() + os.unlink(os.path.join(self.package_folder, "bin", f"ncurses{self._suffix}{self._major_version}-config")) + copy(self, "*.cmake", + src=os.path.join(self.export_sources_folder, "cmake"), + dst=os.path.join(self.package_folder, self._module_subfolder)) + fix_apple_shared_install_name(self) @property def _suffix(self): res = "" + # https://github.com/mirror/ncurses/blob/v6.4/configure.in#L1393 if self.options.with_reentrant: res += "t" + # https://github.com/mirror/ncurses/blob/v6.4/configure.in#L959 if self.options.with_widec: res += "w" return res @@ -248,80 +261,80 @@ def _lib_suffix(self): res += ".dll" return res - def package_id(self): - self.info.options.with_ticlib = self._with_ticlib - self.info.options.with_tinfo = self._with_tinfo - @property def _module_subfolder(self): return os.path.join("lib", "cmake") @property def _module_file(self): - return "conan-official-{}-targets.cmake".format(self.name) + return f"conan-official-{self.name}-targets.cmake" def package_info(self): - self.cpp_info.filenames["cmake_find_package"] = "Curses" - self.cpp_info.filenames["cmake_find_package_multi"] = "Curses" - if self._with_tinfo: - self.cpp_info.components["tinfo"].libs = ["tinfo" + self._lib_suffix] - self.cpp_info.components["tinfo"].names["pkg_config"] = "tinfo" + self._lib_suffix - self.cpp_info.components["tinfo"].includedirs.append(os.path.join("include", "ncurses" + self._suffix)) - - self.cpp_info.components["libcurses"].libs = ["ncurses" + self._lib_suffix] - self.cpp_info.components["libcurses"].names["pkg_config"] = "ncurses" + self._lib_suffix - self.cpp_info.components["libcurses"].includedirs.append(os.path.join("include", "ncurses" + self._suffix)) - if not self.options.shared: - self.cpp_info.components["libcurses"].defines = ["NCURSES_STATIC"] - if self.settings.os == "Linux": - self.cpp_info.components["libcurses"].system_libs = ["dl", "m"] - if self._with_tinfo: - self.cpp_info.components["libcurses"].requires.append("tinfo") + self.cpp_info.set_property("cmake_find_mode", "both") + self.cpp_info.set_property("cmake_file_name", "Curses") - if self.settings.compiler == "Visual Studio": - self.cpp_info.components["libcurses"].requires.extend([ - "getopt-for-visual-studio::getopt-for-visual-studio", - "dirent::dirent", - ]) - if self.options.get_safe("with_extended_colors", False): - self.cpp_info.components["libcurses"].requires.append("naive-tsearch::naive-tsearch") + # CMake's standard FindCurses module does not define a target. + # Adding one nevertheless for consistency with other packages. + # https://gitlab.kitware.com/cmake/cmake/-/issues/23051 + self.cpp_info.set_property("cmake_target_name", "Curses::Curses") - module_rel_path = os.path.join(self._module_subfolder, self._module_file) - self.cpp_info.components["libcurses"].builddirs.append(self._module_subfolder) - self.cpp_info.components["libcurses"].build_modules["cmake_find_package"] = [module_rel_path] - self.cpp_info.components["libcurses"].build_modules["cmake_find_package_multi"] = [module_rel_path] + def _add_component(name, lib_name=None, requires=None): + lib_name = lib_name or name + self.cpp_info.components[name].libs = [lib_name + self._lib_suffix] + self.cpp_info.components[name].set_property("pkg_config_name", lib_name + self._lib_suffix) + self.cpp_info.components[name].includedirs.append(os.path.join("include", "ncurses" + self._suffix)) + self.cpp_info.components[name].requires = requires if requires else [] - self.cpp_info.components["panel"].libs = ["panel" + self._lib_suffix] - self.cpp_info.components["panel"].names["pkg_config"] = "panel" + self._lib_suffix - self.cpp_info.components["panel"].requires = ["libcurses"] + _add_component("libcurses", lib_name="ncurses") + _add_component("panel", requires=["libcurses"]) + _add_component("menu", requires=["libcurses"]) + _add_component("form", requires=["libcurses"]) - self.cpp_info.components["menu"].libs = ["menu" + self._lib_suffix] - self.cpp_info.components["menu"].names["pkg_config"] = "menu" + self._lib_suffix - self.cpp_info.components["menu"].requires = ["libcurses"] + if self.options.with_tinfo: + _add_component("tinfo") + self.cpp_info.components["libcurses"].requires += ["tinfo"] - self.cpp_info.components["form"].libs = ["form" + self._lib_suffix] - self.cpp_info.components["form"].names["pkg_config"] = "form" + self._lib_suffix - self.cpp_info.components["form"].requires = ["libcurses"] - if self.options.with_pcre2: - self.cpp_info.components["form"].requires.append("pcre2::pcre2") + if self.options.with_ticlib: + _add_component("ticlib", lib_name="tic", requires=["libcurses"]) if self.options.with_cxx: - self.cpp_info.components["curses++"].libs = ["ncurses++" + self._lib_suffix] - self.cpp_info.components["curses++"].names["pkg_config"] = "ncurses++" + self._lib_suffix - self.cpp_info.components["curses++"].requires = ["libcurses"] + _add_component("curses++", lib_name="ncurses++", requires=["libcurses"]) + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["libcurses++"].system_libs.append("util") + libcxx = stdcpp_library(self) + if libcxx: + self.cpp_info.components["libcurses++"].system_libs.append(libcxx) + + if is_msvc(self): + self.cpp_info.components["libcurses"].requires += [ + "getopt-for-visual-studio::getopt-for-visual-studio", + "dirent::dirent", + ] + if self.options.get_safe("with_extended_colors"): + self.cpp_info.components["libcurses"].requires += [ + "naive-tsearch::naive-tsearch" + ] + if self.options.with_pcre2: + self.cpp_info.components["form"].requires.append("pcre2::pcre2") - if self._with_ticlib: - self.cpp_info.components["ticlib"].libs = ["tic" + self._lib_suffix] - self.cpp_info.components["ticlib"].names["pkg_config"] = "tic" + self._lib_suffix - self.cpp_info.components["ticlib"].requires = ["libcurses"] + if not self.options.shared: + self.cpp_info.components["libcurses"].defines = ["NCURSES_STATIC"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["libcurses"].system_libs = ["dl", "m"] - if self.options.with_progs: - 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) + module_rel_path = os.path.join(self._module_subfolder, self._module_file) + self.cpp_info.components["libcurses"].builddirs.append(self._module_subfolder) + self.cpp_info.set_property("cmake_build_modules", [module_rel_path]) terminfo = os.path.join(self.package_folder, "res", "terminfo") - self.output.info("Setting TERMINFO environment variable: {}".format(terminfo)) - self.env_info.TERMINFO = terminfo + self.buildenv_info.define_path("TERMINFO", terminfo) + self.runenv_info.define_path("TERMINFO", terminfo) + self.conf_info.define("user.ncurses:lib_suffix", self._lib_suffix) + # TODO: Legacy, to be removed on Conan 2.0 + self.cpp_info.names["cmake_find_package"] = "Curses" + self.cpp_info.names["cmake_find_package_multi"] = "Curses" + self.cpp_info.components["libcurses"].build_modules["cmake_find_package"] = [module_rel_path] + self.cpp_info.components["libcurses"].build_modules["cmake_find_package_multi"] = [module_rel_path] + self.env_info.TERMINFO = terminfo self.user_info.lib_suffix = self._lib_suffix diff --git a/recipes/ncurses/all/patches/6.2.0-0001-Look-for-pcre2posix-instead-of-pcre2-posix.h.patch b/recipes/ncurses/all/patches/6.2.0-0001-Look-for-pcre2posix-instead-of-pcre2-posix.h.patch deleted file mode 100644 index c9d1dc8e8178a..0000000000000 --- a/recipes/ncurses/all/patches/6.2.0-0001-Look-for-pcre2posix-instead-of-pcre2-posix.h.patch +++ /dev/null @@ -1,59 +0,0 @@ -Upstreamed in 18f51bcf99101e5bf4c737239c44064227f34db8 - -ncurses 6.2 - patch 20200229 - -From 7699b26096801fe462233ecb86484bdc3a2f0beb Mon Sep 17 00:00:00 2001 -From: Anonymous Maarten -Date: Tue, 17 Mar 2020 15:22:08 +0100 -Subject: [PATCH 01/15] Look for pcre2posix instead of pcre2-posix.h - ---- - aclocal.m4 | 2 +- - form/fty_regex.c | 4 ++-- - include/ncurses_defs | 2 +- - 3 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/aclocal.m4 b/aclocal.m4 -index c27cc368..e6ccc42f 100644 ---- a/aclocal.m4 -+++ b/aclocal.m4 -@@ -8506,7 +8506,7 @@ if test "x$with_pcre2" != xno ; then - esac - - # either way, check for the library header files -- AC_CHECK_HEADERS(pcre2-posix.h pcreposix.h) -+ AC_CHECK_HEADERS(pcre2posix.h pcreposix.h) - fi - ])dnl - dnl --------------------------------------------------------------------------- -diff --git a/form/fty_regex.c b/form/fty_regex.c -index da0ef08c..d1daf714 100644 ---- a/form/fty_regex.c -+++ b/form/fty_regex.c -@@ -39,8 +39,8 @@ MODULE_ID("$Id: fty_regex.c,v 1.28 2020/02/02 23:34:34 tom Exp $") - - #if HAVE_REGEX_H_FUNCS || HAVE_LIB_PCRE2 /* We prefer POSIX regex */ - --#if HAVE_PCRE2_POSIX_H --#include -+#if HAVE_PCRE2POSIX_H -+#include - #elif HAVE_PCREPOSIX_H - #include - #else -diff --git a/include/ncurses_defs b/include/ncurses_defs -index e37fc901..a0339457 100644 ---- a/include/ncurses_defs -+++ b/include/ncurses_defs -@@ -120,7 +120,7 @@ HAVE_NANOSLEEP - HAVE_NC_ALLOC_H - HAVE_NEWPAD 1 - HAVE_PANEL_H --HAVE_PCRE2_POSIX_H -+HAVE_PCRE2POSIX_H - HAVE_PCREPOSIX_H - HAVE_POLL - HAVE_POLL_H --- -2.21.1 - diff --git a/recipes/ncurses/all/patches/6.2.0-0002-Optionally-include-sys-time.h.patch b/recipes/ncurses/all/patches/6.2.0-0002-Optionally-include-sys-time.h.patch deleted file mode 100644 index b8cb861a2599a..0000000000000 --- a/recipes/ncurses/all/patches/6.2.0-0002-Optionally-include-sys-time.h.patch +++ /dev/null @@ -1,51 +0,0 @@ -Upstreamed in 18f51bcf99101e5bf4c737239c44064227f34db8 - -ncurses 6.2 - patch 20200229 - -From 3737faf9325859a33d8288337c312fb9ad5b3e02 Mon Sep 17 00:00:00 2001 -From: Anonymous Maarten -Date: Tue, 17 Mar 2020 15:24:34 +0100 -Subject: [PATCH 02/15] Optionally include sys/time.h - ---- - include/nc_mingw.h | 2 ++ - ncurses/tty/lib_twait.c | 2 +- - 2 files changed, 3 insertions(+), 1 deletion(-) - -diff --git a/include/nc_mingw.h b/include/nc_mingw.h -index 68a41849..b47bb2cf 100644 ---- a/include/nc_mingw.h -+++ b/include/nc_mingw.h -@@ -52,10 +52,16 @@ - #undef gettimeofday - #define gettimeofday(tv,tz) _nc_gettimeofday(tv,tz) - -+#if HAVE_SYS_TIME_H - #include /* for struct timeval */ -+#endif - -+#ifdef _MSC_VER -+#include /* for struct timeval */ -+#endif -+ - extern int _nc_gettimeofday(struct timeval *, void *); - - #undef HAVE_GETTIMEOFDAY - #define HAVE_GETTIMEOFDAY 1 - -diff --git a/ncurses/tty/lib_twait.c b/ncurses/tty/lib_twait.c -index 3ab168dd..74d267c7 100644 ---- a/ncurses/tty/lib_twait.c -+++ b/ncurses/tty/lib_twait.c -@@ -71,7 +71,7 @@ - # include - # endif - #endif --#ifdef _WIN32 -+#if HAVE_SYS_TIME_H - # include - #endif - #undef CUR --- -2.21.1 - diff --git a/recipes/ncurses/all/patches/6.2.0-0003-Do-not-redeclare-exit.patch b/recipes/ncurses/all/patches/6.2.0-0003-Do-not-redeclare-exit.patch deleted file mode 100644 index 758bbc562ec77..0000000000000 --- a/recipes/ncurses/all/patches/6.2.0-0003-Do-not-redeclare-exit.patch +++ /dev/null @@ -1,28 +0,0 @@ -Upstreamed in 18f51bcf99101e5bf4c737239c44064227f34db8 - -ncurses 6.2 - patch 20200229 - -From 8e12095e0af72dd9414fcdb35831f585d5b8d67e Mon Sep 17 00:00:00 2001 -From: Anonymous Maarten -Date: Tue, 17 Mar 2020 15:25:00 +0100 -Subject: [PATCH 03/15] Do not redeclare exit - ---- - c++/etip.h.in | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/c++/etip.h.in b/c++/etip.h.in -index 9334f9d3..1155c5fd 100644 ---- a/c++/etip.h.in -+++ b/c++/etip.h.in -@@ -341,7 +341,6 @@ using std::endl; - # else - # include - # endif -- extern "C" void exit(int); - #endif - - inline void THROW(const NCursesException *e) { --- -2.21.1 - diff --git a/recipes/ncurses/all/patches/6.2.0-0004-fix-win32con.patch b/recipes/ncurses/all/patches/6.2.0-0004-fix-win32con.patch deleted file mode 100644 index 4af53ed568c0d..0000000000000 --- a/recipes/ncurses/all/patches/6.2.0-0004-fix-win32con.patch +++ /dev/null @@ -1,91 +0,0 @@ -Upstreamed in 18f51bcf99101e5bf4c737239c44064227f34db8 - -ncurses 6.2 - patch 20200229 - -From 5cb87b2244c1e944e13478b7bb98d0984b7dfdf7 Mon Sep 17 00:00:00 2001 -From: Anonymous Maarten -Date: Tue, 17 Mar 2020 15:25:57 +0100 -Subject: [PATCH 04/15] fix win32con ---- - ncurses/win32con/gettimeofday.c | 4 ++++ - ncurses/win32con/win_driver.c | 14 +++++++------- - 2 files changed, 11 insertions(+), 7 deletions(-) - -diff --git a/ncurses/win32con/gettimeofday.c b/ncurses/win32con/gettimeofday.c -index 8fad9a62..319937c6 100644 ---- a/ncurses/win32con/gettimeofday.c -+++ b/ncurses/win32con/gettimeofday.c -@@ -40,6 +40,10 @@ MODULE_ID("$Id: gettimeofday.c,v 1.4 2020/02/02 23:34:34 tom Exp $") - - #define JAN1970 116444736000000000LL /* the value for 01/01/1970 00:00 */ - -+#ifdef _MSC_VER -+#include -+#endif -+ - int - gettimeofday(struct timeval *tv, void *tz GCC_UNUSED) - { -diff --git a/ncurses/win32con/win_driver.c b/ncurses/win32con/win_driver.c -index 280aa6dc..1bd45bb7 100644 ---- a/ncurses/win32con/win_driver.c -+++ b/ncurses/win32con/win_driver.c -@@ -58,7 +58,7 @@ - MODULE_ID("$Id: win_driver.c,v 1.63 2020/02/02 23:34:34 tom Exp $") - - #ifndef __GNUC__ --# error We need GCC to compile for MinGW -+//# error We need GCC to compile for MinGW - #endif - - #define WINMAGIC NCDRV_MAGIC(NCDRV_WINCONSOLE) -@@ -262,7 +262,7 @@ static BOOL - con_write16(TERMINAL_CONTROL_BLOCK * TCB, int y, int x, cchar_t *str, int limit) - { - int actual = 0; -- CHAR_INFO ci[limit]; -+ CHAR_INFO * ci = (CHAR_INFO*) _alloca(sizeof(CHAR_INFO) * limit); - COORD loc, siz; - SMALL_RECT rec; - int i; -@@ -311,7 +311,7 @@ con_write16(TERMINAL_CONTROL_BLOCK * TCB, int y, int x, cchar_t *str, int limit) - static BOOL - con_write8(TERMINAL_CONTROL_BLOCK * TCB, int y, int x, chtype *str, int n) - { -- CHAR_INFO ci[n]; -+ CHAR_INFO * ci = (CHAR_INFO*) _alloca(sizeof(CHAR_INFO) * n); - COORD loc, siz; - SMALL_RECT rec; - int i; -@@ -510,7 +510,7 @@ wcon_doupdate(TERMINAL_CONTROL_BLOCK * TCB) - if ((CurScreen(sp)->_clear || NewScreen(sp)->_clear)) { - int x; - #if USE_WIDEC_SUPPORT -- cchar_t empty[Width]; -+ cchar_t * empty = (cchar_t*) _alloca(sizeof(cchar_t) * Width); - wchar_t blank[2] = - { - L' ', L'\0' -@@ -519,7 +519,7 @@ wcon_doupdate(TERMINAL_CONTROL_BLOCK * TCB) - for (x = 0; x < Width; x++) - setcchar(&empty[x], blank, 0, 0, 0); - #else -- chtype empty[Width]; -+ chtype * empty = (chtype*) _alloca(sizeof(chtype) * Width); - - for (x = 0; x < Width; x++) - empty[x] = ' '; -@@ -675,8 +675,8 @@ wcon_dobeepflash(TERMINAL_CONTROL_BLOCK * TCB, - int max_cells = (high * wide); - int i; - -- CHAR_INFO this_screen[max_cells]; -- CHAR_INFO that_screen[max_cells]; -+ CHAR_INFO * this_screen = (CHAR_INFO*) _alloca(sizeof(CHAR_INFO) * max_cells); -+ CHAR_INFO * that_screen = (CHAR_INFO*) _alloca(sizeof(CHAR_INFO) * max_cells); - COORD this_size; - SMALL_RECT this_region; - COORD bufferCoord; --- -2.21.1 - diff --git a/recipes/ncurses/all/patches/6.2.0-0005-api-must-be-placed-next-to-variable-name.patch b/recipes/ncurses/all/patches/6.2.0-0005-api-must-be-placed-next-to-variable-name.patch deleted file mode 100644 index 9d34795fa33af..0000000000000 --- a/recipes/ncurses/all/patches/6.2.0-0005-api-must-be-placed-next-to-variable-name.patch +++ /dev/null @@ -1,45 +0,0 @@ -Upstreamed in 18f51bcf99101e5bf4c737239c44064227f34db8 - -ncurses 6.2 - patch 20200229 - -From c225d0ccd87b45fbaf92a4b048887f8f136cedcd Mon Sep 17 00:00:00 2001 -From: Anonymous Maarten -Date: Tue, 17 Mar 2020 15:26:55 +0100 -Subject: [PATCH 05/15] api must be placed next to variable name - ---- - include/term_entry.h | 4 ++-- - ncurses/tinfo/comp_parse.c | 2 +- - 2 files changed, 3 insertions(+), 3 deletions(-) - -diff --git a/include/term_entry.h b/include/term_entry.h -index df13f53f..c4702012 100644 ---- a/include/term_entry.h -+++ b/include/term_entry.h -@@ -200,8 +200,8 @@ extern NCURSES_EXPORT(bool) _nc_entry_match (char *, char *); - extern NCURSES_EXPORT(int) _nc_resolve_uses (bool); /* obs 20040705 */ - extern NCURSES_EXPORT(int) _nc_resolve_uses2 (bool, bool); - extern NCURSES_EXPORT(void) _nc_free_entries (ENTRY *); --extern NCURSES_IMPEXP void NCURSES_API (*_nc_check_termtype)(TERMTYPE *); /* obs 20040705 */ --extern NCURSES_IMPEXP void NCURSES_API (*_nc_check_termtype2)(TERMTYPE2 *, bool); -+extern NCURSES_IMPEXP void (NCURSES_API *_nc_check_termtype)(TERMTYPE *); /* obs 20040705 */ -+extern NCURSES_IMPEXP void (NCURSES_API *_nc_check_termtype2)(TERMTYPE2 *, bool); - - /* trace_xnames.c */ - extern NCURSES_EXPORT(void) _nc_trace_xnames (TERMTYPE *); -diff --git a/ncurses/tinfo/comp_parse.c b/ncurses/tinfo/comp_parse.c -index ab25d5b1..d320129e 100644 ---- a/ncurses/tinfo/comp_parse.c -+++ b/ncurses/tinfo/comp_parse.c -@@ -51,7 +51,7 @@ - MODULE_ID("$Id: comp_parse.c,v 1.109 2020/02/02 23:34:34 tom Exp $") - - static void sanity_check2(TERMTYPE2 *, bool); --NCURSES_IMPEXP void NCURSES_API(*_nc_check_termtype2) (TERMTYPE2 *, bool) = sanity_check2; -+NCURSES_IMPEXP void (NCURSES_API *_nc_check_termtype2) (TERMTYPE2 *, bool) = sanity_check2; - - static void fixup_acsc(TERMTYPE2 *, int); - --- -2.21.1 - diff --git a/recipes/ncurses/all/patches/6.2.0-0006-Add-potentially-missing-STDOUT_FILENO.patch b/recipes/ncurses/all/patches/6.2.0-0006-Add-potentially-missing-STDOUT_FILENO.patch deleted file mode 100644 index 60a2039b3f9e1..0000000000000 --- a/recipes/ncurses/all/patches/6.2.0-0006-Add-potentially-missing-STDOUT_FILENO.patch +++ /dev/null @@ -1,31 +0,0 @@ -Upstreamed in 18f51bcf99101e5bf4c737239c44064227f34db8 - -ncurses 6.2 - patch 20200229 - -From 536b8ba02682dcf367efba46b9616a9695341797 Mon Sep 17 00:00:00 2001 -From: Anonymous Maarten -Date: Tue, 17 Mar 2020 15:27:22 +0100 -Subject: [PATCH 06/15] Add potentially missing STDOUT_FILENO - ---- - progs/progs.priv.h | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/progs/progs.priv.h b/progs/progs.priv.h -index da7a5154..4734e740 100644 ---- a/progs/progs.priv.h -+++ b/progs/progs.priv.h -@@ -155,6 +155,10 @@ extern int optind; - #endif /* gcc workarounds */ - - /* usually in */ -+#ifndef STDIN_FILENO -+#define STDIN_FILENO 0 -+#endif -+ - #ifndef STDOUT_FILENO - #define STDOUT_FILENO 1 - #endif --- -2.21.1 - diff --git a/recipes/ncurses/all/patches/6.2.0-0007-No-import-export-declaration-on-class-members.patch b/recipes/ncurses/all/patches/6.2.0-0007-No-import-export-declaration-on-class-members.patch deleted file mode 100644 index ef00f1218a927..0000000000000 --- a/recipes/ncurses/all/patches/6.2.0-0007-No-import-export-declaration-on-class-members.patch +++ /dev/null @@ -1,53 +0,0 @@ -Upstreamed in 18f51bcf99101e5bf4c737239c44064227f34db8 - -ncurses 6.2 - patch 20200229 - -From ff6bd063127225360332a938ed8e6babd90d9798 Mon Sep 17 00:00:00 2001 -From: Anonymous Maarten -Date: Tue, 17 Mar 2020 15:28:30 +0100 -Subject: [PATCH 07/15] No import/export declaration on class members - ---- - c++/cursslk.h | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - -diff --git a/c++/cursslk.h b/c++/cursslk.h -index 5a7b78c3..10364c1d 100644 ---- a/c++/cursslk.h -+++ b/c++/cursslk.h -@@ -101,10 +101,10 @@ public: - } Label_Layout; - - private: -- static long NCURSES_IMPEXP count; // Number of Key Sets -- static Label_Layout NCURSES_IMPEXP format; // Layout of the Key Sets -- static int NCURSES_IMPEXP num_labels; // Number Of Labels in Key Sets -- bool NCURSES_IMPEXP b_attrInit; // Are attributes initialized -+ static long count; // Number of Key Sets -+ static Label_Layout format; // Layout of the Key Sets -+ static int num_labels; // Number Of Labels in Key Sets -+ bool b_attrInit; // Are attributes initialized - - Soft_Label_Key *slk_array; // The array of SLK's - -@@ -144,7 +144,7 @@ public: - - // This constructor assumes, that you already constructed a Key Set - // with a layout by the constructor above. This layout will be reused. -- NCURSES_IMPEXP Soft_Label_Key_Set(); -+ Soft_Label_Key_Set(); - - Soft_Label_Key_Set& operator=(const Soft_Label_Key_Set& rhs) - { -@@ -165,7 +165,7 @@ public: - virtual ~Soft_Label_Key_Set() THROWS(NCursesException); - - // Get Label# i. Label counting starts with 1! -- NCURSES_IMPEXP Soft_Label_Key& operator[](int i); -+ Soft_Label_Key& operator[](int i); - - // Retrieve number of Labels - inline int labels() const { return num_labels; } --- -2.21.1 - diff --git a/recipes/ncurses/all/patches/6.2.0-0008-Add-include-file-to-add-export-annotation.patch b/recipes/ncurses/all/patches/6.2.0-0008-Add-include-file-to-add-export-annotation.patch deleted file mode 100644 index d29108c2fbbb7..0000000000000 --- a/recipes/ncurses/all/patches/6.2.0-0008-Add-include-file-to-add-export-annotation.patch +++ /dev/null @@ -1,100 +0,0 @@ -Upstreamed in 3e37c7d3fa122563a9d88168926f61286ef30cd3 - -ncurses 6.2 - patch 20200523 - -this patch differs with upstream: -upstream has integrated this fine in ncurses_dll.h.in (instead of creating a new file) -This change is small, so don't care. - -From ffcd8b69aa8346e94aceefdc4593ad74635708f9 Mon Sep 17 00:00:00 2001 -From: Anonymous Maarten -Date: Sat, 14 Mar 2020 12:38:41 +0100 -Subject: [PATCH 08/15] Add include file to add export annotation - ---- - configure.in | 1 + - include/headers | 1 + - include/ncurses_exports.h.in | 47 ++++++++++++++++++++++++++++++++++++ - 3 files changed, 49 insertions(+) - create mode 100644 include/ncurses_exports.h.in - -diff --git a/configure.in b/configure.in -index 2183a978..fc00f9dc 100644 ---- a/configure.in -+++ b/configure.in -@@ -2395,6 +2395,7 @@ AC_OUTPUT( \ - include/MKterm.h.awk \ - include/curses.head:include/curses.h.in \ - include/ncurses_dll.h \ -+ include/ncurses_exports.h \ - include/termcap.h \ - include/unctrl.h \ - $SUB_MAKEFILES \ -diff --git a/include/headers b/include/headers -index dbb134d1..e20798b4 100644 ---- a/include/headers -+++ b/include/headers -@@ -33,6 +33,7 @@ - curses.h - unctrl.h - ncurses_dll.h -+ncurses_exports.h - - # Support for termcap (and tic, etc.), which can be a separate library - @ termlib -diff --git a/include/ncurses_exports.h.in b/include/ncurses_exports.h.in -new file mode 100644 -index 00000000..252f5021 ---- /dev/null -+++ b/include/ncurses_exports.h.in -@@ -0,0 +1,47 @@ -+/**************************************************************************** -+ * Copyright 2020 Thomas E. Dickey * -+ * * -+ * 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, distribute with modifications, 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 ABOVE 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. * -+ * * -+ * Except as contained in this notice, the name(s) of the above copyright * -+ * holders shall not be used in advertising or otherwise to promote the * -+ * sale, use or other dealings in this Software without prior written * -+ * authorization. * -+ ****************************************************************************/ -+/* $Id: ncurses_exports.h.in,v 1.13 2020/02/29 21:53:14 tom Exp $ */ -+ -+#ifndef NCURSES_EXPORTS_H_incl -+#define NCURSES_EXPORTS_H_incl 1 -+ -+#if defined(__CYGWIN__) || defined(_WIN32) -+# if defined(NCURSES_DLL) -+# define NCURSES_EXPORT __declspec(dllexport) -+# elif !defined(NCURSES_STATIC) -+# define NCURSES_EXPORT __declspec(dllimport) -+# else -+# define NCURSES_EXPORT -+# endif -+#endif -+ -+#if !defined(NCURSES_EXPORT) -+# define NCURSES_EXPORT @NCURSES_EXPORT@ -+#endif -+ -+#endif /* NCURSES_EXPORTS_H_incl */ --- -2.21.1 - diff --git a/recipes/ncurses/all/patches/6.2.0-0010-Pass-BUILDING_XXX-compile-definition-while-building-.patch b/recipes/ncurses/all/patches/6.2.0-0010-Pass-BUILDING_XXX-compile-definition-while-building-.patch deleted file mode 100644 index ffa1320f610fb..0000000000000 --- a/recipes/ncurses/all/patches/6.2.0-0010-Pass-BUILDING_XXX-compile-definition-while-building-.patch +++ /dev/null @@ -1,242 +0,0 @@ -Upstreamed in 04d942c3d98cf0a929c6afb17be8c10d4ae39af0 - -ncurses 6.2 - patch 20200704 - -From ed3ad1962ab885b9a9c6e6a3437eb6db274110b5 Mon Sep 17 00:00:00 2001 -From: Anonymous Maarten -Date: Sat, 14 Mar 2020 14:15:41 +0100 -Subject: [PATCH 10/15] Pass BUILDING_XXX compile definition while building - library XXX - ---- - c++/Makefile.in | 6 ++--- - form/Makefile.in | 6 ++--- - include/ncurses_dll.h.in | 49 ++++++------------------------------ - include/ncurses_exports.h.in | 23 +++++++++-------- - menu/Makefile.in | 6 ++--- - ncurses/Makefile.in | 8 +++--- - panel/Makefile.in | 6 ++--- - 7 files changed, 35 insertions(+), 69 deletions(-) - -diff --git a/c++/Makefile.in b/c++/Makefile.in -index 9b22b6ac..17b3e069 100644 ---- a/c++/Makefile.in -+++ b/c++/Makefile.in -@@ -89,7 +89,7 @@ CXXFLAGS = @CXXFLAGS@ @EXTRA_CXXFLAGS@ - CXXLIBS = @CXXLIBS@ - - INCDIR = ../include --CPPFLAGS = -DHAVE_CONFIG_H -I../c++ @CPPFLAGS@ -+CPPFLAGS = -DHAVE_CONFIG_H -DBUILDING_NCURSES_CXX -I../c++ @CPPFLAGS@ - - CTAGS = @CTAGS@ - ETAGS = @ETAGS@ -@@ -97,8 +97,8 @@ ETAGS = @ETAGS@ - CC = ${CXX} - CCFLAGS = $(CPPFLAGS) $(CXXFLAGS) - --CFLAGS_LIBTOOL = $(CCFLAGS) --CFLAGS_NORMAL = $(CCFLAGS) -+CFLAGS_LIBTOOL = $(CCFLAGS) -DNCURSES_STATIC -+CFLAGS_NORMAL = $(CCFLAGS) -DNCURSES_STATIC - CFLAGS_DEBUG = $(CCFLAGS) @CXX_G_OPT@ -DTRACE - CFLAGS_PROFILE = $(CCFLAGS) -pg - CFLAGS_SHARED = $(CCFLAGS) @CC_SHARED_OPTS@ -diff --git a/form/Makefile.in b/form/Makefile.in -index 3e5be8da..34bfd172 100644 ---- a/form/Makefile.in -+++ b/form/Makefile.in -@@ -92,12 +92,12 @@ CC = @CC@ - CPP = @CPP@ - CFLAGS = @CFLAGS@ - --CPPFLAGS = -I${top_srcdir}/ncurses -DHAVE_CONFIG_H @CPPFLAGS@ -+CPPFLAGS = -I${top_srcdir}/ncurses -DHAVE_CONFIG_H @CPPFLAGS@ -DBUILDING_FORM - - CCFLAGS = $(CPPFLAGS) $(CFLAGS) - --CFLAGS_LIBTOOL = $(CCFLAGS) --CFLAGS_NORMAL = $(CCFLAGS) -+CFLAGS_LIBTOOL = $(CCFLAGS) -DNCURSES_STATIC -+CFLAGS_NORMAL = $(CCFLAGS) -DNCURSES_STATIC - CFLAGS_DEBUG = $(CCFLAGS) @CC_G_OPT@ -DTRACE - CFLAGS_PROFILE = $(CCFLAGS) -pg - CFLAGS_SHARED = $(CCFLAGS) @CC_SHARED_OPTS@ -diff --git a/include/ncurses_dll.h.in b/include/ncurses_dll.h.in -index f439d480..568112e2 100644 ---- a/include/ncurses_dll.h.in -+++ b/include/ncurses_dll.h.in -@@ -68,50 +68,15 @@ - #define NCURSES_PUBLIC_VAR(name) @NCURSES_WRAP_PREFIX@##name - #define NCURSES_WRAPPED_VAR(type,name) extern type NCURSES_PUBLIC_VAR(name)(void) - --/* no longer needed on cygwin or mingw, thanks to auto-import */ --/* but this structure may be useful at some point for an MSVC build */ --/* so, for now unconditionally define the important flags */ --/* "the right way" for proper static and dll+auto-import behavior */ --#undef NCURSES_DLL --#define NCURSES_STATIC -+#include "ncurses_exports.h" - --#if defined(__CYGWIN__) || defined(_WIN32) --# if defined(NCURSES_DLL) --# if defined(NCURSES_STATIC) --# undef NCURSES_STATIC --# endif --# endif --# undef NCURSES_IMPEXP --# undef NCURSES_API --# undef NCURSES_EXPORT --# undef NCURSES_EXPORT_VAR --# if defined(NCURSES_DLL) --/* building a DLL */ --# define NCURSES_IMPEXP __declspec(dllexport) --# elif defined(NCURSES_STATIC) --/* building or linking to a static library */ --# define NCURSES_IMPEXP /* nothing */ --# else --/* linking to the DLL */ --# define NCURSES_IMPEXP __declspec(dllimport) --# endif --# define NCURSES_API __cdecl --# define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API --# define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type -+#if defined(BUILDING_NCURSES) -+# define NCURSES_IMPEXP NCURSES_EXPORT_GENERAL_EXPORT -+#else -+# define NCURSES_IMPEXP NCURSES_EXPORT_GENERAL_IMPORT - #endif - --/* Take care of non-cygwin platforms */ --#if !defined(NCURSES_IMPEXP) --# define NCURSES_IMPEXP /* nothing */ --#endif --#if !defined(NCURSES_API) --# define NCURSES_API /* nothing */ --#endif --#if !defined(NCURSES_EXPORT) --# define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API --#endif --#if !defined(NCURSES_EXPORT_VAR) --# define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type --#endif -+#define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API -+#define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type - - #endif /* NCURSES_DLL_H_incl */ -diff --git a/include/ncurses_exports.h.in b/include/ncurses_exports.h.in -index 252f5021..61655f65 100644 ---- a/include/ncurses_exports.h.in -+++ b/include/ncurses_exports.h.in -@@ -31,17 +31,18 @@ - #define NCURSES_EXPORTS_H_incl 1 - - #if defined(__CYGWIN__) || defined(_WIN32) --# if defined(NCURSES_DLL) --# define NCURSES_EXPORT __declspec(dllexport) --# elif !defined(NCURSES_STATIC) --# define NCURSES_EXPORT __declspec(dllimport) --# else --# define NCURSES_EXPORT --# endif --#endif -- --#if !defined(NCURSES_EXPORT) --# define NCURSES_EXPORT @NCURSES_EXPORT@ -+# if defined(NCURSES_STATIC) -+# define NCURSES_EXPORT_GENERAL_IMPORT -+# define NCURSES_EXPORT_GENERAL_EXPORT -+# else -+# define NCURSES_EXPORT_GENERAL_IMPORT __declspec(dllimport) -+# define NCURSES_EXPORT_GENERAL_EXPORT __declspec(dllexport) -+# endif -+# define NCURSES_API __cdecl -+#else -+# define NCURSES_EXPORT_GENERAL_IMPORT -+# define NCURSES_EXPORT_GENERAL_EXPORT -+# define NCURSES_API /* FIXME: __attribute__ ((cdecl)) is only available on x86 */ - #endif - - #endif /* NCURSES_EXPORTS_H_incl */ -diff --git a/menu/Makefile.in b/menu/Makefile.in -index 495651c2..bf153602 100644 ---- a/menu/Makefile.in -+++ b/menu/Makefile.in -@@ -92,12 +92,12 @@ CC = @CC@ - CPP = @CPP@ - CFLAGS = @CFLAGS@ - --CPPFLAGS = -I${top_srcdir}/ncurses -DHAVE_CONFIG_H @CPPFLAGS@ -+CPPFLAGS = -I${top_srcdir}/ncurses -DHAVE_CONFIG_H @CPPFLAGS@ -DBUILDING_MENU - - CCFLAGS = $(CPPFLAGS) $(CFLAGS) - --CFLAGS_LIBTOOL = $(CCFLAGS) --CFLAGS_NORMAL = $(CCFLAGS) -+CFLAGS_LIBTOOL = $(CCFLAGS) -DNCURSES_STATIC -+CFLAGS_NORMAL = $(CCFLAGS) -DNCURSES_STATIC - CFLAGS_DEBUG = $(CCFLAGS) @CC_G_OPT@ -DTRACE - CFLAGS_PROFILE = $(CCFLAGS) -pg - CFLAGS_SHARED = $(CCFLAGS) @CC_SHARED_OPTS@ -diff --git a/ncurses/Makefile.in b/ncurses/Makefile.in -index b2420788..00129d0b 100644 ---- a/ncurses/Makefile.in -+++ b/ncurses/Makefile.in -@@ -102,11 +102,11 @@ CPP = @CPP@ - CFLAGS = @CFLAGS@ - - INCDIR = $(srcdir)/../include --CPPFLAGS = -DHAVE_CONFIG_H -I../ncurses @CPPFLAGS@ -+CPPFLAGS = -DHAVE_CONFIG_H -DBUILDING_NCURSES -I../ncurses @CPPFLAGS@ - - CCFLAGS = $(CPPFLAGS) $(CFLAGS) - --BUILD_CPPFLAGS = -DHAVE_CONFIG_H -DUSE_BUILD_CC -I../ncurses -I$(srcdir) -I../include -I$(INCDIR) @BUILD_CPPFLAGS@ -+BUILD_CPPFLAGS = -DHAVE_CONFIG_H -DUSE_BUILD_CC -I../ncurses -I$(srcdir) -I../include -I$(INCDIR) @BUILD_CPPFLAGS@ - BUILD_CC = @BUILD_CC@ - BUILD_CCFLAGS = @BUILD_CFLAGS@ - BUILD_LDFLAGS = @BUILD_LDFLAGS@ -@@ -118,8 +118,8 @@ BUILD_LIBS = @BUILD_LIBS@ - BUILD_EXEEXT = @BUILD_EXEEXT@ - x = @EXEEXT@ - --CFLAGS_LIBTOOL = $(CCFLAGS) --CFLAGS_NORMAL = $(CCFLAGS) -+CFLAGS_LIBTOOL = $(CCFLAGS) -DNCURSES_STATIC -+CFLAGS_NORMAL = $(CCFLAGS) -DNCURSES_STATIC - CFLAGS_DEBUG = $(CCFLAGS) @CC_G_OPT@ -DTRACE - CFLAGS_PROFILE = $(CCFLAGS) -pg - CFLAGS_SHARED = $(CCFLAGS) @CC_SHARED_OPTS@ -diff --git a/panel/Makefile.in b/panel/Makefile.in -index 5f7b5b92..e1f7e705 100644 ---- a/panel/Makefile.in -+++ b/panel/Makefile.in -@@ -94,12 +94,12 @@ CC = @CC@ - CPP = @CPP@ - CFLAGS = @CFLAGS@ - --CPPFLAGS = -I${top_srcdir}/ncurses -DHAVE_CONFIG_H @CPPFLAGS@ -+CPPFLAGS = -I${top_srcdir}/ncurses -DHAVE_CONFIG_H @CPPFLAGS@ -DBUILDING_PANEL - - CCFLAGS = $(CPPFLAGS) $(CFLAGS) - --CFLAGS_LIBTOOL = $(CCFLAGS) --CFLAGS_NORMAL = $(CCFLAGS) -+CFLAGS_LIBTOOL = $(CCFLAGS) -DNCURSES_STATIC -+CFLAGS_NORMAL = $(CCFLAGS) -DNCURSES_STATIC - CFLAGS_DEBUG = $(CCFLAGS) @CC_G_OPT@ -DTRACE - CFLAGS_PROFILE = $(CCFLAGS) -pg - CFLAGS_SHARED = $(CCFLAGS) @CC_SHARED_OPTS@ ---- a/progs/Makefile.in -+++ b/progs/Makefile.in -@@ -97,8 +97,8 @@ - - CCFLAGS = $(CPPFLAGS) $(CFLAGS) - --CFLAGS_LIBTOOL = $(CCFLAGS) --CFLAGS_NORMAL = $(CCFLAGS) -+CFLAGS_LIBTOOL = $(CCFLAGS) -DNCURSES_STATIC -+CFLAGS_NORMAL = $(CCFLAGS) -DNCURSES_STATIC - CFLAGS_DEBUG = $(CCFLAGS) @CC_G_OPT@ -DTRACE - CFLAGS_PROFILE = $(CCFLAGS) -pg - CFLAGS_SHARED = $(CCFLAGS) @CC_SHARED_OPTS@ diff --git a/recipes/ncurses/all/patches/6.2.0-0011-Let-each-sublibrary-do-its-own-import-exporting.patch b/recipes/ncurses/all/patches/6.2.0-0011-Let-each-sublibrary-do-its-own-import-exporting.patch deleted file mode 100644 index 38de8ccbe5b84..0000000000000 --- a/recipes/ncurses/all/patches/6.2.0-0011-Let-each-sublibrary-do-its-own-import-exporting.patch +++ /dev/null @@ -1,3326 +0,0 @@ -Upstreamed in 04d942c3d98cf0a929c6afb17be8c10d4ae39af0 - -ncurses 6.2 - patch 20200704 - -d61c3c6a ("ncurses 6.2 - patch 20200711", 2020-07-12) - ---- ncurses/win32con/wcwidth.c -+++ ncurses/win32con/wcwidth.c -@@ -36,10 +36,10 @@ MODULE_ID("$Id: wcwidth.c,v 1.3 2020/02/02 23:34:34 tom Exp $") - #define mk_wcwidth_cjk(ucs) _nc_wcwidth_cjk(ucs) - #define mk_wcswidth_cjk(pwcs, n) _nc_wcswidth_cjk(pwcs, n) - --extern int mk_wcwidth(wchar_t); --extern int mk_wcswidth(const wchar_t *, size_t); --extern int mk_wcwidth_cjk(wchar_t); --extern int mk_wcswidth_cjk(const wchar_t *, size_t); -+NCURSES_EXPORT(int) mk_wcwidth(wchar_t); -+NCURSES_EXPORT(int) mk_wcswidth(const wchar_t *, size_t); -+NCURSES_EXPORT(int) mk_wcwidth_cjk(wchar_t); -+NCURSES_EXPORT(int) mk_wcswidth_cjk(const wchar_t *, size_t); - - #include - #else ---- ncurses/wcwidth.h -+++ ncurses/wcwidth.h -@@ -119,7 +119,7 @@ - * in ISO 10646. - */ - --int mk_wcwidth(wchar_t ucs) -+NCURSES_EXPORT(int) mk_wcwidth(wchar_t ucs) - { - /* sorted list of non-overlapping intervals of non-spacing characters */ - /* generated by "uniset +cat=Me +cat=Mn +cat=Cf -00AD +1160-11FF +200B c" */ -@@ -207,7 +207,7 @@ int mk_wcwidth(wchar_t ucs) - } - - --int mk_wcswidth(const wchar_t *pwcs, size_t n) -+NCURSES_EXPORT(int) mk_wcswidth(const wchar_t *pwcs, size_t n) - { - int w, width = 0; - -@@ -230,7 +230,7 @@ int mk_wcswidth(const wchar_t *pwcs, size_t n) - * the traditional terminal character-width behaviour. It is not - * otherwise recommended for general use. - */ --int mk_wcwidth_cjk(wchar_t ucs) -+NCURSES_EXPORT(int) mk_wcwidth_cjk(wchar_t ucs) - { - /* sorted list of non-overlapping intervals of East Asian Ambiguous - * characters, generated by "uniset +WIDTH-A -cat=Me -cat=Mn -cat=Cf c" */ -@@ -298,7 +298,7 @@ int mk_wcwidth_cjk(wchar_t ucs) - } - - --int mk_wcswidth_cjk(const wchar_t *pwcs, size_t n) -+NCURSES_EXPORT(int) mk_wcswidth_cjk(const wchar_t *pwcs, size_t n) - { - int w, width = 0; - -diff --git a/c++/cursesapp.h b/c++/cursesapp.h -index a09a3b63..e423089c 100644 ---- a/c++/cursesapp.h -+++ b/c++/cursesapp.h -@@ -39,7 +39,7 @@ - - #include - --class NCURSES_IMPEXP NCursesApplication { -+class NCURSES_CXX_IMPEXP NCursesApplication { - public: - typedef struct _slk_link { // This structure is used to maintain - struct _slk_link* prev; // a stack of SLKs -diff --git a/c++/cursesf.h b/c++/cursesf.h -index 17d4c70e..1e90c360 100644 ---- a/c++/cursesf.h -+++ b/c++/cursesf.h -@@ -51,11 +51,11 @@ extern "C" { - // The abstract base class for builtin and user defined Fieldtypes. - // ------------------------------------------------------------------------- - // --class NCURSES_IMPEXP NCursesFormField; // forward declaration -+class NCURSES_CXX_IMPEXP NCursesFormField; // forward declaration - - // Class to represent builtin field types as well as C++ written new - // fieldtypes (see classes UserDefineFieldType... --class NCURSES_IMPEXP NCursesFieldType -+class NCURSES_CXX_IMPEXP NCursesFieldType - { - friend class NCursesFormField; - -@@ -101,7 +101,7 @@ public: - // The class representing a forms field, wrapping the lowlevel FIELD struct - // ------------------------------------------------------------------------- - // --class NCURSES_IMPEXP NCursesFormField -+class NCURSES_CXX_IMPEXP NCursesFormField - { - friend class NCursesForm; - -@@ -338,7 +338,7 @@ extern "C" { - // The class representing a form, wrapping the lowlevel FORM struct - // ------------------------------------------------------------------------- - // --class NCURSES_IMPEXP NCursesForm : public NCursesPanel -+class NCURSES_CXX_IMPEXP NCursesForm : public NCursesPanel - { - protected: - FORM* form; // the lowlevel structure -@@ -629,7 +629,7 @@ public: - // data belongs to some class T. Use T as template argument - // to create a UserField. - // ------------------------------------------------------------------------- --template class NCURSES_IMPEXP NCursesUserField : public NCursesFormField -+template class NCURSES_CXX_IMPEXP NCursesUserField : public NCursesFormField - { - public: - NCursesUserField (int rows, -@@ -662,7 +662,7 @@ public: - // The same mechanism is used to attach user data to a form - // ------------------------------------------------------------------------- - // --template class NCURSES_IMPEXP NCursesUserForm : public NCursesForm -+template class NCURSES_CXX_IMPEXP NCursesUserForm : public NCursesForm - { - protected: - // 'Internal' constructor, builds an object without association to a -@@ -721,7 +721,7 @@ public: - // Builtin Fieldtypes - // ------------------------------------------------------------------------- - // --class NCURSES_IMPEXP Alpha_Field : public NCursesFieldType -+class NCURSES_CXX_IMPEXP Alpha_Field : public NCursesFieldType - { - private: - int min_field_width; -@@ -737,7 +737,7 @@ public: - } - }; - --class NCURSES_IMPEXP Alphanumeric_Field : public NCursesFieldType -+class NCURSES_CXX_IMPEXP Alphanumeric_Field : public NCursesFieldType - { - private: - int min_field_width; -@@ -753,7 +753,7 @@ public: - } - }; - --class NCURSES_IMPEXP Integer_Field : public NCursesFieldType -+class NCURSES_CXX_IMPEXP Integer_Field : public NCursesFieldType - { - private: - int precision; -@@ -771,7 +771,7 @@ public: - } - }; - --class NCURSES_IMPEXP Numeric_Field : public NCursesFieldType -+class NCURSES_CXX_IMPEXP Numeric_Field : public NCursesFieldType - { - private: - int precision; -@@ -789,7 +789,7 @@ public: - } - }; - --class NCURSES_IMPEXP Regular_Expression_Field : public NCursesFieldType -+class NCURSES_CXX_IMPEXP Regular_Expression_Field : public NCursesFieldType - { - private: - char* regex; -@@ -834,7 +834,7 @@ public: - } - }; - --class NCURSES_IMPEXP Enumeration_Field : public NCursesFieldType -+class NCURSES_CXX_IMPEXP Enumeration_Field : public NCursesFieldType - { - private: - const char** list; -@@ -873,7 +873,7 @@ public: - } - }; - --class NCURSES_IMPEXP IPV4_Address_Field : public NCursesFieldType -+class NCURSES_CXX_IMPEXP IPV4_Address_Field : public NCursesFieldType - { - private: - void set(NCursesFormField& f) { -@@ -896,7 +896,7 @@ extern "C" { - // Abstract base class for User-Defined Fieldtypes - // ------------------------------------------------------------------------- - // --class NCURSES_IMPEXP UserDefinedFieldType : public NCursesFieldType -+class NCURSES_CXX_IMPEXP UserDefinedFieldType : public NCursesFieldType - { - friend class UDF_Init; // Internal helper to set up statics - private: -@@ -939,7 +939,7 @@ extern "C" { - // Abstract base class for User-Defined Fieldtypes with Choice functions - // ------------------------------------------------------------------------- - // --class NCURSES_IMPEXP UserDefinedFieldType_With_Choice : public UserDefinedFieldType -+class NCURSES_CXX_IMPEXP UserDefinedFieldType_With_Choice : public UserDefinedFieldType - { - friend class UDF_Init; // Internal helper to set up statics - private: -diff --git a/c++/cursesm.h b/c++/cursesm.h -index 413da764..0eab3861 100644 ---- a/c++/cursesm.h -+++ b/c++/cursesm.h -@@ -47,7 +47,7 @@ extern "C" { - // This wraps the ITEM type of - // ------------------------------------------------------------------------- - // --class NCURSES_IMPEXP NCursesMenuItem -+class NCURSES_CXX_IMPEXP NCursesMenuItem - { - friend class NCursesMenu; - -@@ -153,7 +153,7 @@ typedef bool ITEMCALLBACK(NCursesMenuItem&); - // If you don't like to create a child class for individual items to - // overload action(), you may use this class and provide a callback - // function pointer for items. --class NCURSES_IMPEXP NCursesMenuCallbackItem : public NCursesMenuItem -+class NCURSES_CXX_IMPEXP NCursesMenuCallbackItem : public NCursesMenuItem - { - private: - ITEMCALLBACK* p_fct; -@@ -200,7 +200,7 @@ extern "C" { - // This wraps the MENU type of - // ------------------------------------------------------------------------- - // --class NCURSES_IMPEXP NCursesMenu : public NCursesPanel -+class NCURSES_CXX_IMPEXP NCursesMenu : public NCursesPanel - { - protected: - MENU *menu; -@@ -596,7 +596,7 @@ public: - // to create a UserItem. - // ------------------------------------------------------------------------- - // --template class NCURSES_IMPEXP NCursesUserItem : public NCursesMenuItem -+template class NCURSES_CXX_IMPEXP NCursesUserItem : public NCursesMenuItem - { - public: - NCursesUserItem (const char* p_name, -@@ -623,7 +623,7 @@ public: - // The same mechanism is used to attach user data to a menu - // ------------------------------------------------------------------------- - // --template class NCURSES_IMPEXP NCursesUserMenu : public NCursesMenu -+template class NCURSES_CXX_IMPEXP NCursesUserMenu : public NCursesMenu - { - protected: - NCursesUserMenu( int nlines, -diff --git a/c++/cursesp.h b/c++/cursesp.h -index d1eea968..af97b022 100644 ---- a/c++/cursesmain.cc -+++ b/c++/cursesmain.cc -@@ -60,7 +60,7 @@ MODULE_ID("$Id: cursesmain.cc,v 1.18 2020/04/04 23:25:34 tom Exp $") - * You only have to instantiate a static NCursesApplication object in your - * main application source file and link this module with your application. - */ --int main(int argc, char* argv[]) -+NCURSES_CXX_IMPEXP int main(int argc, char* argv[]) - { - setlocale(LC_ALL, ""); - ---- a/c++/cursesp.h -+++ b/c++/cursesp.h -@@ -43,7 +43,7 @@ extern "C" { - # include - } - --class NCURSES_IMPEXP NCursesPanel -+class NCURSES_CXX_IMPEXP NCursesPanel - : public NCursesWindow - { - protected: -diff --git a/c++/cursesw.h b/c++/cursesw.h -index 10a2da7e..62721495 100644 ---- a/c++/cursesw.h -+++ b/c++/cursesw.h -@@ -38,6 +38,19 @@ extern "C" { - # include - } - -+#include "ncurses_exports.h" -+ -+#if defined(BUILDING_NCURSES_CXX) -+# define NCURSES_CXX_IMPEXP NCURSES_EXPORT_GENERAL_EXPORT -+#else -+# define NCURSES_CXX_IMPEXP NCURSES_EXPORT_GENERAL_IMPORT -+#endif -+ -+#define NCURSES_CXX_WRAPPED_VAR(type,name) extern NCURSES_CXX_IMPEXP type NCURSES_PUBLIC_VAR(name)(void) -+ -+#define NCURSES_CXX_EXPORT(type) NCURSES_CXX_IMPEXP type NCURSES_API -+#define NCURSES_CXX_EXPORT_VAR(type) NCURSES_CXX_IMPEXP type -+ - #include - - /* SCO 3.2v4 curses.h includes term.h, which defines lines as a macro. -@@ -757,7 +770,7 @@ extern "C" int _nc_ripoffline(int, int (*init)(WINDOW*, int)); - extern "C" int _nc_xx_ripoff_init(WINDOW *, int); - extern "C" int _nc_has_mouse(void); - --class NCURSES_IMPEXP NCursesWindow -+class NCURSES_CXX_IMPEXP NCursesWindow - { - friend class NCursesMenu; - friend class NCursesForm; -@@ -1371,7 +1384,7 @@ public: - // ------------------------------------------------------------------------- - // We leave this here for compatibility reasons. - // ------------------------------------------------------------------------- --class NCURSES_IMPEXP NCursesColorWindow : public NCursesWindow -+class NCURSES_CXX_IMPEXP NCursesColorWindow : public NCursesWindow - { - public: - NCursesColorWindow(WINDOW* &window) // useful only for stdscr -@@ -1417,7 +1430,7 @@ public: - // Pad Support. We allow an association of a pad with a "real" window - // through which the pad may be viewed. - // ------------------------------------------------------------------------- --class NCURSES_IMPEXP NCursesPad : public NCursesWindow -+class NCURSES_CXX_IMPEXP NCursesPad : public NCursesWindow - { - private: - NCursesWindow* viewWin; // the "viewport" window -@@ -1533,7 +1546,7 @@ public: - // A FramedPad is constructed always with a viewport window. This viewport - // will be framed (by a box() command) and the interior of the box is the - // viewport subwindow. On the frame we display scrollbar sliders. --class NCURSES_IMPEXP NCursesFramedPad : public NCursesPad -+class NCURSES_CXX_IMPEXP NCursesFramedPad : public NCursesPad - { - protected: - virtual void OnOperation(int pad_req); -diff --git a/c++/cursslk.h b/c++/cursslk.h -index 10364c1d..d69f27d5 100644 ---- a/c++/cursslk.h -+++ b/c++/cursslk.h -@@ -39,10 +39,10 @@ - - #include - --class NCURSES_IMPEXP Soft_Label_Key_Set { -+class NCURSES_CXX_IMPEXP Soft_Label_Key_Set { - public: - // This inner class represents the attributes of a Soft Label Key (SLK) -- class NCURSES_IMPEXP Soft_Label_Key { -+ class NCURSES_CXX_IMPEXP Soft_Label_Key { - friend class Soft_Label_Key_Set; - public: - typedef enum { Left=0, Center=1, Right=2 } Justification; -diff --git a/c++/demo.cc b/c++/demo.cc -index 2b5451a4..b5480808 100644 ---- a/c++/demo.cc -+++ b/c++/demo.cc -@@ -187,7 +187,7 @@ public: - }; - - template class MyAction; --template class NCURSES_IMPEXP NCursesUserItem; -+template class NCURSES_CXX_IMPEXP NCursesUserItem; - - class QuitItem : public NCursesMenuItem - { -diff --git a/c++/etip.h.in b/c++/etip.h.in -index 1155c5fd..65a5b450 100644 ---- a/c++/etip.h.in -+++ b/c++/etip.h.in -@@ -140,11 +140,11 @@ extern "C" { - #endif - - // Forward Declarations --class NCURSES_IMPEXP NCursesPanel; --class NCURSES_IMPEXP NCursesMenu; --class NCURSES_IMPEXP NCursesForm; -+class NCURSES_CXX_IMPEXP NCursesPanel; -+class NCURSES_CXX_IMPEXP NCursesMenu; -+class NCURSES_CXX_IMPEXP NCursesForm; - --class NCURSES_IMPEXP NCursesException -+class NCURSES_CXX_IMPEXP NCursesException - { - public: - const char *message; -@@ -178,7 +178,7 @@ public: - } - }; - --class NCURSES_IMPEXP NCursesPanelException : public NCursesException -+class NCURSES_CXX_IMPEXP NCursesPanelException : public NCursesException - { - public: - const NCursesPanel* p; -@@ -229,7 +229,7 @@ public: - } - }; - --class NCURSES_IMPEXP NCursesMenuException : public NCursesException -+class NCURSES_CXX_IMPEXP NCursesMenuException : public NCursesException - { - public: - const NCursesMenu* m; -@@ -280,7 +280,7 @@ public: - } - }; - --class NCURSES_IMPEXP NCursesFormException : public NCursesException -+class NCURSES_CXX_IMPEXP NCursesFormException : public NCursesException - { - public: - const NCursesForm* f; -diff --git a/form/f_trace.c b/form/f_trace.c -index d24708ce..6efc5225 100644 ---- a/form/f_trace.c -+++ b/form/f_trace.c -@@ -35,35 +35,35 @@ - - MODULE_ID("$Id: f_trace.c,v 1.5 2020/02/02 23:34:34 tom Exp $") - --NCURSES_EXPORT(FIELD **) -+FORM_EXPORT(FIELD **) - _nc_retrace_field_ptr(FIELD **code) - { - T((T_RETURN("%p"), (void *)code)); - return code; - } - --NCURSES_EXPORT(FIELD *) -+FORM_EXPORT(FIELD *) - _nc_retrace_field(FIELD *code) - { - T((T_RETURN("%p"), (void *)code)); - return code; - } - --NCURSES_EXPORT(FIELDTYPE *) -+FORM_EXPORT(FIELDTYPE *) - _nc_retrace_field_type(FIELDTYPE *code) - { - T((T_RETURN("%p"), (void *)code)); - return code; - } - --NCURSES_EXPORT(FORM *) -+FORM_EXPORT(FORM *) - _nc_retrace_form(FORM *code) - { - T((T_RETURN("%p"), (void *)code)); - return code; - } - --NCURSES_EXPORT(Form_Hook) -+FORM_EXPORT(Form_Hook) - _nc_retrace_form_hook(Form_Hook code) - { - TR_FUNC_BFR(1); -diff --git a/form/fld_arg.c b/form/fld_arg.c -index e7555f65..852cd6a8 100644 ---- a/form/fld_arg.c -+++ b/form/fld_arg.c -@@ -61,7 +61,7 @@ MODULE_ID("$Id: fld_arg.c,v 1.16 2020/02/02 23:34:34 tom Exp $") - | Return Values : E_OK - success - | E_BAD_ARGUMENT - invalid argument - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+FORM_EXPORT(int) - set_fieldtype_arg(FIELDTYPE *typ, - void *(*const make_arg)(va_list *), - void *(*const copy_arg)(const void *), -@@ -94,7 +94,7 @@ set_fieldtype_arg(FIELDTYPE *typ, - | - | Return Values : Pointer to structure or NULL if none is defined. - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(void *) -+FORM_EXPORT(void *) - field_arg(const FIELD *field) - { - T((T_CALLED("field_arg(%p)"), (const void *)field)); -diff --git a/form/fld_attr.c b/form/fld_attr.c -index 50e2c73d..c974f72d 100644 ---- a/form/fld_attr.c -+++ b/form/fld_attr.c -@@ -40,7 +40,7 @@ MODULE_ID("$Id: fld_attr.c,v 1.13 2020/02/02 23:34:34 tom Exp $") - --------------------------------------------------------------------------*/ - /* "Template" macro to generate a function to set a fields attribute */ - #define GEN_FIELD_ATTR_SET_FCT( name ) \ --NCURSES_IMPEXP int NCURSES_API set_field_ ## name (FIELD * field, chtype attr)\ -+FORM_IMPEXP int NCURSES_API set_field_ ## name (FIELD * field, chtype attr)\ - {\ - int res = E_BAD_ARGUMENT;\ - T((T_CALLED("set_field_" #name "(%p,%s)"), (void *)field, _traceattr(attr)));\ -@@ -65,7 +65,7 @@ NCURSES_IMPEXP int NCURSES_API set_field_ ## name (FIELD * field, chtype attr)\ - - /* "Template" macro to generate a function to get a fields attribute */ - #define GEN_FIELD_ATTR_GET_FCT( name ) \ --NCURSES_IMPEXP chtype NCURSES_API field_ ## name (const FIELD * field)\ -+FORM_IMPEXP chtype NCURSES_API field_ ## name (const FIELD * field)\ - {\ - T((T_CALLED("field_" #name "(%p)"), (const void *) field));\ - returnAttr( A_ATTRIBUTES & (Normalize_Field( field ) -> name) );\ -diff --git a/form/fld_current.c b/form/fld_current.c -index 75e68edd..14e80e34 100644 ---- a/form/fld_current.c -+++ b/form/fld_current.c -@@ -48,7 +48,7 @@ MODULE_ID("$Id: fld_current.c,v 1.15 2020/02/02 23:34:34 tom Exp $") - | E_INVALID_FIELD - current field can't be left - | E_SYSTEM_ERROR - system error - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+FORM_EXPORT(int) - set_current_field(FORM *form, FIELD *field) - { - int err = E_OK; -@@ -113,7 +113,7 @@ set_current_field(FORM *form, FIELD *field) - | E_BAD_ARGUMENT - invalid form pointer - | E_REQUEST_DENIED - there is no current field to unfocus - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+FORM_EXPORT(int) - unfocus_current_field(FORM *const form) - { - T((T_CALLED("unfocus_current_field(%p)"), (const void *)form)); -@@ -137,7 +137,7 @@ unfocus_current_field(FORM *const form) - | - | Return Values : Pointer to the current field. - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(FIELD *) -+FORM_EXPORT(FIELD *) - current_field(const FORM *form) - { - T((T_CALLED("current_field(%p)"), (const void *)form)); -@@ -154,7 +154,7 @@ current_field(const FORM *form) - | Return Values : >= 0 : field index - | -1 : fieldpointer invalid or field not connected - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+FORM_EXPORT(int) - field_index(const FIELD *field) - { - T((T_CALLED("field_index(%p)"), (const void *)field)); -diff --git a/form/fld_def.c b/form/fld_def.c -index e529b3c0..a9d2abf7 100644 ---- a/form/fld_def.c -+++ b/form/fld_def.c -@@ -66,7 +66,7 @@ static FIELD default_field = - NCURSES_FIELD_EXTENSION - }; - --NCURSES_EXPORT_VAR(FIELD *) _nc_Default_Field = &default_field; -+FORM_EXPORT_VAR(FIELD *) _nc_Default_Field = &default_field; - - /*--------------------------------------------------------------------------- - | Facility : libnform -@@ -82,7 +82,7 @@ NCURSES_EXPORT_VAR(FIELD *) _nc_Default_Field = &default_field; - | Return Values : Pointer to argument structure. Maybe NULL. - | In case of an error in *err an error counter is increased. - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(TypeArgument *) -+FORM_EXPORT(TypeArgument *) - _nc_Make_Argument(const FIELDTYPE *typ, va_list *ap, int *err) - { - TypeArgument *res = (TypeArgument *)0; -@@ -130,7 +130,7 @@ _nc_Make_Argument(const FIELDTYPE *typ, va_list *ap, int *err) - | Return Values : Pointer to argument structure. Maybe NULL. - | In case of an error in *err an error counter is increased. - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(TypeArgument *) -+FORM_EXPORT(TypeArgument *) - _nc_Copy_Argument(const FIELDTYPE *typ, const TypeArgument *argp, int *err) - { - TypeArgument *res = (TypeArgument *)0; -@@ -179,7 +179,7 @@ _nc_Copy_Argument(const FIELDTYPE *typ, const TypeArgument *argp, int *err) - | - | Return Values : - - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(void) -+FORM_EXPORT(void) - _nc_Free_Argument(const FIELDTYPE *typ, TypeArgument *argp) - { - if (typ != 0 && (typ->status & _HAS_ARGS) != 0) -@@ -212,7 +212,7 @@ _nc_Free_Argument(const FIELDTYPE *typ, TypeArgument *argp) - | Return Values : TRUE - copy worked - | FALSE - error occurred - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(bool) -+FORM_EXPORT(bool) - _nc_Copy_Type(FIELD *dst, FIELD const *src) - { - int err = 0; -@@ -247,7 +247,7 @@ _nc_Copy_Type(FIELD *dst, FIELD const *src) - | - | Return Values : - - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(void) -+FORM_EXPORT(void) - _nc_Free_Type(FIELD *field) - { - assert(field != 0); -@@ -274,7 +274,7 @@ _nc_Free_Type(FIELD *field) - | - | Return Values : Pointer to the new field or NULL if failure. - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(FIELD *) -+FORM_EXPORT(FIELD *) - new_field(int rows, int cols, int frow, int fcol, int nrow, int nbuf) - { - static const FIELD_CELL blank = BLANK; -@@ -354,7 +354,7 @@ new_field(int rows, int cols, int frow, int fcol, int nrow, int nbuf) - | E_BAD_ARGUMENT - invalid field pointer - | E_CONNECTED - field is connected - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+FORM_EXPORT(int) - free_field(FIELD *field) - { - T((T_CALLED("free_field(%p)"), (void *)field)); -diff --git a/form/fld_dup.c b/form/fld_dup.c -index 9859a09f..08356b13 100644 ---- a/form/fld_dup.c -+++ b/form/fld_dup.c -@@ -48,7 +48,7 @@ MODULE_ID("$Id: fld_dup.c,v 1.15 2020/02/02 23:34:34 tom Exp $") - | - | Return Values : Pointer to the new field or NULL if failure - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(FIELD *) -+FORM_EXPORT(FIELD *) - dup_field(FIELD *field, int frow, int fcol) - { - FIELD *New_Field = (FIELD *)0; -diff --git a/form/fld_ftchoice.c b/form/fld_ftchoice.c -index 5dc5f4a9..4119e76e 100644 ---- a/form/fld_ftchoice.c -+++ b/form/fld_ftchoice.c -@@ -47,7 +47,7 @@ MODULE_ID("$Id: fld_ftchoice.c,v 1.16 2020/02/02 23:34:34 tom Exp $") - | Return Values : E_OK - success - | E_BAD_ARGUMENT - invalid arguments - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+FORM_EXPORT(int) - set_fieldtype_choice(FIELDTYPE *typ, - bool (*const next_choice) (FIELD *, const void *), - bool (*const prev_choice) (FIELD *, const void *)) -diff --git a/form/fld_ftlink.c b/form/fld_ftlink.c -index afa488b3..23bf0912 100644 ---- a/form/fld_ftlink.c -+++ b/form/fld_ftlink.c -@@ -49,7 +49,7 @@ MODULE_ID("$Id: fld_ftlink.c,v 1.16 2020/02/02 23:34:34 tom Exp $") - | - | Return Values : Fieldtype pointer or NULL if error occurred. - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(FIELDTYPE *) -+FORM_EXPORT(FIELDTYPE *) - link_fieldtype(FIELDTYPE *type1, FIELDTYPE *type2) - { - FIELDTYPE *nftyp = (FIELDTYPE *)0; -diff --git a/form/fld_info.c b/form/fld_info.c -index 9963b5b3..34defdea 100644 ---- a/form/fld_info.c -+++ b/form/fld_info.c -@@ -47,7 +47,7 @@ MODULE_ID("$Id: fld_info.c,v 1.12 2020/02/02 23:34:34 tom Exp $") - | Return Values : E_OK - success - | E_BAD_ARGUMENT - invalid field pointer - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+FORM_EXPORT(int) - field_info(const FIELD *field, - int *rows, int *cols, - int *frow, int *fcol, -@@ -89,7 +89,7 @@ field_info(const FIELD *field, - | Return Values : E_OK - success - | E_BAD_ARGUMENT - invalid argument - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+FORM_EXPORT(int) - dynamic_field_info(const FIELD *field, int *drows, int *dcols, int *maxgrow) - { - T((T_CALLED("dynamic_field_info(%p,%p,%p,%p)"), -diff --git a/form/fld_just.c b/form/fld_just.c -index 8097019d..f15cdcaa 100644 ---- a/form/fld_just.c -+++ b/form/fld_just.c -@@ -45,7 +45,7 @@ MODULE_ID("$Id: fld_just.c,v 1.14 2020/02/02 23:34:34 tom Exp $") - | E_BAD_ARGUMENT - one of the arguments was incorrect - | E_SYSTEM_ERROR - system error - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+FORM_EXPORT(int) - set_field_just(FIELD *field, int just) - { - int res = E_BAD_ARGUMENT; -@@ -77,7 +77,7 @@ set_field_just(FIELD *field, int just) - | - | Return Values : The justification type. - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+FORM_EXPORT(int) - field_just(const FIELD *field) - { - T((T_CALLED("field_just(%p)"), (const void *)field)); -diff --git a/form/fld_link.c b/form/fld_link.c -index cb67ac07..b6f4ff75 100644 ---- a/form/fld_link.c -+++ b/form/fld_link.c -@@ -49,7 +49,7 @@ MODULE_ID("$Id: fld_link.c,v 1.14 2020/02/02 23:34:34 tom Exp $") - | - | Return Values : Pointer to the new field or NULL if failure - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(FIELD *) -+FORM_EXPORT(FIELD *) - link_field(FIELD *field, int frow, int fcol) - { - FIELD *New_Field = (FIELD *)0; -diff --git a/form/fld_max.c b/form/fld_max.c -index 7d0e146d..8fb873b5 100644 ---- a/form/fld_max.c -+++ b/form/fld_max.c -@@ -45,7 +45,7 @@ MODULE_ID("$Id: fld_max.c,v 1.16 2020/02/02 23:34:34 tom Exp $") - | Return Values : E_OK - success - | E_BAD_ARGUMENT - invalid argument - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+FORM_EXPORT(int) - set_max_field(FIELD *field, int maxgrow) - { - T((T_CALLED("set_max_field(%p,%d)"), (void *)field, maxgrow)); -diff --git a/form/fld_move.c b/form/fld_move.c -index 0d6692f3..245f26c1 100644 ---- a/form/fld_move.c -+++ b/form/fld_move.c -@@ -46,7 +46,7 @@ MODULE_ID("$Id: fld_move.c,v 1.12 2020/02/02 23:34:34 tom Exp $") - | E_BAD_ARGUMENT - invalid argument passed - | E_CONNECTED - field is connected - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+FORM_EXPORT(int) - move_field(FIELD *field, int frow, int fcol) - { - T((T_CALLED("move_field(%p,%d,%d)"), (void *)field, frow, fcol)); -diff --git a/form/fld_newftyp.c b/form/fld_newftyp.c -index 18a7c073..53162f33 100644 ---- a/form/fld_newftyp.c -+++ b/form/fld_newftyp.c -@@ -53,7 +53,7 @@ static FIELDTYPE default_fieldtype = - #endif - }; - --NCURSES_EXPORT_VAR(FIELDTYPE *) -+FORM_EXPORT_VAR(FIELDTYPE *) - _nc_Default_FieldType = &default_fieldtype; - - /*--------------------------------------------------------------------------- -@@ -71,7 +71,7 @@ NCURSES_EXPORT_VAR(FIELDTYPE *) - | - | Return Values : Fieldtype pointer or NULL if error occurred - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(FIELDTYPE *) -+FORM_EXPORT(FIELDTYPE *) - new_fieldtype(bool (*const field_check) (FIELD *, const void *), - bool (*const char_check) (int, const void *)) - { -@@ -121,7 +121,7 @@ new_fieldtype(bool (*const field_check) (FIELD *, const void *), - | E_CONNECTED - there are fields referencing the type - | E_BAD_ARGUMENT - invalid fieldtype pointer - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+FORM_EXPORT(int) - free_fieldtype(FIELDTYPE *typ) - { - T((T_CALLED("free_fieldtype(%p)"), (void *)typ)); -diff --git a/form/fld_opts.c b/form/fld_opts.c -index fee5804a..17ab8027 100644 ---- a/form/fld_opts.c -+++ b/form/fld_opts.c -@@ -51,7 +51,7 @@ MODULE_ID("$Id: fld_opts.c,v 1.13 2020/02/02 23:34:34 tom Exp $") - | E_BAD_ARGUMENT - invalid options - | E_SYSTEM_ERROR - system error - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+FORM_EXPORT(int) - set_field_opts(FIELD *field, Field_Options opts) - { - int res = E_BAD_ARGUMENT; -@@ -72,7 +72,7 @@ set_field_opts(FIELD *field, Field_Options opts) - | - | Return Values : The options. - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(Field_Options) -+FORM_EXPORT(Field_Options) - field_opts(const FIELD *field) - { - T((T_CALLED("field_opts(%p)"), (const void *)field)); -@@ -92,7 +92,7 @@ field_opts(const FIELD *field) - | E_BAD_ARGUMENT - invalid options - | E_SYSTEM_ERROR - system error - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+FORM_EXPORT(int) - field_opts_on(FIELD *field, Field_Options opts) - { - int res = E_BAD_ARGUMENT; -@@ -120,7 +120,7 @@ field_opts_on(FIELD *field, Field_Options opts) - | E_BAD_ARGUMENT - invalid options - | E_SYSTEM_ERROR - system error - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+FORM_EXPORT(int) - field_opts_off(FIELD *field, Field_Options opts) - { - int res = E_BAD_ARGUMENT; -diff --git a/form/fld_pad.c b/form/fld_pad.c -index b6d59e2c..260ec407 100644 ---- a/form/fld_pad.c -+++ b/form/fld_pad.c -@@ -46,7 +46,7 @@ MODULE_ID("$Id: fld_pad.c,v 1.11 2020/02/02 23:34:34 tom Exp $") - | E_BAD_ARGUMENT - invalid field pointer or pad character - | E_SYSTEM_ERROR - system error - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+FORM_EXPORT(int) - set_field_pad(FIELD *field, int ch) - { - int res = E_BAD_ARGUMENT; -@@ -75,7 +75,7 @@ set_field_pad(FIELD *field, int ch) - | - | Return Values : The pad character. - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+FORM_EXPORT(int) - field_pad(const FIELD *field) - { - T((T_CALLED("field_pad(%p)"), (const void *)field)); -diff --git a/form/fld_page.c b/form/fld_page.c -index c6fb37c8..7310202c 100644 ---- a/form/fld_page.c -+++ b/form/fld_page.c -@@ -45,7 +45,7 @@ MODULE_ID("$Id: fld_page.c,v 1.13 2020/02/02 23:34:34 tom Exp $") - | Return Values : E_OK - success - | E_CONNECTED - field is connected - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+FORM_EXPORT(int) - set_new_page(FIELD *field, bool new_page_flag) - { - T((T_CALLED("set_new_page(%p,%d)"), (void *)field, new_page_flag)); -@@ -72,7 +72,7 @@ set_new_page(FIELD *field, bool new_page_flag) - | Return Values : TRUE - field starts a new page - | FALSE - field doesn't start a new page - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(bool) -+FORM_EXPORT(bool) - new_page(const FIELD *field) - { - T((T_CALLED("new_page(%p)"), (const void *)field)); -diff --git a/form/fld_stat.c b/form/fld_stat.c -index 487a21dc..19000af2 100644 ---- a/form/fld_stat.c -+++ b/form/fld_stat.c -@@ -44,7 +44,7 @@ MODULE_ID("$Id: fld_stat.c,v 1.15 2020/02/02 23:34:34 tom Exp $") - | - | Return Values : E_OK - success - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+FORM_EXPORT(int) - set_field_status(FIELD *field, bool status) - { - T((T_CALLED("set_field_status(%p,%d)"), (void *)field, status)); -@@ -69,7 +69,7 @@ set_field_status(FIELD *field, bool status) - | Return Values : TRUE - buffer has been changed - | FALSE - buffer has not been changed - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(bool) -+FORM_EXPORT(bool) - field_status(const FIELD *field) - { - T((T_CALLED("field_status(%p)"), (const void *)field)); -diff --git a/form/fld_type.c b/form/fld_type.c -index a445fa4d..69ebe4ca 100644 ---- a/form/fld_type.c -+++ b/form/fld_type.c -@@ -46,7 +46,7 @@ MODULE_ID("$Id: fld_type.c,v 1.17 2020/02/02 23:34:34 tom Exp $") - | Return Values : E_OK - success - | E_SYSTEM_ERROR - system error - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+FORM_EXPORT(int) - set_field_type(FIELD *field, FIELDTYPE *type,...) - { - va_list ap; -@@ -88,7 +88,7 @@ set_field_type(FIELD *field, FIELDTYPE *type,...) - | - | Return Values : Pointer to fieldtype of NULL if none is defined. - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(FIELDTYPE *) -+FORM_EXPORT(FIELDTYPE *) - field_type(const FIELD *field) - { - T((T_CALLED("field_type(%p)"), (const void *)field)); -diff --git a/form/fld_user.c b/form/fld_user.c -index 5cd165c8..2deb68e6 100644 ---- a/form/fld_user.c -+++ b/form/fld_user.c -@@ -44,7 +44,7 @@ MODULE_ID("$Id: fld_user.c,v 1.17 2020/02/02 23:34:34 tom Exp $") - | - | Return Values : E_OK - on success - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+FORM_EXPORT(int) - set_field_userptr(FIELD *field, void *usrptr) - { - T((T_CALLED("set_field_userptr(%p,%p)"), (void *)field, (void *)usrptr)); -@@ -63,7 +63,7 @@ set_field_userptr(FIELD *field, void *usrptr) - | Return Values : Value of pointer. If no such pointer has been set, - | NULL is returned - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(void *) -+FORM_EXPORT(void *) - field_userptr(const FIELD *field) - { - T((T_CALLED("field_userptr(%p)"), (const void *)field)); -diff --git a/form/form.h b/form/form.h -index dabe6764..3c584357 100644 ---- a/form/form.h -+++ b/form/form.h -@@ -44,6 +44,19 @@ - extern "C" { - #endif - -+#include "ncurses_exports.h" -+ -+#if defined(BUILDING_FORM) -+# define FORM_IMPEXP NCURSES_EXPORT_GENERAL_EXPORT -+#else -+# define FORM_IMPEXP NCURSES_EXPORT_GENERAL_IMPORT -+#endif -+ -+#define FORM_WRAPPED_VAR(type,name) extern FORM_IMPEXP type NCURSES_PUBLIC_VAR(name)(void) -+ -+#define FORM_EXPORT(type) FORM_IMPEXP type NCURSES_API -+#define FORM_EXPORT_VAR(type) FORM_IMPEXP type -+ - #ifndef FORM_PRIV_H - typedef void *FIELD_CELL; - #endif -@@ -309,136 +322,136 @@ typedef void (*Form_Hook)(FORM *); - /************************* - * standard field types * - *************************/ --extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_ALPHA; --extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_ALNUM; --extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_ENUM; --extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_INTEGER; --extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_NUMERIC; --extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_REGEXP; -+extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_ALPHA; -+extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_ALNUM; -+extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_ENUM; -+extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_INTEGER; -+extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_NUMERIC; -+extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_REGEXP; - - /************************************ - * built-in additional field types * - * They are not defined in SVr4 * - ************************************/ --extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_IPV4; /* Internet IP Version 4 address */ -+extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_IPV4; /* Internet IP Version 4 address */ - - /*********************** - * FIELDTYPE routines * - ***********************/ --extern NCURSES_EXPORT(FIELDTYPE *) new_fieldtype ( -+extern FORM_EXPORT(FIELDTYPE *) new_fieldtype ( - bool (* const field_check)(FIELD *,const void *), - bool (* const char_check)(int,const void *)); --extern NCURSES_EXPORT(FIELDTYPE *) link_fieldtype( -+extern FORM_EXPORT(FIELDTYPE *) link_fieldtype( - FIELDTYPE *, FIELDTYPE *); - --extern NCURSES_EXPORT(int) free_fieldtype (FIELDTYPE *); --extern NCURSES_EXPORT(int) set_fieldtype_arg (FIELDTYPE *, -+extern FORM_EXPORT(int) free_fieldtype (FIELDTYPE *); -+extern FORM_EXPORT(int) set_fieldtype_arg (FIELDTYPE *, - void * (* const make_arg)(va_list *), - void * (* const copy_arg)(const void *), - void (* const free_arg)(void *)); --extern NCURSES_EXPORT(int) set_fieldtype_choice (FIELDTYPE *, -+extern FORM_EXPORT(int) set_fieldtype_choice (FIELDTYPE *, - bool (* const next_choice)(FIELD *,const void *), - bool (* const prev_choice)(FIELD *,const void *)); - - /******************* - * FIELD routines * - *******************/ --extern NCURSES_EXPORT(FIELD *) new_field (int,int,int,int,int,int); --extern NCURSES_EXPORT(FIELD *) dup_field (FIELD *,int,int); --extern NCURSES_EXPORT(FIELD *) link_field (FIELD *,int,int); -- --extern NCURSES_EXPORT(int) free_field (FIELD *); --extern NCURSES_EXPORT(int) field_info (const FIELD *,int *,int *,int *,int *,int *,int *); --extern NCURSES_EXPORT(int) dynamic_field_info (const FIELD *,int *,int *,int *); --extern NCURSES_EXPORT(int) set_max_field ( FIELD *,int); --extern NCURSES_EXPORT(int) move_field (FIELD *,int,int); --extern NCURSES_EXPORT(int) set_field_type (FIELD *,FIELDTYPE *,...); --extern NCURSES_EXPORT(int) set_new_page (FIELD *,bool); --extern NCURSES_EXPORT(int) set_field_just (FIELD *,int); --extern NCURSES_EXPORT(int) field_just (const FIELD *); --extern NCURSES_EXPORT(int) set_field_fore (FIELD *,chtype); --extern NCURSES_EXPORT(int) set_field_back (FIELD *,chtype); --extern NCURSES_EXPORT(int) set_field_pad (FIELD *,int); --extern NCURSES_EXPORT(int) field_pad (const FIELD *); --extern NCURSES_EXPORT(int) set_field_buffer (FIELD *,int,const char *); --extern NCURSES_EXPORT(int) set_field_status (FIELD *,bool); --extern NCURSES_EXPORT(int) set_field_userptr (FIELD *, void *); --extern NCURSES_EXPORT(int) set_field_opts (FIELD *,Field_Options); --extern NCURSES_EXPORT(int) field_opts_on (FIELD *,Field_Options); --extern NCURSES_EXPORT(int) field_opts_off (FIELD *,Field_Options); -- --extern NCURSES_EXPORT(chtype) field_fore (const FIELD *); --extern NCURSES_EXPORT(chtype) field_back (const FIELD *); -- --extern NCURSES_EXPORT(bool) new_page (const FIELD *); --extern NCURSES_EXPORT(bool) field_status (const FIELD *); -- --extern NCURSES_EXPORT(void *) field_arg (const FIELD *); -- --extern NCURSES_EXPORT(void *) field_userptr (const FIELD *); -- --extern NCURSES_EXPORT(FIELDTYPE *) field_type (const FIELD *); -- --extern NCURSES_EXPORT(char *) field_buffer (const FIELD *,int); -- --extern NCURSES_EXPORT(Field_Options) field_opts (const FIELD *); -+extern FORM_EXPORT(FIELD *) new_field (int,int,int,int,int,int); -+extern FORM_EXPORT(FIELD *) dup_field (FIELD *,int,int); -+extern FORM_EXPORT(FIELD *) link_field (FIELD *,int,int); -+ -+extern FORM_EXPORT(int) free_field (FIELD *); -+extern FORM_EXPORT(int) field_info (const FIELD *,int *,int *,int *,int *,int *,int *); -+extern FORM_EXPORT(int) dynamic_field_info (const FIELD *,int *,int *,int *); -+extern FORM_EXPORT(int) set_max_field ( FIELD *,int); -+extern FORM_EXPORT(int) move_field (FIELD *,int,int); -+extern FORM_EXPORT(int) set_field_type (FIELD *,FIELDTYPE *,...); -+extern FORM_EXPORT(int) set_new_page (FIELD *,bool); -+extern FORM_EXPORT(int) set_field_just (FIELD *,int); -+extern FORM_EXPORT(int) field_just (const FIELD *); -+extern FORM_EXPORT(int) set_field_fore (FIELD *,chtype); -+extern FORM_EXPORT(int) set_field_back (FIELD *,chtype); -+extern FORM_EXPORT(int) set_field_pad (FIELD *,int); -+extern FORM_EXPORT(int) field_pad (const FIELD *); -+extern FORM_EXPORT(int) set_field_buffer (FIELD *,int,const char *); -+extern FORM_EXPORT(int) set_field_status (FIELD *,bool); -+extern FORM_EXPORT(int) set_field_userptr (FIELD *, void *); -+extern FORM_EXPORT(int) set_field_opts (FIELD *,Field_Options); -+extern FORM_EXPORT(int) field_opts_on (FIELD *,Field_Options); -+extern FORM_EXPORT(int) field_opts_off (FIELD *,Field_Options); -+ -+extern FORM_EXPORT(chtype) field_fore (const FIELD *); -+extern FORM_EXPORT(chtype) field_back (const FIELD *); -+ -+extern FORM_EXPORT(bool) new_page (const FIELD *); -+extern FORM_EXPORT(bool) field_status (const FIELD *); -+ -+extern FORM_EXPORT(void *) field_arg (const FIELD *); -+ -+extern FORM_EXPORT(void *) field_userptr (const FIELD *); -+ -+extern FORM_EXPORT(FIELDTYPE *) field_type (const FIELD *); -+ -+extern FORM_EXPORT(char *) field_buffer (const FIELD *,int); -+ -+extern FORM_EXPORT(Field_Options) field_opts (const FIELD *); - - /****************** - * FORM routines * - ******************/ - --extern NCURSES_EXPORT(FORM *) new_form (FIELD **); -- --extern NCURSES_EXPORT(FIELD **) form_fields (const FORM *); --extern NCURSES_EXPORT(FIELD *) current_field (const FORM *); -- --extern NCURSES_EXPORT(WINDOW *) form_win (const FORM *); --extern NCURSES_EXPORT(WINDOW *) form_sub (const FORM *); -- --extern NCURSES_EXPORT(Form_Hook) form_init (const FORM *); --extern NCURSES_EXPORT(Form_Hook) form_term (const FORM *); --extern NCURSES_EXPORT(Form_Hook) field_init (const FORM *); --extern NCURSES_EXPORT(Form_Hook) field_term (const FORM *); -- --extern NCURSES_EXPORT(int) free_form (FORM *); --extern NCURSES_EXPORT(int) set_form_fields (FORM *,FIELD **); --extern NCURSES_EXPORT(int) field_count (const FORM *); --extern NCURSES_EXPORT(int) set_form_win (FORM *,WINDOW *); --extern NCURSES_EXPORT(int) set_form_sub (FORM *,WINDOW *); --extern NCURSES_EXPORT(int) set_current_field (FORM *,FIELD *); --extern NCURSES_EXPORT(int) unfocus_current_field (FORM *); --extern NCURSES_EXPORT(int) field_index (const FIELD *); --extern NCURSES_EXPORT(int) set_form_page (FORM *,int); --extern NCURSES_EXPORT(int) form_page (const FORM *); --extern NCURSES_EXPORT(int) scale_form (const FORM *,int *,int *); --extern NCURSES_EXPORT(int) set_form_init (FORM *,Form_Hook); --extern NCURSES_EXPORT(int) set_form_term (FORM *,Form_Hook); --extern NCURSES_EXPORT(int) set_field_init (FORM *,Form_Hook); --extern NCURSES_EXPORT(int) set_field_term (FORM *,Form_Hook); --extern NCURSES_EXPORT(int) post_form (FORM *); --extern NCURSES_EXPORT(int) unpost_form (FORM *); --extern NCURSES_EXPORT(int) pos_form_cursor (FORM *); --extern NCURSES_EXPORT(int) form_driver (FORM *,int); -+extern FORM_EXPORT(FORM *) new_form (FIELD **); -+ -+extern FORM_EXPORT(FIELD **) form_fields (const FORM *); -+extern FORM_EXPORT(FIELD *) current_field (const FORM *); -+ -+extern FORM_EXPORT(WINDOW *) form_win (const FORM *); -+extern FORM_EXPORT(WINDOW *) form_sub (const FORM *); -+ -+extern FORM_EXPORT(Form_Hook) form_init (const FORM *); -+extern FORM_EXPORT(Form_Hook) form_term (const FORM *); -+extern FORM_EXPORT(Form_Hook) field_init (const FORM *); -+extern FORM_EXPORT(Form_Hook) field_term (const FORM *); -+ -+extern FORM_EXPORT(int) free_form (FORM *); -+extern FORM_EXPORT(int) set_form_fields (FORM *,FIELD **); -+extern FORM_EXPORT(int) field_count (const FORM *); -+extern FORM_EXPORT(int) set_form_win (FORM *,WINDOW *); -+extern FORM_EXPORT(int) set_form_sub (FORM *,WINDOW *); -+extern FORM_EXPORT(int) set_current_field (FORM *,FIELD *); -+extern FORM_EXPORT(int) unfocus_current_field (FORM *); -+extern FORM_EXPORT(int) field_index (const FIELD *); -+extern FORM_EXPORT(int) set_form_page (FORM *,int); -+extern FORM_EXPORT(int) form_page (const FORM *); -+extern FORM_EXPORT(int) scale_form (const FORM *,int *,int *); -+extern FORM_EXPORT(int) set_form_init (FORM *,Form_Hook); -+extern FORM_EXPORT(int) set_form_term (FORM *,Form_Hook); -+extern FORM_EXPORT(int) set_field_init (FORM *,Form_Hook); -+extern FORM_EXPORT(int) set_field_term (FORM *,Form_Hook); -+extern FORM_EXPORT(int) post_form (FORM *); -+extern FORM_EXPORT(int) unpost_form (FORM *); -+extern FORM_EXPORT(int) pos_form_cursor (FORM *); -+extern FORM_EXPORT(int) form_driver (FORM *,int); - # if NCURSES_WIDECHAR --extern NCURSES_EXPORT(int) form_driver_w (FORM *,int,wchar_t); -+extern FORM_EXPORT(int) form_driver_w (FORM *,int,wchar_t); - # endif --extern NCURSES_EXPORT(int) set_form_userptr (FORM *,void *); --extern NCURSES_EXPORT(int) set_form_opts (FORM *,Form_Options); --extern NCURSES_EXPORT(int) form_opts_on (FORM *,Form_Options); --extern NCURSES_EXPORT(int) form_opts_off (FORM *,Form_Options); --extern NCURSES_EXPORT(int) form_request_by_name (const char *); -+extern FORM_EXPORT(int) set_form_userptr (FORM *,void *); -+extern FORM_EXPORT(int) set_form_opts (FORM *,Form_Options); -+extern FORM_EXPORT(int) form_opts_on (FORM *,Form_Options); -+extern FORM_EXPORT(int) form_opts_off (FORM *,Form_Options); -+extern FORM_EXPORT(int) form_request_by_name (const char *); - --extern NCURSES_EXPORT(const char *) form_request_name (int); -+extern FORM_EXPORT(const char *) form_request_name (int); - --extern NCURSES_EXPORT(void *) form_userptr (const FORM *); -+extern FORM_EXPORT(void *) form_userptr (const FORM *); - --extern NCURSES_EXPORT(Form_Options) form_opts (const FORM *); -+extern FORM_EXPORT(Form_Options) form_opts (const FORM *); - --extern NCURSES_EXPORT(bool) data_ahead (const FORM *); --extern NCURSES_EXPORT(bool) data_behind (const FORM *); -+extern FORM_EXPORT(bool) data_ahead (const FORM *); -+extern FORM_EXPORT(bool) data_behind (const FORM *); - - #if NCURSES_SP_FUNCS --extern NCURSES_EXPORT(FORM *) NCURSES_SP_NAME(new_form) (SCREEN*, FIELD **); -+extern FORM_EXPORT(FORM *) NCURSES_SP_NAME(new_form) (SCREEN*, FIELD **); - #endif - - #ifdef __cplusplus -diff --git a/form/form.priv.h b/form/form.priv.h -index 53c717c6..fe60b91a 100644 ---- a/form/form.priv.h -+++ b/form/form.priv.h -@@ -69,9 +69,9 @@ - /*********************** - * Default objects * - ***********************/ --extern NCURSES_EXPORT_VAR(FORM *) _nc_Default_Form; --extern NCURSES_EXPORT_VAR(FIELD *) _nc_Default_Field; --extern NCURSES_EXPORT_VAR(FIELDTYPE *) _nc_Default_FieldType; -+extern FORM_EXPORT_VAR(FORM *) _nc_Default_Form; -+extern FORM_EXPORT_VAR(FIELD *) _nc_Default_Field; -+extern FORM_EXPORT_VAR(FIELDTYPE *) _nc_Default_FieldType; - - /* form status values */ - #define _OVLMODE (0x04U) /* Form is in overlay mode */ -@@ -176,32 +176,32 @@ TypeArgument; - - #define C_ZEROS '\0' - --extern NCURSES_EXPORT(TypeArgument *) _nc_Make_Argument (const FIELDTYPE*, va_list*, int*); --extern NCURSES_EXPORT(TypeArgument *) _nc_Copy_Argument (const FIELDTYPE*, const TypeArgument*, int*); --extern NCURSES_EXPORT(void) _nc_Free_Argument (const FIELDTYPE*, TypeArgument*); --extern NCURSES_EXPORT(bool) _nc_Copy_Type (FIELD*, FIELD const *); --extern NCURSES_EXPORT(void) _nc_Free_Type (FIELD *); -- --extern NCURSES_EXPORT(int) _nc_Synchronize_Attributes (FIELD*); --extern NCURSES_EXPORT(int) _nc_Synchronize_Options (FIELD*, Field_Options); --extern NCURSES_EXPORT(int) _nc_Set_Form_Page (FORM*, int, FIELD*); --extern NCURSES_EXPORT(int) _nc_Refresh_Current_Field (FORM*); --extern NCURSES_EXPORT(FIELD *) _nc_First_Active_Field (FORM*); --extern NCURSES_EXPORT(bool) _nc_Internal_Validation (FORM*); --extern NCURSES_EXPORT(int) _nc_Set_Current_Field (FORM*, FIELD*); --extern NCURSES_EXPORT(int) _nc_Position_Form_Cursor (FORM*); --extern NCURSES_EXPORT(void) _nc_Unset_Current_Field(FORM *form); -+extern FORM_EXPORT(TypeArgument *) _nc_Make_Argument (const FIELDTYPE*, va_list*, int*); -+extern FORM_EXPORT(TypeArgument *) _nc_Copy_Argument (const FIELDTYPE*, const TypeArgument*, int*); -+extern FORM_EXPORT(void) _nc_Free_Argument (const FIELDTYPE*, TypeArgument*); -+extern FORM_EXPORT(bool) _nc_Copy_Type (FIELD*, FIELD const *); -+extern FORM_EXPORT(void) _nc_Free_Type (FIELD *); -+ -+extern FORM_EXPORT(int) _nc_Synchronize_Attributes (FIELD*); -+extern FORM_EXPORT(int) _nc_Synchronize_Options (FIELD*, Field_Options); -+extern FORM_EXPORT(int) _nc_Set_Form_Page (FORM*, int, FIELD*); -+extern FORM_EXPORT(int) _nc_Refresh_Current_Field (FORM*); -+extern FORM_EXPORT(FIELD *) _nc_First_Active_Field (FORM*); -+extern FORM_EXPORT(bool) _nc_Internal_Validation (FORM*); -+extern FORM_EXPORT(int) _nc_Set_Current_Field (FORM*, FIELD*); -+extern FORM_EXPORT(int) _nc_Position_Form_Cursor (FORM*); -+extern FORM_EXPORT(void) _nc_Unset_Current_Field(FORM *form); - - #if NCURSES_INTEROP_FUNCS --extern NCURSES_EXPORT(FIELDTYPE *) _nc_TYPE_INTEGER(void); --extern NCURSES_EXPORT(FIELDTYPE *) _nc_TYPE_ALNUM(void); --extern NCURSES_EXPORT(FIELDTYPE *) _nc_TYPE_ALPHA(void); --extern NCURSES_EXPORT(FIELDTYPE *) _nc_TYPE_ENUM(void); --extern NCURSES_EXPORT(FIELDTYPE *) _nc_TYPE_NUMERIC(void); --extern NCURSES_EXPORT(FIELDTYPE *) _nc_TYPE_REGEXP(void); --extern NCURSES_EXPORT(FIELDTYPE *) _nc_TYPE_IPV4(void); -- --extern NCURSES_EXPORT(FIELDTYPE *) -+extern FORM_EXPORT(FIELDTYPE *) _nc_TYPE_INTEGER(void); -+extern FORM_EXPORT(FIELDTYPE *) _nc_TYPE_ALNUM(void); -+extern FORM_EXPORT(FIELDTYPE *) _nc_TYPE_ALPHA(void); -+extern FORM_EXPORT(FIELDTYPE *) _nc_TYPE_ENUM(void); -+extern FORM_EXPORT(FIELDTYPE *) _nc_TYPE_NUMERIC(void); -+extern FORM_EXPORT(FIELDTYPE *) _nc_TYPE_REGEXP(void); -+extern FORM_EXPORT(FIELDTYPE *) _nc_TYPE_IPV4(void); -+ -+extern FORM_EXPORT(FIELDTYPE *) - _nc_generic_fieldtype(bool (*const field_check) (FORM*, - FIELD *, - const void *), -@@ -212,18 +212,18 @@ _nc_generic_fieldtype(bool (*const field_check) (FORM*, - bool (*const next)(FORM*,FIELD*,const void*), - bool (*const prev)(FORM*,FIELD*,const void*), - void (*freecallback)(void*)); --extern NCURSES_EXPORT(int) _nc_set_generic_fieldtype(FIELD*, FIELDTYPE*, int (*)(void**)); --extern NCURSES_EXPORT(WINDOW*) _nc_form_cursor(const FORM* , int* , int* ); -+extern FORM_EXPORT(int) _nc_set_generic_fieldtype(FIELD*, FIELDTYPE*, int (*)(void**)); -+extern FORM_EXPORT(WINDOW*) _nc_form_cursor(const FORM* , int* , int* ); - - #define INIT_FT_FUNC(func) {func} - #else - #define INIT_FT_FUNC(func) func - #endif - --extern NCURSES_EXPORT(void) _nc_get_fieldbuffer(FORM*, FIELD*, FIELD_CELL*); -+extern FORM_EXPORT(void) _nc_get_fieldbuffer(FORM*, FIELD*, FIELD_CELL*); - - #if USE_WIDEC_SUPPORT --extern NCURSES_EXPORT(wchar_t *) _nc_Widen_String(char *, int *); -+extern FORM_EXPORT(wchar_t *) _nc_Widen_String(char *, int *); - #endif - - #ifdef TRACE -@@ -234,11 +234,11 @@ extern NCURSES_EXPORT(wchar_t *) _nc_Widen_String(char *, int *); - #define returnFieldType(code) TRACE_RETURN1(code,field_type) - #define returnFormHook(code) TRACE_RETURN1(code,form_hook) - --extern NCURSES_EXPORT(FIELD **) _nc_retrace_field_ptr (FIELD **); --extern NCURSES_EXPORT(FIELD *) _nc_retrace_field (FIELD *); --extern NCURSES_EXPORT(FIELDTYPE *) _nc_retrace_field_type (FIELDTYPE *); --extern NCURSES_EXPORT(FORM *) _nc_retrace_form (FORM *); --extern NCURSES_EXPORT(Form_Hook) _nc_retrace_form_hook (Form_Hook); -+extern FORM_EXPORT(FIELD **) _nc_retrace_field_ptr (FIELD **); -+extern FORM_EXPORT(FIELD *) _nc_retrace_field (FIELD *); -+extern FORM_EXPORT(FIELDTYPE *) _nc_retrace_field_type (FIELDTYPE *); -+extern FORM_EXPORT(FORM *) _nc_retrace_form (FORM *); -+extern FORM_EXPORT(Form_Hook) _nc_retrace_form_hook (Form_Hook); - - #else /* !TRACE */ - -diff --git a/form/frm_cursor.c b/form/frm_cursor.c -index 8ff42bf8..8ec64f73 100644 ---- a/form/frm_cursor.c -+++ b/form/frm_cursor.c -@@ -49,7 +49,7 @@ MODULE_ID("$Id: frm_cursor.c,v 1.11 2020/02/02 23:34:34 tom Exp $") - | E_BAD_ARGUMENT - Invalid form pointer - | E_NOT_POSTED - Form is not posted - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+FORM_EXPORT(int) - pos_form_cursor(FORM *form) - { - int res; -diff --git a/form/frm_data.c b/form/frm_data.c -index 5c3b2a04..2860fad7 100644 ---- a/form/frm_data.c -+++ b/form/frm_data.c -@@ -45,7 +45,7 @@ MODULE_ID("$Id: frm_data.c,v 1.17 2020/02/02 23:34:34 tom Exp $") - | Return Values : TRUE - there are off-screen data behind - | FALSE - there are no off-screen data behind - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(bool) -+FORM_EXPORT(bool) - data_behind(const FORM *form) - { - bool result = FALSE; -@@ -132,7 +132,7 @@ Only_Padding(WINDOW *w, int len, int pad) - | Return Values : TRUE - there are off-screen data ahead - | FALSE - there are no off-screen data ahead - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(bool) -+FORM_EXPORT(bool) - data_ahead(const FORM *form) - { - bool result = FALSE; -diff --git a/form/frm_def.c b/form/frm_def.c -index 0722d517..273d0441 100644 ---- a/form/frm_def.c -+++ b/form/frm_def.c -@@ -62,7 +62,7 @@ static FORM default_form = - NULL /* fieldterm */ - }; - --NCURSES_EXPORT_VAR(FORM *) _nc_Default_Form = &default_form; -+FORM_EXPORT_VAR(FORM *) _nc_Default_Form = &default_form; - - /*--------------------------------------------------------------------------- - | Facility : libnform -@@ -295,7 +295,7 @@ Associate_Fields(FORM *form, FIELD **fields) - | E_CONNECTED - a field is already connected - | E_SYSTEM_ERROR - not enough memory - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(FORM *) -+FORM_EXPORT(FORM *) - NCURSES_SP_NAME(new_form) (NCURSES_SP_DCLx FIELD **fields) - { - int err = E_SYSTEM_ERROR; -@@ -344,7 +344,7 @@ NCURSES_SP_NAME(new_form) (NCURSES_SP_DCLx FIELD **fields) - | E_SYSTEM_ERROR - not enough memory - +--------------------------------------------------------------------------*/ - #if NCURSES_SP_FUNCS --NCURSES_EXPORT(FORM *) -+FORM_EXPORT(FORM *) - new_form(FIELD **fields) - { - return NCURSES_SP_NAME(new_form) (CURRENT_SCREEN, fields); -@@ -361,7 +361,7 @@ new_form(FIELD **fields) - | E_BAD_ARGUMENT - invalid form pointer - | E_POSTED - form is posted - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+FORM_EXPORT(int) - free_form(FORM *form) - { - T((T_CALLED("free_form(%p)"), (void *)form)); -@@ -392,7 +392,7 @@ free_form(FORM *form) - | E_POSTED - form is posted - | E_SYSTEM_ERROR - not enough memory - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+FORM_EXPORT(int) - set_form_fields(FORM *form, FIELD **fields) - { - FIELD **old; -@@ -423,7 +423,7 @@ set_form_fields(FORM *form, FIELD **fields) - | - | Return Values : Pointer to field array - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(FIELD **) -+FORM_EXPORT(FIELD **) - form_fields(const FORM *form) - { - T((T_CALLED("form_field(%p)"), (const void *)form)); -@@ -438,7 +438,7 @@ form_fields(const FORM *form) - | - | Return Values : Number of fields, -1 if none are defined - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+FORM_EXPORT(int) - field_count(const FORM *form) - { - T((T_CALLED("field_count(%p)"), (const void *)form)); -diff --git a/form/frm_driver.c b/form/frm_driver.c -index b9f91e12..7b92a2ad 100644 ---- a/form/frm_driver.c -+++ b/form/frm_driver.c -@@ -548,7 +548,7 @@ Buffer_To_Window(const FIELD *field, WINDOW *win) - | - | Return Values : - - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(void) -+FORM_EXPORT(void) - _nc_get_fieldbuffer(FORM *form, FIELD *field, FIELD_CELL *buf) - { - int pad; -@@ -826,7 +826,7 @@ Field_encloses(FIELD *field, int ry, int rx) - | E_SYSTEM_ERROR - form has no current field or - | field-window - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+FORM_EXPORT(int) - _nc_Position_Form_Cursor(FORM *form) - { - FIELD *field; -@@ -868,7 +868,7 @@ _nc_Position_Form_Cursor(FORM *form) - | E_SYSTEM_ERROR - general error - +--------------------------------------------------------------------------*/ - static bool move_after_insert = TRUE; --NCURSES_EXPORT(int) -+FORM_EXPORT(int) - _nc_Refresh_Current_Field(FORM *form) - { - WINDOW *formwin; -@@ -1271,7 +1271,7 @@ Synchronize_Linked_Fields(FIELD *field) - | E_BAD_ARGUMENT - invalid field pointer - | E_SYSTEM_ERROR - some severe basic error - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+FORM_EXPORT(int) - _nc_Synchronize_Attributes(FIELD *field) - { - FORM *form; -@@ -1338,7 +1338,7 @@ _nc_Synchronize_Attributes(FIELD *field) - | E_CURRENT - field is the current one - | E_SYSTEM_ERROR - some severe basic error - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+FORM_EXPORT(int) - _nc_Synchronize_Options(FIELD *field, Field_Options newopts) - { - Field_Options oldopts; -@@ -1491,7 +1491,7 @@ _nc_Unset_Current_Field(FORM *form) - | E_SYSTEM_ERROR - some severe basic error - | E_NOT_CONNECTED - no fields are connected to the form - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+FORM_EXPORT(int) - _nc_Set_Current_Field(FORM *form, FIELD *newfield) - { - FIELD *field; -@@ -3225,7 +3225,7 @@ Check_Field(FORM *form, FIELDTYPE *typ, FIELD *field, TypeArgument *argp) - | Return Values : TRUE - field is valid - | FALSE - field is invalid - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(bool) -+FORM_EXPORT(bool) - _nc_Internal_Validation(FORM *form) - { - FIELD *field; -@@ -3319,7 +3319,7 @@ Next_Field_On_Page(FIELD *field) - | - | Return Values : Pointer to calculated field. - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(FIELD *) -+FORM_EXPORT(FIELD *) - _nc_First_Active_Field(FORM *form) - { - FIELD **last_on_page = &form->field[form->page[form->curpage].pmax]; -@@ -3873,7 +3873,7 @@ FN_Down_Field(FORM *form) - | E_BAD_ARGUMENT - invalid field pointer - | E_SYSTEM_ERROR - some severe basic error - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+FORM_EXPORT(int) - _nc_Set_Form_Page(FORM *form, int page, FIELD *field) - { - int res = E_OK; -@@ -4354,7 +4354,7 @@ static const Binding_Info bindings[MAX_FORM_COMMAND - MIN_FORM_COMMAND + 1] = - | E_NOT_CONNECTED - no fields are connected to the form - | E_UNKNOWN_COMMAND - command not known - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+FORM_EXPORT(int) - form_driver(FORM *form, int c) - { - const Binding_Info *BI = (Binding_Info *) 0; -@@ -4561,7 +4561,7 @@ form_driver(FORM *form, int c) - | E_NOT_CONNECTED - no fields are connected to the form - | E_UNKNOWN_COMMAND - command not known - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+FORM_EXPORT(int) - form_driver_w(FORM *form, int type, wchar_t c) - { - const Binding_Info *BI = (Binding_Info *) 0; -@@ -4743,7 +4743,7 @@ form_driver_w(FORM *form, int type, wchar_t c) - | E_BAD_ARGUMENT - invalid argument - | E_SYSTEM_ERROR - system error - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+FORM_EXPORT(int) - set_field_buffer(FIELD *field, int buffer, const char *value) - { - FIELD_CELL *p; -@@ -4860,7 +4860,7 @@ set_field_buffer(FIELD *field, int buffer, const char *value) - | - | Return Values : Pointer to buffer or NULL if arguments were invalid. - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(char *) -+FORM_EXPORT(char *) - field_buffer(const FIELD *field, int buffer) - { - char *result = 0; -@@ -4928,7 +4928,7 @@ field_buffer(const FIELD *field, int buffer) - | Convert a multibyte string to a wide-character string. The result must be - | freed by the caller. - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(wchar_t *) -+FORM_EXPORT(wchar_t *) - _nc_Widen_String(char *source, int *lengthp) - { - wchar_t *result = 0; -diff --git a/form/frm_hook.c b/form/frm_hook.c -index 3051cddc..0feb01c2 100644 ---- a/form/frm_hook.c -+++ b/form/frm_hook.c -@@ -37,7 +37,7 @@ MODULE_ID("$Id: frm_hook.c,v 1.19 2020/02/02 23:34:34 tom Exp $") - - /* "Template" macro to generate function to set application specific hook */ - #define GEN_HOOK_SET_FUNCTION( typ, name ) \ --NCURSES_IMPEXP int NCURSES_API set_ ## typ ## _ ## name (FORM *form, Form_Hook func)\ -+FORM_IMPEXP int NCURSES_API set_ ## typ ## _ ## name (FORM *form, Form_Hook func)\ - {\ - TR_FUNC_BFR(1); \ - T((T_CALLED("set_" #typ"_"#name"(%p,%s)"), (void *) form, TR_FUNC_ARG(0, func)));\ -@@ -47,7 +47,7 @@ NCURSES_IMPEXP int NCURSES_API set_ ## typ ## _ ## name (FORM *form, Form_Hook f - - /* "Template" macro to generate function to get application specific hook */ - #define GEN_HOOK_GET_FUNCTION( typ, name ) \ --NCURSES_IMPEXP Form_Hook NCURSES_API typ ## _ ## name ( const FORM *form )\ -+FORM_IMPEXP Form_Hook NCURSES_API typ ## _ ## name ( const FORM *form )\ - {\ - T((T_CALLED(#typ "_" #name "(%p)"), (const void *) form));\ - returnFormHook( Normalize_Form( form ) -> typ ## name );\ -diff --git a/form/frm_opts.c b/form/frm_opts.c -index 18ab2938..c6455466 100644 ---- a/form/frm_opts.c -+++ b/form/frm_opts.c -@@ -45,7 +45,7 @@ MODULE_ID("$Id: frm_opts.c,v 1.18 2020/02/02 23:34:34 tom Exp $") - | Return Values : E_OK - success - | E_BAD_ARGUMENT - invalid options - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+FORM_EXPORT(int) - set_form_opts(FORM *form, Form_Options opts) - { - T((T_CALLED("set_form_opts(%p,%d)"), (void *)form, opts)); -@@ -68,7 +68,7 @@ set_form_opts(FORM *form, Form_Options opts) - | - | Return Values : The option flags. - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(Form_Options) -+FORM_EXPORT(Form_Options) - form_opts(const FORM *form) - { - T((T_CALLED("form_opts(%p)"), (const void *)form)); -@@ -85,7 +85,7 @@ form_opts(const FORM *form) - | Return Values : E_OK - success - | E_BAD_ARGUMENT - invalid options - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+FORM_EXPORT(int) - form_opts_on(FORM *form, Form_Options opts) - { - T((T_CALLED("form_opts_on(%p,%d)"), (void *)form, opts)); -@@ -110,7 +110,7 @@ form_opts_on(FORM *form, Form_Options opts) - | Return Values : E_OK - success - | E_BAD_ARGUMENT - invalid options - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+FORM_EXPORT(int) - form_opts_off(FORM *form, Form_Options opts) - { - T((T_CALLED("form_opts_off(%p,%d)"), (void *)form, opts)); -diff --git a/form/frm_page.c b/form/frm_page.c -index c8569eef..e07655b7 100644 ---- a/form/frm_page.c -+++ b/form/frm_page.c -@@ -47,7 +47,7 @@ MODULE_ID("$Id: frm_page.c,v 1.13 2020/02/02 23:34:34 tom Exp $") - | E_INVALID_FIELD - current field can't be left - | E_SYSTEM_ERROR - system error - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+FORM_EXPORT(int) - set_form_page(FORM *form, int page) - { - int err = E_OK; -@@ -96,7 +96,7 @@ set_form_page(FORM *form, int page) - | Return Values : >= 0 : current page number - | -1 : invalid form pointer - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+FORM_EXPORT(int) - form_page(const FORM *form) - { - T((T_CALLED("form_page(%p)"), (const void *)form)); -diff --git a/form/frm_post.c b/form/frm_post.c -index 2f1ad813..894c7c4c 100644 ---- a/form/frm_post.c -+++ b/form/frm_post.c -@@ -48,7 +48,7 @@ MODULE_ID("$Id: frm_post.c,v 1.13 2020/02/02 23:34:34 tom Exp $") - | E_NO_ROOM - form doesn't fit into subwindow - | E_SYSTEM_ERROR - system error - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+FORM_EXPORT(int) - post_form(FORM *form) - { - WINDOW *formwin; -@@ -98,7 +98,7 @@ post_form(FORM *form) - | E_NOT_POSTED - form isn't posted - | E_BAD_STATE - called from a hook routine - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+FORM_EXPORT(int) - unpost_form(FORM *form) - { - T((T_CALLED("unpost_form(%p)"), (void *)form)); -diff --git a/form/frm_req_name.c b/form/frm_req_name.c -index 1e56c3dc..2f734f18 100644 ---- a/form/frm_req_name.c -+++ b/form/frm_req_name.c -@@ -120,7 +120,7 @@ static const char request_names[MAX_FORM_COMMAND - MIN_FORM_COMMAND + 1][13] = - | Return Values : Pointer to name - on success - | NULL - on invalid request code - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(const char *) -+FORM_EXPORT(const char *) - form_request_name(int request) - { - T((T_CALLED("form_request_name(%d)"), request)); -@@ -143,7 +143,7 @@ form_request_name(int request) - | Return Values : Request Id - on success - | E_NO_MATCH - request not found - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+FORM_EXPORT(int) - form_request_by_name(const char *str) - { - /* because the table is so small, it doesn't really hurt -diff --git a/form/frm_scale.c b/form/frm_scale.c -index 34c3611d..e0e025aa 100644 ---- a/form/frm_scale.c -+++ b/form/frm_scale.c -@@ -45,7 +45,7 @@ MODULE_ID("$Id: frm_scale.c,v 1.11 2020/02/02 23:34:34 tom Exp $") - | E_BAD_ARGUMENT - invalid form pointer - | E_NOT_CONNECTED - no fields connected to form - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+FORM_EXPORT(int) - scale_form(const FORM *form, int *rows, int *cols) - { - T((T_CALLED("scale_form(%p,%p,%p)"), -diff --git a/form/frm_sub.c b/form/frm_sub.c -index 9621e302..ebfcb10d 100644 ---- a/form/frm_sub.c -+++ b/form/frm_sub.c -@@ -44,7 +44,7 @@ MODULE_ID("$Id: frm_sub.c,v 1.13 2020/02/02 23:34:34 tom Exp $") - | Return Values : E_OK - success - | E_POSTED - form is posted - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+FORM_EXPORT(int) - set_form_sub(FORM *form, WINDOW *win) - { - T((T_CALLED("set_form_sub(%p,%p)"), (void *)form, (void *)win)); -@@ -73,7 +73,7 @@ set_form_sub(FORM *form, WINDOW *win) - | - | Return Values : The pointer to the Subwindow. - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(WINDOW *) -+FORM_EXPORT(WINDOW *) - form_sub(const FORM *form) - { - const FORM *f; -diff --git a/form/frm_user.c b/form/frm_user.c -index e1210f2d..2a415fbe 100644 ---- a/form/frm_user.c -+++ b/form/frm_user.c -@@ -44,7 +44,7 @@ MODULE_ID("$Id: frm_user.c,v 1.16 2020/02/02 23:34:34 tom Exp $") - | - | Return Values : E_OK - on success - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+FORM_EXPORT(int) - set_form_userptr(FORM *form, void *usrptr) - { - T((T_CALLED("set_form_userptr(%p,%p)"), (void *)form, (void *)usrptr)); -@@ -63,7 +63,7 @@ set_form_userptr(FORM *form, void *usrptr) - | Return Values : Value of pointer. If no such pointer has been set, - | NULL is returned - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(void *) -+FORM_EXPORT(void *) - form_userptr(const FORM *form) - { - T((T_CALLED("form_userptr(%p)"), (const void *)form)); -diff --git a/form/frm_win.c b/form/frm_win.c -index b7d1272d..465ceb3c 100644 ---- a/form/frm_win.c -+++ b/form/frm_win.c -@@ -44,7 +44,7 @@ MODULE_ID("$Id: frm_win.c,v 1.17 2020/02/02 23:34:34 tom Exp $") - | Return Values : E_OK - success - | E_POSTED - form is posted - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+FORM_EXPORT(int) - set_form_win(FORM *form, WINDOW *win) - { - T((T_CALLED("set_form_win(%p,%p)"), (void *)form, (void *)win)); -@@ -73,7 +73,7 @@ set_form_win(FORM *form, WINDOW *win) - | - | Return Values : The pointer to the Window or stdscr if there is none. - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(WINDOW *) -+FORM_EXPORT(WINDOW *) - form_win(const FORM *form) - { - WINDOW *result; -diff --git a/form/fty_alnum.c b/form/fty_alnum.c -index a2ca3514..5504ba98 100644 ---- a/form/fty_alnum.c -+++ b/form/fty_alnum.c -@@ -186,14 +186,14 @@ static FIELDTYPE typeTHIS = - #endif - }; - --NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_ALNUM = &typeTHIS; -+FORM_EXPORT_VAR(FIELDTYPE*) TYPE_ALNUM = &typeTHIS; - - #if NCURSES_INTEROP_FUNCS - /* The next routines are to simplify the use of ncurses from - programming languages with restictions on interop with C level - constructs (e.g. variable access or va_list + ellipsis constructs) - */ --NCURSES_EXPORT(FIELDTYPE *) -+FORM_EXPORT(FIELDTYPE *) - _nc_TYPE_ALNUM(void) - { - return TYPE_ALNUM; -diff --git a/form/fty_alpha.c b/form/fty_alpha.c -index 7dec23f5..15e27143 100644 ---- a/form/fty_alpha.c -+++ b/form/fty_alpha.c -@@ -186,14 +186,14 @@ static FIELDTYPE typeTHIS = - #endif - }; - --NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_ALPHA = &typeTHIS; -+FORM_EXPORT_VAR(FIELDTYPE*) TYPE_ALPHA = &typeTHIS; - - #if NCURSES_INTEROP_FUNCS - /* The next routines are to simplify the use of ncurses from - programming languages with restictions on interop with C level - constructs (e.g. variable access or va_list + ellipsis constructs) - */ --NCURSES_EXPORT(FIELDTYPE *) -+FORM_EXPORT(FIELDTYPE *) - _nc_TYPE_ALPHA(void) - { - return TYPE_ALPHA; -diff --git a/form/fty_enum.c b/form/fty_enum.c -index 71978e3a..2633eff4 100644 ---- a/form/fty_enum.c -+++ b/form/fty_enum.c -@@ -425,7 +425,7 @@ static FIELDTYPE typeENUM = - #endif - }; - --NCURSES_EXPORT_VAR(FIELDTYPE *) -+FORM_EXPORT_VAR(FIELDTYPE *) - TYPE_ENUM = &typeENUM; - - #if NCURSES_INTEROP_FUNCS -@@ -433,7 +433,7 @@ TYPE_ENUM = &typeENUM; - programming languages with restictions on interop with C level - constructs (e.g. variable access or va_list + ellipsis constructs) - */ --NCURSES_EXPORT(FIELDTYPE *) -+FORM_EXPORT(FIELDTYPE *) - _nc_TYPE_ENUM(void) - { - return TYPE_ENUM; -diff --git a/form/fty_generic.c b/form/fty_generic.c -index 159d3059..f4332f43 100644 ---- a/form/fty_generic.c -+++ b/form/fty_generic.c -@@ -99,7 +99,7 @@ Generic_This_Type(void *arg) - | - | Return Values : Fieldtype pointer or NULL if error occurred - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(FIELDTYPE *) -+FORM_EXPORT(FIELDTYPE *) - _nc_generic_fieldtype(bool (*const field_check) (FORM *, FIELD *, const void *), - bool (*const char_check) (int, FORM *, FIELD *, const - void *), -@@ -220,7 +220,7 @@ GenericArgument(const FIELDTYPE *typ, - | Return Values : E_OK if all went well - | E_SYSTEM_ERROR if an error occurred - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+FORM_EXPORT(int) - _nc_set_generic_fieldtype(FIELD *field, - FIELDTYPE *ftyp, - int (*argiterator) (void **)) -@@ -275,7 +275,7 @@ _nc_set_generic_fieldtype(FIELD *field, - | - | Return Values : The fields Window or NULL on error - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(WINDOW *) -+FORM_EXPORT(WINDOW *) - _nc_form_cursor(const FORM *form, int *pRow, int *pCol) - { - int code = E_SYSTEM_ERROR; -diff --git a/form/fty_int.c b/form/fty_int.c -index 71056404..5e619462 100644 ---- a/form/fty_int.c -+++ b/form/fty_int.c -@@ -278,14 +278,14 @@ static FIELDTYPE typeTHIS = - #endif - }; - --NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_INTEGER = &typeTHIS; -+FORM_EXPORT_VAR(FIELDTYPE*) TYPE_INTEGER = &typeTHIS; - - #if NCURSES_INTEROP_FUNCS - /* The next routines are to simplify the use of ncurses from - programming languages with restictions on interop with C level - constructs (e.g. variable access or va_list + ellipsis constructs) - */ --NCURSES_EXPORT(FIELDTYPE *) -+FORM_EXPORT(FIELDTYPE *) - _nc_TYPE_INTEGER(void) - { - return TYPE_INTEGER; -diff --git a/form/fty_ipv4.c b/form/fty_ipv4.c -index 37133770..6d558668 100644 ---- a/form/fty_ipv4.c -+++ b/form/fty_ipv4.c -@@ -104,14 +104,14 @@ static FIELDTYPE typeIPV4 = - #endif - }; - --NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_IPV4 = &typeIPV4; -+FORM_EXPORT_VAR(FIELDTYPE*) TYPE_IPV4 = &typeIPV4; - - #if NCURSES_INTEROP_FUNCS - /* The next routines are to simplify the use of ncurses from - programming languages with restictions on interop with C level - constructs (e.g. variable access or va_list + ellipsis constructs) - */ --NCURSES_EXPORT(FIELDTYPE *) -+FORM_EXPORT(FIELDTYPE *) - _nc_TYPE_IPV4(void) - { - return TYPE_IPV4; -diff --git a/form/fty_num.c b/form/fty_num.c -index b4dfeb97..8216cd74 100644 ---- a/form/fty_num.c -+++ b/form/fty_num.c -@@ -324,14 +324,14 @@ static FIELDTYPE typeTHIS = - #endif - }; - --NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_NUMERIC = &typeTHIS; -+FORM_EXPORT_VAR(FIELDTYPE*) TYPE_NUMERIC = &typeTHIS; - - #if NCURSES_INTEROP_FUNCS - /* The next routines are to simplify the use of ncurses from - programming languages with restictions on interop with C level - constructs (e.g. variable access or va_list + ellipsis constructs) - */ --NCURSES_EXPORT(FIELDTYPE *) -+FORM_EXPORT(FIELDTYPE *) - _nc_TYPE_NUMERIC(void) - { - return TYPE_NUMERIC; -diff --git a/form/fty_regex.c b/form/fty_regex.c -index d1daf714..61378050 100644 ---- a/form/fty_regex.c -+++ b/form/fty_regex.c -@@ -340,14 +340,14 @@ static FIELDTYPE typeREGEXP = - #endif - }; - --NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_REGEXP = &typeREGEXP; -+FORM_EXPORT_VAR(FIELDTYPE*) TYPE_REGEXP = &typeREGEXP; - - #if NCURSES_INTEROP_FUNCS - /* The next routines are to simplify the use of ncurses from - programming languages with restictions on interop with C level - constructs (e.g. variable access or va_list + ellipsis constructs) - */ --NCURSES_EXPORT(FIELDTYPE *) -+FORM_EXPORT(FIELDTYPE *) - _nc_TYPE_REGEXP(void) - { - return TYPE_REGEXP; -diff --git a/include/ncurses_dll.h.in b/include/ncurses_dll.h.in -index 568112e2..ca1f0749 100644 ---- a/include/ncurses_dll.h.in -+++ b/include/ncurses_dll.h.in -@@ -66,7 +66,6 @@ - * using functions to access them. - */ - #define NCURSES_PUBLIC_VAR(name) @NCURSES_WRAP_PREFIX@##name --#define NCURSES_WRAPPED_VAR(type,name) extern type NCURSES_PUBLIC_VAR(name)(void) - - #include "ncurses_exports.h" - -@@ -76,6 +75,8 @@ - # define NCURSES_IMPEXP NCURSES_EXPORT_GENERAL_IMPORT - #endif - -+#define NCURSES_WRAPPED_VAR(type,name) extern NCURSES_IMPEXP type NCURSES_PUBLIC_VAR(name)(void) -+ - #define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API - #define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type - ---- include/nc_mingw.h -+++ include/nc_mingw.h -@@ -60,7 +60,9 @@ - #include /* for struct timeval */ - #endif - --extern int _nc_gettimeofday(struct timeval *, void *); -+#include -+ -+NCURSES_EXPORT(int) _nc_gettimeofday(struct timeval *, void *); - - #undef HAVE_GETTIMEOFDAY - #define HAVE_GETTIMEOFDAY 1 -@@ -71,7 +73,7 @@ extern int _nc_gettimeofday(struct timeval *, void *); - - #undef wcwidth - #define wcwidth(ucs) _nc_wcwidth((wchar_t)(ucs)) --extern int _nc_wcwidth(wchar_t); -+NCURSES_EXPORT(int) _nc_wcwidth(wchar_t); - - #endif /* _WIN32 */ - -diff --git a/menu/m_cursor.c b/menu/m_cursor.c -index 3f8e5480..786d9e6c 100644 ---- a/menu/m_cursor.c -+++ b/menu/m_cursor.c -@@ -50,7 +50,7 @@ MODULE_ID("$Id: m_cursor.c,v 1.23 2020/02/02 23:34:34 tom Exp $") - | E_BAD_ARGUMENT - invalid menu - | E_NOT_POSTED - Menu is not posted - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+MENU_EXPORT(int) - _nc_menu_cursor_pos(const MENU * menu, const ITEM * item, int *pY, int *pX) - { - if (!menu || !pX || !pY) -@@ -80,7 +80,7 @@ _nc_menu_cursor_pos(const MENU * menu, const ITEM * item, int *pY, int *pX) - | E_BAD_ARGUMENT - invalid menu - | E_NOT_POSTED - Menu is not posted - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+MENU_EXPORT(int) - pos_menu_cursor(const MENU * menu) - { - WINDOW *win, *sub; -diff --git a/menu/m_driver.c b/menu/m_driver.c -index e592bab4..98d7fdf1 100644 ---- a/menu/m_driver.c -+++ b/menu/m_driver.c -@@ -115,7 +115,7 @@ Is_Sub_String( - | Return Values : E_OK - an item matching the pattern was found - | E_NO_MATCH - nothing found - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+MENU_EXPORT(int) - _nc_Match_Next_Character_In_Item_Name - (MENU * menu, int ch, ITEM ** item) - { -@@ -209,7 +209,7 @@ _nc_Match_Next_Character_In_Item_Name - | E_BAD_STATE - menu is in user hook routine - | E_NOT_POSTED - menu is not posted - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+MENU_EXPORT(int) - menu_driver(MENU * menu, int c) - { - #define NAVIGATE(dir) \ -diff --git a/menu/m_format.c b/menu/m_format.c -index 9738dbf2..96d331e4 100644 ---- a/menu/m_format.c -+++ b/menu/m_format.c -@@ -56,7 +56,7 @@ MODULE_ID("$Id: m_format.c,v 1.19 2020/02/02 23:34:34 tom Exp $") - | E_NOT_CONNECTED - there are no items connected - | E_POSTED - the menu is already posted - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+MENU_EXPORT(int) - set_menu_format(MENU * menu, int rows, int cols) - { - int total_rows, total_cols; -@@ -120,7 +120,7 @@ set_menu_format(MENU * menu, int rows, int cols) - | - | Return Values : - - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(void) -+MENU_EXPORT(void) - menu_format(const MENU * menu, int *rows, int *cols) - { - if (rows) -diff --git a/menu/m_global.c b/menu/m_global.c -index 489987fe..f2d6c001 100644 ---- a/menu/m_global.c -+++ b/menu/m_global.c -@@ -42,7 +42,7 @@ MODULE_ID("$Id: m_global.c,v 1.30 2020/02/02 23:34:34 tom Exp $") - - static char mark[] = "-"; - /* *INDENT-OFF* */ --NCURSES_EXPORT_VAR(MENU) _nc_Default_Menu = { -+MENU_EXPORT_VAR(MENU) _nc_Default_Menu = { - 16, /* Nr. of chars high */ - 1, /* Nr. of chars wide */ - 16, /* Nr. of items high */ -@@ -81,7 +81,7 @@ NCURSES_EXPORT_VAR(MENU) _nc_Default_Menu = { - 0 /* status */ - }; - --NCURSES_EXPORT_VAR(ITEM) _nc_Default_Item = { -+MENU_EXPORT_VAR(ITEM) _nc_Default_Item = { - { (char *)0, 0 }, /* name */ - { (char *)0, 0 }, /* description */ - (MENU *)0, /* Pointer to parent menu */ -@@ -171,7 +171,7 @@ ResetConnectionInfo(MENU * menu, ITEM ** items) - | Return Values : TRUE - successful connection - | FALSE - connection failed - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(bool) -+MENU_EXPORT(bool) - _nc_Connect_Items(MENU * menu, ITEM ** items) - { - ITEM **item; -@@ -233,7 +233,7 @@ _nc_Connect_Items(MENU * menu, ITEM ** items) - | - | Return Values : - - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(void) -+MENU_EXPORT(void) - _nc_Disconnect_Items(MENU * menu) - { - if (menu && menu->items) -@@ -248,7 +248,7 @@ _nc_Disconnect_Items(MENU * menu) - | - | Return Values : the width - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+MENU_EXPORT(int) - _nc_Calculate_Text_Width(const TEXT * item /*FIXME: limit length */ ) - { - #if USE_WIDEC_SUPPORT -@@ -337,7 +337,7 @@ calculate_actual_width(MENU * menu, bool name) - | - | Return Values : - - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(void) -+MENU_EXPORT(void) - _nc_Calculate_Item_Length_and_Width(MENU * menu) - { - int l; -@@ -376,7 +376,7 @@ _nc_Calculate_Item_Length_and_Width(MENU * menu) - | - | Return Values : - - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(void) -+MENU_EXPORT(void) - _nc_Link_Items(MENU * menu) - { - if (menu && menu->items && *(menu->items)) -@@ -503,7 +503,7 @@ _nc_Link_Items(MENU * menu) - | - | Return Values : - - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(void) -+MENU_EXPORT(void) - _nc_Show_Menu(const MENU * menu) - { - WINDOW *win; -@@ -543,7 +543,7 @@ _nc_Show_Menu(const MENU * menu) - | - | Return Values : - - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(void) -+MENU_EXPORT(void) - _nc_New_TopRow_and_CurrentItem( - MENU * menu, - int new_toprow, -diff --git a/menu/m_item_cur.c b/menu/m_item_cur.c -index c09bf311..10435e7a 100644 ---- a/menu/m_item_cur.c -+++ b/menu/m_item_cur.c -@@ -48,7 +48,7 @@ MODULE_ID("$Id: m_item_cur.c,v 1.19 2020/02/02 23:34:34 tom Exp $") - | - | Return Values : E_OK - success - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+MENU_EXPORT(int) - set_current_item(MENU * menu, ITEM * item) - { - T((T_CALLED("set_current_item(%p,%p)"), (void *)menu, (void *)item)); -@@ -89,7 +89,7 @@ set_current_item(MENU * menu, ITEM * item) - | - | Return Values : Item pointer or NULL if failure - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(ITEM *) -+MENU_EXPORT(ITEM *) - current_item(const MENU * menu) - { - T((T_CALLED("current_item(%p)"), (const void *)menu)); -@@ -104,7 +104,7 @@ current_item(const MENU * menu) - | - | Return Values : The index or ERR if this is an invalid item pointer - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+MENU_EXPORT(int) - item_index(const ITEM * item) - { - T((T_CALLED("item_index(%p)"), (const void *)item)); -diff --git a/menu/m_item_nam.c b/menu/m_item_nam.c -index aaf54e0a..dc4d66c6 100644 ---- a/menu/m_item_nam.c -+++ b/menu/m_item_nam.c -@@ -48,7 +48,7 @@ MODULE_ID("$Id: m_item_nam.c,v 1.16 2020/02/02 23:34:34 tom Exp $") - | - | Return Values : See above; returns NULL if item is invalid - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(const char *) -+MENU_EXPORT(const char *) - item_name(const ITEM * item) - { - T((T_CALLED("item_name(%p)"), (const void *)item)); -@@ -63,7 +63,7 @@ item_name(const ITEM * item) - | - | Return Values : See above; Returns NULL if item is invalid - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(const char *) -+MENU_EXPORT(const char *) - item_description(const ITEM * item) - { - T((T_CALLED("item_description(%p)"), (const void *)item)); -diff --git a/menu/m_item_new.c b/menu/m_item_new.c -index 1e7950db..493977ad 100644 ---- a/menu/m_item_new.c -+++ b/menu/m_item_new.c -@@ -107,7 +107,7 @@ Is_Printable_String(const char *s) - | - | Return Values : The item pointer or NULL if creation failed. - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(ITEM *) -+MENU_EXPORT(ITEM *) - new_item(const char *name, const char *description) - { - ITEM *item; -@@ -160,7 +160,7 @@ new_item(const char *name, const char *description) - | E_BAD_ARGUMENT - invalid value has been passed - | E_CONNECTED - item is still connected to a menu - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+MENU_EXPORT(int) - free_item(ITEM * item) - { - T((T_CALLED("free_item(%p)"), (void *)item)); -@@ -193,7 +193,7 @@ free_item(ITEM * item) - | E_BAD_ARGUMENT - an invalid value has been passed - | E_SYSTEM_ERROR - no memory to store mark - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+MENU_EXPORT(int) - set_menu_mark(MENU * menu, const char *mark) - { - short l; -@@ -265,7 +265,7 @@ set_menu_mark(MENU * menu, const char *mark) - | - | Return Values : The marker string pointer or NULL if no marker defined - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(const char *) -+MENU_EXPORT(const char *) - menu_mark(const MENU * menu) - { - T((T_CALLED("menu_mark(%p)"), (const void *)menu)); -diff --git a/menu/m_item_opt.c b/menu/m_item_opt.c -index f8df2205..b6a5e151 100644 ---- a/menu/m_item_opt.c -+++ b/menu/m_item_opt.c -@@ -51,7 +51,7 @@ MODULE_ID("$Id: m_item_opt.c,v 1.19 2020/02/02 23:34:34 tom Exp $") - | Return Values : E_OK - success - | E_BAD_ARGUMENT - invalid item options - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+MENU_EXPORT(int) - set_item_opts(ITEM * item, Item_Options opts) - { - T((T_CALLED("set_menu_opts(%p,%d)"), (void *)item, opts)); -@@ -94,7 +94,7 @@ set_item_opts(ITEM * item, Item_Options opts) - | Return Values : E_OK - success - | E_BAD_ARGUMENT - invalid options - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+MENU_EXPORT(int) - item_opts_off(ITEM * item, Item_Options opts) - { - ITEM *citem = item; /* use a copy because set_item_opts must detect -@@ -122,7 +122,7 @@ item_opts_off(ITEM * item, Item_Options opts) - | Return Values : E_OK - success - | E_BAD_ARGUMENT - invalid options - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+MENU_EXPORT(int) - item_opts_on(ITEM * item, Item_Options opts) - { - ITEM *citem = item; /* use a copy because set_item_opts must detect -@@ -150,7 +150,7 @@ item_opts_on(ITEM * item, Item_Options opts) - | - | Return Values : Items options - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(Item_Options) -+MENU_EXPORT(Item_Options) - item_opts(const ITEM * item) - { - T((T_CALLED("item_opts(%p)"), (const void *)item)); -diff --git a/menu/m_item_top.c b/menu/m_item_top.c -index 9417e72b..ab60e0f9 100644 ---- a/menu/m_item_top.c -+++ b/menu/m_item_top.c -@@ -50,7 +50,7 @@ MODULE_ID("$Id: m_item_top.c,v 1.12 2020/02/02 23:34:34 tom Exp $") - | E_BAD_ARGUMENT - not a menu pointer or invalid row - | E_NOT_CONNECTED - there are no items for the menu - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+MENU_EXPORT(int) - set_top_row(MENU * menu, int row) - { - ITEM *item; -@@ -92,7 +92,7 @@ set_top_row(MENU * menu, int row) - | - | Return Values : The row number or ERR if there is no row - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+MENU_EXPORT(int) - top_row(const MENU * menu) - { - T((T_CALLED("top_row(%p)"), (const void *)menu)); -diff --git a/menu/m_item_use.c b/menu/m_item_use.c -index 30814327..a2e6cfa6 100644 ---- a/menu/m_item_use.c -+++ b/menu/m_item_use.c -@@ -49,7 +49,7 @@ MODULE_ID("$Id: m_item_use.c,v 1.19 2020/02/02 23:34:34 tom Exp $") - | - | Return Values : E_OK - success - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+MENU_EXPORT(int) - set_item_userptr(ITEM * item, void *userptr) - { - T((T_CALLED("set_item_userptr(%p,%p)"), (void *)item, (void *)userptr)); -@@ -67,7 +67,7 @@ set_item_userptr(ITEM * item, void *userptr) - | Return Values : Value of the pointer. If no such pointer has been set, - | NULL is returned. - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(void *) -+MENU_EXPORT(void *) - item_userptr(const ITEM * item) - { - T((T_CALLED("item_userptr(%p)"), (const void *)item)); -diff --git a/menu/m_item_val.c b/menu/m_item_val.c -index d8d11f21..825c9a2f 100644 ---- a/menu/m_item_val.c -+++ b/menu/m_item_val.c -@@ -53,7 +53,7 @@ MODULE_ID("$Id: m_item_val.c,v 1.16 2020/02/02 23:34:34 tom Exp $") - | Return Values : E_OK - success - | E_REQUEST_DENIED - not selectable or single valued menu - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+MENU_EXPORT(int) - set_item_value(ITEM * item, bool value) - { - MENU *menu; -@@ -95,7 +95,7 @@ set_item_value(ITEM * item, bool value) - | Return Values : TRUE - if item is selected - | FALSE - if item is not selected - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(bool) -+MENU_EXPORT(bool) - item_value(const ITEM * item) - { - T((T_CALLED("item_value(%p)"), (const void *)item)); -diff --git a/menu/m_item_vis.c b/menu/m_item_vis.c -index 8e993413..5959548a 100644 ---- a/menu/m_item_vis.c -+++ b/menu/m_item_vis.c -@@ -50,7 +50,7 @@ MODULE_ID("$Id: m_item_vis.c,v 1.17 2020/02/02 23:34:34 tom Exp $") - | Return Values : TRUE if visible - | FALSE if invisible - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(bool) -+MENU_EXPORT(bool) - item_visible(const ITEM * item) - { - MENU *menu; -diff --git a/menu/m_items.c b/menu/m_items.c -index 9f46c8be..8c6d4bfc 100644 ---- a/menu/m_items.c -+++ b/menu/m_items.c -@@ -53,7 +53,7 @@ MODULE_ID("$Id: m_items.c,v 1.18 2020/02/02 23:34:34 tom Exp $") - | E_BAD_ARGUMENT - An incorrect menu or item array was - | passed to the function - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+MENU_EXPORT(int) - set_menu_items(MENU * menu, ITEM ** items) - { - T((T_CALLED("set_menu_items(%p,%p)"), (void *)menu, (void *)items)); -@@ -85,7 +85,7 @@ set_menu_items(MENU * menu, ITEM ** items) - | - | Return Values : NULL on error - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(ITEM **) -+MENU_EXPORT(ITEM **) - menu_items(const MENU * menu) - { - T((T_CALLED("menu_items(%p)"), (const void *)menu)); -@@ -101,7 +101,7 @@ menu_items(const MENU * menu) - | - | Return Values : Number of items or -1 to indicate error. - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+MENU_EXPORT(int) - item_count(const MENU * menu) - { - T((T_CALLED("item_count(%p)"), (const void *)menu)); -diff --git a/menu/m_new.c b/menu/m_new.c -index cf89196a..f78c702c 100644 ---- a/menu/m_new.c -+++ b/menu/m_new.c -@@ -51,7 +51,7 @@ MODULE_ID("$Id: m_new.c,v 1.22 2020/02/02 23:34:34 tom Exp $") - | - | Return Values : NULL on error - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(MENU *) -+MENU_EXPORT(MENU *) - NCURSES_SP_NAME(new_menu) (NCURSES_SP_DCLx ITEM ** items) - { - int err = E_SYSTEM_ERROR; -@@ -102,7 +102,7 @@ NCURSES_SP_NAME(new_menu) (NCURSES_SP_DCLx ITEM ** items) - | Return Values : NULL on error - +--------------------------------------------------------------------------*/ - #if NCURSES_SP_FUNCS --NCURSES_EXPORT(MENU *) -+MENU_EXPORT(MENU *) - new_menu(ITEM ** items) - { - return NCURSES_SP_NAME(new_menu) (CURRENT_SCREEN, items); -@@ -120,7 +120,7 @@ new_menu(ITEM ** items) - | E_BAD_ARGUMENT - Invalid menu pointer passed - | E_POSTED - Menu is already posted - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+MENU_EXPORT(int) - free_menu(MENU * menu) - { - T((T_CALLED("free_menu(%p)"), (void *)menu)); -diff --git a/menu/m_opts.c b/menu/m_opts.c -index 4c29f333..b8dc653d 100644 ---- a/menu/m_opts.c -+++ b/menu/m_opts.c -@@ -53,7 +53,7 @@ MODULE_ID("$Id: m_opts.c,v 1.21 2020/02/02 23:34:34 tom Exp $") - | E_BAD_ARGUMENT - invalid menu options - | E_POSTED - menu is already posted - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+MENU_EXPORT(int) - set_menu_opts(MENU * menu, Menu_Options opts) - { - T((T_CALLED("set_menu_opts(%p,%d)"), (void *)menu, opts)); -@@ -113,7 +113,7 @@ set_menu_opts(MENU * menu, Menu_Options opts) - | E_BAD_ARGUMENT - invalid options - | E_POSTED - menu is already posted - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+MENU_EXPORT(int) - menu_opts_off(MENU * menu, Menu_Options opts) - { - MENU *cmenu = menu; /* use a copy because set_menu_opts must detect -@@ -146,7 +146,7 @@ menu_opts_off(MENU * menu, Menu_Options opts) - | E_BAD_ARGUMENT - invalid menu options - | E_POSTED - menu is already posted - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+MENU_EXPORT(int) - menu_opts_on(MENU * menu, Menu_Options opts) - { - MENU *cmenu = menu; /* use a copy because set_menu_opts must detect -@@ -174,7 +174,7 @@ menu_opts_on(MENU * menu, Menu_Options opts) - | - | Return Values : Menu options - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(Menu_Options) -+MENU_EXPORT(Menu_Options) - menu_opts(const MENU * menu) - { - T((T_CALLED("menu_opts(%p)"), (const void *)menu)); -diff --git a/menu/m_pad.c b/menu/m_pad.c -index 3d5702ae..e56d3748 100644 ---- a/menu/m_pad.c -+++ b/menu/m_pad.c -@@ -59,7 +59,7 @@ MODULE_ID("$Id: m_pad.c,v 1.14 2020/02/02 23:34:34 tom Exp $") - | Return Values : E_OK - success - | E_BAD_ARGUMENT - an invalid value has been passed - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+MENU_EXPORT(int) - set_menu_pad(MENU * menu, int pad) - { - bool do_refresh = (menu != (MENU *) 0); -@@ -86,7 +86,7 @@ set_menu_pad(MENU * menu, int pad) - | - | Return Values : The pad character - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+MENU_EXPORT(int) - menu_pad(const MENU * menu) - { - T((T_CALLED("menu_pad(%p)"), (const void *)menu)); -diff --git a/menu/m_pattern.c b/menu/m_pattern.c -index 9ff02304..f91f3223 100644 ---- a/menu/m_pattern.c -+++ b/menu/m_pattern.c -@@ -51,7 +51,7 @@ MODULE_ID("$Id: m_pattern.c,v 1.17 2020/02/02 23:34:34 tom Exp $") - | pattern is stored - | PatternString - as expected - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(char *) -+MENU_EXPORT(char *) - menu_pattern(const MENU * menu) - { - static char empty[] = ""; -@@ -73,7 +73,7 @@ menu_pattern(const MENU * menu) - | E_NOT_CONNECTED - no items connected to menu - | E_NO_MATCH - no item matches pattern - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+MENU_EXPORT(int) - set_menu_pattern(MENU * menu, const char *p) - { - ITEM *matchitem; -diff --git a/menu/m_post.c b/menu/m_post.c -index 2cc0ea09..6d81b7c9 100644 ---- a/menu/m_post.c -+++ b/menu/m_post.c -@@ -49,7 +49,7 @@ MODULE_ID("$Id: m_post.c,v 1.32 2020/02/02 23:34:34 tom Exp $") - | - | Return Values : - - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(void) -+MENU_EXPORT(void) - _nc_Post_Item(const MENU * menu, const ITEM * item) - { - int i; -@@ -197,7 +197,7 @@ _nc_Post_Item(const MENU * menu, const ITEM * item) - | - | Return Values : - - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(void) -+MENU_EXPORT(void) - _nc_Draw_Menu(const MENU * menu) - { - ITEM *item = menu->items[0]; -@@ -267,7 +267,7 @@ _nc_Draw_Menu(const MENU * menu) - | E_BAD_STATE - Menu in userexit routine - | E_POSTED - Menu already posted - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+MENU_EXPORT(int) - post_menu(MENU * menu) - { - T((T_CALLED("post_menu(%p)"), (void *)menu)); -@@ -339,7 +339,7 @@ post_menu(MENU * menu) - | E_BAD_STATE - menu in userexit routine - | E_NOT_POSTED - menu is not posted - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+MENU_EXPORT(int) - unpost_menu(MENU * menu) - { - WINDOW *win; -diff --git a/menu/m_req_name.c b/menu/m_req_name.c -index d3f04c1d..beeea0f1 100644 ---- a/menu/m_req_name.c -+++ b/menu/m_req_name.c -@@ -74,7 +74,7 @@ static const char request_names[MAX_MENU_COMMAND - MIN_MENU_COMMAND + 1][14] = - | Return Values : Pointer to name - on success - | NULL - on invalid request code - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(const char *) -+MENU_EXPORT(const char *) - menu_request_name(int request) - { - T((T_CALLED("menu_request_name(%d)"), request)); -@@ -96,7 +96,7 @@ menu_request_name(int request) - | Return Values : Request Id - on success - | E_NO_MATCH - request not found - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+MENU_EXPORT(int) - menu_request_by_name(const char *str) - { - /* because the table is so small, it doesn't really hurt -diff --git a/menu/m_scale.c b/menu/m_scale.c -index e013acd8..ba986955 100644 ---- a/menu/m_scale.c -+++ b/menu/m_scale.c -@@ -51,7 +51,7 @@ MODULE_ID("$Id: m_scale.c,v 1.11 2020/02/02 23:34:34 tom Exp $") - | E_BAD_ARGUMENT - invalid menu pointer - | E_NOT_CONNECTED - no items are connected to menu - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+MENU_EXPORT(int) - scale_menu(const MENU * menu, int *rows, int *cols) - { - T((T_CALLED("scale_menu(%p,%p,%p)"), -diff --git a/menu/m_spacing.c b/menu/m_spacing.c -index 9bb746a0..6d68e268 100644 ---- a/menu/m_spacing.c -+++ b/menu/m_spacing.c -@@ -52,7 +52,7 @@ MODULE_ID("$Id: m_spacing.c,v 1.20 2020/02/02 23:34:34 tom Exp $") - | - | Return Values : E_OK - on success - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+MENU_EXPORT(int) - set_menu_spacing(MENU * menu, int s_desc, int s_row, int s_col) - { - MENU *m; /* split for ATAC workaround */ -@@ -87,7 +87,7 @@ set_menu_spacing(MENU * menu, int s_desc, int s_row, int s_col) - | - | Return Values : E_OK - on success - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+MENU_EXPORT(int) - menu_spacing(const MENU * menu, int *s_desc, int *s_row, int *s_col) - { - const MENU *m; /* split for ATAC workaround */ -diff --git a/menu/m_sub.c b/menu/m_sub.c -index 4658e90e..e69994d5 100644 ---- a/menu/m_sub.c -+++ b/menu/m_sub.c -@@ -49,7 +49,7 @@ MODULE_ID("$Id: m_sub.c,v 1.13 2020/02/02 23:34:34 tom Exp $") - | Return Values : E_OK - success - | E_POSTED - menu is already posted - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+MENU_EXPORT(int) - set_menu_sub(MENU * menu, WINDOW *win) - { - T((T_CALLED("set_menu_sub(%p,%p)"), (void *)menu, (void *)win)); -@@ -89,7 +89,7 @@ set_menu_sub(MENU * menu, WINDOW *win) - | - | Return Values : NULL on error, otherwise a pointer to the window - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(WINDOW *) -+MENU_EXPORT(WINDOW *) - menu_sub(const MENU * menu) - { - const MENU *m = Normalize_Menu(menu); -diff --git a/menu/m_trace.c b/menu/m_trace.c -index f5332b18..f4d3373d 100644 ---- a/menu/m_trace.c -+++ b/menu/m_trace.c -@@ -35,35 +35,35 @@ - - MODULE_ID("$Id: m_trace.c,v 1.7 2020/02/02 23:34:34 tom Exp $") - --NCURSES_EXPORT(ITEM *) -+MENU_EXPORT(ITEM *) - _nc_retrace_item(ITEM * code) - { - T((T_RETURN("%p"), (void *)code)); - return code; - } - --NCURSES_EXPORT(ITEM **) -+MENU_EXPORT(ITEM **) - _nc_retrace_item_ptr(ITEM ** code) - { - T((T_RETURN("%p"), (void *)code)); - return code; - } - --NCURSES_EXPORT(Item_Options) -+MENU_EXPORT(Item_Options) - _nc_retrace_item_opts(Item_Options code) - { - T((T_RETURN("%d"), code)); - return code; - } - --NCURSES_EXPORT(MENU *) -+MENU_EXPORT(MENU *) - _nc_retrace_menu(MENU * code) - { - T((T_RETURN("%p"), (void *)code)); - return code; - } - --NCURSES_EXPORT(Menu_Hook) -+MENU_EXPORT(Menu_Hook) - _nc_retrace_menu_hook(Menu_Hook code) - { - TR_FUNC_BFR(1); -@@ -71,7 +71,7 @@ _nc_retrace_menu_hook(Menu_Hook code) - return code; - } - --NCURSES_EXPORT(Menu_Options) -+MENU_EXPORT(Menu_Options) - _nc_retrace_menu_opts(Menu_Options code) - { - T((T_RETURN("%d"), code)); -diff --git a/menu/m_userptr.c b/menu/m_userptr.c -index df3a45f8..6b1ca551 100644 ---- a/menu/m_userptr.c -+++ b/menu/m_userptr.c -@@ -49,7 +49,7 @@ MODULE_ID("$Id: m_userptr.c,v 1.19 2020/02/02 23:34:34 tom Exp $") - | - | Return Values : E_OK - success - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+MENU_EXPORT(int) - set_menu_userptr(MENU * menu, void *userptr) - { - T((T_CALLED("set_menu_userptr(%p,%p)"), (void *)menu, (void *)userptr)); -@@ -67,7 +67,7 @@ set_menu_userptr(MENU * menu, void *userptr) - | Return Values : Value of the pointer. If no such pointer has been set, - | NULL is returned - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(void *) -+MENU_EXPORT(void *) - menu_userptr(const MENU * menu) - { - T((T_CALLED("menu_userptr(%p)"), (const void *)menu)); -diff --git a/menu/m_win.c b/menu/m_win.c -index f06c5808..e67cc92e 100644 ---- a/menu/m_win.c -+++ b/menu/m_win.c -@@ -49,7 +49,7 @@ MODULE_ID("$Id: m_win.c,v 1.18 2020/02/02 23:34:34 tom Exp $") - | Return Values : E_OK - success - | E_POSTED - menu is already posted - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(int) -+MENU_EXPORT(int) - set_menu_win(MENU * menu, WINDOW *win) - { - T((T_CALLED("set_menu_win(%p,%p)"), (void *)menu, (void *)win)); -@@ -89,7 +89,7 @@ set_menu_win(MENU * menu, WINDOW *win) - | - | Return Values : NULL on error, otherwise pointer to window - +--------------------------------------------------------------------------*/ --NCURSES_EXPORT(WINDOW *) -+MENU_EXPORT(WINDOW *) - menu_win(const MENU * menu) - { - const MENU *m = Normalize_Menu(menu); -diff --git a/menu/menu.h b/menu/menu.h -index b2e845c6..09bc6c0a 100644 ---- a/menu/menu.h -+++ b/menu/menu.h -@@ -47,6 +47,19 @@ - extern "C" { - #endif - -+#include "ncurses_exports.h" -+ -+#if defined(BUILDING_MENU) -+# define MENU_IMPEXP NCURSES_EXPORT_GENERAL_EXPORT -+#else -+# define MENU_IMPEXP NCURSES_EXPORT_GENERAL_IMPORT -+#endif -+ -+#define MENU_WRAPPED_VAR(type,name) extern MENU_IMPEXP type NCURSES_PUBLIC_VAR(name)(void) -+ -+#define MENU_EXPORT(type) MENU_IMPEXP type NCURSES_API -+#define MENU_EXPORT_VAR(type) MENU_IMPEXP type -+ - typedef int Menu_Options; - typedef int Item_Options; - -@@ -183,85 +196,85 @@ MENU; - - /* --------- prototypes for libmenu functions ----------------------------- */ - --extern NCURSES_EXPORT(ITEM **) menu_items (const MENU *); --extern NCURSES_EXPORT(ITEM *) current_item (const MENU *); --extern NCURSES_EXPORT(ITEM *) new_item (const char *,const char *); -- --extern NCURSES_EXPORT(MENU *) new_menu (ITEM **); -- --extern NCURSES_EXPORT(Item_Options) item_opts (const ITEM *); --extern NCURSES_EXPORT(Menu_Options) menu_opts (const MENU *); -- --extern NCURSES_EXPORT(Menu_Hook) item_init (const MENU *); --extern NCURSES_EXPORT(Menu_Hook) item_term (const MENU *); --extern NCURSES_EXPORT(Menu_Hook) menu_init (const MENU *); --extern NCURSES_EXPORT(Menu_Hook) menu_term (const MENU *); -- --extern NCURSES_EXPORT(WINDOW *) menu_sub (const MENU *); --extern NCURSES_EXPORT(WINDOW *) menu_win (const MENU *); -- --extern NCURSES_EXPORT(const char *) item_description (const ITEM *); --extern NCURSES_EXPORT(const char *) item_name (const ITEM *); --extern NCURSES_EXPORT(const char *) menu_mark (const MENU *); --extern NCURSES_EXPORT(const char *) menu_request_name (int); -- --extern NCURSES_EXPORT(char *) menu_pattern (const MENU *); -- --extern NCURSES_EXPORT(void *) menu_userptr (const MENU *); --extern NCURSES_EXPORT(void *) item_userptr (const ITEM *); -- --extern NCURSES_EXPORT(chtype) menu_back (const MENU *); --extern NCURSES_EXPORT(chtype) menu_fore (const MENU *); --extern NCURSES_EXPORT(chtype) menu_grey (const MENU *); -- --extern NCURSES_EXPORT(int) free_item (ITEM *); --extern NCURSES_EXPORT(int) free_menu (MENU *); --extern NCURSES_EXPORT(int) item_count (const MENU *); --extern NCURSES_EXPORT(int) item_index (const ITEM *); --extern NCURSES_EXPORT(int) item_opts_off (ITEM *,Item_Options); --extern NCURSES_EXPORT(int) item_opts_on (ITEM *,Item_Options); --extern NCURSES_EXPORT(int) menu_driver (MENU *,int); --extern NCURSES_EXPORT(int) menu_opts_off (MENU *,Menu_Options); --extern NCURSES_EXPORT(int) menu_opts_on (MENU *,Menu_Options); --extern NCURSES_EXPORT(int) menu_pad (const MENU *); --extern NCURSES_EXPORT(int) pos_menu_cursor (const MENU *); --extern NCURSES_EXPORT(int) post_menu (MENU *); --extern NCURSES_EXPORT(int) scale_menu (const MENU *,int *,int *); --extern NCURSES_EXPORT(int) set_current_item (MENU *menu,ITEM *item); --extern NCURSES_EXPORT(int) set_item_init (MENU *, Menu_Hook); --extern NCURSES_EXPORT(int) set_item_opts (ITEM *,Item_Options); --extern NCURSES_EXPORT(int) set_item_term (MENU *, Menu_Hook); --extern NCURSES_EXPORT(int) set_item_userptr (ITEM *, void *); --extern NCURSES_EXPORT(int) set_item_value (ITEM *,bool); --extern NCURSES_EXPORT(int) set_menu_back (MENU *,chtype); --extern NCURSES_EXPORT(int) set_menu_fore (MENU *,chtype); --extern NCURSES_EXPORT(int) set_menu_format (MENU *,int,int); --extern NCURSES_EXPORT(int) set_menu_grey (MENU *,chtype); --extern NCURSES_EXPORT(int) set_menu_init (MENU *, Menu_Hook); --extern NCURSES_EXPORT(int) set_menu_items (MENU *,ITEM **); --extern NCURSES_EXPORT(int) set_menu_mark (MENU *, const char *); --extern NCURSES_EXPORT(int) set_menu_opts (MENU *,Menu_Options); --extern NCURSES_EXPORT(int) set_menu_pad (MENU *,int); --extern NCURSES_EXPORT(int) set_menu_pattern (MENU *,const char *); --extern NCURSES_EXPORT(int) set_menu_sub (MENU *,WINDOW *); --extern NCURSES_EXPORT(int) set_menu_term (MENU *, Menu_Hook); --extern NCURSES_EXPORT(int) set_menu_userptr (MENU *,void *); --extern NCURSES_EXPORT(int) set_menu_win (MENU *,WINDOW *); --extern NCURSES_EXPORT(int) set_top_row (MENU *,int); --extern NCURSES_EXPORT(int) top_row (const MENU *); --extern NCURSES_EXPORT(int) unpost_menu (MENU *); --extern NCURSES_EXPORT(int) menu_request_by_name (const char *); --extern NCURSES_EXPORT(int) set_menu_spacing (MENU *,int,int,int); --extern NCURSES_EXPORT(int) menu_spacing (const MENU *,int *,int *,int *); -- -- --extern NCURSES_EXPORT(bool) item_value (const ITEM *); --extern NCURSES_EXPORT(bool) item_visible (const ITEM *); -- --extern NCURSES_EXPORT(void) menu_format (const MENU *,int *,int *); -+extern MENU_EXPORT(ITEM **) menu_items (const MENU *); -+extern MENU_EXPORT(ITEM *) current_item (const MENU *); -+extern MENU_EXPORT(ITEM *) new_item (const char *,const char *); -+ -+extern MENU_EXPORT(MENU *) new_menu (ITEM **); -+ -+extern MENU_EXPORT(Item_Options) item_opts (const ITEM *); -+extern MENU_EXPORT(Menu_Options) menu_opts (const MENU *); -+ -+extern MENU_EXPORT(Menu_Hook) item_init (const MENU *); -+extern MENU_EXPORT(Menu_Hook) item_term (const MENU *); -+extern MENU_EXPORT(Menu_Hook) menu_init (const MENU *); -+extern MENU_EXPORT(Menu_Hook) menu_term (const MENU *); -+ -+extern MENU_EXPORT(WINDOW *) menu_sub (const MENU *); -+extern MENU_EXPORT(WINDOW *) menu_win (const MENU *); -+ -+extern MENU_EXPORT(const char *) item_description (const ITEM *); -+extern MENU_EXPORT(const char *) item_name (const ITEM *); -+extern MENU_EXPORT(const char *) menu_mark (const MENU *); -+extern MENU_EXPORT(const char *) menu_request_name (int); -+ -+extern MENU_EXPORT(char *) menu_pattern (const MENU *); -+ -+extern MENU_EXPORT(void *) menu_userptr (const MENU *); -+extern MENU_EXPORT(void *) item_userptr (const ITEM *); -+ -+extern MENU_EXPORT(chtype) menu_back (const MENU *); -+extern MENU_EXPORT(chtype) menu_fore (const MENU *); -+extern MENU_EXPORT(chtype) menu_grey (const MENU *); -+ -+extern MENU_EXPORT(int) free_item (ITEM *); -+extern MENU_EXPORT(int) free_menu (MENU *); -+extern MENU_EXPORT(int) item_count (const MENU *); -+extern MENU_EXPORT(int) item_index (const ITEM *); -+extern MENU_EXPORT(int) item_opts_off (ITEM *,Item_Options); -+extern MENU_EXPORT(int) item_opts_on (ITEM *,Item_Options); -+extern MENU_EXPORT(int) menu_driver (MENU *,int); -+extern MENU_EXPORT(int) menu_opts_off (MENU *,Menu_Options); -+extern MENU_EXPORT(int) menu_opts_on (MENU *,Menu_Options); -+extern MENU_EXPORT(int) menu_pad (const MENU *); -+extern MENU_EXPORT(int) pos_menu_cursor (const MENU *); -+extern MENU_EXPORT(int) post_menu (MENU *); -+extern MENU_EXPORT(int) scale_menu (const MENU *,int *,int *); -+extern MENU_EXPORT(int) set_current_item (MENU *menu,ITEM *item); -+extern MENU_EXPORT(int) set_item_init (MENU *, Menu_Hook); -+extern MENU_EXPORT(int) set_item_opts (ITEM *,Item_Options); -+extern MENU_EXPORT(int) set_item_term (MENU *, Menu_Hook); -+extern MENU_EXPORT(int) set_item_userptr (ITEM *, void *); -+extern MENU_EXPORT(int) set_item_value (ITEM *,bool); -+extern MENU_EXPORT(int) set_menu_back (MENU *,chtype); -+extern MENU_EXPORT(int) set_menu_fore (MENU *,chtype); -+extern MENU_EXPORT(int) set_menu_format (MENU *,int,int); -+extern MENU_EXPORT(int) set_menu_grey (MENU *,chtype); -+extern MENU_EXPORT(int) set_menu_init (MENU *, Menu_Hook); -+extern MENU_EXPORT(int) set_menu_items (MENU *,ITEM **); -+extern MENU_EXPORT(int) set_menu_mark (MENU *, const char *); -+extern MENU_EXPORT(int) set_menu_opts (MENU *,Menu_Options); -+extern MENU_EXPORT(int) set_menu_pad (MENU *,int); -+extern MENU_EXPORT(int) set_menu_pattern (MENU *,const char *); -+extern MENU_EXPORT(int) set_menu_sub (MENU *,WINDOW *); -+extern MENU_EXPORT(int) set_menu_term (MENU *, Menu_Hook); -+extern MENU_EXPORT(int) set_menu_userptr (MENU *,void *); -+extern MENU_EXPORT(int) set_menu_win (MENU *,WINDOW *); -+extern MENU_EXPORT(int) set_top_row (MENU *,int); -+extern MENU_EXPORT(int) top_row (const MENU *); -+extern MENU_EXPORT(int) unpost_menu (MENU *); -+extern MENU_EXPORT(int) menu_request_by_name (const char *); -+extern MENU_EXPORT(int) set_menu_spacing (MENU *,int,int,int); -+extern MENU_EXPORT(int) menu_spacing (const MENU *,int *,int *,int *); -+ -+ -+extern MENU_EXPORT(bool) item_value (const ITEM *); -+extern MENU_EXPORT(bool) item_visible (const ITEM *); -+ -+extern MENU_EXPORT(void) menu_format (const MENU *,int *,int *); - - #if NCURSES_SP_FUNCS --extern NCURSES_EXPORT(MENU *) NCURSES_SP_NAME(new_menu) (SCREEN*, ITEM **); -+extern MENU_EXPORT(MENU *) NCURSES_SP_NAME(new_menu) (SCREEN*, ITEM **); - #endif - - #ifdef __cplusplus -diff --git a/menu/menu.priv.h b/menu/menu.priv.h -index d084565a..eb653ba4 100644 ---- a/menu/menu.priv.h -+++ b/menu/menu.priv.h -@@ -52,8 +52,8 @@ - /* Backspace code */ - #define BS (8) - --extern NCURSES_EXPORT_VAR(ITEM) _nc_Default_Item; --extern NCURSES_EXPORT_VAR(MENU) _nc_Default_Menu; -+extern MENU_EXPORT_VAR(ITEM) _nc_Default_Item; -+extern MENU_EXPORT_VAR(MENU) _nc_Default_Menu; - - /* Normalize item to default if none was given */ - #define Normalize_Item( item ) ((item)=(item)?(item):&_nc_Default_Item) -@@ -120,17 +120,17 @@ extern NCURSES_EXPORT_VAR(MENU) _nc_Default_Menu; - #define UChar(c) ((unsigned char)(c)) - - /* Internal functions. */ --extern NCURSES_EXPORT(void) _nc_Draw_Menu (const MENU *); --extern NCURSES_EXPORT(void) _nc_Show_Menu (const MENU *); --extern NCURSES_EXPORT(void) _nc_Calculate_Item_Length_and_Width (MENU *); --extern NCURSES_EXPORT(int) _nc_Calculate_Text_Width(const TEXT *); --extern NCURSES_EXPORT(void) _nc_Post_Item (const MENU *, const ITEM *); --extern NCURSES_EXPORT(bool) _nc_Connect_Items (MENU *, ITEM **); --extern NCURSES_EXPORT(void) _nc_Disconnect_Items (MENU *); --extern NCURSES_EXPORT(void) _nc_New_TopRow_and_CurrentItem (MENU *,int, ITEM *); --extern NCURSES_EXPORT(void) _nc_Link_Items (MENU *); --extern NCURSES_EXPORT(int) _nc_Match_Next_Character_In_Item_Name (MENU*,int,ITEM**); --extern NCURSES_EXPORT(int) _nc_menu_cursor_pos (const MENU* menu, const ITEM* item, -+extern MENU_EXPORT(void) _nc_Draw_Menu (const MENU *); -+extern MENU_EXPORT(void) _nc_Show_Menu (const MENU *); -+extern MENU_EXPORT(void) _nc_Calculate_Item_Length_and_Width (MENU *); -+extern MENU_EXPORT(int) _nc_Calculate_Text_Width(const TEXT *); -+extern MENU_EXPORT(void) _nc_Post_Item (const MENU *, const ITEM *); -+extern MENU_EXPORT(bool) _nc_Connect_Items (MENU *, ITEM **); -+extern MENU_EXPORT(void) _nc_Disconnect_Items (MENU *); -+extern MENU_EXPORT(void) _nc_New_TopRow_and_CurrentItem (MENU *,int, ITEM *); -+extern MENU_EXPORT(void) _nc_Link_Items (MENU *); -+extern MENU_EXPORT(int) _nc_Match_Next_Character_In_Item_Name (MENU*,int,ITEM**); -+extern MENU_EXPORT(int) _nc_menu_cursor_pos (const MENU* menu, const ITEM* item, - int* pY, int* pX); - - #ifdef TRACE -@@ -142,12 +142,12 @@ extern NCURSES_EXPORT(int) _nc_menu_cursor_pos (const MENU* menu, const ITEM* i - #define returnMenuHook(code) TRACE_RETURN1(code,menu_hook) - #define returnMenuOpts(code) TRACE_RETURN1(code,menu_opts) - --extern NCURSES_EXPORT(ITEM *) _nc_retrace_item (ITEM *); --extern NCURSES_EXPORT(ITEM **) _nc_retrace_item_ptr (ITEM **); --extern NCURSES_EXPORT(Item_Options) _nc_retrace_item_opts (Item_Options); --extern NCURSES_EXPORT(MENU *) _nc_retrace_menu (MENU *); --extern NCURSES_EXPORT(Menu_Hook) _nc_retrace_menu_hook (Menu_Hook); --extern NCURSES_EXPORT(Menu_Options) _nc_retrace_menu_opts (Menu_Options); -+extern MENU_EXPORT(ITEM *) _nc_retrace_item (ITEM *); -+extern MENU_EXPORT(ITEM **) _nc_retrace_item_ptr (ITEM **); -+extern MENU_EXPORT(Item_Options) _nc_retrace_item_opts (Item_Options); -+extern MENU_EXPORT(MENU *) _nc_retrace_menu (MENU *); -+extern MENU_EXPORT(Menu_Hook) _nc_retrace_menu_hook (Menu_Hook); -+extern MENU_EXPORT(Menu_Options) _nc_retrace_menu_opts (Menu_Options); - - #else /* !TRACE */ - -diff --git a/panel/p_above.c b/panel/p_above.c -index 12b5b87b..704863a7 100644 ---- a/panel/p_above.c -+++ b/panel/p_above.c -@@ -40,7 +40,7 @@ - MODULE_ID("$Id: p_above.c,v 1.10 2020/02/02 23:34:34 tom Exp $") - - #if NCURSES_SP_FUNCS --NCURSES_EXPORT(PANEL *) -+PANEL_EXPORT(PANEL *) - ground_panel(SCREEN * sp) - { - T((T_CALLED("ground_panel(%p)"), (void *)sp)); -@@ -63,7 +63,7 @@ ground_panel(SCREEN * sp) - } - #endif - --NCURSES_EXPORT(PANEL *) -+PANEL_EXPORT(PANEL *) - panel_above(const PANEL * pan) - { - PANEL *result; -diff --git a/panel/p_below.c b/panel/p_below.c -index a8b1ef47..972ec836 100644 ---- a/panel/p_below.c -+++ b/panel/p_below.c -@@ -40,7 +40,7 @@ - MODULE_ID("$Id: p_below.c,v 1.10 2020/02/02 23:34:34 tom Exp $") - - #if NCURSES_SP_FUNCS --NCURSES_EXPORT(PANEL *) -+PANEL_EXPORT(PANEL *) - ceiling_panel(SCREEN * sp) - { - T((T_CALLED("ceiling_panel(%p)"), (void *)sp)); -@@ -61,7 +61,7 @@ ceiling_panel(SCREEN * sp) - } - #endif - --NCURSES_EXPORT(PANEL *) -+PANEL_EXPORT(PANEL *) - panel_below(const PANEL * pan) - { - PANEL *result; -diff --git a/panel/p_bottom.c b/panel/p_bottom.c -index a69ac9f4..c4a170ad 100644 ---- a/panel/p_bottom.c -+++ b/panel/p_bottom.c -@@ -40,7 +40,7 @@ - - MODULE_ID("$Id: p_bottom.c,v 1.14 2020/02/02 23:34:34 tom Exp $") - --NCURSES_EXPORT(int) -+PANEL_EXPORT(int) - bottom_panel(PANEL * pan) - { - int err = OK; -diff --git a/panel/p_delete.c b/panel/p_delete.c -index 6b122a6c..e58875b1 100644 ---- a/panel/p_delete.c -+++ b/panel/p_delete.c -@@ -40,7 +40,7 @@ - - MODULE_ID("$Id: p_delete.c,v 1.11 2020/02/02 23:34:34 tom Exp $") - --NCURSES_EXPORT(int) -+PANEL_EXPORT(int) - del_panel(PANEL * pan) - { - int err = OK; -diff --git a/panel/p_hidden.c b/panel/p_hidden.c -index ddb23b13..a43ea481 100644 ---- a/panel/p_hidden.c -+++ b/panel/p_hidden.c -@@ -40,7 +40,7 @@ - - MODULE_ID("$Id: p_hidden.c,v 1.10 2020/02/02 23:34:34 tom Exp $") - --NCURSES_EXPORT(int) -+PANEL_EXPORT(int) - panel_hidden(const PANEL * pan) - { - int rc = ERR; -diff --git a/panel/p_hide.c b/panel/p_hide.c -index fc26f752..35e738e3 100644 ---- a/panel/p_hide.c -+++ b/panel/p_hide.c -@@ -39,7 +39,7 @@ - - MODULE_ID("$Id: p_hide.c,v 1.12 2020/02/02 23:34:34 tom Exp $") - --NCURSES_EXPORT(int) -+PANEL_EXPORT(int) - hide_panel(register PANEL * pan) - { - int err = ERR; -diff --git a/panel/p_move.c b/panel/p_move.c -index 02830bf5..77127be7 100644 ---- a/panel/p_move.c -+++ b/panel/p_move.c -@@ -40,7 +40,7 @@ - - MODULE_ID("$Id: p_move.c,v 1.12 2020/02/02 23:34:34 tom Exp $") - --NCURSES_EXPORT(int) -+PANEL_EXPORT(int) - move_panel(PANEL * pan, int starty, int startx) - { - int rc = ERR; -diff --git a/panel/p_new.c b/panel/p_new.c -index d2f8d036..659bdeb9 100644 ---- a/panel/p_new.c -+++ b/panel/p_new.c -@@ -89,7 +89,7 @@ root_panel(NCURSES_SP_DCL0) - return _nc_stdscr_pseudo_panel; - } - --NCURSES_EXPORT(PANEL *) -+PANEL_EXPORT(PANEL *) - new_panel(WINDOW *win) - { - PANEL *pan = (PANEL *) 0; -diff --git a/panel/p_replace.c b/panel/p_replace.c -index 5acbccf8..362a2ef8 100644 ---- a/panel/p_replace.c -+++ b/panel/p_replace.c -@@ -39,7 +39,7 @@ - - MODULE_ID("$Id: p_replace.c,v 1.12 2020/02/02 23:34:34 tom Exp $") - --NCURSES_EXPORT(int) -+PANEL_EXPORT(int) - replace_panel(PANEL * pan, WINDOW *win) - { - int rc = ERR; -diff --git a/panel/p_show.c b/panel/p_show.c -index 933bf5aa..bfee2cb8 100644 ---- a/panel/p_show.c -+++ b/panel/p_show.c -@@ -39,7 +39,7 @@ - - MODULE_ID("$Id: p_show.c,v 1.14 2020/02/02 23:34:34 tom Exp $") - --NCURSES_EXPORT(int) -+PANEL_EXPORT(int) - show_panel(PANEL * pan) - { - int err = ERR; -diff --git a/panel/p_top.c b/panel/p_top.c -index 09e89fcc..438086c1 100644 ---- a/panel/p_top.c -+++ b/panel/p_top.c -@@ -39,7 +39,7 @@ - - MODULE_ID("$Id: p_top.c,v 1.7 2020/02/02 23:34:34 tom Exp $") - --NCURSES_EXPORT(int) -+PANEL_EXPORT(int) - top_panel(PANEL * pan) - { - T((T_CALLED("top_panel(%p)"), (void *)pan)); -diff --git a/panel/p_update.c b/panel/p_update.c -index 3fe4770b..ca856795 100644 ---- a/panel/p_update.c -+++ b/panel/p_update.c -@@ -40,7 +40,7 @@ - - MODULE_ID("$Id: p_update.c,v 1.12 2020/02/02 23:34:34 tom Exp $") - --NCURSES_EXPORT(void) -+PANEL_EXPORT(void) - NCURSES_SP_NAME(update_panels) (NCURSES_SP_DCL0) - { - PANEL *pan; -@@ -71,7 +71,7 @@ NCURSES_SP_NAME(update_panels) (NCURSES_SP_DCL0) - } - - #if NCURSES_SP_FUNCS --NCURSES_EXPORT(void) -+PANEL_EXPORT(void) - update_panels(void) - { - NCURSES_SP_NAME(update_panels) (CURRENT_SCREEN); -diff --git a/panel/p_user.c b/panel/p_user.c -index 633431ea..e6122d33 100644 ---- a/panel/p_user.c -+++ b/panel/p_user.c -@@ -39,7 +39,7 @@ - - MODULE_ID("$Id: p_user.c,v 1.9 2020/02/02 23:34:34 tom Exp $") - --NCURSES_EXPORT(int) -+PANEL_EXPORT(int) - set_panel_userptr(PANEL * pan, NCURSES_CONST void *uptr) - { - T((T_CALLED("set_panel_userptr(%p,%p)"), (void *)pan, (NCURSES_CONST void *)uptr)); -@@ -49,7 +49,7 @@ set_panel_userptr(PANEL * pan, NCURSES_CONST void *uptr) - returnCode(OK); - } - --NCURSES_EXPORT(NCURSES_CONST void *) -+PANEL_EXPORT(NCURSES_CONST void *) - panel_userptr(const PANEL * pan) - { - T((T_CALLED("panel_userptr(%p)"), (const void *)pan)); -diff --git a/panel/p_win.c b/panel/p_win.c -index 023a71c9..0bc838f5 100644 ---- a/panel/p_win.c -+++ b/panel/p_win.c -@@ -39,7 +39,7 @@ - - MODULE_ID("$Id: p_win.c,v 1.7 2020/02/02 23:34:34 tom Exp $") - --NCURSES_EXPORT(WINDOW *) -+PANEL_EXPORT(WINDOW *) - panel_window(const PANEL * pan) - { - T((T_CALLED("panel_window(%p)"), (const void *)pan)); -diff --git a/panel/panel.c b/panel/panel.c -index a0e632d2..5d66476e 100644 ---- a/panel/panel.c -+++ b/panel/panel.c -@@ -43,7 +43,7 @@ MODULE_ID("$Id: panel.c,v 1.27 2020/02/02 23:34:34 tom Exp $") - _nc_retrace_panel (pan) - --------------------------------------------------------------------------*/ - #ifdef TRACE --NCURSES_EXPORT(PANEL *) -+PANEL_EXPORT(PANEL *) - _nc_retrace_panel(PANEL * pan) - { - T((T_RETURN("%p"), (void *)pan)); -@@ -56,7 +56,7 @@ _nc_retrace_panel(PANEL * pan) - --------------------------------------------------------------------------*/ - #ifdef TRACE - #ifndef TRACE_TXT --NCURSES_EXPORT(const char *) -+PANEL_EXPORT(const char *) - _nc_my_visbuf(const void *ptr) - { - char temp[32]; -@@ -74,7 +74,7 @@ _nc_my_visbuf(const void *ptr) - dPanel(text,pan) - --------------------------------------------------------------------------*/ - #ifdef TRACE --NCURSES_EXPORT(void) -+PANEL_EXPORT(void) - _nc_dPanel(const char *text, const PANEL * pan) - { - _tracef("%s id=%s b=%s a=%s y=%d x=%d", -@@ -89,7 +89,7 @@ _nc_dPanel(const char *text, const PANEL * pan) - dStack(fmt,num,pan) - --------------------------------------------------------------------------*/ - #ifdef TRACE --NCURSES_EXPORT(void) -+PANEL_EXPORT(void) - _nc_dStack(const char *fmt, int num, const PANEL * pan) - { - char s80[80]; -@@ -115,7 +115,7 @@ _nc_dStack(const char *fmt, int num, const PANEL * pan) - Wnoutrefresh(pan) - debugging hook for wnoutrefresh - --------------------------------------------------------------------------*/ - #ifdef TRACE --NCURSES_EXPORT(void) -+PANEL_EXPORT(void) - _nc_Wnoutrefresh(const PANEL * pan) - { - dPanel("wnoutrefresh", pan); -@@ -127,7 +127,7 @@ _nc_Wnoutrefresh(const PANEL * pan) - Touchpan(pan) - --------------------------------------------------------------------------*/ - #ifdef TRACE --NCURSES_EXPORT(void) -+PANEL_EXPORT(void) - _nc_Touchpan(const PANEL * pan) - { - dPanel("Touchpan", pan); -@@ -139,7 +139,7 @@ _nc_Touchpan(const PANEL * pan) - Touchline(pan,start,count) - --------------------------------------------------------------------------*/ - #ifdef TRACE --NCURSES_EXPORT(void) -+PANEL_EXPORT(void) - _nc_Touchline(const PANEL * pan, int start, int count) - { - char s80[80]; -diff --git a/panel/panel.h b/panel/panel.h -index 2eebe178..042cf5d4 100644 ---- a/panel/panel.h -+++ b/panel/panel.h -@@ -57,27 +57,40 @@ PANEL; - extern "C" { - #endif - --extern NCURSES_EXPORT(WINDOW*) panel_window (const PANEL *); --extern NCURSES_EXPORT(void) update_panels (void); --extern NCURSES_EXPORT(int) hide_panel (PANEL *); --extern NCURSES_EXPORT(int) show_panel (PANEL *); --extern NCURSES_EXPORT(int) del_panel (PANEL *); --extern NCURSES_EXPORT(int) top_panel (PANEL *); --extern NCURSES_EXPORT(int) bottom_panel (PANEL *); --extern NCURSES_EXPORT(PANEL*) new_panel (WINDOW *); --extern NCURSES_EXPORT(PANEL*) panel_above (const PANEL *); --extern NCURSES_EXPORT(PANEL*) panel_below (const PANEL *); --extern NCURSES_EXPORT(int) set_panel_userptr (PANEL *, NCURSES_CONST void *); --extern NCURSES_EXPORT(NCURSES_CONST void*) panel_userptr (const PANEL *); --extern NCURSES_EXPORT(int) move_panel (PANEL *, int, int); --extern NCURSES_EXPORT(int) replace_panel (PANEL *,WINDOW *); --extern NCURSES_EXPORT(int) panel_hidden (const PANEL *); -+#include "ncurses_exports.h" -+ -+#if defined(BUILDING_PANEL) -+# define PANEL_IMPEXP NCURSES_EXPORT_GENERAL_EXPORT -+#else -+# define PANEL_IMPEXP NCURSES_EXPORT_GENERAL_IMPORT -+#endif -+ -+#define PANEL_WRAPPED_VAR(type,name) extern PANEL_IMPEXP type NCURSES_PUBLIC_VAR(name)(void) -+ -+#define PANEL_EXPORT(type) PANEL_IMPEXP type NCURSES_API -+#define PANEL_EXPORT_VAR(type) PANEL_IMPEXP type -+ -+extern PANEL_EXPORT(WINDOW*) panel_window (const PANEL *); -+extern PANEL_EXPORT(void) update_panels (void); -+extern PANEL_EXPORT(int) hide_panel (PANEL *); -+extern PANEL_EXPORT(int) show_panel (PANEL *); -+extern PANEL_EXPORT(int) del_panel (PANEL *); -+extern PANEL_EXPORT(int) top_panel (PANEL *); -+extern PANEL_EXPORT(int) bottom_panel (PANEL *); -+extern PANEL_EXPORT(PANEL*) new_panel (WINDOW *); -+extern PANEL_EXPORT(PANEL*) panel_above (const PANEL *); -+extern PANEL_EXPORT(PANEL*) panel_below (const PANEL *); -+extern PANEL_EXPORT(int) set_panel_userptr (PANEL *, NCURSES_CONST void *); -+extern PANEL_EXPORT(NCURSES_CONST void*) panel_userptr (const PANEL *); -+extern PANEL_EXPORT(int) move_panel (PANEL *, int, int); -+extern PANEL_EXPORT(int) replace_panel (PANEL *,WINDOW *); -+extern PANEL_EXPORT(int) panel_hidden (const PANEL *); - - #if NCURSES_SP_FUNCS --extern NCURSES_EXPORT(PANEL *) ground_panel(SCREEN *); --extern NCURSES_EXPORT(PANEL *) ceiling_panel(SCREEN *); -+extern PANEL_EXPORT(PANEL *) ground_panel(SCREEN *); -+extern PANEL_EXPORT(PANEL *) ceiling_panel(SCREEN *); - --extern NCURSES_EXPORT(void) NCURSES_SP_NAME(update_panels) (SCREEN*); -+extern PANEL_EXPORT(void) NCURSES_SP_NAME(update_panels) (SCREEN*); - #endif - - #if defined(__cplusplus) -diff --git a/panel/panel.priv.h b/panel/panel.priv.h -index c8e3ea79..bf9df442 100644 ---- a/panel/panel.priv.h -+++ b/panel/panel.priv.h -@@ -50,7 +50,7 @@ struct screen; /* forward declaration */ - #include "panel.h" - - #ifdef TRACE -- extern NCURSES_EXPORT(const char *) _nc_my_visbuf (const void *); -+ extern PANEL_EXPORT(const char *) _nc_my_visbuf (const void *); - # ifdef TRACE_TXT - # define USER_PTR(ptr) _nc_visbuf((const char *)ptr) - # else -@@ -59,12 +59,12 @@ struct screen; /* forward declaration */ - - # define returnPanel(code) TRACE_RETURN1(code,panel) - -- extern NCURSES_EXPORT(PANEL *) _nc_retrace_panel (PANEL *); -- extern NCURSES_EXPORT(void) _nc_dPanel (const char*, const PANEL*); -- extern NCURSES_EXPORT(void) _nc_dStack (const char*, int, const PANEL*); -- extern NCURSES_EXPORT(void) _nc_Wnoutrefresh (const PANEL*); -- extern NCURSES_EXPORT(void) _nc_Touchpan (const PANEL*); -- extern NCURSES_EXPORT(void) _nc_Touchline (const PANEL*, int, int); -+ extern PANEL_EXPORT(PANEL *) _nc_retrace_panel (PANEL *); -+ extern PANEL_EXPORT(void) _nc_dPanel (const char*, const PANEL*); -+ extern PANEL_EXPORT(void) _nc_dStack (const char*, int, const PANEL*); -+ extern PANEL_EXPORT(void) _nc_Wnoutrefresh (const PANEL*); -+ extern PANEL_EXPORT(void) _nc_Touchpan (const PANEL*); -+ extern PANEL_EXPORT(void) _nc_Touchline (const PANEL*, int, int); - - # define dBug(x) _tracef x - # define dPanel(text,pan) _nc_dPanel(text,pan) -@@ -205,7 +205,7 @@ struct screen; /* forward declaration */ - - #if NCURSES_SP_FUNCS - /* These may become later renamed and part of panel.h and the public API */ --extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_update_panels)(SCREEN*); -+extern PANEL_EXPORT(void) NCURSES_SP_NAME(_nc_update_panels)(SCREEN*); - #endif - /* *INDENT-ON* */ - --- -2.21.1 - diff --git a/recipes/ncurses/all/patches/6.2.0-0012-Learn-configure-about-msvc.patch b/recipes/ncurses/all/patches/6.2.0-0012-Learn-configure-about-msvc.patch deleted file mode 100644 index 1a723cab0cac4..0000000000000 --- a/recipes/ncurses/all/patches/6.2.0-0012-Learn-configure-about-msvc.patch +++ /dev/null @@ -1,423 +0,0 @@ -Upstreamed in 18f51bcf99101e5bf4c737239c44064227f34db8 - -ncurses 6.2 - patch 20200229 - -Upstreamed in 3e37c7d3fa122563a9d88168926f61286ef30cd3 - -ncurses 6.2 - patch 20200523 - -Upstreamed in d61c3c6a831d18ef0ed6f797ac97d60fffc2f158 - -ncurses 6.2 - patch 20200711 - -From 4a4d205735df2634a328c03629435f440cb5dd3c Mon Sep 17 00:00:00 2001 -From: Anonymous Maarten -Date: Tue, 17 Mar 2020 15:38:08 +0100 -Subject: [PATCH 12/15] Learn configure about msvc - ---- - aclocal.m4 | 145 +++++++++++++++++++++++++++++++++++++++++------------ - mk-1st.awk | 25 +++++---- - 2 files changed, 128 insertions(+), 42 deletions(-) - -diff --git a/aclocal.m4 b/aclocal.m4 -index 55c65d1a..3a44d63b 100644 ---- a/aclocal.m4 -+++ b/aclocal.m4 -@@ -453,39 +453,55 @@ AC_DEFUN([CF_AR_FLAGS],[ - AC_REQUIRE([CF_PROG_AR]) - - AC_CACHE_CHECK(for options to update archives, cf_cv_ar_flags,[ -- cf_cv_ar_flags=unknown -- for cf_ar_flags in -curvU -curv curv -crv crv -cqv cqv -rv rv -- do -+ case $cf_cv_system_name in -+ (*-msvc*) -+ cf_cv_ar_flags='' -+ cat >mk_static_lib.sh <<-EOF -+ #!$SHELL -+ MSVC_BIN="[$]AR" -+ out="\[$]1" -+ shift -+ exec \[$]MSVC_BIN -out:"\[$]out" \[$]@ -+ EOF -+ chmod +x mk_static_lib.sh -+ AR=`pwd`/mk_static_lib.sh -+ ;; -+ (*) -+ cf_cv_ar_flags=unknown -+ for cf_ar_flags in -curvU -curv curv -crv crv -cqv cqv -rv rv -+ do - -- # check if $ARFLAGS already contains this choice -- if test "x$ARFLAGS" != "x" ; then -- cf_check_ar_flags=`echo "x$ARFLAGS" | sed -e "s/$cf_ar_flags\$//" -e "s/$cf_ar_flags / /"` -- if test "x$ARFLAGS" != "$cf_check_ar_flags" ; then -- cf_cv_ar_flags= -- break -+ # check if $ARFLAGS already contains this choice -+ if test "x$ARFLAGS" != "x" ; then -+ cf_check_ar_flags=`echo "x$ARFLAGS" | sed -e "s/$cf_ar_flags\$//" -e "s/$cf_ar_flags / /"` -+ if test "x$ARFLAGS" != "$cf_check_ar_flags" ; then -+ cf_cv_ar_flags= -+ break -+ fi - fi -- fi -- -- rm -f conftest.$ac_cv_objext -- rm -f conftest.a - -- cat >conftest.$ac_ext <&AC_FD_CC -- $AR $ARFLAGS $cf_ar_flags conftest.a conftest.$ac_cv_objext 2>&AC_FD_CC 1>/dev/null -- if test -f conftest.a ; then -- cf_cv_ar_flags=$cf_ar_flags -+ rm -f conftest.$ac_cv_objext -+ rm -f conftest.a -+ -+ cat >conftest.$ac_ext <<-EOF -+ #line __oline__ "configure" -+ int testdata[[3]] = { 123, 456, 789 }; -+ EOF -+ if AC_TRY_EVAL(ac_compile) ; then -+ echo "$AR $ARFLAGS $cf_ar_flags conftest.a conftest.$ac_cv_objext" >&AC_FD_CC -+ $AR $ARFLAGS $cf_ar_flags conftest.a conftest.$ac_cv_objext 2>&AC_FD_CC 1>/dev/null -+ if test -f conftest.a ; then -+ cf_cv_ar_flags=$cf_ar_flags -+ break -+ fi -+ else -+ CF_VERBOSE(cannot compile test-program) - break - fi -- else -- CF_VERBOSE(cannot compile test-program) -- break -- fi -- done -- rm -f conftest.a conftest.$ac_ext conftest.$ac_cv_objext -+ done -+ rm -f conftest.a conftest.$ac_ext conftest.$ac_cv_objext -+ ;; -+ esac - ]) - - if test -n "$ARFLAGS" ; then -@@ -4008,6 +4024,9 @@ define([CF_LIB_PREFIX], - LIB_PREFIX='' - fi - ;; -+ (*-msvc*) -+ LIB_PREFIX='' -+ ;; - (*) LIB_PREFIX='lib' - ;; - esac -@@ -4036,7 +4055,7 @@ cf_prefix=$LIB_PREFIX - AC_REQUIRE([CF_SUBST_NCURSES_VERSION]) - - case $cf_cv_shlib_version in --(cygdll|msysdll|mingw) -+(cygdll|msysdll|mingw|msvcdll) - TINFO_NAME=$TINFO_ARG_SUFFIX - TINFO_SUFFIX=.dll - ;; -@@ -4159,6 +4178,10 @@ CF_EOF - cf_cygsuf=`echo "$cf_suffix" | sed -e 's/\.dll/\${ABI_VERSION}.dll/'` - cf_add_lib="../lib/lib${cf_libname}${cf_cygsuf}" - ;; -+ (msvcdll) -+ cf_cygsuf=`echo "$cf_suffix" | sed -e 's/\.dll/\${ABI_VERSION}.dll/'` -+ cf_add_lib="../lib/${cf_libname}${cf_cygsuf}" -+ ;; - (*) - cf_add_lib= - ;; -@@ -4254,7 +4277,7 @@ CF_EOF - CXX_MODEL=$cf_ITEM - if test "$CXX_MODEL" = SHARED; then - case $cf_cv_shlib_version in -- (cygdll|msysdll|mingw) -+ (cygdll|msysdll|mingw|msvcdll) - test "x$with_shared_cxx" = xno && CF_VERBOSE(overriding CXX_MODEL to SHARED) - with_shared_cxx=yes - ;; -@@ -4649,11 +4672,25 @@ AC_DEFUN([CF_LIB_SUFFIX], - $3=[$]$2 - ;; - (Xdebug) -- $2='_g.a' -+ case $cf_cv_system_name in -+ (*-msvc*) -+ $2='_g.lib' -+ ;; -+ (*) -+ $2='_g.a' -+ ;; -+ esac - $3=[$]$2 - ;; - (Xprofile) -- $2='_p.a' -+ case $cf_cv_system_name in -+ (*-msvc*) -+ $2='_p.lib' -+ ;; -+ (*) -+ $2='_p.a' -+ ;; -+ esac - $3=[$]$2 - ;; - (Xshared) -@@ -4662,6 +4699,10 @@ AC_DEFUN([CF_LIB_SUFFIX], - $2='.so' - $3=[$]$2 - ;; -+ (*-msvc*) -+ $2='.dll' -+ $3='.dll.lib' -+ ;; - (cygwin*|msys*|mingw*) - $2='.dll' - $3='.dll.a' -@@ -4689,7 +4730,14 @@ AC_DEFUN([CF_LIB_SUFFIX], - esac - ;; - (*) -- $2='.a' -+ case $target in -+ (*-msvc*) -+ $2='.lib' -+ ;; -+ (*) -+ $2='.a' -+ ;; -+ esac - $3=[$]$2 - ;; - esac -@@ -6759,6 +6807,110 @@ CF_EOF - CF_SHARED_SONAME - MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname',-stats,-lc -o $[@]' - ;; -+ (mingw*msvc*) -+ LDFLAGS="$LDFLAGS user32.lib" -+ export LDFLAGS -+ cf_cv_shlib_version=msvcdll -+ cf_cv_shlib_version_infix=msvcdll -+ shlibdir=$bindir -+ MAKE_DLLS= -+ if test "$DFT_LWR_MODEL" = "shared" ; then -+ LOCAL_LDFLAGS="-link -dll" -+ LOCAL_LDFLAGS2="$LOCAL_LDFLAGS" -+ EXTRA_LDFLAGS="-link -dll $EXTRA_LDFLAGS" -+ fi -+ CC_SHARED_OPTS= -+ MK_SHARED_LIB=$SHELL' '$rel_builddir'/mk_shared_lib.sh [$]@ ${LD} [$]{CFLAGS}' -+ RM_SHARED_OPTS="$RM_SHARED_OPTS $rel_builddir/mk_shared_lib.sh *.dll.lib" -+ cat >mk_shared_lib.sh <<-CF_EOF -+ #!$SHELL -+ SHARED_LIB=\[$]1 -+ IMPORT_LIB=\`echo "\[$]1" | sed -e 's/[[0-9]]*\.dll[$]/.dll.lib/'\` -+ shift -+ my_ld=\[$]1 -+ shift -+ cat <<-EOF -+ Linking shared library -+ ** SHARED LIB \$SHARED_LIB -+ ** IMPORT_LIB \$IMPORT_LIB -+EOF -+ args=\$(echo \[$]* | sed -E "s#-l(\w*)#\1.dll.lib#g" | sed -E "s#-L(\w*)#-LIBPATH:\1#g") -+ exec \$my_ld -DLL -IMPLIB:"\${IMPORT_LIB}" -OUT:"\${SHARED_LIB}" ${LDFLAGS} \$args -+ mv "\${IMPORT_LIB}" "\${IMPORT_LIB}" -+CF_EOF -+ chmod +x mk_shared_lib.sh -+ cat >mk_prog.sh <<-CF_EOF -+ #!$SHELL -+ shift -+ # Ignore first argument (compiler) and use LD (link.exe) unconditionally -+ LD="[$]LD" -+ clopts=() -+ ldopts=("/subsystem:console") -+ libs=() -+ isdll=0 -+ while test \[$]# -gt 0; do -+ case "\[$]1" in -+ -link | -MT | -MD | -MTd | -MDd) -+ # ignore -link argument -+ ;; -+ -dll) -+ isdll=1 -+ ;; -+ -W* | -w*) -+ # ignore warnings -+ ;; -+ -D*) -+ clopts+=("\[$]1") -+ ;; -+ -I*) -+ clopts+=("\[$]1") -+ ;; -+ -l*) -+ libs+=("\`echo \"\[$]1\" | sed \"s/^-l//\"\`") -+ ;; -+ -L*) -+ ldopts+=("\`echo \"\[$]1\" | sed \"s/^-L/-LIBPATH:/\"\`") -+ ;; -+ *.obj | *.o) -+ ldopts+=("\[$]1") -+ ;; -+ -Wl,*) -+ for linkarg in \`echo '\[$]1' | sed -e 's/-Wl,//' -e 's/,/ /'\`; do -+ ldopts+=("\[$]{linkarg}") -+ done -+ ;; -+ *.lib) -+ ldopts+=("\[$]1") -+ ;; -+ -o) -+ shift -+ ldopts+=("-out:\[$]1") -+ ;; -+ *) -+ clopts+=("\[$]1") -+ ldopts+=("\[$]1") -+ ;; -+ esac -+ shift -+ done -+ if [[ "\$isdll" -ne 0 ]]; then -+ for lib in \[$]{libs[[*]]}; do -+ ldopts+=("\[$]lib.dll.lib") -+ done -+ else -+ for lib in \[$]{libs[[*]]}; do -+ ldopts+=("\[$]lib.lib") -+ done -+ fi -+ cat <<-EOF -+ Creating program -+ ** ld options: "\[$]{ldopts[[@]]}" -+EOF -+ exec \[$]LD \[$]{ldopts[[@]]} -+CF_EOF -+ chmod +x mk_prog.sh -+ LINK_PROGS="$SHELL ${rel_builddir}/mk_prog.sh" -+ ;; - (mingw*) - cf_cv_shlib_version=mingw - cf_cv_shlib_version_infix=mingw ---- configure.in -+++ configure.in -@@ -2181,6 +2181,17 @@ fi - fi - WITH_OVERWRITE=$with_overwrite - -+### At least on MinGW a shared library build without libtool -+### requires adding the additional libs to the link list. -+case $cf_cv_system_name in -+(*mingw32*|*mingw64*) -+ if test "$DFT_LWR_MODEL" != "libtool"; then -+ SHLIB_LIST="$SHLIB_LIST ${LIBS}" -+ fi -+ ;; -+*) ;; -+esac -+ - AC_SUBST(WITH_OVERWRITE) - AC_SUBST(TICS_LIST) - AC_SUBST(TINFO_LIST) -diff --git a/mk-1st.awk b/mk-1st.awk -index 480baad6..b6b7b06d 100644 ---- a/mk-1st.awk -+++ b/mk-1st.awk -@@ -75,7 +75,9 @@ function lib_name_of(a_name) { - function imp_name_of(a_name) { - if (ShlibVerInfix == "cygdll" || ShlibVerInfix == "msysdll" || ShlibVerInfix == "mingw") { - result = sprintf("%s%s%s.a", prefix, a_name, suffix); -- } else { -+ } else if (ShlibVerInfix == "msvcdll") { -+ result = sprintf("%s%s%s.lib", prefix, a_name, suffix); -+ } else{ - result = ""; - } - return result; -@@ -86,7 +88,7 @@ function abi_name_of(a_name) { - result = sprintf("%s%s$(ABI_VERSION)%s", "cyg", a_name, suffix); - } else if (ShlibVerInfix == "msysdll") { - result = sprintf("%s%s$(ABI_VERSION)%s", "msys-", a_name, suffix); -- } else if (ShlibVerInfix == "mingw") { -+ } else if (ShlibVerInfix == "mingw" || ShlibVerInfix == "msvcdll") { - result = sprintf("%s%s$(ABI_VERSION)%s", prefix, a_name, suffix); - } else if (ShlibVerInfix == "yes") { - result = sprintf("%s%s.$(ABI_VERSION)%s", prefix, a_name, suffix); -@@ -101,7 +103,7 @@ function rel_name_of(a_name) { - result = sprintf("%s%s$(REL_VERSION)%s", "cyg", a_name, suffix); - } else if (ShlibVerInfix == "msysdll") { - result = sprintf("%s%s$(ABI_VERSION)%s", "msys-", a_name, suffix); -- } else if (ShlibVerInfix == "mingw") { -+ } else if (ShlibVerInfix == "mingw" || ShlibVerInfix == "msvcdll") { - result = sprintf("%s%s$(REL_VERSION)%s", prefix, a_name, suffix); - } else if (ShlibVerInfix == "yes") { - result = sprintf("%s%s.$(REL_VERSION)%s", prefix, a_name, suffix); -@@ -119,7 +121,7 @@ function end_name_of(a_name) { - } else { - if ( ShlibVer == "rel" ) { - result = rel_name_of(a_name); -- } else if ( ShlibVer == "abi" || ShlibVer == "cygdll" || ShlibVer == "msysdll" || ShlibVer == "mingw" ) { -+ } else if ( ShlibVer == "abi" || ShlibVer == "cygdll" || ShlibVer == "msysdll" || ShlibVer == "mingw" || ShlibVer == "msvcdll" ) { - result = abi_name_of(a_name); - } else { - result = lib_name_of(a_name); -@@ -175,7 +177,7 @@ function make_shlib(objs, shlib_list) { - printf "\t$(MK_SHARED_LIB) $(%s_OBJS) $(%s)\n", objs, shlib_list - } - function sharedlinks(directory) { -- if ( ShlibVer != "auto" && ShlibVer != "cygdll" && ShlibVer != "msysdll" && ShlibVer != "mingw" ) { -+ if ( ShlibVer != "auto" && ShlibVer != "cygdll" && ShlibVer != "msysdll" && ShlibVer != "mingw" && ShlibVer != "msvcdll" ) { - printf "\tcd %s && (", directory - if ( DoLinks == "reverse" ) { - if ( ShlibVer == "rel" ) { -@@ -375,7 +377,7 @@ END { - print "install \\" - print "install.libs \\" - -- if ( ShlibVer == "cygdll" || ShlibVer == "msysdll" || ShlibVer == "mingw") { -+ if ( ShlibVer == "cygdll" || ShlibVer == "msysdll" || ShlibVer == "mingw" || ShlibVer == "msvcdll") { - - dst_dirs = "$(DESTDIR)$(bindir) $(DESTDIR)$(libdir)"; - printf "install.%s :: %s $(LIBRARIES)\n", name, dst_dirs -@@ -396,8 +398,13 @@ END { - - if ( overwrite == "yes" && name == "ncurses" ) - { -- if ( ShlibVer == "cygdll" || ShlibVer == "msysdll" || ShlibVer == "mingw") { -- ovr_name = sprintf("libcurses%s.a", suffix) -+ if ( ShlibVer == "cygdll" || ShlibVer == "msysdll" || ShlibVer == "mingw" || SlibVer == "msvcdll") { -+ if (ShlibVer == "msvcdll") { -+ curses_prefix = "" -+ } else { -+ curses_prefix = "lib" -+ } -+ ovr_name = sprintf("%scurses%s.a", curses_prefix, suffix) - printf "\t@echo linking %s to %s\n", imp_name, ovr_name - printf "\tcd $(DESTDIR)$(libdir) && (" - symlink(imp_name, ovr_name) -@@ -417,7 +424,7 @@ END { - print "uninstall \\" - print "uninstall.libs \\" - printf "uninstall.%s ::\n", name -- if ( ShlibVer == "cygdll" || ShlibVer == "msysdll" || ShlibVer == "mingw") { -+ if ( ShlibVer == "cygdll" || ShlibVer == "msysdll" || ShlibVer == "mingw" || ShlibVer == "msvcdll") { - - printf "\t@echo uninstalling $(DESTDIR)$(bindir)/%s\n", end_name - printf "\t-@rm -f $(DESTDIR)$(bindir)/%s\n", end_name --- -2.21.1 - diff --git a/recipes/ncurses/all/patches/6.2.0-0013-Fix-lib_gen.c.patch b/recipes/ncurses/all/patches/6.2.0-0013-Fix-lib_gen.c.patch deleted file mode 100644 index 591da3292bdf0..0000000000000 --- a/recipes/ncurses/all/patches/6.2.0-0013-Fix-lib_gen.c.patch +++ /dev/null @@ -1,45 +0,0 @@ -Upstreamed in 3e37c7d3fa122563a9d88168926f61286ef30cd3 - -ncurses 6.2 - patch 20200523 - -From 2735f43727f8cef9edb406dc361a51014807788c Mon Sep 17 00:00:00 2001 -From: Anonymous Maarten -Date: Wed, 26 Feb 2020 19:24:16 +0100 -Subject: [PATCH 13/15] Fix lib_gen.c - -Fixes these kind of errors on MSVC -../ncurses/lib_gen.c(23): error C2059: syntax error: '(' - -(required for static build) - -../ncurses/lib_gen.c(30): error C2059: syntax error: '(' -../ncurses/lib_gen.c(37): error C2059: syntax error: '(' -../ncurses/lib_gen.c(44): error C2059: syntax error: '(' -../ncurses/lib_gen.c(51): error C2059: syntax error: '(' -../ncurses/lib_gen.c(58): error C2059: syntax error: '(' -../ncurses/lib_gen.c(65): error C2059: syntax error: '(' -../ncurses/lib_gen.c(72): error C2059: syntax error: '(' -../ncurses/lib_gen.c(79): error C2059: syntax error: '(' -../ncurses/lib_gen.c(86): error C2059: syntax error: '(' -(and more) - ---- - ncurses/base/MKlib_gen.sh | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/ncurses/base/MKlib_gen.sh b/ncurses/base/MKlib_gen.sh -index 5a3770e5..5e646e66 100755 ---- a/ncurses/base/MKlib_gen.sh -+++ b/ncurses/base/MKlib_gen.sh -@@ -178,7 +178,7 @@ EOF3 - - if test "$USE" = generated ; then - cat >$ED4 < -Date: Mon, 16 Mar 2020 11:01:28 +0100 -Subject: [PATCH 14/15] avoid macro expansion in args by defining - NCURSES_NOMACROS in ncurses/lib_gen.c - -Macro expansion from macros in curses.h(.in) will lead to: - -spec(dllexport) int __cdecl -waddchnstr(stdscr,(const chtype * z),-1) -{ - ; - return waddchnstr(stdscr,(z),-1); -} - -__declspec(dllexport) int __cdecl -waddnstr(stdscr,(const char * a1),(int z)) -{ - ; - return waddnstr(stdscr,(a1),(z)); -} - -__declspec(dllexport) int __cdecl -waddnstr(stdscr,(const char * z),-1) -{ - ; - return waddnstr(stdscr,(z),-1); -} - ---- - ncurses/base/MKlib_gen.sh | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/ncurses/base/MKlib_gen.sh b/ncurses/base/MKlib_gen.sh -index 5e646e66..f57cd55f 100755 ---- a/ncurses/base/MKlib_gen.sh -+++ b/ncurses/base/MKlib_gen.sh -@@ -432,7 +432,7 @@ BEGIN { - print "#define NCURSES_ATTR_T int" - print "#include " - print "" -- print "#undef NCURSES_NOMACROS /* _this_ file uses macros */" -+ print "#define NCURSES_NOMACROS 1" - print "" - print "#include " - print "" --- -2.21.1 - diff --git a/recipes/ncurses/all/patches/6.2.0-0015-MSVC-access-does-not-support-X_OK.patch b/recipes/ncurses/all/patches/6.2.0-0015-MSVC-access-does-not-support-X_OK.patch deleted file mode 100644 index 76f47d3a9f588..0000000000000 --- a/recipes/ncurses/all/patches/6.2.0-0015-MSVC-access-does-not-support-X_OK.patch +++ /dev/null @@ -1,34 +0,0 @@ ---- ncurses/tinfo/access.c -+++ ncurses/tinfo/access.c -@@ -41,6 +41,13 @@ - - #define LOWERCASE(c) ((isalpha(UChar(c)) && isupper(UChar(c))) ? tolower(UChar(c)) : (c)) - -+#ifdef _MSC_VER -+# define ACCESS(FN, MODE) access((FN), (MODE)&(R_OK|W_OK)) -+#else -+# define ACCESS access -+#endif -+ -+ - NCURSES_EXPORT(char *) - _nc_rootname(char *path) - { -@@ -112,7 +119,7 @@ - - if (path == 0) { - result = -1; -- } else if (access(path, mode) < 0) { -+ } else if (ACCESS(path, mode) < 0) { - if ((mode & W_OK) != 0 - && errno == ENOENT - && strlen(path) < PATH_MAX) { -@@ -127,7 +134,7 @@ _nc_access(const char *path, int mode) - if (head == leaf) - _nc_STRCPY(head, ".", sizeof(head)); - -- result = access(head, R_OK | W_OK | X_OK); -+ result = ACCESS(head, R_OK | W_OK | X_OK); - } else { - result = -1; - } diff --git a/recipes/ncurses/all/patches/6.2.0-0016-msvc-has-wchar-support.patch b/recipes/ncurses/all/patches/6.2.0-0016-msvc-has-wchar-support.patch deleted file mode 100644 index 919d4eb50dbff..0000000000000 --- a/recipes/ncurses/all/patches/6.2.0-0016-msvc-has-wchar-support.patch +++ /dev/null @@ -1,34 +0,0 @@ -d61c3c6a ("ncurses 6.2 - patch 20200711", 2020-07-12) - ---- a/ncurses/curses.priv.h -+++ b/ncurses/curses.priv.h -@@ -2343,7 +2343,7 @@ extern NCURSES_EXPORT(int) _nc_eventlist_timeout(_nc_eventlist *); - */ - #if USE_WIDEC_SUPPORT - --#if defined(_WIN32) -+#if defined(_WIN32) && !defined(_MSC_VER) - /* - * MinGW has wide-character functions, but they do not work correctly. - */ ---- a/ncurses/widechar/lib_cchar.c -+++ b/ncurses/widechar/lib_cchar.c -@@ -35,6 +35,7 @@ - */ - - #include -+#include - - MODULE_ID("$Id: lib_cchar.c,v 1.33 2020/02/02 23:34:34 tom Exp $") - ---- a/ncurses/widechar/widechars.c -+++ b/ncurses/widechar/widechars.c -@@ -33,7 +33,7 @@ - - MODULE_ID("$Id: widechars.c,v 1.7 2020/02/02 23:34:34 tom Exp $") - --#if defined(_WIN32) -+#if defined(_WIN32) && !defined(_MSC_VER) - /* - * MinGW has wide-character functions, but they do not work correctly. - */ diff --git a/recipes/ncurses/all/patches/6.2.0-0017-msvc-fix-tests.patch b/recipes/ncurses/all/patches/6.2.0-0017-msvc-fix-tests.patch deleted file mode 100644 index f5276b3ee5fda..0000000000000 --- a/recipes/ncurses/all/patches/6.2.0-0017-msvc-fix-tests.patch +++ /dev/null @@ -1,50 +0,0 @@ -d61c3c6a ("ncurses 6.2 - patch 20200711", 2020-07-12) - ---- test/picsmap.c -+++ test/picsmap.c -@@ -955,6 +955,20 @@ parse_rgb(char **data) - return result; - } - -+#define LOWERCASE(c) ((isalpha(UChar(c)) && isupper(UChar(c))) ? tolower(UChar(c)) : (c)) -+ -+static int -+CaselessCmp(const char *a, const char *b) -+{ /* strcasecmp isn't portable */ -+ while (*a && *b) { -+ int cmp = LOWERCASE(*a) - LOWERCASE(*b); -+ if (cmp != 0) -+ break; -+ a++, b++; -+ } -+ return LOWERCASE(*a) - LOWERCASE(*b); -+} -+ - static RGB_NAME * - lookup_rgb(const char *name) - { -@@ -962,7 +976,7 @@ lookup_rgb(const char *name) - if (rgb_table != 0) { - int n; - for (n = 0; rgb_table[n].name != 0; ++n) { -- if (!strcasecmp(name, rgb_table[n].name)) { -+ if (!CaselessCmp(name, rgb_table[n].name)) { - result = &rgb_table[n]; - break; - } ---- test/test.priv.h -+++ test/test.priv.h -@@ -437,6 +437,13 @@ extern int optind; - #include - #include - -+#if defined(_MSC_VER) -+#undef popen -+#define popen(s,n) _popen(s,n) -+#undef pclose -+#define pclose(s) _pclose(s) -+#endif -+ - #ifndef GCC_NORETURN - #define GCC_NORETURN /* nothing */ - #endif diff --git a/recipes/ncurses/all/patches/6.2.0-0018-missing-functions-c-linkage.patch b/recipes/ncurses/all/patches/6.2.0-0018-missing-functions-c-linkage.patch deleted file mode 100644 index a47d3777212a3..0000000000000 --- a/recipes/ncurses/all/patches/6.2.0-0018-missing-functions-c-linkage.patch +++ /dev/null @@ -1,25 +0,0 @@ - ---- include/nc_mingw.h -+++ include/nc_mingw.h -@@ -62,6 +62,10 @@ - - #include - -+#ifdef __cplusplus -+extern "C" { -+#endif -+ - NCURSES_EXPORT(int) _nc_gettimeofday(struct timeval *, void *); - - #undef HAVE_GETTIMEOFDAY -@@ -75,6 +79,10 @@ - #define wcwidth(ucs) _nc_wcwidth((wchar_t)(ucs)) - NCURSES_EXPORT(int) _nc_wcwidth(wchar_t); - -+#ifdef __cplusplus -+} -+#endif -+ - #endif /* _WIN32 */ - - #endif /* NC_MINGW_H */ diff --git a/recipes/ncurses/all/patches/6.2.0-0019-Run-autoreconf.patch b/recipes/ncurses/all/patches/6.2.0-0019-Run-autoreconf.patch deleted file mode 100644 index ec7887edfac48..0000000000000 --- a/recipes/ncurses/all/patches/6.2.0-0019-Run-autoreconf.patch +++ /dev/null @@ -1,565 +0,0 @@ ---- configure -+++ configure -@@ -4750,49 +4750,65 @@ - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - -- cf_cv_ar_flags=unknown -- for cf_ar_flags in -curvU -curv curv -crv crv -cqv cqv -rv rv -- do -+ case $cf_cv_system_name in -+ (*-msvc*) -+ cf_cv_ar_flags='' -+ cat >mk_static_lib.sh <<-EOF -+ #!$SHELL -+ MSVC_BIN="$AR" -+ out="\$1" -+ shift -+ exec \$MSVC_BIN -out:"\$out" \$@ -+ EOF -+ chmod +x mk_static_lib.sh -+ AR=`pwd`/mk_static_lib.sh -+ ;; -+ (*) -+ cf_cv_ar_flags=unknown -+ for cf_ar_flags in -curvU -curv curv -crv crv -cqv cqv -rv rv -+ do - -- # check if $ARFLAGS already contains this choice -- if test "x$ARFLAGS" != "x" ; then -- cf_check_ar_flags=`echo "x$ARFLAGS" | sed -e "s/$cf_ar_flags\$//" -e "s/$cf_ar_flags / /"` -- if test "x$ARFLAGS" != "$cf_check_ar_flags" ; then -- cf_cv_ar_flags= -- break -+ # check if $ARFLAGS already contains this choice -+ if test "x$ARFLAGS" != "x" ; then -+ cf_check_ar_flags=`echo "x$ARFLAGS" | sed -e "s/$cf_ar_flags\$//" -e "s/$cf_ar_flags / /"` -+ if test "x$ARFLAGS" != "$cf_check_ar_flags" ; then -+ cf_cv_ar_flags= -+ break -+ fi - fi -- fi - -- rm -f conftest.$ac_cv_objext -- rm -f conftest.a -+ rm -f conftest.$ac_cv_objext -+ rm -f conftest.a - -- cat >conftest.$ac_ext <&5 -+ cat >conftest.$ac_ext <<-EOF -+ #line 4784 "configure" -+ int testdata[3] = { 123, 456, 789 }; -+ EOF -+ if { (eval echo "$as_me:4787: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -- echo "$as_me:4776: \$? = $ac_status" >&5 -+ echo "$as_me:4790: \$? = $ac_status" >&5 - (exit $ac_status); } ; then -- echo "$AR $ARFLAGS $cf_ar_flags conftest.a conftest.$ac_cv_objext" >&5 -- $AR $ARFLAGS $cf_ar_flags conftest.a conftest.$ac_cv_objext 2>&5 1>/dev/null -- if test -f conftest.a ; then -- cf_cv_ar_flags=$cf_ar_flags -- break -- fi -- else -- test -n "$verbose" && echo " cannot compile test-program" 1>&6 -+ echo "$AR $ARFLAGS $cf_ar_flags conftest.a conftest.$ac_cv_objext" >&5 -+ $AR $ARFLAGS $cf_ar_flags conftest.a conftest.$ac_cv_objext 2>&5 1>/dev/null -+ if test -f conftest.a ; then -+ cf_cv_ar_flags=$cf_ar_flags -+ break -+ fi -+ else -+ test -n "$verbose" && echo " cannot compile test-program" 1>&6 - --echo "${as_me:-configure}:4787: testing cannot compile test-program ..." 1>&5 -+echo "${as_me:-configure}:4801: testing cannot compile test-program ..." 1>&5 - -- break -- fi -- done -- rm -f conftest.a conftest.$ac_ext conftest.$ac_cv_objext -+ break -+ fi -+ done -+ rm -f conftest.a conftest.$ac_ext conftest.$ac_cv_objext -+ ;; -+ esac - - fi --echo "$as_me:4795: result: $cf_cv_ar_flags" >&5 -+echo "$as_me:4811: result: $cf_cv_ar_flags" >&5 - echo "${ECHO_T}$cf_cv_ar_flags" >&6 - - if test -n "$ARFLAGS" ; then -@@ -5474,6 +5490,9 @@ - LIB_PREFIX='' - fi - ;; -+ (*-msvc*) -+ LIB_PREFIX='' -+ ;; - (*) LIB_PREFIX='lib' - ;; - esac -@@ -5961,6 +5980,110 @@ - - MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname',-stats,-lc -o $@' - ;; -+ (mingw*msvc*) -+ LDFLAGS="$LDFLAGS user32.lib" -+ export LDFLAGS -+ cf_cv_shlib_version=msvcdll -+ cf_cv_shlib_version_infix=msvcdll -+ shlibdir=$bindir -+ MAKE_DLLS= -+ if test "$DFT_LWR_MODEL" = "shared" ; then -+ LOCAL_LDFLAGS="-link -dll" -+ LOCAL_LDFLAGS2="$LOCAL_LDFLAGS" -+ EXTRA_LDFLAGS="-link -dll $EXTRA_LDFLAGS" -+ fi -+ CC_SHARED_OPTS= -+ MK_SHARED_LIB=$SHELL' '$rel_builddir'/mk_shared_lib.sh $@ ${LD} ${CFLAGS}' -+ RM_SHARED_OPTS="$RM_SHARED_OPTS $rel_builddir/mk_shared_lib.sh *.dll.lib" -+ cat >mk_shared_lib.sh <<-CF_EOF -+ #!$SHELL -+ SHARED_LIB=\$1 -+ IMPORT_LIB=\`echo "\$1" | sed -e 's/[0-9]*\.dll$/.dll.lib/'\` -+ shift -+ my_ld=\$1 -+ shift -+ cat <<-EOF -+ Linking shared library -+ ** SHARED LIB \$SHARED_LIB -+ ** IMPORT_LIB \$IMPORT_LIB -+EOF -+ args=\$(echo \$* | sed -E "s#-l(\w*)#\1.dll.lib#g" | sed -E "s#-L(\w*)#-LIBPATH:\1#g") -+ exec \$my_ld -DLL -IMPLIB:"\${IMPORT_LIB}" -OUT:"\${SHARED_LIB}" ${LDFLAGS} \$args -+ mv "\${IMPORT_LIB}" "\${IMPORT_LIB}" -+CF_EOF -+ chmod +x mk_shared_lib.sh -+ cat >mk_prog.sh <<-CF_EOF -+ #!$SHELL -+ shift -+ # Ignore first argument (compiler) and use LD (link.exe) unconditionally -+ LD="$LD" -+ clopts=() -+ ldopts=("/subsystem:console") -+ libs=() -+ isdll=0 -+ while test \$# -gt 0; do -+ case "\$1" in -+ -link | -MT | -MD | -MTd | -MDd) -+ # ignore -link argument -+ ;; -+ -dll) -+ isdll=1 -+ ;; -+ -W* | -w*) -+ # ignore warnings -+ ;; -+ -D*) -+ clopts+=("\$1") -+ ;; -+ -I*) -+ clopts+=("\$1") -+ ;; -+ -l*) -+ libs+=("\`echo \"\$1\" | sed \"s/^-l//\"\`") -+ ;; -+ -L*) -+ ldopts+=("\`echo \"\$1\" | sed \"s/^-L/-LIBPATH:/\"\`") -+ ;; -+ *.obj | *.o) -+ ldopts+=("\$1") -+ ;; -+ -Wl,*) -+ for linkarg in \`echo '\$1' | sed -e 's/-Wl,//' -e 's/,/ /'\`; do -+ ldopts+=("\${linkarg}") -+ done -+ ;; -+ *.lib) -+ ldopts+=("\$1") -+ ;; -+ -o) -+ shift -+ ldopts+=("-out:\$1") -+ ;; -+ *) -+ clopts+=("\$1") -+ ldopts+=("\$1") -+ ;; -+ esac -+ shift -+ done -+ if [ "\$isdll" -ne 0 ]; then -+ for lib in \${libs[*]}; do -+ ldopts+=("\$lib.dll.lib") -+ done -+ else -+ for lib in \${libs[*]}; do -+ ldopts+=("\$lib.lib") -+ done -+ fi -+ cat <<-EOF -+ Creating program -+ ** ld options: "\${ldopts[@]}" -+EOF -+ exec \$LD \${ldopts[@]} -+CF_EOF -+ chmod +x mk_prog.sh -+ LINK_PROGS="$SHELL ${rel_builddir}/mk_prog.sh" -+ ;; - (mingw*) - cf_cv_shlib_version=mingw - cf_cv_shlib_version_infix=mingw -@@ -7516,26 +7639,26 @@ - - # either way, check for the library header files - --for ac_header in pcre2-posix.h pcreposix.h -+for ac_header in pcre2posix.h pcreposix.h - do - as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` --echo "$as_me:7522: checking for $ac_header" >&5 -+echo "$as_me:7643: checking for $ac_header" >&5 - echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 - if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line 7528 "configure" -+#line 7649 "configure" - #include "confdefs.h" - #include <$ac_header> - _ACEOF --if { (eval echo "$as_me:7532: \"$ac_cpp conftest.$ac_ext\"") >&5 -+if { (eval echo "$as_me:7653: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 -- echo "$as_me:7538: \$? = $ac_status" >&5 -+ echo "$as_me:7659: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag -@@ -9897,7 +10018,7 @@ - rm -f conftest.$ac_objext conftest.$ac_ext - fi - --echo "${as_me:-configure}:9900: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5 -+echo "${as_me:-configure}:10021: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5 - - CFLAGS="$cf_trim_CFLAGS" - CPPFLAGS="$cf_trim_CPPFLAGS" -@@ -25163,11 +25286,25 @@ - DFT_DEP_SUFFIX=$DFT_LIB_SUFFIX - ;; - (Xdebug) -- DFT_LIB_SUFFIX='_g.a' -+ case $cf_cv_system_name in -+ (*-msvc*) -+ DFT_LIB_SUFFIX='_g.lib' -+ ;; -+ (*) -+ DFT_LIB_SUFFIX='_g.a' -+ ;; -+ esac - DFT_DEP_SUFFIX=$DFT_LIB_SUFFIX - ;; - (Xprofile) -- DFT_LIB_SUFFIX='_p.a' -+ case $cf_cv_system_name in -+ (*-msvc*) -+ DFT_LIB_SUFFIX='_p.lib' -+ ;; -+ (*) -+ DFT_LIB_SUFFIX='_p.a' -+ ;; -+ esac - DFT_DEP_SUFFIX=$DFT_LIB_SUFFIX - ;; - (Xshared) -@@ -25176,6 +25313,10 @@ - DFT_LIB_SUFFIX='.so' - DFT_DEP_SUFFIX=$DFT_LIB_SUFFIX - ;; -+ (*-msvc*) -+ DFT_LIB_SUFFIX='.dll' -+ DFT_DEP_SUFFIX='.dll.lib' -+ ;; - (cygwin*|msys*|mingw*) - DFT_LIB_SUFFIX='.dll' - DFT_DEP_SUFFIX='.dll.a' -@@ -25203,7 +25344,14 @@ - esac - ;; - (*) -- DFT_LIB_SUFFIX='.a' -+ case $target in -+ (*-msvc*) -+ DFT_LIB_SUFFIX='.lib' -+ ;; -+ (*) -+ DFT_LIB_SUFFIX='.a' -+ ;; -+ esac - DFT_DEP_SUFFIX=$DFT_LIB_SUFFIX - ;; - esac -@@ -25252,11 +25400,25 @@ - CXX_DEP_SUFFIX=$CXX_LIB_SUFFIX - ;; - (Xdebug) -- CXX_LIB_SUFFIX='_g.a' -+ case $cf_cv_system_name in -+ (*-msvc*) -+ CXX_LIB_SUFFIX='_g.lib' -+ ;; -+ (*) -+ CXX_LIB_SUFFIX='_g.a' -+ ;; -+ esac - CXX_DEP_SUFFIX=$CXX_LIB_SUFFIX - ;; - (Xprofile) -- CXX_LIB_SUFFIX='_p.a' -+ case $cf_cv_system_name in -+ (*-msvc*) -+ CXX_LIB_SUFFIX='_p.lib' -+ ;; -+ (*) -+ CXX_LIB_SUFFIX='_p.a' -+ ;; -+ esac - CXX_DEP_SUFFIX=$CXX_LIB_SUFFIX - ;; - (Xshared) -@@ -25265,6 +25427,10 @@ - CXX_LIB_SUFFIX='.so' - CXX_DEP_SUFFIX=$CXX_LIB_SUFFIX - ;; -+ (*-msvc*) -+ CXX_LIB_SUFFIX='.dll' -+ CXX_DEP_SUFFIX='.dll.lib' -+ ;; - (cygwin*|msys*|mingw*) - CXX_LIB_SUFFIX='.dll' - CXX_DEP_SUFFIX='.dll.a' -@@ -25292,7 +25458,14 @@ - esac - ;; - (*) -- CXX_LIB_SUFFIX='.a' -+ case $target in -+ (*-msvc*) -+ CXX_LIB_SUFFIX='.lib' -+ ;; -+ (*) -+ CXX_LIB_SUFFIX='.a' -+ ;; -+ esac - CXX_DEP_SUFFIX=$CXX_LIB_SUFFIX - ;; - esac -@@ -25586,12 +25759,23 @@ - if test "$with_overwrite" != no ; then - if test "$NCURSES_LIBUTF8" = 1 ; then - NCURSES_LIBUTF8='defined(HAVE_LIBUTF8_H)' -- { echo "$as_me:25589: WARNING: Wide-character applications must define HAVE_LIBUTF8_H to include curses.h" >&5 -+ { echo "$as_me:25760: WARNING: Wide-character applications must define HAVE_LIBUTF8_H to include curses.h" >&5 - echo "$as_me: WARNING: Wide-character applications must define HAVE_LIBUTF8_H to include curses.h" >&2;} - fi - fi - WITH_OVERWRITE=$with_overwrite - -+### At least on MinGW a shared library build without libtool -+### requires adding the additional libs to the link list. -+case $cf_cv_system_name in -+(*mingw32*|*mingw64*) -+ if test "$DFT_LWR_MODEL" != "libtool"; then -+ SHLIB_LIST="$SHLIB_LIST ${LIBS}" -+ fi -+ ;; -+*) ;; -+esac -+ - # used to separate tack out of the tree - NCURSES_TREE= - -@@ -26124,7 +26308,7 @@ - #define HAVE_CURSES_DATA_BOOLNAMES 1 - EOF - --ac_config_files="$ac_config_files include/MKterm.h.awk include/curses.head:include/curses.h.in include/ncurses_dll.h include/termcap.h include/unctrl.h $SUB_MAKEFILES Makefile" -+ac_config_files="$ac_config_files include/MKterm.h.awk include/curses.head:include/curses.h.in include/ncurses_dll.h include/ncurses_exports.h include/termcap.h include/unctrl.h $SUB_MAKEFILES Makefile" - ac_config_commands="$ac_config_commands default" - cat >confcache <<\_ACEOF - # This file is a shell script that caches the results of configure -@@ -26513,13 +26697,14 @@ - "include/MKterm.h.awk" ) CONFIG_FILES="$CONFIG_FILES include/MKterm.h.awk" ;; - "include/curses.head" ) CONFIG_FILES="$CONFIG_FILES include/curses.head:include/curses.h.in" ;; - "include/ncurses_dll.h" ) CONFIG_FILES="$CONFIG_FILES include/ncurses_dll.h" ;; -+ "include/ncurses_exports.h" ) CONFIG_FILES="$CONFIG_FILES include/ncurses_exports.h" ;; - "include/termcap.h" ) CONFIG_FILES="$CONFIG_FILES include/termcap.h" ;; - "include/unctrl.h" ) CONFIG_FILES="$CONFIG_FILES include/unctrl.h" ;; - "$SUB_MAKEFILES" ) CONFIG_FILES="$CONFIG_FILES $SUB_MAKEFILES" ;; - "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "default" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;; - "include/ncurses_cfg.h" ) CONFIG_HEADERS="$CONFIG_HEADERS include/ncurses_cfg.h:include/ncurses_cfg.hin" ;; -- *) { { echo "$as_me:26522: error: invalid argument: $ac_config_target" >&5 -+ *) { { echo "$as_me:26705: error: invalid argument: $ac_config_target" >&5 - echo "$as_me: error: invalid argument: $ac_config_target" >&2;} - { (exit 1); exit 1; }; };; - esac -@@ -27317,7 +27502,7 @@ - cf_prefix=$LIB_PREFIX - - case $cf_cv_shlib_version in --(cygdll|msysdll|mingw) -+(cygdll|msysdll|mingw|msvcdll) - TINFO_NAME=$TINFO_ARG_SUFFIX - TINFO_SUFFIX=.dll - ;; -@@ -27390,11 +27575,25 @@ - cf_depsuf=$cf_suffix - ;; - (Xdebug) -- cf_suffix='_g.a' -+ case $cf_cv_system_name in -+ (*-msvc*) -+ cf_suffix='_g.lib' -+ ;; -+ (*) -+ cf_suffix='_g.a' -+ ;; -+ esac - cf_depsuf=$cf_suffix - ;; - (Xprofile) -- cf_suffix='_p.a' -+ case $cf_cv_system_name in -+ (*-msvc*) -+ cf_suffix='_p.lib' -+ ;; -+ (*) -+ cf_suffix='_p.a' -+ ;; -+ esac - cf_depsuf=$cf_suffix - ;; - (Xshared) -@@ -27403,6 +27602,10 @@ - cf_suffix='.so' - cf_depsuf=$cf_suffix - ;; -+ (*-msvc*) -+ cf_suffix='.dll' -+ cf_depsuf='.dll.lib' -+ ;; - (cygwin*|msys*|mingw*) - cf_suffix='.dll' - cf_depsuf='.dll.a' -@@ -27430,7 +27633,14 @@ - esac - ;; - (*) -- cf_suffix='.a' -+ case $target in -+ (*-msvc*) -+ cf_suffix='.lib' -+ ;; -+ (*) -+ cf_suffix='.a' -+ ;; -+ esac - cf_depsuf=$cf_suffix - ;; - esac -@@ -27496,6 +27706,10 @@ - cf_cygsuf=`echo "$cf_suffix" | sed -e 's/\.dll/\${ABI_VERSION}.dll/'` - cf_add_lib="../lib/lib${cf_libname}${cf_cygsuf}" - ;; -+ (msvcdll) -+ cf_cygsuf=`echo "$cf_suffix" | sed -e 's/\.dll/\${ABI_VERSION}.dll/'` -+ cf_add_lib="../lib/${cf_libname}${cf_cygsuf}" -+ ;; - (*) - cf_add_lib= - ;; -@@ -27592,10 +27806,10 @@ - CXX_MODEL=$cf_ITEM - if test "$CXX_MODEL" = SHARED; then - case $cf_cv_shlib_version in -- (cygdll|msysdll|mingw) -+ (cygdll|msysdll|mingw|msvcdll) - test "x$with_shared_cxx" = xno && test -n "$verbose" && echo " overriding CXX_MODEL to SHARED" 1>&6 - --echo "${as_me:-configure}:27598: testing overriding CXX_MODEL to SHARED ..." 1>&5 -+echo "${as_me:-configure}:27810: testing overriding CXX_MODEL to SHARED ..." 1>&5 - - with_shared_cxx=yes - ;; -@@ -27611,11 +27825,25 @@ - cf_depsuf=$cf_suffix - ;; - (Xdebug) -- cf_suffix='_g.a' -+ case $cf_cv_system_name in -+ (*-msvc*) -+ cf_suffix='_g.lib' -+ ;; -+ (*) -+ cf_suffix='_g.a' -+ ;; -+ esac - cf_depsuf=$cf_suffix - ;; - (Xprofile) -- cf_suffix='_p.a' -+ case $cf_cv_system_name in -+ (*-msvc*) -+ cf_suffix='_p.lib' -+ ;; -+ (*) -+ cf_suffix='_p.a' -+ ;; -+ esac - cf_depsuf=$cf_suffix - ;; - (Xshared) -@@ -27624,6 +27852,10 @@ - cf_suffix='.so' - cf_depsuf=$cf_suffix - ;; -+ (*-msvc*) -+ cf_suffix='.dll' -+ cf_depsuf='.dll.lib' -+ ;; - (cygwin*|msys*|mingw*) - cf_suffix='.dll' - cf_depsuf='.dll.a' -@@ -27651,7 +27883,14 @@ - esac - ;; - (*) -- cf_suffix='.a' -+ case $target in -+ (*-msvc*) -+ cf_suffix='.lib' -+ ;; -+ (*) -+ cf_suffix='.a' -+ ;; -+ esac - cf_depsuf=$cf_suffix - ;; - esac diff --git a/recipes/ncurses/all/test_package/CMakeLists.txt b/recipes/ncurses/all/test_package/CMakeLists.txt index 6742c96b11c21..98c789fb359ec 100644 --- a/recipes/ncurses/all/test_package/CMakeLists.txt +++ b/recipes/ncurses/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.0) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) set(CURSES_NEED_NCURSES TRUE) -find_package(Curses REQUIRED) +find_package(Curses CONFIG REQUIRED) if(NOT CURSES_HAVE_NCURSES_NCURSES_H) message(FATAL_ERROR "ncurses/ncurses.h is not available (CURSES_HAVE_NCURSES_NCURSES_H)") diff --git a/recipes/ncurses/all/test_package/conanfile.py b/recipes/ncurses/all/test_package/conanfile.py index 430a3b6ec8e18..d78cda6c6388d 100644 --- a/recipes/ncurses/all/test_package/conanfile.py +++ b/recipes/ncurses/all/test_package/conanfile.py @@ -1,10 +1,26 @@ -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_layout, CMake +from conan.tools.env import Environment + 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): + env = Environment() + env.define("TERM", "dumb") + env.vars(self, scope="run").save_script("conanrun_term") def build(self): cmake = CMake(self) @@ -12,6 +28,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - with tools.environment_append({"TERM": "dumb"}): - self.run(os.path.join("bin", "test_package"), 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/ncurses/config.yml b/recipes/ncurses/config.yml index 0791c21efa476..8ccaa404ee598 100644 --- a/recipes/ncurses/config.yml +++ b/recipes/ncurses/config.yml @@ -1,5 +1,7 @@ versions: - "6.3": + "6.5": + folder: all + "6.4": folder: all - "6.2": + "6.3": folder: all diff --git a/recipes/neargye-semver/all/conandata.yml b/recipes/neargye-semver/all/conandata.yml index 98327d51fc307..6859f75eb1461 100644 --- a/recipes/neargye-semver/all/conandata.yml +++ b/recipes/neargye-semver/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.3.1": + url: "https://github.com/Neargye/semver/archive/refs/tags/v0.3.1.tar.gz" + sha256: "422b5882460a685a455fda9da53b85aa1824dcb9ba9dfbd0460ce50393f71061" "0.3.0": url: "https://github.com/Neargye/semver/archive/refs/tags/v0.3.0.tar.gz" sha256: "f88697a059e7a850ca65315828682e14c34958fb585c3b8555b9d89f5c76e3cc" diff --git a/recipes/neargye-semver/all/conanfile.py b/recipes/neargye-semver/all/conanfile.py index 53652835d3593..4c81f48ec928f 100644 --- a/recipes/neargye-semver/all/conanfile.py +++ b/recipes/neargye-semver/all/conanfile.py @@ -1,63 +1,72 @@ -from conans import ConanFile, 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.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.52.0" class NeargyeSemverConan(ConanFile): name = "neargye-semver" description = "Semantic Versioning for modern C++" - topics = ("conan", "semver", "semantic", "versioning") + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/Neargye/semver" - license = "MIT" - generators = "cmake", "cmake_find_package_multi" - settings = "compiler", "build_type" + topics = ("semver", "semantic", "versioning", "header-only") + + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 17 - def configure(self): - compiler = str(self.settings.compiler) - compiler_version = tools.Version(self.settings.compiler.version) - - min_req_cppstd = "17" - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, min_req_cppstd) - else: - self.output.warn("%s recipe lacks information about the %s compiler" - " standard version support." % (self.name, compiler)) - - minimal_version = { + @property + def _compilers_minimum_version(self): + return { "Visual Studio": "16", + "msvc": "192", "gcc": "7.3", "clang": "6.0", "apple-clang": "10.0", } - # Exclude compilers not supported - if compiler not in minimal_version: - self.output.info("%s requires a compiler that supports at least C++%s" % (self.name, min_req_cppstd)) - return - if compiler_version < minimal_version[compiler]: + + 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( - "%s requires a compiler that supports at least C++%s. %s %s is not supported." % - (self.name, min_req_cppstd, compiler, tools.Version(self.settings.compiler.version.value))) + 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 package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - 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", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self.source_folder, "include")) def package_info(self): - self.cpp_info.names["pkg_config"] = "semver" + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + self.cpp_info.set_property("pkg_config_name", "semver") + self.cpp_info.set_property("cmake_file_name", "semver") + self.cpp_info.set_property("cmake_target_name", "semver::semver") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.names["cmake_find_package"] = "semver" self.cpp_info.names["cmake_find_package_multi"] = "semver" - - def package_id(self): - self.info.header_only() diff --git a/recipes/neargye-semver/all/test_package/CMakeLists.txt b/recipes/neargye-semver/all/test_package/CMakeLists.txt index 4b4849803c256..6915cbdbd4166 100644 --- a/recipes/neargye-semver/all/test_package/CMakeLists.txt +++ b/recipes/neargye-semver/all/test_package/CMakeLists.txt @@ -1,10 +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) - -find_package(semver CONFIG REQUIRED) +find_package(semver REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} semver::semver) diff --git a/recipes/neargye-semver/all/test_package/conanfile.py b/recipes/neargye-semver/all/test_package/conanfile.py index 49a3a66ea5bad..ef5d7042163ec 100644 --- a/recipes/neargye-semver/all/test_package/conanfile.py +++ b/recipes/neargye-semver/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/neargye-semver/all/test_v1_package/CMakeLists.txt b/recipes/neargye-semver/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/neargye-semver/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/neargye-semver/all/test_v1_package/conanfile.py b/recipes/neargye-semver/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..49a3a66ea5bad --- /dev/null +++ b/recipes/neargye-semver/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/neargye-semver/config.yml b/recipes/neargye-semver/config.yml index d126790212e0c..f9de643fda854 100644 --- a/recipes/neargye-semver/config.yml +++ b/recipes/neargye-semver/config.yml @@ -1,3 +1,5 @@ versions: + "0.3.1": + folder: all "0.3.0": folder: all diff --git a/recipes/net-snmp/all/conandata.yml b/recipes/net-snmp/all/conandata.yml index 269a227ecf9b0..9ad5ce20f2145 100644 --- a/recipes/net-snmp/all/conandata.yml +++ b/recipes/net-snmp/all/conandata.yml @@ -1,14 +1,13 @@ sources: - "5.9.1": - sha256: "75b59d67e871aaaa31c8cef89ba7d06972782b97736b7e8c3399f36b50a8816f" - url: https://sourceforge.net/projects/net-snmp/files/net-snmp/5.9.1/net-snmp-5.9.1.zip/download + "5.9.4": + url: "https://sourceforge.net/projects/net-snmp/files/net-snmp/5.9.4/net-snmp-5.9.4.zip/download" + sha256: "ceea0c876f23b87731de2073e6a3a683ea610c66a5a67b5cabf4986b7813c22b" patches: - "5.9.1": + "5.9.4": - patch_file: patches/0001-fix-openssl-linking-msvc.patch - base_path: "" + patch_description: "Use Conan OpenSSL when linking on Windows" + patch_source: "https://github.com/net-snmp/net-snmp/commit/99332c80b68248cb60023d12297135dc9c6c8abf" - patch_file: patches/0002-install-only-libnetsnmp.patch - base_path: "" + patch_description: "Avoid install extra helper libraries" - patch_file: patches/0003-fix-perl-scripts-msvc.patch - base_path: "" - - patch_file: patches/0004-fix-apple-arm64-build.patch - base_path: "" + patch_description: "Avoid injecting extra flags when running perl" diff --git a/recipes/net-snmp/all/conanfile.py b/recipes/net-snmp/all/conanfile.py index cf81f5bab247a..68f4965c95152 100644 --- a/recipes/net-snmp/all/conanfile.py +++ b/recipes/net-snmp/all/conanfile.py @@ -1,11 +1,17 @@ -import functools import os import stat -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 apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rm, rmdir, chdir +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, NMakeToolchain +from conan.tools.apple import is_apple_os, fix_apple_shared_install_name -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class NetSnmpConan(ConanFile): @@ -15,10 +21,12 @@ class NetSnmpConan(ConanFile): "for monitoring the health and welfare of network equipment " "(eg. routers), computer equipment and even devices like UPSs." ) + license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "http://www.net-snmp.org/" topics = "snmp" - license = "BSD-3-Clause" + + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -30,21 +38,9 @@ class NetSnmpConan(ConanFile): "fPIC": True, "with_ipv6": True, } - requires = "openssl/1.1.1m" - exports_sources = "patches/*" - @property - def _is_msvc(self): - return self.settings.compiler in ("Visual Studio", "msvc") - - def validate(self): - if self.settings.os == "Windows" and not self._is_msvc: - raise ConanInvalidConfiguration( - "net-snmp is setup to build only with MSVC on Windows" - ) - - def source(self): - tools.get(**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": @@ -52,145 +48,174 @@ 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("openssl/[>=1.1 <4]") + self.requires("pcre/8.45") + self.requires("zlib/[>=1.2.11 <2]") + + def validate(self): + if is_msvc(self) and self.options.shared: + # FIXME: Linker errors against third-party dependencies: + # snmp_openssl.obj : error LNK2019: unresolved external symbol CRYPTO_free referenced in function _extract_oname + raise ConanInvalidConfiguration(f"{self.ref} fails when building as shared library, use -o '&:shared=False'. Contributions are welcome!") def build_requirements(self): - if self._is_msvc: - self.build_requires("strawberryperl/5.30.0.1") + if is_msvc(self): + self.tool_requires("strawberryperl/5.32.1.1") + else: + self.tool_requires("gnu-config/cci.20210814") + self.tool_requires("autoconf/2.71") + self.tool_requires("automake/1.16.5") + 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/2.2.0") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) @property def _is_debug(self): return self.settings.build_type == "Debug" + def generate(self): + if is_msvc(self): + tc = NMakeToolchain(self) + tc.generate() + # Workaround for "unresolved external symbol" errors during shared build + env = VirtualRunEnv(self) + env.generate(scope="build") + else: + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") + tc = AutotoolsToolchain(self) + debug_flag = "enable" if self._is_debug else "disable" + ipv6_flag = "enable" if self.options.with_ipv6 else "disable" + openssl_path = self.dependencies["openssl"].package_folder + zlib_path = self.dependencies["zlib"].package_folder + tc.configure_args += [ + f"--with-openssl={openssl_path}", + f"--with-zlib={zlib_path}", + f"--{debug_flag}-debugging", + f"--{ipv6_flag}-ipv6", + "--with-defaults", + "--without-rpm", + "--without-pcre", + "--disable-agent", + "--disable-applications", + "--disable-manuals", + "--disable-scripts", + "--disable-mibs", + "--disable-embedded-perl", + ] + if self.settings.os in ["Linux"]: + tc.extra_ldflags.append("-ldl") + tc.extra_ldflags.append("-lpthread") + tc.generate() + + deps = AutotoolsDeps(self) + deps.generate() + + deps = PkgConfigDeps(self) + deps.generate() + def _patch_msvc(self): - ssl_info = self.deps_cpp_info["openssl"] - openssl_root = ssl_info.rootpath.replace("\\", "/") + ssl_info = self.dependencies["openssl"] + openssl_root = ssl_info.package_folder.replace("\\", "/") search_replace = [ - ( - r'$default_openssldir . "\\include"', - f"'{openssl_root}/include'" - ), + (r'$default_openssldir . "\\include"', f"'{openssl_root}/include'"), (r'$default_openssldir . "\\lib\\VC"', f"'{openssl_root}/lib'"), - ("$openssl = false", "$openssl = true") + ("$openssl = false", "$openssl = true"), ] if self._is_debug: search_replace.append(("$debug = false", "$debug = true")) if self.options.shared: - search_replace.append(( - "$link_dynamic = false", - "$link_dynamic = true" - )) + search_replace.append(("$link_dynamic = false", "$link_dynamic = true")) if self.options.with_ipv6: search_replace.append(("$b_ipv6 = false", "$b_ipv6 = true")) for search, replace in search_replace: - tools.replace_in_file("win32\\build.pl", search, replace) - runtime = self.settings.compiler.runtime - tools.replace_in_file("win32\\Configure", '"/runtime', f'"/{runtime}') + replace_in_file(self, "build.pl", search, replace) + replace_in_file(self, "Configure", '"/runtime', f'"/{msvc_runtime_flag(self)}') link_lines = "\n".join( f'# pragma comment(lib, "{lib}.lib")' - for lib in ssl_info.libs + ssl_info.system_libs + for lib in ssl_info.cpp_info.libs + ssl_info.cpp_info.system_libs ) - config = r"win32\net-snmp\net-snmp-config.h.in" - tools.replace_in_file(config, "/* Conan: system_libs */", link_lines) - - def _build_msvc(self): - if self.should_configure: - self._patch_msvc() - self.run("perl build.pl", cwd="win32") - if self.should_build: - with tools.vcvars(self): - self.run("nmake /nologo libsnmp", cwd="win32") - - @functools.lru_cache(1) - def _configure_autotools(self): - disabled_link_type = "static" if self.options.shared else "shared" - debug_flag = "enable" if self._is_debug else "disable" - ipv6_flag = "enable" if self.options.with_ipv6 else "disable" - ssl_path = self.deps_cpp_info["openssl"].rootpath - args = [ - "--with-defaults", - "--without-rpm", - "--without-pcre", - "--disable-agent", - "--disable-applications", - "--disable-manuals", - "--disable-scripts", - "--disable-mibs", - "--disable-embedded-perl", - f"--disable-{disabled_link_type}", - f"--{debug_flag}-debugging", - f"--{ipv6_flag}-ipv6", - f"--with-openssl={ssl_path}", - ] - autotools = AutoToolsBuildEnvironment(self) - autotools.libs = [] - autotools.configure(args=args) - return autotools + config = r"net-snmp\net-snmp-config.h.in" + replace_in_file(self, config, "/* Conan: system_libs */", link_lines) def _patch_unix(self): - tools.replace_in_file( - "configure", - "-install_name \\$rpath/", - "-install_name @rpath/" - ) - crypto_libs = self.deps_cpp_info["openssl"].system_libs + 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) + configure_path = os.path.join(self.source_folder, "configure") + replace_in_file(self, configure_path, + "-install_name \\$rpath/", + "-install_name @rpath/") + crypto_libs = self.dependencies["openssl"].cpp_info.system_libs if len(crypto_libs) != 0: crypto_link_flags = " -l".join(crypto_libs) - tools.replace_in_file( - "configure", + replace_in_file(self, configure_path, 'LIBCRYPTO="-l${CRYPTO}"', - 'LIBCRYPTO="-l${CRYPTO} -l%s"' % (crypto_link_flags,) - ) - tools.replace_in_file( - "configure", - 'LIBS="-lcrypto $LIBS"', - f'LIBS="-lcrypto -l{crypto_link_flags} $LIBS"' - ) + 'LIBCRYPTO="-l${CRYPTO} -l%s"' % (crypto_link_flags,)) + replace_in_file(self, configure_path, + 'LIBS="-lcrypto $LIBS"', + f'LIBS="-lcrypto -l{crypto_link_flags} $LIBS"') def build(self): - for patch in self.conan_data["patches"][self.version]: - tools.patch(**patch) - if self._is_msvc: - self._build_msvc() + apply_conandata_patches(self) + if is_msvc(self): + with chdir(self, os.path.join(self.source_folder, "win32")): + self._patch_msvc() + self.run("perl build.pl") + self.run("nmake /nologo libsnmp") else: self._patch_unix() - os.chmod("configure", os.stat("configure").st_mode | stat.S_IEXEC) - self._configure_autotools()\ - .make(target="snmplib", args=["NOAUTODEPS=1"]) - - def _package_msvc(self): - cfg = "debug" if self._is_debug else "release" - self.copy("netsnmp.dll", "bin", fr"win32\bin\{cfg}") - self.copy("netsnmp.lib", "lib", fr"win32\lib\{cfg}") - self.copy("include/net-snmp/*.h") - for directory in ["", "agent/", "library/"]: - self.copy(f"net-snmp/{directory}*.h", "include", "win32") - self.copy("COPYING", "licenses") - - def _remove(self, path): - if os.path.isdir(path): - tools.rmdir(path) - else: - os.remove(path) - - def _package_unix(self): - self._configure_autotools().install(args=["NOAUTODEPS=1"]) - tools.remove_files_by_mask(self.package_folder, "README") - tools.rmdir(os.path.join(self.package_folder, "bin")) - lib_dir = os.path.join(self.package_folder, "lib") - for entry in os.listdir(lib_dir): - if not entry.startswith("libnetsnmp.") or entry.endswith(".la"): - self._remove(os.path.join(lib_dir, entry)) - self.copy("COPYING", "licenses") + configure_path = os.path.join(self.source_folder, "configure") + os.chmod(configure_path, os.stat(configure_path).st_mode | stat.S_IEXEC) + autotools = Autotools(self) + autotools.autoreconf() + autotools.configure() + autotools.make(target="snmplib", args=["NOAUTODEPS=1"]) def package(self): - if self._is_msvc: - self._package_msvc() + copy(self, "COPYING", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder) + if is_msvc(self): + cfg = "debug" if self._is_debug else "release" + copy(self, "netsnmp.lib", + dst=os.path.join(self.package_folder, "lib"), + src=os.path.join(self.source_folder, rf"win32\lib\{cfg}")) + copy(self, "include/net-snmp/*.h", + dst=self.package_folder, + src=self.source_folder) + for directory in ["", "agent/", "library/"]: + copy(self, f"net-snmp/{directory}*.h", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "win32")) else: - self._package_unix() + autotools = Autotools(self) + #only install with -j1 as parallel install will break dependencies. Probably a bug in the dependencies + #install specific targets instead of just everything as it will try to do perl stuff on you host machine + autotools.install(args=["-j1"], target="installsubdirs installlibs installprogs installheaders") + rm(self, "README", self.package_folder, recursive=True) + rmdir(self, os.path.join(self.package_folder, "bin")) + rm(self, "*.la", self.package_folder, recursive=True) + fix_apple_shared_install_name(self) def package_info(self): self.cpp_info.libs = ["netsnmp"] - self.cpp_info.requires = ["openssl::openssl"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["rt", "pthread", "m"]) + if is_apple_os(self): + self.cpp_info.frameworks.extend(["CoreFoundation", "DiskArbitration", "IOKit"]) diff --git a/recipes/net-snmp/all/patches/0003-fix-perl-scripts-msvc.patch b/recipes/net-snmp/all/patches/0003-fix-perl-scripts-msvc.patch index 992914c1a489c..5d1776394ec89 100644 --- a/recipes/net-snmp/all/patches/0003-fix-perl-scripts-msvc.patch +++ b/recipes/net-snmp/all/patches/0003-fix-perl-scripts-msvc.patch @@ -9,24 +9,25 @@ my $debug = false; my $configOpts; my $link_dynamic = false; -@@ -44,15 +44,7 @@ +@@ -44,7 +44,7 @@ # Path of this script (source tree path + "win32"). my $current_pwd = dirname(abs_path($0)); -if (!defined($ENV{MSVCDir}) && !defined($ENV{VCINSTALLDIR}) && -- !defined($ENV{TARGET_CPU})) { -- print "\nPlease run VCVARS32.BAT first to set up the Visual Studio build\n" . -- "environment.\n\n"; -- system("pause"); -- exit; --} -- ++if (0 && + !defined($ENV{TARGET_CPU})) { + print "\nPlease run VCVARS32.BAT first to set up the Visual Studio build\n" . + "environment.\n\n"; +@@ -52,7 +52,7 @@ + exit; + } + -while (1) { +while (0) { print "\n\nNet-SNMP build and install options\n"; print "==================================\n\n"; print "1. OpenSSL support: " . ($openssl ? "enabled" : "disabled"). "\n"; -@@ -192,6 +184,8 @@ +@@ -188,6 +188,8 @@ print "Running Configure...\n"; system("perl Configure $configOpts --linktype=$linktype --prefix=\"$install_base\"" . ($logging ? " > configure.out 2>&1" : "")) == 0 || die ($logging ? "Build error (see configure.out)" : "Build error (see above)"); @@ -35,6 +36,7 @@ print "Cleaning...\n"; system("nmake /nologo clean" . ($logging ? " > clean.out 2>&1" : "")) == 0 || die ($logging ? "Build error (see clean.out)" : "Build error (see above)"); + --- win32/Configure +++ win32/Configure @@ -6,7 +6,6 @@ @@ -45,16 +47,16 @@ use Getopt::Long; my $version = "unknown"; -@@ -190,8 +189,6 @@ +@@ -190,7 +189,6 @@ my $perl_inc = $opensslincdir ? "/I $opensslincdir" : ""; -my $perl_cflags = ExtUtils::Embed::ccopts(); -- - my %makefile_subs = ( - "app" => [ "^APPS=", "APPS=" . join(" ", @apps) ], - "apc" => [ "^APPS_CLEAN=", "APPS_CLEAN=" . join(" ", @apps_clean)], -@@ -205,29 +202,23 @@ + # Do not use $perl_cflags if these come from a Perl executable built with gcc. +-$perl_cflags = "" if $perl_cflags =~ / -pipe/; ++ + +@@ -207,29 +205,24 @@ "sdk" => [ "^SDK=", $sdk == 1 ? "SDK=true" : "SDK=false" ], "pin" => [ "^PERL_DEFINE=","PERL_DEFINE=$perl_define" ], "pdf" => [ "^PERL_INC=", "PERL_INC=$perl_inc" ], @@ -62,7 +64,7 @@ + "pcf" => [ "^PERL_CFLAGS=","PERL_CFLAGS=" ], "cfl" => [ "^CFLAGS=", "CFLAGS=$perl_define " . "/D WIN32_LEAN_AND_MEAN " . -- "/EHsc " . + "/EHsc " . - "/FD " . - "/FR\$(INTDIR)\\ " . "/Fd\$(INTDIR)\\\$(PROGNAME).pdb " . @@ -89,7 +91,7 @@ ], "rsc" => [ "^RSCFLAGS=", "RSCFLAGS=/l 0x409 " . ($config eq "release" ? "/d NDEBUG" : -@@ -308,9 +299,3 @@ +@@ -310,9 +303,3 @@ print " Blumenthal AES: " . ($blumenthal_aes ? "enabled" : "disabled") . "\n"; print " IPv6 transport: " . ($b_ipv6 == 1 ? "enabled" : "disabled") . "\n"; print " winExtDLL agent: " . ($b_winextdll == 1 ? "enabled" : "disabled") . "\n"; diff --git a/recipes/net-snmp/all/patches/0004-fix-apple-arm64-build.patch b/recipes/net-snmp/all/patches/0004-fix-apple-arm64-build.patch deleted file mode 100644 index 018c49021fc87..0000000000000 --- a/recipes/net-snmp/all/patches/0004-fix-apple-arm64-build.patch +++ /dev/null @@ -1,17 +0,0 @@ -Upstream suggests the just hardcode this value: -https://github.com/net-snmp/net-snmp/issues/295#issuecomment-1002631231 - ---- config.sub -+++ config.sub -@@ -120,6 +120,11 @@ - exit 1;; - esac - -+if [ "$1" = aarch64-apple-darwin ]; then -+ echo arm-apple-darwin -+ exit 0 -+fi -+ - # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). - # Here we must recognize all the valid KERNEL-OS combinations. - maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` diff --git a/recipes/net-snmp/all/test_package/CMakeLists.txt b/recipes/net-snmp/all/test_package/CMakeLists.txt index bed2bf477f616..21569fa32fd1f 100644 --- a/recipes/net-snmp/all/test_package/CMakeLists.txt +++ b/recipes/net-snmp/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 KEEP_RPATHS) - find_package(net-snmp REQUIRED CONFIG) add_executable(test_package test_package.c) diff --git a/recipes/net-snmp/all/test_package/conanfile.py b/recipes/net-snmp/all/test_package/conanfile.py index 56657365795bd..ef5d7042163ec 100644 --- a/recipes/net-snmp/all/test_package/conanfile.py +++ b/recipes/net-snmp/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_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 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 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/net-snmp/all/test_package/test_package.c b/recipes/net-snmp/all/test_package/test_package.c index db6d49e73a2f8..dbe79814204fe 100644 --- a/recipes/net-snmp/all/test_package/test_package.c +++ b/recipes/net-snmp/all/test_package/test_package.c @@ -2,12 +2,8 @@ #include #include -int main(int argc, char const* argv[]) +int main() { - (void)argc; - (void)argv; - netsnmp_free(NULL); - return 0; } diff --git a/recipes/net-snmp/all/test_v1_package/CMakeLists.txt b/recipes/net-snmp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/net-snmp/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/net-snmp/all/test_v1_package/conanfile.py b/recipes/net-snmp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..a8c92dea63335 --- /dev/null +++ b/recipes/net-snmp/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +import os + +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.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/net-snmp/config.yml b/recipes/net-snmp/config.yml index f15097f7b11ab..be87e4ef2a874 100644 --- a/recipes/net-snmp/config.yml +++ b/recipes/net-snmp/config.yml @@ -1,3 +1,3 @@ versions: - "5.9.1": + "5.9.4": folder: all diff --git a/recipes/netcdf/all/conandata.yml b/recipes/netcdf/all/conandata.yml index c96fc1ea18103..e6119be629931 100644 --- a/recipes/netcdf/all/conandata.yml +++ b/recipes/netcdf/all/conandata.yml @@ -10,7 +10,13 @@ patches: - patch_file: "patches/4.7.4-0001-fix-cmake.patch" patch_description: "fixes for cmake target_link_libraries and using deps" patch_type: "conan" + - patch_file: "patches/4.7.4-0002-fix-cross-compile.patch" + patch_description: "fixes 'Unable to find the math library' when cross compiling" + patch_type: "conan" "4.8.1": - patch_file: "patches/4.8.1-0001-fix-cmake.patch" patch_description: "fixes for cmake target_link_libraries and using deps" patch_type: "conan" + - patch_file: "patches/4.8.1-0002-fix-cross-compile.patch" + patch_description: "fixes 'Unable to find the math library' when cross compiling" + patch_type: "conan" diff --git a/recipes/netcdf/all/conanfile.py b/recipes/netcdf/all/conanfile.py index 5078a2341094a..748b4bb9a8744 100644 --- a/recipes/netcdf/all/conanfile.py +++ b/recipes/netcdf/all/conanfile.py @@ -3,7 +3,7 @@ from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rm, rmdir import os -required_conan_version = ">=1.53.0" +required_conan_version = ">=1.54.0" class NetcdfConan(ConanFile): @@ -17,7 +17,7 @@ class NetcdfConan(ConanFile): license = "BSD-3-Clause" homepage = "https://github.com/Unidata/netcdf-c" url = "https://github.com/conan-io/conan-center-index" - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -68,13 +68,14 @@ 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.13.1") + self.requires("hdf5/1.14.1") if self.options.dap or self.options.byterange: - self.requires("libcurl/7.86.0") + self.requires("libcurl/[>=7.78.0 <9]") 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) + apply_conandata_patches(self) def generate(self): tc = CMakeToolchain(self) @@ -89,17 +90,12 @@ def generate(self): 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" - tc.generate() tc = CMakeDeps(self) tc.generate() def build(self): - apply_conandata_patches(self) cmake = CMake(self) cmake.configure() cmake.build() @@ -127,8 +123,6 @@ def package_info(self): self.cpp_info.set_property("pkg_config_name", "netcdf") # TODO: back to global scope in conan v2 once cmake_find_package_* generators removed self.cpp_info.components["libnetcdf"].libs = ["netcdf"] - self.cpp_info.components["libnetcdf"].libdirs = ["lib"] - self.cpp_info.components["libnetcdf"].includedirs = ["include"] if self._with_hdf5: self.cpp_info.components["libnetcdf"].requires.append("hdf5::hdf5") if self.options.dap or self.options.byterange: diff --git a/recipes/netcdf/all/patches/4.7.4-0002-fix-cross-compile.patch b/recipes/netcdf/all/patches/4.7.4-0002-fix-cross-compile.patch new file mode 100644 index 0000000000000..6c157604fa80f --- /dev/null +++ b/recipes/netcdf/all/patches/4.7.4-0002-fix-cross-compile.patch @@ -0,0 +1,17 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 80a986f..7e398ba 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -864,7 +864,11 @@ ENDIF() + + # Check for the math library so it can be explicitly linked. + IF(NOT WIN32) +- FIND_LIBRARY(HAVE_LIBM NAMES math m libm) ++ INCLUDE(CheckLibraryExists) ++ CHECK_LIBRARY_EXISTS(m log "" CAN_LINK_LIBM) ++ IF(CAN_LINK_LIBM) ++ SET(HAVE_LIBM m) ++ ENDIF() + MESSAGE(STATUS "Found Math library: ${HAVE_LIBM}") + IF(NOT HAVE_LIBM) + MESSAGE(FATAL_ERROR "Unable to find the math library.") diff --git a/recipes/netcdf/all/patches/4.8.1-0002-fix-cross-compile.patch b/recipes/netcdf/all/patches/4.8.1-0002-fix-cross-compile.patch new file mode 100644 index 0000000000000..1b07967b34210 --- /dev/null +++ b/recipes/netcdf/all/patches/4.8.1-0002-fix-cross-compile.patch @@ -0,0 +1,17 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index fd6713d..c6312b2 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -938,7 +938,11 @@ OPTION(ENABLE_BYTERANGE "Enable byte-range access to remote datasets.." OFF) + + # Check for the math library so it can be explicitly linked. + IF(NOT WIN32) +- FIND_LIBRARY(HAVE_LIBM NAMES math m libm) ++ INCLUDE(CheckLibraryExists) ++ CHECK_LIBRARY_EXISTS(m log "" CAN_LINK_LIBM) ++ IF(CAN_LINK_LIBM) ++ SET(HAVE_LIBM m) ++ ENDIF() + MESSAGE(STATUS "Found Math library: ${HAVE_LIBM}") + IF(NOT HAVE_LIBM) + MESSAGE(FATAL_ERROR "Unable to find the math library.") diff --git a/recipes/nettle/all/conandata.yml b/recipes/nettle/all/conandata.yml index 8e0d6c4f8c0c7..8d2046aa39c9c 100644 --- a/recipes/nettle/all/conandata.yml +++ b/recipes/nettle/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.9.1": + url: "https://ftp.gnu.org/gnu/nettle/nettle-3.9.1.tar.gz" + sha256: "ccfeff981b0ca71bbd6fbcb054f407c60ffb644389a5be80d6716d5b550c6ce3" "3.8.1": url: "https://ftp.gnu.org/gnu/nettle/nettle-3.8.1.tar.gz" sha256: "364f3e2b77cd7dcde83fd7c45219c834e54b0c75e428b6f894a23d12dd41cbfe" diff --git a/recipes/nettle/all/conanfile.py b/recipes/nettle/all/conanfile.py index 6fad71c864b8b..e24910f2f61b5 100644 --- a/recipes/nettle/all/conanfile.py +++ b/recipes/nettle/all/conanfile.py @@ -10,7 +10,7 @@ from conan.tools.scm import Version import os -required_conan_version = ">=1.51.1" +required_conan_version = ">=1.54.0" class NettleConan(ConanFile): @@ -20,6 +20,7 @@ class NettleConan(ConanFile): 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" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -49,30 +50,21 @@ def config_options(self): 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 + 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.public_key: - self.requires("gmp/6.2.1") + self.requires("gmp/6.3.0") def validate(self): 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(f"{self.ref} cannot be built with Visual Studio") + if Version(self.version) < "3.6" and self.options.get_safe("fat") and self.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 @@ -83,13 +75,18 @@ def build_requirements(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", default=False, check_type=bool): + 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_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 = AutotoolsToolchain(self) tc.configure_args.extend([ "--enable-public-key" if self.options.public_key else "--disable-public-key", @@ -100,11 +97,6 @@ def generate(self): 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_folder, "Makefile.in") @@ -121,19 +113,21 @@ def build(self): self._patch_sources() autotools = Autotools(self) autotools.autoreconf() + autotools.configure() # 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() + replace_in_file( + self, + os.path.join(self.build_folder, "config.m4"), + unix_path(self, self.source_folder), + self.source_folder.replace("\\", "/"), + ) autotools.make() def package(self): 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)}"]) + autotools.install() 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) diff --git a/recipes/nettle/all/test_v1_package/CMakeLists.txt b/recipes/nettle/all/test_v1_package/CMakeLists.txt index 6ec75079b3fc2..0d20897301b68 100644 --- a/recipes/nettle/all/test_v1_package/CMakeLists.txt +++ b/recipes/nettle/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(nettle REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE nettle::libnettle nettle::hogweed) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/nettle/config.yml b/recipes/nettle/config.yml index e749bd36291ee..f812356867a67 100644 --- a/recipes/nettle/config.yml +++ b/recipes/nettle/config.yml @@ -1,4 +1,6 @@ versions: + "3.9.1": + folder: "all" "3.8.1": folder: "all" "3.6": diff --git a/recipes/newmat/all/CMakeLists.txt b/recipes/newmat/all/CMakeLists.txt new file mode 100644 index 0000000000000..768502b8f6a7f --- /dev/null +++ b/recipes/newmat/all/CMakeLists.txt @@ -0,0 +1,92 @@ +cmake_minimum_required(VERSION 3.0) + +project( + "newmat" + DESCRIPTION + "The package is intended for scientists and engineers who need to \ + manipulate a variety of types of matrices using standard matrix \ + operations. Emphasis is on the kind of operations needed in statistical \ + calculations such as least squares, linear equation solve and eigenvalues." + HOMEPAGE_URL "http://www.robertnz.net/nm11.htm" + LANGUAGES CXX) + +option(SETUP_C_SUBSCRIPTS "Activate SETUP_C_SUBSCRIPTS if you want to use traditional C style element access" OFF) +if (SETUP_C_SUBSCRIPTS) + add_compile_definitions(SETUP_C_SUBSCRIPTS) +endif() +message("Build with C style element access ${SETUP_C_SUBSCRIPTS}") + +# ------------- +# target +# ------------- +set(source_subfolder_ "src") +set(lib_name ${PROJECT_NAME}) +add_library(${lib_name}) + +target_sources( + ${lib_name} + PRIVATE + ${source_subfolder_}/bandmat.cpp + ${source_subfolder_}/jacobi.cpp + ${source_subfolder_}/newmat3.cpp + ${source_subfolder_}/newmat8.cpp + ${source_subfolder_}/nm_misc.cpp + ${source_subfolder_}/cholesky.cpp + ${source_subfolder_}/myexcept.cpp + ${source_subfolder_}/newmat4.cpp + ${source_subfolder_}/newmat9.cpp + ${source_subfolder_}/solution.cpp + ${source_subfolder_}/evalue.cpp + ${source_subfolder_}/newfft.cpp + ${source_subfolder_}/newmat5.cpp + ${source_subfolder_}/newmatex.cpp + ${source_subfolder_}/sort.cpp + ${source_subfolder_}/fft.cpp + ${source_subfolder_}/newmat1.cpp + ${source_subfolder_}/newmat6.cpp + ${source_subfolder_}/newmatnl.cpp + ${source_subfolder_}/submat.cpp + ${source_subfolder_}/hholder.cpp + ${source_subfolder_}/newmat2.cpp + ${source_subfolder_}/newmat7.cpp + ${source_subfolder_}/newmatrm.cpp + ${source_subfolder_}/svd.cpp +) + +set(include_dir ${PROJECT_SOURCE_DIR}/${source_subfolder_}) + +target_include_directories( + ${lib_name} PUBLIC $) +target_include_directories( + ${lib_name} INTERFACE $) + +# code has throwing desctructors, thus try to compile with c++98 +set_property(TARGET ${lib_name} PROPERTY CXX_STANDARD 98) + +# ------------- +# installation +# ------------- +include(GNUInstallDirs) +install( + FILES + ${include_dir}/controlw.h + ${include_dir}/include.h + ${include_dir}/myexcept.h + ${include_dir}/newmatap.h + ${include_dir}/newmat.h + ${include_dir}/newmatio.h + ${include_dir}/newmatnl.h + ${include_dir}/newmatrc.h + ${include_dir}/newmatrm.h + ${include_dir}/precisio.h + ${include_dir}/solution.h + DESTINATION + include/newmat +) +install( + TARGETS ${lib_name} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) diff --git a/recipes/newmat/all/conandata.yml b/recipes/newmat/all/conandata.yml new file mode 100644 index 0000000000000..e5211d2f68295 --- /dev/null +++ b/recipes/newmat/all/conandata.yml @@ -0,0 +1,9 @@ +sources: + "11.0.1": + url: "http://www.robertnz.net/ftp/newmat11.tar.gz" + sha256: "daf313a4db0db14dfcce236ad3cdc514d449e62ddd4f1b07cc31179b0787db6f" +patches: + "11.0.1": + - patch_file: "patches/11.0.1/newmat6.cpp.patch" + patch_type: portability + patch_description: "Fix comparison of pointer and int for new compilers" diff --git a/recipes/newmat/all/conanfile.py b/recipes/newmat/all/conanfile.py new file mode 100644 index 0000000000000..e73dffca97d70 --- /dev/null +++ b/recipes/newmat/all/conanfile.py @@ -0,0 +1,87 @@ +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, export_conandata_patches, copy, get, rmdir, save, load +from conan.tools.microsoft import is_msvc +import os + +required_conan_version = ">=1.53.0" + + +class NewmatConan(ConanFile): + name = "newmat" + description = "Manipulate a variety of types of matrices using standard matrix operations." + url = "https://github.com/conan-io/conan-center-index" + homepage = "http://www.robertnz.net/nm11.htm" + topics = ("matrix") + license = "LicenseRef-newmat" + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_c_subscripts": [True, False] + } + default_options = { + "shared": False, + "fPIC": True, + "with_c_subscripts": False, + } + + 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 + + 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 is_msvc(self) and self.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} does not support dynamic library with msvc.") + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["SETUP_C_SUBSCRIPTS"] = self.options.with_c_subscripts + tc.generate() + + def build(self): + 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 = load(self, os.path.join(self.source_folder, "nm11.htm")) + return header[header.find("I place no restrictions", 1) : header.find("report bugs to me.", 1) + 18] + + def package(self): + cmake = CMake(self) + cmake.install() + save(self, os.path.join(self.package_folder, "licenses", "LICENSE"), self._extract_license()) + rmdir(self, os.path.join(self.package_folder, "cmake")) + if self.settings.os == "Windows": + rmdir(self, os.path.join(self.package_folder, "bin")) + + def package_info(self): + self.cpp_info.libs = ["newmat"] + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs = ["m"] + + self.cpp_info.includedirs.append(os.path.join("include", "newmat")) + if self.options.with_c_subscripts: + self.cpp_info.defines.append("SETUP_C_SUBSCRIPTS") + diff --git a/recipes/newmat/all/patches/11.0.1/newmat6.cpp.patch b/recipes/newmat/all/patches/11.0.1/newmat6.cpp.patch new file mode 100644 index 0000000000000..2cbfaaa6c4648 --- /dev/null +++ b/recipes/newmat/all/patches/11.0.1/newmat6.cpp.patch @@ -0,0 +1,12 @@ +@@ -1,11 +0,0 @@ +--- newmat6.cpp ++++ newmat6.cpp +@@ -428,7 +428,7 @@ + { + if (&gm == this) { REPORT tag_val = -1; return; } + REPORT +- if (indx > 0) { delete [] indx; indx = 0; } ++ if (indx != 0) { delete [] indx; indx = 0; } + ((CroutMatrix&)gm).get_aux(*this); + Eq(gm); + } diff --git a/recipes/newmat/all/test_package/CMakeLists.txt b/recipes/newmat/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..b7da1c805dfbd --- /dev/null +++ b/recipes/newmat/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +find_package(newmat REQUIRED) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE newmat::newmat) diff --git a/recipes/newmat/all/test_package/conanfile.py b/recipes/newmat/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0a6bc68712d90 --- /dev/null +++ b/recipes/newmat/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/newmat/all/test_package/test_package.cpp b/recipes/newmat/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..bd314f10d88fc --- /dev/null +++ b/recipes/newmat/all/test_package/test_package.cpp @@ -0,0 +1,15 @@ +#include "newmatap.h" + +int main() +{ + Matrix matrix(4,4); + + matrix + << 1 << 2 << 3 << 4 + << 21 << 22 << 23 << 24 + << 31 << 32 << 33 << 34 + << 41 << 42 << 43 << 44 + ; + + return 0; +} diff --git a/recipes/newmat/config.yml b/recipes/newmat/config.yml new file mode 100644 index 0000000000000..d7fc56a2cf1b3 --- /dev/null +++ b/recipes/newmat/config.yml @@ -0,0 +1,3 @@ +versions: + "11.0.1": + folder: all diff --git a/recipes/nextsilicon-cpp-subprocess/all/conanfile.py b/recipes/nextsilicon-cpp-subprocess/all/conanfile.py index cc556b383afc6..01f1e1a74c95e 100644 --- a/recipes/nextsilicon-cpp-subprocess/all/conanfile.py +++ b/recipes/nextsilicon-cpp-subprocess/all/conanfile.py @@ -1,27 +1,54 @@ -from conans import ConanFile, tools +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 + +required_conan_version = ">=1.52.0" class CppSubprocess(ConanFile): name = "nextsilicon-cpp-subprocess" + description = ( + "Subprocessing with modern C++. " + "The only goal was to develop something that is as close as possible" + " to the Python subprocess module in dealing with processes." + ) license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/nextsilicon/cpp-subprocess" - topics = ("subprocess", "os", "fork") - description = ("Subprocessing with modern C++, " - "The only goal was to develop something that is as close as" - "python subprocess module in dealing with processes.") - no_copy_source = True + topics = ("subprocess", "os", "fork", "header-only") + + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" + no_copy_source = True - _source_subfolder = 'cpp-subprocess' + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + @property + def _min_cppstd(self): + return 11 + + 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], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): - self.copy("subprocess.hpp", dst="include/cpp-subprocess", src=self._source_subfolder) - self.copy("LICENSE.MIT", dst="licenses", src=self._source_subfolder) + copy(self, "subprocess.hpp", + dst=os.path.join(self.package_folder, "include/cpp-subprocess"), + src=self.source_folder) + copy(self, "LICENSE.MIT", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder) - def package_id(self): - self.info.header_only() + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/nextsilicon-cpp-subprocess/all/test_package/CMakeLists.txt b/recipes/nextsilicon-cpp-subprocess/all/test_package/CMakeLists.txt index c61a7aada95ff..ccc5e64288292 100644 --- a/recipes/nextsilicon-cpp-subprocess/all/test_package/CMakeLists.txt +++ b/recipes/nextsilicon-cpp-subprocess/all/test_package/CMakeLists.txt @@ -1,14 +1,12 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - set(CMAKE_CXX_STANDARD 11) -set(CMAKE_BUILD_TYPE Debug) set(THREADS_PREFER_PTHREAD_FLAG ON) + +find_package(nextsilicon-cpp-subprocess REQUIRED CONFIG) find_package(Threads REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS} Threads::Threads) +target_link_libraries(${PROJECT_NAME} PRIVATE nextsilicon-cpp-subprocess::nextsilicon-cpp-subprocess Threads::Threads) diff --git a/recipes/nextsilicon-cpp-subprocess/all/test_package/conanfile.py b/recipes/nextsilicon-cpp-subprocess/all/test_package/conanfile.py index fc4fe1905b49a..ef5d7042163ec 100644 --- a/recipes/nextsilicon-cpp-subprocess/all/test_package/conanfile.py +++ b/recipes/nextsilicon-cpp-subprocess/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" + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/nfrechette-acl/all/conandata.yml b/recipes/nfrechette-acl/all/conandata.yml index 0c2e8a5978fd0..191bbde1ad6d6 100644 --- a/recipes/nfrechette-acl/all/conandata.yml +++ b/recipes/nfrechette-acl/all/conandata.yml @@ -2,21 +2,12 @@ sources: "1.3.5": url: "https://github.com/nfrechette/acl/archive/v1.3.5.tar.gz" sha256: "06112ad5dc6b586124cc7b22ff6979ea1de9b69abefcd94d43556e20617355a1" - "2.0.0": - url: "https://github.com/nfrechette/acl/archive/v2.0.0.tar.gz" - sha256: "c5b44c063efbee6fb5753d0070e37215162d5d47f047fa033024750d9dbb6cdc" - "2.0.1": - url: "https://github.com/nfrechette/acl/archive/v2.0.1.tar.gz" - sha256: "aeab843b03ba15edd886472d96cdbe06e7c7142a0d54f0bf08a4f30693b9dad7" - "2.0.2": - url: "https://github.com/nfrechette/acl/archive/v2.0.2.tar.gz" - sha256: "d91c7942b4cbc6e8123a9964c1a68eec2778c75dc741c10ea9fede382d831649" - "2.0.3": - url: "https://github.com/nfrechette/acl/archive/v2.0.3.tar.gz" - sha256: "2cc0a6fd8f74ba7fee9177f6b7794bfdc22a27f5b00aa684ba52d60f0f8b3460" "2.0.5": url: "https://github.com/nfrechette/acl/archive/v2.0.5.tar.gz" sha256: "edd255a3ffcdb102b960922069d1ec9ae5fed561bca3bb6ee73224562f76fa36" "2.0.6": url: "https://github.com/nfrechette/acl/archive/v2.0.6.tar.gz" sha256: "595575d3470eb3a4a572f7c5cb986ea2205ea1271ca3b32b864c569659106311" + "2.1.0": + url: "https://github.com/nfrechette/acl/archive/v2.1.0.tar.gz" + sha256: "0ac8473cd30eb768bae1ef58558e3088242d6fef81f727ce7b5ff5af9be74fce" diff --git a/recipes/nfrechette-acl/all/conanfile.py b/recipes/nfrechette-acl/all/conanfile.py index 23d68bbd569f4..9486ab8fa1d5e 100644 --- a/recipes/nfrechette-acl/all/conanfile.py +++ b/recipes/nfrechette-acl/all/conanfile.py @@ -1,44 +1,59 @@ import os + from conan import ConanFile -from conan.tools.files import rename, get -from conans import tools -from conans.errors import ConanInvalidConfiguration +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.52.0" class AclConan(ConanFile): name = "nfrechette-acl" description = "Animation Compression Library" - topics = ("animation", "compression") license = "MIT" - homepage = "https://github.com/nfrechette/acl" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/nfrechette/acl" + topics = ("animation", "compression", "header-only") + + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - settings = "compiler" @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 11 - def requirements(self): - self.requires("rtm/2.1.4") + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) - def configure(self): - minimal_cpp_standard = "11" - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, minimal_cpp_standard) + if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "5": + raise ConanInvalidConfiguration( + f"acl can't be compiled by {self.settings.compiler} {self.settings.compiler.version}") - if self.settings.compiler == "gcc" and tools.Version(self.settings.compiler.version) < "5": - raise ConanInvalidConfiguration("acl can't be compiled by {0} {1}".format(self.settings.compiler, - self.settings.compiler.version)) + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("rtm/2.2.0") + + def package_id(self): + self.info.clear() def source(self): - get(self, **self.conan_data["sources"][self.version]) - extracted_dir = "acl-" + self.version - rename(self, extracted_dir, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("*.h", dst="include", src=os.path.join(self._source_subfolder, "includes")) - - def package_id(self): - self.info.header_only() + copy(self, "LICENSE", + 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, "includes")) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/nfrechette-acl/all/test_package/CMakeLists.txt b/recipes/nfrechette-acl/all/test_package/CMakeLists.txt index 33ae887aa6aea..da2314ef0ec2b 100644 --- a/recipes/nfrechette-acl/all/test_package/CMakeLists.txt +++ b/recipes/nfrechette-acl/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -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() +find_package(nfrechette-acl REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE nfrechette-acl::nfrechette-acl) set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) diff --git a/recipes/nfrechette-acl/all/test_package/conanfile.py b/recipes/nfrechette-acl/all/test_package/conanfile.py index efea435279716..ef5d7042163ec 100644 --- a/recipes/nfrechette-acl/all/test_package/conanfile.py +++ b/recipes/nfrechette-acl/all/test_package/conanfile.py @@ -1,11 +1,19 @@ -import os from conan import ConanFile -from conans import CMake, tools +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) @@ -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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/nfrechette-acl/all/test_v1_package/CMakeLists.txt b/recipes/nfrechette-acl/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/nfrechette-acl/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/nfrechette-acl/all/test_v1_package/conanfile.py b/recipes/nfrechette-acl/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..49ba777923b40 --- /dev/null +++ b/recipes/nfrechette-acl/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +import os +from conan import ConanFile +from conans import 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/nfrechette-acl/config.yml b/recipes/nfrechette-acl/config.yml index cf68d13e1c698..1a65a1cc6cec7 100644 --- a/recipes/nfrechette-acl/config.yml +++ b/recipes/nfrechette-acl/config.yml @@ -1,15 +1,9 @@ versions: "1.3.5": folder: "all" - "2.0.0": - folder: "all" - "2.0.1": - folder: "all" - "2.0.2": - folder: "all" - "2.0.3": - folder: "all" "2.0.5": folder: "all" "2.0.6": folder: "all" + "2.1.0": + folder: "all" diff --git a/recipes/nghttp3/all/conandata.yml b/recipes/nghttp3/all/conandata.yml new file mode 100644 index 0000000000000..9fdcd6c92b130 --- /dev/null +++ b/recipes/nghttp3/all/conandata.yml @@ -0,0 +1,30 @@ +sources: + "1.6.0": + url: "https://github.com/ngtcp2/nghttp3/releases/download/v1.6.0/nghttp3-1.6.0.tar.bz2" + sha256: "e49806e1008fe823961616dc61dab7df0f20d3e1f43bc76faecf3e10e541a4b8" + "1.5.0": + url: "https://github.com/ngtcp2/nghttp3/releases/download/v1.5.0/nghttp3-1.5.0.tar.bz2" + sha256: "4d89a3b84dbe2c6e0fe1367a2082f23b3c6e3279536e2436aed1a3785f6716c5" + "1.4.0": + url: "https://github.com/ngtcp2/nghttp3/releases/download/v1.4.0/nghttp3-1.4.0.tar.bz2" + sha256: "bf8fbb4242cff0feb10b3e0d02545a8ad9a71d932f877a57a592bfde62a26019" + "1.3.0": + url: "https://github.com/ngtcp2/nghttp3/releases/download/v1.3.0/nghttp3-1.3.0.tar.bz2" + sha256: "1f6bda74a888bfeb110a660a04b2ea25b756e0774d48143e34374af83d25e4a8" + "1.2.0": + url: "https://github.com/ngtcp2/nghttp3/releases/download/v1.2.0/nghttp3-1.2.0.tar.bz2" + sha256: "da1bc26af1fd8756b59883c256153d2f41064294750454ee4c970fe087a70056" + "1.1.0": + url: "https://github.com/ngtcp2/nghttp3/releases/download/v1.1.0/nghttp3-1.1.0.tar.bz2" + sha256: "5a203bf6e3129a9c23b06207c0fa3b05b26066ea28c037a62c9fea8cffecd85f" + "1.0.0": + url: "https://github.com/ngtcp2/nghttp3/releases/download/v1.0.0/nghttp3-1.0.0.tar.bz2" + sha256: "c4aa8a38056e3b286a4102612d690e0c21f584784364f04215100e74efc95a61" + "0.15.0": + url: "https://github.com/ngtcp2/nghttp3/releases/download/v0.15.0/nghttp3-0.15.0.tar.gz" + sha256: "3c56d9fa6f1b58b37bd7b1b53eaf16cd71118bc2d5cadbc904f09d6f6466b42f" +patches: + "1.2.0": + - patch_file: "patches/1.2.0-0001-disable-always-static-build.patch" + patch_description: "disable always static build to avoid overwrite lib file on windows" + patch_type: "conan" diff --git a/recipes/nghttp3/all/conanfile.py b/recipes/nghttp3/all/conanfile.py new file mode 100644 index 0000000000000..9fbb63e061dc5 --- /dev/null +++ b/recipes/nghttp3/all/conanfile.py @@ -0,0 +1,83 @@ +from conan import ConanFile +from conan.tools.apple import is_apple_os +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.microsoft import is_msvc +import os + + +required_conan_version = ">=1.53.0" + + +class Nghttp3Conan(ConanFile): + name = "nghttp3" + description = "HTTP/3 library written in C" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://nghttp2.org/nghttp3/" + topics = ("http", "http3", "quic", "qpack") + 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 build_requirements(self): + self.tool_requires("cmake/[>=3.20 <4]") + + def source(self): + 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_LIB_ONLY"] = True + if is_apple_os(self): + # workaround for: install TARGETS given no BUNDLE DESTINATION for MACOSX_BUNDLE executable + tc.cache_variables["CMAKE_MACOSX_BUNDLE"] = False + tc.variables["BUILD_TESTING"] = False + tc.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() + 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.libs = ["nghttp3"] + if is_msvc(self) and not self.options.shared: + self.cpp_info.defines.append("NGHTTP3_STATICLIB") + + self.cpp_info.set_property("pkg_config_name", "nghttp3") diff --git a/recipes/nghttp3/all/patches/1.2.0-0001-disable-always-static-build.patch b/recipes/nghttp3/all/patches/1.2.0-0001-disable-always-static-build.patch new file mode 100644 index 0000000000000..3f7e1ccd58d6f --- /dev/null +++ b/recipes/nghttp3/all/patches/1.2.0-0001-disable-always-static-build.patch @@ -0,0 +1,20 @@ +diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt +index 3928fb3..18bcb04 100644 +--- a/lib/CMakeLists.txt ++++ b/lib/CMakeLists.txt +@@ -78,6 +78,7 @@ if(ENABLE_SHARED_LIB) + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") + endif() + ++if(ENABLE_STATIC_LIB) + # Static library (for unittests because of symbol visibility) + add_library(nghttp3_static STATIC ${nghttp3_SOURCES}) + set_target_properties(nghttp3_static PROPERTIES +@@ -86,7 +87,6 @@ set_target_properties(nghttp3_static PROPERTIES + ARCHIVE_OUTPUT_NAME nghttp3${STATIC_LIB_SUFFIX} + ) + target_compile_definitions(nghttp3_static PUBLIC "-DNGHTTP3_STATICLIB") +-if(ENABLE_STATIC_LIB) + install(TARGETS nghttp3_static + DESTINATION "${CMAKE_INSTALL_LIBDIR}") + endif() diff --git a/recipes/nghttp3/all/test_package/CMakeLists.txt b/recipes/nghttp3/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..c52d61a995b33 --- /dev/null +++ b/recipes/nghttp3/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES C) + +find_package(nghttp3 REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE nghttp3::nghttp3) diff --git a/recipes/nghttp3/all/test_package/conanfile.py b/recipes/nghttp3/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fb96656f203 --- /dev/null +++ b/recipes/nghttp3/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/nghttp3/all/test_package/test_package.c b/recipes/nghttp3/all/test_package/test_package.c new file mode 100644 index 0000000000000..f093072babb72 --- /dev/null +++ b/recipes/nghttp3/all/test_package/test_package.c @@ -0,0 +1,19 @@ +#include + +#if defined(_MSC_VER) +/* nghttp3 defaults to int */ +typedef int ssize_t; +#endif +#include +#include + +int main() +{ + const nghttp3_info* info = nghttp3_version(NGHTTP3_VERSION_NUM); + if (info) { + printf("nghttp3 ver=%d version=%s\n", info->version_num, info->version_str); + } else { + printf("nghttp3: cannot get version\n"); + } + return 0; +} diff --git a/recipes/nghttp3/config.yml b/recipes/nghttp3/config.yml new file mode 100644 index 0000000000000..882e07adca5bd --- /dev/null +++ b/recipes/nghttp3/config.yml @@ -0,0 +1,17 @@ +versions: + "1.6.0": + folder: all + "1.5.0": + folder: all + "1.4.0": + folder: all + "1.3.0": + folder: all + "1.2.0": + folder: all + "1.1.0": + folder: all + "1.0.0": + folder: all + "0.15.0": + folder: all diff --git a/recipes/nifti_clib/all/conandata.yml b/recipes/nifti_clib/all/conandata.yml new file mode 100644 index 0000000000000..1821fa5866772 --- /dev/null +++ b/recipes/nifti_clib/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "3.0.0": + url: "https://github.com/NIFTI-Imaging/nifti_clib/archive/refs/tags/v3.0.0.tar.gz" + sha256: "fe6cb1076974df01844f3f4dab1aa844953b3bc1d679126c652975158573d03d" diff --git a/recipes/nifti_clib/all/conanfile.py b/recipes/nifti_clib/all/conanfile.py new file mode 100644 index 0000000000000..14e3e3f3e4960 --- /dev/null +++ b/recipes/nifti_clib/all/conanfile.py @@ -0,0 +1,151 @@ +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, rm, rmdir +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +import os + + +required_conan_version = ">=1.53.0" + + +class NiftiClibConan(ConanFile): + name = "nifti_clib" + description = "C libraries for NIFTI support" + license = "LicenseRef-LICENSE" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/NIFTI-Imaging/nifti_clib" + topics = ("image") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "use_nifti2": [True, False], + "use_cifti": [True, False], + "use_fslio": [True, False] + } + default_options = { + "shared": False, + "fPIC": True, + "use_nifti2": True, + "use_cifti": False, # seems to be beta? + "use_fslio": False # Note in CMakeLists.txt: "If OFF, The copyright of this code is questionable for inclusion with nifti." + } + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def validate(self): + if is_msvc(self) and self.options.shared: + # not supported due to not having dllexport definitions + raise ConanInvalidConfiguration(f"{self.ref} does not support -o {self.ref}:shared=True with MSVC compiler.") + if not self.options.use_nifti2 and self.options.use_cifti: + raise ConanInvalidConfiguration(f"{self.ref} -o '&:use_cifti=True' requires -o '&:use_nifti2=True'") + + 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): + self.requires("zlib/[>=1.2.11 <2]") + if self.options.use_cifti: + self.requires("expat/[>=2.6.2 <3]") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["NIFTI_INSTALL_NO_DOCS"] = True + tc.variables["USE_NIFTI2_CODE"] = self.options.use_nifti2 + tc.variables["USE_CIFTI_CODE"] = self.options.use_cifti + tc.variables["USE_FSL_CODE"] = self.options.use_fslio + tc.variables["NIFTI_BUILD_TESTING"] = False # disable building tests + if is_msvc(self): + tc.variables["USE_MSVC_RUNTIME_LIBRARY_DLL"] = not is_msvc_static_runtime(self) + tc.preprocessor_definitions["_CRT_SECURE_NO_WARNINGS"] = 1 + tc.generate() + tc = CMakeDeps(self) + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + 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.set_property("cmake_file_name", "nifti") + self.cpp_info.set_property("cmake_target_name", "NIFTI::NIFTI") + self.cpp_info.set_property("pkg_config_name", "nifti") + self.cpp_info.includedirs += [ os.path.join("include", "nifti") ] + + sys_libs = [] + if self.settings.os in ["Linux", "FreeBSD"]: + sys_libs += ["m"] + + self.cpp_info.required_components = ["ZLIB::ZLIB"] + if self.options.use_cifti: + self.cpp_info.required_components += ["EXPAT::EXPAT"] + + self.cpp_info.components["znz"].libs = ["znz"] + self.cpp_info.components["znz"].set_property("pkg_config_name", "znz") + self.cpp_info.components["znz"].set_property("cmake_target_name", "NIFTI::znz") + self.cpp_info.components["znz"].includedirs += [os.path.join("include", "nifti")] + self.cpp_info.components["znz"].system_libs += sys_libs + + # inside the niftilib folder + self.cpp_info.components["niftiio"].libs = ["niftiio"] + self.cpp_info.components["niftiio"].set_property("pkg_config_name", "niftiio") + self.cpp_info.components["niftiio"].set_property("cmake_target_name", "NIFTI::niftiio") + self.cpp_info.components["niftiio"].includedirs += [os.path.join("include", "nifti")] + self.cpp_info.components["niftiio"].system_libs += sys_libs + + self.cpp_info.components["nifticdf"].libs = ["nifticdf"] + self.cpp_info.components["nifticdf"].requires = ["niftiio"] + self.cpp_info.components["nifticdf"].set_property("pkg_config_name", "nifticdf") + self.cpp_info.components["nifticdf"].set_property("cmake_target_name", "NIFTI::nifticdf") + self.cpp_info.components["nifticdf"].includedirs += [os.path.join("include", "nifti")] + self.cpp_info.components["nifticdf"].system_libs += sys_libs + + if self.options.use_nifti2: + self.cpp_info.components["nifti2"].libs = ["nifti2"] + self.cpp_info.components["nifti2"].requires = ["znz"] + self.cpp_info.components["nifti2"].set_property("pkg_config_name", "nifti2") + self.cpp_info.components["nifti2"].set_property("cmake_target_name", "NIFTI::nifti2") + self.cpp_info.components["nifti2"].includedirs += [os.path.join("include", "nifti")] + self.cpp_info.components["nifti2"].system_libs += sys_libs + + if self.options.use_cifti: + self.cpp_info.components["cifti"].libs = ["cifti"] + self.cpp_info.components["cifti"].requires = ["nifti2"] + self.cpp_info.components["cifti"].set_property("pkg_config_name", "cifti") + self.cpp_info.components["cifti"].set_property("cmake_target_name", "NIFTI::cifti") + self.cpp_info.components["cifti"].includedirs += [os.path.join("include", "nifti")] + self.cpp_info.components["cifti"].system_libs += sys_libs + + if self.options.use_fslio: + self.cpp_info.components["fslio"].libs = ["fslio"] + self.cpp_info.components["fslio"].requires = ["nifti2"] + self.cpp_info.components["fslio"].set_property("pkg_config_name", "fslio") + self.cpp_info.components["fslio"].set_property("cmake_target_name", "NIFTI::fslio") + self.cpp_info.components["fslio"].includedirs += [os.path.join("include", "nifti")] + self.cpp_info.components["fslio"].system_libs += sys_libs diff --git a/recipes/nifti_clib/all/test_package/CMakeLists.txt b/recipes/nifti_clib/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..a63a2b6d3fe16 --- /dev/null +++ b/recipes/nifti_clib/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.15) + +project(test_package LANGUAGES C) + +find_package(NIFTI 3 REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) + +target_link_libraries(${PROJECT_NAME} PRIVATE NIFTI::nifticdf) diff --git a/recipes/nifti_clib/all/test_package/conanfile.py b/recipes/nifti_clib/all/test_package/conanfile.py new file mode 100644 index 0000000000000..ef5d7042163ec --- /dev/null +++ b/recipes/nifti_clib/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/nifti_clib/all/test_package/test_package.c b/recipes/nifti_clib/all/test_package/test_package.c new file mode 100644 index 0000000000000..c1c849f8faf18 --- /dev/null +++ b/recipes/nifti_clib/all/test_package/test_package.c @@ -0,0 +1,9 @@ +#include "nifticdf.h" + +// taken from nifti_clib/real_easy/minimal_example_of_downstream_usage +int main(void) { + double input= 7.0; + const double output = alnrel(&input); + + return (output > 0.0) ? EXIT_SUCCESS: EXIT_FAILURE ; +} diff --git a/recipes/nifti_clib/config.yml b/recipes/nifti_clib/config.yml new file mode 100644 index 0000000000000..3a44950f9d81d --- /dev/null +++ b/recipes/nifti_clib/config.yml @@ -0,0 +1,4 @@ +versions: + # Newer versions at the top + "3.0.0": + folder: all diff --git a/recipes/ninja/all/conandata.yml b/recipes/ninja/all/conandata.yml index 02891869efb97..36f42c6c69771 100644 --- a/recipes/ninja/all/conandata.yml +++ b/recipes/ninja/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "1.12.1": + url: "https://github.com/ninja-build/ninja/archive/v1.12.1.tar.gz" + sha256: "821bdff48a3f683bc4bb3b6f0b5fe7b2d647cf65d52aeb63328c91a6c6df285a" + "1.12.0": + url: "https://github.com/ninja-build/ninja/archive/v1.12.0.tar.gz" + sha256: "8b2c86cd483dc7fcb7975c5ec7329135d210099a89bc7db0590a07b0bbfe49a5" "1.11.1": url: "https://github.com/ninja-build/ninja/archive/v1.11.1.tar.gz" sha256: "31747ae633213f1eda3842686f83c2aa1412e0f5691d1c14dbbcc67fe7400cea" diff --git a/recipes/ninja/all/conanfile.py b/recipes/ninja/all/conanfile.py index d1a9ba2c4828e..5e97a00b8feff 100644 --- a/recipes/ninja/all/conanfile.py +++ b/recipes/ninja/all/conanfile.py @@ -1,6 +1,6 @@ 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.files import copy, get, replace_in_file from conan.tools.scm import Version import os @@ -24,12 +24,19 @@ 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") + + #prevent re2c (which is optional and not needed) from being used + replace_in_file(self, cmakelists, "if(RE2C)", "if(FALSE)") def generate(self): tc = CMakeToolchain(self) tc.variables["BUILD_TESTING"] = False + if self.settings.os == "Linux" and "libstdc++" in self.settings.compiler.libcxx: + # Link C++ library statically on Linux so that it can run on systems + # with an older C++ runtime + tc.cache_variables["CMAKE_EXE_LINKER_FLAGS"] = "-static-libstdc++ -static-libgcc" tc.generate() def build(self): diff --git a/recipes/ninja/config.yml b/recipes/ninja/config.yml index 0a0061dfb232d..8d14bc8f88871 100644 --- a/recipes/ninja/config.yml +++ b/recipes/ninja/config.yml @@ -1,4 +1,8 @@ versions: + "1.12.1": + folder: all + "1.12.0": + folder: all "1.11.1": folder: all "1.11.0": diff --git a/recipes/nlohmann_json/all/conandata.yml b/recipes/nlohmann_json/all/conandata.yml index 6d20bef200f0e..971d0191590f9 100644 --- a/recipes/nlohmann_json/all/conandata.yml +++ b/recipes/nlohmann_json/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.11.3": + url: "https://github.com/nlohmann/json/archive/v3.11.3.tar.gz" + sha256: "0d8ef5af7f9794e3263480193c491549b2ba6cc74bb018906202ada498a79406" "3.11.2": url: "https://github.com/nlohmann/json/archive/v3.11.2.tar.gz" sha256: "d69f9deb6a75e2580465c6c4c5111b89c4dc2fa94e3a85fcd2ffcd9a143d9273" @@ -38,6 +41,9 @@ sources: "3.7.0": sha256: D51A3A8D3EFBB1139D7608E28782EA9EFEA7E7933157E8FF8184901EFD8EE760 url: https://github.com/nlohmann/json/archive/v3.7.0.tar.gz + "3.5.0": + sha256: E0B1FC6CC6CA05706CCE99118A87ACA5248BD9DB3113E703023D23F044995C1D + url: https://github.com/nlohmann/json/archive/v3.5.0.tar.gz "3.4.0": sha256: C377963A95989270C943D522BFEFE7B889EF5ED0E1E15D535FD6F6F16ED70732 url: https://github.com/nlohmann/json/archive/v3.4.0.tar.gz diff --git a/recipes/nlohmann_json/all/conanfile.py b/recipes/nlohmann_json/all/conanfile.py index 83bc77059e036..98eaf15380fff 100644 --- a/recipes/nlohmann_json/all/conanfile.py +++ b/recipes/nlohmann_json/all/conanfile.py @@ -14,6 +14,7 @@ class NlohmannJsonConan(ConanFile): topics = "json", "header-only" url = "https://github.com/conan-io/conan-center-index" license = "MIT" + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -32,8 +33,7 @@ def validate(self): 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): pass diff --git a/recipes/nlohmann_json/config.yml b/recipes/nlohmann_json/config.yml index f26a7154dd392..ad526c439b84b 100644 --- a/recipes/nlohmann_json/config.yml +++ b/recipes/nlohmann_json/config.yml @@ -1,4 +1,6 @@ versions: + "3.11.3": + folder: all "3.11.2": folder: all "3.11.1": @@ -25,6 +27,8 @@ versions: folder: all "3.7.0": folder: all + "3.5.0": + folder: all "3.4.0": folder: all "3.2.0": 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/nmea/all/CMakeLists.txt b/recipes/nmea/all/CMakeLists.txt new file mode 100644 index 0000000000000..75b13231e08ae --- /dev/null +++ b/recipes/nmea/all/CMakeLists.txt @@ -0,0 +1,67 @@ +cmake_minimum_required(VERSION 3.15) + +project(nmea LANGUAGES C) + +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + +add_library(${PROJECT_NAME}) + +set(NMEA_INCLUDE_DIR ${NMEA_ROOT_DIR}/include) +set(NMEA_SRC_DIR ${NMEA_ROOT_DIR}/src) + +target_sources( + ${PROJECT_NAME} + PRIVATE + ${NMEA_SRC_DIR}/context.c + ${NMEA_SRC_DIR}/generate.c + ${NMEA_SRC_DIR}/generator.c + ${NMEA_SRC_DIR}/gmath.c + ${NMEA_SRC_DIR}/info.c + ${NMEA_SRC_DIR}/parse.c + ${NMEA_SRC_DIR}/parser.c + ${NMEA_SRC_DIR}/sentence.c + ${NMEA_SRC_DIR}/time.c + ${NMEA_SRC_DIR}/tok.c +) + +target_include_directories( + ${PROJECT_NAME} + PUBLIC + ${NMEA_INCLUDE_DIR} +) + +set( + NMEA_HEADERS + ${NMEA_INCLUDE_DIR}/${PROJECT_NAME}/config.h + ${NMEA_INCLUDE_DIR}/${PROJECT_NAME}/context.h + ${NMEA_INCLUDE_DIR}/${PROJECT_NAME}/generate.h + ${NMEA_INCLUDE_DIR}/${PROJECT_NAME}/generator.h + ${NMEA_INCLUDE_DIR}/${PROJECT_NAME}/gmath.h + ${NMEA_INCLUDE_DIR}/${PROJECT_NAME}/info.h + ${NMEA_INCLUDE_DIR}/${PROJECT_NAME}/nmea.h + ${NMEA_INCLUDE_DIR}/${PROJECT_NAME}/parse.h + ${NMEA_INCLUDE_DIR}/${PROJECT_NAME}/parser.h + ${NMEA_INCLUDE_DIR}/${PROJECT_NAME}/sentence.h + ${NMEA_INCLUDE_DIR}/${PROJECT_NAME}/time.h + ${NMEA_INCLUDE_DIR}/${PROJECT_NAME}/tok.h + ${NMEA_INCLUDE_DIR}/${PROJECT_NAME}/units.h +) + +set_target_properties( + ${PROJECT_NAME} + PROPERTIES + PUBLIC_HEADER "${NMEA_HEADERS}" + C_EXTENSIONS OFF +) + +find_library(LIBM m) +target_link_libraries(${PROJECT_NAME} PRIVATE $<$:${LIBM}>) + +include(GNUInstallDirs) +install( + TARGETS ${PROJECT_NAME} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME} +) diff --git a/recipes/nmea/all/conandata.yml b/recipes/nmea/all/conandata.yml new file mode 100644 index 0000000000000..11255f314caf5 --- /dev/null +++ b/recipes/nmea/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.5.3": + url: "http://downloads.sourceforge.net/nmea/nmealib-0.5.3.zip" + sha256: "41e9fbb8fd5cb1836ff727355b3debe98662b39beb7493af9b78bc4bd4a2ad7d" diff --git a/recipes/nmea/all/conanfile.py b/recipes/nmea/all/conanfile.py new file mode 100644 index 0000000000000..17706f598b456 --- /dev/null +++ b/recipes/nmea/all/conanfile.py @@ -0,0 +1,67 @@ +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 NmeaConan(ConanFile): + name = "nmea" + description = "Library to work with NMEA protocol" + license = "LGPL-2.1-only" + url = "https://github.com/conan-io/conan-center-index" + homepage = "http://nmea.sourceforge.net/" + topics = ("nmea", "geospatial", "gnss", "gps", "navigation") + 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): + 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: + 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) + tc.variables["NMEA_ROOT_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.append(self.name) + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") diff --git a/recipes/nmea/all/test_package/CMakeLists.txt b/recipes/nmea/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..0fc5503253f05 --- /dev/null +++ b/recipes/nmea/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) + +project(test_package C) + +find_package(nmea REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE nmea::nmea) diff --git a/recipes/nmea/all/test_package/conanfile.py b/recipes/nmea/all/test_package/conanfile.py new file mode 100644 index 0000000000000..ef5d7042163ec --- /dev/null +++ b/recipes/nmea/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/nmea/all/test_package/test_package.c b/recipes/nmea/all/test_package/test_package.c new file mode 100644 index 0000000000000..2c83a9e9a35fb --- /dev/null +++ b/recipes/nmea/all/test_package/test_package.c @@ -0,0 +1,9 @@ +#include + +#include + +int main() +{ + printf("%f", nmea_degree2radian(180.0)); + return 0; +} diff --git a/recipes/nmea/config.yml b/recipes/nmea/config.yml new file mode 100644 index 0000000000000..2a0554e18df80 --- /dev/null +++ b/recipes/nmea/config.yml @@ -0,0 +1,3 @@ +versions: + "0.5.3": + folder: all diff --git a/recipes/nmos-cpp/all/conandata.yml b/recipes/nmos-cpp/all/conandata.yml index 94817c0d8466a..48f839443ae06 100644 --- a/recipes/nmos-cpp/all/conandata.yml +++ b/recipes/nmos-cpp/all/conandata.yml @@ -1,5 +1,8 @@ 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.20240223": + url: "https://github.com/sony/nmos-cpp/archive/27dff31919e06a132651291648293ff7b6b38b38.tar.gz" + sha256: "25c5fec843c9ced8061231b44f00942886766008ddbb171b351bf5616c07eccc" "cci.20221203": url: "https://github.com/sony/nmos-cpp/archive/0fb6b51737f737ae011cbcc39cdfb2c5236ec59f.tar.gz" sha256: "9e811b2707afe084c4470fcaa5664f57468fd03e86b1eebd03ec9216cf31cac1" diff --git a/recipes/nmos-cpp/all/conanfile.py b/recipes/nmos-cpp/all/conanfile.py index be9549d77d691..82bc34f86af52 100644 --- a/recipes/nmos-cpp/all/conanfile.py +++ b/recipes/nmos-cpp/all/conanfile.py @@ -2,6 +2,7 @@ from conan.errors import ConanInvalidConfiguration from conan.tools import build, files from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.scm import Version import json import os import re @@ -16,6 +17,8 @@ class NmosCppConan(ConanFile): homepage = "https://github.com/sony/nmos-cpp" topics = ("amwa", "nmos", "is-04", "is-05", "is-07", "is-08", "is-09", "broadcasting", "network", "media") + # https://github.com/sony/nmos-cpp/blob/master/Development/cmake/NmosCppLibraries.cmake#L947 + package_type = "static-library" settings = "os", "compiler", "build_type", "arch" # for now, no "shared" option support options = { @@ -46,13 +49,16 @@ def config_options(self): def requirements(self): # for now, consistent with project's conanfile.txt - self.requires("boost/1.80.0") - self.requires("cpprestsdk/2.10.18") + # INFO: details/system_error.h: #include + self.requires("boost/1.83.0", transitive_headers=True) + # INFO: json_ops.h exposes cpprest/json.h + self.requires("cpprestsdk/2.10.19", transitive_headers=True) self.requires("websocketpp/0.8.2") - 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") + self.requires("openssl/[>=1.1 <4]") + self.requires("json-schema-validator/2.3.0") + self.requires("nlohmann_json/3.11.3") + if Version(self.version) >= "cci.20240222": + self.requires("jwt-cpp/0.7.0") if self.options.get_safe("with_dnssd") == "mdnsresponder": self.requires("mdnsresponder/878.200.35") @@ -64,8 +70,7 @@ def requirements(self): self.requires("avahi/0.8") def build_requirements(self): - # nmos-cpp needs CMake 3.17 or higher but CCI doesn't allow version ranges - self.build_requires("cmake/3.24.2") + self.tool_requires("cmake/[>=3.17 <4]") def validate(self): if self.info.settings.os in ["Macos"]: @@ -73,10 +78,6 @@ def validate(self): 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") @@ -125,7 +126,7 @@ def _create_components_file_from_cmake_target_file(self, 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) + cmake_functions = re.findall(r"(?Padd_executable|add_library|set_target_properties)[\n|\s]*\([\n|\s]*(?P[^)]*)\)", target_content) for (cmake_function_name, cmake_function_args) in cmake_functions: cmake_function_args = re.split(r"[\s|\n]+", cmake_function_args, maxsplit=2) @@ -138,7 +139,9 @@ def _create_components_file_from_cmake_target_file(self, target_file_path): components.setdefault(component_name, {"cmake_target": cmake_target_nonamespace}) - if cmake_function_name == "add_library": + if cmake_function_name == "add_executable": + components[component_name]["exe"] = True + elif cmake_function_name == "add_library": cmake_imported_target_type = cmake_function_args[1] if cmake_imported_target_type in ["STATIC", "SHARED"]: # library filenames are based on the target name by default @@ -209,6 +212,11 @@ def _create_components_file_from_cmake_target_file(self, target_file_path): else: self.output.warn(f"{self.name} recipe does not handle {property_type} (yet)") + # until https://github.com/sony/nmos-cpp/commit/9489d84098ddc8cc514b7e4d5afe740dee4518ee + # direct dependency on nlohmann_json was missing + if Version(self.version) < "cci.20221203": + components["json_schema_validator"].setdefault("requires", []).append("nlohmann_json::nlohmann_json") + # Save components informations in json file with open(self._components_helper_filepath, "w", encoding="utf-8") as json_file: json.dump(components, json_file, indent=4) @@ -235,6 +243,7 @@ def _register_components(): cmake_target = values["cmake_target"] self.cpp_info.components[component_name].names["cmake_find_package"] = cmake_target self.cpp_info.components[component_name].names["cmake_find_package_multi"] = cmake_target + self.cpp_info.components[component_name].bindirs = [bindir] if values.get("exe") else [] self.cpp_info.components[component_name].libs = values.get("libs", []) self.cpp_info.components[component_name].libdirs = [libdir] self.cpp_info.components[component_name].defines = values.get("defines", []) @@ -252,5 +261,4 @@ 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(f"Appending PATH environment variable: {bin_path}") self.env_info.PATH.append(bin_path) diff --git a/recipes/nmos-cpp/all/test_package/conanfile.py b/recipes/nmos-cpp/all/test_package/conanfile.py index dbb752cd0c9a2..14f7348224835 100644 --- a/recipes/nmos-cpp/all/test_package/conanfile.py +++ b/recipes/nmos-cpp/all/test_package/conanfile.py @@ -2,9 +2,6 @@ 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 class NmosCppTestPackageConan(ConanFile): @@ -25,30 +22,5 @@ def build(self): def test(self): 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", encoding="utf-8") as config: - config.write('{"http_port": 20000, "domain": "local.", "highest_pri": 51967, "lowest_pri": 51967}') - - # 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) - - # run the test_package node which should have time to register and then exit - node_out = StringIO() - try: - 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(): - 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())) + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/nmos-cpp/all/test_package/test_package.cpp b/recipes/nmos-cpp/all/test_package/test_package.cpp index 56040987cfeb9..38ff2077350ec 100644 --- a/recipes/nmos-cpp/all/test_package/test_package.cpp +++ b/recipes/nmos-cpp/all/test_package/test_package.cpp @@ -1,40 +1,17 @@ -#include -#include -#include "cpprest/json_utils.h" -#include "nmos/id.h" -#include "nmos/log_gate.h" -#include "nmos/model.h" -#include "nmos/node_resource.h" -#include "nmos/node_server.h" -#include "nmos/server.h" +#include +#include "cpprest/http_utils.h" -const web::json::field_with_default how_long{ U("how_long"), 2000 }; -int main(int argc, char* argv[]) -{ - nmos::node_model node_model; - nmos::experimental::log_model log_model; - nmos::experimental::log_gate gate(std::cerr, std::cout, log_model); - nmos::experimental::node_implementation node_implementation; +int main() { - if (argc > 1) - { - std::ifstream file(argv[1]); - node_model.settings = web::json::value::parse(file); - } - nmos::insert_node_default_settings(node_model.settings); + web::http::http_request request; - auto node_server = nmos::experimental::make_node_server(node_model, node_implementation, log_model, gate); - nmos::insert_resource(node_model.node_resources, nmos::make_node(nmos::make_id(), node_model.settings)); + request.headers().add(U("Host"), U("foobar")); + request.headers().add(U("X-Forwarded-Host"), U("baz, qux:57")); - try - { - nmos::server_guard node_server_guard(node_server); - std::this_thread::sleep_for(std::chrono::milliseconds(how_long(node_model.settings))); - } - catch (const std::exception& e) - { - slog::log(gate, SLOG_FLF) << "Exception: " << e.what(); + if (web::http::has_header_value(request.headers(), U("foo"), 42)) { + return EXIT_FAILURE; } - return 0; + + return EXIT_SUCCESS; } diff --git a/recipes/nmos-cpp/all/test_v1_package/conanfile.py b/recipes/nmos-cpp/all/test_v1_package/conanfile.py index bc0089a6ae374..2df20034f628d 100644 --- a/recipes/nmos-cpp/all/test_v1_package/conanfile.py +++ b/recipes/nmos-cpp/all/test_v1_package/conanfile.py @@ -1,11 +1,9 @@ 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): @@ -14,30 +12,6 @@ def build(self): 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())) + 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/nmos-cpp/config.yml b/recipes/nmos-cpp/config.yml index 1ebebe8a73c09..9cc517e0f52ae 100644 --- a/recipes/nmos-cpp/config.yml +++ b/recipes/nmos-cpp/config.yml @@ -1,4 +1,6 @@ versions: + "cci.20240223": + folder: all "cci.20221203": folder: all "cci.20220620": diff --git a/recipes/nmslib/all/CMakeLists.txt b/recipes/nmslib/all/CMakeLists.txt deleted file mode 100644 index c8e560d40aa56..0000000000000 --- a/recipes/nmslib/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) - -add_subdirectory(source_subfolder/similarity_search) diff --git a/recipes/nmslib/all/conandata.yml b/recipes/nmslib/all/conandata.yml index bc747087c62bd..a76e6327ac2f8 100644 --- a/recipes/nmslib/all/conandata.yml +++ b/recipes/nmslib/all/conandata.yml @@ -4,11 +4,7 @@ sources: sha256: d1f5c60a62e0e61e14c92b37d6f1420ed4bb3c6fd19ced67c84b7e0e0e3f07c5 patches: "2.1.1": - - base_path: source_subfolder - patch_file: patches/0001-cmake-disable-app-build.patch - - base_path: source_subfolder - patch_file: patches/0002-cmake-fix-install.patch - - base_path: source_subfolder - patch_file: patches/0003-cmake-fix-flags.patch - - base_path: source_subfolder - patch_file: patches/0004-missing-utils-header.patch + - patch_file: patches/0001-cmake-disable-app-build.patch + - patch_file: patches/0002-cmake-fix-install.patch + - patch_file: patches/0003-cmake-fix-flags.patch + - patch_file: patches/0004-missing-utils-header.patch diff --git a/recipes/nmslib/all/conanfile.py b/recipes/nmslib/all/conanfile.py index 637febf0d43bb..339645c679763 100644 --- a/recipes/nmslib/all/conanfile.py +++ b/recipes/nmslib/all/conanfile.py @@ -1,66 +1,111 @@ import os -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 apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file +from conan.tools.microsoft import is_msvc, check_min_vs + +required_conan_version = ">=1.53.0" class Nmslib(ConanFile): name = "nmslib" + description = ( + "Non-Metric Space Library (NMSLIB): An efficient similarity search library " + "and a toolkit for evaluation of k-NN methods for generic non-metric spaces." + ) + license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/nmslib/nmslib" - description = "Non-Metric Space Library (NMSLIB): An efficient similarity search library and a toolkit for evaluation of k-NN methods for generic non-metric spaces." topics = ("knn-search", "non-metric", "neighborhood-graphs", "neighborhood-graphs", "vp-tree") - license = "Apache-2.0" + + package_type = "library" settings = "os", "arch", "compiler", "build_type" - options = {"shared": [True, False], "fPIC": [True, False]} - default_options = {"shared": False, "fPIC": True} - exports_sources = "CMakeLists.txt", "patches/**" - generators = "cmake" + options = { + "shared": [True, False], + "fPIC": [True, False], + "build_extras": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "build_extras": True, + } + options_description = { + "build_extras": "Add support for Signature Quadratic Form Distance (SQFD). Not supported on MSVC.", + } - _cmake = None + def export_sources(self): + export_conandata_patches(self) - def validate(self): - if self.settings.compiler == "Visual Studio": - if self.settings.compiler.version == "14": - raise ConanInvalidConfiguration("Visual Studio 14 builds are not supported") # TODO: add reason in message - if self.options.shared: - raise ConanInvalidConfiguration("Visual Studio shared builds are not supported (.lib artifacts missing)") + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + if is_msvc(self): + # Not available on MSVC + # https://github.com/nmslib/nmslib/blob/v2.1.1/similarity_search/include/space/space_sqfd.h#L19 + del self.options.build_extras 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 requirements(self): + if self.options.get_safe("build_extras"): + # Eigen is only used internally, no need for transitive_* + self.requires("eigen/3.4.0") - @property - def _source_subfolder(self): - return "source_subfolder" + def validate(self): + check_min_vs(self, 190) # TODO: add reason in message + if is_msvc(self) and self.options.shared: + raise ConanInvalidConfiguration( + "Visual Studio shared builds are not supported (.lib artifacts missing)" + ) 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): + tc = CMakeToolchain(self) + tc.variables["WITH_EXTRAS"] = self.options.get_safe("build_extras", False) + tc.variables["WITHOUT_TESTS"] = True + # Relocatable shared libs on macOS + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" + tc.generate() + deps = CMakeDeps(self) + deps.generate() - def _configure_cmake(self): - if self._cmake is None: - cmake = CMake(self) - cmake.definitions["WITHOUT_TESTS"] = True - cmake.configure() - self._cmake = cmake - return self._cmake + def _patch_sources(self): + apply_conandata_patches(self) + replace_in_file(self, os.path.join(self.source_folder, "similarity_search", "CMakeLists.txt"), + "EIGEN3", "Eigen3") + # The finite-math-only optimization has no effect and can cause linking errors + # when linked against glibc >= 2.31 + replace_in_file(self, os.path.join(self.source_folder, "similarity_search", "CMakeLists.txt"), + "-Ofast", "-Ofast -fno-finite-math-only") 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, "similarity_search")) cmake.build() def package(self): - self.copy(pattern="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() def package_info(self): self.cpp_info.libs = ["NonMetricSpaceLib"] - if self.settings.os == "Linux": - self.cpp_info.system_libs = ["pthread"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs = ["pthread", "m"] + if self.settings.arch in ["x86", "x86_64"]: + self.cpp_info.system_libs.append("mvec") + if self.options.get_safe("build_extras"): + self.cpp_info.defines.append("WITH_EXTRAS") diff --git a/recipes/nmslib/all/test_package/CMakeLists.txt b/recipes/nmslib/all/test_package/CMakeLists.txt index 7b52b10445744..a7336347af2da 100644 --- a/recipes/nmslib/all/test_package/CMakeLists.txt +++ b/recipes/nmslib/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - find_package(nmslib REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/nmslib/all/test_package/conanfile.py b/recipes/nmslib/all/test_package/conanfile.py index abcaeed3f89b6..ef5d7042163ec 100644 --- a/recipes/nmslib/all/test_package/conanfile.py +++ b/recipes/nmslib/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.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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/nmslib/all/test_v1_package/CMakeLists.txt b/recipes/nmslib/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/nmslib/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/nmslib/all/test_v1_package/conanfile.py b/recipes/nmslib/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..abcaeed3f89b6 --- /dev/null +++ b/recipes/nmslib/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.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/nng/all/CMakeLists.txt b/recipes/nng/all/CMakeLists.txt deleted file mode 100644 index 1848ca5a77c35..0000000000000 --- a/recipes/nng/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/nng/all/conandata.yml b/recipes/nng/all/conandata.yml index 696247a65e1e7..2232f4892fec8 100644 --- a/recipes/nng/all/conandata.yml +++ b/recipes/nng/all/conandata.yml @@ -1,4 +1,25 @@ sources: + "1.9.0": + url: "https://github.com/nanomsg/nng/archive/refs/tags/v1.9.0.tar.gz" + sha256: "ff882bda0a854abd184a7c1eb33329e526928ef98e80ef0457dd9a708bb5b0b1" + "1.8.0": + url: "https://github.com/nanomsg/nng/archive/refs/tags/v1.8.0.tar.gz" + sha256: "cfacfdfa35c1618a28bb940e71f774a513dcb91292999696b4346ad8bfb5baff" + "1.7.3": + url: "https://github.com/nanomsg/nng/archive/refs/tags/v1.7.3.tar.gz" + sha256: "035f2c3cad4e45fc0d978c54a338c197d1937527ae6feb82180d428a96b83474" + "1.7.2": + url: "https://github.com/nanomsg/nng/archive/refs/tags/v1.7.2.tar.gz" + sha256: "40e6af7bdd5d02ee98ba8fe5fd5c149ce3e5a555f202cdc837e3ead2d7cc7534" + "1.7.1": + url: "https://github.com/nanomsg/nng/archive/refs/tags/v1.7.1.tar.gz" + sha256: "b62b2170d2b4757f9f01fb65e5aa9f078dec726735e9de5ed5d7e332cbbbf2ef" + "1.7.0": + url: "https://github.com/nanomsg/nng/archive/refs/tags/v1.7.0.tar.gz" + sha256: "668325161637a0debcf7fb4340919b81e74b66d38bc7a663e8b55b7e0abd7f57" + "1.6.0": + url: "https://github.com/nanomsg/nng/archive/refs/tags/v1.6.0.tar.gz" + sha256: "f639e77911ef935a13e9779d4a18d45490433ba744f89752a15b84c929ce2725" "1.5.2": url: "https://github.com/nanomsg/nng/archive/refs/tags/v1.5.2.tar.gz" sha256: "f8b25ab86738864b1f2e3128e8badab581510fa8085ff5ca9bb980d317334c46" @@ -8,22 +29,14 @@ sources: "1.3.2": url: "https://github.com/nanomsg/nng/archive/v1.3.2.tar.gz" sha256: "0f8f2ede7f5ea2018c7fa615c76f48662eb06d39c71c3339f8ff38da44470855" - "1.3.1": - url: "https://github.com/nanomsg/nng/archive/v1.3.1.tar.gz" - sha256: "3f258514b6aed931485ce1a6e5745e07416d32e6c4315ae771ff358e9fd18e55" - "1.3.0": - url: "https://github.com/nanomsg/nng/archive/v1.3.0.tar.gz" - sha256: "e8fe50d0f79ec3243733f8b4c25099c88b2597ed1bb0d94a27c4385a2a24ecac" patches: "1.5.1": - patch_file: patches/0001-fix-ios-tvos-watchos-1.5.1.patch - base_path: source_subfolder + patch_description: "add support iOS, tvOS and watchOS" + patch_type: "portability" + patch_source: "https://github.com/nanomsg/nng/pull/1474" "1.3.2": - patch_file: patches/0001-fix-ios-tvos-watchos-1.3.1.patch - base_path: source_subfolder - "1.3.1": - - patch_file: patches/0001-fix-ios-tvos-watchos-1.3.1.patch - base_path: source_subfolder - "1.3.0": - - patch_file: patches/0001-fix-ios-tvos-watchos-1.3.0.patch - base_path: source_subfolder + patch_description: "add support iOS, tvOS and watchOS" + patch_type: "portability" + patch_source: "https://github.com/nanomsg/nng/pull/1474" diff --git a/recipes/nng/all/conanfile.py b/recipes/nng/all/conanfile.py index 413698774bc7b..2f960488b2d41 100644 --- a/recipes/nng/all/conanfile.py +++ b/recipes/nng/all/conanfile.py @@ -1,18 +1,21 @@ -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.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 NngConan(ConanFile): name = "nng" description = "nanomsg-next-generation: light-weight brokerless messaging" + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/nanomsg/nng" - license = "MIT" topics = ("nanomsg", "communication", "messaging", "protocols") - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -20,7 +23,12 @@ class NngConan(ConanFile): "nngcat": [True, False], "http": [True, False], "tls": [True, False], - "max_taskq_threads": "ANY" + "max_taskq_threads": ["ANY"], + "max_expire_threads": ["ANY"], + "max_poller_threads": ["ANY"], + "compat": [True, False], + "with_ipv6": [True, False], + "tls_engine": ["mbed", "wolf"], } default_options = { "shared": False, @@ -28,88 +36,118 @@ class NngConan(ConanFile): "nngcat": False, "http": True, "tls": False, - "max_taskq_threads": "16" + "max_taskq_threads": "16", + "max_expire_threads": "8", + "max_poller_threads": "8", + "compat": True, + "with_ipv6": True, + "tls_engine": "mbed", } - generators = "cmake" - _cmake = None - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) - - @property - def _source_subfolder(self): - return "source_subfolder" + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + if Version(self.version) < "1.6.0": + del self.options.max_expire_threads + if Version(self.version) < "1.7.0": + del self.options.max_poller_threads + if Version(self.version) < "1.7.2": + del self.options.compat + if Version(self.version) < "1.7.3": + del self.options.with_ipv6 + if Version(self.version) < "1.9.0": + del self.options.tls_engine 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.tls: - if tools.Version(self.version) < "1.5.2": - self.requires("mbedtls/2.25.0") - else: - self.requires("mbedtls/3.0.0") + tls_engine = self.options.get_safe("tls_engine", "mbed") + if tls_engine == "mbed": + if Version(self.version) < "1.5.2": + self.requires("mbedtls/2.25.0") + else: + self.requires("mbedtls/3.5.2") + elif tls_engine == "wolf": + self.requires("wolfssl/5.7.2") def validate(self): - if self.settings.compiler == "Visual Studio" and \ - tools.Version(self.settings.compiler.version) < 14: - raise ConanInvalidConfiguration("MSVC < 14 is not supported") + compiler_minimum_version = { + "Visual Studio": "14", + "msvc": "190", + } + minimum_version = compiler_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.settings.compiler} < {minimum_version} is not supported", + ) if not self.options.max_taskq_threads.value.isdigit(): raise ConanInvalidConfiguration("max_taskq_threads must be an integral number") + if "max_expire_threads" in self.options and not self.options.max_expire_threads.value.isdigit(): + raise ConanInvalidConfiguration("max_expire_threads must be an integral number") + if "max_poller_threads" in self.options and not self.options.max_poller_threads.value.isdigit(): + raise ConanInvalidConfiguration("max_poller_threads must be an integral number") 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["NNG_TESTS"] = False - self._cmake.definitions["NNG_ENABLE_TLS"] = self.options.tls - self._cmake.definitions["NNG_ENABLE_NNGCAT"] = self.options.nngcat - self._cmake.definitions["NNG_ENABLE_HTTP"] = self.options.http - self._cmake.definitions["NNG_MAX_TASKQ_THREADS"] = self.options.max_taskq_threads - - 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["NNG_TESTS"] = False + tc.variables["NNG_ENABLE_TLS"] = self.options.tls + tc.variables["NNG_ENABLE_NNGCAT"] = self.options.nngcat + tc.variables["NNG_ENABLE_HTTP"] = self.options.http + tc.variables["NNG_MAX_TASKQ_THREADS"] = self.options.max_taskq_threads + if "max_expire_threads" in self.options: + tc.variables["NNG_MAX_EXPIRE_THREADS"] = self.options.max_expire_threads + if "max_poller_threads" in self.options: + tc.variables["NNG_MAX_POLLER_THREADS"] = self.options.max_poller_threads + if "compat" in self.options: + tc.variables["NNG_ENABLE_COMPAT"] = self.options.compat + if "with_ipv6" in self.options: + tc.variables["NNG_ENABLE_IPV6"] = self.options.with_ipv6 + tc.variables["NNG_TLS_ENGINE"] = self.options.get_safe("tls_engine", "mbed") + 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, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): - self.cpp_info.names["cmake_find_package"] = "nng" - self.cpp_info.names["cmake_find_package_multi"] = "nng" + self.cpp_info.set_property("cmake_file_name", "nng") + self.cpp_info.set_property("cmake_target_name", "nng::nng") + self.cpp_info.libs = ["nng"] if self.settings.os == "Windows" and not self.options.shared: self.cpp_info.system_libs.extend(["mswsock", "ws2_32"]) elif self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.system_libs.extend(["pthread"]) + self.cpp_info.system_libs.extend(["pthread", "rt", "nsl"]) if self.options.shared: self.cpp_info.defines.append("NNG_SHARED_LIB") else: self.cpp_info.defines.append("NNG_STATIC_LIB") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.names["cmake_find_package"] = "nng" + self.cpp_info.names["cmake_find_package_multi"] = "nng" diff --git a/recipes/nng/all/patches/0001-fix-ios-tvos-watchos-1.3.0.patch b/recipes/nng/all/patches/0001-fix-ios-tvos-watchos-1.3.0.patch deleted file mode 100644 index 3b71e923ae407..0000000000000 --- a/recipes/nng/all/patches/0001-fix-ios-tvos-watchos-1.3.0.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -214,7 +214,7 @@ elseif (CMAKE_SYSTEM_NAME MATCHES "Android") - add_definitions(-DNNG_USE_EVENTFD) - set(NNG_PLATFORM_POSIX ON) - --elseif (CMAKE_SYSTEM_NAME MATCHES "Darwin") -+elseif (APPLE) - add_definitions(-DNNG_PLATFORM_POSIX) - add_definitions(-DNNG_PLATFORM_DARWIN) - set(NNG_PLATFORM_POSIX ON) diff --git a/recipes/nng/all/test_package/CMakeLists.txt b/recipes/nng/all/test_package/CMakeLists.txt index fd72be19f00b1..7a60c8282db34 100644 --- a/recipes/nng/all/test_package/CMakeLists.txt +++ b/recipes/nng/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) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES C) find_package(nng REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} nng::nng) +target_link_libraries(${PROJECT_NAME} PRIVATE nng::nng) diff --git a/recipes/nng/all/test_package/conanfile.py b/recipes/nng/all/test_package/conanfile.py index 49a3a66ea5bad..a9fb96656f203 100644 --- a/recipes/nng/all/test_package/conanfile.py +++ b/recipes/nng/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/nng/all/test_v1_package/CMakeLists.txt b/recipes/nng/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/nng/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/nng/all/test_v1_package/conanfile.py b/recipes/nng/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..d4a99c7cba3ed --- /dev/null +++ b/recipes/nng/all/test_v1_package/conanfile.py @@ -0,0 +1,22 @@ +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): + cache = os.path.join(self.build_folder, "CMakeCache.txt") + if os.path.exists(cache): + self.output.info(f"Removing {cache}") + os.remove(cache) + 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/nng/config.yml b/recipes/nng/config.yml index ba169426f19de..a216ebf04278c 100644 --- a/recipes/nng/config.yml +++ b/recipes/nng/config.yml @@ -1,11 +1,21 @@ versions: + "1.9.0": + folder: all + "1.8.0": + folder: all + "1.7.3": + folder: all + "1.7.2": + folder: all + "1.7.1": + folder: all + "1.7.0": + folder: all + "1.6.0": + folder: all "1.5.2": folder: all "1.5.1": folder: all "1.3.2": folder: all - "1.3.1": - folder: all - "1.3.0": - folder: all diff --git a/recipes/nodejs/all/conandata.yml b/recipes/nodejs/all/conandata.yml index 21b79e6148a9b..da170c70c328b 100644 --- a/recipes/nodejs/all/conandata.yml +++ b/recipes/nodejs/all/conandata.yml @@ -1,30 +1,73 @@ sources: - "12.14.1": + "20.16.0": Windows: "x86_64": - url: "https://nodejs.org/dist/v12.14.1/node-v12.14.1-win-x64.zip" - sha256: "1f96ccce3ba045ecea3f458e189500adb90b8bc1a34de5d82fc10a5bf66ce7e3" + url: "https://nodejs.org/dist/v20.16.0/node-v20.16.0-win-x64.zip" + sha256: "4e88373ac5ae859ad4d50cc3c5fa86eb3178d089b72e64c4dbe6eeac5d7b5979" + "armv8": + url: "https://nodejs.org/dist/v20.16.0/node-v20.16.0-win-arm64.zip" + sha256: "af5a85ea299fcebd34c3c726a47a926e73171f9b657a6eaa796c011597241bf8" Linux: "x86_64": - url: "https://nodejs.org/dist/v12.14.1/node-v12.14.1-linux-x64.tar.xz" - sha256: "07cfcaa0aa9d0fcb6e99725408d9e0b07be03b844701588e3ab5dbc395b98e1b" + url: "https://nodejs.org/dist/v20.16.0/node-v20.16.0-linux-x64.tar.xz" + sha256: "c30af7dfea46de7d8b9b370fa33b8b15440bc93f0a686af8601bbb48b82f16c0" + "armv7": + url: "https://nodejs.org/dist/v20.16.0/node-v20.16.0-linux-armv7l.tar.xz" + sha256: "a23a49029e8c7788c701eb3ace553260b7676a5a2ea9965ba92e4817008fbefe" + "armv8": + url: "https://nodejs.org/dist/v20.16.0/node-v20.16.0-linux-arm64.tar.xz" + sha256: "1d9929e72f692179f884cd676b2dfabd879cb77defa7869dc8cfc802619277fb" Macos: "x86_64": - url: "https://nodejs.org/dist/v12.14.1/node-v12.14.1-darwin-x64.tar.gz" - sha256: "0be10a28737527a1e5e3784d3ad844d742fe8b0718acd701fd48f718fd3af78f" - "13.6.0": + url: "https://nodejs.org/dist/v20.16.0/node-v20.16.0-darwin-x64.tar.gz" + sha256: "e18942cd706e4d69a4845ddacee2f1c17a72e853a229e3d2623d2edeb7efde72" + "armv8": + url: "https://nodejs.org/dist/v20.16.0/node-v20.16.0-darwin-arm64.tar.gz" + sha256: "fc7355e778b181575153b7dea4879e8021776eeb376c43c50f65893d2ea70aa3" + "18.15.0": Windows: "x86_64": - url: "https://nodejs.org/dist/v13.6.0/node-v13.6.0-win-x64.zip" - sha256: "7fe37b34a4673a071bea52fcaf913ec422cf6fd79fd025bfb22de42ccc77f386" + url: "https://nodejs.org/dist/v18.15.0/node-v18.15.0-win-x64.zip" + sha256: "118fbcae58bc8c53cbe97a10c019734ed90685da8dda98aa0b0f4aeead42a647" Linux: "x86_64": - url: "https://nodejs.org/dist/v13.6.0/node-v13.6.0-linux-x64.tar.xz" - sha256: "00f01315a867da16d1638f7a02966c608e344ac6c5b7d04d1fdae3138fa9d798" + url: "https://nodejs.org/dist/v18.15.0/node-v18.15.0-linux-x64.tar.xz" + sha256: "c8c5fa53ce0c0f248e45983e86368e0b1daf84b77e88b310f769c3cfc12682ef" + "armv7": + url: "https://nodejs.org/dist/v18.15.0/node-v18.15.0-linux-armv7l.tar.xz" + sha256: "baad3cdf1365f46bf837635554b10bc3e320799e69ac26e07df1fcde0c1738c7" + "armv8": + url: "https://nodejs.org/dist/v18.15.0/node-v18.15.0-linux-arm64.tar.xz" + sha256: "98ea6ed0a1ae55334ab2c03c34d5e52c6dc3dee8f236c0afc08ab1c964506633" Macos: "x86_64": - url: "https://nodejs.org/dist/v13.6.0/node-v13.6.0-darwin-x64.tar.gz" - sha256: "da13adb864777b322dda7af20410a9b0c63aa69de4b5574008d1e6910768bf69" + url: "https://nodejs.org/dist/v18.15.0/node-v18.15.0-darwin-x64.tar.gz" + sha256: "76add174d2d3f98da08907412e82add7352b8cb6f639324d352a65c084b99c7e" + "armv8": + url: "https://nodejs.org/dist/v18.15.0/node-v18.15.0-darwin-arm64.tar.gz" + sha256: "bd302a689c3c34e2b61d86b97de66d26a335881a17af09b6a0a4bb1019df56e4" + "16.20.2": + Windows: + "x86_64": + url: "https://nodejs.org/dist/v16.20.2/node-v16.20.2-win-x64.zip" + sha256: "f8bb35f6c08dc7bf14ac753509c06ed1a7ebf5b390cd3fbdc8f8c1aedd020ec3" + Linux: + "x86_64": + url: "https://nodejs.org/dist/v16.20.2/node-v16.20.2-linux-x64.tar.xz" + sha256: "874463523f26ed528634580247f403d200ba17a31adf2de98a7b124c6eb33d87" + "armv7": + url: "https://nodejs.org/dist/v16.20.2/node-v16.20.2-linux-armv7l.tar.xz" + sha256: "5f2a2a34d2f19931b8ef39416bde96933e6666f91a2d1a2b92af30627a8e8429" + "armv8": + url: "https://nodejs.org/dist/v16.20.2/node-v16.20.2-linux-arm64.tar.xz" + sha256: "e88d86154d1ce53dc52fd74d79d4bfdf0b05f58c0bb2639adfa36e9378b770c4" + Macos: + "x86_64": + url: "https://nodejs.org/dist/v16.20.2/node-v16.20.2-darwin-x64.tar.gz" + sha256: "d7a46eaf2b57ffddeda16ece0d887feb2e31a91ad33f8774da553da0249dc4a6" + "armv8": + url: "https://nodejs.org/dist/v16.20.2/node-v16.20.2-darwin-arm64.tar.gz" + sha256: "6a5c4108475871362d742b988566f3fe307f6a67ce14634eb3fbceb4f9eea88c" "16.3.0": Windows: "x86_64": @@ -47,3 +90,29 @@ sources: "armv8": url: "https://nodejs.org/dist/v16.3.0/node-v16.3.0-darwin-arm64.tar.gz" sha256: "aeac294dbe54a4dfd222eedfbae704b185c40702254810e2c5917f6dbc80e017" + "13.6.0": + Windows: + "x86_64": + url: "https://nodejs.org/dist/v13.6.0/node-v13.6.0-win-x64.zip" + sha256: "7fe37b34a4673a071bea52fcaf913ec422cf6fd79fd025bfb22de42ccc77f386" + Linux: + "x86_64": + url: "https://nodejs.org/dist/v13.6.0/node-v13.6.0-linux-x64.tar.xz" + sha256: "00f01315a867da16d1638f7a02966c608e344ac6c5b7d04d1fdae3138fa9d798" + Macos: + "x86_64": + url: "https://nodejs.org/dist/v13.6.0/node-v13.6.0-darwin-x64.tar.gz" + sha256: "da13adb864777b322dda7af20410a9b0c63aa69de4b5574008d1e6910768bf69" + "12.14.1": + Windows: + "x86_64": + url: "https://nodejs.org/dist/v12.14.1/node-v12.14.1-win-x64.zip" + sha256: "1f96ccce3ba045ecea3f458e189500adb90b8bc1a34de5d82fc10a5bf66ce7e3" + Linux: + "x86_64": + url: "https://nodejs.org/dist/v12.14.1/node-v12.14.1-linux-x64.tar.xz" + sha256: "07cfcaa0aa9d0fcb6e99725408d9e0b07be03b844701588e3ab5dbc395b98e1b" + Macos: + "x86_64": + url: "https://nodejs.org/dist/v12.14.1/node-v12.14.1-darwin-x64.tar.gz" + sha256: "0be10a28737527a1e5e3784d3ad844d742fe8b0718acd701fd48f718fd3af78f" diff --git a/recipes/nodejs/all/conanfile.py b/recipes/nodejs/all/conanfile.py index c0927a5e70416..077b1d4fb6d5e 100644 --- a/recipes/nodejs/all/conanfile.py +++ b/recipes/nodejs/all/conanfile.py @@ -1,51 +1,66 @@ import os -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration -required_conan_version = ">=1.33.0" +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import copy, get + +required_conan_version = ">=1.59.0" class NodejsConan(ConanFile): name = "nodejs" - description = "nodejs binaries for use in recipes" - topics = ("conan", "node", "nodejs") + description = "Node.js is an open-source, cross-platform JavaScript runtime environment." + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://nodejs.org" - license = "MIT" - settings = "os", "arch" + topics = ("node", "javascript", "runtime", "pre-built") + + package_type = "application" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True + short_paths = True - @property - def _source_subfolder(self): - return os.path.join(self.source_folder, "source_subfolder") + def layout(self): + pass + + def package_id(self): + del self.info.settings.compiler + del self.info.settings.build_type @property def _nodejs_arch(self): - if str(self.settings.os) == "Linux": + if str(self.settings.os) in ["Linux", "FreeBSD"]: if str(self.settings.arch).startswith("armv7"): return "armv7" if str(self.settings.arch).startswith("armv8") and "32" not in str(self.settings.arch): return "armv8" return str(self.settings.arch) + @property + def _dl_info(self): + return self.conan_data["sources"].get(self.version, {}).get(str(self.settings.os), {}).get(self._nodejs_arch) + def validate(self): - if (not (self.version in self.conan_data["sources"]) or - not (str(self.settings.os) in self.conan_data["sources"][self.version]) or - not (self._nodejs_arch in self.conan_data["sources"][self.version][str(self.settings.os)] ) ): + if not self._dl_info: raise ConanInvalidConfiguration("Binaries for this combination of architecture/version/os not available") def build(self): - tools.get(**self.conan_data["sources"][self.version][str(self.settings.os)][self._nodejs_arch], destination=self._source_subfolder, strip_root=True) + get(self, **self._dl_info, strip_root=True) def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - self.copy(pattern="*", src=os.path.join(self._source_subfolder, "bin"), dst="bin") - self.copy(pattern="node.exe", src=self._source_subfolder, dst="bin") - self.copy(pattern="npm", src=self._source_subfolder, dst="bin") - self.copy(pattern="npx", src=self._source_subfolder, dst="bin") + copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.build_folder) + copy(self, "*", dst=os.path.join(self.package_folder, "bin"), src=os.path.join(self.build_folder, "bin")) + copy(self, "*", dst=os.path.join(self.package_folder, "lib"), src=os.path.join(self.build_folder, "lib")) + copy(self, "node.exe", dst=os.path.join(self.package_folder, "bin"), src=self.build_folder) + copy(self, "npm", dst=os.path.join(self.package_folder, "bin"), src=self.build_folder) + copy(self, "npx", dst=os.path.join(self.package_folder, "bin"), src=self.build_folder) def package_info(self): self.cpp_info.includedirs = [] + self.cpp_info.frameworkdirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] + + # TODO: Legacy, to be removed on Conan 2.0 bin_dir = os.path.join(self.package_folder, "bin") - self.output.info('Appending PATH environment variable: {}'.format(bin_dir)) self.env_info.PATH.append(bin_dir) diff --git a/recipes/nodejs/all/test_package/conanfile.py b/recipes/nodejs/all/test_package/conanfile.py index 42e6935fc89c3..01953a2dc0788 100644 --- a/recipes/nodejs/all/test_package/conanfile.py +++ b/recipes/nodejs/all/test_package/conanfile.py @@ -1,12 +1,27 @@ -import os -from conans import ConanFile, tools +import platform + +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout +from conan.tools.scm import Version class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) - settings = "os", "arch" + def build_requirements(self): + self.tool_requires(self.tested_reference_str) def test(self): - if not tools.cross_building(self): - self.output.info("Node version:") - self.run("node --version", run_environment=True) + if can_run(self): + if self.settings.os in ["Linux", "FreeBSD"]: + libc_version = Version(platform.libc_ver()[1]) + if libc_version < "2.29": + self.output.warning(f"System libc version {libc_version} < 2.29, skipping test_package") + return + self.run("node --version") diff --git a/recipes/nodejs/all/test_v1_package/conanfile.py b/recipes/nodejs/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..31062ce8b441a --- /dev/null +++ b/recipes/nodejs/all/test_v1_package/conanfile.py @@ -0,0 +1,24 @@ +import platform + +from conan import ConanFile +from conan.tools.build import cross_building +from conans.model.version import Version + + +class TestPackageConan(ConanFile): + + settings = "os", "arch" + test_type = "explicit" + + def build_requirements(self): + self.build_requires(self.tested_reference_str) + + def test(self): + if not cross_building(self): + if self.settings.os in ["Linux", "FreeBSD"]: + libc_version = Version(platform.libc_ver()[1]) + if libc_version < "2.29": + self.output.warning(f"System libc version {libc_version} < 2.29, skipping test_package") + return + self.output.info("Node version:") + self.run("node --version") diff --git a/recipes/nodejs/config.yml b/recipes/nodejs/config.yml index 8a3ed6b7b7266..7f37f049d8acc 100644 --- a/recipes/nodejs/config.yml +++ b/recipes/nodejs/config.yml @@ -1,7 +1,13 @@ versions: - "12.14.1": + "20.16.0": folder: all - "13.6.0": + "18.15.0": + folder: all + "16.20.2": folder: all "16.3.0": folder: all + "13.6.0": + folder: all + "12.14.1": + folder: all diff --git a/recipes/nodesoup/all/CMakeLists.txt b/recipes/nodesoup/all/CMakeLists.txt deleted file mode 100644 index 881b1cb39250b..0000000000000 --- a/recipes/nodesoup/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/nodesoup/all/conandata.yml b/recipes/nodesoup/all/conandata.yml index bf507c033f50b..633f6755af50c 100644 --- a/recipes/nodesoup/all/conandata.yml +++ b/recipes/nodesoup/all/conandata.yml @@ -5,4 +5,3 @@ sources: patches: "cci.20200905": - patch_file: "patches/0001-install-shared-windows.patch" - base_path: "source_subfolder" diff --git a/recipes/nodesoup/all/conanfile.py b/recipes/nodesoup/all/conanfile.py index 19ef9ea3f1923..86e6f75fa6616 100644 --- a/recipes/nodesoup/all/conanfile.py +++ b/recipes/nodesoup/all/conanfile.py @@ -1,9 +1,11 @@ -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, cmake_layout +from conan.tools.files import copy, get, rmdir, apply_conandata_patches, export_conandata_patches +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration import os -required_conan_version = ">=1.33.0" - class NodesoupConan(ConanFile): name = "nodesoup" @@ -13,6 +15,7 @@ class NodesoupConan(ConanFile): homepage = "https://github.com/olvb/nodesoup" url = "https://github.com/conan-io/conan-center-index" settings = "os", "arch", "compiler", "build_type" + package_type = "library" options = { "shared": [True, False], "fPIC": [True, False], @@ -22,18 +25,8 @@ class NodesoupConan(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 layout(self): + cmake_layout(self, src_folder="src") def config_options(self): if self.settings.os == "Windows": @@ -41,38 +34,44 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + @property + def _min_cppstd(self): + return 14 def validate(self): if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 14) + check_min_cppstd(self, self._min_cppstd) if self.settings.compiler == "clang": - if tools.Version(self.settings.compiler.version) < "5.0" and self.settings.compiler.libcxx in ("libstdc++", "libstdc++11"): + if Version(self.settings.compiler.version) < "5.0" and self.settings.compiler.libcxx in ("libstdc++", "libstdc++11"): raise ConanInvalidConfiguration("The version of libstdc++(11) of the current compiler does not support building nodesoup") + 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 _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["BUILD_DEMO"] = False + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = 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, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): self.cpp_info.includedirs.append(os.path.join("include", "nodesoup")) diff --git a/recipes/nodesoup/all/test_package/CMakeLists.txt b/recipes/nodesoup/all/test_package/CMakeLists.txt index 027a67d403fb1..881aec891e1d0 100644 --- a/recipes/nodesoup/all/test_package/CMakeLists.txt +++ b/recipes/nodesoup/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(nodesoup REQUIRED CONFIG) add_executable(${CMAKE_PROJECT_NAME} test_package.cpp) diff --git a/recipes/nodesoup/all/test_package/conanfile.py b/recipes/nodesoup/all/test_package/conanfile.py index 49a3a66ea5bad..8a5bb47f50c4c 100644 --- a/recipes/nodesoup/all/test_package/conanfile.py +++ b/recipes/nodesoup/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 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/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..7e6037b74502b 100644 --- a/recipes/norm/all/conandata.yml +++ b/recipes/norm/all/conandata.yml @@ -1,10 +1,11 @@ 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" + - patch_file: "patches/0003-cpp20-compat.patch" + patch_description: "C++20 compatibility: Fix ambiguous overloaded operator ==" + patch_type: "portability" diff --git a/recipes/norm/all/conanfile.py b/recipes/norm/all/conanfile.py index fef2a3413a749..3d4877a41e642 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" + package_type = "library" + 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.12.5 <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/patches/0003-cpp20-compat.patch b/recipes/norm/all/patches/0003-cpp20-compat.patch new file mode 100644 index 0000000000000..6603e3d9c09bf --- /dev/null +++ b/recipes/norm/all/patches/0003-cpp20-compat.patch @@ -0,0 +1,11 @@ +--- a/src/common/normNode.cpp ++++ b/src/common/normNode.cpp +@@ -1621,7 +1621,7 @@ void NormSenderNode::HandleObjectMessage(const NormObjectMsg& msg) + { + // The hacky use of "sync_id" here keeps the debug message from + // printing too often while "waiting to sync" ... +- if (0 == sync_id) ++ if (0 == (UINT16)sync_id) + { + PLOG(PL_ERROR, "NormSenderNode::HandleObjectMessage() waiting to sync ...\n"); + sync_id = 100; 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/test_package/conanfile.py b/recipes/npcap/all/test_package/conanfile.py index 88fb844b5824b..3f5bd28111ec1 100644 --- a/recipes/npcap/all/test_package/conanfile.py +++ b/recipes/npcap/all/test_package/conanfile.py @@ -2,7 +2,6 @@ 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 @@ -24,6 +23,9 @@ def configure(self): def layout(self): cmake_layout(self) + def generate(self): + files.save(self, os.path.join(self.build_folder, "libpcap_bin_path"), self.dependencies["libpcap"].cpp_info.bindirs[0]) + def build(self): cmake = CMake(self) cmake.configure() @@ -31,17 +33,13 @@ def build(self): def test(self): if can_run(self): - bindir = self.cpp.build.bindirs[0] + bindir = self.cpp.build.bindir # 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) + libpcap_bin_path = files.load(self, os.path.join(self.build_folder, "libpcap_bin_path")) + files.copy(self, "pcap.dll", src=libpcap_bin_path, dst=os.path.join(str(self.build_path), 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 + self.run(os.path.join(bindir, "test_package"), env="conanrun") diff --git a/recipes/nsimd/2.x/CMakeLists.txt b/recipes/nsimd/2.x/CMakeLists.txt deleted file mode 100644 index c986d294c7547..0000000000000 --- a/recipes/nsimd/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() - -add_subdirectory("source_subfolder") diff --git a/recipes/nsimd/2.x/conanfile.py b/recipes/nsimd/2.x/conanfile.py index 517dd7d55ea04..714275e3c3205 100644 --- a/recipes/nsimd/2.x/conanfile.py +++ b/recipes/nsimd/2.x/conanfile.py @@ -1,5 +1,7 @@ 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 collect_libs, copy, get, replace_in_file required_conan_version = ">=1.33.0" @@ -11,8 +13,6 @@ class NsimdConan(ConanFile): topics = ("hpc", "neon", "cuda", "avx", "simd", "avx2", "sse2", "aarch64", "avx512", "sse42", "rocm", "sve", "neon128") url = "https://github.com/conan-io/conan-center-index" license = "MIT" - exports_sources = ["CMakeLists.txt", "patches/*"] - generators = "cmake" settings = "os", "compiler", "build_type", "arch" options = { "shared": [True, False], @@ -27,63 +27,57 @@ class NsimdConan(ConanFile): "simd": None } - _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 + self.options.rm_safe("fPIC") # Most of the library is header only. # cpp files do not use STL. - del self.settings.compiler.libcxx + 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], 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) + def generate(self): + tc = CMakeToolchain(self) if self.options.simd: - self._cmake.definitions["simd"] = self.options.simd + tc.variables["simd"] = self.options.simd if self.settings.arch == "armv7hf": - self._cmake.definitions["NSIMD_ARM32_IS_ARMEL"] = False - self._cmake.definitions["CMAKE_POSITION_INDEPENDENT_CODE"] = self.options.get_safe("fPIC", True) - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + tc.variables["NSIMD_ARM32_IS_ARMEL"] = False + tc.variables["CMAKE_POSITION_INDEPENDENT_CODE"] = self.options.get_safe("fPIC", True) + tc.generate() def _patch_sources(self): - cmakefile_path = os.path.join(self._source_subfolder, "CMakeLists.txt") - tools.replace_in_file(cmakefile_path, - " SHARED ", - " ") - tools.replace_in_file(cmakefile_path, - "RUNTIME DESTINATION lib", - "RUNTIME DESTINATION bin") - tools.replace_in_file(cmakefile_path, - "set_property(TARGET ${o} PROPERTY POSITION_INDEPENDENT_CODE ON)", - "") + cmakefile_path = os.path.join(self.source_folder, "CMakeLists.txt") + replace_in_file(self, cmakefile_path, + " SHARED ", + " ") + replace_in_file(self, cmakefile_path, + "RUNTIME DESTINATION lib", + "RUNTIME DESTINATION bin") + replace_in_file(self, cmakefile_path, + "set_property(TARGET ${o} 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() def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = collect_libs(self) diff --git a/recipes/nsimd/2.x/test_package/CMakeLists.txt b/recipes/nsimd/2.x/test_package/CMakeLists.txt index aac673c26f6fe..6f3111e50d3ef 100644 --- a/recipes/nsimd/2.x/test_package/CMakeLists.txt +++ b/recipes/nsimd/2.x/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(nsimd CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/nsimd/2.x/test_package/conanfile.py b/recipes/nsimd/2.x/test_package/conanfile.py index 0937dd58a343b..22e1a75b926d7 100644 --- a/recipes/nsimd/2.x/test_package/conanfile.py +++ b/recipes/nsimd/2.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, cmake_layout import os -from conans import ConanFile, CMake, tools - class NsimdTestConan(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) @@ -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/nsimd/2.x/test_v1_package/CMakeLists.txt b/recipes/nsimd/2.x/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..ed8a6b4ca24f6 --- /dev/null +++ b/recipes/nsimd/2.x/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(nsimd CONFIG REQUIRED) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} nsimd::nsimd) diff --git a/recipes/nsimd/2.x/test_v1_package/conanfile.py b/recipes/nsimd/2.x/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..0937dd58a343b --- /dev/null +++ b/recipes/nsimd/2.x/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +import os + +from conans import ConanFile, CMake, tools + + +class NsimdTestConan(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/nspr/all/conanfile.py b/recipes/nspr/all/conanfile.py index b0ce8c9099e1b..fe56b4bbdf4f7 100644 --- a/recipes/nspr/all/conanfile.py +++ b/recipes/nspr/all/conanfile.py @@ -1,24 +1,30 @@ -from conan.tools.microsoft import msvc_runtime_flag -from conan.tools.files import rename, get, rmdir, chdir, replace_in_file -from conan.tools.scm import Version +import os +import shutil + from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conans import tools, AutoToolsBuildEnvironment -import contextlib -import functools -import os +from conan.tools.apple import is_apple_os +from conan.tools.build import cross_building +from conan.tools.env import Environment +from conan.tools.files import chdir, copy, get, rename, replace_in_file, rmdir, mkdir +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, msvc_runtime_flag, unix_path_package_info_legacy +from conan.tools.scm import Version -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.57.0" class NsprConan(ConanFile): name = "nspr" - homepage = "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSPR" - description = "Netscape Portable Runtime (NSPR) provides a platform-neutral API for system level and libc-like functions." - topics = ("nspr", "libc") - url = "https://github.com/conan-io/conan-center-index" + description = ("Netscape Portable Runtime (NSPR) provides a platform-neutral API" + " for system level and libc-like functions.") license = "MPL-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSPR" + topics = ("libc",) + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -33,14 +39,6 @@ class NsprConan(ConanFile): "win32_target": "winnt", } - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _settings_build(self): return getattr(self, "settings_build", self.settings) @@ -49,128 +47,129 @@ def config_options(self): if self.settings.os == "Windows": del self.options.fPIC else: - del self.options.win32_target + self.options.rm_safe("win32_target") 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): # https://bugzilla.mozilla.org/show_bug.cgi?id=1658671 if Version(self.version) < "4.29": - if self.settings.os == "Macos" and self.settings.arch == "armv8": + if is_apple_os(self) and self.settings.arch == "armv8": raise ConanInvalidConfiguration("NSPR does not support mac M1 before 4.29") + if cross_building(self): + raise ConanInvalidConfiguration("Cross-building is not supported") def build_requirements(self): if self._settings_build.os == "Windows": - self.build_requires("mozilla-build/3.3") - if not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + self.tool_requires("mozilla-build/3.3") + 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="tmp", strip_root=True) - rename(self, os.path.join("tmp", "nspr"), self._source_subfolder) - rmdir(self, "tmp") - - @contextlib.contextmanager - def _build_context(self): - if self._is_msvc: - with tools.vcvars(self): - with tools.environment_append({"CC": "cl", "CXX": "cl", "LD": "link"}): - yield - else: - yield + with chdir(self, self.export_sources_folder): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + rmdir(self, self.source_folder) + rename(self, "nspr", self.source_folder) - @functools.lru_cache(1) - def _configure_autotools(self): - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) + def generate(self): + tc = AutotoolsToolchain(self) yes_no = lambda v: "yes" if v else "no" - conf_args = [ + tc.configure_args += [ "--with-mozilla={}".format(yes_no(self.options.with_mozilla)), "--enable-64bit={}".format(yes_no(self.settings.arch in ("armv8", "x86_64", "mips64", "ppc64", "ppc64le"))), "--enable-strip={}".format(yes_no(self.settings.build_type not in ("Debug", "RelWithDebInfo"))), "--enable-debug={}".format(yes_no(self.settings.build_type == "Debug")), - "--datarootdir={}".format(tools.unix_path(os.path.join(self.package_folder, "res"))), + "--datarootdir=${prefix}/res", "--disable-cplus", ] - if self._is_msvc: - conf_args.extend([ + if is_msvc(self): + tc.configure_args += [ "{}-pc-mingw32".format("x86_64" if self.settings.arch == "x86_64" else "x86"), - "--enable-static-rtl={}".format(yes_no("MT" in msvc_runtime_flag(self))), + "--enable-static-rtl={}".format(yes_no(is_msvc_static_runtime(self))), "--enable-debug-rtl={}".format(yes_no("d" in msvc_runtime_flag(self))), - ]) + ] elif self.settings.os == "Android": - conf_args.extend([ - "--with-android-ndk={}".format(tools.get_env(["NDK_ROOT"])), + tc.configure_args += [ + "--with-android-ndk={}".format(os.environ.get("NDK_ROOT", "")), "--with-android-version={}".format(self.settings.os.api_level), - "--with-android-platform={}".format(tools.get_env("ANDROID_PLATFORM")), - "--with-android-toolchain={}".format(tools.get_env("ANDROID_TOOLCHAIN")), - ]) + "--with-android-platform={}".format(os.environ.get("ANDROID_PLATFORM")), + "--with-android-toolchain={}".format(os.environ.get("ANDROID_TOOLCHAIN")), + ] elif self.settings.os == "Windows": - conf_args.append("--enable-win32-target={}".format(self.options.win32_target)) - env = autotools.vars - if self.settings.os == "Macos": - if self.settings.arch == "armv8": - # conan adds `-arch`, which conflicts with nspr's apple silicon support - env["CFLAGS"] = env["CFLAGS"].replace("-arch arm64", "") - env["CXXFLAGS"] = env["CXXFLAGS"].replace("-arch arm64", "") - - autotools.configure(args=conf_args, vars=env) - return autotools + tc.configure_args.append("--enable-win32-target={}".format(self.options.win32_target)) + if is_apple_os(self) and self.settings.arch == "armv8": + # conan adds `-arch`, which conflicts with nspr's apple silicon support + tc.cflags.remove("-arch arm64") + tc.cxxflags.remove("-arch arm64") + tc.generate() + + if is_msvc(self): + env = Environment() + env.define("CC", "cl") + env.define("CXX", "cl") + env.define("LD", "link") + env.vars(self).save_script("conanbuild_msvc") def build(self): - with chdir(self, self._source_subfolder): + with chdir(self, self.source_folder): # relocatable shared libs on macOS - replace_in_file(self, - "configure", - "-install_name @executable_path/", - "-install_name @rpath/" - ) - with self._build_context(): - autotools = self._configure_autotools() - autotools.make() + replace_in_file(self, "configure", "-install_name @executable_path/", "-install_name @rpath/") + autotools = Autotools(self) + autotools.configure() + autotools.make() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - with chdir(self, self._source_subfolder): - with self._build_context(): - autotools = self._configure_autotools() - autotools.install() + copy(self, "LICENSE", + dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.install() 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 os.path.exists(os.path.join(self.package_folder, "include", "nspr.h")): + with chdir(self, self.package_folder): + rename(self, "include", "nspr") + mkdir(self, "include") + shutil.move("nspr", "include") if self.settings.os == "Windows": if self.options.shared: os.mkdir(os.path.join(self.package_folder, "bin")) for lib in self._library_names: - libsuffix = "lib" if self._is_msvc else "a" - libprefix = "" if self._is_msvc else "lib" + libsuffix = "lib" if is_msvc(self) else "a" + libprefix = "" if is_msvc(self) else "lib" if self.options.shared: 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")) + 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", f"{libprefix}{lib}.{libsuffix}")) os.unlink(os.path.join(self.package_folder, "lib", f"{lib}.dll")) if not self.options.shared: 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") + "#define NSPR_API(__type) PR_IMPORT(__type)", + "#define NSPR_API(__type) extern __type") 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") + "#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" + shared_ext = "dylib" if is_apple_os(self) else "so" for lib in self._library_names: if self.options.shared: os.unlink(os.path.join(self.package_folder, "lib", f"lib{lib}.a")) else: os.unlink(os.path.join(self.package_folder, "lib", f"lib{lib}.{shared_ext}")) - if self._is_msvc: + if is_msvc(self): if self.settings.build_type == "Debug": for lib in self._library_names: os.unlink(os.path.join(self.package_folder, "lib", f"{lib}.pdb")) @@ -200,8 +199,9 @@ def package_info(self): 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.cpp_info.resdirs = ["res"] + + # TODO: the following can be removed when the recipe supports Conan >= 2.0 only + aclocal = unix_path_package_info_legacy(self, os.path.join(self.package_folder, "res", "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/all/test_package/CMakeLists.txt b/recipes/nspr/all/test_package/CMakeLists.txt index e8bb34d55a637..898448a11de58 100644 --- a/recipes/nspr/all/test_package/CMakeLists.txt +++ b/recipes/nspr/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(nspr REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) diff --git a/recipes/nspr/all/test_package/conanfile.py b/recipes/nspr/all/test_package/conanfile.py index ab912e4e61df1..d6a48b7c16ccf 100644 --- a/recipes/nspr/all/test_package/conanfile.py +++ b/recipes/nspr/all/test_package/conanfile.py @@ -1,19 +1,29 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.apple import is_apple_os +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 build_requirements(self): - if self.settings.os == "Macos" and self.settings.arch == "armv8": + if is_apple_os(self) 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") + self.tool_requires("cmake/3.22.0") + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -21,6 +31,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/nspr/all/test_v1_package/CMakeLists.txt b/recipes/nspr/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/nspr/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/nspr/all/test_v1_package/conanfile.py b/recipes/nspr/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..9f6cd40d88fed --- /dev/null +++ b/recipes/nspr/all/test_v1_package/conanfile.py @@ -0,0 +1,27 @@ +from conan.tools.apple import is_apple_os +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_requirements(self): + if is_apple_os(self) 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 build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/nss/all/conandata.yml b/recipes/nss/all/conandata.yml index 923df56524bb2..f10905ebbaa04 100644 --- a/recipes/nss/all/conandata.yml +++ b/recipes/nss/all/conandata.yml @@ -1,4 +1,22 @@ sources: + "3.93": + url: "https://ftp.mozilla.org/pub/security/nss/releases/NSS_3_93_RTM/src/nss-3.93.tar.gz" + sha256: "15f54bb72048eb105f8c0e936a04b899e74c3db9a19bbc1e00acee2af9476a8a" + "3.92": + url: "https://ftp.mozilla.org/pub/security/nss/releases/NSS_3_92_RTM/src/nss-3.92.tar.gz" + sha256: "3db192d6e882039af02ae7eaf3217ed114bb7ad83414c646772ab8021e24a254" + "3.91": + url: "https://ftp.mozilla.org/pub/security/nss/releases/NSS_3_91_RTM/src/nss-3.91.tar.gz" + sha256: "84bd46376df17118c55f6d73d30fd93a0af21296c66e7690471547e5898fc4b3" + "3.89": + url: "https://ftp.mozilla.org/pub/security/nss/releases/NSS_3_89_RTM/src/nss-3.89.tar.gz" + sha256: "55c37a3f4da010d0574fb8b39264cb1e7b4ce9e6c2954c1c7ecf9f41ee00bed5" + "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" diff --git a/recipes/nss/all/conanfile.py b/recipes/nss/all/conanfile.py index 4a063d42abaeb..6c0ff3efc96a7 100644 --- a/recipes/nss/all/conanfile.py +++ b/recipes/nss/all/conanfile.py @@ -36,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.39.3") + self.build_requires("sqlite3/3.41.2") def configure(self): self.options["nspr"].shared = True @@ -49,8 +49,8 @@ def configure(self): def requirements(self): self.requires("nspr/4.35") - self.requires("sqlite3/3.39.3") - self.requires("zlib/1.2.12") + self.requires("sqlite3/3.41.2") + self.requires("zlib/1.2.13") def validate(self): if not self.options.shared: diff --git a/recipes/nss/config.yml b/recipes/nss/config.yml index c0aec8621018b..82fff1e6a41ec 100644 --- a/recipes/nss/config.yml +++ b/recipes/nss/config.yml @@ -1,4 +1,16 @@ versions: + "3.93": + folder: all + "3.92": + folder: all + "3.91": + folder: all + "3.89": + folder: all + "3.88.1": + folder: all + "3.87": + folder: all "3.86": folder: all "3.85": diff --git a/recipes/nsync/all/CMakeLists.txt b/recipes/nsync/all/CMakeLists.txt deleted file mode 100644 index 881b1cb39250b..0000000000000 --- a/recipes/nsync/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/nsync/all/conandata.yml b/recipes/nsync/all/conandata.yml index 8b34da22a2d62..2612b48d1ed17 100644 --- a/recipes/nsync/all/conandata.yml +++ b/recipes/nsync/all/conandata.yml @@ -1,4 +1,19 @@ sources: + "1.29.2": + url: "https://github.com/google/nsync/archive/1.29.2.tar.gz" + sha256: "1d63e967973733d2c97e841e3c05fac4d3fa299f01d14c86f2695594c7a4a2ec" + "1.29.1": + url: "https://github.com/google/nsync/archive/1.29.1.tar.gz" + sha256: "3045a8922171430426b695edf794053182d245f6a382ddcc59ef4a6190848e98" + "1.28.0": + url: "https://github.com/google/nsync/archive/1.28.0.tar.gz" + sha256: "1e6a7193bd85d480faaf992cef204c5cf09f9da72766c9987e25b4f88508eed1" + "1.27.0": + url: "https://github.com/google/nsync/archive/1.27.0.tar.gz" + sha256: "e8e552a358f4a28e844207a7c5cb51767e4aeb0b29e22d23ac2a09924130f761" + "1.26.0": + url: "https://github.com/google/nsync/archive/1.26.0.tar.gz" + sha256: "80fc1e605bb3cf5f272811ece39c4fb6761ffcb9b30563301845cc9ff381eb8b" "1.25.0": url: "https://github.com/google/nsync/archive/1.25.0.tar.gz" sha256: "2be9dbfcce417c7abcc2aa6fee351cd4d292518d692577e74a2c6c05b049e442" @@ -9,12 +24,19 @@ sources: sha256: "b7e75b17957c62bd02dd73890bde22da3a564903fcaad651b395453d41d3325b" url: "https://github.com/google/nsync/archive/refs/tags/1.23.0.tar.gz" patches: + "1.29.2": + - patch_file: "patches/0001-1.27.0-darwin-exclude_semaphore_mutex_c_from_nsync_cpp_lib.patch" + "1.29.1": + - patch_file: "patches/0001-1.27.0-darwin-exclude_semaphore_mutex_c_from_nsync_cpp_lib.patch" + "1.28.0": + - patch_file: "patches/0001-1.27.0-darwin-exclude_semaphore_mutex_c_from_nsync_cpp_lib.patch" + "1.27.0": + - patch_file: "patches/0001-1.27.0-darwin-exclude_semaphore_mutex_c_from_nsync_cpp_lib.patch" + "1.26.0": + - patch_file: "patches/0001-darwin-exclude_semaphore_mutex_c_from_nsync_cpp_lib.patch" "1.25.0": - patch_file: "patches/0001-darwin-exclude_semaphore_mutex_c_from_nsync_cpp_lib.patch" - base_path: "source_subfolder" "1.24.0": - patch_file: "patches/0001-darwin-exclude_semaphore_mutex_c_from_nsync_cpp_lib.patch" - base_path: "source_subfolder" "1.23.0": - patch_file: "patches/0001-darwin-exclude_semaphore_mutex_c_from_nsync_cpp_lib.patch" - base_path: "source_subfolder" diff --git a/recipes/nsync/all/conanfile.py b/recipes/nsync/all/conanfile.py index b5e32bf7b92ce..0161c97b47851 100644 --- a/recipes/nsync/all/conanfile.py +++ b/recipes/nsync/all/conanfile.py @@ -1,7 +1,10 @@ +from conan import ConanFile +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, replace_in_file, rmdir +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout import os -from conans import ConanFile, CMake, tools -required_conan_version = ">=1.33.0" + +required_conan_version = ">=1.53.0" class NsyncConan(ConanFile): @@ -11,21 +14,20 @@ class NsyncConan(ConanFile): license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" topics = ("c", "thread", "multithreading", "google") - settings = "os", "compiler", "build_type", "arch" - options = {"fPIC": [True, False], "shared": [True, False]} - default_options = {"fPIC": True, "shared": False} - exports_sources = ["CMakeLists.txt", "patches/**"] - - generators = "cmake", "cmake_find_package" - _cmake = None + package_type = "library" + settings = "os", "arch", "compiler", "build_type" - @property - def _source_subfolder(self): - return "source_subfolder" + 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": @@ -33,66 +35,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 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["NSYNC_ENABLE_TESTS"] = False - 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["NSYNC_ENABLE_TESTS"] = False + if self.settings.os == "Windows" and self.options.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): - for patch in self.conan_data["patches"][self.version]: - tools.patch(**patch) + apply_conandata_patches(self) - tools.replace_in_file( - os.path.join(self._source_subfolder, "CMakeLists.txt"), - "set (CMAKE_POSITION_INDEPENDENT_CODE ON)", "") + replace_in_file( + self, + os.path.join(self.source_folder, "CMakeLists.txt"), + "set (CMAKE_POSITION_INDEPENDENT_CODE ON)", + "" + ) if self.settings.os == "Windows" and self.options.shared: ar_dest = \ "ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} " \ "COMPONENT Development" rt_dest = 'RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"' - tools.replace_in_file( - os.path.join(self._source_subfolder, "CMakeLists.txt"), - f"{ar_dest})", f"{ar_dest}\n{rt_dest})") + replace_in_file( + self, + os.path.join(self.source_folder, "CMakeLists.txt"), + f"{ar_dest})", + f"{ar_dest}\n{rt_dest})" + ) 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() + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): - self.cpp_info.filenames["cmake_find_package"] = "nsync" - self.cpp_info.filenames["cmake_find_package_multi"] = "nsync" - self.cpp_info.names["cmake_find_package"] = "nsync" - self.cpp_info.names["cmake_find_package_multi"] = "nsync" - - self._def_compoment("nsync_c", "nsync") - self._def_compoment("nsync_cpp") - - def _def_compoment(self, name, lib=None): - lib = lib if lib else name - - component = self.cpp_info.components[name] - component.name = name - component.libs = [lib] - component.names["cmake_find_package"] = name - component.names["cmake_find_package_multi"] = name - component.names["pkg_config"] = lib - + self.cpp_info.components["nsync_c"].libs = ["nsync"] + self.cpp_info.components["nsync_cpp"].libs = ["nsync_cpp"] if self.settings.os in ["Linux", "FreeBSD"]: - component.system_libs = ["pthread"] + self.cpp_info.components["nsync_c"].system_libs.append("pthread") + self.cpp_info.components["nsync_cpp"].system_libs.extend(["m", "pthread"]) diff --git a/recipes/nsync/all/patches/0001-1.27.0-darwin-exclude_semaphore_mutex_c_from_nsync_cpp_lib.patch b/recipes/nsync/all/patches/0001-1.27.0-darwin-exclude_semaphore_mutex_c_from_nsync_cpp_lib.patch new file mode 100644 index 0000000000000..1f3fd75999335 --- /dev/null +++ b/recipes/nsync/all/patches/0001-1.27.0-darwin-exclude_semaphore_mutex_c_from_nsync_cpp_lib.patch @@ -0,0 +1,10 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -125,7 +125,6 @@ + ${NSYNC_OS_CPP_SRC} + "platform/c++11/src/nsync_semaphore_mutex.cc" + "platform/posix/src/clock_gettime.c" +- "platform/posix/src/nsync_semaphore_mutex.c" + ) + elseif ("${CMAKE_SYSTEM_NAME}X" STREQUAL "LinuxX") + set (NSYNC_POSIX ON) diff --git a/recipes/nsync/all/test_package/CMakeLists.txt b/recipes/nsync/all/test_package/CMakeLists.txt index fae638a336117..d5e1f549f9dd0 100644 --- a/recipes/nsync/all/test_package/CMakeLists.txt +++ b/recipes/nsync/all/test_package/CMakeLists.txt @@ -1,14 +1,10 @@ cmake_minimum_required(VERSION 3.1) project(test_package C CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(nsync CONFIG REQUIRED) +find_package(nsync REQUIRED CONFIG) add_executable(${PROJECT_NAME} example_c.c) target_link_libraries(${PROJECT_NAME} nsync::nsync_c) add_executable(${PROJECT_NAME}_cpp example_cpp.cpp) target_link_libraries(${PROJECT_NAME}_cpp nsync::nsync_cpp) - diff --git a/recipes/nsync/all/test_package/conanfile.py b/recipes/nsync/all/test_package/conanfile.py index 0587822da3871..e086279e07c8b 100644 --- a/recipes/nsync/all/test_package/conanfile.py +++ b/recipes/nsync/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 NsyncTestConan(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) @@ -13,8 +21,8 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - test_package_c = os.path.join("bin", "test_package") - test_package_cpp = os.path.join("bin", "test_package_cpp") - self.run(test_package_c, run_environment=True) - self.run(test_package_cpp, run_environment=True) + if can_run(self): + test_package_c = os.path.join(self.cpp.build.bindirs[0], "test_package") + test_package_cpp = os.path.join(self.cpp.build.bindirs[0], "test_package_cpp") + self.run(test_package_c, env="conanrun") + self.run(test_package_cpp, env="conanrun") diff --git a/recipes/nsync/all/test_v1_package/CMakeLists.txt b/recipes/nsync/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/nsync/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/nsync/all/test_v1_package/conanfile.py b/recipes/nsync/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..e1fbce68b1417 --- /dev/null +++ b/recipes/nsync/all/test_v1_package/conanfile.py @@ -0,0 +1,21 @@ +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): + test_package_c = os.path.join("bin", "test_package") + test_package_cpp = os.path.join("bin", "test_package_cpp") + self.run(test_package_c, run_environment=True) + self.run(test_package_cpp, run_environment=True) diff --git a/recipes/nsync/config.yml b/recipes/nsync/config.yml index 14ad5b4688ed8..b839a601be83a 100644 --- a/recipes/nsync/config.yml +++ b/recipes/nsync/config.yml @@ -1,4 +1,14 @@ versions: + "1.29.2": + folder: "all" + "1.29.1": + folder: "all" + "1.28.0": + folder: "all" + "1.27.0": + folder: "all" + "1.26.0": + folder: "all" "1.25.0": folder: "all" "1.24.0": 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/nudb/all/conanfile.py b/recipes/nudb/all/conanfile.py index 4613f1e67604a..7b03f03a6026b 100644 --- a/recipes/nudb/all/conanfile.py +++ b/recipes/nudb/all/conanfile.py @@ -1,42 +1,66 @@ -from conans import ConanFile, CMake, tools import os -required_conan_version = ">=1.33.0" +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 + +required_conan_version = ">=1.52.0" + class NudbConan(ConanFile): name = "nudb" - license = "BSL-1.0" description = "A fast key/value insert-only database for SSD drives in C++11" + license = "BSL-1.0" + url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/CPPAlliance/NuDB" - url = "https://github.com/conan-io/conan-center-index/" topics = ("header-only", "KVS", "insert-only") + + package_type = "header-library" + 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 requirements(self): - self.requires("boost/1.78.0") + self.requires("boost/1.83.0") + + def package_id(self): + self.info.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], - 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", "include", src=os.path.join(self._source_subfolder, "include")) - self.copy("*.ipp", "include", src=os.path.join(self._source_subfolder, "include")) - - def package_id(self): - self.info.header_only() + copy(self, "LICENSE*", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder) + copy(self, "*", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include")) def package_info(self): - self.cpp_info.names["cmake_find_package"] = "NuDB" - self.cpp_info.names["cmake_find_package_multi"] = "NuDB" + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + self.cpp_info.set_property("cmake_target_name", "NuDB") + self.cpp_info.set_property("cmake_target_aliases", ["NuDB::nudb"]) + self.cpp_info.set_property("cmake_find_mode", "both") + + self.cpp_info.components["core"].set_property("cmake_target_name", "nudb") self.cpp_info.components["core"].names["cmake_find_package"] = "nudb" self.cpp_info.components["core"].names["cmake_find_package_multi"] = "nudb" self.cpp_info.components["core"].requires = ["boost::thread", "boost::system"] - self.cpp_info.set_property("cmake_target_name", "NuDB") - self.cpp_info.set_property("cmake_target_module_name", "NuDB::nudb") - self.cpp_info.set_property("cmake_find_module", "both") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.names["cmake_find_package"] = "NuDB" + self.cpp_info.names["cmake_find_package_multi"] = "NuDB" diff --git a/recipes/nudb/all/test_package/CMakeLists.txt b/recipes/nudb/all/test_package/CMakeLists.txt index 8aef4010c6c96..ba8bae2a7d0d2 100644 --- a/recipes/nudb/all/test_package/CMakeLists.txt +++ b/recipes/nudb/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(NuDB CONFIG REQUIRED) +find_package(NuDB REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} NuDB::nudb) diff --git a/recipes/nudb/all/test_package/conanfile.py b/recipes/nudb/all/test_package/conanfile.py index 573376a19a476..fae501d0afb9e 100644 --- a/recipes/nudb/all/test_package/conanfile.py +++ b/recipes/nudb/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 NudbTestConan(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" + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/nudb/all/test_v1_package/CMakeLists.txt b/recipes/nudb/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/nudb/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/nudb/all/test_v1_package/conanfile.py b/recipes/nudb/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..573376a19a476 --- /dev/null +++ b/recipes/nudb/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +import os +from conans import ConanFile, CMake, tools + + +class NudbTestConan(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/nuklear/all/conandata.yml b/recipes/nuklear/all/conandata.yml index 2bff2ae899a2a..f0b7ee2207d6b 100644 --- a/recipes/nuklear/all/conandata.yml +++ b/recipes/nuklear/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "4.12.0": + url: "https://github.com/Immediate-Mode-UI/Nuklear/archive/4.12.0.tar.gz" + sha256: "4cb80084d20d20561548a2941b6d1eb7c30e6f0b9405e0d5df84bae3c1d7bbaf" + "4.10.6": + url: "https://github.com/Immediate-Mode-UI/Nuklear/archive/4.10.6.tar.gz" + sha256: "1baa1c9603ef20e6410a931de65d3fe07def5266fa7a61cdf1ffd241b3109a99" "4.10.1": url: "https://github.com/Immediate-Mode-UI/Nuklear/archive/refs/tags/4.10.1.tar.gz" sha256: "a7bd28477e00be6768e9b8cc3a406bc67b2d32d3a023b1e44868e8c566a7eb2f" diff --git a/recipes/nuklear/all/conanfile.py b/recipes/nuklear/all/conanfile.py index 6e91081b7e51f..b3be73bced4e2 100644 --- a/recipes/nuklear/all/conanfile.py +++ b/recipes/nuklear/all/conanfile.py @@ -10,21 +10,21 @@ class NuklearConan(ConanFile): name = "nuklear" description = "A single-header ANSI C immediate mode cross-platform GUI library." license = ["MIT", "Unlicense"] - topics = ("nuklear", "gui", "header-only") + topics = ("gui", "header-only") homepage = "https://github.com/Immediate-Mode-UI/Nuklear" url = "https://github.com/conan-io/conan-center-index" + package_type = "header-library" 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 @@ -35,8 +35,6 @@ 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.append("m") diff --git a/recipes/nuklear/all/test_package/conanfile.py b/recipes/nuklear/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/nuklear/all/test_package/conanfile.py +++ b/recipes/nuklear/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/nuklear/all/test_v1_package/CMakeLists.txt b/recipes/nuklear/all/test_v1_package/CMakeLists.txt index 9898e4868ff3c..b21cc49efde95 100644 --- a/recipes/nuklear/all/test_v1_package/CMakeLists.txt +++ b/recipes/nuklear/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +cmake_minimum_required(VERSION 3.15) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(nuklear REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE nuklear::nuklear) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/nuklear/config.yml b/recipes/nuklear/config.yml index 7f21ae0ba7418..bb8a95e082cf9 100644 --- a/recipes/nuklear/config.yml +++ b/recipes/nuklear/config.yml @@ -1,4 +1,8 @@ versions: + "4.12.0": + folder: all + "4.10.6": + folder: all "4.10.1": folder: all "4.06.1": diff --git a/recipes/numcpp/all/conandata.yml b/recipes/numcpp/all/conandata.yml index ea2f641d0b415..bc13c5f8f97d8 100644 --- a/recipes/numcpp/all/conandata.yml +++ b/recipes/numcpp/all/conandata.yml @@ -1,4 +1,19 @@ sources: + "2.12.1": + url: "https://github.com/dpilger26/NumCpp/archive/Version_2.12.1.tar.gz" + sha256: "f462ecd27126e6057b31fa38f1f72cef2c4223c9d848515412970714a5bb6d16" + "2.12.0": + url: "https://github.com/dpilger26/NumCpp/archive/Version_2.12.0.tar.gz" + sha256: "4c7266d405c8058f87467732129362b5a5c810d36df91e8655defa4d93fc141b" + "2.11.0": + url: "https://github.com/dpilger26/NumCpp/archive/Version_2.11.0.tar.gz" + sha256: "ea675775c3535589f268224efa31ae6003a68e95a465e92c99496a0c9366bdc2" + "2.10.1": + url: "https://github.com/dpilger26/NumCpp/archive/Version_2.10.1.tar.gz" + sha256: "847382a780bea2a9b804c1835dcc5f9addabd0d1e3eb9c8339cde9422a5008d6" + "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 7a09bc41279ec..d8dc35d2e0548 100644 --- a/recipes/numcpp/all/conanfile.py +++ b/recipes/numcpp/all/conanfile.py @@ -12,11 +12,11 @@ class NumCppConan(ConanFile): name = "numcpp" description = "A Templatized Header Only C++ Implementation of the Python NumPy Library" - topics = ("python", "numpy", "numeric") + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/dpilger26/NumCpp" - license = "MIT" - + topics = ("python", "numpy", "numeric", "header-library") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" options = { "with_boost" : [True, False], @@ -26,21 +26,29 @@ class NumCppConan(ConanFile): "with_boost" : True, "threads" : False, } - no_copy_source = True + short_paths = True @property def _min_cppstd(self): - return "14" + 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": "5", - "clang": "3.4", - "apple-clang": "10", - "Visual Studio": "14", - "msvc": "190", + "gcc": "8", + "clang": "7", + "apple-clang": "12", + "Visual Studio": "15", + "msvc": "191", } def config_options(self): @@ -53,7 +61,7 @@ def layout(self): def requirements(self): if self.options.get_safe("with_boost", True): - self.requires("boost/1.80.0", transitive_headers=True) + self.requires("boost/1.83.0", transitive_headers=True) def package_id(self): self.info.clear() @@ -61,16 +69,29 @@ def package_id(self): 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.", ) + # since 2.10.0, numcpp requires filesystem + if Version(self.version) >= "2.10.0" and \ + self.settings.compiler == "clang" and Version(self.settings.compiler.version) < "12" and \ + self.settings.compiler.libcxx == "libstdc++11": + raise ConanInvalidConfiguration( + f"{self.ref} doesn't support clang<12 with libstdc++11 due to filesystem library.", + ) + + # since 2.12.0, numcpp uses TRUE/FALSE symbol which are defined by macOSX SDK + # https://github.com/dpilger26/NumCpp/issues/204 + if Version(self.version) == "2.12.0" and self.settings.compiler == "apple-clang": + raise ConanInvalidConfiguration( + f"{self.ref} doesn't support apple-clang by defining TRUE/FALSE symbols", + ) + 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 @@ -95,6 +116,12 @@ def package_info(self): self.cpp_info.bindirs = [] self.cpp_info.libdirs = [] + if Version(self.version) >= "2.10.0": + if self.settings.compiler == "gcc" and Version(self.settings.compiler.version).major == "8": + self.cpp_info.system_libs.append("stdc++fs") + if self.settings.compiler == "clang" and Version(self.settings.compiler.version).major == "7": + self.cpp_info.system_libs.append("c++fs") + # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.names["cmake_find_package"] = "NumCpp" self.cpp_info.names["cmake_find_package_multi"] = "NumCpp" diff --git a/recipes/numcpp/all/test_package/CMakeLists.txt b/recipes/numcpp/all/test_package/CMakeLists.txt index b99c5d153ee5b..18d7cfddbd897 100644 --- a/recipes/numcpp/all/test_package/CMakeLists.txt +++ b/recipes/numcpp/all/test_package/CMakeLists.txt @@ -5,4 +5,8 @@ find_package(NumCpp REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE NumCpp::NumCpp) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) +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/config.yml b/recipes/numcpp/config.yml index d9c228a9d4542..a222baacafc0a 100644 --- a/recipes/numcpp/config.yml +++ b/recipes/numcpp/config.yml @@ -1,4 +1,14 @@ versions: + "2.12.1": + folder: "all" + "2.12.0": + folder: "all" + "2.11.0": + folder: "all" + "2.10.1": + folder: "all" + "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 index e25c8364f1d83..a9ea8cc742401 100644 --- a/recipes/nuraft/all/conandata.yml +++ b/recipes/nuraft/all/conandata.yml @@ -1,10 +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" - sha256: 8147e2f3b950f944433220539376b1c8e0e93207902f48aa2d3bcbca814a674a diff --git a/recipes/nuraft/all/conanfile.py b/recipes/nuraft/all/conanfile.py index 38fbab82bf133..d1f0175ecb6cf 100644 --- a/recipes/nuraft/all/conanfile.py +++ b/recipes/nuraft/all/conanfile.py @@ -1,64 +1,67 @@ -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 +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" -required_conan_version = ">=1.50.0" class NuRaftConan(ConanFile): name = "nuraft" - homepage = "https://github.corp.ebay.com/sds/NuRaft" + homepage = "https://github.com/eBay/NuRaft" description = """Cornerstone based RAFT library.""" - topics = ("raft") + topics = ("raft",) url = "https://github.com/conan-io/conan-center-index" license = "Apache-2.0" - settings = "os", "compiler", "arch", "build_type" - + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { + "shared": [True, False], + "fPIC": [True, False], "asio": ["boost", "standalone"], - "shared": ['True', 'False'], - "fPIC": ['True', 'False'], } default_options = { - "asio": "boost", "shared": False, "fPIC": True, + "asio": "boost", } 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: + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): + self.requires("openssl/[>=1.1 <4]") if self.options.asio == "boost": - self.requires("boost/1.79.0") + self.requires("boost/1.81.0") else: - self.requires("asio/1.22.1") - self.requires("openssl/1.1.1s") + self.requires("asio/1.27.0") 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: + if self.settings.os == "Windows": + raise ConanInvalidConfiguration(f"{self.ref} doesn't support Windows") + if self.settings.os == "Macos" and self.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} shared not supported for Macos") + if self.settings.compiler.get_safe("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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) tc.generate() - cmake = CMakeDeps(self) - cmake.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): apply_conandata_patches(self) @@ -67,12 +70,11 @@ def build(self): 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() - 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"]) + self.cpp_info.system_libs.extend(["m", "pthread"]) 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 index d722680750dcd..a85fdad5cb296 100644 --- a/recipes/nuraft/all/test_package/CMakeLists.txt +++ b/recipes/nuraft/all/test_package/CMakeLists.txt @@ -1,12 +1,8 @@ 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) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE nuraft::nuraft) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/nuraft/all/test_package/conanfile.py b/recipes/nuraft/all/test_package/conanfile.py index a81309f2fe1fc..0a6bc68712d90 100644 --- a/recipes/nuraft/all/test_package/conanfile.py +++ b/recipes/nuraft/all/test_package/conanfile.py @@ -1,11 +1,19 @@ -import os from conan import ConanFile -from conans import CMake -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" - 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 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/nuraft/all/test_v1_package/CMakeLists.txt b/recipes/nuraft/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/nuraft/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/nuraft/all/test_v1_package/conanfile.py b/recipes/nuraft/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/nuraft/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/nuraft/config.yml b/recipes/nuraft/config.yml index d77ad03cbf510..2d136f3fe768d 100644 --- a/recipes/nuraft/config.yml +++ b/recipes/nuraft/config.yml @@ -1,3 +1,5 @@ versions: + "2.1.0": + folder: all "2.0.0": folder: all diff --git a/recipes/nv-codec-headers/all/conandata.yml b/recipes/nv-codec-headers/all/conandata.yml index 708ee808ccc1d..482c89e58c766 100644 --- a/recipes/nv-codec-headers/all/conandata.yml +++ b/recipes/nv-codec-headers/all/conandata.yml @@ -1,7 +1,13 @@ sources: + "12.1.14.0": + url: "https://github.com/FFmpeg/nv-codec-headers/archive/n12.1.14.0.tar.gz" + sha256: "2fefaa227d2a3b4170797796425a59d1dd2ed5fd231db9b4244468ba327acd0b" + "12.0.16.0": + url: "https://github.com/FFmpeg/nv-codec-headers/archive/n12.0.16.0.tar.gz" + sha256: "2a1533b65f55f9da52956faf0627ed3b74868ac0c7f269990edd21369113b48f" "11.1.5.1": url: "https://github.com/FFmpeg/nv-codec-headers/archive/n11.1.5.1.tar.gz" sha256: "d095fbd56aa93772471a323be0ebe65504a0f43f06c76a30b6d25da77b06ae9c" "9.1.23.2": - url: https://github.com/FFmpeg/nv-codec-headers/releases/download/n9.1.23.2/nv-codec-headers-9.1.23.2.tar.gz - sha256: 34c9d1aedf32dc4b9fb22e94dbb041de666b568ceb4bdb317e414b752a3f9a9a + url: "https://github.com/FFmpeg/nv-codec-headers/releases/download/n9.1.23.2/nv-codec-headers-9.1.23.2.tar.gz" + sha256: "34c9d1aedf32dc4b9fb22e94dbb041de666b568ceb4bdb317e414b752a3f9a9a" diff --git a/recipes/nv-codec-headers/all/conanfile.py b/recipes/nv-codec-headers/all/conanfile.py index b7d41a1b54635..f21dc25aa7ca9 100644 --- a/recipes/nv-codec-headers/all/conanfile.py +++ b/recipes/nv-codec-headers/all/conanfile.py @@ -1,60 +1,67 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, tools import os -required_conan_version = ">=1.35.0" +from conan import ConanFile +from conan.tools.files import chdir, get, load, rmdir, save +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout + +required_conan_version = ">=1.52.0" + class FFNvEncHeaders(ConanFile): name = "nv-codec-headers" description = "FFmpeg version of headers required to interface with Nvidia's codec APIs" - topics = ("ffmpeg", "video", "nvidia", "headers") + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/FFmpeg/nv-codec-headers" - license = "MIT" - settings = "os" + topics = ("ffmpeg", "video", "nvidia", "headers", "header-only") - _autotools = None - _source_subfolder = "source_subfolder" + package_type = "header-library" + 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 package_id(self): + self.info.clear() + def build_requirements(self): if self._settings_build.os == "Windows": if "CONAN_MAKE_PROGRAM" not in os.environ: - self.build_requires("make/4.2.1") - - def package_id(self): - self.info.header_only() + self.build_requires("make/4.4") 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) - return self._autotools + def generate(self): + tc = AutotoolsToolchain(self) + tc.generate() def build(self): - autotools = self._configure_autotools() - with tools.chdir(os.path.join(self.build_folder, self._source_subfolder)): + with chdir(self, self.source_folder): + autotools = Autotools(self) autotools.make() def _extract_license(self): # Extract the License/s from the header to a file - tmp = tools.load(os.path.join(self._source_subfolder, "include", "ffnvcodec", "nvEncodeAPI.h")) - license_contents = tmp[2:tmp.find("*/", 1)] # The license begins with a C comment /* and ends with */ - tools.save(os.path.join(self.package_folder, "licenses", "LICENSE"), license_contents) + tmp = load(self, os.path.join(self.source_folder, "include", "ffnvcodec", "nvEncodeAPI.h")) + license_contents = tmp[2 : tmp.find("*/", 1)] # The license begins with a C comment /* and ends with */ + save(self, os.path.join(self.package_folder, "licenses", "LICENSE"), license_contents) def package(self): self._extract_license() - - autotools = self._configure_autotools() - with tools.chdir(os.path.join(self.build_folder, self._source_subfolder)): - autotools.install(args=["PREFIX={}".format(self.package_folder)]) - - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.install(args=["PREFIX=/"]) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): - self.cpp_info.names["pkg_config"] = "ffnvcodec" + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + self.cpp_info.set_property("pkg_config_name", "ffnvcodec") diff --git a/recipes/nv-codec-headers/all/test_package/CMakeLists.txt b/recipes/nv-codec-headers/all/test_package/CMakeLists.txt index 7b9b613cbb24a..a89c9eadf95fc 100644 --- a/recipes/nv-codec-headers/all/test_package/CMakeLists.txt +++ b/recipes/nv-codec-headers/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ -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() +find_package(nv-codec-headers REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE nv-codec-headers::nv-codec-headers) diff --git a/recipes/nv-codec-headers/all/test_package/conanfile.py b/recipes/nv-codec-headers/all/test_package/conanfile.py index bd7165a553cf4..ef5d7042163ec 100644 --- a/recipes/nv-codec-headers/all/test_package/conanfile.py +++ b/recipes/nv-codec-headers/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/nv-codec-headers/all/test_package/test_package.c b/recipes/nv-codec-headers/all/test_package/test_package.c index 6742254a188e9..2cb0fd61df830 100644 --- a/recipes/nv-codec-headers/all/test_package/test_package.c +++ b/recipes/nv-codec-headers/all/test_package/test_package.c @@ -4,7 +4,7 @@ #include #include -int main () { +int main() { printf("hello NVENC API version %u.%u\n", NVENCAPI_MAJOR_VERSION, NVENCAPI_MINOR_VERSION); return EXIT_SUCCESS; } diff --git a/recipes/nv-codec-headers/config.yml b/recipes/nv-codec-headers/config.yml index 993edd5a10422..21a0b445119b1 100644 --- a/recipes/nv-codec-headers/config.yml +++ b/recipes/nv-codec-headers/config.yml @@ -1,4 +1,8 @@ versions: + "12.1.14.0": + folder: all + "12.0.16.0": + folder: all "11.1.5.1": folder: all "9.1.23.2": diff --git a/recipes/nvcloth/1.1.6/CMakeLists.txt b/recipes/nvcloth/1.1.6/CMakeLists.txt index a236130272a84..4cd8eda7866f8 100644 --- a/recipes/nvcloth/1.1.6/CMakeLists.txt +++ b/recipes/nvcloth/1.1.6/CMakeLists.txt @@ -1,7 +1,5 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) +# Using a CMake wrapper because the project's CMakeLists.txt does not set project() +cmake_minimum_required(VERSION 3.15) +project(cmake_wrapper CXX) -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory("source_subfolder/NvCloth/compiler/cmake/${TARGET_BUILD_PLATFORM}") +add_subdirectory("src/NvCloth/compiler/cmake/${TARGET_BUILD_PLATFORM}") diff --git a/recipes/nvcloth/1.1.6/conandata.yml b/recipes/nvcloth/1.1.6/conandata.yml index c37596cc7f7b6..657fa6c95ca38 100644 --- a/recipes/nvcloth/1.1.6/conandata.yml +++ b/recipes/nvcloth/1.1.6/conandata.yml @@ -5,8 +5,5 @@ sources: patches: "1.1.6": - patch_file: "patches/0001-PsAllocator-include-typeinfo.patch" - base_path: "source_subfolder" - patch_file: "patches/0002-CallbackFix.patch" - base_path: "source_subfolder" - patch_file: "patches/0003-PsAllocator.patch" - base_path: "source_subfolder" diff --git a/recipes/nvcloth/1.1.6/conanfile.py b/recipes/nvcloth/1.1.6/conanfile.py index c303576ad28c2..abfae884a66d8 100644 --- a/recipes/nvcloth/1.1.6/conanfile.py +++ b/recipes/nvcloth/1.1.6/conanfile.py @@ -1,175 +1,152 @@ import os import shutil -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -from conan.tools.microsoft import msvc_runtime_flag, is_msvc_static_runtime, is_msvc +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 Environment +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir +from conan.tools.microsoft import check_min_vs, is_msvc_static_runtime + +required_conan_version = ">=1.53.0" -required_conan_version = ">=1.35.0" class NvclothConan(ConanFile): name = "nvcloth" + description = "NvCloth is a library that provides low level access to a cloth solver designed for realtime interactive applications." license = "Nvidia Source Code License (1-Way Commercial)" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/NVIDIAGameWorks/NvCloth" - description = "NvCloth is a library that provides low level access to a cloth solver designed for realtime interactive applications." topics = ("physics", "physics-engine", "physics-simulation", "game-development", "cuda") - # Binary configuration - settings = "os", "compiler", "build_type", "arch" + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], "use_cuda": [True, False], - "use_dx11": [True, False] + "use_dx11": [True, False], } default_options = { "shared": False, "fPIC": True, "use_cuda": False, - "use_dx11": False + "use_dx11": False, } - generators = "cmake" + def export_sources(self): + export_conandata_patches(self) + copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) - @property - def _source_subfolder(self): - return "source_subfolder" + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC - @property - def _build_subfolder(self): - return "build_subfolder" - - def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") - 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 validate(self): - if self.settings.os not in ["Windows", "Linux", "Macos", "Android", "iOS"]: - raise ConanInvalidConfiguration("Current os is not supported") + if self.settings.os not in ["Windows", "Linux", "FreeBSD", "Macos", "Android", "iOS"]: + raise ConanInvalidConfiguration(f"{self.settings.os} is not supported") - build_type = self.settings.build_type - if build_type not in ["Debug", "RelWithDebInfo", "Release"]: - raise ConanInvalidConfiguration("Current build_type is not supported") + if self.settings.os in ["Windows", "Macos"] and not self.options.shared: + raise ConanInvalidConfiguration(f"Static builds are not supported on {self.settings.os}") + if self.settings.os in ["iOS", "Android"] and self.options.shared: + raise ConanInvalidConfiguration(f"Shared builds are not supported on {self.settings.os}") - if is_msvc(self) and tools.Version(self.settings.compiler.version) < 9: - raise ConanInvalidConfiguration("Visual Studio versions < 9 are not supported") + if self.settings.build_type not in ["Debug", "RelWithDebInfo", "Release"]: + raise ConanInvalidConfiguration(f"{self.settings.build_type} build_type is not supported") - def _configure_cmake(self): - cmake = CMake(self) - if not self.options.shared: - cmake.definitions["PX_STATIC_LIBRARIES"] = 1 - cmake.definitions["STATIC_WINCRT"] = is_msvc_static_runtime(self) + check_min_vs(self, 150) + check_min_cppstd(self, 11) - cmake.definitions["NV_CLOTH_ENABLE_CUDA"] = self.options.use_cuda - cmake.definitions["NV_CLOTH_ENABLE_DX11"] = self.options.use_dx11 + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) - cmake.definitions["TARGET_BUILD_PLATFORM"] = self._get_target_build_platform() + @property + def _target_build_platform(self): + return { + "Windows": "windows", + "Linux": "linux", + "Macos": "mac", + "Android": "android", + "iOS": "ios", + }.get(str(self.settings.os)) + + def generate(self): + tc = CMakeToolchain(self) + if not self.options.shared: + tc.variables["PX_STATIC_LIBRARIES"] = 1 + tc.variables["STATIC_WINCRT"] = is_msvc_static_runtime(self) + tc.variables["NV_CLOTH_ENABLE_CUDA"] = self.options.use_cuda + tc.variables["NV_CLOTH_ENABLE_DX11"] = self.options.use_dx11 + tc.variables["TARGET_BUILD_PLATFORM"] = self._target_build_platform + tc.generate() + + env = Environment() + env.define_path("GW_DEPS_ROOT", self.source_folder) + env.vars(self).save_script("conan_build_vars") - cmake.configure( - build_folder=os.path.join(self.build_folder, self._build_subfolder) - ) - return cmake - def _remove_samples(self): - tools.rmdir(os.path.join(self._source_subfolder, "NvCloth", "samples")) + rmdir(self, os.path.join(self.source_folder, "NvCloth", "samples")) def _patch_sources(self): # There is no reason to force consumer of PhysX public headers to use one of # NDEBUG or _DEBUG, since none of them relies on NDEBUG or _DEBUG - tools.replace_in_file(os.path.join(self.build_folder, self._source_subfolder, "PxShared", "include", "foundation", "PxPreprocessor.h"), - "#error Exactly one of NDEBUG and _DEBUG needs to be defined!", - "// #error Exactly one of NDEBUG and _DEBUG needs to be defined!") - shutil.copy( - os.path.join(self.build_folder, self._source_subfolder, "NvCloth/include/NvCloth/Callbacks.h"), - os.path.join(self.build_folder, self._source_subfolder, "NvCloth/include/NvCloth/Callbacks.h.origin") - ) - for patch in self.conan_data["patches"][self.version]: - tools.patch(**patch) - - if self.settings.build_type == "Debug": - shutil.copy( - os.path.join(self.build_folder, self._source_subfolder, "NvCloth/include/NvCloth/Callbacks.h"), - os.path.join(self.build_folder, self._source_subfolder, "NvCloth/include/NvCloth/Callbacks.h.patched") - ) - shutil.copy( - os.path.join(self.build_folder, self._source_subfolder, "NvCloth/include/NvCloth/Callbacks.h.origin"), - os.path.join(self.build_folder, self._source_subfolder, "NvCloth/include/NvCloth/Callbacks.h") - ) - - def config_options(self): - if self.settings.os == "Windows": - del self.options.fPIC + replace_in_file(self, os.path.join(self.source_folder, "PxShared", "include", "foundation", "PxPreprocessor.h"), + "#error Exactly one of NDEBUG and _DEBUG needs to be defined!", + "// #error Exactly one of NDEBUG and _DEBUG needs to be defined!") + shutil.copy(os.path.join(self.source_folder, "NvCloth", "include", "NvCloth", "Callbacks.h"), + os.path.join(self.source_folder, "NvCloth", "include", "NvCloth", "Callbacks.h.origin")) + apply_conandata_patches(self) - def configure(self): - if self.options.shared: - del self.options.fPIC + if self.settings.build_type == "Debug": + shutil.copy(os.path.join(self.source_folder, "NvCloth", "include", "NvCloth", "Callbacks.h"), + os.path.join(self.source_folder, "NvCloth", "include", "NvCloth", "Callbacks.h.patched")) + shutil.copy(os.path.join(self.source_folder, "NvCloth", "include", "NvCloth", "Callbacks.h.origin"), + os.path.join(self.source_folder, "NvCloth", "include", "NvCloth", "Callbacks.h")) def build(self): - with tools.environment_append({"GW_DEPS_ROOT": os.path.abspath(self._source_subfolder)}): - self._patch_sources() - self._remove_samples() - cmake = self._configure_cmake() - cmake.build() - - def _get_build_type(self): - if self.settings.build_type == "Debug": - return "debug" - elif self.settings.build_type == "RelWithDebInfo": - return "checked" - elif self.settings.build_type == "Release": - return "release" - - def _get_target_build_platform(self): - return { - "Windows" : "windows", - "Linux" : "linux", - "Macos" : "mac", - "Android" : "android", - "iOS" : "ios" - }.get(str(self.settings.os)) + self._patch_sources() + self._remove_samples() + cmake = CMake(self) + cmake.configure(build_script_folder=self.source_path.parent) + cmake.build() def package(self): if self.settings.build_type == "Debug": - shutil.copy( - os.path.join(self._source_subfolder, "NvCloth/include/NvCloth/Callbacks.h.patched"), - os.path.join(self._source_subfolder, "NvCloth/include/NvCloth/Callbacks.h") - ) - nvcloth_source_subfolder = os.path.join(self.build_folder, self._source_subfolder) - nvcloth_build_subfolder = os.path.join(self.build_folder, self._build_subfolder) - - self.copy(pattern="NvCloth/license.txt", dst="licenses", src=nvcloth_source_subfolder, keep_path=False) - self.copy("*.h", dst="include", src=os.path.join(nvcloth_source_subfolder, "NvCloth", "include")) - self.copy("*.h", dst="include", src=os.path.join(nvcloth_source_subfolder, "NvCloth", "extensions", "include")) - self.copy("*.h", dst="include", src=os.path.join(nvcloth_source_subfolder, "PxShared", "include")) - self.copy("*.a", dst="lib", src=nvcloth_build_subfolder, keep_path=False) - self.copy("*.lib", dst="lib", src=nvcloth_build_subfolder, keep_path=False) - self.copy("*.dylib*", dst="lib", src=nvcloth_build_subfolder, keep_path=False) - self.copy("*.dll", dst="bin", src=nvcloth_build_subfolder, keep_path=False) - self.copy("*.so", dst="lib", src=nvcloth_build_subfolder, keep_path=False) + shutil.copy(os.path.join(self.source_folder, "NvCloth", "include", "NvCloth", "Callbacks.h.patched"), + os.path.join(self.source_folder, "NvCloth", "include", "NvCloth", "Callbacks.h")) + copy(self, "NvCloth/license.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder, keep_path=False) + copy(self, "*.h", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self.source_folder, "NvCloth", "include")) + copy(self, "*.h", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self.source_folder, "NvCloth", "extensions", "include")) + copy(self, "*.h", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self.source_folder, "PxShared", "include")) + copy(self, "*.a", dst=os.path.join(self.package_folder, "lib"), src=self.build_folder, keep_path=False) + copy(self, "*.lib", dst=os.path.join(self.package_folder, "lib"), src=self.build_folder, keep_path=False) + copy(self, "*.dylib*", dst=os.path.join(self.package_folder, "lib"), src=self.build_folder, keep_path=False) + copy(self, "*.dll", dst=os.path.join(self.package_folder, "bin"), src=self.build_folder, keep_path=False) + copy(self, "*.so", dst=os.path.join(self.package_folder, "lib"), src=self.build_folder, keep_path=False) def package_info(self): - self.cpp_info.names["cmake_find_package"] = "nvcloth" - self.cpp_info.names["cmake_find_package_multi"] = "nvcloth" + self.cpp_info.set_property("cmake_file_name", "nvcloth") + self.cpp_info.set_property("cmake_target_name", "nvcloth::nvcloth") if self.settings.build_type == "Debug": debug_suffix = "DEBUG" else: debug_suffix = "" - if self.settings.os == "Windows": - if self.settings.arch == "x86_64": - arch_suffix = "x64" - else: - arch_suffix = "" - self.cpp_info.libs = ["NvCloth{}_{}".format(debug_suffix, arch_suffix)] + if self.settings.os == "Windows" and self.settings.arch == "x86_64": + arch_suffix = "_x64" else: - self.cpp_info.libs = ["NvCloth{}".format(debug_suffix)] + arch_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"NvCloth{debug_suffix}{arch_suffix}"] + + if self.settings.os in ("FreeBSD", "Linux"): + self.cpp_info.system_libs.append("m") diff --git a/recipes/nvcloth/1.1.6/test_package/CMakeLists.txt b/recipes/nvcloth/1.1.6/test_package/CMakeLists.txt index e0165aeedb7a2..d8a9e2773d7d6 100644 --- a/recipes/nvcloth/1.1.6/test_package/CMakeLists.txt +++ b/recipes/nvcloth/1.1.6/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 CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +find_package(nvcloth REQUIRED CONFIG) find_package(nvcloth REQUIRED nvcloth CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} nvcloth::nvcloth) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/nvcloth/1.1.6/test_package/conanfile.py b/recipes/nvcloth/1.1.6/test_package/conanfile.py index e290e81a631fa..ef5d7042163ec 100644 --- a/recipes/nvcloth/1.1.6/test_package/conanfile.py +++ b/recipes/nvcloth/1.1.6/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 NvClothTestConan(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 +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/nvcloth/1.1.6/test_v1_package/CMakeLists.txt b/recipes/nvcloth/1.1.6/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/nvcloth/1.1.6/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/nvcloth/1.1.6/test_v1_package/conanfile.py b/recipes/nvcloth/1.1.6/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..e290e81a631fa --- /dev/null +++ b/recipes/nvcloth/1.1.6/test_v1_package/conanfile.py @@ -0,0 +1,16 @@ +import os +from conans import ConanFile, CMake, tools + +class NvClothTestConan(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/nvtx/all/conandata.yml b/recipes/nvtx/all/conandata.yml index 7d5d894d50353..48340be192d8e 100644 --- a/recipes/nvtx/all/conandata.yml +++ b/recipes/nvtx/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.1.0": + url: "https://github.com/NVIDIA/NVTX/archive/v3.1.0.tar.gz" + sha256: "dc4e4a227d04d3da46ad920dfee5f7599ac8d6b2ee1809c9067110fb1cc71ced" "3.0.1": url: "https://github.com/NVIDIA/NVTX/archive/refs/tags/v3.0.1.tar.gz" sha256: "bb8d1536aad708ec807bc675e12e5838c2f84481dec4005cd7a9bbd49e326ba1" diff --git a/recipes/nvtx/all/conanfile.py b/recipes/nvtx/all/conanfile.py index fbe722ba0c892..049e362302672 100644 --- a/recipes/nvtx/all/conanfile.py +++ b/recipes/nvtx/all/conanfile.py @@ -16,6 +16,7 @@ class NVTXConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" license = "Apache-2.0" topics = ("profiler", "nvidia", "nsight") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -26,8 +27,7 @@ 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 diff --git a/recipes/nvtx/config.yml b/recipes/nvtx/config.yml index f1eca9cdf76de..188be115336dd 100644 --- a/recipes/nvtx/config.yml +++ b/recipes/nvtx/config.yml @@ -1,3 +1,5 @@ versions: + "3.1.0": + folder: all "3.0.1": folder: all diff --git a/recipes/oatpp-libressl/all/conanfile.py b/recipes/oatpp-libressl/all/conanfile.py index 6eec475cde13d..02cb36cfa573c 100644 --- a/recipes/oatpp-libressl/all/conanfile.py +++ b/recipes/oatpp-libressl/all/conanfile.py @@ -7,7 +7,7 @@ from conan.tools.scm import Version import os -required_conan_version = ">=1.51.1" +required_conan_version = ">=1.54" class OatppLibresslConan(ConanFile): @@ -18,6 +18,7 @@ class OatppLibresslConan(ConanFile): description = "oat++ libressl library" topics = ("oat++", "oatpp", "libressl") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -34,21 +35,24 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires(f"oatpp/{self.version}") - self.requires("libressl/3.5.3") + # There's a 1 to 1 match between versions of oatpp and oatpp-libressl + # oatpp-libressl/oatpp-libressl/Config.hpp:28 and 30 contain includes to these libraries + self.requires(f"oatpp/{self.version}", transitive_headers=True) + self.requires("libressl/3.5.3", transitive_headers=True) + + @property + def _min_cppstd(self): + return 11 def validate(self): if self.info.settings.compiler.get_safe("cppstd"): - check_min_cppstd(self, 11) + check_min_cppstd(self, self._min_cppstd) if is_msvc(self) and self.info.options.shared: raise ConanInvalidConfiguration(f"{self.ref} can not be built as shared library with msvc") @@ -64,8 +68,6 @@ 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() @@ -84,6 +86,10 @@ def package(self): def package_info(self): self.cpp_info.set_property("cmake_file_name", "oatpp-libressl") self.cpp_info.set_property("cmake_target_name", "oatpp::oatpp-libressl") + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") + # TODO: back to global scope in conan v2 once legacy generators removed self.cpp_info.components["_oatpp-libressl"].includedirs = [ os.path.join("include", f"oatpp-{self.version}", "oatpp-libressl") diff --git a/recipes/oatpp-openssl/all/conanfile.py b/recipes/oatpp-openssl/all/conanfile.py index d109d1b7545bb..771c7d111c06d 100644 --- a/recipes/oatpp-openssl/all/conanfile.py +++ b/recipes/oatpp-openssl/all/conanfile.py @@ -7,7 +7,7 @@ from conan.tools.scm import Version import os -required_conan_version = ">=1.51.1" +required_conan_version = ">=2.1" class OatppOpenSSLConan(ConanFile): @@ -18,6 +18,7 @@ class OatppOpenSSLConan(ConanFile): description = "Oat++ OpenSSL library" topics = ("oat++", "oatpp", "openssl") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -28,27 +29,19 @@ class OatppOpenSSLConan(ConanFile): "fPIC": 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 + implements = ["auto_shared_fpic"] def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires(f"oatpp/{self.version}") - self.requires("openssl/3.0.5") + # Used in oatpp-openssl/oatpp-openssl/Config.hpp public header + self.requires(f"oatpp/{self.version}", transitive_headers=True) + # Used SSL* and SSL_CTX* used in public headers + self.requires("openssl/[>=1.1 <4]", transitive_headers=True) def validate(self): - if self.info.settings.compiler.get_safe("cppstd"): - check_min_cppstd(self, 11) + 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") @@ -57,13 +50,12 @@ def validate(self): 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) - tc.variables["OATPP_BUILD_TESTS"] = False - tc.variables["OATPP_MODULES_LOCATION"] = "INSTALLED" + tc.cache_variables["OATPP_BUILD_TESTS"] = False + tc.cache_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() @@ -76,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", self.source_folder, os.path.join(self.package_folder, "licenses")) cmake = CMake(self) cmake.install() rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) @@ -84,6 +76,7 @@ def package(self): def package_info(self): self.cpp_info.set_property("cmake_file_name", "oatpp-openssl") self.cpp_info.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", f"oatpp-{self.version}", "oatpp-openssl") @@ -97,12 +90,5 @@ def package_info(self): 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 716aedd7390f1..5aaf8115d1dba 100644 --- a/recipes/oatpp-openssl/all/test_package/CMakeLists.txt +++ b/recipes/oatpp-openssl/all/test_package/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.15) project(test_package LANGUAGES CXX) find_package(oatpp-openssl REQUIRED CONFIG) diff --git a/recipes/oatpp-openssl/all/test_package/test_package.cpp b/recipes/oatpp-openssl/all/test_package/test_package.cpp index 5b43d477e581e..a3e8d635fe6aa 100644 --- a/recipes/oatpp-openssl/all/test_package/test_package.cpp +++ b/recipes/oatpp-openssl/all/test_package/test_package.cpp @@ -2,8 +2,7 @@ #include "oatpp-openssl/Config.hpp" int main() { - - oatpp::openssl::Config config; - + std::shared_ptr config = oatpp::openssl::Config::createShared(); + std::cout << "Test package successful\n"; return 0; } diff --git a/recipes/oatpp-openssl/all/test_v1_package/CMakeLists.txt b/recipes/oatpp-openssl/all/test_v1_package/CMakeLists.txt deleted file mode 100644 index 07d783bdbcaec..0000000000000 --- a/recipes/oatpp-openssl/all/test_v1_package/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -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-postgresql/all/conanfile.py b/recipes/oatpp-postgresql/all/conanfile.py index 5aa80c1777d6d..e1a3c065c3b16 100644 --- a/recipes/oatpp-postgresql/all/conanfile.py +++ b/recipes/oatpp-postgresql/all/conanfile.py @@ -7,7 +7,7 @@ from conan.tools.scm import Version import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class OatppPostgresqlConan(ConanFile): @@ -18,6 +18,7 @@ class OatppPostgresqlConan(ConanFile): description = "oat++ PostgreSQL library" topics = ("oat", "postgresql", "orm", "database") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -37,17 +38,15 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires(f"oatpp/{self.version}") - self.requires("libpq/14.5") + # Most headers include oatpp's + self.requires(f"oatpp/{self.version}", transitive_headers=True) + self.requires("libpq/15.4") def validate(self): if self.info.settings.compiler.get_safe("cppstd"): diff --git a/recipes/oatpp-sqlite/all/conanfile.py b/recipes/oatpp-sqlite/all/conanfile.py index 75896ed5f3e71..5d2b46351ef5e 100644 --- a/recipes/oatpp-sqlite/all/conanfile.py +++ b/recipes/oatpp-sqlite/all/conanfile.py @@ -7,17 +7,17 @@ from conan.tools.scm import Version import os -required_conan_version = ">=1.51.1" +required_conan_version = ">=1.53.0" class OatppsqliteConan(ConanFile): name = "oatpp-sqlite" + description = "SQLite adapter for oatpp ORM." license = "Apache-2.0" - homepage = "https://github.com/oatpp/oatpp-sqlite" url = "https://github.com/conan-io/conan-center-index" - description = "oat++ SQLite library" + homepage = "https://github.com/oatpp/oatpp-sqlite" topics = ("oat++", "oatpp", "sqlite") - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -34,17 +34,14 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires(f"oatpp/{self.version}") - self.requires("sqlite3/3.39.4") + self.requires(f"oatpp/{self.version}", transitive_headers=True) + self.requires("sqlite3/3.45.0") def validate(self): if self.info.settings.compiler.get_safe("cppstd"): @@ -57,8 +54,7 @@ def validate(self): 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/oatpp/all/conandata.yml b/recipes/oatpp/all/conandata.yml index d78e0b1d715f8..afae435ea8dae 100644 --- a/recipes/oatpp/all/conandata.yml +++ b/recipes/oatpp/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.3.0.latest": + url: "https://github.com/oatpp/oatpp/archive/1.3.0-latest.tar.gz" + sha256: "adc3b88076532838cd0fb8155872d6a9467ac0cb5df319735a2396ce6945d064" "1.3.0": url: "https://github.com/oatpp/oatpp/archive/1.3.0.tar.gz" sha256: "e1f80fa8fd7a74da6737e7fee1a4db68b4d7085a3f40e7d550752d6ff5714583" diff --git a/recipes/oatpp/all/conanfile.py b/recipes/oatpp/all/conanfile.py index 900a520d4fc5d..ac27a054d2bc3 100644 --- a/recipes/oatpp/all/conanfile.py +++ b/recipes/oatpp/all/conanfile.py @@ -5,9 +5,10 @@ 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 +from conan.tools.env import VirtualBuildEnv import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.54.0" class OatppConan(ConanFile): @@ -15,42 +16,55 @@ 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], + "with_test_library": [True, False], } default_options = { "shared": False, "fPIC": True, + "with_test_library": False, } + @property + def _version(self): + version = str(self.version) + if version.endswith(".latest"): + version = version[:-len(".latest")] + return version + 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.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 build_requirements(self): + if Version(self._version) >= "1.3.0": + self.tool_requires("cmake/[>=3.20 <4]") 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,9 +72,10 @@ 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.variables["OATPP_LINK_TEST_LIBRARY"] = self.options.with_test_library tc.generate() + venv = VirtualBuildEnv(self) + venv.generate(scope="build") def build(self): cmake = CMake(self) @@ -76,8 +91,8 @@ def package(self): def package_info(self): self.cpp_info.set_property("cmake_file_name", "oatpp") - include_dir = os.path.join("include", f"oatpp-{self.version}", "oatpp") - lib_dir = os.path.join("lib", f"oatpp-{self.version}") + include_dir = os.path.join("include", f"oatpp-{self._version}", "oatpp") + lib_dir = os.path.join("lib", f"oatpp-{self._version}") # oatpp self.cpp_info.components["_oatpp"].names["cmake_find_package"] = "oatpp" @@ -87,18 +102,19 @@ def package_info(self): self.cpp_info.components["_oatpp"].libdirs = [lib_dir] self.cpp_info.components["_oatpp"].libs = ["oatpp"] if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.components["_oatpp"].system_libs = ["pthread"] + self.cpp_info.components["_oatpp"].system_libs = ["pthread", "m"] elif self.settings.os == "Windows": self.cpp_info.components["_oatpp"].system_libs = ["ws2_32", "wsock32"] # oatpp-test - self.cpp_info.components["oatpp-test"].names["cmake_find_package"] = "oatpp-test" - self.cpp_info.components["oatpp-test"].names["cmake_find_package_multi"] = "oatpp-test" - self.cpp_info.components["oatpp-test"].set_property("cmake_target_name", "oatpp-test::oatpp-test") - self.cpp_info.components["oatpp-test"].includedirs = [include_dir] - self.cpp_info.components["oatpp-test"].libdirs = [lib_dir] - self.cpp_info.components["oatpp-test"].libs = ["oatpp-test"] - self.cpp_info.components["oatpp-test"].requires = ["_oatpp"] + if self.options.with_test_library: + self.cpp_info.components["oatpp-test"].names["cmake_find_package"] = "oatpp-test" + self.cpp_info.components["oatpp-test"].names["cmake_find_package_multi"] = "oatpp-test" + self.cpp_info.components["oatpp-test"].set_property("cmake_target_name", "oatpp-test::oatpp-test") + self.cpp_info.components["oatpp-test"].includedirs = [include_dir] + self.cpp_info.components["oatpp-test"].libdirs = [lib_dir] + self.cpp_info.components["oatpp-test"].libs = ["oatpp-test"] + self.cpp_info.components["oatpp-test"].requires = ["_oatpp"] # workaround to have all components in the global target self.cpp_info.set_property("cmake_target_name", "oatpp::oatpp-test") diff --git a/recipes/oatpp/all/test_package/CMakeLists.txt b/recipes/oatpp/all/test_package/CMakeLists.txt index cffae2f965d2e..9c8af92835a8c 100644 --- a/recipes/oatpp/all/test_package/CMakeLists.txt +++ b/recipes/oatpp/all/test_package/CMakeLists.txt @@ -3,12 +3,6 @@ project(test_package LANGUAGES CXX) find_package(oatpp REQUIRED CONFIG) -if ("${oatpp_VERSION}" VERSION_GREATER_EQUAL "1.3.0") - add_executable(${PROJECT_NAME} test_package.cpp DeserializerTest_1_3_0.cpp) -elseif("${oatpp_VERSION}" VERSION_GREATER_EQUAL "1.1.0") - add_executable(${PROJECT_NAME} test_package.cpp DeserializerTest_1_1_0.cpp) -else() - add_executable(${PROJECT_NAME} test_package.cpp DeserializerTest_1_0_0.cpp) -endif() -target_link_libraries(${PROJECT_NAME} PRIVATE oatpp::oatpp oatpp::oatpp-test) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE oatpp::oatpp) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/oatpp/all/test_package/DeserializerTest.hpp b/recipes/oatpp/all/test_package/DeserializerTest.hpp deleted file mode 100644 index 6c1c0ec06209e..0000000000000 --- a/recipes/oatpp/all/test_package/DeserializerTest.hpp +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef oatpp_test_parser_json_mapping_DeserializerTest_hpp -#define oatpp_test_parser_json_mapping_DeserializerTest_hpp - -#include "oatpp-test/UnitTest.hpp" - -namespace oatpp { namespace test { namespace parser { namespace json { namespace mapping { - -class DeserializerTest : public UnitTest{ -public: - - DeserializerTest():UnitTest("TEST[parser::json::mapping::DeserializerTest]"){} - void onRun() override; - -}; - -}}}}} - -#endif /* oatpp_test_parser_json_mapping_DeserializerTest_hpp */ diff --git a/recipes/oatpp/all/test_package/DeserializerTest_1_0_0.cpp b/recipes/oatpp/all/test_package/DeserializerTest_1_0_0.cpp deleted file mode 100644 index e4cd44ea34920..0000000000000 --- a/recipes/oatpp/all/test_package/DeserializerTest_1_0_0.cpp +++ /dev/null @@ -1,51 +0,0 @@ -#include "DeserializerTest.hpp" - -#include "oatpp/parser/json/mapping/ObjectMapper.hpp" -#include "oatpp/core/macro/codegen.hpp" - -namespace oatpp { namespace test { namespace parser { namespace json { namespace mapping { - -namespace { - -#include OATPP_CODEGEN_BEGIN(DTO) - -typedef oatpp::data::mapping::type::Object DTO; - -class EmptyDto : public DTO { - - DTO_INIT(EmptyDto, DTO) - -}; - -class SampleDto : public DTO { - - DTO_INIT(SampleDto, DTO); - - DTO_FIELD(String, strF); - DTO_FIELD(Int32, int32F); - DTO_FIELD(Float32, float32F); - DTO_FIELD(EmptyDto::ObjectWrapper, object); - DTO_FIELD(List::ObjectWrapper, list); - -}; - -#include OATPP_CODEGEN_END(DTO) - -} - -void DeserializerTest::onRun(){ - - auto mapper = oatpp::parser::json::mapping::ObjectMapper::createShared(); - - auto obj = mapper->readFromString("{ \"strF\": \"value1\", \"int32F\": 30, \"float32F\": 32.4, \"object\": {}\"list\": [] }"); - - OATPP_ASSERT(obj); - OATPP_ASSERT(obj->strF->equals("value1")); - OATPP_ASSERT(obj->int32F->getValue() == 30); - OATPP_ASSERT(obj->float32F); - OATPP_ASSERT(obj->object); - OATPP_ASSERT(obj->list->count() == 0); - -} - -}}}}} diff --git a/recipes/oatpp/all/test_package/DeserializerTest_1_1_0.cpp b/recipes/oatpp/all/test_package/DeserializerTest_1_1_0.cpp deleted file mode 100644 index 93aedbe56f4c3..0000000000000 --- a/recipes/oatpp/all/test_package/DeserializerTest_1_1_0.cpp +++ /dev/null @@ -1,49 +0,0 @@ -#include "DeserializerTest.hpp" - -#include "oatpp/parser/json/mapping/ObjectMapper.hpp" -#include "oatpp/core/macro/codegen.hpp" - -namespace oatpp { namespace test { namespace parser { namespace json { namespace mapping { - -namespace { - -#include OATPP_CODEGEN_BEGIN(DTO) - -class EmptyDto : public oatpp::DTO { - - DTO_INIT(EmptyDto, DTO) - -}; - -class SampleDto : public DTO { - - DTO_INIT(SampleDto, DTO); - - DTO_FIELD(String, strF); - DTO_FIELD(Int32, int32F); - DTO_FIELD(Float32, float32F); - DTO_FIELD(Object, object); - DTO_FIELD(List>, list); - -}; - -#include OATPP_CODEGEN_END(DTO) - -} - -void DeserializerTest::onRun(){ - - auto mapper = oatpp::parser::json::mapping::ObjectMapper::createShared(); - - auto obj = mapper->readFromString>("{ \"strF\": \"value1\", \"int32F\": 30, \"float32F\": 32.4, \"object\": {}\"list\": [] }"); - - OATPP_ASSERT(obj); - OATPP_ASSERT(obj->strF->equals("value1")); - OATPP_ASSERT(obj->int32F == 30); - OATPP_ASSERT(obj->float32F); - OATPP_ASSERT(obj->object); - OATPP_ASSERT(obj->list->size() == 0); - -} - -}}}}} diff --git a/recipes/oatpp/all/test_package/DeserializerTest_1_3_0.cpp b/recipes/oatpp/all/test_package/DeserializerTest_1_3_0.cpp deleted file mode 100644 index 331bb2d27749f..0000000000000 --- a/recipes/oatpp/all/test_package/DeserializerTest_1_3_0.cpp +++ /dev/null @@ -1,49 +0,0 @@ -#include "DeserializerTest.hpp" - -#include "oatpp/parser/json/mapping/ObjectMapper.hpp" -#include "oatpp/core/macro/codegen.hpp" - -namespace oatpp { namespace test { namespace parser { namespace json { namespace mapping { - -namespace { - -#include OATPP_CODEGEN_BEGIN(DTO) - -class EmptyDto : public oatpp::DTO { - - DTO_INIT(EmptyDto, DTO) - -}; - -class SampleDto : public DTO { - - DTO_INIT(SampleDto, DTO); - - DTO_FIELD(String, strF); - DTO_FIELD(Int32, int32F); - DTO_FIELD(Float32, float32F); - DTO_FIELD(Object, object); - DTO_FIELD(List>, list); - -}; - -#include OATPP_CODEGEN_END(DTO) - -} - -void DeserializerTest::onRun(){ - - auto mapper = oatpp::parser::json::mapping::ObjectMapper::createShared(); - - auto obj = mapper->readFromString>("{ \"strF\": \"value1\", \"int32F\": 30, \"float32F\": 32.4, \"object\": {}\"list\": [] }"); - - OATPP_ASSERT(obj); - OATPP_ASSERT(*(obj->strF) == "value1"); - OATPP_ASSERT(obj->int32F == 30); - OATPP_ASSERT(obj->float32F); - OATPP_ASSERT(obj->object); - OATPP_ASSERT(obj->list->size() == 0); - -} - -}}}}} 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_package/test_package.cpp b/recipes/oatpp/all/test_package/test_package.cpp index b0d824cdfda32..c3c071f43b8a4 100644 --- a/recipes/oatpp/all/test_package/test_package.cpp +++ b/recipes/oatpp/all/test_package/test_package.cpp @@ -1,31 +1,20 @@ -#include "DeserializerTest.hpp" +#include #include "oatpp/core/concurrency/SpinLock.hpp" #include "oatpp/core/base/Environment.hpp" -#include -#include - - -void runTests() { - OATPP_RUN_TEST(oatpp::test::parser::json::mapping::DeserializerTest); -} - int main() { oatpp::base::Environment::init(); - - runTests(); - + /* Print how much objects were created during app running, and what have left-probably leaked */ /* Disable object counting for release builds using '-D OATPP_DISABLE_ENV_OBJECT_COUNTERS' flag for better performance */ std::cout << "\nEnvironment:\n"; std::cout << "objectsCount = " << oatpp::base::Environment::getObjectsCount() << "\n"; std::cout << "objectsCreated = " << oatpp::base::Environment::getObjectsCreated() << "\n\n"; - + OATPP_ASSERT(oatpp::base::Environment::getObjectsCount() == 0); - - oatpp::base::Environment::destroy(); + oatpp::base::Environment::destroy(); return 0; } 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/oatpp/config.yml b/recipes/oatpp/config.yml index 4fdf83fae05c2..64022fc52f7b5 100644 --- a/recipes/oatpp/config.yml +++ b/recipes/oatpp/config.yml @@ -1,4 +1,6 @@ versions: + "1.3.0.latest": + folder: all "1.3.0": folder: all "1.2.5": diff --git a/recipes/objectbox-generator/all/conanfile.py b/recipes/objectbox-generator/all/conanfile.py index 5493b25252fde..b6b2defa46e0e 100644 --- a/recipes/objectbox-generator/all/conanfile.py +++ b/recipes/objectbox-generator/all/conanfile.py @@ -1,8 +1,12 @@ -from conans import CMake, ConanFile, 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.files import copy, download, get +from conan.tools.layout import basic_layout + +required_conan_version = ">=1.47.0" + class PackageConan(ConanFile): name = "objectbox-generator" @@ -10,39 +14,45 @@ class PackageConan(ConanFile): license = "GPL-3.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/objectbox/objectbox-generator" - topics = ("database", "code-generator", "objectbox") + topics = ("database", "code-generator", "objectbox", "pre-built") + + package_type = "application" settings = "os", "arch", "compiler", "build_type" - @property - def _source_subfolder(self): - return "source_subfolder" - - def validate(self): - if self.settings.os not in ["Linux", "Windows", "Macos"] or self.settings.arch != "x86_64": - raise ConanInvalidConfiguration("{} doesn't support current environment".format(self.name)) + def layout(self): + basic_layout(self, src_folder="src") def package_id(self): del self.info.settings.compiler del self.info.settings.build_type - def source(self): - tools.get(**self.conan_data["sources"][self.version][str(self.settings.os)], - destination=self.source_folder) - tools.download(**self.conan_data["sources"][self.version]["License"], filename="LICENSE.txt") + def validate(self): + if self.settings.os not in ["Linux", "FreeBSD", "Windows", "Macos"] or self.settings.arch != "x86_64": + raise ConanInvalidConfiguration(f"{self.name} doesn't support current environment") + + def build(self): + get(self, **self.conan_data["sources"][self.version][str(self.info.settings.os)]) + download(self, **self.conan_data["sources"][self.version]["License"], filename="LICENSE.txt") def package(self): if self.settings.os != "Windows": - bin_path = os.path.join(self.source_folder, "objectbox-generator") + bin_path = os.path.join(self.build_folder, "objectbox-generator") os.chmod(bin_path, os.stat(bin_path).st_mode | 0o111) - self.copy("objectbox-generator*", src=self.source_folder, dst="bin", keep_path=False) - self.copy("LICENSE.txt", dst="licenses", src=self.source_folder) + copy(self, "objectbox-generator*", + src=self.build_folder, + dst=os.path.join(self.package_folder, "bin"), + keep_path=False) + copy(self, "LICENSE.txt", + dst=os.path.join(self.package_folder, "licenses"), + src=self.build_folder) def package_info(self): - binpath = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH env var: {}".format(binpath)) - self.env_info.PATH.append(binpath) - self.cpp_info.includedirs = [] self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] self.cpp_info.resdirs = [] + + # TODO: Legacy, to be removed on Conan 2.0 + 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/objectbox-generator/all/test_package/conanfile.py b/recipes/objectbox-generator/all/test_package/conanfile.py index c605339e388af..42f9cfb1d7ca2 100644 --- a/recipes/objectbox-generator/all/test_package/conanfile.py +++ b/recipes/objectbox-generator/all/test_package/conanfile.py @@ -1,11 +1,15 @@ -from conans import ConanFile, CMake, tools -import os +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): - bin_path = os.path.join(self.deps_cpp_info["objectbox-generator"].rootpath, "bin", "objectbox-generator") - self.run(bin_path + " -help", run_environment=True) + if can_run(self): + self.run("objectbox-generator -help") diff --git a/recipes/objectbox-generator/all/test_v1_package/conanfile.py b/recipes/objectbox-generator/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..c605339e388af --- /dev/null +++ b/recipes/objectbox-generator/all/test_v1_package/conanfile.py @@ -0,0 +1,11 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join(self.deps_cpp_info["objectbox-generator"].rootpath, "bin", "objectbox-generator") + self.run(bin_path + " -help", run_environment=True) 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 deleted file mode 100644 index c17f9834922b3..0000000000000 --- a/recipes/objectbox/all/conandata.yml +++ /dev/null @@ -1,15 +0,0 @@ -sources: - "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.0": - - patch_file: "patches/0001-fix-cmake.patch" - base_path: "source_subfolder" - "0.17.0": - - patch_file: "patches/0001-fix-cmake.patch" - base_path: "source_subfolder" diff --git a/recipes/objectbox/all/conanfile.py b/recipes/objectbox/all/conanfile.py deleted file mode 100644 index e14e7b0b2f9b4..0000000000000 --- a/recipes/objectbox/all/conanfile.py +++ /dev/null @@ -1,62 +0,0 @@ -from conans import CMake, ConanFile, tools -import functools - -required_conan_version = ">=1.33.0" - -class ObjectboxCConan(ConanFile): - name = "objectbox" - description = "ObjectBox C and C++: super-fast database for objects and structs" - license = "Apache-2.0" - url = "https://github.com/conan-io/conan-center-index" - homepage = "https://github.com/objectbox/objectbox-c" - topics = ("performance", "database", "flatbuffers") - settings = "os", "arch", "compiler", "build_type" - options = { - "with_sync": [True, False], - } - 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"]) - - def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) - - 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["OBJECTBOX_WITH_SYNC"] = self.options.with_sync - 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(pattern="LICENSE*", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() - 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") - diff --git a/recipes/objectbox/all/patches/0001-fix-cmake.patch b/recipes/objectbox/all/patches/0001-fix-cmake.patch deleted file mode 100644 index d22926b57e6c9..0000000000000 --- a/recipes/objectbox/all/patches/0001-fix-cmake.patch +++ /dev/null @@ -1,66 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index e32c84b..c2c535f 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -9,10 +9,17 @@ if (${CMAKE_VERSION} VERSION_LESS "3.11.0") - endif () - link_directories("${CMAKE_CURRENT_SOURCE_DIR}/lib") - else () -+ include(GNUInstallDirs) -+ - function(defineObjectBoxLibForURL VARIANT DL_URL) - include(FetchContent) - project(objectbox${VARIANT}-download) -- FetchContent_Declare(${PROJECT_NAME} URL ${DL_URL}) -+ FetchContent_Declare(${PROJECT_NAME} -+ URL ${DL_URL} -+ # workaround for max path length in Windows (260byte) -+ SUBBUILD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/sub -+ SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/tmp -+ ) - - FetchContent_Populate(${PROJECT_NAME}) - set(DL_DIR "${${PROJECT_NAME}_SOURCE_DIR}") -@@ -27,6 +34,25 @@ else () - IMPORTED_IMPLIB ${DL_DIR}/lib/${CMAKE_IMPORT_LIBRARY_PREFIX}objectbox${CMAKE_IMPORT_LIBRARY_SUFFIX} - INTERFACE_INCLUDE_DIRECTORIES "${objectbox_include_dirs}" - ) -+ -+ if(EXISTS "${DL_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}objectbox${CMAKE_SHARED_LIBRARY_SUFFIX}") -+ install( -+ FILES ${DL_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}objectbox${CMAKE_SHARED_LIBRARY_SUFFIX} -+ DESTINATION $,${CMAKE_INSTALL_BINDIR},${CMAKE_INSTALL_LIBDIR}> -+ ) -+ endif() -+ if(EXISTS "${DL_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}objectbox${CMAKE_IMPORT_LIBRARY_SUFFIX}") -+ install( -+ FILES ${DL_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}objectbox${CMAKE_IMPORT_LIBRARY_SUFFIX} -+ DESTINATION ${CMAKE_INSTALL_LIBDIR} -+ ) -+ endif() -+ -+ install( -+ DIRECTORY ${DL_DIR}/include/ -+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} -+ ) -+ - endfunction() - - function(defineObjectBoxLib VARIANT) -@@ -72,10 +98,15 @@ else () - defineObjectBoxLibForURL("" "${DL_URL}") - else () - defineObjectBoxLib("") -- defineObjectBoxLib("-sync") -+ if(OBJECTBOX_WITH_SYNC) -+ defineObjectBoxLib("-sync") -+ endif() - endif () - endif () - -+if(0) - add_subdirectory(src-test) - add_subdirectory(src-test-gen) - add_subdirectory(examples) -+endif() -+ diff --git a/recipes/objectbox/all/test_package/CMakeLists.txt b/recipes/objectbox/all/test_package/CMakeLists.txt deleted file mode 100644 index 6b823b4c18ea1..0000000000000 --- a/recipes/objectbox/all/test_package/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -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) diff --git a/recipes/objectbox/all/test_package/test_package.c b/recipes/objectbox/all/test_package/test_package.c deleted file mode 100644 index f03f0d6b965c7..0000000000000 --- a/recipes/objectbox/all/test_package/test_package.c +++ /dev/null @@ -1,10 +0,0 @@ -#include - -#include "objectbox.h" - -int main() { - printf("ObjectBox version %s\n", obx_version_string()); - - return 0; -} - diff --git a/recipes/objectbox/config.yml b/recipes/objectbox/config.yml deleted file mode 100644 index 5bf98d20ca9eb..0000000000000 --- a/recipes/objectbox/config.yml +++ /dev/null @@ -1,5 +0,0 @@ -versions: - "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..c83ffd5703892 --- /dev/null +++ b/recipes/oboe/all/conandata.yml @@ -0,0 +1,16 @@ +sources: + "1.8.0": + url: "https://github.com/google/oboe/archive/refs/tags/1.8.0.tar.gz" + sha256: "1ab24ff129af6396b8a5741c12b44b922814337d1b40958ac7ada8e270eb4880" + "1.7.0": + url: "https://github.com/google/oboe/archive/refs/tags/1.7.0.tar.gz" + sha256: "b01896f9180f725a38806cfef73a29b36b2ea37f91389ed4e69d664ce83b79b6" +patches: + "1.8.0": + - patch_file: "patches/1.8.0-0001-fix-cmake.patch" + patch_description: "Fix CMakeLists" + patch_type: "conan" + "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..a662f73c76364 --- /dev/null +++ b/recipes/oboe/all/conanfile.py @@ -0,0 +1,72 @@ +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, 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" + package_type = "library" + 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 + + def export_sources(self): + export_conandata_patches(self) + + 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 != "Android": + raise ConanInvalidConfiguration("oboe supports Android 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], 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.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + 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..1059375d2b0c8 --- /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>") ++) ++ + + # 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/patches/1.8.0-0001-fix-cmake.patch b/recipes/oboe/all/patches/1.8.0-0001-fix-cmake.patch new file mode 100644 index 0000000000000..46b4a6a56b9f9 --- /dev/null +++ b/recipes/oboe/all/patches/1.8.0-0001-fix-cmake.patch @@ -0,0 +1,30 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -81,14 +81,14 @@ + # Enable -Ofast + target_compile_options(oboe + PRIVATE +- -std=c++17 + -Wall + -Wextra-semi + -Wshadow + -Wshadow-field + "$<$:-Ofast>" + "$<$:-O3>" +- "$<$:-Werror>") ++) ++ + + # Enable logging of D,V for debug builds + target_compile_definitions(oboe PUBLIC $<$:OBOE_ENABLE_LOGGING=1>) +@@ -97,8 +97,8 @@ + + # 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) 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..651b6092ebbf2 --- /dev/null +++ b/recipes/oboe/config.yml @@ -0,0 +1,5 @@ +versions: + "1.8.0": + folder: all + "1.7.0": + folder: all diff --git a/recipes/observer-ptr-lite/all/conanfile.py b/recipes/observer-ptr-lite/all/conanfile.py index 3d66f15a4c9af..6e4898b3c5824 100644 --- a/recipes/observer-ptr-lite/all/conanfile.py +++ b/recipes/observer-ptr-lite/all/conanfile.py @@ -14,18 +14,18 @@ class ObserverPtrLiteConan(ConanFile): std::experimental::observer_ptr for C++98 and later.") topics = ("cpp98", "cpp11", "cpp14", "cpp17") license = "BSL-1.0" + package_type = "header-library" 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 @@ -38,9 +38,7 @@ def package_info(self): self.cpp_info.set_property("cmake_file_name", "observer-ptr-lite") self.cpp_info.set_property("cmake_target_name", "nonstd::observer-ptr-lite") 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"] = "observer-ptr-lite" @@ -51,6 +49,4 @@ def package_info(self): self.cpp_info.components["observerptrlite"].names["cmake_find_package_multi"] = "observer-ptr-lite" self.cpp_info.components["observerptrlite"].set_property("cmake_target_name", "nonstd::observer-ptr-lite") self.cpp_info.components["observerptrlite"].bindirs = [] - self.cpp_info.components["observerptrlite"].frameworkdirs = [] self.cpp_info.components["observerptrlite"].libdirs = [] - self.cpp_info.components["observerptrlite"].resdirs = [] diff --git a/recipes/observer-ptr-lite/all/test_package/conanfile.py b/recipes/observer-ptr-lite/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/observer-ptr-lite/all/test_package/conanfile.py +++ b/recipes/observer-ptr-lite/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/observer-ptr-lite/all/test_v1_package/CMakeLists.txt b/recipes/observer-ptr-lite/all/test_v1_package/CMakeLists.txt index 20353a906da64..b21cc49efde95 100644 --- a/recipes/observer-ptr-lite/all/test_v1_package/CMakeLists.txt +++ b/recipes/observer-ptr-lite/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.15) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(observer-ptr-lite REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE nonstd::observer-ptr-lite) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/ocilib/all/conandata.yml b/recipes/ocilib/all/conandata.yml new file mode 100644 index 0000000000000..2f5cc065e7d14 --- /dev/null +++ b/recipes/ocilib/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "4.7.6": + url: "https://github.com/vrogier/ocilib/releases/download/v4.7.6/ocilib-4.7.6-gnu.tar.gz" + sha256: "35657c00b3cfbcff09a398a6566b95b23067b0d15c1155a17615da7780715a85" diff --git a/recipes/ocilib/all/conanfile.py b/recipes/ocilib/all/conanfile.py new file mode 100644 index 0000000000000..6af72058d349a --- /dev/null +++ b/recipes/ocilib/all/conanfile.py @@ -0,0 +1,81 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get, rm, rmdir, chdir +from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain +from conan.tools.scm import Version +import os + +required_conan_version = ">=1.54.0" + +class OCILIBConan(ConanFile): + name = "ocilib" + description = "An open source and cross platform Oracle Driver that delivers efficient access to Oracle databases." + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/vrogier/ocilib" + topics = ("database", "db", "sql", "oracle") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_oracle_charset": ["ansi", "wide"], + "with_oracle_import": ["runtime", "linkage"], + } + default_options = { + "shared": False, + "fPIC": True, + "with_oracle_charset": "ansi", + "with_oracle_import": "runtime", + } + + @property + def _min_cppstd(self): + return 11 + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + if self.settings.os != "Linux": + raise ConanInvalidConfiguration(f"{self.ref} recipe only supports Linux for now. Pull requests to add new configurtations are welcomed.") + # TODO: Check support for other platforms + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = AutotoolsToolchain(self) + tc.configure_args.extend([ + f"--with-oracle-charset={self.options.with_oracle_charset}", + f"--with-oracle-import={self.options.with_oracle_import}", + ]) + tc.generate() + + def build(self): + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.configure() + autotools.make() + + def package(self): + autotools = Autotools(self) + autotools.install() + + copy(self, "COPYING", self.source_folder, os.path.join(self.package_folder, "licenses")) + 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")) + copy(self, "*.lib", self.source_folder, os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, "*.a", self.source_folder, os.path.join(self.package_folder, "lib"), keep_path=False) + 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 = ["ocilib"] + self.cpp_info.set_property("pkg_config_name", "ocilib") + self.cpp_info.system_libs.append("dl") diff --git a/recipes/ocilib/all/test_package/CMakeLists.txt b/recipes/ocilib/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d33ea642b397 --- /dev/null +++ b/recipes/ocilib/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + + +find_package(ocilib REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE ocilib::ocilib) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/ocilib/all/test_package/conanfile.py b/recipes/ocilib/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0a808db45f245 --- /dev/null +++ b/recipes/ocilib/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/ocilib/all/test_package/test_package.cpp b/recipes/ocilib/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..e71599957563d --- /dev/null +++ b/recipes/ocilib/all/test_package/test_package.cpp @@ -0,0 +1,26 @@ +#include +#include + +#include "ocilib.hpp" + +using namespace ocilib; + +int main(void) +{ + try + { + std::cout << "OCILIB Version: "; + std::cout << OCILIB_MAJOR_VERSION << "."; + std::cout << OCILIB_MINOR_VERSION << "."; + std::cout << OCILIB_REVISION_VERSION << std::endl; + + Environment::Initialize(); + } + catch (...) + { + } + + Environment::Cleanup(); + + return EXIT_SUCCESS; +} diff --git a/recipes/ocilib/config.yml b/recipes/ocilib/config.yml new file mode 100644 index 0000000000000..947442bf2969b --- /dev/null +++ b/recipes/ocilib/config.yml @@ -0,0 +1,3 @@ +versions: + "4.7.6": + folder: all diff --git a/recipes/octo-encryption-cpp/all/conandata.yml b/recipes/octo-encryption-cpp/all/conandata.yml index 1e42247500f04..d2c6c293649c6 100644 --- a/recipes/octo-encryption-cpp/all/conandata.yml +++ b/recipes/octo-encryption-cpp/all/conandata.yml @@ -1,4 +1,4 @@ sources: "1.1.0": - sha256: f595eb6c44187e8f5f047fc7bd6747ba0d50ad99f526fe87c16fdba9c77b513d - url: https://github.com/ofiriluz/octo-encryption-cpp/archive/refs/tags/v1.1.0.tar.gz + url: "https://github.com/ofiriluz/octo-encryption-cpp/archive/refs/tags/v1.1.0.tar.gz" + sha256: "f595eb6c44187e8f5f047fc7bd6747ba0d50ad99f526fe87c16fdba9c77b513d" diff --git a/recipes/octo-encryption-cpp/all/conanfile.py b/recipes/octo-encryption-cpp/all/conanfile.py index 991faa27ffc84..263f2034b1a24 100644 --- a/recipes/octo-encryption-cpp/all/conanfile.py +++ b/recipes/octo-encryption-cpp/all/conanfile.py @@ -4,19 +4,24 @@ from conan.tools.build import check_min_cppstd from conan.errors import ConanInvalidConfiguration from conan.tools.scm import Version +from conan.tools.microsoft import is_msvc_static_runtime import os -required_conan_version = ">=1.50.0" - +required_conan_version = ">=1.53.0" class OctoEncryptionCPPConan(ConanFile): name = "octo-encryption-cpp" + description = "Octo encryption library" license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/ofiriluz/octo-encryption-cpp" - description = "Octo encryption library" topics = ("cryptography", "cpp") - settings = "os", "compiler", "build_type", "arch" + package_type = "static-library" + settings = "os", "arch", "compiler", "build_type" + + @property + def _min_cppstd(self): + return 17 @property def _compilers_minimum_version(self): @@ -25,45 +30,41 @@ def _compilers_minimum_version(self): "clang": "9", "apple-clang": "11", "Visual Studio": "16", - "msvc": "1923", + "msvc": "192", } - def generate(self): - tc = CMakeToolchain(self) - tc.variables["DISABLE_TESTS"] = True - tc.variables["DISABLE_EXAMPLES"] = True - tc.generate() - cd = CMakeDeps(self) - cd.generate() - def layout(self): cmake_layout(self, src_folder="src") - def validate(self): - if self.info.settings.compiler.cppstd: - check_min_cppstd(self, "17") + def requirements(self): + self.requires("openssl/[>=1.1 <4]", transitive_headers=True) + def validate(self): + 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.name} requires C++17, which your compiler does not support." + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." ) - else: - self.output.warn(f"{self.name} requires C++17. Your compiler is unknown. Assuming it supports C++17.") if self.settings.compiler == "clang" and self.settings.compiler.get_safe("libcxx") == "libc++": raise ConanInvalidConfiguration(f"{self.name} does not support clang with libc++. Use libstdc++ instead.") - if self.settings.compiler == "Visual Studio" and self.settings.compiler.runtime in ["MTd", "MT"]: - raise ConanInvalidConfiguration(f"{self.name} does not support MSVC MT/MTd configurations, only MD/MDd is supported") + if is_msvc_static_runtime(self): + raise ConanInvalidConfiguration(f"{self.ref} does not support MSVC MT/MTd configurations, only MD/MDd is supported") - def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + def build_requirements(self): + self.tool_requires("cmake/[>=3.16 <4]") - def requirements(self): - self.requires("openssl/1.1.1q") + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) - def build_requirements(self): - self.build_requires("cmake/3.24.0") + def generate(self): + tc = CMakeToolchain(self) + tc.variables["DISABLE_TESTS"] = True + tc.variables["DISABLE_EXAMPLES"] = True + tc.generate() + cd = CMakeDeps(self) + cd.generate() def build(self): cmake = CMake(self) @@ -76,11 +77,14 @@ def package(self): cmake.install() def package_info(self): + self.cpp_info.libs = ["octo-encryption-cpp"] + self.cpp_info.set_property("cmake_file_name", "octo-encryption-cpp") self.cpp_info.set_property("cmake_target_name", "octo::octo-encryption-cpp") self.cpp_info.set_property("pkg_config_name", "octo-encryption-cpp") - self.cpp_info.libs = ["octo-encryption-cpp"] + self.cpp_info.requires = ["openssl::openssl"] + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.names["cmake_find_package"] = "octo-encryption-cpp" self.cpp_info.names["cmake_find_package_multi"] = "octo-encryption-cpp" self.cpp_info.names["pkg_config"] = "octo-encryption-cpp" - self.cpp_info.requires = ["openssl::openssl"] diff --git a/recipes/octo-encryption-cpp/all/test_package/CMakeLists.txt b/recipes/octo-encryption-cpp/all/test_package/CMakeLists.txt index a07fac747020c..bd49d24ed139e 100644 --- a/recipes/octo-encryption-cpp/all/test_package/CMakeLists.txt +++ b/recipes/octo-encryption-cpp/all/test_package/CMakeLists.txt @@ -1,8 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) find_package(octo-encryption-cpp REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} octo::octo-encryption-cpp) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17) +target_link_libraries(${PROJECT_NAME} PRIVATE octo::octo-encryption-cpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/octo-encryption-cpp/all/test_package/conanfile.py b/recipes/octo-encryption-cpp/all/test_package/conanfile.py index 62e07ce5add59..ef5d7042163ec 100644 --- a/recipes/octo-encryption-cpp/all/test_package/conanfile.py +++ b/recipes/octo-encryption-cpp/all/test_package/conanfile.py @@ -1,19 +1,16 @@ -from conans import ConanFile -from conan.tools.cmake import CMake, CMakeToolchain +from conan import ConanFile from conan.tools.build import can_run -from conan.tools.cmake import cmake_layout +from conan.tools.cmake import cmake_layout, CMake import os -required_conan_version = ">=1.43.0" - class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "CMakeDeps", "VirtualRunEnv" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" - def generate(self): - tc = CMakeToolchain(self) - tc.generate() + def requirements(self): + self.requires(self.tested_reference_str) def layout(self): cmake_layout(self) @@ -25,4 +22,5 @@ def build(self): def test(self): if can_run(self): - self.run(os.path.join(self.cpp.build.bindirs[0], "test_package"), env="conanrun") + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/octo-keygen-cpp/all/conandata.yml b/recipes/octo-keygen-cpp/all/conandata.yml index 1915a524b0e38..2fde3196d3682 100644 --- a/recipes/octo-keygen-cpp/all/conandata.yml +++ b/recipes/octo-keygen-cpp/all/conandata.yml @@ -1,4 +1,4 @@ sources: "1.0.0": - sha256: c4c60b4defed781d164e8fcc002c98df6fef0166ac2a18c7919dbbda22accecf - url: https://github.com/ofiriluz/octo-keygen-cpp/archive/refs/tags/v1.0.0.tar.gz + url: "https://github.com/ofiriluz/octo-keygen-cpp/archive/refs/tags/v1.0.0.tar.gz" + sha256: "c4c60b4defed781d164e8fcc002c98df6fef0166ac2a18c7919dbbda22accecf" diff --git a/recipes/octo-keygen-cpp/all/conanfile.py b/recipes/octo-keygen-cpp/all/conanfile.py index 52e5634af7ecf..50c1d18d84986 100644 --- a/recipes/octo-keygen-cpp/all/conanfile.py +++ b/recipes/octo-keygen-cpp/all/conanfile.py @@ -2,8 +2,9 @@ from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout from conan.tools.files import get, copy from conan.tools.build import check_min_cppstd -from conan.errors import ConanInvalidConfiguration from conan.tools.scm import Version +from conan.tools.microsoft import is_msvc_static_runtime +from conan.errors import ConanInvalidConfiguration import os required_conan_version = ">=1.50.0" @@ -11,12 +12,17 @@ class OctoKeygenCPPConan(ConanFile): name = "octo-keygen-cpp" + description = "Key generation / certificate generation using openssl for CPP" license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/ofiriluz/octo-keygen-cpp" - description = "Octo keygen library" topics = ("pki", "keypair", "certificates", "cpp") - settings = "os", "compiler", "build_type", "arch" + package_type = "static-library" + settings = "os", "arch", "compiler", "build_type" + + @property + def _min_cppstd(self): + return 17 @property def _compilers_minimum_version(self): @@ -25,47 +31,43 @@ def _compilers_minimum_version(self): "clang": "9", "apple-clang": "11", "Visual Studio": "16", - "msvc": "1923", + "msvc": "192", } - def generate(self): - tc = CMakeToolchain(self) - tc.variables["DISABLE_TESTS"] = True - tc.generate() - cd = CMakeDeps(self) - cd.generate() - def layout(self): cmake_layout(self, src_folder="src") - def validate(self): - if self.info.settings.compiler.cppstd: - check_min_cppstd(self, "17") + def requirements(self): + self.requires("octo-logger-cpp/1.1.0", transitive_headers=True) + self.requires("octo-encryption-cpp/1.1.0", transitive_headers=True) + self.requires("fmt/10.2.1") + self.requires("openssl/[>=1.1 <4]") + def validate(self): + 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.name} requires C++17, which your compiler does not support." + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." ) - else: - self.output.warn(f"{self.name} requires C++17. Your compiler is unknown. Assuming it supports C++17.") if self.settings.compiler == "clang" and self.settings.compiler.get_safe("libcxx") == "libc++": - raise ConanInvalidConfiguration(f"{self.name} does not support clang with libc++. Use libstdc++ instead.") - if self.settings.compiler == "Visual Studio" and self.settings.compiler.runtime in ["MTd", "MT"]: - raise ConanInvalidConfiguration(f"{self.name} does not support MSVC MT/MTd configurations, only MD/MDd is supported") + raise ConanInvalidConfiguration(f"{self.ref} does not support clang with libc++. Use libstdc++ instead.") + if is_msvc_static_runtime(self): + raise ConanInvalidConfiguration(f"{self.ref} does not support MSVC MT/MTd configurations, only MD/MDd is supported") - def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + def build_requirements(self): + self.tool_requires("cmake/[>=3.16 <4]") - def requirements(self): - self.requires("octo-logger-cpp/1.1.0") - self.requires("octo-encryption-cpp/1.1.0") - self.requires("fmt/9.0.0") - self.requires("openssl/1.1.1q") + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) - def build_requirements(self): - self.tool_requires("cmake/3.24.0") + def generate(self): + tc = CMakeToolchain(self) + tc.variables["DISABLE_TESTS"] = True + tc.generate() + cd = CMakeDeps(self) + cd.generate() def build(self): cmake = CMake(self) @@ -78,16 +80,18 @@ def package(self): cmake.install() def package_info(self): + self.cpp_info.libs = ["octo-keygen-cpp"] self.cpp_info.set_property("cmake_file_name", "octo-keygen-cpp") self.cpp_info.set_property("cmake_target_name", "octo::octo-keygen-cpp") self.cpp_info.set_property("pkg_config_name", "octo-keygen-cpp") - self.cpp_info.libs = ["octo-keygen-cpp"] - self.cpp_info.names["cmake_find_package"] = "octo-keygen-cpp" - self.cpp_info.names["cmake_find_package_multi"] = "octo-keygen-cpp" - self.cpp_info.names["pkg_config"] = "octo-keygen-cpp" self.cpp_info.requires = [ "fmt::fmt", "openssl::openssl", "octo-logger-cpp::octo-logger-cpp", "octo-encryption-cpp::octo-encryption-cpp" ] + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.names["cmake_find_package"] = "octo-keygen-cpp" + self.cpp_info.names["cmake_find_package_multi"] = "octo-keygen-cpp" + self.cpp_info.names["pkg_config"] = "octo-keygen-cpp" diff --git a/recipes/octo-keygen-cpp/all/test_package/CMakeLists.txt b/recipes/octo-keygen-cpp/all/test_package/CMakeLists.txt index 7a68c9f36c4bf..ec355db2143f3 100644 --- a/recipes/octo-keygen-cpp/all/test_package/CMakeLists.txt +++ b/recipes/octo-keygen-cpp/all/test_package/CMakeLists.txt @@ -1,8 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) find_package(octo-keygen-cpp REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} octo::octo-keygen-cpp) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17) +target_link_libraries(${PROJECT_NAME} PRIVATE octo::octo-keygen-cpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/octo-keygen-cpp/all/test_package/conanfile.py b/recipes/octo-keygen-cpp/all/test_package/conanfile.py index 6f1d3245dd7e8..bb7197d60a7c5 100644 --- a/recipes/octo-keygen-cpp/all/test_package/conanfile.py +++ b/recipes/octo-keygen-cpp/all/test_package/conanfile.py @@ -7,11 +7,11 @@ class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "CMakeDeps", "VirtualRunEnv" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" - def generate(self): - tc = CMakeToolchain(self) - tc.generate() + def requirements(self): + self.requires(self.tested_reference_str) def layout(self): cmake_layout(self) diff --git a/recipes/octo-keygen-cpp/all/test_package/test_package.cpp b/recipes/octo-keygen-cpp/all/test_package/test_package.cpp index 98222f149cce9..418c7b3cdcaa5 100644 --- a/recipes/octo-keygen-cpp/all/test_package/test_package.cpp +++ b/recipes/octo-keygen-cpp/all/test_package/test_package.cpp @@ -13,7 +13,6 @@ #include "octo-keygen-cpp/openssl/ssl-keypair.hpp" #include "octo-keygen-cpp/openssl/ssl-keypair-certificate-chain.hpp" #include "octo-keygen-cpp/openssl/ssl-keypair-certificate.hpp" -#include #include #include @@ -87,16 +86,6 @@ constexpr auto TARGET_CERT = "-----BEGIN CERTIFICATE-----\n" int main(int argc, char** argv) { - octo::logger::Logger logger("PSKeygen"); - std::shared_ptr config = - std::make_shared(); - octo::logger::SinkConfig console_writer_sink("Console", octo::logger::SinkConfig::SinkType::CONSOLE_SINK); - config->add_sink(console_writer_sink); - octo::logger::Manager::instance() - .editable_channel("PSKeygen") - .set_log_level(octo::logger::Log::LogLevel::DEBUG); - octo::logger::Manager::instance().configure(config); - auto ca = octo::keygen::ssl::SSLKeypairCertificateChain::load_certificate_chain( std::make_unique(ROOTCA) ); @@ -106,18 +95,11 @@ int main(int argc, char** argv) auto chain = octo::keygen::ssl::SSLKeypairCertificateChain::load_certificate_chain( std::make_unique(SUBCA) ); - logger.info() << "IS CA = " << ca->is_any_ca(); - logger.info() << "IS VALID CERT = " << ca->is_valid_chain(target.get(), - chain.get()); octo::keygen::KeygenPtr ssl_key_gen = std::make_shared(); octo::keygen::KeygenOptions ssl_opts; octo::keygen::KeypairPtr ssl_key_pair = ssl_key_gen->generate_keypair(ssl_opts); - logger.info() << "\n" << ssl_key_pair->private_key(); - logger.info() << "\n" << ssl_key_pair->public_key(); octo::keygen::KeygenOptions ssl_sign_opts; octo::keygen::KeypairCertificatePtr ssl_cert = ssl_key_gen->sign_key_pair(ssl_key_pair, ssl_sign_opts); - logger.info() << "\n" << ssl_cert->certificate(); - logger.info() << "\n" << ssl_cert->pretty_print_certificate_info(); } diff --git a/recipes/octo-logger-cpp/all/conandata.yml b/recipes/octo-logger-cpp/all/conandata.yml index eecbf7a0bd2d8..5b5d4e7697075 100644 --- a/recipes/octo-logger-cpp/all/conandata.yml +++ b/recipes/octo-logger-cpp/all/conandata.yml @@ -1,7 +1,34 @@ sources: - "1.1.0": - sha256: 69057ab2f0ba0754dc6dce1f27c6f1fd9ad1e97c828779a801273bb3e9123e4e - url: https://github.com/ofiriluz/octo-logger-cpp/archive/refs/tags/v1.1.0.tar.gz + "2.1.2": + url: "https://github.com/ofiriluz/octo-logger-cpp/archive/v2.1.2.tar.gz" + sha256: "d653dc91d17f33f2e7659126ba408b40f8f421def8190ec2b6991713c6a2accf" + "2.0.2": + url: "https://github.com/ofiriluz/octo-logger-cpp/archive/v2.0.2.tar.gz" + sha256: "6aa8ee80a7f7b84df55fa215f22cdf66cbeece8cc60b2097828795194a1e6a40" + "2.0.0": + url: "https://github.com/ofiriluz/octo-logger-cpp/archive/v2.0.0.tar.gz" + sha256: "2edad6d1cba27019f1f26e562d9d8ff8395fc9ada1e8fb0c226c603ec5e0ed15" + "1.12.0": + url: "https://github.com/ofiriluz/octo-logger-cpp/archive/v1.12.0.tar.gz" + sha256: "77f351ae4cad973ad7836dae7498419692590f2419b5b569c1f00fc6130d8bbb" + "1.11.0": + url: "https://github.com/ofiriluz/octo-logger-cpp/archive/v1.11.0.tar.gz" + sha256: "73c35ca2a2e0c4be2cd85c5ba1f4061bbc22637fe79570107f1123eff30936db" + "1.9.0": + url: "https://github.com/ofiriluz/octo-logger-cpp/archive/v1.9.0.tar.gz" + sha256: "95187b6e9ae5d405b53ecb12ff7cbde847a9824a340ca88922eecd712ce9a138" + "1.6.1": + url: "https://github.com/ofiriluz/octo-logger-cpp/archive/v1.6.1.tar.gz" + sha256: "02c1d5303d8c129cb2527a92d49677229230a5feaec002791f96d47de3bccb5a" + "1.5.0": + url: "https://github.com/ofiriluz/octo-logger-cpp/archive/v1.5.0.tar.gz" + sha256: "e62e4a54700f7c235111fd2b75c51d96f0b4deaf2c24ce7bc9ef1751ce31ea20" + "1.4.0": + url: "https://github.com/ofiriluz/octo-logger-cpp/archive/v1.4.0.tar.gz" + sha256: "6aacbab0e57917a935e0f9741e52a57ecac21785ba49aaafec5775030208a153" "1.2.0": - sha256: 54381d6dbc80c6be6d8b9e087a4b55fae6ff5d07c3c2399bc7e1c94252260bf2 - url: https://github.com/ofiriluz/octo-logger-cpp/archive/refs/tags/v1.2.0.tar.gz + url: "https://github.com/ofiriluz/octo-logger-cpp/archive/refs/tags/v1.2.0.tar.gz" + sha256: "54381d6dbc80c6be6d8b9e087a4b55fae6ff5d07c3c2399bc7e1c94252260bf2" + "1.1.0": + url: "https://github.com/ofiriluz/octo-logger-cpp/archive/refs/tags/v1.1.0.tar.gz" + sha256: "69057ab2f0ba0754dc6dce1f27c6f1fd9ad1e97c828779a801273bb3e9123e4e" diff --git a/recipes/octo-logger-cpp/all/conanfile.py b/recipes/octo-logger-cpp/all/conanfile.py index cdb8df5c161d2..27de74bad7ee2 100644 --- a/recipes/octo-logger-cpp/all/conanfile.py +++ b/recipes/octo-logger-cpp/all/conanfile.py @@ -1,8 +1,9 @@ from conan import ConanFile -from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout -from conan.tools.files import get, copy -from conan.tools.build import check_min_cppstd 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_static_runtime from conan.tools.scm import Version import os @@ -11,19 +12,24 @@ class OctoLoggerCPPConan(ConanFile): name = "octo-logger-cpp" + description = "CPP Stream based logging library" license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/ofiriluz/octo-logger-cpp" - description = "Octo logger library" - topics = ("logging", "cpp") - settings = "os", "compiler", "build_type", "arch" + topics = ("logging", "stream", "syslog", "cloudwatch") + package_type = "static-library" + settings = "os", "arch", "compiler", "build_type" options = { - "with_aws": [True, False] + "with_aws": [True, False], } default_options = { - "with_aws": False + "with_aws": False, } + @property + def _min_cppstd(self): + return 17 + @property def _compilers_minimum_version(self): return { @@ -31,7 +37,7 @@ def _compilers_minimum_version(self): "clang": "9", "apple-clang": "11", "Visual Studio": "16", - "msvc": "1923", + "msvc": "192", } @property @@ -42,51 +48,49 @@ def configure(self): if not self._aws_supported: del self.options.with_aws - def generate(self): - tc = CMakeToolchain(self) - tc.variables["DISABLE_TESTS"] = True - tc.variables["DISABLE_EXAMPLES"] = True - if self.options.get_safe("with_aws"): - tc.variables["WITH_AWS"] = True - tc.generate() - cd = CMakeDeps(self) - cd.generate() - def layout(self): cmake_layout(self, src_folder="src") - def validate(self): - if self.info.settings.compiler.cppstd: - check_min_cppstd(self, "17") + def requirements(self): + self.requires("fmt/10.2.1", transitive_headers=True) + if self.options.get_safe("with_aws"): + self.requires("nlohmann_json/3.11.3") + if Version(self.version) >= "2.0.0": + self.requires("aws-sdk-cpp/1.11.352") + else: + self.requires("aws-sdk-cpp/1.9.234") - 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: + 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} requires C++17, which your compiler does not support." + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." ) - else: - self.output.warn(f"{self.name} requires C++17. Your compiler is unknown. Assuming it supports C++17.") if self.settings.compiler == "clang" and self.settings.compiler.get_safe("libcxx") == "libc++": - raise ConanInvalidConfiguration(f"{self.name} does not support clang with libc++. Use libstdc++ instead.") - if self.settings.compiler == "Visual Studio" and self.settings.compiler.runtime in ["MTd", "MT"]: - raise ConanInvalidConfiguration(f"{self.name} does not support MSVC MT/MTd configurations, only MD/MDd is supported") + raise ConanInvalidConfiguration(f"{self.ref} does not support clang with libc++. Use libstdc++ instead.") + if is_msvc_static_runtime(self): + raise ConanInvalidConfiguration(f"{self.ref} does not support MSVC static runtime. Use dynamic runtime instead.") if self.options.get_safe("with_aws"): if not self.dependencies["aws-sdk-cpp"].options.logs: - raise ConanInvalidConfiguration(f"{self.name} requires the option aws-sdk-cpp:logs=True") + raise ConanInvalidConfiguration(f"{self.ref} requires the option aws-sdk-cpp:logs=True") + def build_requirements(self): + self.tool_requires("cmake/[>=3.16 <4]") 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 requirements(self): - self.requires("fmt/9.0.0") + def generate(self): + tc = CMakeToolchain(self) + tc.variables["DISABLE_TESTS"] = True + tc.variables["DISABLE_EXAMPLES"] = True if self.options.get_safe("with_aws"): - self.requires("nlohmann_json/3.11.2") - self.requires("aws-sdk-cpp/1.9.234") - - def build_requirements(self): - self.build_requires("cmake/3.24.0") + tc.variables["WITH_AWS"] = True + tc.generate() + cd = CMakeDeps(self) + cd.generate() def build(self): cmake = CMake(self) @@ -101,11 +105,7 @@ def package(self): def package_info(self): self.cpp_info.set_property("cmake_file_name", "octo-logger-cpp") self.cpp_info.set_property("cmake_target_name", "octo::octo-logger-cpp") - self.cpp_info.set_property("pkg_config_name", "octo-logger-cpp") self.cpp_info.libs = ["octo-logger-cpp"] - self.cpp_info.names["cmake_find_package"] = "octo-logger-cpp" - self.cpp_info.names["cmake_find_package_multi"] = "octo-logger-cpp" - self.cpp_info.names["pkg_config"] = "octo-logger-cpp" self.cpp_info.requires = ["fmt::fmt"] if self.options.get_safe("with_aws"): self.cpp_info.requires.extend([ diff --git a/recipes/octo-logger-cpp/all/test_package/CMakeLists.txt b/recipes/octo-logger-cpp/all/test_package/CMakeLists.txt index 4cdb390261544..f7d178a90b8ee 100644 --- a/recipes/octo-logger-cpp/all/test_package/CMakeLists.txt +++ b/recipes/octo-logger-cpp/all/test_package/CMakeLists.txt @@ -1,8 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) find_package(octo-logger-cpp REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} octo::octo-logger-cpp) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17) +target_link_libraries(${PROJECT_NAME} PRIVATE octo::octo-logger-cpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/octo-logger-cpp/all/test_package/conanfile.py b/recipes/octo-logger-cpp/all/test_package/conanfile.py index 696c343fa84f4..ef5d7042163ec 100644 --- a/recipes/octo-logger-cpp/all/test_package/conanfile.py +++ b/recipes/octo-logger-cpp/all/test_package/conanfile.py @@ -1,17 +1,16 @@ -from conans import ConanFile -from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan import ConanFile from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -required_conan_version = ">=1.43.0" class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "CMakeDeps", "VirtualRunEnv" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" - def generate(self): - tc = CMakeToolchain(self) - tc.generate() + def requirements(self): + self.requires(self.tested_reference_str) def layout(self): cmake_layout(self) @@ -23,4 +22,5 @@ def build(self): def test(self): if can_run(self): - self.run(os.path.join(self.cpp.build.bindirs[0], "test_package"), env="conanrun") + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/octo-logger-cpp/config.yml b/recipes/octo-logger-cpp/config.yml index ee6c707d3f79c..70f417f829406 100644 --- a/recipes/octo-logger-cpp/config.yml +++ b/recipes/octo-logger-cpp/config.yml @@ -1,5 +1,23 @@ versions: - "1.1.0": + "2.1.2": + folder: "all" + "2.0.2": + folder: "all" + "2.0.0": + folder: "all" + "1.12.0": + folder: "all" + "1.11.0": + folder: "all" + "1.9.0": + folder: "all" + "1.6.1": + folder: "all" + "1.5.0": + folder: "all" + "1.4.0": folder: "all" "1.2.0": folder: "all" + "1.1.0": + folder: "all" diff --git a/recipes/octo-wildcardmatching-cpp/all/conanfile.py b/recipes/octo-wildcardmatching-cpp/all/conanfile.py index f22d6f51767b8..c8622ee725469 100644 --- a/recipes/octo-wildcardmatching-cpp/all/conanfile.py +++ b/recipes/octo-wildcardmatching-cpp/all/conanfile.py @@ -1,8 +1,9 @@ from conan import ConanFile -from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout -from conan.tools.files import get, copy -from conan.tools.build import check_min_cppstd 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 +from conan.tools.microsoft import is_msvc_static_runtime from conan.tools.scm import Version import os @@ -16,8 +17,13 @@ class OctoWildcardMatchingCPPConan(ConanFile): homepage = "https://github.com/ofiriluz/octo-wildcardmatching-cpp" description = "Octo wildcardmatching library" topics = ("wildcard", "regex", "patterns", "cpp") + package_type = "static-library" settings = "os", "compiler", "build_type", "arch" + @property + def _min_cppstd(self): + return "17" + @property def _compilers_minimum_version(self): return { @@ -25,42 +31,38 @@ def _compilers_minimum_version(self): "clang": "9", "apple-clang": "11", "Visual Studio": "16", - "msvc": "1923", + "msvc": "192", } - def generate(self): - tc = CMakeToolchain(self) - tc.variables["DISABLE_TESTS"] = True - tc.variables["DISABLE_EXAMPLES"] = True - tc.generate() - cd = CMakeDeps(self) - cd.generate() - 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.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: + 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} requires C++17, which your compiler does not support." + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." ) - else: - self.output.warn(f"{self.name} requires C++17. Your compiler is unknown. Assuming it supports C++17.") + if self.settings.compiler == "clang" and self.settings.compiler.get_safe("libcxx") == "libc++": - raise ConanInvalidConfiguration(f"{self.name} does not support clang with libc++. Use libstdc++ instead.") - if self.settings.compiler == "Visual Studio" and self.settings.compiler.runtime in ["MTd", "MT"]: - raise ConanInvalidConfiguration(f"{self.name} does not support MSVC MT/MTd configurations, only MD/MDd is supported") + raise ConanInvalidConfiguration(f"{self.ref} does not support clang with libc++. Use libstdc++ instead.") + if is_msvc_static_runtime(self): + raise ConanInvalidConfiguration(f"{self.ref} does not support MSVC static runtime. Use dynamic runtime instead.") + + def build_requirements(self): + self.tool_requires("cmake/[>=3.16 <4]") 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_requirements(self): - self.build_requires("cmake/3.24.0") + def generate(self): + tc = CMakeToolchain(self) + tc.variables["DISABLE_TESTS"] = True + tc.variables["DISABLE_EXAMPLES"] = True + tc.generate() def build(self): cmake = CMake(self) @@ -75,8 +77,4 @@ def package(self): def package_info(self): self.cpp_info.set_property("cmake_file_name", "octo-wildcardmatching-cpp") self.cpp_info.set_property("cmake_target_name", "octo::octo-wildcardmatching-cpp") - self.cpp_info.set_property("pkg_config_name", "octo-wildcardmatching-cpp") self.cpp_info.libs = ["octo-wildcardmatching-cpp"] - self.cpp_info.names["cmake_find_package"] = "octo-wildcardmatching-cpp" - self.cpp_info.names["cmake_find_package_multi"] = "octo-wildcardmatching-cpp" - self.cpp_info.names["pkg_config"] = "octo-wildcardmatching-cpp" diff --git a/recipes/octo-wildcardmatching-cpp/all/test_package/CMakeLists.txt b/recipes/octo-wildcardmatching-cpp/all/test_package/CMakeLists.txt index d02959b9b71e5..10219d5afbaa2 100644 --- a/recipes/octo-wildcardmatching-cpp/all/test_package/CMakeLists.txt +++ b/recipes/octo-wildcardmatching-cpp/all/test_package/CMakeLists.txt @@ -1,8 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(octo-wildcardmatching-cpp REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} octo::octo-wildcardmatching-cpp) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17) +target_link_libraries(${PROJECT_NAME} PRIVATE octo::octo-wildcardmatching-cpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/octo-wildcardmatching-cpp/all/test_package/conanfile.py b/recipes/octo-wildcardmatching-cpp/all/test_package/conanfile.py index 62e07ce5add59..254feca104287 100644 --- a/recipes/octo-wildcardmatching-cpp/all/test_package/conanfile.py +++ b/recipes/octo-wildcardmatching-cpp/all/test_package/conanfile.py @@ -1,23 +1,20 @@ -from conans import ConanFile -from conan.tools.cmake import CMake, CMakeToolchain +from conan import ConanFile from conan.tools.build import can_run -from conan.tools.cmake import cmake_layout +from conan.tools.cmake import CMake, cmake_layout import os -required_conan_version = ">=1.43.0" - class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "CMakeDeps", "VirtualRunEnv" - - def generate(self): - tc = CMakeToolchain(self) - tc.generate() + 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() diff --git a/recipes/octomap/all/conandata.yml b/recipes/octomap/all/conandata.yml index 1b73c9b2e5c5d..24483c3d1fc42 100644 --- a/recipes/octomap/all/conandata.yml +++ b/recipes/octomap/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "1.10.0": + url: "https://github.com/OctoMap/octomap/archive/v1.10.0.tar.gz" + sha256: "8da2576ec6a0993e8900db7f91083be8682d8397a7be0752c85d1b7dd1b8e992" + "1.9.8": + url: "https://github.com/OctoMap/octomap/archive/v1.9.8.tar.gz" + sha256: "417af6da4e855e9a83b93458aa98b01a2c88f880088baad2b59d323ce162586e" "1.9.7": url: "https://github.com/OctoMap/octomap/archive/v1.9.7.tar.gz" sha256: "3e9ac020686ceb4e17e161bffc5a0dafd9cccab33adeb9adee59a61c418ea1c1" @@ -12,11 +18,47 @@ sources: url: "https://github.com/OctoMap/octomap/archive/v1.9.3.tar.gz" sha256: "8488de97ed2c8f4757bfbaf3225e82a9e36783dce1f573b3bde1cf968aa89696" patches: + "1.10.0": + - patch_file: "patches/1.10.0-0001-separate-static-shared-build.patch" + patch_description: "CMake: build either shared or static" + patch_type: "conan" + "1.9.8": + - patch_file: "patches/1.9.5-0001-targets-outputname-collision.patch" + patch_description: "CMake: build either shared or static, and avoid name collision" + patch_type: "conan" + - patch_file: "patches/1.9.8-0001-cpp17-compat.patch" + patch_description: "Robust C++17 compatibility" + patch_type: "portability" + patch_source: "https://github.com/OctoMap/octomap/pull/394" "1.9.7": - - patch_file: "patches/targets-outputname-collision-1.9.5.patch" + - patch_file: "patches/1.9.5-0001-targets-outputname-collision.patch" + patch_description: "CMake: build either shared or static, and avoid name collision" + patch_type: "conan" + - patch_file: "patches/1.9.6-0001-cpp17-compat.patch" + patch_description: "Robust C++17 compatibility" + patch_type: "portability" + patch_source: "https://github.com/OctoMap/octomap/pull/394" "1.9.6": - - patch_file: "patches/targets-outputname-collision-1.9.5.patch" + - patch_file: "patches/1.9.5-0001-targets-outputname-collision.patch" + patch_description: "CMake: build either shared or static, and avoid name collision" + patch_type: "conan" + - patch_file: "patches/1.9.6-0001-cpp17-compat.patch" + patch_description: "Robust C++17 compatibility" + patch_type: "portability" + patch_source: "https://github.com/OctoMap/octomap/pull/394" "1.9.5": - - patch_file: "patches/targets-outputname-collision-1.9.5.patch" + - patch_file: "patches/1.9.5-0001-targets-outputname-collision.patch" + patch_description: "CMake: build either shared or static, and avoid name collision" + patch_type: "conan" + - patch_file: "patches/1.9.3-0002-cpp17-compat.patch" + patch_description: "Robust C++17 compatibility" + patch_type: "portability" + patch_source: "https://github.com/OctoMap/octomap/pull/394" "1.9.3": - - patch_file: "patches/targets-outputname-collision-1.9.3.patch" + - patch_file: "patches/1.9.3-0001-targets-outputname-collision.patch" + patch_description: "CMake: build either shared or static, and avoid name collision" + patch_type: "conan" + - patch_file: "patches/1.9.3-0002-cpp17-compat.patch" + patch_description: "Robust C++17 compatibility" + patch_type: "portability" + patch_source: "https://github.com/OctoMap/octomap/pull/394" diff --git a/recipes/octomap/all/conanfile.py b/recipes/octomap/all/conanfile.py index 0da2ca11366f6..ced4e906103b0 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 +from conan.tools.build import check_min_cppstd 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], @@ -30,9 +31,12 @@ class OctomapConan(ConanFile): "openmp": False, } + @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": @@ -40,18 +44,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 validate(self): - 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("shared octomap doesn't support MT runtime") - def layout(self): - cmake_layout(self, src_folder="src") + if Version(self.version) >= "1.10.0" and self.settings.compiler.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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -59,6 +65,8 @@ def generate(self): tc.variables["BUILD_TESTING"] = False if is_msvc(self) and self.options.shared: tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + if Version(self.version) >= "1.10.0": + tc.variables["CMAKE_CXX_STANDARD"] = self.settings.compiler.get_safe("cppstd", "11").replace("gnu", "") tc.generate() def _patch_sources(self): @@ -95,25 +103,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/patches/1.10.0-0001-separate-static-shared-build.patch b/recipes/octomap/all/patches/1.10.0-0001-separate-static-shared-build.patch new file mode 100644 index 0000000000000..bf38e33037d86 --- /dev/null +++ b/recipes/octomap/all/patches/1.10.0-0001-separate-static-shared-build.patch @@ -0,0 +1,120 @@ +diff --git a/octomap/src/CMakeLists.txt b/octomap/src/CMakeLists.txt +index 45b384f..e870608 100644 +--- a/octomap/src/CMakeLists.txt ++++ b/octomap/src/CMakeLists.txt +@@ -11,24 +11,32 @@ SET (octomap_SRCS + ) + + # dynamic and static libs, see CMake FAQ: ++if(BUILD_SHARED_LIBS) + ADD_LIBRARY( octomap SHARED ${octomap_SRCS}) + set_target_properties( octomap PROPERTIES + VERSION ${OCTOMAP_VERSION} + SOVERSION ${OCTOMAP_SOVERSION} + ) ++TARGET_LINK_LIBRARIES(octomap octomath) ++else() + ADD_LIBRARY( octomap-static STATIC ${octomap_SRCS}) + SET_TARGET_PROPERTIES(octomap-static PROPERTIES OUTPUT_NAME "octomap") + add_dependencies(octomap-static octomath-static) +- +-TARGET_LINK_LIBRARIES(octomap octomath) ++TARGET_LINK_LIBRARIES(octomap-static octomath-static) ++endif() + + if(NOT EXISTS "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/octomap") + file(MAKE_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/octomap") + endif() + +-export(TARGETS octomap octomap-static ++if(BUILD_SHARED_LIBS) ++export(TARGETS octomap + APPEND FILE "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/octomap/octomap-targets.cmake") +- ++else() ++export(TARGETS octomap-static ++ APPEND FILE "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/octomap/octomap-targets.cmake") ++endif() ++if(0) + ADD_SUBDIRECTORY( testing ) + + ADD_EXECUTABLE(graph2tree graph2tree.cpp) +@@ -66,14 +74,22 @@ TARGET_LINK_LIBRARIES(intersection_example octomap) + + ADD_EXECUTABLE(octree2pointcloud octree2pointcloud.cpp) + TARGET_LINK_LIBRARIES(octree2pointcloud octomap) +- +-install(TARGETS octomap octomap-static ++endif() ++if(BUILD_SHARED_LIBS) ++install(TARGETS octomap + EXPORT octomap-targets + INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" + ${INSTALL_TARGETS_DEFAULT_ARGS} + ) ++else() ++install(TARGETS octomap-static ++ EXPORT octomap-targets ++ INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" ++ ${INSTALL_TARGETS_DEFAULT_ARGS} ++) ++endif() + install(EXPORT octomap-targets DESTINATION "${CMAKE_INSTALL_DATADIR}/octomap") +- ++if(0) + install(TARGETS + graph2tree + log2graph +@@ -85,4 +101,4 @@ install(TARGETS + compare_octrees + ${INSTALL_TARGETS_DEFAULT_ARGS} + ) +- ++endif() +diff --git a/octomap/src/math/CMakeLists.txt b/octomap/src/math/CMakeLists.txt +index 3b47ec4..596f7d8 100644 +--- a/octomap/src/math/CMakeLists.txt ++++ b/octomap/src/math/CMakeLists.txt +@@ -4,26 +4,37 @@ SET (octomath_SRCS + Pose6D.cpp + ) + +- ++if(BUILD_SHARED_LIBS) + ADD_LIBRARY( octomath SHARED ${octomath_SRCS}) + + SET_TARGET_PROPERTIES( octomath PROPERTIES + VERSION ${OCTOMAP_VERSION} + SOVERSION ${OCTOMAP_SOVERSION} + ) +- ++else() + ADD_LIBRARY( octomath-static STATIC ${octomath_SRCS}) + SET_TARGET_PROPERTIES(octomath-static PROPERTIES OUTPUT_NAME "octomath") +- ++endif() + if(NOT EXISTS "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/octomap") + file(MAKE_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/octomap") + endif() + +-export(TARGETS octomath octomath-static ++if(BUILD_SHARED_LIBS) ++export(TARGETS octomath + APPEND FILE "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/octomap/octomap-targets.cmake") + +-install(TARGETS octomath octomath-static ++install(TARGETS octomath + EXPORT octomap-targets + INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" + ${INSTALL_TARGETS_DEFAULT_ARGS} + ) ++else() ++export(TARGETS octomath-static ++ APPEND FILE "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/octomap/octomap-targets.cmake") ++ ++install(TARGETS octomath-static ++ EXPORT octomap-targets ++ INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" ++ ${INSTALL_TARGETS_DEFAULT_ARGS} ++) ++endif() diff --git a/recipes/octomap/all/patches/targets-outputname-collision-1.9.3.patch b/recipes/octomap/all/patches/1.9.3-0001-targets-outputname-collision.patch similarity index 100% rename from recipes/octomap/all/patches/targets-outputname-collision-1.9.3.patch rename to recipes/octomap/all/patches/1.9.3-0001-targets-outputname-collision.patch diff --git a/recipes/octomap/all/patches/1.9.3-0002-cpp17-compat.patch b/recipes/octomap/all/patches/1.9.3-0002-cpp17-compat.patch new file mode 100644 index 0000000000000..f260df02249e4 --- /dev/null +++ b/recipes/octomap/all/patches/1.9.3-0002-cpp17-compat.patch @@ -0,0 +1,247 @@ +--- a/octomap/include/octomap/AbstractOcTree.h ++++ b/octomap/include/octomap/AbstractOcTree.h +@@ -51,7 +51,7 @@ namespace octomap { + friend class StaticMapInit; + public: + AbstractOcTree(); +- virtual ~AbstractOcTree() {}; ++ virtual ~AbstractOcTree() {} + + /// virtual constructor: creates a new object of same type + virtual AbstractOcTree* create() const = 0; +--- a/octomap/include/octomap/AbstractOccupancyOcTree.h ++++ b/octomap/include/octomap/AbstractOccupancyOcTree.h +@@ -52,7 +52,7 @@ namespace octomap { + class AbstractOccupancyOcTree : public AbstractOcTree { + public: + AbstractOccupancyOcTree(); +- virtual ~AbstractOccupancyOcTree() {}; ++ virtual ~AbstractOccupancyOcTree() {} + + //-- IO + +--- a/octomap/include/octomap/ColorOcTree.h ++++ b/octomap/include/octomap/ColorOcTree.h +@@ -192,7 +192,7 @@ namespace octomap { + * StaticMemberInitializer, causing this tree failing to register. + * Needs to be called from the constructor of this octree. + */ +- void ensureLinking() {}; ++ void ensureLinking() {} + }; + /// static member to ensure static initialization (only once) + static StaticMemberInitializer colorOcTreeMemberInit; +--- a/octomap/include/octomap/CountingOcTree.h ++++ b/octomap/include/octomap/CountingOcTree.h +@@ -110,7 +110,7 @@ namespace octomap { + * StaticMemberInitializer, causing this tree failing to register. + * Needs to be called from the constructor of this octree. + */ +- void ensureLinking() {}; ++ void ensureLinking() {} + }; + /// static member to ensure static initialization (only once) + static StaticMemberInitializer countingOcTreeMemberInit; +--- a/octomap/include/octomap/OcTree.h ++++ b/octomap/include/octomap/OcTree.h +@@ -59,7 +59,7 @@ namespace octomap { + */ + OcTree(std::string _filename); + +- virtual ~OcTree(){}; ++ virtual ~OcTree(){} + + /// virtual constructor: creates a new object of same type + /// (Covariant return type requires an up-to-date compiler) +@@ -89,7 +89,7 @@ namespace octomap { + * StaticMemberInitializer, causing this tree failing to register. + * Needs to be called from the constructor of this octree. + */ +- void ensureLinking() {}; ++ void ensureLinking() {} + }; + + /// to ensure static initialization (only once) +--- a/octomap/include/octomap/OcTreeBase.h ++++ b/octomap/include/octomap/OcTreeBase.h +@@ -43,7 +43,7 @@ namespace octomap { + template + class OcTreeBase : public OcTreeBaseImpl { + public: +- OcTreeBase(double res) : OcTreeBaseImpl(res) {}; ++ OcTreeBase(double res) : OcTreeBaseImpl(res) {} + + /// virtual constructor: creates a new object of same type + /// (Covariant return type requires an up-to-date compiler) +@@ -51,7 +51,7 @@ namespace octomap { + std::string getTreeType() const {return "OcTreeBase";} + }; + +- }; ++} + + + #endif +--- a/octomap/include/octomap/OcTreeBaseImpl.h ++++ b/octomap/include/octomap/OcTreeBaseImpl.h +@@ -244,7 +244,7 @@ namespace octomap { + virtual size_t memoryUsage() const; + + /// \return Memory usage of a single octree node +- virtual inline size_t memoryUsageNode() const {return sizeof(NODE); }; ++ virtual inline size_t memoryUsageNode() const {return sizeof(NODE); } + + /// \return Memory usage of a full grid of the same size as the OcTree in bytes (for comparison) + /// \note this can be larger than the adressable memory - size_t may not be enough to hold it! +@@ -324,12 +324,12 @@ namespace octomap { + typedef leaf_iterator iterator; + + /// @return beginning of the tree as leaf iterator +- iterator begin(unsigned char maxDepth=0) const {return iterator(this, maxDepth);}; ++ iterator begin(unsigned char maxDepth=0) const {return iterator(this, maxDepth);} + /// @return end of the tree as leaf iterator +- const iterator end() const {return leaf_iterator_end;}; // TODO: RVE? ++ const iterator end() const {return leaf_iterator_end;} // TODO: RVE? + + /// @return beginning of the tree as leaf iterator +- leaf_iterator begin_leafs(unsigned char maxDepth=0) const {return leaf_iterator(this, maxDepth);}; ++ leaf_iterator begin_leafs(unsigned char maxDepth=0) const {return leaf_iterator(this, maxDepth);} + /// @return end of the tree as leaf iterator + const leaf_iterator end_leafs() const {return leaf_iterator_end;} + +--- a/octomap/include/octomap/OcTreeDataNode.h ++++ b/octomap/include/octomap/OcTreeDataNode.h +@@ -100,9 +100,9 @@ namespace octomap { + OCTOMAP_DEPRECATED(bool hasChildren() const); + + /// @return value stored in the node +- T getValue() const{return value;}; ++ T getValue() const{return value;} + /// sets value to be stored in the node +- void setValue(T v) {value = v;}; ++ void setValue(T v) {value = v;} + + // file IO: + +--- a/octomap/include/octomap/OcTreeIterator.hxx ++++ b/octomap/include/octomap/OcTreeIterator.hxx +@@ -95,7 +95,7 @@ + maxDepth = other.maxDepth; + stack = other.stack; + return *this; +- }; ++ } + + /// Ptr operator will return the current node in the octree which the + /// iterator is referring to +@@ -213,7 +213,7 @@ + * @param tree OcTreeBaseImpl on which the iterator is used on + * @param depth Maximum depth to traverse the tree. 0 (default): unlimited + */ +- tree_iterator(OcTreeBaseImpl const* ptree, uint8_t depth=0) : iterator_base(ptree, depth) {}; ++ tree_iterator(OcTreeBaseImpl const* ptree, uint8_t depth=0) : iterator_base(ptree, depth) {} + + /// postfix increment operator of iterator (it++) + tree_iterator operator++(int){ +@@ -280,7 +280,7 @@ + } + } + +- leaf_iterator(const leaf_iterator& other) : iterator_base(other) {}; ++ leaf_iterator(const leaf_iterator& other) : iterator_base(other) {} + + /// postfix increment operator of iterator (it++) + leaf_iterator operator++(int){ +@@ -334,7 +334,7 @@ + */ + class leaf_bbx_iterator : public iterator_base { + public: +- leaf_bbx_iterator() : iterator_base() {}; ++ leaf_bbx_iterator() : iterator_base() {} + /** + * Constructor of the iterator. The bounding box corners min and max are + * converted into an OcTreeKey first. +@@ -425,7 +425,7 @@ + + + return *this; +- }; ++ } + + protected: + +--- a/octomap/include/octomap/OcTreeStamped.h ++++ b/octomap/include/octomap/OcTreeStamped.h +@@ -116,7 +116,7 @@ namespace octomap { + * StaticMemberInitializer, causing this tree failing to register. + * Needs to be called from the constructor of this octree. + */ +- void ensureLinking() {}; ++ void ensureLinking() {} + }; + /// to ensure static initialization (only once) + static StaticMemberInitializer ocTreeStampedMemberInit; +--- a/octomap/include/octomap/ScanGraph.h ++++ b/octomap/include/octomap/ScanGraph.h +@@ -115,7 +115,7 @@ namespace octomap { + + public: + +- ScanGraph() {}; ++ ScanGraph() {} + ~ScanGraph(); + + /// Clears all nodes and edges, and will delete the corresponding objects +--- a/octomap/src/ColorOcTree.cpp ++++ b/octomap/src/ColorOcTree.cpp +@@ -91,7 +91,7 @@ namespace octomap { + ColorOcTree::ColorOcTree(double in_resolution) + : OccupancyOcTreeBase(in_resolution) { + colorOcTreeMemberInit.ensureLinking(); +- }; ++ } + + ColorOcTreeNode* ColorOcTree::setNodeColor(const OcTreeKey& key, + uint8_t r, +--- a/octomap/src/OcTree.cpp ++++ b/octomap/src/OcTree.cpp +@@ -39,7 +39,7 @@ namespace octomap { + OcTree::OcTree(double in_resolution) + : OccupancyOcTreeBase(in_resolution) { + ocTreeMemberInit.ensureLinking(); +- }; ++ } + + OcTree::OcTree(std::string _filename) + : OccupancyOcTreeBase (0.1) { // resolution will be set according to tree file +--- a/octomap/src/Pointcloud.cpp ++++ b/octomap/src/Pointcloud.cpp +@@ -38,7 +38,7 @@ + + #if defined(_MSC_VER) || defined(_LIBCPP_VERSION) + #include +- #if __cplusplus > 199711L ++ #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201103L) || __cplusplus >= 201103L) + #include + #endif + #else +@@ -213,7 +213,7 @@ namespace octomap { + #if defined(_MSC_VER) || defined(_LIBCPP_VERSION) + samples.reserve(this->size()); + samples.insert(samples.end(), this->begin(), this->end()); +- #if __cplusplus > 199711L ++ #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201103L) || __cplusplus >= 201103L) + std::random_device r; + std::mt19937 urbg(r()); + std::shuffle(samples.begin(), samples.end(), urbg); +--- a/octomap/src/compare_octrees.cpp ++++ b/octomap/src/compare_octrees.cpp +@@ -132,7 +132,7 @@ int main(int argc, char** argv) { + else + kld +=log(p1/p2)*p1 + log((1-p1)/(1-p2))*(1-p1); + +-#if __cplusplus >= 201103L ++#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201103L) || __cplusplus >= 201103L) + if (std::isnan(kld)){ + #else + if (isnan(kld)){ diff --git a/recipes/octomap/all/patches/targets-outputname-collision-1.9.5.patch b/recipes/octomap/all/patches/1.9.5-0001-targets-outputname-collision.patch similarity index 100% rename from recipes/octomap/all/patches/targets-outputname-collision-1.9.5.patch rename to recipes/octomap/all/patches/1.9.5-0001-targets-outputname-collision.patch diff --git a/recipes/octomap/all/patches/1.9.6-0001-cpp17-compat.patch b/recipes/octomap/all/patches/1.9.6-0001-cpp17-compat.patch new file mode 100644 index 0000000000000..510dd8cad3218 --- /dev/null +++ b/recipes/octomap/all/patches/1.9.6-0001-cpp17-compat.patch @@ -0,0 +1,216 @@ +--- a/octomap/include/octomap/AbstractOcTree.h ++++ b/octomap/include/octomap/AbstractOcTree.h +@@ -51,7 +51,7 @@ namespace octomap { + friend class StaticMapInit; + public: + AbstractOcTree(); +- virtual ~AbstractOcTree() {}; ++ virtual ~AbstractOcTree() {} + + /// virtual constructor: creates a new object of same type + virtual AbstractOcTree* create() const = 0; +--- a/octomap/include/octomap/AbstractOccupancyOcTree.h ++++ b/octomap/include/octomap/AbstractOccupancyOcTree.h +@@ -52,7 +52,7 @@ namespace octomap { + class AbstractOccupancyOcTree : public AbstractOcTree { + public: + AbstractOccupancyOcTree(); +- virtual ~AbstractOccupancyOcTree() {}; ++ virtual ~AbstractOccupancyOcTree() {} + + //-- IO + +--- a/octomap/include/octomap/ColorOcTree.h ++++ b/octomap/include/octomap/ColorOcTree.h +@@ -192,7 +192,7 @@ namespace octomap { + * StaticMemberInitializer, causing this tree failing to register. + * Needs to be called from the constructor of this octree. + */ +- void ensureLinking() {}; ++ void ensureLinking() {} + }; + /// static member to ensure static initialization (only once) + static StaticMemberInitializer colorOcTreeMemberInit; +--- a/octomap/include/octomap/CountingOcTree.h ++++ b/octomap/include/octomap/CountingOcTree.h +@@ -110,7 +110,7 @@ namespace octomap { + * StaticMemberInitializer, causing this tree failing to register. + * Needs to be called from the constructor of this octree. + */ +- void ensureLinking() {}; ++ void ensureLinking() {} + }; + /// static member to ensure static initialization (only once) + static StaticMemberInitializer countingOcTreeMemberInit; +--- a/octomap/include/octomap/OcTree.h ++++ b/octomap/include/octomap/OcTree.h +@@ -59,7 +59,7 @@ namespace octomap { + */ + OcTree(std::string _filename); + +- virtual ~OcTree(){}; ++ virtual ~OcTree(){} + + /// virtual constructor: creates a new object of same type + /// (Covariant return type requires an up-to-date compiler) +@@ -89,7 +89,7 @@ namespace octomap { + * StaticMemberInitializer, causing this tree failing to register. + * Needs to be called from the constructor of this octree. + */ +- void ensureLinking() {}; ++ void ensureLinking() {} + }; + + /// to ensure static initialization (only once) +--- a/octomap/include/octomap/OcTreeBase.h ++++ b/octomap/include/octomap/OcTreeBase.h +@@ -43,7 +43,7 @@ namespace octomap { + template + class OcTreeBase : public OcTreeBaseImpl { + public: +- OcTreeBase(double res) : OcTreeBaseImpl(res) {}; ++ OcTreeBase(double res) : OcTreeBaseImpl(res) {} + + /// virtual constructor: creates a new object of same type + /// (Covariant return type requires an up-to-date compiler) +--- a/octomap/include/octomap/OcTreeBaseImpl.h ++++ b/octomap/include/octomap/OcTreeBaseImpl.h +@@ -244,7 +244,7 @@ namespace octomap { + virtual size_t memoryUsage() const; + + /// \return Memory usage of a single octree node +- virtual inline size_t memoryUsageNode() const {return sizeof(NODE); }; ++ virtual inline size_t memoryUsageNode() const {return sizeof(NODE); } + + /// \return Memory usage of a full grid of the same size as the OcTree in bytes (for comparison) + /// \note this can be larger than the adressable memory - size_t may not be enough to hold it! +@@ -324,12 +324,12 @@ namespace octomap { + typedef leaf_iterator iterator; + + /// @return beginning of the tree as leaf iterator +- iterator begin(unsigned char maxDepth=0) const {return iterator(this, maxDepth);}; ++ iterator begin(unsigned char maxDepth=0) const {return iterator(this, maxDepth);} + /// @return end of the tree as leaf iterator +- const iterator end() const {return leaf_iterator_end;}; // TODO: RVE? ++ const iterator end() const {return leaf_iterator_end;} // TODO: RVE? + + /// @return beginning of the tree as leaf iterator +- leaf_iterator begin_leafs(unsigned char maxDepth=0) const {return leaf_iterator(this, maxDepth);}; ++ leaf_iterator begin_leafs(unsigned char maxDepth=0) const {return leaf_iterator(this, maxDepth);} + /// @return end of the tree as leaf iterator + const leaf_iterator end_leafs() const {return leaf_iterator_end;} + +--- a/octomap/include/octomap/OcTreeDataNode.h ++++ b/octomap/include/octomap/OcTreeDataNode.h +@@ -100,9 +100,9 @@ namespace octomap { + OCTOMAP_DEPRECATED(bool hasChildren() const); + + /// @return value stored in the node +- T getValue() const{return value;}; ++ T getValue() const{return value;} + /// sets value to be stored in the node +- void setValue(T v) {value = v;}; ++ void setValue(T v) {value = v;} + + // file IO: + +--- a/octomap/include/octomap/OcTreeIterator.hxx ++++ b/octomap/include/octomap/OcTreeIterator.hxx +@@ -95,7 +95,7 @@ + maxDepth = other.maxDepth; + stack = other.stack; + return *this; +- }; ++ } + + /// Ptr operator will return the current node in the octree which the + /// iterator is referring to +@@ -213,7 +213,7 @@ + * @param tree OcTreeBaseImpl on which the iterator is used on + * @param depth Maximum depth to traverse the tree. 0 (default): unlimited + */ +- tree_iterator(OcTreeBaseImpl const* ptree, uint8_t depth=0) : iterator_base(ptree, depth) {}; ++ tree_iterator(OcTreeBaseImpl const* ptree, uint8_t depth=0) : iterator_base(ptree, depth) {} + + /// postfix increment operator of iterator (it++) + tree_iterator operator++(int){ +@@ -280,7 +280,7 @@ + } + } + +- leaf_iterator(const leaf_iterator& other) : iterator_base(other) {}; ++ leaf_iterator(const leaf_iterator& other) : iterator_base(other) {} + + /// postfix increment operator of iterator (it++) + leaf_iterator operator++(int){ +@@ -334,7 +334,7 @@ + */ + class leaf_bbx_iterator : public iterator_base { + public: +- leaf_bbx_iterator() : iterator_base() {}; ++ leaf_bbx_iterator() : iterator_base() {} + /** + * Constructor of the iterator. The bounding box corners min and max are + * converted into an OcTreeKey first. +@@ -425,7 +425,7 @@ + + + return *this; +- }; ++ } + + protected: + +--- a/octomap/include/octomap/OcTreeStamped.h ++++ b/octomap/include/octomap/OcTreeStamped.h +@@ -116,7 +116,7 @@ namespace octomap { + * StaticMemberInitializer, causing this tree failing to register. + * Needs to be called from the constructor of this octree. + */ +- void ensureLinking() {}; ++ void ensureLinking() {} + }; + /// to ensure static initialization (only once) + static StaticMemberInitializer ocTreeStampedMemberInit; +--- a/octomap/include/octomap/ScanGraph.h ++++ b/octomap/include/octomap/ScanGraph.h +@@ -115,7 +115,7 @@ namespace octomap { + + public: + +- ScanGraph() {}; ++ ScanGraph() {} + ~ScanGraph(); + + /// Clears all nodes and edges, and will delete the corresponding objects +--- a/octomap/src/Pointcloud.cpp ++++ b/octomap/src/Pointcloud.cpp +@@ -38,7 +38,7 @@ + + #if defined(_MSC_VER) || defined(_LIBCPP_VERSION) + #include +- #if __cplusplus > 199711L ++ #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201103L) || __cplusplus >= 201103L) + #include + #endif + #else +@@ -213,7 +213,7 @@ namespace octomap { + #if defined(_MSC_VER) || defined(_LIBCPP_VERSION) + samples.reserve(this->size()); + samples.insert(samples.end(), this->begin(), this->end()); +- #if __cplusplus > 199711L ++ #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201103L) || __cplusplus >= 201103L) + std::random_device r; + std::mt19937 urbg(r()); + std::shuffle(samples.begin(), samples.end(), urbg); +--- a/octomap/src/compare_octrees.cpp ++++ b/octomap/src/compare_octrees.cpp +@@ -132,7 +132,7 @@ int main(int argc, char** argv) { + else + kld +=log(p1/p2)*p1 + log((1-p1)/(1-p2))*(1-p1); + +-#if __cplusplus >= 201103L ++#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201103L) || __cplusplus >= 201103L) + if (std::isnan(kld)){ + #else + if (isnan(kld)){ diff --git a/recipes/octomap/all/patches/1.9.8-0001-cpp17-compat.patch b/recipes/octomap/all/patches/1.9.8-0001-cpp17-compat.patch new file mode 100644 index 0000000000000..5855cdf69fd95 --- /dev/null +++ b/recipes/octomap/all/patches/1.9.8-0001-cpp17-compat.patch @@ -0,0 +1,442 @@ +--- a/octomap/include/octomap/AbstractOcTree.h ++++ b/octomap/include/octomap/AbstractOcTree.h +@@ -51,7 +51,7 @@ + friend class StaticMapInit; + public: + AbstractOcTree(); +- virtual ~AbstractOcTree() {}; ++ virtual ~AbstractOcTree() {} + + /// virtual constructor: creates a new object of same type + virtual AbstractOcTree* create() const = 0; +--- a/octomap/include/octomap/AbstractOccupancyOcTree.h ++++ b/octomap/include/octomap/AbstractOccupancyOcTree.h +@@ -52,7 +52,7 @@ + class AbstractOccupancyOcTree : public AbstractOcTree { + public: + AbstractOccupancyOcTree(); +- virtual ~AbstractOccupancyOcTree() {}; ++ virtual ~AbstractOccupancyOcTree() {} + + //-- IO + +--- a/octomap/include/octomap/ColorOcTree.h ++++ b/octomap/include/octomap/ColorOcTree.h +@@ -192,7 +192,7 @@ + * StaticMemberInitializer, causing this tree failing to register. + * Needs to be called from the constructor of this octree. + */ +- void ensureLinking() {}; ++ void ensureLinking() {} + }; + /// static member to ensure static initialization (only once) + static StaticMemberInitializer colorOcTreeMemberInit; +--- a/octomap/include/octomap/CountingOcTree.h ++++ b/octomap/include/octomap/CountingOcTree.h +@@ -110,7 +110,7 @@ + * StaticMemberInitializer, causing this tree failing to register. + * Needs to be called from the constructor of this octree. + */ +- void ensureLinking() {}; ++ void ensureLinking() {} + }; + /// static member to ensure static initialization (only once) + static StaticMemberInitializer countingOcTreeMemberInit; +--- a/octomap/include/octomap/OcTree.h ++++ b/octomap/include/octomap/OcTree.h +@@ -59,7 +59,7 @@ + */ + OcTree(std::string _filename); + +- virtual ~OcTree(){}; ++ virtual ~OcTree(){} + + /// virtual constructor: creates a new object of same type + /// (Covariant return type requires an up-to-date compiler) +@@ -89,7 +89,7 @@ + * StaticMemberInitializer, causing this tree failing to register. + * Needs to be called from the constructor of this octree. + */ +- void ensureLinking() {}; ++ void ensureLinking() {} + }; + + /// to ensure static initialization (only once) +--- a/octomap/include/octomap/OcTreeBase.h ++++ b/octomap/include/octomap/OcTreeBase.h +@@ -43,7 +43,7 @@ + template + class OcTreeBase : public OcTreeBaseImpl { + public: +- OcTreeBase(double res) : OcTreeBaseImpl(res) {}; ++ OcTreeBase(double res) : OcTreeBaseImpl(res) {} + + /// virtual constructor: creates a new object of same type + /// (Covariant return type requires an up-to-date compiler) +--- a/octomap/include/octomap/OcTreeBaseImpl.h ++++ b/octomap/include/octomap/OcTreeBaseImpl.h +@@ -244,7 +244,7 @@ + virtual size_t memoryUsage() const; + + /// \return Memory usage of a single octree node +- virtual inline size_t memoryUsageNode() const {return sizeof(NODE); }; ++ virtual inline size_t memoryUsageNode() const {return sizeof(NODE); } + + /// \return Memory usage of a full grid of the same size as the OcTree in bytes (for comparison) + /// \note this can be larger than the adressable memory - size_t may not be enough to hold it! +@@ -324,12 +324,12 @@ + typedef leaf_iterator iterator; + + /// @return beginning of the tree as leaf iterator +- iterator begin(unsigned char maxDepth=0) const {return iterator(this, maxDepth);}; ++ iterator begin(unsigned char maxDepth=0) const {return iterator(this, maxDepth);} + /// @return end of the tree as leaf iterator +- const iterator end() const {return leaf_iterator_end;}; // TODO: RVE? ++ const iterator end() const {return leaf_iterator_end;} // TODO: RVE? + + /// @return beginning of the tree as leaf iterator +- leaf_iterator begin_leafs(unsigned char maxDepth=0) const {return leaf_iterator(this, maxDepth);}; ++ leaf_iterator begin_leafs(unsigned char maxDepth=0) const {return leaf_iterator(this, maxDepth);} + /// @return end of the tree as leaf iterator + const leaf_iterator end_leafs() const {return leaf_iterator_end;} + +--- a/octomap/include/octomap/OcTreeDataNode.h ++++ b/octomap/include/octomap/OcTreeDataNode.h +@@ -100,9 +100,9 @@ + OCTOMAP_DEPRECATED(bool hasChildren() const); + + /// @return value stored in the node +- T getValue() const{return value;}; ++ T getValue() const{return value;} + /// sets value to be stored in the node +- void setValue(T v) {value = v;}; ++ void setValue(T v) {value = v;} + + // file IO: + +--- a/octomap/include/octomap/OcTreeIterator.hxx ++++ b/octomap/include/octomap/OcTreeIterator.hxx +@@ -95,7 +95,7 @@ + maxDepth = other.maxDepth; + stack = other.stack; + return *this; +- }; ++ } + + /// Ptr operator will return the current node in the octree which the + /// iterator is referring to +@@ -213,7 +213,7 @@ + * @param ptree OcTreeBaseImpl on which the iterator is used on + * @param depth Maximum depth to traverse the tree. 0 (default): unlimited + */ +- tree_iterator(OcTreeBaseImpl const* ptree, uint8_t depth=0) : iterator_base(ptree, depth) {}; ++ tree_iterator(OcTreeBaseImpl const* ptree, uint8_t depth=0) : iterator_base(ptree, depth) {} + + /// postfix increment operator of iterator (it++) + tree_iterator operator++(int){ +@@ -280,7 +280,7 @@ + } + } + +- leaf_iterator(const leaf_iterator& other) : iterator_base(other) {}; ++ leaf_iterator(const leaf_iterator& other) : iterator_base(other) {} + + /// postfix increment operator of iterator (it++) + leaf_iterator operator++(int){ +@@ -334,7 +334,7 @@ + */ + class leaf_bbx_iterator : public iterator_base { + public: +- leaf_bbx_iterator() : iterator_base() {}; ++ leaf_bbx_iterator() : iterator_base() {} + /** + * Constructor of the iterator. The bounding box corners min and max are + * converted into an OcTreeKey first. +@@ -425,7 +425,7 @@ + + + return *this; +- }; ++ } + + protected: + +--- a/octomap/include/octomap/OcTreeStamped.h ++++ b/octomap/include/octomap/OcTreeStamped.h +@@ -116,7 +116,7 @@ + * StaticMemberInitializer, causing this tree failing to register. + * Needs to be called from the constructor of this octree. + */ +- void ensureLinking() {}; ++ void ensureLinking() {} + }; + /// to ensure static initialization (only once) + static StaticMemberInitializer ocTreeStampedMemberInit; +--- a/octomap/include/octomap/ScanGraph.h ++++ b/octomap/include/octomap/ScanGraph.h +@@ -115,7 +115,7 @@ + + public: + +- ScanGraph() {}; ++ ScanGraph() {} + ~ScanGraph(); + + /// Clears all nodes and edges, and will delete the corresponding objects +--- a/octomap/src/Pointcloud.cpp ++++ b/octomap/src/Pointcloud.cpp +@@ -38,7 +38,7 @@ + + #if defined(_MSC_VER) || defined(_LIBCPP_VERSION) + #include +- #if __cplusplus > 199711L ++ #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201103L) || __cplusplus >= 201103L) + #include + #endif + #else +@@ -213,7 +213,7 @@ + #if defined(_MSC_VER) || defined(_LIBCPP_VERSION) + samples.reserve(this->size()); + samples.insert(samples.end(), this->begin(), this->end()); +- #if __cplusplus > 199711L ++ #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201103L) || __cplusplus >= 201103L) + std::random_device r; + std::mt19937 urbg(r()); + std::shuffle(samples.begin(), samples.end(), urbg); +--- a/octomap/src/compare_octrees.cpp ++++ b/octomap/src/compare_octrees.cpp +@@ -132,7 +132,7 @@ + else + kld +=log(p1/p2)*p1 + log((1-p1)/(1-p2))*(1-p1); + +-#if __cplusplus >= 201103L ++#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201103L) || __cplusplus >= 201103L) + if (std::isnan(kld)){ + #else + if (isnan(kld)){ +--- a/octovis/include/octovis/OcTreeDrawer.h ++++ b/octovis/include/octovis/OcTreeDrawer.h +@@ -62,14 +62,14 @@ + void setAlternativeDrawing(bool flag){m_alternativeDrawing = flag;} + + void enableOcTree(bool enabled = true); +- void enableOcTreeCells(bool enabled = true) { m_update = true; m_drawOccupied = enabled; }; +- void enableFreespace(bool enabled = true) { m_update = true; m_drawFree = enabled; }; +- void enableSelection(bool enabled = true) { m_update = true; m_drawSelection = enabled; }; +- void setMax_tree_depth(unsigned int max_tree_depth) { m_update = true; m_max_tree_depth = max_tree_depth;}; ++ void enableOcTreeCells(bool enabled = true) { m_update = true; m_drawOccupied = enabled; } ++ void enableFreespace(bool enabled = true) { m_update = true; m_drawFree = enabled; } ++ void enableSelection(bool enabled = true) { m_update = true; m_drawSelection = enabled; } ++ void setMax_tree_depth(unsigned int max_tree_depth) { m_update = true; m_max_tree_depth = max_tree_depth;} + + // set new origin (move object) + void setOrigin(octomap::pose6d t); +- void enableAxes(bool enabled = true) { m_update = true; m_displayAxes = enabled; }; ++ void enableAxes(bool enabled = true) { m_update = true; m_displayAxes = enabled; } + + protected: + //void clearOcTree(); +--- a/octovis/include/octovis/SceneObject.h ++++ b/octovis/include/octovis/SceneObject.h +@@ -57,7 +57,7 @@ + + public: + SceneObject(); +- virtual ~SceneObject(){}; ++ virtual ~SceneObject(){} + + /** + * Actual draw function which will be called to visualize the object +@@ -67,7 +67,7 @@ + /** + * Clears the object's representation (will be called when it gets invalid) + */ +- virtual void clear(){}; ++ virtual void clear(){} + + public: + //! the color mode has to be set before calling OcTreDrawer::setMap() +@@ -95,8 +95,8 @@ + */ + class ScanGraphDrawer : public SceneObject { + public: +- ScanGraphDrawer(): SceneObject(){}; +- virtual ~ScanGraphDrawer(){}; ++ ScanGraphDrawer(): SceneObject(){} ++ virtual ~ScanGraphDrawer(){} + + /** + * Notifies drawer of a new or changed ScanGraph, so that the internal +--- a/octovis/include/octovis/ViewerSettings.h ++++ b/octovis/include/octovis/ViewerSettings.h +@@ -40,12 +40,12 @@ + public: + ViewerSettings(QWidget *parent = 0); + ~ViewerSettings(); +- double getResolution(){return ui.resolution->value(); }; +- void setResolution(double resolution){ui.resolution->setValue(resolution);}; +- unsigned int getLaserType(){return ui.laserType->currentIndex(); }; +- void setLaserType(int type){ui.laserType->setCurrentIndex(type); }; +- double getMaxRange(){return ui.maxRange->value(); }; +- void setMaxRange(double range){ui.maxRange->setValue(range); }; ++ double getResolution(){return ui.resolution->value(); } ++ void setResolution(double resolution){ui.resolution->setValue(resolution);} ++ unsigned int getLaserType(){return ui.laserType->currentIndex(); } ++ void setLaserType(int type){ui.laserType->setCurrentIndex(type); } ++ double getMaxRange(){return ui.maxRange->value(); } ++ void setMaxRange(double range){ui.maxRange->setValue(range); } + + private: + Ui::ViewerSettingsClass ui; +--- a/octovis/src/extern/QGLViewer/VRender/Exporter.h ++++ b/octovis/src/extern/QGLViewer/VRender/Exporter.h +@@ -60,7 +60,7 @@ + { + public: + Exporter() ; +- virtual ~Exporter() {}; ++ virtual ~Exporter() {} + + virtual void exportToFile(const QString& filename,const std::vector&,VRenderParams&) ; + +@@ -92,7 +92,7 @@ + { + public: + EPSExporter() ; +- virtual ~EPSExporter() {}; ++ virtual ~EPSExporter() {} + + protected: + virtual void spewPoint(const Point *, QTextStream& out) ; +@@ -120,7 +120,7 @@ + class PSExporter: public EPSExporter + { + public: +- virtual ~PSExporter() {}; ++ virtual ~PSExporter() {} + protected: + virtual void writeFooter(QTextStream& out) const ; + }; +@@ -129,7 +129,7 @@ + { + public: + FIGExporter() ; +- virtual ~FIGExporter() {}; ++ virtual ~FIGExporter() {} + + protected: + virtual void spewPoint(const Point *, QTextStream& out) ; +--- a/octovis/src/extern/QGLViewer/camera.cpp ++++ b/octovis/src/extern/QGLViewer/camera.cpp +@@ -199,8 +199,8 @@ + \code + class myCamera :: public qglviewer::Camera + { +- virtual qreal Camera::zNear() const { return 0.001; }; +- virtual qreal Camera::zFar() const { return 100.0; }; ++ virtual qreal Camera::zNear() const { return 0.001; } ++ virtual qreal Camera::zFar() const { return 100.0; } + } + \endcode + +--- a/octovis/src/extern/QGLViewer/constraint.h ++++ b/octovis/src/extern/QGLViewer/constraint.h +@@ -197,7 +197,7 @@ + case MyAxisPlaneConstraint::FREE: ... break; + case MyAxisPlaneConstraint::CUSTOM: ... break; + } +- }; ++ } + + MyAxisPlaneConstraint* c = new MyAxisPlaneConstraint(); + // Note the Type conversion +@@ -209,11 +209,11 @@ + /*! @name Translation constraint */ + //@{ + /*! Overloading of Constraint::constrainTranslation(). Empty */ +- virtual void constrainTranslation(Vec& translation, Frame* const frame) { Q_UNUSED(translation); Q_UNUSED(frame); }; ++ virtual void constrainTranslation(Vec& translation, Frame* const frame) { Q_UNUSED(translation); Q_UNUSED(frame); } + + void setTranslationConstraint(Type type, const Vec& direction); + /*! Sets the Type() of the translationConstraintType(). Default is AxisPlaneConstraint::FREE. */ +- void setTranslationConstraintType(Type type) { translationConstraintType_ = type; }; ++ void setTranslationConstraintType(Type type) { translationConstraintType_ = type; } + void setTranslationConstraintDirection(const Vec& direction); + + /*! Returns the translation constraint Type(). +@@ -225,7 +225,7 @@ + + Use Frame::setPosition() to define the position of the constrained Frame before it gets + constrained. */ +- Type translationConstraintType() const { return translationConstraintType_; }; ++ Type translationConstraintType() const { return translationConstraintType_; } + /*! Returns the direction used by the translation constraint. + + It represents the axis direction (AxisPlaneConstraint::AXIS) or the plane normal +@@ -235,20 +235,20 @@ + The AxisPlaneConstraint derived classes express this direction in different coordinate system + (camera for CameraConstraint, local for LocalConstraint, and world for WorldConstraint). This + value can be modified with setTranslationConstraintDirection(). */ +- Vec translationConstraintDirection() const { return translationConstraintDir_; }; ++ Vec translationConstraintDirection() const { return translationConstraintDir_; } + //@} + + /*! @name Rotation constraint */ + //@{ + /*! Overloading of Constraint::constrainRotation(). Empty. */ +- virtual void constrainRotation(Quaternion& rotation, Frame* const frame) { Q_UNUSED(rotation); Q_UNUSED(frame); }; ++ virtual void constrainRotation(Quaternion& rotation, Frame* const frame) { Q_UNUSED(rotation); Q_UNUSED(frame); } + + void setRotationConstraint(Type type, const Vec& direction); + void setRotationConstraintType(Type type); + void setRotationConstraintDirection(const Vec& direction); + + /*! Returns the rotation constraint Type(). */ +- Type rotationConstraintType() const { return rotationConstraintType_; }; ++ Type rotationConstraintType() const { return rotationConstraintType_; } + /*! Returns the axis direction used by the rotation constraint. + + This direction is defined only when rotationConstraintType() is AxisPlaneConstraint::AXIS. +@@ -256,7 +256,7 @@ + The AxisPlaneConstraint derived classes express this direction in different coordinate system + (camera for CameraConstraint, local for LocalConstraint, and world for WorldConstraint). This + value can be modified with setRotationConstraintDirection(). */ +- Vec rotationConstraintDirection() const { return rotationConstraintDir_; }; ++ Vec rotationConstraintDirection() const { return rotationConstraintDir_; } + //@} + + private: +@@ -280,7 +280,7 @@ + { + public: + /*! Virtual destructor. Empty. */ +- virtual ~LocalConstraint() {}; ++ virtual ~LocalConstraint() {} + + virtual void constrainTranslation(Vec& translation, Frame* const frame); + virtual void constrainRotation (Quaternion& rotation, Frame* const frame); +@@ -300,7 +300,7 @@ + { + public: + /*! Virtual destructor. Empty. */ +- virtual ~WorldConstraint() {}; ++ virtual ~WorldConstraint() {} + + virtual void constrainTranslation(Vec& translation, Frame* const frame); + virtual void constrainRotation (Quaternion& rotation, Frame* const frame); +@@ -321,13 +321,13 @@ + public: + explicit CameraConstraint(const Camera* const camera); + /*! Virtual destructor. Empty. */ +- virtual ~CameraConstraint() {}; ++ virtual ~CameraConstraint() {} + + virtual void constrainTranslation(Vec& translation, Frame* const frame); + virtual void constrainRotation (Quaternion& rotation, Frame* const frame); + + /*! Returns the associated Camera. Set using the CameraConstraint constructor. */ +- const Camera* camera() const { return camera_; }; ++ const Camera* camera() const { return camera_; } + + private: + const Camera* const camera_; diff --git a/recipes/octomap/all/test_package/CMakeLists.txt b/recipes/octomap/all/test_package/CMakeLists.txt index bb595de7484c4..4ec2de09236c3 100644 --- a/recipes/octomap/all/test_package/CMakeLists.txt +++ b/recipes/octomap/all/test_package/CMakeLists.txt @@ -9,3 +9,7 @@ if(TARGET octomap-static) else() target_link_libraries(${PROJECT_NAME} PRIVATE octomap octomath) endif() + +if(octomap_VERSION VERSION_GREATER_EQUAL "1.10.0") + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +endif() 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/octomap/config.yml b/recipes/octomap/config.yml index bbf53f61e28d4..83dd314d86186 100644 --- a/recipes/octomap/config.yml +++ b/recipes/octomap/config.yml @@ -1,4 +1,8 @@ versions: + "1.10.0": + folder: all + "1.9.8": + folder: all "1.9.7": folder: all "1.9.6": diff --git a/recipes/odbc/all/conanfile.py b/recipes/odbc/all/conanfile.py index 929c7ac4a289f..f192cd232425a 100644 --- a/recipes/odbc/all/conanfile.py +++ b/recipes/odbc/all/conanfile.py @@ -1,5 +1,6 @@ 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 @@ -10,6 +11,7 @@ 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" @@ -46,23 +48,23 @@ def requirements(self): self.requires("libiconv/1.17") def validate(self): - if self.info.settings.os == "Windows": + if self.settings.os == "Windows": raise ConanInvalidConfiguration("odbc is a system lib on Windows") def build_requirements(self): self.tool_requires("gnu-config/cci.20210814") 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 = AutotoolsToolchain(self) yes_no = lambda v: "yes" if v else "no" + libtool_cppinfo = self.dependencies["libtool"].cpp_info.aggregated_components() tc.configure_args.extend([ "--without-included-ltdl", - f"--with-ltdl-include={self.dependencies['libtool'].cpp_info.includedirs[0]}", - f"--with-ltdl-lib={self.dependencies['libtool'].cpp_info.libdirs[0]}", + 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", @@ -88,7 +90,7 @@ def _patch_sources(self): "if test -f \"$with_ltdl_lib/libltdl.la\";", "if true;", ) - libtool_system_libs = self.dependencies["libtool"].cpp_info.system_libs + libtool_system_libs = self.dependencies["libtool"].cpp_info.aggregated_components().system_libs if libtool_system_libs: replace_in_file( self, @@ -96,12 +98,6 @@ def _patch_sources(self): "-L$with_ltdl_lib -lltdl", "-L$with_ltdl_lib -lltdl -l{}".format(" -l".join(libtool_system_libs)), ) - # relocatable shared libs on macOS - for configure in [ - os.path.join(self.source_folder, "configure"), - os.path.join(self.source_folder, "libltdl", "configure"), - ]: - replace_in_file(self, configure, "-install_name \\$rpath/", "-install_name @rpath/") def build(self): self._patch_sources() @@ -117,6 +113,7 @@ def package(self): 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") @@ -149,6 +146,4 @@ def package_info(self): self.cpp_info.components["odbcinst"].system_libs = ["pthread"] # 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.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/odbc/all/test_package/conanfile.py b/recipes/odbc/all/test_package/conanfile.py index 1278841f61298..a0bef6bd96975 100644 --- a/recipes/odbc/all/test_package/conanfile.py +++ b/recipes/odbc/all/test_package/conanfile.py @@ -13,7 +13,7 @@ def layout(self): cmake_layout(self) def requirements(self): - self.requires(self.tested_reference_str) + self.requires(self.tested_reference_str, run=True) def build(self): cmake = CMake(self) diff --git a/recipes/ode/all/conandata.yml b/recipes/ode/all/conandata.yml index cb490a2db9ad2..59347531ec928 100644 --- a/recipes/ode/all/conandata.yml +++ b/recipes/ode/all/conandata.yml @@ -1,8 +1,15 @@ sources: + "0.16.4": + url: "https://bitbucket.org/odedevs/ode/downloads/ode-0.16.4.tar.gz" + sha256: "71037b8281c6c86b0a55729f90d5db697abe4cbec1d8118157e00d48ec253467" "0.16.2": url: "https://bitbucket.org/odedevs/ode/downloads/ode-0.16.2.tar.gz" sha256: "b26aebdcb015e2d89720ef48e0cb2e8a3ca77915f89d853893e7cc861f810f22" patches: + "0.16.4": + - patch_file: "patches/0002-dont-force-pic.patch" + patch_description: "Allow to build static library without PIC" + patch_type: "conan" "0.16.2": - patch_file: "patches/0001-fix-apple.patch" patch_description: "Fix cross-build to macOS, iOS, watchOS & tvOS" @@ -10,9 +17,6 @@ patches: - 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 index f4db94d80a49b..0ad8a648e1978 100644 --- a/recipes/ode/all/conanfile.py +++ b/recipes/ode/all/conanfile.py @@ -1,11 +1,11 @@ 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 -from conans.tools import stdcpp_library import os -required_conan_version = ">=1.53.0" +required_conan_version = ">=1.54.0" class OdeConan(ConanFile): @@ -16,6 +16,7 @@ class OdeConan(ConanFile): 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], @@ -49,16 +50,15 @@ def requirements(self): self.requires("libccd/2.1") def validate(self): - if self.info.options.with_libccd: + if self.options.with_libccd: ccd_double_precision = self.dependencies["libccd"].options.enable_double_precision - if self.info.options.precision == "single" and ccd_double_precision: + if self.options.precision == "single" and ccd_double_precision: raise ConanInvalidConfiguration("ode:precision=single requires libccd:enable_double_precision=False") - elif self.info.options.precision == "double" and not ccd_double_precision: + 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], - 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,13 +77,12 @@ def generate(self): tc.variables["ODE_DOUBLE_PRECISION"] = self.options.precision == "double" # Relocatable shared libs on macOS tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" - # Honor BUILD_SHARED_LIBS (see https://github.com/conan-io/conan/issues/11840) - tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" # Avoid a warning tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0075"] = "NEW" tc.generate() deps = CMakeDeps(self) + deps.set_property("libccd", "cmake_target_name", "ccd::ccd") deps.generate() def build(self): diff --git a/recipes/ode/all/patches/0003-cmake-fix-ccd-target.patch b/recipes/ode/all/patches/0003-cmake-fix-ccd-target.patch deleted file mode 100644 index e9dd8b78218bb..0000000000000 --- a/recipes/ode/all/patches/0003-cmake-fix-ccd-target.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- 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/config.yml b/recipes/ode/config.yml index 62178f7b45783..86a42ef0267a1 100644 --- a/recipes/ode/config.yml +++ b/recipes/ode/config.yml @@ -1,3 +1,5 @@ versions: + "0.16.4": + folder: all "0.16.2": folder: all diff --git a/recipes/ofeli/all/conandata.yml b/recipes/ofeli/4.x/conandata.yml similarity index 100% rename from recipes/ofeli/all/conandata.yml rename to recipes/ofeli/4.x/conandata.yml diff --git a/recipes/ofeli/4.x/conanfile.py b/recipes/ofeli/4.x/conanfile.py new file mode 100644 index 0000000000000..1bdb7a7fb9c25 --- /dev/null +++ b/recipes/ofeli/4.x/conanfile.py @@ -0,0 +1,82 @@ +import os + +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import chdir, copy, get +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout + +required_conan_version = ">=1.53.0" + + +class OfeliConan(ConanFile): + name = "ofeli" + description = "An Object Finite Element Library" + license = "LGPL-3.0-or-later" + url = "https://github.com/conan-io/conan-center-index" + homepage = "http://ofeli.org/index.html" + topics = ("finite-element", "finite-element-library", "finite-element-analysis", "finite-element-solver") + + package_type = "static-library" + settings = "os", "arch", "compiler", "build_type" + options = { + "fPIC": [True, False], + } + default_options = { + "fPIC": True, + } + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def layout(self): + basic_layout(self, src_folder="src") + + def validate(self): + if self.settings.os not in ["Linux", "FreeBSD"]: + raise ConanInvalidConfiguration("Ofeli only supports Linux") + if self.settings.compiler != "gcc": + raise ConanInvalidConfiguration("Ofeli only supports GCC") + if self.settings.compiler.cppstd: + check_min_cppstd(self, 11) + if self.settings.compiler.libcxx != "libstdc++11": + raise ConanInvalidConfiguration("Ofeli only supports libstdc++'s new ABI") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = AutotoolsToolchain(self) + config = 'release' if self.settings.build_type == 'Release' else 'debug' + tc.configure_args.append(f"--enable-{config}") + tc.generate() + + def build(self): + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.configure() + autotools.make() + + def package(self): + copy(self, "*.h", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include")) + copy(self, "*libofeli.a", + dst=os.path.join(self.package_folder, "lib"), + src=os.path.join(self.source_folder, "src")) + copy(self, "*.md", + dst=os.path.join(self.package_folder, "res"), + src=os.path.join(self.source_folder, "material")) + copy(self, "COPYING", + dst=os.path.join(self.package_folder, "licenses"), + src=os.path.join(self.source_folder, "doc")) + + def package_info(self): + self.cpp_info.libs = ["ofeli"] + res_path = os.path.join(self.package_folder, "res") + self.runenv_info.define("OFELI_PATH_MATERIAL", res_path) + + # TODO: Legacy, to be removed on Conan 2.0 + self.env_info.OFELI_PATH_MATERIAL.append(res_path) diff --git a/recipes/ofeli/4.x/test_package/CMakeLists.txt b/recipes/ofeli/4.x/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..1e5e727abc890 --- /dev/null +++ b/recipes/ofeli/4.x/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(ofeli REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} ofeli::ofeli) +set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 11) diff --git a/recipes/ofeli/4.x/test_package/conanfile.py b/recipes/ofeli/4.x/test_package/conanfile.py new file mode 100644 index 0000000000000..ef5d7042163ec --- /dev/null +++ b/recipes/ofeli/4.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_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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/ofeli/4.x/test_package/test_package.cpp b/recipes/ofeli/4.x/test_package/test_package.cpp new file mode 100644 index 0000000000000..618f3ee674c68 --- /dev/null +++ b/recipes/ofeli/4.x/test_package/test_package.cpp @@ -0,0 +1,76 @@ +/*============================================================================== + + O F E L I + + Object Finite Element Library + + ============================================================================== + + Copyright (C) 1998 - 2015 Rachid Touzani + + This file is part of OFELI. + + OFELI is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OFELI is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with OFELI. If not, see . + + ============================================================================== + + An example of a Finite Element Code using OFELI + + Solution of a 1-D Elliptic problem using P1 Finite elements + + ==============================================================================*/ + +#include "OFELI.h" +using namespace OFELI; + +int main(int argc, char *argv[]) +{ + double L=1; + int N=10; + +/// Read and output mesh data + banner(); + if (argc>1) + N = atoi(argv[1]); + Mesh ms(L,N); + int NbN = N+1; + +// Declare problem data (matrix, rhs, boundary conditions, body forces) + TrMatrix A(NbN); + Vect b(ms); + b.set("16*pi*pi*sin(4*pi*x)"); + +// Build matrix and R.H.S. + double h = L/double(N); + b *= h; + for (int i=2; i sol(ms); + sol.set("sin(4*pi*x)"); + cout << "Error = " << (b-sol).getNormMax() << endl; + return 0; +} diff --git a/recipes/ofeli/4.x/test_v1_package/CMakeLists.txt b/recipes/ofeli/4.x/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/ofeli/4.x/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/ofeli/4.x/test_v1_package/conanfile.py b/recipes/ofeli/4.x/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..49a3a66ea5bad --- /dev/null +++ b/recipes/ofeli/4.x/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/ofeli/5.x/conandata.yml b/recipes/ofeli/5.x/conandata.yml new file mode 100644 index 0000000000000..113211f34c5ac --- /dev/null +++ b/recipes/ofeli/5.x/conandata.yml @@ -0,0 +1,4 @@ +sources: + "5.1.0": + url: "https://github.com/rtouzani/ofeli/archive/0e66d0e5a38b209ee79eab0daf7686562b753536.tar.gz" + sha256: "a2e4e62d912d05e55001a9be7c5c4741a7b8773a399acbbe558bdca0d60d430b" diff --git a/recipes/ofeli/5.x/conanfile.py b/recipes/ofeli/5.x/conanfile.py new file mode 100644 index 0000000000000..ee690068f3c61 --- /dev/null +++ b/recipes/ofeli/5.x/conanfile.py @@ -0,0 +1,88 @@ +import os + +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import copy, get, rmdir, replace_in_file, rename +from conan.tools.microsoft import is_msvc + +required_conan_version = ">=1.53.0" + + +class OfeliConan(ConanFile): + name = "ofeli" + description = "An Object Finite Element Library" + license = "LGPL-3.0-or-later" + url = "https://github.com/conan-io/conan-center-index" + homepage = "http://ofeli.org/index.html" + topics = ("finite-element", "finite-element-library", "finite-element-analysis", "finite-element-solver") + + package_type = "static-library" + settings = "os", "arch", "compiler", "build_type" + 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 validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, 11) + if self.settings.compiler in ["clang", "apple-clang"] or is_msvc(self): + # Clang fails with + # include/linear_algebra/LocalVect_impl.h:251:42: error: cannot initialize return object of type 'OFELI::Element *' with an lvalue of type 'const OFELI::Element *' + # MSVC fails with a lot of errors + # https://c3i.jfrog.io/c3i/misc/summary.html?json=https://c3i.jfrog.io/c3i/misc/logs/pr/18952/12-windows-visual_studio/ofeli/5.1.0/summary.json + raise ConanInvalidConfiguration(f"{self.settings.compiler} is not supported due to compilation errors") + + def build_requirements(self): + self.tool_requires("cmake/[>=3.16 <4]") + + 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.generate() + + def _patch_sources(self): + cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") + replace_in_file(self, cmakelists, "add_subdirectory (demos)", "") + replace_in_file(self, cmakelists, "add_subdirectory (util)", "") + # Fix incorrect use of add_definitions() for build flags + replace_in_file(self, cmakelists, "add_definitions", "add_compile_options") + # Fix -fPIC support + replace_in_file(self, cmakelists, " -fPIE", "") + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) + cmake.install() + rename(self, os.path.join(self.package_folder, "share", "ofeli", "material"), + os.path.join(self.package_folder, "res")) + rmdir(self, os.path.join(self.package_folder, "share")) + + + def package_info(self): + self.cpp_info.libs = ["ofeli"] + self.cpp_info.includedirs = [os.path.join("include", "ofeli")] + res_path = os.path.join(self.package_folder, "res") + self.runenv_info.define_path("OFELI_PATH_MATERIAL", res_path) diff --git a/recipes/ofeli/5.x/test_package/CMakeLists.txt b/recipes/ofeli/5.x/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..1e5e727abc890 --- /dev/null +++ b/recipes/ofeli/5.x/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(ofeli REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} ofeli::ofeli) +set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 11) diff --git a/recipes/ofeli/5.x/test_package/conanfile.py b/recipes/ofeli/5.x/test_package/conanfile.py new file mode 100644 index 0000000000000..ef5d7042163ec --- /dev/null +++ b/recipes/ofeli/5.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_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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/ofeli/5.x/test_package/test_package.cpp b/recipes/ofeli/5.x/test_package/test_package.cpp new file mode 100644 index 0000000000000..618f3ee674c68 --- /dev/null +++ b/recipes/ofeli/5.x/test_package/test_package.cpp @@ -0,0 +1,76 @@ +/*============================================================================== + + O F E L I + + Object Finite Element Library + + ============================================================================== + + Copyright (C) 1998 - 2015 Rachid Touzani + + This file is part of OFELI. + + OFELI is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OFELI is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with OFELI. If not, see . + + ============================================================================== + + An example of a Finite Element Code using OFELI + + Solution of a 1-D Elliptic problem using P1 Finite elements + + ==============================================================================*/ + +#include "OFELI.h" +using namespace OFELI; + +int main(int argc, char *argv[]) +{ + double L=1; + int N=10; + +/// Read and output mesh data + banner(); + if (argc>1) + N = atoi(argv[1]); + Mesh ms(L,N); + int NbN = N+1; + +// Declare problem data (matrix, rhs, boundary conditions, body forces) + TrMatrix A(NbN); + Vect b(ms); + b.set("16*pi*pi*sin(4*pi*x)"); + +// Build matrix and R.H.S. + double h = L/double(N); + b *= h; + for (int i=2; i sol(ms); + sol.set("sin(4*pi*x)"); + cout << "Error = " << (b-sol).getNormMax() << endl; + return 0; +} diff --git a/recipes/ofeli/all/CMakeLists.txt b/recipes/ofeli/all/CMakeLists.txt deleted file mode 100644 index c921d02a0d877..0000000000000 --- a/recipes/ofeli/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/ofeli/all/conanfile.py b/recipes/ofeli/all/conanfile.py deleted file mode 100644 index 0696eaa92f3e6..0000000000000 --- a/recipes/ofeli/all/conanfile.py +++ /dev/null @@ -1,73 +0,0 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment -import os -from conans.errors import ConanInvalidConfiguration - -required_conan_version = ">=1.40.0" - - -class OfeliConan(ConanFile): - name = "ofeli" - description = "An Object Finite Element Library" - topics = ("finite-element", "finite-element-library", - "finite-element-analysis", "finite-element-solver") - license = "LGPL-3.0-or-later" - homepage = "http://ofeli.org/index.html" - url = "https://github.com/conan-io/conan-center-index" - settings = "os", "arch", "compiler", "build_type" - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _doc_folder(self): - return os.path.join( - self._source_subfolder, - "doc" - ) - - def validate(self): - if self.settings.os != "Linux": - raise ConanInvalidConfiguration( - "Ofeli is just supported for Linux") - if self.settings.compiler != "gcc": - raise ConanInvalidConfiguration( - "Ofeli is just supported for GCC") - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 11) - if self.settings.compiler.libcxx != "libstdc++11": - raise ConanInvalidConfiguration( - "Ofeli supports only libstdc++'s new ABI") - - 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) - self._autotools.configure(args=["--enable-%s" % ("release" - if self.settings.build_type == "Release" - else "debug")]) - return self._autotools - - def build(self): - with tools.chdir(self._source_subfolder): - autotools = self._configure_autotools() - autotools.make() - - def package(self): - self.copy("*.h", dst="include", - src=os.path.join(self._source_subfolder, "include")) - self.copy("*libofeli.a", dst="lib", - src=os.path.join(self._source_subfolder, "src")) - self.copy("*.md", dst="res", - src=os.path.join(self._source_subfolder, "material")) - self.copy("COPYING", dst="licenses", src=self._doc_folder) - - def package_info(self): - self.cpp_info.libs = ["ofeli"] - self.env_info.OFELI_PATH_MATERIAL.append( - os.path.join(self.package_folder, "res")) diff --git a/recipes/ofeli/all/test_package/CMakeLists.txt b/recipes/ofeli/all/test_package/CMakeLists.txt deleted file mode 100644 index 14b7550d3c44c..0000000000000 --- a/recipes/ofeli/all/test_package/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(test_package LANGUAGES CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(ofeli CONFIG REQUIRED) - -add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ofeli::ofeli) -set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 11) diff --git a/recipes/ofeli/all/test_package/test_package.cpp b/recipes/ofeli/all/test_package/test_package.cpp deleted file mode 100644 index 8d7d1aa2db165..0000000000000 --- a/recipes/ofeli/all/test_package/test_package.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/*============================================================================== - - O F E L I - - Object Finite Element Library - - ============================================================================== - - Copyright (C) 1998 - 2015 Rachid Touzani - - This file is part of OFELI. - - OFELI is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OFELI is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with OFELI. If not, see . - - ============================================================================== - - An example of a Finite Element Code using OFELI - - Solution of a 1-D Elliptic problem using P1 Finite elements - - ==============================================================================*/ - -#include "OFELI.h" -using namespace OFELI; - -int main(int argc, char *argv[]) -{ - double L=1; - int N=10; - -/// Read and output mesh data - banner(); - if (argc>1) - N = atoi(argv[1]); - Mesh ms(L,N); - int NbN = N+1; - -// Declare problem data (matrix, rhs, boundary conditions, body forces) - TrMatrix A(NbN); - Vect b(ms); - b.set("16*pi*pi*sin(4*pi*x)"); - -// Build matrix and R.H.S. - double h = L/double(N); - b *= h; - for (int i=2; i sol(ms); - sol.set("sin(4*pi*x)"); - cout << "Error = " << (b-sol).getNormMax() << endl; - return 0; -} diff --git a/recipes/ofeli/config.yml b/recipes/ofeli/config.yml index 33a6df35b4e32..ed520cd12092e 100644 --- a/recipes/ofeli/config.yml +++ b/recipes/ofeli/config.yml @@ -1,3 +1,5 @@ versions: + "5.1.0": + folder: 5.x "4.1.2": - folder: all + folder: 4.x diff --git a/recipes/ogdf/all/conandata.yml b/recipes/ogdf/all/conandata.yml new file mode 100644 index 0000000000000..c6c2b408e36ee --- /dev/null +++ b/recipes/ogdf/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "2023.09": + url: "https://github.com/ogdf/ogdf/archive/refs/tags/elderberry-202309.tar.gz" + sha256: "3438205d3a6ff69d24c3a6db748d2a5a78688605baf3092456073901a2b623f3" + "2022.02": + url: "https://github.com/ogdf/ogdf/archive/refs/tags/dogwood-202202.tar.gz" + sha256: "308cc2749c6a63520f7979bac86a04066dfea2fb9d3a5e89831318db404bfbf5" diff --git a/recipes/ogdf/all/conanfile.py b/recipes/ogdf/all/conanfile.py new file mode 100644 index 0000000000000..cbdc4032988fc --- /dev/null +++ b/recipes/ogdf/all/conanfile.py @@ -0,0 +1,95 @@ +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.tools.files import copy, get, replace_in_file, rmdir +from os.path import join + +required_conan_version = ">=1.53.0" + + +class OGDFConan(ConanFile): + name = "ogdf" + description = "Open Graph algorithms and Data structures Framework" + license = ("GPL-2.0-or-later", "GPL-3.0-or-later") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://ogdf.net" + topics = ("graph", "algorithm", "data-structures") + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + def source(self): + 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 configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def requirements(self): + self.requires("coin-clp/1.17.7") + self.requires("pugixml/1.14") + + def layout(self): + cmake_layout(self, src_folder="src") + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["COIN_SOLVER"] = "CLP" + tc.variables["COIN_SOLVER_IS_EXTERNAL"] = 0 + tc.generate() + tc = CMakeDeps(self) + tc.generate() + + def _patch_sources(self): + # delete code from other cci packages + rmdir(self, join(self.source_folder, "src", "coin")) + rmdir(self, join(self.source_folder, "include", "coin")) + rmdir(self, join(self.source_folder, "include", "ogdf", "lib", "backward")) + rmdir(self, join(self.source_folder, "src", "ogdf", "lib", "pugixml")) + rmdir(self, join(self.source_folder, "include", "ogdf", "lib", "pugixml")) + # use cci packages where available + replace_in_file(self, join(self.source_folder, "CMakeLists.txt"), "include(coin)", "find_package(coin-clp REQUIRED CONFIG)\nfind_package(pugixml REQUIRED CONFIG)") + replace_in_file(self, join(self.source_folder, "cmake", "ogdf.cmake"), "target_link_libraries(OGDF PUBLIC COIN)", "target_link_libraries(OGDF PUBLIC coin-clp::coin-clp pugixml::pugixml)") + # replace pugixml copy in repo by conan dependency + for dir_name, file_name in [("include", "GexfParser.h"), + ("include", "GraphMLParser.h"), + ("include", "SvgPrinter.h"), + ("include", "TsplibXmlParser.h"), + ("src", "GraphIO_graphml.cpp"), + ("src", "GraphIO_gexf.cpp")]: + replace_in_file(self, join(self.source_folder, dir_name, "ogdf", "fileformats", file_name), "ogdf/lib/pugixml/pugixml.h", "pugixml.hpp") + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() + cmake.build(target="OGDF") + + def package(self): + copy(self, pattern="LICENSE*.txt", src=self.source_folder, dst=join(self.package_folder, "licenses")) + copy(self, pattern="*.h", src=join(self.source_folder, "include"), dst=join(self.package_folder, "include")) + copy(self, pattern="*.h", src=join(self.build_folder, "include"), dst=join(self.package_folder, "include")) + copy(self, pattern="*.lib", src=self.build_folder, dst=join(self.package_folder, "lib"), keep_path=False) + if self.options.shared: + copy(self, pattern="*.so*", src=self.build_folder, dst=join(self.package_folder, "lib")) + copy(self, pattern="*.dylib*", src=self.build_folder, dst=join(self.package_folder, "lib")) + copy(self, pattern="*.dll", src=self.build_folder, dst=join(self.package_folder, "bin"), keep_path=False) + else: + copy(self, pattern="*.a", src=self.build_folder, dst=join(self.package_folder, "lib")) + fix_apple_shared_install_name(self) + + def package_info(self): + self.cpp_info.libs = ["OGDF"] + 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/ogdf/all/test_package/CMakeLists.txt b/recipes/ogdf/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..f9d34fb86421b --- /dev/null +++ b/recipes/ogdf/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(ogdf REQUIRED CONFIG) +add_executable(${PROJECT_NAME} main.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE ogdf::ogdf) diff --git a/recipes/ogdf/all/test_package/conanfile.py b/recipes/ogdf/all/test_package/conanfile.py new file mode 100644 index 0000000000000..8a5bb47f50c4c --- /dev/null +++ b/recipes/ogdf/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/ogdf/all/test_package/main.cpp b/recipes/ogdf/all/test_package/main.cpp new file mode 100644 index 0000000000000..92f79bf1d49e0 --- /dev/null +++ b/recipes/ogdf/all/test_package/main.cpp @@ -0,0 +1,18 @@ +#include +#include +#include + +using namespace ogdf; + +int main() +{ + Graph G; + randomSimpleGraph(G, 10, 20); + + DfsAcyclicSubgraph DAS; + DAS.callAndReverse(G); + + GraphIO::write(G, "output-acyclic-graph.graphml", GraphIO::writeGraphML); + + return 0; +} diff --git a/recipes/ogdf/all/test_v1_package/CMakeLists.txt b/recipes/ogdf/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..36b48f96d1078 --- /dev/null +++ b/recipes/ogdf/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/ogdf/all/test_v1_package/conanfile.py b/recipes/ogdf/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/ogdf/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/ogdf/config.yml b/recipes/ogdf/config.yml new file mode 100644 index 0000000000000..9860e459d4c28 --- /dev/null +++ b/recipes/ogdf/config.yml @@ -0,0 +1,5 @@ +versions: + "2023.09": + folder: all + "2022.02": + 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/ohnet/all/conandata.yml b/recipes/ohnet/all/conandata.yml new file mode 100644 index 0000000000000..974392dab738f --- /dev/null +++ b/recipes/ohnet/all/conandata.yml @@ -0,0 +1,26 @@ +sources: + "1.37.5454": + url: "https://github.com/openhome/ohNet/archive/refs/tags/ohNet_1.37.5454.tar.gz" + sha256: "343c0f6b015e04195f5e7d937fa5e010a4d5a54782387d1c79259d3bb4ead0f0" + "1.36.5344": + url: "https://github.com/openhome/ohNet/archive/refs/tags/ohNet_1.36.5344.tar.gz" + sha256: "4873504f8f98c5fdbd72537392d6e5d97ed0747d3ef0b9c2b7fe77f1a02aaeb6" + "1.36.5182": + url: "https://github.com/openhome/ohNet/archive/refs/tags/ohNet_1.36.5182.tar.gz" + sha256: "1489407b9bae13affa8f933a81fb5a43f16b29f5bf8048b68ea645afc0e53ced" +patches: + "1.37.5454": + - patch_file: "patches/0001-makefile-1.37.5454.patch" + patch_description: "Reduce gcc-centricity in Makefile" + patch_type: "conan" + - patch_file: "patches/0001-common.mak-1.37.5454.patch" + patch_description: "Use proper flags for C++ file" + patch_type: "conan" + "1.36.5344": + - patch_file: "patches/0001-makefile-1.36.5344.patch" + patch_description: "Reduce gcc-centricity in Makefile" + patch_type: "conan" + "1.36.5182": + - patch_file: "patches/0001-makefile-universal.patch" + patch_description: "Reduce gcc-centricity in Makefile" + patch_type: "conan" diff --git a/recipes/ohnet/all/conanfile.py b/recipes/ohnet/all/conanfile.py new file mode 100755 index 0000000000000..e76982e6ef25b --- /dev/null +++ b/recipes/ohnet/all/conanfile.py @@ -0,0 +1,155 @@ +from conan import ConanFile +from conan.tools.files import get, chdir, copy, mkdir, export_conandata_patches, apply_conandata_patches +from conan.tools.apple import fix_apple_shared_install_name, is_apple_os +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.microsoft import is_msvc, msvc_runtime_flag, NMakeToolchain +from conan.tools.layout import basic_layout +from conan.errors import ConanInvalidConfiguration +import os + +required_conan_version = ">=1.53.0" + + +class OhNetConan(ConanFile): + name = "ohnet" + description = "OpenHome Networking (ohNet) is a modern, cross platform, multi-language UPnP stack" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/openhome/ohNet" + topics = ("openhome", "ohnet", "upnp") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + short_paths = True + + def _fill_openhome_architecture(self, args): + if is_apple_os(self): + if str(self.settings.arch).startswith("armv8"): + openhome_architecture = "arm64" + args.extend([f"openhome_architecture={openhome_architecture}", f"detected_openhome_architecture={openhome_architecture}"]) + return args + + 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): + basic_layout(self, src_folder="src") + + def validate(self): + if is_msvc(self) and (self.options.shared or msvc_runtime_flag(self).startswith('MD')): + raise ConanInvalidConfiguration(f"{self.ref} doesn't support shared builds with Visual Studio yet") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def export_sources(self): + export_conandata_patches(self) + + def generate(self): + if is_msvc(self): + tc = NMakeToolchain(self) + tc.generate() + else: + tc = AutotoolsToolchain(self) + tc.make_args.append("-j1") + tc.generate() + + def _fill_ohnet_args(self, args): + if self.settings.build_type == "Debug": + args.append("debug=1") + + installlibdir = os.path.join(self.package_folder, "lib") + installincludedir = os.path.join(self.package_folder, "include") + + args.extend([f"prefix={self.package_folder}",f"installdir={self.package_folder}", f"installlibdir={installlibdir}", f"installincludedir={installincludedir}"]) + + if not is_msvc(self): + args = self._fill_openhome_architecture(args) + args.append("rsync=no") + if str(self.settings.compiler.libcxx) == "libc++": + args.extend(["CPPFLAGS=-stdlib=libc++", "LDFLAGS=-stdlib=libc++"]) + return args + + def build(self): + apply_conandata_patches(self) + targets = "ohNetDll TestsNative proxies devices" + args = [] + self._fill_ohnet_args(args) + + with chdir(self, self.source_folder): + if is_msvc(self): + self.run(f"nmake /f OhNet.mak {targets} {' '.join(args)}") + else: + autotools = Autotools(self) + autotools.make(args=args, target=targets) + + def package(self): + copy(self, "License.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + + copy(self, "*", src=os.path.join(self.source_folder, "OpenHome", "Net", "ServiceGen"), dst=os.path.join(self.package_folder, "lib", "ServiceGen")) + mkdir(self, os.path.join(self.package_folder, "lib", "t4")) + + args = [] + self._fill_ohnet_args(args) + + with chdir(self, self.source_folder): + if is_msvc(self): + self.run(f"nmake /f OhNet.mak install {' '.join(args)}") + else: + autotools = Autotools(self) + autotools.make(args=args, target="install-libs install-includes") + if is_apple_os(self): + fix_apple_shared_install_name(self) + + def package_info(self): + self.cpp_info.components["ohNet"].libs = ["ohNet"] + self.cpp_info.components["ohNet"].builddirs = [os.path.join("lib", "ServiceGen")] + self.cpp_info.components["ohNet"].set_property("cmake_target_name", "ohNet") + self.cpp_info.components["ohNet"].defines.extend(["DEFINE_LITTLE_ENDIAN"]) + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["ohNet"].system_libs.extend(["pthread", "m"]) + elif self.settings.os == "Windows": + self.cpp_info.components["ohNet"].system_libs.extend(["iphlpapi", "ws2_32", "dbghelp"]) + + self.cpp_info.components["ohNetCore"].libs = ["ohNetCore"] + self.cpp_info.components["ohNetCore"].builddirs = [os.path.join("lib", "ServiceGen")] + self.cpp_info.components["ohNetCore"].set_property("cmake_target_name", "ohNetCore") + self.cpp_info.components["ohNetCore"].defines.extend(["DEFINE_LITTLE_ENDIAN"]) + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["ohNetCore"].system_libs.extend(["pthread", "m"]) + elif self.settings.os == "Windows": + self.cpp_info.components["ohNetCore"].system_libs.extend(["iphlpapi", "ws2_32", "dbghelp"]) + elif self.settings.os == "Macos": + self.cpp_info.components["ohNetCore"].frameworks.extend(["CoreFoundation", "IOKit", "SystemConfiguration"]) + + self.cpp_info.components["ohNetDevices"].libs = ["ohNetDevices"] + self.cpp_info.components["ohNetDevices"].set_property("cmake_target_name", "ohNetDevices") + + self.cpp_info.components["ohNetProxies"].libs = ["ohNetProxies"] + self.cpp_info.components["ohNetProxies"].set_property("cmake_target_name", "ohNetProxies") + + self.cpp_info.components["TestFramework"].libs = ["TestFramework"] + self.cpp_info.components["TestFramework"].set_property("cmake_target_name", "TestFramework") + self.cpp_info.components["TestFramework"].requires = ["ohNetCore"] + + # TODO: to remove in conan v2 once cmake_find_package* generators removed + self.cpp_info.names["cmake_find_package"] = "ohNet" + self.cpp_info.names["cmake_find_package_multi"] = "ohNet" + self.cpp_info.names["pkg_config"] = "ohNet" + + for component in ["ohNetCore", "OhNetDevices", "ohNetProxies", "TestFramework"]: + self.cpp_info.components[component].names["cmake_find_package"] = component + self.cpp_info.components[component].names["cmake_find_package_multi"] = component + self.cpp_info.components[component].set_property("cmake_target_name", component) diff --git a/recipes/ohnet/all/patches/0001-common.mak-1.37.5454.patch b/recipes/ohnet/all/patches/0001-common.mak-1.37.5454.patch new file mode 100644 index 0000000000000..9b99e3972d230 --- /dev/null +++ b/recipes/ohnet/all/patches/0001-common.mak-1.37.5454.patch @@ -0,0 +1,27 @@ +diff --git a/Common.mak b/Common.mak +index a25489c2..7189c9dc 100644 +--- a/Common.mak ++++ b/Common.mak +@@ -385,21 +385,21 @@ $(objdir)nsec.$(objext) : $(mDNSdir)/nsec.c $(headers) + $(compiler)nsec.$(objext) -c $(cflags_third_party) $(includes) $(mDNSdir)/nsec.c + $(objdir)nsec3.$(objext) : $(mDNSdir)/nsec3.c $(headers) + $(compiler)nsec3.$(objext) -c $(cflags_third_party) $(includes) $(mDNSdir)/nsec3.c + $(objdir)uDNS.$(objext) : $(mDNSdir)/uDNS.c $(headers) + $(compiler)uDNS.$(objext) -c $(cflags_third_party) $(includes) $(mDNSdir)/uDNS.c + $(objdir)dnssd_clientshim.$(objext) : $(mDNSdir)/dnssd_clientshim.c $(headers) + $(compiler)dnssd_clientshim.$(objext) -c $(cflags_third_party) $(includes) $(mDNSdir)/dnssd_clientshim.c + $(objdir)dnssd_clientlib.$(objext) : $(mDNSdir)/dnssd_clientlib.c $(headers) + $(compiler)dnssd_clientlib.$(objext) -c $(cflags_third_party) $(includes) $(mDNSdir)/dnssd_clientlib.c + $(objdir)MdnsPlatform.$(objext) : OpenHome/Net/Device/Bonjour/MdnsPlatform.cpp $(headers) +- $(compiler)MdnsPlatform.$(objext) -c $(cflags_third_party) $(includes) OpenHome/Net/Device/Bonjour/MdnsPlatform.cpp ++ $(compiler)MdnsPlatform.$(objext) -c $(cflags_third_party) $(cppflags) $(includes) OpenHome/Net/Device/Bonjour/MdnsPlatform.cpp + $(objdir)MdnsProvider.$(objext) : OpenHome/Net/Device/Bonjour/MdnsProvider.cpp $(headers) + $(compiler)MdnsProvider.$(objext) -c $(cppflags) $(includes) OpenHome/Net/Device/Bonjour/MdnsProvider.cpp + $(objdir)Md5.$(objext) : OpenHome/md5.c $(headers) + $(compiler)Md5.$(objext) -c $(cflags_third_party) $(includes) OpenHome/md5.c + $(objdir)NetworkAdapterList.$(objext) : OpenHome/NetworkAdapterList.cpp $(headers) + $(compiler)NetworkAdapterList.$(objext) -c $(cppflags) $(includes) OpenHome/NetworkAdapterList.cpp + $(objdir)DnsChangeNotifier.$(objext) : OpenHome/DnsChangeNotifier.cpp $(headers) + $(compiler)DnsChangeNotifier.$(objext) -c $(cppflags) $(includes) OpenHome/DnsChangeNotifier.cpp + $(objdir)Network.$(objext) : OpenHome/Network.cpp $(headers) + $(compiler)Network.$(objext) -c $(cppflags) $(includes) OpenHome/Network.cpp diff --git a/recipes/ohnet/all/patches/0001-makefile-1.36.5344.patch b/recipes/ohnet/all/patches/0001-makefile-1.36.5344.patch new file mode 100644 index 0000000000000..4422447f1344d --- /dev/null +++ b/recipes/ohnet/all/patches/0001-makefile-1.36.5344.patch @@ -0,0 +1,363 @@ +diff --git a/Common.mak b/Common.mak +index baae7b17..2f058f51 100644 +--- a/Common.mak ++++ b/Common.mak +@@ -381,21 +381,21 @@ $(objdir)nsec.$(objext) : $(mDNSdir)/nsec.c $(headers) + $(compiler)nsec.$(objext) -c $(cflags_third_party) $(includes) $(mDNSdir)/nsec.c + $(objdir)nsec3.$(objext) : $(mDNSdir)/nsec3.c $(headers) + $(compiler)nsec3.$(objext) -c $(cflags_third_party) $(includes) $(mDNSdir)/nsec3.c + $(objdir)uDNS.$(objext) : $(mDNSdir)/uDNS.c $(headers) + $(compiler)uDNS.$(objext) -c $(cflags_third_party) $(includes) $(mDNSdir)/uDNS.c + $(objdir)dnssd_clientshim.$(objext) : $(mDNSdir)/dnssd_clientshim.c $(headers) + $(compiler)dnssd_clientshim.$(objext) -c $(cflags_third_party) $(includes) $(mDNSdir)/dnssd_clientshim.c + $(objdir)dnssd_clientlib.$(objext) : $(mDNSdir)/dnssd_clientlib.c $(headers) + $(compiler)dnssd_clientlib.$(objext) -c $(cflags_third_party) $(includes) $(mDNSdir)/dnssd_clientlib.c + $(objdir)MdnsPlatform.$(objext) : OpenHome/Net/Device/Bonjour/MdnsPlatform.cpp $(headers) +- $(compiler)MdnsPlatform.$(objext) -c $(cflags_third_party) $(includes) OpenHome/Net/Device/Bonjour/MdnsPlatform.cpp ++ $(compiler)MdnsPlatform.$(objext) -c $(cppflags) $(cflags_third_party) $(includes) OpenHome/Net/Device/Bonjour/MdnsPlatform.cpp + $(objdir)MdnsProvider.$(objext) : OpenHome/Net/Device/Bonjour/MdnsProvider.cpp $(headers) + $(compiler)MdnsProvider.$(objext) -c $(cppflags) $(includes) OpenHome/Net/Device/Bonjour/MdnsProvider.cpp + $(objdir)Md5.$(objext) : OpenHome/md5.c $(headers) + $(compiler)Md5.$(objext) -c $(cflags_third_party) $(includes) OpenHome/md5.c + $(objdir)NetworkAdapterList.$(objext) : OpenHome/NetworkAdapterList.cpp $(headers) + $(compiler)NetworkAdapterList.$(objext) -c $(cppflags) $(includes) OpenHome/NetworkAdapterList.cpp + $(objdir)DnsChangeNotifier.$(objext) : OpenHome/DnsChangeNotifier.cpp $(headers) + $(compiler)DnsChangeNotifier.$(objext) -c $(cppflags) $(includes) OpenHome/DnsChangeNotifier.cpp + $(objdir)Network.$(objext) : OpenHome/Network.cpp $(headers) + $(compiler)Network.$(objext) -c $(cppflags) $(includes) OpenHome/Network.cpp +diff --git a/Makefile b/Makefile +index 2f0cb07c..372a6765 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,44 +1,44 @@ + #Makefile for linux + # Could be extended to support Mac in future + + rsync ?= yes + + ifeq ($(rsync),yes) + cp = rsync -u + else +-cp = cp -u ++cp = cp + endif + + ifeq ($(debug),1) + debug_specific_cflags = -g -O0 + debug_csharp = /define:DEBUG /debug+ + build_dir = Debug + openhome_configuration = Debug + android_ndk_debug = 1 + else + debug_specific_cflags = -g -O2 + debug_csharp = /optimize+ /debug:pdbonly + build_dir = Release + openhome_configuration = Release + android_ndk_debug=0 + endif + + + + # Figure out platform, openhome_system and openhome_architecture + +-gcc_machine = $(shell ${CROSS_COMPILE}gcc -dumpmachine) ++cc_machine = $(shell ${CROSS_COMPILE}$(CC) -dumpmachine) + MACHINE = $(shell uname -s) + + $(info CROSS_COMPILE: ${CROSS_COMPILE}) +-$(info Machine reported by compiler is: ${gcc_machine}) ++$(info Machine reported by compiler is: ${cc_machine}) + $(info Machine reported by uname is: ${MACHINE}) + $(info PLATFORM: ${PLATFORM}) + + ifeq ($(MACHINE),Darwin) + ifeq ($(iOs-arm64),1) + platform = iOS + detected_openhome_system = iOs + detected_openhome_architecture = arm64 + else ifeq ($(iOs-x64),1) + platform = iOS +@@ -50,88 +50,88 @@ ifeq ($(MACHINE),Darwin) + detected_openhome_architecture = rpi + else + platform = Mac + detected_openhome_system = Mac + ifeq ($(Mac-arm64),1) + detected_openhome_architecture = arm64 + else + detected_openhome_architecture = x64 + endif + endif +-else ifneq (, $(findstring powerpc, $(gcc_machine))) ++else ifneq (, $(findstring powerpc, $(cc_machine))) + platform = Core-ppc32 + detected_openhome_system = Core + detected_openhome_architecture = ppc32 + else ifeq ($(Android-anycpu), 1) + platform = Android + detected_openhome_system = Android + detected_openhome_architecture = anycpu + else ifeq ($(freebsd), 1) + platform = FreeBSD + detected_openhome_system = FreeBSD + detected_openhome_architecture = x86 +- compiler = gcc -o $(objdir) +- link = ${CROSS_COMPILE}g++ $(platform_linkflags) ++ compiler = $(CC) -o $(objdir) ++ link = ${CROSS_COMPILE}$(CXX) $(platform_linkflags) + ar = ${CROSS_COMPILE}ar rc $(objdir) + else ifneq (,$(findstring Linux-x86,${PLATFORM})) +- ifneq (,$(findstring x86_64,$(gcc_machine))) ++ ifneq (,$(findstring x86_64,$(cc_machine))) + platform = Vanilla + detected_openhome_system = Linux + detected_openhome_architecture = x86 + CFLAGS = -m32 + LDFLAGS = -m32 + endif + else + # At present, platform == Vanilla is used for Kirkwood, x86 and x64 Posix builds. + platform ?= Vanilla + ifneq (,$(findstring Qnap,$(platform))) + detected_openhome_system = Qnap +- else ifneq (,$(findstring linux,$(gcc_machine))) ++ else ifneq (,$(findstring linux,$(cc_machine))) + detected_openhome_system = Linux + endif +- ifneq (,$(findstring arm,$(gcc_machine))) +- ifneq (,$(findstring linux-gnueabihf,$(gcc_machine))) ++ ifneq (,$(findstring arm,$(cc_machine))) ++ ifneq (,$(findstring linux-gnueabihf,$(cc_machine))) + detected_openhome_architecture = armhf + else ifeq (${detected_openhome_system},Qnap) + detected_openhome_architecture = x19 + else + detected_openhome_architecture = armel + endif + endif +- ifneq (,$(findstring i686,$(gcc_machine))) ++ ifneq (,$(findstring i686,$(cc_machine))) + detected_openhome_architecture = x86 + endif +- ifneq (,$(findstring i586,$(gcc_machine))) ++ ifneq (,$(findstring i586,$(cc_machine))) + detected_openhome_architecture = x86 + endif +- ifneq (,$(findstring i486,$(gcc_machine))) ++ ifneq (,$(findstring i486,$(cc_machine))) + detected_openhome_architecture = x86 + endif +- ifneq (,$(findstring i386,$(gcc_machine))) ++ ifneq (,$(findstring i386,$(cc_machine))) + detected_openhome_architecture = x86 + endif +- ifneq (,$(findstring amd64,$(gcc_machine))) ++ ifneq (,$(findstring amd64,$(cc_machine))) + detected_openhome_architecture = x64 + endif +- ifneq (,$(findstring x86_64,$(gcc_machine))) ++ ifneq (,$(findstring x86_64,$(cc_machine))) + detected_openhome_architecture = x64 + endif +- ifneq (,$(findstring mipsel,$(gcc_machine))) ++ ifneq (,$(findstring mipsel,$(cc_machine))) + detected_openhome_architecture = mipsel + endif +- ifneq (,$(findstring mips,$(gcc_machine))) ++ ifneq (,$(findstring mips,$(cc_machine))) + detected_openhome_architecture = mipsel + endif +- ifneq (,$(findstring aarch64,$(gcc_machine))) ++ ifneq (,$(findstring aarch64,$(cc_machine))) + detected_openhome_architecture = arm64 + endif +- ifneq (,$(findstring riscv64,$(gcc_machine))) ++ ifneq (,$(findstring riscv64,$(cc_machine))) + detected_openhome_architecture = riscv64 + endif + endif + + detected_openhome_system ?= Unknown + detected_openhome_architecture ?= Unknown + + ifneq (${openhome_system},) + ifneq (${openhome_system},${detected_openhome_system}) + $(warning Detected compiler is for system ${detected_openhome_system} but expected ${openhome_system}. Build will probably fail.) +@@ -208,83 +208,89 @@ ifeq ($(platform),Mac) + openhome_architecture = x64 + else + # building for arm64 + platform_cflags = -DPLATFORM_MACOSX_GNU -arch arm64 -mmacosx-version-min=11 + platform_linkflags = -arch arm64 -framework CoreFoundation -framework SystemConfiguration -framework IOKit + osbuilddir = Mac-arm64 + openhome_architecture = arm64 + endif + + objdir = Build/Obj/$(osbuilddir)/$(build_dir)/ +- compiler = clang -fPIC -stdlib=libc++ -o $(objdir) ++ compiler = clang -fPIC -Qunused-arguments -stdlib=libc++ -o $(objdir) + link = clang++ -pthread -stdlib=libc++ $(platform_linkflags) + ar = ar rc $(objdir) + openhome_system = Mac + + dotnetRuntime = osx-x64 + endif + + ifeq ($(platform), Core-ppc32) + # platform == Core1 + openhome_system = Core + openhome_architecture = ppc32 + endian = BIG + platform_cflags = -mcpu=405 + platform_linkflags = -mcpu=405 ${CROSS_LINKFLAGS} + linkopts_ohNet = + osdir = Core + osbuilddir = Core-ppc32 + objdir = Build/Obj/$(osbuilddir)/$(build_dir)/ + native_only = yes +- compiler = ${CROSS_COMPILE}gcc -o $(objdir) +- link = ${CROSS_COMPILE}g++ $(platform_linkflags) ++ compiler = ${CROSS_COMPILE}$(CC) -o $(objdir) ++ link = ${CROSS_COMPILE}$(CXX) $(platform_linkflags) + ar = ${CROSS_COMPILE}ar rc $(objdir) + endif + + ifeq ($(platform), Core-armv6) + # platform == Core2 + openhome_system = Core + openhome_architecture = armv6 + endian = LITTLE + platform_cflags = -mcpu=arm926ej-s -Wno-psabi + platform_linkflags = -mcpu=arm926ej-s ${CROSS_LINKFLAGS} + linkopts_ohNet = + osdir = Core + osbuilddir = Core-armv6 + objdir = Build/Obj/$(osbuilddir)/$(build_dir)/ + native_only = yes +- compiler = ${CROSS_COMPILE}gcc -o $(objdir) +- link = ${CROSS_COMPILE}g++ $(platform_linkflags) ++ compiler = ${CROSS_COMPILE}$(CC) -o $(objdir) ++ link = ${CROSS_COMPILE}$(CXX) $(platform_linkflags) + ar = ${CROSS_COMPILE}ar rc $(objdir) + endif + + ifneq (,$(findstring $(platform),Vanilla Qnap-x86 Qnap-x19 Linux-ppc32)) + ifeq ($(gcc4_1), yes) + version_specific_cflags = ${CROSS_COMPILE_CFLAGS} + version_specific_cflags_third_party = -Wno-non-virtual-dtor + version_specific_java_cflags = -Wstrict-aliasing=0 + else +- gcc_min_ver = $(shell ${CROSS_COMPILE}gcc -dumpversion | cut -f2 -d'.') +- version_specific_cflags = $(shell if [ $(gcc_min_ver) -ge 6 ]; then echo '-Wno-psabi'; fi) ++ version_specific_cflags = ++ ifeq ($(CC), gcc) ++ gcc_min_ver = $(shell ${CROSS_COMPILE}gcc -dumpversion | cut -f2 -d'.') ++ gcc_ge_6 = $(shell if [ $(gcc_min_ver) -ge 6 ]; then echo 'yes'; fi) ++ ifeq ($(gcc_ge_6), yes) ++ version_specific_cflags = '-Wno-psabi' ++ endif ++ endif + version_specific_cflags += ${CROSS_COMPILE_CFLAGS} + version_specific_cflags_third_party = + version_specific_java_cflags = + endif + + version_specific_linkflags = ${CROSS_COMPILE_LINKFLAGS} + version_specific_library_path = ${CROSS_COMPILE_LIBRARY_PATH} + version_specific_includes = ${CROSS_COMPILE_INCLUDES} + + # Continuing with the non-Darwin settings... + objdir = Build/Obj/$(osdir)/$(build_dir)/ +- compiler = ${CROSS_COMPILE}gcc -o $(objdir) +- link = $(version_specific_library_path) ${CROSS_COMPILE}g++ $(platform_linkflags) ++ compiler = ${CROSS_COMPILE}$(CC) -o $(objdir) ++ link = $(version_specific_library_path) ${CROSS_COMPILE}$(CXX) $(platform_linkflags) + ar = $(version_specific_library_path) ${CROSS_COMPILE}ar rc $(objdir) + endif + + ifeq ($(platform), FreeBSD) + platform_cflags = $(version_specific_cflags) -fPIC -DPLATFORM_FREEBSD + platform_linkflags = $(version_specific_linkflags) -pthread + linkopts_ohNet = -Wl,-soname,libohNet.so + osbuilddir = Posix + objdir = Build/Obj/$(osbuilddir)/$(build_dir)/ + osdir = Posix +@@ -351,25 +357,25 @@ $(info Building for system ${openhome_system} and architecture ${openhome_archit + + + # Macros used by Common.mak + native_only ?= no + managed_only ?= no + no_shared_objects ?= no + endian ?= LITTLE + cflags_base = $(CFLAGS) -fexceptions -Wall $(version_specific_cflags_third_party) -pipe -D_GNU_SOURCE -D_REENTRANT -DDEFINE_$(endian)_ENDIAN -DDEFINE_TRACE $(debug_specific_cflags) -fvisibility=hidden $(platform_cflags) + cflags_third_party = $(cflags_base) -Wno-int-to-pointer-cast + ifeq ($(nocpp11), yes) +- cppflags = $(cflags_base) -Werror ++ cppflags = $(CPPFLAGS) $(cflags_base) -Werror + else ifeq ($(platform),Mac) +- cppflags = $(cflags_base) -std=c++11 -Werror ++ cppflags = $(CPPFLAGS) $(cflags_base) -std=c++11 -Werror + else +- cppflags = $(cflags_base) -std=c++0x -Werror ++ cppflags = $(CPPFLAGS) $(cflags_base) -std=c++0x -Werror + endif + cflags = $(cflags_base) -Werror + inc_build = Build/Include + includes = -IBuild/Include/ $(version_specific_includes) + bundle_build = Build/Bundles + mDNSdir = Build/mDNS + osdir ?= Posix + objext = o + libprefix = lib + libext = a +@@ -383,21 +389,21 @@ else + endif + exeext = elf + linkoutput = -o + dllprefix = lib + ifeq ($(platform), iOS) + link_dll = $(toolroot)/clang++ -pthread -shared -stdlib=libc++ $(platform_linkflags) + else ifeq ($(MACHINE), Darwin) + link_dll = $(version_specific_library_path) clang++ -pthread $(platform_linkflags) -shared -stdlib=libc++ + else + CROSS_COMPILE_LIBGCC ?= -shared-libgcc +- link_dll = $(version_specific_library_path) ${CROSS_COMPILE}g++ -pthread $(platform_linkflags) -shared ${CROSS_COMPILE_LIBGCC} ++ link_dll = $(version_specific_library_path) ${CROSS_COMPILE}$(CXX) -pthread $(platform_linkflags) -shared ${CROSS_COMPILE_LIBGCC} + endif + + csharp = mcs /nologo $(debug_csharp) + + csharpdefines ?= + publicjavadir = OpenHome/Net/Bindings/Java/ + + ifeq ($(platform), Mac) + platform_java_cflags = -Wno-self-assign + # arm64 builds need JAVA_HOME to be set because the Mac SDK for arm64 doesn't contain Java includes or dylibs +@@ -409,24 +415,24 @@ ifeq ($(platform), Mac) + link_jvm = ${MACOSX_SDK}/System/Library/Frameworks/JavaVM.framework/JavaVM + endif + javac = /usr/bin/javac + jar = /usr/bin/jar + else + platform_java_cflags = + includes_jni = -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux + ifeq ($(platform), Linux-ppc32) + libjvm_dir ?= $(JAVA_HOME)/jre/lib/ppc/server + else +- ifneq (,$(findstring arm,$(gcc_machine))) ++ ifneq (,$(findstring arm,$(cc_machine))) + libjvm_dir ?= $(JAVA_HOME)/jre/lib/arm/server + else +- ifneq (,$(findstring x64,$(gcc_machine))) ++ ifneq (,$(findstring x64,$(cc_machine))) + libjvm_dir ?= $(JAVA_HOME)/jre/lib/amd64/server + else + libjvm_dir ?= $(JAVA_HOME)/jre/lib/i386/server + endif + endif + endif + link_jvm = $(libjvm_dir)/libjvm.so + javac = $(JAVA_HOME)/bin/javac + jar = $(JAVA_HOME)/bin/jar + endif diff --git a/recipes/ohnet/all/patches/0001-makefile-1.37.5454.patch b/recipes/ohnet/all/patches/0001-makefile-1.37.5454.patch new file mode 100644 index 0000000000000..b180a57e2d452 --- /dev/null +++ b/recipes/ohnet/all/patches/0001-makefile-1.37.5454.patch @@ -0,0 +1,336 @@ +diff --git a/Makefile b/Makefile +index 2f0cb07c..372a6765 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,44 +1,44 @@ + #Makefile for linux + # Could be extended to support Mac in future + + rsync ?= yes + + ifeq ($(rsync),yes) + cp = rsync -u + else +-cp = cp -u ++cp = cp + endif + + ifeq ($(debug),1) + debug_specific_cflags = -g -O0 + debug_csharp = /define:DEBUG /debug+ + build_dir = Debug + openhome_configuration = Debug + android_ndk_debug = 1 + else + debug_specific_cflags = -g -O2 + debug_csharp = /optimize+ /debug:pdbonly + build_dir = Release + openhome_configuration = Release + android_ndk_debug=0 + endif + + + + # Figure out platform, openhome_system and openhome_architecture + +-gcc_machine = $(shell ${CROSS_COMPILE}gcc -dumpmachine) ++cc_machine = $(shell ${CROSS_COMPILE}$(CC) -dumpmachine) + MACHINE = $(shell uname -s) + + $(info CROSS_COMPILE: ${CROSS_COMPILE}) +-$(info Machine reported by compiler is: ${gcc_machine}) ++$(info Machine reported by compiler is: ${cc_machine}) + $(info Machine reported by uname is: ${MACHINE}) + $(info PLATFORM: ${PLATFORM}) + + ifeq ($(MACHINE),Darwin) + ifeq ($(iOs-arm64),1) + platform = iOS + detected_openhome_system = iOs + detected_openhome_architecture = arm64 + else ifeq ($(iOs-x64),1) + platform = iOS +@@ -50,88 +50,88 @@ ifeq ($(MACHINE),Darwin) + detected_openhome_architecture = rpi + else + platform = Mac + detected_openhome_system = Mac + ifeq ($(Mac-arm64),1) + detected_openhome_architecture = arm64 + else + detected_openhome_architecture = x64 + endif + endif +-else ifneq (, $(findstring powerpc, $(gcc_machine))) ++else ifneq (, $(findstring powerpc, $(cc_machine))) + platform = Core-ppc32 + detected_openhome_system = Core + detected_openhome_architecture = ppc32 + else ifeq ($(Android-anycpu), 1) + platform = Android + detected_openhome_system = Android + detected_openhome_architecture = anycpu + else ifeq ($(freebsd), 1) + platform = FreeBSD + detected_openhome_system = FreeBSD + detected_openhome_architecture = x86 +- compiler = gcc -o $(objdir) +- link = ${CROSS_COMPILE}g++ $(platform_linkflags) ++ compiler = $(CC) -o $(objdir) ++ link = ${CROSS_COMPILE}$(CXX) $(platform_linkflags) + ar = ${CROSS_COMPILE}ar rc $(objdir) + else ifneq (,$(findstring Linux-x86,${PLATFORM})) +- ifneq (,$(findstring x86_64,$(gcc_machine))) ++ ifneq (,$(findstring x86_64,$(cc_machine))) + platform = Vanilla + detected_openhome_system = Linux + detected_openhome_architecture = x86 + CFLAGS = -m32 + LDFLAGS = -m32 + endif + else + # At present, platform == Vanilla is used for Kirkwood, x86 and x64 Posix builds. + platform ?= Vanilla + ifneq (,$(findstring Qnap,$(platform))) + detected_openhome_system = Qnap +- else ifneq (,$(findstring linux,$(gcc_machine))) ++ else ifneq (,$(findstring linux,$(cc_machine))) + detected_openhome_system = Linux + endif +- ifneq (,$(findstring arm,$(gcc_machine))) +- ifneq (,$(findstring linux-gnueabihf,$(gcc_machine))) ++ ifneq (,$(findstring arm,$(cc_machine))) ++ ifneq (,$(findstring linux-gnueabihf,$(cc_machine))) + detected_openhome_architecture = armhf + else ifeq (${detected_openhome_system},Qnap) + detected_openhome_architecture = x19 + else + detected_openhome_architecture = armel + endif + endif +- ifneq (,$(findstring i686,$(gcc_machine))) ++ ifneq (,$(findstring i686,$(cc_machine))) + detected_openhome_architecture = x86 + endif +- ifneq (,$(findstring i586,$(gcc_machine))) ++ ifneq (,$(findstring i586,$(cc_machine))) + detected_openhome_architecture = x86 + endif +- ifneq (,$(findstring i486,$(gcc_machine))) ++ ifneq (,$(findstring i486,$(cc_machine))) + detected_openhome_architecture = x86 + endif +- ifneq (,$(findstring i386,$(gcc_machine))) ++ ifneq (,$(findstring i386,$(cc_machine))) + detected_openhome_architecture = x86 + endif +- ifneq (,$(findstring amd64,$(gcc_machine))) ++ ifneq (,$(findstring amd64,$(cc_machine))) + detected_openhome_architecture = x64 + endif +- ifneq (,$(findstring x86_64,$(gcc_machine))) ++ ifneq (,$(findstring x86_64,$(cc_machine))) + detected_openhome_architecture = x64 + endif +- ifneq (,$(findstring mipsel,$(gcc_machine))) ++ ifneq (,$(findstring mipsel,$(cc_machine))) + detected_openhome_architecture = mipsel + endif +- ifneq (,$(findstring mips,$(gcc_machine))) ++ ifneq (,$(findstring mips,$(cc_machine))) + detected_openhome_architecture = mipsel + endif +- ifneq (,$(findstring aarch64,$(gcc_machine))) ++ ifneq (,$(findstring aarch64,$(cc_machine))) + detected_openhome_architecture = arm64 + endif +- ifneq (,$(findstring riscv64,$(gcc_machine))) ++ ifneq (,$(findstring riscv64,$(cc_machine))) + detected_openhome_architecture = riscv64 + endif + endif + + detected_openhome_system ?= Unknown + detected_openhome_architecture ?= Unknown + + ifneq (${openhome_system},) + ifneq (${openhome_system},${detected_openhome_system}) + $(warning Detected compiler is for system ${detected_openhome_system} but expected ${openhome_system}. Build will probably fail.) +@@ -208,83 +208,89 @@ ifeq ($(platform),Mac) + openhome_architecture = x64 + else + # building for arm64 + platform_cflags = -DPLATFORM_MACOSX_GNU -arch arm64 -mmacosx-version-min=11 + platform_linkflags = -arch arm64 -framework CoreFoundation -framework SystemConfiguration -framework IOKit + osbuilddir = Mac-arm64 + openhome_architecture = arm64 + endif + + objdir = Build/Obj/$(osbuilddir)/$(build_dir)/ +- compiler = clang -fPIC -stdlib=libc++ -o $(objdir) ++ compiler = clang -fPIC -Qunused-arguments -stdlib=libc++ -o $(objdir) + link = clang++ -pthread -stdlib=libc++ $(platform_linkflags) + ar = ar rc $(objdir) + openhome_system = Mac + + dotnetRuntime = osx-x64 + endif + + ifeq ($(platform), Core-ppc32) + # platform == Core1 + openhome_system = Core + openhome_architecture = ppc32 + endian = BIG + platform_cflags = -mcpu=405 + platform_linkflags = -mcpu=405 ${CROSS_LINKFLAGS} + linkopts_ohNet = + osdir = Core + osbuilddir = Core-ppc32 + objdir = Build/Obj/$(osbuilddir)/$(build_dir)/ + native_only = yes +- compiler = ${CROSS_COMPILE}gcc -o $(objdir) +- link = ${CROSS_COMPILE}g++ $(platform_linkflags) ++ compiler = ${CROSS_COMPILE}$(CC) -o $(objdir) ++ link = ${CROSS_COMPILE}$(CXX) $(platform_linkflags) + ar = ${CROSS_COMPILE}ar rc $(objdir) + endif + + ifeq ($(platform), Core-armv6) + # platform == Core2 + openhome_system = Core + openhome_architecture = armv6 + endian = LITTLE + platform_cflags = -mcpu=arm926ej-s -Wno-psabi + platform_linkflags = -mcpu=arm926ej-s ${CROSS_LINKFLAGS} + linkopts_ohNet = + osdir = Core + osbuilddir = Core-armv6 + objdir = Build/Obj/$(osbuilddir)/$(build_dir)/ + native_only = yes +- compiler = ${CROSS_COMPILE}gcc -o $(objdir) +- link = ${CROSS_COMPILE}g++ $(platform_linkflags) ++ compiler = ${CROSS_COMPILE}$(CC) -o $(objdir) ++ link = ${CROSS_COMPILE}$(CXX) $(platform_linkflags) + ar = ${CROSS_COMPILE}ar rc $(objdir) + endif + + ifneq (,$(findstring $(platform),Vanilla Qnap-x86 Qnap-x19 Linux-ppc32)) + ifeq ($(gcc4_1), yes) + version_specific_cflags = ${CROSS_COMPILE_CFLAGS} + version_specific_cflags_third_party = -Wno-non-virtual-dtor + version_specific_java_cflags = -Wstrict-aliasing=0 + else +- gcc_min_ver = $(shell ${CROSS_COMPILE}gcc -dumpversion | cut -f2 -d'.') +- version_specific_cflags = $(shell if [ $(gcc_min_ver) -ge 6 ]; then echo '-Wno-psabi'; fi) ++ version_specific_cflags = ++ ifeq ($(CC), gcc) ++ gcc_min_ver = $(shell ${CROSS_COMPILE}gcc -dumpversion | cut -f2 -d'.') ++ gcc_ge_6 = $(shell if [ $(gcc_min_ver) -ge 6 ]; then echo 'yes'; fi) ++ ifeq ($(gcc_ge_6), yes) ++ version_specific_cflags = '-Wno-psabi' ++ endif ++ endif + version_specific_cflags += ${CROSS_COMPILE_CFLAGS} + version_specific_cflags_third_party = + version_specific_java_cflags = + endif + + version_specific_linkflags = ${CROSS_COMPILE_LINKFLAGS} + version_specific_library_path = ${CROSS_COMPILE_LIBRARY_PATH} + version_specific_includes = ${CROSS_COMPILE_INCLUDES} + + # Continuing with the non-Darwin settings... + objdir = Build/Obj/$(osdir)/$(build_dir)/ +- compiler = ${CROSS_COMPILE}gcc -o $(objdir) +- link = $(version_specific_library_path) ${CROSS_COMPILE}g++ $(platform_linkflags) ++ compiler = ${CROSS_COMPILE}$(CC) -o $(objdir) ++ link = $(version_specific_library_path) ${CROSS_COMPILE}$(CXX) $(platform_linkflags) + ar = $(version_specific_library_path) ${CROSS_COMPILE}ar rc $(objdir) + endif + + ifeq ($(platform), FreeBSD) + platform_cflags = $(version_specific_cflags) -fPIC -DPLATFORM_FREEBSD + platform_linkflags = $(version_specific_linkflags) -pthread + linkopts_ohNet = -Wl,-soname,libohNet.so + osbuilddir = Posix + objdir = Build/Obj/$(osbuilddir)/$(build_dir)/ + osdir = Posix +@@ -351,25 +357,25 @@ $(info Building for system ${openhome_system} and architecture ${openhome_archit + + + # Macros used by Common.mak + native_only ?= no + managed_only ?= no + no_shared_objects ?= no + endian ?= LITTLE + cflags_base = $(CFLAGS) -fexceptions -Wall $(version_specific_cflags_third_party) -pipe -D_GNU_SOURCE -D_REENTRANT -DDEFINE_$(endian)_ENDIAN -DDEFINE_TRACE $(debug_specific_cflags) -fvisibility=hidden $(platform_cflags) + cflags_third_party = $(cflags_base) -Wno-int-to-pointer-cast + ifeq ($(nocpp11), yes) +- cppflags = $(cflags_base) -Werror ++ cppflags = $(CPPFLAGS) $(cflags_base) -Werror + else ifeq ($(platform),Mac) +- cppflags = $(cflags_base) -std=c++11 -Werror ++ cppflags = $(CPPFLAGS) $(cflags_base) -std=c++11 -Werror + else +- cppflags = $(cflags_base) -std=c++0x -Werror ++ cppflags = $(CPPFLAGS) $(cflags_base) -std=c++0x -Werror + endif + cflags = $(cflags_base) -Werror + inc_build = Build/Include + includes = -IBuild/Include/ $(version_specific_includes) + bundle_build = Build/Bundles + mDNSdir = Build/mDNS + osdir ?= Posix + objext = o + libprefix = lib + libext = a +@@ -383,21 +389,21 @@ else + endif + exeext = elf + linkoutput = -o + dllprefix = lib + ifeq ($(platform), iOS) + link_dll = $(toolroot)/clang++ -pthread -shared -stdlib=libc++ $(platform_linkflags) + else ifeq ($(MACHINE), Darwin) + link_dll = $(version_specific_library_path) clang++ -pthread $(platform_linkflags) -shared -stdlib=libc++ + else + CROSS_COMPILE_LIBGCC ?= -shared-libgcc +- link_dll = $(version_specific_library_path) ${CROSS_COMPILE}g++ -pthread $(platform_linkflags) -shared ${CROSS_COMPILE_LIBGCC} ++ link_dll = $(version_specific_library_path) ${CROSS_COMPILE}$(CXX) -pthread $(platform_linkflags) -shared ${CROSS_COMPILE_LIBGCC} + endif + + csharp = mcs /nologo $(debug_csharp) + + csharpdefines ?= + publicjavadir = OpenHome/Net/Bindings/Java/ + + ifeq ($(platform), Mac) + platform_java_cflags = -Wno-self-assign + # arm64 builds need JAVA_HOME to be set because the Mac SDK for arm64 doesn't contain Java includes or dylibs +@@ -409,24 +415,24 @@ ifeq ($(platform), Mac) + link_jvm = ${MACOSX_SDK}/System/Library/Frameworks/JavaVM.framework/JavaVM + endif + javac = /usr/bin/javac + jar = /usr/bin/jar + else + platform_java_cflags = + includes_jni = -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux + ifeq ($(platform), Linux-ppc32) + libjvm_dir ?= $(JAVA_HOME)/jre/lib/ppc/server + else +- ifneq (,$(findstring arm,$(gcc_machine))) ++ ifneq (,$(findstring arm,$(cc_machine))) + libjvm_dir ?= $(JAVA_HOME)/jre/lib/arm/server + else +- ifneq (,$(findstring x64,$(gcc_machine))) ++ ifneq (,$(findstring x64,$(cc_machine))) + libjvm_dir ?= $(JAVA_HOME)/jre/lib/amd64/server + else + libjvm_dir ?= $(JAVA_HOME)/jre/lib/i386/server + endif + endif + endif + link_jvm = $(libjvm_dir)/libjvm.so + javac = $(JAVA_HOME)/bin/javac + jar = $(JAVA_HOME)/bin/jar + endif diff --git a/recipes/ohnet/all/patches/0001-makefile-universal.patch b/recipes/ohnet/all/patches/0001-makefile-universal.patch new file mode 100644 index 0000000000000..487c6aa0a79e2 --- /dev/null +++ b/recipes/ohnet/all/patches/0001-makefile-universal.patch @@ -0,0 +1,220 @@ +diff --git a/Common.mak b/Common.mak +index a479b12a..82e5db60 100644 +--- a/Common.mak ++++ b/Common.mak +@@ -386,7 +386,7 @@ $(objdir)dnssd_clientshim.$(objext) : $(mDNSdir)/dnssd_clientshim.c $(headers) + $(objdir)dnssd_clientlib.$(objext) : $(mDNSdir)/dnssd_clientlib.c $(headers) + $(compiler)dnssd_clientlib.$(objext) -c $(cflags_third_party) $(includes) $(mDNSdir)/dnssd_clientlib.c + $(objdir)MdnsPlatform.$(objext) : OpenHome/Net/Device/Bonjour/MdnsPlatform.cpp $(headers) +- $(compiler)MdnsPlatform.$(objext) -c $(cflags_third_party) $(includes) OpenHome/Net/Device/Bonjour/MdnsPlatform.cpp ++ $(compiler)MdnsPlatform.$(objext) -c $(cppflags) $(cflags_third_party) $(includes) OpenHome/Net/Device/Bonjour/MdnsPlatform.cpp + $(objdir)MdnsProvider.$(objext) : OpenHome/Net/Device/Bonjour/MdnsProvider.cpp $(headers) + $(compiler)MdnsProvider.$(objext) -c $(cppflags) $(includes) OpenHome/Net/Device/Bonjour/MdnsProvider.cpp + $(objdir)Md5.$(objext) : OpenHome/md5.c $(headers) +diff --git a/Makefile b/Makefile +index 2f0cb07c..7b73494d 100644 +--- a/Makefile ++++ b/Makefile +@@ -6,7 +6,7 @@ rsync ?= yes + ifeq ($(rsync),yes) + cp = rsync -u + else +-cp = cp -u ++cp = cp + endif + + ifeq ($(debug),1) +@@ -27,11 +27,11 @@ endif + + # Figure out platform, openhome_system and openhome_architecture + +-gcc_machine = $(shell ${CROSS_COMPILE}gcc -dumpmachine) ++cc_machine = $(shell ${CROSS_COMPILE}$(CC) -dumpmachine) + MACHINE = $(shell uname -s) + + $(info CROSS_COMPILE: ${CROSS_COMPILE}) +-$(info Machine reported by compiler is: ${gcc_machine}) ++$(info Machine reported by compiler is: ${cc_machine}) + $(info Machine reported by uname is: ${MACHINE}) + $(info PLATFORM: ${PLATFORM}) + +@@ -57,7 +57,7 @@ ifeq ($(MACHINE),Darwin) + detected_openhome_architecture = x64 + endif + endif +-else ifneq (, $(findstring powerpc, $(gcc_machine))) ++else ifneq (, $(findstring powerpc, $(cc_machine))) + platform = Core-ppc32 + detected_openhome_system = Core + detected_openhome_architecture = ppc32 +@@ -69,11 +69,11 @@ else ifeq ($(freebsd), 1) + platform = FreeBSD + detected_openhome_system = FreeBSD + detected_openhome_architecture = x86 +- compiler = gcc -o $(objdir) +- link = ${CROSS_COMPILE}g++ $(platform_linkflags) ++ compiler = $(CC) -o $(objdir) ++ link = ${CROSS_COMPILE}$(CXX) $(platform_linkflags) + ar = ${CROSS_COMPILE}ar rc $(objdir) + else ifneq (,$(findstring Linux-x86,${PLATFORM})) +- ifneq (,$(findstring x86_64,$(gcc_machine))) ++ ifneq (,$(findstring x86_64,$(cc_machine))) + platform = Vanilla + detected_openhome_system = Linux + detected_openhome_architecture = x86 +@@ -85,11 +85,11 @@ else + platform ?= Vanilla + ifneq (,$(findstring Qnap,$(platform))) + detected_openhome_system = Qnap +- else ifneq (,$(findstring linux,$(gcc_machine))) ++ else ifneq (,$(findstring linux,$(cc_machine))) + detected_openhome_system = Linux + endif +- ifneq (,$(findstring arm,$(gcc_machine))) +- ifneq (,$(findstring linux-gnueabihf,$(gcc_machine))) ++ ifneq (,$(findstring arm,$(cc_machine))) ++ ifneq (,$(findstring linux-gnueabihf,$(cc_machine))) + detected_openhome_architecture = armhf + else ifeq (${detected_openhome_system},Qnap) + detected_openhome_architecture = x19 +@@ -97,34 +97,34 @@ else + detected_openhome_architecture = armel + endif + endif +- ifneq (,$(findstring i686,$(gcc_machine))) ++ ifneq (,$(findstring i686,$(cc_machine))) + detected_openhome_architecture = x86 + endif +- ifneq (,$(findstring i586,$(gcc_machine))) ++ ifneq (,$(findstring i586,$(cc_machine))) + detected_openhome_architecture = x86 + endif +- ifneq (,$(findstring i486,$(gcc_machine))) ++ ifneq (,$(findstring i486,$(cc_machine))) + detected_openhome_architecture = x86 + endif +- ifneq (,$(findstring i386,$(gcc_machine))) ++ ifneq (,$(findstring i386,$(cc_machine))) + detected_openhome_architecture = x86 + endif +- ifneq (,$(findstring amd64,$(gcc_machine))) ++ ifneq (,$(findstring amd64,$(cc_machine))) + detected_openhome_architecture = x64 + endif +- ifneq (,$(findstring x86_64,$(gcc_machine))) ++ ifneq (,$(findstring x86_64,$(cc_machine))) + detected_openhome_architecture = x64 + endif +- ifneq (,$(findstring mipsel,$(gcc_machine))) ++ ifneq (,$(findstring mipsel,$(cc_machine))) + detected_openhome_architecture = mipsel + endif +- ifneq (,$(findstring mips,$(gcc_machine))) ++ ifneq (,$(findstring mips,$(cc_machine))) + detected_openhome_architecture = mipsel + endif +- ifneq (,$(findstring aarch64,$(gcc_machine))) ++ ifneq (,$(findstring aarch64,$(cc_machine))) + detected_openhome_architecture = arm64 + endif +- ifneq (,$(findstring riscv64,$(gcc_machine))) ++ ifneq (,$(findstring riscv64,$(cc_machine))) + detected_openhome_architecture = riscv64 + endif + endif +@@ -215,7 +215,7 @@ ifeq ($(platform),Mac) + endif + + objdir = Build/Obj/$(osbuilddir)/$(build_dir)/ +- compiler = clang -fPIC -stdlib=libc++ -o $(objdir) ++ compiler = clang -fPIC -Qunused-arguments -stdlib=libc++ -o $(objdir) + link = clang++ -pthread -stdlib=libc++ $(platform_linkflags) + ar = ar rc $(objdir) + openhome_system = Mac +@@ -235,8 +235,8 @@ ifeq ($(platform), Core-ppc32) + osbuilddir = Core-ppc32 + objdir = Build/Obj/$(osbuilddir)/$(build_dir)/ + native_only = yes +- compiler = ${CROSS_COMPILE}gcc -o $(objdir) +- link = ${CROSS_COMPILE}g++ $(platform_linkflags) ++ compiler = ${CROSS_COMPILE}$(CC) -o $(objdir) ++ link = ${CROSS_COMPILE}$(CXX) $(platform_linkflags) + ar = ${CROSS_COMPILE}ar rc $(objdir) + endif + +@@ -252,8 +252,8 @@ ifeq ($(platform), Core-armv6) + osbuilddir = Core-armv6 + objdir = Build/Obj/$(osbuilddir)/$(build_dir)/ + native_only = yes +- compiler = ${CROSS_COMPILE}gcc -o $(objdir) +- link = ${CROSS_COMPILE}g++ $(platform_linkflags) ++ compiler = ${CROSS_COMPILE}$(CC) -o $(objdir) ++ link = ${CROSS_COMPILE}$(CXX) $(platform_linkflags) + ar = ${CROSS_COMPILE}ar rc $(objdir) + endif + +@@ -263,8 +263,14 @@ ifneq (,$(findstring $(platform),Vanilla Qnap-x86 Qnap-x19 Linux-ppc32)) + version_specific_cflags_third_party = -Wno-non-virtual-dtor + version_specific_java_cflags = -Wstrict-aliasing=0 + else +- gcc_min_ver = $(shell ${CROSS_COMPILE}gcc -dumpversion | cut -f2 -d'.') +- version_specific_cflags = $(shell if [ $(gcc_min_ver) -ge 6 ]; then echo '-Wno-psabi'; fi) ++ version_specific_cflags = ++ ifeq ($(CC), gcc) ++ gcc_min_ver = $(shell ${CROSS_COMPILE}gcc -dumpversion | cut -f2 -d'.') ++ gcc_ge_6 = $(shell if [ $(gcc_min_ver) -ge 6 ]; then echo 'yes'; fi) ++ ifeq ($(gcc_ge_6), yes) ++ version_specific_cflags = '-Wno-psabi' ++ endif ++ endif + version_specific_cflags += ${CROSS_COMPILE_CFLAGS} + version_specific_cflags_third_party = + version_specific_java_cflags = +@@ -276,8 +282,8 @@ ifneq (,$(findstring $(platform),Vanilla Qnap-x86 Qnap-x19 Linux-ppc32)) + + # Continuing with the non-Darwin settings... + objdir = Build/Obj/$(osdir)/$(build_dir)/ +- compiler = ${CROSS_COMPILE}gcc -o $(objdir) +- link = $(version_specific_library_path) ${CROSS_COMPILE}g++ $(platform_linkflags) ++ compiler = ${CROSS_COMPILE}$(CC) -o $(objdir) ++ link = $(version_specific_library_path) ${CROSS_COMPILE}$(CXX) $(platform_linkflags) + ar = $(version_specific_library_path) ${CROSS_COMPILE}ar rc $(objdir) + endif + +@@ -358,11 +364,11 @@ endian ?= LITTLE + cflags_base = $(CFLAGS) -fexceptions -Wall $(version_specific_cflags_third_party) -pipe -D_GNU_SOURCE -D_REENTRANT -DDEFINE_$(endian)_ENDIAN -DDEFINE_TRACE $(debug_specific_cflags) -fvisibility=hidden $(platform_cflags) + cflags_third_party = $(cflags_base) -Wno-int-to-pointer-cast + ifeq ($(nocpp11), yes) +- cppflags = $(cflags_base) -Werror ++ cppflags = $(CPPFLAGS) $(cflags_base) -Werror + else ifeq ($(platform),Mac) +- cppflags = $(cflags_base) -std=c++11 -Werror ++ cppflags = $(CPPFLAGS) $(cflags_base) -std=c++11 -Werror + else +- cppflags = $(cflags_base) -std=c++0x -Werror ++ cppflags = $(CPPFLAGS) $(cflags_base) -std=c++0x -Werror + endif + cflags = $(cflags_base) -Werror + inc_build = Build/Include +@@ -390,7 +396,7 @@ else ifeq ($(MACHINE), Darwin) + link_dll = $(version_specific_library_path) clang++ -pthread $(platform_linkflags) -shared -stdlib=libc++ + else + CROSS_COMPILE_LIBGCC ?= -shared-libgcc +- link_dll = $(version_specific_library_path) ${CROSS_COMPILE}g++ -pthread $(platform_linkflags) -shared ${CROSS_COMPILE_LIBGCC} ++ link_dll = $(version_specific_library_path) ${CROSS_COMPILE}$(CXX) -pthread $(platform_linkflags) -shared ${CROSS_COMPILE_LIBGCC} + endif + + csharp = mcs /nologo $(debug_csharp) +@@ -416,10 +422,10 @@ else + ifeq ($(platform), Linux-ppc32) + libjvm_dir ?= $(JAVA_HOME)/jre/lib/ppc/server + else +- ifneq (,$(findstring arm,$(gcc_machine))) ++ ifneq (,$(findstring arm,$(cc_machine))) + libjvm_dir ?= $(JAVA_HOME)/jre/lib/arm/server + else +- ifneq (,$(findstring x64,$(gcc_machine))) ++ ifneq (,$(findstring x64,$(cc_machine))) + libjvm_dir ?= $(JAVA_HOME)/jre/lib/amd64/server + else + libjvm_dir ?= $(JAVA_HOME)/jre/lib/i386/server diff --git a/recipes/ohnet/all/test_package/CMakeLists.txt b/recipes/ohnet/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..b864873d00282 --- /dev/null +++ b/recipes/ohnet/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) + +project(test_package CXX) + +find_package(ohNet REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PUBLIC ohNetCore) diff --git a/recipes/ohnet/all/test_package/conanfile.py b/recipes/ohnet/all/test_package/conanfile.py new file mode 100644 index 0000000000000..08478d9835129 --- /dev/null +++ b/recipes/ohnet/all/test_package/conanfile.py @@ -0,0 +1,29 @@ +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 build_requirements(self): + self.tool_requires("cmake/[>3.23 <4]") + + 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/ohnet/all/test_package/test_package.cpp b/recipes/ohnet/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..4d3ae89a2e2e0 --- /dev/null +++ b/recipes/ohnet/all/test_package/test_package.cpp @@ -0,0 +1,12 @@ +#include +#include + +using namespace OpenHome::Net; + +int main() +{ + InitialisationParams* initParams = InitialisationParams::Create(); + UpnpLibrary::InitialiseMinimal(initParams); + delete initParams; + UpnpLibrary::Close(); +} diff --git a/recipes/ohnet/config.yml b/recipes/ohnet/config.yml new file mode 100644 index 0000000000000..89da0e2089324 --- /dev/null +++ b/recipes/ohnet/config.yml @@ -0,0 +1,7 @@ +versions: + "1.36.5344": + folder: all + "1.36.5182": + folder: all + "1.37.5454": + folder: all diff --git a/recipes/ohpipeline/all/conandata.yml b/recipes/ohpipeline/all/conandata.yml new file mode 100644 index 0000000000000..a9fa8d1a7bd8f --- /dev/null +++ b/recipes/ohpipeline/all/conandata.yml @@ -0,0 +1,20 @@ +sources: + "1.139.1000": + source: + url: "https://github.com/openhome/ohPipeline/archive/refs/tags/ohMediaPlayer_1.139.1000.tar.gz" + sha256: "070eac6d974bbe520d0b292df1ca4a72160a2b607a60dabdaa0971c3ef96e5e4" + cmake: + url: "https://raw.githubusercontent.com/merakiacoustic/ohPipeline/ohMediaPlayer_1.139.1000_meraki3/CMakeLists.txt" + sha256: "4ebe83cf0419802f42d9d9c7ff36c666bd1094415eb29c77927273753019a202" + "1.155.1133": + source: + url: "https://github.com/openhome/ohPipeline/archive/refs/tags/ohMediaPlayer_1.155.1133.tar.gz" + sha256: "507bdf70fc6b9bf8e4605546a5c7ae99abbe537cce4b74b3e091764323939fae" + cmake: + url: "https://raw.githubusercontent.com/merakiacoustic/ohPipeline/ohMediaPlayer_1.155.1133_meraki2/CMakeLists.txt" + sha256: "0f8701552c2b3331edeedde4c3a1b8120dc419d493f6a2e05b21c9045729d6ff" +patches: + "1.139.1000": + - patch_file: "patches/0001-missing-include.patch" + patch_type: "portability" + patch_description: "Add a missing stdlib include" diff --git a/recipes/ohpipeline/all/conanfile.py b/recipes/ohpipeline/all/conanfile.py new file mode 100755 index 0000000000000..d2314dfa54789 --- /dev/null +++ b/recipes/ohpipeline/all/conanfile.py @@ -0,0 +1,129 @@ +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMakeDeps, CMakeToolchain, CMake, cmake_layout +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import copy, get, download, export_conandata_patches, apply_conandata_patches +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration +import os + +required_conan_version = ">=1.53.0" + + +class OhPipelineConan(ConanFile): + name = "ohpipeline" + description = "OpenHome audio pipeline" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/openhome/ohPipeline" + topics = ("openhome", "ohnet", "ohpipeline", "upnp") + + package_type = "static-library" + settings = "os", "arch", "compiler", "build_type" + options = { + "fPIC": [True, False], + } + default_options = { + "fPIC": True, + } + + @property + def _min_cppstd(self): + return 11 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "7", + } + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def export_sources(self): + export_conandata_patches(self) + + def build_requirements(self): + self.tool_requires("cmake/[>3.23 <4]") + + def requirements(self): + self.requires("ohnet/1.37.5454", transitive_headers=True, transitive_libs=True) + self.requires("openssl/[>=1.1 <4]") + self.requires("libmad/0.15.1b") + self.requires("alac/cci.20121212") + self.requires("libfdk_aac/2.0.3") + self.requires("faac/1.30") + self.requires("flac/1.4.3") + self.requires("ogg/1.3.5") + self.requires("vorbis/1.3.7") + + def layout(self): + cmake_layout(self, src_folder="src") + + 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." + ) + + def generate(self): + venv = VirtualBuildEnv(self) + venv.generate() + tc = CMakeToolchain(self) + tc.generate() + deps = CMakeDeps(self) + deps.generate() + + def source(self): + get(self, **self.conan_data["sources"][self.version]["source"], strip_root=True) + download(self, **self.conan_data["sources"][self.version]["cmake"], filename="CMakeLists.txt") + + def build(self): + apply_conandata_patches(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")) + cmake = CMake(self) + cmake.install() + + def package_info(self): + self.cpp_info.libs = [ + "ohPipeline", + "ohMediaPlayer", + "Odp", + "SourcePlaylist", + "SourceRadio", + "SourceSongcast", + "SourceScd", + "SourceRaop", + "SourceUpnpAv", + "Podcast", + "ScdSender", + "CodecWav", + "CodecPcm", + "CodecDsdDsf", + "CodecDsdDff", + "CodecDsdRaw", + "CodecAiffBase", + "CodecAifc", + "CodecAiff", + "CodecFlac", + "CodecAlacAppleBase", + "CodecAlacApple", + "CodecAacFdkBase", + "CodecAacFdkMp4", + "CodecAacFdkAdts", + "CodecMp3", + "CodecVorbis", + "WebAppFramework", + "WebAppFrameworkTestUtils", + "ConfigUi", + "ConfigUiTestUtils", + ] diff --git a/recipes/ohpipeline/all/patches/0001-missing-include.patch b/recipes/ohpipeline/all/patches/0001-missing-include.patch new file mode 100644 index 0000000000000..a6ff36f81a9fe --- /dev/null +++ b/recipes/ohpipeline/all/patches/0001-missing-include.patch @@ -0,0 +1,10 @@ +--- a/OpenHome/Media/Protocol/ProtocolHls.cpp ++++ b/OpenHome/Media/Protocol/ProtocolHls.cpp +@@ -18,6 +18,7 @@ + #include + + #include ++#include + + namespace OpenHome { + namespace Media { diff --git a/recipes/ohpipeline/all/test_package/CMakeLists.txt b/recipes/ohpipeline/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..bd868ecdf5a63 --- /dev/null +++ b/recipes/ohpipeline/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) + +project(test_package CXX) + +find_package(ohpipeline REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PUBLIC ohpipeline::ohpipeline) diff --git a/recipes/ohpipeline/all/test_package/conanfile.py b/recipes/ohpipeline/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fb96656f203 --- /dev/null +++ b/recipes/ohpipeline/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/ohpipeline/all/test_package/test_package.cpp b/recipes/ohpipeline/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..dce35f7c92826 --- /dev/null +++ b/recipes/ohpipeline/all/test_package/test_package.cpp @@ -0,0 +1,43 @@ +#include +#include +#include + +using namespace OpenHome; +using namespace OpenHome::Av; + +class RamStore : public IStaticDataSource +{ +public: + RamStore(const Brx& aImageFileName); + virtual ~RamStore(); +private: // from IStaticDataSource + void LoadStaticData(IStoreLoaderStatic& aLoader) override; +private: + Brhz iImageFileName; +}; + +RamStore::RamStore(const Brx& aImageFileName) + : iImageFileName(aImageFileName) +{ +} + +RamStore::~RamStore() {} + +void RamStore::LoadStaticData(IStoreLoaderStatic& aLoader) +{ + aLoader.AddStaticItem(StaticDataKey::kBufManufacturerName, "OpenHome"); + aLoader.AddStaticItem(StaticDataKey::kBufManufacturerInfo, "insert oh info here..."); + aLoader.AddStaticItem(StaticDataKey::kBufManufacturerUrl, "http://www.openhome.org"); + aLoader.AddStaticItem(StaticDataKey::kBufManufacturerImageUrl, "http://wiki.openhome.org/mediawiki/skins/openhome/images/logo.png"); + aLoader.AddStaticItem(StaticDataKey::kBufModelName, "OpenHome Media Player (test)"); + aLoader.AddStaticItem(StaticDataKey::kBufModelInfo, "Test implementation of ohMediaPlayer"); + aLoader.AddStaticItem(StaticDataKey::kBufModelUrl, "http://wiki.openhome.org/wiki/OhMedia"); + aLoader.AddStaticItem(StaticDataKey::kBufModelImageUrl, iImageFileName.CString()); +} + +int main() +{ + RamStore* ramStore = new RamStore(Brx::Empty()); + + delete ramStore; +} diff --git a/recipes/ohpipeline/config.yml b/recipes/ohpipeline/config.yml new file mode 100644 index 0000000000000..12fa634205705 --- /dev/null +++ b/recipes/ohpipeline/config.yml @@ -0,0 +1,5 @@ +versions: + "1.139.1000": + folder: all + "1.155.1133": + folder: all diff --git a/recipes/ois/all/CMakeLists.txt b/recipes/ois/all/CMakeLists.txt deleted file mode 100644 index cdeeef45d13c1..0000000000000 --- a/recipes/ois/all/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -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/ois/all/conandata.yml b/recipes/ois/all/conandata.yml index 0c7f109273e17..cad4b4f6daeb0 100644 --- a/recipes/ois/all/conandata.yml +++ b/recipes/ois/all/conandata.yml @@ -1,8 +1,11 @@ sources: + "1.5.1": + url: "https://github.com/wgois/OIS/archive/v1.5.1.tar.gz" + sha256: "614f6ef6d69cf6d84f1b50efff46a6c1acce426933e5f0dcf29862ea8332af73" "1.5": url: "https://github.com/wgois/OIS/archive/v1.5.tar.gz" sha256: "aa3e6b840b1149bb06835e04365957f4659c08b3e3095a48b289050f1637a174" patches: "1.5": - - patch_file: "patches/1.5/001_export_headers_from_CMAKE_CURRENT_SOURCE_DIR.patch" - base_path: "source_subfolder" + - patch_file: "patches/1.5-0001_export_headers_from_CMAKE_CURRENT_SOURCE_DIR.patch" + patch_type: "conan" diff --git a/recipes/ois/all/conanfile.py b/recipes/ois/all/conanfile.py index 53d83bec3c91b..3520d291b333d 100644 --- a/recipes/ois/all/conanfile.py +++ b/recipes/ois/all/conanfile.py @@ -1,17 +1,25 @@ import os import glob -from conans import ConanFile, tools, CMake -from conans.errors import ConanInvalidConfiguration +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, CMakeToolchain, cmake_layout + +required_conan_version = ">=1.53.0" + class OisConan(ConanFile): name = "ois" description = "Object oriented Input System." - topics = ("conan", "ois", "input" ) + topics = ("input system", "input" ) url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/wgois/OIS" license = "Zlib" - exports_sources = ["CMakeLists.txt", "patches/*"] - generators = "cmake" + package_type = "library" settings = "os", "compiler", "build_type", "arch" options = { "shared": [True, False], @@ -22,19 +30,12 @@ class OisConan(ConanFile): "fPIC": True, } - _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 requirements(self): - if self.settings.os == "Linux": - self.requires("xorg/system") + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -42,48 +43,59 @@ def config_options(self): 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]) - extracted_dir = "OIS-{}".format(self.version) - os.rename(extracted_dir, self._source_subfolder) + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + if self.settings.os == "Linux": + self.requires("xorg/system") - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["OIS_BUILD_SHARED_LIBS"] = self.options.shared - self._cmake.definitions["OIS_BUILD_DEMOS"] = False - self._cmake.configure(build_folder=self._build_subfolder) + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) - 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["OIS_BUILD_SHARED_LIBS"] = self.options.shared + tc.variables["OIS_BUILD_DEMOS"] = 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.md", src=os.path.join(self.source_folder, 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")) for pdb_file in glob.glob(os.path.join(self.package_folder, "bin", "*.pdb")): os.unlink(pdb_file) def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = collect_libs(self) - self.cpp_info.names["pkg_config"] = "OIS" - self.cpp_info.names["cmake_find_package"] = "OIS" - self.cpp_info.names["cmake_find_package_multi"] = "OIS" + self.cpp_info.set_property("pkg_config_name", "OIS") if self.settings.os == "Macos": - self.cpp_info.frameworks = ["Foundation", "Cocoa", "IOKit"] + self.cpp_info.frameworks = ["Foundation", "Cocoa", "IOKit", "AppKit", "CoreFoundation", "CoreGraphics"] elif self.settings.os == "Windows": self.cpp_info.defines = ["OIS_WIN32_XINPUT_SUPPORT"] self.cpp_info.system_libs = ["dinput8", "dxguid"] if self.options.shared: self.cpp_info.defines.append("OIS_DYNAMIC_LIB") + elif self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs = ["m"] + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.names["cmake_find_package"] = "OIS" + self.cpp_info.names["cmake_find_package_multi"] = "OIS" diff --git a/recipes/ois/all/patches/1.5/001_export_headers_from_CMAKE_CURRENT_SOURCE_DIR.patch b/recipes/ois/all/patches/1.5-0001_export_headers_from_CMAKE_CURRENT_SOURCE_DIR.patch similarity index 100% rename from recipes/ois/all/patches/1.5/001_export_headers_from_CMAKE_CURRENT_SOURCE_DIR.patch rename to recipes/ois/all/patches/1.5-0001_export_headers_from_CMAKE_CURRENT_SOURCE_DIR.patch diff --git a/recipes/ois/all/test_package/CMakeLists.txt b/recipes/ois/all/test_package/CMakeLists.txt index 196188113685c..6704daeed1834 100644 --- a/recipes/ois/all/test_package/CMakeLists.txt +++ b/recipes/ois/all/test_package/CMakeLists.txt @@ -1,8 +1,8 @@ -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() +find_package(ois REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE ois::ois) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/ois/all/test_package/conanfile.py b/recipes/ois/all/test_package/conanfile.py index bd7165a553cf4..3a91c9439218e 100644 --- a/recipes/ois/all/test_package/conanfile.py +++ b/recipes/ois/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/ois/config.yml b/recipes/ois/config.yml index 289ff2f2a0c3c..1ce6b25b9dda7 100644 --- a/recipes/ois/config.yml +++ b/recipes/ois/config.yml @@ -1,3 +1,5 @@ versions: + "1.5.1": + folder: all "1.5": folder: all diff --git a/recipes/onedpl/all/conandata.yml b/recipes/onedpl/all/conandata.yml index 991993ba67d6e..9e43f2c338c1b 100644 --- a/recipes/onedpl/all/conandata.yml +++ b/recipes/onedpl/all/conandata.yml @@ -1,10 +1,10 @@ sources: + "2022.3.0": + url: "https://github.com/oneapi-src/oneDPL/archive/refs/tags/oneDPL-2022.3.0-rc1.tar.gz" + sha256: "8ada85fc95255d08024ea3fda778a138a3b2efdbeb52468a4bdd08eb04254aa6" "2021.7.0": url: "https://github.com/oneapi-src/oneDPL/archive/refs/tags/oneDPL-2021.7.0-release.tar.gz" sha256: "5484c6de482790206d877a4947dcef6e0a1e082dbfa5c6a5362e18072c4a3de3" "2021.6.1": url: "https://github.com/oneapi-src/oneDPL/archive/refs/tags/oneDPL-2021.6.1-release.tar.gz" sha256: "4995fe2ed2724b89cdb52c4b6c9af22e146b48d2561abdafdaaa06262dbd67c4" - "20200330": - url: "https://github.com/oneapi-src/oneDPL/archive/20200330.tar.gz" - sha256: "3e040f6afdb200229dd58be2cf2a5f1613872f254231b18de2942aaf7e39ae2d" diff --git a/recipes/onedpl/all/conanfile.py b/recipes/onedpl/all/conanfile.py index 26d62f2265887..519736b1d8a3c 100644 --- a/recipes/onedpl/all/conanfile.py +++ b/recipes/onedpl/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.microsoft import is_msvc from conan.tools.scm import Version import os @@ -18,6 +20,8 @@ class OneDplConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/oneapi-src/oneDPL" topics = ("stl", "parallelism") + + package_type = "header-library" settings = "os", "arch", "build_type", "compiler" options = { "backend": ["tbb", "serial"], @@ -27,42 +31,64 @@ class OneDplConan(ConanFile): } no_copy_source = True + @property + def _min_cppstd(self): + if Version(self.version) < "2021.7.0": + return 11 + return 17 + + @property + def _compilers_minimum_version(self): + if Version(self.version) < "2021.7.0": + return {} + return { + "gcc": "7", + "clang": "6", + "apple-clang": "10", + "Visual Studio": "15", + "msvc": "191", + } + + def layout(self): + basic_layout(self, src_folder="src") + def requirements(self): if self.options.backend == "tbb": - self.requires("onetbb/2020.3") + self.requires("onetbb/2021.10.0") def package_id(self): self.info.clear() def validate(self): - if self.settings.compiler.get_safe("cppstd"): - if Version(self.version) >= "2021.7.0": - check_min_cppstd(self, 17) - else: - check_min_cppstd(self, 11) + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) - def layout(self): - basic_layout(self, src_folder="src") + 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.get_safe("compiler.libcxx") == "libstdc++": + # https://stackoverflow.com/a/67924408/2997179 + raise ConanInvalidConfiguration("libstdc++ is not supported") + + if "2021.7" <= Version(self.version) < "2022" and is_msvc(self): + raise ConanInvalidConfiguration(f"MSVC is not supported for {self.version} due to " + "std::unary_function and std::binary_function being used") def source(self): - get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=self.source_folder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): - version_major = int(str(Version(self.version).major)[0:4]) copy(self, "*", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) - if version_major < 2021: - copy(self, "*", src=os.path.join(self.source_folder, "stdlib"), dst=os.path.join(self.package_folder, "include")) - copy(self, "LICENSE.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) - else: - copy(self, "LICENSE.txt", src=os.path.join(self.source_folder, "licensing"), dst=os.path.join(self.package_folder, "licenses")) + copy(self, "LICENSE.txt", src=os.path.join(self.source_folder, "licensing"), dst=os.path.join(self.package_folder, "licenses")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "ParallelSTL") self.cpp_info.set_property("cmake_target_name", "pstl::ParallelSTL") 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"] = "ParallelSTL" @@ -72,5 +98,7 @@ def package_info(self): self.cpp_info.components["_onedpl"].names["cmake_find_package"] = "ParallelSTL" self.cpp_info.components["_onedpl"].names["cmake_find_package_multi"] = "ParallelSTL" self.cpp_info.components["_onedpl"].set_property("cmake_target_name", "pstl::ParallelSTL") + self.cpp_info.components["_onedpl"].bindirs = [] + self.cpp_info.components["_onedpl"].libdirs = [] if self.options.backend == "tbb": self.cpp_info.components["_onedpl"].requires = ["onetbb::onetbb"] diff --git a/recipes/onedpl/all/test_package/CMakeLists.txt b/recipes/onedpl/all/test_package/CMakeLists.txt index ae285797ed88a..cad3204918869 100644 --- a/recipes/onedpl/all/test_package/CMakeLists.txt +++ b/recipes/onedpl/all/test_package/CMakeLists.txt @@ -1,9 +1,12 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) find_package(ParallelSTL REQUIRED CONFIG) -message(STATUS "OneDPL test version: ${ONEDPL_VERSION_MAJOR}") -add_executable(${PROJECT_NAME} test_package.${ONEDPL_VERSION_MAJOR}.cpp) +add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE pstl::ParallelSTL) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +if (ParallelSTL_VERSION VERSION_GREATER_EQUAL "2021.7") + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +else() + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +endif() diff --git a/recipes/onedpl/all/test_package/conanfile.py b/recipes/onedpl/all/test_package/conanfile.py index 5d2f30da145a9..db11bba8a6d83 100644 --- a/recipes/onedpl/all/test_package/conanfile.py +++ b/recipes/onedpl/all/test_package/conanfile.py @@ -1,24 +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.scm import Version 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", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" def layout(self): cmake_layout(self) - def generate(self): - tc = CMakeToolchain(self) - tc.variables["ONEDPL_VERSION_MAJOR"] = str(Version(self.dependencies["onedpl"].ref.version).major)[0:4] - tc.generate() + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -26,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/onedpl/all/test_package/test_package.2020.cpp b/recipes/onedpl/all/test_package/test_package.2020.cpp deleted file mode 100644 index 3af6b2f8d8648..0000000000000 --- a/recipes/onedpl/all/test_package/test_package.2020.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include -#include - -int main() -{ - std::vector data(10000000); - std::fill_n(pstl::execution::par_unseq, data.begin(), data.size(), -1); - - return 0; -} diff --git a/recipes/onedpl/all/test_package/test_package.2021.cpp b/recipes/onedpl/all/test_package/test_package.cpp similarity index 100% rename from recipes/onedpl/all/test_package/test_package.2021.cpp rename to recipes/onedpl/all/test_package/test_package.cpp diff --git a/recipes/onedpl/all/test_v1_package/CMakeLists.txt b/recipes/onedpl/all/test_v1_package/CMakeLists.txt index b8bcdb29cc801..91630d79f4abb 100644 --- a/recipes/onedpl/all/test_v1_package/CMakeLists.txt +++ b/recipes/onedpl/all/test_v1_package/CMakeLists.txt @@ -1,12 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package CXX) +cmake_minimum_required(VERSION 3.15) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(ParallelSTL REQUIRED CONFIG) - -message(STATUS "OneDPL test version: ${ONEDPL_VERSION_MAJOR}") -add_executable(${PROJECT_NAME} ../test_package/test_package.${ONEDPL_VERSION_MAJOR}.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE pstl::ParallelSTL) -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/onedpl/all/test_v1_package/conanfile.py b/recipes/onedpl/all/test_v1_package/conanfile.py index 7982514ebc4f8..38f4483872d47 100644 --- a/recipes/onedpl/all/test_v1_package/conanfile.py +++ b/recipes/onedpl/all/test_v1_package/conanfile.py @@ -8,7 +8,6 @@ class TestPackageConan(ConanFile): def build(self): cmake = CMake(self) - cmake.definitions["ONEDPL_VERSION_MAJOR"] = tools.Version(self.deps_cpp_info["onedpl"].version).major[0:4] cmake.configure() cmake.build() diff --git a/recipes/onedpl/config.yml b/recipes/onedpl/config.yml index 24b37db7f2bf3..3d474c4d1d440 100644 --- a/recipes/onedpl/config.yml +++ b/recipes/onedpl/config.yml @@ -1,7 +1,7 @@ versions: - "20200330": - folder: all - "2021.6.1": + "2022.3.0": folder: all "2021.7.0": folder: all + "2021.6.1": + folder: all diff --git a/recipes/onetbb/2020.x/conandata.yml b/recipes/onetbb/2020.x/conandata.yml index de98a3aa2d71d..bca751ad9a8a8 100644 --- a/recipes/onetbb/2020.x/conandata.yml +++ b/recipes/onetbb/2020.x/conandata.yml @@ -1,4 +1,7 @@ sources: + "2020.3.3": + url: "https://github.com/oneapi-src/oneTBB/archive/v2020.3.3.tar.gz" + sha256: "494ac15f60e91d95ed7aec04f4e1d389b8a55bffc581d0fe9116b99336401963" "2020.3": url: "https://github.com/oneapi-src/oneTBB/archive/v2020.3.tar.gz" sha256: "ebc4f6aa47972daed1f7bf71d100ae5bf6931c2e3144cf299c8cc7d041dca2f3" diff --git a/recipes/onetbb/2020.x/conanfile.py b/recipes/onetbb/2020.x/conanfile.py index 0fd823e9ffd15..3975cf2c1c8b6 100644 --- a/recipes/onetbb/2020.x/conanfile.py +++ b/recipes/onetbb/2020.x/conanfile.py @@ -1,27 +1,34 @@ -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 re import textwrap +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.files import chdir, copy, get, replace_in_file, save +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.intel import IntelCC +from conan.tools.layout import basic_layout +from conan.tools.microsoft import VCVars, msvs_toolset, msvc_runtime_flag, is_msvc +from conan.tools.scm import Version + required_conan_version = ">=1.53.0" class OneTBBConan(ConanFile): name = "onetbb" - license = "Apache-2.0" - url = "https://github.com/conan-io/conan-center-index" - homepage = "https://github.com/oneapi-src/oneTBB" description = ( "oneAPI Threading Building Blocks (oneTBB) lets you easily write parallel " "C++ programs that take full advantage of multicore performance, that " "are portable, composable and have future-proof scalability." ) + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/oneapi-src/oneTBB" topics = ("tbb", "threading", "parallelism", "tbbmalloc") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -36,18 +43,10 @@ class OneTBBConan(ConanFile): "tbbproxy": False, } - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _settings_build(self): return getattr(self, "settings_build", self.settings) - @property - def _is_clanglc(self): - return self.settings.os == "Windows" and self.settings.compiler == "clang" - @property def _base_compiler(self): base = self.settings.get_safe("compiler.base") @@ -55,6 +54,14 @@ def _base_compiler(self): return self.settings.compiler.base return self.settings.compiler + @property + def _is_msvc(self): + return str(self._base_compiler) in ["Visual Studio", "msvc"] + + @property + def _is_clang_cl(self): + return self.settings.os == "Windows" and self.settings.compiler == "clang" + def config_options(self): if self.settings.os == "Windows": del self.options.fPIC @@ -63,51 +70,42 @@ def configure(self): if self.options.shared: self.options.rm_safe("fPIC") - def validate(self): - if self.settings.os == "Macos": - 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") - if self.options.tbbproxy and \ - (not self.options.shared or \ - not self.options.tbbmalloc): - raise ConanInvalidConfiguration("tbbproxy needs tbbmaloc and shared options") + def layout(self): + basic_layout(self, src_folder="src") def package_id(self): del self.info.options.tbbmalloc del self.info.options.tbbproxy + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) + if is_apple_os(self): + if self.settings.compiler == "apple-clang" and Version(self.settings.compiler.version) < "8.0": + raise ConanInvalidConfiguration(f"{self.name} {self.version} couldn't be built by apple-clang < 8.0") + if not self.options.shared: + self.output.warning("oneTBB strongly discourages usage of static linkage") + if self.options.tbbproxy and (not self.options.shared or not self.options.tbbmalloc): + raise ConanInvalidConfiguration("tbbproxy needs tbbmaloc and shared options") + def build_requirements(self): if self._settings_build.os == "Windows": - if "CONAN_MAKE_PROGRAM" not in os.environ and not legacy_tools.which("make"): - self.tool_requires("make/4.2.1") + if not self.conf_info.get("tools.gnu:make_program", check_type=str): + self.tool_requires("make/4.3") def source(self): - get(self, **self.conan_data["sources"][self.version], - strip_root=True, destination=self._source_subfolder) - - def build(self): - def add_flag(name, value): - if name in os.environ: - os.environ[name] += " " + value - else: - os.environ[name] = value - - # Get the version of the current compiler instead of gcc - linux_include = os.path.join(self._source_subfolder, "build", "linux.inc") - 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": - replace_in_file(self, os.path.join(self._source_subfolder, "Makefile"), "release", "debug") - - if str(self._base_compiler) in ["Visual Studio", "msvc"]: - save(self, - os.path.join(self._source_subfolder, "build", "big_iron_msvc.inc"), + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = AutotoolsToolchain(self) + if self._is_msvc: + link_cmd = "xilib" if self.settings.compiler == "intel-cc" else "lib" + save( + self, + os.path.join(self.source_folder, "build", "big_iron_msvc.inc"), # copy of big_iron.inc adapted for MSVC - textwrap.dedent("""\ - LIB_LINK_CMD = {}.exe + textwrap.dedent(f"""\ + LIB_LINK_CMD = {link_cmd}.exe LIB_OUTPUT_KEY = /OUT: LIB_LINK_FLAGS = LIB_LINK_LIBS = @@ -128,39 +126,39 @@ def add_flag(name, value): MALLOC_NO_VERSION.DLL = MALLOCPROXY.DLL = MALLOCPROXY.DEF = - """.format("xilib" if self.settings.compiler == "intel" else "lib")) + """), ) - extra = "" if self.options.shared else "extra_inc=big_iron_msvc.inc" + if not self.options.shared: + tc.make_args.append("extra_inc=big_iron_msvc.inc") else: - extra = "" if self.options.shared else "extra_inc=big_iron.inc" + if not self.options.shared: + tc.make_args.append("extra_inc=big_iron.inc") arch = { "x86": "ia32", "x86_64": "intel64", "armv7": "armv7", - "armv8": "arm64" - if (self.settings.os == "iOS" or self.settings.os == "Macos") - else "aarch64", + "armv8": "arm64" if is_apple_os(self) else "aarch64", }[str(self.settings.arch)] - extra += " arch=%s" % arch + tc.make_args.append(f"arch={arch}") if self.settings.os == "iOS": - extra += " target=ios" + tc.make_args.append("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++" + tc.make_args.append("stdlib=libstdc++") elif str(self._base_compiler.libcxx) == "libc++": - extra += " stdlib=libc++" + tc.make_args.append("stdlib=libc++") - if str(self.settings.compiler) == "intel": - extra += " compiler=icc" + if str(self.settings.compiler) == "intel-cc": + tc.make_args.append("compiler=icc") elif str(self.settings.compiler) in ("clang", "apple-clang"): - extra += " compiler=clang" + tc.make_args.append("compiler=clang") else: - extra += " compiler=gcc" + tc.make_args.append("compiler=gcc") - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: # runtime is supposed to track the version of the c++ stdlib, # the version of glibc, and the version of the linux kernel. # However, it isn't actually used anywhere other than for @@ -168,113 +166,123 @@ def add_flag(name, value): # TBB computes the value of this variable using gcc, which we # don't necessarily want to require when building this recipe. # Setting it to a dummy value prevents TBB from calling gcc. - extra += " runtime=gnu" - elif str(self._base_compiler) in ["Visual Studio", "msvc"]: + tc.make_args.append("runtime=gnu") + elif self._is_msvc: if "MT" in msvc_runtime_flag(self): runtime = "vc_mt" else: - if self.settings.compiler == "Visual Studio": - runtime = { - "8": "vc8", - "9": "vc9", - "10": "vc10", - "11": "vc11", - "12": "vc12", - "14": "vc14", - "15": "vc14.1", - "16": "vc14.2" - }.get(str(self._base_compiler.version), "vc14.2") + # Convert MSVC toolset to TBB runtime id + # v140 -> vc14, v141 -> vc14.1, etc + toolset = msvs_toolset(self) + m = re.fullmatch(r"v(\d+)(\d)", toolset) + if m: + runtime = f"vc{m[1]}" + (f".{m[2]}" if m[2] != "0" else "") else: - runtime = { - "190": "vc14", - "191": "vc14.1", - "192": "vc14.2" - }.get(str(self._base_compiler.version), "vc14.2") - extra += " runtime=%s" % runtime - - if self.settings.compiler == "intel": - extra += " compiler=icl" + self.output.warning(f"Unknown MSVC toolset: {toolset}") + runtime = "vc14.2" + tc.make_args.append(f"runtime={runtime}") + + if self.settings.compiler == "intel-cc": + tc.make_args.append("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 = 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 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 = legacy_tools.no_op() - if self.settings.compiler == "intel": - context = legacy_tools.intel_compilervars(self) - elif is_msvc(self): - # intentionally not using vcvars for clang-cl yet - context = legacy_tools.vcvars(self) - with context: - self.run("%s %s %s" % (make, extra, " ".join(targets))) + tc.make_args.append("compiler=cl") + elif self._is_clang_cl: + tc.extra_cflags.append("-mrtm") + tc.extra_cxxflags.append("-mrtm") + + tc.generate() + + if self.settings.compiler == "intel-cc": + intelcc = IntelCC(self) + intelcc.generate() + elif is_msvc(self): + # intentionally not using vcvars for clang-cl yet + vcvars = VCVars(self) + vcvars.generate() + + def _patch_sources(self): + # Fix LDFLAGS getting incorrectly applied to ar command + linux_include = os.path.join(self.source_folder, "build", "common_rules.inc") + replace_in_file(self, linux_include, "LIB_LINK_FLAGS += $(LDFLAGS)", "") + # Get the version of the current compiler instead of gcc + linux_include = os.path.join(self.source_folder, "build", "linux.inc") + 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": + replace_in_file(self, os.path.join(self.source_folder, "Makefile"), "release", "debug") + + def build(self): + self._patch_sources() + with chdir(self, self.source_folder): + autotools = Autotools(self) + for target in ["tbb", "tbbmalloc", "tbbproxy"]: + autotools.make(target) def package(self): - 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") + copy(self, "LICENSE", + 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, "*", + dst=os.path.join(self.package_folder, "include", "tbb", "compat"), + src=os.path.join(self.source_folder, "include", "tbb", "compat")) + + build_folder = os.path.join(self.source_folder, "build") build_type = "debug" if self.settings.build_type == "Debug" else "release" - 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) + for extension in ["lib", "a", "dylib"]: + copy(self, f"*{build_type}*.{extension}", + dst=os.path.join(self.package_folder, "lib"), + src=build_folder, keep_path=False) + copy(self, f"*{build_type}*.dll", + dst=os.path.join(self.package_folder, "bin"), + 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": - copy(self, f"*{build_type}*.dll", dst=os.path.join(self.package_folder, "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": + if self.settings.os in ["Linux", "FreeBSD"] and self.options.shared: extension = "so" - if self.options.shared: - 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") - 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) + copy(self, f"*{build_type}*.{extension}.*", + dst=os.path.join(self.package_folder, "lib"), + src=build_folder, keep_path=False) + # Create libtbb.so.2 -> libtbb.so, etc symlinks + with chdir(self, os.path.join(self.package_folder, "lib")): + for fname in os.listdir("."): + fname_without_version = fname.split(f".{extension}", 1)[0] + f".{extension}" + self.run(f'ln -s "{fname}" "{fname_without_version}"') def package_info(self): self.cpp_info.set_property("cmake_file_name", "TBB") + self.cpp_info.set_property("cmake_target_name", "TBB::TBB") suffix = "_debug" if self.settings.build_type == "Debug" else "" # tbb self.cpp_info.components["libtbb"].set_property("cmake_target_name", "TBB::tbb") - self.cpp_info.components["libtbb"].libs = ["tbb{}".format(suffix)] + self.cpp_info.components["libtbb"].libs = [f"tbb{suffix}"] if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.components["libtbb"].system_libs = ["dl", "rt", "pthread"] + self.cpp_info.components["libtbb"].system_libs = ["m", "dl", "rt", "pthread"] # tbbmalloc if self.options.tbbmalloc: self.cpp_info.components["tbbmalloc"].set_property("cmake_target_name", "TBB::tbbmalloc") - self.cpp_info.components["tbbmalloc"].libs = ["tbbmalloc{}".format(suffix)] + self.cpp_info.components["tbbmalloc"].libs = [f"tbbmalloc{suffix}"] if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.components["tbbmalloc"].system_libs = ["dl", "pthread"] + self.cpp_info.components["tbbmalloc"].system_libs = ["m", "dl", "pthread"] # tbbmalloc_proxy if self.options.tbbproxy: self.cpp_info.components["tbbmalloc_proxy"].set_property("cmake_target_name", "TBB::tbbmalloc_proxy") - self.cpp_info.components["tbbmalloc_proxy"].libs = ["tbbmalloc_proxy{}".format(suffix)] + self.cpp_info.components["tbbmalloc_proxy"].libs = [f"tbbmalloc_proxy{suffix}"] self.cpp_info.components["tbbmalloc_proxy"].requires = ["tbbmalloc"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["tbbmalloc_proxy"].system_libs = ["m"] # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.names["cmake_find_package"] = "TBB" diff --git a/recipes/onetbb/2020.x/test_package/CMakeLists.txt b/recipes/onetbb/2020.x/test_package/CMakeLists.txt index d5a40167452f4..2dd759c70dd11 100644 --- a/recipes/onetbb/2020.x/test_package/CMakeLists.txt +++ b/recipes/onetbb/2020.x/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(TBB REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/onetbb/2020.x/test_package/conanfile.py b/recipes/onetbb/2020.x/test_package/conanfile.py index 38f4483872d47..ef5d7042163ec 100644 --- a/recipes/onetbb/2020.x/test_package/conanfile.py +++ b/recipes/onetbb/2020.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_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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/onetbb/2020.x/test_v1_package/CMakeLists.txt b/recipes/onetbb/2020.x/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/onetbb/2020.x/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/onetbb/2020.x/test_v1_package/conanfile.py b/recipes/onetbb/2020.x/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/onetbb/2020.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/onetbb/all/conandata.yml b/recipes/onetbb/all/conandata.yml index 8b78e00c51454..d6288f698e49a 100644 --- a/recipes/onetbb/all/conandata.yml +++ b/recipes/onetbb/all/conandata.yml @@ -1,4 +1,16 @@ sources: + "2021.12.0": + url: "https://github.com/oneapi-src/oneTBB/archive/refs/tags/v2021.12.0.tar.gz" + sha256: "c7bb7aa69c254d91b8f0041a71c5bcc3936acb64408a1719aec0b2b7639dd84f" + "2021.10.0": + url: "https://github.com/oneapi-src/oneTBB/archive/refs/tags/v2021.10.0.tar.gz" + sha256: "487023a955e5a3cc6d3a0d5f89179f9b6c0ae7222613a7185b0227ba0c83700b" + "2021.9.0": + url: "https://github.com/oneapi-src/oneTBB/archive/refs/tags/v2021.9.0.tar.gz" + sha256: "1ce48f34dada7837f510735ff1172f6e2c261b09460e3bf773b49791d247d24e" + "2021.8.0": + url: "https://github.com/oneapi-src/oneTBB/archive/refs/tags/v2021.8.0.tar.gz" + sha256: "eee380323bb7ce864355ed9431f85c43955faaae9e9bce35c62b372d7ffd9f8b" "2021.7.0": url: "https://github.com/oneapi-src/oneTBB/archive/refs/tags/v2021.7.0.tar.gz" sha256: "2cae2a80cda7d45dc7c072e4295c675fff5ad8316691f26f40539f7e7e54c0cc" @@ -9,13 +21,29 @@ sources: url: "https://github.com/oneapi-src/oneTBB/archive/v2021.3.0.tar.gz" sha256: "8f616561603695bbb83871875d2c6051ea28f8187dbe59299961369904d1d49e" patches: + "2021.8.0": + - patch_description: "fix building for android with NDK >= 25" + patch_type: "portability" + patch_source: "https://github.com/oneapi-src/oneTBB/pull/953.patch" + patch_file: "patches/android-ndk25.patch" + "2021.7.0": + - patch_description: "fix building for android with NDK >= 25" + patch_type: "portability" + patch_source: "https://github.com/oneapi-src/oneTBB/pull/953.patch" + patch_file: "patches/android-ndk25.patch" "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_type: "portability" 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_type: "portability" patch_source: "https://github.com/oneapi-src/oneTBB/pull/716.diff" patch_file: "patches/fix-overeager-stripping-of-compile-flag.diff" + - patch_description: "Use pkg_search_module with IMPORTED_TARGET" + patch_type: "portability" + patch_source: + - "https://github.com/oneapi-src/oneTBB/pull/448.diff" + - "https://github.com/oneapi-src/oneTBB/commit/df3096075a00942acbdd3ce9347f5298cc153fd6.diff" + patch_file: "patches/pkg-search-module-use-imported-target.diff" diff --git a/recipes/onetbb/all/conanfile.py b/recipes/onetbb/all/conanfile.py index 240acbbc36f0d..1d40fac290ce1 100644 --- a/recipes/onetbb/all/conanfile.py +++ b/recipes/onetbb/all/conanfile.py @@ -1,13 +1,16 @@ 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.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, export_conandata_patches, copy, get, load, rmdir +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, export_conandata_patches, copy, get, load, rmdir, rm +from conan.tools.gnu import PkgConfigDeps from conan.tools.scm import Version import os import re -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class OneTBBConan(ConanFile): @@ -20,85 +23,122 @@ class OneTBBConan(ConanFile): " programs that take full advantage of multicore performance, that are portable, composable" " and have future-proof scalability.") topics = ("tbb", "threading", "parallelism", "tbbmalloc") - + package_type = "shared-library" settings = "os", "arch", "compiler", "build_type" options = { - "shared": [True, False], - "fPIC": [True, False], "tbbmalloc": [True, False], "tbbproxy": [True, False], + "tbbbind": [True, False], "interprocedural_optimization": [True, False], } default_options = { - "shared": True, - "fPIC": True, - "tbbmalloc": False, - "tbbproxy": False, + "tbbmalloc": True, + "tbbproxy": True, + "tbbbind": True, "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 + @property + def _has_tbbmalloc(self): + return Version(self.version) < "2021.5.0" or self.options.get_safe("tbbmalloc") + + @property + def _has_tbbproxy(self): + return Version(self.version) < "2021.6.0" or self.options.get_safe("tbbproxy") + + @property + def _tbbbind_hwloc_version(self): + # TBB expects different variables depending on the version + return "2_5" if Version(self.version) >= "2021.4.0" else "2_4" + + @property + def _tbbbind_supported(self): + if is_apple_os(self): + return self.settings.os == "Macos" and Version(self.version) >= "2021.11.0" + return True + + @property + def _tbbbind_build(self): + return self.options.get_safe("tbbbind", False) and self._tbbbind_supported + + @property + def _tbbbind_explicit_hwloc(self): + # during cross-compilation, oneTBB does not search for HWLOC and we need to specify it explicitly + # but then oneTBB creates an imported SHARED target from provided paths, so we have to set shared=True + return self._tbbbind_build and cross_building(self) 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): + def config_options(self): + if Version(self.version) < "2021.5.0": + del self.options.tbbmalloc if Version(self.version) < "2021.6.0": - del self.info.options.tbbmalloc - del self.info.options.tbbproxy + del self.options.tbbproxy + if not self._tbbbind_supported: + del self.options.tbbbind + if Version(self.version) < "2021.6.0" or self.settings.os == "Android": + del self.options.interprocedural_optimization - def validate(self): - if (is_apple_os(self) - and self.settings.compiler == "apple-clang" - and Version(self.settings.compiler.version) < "11.0"): - raise ConanInvalidConfiguration( - "{} {} couldn't be built by apple-clang < 11.0".format( - self.name, - 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 - and not (self.options.tbbmalloc - and self.options.get_safe("shared", True))): - raise ConanInvalidConfiguration( - "tbbproxy needs tbbmalloc and shared options") + def configure(self): + if Version(self.version) >= "2021.6.0" and not self.options.tbbmalloc: + self.options.rm_safe("tbbproxy") def layout(self): cmake_layout(self, src_folder="src") + def requirements(self): + if self._tbbbind_build: + self.requires("hwloc/2.9.3") + + def validate(self): + if self.settings.compiler == "apple-clang" and Version(self.settings.compiler.version) < "11.0": + raise ConanInvalidConfiguration(f"{self.ref} couldn't be built by apple-clang < 11.0") + + # Old versions used to have shared option before hwloc dependency was moved to shared only + if self._tbbbind_explicit_hwloc and not self.dependencies["hwloc"].options.get_safe("shared", True): + raise ConanInvalidConfiguration(f"{self.ref} requires hwloc:shared=True to be built.") + + def build_requirements(self): + if self._tbbbind_build and not self._tbbbind_explicit_hwloc: + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/2.1.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() + toolchain = CMakeToolchain(self) toolchain.variables["TBB_TEST"] = False toolchain.variables["TBB_STRICT"] = False - if Version(self.version) >= "2021.6.0": + if Version(self.version) >= "2021.5.0": toolchain.variables["TBBMALLOC_BUILD"] = self.options.tbbmalloc + if self.options.get_safe("interprocedural_optimization"): + toolchain.variables["TBB_ENABLE_IPO"] = self.options.interprocedural_optimization + if Version(self.version) >= "2021.6.0" and self.options.get_safe("tbbmalloc"): toolchain.variables["TBBMALLOC_PROXY_BUILD"] = self.options.tbbproxy - toolchain.variables["TBB_ENABLE_IPO"] = self.options.get_safe("interprocedural_optimization", False) + toolchain.variables["TBB_DISABLE_HWLOC_AUTOMATIC_SEARCH"] = not self._tbbbind_build + if self._tbbbind_explicit_hwloc: + hwloc_package_folder = self.dependencies["hwloc"].package_folder + hwloc_lib_name = ("hwloc.lib" if self.settings.os == "Windows" else + "libhwloc.dylib" if self.settings.os == "Macos" else + "libhwloc.so") + toolchain.variables[f"CMAKE_HWLOC_{self._tbbbind_hwloc_version}_LIBRARY_PATH"] = \ + os.path.join(hwloc_package_folder, "lib", hwloc_lib_name).replace("\\", "/") + toolchain.variables[f"CMAKE_HWLOC_{self._tbbbind_hwloc_version}_INCLUDE_PATH"] = \ + os.path.join(hwloc_package_folder, "include").replace("\\", "/") + if self.settings.os == "Windows": + toolchain.variables[f"CMAKE_HWLOC_{self._tbbbind_hwloc_version}_DLL_PATH"] = \ + os.path.join(hwloc_package_folder, "bin", "hwloc.dll").replace("\\", "/") toolchain.generate() + if self._tbbbind_build and not self._tbbbind_explicit_hwloc: + deps = PkgConfigDeps(self) + deps.generate() + def build(self): apply_conandata_patches(self) cmake = CMake(self) @@ -112,10 +152,12 @@ 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, "share")) + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "TBB") self.cpp_info.set_property("pkg_config_name", "tbb") + self.cpp_info.set_property("cmake_config_version_compat", "AnyNewerVersion") def lib_name(name): if self.settings.build_type == "Debug": @@ -138,12 +180,12 @@ def lib_name(name): version_info, flags=re.MULTILINE | re.DOTALL, ) - tbb.libs.append(lib_name("tbb{}".format(binary_version))) + tbb.libs.append(lib_name(f"tbb{binary_version}")) if self.settings.os in ["Linux", "FreeBSD"]: tbb.system_libs = ["m", "dl", "rt", "pthread"] # tbbmalloc - if self.options.tbbmalloc: + if self._has_tbbmalloc: tbbmalloc = self.cpp_info.components["tbbmalloc"] tbbmalloc.set_property("cmake_target_name", "TBB::tbbmalloc") @@ -152,7 +194,7 @@ def lib_name(name): tbbmalloc.system_libs = ["dl", "pthread"] # tbbmalloc_proxy - if self.options.tbbproxy: + if self._has_tbbproxy: tbbproxy = self.cpp_info.components["tbbmalloc_proxy"] tbbproxy.set_property("cmake_target_name", "TBB::tbbmalloc_proxy") diff --git a/recipes/onetbb/all/patches/android-ndk25.patch b/recipes/onetbb/all/patches/android-ndk25.patch new file mode 100644 index 0000000000000..4b3cad08432b9 --- /dev/null +++ b/recipes/onetbb/all/patches/android-ndk25.patch @@ -0,0 +1,46 @@ +From 4ce5d767df83ac4396eef4964c6df6c3dcfef234 Mon Sep 17 00:00:00 2001 +From: Dmitry Kurtaev +Date: Fri, 4 Nov 2022 09:33:33 +0300 +Subject: [PATCH] Fixes for Android NDK 25 + +Signed-off-by: Dmitry Kurtaev +--- + CMakeLists.txt | 25 +++++++++++++++++++++---- + 1 file changed, 21 insertions(+), 4 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 9b8bb7c8be..6c479fe4dc 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -279,10 +279,27 @@ endif() + + if (ANDROID_PLATFORM) + if ("${ANDROID_STL}" STREQUAL "c++_shared") +- configure_file( +- "${ANDROID_NDK}/sources/cxx-stl/llvm-libc++/libs/${ANDROID_ABI}/libc++_shared.so" +- "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libc++_shared.so" +- COPYONLY) ++ if (${ANDROID_NDK_MAJOR} GREATER_EQUAL "25") ++ if(ANDROID_ABI STREQUAL "arm64-v8a") ++ set(ANDROID_TOOLCHAIN_NAME "aarch64-linux-android") ++ elseif(ANDROID_ABI STREQUAL "x86_64") ++ set(ANDROID_TOOLCHAIN_NAME "x86_64-linux-android") ++ elseif(ANDROID_ABI STREQUAL "armeabi-v7a") ++ set(ANDROID_TOOLCHAIN_NAME "arm-linux-androideabi") ++ elseif(ANDROID_ABI STREQUAL "x86") ++ set(ANDROID_TOOLCHAIN_NAME "i686-linux-android") ++ endif() ++ ++ configure_file( ++ "${ANDROID_TOOLCHAIN_ROOT}/sysroot/usr/lib/${ANDROID_TOOLCHAIN_NAME}/libc++_shared.so" ++ "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libc++_shared.so" ++ COPYONLY) ++ else() ++ configure_file( ++ "${ANDROID_NDK}/sources/cxx-stl/llvm-libc++/libs/${ANDROID_ABI}/libc++_shared.so" ++ "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libc++_shared.so" ++ COPYONLY) ++ endif() + endif() + # This custom target may be implemented without separate CMake script, but it requires + # ADB(Android Debug Bridge) executable file availability, so to incapsulate this requirement diff --git a/recipes/onetbb/all/patches/pkg-search-module-use-imported-target.diff b/recipes/onetbb/all/patches/pkg-search-module-use-imported-target.diff new file mode 100644 index 0000000000000..e1a3505708cba --- /dev/null +++ b/recipes/onetbb/all/patches/pkg-search-module-use-imported-target.diff @@ -0,0 +1,97 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 34a23d40..d569d57e 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -100,6 +100,8 @@ option(TBB_NO_APPCONTAINER "Apply /APPCONTAINER:NO (for testing binaries for Win + option(TBB4PY_BUILD "Enable tbb4py build" OFF) + option(TBB_CPF "Enable preview features of the library" OFF) + option(TBB_FIND_PACKAGE "Enable search for external oneTBB using find_package instead of build from sources" OFF) ++option(TBB_DISABLE_HWLOC_AUTOMATIC_SEARCH "Disable HWLOC automatic search by pkg-config tool" OFF) ++ + + if (NOT DEFINED BUILD_SHARED_LIBS) + set(BUILD_SHARED_LIBS ON) +@@ -194,7 +196,7 @@ else() + if (NOT "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "mips") + add_subdirectory(src/tbbmalloc) + add_subdirectory(src/tbbmalloc_proxy) +- if (APPLE) ++ if (APPLE OR NOT BUILD_SHARED_LIBS) + message(STATUS "TBBBind build target is disabled due to unsupported environment") + else() + add_subdirectory(src/tbbbind) +diff --git a/cmake/hwloc_detection.cmake b/cmake/hwloc_detection.cmake +index f1740662..e1806a0f 100644 +--- a/cmake/hwloc_detection.cmake ++++ b/cmake/hwloc_detection.cmake +@@ -45,11 +45,15 @@ endforeach() + + unset(HWLOC_TARGET_NAME) + +-if (NOT HWLOC_TARGET_EXPLICITLY_DEFINED) ++if (NOT HWLOC_TARGET_EXPLICITLY_DEFINED AND ++ # No hwloc auto detection for cross compilation ++ NOT CMAKE_CROSSCOMPILING AND ++ NOT TBB_DISABLE_HWLOC_AUTOMATIC_SEARCH ++) + find_package(PkgConfig QUIET) +- if (PKG_CONFIG_FOUND) +- pkg_search_module(HWLOC hwloc) +- if (HWLOC_FOUND) ++ if (PKG_CONFIG_FOUND AND NOT CMAKE_VERSION VERSION_LESS 3.6) ++ pkg_search_module(HWLOC hwloc IMPORTED_TARGET) ++ if (TARGET PkgConfig::HWLOC) + if (HWLOC_VERSION VERSION_LESS 2) + set(TBBBIND_LIBRARY_NAME tbbbind) + elseif(HWLOC_VERSION VERSION_LESS 2.4) +@@ -60,4 +64,3 @@ if (NOT HWLOC_TARGET_EXPLICITLY_DEFINED) + endif() + endif() + endif() +- +diff --git a/src/tbbbind/CMakeLists.txt b/src/tbbbind/CMakeLists.txt +index da9dabfe..1a4c6ca0 100644 +--- a/src/tbbbind/CMakeLists.txt ++++ b/src/tbbbind/CMakeLists.txt +@@ -18,12 +18,13 @@ endif() + set(CMAKE_SKIP_BUILD_RPATH TRUE) + + function(tbbbind_build TBBBIND_NAME REQUIRED_HWLOC_TARGET) +- if (NOT TARGET ${REQUIRED_HWLOC_TARGET} AND NOT DEFINED HWLOC_LIBRARIES) ++ if (NOT TARGET ${REQUIRED_HWLOC_TARGET}) + message(STATUS "HWLOC target ${REQUIRED_HWLOC_TARGET} doesn't exist." + " The ${TBBBIND_NAME} target cannot be created") + return() + endif() + add_library(${TBBBIND_NAME} tbb_bind.cpp) ++ + add_library(TBB::${TBBBIND_NAME} ALIAS ${TBBBIND_NAME}) + + target_compile_definitions(${TBBBIND_NAME} +@@ -64,14 +65,12 @@ function(tbbbind_build TBBBIND_NAME REQUIRED_HWLOC_TARGET) + PRIVATE + ${TBB_LIB_LINK_FLAGS} + ${TBB_COMMON_LINK_FLAGS} +- ${HWLOC_LIBRARY_DIRS} # pkg-config defined + ) + else() + target_link_libraries(${TBBBIND_NAME} + PRIVATE + ${TBB_LIB_LINK_FLAGS} + ${TBB_COMMON_LINK_FLAGS} +- ${HWLOC_LIBRARY_DIRS} # pkg-config defined + ) + endif() + +@@ -90,9 +89,9 @@ function(tbbbind_build TBBBIND_NAME REQUIRED_HWLOC_TARGET) + endif() + endfunction() + +-if (NOT DEFINED HWLOC_TARGET_EXPLICITLY_DEFINED AND DEFINED HWLOC_LIBRARIES) ++if (NOT DEFINED HWLOC_TARGET_EXPLICITLY_DEFINED AND TARGET PkgConfig::HWLOC) + message(STATUS "The ${TBBBIND_LIBRARY_NAME} target will be configured using the HWLOC ${HWLOC_VERSION}") +- tbbbind_build(${TBBBIND_LIBRARY_NAME} ${HWLOC_LIBRARIES}) ++ tbbbind_build(${TBBBIND_LIBRARY_NAME} PkgConfig::HWLOC) + else() + tbbbind_build(tbbbind HWLOC::hwloc_1_11) + tbbbind_build(tbbbind_2_0 HWLOC::hwloc_2 ) diff --git a/recipes/onetbb/all/test_package/CMakeLists.txt b/recipes/onetbb/all/test_package/CMakeLists.txt index f510136a26a97..fbae62535650c 100644 --- a/recipes/onetbb/all/test_package/CMakeLists.txt +++ b/recipes/onetbb/all/test_package/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.15) project(test_package LANGUAGES CXX) find_package(TBB REQUIRED CONFIG) diff --git a/recipes/onetbb/all/test_package/conanfile.py b/recipes/onetbb/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/onetbb/all/test_package/conanfile.py +++ b/recipes/onetbb/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/onetbb/all/test_v1_package/CMakeLists.txt b/recipes/onetbb/all/test_v1_package/CMakeLists.txt index 4daf7ea625bc3..b21cc49efde95 100644 --- a/recipes/onetbb/all/test_v1_package/CMakeLists.txt +++ b/recipes/onetbb/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.15) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(TBB REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE TBB::tbb) -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/onetbb/config.yml b/recipes/onetbb/config.yml index 20a58c634a9a6..4ef9dafa04d03 100644 --- a/recipes/onetbb/config.yml +++ b/recipes/onetbb/config.yml @@ -1,10 +1,20 @@ versions: + "2021.12.0": + folder: all + "2021.10.0": + folder: all + "2021.9.0": + folder: all + "2021.8.0": + folder: all "2021.7.0": folder: all "2021.6.0": folder: all "2021.3.0": folder: all + "2020.3.3": + folder: "2020.x" "2020.3": folder: "2020.x" "2020.2": diff --git a/recipes/oniguruma/all/conandata.yml b/recipes/oniguruma/all/conandata.yml index 1d4c5ee6c5192..d74493648d9a9 100644 --- a/recipes/oniguruma/all/conandata.yml +++ b/recipes/oniguruma/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "6.9.9": + url: "https://github.com/kkos/oniguruma/releases/download/v6.9.9/onig-6.9.9.tar.gz" + sha256: "60162bd3b9fc6f4886d4c7a07925ffd374167732f55dce8c491bfd9cd818a6cf" "6.9.8": url: "https://github.com/kkos/oniguruma/releases/download/v6.9.8/onig-6.9.8.tar.gz" sha256: "28cd62c1464623c7910565fb1ccaaa0104b2fe8b12bcd646e81f73b47535213e" 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/oniguruma/config.yml b/recipes/oniguruma/config.yml index 271aea5702065..9cf31a690977c 100644 --- a/recipes/oniguruma/config.yml +++ b/recipes/oniguruma/config.yml @@ -1,4 +1,6 @@ versions: + "6.9.9": + folder: all "6.9.8": folder: all "6.9.7.1": diff --git a/recipes/onnx/all/conandata.yml b/recipes/onnx/all/conandata.yml index 2ddba74f0fc3a..337aa98f505f5 100644 --- a/recipes/onnx/all/conandata.yml +++ b/recipes/onnx/all/conandata.yml @@ -1,24 +1,25 @@ sources: - "1.11.0": - url: "https://github.com/onnx/onnx/archive/refs/tags/v1.11.0.tar.gz" - sha256: "a20f2d9df805b16ac75ab4da0a230d3d1c304127d719e5c66a4e6df514e7f6c0" - "1.10.2": - url: "https://github.com/onnx/onnx/archive/refs/tags/v1.10.2.tar.gz" - sha256: "520b3aa34272cc215e2eb41385f58adf01750d88858d4722563edca8410c5dc9" - "1.9.0": - url: "https://github.com/onnx/onnx/archive/v1.9.0.tar.gz" - sha256: "61d459a5f30604cabec352574119a6685dfd43bfa757cfbff52be9471d5b8ea0" - "1.8.1": - url: "https://github.com/onnx/onnx/archive/v1.8.1.tar.gz" - sha256: "0054c7eeed97e8ee43921c3f944b0450782a081d910a14b3b6e662bc87065192" -patches: - "1.11.0": - - patch_file: "patches/0001-fix-concurrent-proto3-remove-1.11.0.patch" - "1.10.2": - - patch_file: "patches/0001-fix-concurrent-proto3-remove-1.9.0.patch" - "1.9.0": - - patch_file: "patches/0001-fix-concurrent-proto3-remove-1.9.0.patch" - - patch_file: "patches/0002-msvc-no-warnings-as-errors-1.9.0.patch" - "1.8.1": - - patch_file: "patches/0001-fix-concurrent-proto3-remove-1.8.1.patch" - - patch_file: "patches/0002-msvc-no-warnings-as-errors-1.8.1.patch" + "1.17.0": + url: "https://github.com/onnx/onnx/archive/v1.17.0.tar.gz" + sha256: "8d5e983c36037003615e5a02d36b18fc286541bf52de1a78f6cf9f32005a820e" + "1.16.2": + url: "https://github.com/onnx/onnx/archive/v1.16.2.tar.gz" + sha256: "84fc1c3d6133417f8a13af6643ed50983c91dacde5ffba16cc8bb39b22c2acbb" + "1.16.1": + url: "https://github.com/onnx/onnx/archive/v1.16.1.tar.gz" + sha256: "0e6aa2c0a59bb2d90858ad0040ea1807117cc2f05b97702170f18e6cd6b66fb3" + "1.16.0": + url: "https://github.com/onnx/onnx/archive/v1.16.0.tar.gz" + sha256: "0ce153e26ce2c00afca01c331a447d86fbf21b166b640551fe04258b4acfc6a4" + "1.15.0": + url: "https://github.com/onnx/onnx/archive/v1.15.0.tar.gz" + sha256: "c757132e018dd0dd171499ef74fca88b74c5430a20781ec53da19eb7f937ef68" + "1.14.1": + url: "https://github.com/onnx/onnx/archive/v1.14.1.tar.gz" + sha256: "e296f8867951fa6e71417a18f2e550a730550f8829bd35e947b4df5e3e777aa1" + "1.14.0": + url: "https://github.com/onnx/onnx/archive/v1.14.0.tar.gz" + sha256: "1b02ad523f79d83f9678c749d5a3f63f0bcd0934550d5e0d7b895f9a29320003" + "1.13.1": + url: "https://github.com/onnx/onnx/archive/refs/tags/v1.13.1.tar.gz" + sha256: "090d3e10ec662a98a2a72f1bf053f793efc645824f0d4b779e0ce47468a0890e" diff --git a/recipes/onnx/all/conanfile.py b/recipes/onnx/all/conanfile.py index 21814da896d45..ccffd47b97dce 100644 --- a/recipes/onnx/all/conanfile.py +++ b/recipes/onnx/all/conanfile.py @@ -1,15 +1,17 @@ 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.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 sys import textwrap -required_conan_version = ">=1.50.2 <1.51.0 || >=1.51.2" +required_conan_version = ">=1.60.0 <2.0 || >=2.0.5" class OnnxConan(ConanFile): @@ -20,74 +22,112 @@ 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], "fPIC": [True, False], + "disable_static_registration": [True, False], } default_options = { "shared": False, "fPIC": True, + "disable_static_registration": True, } @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" + def _is_legacy_one_profile(self): + return not hasattr(self, "settings_build") + + @property + def _min_cppstd(self): + if Version(self.version) >= "1.15.0": + return 17 + if Version(self.version) >= "1.13.0" and is_msvc(self): + return 17 + return 11 + + @property + def _compilers_minimum_version(self): + if Version(self.version) < "1.16.0": + return { + "Visual Studio": "15", + "msvc": "191", + "gcc": "7", + "clang": "5", + "apple-clang": "10", + } + # 1.16.0+ requires header available with gcc8+ + return { + "Visual Studio": "15", + "msvc": "191", + "gcc": "8", + "clang": "5", + "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": del self.options.fPIC def configure(self): - if self.options.shared: - del self.options.fPIC + if is_msvc(self): + del self.options.shared + self.package_type = "static-library" + if self.options.get_safe("shared"): + 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("protobuf/3.21.12", transitive_headers=True, transitive_libs=True) def validate(self): - if self.info.settings.compiler.cppstd: - check_min_cppstd(self, 11) - if is_msvc(self) and self.info.options.shared: - raise ConanInvalidConfiguration("onnx shared is broken with Visual Studio") + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + if self._min_cppstd > 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 build_requirements(self): - if hasattr(self, "settings_build"): - self.tool_requires(f"protobuf/{self._protobuf_version}") - - def layout(self): - cmake_layout(self, src_folder="src") + if not self._is_legacy_one_profile: + self.tool_requires("protobuf/") 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 self._is_legacy_one_profile: + 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 + # https://cmake.org/cmake/help/v3.28/module/FindPythonInterp.html + # https://github.com/onnx/onnx/blob/1014f41f17ecc778d63e760a994579d96ba471ff/CMakeLists.txt#L119C1-L119C50 + tc.variables["PYTHON_EXECUTABLE"] = sys.executable.replace("\\", "/") + 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 tc.variables["ONNX_COVERAGE"] = False tc.variables["ONNX_BUILD_TESTS"] = False - tc.variables["ONNX_USE_LITE_PROTO"] = False - tc.variables["ONNXIFI_ENABLE_EXT"] = False + tc.variables["ONNX_USE_LITE_PROTO"] = self.dependencies.host["protobuf"].options.lite tc.variables["ONNX_ML"] = True - tc.variables["ONNXIFI_DUMMY_BACKEND"] = False tc.variables["ONNX_VERIFY_PROTO3"] = Version(self.dependencies.host["protobuf"].ref.version).major == "3" if is_msvc(self): tc.variables["ONNX_USE_MSVC_STATIC_RUNTIME"] = is_msvc_static_runtime(self) + tc.variables["ONNX_DISABLE_STATIC_REGISTRATION"] = self.options.get_safe('disable_static_registration') tc.generate() deps = CMakeDeps(self) deps.generate() - env = VirtualBuildEnv(self) - env.generate() def build(self): apply_conandata_patches(self) @@ -100,6 +140,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( @@ -136,26 +177,9 @@ def _onnx_components(self): "libs": ["onnx_proto"], "defines": ["ONNX_NAMESPACE=onnx", "ONNX_ML=1"], "requires": ["protobuf::libprotobuf"] - }, - "onnxifi": { - "target": "onnxifi" - }, - "onnxifi_dummy": { - "target": "onnxifi_dummy", - "libs": ["onnxifi_dummy"], - "requires": ["onnxifi"] - }, - "onnxifi_loader": { - "target": "onnxifi_loader", - "libs": ["onnxifi_loader"], - "requires": ["onnxifi"] - }, - "onnxifi_wrapper": { - "target": "onnxifi_wrapper" } } - if Version(self.version) >= "1.11.0": - components["libonnx"]["defines"].append("__STDC_FORMAT_MACROS") + components["libonnx"]["defines"].append("__STDC_FORMAT_MACROS") return components def package_info(self): @@ -167,10 +191,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/patches/0001-fix-concurrent-proto3-remove-1.11.0.patch b/recipes/onnx/all/patches/0001-fix-concurrent-proto3-remove-1.11.0.patch deleted file mode 100644 index 5ecbd144c4919..0000000000000 --- a/recipes/onnx/all/patches/0001-fix-concurrent-proto3-remove-1.11.0.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/onnx/gen_proto.py -+++ b/onnx/gen_proto.py -@@ -165,7 +165,7 @@ def convert(stem, package_name, output, do_onnx_ml=False, lite=False, protoc_pat - porto3_dir = os.path.dirname(proto3) - base_dir = os.path.dirname(porto3_dir) - gen_proto3_code(protoc_path, proto3, base_dir, base_dir, base_dir) -- pb3_files = glob.glob(os.path.join(porto3_dir, '*.proto3.*')) -+ pb3_files = glob.glob(os.path.join(porto3_dir, '{}.proto3.*'.format(proto_base))) - for pb3_file in pb3_files: - print("Removing {}".format(pb3_file)) - os.remove(pb3_file) diff --git a/recipes/onnx/all/patches/0001-fix-concurrent-proto3-remove-1.8.1.patch b/recipes/onnx/all/patches/0001-fix-concurrent-proto3-remove-1.8.1.patch deleted file mode 100644 index 2d1317c302c93..0000000000000 --- a/recipes/onnx/all/patches/0001-fix-concurrent-proto3-remove-1.8.1.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/onnx/gen_proto.py -+++ b/onnx/gen_proto.py -@@ -166,7 +166,7 @@ def convert(stem, package_name, output, do_onnx_ml=False, lite=False, protoc_pat - porto3_dir = os.path.dirname(proto3) - base_dir = os.path.dirname(porto3_dir) - gen_proto3_code(protoc_path, proto3, base_dir, base_dir, base_dir) -- pb3_files = glob.glob(os.path.join(porto3_dir, '*.proto3.*')) -+ pb3_files = glob.glob(os.path.join(porto3_dir, '{}.proto3.*'.format(proto_base))) - for pb3_file in pb3_files: - print("Removing {}".format(pb3_file)) - os.remove(pb3_file) diff --git a/recipes/onnx/all/patches/0001-fix-concurrent-proto3-remove-1.9.0.patch b/recipes/onnx/all/patches/0001-fix-concurrent-proto3-remove-1.9.0.patch deleted file mode 100644 index 181c708c8d374..0000000000000 --- a/recipes/onnx/all/patches/0001-fix-concurrent-proto3-remove-1.9.0.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/onnx/gen_proto.py -+++ b/onnx/gen_proto.py -@@ -169,7 +169,7 @@ def convert(stem, package_name, output, do_onnx_ml=False, lite=False, protoc_pat - porto3_dir = os.path.dirname(proto3) - base_dir = os.path.dirname(porto3_dir) - gen_proto3_code(protoc_path, proto3, base_dir, base_dir, base_dir) -- pb3_files = glob.glob(os.path.join(porto3_dir, '*.proto3.*')) -+ pb3_files = glob.glob(os.path.join(porto3_dir, '{}.proto3.*'.format(proto_base))) - for pb3_file in pb3_files: - print("Removing {}".format(pb3_file)) - os.remove(pb3_file) diff --git a/recipes/onnx/all/patches/0002-msvc-no-warnings-as-errors-1.8.1.patch b/recipes/onnx/all/patches/0002-msvc-no-warnings-as-errors-1.8.1.patch deleted file mode 100644 index b701fb66947d1..0000000000000 --- a/recipes/onnx/all/patches/0002-msvc-no-warnings-as-errors-1.8.1.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -454,7 +454,6 @@ if(BUILD_ONNX_PYTHON) - target_link_libraries(onnx_cpp2py_export PRIVATE ${PYTHON_LIBRARIES}) - target_compile_options(onnx_cpp2py_export - PRIVATE /MP -- /WX - /wd4800 # disable warning type' : forcing - # value to bool 'true' or 'false' - # (performance warning) -@@ -514,7 +513,6 @@ endif() - if(MSVC) - target_compile_options(onnx_proto - PRIVATE /MP -- /WX - /wd4800 # disable warning type' : forcing value - # to bool 'true' or 'false' - # (performance warning) -@@ -532,7 +530,6 @@ if(MSVC) - ${EXTRA_FLAGS}) - target_compile_options(onnx - PRIVATE /MP -- /WX - /wd4800 # disable warning type' : forcing value - # to bool 'true' or 'false' - # (performance warning) diff --git a/recipes/onnx/all/patches/0002-msvc-no-warnings-as-errors-1.9.0.patch b/recipes/onnx/all/patches/0002-msvc-no-warnings-as-errors-1.9.0.patch deleted file mode 100644 index 1ff241f73aca7..0000000000000 --- a/recipes/onnx/all/patches/0002-msvc-no-warnings-as-errors-1.9.0.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -485,7 +485,6 @@ if(BUILD_ONNX_PYTHON) - target_link_libraries(onnx_cpp2py_export PRIVATE ${PYTHON_LIBRARIES}) - target_compile_options(onnx_cpp2py_export - PRIVATE /MP -- /WX - /wd4800 # disable warning type' : forcing - # value to bool 'true' or 'false' - # (performance warning) -@@ -545,7 +544,6 @@ endif() - if(MSVC) - target_compile_options(onnx_proto - PRIVATE /MP -- /WX - /wd4800 # disable warning type' : forcing value - # to bool 'true' or 'false' - # (performance warning) -@@ -563,7 +561,6 @@ if(MSVC) - ${EXTRA_FLAGS}) - target_compile_options(onnx - PRIVATE /MP -- /WX - /wd4800 # disable warning type' : forcing value - # to bool 'true' or 'false' - # (performance warning) 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/onnx/config.yml b/recipes/onnx/config.yml index bff0ed99101e1..32a3b9ac351e1 100644 --- a/recipes/onnx/config.yml +++ b/recipes/onnx/config.yml @@ -1,9 +1,17 @@ versions: - "1.11.0": + "1.17.0": folder: all - "1.10.2": + "1.16.2": folder: all - "1.9.0": + "1.16.1": folder: all - "1.8.1": + "1.16.0": + folder: all + "1.15.0": + folder: all + "1.14.1": + folder: all + "1.14.0": + folder: all + "1.13.1": folder: all diff --git a/recipes/onnxruntime/all/cmake/onnxruntime_external_deps.cmake b/recipes/onnxruntime/all/cmake/onnxruntime_external_deps.cmake new file mode 100644 index 0000000000000..8cacf5636fe36 --- /dev/null +++ b/recipes/onnxruntime/all/cmake/onnxruntime_external_deps.cmake @@ -0,0 +1,112 @@ +# Replacement for https://github.com/microsoft/onnxruntime/blob/v1.16.1/cmake/external/onnxruntime_external_deps.cmake + +if(NOT onnxruntime_DISABLE_ABSEIL) + find_package(absl REQUIRED CONFIG) + list(APPEND onnxruntime_EXTERNAL_LIBRARIES abseil::abseil) + include_directories(${absl_INCLUDE_DIRS}) +endif() + +find_package(re2 REQUIRED CONFIG) +list(APPEND onnxruntime_EXTERNAL_LIBRARIES re2::re2) + +#flatbuffers 1.11.0 does not have flatbuffers::IsOutRange, therefore we require 1.12.0+ +find_package(Flatbuffers REQUIRED CONFIG) +list(APPEND onnxruntime_EXTERNAL_LIBRARIES flatbuffers::flatbuffers) + +find_package(Protobuf REQUIRED CONFIG) +list(APPEND onnxruntime_EXTERNAL_LIBRARIES protobuf::libprotobuf) +set(ONNX_CUSTOM_PROTOC_EXECUTABLE protoc) +set(PROTOC_EXECUTABLE protoc) + +find_package(date REQUIRED CONFIG) +list(APPEND onnxruntime_EXTERNAL_LIBRARIES date::date) +include_directories(${date_INCLUDE_DIRS}) +add_library(date_interface INTERFACE) + +find_package(Boost REQUIRED CONFIG) +list(APPEND onnxruntime_EXTERNAL_LIBRARIES Boost::mp11) + +find_package(nlohmann_json REQUIRED CONFIG) +list(APPEND onnxruntime_EXTERNAL_LIBRARIES nlohmann_json::nlohmann_json) + +find_package(cpuinfo REQUIRED CONFIG) +list(APPEND onnxruntime_EXTERNAL_LIBRARIES cpuinfo::cpuinfo) +if (TARGET cpuinfo::clog) + list(APPEND onnxruntime_EXTERNAL_LIBRARIES cpuinfo::clog) +endif() +set(CPUINFO_SUPPORTED ${cpuinfo_FOUND}) +# Add a dummy targets for onnxruntime CMakelists.txt to depend on +add_library(clog INTERFACE) +add_library(cpuinfo INTERFACE) + +if (NOT WIN32) + find_package(nsync REQUIRED CONFIG) + list(APPEND onnxruntime_EXTERNAL_LIBRARIES nsync::nsync_cpp) + include_directories(${nsync_INCLUDE_DIRS}) + add_library(nsync_cpp INTERFACE) +endif() + +find_package(Microsoft.GSL 4.0 REQUIRED CONFIG) +list(APPEND onnxruntime_EXTERNAL_LIBRARIES Microsoft.GSL::GSL) +include_directories(${Microsoft.GSL_INCLUDE_DIRS}) + +find_package(safeint REQUIRED CONFIG) +include_directories(${safeint_INCLUDE_DIRS}) +add_library(safeint_interface INTERFACE) + +find_package(ONNX REQUIRED CONFIG) +list(APPEND onnxruntime_EXTERNAL_LIBRARIES onnx onnx_proto) + +find_package(Eigen3 REQUIRED CONFIG) +list(APPEND onnxruntime_EXTERNAL_LIBRARIES Eigen3::Eigen) +set(eigen_INCLUDE_DIRS ${Eigen3_INCLUDE_DIRS}) + +if(WIN32) + find_package(wil REQUIRED CONFIG) + list(APPEND onnxruntime_EXTERNAL_LIBRARIES WIL::WIL) + include_directories(${wil_INCLUDE_DIRS}) +endif() + +# XNNPACK EP +if (onnxruntime_USE_XNNPACK) + if (onnxruntime_DISABLE_CONTRIB_OPS) + message(FATAL_ERROR "XNNPACK EP requires the internal NHWC contrib ops to be available " + "but onnxruntime_DISABLE_CONTRIB_OPS is ON") + endif() + find_package(xnnpack REQUIRED CONFIG) + list(APPEND onnxruntime_EXTERNAL_LIBRARIES xnnpack::xnnpack) + add_library(XNNPACK INTERFACE) +endif() + +if (onnxruntime_USE_MIMALLOC) + find_package(mimalloc REQUIRED CONFIG) + add_definitions(-DUSE_MIMALLOC) +endif() + +# The source code of onnx_proto is generated, we must build this lib first before starting to compile the other source code that uses ONNX protobuf types. +# The other libs do not have the problem. All the sources are already there. We can compile them in any order. +set(onnxruntime_EXTERNAL_DEPENDENCIES + onnx_proto + flatbuffers::flatbuffers +) + +if (onnxruntime_RUN_ONNX_TESTS) + add_definitions(-DORT_RUN_EXTERNAL_ONNX_TESTS) +endif() + +if(onnxruntime_ENABLE_ATEN) + message("Aten fallback is enabled.") + find_package(dlpack REQUIRED CONFIG) +endif() + +if(onnxruntime_ENABLE_TRAINING OR (onnxruntime_ENABLE_TRAINING_APIS AND onnxruntime_BUILD_UNIT_TESTS)) + find_package(cxxopts REQUIRED CONFIG) +endif() + +if(onnxruntime_USE_SNPE) + include(external/find_snpe.cmake) + list(APPEND onnxruntime_EXTERNAL_LIBRARIES ${SNPE_NN_LIBS}) +endif() + +file(TO_NATIVE_PATH ${CMAKE_BINARY_DIR} ORT_BINARY_DIR) +file(TO_NATIVE_PATH ${PROJECT_SOURCE_DIR} ORT_SOURCE_DIR) diff --git a/recipes/onnxruntime/all/conandata.yml b/recipes/onnxruntime/all/conandata.yml new file mode 100644 index 0000000000000..5ad665fd49f79 --- /dev/null +++ b/recipes/onnxruntime/all/conandata.yml @@ -0,0 +1,77 @@ +sources: + "1.18.1": + url: "https://github.com/microsoft/onnxruntime/archive/refs/tags/v1.18.1.tar.gz" + sha256: "480ff5d2450ff18d02db48908c9c0c6a602993942cb47866b8effe32d0469a2c" + "1.17.3": + url: "https://github.com/microsoft/onnxruntime/archive/refs/tags/v1.17.3.tar.gz" + sha256: "4112f6552c17216311be013b9a2621a3c1a17ed9e1268a1142599b6a494517c2" + "1.16.3": + url: "https://github.com/microsoft/onnxruntime/archive/refs/tags/v1.16.3.tar.gz" + sha256: "d26b8a7eed1df4440aa3d8eac5049980cbe585514ccedfda809712051a4b1721" + "1.15.1": + url: "https://github.com/microsoft/onnxruntime/archive/refs/tags/v1.15.1.tar.gz" + sha256: "93a9b6f148639938ccbaa48d0f641d8f33312fdfcc69ee9466e11362b43917c4" + "1.14.1": + url: "https://github.com/microsoft/onnxruntime/archive/refs/tags/v1.14.1.tar.gz" + sha256: "f998352b131bb89fa7dd1f1d87ddbafe647dfaddd11929b6b5168b3f4ef857de" +patches: + "1.18.1": + - patch_file: "patches/1.17.3-0002-missing-include.patch" + patch_description: "add missing '' include when abseil is built without c++17 support" + patch_type: "portability" + - patch_file: "patches/1.18.0-0004-abseil-no-string-view.patch" + patch_description: "allow to build with abseil built without c++17 support" + patch_type: "portability" + - patch_file: "patches/1.18.1-0005-fix-cutlass-cuda-provider.patch" + patch_description: "use cutlass from Conan" + patch_type: "portability" + "1.17.3": + - patch_file: "patches/1.17.3-0001-patch-macos-cpp20-date-compat.patch" + patch_description: "allow to build with macos c++20 support" + patch_type: "portability" + patch_source: "https://github.com/microsoft/onnxruntime/commit/7303a90f4916dcf6f66236d40b8917344c27420a.patch" + - patch_file: "patches/1.17.3-0002-missing-include.patch" + patch_description: "add missing '' include when abseil is built without c++17 support" + patch_type: "portability" + - patch_file: "patches/1.14.1-0004-abseil-no-string-view.patch" + patch_description: "allow to build with abseil built without c++17 support" + patch_type: "portability" + - patch_file: "patches/1.17.3-0003-fix-cutlass-cuda-provider.patch" + patch_description: "use cutlass from Conan" + patch_type: "portability" + "1.16.3": + - patch_file: "patches/1.14.1-0004-abseil-no-string-view.patch" + patch_description: "allow to build with abseil built without c++17 support" + patch_type: "portability" + "1.15.1": + - patch_file: "patches/1.14.1-0004-abseil-no-string-view.patch" + patch_description: "allow to build with abseil built without c++17 support" + patch_type: "portability" + - patch_file: "patches/1.15.1-0002-fix-attention-15983.patch" + patch_description: "Fix attention.cc" + patch_source: "https://github.com/microsoft/onnxruntime/pull/15983" + patch_type: "backport" + "1.14.1": + - patch_file: "patches/1.14.1-0001-cmake-dependencies.patch" + patch_description: "CMake: ensure conan dependencies are used (upstreamed future versions)" + patch_type: "conan" + - patch_file: "patches/1.14.1-0003-amx-gas-version.patch" + patch_description: "Check GNU AS supports AMX before enabling it" + patch_type: "portability" + patch_source: "https://github.com/microsoft/onnxruntime/commit/126e7bf15fa4af8621814b82a3f7bd0d786f0239.patch" + - patch_file: "patches/1.14.1-0004-abseil-no-string-view.patch" + patch_description: "allow to build with abseil built without c++17 support" + patch_type: "portability" + - patch_file: "patches/1.14.1-0005-re2-compat.patch" + patch_description: "Ensures the forward compatibility with the newest versions of re2 library." + patch_type: "portability" + patch_source: "https://github.com/microsoft/onnxruntime/commit/126e7bf15fa4af8621814b82a3f7bd0d786f0239.patch" + +# ONNX versions are based on the minor version used at +# https://github.com/microsoft/onnxruntime/tree/main/cmake/external +onnx_version_map: + "1.18.1": "1.16.2" + "1.17.3": "1.15.0" + "1.16.3": "1.14.1" + "1.15.1": "1.14.1" + "1.14.1": "1.13.1" diff --git a/recipes/onnxruntime/all/conanfile.py b/recipes/onnxruntime/all/conanfile.py new file mode 100644 index 0000000000000..ce3b31cb93581 --- /dev/null +++ b/recipes/onnxruntime/all/conanfile.py @@ -0,0 +1,280 @@ +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, copy, export_conandata_patches, get, rmdir, replace_in_file +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.env import VirtualBuildEnv +import os +import sys + + +required_conan_version = ">=1.53.0" + + +class OnnxRuntimeConan(ConanFile): + name = "onnxruntime" + description = "ONNX Runtime: cross-platform, high performance ML inferencing and training accelerator" + url = "https://github.com/conan-io/conan-center-index" + license = "MIT" + homepage = "https://onnxruntime.ai" + topics = ("deep-learning", "onnx", "neural-networks", "machine-learning", "ai-framework", "hardware-acceleration") + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_xnnpack": [True, False], + "with_cuda": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_xnnpack": False, + "with_cuda": False, + } + short_paths = True + + @property + def _min_cppstd(self): + if is_apple_os(self) and Version(self.version) >= "1.17.0": + return 20 # https://github.com/microsoft/onnxruntime/blob/8f5c79cb63f09ef1302e85081093a3fe4da1bc7d/cmake/CMakeLists.txt#L43-L47 + return 17 + + @property + def _compilers_minimum_version(self): + if Version(self.version) < "1.16.0": + return { + "Visual Studio": "16", + "msvc": "192", + "gcc": "7", + "clang": "5", + "apple-clang": "10", + } + return { + "Visual Studio": "17", + "msvc": "193", + "gcc": "9", + "clang": "5", + "apple-clang": "10", + } + + def export_sources(self): + export_conandata_patches(self) + copy(self, "cmake/*", 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") + # onnxruntime forces this to be True + # https://github.com/microsoft/onnxruntime/blob/be76e1e1b8e2914e448d12a0cc683c00014c0490/cmake/external/onnxruntime_external_deps.cmake#L542 + self.options["onnx"].disable_static_registration = True + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + required_onnx_version = self.conan_data["onnx_version_map"][self.version] + self.requires(f"onnx/{required_onnx_version}") + self.requires("abseil/20240116.1") + self.requires("protobuf/3.21.12") + self.requires("date/3.0.1") + self.requires("re2/20231101") + if Version(self.version) >= "1.18": + self.requires("flatbuffers/23.5.26") + else: + # v1.* is required, newer versions are not compatible + self.requires("flatbuffers/1.12.0") + # using 1.84.0+ fails on CCI as it prevents the cpp 17 version to be picked up when building with cpp 20 + self.requires("boost/1.83.0", headers=True, libs=False) # for mp11, header only, no need for libraries + self.requires("safeint/3.0.28") + self.requires("nlohmann_json/3.11.3") + self.requires("eigen/3.4.0") + self.requires("ms-gsl/4.0.0") + if Version(self.version) >= "1.17.0": + self.requires("cpuinfo/cci.20231129") + else: + self.requires("cpuinfo/cci.20220618") # Newer versions are not compatible + if self.settings.os != "Windows": + self.requires("nsync/1.26.0") + else: + self.requires("wil/1.0.240803.1") + if self.options.with_xnnpack: + if Version(self.version) >= "1.17.0": + self.requires("xnnpack/cci.20230715") + else: + self.requires("xnnpack/cci.20220801") + if self.options.with_cuda: + self.requires("cutlass/3.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 minimum compiler version {minimum_version}." + ) + if not self.dependencies["onnx"].options.disable_static_registration: + raise ConanInvalidConfiguration( + f"{self.ref} requires onnx compiled with `-o onnx:disable_static_registration=True`." + ) + + def validate_build(self): + if self.version >= Version("1.15.0") and self.options.shared and sys.version_info[:2] < (3, 8): + # https://github.com/microsoft/onnxruntime/blob/638146b79ea52598ece514704d3f592c10fab2f1/cmake/CMakeLists.txt#LL500C12-L500C12 + raise ConanInvalidConfiguration( + f"{self.ref} requires Python 3.8+ to be built as shared." + ) + if self.settings.os == "Windows" and self.dependencies["abseil"].options.shared: + raise ConanInvalidConfiguration("Using abseil shared on Windows leads to link errors.") + + def build_requirements(self): + # Required by upstream https://github.com/microsoft/onnxruntime/blob/v1.16.1/cmake/CMakeLists.txt#L5 + self.tool_requires("cmake/[>=3.26 <4]") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + # disable downloading dependencies to ensure conan ones are used + tc.variables["FETCHCONTENT_FULLY_DISCONNECTED"] = True + if self.version >= Version("1.15.0") and self.options.shared: + # Need to replace windows path separators with linux path separators to keep CMake from crashing + tc.variables["Python_EXECUTABLE"] = sys.executable.replace("\\", "/") + + tc.variables["onnxruntime_BUILD_SHARED_LIB"] = self.options.shared + tc.variables["onnxruntime_USE_FULL_PROTOBUF"] = not self.dependencies["protobuf"].options.lite + tc.variables["onnxruntime_USE_XNNPACK"] = self.options.with_xnnpack + + tc.variables["onnxruntime_USE_CUDA"] = self.options.with_cuda + tc.variables["onnxruntime_BUILD_UNIT_TESTS"] = False + tc.variables["onnxruntime_DISABLE_CONTRIB_OPS"] = False + tc.variables["onnxruntime_USE_FLASH_ATTENTION"] = False + tc.variables["onnxruntime_DISABLE_RTTI"] = False + tc.variables["onnxruntime_DISABLE_EXCEPTIONS"] = False + + tc.variables["onnxruntime_ARMNN_RELU_USE_CPU"] = False + tc.variables["onnxruntime_ARMNN_BN_USE_CPU"] = False + tc.variables["onnxruntime_ENABLE_CPU_FP16_OPS"] = False + tc.variables["onnxruntime_ENABLE_EAGER_MODE"] = False + tc.variables["onnxruntime_ENABLE_LAZY_TENSOR"] = False + + if Version(self.version) >= "1.17": + tc.variables["onnxruntime_ENABLE_CUDA_EP_INTERNAL_TESTS"] = False + tc.variables["onnxruntime_USE_NEURAL_SPEED"] = False + tc.variables["onnxruntime_USE_MEMORY_EFFICIENT_ATTENTION"] = False + + # Disable a warning that gets converted to an error + tc.preprocessor_definitions["_SILENCE_ALL_CXX23_DEPRECATION_WARNINGS"] = "1" + tc.generate() + + deps = CMakeDeps(self) + deps.set_property("boost::headers", "cmake_target_name", "Boost::mp11") + deps.set_property("flatbuffers", "cmake_target_name", "flatbuffers::flatbuffers") + deps.generate() + + vbe = VirtualBuildEnv(self) + vbe.generate(scope="build") + + def _patch_sources(self): + apply_conandata_patches(self) + copy(self, "onnxruntime_external_deps.cmake", + src=os.path.join(self.export_sources_folder, "cmake"), + dst=os.path.join(self.source_folder, "cmake", "external")) + # Avoid parsing of git commit info + if Version(self.version) >= "15.0": + replace_in_file(self, os.path.join(self.source_folder, "cmake", "CMakeLists.txt"), + "if (Git_FOUND)", "if (FALSE)") + if Version(self.version) >= "1.17": + # https://github.com/microsoft/onnxruntime/commit/5bfca1dc576720627f3af8f65e25af408271079b + replace_in_file(self, os.path.join(self.source_folder, "cmake", "onnxruntime_providers_cuda.cmake"), + 'option(onnxruntime_NVCC_THREADS "Number of threads that NVCC can use for compilation." 1)', + 'set(onnxruntime_NVCC_THREADS "1" CACHE STRING "Number of threads that NVCC can use for compilation.")') + + def build(self): + self._patch_sources() + cmake = CMake(self) + # https://github.com/microsoft/onnxruntime/blob/v1.14.1/cmake/CMakeLists.txt#L792 + # onnxruntime is builds its targets with COMPILE_WARNING_AS_ERROR ON + # This will most likely lead to build errors on compilers not undergoing CI testing upstream + # so disable COMPILE_WARNING_AS_ERROR + cmake.configure(build_script_folder="cmake", cli_args=["--compile-no-warning-as-error"]) + 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() + pkg_config_dir = os.path.join(self.package_folder, "lib", "pkgconfig") + rmdir(self, pkg_config_dir) + + def package_info(self): + if self.options.shared: + self.cpp_info.libs = ["onnxruntime"] + else: + onnxruntime_libs = [ + "session", + "optimizer", + "providers", + "framework", + "graph", + "util", + "mlas", + "common", + "flatbuffers", + ] + if self.options.with_xnnpack: + onnxruntime_libs.append("providers_xnnpack") + self.cpp_info.libs = [f"onnxruntime_{lib}" for lib in onnxruntime_libs] + + if Version(self.version) < "1.16.0" or not self.options.shared: + self.cpp_info.includedirs.append("include/onnxruntime/core/session") + else: + self.cpp_info.includedirs.append("include/onnxruntime") + + if self.settings.os in ["Linux", "Android", "FreeBSD", "SunOS", "AIX"]: + self.cpp_info.system_libs.append("m") + if self.settings.os in ["Linux", "FreeBSD", "SunOS", "AIX"]: + self.cpp_info.system_libs.append("pthread") + if is_apple_os(self): + self.cpp_info.frameworks.append("Foundation") + if self.settings.os == "Windows": + self.cpp_info.system_libs.append("shlwapi") + + # conanv1 doesn't support traits and we only need headers from boost + self.cpp_info.requires = [ + "abseil::abseil", + "protobuf::protobuf", + "date::date", + "re2::re2", + "onnx::onnx", + "flatbuffers::flatbuffers", + "boost::headers", + "safeint::safeint", + "nlohmann_json::nlohmann_json", + "eigen::eigen", + "ms-gsl::ms-gsl", + "cpuinfo::cpuinfo" + ] + if self.settings.os != "Windows": + self.cpp_info.requires.append("nsync::nsync") + else: + self.cpp_info.requires.append("wil::wil") + if self.options.with_xnnpack: + self.cpp_info.requires.append("xnnpack::xnnpack") + if self.options.with_cuda: + self.cpp_info.requires.append("cutlass::cutlass") + + # https://github.com/microsoft/onnxruntime/blob/v1.16.0/cmake/CMakeLists.txt#L1759-L1763 + self.cpp_info.set_property("cmake_file_name", "onnxruntime") + self.cpp_info.set_property("cmake_target_name", "onnxruntime::onnxruntime") + # https://github.com/microsoft/onnxruntime/blob/v1.14.1/cmake/CMakeLists.txt#L1584 + self.cpp_info.set_property("pkg_config_name", "onnxruntime") diff --git a/recipes/onnxruntime/all/patches/1.14.1-0001-cmake-dependencies.patch b/recipes/onnxruntime/all/patches/1.14.1-0001-cmake-dependencies.patch new file mode 100644 index 0000000000000..f2d83eacd7844 --- /dev/null +++ b/recipes/onnxruntime/all/patches/1.14.1-0001-cmake-dependencies.patch @@ -0,0 +1,11 @@ +--- a/cmake/onnxruntime_flatbuffers.cmake ++++ b/cmake/onnxruntime_flatbuffers.cmake +@@ -9,7 +9,7 @@ file(GLOB onnxruntime_flatbuffers_srcs CONFIGURE_DEPENDS + source_group(TREE ${REPO_ROOT} FILES ${onnxruntime_flatbuffers_srcs}) + + onnxruntime_add_static_library(onnxruntime_flatbuffers ${onnxruntime_flatbuffers_srcs}) +-onnxruntime_add_include_to_target(onnxruntime_flatbuffers onnx flatbuffers ${GSL_TARGET}) ++onnxruntime_add_include_to_target(onnxruntime_flatbuffers onnx flatbuffers::flatbuffers ${GSL_TARGET}) + if(onnxruntime_ENABLE_INSTRUMENT) + target_compile_definitions(onnxruntime_flatbuffers PUBLIC ONNXRUNTIME_ENABLE_INSTRUMENT) + endif() diff --git a/recipes/onnxruntime/all/patches/1.14.1-0003-amx-gas-version.patch b/recipes/onnxruntime/all/patches/1.14.1-0003-amx-gas-version.patch new file mode 100644 index 0000000000000..ab85b0ed79eee --- /dev/null +++ b/recipes/onnxruntime/all/patches/1.14.1-0003-amx-gas-version.patch @@ -0,0 +1,42 @@ +From 126e7bf15fa4af8621814b82a3f7bd0d786f0239 Mon Sep 17 00:00:00 2001 +From: JiCheng +Date: Wed, 22 Mar 2023 07:57:22 +0800 +Subject: [PATCH] [AMX] add assembler check (#15055) + +### Description + + +AMX isn't supportted until assembler 2.40 even though the GCC frontend +supports it. + + +### Motivation and Context + +--- + cmake/onnxruntime_mlas.cmake | 12 +++++++++++- + 1 file changed, 11 insertions(+), 1 deletion(-) + +diff --git a/cmake/onnxruntime_mlas.cmake b/cmake/onnxruntime_mlas.cmake +index e79e1ed9855..6292a667d4a 100644 +--- a/cmake/onnxruntime_mlas.cmake ++++ b/cmake/onnxruntime_mlas.cmake +@@ -7,7 +7,17 @@ set(MLAS_SRC_DIR ${ONNXRUNTIME_ROOT}/core/mlas/lib) + set(MLAS_AMX_SUPPORTED FALSE) + + if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 11) +- set(MLAS_AMX_SUPPORTED TRUE) ++ # match assembler version, AMX instructions are supported from 2.40 ++ if (CMAKE_ASM-ATT_COMPILER_ID STREQUAL "GNU") ++ execute_process( ++ COMMAND ${CMAKE_ASM-ATT_COMPILER} --version ++ OUTPUT_VARIABLE _gas_version ++ ) ++ # 2.40 or later ++ if (_gas_version MATCHES "GNU.[Aa]ssembler.*(2\\.[4-9][0-9])") ++ set(MLAS_AMX_SUPPORTED TRUE) ++ endif() ++ endif() + endif() + + if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") diff --git a/recipes/onnxruntime/all/patches/1.14.1-0004-abseil-no-string-view.patch b/recipes/onnxruntime/all/patches/1.14.1-0004-abseil-no-string-view.patch new file mode 100644 index 0000000000000..983988c7e0db2 --- /dev/null +++ b/recipes/onnxruntime/all/patches/1.14.1-0004-abseil-no-string-view.patch @@ -0,0 +1,22 @@ +--- a/onnxruntime/core/framework/kernel_type_str_resolver.cc ++++ b/onnxruntime/core/framework/kernel_type_str_resolver.cc +@@ -20,7 +20,7 @@ Status KernelTypeStrResolver::ResolveKernelTypeStr(const Node& node, std::string + ORT_RETURN_IF(op_it == op_kernel_type_str_map_.end(), "Failed to find op_id: ", op_id); + const auto& type_str_map = op_it->second; + +-#ifdef DISABLE_ABSEIL ++#ifndef ABSL_USES_STD_STRING_VIEW + // TODO(edgchen1) maybe we can use transparent hash/eq to enable lookup with string_view + const auto type_str_it = type_str_map.find(std::string(kernel_type_str)); + #else +--- a/onnxruntime/core/framework/ort_value_name_idx_map.h ++++ b/onnxruntime/core/framework/ort_value_name_idx_map.h +@@ -33,7 +33,7 @@ class OrtValueNameIdxMap { + common::Status GetIdx(std::string_view name, int& idx) const { + idx = -1; + +-#ifdef DISABLE_ABSEIL ++#ifndef ABSL_USES_STD_STRING_VIEW + auto it = map_.find(std::string(name)); + #else + auto it = map_.find(name); diff --git a/recipes/onnxruntime/all/patches/1.14.1-0005-re2-compat.patch b/recipes/onnxruntime/all/patches/1.14.1-0005-re2-compat.patch new file mode 100644 index 0000000000000..c8e0cc9d9a48e --- /dev/null +++ b/recipes/onnxruntime/all/patches/1.14.1-0005-re2-compat.patch @@ -0,0 +1,41 @@ +From a3a443c80431c390cbf8855e9c7b2a95d413cd54 Mon Sep 17 00:00:00 2001 +From: Yuriy Chernyshov +Date: Thu, 8 Jun 2023 20:26:26 +0200 +Subject: [PATCH] Support re2 == 2023-06-02 (#16257) + +### Description + +google/re2 [was +switched](https://github.com/google/re2/commit/49d776b9d29d79b6e2876d5f091d2207d8123dfa) +to absl::string_view in version 2023-06-02. + +As `absl::string_view` is a drop-in replacement for `std::string_view` +it does not have `as_string()` method. +This PR ensures the forward compatibility with the newest versions of +re2 library. +--- + onnxruntime/contrib_ops/cpu/tokenizer.cc | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/onnxruntime/contrib_ops/cpu/tokenizer.cc b/onnxruntime/contrib_ops/cpu/tokenizer.cc +index 45998b6d8310..1787fb9b3c4a 100644 +--- a/onnxruntime/contrib_ops/cpu/tokenizer.cc ++++ b/onnxruntime/contrib_ops/cpu/tokenizer.cc +@@ -242,7 +242,7 @@ Status Tokenizer::SeparatorExpressionTokenizer(OpKernelContext* ctx, + token_len, utf8_chars); + if (!valid) { + return Status(common::ONNXRUNTIME, common::INVALID_ARGUMENT, +- "Match contains invalid utf8 chars: " + submatch.as_string()); ++ "Match contains invalid utf8 chars: " + std::string{submatch}); + } + if (utf8_chars >= size_t(mincharnum_)) { + tokens.emplace_back(text.data() + start_pos, token_len); +@@ -384,7 +384,7 @@ Status Tokenizer::TokenExpression(OpKernelContext* ctx, + utf8_chars = 0; + if (!utf8_len(reinterpret_cast(submatch.data()), token_len, utf8_chars)) { + return Status(common::ONNXRUNTIME, common::INVALID_ARGUMENT, +- "Match contains invalid utf8 chars: " + submatch.as_string()); ++ "Match contains invalid utf8 chars: " + std::string{submatch}); + } + if (utf8_chars >= size_t(mincharnum_)) { + row.push_back(submatch); diff --git a/recipes/onnxruntime/all/patches/1.15.1-0002-fix-attention-15983.patch b/recipes/onnxruntime/all/patches/1.15.1-0002-fix-attention-15983.patch new file mode 100644 index 0000000000000..512fe43577ad8 --- /dev/null +++ b/recipes/onnxruntime/all/patches/1.15.1-0002-fix-attention-15983.patch @@ -0,0 +1,11 @@ +--- a/onnxruntime/contrib_ops/cuda/bert/attention.cc ++++ b/onnxruntime/contrib_ops/cuda/bert/attention.cc +@@ -164,7 +164,7 @@ + has_memory_efficient_attention(sm, sizeof(T) == 2); + #else + constexpr bool use_memory_efficient_attention = false; +- ORT_UNUSED_VARIABLE(is_mask_1d_key_seq_len_start); ++ ORT_UNUSED_PARAMETER(is_mask_1d_key_seq_len_start); + #endif + + cublasHandle_t cublas = GetCublasHandle(context); diff --git a/recipes/onnxruntime/all/patches/1.17.3-0001-patch-macos-cpp20-date-compat.patch b/recipes/onnxruntime/all/patches/1.17.3-0001-patch-macos-cpp20-date-compat.patch new file mode 100644 index 0000000000000..4f206c34e7538 --- /dev/null +++ b/recipes/onnxruntime/all/patches/1.17.3-0001-patch-macos-cpp20-date-compat.patch @@ -0,0 +1,142 @@ +From 7303a90f4916dcf6f66236d40b8917344c27420a Mon Sep 17 00:00:00 2001 +From: Andrew Fantino <15876180+afantino951@users.noreply.github.com> +Date: Tue, 2 Apr 2024 22:10:25 -0700 +Subject: [PATCH] Fix build errors from date/date.h C++20 compatibility + (#20139) + +### Description +For C++ standards >= 20, use `std::chrono::operator<<` in place of +`date::operator<<` to fix ambiguous operator compile error. + +### Motivation and Context +The external dependency HowardHinnant/date has a conflict with +std::chrono for >=C++20. +Solves #20137 +--- + cmake/onnxruntime_common.cmake | 2 +- + include/onnxruntime/core/common/logging/logging.h | 11 +++++++++++ + onnxruntime/core/common/logging/sinks/ostream_sink.cc | 3 +-- + .../core/platform/apple/logging/apple_log_sink.mm | 2 +- + onnxruntime/test/common/logging/helpers.h | 3 +-- + onnxruntime/test/util/include/test/capturing_sink.h | 4 +--- + 6 files changed, 16 insertions(+), 9 deletions(-) + +diff --git a/cmake/onnxruntime_common.cmake b/cmake/onnxruntime_common.cmake +index fb56e3f3445d..69d8f5fa138c 100644 +--- a/cmake/onnxruntime_common.cmake ++++ b/cmake/onnxruntime_common.cmake +@@ -129,7 +129,7 @@ target_include_directories(onnxruntime_common + ${OPTIONAL_LITE_INCLUDE_DIR}) + + +-target_link_libraries(onnxruntime_common PUBLIC safeint_interface ${GSL_TARGET} ${ABSEIL_LIBS}) ++target_link_libraries(onnxruntime_common PUBLIC safeint_interface ${GSL_TARGET} ${ABSEIL_LIBS} date::date) + + add_dependencies(onnxruntime_common ${onnxruntime_EXTERNAL_DEPENDENCIES}) + +diff --git a/include/onnxruntime/core/common/logging/logging.h b/include/onnxruntime/core/common/logging/logging.h +index 2b9912ea7738..f62053a5e44a 100644 +--- a/include/onnxruntime/core/common/logging/logging.h ++++ b/include/onnxruntime/core/common/logging/logging.h +@@ -18,6 +18,8 @@ + + #include "core/common/logging/macros.h" + ++#include "date/date.h" ++ + /* + + Logging overview and expected usage: +@@ -56,6 +58,15 @@ namespace logging { + + using Timestamp = std::chrono::time_point; + ++// TODO: When other compilers support std::chrono::operator<<, update this. ++// TODO: Check support for other compilers' version before enable C++20 for other compilers. ++// Xcode added support for C++20's std::chrono::operator<< in SDK version 14.4. ++#if __cplusplus >= 202002L && __MAC_OS_X_VERSION_MAX_ALLOWED >= 140400L ++namespace timestamp_ns = std::chrono; ++#else ++namespace timestamp_ns = ::date; ++#endif ++ + #ifndef NDEBUG + ORT_ATTRIBUTE_UNUSED static bool vlog_enabled = true; // Set directly based on your needs. + #else +diff --git a/onnxruntime/core/common/logging/sinks/ostream_sink.cc b/onnxruntime/core/common/logging/sinks/ostream_sink.cc +index 0db3d8709d48..a120138d1d15 100644 +--- a/onnxruntime/core/common/logging/sinks/ostream_sink.cc ++++ b/onnxruntime/core/common/logging/sinks/ostream_sink.cc +@@ -2,7 +2,6 @@ + // Licensed under the MIT License. + + #include "core/common/logging/sinks/ostream_sink.h" +-#include "date/date.h" + + namespace onnxruntime { + namespace logging { +@@ -24,7 +23,7 @@ struct Color { + + void OStreamSink::SendImpl(const Timestamp& timestamp, const std::string& logger_id, const Capture& message) { + // operator for formatting of timestamp in ISO8601 format including microseconds +- using date::operator<<; ++ using timestamp_ns::operator<<; + + // Two options as there may be multiple calls attempting to write to the same sink at once: + // 1) Use mutex to synchronize access to the stream. +diff --git a/onnxruntime/core/platform/apple/logging/apple_log_sink.mm b/onnxruntime/core/platform/apple/logging/apple_log_sink.mm +index 8dbd8eecd0e7..78614ffd2819 100644 +--- a/onnxruntime/core/platform/apple/logging/apple_log_sink.mm ++++ b/onnxruntime/core/platform/apple/logging/apple_log_sink.mm +@@ -13,7 +13,7 @@ + namespace logging { + + void AppleLogSink::SendImpl(const Timestamp& timestamp, const std::string& logger_id, const Capture& message) { +- using date::operator<<; ++ using timestamp_ns::operator<<; + std::ostringstream msg; + msg << timestamp << " [" << message.SeverityPrefix() << ":" << message.Category() << ":" << logger_id << ", " + << message.Location().ToString() << "] " << message.Message(); +diff --git a/onnxruntime/test/common/logging/helpers.h b/onnxruntime/test/common/logging/helpers.h +index c8d027022850..7fd03b72e53a 100644 +--- a/onnxruntime/test/common/logging/helpers.h ++++ b/onnxruntime/test/common/logging/helpers.h +@@ -5,7 +5,6 @@ + + #include + +-#include "date/date.h" + #include "gmock/gmock.h" + #include "gtest/gtest.h" + +@@ -30,7 +29,7 @@ class MockSink : public ::onnxruntime::logging::ISink { + #endif + + ACTION(PrintArgs) { +- using date::operator<<; ++ using onnxruntime::logging::timestamp_ns::operator<<; + + // const Timestamp ×tamp, const std::string &logger_id, const Message &message + // arg0 arg1 arg2 +diff --git a/onnxruntime/test/util/include/test/capturing_sink.h b/onnxruntime/test/util/include/test/capturing_sink.h +index 39788947602d..7d978d1bd1e5 100644 +--- a/onnxruntime/test/util/include/test/capturing_sink.h ++++ b/onnxruntime/test/util/include/test/capturing_sink.h +@@ -6,8 +6,6 @@ + #include "core/common/logging/logging.h" + #include "core/common/logging/isink.h" + +-#include "date/date.h" +- + namespace onnxruntime { + namespace test { + +@@ -17,7 +15,7 @@ class CapturingSink : public logging::ISink { + public: + void SendImpl(const Timestamp& timestamp, const std::string& logger_id, const Capture& message) override { + // operator for formatting of timestamp in ISO8601 format including microseconds +- using date::operator<<; ++ using timestamp_ns::operator<<; + std::ostringstream msg; + + msg << timestamp << " [" << message.SeverityPrefix() << ":" << message.Category() << ":" << logger_id << ", " diff --git a/recipes/onnxruntime/all/patches/1.17.3-0002-missing-include.patch b/recipes/onnxruntime/all/patches/1.17.3-0002-missing-include.patch new file mode 100644 index 0000000000000..d3555681e4af9 --- /dev/null +++ b/recipes/onnxruntime/all/patches/1.17.3-0002-missing-include.patch @@ -0,0 +1,12 @@ +diff --git a/include/onnxruntime/core/graph/graph.h b/include/onnxruntime/core/graph/graph.h +index 22827d43b2..f9e5fd56d3 100644 +--- a/include/onnxruntime/core/graph/graph.h ++++ b/include/onnxruntime/core/graph/graph.h +@@ -6,6 +6,7 @@ + #include + #include + #include ++#include + #include + #include + #include diff --git a/recipes/onnxruntime/all/patches/1.17.3-0003-fix-cutlass-cuda-provider.patch b/recipes/onnxruntime/all/patches/1.17.3-0003-fix-cutlass-cuda-provider.patch new file mode 100644 index 0000000000000..8ea3d51071e51 --- /dev/null +++ b/recipes/onnxruntime/all/patches/1.17.3-0003-fix-cutlass-cuda-provider.patch @@ -0,0 +1,15 @@ +diff --git a/cmake/onnxruntime_providers_cuda.cmake b/cmake/onnxruntime_providers_cuda.cmake +index b5c3100865..129c4f19f6 100644 +--- a/cmake/onnxruntime_providers_cuda.cmake ++++ b/cmake/onnxruntime_providers_cuda.cmake +@@ -180,8 +180,8 @@ + target_link_libraries(${target} PRIVATE CUDA::cuda_driver) + endif() + +- include(cutlass) +- target_include_directories(${target} PRIVATE ${cutlass_SOURCE_DIR}/include ${cutlass_SOURCE_DIR}/examples) ++ find_package(NvidiaCutlass) ++ target_link_libraries(${target} PRIVATE nvidia::cutlass::cutlass) + + target_include_directories(${target} PRIVATE ${ONNXRUNTIME_ROOT} ${CMAKE_CURRENT_BINARY_DIR} ${eigen_INCLUDE_DIRS} ${TVM_INCLUDES} + PUBLIC ${CUDAToolkit_INCLUDE_DIRS}) diff --git a/recipes/onnxruntime/all/patches/1.18.0-0004-abseil-no-string-view.patch b/recipes/onnxruntime/all/patches/1.18.0-0004-abseil-no-string-view.patch new file mode 100644 index 0000000000000..329024e7245ef --- /dev/null +++ b/recipes/onnxruntime/all/patches/1.18.0-0004-abseil-no-string-view.patch @@ -0,0 +1,22 @@ +--- a/onnxruntime/core/framework/kernel_type_str_resolver.cc ++++ b/onnxruntime/core/framework/kernel_type_str_resolver.cc +@@ -46,7 +46,7 @@ + ORT_RETURN_IF(op_it == op_kernel_type_str_map_.end(), "Failed to find op_id: ", op_id); + const auto& type_str_map = op_it->second; + +-#ifdef DISABLE_ABSEIL ++#ifndef ABSL_USES_STD_STRING_VIEW + // TODO(edgchen1) maybe we can use transparent hash/eq to enable lookup with string_view + const auto type_str_it = type_str_map.find(std::string(kernel_type_str)); + #else +--- a/onnxruntime/core/framework/ort_value_name_idx_map.h ++++ b/onnxruntime/core/framework/ort_value_name_idx_map.h +@@ -33,7 +33,7 @@ class OrtValueNameIdxMap { + common::Status GetIdx(std::string_view name, int& idx) const { + idx = -1; + +-#ifdef DISABLE_ABSEIL ++#ifndef ABSL_USES_STD_STRING_VIEW + auto it = map_.find(std::string(name)); + #else + auto it = map_.find(name); diff --git a/recipes/onnxruntime/all/patches/1.18.1-0005-fix-cutlass-cuda-provider.patch b/recipes/onnxruntime/all/patches/1.18.1-0005-fix-cutlass-cuda-provider.patch new file mode 100644 index 0000000000000..3024bfb1f7bb6 --- /dev/null +++ b/recipes/onnxruntime/all/patches/1.18.1-0005-fix-cutlass-cuda-provider.patch @@ -0,0 +1,15 @@ +diff --git a/cmake/onnxruntime_providers_cuda.cmake b/cmake/onnxruntime_providers_cuda.cmake +index 1346a9ce96..f40661d4bd 100644 +--- a/cmake/onnxruntime_providers_cuda.cmake ++++ b/cmake/onnxruntime_providers_cuda.cmake +@@ -211,8 +211,8 @@ + target_link_libraries(${target} PRIVATE CUDA::cuda_driver) + endif() + +- include(cutlass) +- target_include_directories(${target} PRIVATE ${cutlass_SOURCE_DIR}/include ${cutlass_SOURCE_DIR}/examples ${cutlass_SOURCE_DIR}/tools/util/include) ++ find_package(NvidiaCutlass) ++ target_link_libraries(${target} PRIVATE nvidia::cutlass::cutlass) + + target_include_directories(${target} PRIVATE ${ONNXRUNTIME_ROOT} ${CMAKE_CURRENT_BINARY_DIR} ${eigen_INCLUDE_DIRS} ${TVM_INCLUDES} + PUBLIC ${CUDAToolkit_INCLUDE_DIRS}) diff --git a/recipes/onnxruntime/all/test_package/CMakeLists.txt b/recipes/onnxruntime/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..483ebf5ead1ee --- /dev/null +++ b/recipes/onnxruntime/all/test_package/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package CXX) + +find_package(onnxruntime REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +if(WITH_CUDA) + target_compile_definitions(${PROJECT_NAME} PRIVATE WITH_CUDA) +endif() +target_link_libraries(${PROJECT_NAME} PRIVATE onnxruntime::onnxruntime) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/onnxruntime/all/test_package/conanfile.py b/recipes/onnxruntime/all/test_package/conanfile.py new file mode 100644 index 0000000000000..17284808fb050 --- /dev/null +++ b/recipes/onnxruntime/all/test_package/conanfile.py @@ -0,0 +1,37 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake, CMakeToolchain +from conan.tools.files import copy +import os + + +# It will become the standard on Conan 2.x +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, src_folder=".") + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["WITH_CUDA"] = self.dependencies["onnxruntime"].options.with_cuda + tc.generate() + if self.settings.os == "Windows": + # on windows the system dll C:\WINDOWS\system32\onnxruntime.dll may be loaded instead even if the conan lib is first in the PATH, see https://learn.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-search-order + for bindir in self.dependencies[self.tested_reference_str].cpp_info.bindirs: + copy(self, "*.dll", bindir, os.path.join(self.build_folder, str(self.settings.build_type))) + + 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/onnxruntime/all/test_package/test_package.cpp b/recipes/onnxruntime/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..09281241c4ad8 --- /dev/null +++ b/recipes/onnxruntime/all/test_package/test_package.cpp @@ -0,0 +1,23 @@ + +#include +#include + +#ifdef WITH_CUDA +#include +#endif + +int main() { + const auto& api = Ort::GetApi(); + std::cout << "Version: " << OrtGetApiBase()->GetVersionString() << std::endl; + std::cout << "Providers: " << std::endl; + for(const auto& provider: Ort::GetAvailableProviders()) + std::cout << provider << ", " << std::endl; + +#ifdef WITH_CUDA + Ort::SessionOptions session_options; + OrtSessionOptionsAppendExecutionProvider_CUDA(session_options, 1); + std::cout << "with cuda!" << std::endl; +#endif + + return 0; +} diff --git a/recipes/onnxruntime/all/test_v1_package/CMakeLists.txt b/recipes/onnxruntime/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..691d35acd08dc --- /dev/null +++ b/recipes/onnxruntime/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,22 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(onnxruntime REQUIRED CONFIG) +add_executable(${PROJECT_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/../test_package/test_package.cpp) +if(WITH_CUDA) + target_compile_definitions(${PROJECT_NAME} PRIVATE WITH_CUDA) +endif() + +target_link_libraries(${PROJECT_NAME} PRIVATE onnxruntime::onnxruntime) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) + +if(WIN32 AND DEFINED CONAN_BIN_DIRS_ONNXRUNTIME AND EXISTS ${CONAN_BIN_DIRS_ONNXRUNTIME}) + add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_directory + ${CONAN_BIN_DIRS_ONNXRUNTIME} + $ + ) +endif() diff --git a/recipes/onnxruntime/all/test_v1_package/conanfile.py b/recipes/onnxruntime/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..c492184eec19c --- /dev/null +++ b/recipes/onnxruntime/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/onnxruntime/config.yml b/recipes/onnxruntime/config.yml new file mode 100644 index 0000000000000..497cb76cea1d7 --- /dev/null +++ b/recipes/onnxruntime/config.yml @@ -0,0 +1,11 @@ +versions: + "1.18.1": + folder: all + "1.17.3": + folder: all + "1.16.3": + folder: all + "1.15.1": + folder: all + "1.14.1": + folder: all 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/open-simulation-interface/all/CMakeLists.txt b/recipes/open-simulation-interface/all/CMakeLists.txt deleted file mode 100644 index 5cfb924ad4de7..0000000000000 --- a/recipes/open-simulation-interface/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/open-simulation-interface/all/conandata.yml b/recipes/open-simulation-interface/all/conandata.yml index e0a816774466a..0a86437ce1ae3 100644 --- a/recipes/open-simulation-interface/all/conandata.yml +++ b/recipes/open-simulation-interface/all/conandata.yml @@ -12,10 +12,7 @@ sources: patches: 3.1.2: - patch_file: "patches/3.1.2_single_lib.patch" - base_path: "source_subfolder" 3.3.1: - patch_file: "patches/3.3.x_single_lib.patch" - base_path: "source_subfolder" 3.4.0: - patch_file: "patches/3.4.0_single_lib.patch" - base_path: "source_subfolder" diff --git a/recipes/open-simulation-interface/all/conanfile.py b/recipes/open-simulation-interface/all/conanfile.py index 971823690f5f9..b0e3cac24d6f1 100644 --- a/recipes/open-simulation-interface/all/conanfile.py +++ b/recipes/open-simulation-interface/all/conanfile.py @@ -1,17 +1,23 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration import os -import shutil -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, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir + +required_conan_version = ">=1.60.0 <2.0 || >=2.0.5" + class OpenSimulationInterfaceConan(ConanFile): name = "open-simulation-interface" + description = "Generic interface environmental perception of automated driving functions in virtual scenarios" + license = "MPL-2.0" + url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/OpenSimulationInterface/open-simulation-interface" - description = 'Generic interface environmental perception of automated driving functions in virtual scenarios' topics = ("asam", "adas", "open-simulation", "automated-driving", "openx") - url = "https://github.com/conan-io/conan-center-index" - license = "MPL-2.0" + + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -21,77 +27,67 @@ class OpenSimulationInterfaceConan(ConanFile): "shared": False, "fPIC": True, } - generators = "cmake", "cmake_find_package" - _cmake = None - short_paths = True - - @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 validate(self): - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 11) - if self.options.shared: - if self.settings.os == "Windows": - raise ConanInvalidConfiguration("Shared Libraries are not supported on windows because of the missing symbol export in the library.") - 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.12", transitive_headers=True, transitive_libs=True) + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) + if self.options.shared and self.settings.os == "Windows": + raise ConanInvalidConfiguration( + "Shared Libraries are not supported on windows because of the missing symbol export in the library." + ) def build_requirements(self): - self.build_requires("protobuf/3.17.1") + self.tool_requires("protobuf/") 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): + tc = CMakeToolchain(self) + 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 _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 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() - try: - if self.settings.os == "Windows": - shutil.rmtree(os.path.join(self.package_folder, "CMake")) - else: - shutil.rmtree(os.path.join(self.package_folder, "lib", "cmake")) - except: - pass + if self.settings.os == "Windows": + rmdir(self, os.path.join(self.package_folder, "CMake")) + else: + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): + self.cpp_info.set_property("cmake_file_name", "open_simulation_interface") + self.cpp_info.set_property("cmake_target_name", "open_simulation_interface::open_simulation_interface") + self.cpp_info.components["libopen_simulation_interface"].libs = ["open_simulation_interface"] + self.cpp_info.components["libopen_simulation_interface"].requires = ["protobuf::libprotobuf"] + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.names["cmake_find_package"] = "open_simulation_interface" self.cpp_info.names["cmake_find_package_multi"] = "open_simulation_interface" self.cpp_info.components["libopen_simulation_interface"].names["cmake_find_package"] = "open_simulation_interface" self.cpp_info.components["libopen_simulation_interface"].names["cmake_find_package_multi"] = "open_simulation_interface" - self.cpp_info.components["libopen_simulation_interface"].libs = ["open_simulation_interface"] - self.cpp_info.components["libopen_simulation_interface"].requires = ["protobuf::libprotobuf"] - diff --git a/recipes/open-simulation-interface/all/test_package/CMakeLists.txt b/recipes/open-simulation-interface/all/test_package/CMakeLists.txt index 34497df14111e..27d995312b038 100644 --- a/recipes/open-simulation-interface/all/test_package/CMakeLists.txt +++ b/recipes/open-simulation-interface/all/test_package/CMakeLists.txt @@ -1,16 +1,11 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(open_simulation_interface REQUIRED) +find_package(open_simulation_interface REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) - -target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_11) - target_link_libraries(${PROJECT_NAME} open_simulation_interface::open_simulation_interface ) +target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_11) diff --git a/recipes/open-simulation-interface/all/test_package/conanfile.py b/recipes/open-simulation-interface/all/test_package/conanfile.py index 3da371b660e0a..ef5d7042163ec 100644 --- a/recipes/open-simulation-interface/all/test_package/conanfile.py +++ b/recipes/open-simulation-interface/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/open-simulation-interface/all/test_package/test_package.cpp b/recipes/open-simulation-interface/all/test_package/test_package.cpp index 2b6c34045d39d..231a6941a54bb 100644 --- a/recipes/open-simulation-interface/all/test_package/test_package.cpp +++ b/recipes/open-simulation-interface/all/test_package/test_package.cpp @@ -3,7 +3,7 @@ #include int main() { - + osi3::SensorData d; // Version d.mutable_version()->set_version_major(3); diff --git a/recipes/open-simulation-interface/all/test_v1_package/CMakeLists.txt b/recipes/open-simulation-interface/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/open-simulation-interface/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/open-simulation-interface/all/test_v1_package/conanfile.py b/recipes/open-simulation-interface/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..49a3a66ea5bad --- /dev/null +++ b/recipes/open-simulation-interface/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/open62541/all/conandata.yml b/recipes/open62541/all/conandata.yml index 6e8ccb43a8658..6237b2ba7aa88 100644 --- a/recipes/open62541/all/conandata.yml +++ b/recipes/open62541/all/conandata.yml @@ -1,64 +1,56 @@ sources: - "1.3.1": - url: "https://github.com/open62541/open62541/archive/v1.3.1.tar.gz" - sha256: "f54d10325fd08fc1505aea37d83daa085912a269521e6d018bfc41a744ba57aa" - "1.2.4": - url: "https://github.com/open62541/open62541/archive/v1.2.4.tar.gz" - sha256: "b2d00b91e8315b61efaef6398f0902a0c9a8f357aa6d02f7f000a429048c97ae" - "1.2.2": - url: "https://github.com/open62541/open62541/archive/v1.2.2.tar.gz" - sha256: "9b5bfd811ee523be601f11abc514a93c67fe5c6e957cd6c36fe6ea4f28e009bb" + "1.4.6": + url: "https://github.com/open62541/open62541/archive/v1.4.6.tar.gz" + sha256: "bc4ad185fec5c257e15fcb813b7fef9607b7aaa5d355de7b665e1f210556d38e" + "1.3.9": + url: "https://github.com/open62541/open62541/archive/v1.3.9.tar.gz" + sha256: "71764d4a060cfa07eae7aaabd176da38b155ef01c63103513339699fd8026e2f" + "1.3.8": + url: "https://github.com/open62541/open62541/archive/v1.3.8.tar.gz" + sha256: "b6943b564787c4953b77ca8d7f987c4b896b3f3e91f45d9f13e9056b6148bc1d" + "1.2.6": + url: "https://github.com/open62541/open62541/archive/v1.2.6.tar.gz" + sha256: "7470c1e2f97d0e7dad9632ced7b62f0add66a3c689532204ef85b0556d129106" "1.1.6": url: "https://github.com/open62541/open62541/archive/v1.1.6.tar.gz" sha256: "005bb336ba52f2c0add479bb46de8aa4216efa7f2bfd8b1c24a0271494edbd3f" - "1.1.5": - url: "https://github.com/open62541/open62541/archive/v1.1.5.tar.gz" - sha256: "a3e689216d75c3313bffdbb1cb7190d63b173410f392b8c558062fdd667635d7" - "1.1.3": - url: "https://github.com/open62541/open62541/archive/v1.1.3.tar.gz" - sha256: "12770bf9f5d9f44dedce0d1b34066dd14111d24c73a2f0153420e0a750e85d19" "1.0.6": url: "https://github.com/open62541/open62541/archive/v1.0.6.tar.gz" sha256: "299940025c14929533064abe0044d5805ea50d52b32d05ad9bc0e6996569c2a6" - "1.0.3": - url: "https://github.com/open62541/open62541/archive/v1.0.3.tar.gz" - sha256: "3e4c939d702d06d89f32a1cafe2b992c7f3d81c8f8579e093a972d4bc4fb3d50" patches: - "1.3.1": - - patch_file: "patches/0001-fix-cmake-find-deps-1_3_x.patch" - base_path: "source_subfolder" - "1.2.4": + "1.4.6": + - patch_file: "patches/0001-disable-sanitizers-1_4_x.patch" + patch_description: "Disable static code analysis" + patch_type: "conan" + - patch_file: "patches/0004-include-iphlpapi.patch" + patch_description: "Include iphlpapi.h for SecureZeroMemory" + patch_type: "conan" + "1.3.9": + - patch_file: "patches/0001-disable-sanitizers-1_3_x.patch" + patch_description: "Disable static code analysis" + patch_type: "conan" + "1.3.8": + - patch_file: "patches/0001-disable-sanitizers-1_3_x.patch" + patch_description: "Disable static code analysis" + patch_type: "conan" + "1.2.6": - 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" - "1.2.2": - - patch_file: "patches/0001-fix-cmake-find-deps-1_2_x.patch" - base_path: "source_subfolder" - - patch_file: "patches/0003-disable-sanitizers-1_2_x.patch" - base_path: "source_subfolder" - - 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" - "1.1.5": - - patch_file: "patches/0001-fix-cmake-find-deps-1_1_x.patch" - base_path: "source_subfolder" - - patch_file: "patches/0002-disable-sanitizers-1_1_3-and-1_1_5.patch" - base_path: "source_subfolder" - "1.1.3": - - patch_file: "patches/0001-fix-cmake-find-deps-1_1_x.patch" - base_path: "source_subfolder" - - 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" - "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..456510bc92860 100644 --- a/recipes/open62541/all/conanfile.py +++ b/recipes/open62541/all/conanfile.py @@ -1,18 +1,17 @@ -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, copy, 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): name = "open62541" - license = "MPLv2" - homepage = "https://open62541.org/" - url = "https://github.com/conan-io/conan-center-index" description = "open62541 is an open source and free implementation of OPC UA " \ "(OPC Unified Architecture) written in the common subset of the " \ "C99 and C++98 languages. The library is usable with all major " \ @@ -21,11 +20,15 @@ class Open62541Conan(ConanFile): "into existing applications. open62541 library is platform independent. " \ "All platform-specific functionality is implemented via exchangeable " \ "plugins. Plugin implementations are provided for the major operating systems." + license = ("MPL-2.0", "CC0-1.0") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://open62541.org/" topics = ( - "opc ua", "open62541", "sdk", "server/client", "c", "iec-62541", + "opc ua", "sdk", "server/client", "c", "iec-62541", "industrial automation", "tsn", "time sensitive networks", "publish-subscirbe", "pubsub" ) + package_type = "library" settings = "os", "compiler", "build_type", "arch" options = { "fPIC": [True, False], @@ -105,7 +108,7 @@ class Open62541Conan(ConanFile): # UA_COMPILE_AS_CXX=cpp_compatible "cpp_compatible": [True, False], # UA_ENABLE_STATUSCODE_DESCRIPTIONS=readable_statuscodes - "readable_statuscodes": [True, False] + "readable_statuscodes": [True, False], } default_options = { "fPIC": True, @@ -133,52 +136,50 @@ class Open62541Conan(ConanFile): "typenames": True, "hardening": True, "cpp_compatible": False, - "readable_statuscodes": True + "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 - if not self.options.cpp_compatible: - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + self.options.rm_safe("fPIC") - # 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 not self.options.cpp_compatible: + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") 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 <4]") 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 +193,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") @@ -209,14 +210,13 @@ def validate(self): raise ConanInvalidConfiguration( "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: + unsupported_clang_version = "8" if Version(self.version) < "1.1.0" else "9" + if self.settings.compiler == "clang" and Version(self.settings.compiler.version) == unsupported_clang_version: raise ConanInvalidConfiguration( - "Open62541 supports Clang up to {} compiler version".format(max_clang_version)) + f"{self.ref} does not support Clang version {self.settings.compiler.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") @@ -224,33 +224,30 @@ def validate(self): raise ConanInvalidConfiguration( "PubSub over Ethernet is not supported for your OS!") + # Due to https://github.com/open62541/open62541/issues/4687 we cannot build with 1.2.2 + Windows + shared + 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.web_socket: if self.options["libwebsockets"].with_ssl != self.options.encryption: raise ConanInvalidConfiguration( "When web_socket is enabled, libwebsockets:with_ssl must have the value of open62541:encryption") 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) - submodule_filename = os.path.join( - self.recipe_folder, 'submoduledata.yml') + submodule_filename = os.path.join(self.recipe_folder, 'submoduledata.yml') with open(submodule_filename, 'r') as submodule_stream: submodules_data = yaml.safe_load(submodule_stream) for path, submodule in submodules_data["submodules"][self.version].items(): - filename = os.path.basename(submodule["url"]) - archive_name = submodule["archive_pattern"].format( - version=os.path.splitext(filename.replace('v', ''))[0]) - - submodule_data = { - "url": submodule["url"], - "sha256": submodule["sha256"] - } - - get(self, **submodule_data) - submodule_source = os.path.join(self._source_subfolder, path) - tools.rmdir(submodule_source) - rename(self, archive_name, submodule_source) + archive_name = os.path.splitext( + os.path.basename(submodule["url"]))[0] + get(self, url=submodule["url"], + sha256=submodule["sha256"], + destination=path, + filename=archive_name, + strip_root=True) def _get_log_level(self): return { @@ -270,122 +267,143 @@ 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_INFORMATIONMODEL"] = self.options.pub_sub != False + 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 - 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 - - self._cmake.configure(source_dir=self._source_subfolder) - return self._cmake + 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 == "msvc" and self.options.shared == True: + 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" + + tc.generate() + tc = CMakeDeps(self) + tc.set_property("mbedtls", "cmake_additional_variables_prefixes", ["MBEDTLS"]) + 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() + licenses_dir = os.path.join(self.package_folder, "licenses") + copy(self, "LICENSE", src=self.source_folder, dst=licenses_dir) + copy(self, "LICENSE-CC0", src=self.source_folder, dst=licenses_dir) + 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") + tools_dir = os.path.join(self.package_folder, "res", "tools") + copy(self, "generate_*.py", src=self._tools_subfolder, dst=tools_dir) + copy(self, "nodeset_compiler/*", src=self._tools_subfolder, dst=tools_dir) @staticmethod def _chmod_plus_x(filename): @@ -396,24 +414,43 @@ 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.includedirs = [ - "include", - os.path.join("include", "open62541", "plugin") - ] + self.cpp_info.libs = collect_libs(self) + self.cpp_info.includedirs = ["include"] # 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") + else: + self.cpp_info.includedirs.append( + os.path.join("include", "open62541", "plugin")) + if Version(self.version) < "1.4.0": + if self.settings.os == "Windows": + self.cpp_info.includedirs.append( + os.path.join("include", "open62541", "win32")) + else: + self.cpp_info.includedirs.append( + os.path.join("include", "open62541", "posix")) + if self.settings.os == "Windows": self.cpp_info.system_libs.append("ws2_32") - self.cpp_info.includedirs.append(os.path.join("include", "open62541", "win32")) - else: - self.cpp_info.includedirs.append(os.path.join("include", "open62541", "posix")) - if self.settings.os in ("Linux", "FreeBSD"): + if Version(self.version) >= "1.4.6": + self.cpp_info.system_libs.append("iphlpapi") + elif 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-disable-sanitizers-1_3_x.patch b/recipes/open62541/all/patches/0001-disable-sanitizers-1_3_x.patch new file mode 100644 index 0000000000000..a2c9d60322e4f --- /dev/null +++ b/recipes/open62541/all/patches/0001-disable-sanitizers-1_3_x.patch @@ -0,0 +1,24 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 5300b12f6..9a80321da 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -749,19 +749,6 @@ if(NOT UA_FORCE_CPP AND (CMAKE_COMPILER_IS_GNUCC OR "x${CMAKE_C_COMPILER_ID}" ST + # Linker + 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 +- "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 +- message(STATUS "Sanitizer enabled") +- set(SANITIZER_FLAGS "-g -fno-omit-frame-pointer -gline-tables-only -fsanitize=address -fsanitize-address-use-after-scope -fsanitize=leak -fsanitize=undefined") +- if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10.0) +- set(SANITIZER_FLAGS "${SANITIZER_FLAGS} -fsanitize-coverage=trace-pc-guard") +- endif() +- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SANITIZER_FLAGS}") +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SANITIZER_FLAGS}") +- endif() + + if(NOT MINGW AND UA_ENABLE_HARDENING AND ((CMAKE_BUILD_TYPE STREQUAL "Release") OR (CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo"))) + check_add_cc_flag("-D_FORTIFY_SOURCE=2") # run-time buffer overflow detection (needs at least -O1) diff --git a/recipes/open62541/all/patches/0001-disable-sanitizers-1_4_x.patch b/recipes/open62541/all/patches/0001-disable-sanitizers-1_4_x.patch new file mode 100644 index 0000000000000..841418b28bf86 --- /dev/null +++ b/recipes/open62541/all/patches/0001-disable-sanitizers-1_4_x.patch @@ -0,0 +1,35 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index c18a457..951efe4 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -666,18 +666,18 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang") + set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # cmake sets -rdynamic by default + + # Debug +- if(UA_ENABLE_DEBUG_SANITIZER AND BUILD_TYPE_LOWER_CASE STREQUAL "debug" AND UNIX AND NOT UA_BUILD_OSS_FUZZ AND +- CMAKE_C_COMPILER_ID STREQUAL "Clang" 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 +- message(STATUS "Sanitizer enabled") +- set(SANITIZER_FLAGS "-g -fno-omit-frame-pointer -gline-tables-only -fsanitize=address -fsanitize-address-use-after-scope -fsanitize=leak -fsanitize=undefined") +- if(CMAKE_CXX_COMPILER_VERSION AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10.0) +- set(SANITIZER_FLAGS "${SANITIZER_FLAGS} -fsanitize-coverage=trace-pc-guard") +- endif() +- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SANITIZER_FLAGS}") +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SANITIZER_FLAGS}") +- endif() ++ # if(UA_ENABLE_DEBUG_SANITIZER AND BUILD_TYPE_LOWER_CASE STREQUAL "debug" AND UNIX AND NOT UA_BUILD_OSS_FUZZ AND ++ # CMAKE_C_COMPILER_ID STREQUAL "Clang" 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 ++ # message(STATUS "Sanitizer enabled") ++ # set(SANITIZER_FLAGS "-g -fno-omit-frame-pointer -gline-tables-only -fsanitize=address -fsanitize-address-use-after-scope -fsanitize=leak -fsanitize=undefined") ++ # if(CMAKE_CXX_COMPILER_VERSION AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10.0) ++ # set(SANITIZER_FLAGS "${SANITIZER_FLAGS} -fsanitize-coverage=trace-pc-guard") ++ # endif() ++ # set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SANITIZER_FLAGS}") ++ # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SANITIZER_FLAGS}") ++ # endif() + + if(NOT MINGW AND UA_ENABLE_HARDENING AND ((CMAKE_BUILD_TYPE STREQUAL "Release") OR (CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo"))) + check_add_cc_flag("-D_FORTIFY_SOURCE=2") # run-time buffer overflow detection (needs at least -O1) 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_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/0002-disable-sanitizers-1_1_3-and-1_1_5.patch b/recipes/open62541/all/patches/0002-disable-sanitizers-1_1_3-and-1_1_5.patch deleted file mode 100644 index d8c1db13840da..0000000000000 --- a/recipes/open62541/all/patches/0002-disable-sanitizers-1_1_3-and-1_1_5.patch +++ /dev/null @@ -1,23 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 2fd6ef29..cde6a08c 100755 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -576,18 +576,6 @@ if(NOT UA_FORCE_CPP AND (CMAKE_COMPILER_IS_GNUCC OR "x${CMAKE_C_COMPILER_ID}" ST - # Linker - set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # cmake sets -rdynamic by default - -- # Debug -- if(BUILD_TYPE_LOWER_CASE STREQUAL "debug" AND UNIX) -- if("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 -- message(STATUS "Sanitizer enabled") -- set(SANITIZER_FLAGS "-g -fno-omit-frame-pointer -gline-tables-only -fsanitize=address -fsanitize-address-use-after-scope -fsanitize-coverage=trace-pc-guard,trace-cmp -fsanitize=leak -fsanitize=undefined") -- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SANITIZER_FLAGS}") -- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SANITIZER_FLAGS}") -- endif() -- endif() -- - if (NOT MINGW) - if(UA_ENABLE_HARDENING AND ((CMAKE_BUILD_TYPE STREQUAL "Release") OR (CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo"))) - check_add_cc_flag("-D_FORTIFY_SOURCE=2") # run-time buffer overflow detection (needs at least -O1) diff --git a/recipes/open62541/all/patches/0004-include-iphlpapi.patch b/recipes/open62541/all/patches/0004-include-iphlpapi.patch new file mode 100644 index 0000000000000..4af83a9e4709b --- /dev/null +++ b/recipes/open62541/all/patches/0004-include-iphlpapi.patch @@ -0,0 +1,15 @@ +diff --git a/src/ua_util.c b/src/ua_util.c +index 13eb0fb..d832f0a 100644 +--- a/src/ua_util.c ++++ b/src/ua_util.c +@@ -11,6 +11,10 @@ + * unit for the generated code from UA_INLINABLE definitions. */ + #define UA_INLINABLE_IMPL 1 + ++#if defined(_WIN32) ++# include ++# include ++#endif + #include + #include + 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..ec323bcad9aa0 100644 --- a/recipes/open62541/all/submoduledata.yml +++ b/recipes/open62541/all/submoduledata.yml @@ -1,41 +1,31 @@ submodules: - "1.0.3": + "1.4.6": deps/ua-nodeset: - sha256: a2bcc1cda0154091ecbed25b8c40436c5b75d11bb38df28b35a2ceedb331d562 - url: https://github.com/OPCFoundation/UA-Nodeset/archive/Errata-1.04.5.zip + url: "https://github.com/OPCFoundation/UA-Nodeset/archive/Machinery-1.03.0-2023-08-01.zip" + sha256: "b1677e7114004f44103159ae7a2fb220958e6f645177c9d140f6acfe469b8eb8" archive_pattern: "UA-Nodeset-{version}" - "1.0.6": + "1.3.9": deps/ua-nodeset: - sha256: c9c0228ce640bf4eead31b9c0b5b7190bc197a2d393a8e90328d14cb45805637 - url: https://github.com/OPCFoundation/UA-Nodeset/archive/UA-1.04.8-2020-11-20.zip + url: "https://github.com/OPCFoundation/UA-Nodeset/archive/Glass=1.0.0-2022-01-01.zip" + sha256: "032c93e3f7c335bbb2d2d699804a804c9cdce2a2ecc3fe7cde552f2130982c26" archive_pattern: "UA-Nodeset-{version}" - "1.1.3": + "1.3.8": deps/ua-nodeset: - sha256: a2bcc1cda0154091ecbed25b8c40436c5b75d11bb38df28b35a2ceedb331d562 - url: https://github.com/OPCFoundation/UA-Nodeset/archive/Errata-1.04.5.zip + url: "https://github.com/OPCFoundation/UA-Nodeset/archive/Glass=1.0.0-2022-01-01.zip" + sha256: "032c93e3f7c335bbb2d2d699804a804c9cdce2a2ecc3fe7cde552f2130982c26" archive_pattern: "UA-Nodeset-{version}" - "1.1.5": + "1.2.6": deps/ua-nodeset: - sha256: a2bcc1cda0154091ecbed25b8c40436c5b75d11bb38df28b35a2ceedb331d562 - url: https://github.com/OPCFoundation/UA-Nodeset/archive/Errata-1.04.5.zip + url: "https://github.com/OPCFoundation/UA-Nodeset/archive/Errata-1.04.5.zip" + sha256: "a2bcc1cda0154091ecbed25b8c40436c5b75d11bb38df28b35a2ceedb331d562" archive_pattern: "UA-Nodeset-{version}" "1.1.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.2.2": - deps/ua-nodeset: - sha256: a2bcc1cda0154091ecbed25b8c40436c5b75d11bb38df28b35a2ceedb331d562 - url: https://github.com/OPCFoundation/UA-Nodeset/archive/Errata-1.04.5.zip + url: "https://github.com/OPCFoundation/UA-Nodeset/archive/Errata-1.04.5.zip" + sha256: "a2bcc1cda0154091ecbed25b8c40436c5b75d11bb38df28b35a2ceedb331d562" archive_pattern: "UA-Nodeset-{version}" - "1.2.4": - 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": + "1.0.6": deps/ua-nodeset: - sha256: a2bcc1cda0154091ecbed25b8c40436c5b75d11bb38df28b35a2ceedb331d562 - url: https://github.com/OPCFoundation/UA-Nodeset/archive/Errata-1.04.5.zip + url: "https://github.com/OPCFoundation/UA-Nodeset/archive/UA-1.04.8-2020-11-20.zip" + sha256: "c9c0228ce640bf4eead31b9c0b5b7190bc197a2d393a8e90328d14cb45805637" 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..099ba922c1149 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,17 @@ 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..85d0878ec465b 100644 --- a/recipes/open62541/all/test_package/conanfile.py +++ b/recipes/open62541/all/test_package/conanfile.py @@ -1,25 +1,37 @@ -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", "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.dependencies["ua-nodeset"].conf_info.get( + "user.ua-nodeset:nodeset_dir").replace("\\", "/") # sanitize path for windows systems + tc.variables["open62541_TOOLS_DIR"] = self.dependencies["open62541"].conf_info.get( + "user.open62541:tools_dir") + tc.variables["UA_SCHEMA_DIR"] = os.path.join(self.dependencies["ua-nodeset"].conf_info.get("user.ua-nodeset:nodeset_dir"), "Schema").replace("\\", "/") + 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.c b/recipes/open62541/all/test_package/test_package.c new file mode 100644 index 0000000000000..ee2c13af0aa82 --- /dev/null +++ b/recipes/open62541/all/test_package/test_package.c @@ -0,0 +1,53 @@ +#ifdef UA_ENABLE_AMALGAMATION +#include +#else +#include +#include +#include +#endif + +/* Files namespace_foo_flt_generated.h and namespace_foo_flt_generated.c are created from FooFlt.NodeSet2.xml in the + * /src_generated directory by CMake */ +#include "foo_flt_nodeids.h" +#include "namespace_foo_flt_generated.h" +#include +#include + +UA_Boolean running = false; + +static void server_stop_callback(UA_Server *server, void *data) { + UA_LOG_INFO(UA_Log_Stdout, UA_LOGCATEGORY_SERVER, "stopping server due to timer"); + running = false; +} + +int main(void) { + UA_Server *server = UA_Server_new(); + running = true; + UA_StatusCode return_code; + UA_UInt16 portNumber = 4840; + UA_ServerConfig_setMinimal(UA_Server_getConfig(server), portNumber, NULL); + UA_Server_addRepeatedCallback(server, server_stop_callback, NULL, 500., NULL); + + /* create nodes from nodeset */ + if(namespace_foo_flt_generated(server) != UA_STATUSCODE_GOOD) + { + UA_LOG_ERROR(UA_Log_Stdout, UA_LOGCATEGORY_SERVER, "Could not add the Foo FLT nodeset. " + "Check previous output for any error."); + return_code = UA_STATUSCODE_BADUNEXPECTEDERROR; + } + else + { + // Do some additional stuff with the nodes + // this will just get the namespace index, since it is already added to the server + UA_UInt16 nsIdx = UA_Server_addNamespace(server, "https://new.foo.com/zebra-compression/flattening-and-subspacefolding/UA/"); + UA_NodeId testInstanceId = UA_NODEID_NUMERIC(nsIdx, UA_FOO_FLTID_APE); + UA_LOG_INFO(UA_Log_Stdout, UA_LOGCATEGORY_SERVER, "The Ape has ns=%d;id=%d", + testInstanceId.namespaceIndex, testInstanceId.identifier.numeric); + + // return_code = UA_Server_run(server, &running); + return_code = UA_STATUSCODE_GOOD; + } + running = false; + UA_Server_delete(server); + return return_code == UA_STATUSCODE_GOOD ? EXIT_SUCCESS : EXIT_FAILURE; +} diff --git a/recipes/open62541/all/test_package/test_package_nodeset.c b/recipes/open62541/all/test_package/test_package_nodeset.c deleted file mode 100644 index 31232fcb703bd..0000000000000 --- a/recipes/open62541/all/test_package/test_package_nodeset.c +++ /dev/null @@ -1,75 +0,0 @@ -#ifdef UA_ENABLE_AMALGAMATION -#include -#else -#include -#include -#include -#include -#endif - -/* Files namespace_foo_flt_generated.h and namespace_foo_flt_generated.c are created from FooFlt.NodeSet2.xml in the - * /src_generated directory by CMake */ -#include "foo_flt_nodeids.h" -#include "namespace_foo_flt_generated.h" -#include -#include -#include - -UA_Boolean running = false; - -static void server_stop_callback(UA_Server *server, void *data) { - UA_LOG_INFO(UA_Log_Stdout, UA_LOGCATEGORY_SERVER, "stopping server due to timer"); - running = false; -} - -int main(void) { - UA_Server *server = UA_Server_new(); - running = true; - UA_StatusCode return_code; - UA_UInt16 portNumber = 4840; - UA_ServerConfig_setMinimal(UA_Server_getConfig(server), portNumber, NULL); - UA_Server_addRepeatedCallback(server, server_stop_callback, NULL, 500., NULL); - - /* create nodes from nodeset */ - if(namespace_foo_flt_generated(server) != UA_STATUSCODE_GOOD) - { - UA_LOG_ERROR(UA_Log_Stdout, UA_LOGCATEGORY_SERVER, "Could not add the Foo FLT nodeset. " - "Check previous output for any error."); - return_code = UA_STATUSCODE_BADUNEXPECTEDERROR; - } - else - { - // Do some additional stuff with the nodes - // this will just get the namespace index, since it is already added to the server - UA_UInt16 nsIdx = UA_Server_addNamespace(server, "https://new.foo.com/zebra-compression/flattening-and-subspacefolding/UA/"); - UA_NodeId testInstanceId = UA_NODEID_NUMERIC(nsIdx, UA_FOO_FLTID_APE); - UA_LOG_INFO(UA_Log_Stdout, UA_LOGCATEGORY_SERVER, "The Ape has ns=%d;id=%d", - testInstanceId.namespaceIndex, testInstanceId.identifier.numeric); - - return_code = UA_Server_run(server, &running); - - while(return_code == UA_STATUSCODE_BADCOMMUNICATIONERROR) - { - running = false; - portNumber = portNumber + 1; - UA_Server_getConfig(server)->networkLayersSize = 0; - UA_ServerConfig_addNetworkLayerTCP(UA_Server_getConfig(server), portNumber, 0, 0); - running = true; - return_code = UA_Server_run(server, &running); - - if(return_code == UA_STATUSCODE_GOOD) - { - printf("free port found"); - break; - } - else if(portNumber>4850) - { - printf("ports from 4840 to 4850 are not avilable"); - break; - } - } - } - running = false; - UA_Server_delete(server); - return return_code == UA_STATUSCODE_GOOD ? EXIT_SUCCESS : EXIT_FAILURE; -} diff --git a/recipes/open62541/config.yml b/recipes/open62541/config.yml index eb0be7a7f5d36..9dae87e5721a3 100644 --- a/recipes/open62541/config.yml +++ b/recipes/open62541/config.yml @@ -1,17 +1,13 @@ versions: - "1.3.1": + "1.4.6": folder: all - "1.2.4": + "1.3.9": folder: all - "1.2.2": + "1.3.8": folder: all - "1.1.6": - folder: all - "1.1.5": + "1.2.6": folder: all - "1.1.3": + "1.1.6": folder: all "1.0.6": folder: all - "1.0.3": - folder: all diff --git a/recipes/openal-soft/all/conandata.yml b/recipes/openal-soft/all/conandata.yml new file mode 100644 index 0000000000000..23bf0e0ad9976 --- /dev/null +++ b/recipes/openal-soft/all/conandata.yml @@ -0,0 +1,16 @@ +sources: + "1.23.1": + url: + - "https://github.com/kcat/openal-soft/releases/download/1.23.1/openal-soft-1.23.1.tar.bz2" + - "https://openal-soft.org/openal-releases/openal-soft-1.23.1.tar.bz2" + sha256: "796f4b89134c4e57270b7f0d755f0fa3435b90da437b745160a49bd41c845b21" + "1.22.2": + url: + - "https://github.com/kcat/openal-soft/releases/download/1.22.2/openal-soft-1.22.2.tar.bz2" + - "https://openal-soft.org/openal-releases/openal-soft-1.22.2.tar.bz2" + sha256: "ae94cc95cda76b7cc6e92e38c2531af82148e76d3d88ce996e2928a1ea7c3d20" +patches: + "1.22.2": + - patch_file: "patches/1.22.2-0001-fix-al-optional-in-if-compile-error.patch" + patch_source: "https://github.com/kcat/openal-soft/commit/650a6d49e9a511d005171940761f6dd6b440ee66" + - patch_file: "patches/1.22.2-0002-fix-pulseaudio-find-package-vars.patch" diff --git a/recipes/openal-soft/all/conanfile.py b/recipes/openal-soft/all/conanfile.py new file mode 100644 index 0000000000000..885d85434ec21 --- /dev/null +++ b/recipes/openal-soft/all/conanfile.py @@ -0,0 +1,158 @@ +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" + package_type = "library" + 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 _minimum_compilers_version(self): + return { + "Visual Studio": "15", + "msvc": "191", + "gcc": "6", + "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") + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + if self.settings.os == "Linux": + self.requires("libalsa/1.2.10") + + def validate(self): + 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(f"""\ + 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() + set(OPENAL_VERSION_STRING {self.version}) + """) + 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 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") + if self.settings.get_safe("compiler.libcxx") in ["libstdc++", "libstdc++11"]: + self.cpp_info.system_libs.append("atomic") diff --git a/recipes/openal-soft/all/patches/1.22.2-0001-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 new file mode 100644 index 0000000000000..6e0e4aa8641f8 --- /dev/null +++ b/recipes/openal-soft/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-soft/all/patches/1.22.2-0002-fix-pulseaudio-find-package-vars.patch b/recipes/openal-soft/all/patches/1.22.2-0002-fix-pulseaudio-find-package-vars.patch new file mode 100644 index 0000000000000..ff97aae372563 --- /dev/null +++ b/recipes/openal-soft/all/patches/1.22.2-0002-fix-pulseaudio-find-package-vars.patch @@ -0,0 +1,15 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 1984ac9..75e904d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1051,8 +1051,8 @@ if(PULSEAUDIO_FOUND) + set(HAVE_PULSEAUDIO 1) + set(BACKENDS "${BACKENDS} PulseAudio${IS_LINKED},") + set(ALC_OBJS ${ALC_OBJS} alc/backends/pulseaudio.cpp alc/backends/pulseaudio.h) +- add_backend_libs(${PULSEAUDIO_LIBRARIES}) +- set(INC_PATHS ${INC_PATHS} ${PULSEAUDIO_INCLUDE_DIRS}) ++ add_backend_libs(${PULSEAUDIO_LIBRARY}) ++ set(INC_PATHS ${INC_PATHS} ${PULSEAUDIO_INCLUDE_DIR}) + endif() + endif() + if(ALSOFT_REQUIRE_PULSEAUDIO AND NOT HAVE_PULSEAUDIO) 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..6822e9962142c --- /dev/null +++ b/recipes/openal-soft/all/test_package/CMakeLists.txt @@ -0,0 +1,22 @@ +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) + +# Test whether variables from https://cmake.org/cmake/help/latest/module/FindOpenAL.html are properly defined +set(_custom_vars + OPENAL_FOUND + OPENAL_INCLUDE_DIR + OPENAL_LIBRARY + OPENAL_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/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..a3a476fc04f3a --- /dev/null +++ b/recipes/openal-soft/config.yml @@ -0,0 +1,5 @@ +versions: + "1.23.1": + folder: all + "1.22.2": + folder: all diff --git a/recipes/openal/all/conandata.yml b/recipes/openal/all/conandata.yml index 909139e9bcbd7..39085eaa09938 100644 --- a/recipes/openal/all/conandata.yml +++ b/recipes/openal/all/conandata.yml @@ -1,19 +1,19 @@ 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": - patch_file: "patches/1.22.2-0001-fix-al-optional-in-if-compile-error.patch" @@ -21,17 +21,17 @@ patches: - 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: "backport" + 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: "backport" + 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: "backport" + 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 ad9125032f896..4de9550fc2a4b 100644 --- a/recipes/openal/all/conanfile.py +++ b/recipes/openal/all/conanfile.py @@ -1,18 +1,19 @@ 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.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, rmdir, save +from conan.tools.files import apply_conandata_patches, collect_libs, export_conandata_patches, copy, get, rmdir, save from conan.tools.scm import Version -from conans import tools as tools_legacy import os import textwrap -required_conan_version = ">=1.51.3" +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") @@ -48,8 +49,7 @@ def _minimum_compilers_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": @@ -57,12 +57,12 @@ def config_options(self): 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") @@ -73,10 +73,10 @@ def requirements(self): def validate(self): if self._openal_cxx_backend: - if self.info.settings.compiler.get_safe("cppstd"): + if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, self._min_cppstd) - compiler = self.info.settings.compiler + compiler = self.settings.compiler minimum_version = self._minimum_compilers_version.get(str(compiler), False) if minimum_version and Version(compiler.version) < minimum_version: @@ -91,8 +91,7 @@ def validate(self): ) 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) @@ -155,11 +154,13 @@ def package_info(self): 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", "CoreAudio", "CoreFoundation"]) + 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"]) + self.cpp_info.system_libs.extend(["winmm", "ole32", "shell32", "user32"]) if self._openal_cxx_backend and not self.options.shared: - libcxx = tools_legacy.stdcpp_library(self) + libcxx = stdcpp_library(self) if libcxx: self.cpp_info.system_libs.append(libcxx) if not self.options.shared: diff --git a/recipes/openal/all/test_v1_package/CMakeLists.txt b/recipes/openal/all/test_v1_package/CMakeLists.txt index 6ea75c1516be0..0d20897301b68 100644 --- a/recipes/openal/all/test_v1_package/CMakeLists.txt +++ b/recipes/openal/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(OpenAL REQUIRED) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE OpenAL::OpenAL) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/openapi-generator/all/conandata.yml b/recipes/openapi-generator/all/conandata.yml index 9ae4cad2b21d4..94d684c5ba1bc 100644 --- a/recipes/openapi-generator/all/conandata.yml +++ b/recipes/openapi-generator/all/conandata.yml @@ -1,13 +1,13 @@ sources: - "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" - "6.2.0": - url: "https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/6.2.0/openapi-generator-cli-6.2.0.jar" - sha256: "60707e2c8938a94278f6216081d7067d0f1beced8c8eb1277e625e9a59ccd2da" - "6.1.0": - url: "https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/6.1.0/openapi-generator-cli-6.1.0.jar" - sha256: "3bcbff776072e4e5161307f837d34ab4713a13ed9edc20e4983c2321791ea037" - "6.0.1": - url: "https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/6.0.1/openapi-generator-cli-6.0.1.jar" - sha256: "ba9279900d1fefc9f0b977264b709f7d481c278d6780090b36673b65cb1a9122" + "7.8.0": + url: "https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.8.0/openapi-generator-cli-7.8.0.jar" + sha256: "d1879cf42da31f8cf61cf68798b8ef2418af0c6bd93a5c1870e1ff543fbb9365" + "7.5.0": + url: "https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.5.0/openapi-generator-cli-7.5.0.jar" + sha256: "47ebbd1beddaf7dfbee523e7b87623c6ec1b1d42960fbe15f6cad2f6426c69bf" + "7.4.0": + url: "https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.4.0/openapi-generator-cli-7.4.0.jar" + sha256: "e42769a98fef5634bee0f921e4b90786a6b3292aa11fe8d2f84c045ac435ab29" + "6.6.0": + url: "https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/6.6.0/openapi-generator-cli-6.6.0.jar" + sha256: "9718ff7844e89462c75dcd9b20a35136f6db257bfe1b874db1e3002e99de4609" diff --git a/recipes/openapi-generator/all/conanfile.py b/recipes/openapi-generator/all/conanfile.py index 2f6139881be2a..907abc8f087d1 100644 --- a/recipes/openapi-generator/all/conanfile.py +++ b/recipes/openapi-generator/all/conanfile.py @@ -20,7 +20,7 @@ def layout(self): pass def requirements(self): - self.requires("openjdk/16.0.1") + self.requires("openjdk/21.0.1") def package_id(self): del self.info.settings.arch @@ -48,7 +48,7 @@ def build(self): 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": + if self.settings.os == "Windows": save(self, path=os.path.join(self.package_folder, "bin", "openapi-generator.bat"), content="""\ diff --git a/recipes/openapi-generator/config.yml b/recipes/openapi-generator/config.yml index 163f34ba9d4f3..f7485451c5674 100644 --- a/recipes/openapi-generator/config.yml +++ b/recipes/openapi-generator/config.yml @@ -1,9 +1,9 @@ versions: - "6.2.1": + "7.8.0": folder: all - "6.2.0": + "7.5.0": folder: all - "6.1.0": + "7.4.0": folder: all - "6.0.1": + "6.6.0": folder: all diff --git a/recipes/openassetio/all/conandata.yml b/recipes/openassetio/all/conandata.yml new file mode 100644 index 0000000000000..c866999f64398 --- /dev/null +++ b/recipes/openassetio/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.0.0-alpha.9": + url: "https://github.com/OpenAssetIO/OpenAssetIO/archive/v1.0.0-alpha.9.tar.gz" + sha256: "1e65e405b4e52128401ad8e8d609baea85c1697de686c7d19870c8d4566f531e" diff --git a/recipes/openassetio/all/conanfile.py b/recipes/openassetio/all/conanfile.py new file mode 100644 index 0000000000000..ad052d19eaab0 --- /dev/null +++ b/recipes/openassetio/all/conanfile.py @@ -0,0 +1,160 @@ +import pathlib +import os + +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import check_min_vs, is_msvc +from conan.tools.apple import is_apple_os +from conan.tools.files import apply_conandata_patches, get, copy, rm +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 + + +required_conan_version = ">=1.53.0" + + +class PackageConan(ConanFile): + name = "openassetio" + description = "An open-source interoperability standard for tools and content management systems used in media production." + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/OpenAssetIO/OpenAssetIO" + topics = ("asset-pipeline", "vfx", "cg", "assetmanager", "vfx-pipeline") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "with_python": [True, False], + } + default_options = { + "shared": False, + "with_python": True, + } + short_paths = True + + @property + def _min_cppstd(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "9", + "clang": "12", + "apple-clang": "12", + } + + def configure(self): + if self.options.with_python: + if is_msvc(self): + # Required to create import .lib for building extension module. + self.options["cpython"].shared = True + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires("tomlplusplus/3.2.0") + if self.options.with_python: + # TODO: cpython requires ncurses/6.2 but no pre-built package exists. + self.requires("ncurses/6.3") + self.requires("cpython/3.9.7") + self.requires("pybind11/2.10.1") + + def validate(self): + if is_apple_os(self): + raise ConanInvalidConfiguration( + f"{self.ref} does not support MacOS at this time" + ) + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + + if is_msvc(self) and not self.dependencies["cpython"].options.shared: + raise ConanInvalidConfiguration(f"{self.ref} requires cpython:shared=True when using MSVC compiler") + + 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." + ) + + def build_requirements(self): + self.tool_requires("cmake/3.25.3") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + + tc.variables["OPENASSETIO_ENABLE_TESTS"] = not self.conf.get("tools.build:skip_test", default=True, check_type=bool) + + tc.variables["OPENASSETIO_GLIBCXX_USE_CXX11_ABI"] = self.settings.get_safe("compiler.libcxx") == "libstdc++11" + + tc.variables["OPENASSETIO_ENABLE_PYTHON"] = self.options.with_python + if self.options.with_python: + tc.variables["Python_EXECUTABLE"] = self._python_exe + if is_msvc(self): + tc.variables["Python_LIBRARY"] = self._python_windows_lib + + tc.generate() + tc = CMakeDeps(self) + tc.generate() + tc = VirtualBuildEnv(self) + tc.generate() + + @property + def _python_exe(self): + # TODO: update to V2 once cpython is updated + return pathlib.Path(self.deps_user_info["cpython"].python).as_posix() + + @property + def _python_windows_lib(self): + pth = pathlib.Path( + self.dependencies["cpython"].package_folder, + self.dependencies["cpython"].cpp_info.components["embed"].libdirs[0], + self.dependencies["cpython"].cpp_info.components["embed"].libs[0]) + pth = pth.with_suffix(".lib") + return pth.as_posix() + + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package_id(self): + if self.options.with_python: + self.info.requires["cpython"].minor_mode() + + 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, "OpenAssetIOConfig*.cmake", os.path.join(self.package_folder, "lib", "cmake", "OpenAssetIO")) + rm(self, "OpenAssetIOTargets*.cmake", os.path.join(self.package_folder, "lib", "cmake", "OpenAssetIO")) + 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 = [] + self.cpp_info.set_property("cmake_file_name", "OpenAssetIO") + self.cpp_info.set_property("cmake_target_name", "OpenAssetIO::OpenAssetIO") + self.cpp_info.set_property("cmake_build_modules", [os.path.join("lib", "cmake", "OpenAssetIO", "OpenAssetIOVariables.cmake")]) + self.cpp_info.builddirs = [os.path.join("lib", "cmake")] + + self.cpp_info.components["openassetio-core"].set_property("cmake_target_name", "OpenAssetIO::openassetio-core") + self.cpp_info.components["openassetio-core"].libs = ["openassetio"] + if self.options.with_python: + self.cpp_info.components["openassetio-python-bridge"].set_property("cmake_target_name", "OpenAssetIO::openassetio-python-bridge") + self.cpp_info.components["openassetio-python-bridge"].requires = ["openassetio-core"] + self.cpp_info.components["openassetio-python-bridge"].libs = ["openassetio-python"] + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.names["cmake_find_package"] = "OpenAssetIO" + self.cpp_info.names["cmake_find_package_multi"] = "OpenAssetIO" diff --git a/recipes/openassetio/all/test_package/CMakeLists.txt b/recipes/openassetio/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..96906a3bae2ff --- /dev/null +++ b/recipes/openassetio/all/test_package/CMakeLists.txt @@ -0,0 +1,121 @@ +cmake_minimum_required(VERSION 3.21) +project(OpenAssetIO-Test-Conan) + +enable_testing() +set(CMAKE_CXX_STANDARD 17) + +#----------------------------------------------------------------------- +# Options + +option(OPENASSETIOTEST_ENABLE_PYTHON "Test Python bindings" ON) + +if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND + CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 5.0) + option(OPENASSETIOTEST_GLIBCXX_USE_CXX11_ABI "For gcc, use the new C++11 library ABI" OFF) +endif () + +#----------------------------------------------------------------------- +# OpenAssetIO dependency. +find_package(OpenAssetIO REQUIRED) + +# For Windows tests to work we must add the dlls to the PATH +if (WIN32 AND DEFINED OpenAssetIO_BINARY_DIR) + file(TO_NATIVE_PATH "${OpenAssetIO_BINARY_DIR}" OpenAssetIO_BINARY_DIR_NATIVE) +endif () + +#----------------------------------------------------------------------- +# C++ tests. + +add_executable(test.cpp.core test.core.cpp) +add_test(cpp.core test.cpp.core) +target_link_libraries(test.cpp.core PRIVATE OpenAssetIO::openassetio-core) + +# GCC's C++11 ABI toggle must match OpenAssetIO's settings. +if (DEFINED OPENASSETIOTEST_GLIBCXX_USE_CXX11_ABI) + if (OPENASSETIOTEST_GLIBCXX_USE_CXX11_ABI) + target_compile_definitions(test.cpp.core PRIVATE _GLIBCXX_USE_CXX11_ABI=1) + else () + target_compile_definitions(test.cpp.core PRIVATE _GLIBCXX_USE_CXX11_ABI=0) + endif () +endif () + +if (WIN32 AND DEFINED OpenAssetIO_BINARY_DIR) + set_tests_properties(cpp.core PROPERTIES ENVIRONMENT "PATH=${OpenAssetIO_BINARY_DIR_NATIVE}") +endif () + +#----------------------------------------------------------------------- +# Python tests. + +if (OPENASSETIOTEST_ENABLE_PYTHON) + find_package(Python COMPONENTS Interpreter Development.Embed REQUIRED) + + #----------------------------------------------------------------------- + # Python sources tests. + + # Python sources test. + # -s - ignore the user site-directory (avoid unexpected things + # leaking in). + add_test(NAME python COMMAND ${Python_EXECUTABLE} -s ${PROJECT_SOURCE_DIR}/test.py) + set_tests_properties(python PROPERTIES ENVIRONMENT PYTHONPATH=${OpenAssetIO_Python_SITELIB}) + + #----------------------------------------------------------------------- + # Python bridge test (loading Python plugin system from C++). + + add_executable(test.python.bridge test.python.bridge.cpp) + add_test(python.bridge.cpp test.python.bridge) + target_link_libraries( + test.python.bridge + PRIVATE + OpenAssetIO::openassetio-python-bridge + Python::Python + ) + target_compile_features(test.python.bridge PRIVATE cxx_std_17) + # If libpython is linked in as a static library, then we must export + # symbols for dynamically loaded Python extension modules to use. + set_target_properties(test.python.bridge PROPERTIES ENABLE_EXPORTS ON) + + # Storage for list of environment variables to set before running + # the test. + set(_envvars) + + # Add location of Python sources in the OpenAssetIO package to the + # PYTHONPATH. + list(APPEND _envvars "PYTHONPATH=${OpenAssetIO_Python_SITELIB}") + + # The test has an embedded Python interpreter, but is missing all + # the required basic Python libraries, so we need to set PYTHONHOME + # to the source Python package to avoid nasty errors. + execute_process( + COMMAND ${Python_EXECUTABLE} -c "import sys; sys.stdout.write(sys.prefix)" + OUTPUT_VARIABLE Python_PREFIX + ) + list(APPEND _envvars "PYTHONHOME=${Python_PREFIX}") + + # Fix library search path on MacOS. + if (APPLE) + # The `Python::Python` target's link options are set to e.g + # `@rpath/Python.framework/Versions/3.9/Python` but all our + # target's (CMake generated) @rpaths already contain + # `Python.framework/Versions/3.9`. So add another RPATH with + # the framework subdirectories stripped. This then allows our + # test target to find the Python library. + set_target_properties(test.python.bridge PROPERTIES BUILD_RPATH ${Python_PREFIX}/../../..) + endif () + + # Augment the PATH on Windows to find Python library dlls. + if (WIN32) + if (DEFINED OpenAssetIO_BINARY_DIR) + list(APPEND _envvars.path ${OpenAssetIO_BINARY_DIR_NATIVE}) + endif () + foreach (path ${Python_RUNTIME_LIBRARY_DIRS}) + file(TO_NATIVE_PATH "${path}" path_native) + list(APPEND _envvars.path ${path_native}) + endforeach () + # Frustratingly, $ doesn't work here, we have to find + # the magic number of backslashes instead. + list(JOIN _envvars.path \\\; _envvars.path) + list(APPEND _envvars "PATH=${_envvars.path}") + endif () + + set_tests_properties(python.bridge.cpp PROPERTIES ENVIRONMENT "${_envvars}") +endif () diff --git a/recipes/openassetio/all/test_package/conanfile.py b/recipes/openassetio/all/test_package/conanfile.py new file mode 100644 index 0000000000000..54be6cdb23d9f --- /dev/null +++ b/recipes/openassetio/all/test_package/conanfile.py @@ -0,0 +1,66 @@ +import pathlib + +from conan import ConanFile +from conan.tools.microsoft import is_msvc +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake, CMakeToolchain, CMakeDeps + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def build_requirements(self): + self.tool_requires("cmake/3.25.3") + + def requirements(self): + self.requires(self.tested_reference_str) + + if "with_python" not in self.options["openassetio"] or self.options["openassetio"].with_python: + self.requires("cpython/3.9.7") + + def layout(self): + cmake_layout(self) + + def generate(self): + tc = CMakeToolchain(self) + + tc.variables["OPENASSETIOTEST_GLIBCXX_USE_CXX11_ABI"] = self.settings.get_safe("compiler.libcxx") == "libstdc++11" + tc.variables["OPENASSETIOTEST_ENABLE_PYTHON"] = self.dependencies["openassetio"].options.with_python + + if self.dependencies["openassetio"].options.with_python: + tc.variables["Python_EXECUTABLE"] = self._python_exe + if is_msvc(self): + tc.variables["Python_LIBRARY"] = self._python_windows_lib + if self.settings.compiler == "clang": + # Work around cpython recipe bug. + # FIXME: remove once fixed upstream. + tc.variables["CMAKE_EXE_LINKER_FLAGS"] = "-lpthread" + + tc.generate() + tc = CMakeDeps(self) + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + cmake = CMake(self) + cmake.test() + + @property + def _python_exe(self): + return pathlib.Path(self.deps_user_info["cpython"].python).as_posix() + + @property + def _python_windows_lib(self): + pth = pathlib.Path( + self.dependencies["cpython"].package_folder, + self.dependencies["cpython"].cpp_info.components["embed"].libdirs[0], + self.dependencies["cpython"].cpp_info.components["embed"].libs[0]) + pth = pth.with_suffix(".lib") + return pth.as_posix() diff --git a/recipes/openassetio/all/test_package/test.core.cpp b/recipes/openassetio/all/test_package/test.core.cpp new file mode 100644 index 0000000000000..9a8d67cb237d5 --- /dev/null +++ b/recipes/openassetio/all/test_package/test.core.cpp @@ -0,0 +1,9 @@ +// Include all headers to test they are where we expect and can be +// compiled. +#include + +int main() { + auto traits = openassetio::TraitsData::make(); + traits->setTraitProperty("a", "b", openassetio::Str{"c"}); + return 0; +} diff --git a/recipes/openassetio/all/test_package/test.py b/recipes/openassetio/all/test_package/test.py new file mode 100644 index 0000000000000..b6dbc60c44009 --- /dev/null +++ b/recipes/openassetio/all/test_package/test.py @@ -0,0 +1,15 @@ +import sys + +try: + import openassetio + from openassetio.hostApi import ManagerFactory +except ImportError as exc: + print("Error importing openassetio package: {}".format(exc)) + print("Using python executable: {}".format(sys.executable)) + print("With PYTHONPATH:") + for i in sys.path: + print("\t{}".format(i)) + sys.exit(1) + +print("openassetio found at {}".format(openassetio.__file__)) +sys.exit(0) diff --git a/recipes/openassetio/all/test_package/test.python.bridge.cpp b/recipes/openassetio/all/test_package/test.python.bridge.cpp new file mode 100644 index 0000000000000..60f0cf0e94df0 --- /dev/null +++ b/recipes/openassetio/all/test_package/test.python.bridge.cpp @@ -0,0 +1,25 @@ +#include + +#include + +#include +#include +#include + +namespace { +struct DummyLoggerInterface : openassetio::log::LoggerInterface { + void log(Severity severity, const openassetio::Str& message) override {} +}; +} // namespace + +int main() { + Py_Initialize(); + auto logger = std::make_shared(); + { + const auto factory = + openassetio::python::hostApi::createPythonPluginSystemManagerImplementationFactory(logger); + const auto identifiers = factory->identifiers(); + // Must be destroyed before Py_FinalizeEx. + } + Py_FinalizeEx(); +} diff --git a/recipes/openassetio/all/test_v1_package/CMakeLists.txt b/recipes/openassetio/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..96906a3bae2ff --- /dev/null +++ b/recipes/openassetio/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,121 @@ +cmake_minimum_required(VERSION 3.21) +project(OpenAssetIO-Test-Conan) + +enable_testing() +set(CMAKE_CXX_STANDARD 17) + +#----------------------------------------------------------------------- +# Options + +option(OPENASSETIOTEST_ENABLE_PYTHON "Test Python bindings" ON) + +if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND + CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 5.0) + option(OPENASSETIOTEST_GLIBCXX_USE_CXX11_ABI "For gcc, use the new C++11 library ABI" OFF) +endif () + +#----------------------------------------------------------------------- +# OpenAssetIO dependency. +find_package(OpenAssetIO REQUIRED) + +# For Windows tests to work we must add the dlls to the PATH +if (WIN32 AND DEFINED OpenAssetIO_BINARY_DIR) + file(TO_NATIVE_PATH "${OpenAssetIO_BINARY_DIR}" OpenAssetIO_BINARY_DIR_NATIVE) +endif () + +#----------------------------------------------------------------------- +# C++ tests. + +add_executable(test.cpp.core test.core.cpp) +add_test(cpp.core test.cpp.core) +target_link_libraries(test.cpp.core PRIVATE OpenAssetIO::openassetio-core) + +# GCC's C++11 ABI toggle must match OpenAssetIO's settings. +if (DEFINED OPENASSETIOTEST_GLIBCXX_USE_CXX11_ABI) + if (OPENASSETIOTEST_GLIBCXX_USE_CXX11_ABI) + target_compile_definitions(test.cpp.core PRIVATE _GLIBCXX_USE_CXX11_ABI=1) + else () + target_compile_definitions(test.cpp.core PRIVATE _GLIBCXX_USE_CXX11_ABI=0) + endif () +endif () + +if (WIN32 AND DEFINED OpenAssetIO_BINARY_DIR) + set_tests_properties(cpp.core PROPERTIES ENVIRONMENT "PATH=${OpenAssetIO_BINARY_DIR_NATIVE}") +endif () + +#----------------------------------------------------------------------- +# Python tests. + +if (OPENASSETIOTEST_ENABLE_PYTHON) + find_package(Python COMPONENTS Interpreter Development.Embed REQUIRED) + + #----------------------------------------------------------------------- + # Python sources tests. + + # Python sources test. + # -s - ignore the user site-directory (avoid unexpected things + # leaking in). + add_test(NAME python COMMAND ${Python_EXECUTABLE} -s ${PROJECT_SOURCE_DIR}/test.py) + set_tests_properties(python PROPERTIES ENVIRONMENT PYTHONPATH=${OpenAssetIO_Python_SITELIB}) + + #----------------------------------------------------------------------- + # Python bridge test (loading Python plugin system from C++). + + add_executable(test.python.bridge test.python.bridge.cpp) + add_test(python.bridge.cpp test.python.bridge) + target_link_libraries( + test.python.bridge + PRIVATE + OpenAssetIO::openassetio-python-bridge + Python::Python + ) + target_compile_features(test.python.bridge PRIVATE cxx_std_17) + # If libpython is linked in as a static library, then we must export + # symbols for dynamically loaded Python extension modules to use. + set_target_properties(test.python.bridge PROPERTIES ENABLE_EXPORTS ON) + + # Storage for list of environment variables to set before running + # the test. + set(_envvars) + + # Add location of Python sources in the OpenAssetIO package to the + # PYTHONPATH. + list(APPEND _envvars "PYTHONPATH=${OpenAssetIO_Python_SITELIB}") + + # The test has an embedded Python interpreter, but is missing all + # the required basic Python libraries, so we need to set PYTHONHOME + # to the source Python package to avoid nasty errors. + execute_process( + COMMAND ${Python_EXECUTABLE} -c "import sys; sys.stdout.write(sys.prefix)" + OUTPUT_VARIABLE Python_PREFIX + ) + list(APPEND _envvars "PYTHONHOME=${Python_PREFIX}") + + # Fix library search path on MacOS. + if (APPLE) + # The `Python::Python` target's link options are set to e.g + # `@rpath/Python.framework/Versions/3.9/Python` but all our + # target's (CMake generated) @rpaths already contain + # `Python.framework/Versions/3.9`. So add another RPATH with + # the framework subdirectories stripped. This then allows our + # test target to find the Python library. + set_target_properties(test.python.bridge PROPERTIES BUILD_RPATH ${Python_PREFIX}/../../..) + endif () + + # Augment the PATH on Windows to find Python library dlls. + if (WIN32) + if (DEFINED OpenAssetIO_BINARY_DIR) + list(APPEND _envvars.path ${OpenAssetIO_BINARY_DIR_NATIVE}) + endif () + foreach (path ${Python_RUNTIME_LIBRARY_DIRS}) + file(TO_NATIVE_PATH "${path}" path_native) + list(APPEND _envvars.path ${path_native}) + endforeach () + # Frustratingly, $ doesn't work here, we have to find + # the magic number of backslashes instead. + list(JOIN _envvars.path \\\; _envvars.path) + list(APPEND _envvars "PATH=${_envvars.path}") + endif () + + set_tests_properties(python.bridge.cpp PROPERTIES ENVIRONMENT "${_envvars}") +endif () diff --git a/recipes/openassetio/all/test_v1_package/conanfile.py b/recipes/openassetio/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..54be6cdb23d9f --- /dev/null +++ b/recipes/openassetio/all/test_v1_package/conanfile.py @@ -0,0 +1,66 @@ +import pathlib + +from conan import ConanFile +from conan.tools.microsoft import is_msvc +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake, CMakeToolchain, CMakeDeps + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def build_requirements(self): + self.tool_requires("cmake/3.25.3") + + def requirements(self): + self.requires(self.tested_reference_str) + + if "with_python" not in self.options["openassetio"] or self.options["openassetio"].with_python: + self.requires("cpython/3.9.7") + + def layout(self): + cmake_layout(self) + + def generate(self): + tc = CMakeToolchain(self) + + tc.variables["OPENASSETIOTEST_GLIBCXX_USE_CXX11_ABI"] = self.settings.get_safe("compiler.libcxx") == "libstdc++11" + tc.variables["OPENASSETIOTEST_ENABLE_PYTHON"] = self.dependencies["openassetio"].options.with_python + + if self.dependencies["openassetio"].options.with_python: + tc.variables["Python_EXECUTABLE"] = self._python_exe + if is_msvc(self): + tc.variables["Python_LIBRARY"] = self._python_windows_lib + if self.settings.compiler == "clang": + # Work around cpython recipe bug. + # FIXME: remove once fixed upstream. + tc.variables["CMAKE_EXE_LINKER_FLAGS"] = "-lpthread" + + tc.generate() + tc = CMakeDeps(self) + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + cmake = CMake(self) + cmake.test() + + @property + def _python_exe(self): + return pathlib.Path(self.deps_user_info["cpython"].python).as_posix() + + @property + def _python_windows_lib(self): + pth = pathlib.Path( + self.dependencies["cpython"].package_folder, + self.dependencies["cpython"].cpp_info.components["embed"].libdirs[0], + self.dependencies["cpython"].cpp_info.components["embed"].libs[0]) + pth = pth.with_suffix(".lib") + return pth.as_posix() diff --git a/recipes/openassetio/all/test_v1_package/test.core.cpp b/recipes/openassetio/all/test_v1_package/test.core.cpp new file mode 100644 index 0000000000000..47d6ffca71ad2 --- /dev/null +++ b/recipes/openassetio/all/test_v1_package/test.core.cpp @@ -0,0 +1,29 @@ +// Include all headers to test they are where we expect and can be +// compiled. +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +int main() { + auto traits = openassetio::TraitsData::make(); + traits->setTraitProperty("a", "b", openassetio::Str{"c"}); + return 0; +} diff --git a/recipes/openassetio/all/test_v1_package/test.py b/recipes/openassetio/all/test_v1_package/test.py new file mode 100644 index 0000000000000..b6dbc60c44009 --- /dev/null +++ b/recipes/openassetio/all/test_v1_package/test.py @@ -0,0 +1,15 @@ +import sys + +try: + import openassetio + from openassetio.hostApi import ManagerFactory +except ImportError as exc: + print("Error importing openassetio package: {}".format(exc)) + print("Using python executable: {}".format(sys.executable)) + print("With PYTHONPATH:") + for i in sys.path: + print("\t{}".format(i)) + sys.exit(1) + +print("openassetio found at {}".format(openassetio.__file__)) +sys.exit(0) diff --git a/recipes/openassetio/all/test_v1_package/test.python.bridge.cpp b/recipes/openassetio/all/test_v1_package/test.python.bridge.cpp new file mode 100644 index 0000000000000..60f0cf0e94df0 --- /dev/null +++ b/recipes/openassetio/all/test_v1_package/test.python.bridge.cpp @@ -0,0 +1,25 @@ +#include + +#include + +#include +#include +#include + +namespace { +struct DummyLoggerInterface : openassetio::log::LoggerInterface { + void log(Severity severity, const openassetio::Str& message) override {} +}; +} // namespace + +int main() { + Py_Initialize(); + auto logger = std::make_shared(); + { + const auto factory = + openassetio::python::hostApi::createPythonPluginSystemManagerImplementationFactory(logger); + const auto identifiers = factory->identifiers(); + // Must be destroyed before Py_FinalizeEx. + } + Py_FinalizeEx(); +} diff --git a/recipes/openassetio/config.yml b/recipes/openassetio/config.yml new file mode 100644 index 0000000000000..6b2c27e66e740 --- /dev/null +++ b/recipes/openassetio/config.yml @@ -0,0 +1,3 @@ +versions: + "1.0.0-alpha.9": + folder: all diff --git a/recipes/openblas/all/CMakeLists.txt b/recipes/openblas/all/CMakeLists.txt deleted file mode 100644 index cdeeef45d13c1..0000000000000 --- a/recipes/openblas/all/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -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/openblas/all/conandata.yml b/recipes/openblas/all/conandata.yml index 33390fd9116e6..85e4fee5631f1 100644 --- a/recipes/openblas/all/conandata.yml +++ b/recipes/openblas/all/conandata.yml @@ -1,4 +1,16 @@ sources: + "0.3.27": + url: "https://github.com/xianyi/OpenBLAS/archive/v0.3.27.tar.gz" + sha256: "aa2d68b1564fe2b13bc292672608e9cdeeeb6dc34995512e65c3b10f4599e897" + "0.3.26": + url: "https://github.com/xianyi/OpenBLAS/archive/v0.3.26.tar.gz" + sha256: "4e6e4f5cb14c209262e33e6816d70221a2fe49eb69eaf0a06f065598ac602c68" + "0.3.25": + url: "https://github.com/xianyi/OpenBLAS/archive/v0.3.25.tar.gz" + sha256: "4c25cb30c4bb23eddca05d7d0a85997b8db6144f5464ba7f8c09ce91e2f35543" + "0.3.24": + url: "https://github.com/xianyi/OpenBLAS/archive/v0.3.24.tar.gz" + sha256: "ceadc5065da97bd92404cac7254da66cc6eb192679cf1002098688978d4d5132" "0.3.20": url: "https://github.com/xianyi/OpenBLAS/archive/v0.3.20.tar.gz" sha256: "8495c9affc536253648e942908e88e097f2ec7753ede55aca52e5dead3029e3c" diff --git a/recipes/openblas/all/conanfile.py b/recipes/openblas/all/conanfile.py index 01041ab44fd28..6fcc5d83048b9 100644 --- a/recipes/openblas/all/conanfile.py +++ b/recipes/openblas/all/conanfile.py @@ -1,9 +1,62 @@ -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 fix_apple_shared_install_name +from conan.tools.build import cross_building +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, replace_in_file, rmdir +from conan.tools.microsoft import is_msvc_static_runtime, is_msvc +from conan.tools.scm import Version import os -import functools +import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" + +# Maps Conan's settings.arch to the corresponding OpenBLAS TARGET: +conan_arch_to_openblas_target = { + "x86": "SANDYBRIDGE", # Sandy bridge was discontinued in September of 2013, + "x86_64": "SANDYBRIDGE", # supporting older CPUs is a performance trade-off + "ppc32be": None, # TODO: OpenBLAS has POWER4, POWER5, POWER6, POWER7, + "ppc32": None, # POWER8, POWER9, POWER10, PPCG4, PPC970, PPC970MP, + "ppc64le": None, # PPC440, PPC440FP2, CELL + "ppc64": None, + "armv4": None, # Not supported by OpenBLAS + "armv4i": None, # Not supported by OpenBLAS + "armv5el": "ARMV5", + "armv5hf": "ARMV5", + "armv6": "ARMV6", + "armv7": "ARMV7", + "armv7hf": "ARMV7", + "armv7s": "ARMV7", + "armv7k": "ARMV7", + "armv8": "ARMV8", + "armv8_32": "ARMV7", # No 32-bit ARMv8 TARGET in OpenBLAS + "armv8.3": "ARMV8", + "arm64ec": "ARMV8", + "sparc": None, # TODO: OpenBLAS has SPARC, SPARCV7 + "sparcv9": None, + "mips": None, # TODO: OpenBLAS has P5600, MIPS1004K and MIPS24K + "mips64": "MIPS64_GENERIC", + "avr": None, # Not supported by OpenBLAS + "s390": None, # Not supported by OpenBLAS + "s390x": None, # Not supported by OpenBLAS + "asm.js": "GENERIC", # TODO: ? + "wasm": "GENERIC", # TODO: ? + "sh4le": None, # Not supported by OpenBLAS + "e2k-v2": "E2K", + "e2k-v3": "E2K", + "e2k-v4": "E2K", + "e2k-v5": "E2K", + "e2k-v6": "E2K", + "e2k-v7": "E2K", + "riscv64": "RISCV64_GENERIC", + "riscv32": None, # Not supported by OpenBLAS + "xtensalx6": None, # Not supported by OpenBLAS + "xtensalx106": None, # Not supported by OpenBLAS + "xtensalx7": None, # Not supported by OpenBLAS +} + +# Taken from OpenBLAS TargetList.txt +available_openblas_targets = ["P2", "KATMAI", "COPPERMINE", "NORTHWOOD", "PRESCOTT", "BANIAS", "YONAH", "CORE2", "PENRYN", "DUNNINGTON", "NEHALEM", "SANDYBRIDGE", "HASWELL", "SKYLAKEX", "ATOM", "COOPERLAKE", "SAPPHIRERAPIDS", "ATHLON", "OPTERON", "OPTERON_SSE3", "BARCELONA", "SHANGHAI", "ISTANBUL", "BOBCAT", "BULLDOZER", "PILEDRIVER", "STEAMROLLER", "EXCAVATOR", "ZEN", "SSE_GENERIC", "VIAC3", "NANO", "POWER4", "POWER5", "POWER6", "POWER7", "POWER8", "POWER9", "POWER10", "PPCG4", "PPC970", "PPC970MP", "PPC440", "PPC440FP2", "CELL", "P5600", "MIPS1004K", "MIPS24K", "MIPS64_GENERIC", "SICORTEX", "LOONGSON3A", "LOONGSON3B", "I6400", "P6600", "I6500", "ITANIUM2", "SPARC", "SPARCV7", "CORTEXA15", "CORTEXA9", "ARMV7", "ARMV6", "ARMV5", "ARMV8", "CORTEXA53", "CORTEXA57", "CORTEXA72", "CORTEXA73", "CORTEXA76", "CORTEXA510", "CORTEXA710", "CORTEXX1", "CORTEXX2", "NEOVERSEN1", "NEOVERSEV1", "NEOVERSEN2", "CORTEXA55", "EMAG8180", "FALKOR", "THUNDERX", "THUNDERX2T99", "TSV110", "THUNDERX3T110", "VORTEX", "A64FX", "ARMV8SVE", "FT2000", "ZARCH_GENERIC", "Z13", "Z14", "RISCV64_GENERIC", "RISCV64_ZVL128B", "C910V", "x280", "RISCV64_ZVL256B", "LOONGSONGENERIC", "LOONGSON3R5", "LOONGSON2K1000", "E2K", "EV4", "EV5", "EV6", "CSKY", "CK860FV"] class OpenblasConan(ConanFile): @@ -13,111 +66,188 @@ class OpenblasConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.openblas.net" topics = ("blas", "lapack") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], "build_lapack": [True, False], + "build_relapack": [True, False], "use_thread": [True, False], + "use_locking": [True, False], "dynamic_arch": [True, False], + "target": [None] + available_openblas_targets } default_options = { "shared": False, "fPIC": True, - "build_lapack": False, + "build_lapack": True, + "build_relapack": False, "use_thread": True, + "use_locking": True, "dynamic_arch": False, + "target": None, + } + options_description = { + "build_lapack": "Build LAPACK and LAPACKE", + "build_relapack": "Build with ReLAPACK (recursive implementation of several LAPACK functions on top of standard LAPACK)", + "use_thread": "Enable threads support", + "use_locking": "Use locks even in single-threaded builds to make them callable from multiple threads", + "dynamic_arch": "Include support for multiple CPU targets, with automatic selection at runtime (x86/x86_64, aarch64 or ppc only)", + "target": "OpenBLAS TARGET variable (see TargetList.txt)", } - generators = "cmake" short_paths = True @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 _fortran_compiler(self): + comp_exe = self.conf.get("tools.build:compiler_executables") + if comp_exe and "fortran" in comp_exe: + return comp_exe["fortran"] + return None def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + # When no Fortran compiler is available, OpenBLAS builds LAPACK from an f2c-converted copy of LAPACK unless the NO_LAPACK option is specified. + # This is not available before v0.3.21. + if Version(self.version) < "0.3.21": + self.options.build_lapack = False + self.options.build_relapack = False def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + # When cross-compiling, OpenBLAS requires explicitly setting TARGET + if cross_building(self, skip_x64_x86=True) and not self.options.target: + # Try inferring the target from settings.arch + target = conan_arch_to_openblas_target.get(str(self.settings.arch)) + if target: + self.output.warning(f'Setting OpenBLAS TARGET={target} based on settings.arch. This may result in suboptimal performance. Set the "{self.name}/*:target=XXX" option to silence this warning.') + self.options.target = target def validate(self): - if hasattr(self, "settings_build") and tools.cross_building(self, skip_x64_x86=True): - raise ConanInvalidConfiguration("Cross-building not implemented") + if Version(self.version) < "0.3.24" and self.settings.arch == "armv8": + # OpenBLAS fails to detect the appropriate target architecture for armv8 for versions < 0.3.24, as it matches the 32 bit variant instead of 64. + # This was fixed in https://github.com/OpenMathLib/OpenBLAS/pull/4142, which was introduced in 0.3.24. + # This would be a reasonably trivial hotfix to backport. + raise ConanInvalidConfiguration("armv8 builds are not currently supported for versions lower than 0.3.24. Contributions to support this are welcome.") + + if self.options.build_relapack: + if not self.options.build_lapack: + raise ConanInvalidConfiguration(f'"{self.name}/*:build_relapack=True" option requires "{self.name}/*:build_lapack=True"') + if self.settings.compiler not in ["gcc", "clang"]: + # ld: unknown option: --allow-multiple-definition on apple-clang + raise ConanInvalidConfiguration(f'"{self.name}/*:build_relapack=True" option is only supported for GCC and Clang') + + def validate_build(self): + if Version(self.version) < "0.3.22" and cross_building(self, skip_x64_x86=True): + # OpenBLAS CMake builds did not support some of the cross-compilation targets in 0.3.20/21 and earlier. + # This was fixed in https://github.com/OpenMathLib/OpenBLAS/pull/3714 and https://github.com/OpenMathLib/OpenBLAS/pull/3958 + raise ConanInvalidConfiguration(f"Cross-building is not supported for {self.name}/0.3.21 and earlier.") + + # If we're cross-compiling, and the user didn't provide the target, and + # we couldn't infer the target from settings.arch, fail + if cross_building(self, skip_x64_x86=True) and not self.options.target: + raise ConanInvalidConfiguration(f'Could not determine OpenBLAS TARGET. Please set the "{self.name}/*:target=XXX" option.') 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - if self.options.build_lapack: - self.output.warn("Building with lapack support requires a Fortran compiler.") - cmake.definitions["NOFORTRAN"] = not self.options.build_lapack - cmake.definitions["BUILD_WITHOUT_LAPACK"] = not self.options.build_lapack - cmake.definitions["DYNAMIC_ARCH"] = self.options.dynamic_arch - cmake.definitions["USE_THREAD"] = self.options.use_thread + def layout(self): + cmake_layout(self, src_folder="src") - # Required for safe concurrent calls to OpenBLAS routines - cmake.definitions["USE_LOCKING"] = not self.options.use_thread + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_STATIC_LIBS"] = not self.options.shared + tc.variables["BUILD_SHARED_LIBS"] = self.options.shared + tc.variables["BUILD_TESTING"] = False - cmake.definitions[ - "MSVC_STATIC_CRT" - ] = False # don't, may lie to consumer, /MD or /MT is managed by conan + tc.variables["NOFORTRAN"] = not self.options.build_lapack + # This checks explicit user-specified fortran compiler + if self.options.build_lapack and not self._fortran_compiler: + if Version(self.version) < "0.3.21": + self.output.warning("Building with LAPACK support requires a Fortran compiler.") + else: + tc.variables["C_LAPACK"] = True + tc.variables["NOFORTRAN"] = True + self.output.info("Building LAPACK without a Fortran compiler") + + tc.variables["BUILD_WITHOUT_LAPACK"] = not self.options.build_lapack + tc.variables["BUILD_RELAPACK"] = self.options.build_relapack + + tc.variables["DYNAMIC_ARCH"] = self.options.dynamic_arch + tc.variables["USE_THREAD"] = self.options.use_thread + tc.variables["USE_LOCKING"] = self.options.use_locking + + tc.variables["MSVC_STATIC_CRT"] = is_msvc_static_runtime(self) # This is a workaround to add the libm dependency on linux, # which is required to successfully compile on older gcc versions. - cmake.definitions["ANDROID"] = self.settings.os in ["Linux", "Android"] + tc.variables["ANDROID"] = self.settings.os in ["Linux", "Android"] + + if self.options.target: + tc.cache_variables["TARGET"] = self.options.target + + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() + + def _patch_sources(self): + if Version(self.version) <= "0.3.15": + replace_in_file(self, os.path.join(self.source_folder, "cmake", "utils.cmake"), + "set(obj_defines ${defines_in})", textwrap.dedent("""\ + set(obj_defines ${defines_in}) - cmake.configure(build_folder=self._build_subfolder) - return cmake + list(FIND obj_defines "RC" def_idx) + if (${def_idx} GREATER -1) + list(REMOVE_ITEM obj_defines "RC") + list(APPEND obj_defines "RC=RC") + endif () + list(FIND obj_defines "CR" def_idx) + if (${def_idx} GREATER -1) + list(REMOVE_ITEM obj_defines "CR") + list(APPEND obj_defines "CR=CR") + endif ()""")) + if Version(self.version) < "0.3.21": + f_check_cmake = os.path.join(self.source_folder, "cmake", "f_check.cmake") + if Version(self.version) >= "0.3.12": + replace_in_file(self, f_check_cmake, + 'message(STATUS "No Fortran compiler found, can build only BLAS but not LAPACK")', + 'message(FATAL_ERROR "No Fortran compiler found. Cannot build with LAPACK.")') + else: + replace_in_file(self, f_check_cmake, + "enable_language(Fortran)", + textwrap.dedent("""\ + include(CheckLanguage) + check_language(Fortran) + if(CMAKE_Fortran_COMPILER) + enable_language(Fortran) + else() + message(FATAL_ERROR "No Fortran compiler found. Cannot build with LAPACK.") + set (NOFORTRAN 1) + set (NO_LAPACK 1) + endif()""")) def build(self): - if tools.Version(self.version) >= "0.3.12": - search = """message(STATUS "No Fortran compiler found, can build only BLAS but not LAPACK")""" - replace = ( - """message(FATAL_ERROR "No Fortran compiler found. Cannot build with LAPACK.")""" - ) - else: - search = "enable_language(Fortran)" - replace = """include(CheckLanguage) -check_language(Fortran) -if(CMAKE_Fortran_COMPILER) - enable_language(Fortran) -else() - message(FATAL_ERROR "No Fortran compiler found. Cannot build with LAPACK.") - set (NOFORTRAN 1) - set (NO_LAPACK 1) -endif()""" - - tools.replace_in_file( - os.path.join(self._source_subfolder, "cmake", "f_check.cmake"), - search, - replace, - ) - cmake = self._configure_cmake() + self._patch_sources() + 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", 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", "cmake")) + 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) + + @property + def _lib_name(self): + if self.options.shared and self.settings.build_type == "Debug" and not is_msvc(self): + return "openblas_d" + return "openblas" def package_info(self): # CMake config file: @@ -127,26 +257,25 @@ def package_info(self): self.cpp_info.set_property("cmake_file_name", "OpenBLAS") self.cpp_info.set_property("cmake_target_name", "OpenBLAS::OpenBLAS") self.cpp_info.set_property("pkg_config_name", "openblas") - cmake_component_name = "pthread" if self.options.use_thread else "serial" # TODO: ow to model this in CMakeDeps? + # 'pthread' causes issues without namespace + cmake_component_name = "pthread" if self.options.use_thread else "serial" # TODO: how to model this in CMakeDeps? + self.cpp_info.components["openblas_component"].set_property("cmake_target_name", f"OpenBLAS::{cmake_component_name}") self.cpp_info.components["openblas_component"].set_property("pkg_config_name", "openblas") - self.cpp_info.components["openblas_component"].includedirs.append( - os.path.join("include", "openblas") - ) - self.cpp_info.components["openblas_component"].libs = tools.collect_libs(self) + self.cpp_info.components["openblas_component"].includedirs.append(os.path.join("include", "openblas")) + self.cpp_info.components["openblas_component"].libs = [self._lib_name] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["openblas_component"].system_libs.append("m") if self.options.use_thread: self.cpp_info.components["openblas_component"].system_libs.append("pthread") - if self.options.build_lapack: + if self.options.build_lapack and self._fortran_compiler: self.cpp_info.components["openblas_component"].system_libs.append("gfortran") - self.output.info( - "Setting OpenBLAS_HOME environment variable: {}".format(self.package_folder) - ) - self.env_info.OpenBLAS_HOME = self.package_folder + self.buildenv_info.define_path("OpenBLAS_HOME", self.package_folder) + self.runenv_info.define_path("OpenBLAS_HOME", self.package_folder) # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.names["cmake_find_package"] = "OpenBLAS" self.cpp_info.names["cmake_find_package_multi"] = "OpenBLAS" self.cpp_info.components["openblas_component"].names["cmake_find_package"] = cmake_component_name self.cpp_info.components["openblas_component"].names["cmake_find_package_multi"] = cmake_component_name + self.env_info.OpenBLAS_HOME = self.package_folder diff --git a/recipes/openblas/all/test_package/CMakeLists.txt b/recipes/openblas/all/test_package/CMakeLists.txt index 4b2a260fe0ab9..eaf07820c3b1c 100644 --- a/recipes/openblas/all/test_package/CMakeLists.txt +++ b/recipes/openblas/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(OpenBLAS REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/openblas/all/test_package/conanfile.py b/recipes/openblas/all/test_package/conanfile.py index 38f4483872d47..02eb5ce439fb4 100644 --- a/recipes/openblas/all/test_package/conanfile.py +++ b/recipes/openblas/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,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/openblas/config.yml b/recipes/openblas/config.yml index 6d0851b7920c3..e0f3014a9fdda 100644 --- a/recipes/openblas/config.yml +++ b/recipes/openblas/config.yml @@ -1,4 +1,12 @@ versions: + "0.3.27": + folder: all + "0.3.26": + folder: all + "0.3.25": + folder: all + "0.3.24": + folder: all "0.3.20": folder: all "0.3.17": diff --git a/recipes/opencascade/all/conandata.yml b/recipes/opencascade/all/conandata.yml index 9973488d4454b..fb18864cacb8a 100644 --- a/recipes/opencascade/all/conandata.yml +++ b/recipes/opencascade/all/conandata.yml @@ -9,6 +9,34 @@ sources: url: "https://github.com/Open-Cascade-SAS/OCCT/archive/V7_5_0.tar.gz" sha256: "dbe1d62a9317ad1516bd4575293d9aab2dc20206ca7a60a7705c9a3b77dc59c9" patches: + "7.6.2": + - patch_file: "patches/7.5.0-0001-fix-compile-error-cxx17.patch" + patch_description: "Fix compilation error with C++17" + patch_source: "https://git.dev.opencascade.org/gitweb/?p=occt.git;a=commitdiff;h=7021de2fe7a69d4c788ccf43b8b096dbcc8597c8" + patch_type: "portability" + - patch_file: "patches/7.5.0-0002-fix-compile-error-cxx20.patch" + patch_description: "Fix compilation error with C++20" + patch_source: "https://git.dev.opencascade.org/gitweb/?p=occt.git;a=commitdiff;h=73035770f6fced4ec7dc7e6a0276ee894daa479a" + patch_type: "portability" + "7.6.0": + - patch_file: "patches/7.5.0-0001-fix-compile-error-cxx17.patch" + patch_description: "Fix compilation error with C++17" + patch_source: "https://git.dev.opencascade.org/gitweb/?p=occt.git;a=commitdiff;h=7021de2fe7a69d4c788ccf43b8b096dbcc8597c8" + patch_type: "portability" + - patch_file: "patches/7.5.0-0002-fix-compile-error-cxx20.patch" + patch_description: "Fix compilation error with C++20" + patch_source: "https://git.dev.opencascade.org/gitweb/?p=occt.git;a=commitdiff;h=73035770f6fced4ec7dc7e6a0276ee894daa479a" + patch_type: "portability" "7.5.0": - - patch_file: "patches/0001-undefined-ref-ncollection-lerp.patch" - base_path: "source_subfolder" + - patch_file: "patches/7.5.0-0001-fix-compile-error-cxx17.patch" + patch_description: "Fix compilation error with C++17" + patch_source: "https://git.dev.opencascade.org/gitweb/?p=occt.git;a=commitdiff;h=7021de2fe7a69d4c788ccf43b8b096dbcc8597c8" + patch_type: "portability" + - patch_file: "patches/7.5.0-0002-fix-compile-error-cxx20.patch" + patch_description: "Fix compilation error with C++20" + patch_source: "https://git.dev.opencascade.org/gitweb/?p=occt.git;a=commitdiff;h=73035770f6fced4ec7dc7e6a0276ee894daa479a" + patch_type: "portability" + - patch_file: "patches/7.5.0-0003-undefined-ref-ncollection-lerp.patch" + patch_description: "Fix undefined reference with Visual Studio 2015" + patch_source: "https://git.dev.opencascade.org/gitweb/?p=occt.git;a=commitdiff;h=026aec186081397e553e492db1632ee606f01fad" + patch_type: "portability" diff --git a/recipes/opencascade/all/conanfile.py b/recipes/opencascade/all/conanfile.py index 4cf35d30dea34..055db5ab3dbd9 100644 --- a/recipes/opencascade/all/conanfile.py +++ b/recipes/opencascade/all/conanfile.py @@ -1,13 +1,20 @@ -from conan.tools.files import rename -from conan.tools.microsoft import is_msvc -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -import functools import json import os import textwrap -required_conan_version = ">=1.45.0" +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, collect_libs, copy, export_conandata_patches, get, + load, rename, replace_in_file, rmdir, save +) +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" class OpenCascadeConan(ConanFile): @@ -17,8 +24,8 @@ class OpenCascadeConan(ConanFile): homepage = "https://dev.opencascade.org" url = "https://github.com/conan-io/conan-center-index" license = "LGPL-2.1-or-later" - topics = ("opencascade", "occt", "3d", "modeling", "cad") - + topics = ("occt", "3d", "modeling", "cad") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -48,11 +55,6 @@ class OpenCascadeConan(ConanFile): } short_paths = True - generators = "cmake" - - @property - def _source_subfolder(self): - return "source_subfolder" @property def _is_linux(self): @@ -60,41 +62,47 @@ def _is_linux(self): @property def _link_tk(self): - if tools.Version(self.version) >= "7.6.0": + if Version(self.version) >= "7.6.0": return self.options.with_tk else: return True @property def _link_opengl(self): - if tools.Version(self.version) >= "7.6.0": + if Version(self.version) >= "7.6.0": return self.options.with_opengl else: return True + @property + 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 config_options(self): - if tools.Version(self.version) < "7.6.0": + if self.settings.os == "Windows": + del self.options.fPIC + if Version(self.version) < "7.6.0": del self.options.with_tk del self.options.with_draco del self.options.with_opengl - if self.settings.os == "Windows": - del self.options.fPIC if self.settings.build_type != "Debug": del self.options.extended_debug_messages 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("tcl/8.6.11") + self.requires("tcl/8.6.10") if self._link_tk: self.requires("tk/8.6.10") - self.requires("freetype/2.11.1") + self.requires("freetype/2.13.0") if self._link_opengl: self.requires("opengl/system") if self._is_linux: @@ -102,7 +110,7 @@ def requirements(self): self.requires("xorg/system") # TODO: add vtk support? if self.options.with_ffmpeg: - self.requires("ffmpeg/5.0") + self.requires("ffmpeg/6.0") if self.options.with_freeimage: self.requires("freeimage/3.18.0") if self.options.with_openvr: @@ -110,265 +118,342 @@ def requirements(self): if self.options.with_rapidjson: self.requires("rapidjson/1.1.0") if self.options.get_safe("with_draco"): - self.requires("draco/1.5.2") + self.requires("draco/1.5.6") if self.options.with_tbb: - self.requires("onetbb/2020.3") + self.requires("onetbb/2021.10.0") def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) + check_min_cppstd(self, self._min_cppstd) if self.settings.compiler == "clang" and self.settings.compiler.version == "6.0" and \ self.settings.build_type == "Release": - raise ConanInvalidConfiguration("OpenCASCADE {} doesn't support Clang 6.0 if Release build type".format(self.version)) + raise ConanInvalidConfiguration(f"{self.ref} doesn't support Clang 6.0 if Release build type") 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) + + # Inject C++ standard from profile since we have removed hardcoded C++ standard from upstream build files + if not valid_min_cppstd(self, self._min_cppstd): + tc.variables["CMAKE_CXX_STANDARD"] = self._min_cppstd + + tc.cache_variables["BUILD_LIBRARY_TYPE"] = "Shared" if self.options.shared else "Static" + tc.cache_variables["INSTALL_TEST_CASES"] = False + tc.cache_variables["BUILD_RESOURCES"] = False + tc.cache_variables["BUILD_RELEASE_DISABLE_EXCEPTIONS"] = True + if self.settings.build_type == "Debug": + tc.cache_variables["BUILD_WITH_DEBUG"] = self.options.extended_debug_messages + tc.cache_variables["BUILD_USE_PCH"] = False + tc.cache_variables["INSTALL_SAMPLES"] = False + + tc.cache_variables["INSTALL_DIR_LAYOUT"] = "Unix" + tc.cache_variables["INSTALL_DIR_BIN"] = "bin" + tc.cache_variables["INSTALL_DIR_LIB"] = "lib" + tc.cache_variables["INSTALL_DIR_INCLUDE"] = "include" + tc.cache_variables["INSTALL_DIR_RESOURCE"] = "res/resource" + tc.cache_variables["INSTALL_DIR_DATA"] = "res/data" + tc.cache_variables["INSTALL_DIR_SAMPLES"] = "res/samples" + tc.cache_variables["INSTALL_DIR_DOC"] = "res/doc" + + if is_msvc(self): + tc.cache_variables["BUILD_SAMPLES_MFC"] = False + tc.cache_variables["BUILD_SAMPLES_QT"] = False + tc.cache_variables["BUILD_Inspector"] = False + if is_apple_os(self): + tc.cache_variables["USE_GLX"] = False + if self.settings.os == "Windows": + tc.cache_variables["USE_D3D"] = False + tc.cache_variables["BUILD_ENABLE_FPE_SIGNAL_HANDLER"] = False + tc.cache_variables["BUILD_DOC_Overview"] = False + + tc.cache_variables["USE_FREEIMAGE"] = self.options.with_freeimage + tc.cache_variables["USE_OPENVR"] = self.options.with_openvr + tc.cache_variables["USE_FFMPEG"] = self.options.with_ffmpeg + tc.cache_variables["USE_TBB"] = self.options.with_tbb + tc.cache_variables["USE_RAPIDJSON"] = self.options.with_rapidjson + if Version(self.version) >= "7.6.0": + tc.cache_variables["USE_DRACO"] = self.options.with_draco + tc.cache_variables["USE_TK"] = self.options.with_tk + tc.cache_variables["USE_OPENGL"] = self.options.with_opengl + + # Relocatable shared libs on Macos + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "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) - - cmakelists = os.path.join(self._source_subfolder, "CMakeLists.txt") - cmakelists_tools = os.path.join(self._source_subfolder, "tools", "CMakeLists.txt") - occt_toolkit_cmake = os.path.join(self._source_subfolder, "adm", "cmake", "occt_toolkit.cmake") - occt_csf_cmake = os.path.join(self._source_subfolder, "adm", "cmake", "occt_csf.cmake") - occt_defs_flags_cmake = os.path.join(self._source_subfolder, "adm", "cmake", "occt_defs_flags.cmake") - - # Inject conanbuildinfo, upstream build files are not ready for a CMake wrapper (too much modifications required) - # Also inject compile flags - tools.replace_in_file( + apply_conandata_patches(self) + + cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") + cmakelists_tools = os.path.join(self.source_folder, "tools", "CMakeLists.txt") + occt_toolkit_cmake = os.path.join(self.source_folder, "adm", "cmake", "occt_toolkit.cmake") + occt_csf_cmake = os.path.join(self.source_folder, "adm", "cmake", "occt_csf.cmake") + occt_defs_flags_cmake = os.path.join(self.source_folder, "adm", "cmake", "occt_defs_flags.cmake") + + # Inject interface definitions of dependencies because opencascade + # does not always link to CMake imported targets + sorted_deps = [dep for dep in reversed(self.dependencies.host.topological_sort.values())] + deps_defines = " ".join([f"-D{d}" for dep in sorted_deps for d in dep.cpp_info.aggregated_components().defines]) + replace_in_file( + self, cmakelists, "project (OCCT)", - "project (OCCT)\n" - "include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)\n" - "conan_basic_setup(TARGETS KEEP_RPATHS)\n" - "conan_global_flags()") + textwrap.dedent(f"""\ + project (OCCT) + add_definitions({deps_defines}) + """), + ) - # Avoid to add system include/libs directories - tools.replace_in_file(cmakelists, "3RDPARTY_INCLUDE_DIRS", "CONAN_INCLUDE_DIRS") - tools.replace_in_file(cmakelists, "3RDPARTY_LIBRARY_DIRS", "CONAN_LIB_DIRS") - tools.replace_in_file(cmakelists_tools, "3RDPARTY_INCLUDE_DIRS", "CONAN_INCLUDE_DIRS") - tools.replace_in_file(cmakelists_tools, "3RDPARTY_LIBRARY_DIRS", "CONAN_LIB_DIRS") + # Avoid to add system include/libs directories and inject directories + # from conan dependencies instead + for cmake_file in [cmakelists, cmakelists_tools]: + deps_includedirs = ";".join([p.replace("\\", "/") for dep in sorted_deps for p in dep.cpp_info.aggregated_components().includedirs]) + replace_in_file( + self, + cmake_file, + "if (3RDPARTY_INCLUDE_DIRS)", + f"set(3RDPARTY_INCLUDE_DIRS \"{deps_includedirs}\")\nif (3RDPARTY_INCLUDE_DIRS)", + ) + deps_libdirs = ";".join([p.replace("\\", "/") for dep in sorted_deps for p in dep.cpp_info.aggregated_components().libdirs]) + replace_in_file( + self, + cmake_file, + "if (3RDPARTY_LIBRARY_DIRS)", + f"set(3RDPARTY_LIBRARY_DIRS \"{deps_libdirs}\")\nif (3RDPARTY_LIBRARY_DIRS)", + ) # Do not fail due to "fragile" upstream logic to find dependencies - tools.replace_in_file(cmakelists, "if (3RDPARTY_NOT_INCLUDED)", "if(0)") - tools.replace_in_file(cmakelists, "if (3RDPARTY_NO_LIBS)", "if(0)") - tools.replace_in_file(cmakelists, "if (3RDPARTY_NO_DLLS)", "if(0)") + replace_in_file(self, cmakelists, "if (3RDPARTY_NOT_INCLUDED)", "if(0)") + replace_in_file(self, cmakelists, "if (3RDPARTY_NO_LIBS)", "if(0)") + replace_in_file(self, cmakelists, "if (3RDPARTY_NO_DLLS)", "if(0)") # Inject dependencies from conan, and avoid to rely on upstream custom CMake files - conan_targets = [] + deps_targets = [] ## freetype - conan_targets.append("CONAN_PKG::freetype") - tools.replace_in_file(cmakelists, "OCCT_INCLUDE_CMAKE_FILE (\"adm/cmake/freetype\")", "") - tools.replace_in_file( + deps_targets.append("Freetype::Freetype") + replace_in_file( + self, + cmakelists, + "OCCT_INCLUDE_CMAKE_FILE (\"adm/cmake/freetype\")", + "find_package(Freetype REQUIRED MODULE)", + ) + freetype_libs = " ".join(self.dependencies["freetype"].cpp_info.aggregated_components().libs) + replace_in_file( + self, occt_csf_cmake, "set (CSF_FREETYPE \"freetype\")", - "set (CSF_FREETYPE \"{}\")".format(" ".join(self.deps_cpp_info["freetype"].libs))) + f"set (CSF_FREETYPE \"{freetype_libs}\")", + ) ## tcl - conan_targets.append("CONAN_PKG::tcl") - tools.replace_in_file(cmakelists, "OCCT_INCLUDE_CMAKE_FILE (\"adm/cmake/tcl\")", "") - csf_tcl_libs = "set (CSF_TclLibs \"{}\")".format(" ".join(self.deps_cpp_info["tcl"].libs)) - tools.replace_in_file(occt_csf_cmake, "set (CSF_TclLibs \"tcl86\")", csf_tcl_libs) - tools.replace_in_file(occt_csf_cmake, "set (CSF_TclLibs Tcl)", csf_tcl_libs) - if tools.Version(self.version) >= "7.6.0": - tools.replace_in_file(occt_csf_cmake, "set (CSF_TclLibs \"tcl8.6\")", csf_tcl_libs) + deps_targets.append("tcl::tcl") + replace_in_file(self, cmakelists, "OCCT_INCLUDE_CMAKE_FILE (\"adm/cmake/tcl\")", "find_package(TCL REQUIRED)") + tcl_libs = " ".join(self.dependencies["tcl"].cpp_info.aggregated_components().libs) + csf_tcl_libs = f"set (CSF_TclLibs \"{tcl_libs}\")" + replace_in_file(self, occt_csf_cmake, "set (CSF_TclLibs \"tcl86\")", csf_tcl_libs) + replace_in_file(self, occt_csf_cmake, "set (CSF_TclLibs Tcl)", csf_tcl_libs) + if Version(self.version) >= "7.6.0": + replace_in_file(self, occt_csf_cmake, "set (CSF_TclLibs \"tcl8.6\")", csf_tcl_libs) else: - tools.replace_in_file(occt_csf_cmake, "set (CSF_TclLibs \"tcl8.6\")", csf_tcl_libs) + replace_in_file(self, occt_csf_cmake, "set (CSF_TclLibs \"tcl8.6\")", csf_tcl_libs) ## tk if self._link_tk: - conan_targets.append("CONAN_PKG::tk") - tools.replace_in_file(cmakelists, "OCCT_INCLUDE_CMAKE_FILE (\"adm/cmake/tk\")", "") - csf_tk_libs = "set (CSF_TclTkLibs \"{}\")".format(" ".join(self.deps_cpp_info["tk"].libs)) - tools.replace_in_file(occt_csf_cmake, "set (CSF_TclTkLibs \"tk86\")", csf_tk_libs) - tools.replace_in_file(occt_csf_cmake, "set (CSF_TclTkLibs Tk)", csf_tk_libs) - if tools.Version(self.version) >= "7.6.0": - tools.replace_in_file(occt_csf_cmake, "set (CSF_TclTkLibs \"tk8.6\")", csf_tk_libs) + deps_targets.append("tk::tk") + replace_in_file(self, cmakelists, "OCCT_INCLUDE_CMAKE_FILE (\"adm/cmake/tk\")", "find_package(tk REQUIRED)") + tk_libs = " ".join(self.dependencies["tk"].cpp_info.aggregated_components().libs) + csf_tk_libs = f"set (CSF_TclTkLibs \"{tk_libs}\")" + replace_in_file(self, occt_csf_cmake, "set (CSF_TclTkLibs \"tk86\")", csf_tk_libs) + replace_in_file(self, occt_csf_cmake, "set (CSF_TclTkLibs Tk)", csf_tk_libs) + if Version(self.version) >= "7.6.0": + replace_in_file(self, occt_csf_cmake, "set (CSF_TclTkLibs \"tk8.6\")", csf_tk_libs) else: - tools.replace_in_file(occt_csf_cmake, "set (CSF_TclTkLibs \"tk8.6\")", csf_tk_libs) + replace_in_file(self, occt_csf_cmake, "set (CSF_TclTkLibs \"tk8.6\")", csf_tk_libs) ## fontconfig if self._is_linux: - conan_targets.append("CONAN_PKG::fontconfig") - if tools.Version(self.version) >= "7.6.0": - tools.replace_in_file( + deps_targets.append("Fontconfig::Fontconfig") + fontconfig_libs = " ".join(self.dependencies["fontconfig"].cpp_info.aggregated_components().libs) + if Version(self.version) >= "7.6.0": + replace_in_file( + self, occt_csf_cmake, "set (CSF_fontconfig \"fontconfig\")", - "set (CSF_fontconfig \"{}\")".format(" ".join(self.deps_cpp_info["fontconfig"].libs))) + f"find_package(Fontconfig REQUIRED)\nset (CSF_fontconfig \"{fontconfig_libs}\")", + ) else: - tools.replace_in_file( + replace_in_file( + self, occt_csf_cmake, "set (CSF_fontconfig \"fontconfig\")", - "set (CSF_fontconfig \"{}\")".format(" ".join(self.deps_cpp_info["fontconfig"].libs))) + f"find_package(Fontconfig REQUIRED)\nset (CSF_fontconfig \"{fontconfig_libs}\")", + ) ## onetbb if self.options.with_tbb: - conan_targets.append("CONAN_PKG::onetbb") - tools.replace_in_file(cmakelists, "OCCT_INCLUDE_CMAKE_FILE (\"adm/cmake/tbb\")", "") - tools.replace_in_file( + deps_targets.append("TBB::tbb") + replace_in_file( + self, + cmakelists, + "OCCT_INCLUDE_CMAKE_FILE (\"adm/cmake/tbb\")", + "find_package(TBB REQUIRED)", + ) + tbb_libs = " ".join(self.dependencies["onetbb"].cpp_info.aggregated_components().libs) + replace_in_file( + self, occt_csf_cmake, "set (CSF_TBB \"tbb tbbmalloc\")", - "set (CSF_TBB \"{}\")".format(" ".join(self.deps_cpp_info["onetbb"].libs))) + f"set (CSF_TBB \"{tbb_libs}\")", + ) ## ffmpeg if self.options.with_ffmpeg: - conan_targets.append("CONAN_PKG::ffmpeg") - tools.replace_in_file(cmakelists, "OCCT_INCLUDE_CMAKE_FILE (\"adm/cmake/ffmpeg\")", "") - tools.replace_in_file( + deps_targets.append("ffmpeg::ffmpeg") + replace_in_file( + self, + cmakelists, + "OCCT_INCLUDE_CMAKE_FILE (\"adm/cmake/ffmpeg\")", + "find_package(ffmpeg REQUIRED)", + ) + ffmpeg_libs = " ".join(self.dependencies["ffmpeg"].cpp_info.aggregated_components().libs) + replace_in_file( + self, occt_csf_cmake, "set (CSF_FFmpeg \"avcodec avformat swscale avutil\")", - "set (CSF_FFmpeg \"{}\")".format(" ".join(self.deps_cpp_info["ffmpeg"].libs))) + f"set (CSF_FFmpeg \"{ffmpeg_libs}\")", + ) ## freeimage if self.options.with_freeimage: - conan_targets.append("CONAN_PKG::freeimage") - tools.replace_in_file(cmakelists, "OCCT_INCLUDE_CMAKE_FILE (\"adm/cmake/freeimage\")", "") - tools.replace_in_file( + deps_targets.append("freeimage::freeimage") + replace_in_file( + self, cmakelists, + "OCCT_INCLUDE_CMAKE_FILE (\"adm/cmake/freeimage\")", + "find_package(freeimage REQUIRED)", + ) + freeimage_libs = " ".join(self.dependencies["freeimage"].cpp_info.aggregated_components().libs) + replace_in_file( + self, occt_csf_cmake, "set (CSF_FreeImagePlus \"freeimage\")", - "set (CSF_FreeImagePlus \"{}\")".format(" ".join(self.deps_cpp_info["freeimage"].libs))) + f"set (CSF_FreeImagePlus \"{freeimage_libs}\")", + ) ## openvr if self.options.with_openvr: - conan_targets.append("CONAN_PKG::openvr") - tools.replace_in_file(cmakelists, "OCCT_INCLUDE_CMAKE_FILE (\"adm/cmake/openvr\")", "") - tools.replace_in_file( + deps_targets.append("openvr::openvr") + replace_in_file( + self, + cmakelists, + "OCCT_INCLUDE_CMAKE_FILE (\"adm/cmake/openvr\")", + "find_package(openvr REQUIRED)", + ) + openvr_libs = " ".join(self.dependencies["openvr"].cpp_info.aggregated_components().libs) + replace_in_file( + self, occt_csf_cmake, "set (CSF_OpenVR \"openvr_api\")", - "set (CSF_OpenVR \"{}\")".format(" ".join(self.deps_cpp_info["openvr"].libs))) + f"set (CSF_OpenVR \"{openvr_libs}\")", + ) ## rapidjson if self.options.with_rapidjson: - conan_targets.append("CONAN_PKG::rapidjson") - tools.replace_in_file(cmakelists, "OCCT_INCLUDE_CMAKE_FILE (\"adm/cmake/rapidjson\")", "") + deps_targets.append("rapidjson") + replace_in_file( + self, + cmakelists, + "OCCT_INCLUDE_CMAKE_FILE (\"adm/cmake/rapidjson\")", + "find_package(RapidJSON REQUIRED)", + ) ## draco if self.options.get_safe("with_draco"): - conan_targets.append("CONAN_PKG::draco") - tools.replace_in_file(cmakelists, "OCCT_INCLUDE_CMAKE_FILE (\"adm/cmake/draco\")", "") + deps_targets.append("draco::draco") + replace_in_file( + self, + cmakelists, + "OCCT_INCLUDE_CMAKE_FILE (\"adm/cmake/draco\")", + "find_package(draco REQUIRED)", + ) ## opengl - tools.replace_in_file( + replace_in_file( + self, occt_csf_cmake, "set (CSF_OpenGlLibs ", - "# set (CSF_OpenGlLibs ") + "find_package(OpenGL)\n# set (CSF_OpenGlLibs ", + ) if self._link_opengl: - conan_targets.append("CONAN_PKG::opengl") + deps_targets.append("OpenGL::GL") - ## Inject conan targets - tools.replace_in_file( + ## Inject dependencies targets + replace_in_file( + self, occt_toolkit_cmake, "${USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT}", - "${{USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT}} {}".format(" ".join(conan_targets))) + "${{USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT}} {}".format(" ".join(deps_targets)), + ) # Do not install pdb files - if tools.Version(self.version) >= "7.6.0": - tools.replace_in_file( + if Version(self.version) >= "7.6.0": + replace_in_file( + self, occt_toolkit_cmake, """ install (FILES ${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin\\${OCCT_INSTALL_BIN_LETTER}/${PROJECT_NAME}.pdb CONFIGURATIONS Debug ${aReleasePdbConf} RelWithDebInfo DESTINATION "${INSTALL_DIR_BIN}\\${OCCT_INSTALL_BIN_LETTER}")""", - "") + "", + ) else: - tools.replace_in_file( + replace_in_file( + self, occt_toolkit_cmake, """ install (FILES ${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin\\${OCCT_INSTALL_BIN_LETTER}/${PROJECT_NAME}.pdb CONFIGURATIONS Debug RelWithDebInfo DESTINATION "${INSTALL_DIR_BIN}\\${OCCT_INSTALL_BIN_LETTER}")""", - "") + "", + ) # Honor fPIC option, compiler.cppstd and compiler.libcxx - tools.replace_in_file(occt_defs_flags_cmake, "-fPIC", "") - tools.replace_in_file(occt_defs_flags_cmake, "-std=c++0x", "") - tools.replace_in_file(occt_defs_flags_cmake, "-std=gnu++0x", "") - tools.replace_in_file(occt_defs_flags_cmake, "-stdlib=libc++", "") - tools.replace_in_file(occt_csf_cmake, + replace_in_file(self, occt_defs_flags_cmake, "-fPIC", "") + replace_in_file(self, occt_defs_flags_cmake, "-std=c++0x", "") + replace_in_file(self, occt_defs_flags_cmake, "-std=gnu++0x", "") + replace_in_file(self, occt_defs_flags_cmake, "-stdlib=libc++", "") + replace_in_file(self, occt_csf_cmake, "set (CSF_ThreadLibs \"pthread rt stdc++\")", "set (CSF_ThreadLibs \"pthread rt\")") # No hardcoded link through #pragma - if tools.Version(self.version) < "7.6.0": - tools.replace_in_file( - os.path.join(self._source_subfolder, "src", "Font", "Font_FontMgr.cxx"), + if Version(self.version) < "7.6.0": + replace_in_file( + self, + os.path.join(self.source_folder, "src", "Font", "Font_FontMgr.cxx"), "#pragma comment (lib, \"freetype.lib\")", - "") - tools.replace_in_file( - os.path.join(self._source_subfolder, "src", "Draw", "Draw.cxx"), + "", + ) + replace_in_file( + self, + os.path.join(self.source_folder, "src", "Draw", "Draw.cxx"), """#pragma comment (lib, "tcl" STRINGIZE2(TCL_MAJOR_VERSION) STRINGIZE2(TCL_MINOR_VERSION) ".lib") #pragma comment (lib, "tk" STRINGIZE2(TCL_MAJOR_VERSION) STRINGIZE2(TCL_MINOR_VERSION) ".lib")""", "" ) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - - # Inject C++ standard from profile since we have removed hardcoded C++11 from upstream build files - if not tools.valid_min_cppstd(self, 11): - cmake.definitions["CMAKE_CXX_STANDARD"] = 11 - - # Generate a relocatable shared lib on Macos - cmake.definitions["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" - - cmake.definitions["BUILD_LIBRARY_TYPE"] = "Shared" if self.options.shared else "Static" - cmake.definitions["INSTALL_TEST_CASES"] = False - cmake.definitions["BUILD_RESOURCES"] = False - cmake.definitions["BUILD_RELEASE_DISABLE_EXCEPTIONS"] = True - if self.settings.build_type == "Debug": - cmake.definitions["BUILD_WITH_DEBUG"] = self.options.extended_debug_messages - cmake.definitions["BUILD_USE_PCH"] = False - cmake.definitions["INSTALL_SAMPLES"] = False - - cmake.definitions["INSTALL_DIR_LAYOUT"] = "Unix" - cmake.definitions["INSTALL_DIR_BIN"] = "bin" - cmake.definitions["INSTALL_DIR_LIB"] = "lib" - cmake.definitions["INSTALL_DIR_INCLUDE"] = "include" - cmake.definitions["INSTALL_DIR_RESOURCE"] = "res/resource" - cmake.definitions["INSTALL_DIR_DATA"] = "res/data" - cmake.definitions["INSTALL_DIR_SAMPLES"] = "res/samples" - cmake.definitions["INSTALL_DIR_DOC"] = "res/doc" - - if is_msvc(self): - cmake.definitions["BUILD_SAMPLES_MFC"] = False - cmake.definitions["BUILD_SAMPLES_QT"] = False - cmake.definitions["BUILD_Inspector"] = False - if tools.is_apple_os(self.settings.os): - cmake.definitions["USE_GLX"] = False - if self.settings.os == "Windows": - cmake.definitions["USE_D3D"] = False - cmake.definitions["BUILD_ENABLE_FPE_SIGNAL_HANDLER"] = False - cmake.definitions["BUILD_DOC_Overview"] = False - - cmake.definitions["USE_FREEIMAGE"] = self.options.with_freeimage - cmake.definitions["USE_OPENVR"] = self.options.with_openvr - cmake.definitions["USE_FFMPEG"] = self.options.with_ffmpeg - cmake.definitions["USE_TBB"] = self.options.with_tbb - cmake.definitions["USE_RAPIDJSON"] = self.options.with_rapidjson - if tools.Version(self.version) >= "7.6.0": - cmake.definitions["USE_DRACO"] = self.options.with_draco - cmake.definitions["USE_TK"] = self.options.with_tk - cmake.definitions["USE_OPENGL"] = self.options.with_opengl - - cmake.configure(source_folder=self._source_subfolder) - return cmake - def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def _replace_package_folder(self, source, target): if os.path.isdir(os.path.join(self.package_folder, source)): - tools.rmdir(os.path.join(self.package_folder, target)) + rmdir(self, os.path.join(self.package_folder, target)) rename(self, os.path.join(self.package_folder, source), os.path.join(self.package_folder, target)) def package(self): - cmake = self._configure_cmake() + cmake = CMake(self) cmake.install() - self.copy( - "LICENSE_LGPL_21.txt", - src=self._source_subfolder, - dst="licenses") - self.copy( - "OCCT_LGPL_EXCEPTION.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")) + for license_file in ["LICENSE_LGPL_21.txt", "OCCT_LGPL_EXCEPTION.txt"]: + copy(self, license_file, src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + rmdir(self, os.path.join(self.package_folder, "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) if self.settings.build_type == "Debug": self._replace_package_folder("libd", "lib") self._replace_package_folder("bind", "bin") @@ -382,24 +467,23 @@ def package(self): # 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._cmake_module_file_rel_path), - {target: "OpenCASCADE::{}".format(target) for module in occt_modules.values() for target in module} + {target: f"opencascade::{target}" for module in occt_modules.values() for target in module}, ) - @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 _cmake_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 _get_modules_from_source_code(self): csf_to_conan_dependencies = { @@ -435,25 +519,24 @@ def _get_modules_from_source_code(self): "CSF_wsock32": {"system_libs": ["wsock32"] if self.settings.os == "Windows" else []}, "CSF_d3d9": {}, # Apple OS frameworks - "CSF_Appkit": {"frameworks": ["UIKit"] if self.settings.os == "iOS" else ["Appkit"] if tools.is_apple_os(self.settings.os) else []}, - "CSF_IOKit": {"frameworks": ["IOKit"] if tools.is_apple_os(self.settings.os) else []}, + "CSF_Appkit": {"frameworks": ["UIKit"] if self.settings.os == "iOS" else ["Appkit"] if is_apple_os(self) else []}, + "CSF_IOKit": {"frameworks": ["IOKit"] if is_apple_os(self) else []}, "CSF_objc": {}, } modules = {} - # MODULES file lists all modules and all possible components per module - modules_content = tools.load(os.path.join(self.build_folder, self._source_subfolder, "adm", "MODULES")) - packaged_libs_list = tools.collect_libs(self, "lib") + # MODULES: lists all modules and all possible components per module + modules_content = load(self, os.path.join(self.source_folder, "adm", "MODULES")) + packaged_libs_list = collect_libs(self, "lib") for module_line in modules_content.splitlines(): components = {} module_components = module_line.split() components_list = [component for component in module_components[1:] if component in packaged_libs_list] for component_name in components_list: component_deps = {} - # EXTERNLIB file stores dependencies of each component. External dependencies are prefixed with CSF_ - externlib_content = tools.load(os.path.join(self.build_folder, self._source_subfolder, - "src", component_name, "EXTERNLIB")) + # EXTERNLIB: stores dependencies of each component. External dependencies are prefixed with CSF_ + externlib_content = load(self, os.path.join(self.source_folder, "src", component_name, "EXTERNLIB")) for dependency in externlib_content.splitlines(): if dependency.startswith("TK") and dependency in packaged_libs_list: component_deps.setdefault("internals", []).append(dependency) @@ -468,7 +551,7 @@ def _get_modules_from_source_code(self): return modules def _create_modules_json_file(self, modules): - tools.save(self._modules_helper_filepath, json.dumps(modules, indent=4)) + save(self, self._modules_helper_filepath, json.dumps(modules, indent=4)) @property def _modules_helper_filepath(self): @@ -478,7 +561,7 @@ def package_info(self): self.cpp_info.set_property("cmake_file_name", "OpenCASCADE") def _to_qualified_name(target): - return "occt_{}".format(target.lower()) + return f"occt_{target.lower()}" def _register_components(modules_dict): for module, targets in modules_dict.items(): @@ -516,16 +599,12 @@ def _register_components(modules_dict): self.cpp_info.components[conan_component_module_name].names["cmake_find_package"] = module self.cpp_info.components[conan_component_module_name].names["cmake_find_package_multi"] = module - occt_modules_json_content = tools.load(self._modules_helper_filepath) + occt_modules_json_content = load(self, self._modules_helper_filepath) occt_modules = json.loads(occt_modules_json_content) _register_components(occt_modules) - # DRAWEXE executable is not created if static build - if self.options.shared: - 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"] = "OpenCASCADE" - self.cpp_info.names["cmake_find_package_multi"] = "OpenCASCADE" + self.cpp_info.filenames["cmake_find_package"] = "OpenCASCADE" + self.cpp_info.filenames["cmake_find_package_multi"] = "OpenCASCADE" + if self.options.shared: + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/opencascade/all/patches/0001-undefined-ref-ncollection-lerp.patch b/recipes/opencascade/all/patches/0001-undefined-ref-ncollection-lerp.patch deleted file mode 100644 index ddfa9af0fec0a..0000000000000 --- a/recipes/opencascade/all/patches/0001-undefined-ref-ncollection-lerp.patch +++ /dev/null @@ -1,119 +0,0 @@ -Fix undefined reference with Visual Studio 2015 -see https://tracker.dev.opencascade.org/view.php?id=31922 - ---- a/src/Graphic3d/Graphic3d_Camera.cxx -+++ b/src/Graphic3d/Graphic3d_Camera.cxx -@@ -1576,18 +1576,19 @@ bool Graphic3d_Camera::ZFitAll (const Standard_Real theScaleFactor, - //function : Interpolate - //purpose : - //============================================================================= --template<> --Standard_EXPORT void NCollection_Lerp::Interpolate (const double theT, -- Handle(Graphic3d_Camera)& theCamera) const -+void Graphic3d_Camera::Interpolate (const Handle(Graphic3d_Camera)& theStart, -+ const Handle(Graphic3d_Camera)& theEnd, -+ const double theT, -+ Handle(Graphic3d_Camera)& theCamera) - { - if (Abs (theT - 1.0) < Precision::Confusion()) - { - // just copy end-point transformation -- theCamera->Copy (myEnd); -+ theCamera->Copy (theEnd); - return; - } - -- theCamera->Copy (myStart); -+ theCamera->Copy (theStart); - if (Abs (theT - 0.0) < Precision::Confusion()) - { - return; -@@ -1595,8 +1596,8 @@ Standard_EXPORT void NCollection_Lerp::Interpolate (co - - // apply rotation - { -- gp_Ax3 aCamStart = cameraToAx3 (*myStart); -- gp_Ax3 aCamEnd = cameraToAx3 (*myEnd); -+ gp_Ax3 aCamStart = cameraToAx3 (*theStart); -+ gp_Ax3 aCamEnd = cameraToAx3 (*theEnd); - gp_Trsf aTrsfStart, aTrsfEnd; - aTrsfStart.SetTransformation (aCamStart, gp::XOY()); - aTrsfEnd .SetTransformation (aCamEnd, gp::XOY()); -@@ -1612,13 +1613,13 @@ Standard_EXPORT void NCollection_Lerp::Interpolate (co - - // apply translation - { -- gp_XYZ aCenter = NCollection_Lerp::Interpolate (myStart->Center().XYZ(), myEnd->Center().XYZ(), theT); -- gp_XYZ anEye = NCollection_Lerp::Interpolate (myStart->Eye().XYZ(), myEnd->Eye().XYZ(), theT); -+ gp_XYZ aCenter = NCollection_Lerp::Interpolate (theStart->Center().XYZ(), theEnd->Center().XYZ(), theT); -+ gp_XYZ anEye = NCollection_Lerp::Interpolate (theStart->Eye().XYZ(), theEnd->Eye().XYZ(), theT); - gp_XYZ anAnchor = aCenter; - Standard_Real aKc = 0.0; - -- const Standard_Real aDeltaCenter = myStart->Center().Distance (myEnd->Center()); -- const Standard_Real aDeltaEye = myStart->Eye() .Distance (myEnd->Eye()); -+ const Standard_Real aDeltaCenter = theStart->Center().Distance (theEnd->Center()); -+ const Standard_Real aDeltaEye = theStart->Eye() .Distance (theEnd->Eye()); - if (aDeltaEye <= gp::Resolution()) - { - anAnchor = anEye; -@@ -1628,14 +1629,14 @@ Standard_EXPORT void NCollection_Lerp::Interpolate (co - { - aKc = aDeltaCenter / (aDeltaCenter + aDeltaEye); - -- const gp_XYZ anAnchorStart = NCollection_Lerp::Interpolate (myStart->Center().XYZ(), myStart->Eye().XYZ(), aKc); -- const gp_XYZ anAnchorEnd = NCollection_Lerp::Interpolate (myEnd ->Center().XYZ(), myEnd ->Eye().XYZ(), aKc); -+ const gp_XYZ anAnchorStart = NCollection_Lerp::Interpolate (theStart->Center().XYZ(), theStart->Eye().XYZ(), aKc); -+ const gp_XYZ anAnchorEnd = NCollection_Lerp::Interpolate (theEnd ->Center().XYZ(), theEnd ->Eye().XYZ(), aKc); - anAnchor = NCollection_Lerp::Interpolate (anAnchorStart, anAnchorEnd, theT); - } - - const gp_Vec aDirEyeToCenter = theCamera->Direction(); -- const Standard_Real aDistEyeCenterStart = myStart->Eye().Distance (myStart->Center()); -- const Standard_Real aDistEyeCenterEnd = myEnd ->Eye().Distance (myEnd ->Center()); -+ const Standard_Real aDistEyeCenterStart = theStart->Eye().Distance (theStart->Center()); -+ const Standard_Real aDistEyeCenterEnd = theEnd ->Eye().Distance (theEnd ->Center()); - const Standard_Real aDistEyeCenter = NCollection_Lerp::Interpolate (aDistEyeCenterStart, aDistEyeCenterEnd, theT); - aCenter = anAnchor + aDirEyeToCenter.XYZ() * aDistEyeCenter * aKc; - anEye = anAnchor - aDirEyeToCenter.XYZ() * aDistEyeCenter * (1.0 - aKc); -@@ -1644,10 +1645,10 @@ Standard_EXPORT void NCollection_Lerp::Interpolate (co - } - - // apply scaling -- if (Abs(myStart->Scale() - myEnd->Scale()) > Precision::Confusion() -- && myStart->IsOrthographic()) -+ if (Abs(theStart->Scale() - theEnd->Scale()) > Precision::Confusion() -+ && theStart->IsOrthographic()) - { -- const Standard_Real aScale = NCollection_Lerp::Interpolate (myStart->Scale(), myEnd->Scale(), theT); -+ const Standard_Real aScale = NCollection_Lerp::Interpolate (theStart->Scale(), theEnd->Scale(), theT); - theCamera->SetScale (aScale); - } - } ---- a/src/Graphic3d/Graphic3d_Camera.hxx -+++ b/src/Graphic3d/Graphic3d_Camera.hxx -@@ -148,6 +148,10 @@ public: - }; - - public: -+ Standard_EXPORT static void Interpolate (const Handle(Graphic3d_Camera)& theStart, -+ const Handle(Graphic3d_Camera)& theEnd, -+ const double theT, -+ Handle(Graphic3d_Camera)& theCamera); - - //! Default constructor. - //! Initializes camera with the following properties: -@@ -852,8 +856,11 @@ DEFINE_STANDARD_HANDLE (Graphic3d_Camera, Standard_Transient) - //! In this case, application might define intermediate camera positions for interpolation - //! or implement own interpolation logic. - template<> --Standard_EXPORT void NCollection_Lerp::Interpolate (const double theT, -- Handle(Graphic3d_Camera)& theResult) const; -+inline void NCollection_Lerp::Interpolate (const double theT, -+ Handle(Graphic3d_Camera)& theResult) const -+{ -+ Graphic3d_Camera::Interpolate (myStart, myEnd, theT, theResult); -+} - typedef NCollection_Lerp Graphic3d_CameraLerp; - - #endif diff --git a/recipes/opencascade/all/patches/7.5.0-0001-fix-compile-error-cxx17.patch b/recipes/opencascade/all/patches/7.5.0-0001-fix-compile-error-cxx17.patch new file mode 100644 index 0000000000000..5084de84816a3 --- /dev/null +++ b/recipes/opencascade/all/patches/7.5.0-0001-fix-compile-error-cxx17.patch @@ -0,0 +1,83 @@ +--- a/src/QANCollection/QANCollection_Stl.cxx ++++ b/src/QANCollection/QANCollection_Stl.cxx +@@ -38,18 +38,11 @@ + #include + #include + #include ++#include + + //! Size of test data sets. + const int THE_TEST_SIZE = 5000; + +-namespace { +- // Auxiliary class to use in std::random_shuffle() +- struct RandomGenerator { +- RandomGenerator () { srand(1); } +- ptrdiff_t operator () (ptrdiff_t upper) const { return rand() % upper; } +- }; +-} +- + template + struct CollectionFiller + { +@@ -951,11 +944,13 @@ void TestPerformanceRandomIterator(Draw_Interpretor& di) + aTimer.Reset(); + aTimer.Start(); + { +- RandomGenerator aRandomGen; ++ std::random_device ran_dev; ++ std::mt19937 gen(ran_dev()); ++ gen.seed(0x03ac38f2); + for (Standard_Integer anIdx = 0; anIdx < 10; ++anIdx) + { +- std::sort (aVector->begin(), aVector->end()); +- std::random_shuffle (aVector->begin(), aVector->end(), aRandomGen); ++ std::sort (aVector->begin(), aVector->end()); ++ std::shuffle (aVector->begin(), aVector->end(), gen); + } + } + aTimer.Stop(); +@@ -965,11 +960,13 @@ void TestPerformanceRandomIterator(Draw_Interpretor& di) + aTimer.Reset(); + aTimer.Start(); + { +- RandomGenerator aRandomGen; ++ std::random_device ran_dev; ++ std::mt19937 gen(ran_dev()); ++ gen.seed(0x03ac38f2); + for (Standard_Integer anIdx = 0; anIdx < 10; ++anIdx) + { +- std::sort (aCollec->begin(), aCollec->end()); +- std::random_shuffle (aCollec->begin(), aCollec->end(), aRandomGen); ++ std::sort (aCollec->begin(), aCollec->end()); ++ std::shuffle (aCollec->begin(), aCollec->end(), gen); + } + } + aTimer.Stop(); +@@ -981,7 +978,7 @@ void TestPerformanceRandomIterator(Draw_Interpretor& di) + + // check that result is the same + if ( ! std::equal (aVector->begin(), aVector->end(), aCollec->begin()) ) +- di << "Error: sequences are not the same at the end!\n"; ++ di << "Error: sequences are not the same at the end (random iterator)!\n"; + + delete aVector; + delete aCollec; +@@ -1033,7 +1030,7 @@ void TestPerformanceForwardIterator(Draw_Interpretor& di) + + // check that result is the same + if ( ! std::equal (aVector->begin(), aVector->end(), aCollec->begin()) ) +- di << "Error: sequences are not the same at the end!\n"; ++ di << "Error: sequences are not the same at the end (forward iterator)!\n"; + + delete aVector; + delete aCollec; +@@ -1085,7 +1082,7 @@ void TestPerformanceBidirIterator(Draw_Interpretor& di) + + // check that result is the same + if ( ! std::equal (aVector->begin(), aVector->end(), aCollec->begin()) ) +- di << "Error: sequences are not the same at the end!\n"; ++ di << "Error: sequences are not the same at the end (bidir iterator)!\n"; + + delete aVector; + delete aCollec; diff --git a/recipes/opencascade/all/patches/7.5.0-0002-fix-compile-error-cxx20.patch b/recipes/opencascade/all/patches/7.5.0-0002-fix-compile-error-cxx20.patch new file mode 100644 index 0000000000000..ebda62599bb8f --- /dev/null +++ b/recipes/opencascade/all/patches/7.5.0-0002-fix-compile-error-cxx20.patch @@ -0,0 +1,45 @@ +--- a/src/XSDRAW/XSDRAW.cxx ++++ b/src/XSDRAW/XSDRAW.cxx +@@ -40,7 +40,8 @@ + #include + #include + +-#include ++#include ++#include + //#include + static int deja = 0, dejald = 0; + //unused variable +@@ -245,16 +246,23 @@ void XSDRAW::LoadDraw (Draw_Interpretor& theCommands) + Handle(TColStd_HSequenceOfTransient) XSDRAW::GetList + (const Standard_CString first, const Standard_CString second) + { +- Handle(TColStd_HSequenceOfTransient) list; +- if (!first || first[0] == '\0') { +- char ligne[80]; ligne[0] = '\0'; char truc; +-// std::cin.clear(); std::cin.get (ligne,79,'\n'); +- std::cin >> ligne; Standard_Size ln = strlen(ligne); +- char *ff = &ligne[0], *ss = NULL; +- std::cin.get(truc); if (truc != '\n') { std::cin>>&ligne[ln+1]; ss = &ligne[ln+1]; } +- return XSDRAW::GetList (ff,ss); ++ if ( !first || first[0] == '\0' ) ++ { ++ std::string aLineFirst; ++ std::cin >> aLineFirst; ++ ++ char terminateSymbol = '\0'; ++ std::cin.get(terminateSymbol); ++ ++ if ( terminateSymbol == '\n' ) ++ return XSDRAW::GetList (aLineFirst.c_str(), nullptr); ++ else ++ { ++ std::string aLineSecond; ++ std::cin >> aLineSecond; ++ return XSDRAW::GetList (aLineFirst.c_str(), aLineSecond.c_str()); ++ } + } +-// return IFSelect_Functions::GiveList (Session(),first,second); + return IFSelect_Functions::GiveList (Session(),first,second); + } + diff --git a/recipes/opencascade/all/patches/7.5.0-0003-undefined-ref-ncollection-lerp.patch b/recipes/opencascade/all/patches/7.5.0-0003-undefined-ref-ncollection-lerp.patch new file mode 100644 index 0000000000000..8c42c0b9ae17f --- /dev/null +++ b/recipes/opencascade/all/patches/7.5.0-0003-undefined-ref-ncollection-lerp.patch @@ -0,0 +1,116 @@ +--- a/src/Graphic3d/Graphic3d_Camera.cxx ++++ b/src/Graphic3d/Graphic3d_Camera.cxx +@@ -1576,18 +1576,19 @@ bool Graphic3d_Camera::ZFitAll (const Standard_Real theScaleFactor, + //function : Interpolate + //purpose : + //============================================================================= +-template<> +-Standard_EXPORT void NCollection_Lerp::Interpolate (const double theT, +- Handle(Graphic3d_Camera)& theCamera) const ++void Graphic3d_Camera::Interpolate (const Handle(Graphic3d_Camera)& theStart, ++ const Handle(Graphic3d_Camera)& theEnd, ++ const double theT, ++ Handle(Graphic3d_Camera)& theCamera) + { + if (Abs (theT - 1.0) < Precision::Confusion()) + { + // just copy end-point transformation +- theCamera->Copy (myEnd); ++ theCamera->Copy (theEnd); + return; + } + +- theCamera->Copy (myStart); ++ theCamera->Copy (theStart); + if (Abs (theT - 0.0) < Precision::Confusion()) + { + return; +@@ -1595,8 +1596,8 @@ Standard_EXPORT void NCollection_Lerp::Interpolate (co + + // apply rotation + { +- gp_Ax3 aCamStart = cameraToAx3 (*myStart); +- gp_Ax3 aCamEnd = cameraToAx3 (*myEnd); ++ gp_Ax3 aCamStart = cameraToAx3 (*theStart); ++ gp_Ax3 aCamEnd = cameraToAx3 (*theEnd); + gp_Trsf aTrsfStart, aTrsfEnd; + aTrsfStart.SetTransformation (aCamStart, gp::XOY()); + aTrsfEnd .SetTransformation (aCamEnd, gp::XOY()); +@@ -1612,13 +1613,13 @@ Standard_EXPORT void NCollection_Lerp::Interpolate (co + + // apply translation + { +- gp_XYZ aCenter = NCollection_Lerp::Interpolate (myStart->Center().XYZ(), myEnd->Center().XYZ(), theT); +- gp_XYZ anEye = NCollection_Lerp::Interpolate (myStart->Eye().XYZ(), myEnd->Eye().XYZ(), theT); ++ gp_XYZ aCenter = NCollection_Lerp::Interpolate (theStart->Center().XYZ(), theEnd->Center().XYZ(), theT); ++ gp_XYZ anEye = NCollection_Lerp::Interpolate (theStart->Eye().XYZ(), theEnd->Eye().XYZ(), theT); + gp_XYZ anAnchor = aCenter; + Standard_Real aKc = 0.0; + +- const Standard_Real aDeltaCenter = myStart->Center().Distance (myEnd->Center()); +- const Standard_Real aDeltaEye = myStart->Eye() .Distance (myEnd->Eye()); ++ const Standard_Real aDeltaCenter = theStart->Center().Distance (theEnd->Center()); ++ const Standard_Real aDeltaEye = theStart->Eye() .Distance (theEnd->Eye()); + if (aDeltaEye <= gp::Resolution()) + { + anAnchor = anEye; +@@ -1628,14 +1629,14 @@ Standard_EXPORT void NCollection_Lerp::Interpolate (co + { + aKc = aDeltaCenter / (aDeltaCenter + aDeltaEye); + +- const gp_XYZ anAnchorStart = NCollection_Lerp::Interpolate (myStart->Center().XYZ(), myStart->Eye().XYZ(), aKc); +- const gp_XYZ anAnchorEnd = NCollection_Lerp::Interpolate (myEnd ->Center().XYZ(), myEnd ->Eye().XYZ(), aKc); ++ const gp_XYZ anAnchorStart = NCollection_Lerp::Interpolate (theStart->Center().XYZ(), theStart->Eye().XYZ(), aKc); ++ const gp_XYZ anAnchorEnd = NCollection_Lerp::Interpolate (theEnd ->Center().XYZ(), theEnd ->Eye().XYZ(), aKc); + anAnchor = NCollection_Lerp::Interpolate (anAnchorStart, anAnchorEnd, theT); + } + + const gp_Vec aDirEyeToCenter = theCamera->Direction(); +- const Standard_Real aDistEyeCenterStart = myStart->Eye().Distance (myStart->Center()); +- const Standard_Real aDistEyeCenterEnd = myEnd ->Eye().Distance (myEnd ->Center()); ++ const Standard_Real aDistEyeCenterStart = theStart->Eye().Distance (theStart->Center()); ++ const Standard_Real aDistEyeCenterEnd = theEnd ->Eye().Distance (theEnd ->Center()); + const Standard_Real aDistEyeCenter = NCollection_Lerp::Interpolate (aDistEyeCenterStart, aDistEyeCenterEnd, theT); + aCenter = anAnchor + aDirEyeToCenter.XYZ() * aDistEyeCenter * aKc; + anEye = anAnchor - aDirEyeToCenter.XYZ() * aDistEyeCenter * (1.0 - aKc); +@@ -1644,10 +1645,10 @@ Standard_EXPORT void NCollection_Lerp::Interpolate (co + } + + // apply scaling +- if (Abs(myStart->Scale() - myEnd->Scale()) > Precision::Confusion() +- && myStart->IsOrthographic()) ++ if (Abs(theStart->Scale() - theEnd->Scale()) > Precision::Confusion() ++ && theStart->IsOrthographic()) + { +- const Standard_Real aScale = NCollection_Lerp::Interpolate (myStart->Scale(), myEnd->Scale(), theT); ++ const Standard_Real aScale = NCollection_Lerp::Interpolate (theStart->Scale(), theEnd->Scale(), theT); + theCamera->SetScale (aScale); + } + } +--- a/src/Graphic3d/Graphic3d_Camera.hxx ++++ b/src/Graphic3d/Graphic3d_Camera.hxx +@@ -148,6 +148,10 @@ public: + }; + + public: ++ Standard_EXPORT static void Interpolate (const Handle(Graphic3d_Camera)& theStart, ++ const Handle(Graphic3d_Camera)& theEnd, ++ const double theT, ++ Handle(Graphic3d_Camera)& theCamera); + + //! Default constructor. + //! Initializes camera with the following properties: +@@ -852,8 +856,11 @@ DEFINE_STANDARD_HANDLE (Graphic3d_Camera, Standard_Transient) + //! In this case, application might define intermediate camera positions for interpolation + //! or implement own interpolation logic. + template<> +-Standard_EXPORT void NCollection_Lerp::Interpolate (const double theT, +- Handle(Graphic3d_Camera)& theResult) const; ++inline void NCollection_Lerp::Interpolate (const double theT, ++ Handle(Graphic3d_Camera)& theResult) const ++{ ++ Graphic3d_Camera::Interpolate (myStart, myEnd, theT, theResult); ++} + typedef NCollection_Lerp Graphic3d_CameraLerp; + + #endif diff --git a/recipes/opencascade/all/test_package/CMakeLists.txt b/recipes/opencascade/all/test_package/CMakeLists.txt index 21320b4482f5b..3f52809e46906 100644 --- a/recipes/opencascade/all/test_package/CMakeLists.txt +++ b/recipes/opencascade/all/test_package/CMakeLists.txt @@ -1,17 +1,14 @@ -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) # Test components -find_package(OpenCASCADE COMPONENTS FoundationClasses ModelingData ModelingAlgorithms CONFIG) +find_package(OpenCASCADE REQUIRED FoundationClasses ModelingData ModelingAlgorithms CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} TKMath TKGeomBase TKTopAlgo TKBRep) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE TKMath TKGeomBase TKTopAlgo TKBRep) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) # Test global conan target add_executable(${PROJECT_NAME}_global test_package.cpp) -target_link_libraries(${PROJECT_NAME}_global CONAN_PKG::opencascade) -set_property(TARGET ${PROJECT_NAME}_global PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME}_global PRIVATE opencascade::opencascade) +target_compile_features(${PROJECT_NAME}_global PRIVATE cxx_std_11) diff --git a/recipes/opencascade/all/test_package/conanfile.py b/recipes/opencascade/all/test_package/conanfile.py index 13290d598bb5f..9283a22ebe1e0 100644 --- a/recipes/opencascade/all/test_package/conanfile.py +++ b/recipes/opencascade/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): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) - bin_path_global = os.path.join("bin", "test_package_global") - self.run(bin_path_global, run_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_global = os.path.join(self.cpp.build.bindirs[0], "test_package_global") + self.run(bin_path_global, env="conanrun") diff --git a/recipes/opencascade/all/test_v1_package/CMakeLists.txt b/recipes/opencascade/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/opencascade/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/opencascade/all/test_v1_package/conanfile.py b/recipes/opencascade/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..13290d598bb5f --- /dev/null +++ b/recipes/opencascade/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) + bin_path_global = os.path.join("bin", "test_package_global") + self.run(bin_path_global, run_environment=True) diff --git a/recipes/opencl-clhpp-headers/all/conandata.yml b/recipes/opencl-clhpp-headers/all/conandata.yml new file mode 100644 index 0000000000000..dccc1bdf6f829 --- /dev/null +++ b/recipes/opencl-clhpp-headers/all/conandata.yml @@ -0,0 +1,34 @@ +sources: + "2023.12.14": + url: "https://github.com/KhronosGroup/OpenCL-CLHPP/archive/refs/tags/v2023.12.14.tar.gz" + sha256: "9106700634e79cfa0935ebd67197f64689ced24c42da702acf18fa8435bd8a82" + "2023.04.17": + url: "https://github.com/KhronosGroup/OpenCL-CLHPP/archive/refs/tags/v2023.04.17.tar.gz" + sha256: "179243843c620ef6f78b52937aaaa0a742c6ff415f9aaefe3c20225ee283b357" + "2023.02.06": + url: "https://github.com/KhronosGroup/OpenCL-CLHPP/archive/refs/tags/v2023.02.06.tar.gz" + sha256: "2726106df611fb5cb65503a52df27988d80c0b8844c8f0901c6092ab43701e8c" + "2022.09.30": + url: "https://github.com/KhronosGroup/OpenCL-CLHPP/archive/refs/tags/v2022.09.30.tar.gz" + sha256: "999dec3ebf451f0f1087e5e1b9a5af91434b4d0c496d47e912863ac85ad1e6b2" + "2022.05.18": + url: "https://github.com/KhronosGroup/OpenCL-CLHPP/archive/refs/tags/v2022.05.18.tar.gz" + sha256: "d29affd740c5037b4499790613f5af0718ffc88c325e793b73cb35b7592fc0f7" + "2022.01.04": + url: "https://github.com/KhronosGroup/OpenCL-CLHPP/archive/refs/tags/v2.0.16.tar.gz" + sha256: "869456032e60787eed9fceaeaf6c6cb4452bc0ff97e0f5a271510145a1c8f4d4" + "2021.06.30": + url: "https://github.com/KhronosGroup/OpenCL-CLHPP/archive/refs/tags/v2.0.15.tar.gz" + sha256: "0175806508abc699586fc9a9387e01eb37bf812ca534e3b493ff3091ec2a9246" + "2021.04.29": + url: "https://github.com/KhronosGroup/OpenCL-CLHPP/archive/refs/tags/v2.0.14.tar.gz" + sha256: "c8821a7638e57a2c4052631c941af720b581edda634db6ab0b59924c958d69b6" + "2020.12.18": + url: "https://github.com/KhronosGroup/OpenCL-CLHPP/archive/refs/tags/v2.0.13.tar.gz" + sha256: "8ff0d0cd94d728edd30c876db546bf13e370ee7863629b4b9b5e2ef8e130d23c" + "2020.06.16": + url: "https://github.com/KhronosGroup/OpenCL-CLHPP/archive/refs/tags/v2.0.12.tar.gz" + sha256: "20b28709ce74d3602f1a946d78a2024c1f6b0ef51358b9686612669897a58719" + "2020.03.13": + url: "https://github.com/KhronosGroup/OpenCL-CLHPP/archive/refs/tags/v2.0.11.tar.gz" + sha256: "ffc2ca08cf4ae90ee55f14ea3735ccc388f454f4422b69498b2e9b93a1d45181" diff --git a/recipes/opencl-clhpp-headers/all/conanfile.py b/recipes/opencl-clhpp-headers/all/conanfile.py new file mode 100644 index 0000000000000..80288ec7b3f8d --- /dev/null +++ b/recipes/opencl-clhpp-headers/all/conanfile.py @@ -0,0 +1,78 @@ +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 OpenclClhppHeadersConan(ConanFile): + name = "opencl-clhpp-headers" + description = "C++ language headers for the OpenCL API" + license = "Apache-2.0" + topics = ("opencl", "header-only", "api-headers") + homepage = "https://github.com/KhronosGroup/OpenCL-CLHPP" + 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 _target_name(self): + return "OpenCL::HeadersCpp" + + 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], strip_root=True) + + def requirements(self): + self.requires(f"opencl-headers/{self.version}", transitive_headers=True) + + 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) + + def generate(self): + # 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._target_name: f"{self.name}::{self.name}"} + ) + + def build(self): + pass + + def package(self): + copy(self, "LICENSE.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*", src=os.path.join(self.source_folder, "include", "CL"), dst=os.path.join(self.package_folder, "include", "CL")) + + @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", "OpenCLHeadersCpp") + self.cpp_info.set_property("cmake_target_name", self._target_name) + self.cpp_info.set_property("pkg_config_name", "OpenCL-CLHPP") + self.cpp_info.requires = ["opencl-headers::opencl-headers"] + 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"] = "OpenCLHeadersCpp" + self.cpp_info.filenames["cmake_find_package_multi"] = "OpenCLHeadersCpp" + 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/opencl-clhpp-headers/all/test_package/CMakeLists.txt b/recipes/opencl-clhpp-headers/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..733d421e88716 --- /dev/null +++ b/recipes/opencl-clhpp-headers/all/test_package/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES CXX) + +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +find_package(OpenCLHeadersCpp REQUIRED CONFIG) + +add_library(${PROJECT_NAME} OBJECT test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE OpenCL::HeadersCpp) + +if(OpenCLHeadersCpp_VERSION VERSION_GREATER 2020.06.16) + target_compile_definitions(${PROJECT_NAME} PRIVATE USE_OPENCL_HPP) +endif() diff --git a/recipes/opencl-clhpp-headers/all/test_package/conanfile.py b/recipes/opencl-clhpp-headers/all/test_package/conanfile.py new file mode 100644 index 0000000000000..7f3268933acd2 --- /dev/null +++ b/recipes/opencl-clhpp-headers/all/test_package/conanfile.py @@ -0,0 +1,22 @@ +from conan import ConanFile +from conan.tools.cmake import CMake, cmake_layout + + +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): + pass diff --git a/recipes/opencl-clhpp-headers/all/test_package/test_package.cpp b/recipes/opencl-clhpp-headers/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..a1e2c103aae1a --- /dev/null +++ b/recipes/opencl-clhpp-headers/all/test_package/test_package.cpp @@ -0,0 +1,26 @@ +#define CL_HPP_MINIMUM_OPENCL_VERSION 120 +#define CL_HPP_TARGET_OPENCL_VERSION 120 + +#ifdef USE_OPENCL_HPP +#include +#else +#include +#endif + +#include +#include + +int main() { + cl::Context context; + cl::Device device_id; + + (void) context; + (void) device_id; + + if (CL_VERSION_1_2 != 1) { + std::cerr << "Wrong OpenCL header version"; + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; +} diff --git a/recipes/opencl-clhpp-headers/all/test_v1_package/CMakeLists.txt b/recipes/opencl-clhpp-headers/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/opencl-clhpp-headers/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/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-clhpp-headers/all/test_v1_package/conanfile.py b/recipes/opencl-clhpp-headers/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..92704204c75e6 --- /dev/null +++ b/recipes/opencl-clhpp-headers/all/test_v1_package/conanfile.py @@ -0,0 +1,15 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + pass diff --git a/recipes/opencl-clhpp-headers/config.yml b/recipes/opencl-clhpp-headers/config.yml new file mode 100644 index 0000000000000..33facd761b66c --- /dev/null +++ b/recipes/opencl-clhpp-headers/config.yml @@ -0,0 +1,23 @@ +versions: + "2023.12.14": + folder: all + "2023.04.17": + folder: all + "2023.02.06": + folder: all + "2022.09.30": + folder: all + "2022.05.18": + folder: all + "2022.01.04": + folder: all + "2021.06.30": + folder: all + "2021.04.29": + folder: all + "2020.12.18": + folder: all + "2020.06.16": + folder: all + "2020.03.13": + folder: all diff --git a/recipes/opencl-headers/all/conandata.yml b/recipes/opencl-headers/all/conandata.yml index bc33b51742e45..c12029431ef1b 100644 --- a/recipes/opencl-headers/all/conandata.yml +++ b/recipes/opencl-headers/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "2023.12.14": + url: "https://github.com/KhronosGroup/OpenCL-Headers/archive/refs/tags/v2023.12.14.tar.gz" + sha256: "407d5e109a70ec1b6cd3380ce357c21e3d3651a91caae6d0d8e1719c69a1791d" + "2023.04.17": + url: "https://github.com/KhronosGroup/OpenCL-Headers/archive/refs/tags/v2023.04.17.tar.gz" + sha256: "0ce992f4167f958f68a37918dec6325be18f848dee29a4521c633aae3304915d" + "2023.02.06": + url: "https://github.com/KhronosGroup/OpenCL-Headers/archive/refs/tags/v2023.02.06.tar.gz" + sha256: "464d1b04a5e185739065b2d86e4cebf02c154c416d63e6067a5060d7c053c79a" "2022.09.30": url: "https://github.com/KhronosGroup/OpenCL-Headers/archive/refs/tags/v2022.09.30.tar.gz" sha256: "0ae857ecb28af95a420c800b21ed2d0f437503e104f841ab8db249df5f4fbe5c" diff --git a/recipes/opencl-headers/all/conanfile.py b/recipes/opencl-headers/all/conanfile.py index 3e936c8d7457e..f2f779e3923da 100644 --- a/recipes/opencl-headers/all/conanfile.py +++ b/recipes/opencl-headers/all/conanfile.py @@ -1,7 +1,8 @@ from conan import ConanFile -from conan.tools.files import copy, get +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" @@ -13,9 +14,14 @@ class OpenclHeadersConan(ConanFile): topics = ("opencl", "header-only", "api-headers") homepage = "https://github.com/KhronosGroup/OpenCL-Headers" 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 _target_name(self): + return "OpenCL::Headers" + def layout(self): basic_layout(self, src_folder="src") @@ -23,8 +29,7 @@ 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 @@ -33,22 +38,37 @@ 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, "CL"), dst=os.path.join(self.package_folder, "include", "CL")) + 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) + + def generate(self): + # 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._target_name: f"{self.name}::{self.name}"} + ) + + @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", "OpenCLHeaders") - self.cpp_info.set_property("cmake_target_name", "OpenCL::Headers") - self.cpp_info.set_property("pkg_config_name", "OpenCL") + self.cpp_info.set_property("cmake_target_name", self._target_name) + self.cpp_info.set_property("pkg_config_name", "OpenCL-Headers") 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"] = "OpenCLHeaders" self.cpp_info.filenames["cmake_find_package_multi"] = "OpenCLHeaders" - self.cpp_info.names["cmake_find_package"] = "OpenCL" - self.cpp_info.names["cmake_find_package_multi"] = "OpenCL" - self.cpp_info.names["pkg_config"] = "OpenCL" - self.cpp_info.components["_opencl-headers"].names["cmake_find_package"] = "Headers" - self.cpp_info.components["_opencl-headers"].names["cmake_find_package_multi"] = "Headers" - 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"].libdirs = [] + 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/opencl-headers/config.yml b/recipes/opencl-headers/config.yml index ce621bb7cdbe5..33facd761b66c 100644 --- a/recipes/opencl-headers/config.yml +++ b/recipes/opencl-headers/config.yml @@ -1,4 +1,10 @@ versions: + "2023.12.14": + folder: all + "2023.04.17": + folder: all + "2023.02.06": + folder: all "2022.09.30": folder: all "2022.05.18": diff --git a/recipes/opencl-icd-loader/all/conandata.yml b/recipes/opencl-icd-loader/all/conandata.yml index 398c17f249549..41da7d924af19 100644 --- a/recipes/opencl-icd-loader/all/conandata.yml +++ b/recipes/opencl-icd-loader/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "2023.12.14": + url: "https://github.com/KhronosGroup/OpenCL-ICD-Loader/archive/refs/tags/v2023.12.14.tar.gz" + sha256: "af8df96f1e1030329e8d4892ba3aa761b923838d4c689ef52d97822ab0bd8917" + "2023.04.17": + url: "https://github.com/KhronosGroup/OpenCL-ICD-Loader/archive/refs/tags/v2023.04.17.tar.gz" + sha256: "173bdc4f321d550b6578ad2aafc2832f25fbb36041f095e6221025f74134b876" + "2023.02.06": + url: "https://github.com/KhronosGroup/OpenCL-ICD-Loader/archive/refs/tags/v2023.02.06.tar.gz" + sha256: "f31a932b470c1e115d6a858b25c437172809b939953dc1cf20a3a15e8785d698" "2022.09.30": url: "https://github.com/KhronosGroup/OpenCL-ICD-Loader/archive/refs/tags/v2022.09.30.tar.gz" sha256: "e9522fb736627dd4feae2a9c467a864e7d25bb715f808de8a04eea5a7d394b74" diff --git a/recipes/opencl-icd-loader/all/conanfile.py b/recipes/opencl-icd-loader/all/conanfile.py index 58940f83c77c3..ae7aae3d17794 100644 --- a/recipes/opencl-icd-loader/all/conanfile.py +++ b/recipes/opencl-icd-loader/all/conanfile.py @@ -1,10 +1,11 @@ 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.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.52.0" +required_conan_version = ">=1.54.0" class OpenclIcdLoaderConan(ConanFile): @@ -14,7 +15,7 @@ class OpenclIcdLoaderConan(ConanFile): topics = ("opencl", "khronos", "parallel", "icd-loader") homepage = "https://github.com/KhronosGroup/OpenCL-ICD-Loader" url = "https://github.com/conan-io/conan-center-index" - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -38,40 +39,30 @@ def config_options(self): 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 + 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"opencl-headers/{self.version}", transitive_headers=True) + self.requires(f"opencl-clhpp-headers/{self.version}", transitive_headers=True) 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.cache_variables["OPENCL_ICD_LOADER_HEADERS_DIR"] = ";".join(self.deps_cpp_info["opencl-headers"].include_paths) + opencl_headers_includedirs = self.dependencies["opencl-headers"].cpp_info.aggregated_components().includedirs + tc.cache_variables["OPENCL_ICD_LOADER_HEADERS_DIR"] = ";".join(opencl_headers_includedirs) 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": 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): @@ -86,6 +77,8 @@ def package(self): cmake.install() rm(self, "*.pdb", 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")) + fix_apple_shared_install_name(self) def package_info(self): self.cpp_info.set_property("cmake_find_mode", "both") diff --git a/recipes/opencl-icd-loader/all/test_package/test_package.c b/recipes/opencl-icd-loader/all/test_package/test_package.c index 4c923ce588658..42b334ba331d4 100644 --- a/recipes/opencl-icd-loader/all/test_package/test_package.c +++ b/recipes/opencl-icd-loader/all/test_package/test_package.c @@ -1,3 +1,4 @@ +#define CL_TARGET_OPENCL_VERSION 120 #include int main() { diff --git a/recipes/opencl-icd-loader/config.yml b/recipes/opencl-icd-loader/config.yml index ee1b6d54f979e..59d020bde1e4e 100644 --- a/recipes/opencl-icd-loader/config.yml +++ b/recipes/opencl-icd-loader/config.yml @@ -1,4 +1,10 @@ versions: + "2023.12.14": + folder: all + "2023.04.17": + folder: all + "2023.02.06": + folder: all "2022.09.30": folder: all "2022.05.18": diff --git a/recipes/opencolorio/all/CMakeLists.txt b/recipes/opencolorio/all/CMakeLists.txt deleted file mode 100644 index 61f3d3b039e2b..0000000000000 --- a/recipes/opencolorio/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/opencolorio/all/conandata.yml b/recipes/opencolorio/all/conandata.yml index 23ef77f414ab2..ded9b55cd99f7 100644 --- a/recipes/opencolorio/all/conandata.yml +++ b/recipes/opencolorio/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "2.4.0": + url: "https://github.com/AcademySoftwareFoundation/OpenColorIO/archive/v2.4.0.tar.gz" + sha256: "0ff3966b9214da0941b2b1cbdab3975a00a51fc6f3417fa860f98f5358f2c282" + "2.3.2": + url: "https://github.com/AcademySoftwareFoundation/OpenColorIO/archive/v2.3.2.tar.gz" + sha256: "6bbf4e7fa4ea2f743a238cb22aff44890425771a2f57f62cece1574e46ceec2f" + "2.2.1": + url: "https://github.com/AcademySoftwareFoundation/OpenColorIO/archive/v2.2.1.tar.gz" + sha256: "36f27c5887fc4e5c241805c29b8b8e68725aa05520bcaa7c7ec84c0422b8580e" "2.1.0": url: "https://github.com/AcademySoftwareFoundation/OpenColorIO/archive/v2.1.0.tar.gz" sha256: "81fc7853a490031632a69c73716bc6ac271b395e2ba0e2587af9995c2b0efb5f" @@ -6,13 +15,39 @@ sources: url: "https://github.com/AcademySoftwareFoundation/OpenColorIO/archive/v1.1.1.tar.gz" sha256: "c9b5b9def907e1dafb29e37336b702fff22cc6306d445a13b1621b8a754c14c8" patches: + "2.4.0": + - patch_file: "patches/2.4.0-0001-fix-cmake-source-dir-and-targets.patch" + patch_description: "use cci package, use PROJECT_BINARY_DIR/PROJECT_SOURCE_DIR" + patch_type: "conan" + "2.3.2": + - patch_file: "patches/2.3.1-0001-fix-cmake-source-dir-and-targets.patch" + patch_description: "use cci package, use PROJECT_BINARY_DIR/PROJECT_SOURCE_DIR" + patch_type: "conan" + "2.2.1": + - patch_file: "patches/2.2.1-0001-fix-cmake-source-dir-and-targets.patch" + patch_description: "use cci package, use PROJECT_BINARY_DIR/PROJECT_SOURCE_DIR" + patch_type: "conan" + - patch_file: "patches/2.2.1-0002-fix-pystring.patch" + patch_description: "fix include path for pystring" + patch_type: "conan" + - patch_file: "patches/2.2.1-0003-strlen.patch" + patch_description: "add std namespace for strlen" + patch_type: "portability" "2.1.0": - - patch_file: "patches/fix-cmake-source-dir-and-targets.patch" - base_path: "source_subfolder" - - patch_file: "patches/pstring.patch" - base_path: "source_subfolder" - - patch_file: "patches/strlen.patch" - base_path: "source_subfolder" + - patch_file: "patches/2.1.0-0001-fix-cmake-source-dir-and-targets.patch" + patch_description: "use cci package, use PROJECT_BINARY_DIR/PROJECT_SOURCE_DIR" + patch_type: "conan" + - patch_file: "patches/2.1.0-0002-fix-pystring.patch" + patch_description: "fix include path for pystring" + patch_type: "conan" + - patch_file: "patches/2.1.0-0003-strlen.patch" + patch_description: "include string.h for strlen" + patch_type: "portability" + - patch_file: "patches/2.1.0-0004-fix-cpp-version-check.patch" + patch_description: "fix C++20 compilation error" + patch_type: "portability" + patch_source: "https://github.com/AcademySoftwareFoundation/OpenColorIO/pull/1542" "1.1.1": - - patch_file: "patches/1.1.1.patch" - base_path: "source_subfolder" + - patch_file: "patches/1.1.1-fix-cmake.patch" + patch_description: "use cci package, use PROJECT_BINARY_DIR/PROJECT_SOURCE_DIR" + patch_type: "conan" diff --git a/recipes/opencolorio/all/conanfile.py b/recipes/opencolorio/all/conanfile.py index 82c7ed3d43c8c..2823fcb13e038 100644 --- a/recipes/opencolorio/all/conanfile.py +++ b/recipes/opencolorio/all/conanfile.py @@ -1,10 +1,14 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration from conan.tools.microsoft import is_msvc -from conans import ConanFile, CMake, tools -import functools +from conan.tools.apple import is_apple_os, fix_apple_shared_install_name +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.45.0" - +required_conan_version = ">=1.53.0" class OpenColorIOConan(ConanFile): name = "opencolorio" @@ -13,8 +17,8 @@ class OpenColorIOConan(ConanFile): homepage = "https://opencolorio.org/" url = "https://github.com/conan-io/conan-center-index" topics = ("colors", "visual", "effects", "animation") - settings = "os", "arch", "compiler", "build_type" + package_type = "library" options = { "shared": [True, False], "fPIC": [True, False], @@ -26,20 +30,8 @@ class OpenColorIOConan(ConanFile): "use_sse": 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": @@ -49,96 +41,143 @@ 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("openexr/2.5.7") - self.requires("yaml-cpp/0.7.0") - if tools.Version(self.version) < "2.0.0": + self.requires("expat/[>=2.6.2 <3]") + if Version(self.version) < "2.2.0": + self.requires("openexr/2.5.7") + else: + self.requires("openexr/3.2.3") + self.requires("imath/3.1.9") + + if Version(self.version) < "2.0.0": self.requires("tinyxml/2.6.2") + self.requires("yaml-cpp/0.7.0") else: - self.requires("pystring/1.1.3") + self.requires("pystring/1.1.4") + self.requires("yaml-cpp/0.8.0") + + if Version(self.version) >= "2.3.0": + self.requires("minizip-ng/4.0.3") + elif Version(self.version) >= "2.2.0": + self.requires("minizip-ng/3.0.9") + # for tools only - self.requires("lcms/2.13.1") + self.requires("lcms/2.16") # TODO: add GLUT (needed for ociodisplay tool) def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) + check_min_cppstd(self, 11) + if Version(self.version) >= "2.3.0" and \ + self.settings.compiler == "gcc" and \ + Version(self.settings.compiler.version) < "6.0": + raise ConanInvalidConfiguration(f"{self.ref} requires gcc >= 6.0") + + if Version(self.version) < "2.0.0" and \ + self.settings.compiler.value == "msvc" and \ + Version(self.settings.compiler.version) >= "17.0": + raise ConanInvalidConfiguration(f"{self.ref} < 2.0 not building on MSVC 2022") + + if Version(self.version) >= "2.3.0" and \ + self.settings.compiler == "clang" and \ + self.settings.compiler.libcxx == "libc++": + raise ConanInvalidConfiguration(f"{self.ref} deosn't support clang with libc++") + + # opencolorio>=2.2.0 requires minizip-ng with with_zlib + if Version(self.version) >= "2.2.0" and \ + not self.dependencies["minizip-ng"].options.get_safe("with_zlib", False): + raise ConanInvalidConfiguration(f"{self.ref} requires minizip-ng with with_zlib = True. On Apple platforms with_libcomp = False is also needed to enable the with_zlib option.") + + if Version(self.version) == "1.1.1" and self.options.shared and self.dependencies["yaml-cpp"].options.shared: + raise ConanInvalidConfiguration(f"{self.ref} requires static build yaml-cpp") + + def build_requirements(self): + if Version(self.version) >= "2.2.0": + self.tool_requires("cmake/[>=3.16 <4]") 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - if tools.Version(self.version) >= "2.1.0": - cmake.definitions["OCIO_BUILD_PYTHON"] = False + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CMAKE_VERBOSE_MAKEFILE"] = True + if Version(self.version) >= "2.1.0": + tc.variables["OCIO_BUILD_PYTHON"] = False else: - cmake.definitions["OCIO_BUILD_SHARED"] = self.options.shared - cmake.definitions["OCIO_BUILD_STATIC"] = not self.options.shared - cmake.definitions["OCIO_BUILD_PYGLUE"] = False + tc.variables["OCIO_BUILD_SHARED"] = self.options.shared + tc.variables["OCIO_BUILD_STATIC"] = not self.options.shared + tc.variables["OCIO_BUILD_PYGLUE"] = False - cmake.definitions["USE_EXTERNAL_YAML"] = True - cmake.definitions["USE_EXTERNAL_TINYXML"] = True - cmake.definitions["USE_EXTERNAL_LCMS"] = True + tc.variables["USE_EXTERNAL_YAML"] = True + tc.variables["USE_EXTERNAL_TINYXML"] = True + tc.variables["TINYXML_OBJECT_LIB_EMBEDDED"] = False + tc.variables["USE_EXTERNAL_LCMS"] = True - cmake.definitions["OCIO_USE_SSE"] = self.options.get_safe("use_sse", False) + tc.variables["OCIO_USE_SSE"] = self.options.get_safe("use_sse", False) # openexr 2.x provides Half library - cmake.definitions["OCIO_USE_OPENEXR_HALF"] = True + tc.variables["OCIO_USE_OPENEXR_HALF"] = True - cmake.definitions["OCIO_BUILD_APPS"] = True - cmake.definitions["OCIO_BUILD_DOCS"] = False - cmake.definitions["OCIO_BUILD_TESTS"] = False - cmake.definitions["OCIO_BUILD_GPU_TESTS"] = False - cmake.definitions["OCIO_USE_BOOST_PTR"] = False + tc.variables["OCIO_BUILD_APPS"] = True + tc.variables["OCIO_BUILD_DOCS"] = False + tc.variables["OCIO_BUILD_TESTS"] = False + tc.variables["OCIO_BUILD_GPU_TESTS"] = False + tc.variables["OCIO_USE_BOOST_PTR"] = False # avoid downloading dependencies - cmake.definitions["OCIO_INSTALL_EXT_PACKAGE"] = "NONE" + tc.variables["OCIO_INSTALL_EXT_PACKAGE"] = "NONE" if is_msvc(self) and not self.options.shared: # define any value because ifndef is used - cmake.definitions["OpenColorIO_SKIP_IMPORTS"] = True + tc.variables["OpenColorIO_SKIP_IMPORTS"] = True - cmake.configure(build_folder=self._build_subfolder) - return cmake + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0091"] = "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) - for module in ("expat", "lcms2", "pystring", "yaml-cpp", "Imath"): - tools.remove_files_by_mask(os.path.join(self._source_subfolder, "share", "cmake", "modules"), "Find"+module+".cmake") + for module in ("expat", "lcms2", "pystring", "yaml-cpp", "Imath", "minizip-ng"): + rm(self, "Find"+module+".cmake", os.path.join(self.source_folder, "share", "cmake", "modules")) def build(self): self._patch_sources() - cm = self._configure_cmake() + cm = CMake(self) + cm.configure() cm.build() def package(self): - cm = self._configure_cmake() + cm = CMake(self) cm.install() if not self.options.shared: - self.copy("*", src=os.path.join(self.package_folder, - "lib", "static"), dst="lib") - tools.rmdir(os.path.join(self.package_folder, "lib", "static")) - - 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, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "share")) + copy(self, "*", + src=os.path.join(self.package_folder, "lib", "static"), + dst=os.path.join(self.package_folder, "lib")) + rmdir(self, os.path.join(self.package_folder, "lib", "static")) + + 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, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "share")) # nop for 2.x - tools.remove_files_by_mask(self.package_folder, "OpenColorIOConfig*.cmake") + rm(self, "OpenColorIOConfig*.cmake", self.package_folder) + + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), "*.pdb") + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") + if Version(self.version) == "1.1.1": + fix_apple_shared_install_name(self) def package_info(self): self.cpp_info.set_property("cmake_file_name", "OpenColorIO") @@ -147,21 +186,14 @@ def package_info(self): self.cpp_info.libs = ["OpenColorIO"] - if tools.Version(self.version) < "2.1.0": + if Version(self.version) < "2.1.0": if not self.options.shared: self.cpp_info.defines.append("OpenColorIO_STATIC") - if self.settings.os == "Macos": + if is_apple_os(self): self.cpp_info.frameworks.extend(["Foundation", "IOKit", "ColorSync", "CoreGraphics"]) + if Version(self.version) == "2.1.0": + self.cpp_info.frameworks.extend(["Carbon", "CoreFoundation"]) if is_msvc(self) and not self.options.shared: self.cpp_info.defines.append("OpenColorIO_SKIP_IMPORTS") - - 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_* & pkg_config generators removed - self.cpp_info.names["cmake_find_package"] = "OpenColorIO" - self.cpp_info.names["cmake_find_package_multi"] = "OpenColorIO" - self.cpp_info.names["pkg_config"] = "OpenColorIO" diff --git a/recipes/opencolorio/all/patches/1.1.1-fix-cmake.patch b/recipes/opencolorio/all/patches/1.1.1-fix-cmake.patch new file mode 100644 index 0000000000000..39c1981eda4b5 --- /dev/null +++ b/recipes/opencolorio/all/patches/1.1.1-fix-cmake.patch @@ -0,0 +1,287 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index e4f3119..9eb6d07 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,14 +1,16 @@ ++cmake_minimum_required(VERSION 2.8) + project(OpenColorIO) + set(OCIO_VERSION_MAJOR 1) + set(OCIO_VERSION_MINOR 1) + set(OCIO_VERSION_PATCH 1) + +-cmake_minimum_required(VERSION 2.8) +-set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/share/cmake) ++list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/share/cmake) + if(NOT DEFINED CMAKE_FIRST_RUN) + SET(CMAKE_FIRST_RUN 1 CACHE INTERNAL "") + endif() + ++set(CMAKE_CXX_STANDARD 11) ++ + ############################################################################### + ### GLOBAL ### + +@@ -142,11 +144,11 @@ endif(CMAKE_COMPILER_IS_GNUCXX) + ############################################################################### + ### Python ### + +-OCIOFindPython() ++#OCIOFindPython() + + # Find Python, used for (possibly) building pyglue, and now to + # construct the external project path +-set(EXTDIST_ROOT ${CMAKE_BINARY_DIR}/ext/dist) ++set(EXTDIST_ROOT ${PROJECT_BINARY_DIR}/ext/dist) + set(EXTDIST_BINPATH ${EXTDIST_ROOT}/bin) + if(PYTHON_OK) + set(EXTDIST_PYTHONPATH ${EXTDIST_ROOT}/${PYTHON_VARIANT_PATH}) +@@ -170,7 +172,12 @@ messageonce("Setting EXTDIST_PYTHONPATH: ${EXTDIST_PYTHONPATH}") + + if(USE_EXTERNAL_TINYXML) + set(TINYXML_VERSION_MIN "2.6.1") +- find_package(TinyXML) ++ find_package(TinyXML REQUIRED) ++ set(TINYXML_FOUND ${TinyXML_FOUND}) ++ set(TINYXML_LIBRARIES tinyxml::tinyxml) ++ set(TINYXML_VERSION "${TinyXML_VERSION}") ++ list(APPEND EXTERNAL_LIBRARIES ${TINYXML_LIBRARIES}) ++ + if(TINYXML_FOUND) + if(TINYXML_VERSION VERSION_EQUAL ${TINYXML_VERSION_MIN} OR + TINYXML_VERSION VERSION_GREATER ${TINYXML_VERSION_MIN}) +@@ -251,6 +258,13 @@ endif(USE_EXTERNAL_TINYXML) + if(USE_EXTERNAL_YAML) + # Set minimum yaml version for non-patched sources. + set(YAML_VERSION_MIN "0.3.0") ++ find_package(yaml-cpp REQUIRED) ++ set(YAML_CPP_INCLUDE_DIRS "${CONAN_INCLUDE_DIRS_YAML-CPP}") ++ set(YAML_CPP_LIBRARIES yaml-cpp) ++ set(YAML_CPP_VERSION "${yaml-cpp_VERSION}") ++ list(APPEND EXTERNAL_LIBRARIES ${YAML_CPP_LIBRARIES}) ++ ++ if(0) + include(FindPkgConfig) + pkg_check_modules(PC_YAML_CPP REQUIRED QUIET yaml-cpp) + find_path(YAML_CPP_INCLUDE_DIR yaml-cpp/yaml.h +@@ -293,6 +307,7 @@ if(USE_EXTERNAL_YAML) + else(YAML_CPP_FOUND) + message(FATAL_ERROR "ERROR: System yaml-cpp library was not found. Make sure the library is installed and the pkg-config file exists.") + endif(YAML_CPP_FOUND) ++ endif() + else(USE_EXTERNAL_YAML) ## provide 2 ways to build this dependency + set(YAML_CPP_VERSION 0.3.0) + set(YAML_CPP_CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${PROJECT_BINARY_DIR}/ext/dist -DYAML_CPP_BUILD_TOOLS:BOOL=FALSE -DOCIO_INLINES_HIDDEN:BOOL=${OCIO_INLINES_HIDDEN}) +@@ -384,7 +399,7 @@ else() + set(OCIO_INLINES_HIDDEN OFF) + endif() + +-set(EXTERNAL_COMPILE_FLAGS "-DTIXML_USE_STL ${YAML_CPP_COMPILE_FLAGS} ${GCC_COMPILE_FLAGS}") ++set(EXTERNAL_COMPILE_FLAGS "${YAML_CPP_COMPILE_FLAGS} ${GCC_COMPILE_FLAGS}") + + set(EXTERNAL_LINK_FLAGS "") + set(EXTERNAL_LIBRARY_DIRS ${PROJECT_BINARY_DIR}/ext/dist/lib) +@@ -460,7 +475,7 @@ endif() + if(OCIO_BUILD_APPS AND (OCIO_BUILD_STATIC OR OCIO_BUILD_SHARED) ) + + # Try to find OpenImageIO (OIIO) and OpenGL stuff +- OCIOFindOpenImageIO() ++ #OCIOFindOpenImageIO() + + if(OIIO_FOUND) + add_subdirectory(src/apps/ocioconvert) +@@ -528,7 +543,7 @@ endif() + + ############################################################################### + ### Configure env script ### +-configure_file(${CMAKE_SOURCE_DIR}/share/ocio/setup_ocio.sh.in ++configure_file(${PROJECT_SOURCE_DIR}/share/ocio/setup_ocio.sh.in + ${CMAKE_CURRENT_BINARY_DIR}/share/ocio/setup_ocio.sh @ONLY) + + INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/share/ocio/setup_ocio.sh DESTINATION share/ocio/) +@@ -597,7 +612,7 @@ if(TARGET OpenColorIO_STATIC) + endif() + endif() + install(EXPORT OpenColorIO DESTINATION cmake) +-file(WRITE "${CMAKE_BINARY_DIR}/OpenColorIOConfig.cmake" ++file(WRITE "${PROJECT_BINARY_DIR}/OpenColorIOConfig.cmake" + " + get_filename_component(OpenColorIO_DIR \"\${CMAKE_CURRENT_LIST_FILE}\" PATH) + +@@ -646,4 +661,4 @@ file(WRITE "${CMAKE_BINARY_DIR}/OpenColorIOConfig.cmake" + message(STATUS OPENCOLORIO_FOUND=\${OPENCOLORIO_FOUND}) + " + ) +-install(FILES "${CMAKE_BINARY_DIR}/OpenColorIOConfig.cmake" DESTINATION .) ++install(FILES "${PROJECT_BINARY_DIR}/OpenColorIOConfig.cmake" DESTINATION .) +diff --git a/share/cmake/OCIOMacros.cmake b/share/cmake/OCIOMacros.cmake +index b9fb239..b1a206e 100644 +--- a/share/cmake/OCIOMacros.cmake ++++ b/share/cmake/OCIOMacros.cmake +@@ -356,9 +356,9 @@ ENDMACRO() + + MACRO(ExtractRstCPP INFILE OUTFILE) + add_custom_command( +- WORKING_DIRECTORY ${CMAKE_BINARY_DIR} ++ WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + OUTPUT ${OUTFILE} +- COMMAND ${PYTHON} ${CMAKE_SOURCE_DIR}/share/sphinx/ExtractRstFromSourceCPP.py ${INFILE} ${OUTFILE} ++ COMMAND ${PYTHON} ${PROJECT_SOURCE_DIR}/share/sphinx/ExtractRstFromSourceCPP.py ${INFILE} ${OUTFILE} + DEPENDS ${INFILE} + COMMENT "Extracting reStructuredText from ${INFILE} (using old process)" + ) +@@ -366,9 +366,9 @@ ENDMACRO() + + MACRO(ExtractRstSimple INFILE OUTFILE) + add_custom_command( +- WORKING_DIRECTORY ${CMAKE_BINARY_DIR} ++ WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + OUTPUT ${OUTFILE} +- COMMAND ${PYTHON} ${CMAKE_SOURCE_DIR}/share/sphinx/ExtractRstFromSourceSimple.py ${INFILE} ${OUTFILE} ++ COMMAND ${PYTHON} ${PROJECT_SOURCE_DIR}/share/sphinx/ExtractRstFromSourceSimple.py ${INFILE} ${OUTFILE} + DEPENDS ${INFILE} + COMMENT "Extracting reStructuredText from ${INFILE}" + ) +diff --git a/src/apps/ociobakelut/CMakeLists.txt b/src/apps/ociobakelut/CMakeLists.txt +index d31b4e3..4aa1efb 100644 +--- a/src/apps/ociobakelut/CMakeLists.txt ++++ b/src/apps/ociobakelut/CMakeLists.txt +@@ -1,6 +1,10 @@ + # LCMS +-include(FindPkgConfig FindPackageMessage) +-pkg_check_modules(LCMS QUIET lcms2) ++find_package(lcms REQUIRED) ++set(LCMS_FOUND ${lcms_FOUND}) ++set(LCMS_VERSION ${lcms_VERSION}) ++set(LCMS_LIBRARIES ${lcms_LIBRARIES}) ++set(LCMS_INCLUDE_DIR ${lcms_INCLUDE_DIR}) ++ + if(LCMS_FOUND AND (LCMS_VERSION VERSION_EQUAL 2.1 OR LCMS_VERSION VERSION_GREATER 2.1)) + FIND_PACKAGE_MESSAGE(LCMS "Found lcms: ${LCMS_LIBRARIES}" + "${LCMS_INCLUDE_DIR}") +@@ -29,12 +33,12 @@ else() + set(LCMS_LIBRARIES ${PROJECT_BINARY_DIR}/ext/dist/lib/${CMAKE_STATIC_LIBRARY_PREFIX}lcms2${CMAKE_STATIC_LIBRARY_SUFFIX}) + endif() + +-file(GLOB_RECURSE share_src_files "${CMAKE_SOURCE_DIR}/src/apps/share/*.cpp") ++file(GLOB_RECURSE share_src_files "${PROJECT_SOURCE_DIR}/src/apps/share/*.cpp") + + include_directories( +- ${CMAKE_SOURCE_DIR}/export/ +- ${CMAKE_BINARY_DIR}/export/ +- ${CMAKE_SOURCE_DIR}/src/apps/share/ ++ ${PROJECT_SOURCE_DIR}/export/ ++ ${PROJECT_BINARY_DIR}/export/ ++ ${PROJECT_SOURCE_DIR}/src/apps/share/ + ${LCMS_INCLUDE_DIRS} + ${Boost_INCLUDE_DIR} + ) +diff --git a/src/apps/ociocheck/CMakeLists.txt b/src/apps/ociocheck/CMakeLists.txt +index 4955f4d..14b5017 100644 +--- a/src/apps/ociocheck/CMakeLists.txt ++++ b/src/apps/ociocheck/CMakeLists.txt +@@ -1,9 +1,9 @@ +-file(GLOB_RECURSE share_src_files "${CMAKE_SOURCE_DIR}/src/apps/share/*.cpp") ++file(GLOB_RECURSE share_src_files "${PROJECT_SOURCE_DIR}/src/apps/share/*.cpp") + + include_directories( +- ${CMAKE_SOURCE_DIR}/export/ +- ${CMAKE_BINARY_DIR}/export/ +- ${CMAKE_SOURCE_DIR}/src/apps/share/ ++ ${PROJECT_SOURCE_DIR}/export/ ++ ${PROJECT_BINARY_DIR}/export/ ++ ${PROJECT_SOURCE_DIR}/src/apps/share/ + ${Boost_INCLUDE_DIR} + ) + +diff --git a/src/core/CDLTransform.cpp b/src/core/CDLTransform.cpp +index 8b05deb..a7d6031 100644 +--- a/src/core/CDLTransform.cpp ++++ b/src/core/CDLTransform.cpp +@@ -126,7 +126,11 @@ OCIO_NAMESPACE_ENTER + TiXmlPrinter printer; + printer.SetStreamPrinting(); + doc.Accept( &printer ); +- return printer.Str(); ++ #ifdef TIXML_USE_STL ++ return printer.Str(); ++ #else ++ return printer.CStr(); ++ #endif + } + } + +diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt +index 1eb691b..a2f099a 100644 +--- a/src/core/CMakeLists.txt ++++ b/src/core/CMakeLists.txt +@@ -2,29 +2,29 @@ + ### OCIO CORE ### + + include_directories( +- ${CMAKE_SOURCE_DIR}/export/ +- ${CMAKE_BINARY_DIR}/export/ +- ${CMAKE_SOURCE_DIR}/ext/oiio/src/include ++ ${PROJECT_SOURCE_DIR}/export/ ++ ${PROJECT_BINARY_DIR}/export/ ++ ${PROJECT_SOURCE_DIR}/ext/oiio/src/include + ${EXTERNAL_INCLUDE_DIRS} + ) + +-file(GLOB_RECURSE core_src_files "${CMAKE_SOURCE_DIR}/src/core/*.cpp") +-file(GLOB_RECURSE core_export_headers "${CMAKE_SOURCE_DIR}/export/OpenColorIO/*.h") ++file(GLOB_RECURSE core_src_files "${PROJECT_SOURCE_DIR}/src/core/*.cpp") ++file(GLOB_RECURSE core_export_headers "${PROJECT_SOURCE_DIR}/export/OpenColorIO/*.h") + + message(STATUS "Create OpenColorABI.h from OpenColorABI.h.in") +-configure_file(${CMAKE_SOURCE_DIR}/export/OpenColorIO/OpenColorABI.h.in +- ${CMAKE_BINARY_DIR}/export/OpenColorABI.h @ONLY) +-list(APPEND core_export_headers ${CMAKE_BINARY_DIR}/export/OpenColorABI.h) ++configure_file(${PROJECT_SOURCE_DIR}/export/OpenColorIO/OpenColorABI.h.in ++ ${PROJECT_BINARY_DIR}/export/OpenColorABI.h @ONLY) ++list(APPEND core_export_headers ${PROJECT_BINARY_DIR}/export/OpenColorABI.h) + + # Process all warnings as errors + + if(WIN32) + # On debug mode there are other kinds of warning... + if("${CMAKE_BUILD_TYPE}" STREQUAL "Release") +- set(EXTERNAL_COMPILE_FLAGS "${EXTERNAL_COMPILE_FLAGS} /WX") ++ # set(EXTERNAL_COMPILE_FLAGS "${EXTERNAL_COMPILE_FLAGS} /WX") + endif() + else() +- set(EXTERNAL_COMPILE_FLAGS "${EXTERNAL_COMPILE_FLAGS} -Werror") ++ # set(EXTERNAL_COMPILE_FLAGS "${EXTERNAL_COMPILE_FLAGS} -Werror") + endif() + + # SHARED +@@ -75,7 +75,7 @@ endif() + # STATIC + + if(OCIO_BUILD_STATIC) +- list(REMOVE_ITEM core_src_files ${CMAKE_SOURCE_DIR}/src/core/UnitTest.cpp) ++ list(REMOVE_ITEM core_src_files ${PROJECT_SOURCE_DIR}/src/core/UnitTest.cpp) + add_library(OpenColorIO_STATIC STATIC ${EXTERNAL_OBJECTS} ${core_src_files}) + add_dependencies(OpenColorIO_STATIC TINYXML_LIB YAML_CPP_LIB) + if(EXTERNAL_LIBRARIES) +@@ -113,7 +113,7 @@ install(FILES ${core_export_headers} + + # pkg-config + message(STATUS "Create OpenColorIO.pc from OpenColorIO.pc.in") +-configure_file(${CMAKE_SOURCE_DIR}/export/pkgconfig/OpenColorIO.pc.in ++configure_file(${PROJECT_SOURCE_DIR}/export/pkgconfig/OpenColorIO.pc.in + ${CMAKE_CURRENT_BINARY_DIR}/OpenColorIO.pc @ONLY) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/OpenColorIO.pc + DESTINATION ${CMAKE_INSTALL_EXEC_PREFIX}/lib${LIB_SUFFIX}/pkgconfig/) +diff --git a/src/core/OCIOYaml.cpp b/src/core/OCIOYaml.cpp +index 68fcef6..a1c1c1d 100644 +--- a/src/core/OCIOYaml.cpp ++++ b/src/core/OCIOYaml.cpp +@@ -1442,7 +1442,7 @@ OCIO_NAMESPACE_ENTER + #ifdef OLDYAML + if(node.FindValue("ocio_profile_version") == NULL) + #else +- if(node["ocio_profile_version"] == NULL) ++ if(node["ocio_profile_version"].IsNull()) + #endif + { + std::ostringstream os; diff --git a/recipes/opencolorio/all/patches/1.1.1.patch b/recipes/opencolorio/all/patches/1.1.1.patch deleted file mode 100644 index 579e529242a44..0000000000000 --- a/recipes/opencolorio/all/patches/1.1.1.patch +++ /dev/null @@ -1,283 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index e4f31196..b73396b4 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -4,11 +4,13 @@ set(OCIO_VERSION_MINOR 1) - set(OCIO_VERSION_PATCH 1) - - cmake_minimum_required(VERSION 2.8) --set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/share/cmake) -+list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/share/cmake) - if(NOT DEFINED CMAKE_FIRST_RUN) - SET(CMAKE_FIRST_RUN 1 CACHE INTERNAL "") - endif() - -+set(CMAKE_CXX_STANDARD 11) -+ - ############################################################################### - ### GLOBAL ### - -@@ -142,11 +144,11 @@ endif(CMAKE_COMPILER_IS_GNUCXX) - ############################################################################### - ### Python ### - --OCIOFindPython() -+#OCIOFindPython() - - # Find Python, used for (possibly) building pyglue, and now to - # construct the external project path --set(EXTDIST_ROOT ${CMAKE_BINARY_DIR}/ext/dist) -+set(EXTDIST_ROOT ${PROJECT_BINARY_DIR}/ext/dist) - set(EXTDIST_BINPATH ${EXTDIST_ROOT}/bin) - if(PYTHON_OK) - set(EXTDIST_PYTHONPATH ${EXTDIST_ROOT}/${PYTHON_VARIANT_PATH}) -@@ -170,7 +172,12 @@ messageonce("Setting EXTDIST_PYTHONPATH: ${EXTDIST_PYTHONPATH}") - - if(USE_EXTERNAL_TINYXML) - set(TINYXML_VERSION_MIN "2.6.1") -- find_package(TinyXML) -+ find_package(TinyXML REQUIRED) -+ set(TINYXML_FOUND ${TinyXML_FOUND}) -+ set(TINYXML_LIBRARIES TinyXML::TinyXML) -+ set(TINYXML_VERSION "${TinyXML_VERSION}") -+ list(APPEND EXTERNAL_LIBRARIES ${TINYXML_LIBRARIES}) -+ - if(TINYXML_FOUND) - if(TINYXML_VERSION VERSION_EQUAL ${TINYXML_VERSION_MIN} OR - TINYXML_VERSION VERSION_GREATER ${TINYXML_VERSION_MIN}) -@@ -251,6 +258,13 @@ endif(USE_EXTERNAL_TINYXML) - if(USE_EXTERNAL_YAML) - # Set minimum yaml version for non-patched sources. - set(YAML_VERSION_MIN "0.3.0") -+ find_package(yaml-cpp REQUIRED) -+ set(YAML_CPP_INCLUDE_DIRS "${CONAN_INCLUDE_DIRS_YAML-CPP}") -+ set(YAML_CPP_LIBRARIES yaml-cpp::yaml-cpp) -+ set(YAML_CPP_VERSION "${yaml-cpp_VERSION}") -+ list(APPEND EXTERNAL_LIBRARIES ${YAML_CPP_LIBRARIES}) -+ -+ if(0) - include(FindPkgConfig) - pkg_check_modules(PC_YAML_CPP REQUIRED QUIET yaml-cpp) - find_path(YAML_CPP_INCLUDE_DIR yaml-cpp/yaml.h -@@ -293,6 +307,7 @@ if(USE_EXTERNAL_YAML) - else(YAML_CPP_FOUND) - message(FATAL_ERROR "ERROR: System yaml-cpp library was not found. Make sure the library is installed and the pkg-config file exists.") - endif(YAML_CPP_FOUND) -+ endif() - else(USE_EXTERNAL_YAML) ## provide 2 ways to build this dependency - set(YAML_CPP_VERSION 0.3.0) - set(YAML_CPP_CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${PROJECT_BINARY_DIR}/ext/dist -DYAML_CPP_BUILD_TOOLS:BOOL=FALSE -DOCIO_INLINES_HIDDEN:BOOL=${OCIO_INLINES_HIDDEN}) -@@ -384,7 +399,7 @@ else() - set(OCIO_INLINES_HIDDEN OFF) - endif() - --set(EXTERNAL_COMPILE_FLAGS "-DTIXML_USE_STL ${YAML_CPP_COMPILE_FLAGS} ${GCC_COMPILE_FLAGS}") -+set(EXTERNAL_COMPILE_FLAGS "${YAML_CPP_COMPILE_FLAGS} ${GCC_COMPILE_FLAGS}") - - set(EXTERNAL_LINK_FLAGS "") - set(EXTERNAL_LIBRARY_DIRS ${PROJECT_BINARY_DIR}/ext/dist/lib) -@@ -460,7 +475,7 @@ endif() - if(OCIO_BUILD_APPS AND (OCIO_BUILD_STATIC OR OCIO_BUILD_SHARED) ) - - # Try to find OpenImageIO (OIIO) and OpenGL stuff -- OCIOFindOpenImageIO() -+ #OCIOFindOpenImageIO() - - if(OIIO_FOUND) - add_subdirectory(src/apps/ocioconvert) -@@ -528,7 +543,7 @@ endif() - - ############################################################################### - ### Configure env script ### --configure_file(${CMAKE_SOURCE_DIR}/share/ocio/setup_ocio.sh.in -+configure_file(${PROJECT_SOURCE_DIR}/share/ocio/setup_ocio.sh.in - ${CMAKE_CURRENT_BINARY_DIR}/share/ocio/setup_ocio.sh @ONLY) - - INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/share/ocio/setup_ocio.sh DESTINATION share/ocio/) -@@ -597,7 +612,7 @@ if(TARGET OpenColorIO_STATIC) - endif() - endif() - install(EXPORT OpenColorIO DESTINATION cmake) --file(WRITE "${CMAKE_BINARY_DIR}/OpenColorIOConfig.cmake" -+file(WRITE "${PROJECT_BINARY_DIR}/OpenColorIOConfig.cmake" - " - get_filename_component(OpenColorIO_DIR \"\${CMAKE_CURRENT_LIST_FILE}\" PATH) - -@@ -646,4 +661,4 @@ file(WRITE "${CMAKE_BINARY_DIR}/OpenColorIOConfig.cmake" - message(STATUS OPENCOLORIO_FOUND=\${OPENCOLORIO_FOUND}) - " - ) --install(FILES "${CMAKE_BINARY_DIR}/OpenColorIOConfig.cmake" DESTINATION .) -+install(FILES "${PROJECT_BINARY_DIR}/OpenColorIOConfig.cmake" DESTINATION .) -diff --git a/share/cmake/OCIOMacros.cmake b/share/cmake/OCIOMacros.cmake -index b9fb2393..b1a206e7 100644 ---- a/share/cmake/OCIOMacros.cmake -+++ b/share/cmake/OCIOMacros.cmake -@@ -356,9 +356,9 @@ ENDMACRO() - - MACRO(ExtractRstCPP INFILE OUTFILE) - add_custom_command( -- WORKING_DIRECTORY ${CMAKE_BINARY_DIR} -+ WORKING_DIRECTORY ${PROJECT_BINARY_DIR} - OUTPUT ${OUTFILE} -- COMMAND ${PYTHON} ${CMAKE_SOURCE_DIR}/share/sphinx/ExtractRstFromSourceCPP.py ${INFILE} ${OUTFILE} -+ COMMAND ${PYTHON} ${PROJECT_SOURCE_DIR}/share/sphinx/ExtractRstFromSourceCPP.py ${INFILE} ${OUTFILE} - DEPENDS ${INFILE} - COMMENT "Extracting reStructuredText from ${INFILE} (using old process)" - ) -@@ -366,9 +366,9 @@ ENDMACRO() - - MACRO(ExtractRstSimple INFILE OUTFILE) - add_custom_command( -- WORKING_DIRECTORY ${CMAKE_BINARY_DIR} -+ WORKING_DIRECTORY ${PROJECT_BINARY_DIR} - OUTPUT ${OUTFILE} -- COMMAND ${PYTHON} ${CMAKE_SOURCE_DIR}/share/sphinx/ExtractRstFromSourceSimple.py ${INFILE} ${OUTFILE} -+ COMMAND ${PYTHON} ${PROJECT_SOURCE_DIR}/share/sphinx/ExtractRstFromSourceSimple.py ${INFILE} ${OUTFILE} - DEPENDS ${INFILE} - COMMENT "Extracting reStructuredText from ${INFILE}" - ) -diff --git a/src/apps/ociobakelut/CMakeLists.txt b/src/apps/ociobakelut/CMakeLists.txt -index d31b4e34..4aa1efb2 100644 ---- a/src/apps/ociobakelut/CMakeLists.txt -+++ b/src/apps/ociobakelut/CMakeLists.txt -@@ -1,6 +1,10 @@ - # LCMS --include(FindPkgConfig FindPackageMessage) --pkg_check_modules(LCMS QUIET lcms2) -+find_package(lcms REQUIRED) -+set(LCMS_FOUND ${lcms_FOUND}) -+set(LCMS_VERSION ${lcms_VERSION}) -+set(LCMS_LIBRARIES ${lcms_LIBRARIES}) -+set(LCMS_INCLUDE_DIR ${lcms_INCLUDE_DIR}) -+ - if(LCMS_FOUND AND (LCMS_VERSION VERSION_EQUAL 2.1 OR LCMS_VERSION VERSION_GREATER 2.1)) - FIND_PACKAGE_MESSAGE(LCMS "Found lcms: ${LCMS_LIBRARIES}" - "${LCMS_INCLUDE_DIR}") -@@ -29,12 +33,12 @@ else() - set(LCMS_LIBRARIES ${PROJECT_BINARY_DIR}/ext/dist/lib/${CMAKE_STATIC_LIBRARY_PREFIX}lcms2${CMAKE_STATIC_LIBRARY_SUFFIX}) - endif() - --file(GLOB_RECURSE share_src_files "${CMAKE_SOURCE_DIR}/src/apps/share/*.cpp") -+file(GLOB_RECURSE share_src_files "${PROJECT_SOURCE_DIR}/src/apps/share/*.cpp") - - include_directories( -- ${CMAKE_SOURCE_DIR}/export/ -- ${CMAKE_BINARY_DIR}/export/ -- ${CMAKE_SOURCE_DIR}/src/apps/share/ -+ ${PROJECT_SOURCE_DIR}/export/ -+ ${PROJECT_BINARY_DIR}/export/ -+ ${PROJECT_SOURCE_DIR}/src/apps/share/ - ${LCMS_INCLUDE_DIRS} - ${Boost_INCLUDE_DIR} - ) -diff --git a/src/apps/ociocheck/CMakeLists.txt b/src/apps/ociocheck/CMakeLists.txt -index 4955f4db..14b5017f 100644 ---- a/src/apps/ociocheck/CMakeLists.txt -+++ b/src/apps/ociocheck/CMakeLists.txt -@@ -1,9 +1,9 @@ --file(GLOB_RECURSE share_src_files "${CMAKE_SOURCE_DIR}/src/apps/share/*.cpp") -+file(GLOB_RECURSE share_src_files "${PROJECT_SOURCE_DIR}/src/apps/share/*.cpp") - - include_directories( -- ${CMAKE_SOURCE_DIR}/export/ -- ${CMAKE_BINARY_DIR}/export/ -- ${CMAKE_SOURCE_DIR}/src/apps/share/ -+ ${PROJECT_SOURCE_DIR}/export/ -+ ${PROJECT_BINARY_DIR}/export/ -+ ${PROJECT_SOURCE_DIR}/src/apps/share/ - ${Boost_INCLUDE_DIR} - ) - -diff --git a/src/core/CDLTransform.cpp b/src/core/CDLTransform.cpp -index 8b05debc..a7d6031f 100644 ---- a/src/core/CDLTransform.cpp -+++ b/src/core/CDLTransform.cpp -@@ -126,7 +126,11 @@ OCIO_NAMESPACE_ENTER - TiXmlPrinter printer; - printer.SetStreamPrinting(); - doc.Accept( &printer ); -- return printer.Str(); -+ #ifdef TIXML_USE_STL -+ return printer.Str(); -+ #else -+ return printer.CStr(); -+ #endif - } - } - -diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt -index 1eb691b6..a2f099ab 100644 ---- a/src/core/CMakeLists.txt -+++ b/src/core/CMakeLists.txt -@@ -2,29 +2,29 @@ - ### OCIO CORE ### - - include_directories( -- ${CMAKE_SOURCE_DIR}/export/ -- ${CMAKE_BINARY_DIR}/export/ -- ${CMAKE_SOURCE_DIR}/ext/oiio/src/include -+ ${PROJECT_SOURCE_DIR}/export/ -+ ${PROJECT_BINARY_DIR}/export/ -+ ${PROJECT_SOURCE_DIR}/ext/oiio/src/include - ${EXTERNAL_INCLUDE_DIRS} - ) - --file(GLOB_RECURSE core_src_files "${CMAKE_SOURCE_DIR}/src/core/*.cpp") --file(GLOB_RECURSE core_export_headers "${CMAKE_SOURCE_DIR}/export/OpenColorIO/*.h") -+file(GLOB_RECURSE core_src_files "${PROJECT_SOURCE_DIR}/src/core/*.cpp") -+file(GLOB_RECURSE core_export_headers "${PROJECT_SOURCE_DIR}/export/OpenColorIO/*.h") - - message(STATUS "Create OpenColorABI.h from OpenColorABI.h.in") --configure_file(${CMAKE_SOURCE_DIR}/export/OpenColorIO/OpenColorABI.h.in -- ${CMAKE_BINARY_DIR}/export/OpenColorABI.h @ONLY) --list(APPEND core_export_headers ${CMAKE_BINARY_DIR}/export/OpenColorABI.h) -+configure_file(${PROJECT_SOURCE_DIR}/export/OpenColorIO/OpenColorABI.h.in -+ ${PROJECT_BINARY_DIR}/export/OpenColorABI.h @ONLY) -+list(APPEND core_export_headers ${PROJECT_BINARY_DIR}/export/OpenColorABI.h) - - # Process all warnings as errors - - if(WIN32) - # On debug mode there are other kinds of warning... - if("${CMAKE_BUILD_TYPE}" STREQUAL "Release") -- set(EXTERNAL_COMPILE_FLAGS "${EXTERNAL_COMPILE_FLAGS} /WX") -+ # set(EXTERNAL_COMPILE_FLAGS "${EXTERNAL_COMPILE_FLAGS} /WX") - endif() - else() -- set(EXTERNAL_COMPILE_FLAGS "${EXTERNAL_COMPILE_FLAGS} -Werror") -+ # set(EXTERNAL_COMPILE_FLAGS "${EXTERNAL_COMPILE_FLAGS} -Werror") - endif() - - # SHARED -@@ -75,7 +75,7 @@ endif() - # STATIC - - if(OCIO_BUILD_STATIC) -- list(REMOVE_ITEM core_src_files ${CMAKE_SOURCE_DIR}/src/core/UnitTest.cpp) -+ list(REMOVE_ITEM core_src_files ${PROJECT_SOURCE_DIR}/src/core/UnitTest.cpp) - add_library(OpenColorIO_STATIC STATIC ${EXTERNAL_OBJECTS} ${core_src_files}) - add_dependencies(OpenColorIO_STATIC TINYXML_LIB YAML_CPP_LIB) - if(EXTERNAL_LIBRARIES) -@@ -113,7 +113,7 @@ install(FILES ${core_export_headers} - - # pkg-config - message(STATUS "Create OpenColorIO.pc from OpenColorIO.pc.in") --configure_file(${CMAKE_SOURCE_DIR}/export/pkgconfig/OpenColorIO.pc.in -+configure_file(${PROJECT_SOURCE_DIR}/export/pkgconfig/OpenColorIO.pc.in - ${CMAKE_CURRENT_BINARY_DIR}/OpenColorIO.pc @ONLY) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/OpenColorIO.pc - DESTINATION ${CMAKE_INSTALL_EXEC_PREFIX}/lib${LIB_SUFFIX}/pkgconfig/) -diff --git a/src/core/OCIOYaml.cpp b/src/core/OCIOYaml.cpp -index 68fcef60..a1c1c1d8 100644 ---- a/src/core/OCIOYaml.cpp -+++ b/src/core/OCIOYaml.cpp -@@ -1442,7 +1442,7 @@ OCIO_NAMESPACE_ENTER - #ifdef OLDYAML - if(node.FindValue("ocio_profile_version") == NULL) - #else -- if(node["ocio_profile_version"] == NULL) -+ if(node["ocio_profile_version"].IsNull()) - #endif - { - std::ostringstream os; diff --git a/recipes/opencolorio/all/patches/2.1.0-0001-fix-cmake-source-dir-and-targets.patch b/recipes/opencolorio/all/patches/2.1.0-0001-fix-cmake-source-dir-and-targets.patch new file mode 100644 index 0000000000000..5de7b145077d6 --- /dev/null +++ b/recipes/opencolorio/all/patches/2.1.0-0001-fix-cmake-source-dir-and-targets.patch @@ -0,0 +1,61 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index b0840ac..e4875ab 100755 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -9,9 +9,9 @@ cmake_minimum_required(VERSION 3.12) + + set(CMAKE_MODULE_PATH + ${CMAKE_MODULE_PATH} +- ${CMAKE_SOURCE_DIR}/share/cmake/utils +- ${CMAKE_SOURCE_DIR}/share/cmake/macros +- ${CMAKE_SOURCE_DIR}/share/cmake/modules ++ ${CMAKE_CURRENT_SOURCE_DIR}/share/cmake/utils ++ ${CMAKE_CURRENT_SOURCE_DIR}/share/cmake/macros ++ ${CMAKE_CURRENT_SOURCE_DIR}/share/cmake/modules + ) + + set(CMAKE_WARN_DEPRECATED ON) +@@ -272,7 +272,7 @@ else() + set(OCIO_SETUP_NAME setup_ocio.sh) + endif() + +-configure_file(${CMAKE_SOURCE_DIR}/share/ocio/${OCIO_SETUP_NAME}.in ++configure_file(${PROJECT_SOURCE_DIR}/share/ocio/${OCIO_SETUP_NAME}.in + ${CMAKE_CURRENT_BINARY_DIR}/share/ocio/${OCIO_SETUP_NAME} @ONLY) + + INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/share/ocio/${OCIO_SETUP_NAME} DESTINATION share/ocio/) +diff --git a/share/cmake/modules/FindExtPackages.cmake b/share/cmake/modules/FindExtPackages.cmake +index 86a0225..73d8599 100644 +--- a/share/cmake/modules/FindExtPackages.cmake ++++ b/share/cmake/modules/FindExtPackages.cmake +@@ -50,7 +50,7 @@ else() + + # OpenEXR/IlmBase (<=2.5) + # https://github.com/AcademySoftwareFoundation/openexr +- find_package(Half 2.4.0 REQUIRED) ++ find_package(OpenEXR 2.4.0 REQUIRED) + + set(OCIO_HALF_LIB IlmBase::Half CACHE STRING "Half library target" FORCE) + set(OCIO_USE_IMATH_HALF "0" CACHE STRING "Whether 'half' type will be sourced from the Imath library (>=v3.0)" FORCE) +@@ -65,7 +65,7 @@ if(OCIO_BUILD_APPS) + + # lcms2 + # https://github.com/mm2/Little-CMS +- find_package(lcms2 2.2 REQUIRED) ++ find_package(lcms 2.2 REQUIRED) + endif() + + if(OCIO_BUILD_OPENFX) +diff --git a/src/apps/ociobakelut/CMakeLists.txt b/src/apps/ociobakelut/CMakeLists.txt +index 7eb1cd8..de13607 100755 +--- a/src/apps/ociobakelut/CMakeLists.txt ++++ b/src/apps/ociobakelut/CMakeLists.txt +@@ -35,7 +35,7 @@ set_target_properties(ociobakelut + target_link_libraries(ociobakelut + PRIVATE + apputils +- lcms2::lcms2 ++ lcms::lcms + OpenColorIO + ) + diff --git a/recipes/opencolorio/all/patches/pstring.patch b/recipes/opencolorio/all/patches/2.1.0-0002-fix-pystring.patch similarity index 100% rename from recipes/opencolorio/all/patches/pstring.patch rename to recipes/opencolorio/all/patches/2.1.0-0002-fix-pystring.patch diff --git a/recipes/opencolorio/all/patches/strlen.patch b/recipes/opencolorio/all/patches/2.1.0-0003-strlen.patch similarity index 100% rename from recipes/opencolorio/all/patches/strlen.patch rename to recipes/opencolorio/all/patches/2.1.0-0003-strlen.patch diff --git a/recipes/opencolorio/all/patches/2.1.0-0004-fix-cpp-version-check.patch b/recipes/opencolorio/all/patches/2.1.0-0004-fix-cpp-version-check.patch new file mode 100644 index 0000000000000..50d9ce38deeed --- /dev/null +++ b/recipes/opencolorio/all/patches/2.1.0-0004-fix-cpp-version-check.patch @@ -0,0 +1,18 @@ +diff --git a/share/cmake/utils/CppVersion.cmake b/share/cmake/utils/CppVersion.cmake +index aeca6c0..6b4dc4e 100644 +--- a/share/cmake/utils/CppVersion.cmake ++++ b/share/cmake/utils/CppVersion.cmake +@@ -12,11 +12,11 @@ if(NOT DEFINED CMAKE_CXX_STANDARD) + message(STATUS "Setting C++ version to '11' as none was specified.") + set(CMAKE_CXX_STANDARD 11 CACHE STRING "C++ standard to compile against") + elseif(NOT CMAKE_CXX_STANDARD IN_LIST SUPPORTED_CXX_STANDARDS) +- message(FATAL_ERROR ++ message(WARNING + "CMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} is unsupported. Supported standards are: ${SUPPORTED_CXX_STANDARDS_STR}.") + endif() + +-set_property(CACHE CMAKE_CXX_STANDARD PROPERTY STRINGS "${SUPPORTED_CXX_STANDARDS}") ++#set_property(CACHE CMAKE_CXX_STANDARD PROPERTY STRINGS "${SUPPORTED_CXX_STANDARDS}") + + include(CheckCXXCompilerFlag) + diff --git a/recipes/opencolorio/all/patches/2.2.1-0001-fix-cmake-source-dir-and-targets.patch b/recipes/opencolorio/all/patches/2.2.1-0001-fix-cmake-source-dir-and-targets.patch new file mode 100644 index 0000000000000..115857775079d --- /dev/null +++ b/recipes/opencolorio/all/patches/2.2.1-0001-fix-cmake-source-dir-and-targets.patch @@ -0,0 +1,105 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 17e188d..91af0ec 100755 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -332,7 +332,7 @@ install( + FILE ${OCIO_TARGETS_EXPORT_NAME} + ) + +-if (NOT BUILD_SHARED_LIBS) ++if (0) + # Install custom macros used in the find modules. + install(FILES + ${CMAKE_CURRENT_LIST_DIR}/share/cmake/macros/VersionUtils.cmake +diff --git a/share/cmake/modules/FindExtPackages.cmake b/share/cmake/modules/FindExtPackages.cmake +index 5455a08..420fbd4 100644 +--- a/share/cmake/modules/FindExtPackages.cmake ++++ b/share/cmake/modules/FindExtPackages.cmake +@@ -41,7 +41,7 @@ find_package(expat 2.4.1 REQUIRED) + + # yaml-cpp + # https://github.com/jbeder/yaml-cpp +-find_package(yaml-cpp 0.7.0 REQUIRED) ++find_package(yaml-cpp REQUIRED) + + # pystring + # https://github.com/imageworks/pystring +@@ -138,7 +138,7 @@ endif() + + # minizip-ng + # https://github.com/zlib-ng/minizip-ng +-find_package(minizip-ng 3.0.7 REQUIRED) ++find_package(minizip REQUIRED) + + if(OCIO_BUILD_APPS) + +@@ -149,7 +149,7 @@ if(OCIO_BUILD_APPS) + + # lcms2 + # https://github.com/mm2/Little-CMS +- find_package(lcms2 2.2 REQUIRED) ++ find_package(lcms REQUIRED) + endif() + + if(OCIO_BUILD_OPENFX) +@@ -214,7 +214,7 @@ if(OCIO_BUILD_APPS) + # OpenEXR + # https://github.com/AcademySoftwareFoundation/openexr + set(_OpenEXR_ExternalProject_VERSION "3.1.5") +- find_package(OpenEXR 3.0) ++ find_package(OpenEXR CONFIG) + + if(OpenEXR_FOUND AND TARGET OpenEXR::OpenEXR) + add_library(OpenColorIO::ImageIOBackend ALIAS OpenEXR::OpenEXR) +diff --git a/share/cmake/utils/CppVersion.cmake b/share/cmake/utils/CppVersion.cmake +index 175d89c..2d34a65 100644 +--- a/share/cmake/utils/CppVersion.cmake ++++ b/share/cmake/utils/CppVersion.cmake +@@ -16,8 +16,6 @@ elseif(NOT CMAKE_CXX_STANDARD IN_LIST SUPPORTED_CXX_STANDARDS) + "CMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} is unsupported. Supported standards are: ${SUPPORTED_CXX_STANDARDS_STR}.") + endif() + +-set_property(CACHE CMAKE_CXX_STANDARD PROPERTY STRINGS "${SUPPORTED_CXX_STANDARDS}") +- + include(CheckCXXCompilerFlag) + + # As CheckCXXCompilerFlag implicitly uses CMAKE_CXX_FLAGS some custom flags could trigger unrelated +diff --git a/src/OpenColorIO/CMakeLists.txt b/src/OpenColorIO/CMakeLists.txt +index 1c4d774..da70227 100755 +--- a/src/OpenColorIO/CMakeLists.txt ++++ b/src/OpenColorIO/CMakeLists.txt +@@ -289,7 +289,7 @@ target_link_libraries(OpenColorIO + "$" + "$" + yaml-cpp +- MINIZIP::minizip-ng ++ PUBLIC MINIZIP::minizip + ) + + if(APPLE) +diff --git a/src/apps/ocioarchive/CMakeLists.txt b/src/apps/ocioarchive/CMakeLists.txt +index 6b868d1..820e36c 100644 +--- a/src/apps/ocioarchive/CMakeLists.txt ++++ b/src/apps/ocioarchive/CMakeLists.txt +@@ -19,7 +19,7 @@ target_link_libraries(ocioarchive + PRIVATE + apputils + OpenColorIO +- MINIZIP::minizip-ng ++ MINIZIP::minizip + ) + + install(TARGETS ocioarchive +diff --git a/src/apps/ociobakelut/CMakeLists.txt b/src/apps/ociobakelut/CMakeLists.txt +index a50e87e..37174ea 100755 +--- a/src/apps/ociobakelut/CMakeLists.txt ++++ b/src/apps/ociobakelut/CMakeLists.txt +@@ -28,7 +28,7 @@ set_target_properties(ociobakelut + target_link_libraries(ociobakelut + PRIVATE + apputils +- lcms2::lcms2 ++ lcms::lcms + OpenColorIO + ) + diff --git a/recipes/opencolorio/all/patches/2.2.1-0002-fix-pystring.patch b/recipes/opencolorio/all/patches/2.2.1-0002-fix-pystring.patch new file mode 100644 index 0000000000000..fc58ce5a2da84 --- /dev/null +++ b/recipes/opencolorio/all/patches/2.2.1-0002-fix-pystring.patch @@ -0,0 +1,163 @@ +diff --git a/src/OpenColorIO/Config.cpp b/src/OpenColorIO/Config.cpp +index 665d522..6abc149 100644 +--- a/src/OpenColorIO/Config.cpp ++++ b/src/OpenColorIO/Config.cpp +@@ -33,7 +33,7 @@ + #include "Platform.h" + #include "PrivateTypes.h" + #include "Processor.h" +-#include "pystring/pystring.h" ++#include "pystring.h" + #include "transforms/FileTransform.h" + #include "utils/StringUtils.h" + #include "ViewingRules.h" +diff --git a/src/OpenColorIO/Context.cpp b/src/OpenColorIO/Context.cpp +index bb6fb07..a8890ed 100644 +--- a/src/OpenColorIO/Context.cpp ++++ b/src/OpenColorIO/Context.cpp +@@ -15,7 +15,7 @@ + #include "OCIOZArchive.h" + #include "PathUtils.h" + #include "PrivateTypes.h" +-#include "pystring/pystring.h" ++#include "pystring.h" + #include "utils/StringUtils.h" + + namespace OCIO_NAMESPACE +diff --git a/src/OpenColorIO/OCIOYaml.cpp b/src/OpenColorIO/OCIOYaml.cpp +index 62cbb0d..59c1564 100644 +--- a/src/OpenColorIO/OCIOYaml.cpp ++++ b/src/OpenColorIO/OCIOYaml.cpp +@@ -19,7 +19,7 @@ + #include "ParseUtils.h" + #include "PathUtils.h" + #include "Platform.h" +-#include "pystring/pystring.h" ++#include "pystring.h" + #include "utils/StringUtils.h" + #include "ViewingRules.h" + #include "yaml-cpp/yaml.h" +diff --git a/src/OpenColorIO/OCIOZArchive.cpp b/src/OpenColorIO/OCIOZArchive.cpp +index 85fc7bb..4cd1448 100644 +--- a/src/OpenColorIO/OCIOZArchive.cpp ++++ b/src/OpenColorIO/OCIOZArchive.cpp +@@ -11,7 +11,7 @@ + #include + #include "Mutex.h" + #include "Platform.h" +-#include "pystring/pystring.h" ++#include "pystring.h" + #include "utils/StringUtils.h" + #include "transforms/FileTransform.h" + +@@ -630,4 +630,4 @@ void CIOPOciozArchive::buildEntries() + getEntriesMappingFromArchiveFile(m_archiveAbsPath, m_entries); + } + +-} // namespace OCIO_NAMESPACE +\ No newline at end of file ++} // namespace OCIO_NAMESPACE +diff --git a/src/OpenColorIO/Op.cpp b/src/OpenColorIO/Op.cpp +index 1ae607a..bb5406f 100755 +--- a/src/OpenColorIO/Op.cpp ++++ b/src/OpenColorIO/Op.cpp +@@ -20,7 +20,7 @@ + #include "ops/lut1d/Lut1DOp.h" + #include "ops/lut3d/Lut3DOp.h" + #include "ops/range/RangeOp.h" +-#include "pystring/pystring.h" ++#include "pystring.h" + + namespace OCIO_NAMESPACE + { +diff --git a/src/OpenColorIO/PathUtils.cpp b/src/OpenColorIO/PathUtils.cpp +index 9dc8c6b..4a1096d 100644 +--- a/src/OpenColorIO/PathUtils.cpp ++++ b/src/OpenColorIO/PathUtils.cpp +@@ -10,7 +10,7 @@ + #include "Mutex.h" + #include "PathUtils.h" + #include "Platform.h" +-#include "pystring/pystring.h" ++#include "pystring.h" + #include "utils/StringUtils.h" + #include "OCIOZArchive.h" + +diff --git a/src/OpenColorIO/fileformats/FileFormatCTF.cpp b/src/OpenColorIO/fileformats/FileFormatCTF.cpp +index ebed326..9f70ff8 100644 +--- a/src/OpenColorIO/fileformats/FileFormatCTF.cpp ++++ b/src/OpenColorIO/fileformats/FileFormatCTF.cpp +@@ -23,7 +23,7 @@ + #include "OpBuilders.h" + #include "ops/noop/NoOps.h" + #include "Platform.h" +-#include "pystring/pystring.h" ++#include "pystring.h" + #include "TransformBuilder.h" + #include "transforms/FileTransform.h" + #include "utils/StringUtils.h" +diff --git a/src/OpenColorIO/fileformats/FileFormatDiscreet1DL.cpp b/src/OpenColorIO/fileformats/FileFormatDiscreet1DL.cpp +index a52bc72..bd827f0 100755 +--- a/src/OpenColorIO/fileformats/FileFormatDiscreet1DL.cpp ++++ b/src/OpenColorIO/fileformats/FileFormatDiscreet1DL.cpp +@@ -16,7 +16,7 @@ + #include "ops/lut1d/Lut1DOp.h" + #include "ops/lut3d/Lut3DOp.h" + #include "ParseUtils.h" +-#include "pystring/pystring.h" ++#include "pystring.h" + #include "Platform.h" + #include "transforms/FileTransform.h" + #include "utils/StringUtils.h" +diff --git a/src/OpenColorIO/fileformats/FileFormatICC.cpp b/src/OpenColorIO/fileformats/FileFormatICC.cpp +index 786c8a5..4953103 100755 +--- a/src/OpenColorIO/fileformats/FileFormatICC.cpp ++++ b/src/OpenColorIO/fileformats/FileFormatICC.cpp +@@ -14,7 +14,7 @@ + #include "ops/lut1d/Lut1DOp.h" + #include "ops/matrix/MatrixOp.h" + #include "ops/range/RangeOp.h" +-#include "pystring/pystring.h" ++#include "pystring.h" + #include "transforms/FileTransform.h" + + +diff --git a/src/OpenColorIO/fileformats/FileFormatIridasLook.cpp b/src/OpenColorIO/fileformats/FileFormatIridasLook.cpp +index 7402efd..cc3acb4 100755 +--- a/src/OpenColorIO/fileformats/FileFormatIridasLook.cpp ++++ b/src/OpenColorIO/fileformats/FileFormatIridasLook.cpp +@@ -13,7 +13,7 @@ + #include "ops/lut3d/Lut3DOp.h" + #include "ParseUtils.h" + #include "Platform.h" +-#include "pystring/pystring.h" ++#include "pystring.h" + #include "transforms/FileTransform.h" + #include "utils/StringUtils.h" + #include "utils/NumberUtils.h" +diff --git a/src/OpenColorIO/transforms/FileTransform.cpp b/src/OpenColorIO/transforms/FileTransform.cpp +index 4fd4d5d..dc5eb3c 100755 +--- a/src/OpenColorIO/transforms/FileTransform.cpp ++++ b/src/OpenColorIO/transforms/FileTransform.cpp +@@ -19,7 +19,7 @@ + #include "ops/noop/NoOps.h" + #include "PathUtils.h" + #include "Platform.h" +-#include "pystring/pystring.h" ++#include "pystring.h" + #include "utils/StringUtils.h" + + namespace OCIO_NAMESPACE +diff --git a/vendor/openfx/OCIOUtils.cpp b/vendor/openfx/OCIOUtils.cpp +index ca44905..469ed35 100644 +--- a/vendor/openfx/OCIOUtils.cpp ++++ b/vendor/openfx/OCIOUtils.cpp +@@ -9,7 +9,7 @@ namespace OCIO = OCIO_NAMESPACE; + #include + + #include "ofxsLog.h" +-#include "pystring/pystring.h" ++#include "pystring.h" + + namespace + { diff --git a/recipes/opencolorio/all/patches/2.2.1-0003-strlen.patch b/recipes/opencolorio/all/patches/2.2.1-0003-strlen.patch new file mode 100644 index 0000000000000..b694178bdf977 --- /dev/null +++ b/recipes/opencolorio/all/patches/2.2.1-0003-strlen.patch @@ -0,0 +1,13 @@ +diff --git a/src/OpenColorIO/FileRules.cpp b/src/OpenColorIO/FileRules.cpp +index 61a5e0f..e0df0d0 100644 +--- a/src/OpenColorIO/FileRules.cpp ++++ b/src/OpenColorIO/FileRules.cpp +@@ -62,7 +62,7 @@ std::string ConvertToRegularExpression(const char * globPattern, bool ignoreCase + + if (ignoreCase) + { +- const size_t length = strlen(globPattern); ++ const size_t length = std::strlen(globPattern); + bool respectCase = false; + for (size_t i = 0; i < length; ++i) + { diff --git a/recipes/opencolorio/all/patches/2.3.1-0001-fix-cmake-source-dir-and-targets.patch b/recipes/opencolorio/all/patches/2.3.1-0001-fix-cmake-source-dir-and-targets.patch new file mode 100644 index 0000000000000..8b057e40e2eb1 --- /dev/null +++ b/recipes/opencolorio/all/patches/2.3.1-0001-fix-cmake-source-dir-and-targets.patch @@ -0,0 +1,101 @@ +diff --git CMakeLists.txt CMakeLists.txt +index 7b62a993..5ea33694 100755 +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -511,7 +511,7 @@ install( + FILE ${OCIO_TARGETS_EXPORT_NAME} + ) + +-if (NOT BUILD_SHARED_LIBS) ++if (0) + # Install custom macros used in the find modules. + install(FILES + ${CMAKE_CURRENT_LIST_DIR}/share/cmake/macros/VersionUtils.cmake +diff --git share/cmake/modules/FindExtPackages.cmake share/cmake/modules/FindExtPackages.cmake +index 2625242c..dcb41cf2 100644 +--- share/cmake/modules/FindExtPackages.cmake ++++ share/cmake/modules/FindExtPackages.cmake +@@ -63,7 +63,7 @@ ocio_handle_dependency( expat REQUIRED ALLOW_INSTALL + # https://github.com/jbeder/yaml-cpp + ocio_handle_dependency( yaml-cpp REQUIRED ALLOW_INSTALL + MIN_VERSION 0.6.3 +- RECOMMENDED_VERSION 0.7.0 ++ RECOMMENDED_VERSION 0.8.0 + RECOMMENDED_VERSION_REASON "Latest version tested with OCIO") + + # pystring +@@ -110,9 +110,9 @@ ocio_handle_dependency( ZLIB REQUIRED ALLOW_INSTALL + + # minizip-ng + # https://github.com/zlib-ng/minizip-ng +-ocio_handle_dependency( minizip-ng REQUIRED ALLOW_INSTALL ++ocio_handle_dependency( minizip REQUIRED ALLOW_INSTALL + MIN_VERSION 3.0.6 +- RECOMMENDED_VERSION 3.0.7 ++ RECOMMENDED_VERSION 4.0.1 + RECOMMENDED_VERSION_REASON "Latest version tested with OCIO") + + ############################################################################### +@@ -131,7 +131,7 @@ if(OCIO_BUILD_APPS) + + # lcms2 + # https://github.com/mm2/Little-CMS +- ocio_handle_dependency( lcms2 REQUIRED ALLOW_INSTALL ++ ocio_handle_dependency( lcms REQUIRED ALLOW_INSTALL + MIN_VERSION 2.2 + RECOMMENDED_VERSION 2.2 + RECOMMENDED_VERSION_REASON "Latest version tested with OCIO") +diff --git share/cmake/utils/CppVersion.cmake share/cmake/utils/CppVersion.cmake +index 175d89c2..ac93b87a 100644 +--- share/cmake/utils/CppVersion.cmake ++++ share/cmake/utils/CppVersion.cmake +@@ -16,7 +16,7 @@ elseif(NOT CMAKE_CXX_STANDARD IN_LIST SUPPORTED_CXX_STANDARDS) + "CMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} is unsupported. Supported standards are: ${SUPPORTED_CXX_STANDARDS_STR}.") + endif() + +-set_property(CACHE CMAKE_CXX_STANDARD PROPERTY STRINGS "${SUPPORTED_CXX_STANDARDS}") ++# set_property(CACHE CMAKE_CXX_STANDARD PROPERTY STRINGS "${SUPPORTED_CXX_STANDARDS}") + + include(CheckCXXCompilerFlag) + +diff --git src/OpenColorIO/CMakeLists.txt src/OpenColorIO/CMakeLists.txt +index 26b4bb4c..d54cff3d 100755 +--- src/OpenColorIO/CMakeLists.txt ++++ src/OpenColorIO/CMakeLists.txt +@@ -309,8 +309,8 @@ target_link_libraries(OpenColorIO + "$" + "$" + "$" +- ${YAML_CPP_LIBRARIES} +- MINIZIP::minizip-ng ++ PUBLIC yaml-cpp ++ MINIZIP::minizip + ) + + if(OCIO_USE_SIMD AND OCIO_USE_SSE2NEON AND COMPILER_SUPPORTS_SSE_WITH_SSE2NEON) +diff --git src/apps/ocioarchive/CMakeLists.txt src/apps/ocioarchive/CMakeLists.txt +index 599d706f..efe6cd5a 100644 +--- src/apps/ocioarchive/CMakeLists.txt ++++ src/apps/ocioarchive/CMakeLists.txt +@@ -21,7 +21,7 @@ target_link_libraries(ocioarchive + PRIVATE + apputils + OpenColorIO +- MINIZIP::minizip-ng ++ MINIZIP::minizip + ) + + include(StripUtils) +diff --git src/apps/ociobakelut/CMakeLists.txt src/apps/ociobakelut/CMakeLists.txt +index 3d6e586b..f7069a1f 100755 +--- src/apps/ociobakelut/CMakeLists.txt ++++ src/apps/ociobakelut/CMakeLists.txt +@@ -29,7 +29,7 @@ set_target_properties(ociobakelut + target_link_libraries(ociobakelut + PRIVATE + apputils +- lcms2::lcms2 ++ lcms::lcms + OpenColorIO + ) + diff --git a/recipes/opencolorio/all/patches/2.4.0-0001-fix-cmake-source-dir-and-targets.patch b/recipes/opencolorio/all/patches/2.4.0-0001-fix-cmake-source-dir-and-targets.patch new file mode 100644 index 0000000000000..35a7af01ea95d --- /dev/null +++ b/recipes/opencolorio/all/patches/2.4.0-0001-fix-cmake-source-dir-and-targets.patch @@ -0,0 +1,101 @@ +diff --git CMakeLists.txt CMakeLists.txt +index 0eaec4be..e711295c 100755 +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -511,7 +511,7 @@ install( + FILE ${OCIO_TARGETS_EXPORT_NAME} + ) + +-if (NOT BUILD_SHARED_LIBS) ++if (0) + # Install custom macros used in the find modules. + install(FILES + ${CMAKE_CURRENT_LIST_DIR}/share/cmake/macros/VersionUtils.cmake +diff --git share/cmake/modules/FindExtPackages.cmake share/cmake/modules/FindExtPackages.cmake +index accdecec..945c5edc 100644 +--- share/cmake/modules/FindExtPackages.cmake ++++ share/cmake/modules/FindExtPackages.cmake +@@ -63,7 +63,7 @@ ocio_handle_dependency( expat REQUIRED ALLOW_INSTALL + # https://github.com/jbeder/yaml-cpp + ocio_handle_dependency( yaml-cpp REQUIRED ALLOW_INSTALL + MIN_VERSION 0.6.3 +- RECOMMENDED_VERSION 0.7.0 ++ RECOMMENDED_VERSION 0.8.0 + RECOMMENDED_VERSION_REASON "Latest version tested with OCIO") + + # pystring +@@ -110,9 +110,9 @@ ocio_handle_dependency( ZLIB REQUIRED ALLOW_INSTALL + + # minizip-ng + # https://github.com/zlib-ng/minizip-ng +-ocio_handle_dependency( minizip-ng REQUIRED ALLOW_INSTALL ++ocio_handle_dependency( minizip REQUIRED ALLOW_INSTALL + MIN_VERSION 3.0.6 +- RECOMMENDED_VERSION 3.0.7 ++ RECOMMENDED_VERSION 4.0.1 + RECOMMENDED_VERSION_REASON "Latest version tested with OCIO") + + ############################################################################### +@@ -131,7 +131,7 @@ if(OCIO_BUILD_APPS) + + # lcms2 + # https://github.com/mm2/Little-CMS +- ocio_handle_dependency( lcms2 REQUIRED ALLOW_INSTALL ++ ocio_handle_dependency( lcms REQUIRED ALLOW_INSTALL + MIN_VERSION 2.2 + RECOMMENDED_VERSION 2.2 + RECOMMENDED_VERSION_REASON "Latest version tested with OCIO") +diff --git share/cmake/utils/CppVersion.cmake share/cmake/utils/CppVersion.cmake +index 175d89c2..ac93b87a 100644 +--- share/cmake/utils/CppVersion.cmake ++++ share/cmake/utils/CppVersion.cmake +@@ -16,7 +16,7 @@ elseif(NOT CMAKE_CXX_STANDARD IN_LIST SUPPORTED_CXX_STANDARDS) + "CMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} is unsupported. Supported standards are: ${SUPPORTED_CXX_STANDARDS_STR}.") + endif() + +-set_property(CACHE CMAKE_CXX_STANDARD PROPERTY STRINGS "${SUPPORTED_CXX_STANDARDS}") ++# set_property(CACHE CMAKE_CXX_STANDARD PROPERTY STRINGS "${SUPPORTED_CXX_STANDARDS}") + + include(CheckCXXCompilerFlag) + +diff --git src/OpenColorIO/CMakeLists.txt src/OpenColorIO/CMakeLists.txt +index 7d2894da..1e6570b4 100755 +--- src/OpenColorIO/CMakeLists.txt ++++ src/OpenColorIO/CMakeLists.txt +@@ -315,8 +315,8 @@ target_link_libraries(OpenColorIO + "$" + "$" + "$" +- ${YAML_CPP_LIBRARIES} +- MINIZIP::minizip-ng ++ PUBLIC yaml-cpp ++ MINIZIP::minizip + ) + + if(OCIO_USE_SIMD AND OCIO_USE_SSE2NEON AND COMPILER_SUPPORTS_SSE_WITH_SSE2NEON) +diff --git src/apps/ocioarchive/CMakeLists.txt src/apps/ocioarchive/CMakeLists.txt +index 599d706f..efe6cd5a 100644 +--- src/apps/ocioarchive/CMakeLists.txt ++++ src/apps/ocioarchive/CMakeLists.txt +@@ -21,7 +21,7 @@ target_link_libraries(ocioarchive + PRIVATE + apputils + OpenColorIO +- MINIZIP::minizip-ng ++ MINIZIP::minizip + ) + + include(StripUtils) +diff --git src/apps/ociobakelut/CMakeLists.txt src/apps/ociobakelut/CMakeLists.txt +index 3d6e586b..f7069a1f 100755 +--- src/apps/ociobakelut/CMakeLists.txt ++++ src/apps/ociobakelut/CMakeLists.txt +@@ -29,7 +29,7 @@ set_target_properties(ociobakelut + target_link_libraries(ociobakelut + PRIVATE + apputils +- lcms2::lcms2 ++ lcms::lcms + OpenColorIO + ) + diff --git a/recipes/opencolorio/all/patches/fix-cmake-source-dir-and-targets.patch b/recipes/opencolorio/all/patches/fix-cmake-source-dir-and-targets.patch deleted file mode 100644 index c9f1055c82e2c..0000000000000 --- a/recipes/opencolorio/all/patches/fix-cmake-source-dir-and-targets.patch +++ /dev/null @@ -1,86 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index b0840ac2..e4875ab6 100755 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -9,9 +9,9 @@ cmake_minimum_required(VERSION 3.12) - - set(CMAKE_MODULE_PATH - ${CMAKE_MODULE_PATH} -- ${CMAKE_SOURCE_DIR}/share/cmake/utils -- ${CMAKE_SOURCE_DIR}/share/cmake/macros -- ${CMAKE_SOURCE_DIR}/share/cmake/modules -+ ${CMAKE_CURRENT_SOURCE_DIR}/share/cmake/utils -+ ${CMAKE_CURRENT_SOURCE_DIR}/share/cmake/macros -+ ${CMAKE_CURRENT_SOURCE_DIR}/share/cmake/modules - ) - - set(CMAKE_WARN_DEPRECATED ON) -@@ -272,7 +272,7 @@ else() - set(OCIO_SETUP_NAME setup_ocio.sh) - endif() - --configure_file(${CMAKE_SOURCE_DIR}/share/ocio/${OCIO_SETUP_NAME}.in -+configure_file(${PROJECT_SOURCE_DIR}/share/ocio/${OCIO_SETUP_NAME}.in - ${CMAKE_CURRENT_BINARY_DIR}/share/ocio/${OCIO_SETUP_NAME} @ONLY) - - INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/share/ocio/${OCIO_SETUP_NAME} DESTINATION share/ocio/) -diff --git a/share/cmake/modules/FindExtPackages.cmake b/share/cmake/modules/FindExtPackages.cmake -index 86a02258..a8fed622 100644 ---- a/share/cmake/modules/FindExtPackages.cmake -+++ b/share/cmake/modules/FindExtPackages.cmake -@@ -26,7 +26,7 @@ set(CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY ON CACHE BOOL - - # expat - # https://github.com/libexpat/libexpat --find_package(expat 2.2.8 REQUIRED) -+find_package(EXPAT 2.2.8 REQUIRED) - - # yaml-cpp - # https://github.com/jbeder/yaml-cpp -@@ -50,9 +50,9 @@ else() - - # OpenEXR/IlmBase (<=2.5) - # https://github.com/AcademySoftwareFoundation/openexr -- find_package(Half 2.4.0 REQUIRED) -+ find_package(OpenEXR 2.4.0 REQUIRED) - -- set(OCIO_HALF_LIB IlmBase::Half CACHE STRING "Half library target" FORCE) -+ set(OCIO_HALF_LIB OpenEXR::Half CACHE STRING "Half library target" FORCE) - set(OCIO_USE_IMATH_HALF "0" CACHE STRING "Whether 'half' type will be sourced from the Imath library (>=v3.0)" FORCE) - endif() - -@@ -65,7 +65,7 @@ if(OCIO_BUILD_APPS) - - # lcms2 - # https://github.com/mm2/Little-CMS -- find_package(lcms2 2.2 REQUIRED) -+ find_package(lcms 2.2 REQUIRED) - endif() - - if(OCIO_BUILD_OPENFX) -diff --git a/src/OpenColorIO/CMakeLists.txt b/src/OpenColorIO/CMakeLists.txt -index be50b7b6..8423a099 100755 ---- a/src/OpenColorIO/CMakeLists.txt -+++ b/src/OpenColorIO/CMakeLists.txt -@@ -211,7 +211,7 @@ target_link_libraries(OpenColorIO - PUBLIC - OpenColorIOHeaders - PRIVATE -- expat::expat -+ EXPAT::EXPAT - ${OCIO_HALF_LIB} - pystring::pystring - sampleicc::sampleicc -diff --git a/src/apps/ociobakelut/CMakeLists.txt b/src/apps/ociobakelut/CMakeLists.txt -index 7eb1cd8a..de136073 100755 ---- a/src/apps/ociobakelut/CMakeLists.txt -+++ b/src/apps/ociobakelut/CMakeLists.txt -@@ -35,7 +35,7 @@ set_target_properties(ociobakelut - target_link_libraries(ociobakelut - PRIVATE - apputils -- lcms2::lcms2 -+ lcms::lcms - OpenColorIO - ) - diff --git a/recipes/opencolorio/all/test_package/CMakeLists.txt b/recipes/opencolorio/all/test_package/CMakeLists.txt index 074c63fccc550..825fa34216bd6 100644 --- a/recipes/opencolorio/all/test_package/CMakeLists.txt +++ b/recipes/opencolorio/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(OpenColorIO REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} OpenColorIO::OpenColorIO) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE OpenColorIO::OpenColorIO) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/opencolorio/all/test_package/conanfile.py b/recipes/opencolorio/all/test_package/conanfile.py index 38f4483872d47..a9fb96656f203 100644 --- a/recipes/opencolorio/all/test_package/conanfile.py +++ b/recipes/opencolorio/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/opencolorio/config.yml b/recipes/opencolorio/config.yml index 1f2bc2497ef89..29dc01bc3add5 100644 --- a/recipes/opencolorio/config.yml +++ b/recipes/opencolorio/config.yml @@ -1,4 +1,10 @@ versions: + "2.4.0": + folder: "all" + "2.3.2": + folder: "all" + "2.2.1": + folder: "all" "2.1.0": folder: "all" "1.1.1": diff --git a/recipes/opencore-amr/all/conandata.yml b/recipes/opencore-amr/all/conandata.yml index 44a009a38d2e0..8ac0f24717894 100644 --- a/recipes/opencore-amr/all/conandata.yml +++ b/recipes/opencore-amr/all/conandata.yml @@ -5,3 +5,12 @@ sources: "0.1.5": url: "https://downloads.sourceforge.net/project/opencore-amr/opencore-amr/opencore-amr-0.1.5.tar.gz" sha256: "2c006cb9d5f651bfb5e60156dbff6af3c9d35c7bbcc9015308c0aff1e14cd341" +patches: + "0.1.6": + - patch_file: "patches/0001-remove-deprecated-register-keyword.patch" + patch_description: "remove deprecated register keyword" + patch_type: "portability" + "0.1.5": + - patch_file: "patches/0001-remove-deprecated-register-keyword.patch" + patch_description: "remove deprecated register keyword" + patch_type: "portability" diff --git a/recipes/opencore-amr/all/conanfile.py b/recipes/opencore-amr/all/conanfile.py index 3c1ebbcb2a163..c502c5b4aa5f7 100644 --- a/recipes/opencore-amr/all/conanfile.py +++ b/recipes/opencore-amr/all/conanfile.py @@ -1,13 +1,13 @@ 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 +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, 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.47.0" +required_conan_version = ">=1.54.0" class OpencoreAmrConan(ConanFile): @@ -17,6 +17,7 @@ class OpencoreAmrConan(ConanFile): topics = ("audio-codec", "amr", "opencore") url = "https://github.com/conan-io/conan-center-index" license = "Apache-2.0" + package_type = "library" settings = "os", "compiler", "build_type", "arch" options = { "shared": [True, False], @@ -27,82 +28,83 @@ class OpencoreAmrConan(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) + 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 layout(self): + basic_layout(self, src_folder="src") 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") + 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): - files.get(self, **self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - @contextmanager - def _build_context(self): + 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([ + "--disable-compile-c", + "--disable-examples", + ]) if is_msvc(self): - with vcvars(self): - env = { - "CC": "cl -nologo", - "CXX": "cl -nologo", - "LD": "link -nologo", - "AR": "{} lib".format(unix_path(self.deps_user_info["automake"].ar_lib)), - } - with environment_append(env): - yield - else: - yield - - def _configure_autotools(self): - if self._autotools: - return self._autotools - 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)), - ] + tc.extra_cxxflags.append("-EHsc") + if check_min_vs(self, "180", raise_invalid=False): + tc.extra_cxxflags.append("-FS") + tc.generate() + if is_msvc(self): - self._autotools.cxx_flags.append("-EHsc") - if Version(self.settings.compiler.version) >= "12": - self._autotools.flags.append("-FS") - self._autotools.configure( - args=args, configure_dir=self._source_subfolder) - return self._autotools + env = Environment() + 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): - with self._build_context(): - self._configure_autotools() - self._autotools.make() + apply_conandata_patches(self) + autotools = Autotools(self) + autotools.configure() + autotools.make() def package(self): - self._autotools.install() - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - 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: + copy(self, pattern="LICENSE", 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, "lib", "pkgconfig")) + + fix_apple_shared_install_name(self) + + if is_msvc(self) and self.options.shared: for lib in ("opencore-amrwb", "opencore-amrnb"): - files.rename(self, os.path.join(self.package_folder, "lib", "{}.dll.lib".format(lib)), + 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): @@ -114,5 +116,8 @@ def package_info(self): "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] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components[lib].system_libs.extend(["m"]) + # 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/all/patches/0001-remove-deprecated-register-keyword.patch b/recipes/opencore-amr/all/patches/0001-remove-deprecated-register-keyword.patch new file mode 100644 index 0000000000000..8604cff0abf61 --- /dev/null +++ b/recipes/opencore-amr/all/patches/0001-remove-deprecated-register-keyword.patch @@ -0,0 +1,1357 @@ +From 8fa46c7a3092186e922ed27e9b38d79caf178f36 Mon Sep 17 00:00:00 2001 +From: Gregor Jasny +Date: Mon, 19 Jun 2023 20:41:15 +0200 +Subject: [PATCH] remove deprecated register keyword + +--- + .../common/include/basic_op_arm_gcc_v5.h | 62 ++++++------ + .../common/include/basic_op_c_equivalent.h | 10 +- + .../gsm_amr/amr_nb/common/include/l_add.h | 8 +- + .../gsm_amr/amr_nb/common/include/l_mac.h | 6 +- + .../gsm_amr/amr_nb/common/include/l_msu.h | 6 +- + .../gsm_amr/amr_nb/common/include/l_mult.h | 6 +- + .../gsm_amr/amr_nb/common/include/l_sub.h | 8 +- + .../gsm_amr/amr_nb/common/include/mpy_32.h | 14 +-- + .../gsm_amr/amr_nb/common/include/mpy_32_16.h | 6 +- + .../gsm_amr/amr_nb/common/include/mult.h | 6 +- + .../gsm_amr/amr_nb/common/include/negate.h | 2 +- + .../gsm_amr/amr_nb/common/include/norm_l.h | 4 +- + .../gsm_amr/amr_nb/common/include/norm_s.h | 4 +- + .../gsm_amr/amr_nb/common/src/az_lsp.cpp | 8 +- + .../audio/gsm_amr/amr_nb/common/src/div_s.cpp | 4 +- + .../gsm_amr/amr_nb/common/src/gc_pred.cpp | 8 +- + .../gsm_amr/amr_nb/common/src/gmed_n.cpp | 6 +- + .../audio/gsm_amr/amr_nb/common/src/l_abs.cpp | 2 +- + .../gsm_amr/amr_nb/common/src/l_shr_r.cpp | 2 +- + .../gsm_amr/amr_nb/common/src/lsp_az.cpp | 8 +- + .../gsm_amr/amr_nb/common/src/mult_r.cpp | 2 +- + .../gsm_amr/amr_nb/common/src/negate.cpp | 2 +- + .../gsm_amr/amr_nb/common/src/norm_l.cpp | 4 +- + .../gsm_amr/amr_nb/common/src/norm_s.cpp | 4 +- + .../gsm_amr/amr_nb/common/src/pred_lt.cpp | 6 +- + .../gsm_amr/amr_nb/common/src/q_plsf_3.cpp | 6 +- + .../gsm_amr/amr_nb/common/src/residu.cpp | 2 +- + .../audio/gsm_amr/amr_nb/common/src/round.cpp | 2 +- + .../audio/gsm_amr/amr_nb/common/src/shr.cpp | 4 +- + .../audio/gsm_amr/amr_nb/common/src/shr_r.cpp | 2 +- + .../gsm_amr/amr_nb/common/src/weight_a.cpp | 2 +- + .../audio/gsm_amr/amr_nb/dec/src/d1035pf.cpp | 2 +- + .../audio/gsm_amr/amr_nb/dec/src/d_plsf_5.cpp | 2 +- + .../audio/gsm_amr/amr_nb/dec/src/int_lsf.cpp | 6 +- + .../audio/gsm_amr/amr_nb/dec/src/ph_disp.cpp | 8 +- + .../audio/gsm_amr/amr_nb/dec/src/pstfilt.cpp | 4 +- + .../audio/gsm_amr/amr_nb/enc/src/autocorr.cpp | 6 +- + .../audio/gsm_amr/amr_nb/enc/src/c2_9pf.cpp | 24 ++--- + .../audio/gsm_amr/amr_nb/enc/src/cl_ltp.cpp | 2 +- + .../audio/gsm_amr/amr_nb/enc/src/convolve.cpp | 2 +- + .../audio/gsm_amr/amr_nb/enc/src/cor_h.cpp | 4 +- + .../audio/gsm_amr/amr_nb/enc/src/cor_h_x.cpp | 6 +- + .../audio/gsm_amr/amr_nb/enc/src/cor_h_x2.cpp | 6 +- + .../audio/gsm_amr/amr_nb/enc/src/dtx_enc.cpp | 6 +- + .../audio/gsm_amr/amr_nb/enc/src/l_negate.cpp | 2 +- + .../audio/gsm_amr/amr_nb/enc/src/levinson.cpp | 10 +- + .../audio/gsm_amr/amr_nb/enc/src/pitch_ol.cpp | 2 +- + .../audio/gsm_amr/amr_nb/enc/src/pre_proc.cpp | 2 +- + .../audio/gsm_amr/amr_nb/enc/src/set_sign.cpp | 2 +- + .../gsm_amr/amr_wb/dec/src/normalize_amr_wb.h | 4 +- + .../amr_wb/dec/src/pvamrwb_math_op.cpp | 2 +- + .../src/pvamrwbdecoder_basic_op_gcc_armv5.h | 98 +++++++++---------- + 52 files changed, 208 insertions(+), 208 deletions(-) + +diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_gcc_v5.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_gcc_v5.h +index 5752171..2c93015 100644 +--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_gcc_v5.h ++++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_gcc_v5.h +@@ -112,10 +112,10 @@ extern "C" + L_sum = 32-bit sum of L_var1 and L_var2 (Word32) + */ + +- static inline Word32 L_add(register Word32 L_var1, register Word32 L_var2, Flag *pOverflow) ++ static inline Word32 L_add(Word32 L_var1, Word32 L_var2, Flag *pOverflow) + { +- register Word32 ra = L_var1; +- register Word32 rb = L_var2; ++ Word32 ra = L_var1; ++ Word32 rb = L_var2; + Word32 result; + + OSCL_UNUSED_ARG(pOverflow); +@@ -151,8 +151,8 @@ extern "C" + */ + static inline Word32 L_sub(Word32 L_var1, Word32 L_var2, Flag *pOverflow) + { +- register Word32 ra = L_var1; +- register Word32 rb = L_var2; ++ Word32 ra = L_var1; ++ Word32 rb = L_var2; + Word32 result; + + OSCL_UNUSED_ARG(pOverflow); +@@ -190,9 +190,9 @@ extern "C" + */ + static inline Word32 L_mac(Word32 L_var3, Word16 var1, Word16 var2, Flag *pOverflow) + { +- register Word32 ra = L_var3; +- register Word32 rb = var1; +- register Word32 rc = var2; ++ Word32 ra = L_var3; ++ Word32 rb = var1; ++ Word32 rc = var2; + Word32 result; + + OSCL_UNUSED_ARG(pOverflow); +@@ -234,8 +234,8 @@ extern "C" + + static inline Word32 L_mult(Word16 var1, Word16 var2, Flag *pOverflow) + { +- register Word32 ra = var1; +- register Word32 rb = var2; ++ Word32 ra = var1; ++ Word32 rb = var2; + Word32 result; + Word32 product; + +@@ -279,9 +279,9 @@ extern "C" + */ + static inline Word32 L_msu(Word32 L_var3, Word16 var1, Word16 var2, Flag *pOverflow) + { +- register Word32 ra = L_var3; +- register Word32 rb = var1; +- register Word32 rc = var2; ++ Word32 ra = L_var3; ++ Word32 rb = var1; ++ Word32 rc = var2; + Word32 product; + Word32 result; + +@@ -326,13 +326,13 @@ extern "C" + Word16 L_var2_lo, + Flag *pOverflow) + { +- register Word32 product32; +- register Word32 L_sum; +- register Word32 L_product, result; +- register Word32 ra = L_var1_hi; +- register Word32 rb = L_var1_lo; +- register Word32 rc = L_var2_hi; +- register Word32 rd = L_var2_lo; ++ Word32 product32; ++ Word32 L_sum; ++ Word32 L_product, result; ++ Word32 ra = L_var1_hi; ++ Word32 rb = L_var1_lo; ++ Word32 rc = L_var2_hi; ++ Word32 rd = L_var2_lo; + + + +@@ -410,9 +410,9 @@ extern "C" + Flag *pOverflow) + { + +- register Word32 ra = L_var1_hi; +- register Word32 rb = L_var1_lo; +- register Word32 rc = var2; ++ Word32 ra = L_var1_hi; ++ Word32 rb = L_var1_lo; ++ Word32 rc = var2; + Word32 result, L_product; + + OSCL_UNUSED_ARG(pOverflow); +@@ -470,8 +470,8 @@ extern "C" + */ + static inline Word16 mult(Word16 var1, Word16 var2, Flag *pOverflow) + { +- register Word32 ra = var1; +- register Word32 rb = var2; ++ Word32 ra = var1; ++ Word32 rb = var2; + Word32 product; + Word32 temp; + +@@ -494,9 +494,9 @@ extern "C" + + static inline Word32 amrnb_fxp_mac_16_by_16bb(Word32 L_var1, Word32 L_var2, Word32 L_var3) + { +- register Word32 ra = L_var1; +- register Word32 rb = L_var2; +- register Word32 rc = L_var3; ++ Word32 ra = L_var1; ++ Word32 rb = L_var2; ++ Word32 rc = L_var3; + Word32 result; + + __asm__ volatile("smlabb %0, %1, %2, %3" +@@ -508,9 +508,9 @@ extern "C" + + static inline Word32 amrnb_fxp_msu_16_by_16bb(Word32 L_var1, Word32 L_var2, Word32 L_var3) + { +- register Word32 ra = L_var1; +- register Word32 rb = L_var2; +- register Word32 rc = L_var3; ++ Word32 ra = L_var1; ++ Word32 rb = L_var2; ++ Word32 rc = L_var3; + Word32 result; + + __asm__ volatile("rsb %0, %1, #0" +diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_c_equivalent.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_c_equivalent.h +index 62072a5..d56ecd0 100644 +--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_c_equivalent.h ++++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_c_equivalent.h +@@ -109,7 +109,7 @@ extern "C" + Returns: + L_sum = 32-bit sum of L_var1 and L_var2 (Word32) + */ +- static inline Word32 L_add(register Word32 L_var1, register Word32 L_var2, Flag *pOverflow) ++ static inline Word32 L_add(Word32 L_var1, Word32 L_var2, Flag *pOverflow) + { + Word32 L_sum; + +@@ -148,8 +148,8 @@ extern "C" + Returns: + L_diff = 32-bit difference of L_var1 and L_var2 (Word32) + */ +- static inline Word32 L_sub(register Word32 L_var1, register Word32 L_var2, +- register Flag *pOverflow) ++ static inline Word32 L_sub(Word32 L_var1, Word32 L_var2, ++ Flag *pOverflow) + { + Word32 L_diff; + +@@ -240,7 +240,7 @@ extern "C" + */ + static inline Word32 L_mult(Word16 var1, Word16 var2, Flag *pOverflow) + { +- register Word32 L_product; ++ Word32 L_product; + + L_product = (Word32) var1 * var2; + +@@ -446,7 +446,7 @@ extern "C" + */ + static inline Word16 mult(Word16 var1, Word16 var2, Flag *pOverflow) + { +- register Word32 product; ++ Word32 product; + + product = ((Word32) var1 * var2) >> 15; + +diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_add.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_add.h +index ac72c31..fc849a5 100644 +--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_add.h ++++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_add.h +@@ -88,10 +88,10 @@ extern "C" + ; Function Prototype declaration + ----------------------------------------------------------------------------*/ + #if ((PV_CPU_ARCH_VERSION >=5) && (PV_COMPILER == EPV_ARM_GNUC))/* Instructions for ARM-linux cross-compiler*/ +- __inline Word32 L_add(register Word32 L_var1, register Word32 L_var2, Flag *pOverflow) ++ __inline Word32 L_add(Word32 L_var1, Word32 L_var2, Flag *pOverflow) + { +- register Word32 ra = L_var1; +- register Word32 rb = L_var2; ++ Word32 ra = L_var1; ++ Word32 rb = L_var2; + Word32 result; + + OSCL_UNUSED_ARG(pOverflow); +@@ -107,7 +107,7 @@ extern "C" + #else /* C EQUIVALENT */ + + +- static inline Word32 L_add(register Word32 L_var1, register Word32 L_var2, Flag *pOverflow) ++ static inline Word32 L_add(Word32 L_var1, Word32 L_var2, Flag *pOverflow) + { + Word32 L_sum; + +diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_mac.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_mac.h +index f672428..173e1dd 100644 +--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_mac.h ++++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_mac.h +@@ -90,9 +90,9 @@ extern "C" + + static inline Word32 L_mac(Word32 L_var3, Word16 var1, Word16 var2, Flag *pOverflow) + { +- register Word32 ra = L_var3; +- register Word32 rb = var1; +- register Word32 rc = var2; ++ Word32 ra = L_var3; ++ Word32 rb = var1; ++ Word32 rc = var2; + Word32 result; + + OSCL_UNUSED_ARG(pOverflow); +diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_msu.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_msu.h +index 86c5735..de07525 100644 +--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_msu.h ++++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_msu.h +@@ -92,9 +92,9 @@ extern "C" + + __inline Word32 L_msu(Word32 L_var3, Word16 var1, Word16 var2, Flag *pOverflow) + { +- register Word32 ra = L_var3; +- register Word32 rb = var1; +- register Word32 rc = var2; ++ Word32 ra = L_var3; ++ Word32 rb = var1; ++ Word32 rc = var2; + Word32 product; + Word32 result; + +diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_mult.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_mult.h +index 33fedb1..5531509 100644 +--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_mult.h ++++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_mult.h +@@ -91,8 +91,8 @@ extern "C" + + __inline Word32 L_mult(Word16 var1, Word16 var2, Flag *pOverflow) + { +- register Word32 ra = var1; +- register Word32 rb = var2; ++ Word32 ra = var1; ++ Word32 rb = var2; + Word32 result; + Word32 product; + +@@ -115,7 +115,7 @@ extern "C" + + static inline Word32 L_mult(Word16 var1, Word16 var2, Flag *pOverflow) + { +- register Word32 L_product; ++ Word32 L_product; + + L_product = (Word32) var1 * var2; + +diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_sub.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_sub.h +index 88d86ca..ef83f1c 100644 +--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_sub.h ++++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_sub.h +@@ -93,8 +93,8 @@ extern "C" + + __inline Word32 L_sub(Word32 L_var1, Word32 L_var2, Flag *pOverflow) + { +- register Word32 ra = L_var1; +- register Word32 rb = L_var2; ++ Word32 ra = L_var1; ++ Word32 rb = L_var2; + Word32 result; + + OSCL_UNUSED_ARG(pOverflow); +@@ -109,8 +109,8 @@ extern "C" + + #else /* C EQUIVALENT */ + +- static inline Word32 L_sub(register Word32 L_var1, register Word32 L_var2, +- register Flag *pOverflow) ++ static inline Word32 L_sub(Word32 L_var1, Word32 L_var2, ++ Flag *pOverflow) + { + Word32 L_diff; + +diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mpy_32.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mpy_32.h +index 8df43c9..83505f4 100644 +--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mpy_32.h ++++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mpy_32.h +@@ -96,13 +96,13 @@ extern "C" + Word16 L_var2_lo, + Flag *pOverflow) + { +- register Word32 product32; +- register Word32 L_sum; +- register Word32 L_product, result; +- register Word32 ra = L_var1_hi; +- register Word32 rb = L_var1_lo; +- register Word32 rc = L_var2_hi; +- register Word32 rd = L_var2_lo; ++ Word32 product32; ++ Word32 L_sum; ++ Word32 L_product, result; ++ Word32 ra = L_var1_hi; ++ Word32 rb = L_var1_lo; ++ Word32 rc = L_var2_hi; ++ Word32 rd = L_var2_lo; + + + +diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mpy_32_16.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mpy_32_16.h +index 3a68e69..4eaa732 100644 +--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mpy_32_16.h ++++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mpy_32_16.h +@@ -96,9 +96,9 @@ extern "C" + Flag *pOverflow) + { + +- register Word32 ra = L_var1_hi; +- register Word32 rb = L_var1_lo; +- register Word32 rc = var2; ++ Word32 ra = L_var1_hi; ++ Word32 rb = L_var1_lo; ++ Word32 rc = var2; + Word32 result, L_product; + + OSCL_UNUSED_ARG(pOverflow); +diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mult.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mult.h +index c89a94e..c2ebf9a 100644 +--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mult.h ++++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mult.h +@@ -89,8 +89,8 @@ extern "C" + + __inline Word16 mult(Word16 var1, Word16 var2, Flag *pOverflow) + { +- register Word32 ra = var1; +- register Word32 rb = var2; ++ Word32 ra = var1; ++ Word32 rb = var2; + Word32 product; + Word32 temp = 0x7FFF; + +@@ -120,7 +120,7 @@ extern "C" + + static inline Word16 mult(Word16 var1, Word16 var2, Flag *pOverflow) + { +- register Word32 product; ++ Word32 product; + + product = ((Word32) var1 * var2) >> 15; + +diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/negate.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/negate.h +index 2b77f77..3ff7347 100644 +--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/negate.h ++++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/negate.h +@@ -86,7 +86,7 @@ extern "C" + ; GLOBAL FUNCTION DEFINITIONS + ; Function Prototype declaration + ----------------------------------------------------------------------------*/ +- Word16 negate(register Word16 var1); ++ Word16 negate(Word16 var1); + + /*---------------------------------------------------------------------------- + ; END +diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/norm_l.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/norm_l.h +index 288b6c7..d3de69f 100644 +--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/norm_l.h ++++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/norm_l.h +@@ -91,8 +91,8 @@ extern "C" + #if ((PV_CPU_ARCH_VERSION >=5) && (PV_COMPILER == EPV_ARM_GNUC)) + static inline Word16 norm_l(Word32 L_var1) + { +- register Word32 var_out = 0; +- register Word32 ra = L_var1; ++ Word32 var_out = 0; ++ Word32 ra = L_var1; + if (L_var1) + { + ra ^= (ra << 1); +diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/norm_s.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/norm_s.h +index 7847f34..e7865f8 100644 +--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/norm_s.h ++++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/norm_s.h +@@ -91,8 +91,8 @@ extern "C" + #if ((PV_CPU_ARCH_VERSION >=5) && (PV_COMPILER == EPV_ARM_GNUC)) + static inline Word16 norm_s(Word16 var1) + { +- register Word32 var_out = 0; +- register Word32 ra = var1 << 16; ++ Word32 var_out = 0; ++ Word32 ra = var1 << 16; + if (ra) + { + ra ^= (ra << 1); +diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/az_lsp.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/az_lsp.cpp +index 7711ac9..b3194aa 100644 +--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/az_lsp.cpp ++++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/az_lsp.cpp +@@ -489,10 +489,10 @@ void Az_lsp( + Flag *pOverflow /* (i/o): overflow flag */ + ) + { +- register Word16 i; +- register Word16 j; +- register Word16 nf; +- register Word16 ip; ++ Word16 i; ++ Word16 j; ++ Word16 nf; ++ Word16 ip; + Word16 xlow; + Word16 ylow; + Word16 xhigh; +diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/div_s.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/div_s.cpp +index f60f18b..40667eb 100644 +--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/div_s.cpp ++++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/div_s.cpp +@@ -165,13 +165,13 @@ Word16 div_s (Word16 var1, Word16 var2) + /*---------------------------------------------------------------------------- + ; FUNCTION CODE + ----------------------------------------------------------------------------*/ +-OSCL_EXPORT_REF Word16 div_s(register Word16 var1, register Word16 var2) ++OSCL_EXPORT_REF Word16 div_s(Word16 var1, Word16 var2) + { + /*---------------------------------------------------------------------------- + ; Define all local variables + ----------------------------------------------------------------------------*/ + Word16 var_out = 0; +- register Word16 iteration; ++ Word16 iteration; + Word32 L_num; + Word32 L_denom; + Word32 L_denom_by_2; +diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/gc_pred.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/gc_pred.cpp +index 71519e9..198cccc 100644 +--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/gc_pred.cpp ++++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/gc_pred.cpp +@@ -445,9 +445,9 @@ OSCL_EXPORT_REF void gc_pred( + Flag *pOverflow + ) + { +- register Word16 i; +- register Word32 L_temp1, L_temp2; +- register Word32 L_tmp; ++ Word16 i; ++ Word32 L_temp1, L_temp2; ++ Word32 L_tmp; + Word32 ener_code; + Word32 ener; + Word16 exp, frac; +@@ -929,7 +929,7 @@ OSCL_EXPORT_REF void gc_pred_average_limited( + ) + { + Word16 av_pred_en; +- register Word16 i; ++ Word16 i; + + /* do average in MR122 mode (log2() domain) */ + av_pred_en = 0; +diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/gmed_n.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/gmed_n.cpp +index a723ce4..e15549f 100644 +--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/gmed_n.cpp ++++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/gmed_n.cpp +@@ -154,9 +154,9 @@ OSCL_EXPORT_REF Word16 gmed_n( /* o : the median value */ + Word16 n /* i : number of inputs */ + ) + { +- register Word16 i, j, ix = 0; +- register Word16 max; +- register Word16 medianIndex; ++ Word16 i, j, ix = 0; ++ Word16 max; ++ Word16 medianIndex; + Word16 tmp[NMAX]; + Word16 tmp2[NMAX]; + +diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/l_abs.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/l_abs.cpp +index e436006..8f167c3 100644 +--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/l_abs.cpp ++++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/l_abs.cpp +@@ -143,7 +143,7 @@ Word32 L_abs (Word32 L_var1) + /*---------------------------------------------------------------------------- + ; FUNCTION CODE + ----------------------------------------------------------------------------*/ +-Word32 L_abs(register Word32 L_var1) ++Word32 L_abs(Word32 L_var1) + { + /*---------------------------------------------------------------------------- + ; Define all local variables +diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/l_shr_r.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/l_shr_r.cpp +index 0a07135..ec120f0 100644 +--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/l_shr_r.cpp ++++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/l_shr_r.cpp +@@ -159,7 +159,7 @@ Word32 L_shr_r (Word32 L_var1, Word16 var2) + /*---------------------------------------------------------------------------- + ; FUNCTION CODE + ----------------------------------------------------------------------------*/ +-OSCL_EXPORT_REF Word32 L_shr_r(register Word32 L_var1, register Word16 var2, Flag *pOverflow) ++OSCL_EXPORT_REF Word32 L_shr_r(Word32 L_var1, Word16 var2, Flag *pOverflow) + { + Word32 result; + +diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/lsp_az.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/lsp_az.cpp +index c41f614..af1a716 100644 +--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/lsp_az.cpp ++++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/lsp_az.cpp +@@ -185,8 +185,8 @@ static void Get_lsp_pol( + Word32 *f, + Flag *pOverflow) + { +- register Word16 i; +- register Word16 j; ++ Word16 i; ++ Word16 j; + + Word16 hi; + Word16 lo; +@@ -332,8 +332,8 @@ OSCL_EXPORT_REF void Lsp_Az( + Flag *pOverflow /* (o) : overflow flag */ + ) + { +- register Word16 i; +- register Word16 j; ++ Word16 i; ++ Word16 j; + + Word32 f1[6]; + Word32 f2[6]; +diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/mult_r.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/mult_r.cpp +index 003afc7..a6b4a62 100644 +--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/mult_r.cpp ++++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/mult_r.cpp +@@ -155,7 +155,7 @@ Word16 mult_r (Word16 var1, Word16 var2) + OSCL_EXPORT_REF Word16 mult_r(Word16 var1, Word16 var2, Flag *pOverflow) + { + +- register Word32 L_product_arr; ++ Word32 L_product_arr; + + L_product_arr = ((Word32) var1) * var2; /* product */ + L_product_arr += (Word32) 0x00004000L; /* round */ +diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/negate.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/negate.cpp +index 3db2458..e16dca0 100644 +--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/negate.cpp ++++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/negate.cpp +@@ -128,7 +128,7 @@ Word16 negate (Word16 var1) + /*---------------------------------------------------------------------------- + ; FUNCTION CODE + ----------------------------------------------------------------------------*/ +-Word16 negate(register Word16 var1) ++Word16 negate(Word16 var1) + { + /*---------------------------------------------------------------------------- + ; Define all local variables +diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/norm_l.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/norm_l.cpp +index dc4ca72..fabbb44 100644 +--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/norm_l.cpp ++++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/norm_l.cpp +@@ -153,12 +153,12 @@ Word16 norm_l (Word32 L_var1) + ; FUNCTION CODE + ----------------------------------------------------------------------------*/ + #if !((PV_CPU_ARCH_VERSION >=5) && ((PV_COMPILER == EPV_ARM_GNUC) || (PV_COMPILER == EPV_ARM_RVCT))) +-OSCL_EXPORT_REF Word16 norm_l(register Word32 L_var1) ++OSCL_EXPORT_REF Word16 norm_l(Word32 L_var1) + { + /*---------------------------------------------------------------------------- + ; Define all local variables + ----------------------------------------------------------------------------*/ +- register Word16 var_out = 0; ++ Word16 var_out = 0; + + /*---------------------------------------------------------------------------- + ; Function body here +diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/norm_s.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/norm_s.cpp +index 4fdc6d2..66dfb65 100644 +--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/norm_s.cpp ++++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/norm_s.cpp +@@ -155,13 +155,13 @@ Word16 norm_s (Word16 var1) + ----------------------------------------------------------------------------*/ + #if !((PV_CPU_ARCH_VERSION >=5) && ((PV_COMPILER == EPV_ARM_GNUC) || (PV_COMPILER == EPV_ARM_RVCT))) + +-OSCL_EXPORT_REF Word16 norm_s(register Word16 var1) ++OSCL_EXPORT_REF Word16 norm_s(Word16 var1) + { + /*---------------------------------------------------------------------------- + ; Define all local variables + ----------------------------------------------------------------------------*/ + +- register Word16 var_out = 0; ++ Word16 var_out = 0; + + /*---------------------------------------------------------------------------- + ; Function body here +diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/pred_lt.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/pred_lt.cpp +index fd51242..abcfddc 100644 +--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/pred_lt.cpp ++++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/pred_lt.cpp +@@ -202,9 +202,9 @@ OSCL_EXPORT_REF void Pred_lt_3or6( + Flag *pOverflow /* output: if set, overflow occurred in this function */ + ) + { +- register Word16 i; +- register Word16 j; +- register Word16 k; ++ Word16 i; ++ Word16 j; ++ Word16 k; + + Word16 *pX0; + Word16 *pX2; +diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/q_plsf_3.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/q_plsf_3.cpp +index 2c5446b..adb3542 100644 +--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/q_plsf_3.cpp ++++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/q_plsf_3.cpp +@@ -216,7 +216,7 @@ static Word16 Vq_subvec4( /* o: quantization index, Q0 */ + Flag *pOverflow /* o : Flag set when overflow occurs */ + ) + { +- register Word16 i; ++ Word16 i; + Word16 temp; + const Word16 *p_dico; + Word16 index = 0; +@@ -510,7 +510,7 @@ static Word16 Vq_subvec3( /* o: quantization index, Q0 */ + Flag use_half, /* i: use every second entry in codebook */ + Flag *pOverflow) /* o : Flag set when overflow occurs */ + { +- register Word16 i; ++ Word16 i; + Word16 temp; + + const Word16 *p_dico; +@@ -884,7 +884,7 @@ OSCL_EXPORT_REF void Q_plsf_3( + Flag *pOverflow /* o : Flag set when overflow occurs */ + ) + { +- register Word16 i, j; ++ Word16 i, j; + Word16 lsf1[M]; + Word16 wf1[M]; + Word16 lsf_p[M]; +diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/residu.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/residu.cpp +index 787e043..3e8393e 100644 +--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/residu.cpp ++++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/residu.cpp +@@ -152,7 +152,7 @@ OSCL_EXPORT_REF void Residu( + { + + +- register Word16 i, j; ++ Word16 i, j; + Word32 s1; + Word32 s2; + Word32 s3; +diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/round.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/round.cpp +index 9fd4abb..b46a44e 100644 +--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/round.cpp ++++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/round.cpp +@@ -141,7 +141,7 @@ Word16 pv_round (Word32 L_var1) + /*---------------------------------------------------------------------------- + ; FUNCTION CODE + ----------------------------------------------------------------------------*/ +-OSCL_EXPORT_REF Word16 pv_round(register Word32 L_var1, Flag *pOverflow) ++OSCL_EXPORT_REF Word16 pv_round(Word32 L_var1, Flag *pOverflow) + { + Word16 result; + +diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/shr.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/shr.cpp +index a0fbd35..dabe1a8 100644 +--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/shr.cpp ++++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/shr.cpp +@@ -157,9 +157,9 @@ Word16 shr_std (Word16 var1, Word16 var2) + /*---------------------------------------------------------------------------- + ; FUNCTION CODE + ----------------------------------------------------------------------------*/ +-OSCL_EXPORT_REF Word16 shr(register Word16 var1, register Word16 var2, Flag *pOverflow) ++OSCL_EXPORT_REF Word16 shr(Word16 var1, Word16 var2, Flag *pOverflow) + { +- register Word16 result; ++ Word16 result; + + if (var2 != 0) + { +diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/shr_r.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/shr_r.cpp +index b403885..04ef9e6 100644 +--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/shr_r.cpp ++++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/shr_r.cpp +@@ -160,7 +160,7 @@ Word16 shr_r (Word16 var1, Word16 var2) + /*---------------------------------------------------------------------------- + ; FUNCTION CODE + ----------------------------------------------------------------------------*/ +-OSCL_EXPORT_REF Word16 shr_r(register Word16 var1, register Word16 var2, Flag *pOverflow) ++OSCL_EXPORT_REF Word16 shr_r(Word16 var1, Word16 var2, Flag *pOverflow) + { + /*---------------------------------------------------------------------------- + ; Define all local variables +diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/weight_a.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/weight_a.cpp +index 98382b8..04160d8 100644 +--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/weight_a.cpp ++++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/weight_a.cpp +@@ -137,7 +137,7 @@ OSCL_EXPORT_REF void Weight_Ai( + Word16 a_exp[] /* (o) : Spectral expanded LPC coefficients */ + ) + { +- register Word16 i; ++ Word16 i; + + *(a_exp) = *(a); + +diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d1035pf.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d1035pf.cpp +index d56b922..5f147bd 100644 +--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d1035pf.cpp ++++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d1035pf.cpp +@@ -177,7 +177,7 @@ void dec_10i40_35bits( + const Word16* dgray_ptr /* i : ptr to read-only tbl */ + ) + { +- register Word16 i, j, pos1, pos2; ++ Word16 i, j, pos1, pos2; + Word16 sign, tmp; + + for (i = 0; i < L_CODE; i++) +diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d_plsf_5.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d_plsf_5.cpp +index 8a4e763..9218c4b 100644 +--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d_plsf_5.cpp ++++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d_plsf_5.cpp +@@ -263,7 +263,7 @@ void D_plsf_5( + Flag *pOverflow /* o : Flag set when overflow occurs */ + ) + { +- register Word16 i; ++ Word16 i; + Word16 temp; + Word16 sign; + +diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/int_lsf.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/int_lsf.cpp +index e50eb6c..82844a1 100644 +--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/int_lsf.cpp ++++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/int_lsf.cpp +@@ -176,9 +176,9 @@ void Int_lsf( + Flag *pOverflow /* o : flag set if overflow occurs */ + ) + { +- register Word16 i; +- register Word16 temp1; +- register Word16 temp2; ++ Word16 i; ++ Word16 temp1; ++ Word16 temp2; + + if (i_subfr == 0) + { +diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/ph_disp.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/ph_disp.cpp +index 22fe3b5..b2d00ff 100644 +--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/ph_disp.cpp ++++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/ph_disp.cpp +@@ -147,7 +147,7 @@ int ph_disp_reset (ph_dispState *state) + + Word16 ph_disp_reset(ph_dispState *state) + { +- register Word16 i; ++ Word16 i; + + if (state == (ph_dispState *) NULL) + { +@@ -560,15 +560,15 @@ void ph_disp( + Flag *pOverflow /* i/o : oveflow indicator */ + ) + { +- register Word16 i, i1; +- register Word16 tmp1; ++ Word16 i, i1; ++ Word16 tmp1; + Word32 L_temp; + Word32 L_temp2; + Word16 impNr; /* indicator for amount of disp./filter used */ + + Word16 inno_sav[L_SUBFR]; + Word16 ps_poss[L_SUBFR]; +- register Word16 nze, nPulse; ++ Word16 nze, nPulse; + Word16 ppos; + const Word16 *ph_imp; /* Pointer to phase dispersion filter */ + +diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/pstfilt.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/pstfilt.cpp +index 479ded7..2bbb9e1 100644 +--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/pstfilt.cpp ++++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/pstfilt.cpp +@@ -376,10 +376,10 @@ void Post_Filter( + Word16 Ap4[MP1]; /* bandwidth expanded LP parameters */ + Word16 *Az; /* pointer to Az_4: */ + /* LPC parameters in each subframe */ +- register Word16 i_subfr; /* index for beginning of subframe */ ++ Word16 i_subfr; /* index for beginning of subframe */ + Word16 h[L_H]; + +- register Word16 i; ++ Word16 i; + Word16 temp1; + Word16 temp2; + Word32 L_tmp; +diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/autocorr.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/autocorr.cpp +index 033c93a..014a124 100644 +--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/autocorr.cpp ++++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/autocorr.cpp +@@ -224,9 +224,9 @@ Word16 Autocorr( + Flag *pOverflow /* (o) : indicates overflow */ + ) + { +- register Word16 i; +- register Word16 j; +- register Word16 norm; ++ Word16 i; ++ Word16 j; ++ Word16 norm; + + Word16 y[L_WINDOW]; + Word32 sum; +diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c2_9pf.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c2_9pf.cpp +index 052a53f..2bcb7b8 100644 +--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c2_9pf.cpp ++++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c2_9pf.cpp +@@ -267,7 +267,7 @@ extern "C" + Word16 dn_sign[L_CODE]; + Word16 rr[L_CODE][L_CODE]; + +- register Word16 i; ++ Word16 i; + + Word16 index; + Word16 sharp; +@@ -527,10 +527,10 @@ extern "C" + Flag * pOverflow /* o : Flag set when overflow occurs */ + ) + { +- register Word16 i0; +- register Word16 i1; ++ Word16 i0; ++ Word16 i1; + Word16 ix = 0; /* initialization only needed to keep gcc silent */ +- register Word16 track1; ++ Word16 track1; + Word16 ipos[NB_PULSE]; + Word16 psk; + Word16 ps0; +@@ -543,7 +543,7 @@ extern "C" + Word32 s; + Word32 alp0; + Word32 alp1; +- register Word16 i; ++ Word16 i; + Word32 L_temp; + Word16 *p_codvec = &codvec[0]; + +@@ -898,13 +898,13 @@ extern "C" + Flag *pOverflow /* o : Flag set when overflow occurs */ + ) + { +- register Word16 i; +- register Word16 j; +- register Word16 k; +- register Word16 track; +- register Word16 first; +- register Word16 index; +- register Word16 rsign; ++ Word16 i; ++ Word16 j; ++ Word16 k; ++ Word16 track; ++ Word16 first; ++ Word16 index; ++ Word16 rsign; + Word16 indx; + Word16 _sign[NB_PULSE]; + Word16 *p0; +diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cl_ltp.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cl_ltp.cpp +index 50eb6b9..2b49af2 100644 +--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cl_ltp.cpp ++++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cl_ltp.cpp +@@ -545,7 +545,7 @@ void cl_ltp( + Flag *pOverflow /* o : overflow indicator */ + ) + { +- register Word16 i; ++ Word16 i; + Word16 index; + Word32 L_temp; /* temporarily variable */ + Word16 resu3; /* flag for upsample resolution */ +diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/convolve.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/convolve.cpp +index e1471d6..c059532 100644 +--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/convolve.cpp ++++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/convolve.cpp +@@ -155,7 +155,7 @@ void Convolve( + Word16 L /* (i) : vector size */ + ) + { +- register Word16 i, n; ++ Word16 i, n; + Word32 s1, s2; + + +diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h.cpp +index 32fbdd1..1b2f3d4 100644 +--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h.cpp ++++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h.cpp +@@ -193,8 +193,8 @@ void cor_h( + Flag *pOverflow + ) + { +- register Word16 i; +- register Word16 dec; ++ Word16 i; ++ Word16 dec; + + Word16 h2[L_CODE]; + Word32 s; +diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h_x.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h_x.cpp +index 7bb54bb..492e4b8 100644 +--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h_x.cpp ++++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h_x.cpp +@@ -202,9 +202,9 @@ void cor_h_x( + Flag *pOverflow /* (o): pointer to overflow flag */ + ) + { +- register Word16 i; +- register Word16 j; +- register Word16 k; ++ Word16 i; ++ Word16 j; ++ Word16 k; + + Word32 s; + Word32 y32[L_CODE]; +diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h_x2.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h_x2.cpp +index 9d72ab3..fc126b2 100644 +--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h_x2.cpp ++++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h_x2.cpp +@@ -194,9 +194,9 @@ void cor_h_x2( + Flag *pOverflow + ) + { +- register Word16 i; +- register Word16 j; +- register Word16 k; ++ Word16 i; ++ Word16 j; ++ Word16 k; + Word32 s; + Word32 y32[L_CODE]; + Word32 max; +diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/dtx_enc.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/dtx_enc.cpp +index f4f25f9..202ba2d 100644 +--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/dtx_enc.cpp ++++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/dtx_enc.cpp +@@ -67,7 +67,7 @@ terms listed above has been obtained from the copyright holder. + ; MACROS + ; Define module specific macros here + ----------------------------------------------------------------------------*/ +-extern Word32 L_add(register Word32 L_var1, register Word32 L_var2, Flag *pOverflow); ++extern Word32 L_add(Word32 L_var1, Word32 L_var2, Flag *pOverflow); + + /*---------------------------------------------------------------------------- + ; DEFINES +@@ -544,7 +544,7 @@ void dtx_enc(dtx_encState *st, /* i/o : State struct */ + Flag *pOverflow /* i/o : overflow indicator */ + ) + { +- register Word16 i, j; ++ Word16 i, j; + Word16 temp; + Word16 log_en; + Word16 lsf[M]; +@@ -800,7 +800,7 @@ void dtx_buffer(dtx_encState *st, /* i/o : State struct */ + ) + { + +- register Word16 i; ++ Word16 i; + Word32 L_frame_en; + Word32 L_temp; + Word16 log_en_e; +diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/l_negate.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/l_negate.cpp +index 9699095..01b9dca 100644 +--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/l_negate.cpp ++++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/l_negate.cpp +@@ -125,7 +125,7 @@ Word32 L_negate (Word32 L_var1) + /*---------------------------------------------------------------------------- + ; FUNCTION CODE + ----------------------------------------------------------------------------*/ +-Word32 L_negate(register Word32 L_var1) ++Word32 L_negate(Word32 L_var1) + { + /*---------------------------------------------------------------------------- + ; Define all local variables +diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/levinson.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/levinson.cpp +index cbd27d7..c138e5d 100644 +--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/levinson.cpp ++++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/levinson.cpp +@@ -573,8 +573,8 @@ Word16 Levinson( + Flag *pOverflow + ) + { +- register Word16 i; +- register Word16 j; ++ Word16 i; ++ Word16 j; + Word16 hi; + Word16 lo; + Word16 Kh; /* reflexion coefficient; hi and lo */ +@@ -586,9 +586,9 @@ Word16 Levinson( + Word16 Al[M + 1]; + Word16 Anh[M + 1]; /* LPC coef.for next iteration in */ + Word16 Anl[M + 1]; /* double prec. */ +- register Word32 t0; /* temporary variable */ +- register Word32 t1; /* temporary variable */ +- register Word32 t2; /* temporary variable */ ++ Word32 t0; /* temporary variable */ ++ Word32 t1; /* temporary variable */ ++ Word32 t2; /* temporary variable */ + + Word16 *p_Rh; + Word16 *p_Rl; +diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pitch_ol.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pitch_ol.cpp +index d8efa1e..1d0ff1e 100644 +--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pitch_ol.cpp ++++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pitch_ol.cpp +@@ -303,7 +303,7 @@ static Word16 Lag_max( /* o : lag found */ + ) + #endif + { +- register Word16 i; ++ Word16 i; + Word16 *p; + Word32 max; + Word32 t0; +diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pre_proc.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pre_proc.cpp +index 93d23b5..4108f3f 100644 +--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pre_proc.cpp ++++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pre_proc.cpp +@@ -436,7 +436,7 @@ void Pre_Process( + Word16 signal[], /* input/output signal */ + Word16 lg) /* length of signal */ + { +- register Word16 i; ++ Word16 i; + Word16 x_n_2; + Word16 x_n_1; + Word32 L_tmp; +diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/set_sign.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/set_sign.cpp +index f759901..f25b062 100644 +--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/set_sign.cpp ++++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/set_sign.cpp +@@ -194,7 +194,7 @@ void set_sign(Word16 dn[], /* i/o : correlation between target and h[] */ + Word16 n /* i : # of maximum correlations in dn2[] */ + ) + { +- register Word16 i, j, k; ++ Word16 i, j, k; + Word16 val, min; + Word16 pos = 0; /* initialization only needed to keep gcc silent */ + +diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/normalize_amr_wb.h b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/normalize_amr_wb.h +index 73ccb71..5132d7d 100644 +--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/normalize_amr_wb.h ++++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/normalize_amr_wb.h +@@ -66,8 +66,8 @@ terms listed above has been obtained from the copyright holder. + + __inline int16 normalize_amr_wb(int32 x) + { +- register int32 y; +- register int32 ra = x; ++ int32 y; ++ int32 ra = x; + + + asm volatile( +diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwb_math_op.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwb_math_op.cpp +index d1ec790..5872512 100644 +--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwb_math_op.cpp ++++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwb_math_op.cpp +@@ -205,7 +205,7 @@ int16 div_16by16(int16 var1, int16 var2) + { + + int16 var_out = 0; +- register int16 iteration; ++ int16 iteration; + int32 L_num; + int32 L_denom; + int32 L_denom_by_2; +diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_gcc_armv5.h b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_gcc_armv5.h +index c2c9f36..e9ddbf1 100644 +--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_gcc_armv5.h ++++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_gcc_armv5.h +@@ -51,10 +51,10 @@ extern "C" + + static inline int16 sub_int16(int16 var1, int16 var2) + { +- register int32 L_var_out; +- register int32 L_var_aux; +- register int32 ra = (int32)var1; +- register int32 rb = (int32)var2; ++ int32 L_var_out; ++ int32 L_var_aux; ++ int32 ra = (int32)var1; ++ int32 rb = (int32)var2; + + asm volatile( + "mov %0, %2, lsl #16\n" +@@ -72,10 +72,10 @@ extern "C" + + static inline int16 add_int16(int16 var1, int16 var2) + { +- register int32 L_var_out; +- register int32 L_var_aux; +- register int32 ra = (int32)var1; +- register int32 rb = (int32)var2; ++ int32 L_var_out; ++ int32 L_var_aux; ++ int32 ra = (int32)var1; ++ int32 rb = (int32)var2; + + asm volatile( + "mov %0, %2, lsl #16\n" +@@ -93,11 +93,11 @@ extern "C" + + static inline int32 mul_32by16(int16 hi, int16 lo, int16 n) + { +- register int32 H_32; +- register int32 L_32; +- register int32 ra = (int32)hi; +- register int32 rb = (int32)lo; +- register int32 rc = (int32)n; ++ int32 H_32; ++ int32 L_32; ++ int32 ra = (int32)hi; ++ int32 rb = (int32)lo; ++ int32 rc = (int32)n; + + + asm volatile( +@@ -117,9 +117,9 @@ extern "C" + + static inline int32 sub_int32(int32 L_var1, int32 L_var2) + { +- register int32 L_var_out; +- register int32 ra = L_var1; +- register int32 rb = L_var2; ++ int32 L_var_out; ++ int32 ra = L_var1; ++ int32 rb = L_var2; + + asm volatile( + "qsub %0, %1, %2" +@@ -132,9 +132,9 @@ extern "C" + + static inline int32 add_int32(int32 L_var1, int32 L_var2) + { +- register int32 L_var_out; +- register int32 ra = L_var1; +- register int32 rb = L_var2; ++ int32 L_var_out; ++ int32 ra = L_var1; ++ int32 rb = L_var2; + + asm volatile( + "qadd %0, %1, %2" +@@ -147,10 +147,10 @@ extern "C" + + static inline int32 msu_16by16_from_int32(int32 L_var3, int16 var1, int16 var2) + { +- register int32 L_var_out; +- register int32 ra = (int32)var1; +- register int32 rb = (int32)var2; +- register int32 rc = L_var3; ++ int32 L_var_out; ++ int32 ra = (int32)var1; ++ int32 rb = (int32)var2; ++ int32 rc = L_var3; + + asm volatile( + "smulbb %0, %1, %2\n" +@@ -166,10 +166,10 @@ extern "C" + + static inline int32 mac_16by16_to_int32(int32 L_var3, int16 var1, int16 var2) + { +- register int32 L_var_out; +- register int32 ra = (int32)var1; +- register int32 rb = (int32)var2; +- register int32 rc = L_var3; ++ int32 L_var_out; ++ int32 ra = (int32)var1; ++ int32 rb = (int32)var2; ++ int32 rc = L_var3; + + asm volatile( + "smulbb %0, %1, %2\n" +@@ -185,9 +185,9 @@ extern "C" + + static inline int32 mul_16by16_to_int32(int16 var1, int16 var2) + { +- register int32 L_var_out; +- register int32 ra = (int32)var1; +- register int32 rb = (int32)var2; ++ int32 L_var_out; ++ int32 ra = (int32)var1; ++ int32 rb = (int32)var2; + + asm volatile( + "smulbb %0, %1, %2\n" +@@ -202,9 +202,9 @@ extern "C" + + static inline int16 mult_int16(int16 var1, int16 var2) + { +- register int32 L_var_out; +- register int32 ra = (int32)var1; +- register int32 rb = (int32)var2; ++ int32 L_var_out; ++ int32 ra = (int32)var1; ++ int32 rb = (int32)var2; + + asm volatile( + "smulbb %0, %1, %2\n" +@@ -218,9 +218,9 @@ extern "C" + + static inline int16 amr_wb_round(int32 L_var1) + { +- register int32 L_var_out; +- register int32 ra = (int32)L_var1; +- register int32 rb = (int32)0x00008000L; ++ int32 L_var_out; ++ int32 ra = (int32)L_var1; ++ int32 rb = (int32)0x00008000L; + + asm volatile( + "qadd %0, %1, %2\n" +@@ -233,9 +233,9 @@ extern "C" + + static inline int16 amr_wb_shl1_round(int32 L_var1) + { +- register int32 L_var_out; +- register int32 ra = (int32)L_var1; +- register int32 rb = (int32)0x00008000L; ++ int32 L_var_out; ++ int32 ra = (int32)L_var1; ++ int32 rb = (int32)0x00008000L; + + asm volatile( + "qadd %0, %1, %1\n" +@@ -250,10 +250,10 @@ extern "C" + + static inline int32 fxp_mac_16by16(const int16 L_var1, const int16 L_var2, int32 L_add) + { +- register int32 tmp; +- register int32 ra = (int32)L_var1; +- register int32 rb = (int32)L_var2; +- register int32 rc = (int32)L_add; ++ int32 tmp; ++ int32 ra = (int32)L_var1; ++ int32 rb = (int32)L_var2; ++ int32 rc = (int32)L_add; + + asm volatile( + "smlabb %0, %1, %2, %3" +@@ -266,9 +266,9 @@ extern "C" + + static inline int32 fxp_mul_16by16bb(int16 L_var1, const int16 L_var2) + { +- register int32 tmp; +- register int32 ra = (int32)L_var1; +- register int32 rb = (int32)L_var2; ++ int32 tmp; ++ int32 ra = (int32)L_var1; ++ int32 rb = (int32)L_var2; + + asm volatile( + "smulbb %0, %1, %2" +@@ -284,9 +284,9 @@ extern "C" + + static inline int32 fxp_mul32_by_16(int32 L_var1, const int32 L_var2) + { +- register int32 tmp; +- register int32 ra = (int32)L_var1; +- register int32 rb = (int32)L_var2; ++ int32 tmp; ++ int32 ra = (int32)L_var1; ++ int32 rb = (int32)L_var2; + + asm volatile( + "smulwb %0, %1, %2" +-- +2.41.0 + diff --git a/recipes/opencore-amr/all/test_package/CMakeLists.txt b/recipes/opencore-amr/all/test_package/CMakeLists.txt index f8165a7ba4d2f..b4b3b8c570e31 100644 --- a/recipes/opencore-amr/all/test_package/CMakeLists.txt +++ b/recipes/opencore-amr/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.15) +project(test_package LANGUAGES CXX) find_package(opencore-amr REQUIRED) @@ -10,4 +7,4 @@ add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE opencore-amr::opencore-amrnb opencore-amr::opencore-amrwb - ) +) diff --git a/recipes/opencore-amr/all/test_package/conanfile.py b/recipes/opencore-amr/all/test_package/conanfile.py index e16563695d6b4..e730ad6dc0dfc 100644 --- a/recipes/opencore-amr/all/test_package/conanfile.py +++ b/recipes/opencore-amr/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", "arch", "build_type" - 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) @@ -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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/opencore-amr/all/test_v1_package/CMakeLists.txt b/recipes/opencore-amr/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/opencore-amr/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/opencore-amr/all/test_v1_package/conanfile.py b/recipes/opencore-amr/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..e16563695d6b4 --- /dev/null +++ b/recipes/opencore-amr/all/test_v1_package/conanfile.py @@ -0,0 +1,16 @@ +from conans import ConanFile, CMake, tools +import os + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "arch", "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/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..a256803f12717 100644 --- a/recipes/opencv/2.x/conanfile.py +++ b/recipes/opencv/2.x/conanfile.py @@ -1,11 +1,43 @@ -from conan.tools.microsoft import msvc_runtime_flag -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.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 +from conan.tools.scm import Version +import sys 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" @@ -14,333 +46,625 @@ class OpenCVConan(ConanFile): description = "OpenCV (Open Source Computer Vision Library)" url = "https://github.com/conan-io/conan-center-index" topics = ("computer-vision", "deep-learning", "image-processing") - + package_type = "library" settings = "os", "arch", "compiler", "build_type" 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.11 <2]") if self.options.with_eigen: self.requires("eigen/3.4.0") if self.options.with_tbb: - self.requires("onetbb/2020.3") + # opencv 2.x doesn't support onetbb >= 2021 + self.requires("onetbb/2020.3.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/3.0.0") + elif self.options.get_safe("with_jpeg") == "mozjpeg": + self.requires("mozjpeg/4.1.3") + if self.options.get_safe("with_png"): + self.requires("libpng/1.6.40") + 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.6.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." + ) + # FIXME: check_max_cppstd is only available for Conan 2.x. Remove it after dropping support for Conan 1.x + if conan_version.major == 2: + # FIXME: linter complains, but function is there + # https://docs.conan.io/2.0/reference/tools/build.html?highlight=check_min_cppstd#conan-tools-build-check-max-cppstd + check_max_cppstd = getattr(sys.modules['conan.tools.build'], 'check_max_cppstd') + # INFO: OpenCV 2.x uses std::random_shuffle and mem_fun_ref. Both removed in C++17. + check_max_cppstd(self, 14) 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) + + self._create_cmake_module_variables(os.path.join(self.package_folder, self._module_vars_rel_path)) # 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} + os.path.join(self.package_folder, self._module_target_rel_path), + targets_mapping, ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_variables(self, module_file): + """ + Define several CMake variables from upstream CMake config file not defined by default by CMakeDeps. + See https://github.com/opencv/opencv/blob/2.4.13.7/cmake/templates/OpenCVConfig.cmake.in + """ + v = Version(self.version) + content = textwrap.dedent(f"""\ + if(NOT DEFINED OpenCV_LIBS) + set(OpenCV_LIBS opencv::opencv) + endif() + if(NOT DEFINED OpenCV_VERSION_MAJOR) + set(OpenCV_VERSION_MAJOR {v.major}) + endif() + if(NOT DEFINED OpenCV_VERSION_MINOR) + set(OpenCV_VERSION_MINOR {v.minor}) + endif() + if(NOT DEFINED OpenCV_VERSION_PATCH) + set(OpenCV_VERSION_PATCH {v.patch}) + endif() + """) + save(self, module_file, content) + + 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)) + def _module_vars_rel_path(self): + return os.path.join("lib", "cmake", f"conan-official-{self.name}-variables.cmake") @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 + def _module_target_rel_path(self): + 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: + self.cpp_info.components[conan_component].build_modules["cmake_find_package"] = [self._module_vars_rel_path, self._module_target_rel_path] + self.cpp_info.components[conan_component].build_modules["cmake_find_package_multi"] = [self._module_vars_rel_path, self._module_target_rel_path] + 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_vars_rel_path, self._module_target_rel_path] + self.cpp_info.components["opencv_world"].build_modules["cmake_find_package_multi"] = [self._module_vars_rel_path, self._module_target_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") + self.cpp_info.set_property("cmake_build_modules", [self._module_vars_rel_path]) + + 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..147afc1ea676d 100644 --- a/recipes/opencv/3.x/conandata.yml +++ b/recipes/opencv/3.x/conandata.yml @@ -1,11 +1,20 @@ sources: + "3.4.20": + - url: "https://github.com/opencv/opencv/archive/refs/tags/3.4.20.tar.gz" + sha256: "b9eda448a08ba7b10bfd5bd45697056569ebdf7a02070947e1c1f3e8e69280cd" + - url: "https://github.com/opencv/opencv_contrib/archive/refs/tags/3.4.20.tar.gz" + sha256: "b0bb3fa7ae4ac00926b83d4d95c6500c2f7af542f8ec78d0f01b2961a690d5dc" "3.4.17": - url: "https://github.com/opencv/opencv/archive/refs/tags/3.4.17.tar.gz" sha256: "1353eec67849aadb20df71d8bae18b83708e18fc5da080fe5efeabb1e99b2ee8" - url: "https://github.com/opencv/opencv_contrib/archive/refs/tags/3.4.17.tar.gz" sha256: "2b4d3e91a5767a1ae4f4e2a71b0a93c9ec744755763653a650e40ace8f7b9a1b" - "3.4.12": - - url: "https://github.com/opencv/opencv/archive/3.4.12.tar.gz" - sha256: "c8919dfb5ead6be67534bf794cb0925534311f1cd5c6680f8164ad1813c88d13" - - url: "https://github.com/opencv/opencv_contrib/archive/3.4.12.tar.gz" - sha256: "b207024589674dd2efc7c25740ef192ee4f3e0783e773e2d49a198c37e3e7570" +patches: + "3.4.20": + - patch_file: "patches/3.4.17-0001-find-openexr.patch" + patch_description: "Robust discovery & injection of OpenEXR" + patch_type: "conan" + "3.4.17": + - patch_file: "patches/3.4.17-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..94f59dc50fb8e 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): @@ -14,14 +17,14 @@ class OpenCVConan(ConanFile): description = "OpenCV (Open Source Computer Vision Library)" url = "https://github.com/conan-io/conan-center-index" topics = ("computer-vision", "deep-learning", "image-processing") - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "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,250 +67,260 @@ 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.11 <2]") 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/3.0.0") + elif self.options.with_jpeg == "mozjpeg": + self.requires("mozjpeg/4.1.3") if self.options.with_png: - self.requires("libpng/1.6.37") + self.requires("libpng/1.6.40") 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.6.0") if self.options.with_eigen: - self.requires("eigen/3.3.9") + self.requires("eigen/3.4.0") if self.options.parallel == "tbb": - self.requires("onetbb/2020.3") + # opencv 3.x doesn't support onetbb >= 2021 + self.requires("onetbb/2020.3.3") if self.options.with_webp: - self.requires("libwebp/1.2.2") + self.requires("libwebp/1.3.2") if self.options.contrib: - self.requires("freetype/2.11.1") - self.requires("harfbuzz/3.2.0") + self.requires("freetype/2.13.0") + self.requires("harfbuzz/8.2.2") 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") - 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)", "") - - if self.options.contrib and tools.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, """{} - 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 + replace_in_file(self, install_layout_file, "set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)", "") + + 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') + 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() - 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 - - 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")) + + self._create_cmake_module_variables(os.path.join(self.package_folder, self._module_vars_rel_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._module_file_rel_path), + os.path.join(self.package_folder, self._module_target_rel_path), {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_variables(self, module_file): + """ + Define several CMake variables from upstream CMake config file not defined by default by CMakeDeps. + See https://github.com/opencv/opencv/blob/3.4.20/cmake/templates/OpenCVConfig.cmake.in + """ + v = Version(self.version) + content = textwrap.dedent(f"""\ + if(NOT DEFINED OpenCV_LIBS) + set(OpenCV_LIBS opencv::opencv) + endif() + if(NOT DEFINED OpenCV_VERSION_MAJOR) + set(OpenCV_VERSION_MAJOR {v.major}) + endif() + if(NOT DEFINED OpenCV_VERSION_MINOR) + set(OpenCV_VERSION_MINOR {v.minor}) + endif() + if(NOT DEFINED OpenCV_VERSION_PATCH) + set(OpenCV_VERSION_PATCH {v.patch}) + endif() + """) + save(self, module_file, content) + + 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_vars_rel_path(self): + return os.path.join("lib", "cmake", f"conan-official-{self.name}-variables.cmake") @property - def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + def _module_target_rel_path(self): + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") @property def _opencv_components(self): @@ -329,8 +330,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 +418,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,33 +439,32 @@ 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 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] + self.cpp_info.components[conan_component].build_modules["cmake_find_package"] = [self._module_vars_rel_path, self._module_target_rel_path] + self.cpp_info.components[conan_component].build_modules["cmake_find_package_multi"] = [self._module_vars_rel_path, self._module_target_rel_path] if cmake_component != 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].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") + self.cpp_info.set_property("cmake_build_modules", [self._module_vars_rel_path]) add_components(self._opencv_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.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..8c1ffb58a9492 100644 --- a/recipes/opencv/4.x/conandata.yml +++ b/recipes/opencv/4.x/conandata.yml @@ -1,37 +1,207 @@ sources: + "4.10.0": + - url: "https://github.com/opencv/opencv/archive/refs/tags/4.10.0.tar.gz" + sha256: "b2171af5be6b26f7a06b1229948bbb2bdaa74fcf5cd097e0af6378fce50a6eb9" + - url: "https://github.com/opencv/opencv_contrib/archive/refs/tags/4.10.0.tar.gz" + sha256: "65597f8fb8dc2b876c1b45b928bbcc5f772ddbaf97539bf1b737623d0604cba1" + "4.9.0": + - url: "https://github.com/opencv/opencv/archive/refs/tags/4.9.0.tar.gz" + sha256: "ddf76f9dffd322c7c3cb1f721d0887f62d747b82059342213138dc190f28bc6c" + - url: "https://github.com/opencv/opencv_contrib/archive/refs/tags/4.9.0.tar.gz" + sha256: "8952c45a73b75676c522dd574229f563e43c271ae1d5bbbd26f8e2b6bc1a4dae" + "4.8.1": + - url: "https://github.com/opencv/opencv/archive/refs/tags/4.8.1.tar.gz" + sha256: "62f650467a60a38794d681ae7e66e3e8cfba38f445e0bf87867e2f2cdc8be9d5" + - url: "https://github.com/opencv/opencv_contrib/archive/refs/tags/4.8.1.tar.gz" + sha256: "0c082a0b29b3118f2a0a1856b403bb098643af7b994a0080f402a12159a99c6e" "4.5.5": - url: "https://github.com/opencv/opencv/archive/refs/tags/4.5.5.tar.gz" sha256: "a1cfdcf6619387ca9e232687504da996aaa9f7b5689986b8331ec02cb61d28ad" - url: "https://github.com/opencv/opencv_contrib/archive/refs/tags/4.5.5.tar.gz" sha256: "a97c2eaecf7a23c6dbd119a609c6d7fae903e5f9ff5f1fe678933e01c67a6c11" "4.5.3": - - url: "https://github.com/opencv/opencv/archive/4.5.3.tar.gz" + - url: "https://github.com/opencv/opencv/archive/refs/tags/4.5.3.tar.gz" sha256: "77f616ae4bea416674d8c373984b20c8bd55e7db887fd38c6df73463a0647bab" - - url: "https://github.com/opencv/opencv_contrib/archive/4.5.3.tar.gz" + - url: "https://github.com/opencv/opencv_contrib/archive/refs/tags/4.5.3.tar.gz" sha256: "73da052fd10e73aaba2560eaff10cc5177e2dcc58b27f8aedf7c649e24c233bc" - "4.5.2": - - url: "https://github.com/opencv/opencv/archive/4.5.2.tar.gz" - sha256: "ae258ed50aa039279c3d36afdea5c6ecf762515836b27871a8957c610d0424f8" - - url: "https://github.com/opencv/opencv_contrib/archive/4.5.2.tar.gz" - sha256: "9f52fd3114ac464cb4c9a2a6a485c729a223afb57b9c24848484e55cef0b5c2a" - "4.5.1": - - url: "https://github.com/opencv/opencv/archive/4.5.1.tar.gz" - sha256: "e27fe5b168918ab60d58d7ace2bd82dd14a4d0bd1d3ae182952c2113f5637513" - - url: "https://github.com/opencv/opencv_contrib/archive/4.5.1.tar.gz" - sha256: "12c3b1ddd0b8c1a7da5b743590a288df0934e5cef243e036ca290c2e45e425f5" - "4.5.0": - - url: "https://github.com/opencv/opencv/archive/4.5.0.tar.gz" - sha256: "dde4bf8d6639a5d3fe34d5515eab4a15669ded609a1d622350c7ff20dace1907" - - url: "https://github.com/opencv/opencv_contrib/archive/4.5.0.tar.gz" - sha256: "a65f1f0b98b2c720abbf122c502044d11f427a43212d85d8d2402d7a6339edda" "4.1.2": - - url: "https://github.com/opencv/opencv/archive/4.1.2.tar.gz" + - url: "https://github.com/opencv/opencv/archive/refs/tags/4.1.2.tar.gz" sha256: "385dd0a9c25e67ef0dd60e022d2a2d7b17e2f36819cf3cb46aa8cdff5c5282c9" - - url: "https://github.com/opencv/opencv_contrib/archive/4.1.2.tar.gz" + - url: "https://github.com/opencv/opencv_contrib/archive/refs/tags/4.1.2.tar.gz" sha256: "0f6c3d30baa39e3e7611afb481ee86dea45dafb182cac87d570c95dccd83eb8b" patches: + "4.10.0": + - 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.5-0003-find-quirc.patch" + patch_description: "Robust discovery & injection of quirc" + patch_type: "conan" + - patch_file: "patches/4.8.1-0001-find-ade.patch" + patch_description: "Robust discovery & injection of ade" + patch_type: "conan" + - patch_file: "patches/4.5.1-0001-tracking-no-plot-deps.patch" + patch_description: "Fix requirements of tracking module" + patch_type: "conan" + - patch_file: "patches/4.1.2-0006-hdf.patch" + patch_description: "Robust discovery of hdf" + patch_type: "conan" + - patch_file: "patches/4.10.0-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.9.0": + - 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.5-0003-find-quirc.patch" + patch_description: "Robust discovery & injection of quirc" + patch_type: "conan" + - patch_file: "patches/4.8.1-0001-find-ade.patch" + patch_description: "Robust discovery & injection of ade" + patch_type: "conan" + - patch_file: "patches/4.5.1-0001-tracking-no-plot-deps.patch" + patch_description: "Fix requirements of tracking module" + patch_type: "conan" + - patch_file: "patches/4.1.2-0006-hdf.patch" + patch_description: "Robust discovery of hdf" + 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.8.1": + - 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.5-0003-find-quirc.patch" + patch_description: "Robust discovery & injection of quirc" + patch_type: "conan" + - patch_file: "patches/4.8.1-0004-link-qt-targets.patch" + patch_description: "Link to Qt through CMake targets" + patch_type: "conan" + - patch_file: "patches/4.8.1-0001-find-ade.patch" + patch_description: "Robust discovery & injection of ade" + patch_type: "conan" + - patch_file: "patches/4.5.1-0001-tracking-no-plot-deps.patch" + patch_description: "Fix requirements of tracking module" + patch_type: "conan" + - patch_file: "patches/4.1.2-0006-hdf.patch" + patch_description: "Robust discovery of hdf" + 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" + - patch_file: "patches/4.8.1-0002-mingw-disable-obsensor.patch" + patch_description: "MinGW: disable obsensor to avoid build issue" + patch_type: "portability" + patch_source: "https://github.com/opencv/opencv/pull/24478" + "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.5-0002-objdetect-without-dnn.patch" + patch_description: "Allow to build objdetect module without dnn" + patch_type: "portability" + patch_source: "https://github.com/opencv/opencv/pull/21369" + - patch_file: "patches/4.5.5-0003-find-quirc.patch" + patch_description: "Robust discovery & injection of quirc" + patch_type: "conan" + - patch_file: "patches/4.5.5-0004-link-qt-targets.patch" + patch_description: "Link to Qt through CMake targets" + 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.5.1-0001-tracking-no-plot-deps.patch" + patch_description: "Fix requirements of tracking module" + patch_type: "conan" + - patch_file: "patches/4.5.1-0002-alphamat-header.patch" + patch_description: "Add missing header in alphamat.hpp" + patch_type: "portability" + patch_source: "https://github.com/opencv/opencv_contrib/pull/3422" + - patch_file: "patches/4.1.2-0006-hdf.patch" + patch_description: "Robust discovery of hdf" + 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.3-0002-link-qt-targets.patch" + patch_description: "Link to Qt through CMake targets" + 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.1-0001-tracking-no-plot-deps.patch" + patch_description: "Fix requirements of tracking module" + patch_type: "conan" + - patch_file: "patches/4.5.1-0002-alphamat-header.patch" + patch_description: "Add missing header in alphamat.hpp" + patch_type: "portability" + patch_source: "https://github.com/opencv/opencv_contrib/pull/3422" + - patch_file: "patches/4.1.2-0006-hdf.patch" + patch_description: "Robust discovery of hdf" + 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" + - patch_file: "patches/4.1.2-0010-compat-protobuf-ge-3.18.patch" + patch_description: "Compatibility with protobuf >= 3.18" + patch_type: "portability" + patch_source: "https://github.com/opencv/opencv/pull/20386" "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-0005-tracking-no-plot-deps.patch" + patch_description: "Fix requirements of tracking module" + patch_type: "conan" + - patch_file: "patches/4.1.2-0006-hdf.patch" + patch_description: "Robust discovery of hdf" + 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" + - patch_file: "patches/4.1.2-0008-link-qt-targets.patch" + patch_description: "Link to Qt through CMake targets" + patch_type: "conan" + - patch_file: "patches/4.1.2-0009-sfm-deps.patch" + patch_description: "Fix link to dependencies of sfm module" + patch_type: "conan" + - patch_file: "patches/4.1.2-0010-compat-protobuf-ge-3.18.patch" + patch_description: "Compatibility with protobuf >= 3.18" + patch_type: "portability" + patch_source: "https://github.com/opencv/opencv/pull/20386" + - patch_file: "patches/4.1.2-0011-compat-openexr3.patch" + patch_description: "Compatibility with OpenEXR 3.x" + patch_type: "portability" + patch_source: "https://github.com/opencv/opencv/pull/19970" diff --git a/recipes/opencv/4.x/conanfile.py b/recipes/opencv/4.x/conanfile.py index dc6c82ea44df3..491ff108378e7 100644 --- a/recipes/opencv/4.x/conanfile.py +++ b/recipes/opencv/4.x/conanfile.py @@ -1,11 +1,94 @@ +from conan import ConanFile +from conan.errors import ConanException, 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.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.gnu import PkgConfigDeps 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 os +import re import textwrap -required_conan_version = ">=1.43.0" - +required_conan_version = ">=1.60.0 <2.0 || >=2.0.5" + + +OPENCV_MAIN_MODULES_OPTIONS = ( + "calib3d", + "dnn", + "features2d", + "flann", + "gapi", + "highgui", + "imgcodecs", + "imgproc", + "ml", + "objdetect", + "photo", + "stitching", + "video", + "videoio", +) + +OPENCV_EXTRA_MODULES_OPTIONS = ( + "alphamat", + "aruco", + "barcode", + "bgsegm", + "bioinspired", + "ccalib", + "cudaarithm", + "cudabgsegm", + "cudacodec", + "cudafeatures2d", + "cudafilters", + "cudaimgproc", + "cudalegacy", + "cudaobjdetect", + "cudaoptflow", + "cudastereo", + "cudawarping", + "cvv", + "datasets", + "dnn_objdetect", + "dnn_superres", + "dpm", + "face", + "freetype", + "fuzzy", + "hdf", + "hfs", + "img_hash", + "intensity_transform", + "line_descriptor", + "mcc", + "optflow", + "ovis", + "phase_unwrapping", + "plot", + "quality", + "rapid", + "reg", + "rgbd", + "saliency", + "sfm", + "shape", + "stereo", + "structured_light", + "superres", + "surface_matching", + "text", + "tracking", + "videostab", + "viz", + "wechat_qrcode", + "xfeatures2d", + "ximgproc", + "xobjdetect", + "xphoto", +) class OpenCVConan(ConanFile): name = "opencv" @@ -15,99 +98,151 @@ class OpenCVConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" topics = ("computer-vision", "deep-learning", "image-processing") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], - "contrib": [True, False], - "contrib_freetype": [True, False], - "contrib_sfm": [True, False], + # global options "parallel": [False, "tbb", "openmp"], "with_ipp": [False, "intel-ipp", "opencv-icv"], - "with_ade": [True, False], - "with_jpeg": [False, "libjpeg", "libjpeg-turbo"], - "with_png": [True, False], - "with_tiff": [True, False], - "with_jpeg2000": [False, "jasper", "openjpeg"], - "with_openexr": [True, False], "with_eigen": [True, False], - "with_webp": [True, False], - "with_gtk": [True, False], - "with_quirc": [True, False], + "neon": [True, False], + "with_opencl": [True, False], "with_cuda": [True, False], "with_cublas": [True, False], "with_cufft": [True, False], "with_cudnn": [True, False], - "with_v4l": [True, False], - "with_ffmpeg": [True, False], + "cuda_arch_bin": [None, "ANY"], + "cpu_baseline": [None, "ANY"], + "cpu_dispatch": [None, "ANY"], + "world": [True, False], + "nonfree": [True, False], + # dnn module options + "with_flatbuffers": [True, False], + "with_protobuf": [True, False], + "with_vulkan": [True, False], + "dnn_cuda": [True, False], + # highgui module options + "with_gtk": [True, False], + "with_qt": [True, False], + "with_wayland": [True, False], + # imgcodecs module options + "with_avif": [True, False], + "with_jpeg": [False, "libjpeg", "libjpeg-turbo", "mozjpeg"], + "with_png": [True, False], + "with_tiff": [True, False], + "with_jpeg2000": [False, "jasper", "openjpeg"], + "with_openexr": [True, False], + "with_webp": [True, False], + "with_gdal": [True, False], + "with_gdcm": [True, False], "with_imgcodec_hdr": [True, False], "with_imgcodec_pfm": [True, False], "with_imgcodec_pxm": [True, False], "with_imgcodec_sunraster": [True, False], - "neon": [True, False], - "dnn": [True, False], - "dnn_cuda": [True, False], - "cuda_arch_bin": "ANY", - "cpu_baseline": "ANY", - "cpu_dispatch": "ANY", - "nonfree": [True, False], + "with_msmf": [True, False], + "with_msmf_dxva": [True, False], + # objdetect module options + "with_quirc": [True, False], + # videoio module options + "with_ffmpeg": [True, False], + "with_v4l": [True, False], + # text module options + "with_tesseract": [True, False], + # TODO: deprecated options to remove in few months + "contrib": [True, False, "deprecated"], + "contrib_freetype": [True, False, "deprecated"], + "contrib_sfm": [True, False, "deprecated"], + "with_ade": [True, False, "deprecated"], } + 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, + # global options "parallel": False, - "contrib": False, - "contrib_freetype": False, - "contrib_sfm": False, "with_ipp": False, - "with_ade": True, - "with_jpeg": "libjpeg", - "with_png": True, - "with_tiff": True, - "with_jpeg2000": "jasper", - "with_openexr": True, "with_eigen": True, - "with_webp": True, - "with_gtk": True, - "with_quirc": True, + "neon": True, + "with_opencl": False, "with_cuda": False, "with_cublas": False, "with_cufft": False, "with_cudnn": False, - "with_v4l": False, - "with_ffmpeg": True, - "with_imgcodec_hdr": False, - "with_imgcodec_pfm": False, - "with_imgcodec_pxm": False, - "with_imgcodec_sunraster": False, - "neon": True, - "dnn": True, - "dnn_cuda": False, "cuda_arch_bin": None, "cpu_baseline": None, "cpu_dispatch": None, + "world": False, "nonfree": False, + # dnn module options + "with_flatbuffers": True, + "with_protobuf": True, + "with_vulkan": False, + "dnn_cuda": False, + # highgui module options + "with_gtk": False, + "with_qt": False, + "with_wayland": True, + # imgcodecs module options + "with_avif": False, + "with_jpeg": "libjpeg", + "with_png": True, + "with_tiff": True, + "with_jpeg2000": "openjpeg", + "with_openexr": True, + "with_webp": True, + "with_gdal": False, + "with_gdcm": False, + "with_imgcodec_hdr": True, + "with_imgcodec_pfm": True, + "with_imgcodec_pxm": True, + "with_imgcodec_sunraster": True, + "with_msmf": True, + "with_msmf_dxva": True, + # objdetect module options + "with_quirc": True, + # videoio module options + "with_ffmpeg": True, + "with_v4l": False, + # text module options + "with_tesseract": True, + # TODO: deprecated options to remove in few months + "contrib": "deprecated", + "contrib_freetype": "deprecated", + "contrib_sfm": "deprecated", + "with_ade": "deprecated", } + default_options.update({_name: True for _name in OPENCV_MAIN_MODULES_OPTIONS}) + default_options.update({_name: False for _name in OPENCV_EXTRA_MODULES_OPTIONS}) short_paths = True - generators = "cmake", "cmake_find_package" - _cmake = None @property - def _source_subfolder(self): - return "source_subfolder" + def _is_cl_like(self): + return self.settings.compiler.get_safe("runtime") is not None + + @property + def _is_cl_like_static_runtime(self): + return self._is_cl_like and "MT" in msvc_runtime_flag(self) + + @property + def _is_mingw(self): + return self.settings.os == "Windows" and self.settings.compiler == "gcc" @property - def _build_subfolder(self): - return "build_subfolder" + def _is_legacy_one_profile(self): + return not hasattr(self, "settings_build") @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 _extra_modules_folder(self): + return os.path.join(self._contrib_folder, "modules") @property def _has_with_jpeg2000_option(self): @@ -122,13 +257,47 @@ def _has_with_ffmpeg_option(self): return self.settings.os != "iOS" and self.settings.os != "WindowsStore" @property - def _protobuf_version(self): - return "protobuf/3.17.1" + def _has_superres_option(self): + return self.settings.os != "iOS" + + @property + def _has_alphamat_option(self): + return Version(self.version) >= "4.3.0" + + @property + def _has_intensity_transform_option(self): + return Version(self.version) >= "4.3.0" + + @property + def _has_rapid_option(self): + return Version(self.version) >= "4.3.0" + + @property + def _has_mcc_option(self): + return Version(self.version) >= "4.5.0" + + @property + def _has_wechat_qrcode_option(self): + return Version(self.version) >= "4.5.2" + + @property + def _has_barcode_option(self): + return Version(self.version) >= "4.5.3" and Version(self.version) < "4.8.0" + + @property + def _has_with_wayland_option(self): + return Version(self.version) >= "4.7.0" and self.settings.os in ["Linux", "FreeBSD"] + + @property + def _has_with_avif_option(self): + return Version(self.version) >= "4.8.0" + + @property + def _has_with_flatbuffers_option(self): + return Version(self.version) >= "4.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": @@ -136,6 +305,11 @@ def config_options(self): if self.settings.os != "Linux": del self.options.with_gtk del self.options.with_v4l + if self.settings.os in ["iOS", "Android"]: + del self.options.with_opencl + 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 @@ -145,409 +319,1328 @@ def config_options(self): else: del self.options.with_ffmpeg - if "arm" not in self.settings.arch: - del self.options.neon if not self._has_with_jpeg2000_option: del self.options.with_jpeg2000 + elif Version(self.version) < "4.3.0": + self.options.with_jpeg2000 = "jasper" + + if "arm" not in self.settings.arch: + del self.options.neon if not self._has_with_tiff_option: del self.options.with_tiff + if not self._has_superres_option: + del self.options.superres + if not self._has_alphamat_option: + del self.options.alphamat + if not self._has_intensity_transform_option: + del self.options.intensity_transform + if not self._has_rapid_option: + del self.options.rapid + if not self._has_mcc_option: + del self.options.mcc + if not self._has_wechat_qrcode_option: + del self.options.wechat_qrcode + if not self._has_barcode_option: + del self.options.barcode + if not self._has_with_wayland_option: + del self.options.with_wayland + if not self._has_with_avif_option: + del self.options.with_avif + if not self._has_with_flatbuffers_option: + del self.options.with_flatbuffers + + # Conditional default options + if self._is_mingw: + # These options are visible for Windows, but upstream disables them + # by default for MinGW (actually it would fail otherwise) + self.options.with_msmf = False + self.options.with_msmf_dxva = False + if self.settings.os == "Linux": + # Use Wayland by default, but fallback to GTK for old OpenCV versions. + # gtk/system is problematic for this recpe, there might be side effects + # in a big dependency graph + if not self._has_with_wayland_option: + self.options.with_gtk = True + + @property + def _opencv_modules(self): + def imageformats_deps(): + components = [] + if self.options.get_safe("with_avif"): + components.append("libavif::libavif") + if self.options.get_safe("with_jpeg2000"): + components.append("{0}::{0}".format(self.options.with_jpeg2000)) + 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_openexr"): + components.append("openexr::openexr") + if self.options.get_safe("with_webp"): + components.append("libwebp::libwebp") + if self.options.get_safe("with_gdal"): + components.append("gdal::gdal") + if self.options.get_safe("with_gdcm"): + components.append("gdcm::gdcm") + return components + + def eigen(): + return ["eigen::eigen"] if self.options.with_eigen else [] + + def ffmpeg(): + components = [] + if self.options.get_safe("with_ffmpeg"): + components = ["ffmpeg::avcodec", "ffmpeg::avformat", "ffmpeg::avutil", "ffmpeg::swscale"] + return components + + def gtk(): + return ["gtk::gtk"] if self.options.get_safe("with_gtk") else [] + + def ipp(): + if self.options.with_ipp == "intel-ipp": + return ["intel-ipp::intel-ipp"] + elif self.options.with_ipp == "opencv-icv" and not self.options.shared: + return ["ippiw"] + return [] + + def parallel(): + return ["onetbb::onetbb"] if self.options.parallel == "tbb" else [] + + def protobuf(): + return ["protobuf::protobuf"] if self.options.get_safe("with_protobuf") else [] + + def qt(): + return ["qt::qt"] if self.options.get_safe("with_qt") else [] + + def quirc(): + return ["quirc::quirc"] if self.options.get_safe("with_quirc") else [] + + def tesseract(): + return ["tesseract::tesseract"] if self.options.get_safe("with_tesseract") else [] + + def vulkan(): + return ["vulkan-headers::vulkan-headers"] if self.options.get_safe("with_vulkan") else [] + + def wayland(): + return ["wayland::wayland-client", "wayland::wayland-cursor"] if self.options.get_safe("with_wayland") else [] + + def xkbcommon(): + return ["xkbcommon::libxkbcommon"] if self.options.get_safe("with_wayland") else [] + + def opencv_calib3d(): + return ["opencv_calib3d"] if self.options.calib3d else [] + + def opencv_cudaarithm(): + return ["opencv_cudaarithm"] if self.options.cudaarithm else [] + + def opencv_cudacodec(): + return ["opencv_cudacodec"] if self.options.cudacodec else [] + + def opencv_cudafeatures2d(): + return ["opencv_cudafeatures2d"] if self.options.cudafeatures2d else [] + + def opencv_cudafilters(): + return ["opencv_cudafilters"] if self.options.cudafilters else [] + + def opencv_cudaimgproc(): + return ["opencv_cudaimgproc"] if self.options.cudaimgproc else [] + + def opencv_cudalegacy(): + return ["opencv_cudalegacy"] if self.options.cudalegacy else [] + + def opencv_cudaoptflow(): + return ["opencv_cudaoptflow"] if self.options.cudaoptflow else [] + + def opencv_cudawarping(): + return ["opencv_cudawarping"] if self.options.cudawarping else [] + + def opencv_dnn(): + return ["opencv_dnn"] if self.options.dnn else [] + + def opencv_flann(): + return ["opencv_flann"] if self.options.flann else [] + + def opencv_imgcodecs(): + return ["opencv_imgcodecs"] if self.options.imgcodecs else [] + + def opencv_imgproc(): + return ["opencv_imgproc"] if self.options.imgproc else [] + + def opencv_objdetect(): + return ["opencv_objdetect"] if self.options.objdetect else [] + + def opencv_video(): + return ["opencv_video"] if self.options.video else [] + + def opencv_videoio(): + return ["opencv_videoio"] if self.options.videoio else [] + + def opencv_xfeatures2d(): + return ["opencv_xfeatures2d"] if self.options.xfeatures2d else [] + + opencv_modules = { + # Main modules + "calib3d": { + "is_built": self.options.calib3d, + "mandatory_options": ["features2d", "flann", "imgproc"], + "requires": ["opencv_core", "opencv_features2d", "opencv_flann", "opencv_imgproc"] + eigen() + ipp(), + }, + "core": { + "is_built": True, + "no_option": True, + "requires": ["zlib::zlib"] + parallel() + eigen() + ipp(), + "system_libs": [ + (self.settings.os == "Android", ["dl", "m", "log"]), + (self.settings.os == "FreeBSD", ["m", "pthread"]), + (self.settings.os == "Linux", ["dl", "m", "pthread", "rt"]), + ], + "frameworks": [ + (self.settings.os == "Macos" and self.options.get_safe("with_opencl"), ["OpenCL"]), + ], + }, + "dnn": { + "is_built": self.options.dnn, + "mandatory_options": ["imgproc"], + "requires": ["opencv_core", "opencv_imgproc"] + protobuf() + vulkan() + ipp(), + }, + "features2d": { + "is_built": self.options.features2d, + "mandatory_options": ["imgproc"], + "requires": ["opencv_imgproc"] + opencv_flann() + eigen() + ipp(), + }, + "flann": { + "is_built": self.options.flann, + "requires": ["opencv_core"] + ipp(), + }, + "gapi": { + "is_built": self.options.gapi, + "mandatory_options": ["imgproc"], + "requires": ["opencv_imgproc", "ade::ade"], + "system_libs": [ + (self.settings.os == "Windows", ["ws2_32", "wsock32"]), + ], + }, + "highgui": { + "is_built": self.options.highgui, + "mandatory_options": ["imgproc"], + "requires": ["opencv_core", "opencv_imgproc"] + opencv_imgcodecs() + + opencv_videoio() + gtk() + qt() + xkbcommon() + wayland() + ipp(), + "system_libs": [ + (self.settings.os == "Windows", ["comctl32", "gdi32", "ole32", "setupapi", "ws2_32", "vfw32"]), + ], + "frameworks": [ + (self.settings.os == "Macos", ["Cocoa"]), + ], + }, + "imgcodecs": { + "is_built": self.options.imgcodecs, + "mandatory_options": ["imgproc"], + "requires": ["opencv_imgproc", "zlib::zlib"] + imageformats_deps() + ipp(), + "frameworks": [ + (is_apple_os(self), ["CoreFoundation", "CoreGraphics"]), + (self.settings.os == "iOS", ["UIKit"]), + (self.settings.os == "Macos", ["AppKit"]), + ], + }, + "imgproc": { + "is_built": self.options.imgproc, + "requires": ["opencv_core"] + ipp(), + }, + "ml": { + "is_built": self.options.ml, + "requires": ["opencv_core"] + ipp(), + }, + "objdetect": { + "is_built": self.options.objdetect, + "mandatory_options": ["calib3d", "imgproc"], + "requires": ["opencv_core", "opencv_calib3d", "opencv_imgproc"] + quirc() + ipp(), + }, + "photo": { + "is_built": self.options.photo, + "mandatory_options": ["imgproc"], + "requires": ["opencv_imgproc"] + opencv_cudaarithm() + opencv_cudaimgproc() + ipp(), + }, + "stitching": { + "is_built": self.options.stitching, + "mandatory_options": ["calib3d", "features2d", "flann", "imgproc"], + "requires": ["opencv_calib3d", "opencv_features2d", "opencv_flann", "opencv_imgproc"] + + opencv_xfeatures2d() + opencv_cudaarithm() + opencv_cudawarping() + + opencv_cudafeatures2d() + opencv_cudalegacy() + opencv_cudaimgproc() + eigen() + ipp(), + }, + "video": { + "is_built": self.options.video, + "mandatory_options": ["imgproc"], + "requires": ["opencv_imgproc"] + opencv_calib3d() + ipp(), + }, + "videoio": { + "is_built": self.options.videoio, + "mandatory_options": ["imgcodecs", "imgproc"], + "requires": ["opencv_imgcodecs", "opencv_imgproc"] + ffmpeg() + ipp(), + "system_libs": [ + (self.settings.os == "Android" and int(str(self.settings.os.api_level)) > 20, ["mediandk"]), + ], + "frameworks": [ + (is_apple_os(self), ["Accelerate", "AVFoundation", "CoreGraphics", "CoreMedia", "CoreVideo", "QuartzCore"]), + (self.settings.os == "iOS", ["CoreImage", "UIKit"]), + (self.settings.os == "Macos", ["Cocoa"]), + ], + }, + # Extra modules + "alphamat": { + "is_built": self.options.get_safe("alphamat"), + "mandatory_options": ["with_eigen", "imgproc"], + "requires": ["opencv_core", "opencv_imgproc"] + ipp(), + }, + "aruco": { + "is_built": self.options.aruco, + "mandatory_options": ["calib3d", "imgproc"], + "requires": ["opencv_core", "opencv_calib3d", "opencv_imgproc"] + ipp(), + }, + "barcode": { + "is_built": self.options.get_safe("barcode"), + "mandatory_options": ["dnn", "imgproc"], + "requires": ["opencv_core", "opencv_dnn", "opencv_imgproc"] + ipp(), + }, + "bgsegm": { + "is_built": self.options.bgsegm, + "mandatory_options": ["calib3d", "imgproc", "video"], + "requires": ["opencv_core", "opencv_calib3d", "opencv_imgproc", "opencv_video"] + ipp(), + }, + "bioinspired": { + "is_built": self.options.bioinspired, + "requires": ["opencv_core"] + ipp(), + }, + "ccalib": { + "is_built": self.options.ccalib, + "mandatory_options": ["calib3d", "features2d", "highgui", "imgproc"], + "requires": ["opencv_core", "opencv_calib3d", "opencv_features2d", "opencv_highgui", "opencv_imgproc"] + ipp(), + }, + "cudaarithm": { + "is_built": self.options.cudaarithm, + "mandatory_options": ["with_cuda"], + "requires": ["opencv_core", "opencv_cudev"] + ipp(), + }, + "cudabgsegm": { + "is_built": self.options.cudabgsegm, + "mandatory_options": ["with_cuda", "video"], + "requires": ["opencv_video"] + ipp(), + }, + "cudacodec": { + "is_built": self.options.cudacodec, + "mandatory_options": ["with_cuda", "videoio"], + "requires": ["opencv_core", "opencv_videoio"] + ipp(), + }, + "cudafeatures2d": { + "is_built": self.options.cudafeatures2d, + "mandatory_options": ["with_cuda", "features2d", "cudafilters", "cudawarping"], + "requires": ["opencv_features2d", "opencv_cudafilters", "opencv_cudawarping"] + ipp(), + }, + "cudafilters": { + "is_built": self.options.cudafilters, + "mandatory_options": ["with_cuda", "imgproc", "cudaarithm"], + "requires": ["opencv_imgproc", "opencv_cudaarithm"] + ipp(), + }, + "cudaimgproc": { + "is_built": self.options.cudaimgproc, + "mandatory_options": ["with_cuda", "imgproc"], + "requires": ["opencv_imgproc", "opencv_cudev"] + opencv_cudaarithm() + opencv_cudafilters() + ipp(), + }, + "cudalegacy": { + "is_built": self.options.cudalegacy, + "mandatory_options": ["with_cuda", "video"], + "requires": ["opencv_core", "opencv_video"] + opencv_calib3d() + opencv_imgproc() + opencv_objdetect() + + opencv_cudaarithm() + opencv_cudafilters() + opencv_cudaimgproc() + ipp(), + }, + "cudaobjdetect": { + "is_built": self.options.cudaobjdetect, + "mandatory_options": ["with_cuda", "objdetect", "cudaarithm", "cudawarping"], + "requires": ["opencv_objdetect", "opencv_cudaarithm", "opencv_cudawarping"] + opencv_cudalegacy() + ipp(), + }, + "cudaoptflow": { + "is_built": self.options.cudaoptflow, + "mandatory_options": ["with_cuda", "video", "cudaarithm", "cudaimgproc", "cudawarping", "optflow"], + "requires": ["opencv_video", "opencv_cudaarithm", "cudaimgproc", "opencv_cudawarping", + "opencv_optflow"] + opencv_cudalegacy() + ipp(), + }, + "cudastereo": { + "is_built": self.options.cudastereo, + "mandatory_options": ["with_cuda", "calib3d"], + "requires": ["opencv_calib3d", "opencv_cudev"] + ipp(), + }, + "cudawarping": { + "is_built": self.options.cudawarping, + "mandatory_options": ["with_cuda", "imgproc"], + "requires": ["opencv_core", "opencv_imgproc", "opencv_cudev"] + ipp(), + }, + "cudev": { + "is_built": self.options.with_cuda, + "no_option": True, + "requires": ipp(), + }, + "cvv": { + "is_built": self.options.cvv, + "mandatory_options": ["with_qt", "features2d", "imgproc"], + "requires": ["opencv_core", "opencv_features2d", "opencv_imgproc", "qt::qt"] + ipp(), + }, + "datasets": { + "is_built": self.options.datasets, + "mandatory_options": ["flann", "imgcodecs", "ml"], + "requires": ["opencv_core", "opencv_flann", "opencv_imgcodecs", "opencv_ml"] + ipp(), + }, + "dnn_objdetect": { + "is_built": self.options.dnn_objdetect, + "mandatory_options": ["dnn", "imgproc"], + "requires": ["opencv_core", "opencv_dnn", "opencv_imgproc"] + ipp(), + }, + "dnn_superres": { + "is_built": self.options.dnn_superres, + "mandatory_options": ["dnn", "imgproc"], + "requires": ["opencv_core", "opencv_dnn", "opencv_imgproc"] + ipp(), + }, + "dpm": { + "is_built": self.options.dpm, + "mandatory_options": ["imgproc", "objdetect"], + "requires": ["opencv_core", "opencv_imgproc", "opencv_objdetect"] + ipp(), + }, + "face": { + "is_built": self.options.face, + "mandatory_options": ["calib3d", "imgproc", "objdetect", "photo"], + "requires": ["opencv_core", "opencv_calib3d", "opencv_imgproc", "opencv_objdetect", "opencv_photo"] + ipp(), + }, + "freetype": { + "is_built": self.options.freetype, + "mandatory_options": ["imgproc"], + "requires": ["opencv_core", "opencv_imgproc", "freetype::freetype", "harfbuzz::harfbuzz"] + ipp(), + }, + "fuzzy": { + "is_built": self.options.fuzzy, + "mandatory_options": ["imgproc"], + "requires": ["opencv_core", "opencv_imgproc"] + ipp(), + }, + "hdf": { + "is_built": self.options.hdf, + "requires": ["opencv_core", "hdf5::hdf5"] + ipp(), + }, + "hfs": { + "is_built": self.options.hfs, + "mandatory_options": ["imgproc"], + "requires": ["opencv_core", "opencv_imgproc"] + ipp(), + }, + "img_hash": { + "is_built": self.options.img_hash, + "is_part_of_world": False, + "mandatory_options": ["imgproc"], + "requires": ["opencv_core", "opencv_imgproc"] + ipp(), + }, + "intensity_transform": { + "is_built": self.options.get_safe("intensity_transform"), + "requires": ["opencv_core"] + ipp(), + }, + "line_descriptor": { + "is_built": self.options.line_descriptor, + "mandatory_options": ["imgproc"], + "requires": ["opencv_imgproc"] + ipp(), + }, + "mcc": { + "is_built": self.options.get_safe("mcc"), + "mandatory_options": ["calib3d", "dnn", "imgproc"], + "requires": ["opencv_core", "opencv_calib3d", "opencv_dnn", "opencv_imgproc"] + ipp(), + }, + "optflow": { + "is_built": self.options.optflow, + "mandatory_options": ["calib3d", "flann", "imgcodecs", "imgproc", "video", "ximgproc"], + "requires": ["opencv_core", "opencv_calib3d", "opencv_flann", "opencv_imgcodecs", "opencv_imgproc", + "opencv_video", "opencv_ximgproc"] + ipp(), + }, + "ovis": { + "is_built": self.options.ovis, + "mandatory_options": ["calib3d", "imgproc"], + "requires": ["opencv_core", "opencv_calib3d", "opencv_imgproc", "ogre::ogre"] + ipp(), + }, + "phase_unwrapping": { + "is_built": self.options.phase_unwrapping, + "mandatory_options": ["imgproc"], + "requires": ["opencv_core", "opencv_imgproc"] + ipp(), + }, + "plot": { + "is_built": self.options.plot, + "mandatory_options": ["imgproc"], + "requires": ["opencv_core", "opencv_imgproc"] + ipp(), + }, + "quality": { + "is_built": self.options.quality, + "mandatory_options": ["imgproc", "ml"], + "requires": ["opencv_core", "opencv_imgproc", "opencv_ml"] + ipp(), + }, + "rapid": { + "is_built": self.options.get_safe("rapid"), + "mandatory_options": ["calib3d", "imgproc"], + "requires": ["opencv_core", "opencv_calib3d", "opencv_imgproc"] + ipp(), + }, + "reg": { + "is_built": self.options.reg, + "mandatory_options": ["imgproc"], + "requires": ["opencv_core", "opencv_imgproc"] + ipp(), + }, + "rgbd": { + "is_built": self.options.rgbd, + "mandatory_options": ["calib3d", "imgproc"], + "requires": ["opencv_core", "opencv_calib3d", "opencv_imgproc"] + eigen() + ipp(), + }, + "saliency": { + "is_built": self.options.saliency, + "mandatory_options": ["features2d", "imgproc"], + "requires": ["opencv_features2d", "opencv_imgproc"] + ipp(), + }, + "sfm": { + "is_built": self.options.sfm, + "is_part_of_world": False, + "mandatory_options": ["with_eigen", "calib3d", "features2d", "imgcodecs", "xfeatures2d"], + "requires": ["opencv_core", "opencv_calib3d", "opencv_features2d", "opencv_imgcodecs", "opencv_xfeatures2d", + "correspondence", "multiview", "numeric", "glog::glog", "gflags::gflags"] + eigen() + ipp(), + }, + "shape": { + "is_built": self.options.shape, + "mandatory_options": ["calib3d", "imgproc"], + "requires": ["opencv_core", "opencv_calib3d", "opencv_imgproc"] + ipp(), + }, + "stereo": { + "is_built": self.options.stereo, + "mandatory_options": ["features2d", "imgproc", "tracking"], + "requires": ["opencv_core", "opencv_features2d", "opencv_imgproc", "opencv_tracking"] + ipp(), + }, + "structured_light": { + "is_built": self.options.structured_light, + "mandatory_options": ["calib3d", "imgproc", "phase_unwrapping"], + "requires": ["opencv_core", "opencv_calib3d", "opencv_imgproc", "opencv_phase_unwrapping"] + ipp(), + }, + "superres": { + "is_built": self.options.get_safe("superres"), + "mandatory_options": ["imgproc", "video", "optflow"], + "requires": ["opencv_imgproc", "opencv_video", "opencv_optflow"] + opencv_videoio() + ipp() + + opencv_cudaarithm() + opencv_cudafilters() + opencv_cudawarping() + opencv_cudaimgproc() + + opencv_cudaoptflow() + opencv_cudacodec(), + }, + "surface_matching": { + "is_built": self.options.surface_matching, + "mandatory_options": ["flann"], + "requires": ["opencv_core", "opencv_flann"] + ipp(), + }, + "text": { + "is_built": self.options.text, + "mandatory_options": ["dnn", "features2d", "imgproc", "ml"], + "requires": ["opencv_core", "opencv_dnn", "opencv_features2d", "opencv_imgproc", "opencv_ml"] + + tesseract() + ipp(), + }, + "tracking": { + "is_built": self.options.tracking, + "mandatory_options": ["imgproc", "video"], + "requires": ["opencv_core", "opencv_imgproc", "opencv_video"] + opencv_dnn() + ipp(), + }, + "videostab": { + "is_built": self.options.videostab, + "mandatory_options": ["calib3d", "features2d", "imgproc", "photo", "video"], + "requires": ["opencv_calib3d", "opencv_features2d", "opencv_imgproc", "opencv_photo", "opencv_video"] + + opencv_videoio() + ipp() + opencv_cudawarping() + opencv_cudaoptflow(), + }, + "viz": { + "is_built": self.options.viz, + "requires": ["opencv_core", "vtk::vtk"] + ipp(), + }, + "wechat_qrcode": { + "is_built": self.options.get_safe("wechat_qrcode"), + "mandatory_options": ["dnn", "imgproc"], + "requires": ["opencv_core", "opencv_dnn", "opencv_imgproc"] + ipp(), + }, + "xfeatures2d": { + "is_built": self.options.xfeatures2d, + "mandatory_options": ["calib3d", "features2d", "imgproc"], + "requires": ["opencv_core", "opencv_calib3d", "opencv_features2d", "opencv_imgproc"] + ipp() + opencv_cudaarithm(), + }, + "ximgproc": { + "is_built": self.options.ximgproc, + "mandatory_options": ["calib3d", "imgcodecs", "imgproc", "video"], + "requires": ["opencv_core", "opencv_calib3d", "opencv_imgcodecs", "opencv_imgproc", "opencv_video"] + + eigen() + ipp(), + }, + "xobjdetect": { + "is_built": self.options.xobjdetect, + "mandatory_options": ["imgcodecs", "imgproc", "objdetect"], + "requires": ["opencv_core", "opencv_imgcodecs", "opencv_imgproc", "opencv_objdetect"] + ipp(), + }, + "xphoto": { + "is_built": self.options.xphoto, + "mandatory_options": ["imgproc", "photo"], + "requires": ["opencv_core", "opencv_imgproc", "opencv_photo"] + ipp(), + }, + # Extra targets (without prefix in their target & lib name) + "ippiw": { + "is_built": self.options.with_ipp == "opencv-icv" and not self.options.shared, + "is_part_of_world": False, + "no_option": True, + }, + "numeric": { + "is_built": self.options.sfm, + "is_part_of_world": False, + "no_option": True, + "requires": eigen() + ipp(), + }, + "correspondence": { + "is_built": self.options.sfm, + "is_part_of_world": False, + "no_option": True, + "requires": ["opencv_imgcodecs", "multiview", "glog::glog"] + eigen() + ipp(), + }, + "multiview": { + "is_built": self.options.sfm, + "is_part_of_world": False, + "no_option": True, + "requires": ["numeric", "glog::glog"] + eigen() + ipp(), + }, + } + + if Version(self.version) >= "4.3.0": + opencv_modules["gapi"].setdefault("requires", []).extend(opencv_video()) + if Version(self.version) >= "4.5.2": + opencv_modules["gapi"].setdefault("requires", []).extend(opencv_calib3d()) + if Version(self.version) >= "4.5.4": + opencv_modules["objdetect"].setdefault("requires", []).extend(opencv_dnn()) + if Version(self.version) >= "4.5.1": + opencv_modules["video"].setdefault("requires", []).extend(opencv_dnn()) + if Version(self.version) >= "4.4.0": + opencv_modules["intensity_transform"].setdefault("mandatory_options", []).append("imgproc") + opencv_modules["intensity_transform"].setdefault("requires", []).append("opencv_imgproc") + if Version(self.version) < "4.3.0": + opencv_modules["stereo"].setdefault("mandatory_options", []).extend(["calib3d", "video"]) + opencv_modules["stereo"].setdefault("requires", []).extend(["opencv_calib3d", "opencv_video"]) + if Version(self.version) >= "4.7.0": + opencv_modules["aruco"].setdefault("mandatory_options", []).append("objdetect") + opencv_modules["aruco"].setdefault("requires", []).append("opencv_objdetect") + opencv_modules["cudacodec"].setdefault("mandatory_options", []).extend(["cudaarithm", "cudawarping"]) + opencv_modules["cudacodec"].setdefault("requires", []).extend(["opencv_cudaarithm", "opencv_cudawarping"]) + opencv_modules["wechat_qrcode"].setdefault("mandatory_options", []).append("objdetect") + opencv_modules["wechat_qrcode"].setdefault("requires", []).append("opencv_objdetect") + else: + opencv_modules["cudacodec"].setdefault("requires", []).append("opencv_cudev") + if Version(self.version) < "4.8.0": + opencv_modules["dnn"].setdefault("mandatory_options", []).append("with_protobuf") + + 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: + try: + setattr(self.options, option_to_enable, True) + except ConanException: + # It may not work in conan v2 and raise ConanException "Incorrect attempt to modify option" + continue + + 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 - if not self.options.contrib: - del self.options.contrib_freetype - del self.options.contrib_sfm + self.options.rm_safe("fPIC") + + # TODO: remove contrib option in few months + if self.options.contrib != "deprecated": + self.output.warning("contrib option is deprecated") + if self.options.contrib: + # During deprecation period, keep old behavior of contrib=True, which was to enable + # all available contribs. + ## Filter main module options + filtered_options = list(OPENCV_MAIN_MODULES_OPTIONS) + ## Filter extra modules not built previously with contrib=True + filtered_options.extend(["cvv", "freetype", "hdf", "ovis", "sfm", "viz"]) + ## Filter extra modules not built previously when some option was disabled + if not self.options.with_eigen: + filtered_options.append("alphamat") + if not self.options.with_cuda: + filtered_options.extend([ + "cudaarithm", "cudabgsegm", "cudacodec", "cudafeatures2d", "cudafilters", "cudaimgproc", + "cudalegacy", "cudaobjdetect", "cudaoptflow", "cudastereo", "cudawarping", + ]) + for option, values in self._opencv_modules.items(): + if option not in filtered_options and not values.get("no_option"): + try: + if hasattr(self.options, option): + setattr(self.options, option, True) + except ConanException: + continue + + # TODO: remove contrib_freetype option in few months + if self.options.contrib_freetype != "deprecated": + self.output.warning("contrib_freetype option is deprecated, use freetype option instead") + self.options.freetype = self.options.contrib_freetype + + # TODO: remove contrib_sfm option in few months + if self.options.contrib_sfm != "deprecated": + self.output.warning("contrib_sfm option is deprecated, use sfm option instead") + self.options.sfm = self.options.contrib_sfm + + # TODO: remove with_ade option in few months + if self.options.with_ade != "deprecated": + self.output.warning("with_ade option is deprecated, use gapi option instead") + self.options.gapi = self.options.with_ade + + # 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.dnn: - del self.options.dnn_cuda + self.options.rm_safe("dnn_cuda") + self.options.rm_safe("with_flatbuffers") + self.options.rm_safe("with_protobuf") + self.options.rm_safe("with_vulkan") + if not self.options.highgui: + self.options.rm_safe("with_gtk") + self.options.rm_safe("with_wayland") + if not (self.options.highgui or self.options.cvv): + self.options.rm_safe("with_qt") + if not self.options.imgcodecs: + self.options.rm_safe("with_avif") + self.options.rm_safe("with_jpeg") + self.options.rm_safe("with_jpeg2000") + self.options.rm_safe("with_openexr") + self.options.rm_safe("with_png") + self.options.rm_safe("with_tiff") + self.options.rm_safe("with_webp") + self.options.rm_safe("with_gdal") + self.options.rm_safe("with_gdcm") + self.options.rm_safe("with_imgcodec_hdr") + self.options.rm_safe("with_imgcodec_pfm") + self.options.rm_safe("with_imgcodec_pxm") + self.options.rm_safe("with_imgcodec_sunraster") + self.options.rm_safe("with_msmf") + self.options.rm_safe("with_msmf_dxva") + if not self.options.objdetect: + self.options.rm_safe("with_quirc") + if not self.options.videoio: + self.options.rm_safe("with_ffmpeg") + self.options.rm_safe("with_v4l") if not self.options.with_cuda: - del self.options.with_cublas - del self.options.with_cudnn - del self.options.with_cufft - del self.options.dnn_cuda - del self.options.cuda_arch_bin - if bool(self.options.with_jpeg): + self.options.rm_safe("with_cublas") + self.options.rm_safe("with_cudnn") + self.options.rm_safe("with_cufft") + self.options.rm_safe("dnn_cuda") + self.options.rm_safe("cuda_arch_bin") + if not self.options.text: + self.options.rm_safe("with_tesseract") + + if bool(self.options.get_safe("with_jpeg", False)): if self.options.get_safe("with_jpeg2000") == "jasper": self.options["jasper"].with_libjpeg = self.options.with_jpeg if self.options.get_safe("with_tiff"): self.options["libtiff"].jpeg = self.options.with_jpeg - 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") - if self.options.with_jpeg == "libjpeg": - self.requires("libjpeg/9d") - elif self.options.with_jpeg == "libjpeg-turbo": - self.requires("libjpeg-turbo/2.1.2") - if self.options.get_safe("with_jpeg2000") == "jasper": - self.requires("jasper/2.0.33") - elif self.options.get_safe("with_jpeg2000") == "openjpeg": - self.requires("openjpeg/2.4.0") - if self.options.with_png: - self.requires("libpng/1.6.37") - if self.options.with_openexr: - self.requires("openexr/2.5.7") - if self.options.get_safe("with_tiff"): - self.requires("libtiff/4.3.0") + # core module dependencies + self.requires("zlib/[>=1.2.11 <2]") if self.options.with_eigen: - self.requires("eigen/3.3.9") - if self.options.get_safe("with_ffmpeg"): - self.requires("ffmpeg/4.4") + self.requires("eigen/3.4.0") if self.options.parallel == "tbb": - self.requires("onetbb/2020.3") + self.requires("onetbb/2021.10.0") if self.options.with_ipp == "intel-ipp": self.requires("intel-ipp/2020") - if self.options.with_webp: - self.requires("libwebp/1.2.2") - if self.options.get_safe("contrib_freetype"): - self.requires("freetype/2.11.1") - self.requires("harfbuzz/3.2.0") - if self.options.get_safe("contrib_sfm"): - self.requires("gflags/2.2.2") - self.requires("glog/0.5.0") - if self.options.with_quirc: - self.requires("quirc/1.1") + # dnn module dependencies + if self.options.get_safe("with_protobuf"): + # Symbols are exposed https://github.com/conan-io/conan-center-index/pull/16678#issuecomment-1507811867 + self.requires("protobuf/3.21.12", transitive_libs=True) + if self.options.get_safe("with_vulkan"): + self.requires("vulkan-headers/1.3.268.0") + # gapi module dependencies + if self.options.gapi: + self.requires("ade/0.1.2d") + # highgui module dependencies if self.options.get_safe("with_gtk"): self.requires("gtk/system") - if self.options.dnn: - self.requires(self._protobuf_version) - if self.options.with_ade: - self.requires("ade/0.1.1f") + if self.options.get_safe("with_qt"): + self.requires("qt/5.15.12") + if self.options.get_safe("with_wayland"): + self.requires("xkbcommon/1.6.0") + self.requires("wayland/1.22.0") + # imgcodecs module dependencies + if self.options.get_safe("with_avif"): + self.requires("libavif/1.0.4") + 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/3.0.2") + elif self.options.get_safe("with_jpeg") == "mozjpeg": + self.requires("mozjpeg/4.1.5") + if self.options.get_safe("with_jpeg2000") == "jasper": + self.requires("jasper/4.2.0") + elif self.options.get_safe("with_jpeg2000") == "openjpeg": + self.requires("openjpeg/2.5.2") + if self.options.get_safe("with_png"): + self.requires("libpng/[>=1.6 <2]") + if self.options.get_safe("with_openexr"): + self.requires("openexr/3.2.3") + if self.options.get_safe("with_tiff"): + self.requires("libtiff/4.6.0") + if self.options.get_safe("with_webp"): + self.requires("libwebp/1.3.2") + if self.options.get_safe("with_gdal"): + self.requires("gdal/3.8.3") + if self.options.get_safe("with_gdcm"): + self.requires("gdcm/3.0.23") + # objdetect module dependencies + if self.options.get_safe("with_quirc"): + self.requires("quirc/1.2") + # videoio module dependencies + 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.4") + # freetype module dependencies + if self.options.freetype: + self.requires("freetype/2.13.2") + self.requires("harfbuzz/8.3.0") + # hdf module dependencies + if self.options.hdf: + self.requires("hdf5/1.14.3") + # ovis module dependencies + if self.options.ovis: + self.requires("ogre/1.10.2") + # sfm module dependencies + if self.options.sfm: + self.requires("gflags/2.2.2") + self.requires("glog/0.7.0") + # text module dependencies + if self.options.get_safe("with_tesseract"): + self.requires("tesseract/5.3.3") + + def package_id(self): + # deprecated options + del self.info.options.contrib + del self.info.options.contrib_freetype + del self.info.options.contrib_sfm + del self.info.options.with_ade + + 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): - 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": + self._check_mandatory_options(self._opencv_modules) + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) + if self.options.shared and self._is_cl_like and self._is_cl_like_static_runtime: + raise ConanInvalidConfiguration("MSVC or clang-cl with static runtime are not supported for shared library.") + 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 \ - (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.get_safe("dnn_cuda") and \ + (not self.options.with_cuda or not self.options.with_cublas or not self.options.with_cudnn): + raise ConanInvalidConfiguration("with_cublas and with_cudnn 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))) + not (self.settings.arch in ["x86", "x86_64"] and self.settings.os in ["Linux", "Macos", "Windows"]): + raise ConanInvalidConfiguration(f"opencv-icv is not available for {self.settings.os}/{self.settings.arch}") + if self.options.viz: + raise ConanInvalidConfiguration( + "viz module can't be enabled yet. It requires VTK which is not available in conan-center." + ) + if self.options.get_safe("with_jpeg2000") == "openjpeg" and Version(self.version) < "4.3.0": + raise ConanInvalidConfiguration("openjpeg is not available for OpenCV before 4.3.0") + def build_requirements(self): - if self.options.dnn and hasattr(self, "settings_build"): - self.build_requires(self._protobuf_version) + if self.options.get_safe("with_protobuf"): + if not self._is_legacy_one_profile: + self.tool_requires("protobuf/") + if self.options.get_safe("with_wayland"): + self.tool_requires("wayland-protocols/1.33") + if not self._is_legacy_one_profile: + self.tool_requires("wayland/") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/2.1.0") def source(self): - tools.get(**self.conan_data["sources"][self.version][0], - destination=self._source_subfolder, strip_root=True) - - tools.get(**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)", "") - - 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_") - - # Cleanup RPATH - if tools.Version(self.version) < "4.1.2": - install_layout_file = os.path.join(self._source_subfolder, "CMakeLists.txt") - else: - install_layout_file = os.path.join(self._source_subfolder, "cmake", "OpenCVInstallLayout.cmake") - tools.replace_in_file(install_layout_file, + get(self, **self.conan_data["sources"][self.version][0], strip_root=True) + + get(self, **self.conan_data["sources"][self.version][1], + destination=self._contrib_folder, strip_root=True) + + def _patch_sources(self): + apply_conandata_patches(self) + + # Patches in opencv + # ----------------- + + ## Remove 3rd party libs + for directory in [ + "libjasper", "libjpeg", "libjpeg-turbo", "libpng", "libspng", "libtiff", + "libwebp", "openexr", "openjpeg", "protobuf", "quirc", "tbb", "zlib", + ]: + 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)") + + ## Upstream CMakeLists vendors quirc in CMakeLists of 3rdparty/quirc. + ## Instead we rely on find-quirc.patch in order to link external quirc. + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "add_subdirectory(3rdparty/quirc)", "") + + ## Fix link to several dependencies + replace_in_file(self, os.path.join(self.source_folder, "modules", "imgcodecs", "CMakeLists.txt"), "JASPER_", "Jasper_") + replace_in_file(self, os.path.join(self.source_folder, "modules", "imgcodecs", "CMakeLists.txt"), "${GDAL_LIBRARY}", "GDAL::GDAL") + if Version(self.version) >= "4.8.0": + replace_in_file(self, os.path.join(self.source_folder, "modules", "imgcodecs", "CMakeLists.txt"), "${AVIF_LIBRARY}", "avif") + + ## Fix detection of ffmpeg + replace_in_file(self, os.path.join(self.source_folder, "modules", "videoio", "cmake", "detect_ffmpeg.cmake"), + "FFMPEG_FOUND", "ffmpeg_FOUND") + + ## Robust handling of wayland + if self.options.get_safe("with_wayland"): + detect_wayland = os.path.join(self.source_folder, "modules", "highgui", "cmake", "detect_wayland.cmake") + + # We have to override *_LINK_LIBRARIES variables linked to highui because they are just link fkags, not cflags + # so include dirs are missing (OpenCV seems to assume system libs for wayland) + replace_in_file( + self, + detect_wayland, + "ocv_check_modules(WAYLAND_CLIENT wayland-client)", + "ocv_check_modules(WAYLAND_CLIENT wayland-client)\nfind_package(wayland REQUIRED CONFIG)\nset(WAYLAND_CLIENT_LINK_LIBRARIES wayland::wayland-client)", + ) + replace_in_file( + self, + detect_wayland, + "ocv_check_modules(WAYLAND_CURSOR wayland-cursor)", + "ocv_check_modules(WAYLAND_CURSOR wayland-cursor)\nset(WAYLAND_CURSOR_LINK_LIBRARIES wayland::wayland-cursor)", + ) + replace_in_file( + self, + detect_wayland, + "ocv_check_modules(XKBCOMMON xkbcommon)", + "ocv_check_modules(XKBCOMMON xkbcommon)\nfind_package(xkbcommon REQUIRED CONFIG)\nset(XKBCOMMON_LINK_LIBRARIES xkbcommon::libxkbcommon)", + ) + + ## Cleanup RPATH + 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)", "") - - 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()''') + replace_in_file(self, install_layout_file, "set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)", "") + + ## Fix discovery & link of protobuf + if self.options.get_safe("with_protobuf"): + 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": - sfm_cmake = os.path.join(self._contrib_folder, "modules", "sfm", "CMakeLists.txt") - ver = tools.Version(self.version) - if ver <= "4.5.0": - search = ' find_package(Glog QUIET)\nendif()' - else: - search = ' set(GLOG_INCLUDE_DIRS "${GLOG_INCLUDE_DIR}")\nendif()' - tools.replace_in_file(sfm_cmake, 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") + + # Patches in opencv_contrib + # ------------------------- + + ## Remove unused extra modules to avoid side effects + if not self.options.with_cuda: + rmdir(self, os.path.join(self._extra_modules_folder, "cudev")) + for module in OPENCV_EXTRA_MODULES_OPTIONS: + if not self.options.get_safe(module): + rmdir(self, os.path.join(self._extra_modules_folder, module)) + for module in ["cnn_3dobj", "julia", "matlab"]: + rmdir(self, os.path.join(self._extra_modules_folder, module)) + + ## Fix Freetype discovery logic in freetype extra module + if self.options.freetype: + freetype_cmake = os.path.join(self._extra_modules_folder, "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 CONFIG)") + replace_in_file(self, freetype_cmake, "HARFBUZZ_", "harfbuzz_") + + def generate(self): + VirtualBuildEnv(self).generate() + if self._is_legacy_one_profile: + if self.options.get_safe("with_protobuf") or self.options.get_safe("with_wayland"): + 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["OPENCV_SKIP_CMAKE_CXX_STANDARD"] = valid_min_cppstd(self, 11) + + 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"] = self.options.with_ipp == "opencv-icv" + 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_ARAVIS"] = False + tc.variables["WITH_CLP"] = False + tc.variables["WITH_NVCUVID"] = False + + tc.variables["WITH_FFMPEG"] = self.options.get_safe("with_ffmpeg", False) 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" - 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 - if self.options.with_ipp: - self._cmake.definitions["WITH_IPP"] = True - if self.options.with_ipp == "intel-ipp": - ipp_root = self.deps_cpp_info["intel-ipp"].rootpath - if self.settings.os == "Windows": - ipp_root = ipp_root.replace("\\", "/") - self._cmake.definitions["IPPROOT"] = ipp_root - self._cmake.definitions["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["OPENCV_FFMPEG_USE_FIND_PACKAGE"] = "ffmpeg" + tc.variables["OPENCV_INSTALL_FFMPEG_DOWNLOAD_SCRIPT"] = False + if Version(self.version) >= "4.7.0": + tc.variables["OPENCV_FFMPEG_ENABLE_LIBAVDEVICE"] = False + ffmpeg_libraries = [] + for component in ["avcodec", "avformat", "avutil", "swscale", "avresample"]: + if component == "avutil" or self.dependencies["ffmpeg"].options.get_safe(component): + ffmpeg_libraries.append(f"ffmpeg::{component}") + ffmpeg_component_version = self.dependencies["ffmpeg"].cpp_info.components[component].get_property("component_version") + tc.variables[f"FFMPEG_lib{component}_VERSION"] = ffmpeg_component_version + tc.variables["FFMPEG_LIBRARIES"] = ";".join(ffmpeg_libraries) + + tc.variables["WITH_GSTREAMER"] = False + tc.variables["WITH_HALIDE"] = False + tc.variables["WITH_HPX"] = False + tc.variables["WITH_IMGCODEC_HDR"] = self.options.get_safe("with_imgcodec_hdr", False) + tc.variables["WITH_IMGCODEC_PFM"] = self.options.get_safe("with_imgcodec_pfm", False) + tc.variables["WITH_IMGCODEC_PXM"] = self.options.get_safe("with_imgcodec_pxm", False) + tc.variables["WITH_IMGCODEC_SUNRASTER"] = self.options.get_safe("with_imgcodec_sunraster", False) + tc.variables["WITH_IPP"] = bool(self.options.with_ipp) + if self.options.with_ipp == "intel-ipp": + ipp_root = self.dependencies["intel-ipp"].package_folder.replace("\\", "/") + tc.variables["IPPROOT"] = ipp_root + tc.variables["IPPIWROOT"] = ipp_root + tc.variables["WITH_ITT"] = False + tc.variables["WITH_LIBREALSENSE"] = False + tc.variables["WITH_MFX"] = False + tc.variables["WITH_OPENCL"] = self.options.get_safe("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_TBB"] = self.options.parallel == "tbb" + tc.variables["WITH_OPENMP"] = self.options.parallel == "openmp" + tc.variables["WITH_OPENNI"] = False + tc.variables["WITH_OPENNI2"] = False + tc.variables["WITH_OPENVX"] = False + tc.variables["WITH_CAROTENE"] = False + tc.variables["WITH_PLAIDML"] = False + tc.variables["WITH_PVAPI"] = False + tc.variables["WITH_QT"] = self.options.get_safe("with_qt", False) + tc.variables["WITH_QUIRC"] = self.options.get_safe("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"] = self.options.viz + tc.variables["WITH_VULKAN"] = self.options.get_safe("with_vulkan", False) + if self.options.get_safe("with_vulkan"): + tc.variables["VULKAN_INCLUDE_DIRS"] = os.path.join(self.dependencies["vulkan-headers"].package_folder, "include").replace("\\", "/") + 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.get_safe("with_webp", False) + tc.variables["WITH_JPEG"] = bool(self.options.get_safe("with_jpeg", False)) + tc.variables["WITH_PNG"] = self.options.get_safe("with_png", False) if self._has_with_tiff_option: - self._cmake.definitions["WITH_TIFF"] = self.options.with_tiff + tc.variables["WITH_TIFF"] = self.options.get_safe("with_tiff", False) 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 - - if self.options.get_safe("neon") is not None: - self._cmake.definitions["ENABLE_NEON"] = self.options.get_safe("neon") - - self._cmake.definitions["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) - - 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) - - if self.options.with_openexr: - self._cmake.definitions["OPENEXR_ROOT"] = self.deps_cpp_info["openexr"].rootpath + tc.variables["WITH_JASPER"] = self.options.get_safe("with_jpeg2000") == "jasper" + tc.variables["WITH_OPENJPEG"] = self.options.get_safe("with_jpeg2000") == "openjpeg" + tc.variables["WITH_OPENEXR"] = self.options.get_safe("with_openexr", False) + tc.variables["WITH_GDAL"] = self.options.get_safe("with_gdal", False) + tc.variables["WITH_GDCM"] = self.options.get_safe("with_gdcm", False) + tc.variables["WITH_EIGEN"] = self.options.with_eigen + tc.variables["WITH_DSHOW"] = self._is_cl_like + 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 + + tc.variables["ENABLE_NEON"] = self.options.get_safe("neon", False) + + tc.variables["OPENCV_DNN_CUDA"] = self.options.get_safe("dnn_cuda", False) + + if Version(self.version) >= "4.6.0": + tc.variables["WITH_OPENVINO"] = False + tc.variables["WITH_TIMVX"] = False + else: + tc.variables["WITH_INF_ENGINE"] = False + tc.variables["WITH_NGRAPH"] = False + + if Version(self.version) >= "4.7.0": + tc.variables["ENABLE_DELAYLOAD"] = False + tc.variables["WITH_CANN"] = False + tc.variables["WITH_SPNG"] = False # TODO: change with_png recipe option in order to use either libpng or libspng + tc.variables["WITH_WAYLAND"] = self.options.get_safe("with_wayland", False) + + if Version(self.version) >= "4.8.0": + tc.variables["WITH_AVIF"] = self.options.get_safe("with_avif", False) + tc.variables["WITH_FLATBUFFERS"] = self.options.get_safe("with_flatbuffers", False) + + if Version(self.version) >= "4.10.0": + tc.variables["WITH_KLEIDICV"] = False + tc.variables["WITH_NDSRVP"] = False + tc.variables["OBSENSOR_USE_ORBBEC_SDK"] = False + if is_apple_os(self): + # default behavior for 4.9.0 + tc.variables["WITH_OBSENSOR"] = False + tc.variables["WITH_ZLIB_NG"] = False + + # Special world option merging all enabled modules into one big library file + tc.variables["BUILD_opencv_world"] = self.options.world + + # Main modules + tc.variables["BUILD_opencv_core"] = True + for module in OPENCV_MAIN_MODULES_OPTIONS: + tc.variables[f"BUILD_opencv_{module}"] = self.options.get_safe(module, False) + tc.variables["WITH_PROTOBUF"] = self.options.get_safe("with_protobuf", False) + if self.options.get_safe("with_protobuf"): + tc.variables["PROTOBUF_UPDATE_FILES"] = True + tc.variables["WITH_ADE"] = self.options.gapi + + # Extra modules + if any([self.options.get_safe(module) for module in OPENCV_EXTRA_MODULES_OPTIONS]) or self.options.with_cuda: + tc.variables["OPENCV_EXTRA_MODULES_PATH"] = self._extra_modules_folder.replace("\\", "/") + tc.variables["BUILD_opencv_cudev"] = self.options.with_cuda + for module in OPENCV_EXTRA_MODULES_OPTIONS: + tc.variables[f"BUILD_opencv_{module}"] = self.options.get_safe(module, False) + tc.variables["BUILD_opencv_cnn_3dobj"] = False + if Version(self.version) >= "4.4.0": + tc.variables["BUILD_opencv_julia"] = False + tc.variables["BUILD_opencv_matlab"] = False + if self.options.text: + tc.variables["WITH_TESSERACT"] = self.options.with_tesseract + 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 - if self.options.parallel: - self._cmake.definitions["WITH_TBB"] = self.options.parallel == "tbb" - self._cmake.definitions["WITH_OPENMP"] = self.options.parallel == "openmp" - - self._cmake.definitions["WITH_CUDA"] = self.options.with_cuda - self._cmake.definitions["WITH_ADE"] = self.options.with_ade + 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 + + tc.variables["WITH_CUDA"] = self.options.with_cuda 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 self._is_cl_like: + tc.variables["BUILD_WITH_STATIC_CRT"] = self._is_cl_like_static_runtime 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() + + if self.options.get_safe("with_wayland"): + deps = PkgConfigDeps(self) + if self._is_legacy_one_profile: + # Manually generate pkgconfig file of wayland-protocols since + # PkgConfigDeps.build_context_activated can't work with legacy 1 profile + wp_prefix = self.dependencies.build["wayland-protocols"].package_folder + wp_version = self.dependencies.build["wayland-protocols"].ref.version + wp_pkg_content = textwrap.dedent(f"""\ + prefix={wp_prefix} + datarootdir=${{prefix}}/res + pkgdatadir=${{datarootdir}}/wayland-protocols + Name: Wayland Protocols + Description: Wayland protocol files + Version: {wp_version} + """) + save(self, os.path.join(self.generators_folder, "wayland-protocols.pc"), wp_pkg_content) + else: + deps.build_context_activated = ["wayland-protocols"] + deps.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")) + self._create_cmake_module_variables(os.path.join(self.package_folder, self._module_vars_rel_path)) + # 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} + os.path.join(self.package_folder, self._module_target_rel_path), + targets_mapping, ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_variables(self, module_file): + """ + Define several CMake variables from upstream CMake config file not defined by default by CMakeDeps. + See https://github.com/opencv/opencv/blob/4.8.1/cmake/templates/OpenCVConfig.cmake.in + """ + v = Version(self.version) + content = textwrap.dedent(f"""\ + if(NOT DEFINED OpenCV_LIBS) + set(OpenCV_LIBS opencv::opencv) + endif() + if(NOT DEFINED OpenCV_VERSION_MAJOR) + set(OpenCV_VERSION_MAJOR {v.major}) + endif() + if(NOT DEFINED OpenCV_VERSION_MINOR) + set(OpenCV_VERSION_MINOR {v.minor}) + endif() + if(NOT DEFINED OpenCV_VERSION_PATCH) + set(OpenCV_VERSION_PATCH {v.patch}) + endif() + """) + save(self, module_file, content) + + 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)) + def _module_vars_rel_path(self): + return os.path.join("lib", "cmake", f"conan-official-{self.name}-variables.cmake") + + @property + def _module_target_rel_path(self): + 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,258 +1649,111 @@ 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 + return self.dependencies["gtk"].options.version == 2 else: - return tools.Version(gtk_version) < "3.0.0" - - @property - def _opencv_components(self): - def imageformats_deps(): - components = [] - if self.options.get_safe("with_jpeg2000"): - 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.get_safe("with_tiff"): - components.append("libtiff::libtiff") - if self.options.with_openexr: - components.append("openexr::openexr") - if self.options.with_webp: - components.append("libwebp::libwebp") - return components - - def eigen(): - return ["eigen::eigen"] if self.options.with_eigen else [] - - def parallel(): - return ["onetbb::onetbb"] if self.options.parallel == "tbb" else [] - - def quirc(): - return ["quirc::quirc"] if self.options.with_quirc else [] - - def gtk(): - return ["gtk::gtk"] if self.options.get_safe("with_gtk") else [] - - def protobuf(): - return ["protobuf::protobuf"] if self.options.dnn else [] - - def freetype(): - return ["freetype::freetype"] if self.options.get_safe("contrib_freetype") else [] + return Version(gtk_version) < "3.0.0" - def xfeatures2d(): - return ["opencv_xfeatures2d"] if self.options.contrib else [] - - def ffmpeg(): - if self.options.get_safe("with_ffmpeg"): - return [ - "ffmpeg::avcodec", - "ffmpeg::avfilter", - "ffmpeg::avformat", - "ffmpeg::avutil", - "ffmpeg::swresample", - "ffmpeg::swscale" ] - else: - return [ ] - - def ipp(): - if self.options.with_ipp: - if self.options.with_ipp == "intel-ipp": - return ["intel-ipp::intel-ipp"] - elif self.options.with_ipp == "opencv-icv" and not self.options.shared: - return ["ippiw"] - else: - return [] - else: - return [] - - opencv_components = [ - {"target": "opencv_core", "lib": "core", "requires": ["zlib::zlib"] + parallel() + eigen() + ipp()}, - {"target": "opencv_flann", "lib": "flann", "requires": ["opencv_core"] + eigen() + ipp()}, - {"target": "opencv_imgproc", "lib": "imgproc", "requires": ["opencv_core"] + eigen() + ipp()}, - {"target": "opencv_ml", "lib": "ml", "requires": ["opencv_core"] + eigen() + ipp()}, - {"target": "opencv_photo", "lib": "photo", "requires": ["opencv_core", "opencv_imgproc"] + eigen() + ipp()}, - {"target": "opencv_features2d", "lib": "features2d", "requires": ["opencv_core", "opencv_flann", "opencv_imgproc"] + eigen() + ipp()}, - {"target": "opencv_imgcodecs", "lib": "imgcodecs", "requires": ["opencv_core", "opencv_imgproc", "zlib::zlib"] + eigen() + imageformats_deps() + ipp()}, - {"target": "opencv_videoio", "lib": "videoio", "requires": ( - ["opencv_core", "opencv_imgproc", "opencv_imgcodecs"] - + eigen() + ffmpeg() + ipp())}, - {"target": "opencv_calib3d", "lib": "calib3d", "requires": ["opencv_core", "opencv_flann", "opencv_imgproc", "opencv_features2d"]+ eigen() + ipp()}, - {"target": "opencv_highgui", "lib": "highgui", "requires": ["opencv_core", "opencv_imgproc", "opencv_imgcodecs", "opencv_videoio"] + freetype() + eigen() + gtk() + ipp()}, - {"target": "opencv_stitching", "lib": "stitching", "requires": ["opencv_core", "opencv_flann", "opencv_imgproc", "opencv_features2d", "opencv_calib3d"] + xfeatures2d() + eigen() + ipp()}, - {"target": "opencv_video", "lib": "video", "requires": ["opencv_core", "opencv_flann", "opencv_imgproc", "opencv_features2d", "opencv_calib3d"] + eigen() + ipp()}, - ] - if self.options.with_ipp == "opencv-icv" and not self.options.shared: - opencv_components.extend([ - {"target": "ippiw", "lib": "ippiw", "requires": []} - ]) - - if self.options.dnn: - opencv_components.extend([ - {"target": "opencv_dnn", "lib": "dnn", "requires": ["opencv_core", "opencv_imgproc"] + protobuf() + ipp()}, - {"target": "opencv_objdetect", "lib": "objdetect", "requires": ["opencv_core", "opencv_flann", "opencv_imgproc", "opencv_features2d", "opencv_calib3d"] + eigen() + quirc() + ipp()}, - - ]) - if self.options.contrib: - opencv_components.extend([ - {"target": "opencv_phase_unwrapping", "lib": "phase_unwrapping", "requires": ["opencv_core", "opencv_imgproc"] + eigen() + ipp()}, - {"target": "opencv_plot", "lib": "plot", "requires": ["opencv_core", "opencv_imgproc"] + eigen() + ipp()}, - {"target": "opencv_quality", "lib": "quality", "requires": ["opencv_core", "opencv_imgproc", "opencv_ml"] + eigen() + ipp()}, - {"target": "opencv_reg", "lib": "reg", "requires": ["opencv_core", "opencv_imgproc"] + eigen() + ipp()}, - {"target": "opencv_surface_matching", "lib": "surface_matching", "requires": ["opencv_core", "opencv_flann"] + eigen() + ipp()}, - {"target": "opencv_xphoto", "lib": "xphoto", "requires": ["opencv_core", "opencv_imgproc", "opencv_photo"] + eigen() + ipp()}, - {"target": "opencv_fuzzy", "lib": "fuzzy", "requires": ["opencv_core", "opencv_imgproc"] + eigen() + ipp()}, - {"target": "opencv_hfs", "lib": "hfs", "requires": ["opencv_core", "opencv_imgproc"] + eigen() + ipp()}, - {"target": "opencv_img_hash", "lib": "img_hash", "requires": ["opencv_core", "opencv_imgproc"] + eigen() + ipp()}, - {"target": "opencv_line_descriptor", "lib": "line_descriptor", "requires": ["opencv_core", "opencv_flann", "opencv_imgproc", "opencv_features2d"] + eigen() + ipp()}, - {"target": "opencv_saliency", "lib": "saliency", "requires": ["opencv_core", "opencv_flann", "opencv_imgproc", "opencv_features2d"] + eigen() + ipp()}, - {"target": "opencv_datasets", "lib": "datasets", "requires": ["opencv_core", "opencv_flann", "opencv_imgproc", "opencv_ml", "opencv_imgcodecs"] + eigen() + ipp()}, - {"target": "opencv_rgbd", "lib": "rgbd", "requires": ["opencv_core", "opencv_flann", "opencv_imgproc", "opencv_features2d", "opencv_calib3d"] + eigen() + ipp()}, - {"target": "opencv_shape", "lib": "shape", "requires": ["opencv_core", "opencv_flann", "opencv_imgproc", "opencv_features2d", "opencv_calib3d"] + eigen() + ipp()}, - {"target": "opencv_structured_light", "lib": "structured_light", "requires": ["opencv_core", "opencv_flann", "opencv_imgproc", "opencv_phase_unwrapping", "opencv_features2d", "opencv_calib3d"] + eigen() + ipp()}, - {"target": "opencv_videostab", "lib": "videostab", "requires": ["opencv_core", "opencv_flann", "opencv_imgproc", "opencv_photo", "opencv_features2d", "opencv_imgcodecs", "opencv_videoio", "opencv_calib3d", "opencv_video"] + eigen() + ipp()}, - {"target": "opencv_xfeatures2d", "lib": "xfeatures2d", "requires": ["opencv_core", "opencv_flann", "opencv_imgproc", "opencv_ml", "opencv_features2d", "opencv_calib3d", "opencv_shape", ] + eigen() + ipp()}, - {"target": "opencv_ximgproc", "lib": "ximgproc", "requires": ["opencv_core", "opencv_flann", "opencv_imgproc", "opencv_features2d", "opencv_imgcodecs", "opencv_calib3d", "opencv_video"] + eigen() + ipp()}, - {"target": "opencv_aruco", "lib": "aruco", "requires": ["opencv_core", "opencv_flann", "opencv_imgproc", "opencv_features2d", "opencv_imgcodecs", "opencv_calib3d"] + eigen() + ipp()}, - {"target": "opencv_bgsegm", "lib": "bgsegm", "requires": ["opencv_core", "opencv_flann", "opencv_imgproc", "opencv_features2d", "opencv_calib3d", "opencv_video"] + eigen() + ipp()}, - {"target": "opencv_bioinspired", "lib": "bioinspired", "requires": ["opencv_core", "opencv_imgproc", "opencv_imgcodecs", "opencv_videoio", "opencv_highgui"] + eigen() + ipp()}, - {"target": "opencv_ccalib", "lib": "ccalib", "requires": ["opencv_core", "opencv_flann", "opencv_imgproc", "opencv_features2d", "opencv_imgcodecs", "opencv_videoio", "opencv_calib3d", "opencv_highgui"] + eigen() + ipp()}, - {"target": "opencv_optflow", "lib": "optflow", "requires": ["opencv_core", "opencv_flann", "opencv_imgproc", "opencv_video", "opencv_features2d", "opencv_imgcodecs", "opencv_calib3d", "opencv_video", "opencv_ximgproc"] + eigen() + ipp()}, - {"target": "opencv_superres", "lib": "superres", "requires": ["opencv_core", "opencv_flann", "opencv_imgproc", "opencv_features2d", "opencv_imgcodecs", "opencv_videoio", "opencv_calib3d", "opencv_video", "opencv_ximgproc", "opencv_optflow"] + eigen() + ipp()}, - {"target": "opencv_tracking", "lib": "tracking", "requires": ["opencv_core", "opencv_flann", "opencv_imgproc", "opencv_ml", "opencv_plot", "opencv_features2d", "opencv_imgcodecs", "opencv_calib3d", "opencv_datasets", "opencv_video"] + eigen() + ipp()}, - {"target": "opencv_stereo", "lib": "stereo", "requires": ["opencv_core", "opencv_flann", "opencv_imgproc", "opencv_ml", "opencv_plot", "opencv_features2d", "opencv_imgcodecs", "opencv_calib3d", "opencv_datasets", "opencv_video", "opencv_tracking"] + eigen() + ipp()}, - ]) - if self.options.dnn: - opencv_components.extend([ - {"target": "opencv_xobjdetect", "lib": "xobjdetect", "requires": ["opencv_core", "opencv_flann", "opencv_imgproc", "opencv_features2d", "opencv_imgcodecs", "opencv_calib3d", "opencv_objdetect"] + eigen() + ipp()}, - {"target": "opencv_dpm", "lib": "dpm", "requires": ["opencv_core", "opencv_flann", "opencv_imgproc", "opencv_features2d", "opencv_imgcodecs", "opencv_videoio", "opencv_calib3d", "opencv_highgui", "opencv_objdetect"] + eigen() + ipp()}, - {"target": "opencv_face", "lib": "face", "requires": ["opencv_core", "opencv_flann", "opencv_imgproc", "opencv_photo", "opencv_features2d", "opencv_calib3d", "opencv_objdetect"] + eigen() + ipp()} - ]) - if self.version >= "4.3.0": - opencv_components.extend([ - {"target": "opencv_intensity_transform", "lib": "intensity_transform", "requires": ["opencv_core", "opencv_imgproc"] + eigen() + ipp()}, - {"target": "opencv_alphamat", "lib": "alphamat", "requires": ["opencv_core", "opencv_imgproc"] + eigen() + ipp()}, - {"target": "opencv_rapid", "lib": "rapid", "requires": ["opencv_core", "opencv_flann", "opencv_imgproc", "opencv_features2d", "opencv_calib3d"] + eigen() + ipp()}, - ]) - - if self.options.get_safe("contrib_freetype"): - opencv_components.extend([ - {"target": "opencv_freetype", "lib": "freetype", "requires": ["opencv_core", "opencv_imgproc", "freetype::freetype", "harfbuzz::harfbuzz"] + eigen() + ipp()}, - ]) - - if self.options.get_safe("contrib_sfm"): - opencv_components.extend([ - {"target": "opencv_sfm", "lib": "sfm", "requires": ["opencv_core", "opencv_flann", "opencv_imgproc", "opencv_ml", "opencv_features2d", "opencv_imgcodecs", "opencv_calib3d", "opencv_shape", "opencv_xfeatures2d", "correspondence", "multiview", "numeric", "glog::glog", "gflags::gflags"] + eigen() + ipp()}, - {"target": "numeric", "lib": "numeric", "requires": eigen() + ipp()}, - {"target": "correspondence", "lib": "correspondence", "requires": ["multiview", "glog::glog"] + eigen() + ipp()}, - {"target": "multiview", "lib": "multiview", "requires": ["numeric", "gflags::gflags"] + eigen() + ipp()}, - ]) - - - if self.options.with_cuda: - opencv_components.extend([ - {"target": "opencv_cudaarithm", "lib": "cudaarithm", "requires": ["opencv_core"] + eigen() + ipp()}, - {"target": "opencv_cudabgsegm", "lib": "cudabgsegm", "requires": ["opencv_core", "opencv_video"] + eigen() + ipp()}, - {"target": "opencv_cudacodec", "lib": "cudacodec", "requires": ["opencv_core"] + eigen() + ipp()}, - {"target": "opencv_cudafeatures2d", "lib": "cudafeatures2d", "requires": ["opencv_core", "opencv_cudafilters"] + eigen() + ipp()}, - {"target": "opencv_cudafilters", "lib": "cudafilters", "requires": ["opencv_core", "opencv_imgproc"] + eigen() + ipp()}, - {"target": "opencv_cudaimgproc", "lib": "cudaimgproc", "requires": ["opencv_core", "opencv_imgproc"] + eigen() + ipp()}, - {"target": "opencv_cudalegacy", "lib": "cudalegacy", "requires": ["opencv_core", "opencv_video"] + eigen() + ipp()}, - {"target": "opencv_cudaobjdetect", "lib": "cudaobjdetect", "requires": ["opencv_core", "opencv_objdetect"] + eigen() + ipp()}, - {"target": "opencv_cudaoptflow", "lib": "cudaoptflow", "requires": ["opencv_core"] + eigen() + ipp()}, - {"target": "opencv_cudastereo", "lib": "cudastereo", "requires": ["opencv_core", "opencv_calib3d"] + eigen() + ipp()}, - {"target": "opencv_cudawarping", "lib": "cudawarping", "requires": ["opencv_core", "opencv_imgproc"] + eigen() + ipp()}, - {"target": "opencv_cudev", "lib": "cudev", "requires": [] + eigen() + ipp()}, - ]) - - if self.options.with_ade: - opencv_components.extend([ - {"target": "opencv_gapi", "lib": "gapi", "requires": ["opencv_imgproc", "opencv_calib3d", "opencv_video", "ade::ade"]}, - ]) - - return opencv_components + @staticmethod + def _cmake_target(module): + if module in ("ippiw", "correspondence", "multiview", "numeric"): + return module + return f"opencv_{module}" 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.settings.os == "Windows" else "" - def get_lib_name(module): + def get_libs(module): if module == "ippiw": - return "%s%s" % (module, debug) + return [ + f"{module}{debug}", + "ippicvmt" if self.settings.os == "Windows" else "ippicv", + ] elif module in ("correspondence", "multiview", "numeric"): - return module + return [module] else: - return "opencv_%s%s%s" % (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"] - # 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 + libs = [f"opencv_{module}{version}{debug}"] + if module in ["core", "world"] 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))) + return libs + + def add_components(modules): + 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_libs("world") + self.cpp_info.components["opencv_world"].resdirs = ["res"] + if self.settings.os != "Windows": + self.cpp_info.components["opencv_world"].includedirs.append(os.path.join("include", "opencv4")) + world_requires = set() + world_requires_exclude = set() + world_system_libs = set() + world_frameworks = set() + + for module, values in modules.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] - if lib_name.startswith("ippiw"): - self.cpp_info.components[conan_component].libs.append("ippicvmt" if self.settings.os == "Windows" else "ippicv") + self.cpp_info.components[conan_component].resdirs = ["res"] if self.settings.os != "Windows": self.cpp_info.components[conan_component].includedirs.append(os.path.join("include", "opencv4")) - 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"] - - 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 + + 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_libs(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: + self.cpp_info.components[conan_component].build_modules["cmake_find_package"] = [self._module_vars_rel_path, self._module_target_rel_path] + self.cpp_info.components[conan_component].build_modules["cmake_find_package_multi"] = [self._module_vars_rel_path, self._module_target_rel_path] + 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) + + # 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_vars_rel_path, self._module_target_rel_path] + self.cpp_info.components["opencv_world"].build_modules["cmake_find_package_multi"] = [self._module_vars_rel_path, self._module_target_rel_path] - add_components(self._opencv_components) + self.cpp_info.set_property("cmake_file_name", "OpenCV") + self.cpp_info.set_property("cmake_build_modules", [self._module_vars_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.components["opencv_videoio"].frameworks = ["Cocoa", "Accelerate", "AVFoundation", "CoreGraphics", "CoreMedia", "CoreVideo", "QuartzCore"] - elif self.settings.os == "iOS": - self.cpp_info.components["opencv_videoio"].frameworks = ["AVFoundation", "QuartzCore"] + 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/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-0005-tracking-no-plot-deps.patch b/recipes/opencv/4.x/patches/4.1.2-0005-tracking-no-plot-deps.patch new file mode 100644 index 0000000000000..9113058791110 --- /dev/null +++ b/recipes/opencv/4.x/patches/4.1.2-0005-tracking-no-plot-deps.patch @@ -0,0 +1,7 @@ +--- a/contrib/modules/tracking/CMakeLists.txt ++++ b/contrib/modules/tracking/CMakeLists.txt +@@ -1,3 +1,3 @@ + set(the_description "Tracking API") +-ocv_define_module(tracking opencv_imgproc opencv_core opencv_video opencv_plot OPTIONAL opencv_dnn opencv_datasets WRAP java python) ++ocv_define_module(tracking opencv_imgproc opencv_core opencv_video OPTIONAL opencv_plot opencv_dnn opencv_datasets WRAP java python) + ocv_warnings_disable(CMAKE_CXX_FLAGS -Wno-shadow /wd4458) diff --git a/recipes/opencv/4.x/patches/4.1.2-0006-hdf.patch b/recipes/opencv/4.x/patches/4.1.2-0006-hdf.patch new file mode 100644 index 0000000000000..29f4b36e65dc2 --- /dev/null +++ b/recipes/opencv/4.x/patches/4.1.2-0006-hdf.patch @@ -0,0 +1,21 @@ +--- a/contrib/modules/hdf/CMakeLists.txt ++++ b/contrib/modules/hdf/CMakeLists.txt +@@ -1,6 +1,4 @@ +-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}) +- +-if(WIN32) ++if(0) + # windows cmake internal lookups are broken for now + # will lookup for headers and shared libs given HDF_DIR env + find_path(HDF5_INCLUDE_DIRS hdf5.h HINTS "$ENV{HDF5_DIR}\\..\\include") +@@ -16,8 +14,8 @@ if(WIN32) + set(HDF5_FOUND "NO") + endif() + else() +- if(NOT CMAKE_CROSSCOMPILING) # iOS build should not reuse OSX package +- find_package(HDF5) ++ if(1) ++ find_package(HDF5 CONFIG) + endif() + endif() + 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.1.2-0008-link-qt-targets.patch b/recipes/opencv/4.x/patches/4.1.2-0008-link-qt-targets.patch new file mode 100644 index 0000000000000..b32a2916816cb --- /dev/null +++ b/recipes/opencv/4.x/patches/4.1.2-0008-link-qt-targets.patch @@ -0,0 +1,29 @@ +--- a/contrib/modules/cvv/CMakeLists.txt ++++ b/contrib/modules/cvv/CMakeLists.txt +@@ -14,7 +14,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) + foreach(dt5_dep Core Gui Widgets) + add_definitions(${Qt5${dt5_dep}_DEFINITIONS}) + include_directories(${Qt5${dt5_dep}_INCLUDE_DIRS}) +- list(APPEND CVV_LIBRARIES ${Qt5${dt5_dep}_LIBRARIES}) ++ list(APPEND CVV_LIBRARIES Qt5::${dt5_dep}) + endforeach() + + ocv_glob_module_sources() +--- a/modules/highgui/CMakeLists.txt ++++ b/modules/highgui/CMakeLists.txt +@@ -58,13 +58,13 @@ if(HAVE_QT5) + foreach(dt5_dep Core Gui Widgets Test Concurrent) + add_definitions(${Qt5${dt5_dep}_DEFINITIONS}) + include_directories(${Qt5${dt5_dep}_INCLUDE_DIRS}) +- list(APPEND HIGHGUI_LIBRARIES ${Qt5${dt5_dep}_LIBRARIES}) ++ list(APPEND HIGHGUI_LIBRARIES Qt5::${dt5_dep}) + endforeach() + + if(HAVE_QT_OPENGL) + add_definitions(${Qt5OpenGL_DEFINITIONS}) + include_directories(${Qt5OpenGL_INCLUDE_DIRS}) +- list(APPEND HIGHGUI_LIBRARIES ${Qt5OpenGL_LIBRARIES}) ++ list(APPEND HIGHGUI_LIBRARIES Qt5::OpenGL) + endif() + + elseif(HAVE_QT) diff --git a/recipes/opencv/4.x/patches/4.1.2-0009-sfm-deps.patch b/recipes/opencv/4.x/patches/4.1.2-0009-sfm-deps.patch new file mode 100644 index 0000000000000..c4ff008107555 --- /dev/null +++ b/recipes/opencv/4.x/patches/4.1.2-0009-sfm-deps.patch @@ -0,0 +1,49 @@ +--- a/contrib/modules/sfm/CMakeLists.txt ++++ b/contrib/modules/sfm/CMakeLists.txt +@@ -9,8 +9,14 @@ find_package(Ceres QUIET) + if(NOT Ceres_FOUND) # Looks like Ceres find glog on the own, so separate search isn't necessary + find_package(Glog QUIET) + endif() ++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() + +-if((gflags_FOUND OR GFLAGS_FOUND OR GFLAGS_INCLUDE_DIRS) AND (glog_FOUND OR GLOG_FOUND OR GLOG_INCLUDE_DIRS)) ++if(0) + set(_fname "${CMAKE_CURRENT_BINARY_DIR}/test_sfm_deps.cpp") + file(WRITE "${_fname}" "#include \n#include \nint main() { (void)(0); return 0; }\n") + try_compile(SFM_DEPS_OK "${CMAKE_BINARY_DIR}" "${_fname}" +@@ -21,7 +27,7 @@ if((gflags_FOUND OR GFLAGS_FOUND OR GFLAGS_INCLUDE_DIRS) AND (glog_FOUND OR GLOG + file(REMOVE "${_fname}") + message(STATUS "Checking SFM deps... ${SFM_DEPS_OK}") + else() +- set(SFM_DEPS_OK FALSE) ++ set(SFM_DEPS_OK TRUE) + endif() + + if(NOT HAVE_EIGEN OR NOT SFM_DEPS_OK) +--- a/contrib/modules/sfm/src/libmv_light/libmv/correspondence/CMakeLists.txt ++++ b/contrib/modules/sfm/src/libmv_light/libmv/correspondence/CMakeLists.txt +@@ -8,7 +8,7 @@ FILE(GLOB CORRESPONDENCE_HDRS *.h) + + ADD_LIBRARY(correspondence STATIC ${CORRESPONDENCE_SRC} ${CORRESPONDENCE_HDRS}) + +-TARGET_LINK_LIBRARIES(correspondence LINK_PRIVATE ${GLOG_LIBRARY} multiview) ++TARGET_LINK_LIBRARIES(correspondence LINK_PRIVATE ${GLOG_LIBRARIES} multiview) + IF(TARGET Eigen3::Eigen) + TARGET_LINK_LIBRARIES(correspondence LINK_PUBLIC Eigen3::Eigen) + ENDIF() +--- a/contrib/modules/sfm/src/libmv_light/libmv/multiview/CMakeLists.txt ++++ b/contrib/modules/sfm/src/libmv_light/libmv/multiview/CMakeLists.txt +@@ -17,7 +17,7 @@ SET(MULTIVIEW_SRC conditioning.cc + FILE(GLOB MULTIVIEW_HDRS *.h) + + ADD_LIBRARY(multiview STATIC ${MULTIVIEW_SRC} ${MULTIVIEW_HDRS}) +-TARGET_LINK_LIBRARIES(multiview LINK_PRIVATE ${GLOG_LIBRARY} numeric) ++TARGET_LINK_LIBRARIES(multiview LINK_PRIVATE ${GLOG_LIBRARIES} numeric) + IF(TARGET Eigen3::Eigen) + TARGET_LINK_LIBRARIES(multiview LINK_PUBLIC Eigen3::Eigen) + ENDIF() diff --git a/recipes/opencv/4.x/patches/4.1.2-0010-compat-protobuf-ge-3.18.patch b/recipes/opencv/4.x/patches/4.1.2-0010-compat-protobuf-ge-3.18.patch new file mode 100644 index 0000000000000..5bd6bfd1b3816 --- /dev/null +++ b/recipes/opencv/4.x/patches/4.1.2-0010-compat-protobuf-ge-3.18.patch @@ -0,0 +1,22 @@ +--- a/modules/dnn/src/caffe/caffe_io.cpp ++++ b/modules/dnn/src/caffe/caffe_io.cpp +@@ -92,6 +92,7 @@ + #ifdef HAVE_PROTOBUF + #include + #include ++#include + #include + + #include +@@ -1111,7 +1112,11 @@ static const int kProtoReadBytesLimit = INT_MAX; // Max size of 2 GB minus 1 by + + bool ReadProtoFromBinary(ZeroCopyInputStream* input, Message *proto) { + CodedInputStream coded_input(input); ++#if GOOGLE_PROTOBUF_VERSION >= 3006000 ++ coded_input.SetTotalBytesLimit(kProtoReadBytesLimit); ++#else + coded_input.SetTotalBytesLimit(kProtoReadBytesLimit, 536870912); ++#endif + + return proto->ParseFromCodedStream(&coded_input); + } diff --git a/recipes/opencv/4.x/patches/4.1.2-0011-compat-openexr3.patch b/recipes/opencv/4.x/patches/4.1.2-0011-compat-openexr3.patch new file mode 100644 index 0000000000000..3854d36a913a0 --- /dev/null +++ b/recipes/opencv/4.x/patches/4.1.2-0011-compat-openexr3.patch @@ -0,0 +1,10 @@ +--- a/modules/imgcodecs/src/grfmt_exr.cpp ++++ b/modules/imgcodecs/src/grfmt_exr.cpp +@@ -56,6 +56,7 @@ + #include + #include + ++#include + #include + #include + #include diff --git a/recipes/opencv/4.x/patches/4.10.0-0001-fix-zlib-static-android.patch b/recipes/opencv/4.x/patches/4.10.0-0001-fix-zlib-static-android.patch new file mode 100644 index 0000000000000..aae16f037e565 --- /dev/null +++ b/recipes/opencv/4.x/patches/4.10.0-0001-fix-zlib-static-android.patch @@ -0,0 +1,17 @@ +--- a/cmake/OpenCVFindLibsGrfmt.cmake ++++ b/cmake/OpenCVFindLibsGrfmt.cmake +@@ -20,12 +20,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.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.1-0001-tracking-no-plot-deps.patch b/recipes/opencv/4.x/patches/4.5.1-0001-tracking-no-plot-deps.patch new file mode 100644 index 0000000000000..6e57a96b98355 --- /dev/null +++ b/recipes/opencv/4.x/patches/4.5.1-0001-tracking-no-plot-deps.patch @@ -0,0 +1,13 @@ +--- a/contrib/modules/tracking/CMakeLists.txt ++++ b/contrib/modules/tracking/CMakeLists.txt +@@ -9,9 +9,9 @@ ocv_define_module(tracking + opencv_imgproc + opencv_core + opencv_video +- opencv_plot # samples only + ${debug_modules} + OPTIONAL ++ opencv_plot + opencv_dnn + opencv_datasets + opencv_highgui diff --git a/recipes/opencv/4.x/patches/4.5.1-0002-alphamat-header.patch b/recipes/opencv/4.x/patches/4.5.1-0002-alphamat-header.patch new file mode 100644 index 0000000000000..847eeaa9e9869 --- /dev/null +++ b/recipes/opencv/4.x/patches/4.5.1-0002-alphamat-header.patch @@ -0,0 +1,11 @@ +--- a/contrib/modules/alphamat/include/opencv2/alphamat.hpp ++++ b/contrib/modules/alphamat/include/opencv2/alphamat.hpp +@@ -7,6 +7,8 @@ + #ifndef _OPENCV_ALPHAMAT_HPP_ + #define _OPENCV_ALPHAMAT_HPP_ + ++#include ++ + /** + * @defgroup alphamat Alpha Matting + * Alpha matting is used to extract a foreground object with soft boundaries from a background image. 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.3-0002-link-qt-targets.patch b/recipes/opencv/4.x/patches/4.5.3-0002-link-qt-targets.patch new file mode 100644 index 0000000000000..b9b34a95156fe --- /dev/null +++ b/recipes/opencv/4.x/patches/4.5.3-0002-link-qt-targets.patch @@ -0,0 +1,30 @@ +--- a/contrib/modules/cvv/CMakeLists.txt ++++ b/contrib/modules/cvv/CMakeLists.txt +@@ -14,7 +14,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) + foreach(dt5_dep Core Gui Widgets) + add_definitions(${Qt5${dt5_dep}_DEFINITIONS}) + include_directories(${Qt5${dt5_dep}_INCLUDE_DIRS}) +- list(APPEND CVV_LIBRARIES ${Qt5${dt5_dep}_LIBRARIES}) ++ list(APPEND CVV_LIBRARIES Qt5::${dt5_dep}) + endforeach() + + ocv_glob_module_sources() +--- a/modules/highgui/CMakeLists.txt ++++ b/modules/highgui/CMakeLists.txt +@@ -69,14 +69,14 @@ if(HAVE_QT5) + foreach(dt5_dep Core Gui Widgets Test Concurrent) + add_definitions(${Qt5${dt5_dep}_DEFINITIONS}) + include_directories(${Qt5${dt5_dep}_INCLUDE_DIRS}) +- list(APPEND HIGHGUI_LIBRARIES ${Qt5${dt5_dep}_LIBRARIES}) ++ list(APPEND HIGHGUI_LIBRARIES Qt5::${dt5_dep}) + endforeach() + + if(HAVE_QT_OPENGL) + add_definitions(-DHAVE_QT_OPENGL) + add_definitions(${Qt5OpenGL_DEFINITIONS}) + include_directories(${Qt5OpenGL_INCLUDE_DIRS}) +- list(APPEND HIGHGUI_LIBRARIES ${Qt5OpenGL_LIBRARIES}) ++ list(APPEND HIGHGUI_LIBRARIES Qt5::OpenGL) + endif() + elseif(HAVE_QT) + set(OPENCV_HIGHGUI_BUILTIN_BACKEND "QT4") 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/patches/4.5.5-0002-objdetect-without-dnn.patch b/recipes/opencv/4.x/patches/4.5.5-0002-objdetect-without-dnn.patch new file mode 100644 index 0000000000000..5313e7b762001 --- /dev/null +++ b/recipes/opencv/4.x/patches/4.5.5-0002-objdetect-without-dnn.patch @@ -0,0 +1,97 @@ +--- a/modules/objdetect/CMakeLists.txt ++++ b/modules/objdetect/CMakeLists.txt +@@ -1,5 +1,16 @@ + set(the_description "Object Detection") +-ocv_define_module(objdetect opencv_core opencv_imgproc opencv_calib3d opencv_dnn WRAP java objc python js) ++ocv_define_module(objdetect ++ opencv_core ++ opencv_imgproc ++ opencv_calib3d ++ OPTIONAL ++ opencv_dnn ++ WRAP ++ python ++ java ++ objc ++ js ++) + + if(HAVE_QUIRC) + get_property(QUIRC_INCLUDE GLOBAL PROPERTY QUIRC_INCLUDE_DIR) +--- a/modules/objdetect/src/face_detect.cpp ++++ b/modules/objdetect/src/face_detect.cpp +@@ -6,13 +6,16 @@ + + #include "opencv2/imgproc.hpp" + #include "opencv2/core.hpp" ++#ifdef HAVE_OPENCV_DNN + #include "opencv2/dnn.hpp" ++#endif + + #include + + namespace cv + { + ++#ifdef HAVE_OPENCV_DNN + class FaceDetectorYNImpl : public FaceDetectorYN + { + public: +@@ -273,6 +276,7 @@ class FaceDetectorYNImpl : public FaceDetectorYN + + std::vector priors; + }; ++#endif + + Ptr FaceDetectorYN::create(const String& model, + const String& config, +@@ -283,7 +287,12 @@ Ptr FaceDetectorYN::create(const String& model, + const int backend_id, + const int target_id) + { ++#ifdef HAVE_OPENCV_DNN + return makePtr(model, config, input_size, score_threshold, nms_threshold, top_k, backend_id, target_id); ++#else ++ CV_UNUSED(model); CV_UNUSED(config); CV_UNUSED(input_size); CV_UNUSED(score_threshold); CV_UNUSED(nms_threshold); CV_UNUSED(top_k); CV_UNUSED(backend_id); CV_UNUSED(target_id); ++ CV_Error(cv::Error::StsNotImplemented, "cv::FaceDetectorYN requires enabled 'dnn' module."); ++#endif + } + + } // namespace cv +--- a/modules/objdetect/src/face_recognize.cpp ++++ b/modules/objdetect/src/face_recognize.cpp +@@ -4,13 +4,17 @@ + + #include "precomp.hpp" + ++#include "opencv2/core.hpp" ++#ifdef HAVE_OPENCV_DNN + #include "opencv2/dnn.hpp" ++#endif + + #include + + namespace cv + { + ++#ifdef HAVE_OPENCV_DNN + class FaceRecognizerSFImpl : public FaceRecognizerSF + { + public: +@@ -173,10 +177,16 @@ class FaceRecognizerSFImpl : public FaceRecognizerSF + private: + dnn::Net net; + }; ++#endif + + Ptr FaceRecognizerSF::create(const String& model, const String& config, int backend_id, int target_id) + { ++#ifdef HAVE_OPENCV_DNN + return makePtr(model, config, backend_id, target_id); ++#else ++ CV_UNUSED(model); CV_UNUSED(config); CV_UNUSED(backend_id); CV_UNUSED(target_id); ++ CV_Error(cv::Error::StsNotImplemented, "cv::FaceRecognizerSF requires enabled 'dnn' module"); ++#endif + } + + } // namespace cv diff --git a/recipes/opencv/4.x/patches/4.5.5-0003-find-quirc.patch b/recipes/opencv/4.x/patches/4.5.5-0003-find-quirc.patch new file mode 100644 index 0000000000000..e53df28368b3b --- /dev/null +++ b/recipes/opencv/4.x/patches/4.5.5-0003-find-quirc.patch @@ -0,0 +1,12 @@ +--- a/modules/objdetect/CMakeLists.txt ++++ b/modules/objdetect/CMakeLists.txt +@@ -13,7 +13,6 @@ ocv_define_module(objdetect + ) + + 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) + endif() diff --git a/recipes/opencv/4.x/patches/4.5.5-0004-link-qt-targets.patch b/recipes/opencv/4.x/patches/4.5.5-0004-link-qt-targets.patch new file mode 100644 index 0000000000000..4c497271a4d6a --- /dev/null +++ b/recipes/opencv/4.x/patches/4.5.5-0004-link-qt-targets.patch @@ -0,0 +1,22 @@ +--- a/contrib/modules/cvv/CMakeLists.txt ++++ b/contrib/modules/cvv/CMakeLists.txt +@@ -14,7 +14,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) + foreach(dt5_dep Core Gui Widgets) + add_definitions(${Qt5${dt5_dep}_DEFINITIONS}) + include_directories(${Qt5${dt5_dep}_INCLUDE_DIRS}) +- list(APPEND CVV_LIBRARIES ${Qt5${dt5_dep}_LIBRARIES}) ++ list(APPEND CVV_LIBRARIES Qt5::${dt5_dep}) + endforeach() + + ocv_glob_module_sources() +--- a/modules/highgui/CMakeLists.txt ++++ b/modules/highgui/CMakeLists.txt +@@ -89,7 +89,7 @@ if(HAVE_QT) + foreach(dt_dep ${qt_deps}) + add_definitions(${Qt${QT_VERSION_MAJOR}${dt_dep}_DEFINITIONS}) + include_directories(${Qt${QT_VERSION_MAJOR}${dt_dep}_INCLUDE_DIRS}) +- list(APPEND HIGHGUI_LIBRARIES ${Qt${QT_VERSION_MAJOR}${dt_dep}_LIBRARIES}) ++ list(APPEND HIGHGUI_LIBRARIES Qt${QT_VERSION_MAJOR}::${dt_dep}) + endforeach() + else() + ocv_assert(QT_VERSION_MAJOR EQUAL 4) diff --git a/recipes/opencv/4.x/patches/4.8.1-0001-find-ade.patch b/recipes/opencv/4.x/patches/4.8.1-0001-find-ade.patch new file mode 100644 index 0000000000000..0e70b9535811f --- /dev/null +++ b/recipes/opencv/4.x/patches/4.8.1-0001-find-ade.patch @@ -0,0 +1,11 @@ +--- a/modules/gapi/cmake/init.cmake ++++ b/modules/gapi/cmake/init.cmake +@@ -8,7 +8,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.8.1-0002-mingw-disable-obsensor.patch b/recipes/opencv/4.x/patches/4.8.1-0002-mingw-disable-obsensor.patch new file mode 100644 index 0000000000000..33c9550f7c325 --- /dev/null +++ b/recipes/opencv/4.x/patches/4.8.1-0002-mingw-disable-obsensor.patch @@ -0,0 +1,11 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -468,7 +468,7 @@ OCV_OPTION(WITH_TIMVX "Include Tim-VX support" OFF + VISIBLE_IF TRUE + VERIFY HAVE_TIMVX) + OCV_OPTION(WITH_OBSENSOR "Include obsensor support (Orbbec RGB-D modules: Astra+/Femto)" ON +- VISIBLE_IF (WIN32 AND NOT ARM AND NOT WINRT) OR ( UNIX AND NOT APPLE AND NOT ANDROID) ++ VISIBLE_IF (WIN32 AND NOT ARM AND NOT WINRT AND NOT MINGW) OR ( UNIX AND NOT APPLE AND NOT ANDROID) + VERIFY HAVE_OBSENSOR) + OCV_OPTION(WITH_CANN "Include CANN support" OFF + VISIBLE_IF TRUE diff --git a/recipes/opencv/4.x/patches/4.8.1-0004-link-qt-targets.patch b/recipes/opencv/4.x/patches/4.8.1-0004-link-qt-targets.patch new file mode 100644 index 0000000000000..d4ceb77155293 --- /dev/null +++ b/recipes/opencv/4.x/patches/4.8.1-0004-link-qt-targets.patch @@ -0,0 +1,22 @@ +--- a/contrib/modules/cvv/CMakeLists.txt ++++ b/contrib/modules/cvv/CMakeLists.txt +@@ -18,7 +18,7 @@ + set(CMAKE_AUTOMOC ON) + set(CMAKE_INCLUDE_CURRENT_DIR ON) + foreach(module ${CVV_QT_MODULES}) +- list(APPEND CVV_LIBRARIES ${Qt${QT_VERSION_MAJOR}${module}_LIBRARIES}) ++ list(APPEND CVV_LIBRARIES Qt${QT_VERSION_MAJOR}::${module}) + endforeach() + + ocv_glob_module_sources() +--- a/modules/highgui/CMakeLists.txt ++++ b/modules/highgui/CMakeLists.txt +@@ -116,7 +116,7 @@ if(HAVE_QT) + foreach(dt_dep ${qt_deps}) + add_definitions(${Qt${QT_VERSION_MAJOR}${dt_dep}_DEFINITIONS}) + include_directories(${Qt${QT_VERSION_MAJOR}${dt_dep}_INCLUDE_DIRS}) +- list(APPEND HIGHGUI_LIBRARIES ${Qt${QT_VERSION_MAJOR}${dt_dep}_LIBRARIES}) ++ list(APPEND HIGHGUI_LIBRARIES Qt${QT_VERSION_MAJOR}::${dt_dep}) + endforeach() + else() + ocv_assert(QT_VERSION_MAJOR EQUAL 4) diff --git a/recipes/opencv/4.x/test_package/CMakeLists.txt b/recipes/opencv/4.x/test_package/CMakeLists.txt index 3361bc4c26e1f..5404f6ff23915 100644 --- a/recipes/opencv/4.x/test_package/CMakeLists.txt +++ b/recipes/opencv/4.x/test_package/CMakeLists.txt @@ -1,33 +1,33 @@ -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() -find_package(OpenCV REQUIRED imgcodecs highgui objdetect CONFIG) - -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() +set(TESTED_MODULES + # Main modules + "calib3d" "core" "dnn" "features2d" "flann" "gapi" "highgui" "imgcodecs" + "imgproc" "ml" "objdetect" "photo" "stitching" "video" "videoio" + # Extra modules + "alphamat" "aruco" "bgsegm" "bioinspired" "ccalib" "datasets" "dnn_superres" + "face" "freetype" "fuzzy" "hdf" "hfs" "img_hash" "intensity_transform" + "line_descriptor" "mcc" "optflow" "phase_unwrapping" "plot" "quality" "reg" + "rgbd" "saliency" "sfm" "shape" "structured_light" "superres" + "surface_matching" "text" "tracking" "wechat_qrcode" "xfeatures2d" + "ximgproc" "xobjdetect" "xphoto" +) -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 core CONFIG) -add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} - opencv_imgcodecs - opencv_highgui - opencv_objdetect - $ - $ - $ -) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +foreach(_module ${TESTED_MODULES}) + string(TOUPPER ${_module} _module_upper) + if(OPENCV_WITH_${_module_upper}) + set(_test_target test_${_module}) + set(_module_target opencv_${_module}) + add_executable(${_test_target} ${_test_target}.cpp) + target_link_libraries(${_test_target} PRIVATE ${_module_target}) + target_compile_features(${_test_target} PRIVATE cxx_std_11) + if(NOT ${_module} STREQUAL "highgui") + add_test(NAME ${_test_target} COMMAND ${_test_target}) + endif() + endif() +endforeach() diff --git a/recipes/opencv/4.x/test_package/conanfile.py b/recipes/opencv/4.x/test_package/conanfile.py index 1c034b84e089a..e5b25fb84dd4b 100644 --- a/recipes/opencv/4.x/test_package/conanfile.py +++ b/recipes/opencv/4.x/test_package/conanfile.py @@ -1,20 +1,55 @@ -from conans import ConanFile, CMake, tools -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" + generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + @property + def _tested_modules(self): + return [ + # Main modules + "calib3d", "core", "dnn", "features2d", "flann", "gapi", "highgui", "imgcodecs", + "imgproc", "ml", "objdetect", "photo", "stitching", "video", "videoio", + # Extra modules + "alphamat", "aruco", "bgsegm", "bioinspired", "ccalib", "datasets", "dnn_superres", + "face", "freetype", "fuzzy", "hdf", "hfs", "img_hash", "intensity_transform", + "line_descriptor", "mcc", "optflow", "phase_unwrapping", "plot", "quality", "reg", + "rgbd", "saliency", "sfm", "shape", "structured_light", "superres", + "surface_matching", "text", "tracking", "wechat_qrcode", "xfeatures2d", + "ximgproc", "xobjdetect", "xphoto", + ] + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def generate(self): + tc = CMakeToolchain(self) + for module in self._tested_modules: + cmake_option = f"OPENCV_WITH_{module.upper()}" + if module == "core": + tc.variables[cmake_option] = True + elif module == "imgcodecs": + tc.variables[cmake_option] = self.dependencies["opencv"].options.imgcodecs and self.dependencies["opencv"].options.with_png + elif module == "videoio": + tc.variables[cmake_option] = self.dependencies["opencv"].options.videoio and self.dependencies["opencv"].options.with_ffmpeg + else: + tc.variables[cmake_option] = self.dependencies["opencv"].options.get_safe(module, False) + 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): + 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/opencv/4.x/test_package/test_alphamat.cpp b/recipes/opencv/4.x/test_package/test_alphamat.cpp new file mode 100644 index 0000000000000..af8ea966d9715 --- /dev/null +++ b/recipes/opencv/4.x/test_package/test_alphamat.cpp @@ -0,0 +1,10 @@ +#include +#include + +int main() { + cv::Mat image = cv::Mat::ones(400, 400, CV_8UC3) * 50; + cv::Mat tmap = cv::Mat::ones(400, 400, CV_8U) * 120; + cv::Mat result; + cv::alphamat::infoFlow(image, tmap, result); + return 0; +} diff --git a/recipes/opencv/4.x/test_package/test_aruco.cpp b/recipes/opencv/4.x/test_package/test_aruco.cpp new file mode 100644 index 0000000000000..bc510aeaf4b18 --- /dev/null +++ b/recipes/opencv/4.x/test_package/test_aruco.cpp @@ -0,0 +1,9 @@ +#include +#include + +int main() { + cv::Mat markerImage; + auto dictionary = cv::aruco::getPredefinedDictionary(cv::aruco::DICT_6X6_250); + cv::aruco::drawMarker(dictionary, 23, 200, markerImage, 1); + return 0; +} diff --git a/recipes/opencv/4.x/test_package/test_bgsegm.cpp b/recipes/opencv/4.x/test_package/test_bgsegm.cpp new file mode 100644 index 0000000000000..ba01af2fd1861 --- /dev/null +++ b/recipes/opencv/4.x/test_package/test_bgsegm.cpp @@ -0,0 +1,6 @@ +#include + +int main() { + auto bkg_subtractor = cv::bgsegm::createBackgroundSubtractorCNT(); + return 0; +} diff --git a/recipes/opencv/4.x/test_package/test_bioinspired.cpp b/recipes/opencv/4.x/test_package/test_bioinspired.cpp new file mode 100644 index 0000000000000..219fc935596f3 --- /dev/null +++ b/recipes/opencv/4.x/test_package/test_bioinspired.cpp @@ -0,0 +1,6 @@ +#include + +int main() { + auto retina_tone_mapping = cv::bioinspired::RetinaFastToneMapping::create(cv::Size(10, 10)); + return 0; +} diff --git a/recipes/opencv/4.x/test_package/test_calib3d.cpp b/recipes/opencv/4.x/test_package/test_calib3d.cpp new file mode 100644 index 0000000000000..ce5c7e8b7c821 --- /dev/null +++ b/recipes/opencv/4.x/test_package/test_calib3d.cpp @@ -0,0 +1,26 @@ +#include +#include + +#include +#include + +int main() { + const int point_count = 100; + std::vector points1; + points1.reserve(point_count); + std::vector points2; + points2.reserve(point_count); + for (int i = 0; i < point_count; ++i) { + points1.emplace_back( + cv::Point2f(static_cast(100 + 30 * std::cos(i * CV_PI * 2 / 5)), + static_cast(100 - 30 * std::sin(i * CV_PI * 2 / 5))) + ); + points2.emplace_back( + cv::Point2f(static_cast(100 + 30 * std::sin(i * CV_PI * 2 / 5)), + static_cast(100 - 30 * std::cos(i * CV_PI * 2 / 5))) + ); + } + auto fundamental_matrix = cv::findFundamentalMat(points1, points2, cv::FM_RANSAC, 3, 0.99); + + return 0; +} diff --git a/recipes/opencv/4.x/test_package/test_ccalib.cpp b/recipes/opencv/4.x/test_package/test_ccalib.cpp new file mode 100644 index 0000000000000..079bcb7ba21ce --- /dev/null +++ b/recipes/opencv/4.x/test_package/test_ccalib.cpp @@ -0,0 +1,8 @@ +#include + +int main() { + cv::randpattern::RandomPatternGenerator generator(50, 50); + generator.generatePattern(); + auto pattern = generator.getPattern(); + return 0; +} diff --git a/recipes/opencv/4.x/test_package/test_core.cpp b/recipes/opencv/4.x/test_package/test_core.cpp new file mode 100644 index 0000000000000..b9635e35d0fc8 --- /dev/null +++ b/recipes/opencv/4.x/test_package/test_core.cpp @@ -0,0 +1,6 @@ +#include + +int main() { + cv::Mat m = cv::Mat::zeros(400, 400, CV_8UC3); + return 0; +} diff --git a/recipes/opencv/4.x/test_package/test_datasets.cpp b/recipes/opencv/4.x/test_package/test_datasets.cpp new file mode 100644 index 0000000000000..16c5eca1c9205 --- /dev/null +++ b/recipes/opencv/4.x/test_package/test_datasets.cpp @@ -0,0 +1,6 @@ +#include + +int main() { + auto dataset = cv::datasets::AR_hmdb::create(); + return 0; +} diff --git a/recipes/opencv/4.x/test_package/test_dnn.cpp b/recipes/opencv/4.x/test_package/test_dnn.cpp new file mode 100644 index 0000000000000..3d8474fcdd230 --- /dev/null +++ b/recipes/opencv/4.x/test_package/test_dnn.cpp @@ -0,0 +1,6 @@ +#include + +int main() { + auto backends = cv::dnn::getAvailableBackends(); + return 0; +} diff --git a/recipes/opencv/4.x/test_package/test_dnn_superres.cpp b/recipes/opencv/4.x/test_package/test_dnn_superres.cpp new file mode 100644 index 0000000000000..bbe3442b46dc4 --- /dev/null +++ b/recipes/opencv/4.x/test_package/test_dnn_superres.cpp @@ -0,0 +1,6 @@ +#include + +int main() { + cv::dnn_superres::DnnSuperResImpl dnn_superres_impl; + return 0; +} diff --git a/recipes/opencv/4.x/test_package/test_face.cpp b/recipes/opencv/4.x/test_package/test_face.cpp new file mode 100644 index 0000000000000..9e3953a255cc0 --- /dev/null +++ b/recipes/opencv/4.x/test_package/test_face.cpp @@ -0,0 +1,6 @@ +#include + +int main() { + auto face_recognizer = cv::face::FisherFaceRecognizer::create(); + return 0; +} diff --git a/recipes/opencv/4.x/test_package/test_features2d.cpp b/recipes/opencv/4.x/test_package/test_features2d.cpp new file mode 100644 index 0000000000000..2154a2126ebb1 --- /dev/null +++ b/recipes/opencv/4.x/test_package/test_features2d.cpp @@ -0,0 +1,6 @@ +#include + +int main() { + auto matcher = cv::DescriptorMatcher::create(cv::DescriptorMatcher::BRUTEFORCE); + return 0; +} diff --git a/recipes/opencv/4.x/test_package/test_flann.cpp b/recipes/opencv/4.x/test_package/test_flann.cpp new file mode 100644 index 0000000000000..0461a2651192b --- /dev/null +++ b/recipes/opencv/4.x/test_package/test_flann.cpp @@ -0,0 +1,28 @@ +#include +#include + +#include +#include + +int main() { + const int point_count = 100; + std::vector points; + points.reserve(point_count); + for (int i = 0; i < point_count; ++i) { + points.emplace_back( + cv::Point2f(static_cast(100 + 30 * std::cos(i * CV_PI * 2 / 5)), + static_cast(100 - 30 * std::sin(i * CV_PI * 2 / 5))) + ); + } + + cv::flann::KDTreeIndexParams indexParams; + cv::flann::Index kdtree(cv::Mat(points).reshape(1), indexParams); + + std::vector query{110, 98}; + + std::vector indices; + std::vector dists; + kdtree.knnSearch(query, indices, dists, 3); + + return 0; +} diff --git a/recipes/opencv/4.x/test_package/test_freetype.cpp b/recipes/opencv/4.x/test_package/test_freetype.cpp new file mode 100644 index 0000000000000..49ee14c10ed6a --- /dev/null +++ b/recipes/opencv/4.x/test_package/test_freetype.cpp @@ -0,0 +1,6 @@ +#include + +int main() { + auto ft2 = cv::freetype::createFreeType2(); + return 0; +} diff --git a/recipes/opencv/4.x/test_package/test_fuzzy.cpp b/recipes/opencv/4.x/test_package/test_fuzzy.cpp new file mode 100644 index 0000000000000..ad4485785acc4 --- /dev/null +++ b/recipes/opencv/4.x/test_package/test_fuzzy.cpp @@ -0,0 +1,9 @@ +#include +#include + +int main() { + cv::Mat image = cv::Mat::zeros(400, 400, CV_8UC3); + cv::Mat output; + cv::ft::FT02D_FL_process(image, 10, output); + return 0; +} diff --git a/recipes/opencv/4.x/test_package/test_gapi.cpp b/recipes/opencv/4.x/test_package/test_gapi.cpp new file mode 100644 index 0000000000000..1894733df9580 --- /dev/null +++ b/recipes/opencv/4.x/test_package/test_gapi.cpp @@ -0,0 +1,18 @@ +#include +#include +#include + +int main() { + // derived from https://docs.opencv.org/4.5.0/d0/d1e/gapi.html + cv::GMat in; + cv::GMat vga = cv::gapi::resize(in, cv::Size(), 0.5, 0.5); + cv::GMat gray = cv::gapi::BGR2Gray(vga); + cv::GMat blurred = cv::gapi::blur(gray, cv::Size(5,5)); + cv::GMat edges = cv::gapi::Canny(blurred, 32, 128, 3); + cv::GMat b,g,r; + std::tie(b,g,r) = cv::gapi::split3(vga); + cv::GMat out = cv::gapi::merge3(b, g | edges, r); + cv::GComputation ac(in, out); + + return 0; +} diff --git a/recipes/opencv/4.x/test_package/test_hdf.cpp b/recipes/opencv/4.x/test_package/test_hdf.cpp new file mode 100644 index 0000000000000..94d3e97ba46b4 --- /dev/null +++ b/recipes/opencv/4.x/test_package/test_hdf.cpp @@ -0,0 +1,6 @@ +#include + +int main() { + auto hdf5 = cv::hdf::open("test_package_hdf.h5"); + return 0; +} diff --git a/recipes/opencv/4.x/test_package/test_hfs.cpp b/recipes/opencv/4.x/test_package/test_hfs.cpp new file mode 100644 index 0000000000000..8d5391b6b1421 --- /dev/null +++ b/recipes/opencv/4.x/test_package/test_hfs.cpp @@ -0,0 +1,6 @@ +#include + +int main() { + auto hfs_segment = cv::hfs::HfsSegment::create(100, 100); + return 0; +} diff --git a/recipes/opencv/4.x/test_package/test_highgui.cpp b/recipes/opencv/4.x/test_package/test_highgui.cpp new file mode 100644 index 0000000000000..69025d66e0e23 --- /dev/null +++ b/recipes/opencv/4.x/test_package/test_highgui.cpp @@ -0,0 +1,8 @@ +#include +#include + +int main() { + cv::Mat image = cv::Mat::zeros(400, 400, CV_8UC3); + cv::imshow("test highgui", image); + return 0; +} diff --git a/recipes/opencv/4.x/test_package/test_img_hash.cpp b/recipes/opencv/4.x/test_package/test_img_hash.cpp new file mode 100644 index 0000000000000..73ca684981092 --- /dev/null +++ b/recipes/opencv/4.x/test_package/test_img_hash.cpp @@ -0,0 +1,10 @@ +#include +#include + +int main() { + cv::Mat image = cv::Mat::zeros(400, 400, CV_8UC3); + auto func = cv::img_hash::AverageHash::create(); + cv::Mat hash; + func->compute(image, hash); + return 0; +} diff --git a/recipes/opencv/4.x/test_package/test_imgcodecs.cpp b/recipes/opencv/4.x/test_package/test_imgcodecs.cpp new file mode 100644 index 0000000000000..909d28ae9465d --- /dev/null +++ b/recipes/opencv/4.x/test_package/test_imgcodecs.cpp @@ -0,0 +1,9 @@ +#include +#include + +int main() { + cv::Mat img = cv::Mat::zeros(400, 400, CV_8UC3); + cv::imwrite("test_imgcodecs.png", img); + + return 0; +} diff --git a/recipes/opencv/4.x/test_package/test_imgproc.cpp b/recipes/opencv/4.x/test_package/test_imgproc.cpp new file mode 100644 index 0000000000000..23784d8f0a1b6 --- /dev/null +++ b/recipes/opencv/4.x/test_package/test_imgproc.cpp @@ -0,0 +1,14 @@ +#include +#include + +int main() { + const int width = 400; + cv::Mat image = cv::Mat::zeros(width, width, CV_8UC3); + + cv::ellipse( + image, cv::Point(width / 2, width / 2), cv::Size(width / 4, width / 16), + 90, 0, 360, cv::Scalar(255, 0, 0), 2, 8 + ); + + return 0; +} diff --git a/recipes/opencv/4.x/test_package/test_intensity_transform.cpp b/recipes/opencv/4.x/test_package/test_intensity_transform.cpp new file mode 100644 index 0000000000000..dce55e2e9e3a7 --- /dev/null +++ b/recipes/opencv/4.x/test_package/test_intensity_transform.cpp @@ -0,0 +1,9 @@ +#include +#include + +int main() { + cv::Mat src_image = cv::Mat::zeros(400, 400, CV_8UC3); + cv::Mat dst_image; + cv::intensity_transform::autoscaling(src_image, dst_image); + return 0; +} diff --git a/recipes/opencv/4.x/test_package/test_line_descriptor.cpp b/recipes/opencv/4.x/test_package/test_line_descriptor.cpp new file mode 100644 index 0000000000000..a9c8f66bb0d01 --- /dev/null +++ b/recipes/opencv/4.x/test_package/test_line_descriptor.cpp @@ -0,0 +1,6 @@ +#include + +int main() { + auto descriptor = cv::line_descriptor::BinaryDescriptor::createBinaryDescriptor(); + return 0; +} diff --git a/recipes/opencv/4.x/test_package/test_mcc.cpp b/recipes/opencv/4.x/test_package/test_mcc.cpp new file mode 100644 index 0000000000000..7b2647b223c4d --- /dev/null +++ b/recipes/opencv/4.x/test_package/test_mcc.cpp @@ -0,0 +1,6 @@ +#include + +int main() { + auto checker_detector = cv::mcc::CCheckerDetector::create(); + return 0; +} diff --git a/recipes/opencv/4.x/test_package/test_ml.cpp b/recipes/opencv/4.x/test_package/test_ml.cpp new file mode 100644 index 0000000000000..e53dbd4cf97ee --- /dev/null +++ b/recipes/opencv/4.x/test_package/test_ml.cpp @@ -0,0 +1,6 @@ +#include + +int main() { + auto dtrees = cv::ml::DTrees::create(); + return 0; +} diff --git a/recipes/opencv/4.x/test_package/test_objdetect.cpp b/recipes/opencv/4.x/test_package/test_objdetect.cpp new file mode 100644 index 0000000000000..2533cbb506d59 --- /dev/null +++ b/recipes/opencv/4.x/test_package/test_objdetect.cpp @@ -0,0 +1,17 @@ +#include +#include + +#include + +int main() { + std::vector rectangles; + rectangles.reserve(100); + for (int i = 0; i < 10; ++i) { + for (int j = 0; j < 10; ++j) { + rectangles.emplace_back(cv::Rect(10 * i, 5 * (i + j), 2, 3)); + } + } + cv::groupRectangles(rectangles, 2); + + return 0; +} diff --git a/recipes/opencv/4.x/test_package/test_optflow.cpp b/recipes/opencv/4.x/test_package/test_optflow.cpp new file mode 100644 index 0000000000000..f7ef8c92b736e --- /dev/null +++ b/recipes/opencv/4.x/test_package/test_optflow.cpp @@ -0,0 +1,7 @@ +#include +#include + +int main() { + auto tree = cv::optflow::GPCTree::create(); + return 0; +} diff --git a/recipes/opencv/4.x/test_package/test_package.cpp b/recipes/opencv/4.x/test_package/test_package.cpp deleted file mode 100644 index 046f0f961f9b2..0000000000000 --- a/recipes/opencv/4.x/test_package/test_package.cpp +++ /dev/null @@ -1,234 +0,0 @@ -// Test file borrowed from OpenCV tutorial: https://docs.opencv.org/master/d3/d96/tutorial_basic_geometric_drawing.html - -/** - * @file Drawing_1.cpp - * @brief Simple geometric drawing - * @author OpenCV team - */ -#include -#include -#ifdef BUILT_WITH_ADE -#include -#include -#include -#endif -#ifdef BUILD_WITH_FFMPEF -#include -#endif -#ifdef BUILT_CONTRIB_SFM -#include -#endif - -#define w 400 - -using namespace cv; - -/// Function headers -void MyEllipse( Mat img, double angle ); -void MyFilledCircle( Mat img, Point center ); -void MyPolygon( Mat img ); -void MyLine( Mat img, Point start, Point end ); -// to test `with_ade` option -void TestGAPI(); -void TestVideo(); -void TestSFM(); - -/** - * @function main - * @brief Main function - */ -int main( void ){ - - //![create_images] - /// Windows names - char atom_window[] = "Drawing 1: Atom"; - char rook_window[] = "Drawing 2: Rook"; - - /// Create black empty images - Mat atom_image = Mat::zeros( w, w, CV_8UC3 ); - Mat rook_image = Mat::zeros( w, w, CV_8UC3 ); - //![create_images] - - /// 1. Draw a simple atom: - /// ----------------------- - - //![draw_atom] - /// 1.a. Creating ellipses - MyEllipse( atom_image, 90 ); - MyEllipse( atom_image, 0 ); - MyEllipse( atom_image, 45 ); - MyEllipse( atom_image, -45 ); - - /// 1.b. Creating circles - MyFilledCircle( atom_image, Point( w/2, w/2) ); - //![draw_atom] - - /// 2. Draw a rook - /// ------------------ - - //![draw_rook] - /// 2.a. Create a convex polygon - MyPolygon( rook_image ); - - //![rectangle] - /// 2.b. Creating rectangles - rectangle( rook_image, - Point( 0, 7*w/8 ), - Point( w, w), - Scalar( 0, 255, 255 ), - FILLED, - LINE_8 ); - //![rectangle] - - /// 2.c. Create a few lines - MyLine( rook_image, Point( 0, 15*w/16 ), Point( w, 15*w/16 ) ); - MyLine( rook_image, Point( w/4, 7*w/8 ), Point( w/4, w ) ); - MyLine( rook_image, Point( w/2, 7*w/8 ), Point( w/2, w ) ); - MyLine( rook_image, Point( 3*w/4, 7*w/8 ), Point( 3*w/4, w ) ); - //![draw_rook] - TestGAPI(); - TestVideo(); - TestSFM(); - - return(0); -} - -/// Function Declaration - -/** - * @function MyEllipse - * @brief Draw a fixed-size ellipse with different angles - */ -//![my_ellipse] -void MyEllipse( Mat img, double angle ) -{ - int thickness = 2; - int lineType = 8; - - ellipse( img, - Point( w/2, w/2 ), - Size( w/4, w/16 ), - angle, - 0, - 360, - Scalar( 255, 0, 0 ), - thickness, - lineType ); -} -//![my_ellipse] - -/** - * @function MyFilledCircle - * @brief Draw a fixed-size filled circle - */ -//![my_filled_circle] -void MyFilledCircle( Mat img, Point center ) -{ - circle( img, - center, - w/32, - Scalar( 0, 0, 255 ), - FILLED, - LINE_8 ); -} -//![my_filled_circle] - -/** - * @function MyPolygon - * @brief Draw a simple concave polygon (rook) - */ -//![my_polygon] -void MyPolygon( Mat img ) -{ - int lineType = LINE_8; - - /** Create some points */ - Point rook_points[1][20]; - rook_points[0][0] = Point( w/4, 7*w/8 ); - rook_points[0][1] = Point( 3*w/4, 7*w/8 ); - rook_points[0][2] = Point( 3*w/4, 13*w/16 ); - rook_points[0][3] = Point( 11*w/16, 13*w/16 ); - rook_points[0][4] = Point( 19*w/32, 3*w/8 ); - rook_points[0][5] = Point( 3*w/4, 3*w/8 ); - rook_points[0][6] = Point( 3*w/4, w/8 ); - rook_points[0][7] = Point( 26*w/40, w/8 ); - rook_points[0][8] = Point( 26*w/40, w/4 ); - rook_points[0][9] = Point( 22*w/40, w/4 ); - rook_points[0][10] = Point( 22*w/40, w/8 ); - rook_points[0][11] = Point( 18*w/40, w/8 ); - rook_points[0][12] = Point( 18*w/40, w/4 ); - rook_points[0][13] = Point( 14*w/40, w/4 ); - rook_points[0][14] = Point( 14*w/40, w/8 ); - rook_points[0][15] = Point( w/4, w/8 ); - rook_points[0][16] = Point( w/4, 3*w/8 ); - rook_points[0][17] = Point( 13*w/32, 3*w/8 ); - rook_points[0][18] = Point( 5*w/16, 13*w/16 ); - rook_points[0][19] = Point( w/4, 13*w/16 ); - - const Point* ppt[1] = { rook_points[0] }; - int npt[] = { 20 }; - - fillPoly( img, - ppt, - npt, - 1, - Scalar( 255, 255, 255 ), - lineType ); -} -//![my_polygon] - -/** - * @function MyLine - * @brief Draw a simple line - */ -//![my_line] -void MyLine( Mat img, Point start, Point end ) -{ - int thickness = 2; - int lineType = LINE_8; - - line( img, - start, - end, - Scalar( 0, 0, 0 ), - thickness, - lineType ); -} -//![my_line] - -/** - * @function TestGAPI - @brief to test `with_ade` - derived from https://docs.opencv.org/4.5.0/d0/d1e/gapi.html -*/ -void TestGAPI() -{ -#ifdef BUILT_WITH_ADE - cv::GMat in; - cv::GMat vga = cv::gapi::resize(in, cv::Size(), 0.5, 0.5); - cv::GMat gray = cv::gapi::BGR2Gray(vga); - cv::GMat blurred = cv::gapi::blur(gray, cv::Size(5,5)); - cv::GMat edges = cv::gapi::Canny(blurred, 32, 128, 3); - cv::GMat b,g,r; - std::tie(b,g,r) = cv::gapi::split3(vga); - cv::GMat out = cv::gapi::merge3(b, g | edges, r); - cv::GComputation ac(in, out); -#endif -} - -void TestVideo() -{ -#ifdef BUILD_WITH_FFMPEG - if (!videoio_registry::hasBackend(CAP_FFMPEG)) - throw std::runtime_error("FFmpeg backend was not found"); -#endif -} - -void TestSFM() -{ -#ifdef BUILT_CONTRIB_SFM - Vec3f a; - a << 1,2,3; - Matx33f ax = sfm::skew(a); -#endif -} diff --git a/recipes/opencv/4.x/test_package/test_phase_unwrapping.cpp b/recipes/opencv/4.x/test_package/test_phase_unwrapping.cpp new file mode 100644 index 0000000000000..d8863b429ecd4 --- /dev/null +++ b/recipes/opencv/4.x/test_package/test_phase_unwrapping.cpp @@ -0,0 +1,6 @@ +#include + +int main() { + auto histogram_phase_unwrapping = cv::phase_unwrapping::HistogramPhaseUnwrapping::create(); + return 0; +} diff --git a/recipes/opencv/4.x/test_package/test_photo.cpp b/recipes/opencv/4.x/test_package/test_photo.cpp new file mode 100644 index 0000000000000..4a94f1b4c0c8f --- /dev/null +++ b/recipes/opencv/4.x/test_package/test_photo.cpp @@ -0,0 +1,10 @@ +#include +#include + +int main() { + auto src_image = cv::Mat::zeros(400, 400, CV_8UC3); + cv::Mat dst_image; + cv::fastNlMeansDenoising(src_image, dst_image); + + return 0; +} diff --git a/recipes/opencv/4.x/test_package/test_plot.cpp b/recipes/opencv/4.x/test_package/test_plot.cpp new file mode 100644 index 0000000000000..40dc21023a5fc --- /dev/null +++ b/recipes/opencv/4.x/test_package/test_plot.cpp @@ -0,0 +1,12 @@ +#include +#include + +int main() { + cv::Mat xData; + xData.create(1, 100, CV_64F); + for (int i = 0; i < 100; ++i) { + xData.at(i) = i / 10.0; + } + auto plot = cv::plot::Plot2d::create(xData); + return 0; +} diff --git a/recipes/opencv/4.x/test_package/test_quality.cpp b/recipes/opencv/4.x/test_package/test_quality.cpp new file mode 100644 index 0000000000000..75faaa7e15666 --- /dev/null +++ b/recipes/opencv/4.x/test_package/test_quality.cpp @@ -0,0 +1,8 @@ +#include +#include + +int main() { + cv::Mat image = cv::Mat::ones(10, 10, CV_8UC3) * 40; + auto quality_mse = cv::quality::QualityMSE::create(image); + return 0; +} diff --git a/recipes/opencv/4.x/test_package/test_reg.cpp b/recipes/opencv/4.x/test_package/test_reg.cpp new file mode 100644 index 0000000000000..26957e3fa333b --- /dev/null +++ b/recipes/opencv/4.x/test_package/test_reg.cpp @@ -0,0 +1,9 @@ +#include + +int main() { + cv::reg::MapProjec map; + map.scale(5.5); + map.inverseMap(); + map.normalize(); + return 0; +} diff --git a/recipes/opencv/4.x/test_package/test_rgbd.cpp b/recipes/opencv/4.x/test_package/test_rgbd.cpp new file mode 100644 index 0000000000000..f4c2a3c31ec3b --- /dev/null +++ b/recipes/opencv/4.x/test_package/test_rgbd.cpp @@ -0,0 +1,7 @@ +#include +#include + +int main() { + auto depth_cleaner = cv::rgbd::DepthCleaner::create(5); + return 0; +} diff --git a/recipes/opencv/4.x/test_package/test_saliency.cpp b/recipes/opencv/4.x/test_package/test_saliency.cpp new file mode 100644 index 0000000000000..c3938011335b0 --- /dev/null +++ b/recipes/opencv/4.x/test_package/test_saliency.cpp @@ -0,0 +1,6 @@ +#include + +int main() { + auto objectness_bing = cv::saliency::ObjectnessBING::create(); + return 0; +} diff --git a/recipes/opencv/4.x/test_package/test_sfm.cpp b/recipes/opencv/4.x/test_package/test_sfm.cpp new file mode 100644 index 0000000000000..e4b4bacb2a25a --- /dev/null +++ b/recipes/opencv/4.x/test_package/test_sfm.cpp @@ -0,0 +1,10 @@ +#include +#include + +int main() { + cv::Vec3f a; + a << 1,2,3; + cv::Matx33f ax = cv::sfm::skew(a); + + return 0; +} diff --git a/recipes/opencv/4.x/test_package/test_shape.cpp b/recipes/opencv/4.x/test_package/test_shape.cpp new file mode 100644 index 0000000000000..ef5e9500abe47 --- /dev/null +++ b/recipes/opencv/4.x/test_package/test_shape.cpp @@ -0,0 +1,6 @@ +#include + +int main() { + auto extractor = cv::createChiHistogramCostExtractor(); + return 0; +} diff --git a/recipes/opencv/4.x/test_package/test_stitching.cpp b/recipes/opencv/4.x/test_package/test_stitching.cpp new file mode 100644 index 0000000000000..8a445823efb35 --- /dev/null +++ b/recipes/opencv/4.x/test_package/test_stitching.cpp @@ -0,0 +1,13 @@ +#include +#include + +int main() { + cv::Rect roi; + bool overlap = cv::detail::overlapRoi( + cv::Point2f(2, 3), cv::Point2f(4, -3), + cv::Size(10, 10), cv::Size(3, 4), + roi + ); + + return 0; +} diff --git a/recipes/opencv/4.x/test_package/test_structured_light.cpp b/recipes/opencv/4.x/test_package/test_structured_light.cpp new file mode 100644 index 0000000000000..d6f0b0661cdba --- /dev/null +++ b/recipes/opencv/4.x/test_package/test_structured_light.cpp @@ -0,0 +1,6 @@ +#include + +int main() { + auto pattern = cv::structured_light::GrayCodePattern::create(); + return 0; +} diff --git a/recipes/opencv/4.x/test_package/test_superres.cpp b/recipes/opencv/4.x/test_package/test_superres.cpp new file mode 100644 index 0000000000000..70097500036ec --- /dev/null +++ b/recipes/opencv/4.x/test_package/test_superres.cpp @@ -0,0 +1,6 @@ +#include + +int main() { + auto frame_source = cv::superres::createFrameSource_Empty(); + return 0; +} diff --git a/recipes/opencv/4.x/test_package/test_surface_matching.cpp b/recipes/opencv/4.x/test_package/test_surface_matching.cpp new file mode 100644 index 0000000000000..3a215084288be --- /dev/null +++ b/recipes/opencv/4.x/test_package/test_surface_matching.cpp @@ -0,0 +1,7 @@ +#include +#include + +int main() { + cv::ppf_match_3d::PPF3DDetector detector(0.03, 0.05); + return 0; +} diff --git a/recipes/opencv/4.x/test_package/test_text.cpp b/recipes/opencv/4.x/test_package/test_text.cpp new file mode 100644 index 0000000000000..1c8dbed4b8ea2 --- /dev/null +++ b/recipes/opencv/4.x/test_package/test_text.cpp @@ -0,0 +1,11 @@ +#include +#include + +#include + +int main() { + cv::Mat image = cv::Mat::zeros(10, 10, CV_8UC3); + std::vector channels; + cv::text::computeNMChannels(image, channels); + return 0; +} diff --git a/recipes/opencv/4.x/test_package/test_tracking.cpp b/recipes/opencv/4.x/test_package/test_tracking.cpp new file mode 100644 index 0000000000000..69efe349df222 --- /dev/null +++ b/recipes/opencv/4.x/test_package/test_tracking.cpp @@ -0,0 +1,6 @@ +#include + +int main() { + auto kcf_tracker = cv::TrackerKCF::create(); + return 0; +} diff --git a/recipes/opencv/4.x/test_package/test_video.cpp b/recipes/opencv/4.x/test_package/test_video.cpp new file mode 100644 index 0000000000000..09a4342add1a1 --- /dev/null +++ b/recipes/opencv/4.x/test_package/test_video.cpp @@ -0,0 +1,7 @@ +#include + +int main() { + auto bkg_subtractor_knn = cv::createBackgroundSubtractorKNN(); + + return 0; +} diff --git a/recipes/opencv/4.x/test_package/test_videoio.cpp b/recipes/opencv/4.x/test_package/test_videoio.cpp new file mode 100644 index 0000000000000..7b0955e888a06 --- /dev/null +++ b/recipes/opencv/4.x/test_package/test_videoio.cpp @@ -0,0 +1,11 @@ +#include +#include + +#include + +int main() { + if (!cv::videoio_registry::hasBackend(cv::CAP_FFMPEG)) + throw std::runtime_error("FFmpeg backend was not found"); + + return 0; +} diff --git a/recipes/opencv/4.x/test_package/test_wechat_qrcode.cpp b/recipes/opencv/4.x/test_package/test_wechat_qrcode.cpp new file mode 100644 index 0000000000000..6dce15eeb7b40 --- /dev/null +++ b/recipes/opencv/4.x/test_package/test_wechat_qrcode.cpp @@ -0,0 +1,9 @@ +#include +#include + +int main() { + cv::Mat image = cv::Mat::ones(100, 100, CV_8UC3) * 50; + cv::wechat_qrcode::WeChatQRCode wechat_qrcode; + auto decoded_strings = wechat_qrcode.detectAndDecode(image); + return 0; +} diff --git a/recipes/opencv/4.x/test_package/test_xfeatures2d.cpp b/recipes/opencv/4.x/test_package/test_xfeatures2d.cpp new file mode 100644 index 0000000000000..673b9737b4fdd --- /dev/null +++ b/recipes/opencv/4.x/test_package/test_xfeatures2d.cpp @@ -0,0 +1,6 @@ +#include + +int main() { + auto vgg = cv::xfeatures2d::VGG::create(); + return 0; +} diff --git a/recipes/opencv/4.x/test_package/test_ximgproc.cpp b/recipes/opencv/4.x/test_package/test_ximgproc.cpp new file mode 100644 index 0000000000000..b4804362da9b2 --- /dev/null +++ b/recipes/opencv/4.x/test_package/test_ximgproc.cpp @@ -0,0 +1,6 @@ +#include + +int main() { + auto feature_getter = cv::ximgproc::createRFFeatureGetter(); + return 0; +} diff --git a/recipes/opencv/4.x/test_package/test_xobjdetect.cpp b/recipes/opencv/4.x/test_package/test_xobjdetect.cpp new file mode 100644 index 0000000000000..15cecaff5b8ef --- /dev/null +++ b/recipes/opencv/4.x/test_package/test_xobjdetect.cpp @@ -0,0 +1,6 @@ +#include + +int main() { + auto detector = cv::xobjdetect::WBDetector::create(); + return 0; +} diff --git a/recipes/opencv/4.x/test_package/test_xphoto.cpp b/recipes/opencv/4.x/test_package/test_xphoto.cpp new file mode 100644 index 0000000000000..5c0eb661f221c --- /dev/null +++ b/recipes/opencv/4.x/test_package/test_xphoto.cpp @@ -0,0 +1,6 @@ +#include + +int main() { + auto grayworld_wb = cv::xphoto::createGrayworldWB(); + return 0; +} 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..c23ed5cfe6d98 --- /dev/null +++ b/recipes/opencv/4.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/opencv/4.x/test_v1_package/conanfile.py b/recipes/opencv/4.x/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..9aa234fbd88b8 --- /dev/null +++ b/recipes/opencv/4.x/test_v1_package/conanfile.py @@ -0,0 +1,47 @@ +from conans import ConanFile, CMake, tools +from conans.errors import ConanException + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + @property + def _tested_modules(self): + return [ + # Main modules + "calib3d", "core", "dnn", "features2d", "flann", "gapi", "highgui", "imgcodecs", + "imgproc", "ml", "objdetect", "photo", "stitching", "video", "videoio", + # Extra modules + "alphamat", "aruco", "bgsegm", "bioinspired", "ccalib", "datasets", "dnn_superres", + "face", "freetype", "fuzzy", "hdf", "hfs", "img_hash", "intensity_transform", + "line_descriptor", "mcc", "optflow", "phase_unwrapping", "plot", "quality", "reg", + "rgbd", "saliency", "sfm", "shape", "structured_light", "superres", + "surface_matching", "text", "tracking", "wechat_qrcode", "xfeatures2d", + "ximgproc", "xobjdetect", "xphoto", + ] + + def _opencv_option(self, name, default): + try: + return getattr(self.options["opencv"], name, default) + except (AttributeError, ConanException): + return default + + def build(self): + cmake = CMake(self) + for module in self._tested_modules: + cmake_option = f"OPENCV_WITH_{module.upper()}" + if module == "core": + cmake.definitions[cmake_option] = True + elif module == "imgcodecs": + cmake.definitions[cmake_option] = self.options["opencv"].imgcodecs and self.options["opencv"].with_png + elif module == "videoio": + cmake.definitions[cmake_option] = self.options["opencv"].videoio and self.options["opencv"].with_ffmpeg + else: + cmake.definitions[cmake_option] = self._opencv_option(module, 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/opencv/config.yml b/recipes/opencv/config.yml index ca1a31e15cba8..826190b23d258 100644 --- a/recipes/opencv/config.yml +++ b/recipes/opencv/config.yml @@ -1,19 +1,19 @@ versions: - "4.5.5": + "4.10.0": folder: "4.x" - "4.5.3": + "4.9.0": folder: "4.x" - "4.5.2": + "4.8.1": folder: "4.x" - "4.5.1": + "4.5.5": folder: "4.x" - "4.5.0": + "4.5.3": folder: "4.x" "4.1.2": folder: "4.x" - "3.4.17": + "3.4.20": folder: "3.x" - "3.4.12": + "3.4.17": folder: "3.x" "2.4.13.7": folder: "2.x" diff --git a/recipes/openddl-parser/all/conandata.yml b/recipes/openddl-parser/all/conandata.yml index aff9aad9e373b..367951b808907 100644 --- a/recipes/openddl-parser/all/conandata.yml +++ b/recipes/openddl-parser/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.5.1": + url: "https://github.com/kimkulling/openddl-parser/archive/v0.5.1.tar.gz" + sha256: "511146377636f56a8a3bd6daace5ac2ed9672f4be28fc2c90597f4e88e069ffc" "0.5.0": url: "https://github.com/kimkulling/openddl-parser/archive/refs/tags/v0.5.0.tar.gz" sha256: "0ad1a95462932da247a21fc3bb4560c3d9b134e15464f6a518c9e01becc14b60" 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/openddl-parser/config.yml b/recipes/openddl-parser/config.yml index c4cc95f34a3b6..c45ff0b2916ff 100644 --- a/recipes/openddl-parser/config.yml +++ b/recipes/openddl-parser/config.yml @@ -1,4 +1,6 @@ versions: + "0.5.1": + folder: "all" "0.5.0": folder: "all" "cci.20211217": diff --git a/recipes/opendis6/all/conandata.yml b/recipes/opendis6/all/conandata.yml new file mode 100644 index 0000000000000..7824537ac8c80 --- /dev/null +++ b/recipes/opendis6/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.1.0": + url: "https://github.com/crhowell3/opendis6/archive/refs/tags/0.1.0.tar.gz" + sha256: "7acfd6ecdcea03c75f93834c4e8ad532aee03eb0fdd2736c9095e2d548214125" diff --git a/recipes/opendis6/all/conanfile.py b/recipes/opendis6/all/conanfile.py new file mode 100644 index 0000000000000..1d7c11b706f15 --- /dev/null +++ b/recipes/opendis6/all/conanfile.py @@ -0,0 +1,95 @@ +import os + +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, rmdir +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration + +required_conan_version = ">=1.53.0" + +class OpenDis6Conan(ConanFile): + name = "opendis6" + homepage = "https://github.com/crhowell3/opendis6" + description = "Modern C++ implementation of IEEE 1278.1a-1998" + topics = ("library", "protocol", "dis") + url = "https://github.com/conan-io/conan-center-index" + license = "BSD-2-Clause" + package_type = "library" + 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 { + "Visual Studio": "15", + "msvc": "191", + "gcc": "7", + "clang": "7", + "apple-clang": "10", + } + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + 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 configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def build_requirements(self): + self.tool_requires("cmake/[>=3.22 <4]") + + 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.") + + 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")) + 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.libs = ["OpenDIS6"] + self.cpp_info.set_property("cmake_file_name", "OpenDIS") + self.cpp_info.set_property("cmake_target_name", "OpenDIS::OpenDIS6") + self.cpp_info.set_property("cmake_target_aliases", ["OpenDIS::DIS6","OpenDIS6"]) + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") diff --git a/recipes/opendis6/all/test_package/CMakeLists.txt b/recipes/opendis6/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..84b0c539e5ca0 --- /dev/null +++ b/recipes/opendis6/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(OpenDIS CONFIG REQUIRED) + +add_executable(test_package_dis test_package.cpp) +target_link_libraries(test_package_dis PRIVATE OpenDIS::OpenDIS6) +set_target_properties(test_package_dis PROPERTIES CXX_STANDARD 14) diff --git a/recipes/opendis6/all/test_package/conanfile.py b/recipes/opendis6/all/test_package/conanfile.py new file mode 100644 index 0000000000000..8e56d28728132 --- /dev/null +++ b/recipes/opendis6/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_dis"), env="conanrun") diff --git a/recipes/opendis6/all/test_package/test_package.cpp b/recipes/opendis6/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..8d0bb6749255c --- /dev/null +++ b/recipes/opendis6/all/test_package/test_package.cpp @@ -0,0 +1,14 @@ +#include + +#include "dis6/entity_information/EntityStatePdu.h" + +int main() { + dis::EntityStatePdu pdu1, pdu2; + + dis::DataStream ds(dis::kBig); + pdu1.Marshal(ds); + pdu2.Unmarshal(ds); + + std::cout << "Success\n"; + return EXIT_SUCCESS; +} diff --git a/recipes/opendis6/config.yml b/recipes/opendis6/config.yml new file mode 100644 index 0000000000000..6c11a439d0bc2 --- /dev/null +++ b/recipes/opendis6/config.yml @@ -0,0 +1,3 @@ +versions: + "0.1.0": + folder: all diff --git a/recipes/opene57/all/CMakeLists.txt b/recipes/opene57/all/CMakeLists.txt deleted file mode 100644 index 61f3d3b039e2b..0000000000000 --- a/recipes/opene57/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/opene57/all/conandata.yml b/recipes/opene57/all/conandata.yml index c12e0f534863e..01fe8da487209 100644 --- a/recipes/opene57/all/conandata.yml +++ b/recipes/opene57/all/conandata.yml @@ -1,7 +1,10 @@ sources: - "1.6.2": - sha256: 2d487e663cf43105b19653d34250fd45f947af839e327336b6878464a99d5423 - url: https://github.com/openE57/openE57/archive/refs/tags/1.6.2.tar.gz + "1.6.5": + url: "https://github.com/openE57/openE57/archive/1.6.5.tar.gz" + sha256: "23f3c159550a70b6a1c2330f0f03ed816cbc27ff5656410bfee527bae31eb186" + "1.6.4": + url: "https://github.com/openE57/openE57/archive/1.6.4.tar.gz" + sha256: "97accc32ae294113a97b8d3f0ecf0d608057a6f0fcdfee17db0c5db4ab28ce69" "1.6.3": - sha256: e335afdda98a2707d05ec4bce99f362a6f7f0eb2e8bbf2d7346eae292046f827 - url: https://github.com/openE57/openE57/archive/refs/tags/1.6.3.tar.gz + url: "https://github.com/openE57/openE57/archive/refs/tags/1.6.3.tar.gz" + sha256: "e335afdda98a2707d05ec4bce99f362a6f7f0eb2e8bbf2d7346eae292046f827" diff --git a/recipes/opene57/all/conanfile.py b/recipes/opene57/all/conanfile.py index de0ae61c3daea..d02fc5ff273d6 100644 --- a/recipes/opene57/all/conanfile.py +++ b/recipes/opene57/all/conanfile.py @@ -1,123 +1,145 @@ -from conans import ConanFile, tools, CMake -from conan.tools.microsoft import msvc_runtime_flag -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.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, export_conandata_patches, get, replace_in_file +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +from conan.tools.scm import Version + +required_conan_version = ">=1.54.0" + + class Opene57Conan(ConanFile): name = "opene57" - description = "A C++ library for reading and writing E57 files, " \ - "fork of the original libE57 (http://libe57.org)" - topics = ("e57", "libe57", "3d", "astm") + description = "A C++ library for reading and writing E57 files, a fork of the original libE57 (http://libe57.org)" + license = ("MIT", "BSL-1.0") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/openE57/openE57" - license = ("MIT", "BSL-1.0") - settings = "os", "compiler", "arch", "build_type" - options = { "with_tools": [True, False], - "shared": [True, False], - "fPIC": [True, False] - } - default_options = { - "with_tools": False, - "shared": False, - "fPIC": True - } - generators = "cmake", "cmake_find_package" - _cmake = None + topics = ("e57", "libe57", "3d", "astm") - @property - def _source_subfolder(self): - return "source_subfolder" + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_tools": [True, False], + "with_docs": [True, False] + } + default_options = { + "shared": False, + "fPIC": True, + "with_tools": False, + "with_docs": False + } @property - def _build_subfolder(self): - return "build_subfolder" + 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", } 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 configure(self): - if self.options.shared: - del self.options.fPIC - - if self.options.with_tools: - self.options['boost'].multithreading = True + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - def validate(self): + def configure(self): if self.options.shared: - raise ConanInvalidConfiguration("OpenE57 cannot be built as shared library yet") - - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 17) + self.options.rm_safe("fPIC") + if self.options.with_tools: + self.options["boost"].multithreading = True - 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: - raise ConanInvalidConfiguration("C++17 support required, which your compiler does not support.") + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.options.with_tools: - self.requires("boost/1.78.0") + self.requires("boost/1.84.0") + + if self.options.with_docs: + self.requires("doxygen/[>=1.8 <2]") - if self.settings.os == "Linux" or tools.is_apple_os(self.settings.os): - self.requires("icu/70.1") + if self.settings.os != "Windows": + self.requires("icu/74.1") - self.requires("xerces-c/3.2.3") + self.requires("xerces-c/3.2.4") + + 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], destination=self._source_subfolder, strip_root=True) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["PROJECT_VERSION"] = self.version - self._cmake.definitions["BUILD_EXAMPLES"] = False - self._cmake.definitions["BUILD_TOOLS"] = self.options.with_tools - self._cmake.definitions["BUILD_TESTS"] = False - if self.settings.compiler == "Visual Studio": - self._cmake.definitions["BUILD_WITH_MT"] = "MT" in msvc_runtime_flag(self) - else: - 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): + tc = CMakeToolchain(self) + tc.variables["PROJECT_VERSION"] = self.version + tc.variables["BUILD_EXAMPLES"] = False + tc.variables["BUILD_TOOLS"] = self.options.with_tools + tc.variables["BUILD_TESTS"] = False + tc.variables["BUILD_DOCS"] = self.options.with_docs + + if is_msvc(self): + tc.variables["BUILD_WITH_MT"] = is_msvc_static_runtime(self) + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = self.options.shared + tc.generate() + deps = CMakeDeps(self) + deps.generate() + + def _patch_sources(self): + # Do not raise an error for shared builds + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "message(FATAL_ERROR", "# ") + compiler_opts = os.path.join(self.source_folder, "src", "cmake", "compiler_options.cmake") + # Disable ASan and UBSan as these require linking against asan and ubsan runtime libraries + # FIXME: Figure out how to link against these using Conan + replace_in_file(self, compiler_opts, "$<$:-fsanitize=address>", "") + replace_in_file(self, compiler_opts, "$<$:-fsanitize=undefined>", "") + if self.settings.compiler == "apple-clang": + replace_in_file(self, compiler_opts, "$<$:-fsanitize=leak>", "") + if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "8": + replace_in_file(self, compiler_opts, "-fstack-clash-protection", "") def build(self): - cmake = self._configure_cmake() + self._patch_sources() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - self.copy(pattern="LICENSE.libE57", 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) + copy(self, "LICENSE.libE57", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() os.remove(os.path.join(self.package_folder, "CHANGELOG.md")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), "*.dll") def package_info(self): - if self.options.with_tools: - bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH env: {}".format(bin_path)) - self.env_info.PATH.append(bin_path) - lib_suffix = "-d" if self.settings.build_type == "Debug" else "" self.cpp_info.libs = [f"openE57{lib_suffix}", f"openE57las{lib_suffix}"] self.cpp_info.defines.append(f"E57_REFIMPL_REVISION_ID={self.name}-{self.version}") self.cpp_info.defines.append("XERCES_STATIC_LIBRARY") + self.cpp_info.defines.append("CRCPP_INCLUDE_ESOTERIC_CRC_DEFINITIONS") + self.cpp_info.defines.append("CRCPP_USE_CPP11") + # TODO: to remove in conan v2 + if self.options.with_tools: + bin_path = os.path.join(self.package_folder, "bin") + self.env_info.PATH.append(bin_path) diff --git a/recipes/opene57/all/test_package/CMakeLists.txt b/recipes/opene57/all/test_package/CMakeLists.txt index 4371da6fd8c67..47f482568b9fd 100644 --- a/recipes/opene57/all/test_package/CMakeLists.txt +++ b/recipes/opene57/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ cmake_minimum_required(VERSION 3.15.0 FATAL_ERROR) project(opene57_example CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(opene57 REQUIRED CONFIG) add_executable(${PROJECT_NAME} example.cpp) diff --git a/recipes/opene57/all/test_package/conanfile.py b/recipes/opene57/all/test_package/conanfile.py index b295f3f19d774..20c9ce7dbadb1 100644 --- a/recipes/opene57/all/test_package/conanfile.py +++ b/recipes/opene57/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 TestOpenE57Conan(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 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "opene57_example") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindir, "opene57_example") + self.run(bin_path, env="conanrun") diff --git a/recipes/opene57/all/test_package/example.cpp b/recipes/opene57/all/test_package/example.cpp index 053adab3412f0..fa65c1fd0c5c9 100644 --- a/recipes/opene57/all/test_package/example.cpp +++ b/recipes/opene57/all/test_package/example.cpp @@ -1,19 +1,20 @@ -#include #include +#include + using namespace e57; using namespace std; -int main(int /*argc*/, char** /*argv*/) -{ - E57Utilities utilities{}; +int main() { + E57Utilities utilities{}; - int astmMajor{0}; - int astmMinor{0}; - ustring libraryId{}; - utilities.getVersions(astmMajor, astmMinor, libraryId); + int astmMajor{0}; + int astmMinor{0}; + ustring libraryId{}; + utilities.getVersions(astmMajor, astmMinor, libraryId); - std::cout << "E57 Version: " << astmMajor << "." << astmMinor << " - Library ID: " << libraryId << std::endl; + std::cout << "E57 Version: " << astmMajor << "." << astmMinor << " - Library ID: " << libraryId + << std::endl; - return 0; + return 0; } diff --git a/recipes/opene57/all/test_v1_package/CMakeLists.txt b/recipes/opene57/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/opene57/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/opene57/all/test_v1_package/conanfile.py b/recipes/opene57/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..b295f3f19d774 --- /dev/null +++ b/recipes/opene57/all/test_v1_package/conanfile.py @@ -0,0 +1,16 @@ +import os +from conans import ConanFile, CMake, tools + +class TestOpenE57Conan(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", "opene57_example") + self.run(bin_path, run_environment=True) diff --git a/recipes/opene57/config.yml b/recipes/opene57/config.yml index ed1dbc177bf25..0cbc2473d6c2f 100644 --- a/recipes/opene57/config.yml +++ b/recipes/opene57/config.yml @@ -1,5 +1,7 @@ versions: - "1.6.2": + "1.6.5": + folder: all + "1.6.4": folder: all "1.6.3": folder: all diff --git a/recipes/openexr/2.x/conandata.yml b/recipes/openexr/2.x/conandata.yml index 95068ca05e4d4..6ab19656a3a57 100644 --- a/recipes/openexr/2.x/conandata.yml +++ b/recipes/openexr/2.x/conandata.yml @@ -1,19 +1,21 @@ sources: + "2.5.9": + url: "https://github.com/AcademySoftwareFoundation/openexr/archive/refs/tags/v2.5.9.tar.gz" + sha256: "05bb9c2da3ff3508eee51c30f59c7f2c59bf068f3b636d12d5991e8bbaf13e01" "2.5.7": url: "https://github.com/AcademySoftwareFoundation/openexr/archive/refs/tags/v2.5.7.tar.gz" sha256: "36ecb2290cba6fc92b2ec9357f8dc0e364b4f9a90d727bf9a57c84760695272d" - "2.5.5": - url: "https://github.com/AcademySoftwareFoundation/openexr/archive/refs/tags/v2.5.5.tar.gz" - sha256: "59e98361cb31456a9634378d0f653a2b9554b8900f233450f2396ff495ea76b3" - "2.5.4": - url: "https://github.com/AcademySoftwareFoundation/openexr/archive/refs/tags/v2.5.4.tar.gz" - sha256: "dba19e9c6720c6f64fbc8b9d1867eaa75da6438109b941eefdc75ed141b6576d" - "2.5.3": - url: "https://github.com/AcademySoftwareFoundation/openexr/archive/refs/tags/v2.5.3.tar.gz" - sha256: "6a6525e6e3907715c6a55887716d7e42d09b54d2457323fcee35a0376960bebf" - "2.5.2": - url: "https://github.com/AcademySoftwareFoundation/openexr/archive/refs/tags/v2.5.2.tar.gz" - sha256: "5da8dff448d0c4a529e52c97daf238a461d01cd233944f75095668d6d7528761" "2.4.0": url: "https://github.com/AcademySoftwareFoundation/openexr/archive/refs/tags/v2.4.0.tar.gz" sha256: "4904c5ea7914a58f60a5e2fbc397be67e7a25c380d7d07c1c31a3eefff1c92f1" +patches: + "2.5.7": + - patch_file: "patches/2.5.7-0001-cstdint-include.patch" + patch_description: "Add #include as required by newer gcc versions" + patch_type: "portability" + patch_source: "https://github.com/AcademySoftwareFoundation/openexr/commit/310ae8600" + "2.4.0": + - patch_file: "patches/2.4.0-0001-cstdint-include.patch" + patch_description: "Add #include as required by newer gcc versions" + patch_type: "portability" + patch_source: "https://github.com/AcademySoftwareFoundation/openexr/commit/310ae8600" diff --git a/recipes/openexr/2.x/conanfile.py b/recipes/openexr/2.x/conanfile.py index e6fecd0261780..8cf1e63318981 100644 --- a/recipes/openexr/2.x/conanfile.py +++ b/recipes/openexr/2.x/conanfile.py @@ -1,25 +1,24 @@ 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.files import apply_conandata_patches, copy, export_conandata_patches, 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): name = "openexr" description = "OpenEXR is a high dynamic-range (HDR) image file format developed by Industrial Light & " \ "Magic for use in computer imaging applications." - topics = ("openexr", "hdr", "image", "picture") + topics = ("hdr", "image", "picture", "file format", "computer vision") license = "BSD-3-Clause" homepage = "https://github.com/AcademySoftwareFoundation/openexr" url = "https://github.com/conan-io/conan-center-index" - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -30,16 +29,19 @@ class OpenEXRConan(ConanFile): "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: - del self.options.fPIC + self.options.rm_safe("fPIC") def requirements(self): - self.requires("zlib/1.2.13") + self.requires("zlib/[>=1.2.11 <2]") def validate(self): if Version(self.version) < "2.5.0" and hasattr(self, "settings_build") and cross_building(self): @@ -50,8 +52,7 @@ 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) @@ -66,13 +67,13 @@ def generate(self): tc.variables["OPENEXR_BUILD_UTILS"] = False tc.variables["BUILD_TESTING"] = False tc.variables["CMAKE_SKIP_INSTALL_RPATH"] = 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() cd = CMakeDeps(self) cd.generate() def _patch_sources(self): + apply_conandata_patches(self) + pkg_version = Version(self.version) if pkg_version < "2.5.2" and self.settings.os == "Windows": # This fixes symlink creation on Windows. @@ -140,6 +141,9 @@ def package_info(self): # waiting an implementation of https://github.com/conan-io/conan/issues/9000 self.cpp_info.set_property("cmake_file_name", "OpenEXR") + # Avoid conflict in PkgConfigDeps with OpenEXR.pc file coming from openexr_ilmimf component + self.cpp_info.set_property("pkg_config_name", "openexr_conan_full_package") + lib_suffix = "" if not self.options.shared or self.settings.os == "Windows": openexr_version = Version(self.version) @@ -217,7 +221,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/2.x/patches/2.4.0-0001-cstdint-include.patch b/recipes/openexr/2.x/patches/2.4.0-0001-cstdint-include.patch new file mode 100644 index 0000000000000..3f4c78fc6bea5 --- /dev/null +++ b/recipes/openexr/2.x/patches/2.4.0-0001-cstdint-include.patch @@ -0,0 +1,37 @@ +diff --git OpenEXR/IlmImf/ImfDwaCompressor.cpp OpenEXR/IlmImf/ImfDwaCompressor.cpp +index 59d1d5d..585a3e6 100644 +--- OpenEXR/IlmImf/ImfDwaCompressor.cpp ++++ OpenEXR/IlmImf/ImfDwaCompressor.cpp +@@ -158,6 +158,7 @@ + #include + #include + #include ++#include + + // Windows specific addition to prevent the indirect import of the redefined min/max macros + #if defined _WIN32 || defined _WIN64 +diff --git OpenEXR/IlmImf/ImfHuf.cpp OpenEXR/IlmImf/ImfHuf.cpp +index 271849b..165fac5 100644 +--- OpenEXR/IlmImf/ImfHuf.cpp ++++ OpenEXR/IlmImf/ImfHuf.cpp +@@ -53,6 +53,7 @@ + #include + #include + #include ++#include + + + using namespace std; +diff --git OpenEXR/IlmImf/ImfMisc.cpp OpenEXR/IlmImf/ImfMisc.cpp +index d2c8478..0451a33 100644 +--- OpenEXR/IlmImf/ImfMisc.cpp ++++ OpenEXR/IlmImf/ImfMisc.cpp +@@ -54,6 +54,8 @@ + #include + #include "ImfNamespace.h" + ++#include ++ + OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER + + using IMATH_NAMESPACE::Box2i; diff --git a/recipes/openexr/2.x/patches/2.5.7-0001-cstdint-include.patch b/recipes/openexr/2.x/patches/2.5.7-0001-cstdint-include.patch new file mode 100644 index 0000000000000..64f13c78d3ce8 --- /dev/null +++ b/recipes/openexr/2.x/patches/2.5.7-0001-cstdint-include.patch @@ -0,0 +1,37 @@ +diff --git OpenEXR/IlmImf/ImfDwaCompressor.cpp OpenEXR/IlmImf/ImfDwaCompressor.cpp +index 59d1d5d..585a3e6 100644 +--- OpenEXR/IlmImf/ImfDwaCompressor.cpp ++++ OpenEXR/IlmImf/ImfDwaCompressor.cpp +@@ -159,6 +159,7 @@ + #include + + #include ++#include + + + // Windows specific addition to prevent the indirect import of the redefined min/max macros +diff --git OpenEXR/IlmImf/ImfHuf.cpp OpenEXR/IlmImf/ImfHuf.cpp +index 271849b..165fac5 100644 +--- OpenEXR/IlmImf/ImfHuf.cpp ++++ OpenEXR/IlmImf/ImfHuf.cpp +@@ -53,6 +53,7 @@ + #include + #include + #include ++#include + + + using namespace std; +diff --git OpenEXR/IlmImf/ImfMisc.cpp OpenEXR/IlmImf/ImfMisc.cpp +index d2c8478..0451a33 100644 +--- OpenEXR/IlmImf/ImfMisc.cpp ++++ OpenEXR/IlmImf/ImfMisc.cpp +@@ -54,6 +54,8 @@ + #include + #include "ImfNamespace.h" + ++#include ++ + OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER + + using IMATH_NAMESPACE::Box2i; diff --git a/recipes/openexr/2.x/test_package/comp_short_decode_piz.exr b/recipes/openexr/2.x/test_package/comp_short_decode_piz.exr deleted file mode 100644 index 3a16d594b3028..0000000000000 Binary files a/recipes/openexr/2.x/test_package/comp_short_decode_piz.exr and /dev/null differ diff --git a/recipes/openexr/2.x/test_package/conanfile.py b/recipes/openexr/2.x/test_package/conanfile.py index f3a059b562841..3a8c6c5442b33 100644 --- a/recipes/openexr/2.x/test_package/conanfile.py +++ b/recipes/openexr/2.x/test_package/conanfile.py @@ -22,5 +22,4 @@ def build(self): def test(self): if not cross_building(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") - imgfile = os.path.join(self.source_folder, "comp_short_decode_piz.exr") - self.run(f"{bin_path} {imgfile}", env="conanrun") + self.run(bin_path, env="conanrun") diff --git a/recipes/openexr/2.x/test_package/test_package.cpp b/recipes/openexr/2.x/test_package/test_package.cpp index f5c9cab11b69e..d0aa6adf400d6 100644 --- a/recipes/openexr/2.x/test_package/test_package.cpp +++ b/recipes/openexr/2.x/test_package/test_package.cpp @@ -1,18 +1,11 @@ #include #include -#include -#include -#include +#include int main (int argc, char *argv[]) { - if (argc < 2) - return EXIT_FAILURE; - Imf::RgbaInputFile input_file(argv[1]); - const Imf::Header& header = input_file.header(); - size_t width = header.dataWindow().max.x - header.dataWindow().min.x + 1; - size_t height = header.dataWindow().max.y - header.dataWindow().min.y + 1; - std::cout << "OpenEXR images size is " << width << "x" << height << std::endl; + Imf::Header header; + std::cout << "Test: " << header.screenWindowWidth() << std::endl; return EXIT_SUCCESS; } diff --git a/recipes/openexr/3.x/conandata.yml b/recipes/openexr/3.x/conandata.yml index 61df50d0ab0d1..55a601dcb6b76 100644 --- a/recipes/openexr/3.x/conandata.yml +++ b/recipes/openexr/3.x/conandata.yml @@ -1,12 +1,67 @@ sources: - "3.1.5": - url: "https://github.com/AcademySoftwareFoundation/openexr/archive/refs/tags/v3.1.5.tar.gz" - sha256: "93925805c1fc4f8162b35f0ae109c4a75344e6decae5a240afdfce25f8a433ec" - "3.1.4": - url: "https://github.com/AcademySoftwareFoundation/openexr/archive/refs/tags/v3.1.4.tar.gz" - sha256: "cb019c3c69ada47fe340f7fa6c8b863ca0515804dc60bdb25c942c1da886930b" + "3.3.2": + url: "https://github.com/AcademySoftwareFoundation/openexr/releases/download/v3.3.2/openexr-3.3.2.tar.gz" + sha256: "4fb4c643b39f04b67e8f4138e4d5a7804b62fdc15b8f6bcdd32ccc8ecd515683" + "3.3.1": + url: "https://github.com/AcademySoftwareFoundation/openexr/archive/refs/tags/v3.3.1.tar.gz" + sha256: "58aad2b32c047070a52f1205b309bdae007442e0f983120e4ff57551eb6f10f1" + "3.3.0": + url: "https://github.com/AcademySoftwareFoundation/openexr/archive/refs/tags/v3.3.0.tar.gz" + sha256: "58b00f50d2012f3107573c4b7371f70516d2972c2b301a50925e1b4a60a7be6f" + "3.2.4": + url: "https://github.com/AcademySoftwareFoundation/openexr/archive/refs/tags/v3.2.4.tar.gz" + sha256: "81e6518f2c4656fdeaf18a018f135e96a96e7f66dbe1c1f05860dd94772176cc" + "3.2.3": + url: "https://github.com/AcademySoftwareFoundation/openexr/archive/refs/tags/v3.2.3.tar.gz" + sha256: "f3f6c4165694d5c09e478a791eae69847cadb1333a2948ca222aa09f145eba63" + "3.2.2": + url: "https://github.com/AcademySoftwareFoundation/openexr/archive/refs/tags/v3.2.2.tar.gz" + sha256: "65de6459c245a4977ce4d7777e70b30d7ef48ec38e0cfb10205706ca50a8bf2e" + "3.2.1": + url: "https://github.com/AcademySoftwareFoundation/openexr/archive/refs/tags/v3.2.1.tar.gz" + sha256: "61e175aa2203399fb3c8c2288752fbea3c2637680d50b6e306ea5f8ffdd46a9b" + "3.1.9": + url: "https://github.com/AcademySoftwareFoundation/openexr/archive/refs/tags/v3.1.9.tar.gz" + sha256: "103e902d3902800ab07b5f3a298be7afd2755312737b2cdbfa01326ff99dac07" + "3.1.7": + url: "https://github.com/AcademySoftwareFoundation/openexr/archive/refs/tags/v3.1.7.tar.gz" + sha256: "78dbca39115a1c526e6728588753955ee75fa7f5bb1a6e238bed5b6d66f91fd7" patches: - "3.1.5": - - patch_file: "patches/v3.1.4-gcc5-bug-workaround.patch" - "3.1.4": - - patch_file: "patches/v3.1.4-gcc5-bug-workaround.patch" + "3.2.4": + - patch_file: "patches/3.2.1-gcc5-bug-workaround.patch" + patch_description: "Workaround for GCC 5 bug" + patch_type: "portability" + patch_source: "https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82336" + "3.2.3": + - patch_file: "patches/3.2.1-gcc5-bug-workaround.patch" + patch_description: "Workaround for GCC 5 bug" + patch_type: "portability" + patch_source: "https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82336" + "3.2.2": + - patch_file: "patches/3.2.1-gcc5-bug-workaround.patch" + patch_description: "Workaround for GCC 5 bug" + patch_type: "portability" + patch_source: "https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82336" + - patch_file: "patches/3.2.1-find-libdeflate.patch" + patch_description: "Use find_package for libdeflate" + patch_type: "backport" + patch_source: "https://github.com/AcademySoftwareFoundation/openexr/pull/1613" + "3.2.1": + - patch_file: "patches/3.2.1-gcc5-bug-workaround.patch" + patch_description: "Workaround for GCC 5 bug" + patch_type: "portability" + patch_source: "https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82336" + - patch_file: "patches/3.2.1-find-libdeflate.patch" + patch_description: "Use find_package for libdeflate" + patch_type: "backport" + patch_source: "https://github.com/AcademySoftwareFoundation/openexr/pull/1613" + "3.1.9": + - patch_file: "patches/3.1.4-gcc5-bug-workaround.patch" + patch_description: "Workaround for GCC 5 bug" + patch_type: "portability" + patch_source: "https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82336" + "3.1.7": + - patch_file: "patches/3.1.4-gcc5-bug-workaround.patch" + patch_description: "Workaround for GCC 5 bug" + patch_type: "portability" + patch_source: "https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82336" diff --git a/recipes/openexr/3.x/conanfile.py b/recipes/openexr/3.x/conanfile.py index 8f95edf1a7078..e538cc4469902 100644 --- a/recipes/openexr/3.x/conanfile.py +++ b/recipes/openexr/3.x/conanfile.py @@ -1,22 +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, 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, 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 OpenEXRConan(ConanFile): name = "openexr" description = "OpenEXR is a high dynamic-range (HDR) image file format developed by Industrial Light & " \ "Magic for use in computer imaging applications." - topics = ("openexr", "hdr", "image", "picture") license = "BSD-3-Clause" - homepage = "https://github.com/AcademySoftwareFoundation/openexr" url = "https://github.com/conan-io/conan-center-index" - + homepage = "https://github.com/AcademySoftwareFoundation/openexr" + topics = ("openexr", "hdr", "image", "picture") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -27,9 +28,26 @@ class OpenEXRConan(ConanFile): "fPIC": True, } + @property + def _min_cppstd(self): + if Version(self.version) >= "3.3": + return 17 + return 11 + + @property + def _minimum_compiler_version(self): + return { + "17": { + "gcc": "9" + } + }.get(str(self._min_cppstd), {}) + + @property + def _with_libdeflate(self): + return Version(self.version) >= "3.2" + 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,36 +55,50 @@ 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.13") + def layout(self): + cmake_layout(self, src_folder="src") + def requirements(self): + self.requires("zlib/[>=1.2.11 <2]") # Note: OpenEXR and Imath are versioned independently. - self.requires("imath/3.1.5") + self.requires("imath/3.1.9", transitive_headers=True) + if self._with_libdeflate: + self.requires("libdeflate/1.19") def validate(self): - if self.info.settings.compiler.cppstd: - check_min_cppstd(self, 11) + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) - def layout(self): - cmake_layout(self, src_folder="src") + minimum_version = self._minimum_compiler_version.get(str(self.settings.compiler)) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration(f"{self.ref} requires {self.settings.compiler} >= {minimum_version}") 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["OPENEXR_INSTALL_EXAMPLES"] = False tc.variables["BUILD_TESTING"] = False + tc.variables["BUILD_WEBSITE"] = False tc.variables["DOCS"] = False tc.generate() cd = CMakeDeps(self) cd.generate() - def build(self): + def _patch_sources(self): apply_conandata_patches(self) + + if Version(self.version) >= "3.2": + # Even with BUILD_WEBSITE, Website target is compiled in 3.2 + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "add_subdirectory(website/src)", + "# add_subdirectory(website/src)") + + def build(self): + self._patch_sources() cmake = CMake(self) cmake.configure() cmake.build() @@ -121,6 +153,8 @@ def package_info(self): Iex = self._add_component("Iex") Iex.libs = [f"Iex{lib_suffix}"] Iex.requires = [self._conan_comp("IexConfig")] + if self.settings.os in ["Linux", "FreeBSD"]: + Iex.system_libs = ["m"] # OpenEXR::IlmThread IlmThread = self._add_component("IlmThread") @@ -129,12 +163,16 @@ def package_info(self): self._conan_comp("IlmThreadConfig"), self._conan_comp("Iex"), ] if self.settings.os in ["Linux", "FreeBSD"]: - IlmThread.system_libs = ["pthread"] + IlmThread.system_libs = ["pthread", "m"] # OpenEXR::OpenEXRCore OpenEXRCore = self._add_component("OpenEXRCore") OpenEXRCore.libs = [f"OpenEXRCore{lib_suffix}"] OpenEXRCore.requires = [self._conan_comp("OpenEXRConfig"), "zlib::zlib"] + if self._with_libdeflate: + OpenEXRCore.requires.append("libdeflate::libdeflate") + if self.settings.os in ["Linux", "FreeBSD"]: + OpenEXRCore.system_libs = ["m"] # OpenEXR::OpenEXR OpenEXR = self._add_component("OpenEXR") @@ -143,11 +181,15 @@ def package_info(self): self._conan_comp("OpenEXRCore"), self._conan_comp("IlmThread"), self._conan_comp("Iex"), "imath::imath", ] + if self.settings.os in ["Linux", "FreeBSD"]: + OpenEXR.system_libs = ["m"] # OpenEXR::OpenEXRUtil OpenEXRUtil = self._add_component("OpenEXRUtil") OpenEXRUtil.libs = [f"OpenEXRUtil{lib_suffix}"] OpenEXRUtil.requires = [self._conan_comp("OpenEXR")] + if self.settings.os in ["Linux", "FreeBSD"]: + OpenEXRUtil.system_libs = ["m"] # Add tools directory to PATH self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/openexr/3.x/patches/v3.1.4-gcc5-bug-workaround.patch b/recipes/openexr/3.x/patches/3.1.4-gcc5-bug-workaround.patch similarity index 100% rename from recipes/openexr/3.x/patches/v3.1.4-gcc5-bug-workaround.patch rename to recipes/openexr/3.x/patches/3.1.4-gcc5-bug-workaround.patch diff --git a/recipes/openexr/3.x/patches/3.2.1-find-libdeflate.patch b/recipes/openexr/3.x/patches/3.2.1-find-libdeflate.patch new file mode 100644 index 0000000000000..713d06bd8b4c9 --- /dev/null +++ b/recipes/openexr/3.x/patches/3.2.1-find-libdeflate.patch @@ -0,0 +1,82 @@ +diff --git a/cmake/OpenEXR.pc.in b/cmake/OpenEXR.pc.in +index bce35c2..88ddc9a 100644 +--- a/cmake/OpenEXR.pc.in ++++ b/cmake/OpenEXR.pc.in +@@ -14,7 +14,7 @@ Name: OpenEXR + Description: OpenEXR image library + Version: @OPENEXR_VERSION@ + +-Libs: @exr_pthread_libs@ -L${libdir} -lOpenEXR${libsuffix} -lOpenEXRUtil${libsuffix} -lOpenEXRCore${libsuffix} -lIex${libsuffix} -lIlmThread${libsuffix} @EXR_DEFLATE_LDFLAGS@ ++Libs: @exr_pthread_libs@ -L${libdir} -lOpenEXR${libsuffix} -lOpenEXRUtil${libsuffix} -lOpenEXRCore${libsuffix} -lIex${libsuffix} -lIlmThread${libsuffix} + Cflags: -I${includedir} -I${OpenEXR_includedir} @exr_pthread_cflags@ + Requires: Imath +- ++Requires.private: @EXR_DEFLATE_PKGCONFIG_REQUIRES@ +diff --git a/cmake/OpenEXRSetup.cmake b/cmake/OpenEXRSetup.cmake +index ef5c6c0..0a7dabc 100644 +--- a/cmake/OpenEXRSetup.cmake ++++ b/cmake/OpenEXRSetup.cmake +@@ -160,15 +160,40 @@ set(OPENEXR_DEFLATE_TAG "v1.18" CACHE STRING "Tag to use for libdeflate source r + if(NOT OPENEXR_FORCE_INTERNAL_DEFLATE) + #TODO: ^^ Release should not clone from main, this is a place holder + set(CMAKE_IGNORE_PATH "${CMAKE_CURRENT_BINARY_DIR}/_deps/deflate-src/config;${CMAKE_CURRENT_BINARY_DIR}/_deps/deflate-build/config") +- include(FindPkgConfig) +- pkg_check_modules(deflate IMPORTED_TARGET GLOBAL libdeflate) +- set(CMAKE_IGNORE_PATH) +- if (deflate_FOUND) +- message(STATUS "Using libdeflate from ${deflate_LINK_LIBRARIES}") ++ # First try cmake config ++ find_package(libdeflate CONFIG QUIET) ++ if(libdeflate_FOUND) ++ if(TARGET libdeflate::libdeflate_shared) ++ set(EXR_DEFLATE_LIB libdeflate::libdeflate_shared) ++ else() ++ set(EXR_DEFLATE_LIB libdeflate::libdeflate_static) ++ endif() ++ set(EXR_DEFLATE_VERSION ${libdeflate_VERSION}) ++ message(STATUS "Using libdeflate from ${libdeflate_DIR}") ++ else() ++ # If not found, try pkgconfig ++ find_package(PkgConfig) ++ if(PKG_CONFIG_FOUND) ++ include(FindPkgConfig) ++ pkg_check_modules(deflate IMPORTED_TARGET GLOBAL libdeflate) ++ if(deflate_FOUND) ++ set(EXR_DEFLATE_LIB PkgConfig::deflate) ++ set(EXR_DEFLATE_VERSION ${deflate_VERSION}) ++ message(STATUS "Using libdeflate from ${deflate_LINK_LIBRARIES}") ++ endif() ++ endif() + endif() ++ set(CMAKE_IGNORE_PATH) + endif() + +-if(NOT TARGET PkgConfig::deflate AND NOT deflate_FOUND) ++if(EXR_DEFLATE_LIB) ++ # Using external library ++ set(EXR_DEFLATE_SOURCES) ++ set(EXR_DEFLATE_INCLUDE_DIR) ++ # For OpenEXR.pc.in for static build ++ set(EXR_DEFLATE_PKGCONFIG_REQUIRES "libdeflate >= ${EXR_DEFLATE_VERSION}") ++else() ++ # Using internal deflate + if(OPENEXR_FORCE_INTERNAL_DEFLATE) + message(STATUS "libdeflate forced internal, installing from ${OPENEXR_DEFLATE_REPO} (${OPENEXR_DEFLATE_TAG})") + else() +@@ -213,16 +238,6 @@ if(NOT TARGET PkgConfig::deflate AND NOT deflate_FOUND) + list(TRANSFORM EXR_DEFLATE_SOURCES PREPEND ${deflate_SOURCE_DIR}/) + set(EXR_DEFLATE_INCLUDE_DIR ${deflate_SOURCE_DIR}) + set(EXR_DEFLATE_LIB) +-else() +- set(EXR_DEFLATE_INCLUDE_DIR) +- set(EXR_DEFLATE_LIB ${deflate_LIBRARIES}) +- # set EXR_DEFATE_LDFLAGS for OpenEXR.pc.in for static build +- if (BUILD_SHARED_LIBS) +- set(EXR_DEFLATE_LDFLAGS "") +- else() +- set(EXR_DEFLATE_LDFLAGS "-l${deflate_LIBRARIES}") +- endif() +- set(EXR_DEFLATE_SOURCES) + endif() + + ####################################### diff --git a/recipes/openexr/3.x/patches/3.2.1-gcc5-bug-workaround.patch b/recipes/openexr/3.x/patches/3.2.1-gcc5-bug-workaround.patch new file mode 100644 index 0000000000000..fbf062e5d0184 --- /dev/null +++ b/recipes/openexr/3.x/patches/3.2.1-gcc5-bug-workaround.patch @@ -0,0 +1,13 @@ +diff --git a/src/lib/OpenEXR/ImfAttribute.h b/src/lib/OpenEXR/ImfAttribute.h +index bccd980..c8438f3 100644 +--- a/src/lib/OpenEXR/ImfAttribute.h ++++ b/src/lib/OpenEXR/ImfAttribute.h +@@ -108,7 +108,7 @@ public: + // that the type T is copyable/assignable/moveable. + //------------------------------------------------------------ + +- TypedAttribute () = default; ++ TypedAttribute () {}; + TypedAttribute (const T& value); + TypedAttribute (const TypedAttribute& other) = default; + TypedAttribute (TypedAttribute&& other) = default; diff --git a/recipes/openexr/3.x/test_package/comp_short_decode_piz.exr b/recipes/openexr/3.x/test_package/comp_short_decode_piz.exr deleted file mode 100644 index 3a16d594b3028..0000000000000 Binary files a/recipes/openexr/3.x/test_package/comp_short_decode_piz.exr and /dev/null differ diff --git a/recipes/openexr/3.x/test_package/conanfile.py b/recipes/openexr/3.x/test_package/conanfile.py index e5475f6ba1657..8a5bb47f50c4c 100644 --- a/recipes/openexr/3.x/test_package/conanfile.py +++ b/recipes/openexr/3.x/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) @@ -22,5 +23,4 @@ def build(self): def test(self): if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") - imgfile = os.path.join(self.source_folder, "comp_short_decode_piz.exr") - self.run(f"{bin_path} {imgfile}", env="conanrun") + self.run(bin_path, env="conanrun") diff --git a/recipes/openexr/3.x/test_package/test_package.cpp b/recipes/openexr/3.x/test_package/test_package.cpp index f5c9cab11b69e..d0aa6adf400d6 100644 --- a/recipes/openexr/3.x/test_package/test_package.cpp +++ b/recipes/openexr/3.x/test_package/test_package.cpp @@ -1,18 +1,11 @@ #include #include -#include -#include -#include +#include int main (int argc, char *argv[]) { - if (argc < 2) - return EXIT_FAILURE; - Imf::RgbaInputFile input_file(argv[1]); - const Imf::Header& header = input_file.header(); - size_t width = header.dataWindow().max.x - header.dataWindow().min.x + 1; - size_t height = header.dataWindow().max.y - header.dataWindow().min.y + 1; - std::cout << "OpenEXR images size is " << width << "x" << height << std::endl; + Imf::Header header; + std::cout << "Test: " << header.screenWindowWidth() << std::endl; return EXIT_SUCCESS; } diff --git a/recipes/openexr/config.yml b/recipes/openexr/config.yml index f58456c305b79..e6ec794a60bd1 100644 --- a/recipes/openexr/config.yml +++ b/recipes/openexr/config.yml @@ -1,17 +1,25 @@ versions: - "3.1.5": + "3.3.2": folder: "3.x" - "3.1.4": + "3.3.1": folder: "3.x" - "2.5.7": - folder: "2.x" - "2.5.5": - folder: "2.x" - "2.5.4": - folder: "2.x" - "2.5.3": + "3.3.0": + folder: "3.x" + "3.2.4": + folder: "3.x" + "3.2.3": + folder: "3.x" + "3.2.2": + folder: "3.x" + "3.2.1": + folder: "3.x" + "3.1.9": + folder: "3.x" + "3.1.7": + folder: "3.x" + "2.5.9": folder: "2.x" - "2.5.2": + "2.5.7": folder: "2.x" "2.4.0": folder: "2.x" diff --git a/recipes/openfbx/all/test_package/conanfile.py b/recipes/openfbx/all/test_package/conanfile.py index 7635e9e283758..0a6bc68712d90 100644 --- a/recipes/openfbx/all/test_package/conanfile.py +++ b/recipes/openfbx/all/test_package/conanfile.py @@ -23,5 +23,4 @@ def build(self): def test(self): 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(f"{bin_path} {fbx_path}", env="conanrun") + self.run(bin_path, env="conanrun") diff --git a/recipes/openfbx/all/test_package/d.fbx b/recipes/openfbx/all/test_package/d.fbx deleted file mode 100644 index 147ec354d2be2..0000000000000 Binary files a/recipes/openfbx/all/test_package/d.fbx and /dev/null differ diff --git a/recipes/openfbx/all/test_package/test_package.cpp b/recipes/openfbx/all/test_package/test_package.cpp index be802370b1f87..a45770bbd5562 100644 --- a/recipes/openfbx/all/test_package/test_package.cpp +++ b/recipes/openfbx/all/test_package/test_package.cpp @@ -5,17 +5,11 @@ #include int main(int argc, char **argv) { - if (argc < 2) { - std::cerr << "Need at least one argument" << std::endl; - return -1; - } - std::ifstream in_file(argv[1], std::ios::binary); - in_file.seekg(0, std::ios::end); - int file_size = static_cast(in_file.tellg()); - std::vector content(file_size); + std::vector content(13); + ofbx::IScene *g_scene = ofbx::load(&content[0], 13, static_cast(ofbx::LoadFlags::TRIANGULATE)); - ofbx::IScene *g_scene = ofbx::load(&content[0], file_size, static_cast(ofbx::LoadFlags::TRIANGULATE)); + std::cout << "Test: " << g_scene << std::endl; return 0; } diff --git a/recipes/openfbx/all/test_v1_package/conanfile.py b/recipes/openfbx/all/test_v1_package/conanfile.py index fad029416492d..38f4483872d47 100644 --- a/recipes/openfbx/all/test_v1_package/conanfile.py +++ b/recipes/openfbx/all/test_v1_package/conanfile.py @@ -14,5 +14,4 @@ def build(self): 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) + self.run(bin_path, run_environment=True) diff --git a/recipes/openfst/all/conandata.yml b/recipes/openfst/all/conandata.yml index ef54f290e0077..aed678082ff26 100644 --- a/recipes/openfst/all/conandata.yml +++ b/recipes/openfst/all/conandata.yml @@ -5,4 +5,3 @@ sources: patches: "1.8.2": - patch_file: "patches/1.8.2-allocate-hint.patch" - base_path: "source_subfolder" diff --git a/recipes/openfst/all/conanfile.py b/recipes/openfst/all/conanfile.py index ef0a6f1a558d2..350f5171a2fd1 100644 --- a/recipes/openfst/all/conanfile.py +++ b/recipes/openfst/all/conanfile.py @@ -1,20 +1,26 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, tools -from conans.errors import ConanInvalidConfiguration -import functools -from itertools import product import os +from itertools import product + +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, rename, rm, 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.33.0" +required_conan_version = ">=1.53.0" class OpenFstConan(ConanFile): name = "openfst" description = "A library for constructing, combining, optimizing and searching weighted finite-state-transducers (FSTs)." - topics = ("asr", "fst", "wfst", "openfst") + license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.openfst.org/twiki/bin/view/FST/WebHome" - license = "Apache-2.0" + topics = ("asr", "fst", "wfst", "openfst") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -49,26 +55,27 @@ class OpenFstConan(ConanFile): "enable_special": False, } - @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: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + basic_layout(self, src_folder="src") def validate(self): - if self.settings.os != "Linux": - raise ConanInvalidConfiguration( - "OpenFst is only supported on linux") + if self.settings.os not in ["Linux", "FreeBSD"]: + raise ConanInvalidConfiguration("OpenFst is only supported on linux") compilers = { "gcc": "8", @@ -76,33 +83,36 @@ def validate(self): } 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(f"{self.name} requires c++17, which your compiler does not support.") + 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.") + self.output.warning( + f"{self.name} requires c++17, but this compiler is unknown to this recipe." + f" Assuming your compiler supports c++17." + ) # Check stdlib ABI compatibility if self.settings.compiler == "gcc" and self.settings.compiler.libcxx != "libstdc++11": - raise ConanInvalidConfiguration('Using %s with GCC requires "compiler.libcxx=libstdc++11"' % self.name) + raise ConanInvalidConfiguration( + f'Using {self.name} with GCC requires "compiler.libcxx=libstdc++11"' + ) elif self.settings.compiler == "clang" and self.settings.compiler.libcxx not in ["libstdc++11", "libc++"]: - raise ConanInvalidConfiguration('Using %s with Clang requires either "compiler.libcxx=libstdc++11"' - ' or "compiler.libcxx=libc++"' % self.name) + raise ConanInvalidConfiguration( + f'Using {self.name} with Clang requires either "compiler.libcxx=libstdc++11" or "compiler.libcxx=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) - @functools.lru_cache(1) - def _configure_autotools(self): - autotools = AutoToolsBuildEnvironment(self) + def generate(self): + tc = AutotoolsToolchain(self) yes_no = lambda v: "yes" if v else "no" - args = [ - "--with-pic={}".format(yes_no(self.options.get_safe("fPIC", True))), - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), + tc.configure_args += [ "--enable-bin={}".format(yes_no(self.options.enable_bin)), "--enable-compact-fsts={}".format(yes_no(self.options.enable_compact_fsts)), "--enable-compress={}".format(yes_no(self.options.enable_compress)), @@ -115,47 +125,51 @@ def _configure_autotools(self): "--enable-ngram-fsts={}".format(yes_no(self.options.enable_ngram_fsts)), "--enable-pdt={}".format(yes_no(self.options.enable_pdt)), "--enable-special={}".format(yes_no(self.options.enable_special)), - "LIBS=-lpthread", ] - autotools.configure(args=args, configure_dir=self._source_subfolder) - return autotools - - def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + tc.extra_cflags.append("-pthread") + tc.extra_cxxflags.append("-pthread") + tc.generate() def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) def build(self): self._patch_sources() - autotools = self._configure_autotools() + 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, "COPYING", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder) + + autotools = Autotools(self) autotools.install() lib_dir = os.path.join(self.package_folder, "lib") lib_subdir = os.path.join(self.package_folder, "lib", "fst") if os.path.exists(lib_subdir): for fn in os.listdir(lib_subdir): - tools.rename(os.path.join(lib_subdir, fn), os.path.join(lib_dir, "lib{}".format(fn))) - tools.rmdir(lib_subdir) + rename(self, + os.path.join(lib_subdir, fn), + os.path.join(lib_dir, f"lib{fn}")) + rmdir(self, lib_subdir) - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.remove_files_by_mask(lib_dir, "*.la") + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "*.la", lib_dir, recursive=True) @property def _get_const_fsts_libs(self): - return ["const{}-fst".format(n) for n in [8, 16, 64]] + return [f"const{n}-fst" for n in [8, 16, 64]] @property def _get_compact_fsts_libs(self): - return ["compact{}_{}-fst".format(n, fst) - for n, fst in product([8, 16, 64], ["acceptor", "string", "unweighted_acceptor", "unweighted", "weighted_string"])] + return [f"compact{n}_{fst}-fst" + for n, fst in product( + [8, 16, 64], + ["acceptor", "string", "unweighted_acceptor", "unweighted", "weighted_string"] + )] def package_info(self): self.cpp_info.set_property("cmake_file_name", "OpenFst") @@ -196,8 +210,9 @@ def package_info(self): if self.options.enable_pdt or self.options.enable_grm: self.cpp_info.libs.append("fstpdtscript") - bindir = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment var: {}".format(bindir)) - self.env_info.PATH.append(bindir) - self.cpp_info.system_libs = ["pthread", "dl", "m"] + + # TODO: Legacy, to be removed on Conan 2.0 + bindir = os.path.join(self.package_folder, "bin") + self.output.info(f"Appending PATH environment var: {bindir}") + self.env_info.PATH.append(bindir) diff --git a/recipes/openfst/all/test_package/CMakeLists.txt b/recipes/openfst/all/test_package/CMakeLists.txt index cdd919fc9ae03..71588be2b8f7e 100644 --- a/recipes/openfst/all/test_package/CMakeLists.txt +++ b/recipes/openfst/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) set(CMAKE_CXX_STANDARD 17) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(OpenFst REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/openfst/all/test_package/conanfile.py b/recipes/openfst/all/test_package/conanfile.py index 90eb89e3f2f46..ef5d7042163ec 100644 --- a/recipes/openfst/all/test_package/conanfile.py +++ b/recipes/openfst/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/openfst/all/test_v1_package/CMakeLists.txt b/recipes/openfst/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/openfst/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/openfst/all/test_v1_package/conanfile.py b/recipes/openfst/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..90eb89e3f2f46 --- /dev/null +++ b/recipes/openfst/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/openfx/all/CMakeLists.txt b/recipes/openfx/all/CMakeLists.txt index 5232e354a73ee..1a7641b6f3019 100644 --- a/recipes/openfx/all/CMakeLists.txt +++ b/recipes/openfx/all/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.12) project(openfx VERSION 1.4.0 LANGUAGES CXX) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -6,18 +6,18 @@ add_definitions(-D_HAS_AUTO_PTR_ETC) # Flags if(MSVC) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWINDOWS -DNOMINMAX") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWINDOWS -DNOMINMAX -D_WIN32") else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-deprecated -Wno-deprecated-declarations") + add_definitions(-Dlinux) endif() # Conan -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) -find_package(EXPAT REQUIRED) +find_package(expat REQUIRED) +find_package(OpenGL REQUIRED) # Macros -set(SOURCE_SUBFOLDER ${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder) +set(SOURCE_SUBFOLDER ${CMAKE_CURRENT_LIST_DIR}/src) # Sources set(OFX_HEADER_DIR "${SOURCE_SUBFOLDER}/include") @@ -50,7 +50,7 @@ add_library(OfxHost ${OFX_HOSTSUPPORT_HEADER_FILES} ${OFX_HOSTSUPPORT_LIBRARY_FILES}) -target_link_libraries(OfxHost PUBLIC EXPAT::EXPAT) +target_link_libraries(OfxHost PUBLIC expat::expat OpenGL::GL) target_include_directories(OfxHost PUBLIC ${OFX_HEADER_DIR} @@ -68,7 +68,5 @@ install(FILES ${OFX_HOSTSUPPORT_HEADER_FILES} DESTINATION "include") -install(TARGETS OfxSupport OfxHost - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib) +include(GNUInstallDirs) +install(TARGETS OfxSupport OfxHost) diff --git a/recipes/openfx/all/conanfile.py b/recipes/openfx/all/conanfile.py index 6f5bee8600958..2fa66bbb90d2a 100644 --- a/recipes/openfx/all/conanfile.py +++ b/recipes/openfx/all/conanfile.py @@ -1,54 +1,73 @@ -from conans import ConanFile, CMake, tools import os +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 copy, get, rmdir + +required_conan_version = ">=1.53.0" + class openfx(ConanFile): name = "openfx" + description = "OpenFX image processing plug-in standard." license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "http://openeffects.org" - description = "OpenFX image processing plug-in standard." topics = ("image-processing", "standard") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { - "fPIC": [True, False], "shared": [True, False], + "fPIC": [True, False], } default_options = { - "fPIC": True, "shared": False, + "fPIC": True, } - requires = ("opengl/system", "expat/2.4.8") - exports_sources = "CMakeLists.txt", "cmake/*", "symbols/*" - generators = "cmake", "cmake_find_package" - _cmake = None + def export_sources(self): + copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder) + copy(self, "*", + src=os.path.join(self.recipe_folder, "cmake"), + dst=os.path.join(self.export_sources_folder, "cmake")) + copy(self, "*", + src=os.path.join(self.recipe_folder, "symbols"), + dst=os.path.join(self.export_sources_folder, "symbols")) - def source(self): - tools.get( - **self.conan_data["sources"][self.version], - destination="source_subfolder", - strip_root=True - ) + 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 requirements(self): + self.requires("opengl/system") + self.requires("expat/[>=2.6.2 <3]") - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.configure() - return self._cmake + 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], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.generate() + tc = CMakeDeps(self) + tc.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=self.source_path.parent) cmake.build() @property @@ -56,26 +75,25 @@ def _build_modules(self): return [os.path.join("lib", "cmake", "OpenFX.cmake")] def package(self): - cmake = self._configure_cmake() - - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - + cmake = CMake(self) cmake.install() - - self.copy("*.symbols", src="symbols", dst="lib/symbols") - self.copy("*.cmake", src="cmake", dst="lib/cmake") - self.copy("LICENSE", src="source_subfolder/Support", dst="licenses") - self.copy("readme.md") + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + copy(self, "*.symbols", + src=os.path.join(self.export_sources_folder, "symbols"), + dst=os.path.join(self.package_folder, "lib", "symbols")) + copy(self, "*.cmake", + src=os.path.join(self.export_sources_folder, "cmake"), + dst=os.path.join(self.package_folder, "lib", "cmake")) + copy(self, "LICENSE", + src=os.path.join(self.source_folder, "Support"), + dst=os.path.join(self.package_folder, "licenses")) def package_info(self): - self.cpp_info.names["cmake_find_package"] = "openfx" - self.cpp_info.names["cmake_find_package_multi"] = "openfx" - + self.cpp_info.set_property("cmake_file_name", "openfx") + self.cpp_info.set_property("cmake_target_name", "openfx::openfx") self.cpp_info.set_property("cmake_build_modules", self._build_modules) self.cpp_info.builddirs.append(os.path.join("lib", "cmake")) - self.cpp_info.build_modules["cmake_find_package"] = self._build_modules - self.cpp_info.build_modules["cmake_find_package_multi"] = self._build_modules if self.options.shared: self.cpp_info.libs = ["OfxSupport"] @@ -84,5 +102,11 @@ def package_info(self): if self.settings.os in ("Linux", "FreeBSD"): self.cpp_info.system_libs.extend(["GL"]) - if self.settings.os == "Macos": + if is_apple_os(self): self.cpp_info.frameworks = ["CoreFoundation", "OpenGL"] + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.names["cmake_find_package"] = "openfx" + self.cpp_info.names["cmake_find_package_multi"] = "openfx" + self.cpp_info.build_modules["cmake_find_package"] = self._build_modules + self.cpp_info.build_modules["cmake_find_package_multi"] = self._build_modules diff --git a/recipes/openfx/all/test_package/CMakeLists.txt b/recipes/openfx/all/test_package/CMakeLists.txt index c80f526f36b85..130ac63e132fe 100644 --- a/recipes/openfx/all/test_package/CMakeLists.txt +++ b/recipes/openfx/all/test_package/CMakeLists.txt @@ -1,12 +1,11 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) add_definitions(-D_HAS_AUTO_PTR_ETC) # Conan -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) find_package(openfx REQUIRED CONFIG) # Flags diff --git a/recipes/openfx/all/test_package/conanfile.py b/recipes/openfx/all/test_package/conanfile.py index 884a3017a3bd6..93275299d1c47 100644 --- a/recipes/openfx/all/test_package/conanfile.py +++ b/recipes/openfx/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("%s --help" % bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + self.run(f"{bin_path} --help", env="conanrun") diff --git a/recipes/openfx/all/test_v1_package/CMakeLists.txt b/recipes/openfx/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/openfx/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/openfx/all/test_v1_package/conanfile.py b/recipes/openfx/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..884a3017a3bd6 --- /dev/null +++ b/recipes/openfx/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("%s --help" % bin_path, run_environment=True) diff --git a/recipes/opengl-registry/all/conandata.yml b/recipes/opengl-registry/all/conandata.yml index 1fa4f5c98ec9a..fad17557e62be 100644 --- a/recipes/opengl-registry/all/conandata.yml +++ b/recipes/opengl-registry/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "20240721": + url: "https://github.com/KhronosGroup/OpenGL-Registry/archive/d2fe2072a3aecf3e9ef1568976e805531b50d959.tar.gz" + sha256: "0c8295a95e137b0dabd5ad138ad41d96b40e85bcca848b62a3e13378e425a08a" "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 index 46486aec2fc82..5e0a3df392096 100644 --- a/recipes/opengl-registry/all/conanfile.py +++ b/recipes/opengl-registry/all/conanfile.py @@ -13,6 +13,7 @@ class OpenGLRegistryConan(ConanFile): topics = ("opengl-registry", "opengl") homepage = "https://github.com/KhronosGroup/OpenGL-Registry" url = "https://github.com/conan-io/conan-center-index" + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -26,8 +27,7 @@ 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 @@ -46,3 +46,4 @@ def package(self): def package_info(self): self.cpp_info.bindirs = [] self.cpp_info.libdirs = [] + self.cpp_info.resdirs = ["res"] diff --git a/recipes/opengl-registry/all/test_package/test_package.c b/recipes/opengl-registry/all/test_package/test_package.c index a9cb3640b85e1..947465a4a0c1c 100644 --- a/recipes/opengl-registry/all/test_package/test_package.c +++ b/recipes/opengl-registry/all/test_package/test_package.c @@ -4,6 +4,7 @@ #include int main() { + printf("GL_GLEXT_VERSION: %d\n", GL_GLEXT_VERSION); 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/config.yml b/recipes/opengl-registry/config.yml index 0168ee0addf88..07c28129c1bb5 100644 --- a/recipes/opengl-registry/config.yml +++ b/recipes/opengl-registry/config.yml @@ -1,3 +1,5 @@ versions: + "20240721": + folder: all "cci.20220929": folder: all diff --git a/recipes/opengl/all/conanfile.py b/recipes/opengl/all/conanfile.py index bff45b4715333..ca99bbad2e12f 100644 --- a/recipes/opengl/all/conanfile.py +++ b/recipes/opengl/all/conanfile.py @@ -1,9 +1,8 @@ from conan import ConanFile -from conan.errors import ConanException from conan.tools.system import package_manager -from conans import tools +from conan.tools.gnu import PkgConfig -required_conan_version = ">=1.47" +required_conan_version = ">=1.50.0" class SysConfigOpenGLConan(ConanFile): @@ -14,59 +13,41 @@ class SysConfigOpenGLConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.opengl.org/" license = "MIT" + package_type = "shared-library" settings = "os", "arch", "compiler", "build_type" + def layout(self): + pass + 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("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")] - - 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) + self.info.clear() def system_requirements(self): + if self.settings.os not in ["Linux", "FreeBSD", "SunOS"]: + return + dnf = package_manager.Dnf(self) - if tools.os_info.linux_distro == "fedora" and tools.os_info.os_version >= "32": - dnf.install(["libglvnd-devel"], update=True, check=True) - else: - dnf.install(["mesa-libGL-devel"], update=True, check=True) + dnf.install_substitutes(["libglvnd-devel"], ["mesa-libGL-devel"], update=True, check=True) yum = package_manager.Yum(self) yum.install(["mesa-libGL-devel"], update=True, check=True) apt = package_manager.Apt(self) - 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: - apt.install(["libgl-dev"], update=True, check=True) - else: - apt.install(["libgl1-mesa-dev"], update=True, check=True) + 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) + zypper.install_substitutes(["Mesa-libGL-devel", "glproto-devel"], + ["Mesa-libGL-devel", "xorgproto-devel"], update=True, check=True) pkg = package_manager.Pkg(self) pkg.install(["libglvnd"], update=True, check=True) + pkg_util = package_manager.PkgUtil(self) + pkg_util.install(["mesalibs"], 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"] = "opengl_system" @@ -74,6 +55,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": @@ -81,5 +63,6 @@ def package_info(self): self.cpp_info.frameworks.append("OpenGL") elif self.settings.os == "Windows": self.cpp_info.system_libs = ["opengl32"] - elif self.settings.os in ["Linux", "FreeBSD"]: - self._fill_cppinfo_from_pkgconfig('gl') + elif self.settings.os in ["Linux", "FreeBSD", "SunOS"]: + 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/conanfile.py b/recipes/opengv/all/conanfile.py index 34bbe096cc7bc..f2c8c1062b989 100644 --- a/recipes/opengv/all/conanfile.py +++ b/recipes/opengv/all/conanfile.py @@ -6,7 +6,8 @@ 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" +required_conan_version = ">=1.53.0" + class opengvConan(ConanFile): name = "opengv" @@ -15,8 +16,8 @@ class opengvConan(ConanFile): homepage = "https://github.com/laurentkneip/opengv" license = "BSD-3-Clause" topics = ("computer", "vision", "geometric", "pose", "triangulation", "point-cloud") + package_type = "library" settings = "os", "arch", "compiler", "build_type" - options = { "shared": [True, False], "fPIC": [True, False], @@ -37,12 +38,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("eigen/3.4.0") + self.requires("eigen/3.4.0", transitive_headers=True) if self.options.with_python_bindings: - self.requires("pybind11/2.10.0") + self.requires("pybind11/2.10.1") def validate(self): # Disable windows builds since they error out. @@ -52,11 +56,8 @@ def validate(self): if self.settings.compiler == "clang" and self.settings.compiler.version == 12: raise ConanInvalidConfiguration("Clang 12 builds fail on Conan CI.") - 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) @@ -89,17 +90,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", "opengv") diff --git a/recipes/opengv/all/test_package/CMakeLists.txt b/recipes/opengv/all/test_package/CMakeLists.txt index 17768c1b86abd..de51eacadb93f 100644 --- a/recipes/opengv/all/test_package/CMakeLists.txt +++ b/recipes/opengv/all/test_package/CMakeLists.txt @@ -1,8 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(opengv REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} opengv) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE opengv) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/opengv/all/test_package/conanfile.py b/recipes/opengv/all/test_package/conanfile.py index 0a318ba85a952..12503ced11f45 100644 --- a/recipes/opengv/all/test_package/conanfile.py +++ b/recipes/opengv/all/test_package/conanfile.py @@ -1,20 +1,20 @@ 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 +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 requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/opengv/all/test_v1_package/CMakeLists.txt b/recipes/opengv/all/test_v1_package/CMakeLists.txt index 56b29eaba3a22..0d20897301b68 100644 --- a/recipes/opengv/all/test_v1_package/CMakeLists.txt +++ b/recipes/opengv/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(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) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/openh264/all/conandata.yml b/recipes/openh264/all/conandata.yml index 679b1b0e3b70d..4d8902d954f8b 100644 --- a/recipes/openh264/all/conandata.yml +++ b/recipes/openh264/all/conandata.yml @@ -1,38 +1,13 @@ sources: + "2.5.0": + url: "https://github.com/cisco/openh264/archive/refs/tags/v2.5.0.tar.gz" + sha256: "94c8ca364db990047ec4ec3481b04ce0d791e62561ef5601443011bdc00825e3" + "2.4.1": + url: "https://github.com/cisco/openh264/archive/refs/tags/v2.4.1.tar.gz" + sha256: "8ffbe944e74043d0d3fb53d4a2a14c94de71f58dbea6a06d0dc92369542958ea" "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" - "1.7.0": - 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" - patch_type: "portability" - patch_description: "Android Fix" - - patch_file: "patches/2.1.1-0002-macos-relocatable-shared.patch" - patch_type: "portability" - patch_description: "Macos relocatable shared fix" - - patch_file: "patches/1.7.0-0004-mingw-override-CC-CXX-AR-from-env.patch" - 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" - patch_type: "portability" - patch_description: "Android Fix" - - patch_file: "patches/1.7.0-0002-macos-relocatable-shared.patch" - patch_type: "portability" - patch_description: "Macos relocatable shared fix" - - patch_file: "patches/1.7.0-0004-mingw-override-CC-CXX-AR-from-env.patch" - 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 43796c374b53d..cfdd6104e9efb 100644 --- a/recipes/openh264/all/conanfile.py +++ b/recipes/openh264/all/conanfile.py @@ -1,27 +1,28 @@ from conan import ConanFile -from conans import tools +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.files import copy, get, rmdir, rm, rename, replace_in_file from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc +from conan.tools.apple import fix_apple_shared_install_name from conan.tools.scm import Version -from conan.tools.microsoft import is_msvc, unix_path, msvc_runtime_flag +from conan.tools.meson import Meson, MesonToolchain +from conan.errors import ConanInvalidConfiguration import os -required_conan_version = ">=1.53.0" +required_conan_version = ">=2.0.9" class OpenH264Conan(ConanFile): name = "openh264" + description = "Open Source H.264 Codec" + license = "BSD-2-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "http://www.openh264.org/" - description = "Open Source H.264 Codec" topics = ("h264", "codec", "video", "compression", ) - license = "BSD-2-Clause" - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -31,161 +32,95 @@ class OpenH264Conan(ConanFile): "shared": False, "fPIC": True, } - - @property - def _settings_build(self): - return getattr(self, "settings_build", self.settings) + implements = ["auto_shared_fpic"] @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 - - def configure(self): - if self.options.shared: - self.options.rm_safe("fPIC") + @property + def _preserve_dll_name(self): + return (is_msvc(self) or self._is_clang_cl) and Version(self.version) <= "2.4.1" and self.options.shared def layout(self): basic_layout(self, src_folder="src") def build_requirements(self): - if self.settings.arch in ("x86", "x86_64"): - 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") + self.tool_requires("meson/1.4.1") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/[>=2.2 <3]") + if self.settings.arch in ["x86", "x86_64"]: + self.tool_requires("nasm/2.16.01") + + def validate(self): + if Version(self.version) <= "2.1.1" and self.settings.os in ["Android", "Macos"]: + # INFO: ../src/meson.build:86:2: ERROR: Problem encountered: FIXME: Unhandled system android + # INFO: ../src/meson.build:86:2: ERROR: Problem encountered: FIXME: Unhandled system darwin + raise ConanInvalidConfiguration(f"{self.ref} does not support {self.settings.os}. Try a newer version.") def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - def _patch_sources(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": - 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 (is_msvc(self) or self._is_clang_cl) else "lib" - if self.options.shared: - if is_apple_os(self): - suffix = ".dylib" - elif self.settings.os == "Windows": - suffix = ".dll" - else: - suffix = ".so" - else: - if is_msvc(self) or self._is_clang_cl: - suffix = ".lib" - else: - suffix = ".a" - return prefix + "openh264" + suffix - - @property - def _make_arch(self): - return { - "armv7": "arm", - "armv8": "arm64", - "x86": "i386", - }.get(str(self.settings.arch), str(self.settings.arch)) - - @property - def _android_target(self): - return f"android-{self.settings.os.api_level}" - - @property - def _make_args(self): - prefix = unix_path(self, os.path.abspath(self.package_folder)) - args = [ - f"ARCH={self._make_arch}", - f"PREFIX={prefix}" - ] - - 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 = 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([ - f"NDKLEVEL={self.settings.os.api_level}", - f"STL_LIB={stl_lib}", - "OS=android", - 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 not (self.settings.compiler == "Visual Studio" and Version(self.settings.compiler.version) < "12"): - 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 = MesonToolchain(self) + tc.project_options["tests"] = "disabled" tc.generate() + def _patch_sources(self): + if self._preserve_dll_name: + # INFO: When generating with Meson, the library name is openh264-7.dll. This change preserves the old name openh264.dll + replace_in_file(self, os.path.join(self.source_folder, "meson.build"), "soversion: major_version,", "soversion: '',") + def build(self): - apply_conandata_patches(self) self._patch_sources() - autotools = Autotools(self) - with chdir(self, self.source_folder): - autotools.make(target=self._library_filename) + 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) - autotools = Autotools(self) - with chdir(self, self.source_folder): - autotools.make( - target=f'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) + meson = Meson(self) + meson.install() rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + # INFO: Version 2.1.1 installs both static and shared libraries using same target name + if Version(self.version) <= "2.1.1": + if self.options.shared: + rm(self, "*.a", os.path.join(self.package_folder, "lib")) + else: + rm(self, "*.so*", os.path.join(self.package_folder, "lib")) + rm(self, "*.dylib*", os.path.join(self.package_folder, "lib")) + rm(self, "*.dll", os.path.join(self.package_folder, "bin")) + rm(self, "openh264.lib", os.path.join(self.package_folder, "lib")) + + if is_msvc(self) or self._is_clang_cl: + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + if Version(self.version) <= "2.4.1": + if self.options.shared: + # INFO: Preserve same old library name as when building with Make on Windows but using Meson + rename(self, os.path.join(self.package_folder, "lib", "openh264.lib"), + os.path.join(self.package_folder, "lib", "openh264_dll.lib")) + if not self.options.shared: + rename(self, os.path.join(self.package_folder, "lib", "libopenh264.a"), + os.path.join(self.package_folder, "lib", "openh264.lib")) fix_apple_shared_install_name(self) def package_info(self): - self.cpp_info.set_property("pkg_config_name", "openh264") - suffix = "_dll" if ( - is_msvc(self) or self._is_clang_cl) and self.options.shared else "" + suffix = "_dll" if self._preserve_dll_name 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") - # TODO: switch to conan.tools.build.stdcpp_library in conan 1.54 - libcxx = tools.stdcpp_library(self) - if libcxx: - self.cpp_info.system_libs.append(libcxx) + if not self.options.shared: + libcxx = stdcpp_library(self) + if libcxx: + if self.settings.os == "Android" and libcxx == "c++_static": + # INFO: When builing for Android, need to link against c++abi too. Otherwise will get linkage errors: + # ld.lld: error: undefined symbol: operator new(unsigned long) + # >>> referenced by welsEncoderExt.cpp + self.cpp_info.system_libs.append("c++abi") + self.cpp_info.system_libs.append(libcxx) diff --git a/recipes/openh264/all/patches/1.7.0-0001-platform-android.mk.patch b/recipes/openh264/all/patches/1.7.0-0001-platform-android.mk.patch deleted file mode 100644 index 512d9a7cdfe3f..0000000000000 --- a/recipes/openh264/all/patches/1.7.0-0001-platform-android.mk.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- build/platform-android.mk -+++ build/platform-android.mk -@@ -38,23 +38,12 @@ - - TOOLCHAINPREFIX = $(shell NDK_PROJECT_PATH=$(SRC_PATH)/codec/build/android/dec make --no-print-dir -f $(NDKROOT)/build/core/build-local.mk DUMP_TOOLCHAIN_PREFIX APP_ABI=$(APP_ABI)) - --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 - CXXFLAGS += -fno-rtti -fno-exceptions --LDFLAGS += --sysroot=$(SYSROOT) - SHLDFLAGS = -Wl,--no-undefined -Wl,-z,relro -Wl,-z,now -Wl,-soname,lib$(PROJECT_NAME).so - --ifneq ($(CXX),$(wildcard $(CXX))) --ifneq ($(CXX).exe,$(wildcard $(CXX).exe)) --$(error Compiler not found, bad NDKROOT or ARCH?) --endif --endif -- - STL_INCLUDES = \ -- -I$(NDKROOT)/sources/cxx-stl/stlport/stlport -+ -I$(NDKROOT)/sources/cxx-stl/llvm-libc++/include - STL_LIB = \ - $(NDKROOT)/sources/cxx-stl/stlport/libs/$(APP_ABI)/libstlport_static.a - diff --git a/recipes/openh264/all/patches/1.7.0-0002-macos-relocatable-shared.patch b/recipes/openh264/all/patches/1.7.0-0002-macos-relocatable-shared.patch deleted file mode 100644 index dc10d42f2255e..0000000000000 --- a/recipes/openh264/all/patches/1.7.0-0002-macos-relocatable-shared.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/build/platform-darwin.mk -+++ b/build/platform-darwin.mk -@@ -7,7 +7,7 @@ CURRENT_VERSION := 1.7.0 - COMPATIBILITY_VERSION := 1.7.0 - 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 diff --git a/recipes/openh264/all/patches/1.7.0-0004-mingw-override-CC-CXX-AR-from-env.patch b/recipes/openh264/all/patches/1.7.0-0004-mingw-override-CC-CXX-AR-from-env.patch deleted file mode 100644 index fd092924362ea..0000000000000 --- a/recipes/openh264/all/patches/1.7.0-0004-mingw-override-CC-CXX-AR-from-env.patch +++ /dev/null @@ -1,9 +0,0 @@ ---- build/platform-mingw_nt.mk -+++ build/platform-mingw_nt.mk -@@ -13,3 +13,3 @@ --CC = x86_64-w64-mingw32-gcc --CXX = x86_64-w64-mingw32-g++ --AR = x86_64-w64-mingw32-ar -+CC ?= x86_64-w64-mingw32-gcc -+CXX ?= x86_64-w64-mingw32-g++ -+AR ?= x86_64-w64-mingw32-ar diff --git a/recipes/openh264/all/patches/2.1.1-0001-platform-android.mk.patch b/recipes/openh264/all/patches/2.1.1-0001-platform-android.mk.patch deleted file mode 100644 index 2fbaccb65a3c9..0000000000000 --- a/recipes/openh264/all/patches/2.1.1-0001-platform-android.mk.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- 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 -fstack-protector-all -+CFLAGS += -DANDROID_NDK -fpic -MMD -MP -fstack-protector-all - 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.1.1-0002-macos-relocatable-shared.patch b/recipes/openh264/all/patches/2.1.1-0002-macos-relocatable-shared.patch deleted file mode 100644 index ae1867902a4ea..0000000000000 --- a/recipes/openh264/all/patches/2.1.1-0002-macos-relocatable-shared.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/build/platform-darwin.mk -+++ b/build/platform-darwin.mk -@@ -7,7 +7,7 @@ CURRENT_VERSION := 2.1.1 - COMPATIBILITY_VERSION := 2.1.0 - 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 -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 deleted file mode 100644 index 7b4564ae8dded..0000000000000 --- a/recipes/openh264/all/patches/2.3.1-0001-platform-android.mk.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- 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 deleted file mode 100644 index 7b9b27ea4570a..0000000000000 --- a/recipes/openh264/all/patches/2.3.1-0002-macos-relocatable-shared.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- 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/conanfile.py b/recipes/openh264/all/test_package/conanfile.py index 1a1d9c4ff58f1..e845ae751a301 100644 --- a/recipes/openh264/all/test_package/conanfile.py +++ b/recipes/openh264/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_layout, CMake import os @@ -21,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not cross_building(self, skip_x64_x86=True): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/openh264/config.yml b/recipes/openh264/config.yml index 783b155e8bb7a..9d2abec6a5e96 100644 --- a/recipes/openh264/config.yml +++ b/recipes/openh264/config.yml @@ -1,7 +1,9 @@ versions: + "2.5.0": + folder: all + "2.4.1": + folder: all "2.3.1": folder: all "2.1.1": folder: all - "1.7.0": - folder: all diff --git a/recipes/openimageio/all/CMakeLists.txt b/recipes/openimageio/all/CMakeLists.txt deleted file mode 100644 index 62d9f71f06583..0000000000000 --- a/recipes/openimageio/all/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include("conanbuildinfo.cmake") -conan_basic_setup(KEEP_RPATHS) - -include_directories( - BEFORE - # OIIO uses CMAKE_BINARY_DIR, we need to set include dirs - # in order to be able to use add_subdirectory - "${CMAKE_BINARY_DIR}/source_subfolder/src/include" - "${CMAKE_BINARY_DIR}/source_subfolder/include" - # Same as above but for CMAKE_SOURCE_DIR - "${CMAKE_SOURCE_DIR}/source_subfolder/src/include" -) - -set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP YES) - -add_subdirectory(source_subfolder) diff --git a/recipes/openimageio/all/conandata.yml b/recipes/openimageio/all/conandata.yml index c2709435e1f40..ec02436b0682d 100644 --- a/recipes/openimageio/all/conandata.yml +++ b/recipes/openimageio/all/conandata.yml @@ -1,20 +1,47 @@ sources: - "2.2.7.0": - url: "https://github.com/OpenImageIO/oiio/archive/Release-2.2.7.0.tar.gz" - sha256: "857ac83798d6d2bda5d4d11a90618ff19486da2e5a4c4ff022c5976b5746fe8c" - "2.2.18.0": - url: "https://github.com/OpenImageIO/oiio/archive/refs/tags/v2.2.18.0.tar.gz" - sha256: "72597619f09b60cc2afc18f378b40fbec62701112957f43cff162dd9a52a26ce" - "2.3.7.2": - url: "https://github.com/OpenImageIO/oiio/archive/refs/tags/v2.3.7.2.tar.gz" - sha256: "829c05d17610f1156c2a777310f4709b81f3a302fd11e3999ea4a865a5b4a5d3" + "2.4.7.1": + url: "https://github.com/AcademySoftwareFoundation/OpenImageIO/archive/refs/tags/v2.4.7.1.tar.gz" + sha256: "a3dc6fdb3693eb5f1e22191e41c05800a4944f3c76daffe90bd203f956180126" + "2.4.17.0": + url: "https://github.com/AcademySoftwareFoundation/OpenImageIO/archive/refs/tags/v2.4.17.0.tar.gz" + sha256: "7fe81d8e5bce30cc4a212f020ac3cc4344e6b7c1c0842475e3a048515099c65c" + "2.5.14.0": + url: "https://github.com/AcademySoftwareFoundation/OpenImageIO/archive/refs/tags/v2.5.14.0.tar.gz" + sha256: "0e74372c658f083820872311d126867f10d59b526a856672746de7b2c772034d" + "2.5.15.0": + url: "https://github.com/AcademySoftwareFoundation/OpenImageIO/archive/refs/tags/v2.5.15.0.tar.gz" + sha256: "7779ef2c3d03c5ed95e13ff292de85c3f8cee301cd46baad0d2dc83c93bfe85c" + "2.5.16.0": + url: "https://github.com/AcademySoftwareFoundation/OpenImageIO/archive/refs/tags/v2.5.16.0.tar.gz" + sha256: "e5438e28d34a5b0a09428ed77ec310edd47c141db1b259364859110847e161e7" + "2.5.17.0": + url: "https://github.com/AcademySoftwareFoundation/OpenImageIO/archive/refs/tags/v2.5.17.0.tar.gz" + sha256: "9cf1b98762ce5aa5f3f7cd34672549034f5716da1eba26eb5173c18aa21e6583" patches: - "2.2.7.0": - - patch_file: "patches/2.2.7.0-cmake-targets.patch" - base_path: "source_subfolder" - "2.2.18.0": - - patch_file: "patches/2.2.18.0-cmake-targets.patch" - base_path: "source_subfolder" - "2.3.7.2": - - patch_file: "patches/2.3.7.2-cmake-targets.patch" - base_path: "source_subfolder" + "2.4.7.1": + - patch_file: "patches/2.4.7.1-cmake-targets.patch" + patch_description: "Ensure project builds correctly with Conan (don't pick up disabled dependencies from the system, fix different spelling of libraries)" + patch_type: "conan" + - patch_file: "patches/2.4.7.1-fix-msvc2017.patch" + patch_description: "Fix compile error with MSVC 2017" + patch_type: "official" + "2.4.17.0": + - patch_file: "patches/2.4.17.0-cmake-targets.patch" + patch_description: "Ensure project builds correctly with Conan (don't pick up disabled dependencies from the system, fix different spelling of libraries)" + patch_type: "conan" + "2.5.14.0": + - patch_file: "patches/2.5.14.0-cmake-targets.patch" + patch_description: "Ensure project builds correctly with Conan (don't pick up disabled dependencies from the system, fix different spelling of libraries)" + patch_type: "conan" + "2.5.15.0": + - patch_file: "patches/2.5.14.0-cmake-targets.patch" + patch_description: "Ensure project builds correctly with Conan (don't pick up disabled dependencies from the system, fix different spelling of libraries)" + patch_type: "conan" + "2.5.16.0": + - patch_file: "patches/2.5.14.0-cmake-targets.patch" + patch_description: "Ensure project builds correctly with Conan (don't pick up disabled dependencies from the system, fix different spelling of libraries)" + patch_type: "conan" + "2.5.17.0": + - patch_file: "patches/2.5.17.0-cmake-targets.patch" + patch_description: "Ensure project builds correctly with Conan (don't pick up disabled dependencies from the system, fix different spelling of libraries)" + patch_type: "conan" diff --git a/recipes/openimageio/all/conanfile.py b/recipes/openimageio/all/conanfile.py index 0d32e8e437405..77024f25cf6bb 100644 --- a/recipes/openimageio/all/conanfile.py +++ b/recipes/openimageio/all/conanfile.py @@ -1,10 +1,13 @@ +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, export_conandata_patches, copy, get, rm, rmdir 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.tools.scm import Version +from conan.errors import ConanInvalidConfiguration import os -required_conan_version = ">=1.45.0" +required_conan_version = ">=1.53.0" class OpenImageIOConan(ConanFile): @@ -16,7 +19,7 @@ class OpenImageIOConan(ConanFile): "professional, large-scale animation and visual effects work for film." ) topics = ("vfx", "image", "picture") - license = "BSD-3-Clause" + license = "Apache-2.0", "BSD-3-Clause" homepage = "http://www.openimageio.org/" url = "https://github.com/conan-io/conan-center-index" @@ -49,34 +52,21 @@ class OpenImageIOConan(ConanFile): "with_freetype": True, "with_hdf5": True, "with_opencolorio": True, - "with_opencv": True, - "with_tbb": True, - "with_dicom": False, # Heavy dependency, disabled by default + "with_opencv": False, + "with_tbb": False, + "with_dicom": False, # Heavy dependency, disabled by default "with_ffmpeg": True, "with_giflib": True, "with_libheif": True, - "with_raw": False, # libraw is available under CDDL-1.0 or LGPL-2.1, for this reason it is disabled by default + "with_raw": False, # libraw is available under CDDL-1.0 or LGPL-2.1, for this reason it is disabled by default "with_openjpeg": True, - "with_openvdb": False, # FIXME: broken on M1 + "with_openvdb": False, # FIXME: broken on M1 "with_ptex": True, "with_libwebp": True, } - 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": @@ -84,205 +74,235 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") def requirements(self): # Required libraries - self.requires("zlib/1.2.12") - self.requires("boost/1.78.0") - self.requires("libtiff/4.3.0") - self.requires("openexr/2.5.7") + self.requires("zlib/[>=1.2.11 <2]") + self.requires("boost/1.84.0") + self.requires("libtiff/4.6.0") + self.requires("imath/3.1.9", transitive_headers=True) + self.requires("openexr/3.2.3") if self.options.with_libjpeg == "libjpeg": - self.requires("libjpeg/9d") + self.requires("libjpeg/9e") elif self.options.with_libjpeg == "libjpeg-turbo": - self.requires("libjpeg-turbo/2.1.2") - self.requires("pugixml/1.12.1") + self.requires("libjpeg-turbo/3.0.2") + self.requires("pugixml/1.14") self.requires("libsquish/1.15") - self.requires("tsl-robin-map/1.0.1") - self.requires("fmt/8.1.1") + self.requires("tsl-robin-map/1.2.1") + if Version(self.version) >= "2.4.17.0": + self.requires("fmt/10.2.1", transitive_headers=True) + else: + self.requires("fmt/9.1.0", transitive_headers=True) # Optional libraries if self.options.with_libpng: - self.requires("libpng/1.6.37") + self.requires("libpng/[>=1.6 <2]") if self.options.with_freetype: - self.requires("freetype/2.11.1") + self.requires("freetype/2.13.2") if self.options.with_hdf5: - self.requires("hdf5/1.12.1") + self.requires("hdf5/1.14.3") if self.options.with_opencolorio: - if tools.Version(self.version) < "2.3.7.2": - self.requires("opencolorio/1.1.1") - else: - self.requires("opencolorio/2.1.0") + self.requires("opencolorio/2.3.1") if self.options.with_opencv: - self.requires("opencv/4.5.5") + self.requires("opencv/4.8.1") if self.options.with_tbb: - self.requires("onetbb/2020.3") + self.requires("onetbb/2021.10.0") if self.options.with_dicom: - self.requires("dcmtk/3.6.6") + self.requires("dcmtk/3.6.7") if self.options.with_ffmpeg: - self.requires("ffmpeg/4.4") + self.requires("ffmpeg/6.1") # TODO: Field3D dependency if self.options.with_giflib: self.requires("giflib/5.2.1") if self.options.with_libheif: - self.requires("libheif/1.12.0") + self.requires("libheif/1.16.2") if self.options.with_raw: - self.requires("libraw/0.20.2") + self.requires("libraw/0.21.2") if self.options.with_openjpeg: - self.requires("openjpeg/2.4.0") + self.requires("openjpeg/2.5.2") if self.options.with_openvdb: self.requires("openvdb/8.0.1") if self.options.with_ptex: - self.requires("ptex/2.4.0") + self.requires("ptex/2.4.2") if self.options.with_libwebp: - self.requires("libwebp/1.2.2") + self.requires("libwebp/1.3.2") # TODO: R3DSDK dependency # TODO: Nuke dependency def validate(self): - if self.settings.compiler.get_safe("cppstd"): - if tools.Version(self.version) >= "2.3.0.0" or self.options.with_openvdb: - tools.check_min_cppstd(self, 14) - else: - tools.check_min_cppstd(self, 11) + if self.settings.compiler.cppstd: + check_min_cppstd(self, 14) if is_msvc(self) and is_msvc_static_runtime(self) and self.options.shared: - raise ConanInvalidConfiguration("Building shared library with static runtime is not supported!") + raise ConanInvalidConfiguration( + "Building shared library with static runtime is not supported!" + ) - def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + 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], strip_root=True) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) + def generate(self): + tc = CMakeToolchain(self) # CMake options - cmake.definitions["CMAKE_DEBUG_POSTFIX"] = "" # Needed for 2.3.x.x+ versions - cmake.definitions["OIIO_BUILD_TOOLS"] = True - cmake.definitions["OIIO_BUILD_TESTS"] = False - cmake.definitions["BUILD_DOCS"] = False - cmake.definitions["INSTALL_DOCS"] = False - cmake.definitions["INSTALL_FONTS"] = False - cmake.definitions["INSTALL_CMAKE_HELPER"] = False - cmake.definitions["EMBEDPLUGINS"] = True - cmake.definitions["USE_PYTHON"] = False - cmake.definitions["USE_EXTERNAL_PUGIXML"] = True + tc.variables["CMAKE_DEBUG_POSTFIX"] = "" # Needed for 2.3.x.x+ versions + tc.variables["OIIO_BUILD_TOOLS"] = True + tc.variables["OIIO_BUILD_TESTS"] = False + tc.variables["BUILD_DOCS"] = False + tc.variables["INSTALL_DOCS"] = False + tc.variables["INSTALL_FONTS"] = False + tc.variables["INSTALL_CMAKE_HELPER"] = False + tc.variables["EMBEDPLUGINS"] = True + tc.variables["USE_PYTHON"] = False + tc.variables["USE_EXTERNAL_PUGIXML"] = True + tc.variables["BUILD_MISSING_FMT"] = False - # OIIO CMake files are patched to check USE_* flags to require or not use dependencies - cmake.definitions["USE_JPEGTURBO"] = self.options.with_libjpeg == "libjpeg-turbo" - cmake.definitions["USE_JPEG"] = True # Needed for jpeg.imageio plugin, libjpeg/libjpeg-turbo selection still works - cmake.definitions["USE_HDF5"] = self.options.with_hdf5 - cmake.definitions["USE_OPENCOLORIO"] = self.options.with_opencolorio - cmake.definitions["USE_OPENCV"] = self.options.with_opencv - cmake.definitions["USE_TBB"] = self.options.with_tbb - cmake.definitions["USE_DCMTK"] = self.options.with_dicom - cmake.definitions["USE_FFMPEG"] = self.options.with_ffmpeg - cmake.definitions["USE_FIELD3D"] = False - cmake.definitions["USE_GIF"] = self.options.with_giflib - cmake.definitions["USE_LIBHEIF"] = self.options.with_libheif - cmake.definitions["USE_LIBRAW"] = self.options.with_raw - cmake.definitions["USE_OPENVDB"] = self.options.with_openvdb - cmake.definitions["USE_PTEX"] = self.options.with_ptex - cmake.definitions["USE_R3DSDK"] = False - cmake.definitions["USE_NUKE"] = False - cmake.definitions["USE_OPENGL"] = False - cmake.definitions["USE_QT"] = False - cmake.definitions["USE_LIBPNG"] = self.options.with_libpng - cmake.definitions["USE_FREETYPE"] = self.options.with_freetype - cmake.definitions["USE_LIBWEBP"] = self.options.with_libwebp - cmake.definitions["USE_OPENJPEG"] = self.options.with_openjpeg + # Conan is normally not used for testing, so fixing this option to not build the tests + tc.variables["BUILD_TESTING"] = False - if self.options.with_openvdb: - cmake.definitions["CMAKE_CXX_STANDARD"] = 14 + # OIIO CMake files are patched to check USE_* flags to require or not use dependencies + tc.variables["USE_JPEGTURBO"] = ( + self.options.with_libjpeg == "libjpeg-turbo" + ) + tc.variables[ + "USE_JPEG" + ] = True # Needed for jpeg.imageio plugin, libjpeg/libjpeg-turbo selection still works + tc.variables["USE_HDF5"] = self.options.with_hdf5 + tc.variables["USE_OPENCOLORIO"] = self.options.with_opencolorio + tc.variables["USE_OPENCV"] = self.options.with_opencv + tc.variables["USE_TBB"] = self.options.with_tbb + tc.variables["USE_DCMTK"] = self.options.with_dicom + tc.variables["USE_FFMPEG"] = self.options.with_ffmpeg + tc.variables["USE_FIELD3D"] = False + tc.variables["USE_GIF"] = self.options.with_giflib + tc.variables["USE_LIBHEIF"] = self.options.with_libheif + tc.variables["USE_LIBRAW"] = self.options.with_raw + tc.variables["USE_OPENVDB"] = self.options.with_openvdb + tc.variables["USE_PTEX"] = self.options.with_ptex + tc.variables["USE_R3DSDK"] = False + tc.variables["USE_NUKE"] = False + tc.variables["USE_OPENGL"] = False + tc.variables["USE_QT"] = False + tc.variables["USE_LIBPNG"] = self.options.with_libpng + tc.variables["USE_FREETYPE"] = self.options.with_freetype + tc.variables["USE_LIBWEBP"] = self.options.with_libwebp + tc.variables["USE_OPENJPEG"] = self.options.with_openjpeg - cmake.configure(build_folder=self._build_subfolder) - return cmake + tc.generate() + 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): - 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() + rmdir(self, os.path.join(self.package_folder, "share")) + if self.settings.os == "Windows": + for vc_file in ("concrt", "msvcp", "vcruntime"): + rm(self, f"{vc_file}*.dll", 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", "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, "share")) + @staticmethod + def _conan_comp(name): + return f"openimageio_{name.lower()}" - self.copy("LICENSE.md", src=self._source_subfolder, dst="licenses") + def _add_component(self, name): + component = self.cpp_info.components[self._conan_comp(name)] + component.set_property("cmake_target_name", f"OpenImageIO::{name}") + component.names["cmake_find_package"] = name + component.names["cmake_find_package_multi"] = name + return component def package_info(self): self.cpp_info.set_property("cmake_file_name", "OpenImageIO") - self.cpp_info.set_property("cmake_target_name", "OpenImageIO::OpenImageIO") self.cpp_info.set_property("pkg_config_name", "OpenImageIO") - self.cpp_info.components["openimageio_util"].set_property("cmake_target_name", "OpenImageIO::OpenImageIO_Util") - self.cpp_info.components["openimageio_util"].libs = ["OpenImageIO_Util"] - self.cpp_info.components["openimageio_util"].requires = [ - "boost::filesystem", "boost::thread", "boost::system", - "boost::regex", "openexr::openexr", + self.cpp_info.names["cmake_find_package"] = "OpenImageIO" + self.cpp_info.names["cmake_find_package_multi"] = "OpenImageIO" + + # OpenImageIO::OpenImageIO_Util + open_image_io_util = self._add_component("OpenImageIO_Util") + open_image_io_util.libs = ["OpenImageIO_Util"] + open_image_io_util.requires = [ + "boost::filesystem", + "boost::thread", + "boost::system", + "boost::regex", + "imath::imath", + "openexr::openexr", ] if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.components["openimageio_util"].system_libs.extend(["dl", "m", "pthread"]) + open_image_io_util.system_libs.extend( + ["dl", "m", "pthread"] + ) + if self.options.with_tbb: + open_image_io_util.requires.append("onetbb::onetbb") - self.cpp_info.components["main"].set_property("cmake_target_name", "OpenImageIO::OpenImageIO") - self.cpp_info.components["main"].set_property("pkg_config_name", "OpenImageIO") - self.cpp_info.components["main"].libs = ["OpenImageIO"] - self.cpp_info.components["main"].requires = [ - "openimageio_util", "zlib::zlib", "boost::thread", "boost::system", - "boost::container", "boost::regex", "libtiff::libtiff", - "openexr::openexr", "pugixml::pugixml", "tsl-robin-map::tsl-robin-map", - "libsquish::libsquish", "fmt::fmt", + # OpenImageIO::OpenImageIO + open_image_io = self._add_component("OpenImageIO") + open_image_io.libs = ["OpenImageIO"] + open_image_io.requires = [ + "openimageio_openimageio_util", + "zlib::zlib", + "boost::thread", + "boost::system", + "boost::container", + "boost::regex", + "libtiff::libtiff", + "pugixml::pugixml", + "tsl-robin-map::tsl-robin-map", + "libsquish::libsquish", + "fmt::fmt", + "imath::imath", + "openexr::openexr", ] + if self.options.with_libjpeg == "libjpeg": - self.cpp_info.components["main"].requires.append("libjpeg::libjpeg") + open_image_io.requires.append("libjpeg::libjpeg") elif self.options.with_libjpeg == "libjpeg-turbo": - self.cpp_info.components["main"].requires.append("libjpeg-turbo::libjpeg-turbo") + open_image_io.requires.append( + "libjpeg-turbo::libjpeg-turbo" + ) if self.options.with_libpng: - self.cpp_info.components["main"].requires.append("libpng::libpng") + open_image_io.requires.append("libpng::libpng") if self.options.with_freetype: - self.cpp_info.components["main"].requires.append("freetype::freetype") + open_image_io.requires.append("freetype::freetype") if self.options.with_hdf5: - self.cpp_info.components["main"].requires.append("hdf5::hdf5") + open_image_io.requires.append("hdf5::hdf5") if self.options.with_opencolorio: - self.cpp_info.components["main"].requires.append("opencolorio::opencolorio") + open_image_io.requires.append("opencolorio::opencolorio") if self.options.with_opencv: - self.cpp_info.components["main"].requires.append("opencv::opencv") - if self.options.with_tbb: - self.cpp_info.components["main"].requires.append("onetbb::onetbb") + open_image_io.requires.append("opencv::opencv") if self.options.with_dicom: - self.cpp_info.components["main"].requires.append("dcmtk::dcmtk") + open_image_io.requires.append("dcmtk::dcmtk") if self.options.with_ffmpeg: - self.cpp_info.components["main"].requires.append("ffmpeg::ffmpeg") + open_image_io.requires.append("ffmpeg::ffmpeg") if self.options.with_giflib: - self.cpp_info.components["main"].requires.append("giflib::giflib") + open_image_io.requires.append("giflib::giflib") if self.options.with_libheif: - self.cpp_info.components["main"].requires.append("libheif::libheif") + open_image_io.requires.append("libheif::libheif") if self.options.with_raw: - self.cpp_info.components["main"].requires.append("libraw::libraw") + open_image_io.requires.append("libraw::libraw") if self.options.with_openjpeg: - self.cpp_info.components["main"].requires.append("openjpeg::openjpeg") + open_image_io.requires.append("openjpeg::openjpeg") if self.options.with_openvdb: - self.cpp_info.components["main"].requires.append("openvdb::openvdb") + open_image_io.requires.append("openvdb::openvdb") if self.options.with_ptex: - self.cpp_info.components["main"].requires.append("ptex::ptex") + open_image_io.requires.append("ptex::ptex") if self.options.with_libwebp: - self.cpp_info.components["main"].requires.append("libwebp::libwebp") + open_image_io.requires.append("libwebp::libwebp") if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.components["main"].system_libs.extend(["dl", "m", "pthread"]) + open_image_io.system_libs.extend(["dl", "m", "pthread"]) if not self.options.shared: - self.cpp_info.components["main"].defines.append("OIIO_STATIC_DEFINE") - - # TODO: to remove in conan v2 once cmake_find_package* & pkg_config generators removed - self.cpp_info.names["cmake_find_package"] = "OpenImageIO" - self.cpp_info.names["cmake_find_package_multi"] = "OpenImageIO" - self.cpp_info.names["pkg_config"] = "OpenImageIO" - self.cpp_info.components["openimageio_util"].names["cmake_find_package"] = "OpenImageIO_Util" - self.cpp_info.components["main"].names["cmake_find_package"] = "OpenImageIO" + open_image_io.defines.append("OIIO_STATIC_DEFINE") diff --git a/recipes/openimageio/all/patches/2.2.18.0-cmake-targets.patch b/recipes/openimageio/all/patches/2.2.18.0-cmake-targets.patch deleted file mode 100644 index 395bff8a6bd10..0000000000000 --- a/recipes/openimageio/all/patches/2.2.18.0-cmake-targets.patch +++ /dev/null @@ -1,711 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index ccda926b..24b26b8f 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -99,7 +99,7 @@ message(STATUS "Setting Namespace to: ${PROJ_NAMESPACE_V}") - - - list (APPEND CMAKE_MODULE_PATH -- "${PROJECT_SOURCE_DIR}/src/cmake/modules" -+ # "${PROJECT_SOURCE_DIR}/src/cmake/modules" - "${PROJECT_SOURCE_DIR}/src/cmake") - - include (GNUInstallDirs) -@@ -179,7 +179,7 @@ if (OIIO_BUILD_TOOLS AND NOT BUILD_OIIOUTIL_ONLY) - add_subdirectory (src/iinfo) - add_subdirectory (src/maketx) - add_subdirectory (src/oiiotool) -- add_subdirectory (src/testtex) -+ # add_subdirectory (src/testtex) - add_subdirectory (src/iv) - endif () - -diff --git a/src/cmake/compiler.cmake b/src/cmake/compiler.cmake -index 8747f506..503e2a55 100644 ---- a/src/cmake/compiler.cmake -+++ b/src/cmake/compiler.cmake -@@ -92,7 +92,7 @@ if (NOT MSVC) - add_compile_options ("-Wextra") - endif () - if (STOP_ON_WARNING OR DEFINED ENV{CI}) -- add_compile_options ("-Werror") -+ # add_compile_options ("-Werror") - # N.B. Force CI builds to use -Werror, even if STOP_ON_WARNING has - # been switched off by default, which we may do in release - # branches. -diff --git a/src/cmake/externalpackages.cmake b/src/cmake/externalpackages.cmake -index 21e18b53..605d247a 100644 ---- a/src/cmake/externalpackages.cmake -+++ b/src/cmake/externalpackages.cmake -@@ -46,7 +46,7 @@ endif () - if (MSVC) - # Not linking Boost as static libraries: either an explicit setting or LINKSTATIC is FALSE: - if (NOT Boost_USE_STATIC_LIBS) -- add_definitions (-DBOOST_ALL_DYN_LINK=1) -+ # add_definitions (-DBOOST_ALL_DYN_LINK=1) - endif () - endif () - -@@ -55,7 +55,7 @@ if (BOOST_CUSTOM) - # N.B. For a custom version, the caller had better set up the variables - # Boost_VERSION, Boost_INCLUDE_DIRS, Boost_LIBRARY_DIRS, Boost_LIBRARIES. - else () -- set (Boost_COMPONENTS filesystem system thread) -+ set (Boost_COMPONENTS filesystem system thread container) - if (NOT USE_STD_REGEX) - list (APPEND Boost_COMPONENTS regex) - endif () -@@ -106,16 +106,16 @@ checked_find_package (OpenEXR REQUIRED - # library. This shoudn't be necessary, except for the common case of people - # building against Imath/OpenEXR 3.x when there is still a system-level - # install version of 2.x. --include_directories(BEFORE ${IMATH_INCLUDES} ${OPENEXR_INCLUDES}) --if (CMAKE_COMPILER_IS_CLANG AND OPENEXR_VERSION VERSION_LESS 2.3) -+# include_directories(BEFORE ${IMATH_INCLUDES} ${OPENEXR_INCLUDES}) -+if (CMAKE_COMPILER_IS_CLANG AND OpenEXR_VERSION VERSION_LESS 2.3) - # clang C++ >= 11 doesn't like 'register' keyword in old exr headers - add_compile_options (-Wno-deprecated-register) - endif () - if (MSVC AND NOT LINKSTATIC) -- add_definitions (-DOPENEXR_DLL) # Is this needed for new versions? -+ # add_definitions (-DOPENEXR_DLL) # Is this needed for new versions? - endif () - --if (OPENEXR_VERSION VERSION_GREATER_EQUAL 2.5.99) -+if (OpenEXR_VERSION VERSION_GREATER_EQUAL 2.5.99) - set (OIIO_USING_IMATH 3) - else () - set (OIIO_USING_IMATH 2) -@@ -123,12 +123,15 @@ endif () - - - # JPEG -- prefer Turbo-JPEG to regular libjpeg --checked_find_package (JPEGTurbo -+if (USE_JPEGTURBO) -+ checked_find_package (libjpeg-turbo REQUIRED - DEFINITIONS -DUSE_JPEG_TURBO=1 -- PRINT JPEG_INCLUDES JPEG_INCLUDE_DIRS -- JPEG_LIBRARIES) --if (NOT JPEG_FOUND) # Try to find the non-turbo version -+ PRINT libjpeg-turbo_INCLUDES libjpeg-turbo_LIBRARIES) -+ add_library(JPEG::JPEG ALIAS libjpeg-turbo::libjpeg-turbo) -+elseif (USE_JPEG) # Try to find the non-turbo version - checked_find_package (JPEG REQUIRED) -+else () -+ message(FATAL_ERROR "JPEG library was not found!") - endif () - - # Pugixml setup. Normally we just use the version bundled with oiio, but -@@ -144,60 +147,83 @@ else () - endif() - - # From pythonutils.cmake --find_python() -+# find_python() - - - ########################################################################### - # Dependencies for optional formats and features. If these are not found, - # we will continue building, but the related functionality will be disabled. - --checked_find_package (PNG) -- --checked_find_package (BZip2) # Used by ffmpeg and freetype --if (NOT BZIP2_FOUND) -- set (BZIP2_LIBRARIES "") # TODO: why does it break without this? -+if (USE_LIBPNG) -+ checked_find_package (PNG REQUIRED) - endif () - --checked_find_package (Freetype -+# checked_find_package (BZip2) # Used by ffmpeg and freetype -+# if (NOT BZIP2_FOUND) -+# set (BZIP2_LIBRARIES "") # TODO: why does it break without this? -+# endif () -+ -+if (USE_FREETYPE) -+ checked_find_package (Freetype REQUIRED - DEFINITIONS -DUSE_FREETYPE=1 ) -+endif () - --checked_find_package (HDF5 -+if (USE_HDF5) -+ checked_find_package (HDF5 REQUIRED - ISDEPOF Field3D) --checked_find_package (OpenColorIO -+endif () -+if (USE_OPENCOLORIO) -+ checked_find_package (OpenColorIO REQUIRED - DEFINITIONS -DUSE_OCIO=1 -DUSE_OPENCOLORIO=1) --checked_find_package (OpenCV -+endif () -+if (USE_OPENCV) -+ checked_find_package (OpenCV REQUIRED - DEFINITIONS -DUSE_OPENCV=1) -+endif () - - # Intel TBB - set (TBB_USE_DEBUG_BUILD OFF) --checked_find_package (TBB 2017 -+if (USE_TBB) -+ checked_find_package (TBB 2017 REQUIRED - DEFINITIONS -DUSE_TBB=1 - PREFER_CONFIG) -+endif () - --checked_find_package (DCMTK VERSION_MIN 3.6.1) # For DICOM images --checked_find_package (FFmpeg VERSION_MIN 2.6) --checked_find_package (Field3D -+if (USE_DCMTK) -+ checked_find_package (DCMTK REQUIRED VERSION_MIN 3.6.1) # For DICOM images -+endif () -+if (USE_FFMPEG) -+ checked_find_package (ffmpeg REQUIRED VERSION_MIN 2.6) -+endif () -+if (USE_FIELD3D) -+ checked_find_package (Field3D REQUIRED - DEPS HDF5 - DEFINITIONS -DUSE_FIELD3D=1) --checked_find_package (GIF -+endif () -+if (USE_GIF) -+ checked_find_package (GIF REQUIRED - VERSION_MIN 4 - RECOMMEND_MIN 5.0 - RECOMMEND_MIN_REASON "for stability and thread safety") -+endif () - - # For HEIF/HEIC/AVIF formats --checked_find_package (Libheif VERSION_MIN 1.3 -+if (USE_LIBHEIF) -+ checked_find_package (libheif REQUIRED VERSION_MIN 1.3 - RECOMMEND_MIN 1.7 - RECOMMEND_MIN_REASON "for AVIF support") --if (APPLE AND LIBHEIF_VERSION VERSION_GREATER_EQUAL 1.10 AND LIBHEIF_VERSION VERSION_LESS 1.11) -+endif () -+if (0) - message (WARNING "Libheif 1.10 on Apple is known to be broken, disabling libheif support") - set (Libheif_FOUND 0) - endif () - --checked_find_package (LibRaw -+if (USE_LIBRAW) -+ checked_find_package (libraw REQUIRED - RECOMMEND_MIN 0.18 -- RECOMMEND_MIN_REASON "for ACES support and better camera metadata" -- PRINT LibRaw_r_LIBRARIES) --if (LibRaw_FOUND AND LibRaw_VERSION VERSION_LESS 0.20 AND CMAKE_CXX_STANDARD VERSION_GREATER_EQUAL 17) -+ RECOMMEND_MIN_REASON "for ACES support and better camera metadata") -+endif () -+if (0) - message (STATUS "${ColorYellow}WARNING When building for C++17, LibRaw should be 0.20 or higher (found ${LibRaw_VERSION}). You may get errors, depending on the compiler.${ColorReset}") - # Currently, we issue the above warning and let them take their chances. - # If we wish to disable the LibRaw<0.20/C++17 combination that may fail, -@@ -206,12 +232,15 @@ if (LibRaw_FOUND AND LibRaw_VERSION VERSION_LESS 0.20 AND CMAKE_CXX_STANDARD VER - # set (LIBRAW_FOUND 0) - endif () - --checked_find_package (OpenJPEG VERSION_MIN 2.0) -- --checked_find_package (OpenVDB -+if (USE_OPENJPEG) -+ checked_find_package (OpenJPEG REQUIRED VERSION_MIN 2.0) -+endif () -+if (USE_OPENVDB) -+ checked_find_package (OpenVDB REQUIRED - VERSION_MIN 5.0 - DEPS TBB - DEFINITIONS -DUSE_OPENVDB=1) -+endif () - if (OpenVDB_FOUND AND OpenVDB_VERSION VERSION_GREATER_EQUAL 8.0 - AND CMAKE_CXX_STANDARD VERSION_LESS 14) - set (OpenVDB_FOUND OFF) -@@ -225,23 +254,32 @@ if (OpenVDB_FOUND AND OpenVDB_VERSION VERSION_GREATER_EQUAL 8.0 - message (STATUS "${ColorRed}Not using OpenVDB -- OpenVDB ${OpenVDB_VERSION} requires C++14 or later. ${ColorReset}") - endif () - --checked_find_package (Ptex PREFER_CONFIG) --if (NOT Ptex_FOUND OR NOT Ptex_VERSION) -+if (USE_PTEX) -+ checked_find_package (ptex REQUIRED PREFER_CONFIG) -+endif () -+if (0) - # Fallback for inadequate Ptex exported configs. This will eventually - # disappear when we can 100% trust Ptex's exports. - unset (Ptex_FOUND) - checked_find_package (Ptex) - endif () -- --checked_find_package (WebP) -+if (USE_LIBWEBP) -+ checked_find_package (WebP REQUIRED) -+endif () - - option (USE_R3DSDK "Enable R3DSDK (RED camera) support" OFF) --checked_find_package (R3DSDK) # RED camera -+if (USE_R3DSDK) -+ checked_find_package (R3DSDK REQUIRED) # RED camera -+endif () - - set (NUKE_VERSION "7.0" CACHE STRING "Nuke version to target") --checked_find_package (Nuke) -+if (USE_NUKE) -+ checked_find_package (Nuke REQUIRED) -+endif () - --checked_find_package (OpenGL) # used for iv -+if (USE_OPENGL) -+ checked_find_package (OpenGL REQUIRED) # used for iv -+endif () - - # Qt -- used for iv - set (qt5_modules Core Gui Widgets) -@@ -249,7 +287,9 @@ if (OPENGL_FOUND) - list (APPEND qt5_modules OpenGL) - endif () - option (USE_QT "Use Qt if found" ON) --checked_find_package (Qt5 COMPONENTS ${qt5_modules}) -+if (USE_QT) -+ checked_find_package (Qt5 REQUIRED COMPONENTS ${qt5_modules}) -+endif () - if (USE_QT AND NOT Qt5_FOUND AND APPLE) - message (STATUS " If you think you installed qt5 with Homebrew and it still doesn't work,") - message (STATUS " try: export PATH=/usr/local/opt/qt5/bin:$PATH") -@@ -270,13 +310,13 @@ macro (find_or_download_robin_map) - # for an installed version. Still prefer a copy that seems to be - # locally installed in this tree. - if (NOT BUILD_ROBINMAP_FORCE) -- find_package (Robinmap QUIET) -+ find_package (tsl-robin-map REQUIRED) - endif () - # If an external copy wasn't found and we requested that missing - # packages be built, or we we are forcing a local copy to be built, then - # download and build it. - # Download the headers from github -- if ((BUILD_MISSING_ROBINMAP AND NOT ROBINMAP_FOUND) OR BUILD_ROBINMAP_FORCE) -+ if ((BUILD_MISSING_ROBINMAP AND NOT tsl-robin-map_FOUND) OR BUILD_ROBINMAP_FORCE) - message (STATUS "Downloading local Tessil/robin-map") - set (ROBINMAP_INSTALL_DIR "${PROJECT_SOURCE_DIR}/ext/robin-map") - set (ROBINMAP_GIT_REPOSITORY "https://github.com/Tessil/robin-map") -@@ -294,7 +334,7 @@ macro (find_or_download_robin_map) - endif () - set (ROBINMAP_INCLUDE_DIR "${ROBINMAP_INSTALL_DIR}/include") - endif () -- checked_find_package (Robinmap REQUIRED) -+ checked_find_package (tsl-robin-map REQUIRED) - endmacro() - - -@@ -304,7 +344,7 @@ endmacro() - option (USE_EMBEDDED_LIBSQUISH - "Force use of embedded Libsquish, even if external is found" OFF) - if (NOT USE_EMBEDDED_LIBSQUISH) -- checked_find_package (Libsquish) -+ checked_find_package (libsquish) - endif () - - -@@ -325,7 +365,7 @@ macro (find_or_download_fmt) - # If an external copy wasn't found and we requested that missing - # packages be built, or we we are forcing a local copy to be built, then - # download and build it. -- if ((BUILD_MISSING_FMT AND NOT FMT_FOUND) OR BUILD_FMT_FORCE) -+ if ((BUILD_MISSING_FMT AND NOT fmt_FOUND) OR BUILD_FMT_FORCE) - message (STATUS "Downloading local fmtlib/fmt") - set (FMT_INSTALL_DIR "${PROJECT_SOURCE_DIR}/ext/fmt") - set (FMT_GIT_REPOSITORY "https://github.com/fmtlib/fmt") -diff --git a/src/dds.imageio/CMakeLists.txt b/src/dds.imageio/CMakeLists.txt -index d693453a..7ff6e9ce 100644 ---- a/src/dds.imageio/CMakeLists.txt -+++ b/src/dds.imageio/CMakeLists.txt -@@ -2,10 +2,10 @@ - # SPDX-License-Identifier: BSD-3-Clause - # https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md - --if (Libsquish_FOUND) -+if (libsquish_FOUND) - # External libsquish was found -- use it - add_oiio_plugin (ddsinput.cpp -- LINK_LIBRARIES Libsquish::Libsquish -+ LINK_LIBRARIES libsquish::libsquish - ) - else () - # No external libsquish was found -- use the embedded version. -diff --git a/src/dicom.imageio/CMakeLists.txt b/src/dicom.imageio/CMakeLists.txt -index ddd72044..3603eaa3 100644 ---- a/src/dicom.imageio/CMakeLists.txt -+++ b/src/dicom.imageio/CMakeLists.txt -@@ -4,8 +4,8 @@ - - if (DCMTK_FOUND) - add_oiio_plugin (dicominput.cpp -- INCLUDE_DIRS ${DCMTK_INCLUDE_DIR} -- LINK_LIBRARIES ${DCMTK_LIBRARIES} -+ # INCLUDE_DIRS ${DCMTK_INCLUDE_DIR} -+ LINK_LIBRARIES DCMTK::DCMTK - DEFINITIONS "-DUSE_DCMTK=1") - else () - message (WARNING "DICOM plugin will not be built, no DCMTK") -diff --git a/src/ffmpeg.imageio/CMakeLists.txt b/src/ffmpeg.imageio/CMakeLists.txt -index 614b8843..0df87825 100644 ---- a/src/ffmpeg.imageio/CMakeLists.txt -+++ b/src/ffmpeg.imageio/CMakeLists.txt -@@ -2,13 +2,13 @@ - # SPDX-License-Identifier: BSD-3-Clause - # https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md - --if (FFmpeg_FOUND) -+if (ffmpeg_FOUND) - add_oiio_plugin (ffmpeginput.cpp -- INCLUDE_DIRS ${FFMPEG_INCLUDES} -- LINK_LIBRARIES ${FFMPEG_LIBRARIES} -- ${BZIP2_LIBRARIES} -+ # INCLUDE_DIRS ${FFMPEG_INCLUDES} -+ LINK_LIBRARIES ffmpeg::avcodec ffmpeg::avformat ffmpeg::swscale -+ # ${BZIP2_LIBRARIES} - DEFINITIONS "-DUSE_FFMPEG" -- "-DOIIO_FFMPEG_VERSION=\"${FFMPEG_VERSION}\"") -+ "-DOIIO_FFMPEG_VERSION=\"${ffmpeg_VERSION}\"") - else() - message (STATUS "FFmpeg not found: ffmpeg plugin will not be built") - endif() -diff --git a/src/gif.imageio/CMakeLists.txt b/src/gif.imageio/CMakeLists.txt -index c9e7392c..eda8b482 100644 ---- a/src/gif.imageio/CMakeLists.txt -+++ b/src/gif.imageio/CMakeLists.txt -@@ -4,8 +4,8 @@ - - if (GIF_FOUND) - add_oiio_plugin (gifinput.cpp gifoutput.cpp -- INCLUDE_DIRS ${GIF_INCLUDE_DIRS} -- LINK_LIBRARIES ${GIF_LIBRARIES} -+ # INCLUDE_DIRS ${GIF_INCLUDE_DIRS} -+ LINK_LIBRARIES GIF::GIF - DEFINITIONS "-DUSE_GIF") - else() - message (WARNING "GIF plugin will not be built") -diff --git a/src/heif.imageio/CMakeLists.txt b/src/heif.imageio/CMakeLists.txt -index fed80015..2593f585 100644 ---- a/src/heif.imageio/CMakeLists.txt -+++ b/src/heif.imageio/CMakeLists.txt -@@ -2,9 +2,9 @@ - # SPDX-License-Identifier: BSD-3-Clause - # https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md - --if (Libheif_FOUND) -+if (libheif_FOUND) - add_oiio_plugin (heifinput.cpp heifoutput.cpp -- LINK_LIBRARIES Libheif::Libheif -+ LINK_LIBRARIES libheif::libheif - DEFINITIONS "-DUSE_HEIF=1") - else () - message (WARNING "heif plugin will not be built") -diff --git a/src/igrep/CMakeLists.txt b/src/igrep/CMakeLists.txt -index 3fde566a..adaac8bd 100644 ---- a/src/igrep/CMakeLists.txt -+++ b/src/igrep/CMakeLists.txt -@@ -3,5 +3,5 @@ - # https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md - - fancy_add_executable (LINK_LIBRARIES OpenImageIO -- ${Boost_LIBRARIES} # because regex -+ Boost::regex # because regex - ) -diff --git a/src/iinfo/CMakeLists.txt b/src/iinfo/CMakeLists.txt -index 3fde566a..adaac8bd 100644 ---- a/src/iinfo/CMakeLists.txt -+++ b/src/iinfo/CMakeLists.txt -@@ -3,5 +3,5 @@ - # https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md - - fancy_add_executable (LINK_LIBRARIES OpenImageIO -- ${Boost_LIBRARIES} # because regex -+ Boost::regex # because regex - ) -diff --git a/src/include/CMakeLists.txt b/src/include/CMakeLists.txt -index 1ea81b64..248e8a25 100644 ---- a/src/include/CMakeLists.txt -+++ b/src/include/CMakeLists.txt -@@ -56,17 +56,20 @@ install (FILES ${detail_headers} - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}/detail - COMPONENT developer) - -+set(FMT_INCLUDES "${fmt_INCLUDE_DIR}") - set (fmt_headers - ${FMT_INCLUDES}/fmt/core.h - ${FMT_INCLUDES}/fmt/format-inl.h - ${FMT_INCLUDES}/fmt/format.h - ${FMT_INCLUDES}/fmt/ostream.h - ${FMT_INCLUDES}/fmt/printf.h ) -+if (0) - file (COPY ${fmt_headers} - DESTINATION ${CMAKE_BINARY_DIR}/include/OpenImageIO/detail/fmt) - install (FILES ${fmt_headers} - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}/detail/fmt - COMPONENT developer) -+endif () - - if (NOT USE_EXTERNAL_PUGIXML) - set (pugixml_headers -diff --git a/src/include/OpenImageIO/strutil.h b/src/include/OpenImageIO/strutil.h -index ed68af14..34b83220 100644 ---- a/src/include/OpenImageIO/strutil.h -+++ b/src/include/OpenImageIO/strutil.h -@@ -41,9 +41,9 @@ - #ifndef FMT_USE_GRISU - # define FMT_USE_GRISU 1 - #endif --#include "detail/fmt/ostream.h" --#include "detail/fmt/format.h" --#include "detail/fmt/printf.h" -+#include -+#include -+#include - #if OIIO_GNUC_VERSION >= 70000 - # pragma GCC diagnostic pop - #endif -diff --git a/src/jpeg.imageio/CMakeLists.txt b/src/jpeg.imageio/CMakeLists.txt -index 15d50cad..83830cd2 100644 ---- a/src/jpeg.imageio/CMakeLists.txt -+++ b/src/jpeg.imageio/CMakeLists.txt -@@ -3,5 +3,5 @@ - # https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md - - add_oiio_plugin (jpeginput.cpp jpegoutput.cpp -- INCLUDE_DIRS ${JPEG_INCLUDE_DIRS} -- LINK_LIBRARIES ${JPEG_LIBRARIES}) -+ # INCLUDE_DIRS ${JPEG_INCLUDE_DIRS} -+ LINK_LIBRARIES JPEG::JPEG) -diff --git a/src/jpeg2000.imageio/CMakeLists.txt b/src/jpeg2000.imageio/CMakeLists.txt -index 575ed0b7..5644bcf3 100644 ---- a/src/jpeg2000.imageio/CMakeLists.txt -+++ b/src/jpeg2000.imageio/CMakeLists.txt -@@ -2,10 +2,10 @@ - # SPDX-License-Identifier: BSD-3-Clause - # https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md - --if (OPENJPEG_FOUND) -+if (OpenJPEG_FOUND) - add_oiio_plugin (jpeg2000input.cpp jpeg2000output.cpp -- INCLUDE_DIRS ${OPENJPEG_INCLUDES} -- LINK_LIBRARIES ${OPENJPEG_LIBRARIES} -+ # INCLUDE_DIRS ${OPENJPEG_INCLUDES} -+ LINK_LIBRARIES OpenJPEG::OpenJPEG - DEFINITIONS "-DUSE_OPENJPEG") - else() - message (WARNING "Jpeg-2000 plugin will not be built") -diff --git a/src/libOpenImageIO/CMakeLists.txt b/src/libOpenImageIO/CMakeLists.txt -index 29923b60..77035aa7 100644 ---- a/src/libOpenImageIO/CMakeLists.txt -+++ b/src/libOpenImageIO/CMakeLists.txt -@@ -136,37 +136,42 @@ endif () - target_link_libraries (OpenImageIO - PUBLIC - # For OpenEXR/Imath 3.x: -- $<$:Imath::Imath> -- $<$:Imath::Half> -+ # $<$:Imath::Imath> -+ # $<$:Imath::Half> - # For OpenEXR >= 2.4/2.5 with reliable exported targets -- $<$:IlmBase::Imath> -- $<$:IlmBase::Half> -+ # $<$:IlmBase::Imath> -+ # $<$:IlmBase::Half> - # For OpenEXR <= 2.3: -- ${ILMBASE_LIBRARIES} -+ OpenEXR::OpenEXR - ${GCC_ATOMIC_LIBRARIES} - PRIVATE - # For OpenEXR/Imath 3.x: -- $<$:OpenEXR::OpenEXR> -+ # $<$:OpenEXR::OpenEXR> - # For OpenEXR >= 2.4/2.5 with reliable exported targets -- $<$:OpenEXR::IlmImf> -- $<$:IlmBase::IlmThread> -- $<$:IlmBase::Iex> -+ # $<$:OpenEXR::IlmImf> -+ # $<$:IlmBase::IlmThread> -+ # $<$:IlmBase::Iex> - # For OpenEXR <= 2.3: -- ${OPENEXR_LIBRARIES} -- ${OpenCV_LIBRARIES} -+ # ${OPENEXR_LIBRARIES} -+ # ${OpenCV_LIBRARIES} - ${SANITIZE_LIBRARIES} - ${format_plugin_libs} # Add all the target link libraries from the plugins -+ tsl::robin_map - $<$:OpenColorIO::OpenColorIO> -- $<$:OpenColorIO::OpenColorIOHeaders> -+ # $<$:OpenColorIO::OpenColorIOHeaders> - $<$:pugixml::pugixml> -- ${BZIP2_LIBRARIES} -+ # ${BZIP2_LIBRARIES} - ZLIB::ZLIB -- ${Boost_LIBRARIES} -+ Boost::filesystem Boost::thread Boost::system Boost::container - ${CMAKE_DL_LIBS} - ) - --if (FREETYPE_FOUND) -- target_link_libraries (OpenImageIO PRIVATE ${FREETYPE_LIBRARIES}) -+if (OpenCV_FOUND) -+ target_link_libraries (OpenImageIO PUBLIC opencv::opencv_core opencv::opencv_imgproc opencv::opencv_videoio) -+endif () -+ -+if (Freetype_FOUND) -+ target_link_libraries (OpenImageIO PRIVATE Freetype::Freetype) - endif() - - if (WIN32) -diff --git a/src/libutil/CMakeLists.txt b/src/libutil/CMakeLists.txt -index 25d76e5c..c1950e81 100644 ---- a/src/libutil/CMakeLists.txt -+++ b/src/libutil/CMakeLists.txt -@@ -14,19 +14,19 @@ target_include_directories (OpenImageIO_Util - target_link_libraries (OpenImageIO_Util - PUBLIC - # For OpenEXR/Imath 3.x: -- $<$:Imath::Imath> -- $<$:Imath::Half> -+ # $<$:Imath::Imath> -+ # $<$:Imath::Half> - # For OpenEXR >= 2.4/2.5 with reliable exported targets -- $<$:IlmBase::Imath> -- $<$:IlmBase::Half> -- $<$:IlmBase::IlmThread> -- $<$:IlmBase::Iex> -+ # $<$:IlmBase::Imath> -+ # $<$:IlmBase::Half> -+ # $<$:IlmBase::IlmThread> -+ # $<$:IlmBase::Iex> - # For OpenEXR <= 2.3: -- ${ILMBASE_LIBRARIES} -+ OpenEXR::OpenEXR - ${GCC_ATOMIC_LIBRARIES} - PRIVATE - ${SANITIZE_LIBRARIES} -- ${Boost_LIBRARIES} -+ Boost::filesystem Boost::thread Boost::system Boost::regex - ${CMAKE_DL_LIBS} - ) - -diff --git a/src/oiiotool/CMakeLists.txt b/src/oiiotool/CMakeLists.txt -index e281d3f8..0fb1b425 100644 ---- a/src/oiiotool/CMakeLists.txt -+++ b/src/oiiotool/CMakeLists.txt -@@ -4,8 +4,8 @@ - - fancy_add_executable (LINK_LIBRARIES - OpenImageIO -- ${Boost_LIBRARIES} # because regex -- $<$:OpenEXR::OpenEXR> -- $<$:OpenEXR::IlmImf> -- ${OPENEXR_LIBRARIES} -+ Boost::regex # because regex -+ # $<$:OpenEXR::OpenEXR> -+ # $<$:OpenEXR::IlmImf> -+ OpenEXR::OpenEXR - ) -diff --git a/src/openexr.imageio/CMakeLists.txt b/src/openexr.imageio/CMakeLists.txt -index 30758836..1a4d2077 100644 ---- a/src/openexr.imageio/CMakeLists.txt -+++ b/src/openexr.imageio/CMakeLists.txt -@@ -3,6 +3,6 @@ - # https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md - - add_oiio_plugin (exrinput.cpp exroutput.cpp -- INCLUDE_DIRS ${OPENEXR_INCLUDES} ${IMATH_INCLUDE_DIR}/OpenEXR -- LINK_LIBRARIES ${OPENEXR_LIBRARIES}) -+ # INCLUDE_DIRS ${OPENEXR_INCLUDES} ${IMATH_INCLUDE_DIR}/OpenEXR -+ LINK_LIBRARIES OpenEXR::OpenEXR) - -diff --git a/src/openvdb.imageio/CMakeLists.txt b/src/openvdb.imageio/CMakeLists.txt -index 57a0f625..34866390 100644 ---- a/src/openvdb.imageio/CMakeLists.txt -+++ b/src/openvdb.imageio/CMakeLists.txt -@@ -2,8 +2,8 @@ - # SPDX-License-Identifier: BSD-3-Clause - # https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md - --if (OpenVDB_FOUND) -+if (OpenVDB_FOUND AND TBB_FOUND) - add_oiio_plugin (openvdbinput.cpp -- INCLUDE_DIRS ${TBB_INCLUDE_DIRS} -- LINK_LIBRARIES OpenVDB::OpenVDB ${TBB_tbb_LIBRARY} ${BOOST_LIBRARIES}) -+ # INCLUDE_DIRS ${TBB_INCLUDE_DIRS} -+ LINK_LIBRARIES OpenVDB::OpenVDB TBB::TBB) - endif() -diff --git a/src/psd.imageio/CMakeLists.txt b/src/psd.imageio/CMakeLists.txt -index 48bf24fb..7e1d9257 100644 ---- a/src/psd.imageio/CMakeLists.txt -+++ b/src/psd.imageio/CMakeLists.txt -@@ -3,6 +3,6 @@ - # https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md - - add_oiio_plugin (psdinput.cpp jpeg_memory_src.cpp -- INCLUDE_DIRS ${JPEG_INCLUDE_DIR} -- LINK_LIBRARIES ${JPEG_LIBRARIES}) -+ # INCLUDE_DIRS ${JPEG_INCLUDE_DIR} -+ LINK_LIBRARIES JPEG::JPEG) - -diff --git a/src/ptex.imageio/CMakeLists.txt b/src/ptex.imageio/CMakeLists.txt -index 2f47527a..1c3c9800 100644 ---- a/src/ptex.imageio/CMakeLists.txt -+++ b/src/ptex.imageio/CMakeLists.txt -@@ -2,8 +2,8 @@ - # SPDX-License-Identifier: BSD-3-Clause - # https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md - --if (Ptex_FOUND) -+if (PTex_FOUND) - add_oiio_plugin (ptexinput.cpp -- LINK_LIBRARIES Ptex::Ptex_dynamic ZLIB::ZLIB -+ LINK_LIBRARIES PTex::PTex ZLIB::ZLIB - DEFINITIONS "-DUSE_PTEX") - endif () -diff --git a/src/raw.imageio/CMakeLists.txt b/src/raw.imageio/CMakeLists.txt -index d235fd9d..ae229e31 100644 ---- a/src/raw.imageio/CMakeLists.txt -+++ b/src/raw.imageio/CMakeLists.txt -@@ -2,11 +2,11 @@ - # SPDX-License-Identifier: BSD-3-Clause - # https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md - --if (LIBRAW_FOUND) -+if (libraw_FOUND) - add_oiio_plugin (rawinput.cpp -- INCLUDE_DIRS ${LibRaw_INCLUDE_DIR} -- LINK_LIBRARIES ${LibRaw_r_LIBRARIES} -- DEFINITIONS "-DUSE_LIBRAW=1" ${LibRaw_r_DEFINITIONS}) -+ # INCLUDE_DIRS ${LibRaw_INCLUDE_DIR} -+ LINK_LIBRARIES libraw::libraw -+ DEFINITIONS "-DUSE_LIBRAW=1") - else () - message (WARNING "Raw plugin will not be built") - endif () -diff --git a/src/tiff.imageio/CMakeLists.txt b/src/tiff.imageio/CMakeLists.txt -index ab94d56d..05820e8f 100644 ---- a/src/tiff.imageio/CMakeLists.txt -+++ b/src/tiff.imageio/CMakeLists.txt -@@ -3,6 +3,6 @@ - # https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md - - add_oiio_plugin (tiffinput.cpp tiffoutput.cpp -- INCLUDE_DIRS ${TIFF_INCLUDE_DIR} -- LINK_LIBRARIES ${TIFF_LIBRARIES} ${JPEG_LIBRARIES} -+ # INCLUDE_DIRS ${TIFF_INCLUDE_DIR} -+ LINK_LIBRARIES TIFF::TIFF JPEG::JPEG - ZLIB::ZLIB) -diff --git a/src/webp.imageio/CMakeLists.txt b/src/webp.imageio/CMakeLists.txt -index 44462c49..78fe1a58 100644 ---- a/src/webp.imageio/CMakeLists.txt -+++ b/src/webp.imageio/CMakeLists.txt -@@ -4,7 +4,7 @@ - - if (WebP_FOUND) - add_oiio_plugin (webpinput.cpp webpoutput.cpp -- LINK_LIBRARIES WebP::WebP WebP::WebPDemux -+ LINK_LIBRARIES WebP::WebP - DEFINITIONS "-DUSE_WEBP=1") - else () - message (STATUS "WebP plugin will not be built") diff --git a/recipes/openimageio/all/patches/2.2.7.0-cmake-targets.patch b/recipes/openimageio/all/patches/2.2.7.0-cmake-targets.patch deleted file mode 100644 index 7e2a6e4da94b3..0000000000000 --- a/recipes/openimageio/all/patches/2.2.7.0-cmake-targets.patch +++ /dev/null @@ -1,673 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 447c6170..702fb50b 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -99,7 +99,7 @@ message(STATUS "Setting Namespace to: ${PROJ_NAMESPACE_V}") - - - list (APPEND CMAKE_MODULE_PATH -- "${PROJECT_SOURCE_DIR}/src/cmake/modules" -+ # "${PROJECT_SOURCE_DIR}/src/cmake/modules" - "${PROJECT_SOURCE_DIR}/src/cmake") - - include (GNUInstallDirs) -@@ -172,7 +172,7 @@ if (OIIO_BUILD_TOOLS AND NOT BUILD_OIIOUTIL_ONLY) - add_subdirectory (src/iinfo) - add_subdirectory (src/maketx) - add_subdirectory (src/oiiotool) -- add_subdirectory (src/testtex) -+ #add_subdirectory (src/testtex) - add_subdirectory (src/iv) - endif () - -diff --git a/src/cmake/compiler.cmake b/src/cmake/compiler.cmake -index 12a8e819..46c1d0f8 100644 ---- a/src/cmake/compiler.cmake -+++ b/src/cmake/compiler.cmake -@@ -88,7 +88,7 @@ if (NOT MSVC) - add_compile_options ("-Wextra") - endif () - if (STOP_ON_WARNING OR DEFINED ENV{CI}) -- add_compile_options ("-Werror") -+ # add_compile_options ("-Werror") - # N.B. Force CI builds (Travis defines $CI) to use -Werror, even if - # STOP_ON_WARNING has been switched off by default, which we may do - # in release branches. -diff --git a/src/cmake/externalpackages.cmake b/src/cmake/externalpackages.cmake -index 03d521dc..9fe73388 100644 ---- a/src/cmake/externalpackages.cmake -+++ b/src/cmake/externalpackages.cmake -@@ -39,7 +39,7 @@ if (LINKSTATIC) - endif () - else () - if (MSVC) -- add_definitions (-DBOOST_ALL_DYN_LINK=1) -+ # add_definitions (-DBOOST_ALL_DYN_LINK=1) - endif () - endif () - if (BOOST_CUSTOM) -@@ -89,23 +89,27 @@ checked_find_package (OpenEXR 2.0 REQUIRED - RECOMMEND_MIN 2.2 - RECOMMEND_MIN_REASON "for DWA compression") - # We use Imath so commonly, may as well include it everywhere. --include_directories ("${OPENEXR_INCLUDES}" "${ILMBASE_INCLUDES}" -- "${ILMBASE_INCLUDES}/OpenEXR") --if (CMAKE_COMPILER_IS_CLANG AND OPENEXR_VERSION VERSION_LESS 2.3) -+# include_directories ("${OPENEXR_INCLUDES}" "${ILMBASE_INCLUDES}" -+# "${ILMBASE_INCLUDES}/OpenEXR") -+if (CMAKE_COMPILER_IS_CLANG AND OpenEXR_VERSION VERSION_LESS 2.3) - # clang C++ >= 11 doesn't like 'register' keyword in old exr headers - add_compile_options (-Wno-deprecated-register) - endif () - if (MSVC AND NOT LINKSTATIC) -- add_definitions (-DOPENEXR_DLL) # Is this needed for new versions? -+ # add_definitions (-DOPENEXR_DLL) # Is this needed for new versions? - endif () - - - # JPEG -- prefer Turbo-JPEG to regular libjpeg --checked_find_package (JPEGTurbo -+if (USE_JPEGTURBO) -+ checked_find_package (libjpeg-turbo REQUIRED - DEFINITIONS -DUSE_JPEG_TURBO=1 -- PRINT JPEG_INCLUDES JPEG_LIBRARIES) --if (NOT JPEG_FOUND) # Try to find the non-turbo version -+ PRINT libjpeg-turbo_INCLUDES libjpeg-turbo_LIBRARIES) -+ add_library(JPEG::JPEG ALIAS libjpeg-turbo::libjpeg-turbo) -+elseif (USE_JPEG) # Try to find the non-turbo version - checked_find_package (JPEG REQUIRED) -+else () -+ message(FATAL_ERROR "JPEG library was not found!") - endif () - - # Pugixml setup. Normally we just use the version bundled with oiio, but -@@ -123,56 +127,93 @@ endif() - # Dependencies for optional formats and features. If these are not found, - # we will continue building, but the related functionality will be disabled. - --checked_find_package (PNG) -- --checked_find_package (BZip2) # Used by ffmpeg and freetype --if (NOT BZIP2_FOUND) -- set (BZIP2_LIBRARIES "") # TODO: why does it break without this? -+if (USE_LIBPNG) -+ checked_find_package (PNG REQUIRED) - endif () - --checked_find_package (Freetype -+# checked_find_package (BZip2) # Used by ffmpeg and freetype -+# if (NOT BZIP2_FOUND) -+# set (BZIP2_LIBRARIES "") # TODO: why does it break without this? -+# endif () -+ -+if (USE_FREETYPE) -+ checked_find_package (Freetype REQUIRED - DEFINITIONS -DUSE_FREETYPE=1 ) -+endif () - --checked_find_package (HDF5 -+if (USE_HDF5) -+ checked_find_package (HDF5 REQUIRED - ISDEPOF Field3D) --checked_find_package (OpenColorIO -+endif () -+if (USE_OPENCOLORIO) -+ checked_find_package (OpenColorIO REQUIRED - DEFINITIONS -DUSE_OCIO=1 -DUSE_OPENCOLORIO=1) --checked_find_package (OpenCV -+endif () -+if (USE_OPENCV) -+ checked_find_package (OpenCV REQUIRED - DEFINITIONS -DUSE_OPENCV=1) -+endif () - - # Intel TBB - set (TBB_USE_DEBUG_BUILD OFF) --checked_find_package (TBB 2017 -+if (USE_TBB) -+ checked_find_package (TBB 2017 REQUIRED - DEFINITIONS -DUSE_TBB=1 - ISDEPOF OpenVDB) -+endif () - --checked_find_package (DCMTK 3.6.1) # For DICOM images --checked_find_package (FFmpeg 2.6) --checked_find_package (Field3D -+if (USE_DCMTK) -+ checked_find_package (DCMTK 3.6.1 REQUIRED) # For DICOM images -+endif () -+if (USE_FFMPEG) -+ checked_find_package (ffmpeg 2.6 REQUIRED) -+endif () -+if (USE_FIELD3D) -+ checked_find_package (Field3D REQUIRED - DEPS HDF5 - DEFINITIONS -DUSE_FIELD3D=1) --checked_find_package (GIF 4 -+endif () -+if (USE_GIF) -+ checked_find_package (GIF 4 REQUIRED - RECOMMEND_MIN 5.0 - RECOMMEND_MIN_REASON "for stability and thread safety") --checked_find_package (Libheif 1.3) # For HEIF/HEIC format --checked_find_package (LibRaw -- PRINT LibRaw_r_LIBRARIES -+endif () -+if (USE_LIBHEIF) -+ checked_find_package (libheif 1.3 REQUIRED) # For HEIF/HEIC format -+endif () -+if (USE_LIBRAW) -+ checked_find_package (libraw REQUIRED - RECOMMEND_MIN 0.18 - RECOMMEND_MIN_REASON "for ACES support") --checked_find_package (OpenJpeg 2.0) --checked_find_package (OpenVDB 5.0 -+endif () -+if (USE_OPENJPEG) -+ checked_find_package (OpenJPEG 2.0 REQUIRED) -+endif () -+if (USE_OPENVDB) -+ checked_find_package (OpenVDB 5.0 REQUIRED - DEPS TBB - DEFINITIONS -DUSE_OPENVDB=1) --checked_find_package (PTex) --checked_find_package (Webp) -+endif () -+if (USE_PTEX) -+ checked_find_package (ptex REQUIRED) -+endif () -+if (USE_LIBWEBP) -+ checked_find_package (WebP REQUIRED) -+endif () - - option (USE_R3DSDK "Enable R3DSDK (RED camera) support" OFF) --checked_find_package (R3DSDK) # RED camera -+if (USE_R3DSDK) -+ checked_find_package (R3DSDK REQUIRED) # RED camera -+endif () - - set (NUKE_VERSION "7.0" CACHE STRING "Nuke version to target") --checked_find_package (Nuke) -+if (USE_NUKE) -+ checked_find_package (Nuke REQUIRED) -+endif () - --checked_find_package (OpenGL) # used for iv -+if (USE_OPENGL) -+ checked_find_package (OpenGL REQUIRED) # used for iv -+endif () - - # Qt -- used for iv - set (qt5_modules Core Gui Widgets) -@@ -180,7 +221,9 @@ if (OPENGL_FOUND) - list (APPEND qt5_modules OpenGL) - endif () - option (USE_QT "Use Qt if found" ON) --checked_find_package (Qt5 COMPONENTS ${qt5_modules}) -+if (USE_QT) -+ checked_find_package (Qt5 REQUIRED COMPONENTS ${qt5_modules}) -+endif () - if (USE_QT AND NOT Qt5_FOUND AND APPLE) - message (STATUS " If you think you installed qt5 with Homebrew and it still doesn't work,") - message (STATUS " try: export PATH=/usr/local/opt/qt5/bin:$PATH") -@@ -201,13 +244,13 @@ macro (find_or_download_robin_map) - # for an installed version. Still prefer a copy that seems to be - # locally installed in this tree. - if (NOT BUILD_ROBINMAP_FORCE) -- find_package (Robinmap QUIET) -+ find_package (tsl-robin-map REQUIRED) - endif () - # If an external copy wasn't found and we requested that missing - # packages be built, or we we are forcing a local copy to be built, then - # download and build it. - # Download the headers from github -- if ((BUILD_MISSING_ROBINMAP AND NOT ROBINMAP_FOUND) OR BUILD_ROBINMAP_FORCE) -+ if ((BUILD_MISSING_ROBINMAP AND NOT tsl-robin-map_FOUND) OR BUILD_ROBINMAP_FORCE) - message (STATUS "Downloading local Tessil/robin-map") - set (ROBINMAP_INSTALL_DIR "${PROJECT_SOURCE_DIR}/ext/robin-map") - set (ROBINMAP_GIT_REPOSITORY "https://github.com/Tessil/robin-map") -@@ -225,7 +268,7 @@ macro (find_or_download_robin_map) - endif () - set (ROBINMAP_INCLUDE_DIR "${ROBINMAP_INSTALL_DIR}/include") - endif () -- checked_find_package (Robinmap REQUIRED) -+ checked_find_package (tsl-robin-map REQUIRED) - endmacro() - - -@@ -235,7 +278,7 @@ endmacro() - option (USE_EMBEDDED_LIBSQUISH - "Force use of embedded Libsquish, even if external is found" OFF) - if (NOT USE_EMBEDDED_LIBSQUISH) -- checked_find_package (Libsquish) -+ checked_find_package (libsquish REQUIRED) - endif () - - -@@ -251,12 +294,12 @@ macro (find_or_download_fmt) - # for an installed version. Still prefer a copy that seems to be - # locally installed in this tree. - if (NOT BUILD_FMT_FORCE) -- find_package (fmt QUIET) -+ find_package (fmt REQUIRED) - endif () - # If an external copy wasn't found and we requested that missing - # packages be built, or we we are forcing a local copy to be built, then - # download and build it. -- if ((BUILD_MISSING_FMT AND NOT FMT_FOUND) OR BUILD_FMT_FORCE) -+ if ((BUILD_MISSING_FMT AND NOT fmt_FOUND) OR BUILD_FMT_FORCE) - message (STATUS "Downloading local fmtlib/fmt") - set (FMT_INSTALL_DIR "${PROJECT_SOURCE_DIR}/ext/fmt") - set (FMT_GIT_REPOSITORY "https://github.com/fmtlib/fmt") -diff --git a/src/dds.imageio/CMakeLists.txt b/src/dds.imageio/CMakeLists.txt -index d693453a..7ff6e9ce 100644 ---- a/src/dds.imageio/CMakeLists.txt -+++ b/src/dds.imageio/CMakeLists.txt -@@ -2,10 +2,10 @@ - # SPDX-License-Identifier: BSD-3-Clause - # https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md - --if (Libsquish_FOUND) -+if (libsquish_FOUND) - # External libsquish was found -- use it - add_oiio_plugin (ddsinput.cpp -- LINK_LIBRARIES Libsquish::Libsquish -+ LINK_LIBRARIES libsquish::libsquish - ) - else () - # No external libsquish was found -- use the embedded version. -diff --git a/src/dicom.imageio/CMakeLists.txt b/src/dicom.imageio/CMakeLists.txt -index ddd72044..3603eaa3 100644 ---- a/src/dicom.imageio/CMakeLists.txt -+++ b/src/dicom.imageio/CMakeLists.txt -@@ -4,8 +4,8 @@ - - if (DCMTK_FOUND) - add_oiio_plugin (dicominput.cpp -- INCLUDE_DIRS ${DCMTK_INCLUDE_DIR} -- LINK_LIBRARIES ${DCMTK_LIBRARIES} -+ # INCLUDE_DIRS ${DCMTK_INCLUDE_DIR} -+ LINK_LIBRARIES DCMTK::DCMTK - DEFINITIONS "-DUSE_DCMTK=1") - else () - message (WARNING "DICOM plugin will not be built, no DCMTK") -diff --git a/src/dpx.imageio/CMakeLists.txt b/src/dpx.imageio/CMakeLists.txt -index 858beb9d..dd169af4 100644 ---- a/src/dpx.imageio/CMakeLists.txt -+++ b/src/dpx.imageio/CMakeLists.txt -@@ -6,4 +6,4 @@ add_oiio_plugin (dpxinput.cpp dpxoutput.cpp - libdpx/DPX.cpp libdpx/OutStream.cpp libdpx/RunLengthEncoding.cpp - libdpx/Codec.cpp libdpx/Reader.cpp libdpx/Writer.cpp libdpx/DPXHeader.cpp - libdpx/ElementReadStream.cpp libdpx/InStream.cpp libdpx/DPXColorConverter.cpp -- LINK_LIBRARIES ${OPENEXR_LIBRARIES}) -+ LINK_LIBRARIES OpenEXR::OpenEXR) -diff --git a/src/ffmpeg.imageio/CMakeLists.txt b/src/ffmpeg.imageio/CMakeLists.txt -index 6cf07636..d3bb5f61 100644 ---- a/src/ffmpeg.imageio/CMakeLists.txt -+++ b/src/ffmpeg.imageio/CMakeLists.txt -@@ -11,11 +11,11 @@ if (NOT MSVC) - PROPERTIES COMPILE_FLAGS "-Wno-deprecated-declarations") - endif() - --if (FFmpeg_FOUND) -+if (ffmpeg_FOUND) - add_oiio_plugin (ffmpeginput.cpp -- INCLUDE_DIRS ${FFMPEG_INCLUDES} -- LINK_LIBRARIES ${FFMPEG_LIBRARIES} -- ${BZIP2_LIBRARIES} -+ # INCLUDE_DIRS ${FFMPEG_INCLUDES} -+ LINK_LIBRARIES ffmpeg::avcodec ffmpeg::avformat ffmpeg::swscale -+ # ${BZIP2_LIBRARIES} - DEFINITIONS "-DUSE_FFMPEG") - else() - message (STATUS "FFmpeg not found: ffmpeg plugin will not be built") -diff --git a/src/gif.imageio/CMakeLists.txt b/src/gif.imageio/CMakeLists.txt -index c9e7392c..eda8b482 100644 ---- a/src/gif.imageio/CMakeLists.txt -+++ b/src/gif.imageio/CMakeLists.txt -@@ -4,8 +4,8 @@ - - if (GIF_FOUND) - add_oiio_plugin (gifinput.cpp gifoutput.cpp -- INCLUDE_DIRS ${GIF_INCLUDE_DIRS} -- LINK_LIBRARIES ${GIF_LIBRARIES} -+ # INCLUDE_DIRS ${GIF_INCLUDE_DIRS} -+ LINK_LIBRARIES GIF::GIF - DEFINITIONS "-DUSE_GIF") - else() - message (WARNING "GIF plugin will not be built") -diff --git a/src/heif.imageio/CMakeLists.txt b/src/heif.imageio/CMakeLists.txt -index fed80015..2593f585 100644 ---- a/src/heif.imageio/CMakeLists.txt -+++ b/src/heif.imageio/CMakeLists.txt -@@ -2,9 +2,9 @@ - # SPDX-License-Identifier: BSD-3-Clause - # https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md - --if (Libheif_FOUND) -+if (libheif_FOUND) - add_oiio_plugin (heifinput.cpp heifoutput.cpp -- LINK_LIBRARIES Libheif::Libheif -+ LINK_LIBRARIES libheif::libheif - DEFINITIONS "-DUSE_HEIF=1") - else () - message (WARNING "heif plugin will not be built") -diff --git a/src/ico.imageio/CMakeLists.txt b/src/ico.imageio/CMakeLists.txt -index 5a46174d..a8919f63 100644 ---- a/src/ico.imageio/CMakeLists.txt -+++ b/src/ico.imageio/CMakeLists.txt -@@ -4,8 +4,8 @@ - - if (PNG_FOUND) - add_oiio_plugin (icoinput.cpp icooutput.cpp -- INCLUDE_DIRS ${PNG_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS} -- LINK_LIBRARIES ${PNG_LIBRARIES} ${ZLIB_LIBRARIES}) -+ # INCLUDE_DIRS ${PNG_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS} -+ LINK_LIBRARIES PNG::PNG ZLIB::ZLIB) - else () - message (WARNING "libpng not found, so ICO support will not work") - set (format_plugin_definitions ${format_plugin_definitions} DISABLE_ICO=1 PARENT_SCOPE) -diff --git a/src/igrep/CMakeLists.txt b/src/igrep/CMakeLists.txt -index 3fde566a..adaac8bd 100644 ---- a/src/igrep/CMakeLists.txt -+++ b/src/igrep/CMakeLists.txt -@@ -3,5 +3,5 @@ - # https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md - - fancy_add_executable (LINK_LIBRARIES OpenImageIO -- ${Boost_LIBRARIES} # because regex -+ Boost::regex # because regex - ) -diff --git a/src/iinfo/CMakeLists.txt b/src/iinfo/CMakeLists.txt -index 3fde566a..adaac8bd 100644 ---- a/src/iinfo/CMakeLists.txt -+++ b/src/iinfo/CMakeLists.txt -@@ -3,5 +3,5 @@ - # https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md - - fancy_add_executable (LINK_LIBRARIES OpenImageIO -- ${Boost_LIBRARIES} # because regex -+ Boost::regex # because regex - ) -diff --git a/src/include/CMakeLists.txt b/src/include/CMakeLists.txt -index a60b3b21..050911c8 100644 ---- a/src/include/CMakeLists.txt -+++ b/src/include/CMakeLists.txt -@@ -44,17 +44,20 @@ install (FILES ${public_headers} - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME} - COMPONENT developer) - -+set(FMT_INCLUDES "${fmt_INCLUDE_DIR}") - set (fmt_headers - ${FMT_INCLUDES}/fmt/core.h - ${FMT_INCLUDES}/fmt/format-inl.h - ${FMT_INCLUDES}/fmt/format.h - ${FMT_INCLUDES}/fmt/ostream.h - ${FMT_INCLUDES}/fmt/printf.h ) -+if (0) - file (COPY ${fmt_headers} - DESTINATION ${CMAKE_BINARY_DIR}/include/OpenImageIO/detail/fmt) - install (FILES ${fmt_headers} - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}/detail/fmt - COMPONENT developer) -+endif () - - if (NOT USE_EXTERNAL_PUGIXML) - set (pugixml_headers -diff --git a/src/include/OpenImageIO/strutil.h b/src/include/OpenImageIO/strutil.h -index db356f03..003df7f8 100644 ---- a/src/include/OpenImageIO/strutil.h -+++ b/src/include/OpenImageIO/strutil.h -@@ -39,9 +39,9 @@ - #ifndef FMT_USE_GRISU - # define FMT_USE_GRISU 1 - #endif --#include "detail/fmt/ostream.h" --#include "detail/fmt/format.h" --#include "detail/fmt/printf.h" -+#include -+#include -+#include - #if OIIO_GNUC_VERSION >= 70000 - # pragma GCC diagnostic pop - #endif -diff --git a/src/jpeg.imageio/CMakeLists.txt b/src/jpeg.imageio/CMakeLists.txt -index 548faeb7..95e4feb5 100644 ---- a/src/jpeg.imageio/CMakeLists.txt -+++ b/src/jpeg.imageio/CMakeLists.txt -@@ -3,5 +3,5 @@ - # https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md - - add_oiio_plugin (jpeginput.cpp jpegoutput.cpp -- INCLUDE_DIRS ${JPEG_INCLUDE_DIR} -- LINK_LIBRARIES ${JPEG_LIBRARIES}) -+ # INCLUDE_DIRS ${JPEG_INCLUDE_DIR} -+ LINK_LIBRARIES JPEG::JPEG) -diff --git a/src/jpeg2000.imageio/CMakeLists.txt b/src/jpeg2000.imageio/CMakeLists.txt -index 575ed0b7..5644bcf3 100644 ---- a/src/jpeg2000.imageio/CMakeLists.txt -+++ b/src/jpeg2000.imageio/CMakeLists.txt -@@ -2,10 +2,10 @@ - # SPDX-License-Identifier: BSD-3-Clause - # https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md - --if (OPENJPEG_FOUND) -+if (OpenJPEG_FOUND) - add_oiio_plugin (jpeg2000input.cpp jpeg2000output.cpp -- INCLUDE_DIRS ${OPENJPEG_INCLUDES} -- LINK_LIBRARIES ${OPENJPEG_LIBRARIES} -+ # INCLUDE_DIRS ${OPENJPEG_INCLUDES} -+ LINK_LIBRARIES OpenJPEG::OpenJPEG - DEFINITIONS "-DUSE_OPENJPEG") - else() - message (WARNING "Jpeg-2000 plugin will not be built") -diff --git a/src/libOpenImageIO/CMakeLists.txt b/src/libOpenImageIO/CMakeLists.txt -index fe39cdd4..b877cc4d 100644 ---- a/src/libOpenImageIO/CMakeLists.txt -+++ b/src/libOpenImageIO/CMakeLists.txt -@@ -135,31 +135,33 @@ endif () - - target_link_libraries (OpenImageIO - PUBLIC -- ${ILMBASE_LIBRARIES} -- ${OPENEXR_LIBRARIES} -- ${OpenCV_LIBRARIES} -+ OpenEXR::OpenEXR -+ $<$:OpenColorIO::OpenColorIO> - ${GCC_ATOMIC_LIBRARIES} - PRIVATE - ${SANITIZE_LIBRARIES} - ${format_plugin_libs} # Add all the target link libraries from the plugins -- $<$:OpenColorIO::OpenColorIO> -- ${BZIP2_LIBRARIES} -- ${ZLIB_LIBRARIES} -- ${Boost_LIBRARIES} -+ tsl::robin_map -+ ZLIB::ZLIB -+ Boost::Boost - ${CMAKE_DL_LIBS} - ) - -+if (OpenCV_FOUND) -+ target_link_libraries (OpenImageIO PUBLIC opencv::opencv_core opencv::opencv_imgproc opencv::opencv_videoio) -+endif () -+ - if (USE_EXTERNAL_PUGIXML) -- if(TARGET pugixml) -- target_link_libraries (OpenImageIO PRIVATE pugixml) -+ if(pugixml_FOUND) -+ target_link_libraries (OpenImageIO PRIVATE pugixml::pugixml) - else() - target_include_directories (OpenImageIO PRIVATE ${PUGIXML_INCLUDES}) - target_link_libraries (OpenImageIO PRIVATE ${PUGIXML_LIBRARIES}) - endif() - endif() - --if (FREETYPE_FOUND) -- target_link_libraries (OpenImageIO PRIVATE ${FREETYPE_LIBRARIES}) -+if (Freetype_FOUND) -+ target_link_libraries (OpenImageIO PRIVATE Freetype::Freetype) - endif() - - if (WIN32) -diff --git a/src/libutil/CMakeLists.txt b/src/libutil/CMakeLists.txt -index 083b077c..4cdd4e6b 100644 ---- a/src/libutil/CMakeLists.txt -+++ b/src/libutil/CMakeLists.txt -@@ -13,11 +13,11 @@ target_include_directories (OpenImageIO_Util - ) - target_link_libraries (OpenImageIO_Util - PUBLIC -- ${ILMBASE_LIBRARIES} -+ OpenEXR::OpenEXR - ${GCC_ATOMIC_LIBRARIES} - PRIVATE - ${SANITIZE_LIBRARIES} -- ${Boost_LIBRARIES} -+ Boost::Boost - ${CMAKE_DL_LIBS} - ) - -diff --git a/src/oiiotool/CMakeLists.txt b/src/oiiotool/CMakeLists.txt -index 3fde566a..adaac8bd 100644 ---- a/src/oiiotool/CMakeLists.txt -+++ b/src/oiiotool/CMakeLists.txt -@@ -3,5 +3,5 @@ - # https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md - - fancy_add_executable (LINK_LIBRARIES OpenImageIO -- ${Boost_LIBRARIES} # because regex -+ Boost::regex # because regex - ) -diff --git a/src/openexr.imageio/CMakeLists.txt b/src/openexr.imageio/CMakeLists.txt -index 3226eb13..bf8e0358 100644 ---- a/src/openexr.imageio/CMakeLists.txt -+++ b/src/openexr.imageio/CMakeLists.txt -@@ -3,5 +3,5 @@ - # https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md - - add_oiio_plugin (exrinput.cpp exroutput.cpp -- LINK_LIBRARIES ${OPENEXR_LIBRARIES}) -+ LINK_LIBRARIES OpenEXR::OpenEXR) - -diff --git a/src/openvdb.imageio/CMakeLists.txt b/src/openvdb.imageio/CMakeLists.txt -index 57a0f625..61dc2459 100644 ---- a/src/openvdb.imageio/CMakeLists.txt -+++ b/src/openvdb.imageio/CMakeLists.txt -@@ -2,8 +2,8 @@ - # SPDX-License-Identifier: BSD-3-Clause - # https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md - --if (OpenVDB_FOUND) -+if (OpenVDB_FOUND AND TBB_FOUND) - add_oiio_plugin (openvdbinput.cpp -- INCLUDE_DIRS ${TBB_INCLUDE_DIRS} -- LINK_LIBRARIES OpenVDB::OpenVDB ${TBB_tbb_LIBRARY} ${BOOST_LIBRARIES}) -+ # INCLUDE_DIRS ${TBB_INCLUDE_DIRS} -+ LINK_LIBRARIES OpenVDB::OpenVDB TBB::TBB Boost::Boost) - endif() -diff --git a/src/png.imageio/CMakeLists.txt b/src/png.imageio/CMakeLists.txt -index be2724f2..ac16da21 100644 ---- a/src/png.imageio/CMakeLists.txt -+++ b/src/png.imageio/CMakeLists.txt -@@ -4,8 +4,8 @@ - - if (PNG_FOUND) - add_oiio_plugin (pnginput.cpp pngoutput.cpp -- INCLUDE_DIRS ${PNG_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS} -- LINK_LIBRARIES ${PNG_LIBRARIES} ${ZLIB_LIBRARIES}) -+ # INCLUDE_DIRS ${PNG_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS} -+ LINK_LIBRARIES PNG::PNG ZLIB::ZLIB) - else () - message (WARNING "libpng not found, so PNG support will not work") - set (format_plugin_definitions ${format_plugin_definitions} DISABLE_PNG=1 PARENT_SCOPE) -diff --git a/src/psd.imageio/CMakeLists.txt b/src/psd.imageio/CMakeLists.txt -index 48bf24fb..7e1d9257 100644 ---- a/src/psd.imageio/CMakeLists.txt -+++ b/src/psd.imageio/CMakeLists.txt -@@ -3,6 +3,6 @@ - # https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md - - add_oiio_plugin (psdinput.cpp jpeg_memory_src.cpp -- INCLUDE_DIRS ${JPEG_INCLUDE_DIR} -- LINK_LIBRARIES ${JPEG_LIBRARIES}) -+ # INCLUDE_DIRS ${JPEG_INCLUDE_DIR} -+ LINK_LIBRARIES JPEG::JPEG) - -diff --git a/src/ptex.imageio/CMakeLists.txt b/src/ptex.imageio/CMakeLists.txt -index 912081b1..6039fc58 100644 ---- a/src/ptex.imageio/CMakeLists.txt -+++ b/src/ptex.imageio/CMakeLists.txt -@@ -2,9 +2,9 @@ - # SPDX-License-Identifier: BSD-3-Clause - # https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md - --if (PTEX_FOUND) -+if (PTex_FOUND) - add_oiio_plugin (ptexinput.cpp -- INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS} ${PTEX_INCLUDE_DIR} -- LINK_LIBRARIES ${PTEX_LIBRARIES} ${ZLIB_LIBRARIES} -+ # INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS} ${PTEX_INCLUDE_DIR} -+ LINK_LIBRARIES PTex::PTex ZLIB::ZLIB - DEFINITIONS "-DUSE_PTEX") - endif () -diff --git a/src/raw.imageio/CMakeLists.txt b/src/raw.imageio/CMakeLists.txt -index 81a0ff54..ae229e31 100644 ---- a/src/raw.imageio/CMakeLists.txt -+++ b/src/raw.imageio/CMakeLists.txt -@@ -2,10 +2,10 @@ - # SPDX-License-Identifier: BSD-3-Clause - # https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md - --if (LIBRAW_FOUND) -+if (libraw_FOUND) - add_oiio_plugin (rawinput.cpp -- INCLUDE_DIRS ${LibRaw_INCLUDE_DIR} -- LINK_LIBRARIES ${LibRaw_r_LIBRARIES} -+ # INCLUDE_DIRS ${LibRaw_INCLUDE_DIR} -+ LINK_LIBRARIES libraw::libraw - DEFINITIONS "-DUSE_LIBRAW=1") - else () - message (WARNING "Raw plugin will not be built") -diff --git a/src/tiff.imageio/CMakeLists.txt b/src/tiff.imageio/CMakeLists.txt -index f6d648c8..385607c9 100644 ---- a/src/tiff.imageio/CMakeLists.txt -+++ b/src/tiff.imageio/CMakeLists.txt -@@ -3,6 +3,6 @@ - # https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md - - add_oiio_plugin (tiffinput.cpp tiffoutput.cpp -- INCLUDE_DIRS ${TIFF_INCLUDE_DIR} ${ZLIB_INCLUDE_DIRS} -- LINK_LIBRARIES ${TIFF_LIBRARIES} ${JPEG_LIBRARIES} -- ${ZLIB_LIBRARIES}) -+ # INCLUDE_DIRS ${TIFF_INCLUDE_DIR} ${ZLIB_INCLUDE_DIRS} -+ LINK_LIBRARIES TIFF::TIFF JPEG::JPEG -+ ZLIB::ZLIB) -diff --git a/src/webp.imageio/CMakeLists.txt b/src/webp.imageio/CMakeLists.txt -index 9e01bd7f..78fe1a58 100644 ---- a/src/webp.imageio/CMakeLists.txt -+++ b/src/webp.imageio/CMakeLists.txt -@@ -2,9 +2,9 @@ - # SPDX-License-Identifier: BSD-3-Clause - # https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md - --if (Webp_FOUND) -+if (WebP_FOUND) - add_oiio_plugin (webpinput.cpp webpoutput.cpp -- LINK_LIBRARIES Webp::Webp -+ LINK_LIBRARIES WebP::WebP - DEFINITIONS "-DUSE_WEBP=1") - else () - message (STATUS "WebP plugin will not be built") -diff --git a/src/zfile.imageio/CMakeLists.txt b/src/zfile.imageio/CMakeLists.txt -index 36a7ad99..c8fd99d3 100644 ---- a/src/zfile.imageio/CMakeLists.txt -+++ b/src/zfile.imageio/CMakeLists.txt -@@ -3,5 +3,5 @@ - # https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md - - add_oiio_plugin (zfile.cpp -- INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS} -- LINK_LIBRARIES ${ZLIB_LIBRARIES}) -+ # INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS} -+ LINK_LIBRARIES ZLIB::ZLIB) diff --git a/recipes/openimageio/all/patches/2.3.7.2-cmake-targets.patch b/recipes/openimageio/all/patches/2.3.7.2-cmake-targets.patch deleted file mode 100644 index ba213765c8530..0000000000000 --- a/recipes/openimageio/all/patches/2.3.7.2-cmake-targets.patch +++ /dev/null @@ -1,710 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 54fe7d9c..97a1b8e4 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -111,7 +111,7 @@ message(STATUS "Setting Namespace to: ${PROJ_NAMESPACE_V}") - - - list (APPEND CMAKE_MODULE_PATH -- "${PROJECT_SOURCE_DIR}/src/cmake/modules" -+ # "${PROJECT_SOURCE_DIR}/src/cmake/modules" - "${PROJECT_SOURCE_DIR}/src/cmake") - - include (GNUInstallDirs) -@@ -191,7 +191,7 @@ if (OIIO_BUILD_TOOLS AND NOT BUILD_OIIOUTIL_ONLY) - add_subdirectory (src/iinfo) - add_subdirectory (src/maketx) - add_subdirectory (src/oiiotool) -- add_subdirectory (src/testtex) -+ #add_subdirectory (src/testtex) - add_subdirectory (src/iv) - endif () - -diff --git a/src/cmake/compiler.cmake b/src/cmake/compiler.cmake -index 2a513f58..13568140 100644 ---- a/src/cmake/compiler.cmake -+++ b/src/cmake/compiler.cmake -@@ -92,7 +92,7 @@ if (NOT MSVC) - add_compile_options ("-Wextra") - endif () - if (STOP_ON_WARNING OR DEFINED ENV{CI}) -- add_compile_options ("-Werror") -+ #add_compile_options ("-Werror") - # N.B. Force CI builds to use -Werror, even if STOP_ON_WARNING has - # been switched off by default, which we may do in release - # branches. -diff --git a/src/cmake/externalpackages.cmake b/src/cmake/externalpackages.cmake -index 957abe34..885becbf 100644 ---- a/src/cmake/externalpackages.cmake -+++ b/src/cmake/externalpackages.cmake -@@ -46,7 +46,7 @@ endif () - if (MSVC) - # Not linking Boost as static libraries: either an explicit setting or LINKSTATIC is FALSE: - if (NOT Boost_USE_STATIC_LIBS) -- add_definitions (-DBOOST_ALL_DYN_LINK=1) -+ # add_definitions (-DBOOST_ALL_DYN_LINK=1) - endif () - endif () - -@@ -55,7 +55,7 @@ if (BOOST_CUSTOM) - # N.B. For a custom version, the caller had better set up the variables - # Boost_VERSION, Boost_INCLUDE_DIRS, Boost_LIBRARY_DIRS, Boost_LIBRARIES. - else () -- set (Boost_COMPONENTS filesystem system thread) -+ set (Boost_COMPONENTS filesystem system thread container) - # The FindBoost.cmake interface is broken if it uses boost's installed - # cmake output (e.g. boost 1.70.0, cmake <= 3.14). Specifically it fails - # to set the expected variables printed below. So until that's fixed -@@ -103,16 +103,16 @@ checked_find_package (OpenEXR REQUIRED - # library. This shoudn't be necessary, except for the common case of people - # building against Imath/OpenEXR 3.x when there is still a system-level - # install version of 2.x. --include_directories(BEFORE ${IMATH_INCLUDES} ${OPENEXR_INCLUDES}) --if (CMAKE_COMPILER_IS_CLANG AND OPENEXR_VERSION VERSION_LESS 2.3) -+# include_directories(BEFORE ${IMATH_INCLUDES} ${OPENEXR_INCLUDES}) -+if (CMAKE_COMPILER_IS_CLANG AND OpenEXR_VERSION VERSION_LESS 2.3) - # clang C++ >= 11 doesn't like 'register' keyword in old exr headers - add_compile_options (-Wno-deprecated-register) - endif () - if (MSVC AND NOT LINKSTATIC) -- add_definitions (-DOPENEXR_DLL) # Is this needed for new versions? -+ # add_definitions (-DOPENEXR_DLL) # Is this needed for new versions? - endif () - --if (OPENEXR_VERSION VERSION_GREATER_EQUAL 2.5.99) -+if (OpenEXR_VERSION VERSION_GREATER_EQUAL 2.5.99) - set (OIIO_USING_IMATH 3) - else () - set (OIIO_USING_IMATH 2) -@@ -120,12 +120,15 @@ endif () - - - # JPEG -- prefer Turbo-JPEG to regular libjpeg --checked_find_package (JPEGTurbo -+if (USE_JPEGTURBO) -+ checked_find_package (libjpeg-turbo REQUIRED - DEFINITIONS -DUSE_JPEG_TURBO=1 -- PRINT JPEG_INCLUDES JPEG_INCLUDE_DIRS -- JPEG_LIBRARIES) --if (NOT JPEG_FOUND) # Try to find the non-turbo version -+ PRINT libjpeg-turbo_INCLUDES libjpeg-turbo_LIBRARIES) -+ add_library(JPEG::JPEG ALIAS libjpeg-turbo::libjpeg-turbo) -+elseif (USE_JPEG) # Try to find the non-turbo version - checked_find_package (JPEG REQUIRED) -+else () -+ message(FATAL_ERROR "JPEG library was not found!") - endif () - - # Pugixml setup. Normally we just use the version bundled with oiio, but -@@ -141,62 +144,85 @@ else () - endif() - - # From pythonutils.cmake --find_python() -+# find_python() - - - ########################################################################### - # Dependencies for optional formats and features. If these are not found, - # we will continue building, but the related functionality will be disabled. - --checked_find_package (PNG) -- --checked_find_package (BZip2) # Used by ffmpeg and freetype --if (NOT BZIP2_FOUND) -- set (BZIP2_LIBRARIES "") # TODO: why does it break without this? -+if (USE_LIBPNG) -+ checked_find_package (PNG REQUIRED) - endif () - --checked_find_package (Freetype -+# checked_find_package (BZip2) # Used by ffmpeg and freetype -+# if (NOT BZIP2_FOUND) -+# set (BZIP2_LIBRARIES "") # TODO: why does it break without this? -+# endif () -+ -+if (USE_FREETYPE) -+ checked_find_package (Freetype REQUIRED - DEFINITIONS -DUSE_FREETYPE=1 ) -+endif () - --checked_find_package (HDF5 -+if (USE_HDF5) -+ checked_find_package (HDF5 REQUIRED - ISDEPOF Field3D) --checked_find_package (OpenColorIO -+endif () -+if (USE_OPENCOLORIO) -+ checked_find_package (OpenColorIO REQUIRED - DEFINITIONS -DUSE_OCIO=1 -DUSE_OPENCOLORIO=1 - # PREFER_CONFIG - ) --checked_find_package (OpenCV 3.0 -+endif () -+if (USE_OPENCV) -+ checked_find_package (OpenCV 3.0 REQUIRED - DEFINITIONS -DUSE_OPENCV=1) -+endif () - - # Intel TBB - set (TBB_USE_DEBUG_BUILD OFF) --checked_find_package (TBB 2017 -+if (USE_TBB) -+ checked_find_package (TBB 2017 REQUIRED - DEFINITIONS -DUSE_TBB=1 - PREFER_CONFIG) -+endif () - --checked_find_package (DCMTK VERSION_MIN 3.6.1) # For DICOM images --checked_find_package (FFmpeg VERSION_MIN 3.0) --checked_find_package (Field3D -+if (USE_DCMTK) -+ checked_find_package (DCMTK REQUIRED VERSION_MIN 3.6.1) # For DICOM images -+endif () -+if (USE_FFMPEG) -+ checked_find_package (ffmpeg REQUIRED VERSION_MIN 3.0) -+endif () -+if (USE_FIELD3D) -+ checked_find_package (Field3D REQUIRED - DEPS HDF5 - DEFINITIONS -DUSE_FIELD3D=1) --checked_find_package (GIF -+endif () -+if (USE_GIF) -+ checked_find_package (GIF REQUIRED - VERSION_MIN 4 - RECOMMEND_MIN 5.0 - RECOMMEND_MIN_REASON "for stability and thread safety") -+endif () - - # For HEIF/HEIC/AVIF formats --checked_find_package (Libheif VERSION_MIN 1.3 -+if (USE_LIBHEIF) -+ checked_find_package (libheif REQUIRED VERSION_MIN 1.3 - RECOMMEND_MIN 1.7 - RECOMMEND_MIN_REASON "for AVIF support") --if (APPLE AND LIBHEIF_VERSION VERSION_GREATER_EQUAL 1.10 AND LIBHEIF_VERSION VERSION_LESS 1.11) -+endif () -+if (0) - message (WARNING "Libheif 1.10 on Apple is known to be broken, disabling libheif support") - set (Libheif_FOUND 0) - endif () - --checked_find_package (LibRaw -+if (USE_LIBRAW) -+ checked_find_package (libraw REQUIRED - RECOMMEND_MIN 0.18 -- RECOMMEND_MIN_REASON "for ACES support and better camera metadata" -- PRINT LibRaw_r_LIBRARIES) --if (LibRaw_FOUND AND LibRaw_VERSION VERSION_LESS 0.20 AND CMAKE_CXX_STANDARD VERSION_GREATER_EQUAL 17) -+ RECOMMEND_MIN_REASON "for ACES support and better camera metadata") -+endif () -+if (0) - message (STATUS "${ColorYellow}WARNING When building for C++17, LibRaw should be 0.20 or higher (found ${LibRaw_VERSION}). You may get errors, depending on the compiler.${ColorReset}") - # Currently, we issue the above warning and let them take their chances. - # If we wish to disable the LibRaw<0.20/C++17 combination that may fail, -@@ -205,30 +231,43 @@ if (LibRaw_FOUND AND LibRaw_VERSION VERSION_LESS 0.20 AND CMAKE_CXX_STANDARD VER - # set (LIBRAW_FOUND 0) - endif () - --checked_find_package (OpenJPEG VERSION_MIN 2.0) -- --checked_find_package (OpenVDB -+if (USE_OPENJPEG) -+ checked_find_package (OpenJPEG REQUIRED VERSION_MIN 2.0) -+endif () -+if (USE_OPENVDB) -+ checked_find_package (OpenVDB REQUIRED - VERSION_MIN 5.0 - DEPS TBB - DEFINITIONS -DUSE_OPENVDB=1) -+endif () - --checked_find_package (Ptex PREFER_CONFIG) --if (NOT Ptex_FOUND OR NOT Ptex_VERSION) -+if (USE_PTEX) -+ checked_find_package (ptex REQUIRED PREFER_CONFIG) -+endif () -+if (0) - # Fallback for inadequate Ptex exported configs. This will eventually - # disappear when we can 100% trust Ptex's exports. - unset (Ptex_FOUND) - checked_find_package (Ptex) - endif () - --checked_find_package (WebP) -+if (USE_LIBWEBP) -+ checked_find_package (WebP REQUIRED) -+endif () - - option (USE_R3DSDK "Enable R3DSDK (RED camera) support" OFF) --checked_find_package (R3DSDK) # RED camera -+if (USE_R3DSDK) -+ checked_find_package (R3DSDK REQUIRED) # RED camera -+endif () - - set (NUKE_VERSION "7.0" CACHE STRING "Nuke version to target") --checked_find_package (Nuke) -+if (USE_NUKE) -+ checked_find_package (Nuke REQUIRED) -+endif () - --checked_find_package (OpenGL) # used for iv -+if (USE_OPENGL) -+ checked_find_package (OpenGL REQUIRED) # used for iv -+endif () - - # Qt -- used for iv - set (qt5_modules Core Gui Widgets) -@@ -236,7 +275,9 @@ if (OPENGL_FOUND) - list (APPEND qt5_modules OpenGL) - endif () - option (USE_QT "Use Qt if found" ON) --checked_find_package (Qt5 COMPONENTS ${qt5_modules}) -+if (USE_QT) -+ checked_find_package (Qt5 REQUIRED COMPONENTS ${qt5_modules}) -+endif () - if (USE_QT AND NOT Qt5_FOUND AND APPLE) - message (STATUS " If you think you installed qt5 with Homebrew and it still doesn't work,") - message (STATUS " try: export PATH=/usr/local/opt/qt5/bin:$PATH") -@@ -257,13 +298,13 @@ macro (find_or_download_robin_map) - # for an installed version. Still prefer a copy that seems to be - # locally installed in this tree. - if (NOT BUILD_ROBINMAP_FORCE) -- find_package (Robinmap QUIET) -+ find_package (tsl-robin-map REQUIRED) - endif () - # If an external copy wasn't found and we requested that missing - # packages be built, or we we are forcing a local copy to be built, then - # download and build it. - # Download the headers from github -- if ((BUILD_MISSING_ROBINMAP AND NOT ROBINMAP_FOUND) OR BUILD_ROBINMAP_FORCE) -+ if ((BUILD_MISSING_ROBINMAP AND NOT tsl-robin-map_FOUND) OR BUILD_ROBINMAP_FORCE) - message (STATUS "Downloading local Tessil/robin-map") - set (ROBINMAP_INSTALL_DIR "${PROJECT_SOURCE_DIR}/ext/robin-map") - set (ROBINMAP_GIT_REPOSITORY "https://github.com/Tessil/robin-map") -@@ -281,7 +322,7 @@ macro (find_or_download_robin_map) - endif () - set (ROBINMAP_INCLUDE_DIR "${ROBINMAP_INSTALL_DIR}/include") - endif () -- checked_find_package (Robinmap REQUIRED) -+ checked_find_package (tsl-robin-map REQUIRED) - endmacro() - - -@@ -291,7 +332,7 @@ endmacro() - option (USE_EMBEDDED_LIBSQUISH - "Force use of embedded Libsquish, even if external is found" OFF) - if (NOT USE_EMBEDDED_LIBSQUISH) -- checked_find_package (Libsquish) -+ checked_find_package (libsquish REQUIRED) - endif () - - -@@ -307,12 +348,12 @@ macro (find_or_download_fmt) - # for an installed version. Still prefer a copy that seems to be - # locally installed in this tree. - if (NOT BUILD_FMT_FORCE) -- find_package (fmt QUIET) -+ find_package (fmt REQUIRED) - endif () - # If an external copy wasn't found and we requested that missing - # packages be built, or we we are forcing a local copy to be built, then - # download and build it. -- if ((BUILD_MISSING_FMT AND NOT FMT_FOUND) OR BUILD_FMT_FORCE) -+ if ((BUILD_MISSING_FMT AND NOT fmt_FOUND) OR BUILD_FMT_FORCE) - message (STATUS "Downloading local fmtlib/fmt") - set (FMT_INSTALL_DIR "${PROJECT_SOURCE_DIR}/ext/fmt") - set (FMT_GIT_REPOSITORY "https://github.com/fmtlib/fmt") -diff --git a/src/dds.imageio/CMakeLists.txt b/src/dds.imageio/CMakeLists.txt -index d693453a..7ff6e9ce 100644 ---- a/src/dds.imageio/CMakeLists.txt -+++ b/src/dds.imageio/CMakeLists.txt -@@ -2,10 +2,10 @@ - # SPDX-License-Identifier: BSD-3-Clause - # https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md - --if (Libsquish_FOUND) -+if (libsquish_FOUND) - # External libsquish was found -- use it - add_oiio_plugin (ddsinput.cpp -- LINK_LIBRARIES Libsquish::Libsquish -+ LINK_LIBRARIES libsquish::libsquish - ) - else () - # No external libsquish was found -- use the embedded version. -diff --git a/src/dicom.imageio/CMakeLists.txt b/src/dicom.imageio/CMakeLists.txt -index ddd72044..3603eaa3 100644 ---- a/src/dicom.imageio/CMakeLists.txt -+++ b/src/dicom.imageio/CMakeLists.txt -@@ -4,8 +4,8 @@ - - if (DCMTK_FOUND) - add_oiio_plugin (dicominput.cpp -- INCLUDE_DIRS ${DCMTK_INCLUDE_DIR} -- LINK_LIBRARIES ${DCMTK_LIBRARIES} -+ # INCLUDE_DIRS ${DCMTK_INCLUDE_DIR} -+ LINK_LIBRARIES DCMTK::DCMTK - DEFINITIONS "-DUSE_DCMTK=1") - else () - message (WARNING "DICOM plugin will not be built, no DCMTK") -diff --git a/src/ffmpeg.imageio/CMakeLists.txt b/src/ffmpeg.imageio/CMakeLists.txt -index 614b8843..0df87825 100644 ---- a/src/ffmpeg.imageio/CMakeLists.txt -+++ b/src/ffmpeg.imageio/CMakeLists.txt -@@ -2,13 +2,13 @@ - # SPDX-License-Identifier: BSD-3-Clause - # https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md - --if (FFmpeg_FOUND) -+if (ffmpeg_FOUND) - add_oiio_plugin (ffmpeginput.cpp -- INCLUDE_DIRS ${FFMPEG_INCLUDES} -- LINK_LIBRARIES ${FFMPEG_LIBRARIES} -- ${BZIP2_LIBRARIES} -+ # INCLUDE_DIRS ${FFMPEG_INCLUDES} -+ LINK_LIBRARIES ffmpeg::avcodec ffmpeg::avformat ffmpeg::swscale -+ # ${BZIP2_LIBRARIES} - DEFINITIONS "-DUSE_FFMPEG" -- "-DOIIO_FFMPEG_VERSION=\"${FFMPEG_VERSION}\"") -+ "-DOIIO_FFMPEG_VERSION=\"${ffmpeg_VERSION}\"") - else() - message (STATUS "FFmpeg not found: ffmpeg plugin will not be built") - endif() -diff --git a/src/gif.imageio/CMakeLists.txt b/src/gif.imageio/CMakeLists.txt -index c9e7392c..eda8b482 100644 ---- a/src/gif.imageio/CMakeLists.txt -+++ b/src/gif.imageio/CMakeLists.txt -@@ -4,8 +4,8 @@ - - if (GIF_FOUND) - add_oiio_plugin (gifinput.cpp gifoutput.cpp -- INCLUDE_DIRS ${GIF_INCLUDE_DIRS} -- LINK_LIBRARIES ${GIF_LIBRARIES} -+ # INCLUDE_DIRS ${GIF_INCLUDE_DIRS} -+ LINK_LIBRARIES GIF::GIF - DEFINITIONS "-DUSE_GIF") - else() - message (WARNING "GIF plugin will not be built") -diff --git a/src/heif.imageio/CMakeLists.txt b/src/heif.imageio/CMakeLists.txt -index fed80015..2593f585 100644 ---- a/src/heif.imageio/CMakeLists.txt -+++ b/src/heif.imageio/CMakeLists.txt -@@ -2,9 +2,9 @@ - # SPDX-License-Identifier: BSD-3-Clause - # https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md - --if (Libheif_FOUND) -+if (libheif_FOUND) - add_oiio_plugin (heifinput.cpp heifoutput.cpp -- LINK_LIBRARIES Libheif::Libheif -+ LINK_LIBRARIES libheif::libheif - DEFINITIONS "-DUSE_HEIF=1") - else () - message (WARNING "heif plugin will not be built") -diff --git a/src/igrep/CMakeLists.txt b/src/igrep/CMakeLists.txt -index 3fde566a..49f063a8 100644 ---- a/src/igrep/CMakeLists.txt -+++ b/src/igrep/CMakeLists.txt -@@ -3,5 +3,5 @@ - # https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md - - fancy_add_executable (LINK_LIBRARIES OpenImageIO -- ${Boost_LIBRARIES} # because regex -+ #${Boost_LIBRARIES} # because regex - ) -diff --git a/src/iinfo/CMakeLists.txt b/src/iinfo/CMakeLists.txt -index 3fde566a..49f063a8 100644 ---- a/src/iinfo/CMakeLists.txt -+++ b/src/iinfo/CMakeLists.txt -@@ -3,5 +3,5 @@ - # https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md - - fancy_add_executable (LINK_LIBRARIES OpenImageIO -- ${Boost_LIBRARIES} # because regex -+ #${Boost_LIBRARIES} # because regex - ) -diff --git a/src/include/CMakeLists.txt b/src/include/CMakeLists.txt -index 1ea81b64..248e8a25 100644 ---- a/src/include/CMakeLists.txt -+++ b/src/include/CMakeLists.txt -@@ -56,17 +56,20 @@ install (FILES ${detail_headers} - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}/detail - COMPONENT developer) - -+set(FMT_INCLUDES "${fmt_INCLUDE_DIR}") - set (fmt_headers - ${FMT_INCLUDES}/fmt/core.h - ${FMT_INCLUDES}/fmt/format-inl.h - ${FMT_INCLUDES}/fmt/format.h - ${FMT_INCLUDES}/fmt/ostream.h - ${FMT_INCLUDES}/fmt/printf.h ) -+if (0) - file (COPY ${fmt_headers} - DESTINATION ${CMAKE_BINARY_DIR}/include/OpenImageIO/detail/fmt) - install (FILES ${fmt_headers} - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}/detail/fmt - COMPONENT developer) -+endif () - - if (NOT USE_EXTERNAL_PUGIXML) - set (pugixml_headers -diff --git a/src/include/OpenImageIO/strutil.h b/src/include/OpenImageIO/strutil.h -index 030d80a9..d6e768a3 100644 ---- a/src/include/OpenImageIO/strutil.h -+++ b/src/include/OpenImageIO/strutil.h -@@ -41,9 +41,9 @@ - #ifndef FMT_USE_GRISU - # define FMT_USE_GRISU 1 - #endif --#include "detail/fmt/ostream.h" --#include "detail/fmt/format.h" --#include "detail/fmt/printf.h" -+#include -+#include -+#include - #if OIIO_GNUC_VERSION >= 70000 - # pragma GCC diagnostic pop - #endif -diff --git a/src/jpeg.imageio/CMakeLists.txt b/src/jpeg.imageio/CMakeLists.txt -index 15d50cad..83830cd2 100644 ---- a/src/jpeg.imageio/CMakeLists.txt -+++ b/src/jpeg.imageio/CMakeLists.txt -@@ -3,5 +3,5 @@ - # https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md - - add_oiio_plugin (jpeginput.cpp jpegoutput.cpp -- INCLUDE_DIRS ${JPEG_INCLUDE_DIRS} -- LINK_LIBRARIES ${JPEG_LIBRARIES}) -+ # INCLUDE_DIRS ${JPEG_INCLUDE_DIRS} -+ LINK_LIBRARIES JPEG::JPEG) -diff --git a/src/jpeg2000.imageio/CMakeLists.txt b/src/jpeg2000.imageio/CMakeLists.txt -index 575ed0b7..5644bcf3 100644 ---- a/src/jpeg2000.imageio/CMakeLists.txt -+++ b/src/jpeg2000.imageio/CMakeLists.txt -@@ -2,10 +2,10 @@ - # SPDX-License-Identifier: BSD-3-Clause - # https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md - --if (OPENJPEG_FOUND) -+if (OpenJPEG_FOUND) - add_oiio_plugin (jpeg2000input.cpp jpeg2000output.cpp -- INCLUDE_DIRS ${OPENJPEG_INCLUDES} -- LINK_LIBRARIES ${OPENJPEG_LIBRARIES} -+ # INCLUDE_DIRS ${OPENJPEG_INCLUDES} -+ LINK_LIBRARIES OpenJPEG::OpenJPEG - DEFINITIONS "-DUSE_OPENJPEG") - else() - message (WARNING "Jpeg-2000 plugin will not be built") -diff --git a/src/libOpenImageIO/CMakeLists.txt b/src/libOpenImageIO/CMakeLists.txt -index 1e34593d..103c89de 100644 ---- a/src/libOpenImageIO/CMakeLists.txt -+++ b/src/libOpenImageIO/CMakeLists.txt -@@ -123,37 +123,42 @@ target_link_libraries (OpenImageIO - PUBLIC - OpenImageIO_Util - # For OpenEXR/Imath 3.x: -- $<$:Imath::Imath> -- $<$:Imath::Half> -+ # $<$:Imath::Imath> -+ # $<$:Imath::Half> - # For OpenEXR >= 2.4/2.5 with reliable exported targets -- $<$:IlmBase::Imath> -- $<$:IlmBase::Half> -+ # $<$:IlmBase::Imath> -+ # $<$:IlmBase::Half> - # For OpenEXR <= 2.3: -- ${ILMBASE_LIBRARIES} -+ OpenEXR::OpenEXR - ${GCC_ATOMIC_LIBRARIES} - PRIVATE - # For OpenEXR/Imath 3.x: -- $<$:OpenEXR::OpenEXR> -+ # $<$:OpenEXR::OpenEXR> - # For OpenEXR >= 2.4/2.5 with reliable exported targets -- $<$:OpenEXR::IlmImf> -- $<$:IlmBase::IlmThread> -- $<$:IlmBase::Iex> -+ # $<$:OpenEXR::IlmImf> -+ # $<$:IlmBase::IlmThread> -+ # $<$:IlmBase::Iex> - # For OpenEXR <= 2.3: -- ${OPENEXR_LIBRARIES} -- ${OpenCV_LIBRARIES} -+ # ${OPENEXR_LIBRARIES} -+ # ${OpenCV_LIBRARIES} - ${SANITIZE_LIBRARIES} - ${format_plugin_libs} # Add all the target link libraries from the plugins -+ tsl::robin_map - $<$:OpenColorIO::OpenColorIO> -- $<$:OpenColorIO::OpenColorIOHeaders> -+ # $<$:OpenColorIO::OpenColorIOHeaders> - $<$:pugixml::pugixml> -- ${BZIP2_LIBRARIES} -+ # ${BZIP2_LIBRARIES} - ZLIB::ZLIB -- ${Boost_LIBRARIES} -+ Boost::filesystem Boost::thread Boost::system Boost::container - ${CMAKE_DL_LIBS} - ) - --if (FREETYPE_FOUND) -- target_link_libraries (OpenImageIO PRIVATE ${FREETYPE_LIBRARIES}) -+if (OpenCV_FOUND) -+ target_link_libraries (OpenImageIO PUBLIC opencv::opencv_core opencv::opencv_imgproc opencv::opencv_videoio) -+endif () -+ -+if (Freetype_FOUND) -+ target_link_libraries (OpenImageIO PRIVATE Freetype::Freetype) - endif() - - if (WIN32) -diff --git a/src/libutil/CMakeLists.txt b/src/libutil/CMakeLists.txt -index 7de38836..3e1609ad 100644 ---- a/src/libutil/CMakeLists.txt -+++ b/src/libutil/CMakeLists.txt -@@ -14,19 +14,19 @@ target_include_directories (OpenImageIO_Util - target_link_libraries (OpenImageIO_Util - PUBLIC - # For OpenEXR/Imath 3.x: -- $<$:Imath::Imath> -- $<$:Imath::Half> -+ # $<$:Imath::Imath> -+ # $<$:Imath::Half> - # For OpenEXR >= 2.4/2.5 with reliable exported targets -- $<$:IlmBase::Imath> -- $<$:IlmBase::Half> -- $<$:IlmBase::IlmThread> -- $<$:IlmBase::Iex> -+ # $<$:IlmBase::Imath> -+ # $<$:IlmBase::Half> -+ # $<$:IlmBase::IlmThread> -+ # $<$:IlmBase::Iex> - # For OpenEXR <= 2.3: -- ${ILMBASE_LIBRARIES} -+ OpenEXR::OpenEXR - ${GCC_ATOMIC_LIBRARIES} - PRIVATE - ${SANITIZE_LIBRARIES} -- ${Boost_LIBRARIES} -+ Boost::filesystem Boost::thread Boost::system - ${CMAKE_DL_LIBS} - ) - -diff --git a/src/oiiotool/CMakeLists.txt b/src/oiiotool/CMakeLists.txt -index e281d3f8..4ee92aad 100644 ---- a/src/oiiotool/CMakeLists.txt -+++ b/src/oiiotool/CMakeLists.txt -@@ -4,8 +4,8 @@ - - fancy_add_executable (LINK_LIBRARIES - OpenImageIO -- ${Boost_LIBRARIES} # because regex -- $<$:OpenEXR::OpenEXR> -- $<$:OpenEXR::IlmImf> -- ${OPENEXR_LIBRARIES} -+ Boost::container -+ # $<$:OpenEXR::OpenEXR> -+ # $<$:OpenEXR::IlmImf> -+ OpenEXR::OpenEXR - ) -diff --git a/src/openexr.imageio/CMakeLists.txt b/src/openexr.imageio/CMakeLists.txt -index d4772880..9f5f8998 100644 ---- a/src/openexr.imageio/CMakeLists.txt -+++ b/src/openexr.imageio/CMakeLists.txt -@@ -12,7 +12,7 @@ if (OIIO_USE_EXR_C_API) - LINK_LIBRARIES OpenEXR::OpenEXRCore) - else() - add_oiio_plugin (exrinput.cpp exroutput.cpp -- INCLUDE_DIRS ${OPENEXR_INCLUDES} ${IMATH_INCLUDE_DIR}/OpenEXR -- LINK_LIBRARIES ${OPENEXR_LIBRARIES}) -+ #INCLUDE_DIRS ${OPENEXR_INCLUDES} ${IMATH_INCLUDE_DIR}/OpenEXR -+ LINK_LIBRARIES OpenEXR::OpenEXR) - endif() - -diff --git a/src/openvdb.imageio/CMakeLists.txt b/src/openvdb.imageio/CMakeLists.txt -index 57a0f625..986f9c21 100644 ---- a/src/openvdb.imageio/CMakeLists.txt -+++ b/src/openvdb.imageio/CMakeLists.txt -@@ -2,8 +2,8 @@ - # SPDX-License-Identifier: BSD-3-Clause - # https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md - --if (OpenVDB_FOUND) -+if (OpenVDB_FOUND AND TBB_FOUND) - add_oiio_plugin (openvdbinput.cpp - INCLUDE_DIRS ${TBB_INCLUDE_DIRS} -- LINK_LIBRARIES OpenVDB::OpenVDB ${TBB_tbb_LIBRARY} ${BOOST_LIBRARIES}) -+ LINK_LIBRARIES OpenVDB::OpenVDB TBB::TBB) - endif() -diff --git a/src/psd.imageio/CMakeLists.txt b/src/psd.imageio/CMakeLists.txt -index 48bf24fb..a5acecfd 100644 ---- a/src/psd.imageio/CMakeLists.txt -+++ b/src/psd.imageio/CMakeLists.txt -@@ -3,6 +3,6 @@ - # https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md - - add_oiio_plugin (psdinput.cpp jpeg_memory_src.cpp -- INCLUDE_DIRS ${JPEG_INCLUDE_DIR} -- LINK_LIBRARIES ${JPEG_LIBRARIES}) -+ #INCLUDE_DIRS ${JPEG_INCLUDE_DIR} -+ LINK_LIBRARIES JPEG::JPEG) - -diff --git a/src/ptex.imageio/CMakeLists.txt b/src/ptex.imageio/CMakeLists.txt -index 2f47527a..1c3c9800 100644 ---- a/src/ptex.imageio/CMakeLists.txt -+++ b/src/ptex.imageio/CMakeLists.txt -@@ -2,8 +2,8 @@ - # SPDX-License-Identifier: BSD-3-Clause - # https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md - --if (Ptex_FOUND) -+if (PTex_FOUND) - add_oiio_plugin (ptexinput.cpp -- LINK_LIBRARIES Ptex::Ptex_dynamic ZLIB::ZLIB -+ LINK_LIBRARIES PTex::PTex ZLIB::ZLIB - DEFINITIONS "-DUSE_PTEX") - endif () -diff --git a/src/raw.imageio/CMakeLists.txt b/src/raw.imageio/CMakeLists.txt -index d235fd9d..6661a2a8 100644 ---- a/src/raw.imageio/CMakeLists.txt -+++ b/src/raw.imageio/CMakeLists.txt -@@ -4,9 +4,9 @@ - - if (LIBRAW_FOUND) - add_oiio_plugin (rawinput.cpp -- INCLUDE_DIRS ${LibRaw_INCLUDE_DIR} -- LINK_LIBRARIES ${LibRaw_r_LIBRARIES} -- DEFINITIONS "-DUSE_LIBRAW=1" ${LibRaw_r_DEFINITIONS}) -+ #INCLUDE_DIRS ${LibRaw_INCLUDE_DIR} -+ LINK_LIBRARIES libraw::libraw -+ DEFINITIONS "-DUSE_LIBRAW=1") - else () - message (WARNING "Raw plugin will not be built") - endif () -diff --git a/src/tiff.imageio/CMakeLists.txt b/src/tiff.imageio/CMakeLists.txt -index ab94d56d..99ee19ae 100644 ---- a/src/tiff.imageio/CMakeLists.txt -+++ b/src/tiff.imageio/CMakeLists.txt -@@ -3,6 +3,6 @@ - # https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md - - add_oiio_plugin (tiffinput.cpp tiffoutput.cpp -- INCLUDE_DIRS ${TIFF_INCLUDE_DIR} -- LINK_LIBRARIES ${TIFF_LIBRARIES} ${JPEG_LIBRARIES} -+ #INCLUDE_DIRS ${TIFF_INCLUDE_DIR} -+ LINK_LIBRARIES TIFF::TIFF JPEG::JPEG - ZLIB::ZLIB) -diff --git a/src/webp.imageio/CMakeLists.txt b/src/webp.imageio/CMakeLists.txt -index 44462c49..78fe1a58 100644 ---- a/src/webp.imageio/CMakeLists.txt -+++ b/src/webp.imageio/CMakeLists.txt -@@ -4,7 +4,7 @@ - - if (WebP_FOUND) - add_oiio_plugin (webpinput.cpp webpoutput.cpp -- LINK_LIBRARIES WebP::WebP WebP::WebPDemux -+ LINK_LIBRARIES WebP::WebP - DEFINITIONS "-DUSE_WEBP=1") - else () - message (STATUS "WebP plugin will not be built") diff --git a/recipes/openimageio/all/patches/2.4.17.0-cmake-targets.patch b/recipes/openimageio/all/patches/2.4.17.0-cmake-targets.patch new file mode 100644 index 0000000000000..5ed8bf12ec780 --- /dev/null +++ b/recipes/openimageio/all/patches/2.4.17.0-cmake-targets.patch @@ -0,0 +1,456 @@ +diff --git CMakeLists.txt CMakeLists.txt +index a5a6de1c5..f1801af5a 100644 +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -144,7 +144,7 @@ message(STATUS "Setting Namespace to: ${PROJ_NAMESPACE_V}") + add_definitions (-DOIIO_INTERNAL=1) + + list (APPEND CMAKE_MODULE_PATH +- "${PROJECT_SOURCE_DIR}/src/cmake/modules" ++ #"${PROJECT_SOURCE_DIR}/src/cmake/modules" + "${PROJECT_SOURCE_DIR}/src/cmake") + + include (GNUInstallDirs) +@@ -224,7 +224,7 @@ if (OIIO_BUILD_TOOLS AND NOT BUILD_OIIOUTIL_ONLY) + add_subdirectory (src/iinfo) + add_subdirectory (src/maketx) + add_subdirectory (src/oiiotool) +- add_subdirectory (src/testtex) ++ #add_subdirectory (src/testtex) + add_subdirectory (src/iv) + endif () + +diff --git src/cmake/externalpackages.cmake src/cmake/externalpackages.cmake +index a4f895c07..f55da37cb 100644 +--- src/cmake/externalpackages.cmake ++++ src/cmake/externalpackages.cmake +@@ -45,14 +45,14 @@ if (NOT DEFINED Boost_USE_STATIC_LIBS) + set (Boost_USE_STATIC_LIBS "${LINKSTATIC}") + endif () + +-if (MSVC) +- # Not linking Boost as static libraries: either an explicit setting or LINKSTATIC is FALSE: +- if (NOT Boost_USE_STATIC_LIBS) +- add_definitions (-DBOOST_ALL_DYN_LINK=1) +- endif () +-endif () +- +-set (Boost_COMPONENTS thread) ++# if (MSVC) ++# # Not linking Boost as static libraries: either an explicit setting or LINKSTATIC is FALSE: ++# if (NOT Boost_USE_STATIC_LIBS) ++# add_definitions (-DBOOST_ALL_DYN_LINK=1) ++# endif () ++# endif () ++ ++set (Boost_COMPONENTS filesystem system thread container) + if (NOT USE_STD_FILESYSTEM) + list (APPEND Boost_COMPONENTS filesystem) + endif () +@@ -108,9 +108,9 @@ checked_find_package (OpenEXR REQUIRED + # building against Imath/OpenEXR 3.x when there is still a system-level + # install version of 2.x. + include_directories(BEFORE ${IMATH_INCLUDES} ${OPENEXR_INCLUDES}) +-if (MSVC AND NOT LINKSTATIC) +- add_definitions (-DOPENEXR_DLL) # Is this needed for new versions? +-endif () ++# if (MSVC AND NOT LINKSTATIC) ++# add_definitions (-DOPENEXR_DLL) # Is this needed for new versions? ++# endif () + if (OpenEXR_VERSION VERSION_GREATER_EQUAL 3.0) + set (OIIO_USING_IMATH 3) + else () +@@ -141,12 +141,15 @@ set (OPENIMAGEIO_CONFIG_DO_NOT_FIND_IMATH OFF CACHE BOOL + "Exclude find_dependency(Imath) from the exported OpenImageIOConfig.cmake") + + # JPEG -- prefer Turbo-JPEG to regular libjpeg +-checked_find_package (JPEGTurbo +- DEFINITIONS -DUSE_JPEG_TURBO=1 +- PRINT JPEG_INCLUDES JPEG_INCLUDE_DIRS +- JPEG_LIBRARIES JPEG_VERSION) +-if (NOT JPEG_FOUND) # Try to find the non-turbo version ++if (USE_JPEGTURBO) ++ checked_find_package (libjpeg-turbo REQUIRED ++ DEFINITIONS -DUSE_JPEG_TURBO=1 ++ PRINT libjpeg-turbo_INCLUDES libjpeg-turbo_LIBRARIES) ++ add_library(JPEG::JPEG ALIAS libjpeg-turbo::libjpeg-turbo) ++elseif (USE_JPEG) # Try to find the non-turbo version + checked_find_package (JPEG REQUIRED) ++else () ++ message(FATAL_ERROR "JPEG library was not found!") + endif () + + # Pugixml setup. Normally we just use the version bundled with oiio, but +@@ -162,106 +165,110 @@ else () + endif() + + # From pythonutils.cmake +-find_python() ++#find_python() + + + ########################################################################### + # Dependencies for optional formats and features. If these are not found, + # we will continue building, but the related functionality will be disabled. + +-checked_find_package (PNG) +- +-checked_find_package (BZip2) # Used by ffmpeg and freetype +-if (NOT BZIP2_FOUND) +- set (BZIP2_LIBRARIES "") # TODO: why does it break without this? +-endif () ++if (USE_LIBPNG) ++ checked_find_package (PNG) ++endif() + +-checked_find_package (Freetype +- DEFINITIONS -DUSE_FREETYPE=1 ) ++if (USE_FREETYPE) ++ checked_find_package (Freetype ++ DEFINITIONS -DUSE_FREETYPE=1 ) ++endif() + +-checked_find_package (OpenColorIO +- DEFINITIONS -DUSE_OCIO=1 -DUSE_OPENCOLORIO=1 +- # PREFER_CONFIG +- ) +-if (NOT OpenColorIO_FOUND) +- set (OpenColorIO_FOUND 0) +-endif () +-checked_find_package (OpenCV 3.0 +- DEFINITIONS -DUSE_OPENCV=1) ++if (USE_OPENCOLORIO) ++ checked_find_package (OpenColorIO ++ DEFINITIONS -DUSE_OCIO=1 -DUSE_OPENCOLORIO=1 ++ # PREFER_CONFIG ++ ) ++ if (NOT OpenColorIO_FOUND) ++ set (OpenColorIO_FOUND 0) ++ endif () ++endif() ++if (USE_OPENCV) ++ checked_find_package (OpenCV 3.0 ++ DEFINITIONS -DUSE_OPENCV=1) ++endif() + + # Intel TBB +-set (TBB_USE_DEBUG_BUILD OFF) +-checked_find_package (TBB 2017 +- SETVARIABLES OIIO_TBB +- PREFER_CONFIG) +- +-checked_find_package (DCMTK VERSION_MIN 3.6.1) # For DICOM images +-checked_find_package (FFmpeg VERSION_MIN 3.0) +-checked_find_package (GIF +- VERSION_MIN 4 +- RECOMMEND_MIN 5.0 +- RECOMMEND_MIN_REASON "for stability and thread safety") +- ++if (USE_TBB)# Intel TBB ++ set (TBB_USE_DEBUG_BUILD OFF) ++ checked_find_package (TBB 2017 ++ SETVARIABLES OIIO_TBB ++ PREFER_CONFIG) ++endif() ++if (USE_DCMTK) ++ checked_find_package (DCMTK VERSION_MIN 3.6.1) # For DICOM images ++endif() ++if (USE_FFMPEG) ++ checked_find_package (ffmpeg VERSION_MIN 3.0) ++endif() ++if (USE_GIF) ++ checked_find_package (GIF ++ VERSION_MIN 4 ++ RECOMMEND_MIN 5.0 ++ RECOMMEND_MIN_REASON "for stability and thread safety") ++endif() ++ + # For HEIF/HEIC/AVIF formats +-checked_find_package (Libheif VERSION_MIN 1.3 +- RECOMMEND_MIN 1.7 +- RECOMMEND_MIN_REASON "for AVIF support") +-if (APPLE AND LIBHEIF_VERSION VERSION_GREATER_EQUAL 1.10 AND LIBHEIF_VERSION VERSION_LESS 1.11) +- message (WARNING "Libheif 1.10 on Apple is known to be broken, disabling libheif support") +- set (Libheif_FOUND 0) +-endif () +- +-checked_find_package (LibRaw +- RECOMMEND_MIN 0.18 +- RECOMMEND_MIN_REASON "for ACES support and better camera metadata" +- PRINT LibRaw_r_LIBRARIES) +-if (LibRaw_FOUND AND LibRaw_VERSION VERSION_LESS 0.20 AND CMAKE_CXX_STANDARD VERSION_GREATER_EQUAL 17) +- message (STATUS "${ColorYellow}WARNING When building for C++17, LibRaw should be 0.20 or higher (found ${LibRaw_VERSION}). You may get errors, depending on the compiler.${ColorReset}") +- # Currently, we issue the above warning and let them take their chances. +- # If we wish to disable the LibRaw<0.20/C++17 combination that may fail, +- # just uncomment the following two lines. +- # set (LibRaw_FOUND 0) +- # set (LIBRAW_FOUND 0) +-endif () ++if (USE_LIBHEIF) ++ checked_find_package (libheif REQUIRED VERSION_MIN 1.3 ++ RECOMMEND_MIN 1.7 ++ RECOMMEND_MIN_REASON "for AVIF support") ++endif() + +-checked_find_package (OpenJPEG VERSION_MIN 2.0 +- RECOMMEND_MIN 2.2 +- RECOMMEND_MIN_REASON "for multithreading support") +-# Note: Recent OpenJPEG versions have exported cmake configs, but we don't +-# find them reliable at all, so we stick to our FindOpenJPEG.cmake module. +- +-checked_find_package (OpenVDB +- VERSION_MIN 5.0 +- DEPS TBB +- DEFINITIONS -DUSE_OPENVDB=1) +-if (OpenVDB_FOUND AND OpenVDB_VERSION VERSION_GREATER_EQUAL 10.1 AND CMAKE_CXX_STANDARD VERSION_LESS 17) +- message (WARNING "${ColorYellow}OpenVDB >= 10.1 (we found ${OpenVDB_VERSION}) can only be used when we build with C++17 or higher. Disabling OpenVDB support.${ColorReset}") +- set (OpeVDB_FOUND 0) +-endif () ++if (USE_LIBRAW) ++ checked_find_package (LibRaw ++ RECOMMEND_MIN 0.18 ++ RECOMMEND_MIN_REASON "for ACES support and better camera metadata" ++ PRINT LibRaw_r_LIBRARIES) ++endif() + +-checked_find_package (Ptex PREFER_CONFIG) +-if (NOT Ptex_FOUND OR NOT Ptex_VERSION) +- # Fallback for inadequate Ptex exported configs. This will eventually +- # disappear when we can 100% trust Ptex's exports. +- unset (Ptex_FOUND) +- checked_find_package (Ptex) +-endif () ++if (USE_OPENJPEG) ++ checked_find_package (OpenJPEG REQUIRED ++ VERSION_MIN 2.0 ++ RECOMMEND_MIN 2.2 ++ RECOMMEND_MIN_REASON "for multithreading support") ++ # Note: Recent OpenJPEG versions have exported cmake configs, but we don't ++ # find them reliable at all, so we stick to our FindOpenJPEG.cmake module. ++endif() ++if (USE_OPENVDB) ++ checked_find_package (OpenVDB REQUIRED ++ VERSION_MIN 5.0 ++ DEPS TBB ++ DEFINITIONS -DUSE_OPENVDB=1) ++endif() + +-checked_find_package (WebP) ++if (USE_PTEX) ++ checked_find_package (ptex PREFER_CONFIG) ++endif() + ++if (USE_LIBWEBP) ++ checked_find_package (WebP REQUIRED) ++endif() ++ + option (USE_R3DSDK "Enable R3DSDK (RED camera) support" OFF) +-checked_find_package (R3DSDK) # RED camera +- ++if (USE_R3DSDK) ++ checked_find_package (R3DSDK REQUIRED) # RED camera ++endif () ++ + set (NUKE_VERSION "7.0" CACHE STRING "Nuke version to target") +-checked_find_package (Nuke) ++if (USE_NUKE) ++ checked_find_package (Nuke REQUIRED) ++endif () + + + # Qt -- used for iv + option (USE_QT "Use Qt if found" ON) +-if (USE_QT) +- checked_find_package (OpenGL) # used for iv ++if (USE_OPENGL) ++ checked_find_package (OpenGL REQUIRED) # used for iv + endif () +-if (USE_QT AND OPENGL_FOUND) ++if (USE_QT AND USE_OPENGL) + checked_find_package (Qt6 COMPONENTS Core Gui Widgets OpenGLWidgets) + if (NOT Qt6_FOUND) + checked_find_package (Qt5 COMPONENTS Core Gui Widgets OpenGL) +@@ -285,13 +291,13 @@ macro (find_or_download_robin_map) + # for an installed version. Still prefer a copy that seems to be + # locally installed in this tree. + if (NOT BUILD_ROBINMAP_FORCE) +- find_package (Robinmap QUIET) ++ find_package (tsl-robin-map REQUIRED) + endif () + # If an external copy wasn't found and we requested that missing + # packages be built, or we we are forcing a local copy to be built, then + # download and build it. + # Download the headers from github +- if ((BUILD_MISSING_ROBINMAP AND NOT ROBINMAP_FOUND) OR BUILD_ROBINMAP_FORCE) ++ if ((BUILD_MISSING_ROBINMAP AND NOT tsl-robin-map_FOUND) OR BUILD_ROBINMAP_FORCE) + message (STATUS "Downloading local Tessil/robin-map") + set (ROBINMAP_INSTALL_DIR "${PROJECT_SOURCE_DIR}/ext/robin-map") + set (ROBINMAP_GIT_REPOSITORY "https://github.com/Tessil/robin-map") +@@ -309,7 +315,7 @@ macro (find_or_download_robin_map) + endif () + set (ROBINMAP_INCLUDE_DIR "${ROBINMAP_INSTALL_DIR}/include") + endif () +- checked_find_package (Robinmap REQUIRED) ++ checked_find_package (tsl-robin-map REQUIRED) + endmacro() + + +@@ -331,7 +337,7 @@ macro (find_or_download_fmt) + # If an external copy wasn't found and we requested that missing + # packages be built, or we we are forcing a local copy to be built, then + # download and build it. +- if ((BUILD_MISSING_FMT AND NOT FMT_FOUND) OR BUILD_FMT_FORCE) ++ if ((BUILD_MISSING_FMT AND NOT fmt_FOUND) OR BUILD_FMT_FORCE) + message (STATUS "Downloading local fmtlib/fmt") + set (FMT_INSTALL_DIR "${PROJECT_SOURCE_DIR}/ext/fmt") + set (FMT_GIT_REPOSITORY "https://github.com/fmtlib/fmt") +diff --git src/ffmpeg.imageio/CMakeLists.txt src/ffmpeg.imageio/CMakeLists.txt +index 100d4d773..ec7e01884 100644 +--- src/ffmpeg.imageio/CMakeLists.txt ++++ src/ffmpeg.imageio/CMakeLists.txt +@@ -2,13 +2,11 @@ + # SPDX-License-Identifier: Apache-2.0 + # https://github.com/AcademySoftwareFoundation/OpenImageIO + +-if (FFmpeg_FOUND) ++if (USE_FFMPEG) + add_oiio_plugin (ffmpeginput.cpp +- INCLUDE_DIRS ${FFMPEG_INCLUDES} +- LINK_LIBRARIES ${FFMPEG_LIBRARIES} +- ${BZIP2_LIBRARIES} ++ LINK_LIBRARIES ffmpeg::avcodec ffmpeg::avformat ffmpeg::swscale + DEFINITIONS "-DUSE_FFMPEG" +- "-DOIIO_FFMPEG_VERSION=\"${FFMPEG_VERSION}\"") ++ "-DOIIO_FFMPEG_VERSION=\"${ffmpeg_VERSION}\"") + else() + message (STATUS "FFmpeg not found: ffmpeg plugin will not be built") + endif() +diff --git src/heif.imageio/CMakeLists.txt src/heif.imageio/CMakeLists.txt +index eed740900..72aaaff86 100644 +--- src/heif.imageio/CMakeLists.txt ++++ src/heif.imageio/CMakeLists.txt +@@ -2,10 +2,10 @@ + # SPDX-License-Identifier: Apache-2.0 + # https://github.com/AcademySoftwareFoundation/OpenImageIO + +-if (Libheif_FOUND) ++if (USE_LIBHEIF) + add_oiio_plugin (heifinput.cpp heifoutput.cpp +- INCLUDE_DIRS ${LIBHEIF_INCLUDES} +- LINK_LIBRARIES ${LIBHEIF_LIBRARIES} ++ #INCLUDE_DIRS ${LIBHEIF_INCLUDES} ++ LINK_LIBRARIES libheif::heif + DEFINITIONS "-DUSE_HEIF=1") + else () + message (WARNING "heif plugin will not be built") +diff --git src/include/CMakeLists.txt src/include/CMakeLists.txt +index 006cb65a7..2e2c2c2ea 100644 +--- src/include/CMakeLists.txt ++++ src/include/CMakeLists.txt +@@ -65,6 +65,7 @@ install (FILES ${detail_headers} + COMPONENT developer) + + if (INTERNALIZE_FMT OR OIIO_USING_FMT_LOCAL) ++ set(FMT_INCLUDES "${fmt_INCLUDE_DIR}") + set (fmt_headers + ${FMT_INCLUDES}/fmt/core.h + ${FMT_INCLUDES}/fmt/format-inl.h +@@ -74,8 +75,8 @@ if (INTERNALIZE_FMT OR OIIO_USING_FMT_LOCAL) + if (fmt_VERSION VERSION_GREATER_EQUAL 90000) + list (APPEND fmt_headers ${FMT_INCLUDES}/fmt/std.h) + endif () +- file (COPY ${fmt_headers} +- DESTINATION ${CMAKE_BINARY_DIR}/include/OpenImageIO/detail/fmt) ++ # file (COPY ${fmt_headers} ++ # DESTINATION ${CMAKE_BINARY_DIR}/include/OpenImageIO/detail/fmt) + else () + set (fmt_headers + ${CMAKE_BINARY_DIR}/include/OpenImageIO/detail/fmt/format.h +diff --git src/include/OpenImageIO/detail/fmt.h src/include/OpenImageIO/detail/fmt.h +index 31a986d31..9a7e5ce54 100644 +--- src/include/OpenImageIO/detail/fmt.h ++++ src/include/OpenImageIO/detail/fmt.h +@@ -55,9 +55,9 @@ OIIO_PRAGMA_WARNING_PUSH + # pragma GCC diagnostic ignored "-Wtautological-constant-compare" + #endif + +-#include +-#include +-#include ++#include ++#include ++#include + + OIIO_PRAGMA_WARNING_POP + +diff --git src/jpeg2000.imageio/CMakeLists.txt src/jpeg2000.imageio/CMakeLists.txt +index 560e8d486..94b5cd2dc 100644 +--- src/jpeg2000.imageio/CMakeLists.txt ++++ src/jpeg2000.imageio/CMakeLists.txt +@@ -4,8 +4,7 @@ + + if (OPENJPEG_FOUND) + add_oiio_plugin (jpeg2000input.cpp jpeg2000output.cpp +- INCLUDE_DIRS ${OPENJPEG_INCLUDES} +- LINK_LIBRARIES ${OPENJPEG_LIBRARIES} ++ LINK_LIBRARIES openjp2 + DEFINITIONS "-DUSE_OPENJPEG") + else() + message (WARNING "Jpeg-2000 plugin will not be built") +diff --git src/libOpenImageIO/CMakeLists.txt src/libOpenImageIO/CMakeLists.txt +index 772b39ff2..898fb2be6 100644 +--- src/libOpenImageIO/CMakeLists.txt ++++ src/libOpenImageIO/CMakeLists.txt +@@ -141,12 +141,17 @@ target_link_libraries (OpenImageIO + $ + ${BZIP2_LIBRARIES} + ZLIB::ZLIB +- $ ++ tsl::robin_map ++ Boost::filesystem Boost::thread Boost::system Boost::container + ${CMAKE_DL_LIBS} + ) + ++if (USE_OPENCV) ++ target_link_libraries (OpenImageIO PUBLIC opencv::opencv_core opencv::opencv_imgproc opencv::opencv_videoio) ++endif () ++ +-if (FREETYPE_FOUND) +- target_link_libraries (OpenImageIO PRIVATE ${FREETYPE_LIBRARIES}) ++if (USE_FREETYPE) ++ target_link_libraries (OpenImageIO PRIVATE Freetype::Freetype) + endif() + + if (WIN32) +diff --git src/libutil/CMakeLists.txt src/libutil/CMakeLists.txt +index 8933bfe5b..3970eb0c3 100644 +--- src/libutil/CMakeLists.txt ++++ src/libutil/CMakeLists.txt +@@ -20,8 +20,8 @@ target_link_libraries (OpenImageIO_Util + ${GCC_ATOMIC_LIBRARIES} + ${OPENIMAGEIO_IMATH_DEPENDENCY_VISIBILITY} + ${OPENIMAGEIO_IMATH_TARGETS} ++ fmt::fmt + PRIVATE +- $ +- $ ++ Boost::filesystem Boost::thread Boost::system + $ + ${CMAKE_DL_LIBS} + ) +diff --git src/ptex.imageio/CMakeLists.txt src/ptex.imageio/CMakeLists.txt +index ed42f1c94..82d2b9770 100644 +--- src/ptex.imageio/CMakeLists.txt ++++ src/ptex.imageio/CMakeLists.txt +@@ -2,8 +2,9 @@ + # SPDX-License-Identifier: Apache-2.0 + # https://github.com/AcademySoftwareFoundation/OpenImageIO + +-if (Ptex_FOUND) ++if (USE_PTEX) + add_oiio_plugin (ptexinput.cpp +- LINK_LIBRARIES Ptex::Ptex_dynamic ZLIB::ZLIB ++ LINK_LIBRARIES ${ptex_LIBRARIES} ZLIB::ZLIB ++ INCLUDE_DIRS ${ptex_INCLUDE_DIRS} + DEFINITIONS "-DUSE_PTEX") + endif () diff --git a/recipes/openimageio/all/patches/2.4.7.1-cmake-targets.patch b/recipes/openimageio/all/patches/2.4.7.1-cmake-targets.patch new file mode 100644 index 0000000000000..0d61414f30ef2 --- /dev/null +++ b/recipes/openimageio/all/patches/2.4.7.1-cmake-targets.patch @@ -0,0 +1,429 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 4465c824c..7b23fb444 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -140,7 +140,7 @@ message(STATUS "Setting Namespace to: ${PROJ_NAMESPACE_V}") + add_definitions (-DOIIO_INTERNAL=1) + + list (APPEND CMAKE_MODULE_PATH +- "${PROJECT_SOURCE_DIR}/src/cmake/modules" ++ #"${PROJECT_SOURCE_DIR}/src/cmake/modules" + "${PROJECT_SOURCE_DIR}/src/cmake") + + include (GNUInstallDirs) +@@ -220,7 +220,7 @@ if (OIIO_BUILD_TOOLS AND NOT BUILD_OIIOUTIL_ONLY) + add_subdirectory (src/iinfo) + add_subdirectory (src/maketx) + add_subdirectory (src/oiiotool) +- add_subdirectory (src/testtex) ++ #add_subdirectory (src/testtex) + add_subdirectory (src/iv) + endif () + +diff --git a/src/cmake/externalpackages.cmake b/src/cmake/externalpackages.cmake +index 48e871418..21f709b1d 100644 +--- a/src/cmake/externalpackages.cmake ++++ b/src/cmake/externalpackages.cmake +@@ -48,11 +48,11 @@ endif () + if (MSVC) + # Not linking Boost as static libraries: either an explicit setting or LINKSTATIC is FALSE: + if (NOT Boost_USE_STATIC_LIBS) +- add_definitions (-DBOOST_ALL_DYN_LINK=1) ++ #add_definitions (-DBOOST_ALL_DYN_LINK=1) + endif () + endif () + +-set (Boost_COMPONENTS thread) ++set (Boost_COMPONENTS filesystem system thread container) + if (NOT USE_STD_FILESYSTEM) + list (APPEND Boost_COMPONENTS filesystem) + endif () +@@ -104,9 +104,9 @@ checked_find_package (OpenEXR REQUIRED + # install version of 2.x. + include_directories(BEFORE ${IMATH_INCLUDES} ${OPENEXR_INCLUDES}) + if (MSVC AND NOT LINKSTATIC) +- add_definitions (-DOPENEXR_DLL) # Is this needed for new versions? ++ #add_definitions (-DOPENEXR_DLL) # Is this needed for new versions? + endif () +-if (OPENEXR_VERSION VERSION_GREATER_EQUAL 3.0) ++if (OpenEXR_VERSION VERSION_GREATER_EQUAL 3.0) + set (OIIO_USING_IMATH 3) + else () + set (OIIO_USING_IMATH 2) +@@ -136,12 +136,15 @@ set (OPENIMAGEIO_CONFIG_DO_NOT_FIND_IMATH OFF CACHE BOOL + "Exclude find_dependency(Imath) from the exported OpenImageIOConfig.cmake") + + # JPEG -- prefer Turbo-JPEG to regular libjpeg +-checked_find_package (JPEGTurbo +- DEFINITIONS -DUSE_JPEG_TURBO=1 +- PRINT JPEG_INCLUDES JPEG_INCLUDE_DIRS +- JPEG_LIBRARIES JPEG_VERSION) +-if (NOT JPEG_FOUND) # Try to find the non-turbo version ++if (USE_JPEGTURBO) ++ checked_find_package (libjpeg-turbo REQUIRED ++ DEFINITIONS -DUSE_JPEG_TURBO=1 ++ PRINT libjpeg-turbo_INCLUDES libjpeg-turbo_LIBRARIES) ++ add_library(JPEG::JPEG ALIAS libjpeg-turbo::libjpeg-turbo) ++elseif (USE_JPEG) # Try to find the non-turbo version + checked_find_package (JPEG REQUIRED) ++else () ++ message(FATAL_ERROR "JPEG library was not found!") + endif () + + # Pugixml setup. Normally we just use the version bundled with oiio, but +@@ -157,96 +160,102 @@ else () + endif() + + # From pythonutils.cmake +-find_python() ++#find_python() + + + ########################################################################### + # Dependencies for optional formats and features. If these are not found, + # we will continue building, but the related functionality will be disabled. + +-checked_find_package (PNG) +- +-checked_find_package (BZip2) # Used by ffmpeg and freetype +-if (NOT BZIP2_FOUND) +- set (BZIP2_LIBRARIES "") # TODO: why does it break without this? +-endif () ++if (USE_LIBPNG) ++ checked_find_package (PNG) ++endif() + +-checked_find_package (Freetype ++if (USE_FREETYPE) ++ checked_find_package (Freetype + DEFINITIONS -DUSE_FREETYPE=1 ) ++endif() + +-checked_find_package (OpenColorIO +- DEFINITIONS -DUSE_OCIO=1 -DUSE_OPENCOLORIO=1 +- # PREFER_CONFIG +- ) +-if (NOT OpenColorIO_FOUND) +- set (OpenColorIO_FOUND 0) +-endif () +-checked_find_package (OpenCV 3.0 ++if (USE_OPENCOLORIO) ++ checked_find_package (OpenColorIO ++ DEFINITIONS -DUSE_OCIO=1 -DUSE_OPENCOLORIO=1 ++ # PREFER_CONFIG ++ ) ++ if (NOT OpenColorIO_FOUND) ++ set (OpenColorIO_FOUND 0) ++ endif () ++endif() ++if (USE_OPENCV) ++ checked_find_package (OpenCV 3.0 + DEFINITIONS -DUSE_OPENCV=1) ++endif() + +-# Intel TBB +-set (TBB_USE_DEBUG_BUILD OFF) +-checked_find_package (TBB 2017 +- SETVARIABLES OIIO_TBB +- PREFER_CONFIG) +- +-checked_find_package (DCMTK VERSION_MIN 3.6.1) # For DICOM images +-checked_find_package (FFmpeg VERSION_MIN 3.0) +-checked_find_package (GIF +- VERSION_MIN 4 +- RECOMMEND_MIN 5.0 +- RECOMMEND_MIN_REASON "for stability and thread safety") +- ++if (USE_TBB)# Intel TBB ++ set (TBB_USE_DEBUG_BUILD OFF) ++ checked_find_package (TBB 2017 ++ SETVARIABLES OIIO_TBB ++ PREFER_CONFIG) ++endif() ++if (USE_DCMTK) ++ checked_find_package (DCMTK VERSION_MIN 3.6.1) # For DICOM images ++endif() ++if (USE_FFMPEG) ++ checked_find_package (ffmpeg VERSION_MIN 3.0) ++endif() ++if (USE_GIF) ++ checked_find_package (GIF ++ VERSION_MIN 4 ++ RECOMMEND_MIN 5.0 ++ RECOMMEND_MIN_REASON "for stability and thread safety") ++endif() + # For HEIF/HEIC/AVIF formats +-checked_find_package (Libheif VERSION_MIN 1.3 ++if (USE_LIBHEIF) ++checked_find_package (libheif REQUIRED VERSION_MIN 1.3 + RECOMMEND_MIN 1.7 + RECOMMEND_MIN_REASON "for AVIF support") +-if (APPLE AND LIBHEIF_VERSION VERSION_GREATER_EQUAL 1.10 AND LIBHEIF_VERSION VERSION_LESS 1.11) +- message (WARNING "Libheif 1.10 on Apple is known to be broken, disabling libheif support") +- set (Libheif_FOUND 0) +-endif () ++endif() ++if (USE_LIBRAW) ++ checked_find_package (LibRaw ++ RECOMMEND_MIN 0.18 ++ RECOMMEND_MIN_REASON "for ACES support and better camera metadata" ++ PRINT LibRaw_r_LIBRARIES) ++endif() + +-checked_find_package (LibRaw +- RECOMMEND_MIN 0.18 +- RECOMMEND_MIN_REASON "for ACES support and better camera metadata" +- PRINT LibRaw_r_LIBRARIES) +-if (LibRaw_FOUND AND LibRaw_VERSION VERSION_LESS 0.20 AND CMAKE_CXX_STANDARD VERSION_GREATER_EQUAL 17) +- message (STATUS "${ColorYellow}WARNING When building for C++17, LibRaw should be 0.20 or higher (found ${LibRaw_VERSION}). You may get errors, depending on the compiler.${ColorReset}") +- # Currently, we issue the above warning and let them take their chances. +- # If we wish to disable the LibRaw<0.20/C++17 combination that may fail, +- # just uncomment the following two lines. +- # set (LibRaw_FOUND 0) +- # set (LIBRAW_FOUND 0) +-endif () ++if (USE_OPENJPEG) ++ checked_find_package (OpenJPEG VERSION_MIN 2.0 ++ RECOMMEND_MIN 2.2 ++ RECOMMEND_MIN_REASON "for multithreading support") ++ # Note: Recent OpenJPEG versions have exported cmake configs, but we don't ++ # find them reliable at all, so we stick to our FindOpenJPEG.cmake module. ++endif() ++if (USE_OPENVDB) ++ checked_find_package (OpenVDB ++ VERSION_MIN 5.0 ++ DEPS TBB ++ DEFINITIONS -DUSE_OPENVDB=1) ++endif() + +-checked_find_package (OpenJPEG VERSION_MIN 2.0 +- RECOMMEND_MIN 2.2 +- RECOMMEND_MIN_REASON "for multithreading support") +-# Note: Recent OpenJPEG versions have exported cmake configs, but we don't +-# find them reliable at all, so we stick to our FindOpenJPEG.cmake module. +- +-checked_find_package (OpenVDB +- VERSION_MIN 5.0 +- DEPS TBB +- DEFINITIONS -DUSE_OPENVDB=1) +- +-checked_find_package (Ptex PREFER_CONFIG) +-if (NOT Ptex_FOUND OR NOT Ptex_VERSION) +- # Fallback for inadequate Ptex exported configs. This will eventually +- # disappear when we can 100% trust Ptex's exports. +- unset (Ptex_FOUND) +- checked_find_package (Ptex) +-endif () ++if (USE_PTEX) ++ checked_find_package (ptex PREFER_CONFIG) ++endif() + +-checked_find_package (WebP) ++if (USE_LIBWEBP) ++ checked_find_package (WebP) ++endif() + + option (USE_R3DSDK "Enable R3DSDK (RED camera) support" OFF) +-checked_find_package (R3DSDK) # RED camera ++if (USE_R3DSDK) ++ checked_find_package (R3DSDK REQUIRED) # RED camera ++endif () + + set (NUKE_VERSION "7.0" CACHE STRING "Nuke version to target") +-checked_find_package (Nuke) ++if (USE_NUKE) ++ checked_find_package (Nuke REQUIRED) ++endif () + +-checked_find_package (OpenGL) # used for iv ++if (USE_OPENGL) ++ checked_find_package (OpenGL REQUIRED) # used for iv ++endif () + + # Qt -- used for iv + set (qt5_modules Core Gui Widgets) +@@ -254,7 +263,9 @@ if (OPENGL_FOUND) + list (APPEND qt5_modules OpenGL) + endif () + option (USE_QT "Use Qt if found" ON) +-checked_find_package (Qt5 COMPONENTS ${qt5_modules}) ++if (USE_QT) ++ checked_find_package (Qt5 COMPONENTS ${qt5_modules}) ++endif() + if (USE_QT AND NOT Qt5_FOUND AND APPLE) + message (STATUS " If you think you installed qt5 with Homebrew and it still doesn't work,") + message (STATUS " try: export PATH=/usr/local/opt/qt5/bin:$PATH") +@@ -275,13 +286,13 @@ macro (find_or_download_robin_map) + # for an installed version. Still prefer a copy that seems to be + # locally installed in this tree. + if (NOT BUILD_ROBINMAP_FORCE) +- find_package (Robinmap QUIET) ++ find_package (tsl-robin-map REQUIRED) + endif () + # If an external copy wasn't found and we requested that missing + # packages be built, or we we are forcing a local copy to be built, then + # download and build it. + # Download the headers from github +- if ((BUILD_MISSING_ROBINMAP AND NOT ROBINMAP_FOUND) OR BUILD_ROBINMAP_FORCE) ++ if ((BUILD_MISSING_ROBINMAP AND NOT tsl-robin-map_FOUND) OR BUILD_ROBINMAP_FORCE) + message (STATUS "Downloading local Tessil/robin-map") + set (ROBINMAP_INSTALL_DIR "${PROJECT_SOURCE_DIR}/ext/robin-map") + set (ROBINMAP_GIT_REPOSITORY "https://github.com/Tessil/robin-map") +@@ -299,7 +310,7 @@ macro (find_or_download_robin_map) + endif () + set (ROBINMAP_INCLUDE_DIR "${ROBINMAP_INSTALL_DIR}/include") + endif () +- checked_find_package (Robinmap REQUIRED) ++ checked_find_package (tsl-robin-map REQUIRED) + endmacro() + + +diff --git a/src/ffmpeg.imageio/CMakeLists.txt b/src/ffmpeg.imageio/CMakeLists.txt +index 58402060e..5dea82369 100644 +--- a/src/ffmpeg.imageio/CMakeLists.txt ++++ b/src/ffmpeg.imageio/CMakeLists.txt +@@ -2,13 +2,11 @@ + # SPDX-License-Identifier: BSD-3-Clause + # https://github.com/OpenImageIO/oiio + +-if (FFmpeg_FOUND) ++if (ffmpeg_FOUND) + add_oiio_plugin (ffmpeginput.cpp +- INCLUDE_DIRS ${FFMPEG_INCLUDES} +- LINK_LIBRARIES ${FFMPEG_LIBRARIES} +- ${BZIP2_LIBRARIES} ++ LINK_LIBRARIES ffmpeg::avcodec ffmpeg::avformat ffmpeg::swscale + DEFINITIONS "-DUSE_FFMPEG" +- "-DOIIO_FFMPEG_VERSION=\"${FFMPEG_VERSION}\"") ++ "-DOIIO_FFMPEG_VERSION=\"${ffmpeg_VERSION}\"") + else() + message (STATUS "FFmpeg not found: ffmpeg plugin will not be built") + endif() +diff --git src/heif.imageio/CMakeLists.txt src/heif.imageio/CMakeLists.txt +index ece763a27..83abdea66 100644 +--- src/heif.imageio/CMakeLists.txt ++++ src/heif.imageio/CMakeLists.txt +@@ -2,10 +2,10 @@ + # SPDX-License-Identifier: BSD-3-Clause + # https://github.com/OpenImageIO/oiio + +-if (Libheif_FOUND) ++if (USE_LIBHEIF) + add_oiio_plugin (heifinput.cpp heifoutput.cpp +- INCLUDE_DIRS ${LIBHEIF_INCLUDES} +- LINK_LIBRARIES ${LIBHEIF_LIBRARIES} ++ #INCLUDE_DIRS ${LIBHEIF_INCLUDES} ++ LINK_LIBRARIES libheif::heif + DEFINITIONS "-DUSE_HEIF=1") + else () + message (WARNING "heif plugin will not be built") +diff --git a/src/include/CMakeLists.txt b/src/include/CMakeLists.txt +index 52b0936a6..611eadb4e 100644 +--- a/src/include/CMakeLists.txt ++++ b/src/include/CMakeLists.txt +@@ -65,14 +65,15 @@ install (FILES ${detail_headers} + COMPONENT developer) + + if (INTERNALIZE_FMT OR OIIO_USING_FMT_LOCAL) ++ set(FMT_INCLUDES "${fmt_INCLUDE_DIR}") + set (fmt_headers + ${FMT_INCLUDES}/fmt/core.h + ${FMT_INCLUDES}/fmt/format-inl.h + ${FMT_INCLUDES}/fmt/format.h + ${FMT_INCLUDES}/fmt/ostream.h + ${FMT_INCLUDES}/fmt/printf.h ) +- file (COPY ${fmt_headers} +- DESTINATION ${CMAKE_BINARY_DIR}/include/OpenImageIO/detail/fmt) ++ #file (COPY ${fmt_headers} ++ # DESTINATION ${CMAKE_BINARY_DIR}/include/OpenImageIO/detail/fmt) + else () + set (fmt_headers + ${CMAKE_BINARY_DIR}/include/OpenImageIO/detail/fmt/format.h +diff --git a/src/include/OpenImageIO/detail/fmt.h b/src/include/OpenImageIO/detail/fmt.h +index f0cfcb300..1958d824e 100644 +--- a/src/include/OpenImageIO/detail/fmt.h ++++ b/src/include/OpenImageIO/detail/fmt.h +@@ -38,9 +38,9 @@ OIIO_PRAGMA_WARNING_PUSH + # pragma GCC diagnostic ignored "-Wtautological-constant-compare" + #endif + +-#include +-#include +-#include ++#include ++#include ++#include + + OIIO_PRAGMA_WARNING_POP + +diff --git a/src/jpeg2000.imageio/CMakeLists.txt b/src/jpeg2000.imageio/CMakeLists.txt +index 1f47269bf..85b90d66a 100644 +--- a/src/jpeg2000.imageio/CMakeLists.txt ++++ b/src/jpeg2000.imageio/CMakeLists.txt +@@ -4,8 +4,7 @@ + + if (OPENJPEG_FOUND) + add_oiio_plugin (jpeg2000input.cpp jpeg2000output.cpp +- INCLUDE_DIRS ${OPENJPEG_INCLUDES} +- LINK_LIBRARIES ${OPENJPEG_LIBRARIES} ++ LINK_LIBRARIES openjp2 + DEFINITIONS "-DUSE_OPENJPEG") + else() + message (WARNING "Jpeg-2000 plugin will not be built") +diff --git a/src/libOpenImageIO/CMakeLists.txt b/src/libOpenImageIO/CMakeLists.txt +index 456aab81a..eb5bb00fc 100644 +--- a/src/libOpenImageIO/CMakeLists.txt ++++ b/src/libOpenImageIO/CMakeLists.txt +@@ -141,12 +141,17 @@ target_link_libraries (OpenImageIO + $ + ${BZIP2_LIBRARIES} + ZLIB::ZLIB +- $ ++ tsl::robin_map ++ Boost::filesystem Boost::thread Boost::system Boost::container + ${CMAKE_DL_LIBS} + ) + ++if (OpenCV_FOUND) ++ target_link_libraries (OpenImageIO PUBLIC opencv::opencv_core opencv::opencv_imgproc opencv::opencv_videoio) ++endif () ++ + if (FREETYPE_FOUND) +- target_link_libraries (OpenImageIO PRIVATE ${FREETYPE_LIBRARIES}) ++ target_link_libraries (OpenImageIO PRIVATE Freetype::Freetype) + endif() + + if (WIN32) +diff --git a/src/libutil/CMakeLists.txt b/src/libutil/CMakeLists.txt +index 09b9139d0..a2d39982e 100644 +--- a/src/libutil/CMakeLists.txt ++++ b/src/libutil/CMakeLists.txt +@@ -15,8 +15,8 @@ target_link_libraries (OpenImageIO_Util + $ + ${GCC_ATOMIC_LIBRARIES} + ${OPENIMAGEIO_IMATH_DEPENDENCY_VISIBILITY} + ${OPENIMAGEIO_IMATH_TARGETS} ++ fmt::fmt + PRIVATE +- $ +- $ ++ Boost::filesystem Boost::thread Boost::system + $ + ${CMAKE_DL_LIBS} + ) +diff --git a/src/ptex.imageio/CMakeLists.txt b/src/ptex.imageio/CMakeLists.txt +index d7f0a9582..7cfce4a35 100644 +--- a/src/ptex.imageio/CMakeLists.txt ++++ b/src/ptex.imageio/CMakeLists.txt +@@ -2,8 +2,9 @@ + # SPDX-License-Identifier: BSD-3-Clause + # https://github.com/OpenImageIO/oiio + +-if (Ptex_FOUND) ++if (ptex_FOUND) + add_oiio_plugin (ptexinput.cpp +- LINK_LIBRARIES Ptex::Ptex_dynamic ZLIB::ZLIB ++ LINK_LIBRARIES ${ptex_LIBRARIES} ZLIB::ZLIB ++ INCLUDE_DIRS ${ptex_INCLUDE_DIRS} + DEFINITIONS "-DUSE_PTEX") + endif () diff --git a/recipes/openimageio/all/patches/2.4.7.1-fix-msvc2017.patch b/recipes/openimageio/all/patches/2.4.7.1-fix-msvc2017.patch new file mode 100644 index 0000000000000..19c8bb0f493d9 --- /dev/null +++ b/recipes/openimageio/all/patches/2.4.7.1-fix-msvc2017.patch @@ -0,0 +1,23 @@ +diff --git a/src/libutil/strutil.cpp b/src/libutil/strutil.cpp +index 213b1c0bf..24670fe8f 100644 +--- a/src/libutil/strutil.cpp ++++ b/src/libutil/strutil.cpp +@@ -921,9 +921,17 @@ Strutil::utf16_to_utf8(const std::u16string& str) noexcept + try { + OIIO_PRAGMA_WARNING_PUSH + OIIO_CLANG_PRAGMA(GCC diagnostic ignored "-Wdeprecated-declarations") ++ // https://stackoverflow.com/a/35103224 ++#if defined _MSC_VER && _MSC_VER >= 1900 && _MSC_VER < 1930 ++ std::wstring_convert, int16_t> convert; ++ auto p = reinterpret_cast(str.data()); ++ OIIO_PRAGMA_WARNING_POP ++ return convert.to_bytes(p, p + str.size()); ++#else + std::wstring_convert, char16_t> conv; + OIIO_PRAGMA_WARNING_POP + return conv.to_bytes(str); ++#endif + } catch (const std::exception&) { + return std::string(); + } + diff --git a/recipes/openimageio/all/patches/2.5.14.0-cmake-targets.patch b/recipes/openimageio/all/patches/2.5.14.0-cmake-targets.patch new file mode 100644 index 0000000000000..859c8562899a5 --- /dev/null +++ b/recipes/openimageio/all/patches/2.5.14.0-cmake-targets.patch @@ -0,0 +1,521 @@ +diff --git CMakeLists.txt CMakeLists.txt +index 3ff009229..d38941db0 100644 +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -154,7 +154,7 @@ endif () + add_definitions (-DOIIO_INTERNAL=1) + + list (APPEND CMAKE_MODULE_PATH +- "${PROJECT_SOURCE_DIR}/src/cmake/modules" ++ #"${PROJECT_SOURCE_DIR}/src/cmake/modules" + "${PROJECT_SOURCE_DIR}/src/cmake") + + include (GNUInstallDirs) +@@ -233,7 +233,7 @@ if (OIIO_BUILD_TOOLS AND NOT BUILD_OIIOUTIL_ONLY) + add_subdirectory (src/iinfo) + add_subdirectory (src/maketx) + add_subdirectory (src/oiiotool) +- add_subdirectory (src/testtex) ++ #add_subdirectory (src/testtex) + add_subdirectory (src/iv) + endif () + +diff --git src/cmake/externalpackages.cmake src/cmake/externalpackages.cmake +index fe581e723..ab2fbb7f5 100644 +--- src/cmake/externalpackages.cmake ++++ src/cmake/externalpackages.cmake +@@ -48,14 +48,14 @@ if (NOT DEFINED Boost_USE_STATIC_LIBS) + set (Boost_USE_STATIC_LIBS "${LINKSTATIC}") + endif () + +-if (MSVC) +- # Not linking Boost as static libraries: either an explicit setting or LINKSTATIC is FALSE: +- if (NOT Boost_USE_STATIC_LIBS) +- add_definitions (-DBOOST_ALL_DYN_LINK=1) +- endif () +-endif () +- +-set (Boost_COMPONENTS thread) ++#if (MSVC) ++# # Not linking Boost as static libraries: either an explicit setting or LINKSTATIC is FALSE: ++# if (NOT Boost_USE_STATIC_LIBS) ++# add_definitions (-DBOOST_ALL_DYN_LINK=1) ++# endif () ++#endif () ++ ++set (Boost_COMPONENTS filesystem system thread container) + if (NOT USE_STD_FILESYSTEM) + list (APPEND Boost_COMPONENTS filesystem) + endif () +@@ -111,9 +111,9 @@ checked_find_package (OpenEXR REQUIRED + # building against Imath/OpenEXR 3.x when there is still a system-level + # install version of 2.x. + include_directories(BEFORE ${IMATH_INCLUDES} ${OPENEXR_INCLUDES}) +-if (MSVC AND NOT LINKSTATIC) +- add_definitions (-DOPENEXR_DLL) # Is this needed for new versions? +-endif () ++#if (MSVC AND NOT LINKSTATIC) ++# add_definitions (-DOPENEXR_DLL) # Is this needed for new versions? ++#endif () + if (OpenEXR_VERSION VERSION_GREATER_EQUAL 3.0) + set (OIIO_USING_IMATH 3) + else () +@@ -140,11 +140,15 @@ set (OPENIMAGEIO_CONFIG_DO_NOT_FIND_IMATH OFF CACHE BOOL + "Exclude find_dependency(Imath) from the exported OpenImageIOConfig.cmake") + + # JPEG -- prefer JPEG-Turbo to regular libjpeg +-checked_find_package (libjpeg-turbo +- VERSION_MIN 2.1 +- DEFINITIONS -DUSE_JPEG_TURBO=1) +-if (NOT TARGET libjpeg-turbo::jpeg) # Try to find the non-turbo version ++if (USE_JPEGTURBO) ++ checked_find_package (libjpeg-turbo REQUIRED ++ DEFINITIONS -DUSE_JPEG_TURBO=1 ++ PRINT libjpeg-turbo_INCLUDES libjpeg-turbo_LIBRARIES) ++ add_library(JPEG::JPEG ALIAS libjpeg-turbo::libjpeg-turbo) ++elseif (USE_JPEG) # Try to find the non-turbo version + checked_find_package (JPEG REQUIRED) ++else () ++ message(FATAL_ERROR "JPEG library was not found!") + endif () + + # Pugixml setup. Normally we just use the version bundled with oiio, but +@@ -160,7 +164,7 @@ else () + endif() + + # From pythonutils.cmake +-find_python() ++#find_python() + if (USE_PYTHON) + checked_find_package (pybind11 REQUIRED VERSION_MIN 2.4.2) + endif () +@@ -170,111 +174,107 @@ endif () + # Dependencies for optional formats and features. If these are not found, + # we will continue building, but the related functionality will be disabled. + +-checked_find_package (PNG) ++if (USE_LIBPNG) ++ checked_find_package (PNG REQUIRED) ++endif() + +-checked_find_package (BZip2) # Used by ffmpeg and freetype +-if (NOT BZIP2_FOUND) +- set (BZIP2_LIBRARIES "") # TODO: why does it break without this? +-endif () ++if (USE_FREETYPE) ++ checked_find_package (Freetype REQUIRED ++ DEFINITIONS -DUSE_FREETYPE=1 ) ++endif() + +-checked_find_package (Freetype +- DEFINITIONS -DUSE_FREETYPE=1 ) +- +-checked_find_package (OpenColorIO +- DEFINITIONS -DUSE_OCIO=1 -DUSE_OPENCOLORIO=1 +- # PREFER_CONFIG +- ) +-if (OpenColorIO_FOUND) +- option (OIIO_DISABLE_BUILTIN_OCIO_CONFIGS +- "For deveoper debugging/testing ONLY! Disable OCIO 2.2 builtin configs." OFF) +- if (OIIO_DISABLE_BUILTIN_OCIO_CONFIGS OR "$ENV{OIIO_DISABLE_BUILTIN_OCIO_CONFIGS}") +- add_compile_definitions(OIIO_DISABLE_BUILTIN_OCIO_CONFIGS) +- endif () +-else () +- set (OpenColorIO_FOUND 0) ++if (USE_OPENCOLORIO) ++ checked_find_package (OpenColorIO REQUIRED ++ DEFINITIONS -DUSE_OCIO=1 -DUSE_OPENCOLORIO=1 ++ # PREFER_CONFIG ++ ) + endif () + +-checked_find_package (OpenCV 3.0 +- DEFINITIONS -DUSE_OPENCV=1) ++if (USE_OPENCV) ++ checked_find_package (OpenCV REQUIRED 3.0 ++ DEFINITIONS -DUSE_OPENCV=1) ++endif() + + # Intel TBB +-set (TBB_USE_DEBUG_BUILD OFF) +-checked_find_package (TBB 2017 +- SETVARIABLES OIIO_TBB +- PREFER_CONFIG) ++if (USE_TBB)# Intel TBB ++ set (TBB_USE_DEBUG_BUILD OFF) ++ checked_find_package (TBB 2017 REQUIRED ++ SETVARIABLES OIIO_TBB ++ PREFER_CONFIG) ++endif() + + # DCMTK is used to read DICOM images +-checked_find_package (DCMTK VERSION_MIN 3.6.1 +- PREFER_CONFIG) ++if (USE_DCMTK) ++ checked_find_package (DCMTK REQUIRED VERSION_MIN 3.6.1) # For DICOM images ++endif() + +-checked_find_package (FFmpeg VERSION_MIN 3.0) +-checked_find_package (GIF +- VERSION_MIN 4 +- RECOMMEND_MIN 5.0 +- RECOMMEND_MIN_REASON "for stability and thread safety") ++if (USE_FFMPEG) ++ checked_find_package (ffmpeg REQUIRED VERSION_MIN 3.0) ++endif() ++if (USE_GIF) ++ checked_find_package (GIF REQUIRED ++ VERSION_MIN 4 ++ RECOMMEND_MIN 5.0 ++ RECOMMEND_MIN_REASON "for stability and thread safety") ++endif() + + # For HEIF/HEIC/AVIF formats +-checked_find_package (Libheif VERSION_MIN 1.3 +- RECOMMEND_MIN 1.16 +- RECOMMEND_MIN_REASON "for orientation support") +-if (APPLE AND LIBHEIF_VERSION VERSION_GREATER_EQUAL 1.10 AND LIBHEIF_VERSION VERSION_LESS 1.11) +- message (WARNING "Libheif 1.10 on Apple is known to be broken, disabling libheif support") +- set (Libheif_FOUND 0) +-endif () ++if (USE_LIBHEIF) ++ checked_find_package (libheif REQUIRED VERSION_MIN 1.3 ++ RECOMMEND_MIN 1.7 ++ RECOMMEND_MIN_REASON "for AVIF support") ++endif() + +-checked_find_package (LibRaw +- VERSION_MIN 0.18 +- PRINT LibRaw_r_LIBRARIES) +-if (LibRaw_FOUND AND LibRaw_VERSION VERSION_LESS 0.20 AND CMAKE_CXX_STANDARD VERSION_GREATER_EQUAL 17) +- message (STATUS "${ColorYellow}WARNING When building for C++17, LibRaw should be 0.20 or higher (found ${LibRaw_VERSION}). You may get errors, depending on the compiler.${ColorReset}") +- # Currently, we issue the above warning and let them take their chances. +- # If we wish to disable the LibRaw<0.20/C++17 combination that may fail, +- # just uncomment the following two lines. +- # set (LibRaw_FOUND 0) +- # set (LIBRAW_FOUND 0) +-endif () ++if (USE_LIBRAW) ++ checked_find_package (LibRaw REQUIRED ++ RECOMMEND_MIN 0.18 ++ RECOMMEND_MIN_REASON "for ACES support and better camera metadata" ++ PRINT LibRaw_r_LIBRARIES) ++endif() + +-checked_find_package (OpenJPEG VERSION_MIN 2.0 +- RECOMMEND_MIN 2.2 +- RECOMMEND_MIN_REASON "for multithreading support") +-# Note: Recent OpenJPEG versions have exported cmake configs, but we don't +-# find them reliable at all, so we stick to our FindOpenJPEG.cmake module. +- +-checked_find_package (OpenVDB +- VERSION_MIN 5.0 +- DEPS TBB +- DEFINITIONS -DUSE_OPENVDB=1) +-if (OpenVDB_FOUND AND OpenVDB_VERSION VERSION_GREATER_EQUAL 10.1 AND CMAKE_CXX_STANDARD VERSION_LESS 17) +- message (WARNING "${ColorYellow}OpenVDB >= 10.1 (we found ${OpenVDB_VERSION}) can only be used when we build with C++17 or higher. Disabling OpenVDB support.${ColorReset}") +- set (OpenVDB_FOUND 0) +- add_compile_definitions(DISABLE_OPENVDB=1) +-endif () ++if (USE_OPENJPEG) ++ checked_find_package (OpenJPEG REQUIRED ++ VERSION_MIN 2.0 ++ RECOMMEND_MIN 2.2 ++ RECOMMEND_MIN_REASON "for multithreading support") ++ # Note: Recent OpenJPEG versions have exported cmake configs, but we don't ++ # find them reliable at all, so we stick to our FindOpenJPEG.cmake module. ++endif() + +-checked_find_package (Ptex PREFER_CONFIG) +-if (NOT Ptex_FOUND OR NOT Ptex_VERSION) +- # Fallback for inadequate Ptex exported configs. This will eventually +- # disappear when we can 100% trust Ptex's exports. +- unset (Ptex_FOUND) +- checked_find_package (Ptex) +-endif () ++if (USE_OPENVDB) ++ checked_find_package (OpenVDB REQUIRED ++ VERSION_MIN 5.0 ++ DEPS TBB ++ DEFINITIONS -DUSE_OPENVDB=1) ++ # Upstream contains a version check to ensure that CXX 17 or newer is used with ++ # OpenVDB >= 10.1. This is ensured by the conanfile for openvdb ++endif() + +-checked_find_package (WebP) +-# Note: When WebP 1.1 (released late 2019) is our minimum, we can use their +-# exported configs and remove our FindWebP.cmake module. ++if (USE_PTEX) ++ checked_find_package (ptex REQUIRED PREFER_CONFIG) ++endif() ++ ++if (USE_LIBWEBP) ++ checked_find_package (WebP REQUIRED) ++endif() + + option (USE_R3DSDK "Enable R3DSDK (RED camera) support" OFF) +-checked_find_package (R3DSDK NO_RECORD_NOTFOUND) # RED camera ++if (USE_R3DSDK) ++ checked_find_package (R3DSDK REQUIRED) # RED camera ++endif () + + set (NUKE_VERSION "7.0" CACHE STRING "Nuke version to target") +-checked_find_package (Nuke NO_RECORD_NOTFOUND) ++if (USE_NUKE) ++ checked_find_package (Nuke REQUIRED) ++endif () + + + # Qt -- used for iv + option (USE_QT "Use Qt if found" ON) +-if (USE_QT) +- checked_find_package (OpenGL) # used for iv ++if (USE_OPENGL) ++ checked_find_package (OpenGL REQUIRED) # used for iv + endif () +-if (USE_QT AND OPENGL_FOUND) ++if (USE_QT AND USE_OPENGL) + checked_find_package (Qt6 COMPONENTS Core Gui Widgets OpenGLWidgets) + if (NOT Qt6_FOUND) + checked_find_package (Qt5 COMPONENTS Core Gui Widgets OpenGL) +@@ -298,13 +298,13 @@ macro (find_or_download_robin_map) + # for an installed version. Still prefer a copy that seems to be + # locally installed in this tree. + if (NOT BUILD_ROBINMAP_FORCE) +- find_package (Robinmap QUIET) ++ find_package (tsl-robin-map REQUIRED) + endif () + # If an external copy wasn't found and we requested that missing + # packages be built, or we we are forcing a local copy to be built, then + # download and build it. + # Download the headers from github +- if ((BUILD_MISSING_ROBINMAP AND NOT ROBINMAP_FOUND) OR BUILD_ROBINMAP_FORCE) ++ if ((BUILD_MISSING_ROBINMAP AND NOT tsl-robin-map_FOUND) OR BUILD_ROBINMAP_FORCE) + message (STATUS "Downloading local Tessil/robin-map") + set (ROBINMAP_INSTALL_DIR "${PROJECT_SOURCE_DIR}/ext/robin-map") + set (ROBINMAP_GIT_REPOSITORY "https://github.com/Tessil/robin-map") +@@ -322,7 +322,7 @@ macro (find_or_download_robin_map) + endif () + set (ROBINMAP_INCLUDE_DIR "${ROBINMAP_INSTALL_DIR}/include") + endif () +- checked_find_package (Robinmap REQUIRED) ++ checked_find_package (tsl-robin-map REQUIRED) + endmacro() + + find_or_download_robin_map () +@@ -341,7 +341,7 @@ macro (find_or_download_fmt) + # for an installed version. Still prefer a copy that seems to be + # locally installed in this tree. + if (NOT BUILD_FMT_FORCE) +- find_package (fmt QUIET) ++ find_package (fmt REQUIRED) + endif () + # If an external copy wasn't found and we requested that missing + # packages be built, or we we are forcing a local copy to be built, then +@@ -376,7 +376,7 @@ macro (find_or_download_fmt) + set (fmt_VERSION "${FMT_VERSION_MAJOR}.${FMT_VERSION_MINOR}.${FMT_VERSION_PATCH}") + list (APPEND CFP_ALL_BUILD_DEPS_FOUND "${pkgname} ${${pkgname}_VERSION}") + else () +- get_target_property(FMT_INCLUDE_DIR fmt::fmt-header-only INTERFACE_INCLUDE_DIRECTORIES) ++ get_target_property(FMT_INCLUDE_DIR fmt::fmt INTERFACE_INCLUDE_DIRECTORIES) + set (OIIO_USING_FMT_LOCAL FALSE) + checked_find_package (fmt REQUIRED + VERSION_MIN 7.0) +diff --git src/ffmpeg.imageio/CMakeLists.txt src/ffmpeg.imageio/CMakeLists.txt +index 8e47a8443..900d23101 100644 +--- src/ffmpeg.imageio/CMakeLists.txt ++++ src/ffmpeg.imageio/CMakeLists.txt +@@ -2,7 +2,7 @@ + # SPDX-License-Identifier: Apache-2.0 + # https://github.com/AcademySoftwareFoundation/OpenImageIO + +-if (FFmpeg_FOUND) ++if (USE_FFMPEG) + if (LINKSTATIC) + set (_static_suffixes .lib .a) + set (_static_libraries_found 0) +@@ -26,11 +26,9 @@ if (FFmpeg_FOUND) + endif() + + add_oiio_plugin (ffmpeginput.cpp +- INCLUDE_DIRS ${FFMPEG_INCLUDES} +- LINK_LIBRARIES ${FFMPEG_LIBRARIES} +- ${BZIP2_LIBRARIES} ++ LINK_LIBRARIES ffmpeg::avcodec ffmpeg::avformat ffmpeg::swscale + DEFINITIONS "-DUSE_FFMPEG" +- "-DOIIO_FFMPEG_VERSION=\"${FFMPEG_VERSION}\"") ++ "-DOIIO_FFMPEG_VERSION=\"${ffmpeg_VERSION}\"") + else() + message (STATUS "FFmpeg not found: ffmpeg plugin will not be built") + endif() +diff --git src/heif.imageio/CMakeLists.txt src/heif.imageio/CMakeLists.txt +index 5b6c30a85..e5bc55ef1 100644 +--- src/heif.imageio/CMakeLists.txt ++++ src/heif.imageio/CMakeLists.txt +@@ -2,32 +2,31 @@ + # SPDX-License-Identifier: Apache-2.0 + # https://github.com/AcademySoftwareFoundation/OpenImageIO + +-if (Libheif_FOUND) +- if (LINKSTATIC) +- set (_static_suffixes .lib .a) +- set (_static_libraries_found 0) ++if (USE_LIBHEIF) ++ # if (LINKSTATIC) ++ # set (_static_suffixes .lib .a) ++ # set (_static_libraries_found 0) + +- foreach (_libeheif_library IN LISTS LIBHEIF_LIBRARIES) +- get_filename_component (_ext ${_libeheif_library} LAST_EXT) +- list (FIND _static_suffixes ${_ext} _index) +- if (${_index} GREATER -1) +- MATH (EXPR _static_libraries_found "${static_libraries_found}+1") +- endif() +- endforeach() ++ # foreach (_libeheif_library IN LISTS LIBHEIF_LIBRARIES) ++ # get_filename_component (_ext ${_libeheif_library} LAST_EXT) ++ # list (FIND _static_suffixes ${_ext} _index) ++ # if (${_index} GREATER -1) ++ # MATH (EXPR _static_libraries_found "${static_libraries_found}+1") ++ # endif() ++ # endforeach() + +- if (${_static_libraries_found} GREATER 0) +- message (STATUS "${ColorYellow}") +- message (STATUS "You are linking OpenImageIO against a static version of libheif, which is LGPL") +- message (STATUS "licensed. If you intend to redistribute this build of OpenImageIO, we recommend") +- message (STATUS "that you review the libheif license terms, or you may wish to switch to using a") +- message (STATUS "dynamically-linked libheif.") +- message ("${ColorReset}") +- endif() +- endif() ++ # if (${_static_libraries_found} GREATER 0) ++ # message (STATUS "${ColorYellow}") ++ # message (STATUS "You are linking OpenImageIO against a static version of libheif, which is LGPL") ++ # message (STATUS "licensed. If you intend to redistribute this build of OpenImageIO, we recommend") ++ # message (STATUS "that you review the libheif license terms, or you may wish to switch to using a") ++ # message (STATUS "dynamically-linked libheif.") ++ # message ("${ColorReset}") ++ # endif() ++ # endif() + + add_oiio_plugin (heifinput.cpp heifoutput.cpp +- INCLUDE_DIRS ${LIBHEIF_INCLUDES} +- LINK_LIBRARIES ${LIBHEIF_LIBRARIES} ++ LINK_LIBRARIES libheif::heif + DEFINITIONS "-DUSE_HEIF=1") + else () + message (WARNING "heif plugin will not be built") +diff --git src/include/CMakeLists.txt src/include/CMakeLists.txt +index 18b7632a3..c558c4780 100644 +--- src/include/CMakeLists.txt ++++ src/include/CMakeLists.txt +@@ -64,7 +64,8 @@ install (FILES ${detail_headers} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}/detail + COMPONENT developer) + +-if (INTERNALIZE_FMT OR OIIO_USING_FMT_LOCAL) ++if (0) # Don't try to copy fmt libraries to target install folder ++ set(FMT_INCLUDES "${fmt_INCLUDE_DIR}") + set (fmt_headers_base_names) + foreach (header_name core.h format-inl.h format.h ostream.h printf.h + std.h base.h chrono.h) +diff --git src/jpeg2000.imageio/CMakeLists.txt src/jpeg2000.imageio/CMakeLists.txt +index 560e8d486..24348fe66 100644 +--- src/jpeg2000.imageio/CMakeLists.txt ++++ src/jpeg2000.imageio/CMakeLists.txt +@@ -2,10 +2,9 @@ + # SPDX-License-Identifier: Apache-2.0 + # https://github.com/AcademySoftwareFoundation/OpenImageIO + +-if (OPENJPEG_FOUND) ++if (USE_OPENJPEG) + add_oiio_plugin (jpeg2000input.cpp jpeg2000output.cpp +- INCLUDE_DIRS ${OPENJPEG_INCLUDES} +- LINK_LIBRARIES ${OPENJPEG_LIBRARIES} ++ LINK_LIBRARIES openjp2 + DEFINITIONS "-DUSE_OPENJPEG") + else() + message (WARNING "Jpeg-2000 plugin will not be built") +diff --git src/libOpenImageIO/CMakeLists.txt src/libOpenImageIO/CMakeLists.txt +index aeb7b7f93..9a32e4cf2 100644 +--- src/libOpenImageIO/CMakeLists.txt ++++ src/libOpenImageIO/CMakeLists.txt +@@ -154,19 +154,27 @@ target_link_libraries (OpenImageIO + ${OPENIMAGEIO_IMATH_TARGETS} + PRIVATE + ${OPENIMAGEIO_OPENEXR_TARGETS} +- ${OpenCV_LIBRARIES} + ${format_plugin_libs} # Add all the target link libraries from the plugins + $ + $ + $ + $ +- $ + ${BZIP2_LIBRARIES} + ZLIB::ZLIB +- $ ++ tsl::robin_map ++ Boost::filesystem Boost::thread Boost::system Boost::container + ${CMAKE_DL_LIBS} + ) + ++if (USE_OPENCV) ++ target_link_libraries (OpenImageIO PRIVATE opencv::opencv_core ++ opencv::opencv_imgproc ++ opencv::opencv_videoio) ++endif () ++if (USE_FREETYPE) ++ target_link_libraries (OpenImageIO PRIVATE Freetype::Freetype) ++endif() ++ + if (WIN32) + target_link_libraries (OpenImageIO PRIVATE psapi) + endif() +diff --git src/libutil/CMakeLists.txt src/libutil/CMakeLists.txt +index f873b3eed..cf5d4e74c 100644 +--- src/libutil/CMakeLists.txt ++++ src/libutil/CMakeLists.txt +@@ -20,20 +20,13 @@ target_link_libraries (OpenImageIO_Util + ${GCC_ATOMIC_LIBRARIES} + ${OPENIMAGEIO_IMATH_DEPENDENCY_VISIBILITY} + ${OPENIMAGEIO_IMATH_TARGETS} ++ fmt::fmt + PRIVATE +- $ +- $ ++ Boost::filesystem Boost::thread Boost::system + $ + ${CMAKE_DL_LIBS} + ) + +-if (INTERNALIZE_FMT OR OIIO_USING_FMT_LOCAL) +- add_dependencies(OpenImageIO_Util fmt_internal_target) +-else () +- target_link_libraries (OpenImageIO_Util +- PUBLIC fmt::fmt-header-only) +-endif () +- + if (WIN32) + add_definitions(-DWIN32_LEAN_AND_MEAN -DNOMINMAX -DNOGDI -DVC_EXTRALEAN) + target_link_libraries (OpenImageIO_Util PRIVATE psapi) +diff --git src/ptex.imageio/CMakeLists.txt src/ptex.imageio/CMakeLists.txt +index 16634fedb..82060ac29 100644 +--- src/ptex.imageio/CMakeLists.txt ++++ src/ptex.imageio/CMakeLists.txt +@@ -2,12 +2,9 @@ + # SPDX-License-Identifier: Apache-2.0 + # https://github.com/AcademySoftwareFoundation/OpenImageIO + +-if (Ptex_FOUND) +- set(ptex_target Ptex::Ptex_dynamic) +- if (TARGET Ptex::Ptex_static AND (NOT TARGET Ptex::Ptex_dynamic OR LINKSTATIC)) +- set(ptex_target Ptex::Ptex_static) +- endif() ++if (USE_PTEX) + add_oiio_plugin (ptexinput.cpp +- LINK_LIBRARIES ${ptex_target} ZLIB::ZLIB ++ LINK_LIBRARIES ${ptex_LIBRARIES} ZLIB::ZLIB ++ INCLUDE_DIRS ${ptex_INCLUDE_DIRS} + DEFINITIONS "-DUSE_PTEX") + endif () diff --git a/recipes/openimageio/all/patches/2.5.17.0-cmake-targets.patch b/recipes/openimageio/all/patches/2.5.17.0-cmake-targets.patch new file mode 100644 index 0000000000000..4b94fb40e8398 --- /dev/null +++ b/recipes/openimageio/all/patches/2.5.17.0-cmake-targets.patch @@ -0,0 +1,540 @@ +diff --git CMakeLists.txt CMakeLists.txt +index d99dd79ac..bfda2778a 100644 +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -156,7 +156,7 @@ endif () + add_definitions (-DOIIO_INTERNAL=1) + + list (APPEND CMAKE_MODULE_PATH +- "${PROJECT_SOURCE_DIR}/src/cmake/modules" ++ #"${PROJECT_SOURCE_DIR}/src/cmake/modules" + "${PROJECT_SOURCE_DIR}/src/cmake") + + include (GNUInstallDirs) +@@ -235,7 +235,7 @@ if (OIIO_BUILD_TOOLS AND NOT BUILD_OIIOUTIL_ONLY) + add_subdirectory (src/iinfo) + add_subdirectory (src/maketx) + add_subdirectory (src/oiiotool) +- add_subdirectory (src/testtex) ++ #add_subdirectory (src/testtex) + add_subdirectory (src/iv) + endif () + +diff --git src/cmake/externalpackages.cmake src/cmake/externalpackages.cmake +index 6556cd2eb..b9c4cd958 100644 +--- src/cmake/externalpackages.cmake ++++ src/cmake/externalpackages.cmake +@@ -48,14 +48,15 @@ if (NOT DEFINED Boost_USE_STATIC_LIBS) + set (Boost_USE_STATIC_LIBS "${LINKSTATIC}") + endif () + +-if (MSVC) +- # Not linking Boost as static libraries: either an explicit setting or LINKSTATIC is FALSE: +- if (NOT Boost_USE_STATIC_LIBS) +- add_definitions (-DBOOST_ALL_DYN_LINK=1) +- endif () +-endif () ++# if (MSVC) ++# # Not linking Boost as static libraries: either an explicit setting or LINKSTATIC is FALSE: ++# if (NOT Boost_USE_STATIC_LIBS) ++# add_definitions (-DBOOST_ALL_DYN_LINK=1) ++# endif () ++# endif () + + set (Boost_COMPONENTS thread) ++# set (Boost_COMPONENTS filesystem system thread container) + if (NOT USE_STD_FILESYSTEM) + list (APPEND Boost_COMPONENTS filesystem) + endif () +@@ -111,9 +112,9 @@ checked_find_package (OpenEXR REQUIRED + # building against Imath/OpenEXR 3.x when there is still a system-level + # install version of 2.x. + include_directories(BEFORE ${IMATH_INCLUDES} ${OPENEXR_INCLUDES}) +-if (MSVC AND NOT LINKSTATIC) +- add_definitions (-DOPENEXR_DLL) # Is this needed for new versions? +-endif () ++# if (MSVC AND NOT LINKSTATIC) ++# add_definitions (-DOPENEXR_DLL) # Is this needed for new versions? ++# endif () + if (OpenEXR_VERSION VERSION_GREATER_EQUAL 3.0) + set (OIIO_USING_IMATH 3) + else () +@@ -140,17 +141,21 @@ set (OPENIMAGEIO_CONFIG_DO_NOT_FIND_IMATH OFF CACHE BOOL + "Exclude find_dependency(Imath) from the exported OpenImageIOConfig.cmake") + + # JPEG -- prefer JPEG-Turbo to regular libjpeg +-checked_find_package (libjpeg-turbo +- VERSION_MIN 2.1 +- DEFINITIONS -DUSE_JPEG_TURBO=1) +-if (NOT TARGET libjpeg-turbo::jpeg) # Try to find the non-turbo version ++if (USE_JPEGTURBO) ++ checked_find_package (libjpeg-turbo REQUIRED ++ DEFINITIONS -DUSE_JPEG_TURBO=1 ++ PRINT libjpeg-turbo_INCLUDES libjpeg-turbo_LIBRARIES) ++ add_library(JPEG::JPEG ALIAS libjpeg-turbo::libjpeg-turbo) ++elseif (USE_JPEG) # Try to find the non-turbo version + checked_find_package (JPEG REQUIRED) ++else () ++ message(FATAL_ERROR "JPEG library was not found!") + endif () + + # Pugixml setup. Normally we just use the version bundled with oiio, but + # some linux distros are quite particular about having separate packages so we + # allow this to be overridden to use the distro-provided package if desired. +-option (USE_EXTERNAL_PUGIXML "Use an externally built shared library version of the pugixml library" OFF) ++option (USE_EXTERNAL_PUGIXML "Use an externally built shared library version of the pugixml library" ON) + if (USE_EXTERNAL_PUGIXML) + checked_find_package (pugixml REQUIRED + VERSION_MIN 1.8 +@@ -160,7 +165,7 @@ else () + endif() + + # From pythonutils.cmake +-find_python() ++#find_python() + if (USE_PYTHON) + checked_find_package (pybind11 REQUIRED VERSION_MIN 2.4.2) + endif () +@@ -170,15 +175,21 @@ endif () + # Dependencies for optional formats and features. If these are not found, + # we will continue building, but the related functionality will be disabled. + +-checked_find_package (PNG) ++if (USE_LIBPNG) ++ checked_find_package (PNG REQUIRED) ++endif() + +-checked_find_package (Freetype +- DEFINITIONS -DUSE_FREETYPE=1 ) ++if (USE_FREETYPE) ++ checked_find_package (Freetype REQUIRED ++ DEFINITIONS -DUSE_FREETYPE=1 ) ++endif() + +-checked_find_package (OpenColorIO +- DEFINITIONS -DUSE_OCIO=1 -DUSE_OPENCOLORIO=1 +- # PREFER_CONFIG +- ) ++if (USE_OPENCOLORIO) ++ checked_find_package (OpenColorIO REQUIRED ++ DEFINITIONS -DUSE_OCIO=1 -DUSE_OPENCOLORIO=1 ++ # PREFER_CONFIG ++ ) ++endif() + if (OpenColorIO_FOUND) + option (OIIO_DISABLE_BUILTIN_OCIO_CONFIGS + "For deveoper debugging/testing ONLY! Disable OCIO 2.2 builtin configs." OFF) +@@ -189,79 +200,104 @@ else () + set (OpenColorIO_FOUND 0) + endif () + +-checked_find_package (OpenCV 3.0 +- DEFINITIONS -DUSE_OPENCV=1) ++if (USE_OPENCV) ++ checked_find_package (OpenCV REQUIRED 3.0 ++ DEFINITIONS -DUSE_OPENCV=1) ++endif() + + # Intel TBB +-set (TBB_USE_DEBUG_BUILD OFF) +-checked_find_package (TBB 2017 +- SETVARIABLES OIIO_TBB +- PREFER_CONFIG) ++if (USE_TBB) ++ set (TBB_USE_DEBUG_BUILD OFF) ++ checked_find_package (TBB 2017 REQUIRED ++ SETVARIABLES OIIO_TBB ++ PREFER_CONFIG) ++endif() + + # DCMTK is used to read DICOM images +-checked_find_package (DCMTK VERSION_MIN 3.6.1 +- PREFER_CONFIG) ++if (USE_DCMTK) ++ checked_find_package (DCMTK REQUIRED VERSION_MIN 3.6.1 ++ PREFER_CONFIG) ++endif() + +-checked_find_package (FFmpeg VERSION_MIN 3.0) +-checked_find_package (GIF +- VERSION_MIN 4 +- RECOMMEND_MIN 5.0 +- RECOMMEND_MIN_REASON "for stability and thread safety") ++if (USE_FFMPEG) ++ checked_find_package (ffmpeg REQUIRED VERSION_MIN 3.0) ++endif() ++if (USE_GIF) ++ checked_find_package (GIF REQUIRED ++ VERSION_MIN 4 ++ RECOMMEND_MIN 5.0 ++ RECOMMEND_MIN_REASON "for stability and thread safety") ++endif() + + # For HEIF/HEIC/AVIF formats +-checked_find_package (Libheif VERSION_MIN 1.3 +- RECOMMEND_MIN 1.16 +- RECOMMEND_MIN_REASON "for orientation support") +-if (APPLE AND LIBHEIF_VERSION VERSION_GREATER_EQUAL 1.10 AND LIBHEIF_VERSION VERSION_LESS 1.11) +- message (WARNING "Libheif 1.10 on Apple is known to be broken, disabling libheif support") +- set (Libheif_FOUND 0) ++if (USE_LIBHEIF) ++ checked_find_package (libheif REQUIRED VERSION_MIN 1.3 ++ RECOMMEND_MIN 1.16 ++ RECOMMEND_MIN_REASON "for orientation support") ++ #if (APPLE AND LIBHEIF_VERSION VERSION_GREATER_EQUAL 1.10 AND LIBHEIF_VERSION VERSION_LESS 1.11) ++ # message (WARNING "Libheif 1.10 on Apple is known to be broken, disabling libheif support") ++ # set (Libheif_FOUND 0) + endif () + +-checked_find_package (LibRaw +- VERSION_MIN 0.18 +- PRINT LibRaw_r_LIBRARIES) +-if (LibRaw_FOUND AND LibRaw_VERSION VERSION_LESS 0.20 AND CMAKE_CXX_STANDARD VERSION_GREATER_EQUAL 17) +- message (STATUS "${ColorYellow}WARNING When building for C++17, LibRaw should be 0.20 or higher (found ${LibRaw_VERSION}). You may get errors, depending on the compiler.${ColorReset}") +- # Currently, we issue the above warning and let them take their chances. +- # If we wish to disable the LibRaw<0.20/C++17 combination that may fail, +- # just uncomment the following two lines. +- # set (LibRaw_FOUND 0) +- # set (LIBRAW_FOUND 0) +-endif () ++if (USE_LIBRAW) ++ checked_find_package (LibRaw REQUIRED ++ VERSION_MIN 0.18 ++ PRINT LibRaw_r_LIBRARIES) ++endif() ++#if (LibRaw_FOUND AND LibRaw_VERSION VERSION_LESS 0.20 AND CMAKE_CXX_STANDARD VERSION_GREATER_EQUAL 17) ++# message (STATUS "${ColorYellow}WARNING When building for C++17, LibRaw should be 0.20 or higher (found ${LibRaw_VERSION}). You may get errors, depending on the compiler.${ColorReset}") ++# # Currently, we issue the above warning and let them take their chances. ++# # If we wish to disable the LibRaw<0.20/C++17 combination that may fail, ++# # just uncomment the following two lines. ++# # set (LibRaw_FOUND 0) ++# # set (LIBRAW_FOUND 0) ++#endif () ++ ++if (USE_OPENJPEG) ++ checked_find_package (OpenJPEG REQUIRED VERSION_MIN 2.0 ++ RECOMMEND_MIN 2.2 ++ RECOMMEND_MIN_REASON "for multithreading support") ++ # Note: Recent OpenJPEG versions have exported cmake configs, but we don't ++ # find them reliable at all, so we stick to our FindOpenJPEG.cmake module. ++endif() + +-checked_find_package (OpenJPEG VERSION_MIN 2.0 +- RECOMMEND_MIN 2.2 +- RECOMMEND_MIN_REASON "for multithreading support") +-# Note: Recent OpenJPEG versions have exported cmake configs, but we don't +-# find them reliable at all, so we stick to our FindOpenJPEG.cmake module. +- +-checked_find_package (OpenVDB +- VERSION_MIN 5.0 +- DEPS TBB +- DEFINITIONS -DUSE_OPENVDB=1) +-if (OpenVDB_FOUND AND OpenVDB_VERSION VERSION_GREATER_EQUAL 10.1 AND CMAKE_CXX_STANDARD VERSION_LESS 17) +- message (WARNING "${ColorYellow}OpenVDB >= 10.1 (we found ${OpenVDB_VERSION}) can only be used when we build with C++17 or higher. Disabling OpenVDB support.${ColorReset}") +- set (OpenVDB_FOUND 0) +- add_compile_definitions(DISABLE_OPENVDB=1) +-endif () ++if (USE_OPENVDB) ++ checked_find_package (OpenVDB REQUIRED ++ VERSION_MIN 5.0 ++ DEPS TBB ++ DEFINITIONS -DUSE_OPENVDB=1) ++ #if (OpenVDB_FOUND AND OpenVDB_VERSION VERSION_GREATER_EQUAL 10.1 AND CMAKE_CXX_STANDARD VERSION_LESS 17) ++ # message (WARNING "${ColorYellow}OpenVDB >= 10.1 (we found ${OpenVDB_VERSION}) can only be used when we build with C++17 or higher. Disabling OpenVDB support.${ColorReset}") ++ # set (OpenVDB_FOUND 0) ++ # add_compile_definitions(DISABLE_OPENVDB=1) ++ #endif () ++endif() + +-checked_find_package (Ptex PREFER_CONFIG) +-if (NOT Ptex_FOUND OR NOT Ptex_VERSION) +- # Fallback for inadequate Ptex exported configs. This will eventually +- # disappear when we can 100% trust Ptex's exports. +- unset (Ptex_FOUND) +- checked_find_package (Ptex) +-endif () ++if (USE_PTEX) ++ checked_find_package (ptex REQUIRED PREFER_CONFIG) ++ # if (NOT Ptex_FOUND OR NOT Ptex_VERSION) ++ # # Fallback for inadequate Ptex exported configs. This will eventually ++ # # disappear when we can 100% trust Ptex's exports. ++ # unset (Ptex_FOUND) ++ # checked_find_package (Ptex) ++ # endif () ++endif() + +-checked_find_package (WebP) +-# Note: When WebP 1.1 (released late 2019) is our minimum, we can use their +-# exported configs and remove our FindWebP.cmake module. ++if (USE_LIBWEBP) ++ checked_find_package (WebP REQUIRED) ++ # Note: When WebP 1.1 (released late 2019) is our minimum, we can use their ++ # exported configs and remove our FindWebP.cmake module. ++endif() + + option (USE_R3DSDK "Enable R3DSDK (RED camera) support" OFF) +-checked_find_package (R3DSDK NO_RECORD_NOTFOUND) # RED camera ++if (USE_R3DSDK) ++ checked_find_package (R3DSDK NO_RECORD_NOTFOUND) # RED camera ++endif() + + set (NUKE_VERSION "7.0" CACHE STRING "Nuke version to target") +-checked_find_package (Nuke NO_RECORD_NOTFOUND) ++if (USE_NUKE) ++ checked_find_package (Nuke NO_RECORD_NOTFOUND) ++endif() + + if (FFmpeg_FOUND OR FREETYPE_FOUND) + checked_find_package (BZip2) # Used by ffmpeg and freetype +@@ -273,8 +309,8 @@ endif() + + # Qt -- used for iv + option (USE_QT "Use Qt if found" ON) +-if (USE_QT) +- checked_find_package (OpenGL) # used for iv ++if (USE_OPENGL) ++ checked_find_package (OpenGL REQUIRED) # used for iv + endif () + if (USE_QT AND OPENGL_FOUND) + checked_find_package (Qt6 COMPONENTS Core Gui Widgets OpenGLWidgets) +@@ -300,13 +336,13 @@ macro (find_or_download_robin_map) + # for an installed version. Still prefer a copy that seems to be + # locally installed in this tree. + if (NOT BUILD_ROBINMAP_FORCE) +- find_package (Robinmap QUIET) ++ find_package (tsl-robin-map REQUIRED) + endif () + # If an external copy wasn't found and we requested that missing + # packages be built, or we we are forcing a local copy to be built, then + # download and build it. + # Download the headers from github +- if ((BUILD_MISSING_ROBINMAP AND NOT ROBINMAP_FOUND) OR BUILD_ROBINMAP_FORCE) ++ if ((BUILD_MISSING_ROBINMAP AND NOT tsl-robin-map_FOUND) OR BUILD_ROBINMAP_FORCE) + message (STATUS "Downloading local Tessil/robin-map") + set (ROBINMAP_INSTALL_DIR "${PROJECT_SOURCE_DIR}/ext/robin-map") + set (ROBINMAP_GIT_REPOSITORY "https://github.com/Tessil/robin-map") +@@ -324,7 +360,7 @@ macro (find_or_download_robin_map) + endif () + set (ROBINMAP_INCLUDE_DIR "${ROBINMAP_INSTALL_DIR}/include") + endif () +- checked_find_package (Robinmap REQUIRED) ++ checked_find_package (tsl-robin-map REQUIRED) + endmacro() + + find_or_download_robin_map () +@@ -343,7 +379,7 @@ macro (find_or_download_fmt) + # for an installed version. Still prefer a copy that seems to be + # locally installed in this tree. + if (NOT BUILD_FMT_FORCE) +- find_package (fmt QUIET) ++ find_package (fmt REQUIRED) + endif () + # If an external copy wasn't found and we requested that missing + # packages be built, or we we are forcing a local copy to be built, then +@@ -378,7 +414,7 @@ macro (find_or_download_fmt) + set (fmt_VERSION "${FMT_VERSION_MAJOR}.${FMT_VERSION_MINOR}.${FMT_VERSION_PATCH}") + list (APPEND CFP_ALL_BUILD_DEPS_FOUND "${pkgname} ${${pkgname}_VERSION}") + else () +- get_target_property(FMT_INCLUDE_DIR fmt::fmt-header-only INTERFACE_INCLUDE_DIRECTORIES) ++ get_target_property(FMT_INCLUDE_DIR fmt::fmt INTERFACE_INCLUDE_DIRECTORIES) + set (OIIO_USING_FMT_LOCAL FALSE) + checked_find_package (fmt REQUIRED + VERSION_MIN 7.0) +diff --git src/ffmpeg.imageio/CMakeLists.txt src/ffmpeg.imageio/CMakeLists.txt +index 8e47a8443..900d23101 100644 +--- src/ffmpeg.imageio/CMakeLists.txt ++++ src/ffmpeg.imageio/CMakeLists.txt +@@ -2,7 +2,7 @@ + # SPDX-License-Identifier: Apache-2.0 + # https://github.com/AcademySoftwareFoundation/OpenImageIO + +-if (FFmpeg_FOUND) ++if (USE_FFMPEG) + if (LINKSTATIC) + set (_static_suffixes .lib .a) + set (_static_libraries_found 0) +@@ -26,11 +26,9 @@ if (FFmpeg_FOUND) + endif() + + add_oiio_plugin (ffmpeginput.cpp +- INCLUDE_DIRS ${FFMPEG_INCLUDES} +- LINK_LIBRARIES ${FFMPEG_LIBRARIES} +- ${BZIP2_LIBRARIES} ++ LINK_LIBRARIES ffmpeg::avcodec ffmpeg::avformat ffmpeg::swscale + DEFINITIONS "-DUSE_FFMPEG" +- "-DOIIO_FFMPEG_VERSION=\"${FFMPEG_VERSION}\"") ++ "-DOIIO_FFMPEG_VERSION=\"${ffmpeg_VERSION}\"") + else() + message (STATUS "FFmpeg not found: ffmpeg plugin will not be built") + endif() +diff --git src/heif.imageio/CMakeLists.txt src/heif.imageio/CMakeLists.txt +index 5b6c30a85..e5bc55ef1 100644 +--- src/heif.imageio/CMakeLists.txt ++++ src/heif.imageio/CMakeLists.txt +@@ -2,32 +2,31 @@ + # SPDX-License-Identifier: Apache-2.0 + # https://github.com/AcademySoftwareFoundation/OpenImageIO + +-if (Libheif_FOUND) +- if (LINKSTATIC) +- set (_static_suffixes .lib .a) +- set (_static_libraries_found 0) ++if (USE_LIBHEIF) ++ # if (LINKSTATIC) ++ # set (_static_suffixes .lib .a) ++ # set (_static_libraries_found 0) + +- foreach (_libeheif_library IN LISTS LIBHEIF_LIBRARIES) +- get_filename_component (_ext ${_libeheif_library} LAST_EXT) +- list (FIND _static_suffixes ${_ext} _index) +- if (${_index} GREATER -1) +- MATH (EXPR _static_libraries_found "${static_libraries_found}+1") +- endif() +- endforeach() ++ # foreach (_libeheif_library IN LISTS LIBHEIF_LIBRARIES) ++ # get_filename_component (_ext ${_libeheif_library} LAST_EXT) ++ # list (FIND _static_suffixes ${_ext} _index) ++ # if (${_index} GREATER -1) ++ # MATH (EXPR _static_libraries_found "${static_libraries_found}+1") ++ # endif() ++ # endforeach() + +- if (${_static_libraries_found} GREATER 0) +- message (STATUS "${ColorYellow}") +- message (STATUS "You are linking OpenImageIO against a static version of libheif, which is LGPL") +- message (STATUS "licensed. If you intend to redistribute this build of OpenImageIO, we recommend") +- message (STATUS "that you review the libheif license terms, or you may wish to switch to using a") +- message (STATUS "dynamically-linked libheif.") +- message ("${ColorReset}") +- endif() +- endif() ++ # if (${_static_libraries_found} GREATER 0) ++ # message (STATUS "${ColorYellow}") ++ # message (STATUS "You are linking OpenImageIO against a static version of libheif, which is LGPL") ++ # message (STATUS "licensed. If you intend to redistribute this build of OpenImageIO, we recommend") ++ # message (STATUS "that you review the libheif license terms, or you may wish to switch to using a") ++ # message (STATUS "dynamically-linked libheif.") ++ # message ("${ColorReset}") ++ # endif() ++ # endif() + + add_oiio_plugin (heifinput.cpp heifoutput.cpp +- INCLUDE_DIRS ${LIBHEIF_INCLUDES} +- LINK_LIBRARIES ${LIBHEIF_LIBRARIES} ++ LINK_LIBRARIES libheif::heif + DEFINITIONS "-DUSE_HEIF=1") + else () + message (WARNING "heif plugin will not be built") +diff --git src/include/CMakeLists.txt src/include/CMakeLists.txt +index 18b7632a3..c558c4780 100644 +--- src/include/CMakeLists.txt ++++ src/include/CMakeLists.txt +@@ -64,7 +64,8 @@ install (FILES ${detail_headers} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}/detail + COMPONENT developer) + +-if (INTERNALIZE_FMT OR OIIO_USING_FMT_LOCAL) ++if (0) # Don't try to copy fmt libraries to target install folder ++ set(FMT_INCLUDES "${fmt_INCLUDE_DIR}") + set (fmt_headers_base_names) + foreach (header_name core.h format-inl.h format.h ostream.h printf.h + std.h base.h chrono.h) +diff --git src/jpeg2000.imageio/CMakeLists.txt src/jpeg2000.imageio/CMakeLists.txt +index 560e8d486..24348fe66 100644 +--- src/jpeg2000.imageio/CMakeLists.txt ++++ src/jpeg2000.imageio/CMakeLists.txt +@@ -2,10 +2,9 @@ + # SPDX-License-Identifier: Apache-2.0 + # https://github.com/AcademySoftwareFoundation/OpenImageIO + +-if (OPENJPEG_FOUND) ++if (USE_OPENJPEG) + add_oiio_plugin (jpeg2000input.cpp jpeg2000output.cpp +- INCLUDE_DIRS ${OPENJPEG_INCLUDES} +- LINK_LIBRARIES ${OPENJPEG_LIBRARIES} ++ LINK_LIBRARIES openjp2 + DEFINITIONS "-DUSE_OPENJPEG") + else() + message (WARNING "Jpeg-2000 plugin will not be built") +diff --git src/libOpenImageIO/CMakeLists.txt src/libOpenImageIO/CMakeLists.txt +index aeb7b7f93..9a32e4cf2 100644 +--- src/libOpenImageIO/CMakeLists.txt ++++ src/libOpenImageIO/CMakeLists.txt +@@ -154,19 +154,27 @@ target_link_libraries (OpenImageIO + ${OPENIMAGEIO_IMATH_TARGETS} + PRIVATE + ${OPENIMAGEIO_OPENEXR_TARGETS} +- ${OpenCV_LIBRARIES} + ${format_plugin_libs} # Add all the target link libraries from the plugins + $ + $ + $ + $ +- $ + ${BZIP2_LIBRARIES} + ZLIB::ZLIB +- $ ++ tsl::robin_map ++ Boost::filesystem Boost::thread Boost::system Boost::container + ${CMAKE_DL_LIBS} + ) + ++if (USE_OPENCV) ++ target_link_libraries (OpenImageIO PRIVATE opencv::opencv_core ++ opencv::opencv_imgproc ++ opencv::opencv_videoio) ++endif () ++if (USE_FREETYPE) ++ target_link_libraries (OpenImageIO PRIVATE Freetype::Freetype) ++endif() ++ + if (WIN32) + target_link_libraries (OpenImageIO PRIVATE psapi) + endif() +diff --git src/libutil/CMakeLists.txt src/libutil/CMakeLists.txt +index f873b3eed..cf5d4e74c 100644 +--- src/libutil/CMakeLists.txt ++++ src/libutil/CMakeLists.txt +@@ -20,20 +20,13 @@ target_link_libraries (OpenImageIO_Util + ${GCC_ATOMIC_LIBRARIES} + ${OPENIMAGEIO_IMATH_DEPENDENCY_VISIBILITY} + ${OPENIMAGEIO_IMATH_TARGETS} ++ fmt::fmt + PRIVATE +- $ +- $ ++ Boost::filesystem Boost::thread Boost::system + $ + ${CMAKE_DL_LIBS} + ) + +-if (INTERNALIZE_FMT OR OIIO_USING_FMT_LOCAL) +- add_dependencies(OpenImageIO_Util fmt_internal_target) +-else () +- target_link_libraries (OpenImageIO_Util +- PUBLIC fmt::fmt-header-only) +-endif () +- + if (WIN32) + add_definitions(-DWIN32_LEAN_AND_MEAN -DNOMINMAX -DNOGDI -DVC_EXTRALEAN) + target_link_libraries (OpenImageIO_Util PRIVATE psapi) +diff --git src/ptex.imageio/CMakeLists.txt src/ptex.imageio/CMakeLists.txt +index 16634fedb..82060ac29 100644 +--- src/ptex.imageio/CMakeLists.txt ++++ src/ptex.imageio/CMakeLists.txt +@@ -2,12 +2,9 @@ + # SPDX-License-Identifier: Apache-2.0 + # https://github.com/AcademySoftwareFoundation/OpenImageIO + +-if (Ptex_FOUND) +- set(ptex_target Ptex::Ptex_dynamic) +- if (TARGET Ptex::Ptex_static AND (NOT TARGET Ptex::Ptex_dynamic OR LINKSTATIC)) +- set(ptex_target Ptex::Ptex_static) +- endif() ++if (USE_PTEX) + add_oiio_plugin (ptexinput.cpp +- LINK_LIBRARIES ${ptex_target} ZLIB::ZLIB ++ LINK_LIBRARIES ${ptex_LIBRARIES} ZLIB::ZLIB ++ INCLUDE_DIRS ${ptex_INCLUDE_DIRS} + DEFINITIONS "-DUSE_PTEX") + endif () diff --git a/recipes/openimageio/all/test_package/CMakeLists.txt b/recipes/openimageio/all/test_package/CMakeLists.txt index 1644784331f87..2b80f5af75658 100644 --- a/recipes/openimageio/all/test_package/CMakeLists.txt +++ b/recipes/openimageio/all/test_package/CMakeLists.txt @@ -1,10 +1,11 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(OpenImageIO REQUIRED CONFIG) +find_package(fmt REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} OpenImageIO::OpenImageIO) +target_link_libraries(${PROJECT_NAME} PRIVATE OpenImageIO::OpenImageIO + OpenImageIO::OpenImageIO_Util + fmt::fmt) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/openimageio/all/test_package/conanfile.py b/recipes/openimageio/all/test_package/conanfile.py index d51573f42b4f7..f4262a197701c 100644 --- a/recipes/openimageio/all/test_package/conanfile.py +++ b/recipes/openimageio/all/test_package/conanfile.py @@ -1,18 +1,25 @@ -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): - version = tools.Version(self.deps_cpp_info["openimageio"].version) cmake = CMake(self) - cmake.definitions["CMAKE_CXX_STANDARD"] = 14 if version >= "2.3.0.0" else 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 not can_run(self): + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/openimageio/all/test_v1_package/CMakeLists.txt b/recipes/openimageio/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..4f7b705df9ba0 --- /dev/null +++ b/recipes/openimageio/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(OpenImageIO REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} OpenImageIO::OpenImageIO) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/openimageio/all/test_v1_package/conanfile.py b/recipes/openimageio/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..1bf1c7e26255d --- /dev/null +++ b/recipes/openimageio/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_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/openimageio/all/test_v1_package/test_package.cpp b/recipes/openimageio/all/test_v1_package/test_package.cpp new file mode 100644 index 0000000000000..e1594d38c661d --- /dev/null +++ b/recipes/openimageio/all/test_v1_package/test_package.cpp @@ -0,0 +1,9 @@ +#include + +int main() +{ + std::cout << "OpenImageIO " << OIIO_VERSION_STRING << "\n"; + + std::string formats = OIIO::get_string_attribute("format_list"); + std::cout << "Supported formats:\n" << formats << "\n"; +} diff --git a/recipes/openimageio/config.yml b/recipes/openimageio/config.yml index 59d34bbe6638c..3f4b84d6aa425 100644 --- a/recipes/openimageio/config.yml +++ b/recipes/openimageio/config.yml @@ -1,7 +1,13 @@ versions: - "2.2.7.0": + "2.4.7.1": folder: all - "2.2.18.0": + "2.4.17.0": folder: all - "2.3.7.2": + "2.5.14.0": + folder: all + "2.5.15.0": + folder: all + "2.5.16.0": + folder: all + "2.5.17.0": folder: all diff --git a/recipes/openjdk/all/conandata.yml b/recipes/openjdk/all/conandata.yml index 1f874e056684d..41ac854b16462 100644 --- a/recipes/openjdk/all/conandata.yml +++ b/recipes/openjdk/all/conandata.yml @@ -1,11 +1,59 @@ sources: + "21.0.2": + Windows: + url: "https://download.java.net/java/GA/jdk21.0.2/f2283984656d49d69e91c558476027ac/13/GPL/openjdk-21.0.2_windows-x64_bin.zip" + sha256: "b6c17e747ae78cdd6de4d7532b3164b277daee97c007d3eaa2b39cca99882664" + Linux_x86_64: + url: "https://download.java.net/java/GA/jdk21.0.2/f2283984656d49d69e91c558476027ac/12/GPL/openjdk-21.0.2_linux-x64_bin.tar.gz" + sha256: "960a708e76bffa0864e3e756e03314d56aa9dfb253b0803ae8a35eef2188f475" + Linux_armv8: + url: "https://download.java.net/java/GA/jdk21.0.2/f2283984656d49d69e91c558476027ac/12/GPL/openjdk-21.0.2_linux-aarch64_bin.tar.gz" + sha256: "0fcd2bdd32de146288635e05a362a24217baf669a3fa8e145ed09c6ad96a8c38" + Macos_x86_64: + url: "https://download.java.net/java/GA/jdk21.0.2/f2283984656d49d69e91c558476027ac/12/GPL/openjdk-21.0.2_macos-x64_bin.tar.gz" + sha256: "2830aa583a7f1e6ea2673ead18c12a2b1f85e9d5b8d69b116666014b14b81656" + Macos_armv8: + url: "https://download.java.net/java/GA/jdk21.0.2/f2283984656d49d69e91c558476027ac/12/GPL/openjdk-21.0.2_macos-aarch64_bin.tar.gz" + sha256: "997e0797f304a423149fd72284e9bcf7782c4a969fcb49ef05dfa7e5e6b6fbd6" + "21.0.1": + Windows: + url: "https://download.java.net/java/GA/jdk21.0.1/415e3f918a1f4062a0074a2794853d0d/12/GPL/openjdk-21.0.1_windows-x64_bin.zip" + sha256: "77ea464f4fa7cbcbffe0124af44707e8e5ad8c1ce2373f1d94a64d9b20ba0c69" + Linux_x86_64: + url: "https://download.java.net/java/GA/jdk21.0.1/415e3f918a1f4062a0074a2794853d0d/12/GPL/openjdk-21.0.1_linux-x64_bin.tar.gz" + sha256: "7e80146b2c3f719bf7f56992eb268ad466f8854d5d6ae11805784608e458343f" + Linux_armv8: + url: "https://download.java.net/java/GA/jdk21.0.1/415e3f918a1f4062a0074a2794853d0d/12/GPL/openjdk-21.0.1_linux-aarch64_bin.tar.gz" + sha256: "f5e4e4622756fafe05ac0105a8efefa1152c8aad085a2bbb9466df0721bf2ba4" + Macos_x86_64: + url: "https://download.java.net/java/GA/jdk21.0.1/415e3f918a1f4062a0074a2794853d0d/12/GPL/openjdk-21.0.1_macos-x64_bin.tar.gz" + sha256: "1ca6db9e6c09752f842eee6b86a2f7e51b76ae38e007e936b9382b4c3134e9ea" + Macos_armv8: + url: "https://download.java.net/java/GA/jdk21.0.1/415e3f918a1f4062a0074a2794853d0d/12/GPL/openjdk-21.0.1_macos-aarch64_bin.tar.gz" + sha256: "9760eaa019b6d214a06bd44a304f3700ac057d025000bdfb9739b61080969a96" + "19.0.2": + Windows: + url: "https://download.java.net/java/GA/jdk19.0.2/fdb695a9d9064ad6b064dc6df578380c/7/GPL/openjdk-19.0.2_windows-x64_bin.zip" + sha256: "9f70eba3f2631674a2d7d3aa01150d697f68be16ad76662ff948d7fe1b4985d8" + Linux_x86_64: + url: "https://download.java.net/java/GA/jdk19.0.2/fdb695a9d9064ad6b064dc6df578380c/7/GPL/openjdk-19.0.2_linux-x64_bin.tar.gz" + sha256: "34cf8d095cc071e9e10165f5c45023f96ec68397fdaabf6c64bfec1ffeee6198" + Linux_armv8: + url: "https://download.java.net/java/GA/jdk19.0.2/fdb695a9d9064ad6b064dc6df578380c/7/GPL/openjdk-19.0.2_linux-aarch64_bin.tar.gz" + sha256: "95728187b4b5607c49de751a209ecda6e04d9ed7cee603cf36f454239106527b" + Macos_x86_64: + url: "https://download.java.net/java/GA/jdk19.0.2/fdb695a9d9064ad6b064dc6df578380c/7/GPL/openjdk-19.0.2_macos-x64_bin.tar.gz" + sha256: "c57c7c511706738fff6540945e0159e97b8b328777e6460977dd64e00f4c2c0b" + Macos_armv8: + url: "https://download.java.net/java/GA/jdk19.0.2/fdb695a9d9064ad6b064dc6df578380c/7/GPL/openjdk-19.0.2_macos-aarch64_bin.tar.gz" + sha256: "4317442e14c5c2f4f698db0e41347df99d050a32137b2a02dfec28ed856577cc" "16.0.1": Windows: url: "https://download.java.net/java/GA/jdk16.0.1/7147401fd7354114ac51ef3e1328291f/9/GPL/openjdk-16.0.1_windows-x64_bin.zip" sha256: "733b45b09463c97133d70c2368f1b9505da58e88f2c8a84358dd4accfd06a7a4" - Linux: + Linux_x86_64: url: "https://download.java.net/java/GA/jdk16.0.1/7147401fd7354114ac51ef3e1328291f/9/GPL/openjdk-16.0.1_linux-x64_bin.tar.gz" sha256: "b1198ffffb7d26a3fdedc0fa599f60a0d12aa60da1714b56c1defbce95d8b235" - Macos: + Macos_x86_64: url: "https://download.java.net/java/GA/jdk16.0.1/7147401fd7354114ac51ef3e1328291f/9/GPL/openjdk-16.0.1_osx-x64_bin.tar.gz" sha256: "6098f839954439d4916444757c542c1b8778a32461706812d41cc8bbefce7f2f" diff --git a/recipes/openjdk/all/conanfile.py b/recipes/openjdk/all/conanfile.py index 3b3d7b50653c4..6e6220a975840 100644 --- a/recipes/openjdk/all/conanfile.py +++ b/recipes/openjdk/all/conanfile.py @@ -1,5 +1,6 @@ from conan import ConanFile from conan.tools.files import copy, get, symlinks +from conan.tools.scm import Version from conan.errors import ConanInvalidConfiguration import os @@ -8,59 +9,71 @@ class OpenJDK(ConanFile): name = "openjdk" + package_type = "application" url = "https://github.com/conan-io/conan-center-index/" description = "Java Development Kit builds, from Oracle" homepage = "https://jdk.java.net" - license = "GPL-2.0-with-classpath-exception" + license = "GPL-2.0-only WITH Classpath-exception-2.0", "GPL-2.0-only WITH OpenJDK-assembly-exception-1.0" topics = ("java", "jdk", "openjdk") settings = "os", "arch", "compiler", "build_type" - no_copy_source = True + upload_policy = "skip" + build_policy = "missing" def package_id(self): del self.info.settings.compiler del self.info.settings.build_type + def configure(self): + self.settings.rm_safe("os.version") + def validate(self): - if self.settings.arch != "x86_64": + if Version(self.version) < "19.0.2" and 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): - get(self, **self.conan_data["sources"][self.version][str(self.settings.os)], - destination=self.source_folder, strip_root=True) + key = self.settings.os + if self.settings.os in ["Macos", "Linux"]: + key = f"{self.settings.os}_{self.settings.arch}" + get(self, **self.conan_data["sources"][self.version][str(key)], + destination=self.build_folder, strip_root=True) def package(self): if self.settings.os == "Macos": - source_folder = os.path.join(self.source_folder, f"jdk-{self.version}.jdk", "Contents", "Home") + build_folder = os.path.join(self.build_folder, f"jdk-{self.version}.jdk", "Contents", "Home") else: - source_folder = self.source_folder - symlinks.remove_broken_symlinks(self, source_folder) + build_folder = self.build_folder + symlinks.remove_broken_symlinks(self, build_folder) copy(self, pattern="*", - src=os.path.join(source_folder, "bin"), + src=os.path.join(build_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"), + src=os.path.join(build_folder, "include"), dst=os.path.join(self.package_folder, "include")) copy(self, pattern="*", - src=os.path.join(source_folder, "lib"), + src=os.path.join(build_folder, "lib"), dst=os.path.join(self.package_folder, "lib")) copy(self, pattern="*", - src=os.path.join(source_folder, "jmods"), + src=os.path.join(build_folder, "jmods"), dst=os.path.join(self.package_folder, "lib", "jmods")) copy(self, pattern="*", - src=os.path.join(source_folder, "legal"), + src=os.path.join(build_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 copy(self, pattern="*", - src=os.path.join(source_folder, "conf"), + src=os.path.join(build_folder, "conf"), dst=os.path.join(self.package_folder, "conf")) def package_info(self): self.output.info(f"Creating JAVA_HOME environment variable with : {self.package_folder}") + + self.runenv_info.define_path("JAVA_HOME", self.package_folder) + self.buildenv_info.define_path("JAVA_HOME", self.package_folder) + + # TODO: remove `env_info` once the recipe is only compatible with Conan >= 2.0 self.env_info.JAVA_HOME = self.package_folder - 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 79aa1f6d3ba7f..b31a5c71da333 100644 --- a/recipes/openjdk/all/test_package/conanfile.py +++ b/recipes/openjdk/all/test_package/conanfile.py @@ -8,9 +8,11 @@ class TestPackage(ConanFile): test_type = "explicit" + settings = "os", "arch" + generators = "VirtualRunEnv" - def build_requirements(self): - self.build_requires(self.tested_reference_str) + def requirements(self): + self.requires(self.tested_reference_str) def build(self): pass # nothing to build, but tests should not warn @@ -18,8 +20,8 @@ def build(self): def test(self): if can_run(self): output = StringIO() - self.run("java --version", output=output, run_environment=True) - print(output.getvalue) + self.run("java --version", output, env="conanrun") + self.output.info(f"Java version output: {output.getvalue()}") version_info = output.getvalue() if "openjdk" in version_info: pass diff --git a/recipes/openjdk/config.yml b/recipes/openjdk/config.yml index 7fd63e870b786..c2d6c3ae88d91 100644 --- a/recipes/openjdk/config.yml +++ b/recipes/openjdk/config.yml @@ -1,3 +1,9 @@ versions: + "21.0.2": + folder: all + "21.0.1": + folder: all + "19.0.2": + folder: all "16.0.1": folder: all diff --git a/recipes/openjpeg/all/conandata.yml b/recipes/openjpeg/all/conandata.yml index 1770aef0faecd..a2bb2c3515805 100644 --- a/recipes/openjpeg/all/conandata.yml +++ b/recipes/openjpeg/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "2.5.2": + url: "https://github.com/uclouvain/openjpeg/archive/refs/tags/v2.5.2.tar.gz" + sha256: "90e3896fed910c376aaf79cdd98bdfdaf98c6472efd8e1debf0a854938cbda6a" + "2.5.1": + url: "https://github.com/uclouvain/openjpeg/archive/refs/tags/v2.5.1.tar.gz" + sha256: "c0b92dadd65e33b1cf94f39dd9157d5469846744c2e0afb8ca10961f51f61da6" "2.5.0": url: "https://github.com/uclouvain/openjpeg/archive/refs/tags/v2.5.0.tar.gz" sha256: "0333806d6adecc6f7a91243b2b839ff4d2053823634d4f6ed7a59bc87409122a" diff --git a/recipes/openjpeg/all/conanfile.py b/recipes/openjpeg/all/conanfile.py index bc86e099bf7bd..74542890fef4f 100644 --- a/recipes/openjpeg/all/conanfile.py +++ b/recipes/openjpeg/all/conanfile.py @@ -1,21 +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, rmdir, save +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, save, replace_in_file 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): name = "openjpeg" - url = "https://github.com/conan-io/conan-center-index" description = "OpenJPEG is an open-source JPEG 2000 codec written in C language." - topics = ("jpeg2000", "jp2", "openjpeg", "image", "multimedia", "format", "graphics") + license = "BSD-2-Clause" + url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/uclouvain/openjpeg" - license = "BSD 2-Clause" - + topics = ("jpeg2000", "jp2", "openjpeg", "image", "multimedia", "format", "graphics") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -29,8 +29,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 +37,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,12 +68,17 @@ 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): + def _patch_sources(self): apply_conandata_patches(self) + # The finite-math-only optimization has no effect and can cause linking errors + # when linked against glibc >= 2.31 + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "-ffast-math", "-ffast-math;-fno-finite-math-only") + + def build(self): + self._patch_sources() cmake = CMake(self) cmake.configure() cmake.build() @@ -91,13 +88,33 @@ def package(self): cmake = CMake(self) cmake.install() rmdir(self, os.path.join(self.package_folder, "lib", self._openjpeg_subdir)) - + rmdir(self, os.path.join(self.package_folder, "lib", "cmake", self._openjpeg_subdir)) + 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) + ) # 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), + os.path.join(self.package_folder, self._module_target_rel_path), {"openjp2": "OpenJPEG::OpenJPEG"} ) + def _create_cmake_module_variables(self, module_file): + content = textwrap.dedent(f"""\ + set(OPENJPEG_FOUND TRUE) + if(DEFINED OpenJPEG_INCLUDE_DIRS) + set(OPENJPEG_INCLUDE_DIRS ${{OpenJPEG_INCLUDE_DIRS}}) + endif() + if(DEFINED OpenJPEG_LIBRARIES) + set(OPENJPEG_LIBRARIES ${{OpenJPEG_LIBRARIES}}) + endif() + set(OPENJPEG_MAJOR_VERSION "{Version(self.version).major}") + set(OPENJPEG_MINOR_VERSION "{Version(self.version).minor}") + set(OPENJPEG_BUILD_VERSION "{Version(self.version).patch}") + set(OPENJPEG_BUILD_SHARED_LIBS {"TRUE" if self.options.shared else "FALSE"}) + """) + save(self, module_file, content) + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): @@ -110,7 +127,11 @@ def _create_cmake_module_alias_targets(self, module_file, targets): save(self, module_file, content) @property - def _module_file_rel_path(self): + def _module_vars_rel_path(self): + return os.path.join("lib", "cmake", f"conan-official-{self.name}-variables.cmake") + + @property + def _module_target_rel_path(self): return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") @property @@ -121,8 +142,10 @@ def _openjpeg_subdir(self): def package_info(self): self.cpp_info.set_property("cmake_file_name", "OpenJPEG") self.cpp_info.set_property("cmake_target_name", "openjp2") + self.cpp_info.set_property("cmake_build_modules", [self._module_vars_rel_path]) self.cpp_info.set_property("pkg_config_name", "libopenjp2") self.cpp_info.includedirs.append(os.path.join("include", self._openjpeg_subdir)) + self.cpp_info.builddirs.append(os.path.join("lib", "cmake")) self.cpp_info.libs = ["openjp2"] if self.settings.os == "Windows" and not self.options.shared: self.cpp_info.defines.append("OPJ_STATIC") @@ -134,6 +157,6 @@ def package_info(self): # TODO: to remove in conan v2 once cmake_find_package* & pkg_config generators removed self.cpp_info.names["cmake_find_package"] = "OpenJPEG" self.cpp_info.names["cmake_find_package_multi"] = "OpenJPEG" - 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.build_modules["cmake_find_package"] = [self._module_target_rel_path] + self.cpp_info.build_modules["cmake_find_package_multi"] = [self._module_target_rel_path] self.cpp_info.names["pkg_config"] = "libopenjp2" diff --git a/recipes/openjpeg/all/test_package/CMakeLists.txt b/recipes/openjpeg/all/test_package/CMakeLists.txt index eccda132e4efe..08c910c90a70d 100644 --- a/recipes/openjpeg/all/test_package/CMakeLists.txt +++ b/recipes/openjpeg/all/test_package/CMakeLists.txt @@ -5,3 +5,21 @@ find_package(OpenJPEG REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) target_link_libraries(${PROJECT_NAME} PRIVATE openjp2) + +# Test whether variables from https://github.com/uclouvain/openjpeg/blob/master/cmake/OpenJPEGConfig.cmake.in are properly defined +set(_custom_vars + OPENJPEG_FOUND + OPENJPEG_INCLUDE_DIRS + OPENJPEG_LIBRARIES + OPENJPEG_MAJOR_VERSION + OPENJPEG_MINOR_VERSION + OPENJPEG_BUILD_VERSION + OPENJPEG_BUILD_SHARED_LIBS +) +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/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 deleted file mode 100644 index 39ff9e0a1d38d..0000000000000 --- a/recipes/openjpeg/all/test_v1_package/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) - -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) diff --git a/recipes/openjpeg/config.yml b/recipes/openjpeg/config.yml index 2f39469175da4..b4e926204666d 100644 --- a/recipes/openjpeg/config.yml +++ b/recipes/openjpeg/config.yml @@ -1,4 +1,8 @@ versions: + "2.5.2": + folder: all + "2.5.1": + folder: all "2.5.0": folder: all "2.4.0": diff --git a/recipes/openjph/all/conandata.yml b/recipes/openjph/all/conandata.yml new file mode 100644 index 0000000000000..262763e046361 --- /dev/null +++ b/recipes/openjph/all/conandata.yml @@ -0,0 +1,23 @@ +sources: + "0.18.0": + url: "https://github.com/aous72/OpenJPH/archive/0.18.0.tar.gz" + sha256: "2484908bf5a171cda957643d9bc85c39d58ef939016e2d1a00122b1cefbbd4f8" + "0.17.0": + url: "https://github.com/aous72/OpenJPH/archive/0.17.0.tar.gz" + sha256: "9cd09a5f3a8046b10bded787212afd2410836f9c266964a36f61dc4b63f99b6c" + "0.16.0": + url: "https://github.com/aous72/OpenJPH/archive/0.16.0.tar.gz" + sha256: "94bea4d7057f7a5dcb3f8eee3f854955ce153d98dad99602dd0ba50a560d7cf6" +patches: + "0.18.0": + - patch_file: "patches/0.15.0_cmake-cxx-standard.patch" + patch_description: "Remove setting of CXX standard to a fixed value overriding the toolchain provided by Conan" + patch_type: "conan" + "0.17.0": + - patch_file: "patches/0.15.0_cmake-cxx-standard.patch" + patch_description: "Remove setting of CXX standard to a fixed value overriding the toolchain provided by Conan" + patch_type: "conan" + "0.16.0": + - patch_file: "patches/0.15.0_cmake-cxx-standard.patch" + patch_description: "Remove setting of CXX standard to a fixed value overriding the toolchain provided by Conan" + patch_type: "conan" diff --git a/recipes/openjph/all/conanfile.py b/recipes/openjph/all/conanfile.py new file mode 100644 index 0000000000000..e4c19d07b2f87 --- /dev/null +++ b/recipes/openjph/all/conanfile.py @@ -0,0 +1,120 @@ +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 OpenJPH(ConanFile): + name = "openjph" + description = "Open-source implementation of JPEG2000 Part-15 (or JPH or HTJ2K)" + license = "BSD-2-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/aous72/OpenJPH" + topics = ("ht-j2k", "jpeg2000", "jp2", "openjph", "image", "multimedia", "format", "graphics") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_executables": [True, False], + "with_tiff": [True, False], + "with_stream_expand_tool": [True, False], + "disable_simd": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_executables": True, + "with_tiff": True, + "with_stream_expand_tool": False, + "disable_simd": 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_executables and self.options.with_tiff: + self.requires("libtiff/4.6.0") + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + required_cpp_version = 11 + if self.options.with_stream_expand_tool: + required_conan_version = 14 + check_min_cppstd(self, required_cpp_version) + + if self.settings.compiler == "gcc" and \ + Version(self.settings.compiler.version) < "6.0": + raise ConanInvalidConfiguration(f"{self.ref} requires gcc >= 6.0") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["OJPH_BUILD_EXECUTABLES"] = self.options.with_executables + tc.variables["OJPH_ENABLE_TIFF_SUPPORT"] = self.options.with_tiff + tc.variables["OJPH_BUILD_STREAM_EXPAND"] = self.options.with_stream_expand_tool + tc.variables["OJPH_DISABLE_SIMD"] = self.options.disable_simd + + # Workaround for Conan 1 where the CXX standard version isn't set to a fallback to gnu98 happens + if not self.settings.get_safe("compiler.cppstd"): + tc.cache_variables["CMAKE_CXX_STANDARD"] = 14 if self.options.with_stream_expand_tool else 11 + + tc.generate() + + deps = CMakeDeps(self) + deps.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + + def build(self): + self._patch_sources() + + cm = CMake(self) + cm.configure() + cm.build() + + def package(self): + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + + cm = CMake(self) + cm.install() + + # Cleanup package own pkgconfig + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "openjph") + self.cpp_info.set_property("cmake_target_name", "openjph::openjph") + self.cpp_info.set_property("pkg_config_name", "openjph") + + version_suffix = "" + if is_msvc(self): + v = Version(self.version) + version_suffix = f".{v.major}.{v.minor}" + self.cpp_info.libs = ["openjph" + version_suffix] + + # TODO: to remove in conan v2 once cmake_find_package_* & pkg_config generators removed + self.cpp_info.names["cmake_find_package"] = "openjph" + self.cpp_info.names["cmake_find_package_multi"] = "openjph" + self.cpp_info.names["pkg_config"] = "openjph" diff --git a/recipes/openjph/all/patches/0.15.0_cmake-cxx-standard.patch b/recipes/openjph/all/patches/0.15.0_cmake-cxx-standard.patch new file mode 100644 index 0000000000000..336b23fc9542c --- /dev/null +++ b/recipes/openjph/all/patches/0.15.0_cmake-cxx-standard.patch @@ -0,0 +1,26 @@ +diff --git CMakeLists.txt CMakeLists.txt +index cfa70ea..7e761db 100644 +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -93,7 +93,7 @@ message(STATUS "Building ${CMAKE_BUILD_TYPE}") + + ## C++ version and flags + # C++14 is needed for gtest, otherwise, C++11 is sufficient for the library +-set(CMAKE_CXX_STANDARD 14) ++#set(CMAKE_CXX_STANDARD 14) + if (MSVC) + add_compile_definitions(_CRT_SECURE_NO_WARNINGS) + endif() +diff --git src/apps/ojph_stream_expand/CMakeLists.txt src/apps/ojph_stream_expand/CMakeLists.txt +index 5aea342..e21bdd9 100644 +--- src/apps/ojph_stream_expand/CMakeLists.txt ++++ src/apps/ojph_stream_expand/CMakeLists.txt +@@ -5,7 +5,7 @@ if (OJPH_BUILD_STREAM_EXPAND) + + include_directories(../common) + include_directories(../../core/common) +- set(CMAKE_CXX_STANDARD 14) ++ #set(CMAKE_CXX_STANDARD 14) + + file(GLOB OJPH_STREAM_EXPAND "*.cpp" "*.h") + file(GLOB OJPH_SOCKETS "../others/ojph_sockets.cpp") diff --git a/recipes/openjph/all/test_package/CMakeLists.txt b/recipes/openjph/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..f0b6210c6ae20 --- /dev/null +++ b/recipes/openjph/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.11) +project(test_package LANGUAGES CXX) + +find_package(openjph REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE openjph::openjph) diff --git a/recipes/openjph/all/test_package/conanfile.py b/recipes/openjph/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0a6bc68712d90 --- /dev/null +++ b/recipes/openjph/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/openjph/all/test_package/test_package.cpp b/recipes/openjph/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..8ea54e19b7552 --- /dev/null +++ b/recipes/openjph/all/test_package/test_package.cpp @@ -0,0 +1,13 @@ +#include +#include + +#include + + +int main() { + // Print the version number but also do an API call to check the library + std::cout << "OpenJPH Version: " << OPENJPH_VERSION_MAJOR << '.' << OPENJPH_VERSION_MINOR << '.' << OPENJPH_VERSION_PATCH << std::endl; + std::cout << "CPU Extension level: " << ojph::get_cpu_ext_level() << std::endl; + + return EXIT_SUCCESS; +} diff --git a/recipes/openjph/config.yml b/recipes/openjph/config.yml new file mode 100644 index 0000000000000..287a9ed3cd4bc --- /dev/null +++ b/recipes/openjph/config.yml @@ -0,0 +1,7 @@ +versions: + "0.18.0": + folder: all + "0.17.0": + folder: all + "0.16.0": + folder: all diff --git a/recipes/openldap/all/conandata.yml b/recipes/openldap/all/conandata.yml index 9fc035f4ad145..0b8d44649e6e8 100644 --- a/recipes/openldap/all/conandata.yml +++ b/recipes/openldap/all/conandata.yml @@ -1,8 +1,7 @@ sources: + "2.6.7": + url: "https://www.openldap.org/software/download/OpenLDAP/openldap-release/openldap-2.6.7.tgz" + sha256: "cd775f625c944ed78a3da18a03b03b08eea73c8aabc97b41bb336e9a10954930" "2.6.1": - url: https://www.openldap.org/software/download/OpenLDAP/openldap-release/openldap-2.6.1.tgz - sha256: 9d576ea6962d7db8a2e2808574e8c257c15aef55f403a1fb5a0faf35de70e6f3 -patches: - "2.6.1": - - base_path: source_subfolder - patch_file: patches/configure-2.6.1.patch + url: "https://www.openldap.org/software/download/OpenLDAP/openldap-release/openldap-2.6.1.tgz" + sha256: "9d576ea6962d7db8a2e2808574e8c257c15aef55f403a1fb5a0faf35de70e6f3" diff --git a/recipes/openldap/all/conanfile.py b/recipes/openldap/all/conanfile.py index 49a19895302e6..4992bb0b0e23f 100644 --- a/recipes/openldap/all/conanfile.py +++ b/recipes/openldap/all/conanfile.py @@ -1,110 +1,126 @@ import os -from conans import ConanFile, AutoToolsBuildEnvironment, tools -from conans.errors import ConanInvalidConfiguration -required_conan_version = ">=1.43.0" +import shutil + +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 chdir, copy, get, rm, rmdir, replace_in_file +from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain +from conan.tools.apple import is_apple_os, fix_apple_shared_install_name +from conan.tools.layout import basic_layout + +required_conan_version = ">=1.53.0" class OpenldapConan(ConanFile): name = "openldap" - description = "OpenLDAP C++ library" + description = "OpenLDAP C library" + license = "OLDAP-2.8" url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.openldap.org/" - license = "OLDAP-2.8" topics = ("ldap", "load-balancer", "directory-access") - exports_sources = ["patches/*"] - settings = settings = "os", "compiler", "build_type", "arch" + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], - "with_cyrus_sasl": [True, False] + "with_cyrus_sasl": [True, False], } default_options = { "shared": False, "fPIC": True, - "with_cyrus_sasl": True - + "with_cyrus_sasl": True, } - _autotools = None - _configure_vars = None - - @property - def _source_subfolder(self): - return "source_subfolder" def configure(self): 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], - strip_root=True, destination=self._source_subfolder) + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - self.requires("openssl/1.1.1q") + self.requires("openssl/[>=1.1 <4]") if self.options.with_cyrus_sasl: - self.requires("cyrus-sasl/2.1.27") + self.requires("cyrus-sasl/2.1.28") def validate(self): - if self.settings.os != "Linux": - raise ConanInvalidConfiguration( - f"{self.name} is only supported on Linux") - - def _configure_autotools(self): - if self._autotools: - return self._autotools - - def yes_no(v): return "yes" if v else "no" - self._autotools = AutoToolsBuildEnvironment(self) - configure_args = [ - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), + if self.settings.os not in ["Linux", "FreeBSD", "Macos"]: + raise ConanInvalidConfiguration(f"{self.name} is only supported on Unix platforms") + + def source(self): + 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") + + def yes_no(v): + return "yes" if v else "no" + + tc = AutotoolsToolchain(self) + tc.configure_args += [ "--with-cyrus_sasl={}".format(yes_no(self.options.with_cyrus_sasl)), - "--with-pic={}".format(yes_no(self.options.get_safe("fPIC", True))), "--without-fetch", "--with-tls=openssl", - "--enable-auditlog"] - self._configure_vars = self._autotools.vars - self._configure_vars["systemdsystemunitdir"] = os.path.join( - self.package_folder, "res") - - # Need to link to -pthread instead of -lpthread for gcc 8 shared=True - # on CI job. Otherwise, linking fails. - self._autotools.libs.remove("pthread") - self._configure_vars["LIBS"] = self._configure_vars["LIBS"].replace( - "-lpthread", "-pthread") - - self._autotools.configure( - args=configure_args, - configure_dir=self._source_subfolder, - vars=self._configure_vars) - return self._autotools + "--enable-auditlog", + "--libexecdir=${prefix}/bin", + f"systemdsystemunitdir={os.path.join(self.package_folder, 'res')}", + ] + if cross_building(self): + # When cross-building, yielding_select should be explicit: + # https://git.openldap.org/openldap/openldap/-/blob/OPENLDAP_REL_ENG_2_5/configure.ac#L1636 + tc.configure_args.append("--with-yielding_select=yes") + # Workaround: https://bugs.openldap.org/show_bug.cgi?id=9228 + tc.configure_args.append("ac_cv_func_memcmp_working=yes") + if is_apple_os(self): + # macOS Ventura does not have soelim, but mandoc_soelim + tc.make_args.append("SOELIM=soelim" if shutil.which("soelim") else "SOELIM=mandoc_soelim") + tc.generate() + tc = AutotoolsDeps(self) + tc.generate() + + def _patch_sources(self): + replace_in_file(self, os.path.join(self.source_folder, "configure"), + "WITH_SYSTEMD=no\nsystemdsystemunitdir=", "WITH_SYSTEMD=no") def build(self): - for patch in self.conan_data["patches"][self.version]: - tools.patch(**patch) - autotools = self._configure_autotools() - - autotools.make(vars=self._configure_vars) + self._patch_sources() + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.configure() + autotools.make() def package(self): - autotools = self._configure_autotools() - autotools.install(vars=self._configure_vars) - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("COPYRIGHT", dst="licenses", src=self._source_subfolder) - for folder in ["var", "share", "etc", "lib/pkgconfig", "res"]: - tools.rmdir(os.path.join(self.package_folder, folder)) - tools.remove_files_by_mask( - os.path.join( - self.package_folder, - "lib"), - "*.la") + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.install() + copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, "COPYRIGHT", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + rm(self, "*.la", self.package_folder, recursive=True) + fix_apple_shared_install_name(self) + for folder in ["var", "share", "etc", os.path.join("lib", "pkgconfig"), "home", "Users"]: + rmdir(self, os.path.join(self.package_folder, folder)) def package_info(self): - bin_path = os.path.join(self.package_folder, "bin") - self.env_info.PATH.append(bin_path) - self.output.info( - "Appending PATH environment variable: {}".format(bin_path)) + self.cpp_info.components["ldap"].set_property("pkg_config_name", "ldap") + self.cpp_info.components["ldap"].libs = ["ldap"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["ldap"].system_libs = ["pthread", "resolv"] + self.cpp_info.components["ldap"].requires = ["lber", "openssl::ssl", "openssl::crypto"] + if self.options.with_cyrus_sasl: + self.cpp_info.components["ldap"].requires.append("cyrus-sasl::cyrus-sasl") - self.cpp_info.libs = ["ldap", "lber"] + self.cpp_info.components["lber"].set_property("pkg_config_name", "lber") + self.cpp_info.components["lber"].libs = ["lber"] if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.system_libs = ["pthread"] + self.cpp_info.components["lber"].system_libs = ["pthread"] + + # TODO: to remove in conan v2 + bin_path = os.path.join(self.package_folder, "bin") + self.env_info.PATH.append(bin_path) diff --git a/recipes/openldap/all/patches/configure-2.6.1.patch b/recipes/openldap/all/patches/configure-2.6.1.patch deleted file mode 100644 index 9fb405dfefc10..0000000000000 --- a/recipes/openldap/all/patches/configure-2.6.1.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/configure b/configure -index 8521174..8ea6133 100755 ---- a/configure -+++ b/configure -@@ -22337,7 +22337,6 @@ $as_echo "$as_me: WARNING: Strong authentication not supported!" >&2;} - fi - - WITH_SYSTEMD=no --systemdsystemunitdir= - ol_link_systemd=no - if test $ol_enable_slapd == no && test $ol_enable_balancer != yes ; then - if test $ol_with_systemd != no ; then diff --git a/recipes/openldap/all/test_package/CMakeLists.txt b/recipes/openldap/all/test_package/CMakeLists.txt index fb813fde0a56b..c77039fd606a9 100644 --- a/recipes/openldap/all/test_package/CMakeLists.txt +++ b/recipes/openldap/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) -find_package(openldap CONFIG REQUIRED) -add_executable(${PROJECT_NAME} test_package.cpp) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) + +find_package(openldap REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) target_link_libraries(${PROJECT_NAME} openldap::openldap) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) diff --git a/recipes/openldap/all/test_package/conanfile.py b/recipes/openldap/all/test_package/conanfile.py index 49a3a66ea5bad..ef5d7042163ec 100644 --- a/recipes/openldap/all/test_package/conanfile.py +++ b/recipes/openldap/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/openldap/all/test_package/test_package.c b/recipes/openldap/all/test_package/test_package.c new file mode 100644 index 0000000000000..ca578bf88f1df --- /dev/null +++ b/recipes/openldap/all/test_package/test_package.c @@ -0,0 +1,84 @@ +/* ldapurl -- a tool for generating LDAP URLs */ +/* $OpenLDAP$ */ +/* This work is part of OpenLDAP Software . + * + * Copyright 2008-2021 The OpenLDAP Foundation. + * Portions Copyright 2008 Pierangelo Masarati, SysNet + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted only as authorized by the OpenLDAP + * Public License. + * + * A copy of this license is available in the file LICENSE in the + * top-level directory of the distribution or, alternatively, at + * . + */ +/* Portions Copyright (c) 1992-1996 Regents of the University of Michigan. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that this notice is preserved and that due credit is given + * to the University of Michigan at Ann Arbor. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. This + * software is provided ``as is'' without express or implied warranty. + */ +/* ACKNOWLEDGEMENTS: + * This work was originally developed by Pierangelo Masarati + * for inclusion in OpenLDAP software. + */ + +#include "openldap.h" + +#include +#include + +static int do_uri_create(LDAPURLDesc *lud) { + char *uri; + + if (lud->lud_scheme == NULL) { + lud->lud_scheme = "ldap"; + } + + if (lud->lud_port == -1) { + if (strcasecmp(lud->lud_scheme, "ldap") == 0) { + lud->lud_port = LDAP_PORT; + + } else if (strcasecmp(lud->lud_scheme, "ldaps") == 0) { + lud->lud_port = LDAPS_PORT; + + } else if (strcasecmp(lud->lud_scheme, "ldapi") == 0) { + lud->lud_port = 0; + + } else { + /* forgiving... */ + lud->lud_port = 0; + } + } + + if (lud->lud_scope == -1) { + lud->lud_scope = LDAP_SCOPE_DEFAULT; + } + + uri = ldap_url_desc2str(lud); + + if (uri == NULL) { + fprintf(stderr, "unable to generate URI\n"); + exit(EXIT_FAILURE); + } + + printf("%s\n", uri); + free(uri); + + return 0; +} + +int main() { + LDAPURLDesc lud = {0}; + + lud.lud_port = -1; + lud.lud_scope = -1; + + return do_uri_create(&lud); +} diff --git a/recipes/openldap/all/test_package/test_package.cpp b/recipes/openldap/all/test_package/test_package.cpp deleted file mode 100644 index ab1267d80b23a..0000000000000 --- a/recipes/openldap/all/test_package/test_package.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* ldapurl -- a tool for generating LDAP URLs */ -/* $OpenLDAP$ */ -/* This work is part of OpenLDAP Software . - * - * Copyright 2008-2021 The OpenLDAP Foundation. - * Portions Copyright 2008 Pierangelo Masarati, SysNet - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted only as authorized by the OpenLDAP - * Public License. - * - * A copy of this license is available in the file LICENSE in the - * top-level directory of the distribution or, alternatively, at - * . - */ -/* Portions Copyright (c) 1992-1996 Regents of the University of Michigan. - * All rights reserved. - * - * Redistribution and use in source and binary forms are permitted - * provided that this notice is preserved and that due credit is given - * to the University of Michigan at Ann Arbor. The name of the - * University may not be used to endorse or promote products derived - * from this software without specific prior written permission. This - * software is provided ``as is'' without express or implied warranty. - */ -/* ACKNOWLEDGEMENTS: - * This work was originally developed by Pierangelo Masarati - * for inclusion in OpenLDAP software. - */ - -#include -#include -#include "openldap.h" - -static int do_uri_create(LDAPURLDesc *lud) { - char *uri; - - if (lud->lud_scheme == NULL) { - lud->lud_scheme = "ldap"; - } - - if (lud->lud_port == -1) { - if (strcasecmp(lud->lud_scheme, "ldap") == 0) { - lud->lud_port = LDAP_PORT; - - } else if (strcasecmp(lud->lud_scheme, "ldaps") == 0) { - lud->lud_port = LDAPS_PORT; - - } else if (strcasecmp(lud->lud_scheme, "ldapi") == 0) { - lud->lud_port = 0; - - } else { - /* forgiving... */ - lud->lud_port = 0; - } - } - - if (lud->lud_scope == -1) { - lud->lud_scope = LDAP_SCOPE_DEFAULT; - } - - uri = ldap_url_desc2str(lud); - - if (uri == NULL) { - fprintf(stderr, "unable to generate URI\n"); - exit(EXIT_FAILURE); - } - - printf("%s\n", uri); - free(uri); - - return 0; -} - -int main() { - LDAPURLDesc lud = {0}; - - lud.lud_port = -1; - lud.lud_scope = -1; - - return do_uri_create(&lud); -} diff --git a/recipes/openldap/all/test_v1_package/CMakeLists.txt b/recipes/openldap/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/openldap/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/openldap/all/test_v1_package/conanfile.py b/recipes/openldap/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..49a3a66ea5bad --- /dev/null +++ b/recipes/openldap/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/openldap/config.yml b/recipes/openldap/config.yml index 36b28f1209ae7..7177bd469e00d 100644 --- a/recipes/openldap/config.yml +++ b/recipes/openldap/config.yml @@ -1,3 +1,5 @@ versions: + "2.6.7": + folder: all "2.6.1": folder: all diff --git a/recipes/openmesh/all/conandata.yml b/recipes/openmesh/all/conandata.yml index da3df78a47023..118a4fc6160df 100644 --- a/recipes/openmesh/all/conandata.yml +++ b/recipes/openmesh/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "11.0": + url: "https://www.graphics.rwth-aachen.de/media/openmesh_static/Releases/11.0/OpenMesh-11.0.0.tar.bz2" + sha256: "9d22e65bdd6a125ac2043350a019ec4346ea83922cafdf47e125a03c16f6fa07" + "10.0": + url: "https://www.graphics.rwth-aachen.de/media/openmesh_static/Releases/10.0/OpenMesh-10.0.0.tar.bz2" + sha256: "af22520a474bb6a3b355eb0867449c6b995126f97632d1ee5ff9c7ebd322fedb" "9.0": url: "https://www.graphics.rwth-aachen.de/media/openmesh_static/Releases/9.0/OpenMesh-9.0.tar.gz" sha256: "b9574c921482798ce75a8bf578345a84b928ca26ee759219d21b310e2db9d006" @@ -6,6 +12,13 @@ sources: url: "https://www.graphics.rwth-aachen.de/media/openmesh_static/Releases/8.1/OpenMesh-8.1.tar.gz" sha256: "0953777f483d47ea9fa00c329838443a7a09dde8be77bf7de188001cb9e768a7" patches: + "11.0": + - patch_file: "patches/cmake-install_9.0.patch" + "10.0": + - patch_file: "patches/cmake-install_9.0.patch" + - patch_file: "patches/restore-cxx11-compatibility.patch" + patch_description: "Revert a minor change that broke C++11 compatibility for libc++" + patch_type: "portability" "9.0": - patch_file: "patches/cmake-install_9.0.patch" "8.1": diff --git a/recipes/openmesh/all/conanfile.py b/recipes/openmesh/all/conanfile.py index 2b2d6c360f11c..0c47f08b1897f 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.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, 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], @@ -28,9 +29,12 @@ class OpenmeshConan(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": @@ -38,18 +42,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, self._min_cppstd) + 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,6 +60,8 @@ def generate(self): tc.variables["OPENMESH_BUILD_SHARED"] = self.options.shared tc.variables["BUILD_APPS"] = False tc.variables["OPENMESH_DOCS"] = False + if not valid_min_cppstd(self, self._min_cppstd): + tc.variables["CMAKE_CXX_STANDARD"] = self._min_cppstd tc.generate() def build(self): @@ -86,17 +91,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/patches/restore-cxx11-compatibility.patch b/recipes/openmesh/all/patches/restore-cxx11-compatibility.patch new file mode 100644 index 0000000000000..144df56809a27 --- /dev/null +++ b/recipes/openmesh/all/patches/restore-cxx11-compatibility.patch @@ -0,0 +1,17 @@ +Partial revert of https://gitlab.vci.rwth-aachen.de:9000/OpenMesh/OpenMesh/-/commit/998eec1390dcabbb502dc1ac1bc17cd09a16e343 +for compatibility with C++11. + +https://web.archive.org/web/20151001014443/http://en.cppreference.com/w/cpp/container/vector/emplace_back +"The specialization std::vector did not have emplace_back() member until C++14." + +--- src/OpenMesh/Core/Utils/Property.hh ++++ src/OpenMesh/Core/Utils/Property.hh +@@ -250,7 +250,7 @@ + virtual void reserve(size_t _n) override { data_.reserve(_n); } + virtual void resize(size_t _n) override { data_.resize(_n); } + virtual void clear() override { data_.clear(); vector_type().swap(data_); } +- virtual void push_back() override { data_.emplace_back(); } ++ virtual void push_back() override { data_.push_back(bool()); } + virtual void swap(size_t _i0, size_t _i1) override + { bool t(data_[_i0]); data_[_i0]=data_[_i1]; data_[_i1]=t; } + virtual void copy(size_t _i0, size_t _i1) override 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/openmesh/config.yml b/recipes/openmesh/config.yml index 6b3545daffc92..bc3b698019ee1 100644 --- a/recipes/openmesh/config.yml +++ b/recipes/openmesh/config.yml @@ -1,4 +1,8 @@ versions: + "11.0": + folder: all + "10.0": + folder: all "9.0": folder: all "8.1": diff --git a/recipes/openmpi/all/conandata.yml b/recipes/openmpi/all/conandata.yml index 4580e17ba76a3..7211bc311a719 100644 --- a/recipes/openmpi/all/conandata.yml +++ b/recipes/openmpi/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "4.1.6": + url: "https://download.open-mpi.org/release/open-mpi/v4.1/openmpi-4.1.6.tar.bz2" + sha256: "f740994485516deb63b5311af122c265179f5328a0d857a567b85db00b11e415" "4.1.0": - sha256: 73866fb77090819b6a8c85cb8539638d37d6877455825b74e289d647a39fd5b5 - url: https://download.open-mpi.org/release/open-mpi/v4.1/openmpi-4.1.0.tar.bz2 + url: "https://download.open-mpi.org/release/open-mpi/v4.1/openmpi-4.1.0.tar.bz2" + sha256: "73866fb77090819b6a8c85cb8539638d37d6877455825b74e289d647a39fd5b5" diff --git a/recipes/openmpi/all/conanfile.py b/recipes/openmpi/all/conanfile.py index 26cc0e027159c..785217bcba3dc 100644 --- a/recipes/openmpi/all/conanfile.py +++ b/recipes/openmpi/all/conanfile.py @@ -1,97 +1,259 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment -from conans.errors import ConanInvalidConfiguration import os -required_conan_version = ">=1.29.1" +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 VirtualRunEnv +from conan.tools.files import copy, get, rm, rmdir, save, replace_in_file +from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps +from conan.tools.layout import basic_layout +from conan.tools.microsoft import unix_path + +required_conan_version = ">=1.53.0" class OpenMPIConan(ConanFile): name = "openmpi" - homepage = "https://www.open-mpi.org" - url = "https://github.com/conan-io/conan-center-index" - topics = ("conan", "mpi", "openmpi") description = "A High Performance Message Passing Library" license = "BSD-3-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://www.open-mpi.org" + topics = ("mpi", "openmpi") + provides = "mpi" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], - "fortran": ["yes", "mpifh", "usempi", "usempi80", "no"] + "fortran": ["yes", "mpifh", "usempi", "usempi80", "no"], + "enable_cxx": [True, False], + "enable_cxx_exceptions": [True, False], + "with_verbs": [True, False], } default_options = { "shared": False, "fPIC": True, - "fortran": "no" + "fortran": "no", + "enable_cxx": False, + "enable_cxx_exceptions": False, + "with_verbs": False, } - _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") + if not self.options.enable_cxx: + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + del self.options.enable_cxx_exceptions + if is_apple_os(self): + # Unavailable due to dependency on libnl + del self.options.with_verbs + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + # OpenMPI public headers don't include anything besides stddef.h. + # transitive_headers=True is not needed for any dependencies. + self.requires("hwloc/2.10.0") + self.requires("zlib/[>=1.2.11 <2]") + if self.settings.os == "Linux": + self.requires("libnl/3.8.0") + if self.options.get_safe("with_verbs"): + self.requires("rdma-core/52.0") + + def validate(self): if self.settings.os == "Windows": + # Requires Cygwin or WSL raise ConanInvalidConfiguration("OpenMPI doesn't support Windows") - def requirements(self): - # FIXME : self.requires("libevent/2.1.12") - try to use libevent from conan - self.requires("zlib/1.2.11") + if self.version == "4.1.0" and is_apple_os(self) and self.settings.arch == "armv8": + # INFO: https://github.com/open-mpi/ompi/issues/8410 + raise ConanInvalidConfiguration(f"{self.ref} is not supported in Mac M1. Use a newer version.") 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_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self) - args = ["--disable-wrapper-rpath", "--disable-wrapper-runpath"] - if self.settings.build_type == "Debug": - args.append("--enable-debug") - if self.options.shared: - args.extend(["--enable-shared", "--disable-static"]) - else: - args.extend(["--enable-static", "--disable-shared"]) - args.append("--with-pic" if self.options.get_safe("fPIC", True) else "--without-pic") - args.append("--enable-mpi-fortran={}".format(str(self.options.fortran))) - args.append("--with-zlib={}".format(self.deps_cpp_info["zlib"].rootpath)) - args.append("--with-zlib-libdir={}".format(self.deps_cpp_info["zlib"].lib_paths[0])) - args.append("--datarootdir=${prefix}/res") - self._autotools.configure(args=args) - return self._autotools + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + def root(pkg): + return unix_path(self, self.dependencies[pkg].package_folder) + + def yes_no(v): + return "yes" if v else "no" + + tc = AutotoolsToolchain(self) + tc.configure_args += [ + f"--enable-mpi-fortran={self.options.fortran}", + f"--enable-mpi-cxx={yes_no(self.options.enable_cxx)}", + f"--enable-cxx-exceptions={yes_no(self.options.get_safe('enable_cxx_exceptions'))}", + f"--with-hwloc={root('hwloc')}", + f"--with-libnl={root('libnl') if not is_apple_os(self) else 'no'}", + f"--with-verbs={root('rdma-core') if self.options.get_safe('with_verbs') else 'no'}", + f"--with-zlib={root('zlib')}", + "--with-pic" if self.options.get_safe("fPIC", True) else "--without-pic", + "--disable-wrapper-rpath", + "--disable-wrapper-runpath", + "--exec-prefix=/", + "--datarootdir=${prefix}/res", + # Disable other external libraries explicitly + "--with-alps=no", # ALPS + "--with-cuda=no", # CUDA + "--with-fca=no", # FCA + "--with-gpfs=no", # Gpfs + "--with-hcoll=no", # hcoll + "--with-ime=no", # IME + "--with-lsf=no", # LSF + "--with-lustre=no", # Lustre + "--with-memkind=no", # memkind + "--with-moab=no", # Moab + "--with-mxm=no", # Mellanox MXM + "--with-ofi=no", # libfabric, TODO: enable once libfabric is available + "--with-pmi=no", # PMI + "--with-pmix=internal", # PMIx + "--with-portals4=no", # Portals4 + "--with-psm2=no", # PSM2 + "--with-psm=no", # PSM + "--with-pvfs2=no", # Pvfs2 + "--with-treematch=no", # TreeMatch + "--with-ucx=no", # UCX + "--with-valgrind=no", # Valgrind + "--with-x=no", # X11 + "--with-xpmem=no", # XPMEM + ] + if is_apple_os(self): + if self.settings.arch == "armv8": + tc.configure_args.append("--host=aarch64-apple-darwin") + tc.extra_ldflags.append("-arch arm64") + # macOS has no libnl + tc.configure_args.append("--enable-mca-no-build=reachable-netlink") + # libtool's libltdl is not really needed, OpenMPI provides its own equivalent. + # Not adding it as it fails to be detected by ./configure in some cases. + # https://github.com/open-mpi/ompi/blob/v4.1.6/opal/mca/dl/dl.h#L20-L25 + tc.configure_args.append("--with-libltdl=no") + tc.generate() + + deps = AutotoolsDeps(self) + deps.generate() + + # Needed for ./configure to find libhwloc.so and libibnetdisc.so + VirtualRunEnv(self).generate(scope="build") + + # TODO: might want to enable reproducible builds by setting + # $SOURCE_DATE_EPOCH, $USER and $HOSTNAME + + def _patch_sources(self): + # Not needed and fails with v5.0 due to additional Python dependencies + save(self, os.path.join(self.source_folder, "docs", "Makefile.in"), "all:\ninstall:\n") + # Workaround for trying to include VERSION from source dir due to a case-insensitive filesystem on macOS + # Based on https://github.com/macports/macports-ports/blob/22dded99ae76a287f04a9685bbc820ecaa397fea/science/openmpi/files/patch-configure.diff + replace_in_file(self, os.path.join(self.source_folder, "configure"), + "-I$(top_srcdir) ", "-idirafter$(top_srcdir) ") def build(self): - with tools.chdir(self._source_subfolder): - autotools = self._configure_autotools() - autotools.make() + self._patch_sources() + autotools = Autotools(self) + autotools.configure() + autotools.make() def package(self): - self.copy(pattern="LICENSE", src=self._source_subfolder, dst="licenses") - with tools.chdir(self._source_subfolder): - 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.rmdir(os.path.join(self.package_folder, "etc")) - 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")) + autotools = Autotools(self) + autotools.install() + 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, "res", "man")) + rm(self, "*.la", self.package_folder, recursive=True) + fix_apple_shared_install_name(self) def package_info(self): - self.cpp_info.libs = ['mpi', 'open-rte', 'open-pal'] + # Based on https://cmake.org/cmake/help/latest/module/FindMPI.html#variables-for-using-mpi + self.cpp_info.set_property("cmake_find_mode", "both") + self.cpp_info.set_property("cmake_file_name", "MPI") + # TODO: Use None when available as Conan feature. + self.cpp_info.set_property("pkg_config_name", "_ompi-do-not-use") + # TODO: export a .cmake module to correctly set all variables set by CMake's FindMPI.cmake + + requires = [ + "hwloc::hwloc", + "zlib::zlib", + ] if self.settings.os == "Linux": - self.cpp_info.system_libs = ["dl", "pthread", "rt", "util"] + requires.append("libnl::libnl") + if self.options.get_safe("with_verbs"): + requires.extend(["rdma-core::libibverbs", "rdma-core::librdmacm"]) + + # The components are modelled based on OpenMPI's pkg-config files - self.output.info("Creating MPI_HOME environment variable: {}".format(self.package_folder)) + # Run-time environment library + self.cpp_info.components["orte"].set_property("pkg_config_name", "orte") + self.cpp_info.components["orte"].libs = ["open-rte", "open-pal"] + self.cpp_info.components["orte"].includedirs.append(os.path.join("include", "openmpi")) + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["orte"].system_libs = ["dl", "pthread", "rt", "util"] + self.cpp_info.components["orte"].cflags = ["-pthread"] + if self.options.get_safe("enable_cxx_exceptions"): + self.cpp_info.components["orte"].cflags.append("-fexceptions") + self.cpp_info.components["orte"].requires = requires + + self.cpp_info.components["ompi"].set_property("pkg_config_name", "ompi") + self.cpp_info.components["ompi"].libs = ["mpi"] + self.cpp_info.components["ompi"].requires = ["orte"] + + self.cpp_info.components["ompi-c"].set_property("pkg_config_name", "ompi-c") + self.cpp_info.components["ompi-c"].set_property("cmake_target_name", "MPI::MPI_C") + self.cpp_info.components["ompi-c"].requires = ["ompi"] + + self.cpp_info.components["ompitrace"].set_property("pkg_config_name", "ompitrace") + self.cpp_info.components["ompitrace"].libs = ["ompitrace"] + self.cpp_info.components["ompitrace"].requires = ["ompi"] + + if self.options.enable_cxx: + self.cpp_info.components["ompi-cxx"].set_property("pkg_config_name", "ompi-cxx") + self.cpp_info.components["ompi-cxx"].set_property("cmake_target_name", "MPI::MPI_CXX") + self.cpp_info.components["ompi-cxx"].libs = ["mpi_cxx"] + self.cpp_info.components["ompi-cxx"].requires = ["ompi"] + + if self.options.fortran != "no": + self.cpp_info.components["ompi-fort"].set_property("pkg_config_name", "ompi-fort") + self.cpp_info.components["ompi-fort"].set_property("cmake_target_name", "MPI::MPI_Fortran") + self.cpp_info.components["ompi-fort"].libs = ["mpi_mpifh"] + self.cpp_info.components["ompi-fort"].requires = ["ompi"] + # Aliases + self.cpp_info.components["ompi-f77"].set_property("pkg_config_name", "ompi-f77") + self.cpp_info.components["ompi-f77"].requires = ["ompi-fort"] + self.cpp_info.components["ompi-f90"].set_property("pkg_config_name", "ompi-f90") + self.cpp_info.components["ompi-f90"].requires = ["ompi-fort"] + + bin_folder = os.path.join(self.package_folder, "bin") + # Prepend to PATH to avoid a conflict with system MPI + self.runenv_info.prepend_path("PATH", bin_folder) + self.runenv_info.define_path("MPI_BIN", bin_folder) + self.runenv_info.define_path("MPI_HOME", self.package_folder) + self.runenv_info.define_path("OPAL_PREFIX", self.package_folder) + self.runenv_info.define_path("OPAL_EXEC_PREFIX", self.package_folder) + self.runenv_info.define_path("OPAL_LIBDIR", os.path.join(self.package_folder, "lib")) + self.runenv_info.define_path("OPAL_DATADIR", os.path.join(self.package_folder, "res")) + self.runenv_info.define_path("OPAL_DATAROOTDIR", os.path.join(self.package_folder, "res")) + + # TODO: Legacy, to be removed on Conan 2.0 + self.env_info.PATH.append(bin_folder) + self.env_info.MPI_BIN = bin_folder self.env_info.MPI_HOME = self.package_folder - self.output.info("Creating OPAL_PREFIX environment variable: {}".format(self.package_folder)) self.env_info.OPAL_PREFIX = self.package_folder - mpi_bin = os.path.join(self.package_folder, 'bin') - self.output.info("Creating MPI_BIN environment variable: {}".format(mpi_bin)) - self.env_info.MPI_BIN = mpi_bin - self.output.info("Appending PATH environment variable: {}".format(mpi_bin)) - self.env_info.PATH.append(mpi_bin) + self.env_info.OPAL_EXEC_PREFIX = self.package_folder + self.env_info.OPAL_LIBDIR = os.path.join(self.package_folder, "lib") + self.env_info.OPAL_DATADIR = os.path.join(self.package_folder, "res") + self.env_info.OPAL_DATAROOTDIR = os.path.join(self.package_folder, "res") + + self.cpp_info.names["cmake_find_package"] = "MPI" + self.cpp_info.names["cmake_find_package_multi"] = "MPI" + self.cpp_info.components["ompi-c"].names["cmake_find_package"] = "MPI_C" + if self.options.enable_cxx: + self.cpp_info.components["ompi-cxx"].names["cmake_find_package"] = "MPI_CXX" + if self.options.fortran != "no": + self.cpp_info.components["ompi-fort"].names["cmake_find_package"] = "MPI_Fortran" diff --git a/recipes/openmpi/all/test_package/CMakeLists.txt b/recipes/openmpi/all/test_package/CMakeLists.txt index d61f3c4bef33a..a166065f8b662 100644 --- a/recipes/openmpi/all/test_package/CMakeLists.txt +++ b/recipes/openmpi/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ -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() +find_package(MPI REQUIRED CONFIG) -find_package(MPI REQUIRED) - -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 MPI::MPI_C) diff --git a/recipes/openmpi/all/test_package/conanfile.py b/recipes/openmpi/all/test_package/conanfile.py index c63b947b1cb95..09ff6fcc3cc71 100644 --- a/recipes/openmpi/all/test_package/conanfile.py +++ b/recipes/openmpi/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_layout, CMake + 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,7 +22,7 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - mpiexec = os.path.join(os.environ['MPI_BIN'], 'mpiexec') - command = '%s -mca plm_rsh_agent yes -np 2 %s' % (mpiexec, os.path.join("bin", "test_package")) - self.run(command, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + command = f"mpiexec -mca plm_rsh_agent yes {bin_path}" + self.run(command, env="conanrun") diff --git a/recipes/openmpi/all/test_package/test_package.c b/recipes/openmpi/all/test_package/test_package.c new file mode 100644 index 0000000000000..540ba2f9beacc --- /dev/null +++ b/recipes/openmpi/all/test_package/test_package.c @@ -0,0 +1,13 @@ +#include +#include + +#include + +int main(int argc, char* argv[]) +{ + char version[MPI_MAX_LIBRARY_VERSION_STRING] = {0}; + int len = 0; + MPI_Get_library_version(version, &len); + printf("MPI version: %s\n", version); + return EXIT_SUCCESS; +} diff --git a/recipes/openmpi/all/test_package/test_package.cpp b/recipes/openmpi/all/test_package/test_package.cpp deleted file mode 100644 index d6fa9065fdf2a..0000000000000 --- a/recipes/openmpi/all/test_package/test_package.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include -#include - -int main(int argc, char* argv[]) -{ - MPI_Init(&argc, &argv); - - int rank; - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - if (rank == 0) { - int value = 17; - int result = MPI_Send(&value, 1, MPI_INT, 1, 0, MPI_COMM_WORLD); - if (result == MPI_SUCCESS) - std::cout << "Rank 0 OK!" << std::endl; - } else if (rank == 1) { - int value; - int result = MPI_Recv(&value, 1, MPI_INT, 0, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE); - if (result == MPI_SUCCESS && value == 17) - std::cout << "Rank 1 OK!" << std::endl; - } - MPI_Finalize(); - return 0; -} diff --git a/recipes/openmpi/config.yml b/recipes/openmpi/config.yml index 702888c159594..b6ed9888d0176 100644 --- a/recipes/openmpi/config.yml +++ b/recipes/openmpi/config.yml @@ -1,3 +1,5 @@ versions: + "4.1.6": + folder: all "4.1.0": folder: all diff --git a/recipes/openmvg/all/conandata.yml b/recipes/openmvg/all/conandata.yml new file mode 100644 index 0000000000000..b120ff5ab6cb6 --- /dev/null +++ b/recipes/openmvg/all/conandata.yml @@ -0,0 +1,22 @@ +sources: + "2.0": + url: "https://github.com/openMVG/openMVG/archive/refs/tags/v2.0.tar.gz" + sha256: "950da7d6fc370cc99ad29092fd3b46196f782af2f905e475a7262ceb96170618" +patches: + "2.0": + - patch_file: "patches/2.0-0001-robust-dependencies.patch" + patch_description: "Robust discovery of dependencies" + patch_type: "conan" + - patch_file: "patches/2.0-0002-dont-force-c++11.patch" + patch_description: "Allow newer C++ standard than C++11" + patch_type: "conan" + - patch_file: "patches/2.0-0003-fix-non-x86.patch" + patch_description: "Fix build for non-x86 arch" + patch_type: "portability" + patch_source: "https://github.com/openMVG/openMVG/pull/1979" + - patch_file: "patches/2.0-0004-no-auto-simd-optimization.patch" + patch_description: "No fragile babysitting of optimization flags" + patch_type: "conan" + - patch_file: "patches/2.0-0005-msvc-bigobj.patch" + patch_description: "Add /bigobj for openMVG_multiview compilation" + patch_type: "portability" diff --git a/recipes/openmvg/all/conanfile.py b/recipes/openmvg/all/conanfile.py new file mode 100644 index 0000000000000..29978bb46c7d2 --- /dev/null +++ b/recipes/openmvg/all/conanfile.py @@ -0,0 +1,294 @@ +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, rename, rm, rmdir +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version +import glob +import os + +required_conan_version = ">=1.53.0" + + +class Openmvgconan(ConanFile): + name = "openmvg" + description = ( + "OpenMVG provides an end-to-end 3D reconstruction from images framework " + "compounded of libraries, binaries, and pipelines." + ) + license = "MPL-2.0" + topics = ("computer-vision", "geometry", "structure-from-motion", "sfm", + "multi-view-geometry", "photogrammetry", "3d-reconstruction") + homepage = "https://github.com/openMVG/openMVG" + 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_openmp": [True, False], + "with_avx": [False, "avx", "avx2"], + "programs": [True, False], + "with_jpeg": ["libjpeg", "libjpeg-turbo", "mozjpeg"] + } + default_options = { + "shared": False, + "fPIC": True, + "with_openmp": False, + "with_avx": False, + "programs": True, + "with_jpeg": "libjpeg" + } + + short_paths = True + + 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.with_avx + + 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("cereal/1.3.2", transitive_headers=True) + self.requires("ceres-solver/2.1.0") + self.requires("coin-clp/1.17.7") + self.requires("coin-lemon/1.3.1") + self.requires("coin-osi/0.108.7") + self.requires("coin-utils/2.11.9") + self.requires("eigen/3.4.0", transitive_headers=True) + self.requires("flann/1.9.2", transitive_headers=True, transitive_libs=True) + if self.options.with_jpeg == "libjpeg": + self.requires("libjpeg/9e") + elif self.options.with_jpeg == "libjpeg-turbo": + self.requires("libjpeg-turbo/3.0.0") + elif self.options.with_jpeg == "mozjpeg": + self.requires("mozjpeg/4.1.1") + self.requires("libpng/1.6.40") + self.requires("libtiff/4.5.1") + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, "11") + + if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "7": + raise ConanInvalidConfiguration( + f"{self.ref} can' be built by gcc < 7 due to usage of some ceres-solver templated code " + "which hits a bug in gcc < 7: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480" + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["OpenMVG_BUILD_SHARED"] = self.options.shared + tc.variables["OpenMVG_BUILD_TESTS"] = False + tc.variables["OpenMVG_BUILD_DOC"] = False + tc.variables["OpenMVG_BUILD_EXAMPLES"] = False + tc.variables["OpenMVG_BUILD_OPENGL_EXAMPLES"] = False + tc.variables["OpenMVG_BUILD_SOFTWARES"] = self.options.programs + tc.variables["OpenMVG_BUILD_GUI_SOFTWARES"] = False + tc.variables["OpenMVG_BUILD_COVERAGE"] = False + tc.variables["OpenMVG_USE_OPENMP"] = self.options.with_openmp + tc.variables["OpenMVG_USE_OPENCV"] = False + tc.variables["OpenMVG_USE_OCVSIFT"] = False + # OpenMVG expects these CMake variables to be set automatically by a custom OptimizeForArchitecture macro + # but this macro is fragile and broken in case of cross-build. Moreover it may lead to non-portable binaries. + # Therefore macro is disabled through patch and we allow users to decide whether they want specific avx + # optimization. + tc.variables["USE_SSE2"] = self.settings.arch in ["x86", "x86_64"] + tc.variables["USE_AVX"] = self.options.get_safe("with_avx") in ["avx", "avx2"] + tc.variables["USE_AVX2"] = self.options.get_safe("with_avx") == "avx2" + # Even though openmvg requires C++11, recent versions of cereal require C++14 + # and targets generated by CMakeDeps don't propagate compile features (yet?) + # see https://github.com/conan-io/conan/issues/10281 + if Version(self.dependencies["ceres-solver"].ref.version) >= "2.0.0" and not valid_min_cppstd(self, "14"): + tc.variables["CMAKE_CXX_STANDARD"] = "14" + + if self.settings.os == "Linux": + # Workaround for: https://github.com/conan-io/conan/issues/13560 + libdirs_host = [l for dependency in self.dependencies.host.values() for l in dependency.cpp_info.aggregated_components().libdirs] + tc.variables["CMAKE_BUILD_RPATH"] = ";".join(libdirs_host) + + tc.generate() + + deps = CMakeDeps(self) + deps.generate() + + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, "src")) + 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, "*.cmake", os.path.join(self.package_folder, "lib")) + rmdir(self, os.path.join(self.package_folder, "share", "openMVG", "cmake")) + rename(self, src=os.path.join(self.package_folder, "share"), dst=os.path.join(self.package_folder, "res")) + for dll_file in glob.glob(os.path.join(self.package_folder, "lib", "*.dll")): + rename(self, src=dll_file, dst=os.path.join(self.package_folder, "bin", os.path.basename(dll_file))) + + @property + def _openmvg_components(self): + def jpeg(): + if self.options.with_jpeg == "libjpeg": + return ["libjpeg::libjpeg"] + elif self.options.with_jpeg == "libjpeg-turbo": + return ["libjpeg-turbo::jpeg"] + elif self.options.with_jpeg == "mozjpeg": + return ["mozjpeg::libjpeg"] + + return { + "openmvg_camera": { + "target": "openMVG_camera", + "requires": ["openmvg_numeric", "cereal::cereal"], + }, + "openmvg_exif": { + "target": "openMVG_exif", + "libs": ["openMVG_exif"], + "requires": ["openmvg_easyexif"], + }, + "openmvg_features": { + "target": "openMVG_features", + "libs": ["openMVG_features"], + "requires": ["openmvg_fast", "openmvg_stlplus", "eigen::eigen", "cereal::cereal"], + }, + "openmvg_geodesy": { + "target": "openMVG_geodesy", + "requires": ["openmvg_numeric"], + }, + "openmvg_geometry": { + "target": "openMVG_geometry", + "libs": ["openMVG_geometry"], + "requires": ["openmvg_numeric", "openmvg_linearprogramming", "cereal::cereal"], + }, + "openmvg_graph": { + "target": "openMVG_graph", + "requires": ["coin-lemon::coin-lemon"], + }, + "openmvg_image": { + "target": "openMVG_image", + "libs": ["openMVG_image"], + "requires": ["openmvg_numeric", "libpng::libpng", "libtiff::libtiff"] + jpeg(), + }, + "openmvg_linearprogramming": { + "target": "openMVG_linearProgramming", + "libs": ["openMVG_linearProgramming"], + "requires": ["openmvg_numeric", "coin-clp::coin-clp", "coin-osi::coin-osi", "coin-utils::coin-utils"], + }, + "openmvg_linftycomputervision": { + "target": "openMVG_lInftyComputerVision", + "libs": ["openMVG_lInftyComputerVision"], + "requires": ["openmvg_linearprogramming", "openmvg_multiview"], + }, + "openmvg_matching": { + "target": "openMVG_matching", + "libs": ["openMVG_matching"], + "requires": ["openmvg_features", "openmvg_stlplus", "cereal::cereal", "flann::flann"], + "system_libs": [(self.settings.os in ["Linux", "FreeBSD"], ["pthread"])], + }, + "openmvg_kvld": { + "target": "openMVG_kvld", + "libs": ["openMVG_kvld"], + "requires": ["openmvg_features", "openmvg_image"], + }, + "openmvg_matching_image_collection": { + "target": "openMVG_matching_image_collection", + "libs": ["openMVG_matching_image_collection"], + "requires": ["openmvg_matching", "openmvg_multiview"], + }, + "openmvg_multiview": { + "target": "openMVG_multiview", + "libs": ["openMVG_multiview"], + "requires": ["openmvg_numeric", "openmvg_graph", "ceres-solver::ceres-solver"], + }, + "openmvg_numeric": { + "target": "openMVG_numeric", + "libs": ["openMVG_numeric"], + "requires": ["eigen::eigen"], + "defines": [(is_msvc(self), ["_USE_MATH_DEFINES"])], + }, + "openmvg_robust_estimation": { + "target": "openMVG_robust_estimation", + "libs": ["openMVG_robust_estimation"], + "requires": ["openmvg_numeric"], + }, + "openmvg_sfm": { + "target": "openMVG_sfm", + "libs": ["openMVG_sfm"], + "requires": [ + "openmvg_geometry", "openmvg_features", "openmvg_graph", "openmvg_matching", + "openmvg_multiview", "openmvg_image", "openmvg_linftycomputervision", + "openmvg_system", "openmvg_stlplus", "cereal::cereal", "ceres-solver::ceres-solver", + ], + }, + "openmvg_system": { + "target": "openMVG_system", + "libs": ["openMVG_system"], + "requires": ["openmvg_numeric"], + }, + # vendored libs + "openmvg_easyexif": { + "target": "openMVG_easyexif", + "libs": ["openMVG_easyexif"], + }, + "openmvg_fast": { + "target": "openMVG_fast", + "libs": ["openMVG_fast"], + }, + "openmvg_stlplus": { + "target": "openMVG_stlplus", + "libs": ["openMVG_stlplus"], + }, + "openmvg_vlsift": { + "target": "vlsift", + "libs": ["vlsift"], + }, + } + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "OpenMVG") + + for component, values in self._openmvg_components.items(): + target = values["target"] + libs = values.get("libs", []) + defines = [] + for _condition, _defines in values.get("defines", []): + if _condition: + defines.extend(_defines) + system_libs = [] + for _condition, _system_libs in values.get("system_libs", []): + if _condition: + system_libs.extend(_system_libs) + + self.cpp_info.components[component].set_property("cmake_target_name", f"OpenMVG::{target}") + if libs: + self.cpp_info.components[component].libs = libs + self.cpp_info.components[component].defines = defines + self.cpp_info.components[component].requires = values.get("requires", []) + self.cpp_info.components[component].system_libs = system_libs + self.cpp_info.components[component].resdirs = ["res"] + + # TODO: to remove in conan v2 + self.cpp_info.components[component].names["cmake_find_package"] = target + self.cpp_info.components[component].names["cmake_find_package_multi"] = target + + # TODO: to remove in conan v2 + self.cpp_info.names["cmake_find_package"] = "OpenMVG" + self.cpp_info.names["cmake_find_package_multi"] = "OpenMVG" + if self.options.programs: + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/openmvg/all/patches/2.0-0001-robust-dependencies.patch b/recipes/openmvg/all/patches/2.0-0001-robust-dependencies.patch new file mode 100644 index 0000000000000..73934a64c7993 --- /dev/null +++ b/recipes/openmvg/all/patches/2.0-0001-robust-dependencies.patch @@ -0,0 +1,198 @@ +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -98,7 +98,7 @@ endif() + # ============================================================================== + # Check that submodule have been initialized and updated + # ============================================================================== +-if (NOT EXISTS ${PROJECT_SOURCE_DIR}/dependencies/cereal/include) ++if (0) + message(FATAL_ERROR + "\n submodule(s) are missing, please update your repository:\n" + " > git submodule update -i\n") +@@ -193,12 +193,6 @@ if (OpenMVG_BUILD_OPENGL_EXAMPLES) + endif (OpenMVG_BUILD_OPENGL_EXAMPLES) + + # Dependencies install rules +-install( +- DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/dependencies/ +- DESTINATION include/openMVG_dependencies +- COMPONENT headers +- FILES_MATCHING PATTERN "*.hpp" PATTERN "*.h" +-) + + # ============================================================================== + # --END-- SUBMODULE CONFIGURATION +@@ -261,7 +255,7 @@ if (NOT Eigen3_FOUND) + set(OpenMVG_USE_INTERNAL_EIGEN ON) + find_package(Eigen QUIET) + else() +- set(EIGEN_INCLUDE_DIRS ${EIGEN3_INCLUDE_DIR}) ++ set(EIGEN_INCLUDE_DIRS ${Eigen3_INCLUDE_DIRS}) + endif() + + # ============================================================================== +@@ -288,12 +282,12 @@ endif() + # - internal by default (flann), + # - external if FLANN_INCLUDE_DIR_HINTS and a valid Flann setup is found + # ============================================================================== +-if (NOT DEFINED FLANN_INCLUDE_DIR_HINTS) ++if (0) + set(FLANN_INCLUDE_DIR_HINTS ${CMAKE_CURRENT_SOURCE_DIR}/third_party/flann/src/cpp) + set(OpenMVG_USE_INTERNAL_FLANN ON) + endif() +-find_package(Flann QUIET) +-if (NOT FLANN_FOUND OR OpenMVG_USE_INTERNAL_FLANN) ++find_package(Flann REQUIRED CONFIG) ++if (0) + set(FLANN_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/third_party/flann/src/cpp) + endif() + +@@ -303,14 +297,14 @@ endif() + # - internal by default (CoinUtils), + # - external if COINUTILS_INCLUDE_DIR_HINTS and a valid CoinUtils setup is found + # ============================================================================== +-if (NOT DEFINED COINUTILS_INCLUDE_DIR_HINTS) ++if (0) + set(COINUTILS_INCLUDE_DIR_HINTS ${CMAKE_CURRENT_SOURCE_DIR}/dependencies/osi_clp/CoinUtils/src/) + set(OpenMVG_USE_INTERNAL_COINUTILS ON) + find_package(CoinUtils QUIET) + set(COINUTILS_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/dependencies/osi_clp/CoinUtils/src/) + set(COINUTILS_LIBRARY lib_CoinUtils) + else() +- find_package(CoinUtils QUIET) ++ find_package(coin-utils REQUIRED CONFIG) + endif() + + ## ============================================================================== +@@ -319,7 +313,7 @@ endif() + ## - internal by default (Clp), + ## - external if CLP_INCLUDE_DIR_HINTS and a valid Clp setup is found + ## ============================================================================== +-if (NOT DEFINED CLP_INCLUDE_DIR_HINTS) ++if (0) + set(CLP_INCLUDE_DIR_HINTS ${CMAKE_CURRENT_SOURCE_DIR}/dependencies/osi_clp/Clp/src/) + set(OpenMVG_USE_INTERNAL_CLP ON) + find_package(Clp QUIET) +@@ -328,7 +322,7 @@ if (NOT DEFINED CLP_INCLUDE_DIR_HINTS) + ${CMAKE_CURRENT_SOURCE_DIR}/dependencies/osi_clp/Clp/src/OsiClp/) + set(CLP_LIBRARIES lib_clp lib_OsiClpSolver) + else() +- find_package(Clp QUIET) ++ find_package(coin-clp REQUIRED CONFIG) + endif() + + # ============================================================================== +@@ -337,14 +331,14 @@ endif() + # - internal by default (Osi), + # - external if OSI_INCLUDE_DIR_HINTS and a valid Osi setup is found + # ============================================================================== +-if (NOT DEFINED OSI_INCLUDE_DIR_HINTS) ++if (0) + set(OSI_INCLUDE_DIR_HINTS ${CMAKE_CURRENT_SOURCE_DIR}/dependencies/osi_clp/Osi/src/) + set(OpenMVG_USE_INTERNAL_OSI ON) + find_package(Osi QUIET) + set(OSI_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/dependencies/osi_clp/Osi/src/Osi/) + set(OSI_LIBRARY lib_Osi) + else() +- find_package(Osi QUIET) ++ find_package(coin-osi REQUIRED CONFIG) + endif() + + # ============================================================================== +@@ -364,11 +358,11 @@ endif() + # - internal by default (Lemon), + # - external if LEMON_INCLUDE_DIR_HINTS and a valid Lemon setup is found + # ============================================================================== +-if (NOT DEFINED LEMON_INCLUDE_DIR_HINTS) ++if (0) + set(LEMON_INCLUDE_DIR_HINTS ${CMAKE_CURRENT_SOURCE_DIR}/third_party/lemon) + set(OpenMVG_USE_INTERNAL_LEMON ON) + endif() +-find_package(Lemon QUIET) ++find_package(LEMON REQUIRED CONFIG) + if (NOT LEMON_FOUND OR OpenMVG_USE_INTERNAL_LEMON) + set(LEMON_INCLUDE_DIRS + ${CMAKE_CURRENT_SOURCE_DIR}/third_party/lemon +--- a/src/openMVG/graph/CMakeLists.txt ++++ b/src/openMVG/graph/CMakeLists.txt +@@ -1,7 +1,7 @@ + + add_library(openMVG_graph INTERFACE) + target_compile_features(openMVG_graph INTERFACE ${CXX11_FEATURES}) +-target_link_libraries(openMVG_graph INTERFACE ${LEMON_LIBRARY}) ++target_link_libraries(openMVG_graph INTERFACE LEMON::LEMON) + install(TARGETS openMVG_graph DESTINATION lib EXPORT openMVG-targets) + + UNIT_TEST(openMVG_graph connectedComponent "openMVG_testing;openMVG_graph") +--- a/src/openMVG/linearProgramming/CMakeLists.txt ++++ b/src/openMVG/linearProgramming/CMakeLists.txt +@@ -15,9 +15,9 @@ target_link_libraries(openMVG_linearProgramming + PUBLIC + openMVG_numeric + PRIVATE +- ${CLP_LIBRARIES} # clp + solver wrapper +- ${COINUTILS_LIBRARY} # container tools +- ${OSI_LIBRARY} # generic LP ++ coin-clp::coin-clp ++ coin-utils::coin-utils ++ coin-osi::coin-osi + ) + + target_include_directories(openMVG_linearProgramming +--- a/src/openMVG/matching/CMakeLists.txt ++++ b/src/openMVG/matching/CMakeLists.txt +@@ -40,7 +40,7 @@ target_link_libraries(openMVG_matching + if (NOT DEFINED OpenMVG_USE_INTERNAL_FLANN) + target_link_libraries(openMVG_matching + PUBLIC +- ${FLANN_LIBRARIES} ++ $,flann::flann_cpp,flann::flann_cpp_s> + ) + endif() + set_target_properties(openMVG_matching PROPERTIES SOVERSION ${OPENMVG_VERSION_MAJOR} VERSION "${OPENMVG_VERSION_MAJOR}.${OPENMVG_VERSION_MINOR}") +--- a/src/openMVG/multiview/CMakeLists.txt ++++ b/src/openMVG/multiview/CMakeLists.txt +@@ -29,9 +29,9 @@ target_link_libraries(openMVG_multiview + openMVG_numeric + ) + target_link_libraries(openMVG_multiview +- LINK_PRIVATE ++ PRIVATE + openMVG_graph +- ${CERES_LIBRARIES} ++ Ceres::ceres + ) + target_include_directories(openMVG_multiview + PRIVATE +--- a/src/openMVG/sfm/CMakeLists.txt ++++ b/src/openMVG/sfm/CMakeLists.txt +@@ -30,11 +30,11 @@ target_link_libraries(openMVG_sfm + ) + + target_link_libraries(openMVG_sfm +- LINK_PRIVATE ++ PRIVATE + openMVG_image + openMVG_lInftyComputerVision + openMVG_system +- ${CERES_LIBRARIES} ++ Ceres::ceres + ${STLPLUS_LIBRARY} + ) + target_include_directories(openMVG_sfm +--- a/src/software/SfM/CMakeLists.txt ++++ b/src/software/SfM/CMakeLists.txt +@@ -191,12 +191,9 @@ target_link_libraries(openMVG_main_FrustumFiltering + ) + + add_executable(openMVG_main_ComputeStructureFromKnownPoses main_ComputeStructureFromKnownPoses.cpp) +-target_include_directories(openMVG_main_ComputeStructureFromKnownPoses +- PRIVATE +- ${CERES_INCLUDE_DIRS} +-) + target_link_libraries(openMVG_main_ComputeStructureFromKnownPoses + PRIVATE ++ Ceres::ceres + openMVG_system + openMVG_features + openMVG_sfm diff --git a/recipes/openmvg/all/patches/2.0-0002-dont-force-c++11.patch b/recipes/openmvg/all/patches/2.0-0002-dont-force-c++11.patch new file mode 100644 index 0000000000000..5d41fe3f4a874 --- /dev/null +++ b/recipes/openmvg/all/patches/2.0-0002-dont-force-c++11.patch @@ -0,0 +1,18 @@ +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -120,6 +120,7 @@ endif () + # ============================================================================== + # Check C++11 support + # ============================================================================== ++if(0) + include(CXX11) + check_for_cxx11_compiler(CXX11_COMPILER) + # If a C++11 compiler is available, then set the appropriate flags +@@ -130,6 +131,7 @@ if (CXX11_COMPILER) + else (CXX11_COMPILER) + message(FATAL_ERROR "A CXX11 compiler is required.") + endif (CXX11_COMPILER) ++endif() + + # ============================================================================== + # OpenMP detection diff --git a/recipes/openmvg/all/patches/2.0-0003-fix-non-x86.patch b/recipes/openmvg/all/patches/2.0-0003-fix-non-x86.patch new file mode 100644 index 0000000000000..953666dfd9de8 --- /dev/null +++ b/recipes/openmvg/all/patches/2.0-0003-fix-non-x86.patch @@ -0,0 +1,12 @@ +--- a/src/openMVG/matching/metric_simd.hpp ++++ b/src/openMVG/matching/metric_simd.hpp +@@ -17,7 +17,9 @@ + #include + + #include ++#if defined(OPENMVG_USE_AVX2) || defined(OPENMVG_USE_AVX) + #include ++#endif + + namespace openMVG { + namespace matching { diff --git a/recipes/openmvg/all/patches/2.0-0004-no-auto-simd-optimization.patch b/recipes/openmvg/all/patches/2.0-0004-no-auto-simd-optimization.patch new file mode 100644 index 0000000000000..fe05cf48371c1 --- /dev/null +++ b/recipes/openmvg/all/patches/2.0-0004-no-auto-simd-optimization.patch @@ -0,0 +1,29 @@ +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -109,8 +109,24 @@ endif() + # ============================================================================== + set(CMAKE_MODULE_PATH + ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmakeFindModules) +-include(OptimizeForArchitecture) +-OptimizeForArchitecture() ++if(CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)|(i[0-9]86)|(amd64)|(AMD64)") ++ if(MSVC) ++ add_definitions("-D__SSE2__") ++ endif() ++ if(USE_AVX2) ++ if(MSVC) ++ add_compile_options("/arch:AVX2") ++ else() ++ add_compile_options("-mavx2") ++ endif() ++ elseif(USE_AVX) ++ if(MSVC) ++ add_compile_options("/arch:AVX") ++ else() ++ add_compile_options("-mavx") ++ endif() ++ endif() ++endif() + + if (UNIX AND NOT OpenMVG_BUILD_COVERAGE) + set(CMAKE_C_FLAGS_RELEASE "-O3") diff --git a/recipes/openmvg/all/patches/2.0-0005-msvc-bigobj.patch b/recipes/openmvg/all/patches/2.0-0005-msvc-bigobj.patch new file mode 100644 index 0000000000000..253ad672fc36d --- /dev/null +++ b/recipes/openmvg/all/patches/2.0-0005-msvc-bigobj.patch @@ -0,0 +1,25 @@ +--- a/src/openMVG/matching/CMakeLists.txt ++++ b/src/openMVG/matching/CMakeLists.txt +@@ -45,7 +45,9 @@ target_link_libraries(openMVG_matching + endif() + set_target_properties(openMVG_matching PROPERTIES SOVERSION ${OPENMVG_VERSION_MAJOR} VERSION "${OPENMVG_VERSION_MAJOR}.${OPENMVG_VERSION_MINOR}") + set_property(TARGET openMVG_matching PROPERTY FOLDER OpenMVG/OpenMVG) +- ++if(MSVC) ++ set_target_properties(openMVG_matching PROPERTIES COMPILE_FLAGS "/bigobj") ++endif() + + if (USE_AVX2) + target_compile_options(openMVG_matching PUBLIC "-DOPENMVG_USE_AVX2") +--- a/src/openMVG/multiview/CMakeLists.txt ++++ b/src/openMVG/multiview/CMakeLists.txt +@@ -40,6 +40,9 @@ target_include_directories(openMVG_multiview + $ + ) + set_target_properties(openMVG_multiview PROPERTIES SOVERSION ${OPENMVG_VERSION_MAJOR} VERSION "${OPENMVG_VERSION_MAJOR}.${OPENMVG_VERSION_MINOR}") ++if(MSVC) ++ set_target_properties(openMVG_multiview PROPERTIES COMPILE_FLAGS "/bigobj") ++endif() + + add_library(openMVG_multiview_test_data ${MULTIVIEWTESTDATA}) + target_link_libraries(openMVG_multiview_test_data PRIVATE openMVG_numeric openMVG_multiview) diff --git a/recipes/openmvg/all/test_package/CMakeLists.txt b/recipes/openmvg/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..7ecd1fedb6052 --- /dev/null +++ b/recipes/openmvg/all/test_package/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(OpenMVG REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE + OpenMVG::openMVG_geometry + OpenMVG::openMVG_linearProgramming + OpenMVG::openMVG_multiview + OpenMVG::openMVG_numeric +) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/openmvg/all/test_package/conanfile.py b/recipes/openmvg/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0a6bc68712d90 --- /dev/null +++ b/recipes/openmvg/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/openmvg/all/test_package/test_package.cpp b/recipes/openmvg/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..a612513939780 --- /dev/null +++ b/recipes/openmvg/all/test_package/test_package.cpp @@ -0,0 +1,24 @@ +#include +#include +#include +#include + +int main() { + // Test symbols of openMVG_geometry + openMVG::geometry::Polygon2d polygon; + polygon.emplace_back(0.0, 0.0); + polygon.emplace_back(0.0, 2.0); + polygon.emplace_back(1.0, 2.0); + polygon.emplace_back(5.0, 1.2); + polygon.emplace_back(0.0, 0.0); + double area; + auto ret = openMVG::geometry::ConvexPolygonArea(polygon, area); + + // Test symbols of openMVG_linearProgramming + openMVG::linearProgramming::OSI_CLP_SolverWrapper solver(10); + + // Test symbols of openMVG_multiview + openMVG::Mat3 mat; + openMVG::PreconditionerFromPoints(1024, 1024, &mat); + return 0; +} diff --git a/recipes/openmvg/all/test_v1_package/CMakeLists.txt b/recipes/openmvg/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/openmvg/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/openmvg/all/test_v1_package/conanfile.py b/recipes/openmvg/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/openmvg/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/openmvg/config.yml b/recipes/openmvg/config.yml new file mode 100644 index 0000000000000..eab700ad534a3 --- /dev/null +++ b/recipes/openmvg/config.yml @@ -0,0 +1,3 @@ +versions: + "2.0": + folder: all diff --git a/recipes/openpam/all/conandata.yml b/recipes/openpam/all/conandata.yml new file mode 100644 index 0000000000000..632d89ce6cb2b --- /dev/null +++ b/recipes/openpam/all/conandata.yml @@ -0,0 +1,11 @@ +sources: + "20230627": + url: + - "https://www.openpam.org/downloads/openpam-20230627.tar.gz" + - "https://sourceforge.net/projects/openpam/files/openpam/Ximenia/openpam-20230627.tar.gz" + sha256: "0d9ac8f5b55a6241f5073f13eff1e95461422c45ac1a30445d7e1068e91db4fd" + "20190224": + url: + - "https://www.openpam.org/downloads/openpam-20190224.tar.gz" + - "https://sourceforge.net/projects/openpam/files/openpam/Tabebuia/openpam-20190224.tar.gz" + sha256: "31f871f16b6868aef9c849f39aff6c52227977e09eee22b00fb8b7435ddf7105" diff --git a/recipes/openpam/all/conanfile.py b/recipes/openpam/all/conanfile.py new file mode 100644 index 0000000000000..fb8da0b58aff1 --- /dev/null +++ b/recipes/openpam/all/conanfile.py @@ -0,0 +1,68 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import copy, get, rmdir, rm +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +import os + + +required_conan_version = ">=1.54.0" + +class PackageConan(ConanFile): + name = "openpam" + description = "OpenPAM: an open source PAM library that focuses on simplicity, correctness, and cleanliness" + license = "BSD-3-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://openpam.org/" + topics = ("pam", "pluggable-authentication-module", "authentication", "security") + 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.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + basic_layout(self, src_folder="src") + + def validate(self): + if self.settings.os not in ["Linux", "FreeBSD", "Neutrino"]: + raise ConanInvalidConfiguration(f"{self.ref} is not supported on {self.settings.os}.") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = AutotoolsToolchain(self) + tc.generate() + + def build(self): + autotools = Autotools(self) + autotools.configure() + autotools.make() + + def package(self): + autotools = Autotools(self) + autotools.install() + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + 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.libs = ["pam"] + self.cpp_info.system_libs = ["dl"] diff --git a/recipes/openpam/all/test_package/CMakeLists.txt b/recipes/openpam/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..d03b89e820ddd --- /dev/null +++ b/recipes/openpam/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) + +find_package(openpam REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE openpam::openpam) diff --git a/recipes/openpam/all/test_package/conanfile.py b/recipes/openpam/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0a808db45f245 --- /dev/null +++ b/recipes/openpam/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/openpam/all/test_package/test_package.c b/recipes/openpam/all/test_package/test_package.c new file mode 100644 index 0000000000000..50dff63a6c03a --- /dev/null +++ b/recipes/openpam/all/test_package/test_package.c @@ -0,0 +1,22 @@ +#include +#include +#include +#include +#include +#include + + +int main(void) { + pam_handle_t* pamh; + struct pam_conv pamc; + const char *user; + + int rv = pam_start("yes", user, &pamc, &pamh); + + if(rv == PAM_SUCCESS) { + pam_end(pamh, PAM_SUCCESS); + } + + return EXIT_SUCCESS; +} + diff --git a/recipes/openpam/config.yml b/recipes/openpam/config.yml new file mode 100644 index 0000000000000..23de255ba07ec --- /dev/null +++ b/recipes/openpam/config.yml @@ -0,0 +1,5 @@ +versions: + "20230627": + folder: all + "20190224": + folder: all diff --git a/recipes/openscenegraph/all/CMakeLists.txt b/recipes/openscenegraph/all/CMakeLists.txt index a0749127966c0..5acc346654c57 100644 --- a/recipes/openscenegraph/all/CMakeLists.txt +++ b/recipes/openscenegraph/all/CMakeLists.txt @@ -1,23 +1,44 @@ -cmake_minimum_required(VERSION 3.1.2) +cmake_minimum_required(VERSION 3.15) project(cmake_wrapper) -include(${PROJECT_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(NO_OUTPUT_DIRS) +macro(custom_find_package name variable) + string(TOUPPER ${name} name_upper) + if(${variable}) + find_package(${name} ${ARGN} REQUIRED CONFIG + # Allow only Conan packages + NO_DEFAULT_PATH + PATHS ${CMAKE_PREFIX_PATH} + ) + set(${name_upper}_FOUND TRUE) + set(${name_upper}_VERSION_STRING ${${name}_VERSION_STRING}) + set(${name_upper}_INCLUDE_DIRS ${${name}_INCLUDE_DIRS}) + set(${name_upper}_INCLUDE_DIR ${${name}_INCLUDE_DIR}) + set(${name_upper}_LIBRARIES ${${name}_LIBRARIES}) + set(${name_upper}_DEFINITIONS ${${name}_DEFINITIONS}) + unset(name_upper) + else() + set(${name}_FOUND FALSE) + set(${name_upper}_FOUND FALSE) + endif() +endmacro() -# Hack to insure that conan's copy of these are used, rather than CMake's -# If this isn't here, find_package(X11) will pull in CMake's copy -find_package(Freetype QUIET) -find_package(Fontconfig QUIET) +custom_find_package(Boost OSG_WITH_ASIO) +custom_find_package(Asio OSG_WITH_ASIO) +custom_find_package(CURL OSG_WITH_CURL) +custom_find_package(Fontconfig OSG_TEXT_USE_FONTCONFIG) +custom_find_package(Freetype OSG_WITH_FREETYPE) +custom_find_package(GDAL OSG_WITH_GDAL) +custom_find_package(GIFLIB OSG_WITH_GIFLIB) +custom_find_package(GTA OSG_WITH_GTA) +custom_find_package(JPEG OSG_WITH_JPEG) +custom_find_package(Jasper OSG_WITH_JASPER) +custom_find_package(OpenEXR OSG_WITH_OPENEXR) +custom_find_package(PNG OSG_WITH_PNG) +custom_find_package(TIFF OSG_WITH_TIFF) +custom_find_package(ZLIB OSG_WITH_ZLIB) +custom_find_package(DCMTK OSG_WITH_DCMTK) +# custom_find_package(Poppler) +# custom_find_package(RSVG) +# custom_find_package(SDL2) -# Workaround limitations of the cmake_find_package generator -set(FREETYPE_FOUND ${Freetype_FOUND}) -if(FREETYPE_FOUND) - set(FREETYPE_LIBRARIES ${Freetype_LIBRARIES}) - set(FREETYPE_INCLUDE_DIRS ${Freetype_INCLUDE_DIRS}) -endif() - -if(APPLE) - add_compile_definitions("GL_SILENCE_DEPRECATION") -endif() - -add_subdirectory("source_subfolder") +add_subdirectory(src) diff --git a/recipes/openscenegraph/all/conan-official-osg-variables.cmake b/recipes/openscenegraph/all/conan-official-osg-variables.cmake new file mode 100644 index 0000000000000..636f54b308c40 --- /dev/null +++ b/recipes/openscenegraph/all/conan-official-osg-variables.cmake @@ -0,0 +1,23 @@ +# Reproduce https://github.com/openscenegraph/OpenSceneGraph/blob/master/packaging/cmake/OpenSceneGraphConfig.cmake.in +# Component-specific variables are not created. Use the component targets instead. + +# Only export these for the OpenSceneGraph config file, not FindOSG.cmake +if(NOT DEFINED OSG_LIBRARIES) + set(OPENSCENEGRAPH_FOUND TRUE) + set(OPENSCENEGRAPH_LIBRARIES ${OpenSceneGraph_LIBRARIES}) + set(OPENSCENEGRAPH_INCLUDE_DIR ${OpenSceneGraph_INCLUDE_DIRS}) + set(OPENSCENEGRAPH_INCLUDE_DIRS ${OpenSceneGraph_INCLUDE_DIRS}) + + set(OPENSCENEGRAPH_VERSION ${OpenSceneGraph_VERSION}) + set(OPENSCENEGRAPH_VERSION_STRING ${OpenSceneGraph_VERSION_STRING}) + + set(OSG_LIBRARY ${OpenSceneGraph_LIBRARIES}) + set(OSG_LIBRARIES ${OpenSceneGraph_LIBRARIES}) + set(OSG_INCLUDE_DIR ${OpenSceneGraph_INCLUDE_DIRS}) + set(OSG_INCLUDE_DIRS ${OpenSceneGraph_INCLUDE_DIRS}) +endif() + +# Reproduce https://github.com/openscenegraph/OpenSceneGraph/blob/master/CMakeModules/FindOpenThreads.cmake +set(OPENTHREADS_FOUND TRUE) +set(OPENTHREADS_INCLUDE_DIR ${OpenSceneGraph_INCLUDE_DIRS}) +set(OPENTHREADS_LIBRARY OpenThreads::OpenThreads) diff --git a/recipes/openscenegraph/all/conandata.yml b/recipes/openscenegraph/all/conandata.yml index 0f1b6a2cc4790..094e9853e6fca 100644 --- a/recipes/openscenegraph/all/conandata.yml +++ b/recipes/openscenegraph/all/conandata.yml @@ -1,18 +1,38 @@ sources: 3.6.5: - sha256: aea196550f02974d6d09291c5d83b51ca6a03b3767e234a8c0e21322927d1e12 - url: https://github.com/openscenegraph/OpenSceneGraph/archive/OpenSceneGraph-3.6.5.tar.gz + url: "https://github.com/openscenegraph/OpenSceneGraph/archive/OpenSceneGraph-3.6.5.tar.gz" + sha256: "aea196550f02974d6d09291c5d83b51ca6a03b3767e234a8c0e21322927d1e12" patches: 3.6.5: - patch_file: patches/0001-fix-to_cmake_path-usage.patch - base_path: source_subfolder - - patch_file: patches/0002-Use-standard-CMake-name-for-gif.patch - base_path: source_subfolder - - patch_file: patches/0003-Correct-usage-of-_LIBRARY-to-_LIBRARIES.patch - base_path: source_subfolder - - patch_file: patches/0004-Allow-explicit-control-of-plugins.patch - base_path: source_subfolder + patch_description: Fix cmake paths + patch_type: portability - patch_file: patches/0005-use-JPEG-target-for-plugin.patch - base_path: source_subfolder + patch_description: This fixes building against a static libjpeg on windows + patch_type: portability - patch_file: patches/0006-Declare-result-as-LONG-for-Mingw-build.patch - base_path: source_subfolder + patch_description: Win32's ChangeDisplaySettingsEx() API function is documented as returning `LONG`, which evidently is not always the same as `unsigned int` (Mingw64.) This cause a compile error on Mingw with clang10. + patch_type: official + patch_source: https://github.com/openscenegraph/OpenSceneGraph/commit/67468cce344dd5e503aaa1063845f34720563f79 + - patch_file: patches/0007-fix-msvc-with-std-c++17.patch + patch_description: Fix to be able to build with c++17 on MSVC + patch_type: official + patch_source: https://github.com/openscenegraph/OpenSceneGraph/pull/1055 + - patch_file: patches/0008-replace-mem-fun-ref.patch + patch_description: Replaced std::mem_fun_ref usage to avoid compatiblity with modern compilers + patch_type: official + patch_source: https://github.com/openscenegraph/OpenSceneGraph/commit/8a0114a46a4bad9041297950fe3bfbb2aea6e1da + - patch_file: patches/0009-replace-auto-ptr-in-plugins.patch + patch_description: auto_ptr is removed in C++17. + patch_type: portability + patch_source: https://github.com/openscenegraph/OpenSceneGraph/pull/1246 + - patch_file: patches/0010-replace-ptr-fun-in-obj-plugin.patch + patch_description: ptr_fun is removed in C++17 + patch_type: portability + patch_source: https://github.com/openscenegraph/OpenSceneGraph/pull/1246 + - patch_file: patches/0011-remove-deprecated-register.patch + patch_description: The "register" keyword is deprecated as of C++17 + patch_type: bugfix + patch_source: + - https://github.com/openscenegraph/OpenSceneGraph/pull/1296 + - https://github.com/openscenegraph/OpenSceneGraph/pull/951 diff --git a/recipes/openscenegraph/all/conanfile.py b/recipes/openscenegraph/all/conanfile.py index 0d6e3c7e53e23..8ed902063ca31 100644 --- a/recipes/openscenegraph/all/conanfile.py +++ b/recipes/openscenegraph/all/conanfile.py @@ -1,19 +1,27 @@ -from conans import CMake, ConanFile, tools -from conans.errors import ConanInvalidConfiguration import os -import functools +import re +from pathlib import Path -required_conan_version = ">=1.29.1" +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.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir, replace_in_file +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" class OpenSceneGraphConanFile(ConanFile): name = "openscenegraph" description = "OpenSceneGraph is an open source high performance 3D graphics toolkit" - topics = ("openscenegraph", "graphics") + license = ("LGPL-2.1-only", "WxWindows-exception-3.1") url = "https://github.com/conan-io/conan-center-index" homepage = "http://www.openscenegraph.org" - license = "LGPL-2.1-only", "WxWindows-exception-3.1" + topics = ("graphics",) + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -36,11 +44,13 @@ class OpenSceneGraphConanFile(ConanFile): "with_gif": [True, False], "with_gta": [True, False], "with_jasper": [True, False], - "with_jpeg": [True, False], + "with_jpeg": ["libjpeg", "libjpeg-turbo", "mozjpeg", False], "with_openexr": [True, False], "with_png": [True, False], "with_tiff": [True, False], "with_zlib": [True, False], + "with_avfoundation": [True, False], + "opengl_profile": ["gl1", "gl2", "gl3", "glCore", "gles1", "gles2", "gles3", "gles2+gles3"], } default_options = { "shared": False, @@ -63,20 +73,20 @@ class OpenSceneGraphConanFile(ConanFile): "with_gif": True, "with_gta": False, "with_jasper": False, - "with_jpeg": True, + "with_jpeg": "libjpeg", "with_openexr": False, "with_png": True, "with_tiff": True, "with_zlib": True, + "opengl_profile": "gl2", + "with_avfoundation": True, } - short_paths = True - exports_sources = "CMakeLists.txt", "patches/*.patch" - generators = "cmake", "cmake_find_package" - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) + copy(self, "conan-official-osg-variables.cmake", self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -86,7 +96,7 @@ def config_options(self): # Default to false with fontconfig until it is supported on Windows self.options.use_fontconfig = False - if tools.is_apple_os(self.settings.os): + if is_apple_os(self): # osg uses imageio on Apple platforms del self.options.with_gif del self.options.with_jpeg @@ -94,163 +104,254 @@ def config_options(self): # imageio supports tiff files so the tiff plugin isn't needed on Apple platforms self.options.with_tiff = False + else: + del self.options.with_avfoundation def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") if not self.options.with_zlib: # These require zlib support - del self.options.with_openexr - del self.options.with_png - del self.options.with_dcmtk + self.options.rm_safe("with_openexr") + self.options.rm_safe("with_png") + self.options.rm_safe("with_dcmtk") - def validate(self): - if self.options.get_safe("with_asio", False): - raise ConanInvalidConfiguration("ASIO support in OSG is broken, see https://github.com/openscenegraph/OpenSceneGraph/issues/921") - if hasattr(self, "settings_build") and tools.cross_building(self): - raise ConanInvalidConfiguration("openscenegraph recipe cannot be cross-built yet. Contributions are welcome.") + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - if self.options.enable_windowing_system and self.settings.os == "Linux": + if self.options.enable_windowing_system and self.settings.os in ["Linux", "FreeBSD"]: self.requires("xorg/system") self.requires("opengl/system") if self.options.use_fontconfig: - self.requires("fontconfig/2.13.93") + self.requires("fontconfig/2.14.2") - if self.options.get_safe("with_asio", False): + if self.options.get_safe("with_asio"): # Should these be private requires? - self.requires("asio/1.22.1") - self.requires("boost/1.79.0") + self.requires("asio/1.28.1") + self.requires("boost/1.83.0") if self.options.with_curl: - self.requires("libcurl/7.83.1") + self.requires("libcurl/[>=7.78 <9]") if self.options.get_safe("with_dcmtk"): - self.requires("dcmtk/3.6.6") + self.requires("dcmtk/3.6.7") if self.options.with_freetype: - self.requires("freetype/2.12.1") + self.requires("freetype/2.13.2") if self.options.with_gdal: - self.requires("gdal/3.4.3") + self.requires("gdal/3.8.3") if self.options.get_safe("with_gif"): self.requires("giflib/5.2.1") if self.options.with_gta: self.requires("libgta/1.2.1") if self.options.with_jasper: - self.requires("jasper/2.0.33") - if self.options.get_safe("with_jpeg"): - self.requires("libjpeg/9d") + self.requires("jasper/4.2.0") + 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/3.0.2") + elif self.options.get_safe("with_jpeg") == "mozjpeg": + self.requires("mozjpeg/4.1.5") if self.options.get_safe("with_openexr"): - self.requires("openexr/3.1.5") + self.requires("openexr/3.2.3") if self.options.get_safe("with_png"): - self.requires("libpng/1.6.37") + self.requires("libpng/1.6.40") if self.options.with_tiff: - self.requires("libtiff/4.3.0") + self.requires("libtiff/4.6.0") if self.options.with_zlib: - self.requires("zlib/1.2.12") - - 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["patches"].get(self.version, []): - tools.patch(**patch) + self.requires("zlib/[>=1.2.11 <2]") - for package in ("Fontconfig", "Freetype", "GDAL", "GIFLIB", "GTA", "Jasper", "OpenEXR"): - # Prefer conan's find package scripts over osg's - os.unlink(os.path.join(self._source_subfolder, "CMakeModules", "Find{}.cmake".format(package))) + def validate(self): + if self.options.get_safe("with_asio"): + raise ConanInvalidConfiguration( + "ASIO support in OSG is broken, " + "see https://github.com/openscenegraph/OpenSceneGraph/issues/921" + ) + if hasattr(self, "settings_build") and cross_building(self): + raise ConanInvalidConfiguration( + "openscenegraph recipe cannot be cross-built yet. " + "Contributions are welcome." + ) - @functools.lru_cache(1) - def _configured_cmake(self): - cmake = CMake(self) + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) - cmake.definitions["USE_3RDPARTY_BIN"] = False + def generate(self): + tc = CMakeToolchain(self) + tc.variables["USE_3RDPARTY_BIN"] = False - cmake.definitions["DYNAMIC_OPENSCENEGRAPH"] = self.options.shared - cmake.definitions["DYNAMIC_OPENTHREADS"] = self.options.shared + tc.variables["DYNAMIC_OPENSCENEGRAPH"] = self.options.shared + tc.variables["DYNAMIC_OPENTHREADS"] = self.options.shared - cmake.definitions["BUILD_OSG_APPLICATIONS"] = self.options.build_applications - cmake.definitions["BUILD_OSG_EXAMPLES"] = False + tc.variables["BUILD_OSG_APPLICATIONS"] = self.options.build_applications + tc.variables["BUILD_OSG_EXAMPLES"] = False - cmake.definitions["OSG_NOTIFY_DISABLED"] = not self.options.enable_notify - cmake.definitions["OSG_USE_DEPRECATED_API"] = self.options.enable_deprecated_api - cmake.definitions["OSG_PROVIDE_READFILE"] = self.options.enable_readfile - cmake.definitions["OSG_USE_REF_PTR_IMPLICIT_OUTPUT_CONVERSION"] = self.options.enable_ref_ptr_implicit_output_conversion - cmake.definitions["OSG_USE_REF_PTR_SAFE_DEREFERENCE"] = self.options.enable_ref_ptr_safe_dereference - cmake.definitions["OSG_ENVVAR_SUPPORTED"] = self.options.enable_envvar_support + tc.variables["OSG_NOTIFY_DISABLED"] = not self.options.enable_notify + tc.variables["OSG_USE_DEPRECATED_API"] = self.options.enable_deprecated_api + tc.variables["OSG_PROVIDE_READFILE"] = self.options.enable_readfile + tc.variables["OSG_USE_REF_PTR_IMPLICIT_OUTPUT_CONVERSION"] = self.options.enable_ref_ptr_implicit_output_conversion + tc.variables["OSG_USE_REF_PTR_SAFE_DEREFERENCE"] = self.options.enable_ref_ptr_safe_dereference + tc.variables["OSG_ENVVAR_SUPPORTED"] = self.options.enable_envvar_support if not self.options.enable_windowing_system: - cmake.definitions["OSG_WINDOWING_SYSTEM"] = None + tc.variables["OSG_WINDOWING_SYSTEM"] = None + + tc.variables["BUILD_OSG_DEPRECATED_SERIALIZERS"] = self.options.enable_deprecated_serializers - cmake.definitions["BUILD_OSG_DEPRECATED_SERIALIZERS"] = self.options.enable_deprecated_serializers + tc.variables["OSG_TEXT_USE_FONTCONFIG"] = self.options.use_fontconfig - cmake.definitions["OSG_TEXT_USE_FONTCONFIG"] = self.options.use_fontconfig + tc.variables["OPENGL_PROFILE"] = str(self.options.opengl_profile).upper() # Disable option dependencies unless we have a package for them - cmake.definitions["OSG_WITH_FREETYPE"] = self.options.with_freetype - cmake.definitions["OSG_WITH_OPENEXR"] = self.options.get_safe("with_openexr", False) - cmake.definitions["OSG_WITH_INVENTOR"] = False - cmake.definitions["OSG_WITH_JASPER"] = self.options.with_jasper - cmake.definitions["OSG_WITH_OPENCASCADE"] = False - cmake.definitions["OSG_WITH_FBX"] = False - cmake.definitions["OSG_WITH_ZLIB"] = self.options.with_zlib - cmake.definitions["OSG_WITH_GDAL"] = self.options.with_gdal - cmake.definitions["OSG_WITH_GTA"] = self.options.with_gta - cmake.definitions["OSG_WITH_CURL"] = self.options.with_curl - cmake.definitions["OSG_WITH_LIBVNCSERVER"] = False - cmake.definitions["OSG_WITH_DCMTK"] = self.options.get_safe("with_dcmtk", False) - cmake.definitions["OSG_WITH_FFMPEG"] = False - cmake.definitions["OSG_WITH_DIRECTSHOW"] = False - cmake.definitions["OSG_WITH_SDL"] = False - cmake.definitions["OSG_WITH_POPPLER"] = False - cmake.definitions["OSG_WITH_RSVG"] = False - cmake.definitions["OSG_WITH_NVTT"] = False - cmake.definitions["OSG_WITH_ASIO"] = self.options.get_safe("with_asio", False) - cmake.definitions["OSG_WITH_ZEROCONF"] = False - cmake.definitions["OSG_WITH_LIBLAS"] = False - cmake.definitions["OSG_WITH_GIF"] = self.options.get_safe("with_gif", False) - cmake.definitions["OSG_WITH_JPEG"] = self.options.get_safe("with_jpeg", False) - cmake.definitions["OSG_WITH_PNG"] = self.options.get_safe("with_png", False) - cmake.definitions["OSG_WITH_TIFF"] = self.options.with_tiff + tc.variables["OSG_WITH_FREETYPE"] = self.options.with_freetype + tc.variables["OSG_WITH_OPENEXR"] = self.options.get_safe("with_openexr", False) + tc.variables["OSG_WITH_INVENTOR"] = False + tc.variables["OSG_WITH_JASPER"] = self.options.with_jasper + tc.variables["OSG_WITH_OPENCASCADE"] = False + tc.variables["OSG_WITH_FBX"] = False + tc.variables["OSG_WITH_ZLIB"] = self.options.with_zlib + tc.variables["OSG_WITH_GDAL"] = self.options.with_gdal + tc.variables["OSG_WITH_GTA"] = self.options.with_gta + tc.variables["OSG_WITH_CURL"] = self.options.with_curl + tc.variables["OSG_WITH_LIBVNCSERVER"] = False + tc.variables["OSG_WITH_DCMTK"] = self.options.get_safe("with_dcmtk", False) + tc.variables["OSG_WITH_FFMPEG"] = False + tc.variables["OSG_WITH_DIRECTSHOW"] = False + tc.variables["OSG_WITH_SDL"] = False + tc.variables["OSG_WITH_POPPLER"] = False + tc.variables["OSG_WITH_RSVG"] = False + tc.variables["OSG_WITH_NVTT"] = False + tc.variables["OSG_WITH_ASIO"] = self.options.get_safe("with_asio", False) + tc.variables["OSG_WITH_ZEROCONF"] = False + tc.variables["OSG_WITH_LIBLAS"] = False + tc.variables["OSG_WITH_GIFLIB"] = self.options.get_safe("with_gif", False) + tc.variables["OSG_WITH_JPEG"] = self.options.get_safe("with_jpeg", False) + tc.variables["OSG_WITH_PNG"] = self.options.get_safe("with_png", False) + tc.variables["OSG_WITH_TIFF"] = self.options.with_tiff + + if (self.options.get_safe("with_avfoundation")): + tc.variables["OSG_WITH_AV_FOUNDATION"] = True if self.settings.os == "Windows": # osg has optional quicktime support on Windows - cmake.definitions["CMAKE_DISABLE_FIND_PACKAGE_QuickTime"] = True + tc.variables["CMAKE_DISABLE_FIND_PACKAGE_QuickTime"] = True + + tc.variables["OSG_MSVC_VERSIONED_DLL"] = False - cmake.definitions["OSG_MSVC_VERSIONED_DLL"] = False + if is_apple_os(self): + tc.preprocessor_definitions["GL_SILENCE_DEPRECATION"] = "1" - cmake.configure() + tc.generate() - return cmake + deps = CMakeDeps(self) + deps.set_property("freetype", "cmake_module_file_name", "Freetype") + deps.set_property("giflib", "cmake_file_name", "GIFLIB") + deps.generate() + + def _patch_sources(self): + for package in ["Fontconfig", "Freetype", "GDAL", "GIFLIB", "GTA", "Jasper", "OpenEXR"]: + # Prefer conan's find package scripts over osg's + os.unlink(os.path.join(self.source_folder, "CMakeModules", f"Find{package}.cmake")) + plugins_root = Path(self.source_path.joinpath("src", "osgPlugins")) + for path in plugins_root.rglob("CMakeLists.txt"): + if path.parent == plugins_root: + # Don't replace in the root dir + continue + content = path.read_text() + # Correct usage of *_LIBRARY variables to *_LIBRARIES + content = content.replace("_LIBRARY", "_LIBRARIES") + # Allow explicit control of plugins via OSG_WITH_* variables + # e.g. replace IF(FFMPEG_FOUND) with IF(OSG_WITH_FFMPEG) + content = re.sub(r"\b([A-Z]+)_FOUND\b", r"OSG_WITH_\1", content) + path.write_text(content) + for path in self.source_path.joinpath(self.source_folder, "CMakeModules").rglob("*.cmake"): + content = path.read_text(encoding='utf-8', errors='ignore') + lib_match = re.search(r'FIND_LIBRARY\(([^ ]+)_LIBRARY', content) + if lib_match: + library_name = lib_match.group(1) + new_content = re.sub(rf'\b{library_name}_LIBRARY\b', rf'{library_name}_LIBRARIES', content) + path.write_text(new_content) + + apply_conandata_patches(self) + + # Not sure why, but CMake fails to find the EXPAT::EXPAT target created by Conan when Fontconfig is found as a module. + replace_in_file(self, os.path.join(self.source_folder, "src", "osgText", "CMakeLists.txt"), + "find_package(Fontconfig MODULE)", "find_package(Fontconfig CONFIG REQUIRED)") + replace_in_file(self, os.path.join(self.source_folder, "src", "osgPlugins", "freetype", "CMakeLists.txt"), + "SET(TARGET_EXTERNAL_LIBRARIES ${FREETYPE_LIBRARIES} )", "SET(TARGET_EXTERNAL_LIBRARIES Freetype::Freetype)") + + # osg uses imageio on Apple platforms. PNG_FOUND will be set by `FIND_PACKAGE(Freetype)` + # in the OSG cmake code and without this patch the png plugin will be included even though it shouldn't. + replace_in_file(self, os.path.join(self.source_folder, "src", "osgPlugins", "CMakeLists.txt"), + "PNG_FOUND", "PNG_FOUND AND OSG_WITH_PNG") + + # Only add curl plugin if actually requested. + replace_in_file(self, os.path.join(self.source_folder, "src", "osgPlugins", "CMakeLists.txt"), + "CURL_FOUND", "CURL_FOUND AND OSG_WITH_CURL") def build(self): self._patch_sources() - - self._configured_cmake().build() + cmake = CMake(self) + cmake.configure(build_script_folder=self.source_path.parent) + cmake.build() def package(self): - self._configured_cmake().install() + cmake = CMake(self) + cmake.install() - 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) + copy(self, "conan-official-osg-variables.cmake", + dst=os.path.join(self.package_folder, "lib", "cmake"), + src=os.path.join(self.source_folder, os.pardir)) - 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, True) def package_info(self): - # FindOpenSceneGraph.cmake is shipped with cmake and is a traditional cmake script - # It doesn't setup targets and only provides a few variables: - # - OPENSCENEGRAPH_FOUND - # - OPENSCENEGRAPH_VERSION - # - OPENSCENEGRAPH_INCLUDE_DIRS - # - OPENSCENEGRAPH_LIBRARIES - # Unfortunately, the cmake_find_package generators don't currently allow directly setting variables, - # but it will set the last three of these if the name of the package is OPENSCENEGRAPH (it uses - # the filename for the first, so OpenSceneGraph_FOUND gets set, not OPENSCENEGRAPH_FOUND) - # TODO: set OPENSCENEGRAPH_FOUND in cmake_find_package and cmake_find_package_multi - self.cpp_info.filenames["cmake_find_package"] = "OpenSceneGraph" - self.cpp_info.filenames["cmake_find_package_multi"] = "OpenSceneGraph" - self.cpp_info.names["cmake_find_package"] = "OPENSCENEGRAPH" - self.cpp_info.names["cmake_find_package_multi"] = "OPENSCENEGRAPH" + # https://github.com/openscenegraph/OpenSceneGraph/blob/master/packaging/cmake/OpenSceneGraphConfig.cmake.in + self.cpp_info.set_property("cmake_file_name", "OpenSceneGraph") + # https://github.com/openscenegraph/OpenSceneGraph/blob/master/CMakeModules/FindOSG.cmake + self.cpp_info.set_property("cmake_module_file_name", "OSG") + # Disable the automatically created targets, use the "openscenegraph" component instead + self.cpp_info.set_property("pkg_config_name", None) + self.cpp_info.set_property("cmake_target_name", None) + + # Export CMake variables set by the project + self.cpp_info.builddirs.append(os.path.join("lib", "cmake")) + cmake_vars_module = os.path.join("lib", "cmake", "conan-official-osg-variables.cmake") + self.cpp_info.set_property("cmake_build_modules", [cmake_vars_module]) + + # The main component that depends on all non-plugin components + # https://github.com/openscenegraph/OpenSceneGraph/blob/master/packaging/pkgconfig/openscenegraph.pc.in + openscenegraph = self.cpp_info.components["openscenegraph"] + openscenegraph.set_property("pkg_config_name", "openscenegraph") + # Unofficial CMake target + openscenegraph.set_property("cmake_target_name", "OpenSceneGraph::OpenSceneGraph") + openscenegraph.requires = [ + "osg", + "osgDB", + "osgFX", + "osgGA", + "osgParticle", + "osgSim", + "osgText", + "osgUtil", + "osgTerrain", + "osgManipulator", + "osgViewer", + "osgWidget", + "osgShadow", + "osgAnimation", + "osgVolume", + ] + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.names["cmake_find_package"] = "OpenSceneGraph" + self.cpp_info.names["cmake_find_package_multi"] = "OpenSceneGraph" + openscenegraph.names["cmake_find_package"] = "OpenSceneGraph" + openscenegraph.names["cmake_find_package_multi"] = "OpenSceneGraph" + self.cpp_info.build_modules["cmake_find_package"].append(cmake_vars_module) + self.cpp_info.build_modules["cmake_find_package_multi"].append(cmake_vars_module) if self.settings.build_type == "Debug": postfix = "d" @@ -267,49 +368,52 @@ def setup_plugin(plugin): plugin_library.libs = [] if self.options.shared else [lib + postfix] plugin_library.requires = ["OpenThreads", "osg", "osgDB", "osgUtil"] if not self.options.shared: - plugin_library.libdirs = [os.path.join("lib", "osgPlugins-{}".format(self.version))] + plugin_library.libdirs = [os.path.join("lib", f"osgPlugins-{self.version}")] return plugin_library def setup_serializers(lib): plugins = [] if lib not in ("osgDB", "osgWidget", "osgPresentation"): - plugins.append("serializers_{}".format(lib.lower())) + plugins.append(f"serializers_{lib.lower()}") if self.options.enable_deprecated_serializers: if lib not in ("osgUtil", "osgDB", "osgGA", "osgManipulator", "osgUI", "osgPresentation"): - plugins.append("deprecated_{}".format(lib.lower())) + plugins.append(f"deprecated_{lib.lower()}") for plugin in plugins: setup_plugin(plugin).requires.append(lib) def setup_library(lib): library = self.cpp_info.components[lib] library.libs = [lib + postfix] - library.names["pkg_config"] = "openscenegraph-{}".format(lib) + library.set_property("pkg_config_name", f"openscenegraph-{lib}") setup_serializers(lib) return library # Core libraries # requires obtained from osg's source code - # TODO: FindOpenThreads.cmake is shipped with CMake, so we should generate separate - # files for it with cmake_find_package and cmake_find_package_multi + # The project installs FindOpenThreads.cmake as a separate module. + # Conan cannot recreate that, but let's export it as a component instead. + # https://github.com/openscenegraph/OpenSceneGraph/blob/master/CMakeModules/FindOpenThreads.cmake + # https://github.com/openscenegraph/OpenSceneGraph/blob/master/packaging/pkgconfig/openthreads.pc.in library = self.cpp_info.components["OpenThreads"] library.libs = ["OpenThreads" + postfix] - library.names["pkg_config"] = "openthreads" - if self.settings.os == "Linux": + library.set_property("pkg_config_name", "openthreads") + library.set_property("cmake_target_name", "OpenThreads::OpenThreads") + if self.settings.os in ["Linux", "FreeBSD"]: library.system_libs = ["pthread"] library = setup_library("osg") library.requires = ["OpenThreads", "opengl::opengl"] - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: library.system_libs = ["m", "rt", "dl"] if not self.options.shared: library.defines.append("OSG_LIBRARY_STATIC") library = setup_library("osgDB") library.requires = ["osg", "osgUtil", "OpenThreads"] - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: library.system_libs = ["dl"] - elif self.settings.os == "Macos": + elif is_apple_os(self): library.frameworks = ["Carbon", "Cocoa"] if self.options.with_zlib: library.requires.append("zlib::zlib") @@ -325,9 +429,9 @@ def setup_library(lib): library = setup_library("osgViewer") library.requires = ["osgGA", "osgText", "osgDB", "osgUtil", "osg"] if self.options.enable_windowing_system: - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: library.requires.append("xorg::xorg") - elif tools.is_apple_os(self.settings.os): + elif is_apple_os(self): library.frameworks = ["Cocoa"] if self.settings.os == "Windows": library.system_libs = ["gdi32"] @@ -342,7 +446,8 @@ def setup_library(lib): setup_library("osgSim").requires = ["osgText", "osgUtil", "osgDB", "osg", "OpenThreads"] setup_library("osgTerrain").requires = ["osgUtil", "osgDB", "osg", "OpenThreads"] setup_library("osgWidget").requires = ["osgText", "osgViewer", "osgDB", "osg", "OpenThreads"] - setup_library("osgPresentation").requires = ["osgViewer", "osgUI", "osgWidget", "osgManipulator", "osgVolume", "osgFX", "osgText", "osgGA", "osgUtil", "osgDB", "osg", "OpenThreads"] + setup_library("osgPresentation").requires = ["osgViewer", "osgUI", "osgWidget", "osgManipulator", "osgVolume", + "osgFX", "osgText", "osgGA", "osgUtil", "osgDB", "osg", "OpenThreads"] # Start of plugins @@ -361,7 +466,7 @@ def setup_library(lib): setup_plugin("osg") plugin = setup_plugin("ive") - plugin.requires.extend(("osgSim", "osgFX", "osgText", "osgTerrain", "osgVolume")) + plugin.requires.extend(["osgSim", "osgFX", "osgText", "osgTerrain", "osgVolume"]) if self.options.with_zlib: plugin.requires.append("zlib::zlib") @@ -382,8 +487,12 @@ def setup_library(lib): setup_plugin("vtf") setup_plugin("ktx") - if self.options.get_safe("with_jpeg"): + if self.options.get_safe("with_jpeg") == "libjpeg": setup_plugin("jpeg").requires.append("libjpeg::libjpeg") + elif self.options.get_safe("with_jpeg") == "libjpeg-turbo": + setup_plugin("jpeg").requires.append("libjpeg-turbo::jpeg") + elif self.options.get_safe("with_jpeg") == "mozjpeg": + setup_plugin("jpeg").requires.append("mozjpeg::libjpeg") if self.options.with_jasper: setup_plugin("jp2").requires.append("jasper::jasper") @@ -395,13 +504,13 @@ def setup_library(lib): setup_plugin("gif").requires.append("giflib::giflib") if self.options.get_safe("with_png"): - setup_plugin("png").requires.extend(("libpng::libpng", "zlib::zlib")) + setup_plugin("png").requires.extend(["libpng::libpng", "zlib::zlib"]) if self.options.with_tiff: setup_plugin("tiff").requires.append("libtiff::libtiff") if self.options.with_gdal: - setup_plugin("gdal").requires.extend(("osgTerrain", "gdal::gdal")) + setup_plugin("gdal").requires.extend(["osgTerrain", "gdal::gdal"]) setup_plugin("ogr").requires.append("gdal::gdal") if self.options.with_gta: @@ -410,13 +519,13 @@ def setup_library(lib): # 3D Image plugins if self.options.get_safe("with_dcmtk"): plugin = setup_plugin("dicom") - plugin.requires.extend(("osgVolume", "dcmtk::dcmtk")) + plugin.requires.extend(["osgVolume", "dcmtk::dcmtk"]) if self.settings.os == "Windows": plugin.system_libs = ["wsock32", "ws2_32"] # 3rd party 3d plugins setup_plugin("3dc") - setup_plugin("p3d").requires.extend(("osgGA", "osgText", "osgVolume", "osgFX", "osgViewer", "osgPresentation")) + setup_plugin("p3d").requires.extend(["osgGA", "osgText", "osgVolume", "osgFX", "osgViewer", "osgPresentation"]) if self.options.with_curl: plugin = setup_plugin("curl") @@ -454,15 +563,15 @@ def setup_library(lib): setup_plugin("md2") setup_plugin("osgtgz") setup_plugin("tgz") - setup_plugin("shp").requires.extend(("osgSim", "osgTerrain")) + setup_plugin("shp").requires.extend(["osgSim", "osgTerrain"]) setup_plugin("txf").requires.append("osgText") setup_plugin("bsp") setup_plugin("mdl") - setup_plugin("gles").requires.extend(("osgUtil", "osgAnimation")) - setup_plugin("osgjs").requires.extend(("osgAnimation", "osgSim")) + setup_plugin("gles").requires.extend(["osgUtil", "osgAnimation"]) + setup_plugin("osgjs").requires.extend(["osgAnimation", "osgSim"]) setup_plugin("lwo").requires.append("osgFX") setup_plugin("ply") - setup_plugin("txp").requires.extend(("osgSim", "osgText")) + setup_plugin("txp").requires.extend(["osgSim", "osgText"]) # with_ffmpeg # setup_plugin("ffmpeg") @@ -473,19 +582,23 @@ def setup_library(lib): # with_directshow # setup_plugin("directshow") - if tools.is_apple_os(self.settings.os): + if is_apple_os(self): setup_plugin("imageio").frameworks = ["Accelerate"] - if ((self.settings.os == "Macos" and self.settings.os.version and tools.Version(self.settings.os.version) >= "10.8") - or (self.settings.os == "iOS" and tools.Version(self.settings.os.version) >= "6.0")): + if (self.options.get_safe("with_avfoundation")): plugin = setup_plugin("avfoundation") plugin.requires.append("osgViewer") plugin.frameworks = ["AVFoundation", "Cocoa", "CoreVideo", "CoreMedia", "QuartzCore"] - if self.settings.os == "Macos" and self.settings.os.version and tools.Version(self.settings.os.version) <= "10.6" and self.settings.arch == "x86": + if ( + is_apple_os(self) + and self.settings.os.version + and Version(self.settings.os.version) <= "10.6" + and self.settings.arch == "x86" + ): setup_plugin("qt").frameworks = ["QuickTime"] - if self.settings.os == "Macos" and self.settings.arch == "x86": + if is_apple_os(self) and self.settings.arch == "x86": plugin = setup_plugin("QTKit") plugin.requires.append("osgViewer") plugin.frameworks = ["QTKit", "Cocoa", "QuickTime", "CoreVideo"] @@ -494,7 +607,7 @@ def setup_library(lib): # setup_plugin("nvtt") if self.options.with_freetype: - setup_plugin("freetype").requires.extend(("osgText", "freetype::freetype")) + setup_plugin("freetype").requires.extend(["osgText", "freetype::freetype"]) if self.options.with_zlib: setup_plugin("zip") @@ -527,7 +640,7 @@ def setup_library(lib): # setup_plugin("sdl") if self.options.get_safe("with_asio", False): - setup_plugin("resthttp").requires.extend(("osgPresentation", "asio::asio", "boost::boost")) + setup_plugin("resthttp").requires.extend(["osgPresentation", "asio::asio", "boost::boost"]) # with_zeroconf # setup_plugin("zeroconf") diff --git a/recipes/openscenegraph/all/patches/0002-Use-standard-CMake-name-for-gif.patch b/recipes/openscenegraph/all/patches/0002-Use-standard-CMake-name-for-gif.patch deleted file mode 100644 index 7a75a5c326228..0000000000000 --- a/recipes/openscenegraph/all/patches/0002-Use-standard-CMake-name-for-gif.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 17ad9caac56282e89d0e6a62c9564b99e2736225 Mon Sep 17 00:00:00 2001 -From: "R. Andrew Ohana" -Date: Thu, 17 Sep 2020 16:51:45 -0700 -Subject: [PATCH 2/5] Use standard CMake name for gif - ---- - CMakeLists.txt | 2 +- - src/osgPlugins/CMakeLists.txt | 2 +- - src/osgPlugins/gif/CMakeLists.txt | 4 ++-- - 3 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 0ef2edd33..5e0c8f349 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -813,7 +813,7 @@ ENDIF(BUILD_OSG_EXAMPLES AND NOT ANDROID) - # can use Quicktime. - IF(NOT ANDROID) - IF(NOT APPLE) -- FIND_PACKAGE(GIFLIB) -+ FIND_PACKAGE(GIF) - FIND_PACKAGE(JPEG) - FIND_PACKAGE(PNG) - FIND_PACKAGE(TIFF) -diff --git a/src/osgPlugins/CMakeLists.txt b/src/osgPlugins/CMakeLists.txt -index 812550412..2a88684b5 100644 ---- a/src/osgPlugins/CMakeLists.txt -+++ b/src/osgPlugins/CMakeLists.txt -@@ -108,7 +108,7 @@ ENDIF() - IF(OPENEXR_FOUND AND ZLIB_FOUND AND OSG_CPP_EXCEPTIONS_AVAILABLE) - ADD_PLUGIN_DIRECTORY(exr) - ENDIF() --IF(GIFLIB_FOUND) -+IF(GIF_FOUND) - ADD_PLUGIN_DIRECTORY(gif) - ENDIF() - IF(PNG_FOUND AND OSG_CPP_EXCEPTIONS_AVAILABLE) -diff --git a/src/osgPlugins/gif/CMakeLists.txt b/src/osgPlugins/gif/CMakeLists.txt -index 642339af1..0db0296cc 100644 ---- a/src/osgPlugins/gif/CMakeLists.txt -+++ b/src/osgPlugins/gif/CMakeLists.txt -@@ -1,7 +1,7 @@ --INCLUDE_DIRECTORIES( ${GIFLIB_INCLUDE_DIR} ) -+INCLUDE_DIRECTORIES( ${GIF_INCLUDE_DIR} ) - - SET(TARGET_SRC ReaderWriterGIF.cpp ) --SET(TARGET_LIBRARIES_VARS GIFLIB_LIBRARY ) -+SET(TARGET_LIBRARIES_VARS GIF_LIBRARY ) - #### end var setup ### - SETUP_PLUGIN(gif) - --- -2.21.0.windows.1 - diff --git a/recipes/openscenegraph/all/patches/0003-Correct-usage-of-_LIBRARY-to-_LIBRARIES.patch b/recipes/openscenegraph/all/patches/0003-Correct-usage-of-_LIBRARY-to-_LIBRARIES.patch deleted file mode 100644 index b3965bd4897eb..0000000000000 --- a/recipes/openscenegraph/all/patches/0003-Correct-usage-of-_LIBRARY-to-_LIBRARIES.patch +++ /dev/null @@ -1,155 +0,0 @@ -From 4925ff028681f79b8c0cb1d8e0772ca026c6e63e Mon Sep 17 00:00:00 2001 -From: "R. Andrew Ohana" -Date: Thu, 17 Sep 2020 17:06:49 -0700 -Subject: [PATCH 3/5] Correct usage of *_LIBRARY to *_LIBRARIES - ---- - src/osgPlugins/curl/CMakeLists.txt | 4 ++-- - src/osgPlugins/gdal/CMakeLists.txt | 2 +- - src/osgPlugins/gif/CMakeLists.txt | 2 +- - src/osgPlugins/gta/CMakeLists.txt | 2 +- - src/osgPlugins/jp2/CMakeLists.txt | 2 +- - src/osgPlugins/jpeg/CMakeLists.txt | 2 +- - src/osgPlugins/ogr/CMakeLists.txt | 2 +- - src/osgPlugins/png/CMakeLists.txt | 2 +- - src/osgPlugins/tiff/CMakeLists.txt | 2 +- - src/osgPlugins/vnc/CMakeLists.txt | 2 +- - 10 files changed, 11 insertions(+), 11 deletions(-) - -diff --git a/src/osgPlugins/curl/CMakeLists.txt b/src/osgPlugins/curl/CMakeLists.txt -index 667631f07..4afb738c7 100644 ---- a/src/osgPlugins/curl/CMakeLists.txt -+++ b/src/osgPlugins/curl/CMakeLists.txt -@@ -23,11 +23,11 @@ SET(TARGET_H - - IF(ZLIB_FOUND) - SET(TARGET_LIBRARIES_VARS -- CURL_LIBRARY -+ CURL_LIBRARIES - ZLIB_LIBRARIES) - ELSE() - SET(TARGET_LIBRARIES_VARS -- CURL_LIBRARY) -+ CURL_LIBRARIES) - ENDIF() - - IF(WIN32 OR MINGW) -diff --git a/src/osgPlugins/gdal/CMakeLists.txt b/src/osgPlugins/gdal/CMakeLists.txt -index f1b670701..353bc9fc6 100644 ---- a/src/osgPlugins/gdal/CMakeLists.txt -+++ b/src/osgPlugins/gdal/CMakeLists.txt -@@ -9,7 +9,7 @@ SET(TARGET_H - DataSetLayer.h - ) - --SET(TARGET_LIBRARIES_VARS GDAL_LIBRARY ) -+SET(TARGET_LIBRARIES_VARS GDAL_LIBRARIES ) - SET(TARGET_ADDED_LIBRARIES osgTerrain ) - - IF(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") -diff --git a/src/osgPlugins/gif/CMakeLists.txt b/src/osgPlugins/gif/CMakeLists.txt -index 0db0296cc..99d1e26dc 100644 ---- a/src/osgPlugins/gif/CMakeLists.txt -+++ b/src/osgPlugins/gif/CMakeLists.txt -@@ -1,7 +1,7 @@ - INCLUDE_DIRECTORIES( ${GIF_INCLUDE_DIR} ) - - SET(TARGET_SRC ReaderWriterGIF.cpp ) --SET(TARGET_LIBRARIES_VARS GIF_LIBRARY ) -+SET(TARGET_LIBRARIES_VARS GIF_LIBRARIES ) - #### end var setup ### - SETUP_PLUGIN(gif) - -diff --git a/src/osgPlugins/gta/CMakeLists.txt b/src/osgPlugins/gta/CMakeLists.txt -index 2b910a628..16466fefc 100644 ---- a/src/osgPlugins/gta/CMakeLists.txt -+++ b/src/osgPlugins/gta/CMakeLists.txt -@@ -2,7 +2,7 @@ INCLUDE_DIRECTORIES( ${GTA_INCLUDE_DIRS} ) - - SET(TARGET_SRC ReaderWriterGTA.cpp ) - --SET(TARGET_LIBRARIES_VARS GTA_LIBRARY) -+SET(TARGET_LIBRARIES_VARS GTA_LIBRARIES) - - #### end var setup ### - SETUP_PLUGIN(gta) -diff --git a/src/osgPlugins/jp2/CMakeLists.txt b/src/osgPlugins/jp2/CMakeLists.txt -index b95537680..adcd84f64 100644 ---- a/src/osgPlugins/jp2/CMakeLists.txt -+++ b/src/osgPlugins/jp2/CMakeLists.txt -@@ -2,7 +2,7 @@ INCLUDE_DIRECTORIES( ${JASPER_INCLUDE_DIR} ) - - SET(TARGET_SRC ReaderWriterJP2.cpp ) - --SET(TARGET_LIBRARIES_VARS JASPER_LIBRARY ) -+SET(TARGET_LIBRARIES_VARS JASPER_LIBRARIES ) - - IF(WIN32) - ADD_DEFINITIONS(-DJAS_WIN_MSVC_BUILD) -diff --git a/src/osgPlugins/jpeg/CMakeLists.txt b/src/osgPlugins/jpeg/CMakeLists.txt -index 7117713a0..2d290a29d 100644 ---- a/src/osgPlugins/jpeg/CMakeLists.txt -+++ b/src/osgPlugins/jpeg/CMakeLists.txt -@@ -5,6 +5,6 @@ SET(TARGET_SRC - ReaderWriterJPEG.cpp - ) - --SET(TARGET_LIBRARIES_VARS JPEG_LIBRARY ) -+SET(TARGET_LIBRARIES_VARS JPEG_LIBRARIES ) - #### end var setup ### - SETUP_PLUGIN(jpeg) -diff --git a/src/osgPlugins/ogr/CMakeLists.txt b/src/osgPlugins/ogr/CMakeLists.txt -index 01b71e360..ea8b9706a 100644 ---- a/src/osgPlugins/ogr/CMakeLists.txt -+++ b/src/osgPlugins/ogr/CMakeLists.txt -@@ -2,7 +2,7 @@ INCLUDE_DIRECTORIES( ${GDAL_INCLUDE_DIR} ) - - SET(TARGET_SRC ReaderWriterOGR.cpp) - --SET(TARGET_LIBRARIES_VARS GDAL_LIBRARY ) -+SET(TARGET_LIBRARIES_VARS GDAL_LIBRARIES ) - - IF(CMAKE_COMPILER_IS_GNUCXX) - # Remove -Wshadow flag as it barfs on ffmoeg headers -diff --git a/src/osgPlugins/png/CMakeLists.txt b/src/osgPlugins/png/CMakeLists.txt -index 33df903d2..c4a6a2acc 100644 ---- a/src/osgPlugins/png/CMakeLists.txt -+++ b/src/osgPlugins/png/CMakeLists.txt -@@ -5,7 +5,7 @@ IF(OSG_CPP_EXCEPTIONS_AVAILABLE) - ENDIF() - - SET(TARGET_SRC ReaderWriterPNG.cpp ) --SET(TARGET_LIBRARIES_VARS PNG_LIBRARY ZLIB_LIBRARIES ) -+SET(TARGET_LIBRARIES_VARS PNG_LIBRARIES ZLIB_LIBRARIES ) - - - #### end var setup ### -diff --git a/src/osgPlugins/tiff/CMakeLists.txt b/src/osgPlugins/tiff/CMakeLists.txt -index fc945d68e..6b856eab2 100644 ---- a/src/osgPlugins/tiff/CMakeLists.txt -+++ b/src/osgPlugins/tiff/CMakeLists.txt -@@ -2,7 +2,7 @@ INCLUDE_DIRECTORIES( ${TIFF_INCLUDE_DIR} ) - - SET(TARGET_SRC ReaderWriterTIFF.cpp ) - --SET(TARGET_LIBRARIES_VARS TIFF_LIBRARY) -+SET(TARGET_LIBRARIES_VARS TIFF_LIBRARIES) - - #### end var setup ### - SETUP_PLUGIN(tiff) -diff --git a/src/osgPlugins/vnc/CMakeLists.txt b/src/osgPlugins/vnc/CMakeLists.txt -index 9a54b2bf2..49bb2dce4 100644 ---- a/src/osgPlugins/vnc/CMakeLists.txt -+++ b/src/osgPlugins/vnc/CMakeLists.txt -@@ -5,7 +5,7 @@ INCLUDE_DIRECTORIES(${LIBVNCSERVER_INCLUDE_DIR}) - SET(TARGET_EXTERNAL_LIBRARIES - ${LIBVNCCLIENT_LIBRARY} - ${ZLIB_LIBRARIES} -- ${JPEG_LIBRARY} ) -+ ${JPEG_LIBRARIES} ) - - SET(TARGET_ADDED_LIBRARIES osgWidget ) - --- -2.21.0.windows.1 - diff --git a/recipes/openscenegraph/all/patches/0004-Allow-explicit-control-of-plugins.patch b/recipes/openscenegraph/all/patches/0004-Allow-explicit-control-of-plugins.patch deleted file mode 100644 index 19caf4dfed537..0000000000000 --- a/recipes/openscenegraph/all/patches/0004-Allow-explicit-control-of-plugins.patch +++ /dev/null @@ -1,259 +0,0 @@ -From 04859156034c6762338411d5f2c07d02d0a7b814 Mon Sep 17 00:00:00 2001 -From: "R. Andrew Ohana" -Date: Thu, 17 Sep 2020 17:25:12 -0700 -Subject: [PATCH 4/5] Allow explicit control of plugins - ---- - src/osgDB/CMakeLists.txt | 8 ++-- - src/osgPlugins/CMakeLists.txt | 58 ++++++++++++++--------------- - src/osgPlugins/curl/CMakeLists.txt | 4 +- - src/osgPlugins/dicom/CMakeLists.txt | 2 +- - src/osgPlugins/ive/CMakeLists.txt | 2 +- - 5 files changed, 37 insertions(+), 37 deletions(-) - -diff --git a/src/osgDB/CMakeLists.txt b/src/osgDB/CMakeLists.txt -index 340aae095..59b8b3a0d 100644 ---- a/src/osgDB/CMakeLists.txt -+++ b/src/osgDB/CMakeLists.txt -@@ -147,19 +147,19 @@ IF(AV_FOUNDATION_FOUND) - ADD_DEFINITIONS(-DUSE_AV_FOUNDATION) - ENDIF() - --IF(FFMPEG_FOUND) -+IF(OSG_WITH_FFMPEG) - ADD_DEFINITIONS(-DUSE_FFMPEG) - ENDIF() - --IF(INVENTOR_FOUND) -+IF(OSG_WITH_INVENTOR) - ADD_DEFINITIONS(-DUSE_INVENTOR) - ENDIF() - --IF(OPENVRML_FOUND) -+IF(OSG_WITH_OPENVRML) - ADD_DEFINITIONS(-DUSE_VRML) - ENDIF() - --IF( ZLIB_FOUND ) -+IF(OSG_WITH_ZLIB) - ADD_DEFINITIONS( -DUSE_ZLIB ) - INCLUDE_DIRECTORIES( ${ZLIB_INCLUDE_DIR} ) - SET(COMPRESSION_LIBRARIES ZLIB_LIBRARIES) -diff --git a/src/osgPlugins/CMakeLists.txt b/src/osgPlugins/CMakeLists.txt -index 2a88684b5..24dc68667 100644 ---- a/src/osgPlugins/CMakeLists.txt -+++ b/src/osgPlugins/CMakeLists.txt -@@ -99,29 +99,29 @@ ADD_PLUGIN_DIRECTORY(dot) - ADD_PLUGIN_DIRECTORY(vtf) - ADD_PLUGIN_DIRECTORY(ktx) - --IF(JPEG_FOUND) -+IF(OSG_WITH_JPEG) - ADD_PLUGIN_DIRECTORY(jpeg) - ENDIF() --IF(JASPER_FOUND) -+IF(OSG_WITH_JASPER) - ADD_PLUGIN_DIRECTORY(jp2) - ENDIF() --IF(OPENEXR_FOUND AND ZLIB_FOUND AND OSG_CPP_EXCEPTIONS_AVAILABLE) -+IF(OSG_WITH_OPENEXR) - ADD_PLUGIN_DIRECTORY(exr) - ENDIF() --IF(GIF_FOUND) -+IF(OSG_WITH_GIF) - ADD_PLUGIN_DIRECTORY(gif) - ENDIF() --IF(PNG_FOUND AND OSG_CPP_EXCEPTIONS_AVAILABLE) -+IF(OSG_WITH_PNG) - ADD_PLUGIN_DIRECTORY(png) - ENDIF() --IF(TIFF_FOUND AND OSG_CPP_EXCEPTIONS_AVAILABLE) -+IF(OSG_WITH_TIFF) - ADD_PLUGIN_DIRECTORY(tiff) - ENDIF() --IF(GDAL_FOUND) -+IF(OSG_WITH_GDAL) - ADD_PLUGIN_DIRECTORY(gdal) - ADD_PLUGIN_DIRECTORY(ogr) - ENDIF() --IF(GTA_FOUND AND OSG_CPP_EXCEPTIONS_AVAILABLE) -+IF(OSG_WITH_GTA) - ADD_PLUGIN_DIRECTORY(gta) - ENDIF() - -@@ -130,9 +130,9 @@ ENDIF() - # - # 3D Image plugins - # --IF(DCMTK_FOUND AND ZLIB_FOUND) -+IF(OSG_WITH_DCMTK) - ADD_PLUGIN_DIRECTORY(dicom) --ELSE() -+ELSEIF(FALSE) - IF(ITK_FOUND) - ADD_PLUGIN_DIRECTORY(dicom) - ENDIF() -@@ -147,29 +147,29 @@ ADD_PLUGIN_DIRECTORY(3dc) - - ADD_PLUGIN_DIRECTORY(p3d) - --IF(CURL_FOUND) -+IF(OSG_WITH_CURL) - ADD_PLUGIN_DIRECTORY(curl) - ENDIF() - --IF(ZLIB_FOUND) -+IF(OSG_WITH_ZLIB) - ADD_PLUGIN_DIRECTORY(gz) - ENDIF() - - IF(NOT OSG_GLES1_AVAILABLE AND NOT OSG_GLES2_AVAILABLE) -- IF(INVENTOR_FOUND) -+ IF(OSG_WITH_INVENTOR) - ADD_PLUGIN_DIRECTORY(Inventor) - ENDIF() - ENDIF() - --IF(COLLADA_FOUND AND OSG_CPP_EXCEPTIONS_AVAILABLE) -+IF(OSG_WITH_COLLADA) - ADD_PLUGIN_DIRECTORY(dae) - ENDIF() - --IF(FBX_FOUND AND OSG_CPP_EXCEPTIONS_AVAILABLE) -+IF(OSG_WITH_FBX) - ADD_PLUGIN_DIRECTORY(fbx) - ENDIF() - --IF(OPENCASCADE_FOUND) -+IF(OSG_WITH_OPENCASCADE) - ADD_PLUGIN_DIRECTORY(OpenCASCADE) - ENDIF() - -@@ -209,15 +209,15 @@ IF(OSG_CPP_EXCEPTIONS_AVAILABLE) - ADD_PLUGIN_DIRECTORY(txp) - ENDIF() - --IF(FFMPEG_FOUND AND OSG_CPP_EXCEPTIONS_AVAILABLE) -+IF(OSG_WITH_FFMPEG) - ADD_PLUGIN_DIRECTORY(ffmpeg) - ENDIF() - --IF(GSTREAMER_FOUND AND GLIB_FOUND) -+IF(OSG_WITH_GSTREAMER) - ADD_PLUGIN_DIRECTORY(gstreamer) - ENDIF() - --IF(DIRECTSHOW_FOUND) -+IF(OSG_WITH_DIRECTSHOW) - ADD_PLUGIN_DIRECTORY(directshow) - ENDIF() - -@@ -241,28 +241,28 @@ IF(QTKIT_FOUND) - ADD_PLUGIN_DIRECTORY(QTKit) - ENDIF() - --IF(NVTT_FOUND) -+IF(OSG_WITH_NVTT) - ADD_PLUGIN_DIRECTORY(nvtt) - ENDIF() - - --IF(FREETYPE_FOUND) -+IF(OSG_WITH_FREETYPE) - ADD_PLUGIN_DIRECTORY(freetype) - ENDIF() - --IF(ZLIB_FOUND) -+IF(OSG_WITH_ZLIB) - ADD_PLUGIN_DIRECTORY(zip) - ENDIF() - --IF(RSVG_FOUND) -+IF(OSG_WITH_RSVG) - ADD_PLUGIN_DIRECTORY(svg) - ENDIF() - --IF(POPPLER_FOUND) -+IF(OSG_WITH_POPPLER) - ADD_PLUGIN_DIRECTORY(pdf) - ENDIF() - --IF(LIBVNCSERVER_FOUND) -+IF(OSG_WITH_LIBVNCSERVER) - ADD_PLUGIN_DIRECTORY(vnc) - ENDIF() - -@@ -272,7 +272,7 @@ ADD_PLUGIN_DIRECTORY(osc) - ADD_PLUGIN_DIRECTORY(trk) - ADD_PLUGIN_DIRECTORY(tf) - --IF(LIBLAS_FOUND) -+IF(OSG_WITH_LIBLAS) - ADD_PLUGIN_DIRECTORY(las) - ENDIF() - -@@ -299,16 +299,16 @@ ENDIF() - # - # Device integration plugins - # --IF (SDL_FOUND) -+IF(OSG_WITH_SDL) - ADD_PLUGIN_DIRECTORY(sdl) - ENDIF(SDL_FOUND) - --IF(ASIO_FOUND) -+IF(OSG_WITH_ASIO) - ADD_PLUGIN_DIRECTORY(RestHttpDevice) - ENDIF(ASIO_FOUND) - - --IF(ZEROCONF_FOUND) -+IF(OSG_WITH_ZEROCONF) - ADD_PLUGIN_DIRECTORY(ZeroConfDevice) - ENDIF() - -diff --git a/src/osgPlugins/curl/CMakeLists.txt b/src/osgPlugins/curl/CMakeLists.txt -index 4afb738c7..fb5b98498 100644 ---- a/src/osgPlugins/curl/CMakeLists.txt -+++ b/src/osgPlugins/curl/CMakeLists.txt -@@ -5,7 +5,7 @@ IF(WIN32) - SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:MSVCRT") - ENDIF() - --IF(ZLIB_FOUND) -+IF(OSG_WITH_ZLIB) - ADD_DEFINITIONS(-DUSE_ZLIB) - INCLUDE_DIRECTORIES( ${CURL_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR}) - ELSE() -@@ -21,7 +21,7 @@ SET(TARGET_H - ReaderWriterCURL.h - ) - --IF(ZLIB_FOUND) -+IF(OSG_WITH_ZLIB) - SET(TARGET_LIBRARIES_VARS - CURL_LIBRARIES - ZLIB_LIBRARIES) -diff --git a/src/osgPlugins/dicom/CMakeLists.txt b/src/osgPlugins/dicom/CMakeLists.txt -index 3f159a9c5..06ccd17ed 100644 ---- a/src/osgPlugins/dicom/CMakeLists.txt -+++ b/src/osgPlugins/dicom/CMakeLists.txt -@@ -1,4 +1,4 @@ --IF (DCMTK_FOUND) -+IF (TRUE) - - # note, we have to include a '/' in front of the directory string to prevent a CMake bug from ignoring the directory - INCLUDE_DIRECTORIES(${DCMTK_INCLUDE_DIRS}) -diff --git a/src/osgPlugins/ive/CMakeLists.txt b/src/osgPlugins/ive/CMakeLists.txt -index 784a79c7e..40030b27d 100644 ---- a/src/osgPlugins/ive/CMakeLists.txt -+++ b/src/osgPlugins/ive/CMakeLists.txt -@@ -1,4 +1,4 @@ --IF(ZLIB_FOUND) -+IF(OSG_WITH_ZLIB) - ADD_DEFINITIONS(-DUSE_ZLIB) - INCLUDE_DIRECTORIES( ${ZLIB_INCLUDE_DIR}) - ENDIF() --- -2.21.0.windows.1 - diff --git a/recipes/openscenegraph/all/patches/0007-fix-msvc-with-std-c++17.patch b/recipes/openscenegraph/all/patches/0007-fix-msvc-with-std-c++17.patch new file mode 100644 index 0000000000000..39046ed3994aa --- /dev/null +++ b/recipes/openscenegraph/all/patches/0007-fix-msvc-with-std-c++17.patch @@ -0,0 +1,50 @@ +diff --git a/src/osg/DisplaySettings.cpp b/src/osg/DisplaySettings.cpp +index 5c699c8b0..5c097cf66 100644 +--- a/src/osg/DisplaySettings.cpp ++++ b/src/osg/DisplaySettings.cpp +@@ -22,9 +22,6 @@ + #include + #include + +-using namespace osg; +-using namespace std; +- + #if defined(WIN32) && !defined(__CYGWIN__) + #include + extern "C" { OSG_EXPORT DWORD NvOptimusEnablement=0x00000001; } +@@ -32,6 +29,9 @@ extern "C" { OSG_EXPORT DWORD NvOptimusEnablement=0x00000001; } + extern "C" { int NvOptimusEnablement=0x00000001; } + #endif + ++using namespace osg; ++using namespace std; ++ + void DisplaySettings::setNvOptimusEnablement(int value) + { + NvOptimusEnablement = value; +diff --git a/src/osgPlugins/cfg/ConfigParser.cpp b/src/osgPlugins/cfg/ConfigParser.cpp +index 263c82896..4247cc2af 100644 +--- a/src/osgPlugins/cfg/ConfigParser.cpp ++++ b/src/osgPlugins/cfg/ConfigParser.cpp +@@ -235,7 +235,7 @@ + #include "CameraConfig.h" + + +-using namespace std; ++ + using namespace osgProducer; + + static void ConfigParser_error( const char * ); +diff --git a/src/osgPlugins/cfg/ConfigParser.y b/src/osgPlugins/cfg/ConfigParser.y +index cf9adf507..5221be184 100644 +--- a/src/osgPlugins/cfg/ConfigParser.y ++++ b/src/osgPlugins/cfg/ConfigParser.y +@@ -34,7 +34,7 @@ + #include + + +-using namespace std; ++ + using namespace Producer; + + static void ConfigParser_error( const char * ); diff --git a/recipes/openscenegraph/all/patches/0008-replace-mem-fun-ref.patch b/recipes/openscenegraph/all/patches/0008-replace-mem-fun-ref.patch new file mode 100644 index 0000000000000..5f86f332a80cf --- /dev/null +++ b/recipes/openscenegraph/all/patches/0008-replace-mem-fun-ref.patch @@ -0,0 +1,13 @@ +diff --git a/src/osgUtil/tristripper/include/detail/graph_array.h b/src/osgUtil/tristripper/include/detail/graph_array.h +index dc1f38027..ce7000cc8 100644 +--- a/src/osgUtil/tristripper/include/detail/graph_array.h ++++ b/src/osgUtil/tristripper/include/detail/graph_array.h +@@ -446,7 +446,7 @@ inline void graph_array::swap(graph_type & Right) + template + inline void unmark_nodes(graph_array & G) + { +- std::for_each(G.begin(), G.end(), std::mem_fun_ref(&graph_array::node::unmark)); ++ for(typename graph_array::node_iterator itr = G.begin(); itr != G.end(); ++itr) itr->unmark(); + } + + diff --git a/recipes/openscenegraph/all/patches/0009-replace-auto-ptr-in-plugins.patch b/recipes/openscenegraph/all/patches/0009-replace-auto-ptr-in-plugins.patch new file mode 100644 index 0000000000000..de0f3ee7139ef --- /dev/null +++ b/recipes/openscenegraph/all/patches/0009-replace-auto-ptr-in-plugins.patch @@ -0,0 +1,75 @@ +diff --git a/src/osgPlugins/dae/ReaderWriterDAE.cpp b/src/osgPlugins/dae/ReaderWriterDAE.cpp +index fc1a448d4..3b883f19a 100644 +--- a/src/osgPlugins/dae/ReaderWriterDAE.cpp ++++ b/src/osgPlugins/dae/ReaderWriterDAE.cpp +@@ -32,7 +32,7 @@ + + #define SERIALIZER() OpenThreads::ScopedLock lock(_serializerMutex) + +-#if __cplusplus > 199711L ++#if ((defined(_MSVC_LANG) && _MSVC_LANG > 199711L) || __cplusplus > 199711L) + #define smart_ptr std::unique_ptr + #else + #define smart_ptr std::auto_ptr +diff --git a/src/osgPlugins/ffmpeg/FFmpegImageStream.cpp b/src/osgPlugins/ffmpeg/FFmpegImageStream.cpp +index 69826c456..9bba5532a 100644 +--- a/src/osgPlugins/ffmpeg/FFmpegImageStream.cpp ++++ b/src/osgPlugins/ffmpeg/FFmpegImageStream.cpp +@@ -10,6 +10,11 @@ + + #define STREAM_TIMEOUT_IN_SECONDS_TO_CONSIDER_IT_DEAD 10 + ++#if ((defined(_MSVC_LANG) && _MSVC_LANG > 199711L) || __cplusplus > 199711L) ++ template using smart_ptr = std::unique_ptr; ++#else ++ #define smart_ptr std::auto_ptr ++#endif + + namespace osgFFmpeg { + +@@ -23,8 +28,8 @@ FFmpegImageStream::FFmpegImageStream() : + { + setOrigin(osg::Image::TOP_LEFT); + +- std::auto_ptr decoder(new FFmpegDecoder); +- std::auto_ptr commands(new CommandQueue); ++ smart_ptr decoder(new FFmpegDecoder); ++ smart_ptr commands(new CommandQueue); + + m_decoder = decoder.release(); + m_commands = commands.release(); +diff --git a/src/osgPlugins/gdal/ReaderWriterGDAL.cpp b/src/osgPlugins/gdal/ReaderWriterGDAL.cpp +index 298e02fcc..113c9c45f 100644 +--- a/src/osgPlugins/gdal/ReaderWriterGDAL.cpp ++++ b/src/osgPlugins/gdal/ReaderWriterGDAL.cpp +@@ -34,6 +34,12 @@ + + #define SERIALIZER() OpenThreads::ScopedLock lock(_serializerMutex) + ++#if ((defined(_MSVC_LANG) && _MSVC_LANG > 199711L) || __cplusplus > 199711L) ++ #define smart_ptr std::unique_ptr ++#else ++ #define smart_ptr std::auto_ptr ++#endif ++ + // From easyrgb.com + float Hue_2_RGB( float v1, float v2, float vH ) + { +@@ -123,7 +129,7 @@ class ReaderWriterGDAL : public osgDB::ReaderWriter + + initGDAL(); + +- std::auto_ptr dataset((GDALDataset*)GDALOpen(fileName.c_str(),GA_ReadOnly)); ++ smart_ptr dataset((GDALDataset*)GDALOpen(fileName.c_str(),GA_ReadOnly)); + if (!dataset.get()) return ReadResult::FILE_NOT_HANDLED; + + int dataWidth = dataset->GetRasterXSize(); +@@ -577,7 +583,7 @@ class ReaderWriterGDAL : public osgDB::ReaderWriter + + initGDAL(); + +- std::auto_ptr dataset((GDALDataset*)GDALOpen(fileName.c_str(),GA_ReadOnly)); ++ smart_ptr dataset((GDALDataset*)GDALOpen(fileName.c_str(),GA_ReadOnly)); + if (!dataset.get()) return ReadResult::FILE_NOT_HANDLED; + + int dataWidth = dataset->GetRasterXSize(); diff --git a/recipes/openscenegraph/all/patches/0010-replace-ptr-fun-in-obj-plugin.patch b/recipes/openscenegraph/all/patches/0010-replace-ptr-fun-in-obj-plugin.patch new file mode 100644 index 0000000000000..139031361bc28 --- /dev/null +++ b/recipes/openscenegraph/all/patches/0010-replace-ptr-fun-in-obj-plugin.patch @@ -0,0 +1,24 @@ +diff --git a/src/osgPlugins/obj/obj.cpp b/src/osgPlugins/obj/obj.cpp +index 859add652..3580e5181 100644 +--- a/src/osgPlugins/obj/obj.cpp ++++ b/src/osgPlugins/obj/obj.cpp +@@ -37,10 +37,15 @@ using namespace obj; + + static std::string strip( const std::string& ss ) + { +- std::string result; +- result.assign( std::find_if( ss.begin(), ss.end(), std::not1( std::ptr_fun< int, int >( isspace ) ) ), +- std::find_if( ss.rbegin(), ss.rend(), std::not1( std::ptr_fun< int, int >( isspace ) ) ).base() ); +- return( result ); ++ std::string::const_iterator it = ss.begin(); ++ while (it != ss.end() && isspace(*it)) ++ it++; ++ ++ std::string::const_reverse_iterator rit = ss.rbegin(); ++ while (rit.base() != it && isspace(*rit)) ++ rit++; ++ ++ return std::string(it, rit.base()); + } + + /* diff --git a/recipes/openscenegraph/all/patches/0011-remove-deprecated-register.patch b/recipes/openscenegraph/all/patches/0011-remove-deprecated-register.patch new file mode 100644 index 0000000000000..9a1ea80d16a65 --- /dev/null +++ b/recipes/openscenegraph/all/patches/0011-remove-deprecated-register.patch @@ -0,0 +1,187 @@ +From b9f32bf6df5af101624bb065175097d8d96067c2 Mon Sep 17 00:00:00 2001 +From: czoido +Date: Thu, 25 Jan 2024 09:32:10 +0100 +Subject: [PATCH] remove deprecated register + +--- + src/osgPlugins/cfg/ConfigLexer.cpp | 40 ++++++++++++++--------------- + src/osgPlugins/cfg/ConfigParser.cpp | 16 ++++++------ + 2 files changed, 28 insertions(+), 28 deletions(-) + +diff --git a/src/osgPlugins/cfg/ConfigLexer.cpp b/src/osgPlugins/cfg/ConfigLexer.cpp +index 4e169efe4..cba6d6f9e 100644 +--- a/src/osgPlugins/cfg/ConfigLexer.cpp ++++ b/src/osgPlugins/cfg/ConfigLexer.cpp +@@ -832,9 +832,9 @@ YY_MALLOC_DECL + + YY_DECL + { +- register yy_state_type yy_current_state; +- register char *yy_cp, *yy_bp; +- register int yy_act; ++ yy_state_type yy_current_state; ++ char *yy_cp, *yy_bp; ++ int yy_act; + + #line 35 ".././ConfigLexer.l" + +@@ -881,7 +881,7 @@ YY_DECL + yy_match: + do + { +- register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; ++ YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { + yy_last_accepting_state = yy_current_state; +@@ -1598,9 +1598,9 @@ void yyFlexLexer::LexerOutput( const char* buf, int size ) + + int yyFlexLexer::yy_get_next_buffer() + { +- register char *dest = yy_current_buffer->yy_ch_buf; +- register char *source = yytext_ptr; +- register int number_to_move, i; ++ char *dest = yy_current_buffer->yy_ch_buf; ++ char *source = yytext_ptr; ++ int number_to_move, i; + int ret_val; + + if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) +@@ -1730,14 +1730,14 @@ int yyFlexLexer::yy_get_next_buffer() + + yy_state_type yyFlexLexer::yy_get_previous_state() + { +- register yy_state_type yy_current_state; +- register char *yy_cp; ++ yy_state_type yy_current_state; ++ char *yy_cp; + + yy_current_state = yy_start; + + for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) + { +- register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); ++ YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + yy_last_accepting_state = yy_current_state; +@@ -1764,10 +1764,10 @@ yy_state_type yyFlexLexer::yy_get_previous_state() + + yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state ) + { +- register int yy_is_jam; +- register char *yy_cp = yy_c_buf_p; ++ int yy_is_jam; ++ char *yy_cp = yy_c_buf_p; + +- register YY_CHAR yy_c = 1; ++ YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + yy_last_accepting_state = yy_current_state; +@@ -1786,9 +1786,9 @@ yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state ) + } + + +-void yyFlexLexer::yyunput( int c, register char* yy_bp ) ++void yyFlexLexer::yyunput( int c, char* yy_bp ) + { +- register char *yy_cp = yy_c_buf_p; ++ char *yy_cp = yy_c_buf_p; + + /* undo effects of setting up yytext */ + *yy_cp = yy_hold_char; +@@ -1796,10 +1796,10 @@ void yyFlexLexer::yyunput( int c, register char* yy_bp ) + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ +- register int number_to_move = yy_n_chars + 2; +- register char *dest = &yy_current_buffer->yy_ch_buf[ ++ int number_to_move = yy_n_chars + 2; ++ char *dest = &yy_current_buffer->yy_ch_buf[ + yy_current_buffer->yy_buf_size + 2]; +- register char *source = ++ char *source = + &yy_current_buffer->yy_ch_buf[number_to_move]; + + while ( source > yy_current_buffer->yy_ch_buf ) +@@ -2119,7 +2119,7 @@ yyconst char *s2; + int n; + #endif + { +- register int i; ++ int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; + } +@@ -2133,7 +2133,7 @@ static int yy_flex_strlen( s ) + yyconst char *s; + #endif + { +- register int n; ++ int n; + for ( n = 0; s[n]; ++n ) + ; + +diff --git a/src/osgPlugins/cfg/ConfigParser.cpp b/src/osgPlugins/cfg/ConfigParser.cpp +index 263c82896..62d30c3f5 100644 +--- a/src/osgPlugins/cfg/ConfigParser.cpp ++++ b/src/osgPlugins/cfg/ConfigParser.cpp +@@ -351,7 +351,7 @@ union yyalloc + # define YYCOPY(To, From, Count) \ + do \ + { \ +- register YYSIZE_T yyi; \ ++ YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ +@@ -1025,7 +1025,7 @@ yystrlen (yystr) + const char *yystr; + # endif + { +- register const char *yys = yystr; ++ const char *yys = yystr; + + while (*yys++ != '\0') + continue; +@@ -1050,8 +1050,8 @@ yystpcpy (yydest, yysrc) + const char *yysrc; + # endif + { +- register char *yyd = yydest; +- register const char *yys = yysrc; ++ char *yyd = yydest; ++ const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; +@@ -1175,8 +1175,8 @@ yyparse () + #endif + { + +- register int yystate; +- register int yyn; ++ int yystate; ++ int yyn; + int yyresult; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; +@@ -1194,12 +1194,12 @@ yyparse () + /* The state stack. */ + short yyssa[YYINITDEPTH]; + short *yyss = yyssa; +- register short *yyssp; ++ short *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs = yyvsa; +- register YYSTYPE *yyvsp; ++ YYSTYPE *yyvsp; + + + +-- +2.39.3 (Apple Git-145) + diff --git a/recipes/openscenegraph/all/test_package/CMakeLists.txt b/recipes/openscenegraph/all/test_package/CMakeLists.txt index c2aca0be1b70a..fcd48ccf6e39d 100644 --- a/recipes/openscenegraph/all/test_package/CMakeLists.txt +++ b/recipes/openscenegraph/all/test_package/CMakeLists.txt @@ -1,21 +1,58 @@ -cmake_minimum_required(VERSION 3.1.2) -project(test_package) - -include(${PROJECT_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - -find_package(OpenSceneGraph REQUIRED) - -include_directories(${OPENSCENEGRAPH_INCLUDE_DIRS}) -link_libraries(${OPENSCENEGRAPH_LIBRARIES}) -add_compile_definitions(${OPENSCENEGRAPH_COMPILE_DEFINITIONS}) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) +find_package(OpenSceneGraph REQUIRED CONFIG) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} OpenSceneGraph::OpenSceneGraph) -get_property(cache_variables DIRECTORY PROPERTY CACHE_VARIABLES) -foreach(cache_variable ${cache_variables}) - if("${cache_variable}" MATCHES "^OSG_HAS_(WITH_.+)$") - add_compile_definitions("${CMAKE_MATCH_1}=${${cache_variable}}") - endif() +get_directory_property(compile_definitions DIRECTORY ${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS) +foreach(compile_definition ${compile_definitions}) + if("${compile_definition}" MATCHES "(WITH_.+)=(1)$") + string(REPLACE "=" ";" definition_list ${compile_definition}) + list(GET definition_list 0 definition_key) + list(GET definition_list 1 definition_value) + message("Defined: ${definition_key}=${definition_value}") + if("${definition_key}" STREQUAL "WITH_BMP") + target_link_libraries(${PROJECT_NAME} openscenegraph::osgdb_bmp) + endif() + if("${definition_key}" STREQUAL "WITH_JPEG") + target_link_libraries(${PROJECT_NAME} openscenegraph::osgdb_jpeg) + endif() + if("${definition_key}" STREQUAL "WITH_JASPER") + target_link_libraries(${PROJECT_NAME} openscenegraph::osgdb_jp2) + endif() + if("${definition_key}" STREQUAL "WITH_OPENEXR") + target_link_libraries(${PROJECT_NAME} openscenegraph::osgdb_exr) + endif() + if("${definition_key}" STREQUAL "WITH_GIF") + target_link_libraries(${PROJECT_NAME} openscenegraph::osgdb_gif) + endif() + if("${definition_key}" STREQUAL "WITH_PNG") + target_link_libraries(${PROJECT_NAME} openscenegraph::osgdb_png) + endif() + if("${definition_key}" STREQUAL "WITH_TIFF") + target_link_libraries(${PROJECT_NAME} openscenegraph::osgdb_tiff) + endif() + if("${definition_key}" STREQUAL "WITH_GDAL") + target_link_libraries(${PROJECT_NAME} openscenegraph::osgdb_gdal) + endif() + if("${definition_key}" STREQUAL "WITH_GTA") + target_link_libraries(${PROJECT_NAME} openscenegraph::osgdb_gta) + endif() + if("${definition_key}" STREQUAL "WITH_DCMTK") + target_link_libraries(${PROJECT_NAME} openscenegraph::osgdb_dicom) + endif() + if("${definition_key}" STREQUAL "WITH_CURL") + target_link_libraries(${PROJECT_NAME} openscenegraph::osgdb_curl) + endif() + if("${definition_key}" STREQUAL "WITH_ZLIB") + target_link_libraries(${PROJECT_NAME} openscenegraph::osgdb_gz) + endif() + if("${definition_key}" STREQUAL "WITH_FREETYPE") + target_link_libraries(${PROJECT_NAME} openscenegraph::osgdb_freetype) + endif() + if("${definition_key}" STREQUAL "WITH_IMAGEIO") + target_link_libraries(${PROJECT_NAME} openscenegraph::osgdb_imageio) + endif() + endif() endforeach() - -add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/openscenegraph/all/test_package/conanfile.py b/recipes/openscenegraph/all/test_package/conanfile.py index 0e02c2d008408..b27efd09cb3f1 100644 --- a/recipes/openscenegraph/all/test_package/conanfile.py +++ b/recipes/openscenegraph/all/test_package/conanfile.py @@ -1,25 +1,43 @@ -from conans import CMake, ConanFile, tools +from conan import ConanFile +from conan.tools.apple import is_apple_os +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", "VirtualRunEnv" + test_type = "explicit" - def build(self): - cmake = CMake(self) - for key, value in self.options["openscenegraph"].items(): + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def generate(self): + tc = CMakeToolchain(self) + for key, value in self.dependencies["openscenegraph"].options.items(): if key.startswith("with_"): - cmake.definitions["OSG_HAS_" + key.upper()] = 1 if value else 0 - if self.settings.os == "Macos": - cmake.definitions["OSG_HAS_WITH_GIF"] = 0 - cmake.definitions["OSG_HAS_WITH_JPEG"] = 0 - cmake.definitions["OSG_HAS_WITH_PNG"] = 0 + tc.preprocessor_definitions[key.upper()] = 1 if str(value) != "False" else 0 + #OSG always builds the bmp plugin + tc.preprocessor_definitions["WITH_BMP"] = 1 + if is_apple_os(self): + tc.preprocessor_definitions["WITH_GIF"] = 0 + tc.preprocessor_definitions["WITH_JPEG"] = 0 + tc.preprocessor_definitions["WITH_PNG"] = 0 + # OSG builds the imageio plugin on apple platforms + tc.preprocessor_definitions["WITH_IMAGEIO"] = 1 + tc.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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/openscenegraph/all/test_package/test_package.cpp b/recipes/openscenegraph/all/test_package/test_package.cpp index d165af7b34733..c833eb8e3caee 100644 --- a/recipes/openscenegraph/all/test_package/test_package.cpp +++ b/recipes/openscenegraph/all/test_package/test_package.cpp @@ -4,14 +4,8 @@ #include #include -// OSG always builds the bmp plugin -#define WITH_BMP 1 - -// OSG builds the imageio plugin on apple platforms -#ifdef __APPLE__ -# define WITH_IMAGEIO 1 -#else -# define WITH_IMAGEIO 0 +#ifndef WITH_IMAGEIO +#define WITH_IMAGEIO 0 #endif #ifdef OSG_LIBRARY_STATIC diff --git a/recipes/openslide/all/conandata.yml b/recipes/openslide/all/conandata.yml new file mode 100644 index 0000000000000..ca29cdf478653 --- /dev/null +++ b/recipes/openslide/all/conandata.yml @@ -0,0 +1,10 @@ +sources: + "4.0.0": + url: "https://github.com/openslide/openslide/releases/download/v4.0.0/openslide-4.0.0.tar.xz" + sha256: "cc227c44316abb65fb28f1c967706eb7254f91dbfab31e9ae6a48db6cf4ae562" +patches: + "4.0.0": + - patch_file: "patches/0001-no-openslide-poison.patch" + patch_description: "Fix 'error__use__openslide_fclose_instead' compilation error" + patch_type: "backport" + patch_source: "https://github.com/openslide/openslide/commit/048865a3b61e9bc2b61219168d434b61e784d355" diff --git a/recipes/openslide/all/conanfile.py b/recipes/openslide/all/conanfile.py new file mode 100644 index 0000000000000..0557d9913ef70 --- /dev/null +++ b/recipes/openslide/all/conanfile.py @@ -0,0 +1,138 @@ +import os + +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, export_conandata_patches, apply_conandata_patches +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 + +required_conan_version = ">=1.53.0" + + +class OpenSlideConan(ConanFile): + name = "openslide" + description = "OpenSlide is a C library for reading whole slide image files (also known as virtual slides)" + license = "LGPL-2.1" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://openslide.org/" + topics = ("image", "pathology", "whole-slide-imaging", "slide-image", + # supported formats + "bif", "dicom", "dcm", "mrxs", "ndpi", "scn", "svs", "svslide", "tiff", "vms", "vmu") + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "jpeg": ["libjpeg", "libjpeg-turbo", "mozjpeg"], + } + default_options = { + "shared": False, + "fPIC": True, + "jpeg": "libjpeg", + } + + 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 requirements(self): + self.requires("cairo/1.18.0") + self.requires("gdk-pixbuf/2.42.10") + self.requires("glib/2.78.3") + self.requires("libdicom/1.0.5") + self.requires("libpng/[>=1.6 <2]") + self.requires("libtiff/4.6.0") + self.requires("libxml2/[>=2.12.5 <3]") + self.requires("openjpeg/2.5.2") + self.requires("sqlite3/3.45.3") + self.requires("zlib/[>=1.2.11 <2]") + if self.options.jpeg == "libjpeg": + self.requires("libjpeg/9e") + elif self.options.jpeg == "libjpeg-turbo": + self.requires("libjpeg-turbo/3.0.2") + elif self.options.jpeg == "mozjpeg": + self.requires("mozjpeg/4.1.5") + + def validate(self): + if is_msvc(self): + raise ConanInvalidConfiguration("OpenSlide requires GNU C extensions support and is not compatible with MSVC") + + def build_requirements(self): + self.tool_requires("meson/[>=1.2.3 <2]") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/[>=2.2 <3]") + self.tool_requires("glib/") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + venv = VirtualBuildEnv(self) + venv.generate() + tc = MesonToolchain(self) + tc.project_options["test"] = "disabled" + tc.project_options["doc"] = "disabled" + tc.generate() + deps = PkgConfigDeps(self) + deps.generate() + + def build(self): + apply_conandata_patches(self) + meson = Meson(self) + meson.configure() + meson.build() + + def package(self): + copy(self, "COPYING.LESSER", 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")) + 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")) + fix_apple_shared_install_name(self) + + def package_info(self): + self.cpp_info.libs = ["openslide"] + self.cpp_info.includedirs.append(os.path.join("include", "openslide")) + + if self.settings.os == "Macos": + self.cpp_info.frameworks = ["CoreText"] + + self.cpp_info.requires = [ + "cairo::cairo_", + "gdk-pixbuf::gdk-pixbuf", + "glib::gio-2.0", + "glib::glib-2.0", + "glib::gobject-2.0", + "libdicom::libdicom", + "libpng::libpng", + "libtiff::libtiff", + "libxml2::libxml2", + "openjpeg::openjpeg", + "sqlite3::sqlite3", + "zlib::zlib", + ] + 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") diff --git a/recipes/openslide/all/patches/0001-no-openslide-poison.patch b/recipes/openslide/all/patches/0001-no-openslide-poison.patch new file mode 100644 index 0000000000000..00a38642d6421 --- /dev/null +++ b/recipes/openslide/all/patches/0001-no-openslide-poison.patch @@ -0,0 +1,308 @@ +From 048865a3b61e9bc2b61219168d434b61e784d355 Mon Sep 17 00:00:00 2001 +From: Benjamin Gilbert +Date: Mon, 12 Feb 2024 20:44:45 +0900 +Subject: [PATCH] Replace _OPENSLIDE_POISON() with pre-commit check + +Preprocessor macros are somewhat clunky as a way to prevent use of +forbidden functions. Now that we have pre-commit checks, use those +instead. Allow forbidden function calls in wrapper implementations by +ignoring call sites with "ci-allow" in a comment on the same line. + +Signed-off-by: Benjamin Gilbert +--- + .pre-commit-config.yaml | 29 +++++++++++++++++++++++++++++ + src/openslide-decode-sqlite.c | 10 +++------- + src/openslide-decode-tiff.c | 8 ++------ + src/openslide-file.c | 20 +++++++------------- + src/openslide-jdatasrc.c | 2 +- + src/openslide-private.h | 27 --------------------------- + src/openslide-util.c | 4 +--- + src/openslide-vendor-synthetic.c | 7 +++---- + 8 files changed, 46 insertions(+), 61 deletions(-) + +diff --git a/src/openslide-decode-sqlite.c b/src/openslide-decode-sqlite.c +index f75083df5..119b71b5a 100644 +--- a/src/openslide-decode-sqlite.c ++++ b/src/openslide-decode-sqlite.c +@@ -44,7 +44,6 @@ static int profile_callback(unsigned trace_type G_GNUC_UNUSED, + return 0; + } + +-#undef sqlite3_open_v2 + static sqlite3 *do_open(const char *filename, int flags, GError **err) { + sqlite3 *db; + +@@ -55,7 +54,7 @@ static sqlite3 *do_open(const char *filename, int flags, GError **err) { + return NULL; + } + +- ret = sqlite3_open_v2(filename, &db, flags, NULL); ++ ret = sqlite3_open_v2(filename, &db, flags, NULL); // ci-allow + + if (ret) { + if (db) { +@@ -76,7 +75,6 @@ static sqlite3 *do_open(const char *filename, int flags, GError **err) { + + return db; + } +-#define sqlite3_open_v2 _OPENSLIDE_POISON(_openslide_sqlite_open) + + sqlite3 *_openslide_sqlite_open(const char *filename, GError **err) { + // ":" filename prefix is reserved. +@@ -131,12 +129,10 @@ void _openslide_sqlite_propagate_stmt_error(sqlite3_stmt *stmt, GError **err) { + _openslide_sqlite_propagate_error(sqlite3_db_handle(stmt), err); + } + +-#undef sqlite3_close + void _openslide_sqlite_close(sqlite3 *db) { +- // sqlite3_close() failures indicate a leaked resource, probably a ++ // sqlite3_close failures indicate a leaked resource, probably a + // prepared statement. +- if (sqlite3_close(db)) { ++ if (sqlite3_close(db)) { // ci-allow + g_warning("SQLite error: %s", sqlite3_errmsg(db)); + } + } +-#define sqlite3_close _OPENSLIDE_POISON(_openslide_sqlite_close) +diff --git a/src/openslide-decode-tiff.c b/src/openslide-decode-tiff.c +index 0af196479..ed294f18f 100644 +--- a/src/openslide-decode-tiff.c ++++ b/src/openslide-decode-tiff.c +@@ -74,7 +74,6 @@ struct associated_image { + result = tmp; \ + } while (0) + +-#undef TIFFSetDirectory + bool _openslide_tiff_set_dir(TIFF *tiff, + tdir_t dir, + GError **err) { +@@ -82,14 +81,13 @@ bool _openslide_tiff_set_dir(TIFF *tiff, + // avoid libtiff unnecessarily rereading directory contents + return true; + } +- if (!TIFFSetDirectory(tiff, dir)) { ++ if (!TIFFSetDirectory(tiff, dir)) { // ci-allow + g_set_error(err, OPENSLIDE_ERROR, OPENSLIDE_ERROR_FAILED, + "Cannot set TIFF directory %d", dir); + return false; + } + return true; + } +-#define TIFFSetDirectory _OPENSLIDE_POISON(_openslide_tiff_set_dir) + + bool _openslide_tiff_level_init(TIFF *tiff, + tdir_t dir, +@@ -587,7 +585,6 @@ static toff_t tiff_do_size(thandle_t th) { + return hdl->size; + } + +-#undef TIFFClientOpen + static TIFF *tiff_open(struct _openslide_tiffcache *tc, GError **err) { + // open + g_autoptr(_openslide_file) f = _openslide_fopen(tc->filename, err); +@@ -646,7 +643,7 @@ static TIFF *tiff_open(struct _openslide_tiffcache *tc, GError **err) { + + // TIFFOpen + // mode: m disables mmap to avoid sigbus and other mmap fragility +- TIFF *tiff = TIFFClientOpen(tc->filename, "rm", hdl, ++ TIFF *tiff = TIFFClientOpen(tc->filename, "rm", hdl, // ci-allow + tiff_do_read, tiff_do_write, tiff_do_seek, + tiff_do_close, tiff_do_size, NULL, NULL); + if (tiff == NULL) { +@@ -656,7 +653,6 @@ static TIFF *tiff_open(struct _openslide_tiffcache *tc, GError **err) { + } + return tiff; + } +-#define TIFFClientOpen _OPENSLIDE_POISON(_openslide_tiffcache_get) + + struct _openslide_tiffcache *_openslide_tiffcache_create(const char *filename) { + struct _openslide_tiffcache *tc = g_new0(struct _openslide_tiffcache, 1); +diff --git a/src/openslide-file.c b/src/openslide-file.c +index 2763f3807..9eb9b1039 100644 +--- a/src/openslide-file.c ++++ b/src/openslide-file.c +@@ -22,7 +22,6 @@ + + #include + +-#define NO_POISON_FSEEKO + #include "openslide-private.h" + + #include +@@ -44,13 +43,8 @@ struct _openslide_dir { + GDir *dir; + }; + +-#undef fopen +-#undef fread +-#undef fclose +-#undef g_file_test +- + static void wrap_fclose(FILE *fp) { +- fclose(fp); ++ fclose(fp); // ci-allow + } + G_DEFINE_AUTOPTR_CLEANUP_FUNC(FILE, wrap_fclose) + +@@ -87,7 +81,7 @@ static FILE *do_fopen(const char *path, const char *mode, GError **err) { + io_error(err, "Couldn't open %s", path); + } + #else +- f = fopen(path, mode); ++ f = fopen(path, mode); // ci-allow + if (f == NULL) { + io_error(err, "Couldn't open %s", path); + } +@@ -132,7 +126,7 @@ size_t _openslide_fread(struct _openslide_file *file, void *buf, size_t size) { + char *bufp = buf; + size_t total = 0; + while (total < size) { +- size_t count = fread(bufp + total, 1, size - total, file->fp); ++ size_t count = fread(bufp + total, 1, size - total, file->fp); // ci-allow + if (count == 0) { + return total; + } +@@ -143,7 +137,7 @@ size_t _openslide_fread(struct _openslide_file *file, void *buf, size_t size) { + + bool _openslide_fseek(struct _openslide_file *file, off_t offset, int whence, + GError **err) { +- if (fseeko(file->fp, offset, whence)) { ++ if (fseeko(file->fp, offset, whence)) { // ci-allow + g_set_error(err, G_FILE_ERROR, g_file_error_from_errno(errno), + "%s", g_strerror(errno)); + return false; +@@ -152,7 +146,7 @@ bool _openslide_fseek(struct _openslide_file *file, off_t offset, int whence, + } + + off_t _openslide_ftell(struct _openslide_file *file, GError **err) { +- off_t ret = ftello(file->fp); ++ off_t ret = ftello(file->fp); // ci-allow + if (ret == -1) { + g_set_error(err, G_FILE_ERROR, g_file_error_from_errno(errno), + "%s", g_strerror(errno)); +@@ -179,12 +173,12 @@ off_t _openslide_fsize(struct _openslide_file *file, GError **err) { + } + + void _openslide_fclose(struct _openslide_file *file) { +- fclose(file->fp); ++ fclose(file->fp); // ci-allow + g_free(file); + } + + bool _openslide_fexists(const char *path, GError **err G_GNUC_UNUSED) { +- return g_file_test(path, G_FILE_TEST_EXISTS); ++ return g_file_test(path, G_FILE_TEST_EXISTS); // ci-allow + } + + struct _openslide_dir *_openslide_dir_open(const char *dirname, GError **err) { +diff --git a/src/openslide-jdatasrc.c b/src/openslide-jdatasrc.c +index 2ad068818..4de54eddf 100644 +--- a/src/openslide-jdatasrc.c ++++ b/src/openslide-jdatasrc.c +@@ -158,7 +158,7 @@ static void skip_input_data (j_decompress_ptr cinfo, long num_bytes) + { + struct jpeg_source_mgr * src = cinfo->src; + +- /* Just a dumb implementation for now. Could use fseek() except ++ /* Just a dumb implementation for now. Could use fseek except + * it doesn't work on pipes. Not clear that being smart is worth + * any trouble anyway --- large skips are infrequent. + */ +diff --git a/src/openslide-private.h b/src/openslide-private.h +index 5ae36939b..ed08f5ed7 100644 +--- a/src/openslide-private.h ++++ b/src/openslide-private.h +@@ -383,33 +383,6 @@ extern const int32_t _openslide_G_Cb[256]; + extern const int32_t _openslide_G_Cr[256]; + extern const int16_t _openslide_B_Cb[256]; + +-/* Prevent use of dangerous functions and functions with mandatory wrappers. +- Every @p replacement must be unique to avoid conflicting-type errors. */ +-#define _OPENSLIDE_POISON(replacement) error__use_ ## replacement ## _instead +-#define fopen _OPENSLIDE_POISON(_openslide_fopen) +-#define fread _OPENSLIDE_POISON(_openslide_fread) +-#define fseek _OPENSLIDE_POISON(_openslide_fseek) +-#define ftell _OPENSLIDE_POISON(_openslide_ftell) +-#define fclose _OPENSLIDE_POISON(_openslide_fclose) +-#define g_file_test _OPENSLIDE_POISON(_openslide_fexists) +-#define strtod _OPENSLIDE_POISON(_openslide_parse_double) +-#define g_ascii_strtod _OPENSLIDE_POISON(_openslide_parse_double_) +-#define sqlite3_open _OPENSLIDE_POISON(_openslide_sqlite_open) +-#define sqlite3_open_v2 _OPENSLIDE_POISON(_openslide_sqlite_open_) +-#define sqlite3_close _OPENSLIDE_POISON(_openslide_sqlite_close) +-#define TIFFClientOpen _OPENSLIDE_POISON(_openslide_tiffcache_get) +-#define TIFFFdOpen _OPENSLIDE_POISON(_openslide_tiffcache_get_) +-#define TIFFOpen _OPENSLIDE_POISON(_openslide_tiffcache_get__) +-#define TIFFSetDirectory _OPENSLIDE_POISON(_openslide_tiff_set_dir) +- +-#ifndef NO_POISON_FSEEKO +-// openslide-file.c needs the original macros +-#undef fseeko +-#undef ftello +-#define fseeko _OPENSLIDE_POISON(_openslide_fseek_) +-#define ftello _OPENSLIDE_POISON(_openslide_ftell_) +-#endif +- + #ifdef _WIN32 + // Prevent windows.h from defining the IN/OUT macro + #define _NO_W32_PSEUDO_MODIFIERS +diff --git a/src/openslide-util.c b/src/openslide-util.c +index 719953274..b85f9afa3 100644 +--- a/src/openslide-util.c ++++ b/src/openslide-util.c +@@ -170,7 +170,6 @@ void *_openslide_inflate_buffer(const void *src, int64_t src_len, + return g_steal_pointer(&dst); + } + +-#undef g_ascii_strtod + double _openslide_parse_double(const char *value) { + // Canonicalize comma to decimal point, since the locale of the + // originating system sometimes leaks into slide files. +@@ -180,14 +179,13 @@ double _openslide_parse_double(const char *value) { + + char *endptr; + errno = 0; +- double result = g_ascii_strtod(canonical, &endptr); ++ double result = g_ascii_strtod(canonical, &endptr); // ci-allow + // fail on overflow/underflow + if (canonical[0] == 0 || endptr[0] != 0 || errno == ERANGE) { + return NAN; + } + return result; + } +-#define g_ascii_strtod _OPENSLIDE_POISON(_openslide_parse_double) + + char *_openslide_format_double(double d) { + char buf[G_ASCII_DTOSTR_BUF_SIZE]; +diff --git a/src/openslide-vendor-synthetic.c b/src/openslide-vendor-synthetic.c +index e3a440569..79938a597 100644 +--- a/src/openslide-vendor-synthetic.c ++++ b/src/openslide-vendor-synthetic.c +@@ -204,7 +204,6 @@ static toff_t mem_tiff_size(thandle_t th) { + return mem->size; + } + +-#undef TIFFClientOpen + static bool decode_tiff(const void *data, uint32_t len, + uint32_t *dest, GError **err) { + // there's no reason for OpenSlide as a whole to support reading entire +@@ -216,8 +215,9 @@ static bool decode_tiff(const void *data, uint32_t len, + }; + // mode: m disables mmap to avoid sigbus and other mmap fragility + g_autoptr(TIFF) tiff = +- TIFFClientOpen("tiff", "rm", &mem, mem_tiff_read, mem_tiff_write, +- mem_tiff_seek, mem_tiff_close, mem_tiff_size, NULL, NULL); ++ TIFFClientOpen("tiff", "rm", &mem, mem_tiff_read, // ci-allow ++ mem_tiff_write, mem_tiff_seek, mem_tiff_close, ++ mem_tiff_size, NULL, NULL); + if (tiff == NULL) { + g_set_error(err, OPENSLIDE_ERROR, OPENSLIDE_ERROR_FAILED, + "Couldn't open TIFF"); +@@ -238,7 +238,6 @@ static bool decode_tiff(const void *data, uint32_t len, + + return _openslide_tiff_read_tile(&tiffl, tiff, dest, 0, 0, err); + } +-#define TIFFClientOpen _OPENSLIDE_POISON(_openslide_tiffcache_get) + + static bool decode_xml(const void *data, uint32_t len, + uint32_t *dest, GError **err) { diff --git a/recipes/openslide/all/test_package/conanfile.py b/recipes/openslide/all/test_package/conanfile.py new file mode 100644 index 0000000000000..2e3df45816e5a --- /dev/null +++ b/recipes/openslide/all/test_package/conanfile.py @@ -0,0 +1,32 @@ +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): + 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/1.2.3") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/2.0.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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/openslide/all/test_package/meson.build b/recipes/openslide/all/test_package/meson.build new file mode 100644 index 0000000000000..b22a34bfa7460 --- /dev/null +++ b/recipes/openslide/all/test_package/meson.build @@ -0,0 +1,5 @@ +project('test_package', 'c') +package_dep = dependency('openslide') +executable('test_package', + sources : ['test_package.c'], + dependencies : [package_dep]) diff --git a/recipes/openslide/all/test_package/test_package.c b/recipes/openslide/all/test_package/test_package.c new file mode 100644 index 0000000000000..ea806b718030d --- /dev/null +++ b/recipes/openslide/all/test_package/test_package.c @@ -0,0 +1,7 @@ +#include +#include + +int main() { + printf("OpenSlide version: %s\n", openslide_get_version()); + return 0; +} diff --git a/recipes/openslide/config.yml b/recipes/openslide/config.yml new file mode 100644 index 0000000000000..d2be8f453d7c0 --- /dev/null +++ b/recipes/openslide/config.yml @@ -0,0 +1,3 @@ +versions: + "4.0.0": + folder: all diff --git a/recipes/openssh/all/conandata.yml b/recipes/openssh/all/conandata.yml new file mode 100644 index 0000000000000..a3e0ea1fc2e6b --- /dev/null +++ b/recipes/openssh/all/conandata.yml @@ -0,0 +1,10 @@ +sources: + "9.9p1": + url: "https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-9.9p1.tar.gz" + sha256: "b343fbcdbff87f15b1986e6e15d6d4fc9a7d36066be6b7fb507087ba8f966c02" + "9.6p1": + url: "https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-9.6p1.tar.gz" + sha256: "910211c07255a8c5ad654391b40ee59800710dd8119dd5362de09385aa7a777c" + "9.1p1": + url: "https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-9.1p1.tar.gz" + sha256: "19f85009c7e3e23787f0236fbb1578392ab4d4bf9f8ec5fe6bc1cd7e8bfdd288" diff --git a/recipes/openssh/all/conanfile.py b/recipes/openssh/all/conanfile.py new file mode 100644 index 0000000000000..193d5c2993c51 --- /dev/null +++ b/recipes/openssh/all/conanfile.py @@ -0,0 +1,141 @@ +from os.path import join + +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, export_conandata_patches +from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps +from conan.tools.layout import basic_layout + +required_conan_version = ">=1.54.0" + + +class PackageConan(ConanFile): + name = "openssh" + description = "The OpenSSH (portable) suite of secure connectivity tools" + license = "SSH-OpenSSH" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://www.openssh.com/portable.html" + topics = ("security", "cryptography", "login", "keychain", "file-sharing", "ssh") + package_type = "application" + settings = "os", "arch", "compiler", "build_type" + options = { + "with_libcrypto": [False, "libressl", "openssl"], + "with_pam": [False, "openpam"], # linux-pam and Solaris PAM are also supported + "with_selinux": [True, False], + "with_libedit": [True, False], + "with_strip": [True, False], + "with_sandbox": [False, "auto", "capsicum", "darwin", "rlimit", "seccomp_filter", "systrace", "pledge"] + } + default_options = { + "with_libcrypto": "openssl", + "with_pam": False, + "with_selinux": False, + "with_libedit": False, + "with_strip": True, + "with_sandbox": "auto" + } + + def package_id(self): + del self.info.settings.compiler + del self.info.settings.build_type + + def export_sources(self): + export_conandata_patches(self) + + def configure(self): + 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("zlib/[>=1.2.11 <2]") + if self.options.with_libcrypto == "openssl": + self.requires("openssl/[>=1.1 <4]") + elif self.options.with_libcrypto == "libressl": + self.requires("libressl/3.9.1") + if self.options.with_pam == "openpam": + self.requires("openpam/20190224") + if self.options.with_libedit: + self.requires("editline/3.1") + + def validate(self): + if self.settings.os in ["baremetal", "Windows"]: + raise ConanInvalidConfiguration(f"{self.ref} is not supported on {self.settings.os}.") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + if self.version in ["9.1p1", "9.6p1"]: + # Backport configure script fix to accept OpenSSL versions in the 3.x series + # See https://github.com/openssh/openssh-portable/commit/2eded551ba96e66bc3afbbcc883812c2eac02bd7 + replace_in_file(self, join(self.source_folder, "configure"), "300*", "30*") + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + + ad = AutotoolsDeps(self) + ad.generate() + + tc = AutotoolsToolchain(self) + tc.configure_args.append("--without-zlib-version-check") + + if not self.options.with_strip: + tc.configure_args.append("--disable-strip") + + if self.options.with_selinux: + tc.configure_args.append("--with-selinux") + + if self.options.with_pam: + tc.configure_args.append("--with-pam") + + if self.options.with_libedit: + editline = self.dependencies["editline"] + tc.configure_args.append("--with-libedit={}".format(editline.package_folder)) + + if self.options.with_libcrypto == "openssl": + openssl = self.dependencies["openssl"] + tc.configure_args.append("--with-ssl-dir={}".format(openssl.package_folder)) + # It needs libcrypto.so in build time context + if openssl.options.shared: + env = VirtualRunEnv(self) + env.generate(scope="build") + elif self.options.with_libcrypto == "libressl": + libressl = self.dependencies["libressl"] + tc.configure_args.append("--with-ssl-dir={}".format(libressl.package_folder)) + else: + tc.configure_args.append("--without-openssl") + + if self.options.with_sandbox != 'auto': + tc.configure_args.append("--with-sandbox={}".format(self.options.with_sandbox or "no")) + + tc.generate() + + def build(self): + autotools = Autotools(self) + autotools.configure() + autotools.make() + + def package(self): + autotools = Autotools(self) + + install_target = 'install-nokeys' if cross_building(self) else 'install' + autotools.install(target=install_target) + + copy(self, "LICENCE", src=self.source_folder, dst=join(self.package_folder, "licenses"), ignore_case=True) + copy(self, "*", src=join(self.package_folder, "libexec"), dst=join(self.package_folder, "bin"), ignore_case=True) + + rmdir(self, join(self.package_folder, "etc")) + rmdir(self, join(self.package_folder, "var")) + rmdir(self, join(self.package_folder, "share")) + rmdir(self, join(self.package_folder, "libexec")) + + def package_info(self): + self.cpp_info.includedirs = [] + self.cpp_info.libdirs = [] + + bindir = join(self.package_folder, "bin") + self.runenv_info.prepend_path("PATH", bindir) diff --git a/recipes/openssh/all/test_package/conanfile.py b/recipes/openssh/all/test_package/conanfile.py new file mode 100644 index 0000000000000..6198df68dc282 --- /dev/null +++ b/recipes/openssh/all/test_package/conanfile.py @@ -0,0 +1,18 @@ +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 build(self): + pass + + def test(self): + if can_run(self): + self.run("ssh -Q help", env="conanrun") diff --git a/recipes/openssh/config.yml b/recipes/openssh/config.yml new file mode 100644 index 0000000000000..4bf3079108d3e --- /dev/null +++ b/recipes/openssh/config.yml @@ -0,0 +1,7 @@ +versions: + "9.9p1": + folder: all + "9.6p1": + folder: all + "9.1p1": + folder: all diff --git a/recipes/openssl/1.x.x/conandata.yml b/recipes/openssl/1.x.x/conandata.yml index bf78950f0ec35..26bc447884d03 100644 --- a/recipes/openssl/1.x.x/conandata.yml +++ b/recipes/openssl/1.x.x/conandata.yml @@ -1,43 +1,9 @@ sources: - 1.0.2u: - sha256: ecd0c6ffb493dd06707d38b14bb4d8c2288bb7033735606569d8f90f89669d16 - 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/1.1.0/openssl-1.1.0l.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/1.1.1/openssl-1.1.1p.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/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" + 1.1.1w: + sha256: cf3098950cb4d853ad95c0841f1f9c6d3dc102dccfcacd521d93925208b76ac8 + url: "https://github.com/openssl/openssl/releases/download/OpenSSL_1_1_1w/openssl-1.1.1w.tar.gz" patches: - 1.0.2u: - - patch_file: patches/1.0.2u-darwin-arm64.patch - patch_description: "Darwin ARM64 support" - patch_type: "portability" - 1.1.1p: - - patch_file: patches/1.1.1-tvos-watchos.patch - patch_description: "TVOS and WatchOS don't like fork()" - patch_type: "portability" - 1.1.1q: - - patch_file: patches/1.1.1-tvos-watchos.patch - patch_description: "TVOS and WatchOS don't like fork()" - patch_type: "portability" - 1.1.1s: + 1.1.1w: - patch_file: patches/1.1.1-tvos-watchos.patch 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 1b16b3a2fb4f8..424f65ac487e9 100644 --- a/recipes/openssl/1.x.x/conanfile.py +++ b/recipes/openssl/1.x.x/conanfile.py @@ -1,15 +1,17 @@ from conan import ConanFile, conan_version -from conan.tools.env import Environment +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os, XCRun from conan.tools.build import cross_building -from conan.tools.layout import basic_layout +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, AutotoolsDeps +from conan.tools.layout import basic_layout from conan.tools.microsoft import is_msvc, msvc_runtime_flag, unix_path -from conan.tools.apple import is_apple_os, XCRun from conan.tools.scm import Version -from conan.errors import ConanInvalidConfiguration -from conan.tools.files import chdir, copy, rename, rmdir, load, save, get, apply_conandata_patches, export_conandata_patches, replace_in_file from contextlib import contextmanager -from functools import total_ordering import fnmatch import json import os @@ -17,58 +19,6 @@ required_conan_version = ">=1.53.0" -@total_ordering -class OpenSSLVersion(object): - def __init__(self, version): - self._pre = "" - version_str = str(version) - - tokens = version_str.split("-") - if len(tokens) > 1: - self._pre = tokens[1] - version_str = tokens[0] - - tokens = version_str.split(".") - self._major = int(tokens[0]) - self._minor = 0 - self._patch = 0 - self._build = "" - if len(tokens) > 1: - self._minor = int(tokens[1]) - if len(tokens) > 2: - self._patch = tokens[2] - if self._patch[-1].isalpha(): - self._build = self._patch[-1] - self._patch = self._patch[:1] - self._patch = int(self._patch) - - @property - def base(self): - return "%s.%s.%s" % (self._major, self._minor, self._patch) - - @property - def as_list(self): - return [self._major, self._minor, self._patch, self._build, self._pre] - - def __eq__(self, other): - return self.compare(other) == 0 - - def __lt__(self, other): - return self.compare(other) == -1 - - def __hash__(self): - return hash(self.as_list) - - def compare(self, other): - if not isinstance(other, OpenSSLVersion): - other = OpenSSLVersion(other) - if self.as_list == other.as_list: - return 0 - if self.as_list < other.as_list: - return -1 - else: - return 1 - class OpenSSLConan(ConanFile): name = "openssl" @@ -82,7 +32,6 @@ class OpenSSLConan(ConanFile): settings = "os", "arch", "compiler", "build_type" options = { "no_threads": [True, False], - "no_zlib": [True, False], "shared": [True, False], "fPIC": [True, False], "no_asm": [True, False], @@ -97,12 +46,9 @@ class OpenSSLConan(ConanFile): "no_dh": [True, False], "no_dsa": [True, False], "no_hmac": [True, False], - "no_md2": [True, False], "no_md5": [True, False], "no_mdc2": [True, False], "no_rc2": [True, False], - "no_rc4": [True, False], - "no_rc5": [True, False], "no_rsa": [True, False], "no_sha": [True, False], "no_async": [True, False], @@ -142,16 +88,16 @@ class OpenSSLConan(ConanFile): "no_tls1": [True, False], "capieng_dialog": [True, False], "enable_capieng": [True, False], - "openssldir": ["ANY", None] + "openssldir": [None, "ANY"], } default_options = {key: False for key in options.keys()} default_options["fPIC"] = True - default_options["no_md2"] = True default_options["openssldir"] = None @property - def _is_clangcl(self): - return self.settings.compiler == "clang" and self.settings.os == "Windows" + def _is_clang_cl(self): + return self.settings.os == "Windows" and self.settings.compiler == "clang" and \ + self.settings.compiler.get_safe("runtime") @property def _is_mingw(self): @@ -159,54 +105,21 @@ def _is_mingw(self): @property def _use_nmake(self): - return self._is_clangcl or is_msvc(self) + return self._is_clang_cl or is_msvc(self) @property def _settings_build(self): return getattr(self, "settings_build", self.settings) - @property - def _full_version(self): - return OpenSSLVersion(self.version) - def export_sources(self): export_conandata_patches(self) def config_options(self): - if self._full_version >= "1.1.0": - del self.options.no_md2 - del self.options.no_rc4 - del self.options.no_rc5 - del self.options.no_zlib - - if self._full_version < "1.1.0": - del self.options.no_camellia - del self.options.no_cast - del self.options.no_cms - del self.options.no_comp - del self.options.no_dgram - del self.options.no_engine - del self.options.no_idea - del self.options.no_md4 - del self.options.no_ocsp - del self.options.no_seed - del self.options.no_sock - del self.options.no_srp - del self.options.no_ts - del self.options.no_whirlpool - - if self._full_version < "1.1.1": - del self.options.no_aria - del self.options.no_pinshared - del self.options.no_sm2 - del self.options.no_sm3 - del self.options.no_sm4 - - if self.settings.os != "Windows": + if self.settings.os == "Windows": + del self.options.fPIC + else: del self.options.capieng_dialog del self.options.enable_capieng - else: - del self.options.fPIC if self.settings.os == "Emscripten": self.options.no_asm = True @@ -220,9 +133,8 @@ def configure(self): self.settings.rm_safe("compiler.libcxx") self.settings.rm_safe("compiler.cppstd") - def requirements(self): - if self._full_version < "1.1.0" and not self.options.get_safe("no_zlib"): - self.requires("zlib/1.2.12") + def layout(self): + basic_layout(self, src_folder="src") def validate(self): if self.settings.os == "Emscripten": @@ -231,29 +143,22 @@ def validate(self): def build_requirements(self): if self._settings_build.os == "Windows": - if not self.win_bash: - self.tool_requires("strawberryperl/5.30.0.1") if not self.options.no_asm: - self.tool_requires("nasm/2.15.05") - if self.win_bash and not os.getenv("CONAN_BASH_PATH") and not self._use_nmake: - self.build_requires("msys2/cci.latest") - - def layout(self): - basic_layout(self, src_folder="src") + self.tool_requires("nasm/2.16.01") + 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_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], 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}"] @@ -262,28 +167,13 @@ def generate(self): env.define("PERL", self._perl) tc.generate(env) gen_info = {} - gen_info["CFLAGS"] = tc.cflags + gen_info["CFLAGS"] = tc.cflags gen_info["CXXFLAGS"] = tc.cxxflags gen_info["DEFINES"] = tc.defines gen_info["LDFLAGS"] = tc.ldflags - # Support for self.dependencies in build() method is currently restricted to `generate()` and `validate()` - # See https://github.com/conan-io/conan/issues/12411 for more details - if self._full_version < "1.1.0" and not self.options.get_safe("no_zlib"): - zlib_cpp_info = self.dependencies["zlib"].cpp_info - 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): - if self._full_version < "1.1.0" and self.settings.build_type == "Debug": - return "debug-" - return "" @property def _target(self): @@ -319,46 +209,14 @@ def _perlasm_scheme(self): "x86_64": "elf"}.get(the_arch, None) return None - @property - def _asm_target(self): - the_os = str(self.settings.os) - if the_os in ["Android", "iOS", "watchOS", "tvOS"]: - return { - "x86": "x86_asm" if the_os == "Android" else None, - "x86_64": "x86_64_asm" if the_os == "Android" else None, - "armv5el": "armv4_asm", - "armv5hf": "armv4_asm", - "armv6": "armv4_asm", - "armv7": "armv4_asm", - "armv7hf": "armv4_asm", - "armv7s": "armv4_asm", - "armv7k": "armv4_asm", - "armv8": "aarch64_asm", - "armv8_32": "aarch64_asm", - "armv8.3": "aarch64_asm", - "mips": "mips32_asm", - "mips64": "mips64_asm", - "sparc": "sparcv8_asm", - "sparcv9": "sparcv9_asm", - "ia64": "ia64_asm", - "ppc32be": "ppc32_asm", - "ppc32": "ppc32_asm", - "ppc64le": "ppc64_asm", - "ppc64": "ppc64_asm", - "s390": "s390x_asm", - "s390x": "s390x_asm" - }.get(the_os, None) - @property def _targets(self): is_cygwin = self.settings.get_safe("os.subsystem") == "cygwin" - is_1_0 = self._full_version < "1.1.0" - has_darwin_arm = self._full_version >= "1.1.1i" or is_1_0 return { - "Linux-x86-clang": ("%slinux-generic32" % self._target_prefix) if is_1_0 else "linux-x86-clang", - "Linux-x86_64-clang": ("%slinux-x86_64" % self._target_prefix) if is_1_0 else "linux-x86_64-clang", - "Linux-x86-*": ("%slinux-generic32" % self._target_prefix) if is_1_0 else "linux-x86", - "Linux-x86_64-*": "%slinux-x86_64" % self._target_prefix, + "Linux-x86-clang": "linux-x86-clang", + "Linux-x86_64-clang": "linux-x86_64-clang", + "Linux-x86-*": "linux-x86", + "Linux-x86_64-*": "linux-x86_64", "Linux-armv4-*": "linux-armv4", "Linux-armv4i-*": "linux-armv4", "Linux-armv5el-*": "linux-armv4", @@ -384,13 +242,13 @@ def _targets(self): "Linux-sparc-*": "linux-sparcv8", "Linux-sparcv9-*": "linux64-sparcv9", "Linux-*-*": "linux-generic32", - "Macos-x86-*": "%sdarwin-i386-cc" % self._target_prefix, - "Macos-x86_64-*": "%sdarwin64-x86_64-cc" % self._target_prefix, - "Macos-ppc32-*": "%sdarwin-ppc-cc" % self._target_prefix, - "Macos-ppc32be-*": "%sdarwin-ppc-cc" % self._target_prefix, + "Macos-x86-*": "darwin-i386-cc", + "Macos-x86_64-*": "darwin64-x86_64-cc", + "Macos-ppc32-*": "darwin-ppc-cc", + "Macos-ppc32be-*": "darwin-ppc-cc", "Macos-ppc64-*": "darwin64-ppc-cc", "Macos-ppc64be-*": "darwin64-ppc-cc", - "Macos-armv8-*": "darwin64-arm64-cc" if has_darwin_arm else "darwin-common", + "Macos-armv8-*": "darwin64-arm64-cc", "Macos-*-*": "darwin-common", "iOS-x86_64-*": "darwin64-x86_64-cc", "iOS-*-*": "iphoneos-cross", @@ -408,15 +266,15 @@ def _targets(self): "Windows-x86-gcc": "Cygwin-x86" if is_cygwin else "mingw", "Windows-x86_64-gcc": "Cygwin-x86_64" if is_cygwin else "mingw64", "Windows-*-gcc": "Cygwin-common" if is_cygwin else "mingw-common", - "Windows-ia64-Visual Studio": "%sVC-WIN64I" % self._target_prefix, # Itanium - "Windows-x86-Visual Studio": "%sVC-WIN32" % self._target_prefix, - "Windows-x86_64-Visual Studio": "%sVC-WIN64A" % self._target_prefix, + "Windows-ia64-Visual Studio": "VC-WIN64I", # Itanium + "Windows-x86-Visual Studio": "VC-WIN32", + "Windows-x86_64-Visual Studio": "VC-WIN64A", "Windows-armv7-Visual Studio": "VC-WIN32-ARM", "Windows-armv8-Visual Studio": "VC-WIN64-ARM", "Windows-*-Visual Studio": "VC-noCE-common", - "Windows-ia64-clang": "%sVC-WIN64I" % self._target_prefix, # Itanium - "Windows-x86-clang": "%sVC-WIN32" % self._target_prefix, - "Windows-x86_64-clang": "%sVC-WIN64A" % self._target_prefix, + "Windows-ia64-clang": "VC-WIN64I", # Itanium + "Windows-x86-clang": "VC-WIN32", + "Windows-x86_64-clang": "VC-WIN64A", "Windows-armv7-clang": "VC-WIN32-ARM", "Windows-armv8-clang": "VC-WIN64-ARM", "Windows-*-clang": "VC-noCE-common", @@ -426,13 +284,13 @@ def _targets(self): "WindowsStore-armv8-*": "VC-WIN64-ARM-UWP", "WindowsStore-*-*": "VC-WIN32-ONECORE", "WindowsCE-*-*": "VC-CE", - "SunOS-x86-gcc": "%ssolaris-x86-gcc" % self._target_prefix, - "SunOS-x86_64-gcc": "%ssolaris64-x86_64-gcc" % self._target_prefix, - "SunOS-sparc-gcc": "%ssolaris-sparcv8-gcc" % self._target_prefix, + "SunOS-x86-gcc": "solaris-x86-gcc", + "SunOS-x86_64-gcc": "solaris64-x86_64-gcc", + "SunOS-sparc-gcc": "solaris-sparcv8-gcc", "SunOS-sparcv9-gcc": "solaris64-sparcv9-gcc", - "SunOS-x86-suncc": "%ssolaris-x86-cc" % self._target_prefix, - "SunOS-x86_64-suncc": "%ssolaris64-x86_64-cc" % self._target_prefix, - "SunOS-sparc-suncc": "%ssolaris-sparcv8-cc" % self._target_prefix, + "SunOS-x86-suncc": "solaris-x86-cc", + "SunOS-x86_64-suncc": "solaris64-x86_64-cc", + "SunOS-sparc-suncc": "solaris-sparcv8-cc", "SunOS-sparcv9-suncc": "solaris64-sparcv9-cc", "SunOS-*-*": "solaris-common", "*BSD-x86-*": "BSD-x86", @@ -477,37 +335,8 @@ def _tool(self, env_name, 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_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 - - 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_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": + if self.settings.os == "Linux": return "/etc/ssl" return "res" @@ -516,22 +345,17 @@ def _configure_args(self): openssldir = self.options.openssldir or self._get_default_openssl_dir() 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=/", - "--openssldir=\"%s\"" % openssldir, - "no-unit-test", - "no-threads" if self.options.no_threads else "threads" + f'"{self._target}"', + "shared" if self.options.shared else "no-shared", + "--prefix=/", + f"--openssldir=\"{openssldir}\"", + "no-unit-test", + "no-threads" if self.options.no_threads else "threads", + f"PERL={self._perl}", + "no-tests", + "--debug" if self.settings.build_type == "Debug" else "--release", + "--libdir=lib", # See https://github.com/openssl/openssl/blob/master/INSTALL.md#libdir ] - if self._full_version >= "1.1.1": - args.append("PERL=%s" % self._perl) - if self._full_version < "1.1.0" or self._full_version >= "1.1.1": - args.append("no-tests") - if self._full_version >= "1.1.0": - args.append("--debug" if self.settings.build_type == "Debug" else "--release") - - if self.settings.os == "Linux" and self.settings.arch == "x86_64": - 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 @@ -547,37 +371,13 @@ def _configure_args(self): else: args.append("-fPIC" if self.options.get_safe("fPIC", True) else "no-pic") - args.append("no-md2" if self.options.get_safe("no_md2", True) else "enable-md2") + args.append("no-md2") if self.settings.os == "Neutrino": args.append("no-asm -lsocket -latomic") - if self._is_clangcl: + if self._is_clang_cl: # #error is not yet supported when compiling as C, but this is planned for a future release. args.append("-D__STDC_NO_ATOMICS__") - if self._full_version < "1.1.0": - if self.options.get_safe("no_zlib"): - args.append("no-zlib") - else: - 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) - - if Version(conan_version).major <2 : - if self.options["zlib"].shared: - args.append("zlib-dynamic") - else: - args.append("zlib") - else: - if self.dependencies["zlib"].options.shared: - args.append("zlib-dynamic") - else: - args.append("zlib") - - args.extend(['--with-zlib-include="%s"' % include_path, - '--with-zlib-lib="%s"' % lib_path]) if Version(conan_version).major < 2: possible_values = self.options.values.fields @@ -585,7 +385,7 @@ def _configure_args(self): 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"]: + if activated and option_name not in ["fPIC", "openssldir", "capieng_dialog", "enable_capieng"]: self.output.info("activated option: %s" % option_name) args.append(option_name.replace("_", "-")) return args @@ -632,13 +432,10 @@ def _create_targets(self): 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" + targets = "my %targets" includes = "" - if self._asm_target: - ancestor = '[ "%s", asm("%s") ]' % (self._ancestor_target, self._asm_target) - else: - ancestor = '[ "%s" ]' % self._ancestor_target + ancestor = f'[ "{self._ancestor_target}" ]' shared_cflag = '' shared_extension = '' shared_target = '' @@ -649,6 +446,10 @@ def _create_targets(self): if self.options.get_safe("fPIC", True): shared_cflag='shared_cflag => "-fPIC",' + if self.settings.os in ["iOS", "tvOS", "watchOS"] and self.conf.get("tools.apple:enable_bitcode", check_type=bool): + cflags.append("-fembed-bitcode") + cxxflags.append("-fembed-bitcode") + config = config_template.format(targets=targets, target=self._target, ancestor=ancestor, @@ -672,19 +473,10 @@ def _create_targets(self): @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.) - build_deps = (dependency.ref.name for require, dependency in self.dependencies.build.items()) - if "strawberryperl" in build_deps: - return os.path.join(self.dependencies.build["strawberryperl"].package_folder, "bin", "perl.exe") - if 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" - @contextmanager def _make_context(self): if self._use_nmake: @@ -705,61 +497,35 @@ def sanitize_env_var(var): def build(self): 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() + self._create_targets() with self._make_context(): with chdir(self, self.source_folder): # workaround for clang-cl not producing .pdb files - if self._is_clangcl: + if self._is_clang_cl: 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": + if self._use_nmake: 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() + if self._use_nmake: + self.run("nmake /F Makefile") else: - if self._full_version >= "1.1.0": - self.run(f'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/ - - 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}') - + autotools.make() + def _patch_install_name(self): 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" - replace_in_file(self, 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=/') + replace_in_file(self, "Makefile", 'INSTALLTOP_dir=\\', 'INSTALLTOP_dir=/') def _replace_runtime_in_file(self, filename): runtime = msvc_runtime_flag(self) @@ -769,59 +535,25 @@ def _replace_runtime_in_file(self, filename): def package(self): copy(self, "*LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses"), keep_path=False) - autotools = Autotools(self) - args = [] - if self._full_version >= "1.1.0": - target = "install_sw" - args.append(f"DESTDIR={self.package_folder}") - else: # 1.0.2 support - # Note: 1.0.2 should not be used according to the OpenSSL Project - # See https://www.openssl.org/source/ - if not self._use_nmake: - target = "install_sw" - args.append(f"INSTALL_PREFIX={self.package_folder}") - else: - 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 not self._use_nmake: - autotools.make(target=target, args=args) - else: - if self._full_version >= "1.1.0": - self.run(f'nmake /F Makefile {target} {" ".join(args)}') - 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/ - self.run(f'nmake /F {self._nmake_makefile} {target} {" ".join(args)}') - - 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)) if self._use_nmake: - 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 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) + with chdir(self, self.source_folder): + self.run(f"nmake -f Makefile install_sw DESTDIR={self.package_folder}") + rm(self, "*.pdb", self.package_folder, recursive=True) + else: + autotools = Autotools(self) + with chdir(self, self.source_folder): + args = [f"DESTDIR={unix_path(self, self.package_folder)}"] + autotools.make(target="install_sw", args=args) - 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) @@ -883,22 +615,14 @@ def package_info(self): self.cpp_info.components["ssl"].set_property("cmake_target_name", "OpenSSL::SSL") self.cpp_info.components["ssl"].set_property("pkg_config_name", "libssl") if self._use_nmake: - libsuffix = "d" if self.settings.build_type == "Debug" else "" - if self._full_version < "1.1.0": - self.cpp_info.components["ssl"].libs = ["ssleay32"] - self.cpp_info.components["crypto"].libs = ["libeay32"] - else: - self.cpp_info.components["ssl"].libs = ["libssl" + libsuffix] - self.cpp_info.components["crypto"].libs = ["libcrypto" + libsuffix] + self.cpp_info.components["ssl"].libs = ["libssl"] + self.cpp_info.components["crypto"].libs = ["libcrypto"] else: self.cpp_info.components["ssl"].libs = ["ssl"] self.cpp_info.components["crypto"].libs = ["crypto"] self.cpp_info.components["ssl"].requires = ["crypto"] - if self._full_version < "1.1.0" and not self.options.get_safe("no_zlib"): - self.cpp_info.components["crypto"].requires = ["zlib::zlib"] - if self.settings.os == "Windows": self.cpp_info.components["crypto"].system_libs.extend(["crypt32", "ws2_32", "advapi32", "user32", "bcrypt"]) elif self.settings.os in ["Linux", "FreeBSD"]: @@ -910,6 +634,8 @@ def package_info(self): elif self.settings.os == "Neutrino": self.cpp_info.components["crypto"].system_libs.append("atomic") self.cpp_info.components["ssl"].system_libs.append("atomic") + self.cpp_info.components["crypto"].system_libs.append("socket") + self.cpp_info.components["ssl"].system_libs.append("socket") # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.names["cmake_find_package"] = "OpenSSL" diff --git a/recipes/openssl/1.x.x/patches/1.0.2u-darwin-arm64.patch b/recipes/openssl/1.x.x/patches/1.0.2u-darwin-arm64.patch deleted file mode 100644 index f04fd91d793b2..0000000000000 --- a/recipes/openssl/1.x.x/patches/1.0.2u-darwin-arm64.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- Configure 2019-12-20 14:02:41.000000000 +0100 -+++ Configure 2020-11-22 16:23:13.000000000 +0100 -@@ -650,7 +650,9 @@ - "darwin-i386-cc","cc:-arch i386 -O3 -fomit-frame-pointer -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_INT RC4_CHUNK DES_UNROLL BF_PTR:".eval{my $asm=$x86_asm;$asm=~s/cast\-586\.o//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", - "debug-darwin-i386-cc","cc:-arch i386 -g3 -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_INT RC4_CHUNK DES_UNROLL BF_PTR:${x86_asm}:macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", - "darwin64-x86_64-cc","cc:-arch x86_64 -O3 -DL_ENDIAN -Wall::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:".eval{my $asm=$x86_64_asm;$asm=~s/rc4\-[^:]+//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch x86_64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", -+"darwin64-arm64-cc","cc:-arch arm64 -O3 -DL_ENDIAN -Wall::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${no_asm}:dlfcn:darwin-shared:-fPIC -fno-common:-arch arm64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", - "debug-darwin64-x86_64-cc","cc:-arch x86_64 -ggdb -g2 -O0 -DL_ENDIAN -Wall::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:".eval{my $asm=$x86_64_asm;$asm=~s/rc4\-[^:]+//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch x86_64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", -+"debug-darwin64-arm64-cc","cc:-arch arm64 -ggdb -g2 -O0 -DL_ENDIAN -Wall::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${no_asm}:dlfcn:darwin-shared:-fPIC -fno-common:-arch arm64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", - "debug-darwin-ppc-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DB_ENDIAN -g -Wall -O::-D_REENTRANT:MACOSX::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc32_asm}:osx32:dlfcn:darwin-shared:-fPIC:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", - # iPhoneOS/iOS - "iphoneos-cross","llvm-gcc:-O3 -isysroot \$(CROSS_TOP)/SDKs/\$(CROSS_SDK) -fomit-frame-pointer -fno-common::-D_REENTRANT:iOS:-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}:dlfcn:darwin-shared:-fPIC -fno-common:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", diff --git a/recipes/openssl/1.x.x/test_package/CMakeLists.txt b/recipes/openssl/1.x.x/test_package/CMakeLists.txt index a28cd01bfb09b..7fb310b9cb6d9 100644 --- a/recipes/openssl/1.x.x/test_package/CMakeLists.txt +++ b/recipes/openssl/1.x.x/test_package/CMakeLists.txt @@ -19,15 +19,13 @@ set(_custom_vars OPENSSL_VERSION ) foreach(_custom_var ${_custom_vars}) - if(DEFINED _custom_var) + if(DEFINED ${_custom_var}) message(STATUS "${_custom_var}: ${${_custom_var}}") else() message(FATAL_ERROR "${_custom_var} not defined") endif() endforeach() -add_executable(digest digest.c) -target_link_libraries(digest OpenSSL::SSL) -if(OPENSSL_WITH_ZLIB) - target_compile_definitions(digest PRIVATE WITH_ZLIB) -endif() +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 e42aaed0f7cf1..5bbdbb3e0e7bc 100644 --- a/recipes/openssl/1.x.x/test_package/conanfile.py +++ b/recipes/openssl/1.x.x/test_package/conanfile.py @@ -1,55 +1,31 @@ from conan import ConanFile -from conan.tools.scm import Version 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 = "CMakeDeps", "VirtualRunEnv" test_type = "explicit" - @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 layout(self): + cmake_layout(self) def requirements(self): self.requires(self.tested_reference_str) - def layout(self): - cmake_layout(self) - def generate(self): tc = CMakeToolchain(self) - if self.settings.os == "Android": - tc.cache_variables["CONAN_LIBCXX"] = "" - openssl = self.dependencies["openssl"] - openssl_version = Version(openssl.ref.version) - if openssl_version.major == "1" and openssl_version.minor == "1": - tc.cache_variables["OPENSSL_WITH_ZLIB"] = False - else: - tc.cache_variables["OPENSSL_WITH_ZLIB"] = not openssl.options.no_zlib + 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) - cmake.configure() - cmake.build() + cmake = CMake(self) + cmake.configure() + cmake.build() def test(self): - if not self._skip_test and can_run(self): - bin_path = os.path.join(self.cpp.build.bindirs[0], "digest") + if can_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_v1_package/CMakeLists.txt b/recipes/openssl/1.x.x/test_v1_package/CMakeLists.txt index 0219031d70429..2f6b1a2f7ec79 100644 --- a/recipes/openssl/1.x.x/test_v1_package/CMakeLists.txt +++ b/recipes/openssl/1.x.x/test_v1_package/CMakeLists.txt @@ -4,33 +4,5 @@ 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) - -# 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(digest ../test_package/digest.c) -target_link_libraries(digest OpenSSL::SSL) -if(OPENSSL_WITH_ZLIB) - target_compile_definitions(digest PRIVATE WITH_ZLIB) -endif() +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 index 13150b440fe8a..57b42bea43378 100644 --- a/recipes/openssl/1.x.x/test_v1_package/conanfile.py +++ b/recipes/openssl/1.x.x/test_v1_package/conanfile.py @@ -1,42 +1,25 @@ -from conans import CMake, ConanFile -from conan.tools.scm import Version -from conan.tools.build import cross_building +from conans import CMake, ConanFile, tools +from conans.errors import ConanException 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" - @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 _openssl_option(self, name, default): + try: + return getattr(self.options["openssl"], name, default) + except (AttributeError, ConanException): + return default 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.definitions["OPENSSL_WITH_ZLIB"] = not self._openssl_option("no_zlib", True) + cmake.configure() + cmake.build() def test(self): - if not self._skip_test and not cross_building(self): - bin_path = os.path.join("bin", "digest") + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") self.run(bin_path, run_environment=True) - assert os.path.exists(os.path.join(self.deps_cpp_info["openssl"].rootpath, "licenses", "LICENSE")) diff --git a/recipes/openssl/3.x.x/conandata.yml b/recipes/openssl/3.x.x/conandata.yml index fda0f1e1cf28a..10986e398a3f8 100644 --- a/recipes/openssl/3.x.x/conandata.yml +++ b/recipes/openssl/3.x.x/conandata.yml @@ -1,10 +1,34 @@ sources: - 3.0.7: - url: https://www.openssl.org/source/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.3.2: + url: "https://github.com/openssl/openssl/releases/download/openssl-3.3.2/openssl-3.3.2.tar.gz" + sha256: 2e8a40b01979afe8be0bbfb3de5dc1c6709fedb46d6c89c10da114ab5fc3d281 + 3.3.1: + url: "https://github.com/openssl/openssl/releases/download/openssl-3.3.1/openssl-3.3.1.tar.gz" + sha256: 777cd596284c883375a2a7a11bf5d2786fc5413255efab20c50d6ffe6d020b7e + 3.2.3: + url: "https://github.com/openssl/openssl/releases/download/openssl-3.2.3/openssl-3.2.3.tar.gz" + sha256: 52b5f1c6b8022bc5868c308c54fb77705e702d6c6f4594f99a0df216acf46239 + 3.2.2: + url: "https://github.com/openssl/openssl/releases/download/openssl-3.2.2/openssl-3.2.2.tar.gz" + sha256: 197149c18d9e9f292c43f0400acaba12e5f52cacfe050f3d199277ea738ec2e7 + 3.2.1: + url: "https://github.com/openssl/openssl/releases/download/openssl-3.2.1/openssl-3.2.1.tar.gz" + sha256: 83c7329fe52c850677d75e5d0b0ca245309b97e8ecbcfdc1dfdc4ab9fac35b39 + 3.1.7: + url: "https://github.com/openssl/openssl/releases/download/openssl-3.1.7/openssl-3.1.7.tar.gz" + sha256: 053a31fa80cf4aebe1068c987d2ef1e44ce418881427c4464751ae800c31d06c + 3.1.6: + url: "https://github.com/openssl/openssl/releases/download/openssl-3.1.6/openssl-3.1.6.tar.gz" + sha256: 5d2be4036b478ef3cb0a854ca9b353072c3a0e26d8a56f8f0ab9fb6ed32d38d7 + 3.1.5: + url: "https://github.com/openssl/openssl/releases/download/openssl-3.1.5/openssl-3.1.5.tar.gz" + sha256: 6ae015467dabf0469b139ada93319327be24b98251ffaeceda0221848dc09262 + 3.0.15: + url: "https://github.com/openssl/openssl/releases/download/openssl-3.0.15/openssl-3.0.15.tar.gz" + sha256: 23c666d0edf20f14249b3d8f0368acaee9ab585b09e1de82107c66e1f3ec9533 + 3.0.14: + url: "https://github.com/openssl/openssl/releases/download/openssl-3.0.14/openssl-3.0.14.tar.gz" + sha256: eeca035d4dd4e84fc25846d952da6297484afa0650a6f84c682e39df3a4123ca + 3.0.13: + url: "https://github.com/openssl/openssl/releases/download/openssl-3.0.13/openssl-3.0.13.tar.gz" + sha256: 88525753f79d3bec27d2fa7c66aa0b92b3aa9498dafd93d7cfa4b3780cdae313 diff --git a/recipes/openssl/3.x.x/conanfile.py b/recipes/openssl/3.x.x/conanfile.py index 05de257a52c5f..711e03e2c27a9 100644 --- a/recipes/openssl/3.x.x/conanfile.py +++ b/recipes/openssl/3.x.x/conanfile.py @@ -1,26 +1,29 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.build import cross_building -from conan.tools.files import get, rename, rmdir -from conan.tools.microsoft import is_msvc, msvc_runtime_flag -from conans import AutoToolsBuildEnvironment, tools -import contextlib +from conan.tools.apple import fix_apple_shared_install_name, is_apple_os, XCRun +from conan.tools.build import build_jobs +from conan.tools.files import chdir, copy, get, 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, msvc_runtime_flag, unix_path +from conan.tools.scm import Version + import fnmatch -import functools import os import textwrap -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.57.0" class OpenSSLConan(ConanFile): name = "openssl" - settings = "os", "arch", "compiler", "build_type" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/openssl/openssl" license = "Apache-2.0" - topics = ("openssl", "ssl", "tls", "encryption", "security") + topics = ("ssl", "tls", "encryption", "security") description = "A toolkit for the Transport Layer Security (TLS) and Secure Sockets Layer (SSL) protocols" + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -28,7 +31,10 @@ class OpenSSLConan(ConanFile): "386": [True, False], "capieng_dialog": [True, False], "enable_capieng": [True, False], + "enable_trace": [True, False], "no_aria": [True, False], + "no_apps": [True, False], + "no_autoload_config": [True, False], "no_asm": [True, False], "no_async": [True, False], "no_blake2": [True, False], @@ -81,31 +87,38 @@ class OpenSSLConan(ConanFile): "no_ts": [True, False], "no_whirlpool": [True, False], "no_zlib": [True, False], - "openssldir": "ANY", + "openssldir": [None, "ANY"], + "tls_security_level": [None, 0, 1, 2, 3, 4, 5], } default_options = {key: False for key in options.keys()} default_options["fPIC"] = True default_options["no_md2"] = True default_options["openssldir"] = None + default_options["tls_security_level"] = None + + @property + def _is_clang_cl(self): + return self.settings.os == "Windows" and self.settings.compiler == "clang" and \ + self.settings.compiler.get_safe("runtime") + + @property + def _is_mingw(self): + return self.settings.os == "Windows" and self.settings.compiler == "gcc" @property - def _source_subfolder(self): - return "source_subfolder" + def _use_nmake(self): + return self._is_clang_cl or is_msvc(self) @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.capieng_dialog - del self.options.enable_capieng + self.options.rm_safe("capieng_dialog") + self.options.rm_safe("enable_capieng") else: - del self.options.fPIC + self.options.rm_safe("fPIC") if self.settings.os == "Emscripten": self.options.no_asm = True @@ -114,44 +127,38 @@ 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 not self.options.no_zlib: - self.requires("zlib/1.2.13") - - 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: - if not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + self.requires("zlib/[>=1.2.11 <2]") def validate(self): if self.settings.os == "Emscripten": if not all((self.options.no_asm, self.options.no_threads, self.options.no_stdio)): raise ConanInvalidConfiguration("os=Emscripten requires openssl:{no_asm,no_threads,no_stdio}=True") - @property - def _is_clangcl(self): - return self.settings.compiler == "clang" and self.settings.os == "Windows" - - @property - def _is_mingw(self): - return self.settings.os == "Windows" and self.settings.compiler == "gcc" + if self.settings.os == "iOS" and self.options.shared: + raise ConanInvalidConfiguration("OpenSSL 3 does not support building shared libraries for iOS") - @property - def _use_nmake(self): - return self._is_clangcl or is_msvc(self) + def build_requirements(self): + if self._settings_build.os == "Windows": + if not self.options.no_asm: + self.tool_requires("nasm/2.16.01") + 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) @property def _target(self): @@ -333,72 +340,35 @@ def _ancestor_target(self): ) return ancestor - 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 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/;") - - 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 - def adjust_path(path): - return path.replace("\\", "/") if tools.os_info.is_windows else path - - 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" % (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" % adjust_path(os.environ["AR"])) - if "RANLIB" in os.environ: - tools.replace_in_file(makefile_org, "RANLIB= ranlib\n", "RANLIB= %s\n" % 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" % adjust_path(rc)) - if "NM" in os.environ: - tools.replace_in_file(makefile_org, "NM= nm\n", "NM= %s\n" % adjust_path(os.environ["NM"])) - if "AS" in os.environ: - tools.replace_in_file(makefile_org, "AS=$(CC) -c\n", "AS=%s\n" % adjust_path(os.environ["AS"])) - - @functools.lru_cache(1) - def _get_env_build(self): - return AutoToolsBuildEnvironment(self) - def _get_default_openssl_dir(self): if self.settings.os == "Linux": return "/etc/ssl" return os.path.join(self.package_folder, "res") + def _adjust_path(self, path): + if self._use_nmake: + return path.replace("\\", "/") + return unix_path(self, path) + @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), + f'"{self._target}"', "shared" if self.options.shared else "no-shared", - "--prefix=\"%s\"" % prefix, + "--debug" if self.settings.build_type == "Debug" else "--release", + "--prefix=/", "--libdir=lib", - "--openssldir=\"%s\"" % openssldir, - "no-unit-test", + f"--openssldir=\"{openssldir}\"", "no-threads" if self.options.no_threads else "threads", - "PERL=%s" % self._perl, + f"PERL={self._perl}", + "no-unit-test", "no-tests", - "--debug" if self.settings.build_type == "Debug" else "--release", ] if self.settings.os == "Android": - args.append(" -D__ANDROID_API__=%s" % str(self.settings.os.api_level)) # see NOTES.ANDROID + args.append(f" -D__ANDROID_API__={str(self.settings.os.api_level)}") # see NOTES.ANDROID if self.settings.os == "Emscripten": args.append("-D__STDC_NO_ATOMICS__=1") if self.settings.os == "Windows": @@ -411,40 +381,53 @@ def _configure_args(self): args.append("no-fips" if self.options.get_safe("no_fips", True) else "enable-fips") args.append("no-md2" if self.options.get_safe("no_md2", True) else "enable-md2") + if str(self.options.tls_security_level) != "None": + args.append(f"-DOPENSSL_TLS_SECURITY_LEVEL={self.options.tls_security_level}") + + if self.options.get_safe("enable_trace"): + args.append("enable-trace") if self.settings.os == "Neutrino": args.append("no-asm -lsocket -latomic") if not self.options.no_zlib: - 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]) + zlib_cpp_info = self.dependencies["zlib"].cpp_info.aggregated_components() + include_path = self._adjust_path(zlib_cpp_info.includedirs[0]) + if self._use_nmake: + lib_path = self._adjust_path(os.path.join(zlib_cpp_info.libdirs[0], f"{zlib_cpp_info.libs[0]}.lib")) else: - # Just path, linux will find the right file - lib_path = zlib_info.lib_paths[0] - if tools.os_info.is_windows: - # clang-cl doesn't like backslashes in #define CFLAGS (builldinf.h -> cversion.c) - include_path = include_path.replace("\\", "/") - lib_path = lib_path.replace("\\", "/") - - if self.options["zlib"].shared: + # Just path, GNU like compilers will find the right file + lib_path = self._adjust_path(zlib_cpp_info.libdirs[0]) + + if self.dependencies["zlib"].options.shared: args.append("zlib-dynamic") else: args.append("zlib") args.extend([ - '--with-zlib-include="%s"' % include_path, - '--with-zlib-lib="%s"' % lib_path + f'--with-zlib-include="{include_path}"', + f'--with-zlib-lib="{lib_path}"', ]) - for option_name in self.options.values.fields: - if self.options.get_safe(option_name, False) and option_name not in ("shared", "fPIC", "openssldir", "capieng_dialog", "enable_capieng", "zlib", "no_fips", "no_md2"): + for option_name in self.default_options.keys(): + if self.options.get_safe(option_name, False) and option_name not in ("shared", "fPIC", "openssldir", "tls_security_level", "capieng_dialog", "enable_capieng", "zlib", "no_fips", "no_md2"): self.output.info(f"Activated option: {option_name}") args.append(option_name.replace("_", "-")) return args - def _create_targets(self): + def generate(self): + tc = AutotoolsToolchain(self) + env = tc.environment() + env.define_path("PERL", self._perl) + if self.settings.compiler == "apple-clang": + xcrun = XCRun(self) + env.define_path("CROSS_SDK", os.path.basename(xcrun.sdk_path)) + env.define_path("CROSS_TOP", os.path.dirname(os.path.dirname(xcrun.sdk_path))) + + self._create_targets(tc.cflags, tc.cxxflags, tc.defines, tc.ldflags) + tc.generate(env) + + def _create_targets(self, cflags, cxxflags, defines, ldflags): config_template = textwrap.dedent("""\ {targets} = ( "{target}" => {{ @@ -452,201 +435,123 @@ def _create_targets(self): cflags => add("{cflags}"), cxxflags => add("{cxxflags}"), {defines} - includes => add({includes}), lflags => add("{lflags}"), {shared_target} {shared_cflag} {shared_extension} - {cc} - {cxx} - {ar} - {ranlib} {perlasm_scheme} }}, ); """) - cflags = [] - cxxflags = [] - - env_build = self._get_env_build() - cflags.extend(env_build.vars_dict["CFLAGS"]) - cxxflags.extend(env_build.vars_dict["CXXFLAGS"]) - - cc = self._tool("CC", "cc") - cxx = self._tool("CXX", "cxx") - ar = self._tool("AR", "ar") - ranlib = self._tool("RANLIB", "ranlib") perlasm_scheme = "" if self._perlasm_scheme: - perlasm_scheme = 'perlasm_scheme => "%s",' % self._perlasm_scheme + perlasm_scheme = f'perlasm_scheme => "{self._perlasm_scheme}",' - 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 = '", "'.join(defines) defines = 'defines => add("%s"),' % defines if defines else "" - ranlib = 'ranlib => "%s",' % ranlib if ranlib else "" targets = "my %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 if self._asm_target: - ancestor = '[ "%s", asm("%s") ]' % (self._ancestor_target, self._asm_target) + ancestor = f'[ "{self._ancestor_target}", asm("{self._asm_target}") ]' else: - ancestor = '[ "%s" ]' % self._ancestor_target + ancestor = f'[ "{self._ancestor_target}" ]' shared_cflag = "" shared_extension = "" 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",' + if self.settings.os in ["iOS", "tvOS", "watchOS"] and self.conf.get("tools.apple:enable_bitcode", check_type=bool): + cflags.append("-fembed-bitcode") + cxxflags.append("-fembed-bitcode") + config = config_template.format( targets=targets, target=self._target, ancestor=ancestor, - cc=cc, - cxx=cxx, - ar=ar, - ranlib=ranlib, cflags=" ".join(cflags), cxxflags=" ".join(cxxflags), defines=defines, - includes=includes, perlasm_scheme=perlasm_scheme, shared_target=shared_target, shared_extension=shared_extension, shared_cflag=shared_cflag, - lflags=" ".join(env_build.link_flags) + lflags=" ".join(ldflags) ) - self.output.info("using target: %s -> %s" % (self._target, self._ancestor_target)) + self.output.info(f"using target: {self._target} -> {self._ancestor_target}") self.output.info(config) - tools.save(os.path.join(self._source_subfolder, "Configurations", "20-conan.conf"), config) + save(self, os.path.join(self.source_folder, "Configurations", "20-conan.conf"), config) - def _run_make(self, targets=None, makefile=None, parallel=True): + def _run_make(self, targets=None, parallel=True, install=False): command = [self._make_program] - if makefile: - command.extend(["-f", makefile]) + if install: + command.append(f"DESTDIR={self._adjust_path(self.package_folder)}") if targets: command.extend(targets) if not self._use_nmake: - command.append(("-j%s" % tools.cpu_count()) if parallel else "-j1") - self.run(" ".join(command), win_bash=self._win_bash) + command.append(f"-j{build_jobs(self)}" if parallel else "-j1") + self.run(" ".join(command), env="conanbuild") @property def _perl(self): - if tools.os_info.is_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", "") + with chdir(self, self.source_folder): args = " ".join(self._configure_args) if self._use_nmake: 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.run(f"{self._perl} ./Configure {args}", env="conanbuild") + if self._use_nmake: + # When `--prefix=/`, the scripts derive `\` without escaping, which + # causes issues on Windows + replace_in_file(self, "Makefile", "INSTALLTOP_dir=\\", "INSTALLTOP_dir=\\\\") + if Version(self.version) >= "3.3.0": + # replace backslashes in paths with forward slashes + mkinstallvars_pl = os.path.join(self.source_folder, "util", "mkinstallvars.pl") + if Version(self.version) >= "3.3.2": + replace_in_file(self, mkinstallvars_pl, "push @{$values{$k}}, $v;", """$v =~ s|\\\\|/|g; push @{$values{$k}}, $v;""") + replace_in_file(self, mkinstallvars_pl, "$values{$k} = $v;", """$v->[0] =~ s|\\\\|/|g; $values{$k} = $v;""") + else: + replace_in_file(self, mkinstallvars_pl, "$ENV{$k} = $v;", """$v =~ s|\\\\|/|g; $ENV{$k} = $v;""") self._run_make() def _make_install(self): - with tools.chdir(self._source_subfolder): - 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" - - @contextlib.contextmanager - def _make_context(self): - if self._use_nmake: - # Windows: when cmake generates its cache, it populates some environment variables as well. - # If cmake also initiates openssl build, their values (containing spaces and forward slashes) - # 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): - yield - else: - yield + with chdir(self, self.source_folder): + self._run_make(targets=["install_sw"], parallel=False, install=True) def build(self): - with tools.vcvars(self) if self._use_nmake else tools.no_op(): - env_vars = {"PERL": self._perl} - 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): - self._create_targets() - with self._make_context(): - self._make() - - @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)) + self._make() + configdata_pm = self._adjust_path(os.path.join(self.source_folder, "configdata.pm")) + self.run(f"{self._perl} {configdata_pm} --dump") @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")) - if not make_program: - raise Exception('could not find "make" executable. please set "CONAN_MAKE_PROGRAM" environment variable') - make_program = tools.unix_path(make_program) - return make_program + return "nmake" if self._use_nmake else "make" def _replace_runtime_in_file(self, filename): runtime = msvc_runtime_flag(self) for e in ["MDd", "MTd", "MD", "MT"]: - tools.replace_in_file(filename, f"/{e} ", f"/{runtime} ", strict=False) - tools.replace_in_file(filename, f"/{e}\"", f"/{runtime}\"", strict=False) + replace_in_file(self, filename, f"/{e} ", f"/{runtime} ", strict=False) + replace_in_file(self, filename, f"/{e}\"", f"/{runtime}\"", strict=False) def package(self): - self.copy("*LICENSE*", src=self._source_subfolder, dst="licenses") - with tools.vcvars(self) 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)) - if self._use_nmake: - if self.settings.build_type == "Debug": - with tools.chdir(os.path.join(self.package_folder, "lib")): - rename(self, "libssl.lib", "libssld.lib") - rename(self, "libcrypto.lib", "libcryptod.lib") + copy(self, "*LICENSE*", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + self._make_install() + if is_apple_os(self): + fix_apple_shared_install_name(self) + rm(self, "*.pdb", self.package_folder, "lib") if self.options.shared: libdir = os.path.join(self.package_folder, "lib") for file in os.listdir(libdir): @@ -655,24 +560,24 @@ def package(self): if file.endswith(".a"): os.unlink(os.path.join(libdir, file)) - if not self.options.no_fips: - provdir = os.path.join(self._source_subfolder, "providers") + provdir = os.path.join(self.source_folder, "providers") + modules_dir = os.path.join(self.package_folder, "lib", "ossl-modules") if self.settings.os == "Macos": - self.copy("fips.dylib", src=provdir,dst="lib/ossl-modules") + copy(self, "fips.dylib", src=provdir, dst=modules_dir) elif self.settings.os == "Windows": - self.copy("fips.dll", src=provdir,dst="lib/ossl-modules") + copy(self, "fips.dll", src=provdir, dst=modules_dir) else: - self.copy("fips.so", src=provdir,dst="lib/ossl-modules") + copy(self, "fips.so", src=provdir, dst=modules_dir) 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("""\ set(OPENSSL_FOUND TRUE) if(DEFINED OpenSSL_INCLUDE_DIR) @@ -684,6 +589,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}) @@ -691,6 +602,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}) @@ -698,8 +615,8 @@ 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_subfolder(self): @@ -708,12 +625,13 @@ def _module_subfolder(self): @property def _module_file_rel_path(self): return os.path.join(self._module_subfolder, - "conan-official-{}-variables.cmake".format(self.name)) + f"conan-official-{self.name}-variables.cmake") def package_info(self): self.cpp_info.set_property("cmake_file_name", "OpenSSL") self.cpp_info.set_property("cmake_find_mode", "both") self.cpp_info.set_property("pkg_config_name", "openssl") + self.cpp_info.set_property("cmake_build_modules", [self._module_file_rel_path]) self.cpp_info.names["cmake_find_package"] = "OpenSSL" self.cpp_info.names["cmake_find_package_multi"] = "OpenSSL" self.cpp_info.components["ssl"].builddirs.append(self._module_subfolder) @@ -724,9 +642,8 @@ def package_info(self): self.cpp_info.components["crypto"].set_property("cmake_build_modules", [self._module_file_rel_path]) if self._use_nmake: - libsuffix = "d" if self.settings.build_type == "Debug" else "" - self.cpp_info.components["ssl"].libs = ["libssl" + libsuffix] - self.cpp_info.components["crypto"].libs = ["libcrypto" + libsuffix] + self.cpp_info.components["ssl"].libs = ["libssl"] + self.cpp_info.components["crypto"].libs = ["libcrypto"] else: self.cpp_info.components["ssl"].libs = ["ssl"] self.cpp_info.components["crypto"].libs = ["crypto"] @@ -747,6 +664,8 @@ def package_info(self): elif self.settings.os == "Neutrino": self.cpp_info.components["crypto"].system_libs.append("atomic") self.cpp_info.components["ssl"].system_libs.append("atomic") + self.cpp_info.components["crypto"].system_libs.append("socket") + self.cpp_info.components["ssl"].system_libs.append("socket") self.cpp_info.components["crypto"].set_property("cmake_target_name", "OpenSSL::Crypto") self.cpp_info.components["crypto"].set_property("pkg_config_name", "libcrypto") @@ -756,3 +675,9 @@ 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/3.x.x/test_package/CMakeLists.txt b/recipes/openssl/3.x.x/test_package/CMakeLists.txt index d52c980c930cf..f479eb1a54993 100644 --- a/recipes/openssl/3.x.x/test_package/CMakeLists.txt +++ b/recipes/openssl/3.x.x/test_package/CMakeLists.txt @@ -1,10 +1,6 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package C) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -option(OPENSSL_WITH_ZLIB "OpenSSL with zlib support" ON) option(OPENSSL_WITH_LEGACY "OpenSSL with support for the legacy provider" ON) option(OPENSSL_WITH_MD4 "OpenSSL with MD4 support (needs legacy provider)" ON) option(OPENSSL_WITH_RIPEMD160 "OpenSSL with RIPEMD16 support (needs legacy provider)" ON) @@ -12,33 +8,37 @@ option(OPENSSL_WITH_RIPEMD160 "OpenSSL with RIPEMD16 support (needs legacy provi set(OpenSSL_DEBUG 1) find_package(OpenSSL REQUIRED) -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}") +# 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(digest digest.c) -if(OPENSSL_WITH_ZLIB) - target_compile_definitions(digest PRIVATE WITH_ZLIB) -endif() -target_link_libraries(digest OpenSSL::Crypto) +add_executable(test_package test_package.c digest.c) +target_link_libraries(test_package PRIVATE OpenSSL::SSL OpenSSL::Crypto) if(OPENSSL_WITH_LEGACY) - add_executable(digest_legacy digest_legacy.c) + target_sources(test_package PRIVATE digest_legacy.c) # do now show deperecation warnings - target_compile_definitions(digest_legacy PRIVATE OPENSSL_SUPPRESS_DEPRECATED) + target_compile_definitions(test_package PRIVATE OPENSSL_SUPPRESS_DEPRECATED TEST_OPENSSL_LEGACY) if(OPENSSL_WITH_MD4) - target_compile_definitions(digest_legacy PRIVATE OPENSSL_WITH_MD4) + target_compile_definitions(test_package PRIVATE OPENSSL_WITH_MD4) endif() if(OPENSSL_WITH_RIPEMD160) - target_compile_definitions(digest_legacy PRIVATE OPENSSL_WITH_RIPEMD160) - endif() - if(OPENSSL_WITH_ZLIB) - target_compile_definitions(digest_legacy PRIVATE WITH_ZLIB) + target_compile_definitions(test_package PRIVATE OPENSSL_WITH_RIPEMD160) endif() - target_link_libraries(digest_legacy OpenSSL::Crypto) endif() diff --git a/recipes/openssl/3.x.x/test_package/conanfile.py b/recipes/openssl/3.x.x/test_package/conanfile.py index ad509932a9c76..76d2cc26c1df0 100644 --- a/recipes/openssl/3.x.x/test_package/conanfile.py +++ b/recipes/openssl/3.x.x/test_package/conanfile.py @@ -1,40 +1,38 @@ -from conans import CMake, tools, ConanFile -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 class TestPackageConan(ConanFile): - settings = "os", "compiler", "arch", "build_type" - generators = "cmake", "cmake_find_package", "pkg_config" + 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 _with_legacy(self): - return (not self.options["openssl"].no_legacy and - ((not self.options["openssl"].no_md4) or - (not self.options["openssl"].no_rmd160))) + return (not self.dependencies["openssl"].options.no_legacy and + ((not self.dependencies["openssl"].options.no_md4) or + (not self.dependencies["openssl"].options.no_rmd160))) + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["OPENSSL_WITH_LEGACY"] = self._with_legacy() + tc.cache_variables["OPENSSL_WITH_MD4"] = not self.dependencies["openssl"].options.no_md4 + tc.cache_variables["OPENSSL_WITH_RIPEMD160"] = not self.dependencies["openssl"].options.no_rmd160 + tc.generate() def build(self): cmake = CMake(self) - cmake.definitions["OPENSSL_WITH_ZLIB"] = not self.options["openssl"].no_zlib - cmake.definitions["OPENSSL_WITH_LEGACY"] = self._with_legacy() - cmake.definitions["OPENSSL_WITH_MD4"] = not self.options["openssl"].no_md4 - cmake.definitions["OPENSSL_WITH_RIPEMD160"] = not self.options["openssl"].no_rmd160 - if self.settings.os == "Android": - cmake.definitions["CONAN_LIBCXX"] = "" cmake.configure() cmake.build() def test(self): - if not cross_building(self): - bin_path = os.path.join("bin", "digest") - self.run(bin_path, run_environment=True) - - if not self.options["openssl"].no_legacy: - bin_legacy_path = os.path.join("bin", "digest_legacy") - self.run(bin_legacy_path, run_environment=True) - - if not self.options["openssl"].no_stdio: - self.run("openssl version", run_environment=True) - assert os.path.exists(os.path.join(self.deps_cpp_info["openssl"].rootpath, "licenses", "LICENSE.txt")) - - for fn in ("libcrypto.pc", "libssl.pc", "openssl.pc",): - assert os.path.isfile(os.path.join(self.build_folder, fn)) + if can_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/3.x.x/test_package/digest.c b/recipes/openssl/3.x.x/test_package/digest.c index 0693be609aa18..94464635eb783 100644 --- a/recipes/openssl/3.x.x/test_package/digest.c +++ b/recipes/openssl/3.x.x/test_package/digest.c @@ -2,9 +2,6 @@ #include #include #include -#if defined(WITH_ZLIB) -#include -#endif #include #include @@ -32,7 +29,7 @@ void SHA3_hash(const EVP_MD *type, const unsigned char *message, size_t message_ EVP_MD_CTX_destroy(mdctx); } -int main() +void digest() { unsigned int digest_len; unsigned char sha256_digest[SHA256_DIGEST_LENGTH], @@ -64,10 +61,5 @@ int main() printf("sha512 digest: %s\n", sha512_string); printf("sha3 256 digest: %s\n", sha3_256_string); printf("sha3 512 digest: %s\n", sha3_512_string); - printf("OpenSSL version: %s\n", OpenSSL_version(OPENSSL_VERSION)); -#if defined(WITH_ZLIB) - printf("ZLIB version: %s\n", ZLIB_VERSION); -#endif - return 0; } diff --git a/recipes/openssl/3.x.x/test_package/digest_legacy.c b/recipes/openssl/3.x.x/test_package/digest_legacy.c index 740f0d2c20914..9a23bf242cf09 100644 --- a/recipes/openssl/3.x.x/test_package/digest_legacy.c +++ b/recipes/openssl/3.x.x/test_package/digest_legacy.c @@ -10,9 +10,6 @@ #include #include #include -#if defined(WITH_ZLIB) -#include -#endif #include #include @@ -53,7 +50,7 @@ int MDx_hash(const EVP_MD *type, const unsigned char *message, size_t message_le return 0; } -int main() +int digest_legacy() { unsigned int digest_len; unsigned char md5_digest[MD5_DIGEST_LENGTH]; @@ -139,10 +136,6 @@ int main() printf("RIPEMD160 digest: %s\n", ripemd160_string); printf("RIPEMD160 digest (variant 2): %s\n", ripemd160_string2); #endif - printf("OpenSSL version: %s\n", OpenSSL_version(OPENSSL_VERSION)); -#if defined(WITH_ZLIB) - printf("ZLIB version: %s\n", ZLIB_VERSION); -#endif return 0; } diff --git a/recipes/openssl/3.x.x/test_package/test_package.c b/recipes/openssl/3.x.x/test_package/test_package.c new file mode 100644 index 0000000000000..8f4148fbf332d --- /dev/null +++ b/recipes/openssl/3.x.x/test_package/test_package.c @@ -0,0 +1,24 @@ +#include +#include + +void digest(); +int digest_legacy(); + +int main() +{ + int legacy_result = 0; + OPENSSL_init_ssl(0, NULL); + printf("OpenSSL version: %s\n", OpenSSL_version(OPENSSL_VERSION)); + + digest(); + +#if defined(TEST_OPENSSL_LEGACY) + legacy_result = digest_legacy(); + if (legacy_result != 0) { + printf("Error testing the digest_legacy() function\n"); + return 1; + } +#endif + + return 0; +} diff --git a/recipes/openssl/3.x.x/test_v1_package/CMakeLists.txt b/recipes/openssl/3.x.x/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..d52c980c930cf --- /dev/null +++ b/recipes/openssl/3.x.x/test_v1_package/CMakeLists.txt @@ -0,0 +1,44 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +option(OPENSSL_WITH_ZLIB "OpenSSL with zlib support" ON) +option(OPENSSL_WITH_LEGACY "OpenSSL with support for the legacy provider" ON) +option(OPENSSL_WITH_MD4 "OpenSSL with MD4 support (needs legacy provider)" ON) +option(OPENSSL_WITH_RIPEMD160 "OpenSSL with RIPEMD16 support (needs legacy provider)" ON) + +set(OpenSSL_DEBUG 1) +find_package(OpenSSL REQUIRED) + +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}") + +add_executable(digest digest.c) +if(OPENSSL_WITH_ZLIB) + target_compile_definitions(digest PRIVATE WITH_ZLIB) +endif() +target_link_libraries(digest OpenSSL::Crypto) + +if(OPENSSL_WITH_LEGACY) + add_executable(digest_legacy digest_legacy.c) + # do now show deperecation warnings + target_compile_definitions(digest_legacy PRIVATE OPENSSL_SUPPRESS_DEPRECATED) + if(OPENSSL_WITH_MD4) + target_compile_definitions(digest_legacy PRIVATE OPENSSL_WITH_MD4) + endif() + if(OPENSSL_WITH_RIPEMD160) + target_compile_definitions(digest_legacy PRIVATE OPENSSL_WITH_RIPEMD160) + endif() + if(OPENSSL_WITH_ZLIB) + target_compile_definitions(digest_legacy PRIVATE WITH_ZLIB) + endif() + target_link_libraries(digest_legacy OpenSSL::Crypto) +endif() diff --git a/recipes/openssl/3.x.x/test_v1_package/conanfile.py b/recipes/openssl/3.x.x/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..ad509932a9c76 --- /dev/null +++ b/recipes/openssl/3.x.x/test_v1_package/conanfile.py @@ -0,0 +1,40 @@ +from conans import CMake, tools, ConanFile +from conan.tools.build import cross_building +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "arch", "build_type" + generators = "cmake", "cmake_find_package", "pkg_config" + + def _with_legacy(self): + return (not self.options["openssl"].no_legacy and + ((not self.options["openssl"].no_md4) or + (not self.options["openssl"].no_rmd160))) + + def build(self): + cmake = CMake(self) + cmake.definitions["OPENSSL_WITH_ZLIB"] = not self.options["openssl"].no_zlib + cmake.definitions["OPENSSL_WITH_LEGACY"] = self._with_legacy() + cmake.definitions["OPENSSL_WITH_MD4"] = not self.options["openssl"].no_md4 + cmake.definitions["OPENSSL_WITH_RIPEMD160"] = not self.options["openssl"].no_rmd160 + if self.settings.os == "Android": + cmake.definitions["CONAN_LIBCXX"] = "" + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "digest") + self.run(bin_path, run_environment=True) + + if not self.options["openssl"].no_legacy: + bin_legacy_path = os.path.join("bin", "digest_legacy") + self.run(bin_legacy_path, run_environment=True) + + if not self.options["openssl"].no_stdio: + self.run("openssl version", run_environment=True) + assert os.path.exists(os.path.join(self.deps_cpp_info["openssl"].rootpath, "licenses", "LICENSE.txt")) + + for fn in ("libcrypto.pc", "libssl.pc", "openssl.pc",): + assert os.path.isfile(os.path.join(self.build_folder, fn)) diff --git a/recipes/openssl/3.x.x/test_v1_package/digest.c b/recipes/openssl/3.x.x/test_v1_package/digest.c new file mode 100644 index 0000000000000..0693be609aa18 --- /dev/null +++ b/recipes/openssl/3.x.x/test_v1_package/digest.c @@ -0,0 +1,73 @@ +#include +#include +#include +#include +#if defined(WITH_ZLIB) +#include +#endif + +#include +#include +#include + +#if defined(_MSC_VER) && _MSC_VER < 1900 +#define snprintf _snprintf +#endif + +void SHA3_hash(const EVP_MD *type, const unsigned char *message, size_t message_len, unsigned char *digest, unsigned int *digest_len) { + EVP_MD_CTX *mdctx; + + if((mdctx = EVP_MD_CTX_create()) == NULL) + printf("EVP_MD_CTX_create error!\n"); + + if(EVP_DigestInit_ex(mdctx, type, NULL) != 1) + printf("EVP_DigestInit_ex error!\n"); + + if(EVP_DigestUpdate(mdctx, message, message_len) != 1) + printf("EVP_DigestUpdate error!\n"); + + if(EVP_DigestFinal_ex(mdctx, digest, digest_len) != 1) + printf("EVP_DigestFinal_ex error!\n"); + + EVP_MD_CTX_destroy(mdctx); +} + +int main() +{ + unsigned int digest_len; + unsigned char sha256_digest[SHA256_DIGEST_LENGTH], + sha512_digest[SHA512_DIGEST_LENGTH], + sha3_256_digest[SHA256_DIGEST_LENGTH], + sha3_512_digest[SHA512_DIGEST_LENGTH]; + char sha256_string[SHA256_DIGEST_LENGTH*2+1] = {0}, + sha512_string[SHA512_DIGEST_LENGTH*2+1] = {0}, + sha3_256_string[SHA256_DIGEST_LENGTH*2+1] = {0}, + sha3_512_string[SHA512_DIGEST_LENGTH*2+1] = {0}; + char string[] = "happy"; + + SHA256((unsigned char*)&string, strlen(string), (unsigned char*)&sha256_digest); + SHA512((unsigned char*)&string, strlen(string), (unsigned char*)&sha512_digest); + SHA3_hash(EVP_sha3_256(), (unsigned char*)&string, strlen(string), (unsigned char*)&sha3_256_digest, &digest_len); + SHA3_hash(EVP_sha3_512(), (unsigned char*)&string, strlen(string), (unsigned char*)&sha3_512_digest, &digest_len); + + for(int i = 0; i < SHA256_DIGEST_LENGTH; i++) { + snprintf(&sha256_string[i*2], sizeof(sha256_string)-i*2, "%02x", (unsigned int)sha256_digest[i]); + snprintf(&sha3_256_string[i*2], sizeof(sha3_256_string)-i*2, "%02x", (unsigned int)sha3_256_digest[i]); + } + + for(int i = 0; i < SHA512_DIGEST_LENGTH; i++) { + snprintf(&sha512_string[i*2], sizeof(sha512_string)-i*2, "%02x", (unsigned int)sha512_digest[i]); + snprintf(&sha3_512_string[i*2], sizeof(sha3_512_string)-i*2, "%02x", (unsigned int)sha3_512_digest[i]); + } + + printf("sha256 digest: %s\n", sha256_string); + printf("sha512 digest: %s\n", sha512_string); + printf("sha3 256 digest: %s\n", sha3_256_string); + printf("sha3 512 digest: %s\n", sha3_512_string); + printf("OpenSSL version: %s\n", OpenSSL_version(OPENSSL_VERSION)); +#if defined(WITH_ZLIB) + printf("ZLIB version: %s\n", ZLIB_VERSION); +#endif + + return 0; +} diff --git a/recipes/openssl/3.x.x/test_v1_package/digest_legacy.c b/recipes/openssl/3.x.x/test_v1_package/digest_legacy.c new file mode 100644 index 0000000000000..740f0d2c20914 --- /dev/null +++ b/recipes/openssl/3.x.x/test_v1_package/digest_legacy.c @@ -0,0 +1,148 @@ +#include +#if OPENSSL_WITH_MD4 +#include // MD4 needs legacy provider +#endif +#if OPENSSL_WITH_RIPEMD160 +#include // RIPEMD160 needs legacy provider +#endif +#include +#include +#include +#include +#include +#if defined(WITH_ZLIB) +#include +#endif + +#include +#include +#include + +#if defined(_MSC_VER) && _MSC_VER < 1900 +#define snprintf _snprintf +#endif + +int MDx_hash(const EVP_MD *type, const unsigned char *message, size_t message_len, unsigned char *digest, unsigned int *digest_len) { + EVP_MD_CTX *mdctx; + + if((mdctx = EVP_MD_CTX_create()) == NULL) + { + printf("EVP_MD_CTX_create error!\n"); + return 1; + } + + if(EVP_DigestInit_ex(mdctx, type, NULL) != 1) + { + printf("EVP_DigestInit_ex error!\n"); + return 1; + } + + if(EVP_DigestUpdate(mdctx, message, message_len) != 1) + { + printf("EVP_DigestUpdate error!\n"); + return 1; + } + + if(EVP_DigestFinal_ex(mdctx, digest, digest_len) != 1) + { + printf("EVP_DigestFinal_ex error!\n"); + return 1; + } + + EVP_MD_CTX_destroy(mdctx); + return 0; +} + +int main() +{ + unsigned int digest_len; + unsigned char md5_digest[MD5_DIGEST_LENGTH]; + unsigned char md5_digest2[MD5_DIGEST_LENGTH]; + char md5_string[MD5_DIGEST_LENGTH*2+1] = {0}; + char md5_string2[MD5_DIGEST_LENGTH*2+1] = {0}; + char string[] = "happy"; + + MD5((unsigned char*)&string, strlen(string), (unsigned char*)&md5_digest); + if (MDx_hash(EVP_md5(), (unsigned char*)&string, strlen(string), (unsigned char*)&md5_digest2, &digest_len)) + return 1; + + for(int i = 0; i < MD5_DIGEST_LENGTH; i++) { + snprintf(&md5_string[i*2], sizeof(md5_string)-i*2, "%02x", (unsigned int)md5_digest[i]); + snprintf(&md5_string2[i*2], sizeof(md5_string2)-i*2, "%02x", (unsigned int)md5_digest2[i]); + } + + // MD4 needs the legacy provider + OSSL_LIB_CTX* context = OSSL_LIB_CTX_new(); + // From https://wiki.openssl.org/index.php/OpenSSL_3.0 + /* Load Multiple providers into the default (nullptr) library context */ + OSSL_PROVIDER* legacy = OSSL_PROVIDER_load(context, "legacy"); + if (0 == legacy) { + const char* error_string = ERR_error_string(ERR_get_error(), 0); + fprintf(stderr, "Loading legacy provider failed with this error:\n"); + fprintf(stderr, "\t%s\n", error_string); + return 1; + } + OSSL_LIB_CTX* oldcontex = OSSL_LIB_CTX_set0_default(context); + printf("Legacy provider successfully loaded.\n"); + +#if OPENSSL_WITH_MD4 + unsigned char md4_digest[MD4_DIGEST_LENGTH]; + unsigned char md4_digest2[MD4_DIGEST_LENGTH]; + char md4_string[MD4_DIGEST_LENGTH*2+1] = {0}; + char md4_string2[MD4_DIGEST_LENGTH*2+1] = {0}; + + MD4((unsigned char*)&string, strlen(string), (unsigned char*)&md4_digest); + if (MDx_hash(EVP_md4(), (unsigned char*)&string, strlen(string), (unsigned char*)&md4_digest2, &digest_len)) { + const char* error_string = ERR_error_string(ERR_get_error(), 0); + fprintf(stderr, "MD4 calculation failed with this error:\n"); + fprintf(stderr, "\t%s\n", error_string); + return 1; + } + + for(int i = 0; i < MD4_DIGEST_LENGTH; i++) { + snprintf(&md4_string[i*2], sizeof(md4_string)-i*2, "%02x", (unsigned int)md4_digest[i]); + snprintf(&md4_string2[i*2], sizeof(md4_string2)-i*2, "%02x", (unsigned int)md4_digest2[i]); + } +#endif + +#if OPENSSL_WITH_RIPEMD160 + unsigned char ripemd160_digest[RIPEMD160_DIGEST_LENGTH]; + unsigned char ripemd160_digest2[RIPEMD160_DIGEST_LENGTH]; + char ripemd160_string[RIPEMD160_DIGEST_LENGTH*2+1] = {0}; + char ripemd160_string2[RIPEMD160_DIGEST_LENGTH*2+1] = {0}; + + RIPEMD160((unsigned char*)&string, strlen(string), (unsigned char*)&ripemd160_digest); + if (MDx_hash(EVP_ripemd160(), (unsigned char*)&string, strlen(string), (unsigned char*)&ripemd160_digest2, &digest_len)) { + const char* error_string = ERR_error_string(ERR_get_error(), 0); + fprintf(stderr, "RIPEMD160 calculation failed with this error:\n"); + fprintf(stderr, "\t%s\n", error_string); + return 1; + } + + for(int i = 0; i < RIPEMD160_DIGEST_LENGTH; i++) { + snprintf(&ripemd160_string[i*2], sizeof(ripemd160_string)-i*2, "%02x", (unsigned int)ripemd160_digest[i]); + snprintf(&ripemd160_string2[i*2], sizeof(ripemd160_string2)-i*2, "%02x", (unsigned int)ripemd160_digest2[i]); + } +#endif + + OSSL_LIB_CTX_set0_default(oldcontex); + OSSL_PROVIDER_unload(legacy); + OSSL_LIB_CTX_free(context); + + printf("MD5 digest: %s\n", md5_string); + printf("MD5 digest (variant 2): %s\n", md5_string2); +#if OPENSSL_WITH_MD4 + printf("MD4 digest: %s\n", md4_string); + printf("MD4 digest (variant 2): %s\n", md4_string2); +#endif +#if OPENSSL_WITH_RIPEMD160 + printf("RIPEMD160 digest: %s\n", ripemd160_string); + printf("RIPEMD160 digest (variant 2): %s\n", ripemd160_string2); +#endif + printf("OpenSSL version: %s\n", OpenSSL_version(OPENSSL_VERSION)); +#if defined(WITH_ZLIB) + printf("ZLIB version: %s\n", ZLIB_VERSION); +#endif + + return 0; +} diff --git a/recipes/openssl/config.yml b/recipes/openssl/config.yml index 3cb5a6e3ab8f4..9ada8cd7b7467 100644 --- a/recipes/openssl/config.yml +++ b/recipes/openssl/config.yml @@ -1,22 +1,25 @@ versions: - # 3.0.x releases - 3.0.7: + "3.3.2": folder: "3.x.x" - 3.0.5: + "3.3.1": folder: "3.x.x" - 3.0.4: + "3.2.3": folder: "3.x.x" - - # 1.1.1x releases - 1.1.1s: - folder: "1.x.x" - 1.1.1q: - folder: "1.x.x" - 1.1.1p: - folder: "1.x.x" - # 1.1.0x releases - 1.1.0l: - folder: "1.x.x" - # 1.0.2x releases - 1.0.2u: + "3.2.2": + folder: "3.x.x" + "3.2.1": + folder: "3.x.x" + "3.1.7": + folder: "3.x.x" + "3.1.6": + folder: "3.x.x" + "3.1.5": + folder: "3.x.x" + "3.0.15": + folder: "3.x.x" + "3.0.14": + folder: "3.x.x" + "3.0.13": + folder: "3.x.x" + "1.1.1w": folder: "1.x.x" diff --git a/recipes/opensubdiv/all/CMakeLists.txt b/recipes/opensubdiv/all/CMakeLists.txt deleted file mode 100644 index b71c882d9d33f..0000000000000 --- a/recipes/opensubdiv/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/opensubdiv/all/conandata.yml b/recipes/opensubdiv/all/conandata.yml index c9db5e6f5cfd4..803deaf9df19e 100644 --- a/recipes/opensubdiv/all/conandata.yml +++ b/recipes/opensubdiv/all/conandata.yml @@ -1,4 +1,26 @@ sources: + "3.6.0": + url: "https://github.com/PixarAnimationStudios/OpenSubdiv/archive/refs/tags/v3_6_0.tar.gz" + sha256: "bebfd61ab6657a4f4ff27845fb66a167d00395783bfbd253254d87447ed1d879" + "3.5.0": + url: "https://github.com/PixarAnimationStudios/OpenSubdiv/archive/refs/tags/v3_5_0.tar.gz" + sha256: "8f5044f453b94162755131f77c08069004f25306fd6dc2192b6d49889efb8095" "3.4.4": - url: "https://github.com/PixarAnimationStudios/OpenSubdiv/archive/v3_4_4.zip" - sha256: "04b52a67e90a56b18d9ddd0384630f43b5263a8fdee1afae081e32d7b23cd5ec" + url: "https://github.com/PixarAnimationStudios/OpenSubdiv/archive/refs/tags/v3_4_4.tar.gz" + sha256: "20d49f80a2b778ad4d01f091ad88d8c2f91cf6c7363940c6213241ce6f1048fb" +patches: + "3.6.0": + - patch_file: "patches/3.6.0-0002-cmake-no-rpath.patch" + patch_description: "CMake: do not populate rpath with absolute paths" + patch_type: "conan" + "3.5.0": + - patch_file: "patches/3.4.4-0002-cmake-no-rpath.patch" + patch_description: "CMake: do not populate rpath with absolute paths" + patch_type: "conan" + "3.4.4": + - patch_file: "patches/3.4.4-0001-cmake-minimum-required.patch" + patch_description: "CMake: Fix position of cmake_minimum_required()" + patch_type: "conan" + - patch_file: "patches/3.4.4-0002-cmake-no-rpath.patch" + patch_description: "CMake: do not populate rpath with absolute paths" + patch_type: "conan" diff --git a/recipes/opensubdiv/all/conanfile.py b/recipes/opensubdiv/all/conanfile.py index 297736ec83eef..6f46f7d0625fe 100644 --- a/recipes/opensubdiv/all/conanfile.py +++ b/recipes/opensubdiv/all/conanfile.py @@ -1,12 +1,12 @@ -import functools -import os - from conan import ConanFile -from conan.tools.files import get, replace_in_file -from conans import CMake, tools from conan.errors import ConanInvalidConfiguration +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, replace_in_file, rm, rmdir +from conan.tools.scm import Version +import os -required_conan_version = ">=1.48.0" +required_conan_version = ">=1.54.0" class OpenSubdivConan(ConanFile): @@ -16,10 +16,11 @@ class OpenSubdivConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" description = "An Open-Source subdivision surface library" topics = ("cgi", "vfx", "animation", "subdivision surface") - - settings = "os", "compiler", "build_type", "arch" + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], + "fPIC": [True, False], "with_tbb": [True, False], "with_opengl": [True, False], "with_omp": [True, False], @@ -31,6 +32,7 @@ class OpenSubdivConan(ConanFile): } default_options = { "shared": False, + "fPIC": True, "with_tbb": False, "with_opengl": False, "with_omp": False, @@ -42,62 +44,64 @@ class OpenSubdivConan(ConanFile): } short_paths = True - generators = "cmake" - - @property - def _source_subfolder(self): - return "source_subfolder" @property - def _build_subfolder(self): - return "build_subfolder" - - @property - def _minimum_cpp_standard(self): + def _min_cppstd(self): if self.options.get_safe("with_metal"): - return 14 - return 11 + return "14" + return "11" @property def _minimum_compilers_version(self): return { "Visual Studio": "15", + "msvc": "191", "gcc": "5", "clang": "11", "apple-clang": "11.0", } def export_sources(self): - self.copy("CMakeLists.txt") + export_conandata_patches(self) def config_options(self): - if self.settings.os != "Windows": + if self.settings.os == "Windows": + del self.options.fPIC + else: del self.options.with_dx if self.settings.os != "Macos": del self.options.with_metal def configure(self): - if self.settings.os == "Windows": - del self.options.shared + 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_tbb: - self.requires("onetbb/2020.3") + # OpenSubdiv < 3.6.0 support only onettbb/2020.x.x + # https://github.com/PixarAnimationStudios/OpenSubdiv/pull/1317 + if Version(self.version) < "3.6.0": + self.requires("onetbb/2020.3.3", transitive_headers=True) + else: + self.requires("onetbb/2021.10.0", transitive_headers=True) def validate(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) - ) + check_min_cppstd(self, self._min_cppstd) + min_version = self._minimum_compilers_version.get(str(self.settings.compiler), False) + 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." + ) + + if self.options.shared and self.settings.os == "Windows": + raise ConanInvalidConfiguration(f"{self.ref} shared not supported on Windows") 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) @property def _osd_gpu_enabled(self): @@ -111,59 +115,71 @@ def _osd_gpu_enabled(self): ] ) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - 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") - cmake.definitions["NO_OMP"] = not self.options.with_omp - cmake.definitions["NO_CUDA"] = not self.options.with_cuda - cmake.definitions["NO_DX"] = not self.options.get_safe("with_dx") - 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_DOC"] = True - cmake.definitions["NO_EXAMPLES"] = True - cmake.definitions["NO_TUTORIALS"] = True - cmake.definitions["NO_REGRESSION"] = True - cmake.definitions["NO_TESTS"] = True - cmake.definitions["NO_GLTESTS"] = True - - cmake.configure(build_folder=self._build_subfolder) - - return cmake + 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["NO_TBB"] = not self.options.with_tbb + tc.variables["NO_OPENGL"] = not self.options.with_opengl + tc.variables["BUILD_SHARED_LIBS"] = self.options.get_safe("shared") + tc.variables["NO_OMP"] = not self.options.with_omp + tc.variables["NO_CUDA"] = not self.options.with_cuda + tc.variables["NO_DX"] = not self.options.get_safe("with_dx") + tc.variables["NO_METAL"] = not self.options.get_safe("with_metal") + tc.variables["NO_CLEW"] = not self.options.with_clew + tc.variables["NO_OPENCL"] = not self.options.with_opencl + tc.variables["NO_PTEX"] = True # Note: PTEX is for examples only, but we skip them.. + tc.variables["NO_DOC"] = True + tc.variables["NO_EXAMPLES"] = True + tc.variables["NO_TUTORIALS"] = True + tc.variables["NO_REGRESSION"] = True + tc.variables["NO_TESTS"] = True + tc.variables["NO_GLTESTS"] = True + tc.variables["NO_MACOS_FRAMEWORK"] = True + tc.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + if self.settings.os == "Macos" and not self._osd_gpu_enabled: + path = os.path.join(self.source_folder, "opensubdiv", "CMakeLists.txt") + replace_in_file(self, path, "$", "") + # No warnings as errors + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "/WX", "") 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") - if not self._osd_gpu_enabled: - replace_in_file(self, path, "$", "") - cmake = self._configure_cmake() + self._patch_sources() + 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() + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + if self.options.shared: + rm(self, "*.a", os.path.join(self.package_folder, "lib")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "OpenSubdiv") + target_suffix = "" if self.options.shared else "_static" - self.cpp_info.names["cmake_find_package"] = "OpenSubdiv" - self.cpp_info.names["cmake_find_package_multi"] = "OpenSubdiv" - + self.cpp_info.components["osdcpu"].set_property("cmake_target_name", f"OpenSubdiv::osdcpu{target_suffix}") self.cpp_info.components["osdcpu"].libs = ["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"].set_property("cmake_target_name", f"OpenSubdiv::osdgpu{target_suffix}") self.cpp_info.components["osdgpu"].libs = ["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"] + + # TODO: to remove in conan v2 + self.cpp_info.names["cmake_find_package"] = "OpenSubdiv" + self.cpp_info.names["cmake_find_package_multi"] = "OpenSubdiv" + self.cpp_info.components["osdcpu"].names["cmake_find_package"] = f"osdcpu{target_suffix}" + self.cpp_info.components["osdcpu"].names["cmake_find_package_multi"] = f"osdcpu{target_suffix}" + self.cpp_info.components["osdgpu"].names["cmake_find_package"] = f"osdgpu{target_suffix}" + self.cpp_info.components["osdgpu"].names["cmake_find_package_multi"] = f"osdgpu{target_suffix}" diff --git a/recipes/opensubdiv/all/patches/3.4.4-0001-cmake-minimum-required.patch b/recipes/opensubdiv/all/patches/3.4.4-0001-cmake-minimum-required.patch new file mode 100644 index 0000000000000..b5cdfb823f789 --- /dev/null +++ b/recipes/opensubdiv/all/patches/3.4.4-0001-cmake-minimum-required.patch @@ -0,0 +1,13 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -22,9 +22,9 @@ + # language governing permissions and limitations under the Apache License. + # + ++cmake_minimum_required(VERSION 3.1) + project(OpenSubdiv) + +-cmake_minimum_required(VERSION 2.8.6) + + # Turn on folder support + set_property(GLOBAL PROPERTY USE_FOLDERS ON) diff --git a/recipes/opensubdiv/all/patches/3.4.4-0002-cmake-no-rpath.patch b/recipes/opensubdiv/all/patches/3.4.4-0002-cmake-no-rpath.patch new file mode 100644 index 0000000000000..28d5b935a34e9 --- /dev/null +++ b/recipes/opensubdiv/all/patches/3.4.4-0002-cmake-no-rpath.patch @@ -0,0 +1,15 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -146,12 +146,10 @@ if (NOT CMAKE_COMPILER_IS_ICC) + # sequences of ':' that this command causes. The consequence is that examples + # built and installed using icc will not have an rpath pointing to the built + # OSD library which they depend on and will have to set LD_LIBRARY_PATH instead. +- list(APPEND CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") + endif() + + # 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) + + # ensure that ARC is shown as enabled in the Xcode UI + if(CMAKE_GENERATOR STREQUAL "Xcode") diff --git a/recipes/opensubdiv/all/patches/3.6.0-0002-cmake-no-rpath.patch b/recipes/opensubdiv/all/patches/3.6.0-0002-cmake-no-rpath.patch new file mode 100644 index 0000000000000..e8cb72fb5398d --- /dev/null +++ b/recipes/opensubdiv/all/patches/3.6.0-0002-cmake-no-rpath.patch @@ -0,0 +1,19 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 8620cf3..aba7a90 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -157,12 +157,12 @@ if (NOT CMAKE_COMPILER_IS_ICC) + # sequences of ':' that this command causes. The consequence is that examples + # built and installed using icc will not have an rpath pointing to the built + # OSD library which they depend on and will have to set LD_LIBRARY_PATH instead. +- list(APPEND CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") ++# list(APPEND CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") + endif() + + # 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) ++#SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + + # ensure that ARC is shown as enabled in the Xcode UI + if(CMAKE_GENERATOR STREQUAL "Xcode") diff --git a/recipes/opensubdiv/all/test_package/CMakeLists.txt b/recipes/opensubdiv/all/test_package/CMakeLists.txt index 03f2ff1d46044..eae6cba922206 100644 --- a/recipes/opensubdiv/all/test_package/CMakeLists.txt +++ b/recipes/opensubdiv/all/test_package/CMakeLists.txt @@ -1,13 +1,11 @@ cmake_minimum_required(VERSION 3.1) -project(PackageTest CXX) +project(test_package LANGUAGES CXX) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS OFF) +find_package(OpenSubdiv REQUIRED CONFIG) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(OpenSubdiv REQUIRED) - -add_executable(example example.cpp) -target_link_libraries(example OpenSubdiv::OpenSubdiv) +add_executable(${PROJECT_NAME} test_package.cpp) +if(TARGET OpenSubdiv::osdcpu_static) + target_link_libraries(${PROJECT_NAME} PRIVATE OpenSubdiv::osdcpu_static) +else() + target_link_libraries(${PROJECT_NAME} PRIVATE OpenSubdiv::osdcpu) +endif() diff --git a/recipes/opensubdiv/all/test_package/conanfile.py b/recipes/opensubdiv/all/test_package/conanfile.py index c08cb9fda4903..98ab55852ad56 100644 --- a/recipes/opensubdiv/all/test_package/conanfile.py +++ b/recipes/opensubdiv/all/test_package/conanfile.py @@ -1,12 +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 -from conan.tools.build import cross_building +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" -class USDTestConan(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) @@ -14,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not 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/opensubdiv/all/test_package/example.cpp b/recipes/opensubdiv/all/test_package/test_package.cpp similarity index 100% rename from recipes/opensubdiv/all/test_package/example.cpp rename to recipes/opensubdiv/all/test_package/test_package.cpp diff --git a/recipes/opensubdiv/all/test_v1_package/CMakeLists.txt b/recipes/opensubdiv/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/opensubdiv/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/opensubdiv/all/test_v1_package/conanfile.py b/recipes/opensubdiv/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/opensubdiv/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/opensubdiv/config.yml b/recipes/opensubdiv/config.yml index bd356e3c6a168..fde3364b74fa3 100644 --- a/recipes/opensubdiv/config.yml +++ b/recipes/opensubdiv/config.yml @@ -1,3 +1,7 @@ versions: + "3.6.0": + folder: all + "3.5.0": + folder: all "3.4.4": folder: all diff --git a/recipes/opentdf-client/all/CMakeLists.txt b/recipes/opentdf-client/all/CMakeLists.txt deleted file mode 100644 index 93dc9e86f93f9..0000000000000 --- a/recipes/opentdf-client/all/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(opentdf-client) - -set(CMAKE_CXX_STANDARD 17) - -include(${CMAKE_SOURCE_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/opentdf-client/all/conan_cmake_project_include.cmake b/recipes/opentdf-client/all/conan_cmake_project_include.cmake new file mode 100644 index 0000000000000..795904b844ae4 --- /dev/null +++ b/recipes/opentdf-client/all/conan_cmake_project_include.cmake @@ -0,0 +1,11 @@ +find_package(Boost REQUIRED) +find_package(OpenSSL REQUIRED) +find_package(Microsoft.GSL REQUIRED) +find_package(nlohmann_json REQUIRED) +find_package(libxml2 REQUIRED) +find_package(jwt-cpp REQUIRED) +find_package(ZLIB REQUIRED) +if(opentdf_VERSION VERSION_GREATER_EQUAL "1.4.0") + find_package(magic_enum REQUIRED) +endif() +link_libraries(Boost::boost OpenSSL::SSL Microsoft.GSL::GSL nlohmann_json::nlohmann_json LibXml2::LibXml2 jwt-cpp::jwt-cpp $ ZLIB::ZLIB) diff --git a/recipes/opentdf-client/all/conandata.yml b/recipes/opentdf-client/all/conandata.yml index b3ede12a6440c..9d4618fc288dc 100644 --- a/recipes/opentdf-client/all/conandata.yml +++ b/recipes/opentdf-client/all/conandata.yml @@ -1,49 +1,32 @@ 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" - "1.1.3": - url: "https://github.com/opentdf/client-cpp/archive/1.1.3.tar.gz" - sha256: "67855999010f9c1496e170ad885f73b854f91eb1539e3c20d74b162295d5c732" - "1.1.2": - url: "https://github.com/opentdf/client-cpp/archive/1.1.2.tar.gz" - sha256: "4e41a18ef9d47aa9f964beffa78fdd4290a5f50336c6e4dc3c9bf2dd4b075d10" - "1.1.0": - url: "https://github.com/opentdf/client-cpp/archive/1.1.0.tar.gz" - sha256: "2c4c8c00ad67e71b3ad9a5d0473e33a51c8756af68971f0db9218f0e337aa1a5" - "1.0.0": - url: "https://github.com/opentdf/client-cpp/archive/1.0.0.tar.gz" - sha256: "a0c38aa06bb592b8749f8d02cbe67cbe7e35f83fde24b47c516ff28801414ac3" + "1.5.6": + url: "https://github.com/opentdf/client-cpp/archive/1.5.6.tar.gz" + sha256: "3f46d9a175ce67fc2814faf34a42bc6ff9519d9a80ae7dbdd8d34317231a404a" + "1.5.4": + url: "https://github.com/opentdf/client-cpp/archive/1.5.4.tar.gz" + sha256: "7902d3f09b632ac3827f3c9c8fd1a1f7c8fdff82eeed2157385278b91a7f515f" + "1.5.3": + url: "https://github.com/opentdf/client-cpp/archive/1.5.3.tar.gz" + sha256: "43812a99b8942cd8f600f7ea284118e8af7d000705b2602991f889fe49dd3455" + "1.5.0": + url: "https://github.com/opentdf/client-cpp/archive/1.5.0.tar.gz" + sha256: "0d6134634c0c6fde5e8457361332242259e1ef238e5254ccbed2f94549998c48" + "1.4.0": + url: "https://github.com/opentdf/client-cpp/archive/1.4.0.tar.gz" + sha256: "0ef9cdf5e49f83a8ddcde10d64cdf9108652e781396cfab000f50cc067e6f795" + "1.3.10": + url: "https://github.com/opentdf/client-cpp/archive/1.3.10.tar.gz" + sha256: "539bd5e64bceb86f63b3f7db75de470d5ea1d52ae6436a6a2d6789f7d0710dd4" patches: - "1.1.0": - - patch_file: "patches/0001-1.1.0-fstream-missing.patch" - base_path: "source_subfolder" - - patch_file: "patches/0002-1.1.0-cmake-install.patch" - base_path: "source_subfolder" - - patch_file: "patches/0003-1.1.0-cmake-find-package.patch" - base_path: "source_subfolder" - "1.0.0": - - patch_file: "patches/0001-1.0.0-fstream-missing.patch" - base_path: "source_subfolder" - - patch_file: "patches/0002-1.0.0-cmake-install.patch" - base_path: "source_subfolder" - - patch_file: "patches/0003-1.0.0-cmake-find-package.patch" - base_path: "source_subfolder" + "1.5.0": + - patch_file: "patches/1.3.10-0001-cmake-fixes.patch" + patch_description: "CMake build fixes for Conan 2.0-compatible recipe" + patch_type: "conan" + "1.4.0": + - patch_file: "patches/1.3.10-0001-cmake-fixes.patch" + patch_description: "CMake build fixes for Conan 2.0-compatible recipe" + patch_type: "conan" + "1.3.10": + - patch_file: "patches/1.3.10-0001-cmake-fixes.patch" + patch_description: "CMake build fixes for Conan 2.0-compatible recipe" + patch_type: "conan" diff --git a/recipes/opentdf-client/all/conanfile.py b/recipes/opentdf-client/all/conanfile.py index c9196497bfc1a..1709d84e6a285 100644 --- a/recipes/opentdf-client/all/conanfile.py +++ b/recipes/opentdf-client/all/conanfile.py @@ -1,35 +1,38 @@ -from conans import CMake +import os + from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.files import get, copy, patch 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.files import apply_conandata_patches, export_conandata_patches, get, copy from conan.tools.microsoft import is_msvc_static_runtime -import functools -import os +from conan.tools.scm import Version -required_conan_version = ">=1.51.3" +required_conan_version = ">=1.53.0" class OpenTDFConan(ConanFile): name = "opentdf-client" - url = "https://github.com/conan-io/conan-center-index" - homepage = "https://www.virtru.com" - topics = ("opentdf", "opentdf-client", "tdf", "virtru") description = "openTDF core c++ client library for creating and accessing TDF protected data" license = "BSD-3-Clause-Clear" - generators = "cmake", "cmake_find_package" - settings = "os", "arch", "compiler", "build_type" - options = {"fPIC": [True, False]} - default_options = {"fPIC": True} + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://www.virtru.com" + topics = ("opentdf", "tdf", "virtru") - @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 _build_subfolder(self): - return "build_subfolder" + def export_sources(self): + copy(self, "conan_cmake_project_include.cmake", self.recipe_folder, os.path.join(self.export_sources_folder, "src")) + export_conandata_patches(self) @property def _minimum_cpp_standard(self): @@ -38,84 +41,122 @@ def _minimum_cpp_standard(self): @property def _minimum_compilers_version(self): return { - "Visual Studio": "17" if Version(self.version) < "1.1.5" else "15", - "msvc": "193" if Version(self.version) < "1.1.5" else "191", - "gcc": "7.5.0", + "Visual Studio": "15", + "msvc": "191", + "gcc": "7.5", "clang": "12", - "apple-clang": "12.0.0", + "apple-clang": "12", } - def export_sources(self): - self.copy("CMakeLists.txt") - for data in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(data["patch_file"]) + 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): + # Uses openssl 3.x for 1.5.0 and newer + if Version(self.version) >= "1.5.0": + self.requires("openssl/[>=3.1 <4]") + else: + self.requires("openssl/1.1.1w") + # Uses magic_enum for 1.4.0 and newer + if Version(self.version) >= "1.4.0": + self.requires("magic_enum/0.8.2") + self.requires("ms-gsl/2.1.0") + self.requires("nlohmann_json/3.11.3") + self.requires("jwt-cpp/0.4.0") + self.requires("zlib/[>=1.2.11 <2]") + self.requires("boost/1.83.0") + self.requires("libxml2/2.11.6") def validate(self): - # check minimum cpp standard supported by compiler if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, self._minimum_cpp_standard) # check minimum version of compiler 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} compiler support.') + self.output.warning( + f"{self.name} 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 {self.settings.compiler} {self.settings.compiler.version} but found {min_version}') + raise ConanInvalidConfiguration( + f"{self.name} requires {self.settings.compiler} {self.settings.compiler.version} " + f"but found {min_version}" + ) # Disallow MT and MTd if is_msvc_static_runtime(self): - raise ConanInvalidConfiguration(f'{self.name} can not be built with MT or MTd at this time') - - def requirements(self): - self.requires("openssl/1.1.1q") - self.requires("boost/1.79.0") - self.requires("ms-gsl/2.1.0") - self.requires("libxml2/2.9.14") - self.requires("nlohmann_json/3.11.1") - self.requires("jwt-cpp/0.4.0") - # Do not need libarchive after 1.0.0 - if Version(self.version) < "1.1.0": - self.requires("libarchive/3.6.1") + raise ConanInvalidConfiguration(f"{self.name} can not be built with MT or MTd at this time") - def config_options(self): - if self.settings.os == "Windows": - del self.options.fPIC + if self.options.shared and self.settings.os == "Windows": + raise ConanInvalidConfiguration(f"{self.name} does not currently support shared library on Windows") 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 generate(self): + tc = CMakeToolchain(self) + if not self.settings.get_safe("compiler.cppstd"): + tc.variables["CMAKE_CXX_STANDARD"] = 17 + tc.cache_variables["CMAKE_PROJECT_opentdf_INCLUDE"] = os.path.join(self.source_folder, "conan_cmake_project_include.cmake") + tc.generate() + tc = CMakeDeps(self) + tc.generate() - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.configure(build_folder=self._build_subfolder) - return cmake + def _patch_sources(self): + apply_conandata_patches(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() + cmake = CMake(self) cmake.install() - copy(self, "*", dst=os.path.join(self.package_folder, "lib"), src=os.path.join(os.path.join(self._source_subfolder,"tdf-lib-cpp"), "lib"), keep_path=False) - copy(self, "*", dst=os.path.join(self.package_folder, "include"), src=os.path.join(os.path.join(self._source_subfolder,"tdf-lib-cpp"), "include"), keep_path=False) - copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self._source_subfolder, ignore_case=True, keep_path=False) + copy(self, "*", + dst=os.path.join(self.package_folder, "lib"), + src=os.path.join(os.path.join(self.source_folder, "tdf-lib-cpp"), "lib"), + keep_path=False) + copy(self, "*", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(os.path.join(self.source_folder, "tdf-lib-cpp"), "include"), + keep_path=False) + copy(self, "LICENSE", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder, + ignore_case=True, + keep_path=False) - # TODO - this only advertises the static lib, add dynamic lib also def package_info(self): self.cpp_info.set_property("cmake_file_name", "opentdf-client") self.cpp_info.set_property("cmake_target_name", "opentdf-client::opentdf-client") self.cpp_info.set_property("pkg_config_name", "opentdf-client") - self.cpp_info.components["libopentdf"].libs = ["opentdf_static"] + self.cpp_info.components["libopentdf"].libs = ["opentdf_static"] if not self.options.shared else ["opentdf"] self.cpp_info.components["libopentdf"].set_property("cmake_target_name", "copentdf-client::opentdf-client") self.cpp_info.components["libopentdf"].names["cmake_find_package"] = "opentdf-client" self.cpp_info.components["libopentdf"].names["cmake_find_package_multi"] = "opentdf-client" - self.cpp_info.components["libopentdf"].names["pkg_config"] = "opentdf-client" - self.cpp_info.components["libopentdf"].requires = ["openssl::openssl", "boost::boost", "ms-gsl::ms-gsl", "libxml2::libxml2", "jwt-cpp::jwt-cpp", "nlohmann_json::nlohmann_json"] - if Version(self.version) < "1.1.0": - self.cpp_info.components["libopentdf"].requires.append("libarchive::libarchive") + self.cpp_info.components["libopentdf"].requires = [ + "openssl::openssl", + "boost::boost", + "ms-gsl::ms-gsl", + "libxml2::libxml2", + "jwt-cpp::jwt-cpp", + "nlohmann_json::nlohmann_json", + "zlib::zlib" + ] + if Version(self.version) >= "1.4.0": + self.cpp_info.components["libopentdf"].requires.append("magic_enum::magic_enum") + if Version(self.version) >= "1.4.0": + self.cpp_info.components["libopentdf"].requires.append("magic_enum::magic_enum") + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") diff --git a/recipes/opentdf-client/all/patches/0001-1.0.0-fstream-missing.patch b/recipes/opentdf-client/all/patches/0001-1.0.0-fstream-missing.patch deleted file mode 100644 index 31155f8791293..0000000000000 --- a/recipes/opentdf-client/all/patches/0001-1.0.0-fstream-missing.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff --git a/src/lib/include/test/test_utils.cpp b/src/lib/include/test/test_utils.cpp -index 349c8d6..a49ad04 100644 ---- a/src/lib/include/test/test_utils.cpp -+++ b/src/lib/include/test/test_utils.cpp -@@ -18,6 +18,7 @@ - #include - #include - #include -+#include - - #ifdef _WINDOWS - #include -diff --git a/src/lib/src/tdf_impl.cpp b/src/lib/src/tdf_impl.cpp -index 6a6ce9b..21a8f30 100644 ---- a/src/lib/src/tdf_impl.cpp -+++ b/src/lib/src/tdf_impl.cpp -@@ -34,6 +34,7 @@ - #include - #include - #include -+#include - #include - #include - #include diff --git a/recipes/opentdf-client/all/patches/0001-1.1.0-fstream-missing.patch b/recipes/opentdf-client/all/patches/0001-1.1.0-fstream-missing.patch deleted file mode 100644 index 434152647b823..0000000000000 --- a/recipes/opentdf-client/all/patches/0001-1.1.0-fstream-missing.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff --git a/src/lib/include/test/test_utils.cpp b/src/lib/include/test/test_utils.cpp -index 349c8d6..a49ad04 100644 ---- a/src/lib/include/test/test_utils.cpp -+++ b/src/lib/include/test/test_utils.cpp -@@ -18,6 +18,7 @@ - #include - #include - #include -+#include - - #ifdef _WINDOWS - #include -diff --git a/src/lib/src/tdf_impl.cpp b/src/lib/src/tdf_impl.cpp -index 4ceb216..c113708 100644 ---- a/src/lib/src/tdf_impl.cpp -+++ b/src/lib/src/tdf_impl.cpp -@@ -39,6 +39,7 @@ - #include - #include - #include -+#include - #include - #include - #include diff --git a/recipes/opentdf-client/all/patches/0002-1.0.0-cmake-install.patch b/recipes/opentdf-client/all/patches/0002-1.0.0-cmake-install.patch deleted file mode 100644 index 118bf88805386..0000000000000 --- a/recipes/opentdf-client/all/patches/0002-1.0.0-cmake-install.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt -index f8bfc92..b1ae13c 100644 ---- a/src/lib/CMakeLists.txt -+++ b/src/lib/CMakeLists.txt -@@ -224,7 +224,7 @@ endif() - # Package tdf lib for customer - ############################################################ - --set(TDF_LIB_INSTALL_LOCATION ${PROJECT_SOURCE_DIR}/../../tdf-lib-cpp) -+set(TDF_LIB_INSTALL_LOCATION ${CMAKE_INSTALL_PREFIX}) - install(DIRECTORY DESTINATION ${TDF_LIB_INSTALL_LOCATION}) - - # move the headers(to include) and tdf(to lib) directory under tdf-lib-cpp -@@ -244,7 +244,4 @@ else() - DESTINATION ${TDF_LIB_INSTALL_LOCATION}/lib) - endif() - --install(FILES ${PROJECT_SOURCE_DIR}/../../README.md DESTINATION ${TDF_LIB_INSTALL_LOCATION}) --install(FILES ${PROJECT_SOURCE_DIR}/../../LICENSE DESTINATION ${TDF_LIB_INSTALL_LOCATION}) --install(FILES ${PROJECT_SOURCE_DIR}/../../VERSION DESTINATION ${TDF_LIB_INSTALL_LOCATION}) - diff --git a/recipes/opentdf-client/all/patches/0002-1.1.0-cmake-install.patch b/recipes/opentdf-client/all/patches/0002-1.1.0-cmake-install.patch deleted file mode 100644 index d7e8fa4aaec79..0000000000000 --- a/recipes/opentdf-client/all/patches/0002-1.1.0-cmake-install.patch +++ /dev/null @@ -1,22 +0,0 @@ -diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt -index 2fdeb68..347e4e9 100644 ---- a/src/lib/CMakeLists.txt -+++ b/src/lib/CMakeLists.txt -@@ -217,7 +217,7 @@ endif() - # Package tdf lib for customer - ############################################################ - --set(TDF_LIB_INSTALL_LOCATION ${PROJECT_SOURCE_DIR}/../../tdf-lib-cpp) -+set(TDF_LIB_INSTALL_LOCATION ${CMAKE_INSTALL_PREFIX}) - install(DIRECTORY DESTINATION ${TDF_LIB_INSTALL_LOCATION}) - - # move the headers(to include) and tdf(to lib) directory under tdf-lib-cpp -@@ -237,7 +237,4 @@ else() - DESTINATION ${TDF_LIB_INSTALL_LOCATION}/lib) - endif() - --install(FILES ${PROJECT_SOURCE_DIR}/../../README.md DESTINATION ${TDF_LIB_INSTALL_LOCATION}) --install(FILES ${PROJECT_SOURCE_DIR}/../../LICENSE DESTINATION ${TDF_LIB_INSTALL_LOCATION}) --install(FILES ${PROJECT_SOURCE_DIR}/../../VERSION DESTINATION ${TDF_LIB_INSTALL_LOCATION}) - - diff --git a/recipes/opentdf-client/all/patches/0003-1.0.0-cmake-find-package.patch b/recipes/opentdf-client/all/patches/0003-1.0.0-cmake-find-package.patch deleted file mode 100644 index 12e2fccf407bb..0000000000000 --- a/recipes/opentdf-client/all/patches/0003-1.0.0-cmake-find-package.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 1e0d0c3..b46fa5f 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -13,9 +13,9 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) - - find_package("OpenSSL") - find_package("Boost") --find_package("ms_gsl") -+find_package("Microsoft.GSL") - find_package("LibXml2") --find_package("libarchive") -+find_package("LibArchive") - find_package("nlohmann_json") - find_package("jwt-cpp") - diff --git a/recipes/opentdf-client/all/patches/0003-1.1.0-cmake-find-package.patch b/recipes/opentdf-client/all/patches/0003-1.1.0-cmake-find-package.patch deleted file mode 100644 index 9e51e949d9e65..0000000000000 --- a/recipes/opentdf-client/all/patches/0003-1.1.0-cmake-find-package.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 634cb1f..603136c 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -13,7 +13,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) - - find_package("OpenSSL") - find_package("Boost") --find_package("ms_gsl") -+find_package("Microsoft.GSL") - find_package("LibXml2") - find_package("nlohmann_json") - find_package("jwt-cpp") diff --git a/recipes/opentdf-client/all/patches/1.3.10-0001-cmake-fixes.patch b/recipes/opentdf-client/all/patches/1.3.10-0001-cmake-fixes.patch new file mode 100644 index 0000000000000..9901f248faf03 --- /dev/null +++ b/recipes/opentdf-client/all/patches/1.3.10-0001-cmake-fixes.patch @@ -0,0 +1,51 @@ +diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt +index d7e1dc1..aeb3b2c 100644 +--- a/src/lib/CMakeLists.txt ++++ b/src/lib/CMakeLists.txt +@@ -99,7 +99,9 @@ set(TDF_COMBINED_LIB_FULL_PATH ${TDF_LIB_DIR}/${TDF_COMBINED_LIB_FILENAME}) + message(STATUS "Combined full path: ${TDF_COMBINED_LIB_FULL_PATH}") + + #TODO: Also need to handle iOS and Android(arm64). +-if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") ++if(TRUE) ++ message(STATUS "Skipping generation of combined static library") ++elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + + FOREACH (LDIR ${CONAN_LIB_DIRS}) + set(V_COMBINED_LIB_DIRS ${V_COMBINED_LIB_DIRS} -L${LDIR}) +@@ -155,8 +157,6 @@ elseif (${CMAKE_SYSTEM_NAME} MATCHES "Windows") + lib -out:${TDF_LIB_DIR}/${TDF_COMBINED_LIB_FILENAME} ${TDF_LIB_DIR}/${TDF_STATIC_LIB_FILENAME} ${V_COMBINED_LIB_DIRS} ${V_COMBINED_LIB_NAMES} + ) + ) +-else() +- message(STATUS "${CMAKE_SYSTEM_NAME} - unknown system FIXME........") + endif() + + # generate the shared library from the library sources +@@ -187,16 +187,19 @@ install(DIRECTORY DESTINATION ${TDF_LIB_INSTALL_LOCATION}) + # move the headers(to include) and tdf(to lib) directory under tdf-lib-cpp + install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/ + DESTINATION ${TDF_LIB_INSTALL_LOCATION}/include) +- +-install(FILES ${TDF_STATIC_LIB_FULL_PATH} +- DESTINATION ${TDF_LIB_INSTALL_LOCATION}/lib) + +-install(FILES ${TDF_COMBINED_LIB_FULL_PATH} +- DESTINATION ${TDF_LIB_INSTALL_LOCATION}/lib) ++if(NOT BUILD_SHARED_LIBS) ++ install(FILES $ ++ DESTINATION ${TDF_LIB_INSTALL_LOCATION}/lib) ++endif() ++ ++# Skip combined static library for Conan Center Index package ++# install(FILES ${TDF_COMBINED_LIB_FULL_PATH} ++# DESTINATION ${TDF_LIB_INSTALL_LOCATION}/lib) + + if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") + message(STATUS "Skipping shared lib on windows") +-else() +- install(FILES ${TDF_SHARED_LIB_FULL_PATH} ++elseif(BUILD_SHARED_LIBS) ++ install(FILES $ + DESTINATION ${TDF_LIB_INSTALL_LOCATION}/lib) + endif() diff --git a/recipes/opentdf-client/all/test_package/CMakeLists.txt b/recipes/opentdf-client/all/test_package/CMakeLists.txt index 90a74a2912fcb..d73e39aaa8604 100644 --- a/recipes/opentdf-client/all/test_package/CMakeLists.txt +++ b/recipes/opentdf-client/all/test_package/CMakeLists.txt @@ -1,12 +1,9 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) set(CMAKE_CXX_STANDARD 17) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(opentdf-client CONFIG REQUIRED) +find_package(opentdf-client REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} opentdf-client::opentdf-client) diff --git a/recipes/opentdf-client/all/test_package/conanfile.py b/recipes/opentdf-client/all/test_package/conanfile.py index cffa32351d969..ef5d7042163ec 100644 --- a/recipes/opentdf-client/all/test_package/conanfile.py +++ b/recipes/opentdf-client/all/test_package/conanfile.py @@ -1,11 +1,19 @@ -from conans import CMake from conan import ConanFile -from conan.tools.build import cross_building +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) @@ -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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/opentdf-client/config.yml b/recipes/opentdf-client/config.yml index b9d93dc47c8d4..e621751db7c3c 100644 --- a/recipes/opentdf-client/config.yml +++ b/recipes/opentdf-client/config.yml @@ -1,23 +1,13 @@ versions: - "1.3.6": + "1.5.6": folder: all - "1.3.4": + "1.5.4": folder: all - "1.3.3": + "1.5.3": folder: all - "1.3.2": + "1.5.0": folder: all - "1.2.0": + "1.4.0": folder: all - "1.1.6": - folder: all - "1.1.5": - folder: all - "1.1.3": - folder: all - "1.1.2": - folder: all - "1.1.0": - folder: all - "1.0.0": + "1.3.10": folder: all diff --git a/recipes/opentelemetry-cpp/all/conandata.yml b/recipes/opentelemetry-cpp/all/conandata.yml index 88ad3e40bea9c..1906e472cd519 100644 --- a/recipes/opentelemetry-cpp/all/conandata.yml +++ b/recipes/opentelemetry-cpp/all/conandata.yml @@ -1,59 +1,19 @@ 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" - "1.4.0": - url: "https://github.com/open-telemetry/opentelemetry-cpp/archive/refs/tags/v1.4.0.tar.gz" - sha256: "110f4fb2e38dcc72a421647631cfbb9429afd3c77c6c98829cc1d11bd0c72563" - "1.3.0": - url: "https://github.com/open-telemetry/opentelemetry-cpp/archive/refs/tags/v1.3.0.tar.gz" - sha256: "6a4c43b9c9f753841ebc0fe2717325271f02e2a1d5ddd0b52735c35243629ab3" - "1.2.0": - url: "https://github.com/open-telemetry/opentelemetry-cpp/archive/refs/tags/v1.2.0.tar.gz" - sha256: "7a6420f9e4fa44b81a5b06e30e5e116da71decc9086e5cc4f126e1efc8a397c2" - "1.0.1": - url: "https://github.com/open-telemetry/opentelemetry-cpp/archive/refs/tags/v1.0.1.tar.gz" - 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" - 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" - 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" - 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" + "1.17.0": + url: "https://github.com/open-telemetry/opentelemetry-cpp/archive/v1.17.0.tar.gz" + sha256: "13542725463f1ea106edaef078c2276065cf3da998cb1d3dcf92630daa3f64d4" + "1.16.1": + url: "https://github.com/open-telemetry/opentelemetry-cpp/archive/v1.16.1.tar.gz" + sha256: "b8a78bb2a3a78133dbb08bcd04342f4b1e03cb4a19079b8416d408d905fffc37" + "1.14.2": + url: "https://github.com/open-telemetry/opentelemetry-cpp/archive/v1.14.2.tar.gz" + sha256: "c7e7801c9f6228751cdb9dd4724d0f04777ed53f524c8828e73bf4c9f894e0bd" + "1.12.0": + url: "https://github.com/open-telemetry/opentelemetry-cpp/archive/v1.12.0.tar.gz" + sha256: "09c208a21fb1159d114a3ea15dc1bcc5dee28eb39907ba72a6012d2c7b7564a0" + "1.9.1": + url: "https://github.com/open-telemetry/opentelemetry-cpp/archive/v1.9.1.tar.gz" + sha256: "668de24f81c8d36d75092ad9dcb02a97cd41473adbe72485ece05e336db48249" + "1.8.3": + url: "https://github.com/open-telemetry/opentelemetry-cpp/archive/v1.8.3.tar.gz" + sha256: "b23d3c80d2e0012734ea343d2be69b2a7139ec5545453c503b13e629eb8fbe05" diff --git a/recipes/opentelemetry-cpp/all/conanfile.py b/recipes/opentelemetry-cpp/all/conanfile.py index 123f72d4a9130..33d46b7aade44 100644 --- a/recipes/opentelemetry-cpp/all/conanfile.py +++ b/recipes/opentelemetry-cpp/all/conanfile.py @@ -1,15 +1,16 @@ -from conan import ConanFile +from conan import ConanFile, conan_version 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.apple import is_apple_os +from conan.tools.files import 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 +from conan.tools.env import VirtualRunEnv, VirtualBuildEnv import os import textwrap -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.56.0 <2 || >=2.0.6" class OpenTelemetryCppConan(ConanFile): name = "opentelemetry-cpp" @@ -18,64 +19,209 @@ class OpenTelemetryCppConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/open-telemetry/opentelemetry-cpp" topics = ("opentelemetry", "telemetry", "tracing", "metrics", "logs") + package_type = "library" settings = "os", "arch", "compiler", "build_type" 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_grpc": [True, False], + "with_otlp_http": [True, False], + "with_otlp_http_compression": [True, False], + "with_otlp_file": [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, + # Enabling this causes stack overflow in the test_package + "with_stl": False, + "with_gsl": False, + "with_abseil": True, + "with_otlp_grpc": False, + # True because dependencies usually need this, and it would generate missing binaries for those + "with_otlp_http": True, + "with_otlp_http_compression": False, + "with_otlp_file": False, + "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, } short_paths = True @property - def _minimum_cpp_standard(self): + def _min_cppstd(self): + if self.options.with_abseil and Version(self.dependencies["abseil"].ref.version) >= "20230125": + return 14 return 11 - def export_sources(self): - export_conandata_patches(self) + @property + def _compilers_minimum_version(self): + if self._min_cppstd == 14: + return { + "gcc": "6", + "clang": "5", + "apple-clang": "10", + "Visual Studio": "16", + "msvc": "192", + } + else: + return { + "Visual Studio": "16", + "msvc": "192", + } def config_options(self): if self.settings.os == "Windows": - del self.options.fPIC + self.options.rm_safe("fPIC") + del self.options.with_etw + if Version(self.version) >= "1.10": + del self.options.with_jaeger + if Version(self.version) >= "1.11": + del self.options.with_logs_preview + if Version(self.version) < "1.16.0": + del self.options.with_otlp_file + del self.options.with_otlp_http_compression def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") + def _supports_new_proto_grpc_abseil(self): + """Old versions do not support the new proto grpc abseil combo + (Usage of old imports etc) + This is technically only for protobuf, but we take care to + keep abseil range in line, and grpc dependencies in sync so no + conflicts arise if using any of the 3 elsewhere + """ + return Version(self.version) >= "1.12.0" + + @property + def _needs_proto(self): + return self.options.with_otlp_grpc or self.options.with_otlp_http or self.options.get_safe("with_otlp_file") + + @property + def _otlp_http_needs_zlib(self): + # Bug before 1.17.X meant that zib was needed even with compression off + return (Version(self.version) >= "1.16.0" + # Check if new version released with this fix + # It was fixed in https://github.com/open-telemetry/opentelemetry-cpp/pull/3120 + and (Version(self.version) < "1.17.1" + or self.options.with_otlp_http_compression)) + def requirements(self): - self.requires("abseil/20220623.0") - self.requires("grpc/1.50.1") - self.requires("libcurl/7.86.0") - self.requires("nlohmann_json/3.11.2") - self.requires("openssl/1.1.1s") - if Version(self.version) <= "1.4.1": - self.requires("opentelemetry-proto/0.11.0") - else: - self.requires("opentelemetry-proto/0.19.0") - self.requires("protobuf/3.21.4") - self.requires("thrift/0.17.0") - if Version(self.version) >= "1.3.0": - self.requires("boost/1.80.0") + if self.options.with_gsl: + self.requires("ms-gsl/4.0.0") + + if self.options.with_abseil: + if self._supports_new_proto_grpc_abseil(): + self.requires("abseil/[>=20240116.1 <20240117.0]", transitive_headers=True) + else: + self.requires("abseil/[>=20230125.3 <=20230802.1]", transitive_headers=True) + + if self._needs_proto: + if self._supports_new_proto_grpc_abseil(): + self.requires("protobuf/5.27.0", transitive_headers=True, transitive_libs=True) + else: + self.requires("protobuf/3.21.12", transitive_headers=True, transitive_libs=True) + + if self.options.with_otlp_grpc: + if self._supports_new_proto_grpc_abseil(): + self.requires("grpc/1.67.1", transitive_headers=True, transitive_libs=True) + else: + self.requires("grpc/1.54.3", transitive_headers=True, transitive_libs=True) + + if (self.options.with_zipkin or + self.options.with_elasticsearch or + self.options.with_otlp_http or + self.options.get_safe("with_etw") or + self.options.get_safe("with_otlp_file") + ): + self.requires("nlohmann_json/3.11.3") + self.requires("openssl/[>=1.1 <4]") + + if (self.options.with_zipkin or + self.options.with_elasticsearch or + self.options.with_otlp_http + ): + self.requires("libcurl/[>=7.78.0 <9]") + + if self.options.with_otlp_http and self._otlp_http_needs_zlib: + self.requires("zlib/[>=1.2.11 <2]") + + if self.options.with_prometheus: + self.requires("prometheus-cpp/1.1.0") + + if self.options.get_safe("with_jaeger"): + self.requires("thrift/0.17.0") + self.requires("boost/1.85.0") - def validate(self): - if self.info.settings.arch != "x86_64": - raise ConanInvalidConfiguration(f"{self.ref} doesn't support architecture : {self.info.settings.arch}") + @property + def _required_boost_components(self): + return ["locale"] if self.options.get_safe("with_jaeger") else [] - if self.info.settings.compiler.cppstd: - check_min_cppstd(self, self._minimum_cpp_standard) - check_min_vs(self, "192") + 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 != "Linux" and self.options.shared: raise ConanInvalidConfiguration(f"{self.ref} supports building shared libraries only on Linux") + if self.options.with_otlp_grpc: + 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)}" + ) + + if conan_version.major == 1 and self.settings.compiler == "apple-clang" and Version(self.version) >= "1.12.0": + # Only fails on apple-clang in this configuration for some reason: + # https://github.com/conan-io/conan-center-index/pull/21332#issuecomment-1830766894 + raise ConanInvalidConfiguration("opentelemetry-cpp >= 1.12.0 does not support Apple Clang on Conan v1") + + def build_requirements(self): + if self._needs_proto: + self.tool_requires("opentelemetry-proto/1.3.2") + self.tool_requires("protobuf/") + + if self.options.with_otlp_grpc: + self.tool_requires("grpc/") + def _create_cmake_module_variables(self, module_file): content = textwrap.dedent("""\ set(OPENTELEMETRY_CPP_INCLUDE_DIRS ${opentelemetry-cpp_INCLUDE_DIRS} @@ -88,41 +234,80 @@ def _create_cmake_module_variables(self, module_file): save(self, module_file, content) 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 _stl_value(self): + # From 1.12.0 onwards, the STL can have various values + if Version(self.version) < "1.12.1": + return self.options.with_stl + if self.options.with_stl: + if self.settings.compiler.cppstd: + return "CXX" + str(self.settings.compiler.cppstd).replace("gnu", "") + else: + # ON for autodetection in upstream CML + return True + else: + return False def generate(self): + VirtualBuildEnv(self).generate(scope="build") + VirtualRunEnv(self).generate(scope="build") + tc = CMakeToolchain(self) - tc.variables["BUILD_TESTING"] = False - tc.variables["WITH_ABSEIL"] = True - tc.variables["WITH_ETW"] = True - tc.variables["WITH_EXAMPLES"] = False - tc.variables["WITH_JAEGER"] = True - tc.variables["WITH_OTLP"] = True - tc.variables["WITH_ZIPKIN"] = True + tc.cache_variables["BUILD_TESTING"] = False + tc.cache_variables["BUILD_BENCHMARK"] = False + tc.cache_variables["WITH_EXAMPLES"] = False + tc.cache_variables["WITH_NO_DEPRECATED_CODE"] = self.options.with_no_deprecated_code + tc.cache_variables["WITH_STL"] = self._stl_value + tc.cache_variables["WITH_GSL"] = self.options.with_gsl + tc.cache_variables["WITH_ABSEIL"] = self.options.with_abseil + if Version(self.version) < "1.10": + tc.cache_variables["WITH_OTLP"] = self.options.with_otlp_grpc or self.options.with_otlp_http + tc.cache_variables["WITH_OTLP_GRPC"] = self.options.with_otlp_grpc + tc.cache_variables["WITH_OTLP_HTTP"] = self.options.with_otlp_http + if Version(self.version) >= "1.16.0": + tc.cache_variables["WITH_OTLP_HTTP_COMPRESSION"] = self.options.with_otlp_http_compression + if self.options.get_safe("with_otlp_file"): + tc.cache_variables["WITH_OTLP_FILE"] = True + if self._needs_proto: + tc.cache_variables["OTELCPP_PROTO_PATH"] = self.dependencies.build["opentelemetry-proto"].conf_info.get("user.opentelemetry-proto:proto_root").replace("\\", "/") + tc.cache_variables["WITH_ZIPKIN"] = self.options.with_zipkin + tc.cache_variables["WITH_PROMETHEUS"] = self.options.with_prometheus + tc.cache_variables["WITH_ELASTICSEARCH"] = self.options.with_elasticsearch + tc.cache_variables["WITH_ZPAGES"] = self.options.with_zpages + tc.cache_variables["WITH_JAEGER"] = self.options.get_safe("with_jaeger", False) + tc.cache_variables["WITH_NO_GETENV"] = self.options.with_no_getenv + if self.options.get_safe("with_etw"): + # CMakeLists checks for definition, not value + tc.cache_variables["WITH_ETW"] = True + if Version(self.version) < "1.11": + tc.cache_variables["WITH_LOGS_PREVIEW"] = self.options.with_logs_preview + tc.cache_variables["WITH_ASYNC_EXPORT_PREVIEW"] = self.options.with_async_export_preview + tc.cache_variables["WITH_METRICS_EXEMPLAR_PREVIEW"] = self.options.with_metrics_exemplar_preview + tc.cache_variables["OPENTELEMETRY_INSTALL"] = True + if not self.settings.compiler.cppstd: + tc.variables["CMAKE_CXX_STANDARD"] = self._min_cppstd tc.generate() - tc = CMakeDeps(self) - tc.generate() + deps = CMakeDeps(self) + + deps.generate() def _patch_sources(self): - protos_path = self.deps_user_info["opentelemetry-proto"].proto_root.replace("\\", "/") - protos_cmake_path = os.path.join( - self.source_folder, - "cmake", - "opentelemetry-proto.cmake") - 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)") - replace_in_file(self, - protos_cmake_path, - "set(PROTO_PATH \"${CMAKE_CURRENT_SOURCE_DIR}/third_party/opentelemetry-proto\")", - f"set(PROTO_PATH \"{protos_path}\")") - rmdir(self, os.path.join(self.source_folder, "api", "include", "opentelemetry", "nostd", "absl")) + if self._needs_proto: + protos_path = self.dependencies.build["opentelemetry-proto"].conf_info.get("user.opentelemetry-proto:proto_root").replace("\\", "/") + protos_cmake_path = os.path.join(self.source_folder, "cmake", "opentelemetry-proto.cmake") + replace_in_file(self, protos_cmake_path, + "if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/third_party/opentelemetry-proto/.git)", + "if(1)") + replace_in_file(self, protos_cmake_path, + '"${CMAKE_CURRENT_SOURCE_DIR}/third_party/opentelemetry-proto")', + f'"{protos_path}")') + if self.options.with_otlp_grpc and Version(self.version) < "1.9.1": + save(self, protos_cmake_path, "\ntarget_link_libraries(opentelemetry_proto PUBLIC gRPC::grpc++)", append=True) - apply_conandata_patches(self) + rmdir(self, os.path.join(self.source_folder, "api", "include", "opentelemetry", "nostd", "absl")) def build(self): self._patch_sources() @@ -135,6 +320,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")) self._create_cmake_module_variables( os.path.join(self.package_folder, self._otel_cmake_variables_path) ) @@ -154,46 +340,63 @@ def _otel_build_modules(self): @property def _http_client_name(self): - return "http_client_curl" if Version(self.version) < "1.3.0" else "opentelemetry_http_client_curl" + return "opentelemetry_http_client_curl" @property def _otel_libraries(self): libraries = [ - 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 Version(self.version) >= "1.1.0": - libraries.append("opentelemetry_exporter_otlp_http_client") - - 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 Version(self.version) >= "1.5.0": - libraries.append("opentelemetry_exporter_otlp_grpc_metrics") - libraries.append("opentelemetry_exporter_otlp_http_metric") - - if Version(self.version) >= "1.7.0": - libraries.append("opentelemetry_exporter_otlp_grpc_client") - - if self.settings.os == "Windows": + if self.options.with_otlp_http or self.options.with_elasticsearch or self.options.get_safe("with_jaeger") or self.options.with_zipkin: + # https://github.com/open-telemetry/opentelemetry-cpp/blob/v1.12.0/CMakeLists.txt#L452-L460 + libraries.append(self._http_client_name) + if self._needs_proto: + libraries.extend([ + "opentelemetry_proto", + "opentelemetry_otlp_recordable", + ]) + if self.options.with_otlp_grpc: + libraries.append("opentelemetry_exporter_otlp_grpc") + libraries.append("opentelemetry_exporter_otlp_grpc_metrics") + libraries.append("opentelemetry_exporter_otlp_grpc_client") + if Version(self.version) >= "1.9.1": + libraries.append("opentelemetry_proto_grpc") + if Version(self.version) >= "1.11" or self.options.with_logs_preview: + libraries.append("opentelemetry_exporter_otlp_grpc_log") + if self.options.with_otlp_http: + libraries.append("opentelemetry_exporter_otlp_http") + libraries.append("opentelemetry_exporter_otlp_http_client") + libraries.append("opentelemetry_exporter_otlp_http_metric") + if Version(self.version) >= "1.11" or self.options.with_logs_preview: + libraries.append("opentelemetry_exporter_otlp_http_log") + if self.options.get_safe("with_otlp_file"): + libraries.append("opentelemetry_exporter_otlp_file") + libraries.append("opentelemetry_exporter_otlp_file_client") + libraries.append("opentelemetry_exporter_otlp_file_metric") + libraries.append("opentelemetry_exporter_otlp_file_log") + if self.options.with_prometheus: + libraries.append("opentelemetry_exporter_prometheus") + if self.options.with_elasticsearch and (Version(self.version) >= "1.11" or 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.get_safe("with_jaeger"): + libraries.append("opentelemetry_exporter_jaeger_trace") + libraries.append("opentelemetry_metrics") + libraries.append("opentelemetry_exporter_ostream_metrics") + if Version(self.version) >= "1.11" or self.options.with_logs_preview: libraries.extend([ - "opentelemetry_exporter_etw", + "opentelemetry_logs", + "opentelemetry_exporter_ostream_logs", ]) + if self.options.get_safe("with_etw"): + libraries.append("opentelemetry_exporter_etw") return libraries def package_info(self): @@ -203,71 +406,72 @@ 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 Version(self.version) >= "1.3.0": - self.cpp_info.components["opentelemetry_exporter_jaeger_trace"].requires.extend([ - "boost::locale", + if Version(self.version) >= "1.11" or 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_http_client"].requires.extend([ - self._http_client_name, - "nlohmann_json::nlohmann_json", - "opentelemetry_proto", - ]) + 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([ - "opentelemetry_otlp_recordable", - "opentelemetry_exporter_otlp_http_client", - ]) + if Version(self.version) >= "1.16.0" and is_apple_os(self): + self.cpp_info.components["opentelemetry_common"].frameworks.extend(["CoreFoundation"]) - 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.get_safe("with_otlp_http_compression"): + self.cpp_info.components["opentelemetry_common"].defines.append("ENABLE_OTLP_COMPRESSION_PREVIEW") + if self._stl_value: + self.cpp_info.components["opentelemetry_common"].defines.append("HAVE_CPP_STDLIB") - 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 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") - if Version(self.version) <= "1.7.0": - self.cpp_info.components["opentelemetry_exporter_otlp_grpc"].requires.extend([ - "grpc::grpc++", - "opentelemetry_otlp_recordable", + 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") + + if self.options.with_otlp_http or self.options.with_otlp_grpc: + self.cpp_info.components["opentelemetry_proto"].requires.append("protobuf::protobuf") + self.cpp_info.components["opentelemetry_otlp_recordable"].requires.extend([ + "opentelemetry_proto", + "opentelemetry_resources", + "opentelemetry_trace", ]) - if Version(self.version) >= "1.7.0": + if Version(self.version) >= "1.11": + self.cpp_info.components["opentelemetry_otlp_recordable"].requires.extend([ + "opentelemetry_logs", + ]) + + if self.options.with_otlp_grpc: self.cpp_info.components["opentelemetry_exporter_otlp_grpc_client"].requires.extend([ "grpc::grpc++", "opentelemetry_proto", ]) + if Version(self.version) >= "1.9.1": + self.cpp_info.components["opentelemetry_exporter_otlp_grpc_client"].requires.append("opentelemetry_proto_grpc") + self.cpp_info.components["opentelemetry_exporter_otlp_grpc"].requires.extend([ "opentelemetry_otlp_recordable", "opentelemetry_exporter_otlp_grpc_client" @@ -278,31 +482,99 @@ def package_info(self): "opentelemetry_exporter_otlp_grpc_client" ]) - self.cpp_info.components["opentelemetry_exporter_zipkin_trace"].requires.extend([ - self._http_client_name, - "nlohmann_json::nlohmann_json", - "opentelemetry_trace", - ]) + if Version(self.version) >= "1.11" or 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.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") + self.cpp_info.components[self._http_client_name].requires.append("openssl::openssl") + + if self.options.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_otlp_recordable"].requires.extend([ - "opentelemetry_proto", - "opentelemetry_resources", - "opentelemetry_trace", - ]) + if self._otlp_http_needs_zlib: + # This version requires zlib for the http client even if not used, as it includes zconf.h + # regardless of WITH_OTLP_HTTP_COMPRESSION + self.cpp_info.components["opentelemetry_exporter_otlp_http_client"].requires.append("zlib::zlib") - self.cpp_info.components["opentelemetry_proto"].requires.extend([ - "opentelemetry-proto::opentelemetry-proto", - "protobuf::protobuf", - ]) + self.cpp_info.components["opentelemetry_exporter_otlp_http"].requires.extend([ + "opentelemetry_otlp_recordable", + "opentelemetry_exporter_otlp_http_client", + ]) - self.cpp_info.components["opentelemetry_resources"].requires.extend([ - "opentelemetry_common", - ]) + self.cpp_info.components["opentelemetry_exporter_otlp_http_metric"].requires.extend([ + "opentelemetry_otlp_recordable", + "opentelemetry_exporter_otlp_http_client" + ]) - self.cpp_info.components["opentelemetry_trace"].requires.extend([ - "opentelemetry_common", - "opentelemetry_resources", - ]) + if Version(self.version) >= "1.11" or 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.get_safe("with_otlp_file"): + self.cpp_info.components["opentelemetry_exporter_otlp_file_client"].requires.extend([ + "nlohmann_json::nlohmann_json", + "opentelemetry_proto", + "opentelemetry_common" + ]) + if self.options.with_abseil: + self.cpp_info.components["opentelemetry_exporter_otlp_file_client"].requires.append("abseil::absl_strings") + + self.cpp_info.components["opentelemetry_exporter_otlp_file"].requires.extend([ + "opentelemetry_otlp_recordable", + "opentelemetry_exporter_otlp_file_client", + ]) + + self.cpp_info.components["opentelemetry_exporter_otlp_file_log"].requires.extend([ + "opentelemetry_otlp_recordable", + "opentelemetry_exporter_otlp_file_client", + ]) + + self.cpp_info.components["opentelemetry_exporter_otlp_file_metric"].requires.extend([ + "opentelemetry_otlp_recordable", + "opentelemetry_exporter_otlp_file_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.get_safe("with_jaeger"): + self.cpp_info.components["opentelemetry_exporter_jaeger_trace"].requires.extend([ + self._http_client_name, + "openssl::openssl", + "opentelemetry_resources", + "thrift::thrift", + ]) + + self.cpp_info.components["opentelemetry_exporter_jaeger_trace"].requires.append( + "boost::locale" + ) + + if self.options.with_prometheus: + self.cpp_info.components["opentelemetry_exporter_prometheus"].requires.extend([ + "prometheus-cpp::prometheus-cpp", + "opentelemetry_trace", + ]) + + if self.options.get_safe("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 deleted file mode 100644 index ecdbb0cf0f9fc..0000000000000 --- a/recipes/opentelemetry-cpp/all/patches/1.0.1-0001-fix-cmake.patch +++ /dev/null @@ -1,28 +0,0 @@ -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 deleted file mode 100644 index 275e2c9b44a66..0000000000000 --- a/recipes/opentelemetry-cpp/all/patches/1.2.0-0001-fix-cmake.patch +++ /dev/null @@ -1,15 +0,0 @@ -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 deleted file mode 100644 index ce868fbedca22..0000000000000 --- a/recipes/opentelemetry-cpp/all/patches/1.3.0-0001-fix-cmake.patch +++ /dev/null @@ -1,27 +0,0 @@ -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) - 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 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 deleted file mode 100644 index 1fcf5a0427738..0000000000000 --- a/recipes/opentelemetry-cpp/all/patches/1.4.0-0001-fix-cmake.patch +++ /dev/null @@ -1,27 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 6d2b274..4611a6b 100755 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -208,7 +208,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 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 deleted file mode 100644 index b3391855652c4..0000000000000 --- a/recipes/opentelemetry-cpp/all/patches/1.6.1-0001-fix-cmake.patch +++ /dev/null @@ -1,27 +0,0 @@ -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 deleted file mode 100644 index e5e3898386303..0000000000000 --- a/recipes/opentelemetry-cpp/all/patches/1.7.0-0001-fix-cmake.patch +++ /dev/null @@ -1,27 +0,0 @@ -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 deleted file mode 100644 index 5c4fcae46b11b..0000000000000 --- a/recipes/opentelemetry-cpp/all/patches/1.8.1-0001-fix-cmake.patch +++ /dev/null @@ -1,27 +0,0 @@ -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 53dd5c5a1c6f7..0898e9106c8e0 100644 --- a/recipes/opentelemetry-cpp/all/test_package/CMakeLists.txt +++ b/recipes/opentelemetry-cpp/all/test_package/CMakeLists.txt @@ -6,4 +6,4 @@ find_package(opentelemetry-cpp REQUIRED CONFIG) add_executable(${CMAKE_PROJECT_NAME} test_package.cpp) target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE opentelemetry-cpp::opentelemetry-cpp) -target_compile_features(${CMAKE_PROJECT_NAME} PRIVATE cxx_std_11) +target_compile_features(${CMAKE_PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/opentelemetry-cpp/all/test_v1_package/CMakeLists.txt b/recipes/opentelemetry-cpp/all/test_v1_package/CMakeLists.txt deleted file mode 100644 index 432e5d7c64ed4..0000000000000 --- a/recipes/opentelemetry-cpp/all/test_v1_package/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -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/config.yml b/recipes/opentelemetry-cpp/config.yml index 4dd7c49be1a03..6e3e868a29e2f 100644 --- a/recipes/opentelemetry-cpp/config.yml +++ b/recipes/opentelemetry-cpp/config.yml @@ -1,17 +1,13 @@ versions: - "1.8.1": + "1.17.0": folder: all - "1.7.0": + "1.16.1": folder: all - "1.6.1": + "1.14.2": folder: all - "1.4.1": + "1.12.0": folder: all - "1.4.0": + "1.9.1": folder: all - "1.3.0": - folder: all - "1.2.0": - folder: all - "1.0.1": + "1.8.3": folder: all diff --git a/recipes/opentelemetry-proto/all/conandata.yml b/recipes/opentelemetry-proto/all/conandata.yml index 15e276cc4de55..cd89aeeb2492e 100644 --- a/recipes/opentelemetry-proto/all/conandata.yml +++ b/recipes/opentelemetry-proto/all/conandata.yml @@ -1,4 +1,25 @@ sources: + "1.3.2": + url: "https://github.com/open-telemetry/opentelemetry-proto/archive/v1.3.2.tar.gz" + sha256: "c069c0d96137cf005d34411fa67dd3b6f1f8c64af1e7fb2fe0089a41c425acd7" + "1.3.1": + url: "https://github.com/open-telemetry/opentelemetry-proto/archive/v1.3.1.tar.gz" + sha256: "bed250ceec8e4a83aa5604d7d5595a61945059dc662edd058a9da082283f7a00" + "1.3.0": + url: "https://github.com/open-telemetry/opentelemetry-proto/archive/v1.3.0.tar.gz" + sha256: "73a678b0ff7a29b581381566a2230fe2a00b864608786c99c050a4492e2bbafc" + "1.2.0": + url: "https://github.com/open-telemetry/opentelemetry-proto/archive/v1.2.0.tar.gz" + sha256: "516dc94685dbaa14fb792788f31d2ef2b0c3ad08dfa8a9a8164e3cf60c1ab6f7" + "1.1.0": + url: "https://github.com/open-telemetry/opentelemetry-proto/archive/v1.1.0.tar.gz" + sha256: "df491a05f3fcbf86cc5ba5c9de81f6a624d74d4773d7009d573e37d6e2b6af64" + "1.0.0": + url: "https://github.com/open-telemetry/opentelemetry-proto/archive/v1.0.0.tar.gz" + sha256: "a13a1a7b76a1f22a0ca2e6c293e176ffef031413ab8ba653a82a1dbc286a3a33" + "0.20.0": + url: "https://github.com/open-telemetry/opentelemetry-proto/archive/v0.20.0.tar.gz" + sha256: "6ab267cf82832ed60ad075d574c78da736193eecb9693e8a8d02f65d6d3f3520" "0.19.0": url: "https://github.com/open-telemetry/opentelemetry-proto/archive/v0.19.0.tar.gz" sha256: "464bc2b348e674a1a03142e403cbccb01be8655b6de0f8bfe733ea31fcd421be" diff --git a/recipes/opentelemetry-proto/all/conanfile.py b/recipes/opentelemetry-proto/all/conanfile.py index 8b2d929914548..b24f1a700e446 100644 --- a/recipes/opentelemetry-proto/all/conanfile.py +++ b/recipes/opentelemetry-proto/all/conanfile.py @@ -1,9 +1,10 @@ import os -from pathlib import Path -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.33.0" +required_conan_version = ">=1.52.0" class OpenTelemetryProtoConan(ConanFile): @@ -12,25 +13,33 @@ class OpenTelemetryProtoConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/open-telemetry/opentelemetry-proto" description = "Protobuf definitions for the OpenTelemetry protocol (OTLP)" - topics = ("opentelemetry", "telemetry", "otlp") - no_copy_source = True + topics = ("opentelemetry", "telemetry", "otlp", "pre-built") - @property - def _source_subfolder(self): - return os.path.join(self.source_folder, "source_subfolder") + package_type = "build-scripts" + settings = "os", "arch", "compiler", "build_type" - 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): + self.info.clear() + + def build(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("*.proto", dst="res", src=self._source_subfolder) - # satisfy KB-H014 (header_only recipes require headers) - tools.save(os.path.join(self.package_folder, "include", "dummy_header.h"), "\n") + copy(self, pattern="LICENSE", + dst=os.path.join(self.package_folder, "licenses"), src=self.build_folder) + copy(self, pattern="*.proto", + dst=os.path.join(self.package_folder, "res"), src=self.build_folder) def package_info(self): - self.user_info.proto_root = os.path.join(self.package_folder, "res") + self.conf_info.define("user.opentelemetry-proto:proto_root", + os.path.join(self.package_folder, "res")) + self.cpp_info.resdirs = ["res"] + self.cpp_info.bindirs = [] self.cpp_info.libdirs = [] self.cpp_info.includedirs = [] - self.cpp_info.resdirs = [] + + # TODO: to remove in conan v2 + self.user_info.proto_root = os.path.join(self.package_folder, "res") diff --git a/recipes/opentelemetry-proto/all/test_package/conanfile.py b/recipes/opentelemetry-proto/all/test_package/conanfile.py index 533d3d56112fa..43eb202cc1d23 100644 --- a/recipes/opentelemetry-proto/all/test_package/conanfile.py +++ b/recipes/opentelemetry-proto/all/test_package/conanfile.py @@ -1,9 +1,24 @@ import os -from conans import ConanFile + +from conan import ConanFile +from conan.tools.files import save, load +from conan.tools.layout import basic_layout class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + test_type = "explicit" + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires(self.tested_reference_str) + + def generate(self): + save(self, os.path.join(self.build_folder, "proto_root"), self.dependencies["opentelemetry-proto"].conf_info.get("user.opentelemetry-proto:proto_root")) def test(self): - res_folder = self.deps_user_info["opentelemetry-proto"].proto_root - assert os.path.isfile(os.path.join(res_folder, "opentelemetry", "proto", "common", "v1", "common.proto")) + res_folder = load(self, os.path.join(self.build_folder, "proto_root")) + proto_path = os.path.join(res_folder, "opentelemetry", "proto", "common", "v1", "common.proto") + assert os.path.isfile(proto_path) diff --git a/recipes/opentelemetry-proto/all/test_v1_package/conanfile.py b/recipes/opentelemetry-proto/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..c5940f5104d54 --- /dev/null +++ b/recipes/opentelemetry-proto/all/test_v1_package/conanfile.py @@ -0,0 +1,7 @@ +from conans import ConanFile, CMake +import os + +class TestPackageV1Conan(ConanFile): + def test(self): + res_folder = self.deps_user_info["opentelemetry-proto"].proto_root + assert os.path.isfile(os.path.join(res_folder, "opentelemetry", "proto", "common", "v1", "common.proto")) diff --git a/recipes/opentelemetry-proto/config.yml b/recipes/opentelemetry-proto/config.yml index a5c8b6c0c2e34..f97817db57e8d 100644 --- a/recipes/opentelemetry-proto/config.yml +++ b/recipes/opentelemetry-proto/config.yml @@ -1,4 +1,18 @@ versions: + "1.3.2": + folder: all + "1.3.1": + folder: all + "1.3.0": + folder: all + "1.2.0": + folder: all + "1.1.0": + folder: all + "1.0.0": + folder: all + "0.20.0": + folder: all "0.19.0": folder: all "0.18.0": diff --git a/recipes/opentracing-cpp/all/CMakeLists.txt b/recipes/opentracing-cpp/all/CMakeLists.txt deleted file mode 100644 index bd3083b512cb9..0000000000000 --- a/recipes/opentracing-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/opentracing-cpp/all/conandata.yml b/recipes/opentracing-cpp/all/conandata.yml index 97fc5249ab98a..98d819b31175b 100644 --- a/recipes/opentracing-cpp/all/conandata.yml +++ b/recipes/opentracing-cpp/all/conandata.yml @@ -4,5 +4,4 @@ sources: sha256: 5b170042da4d1c4c231df6594da120875429d5231e9baa5179822ee8d1054ac3 patches: "1.6.0": - - base_path: "source_subfolder" - patch_file: "patches/0001-Set-default-installation-folders.patch" + - patch_file: "patches/0001-Set-default-installation-folders.patch" diff --git a/recipes/opentracing-cpp/all/conanfile.py b/recipes/opentracing-cpp/all/conanfile.py index 16f16b80280d2..bd664e1278224 100644 --- a/recipes/opentracing-cpp/all/conanfile.py +++ b/recipes/opentracing-cpp/all/conanfile.py @@ -1,17 +1,21 @@ import os -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, rmdir + +required_conan_version = ">=1.53.0" class OpenTracingConan(ConanFile): name = "opentracing-cpp" description = "C++ implementation of the OpenTracing API http://opentracing.io" license = "Apache-2.0" - topics = ("conan", "opentracing") - homepage = "https://github.com/opentracing/opentracing-cpp" url = "https://github.com/conan-io/conan-center-index" - exports_sources = ["CMakeLists.txt", "patches/*.patch"] - generators = "cmake" + homepage = "https://github.com/opentracing/opentracing-cpp" + topics = "opentracing" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -26,15 +30,8 @@ class OpenTracingConan(ConanFile): "enable_dynamic_load": 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": @@ -42,78 +39,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 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]) - os.rename(self.name + "-" + self.version, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_MOCKTRACER"] = self.options.enable_mocktracer + tc.variables["BUILD_DYNAMIC_LOADING"] = self.options.enable_dynamic_load + tc.variables["BUILD_SHARED_LIBS"] = self.options.shared + tc.variables["BUILD_STATIC_LIBS"] = not self.options.shared + tc.variables["BUILD_TESTING"] = False + tc.variables["ENABLE_LINTING"] = False + tc.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 _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BUILD_MOCKTRACER"] = self.options.enable_mocktracer - self._cmake.definitions[ - "BUILD_DYNAMIC_LOADING" - ] = self.options.enable_dynamic_load - self._cmake.definitions["BUILD_SHARED_LIBS"] = self.options.shared - self._cmake.definitions["BUILD_STATIC_LIBS"] = not self.options.shared - self._cmake.definitions["BUILD_TESTING"] = False - self._cmake.definitions["ENABLE_LINTING"] = False - 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", 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.names["cmake_find_package"] = "OpenTracing" - self.cpp_info.names["cmake_find_package_multi"] = "OpenTracing" + self.cpp_info.set_property("cmake_file_name", "OpenTracing") + self.cpp_info.set_property("cmake_target_name", "OpenTracing::OpenTracing") target_suffix = "" if self.options.shared else "-static" - lib_suffix = ( - "" if self.options.shared or self.settings.os != "Windows" else "-static" - ) + lib_suffix = "" if self.options.shared or self.settings.os != "Windows" else "-static" + # opentracing - self.cpp_info.components["opentracing"].names["cmake_find_package"] = ( - "opentracing" + target_suffix - ) - self.cpp_info.components["opentracing"].names["cmake_find_package_multi"] = ( - "opentracing" + target_suffix - ) - self.cpp_info.components["opentracing"].libs = ["opentracing" + lib_suffix] + opentracing = self.cpp_info.components["opentracing"] + opentracing.set_property("cmake_target_name", "OpenTracing::opentracing" + target_suffix) + opentracing.names["cmake_find_package"] = "opentracing" + target_suffix + opentracing.names["cmake_find_package_multi"] = "opentracing" + target_suffix + opentracing.libs = ["opentracing" + lib_suffix] if not self.options.shared: - self.cpp_info.components["opentracing"].defines.append("OPENTRACING_STATIC") + opentracing.defines.append("OPENTRACING_STATIC") if self.options.enable_dynamic_load and self.settings.os in ("Linux", "FreeBSD"): - self.cpp_info.components["opentracing"].system_libs.append("dl") + opentracing.system_libs.append("dl") # opentracing_mocktracer if self.options.enable_mocktracer: - self.cpp_info.components["opentracing_mocktracer"].names[ - "cmake_find_package" - ] = ("opentracing_mocktracer" + target_suffix) - self.cpp_info.components["opentracing_mocktracer"].names[ - "cmake_find_package_multi" - ] = ("opentracing_mocktracer" + target_suffix) - self.cpp_info.components["opentracing_mocktracer"].libs = [ - "opentracing_mocktracer" + lib_suffix - ] - self.cpp_info.components["opentracing_mocktracer"].requires = [ - "opentracing" - ] + opentracing_mocktracer = self.cpp_info.components["opentracing_mocktracer"] + opentracing_mocktracer.set_property("cmake_target_name", "OpenTracing::opentracing_mocktracer" + target_suffix) + opentracing_mocktracer.names["cmake_find_package"] = "opentracing_mocktracer" + target_suffix + opentracing_mocktracer.names["cmake_find_package_multi"] = "opentracing_mocktracer" + target_suffix + opentracing_mocktracer.libs = ["opentracing_mocktracer" + lib_suffix] + opentracing_mocktracer.requires = ["opentracing"] if not self.options.shared: - self.cpp_info.components["opentracing_mocktracer"].defines.append( - "OPENTRACING_MOCK_TRACER_STATIC" - ) + opentracing_mocktracer.defines.append("OPENTRACING_MOCK_TRACER_STATIC") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.names["cmake_find_package"] = "OpenTracing" + self.cpp_info.names["cmake_find_package_multi"] = "OpenTracing" diff --git a/recipes/opentracing-cpp/all/test_package/CMakeLists.txt b/recipes/opentracing-cpp/all/test_package/CMakeLists.txt index 124ca7e918838..e9ddbfa9df183 100644 --- a/recipes/opentracing-cpp/all/test_package/CMakeLists.txt +++ b/recipes/opentracing-cpp/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(OpenTracing REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/opentracing-cpp/all/test_package/conanfile.py b/recipes/opentracing-cpp/all/test_package/conanfile.py index abcaeed3f89b6..ef5d7042163ec 100644 --- a/recipes/opentracing-cpp/all/test_package/conanfile.py +++ b/recipes/opentracing-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 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.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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/opentracing-cpp/all/test_package/test_package.cpp b/recipes/opentracing-cpp/all/test_package/test_package.cpp index ca88714cbdbf7..85d2151582572 100644 --- a/recipes/opentracing-cpp/all/test_package/test_package.cpp +++ b/recipes/opentracing-cpp/all/test_package/test_package.cpp @@ -7,6 +7,6 @@ int main() { auto tracer = MakeNoopTracer(); auto span1 = tracer->StartSpan("a"); - + return 0; } diff --git a/recipes/opentracing-cpp/all/test_v1_package/CMakeLists.txt b/recipes/opentracing-cpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/opentracing-cpp/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/opentracing-cpp/all/test_v1_package/conanfile.py b/recipes/opentracing-cpp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..abcaeed3f89b6 --- /dev/null +++ b/recipes/opentracing-cpp/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.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/opentrackio-cpp/all/conandata.yml b/recipes/opentrackio-cpp/all/conandata.yml new file mode 100644 index 0000000000000..cab0050ac13e1 --- /dev/null +++ b/recipes/opentrackio-cpp/all/conandata.yml @@ -0,0 +1,5 @@ +sources: + "1.0.0": + url: + - "https://github.com/mosys/opentrackio-cpp/archive/refs/tags/v1.0.0.tar.gz" + sha256: "89bd489774a8efac9b18ddcff9a2219d57d46a73d53ea0a5fd71a94c27fc1257" diff --git a/recipes/opentrackio-cpp/all/conanfile.py b/recipes/opentrackio-cpp/all/conanfile.py new file mode 100644 index 0000000000000..415312fd127dd --- /dev/null +++ b/recipes/opentrackio-cpp/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 copy, get, rmdir +from conan.tools.scm import Version +import os + +required_conan_version = ">=1.53.0" + +class PackageConan(ConanFile): + name = "opentrackio-cpp" + description = "A Cpp helper library for usage with the OpenTrackIO protocol." + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/mosys/opentrackio-cpp" + topics = ("opentrackio", "smpte") + package_type = "library" + 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 20 + + @property + def _compilers_minimum_version(self): + return { + "apple-clang": "15", + "clang": "14", + "gcc": "13", + "msvc": "193", + "Visual Studio": "20", + } + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + # TODO: This goes back to config_options after Conan 1 freeze + if self.settings.os == "Windows": + # Nothing is exported from the library, so we can't use it as a shared library + del self.options.shared + self.package_type = "static-library" + + if self.options.get_safe("shared"): + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires("nlohmann_json/3.11.3", transitive_headers=True) + + def build_requirements(self): + # Min required is 3.15 in the file, but 3.20 in the README. + # Be conservative and require the higher version + self.build_requires("cmake/[>=3.20 <4]") + + 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." + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + deps = CMakeDeps(self) + deps.generate() + tc = CMakeToolchain(self) + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENCE", self.source_folder, os.path.join(self.package_folder, "licenses")) + 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, "cmake")) + rmdir(self, os.path.join(self.package_folder, "share")) + + def package_info(self): + suffix = "" + if self.settings.build_type == "Debug": + suffix = "d" + self.cpp_info.libs = [f"opentrackio-cpp{suffix}"] diff --git a/recipes/opentrackio-cpp/all/test_package/CMakeLists.txt b/recipes/opentrackio-cpp/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..d8f36103d746f --- /dev/null +++ b/recipes/opentrackio-cpp/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.15) + + project(test_package LANGUAGES CXX) + +find_package(opentrackio-cpp REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE opentrackio-cpp::opentrackio-cpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) diff --git a/recipes/opentrackio-cpp/all/test_package/conanfile.py b/recipes/opentrackio-cpp/all/test_package/conanfile.py new file mode 100644 index 0000000000000..ef5d7042163ec --- /dev/null +++ b/recipes/opentrackio-cpp/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/opentrackio-cpp/all/test_package/test_package.cpp b/recipes/opentrackio-cpp/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..7f0e1e6c74be9 --- /dev/null +++ b/recipes/opentrackio-cpp/all/test_package/test_package.cpp @@ -0,0 +1,25 @@ +#include +#include +#include +#include + + +int main(void) { + std::string example = R"({ + "protocol": { + "name": "OpenTrackIO", + "version": "0.9.0" + }, + "tracker": { + "notes": "Example generated sample.", + "recording": false, + "slate": "A101_A_4", + "status": "Optical Good" + } + })"; + + opentrackio::OpenTrackIOSample sample{}; + bool sample_success = sample.initialise(std::string_view{example}); + std::cout << "Sample init successful: " << (sample_success ? "True" : "False") << std::endl; + return EXIT_SUCCESS; +} diff --git a/recipes/opentrackio-cpp/config.yml b/recipes/opentrackio-cpp/config.yml new file mode 100644 index 0000000000000..5d96905a31039 --- /dev/null +++ b/recipes/opentrackio-cpp/config.yml @@ -0,0 +1,4 @@ +versions: + # Newer versions at the top + "1.0.0": + folder: all diff --git a/recipes/openvdb/all/CMakeLists.txt b/recipes/openvdb/all/CMakeLists.txt deleted file mode 100644 index b71c882d9d33f..0000000000000 --- a/recipes/openvdb/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/openvdb/all/conandata.yml b/recipes/openvdb/all/conandata.yml index 902318df1e3ae..35817586160ea 100644 --- a/recipes/openvdb/all/conandata.yml +++ b/recipes/openvdb/all/conandata.yml @@ -1,8 +1,10 @@ sources: - "8.0.1": - url: "https://github.com/AcademySoftwareFoundation/openvdb/archive/refs/tags/v8.0.1.tar.gz" - sha256: "a6845da7c604d2c72e4141c898930ac8a2375521e535f696c2cd92bebbe43c4f" -patches: - "8.0.1": - - patch_file: "patches/0001-Find-packages-fixes.patch" - base_path: "source_subfolder" + "11.0.0": + url: "https://github.com/AcademySoftwareFoundation/openvdb/archive/refs/tags/v11.0.0.tar.gz" + sha256: "6314ff1db057ea90050763e7b7d7ed86d8224fcd42a82cdbb9c515e001b96c74" + "10.1.0": + url: "https://github.com/AcademySoftwareFoundation/openvdb/archive/refs/tags/v10.1.0.tar.gz" + sha256: "2746236e29659a0d35ab90d832f7c7987dd2537587a1a2f9237d9c98afcd5817" + "9.1.0": + url: "https://github.com/AcademySoftwareFoundation/openvdb/archive/refs/tags/v9.1.0.tar.gz" + sha256: "914ee417b4607c75c95b53bc73a0599de4157c7d6a32e849e80f24e40fb64181" diff --git a/recipes/openvdb/all/conanfile.py b/recipes/openvdb/all/conanfile.py index f36eb55cee0f2..5f385526168c2 100644 --- a/recipes/openvdb/all/conanfile.py +++ b/recipes/openvdb/all/conanfile.py @@ -1,11 +1,16 @@ -from conan.tools.microsoft import is_msvc -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -import functools import os +import re + +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 copy, get, rm, replace_in_file +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version - -required_conan_version = ">=1.45.0" +required_conan_version = ">=1.53.0" class OpenVDBConan(ConanFile): @@ -16,232 +21,281 @@ class OpenVDBConan(ConanFile): "manipulation of sparse volumetric data discretized on three-dimensional grids." ) license = "MPL-2.0" - topics = ("voxel", "voxelizer", "volume-rendering", "fx") - homepage = "https://github.com/AcademySoftwareFoundation/openvdb" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/AcademySoftwareFoundation/openvdb" + topics = ("voxel", "voxelizer", "volume-rendering", "fx", "vdb") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], + "build_ax": [True, False], + "simd": [None, "SSE42", "AVX"], + "use_colored_output": [True, False], + "use_delayed_loading": [True, False], + "use_explicit_instantiation": [True, False], + "use_imath_half": [True, False], "with_blosc": [True, False], - "with_zlib": [True, False], + # Deprecated because EXR is only used when building executables, which the recipe does not support + "with_exr": ["deprecated", True, False], "with_log4cplus": [True, False], - "with_exr": [True, False], - "simd": [None, "SSE42", "AVX"], + "with_zlib": [True, False], } default_options = { "shared": False, "fPIC": True, + "build_ax": False, + "simd": None, + "use_colored_output": False, + "use_delayed_loading": False, + "use_explicit_instantiation": False, + "use_imath_half": True, "with_blosc": True, + "with_exr": "deprecated", + "with_log4cplus": False, # Disabled by default because it is not compatible with C++17 "with_zlib": True, - "with_log4cplus": False, - "with_exr": False, - "simd": None, } - - generators = "cmake", "cmake_find_package" - - @property - def _source_subfolder(self): - return "source_subfolder" + options_description = { + "build_ax": "Build the OpenVDB AX library.", + "simd": ( + "Choose whether to enable SIMD compiler flags or not. " + "Although not required, it is strongly recommended to enable SIMD. AVX implies SSE42." + ), + "use_colored_output": "Always produce ANSI-colored output (GNU/Clang only).", + "use_delayed_loading": "Build the core OpenVDB library with delayed-loading.", + "use_explicit_instantiation": ( + "Use explicit instantiation for all supported classes and methods against a pre-defined " + "list of OpenVDB trees. This makes the core library larger and slower to compile, but speeds up " + "the compilation of all dependent code by bypassing the expensive template instantiation. " + "Disabled by default in ConanCenter to avoid excessive memory usage during compilation." + ), + "use_imath_half": ( + "Use the definition of half-precision floating point types from the Imath library. " + "If False, the embedded definition provided by OpenVDB is used. " + "You may set this to on to force Imath half to be used if you know it to be required." + ), + "with_blosc": "Use Blosc for improved disk compression. Recommended.", + "with_log4cplus": "Use log4cplus for improved OpenVDB Logging.", + "with_zlib": "Use ZLib for disk serialization compression. ZLib can only be disabled if Blosc is also disabled.", + } @property - def _build_subfolder(self): - return "build_subfolder" + def _min_cppstd(self): + return 17 if Version(self.version) >= "10.0.0" else 14 @property def _compilers_min_version(self): - return { - "msvc": "191", - "Visual Studio": "15", # Should we check toolset? - "gcc": "6.3.1", - "clang": "3.8", - "apple-clang": "3.8", - "intel": "17", - } - - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + if Version(self.version) >= "10.0.0": + # https://github.com/AcademySoftwareFoundation/openvdb/blob/v10.0.1/doc/dependencies.txt#L56-L84 + return { + "msvc": "192.8", + "Visual Studio": "16", + "gcc": "9.3.1", + "clang": "5.0", + "apple-clang": "12.0", + "intel-cc": "19", + } + else: + # https://github.com/AcademySoftwareFoundation/openvdb/blob/v9.1.0/doc/dependencies.txt#L56-L84 + return { + "msvc": "191.0", + "Visual Studio": "15", + "gcc": "6.3.1", + "clang": "3.8", + "apple-clang": "10.0", + "intel-cc": "17", + } def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + if is_msvc(self): + # Supported by GCC and Clang only + del self.options.use_colored_output + if Version(self.version) < "10.0.0": + del self.options.use_explicit_instantiation + del self.options.use_delayed_loading 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): + # with_exr is deprecated and has no effect + del self.info.options.with_exr def requirements(self): - self.requires("boost/1.79.0") - self.requires("onetbb/2020.3") - self.requires("openexr/2.5.7") # required for IlmBase::Half + # https://github.com/AcademySoftwareFoundation/openvdb/blob/v10.0.1/doc/dependencies.txt#L36-L84 + self.requires("boost/1.84.0", transitive_headers=True) + self.requires("onetbb/2021.10.0", transitive_headers=True, transitive_libs=True) + if self.options.use_imath_half: + self.requires("imath/3.1.9", transitive_headers=True, transitive_libs=True) if self.options.with_zlib: - self.requires("zlib/1.2.12") - if self.options.with_exr: - # Not necessary now. Required for IlmBase::IlmImf - self.requires("openexr/2.5.7") + self.requires("zlib/[>=1.2.11 <2]") if self.options.with_blosc: - self.requires("c-blosc/1.21.1") + self.requires("c-blosc/1.21.5") if self.options.with_log4cplus: - self.requires("log4cplus/2.0.7") + # log4cplus 2.x is not supported + self.requires("log4cplus/1.2.2", transitive_headers=True) - def _check_compilier_version(self): + def _check_compiler_version(self): compiler = str(self.settings.compiler) - version = tools.Version(self.settings.compiler.version) minimum_version = self._compilers_min_version.get(compiler, False) - if minimum_version and version < minimum_version: - raise ConanInvalidConfiguration(f"{self.name} requires a {compiler} version greater than {minimum_version}") + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.name} requires a {compiler} version greater than {minimum_version}" + ) def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 14) + check_min_cppstd(self, self._min_cppstd) if self.settings.arch not in ("x86", "x86_64"): if self.options.simd: raise ConanInvalidConfiguration("Only intel architectures support SSE4 or AVX.") - self._check_compilier_version() + self._check_compiler_version() + if self.options.with_exr != "deprecated": + self.output.warning("with_exr option is deprecated, do not use anymore.") + + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) + + def build_requirements(self): + if Version(self.version) >= "10.0.0": + self.tool_requires("cmake/[>=3.18 <4]") + if self.options.build_ax: + if self._settings_build.os == "Windows": + self.tool_requires("winflexbison/2.5.25") + else: + 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], 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() + + tc = CMakeToolchain(self) + tc.variables["Boost_USE_STATIC_LIBS"] = not self.dependencies["boost"].options.shared + tc.variables["OPENVDB_BUILD_AX"] = self.options.build_ax + tc.variables["OPENVDB_BUILD_BINARIES"] = False + tc.variables["OPENVDB_BUILD_CORE"] = True + tc.variables["OPENVDB_BUILD_DOCS"] = False + tc.variables["OPENVDB_BUILD_HOUDINI_ABITESTS"] = False + tc.variables["OPENVDB_BUILD_HOUDINI_PLUGIN"] = False + tc.variables["OPENVDB_BUILD_MAYA_PLUGIN"] = False + tc.variables["OPENVDB_BUILD_NANOVDB"] = False # nanovdb should be packaged separately in CCI + tc.variables["OPENVDB_BUILD_PYTHON_MODULE"] = False + tc.variables["OPENVDB_CORE_SHARED"] = self.options.shared + tc.variables["OPENVDB_CORE_STATIC"] = not self.options.shared + tc.variables["OPENVDB_CXX_STRICT"] = False + tc.variables["OPENVDB_DISABLE_BOOST_IMPLICIT_LINKING"] = True + tc.variables["OPENVDB_ENABLE_RPATH"] = True + tc.variables["OPENVDB_ENABLE_UNINSTALL"] = False + tc.variables["OPENVDB_FUTURE_DEPRECATION"] = True + tc.variables["OPENVDB_INSTALL_CMAKE_MODULES"] = False + tc.variables["OPENVDB_SIMD"] = self.options.simd + tc.variables["OPENVDB_USE_DELAYED_LOADING"] = self.options.get_safe("use_delayed_loading", False) + tc.variables["USE_AX"] = False # used only by Python bindings and the Houdini plugin + tc.variables["USE_BLOSC"] = self.options.with_blosc + tc.variables["USE_COLORED_OUTPUT"] = self.options.get_safe("use_colored_output", False) + tc.variables["USE_EXPLICIT_INSTANTIATION"] = self.options.get_safe("use_explicit_instantiation", False) + tc.variables["USE_EXR"] = False + tc.variables["USE_HOUDINI"] = False + tc.variables["USE_IMATH_HALF"] = self.options.get_safe("use_imath_half", False) + tc.variables["USE_LOG4CPLUS"] = self.options.with_log4cplus + tc.variables["USE_MAYA"] = False + tc.variables["USE_NANOVDB"] = False + tc.variables["USE_PKGCONFIG"] = False + tc.variables["USE_PNG"] = False + tc.variables["USE_STATIC_DEPENDENCIES"] = False + tc.variables["USE_TBB"] = True # Only affects the nanovdb component + tc.variables["USE_ZLIB"] = self.options.with_zlib + tc.generate() + + tc = CMakeDeps(self) + tc.set_property("c-blosc", "cmake_file_name", "Blosc") + tc.set_property("c-blosc", "cmake_target_name", "Blosc::blosc") + tc.set_property("openexr", "cmake_file_name", "IlmBase") + tc.set_property("openexr::ilmbase_half", "cmake_target_name", "IlmBase::Half") + tc.set_property("log4cplus", "cmake_target_name", "Log4cplus::log4cplus") + tc.generate() def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) # Remove FindXXX files from OpenVDB. Let Conan do the job - tools.remove_files_by_mask(os.path.join(self._source_subfolder, "cmake"), "Find*") - with open("FindBlosc.cmake", "w") as f: - f.write( - """find_package(c-blosc) -if(c-blosc_FOUND) - add_library(blosc INTERFACE) - target_link_libraries(blosc INTERFACE c-blosc::c-blosc) - add_library(Blosc::blosc ALIAS blosc) -endif() -""" - ) - with open("FindIlmBase.cmake", "w") as f: - f.write( - """find_package(OpenEXR) -if(OpenEXR_FOUND) - add_library(Half INTERFACE) - add_library(IlmThread INTERFACE) - add_library(Iex INTERFACE) - add_library(Imath INTERFACE) - add_library(IlmImf INTERFACE) - target_link_libraries(Half INTERFACE OpenEXR::OpenEXR) - target_link_libraries(IlmThread INTERFACE OpenEXR::OpenEXR) - target_link_libraries(Iex INTERFACE OpenEXR::OpenEXR) - target_link_libraries(Imath INTERFACE OpenEXR::OpenEXR) - target_link_libraries(IlmImf INTERFACE OpenEXR::OpenEXR) - add_library(IlmBase::Half ALIAS Half) - add_library(IlmBase::IlmThread ALIAS IlmThread) - add_library(IlmBase::Iex ALIAS Iex) - add_library(IlmBase::Imath ALIAS Imath) - add_library(OpenEXR::IlmImf ALIAS IlmImf) - endif() - """ - ) + rm(self, "Find*.cmake", os.path.join(self.source_folder, "cmake"), recursive=True) + # Relax version checks in find_package(), + # since the config/module files produced by CMakeDeps do not support gt major version checks + cmakelists = self.source_path.joinpath("openvdb", "openvdb", "CMakeLists.txt") + cmakelists.write_text(re.sub(r"\$\{MINIMUM_\S+_VERSION}", "", cmakelists.read_text())) + replace_in_file(self, os.path.join(self.source_folder, "openvdb", "openvdb", "CMakeLists.txt"), + "OPENVDB_FUTURE_DEPRECATION", "FALSE") def build(self): self._patch_sources() - cmake = self._configure_cmake() - cmake.build() - - @functools.lru_cache(1) - def _configure_cmake(self): cmake = CMake(self) - # exposed options - cmake.definitions["USE_BLOSC"] = self.options.with_blosc - cmake.definitions["USE_ZLIB"] = self.options.with_zlib - cmake.definitions["USE_LOG4CPLUS"] = self.options.with_log4cplus - cmake.definitions["USE_EXR"] = self.options.with_exr - cmake.definitions["OPENVDB_SIMD"] = self.options.simd - - cmake.definitions["OPENVDB_CORE_SHARED"] = self.options.shared - cmake.definitions["OPENVDB_CORE_STATIC"] = not self.options.shared - - # All available options but not exposed yet. Set to default values - cmake.definitions["OPENVDB_BUILD_CORE"] = True - cmake.definitions["OPENVDB_BUILD_BINARIES"] = False - cmake.definitions["OPENVDB_BUILD_PYTHON_MODULE"] = False - cmake.definitions["OPENVDB_BUILD_UNITTESTS"] = False - cmake.definitions["OPENVDB_BUILD_DOCS"] = False - cmake.definitions["OPENVDB_BUILD_HOUDINI_PLUGIN"] = False - cmake.definitions["OPENVDB_BUILD_HOUDINI_ABITESTS"] = False - - cmake.definitions["OPENVDB_BUILD_AX"] = False - cmake.definitions["OPENVDB_BUILD_AX_BINARIES"] = False - cmake.definitions["OPENVDB_BUILD_AX_UNITTESTS"] = False - - cmake.definitions["OPENVDB_BUILD_MAYA_PLUGIN"] = False - cmake.definitions["OPENVDB_ENABLE_RPATH"] = False - cmake.definitions["OPENVDB_CXX_STRICT"] = False - cmake.definitions["USE_HOUDINI"] = False - cmake.definitions["USE_MAYA"] = False - cmake.definitions["USE_STATIC_DEPENDENCIES"] = False - cmake.definitions["USE_PKGCONFIG"] = False - cmake.definitions["OPENVDB_INSTALL_CMAKE_MODULES"] = False - - cmake.definitions["Boost_USE_STATIC_LIBS"] = not self.options["boost"].shared - cmake.definitions["OPENEXR_USE_STATIC_LIBS"] = not self.options["openexr"].shared - - cmake.definitions["OPENVDB_DISABLE_BOOST_IMPLICIT_LINKING"] = True - - cmake.configure(build_folder=self._build_subfolder) - return cmake + 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() + @property + def _public_defines(self): + defines = [] + if self.options.shared: + defines.append("OPENVDB_DLL") + else: + defines.append("OPENVDB_STATICLIB") + if self.settings.os == "Windows": + defines.append("_WIN32") + defines.append("NOMINMAX") + if self.options.with_log4cplus: + defines.append("OPENVDB_USE_LOG4CPLUS") + return defines + def package_info(self): self.cpp_info.set_property("cmake_find_mode", "both") self.cpp_info.set_property("cmake_file_name", "OpenVDB") self.cpp_info.set_property("cmake_target_name", "OpenVDB::openvdb") # TODO: back to global scope in conan v2 once cmake_find_package_* generators removed + main_component = self.cpp_info.components["openvdb-core"] lib_prefix = "lib" if is_msvc(self) and not self.options.shared else "" - self.cpp_info.components["openvdb-core"].libs = [lib_prefix + "openvdb"] - - lib_define = "OPENVDB_DLL" if self.options.shared else "OPENVDB_STATICLIB" - self.cpp_info.components["openvdb-core"].defines.append(lib_define) - - if self.settings.os == "Windows": - self.cpp_info.components["openvdb-core"].defines.append("_WIN32") - self.cpp_info.components["openvdb-core"].defines.append("NOMINMAX") - - if not self.options["openexr"].shared: - self.cpp_info.components["openvdb-core"].defines.append("OPENVDB_OPENEXR_STATICLIB") - if self.options.with_exr: - self.cpp_info.components["openvdb-core"].defines.append("OPENVDB_TOOLS_RAYTRACER_USE_EXR") - if self.options.with_log4cplus: - self.cpp_info.components["openvdb-core"].defines.append("OPENVDB_USE_LOG4CPLUS") + main_component.libs = [lib_prefix + "openvdb"] + main_component.defines = self._public_defines + if self.settings.os in ("Linux", "FreeBSD"): + main_component.system_libs = ["pthread"] - self.cpp_info.components["openvdb-core"].requires = [ + main_component.requires = [ "boost::iostreams", "boost::system", "onetbb::onetbb", - "openexr::openexr", # should be "openexr::Half", ] if self.settings.os == "Windows": - self.cpp_info.components["openvdb-core"].requires.append("boost::disable_autolinking") - + main_component.requires.append("boost::disable_autolinking") if self.options.with_zlib: - self.cpp_info.components["openvdb-core"].requires.append("zlib::zlib") + main_component.requires.append("zlib::zlib") if self.options.with_blosc: - self.cpp_info.components["openvdb-core"].requires.append("c-blosc::c-blosc") + main_component.requires.append("c-blosc::c-blosc") if self.options.with_log4cplus: - self.cpp_info.components["openvdb-core"].requires.append("log4cplus::log4cplus") - - if self.settings.os in ("Linux", "FreeBSD"): - self.cpp_info.components["openvdb-core"].system_libs = ["pthread"] + main_component.requires.append("log4cplus::log4cplus") + if self.options.use_imath_half: + main_component.requires.append("imath::imath") # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.names["cmake_find_package"] = "OpenVDB" self.cpp_info.names["cmake_find_package_multi"] = "OpenVDB" - self.cpp_info.components["openvdb-core"].names["cmake_find_package"] = "openvdb" - self.cpp_info.components["openvdb-core"].names["cmake_find_package_multi"] = "openvdb" - self.cpp_info.components["openvdb-core"].set_property("cmake_target_name", "OpenVDB::openvdb") + main_component.names["cmake_find_package"] = "openvdb" + main_component.names["cmake_find_package_multi"] = "openvdb" + main_component.set_property("cmake_target_name", "OpenVDB::openvdb") diff --git a/recipes/openvdb/all/patches/0001-Find-packages-fixes.patch b/recipes/openvdb/all/patches/0001-Find-packages-fixes.patch deleted file mode 100644 index 65027361b1c53..0000000000000 --- a/recipes/openvdb/all/patches/0001-Find-packages-fixes.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- ---- openvdb/openvdb/CMakeLists.txt -+++ openvdb/openvdb/CMakeLists.txt -@@ -413,8 +413,7 @@ if(WIN32) - # @note OPENVDB_OPENEXR_STATICLIB is old functionality from the makefiles - # used in PlatformConfig.h to configure EXR exports. Once this file - # is completely removed, this define can be too -- get_target_property(ILMBASE_LIB_TYPE IlmBase::Half TYPE) -- if(OPENEXR_USE_STATIC_LIBS OR (${ILMBASE_LIB_TYPE} STREQUAL STATIC_LIBRARY)) -+ if(OPENEXR_USE_STATIC_LIBS) - list(APPEND OPENVDB_CORE_PUBLIC_DEFINES -DOPENVDB_OPENEXR_STATICLIB) - endif() - list(APPEND OPENVDB_CORE_PUBLIC_DEFINES -D_WIN32 -DNOMINMAX) - diff --git a/recipes/openvdb/all/test_package/CMakeLists.txt b/recipes/openvdb/all/test_package/CMakeLists.txt index 1016f9a6ff31e..5665948f27dfd 100644 --- a/recipes/openvdb/all/test_package/CMakeLists.txt +++ b/recipes/openvdb/all/test_package/CMakeLists.txt @@ -1,11 +1,12 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(OpenVDB REQUIRED) +find_package(OpenVDB REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE OpenVDB::openvdb) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) +if (OpenVDB_VERSION VERSION_GREATER_EQUAL "10.0.0") + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +else() + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) +endif() diff --git a/recipes/openvdb/all/test_package/conanfile.py b/recipes/openvdb/all/test_package/conanfile.py index 19e6a0c06e3d8..ef5d7042163ec 100644 --- a/recipes/openvdb/all/test_package/conanfile.py +++ b/recipes/openvdb/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/openvdb/all/test_v1_package/CMakeLists.txt b/recipes/openvdb/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/openvdb/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/openvdb/all/test_v1_package/conanfile.py b/recipes/openvdb/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/openvdb/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/openvdb/config.yml b/recipes/openvdb/config.yml index d603f0308422b..203a6bdcd5a75 100644 --- a/recipes/openvdb/config.yml +++ b/recipes/openvdb/config.yml @@ -1,3 +1,7 @@ versions: - "8.0.1": + "11.0.0": + folder: all + "10.1.0": + folder: all + "9.1.0": folder: all diff --git a/recipes/openvino/all/conandata.yml b/recipes/openvino/all/conandata.yml new file mode 100644 index 0000000000000..6588f70161339 --- /dev/null +++ b/recipes/openvino/all/conandata.yml @@ -0,0 +1,34 @@ +sources: + "2024.5.0": + "openvino": + url: "https://github.com/openvinotoolkit/openvino/archive/refs/tags/2024.5.0.tar.gz" + sha256: "3d5b89760e1c946aca7b219dff4bf4cf5eb511932863c90cafc47d3c01c85744" + "arm_compute": + url: "https://github.com/ARM-software/ComputeLibrary/archive/refs/tags/v24.09.tar.gz" + sha256: "49b8620f21cbbe49e825a131d9eacd548532646289b50e070b83860bd88087fe" + "onednn_cpu": + url: "https://github.com/openvinotoolkit/oneDNN/archive/c60a9946aa2386890e5c9f5587974facb7624227.tar.gz" + sha256: "37cea8af9772053fd6d178817f64d59e3aa7de9fd8f1aa21873075bb0664240f" + "mlas": + url: "https://github.com/openvinotoolkit/mlas/archive/d1bc25ec4660cddd87804fcf03b2411b5dfb2e94.tar.gz" + sha256: "0a44fbfd4b13e8609d66ddac4b11a27c90c1074cde5244c91ad197901666004c" + "onednn_gpu": + url: "https://github.com/oneapi-src/oneDNN/archive/1722066ad4c0f15495f2d0fcbe9deb2bfd188c36.tar.gz" + sha256: "8955f19800066d8a705df2eb8b462085d6142b4f771ff88ae196e59a0d4ab1bb" + "2023.3.0": + "openvino": + url: "https://github.com/openvinotoolkit/openvino/archive/refs/tags/2023.3.0.tar.gz" + sha256: "27cff20ac0662f5495d2c2eec47cbe5469ab2f225aa091d223f8bfc9d32f4fc3" + "arm_compute": + url: "https://github.com/ARM-software/ComputeLibrary/archive/refs/tags/v23.08.tar.gz" + sha256: "62f514a555409d4401e5250b290cdf8cf1676e4eb775e5bd61ea6a740a8ce24f" + "onednn_cpu": + url: "https://github.com/openvinotoolkit/oneDNN/archive/cb3060bbf4694e46a1359a3d4dfe70500818f72d.tar.gz" + sha256: "9dea3da8dab8511677db3db68ff4d9cdbfd31d8614bf04fd79a7610892bb991c" + "mlas": + url: "https://github.com/openvinotoolkit/mlas/archive/7a35e48a723944972088627be1a8b60841e8f6a5.tar.gz" + sha256: "b7fdd19523a88373d19fd8d5380f64c2834040fa50a6f0774acf08f3fa858daa" + "onednn_gpu": + url: "https://github.com/oneapi-src/oneDNN/archive/cb77937ffcf5e83b5d1cf2940c94e8b508d8f7b4.tar.gz" + sha256: "2ca304c033786aa5c3ec1ec6f8fc3936ae5c6874d5964b586311da11bec2ec4a" +patches: diff --git a/recipes/openvino/all/conanfile.py b/recipes/openvino/all/conanfile.py new file mode 100644 index 0000000000000..22e7d61400801 --- /dev/null +++ b/recipes/openvino/all/conanfile.py @@ -0,0 +1,424 @@ +from conan import ConanFile +from conan.errors import ConanException, ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +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 +import functools +import os +import yaml + +required_conan_version = ">=1.60.0 <2.0 || >=2.0.8" + + +class OpenvinoConan(ConanFile): + name = "openvino" + + license = "Apache-2.0" + homepage = "https://github.com/openvinotoolkit/openvino" + url = "https://github.com/conan-io/conan-center-index" + description = "Open Visual Inference And Optimization toolkit for AI inference" + topics = ("nlp", "natural-language-processing", "ai", "computer-vision", "deep-learning", "transformers", "inference", + "speech-recognition", "yolo", "performance-boost", "diffusion-models", "recommendation-system", "stable-diffusion", + "generative-ai", "llm-inference", "optimize-ai", "deploy-ai") + package_id_non_embed_mode = "patch_mode" + package_type = "library" + short_paths = True + no_copy_source = True + + # Binary configuration + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + # HW plugins + "enable_cpu": [True, False], + "enable_gpu": [True, False], + # SW plugins + "enable_auto": [True, False], + "enable_hetero": [True, False], + "enable_auto_batch": [True, False], + # Frontends + "enable_ir_frontend": [True, False], + "enable_onnx_frontend": [True, False], + "enable_tf_frontend": [True, False], + "enable_tf_lite_frontend": [True, False], + "enable_paddle_frontend": [True, False], + "enable_pytorch_frontend": [True, False] + } + default_options = { + "shared": False, + "fPIC": True, + # HW plugins + "enable_cpu": True, + "enable_gpu": True, + # SW plugins + "enable_auto": True, + "enable_hetero": True, + "enable_auto_batch": True, + # Frontends + "enable_ir_frontend": True, + "enable_onnx_frontend": True, + "enable_tf_frontend": True, + "enable_tf_lite_frontend": True, + "enable_paddle_frontend": True, + "enable_pytorch_frontend": True + } + + @property + def _dependencies_filename(self): + return f"dependencies-{self.version}.yml" + + @property + @functools.lru_cache(1) + def _dependencies_versions(self): + dependencies_filepath = os.path.join(self.recipe_folder, "dependencies", self._dependencies_filename) + if not os.path.isfile(dependencies_filepath): + raise ConanException(f"Cannot find {dependencies_filepath}") + cached_dependencies = yaml.safe_load(open(dependencies_filepath, encoding='UTF-8')) + return cached_dependencies + + def _require(self, dependency): + if dependency not in self._dependencies_versions: + raise ConanException(f"{dependency} is missing in {self._dependencies_filename}") + return f"{dependency}/{self._dependencies_versions[dependency]}" + + @property + def _protobuf_required(self): + return self.options.enable_tf_frontend or self.options.enable_onnx_frontend or self.options.enable_paddle_frontend + + @property + def _target_arm(self): + return "arm" in self.settings.arch + + @property + def _target_x86_64(self): + return self.settings.arch == "x86_64" + + @property + def _gna_option_available(self): + return self.settings.os in ["Linux", "Windows"] and self._target_x86_64 and Version(self.version) < "2024.0.0" + + @property + def _npu_option_available(self): + return self.settings.os in ["Linux", "Windows"] and self._target_x86_64 and Version(self.version) >= "2024.1.0" + + @property + def _gpu_option_available(self): + return self.settings.os != "Macos" and self._target_x86_64 + + @property + def _preprocessing_available(self): + return "ade" in self._dependencies_versions + + @property + def _compilers_minimum_version(self): + return { + "gcc": "7", + "clang": "9", + "apple-clang": "11", + "Visual Studio": "16", + "msvc": "192", + } + + @property + def _is_legacy_one_profile(self): + return not hasattr(self, "settings_build") + + def source(self): + get(self, **self.conan_data["sources"][self.version]["openvino"], strip_root=True) + get(self, **self.conan_data["sources"][self.version]["onednn_cpu"], strip_root=True, + destination=f"{self.source_folder}/src/plugins/intel_cpu/thirdparty/onednn") + get(self, **self.conan_data["sources"][self.version]["mlas"], strip_root=True, + destination=f"{self.source_folder}/src/plugins/intel_cpu/thirdparty/mlas") + get(self, **self.conan_data["sources"][self.version]["arm_compute"], strip_root=True, + destination=f"{self.source_folder}/src/plugins/intel_cpu/thirdparty/ComputeLibrary") + get(self, **self.conan_data["sources"][self.version]["onednn_gpu"], strip_root=True, + destination=f"{self.source_folder}/src/plugins/intel_gpu/thirdparty/onednn_gpu") + rmdir(self, f"{self.source_folder}/src/plugins/intel_gpu/thirdparty/rapidjson") + apply_conandata_patches(self) + + def export(self): + copy(self, f"dependencies/{self._dependencies_filename}", self.recipe_folder, self.export_folder) + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + if not self._gpu_option_available: + del self.options.enable_gpu + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + if self._protobuf_required: + # even though OpenVINO can work with dynamic protobuf, it's still recommended to use static + self.options["protobuf"].shared = False + + def build_requirements(self): + if self._target_arm: + self.tool_requires("scons/4.3.0") + if not self._is_legacy_one_profile: + if self._protobuf_required: + self.tool_requires("protobuf/") + if self.options.enable_tf_lite_frontend: + self.tool_requires("flatbuffers/") + if not self.options.shared: + self.tool_requires("cmake/[>=3.18 <4]") + + def requirements(self): + self.requires("onetbb/2021.10.0") + self.requires("pugixml/1.14") + if self._target_x86_64: + self.requires("xbyak/6.73") + if self.options.get_safe("enable_gpu"): + self.requires("opencl-icd-loader/2023.04.17") + self.requires("rapidjson/cci.20220822") + if self._protobuf_required: + self.requires("protobuf/3.21.12") + if self.options.enable_tf_frontend: + self.requires("snappy/1.1.10") + if self.options.enable_onnx_frontend: + self.requires(self._require("onnx")) + if self.options.enable_tf_lite_frontend: + self.requires("flatbuffers/23.5.26") + if self._preprocessing_available: + self.requires(self._require("ade")) + + def layout(self): + cmake_layout(self, src_folder="src") + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + if self._is_legacy_one_profile: + env = VirtualRunEnv(self) + env.generate(scope="build") + + deps = CMakeDeps(self) + deps.generate() + + toolchain = CMakeToolchain(self) + # HW plugins + toolchain.cache_variables["ENABLE_INTEL_CPU"] = self.options.enable_cpu + if self._gpu_option_available: + toolchain.cache_variables["ENABLE_INTEL_GPU"] = self.options.enable_gpu + toolchain.cache_variables["ENABLE_ONEDNN_FOR_GPU"] = ( + Version(self.version) >= "2024.4.0" and self.options.enable_gpu + or not self.options.enable_cpu + or self.options.shared + ) + if self._gna_option_available: + toolchain.cache_variables["ENABLE_INTEL_GNA"] = False + if self._npu_option_available: + toolchain.cache_variables["ENABLE_INTEL_NPU"] = False + # SW plugins + toolchain.cache_variables["ENABLE_AUTO"] = self.options.enable_auto + toolchain.cache_variables["ENABLE_MULTI"] = self.options.enable_auto + toolchain.cache_variables["ENABLE_AUTO_BATCH"] = self.options.enable_auto_batch + toolchain.cache_variables["ENABLE_HETERO"] = self.options.enable_hetero + # Frontends + toolchain.cache_variables["ENABLE_OV_IR_FRONTEND"] = self.options.enable_ir_frontend + toolchain.cache_variables["ENABLE_OV_PADDLE_FRONTEND"] = self.options.enable_paddle_frontend + toolchain.cache_variables["ENABLE_OV_TF_FRONTEND"] = self.options.enable_tf_frontend + toolchain.cache_variables["ENABLE_OV_TF_LITE_FRONTEND"] = self.options.enable_tf_lite_frontend + toolchain.cache_variables["ENABLE_OV_ONNX_FRONTEND"] = self.options.enable_onnx_frontend + toolchain.cache_variables["ENABLE_OV_PYTORCH_FRONTEND"] = self.options.enable_pytorch_frontend + if Version(self.version) >= "2024.3.0": + toolchain.cache_variables["ENABLE_OV_JAX_FRONTEND"] = False + # Dependencies + toolchain.cache_variables["ENABLE_SYSTEM_TBB"] = True + toolchain.cache_variables["ENABLE_TBBBIND_2_5"] = False + toolchain.cache_variables["ENABLE_SYSTEM_PUGIXML"] = True + if self._protobuf_required: + toolchain.cache_variables["ENABLE_SYSTEM_PROTOBUF"] = True + if self.options.enable_tf_frontend: + toolchain.cache_variables["ENABLE_SYSTEM_SNAPPY"] = True + if self.options.enable_tf_lite_frontend: + toolchain.cache_variables["ENABLE_SYSTEM_FLATBUFFERS"] = True + if self.options.get_safe("enable_gpu"): + toolchain.cache_variables["ENABLE_SYSTEM_OPENCL"] = True + # misc + if self._preprocessing_available: + toolchain.cache_variables["ENABLE_GAPI_PREPROCESSING"] = True + toolchain.cache_variables["BUILD_SHARED_LIBS"] = self.options.shared + toolchain.cache_variables["CPACK_GENERATOR"] = "CONAN" + toolchain.cache_variables["ENABLE_PROFILING_ITT"] = False + toolchain.cache_variables["ENABLE_PYTHON"] = False + toolchain.cache_variables["ENABLE_PROXY"] = False + toolchain.cache_variables["ENABLE_WHEEL"] = False + toolchain.cache_variables["ENABLE_CPPLINT"] = False + toolchain.cache_variables["ENABLE_NCC_STYLE"] = False + toolchain.cache_variables["ENABLE_SAMPLES"] = False + toolchain.cache_variables["ENABLE_TEMPLATE"] = False + toolchain.generate() + + def validate_build(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) + compiler_version = Version(self.settings.compiler.version) + if minimum_version and compiler_version < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires {self.settings.compiler} ver. {minimum_version}, provided ver. {compiler_version}.", + ) + + # OpenVINO has unresolved symbols, when clang is used with libc++ + if self.settings.compiler == "clang" and self.settings.compiler.libcxx == "libc++": + raise ConanInvalidConfiguration( + f"{self.ref} cannot be built with clang and libc++ due to unresolved symbols. " + f"Please, use libstdc++ instead." + ) + + if self.settings.os == "Emscripten": + raise ConanInvalidConfiguration(f"{self.ref} does not support Emscripten") + + # Failing on Conan Center CI due to memory usage + if os.getenv("CONAN_CENTER_BUILD_SERVICE") and self.settings.build_type == "Debug": + raise ConanInvalidConfiguration(f"{self.ref} does not support Debug build type on Conan Center CI") + + def validate(self): + if (self.options.get_safe("enable_gpu") and self.options.enable_cpu + and Version(self.version) < "2024.4.0" and not self.options.shared): + # GPU and CPU plugins cannot be simultaneously built statically, because they use different oneDNN versions + self.output.warning(f"{self.name} recipe builds GPU plugin without oneDNN (dGPU) support during static build, " + "because CPU plugin compiled with different oneDNN version may cause ODR violation. " + "To enable oneDNN support for GPU plugin, please, either use shared build configuration " + "or disable CPU plugin by setting 'enable_cpu' option to False.") + + def build(self): + cmake = CMake(self) + cmake.configure() + for target in ["ov_frontends", "ov_plugins", "openvino_c"]: + cmake.build(target=target) + + def package(self): + cmake = CMake(self) + cmake.install() + # remove cmake and .pc files, since they will be generated later by Conan itself in package_info() + 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.set_property("cmake_find_mode", "config") + self.cpp_info.set_property("cmake_file_name", "OpenVINO") + self.cpp_info.set_property("pkg_config_name", "openvino") + + openvino_runtime = self.cpp_info.components["Runtime"] + openvino_runtime.set_property("cmake_target_name", "openvino::runtime") + openvino_runtime.requires = ["onetbb::libtbb", "pugixml::pugixml"] + openvino_runtime.libs = ["openvino"] + if self._preprocessing_available: + openvino_runtime.requires.append("ade::ade") + if self._target_x86_64: + openvino_runtime.requires.append("xbyak::xbyak") + if self.settings.os in ["Linux", "Android", "FreeBSD", "SunOS", "AIX"]: + openvino_runtime.system_libs = ["m", "dl", "pthread"] + if self.settings.os == "Windows": + openvino_runtime.system_libs.append("shlwapi") + if self._preprocessing_available: + openvino_runtime.system_libs.extend(["wsock32", "ws2_32"]) + if Version(self.version) < "2024.0.0": + openvino_runtime.includedirs.append(os.path.join("include", "ie")) + + # Have to expose all internal libraries for static libraries case + if not self.options.shared: + # HW plugins + if self.options.enable_cpu: + openvino_runtime.libs.append("openvino_arm_cpu_plugin" if self._target_arm else \ + "openvino_intel_cpu_plugin") + openvino_runtime.libs.extend(["openvino_onednn_cpu", "openvino_snippets", "mlas"]) + if self._target_arm: + openvino_runtime.libs.append("arm_compute-static") + if self.options.get_safe("enable_gpu"): + openvino_runtime.libs.extend(["openvino_intel_gpu_plugin", "openvino_intel_gpu_graph", + "openvino_intel_gpu_runtime", "openvino_intel_gpu_kernels"]) + if not self.options.enable_cpu or Version(self.version) >= "2024.4.0": + openvino_runtime.libs.append("openvino_onednn_gpu") + # SW plugins + if self.options.enable_auto: + openvino_runtime.libs.append("openvino_auto_plugin") + if self.options.enable_hetero: + openvino_runtime.libs.append("openvino_hetero_plugin") + if self.options.enable_auto_batch: + openvino_runtime.libs.append("openvino_auto_batch_plugin") + # Preprocessing should come after plugins, because plugins depend on it + if self._preprocessing_available: + openvino_runtime.libs.extend(["openvino_gapi_preproc", "fluid"]) + # Frontends + if self.options.enable_ir_frontend: + openvino_runtime.libs.append("openvino_ir_frontend") + if self.options.enable_onnx_frontend: + openvino_runtime.libs.extend(["openvino_onnx_frontend", "openvino_onnx_common"]) + openvino_runtime.requires.extend(["protobuf::libprotobuf", "onnx::onnx"]) + if self.options.enable_tf_frontend: + openvino_runtime.libs.extend(["openvino_tensorflow_frontend"]) + openvino_runtime.requires.extend(["protobuf::libprotobuf", "snappy::snappy"]) + if self.options.enable_tf_lite_frontend: + openvino_runtime.libs.extend(["openvino_tensorflow_lite_frontend"]) + openvino_runtime.requires.extend(["flatbuffers::flatbuffers"]) + if self.options.enable_tf_frontend or self.options.enable_tf_lite_frontend: + openvino_runtime.libs.extend(["openvino_tensorflow_common"]) + if self.options.enable_paddle_frontend: + openvino_runtime.libs.append("openvino_paddle_frontend") + openvino_runtime.requires.append("protobuf::libprotobuf") + if self.options.enable_pytorch_frontend: + openvino_runtime.libs.append("openvino_pytorch_frontend") + # Common private dependencies should go last, because they satisfy dependencies for all other libraries + if Version(self.version) < "2024.0.0": + openvino_runtime.libs.append("openvino_builders") + openvino_runtime.libs.extend(["openvino_reference", "openvino_shape_inference", "openvino_itt", + # utils goes last since all others depend on it + "openvino_util"]) + # set 'openvino' once again for transformations objects files (cyclic dependency) + # openvino_runtime.libs.append("openvino") + full_openvino_lib_path = os.path.join(self.package_folder, "lib", "openvino.lib").replace("\\", "/") if self.settings.os == "Windows" else \ + os.path.join(self.package_folder, "lib", "libopenvino.a") + openvino_runtime.system_libs.insert(0, full_openvino_lib_path) + # Add definition to prevent symbols importing + openvino_runtime.defines = ["OPENVINO_STATIC_LIBRARY"] + + if self.options.get_safe("enable_gpu"): + openvino_runtime.requires.extend(["opencl-icd-loader::opencl-icd-loader", "rapidjson::rapidjson"]) + if self.settings.os == "Windows": + openvino_runtime.system_libs.append("setupapi") + + openvino_runtime_c = self.cpp_info.components["Runtime_C"] + openvino_runtime_c.set_property("cmake_target_name", "openvino::runtime::c") + openvino_runtime_c.libs = ["openvino_c"] + openvino_runtime_c.requires = ["Runtime"] + + if self.options.enable_onnx_frontend: + openvino_onnx = self.cpp_info.components["ONNX"] + openvino_onnx.set_property("cmake_target_name", "openvino::frontend::onnx") + openvino_onnx.libs = ["openvino_onnx_frontend"] + openvino_onnx.requires = ["Runtime", "onnx::onnx", "protobuf::libprotobuf"] + + if self.options.enable_paddle_frontend: + openvino_paddle = self.cpp_info.components["Paddle"] + openvino_paddle.set_property("cmake_target_name", "openvino::frontend::paddle") + openvino_paddle.libs = ["openvino_paddle_frontend"] + openvino_paddle.requires = ["Runtime", "protobuf::libprotobuf"] + + if self.options.enable_tf_frontend: + openvino_tensorflow = self.cpp_info.components["TensorFlow"] + openvino_tensorflow.set_property("cmake_target_name", "openvino::frontend::tensorflow") + openvino_tensorflow.libs = ["openvino_tensorflow_frontend"] + openvino_tensorflow.requires = ["Runtime", "protobuf::libprotobuf", "snappy::snappy"] + + if self.options.enable_pytorch_frontend: + openvino_pytorch = self.cpp_info.components["PyTorch"] + openvino_pytorch.set_property("cmake_target_name", "openvino::frontend::pytorch") + openvino_pytorch.libs = ["openvino_pytorch_frontend"] + openvino_pytorch.requires = ["Runtime"] + + if self.options.enable_tf_lite_frontend: + openvino_tensorflow_lite = self.cpp_info.components["TensorFlowLite"] + openvino_tensorflow_lite.set_property("cmake_target_name", "openvino::frontend::tensorflow_lite") + openvino_tensorflow_lite.libs = ["openvino_tensorflow_lite_frontend"] + openvino_tensorflow_lite.requires = ["Runtime", "flatbuffers::flatbuffers"] + diff --git a/recipes/openvino/all/dependencies/dependencies-2023.3.0.yml b/recipes/openvino/all/dependencies/dependencies-2023.3.0.yml new file mode 100644 index 0000000000000..d2b07af77f816 --- /dev/null +++ b/recipes/openvino/all/dependencies/dependencies-2023.3.0.yml @@ -0,0 +1,2 @@ +onnx: "1.15.0" +ade: "0.1.2d" diff --git a/recipes/openvino/all/dependencies/dependencies-2024.5.0.yml b/recipes/openvino/all/dependencies/dependencies-2024.5.0.yml new file mode 100644 index 0000000000000..8885f88a6f2fb --- /dev/null +++ b/recipes/openvino/all/dependencies/dependencies-2024.5.0.yml @@ -0,0 +1 @@ +onnx: "1.16.2" \ No newline at end of file diff --git a/recipes/openvino/all/test_package/CMakeLists.txt b/recipes/openvino/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..60799331791bd --- /dev/null +++ b/recipes/openvino/all/test_package/CMakeLists.txt @@ -0,0 +1,61 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX C) + +# Common + +macro(add_component def comp) + if(${def}) + list(APPEND OpenVINO_COMPONENTS ${comp}) + endif() +endmacro() + +add_component(ENABLE_ONNX_FRONTEND ONNX) +add_component(ENABLE_PADDLE_FRONTEND Paddle) +add_component(ENABLE_TF_FRONTEND TensorFlow) +add_component(ENABLE_TF_LITE_FRONTEND TensorFlowLite) +add_component(ENABLE_PYTORCH_FRONTEND PyTroch) + +find_package(OpenVINO REQUIRED COMPONENTS Runtime ${OpenVINO_COMPONENTS}) + +function(add_plugin_definition target def) + if(${def}) + target_compile_definitions(${target} PRIVATE ${def}) + endif() +endfunction() + +function(add_frontend_definition target def frontend) + if(${def}) + target_compile_definitions(${target} PRIVATE ${def}) + if(NOT TARGET openvino::frontend::${frontend}) + message(FATAL_ERROR "Target for ${frontend} has not been created") + endif() + endif() +endfunction() + +# C++ test_package + +set(target ${PROJECT_NAME}_cpp) +add_executable(${target} test_package.cpp) + +add_plugin_definition(${target} ENABLE_IR_FRONTEND) +add_frontend_definition(${target} ENABLE_ONNX_FRONTEND onnx) +add_frontend_definition(${target} ENABLE_PADDLE_FRONTEND paddle) +add_frontend_definition(${target} ENABLE_TF_FRONTEND tensorflow) +add_frontend_definition(${target} ENABLE_TF_LITE_FRONTEND tensorflow_lite) +add_frontend_definition(${target} ENABLE_PYTORCH_FRONTEND pytorch) + +target_link_libraries(${target} PRIVATE openvino::runtime) +target_compile_features(${target} PRIVATE cxx_std_11) + +# C test_package + +set(target ${PROJECT_NAME}_c) +add_executable(${target} test_package.c) + +add_plugin_definition(${target} ENABLE_INTEL_CPU) +add_plugin_definition(${target} ENABLE_INTEL_GPU) +add_plugin_definition(${target} ENABLE_AUTO) +add_plugin_definition(${target} ENABLE_HETERO) +add_plugin_definition(${target} ENABLE_AUTO_BATCH) + +target_link_libraries(${target} PRIVATE openvino::runtime::c) diff --git a/recipes/openvino/all/test_package/conanfile.py b/recipes/openvino/all/test_package/conanfile.py new file mode 100644 index 0000000000000..9d90e91b9a9f9 --- /dev/null +++ b/recipes/openvino/all/test_package/conanfile.py @@ -0,0 +1,52 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def generate(self): + deps = CMakeDeps(self) + # deps.check_components_exist = True + deps.generate() + + tc = CMakeToolchain(self) + tc.variables["CMAKE_VERBOSE_MAKEFILE"] = True + # HW plugins + tc.variables["ENABLE_INTEL_CPU"] = self.dependencies[self.tested_reference_str].options.enable_cpu + tc.variables["ENABLE_INTEL_GPU"] = self.dependencies[self.tested_reference_str].options.get_safe("enable_gpu", False) + # SW plugins + tc.variables["ENABLE_AUTO"] = self.dependencies[self.tested_reference_str].options.enable_auto + tc.variables["ENABLE_HETERO"] = self.dependencies[self.tested_reference_str].options.enable_hetero + tc.variables["ENABLE_AUTO_BATCH"] = self.dependencies[self.tested_reference_str].options.enable_auto_batch + # Frontends + tc.variables["ENABLE_IR_FRONTEND"] = self.dependencies[self.tested_reference_str].options.enable_ir_frontend + tc.variables["ENABLE_ONNX_FRONTEND"] = self.dependencies[self.tested_reference_str].options.enable_onnx_frontend + tc.variables["ENABLE_TF_FRONTEND"] = self.dependencies[self.tested_reference_str].options.enable_tf_frontend + tc.variables["ENABLE_TF_LITE_FRONTEND"] = self.dependencies[self.tested_reference_str].options.enable_tf_lite_frontend + tc.variables["ENABLE_PADDLE_FRONTEND"] = self.dependencies[self.tested_reference_str].options.enable_paddle_frontend + tc.variables["ENABLE_PYTORCH_FRONTEND"] = self.dependencies[self.tested_reference_str].options.enable_pytorch_frontend + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(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") + self.run(bin_path_cpp, env="conanrun") diff --git a/recipes/openvino/all/test_package/test_package.c b/recipes/openvino/all/test_package/test_package.c new file mode 100644 index 0000000000000..efe358d0b6ecb --- /dev/null +++ b/recipes/openvino/all/test_package/test_package.c @@ -0,0 +1,49 @@ +#include + +#define OV_SUCCESS(statement) \ + if ((statement) != 0) \ + return 1; + +#define OV_FAIL(statement) \ + if ((statement) == 0) \ + return 1; + +int test_available_devices() { + ov_core_t* core = NULL; + char* ret = NULL; + OV_SUCCESS(ov_core_create(&core)); +#ifdef ENABLE_INTEL_CPU + OV_SUCCESS(ov_core_get_property(core, "CPU", "AVAILABLE_DEVICES", &ret)); +#else + OV_FAIL(ov_core_get_property(core, "CPU", "AVAILABLE_DEVICES", &ret)); +#endif +#ifdef ENABLE_INTEL_GPU + OV_SUCCESS(ov_core_get_property(core, "GPU", "AVAILABLE_DEVICES", &ret)); +#else + OV_FAIL(ov_core_get_property(core, "GPU", "AVAILABLE_DEVICES", &ret)); +#endif +#ifdef ENABLE_AUTO + OV_SUCCESS(ov_core_get_property(core, "AUTO", "SUPPORTED_PROPERTIES", &ret)); + OV_SUCCESS(ov_core_get_property(core, "MULTI", "SUPPORTED_PROPERTIES", &ret)); +#else + OV_FAIL(ov_core_get_property(core, "AUTO", "SUPPORTED_PROPERTIES", &ret)); + OV_FAIL(ov_core_get_property(core, "MULTI", "SUPPORTED_PROPERTIES", &ret)); +#endif +#ifdef ENABLE_HETERO + OV_SUCCESS(ov_core_get_property(core, "HETERO", "SUPPORTED_PROPERTIES", &ret)); +#else + OV_FAIL(ov_core_get_property(core, "HETERO", "SUPPORTED_PROPERTIES", &ret)); +#endif +#ifdef ENABLE_AUTO_BATCH + OV_SUCCESS(ov_core_get_property(core, "BATCH", "SUPPORTED_PROPERTIES", &ret)); +#else + OV_FAIL(ov_core_get_property(core, "BATCH", "SUPPORTED_PROPERTIES", &ret)); +#endif + ov_core_free(core); + return 0; +} + +int main() { + OV_SUCCESS(test_available_devices()); + return 0; +} diff --git a/recipes/openvino/all/test_package/test_package.cpp b/recipes/openvino/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..baaef66559aa4 --- /dev/null +++ b/recipes/openvino/all/test_package/test_package.cpp @@ -0,0 +1,66 @@ +#include +#include +#include + +#define OV_SUCCESS(statement) \ + if ((statement) != 0) \ + return 1; + +#define OV_FAIL(statement) \ + if ((statement) == 0) \ + return 1; + +int test_available_frontends() { + ov::frontend::FrontEndManager manager; + auto frontend_found = [&] (const std::string & name) -> int { + try { + manager.load_by_framework(name); + } catch (const std::exception & e) { + return 1; + } + return 0; + }; + +#ifdef ENABLE_IR_FRONTEND + OV_SUCCESS(frontend_found("ir")); +#else + OV_FAIL(frontend_found("ir")); +#endif +#ifdef ENABLE_TF_LITE_FRONTEND + OV_SUCCESS(frontend_found("tflite")); +#else + OV_FAIL(frontend_found("tflite")); +#endif +#ifdef ENABLE_PYTORCH_FRONTEND + OV_SUCCESS(frontend_found("pytorch")); +#else + OV_FAIL(frontend_found("pytorch")); +#endif +#ifdef ENABLE_ONNX_FRONTEND + OV_SUCCESS(frontend_found("onnx")); +#else + OV_FAIL(frontend_found("onnx")); +#endif +#ifdef ENABLE_TF_FRONTEND + OV_SUCCESS(frontend_found("tf")); +#else + OV_FAIL(frontend_found("tf")); +#endif +#ifdef ENABLE_PADDLE_FRONTEND + OV_SUCCESS(frontend_found("paddle")); +#else + OV_FAIL(frontend_found("paddle")); +#endif + return 0; +} + +int main() { + OV_SUCCESS(test_available_frontends()); + + // Deinitialize OpenVINO. Important for old systems like Ubuntu 16.04 with obsolete glibc, + // where application deinit can lead to the following issue on exit: + // Inconsistency detected by ld.so: dl-close.c: 811: _dl_close: Assertion `map->l_init_called' failed! + ov::shutdown(); + + return 0; +} diff --git a/recipes/openvino/config.yml b/recipes/openvino/config.yml new file mode 100644 index 0000000000000..9e7497e795ff9 --- /dev/null +++ b/recipes/openvino/config.yml @@ -0,0 +1,6 @@ +versions: + "2024.5.0": + folder: "all" + "2023.3.0": + folder: "all" + diff --git a/recipes/openvr/all/CMakeLists.txt b/recipes/openvr/all/CMakeLists.txt deleted file mode 100644 index c4553e469fbbd..0000000000000 --- a/recipes/openvr/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(TARGETS) - -link_libraries(CONAN_PKG::jsoncpp) - -add_subdirectory(source_subfolder) diff --git a/recipes/openvr/all/conandata.yml b/recipes/openvr/all/conandata.yml index 8306fe238fc2a..8a94700e08a51 100644 --- a/recipes/openvr/all/conandata.yml +++ b/recipes/openvr/all/conandata.yml @@ -11,4 +11,3 @@ sources: patches: "1.16.8": - patch_file: "patches/fix-includes-and-assert-1.16.8.patch" - base_path: "source_subfolder" diff --git a/recipes/openvr/all/conanfile.py b/recipes/openvr/all/conanfile.py index 35ae1e9ea460d..482f050fca0c4 100644 --- a/recipes/openvr/all/conanfile.py +++ b/recipes/openvr/all/conanfile.py @@ -1,16 +1,30 @@ import os -from conans import ConanFile, tools, CMake -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, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir, \ + save, mkdir +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" + class OpenvrConan(ConanFile): name = "openvr" - description = "API and runtime that allows access to VR hardware from applications have specific knowledge of the hardware they are targeting." - topics = ("conan", "openvr", "vr", ) + description = ( + "API and runtime that allows access to VR hardware from applications " + "have specific knowledge of the hardware they are targeting." + ) + license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/ValveSoftware/openvr" - license = "BSD-3-Clause" + topics = ("vr", "virtual reality") - settings = "os", "compiler", "build_type", "arch" + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -20,13 +34,8 @@ class OpenvrConan(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": @@ -34,69 +43,83 @@ 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") - if self.settings.compiler == "gcc" and tools.Version(self.settings.compiler.version) < "5": - raise ConanInvalidConfiguration("OpenVR can't be compiled by {0} {1}".format(self.settings.compiler, - self.settings.compiler.version)) + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("jsoncpp/1.9.4") + self.requires("jsoncpp/1.9.5", transitive_headers=True, transitive_libs=True) + + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, 11) + if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "5": + raise ConanInvalidConfiguration( + f"OpenVR can't be compiled by {self.settings.compiler} {self.settings.compiler.version}" + ) 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 generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["BUILD_SHARED"] = self.options.shared + tc.cache_variables["BUILD_UNIVERSAL"] = False + # Let Conan handle the stdlib setting, even if we are using libc++ + tc.cache_variables["USE_LIBCXX"] = False + 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) + apply_conandata_patches(self) # Honor fPIC=False - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "-fPIC", "") - # Unvendor jsoncpp (we rely on our CMake wrapper for jsoncpp injection) - tools.replace_in_file(os.path.join(self._source_subfolder, "src", "CMakeLists.txt"), - "jsoncpp.cpp", "") - tools.rmdir(os.path.join(self._source_subfolder, "src", "json")) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BUILD_SHARED"] = self.options.shared - self._cmake.definitions["BUILD_UNIVERSAL"] = False - self._cmake.definitions["USE_LIBCXX"] = False - self._cmake.configure() - - return self._cmake + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "-fPIC", "") + # Unvendor jsoncpp + replace_in_file(self, os.path.join(self.source_folder, "src", "CMakeLists.txt"), "jsoncpp.cpp", "") + rmdir(self, os.path.join(self.source_folder, "src", "json")) + # Add jsoncpp dependency from Conan + save(self, os.path.join(self.source_folder, "src", "CMakeLists.txt"), + "find_package(jsoncpp REQUIRED CONFIG)\n" + "target_link_libraries(${LIBNAME} JsonCpp::JsonCpp)", + append=True) def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() + @property + def _lib_name(self): + if self.settings.os == "Windows" and self.settings.arch == "x86_64": + return "openvr_api64" + return "openvr_api" + def package(self): - self.copy("LICENSE", 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() - self.copy(pattern="openvr_api*.dll", dst="bin", src="bin", keep_path=False) - tools.rmdir(os.path.join(self.package_folder, "share")) + if self.settings.os == "Windows" and self.options.shared: + mkdir(self, os.path.join(self.package_folder, "bin")) + os.rename(os.path.join(self.package_folder, "lib", f"{self._lib_name}.dll"), + os.path.join(self.package_folder, "bin", f"{self._lib_name}.dll")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): - self.cpp_info.names["pkg_config"] = "openvr" - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.set_property("pkg_config_name", "openvr") + self.cpp_info.libs = [self._lib_name] self.cpp_info.includedirs.append(os.path.join("include", "openvr")) if not self.options.shared: self.cpp_info.defines.append("OPENVR_BUILD_STATIC") - 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("dl") - if tools.is_apple_os(self.settings.os): - self.cpp_info.frameworks.append("Foundation") + if is_apple_os(self): + self.cpp_info.frameworks.extend(["Foundation", "CoreFoundation"]) diff --git a/recipes/openvr/all/test_package/CMakeLists.txt b/recipes/openvr/all/test_package/CMakeLists.txt index aede60e3b1e4a..8759620a94936 100644 --- a/recipes/openvr/all/test_package/CMakeLists.txt +++ b/recipes/openvr/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -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() +find_package(openvr 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 openvr::openvr) set_property(TARGET ${CMAKE_PROJECT_NAME} PROPERTY CXX_STANDARD 11) diff --git a/recipes/openvr/all/test_package/conanfile.py b/recipes/openvr/all/test_package/conanfile.py index 4903f1a7e8fa0..ef5d7042163ec 100644 --- a/recipes/openvr/all/test_package/conanfile.py +++ b/recipes/openvr/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/openvr/all/test_v1_package/CMakeLists.txt b/recipes/openvr/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/openvr/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/openvr/all/test_v1_package/conanfile.py b/recipes/openvr/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..6c9d5dba712c7 --- /dev/null +++ b/recipes/openvr/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_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/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/optimlib/all/CMakeLists.txt b/recipes/optimlib/all/CMakeLists.txt new file mode 100644 index 0000000000000..969c489f5660e --- /dev/null +++ b/recipes/optimlib/all/CMakeLists.txt @@ -0,0 +1,49 @@ +# Based on https://github.com/kthohr/optim/blob/5453f48aca695e6fef123677f35cb4d22e356e73/configure +cmake_minimum_required(VERSION 3.15) +project(OptimLib LANGUAGES CXX) + +set(OPTIM_LINEAR_ALG_LIB "eigen" CACHE STRING "Choice of linear algebra library") +set(OPTIM_FPN_TYPE "double" CACHE STRING "Floating-point number type") +option(OPTIM_PARALLEL "Enable OpenMP parallelization features" ON) + +file(GLOB_RECURSE SOURCES src/*.cpp) + +add_library(optim ${SOURCES}) +target_include_directories(optim PUBLIC include) +target_compile_features(optim PUBLIC cxx_std_11) + +target_compile_options(optim PRIVATE -Wall) +if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug") + target_compile_options(optim PRIVATE -O3 -ffp-contract=fast) + target_compile_definitions(optim PRIVATE -DARMA_NO_DEBUG) +endif() + +if(OPTIM_LINEAR_ALG_LIB STREQUAL "eigen") + find_package(Eigen3 REQUIRED) + target_link_libraries(optim PUBLIC Eigen3::Eigen) + target_compile_definitions(optim PRIVATE -DOPTIM_ENABLE_EIGEN_WRAPPERS) +elseif(OPTIM_LINEAR_ALG_LIB STREQUAL "arma") + find_package(Armadillo REQUIRED) + target_link_libraries(optim PUBLIC Armadillo::Armadillo) + target_compile_definitions(optim PRIVATE -DOPTIM_ENABLE_ARMA_WRAPPERS) +else() + message(FATAL_ERROR "OPTIM_LINEAR_ALG_LIB must be either 'eigen' or 'arma'. Got: ${OPTIM_LINEAR_ALG_LIB}") +endif() + +target_compile_definitions(optim PRIVATE -DOPTIM_FPN_TYPE=${OPTIM_FPN_TYPE}) + +if(OPTIM_PARALLEL) + find_package(OpenMP REQUIRED) + target_link_libraries(optim PUBLIC OpenMP::OpenMP_CXX) +endif() + +include(GNUInstallDirs) +install(TARGETS optim + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) +install(DIRECTORY include/ + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + FILES_MATCHING PATTERN "*.hpp" PATTERN "*.ipp" +) diff --git a/recipes/optimlib/all/conandata.yml b/recipes/optimlib/all/conandata.yml new file mode 100644 index 0000000000000..0d0a307dd5d0c --- /dev/null +++ b/recipes/optimlib/all/conandata.yml @@ -0,0 +1,9 @@ +sources: + # The version is defined at https://github.com/kthohr/optim/blob/master/include/misc/optim_options.hpp#L30-L40 + "3.1.3": + source: + url: "https://github.com/kthohr/optim/archive/f9d9357169ce4b497a677faa9ce85e901e77275d.tar.gz" + sha256: "3809f753fc75c007c55ee995264c72487415a22dacc0846ba8ac0c1d1c24b91a" + base_matrix_ops: + url: "https://github.com/kthohr/BaseMatrixOps/archive/9e5beec15d803f0429dadae5e9218ef907271383.zip" + sha256: "f47de48e3814317d3cfa38f986bf847d816fa74dd13d8ccb9bac3ab51a49efd4" diff --git a/recipes/optimlib/all/conanfile.py b/recipes/optimlib/all/conanfile.py new file mode 100644 index 0000000000000..058265aa8ed45 --- /dev/null +++ b/recipes/optimlib/all/conanfile.py @@ -0,0 +1,129 @@ +import os + +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMakeToolchain, CMakeDeps, CMake, cmake_layout +from conan.tools.files import copy, get + +required_conan_version = ">=1.54.0" + + +class OptimLibConan(ConanFile): + name = "optimlib" + description = "OptimLib: a lightweight C++ library of numerical optimization methods for nonlinear functions" + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/kthohr/optim" + topics = ("numerical-optimization", "optimization", "automatic-differentiation", "evolutionary-algorithms") + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "header_only": [True, False], + "linear_alg_lib": ["arma", "eigen"], + "floating_point_type": ["float", "double"], + "with_openmp": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "header_only": False, + "linear_alg_lib": "eigen", + "floating_point_type": "double", + "with_openmp": False, + } + + @property + def _min_cppstd(self): + return 11 + + 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": + del self.options.fPIC + + def configure(self): + if self.options.header_only: + self.package_type = "header-library" + self.options.rm_safe("shared") + self.options.rm_safe("fPIC") + elif self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + if self.options.linear_alg_lib == "arma": + self.requires("armadillo/12.6.4", transitive_headers=True, transitive_libs=True) + elif self.options.linear_alg_lib == "eigen": + self.requires("eigen/3.4.0", transitive_headers=True, transitive_libs=True) + if self.options.with_openmp: + # '#pragma omp' is used in public headers + self.requires("openmp/system", transitive_headers=True, transitive_libs=True) + + def package_id(self): + if self.info.options.header_only: + self.info.clear() + + def validate(self): + if self.settings.os == "Windows": + # "Use of this library with Windows-based systems, with or without MSVC, is not supported." + raise ConanInvalidConfiguration("Windows is not supported") + + 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]["source"], strip_root=True) + get(self, **self.conan_data["sources"][self.version]["base_matrix_ops"], strip_root=True, + destination=os.path.join(self.source_folder, "include", "BaseMatrixOps")) + + def generate(self): + if not self.options.header_only: + tc = CMakeToolchain(self) + tc.variables["OPTIM_LINEAR_ALG_LIB"] = str(self.options.linear_alg_lib) + tc.variables["OPTIM_PARALLEL"] = self.options.with_openmp + tc.variables["OPTIM_FPN_TYPE"] = str(self.options.floating_point_type) + tc.generate() + deps = CMakeDeps(self) + deps.generate() + + def build(self): + if not self.options.header_only: + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + copy(self, "NOTICE.txt", self.source_folder, os.path.join(self.package_folder, "licenses")) + if self.options.header_only: + self.run(f"./configure --header-only-version", cwd=self.source_folder) + include_dir = os.path.join(self.source_folder, "header_only_version") + copy(self, "*.hpp", include_dir, os.path.join(self.package_folder, "include")) + copy(self, "*.ipp", include_dir, os.path.join(self.package_folder, "include")) + else: + cmake = CMake(self) + cmake.install() + + def package_info(self): + # Unofficial CMake file and target + self.cpp_info.set_property("cmake_file_name", "OptimLib") + self.cpp_info.set_property("cmake_target_name", "OptimLib::OptimLib") + + if not self.options.header_only: + self.cpp_info.libs = ["optim"] + + if self.options.linear_alg_lib == "arma": + self.cpp_info.defines.append("OPTIM_ENABLE_ARMA_WRAPPERS") + if self.settings.build_type not in ["Debug", "RelWithDebInfo"]: + self.cpp_info.defines.append("ARMA_NO_DEBUG") + elif self.options.linear_alg_lib == "eigen": + self.cpp_info.defines.append("OPTIM_ENABLE_EIGEN_WRAPPERS") + self.cpp_info.defines.append(f"OPTIM_FPN_TYPE={self.options.floating_point_type}") diff --git a/recipes/optimlib/all/test_package/CMakeLists.txt b/recipes/optimlib/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..897ebb983164b --- /dev/null +++ b/recipes/optimlib/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(OptimLib REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE OptimLib::OptimLib) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/optimlib/all/test_package/conanfile.py b/recipes/optimlib/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/optimlib/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/optimlib/all/test_package/test_package.cpp b/recipes/optimlib/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..c2c8b66e698d0 --- /dev/null +++ b/recipes/optimlib/all/test_package/test_package.cpp @@ -0,0 +1,24 @@ +#include + +struct ll_data_t +{ + optim::ColVec_t Y; + optim::Mat_t X; +}; + +double ll_fn(const optim::ColVec_t& vals_inp, optim::ColVec_t* grad_out, void* opt_data) +{ + return 0.0; +} + +int main() +{ + int n_dim = 5; + int n_samp = 40; + ll_data_t opt_data; + opt_data.Y = optim::ColVec_t(n_samp); + opt_data.X = optim::Mat_t(n_samp, n_dim); + optim::ColVec_t x(n_samp); + optim::algo_settings_t settings; + bool success = optim::gd(x, ll_fn, &opt_data, settings); +} diff --git a/recipes/optimlib/config.yml b/recipes/optimlib/config.yml new file mode 100644 index 0000000000000..71660a79817c5 --- /dev/null +++ b/recipes/optimlib/config.yml @@ -0,0 +1,3 @@ +versions: + "3.1.3": + folder: all diff --git a/recipes/optional-lite/all/conandata.yml b/recipes/optional-lite/all/conandata.yml index 39ffa178f7dc7..91b29bae3c40f 100644 --- a/recipes/optional-lite/all/conandata.yml +++ b/recipes/optional-lite/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.6.0": + url: "https://github.com/martinmoene/optional-lite/archive/v3.6.0.tar.gz" + sha256: "2be17fcfc764809612282c3e728cabc42afe703b9dc333cc87c48d882fcfc2c2" "3.5.0": url: "https://github.com/martinmoene/optional-lite/archive/v3.5.0.tar.gz" sha256: "6077cee87e2812afd05a273645051e0b55397a25c220295ddc1d6f49d0cf5cc8" diff --git a/recipes/optional-lite/all/conanfile.py b/recipes/optional-lite/all/conanfile.py index f70e5bfcb8e65..c0ba7980dc0da 100644 --- a/recipes/optional-lite/all/conanfile.py +++ b/recipes/optional-lite/all/conanfile.py @@ -8,11 +8,12 @@ class OptionalLiteConan(ConanFile): name = "optional-lite" - url = "https://github.com/conan-io/conan-center-index" - homepage = "https://github.com/martinmoene/optional-lite" description = "A single-file header-only version of a C++17-like optional, a nullable object for C++98, C++11 and later" - topics = ("cpp98", "cpp17", "optional", "optional-implementations") license = "BSL-1.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/martinmoene/optional-lite" + topics = ("cpp98", "cpp17", "optional", "optional-implementations", "header-only") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -23,11 +24,7 @@ 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 + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): copy(self, "*.hpp", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) @@ -38,7 +35,6 @@ def package_info(self): 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" @@ -50,4 +46,3 @@ def package_info(self): 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/config.yml b/recipes/optional-lite/config.yml index 14d2da2b590c7..07884c2e355df 100644 --- a/recipes/optional-lite/config.yml +++ b/recipes/optional-lite/config.yml @@ -1,4 +1,6 @@ versions: + "3.6.0": + folder: all "3.5.0": folder: all "3.4.0": diff --git a/recipes/opus/all/conandata.yml b/recipes/opus/all/conandata.yml index d7e0ee962c3b2..a7288d00d394f 100644 --- a/recipes/opus/all/conandata.yml +++ b/recipes/opus/all/conandata.yml @@ -1,7 +1,15 @@ sources: + "1.5.2": + url: "https://gitlab.xiph.org/xiph/opus/-/archive/v1.5.2/opus-v1.5.2.tar.gz" + sha256: "5cf92b5b577d8ed203424f1e0f618f30bc6b6e42a26eae88bdb649ea63961cc9" + "1.4": + url: "https://github.com/xiph/opus/releases/download/v1.4/opus-1.4.tar.gz" + sha256: "c9b32b4253be5ae63d1ff16eea06b94b5f0f2951b7a02aceef58e3a3ce49c51f" "1.3.1": url: "https://archive.mozilla.org/pub/opus/opus-1.3.1.tar.gz" sha256: "65b58e1e25b2a114157014736a3d9dfeaad8d41be1c8179866f144a2fb44ff9d" patches: "1.3.1": - patch_file: "patches/1.3.1-add-opus_buildtype-cmake.patch" + patch_description: "Set a default build type if none was specified" + patch_type: "portability" diff --git a/recipes/opus/all/conanfile.py b/recipes/opus/all/conanfile.py index 548f3227f6d6e..f1ca41949ac83 100644 --- a/recipes/opus/all/conanfile.py +++ b/recipes/opus/all/conanfile.py @@ -1,7 +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, export_conandata_patches, get, rmdir -from conan.tools.microsoft import check_min_vs +from conan.tools.microsoft import check_min_vs, is_msvc, is_msvc_static_runtime +from conan.tools.env import VirtualBuildEnv +from conan.tools.scm import Version import os required_conan_version = ">=1.53.0" @@ -14,19 +17,25 @@ class OpusConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://opus-codec.org" license = "BSD-3-Clause" - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], "fixed_point": [True, False], + "stack_protector": [True, False], } default_options = { "shared": False, "fPIC": True, "fixed_point": False, + "stack_protector": True, } + def build_requirements(self): + if Version(self.version) >= "1.5.2": + self.tool_requires("cmake/[>=3.16 <4]") + def export_sources(self): export_conandata_patches(self) @@ -45,14 +54,23 @@ def layout(self): def validate(self): check_min_vs(self, 190) + if Version(self.version) >= "1.5.2" and self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "8": + raise ConanInvalidConfiguration(f"{self.ref} GCC-{self.settings.compiler.version} not supported due to lack of AVX2 support. Use GCC >=8.") def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) def generate(self): + if Version(self.version) >= "1.5.2": + env = VirtualBuildEnv(self) + env.generate() tc = CMakeToolchain(self) - tc.variables["OPUS_FIXED_POINT"] = self.options.fixed_point + tc.cache_variables["OPUS_BUILD_SHARED_LIBRARY"] = self.options.shared + tc.cache_variables["OPUS_FIXED_POINT"] = self.options.fixed_point + tc.cache_variables["OPUS_STACK_PROTECTOR"] = self.options.stack_protector + if Version(self.version) >= "1.5.2" and is_msvc(self): + tc.cache_variables["OPUS_STATIC_RUNTIME"] = is_msvc_static_runtime(self) tc.generate() def build(self): diff --git a/recipes/opus/all/test_package/conanfile.py b/recipes/opus/all/test_package/conanfile.py index 642aa7eed877c..0a6bc68712d90 100644 --- a/recipes/opus/all/test_package/conanfile.py +++ b/recipes/opus/all/test_package/conanfile.py @@ -23,5 +23,4 @@ def build(self): def test(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") + self.run(bin_path, env="conanrun") diff --git a/recipes/opus/all/test_package/test.pcm b/recipes/opus/all/test_package/test.pcm deleted file mode 100644 index f4d71f2770637..0000000000000 Binary files a/recipes/opus/all/test_package/test.pcm and /dev/null differ diff --git a/recipes/opus/all/test_package/test_package.c b/recipes/opus/all/test_package/test_package.c index a39ea4aacd883..3da6fd100efb6 100644 --- a/recipes/opus/all/test_package/test_package.c +++ b/recipes/opus/all/test_package/test_package.c @@ -1,159 +1,13 @@ -/* Copyright (c) 2013 Jean-Marc Valin */ -/* - 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. - - 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. -*/ - -/* This is meant to be a simple example of encoding and decoding audio - using Opus. It should make it easy to understand how the Opus API - works. For more information, see the full API documentation at: - https://www.opus-codec.org/docs/ */ - -#include -#include -#include -#include #include +#include -/*The frame size is hardcoded for this sample code but it doesn't have to be*/ -#define FRAME_SIZE 960 -#define SAMPLE_RATE 48000 -#define CHANNELS 2 -#define APPLICATION OPUS_APPLICATION_AUDIO -#define BITRATE 64000 - -#define MAX_FRAME_SIZE 6*960 -#define MAX_PACKET_SIZE (3*1276) - -int main(int argc, char **argv) -{ - char *inFile; - FILE *fin; - char *outFile; - FILE *fout; - opus_int16 in[FRAME_SIZE*CHANNELS]; - opus_int16 out[MAX_FRAME_SIZE*CHANNELS]; - unsigned char cbits[MAX_PACKET_SIZE]; - int nbBytes; - /*Holds the state of the encoder and decoder */ - OpusEncoder *encoder; - OpusDecoder *decoder; - int err; - - if (argc != 3) - { - fprintf(stderr, "usage: trivial_example input.pcm output.pcm\n"); - fprintf(stderr, "input and output are 16-bit little-endian raw files\n"); - return EXIT_FAILURE; - } - - /*Create a new encoder state */ - encoder = opus_encoder_create(SAMPLE_RATE, CHANNELS, APPLICATION, &err); - if (err<0) - { - fprintf(stderr, "failed to create an encoder: %s\n", opus_strerror(err)); - return EXIT_FAILURE; - } - /* Set the desired bit-rate. You can also set other parameters if needed. - The Opus library is designed to have good defaults, so only set - parameters you know you need. Doing otherwise is likely to result - in worse quality, but better. */ - err = opus_encoder_ctl(encoder, OPUS_SET_BITRATE(BITRATE)); - if (err<0) - { - fprintf(stderr, "failed to set bitrate: %s\n", opus_strerror(err)); - return EXIT_FAILURE; - } - inFile = argv[1]; - fin = fopen(inFile, "r"); - if (fin==NULL) - { - fprintf(stderr, "failed to open input file: %s\n", strerror(errno)); - return EXIT_FAILURE; - } - - - /* Create a new decoder state. */ - decoder = opus_decoder_create(SAMPLE_RATE, CHANNELS, &err); - if (err<0) - { - fprintf(stderr, "failed to create decoder: %s\n", opus_strerror(err)); - return EXIT_FAILURE; - } - outFile = argv[2]; - fout = fopen(outFile, "w"); - if (fout==NULL) - { - fprintf(stderr, "failed to open output file: %s\n", strerror(errno)); - return EXIT_FAILURE; - } - - while (!feof(fin)) - { - int i; - unsigned char pcm_bytes[MAX_FRAME_SIZE*CHANNELS*2]; - int frame_size; - - /* Read a 16 bits/sample audio frame. */ - fread(pcm_bytes, sizeof(short)*CHANNELS, FRAME_SIZE, fin); - - /* Convert from little-endian ordering. */ - for (i=0;i>8)&0xFF; - } - /* Write the decoded audio to file. */ - fwrite(pcm_bytes, sizeof(short), frame_size*CHANNELS, fout); - } - /*Destroy the encoder state*/ - opus_encoder_destroy(encoder); - opus_decoder_destroy(decoder); - fclose(fin); - fclose(fout); - return EXIT_SUCCESS; + encoder = opus_encoder_create(rate, channels, application, &err); + opus_encoder_destroy(encoder); } diff --git a/recipes/opus/all/test_v1_package/conanfile.py b/recipes/opus/all/test_v1_package/conanfile.py index 9534054c99e3c..38f4483872d47 100644 --- a/recipes/opus/all/test_v1_package/conanfile.py +++ b/recipes/opus/all/test_v1_package/conanfile.py @@ -14,5 +14,4 @@ def build(self): def test(self): if not tools.cross_building(self): bin_path = os.path.join("bin", "test_package") - pcm_path = os.path.join(self.source_folder, os.pardir, "test_package", "test.pcm") - self.run(f"{bin_path} {pcm_path} out.pcm", run_environment=True) + self.run(bin_path, run_environment=True) diff --git a/recipes/opus/config.yml b/recipes/opus/config.yml index 59334d5077368..e9cd861cf2166 100644 --- a/recipes/opus/config.yml +++ b/recipes/opus/config.yml @@ -1,3 +1,7 @@ versions: + "1.5.2": + folder: all + "1.4": + folder: all "1.3.1": folder: all 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..e9cced5a0a16c 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): @@ -12,6 +18,7 @@ class OpusFileConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/xiph/opusfile" license = "BSD-3-Clause" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -24,118 +31,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") + self.requires("ogg/1.3.5", transitive_headers=True) + self.requires("opus/1.4", transitive_headers=True) if self.options.http: - self.requires("openssl/1.1.1q") + self.requires("openssl/[>=1.1 <4]") + + 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/2.0.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/orc/all/ConanThirdpartyToolchain.cmake b/recipes/orc/all/ConanThirdpartyToolchain.cmake new file mode 100644 index 0000000000000..7c6f64861a7cd --- /dev/null +++ b/recipes/orc/all/ConanThirdpartyToolchain.cmake @@ -0,0 +1,50 @@ +# ---------------------------------------------------------------------- +# Snappy + +find_package (Snappy REQUIRED) + +add_library (orc_snappy INTERFACE) +add_library (orc::snappy ALIAS orc_snappy) +target_link_libraries(orc_snappy INTERFACE Snappy::snappy) + +# ---------------------------------------------------------------------- +# ZLIB + +find_package (ZLIB REQUIRED) + +add_library (orc_zlib INTERFACE) +add_library (orc::zlib ALIAS orc_zlib) +target_link_libraries (orc_zlib INTERFACE ZLIB::ZLIB) + +# ---------------------------------------------------------------------- +# Zstd + +find_package (ZSTD REQUIRED) + +add_library (orc_zstd INTERFACE) +add_library (orc::zstd ALIAS orc_zstd) +target_link_libraries (orc_zstd INTERFACE + $ + $ +) + +# ---------------------------------------------------------------------- +# LZ4 + +find_package (LZ4 REQUIRED) + +add_library (orc_lz4 INTERFACE) +add_library (orc::lz4 ALIAS orc_lz4) +target_link_libraries (orc_lz4 INTERFACE + $ + $ +) + +# ---------------------------------------------------------------------- +# Protobuf + +find_package (Protobuf REQUIRED) + +add_library (orc_protobuf INTERFACE) +add_library (orc::protobuf ALIAS orc_protobuf) +target_link_libraries (orc_protobuf INTERFACE protobuf::protobuf) diff --git a/recipes/orc/all/conandata.yml b/recipes/orc/all/conandata.yml new file mode 100644 index 0000000000000..4a8dd075c4c10 --- /dev/null +++ b/recipes/orc/all/conandata.yml @@ -0,0 +1,10 @@ +sources: + "2.0.3": + url: "https://archive.apache.org/dist/orc/orc-2.0.3/orc-2.0.3.tar.gz" + sha256: "082cba862b5a8a0d14c225404d0b51cd8d1b64ca81b8f1e500322ce8922cb86d" + "2.0.0": + url: "https://archive.apache.org/dist/orc/orc-2.0.0/orc-2.0.0.tar.gz" + sha256: "9107730919c29eb39efaff1b9e36166634d1d4d9477e5fee76bfd6a8fec317df" + "1.9.5": + url: "https://archive.apache.org/dist/orc/orc-1.9.5/orc-1.9.5.tar.gz" + sha256: "6900b4e8a2e4e49275f4067bd0f838ad68330204305fd3f13a5ec519e9d71547" diff --git a/recipes/orc/all/conanfile.py b/recipes/orc/all/conanfile.py new file mode 100644 index 0000000000000..8ffc69bfa533d --- /dev/null +++ b/recipes/orc/all/conanfile.py @@ -0,0 +1,148 @@ +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, cmake_layout +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import copy, get, rmdir, replace_in_file, mkdir +from conan.tools.scm import Version + +required_conan_version = ">=2.1" + +class OrcRecipe(ConanFile): + name = "orc" + description = "ORC is a self-describing type-aware columnar file format designed for Hadoop workloads" + license = "Apache-2.0" + homepage = "https://orc.apache.org/" + url = "https://github.com/conan-io/conan-center-index" + topics = ("orc", "columnar", "file-format", "hadoop") + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "build_tools": [True, False], + "build_avx512": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "build_tools": False, + "build_avx512": 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", + } + + @property + def _should_patch_thirdparty_toolchain(self): + return self.version < "2.0.0" + + def export_sources(self): + if self._should_patch_thirdparty_toolchain: + copy(self, "ConanThirdpartyToolchain.cmake", + self.recipe_folder, os.path.join(self.export_sources_folder, "src", "cmake_modules")) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + if self.settings.compiler == "apple-clang": + # AVX support is not enabled by default, might need to add -mavx512f to CXXFLAGS + del self.options.build_avx512 + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src", build_folder="build") + + def requirements(self): + self.requires("protobuf/3.21.12") + self.requires("lz4/1.9.4") + self.requires("snappy/1.1.9") + self.requires("zlib/[>=1.2.11 <2]") + self.requires("zstd/[~1.5]") + + def validate(self): + 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 build_requirements(self): + self.tool_requires("protobuf/") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + self._patch_sources() + + def generate(self): + VirtualBuildEnv(self).generate() + VirtualRunEnv(self).generate(scope="build") + + tc = CMakeToolchain(self) + tc.variables["ORC_PACKAGE_KIND"] = "conan" + tc.variables["BUILD_JAVA"] = False + tc.variables["BUILD_CPP_TESTS"] = False + tc.variables["BUILD_TOOLS"] = self.options.build_tools + tc.variables["BUILD_LIBHDFSPP"] = False + tc.variables["BUILD_POSITION_INDEPENDENT_LIB"] = bool(self.options.get_safe("fPIC", True)) + tc.variables["INSTALL_VENDORED_LIBS"] = False + # AVX512 support is determined by ORC_USER_SIMD_LEVEL env var at runtime, defaults to off + tc.variables["BUILD_ENABLE_AVX512"] = self.options.get_safe("build_avx512", False) + tc.variables["STOP_BUILD_ON_WARNING"] = False + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + + protoc_path = os.path.join(self.dependencies["protobuf"].cpp_info.bindir, "protoc") + tc.variables["PROTOBUF_EXECUTABLE"] = protoc_path.replace("\\", "/") + tc.variables["HAS_POST_2038"] = self.settings.os != "Windows" + tc.variables["HAS_PRE_1970"] = self.settings.os != "Windows" + tc.generate() + + deps = CMakeDeps(self) + deps.generate() + + def _patch_sources(self): + if self._should_patch_thirdparty_toolchain: + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "ThirdpartyToolchain", "ConanThirdpartyToolchain") + # Allow shared builds + replace_in_file(self, os.path.join(self.source_folder, "c++", "src", "CMakeLists.txt"), + "add_library (orc STATIC ${SOURCE_FILES})", "add_library (orc ${SOURCE_FILES})") + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + copy(self, "NOTICE", self.source_folder, 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" and self.options.shared: + mkdir(self, os.path.join(self.package_folder, "bin")) + os.rename(os.path.join(self.package_folder, "lib", "orc.dll"), + os.path.join(self.package_folder, "bin", "orc.dll")) + + def package_info(self): + self.cpp_info.libs = ["orc"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs = ["pthread", "m"] diff --git a/recipes/orc/all/test_package/CMakeLists.txt b/recipes/orc/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..620d40236f2e4 --- /dev/null +++ b/recipes/orc/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(orc REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE orc::orc) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/orc/all/test_package/conanfile.py b/recipes/orc/all/test_package/conanfile.py new file mode 100644 index 0000000000000..594384bd24a75 --- /dev/null +++ b/recipes/orc/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 = "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): + cmd = os.path.join(self.cpp.build.bindir, "test_package") + self.run(cmd, env="conanrun") diff --git a/recipes/orc/all/test_package/test_package.cpp b/recipes/orc/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..ba9153b830bac --- /dev/null +++ b/recipes/orc/all/test_package/test_package.cpp @@ -0,0 +1,8 @@ +#include +#include + +int main() { + auto orcType = orc::Type::buildTypeFromString("struct"); + std::cout << orcType->toString() << std::endl; + return 0; +} diff --git a/recipes/orc/config.yml b/recipes/orc/config.yml new file mode 100644 index 0000000000000..692bfaffff862 --- /dev/null +++ b/recipes/orc/config.yml @@ -0,0 +1,7 @@ +versions: + "2.0.3": + folder: all + "2.0.0": + folder: all + "1.9.5": + folder: all diff --git a/recipes/orcania/all/conandata.yml b/recipes/orcania/all/conandata.yml index a6c92d3317bea..b3d67d34849da 100644 --- a/recipes/orcania/all/conandata.yml +++ b/recipes/orcania/all/conandata.yml @@ -1,8 +1,15 @@ sources: + "2.3.3": + url: "https://github.com/babelouest/orcania/archive/refs/tags/v2.3.3.tar.gz" + sha256: "e26947f7622acf3660b71fb8018ee791c97376530ab6c4a00e4aa2775e052626" "2.3.1": url: "https://github.com/babelouest/orcania/archive/refs/tags/v2.3.1.tar.gz" sha256: "bbf08d563528b8ab88dd4b0e67aeb4e7c4fc9f19dcd1a0346b773cf492f7612b" patches: + "2.3.3": + - patch_file: "patches//2.3.3-0001-getopt-for-msvc.patch" + patch_description: "fubd_package getopt-for-visual-studio for MSVC" + patch_type: "portability" "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" diff --git a/recipes/orcania/all/patches/2.3.3-0001-getopt-for-msvc.patch b/recipes/orcania/all/patches/2.3.3-0001-getopt-for-msvc.patch new file mode 100644 index 0000000000000..eea0c3aaeeacf --- /dev/null +++ b/recipes/orcania/all/patches/2.3.3-0001-getopt-for-msvc.patch @@ -0,0 +1,15 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 44c7299..7421f49 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -202,6 +202,10 @@ if (BUILD_BASE64URL) + target_link_libraries(base64url PRIVATE ${orcania_lib}) + 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 PRIVATE getopt-for-visual-studio::getopt-for-visual-studio) ++ endif() + endif () + + # tests diff --git a/recipes/orcania/config.yml b/recipes/orcania/config.yml index 215bc57fe4993..12ddc838534be 100644 --- a/recipes/orcania/config.yml +++ b/recipes/orcania/config.yml @@ -1,3 +1,5 @@ versions: + "2.3.3": + folder: all "2.3.1": folder: all diff --git a/recipes/osgearth/all/conanfile.py b/recipes/osgearth/all/conanfile.py index 5e59c1a6652d9..1cbcbea3d337a 100644 --- a/recipes/osgearth/all/conanfile.py +++ b/recipes/osgearth/all/conanfile.py @@ -105,13 +105,13 @@ def requirements(self): self.requires("opengl/system") self.requires("gdal/3.4.3") self.requires("openscenegraph/3.6.5") - self.requires("libcurl/7.83.1") + self.requires("libcurl/8.2.0") self.requires("lerc/2.2") self.requires("rapidjson/1.1.0") - self.requires("zlib/1.2.12", override=True) - self.requires("libtiff/4.3.0", override=True) - self.requires("openssl/1.1.1l", override=True) + self.requires("zlib/[>=1.2.11 <2]") # override + self.requires("libtiff/4.5.1") # override + self.requires("libpng/1.6.40") # override # if self.options.build_triton_nodekit: # self.requires("triton_nodekit") @@ -120,13 +120,13 @@ def requirements(self): if self.options.build_leveldb_cache: self.requires("leveldb/1.22") if self.options.build_rocksdb_cache: - self.requires("rocksdb/6.20.3") + self.requires("rocksdb/6.29.5") if self.options.build_zip_plugin: - self.requires("zstd/1.4.9") # override + self.requires("zstd/1.5.5") # override if self.options.with_geos: - self.requires("geos/3.10.2") + self.requires("geos/3.11.1") if self.options.with_sqlite3: - self.requires("sqlite3/3.38.5") + self.requires("sqlite3/3.42.0") if self.options.with_draco: self.requires("draco/1.4.3") # if self.options.with_basisu: @@ -134,9 +134,9 @@ def requirements(self): # if self.options.with_glew: # self.requires("glew/2.2.0") if self.options.with_protobuf: - self.requires("protobuf/3.17.1") + self.requires("protobuf/3.21.9") if self.options.with_webp: - self.requires("libwebp/1.2.0") + self.requires("libwebp/1.3.1") def _patch_sources(self): for patch in self.conan_data.get("patches", {}).get(self.version, []): diff --git a/recipes/osmanip/all/CMakeLists.txt b/recipes/osmanip/all/CMakeLists.txt index ae515532d7df7..a8dff1c7823ce 100644 --- a/recipes/osmanip/all/CMakeLists.txt +++ b/recipes/osmanip/all/CMakeLists.txt @@ -1,33 +1,39 @@ -cmake_minimum_required(VERSION 3.13) +cmake_minimum_required(VERSION 3.15) project(osmanip LANGUAGES CXX) find_package(arsenalgear REQUIRED CONFIG) add_library(osmanip) target_sources(osmanip PRIVATE - ${OSMANIP_SRC_DIR}/src/graphics/canvas.cpp - ${OSMANIP_SRC_DIR}/src/graphics/plot_2D.cpp + src/graphics/canvas.cpp + src/graphics/plot_2D.cpp + $<$: + src/utility/iostream.cpp + src/utility/output_redirector.cpp + src/utility/sstream.cpp + src/utility/strings.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 + src/manipulators/colsty.cpp + src/manipulators/common.cpp + src/manipulators/cursor.cpp + 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 + src/manipulators/colsty.cpp + src/manipulators/common.cpp + src/manipulators/cursor.cpp + src/manipulators/printer.cpp > $<$: - ${OSMANIP_SRC_DIR}/src/manipulators/csmanip.cpp + src/manipulators/csmanip.cpp > $<$: - ${OSMANIP_SRC_DIR}/src/progressbar/progress_bar.cpp + src/progressbar/progress_bar.cpp > - ${OSMANIP_SRC_DIR}/src/utility/windows.cpp + src/utility/windows.cpp ) -target_include_directories(osmanip PUBLIC ${OSMANIP_SRC_DIR}/include/) +target_include_directories(osmanip PUBLIC include/) target_compile_features(osmanip PUBLIC cxx_std_17) set_target_properties(osmanip PROPERTIES PUBLIC_HEADER "${osmanip_inc}" @@ -49,6 +55,6 @@ install( ) install( - DIRECTORY ${OSMANIP_SRC_DIR}/include/ + DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/osmanip ) diff --git a/recipes/osmanip/all/conandata.yml b/recipes/osmanip/all/conandata.yml index 02c907a3fa56b..fd06c3edca398 100644 --- a/recipes/osmanip/all/conandata.yml +++ b/recipes/osmanip/all/conandata.yml @@ -1,25 +1,13 @@ sources: + "4.6.1": + url: "https://github.com/JustWhit3/osmanip/archive/v4.6.1.tar.gz" + sha256: "5454cb0caced1fb9af90666001f2874786a33e6830024cb41c99a5b4ab966f1c" "4.4.0": - url: "https://github.com/JustWhit3/osmanip/archive/v4.3.0.tar.gz" - sha256: "e0d982d19792c3e438e3be99f789434b66788f9a7114f217b3c5f28d0121af7f" + url: "https://github.com/JustWhit3/osmanip/archive/v4.4.0.tar.gz" + sha256: "61c08255afe4fa8694771ed139d9d8a4d5edfba56ffbd25997019a41f6923314" "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" - "4.0.0": - url: "https://github.com/JustWhit3/osmanip/archive/refs/tags/v4.0.0.tar.gz" - sha256: "c6848e1d9b15eb409af88efeee7cd1ce87374ea7ac87424f5d2cf30104f098a0" - -patches: - "4.0.0": - - patch_file: "patches/0001-replace-runtime_error_func.patch" - 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 8a6899850a3b8..dfd876744d966 100644 --- a/recipes/osmanip/all/conanfile.py +++ b/recipes/osmanip/all/conanfile.py @@ -1,9 +1,10 @@ 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.files import copy, get, rmdir, replace_in_file, save +from conan.tools.scm import Version +from conan.tools.microsoft import is_msvc import os @@ -11,11 +12,15 @@ class OsmanipConan(ConanFile): name = "osmanip" - description = "Library with useful output stream tools like: color and style manipulators, progress bars and terminal graphics." + description = ( + "Library with useful output stream tools like: color and style " + "manipulators, progress bars and terminal graphics." + ) license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/JustWhit3/osmanip" topics = ("manipulator", "iostream", "output-stream", "iomanip") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -27,8 +32,8 @@ class OsmanipConan(ConanFile): } def export_sources(self): - copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder) - export_conandata_patches(self) + if Version(self.version) < "4.5.0": + copy(self, "CMakeLists.txt", self.recipe_folder, os.path.join(self.export_sources_folder, "src")) def config_options(self): if self.settings.os == "Windows": @@ -38,64 +43,83 @@ 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.80.0") - if Version(self.version) < "4.2.0": - self.requires("arsenalgear/1.2.2") - else: - self.requires("arsenalgear/2.0.1") + # https://github.com/JustWhit3/osmanip/commit/43c8bd8d018fcb3bce6443f7388e042d5457d4fb + if Version(self.version) < "4.6.0": + # osmanip/progressbar/progress_bar.hpp includes arsenalgear/constants.hpp + self.requires("arsenalgear/2.1.1", transitive_headers=True) @property - def _minimum_cpp_standard(self): + def _min_cppstd(self): return 17 @property def _compiler_required_cpp17(self): return { - "Visual Studio": "16", + "Visual Studio": "15", "msvc": "191", "gcc": "8", "clang": "7", - "apple-clang": "12.0", + "apple-clang": "12", } def validate(self): - if self.info.settings.get_safe("compiler.cppstd"): - check_min_cppstd(self, self._minimum_cpp_standard) + if self.settings.get_safe("compiler.cppstd"): + check_min_cppstd(self, self._min_cppstd) - minimum_version = self._compiler_required_cpp17.get(str(self.info.settings.compiler), False) - if minimum_version: - 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(f"{self.ref} requires C++{self._minimum_cpp_standard}. Your compiler is unknown. Assuming it supports C++{self._minimum_cpp_standard}") + minimum_version = self._compiler_required_cpp17.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): - cmake_layout(self, src_folder="src") + if Version(self.version) >= "4.4.0" and self.settings.get_safe("compiler.libcxx") == "libstdc++": + # test_package segfaults with libstdc++ for some reason + raise ConanInvalidConfiguration("osmanip >= 4.4.0 doesn't support libstdc++") + + if is_msvc(self): + raise ConanInvalidConfiguration("MSVC is not yet supported by osmanip recipe. Contributions are welcome.") 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["OSMANIP_VERSION"] = str(self.version) - tc.variables["OSMANIP_SRC_DIR"] = self.source_folder.replace("\\", "/") + if Version(self.version) < "4.5.0": + tc.variables["OSMANIP_VERSION"] = str(self.version) + else: + tc.variables["OSMANIP_TESTS"] = False + tc.variables["FORMAT"] = False + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True tc.generate() deps = CMakeDeps(self) deps.generate() + def _patch_sources(self): + if Version(self.version) >= "4.5.0": + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + " STATIC ", " ") + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + " DESTINATION lib\n", + " RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib\n") + save(self, os.path.join(self.source_folder, "examples", "CMakeLists.txt"), "") + save(self, os.path.join(self.source_folder, "deps", "doctest", "CMakeLists.txt"), "") + def build(self): - apply_conandata_patches(self) + self._patch_sources() cmake = CMake(self) - cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) + 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 = ["osmanip"] diff --git a/recipes/osmanip/all/patches/0001-replace-runtime_error_func.patch b/recipes/osmanip/all/patches/0001-replace-runtime_error_func.patch deleted file mode 100644 index 8b8b155a0e865..0000000000000 --- a/recipes/osmanip/all/patches/0001-replace-runtime_error_func.patch +++ /dev/null @@ -1,102 +0,0 @@ -diff --git a/src/manipulators/csmanip.cpp b/src/manipulators/csmanip.cpp -index 064c7ba..6363226 100644 ---- a/src/manipulators/csmanip.cpp -+++ b/src/manipulators/csmanip.cpp -@@ -208,7 +208,7 @@ namespace osm - { - if( generic_map.find( feat_string ) == generic_map.end() ) - { -- throw agr::runtime_error_func( generic_map.at( "error" ), feat_string, "is not supported!" ); -+ throw agr::except_error_func( generic_map.at( "error" ), feat_string, "is not supported!" ); - } - return generic_map.at( feat_string ); - } -@@ -228,7 +228,7 @@ namespace osm - { - if( generic_map.find( feat_string ) == generic_map.end() ) - { -- throw agr::runtime_error_func( generic_map.at( "error" ).first, feat_string, "is not supported!" ); -+ throw agr::except_error_func( generic_map.at( "error" ).first, feat_string, "is not supported!" ); - } - else - { -@@ -255,7 +255,7 @@ namespace osm - { - if( rst.find( reset_string ) == rst.end() ) - { -- throw agr::runtime_error_func( rst.at( "error" ), reset_string, "is not supported!" ); -+ throw agr::except_error_func( rst.at( "error" ), reset_string, "is not supported!" ); - } - return rst.at( reset_string ); - } -@@ -295,4 +295,4 @@ namespace osm - std::to_string( g ) + ";"s + - std::to_string( b ) + "m"s; - } -- } -\ No newline at end of file -+ } -diff --git a/src/progressbar/progress_bar.cpp b/src/progressbar/progress_bar.cpp -index 485009f..b12aee4 100644 ---- a/src/progressbar/progress_bar.cpp -+++ b/src/progressbar/progress_bar.cpp -@@ -163,16 +163,16 @@ namespace osm - } - else if( styles_map_.at( type ).find( style ) == styles_map_.at( type ).end() ) - { -- throw agr::runtime_error_func( "Inserted ProgressBar style", style, "is not supported for this type!" ); -+ throw agr::except_error_func( "Inserted ProgressBar style", style, "is not supported for this type!" ); - } - else - { -- throw agr::runtime_error_func( "Inserted ProgressBar type", type, "is not supported!" ); -+ throw agr::except_error_func( "Inserted ProgressBar type", type, "is not supported!" ); - } - } - catch ( std::out_of_range const& exception ) - { -- throw agr::runtime_error_func( "Inserted ProgressBar type", type, "is not supported!" ); -+ throw agr::except_error_func( "Inserted ProgressBar type", type, "is not supported!" ); - } - } - -@@ -201,15 +201,15 @@ namespace osm - } - else if( styles_map_.at( "indicator" ).find( style_p ) == styles_map_.at( "indicator" ).end() ) - { -- throw agr::runtime_error_func( "Inserted indicator style", style_p, "is not supported for this type!" ); -+ throw agr::except_error_func( "Inserted indicator style", style_p, "is not supported for this type!" ); - } - else if( styles_map_.at( "loader" ).find( style_l ) == styles_map_.at( "loader" ).end() ) - { -- throw agr::runtime_error_func( "Inserted loader style", style_l, "is not supported for this type!" ); -+ throw agr::except_error_func( "Inserted loader style", style_l, "is not supported for this type!" ); - } - else - { -- throw agr::runtime_error_func( "Inserted ProgressBar type", type, "is not supported!" ); -+ throw agr::except_error_func( "Inserted ProgressBar type", type, "is not supported!" ); - } - } - -@@ -834,11 +834,11 @@ namespace osm - } - else if( styles_map_.at( type ).find( style ) != styles_map_.at( type ).end() ) - { -- throw agr::runtime_error_func( "Inserted ProgressBar style", style, "is already available!" ); -+ throw agr::except_error_func( "Inserted ProgressBar style", style, "is already available!" ); - } - else - { -- throw agr::runtime_error_func( "Inserted ProgressBar type", type, "is already available!" ); -+ throw agr::except_error_func( "Inserted ProgressBar type", type, "is already available!" ); - } - } - -@@ -869,4 +869,4 @@ namespace osm - * - */ - BOOST_PP_SEQ_FOR_EACH( PROGRESSBAR, _, ARGS( int, long, long long, double, long double, float ) ); -- } -\ No newline at end of file -+ } diff --git a/recipes/osmanip/all/test_package/test_package.cpp b/recipes/osmanip/all/test_package/test_package.cpp index 40b8aeea9e04b..fd39db19a8533 100644 --- a/recipes/osmanip/all/test_package/test_package.cpp +++ b/recipes/osmanip/all/test_package/test_package.cpp @@ -2,7 +2,6 @@ // https://github.com/JustWhit3/osmanip/blob/v4.0.0/examples/progressbar.cpp // My headers -#include "osmanip/progressbar/multi_progress_bar.hpp" #include "osmanip/progressbar/progress_bar.hpp" #ifdef _WIN32 #include "osmanip/utility/windows.hpp" @@ -14,9 +13,7 @@ #endif // STD headers -#include #include -#include //==================================================== // Percentage bar @@ -40,56 +37,10 @@ perc_bars() { std::cout << "This is a normal percentage bar: " << "\n"; for (int i = percentage_bar.getMin(); i < percentage_bar.getMax(); i++) { - std::this_thread::sleep_for(std::chrono::milliseconds(1)); percentage_bar.update(i); // Do some operations... } std::cout << "\n\n"; - - // Percentage bar with message and different style: - osm::ProgressBar percentage_bar_2(1.2f, 4.4f); - percentage_bar_2.setMessage("processing..."); - percentage_bar_2.setStyle("indicator", "/100"); - - std::cout << "This is a percentage bar with message and the /100 style: " - << "\n"; - for (float i = percentage_bar_2.getMin(); i < percentage_bar_2.getMax(); i += 0.1f) { - std::this_thread::sleep_for(std::chrono::milliseconds(1)); - percentage_bar_2.update(i); - // Do some operations... - } - std::cout << "\n\n"; - - // Percentage bar with time consuming info: - percentage_bar.resetMessage(); - percentage_bar.setStyle("indicator", "%"); - - std::cout << "This is a percentage bar with time consuming info: " - << "\n"; - for (int i = percentage_bar.getMin(); i < percentage_bar.getMax(); i++) { - percentage_bar.setBegin(); - std::this_thread::sleep_for(std::chrono::milliseconds(1)); - percentage_bar.update(i); - // Do some operations... - percentage_bar.setEnd(); - } - std::cout << "\n" - << "Time needed to complete the previous loop: " << percentage_bar.getTime() << " ms." - << "\n\n"; - - // Percentage bar with estimated time left: - percentage_bar.setMin(2); - percentage_bar.setMax(121); - percentage_bar.setRemainingTimeFlag("on"); - percentage_bar.resetRemainingTime(); - - std::cout << "This is a percentage bar with time-remaining info: " - << "\n"; - for (int i = percentage_bar.getMin(); i < percentage_bar.getMax(); i++) { - std::this_thread::sleep_for(std::chrono::milliseconds(1)); - percentage_bar.update(i); - // Do some operations... - } std::cout << "\n\n"; } diff --git a/recipes/osmanip/all/test_v1_package/CMakeLists.txt b/recipes/osmanip/all/test_v1_package/CMakeLists.txt index fbf268aae5e4a..426dbc1aa18df 100644 --- a/recipes/osmanip/all/test_v1_package/CMakeLists.txt +++ b/recipes/osmanip/all/test_v1_package/CMakeLists.txt @@ -5,8 +5,5 @@ 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/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE osmanip::osmanip) -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/osmanip/config.yml b/recipes/osmanip/config.yml index 50f7633ad31f3..2b2e483c60d7b 100644 --- a/recipes/osmanip/config.yml +++ b/recipes/osmanip/config.yml @@ -1,13 +1,9 @@ versions: + "4.6.1": + folder: all "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": - folder: all diff --git a/recipes/osqp/all/conandata.yml b/recipes/osqp/all/conandata.yml new file mode 100644 index 0000000000000..fa2a0f2f4400c --- /dev/null +++ b/recipes/osqp/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "0.6.3": + url: "https://github.com/osqp/osqp/releases/download/v0.6.3/osqp-v0.6.3-src.tar.gz" + sha256: "285b2a60f68d113a1090767ec8a9c81a65b3af2d258f8c78a31cc3f98ba58456" + "0.6.2": + url: "https://github.com/osqp/osqp/releases/download/v0.6.2/complete_sources.tar.gz" + sha256: "0a7ade2fa19f13e13bc12f6ea0046ef764049023efb4997a4e72a76534f623ec" diff --git a/recipes/osqp/all/conanfile.py b/recipes/osqp/all/conanfile.py new file mode 100644 index 0000000000000..2aff16badac04 --- /dev/null +++ b/recipes/osqp/all/conanfile.py @@ -0,0 +1,96 @@ +from conan import ConanFile +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 OsqpConan(ConanFile): + name = "osqp" + package_type = "library" + description = "The OSQP (Operator Splitting Quadratic Program) solver is a numerical optimization package." + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://osqp.org/" + topics = ("machine-learning", "control", "optimization", "svm", "solver", "lasso", "portfolio-optimization", + "numerical-optimization", "quadratic-programming", "convex-optimization", "model-predictive-control") + 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): + strip_root = self.version == "0.6.2" + get(self, **self.conan_data["sources"][self.version], strip_root=strip_root) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables['UNITTESTS'] = not self.conf.get("tools.build:skip_test", default=True, check_type=bool) + tc.variables["PRINTING"] = True + tc.variables["PROFILING"] = True + tc.variables["CTRLC"] = True + tc.variables["DFLOAT"] = False + tc.variables["DLONG"] = True + tc.variables["COVERAGE"] = False + tc.variables["ENABLE_MKL_PARDISO"] = True + 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() + + if self.settings.os == "Windows": + if self.options.shared: + rm(self, "qdldl.dll", os.path.join(self.package_folder, "bin")) + else: + rmdir(self, os.path.join(self.package_folder, "bin")) + else: + if self.options.shared: + rm(self, "*.a", os.path.join(self.package_folder, "lib")) + else: + rm(self, "*.so", os.path.join(self.package_folder, "lib")) + rm(self, "*.dylib", 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, "include", "qdldl")) + rm(self, "*qdldl.*", os.path.join(self.package_folder, "lib")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "osqp") + self.cpp_info.set_property("cmake_target_name", "osqp::osqp") + self.cpp_info.libs = ["osqp"] + + 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("dl") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "osqp" + self.cpp_info.filenames["cmake_find_package_multi"] = "osqp" + self.cpp_info.names["cmake_find_package"] = "osqp" + self.cpp_info.names["cmake_find_package_multi"] = "osqp" diff --git a/recipes/osqp/all/test_package/CMakeLists.txt b/recipes/osqp/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..e2ad808df3b71 --- /dev/null +++ b/recipes/osqp/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package CXX) + +find_package(osqp REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE osqp::osqp) diff --git a/recipes/osqp/all/test_package/conanfile.py b/recipes/osqp/all/test_package/conanfile.py new file mode 100644 index 0000000000000..1111583fea732 --- /dev/null +++ b/recipes/osqp/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/osqp/all/test_package/test_package.cpp b/recipes/osqp/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..c966b1083c67d --- /dev/null +++ b/recipes/osqp/all/test_package/test_package.cpp @@ -0,0 +1,69 @@ +/** + * Below is a demo copied from an upstream example code, + * It shows how to setup and solve an optimization problem. + * Source code: https://github.com/osqp/osqp/blob/master/examples/osqp_demo.c + * Problem definition: https://osqp.org/docs/examples/setup-and-solve.html +*/ +#include "osqp/osqp.h" + + +int main(void) { + // Load problem data + c_float P_x[3] = {4.0, 1.0, 2.0, }; + c_int P_nnz = 3; + c_int P_i[3] = {0, 0, 1, }; + c_int P_p[3] = {0, 1, 3, }; + c_float q[2] = {1.0, 1.0, }; + c_float A_x[4] = {1.0, 1.0, 1.0, 1.0, }; + c_int A_nnz = 4; + c_int A_i[4] = {0, 1, 0, 2, }; + c_int A_p[3] = {0, 2, 4, }; + c_float l[3] = {1.0, 0.0, 0.0, }; + c_float u[3] = {1.0, 0.7, 0.7, }; + c_int n = 2; + c_int m = 3; + + // Exitflag + c_int exitflag = 0; + + // Workspace structures + OSQPWorkspace *work; + OSQPSettings *settings = (OSQPSettings *)c_malloc(sizeof(OSQPSettings)); + OSQPData *data = (OSQPData *)c_malloc(sizeof(OSQPData)); + + // Populate data + if (data) { + data->n = n; + data->m = m; + data->P = csc_matrix(data->n, data->n, P_nnz, P_x, P_i, P_p); + data->q = q; + data->A = csc_matrix(data->m, data->n, A_nnz, A_x, A_i, A_p); + data->l = l; + data->u = u; + } + + // Define solver settings as default + if (settings) { + osqp_set_default_settings(settings); + settings->alpha = 1.0; // Change alpha parameter + } + + // Setup workspace + exitflag = osqp_setup(&work, data, settings); + + // Solve Problem + osqp_solve(work); + + // Cleanup + osqp_cleanup(work); + if (data) { + if (data->A) c_free(data->A); + if (data->P) c_free(data->P); + c_free(data); + } + if (settings) c_free(settings); + + return exitflag; + + return EXIT_SUCCESS; +} diff --git a/recipes/osqp/all/test_v1_package/CMakeLists.txt b/recipes/osqp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/osqp/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/osqp/all/test_v1_package/conanfile.py b/recipes/osqp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..c492184eec19c --- /dev/null +++ b/recipes/osqp/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/osqp/config.yml b/recipes/osqp/config.yml new file mode 100644 index 0000000000000..5adc30b2f3c24 --- /dev/null +++ b/recipes/osqp/config.yml @@ -0,0 +1,5 @@ +versions: + "0.6.3": + folder: all + "0.6.2": + folder: all diff --git a/recipes/ouster_sdk/all/conandata.yml b/recipes/ouster_sdk/all/conandata.yml new file mode 100644 index 0000000000000..47f1fc2c3a180 --- /dev/null +++ b/recipes/ouster_sdk/all/conandata.yml @@ -0,0 +1,24 @@ +sources: + "0.13.0": + url: "https://github.com/ouster-lidar/ouster-sdk/archive/refs/tags/release-0.13.0.tar.gz" + sha256: "baf65fbf547375fe73fdaee89c6c1246fdf9f0cabe4f4bd16391d3a06d0117a1" + "0.12.0": + url: "https://github.com/ouster-lidar/ouster-sdk/archive/refs/tags/20240703.tar.gz" + sha256: "7edff33451e99fe094aeafc4c10081d77bfe02d2f2ab16da93a44a5e61473af7" + "0.11.0": + url: "https://github.com/ouster-lidar/ouster-sdk/archive/refs/tags/20240425.tar.gz" + sha256: "8141abf4caef8a175a48c35c47bd841b34f8a7d758cb3ad66cf948a7042adbf9" + "0.10.0": + url: "https://github.com/ouster-lidar/ouster-sdk/archive/refs/tags/20231031.tar.gz" + sha256: "c45dfd42ff11e171b605ffd0a98d8094ec88ecbbccb923d396e1e73cba7737f3" +patches: + "0.11.0": + - patch_file: "patches/001-579-fix-cpp20-string-error.patch" + patch_type: "portability" + patch_description: "Fix non-const string issue with C++20" + patch_source: "https://github.com/ouster-lidar/ouster-sdk/pull/579" + "0.10.0": + - patch_file: "patches/001-579-fix-cpp20-string-error.patch" + patch_type: "portability" + patch_description: "Fix non-const string issue with C++20" + patch_source: "https://github.com/ouster-lidar/ouster-sdk/pull/579" diff --git a/recipes/ouster_sdk/all/conanfile.py b/recipes/ouster_sdk/all/conanfile.py new file mode 100644 index 0000000000000..7362559ac775c --- /dev/null +++ b/recipes/ouster_sdk/all/conanfile.py @@ -0,0 +1,219 @@ +import os + +from conan import ConanFile, conan_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.env import VirtualBuildEnv +from conan.tools.files import get, copy, rmdir, rm, save, replace_in_file, export_conandata_patches, apply_conandata_patches +from conan.tools.scm import Version + +required_conan_version = ">=1.60.0 <2.0 || >=2.0.6" + +class OusterSdkConan(ConanFile): + name = "ouster_sdk" + description = "Ouster SDK - tools for working with Ouster Lidars" + license = "BSD 3-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/ouster-lidar/ouster-sdk" + topics = ("ouster", "lidar", "driver", "hardware", "point cloud", "3d", "robotics", "automotive") + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "build_osf": [True, False], + "build_pcap": [True, False], + "build_viz": [True, False], + "eigen_max_align_bytes": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "build_osf": True, + "build_pcap": True, + "build_viz": False, + "eigen_max_align_bytes": False, + } + options_description = { + "build_osf": "Build Ouster OSF library.", + "build_pcap": "Build pcap utils.", + "build_viz": "Build Ouster visualizer.", + "eigen_max_align_bytes": "Force maximum alignment of Eigen data to 32 bytes.", + } + + @property + def _min_cppstd(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "7", + "clang": "5", + "apple-clang": "10", + "msvc": "191", + "Visual Studio": "15", + } + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + if conan_version.major == 1: + # Turning off by default due to perpetually missing libtins binaries on CCI + self.options.build_pcap = False + self.options.build_osf = False + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + # Used in ouster/types.h + self.requires("eigen/3.4.0", transitive_headers=True) + # Used in ouster/sensor_http.h + self.requires("jsoncpp/1.9.5", transitive_headers=True, transitive_libs=True) + self.requires("spdlog/1.13.0") + self.requires("fmt/10.2.1") + self.requires("libcurl/[>=7.78 <9]") + # Replaces vendored optional-lite + self.requires("optional-lite/3.6.0", transitive_headers=True) + + if self.options.build_pcap: + self.requires("libtins/4.5") + + if self.options.build_osf: + # Used in fb_generated/*.h + self.requires("flatbuffers/24.3.7", transitive_headers=True) + self.requires("libpng/[>=1.6 <2]") + self.requires("zlib/[>=1.2.11 <2]", transitive_libs=True) + + if self.options.build_viz: + self.requires("glad/0.1.36") + self.requires("glfw/3.4") + + def validate(self): + if conan_version.major < 2 and self.settings.os == "Windows": + raise ConanInvalidConfiguration("Windows builds require Conan >= 2.0") + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + minimum_version = self._compilers_minimum_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 self.options.build_osf and not self.options.build_pcap: + raise ConanInvalidConfiguration("build_osf=True requires build_pcap=True") + + if self.options.shared and self.settings.os == "Windows": + raise ConanInvalidConfiguration("Shared builds are not supported on Windows") + + def build_requirements(self): + if self.options.build_osf: + self.tool_requires("flatbuffers/") + + 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.variables["BUILD_VIZ"] = self.options.build_viz + tc.variables["BUILD_PCAP"] = self.options.build_pcap + tc.variables["BUILD_OSF"] = self.options.build_osf + tc.variables["OUSTER_USE_EIGEN_MAX_ALIGN_BYTES_32"] = self.options.eigen_max_align_bytes + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() + deps = CMakeDeps(self) + deps.set_property("flatbuffers", "cmake_target_name", "flatbuffers::flatbuffers") + deps.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + + # Unvendor optional-lite + rmdir(self, os.path.join(self.source_folder, "ouster_client", "include", "optional-lite")) + replace_in_file(self, os.path.join(self.source_folder, "ouster_client", "CMakeLists.txt"), + " include/optional-lite", "") + save(self, os.path.join(self.source_folder, "ouster_client", "CMakeLists.txt"), + "find_package(optional-lite REQUIRED)\n" + "target_link_libraries(ouster_client PUBLIC nonstd::optional-lite)\n", + append=True) + + # Allow non-static ouster_osf for consistency with other components + replace_in_file(self, os.path.join(self.source_folder, "ouster_osf", "CMakeLists.txt"), + "add_library(ouster_osf STATIC", "add_library(ouster_osf") + + def build(self): + self._patch_sources() + 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")) + 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("cmake_file_name", "OusterSDK") + self.cpp_info.set_property("cmake_target_name", "OusterSDK::OusterSDK") + + self.cpp_info.components["ouster_client"].set_property("cmake_target_name", "OusterSDK::ouster_client") + self.cpp_info.components["ouster_client"].libs = ["ouster_client"] + self.cpp_info.components["ouster_client"].requires = [ + "eigen::eigen", + "jsoncpp::jsoncpp", + "spdlog::spdlog", + "fmt::fmt", + "libcurl::libcurl", + "optional-lite::optional-lite", + ] + + if self.options.build_osf: + self.cpp_info.components["ouster_osf"].set_property("cmake_target_name", "OusterSDK::ouster_osf") + self.cpp_info.components["ouster_osf"].libs = ["ouster_osf"] + self.cpp_info.components["ouster_osf"].includedirs.append(os.path.join("include", "fb_generated")) + self.cpp_info.components["ouster_osf"].requires = [ + "ouster_client", + "ouster_pcap", + "flatbuffers::flatbuffers", + "libpng::libpng", + "zlib::zlib", + ] + + if self.options.build_pcap: + self.cpp_info.components["ouster_pcap"].set_property("cmake_target_name", "OusterSDK::ouster_pcap") + self.cpp_info.components["ouster_pcap"].libs = ["ouster_pcap"] + self.cpp_info.components["ouster_pcap"].requires = [ + "ouster_client", + "libtins::libtins", + ] + + if self.options.build_viz: + self.cpp_info.components["ouster_viz"].set_property("cmake_target_name", "OusterSDK::ouster_viz") + self.cpp_info.components["ouster_viz"].libs = ["ouster_viz"] + self.cpp_info.components["ouster_viz"].requires = [ + "ouster_client", + "glad::glad", + "glfw::glfw", + ] + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "OusterSDK" + self.cpp_info.filenames["cmake_find_package_multi"] = "OusterSDK" + self.cpp_info.names["cmake_find_package"] = "OusterSDK" + self.cpp_info.names["cmake_find_package_multi"] = "OusterSDK" + diff --git a/recipes/ouster_sdk/all/patches/001-579-fix-cpp20-string-error.patch b/recipes/ouster_sdk/all/patches/001-579-fix-cpp20-string-error.patch new file mode 100644 index 0000000000000..aa80f65d67d9c --- /dev/null +++ b/recipes/ouster_sdk/all/patches/001-579-fix-cpp20-string-error.patch @@ -0,0 +1,25 @@ +From b2896dee6f43733c832c3a60f09f362abe2c5e79 Mon Sep 17 00:00:00 2001 +From: Kevin Greene +Date: Fri, 23 Feb 2024 10:22:02 -0800 +Subject: [PATCH] Fix non-const string issue with C++20 + +--- + ouster_client/src/curl_client.h | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/ouster_client/src/curl_client.h b/ouster_client/src/curl_client.h +index ce3fb31d..62bcabc0 100644 +--- a/ouster_client/src/curl_client.h ++++ b/ouster_client/src/curl_client.h +@@ -89,9 +89,8 @@ class CurlClient : public ouster::util::HttpClient { + // HTTP 5XX means a server error, so we should re-attempt. + // log a warning and sleep before re-attempting + ouster::sensor::logger().warn( +- std::string("Re-attempting CurlClient::execute_get after " +- "failure for url: ") + +- "[{}] with the code: [{}] - and return: {}", ++ "Re-attempting CurlClient::execute_get after failure for " ++ "url: [{}] with the code: [{}] - and return: {}", + url, http_code, buffer); + std::this_thread::sleep_for( + std::chrono::milliseconds(retry_delay_ms)); diff --git a/recipes/ouster_sdk/all/test_package/CMakeLists.txt b/recipes/ouster_sdk/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..498c697a4f010 --- /dev/null +++ b/recipes/ouster_sdk/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) + project(test_package CXX) + +find_package(OusterSDK REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE OusterSDK::OusterSDK) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/ouster_sdk/all/test_package/conanfile.py b/recipes/ouster_sdk/all/test_package/conanfile.py new file mode 100644 index 0000000000000..57c251706a8d6 --- /dev/null +++ b/recipes/ouster_sdk/all/test_package/conanfile.py @@ -0,0 +1,36 @@ +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", "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) + if self.dependencies["ouster_sdk"].options.build_osf: + tc.preprocessor_definitions["WITH_OSF"] = "1" + if self.dependencies["ouster_sdk"].options.build_pcap: + tc.preprocessor_definitions["WITH_PCAP"] = "1" + if self.dependencies["ouster_sdk"].options.build_viz: + tc.preprocessor_definitions["WITH_VIZ"] = "1" + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/ouster_sdk/all/test_package/test_package.cpp b/recipes/ouster_sdk/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..3190406572ca4 --- /dev/null +++ b/recipes/ouster_sdk/all/test_package/test_package.cpp @@ -0,0 +1,38 @@ +#include "ouster/lidar_scan.h" + +#ifdef WITH_OSF +#include "ouster/osf/writer.h" +#endif +#ifdef WITH_PCAP +#include "ouster/os_pcap.h" +#endif +#ifdef WITH_VIZ +#include "ouster/point_viz.h" +#endif + +#include + +int main() { + size_t w = 100; + size_t h = 100; + using namespace ouster::sensor; + ouster::LidarScan scan(w, h, UDPProfileLidar::PROFILE_RNG19_RFL8_SIG16_NIR16_DUAL); + std::cout << "Successfully created a sensor::LidarScan object" << std::endl; + +#ifdef WITH_OSF + ouster::osf::Writer writer("tmp.osf"); + std::cout << "Successfully created a osf::Writer object" << std::endl; +#endif + +#ifdef WITH_PCAP + try { + ouster::sensor_utils::PcapReader pcap_reader("tmp.pcap"); + } catch (...) { } + std::cout << "Successfully created a sensor_utils::PcapReader object" << std::endl; +#endif + +#ifdef WITH_VIZ + ouster::viz::PointViz viz("Viz example"); + std::cout << "Successfully created a viz::PointViz object" << std::endl; +#endif +} diff --git a/recipes/ouster_sdk/config.yml b/recipes/ouster_sdk/config.yml new file mode 100644 index 0000000000000..4f1ab3799faec --- /dev/null +++ b/recipes/ouster_sdk/config.yml @@ -0,0 +1,9 @@ +versions: + "0.13.0": + folder: all + "0.12.0": + folder: all + "0.11.0": + folder: all + "0.10.0": + folder: all diff --git a/recipes/out_ptr/all/conanfile.py b/recipes/out_ptr/all/conanfile.py index 1e8b0f7b0dcbf..ec1798a3de6ab 100644 --- a/recipes/out_ptr/all/conanfile.py +++ b/recipes/out_ptr/all/conanfile.py @@ -13,20 +13,27 @@ class OutPtrConan(ConanFile): homepage = "https://github.com/soasis/out_ptr" description = "a C++11 implementation of std::out_ptr (p1132), as a standalone library" topics = ("utility", "backport") + package_type = "header-library" settings = "os", "arch", "build_type", "compiler" 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 def package(self): copy(self, "*.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/out_ptr/all/test_package/conanfile.py b/recipes/out_ptr/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/out_ptr/all/test_package/conanfile.py +++ b/recipes/out_ptr/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/out_ptr/all/test_v1_package/CMakeLists.txt b/recipes/out_ptr/all/test_v1_package/CMakeLists.txt index cd9bb19ae3754..0d20897301b68 100644 --- a/recipes/out_ptr/all/test_v1_package/CMakeLists.txt +++ b/recipes/out_ptr/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(out_ptr CONFIG REQUIRED) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE out_ptr::out_ptr) -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/out_ptr/all/test_v1_package/conanfile.py b/recipes/out_ptr/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/out_ptr/all/test_v1_package/conanfile.py +++ b/recipes/out_ptr/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/outcome/all/conandata.yml b/recipes/outcome/all/conandata.yml index 862ef733ccf23..0b6baa08be3b1 100644 --- a/recipes/outcome/all/conandata.yml +++ b/recipes/outcome/all/conandata.yml @@ -1,22 +1,16 @@ sources: - "2.2.3": - url: "https://github.com/ned14/outcome/archive/v2.2.3.tar.gz" - sha256: "31cc987d73b2625a70f35083ccff26d1c2634d89304f1ea606a294da36cb2958" - "2.2.2": - url: "https://github.com/ned14/outcome/archive/v2.2.2.tar.gz" - sha256: "fc16bc24f8a7d10dc24b9cc3abd1609f67b29aab2c8da546d123d518e9c29dbb" - "2.2.1": - url: "https://github.com/ned14/outcome/archive/v2.2.1.tar.gz" - sha256: "cf21a9cba8c7d943a6310012626344618923f2ea367ccee6cb499eee8bb97147" - "2.2.0": - url: "https://github.com/ned14/outcome/archive/v2.2.0.tar.gz" - sha256: "eb7a54e74c7ed7e208ab4a610a56e619c82b2797236aee7cff3303a649f24e0e" + "2.2.9": + url: "https://github.com/ned14/outcome/archive/v2.2.9.tar.gz" + sha256: "2840e403b1d7a0d3a75ecc4df574ab0674284bb21d76ac5f817695f2b56905f2" + "2.2.8": + url: "https://github.com/ned14/outcome/archive/v2.2.8.tar.gz" + sha256: "6ef322867aee454792bd71b61950703dd18608670a69a1780cab81be22f78a1e" + "2.2.7": + url: "https://github.com/ned14/outcome/archive/v2.2.7.tar.gz" + sha256: "553fd03bb9684be19dfa251bfa0064e69e30a95b6b0ba9a62d68f8ec4e31662a" + "2.2.4": + url: "https://github.com/ned14/outcome/archive/v2.2.4.tar.gz" + sha256: "29ad35c1980cf7f75294bb52df678c6a08817228e880fac8454cd6ac390fa1fc" "2.1.5": url: "https://github.com/ned14/outcome/archive/v2.1.5.tar.gz" sha256: "e238e545753e2b00a7eefabeb677c9918c7a5402ad347b67de328089b4e15493" - "2.1.4": - url: "https://github.com/ned14/outcome/archive/v2.1.4.tar.gz" - sha256: "19463d2c9bb0bcdc1c0334b02b344caeb5fc723ab060155c959be8e0b551cf76" - "2.1.3": - url: "https://github.com/ned14/outcome/archive/v2.1.3.tar.gz" - sha256: "45ee2f720bd0965047c35bd0ea719656c9de51c49d13c6a82797fca325b8426a" diff --git a/recipes/outcome/all/conanfile.py b/recipes/outcome/all/conanfile.py index c11f8f905ac53..f1c9aa2601b2d 100644 --- a/recipes/outcome/all/conanfile.py +++ b/recipes/outcome/all/conanfile.py @@ -1,48 +1,66 @@ import os -from conans import ConanFile, errors, tools + +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 OutcomeConan(ConanFile): name = "outcome" - homepage = "https://github.com/ned14/outcome" description = "Provides very lightweight outcome and result" license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" - topics = ("outcome", "result") - settings = "compiler" + homepage = "https://github.com/ned14/outcome" + topics = ("result", "header-only") + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - _source_subfolder = "source_subfolder" - - def configure(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, "14") + @property + def _min_cppstd(self): + return "14" - minimum_version = { + @property + def _compilers_minimum_version(self): + return { "clang": "3.9", "gcc": "6", - "Visual Studio": "15.0", - }.get(str(self.settings.compiler)) - - if not minimum_version: - self.output.warn( - "Unknown compiler {} {}. Assuming compiler supports C++14." - .format(self.settings.compiler, self.settings.compiler.version)) - else: - version = tools.Version(self.settings.compiler.version) - if version < minimum_version: - raise errors.ConanInvalidConfiguration( - "The compiler {} {} does not support C++14." - .format(self.settings.compiler, self.settings.compiler.version)) + "Visual Studio": "15", + "msvc": "191", + } + + 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): - 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 build(self): + pass def package(self): - self.copy("outcome.hpp", dst="include", - src=os.path.join(self._source_subfolder, "single-header")) - self.copy("Licence.txt", dst="licenses", src=self._source_subfolder) + copy(self, "Licence.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "outcome.hpp", src=os.path.join(self.source_folder, "single-header"), + 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/outcome/all/test_package/CMakeLists.txt b/recipes/outcome/all/test_package/CMakeLists.txt index 36d5f5376146d..8a2128b64a829 100644 --- a/recipes/outcome/all/test_package/CMakeLists.txt +++ b/recipes/outcome/all/test_package/CMakeLists.txt @@ -1,13 +1,8 @@ -cmake_minimum_required(VERSION 3.1 FATAL_ERROR) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -project(OutcomePackageTest CXX) +find_package(outcome REQUIRED CONFIG) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -add_executable(example example.cpp) -target_link_libraries(example CONAN_PKG::outcome) -set_target_properties(example PROPERTIES - CXX_STANDARD 14 - CXX_STANDARD_REQUIRED ON - CXX_EXTENSIONS OFF) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE outcome::outcome) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/outcome/all/test_package/conanfile.py b/recipes/outcome/all/test_package/conanfile.py index 25a1fd17c6fbe..0a6bc68712d90 100644 --- a/recipes/outcome/all/test_package/conanfile.py +++ b/recipes/outcome/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 OutcomeTestConan(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/outcome/all/test_package/example.cpp b/recipes/outcome/all/test_package/test_package.cpp similarity index 100% rename from recipes/outcome/all/test_package/example.cpp rename to recipes/outcome/all/test_package/test_package.cpp diff --git a/recipes/outcome/all/test_v1_package/CMakeLists.txt b/recipes/outcome/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/outcome/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/outcome/all/test_v1_package/conanfile.py b/recipes/outcome/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/outcome/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/outcome/config.yml b/recipes/outcome/config.yml index 5e58124a1d058..df84211e55ceb 100644 --- a/recipes/outcome/config.yml +++ b/recipes/outcome/config.yml @@ -1,15 +1,11 @@ versions: - "2.2.3": + "2.2.9": folder: all - "2.2.2": + "2.2.8": folder: all - "2.2.1": + "2.2.7": folder: all - "2.2.0": + "2.2.4": folder: all "2.1.5": folder: all - "2.1.4": - folder: all - "2.1.3": - folder: all diff --git a/recipes/ozz-animation/all/CMakeLists.txt b/recipes/ozz-animation/all/CMakeLists.txt deleted file mode 100644 index 73c551783746d..0000000000000 --- a/recipes/ozz-animation/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.0) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -add_subdirectory("source_subfolder") diff --git a/recipes/ozz-animation/all/conandata.yml b/recipes/ozz-animation/all/conandata.yml index 548e0d6eb8858..ace2364367ed0 100644 --- a/recipes/ozz-animation/all/conandata.yml +++ b/recipes/ozz-animation/all/conandata.yml @@ -5,3 +5,6 @@ sources: "0.13.0": url: "https://github.com/guillaumeblanc/ozz-animation/archive/0.13.0.tar.gz" sha256: "2677f28d83bb4be00f92537ee3fb2573f9e99fc82fb1777a1b8a6131aa9b96a4" + "0.14.1": + url: "https://github.com/guillaumeblanc/ozz-animation/archive/0.14.1.tar.gz" + sha256: "621094d43aeea4b11da530178d1199107f2b590a9bfb3cba7c36b3176a86ac1e" diff --git a/recipes/ozz-animation/all/conanfile.py b/recipes/ozz-animation/all/conanfile.py index 7266f8b1ea03c..6a87de84d42e5 100644 --- a/recipes/ozz-animation/all/conanfile.py +++ b/recipes/ozz-animation/all/conanfile.py @@ -1,52 +1,129 @@ import os -from conans import ConanFile, CMake, tools +from pathlib import Path +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, rename, get, replace_in_file +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" class OzzAnimationConan(ConanFile): name = "ozz-animation" description = "Open source c++ skeletal animation library and toolset." license = "MIT" - topics = ("conan", "ozz", "animation", "skeletal") + topics = ("ozz", "animation", "skeletal") homepage = "https://github.com/guillaumeblanc/ozz-animation" 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], + "shared": [True, False], + + #runtime geometry library (skinning jobs) + "ozz_geometry": [True, False], + + #runtime animation library + "ozz_animation": [True, False], + + #library for parsing CLI args + "ozz_options": [True, False], + + #library for offline processing + "ozz_animation_offline": [True, False], + + #library for creating tools + "ozz_animation_tools": [True, False], + + #gltf2ozz CLI tool + "tools": [True, False], } default_options = { "fPIC": True, + "shared": False, + "tools": False, + "ozz_geometry": True, + "ozz_animation": True, + "ozz_options": False, + "ozz_animation_offline": False, + "ozz_animation_tools": False, } - short_paths = True - _source_subfolder = "source_subfolder" - _build_subfolder = "build_subfolder" + def validate(self): + def _ensure_enabled(opt, req): + if self.options.get_safe(opt): + missing = [r for r in req if not getattr(self.options, r, False)] + if missing: + raise ConanInvalidConfiguration(f"Option '{opt}' requires option(s) {missing} to be enabled too") + _ensure_enabled('ozz_animation_offline', ['ozz_animation']) + _ensure_enabled('ozz_animation_tools', ['ozz_animation_offline', 'ozz_options']) + _ensure_enabled('tools', ['ozz_animation_tools']) + + if self.settings.compiler == 'gcc': + # GCC 11.2 bug breaks build + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99578 + # https://github.com/guillaumeblanc/ozz-animation/issues/147 + if Version(self.settings.compiler.version) < "11.3": + raise ConanInvalidConfiguration(f"GCC 11.3 or newer required") + + if self.options.shared and Version(self.version) < "0.14.0": + raise ConanInvalidConfiguration(f"Can't build shared library for {self.version}") 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") + #this component ships an old version of jsoncpp (0.10.6) which isn't on + #conan center, so this will prevent ODR violations until either + #upstream updates to a newer jsoncpp version, or someone adds a package + #for that version of jsoncpp + if self.options.ozz_animation_tools: + self.provides = ['jsoncpp'] + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() + + 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def _configure_cmake(self): cmake = CMake(self) - cmake.definitions["ozz_build_fbx"] = False - cmake.definitions["ozz_build_data"] = False - cmake.definitions["ozz_build_samples"] = False - cmake.definitions["ozz_build_howtos"] = False - cmake.definitions["ozz_build_tests"] = False - cmake.definitions["ozz_build_cpp11"] = True - cmake.configure(build_folder=self._build_subfolder) + cmvars = { + "ozz_build_fbx": False, + "ozz_build_data": False, + "ozz_build_samples": False, + "ozz_build_howtos": False, + "ozz_build_tests": False, + "ozz_build_cpp11": True, + "ozz_build_tools": False, + "ozz_build_gltf": False, + } + + if self.options.ozz_animation_tools: + cmvars["ozz_build_tools"] = True + + if self.options.tools: + cmvars["ozz_build_tools"] = True + cmvars["ozz_build_gltf"] = True + + cmake.configure(variables = cmvars) return cmake def build(self): + subfolder = Path(self.source_folder) for before, after in [('string(REGEX REPLACE "/MT" "/MD" ${flag} "${${flag}}")', ""), ('string(REGEX REPLACE "/MD" "/MT" ${flag} "${${flag}}")', "")]: - tools.replace_in_file(os.path.join(self._source_subfolder, "build-utils", "cmake", "compiler_settings.cmake"), before, after) + replace_in_file(self, subfolder/"build-utils"/"cmake"/"compiler_settings.cmake", before, after) - tools.replace_in_file(os.path.join(self._source_subfolder, "src", "animation", "offline", "tools", "CMakeLists.txt"), + replace_in_file(self, subfolder/"src"/"animation"/"offline"/"tools"/"CMakeLists.txt", "if(NOT EMSCRIPTEN)", "if(NOT CMAKE_CROSSCOMPILING)") @@ -54,13 +131,68 @@ def build(self): cmake.build() def package(self): - cmake = self._configure_cmake() + cmake = CMake(self) cmake.install() - os.remove(os.path.join(self.package_folder, "CHANGES.md")) - os.remove(os.path.join(self.package_folder, "LICENSE.md")) - os.remove(os.path.join(self.package_folder, "README.md")) - self.copy(pattern="LICENSE.md", dst="licenses", src=self._source_subfolder) + pkg = self.package_path + + if self.options.ozz_animation_tools: + json = Path(self.build_folder)/'src'/'animation'/'offline'/'tools'/'json' + copy(self, "*.a", src=json, dst=pkg/'lib', keep_path=False) + copy(self, "*.so", src=json, dst=pkg/'lib', keep_path=False) + copy(self, "*.dylib", src=json, dst=pkg/'lib', keep_path=False) + copy(self, "*.lib", src=json, dst=pkg/'lib', keep_path=False) + copy(self, "*.dll", src=json, dst=pkg/'bin', keep_path=False) + + os.remove(pkg/"CHANGES.md") + os.remove(pkg/"LICENSE.md") + os.remove(pkg/"README.md") + + (pkg/'bin').mkdir(exist_ok=True) + for file in filter(lambda p: p.suffix=='.dll', (pkg/'lib').iterdir()): + rename(self, src=file, dst=pkg/'bin'/file.name) + + copy(self, pattern="LICENSE.md", dst=pkg/"licenses", src=self.source_folder) def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) + postfix = { + "Debug": "_d", + "Release": "_r", + "MinSizeRel": "_rs", + "RelWithDebInfo": "_rd", + }[str(self.settings.build_type)] + + def _add_libm(c): + if self.settings.os in ("Linux", "Android", "FreeBSD"): + self.cpp_info.components[c].system_libs = ["m"] + + self.cpp_info.components["base"].libs = [f"ozz_base{postfix}"] + _add_libm("base") + + if self.options.ozz_geometry: + self.cpp_info.components["geometry"].libs = [f"ozz_geometry{postfix}"] + self.cpp_info.components["geometry"].requires = ["base"] + _add_libm("geometry") + + if self.options.ozz_animation: + self.cpp_info.components["animation"].libs = [f"ozz_animation{postfix}"] + self.cpp_info.components["animation"].requires = ["base"] + _add_libm("animation") + + if self.options.ozz_animation_offline: + self.cpp_info.components["animation_offline"].libs = [f"ozz_animation_offline{postfix}"] + self.cpp_info.components["animation_offline"].requires = ["animation"] + _add_libm("animation_offline") + + if self.options.ozz_options: + self.cpp_info.components["options"].libs = [f"ozz_options{postfix}"] + self.cpp_info.components["options"].requires = ["base"] + _add_libm("options") + + if self.options.ozz_animation_tools: + self.cpp_info.components["animation_tools"].libs = [f"ozz_animation_tools{postfix}"] + self.cpp_info.components["animation_tools"].requires = ["animation_offline", "options", "jsoncpp"] + self.cpp_info.components["jsoncpp"].libs = [f"json{postfix}"] + + if self.options.tools: + self.buildenv_info.prepend_path("PATH", str(Path(self.package_folder)/"bin"/"tools")) diff --git a/recipes/ozz-animation/all/test_package/CMakeLists.txt b/recipes/ozz-animation/all/test_package/CMakeLists.txt index ef4d8f93d6c96..0c1c8ada3a5be 100644 --- a/recipes/ozz-animation/all/test_package/CMakeLists.txt +++ b/recipes/ozz-animation/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() +find_package(ozz-animation REQUIRED CONFIG) add_executable(${CMAKE_PROJECT_NAME} test_package.cpp) set_property(TARGET ${CMAKE_PROJECT_NAME} PROPERTY CXX_STANDARD 11) set_property(TARGET ${CMAKE_PROJECT_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) -target_link_libraries(${CMAKE_PROJECT_NAME} ${CONAN_LIBS}) + +target_link_libraries(${CMAKE_PROJECT_NAME} + ozz-animation::ozz-animation +) diff --git a/recipes/ozz-animation/all/test_package/conanfile.py b/recipes/ozz-animation/all/test_package/conanfile.py index 4903f1a7e8fa0..304895d77753a 100644 --- a/recipes/ozz-animation/all/test_package/conanfile.py +++ b/recipes/ozz-animation/all/test_package/conanfile.py @@ -1,16 +1,25 @@ -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 = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + + 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.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + cmd = os.path.join(self.cpp.build.bindir, "test_package") + self.run(cmd, env="conanrun") diff --git a/recipes/ozz-animation/all/test_package/test_package.cpp b/recipes/ozz-animation/all/test_package/test_package.cpp index 9202b08874e2c..6ed8f2ae5d31c 100644 --- a/recipes/ozz-animation/all/test_package/test_package.cpp +++ b/recipes/ozz-animation/all/test_package/test_package.cpp @@ -2,6 +2,8 @@ #include "ozz/base/log.h" #include "ozz/base/io/stream.h" +#include "ozz/animation/runtime/animation.h" +#include "ozz/geometry/runtime/skinning_job.h" int main() { diff --git a/recipes/ozz-animation/all/test_v1_package/CMakeLists.txt b/recipes/ozz-animation/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..ef4d8f93d6c96 --- /dev/null +++ b/recipes/ozz-animation/all/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() + +add_executable(${CMAKE_PROJECT_NAME} test_package.cpp) +set_property(TARGET ${CMAKE_PROJECT_NAME} PROPERTY CXX_STANDARD 11) +set_property(TARGET ${CMAKE_PROJECT_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) +target_link_libraries(${CMAKE_PROJECT_NAME} ${CONAN_LIBS}) diff --git a/recipes/ozz-animation/all/test_v1_package/conanfile.py b/recipes/ozz-animation/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..4903f1a7e8fa0 --- /dev/null +++ b/recipes/ozz-animation/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" + + 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/ozz-animation/all/test_v1_package/test_package.cpp b/recipes/ozz-animation/all/test_v1_package/test_package.cpp new file mode 100644 index 0000000000000..9202b08874e2c --- /dev/null +++ b/recipes/ozz-animation/all/test_v1_package/test_package.cpp @@ -0,0 +1,12 @@ +#include + +#include "ozz/base/log.h" +#include "ozz/base/io/stream.h" + +int main() +{ + ozz::io::File file("test.ozz", "rb"); + + if (!file.opened()) { + } +} diff --git a/recipes/ozz-animation/config.yml b/recipes/ozz-animation/config.yml index a9085cf3fa2b2..8e1c91c8b156c 100644 --- a/recipes/ozz-animation/config.yml +++ b/recipes/ozz-animation/config.yml @@ -3,3 +3,5 @@ versions: folder: all "0.13.0": folder: all + "0.14.1": + folder: all diff --git a/recipes/p-ranav-glob/all/conanfile.py b/recipes/p-ranav-glob/all/conanfile.py index 3db82dd1c8225..882ff198b6b6c 100644 --- a/recipes/p-ranav-glob/all/conanfile.py +++ b/recipes/p-ranav-glob/all/conanfile.py @@ -1,23 +1,26 @@ import os -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration -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.files import copy, get +from conan.tools.layout import basic_layout +from conan.tools.scm import Version + +required_conan_version = ">=1.52.0" class PRanavGlobConan(ConanFile): name = "p-ranav-glob" + description = "Glob for C++17" license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/p-ranav/glob" - description = "Glob for C++17" topics = ("c++17", "config", "filesystem", "header-only") - settings = "compiler" - no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True @property def _compilers_minimum_version(self): @@ -28,23 +31,33 @@ def _compilers_minimum_version(self): "apple-clang": "11", } - 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, 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: - raise ConanInvalidConfiguration("{} requires C++17, which your compiler does not support.".format(self.name)) + if Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration(f"{self.name} requires C++17, which your compiler does not support.") else: - self.output.warn("{} requires C++17. Your compiler is unknown. Assuming it supports C++17.".format(self.name)) - - def package_id(self): - self.info.header_only() + self.output.warning(f"{self.name} 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], strip_root=True) def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("*", dst="include", src=os.path.join(self._source_subfolder, "single_include")) + copy(self, "LICENSE", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder) + copy(self, "*", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "single_include")) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/p-ranav-glob/all/test_package/CMakeLists.txt b/recipes/p-ranav-glob/all/test_package/CMakeLists.txt index 481262167c9f5..5baf64aba53ee 100644 --- a/recipes/p-ranav-glob/all/test_package/CMakeLists.txt +++ b/recipes/p-ranav-glob/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(p-ranav-glob REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE p-ranav-glob::p-ranav-glob) set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17) diff --git a/recipes/p-ranav-glob/all/test_package/conanfile.py b/recipes/p-ranav-glob/all/test_package/conanfile.py index 4903f1a7e8fa0..ef5d7042163ec 100644 --- a/recipes/p-ranav-glob/all/test_package/conanfile.py +++ b/recipes/p-ranav-glob/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/p-ranav-glob/all/test_v1_package/CMakeLists.txt b/recipes/p-ranav-glob/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/p-ranav-glob/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/p-ranav-glob/all/test_v1_package/conanfile.py b/recipes/p-ranav-glob/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..6c9d5dba712c7 --- /dev/null +++ b/recipes/p-ranav-glob/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_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/packio/all/conandata.yml b/recipes/packio/all/conandata.yml index 6e87f4c19f689..883472bb39dd2 100644 --- a/recipes/packio/all/conandata.yml +++ b/recipes/packio/all/conandata.yml @@ -32,3 +32,15 @@ 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" + "2.4.0": + url: "https://github.com/qchateau/packio/archive/2.4.0.tar.gz" + sha256: "2815d7772ef8d2360c5e15de7738ec7267e1e54a7afb817bf42a18a9f100ff52" + "2.4.1": + url: "https://github.com/qchateau/packio/archive/2.4.1.tar.gz" + sha256: "c115548146d6da432048265037b30f77ba6ad7a39350693c4fb36fd896bc7a4b" + "2.5.0": + url: "https://github.com/qchateau/packio/archive/2.5.0.tar.gz" + sha256: "5aa29313ac37be2fb66ff01af9413d9f9931cd4566f1400b00fac107552558ae" diff --git a/recipes/packio/all/conanfile.py b/recipes/packio/all/conanfile.py index a3bd43e6d193f..1b6fc91c9312b 100644 --- a/recipes/packio/all/conanfile.py +++ b/recipes/packio/all/conanfile.py @@ -1,7 +1,7 @@ import os -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration -from conans.tools import Version +from conan import ConanFile +from conan.tools import files, scm, build +from conan.errors import ConanInvalidConfiguration class PackioConan(ConanFile): @@ -32,24 +32,31 @@ def _source_subfolder(self): @property def _compilers_minimum_version(self): + if scm.Version(self.version) < "2.4.0": + return { + "apple-clang": 10, + "clang": 6, + "gcc": 7, + "Visual Studio": 16, + } return { - "apple-clang": 10, - "clang": 6, - "gcc": 7, + "apple-clang": 13, + "clang": 11, + "gcc": 9, "Visual Studio": 16, } def config_options(self): - if tools.Version(self.version) < "1.2.0": + if scm.Version(self.version) < "1.2.0": del self.options.standalone_asio - if tools.Version(self.version) < "2.0.0": + if scm.Version(self.version) < "2.0.0": del self.options.msgpack del self.options.nlohmann_json - if tools.Version(self.version) < "2.1.0": + if scm.Version(self.version) < "2.1.0": del self.options.boost_json def requirements(self): - if self.options.get_safe("msgpack") or tools.Version(self.version) < "2.0.0": + if self.options.get_safe("msgpack") or scm.Version(self.version) < "2.0.0": self.requires("msgpack/3.2.1") if self.options.get_safe("nlohmann_json"): @@ -66,17 +73,17 @@ def requirements(self): self.requires("asio/1.18.1") def source(self): - tools.get(**self.conan_data["sources"][self.version]) + files.get(conanfile=self, **self.conan_data["sources"][self.version]) extracted_dir = "packio-" + self.version os.rename(extracted_dir, self._source_subfolder) def configure(self): if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, "17") + build.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 scm.Version(self.settings.compiler.version) < minimum_version: raise ConanInvalidConfiguration("packio requires C++17, which your compiler does not support.") else: self.output.warn("packio requires C++17. Your compiler is unknown. Assuming it supports C++17.") @@ -89,7 +96,7 @@ def package_id(self): self.info.header_only() def package_info(self): - if tools.Version(self.version) < "2.1.0": + if scm.Version(self.version) < "2.1.0": if self.options.get_safe("standalone_asio"): self.cpp_info.defines.append("PACKIO_STANDALONE_ASIO") else: diff --git a/recipes/packio/all/test_package/1.0.x-1.1.x.cpp b/recipes/packio/all/test_package/1.0.x-1.1.x.cpp index 552bf68968f13..f4ef879ba2126 100644 --- a/recipes/packio/all/test_package/1.0.x-1.1.x.cpp +++ b/recipes/packio/all/test_package/1.0.x-1.1.x.cpp @@ -1,3 +1,5 @@ +#include // missing include in recent versions of MSVC + #include namespace ip = boost::asio::ip; diff --git a/recipes/packio/all/test_package/1.2.x.cpp b/recipes/packio/all/test_package/1.2.x.cpp index 47fcbfbab961f..4d1bd032ed004 100644 --- a/recipes/packio/all/test_package/1.2.x.cpp +++ b/recipes/packio/all/test_package/1.2.x.cpp @@ -1,3 +1,5 @@ +#include // missing include in recent versions of MSVC + #include #if defined(PACKIO_STANDALONE_ASIO) diff --git a/recipes/packio/all/test_package/latest.cpp b/recipes/packio/all/test_package/latest.cpp index d01bcd0d75b2f..381f2263eed02 100644 --- a/recipes/packio/all/test_package/latest.cpp +++ b/recipes/packio/all/test_package/latest.cpp @@ -1,3 +1,5 @@ +#include // missing include in recent versions of MSVC + #include namespace net = packio::net; diff --git a/recipes/packio/config.yml b/recipes/packio/config.yml index 1ee2ce354c532..4e4071772582c 100644 --- a/recipes/packio/config.yml +++ b/recipes/packio/config.yml @@ -21,3 +21,11 @@ versions: folder: all "2.2.0": folder: all + "2.3.0": + folder: all + "2.4.0": + folder: all + "2.4.1": + folder: all + "2.5.0": + folder: all diff --git a/recipes/pagmo2/all/CMakeLists.txt b/recipes/pagmo2/all/CMakeLists.txt deleted file mode 100644 index b71c882d9d33f..0000000000000 --- a/recipes/pagmo2/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/pagmo2/all/conandata.yml b/recipes/pagmo2/all/conandata.yml index a610a9ffc5a7b..26d2bd85a3ccc 100644 --- a/recipes/pagmo2/all/conandata.yml +++ b/recipes/pagmo2/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.19.0": + url: "https://github.com/esa/pagmo2/archive/refs/tags/v2.19.0.tar.gz" + sha256: "701ada528de7d454201e92a5d88903dd1c22ea64f43861d9694195ddfef82a70" "2.17.0": url: "https://github.com/esa/pagmo2/archive/refs/tags/v2.17.0.tar.gz" sha256: "1b95b036f75e6fa0b21082ab228dbd63cd18ca10d9622ac53629245e0f95c35c" diff --git a/recipes/pagmo2/all/conanfile.py b/recipes/pagmo2/all/conanfile.py index 08b268962bb1c..b0c859b99c54f 100644 --- a/recipes/pagmo2/all/conanfile.py +++ b/recipes/pagmo2/all/conanfile.py @@ -1,19 +1,25 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -import functools 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.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, replace_in_file, rmdir +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" class Pagmo2Conan(ConanFile): name = "pagmo2" description = "pagmo is a C++ scientific library for massively parallel optimization." license = ("LGPL-3.0-or-later", "GPL-3.0-or-later") - topics = ("pagmo", "optimization", "parallel-computing", "genetic-algorithm", "metaheuristics") - homepage = "https://esa.github.io/pagmo2" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://esa.github.io/pagmo2" + topics = ("pagmo", "optimization", "parallel-computing", "genetic-algorithm", "metaheuristics") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -30,12 +36,15 @@ class Pagmo2Conan(ConanFile): "with_ipopt": False, } - exports_sources = "CMakeLists.txt" - generators = "cmake", "cmake_find_package", "cmake_find_package_multi" - @property - def _source_subfolder(self): - return "source_subfolder" + def _compilers_minimum_version(self): + return { + "Visual Studio": "15.7", + "msvc": "191", + "gcc": "7", + "clang": "5.0", + "apple-clang": "9", + } def config_options(self): if self.settings.os == "Windows": @@ -43,24 +52,18 @@ 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("onetbb/2020.3") + self.requires("boost/1.85.0", transitive_headers=True) + self.requires("onetbb/2021.12.0") if self.options.with_eigen: - self.requires("eigen/3.4.0") + self.requires("eigen/3.4.0", transitive_headers=True) if self.options.with_nlopt: - self.requires("nlopt/2.7.1") - - @property - def _compilers_minimum_version(self): - return { - "Visual Studio": "15.7", - "gcc": "7", - "clang": "5.0", - "apple-clang": "9.1" - } + self.requires("nlopt/2.7.1", transitive_headers=True, transitive_libs=True) @property def _required_boost_components(self): @@ -68,86 +71,95 @@ def _required_boost_components(self): 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] + check_min_cppstd(self, 17) 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)) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.name} {self.version} requires C++17, which your compiler does not support." + ) # TODO: add ipopt support if self.options.with_ipopt: raise ConanInvalidConfiguration("ipopt recipe not available yet in CCI") - 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: - raise ConanInvalidConfiguration("{0} requires non header-only boost with these components: {1}".format(self.name, ", ".join(self._required_boost_components))) + 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) + ) + ) + + if is_msvc(self) and self.options.shared: + # test_package.obj : error LNK2019: unresolved external symbol "public: __cdecl boost::archive::codecvt_null::codecvt_null(unsigned __int64)" + # https://github.com/boostorg/serialization/issues/232 + # https://github.com/conda-forge/scipoptsuite-feedstock/pull/44 + raise ConanInvalidConfiguration("Shared builds are currently broken on MSVC") 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["PAGMO_BUILD_TESTS"] = False + tc.variables["PAGMO_BUILD_BENCHMARKS"] = False + tc.variables["PAGMO_BUILD_TUTORIALS"] = False + tc.variables["PAGMO_WITH_EIGEN3"] = self.options.with_eigen + tc.variables["PAGMO_WITH_NLOPT"] = self.options.with_nlopt + tc.variables["PAGMO_WITH_IPOPT"] = self.options.with_ipopt + tc.variables["PAGMO_ENABLE_IPO"] = False + tc.variables["PAGMO_BUILD_STATIC_LIBRARY"] = not self.options.shared + tc.generate() + tc = CMakeDeps(self) + tc.generate() def _patch_sources(self): # do not force MT runtime for static lib - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "if(YACMA_COMPILER_IS_MSVC AND PAGMO_BUILD_STATIC_LIBRARY)", - "if(0)") + if Version(self.version) < "2.18": + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "if(YACMA_COMPILER_IS_MSVC AND PAGMO_BUILD_STATIC_LIBRARY)", "if(0)") # No warnings as errors - yacma_cmake = os.path.join(self._source_subfolder, "cmake_modules", "yacma", "YACMACompilerLinkerSettings.cmake") - tools.replace_in_file(yacma_cmake, "list(APPEND _YACMA_CXX_FLAGS_DEBUG \"-Werror\")", "") - tools.replace_in_file(yacma_cmake, "_YACMA_CHECK_ENABLE_DEBUG_CXX_FLAG(/W4)", "") - tools.replace_in_file(yacma_cmake, "_YACMA_CHECK_ENABLE_DEBUG_CXX_FLAG(/WX)", "") - - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["PAGMO_BUILD_TESTS"] = False - cmake.definitions["PAGMO_BUILD_BENCHMARKS"] = False - cmake.definitions["PAGMO_BUILD_TUTORIALS"] = False - cmake.definitions["PAGMO_WITH_EIGEN3"] = self.options.with_eigen - cmake.definitions["PAGMO_WITH_NLOPT"] = self.options.with_nlopt - cmake.definitions["PAGMO_WITH_IPOPT"] = self.options.with_ipopt - cmake.definitions["PAGMO_ENABLE_IPO"] = False - cmake.definitions["PAGMO_BUILD_STATIC_LIBRARY"] = not self.options.shared - cmake.configure() - return cmake + yacma_cmake = os.path.join(self.source_folder, "cmake_modules", "yacma", "YACMACompilerLinkerSettings.cmake") + replace_in_file(self, yacma_cmake, 'list(APPEND _YACMA_CXX_FLAGS_DEBUG "-Werror")', "") + replace_in_file(self, yacma_cmake, "_YACMA_CHECK_ENABLE_DEBUG_CXX_FLAG(/W4)", "") + replace_in_file(self, yacma_cmake, "_YACMA_CHECK_ENABLE_DEBUG_CXX_FLAG(/WX)", "") 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, "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.set_property("cmake_file_name", "pagmo") + # https://esa.github.io/pagmo2/quickstart.html#using-pagmo-with-cmake + self.cpp_info.set_property("cmake_file_name", "Pagmo") self.cpp_info.set_property("cmake_target_name", "Pagmo::pagmo") - # TODO: back to global scope in conan v2 once cmake_find_package_* generators removed + self.cpp_info.components["_pagmo"].libs = ["pagmo"] - self.cpp_info.components["_pagmo"].requires = ["boost::headers", "boost::serialization", "onetbb::onetbb"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["_pagmo"].system_libs.append("pthread") + + # TODO: back to global scope in conan v2 once cmake_find_package_* generators removed + self.cpp_info.components["_pagmo"].requires = ["boost::boost", "onetbb::onetbb"] if self.options.with_eigen: self.cpp_info.components["_pagmo"].requires.append("eigen::eigen") if self.options.with_nlopt: self.cpp_info.components["_pagmo"].requires.append("nlopt::nlopt") - if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.components["_pagmo"].system_libs.append("pthread") - - # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.filenames["cmake_find_package"] = "pagmo" self.cpp_info.filenames["cmake_find_package_multi"] = "pagmo" self.cpp_info.names["cmake_find_package"] = "Pagmo" self.cpp_info.names["cmake_find_package_multi"] = "Pagmo" self.cpp_info.components["_pagmo"].names["cmake_find_package"] = "pagmo" self.cpp_info.components["_pagmo"].names["cmake_find_package_multi"] = "pagmo" - self.cpp_info.components["_pagmo"].set_property("cmake_target_name", "Pagmo::pagmo") diff --git a/recipes/pagmo2/all/test_package/CMakeLists.txt b/recipes/pagmo2/all/test_package/CMakeLists.txt index e512e2207b158..73aa85822f44b 100644 --- a/recipes/pagmo2/all/test_package/CMakeLists.txt +++ b/recipes/pagmo2/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(pagmo REQUIRED CONFIG) +find_package(Pagmo REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} Pagmo::pagmo) diff --git a/recipes/pagmo2/all/test_package/conanfile.py b/recipes/pagmo2/all/test_package/conanfile.py index 38f4483872d47..ef5d7042163ec 100644 --- a/recipes/pagmo2/all/test_package/conanfile.py +++ b/recipes/pagmo2/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/pagmo2/all/test_v1_package/CMakeLists.txt b/recipes/pagmo2/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/pagmo2/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/pagmo2/all/test_v1_package/conanfile.py b/recipes/pagmo2/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/pagmo2/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/pagmo2/config.yml b/recipes/pagmo2/config.yml index 0daf1d812658e..4d9124762cc74 100644 --- a/recipes/pagmo2/config.yml +++ b/recipes/pagmo2/config.yml @@ -1,4 +1,6 @@ versions: + "2.19.0": + folder: all "2.17.0": folder: all "2.10": diff --git a/recipes/pagmo2/pre_2.11/CMakeLists.txt b/recipes/pagmo2/pre_2.11/CMakeLists.txt deleted file mode 100644 index 361b35d4c17d9..0000000000000 --- a/recipes/pagmo2/pre_2.11/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/pagmo2/pre_2.11/conandata.yml b/recipes/pagmo2/pre_2.11/conandata.yml index fb48c3245b653..9bb70cc4e5a27 100644 --- a/recipes/pagmo2/pre_2.11/conandata.yml +++ b/recipes/pagmo2/pre_2.11/conandata.yml @@ -5,4 +5,3 @@ sources: patches: "2.10": - patch_file: "patches/0001-fix-cmake-module-path-2-10.patch" - base_path: "source_subfolder" diff --git a/recipes/pagmo2/pre_2.11/conanfile.py b/recipes/pagmo2/pre_2.11/conanfile.py index eeacc0b3752d5..485b29614940a 100644 --- a/recipes/pagmo2/pre_2.11/conanfile.py +++ b/recipes/pagmo2/pre_2.11/conanfile.py @@ -1,18 +1,23 @@ -from conans import ConanFile, CMake, 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.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir + +required_conan_version = ">=1.53.0" class Pagmo2Conan(ConanFile): name = "pagmo2" description = "pagmo is a C++ scientific library for massively parallel optimization." license = ("LGPL-3.0-or-later", "GPL-3.0-or-later") - topics = ("pagmo", "optimization", "parallel-computing", "genetic-algorithm", "metaheuristics") - homepage = "https://esa.github.io/pagmo2" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://esa.github.io/pagmo2" + topics = ("pagmo", "optimization", "parallel-computing", "genetic-algorithm", "metaheuristics", "header-only") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" options = { "with_eigen": [True, False], @@ -25,25 +30,22 @@ class Pagmo2Conan(ConanFile): "with_ipopt": False, } - generators = "cmake", "cmake_find_package", "cmake_find_package_multi" - _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 layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("boost/1.78.0") - self.requires("onetbb/2020.3") + self.requires("boost/1.83.0", transitive_headers=True) + self.requires("onetbb/2021.10.0") if self.options.with_eigen: - self.requires("eigen/3.4.0") + self.requires("eigen/3.4.0", transitive_headers=True) if self.options.with_nlopt: - self.requires("nlopt/2.7.1") + self.requires("nlopt/2.7.1", transitive_headers=True, transitive_libs=True) + + def package_id(self): + self.info.settings.clear() @property def _required_boost_components(self): @@ -51,61 +53,69 @@ def _required_boost_components(self): def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) + check_min_cppstd(self, 11) # TODO: add ipopt support if self.options.with_ipopt: raise ConanInvalidConfiguration("ipopt recipe not available yet in CCI") - 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: - raise ConanInvalidConfiguration("{0} requires non header-only boost with these components: {1}".format(self.name, ", ".join(self._required_boost_components))) - - def package_id(self): - self.info.settings.clear() + 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) + ) + ) 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["PAGMO_BUILD_TESTS"] = False - self._cmake.definitions["PAGMO_BUILD_TUTORIALS"] = False - self._cmake.definitions["PAGMO_WITH_EIGEN3"] = self.options.with_eigen - self._cmake.definitions["PAGMO_WITH_NLOPT"] = self.options.with_nlopt - self._cmake.definitions["PAGMO_WITH_IPOPT"] = self.options.with_ipopt - 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["PAGMO_BUILD_TESTS"] = False + tc.variables["PAGMO_BUILD_TUTORIALS"] = False + tc.variables["PAGMO_WITH_EIGEN3"] = self.options.with_eigen + tc.variables["PAGMO_WITH_NLOPT"] = self.options.with_nlopt + tc.variables["PAGMO_WITH_IPOPT"] = self.options.with_ipopt + tc.generate() + tc = CMakeDeps(self) + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) + 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, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "pagmo") self.cpp_info.set_property("cmake_target_name", "Pagmo::pagmo") + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["_pagmo"].system_libs.append("pthread") + # TODO: back to global scope in conan v2 once cmake_find_package_* generators removed - self.cpp_info.components["_pagmo"].requires = ["boost::headers", "boost::serialization", "onetbb::onetbb"] + self.cpp_info.components["_pagmo"].requires = ["boost::boost", "onetbb::onetbb"] if self.options.with_eigen: self.cpp_info.components["_pagmo"].requires.append("eigen::eigen") if self.options.with_nlopt: self.cpp_info.components["_pagmo"].requires.append("nlopt::nlopt") - if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.components["_pagmo"].system_libs.append("pthread") - - # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.filenames["cmake_find_package"] = "pagmo" self.cpp_info.filenames["cmake_find_package_multi"] = "pagmo" self.cpp_info.names["cmake_find_package"] = "Pagmo" self.cpp_info.names["cmake_find_package_multi"] = "Pagmo" self.cpp_info.components["_pagmo"].names["cmake_find_package"] = "pagmo" self.cpp_info.components["_pagmo"].names["cmake_find_package_multi"] = "pagmo" - self.cpp_info.components["_pagmo"].set_property("cmake_target_name", "Pagmo::pagmo") diff --git a/recipes/pagmo2/pre_2.11/test_package/CMakeLists.txt b/recipes/pagmo2/pre_2.11/test_package/CMakeLists.txt index 7439694a33876..de018735ec0b2 100644 --- a/recipes/pagmo2/pre_2.11/test_package/CMakeLists.txt +++ b/recipes/pagmo2/pre_2.11/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) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) find_package(pagmo REQUIRED CONFIG) diff --git a/recipes/pagmo2/pre_2.11/test_package/conanfile.py b/recipes/pagmo2/pre_2.11/test_package/conanfile.py index 38f4483872d47..ef5d7042163ec 100644 --- a/recipes/pagmo2/pre_2.11/test_package/conanfile.py +++ b/recipes/pagmo2/pre_2.11/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/pagmo2/pre_2.11/test_v1_package/CMakeLists.txt b/recipes/pagmo2/pre_2.11/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/pagmo2/pre_2.11/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/pagmo2/pre_2.11/test_v1_package/conanfile.py b/recipes/pagmo2/pre_2.11/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/pagmo2/pre_2.11/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/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 45923baeaa709..fb14bce735ef1 100644 --- a/recipes/paho-mqtt-c/all/conandata.yml +++ b/recipes/paho-mqtt-c/all/conandata.yml @@ -1,54 +1,49 @@ 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.10": - url: "https://github.com/eclipse/paho.mqtt.c/archive/v1.3.10.tar.gz" - sha256: "c70db96e66adacae411d5d875fbb08bca6ff9945de3d215b3af93cbd22792db5" + "1.3.13": + url: "https://github.com/eclipse/paho.mqtt.c/archive/v1.3.13.tar.gz" + sha256: "47c77e95609812da82feee30db435c3b7c720d4fd3147d466ead126e657b6d9c" + "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" -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.10": + url: "https://github.com/eclipse/paho.mqtt.c/archive/v1.3.10.tar.gz" + sha256: "c70db96e66adacae411d5d875fbb08bca6ff9945de3d215b3af93cbd22792db5" + "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" +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" diff --git a/recipes/paho-mqtt-c/all/conanfile.py b/recipes/paho-mqtt-c/all/conanfile.py index c0dc647af2b3b..7af37a8f2229f 100644 --- a/recipes/paho-mqtt-c/all/conanfile.py +++ b/recipes/paho-mqtt-c/all/conanfile.py @@ -1,130 +1,115 @@ -from conans import CMake, ConanFile, 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, export_conandata_patches, get, copy, rm, replace_in_file 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") + package_type = "library" 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" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - if not self._has_high_performance_option: - del self.options.high_performance - 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") - - 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)) - - def package_id(self): - del self.info.options.samples + # Headers are exposed https://github.com/eclipse/paho.mqtt.c/blob/f7799da95e347bbc930b201b52a1173ebbad45a7/src/SSLSocket.h#L29 + self.requires("openssl/[>=1.1 <4]", 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["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("\\", "/") - if self._has_high_performance_option: - self._cmake.definitions["PAHO_HIGH_PERFORMANCE"] = self.options.high_performance - self._cmake.configure() - return self._cmake + tc.cache_variables["OPENSSL_SEARCH_PATH"] = self.dependencies["openssl"].package_folder.replace("\\", "/") + tc.cache_variables["OPENSSL_ROOT_DIR"] = self.dependencies["openssl"].package_folder.replace("\\", "/") + 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.set_property("cmake_file_name", "eclipse-paho-mqtt-c") + self.cpp_info.set_property("cmake_target_name", f"eclipse-paho-mqtt-c::{self._cmake_target}") + + # TODO: back to global scope in conan v2 self.cpp_info.components["_paho-mqtt-c"].libs = [self._lib_target] if self.settings.os == "Windows": if not self.options.shared: @@ -132,19 +117,25 @@ def package_info(self): if self.settings.compiler == "gcc": self.cpp_info.components["_paho-mqtt-c"].system_libs.extend( ["wsock32", "uuid", "crypt32", "rpcrt4"]) + elif self.settings.os == "Linux": + self.cpp_info.components["_paho-mqtt-c"].system_libs.extend(["anl", "c", "dl", "pthread"]) + elif self.settings.os == "FreeBSD": + self.cpp_info.components["_paho-mqtt-c"].system_libs.extend(["compat", "pthread"]) + elif self.settings.os == "Android": + self.cpp_info.components["_paho-mqtt-c"].system_libs.extend(["c"]) else: - if self.settings.os == "Linux": - self.cpp_info.components["_paho-mqtt-c"].system_libs.extend(["c", "dl", "pthread"]) - elif self.settings.os == "FreeBSD": - self.cpp_info.components["_paho-mqtt-c"].system_libs.extend(["compat", "pthread"]) - elif self.settings.os == "Android": - self.cpp_info.components["_paho-mqtt-c"].system_libs.extend(["c"]) - else: - self.cpp_info.components["_paho-mqtt-c"].system_libs.extend(["c", "pthread"]) + self.cpp_info.components["_paho-mqtt-c"].system_libs.extend(["c", "pthread"]) 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 + self.cpp_info.components["_paho-mqtt-c"].set_property("cmake_target_name", f"eclipse-paho-mqtt-c::{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 +158,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 self.settings.os == "Windows": target += "-static" return target diff --git a/recipes/paho-mqtt-c/all/patches/0001-fix-MinGW-and-OSX-builds-for-1-3-0.patch b/recipes/paho-mqtt-c/all/patches/0001-fix-MinGW-and-OSX-builds-for-1-3-0.patch deleted file mode 100644 index 8b2cf63dd0649..0000000000000 --- a/recipes/paho-mqtt-c/all/patches/0001-fix-MinGW-and-OSX-builds-for-1-3-0.patch +++ /dev/null @@ -1,169 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index b53745b..d8787d8 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -37,7 +37,7 @@ STRING(TIMESTAMP BUILD_TIMESTAMP UTC) - MESSAGE(STATUS "Timestamp is ${BUILD_TIMESTAMP}") - - IF(WIN32) -- ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE -DWIN32_LEAN_AND_MEAN -MD) -+ ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE -DWIN32_LEAN_AND_MEAN) - ELSEIF(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") - ADD_DEFINITIONS(-DOSX) - ENDIF() -@@ -61,34 +61,6 @@ IF(PAHO_BUILD_DOCUMENTATION) - ADD_SUBDIRECTORY(doc) - ENDIF() - --IF (PAHO_ENABLE_CPACK) -- ### packaging settings -- FILE(GLOB samples "src/samples/*.c") -- INSTALL(FILES ${samples} DESTINATION samples) -- -- SET(CPACK_PACKAGE_VENDOR "Eclipse Paho") -- SET(CPACK_PACKAGE_NAME "Eclipse-Paho-MQTT-C") -- INSTALL(FILES CONTRIBUTING.md epl-v10 edl-v10 README.md notice.html DESTINATION .) -- -- IF (WIN32) -- SET(CPACK_GENERATOR "ZIP") -- ELSEIF(PAHO_BUILD_DEB_PACKAGE) -- INSTALL(FILES CONTRIBUTING.md epl-v10 edl-v10 README.md notice.html DESTINATION .) -- -- SET(CPACK_GENERATOR "DEB") -- CONFIGURE_FILE(${CMAKE_SCRIPTS}/CPackDebConfig.cmake.in -- ${CMAKE_BINARY_DIR}/CPackDebConfig.cmake @ONLY) -- SET(CPACK_PROJECT_CONFIG_FILE ${CMAKE_BINARY_DIR}/CPackDebConfig.cmake) -- ADD_SUBDIRECTORY(debian) -- ELSE() -- SET(CPACK_GENERATOR "TGZ") -- ENDIF() --ELSE() -- FILE(GLOB samples "src/samples/*.c") -- INSTALL(FILES ${samples} DESTINATION ${CMAKE_INSTALL_DOCDIR}) -- --ENDIF() -- - SET(CPACK_PACKAGE_VERSION_MAJOR ${PAHO_VERSION_MAJOR}) - SET(CPACK_PACKAGE_VERSION_MINOR ${PAHO_VERSION_MINOR}) - SET(CPACK_PACKAGE_VERSION_PATCH ${PAHO_VERSION_PATCH}) -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index b46eaca..399b37d 100644 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -55,7 +55,7 @@ SET(common_src - ) - - IF (WIN32) -- SET(LIBS_SYSTEM ws2_32) -+ SET(LIBS_SYSTEM ws2_32 rpcrt4 crypt32 wsock32) - ELSEIF (UNIX) - IF(CMAKE_SYSTEM_NAME MATCHES "Linux") - SET(LIBS_SYSTEM c dl pthread) -diff --git a/src/MQTTAsync.c b/src/MQTTAsync.c -index a5813b4..4f209ec 100644 ---- a/src/MQTTAsync.c -+++ b/src/MQTTAsync.c -@@ -205,6 +205,14 @@ START_TIME_TYPE MQTTAsync_start_clock(void) - clock_gettime(CLOCK_MONOTONIC, &start); - return start; - } -+#elif defined(__APPLE__) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101200 -+#define START_TIME_TYPE struct timeval -+START_TIME_TYPE MQTTAsync_start_clock(void) -+{ -+ static struct timeval start; -+ gettimeofday(&start, NULL); -+ return start; -+} - #else - #define START_TIME_TYPE struct timeval - START_TIME_TYPE MQTTAsync_start_clock(void) -@@ -235,6 +243,16 @@ long MQTTAsync_elapsed(struct timespec start) - ntimersub(now, start, res); - return (res.tv_sec)*1000L + (res.tv_nsec)/1000000L; - } -+#elif defined(__APPLE__) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101200 -+ -+long MQTTAsync_elapsed(struct timeval start) -+{ -+ struct timeval now, res; -+ -+ gettimeofday(&now, NULL); -+ timersub(&now, &start, &res); -+ return (res.tv_sec)*1000 + (res.tv_usec)/1000; -+} - #else - long MQTTAsync_elapsed(struct timeval start) - { -diff --git a/src/MQTTClient.c b/src/MQTTClient.c -index 2069ff9..faee1ae 100644 ---- a/src/MQTTClient.c -+++ b/src/MQTTClient.c -@@ -258,6 +258,14 @@ START_TIME_TYPE MQTTClient_start_clock(void) - clock_gettime(CLOCK_MONOTONIC, &start); - return start; - } -+#elif defined(__APPLE__) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101200 -+#define START_TIME_TYPE struct timeval -+START_TIME_TYPE MQTTClient_start_clock(void) -+{ -+ static struct timeval start; -+ gettimeofday(&start, NULL); -+ return start; -+} - #else - #define START_TIME_TYPE struct timeval - START_TIME_TYPE MQTTClient_start_clock(void) -@@ -288,6 +296,15 @@ long MQTTClient_elapsed(struct timespec start) - ntimersub(now, start, res); - return (res.tv_sec)*1000L + (res.tv_nsec)/1000000L; - } -+#elif defined(__APPLE__) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101200 -+long MQTTClient_elapsed(struct timeval start) -+{ -+ struct timeval now, res; -+ -+ gettimeofday(&now, NULL); -+ timersub(&now, &start, &res); -+ return (res.tv_sec)*1000 + (res.tv_usec)/1000; -+} - #else - long MQTTClient_elapsed(struct timeval start) - { -diff --git a/src/Thread.c b/src/Thread.c -index 4cb2f16..40ce8dc 100644 ---- a/src/Thread.c -+++ b/src/Thread.c -@@ -409,9 +409,16 @@ int Thread_wait_cond(cond_type condvar, int timeout) - struct timespec cond_timeout; - - FUNC_ENTRY; -+#if defined(__APPLE__) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101200 -+ struct timeval cur_time; -+ gettimeofday(&cur_time, NULL); -+ cond_timeout.tv_sec = cur_time.tv_sec + timeout; -+ cond_timeout.tv_nsec = cur_time.tv_usec * 1000; -+#else - clock_gettime(CLOCK_REALTIME, &cond_timeout); - - cond_timeout.tv_sec += timeout; -+#endif - pthread_mutex_lock(&condvar->mutex); - rc = pthread_cond_timedwait(&condvar->cond, &condvar->mutex, &cond_timeout); - pthread_mutex_unlock(&condvar->mutex); -diff --git a/src/WebSocket.c b/src/WebSocket.c -index 47b1dad..3f96dac 100644 ---- a/src/WebSocket.c -+++ b/src/WebSocket.c -@@ -28,6 +28,11 @@ - #include "MQTTProtocolOut.h" - #include "StackTrace.h" - -+#ifdef __MINGW32__ -+#define htonll __builtin_bswap64 -+#define ntohll __builtin_bswap64 -+#endif -+ - #if defined(__linux__) - # include - #elif defined(__APPLE__) diff --git a/recipes/paho-mqtt-c/all/patches/0002-fix-MinGW-and-OSX-builds-for-1-3-1.patch b/recipes/paho-mqtt-c/all/patches/0002-fix-MinGW-and-OSX-builds-for-1-3-1.patch deleted file mode 100644 index 5ffa0a2a42da0..0000000000000 --- a/recipes/paho-mqtt-c/all/patches/0002-fix-MinGW-and-OSX-builds-for-1-3-1.patch +++ /dev/null @@ -1,169 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index b53745b..d8787d8 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -37,7 +37,7 @@ STRING(TIMESTAMP BUILD_TIMESTAMP UTC) - MESSAGE(STATUS "Timestamp is ${BUILD_TIMESTAMP}") - - IF(WIN32) -- ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE -DWIN32_LEAN_AND_MEAN -MD) -+ ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE -DWIN32_LEAN_AND_MEAN) - ELSEIF(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") - ADD_DEFINITIONS(-DOSX) - ENDIF() -@@ -61,34 +61,6 @@ IF(PAHO_BUILD_DOCUMENTATION) - ADD_SUBDIRECTORY(doc) - ENDIF() - --IF (PAHO_ENABLE_CPACK) -- ### packaging settings -- FILE(GLOB samples "src/samples/*.c") -- INSTALL(FILES ${samples} DESTINATION samples) -- -- SET(CPACK_PACKAGE_VENDOR "Eclipse Paho") -- SET(CPACK_PACKAGE_NAME "Eclipse-Paho-MQTT-C") -- INSTALL(FILES CONTRIBUTING.md epl-v10 edl-v10 README.md notice.html DESTINATION .) -- -- IF (WIN32) -- SET(CPACK_GENERATOR "ZIP") -- ELSEIF(PAHO_BUILD_DEB_PACKAGE) -- INSTALL(FILES CONTRIBUTING.md epl-v10 edl-v10 README.md notice.html DESTINATION .) -- -- SET(CPACK_GENERATOR "DEB") -- CONFIGURE_FILE(${CMAKE_SCRIPTS}/CPackDebConfig.cmake.in -- ${CMAKE_BINARY_DIR}/CPackDebConfig.cmake @ONLY) -- SET(CPACK_PROJECT_CONFIG_FILE ${CMAKE_BINARY_DIR}/CPackDebConfig.cmake) -- ADD_SUBDIRECTORY(debian) -- ELSE() -- SET(CPACK_GENERATOR "TGZ") -- ENDIF() --ELSE() -- FILE(GLOB samples "src/samples/*.c") -- INSTALL(FILES ${samples} DESTINATION ${CMAKE_INSTALL_DOCDIR}) -- --ENDIF() -- - SET(CPACK_PACKAGE_VERSION_MAJOR ${PAHO_VERSION_MAJOR}) - SET(CPACK_PACKAGE_VERSION_MINOR ${PAHO_VERSION_MINOR}) - SET(CPACK_PACKAGE_VERSION_PATCH ${PAHO_VERSION_PATCH}) -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index b46eaca..399b37d 100644 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -55,7 +55,7 @@ SET(common_src - ) - - IF (WIN32) -- SET(LIBS_SYSTEM ws2_32) -+ SET(LIBS_SYSTEM ws2_32 rpcrt4 crypt32 wsock32) - ELSEIF (UNIX) - IF(CMAKE_SYSTEM_NAME MATCHES "Linux") - SET(LIBS_SYSTEM c dl pthread) -diff --git a/src/MQTTAsync.c b/src/MQTTAsync.c -index a5813b4..4f209ec 100644 ---- a/src/MQTTAsync.c -+++ b/src/MQTTAsync.c -@@ -205,6 +205,14 @@ START_TIME_TYPE MQTTAsync_start_clock(void) - clock_gettime(CLOCK_MONOTONIC, &start); - return start; - } -+#elif defined(__APPLE__) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101200 -+#define START_TIME_TYPE struct timeval -+START_TIME_TYPE MQTTAsync_start_clock(void) -+{ -+ static struct timeval start; -+ gettimeofday(&start, NULL); -+ return start; -+} - #else - #define START_TIME_TYPE struct timeval - START_TIME_TYPE MQTTAsync_start_clock(void) -@@ -255,6 +263,16 @@ long MQTTAsync_elapsed(struct timespec start) - ntimersub(now, start, res); - return (res.tv_sec)*1000L + (res.tv_nsec)/1000000L; - } -+#elif defined(__APPLE__) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101200 -+ -+long MQTTAsync_elapsed(struct timeval start) -+{ -+ struct timeval now, res; -+ -+ gettimeofday(&now, NULL); -+ timersub(&now, &start, &res); -+ return (res.tv_sec)*1000 + (res.tv_usec)/1000; -+} - #else - long MQTTAsync_elapsed(struct timeval start) - { -diff --git a/src/MQTTClient.c b/src/MQTTClient.c -index 2069ff9..faee1ae 100644 ---- a/src/MQTTClient.c -+++ b/src/MQTTClient.c -@@ -258,6 +258,14 @@ START_TIME_TYPE MQTTClient_start_clock(void) - clock_gettime(CLOCK_MONOTONIC, &start); - return start; - } -+#elif defined(__APPLE__) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101200 -+#define START_TIME_TYPE struct timeval -+START_TIME_TYPE MQTTClient_start_clock(void) -+{ -+ static struct timeval start; -+ gettimeofday(&start, NULL); -+ return start; -+} - #else - #define START_TIME_TYPE struct timeval - START_TIME_TYPE MQTTClient_start_clock(void) -@@ -288,6 +296,15 @@ long MQTTClient_elapsed(struct timespec start) - ntimersub(now, start, res); - return (res.tv_sec)*1000L + (res.tv_nsec)/1000000L; - } -+#elif defined(__APPLE__) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101200 -+long MQTTClient_elapsed(struct timeval start) -+{ -+ struct timeval now, res; -+ -+ gettimeofday(&now, NULL); -+ timersub(&now, &start, &res); -+ return (res.tv_sec)*1000 + (res.tv_usec)/1000; -+} - #else - long MQTTClient_elapsed(struct timeval start) - { -diff --git a/src/Thread.c b/src/Thread.c -index 4cb2f16..40ce8dc 100644 ---- a/src/Thread.c -+++ b/src/Thread.c -@@ -411,9 +411,16 @@ int Thread_wait_cond(cond_type condvar, int timeout) - struct timespec cond_timeout; - - FUNC_ENTRY; -+#if defined(__APPLE__) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101200 -+ struct timeval cur_time; -+ gettimeofday(&cur_time, NULL); -+ cond_timeout.tv_sec = cur_time.tv_sec + timeout; -+ cond_timeout.tv_nsec = cur_time.tv_usec * 1000; -+#else - clock_gettime(CLOCK_REALTIME, &cond_timeout); - - cond_timeout.tv_sec += timeout; -+#endif - pthread_mutex_lock(&condvar->mutex); - rc = pthread_cond_timedwait(&condvar->cond, &condvar->mutex, &cond_timeout); - pthread_mutex_unlock(&condvar->mutex); -diff --git a/src/WebSocket.c b/src/WebSocket.c -index 47b1dad..3f96dac 100644 ---- a/src/WebSocket.c -+++ b/src/WebSocket.c -@@ -29,6 +28,11 @@ - #include "SocketBuffer.h" - #include "StackTrace.h" - -+#ifdef __MINGW32__ -+#define htonll __builtin_bswap64 -+#define ntohll __builtin_bswap64 -+#endif -+ - #if defined(__linux__) - # include - #elif defined(__APPLE__) 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 deleted file mode 100644 index 55186be096e0f..0000000000000 --- a/recipes/paho-mqtt-c/all/patches/0004-fix-cmake-find-openssl.patch +++ /dev/null @@ -1,47 +0,0 @@ -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 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -108,29 +108,10 @@ INSTALL(FILES MQTTAsync.h MQTTClient.h MQTTClientPersistence.h MQTTProperties.h - IF (PAHO_WITH_SSL) - SET(OPENSSL_SEARCH_PATH "" CACHE PATH "Directory containing OpenSSL libraries and includes") - -- IF (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") -- SET(OPENSSL_SEARCH_PATH "/usr/local/opt/openssl") -- ENDIF (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") -- -- IF (WIN32) -- SET(OPENSSL_SEARCH_PATH "C:/OpenSSL-Win64") -- SET(OPENSSL_SEARCH_LIB_PATH "${OPENSSL_SEARCH_PATH}/lib64") -- IF (DEFINED ENV{PAHO_WINDOWS_BUILD_BIT}) -- IF ($ENV{PAHO_WINDOWS_BUILD_BIT} STREQUAL "x86") -- SET(OPENSSL_SEARCH_PATH "C:/OpenSSL-Win32") -- SET(OPENSSL_SEARCH_LIB_PATH "${OPENSSL_SEARCH_PATH}/lib32") -- ENDIF () -- ENDIF () -- ELSE() -- SET(OPENSSL_SEARCH_LIB_PATH "${OPENSSL_SEARCH_PATH}/lib64") -- ENDIF () -- -- FIND_PATH(OPENSSL_INCLUDE_DIR openssl/ssl.h -- HINTS ${OPENSSL_SEARCH_PATH}/include) -- FIND_LIBRARY(OPENSSL_LIB NAMES ssl libssl ssleay32 -- 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) -+ -+ 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}") 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..e4c1cfef62d63 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.dependencies["paho-mqtt-c"].options.asynchronous + tc.variables["PAHO_MQTT_C_WITH_SSL"] = self.dependencies["paho-mqtt-c"].options.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 27420c52474ee..5fed002dda09d 100644 --- a/recipes/paho-mqtt-c/config.yml +++ b/recipes/paho-mqtt-c/config.yml @@ -1,19 +1,19 @@ versions: - "1.3.0": + "1.3.13": folder: "all" - "1.3.1": + "1.3.12": folder: "all" - "1.3.4": + "1.3.11": folder: "all" - "1.3.5": + "1.3.10": folder: "all" - "1.3.6": + "1.3.9": folder: "all" "1.3.8": folder: "all" - "1.3.9": + "1.3.6": folder: "all" - "1.3.10": + "1.3.5": folder: "all" - "1.3.11": + "1.3.4": folder: "all" diff --git a/recipes/paho-mqtt-cpp/all/CMakeLists.txt b/recipes/paho-mqtt-cpp/all/CMakeLists.txt deleted file mode 100644 index d17aaff199b4a..0000000000000 --- a/recipes/paho-mqtt-cpp/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-cpp/all/conandata.yml b/recipes/paho-mqtt-cpp/all/conandata.yml index 9f0236641e7c1..e14c99ec20579 100644 --- a/recipes/paho-mqtt-cpp/all/conandata.yml +++ b/recipes/paho-mqtt-cpp/all/conandata.yml @@ -1,23 +1,30 @@ sources: + "1.4.1": + url: "https://github.com/eclipse/paho.mqtt.cpp/archive/v1.4.1.tar.gz" + sha256: "48e7ba6e1032aa73e4d985a7387e02a77cc5807a8420d16790b84b941d86374e" + "1.4.0": + url: "https://github.com/eclipse/paho.mqtt.cpp/archive/v1.4.0.tar.gz" + sha256: "758c504b585402fbeb47822e52897239bbd53b4236ac3908cc040e09d2a8d8e1" + "1.3.2": + url: "https://github.com/eclipse/paho.mqtt.cpp/archive/v1.3.2.tar.gz" + sha256: "c271d521287f417102b447b3d1e8d17be0e0f6a3b0b653334ebcd2ccd20d1e46" "1.2.0": - sha256: 435e97e4d5b1da13daa26cadd3e83fe9d154930abaa78b8ff1b8c854b5345d8b - url: https://github.com/eclipse/paho.mqtt.cpp/archive/v1.2.0.tar.gz - "1.1": - sha256: cb0343349ed91ef51d0e76ae860d19435a730d3d355e57886bb090014cb70bbe - url: https://github.com/eclipse/paho.mqtt.cpp/archive/v1.1.tar.gz - "1.0.1": - sha256: e97386d159b811e534b98d21e3f6881ab2b43678ec026da7525d5c21ebc292ff - url: https://github.com/eclipse/paho.mqtt.cpp/archive/v1.0.1.tar.gz + url: "https://github.com/eclipse/paho.mqtt.cpp/archive/v1.2.0.tar.gz" + sha256: "435e97e4d5b1da13daa26cadd3e83fe9d154930abaa78b8ff1b8c854b5345d8b" patches: - "1.1": - - patch_file: "patches/1.1/0001-deadlock_and_remlog-for-1-1.patch" - base_path: "source_subfolder" - - patch_file: "patches/1.1/0002-ios_fix.patch" - base_path: "source_subfolder" - "1.0.1": - - patch_file: "patches/1.0.1/0001-fix-cmake-module-path.patch" - base_path: "source_subfolder" - - patch_file: "patches/1.0.1/0002-fix-cmake-find-paho-mqtt-c-static.patch" - base_path: "source_subfolder" - - patch_file: "patches/1.0.1/0003-fix-paho-mqtt-cpp-config-cmake.patch" - base_path: "source_subfolder" + "1.4.1": + - patch_file: "patches/1.4.1-0001-fix-cmake.patch" + patch_description: "CMake: Honor fPIC option" + patch_type: "conan" + "1.4.0": + - patch_file: "patches/1.4.0-0001-fix-cmake.patch" + patch_description: "CMake: Honor fPIC option" + patch_type: "conan" + "1.3.2": + - patch_file: "patches/1.3.2-0001-fix-cmake.patch" + patch_description: "CMake: Honor fPIC option and properly link paho-mqtt-c to object target" + patch_type: "conan" + "1.2.0": + - patch_file: "patches/1.2.0-0001-fix-cmake.patch" + patch_description: "CMake: Honor fPIC option and properly link paho-mqtt-c to object target" + patch_type: "conan" diff --git a/recipes/paho-mqtt-cpp/all/conanfile.py b/recipes/paho-mqtt-cpp/all/conanfile.py index 2bff945b71909..29c655cc42b87 100644 --- a/recipes/paho-mqtt-cpp/all/conanfile.py +++ b/recipes/paho-mqtt-cpp/all/conanfile.py @@ -1,32 +1,38 @@ +from conan import ConanFile, conan_version +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import apply_conandata_patches, export_conandata_patches, copy, rmdir, get +from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version import os -from conans import CMake, ConanFile, tools -from conans.errors import ConanInvalidConfiguration + +required_conan_version = ">=1.55.0" class PahoMqttCppConan(ConanFile): name = "paho-mqtt-cpp" + description = "The open-source client implementations of MQTT and MQTT-SN" + license = "EPL-1.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/eclipse/paho.mqtt.cpp" topics = ("mqtt", "iot", "eclipse", "ssl", "paho", "cpp") - license = "EPL-1.0" - description = "The open-source client implementations of MQTT and MQTT-SN" - exports_sources = ["CMakeLists.txt", "patches/**"] - generators = "cmake", "cmake_find_package" + package_type = "library" settings = "os", "arch", "compiler", "build_type" - options = {"shared": [True, False], - "fPIC": [True, False], - "ssl": [True, False], - } - default_options = {"shared": False, - "fPIC": True, - "ssl": 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 _min_cppstd(self): + return 11 + + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -34,71 +40,71 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + suffix = "" if Version(conan_version).major < "2" else "/*" + self.options[f"paho-mqtt-c{suffix}"].shared = self.options.shared - minimal_cpp_standard = "11" - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, minimal_cpp_standard) + def layout(self): + cmake_layout(self, src_folder="src") - self.options["paho-mqtt-c"].shared = self.options.shared - self.options["paho-mqtt-c"].ssl = self.options.ssl + def requirements(self): + # Headers are exposed https://github.com/conan-io/conan-center-index/pull/16760#issuecomment-1502420549 + # Symbols are exposed "_MQTTProperties_free", referenced from: mqtt::connect_options::~connect_options() in test_package.cpp.o + self.requires("paho-mqtt-c/1.3.13", transitive_headers=True, transitive_libs=True) def validate(self): - if self.options["paho-mqtt-c"].shared != self.options.shared: - raise ConanInvalidConfiguration("{} requires paho-mqtt-c to have a matching 'shared' option.".format(self.name)) - if self.options["paho-mqtt-c"].ssl != self.options.ssl: - raise ConanInvalidConfiguration("{} requires paho-mqtt-c to have a matching 'ssl' option.".format(self.name)) + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) - def requirements(self): - if tools.Version(self.version) >= "1.2.0": - self.requires("paho-mqtt-c/1.3.9") - else: - self.requires("paho-mqtt-c/1.3.1") # https://github.com/eclipse/paho.mqtt.cpp/releases/tag/v1.1 + if self.dependencies["paho-mqtt-c"].options.shared != self.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} requires paho-mqtt-c to have a matching 'shared' option.") 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["PAHO_BUILD_DOCUMENTATION"] = False - self._cmake.definitions["PAHO_BUILD_SAMPLES"] = False - self._cmake.definitions["PAHO_BUILD_STATIC"] = not self.options.shared - self._cmake.definitions["PAHO_BUILD_SHARED"] = self.options.shared - self._cmake.definitions["PAHO_WITH_SSL"] = self.options.ssl - 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["PAHO_BUILD_DOCUMENTATION"] = False + tc.variables["PAHO_BUILD_SAMPLES"] = False + tc.variables["PAHO_BUILD_STATIC"] = not self.options.shared + tc.variables["PAHO_BUILD_SHARED"] = self.options.shared + tc.variables["PAHO_WITH_SSL"] = self.dependencies["paho-mqtt-c"].options.ssl + tc.generate() + deps = CMakeDeps(self) + if Version(self.version) < "1.4.0": + deps.set_property("paho-mqtt-c", "cmake_file_name", "PahoMqttC") + deps.set_property("paho-mqtt-c", "cmake_target_name", "PahoMqttC::PahoMqttC") + deps.generate() def build(self): - # See this conversation https://github.com/conan-io/conan-center-index/pull/4096#discussion_r556119143 - # Changed by https://github.com/eclipse/paho.mqtt.c/commit/f875768984574fede6065c8ede0a7eac890a6e09 - # and https://github.com/eclipse/paho.mqtt.c/commit/c116b725fff631180414a6e99701977715a4a690 - # FIXME: after https://github.com/conan-io/conan/pull/8053#pullrequestreview-541120387 - if tools.Version(self.version) < "1.2.0" and tools.Version(self.deps_cpp_info["paho-mqtt-c"].version) >= "1.3.2": - raise ConanInvalidConfiguration("{}/{} requires paho-mqtt-c =< 1.3.1".format(self.name, self.version)) - - 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("edl-v10", src=self._source_subfolder, dst="licenses") - self.copy("epl-v10", src=self._source_subfolder, dst="licenses") - self.copy("notice.html", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, "edl-v10", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "epl-v10", 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")) + 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"] = "PahoMqttCpp" - self.cpp_info.names["cmake_find_package_multi"] = "PahoMqttCpp" target = "paho-mqttpp3" if self.options.shared else "paho-mqttpp3-static" - self.cpp_info.components["paho-mqttpp"].names["cmake_find_package"] = target - self.cpp_info.components["paho-mqttpp"].names["cmake_find_package_multi"] = target - self.cpp_info.components["paho-mqttpp"].requires = ["paho-mqtt-c::paho-mqtt-c"] + self.cpp_info.set_property("cmake_file_name", "PahoMqttCpp") + self.cpp_info.set_property("cmake_target_name", f"PahoMqttCpp::{target}") + # TODO: back to root level once conan v1 support removed if self.settings.os == "Windows": self.cpp_info.components["paho-mqttpp"].libs = [target] else: self.cpp_info.components["paho-mqttpp"].libs = ["paho-mqttpp3"] + + # TODO: to remove once conan v1 support removed + self.cpp_info.names["cmake_find_package"] = "PahoMqttCpp" + self.cpp_info.names["cmake_find_package_multi"] = "PahoMqttCpp" + self.cpp_info.components["paho-mqttpp"].names["cmake_find_package"] = target + self.cpp_info.components["paho-mqttpp"].names["cmake_find_package_multi"] = target + self.cpp_info.components["paho-mqttpp"].set_property("cmake_target_name", f"PahoMqttCpp::{target}") + self.cpp_info.components["paho-mqttpp"].requires = ["paho-mqtt-c::paho-mqtt-c"] diff --git a/recipes/paho-mqtt-cpp/all/patches/1.0.1/0001-fix-cmake-module-path.patch b/recipes/paho-mqtt-cpp/all/patches/1.0.1/0001-fix-cmake-module-path.patch deleted file mode 100644 index 1eae81cadb7a3..0000000000000 --- a/recipes/paho-mqtt-cpp/all/patches/1.0.1/0001-fix-cmake-module-path.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 1f6ab07..bb0b31f 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -69,7 +69,7 @@ endif() - ## --- Build directories --- - - # For the paho_mqtt_c module --list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) -+list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) - add_subdirectory(src) - - # --- Documentation --- - diff --git a/recipes/paho-mqtt-cpp/all/patches/1.0.1/0002-fix-cmake-find-paho-mqtt-c-static.patch b/recipes/paho-mqtt-cpp/all/patches/1.0.1/0002-fix-cmake-find-paho-mqtt-c-static.patch deleted file mode 100644 index 5846fe7e82581..0000000000000 --- a/recipes/paho-mqtt-cpp/all/patches/1.0.1/0002-fix-cmake-find-paho-mqtt-c-static.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff --git a/cmake/FindPahoMqttC.cmake b/cmake/FindPahoMqttC.cmake -index 10c2bfa..a03b226 100644 ---- a/cmake/FindPahoMqttC.cmake -+++ b/cmake/FindPahoMqttC.cmake -@@ -5,6 +5,10 @@ if(PAHO_WITH_SSL) - else() - set(_PAHO_MQTT_C_LIB_NAME paho-mqtt3a) - endif() -+# add suffix when using static Paho MQTT C library variant -+if(PAHO_BUILD_STATIC) -+ set(_PAHO_MQTT_C_LIB_NAME ${_PAHO_MQTT_C_LIB_NAME}-static) -+endif() - - find_library(PAHO_MQTT_C_LIBRARIES NAMES ${_PAHO_MQTT_C_LIB_NAME}) - unset(_PAHO_MQTT_C_LIB_NAME) - diff --git a/recipes/paho-mqtt-cpp/all/patches/1.0.1/0003-fix-paho-mqtt-cpp-config-cmake.patch b/recipes/paho-mqtt-cpp/all/patches/1.0.1/0003-fix-paho-mqtt-cpp-config-cmake.patch deleted file mode 100644 index c84f74f66c0de..0000000000000 --- a/recipes/paho-mqtt-cpp/all/patches/1.0.1/0003-fix-paho-mqtt-cpp-config-cmake.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/cmake/PahoMqttCppConfig.cmake.in b/cmake/PahoMqttCppConfig.cmake.in -index e06dc68..f1137fc 100644 ---- a/cmake/PahoMqttCppConfig.cmake.in -+++ b/cmake/PahoMqttCppConfig.cmake.in -@@ -1,6 +1,11 @@ -+set(PAHO_BUILD_STATIC @PAHO_BUILD_STATIC@) -+set(PAHO_BUILD_SHARED @PAHO_BUILD_SHARED@) -+set(PAHO_WITH_SSL @PAHO_WITH_SSL@) -+ - include(CMakeFindDependencyMacro) - list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) - find_dependency(PahoMqttC REQUIRED) - list(REMOVE_AT CMAKE_MODULE_PATH -1) - - include("${CMAKE_CURRENT_LIST_DIR}/@package_name@Targets.cmake") -+ - diff --git a/recipes/paho-mqtt-cpp/all/patches/1.1/0001-deadlock_and_remlog-for-1-1.patch b/recipes/paho-mqtt-cpp/all/patches/1.1/0001-deadlock_and_remlog-for-1-1.patch deleted file mode 100644 index 4aec911f54ce3..0000000000000 --- a/recipes/paho-mqtt-cpp/all/patches/1.1/0001-deadlock_and_remlog-for-1-1.patch +++ /dev/null @@ -1,360 +0,0 @@ -diff --git a/src/async_client.cpp b/src/async_client.cpp -index c536b77..1a89662 100644 ---- a/src/async_client.cpp -+++ b/src/async_client.cpp -@@ -34,27 +34,6 @@ - #define MQTTAsync_createOptions_initializer5 { {'M', 'Q', 'C', 'O'}, 0, 0, 100, MQTTVERSION_5 } - #endif - --///////////////////////////////////////////////////////////////////////////// --// Paho C logger -- --enum LOG_LEVELS { -- INVALID_LEVEL = -1, -- TRACE_MAX = 1, -- TRACE_MED, -- TRACE_MIN, -- TRACE_PROTOCOL, -- LOG_PROTOCOL = TRACE_PROTOCOL, -- LOG_ERROR, -- LOG_SEVERE, -- LOG_FATAL, --}; -- --extern "C" { -- void Log(enum LOG_LEVELS, int, const char *, ...); --} -- --///////////////////////////////////////////////////////////////////////////// -- - namespace mqtt { - - ///////////////////////////////////////////////////////////////////////////// -@@ -150,8 +129,6 @@ async_client::~async_client() - // is notified of success on a normal connect with callbacks. - void async_client::on_connected(void* context, char* cause) - { -- ::Log(TRACE_MIN, -1, "[cpp] on_connected"); -- - if (context) { - async_client* cli = static_cast(context); - callback* cb = cli->userCallback_; -@@ -172,8 +149,6 @@ void async_client::on_connected(void* context, char* cause) - // MQTTAsync_setCallbacks(). - void async_client::on_connection_lost(void *context, char *cause) - { -- ::Log(TRACE_MIN, -1, "[cpp] on_connection lost"); -- - if (context) { - async_client* cli = static_cast(context); - callback* cb = cli->userCallback_; -@@ -193,6 +168,22 @@ void async_client::on_connection_lost(void *context, char *cause) - } - } - -+// Callback from the C lib for when a disconnect packet is received from -+// the server. -+void async_client::on_disconnected(void* context, MQTTProperties* cprops, -+ MQTTReasonCodes reasonCode) -+{ -+ if (context) { -+ async_client* cli = static_cast(context); -+ auto& disconnectedHandler = cli->disconnectedHandler_; -+ -+ if (disconnectedHandler) { -+ properties props(*cprops); -+ disconnectedHandler(props, ReasonCode(reasonCode)); -+ } -+ } -+} -+ - // Callback for when a subscribed message arrives. - // This is called from the MQTTAsync_messageArrived registered via - // MQTTAsync_setCallbacks(). -@@ -365,6 +356,13 @@ void async_client::set_connection_lost_handler(connection_handler cb) - &async_client::on_connection_lost)); - } - -+void async_client::set_disconnected_handler(disconnected_handler cb) -+{ -+ disconnectedHandler_ = cb; -+ check_ret(::MQTTAsync_setDisconnected(cli_, this, -+ &async_client::on_disconnected)); -+} -+ - void async_client::set_message_callback(message_handler cb) - { - msgHandler_ = cb; -diff --git a/src/mqtt/async_client.h b/src/mqtt/async_client.h -index 4323071..4bbd95c 100644 ---- a/src/mqtt/async_client.h -+++ b/src/mqtt/async_client.h -@@ -32,6 +32,7 @@ - #include "mqtt/delivery_token.h" - #include "mqtt/iclient_persistence.h" - #include "mqtt/iaction_listener.h" -+#include "mqtt/properties.h" - #include "mqtt/exception.h" - #include "mqtt/message.h" - #include "mqtt/callback.h" -@@ -84,6 +85,8 @@ public: - using message_handler = std::function; - /** Handler type for when a connecion is made or lost */ - using connection_handler = std::function; -+ /** Handler type for when a disconnect packet is received */ -+ using disconnected_handler = std::function; - - private: - /** Lock guard type for this class */ -@@ -105,10 +108,12 @@ private: - std::unique_ptr persist_; - /** Callback supplied by the user (if any) */ - callback* userCallback_; -- /** Connection handler */ -+ /** Connection handler */ - connection_handler connHandler_; -- /** Connection lost handler */ -+ /** Connection lost handler */ - connection_handler connLostHandler_; -+ /** Disconnected handler */ -+ disconnected_handler disconnectedHandler_; - /** Message handler (if any) */ - message_handler msgHandler_; - /** Copy of connect token (for re-connects) */ -@@ -120,9 +125,11 @@ private: - /** A queue of messages for consumer API */ - consumer_queue_type que_; - -- /** Callbacks from the C library */ -+ /** Callbacks from the C library */ - static void on_connected(void* context, char* cause); - static void on_connection_lost(void *context, char *cause); -+ static void on_disconnected(void* context, MQTTProperties* cprops, -+ MQTTReasonCodes reasonCode); - static int on_message_arrived(void* context, char* topicName, int topicLen, - MQTTAsync_message* msg); - static void on_delivery_complete(void* context, MQTTAsync_token tok); -@@ -234,6 +241,11 @@ public: - * @param cb Callback functor for when the connection is lost. - */ - void set_connection_lost_handler(connection_handler cb) /*override*/; -+ /** -+ * Callback for when a disconnect packet is received from the server. -+ * @param cb Callback for when the disconnect packet is received. -+ */ -+ void set_disconnected_handler(disconnected_handler cb) /*override*/; - /** - * Sets the callback for when a message arrives from the broker. - * Note that the application can only have one message handler which can -diff --git a/src/mqtt/thread_queue.h b/src/mqtt/thread_queue.h -index 94c3fea..5dafe6e 100644 ---- a/src/mqtt/thread_queue.h -+++ b/src/mqtt/thread_queue.h -@@ -31,6 +31,7 @@ - #include - #include - #include -+#include - - namespace mqtt { - -@@ -102,9 +103,9 @@ public: - /** - * Constructs a queue with the specified capacity. - * @param cap The maximum number of items that can be placed in the -- * queue. -+ * queue. The minimum capacity is 1. - */ -- explicit thread_queue(size_t cap) : cap_(cap) {} -+ explicit thread_queue(size_t cap) : cap_(std::max(cap, 1)) {} - /** - * Determine if the queue is empty. - * @return @em true if there are no elements in the queue, @em false if -@@ -148,11 +149,11 @@ public: - */ - void put(value_type val) { - unique_guard g(lock_); -- size_type n = que_.size(); -- if (n >= cap_) -+ if (que_.size() >= cap_) - notFullCond_.wait(g, [=]{return que_.size() < cap_;}); -+ bool wasEmpty = que_.empty(); - que_.emplace(std::move(val)); -- if (n == 0) { -+ if (wasEmpty) { - g.unlock(); - notEmptyCond_.notify_one(); - } -@@ -187,11 +188,11 @@ public: - template - bool try_put_for(value_type* val, const std::chrono::duration& relTime) { - unique_guard g(lock_); -- size_type n = que_.size(); -- if (n >= cap_ && !notFullCond_.wait_for(g, relTime, [=]{return que_.size() < cap_;})) -+ if (que_.size() >= cap_ && !notFullCond_.wait_for(g, relTime, [=]{return que_.size() < cap_;})) - return false; -+ bool wasEmpty = que_.empty(); - que_.emplace(std::move(val)); -- if (n == 0) { -+ if (wasEmpty) { - g.unlock(); - notEmptyCond_.notify_one(); - } -@@ -210,11 +211,11 @@ public: - template - bool try_put_until(value_type* val, const std::chrono::time_point& absTime) { - unique_guard g(lock_); -- size_type n = que_.size(); -- if (n >= cap_ && !notFullCond_.wait_until(g, absTime, [=]{return que_.size() < cap_;})) -+ if (que_.size() >= cap_ && !notFullCond_.wait_until(g, absTime, [=]{return que_.size() < cap_;})) - return false; -+ bool wasEmpty = que_.empty(); - que_.emplace(std::move(val)); -- if (n == 0) { -+ if (wasEmpty) { - g.unlock(); - notEmptyCond_.notify_one(); - } -@@ -228,12 +229,11 @@ public: - */ - void get(value_type* val) { - unique_guard g(lock_); -- auto n = que_.size(); -- if (n == 0) -+ if (que_.empty()) - notEmptyCond_.wait(g, [=]{return !que_.empty();}); - *val = std::move(que_.front()); - que_.pop(); -- if (n == cap_) { -+ if (que_.size() == cap_-1) { - g.unlock(); - notFullCond_.notify_one(); - } -@@ -246,12 +246,11 @@ public: - */ - value_type get() { - unique_guard g(lock_); -- auto n = que_.size(); -- if (n == 0) -+ if (que_.empty()) - notEmptyCond_.wait(g, [=]{return !que_.empty();}); - value_type val = std::move(que_.front()); - que_.pop(); -- if (n == cap_) { -+ if (que_.size() == cap_-1) { - g.unlock(); - notFullCond_.notify_one(); - } -@@ -267,12 +266,11 @@ public: - */ - bool try_get(value_type* val) { - unique_guard g(lock_); -- auto n = que_.size(); -- if (n == 0) -+ if (que_.empty()) - return false; - *val = std::move(que_.front()); - que_.pop(); -- if (n == cap_) { -+ if (que_.size() == cap_-1) { - g.unlock(); - notFullCond_.notify_one(); - } -@@ -291,12 +289,11 @@ public: - template - bool try_get_for(value_type* val, const std::chrono::duration& relTime) { - unique_guard g(lock_); -- auto n = que_.size(); -- if (n == 0 && !notEmptyCond_.wait_for(g, relTime, [=]{return !que_.empty();})) -+ if (que_.empty() && !notEmptyCond_.wait_for(g, relTime, [=]{return !que_.empty();})) - return false; - *val = std::move(que_.front()); - que_.pop(); -- if (n == cap_) { -+ if (que_.size() == cap_-1) { - g.unlock(); - notFullCond_.notify_one(); - } -@@ -315,12 +312,11 @@ public: - template - bool try_get_until(value_type* val, const std::chrono::time_point& absTime) { - unique_guard g(lock_); -- auto n = que_.size(); -- if (n == 0 && !notEmptyCond_.wait_until(g, absTime, [=]{return !que_.empty();})) -+ if (que_.empty() && !notEmptyCond_.wait_until(g, absTime, [=]{return !que_.empty();})) - return false; - *val = std::move(que_.front()); - que_.pop(); -- if (n == cap_) { -+ if (que_.size() == cap_-1) { - g.unlock(); - notFullCond_.notify_one(); - } -diff --git a/src/token.cpp b/src/token.cpp -index ffbf816..3853cf2 100644 ---- a/src/token.cpp -+++ b/src/token.cpp -@@ -23,27 +23,6 @@ - - #include - --///////////////////////////////////////////////////////////////////////////// --// Paho C logger -- --enum LOG_LEVELS { -- INVALID_LEVEL = -1, -- TRACE_MAX = 1, -- TRACE_MED, -- TRACE_MIN, -- TRACE_PROTOCOL, -- LOG_PROTOCOL = TRACE_PROTOCOL, -- LOG_ERROR, -- LOG_SEVERE, -- LOG_FATAL, --}; -- --extern "C" { -- void Log(enum LOG_LEVELS, int, const char *, ...); --} -- --///////////////////////////////////////////////////////////////////////////// -- - namespace mqtt { - - // -------------------------------------------------------------------------- -@@ -110,8 +89,6 @@ void token::on_failure5(void* context, MQTTAsync_failureData5* rsp) - // - void token::on_success(MQTTAsync_successData* rsp) - { -- ::Log(TRACE_MIN, -1, "[cpp] on_success"); -- - unique_lock g(lock_); - iaction_listener* listener = listener_; - -@@ -154,8 +131,6 @@ void token::on_success(MQTTAsync_successData* rsp) - // - void token::on_success5(MQTTAsync_successData5* rsp) - { -- ::Log(TRACE_MIN, -1, "[cpp] on_success5"); -- - unique_lock g(lock_); - iaction_listener* listener = listener_; - if (rsp) { -@@ -197,8 +172,6 @@ void token::on_success5(MQTTAsync_successData5* rsp) - // - void token::on_failure(MQTTAsync_failureData* rsp) - { -- ::Log(TRACE_MIN, -1, "[cpp] on_failure"); -- - unique_lock g(lock_); - iaction_listener* listener = listener_; - if (rsp) { -@@ -230,8 +203,6 @@ void token::on_failure(MQTTAsync_failureData* rsp) - // - void token::on_failure5(MQTTAsync_failureData5* rsp) - { -- ::Log(TRACE_MIN, -1, "[cpp] on_failure5"); -- - unique_lock g(lock_); - iaction_listener* listener = listener_; - if (rsp) { diff --git a/recipes/paho-mqtt-cpp/all/patches/1.1/0002-ios_fix.patch b/recipes/paho-mqtt-cpp/all/patches/1.1/0002-ios_fix.patch deleted file mode 100644 index ed09f85a50c45..0000000000000 --- a/recipes/paho-mqtt-cpp/all/patches/1.1/0002-ios_fix.patch +++ /dev/null @@ -1,118 +0,0 @@ -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 4e9b7c4..5cc6327 100644 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -41,7 +41,7 @@ find_package(Threads REQUIRED) - - ## --- Use object library to optimize compilation --- - --add_library(paho-cpp-objs OBJECT -+set (PAHO-CPP-SRC - async_client.cpp - client.cpp - disconnect_options.cpp -@@ -51,56 +51,51 @@ add_library(paho-cpp-objs OBJECT - response_options.cpp - ssl_options.cpp - string_collection.cpp -- subscribe_options.cpp -+ subscribe_options.cpp - token.cpp - topic.cpp - connect_options.cpp - will_options.cpp - ) - --## install the shared library --#install(TARGETS paho-cpp-objs EXPORT PahoMqttCpp --# OBJECTS DESTINATION ${CMAKE_INSTALL_LIBDIR} --#) -+if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "iOS") -+ add_library(paho-cpp-objs OBJECT ${PAHO-CPP-SRC}) - --# Object libraries can't use target_link_libraries in order to take advantage --# of transitive usage requirements until CMake 3.12. This is a workaround: --#target_include_directories(OBJS PRIVATE ${PAHO_MQTT_C_INCLUDE_DIRS}) -- --target_include_directories(paho-cpp-objs -+ target_include_directories(paho-cpp-objs - PUBLIC - $ - $ - PRIVATE - ${PAHO_MQTT_C_INCLUDE_DIRS} - src --) -+ ) -+ -+endif() - - - ## --- Build the shared library, if requested --- - - if(PAHO_BUILD_SHARED) - ## create the shared library -- add_library(paho-mqttpp3 SHARED $) -+ if (${CMAKE_SYSTEM_NAME} STREQUAL "iOS") -+ add_library(paho-mqttpp3 SHARED ${PAHO-CPP-SRC}) -+ else() -+ add_library(paho-mqttpp3 SHARED $) -+ endif() - - ## add dependencies to the shared library - target_link_libraries(paho-mqttpp3 - PRIVATE ${LIBS_SYSTEM} - PUBLIC PahoMqttC::PahoMqttC Threads::Threads) - -- # It would be nice to exort the include paths from the obj lib, but we -- # get an export error. Perhaps in a future version? -- # -- # CMake Error: install(EXPORT "PahoMqttCpp" ...) includes target "paho-mqttpp3" -- # which requires target "paho-cpp-objs" that is not in the export set. -- -- #target_include_directories(paho-mqttpp3 PUBLIC -- # $ -- #) - -- target_include_directories(paho-mqttpp3 PUBLIC -- $ -- $ -+ target_include_directories(paho-mqttpp3 -+ PUBLIC -+ $ -+ $ -+ PRIVATE -+ ${PAHO_MQTT_C_INCLUDE_DIRS} -+ src - ) - - ## set the shared library soname -@@ -119,16 +114,24 @@ endif() - - if(PAHO_BUILD_STATIC) - ## create the static library -- add_library(paho-mqttpp3-static STATIC $) -+ if (${CMAKE_SYSTEM_NAME} STREQUAL "iOS") -+ add_library(paho-mqttpp3-static STATIC ${PAHO-CPP-SRC}) -+ else() -+ add_library(paho-mqttpp3-static STATIC $) -+ endif() - - ## add dependencies to the shared library - target_link_libraries(paho-mqttpp3-static - PRIVATE ${LIBS_SYSTEM} - PUBLIC PahoMqttC::PahoMqttC Threads::Threads) - -- target_include_directories(paho-mqttpp3-static PUBLIC -- $ -- $ -+ target_include_directories(paho-mqttpp3-static -+ PUBLIC -+ $ -+ $ -+ PRIVATE -+ ${PAHO_MQTT_C_INCLUDE_DIRS} -+ src - ) - - ## install the static library diff --git a/recipes/paho-mqtt-cpp/all/patches/1.2.0-0001-fix-cmake.patch b/recipes/paho-mqtt-cpp/all/patches/1.2.0-0001-fix-cmake.patch new file mode 100644 index 0000000000000..060c0957c43a8 --- /dev/null +++ b/recipes/paho-mqtt-cpp/all/patches/1.2.0-0001-fix-cmake.patch @@ -0,0 +1,26 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -57,7 +57,6 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) + set(CMAKE_CXX_EXTENSIONS OFF) + + # Generate position-independent code (-fPIC on UNIX) +-set(CMAKE_POSITION_INDEPENDENT_CODE ON) + + # --- System Libraries --- + +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -73,9 +73,12 @@ target_include_directories(paho-cpp-objs + $ + $ + PRIVATE +- ${PAHO_MQTT_C_INCLUDE_DIRS} + src + ) ++target_link_libraries(paho-cpp-objs PUBLIC PahoMqttC::PahoMqttC) ++if(PAHO_BUILD_SHARED) ++ set_target_properties(paho-cpp-objs PROPERTIES POSITION_INDEPENDENT_CODE ON) ++endif() + + + ## --- Build the shared library, if requested --- diff --git a/recipes/paho-mqtt-cpp/all/patches/1.3.2-0001-fix-cmake.patch b/recipes/paho-mqtt-cpp/all/patches/1.3.2-0001-fix-cmake.patch new file mode 100644 index 0000000000000..f2fe425491b50 --- /dev/null +++ b/recipes/paho-mqtt-cpp/all/patches/1.3.2-0001-fix-cmake.patch @@ -0,0 +1,26 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -58,7 +58,6 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) + set(CMAKE_CXX_EXTENSIONS OFF) + + # Generate position-independent code (-fPIC on UNIX) +-set(CMAKE_POSITION_INDEPENDENT_CODE ON) + + # --- System Libraries --- + +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -82,9 +82,12 @@ target_include_directories(paho-cpp-objs + $ + $ + PRIVATE +- ${PAHO_MQTT_C_INCLUDE_DIRS} + src + ) ++target_link_libraries(paho-cpp-objs PUBLIC PahoMqttC::PahoMqttC) ++if(PAHO_BUILD_SHARED) ++ set_target_properties(paho-cpp-objs PROPERTIES POSITION_INDEPENDENT_CODE ON) ++endif() + + target_compile_definitions(paho-cpp-objs PRIVATE PAHO_MQTTPP_EXPORTS) + diff --git a/recipes/paho-mqtt-cpp/all/patches/1.4.0-0001-fix-cmake.patch b/recipes/paho-mqtt-cpp/all/patches/1.4.0-0001-fix-cmake.patch new file mode 100644 index 0000000000000..3a9eac127ef96 --- /dev/null +++ b/recipes/paho-mqtt-cpp/all/patches/1.4.0-0001-fix-cmake.patch @@ -0,0 +1,25 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 1155844..ace2e61 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -107,7 +107,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) + set(CMAKE_CXX_EXTENSIONS OFF) + + # Generate position-independent code (-fPIC on UNIX) +-set(CMAKE_POSITION_INDEPENDENT_CODE ON) ++# set(CMAKE_POSITION_INDEPENDENT_CODE ON) + + # --- System Details --- + +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index c8b213d..2898972 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -68,6 +68,7 @@ if(PAHO_BUILD_SHARED) + set_target_properties(paho-mqttpp3 PROPERTIES + VERSION ${PROJECT_VERSION} + SOVERSION ${PROJECT_VERSION_MAJOR} ++ POSITION_INDEPENDENT_CODE ON + ) + endif() + diff --git a/recipes/paho-mqtt-cpp/all/patches/1.4.1-0001-fix-cmake.patch b/recipes/paho-mqtt-cpp/all/patches/1.4.1-0001-fix-cmake.patch new file mode 100644 index 0000000000000..2a2ea837355aa --- /dev/null +++ b/recipes/paho-mqtt-cpp/all/patches/1.4.1-0001-fix-cmake.patch @@ -0,0 +1,21 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -107,7 +107,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) + set(CMAKE_CXX_EXTENSIONS OFF) + + # Generate position-independent code (-fPIC on UNIX) +-set(CMAKE_POSITION_INDEPENDENT_CODE ON) ++# set(CMAKE_POSITION_INDEPENDENT_CODE ON) + + # --- System Details --- + +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -68,6 +68,7 @@ if(PAHO_BUILD_SHARED) + set_target_properties(paho-mqttpp3 PROPERTIES + VERSION ${PROJECT_VERSION} + SOVERSION ${PROJECT_VERSION_MAJOR} ++ POSITION_INDEPENDENT_CODE ON + ) + endif() + diff --git a/recipes/paho-mqtt-cpp/all/test_package/CMakeLists.txt b/recipes/paho-mqtt-cpp/all/test_package/CMakeLists.txt index fdc6d02a8116f..ff0d0d7fdb39c 100644 --- a/recipes/paho-mqtt-cpp/all/test_package/CMakeLists.txt +++ b/recipes/paho-mqtt-cpp/all/test_package/CMakeLists.txt @@ -1,15 +1,11 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.15) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +project(test_package LANGUAGES CXX) find_package(PahoMqttCpp REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) -if(PAHO_MQTT_CPP_SHARED) - target_link_libraries(${PROJECT_NAME} PahoMqttCpp::paho-mqttpp3) -else() - target_link_libraries(${PROJECT_NAME} PahoMqttCpp::paho-mqttpp3-static) -endif() +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +target_link_libraries(${PROJECT_NAME} PRIVATE + $<$:PahoMqttCpp::paho-mqttpp3> + $<$>:PahoMqttCpp::paho-mqttpp3-static>) diff --git a/recipes/paho-mqtt-cpp/all/test_package/conanfile.py b/recipes/paho-mqtt-cpp/all/test_package/conanfile.py index 6cf3c118599bc..a3dc3d0a3dd9f 100644 --- a/recipes/paho-mqtt-cpp/all/test_package/conanfile.py +++ b/recipes/paho-mqtt-cpp/all/test_package/conanfile.py @@ -1,17 +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, CMakeDeps import os class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + generators = "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() + deps = CMakeDeps(self) + deps.generate() def build(self): cmake = CMake(self) - cmake.definitions["PAHO_MQTT_CPP_SHARED"] = self.options["paho-mqtt-cpp"].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/paho-mqtt-cpp/all/test_package/test_package.cpp b/recipes/paho-mqtt-cpp/all/test_package/test_package.cpp index e71b1ad6ab6d7..59652bb6459ca 100644 --- a/recipes/paho-mqtt-cpp/all/test_package/test_package.cpp +++ b/recipes/paho-mqtt-cpp/all/test_package/test_package.cpp @@ -1,20 +1,10 @@ -#include -#include "mqtt/async_client.h" -#include "mqtt/client.h" +#include +#include "mqtt/message.h" -const std::string SERVER_ADDRESS { "tcp://localhost:1883" }; -const std::string CLIENT_ID { "consume" }; - -int main(int argc, char* argv[]) -{ - mqtt::connect_options connOpts; - connOpts.set_keep_alive_interval(20); - connOpts.set_clean_session(true); - - mqtt::async_client cli_async(SERVER_ADDRESS, CLIENT_ID); - mqtt::client cli(SERVER_ADDRESS, CLIENT_ID); +int main() { + mqtt::message msg("hello", "Hello there", 11, 1, true); + std::cout << "MQTT topic: " << msg.get_topic() << std::endl; return 0; } - diff --git a/recipes/paho-mqtt-cpp/all/test_v1_package/CMakeLists.txt b/recipes/paho-mqtt-cpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/paho-mqtt-cpp/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/paho-mqtt-cpp/all/test_v1_package/conanfile.py b/recipes/paho-mqtt-cpp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/paho-mqtt-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/paho-mqtt-cpp/config.yml b/recipes/paho-mqtt-cpp/config.yml index 1970391ed5cca..cc08f3a574b59 100644 --- a/recipes/paho-mqtt-cpp/config.yml +++ b/recipes/paho-mqtt-cpp/config.yml @@ -1,7 +1,9 @@ versions: - "1.0.1": + "1.4.1": folder: "all" - "1.1": + "1.4.0": + folder: "all" + "1.3.2": folder: "all" "1.2.0": folder: "all" diff --git a/recipes/pango/all/conandata.yml b/recipes/pango/all/conandata.yml index 1d8c33548e913..c6a58de488d3e 100644 --- a/recipes/pango/all/conandata.yml +++ b/recipes/pango/all/conandata.yml @@ -1,16 +1,25 @@ sources: - "1.48.9": - url: "https://github.com/GNOME/pango/archive/1.48.9.tar.gz" - sha256: "6c78162507debd3389dab9f045cfa0b03cb44c432fb21979d4acf45db1b93781" - "1.49.3": - url: "https://github.com/GNOME/pango/archive/1.49.3.tar.gz" - sha256: "2bba081ba680b900a1285d7c9699c0058bf93c3c6b25acaa77214708fb7cb19b" - "1.50.7": - url: "https://github.com/GNOME/pango/archive/1.50.7.tar.gz" - sha256: "4964dc5f1a17464de3c1b91c16a0153429e2f73e81cfdea3229a6370b9ab8e5a" - "1.50.8": - url: "https://download.gnome.org/sources/pango/1.50/pango-1.50.8.tar.xz" - sha256: "cf626f59dd146c023174c4034920e9667f1d25ac2c1569516d63136c311255fa" + "1.54.0": + url: "https://download.gnome.org/sources/pango/1.54/pango-1.54.0.tar.xz" + sha256: "8a9eed75021ee734d7fc0fdf3a65c3bba51dfefe4ae51a9b414a60c70b2d1ed8" + "1.51.0": + url: "https://download.gnome.org/sources/pango/1.51/pango-1.51.0.tar.xz" + sha256: "74efc109ae6f903bbe6af77eaa2ac6094b8ee245a2e23f132a7a8f0862d1a9f5" + "1.50.14": + url: "https://download.gnome.org/sources/pango/1.50/pango-1.50.14.tar.xz" + sha256: "1d67f205bfc318c27a29cfdfb6828568df566795df0cb51d2189cde7f2d581e8" "1.50.10": url: "https://download.gnome.org/sources/pango/1.50/pango-1.50.10.tar.xz" sha256: "7e5d2f1e40854d24a9a2c4d093bafe75dcdbeccdf1de43e4437332eabed64966" + "1.50.8": + url: "https://download.gnome.org/sources/pango/1.50/pango-1.50.8.tar.xz" + sha256: "cf626f59dd146c023174c4034920e9667f1d25ac2c1569516d63136c311255fa" + "1.50.7": + url: "https://github.com/GNOME/pango/archive/1.50.7.tar.gz" + sha256: "4964dc5f1a17464de3c1b91c16a0153429e2f73e81cfdea3229a6370b9ab8e5a" + "1.49.3": + url: "https://github.com/GNOME/pango/archive/1.49.3.tar.gz" + sha256: "2bba081ba680b900a1285d7c9699c0058bf93c3c6b25acaa77214708fb7cb19b" + "1.48.9": + url: "https://github.com/GNOME/pango/archive/1.48.9.tar.gz" + sha256: "6c78162507debd3389dab9f045cfa0b03cb44c432fb21979d4acf45db1b93781" diff --git a/recipes/pango/all/conanfile.py b/recipes/pango/all/conanfile.py index 7c23b65c48a80..b822fb21641da 100644 --- a/recipes/pango/all/conanfile.py +++ b/recipes/pango/all/conanfile.py @@ -1,207 +1,293 @@ import os import glob -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 +from conan.tools.apple import is_apple_os +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 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.60.0 <2 || >=2.0.5" -required_conan_version = ">=1.51.3" class PangoConan(ConanFile): name = "pango" - license = "LGPL-2.0-and-later" + license = "LGPL-2.0-or-later" url = "https://github.com/conan-io/conan-center-index" description = "Internationalized text layout and rendering library" homepage = "https://www.pango.org/" - topics = ("conan", "fontconfig", "fonts", "freedesktop") + topics = ("fontconfig", "fonts", "freedesktop") + package_type = "library" settings = "os", "compiler", "build_type", "arch" - options = {"shared": [True, False], "fPIC": [True, False], "with_libthai": [True, False], "with_cairo": [True, False], "with_xft": [True, False, "auto"], "with_freetype": [True, False, "auto"], "with_fontconfig": [True, False, "auto"]} - default_options = {"shared": False, "fPIC": True, "with_libthai": False, "with_cairo": True, "with_xft": "auto", "with_freetype": "auto", "with_fontconfig": "auto"} - generators = "pkg_config" - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - - def validate(self): - 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") - - if self.options.with_xft and (not self.options.with_freetype or not self.options.with_fontconfig): - raise ConanInvalidConfiguration("Xft requires freetype and fontconfig") - - if self.options.shared and (not self.options["glib"].shared - or not self.options["harfbuzz"].shared or - (self.options.with_cairo - and not self.options["cairo"].shared)): - raise ConanInvalidConfiguration( - "Linking a shared library against static glib can cause unexpected behaviour." - ) - + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_libthai": [True, False], + "with_cairo": [True, False], + "with_xft": [True, False], + "with_freetype": [True, False], + "with_fontconfig": [True, False], + "with_introspection": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_libthai": False, + "with_cairo": True, + "with_xft": True, + # TODO: Currently can't actually disable this in Macos at least, + # it always shows up as detected in meson + "with_freetype": True, + "with_fontconfig": True, + "with_introspection": False, + } def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + if self.settings.os not in ["FreeBSD", "Linux"]: + del self.options.with_xft - def configure(self): - if self.options.shared: - del self.options.fPIC - - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + # Optional in Windows/Macos but false by default + # https://gitlab.gnome.org/GNOME/pango/-/blob/1.54.0/meson.build#L242 + if self.settings.os in ["Macos", "Windows"]: + self.options.with_fontconfig = False + self.options.with_freetype = False - if self.options.with_xft == "auto": - self.options.with_xft = self.settings.os in ["Linux", "FreeBSD"] - if self.options.with_freetype == "auto": - self.options.with_freetype = not self.settings.os in ["Windows", "Macos"] - if self.options.with_fontconfig == "auto": - self.options.with_fontconfig = not self.settings.os in ["Windows", "Macos"] + def configure(self): if self.options.shared: - self.options["glib"].shared = True - self.options["harfbuzz"].shared = True - if self.options.with_cairo: - self.options["cairo"].shared = True + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") - def build_requirements(self): - self.build_requires("pkgconf/1.7.4") - self.build_requires("meson/0.63.2") + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): if self.options.with_freetype: - self.requires("freetype/2.12.1") - + self.requires("freetype/2.13.2") if self.options.with_fontconfig: - self.requires("fontconfig/2.13.93") - if self.options.with_xft: - self.requires("libxft/2.3.4") - if self.options.with_xft and self.options.with_fontconfig and self.options.with_freetype: - self.requires("xorg/system") # for xorg::xrender + self.requires("fontconfig/2.15.0") + if self.options.get_safe("with_xft"): + self.requires("libxft/2.3.8") + self.requires("xorg/system") # for xorg::xrender if self.options.with_cairo: - self.requires("cairo/1.17.4") - self.requires("harfbuzz/5.1.0") - self.requires("glib/2.73.3") - self.requires("fribidi/1.0.12") + # "pango/pangocairo.h" includes "cairo.h" + self.requires("cairo/1.18.0", transitive_headers=True) + self.requires("glib/2.78.3", transitive_headers=True, transitive_libs=True) + self.requires("fribidi/1.0.13") + # "pango/pango-coverage.h" includes "hb.h" + self.requires("harfbuzz/8.3.0", transitive_headers=True) - def source(self): - get(self, **self.conan_data["sources"][self.version], - strip_root=True, destination=self._source_subfolder) + def validate(self): + if ( + self.settings.compiler == "gcc" + and Version(self.settings.compiler.version) < "5" + ): + raise ConanInvalidConfiguration(f"{self.name} does not support GCC before version 5. Contributions are welcome.") + + if self.options.get_safe("with_xft"): + if not self.options.with_freetype or not self.options.with_fontconfig: + raise ConanInvalidConfiguration(f"-o=&:with_xft=True requires -o=&:with_freetype=True and -o=&:with_fontconfig=True") + + 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 _configure_meson(self): - defs = {} - defs["introspection"] = "disabled" + # Can't be turned off outside Macos/Windows + # https://gitlab.gnome.org/GNOME/pango/-/blob/1.54.0/meson.build#L240 + if self.settings.os not in ["Macos", "Windows"] and not self.options.with_fontconfig: + raise ConanInvalidConfiguration(f"{self.ref} requires -o=&:with_fontconfig=True for {self.settings.os}") - defs["libthai"] = "enabled" if self.options.with_libthai else "disabled" - defs["cairo"] = "enabled" if self.options.with_cairo else "disabled" - defs["xft"] = "enabled" if self.options.with_xft else "disabled" - defs["fontconfig"] = "enabled" if self.options.with_fontconfig else "disabled" - defs["freetype"] = "enabled" if self.options.with_freetype else "disabled" + if (self.options.with_fontconfig and self.options.with_freetype + and not self.dependencies["cairo"].options.with_fontconfig): + raise ConanInvalidConfiguration(f"{self.ref} with -o=&:with_fontconfig=True and -o=&:with_freetype=True requires -o=cairo/*:with_fontconfig=True") - meson = Meson(self) - meson.configure(build_folder=self._build_subfolder, source_folder=self._source_subfolder, defs=defs, args=['--wrap-mode=nofallback']) - return meson + if self.options.shared: + if not self.dependencies["glib"].options.shared: + raise ConanInvalidConfiguration( + "Linking a shared library against static glib can cause unexpected behaviour." + ) + if not self.dependencies["harfbuzz"].options.shared: + raise ConanInvalidConfiguration( + "Linking a shared library against static harfbuzz can cause unexpected behaviour." + ) + if self.options.with_cairo and not self.dependencies["cairo"].options.shared: + raise ConanInvalidConfiguration( + "Linking a shared library against static cairo can cause unexpected behaviour." + ) - def build(self): - meson_build = os.path.join(self._source_subfolder, "meson.build") + def build_requirements(self): + self.tool_requires("glib/") + self.tool_requires("meson/[>=1.2.3 <2]") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/[>=2.2 <3]") + if self.options.with_introspection: + self.tool_requires("gobject-introspection/1.78.1") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + VirtualBuildEnv(self).generate() + + deps = PkgConfigDeps(self) + if self.options.with_introspection: + # gnome.generate_gir() in Meson looks for gobject-introspection-1.0.pc + deps.build_context_activated = ["gobject-introspection"] + deps.generate() + + enabled_disabled = lambda opt: "enabled" if opt else "disabled" + tc = MesonToolchain(self) + tc.project_options["introspection"] = enabled_disabled(self.options.with_introspection) + tc.project_options["libthai"] = enabled_disabled(self.options.with_libthai) + tc.project_options["cairo"] = enabled_disabled(self.options.with_cairo) + tc.project_options["xft"] = enabled_disabled(self.options.get_safe("with_xft")) + tc.project_options["fontconfig"] = enabled_disabled(self.options.with_fontconfig) + tc.project_options["freetype"] = enabled_disabled(self.options.with_freetype) + tc.generate() + + def _patch_sources(self): + meson_build = os.path.join(self.source_folder, "meson.build") 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() - def package(self): - self.copy(pattern="COPYING", dst="licenses", src=self._source_subfolder) - with tools.environment_append(VisualStudioBuildEnvironment(self).vars) if is_msvc(self) else tools.no_op(): - meson = self._configure_meson() - meson.install() + def build(self): + self._patch_sources() + meson = Meson(self) + meson.configure() + meson.build() + + def _fix_library_names(self, path): if is_msvc(self): - with chdir(self, os.path.join(self.package_folder, "lib")): + with chdir(self, path): for filename_old in glob.glob("*.a"): filename_new = filename_old[3:-2] + ".lib" self.output.info(f"rename {filename_old} into {filename_new}") rename(self, filename_old, filename_new) + + def package(self): + copy(self, "COPYING", self.source_folder, os.path.join(self.package_folder, "licenses")) + meson = Meson(self) + meson.install() + self._fix_library_names(os.path.join(self.package_folder, "lib")) rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) rm(self, "*.pdb", self.package_folder, recursive=True) + if self.options.with_introspection: + os.rename(os.path.join(self.package_folder, "share"), + os.path.join(self.package_folder, "res")) def package_info(self): - self.cpp_info.components['pango_'].libs = ['pango-1.0'] - self.cpp_info.components['pango_'].names['pkg_config'] = 'pango' - if self.settings.os in ["Linux","FreeBSD"]: - self.cpp_info.components['pango_'].system_libs.append("m") - self.cpp_info.components['pango_'].requires.append('glib::glib-2.0') - self.cpp_info.components['pango_'].requires.append('glib::gobject-2.0') - self.cpp_info.components['pango_'].requires.append('glib::gio-2.0') - self.cpp_info.components['pango_'].requires.append('fribidi::fribidi') - self.cpp_info.components['pango_'].requires.append('harfbuzz::harfbuzz') + self.cpp_info.components["pango_"].libs = ["pango-1.0"] + self.cpp_info.components["pango_"].set_property("pkg_config_name", "pango") + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["pango_"].system_libs.append("m") + self.cpp_info.components["pango_"].requires.append("glib::glib-2.0") + self.cpp_info.components["pango_"].requires.append("glib::gobject-2.0") + self.cpp_info.components["pango_"].requires.append("glib::gio-2.0") + self.cpp_info.components["pango_"].requires.append("fribidi::fribidi") + self.cpp_info.components["pango_"].requires.append("harfbuzz::harfbuzz") if self.options.with_fontconfig: - self.cpp_info.components['pango_'].requires.append('fontconfig::fontconfig') - + self.cpp_info.components["pango_"].requires.append("fontconfig::fontconfig") - if self.options.with_xft: - self.cpp_info.components['pango_'].requires.append('libxft::libxft') - # Pango only uses xrender when Xft, fontconfig and freetype are enabled - if self.options.with_fontconfig and self.options.with_freetype: - self.cpp_info.components['pango_'].requires.append('xorg::xrender') + if self.options.get_safe("with_xft"): + # Pango only uses xrender when Xft, fontconfig and freetype are enabled, which if with_xft is true, + # means that the other options are true because they are checked in the validate() method + self.cpp_info.components["pango_"].requires.extend(["libxft::libxft", "xorg::xrender"]) if self.options.with_cairo: - self.cpp_info.components['pango_'].requires.append('cairo::cairo_') - self.cpp_info.components['pango_'].includedirs = [os.path.join(self.package_folder, "include", "pango-1.0")] - - if self.options.with_freetype: - self.cpp_info.components['pangoft2'].libs = ['pangoft2-1.0'] - self.cpp_info.components['pangoft2'].names['pkg_config'] = 'pangoft2' - self.cpp_info.components['pangoft2'].requires = ['pango_', 'freetype::freetype'] - self.cpp_info.components['pangoft2'].includedirs = [os.path.join(self.package_folder, "include", "pango-1.0")] + self.cpp_info.components["pango_"].requires.append("cairo::cairo_") + self.cpp_info.components["pango_"].includedirs = [ + os.path.join(self.package_folder, "include", "pango-1.0") + ] + + if self.options.with_introspection: + self.cpp_info.components["pango_"].resdirs = ["res"] + self.buildenv_info.append_path("GI_GIR_PATH", os.path.join(self.package_folder, "res", "gir-1.0")) + self.buildenv_info.append_path("GI_TYPELIB_PATH", os.path.join(self.package_folder, "lib", "girepository-1.0")) + self.env_info.GI_GIR_PATH.append(os.path.join(self.package_folder, "res", "gir-1.0")) + self.env_info.GI_TYPELIB_PATH.append(os.path.join(self.package_folder, "lib", "girepository-1.0")) + + # From meson.build: "To build pangoft2, we need HarfBuzz, FontConfig and FreeType" + if self.options.with_freetype and self.options.with_fontconfig: + self.cpp_info.components["pangoft2"].libs = ["pangoft2-1.0"] + self.cpp_info.components["pangoft2"].set_property("pkg_config_name", "pangoft2") + self.cpp_info.components["pangoft2"].requires = [ + "pango_", + "freetype::freetype", + "fontconfig::fontconfig", + ] + self.cpp_info.components["pangoft2"].includedirs = [ + os.path.join(self.package_folder, "include", "pango-1.0") + ] + + # https://gitlab.gnome.org/GNOME/pango/-/blob/1.54.0/meson.build#L320 + self.cpp_info.components["pango_"].requires.append("freetype::freetype") if self.options.with_fontconfig: - self.cpp_info.components['pangofc'].names['pkg_config'] = 'pangofc' + self.cpp_info.components["pangofc"].set_property("pkg_config_name", "pangofc") if self.options.with_freetype: - self.cpp_info.components['pangofc'].requires = ['pangoft2'] + # pangoft2 is always built if pango has fontconfig and freetype support + self.cpp_info.components["pangofc"].requires = ["freetype::freetype", "harfbuzz::harfbuzz", "pangoft2"] + elif self.options.with_freetype: + self.cpp_info.components["pango_"].requires.append("freetype::freetype") if self.settings.os != "Windows": - self.cpp_info.components['pangoroot'].names['pkg_config'] = 'pangoroot' + self.cpp_info.components["pangoroot"].set_property("pkg_config_name", "pangoroot") if self.options.with_freetype: - self.cpp_info.components['pangoroot'].requires = ['pangoft2'] - - if self.options.with_xft: - self.cpp_info.components['pangoxft'].libs = ['pangoxft-1.0'] - self.cpp_info.components['pangoxft'].names['pkg_config'] = 'pangoxft' - self.cpp_info.components['pangoxft'].requires = ['pango_', 'pangoft2'] - self.cpp_info.components['pangoxft'].includedirs = [os.path.join(self.package_folder, "include", "pango-1.0")] + self.cpp_info.components["pangoroot"].requires = ["pangoft2"] + + if self.options.get_safe("with_xft"): + self.cpp_info.components["pangoxft"].libs = ["pangoxft-1.0"] + self.cpp_info.components["pangoxft"].set_property("pkg_config_name", "pangoxft") + # pangoft2 is always built if pango has fontconfig and freetype support, + # which is always true if pango has xft support enabled + self.cpp_info.components["pangoxft"].requires = ["pango_", "pangoft2"] + self.cpp_info.components["pangoxft"].includedirs = [ + os.path.join(self.package_folder, "include", "pango-1.0") + ] if self.settings.os == "Windows": - self.cpp_info.components['pangowin32'].libs = ['pangowin32-1.0'] - self.cpp_info.components['pangowin32'].names['pkg_config'] = 'pangowin32' - self.cpp_info.components['pangowin32'].requires = ['pango_'] - self.cpp_info.components['pangowin32'].system_libs.append('gdi32') + self.cpp_info.components["pangowin32"].libs = ["pangowin32-1.0"] + self.cpp_info.components["pangowin32"].set_property("pkg_config_name", "pangowin32") + self.cpp_info.components["pangowin32"].requires = ["pango_"] + self.cpp_info.components["pangowin32"].system_libs.append("gdi32") + if Version(self.version) >= "1.50.12": + self.cpp_info.components["pangowin32"].system_libs.append("dwrite") + + if is_apple_os(self): + # https://gitlab.gnome.org/GNOME/pango/-/blob/1.54.0/meson.build#L333-346 + self.cpp_info.components["pango_"].frameworks.extend(["CoreText", "CoreFoundation", "ApplicationServices"]) if self.options.with_cairo: - self.cpp_info.components['pangocairo'].libs = ['pangocairo-1.0'] - self.cpp_info.components['pangocairo'].names['pkg_config'] = 'pangocairo' - self.cpp_info.components['pangocairo'].requires = ['pango_'] - if self.options.with_freetype: - self.cpp_info.components['pangocairo'].requires.append('pangoft2') + self.cpp_info.components["pangocairo"].libs = ["pangocairo-1.0"] + self.cpp_info.components["pangocairo"].set_property("pkg_config_name", "pangocairo") + self.cpp_info.components["pangocairo"].requires = ["pango_", "cairo::cairo_"] + if self.options.with_freetype and self.options.with_fontconfig: + # https://gitlab.gnome.org/GNOME/pango/-/blob/1.54.0/meson.build#L506 + self.cpp_info.components["pangocairo"].requires.append("pangoft2") if self.settings.os == "Windows": - self.cpp_info.components['pangocairo'].requires.append('pangowin32') - self.cpp_info.components['pangocairo'].system_libs.append('gdi32') - self.cpp_info.components['pangocairo'].includedirs = [os.path.join(self.package_folder, "include", "pango-1.0")] - - self.env_info.PATH.append(os.path.join(self.package_folder, 'bin')) - - def package_id(self): - 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() + self.cpp_info.components["pangocairo"].requires.append("pangowin32") + self.cpp_info.components["pangocairo"].system_libs.append("gdi32") + self.cpp_info.components["pangocairo"].includedirs = [ + os.path.join(self.package_folder, "include", "pango-1.0") + ] + + self.runenv_info.append_path("PATH", os.path.join(self.package_folder, "bin")) + + # TODO: remove the following when only Conan 2.0 is supported + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) + self.cpp_info.components["pango_"].names["pkg_config"] = "pango" + self.cpp_info.components["pangoft2"].names["pkg_config"] = "pangoft2" + self.cpp_info.components["pangofc"].names["pkg_config"] = "pangofc" + self.cpp_info.components["pangoroot"].names["pkg_config"] = "pangoroot" + self.cpp_info.components["pangoxft"].names["pkg_config"] = "pangoxft" + self.cpp_info.components["pangowin32"].names["pkg_config"] = "pangowin32" + self.cpp_info.components["pangocairo"].names["pkg_config"] = "pangocairo" diff --git a/recipes/pango/all/test_package/CMakeLists.txt b/recipes/pango/all/test_package/CMakeLists.txt index 6b2859c25bddd..c990922a0544d 100644 --- a/recipes/pango/all/test_package/CMakeLists.txt +++ b/recipes/pango/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) -find_package(pango) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(pango REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} pango::pango) +target_link_libraries(${PROJECT_NAME} PRIVATE pango::pango) diff --git a/recipes/pango/all/test_package/conanfile.py b/recipes/pango/all/test_package/conanfile.py index baecd8fdba2aa..ef5d7042163ec 100644 --- a/recipes/pango/all/test_package/conanfile.py +++ b/recipes/pango/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", "pkg_config", "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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/pango/all/test_package/test_package.cpp b/recipes/pango/all/test_package/test_package.cpp index 17022445e9087..20094deaf7d4c 100644 --- a/recipes/pango/all/test_package/test_package.cpp +++ b/recipes/pango/all/test_package/test_package.cpp @@ -3,6 +3,6 @@ int main() { - std::cout << "pango version: " << pango_version_string() << std::endl; + std::cout << "pango version: " << pango_version_string() << "\n"; return 0; } diff --git a/recipes/pango/all/test_v1_package/CMakeLists.txt b/recipes/pango/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/pango/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/pango/all/test_v1_package/conanfile.py b/recipes/pango/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/pango/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/pango/config.yml b/recipes/pango/config.yml index 40891312baffc..2d198a63c6b11 100644 --- a/recipes/pango/config.yml +++ b/recipes/pango/config.yml @@ -1,11 +1,17 @@ versions: - "1.48.9": + "1.54.0": folder: all - "1.49.3": + "1.51.0": folder: all - "1.50.7": + "1.50.14": + folder: all + "1.50.10": folder: all "1.50.8": folder: all - "1.50.10": + "1.50.7": + folder: all + "1.49.3": + folder: all + "1.48.9": folder: all diff --git a/recipes/panzi-portable-endian/all/conandata.yml b/recipes/panzi-portable-endian/all/conandata.yml index 5cba065a6c822..a4dfc7805d29c 100644 --- a/recipes/panzi-portable-endian/all/conandata.yml +++ b/recipes/panzi-portable-endian/all/conandata.yml @@ -1,4 +1,4 @@ sources: - "cci.20150416": - url: "https://gist.github.com/panzi/6856583/archive/1eca2ab34f2301b9641aa73d1016b951fff3fc39.zip" - sha256: "488d5d08215f657e769b31764013ef845355832cc6f1d165e1809fa5fe168eeb" + "cci.20220509": + url: "https://gist.github.com/panzi/6856583/archive/f6512b0830a4e9e06b26e32fc2509d67bbfa93d8.zip" + sha256: "88593bad9a1050779e98f93194b028566df575e06da9f8a60e44fa97a36b92f8" diff --git a/recipes/panzi-portable-endian/all/conanfile.py b/recipes/panzi-portable-endian/all/conanfile.py index 9c18999c225be..5655ba304a520 100644 --- a/recipes/panzi-portable-endian/all/conanfile.py +++ b/recipes/panzi-portable-endian/all/conanfile.py @@ -1,34 +1,43 @@ import os -from conans import ConanFile, tools + +from conan import ConanFile +from conan.tools.files import copy, get, load, save +from conan.tools.layout import basic_layout + +required_conan_version = ">=1.52.0" class PanziPortableEndian(ConanFile): name = "panzi-portable-endian" + description = ("This provides the endian conversion functions from " + "endian.h on Windows, Linux, *BSD, and Mac OS X") + license = "LicenseRef-panzi-portable-endian-public-domain" url = "https://github.com/conan-io/conan-center-index" homepage = "https://gist.github.com/panzi/6856583" - description = "This provides the endian conversion functions form endian.h on Windows, Linux, *BSD, and Mac OS X" - topics = ("conan", "endian") - license = "Unlicense" + topics = ("endian", "header-only") + + 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], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def _extract_license(self): - header = tools.load(os.path.join( - self._source_subfolder, "portable_endian.h")) - license_contents = header[0:(header.find("#ifndef", 1))] - tools.save("LICENSE", license_contents) + header = load(self, os.path.join(self.source_folder, "portable_endian.h")) + license_contents = header[0: (header.find("#ifndef", 1))] + save(self, os.path.join(self.package_folder, "licenses", "LICENSE"), license_contents) def package(self): self._extract_license() - self.copy("LICENSE", dst="licenses") - self.copy(pattern="*.h", dst="include", - src=self._source_subfolder, keep_path=False) + copy(self, "*.h", dst=os.path.join(self.package_folder, "include"), src=self.source_folder, keep_path=False) - def package_id(self): - self.info.header_only() + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/panzi-portable-endian/all/test_package/CMakeLists.txt b/recipes/panzi-portable-endian/all/test_package/CMakeLists.txt index 454c47bb2cbab..272ae426964be 100644 --- a/recipes/panzi-portable-endian/all/test_package/CMakeLists.txt +++ b/recipes/panzi-portable-endian/all/test_package/CMakeLists.txt @@ -1,9 +1,7 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) +cmake_minimum_required(VERSION 3.15) +project(test_package C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(panzi-portable-endian 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 panzi-portable-endian::panzi-portable-endian) diff --git a/recipes/panzi-portable-endian/all/test_package/conanfile.py b/recipes/panzi-portable-endian/all/test_package/conanfile.py index a59a26a52c8dc..ef5d7042163ec 100644 --- a/recipes/panzi-portable-endian/all/test_package/conanfile.py +++ b/recipes/panzi-portable-endian/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" + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/panzi-portable-endian/all/test_package/test_package.c b/recipes/panzi-portable-endian/all/test_package/test_package.c new file mode 100644 index 0000000000000..8a45d0928397d --- /dev/null +++ b/recipes/panzi-portable-endian/all/test_package/test_package.c @@ -0,0 +1,8 @@ +#include + +#include + +int main() { + uint64_t num = 100; + le64toh(num); +} diff --git a/recipes/panzi-portable-endian/all/test_package/test_package.cpp b/recipes/panzi-portable-endian/all/test_package/test_package.cpp deleted file mode 100644 index d5884326032ea..0000000000000 --- a/recipes/panzi-portable-endian/all/test_package/test_package.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include - -#include - -int main() { - uint64_t num = 100; - le64toh(num); -} diff --git a/recipes/panzi-portable-endian/all/test_v1_package/CMakeLists.txt b/recipes/panzi-portable-endian/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/panzi-portable-endian/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/panzi-portable-endian/all/test_v1_package/conanfile.py b/recipes/panzi-portable-endian/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..abcaeed3f89b6 --- /dev/null +++ b/recipes/panzi-portable-endian/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.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/panzi-portable-endian/config.yml b/recipes/panzi-portable-endian/config.yml index 5b6ed6e7fb074..dcdd7cd8a501e 100644 --- a/recipes/panzi-portable-endian/config.yml +++ b/recipes/panzi-portable-endian/config.yml @@ -1,3 +1,3 @@ versions: - "cci.20150416": + "cci.20220509": folder: all diff --git a/recipes/parallel-hashmap/all/conandata.yml b/recipes/parallel-hashmap/all/conandata.yml index 41fe3e31571e0..1162046b50c49 100644 --- a/recipes/parallel-hashmap/all/conandata.yml +++ b/recipes/parallel-hashmap/all/conandata.yml @@ -1,15 +1,27 @@ sources: + "1.4.1": + url: "https://github.com/greg7mdp/parallel-hashmap/archive/refs/tags/v1.4.1.tar.gz" + sha256: "949874f4207b8735422438b23b884fb1f4b926689bb5eebff38cc4d357d09cd2" + "1.4.0": + url: "https://github.com/greg7mdp/parallel-hashmap/archive/refs/tags/v1.4.0.tar.gz" + sha256: "766e05d19c27d9c09e6f9a627868daf451f4fbdd1b617f1bb875fb9402bfb78b" + "1.3.12": + url: "https://github.com/greg7mdp/parallel-hashmap/archive/refs/tags/v1.3.12.tar.gz" + sha256: "0cc203144321924cfbfcc401f42d8204c0dd24e2760c7a1c091baa16d9777c08" + "1.3.11": + url: "https://github.com/greg7mdp/parallel-hashmap/archive/refs/tags/v1.3.11.tar.gz" + sha256: "0515a681bfb24207013786a7737e9d8561302e656689d8a65ea480bbabab460f" "1.3.8": - url: "https://github.com/greg7mdp/parallel-hashmap/archive/v1.3.8.tar.gz" + url: "https://github.com/greg7mdp/parallel-hashmap/archive/refs/tags/v1.3.8.tar.gz" sha256: "c4562ea360dc1dcaddd96a0494c753400364a52c7aa9750de49d8e6a222d28d3" "1.37": - url: "https://github.com/greg7mdp/parallel-hashmap/archive/1.37.tar.gz" + url: "https://github.com/greg7mdp/parallel-hashmap/archive/refs/tags/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" + url: "https://github.com/greg7mdp/parallel-hashmap/archive/refs/tags/1.35.tar.gz" sha256: "308ab6f92e4c6f49304562e352890cf7140de85ce723c097e74fbdec88e0e1ce" "1.34": url: "https://github.com/greg7mdp/parallel-hashmap/archive/refs/tags/1.34.tar.gz" @@ -20,9 +32,3 @@ sources: "1.32": url: "https://github.com/greg7mdp/parallel-hashmap/archive/1.32.tar.gz" sha256: "50cc7abc08f78c6396a33a334e5bc0b3ade121af8604690dae13a1bad47cf07c" - "1.31": - url: "https://github.com/greg7mdp/parallel-hashmap/archive/1.31.tar.gz" - sha256: "1826589041140837f91ab0e3421abbf7e9184454bb83403b5a0359a0bf87bd68" - "1.30": - url: "https://github.com/greg7mdp/parallel-hashmap/archive/1.30.tar.gz" - sha256: "ae14fa41110b5fe211d3f7599318fb1a3e862353c7110cd8370cdc044a98d815" diff --git a/recipes/parallel-hashmap/all/conanfile.py b/recipes/parallel-hashmap/all/conanfile.py index d8dcf1537c358..2714a6823c9e0 100644 --- a/recipes/parallel-hashmap/all/conanfile.py +++ b/recipes/parallel-hashmap/all/conanfile.py @@ -12,12 +12,16 @@ class ParallelHashmapConan(ConanFile): name = "parallel-hashmap" description = "A family of header-only, very fast and memory-friendly hashmap and btree containers." license = "Apache-2.0" - topics = ("parallel-hashmap", "parallel", "hashmap", "btree") - homepage = "https://github.com/greg7mdp/parallel-hashmap" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/greg7mdp/parallel-hashmap" + topics = ("parallel", "hashmap", "btree", "header-only") + package_type = "header-library" 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() @@ -25,15 +29,8 @@ 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) - - def build(self): - pass + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) @@ -66,7 +63,6 @@ def package_info(self): self.cpp_info.set_property("cmake_file_name", "phmap") self.cpp_info.set_property("cmake_target_name", "phmap") self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] # TODO: to remove in conan v2 once cmake_find_package* generators removed diff --git a/recipes/parallel-hashmap/all/test_package/conanfile.py b/recipes/parallel-hashmap/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/parallel-hashmap/all/test_package/conanfile.py +++ b/recipes/parallel-hashmap/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/parallel-hashmap/config.yml b/recipes/parallel-hashmap/config.yml index 2115f091019fe..82038b86a3657 100644 --- a/recipes/parallel-hashmap/config.yml +++ b/recipes/parallel-hashmap/config.yml @@ -1,4 +1,12 @@ versions: + "1.4.1": + folder: all + "1.4.0": + folder: all + "1.3.12": + folder: all + "1.3.11": + folder: all "1.3.8": folder: all "1.37": @@ -13,7 +21,3 @@ versions: folder: all "1.32": folder: all - "1.31": - folder: all - "1.30": - folder: all diff --git a/recipes/parg/all/CMakeLists.txt b/recipes/parg/all/CMakeLists.txt index ea07630def81d..5aea9449b5c81 100644 --- a/recipes/parg/all/CMakeLists.txt +++ b/recipes/parg/all/CMakeLists.txt @@ -1,12 +1,6 @@ -cmake_minimum_required(VERSION 3.4) +cmake_minimum_required(VERSION 3.15) project(cmake_wrapper) -include("conanbuildinfo.cmake") -conan_basic_setup() -set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) - -add_subdirectory("source_subfolder") - -set_target_properties(parg PROPERTIES PUBLIC_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder/parg.h") - +add_subdirectory(src) +set_target_properties(parg PROPERTIES PUBLIC_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/src/parg.h") install(TARGETS parg) diff --git a/recipes/parg/all/conandata.yml b/recipes/parg/all/conandata.yml index 799c3f613ca57..72c50c78f7433 100644 --- a/recipes/parg/all/conandata.yml +++ b/recipes/parg/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.0.3": + url: "https://github.com/jibsen/parg/archive/refs/tags/v1.0.3.tar.gz" + sha256: "cd54a94b4138735f6c9fbdf426a9caa8ffd5bc90988eb02f493bc86de61ce5ad" "1.0.2": url: "https://github.com/jibsen/parg/archive/refs/tags/v1.0.2.tar.gz" sha256: "3c728affd1442c5778cf548d53339132ce033c92fd61f7522d1e59fe6b1b36a8" diff --git a/recipes/parg/all/conanfile.py b/recipes/parg/all/conanfile.py index 0e70a696cc039..ef4d18c549aef 100644 --- a/recipes/parg/all/conanfile.py +++ b/recipes/parg/all/conanfile.py @@ -1,60 +1,79 @@ import os -from conans import ConanFile, CMake, tools + +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.tools.files import copy, get +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" class PargConan(ConanFile): name = "parg" - license = "CC0-1.0" + description = "Parser for argv that works similarly to getopt" + license = ("CC0-1.0", "MIT-0") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/jibsen/parg" - description = "Parser for argv that works similarly to getopt" - topics = ("conan", 'getopt', 'c') - 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 = ("getopt", "c") - def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + package_type = "library" + 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 + 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 + if Version(self.version) < "1.0.3": + self.licenses = "CC0-1.0" + else: + self.licenses = "MIT-0" - 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.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + cmake_layout(self, src_folder="src") + + def build_requirements(self): + self.tool_requires("cmake/[>=3.16 <4]") + + 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"] = self.options.shared + tc.generate() + tc = CMakeDeps(self) + tc.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=self.export_sources_folder) cmake.build() def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + if Version(self.version) < "1.0.3": + copy(self, "COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + else: + copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() + fix_apple_shared_install_name(self) def package_info(self): self.cpp_info.libs = ["parg"] diff --git a/recipes/parg/all/test_package/CMakeLists.txt b/recipes/parg/all/test_package/CMakeLists.txt index 187d95623fba1..ee46ccf27506c 100644 --- a/recipes/parg/all/test_package/CMakeLists.txt +++ b/recipes/parg/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(parg REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) diff --git a/recipes/parg/all/test_package/conanfile.py b/recipes/parg/all/test_package/conanfile.py index 86f0279553123..5030221edcc76 100644 --- a/recipes/parg/all/test_package/conanfile.py +++ b/recipes/parg/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("%s -h" % bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + self.run(f"{bin_path} -h", env="conanrun") diff --git a/recipes/parg/all/test_v1_package/CMakeLists.txt b/recipes/parg/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/parg/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/parg/all/test_v1_package/conanfile.py b/recipes/parg/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..86f0279553123 --- /dev/null +++ b/recipes/parg/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("%s -h" % bin_path, run_environment=True) diff --git a/recipes/parg/config.yml b/recipes/parg/config.yml index 732f7eb9a62dd..6503626e2502c 100644 --- a/recipes/parg/config.yml +++ b/recipes/parg/config.yml @@ -1,3 +1,5 @@ versions: + "1.0.3": + folder: "all" "1.0.2": folder: "all" diff --git a/recipes/parson/all/conanfile.py b/recipes/parson/all/conanfile.py index 41b29d5db87fd..029c0fb72bae0 100644 --- a/recipes/parson/all/conanfile.py +++ b/recipes/parson/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 ParsonConan(ConanFile): @@ -14,6 +14,7 @@ class ParsonConan(ConanFile): 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], @@ -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/parson/all/test_package/conanfile.py b/recipes/parson/all/test_package/conanfile.py index 094bd40f27d12..0a6bc68712d90 100644 --- a/recipes/parson/all/test_package/conanfile.py +++ b/recipes/parson/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 @@ -21,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/parson/all/test_v1_package/CMakeLists.txt b/recipes/parson/all/test_v1_package/CMakeLists.txt index d4d6be1d02e55..0d20897301b68 100644 --- a/recipes/parson/all/test_v1_package/CMakeLists.txt +++ b/recipes/parson/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(parson REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE parson::parson) +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 index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/parson/all/test_v1_package/conanfile.py +++ b/recipes/parson/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/patchelf/all/conandata.yml b/recipes/patchelf/all/conandata.yml index 9385c94daf7b2..0a5b78dee92b9 100644 --- a/recipes/patchelf/all/conandata.yml +++ b/recipes/patchelf/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.18": + url: "https://github.com/NixOS/patchelf/releases/download/0.18.0/patchelf-0.18.0.tar.bz2" + sha256: "1952b2a782ba576279c211ee942e341748fdb44997f704dd53def46cd055470b" "0.13": url: "https://github.com/NixOS/patchelf/archive/0.13.tar.gz" sha256: "60c6aeadb673de9cc1838b630c81f61e31c501de324ef7f1e8094a2431197d09" diff --git a/recipes/patchelf/all/conanfile.py b/recipes/patchelf/all/conanfile.py index 6335b6d0cf6bc..b41b9ff27f477 100644 --- a/recipes/patchelf/all/conanfile.py +++ b/recipes/patchelf/all/conanfile.py @@ -1,11 +1,20 @@ -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, check_min_cppstd +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import copy, get, rmdir +from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain +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.54.0" class PatchElfConan(ConanFile): name = "patchelf" + package_type = "application" description = "A small utility to modify the dynamic linker and RPATH of ELF executables" topics = ("conan", "elf", "linker", "interpreter", "RPATH", "binaries") url = "https://github.com/conan-io/conan-center-index" @@ -13,45 +22,79 @@ class PatchElfConan(ConanFile): license = "GPL-3.0-or-later" settings = "os", "arch", "compiler", "build_type" - _autotools = None + @property + def _min_cppstd(self): + return "11" if Version(self.version) < "0.18" else "17" @property - def _source_subfolder(self): - return "source_subfolder" + def _compilers_minimum_version(self): + return { + "17": { + # patchelf/0.18.0 requires gcc >= 8 + "gcc": "8", + "clang": "5", + "apple-clang": "10", + "Visual Studio": "15", + "msvc": "191", + }, + }.get(self._min_cppstd, {}) + + def layout(self): + basic_layout(self, src_folder="src") def build_requirements(self): - self.build_requires("libtool/2.4.6") + self.tool_requires("libtool/2.4.6") def validate(self): - if not tools.is_apple_os(self.settings.os) and self.settings.os not in ("FreeBSD", "Linux"): - raise ConanInvalidConfiguration("PatchELF is only available for GNU-like operating systems (e.g. Linux)") + if not is_apple_os(self) and self.settings.os not in ("FreeBSD", "Linux"): + raise ConanInvalidConfiguration(f"{self.ref} is only available for GNU-like operating systems (e.g. Linux)") + + 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 generate(self): + env = VirtualBuildEnv(self) + env.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 + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") + + tc = AutotoolsToolchain(self) + tc.generate() + + tc = AutotoolsDeps(self) + tc.generate() def build(self): - with tools.chdir(self._source_subfolder): - self.run("{} -fiv --warnings=all".format(tools.get_env("AUTORECONF")), run_environment=True) - autotools = self._configure_autotools() + autotools = Autotools(self) + autotools.autoreconf() + autotools.configure() autotools.make() def package(self): - self.copy(pattern="COPYING", src=self._source_subfolder, dst="licenses") - 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, "share")) + + rmdir(self, os.path.join(self.package_folder, "share")) def package_id(self): del self.info.settings.compiler 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) diff --git a/recipes/patchelf/all/test_package/conanfile.py b/recipes/patchelf/all/test_package/conanfile.py index 57101a5a6a0d1..4af4d75258f3f 100644 --- a/recipes/patchelf/all/test_package/conanfile.py +++ b/recipes/patchelf/all/test_package/conanfile.py @@ -1,9 +1,15 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run class TestPackageConan(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 tools.cross_building(self, skip_x64_x86=True): - self.run("patchelf --version", run_environment=True) + if can_run(self): + self.run("patchelf --version") diff --git a/recipes/patchelf/all/test_v1_package/conanfile.py b/recipes/patchelf/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..7effccfd4383a --- /dev/null +++ b/recipes/patchelf/all/test_v1_package/conanfile.py @@ -0,0 +1,9 @@ +from conans import ConanFile, CMake, tools + + +class TestPackageV1Conan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + + def test(self): + if not tools.cross_building(self, skip_x64_x86=True): + self.run("patchelf --version", run_environment=True) diff --git a/recipes/patchelf/config.yml b/recipes/patchelf/config.yml index 0782807cb46ce..f1bedb2bb26d8 100644 --- a/recipes/patchelf/config.yml +++ b/recipes/patchelf/config.yml @@ -1,4 +1,6 @@ versions: + "0.18": + folder: all "0.13": folder: all "0.12": diff --git a/recipes/pathie-cpp/all/conandata.yml b/recipes/pathie-cpp/all/conandata.yml new file mode 100644 index 0000000000000..4046bc50f2738 --- /dev/null +++ b/recipes/pathie-cpp/all/conandata.yml @@ -0,0 +1,12 @@ +sources: + "0.1.1": + url: "https://github.com/Quintus/pathie-cpp/archive/refs/tags/v0.1.1.tar.gz" + sha256: "7c2cca0c52ad80792bf6dbeb74213c1791fe9e599058765f5b81fd00f53eb2d3" +patches: + "0.1.1": + - patch_file: "patches/0.1.1-0001-fix-cmake.patch" + patch_description: "separate shtatic and shared build" + patch_type: "conan" + - patch_file: "patches/0.1.1-0002-fix-install-path.patch" + patch_description: "fix install path for windows shared build" + patch_type: "conan" diff --git a/recipes/pathie-cpp/all/conanfile.py b/recipes/pathie-cpp/all/conanfile.py new file mode 100644 index 0000000000000..95acb35802514 --- /dev/null +++ b/recipes/pathie-cpp/all/conanfile.py @@ -0,0 +1,85 @@ +from conan import ConanFile +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rm, rmdir +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.53.0" + +class PathieCppConan(ConanFile): + name = "pathie-cpp" + description = "Small C++ library for crossplatform Unicode path management" + license = "BSD-2-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/Quintus/pathie-cpp" + topics = ("path", "unicode",) + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_stream_replacement": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_stream_replacement": 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 source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["CMAKE_BUILD_SHARED_LIBS"] = self.options.shared + tc.variables["PATHIE_BUILD_STREAM_REPLACEMENTS"] = self.options.with_stream_replacement + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = 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, 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): + self.cpp_info.libs = ["pathie"] + + self.cpp_info.set_property("cmake_file_name", "Pathie") + self.cpp_info.set_property("cmake_target_name", "Pathie::Pathie") + + if self.settings.os == "Windows": + self.cpp_info.system_libs.append("shlwapi") + + if is_apple_os(self): + self.cpp_info.system_libs.append("iconv") diff --git a/recipes/pathie-cpp/all/patches/0.1.1-0001-fix-cmake.patch b/recipes/pathie-cpp/all/patches/0.1.1-0001-fix-cmake.patch new file mode 100644 index 0000000000000..50f3218d3b0f1 --- /dev/null +++ b/recipes/pathie-cpp/all/patches/0.1.1-0001-fix-cmake.patch @@ -0,0 +1,47 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index d765179..e31b54b 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -116,12 +116,14 @@ file(GLOB_RECURSE test_sources + # Targets + + # Libraries ++if (NOT BUILD_SHARED_LIBS) + add_library(pathie STATIC ${pathie_sources}) + if(APPLE) + target_link_libraries(pathie iconv) + endif() ++endif() + +-if (CMAKE_BUILD_SHARED_LIBS) ++if (BUILD_SHARED_LIBS) + add_library(pathie-dynamic SHARED ${pathie_sources}) + set_target_properties(pathie-dynamic PROPERTIES OUTPUT_NAME pathie) + if(APPLE) +@@ -130,9 +132,10 @@ if (CMAKE_BUILD_SHARED_LIBS) + endif() + + if(WIN32) ++ if (NOT BUILD_SHARED_LIBS) + target_link_libraries(pathie shlwapi) +- +- if (CMAKE_BUILD_SHARED_LIBS) ++ endif() ++ if (BUILD_SHARED_LIBS) + target_link_libraries(pathie-dynamic shlwapi) + endif() + endif() +@@ -152,10 +155,12 @@ endif() + ######################################## + # Installation information + ++if (NOT BUILD_SHARED_LIBS) + install(TARGETS pathie + DESTINATION lib) ++endif() + +-if (CMAKE_BUILD_SHARED_LIBS) ++if (BUILD_SHARED_LIBS) + install(TARGETS pathie-dynamic + DESTINATION lib) + endif() diff --git a/recipes/pathie-cpp/all/patches/0.1.1-0002-fix-install-path.patch b/recipes/pathie-cpp/all/patches/0.1.1-0002-fix-install-path.patch new file mode 100644 index 0000000000000..fba8edf003ed6 --- /dev/null +++ b/recipes/pathie-cpp/all/patches/0.1.1-0002-fix-install-path.patch @@ -0,0 +1,27 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index e31b54b..bdf279e 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -154,15 +154,19 @@ endif() + + ######################################## + # Installation information +- ++include(GNUInstallDirs) + if (NOT BUILD_SHARED_LIBS) + install(TARGETS pathie +- DESTINATION lib) ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + endif() + + if (BUILD_SHARED_LIBS) + install(TARGETS pathie-dynamic +- DESTINATION lib) ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + endif() + + install(FILES diff --git a/recipes/pathie-cpp/all/test_package/CMakeLists.txt b/recipes/pathie-cpp/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..00bc659fd0252 --- /dev/null +++ b/recipes/pathie-cpp/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(Pathie REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE Pathie::Pathie) diff --git a/recipes/pathie-cpp/all/test_package/conanfile.py b/recipes/pathie-cpp/all/test_package/conanfile.py new file mode 100644 index 0000000000000..ef5d7042163ec --- /dev/null +++ b/recipes/pathie-cpp/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/pathie-cpp/all/test_package/test_package.cpp b/recipes/pathie-cpp/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..62d62074adb6a --- /dev/null +++ b/recipes/pathie-cpp/all/test_package/test_package.cpp @@ -0,0 +1,16 @@ +#include +#include + +static bool callback(const Pathie::Path& entry) +{ + std::cout << entry << std::endl; + return true; +} + +int main() +{ + Pathie::Path dir("."); + dir.find(callback); + + return 0; +} diff --git a/recipes/pathie-cpp/config.yml b/recipes/pathie-cpp/config.yml new file mode 100644 index 0000000000000..b893ff21f7c23 --- /dev/null +++ b/recipes/pathie-cpp/config.yml @@ -0,0 +1,3 @@ +versions: + "0.1.1": + folder: all diff --git a/recipes/pbc/all/conandata.yml b/recipes/pbc/all/conandata.yml index af6c41c5d370b..3a82e91b4ea31 100644 --- a/recipes/pbc/all/conandata.yml +++ b/recipes/pbc/all/conandata.yml @@ -5,4 +5,3 @@ sources: patches: "0.5.14": - patch_file: "patches/0.5.14-0001-fix-config-sub-ios.patch" - base_path: "" diff --git a/recipes/pbc/all/conanfile.py b/recipes/pbc/all/conanfile.py index cef849369307b..2de63fee00601 100644 --- a/recipes/pbc/all/conanfile.py +++ b/recipes/pbc/all/conanfile.py @@ -1,22 +1,40 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, tools import os -required_conan_version = ">=1.33.0" +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import XCRun, to_apple_arch, 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, rm, rmdir, chdir +from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc + +required_conan_version = ">=1.53.0" class PbcConan(ConanFile): name = "pbc" - topics = ("pbc", "crypto", "cryptography", "security", "pairings", "cryptographic") + description = ("The PBC (Pairing-Based Crypto) library is a C library providing " + "low-level routines for pairing-based cryptosystems.") + license = "LGPL-3.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://crypto.stanford.edu/pbc/" - license = "LGPL-3.0" - description = "The PBC (Pairing-Based Crypto) library is a C library providing low-level routines for pairing-based cryptosystems." + topics = ("crypto", "cryptography", "security", "pairings", "cryptographic") + package_type = "library" settings = "os", "arch", "compiler", "build_type" - options = {"shared": [True, False], "fPIC": [True, False]} - default_options = {"shared": False, "fPIC": True} - _autotools = None - exports_sources = "patches/**" + 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": @@ -24,75 +42,68 @@ 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("gmp/6.2.1") + self.requires("gmp/6.3.0", transitive_headers=True, transitive_libs=True) - def build_requirements(self): - self.build_requires("bison/3.7.6") - self.build_requires("flex/2.6.4") + def validate(self): + if is_msvc(self): + raise ConanInvalidConfiguration("pbc is not compatible with MSVC due to use of GNU extensions") - @property - def _settings_build(self): - return getattr(self, "settings_build", self.settings) + def build_requirements(self): + self.tool_requires("flex/2.6.4") + self.tool_requires("bison/3.8.2") def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True) - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment( - self, win_bash=tools.os_info.is_windows - ) - # Need to override environment or configure will fail despite that flex - # is actually available. - args = ["LEX=flex"] - if self.options.shared: - args.extend(["--disable-static", "--enable-shared"]) - else: - args.extend(["--disable-shared", "--enable-static"]) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - # No idea why this is necessary, but if you don't set CC this way, then - # configure complains that it can't find gmp. - if ( - tools.cross_building(self.settings) - and self.settings.compiler == "apple-clang" - ): + def generate(self): + env = VirtualBuildEnv(self) + env.generate() - xcr = tools.XCRun(self.settings) - target = tools.to_apple_arch(self.settings.arch) + "-apple-darwin" + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") + tc = AutotoolsToolchain(self) + tc.configure_args.append("LEX=flex") + # No idea why this is necessary, but if you don't set CC this way, then + # configure complains that it can't find gmp. + if cross_building(self) and self.settings.compiler == "apple-clang": + xcr = XCRun(self) + target = to_apple_arch(self) + "-apple-darwin" min_ios = "" if self.settings.os == "iOS": - min_ios = "-miphoneos-version-min={}".format(self.settings.os.version) - - args.append( - "CC={} -isysroot {} -target {} {}".format( - xcr.cc, xcr.sdk_path, target, min_ios - ) - ) + min_ios = f"-miphoneos-version-min={self.settings.os.version}" + tc.configure_args.append(f"CC={xcr.cc} -isysroot {xcr.sdk_path} -target {target} {min_ios}") + tc.generate() - self._autotools.configure(args=args) - return self._autotools + deps = AutotoolsDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - autotools = self._configure_autotools() - autotools.make() + apply_conandata_patches(self) + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.configure() + autotools.make() def package(self): - self.copy(pattern="COPYING", dst="licenses") - 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", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.install() + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "*.la", self.package_folder, recursive=True) + fix_apple_shared_install_name(self) def package_info(self): self.cpp_info.libs = ["pbc"] - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["m"] diff --git a/recipes/pbc/all/test_package/CMakeLists.txt b/recipes/pbc/all/test_package/CMakeLists.txt index c67cb318985e8..a724a29a8da1f 100644 --- a/recipes/pbc/all/test_package/CMakeLists.txt +++ b/recipes/pbc/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ -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(TARGETS) - -find_package(pbc CONFIG REQUIRED) +find_package(pbc REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) target_link_libraries(${PROJECT_NAME} pbc::pbc) diff --git a/recipes/pbc/all/test_package/conanfile.py b/recipes/pbc/all/test_package/conanfile.py index 49a3a66ea5bad..ef5d7042163ec 100644 --- a/recipes/pbc/all/test_package/conanfile.py +++ b/recipes/pbc/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/pbc/all/test_v1_package/CMakeLists.txt b/recipes/pbc/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/pbc/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/pbc/all/test_v1_package/conanfile.py b/recipes/pbc/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..49a3a66ea5bad --- /dev/null +++ b/recipes/pbc/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/pbtools/all/CMakeLists.txt b/recipes/pbtools/all/CMakeLists.txt deleted file mode 100644 index 432799d5aaab2..0000000000000 --- a/recipes/pbtools/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/lib) diff --git a/recipes/pbtools/all/conandata.yml b/recipes/pbtools/all/conandata.yml index 529d052902f81..236ef4b15fa0a 100644 --- a/recipes/pbtools/all/conandata.yml +++ b/recipes/pbtools/all/conandata.yml @@ -1,7 +1,10 @@ sources: + "0.47.0": + url: "https://github.com/eerimoq/pbtools/archive/0.47.0.tar.gz" + sha256: "f53189ad061e4063d7cb5a3863f778221868b820a1dde4e65b217537c3fa0c9e" "0.45.2": url: "https://github.com/eerimoq/pbtools/archive/0.45.2.tar.gz" sha256: "723967fff6e1d51a078ce7328f937cafe0c32b4e9ab19735cf591d15afc281d3" "0.45.0": url: "https://github.com/eerimoq/pbtools/archive/refs/tags/0.45.0.zip" - sha256: 84b17003f1c7b6c62061e93e11abe8729480338f5f106948ebfefa303c163b75 + sha256: "84b17003f1c7b6c62061e93e11abe8729480338f5f106948ebfefa303c163b75" diff --git a/recipes/pbtools/all/conanfile.py b/recipes/pbtools/all/conanfile.py index 9aee2f753fe6d..8ae53d392140a 100644 --- a/recipes/pbtools/all/conanfile.py +++ b/recipes/pbtools/all/conanfile.py @@ -1,53 +1,64 @@ -import functools -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.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get + + +required_conan_version = ">=1.53.0" class PbtoolsConan(ConanFile): name = "pbtools" description = "A Google Protocol Buffers C library" + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/eerimoq/pbtools" - license = "MIT" topics = ("protobuf", "serialization", "rpc", "protocol-buffers") - 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" - - @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 _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 validate(self): if self.settings.os == "Windows": - raise ConanInvalidConfiguration("This library is not compatible with Windows") + raise ConanInvalidConfiguration(f"{self.ref} is not compatible with 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) - @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.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, "lib")) cmake.build() def package(self): - self.copy(pattern="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() def package_info(self): diff --git a/recipes/pbtools/all/test_package/CMakeLists.txt b/recipes/pbtools/all/test_package/CMakeLists.txt index 9f0ff5e7f11af..e01a140f079aa 100644 --- a/recipes/pbtools/all/test_package/CMakeLists.txt +++ b/recipes/pbtools/all/test_package/CMakeLists.txt @@ -1,10 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(PackageTest C) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) find_package(pbtools REQUIRED CONFIG) -add_executable(test_package test_package.c hello_world.c) -target_link_libraries(test_package pbtools::pbtools) +add_executable(${PROJECT_NAME} test_package.c hello_world.c) +target_link_libraries(${PROJECT_NAME} PRIVATE pbtools::pbtools) diff --git a/recipes/pbtools/all/test_package/conanfile.py b/recipes/pbtools/all/test_package/conanfile.py index 1ed584307b354..bd118a1d0023b 100644 --- a/recipes/pbtools/all/test_package/conanfile.py +++ b/recipes/pbtools/all/test_package/conanfile.py @@ -1,18 +1,26 @@ +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 PbtoolsTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + 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") + self.tool_requires("cmake/[>=3.20]") + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -20,6 +28,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/pbtools/all/test_v1_package/CMakeLists.txt b/recipes/pbtools/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/pbtools/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/pbtools/all/test_v1_package/conanfile.py b/recipes/pbtools/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..1ed584307b354 --- /dev/null +++ b/recipes/pbtools/all/test_v1_package/conanfile.py @@ -0,0 +1,25 @@ +import os + +from conans import ConanFile, CMake, tools + + +class PbtoolsTestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + 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) diff --git a/recipes/pbtools/config.yml b/recipes/pbtools/config.yml index 81c0b9ecee392..06df1f3ce6232 100644 --- a/recipes/pbtools/config.yml +++ b/recipes/pbtools/config.yml @@ -1,4 +1,6 @@ versions: + "0.47.0": + folder: "all" "0.45.2": folder: "all" "0.45.0": diff --git a/recipes/pcapplusplus/all/conandata.yml b/recipes/pcapplusplus/all/conandata.yml index 9786a06e3c7e2..66c9439d2be66 100644 --- a/recipes/pcapplusplus/all/conandata.yml +++ b/recipes/pcapplusplus/all/conandata.yml @@ -8,45 +8,41 @@ 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 diff --git a/recipes/pcapplusplus/all/conanfile.py b/recipes/pcapplusplus/all/conanfile.py index ef9a8444da061..398650c106206 100644 --- a/recipes/pcapplusplus/all/conanfile.py +++ b/recipes/pcapplusplus/all/conanfile.py @@ -1,20 +1,23 @@ +import glob +import os + from conan import ConanFile -from conan.tools import files -from conan.tools.microsoft import is_msvc +from conan.tools.apple import is_apple_os +from conan.tools.files import apply_conandata_patches, copy, chdir, 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, MSBuild, MSBuildToolchain 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.50.0" +required_conan_version = ">=1.57.0" class PcapplusplusConan(ConanFile): name = "pcapplusplus" + package_type = "static-library" license = "Unlicense" description = "PcapPlusPlus is a multiplatform C++ library for capturing, parsing and crafting of network packets" - topics = ("conan", "pcapplusplus", "pcap", "network", "security", "packet") + topics = ("pcap", "network", "security", "packet") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/seladb/PcapPlusPlus" settings = "os", "compiler", "build_type", "arch" @@ -27,23 +30,23 @@ class PcapplusplusConan(ConanFile): "immediate_mode": False, } - exports_sources = "patches/*" - generators = "make" - - @property - def _source_subfolder(self): - return "source_subfolder" - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + basic_layout(self, src_folder="src") + def requirements(self): if self.settings.os == "Windows": - self.requires("pthreads4w/3.0.0") self.requires("npcap/1.70") + if self.version < "22.11": + self.requires("pthreads4w/3.0.0") else: - self.requires("libpcap/1.9.1") + self.requires("libpcap/1.10.1") # TODO: use conan recipe instead of embedded one # self.requires("hash-library/8.0") @@ -55,8 +58,8 @@ def validate(self): raise ConanInvalidConfiguration(f"{self.settings.os} is not supported") 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) @property def _configure_sh_script(self): @@ -69,58 +72,72 @@ def _configure_sh_script(self): def _patch_sources(self): 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"), + replace_in_file(self, os.path.join(self.source_folder, "PcapPlusPlus.mk.common"), "-fPIC", "") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - files.patch(self, **patch) + apply_conandata_patches(self) + if self.settings.os != "Windows": + rename(self, os.path.join(self.source_folder, self._configure_sh_script), os.path.join(self.source_folder, "configure")) + else: + props_file = os.path.join(self.generators_folder, "conantoolchain.props") + vcxproj_templates = glob.glob(f"{self.source_folder}/mk/vs/*.vcxproj.template") + for template_file in vcxproj_templates: + # Load conan-generated conantoolchain.props before Microsoft.Cpp.props + # so that we have precedence over PlatformToolset version + replace_in_file(self, template_file, '', + f'\n') + + def generate(self): + if self.settings.os == "Windows": + tc = MSBuildToolchain(self) + tc.generate() + else: + tc = AutotoolsToolchain(self) + tc.configure_args.clear() # this configure script does not accept the typical arguments + tc.configure_args.extend([ + "--libpcap-include-dir", unix_path(self, self.dependencies["libpcap"].cpp_info.aggregated_components().includedirs[0]), + "--libpcap-lib-dir", unix_path(self, self.dependencies["libpcap"].cpp_info.aggregated_components().includedirs[0]), + ]) + + if self.options.immediate_mode: + tc.configure_args.append("--use-immediate-mode") + if is_apple_os(self) and "arm" in self.settings.arch: + tc.configure_args.append("--arm64") + + tc.generate() def build(self): self._patch_sources() if self.settings.os == "Windows": self._build_windows() else: - self._build_posix() + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.configure() + autotools.make(target="libs") def _build_windows(self): - with files.chdir(self, self._source_subfolder): + with chdir(self, self.source_folder): config_args = [ "configure-windows-visual-studio.bat", - "--pcap-sdk", self.deps_cpp_info["npcap"].rootpath, - "--pthreads-home", self.deps_cpp_info["pthreads4w"].rootpath, - "--vs-version", "vs2015", + "--pcap-sdk", self.dependencies["npcap"].package_folder, + "--vs-version", "vs2015", # this will be later overridden by the props file generated by MSBuildToolchain ] - self.run(" ".join(config_args), run_environment=True) + if self.version < "22.11": + config_args += ["--pthreads-home", self.dependencies["pthreads4w"].package_folder] + self.run(" ".join(config_args), env="conanbuild") 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]), - "--libpcap-lib-dir", tools.unix_path(self.deps_cpp_info["libpcap"].lib_paths[0]), - ] - if self.options.immediate_mode: - config_args.append("--use-immediate-mode") - if tools.is_apple_os(self.settings.os) and "arm" in self.settings.arch: - config_args.append("--arm64") - - autotools = AutoToolsBuildEnvironment(self) - autotools.cxx_flags.extend(["-D{}".format(d) for d in autotools.defines]) - with tools.environment_append(autotools.vars): - self.run(" ".join(config_args), run_environment=True) - autotools.make(target="libs") - 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) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"), keep_path=False) + copy(self, "*.h", src=os.path.join(self.source_folder, "Dist", "header"), dst=os.path.join(self.package_folder, "include")) + copy(self, "*.a", src=os.path.join(self.source_folder, "Dist"), dst=os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, "*.lib", src=os.path.join(self.source_folder, "Dist"), dst=os.path.join(self.package_folder, "lib"), 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"]) diff --git a/recipes/pcapplusplus/all/patches/0001-Pass-CXXFLAGS-CPPFLAGS-when-compiling-3rd-party-sour.patch b/recipes/pcapplusplus/all/patches/0001-Pass-CXXFLAGS-CPPFLAGS-when-compiling-3rd-party-sour.patch index 35cd4fc290ef0..9f23a37847f60 100644 --- a/recipes/pcapplusplus/all/patches/0001-Pass-CXXFLAGS-CPPFLAGS-when-compiling-3rd-party-sour.patch +++ b/recipes/pcapplusplus/all/patches/0001-Pass-CXXFLAGS-CPPFLAGS-when-compiling-3rd-party-sour.patch @@ -5,7 +5,7 @@ Obj/%.o: LightPcapNg/src/%.c @echo Building file: $< - @$(CC) $(INCLUDES) -Wall -O2 $(GLOBAL_FLAGS) $(DEFS) -g -c -o "$@" "$<" -+ @$(CC) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -Wall -O2 $(GLOBAL_FLAGS) $(DEFS) -g -c -o "$@" "$<" ++ @$(CC) $(CPPFLAGS) $(CLFAGS) $(INCLUDES) -Wall -O2 $(GLOBAL_FLAGS) $(DEFS) -g -c -o "$@" "$<" CUR_TARGET := $(notdir $(shell pwd)) diff --git a/recipes/pcapplusplus/all/patches/0002-Pass-CXXFLAGS-CPPFLAGS-when-compiling-3rd-party-sour.patch b/recipes/pcapplusplus/all/patches/0002-Pass-CXXFLAGS-CPPFLAGS-when-compiling-3rd-party-sour.patch index de4fab42fa738..a3df9981b3b4b 100644 --- a/recipes/pcapplusplus/all/patches/0002-Pass-CXXFLAGS-CPPFLAGS-when-compiling-3rd-party-sour.patch +++ b/recipes/pcapplusplus/all/patches/0002-Pass-CXXFLAGS-CPPFLAGS-when-compiling-3rd-party-sour.patch @@ -5,7 +5,7 @@ Obj/%.o: LightPcapNg/src/%.c @echo Building file: $< - @$(CC) $(INCLUDES) -Wall -O2 $(GLOBAL_FLAGS) $(DEFS) -g -c -o "$@" "$<" -+ @$(CC) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -Wall -O2 $(GLOBAL_FLAGS) $(DEFS) -g -c -o "$@" "$<" ++ @$(CC) $(CPPFLAGS) $(CFLAGS) $(INCLUDES) -Wall -O2 $(GLOBAL_FLAGS) $(DEFS) -g -c -o "$@" "$<" CUR_TARGET := $(notdir $(shell pwd)) 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 877f6f7b6d86a..a9fb96656f203 100644 --- a/recipes/pcapplusplus/all/test_package/conanfile.py +++ b/recipes/pcapplusplus/all/test_package/conanfile.py @@ -1,22 +1,19 @@ from conan import ConanFile from conan.tools.build import can_run -from conans import CMake +from conan.tools.cmake import cmake_layout, CMake import os -import shutil -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) - if can_run(self) and self.settings.os == "Windows": - self.requires("libpcap/1.10.1") - def configure(self): - if can_run(self) and self.settings.os == "Windows": - self.options["libpcap"].shared = True + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -25,14 +22,5 @@ def build(self): def test(self): if can_run(self): - if self.settings.os == "Windows": - # 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 - shutil.copy( - os.path.join(self.deps_cpp_info['libpcap'].bin_paths[0], "pcap.dll"), - os.path.join("bin", "wpcap.dll") - ) - bin_path = os.path.join("bin", "test_package") - pcap_file_path = os.path.join(self.source_folder, "1_packet.pcap") - self.run(f"{bin_path} {pcap_file_path}", run_environment=True) + 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/cmake/conandata.yml b/recipes/pcapplusplus/cmake/conandata.yml new file mode 100644 index 0000000000000..ea13a0a560ea1 --- /dev/null +++ b/recipes/pcapplusplus/cmake/conandata.yml @@ -0,0 +1,7 @@ +sources: + "23.09": + url: "https://github.com/seladb/PcapPlusPlus/archive/v23.09.tar.gz" + sha256: "608292f7d2a2e1b7af26adf89347597a6131547eea4e513194bc4f584a40fe74" + "24.09": + url: "https://github.com/seladb/PcapPlusPlus/archive/v24.09.tar.gz" + sha256: "b14998ecf5718c2bfb6f709060e53f7ef67639b98bf2222a3cd23d820d70acdc" diff --git a/recipes/pcapplusplus/cmake/conanfile.py b/recipes/pcapplusplus/cmake/conanfile.py new file mode 100644 index 0000000000000..cea459f86eeb8 --- /dev/null +++ b/recipes/pcapplusplus/cmake/conanfile.py @@ -0,0 +1,112 @@ +import os +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout +from conan.tools.files import copy, get, rmdir, replace_in_file +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration + + +required_conan_version = ">=1.52.0" + + +class PcapplusplusConan(ConanFile): + name = "pcapplusplus" + license = "Unlicense" + description = "PcapPlusPlus is a multiplatform C++ library for capturing, parsing and crafting of network packets" + topics = ("pcap", "network", "security", "packet") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/seladb/PcapPlusPlus" + settings = "os", "arch", "build_type", "compiler" + package_type = "library" + options = { + "fPIC": [True, False], + "shared": [True, False], + "immediate_mode": [True, False], + } + default_options = { + "fPIC": True, + "shared": False, + "immediate_mode": False, + } + + @property + def _min_cppstd(self): + return 11 + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def requirements(self): + if self.settings.os == "Windows": + self.requires("npcap/1.70") + else: + self.requires("libpcap/1.10.1") + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def validate(self): + if Version(self.version) <= "24.09" and self.options.shared and self.settings.os == "Windows": + # https://github.com/seladb/PcapPlusPlus/issues/1396 + raise ConanInvalidConfiguration(f"{self.ref} does not support Windows shared builds for now") + if self.settings.compiler.cppstd: + # popen()/pclose() usage + check_min_cppstd(self, self._min_cppstd) + if self.settings.os not in ("FreeBSD", "Linux", "Macos", "Windows"): + raise ConanInvalidConfiguration(f"{self.settings.os} is not supported") + + def validate_build(self): + compiler_version = Version(self.settings.compiler.version) + if self.settings.compiler == "gcc" and compiler_version < "5.1": + raise ConanInvalidConfiguration("PcapPlusPlus requires GCC >= 5.1") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["PCAPPP_BUILD_TESTS"] = False + tc.variables["PCAPPP_BUILD_EXAMPLES"] = False + tc.variables["BUILD_SHARED_LIBS"] = self.options.shared + if not self.settings.compiler.cppstd: + tc.variables["CMAKE_CXX_STANDARD"] = self._min_cppstd + tc.generate() + + def layout(self): + cmake_layout(self, src_folder="src") + + def _patch_sources(self): + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "set(CMAKE_CXX_STANDARD 11)", + "") + if Version(self.version) >= "24.09": + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "set(CMAKE_POSITION_INDEPENDENT_CODE ON)", + "") + + 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"), 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")) + + def package_info(self): + self.cpp_info.libs = ["Pcap++", "Packet++", "Common++"] + if self.settings.os == "Macos": + self.cpp_info.frameworks = ["CoreFoundation", "SystemConfiguration"] + elif self.settings.os == "Windows": + self.cpp_info.system_libs = ["ws2_32", "iphlpapi"] + elif self.settings.os in ("Linux", "FreeBSD"): + self.cpp_info.system_libs = ["pthread"] + self.cpp_info.set_property("cmake_file_name", "PcapPlusPlus") + self.cpp_info.set_property("cmake_target_name", "PcapPlusPlus::PcapPlusPlus") diff --git a/recipes/pcapplusplus/cmake/test_package/CMakeLists.txt b/recipes/pcapplusplus/cmake/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..d30ed5e5eaa78 --- /dev/null +++ b/recipes/pcapplusplus/cmake/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(PcapPlusPlus REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PcapPlusPlus::PcapPlusPlus) diff --git a/recipes/pcapplusplus/cmake/test_package/conanfile.py b/recipes/pcapplusplus/cmake/test_package/conanfile.py new file mode 100644 index 0000000000000..cc326072eb57b --- /dev/null +++ b/recipes/pcapplusplus/cmake/test_package/conanfile.py @@ -0,0 +1,29 @@ +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", "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) + + 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): + self.run(os.path.join(self.cpp.build.bindirs[0], "test_package"), env="conanrun") diff --git a/recipes/pcapplusplus/cmake/test_package/test_package.cpp b/recipes/pcapplusplus/cmake/test_package/test_package.cpp new file mode 100644 index 0000000000000..65ce01f5c61cb --- /dev/null +++ b/recipes/pcapplusplus/cmake/test_package/test_package.cpp @@ -0,0 +1,8 @@ +#include +#include +#include "pcapplusplus/PcapPlusPlusVersion.h" + +int main() { + std::cout << "PCAP++ VERSION: " << pcpp::getPcapPlusPlusVersionFull() << std::endl; + return EXIT_SUCCESS; +} diff --git a/recipes/pcapplusplus/config.yml b/recipes/pcapplusplus/config.yml index 5a01a9fd55268..7a6e7c1c1ffa6 100644 --- a/recipes/pcapplusplus/config.yml +++ b/recipes/pcapplusplus/config.yml @@ -5,3 +5,9 @@ versions: folder: all "22.05": folder: all + "22.11": + folder: all + "23.09": + folder: cmake + "24.09": + folder: cmake diff --git a/recipes/pcg-cpp/all/conandata.yml b/recipes/pcg-cpp/all/conandata.yml index 19d6cd5450a07..372c7daee9c81 100644 --- a/recipes/pcg-cpp/all/conandata.yml +++ b/recipes/pcg-cpp/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "cci.20220409": + url: "https://github.com/imneme/pcg-cpp/archive/428802d1a5634f96bcd0705fab379ff0113bcf13.tar.gz" + sha256: "79f23706ed0cbc1bb57ea35d50d0abed66898b8f7b0bcf2aaecdfd234863b060" "cci.20210406": url: "https://github.com/imneme/pcg-cpp/archive/ffd522e7188bef30a00c74dc7eb9de5faff90092.tar.gz" sha256: "81e4ab1936971627e6cc49fba279d0891b657d4397fc7940f6e751a37e4fdc94" diff --git a/recipes/pcg-cpp/all/conanfile.py b/recipes/pcg-cpp/all/conanfile.py index ed57b37949e7a..d470b1eadd1c2 100644 --- a/recipes/pcg-cpp/all/conanfile.py +++ b/recipes/pcg-cpp/all/conanfile.py @@ -11,9 +11,10 @@ class PcgcppConan(ConanFile): name = "pcg-cpp" description = "C++ implementation of the PCG family of random number generators." license = ("MIT", "Apache-2.0") - topics = ("pcg-cpp", "pcg", "rng", "random") + topics = ("pcg-cpp", "pcg", "rng", "random", "header-only") homepage = "https://github.com/imneme/pcg-cpp" url = "https://github.com/conan-io/conan-center-index" + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -28,8 +29,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 @@ -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/pcg-cpp/config.yml b/recipes/pcg-cpp/config.yml index 92120b7e9b6de..5055373e8abfa 100644 --- a/recipes/pcg-cpp/config.yml +++ b/recipes/pcg-cpp/config.yml @@ -1,3 +1,5 @@ versions: + "cci.20220409": + folder: "all" "cci.20210406": folder: "all" diff --git a/recipes/pciutils/all/conandata.yml b/recipes/pciutils/all/conandata.yml index 01d5f5a0e9de5..8cdf113d7ef73 100644 --- a/recipes/pciutils/all/conandata.yml +++ b/recipes/pciutils/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "3.12.0": + url: "https://github.com/pciutils/pciutils/archive/v3.12.0.tar.gz" + sha256: "3a76ca02581fed03d0470ba822e72ee06e492442a990062f9638dec90018505f" + "3.10.0": + url: "https://github.com/pciutils/pciutils/archive/v3.10.0.tar.gz" + sha256: "e579d87f1afe2196db7db648857023f80adb500e8194c4488c8b47f9a238c1c6" "3.7.0": - sha256: ea768aa0187ba349391c6c157445ecc2b42e7d671fc1ce8c53ff5ef513f1e2ab - url: https://github.com/pciutils/pciutils/archive/v3.7.0.tar.gz + url: "https://github.com/pciutils/pciutils/archive/v3.7.0.tar.gz" + sha256: "ea768aa0187ba349391c6c157445ecc2b42e7d671fc1ce8c53ff5ef513f1e2ab" diff --git a/recipes/pciutils/all/conanfile.py b/recipes/pciutils/all/conanfile.py index 7de2b56523367..9e375262e618e 100644 --- a/recipes/pciutils/all/conanfile.py +++ b/recipes/pciutils/all/conanfile.py @@ -1,76 +1,128 @@ import os -from conans import ConanFile, tools, AutoToolsBuildEnvironment -from conans.errors import ConanInvalidConfiguration +import shutil + +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import XCRun +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import chdir, copy, get, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps +from conan.tools.layout import basic_layout + +required_conan_version = ">=1.53.0" class PciUtilsConan(ConanFile): name = "pciutils" - license = "BSD-3-Clause" description = "The PCI Utilities package contains a library for portable access to PCI bus" - topics = ("pci", "pci-bus", "hardware", "local-bus") - homepage = "https://github.com/pciutils/pciutils" + license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" - settings = "os", "compiler", "build_type", "arch" - options = {"shared": [True, False], "fPIC": [True, False], "with_zlib": [True, False], "with_udev": [True, False]} - default_options = {"shared": False, "fPIC": True, "with_zlib": True, "with_udev": False} + homepage = "https://github.com/pciutils/pciutils" + topics = ("pci", "pci-bus", "hardware", "local-bus") - @property - def _source_subfolder(self): - return "source_subfolder" + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_zlib": [True, False], + "with_udev": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_zlib": True, + "with_udev": True, + } - def configure(self): - if self.settings.os != "Linux": - raise ConanInvalidConfiguration("Platform {} is currently not supported by this recipe".format(self.settings.os)) + 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 requirements(self): if self.options.with_zlib: - self.requires("zlib/1.2.11") + self.requires("zlib/[>=1.2.11 <2]") if self.options.with_udev: - # TODO: Enable libudev option when available - raise ConanInvalidConfiguration("libudev requires conan-io/conan-center-index#2468") - self.requires("systemd/system") + self.requires("libudev/system") + + def validate(self): + if self.settings.os not in ["Linux", "FreeBSD"]: + raise ConanInvalidConfiguration( + f"Platform {self.settings.os} is currently not supported by this recipe" + ) def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = self.name + "-" + self.version - tools.rename(extracted_dir, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + @property + def _cc(self): + compilers_by_conf = self.conf.get("tools.build:compiler_executables", default={}, check_type=dict) + cxx = compilers_by_conf.get("c") or VirtualBuildEnv(self).vars().get("CC") + if cxx: + return cxx + if self.settings.compiler == "apple-clang": + return XCRun(self).cxx + compiler_version = str(self.settings.compiler.version) + major = compiler_version.split(".", 1)[0] + if self.settings.compiler == "gcc": + return shutil.which(f"gcc-{compiler_version}") or shutil.which(f"gcc-{major}") or shutil.which("gcc") or "" + if self.settings.compiler == "clang": + return shutil.which(f"clang-{compiler_version}") or shutil.which(f"clang-{major}") or shutil.which("clang") or "" + return "" - def _make(self, targets): + def generate(self): yes_no = lambda v: "yes" if v else "no" - autotools = AutoToolsBuildEnvironment(self) - autotools.make(args=["SHARED={}".format(yes_no(self.options.shared)), - "ZLIB={}".format(yes_no(self.options.with_zlib)), - "HWDB={}".format(yes_no(self.options.with_udev)), - "PREFIX={}".format(self.package_folder), - "OPT={}".format("{} {}".format( - autotools.vars["CPPFLAGS"], autotools.vars["CFLAGS"])), - "DNS=no"], - target=" ".join(targets)) + tc = AutotoolsToolchain(self) + tc.make_args = [ + f"SHARED={yes_no(self.options.shared)}", + f"ZLIB={yes_no(self.options.with_zlib)}", + f"HWDB={yes_no(self.options.with_udev)}", + f"DESTDIR={self.package_folder}", + "PREFIX=/", + "DNS=no", + f"CC={self._cc}", + ] + tc.generate() + deps = AutotoolsDeps(self) + deps.generate() def build(self): - with tools.chdir(self._source_subfolder): - self._make(["all"]) + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.make(target="all") def package(self): - with tools.chdir(self._source_subfolder): - self._make(["install", "install-pcilib"]) + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.make(target="install") + autotools.make(target="install-pcilib") - self.copy("COPYING", src=self._source_subfolder, dst="licenses") - self.copy("*.h", src=self._source_subfolder, dst="include", keep_path=True) + 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"), + keep_path=True) if self.options.shared: - tools.rename(src=os.path.join(self._source_subfolder, "lib", "libpci.so.3.7.0"), - dst=os.path.join(self.package_folder, "lib", "libpci.so")) + # libpci.so.3 -> libpci.so + with chdir(self, os.path.join(self.package_folder, "lib")): + os.symlink("libpci.so.3", "libpci.so") - 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, "man")) + 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, "man")) def package_info(self): - self.cpp_info.names["pkg_config"] = "libpci" + self.cpp_info.set_property("pkg_config_name", "libpci") self.cpp_info.libs = ["pci"] diff --git a/recipes/pciutils/all/test_package/CMakeLists.txt b/recipes/pciutils/all/test_package/CMakeLists.txt index 48b855b8a30aa..3d69747b2d1ec 100644 --- a/recipes/pciutils/all/test_package/CMakeLists.txt +++ b/recipes/pciutils/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(PackageTest C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(pciutils REQUIRED CONFIG) add_executable(example example.c) -target_link_libraries(example ${CONAN_LIBS}) +target_link_libraries(example pciutils::pciutils) diff --git a/recipes/pciutils/all/test_package/conanfile.py b/recipes/pciutils/all/test_package/conanfile.py index 9f2b070b59136..8d52b7021efe1 100644 --- a/recipes/pciutils/all/test_package/conanfile.py +++ b/recipes/pciutils/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 CAresTestConan(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) @@ -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.bindir, "example") + self.run(bin_path, env="conanrun") diff --git a/recipes/pciutils/all/test_v1_package/CMakeLists.txt b/recipes/pciutils/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/pciutils/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/pciutils/all/test_v1_package/conanfile.py b/recipes/pciutils/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..2978938836233 --- /dev/null +++ b/recipes/pciutils/all/test_v1_package/conanfile.py @@ -0,0 +1,16 @@ +from conans import ConanFile, CMake, tools +import os + +class CAresTestConan(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", "example") + self.run(bin_path, run_environment=True) diff --git a/recipes/pciutils/config.yml b/recipes/pciutils/config.yml index 20ddf579e6d44..358eb13a104b8 100644 --- a/recipes/pciutils/config.yml +++ b/recipes/pciutils/config.yml @@ -1,3 +1,7 @@ versions: + "3.12.0": + folder: all + "3.10.0": + folder: all "3.7.0": folder: all diff --git a/recipes/pcl/all/conandata.yml b/recipes/pcl/all/conandata.yml new file mode 100644 index 0000000000000..d2277ffc87cc0 --- /dev/null +++ b/recipes/pcl/all/conandata.yml @@ -0,0 +1,23 @@ +sources: + "1.13.1": + url: https://github.com/PointCloudLibrary/pcl/archive/refs/tags/pcl-1.13.1.tar.gz + sha256: 8ab98a9db371d822de0859084a375a74bdc7f31c96d674147710cf4101b79621 +patches: + "1.13.1": + - patch_file: "patches/1.13.1-0001-cmake_use_conan_targets.patch" + patch_description: "Update PCL CMake files to work with Conan" + patch_type: "conan" + - patch_file: "patches/1.13.1-0002-fix-FindOpenNI-bug.patch" + patch_description: "Fix a libusb detection bug in FindOpenNI.cmake" + patch_type: "bugfix" + - patch_file: "patches/1.13.1-0003-Add-Eigen3-Eigen-target-in-pcl_common-target.patch" + patch_description: "Add Eigen3::Eigen target to pcl_common target" + patch_type: "conan" + - patch_file: "patches/1.13.1-0004-ReportFixAboutMemoryConsumptionDuringBuild.patch" + patch_description: "MovingLeastSquares: reduce the number of instantiations to reduce compile time" + patch_source: "https://github.com/PointCloudLibrary/pcl/pull/5764" + patch_type: "conan" + - patch_file: "patches/1.13.1-0005-ply_parser-include-functional.patch" + patch_description: "Fix missing functional include in ply_parser.h" + patch_source: "https://github.com/PointCloudLibrary/pcl/pull/5964" + patch_type: "portability" diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py new file mode 100644 index 0000000000000..f22cfe52d2e6c --- /dev/null +++ b/recipes/pcl/all/conanfile.py @@ -0,0 +1,592 @@ +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, export_conandata_patches, get, copy, rmdir, rm +from conan.tools.gnu import PkgConfigDeps +from conan.tools.scm import Version +from conan.tools.system import package_manager +import os + +required_conan_version = ">=1.53.0" + +class PclConan(ConanFile): + name = "pcl" + description = ("The Point Cloud Library (PCL) is a standalone, large-scale, " + "open project for 2D/3D image and point cloud processing.") + license = "BSD-3-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/PointCloudLibrary/pcl" + topics = ("computer vision", "point cloud", "pointcloud", "3d", "pcd", "ply", "stl", "ifs", "vtk") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + # Enable/disable individual components + "2d": [True, False], + "features": [True, False], + "filters": [True, False], + "geometry": [True, False], + "io": [True, False], + "kdtree": [True, False], + "keypoints": [True, False], + "ml": [True, False], + "octree": [True, False], + "outofcore": [True, False], + "people": [True, False], + "recognition": [True, False], + "registration": [True, False], + "sample_consensus": [True, False], + "search": [True, False], + "segmentation": [True, False], + "simulation": [True, False], + "stereo": [True, False], + "surface": [True, False], + "tracking": [True, False], + "visualization": [True, False], + "cuda_common": [True, False], + "cuda_features": [True, False], + "cuda_io": [True, False], + "cuda_sample_consensus": [True, False], + "cuda_segmentation": [True, False], + "gpu_containers": [True, False], + "gpu_features": [True, False], + "gpu_kinfu": [True, False], + "gpu_kinfu_large_scale": [True, False], + "gpu_octree": [True, False], + "gpu_people": [True, False], + "gpu_segmentation": [True, False], + "gpu_surface": [True, False], + "gpu_tracking": [True, False], + "gpu_utils": [True, False], + "apps": [True, False], + "tools": [True, False], + # Optional external dependencies. + # Only used if the corresponding component is enabled. + "with_cuda": [True, False], + "with_flann": [True, False], + "with_libusb": [True, False], + "with_opencv": [True, False], + "with_opengl": [True, False], + "with_openmp": [True, False], + "with_pcap": [True, False], + "with_png": [True, False], + "with_qhull": [True, False], + "with_qt": [True, False], + "with_vtk": [True, False], + # TODO: + # "with_davidsdk": [True, False], + # "with_dssdk": [True, False], + # "with_ensenso": [True, False], + # "with_fzapi": [True, False], + # "with_metslib": [True, False], + # "with_openni": [True, False], + # "with_openni2": [True, False], + # "with_rssdk": [True, False], + # "with_rssdk2": [True, False], + # "with_qvtk": [True, False], + # Precompile for a minimal set of point types only instead of all (e.g., pcl::PointXYZ instead of PCL_XYZ_POINT_TYPES) + "precompile_only_core_point_types": [True, False], + # Whether to append a ''/d/rd/s postfix to executables on Windows depending on the build type + "add_build_type_postfix": [True, False], + "use_sse": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + # Enable/disable individual components + "2d": True, + "features": True, + "filters": True, + "geometry": True, + "io": True, + "kdtree": True, + "keypoints": True, + "ml": True, + "octree": True, + "outofcore": False, + "people": False, + "recognition": True, + "registration": True, + "sample_consensus": True, + "search": True, + "segmentation": True, + "simulation": False, + "stereo": True, + "surface": True, + "tracking": True, + # Visualization is currently disabled by default due to missing VTK package + "visualization": False, + # GPU components are disabled by default + "cuda_common": False, + "cuda_features": False, + "cuda_io": False, + "cuda_sample_consensus": False, + "cuda_segmentation": False, + "gpu_containers": False, + "gpu_features": False, + "gpu_kinfu": False, + "gpu_kinfu_large_scale": False, + "gpu_octree": False, + "gpu_people": False, + "gpu_segmentation": False, + "gpu_surface": False, + "gpu_tracking": False, + "gpu_utils": False, + "apps": False, + "tools": False, + # Optional external dependencies + "with_cuda": False, + "with_flann": True, + "with_libusb": True, + "with_opencv": True, + "with_opengl": True, + "with_openmp": False, + "with_pcap": True, + "with_png": True, + "with_qhull": True, + "with_qt": True, + "with_vtk": False, + # Enabled to avoid excessive memory usage during compilation in CCI + "precompile_only_core_point_types": True, + "add_build_type_postfix": False, + "use_sse": True, + } + + short_paths = True + + # The component details have been extracted from their CMakeLists.txt files using + # https://gist.github.com/valgur/e54e39b6a8931b58cc1776515104c828 + @property + def _external_deps(self): + return { + "common": ["boost", "eigen"], + "cuda_common": ["cuda"], + "cuda_features": ["cuda"], + "cuda_io": ["cuda", "openni"], + "cuda_sample_consensus": ["cuda"], + "cuda_segmentation": ["cuda"], + "gpu_containers": ["cuda"], + "gpu_features": ["cuda"], + "gpu_kinfu": ["cuda"], + "gpu_kinfu_large_scale": ["cuda"], + "gpu_octree": ["cuda"], + "gpu_people": ["cuda"], + "gpu_segmentation": ["cuda"], + "gpu_surface": ["cuda"], + "gpu_tracking": ["cuda"], + "gpu_utils": ["cuda"], + "io": ["zlib"], + "people": ["vtk"], + "surface": ["zlib"], + "visualization": ["vtk"], + } + + @property + def _external_optional_deps(self): + return { + "2d": ["vtk"], + "io": ["davidsdk", "dssdk", "ensenso", "fzapi", "libusb", "openni", "openni2", "pcap", "png", "rssdk", "rssdk2", "vtk"], + "kdtree": ["flann"], + "people": ["openni"], + "recognition": ["metslib"], + "search": ["flann"], + "simulation": ["opengl"], + "surface": ["qhull", "vtk"], + "visualization": ["davidsdk", "dssdk", "ensenso", "opengl", "openni", "openni2", "qvtk", "rssdk"], + "apps": ["cuda", "libusb", "opengl", "openni", "png", "qhull", "qt", "qvtk", "vtk"], + "tools": ["cuda", "davidsdk", "dssdk", "ensenso", "opencv", "opengl", "openni", "openni2", "qhull", "rssdk", "vtk"], + } + + def _ext_dep_to_conan_target(self, dep): + if not self._is_enabled(dep): + return [] + return { + "boost": ["boost::boost"], + "cuda": [], + "davidsdk": [], + "dssdk": [], + "eigen": ["eigen::eigen"], + "ensenso": [], + "flann": ["flann::flann"], + "fzapi": [], + "libusb": ["libusb::libusb"], + "metslib": [], + "opencv": ["opencv::opencv"], + "opengl": ["opengl::opengl", "freeglut::freeglut", "glew::glew", "glu::glu" if is_apple_os(self) or self.settings.os == "Windows" else "mesa-glu::mesa-glu"], + "openni": [], + "openni2": [], + "pcap": ["libpcap::libpcap"], + "png": ["libpng::libpng"], + "qhull": ["qhull::qhull"], + "qt": ["qt::qt"], + "qvtk": [], + "rssdk": [], + "rssdk2": [], + "vtk": [], + "zlib": ["zlib::zlib"], + }[dep] + + @property + def _internal_deps(self): + return { + "2d": ["common", "filters"], + "common": [], + "cuda_common": [], + "cuda_features": ["common", "cuda_common", "io"], + "cuda_io": ["common", "cuda_common", "io"], + "cuda_sample_consensus": ["common", "cuda_common", "io"], + "cuda_segmentation": ["common", "cuda_common", "io"], + "features": ["2d", "common", "filters", "kdtree", "octree", "search"], + "filters": ["common", "kdtree", "octree", "sample_consensus", "search"], + "geometry": ["common"], + "gpu_containers": ["common"], + "gpu_features": ["common", "geometry", "gpu_containers", "gpu_octree", "gpu_utils"], + "gpu_kinfu": ["common", "geometry", "gpu_containers", "io", "search"], + "gpu_kinfu_large_scale": ["common", "features", "filters", "geometry", "gpu_containers", + "gpu_utils", "io", "kdtree", "octree", "search", "surface"], + "gpu_octree": ["common", "gpu_containers", "gpu_utils"], + "gpu_people": ["common", "features", "filters", "geometry", "gpu_containers", + "gpu_utils", "io", "kdtree", "octree", "search", "segmentation", + "surface", "visualization"], + "gpu_segmentation": ["common", "gpu_containers", "gpu_octree", "gpu_utils"], + "gpu_surface": ["common", "geometry", "gpu_containers", "gpu_utils"], + "gpu_tracking": ["common", "filters", "gpu_containers", "gpu_octree", + "gpu_utils", "kdtree", "octree", "search", "tracking"], + "gpu_utils": ["common", "gpu_containers"], + "io": ["common", "octree"], + "kdtree": ["common"], + "keypoints": ["common", "features", "filters", "kdtree", "octree", "search"], + "ml": ["common"], + "octree": ["common"], + "outofcore": ["common", "filters", "io", "octree", "visualization"], + "people": ["common", "filters", "geometry", "io", "kdtree", "octree", + "sample_consensus", "search", "segmentation", "visualization"], + "recognition": ["common", "features", "filters", "io", "kdtree", "ml", + "octree", "registration", "sample_consensus", "search"], + "registration": ["common", "features", "filters", "kdtree", "octree", + "sample_consensus", "search"], + "sample_consensus": ["common", "search"], + "search": ["common", "kdtree", "octree"], + "segmentation": ["common", "features", "filters", "geometry", "kdtree", + "ml", "octree", "sample_consensus", "search"], + "simulation": ["common", "features", "filters", "geometry", "io", + "kdtree", "octree", "search", "surface", "visualization"], + "stereo": ["common", "io"], + "surface": ["common", "kdtree", "octree", "search"], + "tracking": ["common", "filters", "kdtree", "octree", "search"], + "visualization": ["common", "geometry", "io", "kdtree", "octree", "search"], + } + + @property + def _internal_optional_deps(self): + return { + "apps": ["2d", "common", "cuda_common", "cuda_features", "cuda_io", + "cuda_sample_consensus", "cuda_segmentation", "features", "filters", + "geometry", "io", "kdtree", "keypoints", "ml", "octree", "recognition", + "registration", "sample_consensus", "search", "segmentation", "stereo", + "surface", "tracking", "visualization"], + "tools": ["features", "filters", "geometry", "gpu_kinfu", "gpu_kinfu_large_scale", + "io", "kdtree", "keypoints", "ml", "octree", "recognition", "registration", + "sample_consensus", "search", "segmentation", "surface", "visualization"], + } + + def _is_header_only(self, component): + return component in {"2d", "cuda_common", "geometry"} + + @property + def _extra_libs(self): + return {"io": ["pcl_io_ply"]} + + def _enabled_components(self, opts=None): + opts = opts or self.options + return {c for c in self._internal_deps if opts.get_safe(c)} | {"common"} + + def _disabled_components(self, opts=None): + opts = opts or self.options + return {c for c in self._internal_deps if not opts.get_safe(c)} - {"common"} + + def _used_ext_deps(self, opts): + all_deps = set() + for component in self._enabled_components(opts): + all_deps.update(self._external_deps.get(component, [])) + all_deps.update(self._external_optional_deps.get(component, [])) + return all_deps + + @property + def _min_cppstd(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "7", + "clang": "7", + "apple-clang": "10", + "msvc": "191", + "Visual Studio": "15", + } + + 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.use_sse + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + + def system_requirements(self): + if self._is_enabled("vtk"): + # TODO: add vtk/system package? + # https://repology.org/project/vtk/versions + package_manager.Apt(self).install(["libvtk9-dev"], update=True, check=True) + package_manager.Dnf(self).install(["vtk-devel"], update=True, check=True) + package_manager.Yum(self).install(["vtk-devel"], update=True, check=True) + package_manager.PacMan(self).install(["vtk"], update=True, check=True) + package_manager.Zypper(self).install(["vtk"], update=True, check=True) + package_manager.Pkg(self).install(["vtk9"], update=True, check=True) + package_manager.Brew(self).install(["vtk"], update=True, check=True) + if self.settings.os == "Windows": + self.output.warning("VTK must be installed manually on Windows.") + + def _is_enabled(self, dep): + always_available = ["boost", "eigen", "zlib"] + is_available = self.options.get_safe(f"with_{dep}") or dep in always_available + is_used = dep in self._used_ext_deps(self.options) + return is_available and is_used + + def requirements(self): + self.requires("boost/1.83.0", transitive_headers=True) + self.requires("eigen/3.4.0", transitive_headers=True) + if self._is_enabled("flann"): + self.requires("flann/1.9.2", transitive_headers=True) + if self._is_enabled("png"): + self.requires("libpng/[>=1.6 <2]") + if self._is_enabled("qhull"): + self.requires("qhull/8.0.1", transitive_headers=True) + if self._is_enabled("qt"): + self.requires("qt/6.6.1") + if self._is_enabled("libusb"): + self.requires("libusb/1.0.26", transitive_headers=True) + if self._is_enabled("pcap"): + self.requires("libpcap/1.10.4") + if self._is_enabled("opengl"): + # OpenGL is only used if VTK is available + self.requires("opengl/system", transitive_headers=True) + self.requires("freeglut/3.4.0", transitive_headers=True) + self.requires("glew/2.2.0", transitive_headers=True) + if is_apple_os(self) or self.settings.os == "Windows": + self.requires("glu/system", transitive_headers=True) + else: + self.requires("mesa-glu/9.0.3", transitive_headers=True) + if self._is_enabled("opencv"): + self.requires("opencv/4.8.1", transitive_headers=True) + if self._is_enabled("zlib"): + self.requires("zlib/[>=1.2.11 <2]") + # TODO: + # self.requires("vtk/9.x.x", transitive_headers=True) + # self.requires("openni/x.x.x", transitive_headers=True) + # self.requires("openni2/x.x.x", transitive_headers=True) + # self.requires("ensenso/x.x.x", transitive_headers=True) + # self.requires("davidsdk/x.x.x", transitive_headers=True) + # self.requires("dssdk/x.x.x", transitive_headers=True) + # self.requires("rssdk/x.x.x", transitive_headers=True) + # self.requires("metslib/x.x.x", transitive_headers=True) + # self.requires("openmp/system", transitive_headers=True) + # self.requires("opennurbs/x.x.x", transitive_headers=True) + # self.requires("poisson4/x.x.x", transitive_headers=True) + + def package_id(self): + used_deps = self._used_ext_deps(self.info.options) + # Disable options that have no effect + all_opts = [opt for opt, value in self.info.options.items()] + for opt in all_opts: + if opt.startswith("with_") and opt.split("_", 1)[1] not in used_deps: + setattr(self.info.options, opt, False) + + def validate(self): + enabled_components = self._enabled_components() + for component in sorted(enabled_components): + for dep in self._external_deps.get(component, []): + if not self._is_enabled(dep): + raise ConanInvalidConfiguration( + f"'with_{dep}=True' is required when '{component}' is enabled." + ) + for dep in self._internal_deps[component]: + if dep not in enabled_components: + raise ConanInvalidConfiguration( + f"'{dep}=True' is required when '{component}' is enabled." + ) + + 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): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["PCL_SHARED_LIBS"] = self.options.shared + tc.cache_variables["WITH_LIBUSB"] = self._is_enabled("libusb") + tc.cache_variables["WITH_OPENGL"] = self._is_enabled("opengl") + tc.cache_variables["WITH_OPENMP"] = self._is_enabled("openmp") + tc.cache_variables["WITH_PCAP"] = self._is_enabled("pcap") + tc.cache_variables["WITH_PNG"] = self._is_enabled("png") + tc.cache_variables["WITH_QHULL"] = self._is_enabled("qhull") + if self._is_enabled("qhull"): + # Upstream FindQhull.cmake defines HAVE_QHULL which changes content of pcl_config.h + # Since we use CMakeDeps instead of this file, we have to manually inject HAVE_QHULL + tc.cache_variables["HAVE_QHULL"] = True + tc.cache_variables["WITH_QT"] = self._is_enabled("qt") + tc.cache_variables["WITH_VTK"] = self._is_enabled("vtk") + tc.cache_variables["WITH_CUDA"] = self._is_enabled("cuda") + tc.cache_variables["BUILD_CUDA"] = self._is_enabled("cuda") + tc.cache_variables["BUILD_GPU"] = self._is_enabled("cuda") + tc.cache_variables["WITH_SYSTEM_ZLIB"] = True + tc.cache_variables["PCL_ONLY_CORE_POINT_TYPES"] = self.options.precompile_only_core_point_types + # The default False setting breaks OpenGL detection in CMake + tc.cache_variables["PCL_ALLOW_BOTH_SHARED_AND_STATIC_DEPENDENCIES"] = True + tc.variables["OpenGL_GL_PREFERENCE"] = "GLVND" + + if not self.options.add_build_type_postfix: + tc.cache_variables["CMAKE_DEBUG_POSTFIX"] = "" + tc.cache_variables["CMAKE_RELEASE_POSTFIX"] = "" + tc.cache_variables["CMAKE_RELWITHDEBINFO_POSTFIX"] = "" + tc.cache_variables["CMAKE_MINSIZEREL_POSTFIX"] = "" + + tc.cache_variables["BUILD_tools"] = self.options.tools + tc.cache_variables["BUILD_apps"] = self.options.apps + tc.cache_variables["BUILD_examples"] = False + enabled = sorted(self._enabled_components()) + disabled = sorted(self._disabled_components()) + self.output.info("Enabled components: " + ", ".join(enabled)) + self.output.info("Disabled components: " + ", ".join(disabled)) + for comp in enabled: + tc.cache_variables[f"BUILD_{comp}"] = True + for comp in disabled: + tc.cache_variables[f"BUILD_{comp}"] = False + + tc.cache_variables["PCL_ENABLE_SSE"] = self.options.get_safe("use_sse", False) + + tc.generate() + + deps = CMakeDeps(self) + deps.set_property("eigen", "cmake_file_name", "EIGEN") + deps.set_property("flann", "cmake_file_name", "FLANN") + deps.set_property("flann", "cmake_target_name", "FLANN::FLANN") + deps.set_property("libpcap", "cmake_file_name", "PCAP") + deps.set_property("qhull", "cmake_file_name", "QHULL") + deps.set_property("qhull", "cmake_target_name", "QHULL::QHULL") + deps.generate() + + deps = PkgConfigDeps(self) + deps.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + for mod in ["Eigen", "FLANN", "GLEW", "Pcap", "Qhull", "libusb"]: + os.remove(os.path.join(self.source_folder, "cmake", "Modules", f"Find{mod}.cmake")) + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "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, "cmake")) + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.pdb", os.path.join(self.package_folder, "lib")) + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + # Remove MSVC runtime libraries + for dll_pattern_to_remove in ["concrt*.dll", "msvcp*.dll", "vcruntime*.dll"]: + rm(self, dll_pattern_to_remove, os.path.join(self.package_folder, "bin")) + + @property + def _version_suffix(self): + semver = Version(self.version) + return f"{semver.major}.{semver.minor}" + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "PCL") + self.cpp_info.set_property("cmake_target_name", "PCL::PCL") + self.cpp_info.set_property("cmake_find_mode", "both") + + for name in sorted(self._enabled_components()): + component = self.cpp_info.components[name] + component.names["cmake_find_package"] = name + component.names["cmake_find_package_multi"] = name + component.set_property("cmake_file_name", name) + component.set_property("cmake_module_file_name", name) + component.set_property("cmake_target_name", f"PCL::{name}") + component.set_property("pkg_config_name", f"pcl_{name}-{self._version_suffix}") + component.includedirs = [os.path.join("include", f"pcl-{self._version_suffix}")] + if not self._is_header_only(name): + component.libs = [f"pcl_{name}"] + component.libs += self._extra_libs.get(name, []) + component.requires += self._internal_deps[name] + for opt_dep in self._internal_optional_deps.get(name, []): + if self.options.get_safe(opt_dep): + component.requires.append(opt_dep) + for dep in self._external_deps.get(name, []) + self._external_optional_deps.get(name, []): + component.requires += self._ext_dep_to_conan_target(dep) + + if self.options.apps: + component = self.cpp_info.components["apps"] + component.libs = [] + component.includedirs = [] + component.requires = self._internal_optional_deps["apps"] + for dep in self._external_optional_deps["apps"]: + component.requires += self._ext_dep_to_conan_target(dep) + + if self.options.tools: + component = self.cpp_info.components["tools"] + component.libs = [] + component.includedirs = [] + component.requires = self._internal_optional_deps["tools"] + for dep in self._external_optional_deps["tools"]: + component.requires += self._ext_dep_to_conan_target(dep) + + common = self.cpp_info.components["common"] + if not self.options.shared: + if self.settings.os in ["Linux", "FreeBSD"]: + common.system_libs.append("pthread") + if self.options.with_openmp: + if self.settings.os == "Linux": + if self.settings.compiler == "gcc": + common.sharedlinkflags.append("-fopenmp") + common.exelinkflags.append("-fopenmp") + elif self.settings.os == "Windows": + if self.settings.compiler == "msvc": + common.system_libs.append("delayimp") + elif self.settings.compiler == "gcc": + common.system_libs.append("gomp") + if self.settings.os == "Windows": + common.system_libs.append("ws2_32") + + # TODO: Legacy, to be removed on Conan 2.0 + self.cpp_info.names["cmake_find_package"] = "PCL" + self.cpp_info.names["cmake_find_package_multi"] = "PCL" diff --git a/recipes/pcl/all/patches/1.13.1-0001-cmake_use_conan_targets.patch b/recipes/pcl/all/patches/1.13.1-0001-cmake_use_conan_targets.patch new file mode 100644 index 0000000000000..5461a0bfed49e --- /dev/null +++ b/recipes/pcl/all/patches/1.13.1-0001-cmake_use_conan_targets.patch @@ -0,0 +1,52 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -297,7 +297,7 @@ + # OpenMP (optional) + option(WITH_OPENMP "Build with parallelization using OpenMP" TRUE) + if(WITH_OPENMP) +- find_package(OpenMP COMPONENTS C CXX) ++ find_package(OpenMP REQUIRED COMPONENTS C CXX) + endif() + if(OpenMP_FOUND) + string(APPEND CMAKE_C_FLAGS " ${OpenMP_C_FLAGS}") +@@ -319,11 +319,11 @@ + find_package(Threads REQUIRED) + + # Eigen (required) +-find_package(Eigen 3.3 REQUIRED) ++find_package(EIGEN REQUIRED CONFIG) + include_directories(SYSTEM ${EIGEN_INCLUDE_DIRS}) + + # FLANN (required) +-find_package(FLANN 1.9.1 REQUIRED) ++find_package(FLANN CONFIG) + if(NOT (${FLANN_LIBRARY_TYPE} MATCHES ${PCL_FLANN_REQUIRED_TYPE}) AND NOT (${PCL_FLANN_REQUIRED_TYPE} MATCHES "DONTCARE")) + message(FATAL_ERROR "Flann was selected with ${PCL_FLANN_REQUIRED_TYPE} but found as ${FLANN_LIBRARY_TYPE}") + endif() +@@ -359,7 +359,7 @@ + # LibPNG + option(WITH_PNG "PNG file support" TRUE) + if(WITH_PNG) +- find_package(PNG) ++ find_package(PNG REQUIRED CONFIG) + if(PNG_FOUND) + set(HAVE_PNG ON) + include_directories(SYSTEM "${PNG_INCLUDE_DIR}") +@@ -369,7 +369,7 @@ + # Qhull + option(WITH_QHULL "Include convex-hull operations" TRUE) + if(WITH_QHULL) +- find_package(Qhull) ++ find_package(QHULL REQUIRED CONFIG) + if(NOT (${QHULL_LIBRARY_TYPE} MATCHES ${PCL_QHULL_REQUIRED_TYPE}) AND NOT (${PCL_QHULL_REQUIRED_TYPE} MATCHES "DONTCARE")) + message(FATAL_ERROR "Qhull was selected with ${PCL_QHULL_REQUIRED_TYPE} but found as ${QHULL_LIBRARY_TYPE}") + endif() +@@ -404,7 +404,7 @@ + #Find PCAP + option(WITH_PCAP "pcap file capabilities in Velodyne HDL driver" TRUE) + if(WITH_PCAP) +- find_package(Pcap) ++ find_package(PCAP REQUIRED CONFIG) + endif() + + # OpenGL and GLUT diff --git a/recipes/pcl/all/patches/1.13.1-0002-fix-FindOpenNI-bug.patch b/recipes/pcl/all/patches/1.13.1-0002-fix-FindOpenNI-bug.patch new file mode 100644 index 0000000000000..34cf4a671e285 --- /dev/null +++ b/recipes/pcl/all/patches/1.13.1-0002-fix-FindOpenNI-bug.patch @@ -0,0 +1,32 @@ +--- cmake/Modules/FindOpenNI.cmake ++++ cmake/Modules/FindOpenNI.cmake +@@ -52,7 +52,12 @@ + + # Libraries + if(NOT WIN32) +- find_package(libusb REQUIRED) ++ find_package(libusb QUIET) ++ if (NOT libusb_FOUND) ++ message(WARNING "Found OpenNI library, but required libusb is not available") ++ set(OPENNI_FOUND FALSE) ++ return() ++ endif() + set(OPENNI_LIBRARIES ${OPENNI_LIBRARY} libusb::libusb) + else() + set(OPENNI_LIBRARIES ${OPENNI_LIBRARY}) +--- cmake/Modules/FindOpenNI2.cmake ++++ cmake/Modules/FindOpenNI2.cmake +@@ -42,7 +42,12 @@ + + # Libraries + if(NOT WIN32) +- find_package(libusb REQUIRED) ++ find_package(libusb QUIET) ++ if (NOT libusb_FOUND) ++ message(WARNING "Found OpenNI2 library, but required libusb is not available") ++ set(OPENNI2_FOUND FALSE) ++ return() ++ endif() + set(OPENNI2_LIBRARIES ${OPENNI2_LIBRARY} libusb::libusb) + else() + set(OPENNI2_LIBRARIES ${OPENNI2_LIBRARY}) diff --git a/recipes/pcl/all/patches/1.13.1-0003-Add-Eigen3-Eigen-target-in-pcl_common-target.patch b/recipes/pcl/all/patches/1.13.1-0003-Add-Eigen3-Eigen-target-in-pcl_common-target.patch new file mode 100644 index 0000000000000..5dfeedf59e5f4 --- /dev/null +++ b/recipes/pcl/all/patches/1.13.1-0003-Add-Eigen3-Eigen-target-in-pcl_common-target.patch @@ -0,0 +1,25 @@ +From a975f68d2e399a1563fe0d66b2c048978f0282d1 Mon Sep 17 00:00:00 2001 +From: Esteban DUGUEPEROUX +Date: Mon, 7 Aug 2023 23:50:12 +0200 +Subject: [PATCH] Add Eigen3::Eigen target in pcl_common target + +--- + common/CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt +index 48e1a202e..e0ced5241 100644 +--- a/common/CMakeLists.txt ++++ b/common/CMakeLists.txt +@@ -179,7 +179,7 @@ target_include_directories(${LIB_NAME} PUBLIC + $ + ) + +-target_link_libraries(${LIB_NAME} Boost::boost) ++target_link_libraries(${LIB_NAME} Boost::boost Eigen3::Eigen) + + if(MSVC AND NOT (MSVC_VERSION LESS 1915)) + # MSVC resolved a byte alignment issue in compiler version 15.9 +-- +2.41.0 + diff --git a/recipes/pcl/all/patches/1.13.1-0004-ReportFixAboutMemoryConsumptionDuringBuild.patch b/recipes/pcl/all/patches/1.13.1-0004-ReportFixAboutMemoryConsumptionDuringBuild.patch new file mode 100644 index 0000000000000..35fba73e8b067 --- /dev/null +++ b/recipes/pcl/all/patches/1.13.1-0004-ReportFixAboutMemoryConsumptionDuringBuild.patch @@ -0,0 +1,38 @@ +From 0bc2f2cc369f7d013ee5c29075188c4e26ea6f87 Mon Sep 17 00:00:00 2001 +From: Markus Vieth +Date: Sat, 15 Jul 2023 15:49:25 +0200 +Subject: [PATCH] MovingLeastSquares: reduce the number of instantiations to + reduce compile time PCL_XYZ_POINT_TYPES currently contains 18 types, so + previously, MLS was instantiated for 18*18=324 different type combinations. + However, among those were instantiations which are likely used by nobody + (like `pcl::MovingLeastSquares`). With + these changes, MLS is only instantiated 6*6+(18-6)=48 times. The most common + type combinations should be covered, but if someone uses an uncommon + combinations, they have to add `#define PCL_NO_PRECOMPILE` before including + `pcl/surface/mls.h` to avoid linker errors. + +--- + surface/src/mls.cpp | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/surface/src/mls.cpp b/surface/src/mls.cpp +index ba2fd655300..c948f4d19e1 100644 +--- a/surface/src/mls.cpp ++++ b/surface/src/mls.cpp +@@ -80,6 +80,15 @@ pcl::MLSResult::calculatePrincipalCurvatures (const double u, const double v) co + PCL_INSTANTIATE_PRODUCT(MovingLeastSquares, ((pcl::PointXYZ)(pcl::PointXYZI)(pcl::PointXYZRGB)(pcl::PointXYZRGBA)(pcl::PointXYZRGBNormal)(pcl::PointNormal)) + ((pcl::PointXYZ)(pcl::PointXYZI)(pcl::PointXYZRGB)(pcl::PointXYZRGBA)(pcl::PointXYZRGBNormal)(pcl::PointNormal))) + #else +- PCL_INSTANTIATE_PRODUCT(MovingLeastSquares, (PCL_XYZ_POINT_TYPES)(PCL_XYZ_POINT_TYPES)) ++ // PCL_INSTANTIATE_PRODUCT(MovingLeastSquares, (PCL_XYZ_POINT_TYPES)(PCL_XYZ_POINT_TYPES)) ++ // All instantiations that are available with PCL_ONLY_CORE_POINT_TYPES, plus instantiations for all XYZ types where PointInT and PointOutT are the same ++ #define PCL_INSTANTIATE_MovingLeastSquaresSameInAndOut(T) template class PCL_EXPORTS pcl::MovingLeastSquares; ++ PCL_INSTANTIATE(MovingLeastSquaresSameInAndOut, PCL_XYZ_POINT_TYPES) ++ PCL_INSTANTIATE_PRODUCT(MovingLeastSquares, ((pcl::PointXYZ))((pcl::PointXYZI)(pcl::PointXYZRGB)(pcl::PointXYZRGBA)(pcl::PointXYZRGBNormal)(pcl::PointNormal))) ++ PCL_INSTANTIATE_PRODUCT(MovingLeastSquares, ((pcl::PointXYZI))((pcl::PointXYZ)(pcl::PointXYZRGB)(pcl::PointXYZRGBA)(pcl::PointXYZRGBNormal)(pcl::PointNormal))) ++ PCL_INSTANTIATE_PRODUCT(MovingLeastSquares, ((pcl::PointXYZRGB))((pcl::PointXYZ)(pcl::PointXYZI)(pcl::PointXYZRGBA)(pcl::PointXYZRGBNormal)(pcl::PointNormal))) ++ PCL_INSTANTIATE_PRODUCT(MovingLeastSquares, ((pcl::PointXYZRGBA))((pcl::PointXYZ)(pcl::PointXYZI)(pcl::PointXYZRGB)(pcl::PointXYZRGBNormal)(pcl::PointNormal))) ++ PCL_INSTANTIATE_PRODUCT(MovingLeastSquares, ((pcl::PointXYZRGBNormal))((pcl::PointXYZ)(pcl::PointXYZI)(pcl::PointXYZRGB)(pcl::PointXYZRGBA)(pcl::PointNormal))) ++ PCL_INSTANTIATE_PRODUCT(MovingLeastSquares, ((pcl::PointNormal))((pcl::PointXYZ)(pcl::PointXYZI)(pcl::PointXYZRGB)(pcl::PointXYZRGBA)(pcl::PointXYZRGBNormal))) + #endif + #endif // PCL_NO_PRECOMPILE diff --git a/recipes/pcl/all/patches/1.13.1-0005-ply_parser-include-functional.patch b/recipes/pcl/all/patches/1.13.1-0005-ply_parser-include-functional.patch new file mode 100644 index 0000000000000..14a4a99db8a78 --- /dev/null +++ b/recipes/pcl/all/patches/1.13.1-0005-ply_parser-include-functional.patch @@ -0,0 +1,21 @@ +From 61b2e8e5336d7d8b0e1ae7c1168035faa083310b Mon Sep 17 00:00:00 2001 +From: Transporter +Date: Sun, 18 Feb 2024 10:38:12 +0100 +Subject: [PATCH] Fix missing include (#5962) + +--- + io/include/pcl/io/ply/ply_parser.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/io/include/pcl/io/ply/ply_parser.h b/io/include/pcl/io/ply/ply_parser.h +index 3023d566607..244f3719506 100644 +--- a/io/include/pcl/io/ply/ply_parser.h ++++ b/io/include/pcl/io/ply/ply_parser.h +@@ -49,6 +49,7 @@ + #include + #include + #include ++#include + #include // for lexical_cast + #include // for fold + #include // for inherit diff --git a/recipes/pcl/all/test_package/CMakeLists.txt b/recipes/pcl/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..57794a612df2a --- /dev/null +++ b/recipes/pcl/all/test_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.15) + +project(test_package CXX) + +find_package(PCL REQUIRED surface CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) + +target_link_libraries(${PROJECT_NAME} PRIVATE PCL::filters) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/pcl/all/test_package/conanfile.py b/recipes/pcl/all/test_package/conanfile.py new file mode 100644 index 0000000000000..02eb5ce439fb4 --- /dev/null +++ b/recipes/pcl/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/pcl/all/test_package/test_package.cpp b/recipes/pcl/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..cca717d08eb8f --- /dev/null +++ b/recipes/pcl/all/test_package/test_package.cpp @@ -0,0 +1,73 @@ +// Copied from https://github.com/PointCloudLibrary/pcl/blob/pcl-1.13.1/examples/filters/example_extract_indices.cpp +/* + * Software License Agreement (BSD License) + * + * Point Cloud Library (PCL) - www.pointclouds.org + * Copyright (c) 2009-2011, Willow Garage, 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 Willow Garage, 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. + * + * $Id: example_ExtractIndices.cpp 4117 2012-01-31 17:56:02Z aichim $ + * + */ + +#include + +#include + +int +main (int, char**) +{ + using PointType = pcl::PointXYZ; + using CloudType = pcl::PointCloud; + CloudType::Ptr cloud (new CloudType); + cloud->is_dense = false; + PointType p; + for (unsigned int i = 0; i < 5; ++i) + { + p.x = p.y = p.z = static_cast (i); + cloud->push_back (p); + } + + std::cout << "Cloud has " << cloud->size () << " points." << std::endl; + + pcl::PointIndices indices; + indices.indices.push_back (0); + indices.indices.push_back (2); + + pcl::ExtractIndices extract_indices; + extract_indices.setIndices (pcl::make_shared (indices)); + extract_indices.setInputCloud (cloud); + pcl::PointCloud::Ptr output (new pcl::PointCloud); + extract_indices.filter (*output); + + std::cout << "Output has " << output->size () << " points." << std::endl; + return (0); +} diff --git a/recipes/pcl/config.yml b/recipes/pcl/config.yml new file mode 100644 index 0000000000000..aac1819cc10c0 --- /dev/null +++ b/recipes/pcl/config.yml @@ -0,0 +1,3 @@ +versions: + "1.13.1": + folder: all diff --git a/recipes/pcre/all/conanfile.py b/recipes/pcre/all/conanfile.py index 9ffa5521e50c7..ca51bc38829c6 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.13") + self.requires("zlib/[>=1.2.11 <2]") 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 344830544b429..a7d2c38f2c564 100644 --- a/recipes/pcre2/all/conandata.yml +++ b/recipes/pcre2/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "10.44": + url: "https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.44/pcre2-10.44.tar.bz2" + sha256: "d34f02e113cf7193a1ebf2770d3ac527088d485d4e047ed10e5d217c6ef5de96" + "10.43": + url: "https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.43/pcre2-10.43.tar.bz2" + sha256: "e2a53984ff0b07dfdb5ae4486bbb9b21cca8e7df2434096cc9bf1b728c350bcb" "10.42": url: "https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.42/pcre2-10.42.tar.bz2" sha256: "8d36cd8cb6ea2a4c2bb358ff6411b0c788633a2a45dabbf1aeb4b701d1b5e840" @@ -34,11 +40,20 @@ sources: - "https://sourceforge.net/projects/pcre/files/pcre2/10.32/pcre2-10.32.tar.bz2" sha256: "f29e89cc5de813f45786580101aaee3984a65818631d4ddbda7b32f699b87c2e" patches: + "10.42": + - patch_file: "patches/0002-fix-cmake-c-std.patch" + patch_description: "make the C99 requirement explicit" + patch_type: "conan" + patch_source: "https://github.com/PCRE2Project/pcre2/pull/193" "10.40": - patch_file: "patches/0001-fix-cmake-1.39.patch" patch_description: "correct the order of cmake_minimum_required() and project()" patch_type: "conan" patch_source: "https://github.com/PCRE2Project/pcre2/pull/142" + - patch_file: "patches/0002-fix-cmake-c-std.patch" + patch_description: "make the C99 requirement explicit" + patch_type: "conan" + patch_source: "https://github.com/PCRE2Project/pcre2/pull/193" "10.39": - patch_file: "patches/0001-fix-cmake-1.39.patch" patch_description: "correct the order of cmake_minimum_required() and project()" diff --git a/recipes/pcre2/all/conanfile.py b/recipes/pcre2/all/conanfile.py index 5982290e7cdbe..7f6022b6b9a83 100644 --- a/recipes/pcre2/all/conanfile.py +++ b/recipes/pcre2/all/conanfile.py @@ -16,7 +16,7 @@ class PCRE2Conan(ConanFile): description = "Perl Compatible Regular Expressions" topics = ("regex", "regexp", "perl") license = "BSD-3-Clause" - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -29,6 +29,7 @@ class PCRE2Conan(ConanFile): "with_bzip2": [True, False], "support_jit": [True, False], "grep_support_callout_fork": [True, False], + "link_size": [2, 3, 4], } default_options = { "shared": False, @@ -41,6 +42,7 @@ class PCRE2Conan(ConanFile): "with_bzip2": True, "support_jit": False, "grep_support_callout_fork": True, + "link_size": 2, } def export_sources(self): @@ -65,7 +67,7 @@ def layout(self): def requirements(self): if self.options.get_safe("with_zlib"): - self.requires("zlib/1.2.13") + self.requires("zlib/[>=1.2.11 <2]") if self.options.get_safe("with_bzip2"): self.requires("bzip2/1.0.8") @@ -76,8 +78,7 @@ def validate(self): raise ConanInvalidConfiguration("build_pcre2_8 must be enabled for the pcre2grep program") 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,6 +98,7 @@ def generate(self): tc.variables["PCRE2_BUILD_PCRE2_16"] = self.options.build_pcre2_16 tc.variables["PCRE2_BUILD_PCRE2_32"] = self.options.build_pcre2_32 tc.variables["PCRE2_SUPPORT_JIT"] = self.options.support_jit + tc.variables["PCRE2_LINK_SIZE"] = self.options.link_size tc.variables["PCRE2GREP_SUPPORT_CALLOUT_FORK"] = self.options.get_safe("grep_support_callout_fork", False) if Version(self.version) < "10.38": # relocatable shared libs on Macos @@ -119,6 +121,18 @@ def _patch_sources(self): replace_in_file(self, cmakelists, "RUNTIME DESTINATION bin", "RUNTIME DESTINATION bin BUNDLE DESTINATION bin") + # pcre2-config does not correctly include '-static' in static library names + if is_msvc(self): + replace = None + if Version(self.version) > "10.42": + replace = "configure_file(pcre2-config.in" + elif Version(self.version) >= "10.38": + replace = "CONFIGURE_FILE(pcre2-config.in" + postfix = "-static" if not self.options.shared else "" + if replace: + if self.settings.build_type == "Debug": + postfix += "d" + replace_in_file(self, cmakelists, replace, f'set(LIB_POSTFIX "{postfix}")\n{replace}') def build(self): self._patch_sources() @@ -150,6 +164,9 @@ def package_info(self): self.cpp_info.components["pcre2-posix"].set_property("pkg_config_name", "libpcre2-posix") self.cpp_info.components["pcre2-posix"].libs = [self._lib_name("pcre2-posix")] self.cpp_info.components["pcre2-posix"].requires = ["pcre2-8"] + if Version(self.version) >= "10.43" and is_msvc(self) and self.options.shared: + self.cpp_info.components["pcre2-posix"].defines.append("PCRE2POSIX_SHARED=1") + # pcre2-16 if self.options.build_pcre2_16: self.cpp_info.components["pcre2-16"].set_property("cmake_target_name", "PCRE2::16BIT") @@ -167,7 +184,7 @@ def package_info(self): if self.options.build_pcre2grep: 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) # FIXME: This is a workaround to avoid ConanException. zlib and bzip2 # are optional requirements of pcre2grep executable, not of any pcre2 lib. diff --git a/recipes/pcre2/all/patches/0002-fix-cmake-c-std.patch b/recipes/pcre2/all/patches/0002-fix-cmake-c-std.patch new file mode 100644 index 0000000000000..e75faef54f312 --- /dev/null +++ b/recipes/pcre2/all/patches/0002-fix-cmake-c-std.patch @@ -0,0 +1,52 @@ +From 12b0e40ee4556318e5a0da3155f28bdfd7c5bc35 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Carlo=20Marcelo=20Arenas=20Bel=C3=B3n?= +Date: Sun, 15 Jan 2023 14:38:44 -0800 +Subject: [PATCH] build: make the C99 requirement explicit + +Recent code uses C99 syntax (as reported in #163, and therefore it +will fail to build unless C99 (or higher) support is required by the +compiler (gcc >= 5 does it by default). + +For those unfortunate to need an older compiler that does require a +flag to enable that, make sure that both autoconf and cmake make it +explicit. + +While testing the change with the ancient autoconf version listed as +a prerequisite, noticed that the LT_INIT syntax introduced with 91485e5 +(Update configure.ac for latest version of autoconf., 2021-02-02), was +not supported, so update the autoconf minimum as well. +--- + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index cec7dfb4..a8147575 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -107,1 +107,3 @@ + PROJECT(PCRE2 C) ++set(CMAKE_C_STANDARD 99) ++set(CMAKE_C_STANDARD_REQUIRED TRUE) + + # Set policy CMP0026 to avoid warnings for the use of LOCATION in + # GET_TARGET_PROPERTY. This should no longer be required. +diff --git a/configure.ac b/configure.ac +index ce5bda3c..67b2fdce 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -22,7 +22,7 @@ m4_define(libpcre2_posix_version, [3:4:0]) + # NOTE: The CMakeLists.txt file searches for the above variables in the first + # 50 lines of this file. Please update that if the variables above are moved. + +-AC_PREREQ([2.60]) ++AC_PREREQ([2.62]) + AC_INIT([PCRE2],pcre2_major.pcre2_minor[]pcre2_prerelease,[],[pcre2]) + AC_CONFIG_SRCDIR([src/pcre2.h.in]) + AM_INIT_AUTOMAKE([dist-bzip2 dist-zip]) +@@ -42,7 +42,7 @@ AC_CONFIG_MACRO_DIR([m4]) + + remember_set_CFLAGS="$CFLAGS" + +-AC_PROG_CC ++m4_version_prereq(2.70, [AC_PROG_CC], [AC_PROG_CC_C99]) + AM_PROG_CC_C_O + AC_USE_SYSTEM_EXTENSIONS + diff --git a/recipes/pcre2/all/test_package/conanfile.py b/recipes/pcre2/all/test_package/conanfile.py index 0a6bc68712d90..fafba71d30d56 100644 --- a/recipes/pcre2/all/test_package/conanfile.py +++ b/recipes/pcre2/all/test_package/conanfile.py @@ -22,5 +22,5 @@ def build(self): def test(self): if can_run(self): - bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + bin_path = os.path.join(self.cpp.build.bindir, "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/pcre2/config.yml b/recipes/pcre2/config.yml index f488a0ecff8cb..7b719e00064be 100644 --- a/recipes/pcre2/config.yml +++ b/recipes/pcre2/config.yml @@ -1,4 +1,8 @@ versions: + "10.44": + folder: all + "10.43": + folder: all "10.42": folder: all "10.40": diff --git a/recipes/pdcurses/all/CMakeLists.txt b/recipes/pdcurses/all/CMakeLists.txt deleted file mode 100644 index 217b9530b904d..0000000000000 --- a/recipes/pdcurses/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/pdcurses/all/conanfile.py b/recipes/pdcurses/all/conanfile.py index c9fb1fa9f32f7..b50701ab1011d 100644 --- a/recipes/pdcurses/all/conanfile.py +++ b/recipes/pdcurses/all/conanfile.py @@ -1,149 +1,198 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, tools -from conans.errors import ConanException, ConanInvalidConfiguration import os import re +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration, ConanException +from conan.tools.apple import is_apple_os +from conan.tools.build import cross_building +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import chdir, copy, get, load, replace_in_file, rmdir, save, rename +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, msvc_runtime_flag, unix_path, NMakeToolchain, NMakeDeps + +required_conan_version = ">=1.53.0" + class PDCursesConan(ConanFile): name = "pdcurses" description = "PDCurses - a curses library for environments that don't fit the termcap/terminfo model" - topics = ("conan", "pdcurses", "curses", "ncurses") + license = "LicenseRef-LICENSE" url = "https://github.com/conan-io/conan-center-index" homepage = "https://pdcurses.org/" - license = "Unlicense", "MITX", "CC-BY-4.0", "GPL", "FSFUL" + topics = ("curses", "ncurses") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], "enable_widec": [True, False], - "with_sdl": [None, "1", "2"], + "with_sdl": [True, False], + "with_x11": [True, False], } default_options = { "shared": False, "fPIC": True, "enable_widec": False, - "with_sdl": None, + "with_sdl": False, + "with_x11": True, } - _autotools = 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 self.settings.os not in ("FreeBSD", "Linux"): - del self.options.enable_widec + if self.settings.os not in ["FreeBSD", "Linux"]: + del self.options.with_x11 + if is_apple_os(self): + # Only the sdl2 subsystem is supported on macOS + self.options.with_sdl = True def configure(self): - if tools.is_apple_os(self.settings.os): - raise ConanInvalidConfiguration("pdcurses does not support Apple") - if self.options.with_sdl: - raise ConanInvalidConfiguration("conan-center-index has no packages for sdl (yet)") 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): - if self.settings.os in ("FreeBSD", "Linux"): + if self.options.with_sdl: + self.requires("sdl/2.28.5", transitive_libs=True) + if self.options.get_safe("with_x11"): self.requires("xorg/system") + def validate(self): + if self.options.with_sdl and self.settings.os == "Windows": + raise ConanInvalidConfiguration("with_sdl option is not yet supported on Windows") + if self.settings.os != "Windows" and not self.options.get_safe("with_x11") and not self.options.with_sdl: + raise ConanInvalidConfiguration("At least one of with_x11 or with_sdl options must be enabled") + if self.options.with_sdl: + if self.options.shared: + raise ConanInvalidConfiguration("Shared library output is not available for with_sdl option") + if cross_building(self): + raise ConanInvalidConfiguration("Cross-building is not supported for with_sdl option") + def build_requirements(self): - if self.settings.compiler != "Visual Studio": - self.build_requires("make/4.2.1") + if not is_msvc(self): + if not self.conf.get("tools.gnu:make_program", check_type=str): + self.tool_requires("make/4.4.1") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename("PDCurses-{}".format(self.version), self._source_subfolder) - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self) - conf_args = [ - "--enable-shared" if self.options.shared else "--disable-shared", - "--enable-widec" if self.options.enable_widec else "--disable-widec", - ] - self._autotools.configure(args=conf_args) - return self._autotools - - def _build_windows(self): - with tools.chdir(os.path.join(self._source_subfolder, "wincon")): - args = [] + 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() + deps = NMakeDeps(self) + deps.generate() + else: + tc = AutotoolsToolchain(self) + tc.configure_args.append("--prefix={}".format(unix_path(self, self.package_folder))) + tc.configure_args.append("--enable-widec" if self.options.enable_widec else "--disable-widec") if self.options.shared: - args.append("DLL=Y") - args = " ".join(args) - if self.settings.compiler == "Visual Studio": - with tools.vcvars(self): - self.run("nmake -f Makefile.vc {}".format(args)) - else: - self.run("{} libs {}".format(os.environ["CONAN_MAKE_PROGRAM"], args)) + tc.make_args.append("DLL=Y") + if self.options.with_sdl: + self.dependencies["sdl"].cpp_info.includedirs.append(os.path.join("include", "SDL2")) + sdl_info = self.dependencies["sdl"].cpp_info.aggregated_components() + def_flags = " ".join(f"-D{x}" for x in sdl_info.defines) + includedir_flags = " ".join(f"-I{x}" for x in sdl_info.includedirs) + libdir_flags = " ".join(f"-L{x}" for x in sdl_info.libdirs) + lib_flags = " ".join(f"-l{x}" for x in (sdl_info.libs + sdl_info.system_libs)) + tc.make_args += [ + f"CFLAGS={includedir_flags} {def_flags}", + f"LDFLAGS={libdir_flags} {lib_flags}", + ] + if self.options.enable_widec: + tc.make_args.append("WIDE=Y") + tc.generate() def _patch_sources(self): - if self.settings.compiler == "Visual Studio": - tools.replace_in_file(os.path.join(self._source_subfolder, "wincon", "Makefile.vc"), - "$(CFLAGS)", - "$(CFLAGS) -{}".format(self.settings.compiler.runtime)) - tools.replace_in_file(os.path.join(self._source_subfolder, "x11", "Makefile.in"), - "$(INSTALL) -c -m 644 $(osdir)/libXCurses.a $(libdir)/libXCurses.a", - "-$(INSTALL) -c -m 644 $(osdir)/libXCurses.a $(libdir)/libXCurses.a") - tools.replace_in_file(os.path.join(self._source_subfolder, "x11", "Makefile.in"), - "\nall:\t", - "\nall:\t{}\t#".format("@SHL_TARGETS@" if self.options.shared else "$(LIBCURSES)")) + if is_msvc(self): + replace_in_file(self, os.path.join(self.source_folder, "wincon", "Makefile.vc"), + "$(CFLAGS)", + "$(CFLAGS) -{}".format(msvc_runtime_flag(self))) + replace_in_file(self, os.path.join(self.source_folder, "x11", "Makefile.in"), + "$(INSTALL) -c -m 644 $(osdir)/libXCurses.a $(libdir)/libXCurses.a", + "-$(INSTALL) -c -m 644 $(osdir)/libXCurses.a $(libdir)/libXCurses.a") + replace_in_file(self, os.path.join(self.source_folder, "x11", "Makefile.in"), + "\nall:\t", + "\nall:\t{}\t#".format("@SHL_TARGETS@" if self.options.shared else "$(LIBCURSES)")) def build(self): self._patch_sources() - if self.settings.os == "Windows": - self._build_windows() + if is_msvc(self): + self._build_msvc() else: - with tools.chdir(os.path.join(self._source_subfolder, "x11")): - autotools = self._configure_autotools() + self._build_autotools() + + def _build_autotools(self): + if self.options.get_safe("with_x11"): + with chdir(self, os.path.join(self.source_folder, "x11")): + autotools = Autotools(self) + autotools.configure(build_script_folder=os.path.join(self.source_folder, "x11")) + autotools.make() + if self.options.with_sdl: + with chdir(self, os.path.join(self.source_folder, "sdl2")): + autotools = Autotools(self) autotools.make() - @property - def _subsystem_folder(self): - return { - "Windows": "wincon", - }.get(str(self.settings.os), "x11") + + def _build_msvc(self): + with chdir(self, os.path.join(self.source_folder, "wincon")): + args = [] + if self.options.shared: + args.append("DLL=Y") + if self.options.enable_widec: + args.append("WIDE=Y") + args = " ".join(args) + if is_msvc(self): + self.run(f"nmake -f Makefile.vc {args}") + else: + self.run(f"make libs {args}") @property def _license_text(self): - readme = tools.load(os.path.join(self._source_subfolder, self._subsystem_folder, "README.md")) - match = re.search(r"Distribution Status\n[\-]+(?:[\r\n])+((?:[0-9a-z .,;*]+[\r\n])+)", readme, - re.IGNORECASE | re.MULTILINE) - if not match: - raise ConanException("Cannot extract distribution status") - return match.group(1).strip() + "\n" + readme = load(self, os.path.join(self.source_folder, "README.md")) + match = re.search(r"Legal Stuff\n[\-]+[\r\n]+((?:.*\n)+)\n\nMaintainer", readme, re.IGNORECASE | re.MULTILINE) + license = match.group(1).strip() + "\n" + if self.options.get_safe("with_x11"): + readme = load(self, os.path.join(self.source_folder, "x11", "README.md")) + match = re.search(r"Distribution Status\n[\-]+[\r\n]+((?:[0-9a-z .,;*]+[\r\n])+)", readme, re.IGNORECASE | re.MULTILINE) + if not match: + raise ConanException("Cannot extract distribution status") + license += "\n" + match.group(1).strip() + "\n" + return license - def package(self): - tools.save(os.path.join(self.package_folder, "licenses", "LICENSE"), self._license_text) - if self.settings.os == "Windows": - self.copy(pattern="curses.h", src=self._source_subfolder, dst="include") - self.copy(pattern="*.dll", dst="bin", keep_path=False) - self.copy(pattern="*.lib", dst="lib", keep_path=False) - self.copy(pattern="*.a", dst="lib", keep_path=False) - - if self.settings.compiler != "Visual Studio": - os.rename(os.path.join(self.package_folder, "lib", "pdcurses.a"), - os.path.join(self.package_folder, "lib", "libpdcurses.a")) - else: - with tools.chdir(os.path.join(self._source_subfolder, "x11")): - autotools = self._configure_autotools() + def package(self): + save(self, os.path.join(self.package_folder, "licenses", "LICENSE"), self._license_text) + if self.options.get_safe("with_x11"): + with chdir(self, os.path.join(self.source_folder, "x11")): + autotools = Autotools(self) autotools.install() - tools.rmdir(os.path.join(self.package_folder, "bin")) + rmdir(self, os.path.join(self.package_folder, "bin")) + copy(self, "curses.h", dst=os.path.join(self.package_folder, "include"), src=self.source_folder) + build_folders = [] + if self.settings.os == "Windows": + build_folders += [self.source_folder] + if self.options.with_sdl: + build_folders += [os.path.join(self.source_folder, "sdl2")] + for build_folder in build_folders: + copy(self, "*.dll", dst=os.path.join(self.package_folder, "bin"), src=build_folder, keep_path=False) + for pattern in ["*.lib", "*.a", "*.so*", "*.dylib*"]: + copy(self, pattern, dst=os.path.join(self.package_folder, "lib"), src=build_folder, keep_path=False) + if (self.settings.os == "Windows" or self.options.with_sdl) and not is_msvc(self): + rename(self, os.path.join(self.package_folder, "lib", "pdcurses.a"), + os.path.join(self.package_folder, "lib", "libpdcurses.a")) def package_info(self): - if self.settings.os == "Windows": + if self.settings.os == "Windows" or self.options.with_sdl: self.cpp_info.libs = ["pdcurses"] - elif self.settings.os in ("FreeBSD", "Linux"): + if self.options.get_safe("with_x11"): self.cpp_info.includedirs.append(os.path.join("include", "xcurses")) - self.cpp_info.libs = ["XCurses"] + self.cpp_info.libs += ["XCurses"] diff --git a/recipes/pdcurses/all/test_package/CMakeLists.txt b/recipes/pdcurses/all/test_package/CMakeLists.txt index 7b9b613cbb24a..06f34416c70f6 100644 --- a/recipes/pdcurses/all/test_package/CMakeLists.txt +++ b/recipes/pdcurses/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ -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() +find_package(pdcurses REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE pdcurses::pdcurses) diff --git a/recipes/pdcurses/all/test_package/conanfile.py b/recipes/pdcurses/all/test_package/conanfile.py index 4aebe114eeb59..ef5d7042163ec 100644 --- a/recipes/pdcurses/all/test_package/conanfile.py +++ b/recipes/pdcurses/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 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.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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/pdcurses/all/test_v1_package/CMakeLists.txt b/recipes/pdcurses/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/pdcurses/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/pdcurses/all/test_v1_package/conanfile.py b/recipes/pdcurses/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..3f4a9f50f389e --- /dev/null +++ b/recipes/pdcurses/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +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.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/pdf-writer/all/conandata.yml b/recipes/pdf-writer/all/conandata.yml new file mode 100644 index 0000000000000..0d800cc7a7750 --- /dev/null +++ b/recipes/pdf-writer/all/conandata.yml @@ -0,0 +1,51 @@ +sources: + "4.6.7": + url: "https://github.com/galkahana/PDF-Writer/archive/refs/tags/v4.6.7.tar.gz" + sha256: "735c65d4685c5156f0876635f3bc1565700d0f648fbb1f384e46d186796c8bae" + "4.6.6": + url: "https://github.com/galkahana/PDF-Writer/archive/refs/tags/v4.6.6.tar.gz" + sha256: "8343820313e553052df68c75fe2bf35353da2719106e81eb2a8b026ff96c7d7c" + "4.6.4": + url: "https://github.com/galkahana/PDF-Writer/archive/refs/tags/v4.6.4.tar.gz" + sha256: "93b5f1dc88fd67fdebde409e927e828dfbae02efa44936e89728622411c6a047" + "4.6.3": + url: "https://github.com/galkahana/PDF-Writer/archive/refs/tags/v4.6.3.tar.gz" + sha256: "3b5d9ba4b49d0380678e8172f27cdb8eda196ea448e7f1cdd79620066d082ab9" + "4.6.2": + url: "https://github.com/galkahana/PDF-Writer/archive/refs/tags/v4.6.2.tar.gz" + sha256: "0a36815ccc9d207028567f90039785c824b211169ba5da68de84d0c15455ab62" + "4.6.1": + url: "https://github.com/galkahana/PDF-Writer/archive/refs/tags/v4.6.1.tar.gz" + sha256: "6e95fcb26ec679fa12ce6638d35a591e80960b35956a142d9a80b9a8c80ca824" + "4.5.12": + url: "https://github.com/galkahana/PDF-Writer/archive/refs/tags/v4.5.12.tar.gz" + sha256: "40fcbaa66fc46fcb588ceda119ba8839ff6d2c886191ac5e68ed702475c7336e" +patches: + "4.6.7": + - patch_file: "patches/4.6.6-0001-fix-cmake.patch" + patch_description: "disable cpack" + patch_type: "conan" + "4.6.6": + - patch_file: "patches/4.6.6-0001-fix-cmake.patch" + patch_description: "disable cpack" + patch_type: "conan" + "4.6.4": + - patch_file: "patches/4.6.2-0001-fix-cmake.patch" + patch_description: "disable cpack" + patch_type: "conan" + "4.6.3": + - patch_file: "patches/4.6.2-0001-fix-cmake.patch" + patch_description: "disable cpack" + patch_type: "conan" + "4.6.2": + - patch_file: "patches/4.6.2-0001-fix-cmake.patch" + patch_description: "disable cpack" + patch_type: "conan" + "4.6.1": + - patch_file: "patches/4.5.12-0001-fix-cmake.patch" + patch_description: "disable test/cpack, use cci package" + patch_type: "conan" + "4.5.12": + - patch_file: "patches/4.5.12-0001-fix-cmake.patch" + patch_description: "disable test/cpack, use cci package" + patch_type: "conan" diff --git a/recipes/pdf-writer/all/conanfile.py b/recipes/pdf-writer/all/conanfile.py new file mode 100644 index 0000000000000..a535f209e9a7b --- /dev/null +++ b/recipes/pdf-writer/all/conanfile.py @@ -0,0 +1,101 @@ +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.gnu import PkgConfigDeps +import os + +required_conan_version = ">=1.53.0" + +class PDFWriterConan(ConanFile): + name = "pdf-writer" + description = "High performance library for creating, modiyfing and parsing PDF files in C++" + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/galkahana/PDF-Writer" + topics = ("pdf", "writer") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_png": [True, False], + "with_jpeg": [True, False], + "with_tiff": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_png": True, + "with_jpeg": True, + "with_tiff": 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("freetype/2.13.0") + self.requires("libaesgm/2013.1.1") + self.requires("zlib/[>=1.2.11 <2]") + if self.options.with_png: + self.requires("libjpeg/9e") + if self.options.with_jpeg: + self.requires("libpng/[>=1.6 <2]") + if self.options.with_tiff: + self.requires("libtiff/4.6.0") + + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["USE_BUNDLED"] = False + tc.generate() + deps = PkgConfigDeps(self) + deps.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() + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "PDFHummus") + self.cpp_info.set_property("cmake_target_name", "PDFHummus::PDFWriter") + self.cpp_info.libs = ["PDFWriter"] + self.cpp_info.requires = ["freetype::freetype", "zlib::zlib", "libaesgm::libaesgm"] + if self.options.with_png: + self.cpp_info.requires.append("libjpeg::libjpeg") + if self.options.with_jpeg: + self.cpp_info.requires.append("libpng::libpng") + if self.options.with_tiff: + self.cpp_info.requires.append("libtiff::libtiff") diff --git a/recipes/pdf-writer/all/patches/4.5.12-0001-fix-cmake.patch b/recipes/pdf-writer/all/patches/4.5.12-0001-fix-cmake.patch new file mode 100644 index 0000000000000..02aec77b37c06 --- /dev/null +++ b/recipes/pdf-writer/all/patches/4.5.12-0001-fix-cmake.patch @@ -0,0 +1,42 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 8dcb27d..ca69cdf 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -153,21 +153,21 @@ endif(NOT USE_BUNDLED) + + ADD_SUBDIRECTORY(PDFWriter) + +-if(PROJECT_IS_TOP_LEVEL) ++if(0) + # avoid installing the testing lib altogether when included in another project. + # it's annoying when in parent all, and more annoying to then get the tests added + # to the parent project ctest. + enable_testing() + ADD_SUBDIRECTORY(PDFWriterTesting) +-endif(PROJECT_IS_TOP_LEVEL) ++endif() + +-include(InstallRequiredSystemLibraries) +-set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") +-set(CPACK_PACKAGE_VERSION_MAJOR "${PDFHummus_VERSION_MAJOR}") +-set(CPACK_PACKAGE_VERSION_MINOR "${PDFHummus_VERSION_MINOR}") +-set(CPACK_SOURCE_GENERATOR "ZIP") +-set(CPACK_GENERATOR "ZIP") +-include(CPack) ++# include(InstallRequiredSystemLibraries) ++# set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") ++# set(CPACK_PACKAGE_VERSION_MAJOR "${PDFHummus_VERSION_MAJOR}") ++# set(CPACK_PACKAGE_VERSION_MINOR "${PDFHummus_VERSION_MINOR}") ++# set(CPACK_SOURCE_GENERATOR "ZIP") ++# set(CPACK_GENERATOR "ZIP") ++# include(CPack) + + install(EXPORT PDFHummusTargets + FILE PDFHummusTargets.cmake +@@ -196,4 +196,4 @@ install(FILES + export(EXPORT PDFHummusTargets + FILE "${CMAKE_CURRENT_BINARY_DIR}/PDFHummusTargets.cmake" + NAMESPACE PDFHummus:: +-) +\ No newline at end of file ++) diff --git a/recipes/pdf-writer/all/patches/4.6.2-0001-fix-cmake.patch b/recipes/pdf-writer/all/patches/4.6.2-0001-fix-cmake.patch new file mode 100644 index 0000000000000..ffff2588e7efa --- /dev/null +++ b/recipes/pdf-writer/all/patches/4.6.2-0001-fix-cmake.patch @@ -0,0 +1,25 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index e32c883..e9ab456 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -161,13 +161,13 @@ if(PROJECT_IS_TOP_LEVEL AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/PDFWriterTesting) + ADD_SUBDIRECTORY(PDFWriterTesting) + endif() + +-include(InstallRequiredSystemLibraries) +-set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") +-set(CPACK_PACKAGE_VERSION_MAJOR "${PDFHummus_VERSION_MAJOR}") +-set(CPACK_PACKAGE_VERSION_MINOR "${PDFHummus_VERSION_MINOR}") +-set(CPACK_SOURCE_GENERATOR "ZIP") +-set(CPACK_GENERATOR "ZIP") +-include(CPack) ++#include(InstallRequiredSystemLibraries) ++#set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") ++#set(CPACK_PACKAGE_VERSION_MAJOR "${PDFHummus_VERSION_MAJOR}") ++#set(CPACK_PACKAGE_VERSION_MINOR "${PDFHummus_VERSION_MINOR}") ++#set(CPACK_SOURCE_GENERATOR "ZIP") ++#set(CPACK_GENERATOR "ZIP") ++#include(CPack) + + install(EXPORT PDFHummusTargets + FILE PDFHummusTargets.cmake diff --git a/recipes/pdf-writer/all/patches/4.6.6-0001-fix-cmake.patch b/recipes/pdf-writer/all/patches/4.6.6-0001-fix-cmake.patch new file mode 100644 index 0000000000000..0f818e64d81ab --- /dev/null +++ b/recipes/pdf-writer/all/patches/4.6.6-0001-fix-cmake.patch @@ -0,0 +1,32 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 956c730..a7d809b 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -165,13 +165,13 @@ if(PROJECT_IS_TOP_LEVEL AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/PDFWriterTesting) + ADD_SUBDIRECTORY(PDFWriterTesting) + endif() + +-include(InstallRequiredSystemLibraries) +-set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") +-set(CPACK_PACKAGE_VERSION_MAJOR "${PDFHummus_VERSION_MAJOR}") +-set(CPACK_PACKAGE_VERSION_MINOR "${PDFHummus_VERSION_MINOR}") +-set(CPACK_SOURCE_GENERATOR "ZIP") +-set(CPACK_GENERATOR "ZIP") +-include(CPack) ++# include(InstallRequiredSystemLibraries) ++# set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") ++# set(CPACK_PACKAGE_VERSION_MAJOR "${PDFHummus_VERSION_MAJOR}") ++# set(CPACK_PACKAGE_VERSION_MINOR "${PDFHummus_VERSION_MINOR}") ++# set(CPACK_SOURCE_GENERATOR "ZIP") ++# set(CPACK_GENERATOR "ZIP") ++# include(CPack) + + install(EXPORT PDFHummusTargets + FILE PDFHummusTargets.cmake +@@ -200,4 +200,4 @@ install(FILES + export(EXPORT PDFHummusTargets + FILE "${CMAKE_CURRENT_BINARY_DIR}/PDFHummusTargets.cmake" + NAMESPACE PDFHummus:: +-) +\ No newline at end of file ++) diff --git a/recipes/pdf-writer/all/test_package/CMakeLists.txt b/recipes/pdf-writer/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..079a134d31c95 --- /dev/null +++ b/recipes/pdf-writer/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(PDFHummus REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE PDFHummus::PDFWriter) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/pdf-writer/all/test_package/conanfile.py b/recipes/pdf-writer/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fb96656f203 --- /dev/null +++ b/recipes/pdf-writer/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/pdf-writer/all/test_package/test_package.cpp b/recipes/pdf-writer/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..aa251ff45f385 --- /dev/null +++ b/recipes/pdf-writer/all/test_package/test_package.cpp @@ -0,0 +1,26 @@ +#include +#include "PDFWriter/PDFWriter.h" + +int main(void) { + PDFWriter pdfWriter; + + auto status = pdfWriter.StartPDF( + "test_package.pdf", + ePDFVersion13, + LogConfiguration(true, true, "AppendPagesTestLog.txt") + ); + + if (status != PDFHummus::eSuccess) { + std::cerr << "failed to create pdf" << std::endl; + return 1; + } + + status = pdfWriter.EndPDF(); + + if (status != PDFHummus::eSuccess) { + std::cerr << "failed to close pdf" << std::endl; + return 1; + } + + return 0; +} diff --git a/recipes/pdf-writer/config.yml b/recipes/pdf-writer/config.yml new file mode 100644 index 0000000000000..36e4d583c87ad --- /dev/null +++ b/recipes/pdf-writer/config.yml @@ -0,0 +1,15 @@ +versions: + "4.6.7": + folder: all + "4.6.6": + folder: all + "4.6.4": + folder: all + "4.6.3": + folder: all + "4.6.2": + folder: all + "4.6.1": + folder: all + "4.5.12": + folder: all diff --git a/recipes/pdfgen/all/CMakeLists.txt b/recipes/pdfgen/all/CMakeLists.txt new file mode 100644 index 0000000000000..7f6aaaf0116da --- /dev/null +++ b/recipes/pdfgen/all/CMakeLists.txt @@ -0,0 +1,20 @@ +cmake_minimum_required(VERSION 3.8) +project(pdfgen LANGUAGES C) + +add_library(pdfgen ${PDFGEN_SRC_DIR}/pdfgen.c) +set_target_properties(pdfgen PROPERTIES + PUBLIC_HEADER ${PDFGEN_SRC_DIR}/pdfgen.h + WINDOWS_EXPORT_ALL_SYMBOLS ON + C_EXTENSIONS OFF + C_STANDARD 99 +) + +include(GNUInstallDirs) + +install( + TARGETS pdfgen + 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/pdfgen/all/conandata.yml b/recipes/pdfgen/all/conandata.yml new file mode 100644 index 0000000000000..cdaa13edf4bdb --- /dev/null +++ b/recipes/pdfgen/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.1.0": + url: "https://github.com/AndreRenaud/PDFGen/archive/refs/tags/0.1.0.tar.gz" + sha256: "606f6dfab90e80ccb21bab558351c783e3791dc85217ada766c1aa352917aea8" diff --git a/recipes/pdfgen/all/conanfile.py b/recipes/pdfgen/all/conanfile.py new file mode 100644 index 0000000000000..d690844af85f7 --- /dev/null +++ b/recipes/pdfgen/all/conanfile.py @@ -0,0 +1,58 @@ +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 PdfgenConan(ConanFile): + name = "pdfgen" + description = "Simple C PDF Writer/Generation library" + license = "Unlicense" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/AndreRenaud/PDFGen" + topics = ("pdf", "generation") + 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.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) + tc.variables["PDFGEN_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 = ["pdfgen"] diff --git a/recipes/pdfgen/all/test_package/CMakeLists.txt b/recipes/pdfgen/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..5e3c8b32c96da --- /dev/null +++ b/recipes/pdfgen/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES C) + +find_package(pdfgen REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE pdfgen::pdfgen) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) diff --git a/recipes/pdfgen/all/test_package/conanfile.py b/recipes/pdfgen/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fbb7f543162 --- /dev/null +++ b/recipes/pdfgen/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/pdfgen/all/test_package/test_package.c b/recipes/pdfgen/all/test_package/test_package.c new file mode 100644 index 0000000000000..097335494c13b --- /dev/null +++ b/recipes/pdfgen/all/test_package/test_package.c @@ -0,0 +1,17 @@ +#include "pdfgen.h" + +int main() { + struct pdf_info info = { + .creator = "My software", + .producer = "My software", + .title = "My document", + .author = "My name", + .subject = "My subject", + .date = "Today" + }; + struct pdf_doc *pdf = pdf_create(PDF_A4_WIDTH, PDF_A4_HEIGHT, &info); + + pdf_destroy(pdf); + + return 0; +} diff --git a/recipes/pdfgen/all/test_v1_package/CMakeLists.txt b/recipes/pdfgen/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..be00a8c7f57c7 --- /dev/null +++ b/recipes/pdfgen/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/pdfgen/all/test_v1_package/conanfile.py b/recipes/pdfgen/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/pdfgen/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/pdfgen/config.yml b/recipes/pdfgen/config.yml new file mode 100644 index 0000000000000..6c11a439d0bc2 --- /dev/null +++ b/recipes/pdfgen/config.yml @@ -0,0 +1,3 @@ +versions: + "0.1.0": + folder: all diff --git a/recipes/pdfium/all/CMakeLists.txt b/recipes/pdfium/all/CMakeLists.txt deleted file mode 100644 index f083cc38ef65c..0000000000000 --- a/recipes/pdfium/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.0) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -add_subdirectory(pdfium-cmake/cmake) diff --git a/recipes/pdfium/all/conandata.yml b/recipes/pdfium/all/conandata.yml index 06bb1b45201c1..77888f52bfe69 100644 --- a/recipes/pdfium/all/conandata.yml +++ b/recipes/pdfium/all/conandata.yml @@ -1,11 +1,11 @@ sources: - "cci.20210730": + "95.0.4629": pdfium-cmake: - # FIXME: create release + use hash - url: "https://github.com/madebr/pdfium-cmake/archive/0abc6ac8b3ecd2faac45bf46ee79bf381b5b5890.zip" - sha256: "8bcbb1eb6ec171604d669585f289c609d3b6c95045525d0e510c3fee7851d44e" + # FIXME: create release + url: "https://github.com/madebr/pdfium-cmake/archive/e02962c2ebf6d1a2edc7b05bb4fc8cb73cac5b18.zip" + sha256: "e8454d098af887bc989fbbc955b32566b109b4f03350fb6c08cc7f2e359a909f" pdfium: - url: "https://pdfium.googlesource.com/pdfium/+archive/6c8cd905587809a0ff299d1edb34fc85bed4c976.tar.gz" + url: "https://pdfium.googlesource.com/pdfium/+archive/refs/heads/chromium/4629.tar.gz" # sha256 is volatile on googlesource, no up-to-date github fork trace_event: url: "https://chromium.googlesource.com/chromium/src/base/trace_event/common/+archive/ad56859ef8c85cc09a3d8e95dcedadb5109a0af8.tar.gz" diff --git a/recipes/pdfium/all/conanfile.py b/recipes/pdfium/all/conanfile.py index e8af8fb6f31c4..4e4268e4ab4a3 100644 --- a/recipes/pdfium/all/conanfile.py +++ b/recipes/pdfium/all/conanfile.py @@ -1,17 +1,26 @@ -from conans import CMake, ConanFile, 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 is_apple_os +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 copy, get +from conan.tools.gnu import PkgConfigDeps +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" class PdfiumConan(ConanFile): name = "pdfium" description = "PDF generation and rendering library." license = "BSD-3-Clause" - topics = ("conan", "pdfium", "generate", "generation", "rendering", "pdf", "document", "print") - homepage = "https://opensource.google/projects/pdfium" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://opensource.google/projects/pdfium" + topics = ("generate", "generation", "rendering", "pdf", "document", "print") + + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -24,84 +33,83 @@ class PdfiumConan(ConanFile): "with_libjpeg": "libjpeg", } - exports_sources = "CMakeLists.txt" - generators = "cmake", "cmake_find_package", "pkg_config" - short_paths = 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 + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("freetype/2.10.4") - self.requires("icu/69.1") - self.requires("lcms/2.11") - self.requires("openjpeg/2.4.0") + self.requires("freetype/2.13.2") + self.requires("icu/74.1") + self.requires("lcms/2.16") + self.requires("openjpeg/2.5.0") + self.requires("zlib/[>=1.2.11 <2]") if self.options.with_libjpeg == "libjpeg": - self.requires("libjpeg/9d") + self.requires("libjpeg/9e") elif self.options.with_libjpeg == "libjpeg-turbo": - self.requires("libjpeg-turbo/2.1.0") - - def build_requirements(self): - self.build_requires("pkgconf/1.7.4") + self.requires("libjpeg-turbo/3.0.1") def validate(self): if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 14) + check_min_cppstd(self, 14) minimum_compiler_versions = { - "gcc": 8, - "Visual Studio": 15, + "gcc": "8", + "msvc": "191", + "Visual Studio": "15", } min_compiler_version = minimum_compiler_versions.get(str(self.settings.compiler)) - if min_compiler_version: - if tools.Version(self.settings.compiler.version) < min_compiler_version: - raise ConanInvalidConfiguration("pdfium needs at least compiler version {}".format(min_compiler_version)) + if min_compiler_version and Version(self.settings.compiler.version) < min_compiler_version: + raise ConanInvalidConfiguration( + f"pdfium needs at least compiler version {min_compiler_version}" + ) + + def build_requirements(self): + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/2.0.3") def source(self): - tools.get(**self.conan_data["sources"][self.version]["pdfium-cmake"], - destination="pdfium-cmake", strip_root=True) - tools.get(**self.conan_data["sources"][self.version]["pdfium"], - destination=self._source_subfolder) - tools.get(**self.conan_data["sources"][self.version]["trace_event"], - destination=os.path.join(self._source_subfolder, "base", "trace_event", "common")) - tools.get(**self.conan_data["sources"][self.version]["chromium_build"], - destination=os.path.join(self._source_subfolder, "build")) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["PDFIUM_ROOT"] = os.path.join(self.source_folder, self._source_subfolder).replace("\\", "/") - self._cmake.definitions["PDF_LIBJPEG_TURBO"] = self.options.with_libjpeg == "libjpeg-turbo" - self._cmake.configure() - return self._cmake + get(self, **self.conan_data["sources"][self.version]["pdfium-cmake"], + destination=os.path.join(self.source_folder, "pdfium-cmake"), strip_root=True) + get(self, **self.conan_data["sources"][self.version]["pdfium"], + destination=self.source_folder) + get(self, **self.conan_data["sources"][self.version]["trace_event"], + destination=os.path.join(self.source_folder, "base", "trace_event", "common")) + get(self, **self.conan_data["sources"][self.version]["chromium_build"], + destination=os.path.join(self.source_folder, "build")) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["PDFIUM_ROOT"] = self.source_folder.replace("\\", "/") + tc.variables["PDF_LIBJPEG_TURBO"] = self.options.with_libjpeg == "libjpeg-turbo" + tc.variables["PDF_ENABLE_XFA"] = False # TODO: pdfium-cmake needs updating + tc.variables["PDF_ENABLE_V8"] = False # TODO: requires v8 + tc.generate() + deps = CMakeDeps(self) + deps.generate() + deps = PkgConfigDeps(self) + deps.generate() def build(self): - cmake = self._configure_cmake() - cmake.build() - cmake.configure() + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join("pdfium-cmake", "cmake")) cmake.build() def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - 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 = ["pdfium"] - if tools.is_apple_os(self.settings.os): - self.cpp_info.frameworks.extend(["Appkit", "CoreFoundation", "CoreGraphics"]) + if is_apple_os(self): + self.cpp_info.frameworks.extend(["AppKit", "CoreFoundation", "CoreGraphics"]) - stdcpp_library = tools.stdcpp_library(self) - if stdcpp_library: - self.cpp_info.system_libs.append(stdcpp_library) + stdcpp = stdcpp_library(self) + if stdcpp: + self.cpp_info.system_libs.append(stdcpp) diff --git a/recipes/pdfium/all/test_package/CMakeLists.txt b/recipes/pdfium/all/test_package/CMakeLists.txt index 7b9b613cbb24a..ca11fa5323a30 100644 --- a/recipes/pdfium/all/test_package/CMakeLists.txt +++ b/recipes/pdfium/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ -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() +find_package(pdfium REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE pdfium::pdfium) diff --git a/recipes/pdfium/all/test_package/conanfile.py b/recipes/pdfium/all/test_package/conanfile.py index 32e61b0a20959..ef5d7042163ec 100644 --- a/recipes/pdfium/all/test_package/conanfile.py +++ b/recipes/pdfium/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 -from conan.tools.build import cross_building 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) @@ -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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/pdfium/all/test_v1_package/CMakeLists.txt b/recipes/pdfium/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/pdfium/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/pdfium/all/test_v1_package/conanfile.py b/recipes/pdfium/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..4c2f046547705 --- /dev/null +++ b/recipes/pdfium/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +import os + +from conans import ConanFile, CMake, 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/pdfium/config.yml b/recipes/pdfium/config.yml index a851713f93a20..6425f0ce6fe06 100644 --- a/recipes/pdfium/config.yml +++ b/recipes/pdfium/config.yml @@ -1,3 +1,3 @@ versions: - "cci.20210730": + "95.0.4629": # released 2021-08-28 folder: all diff --git a/recipes/pdqsort/all/conanfile.py b/recipes/pdqsort/all/conanfile.py index c6b4987b3d5ef..0a1df56b8a3d7 100644 --- a/recipes/pdqsort/all/conanfile.py +++ b/recipes/pdqsort/all/conanfile.py @@ -13,18 +13,18 @@ class PdqsortConan(ConanFile): topics = ("pdqsort", "sort") homepage = "https://github.com/orlp/pdqsort" url = "https://github.com/conan-io/conan-center-index" + package_type = "header-library" 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 @@ -35,6 +35,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/pdqsort/all/test_package/conanfile.py b/recipes/pdqsort/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/pdqsort/all/test_package/conanfile.py +++ b/recipes/pdqsort/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/pdqsort/all/test_v1_package/CMakeLists.txt b/recipes/pdqsort/all/test_v1_package/CMakeLists.txt index 400c3982bde1a..b21cc49efde95 100644 --- a/recipes/pdqsort/all/test_v1_package/CMakeLists.txt +++ b/recipes/pdqsort/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.15) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(pdqsort REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE pdqsort::pdqsort) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/perf/all/conandata.yml b/recipes/perf/all/conandata.yml index 72be9d8648e78..7cffe456681ae 100644 --- a/recipes/perf/all/conandata.yml +++ b/recipes/perf/all/conandata.yml @@ -5,4 +5,3 @@ sources: patches: "5.13": - patch_file: patches/0001-Wno-strict-prototypes.patch - base_path: source_subfolder diff --git a/recipes/perf/all/conanfile.py b/recipes/perf/all/conanfile.py index 2b1346904f2b5..cfea4cd9b1a61 100644 --- a/recipes/perf/all/conanfile.py +++ b/recipes/perf/all/conanfile.py @@ -1,51 +1,74 @@ -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.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 + +required_conan_version = ">=1.47.0" + class Perf(ConanFile): name = "perf" description = "Linux profiling with performance counters" - topics = ("linux", "profiling") + license = "GPL-2.0 WITH Linux-syscall-note" url = "https://github.com/conan-io/conan-center-index" homepage = "https://perf.wiki.kernel.org/index.php" - license = "GPL-2.0 WITH Linux-syscall-note" - settings = "os", "compiler", "build_type", "arch" - exports_sources = "patches/*" + topics = ("linux", "profiling") - @property - def _source_subfolder(self): - return "source_subfolder" + package_type = "application" + 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.settings.os != "Linux": + if self.settings.os not in ["Linux", "FreeBSD"]: raise ConanInvalidConfiguration("perf is supported only on Linux") def build_requirements(self): - self.build_requires("flex/2.6.4") - self.build_requires("bison/3.5.3") + self.tool_requires("flex/2.6.4") + self.tool_requires("bison/3.8.2") 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): + tc = AutotoolsToolchain(self) + tc.make_args += ["NO_LIBPYTHON=1"] + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - autotools = AutoToolsBuildEnvironment(self) - with tools.chdir(os.path.join(self.build_folder, self._source_subfolder, "tools", "perf")): - vars=autotools.vars - vars["NO_LIBPYTHON"] = "1" - autotools.make(vars=vars) + apply_conandata_patches(self) + autotools = Autotools(self) + with chdir(self, os.path.join(self.source_folder, "tools", "perf")): + autotools.make() def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") - self.copy("LICENSES/**", src=self._source_subfolder, dst="licenses") - - self.copy("perf", src=os.path.join(self._source_subfolder, "tools", "perf"), dst="bin") + copy(self, "COPYING", + src=self.source_folder, + dst=os.path.join(self.package_folder, "licenses")) + copy(self, "LICENSES/**", + src=self.source_folder, + dst=os.path.join(self.package_folder, "licenses")) + copy(self, "perf", + src=os.path.join(self.source_folder, "tools", "perf"), + dst=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: remove in conan v2 bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: %s" % bin_path) + self.output.info(f"Appending PATH environment variable: {bin_path}") self.env_info.PATH.append(bin_path) diff --git a/recipes/perf/all/test_package/conanfile.py b/recipes/perf/all/test_package/conanfile.py index 4001f8991b676..451dee24987b0 100644 --- a/recipes/perf/all/test_package/conanfile.py +++ b/recipes/perf/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): - self.run("perf version") + self.run("perf version") diff --git a/recipes/perf/all/test_v1_package/conanfile.py b/recipes/perf/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..4001f8991b676 --- /dev/null +++ b/recipes/perf/all/test_v1_package/conanfile.py @@ -0,0 +1,9 @@ +from conans import ConanFile, tools + + +class TestPackage(ConanFile): + settings = "os", "arch", "compiler", "build_type" + + def test(self): + if not tools.cross_building(self): + self.run("perf version") diff --git a/recipes/perfetto/all/conandata.yml b/recipes/perfetto/all/conandata.yml index e05df11e26350..c8178a3bde6b9 100644 --- a/recipes/perfetto/all/conandata.yml +++ b/recipes/perfetto/all/conandata.yml @@ -1,54 +1,25 @@ sources: - "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" - "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": - 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" - "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" + "48.1": + url: "https://github.com/google/perfetto/archive/refs/tags/v48.1.tar.gz" + sha256: "8d1c6bf44f1bdb098ab70cd60da3ce6b6e731e4eb21dd52b2527cbdcf85d984d" + "47.0": + url: "https://github.com/google/perfetto/archive/refs/tags/v47.0.tar.gz" + sha256: "9bbd38a0f074038bde6ccbcf5f2ff32587eb60faec254932268ecb6f17f18186" + "45.0": + url: "https://github.com/google/perfetto/archive/refs/tags/v45.0.tar.gz" + sha256: "dcb815fb54370fa20a657552288016cb66e7a98237c1a1d47e7645a4325ac75e" + "44.0": + url: "https://github.com/google/perfetto/archive/refs/tags/v44.0.tar.gz" + sha256: "db4162ee6495b1fcc13ba7aca77d67f9fd1766d184743137a04af8b1e3906b9d" + "43.1": + url: "https://github.com/google/perfetto/archive/refs/tags/v43.1.tar.gz" + sha256: "0f23ba39520c9ec629c48dc36a3a4bb92ed9653ac6694445be22985205a3f4ce" + "42.0": + url: "https://github.com/google/perfetto/archive/refs/tags/v42.0.tar.gz" + sha256: "1c474a0f16cc2f9da826fd3f9e44ffd77785c433e997cdaf0ee390ae3d64b53e" + "41.0": + url: "https://github.com/google/perfetto/archive/refs/tags/v41.0.tar.gz" + sha256: "4c8fe8a609fcc77ca653ec85f387ab6c3a048fcd8df9275a1aa8087984b89db8" + "40.0": + url: "https://github.com/google/perfetto/archive/refs/tags/v40.0.tar.gz" + sha256: "bd78f0165e66026c31c8c39221ed2863697a8bba5cd39b12e4b43d0b7f71626f" diff --git a/recipes/perfetto/all/conanfile.py b/recipes/perfetto/all/conanfile.py index 44d0edf055cd6..d311c92822b0a 100644 --- a/recipes/perfetto/all/conanfile.py +++ b/recipes/perfetto/all/conanfile.py @@ -2,7 +2,7 @@ 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.files import copy, get from conan.tools.microsoft import is_msvc from conan.tools.scm import Version import os @@ -12,11 +12,12 @@ class PerfettoConan(ConanFile): name = "perfetto" + description = "Performance instrumentation and tracing for Android, Linux and Chrome" license = "Apache-2.0" - homepage = "https://perfetto.dev" url = "https://github.com/conan-io/conan-center-index" - description = "Performance instrumentation and tracing for Android, Linux and Chrome" + homepage = "https://perfetto.dev" topics = ("linux", "profiling", "tracing") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -28,26 +29,24 @@ class PerfettoConan(ConanFile): "fPIC": True, "disable_logging": False, } - short_paths = True @property def _minimum_cpp_standard(self): - return 11 if Version(self.version) < "31.0" else 17 + return 17 @property def _minimum_compilers_version(self): return { - "Visual Studio": "15" if Version(self.version) < "31.0" else "16", + "Visual Studio": "16" if Version(self.version) < "48.0" else "17", "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", + "clang": "5", + "apple-clang": "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": @@ -78,8 +77,7 @@ def loose_lt_semver(v1, v2): ) 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) @@ -89,7 +87,6 @@ def generate(self): tc.generate() def build(self): - apply_conandata_patches(self) cmake = CMake(self) cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() @@ -102,9 +99,8 @@ def package(self): def package_info(self): self.cpp_info.libs = ["perfetto"] if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.system_libs.append("pthread") + self.cpp_info.system_libs.extend(["pthread", "m"]) 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/v20.1/0001-Fix-perfetto-logging-when-PERFETTO_DISABLE_LOG-activ.patch b/recipes/perfetto/all/patches/v20.1/0001-Fix-perfetto-logging-when-PERFETTO_DISABLE_LOG-activ.patch deleted file mode 100644 index 27f4b089cd4fd..0000000000000 --- a/recipes/perfetto/all/patches/v20.1/0001-Fix-perfetto-logging-when-PERFETTO_DISABLE_LOG-activ.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff --git a/sdk/perfetto.h b/sdk/perfetto.h -index a362342d0..d5fb9e997 100644 ---- a/sdk/perfetto.h -+++ b/sdk/perfetto.h -@@ -580,7 +580,8 @@ PERFETTO_EXPORT void LogMessage(LogLev, - __LINE__, ##__VA_ARGS__); \ - } while (0) - #elif defined(PERFETTO_DISABLE_LOG) --#define PERFETTO_XLOG(...) ::perfetto::base::ignore_result(__VA_ARGS__) -+#define PERFETTO_XLOG(level, fmt, ...) ::perfetto::base::ignore_result(level, \ -+ fmt, ##__VA_ARGS__) - #else - #define PERFETTO_XLOG(level, fmt, ...) \ - ::perfetto::base::LogMessage(level, ::perfetto::base::Basename(__FILE__), \ diff --git a/recipes/perfetto/all/patches/v21.x/0001-Fix-perfetto-logging-when-PERFETTO_DISABLE_LOG-activ.patch b/recipes/perfetto/all/patches/v21.x/0001-Fix-perfetto-logging-when-PERFETTO_DISABLE_LOG-activ.patch deleted file mode 100644 index 56e86bb66c9e9..0000000000000 --- a/recipes/perfetto/all/patches/v21.x/0001-Fix-perfetto-logging-when-PERFETTO_DISABLE_LOG-activ.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff --git a/sdk/perfetto.h b/sdk/perfetto.h -index 4509cbda5..7cd41d570 100644 ---- a/sdk/perfetto.h -+++ b/sdk/perfetto.h -@@ -622,7 +622,8 @@ inline void MaybeSerializeLastLogsForCrashReporting() {} - __LINE__, ##__VA_ARGS__); \ - } while (0) - #elif defined(PERFETTO_DISABLE_LOG) --#define PERFETTO_XLOG(...) ::perfetto::base::ignore_result(__VA_ARGS__) -+#define PERFETTO_XLOG(level, fmt, ...) ::perfetto::base::ignore_result(level, \ -+ fmt, ##__VA_ARGS__) - #else - #define PERFETTO_XLOG(level, fmt, ...) \ - ::perfetto::base::LogMessage(level, ::perfetto::base::Basename(__FILE__), \ diff --git a/recipes/perfetto/all/patches/v22.x/0001-Fix-perfetto-logging-when-PERFETTO_DISABLE_LOG-activ.patch b/recipes/perfetto/all/patches/v22.x/0001-Fix-perfetto-logging-when-PERFETTO_DISABLE_LOG-activ.patch deleted file mode 100644 index 5e4004e7ada01..0000000000000 --- a/recipes/perfetto/all/patches/v22.x/0001-Fix-perfetto-logging-when-PERFETTO_DISABLE_LOG-activ.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff --git a/sdk/perfetto.h b/sdk/perfetto.h -index f88ac9728..a242b37a4 100644 ---- a/sdk/perfetto.h -+++ b/sdk/perfetto.h -@@ -623,7 +623,8 @@ inline void MaybeSerializeLastLogsForCrashReporting() {} - __LINE__, ##__VA_ARGS__); \ - } while (0) - #elif defined(PERFETTO_DISABLE_LOG) --#define PERFETTO_XLOG(...) ::perfetto::base::ignore_result(__VA_ARGS__) -+#define PERFETTO_XLOG(level, fmt, ...) ::perfetto::base::ignore_result(level, \ -+ fmt, ##__VA_ARGS__) - #else - #define PERFETTO_XLOG(level, fmt, ...) \ - ::perfetto::base::LogMessage(level, ::perfetto::base::Basename(__FILE__), \ diff --git a/recipes/perfetto/all/patches/v25.0/0001-MSVC-Fix-narrowing-conversion-error.patch b/recipes/perfetto/all/patches/v25.0/0001-MSVC-Fix-narrowing-conversion-error.patch deleted file mode 100644 index d109447e2946e..0000000000000 --- a/recipes/perfetto/all/patches/v25.0/0001-MSVC-Fix-narrowing-conversion-error.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/sdk/perfetto.h b/sdk/perfetto.h -index 677e0e2..df0de12 100644 ---- a/sdk/perfetto.h -+++ b/sdk/perfetto.h -@@ -16140,7 +16140,7 @@ template <> - struct TraceTimestampTraits { - static inline TraceTimestamp ConvertTimestampToTraceTimeNs( - const uint64_t& timestamp) { -- return {internal::TrackEventInternal::GetClockId(), timestamp}; -+ return {static_cast(internal::TrackEventInternal::GetClockId()), timestamp}; - } - }; - diff --git a/recipes/perfetto/all/test_package/CMakeLists.txt b/recipes/perfetto/all/test_package/CMakeLists.txt index ad42eab5529ea..aa0641bc5d473 100644 --- a/recipes/perfetto/all/test_package/CMakeLists.txt +++ b/recipes/perfetto/all/test_package/CMakeLists.txt @@ -4,9 +4,5 @@ project(test_package LANGUAGES CXX) find_package(perfetto REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -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_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) target_link_libraries(${PROJECT_NAME} PRIVATE perfetto::perfetto) diff --git a/recipes/perfetto/config.yml b/recipes/perfetto/config.yml index 9f4eb56715091..f5d0172738aad 100644 --- a/recipes/perfetto/config.yml +++ b/recipes/perfetto/config.yml @@ -1,25 +1,17 @@ versions: - "31.0": + "48.1": folder: all - "30.0": + "47.0": folder: all - "27.1": + "45.0": folder: all - "27.0": + "44.0": folder: all - "26.1": + "43.1": folder: all - "25.0": + "42.0": folder: all - "24.2": + "41.0": folder: all - "23.0": - folder: all - "22.1": - folder: all - "22.0": - folder: all - "21.0": - folder: all - "20.1": + "40.0": 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/pexports/all/conandata.yml b/recipes/pexports/all/conandata.yml index 5b08eb793f8dc..17b38bf1e163f 100644 --- a/recipes/pexports/all/conandata.yml +++ b/recipes/pexports/all/conandata.yml @@ -5,8 +5,5 @@ sources: patches: "0.47": - patch_file: "patches/0001-add-help.patch" - base_path: "source_subfolder" - patch_file: "patches/0002-fix-MSVC-stack-overflow.patch" - base_path: "source_subfolder" - patch_file: "patches/0003-fix-MSVC-x86.patch" - base_path: "source_subfolder" diff --git a/recipes/pexports/all/conanfile.py b/recipes/pexports/all/conanfile.py index 44edf44c3e48f..88c3b2437f34a 100644 --- a/recipes/pexports/all/conanfile.py +++ b/recipes/pexports/all/conanfile.py @@ -1,94 +1,110 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, tools -import contextlib import os -required_conan_version = ">=1.33.0" +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import cross_building +from conan.tools.env import Environment, VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, chdir, replace_in_file +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import unix_path, is_msvc + +required_conan_version = ">=1.52.0" class PExportsConan(ConanFile): name = "pexports" description = "pexports is a program to extract exported symbols from a PE image (executable)." - homepage = "https://sourceforge.net/projects/mingw/files/MinGW/Extension/pexports/" license = "GPL-2.0-or-later" - topics = ("windows", "dll", "PE", "symbols", "import", "library") url = "https://github.com/conan-io/conan-center-index" - settings = "os", "arch", "compiler", "build_type" - - exports_sources = "patches/*" - - _autotools = None + homepage = "https://sourceforge.net/projects/mingw/files/MinGW/Extension/pexports/" + topics = ("windows", "dll", "PE", "symbols", "import", "library") - @property - def _source_subfolder(self): - return "source_subfolder" + package_type = "application" + 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.cppstd - del self.settings.compiler.libcxx + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") - def build_requirements(self): - 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 layout(self): + basic_layout(self, src_folder="src") def package_id(self): del self.info.settings.compiler - def source(self): - filename = "pexports.tar.xz" - tools.get(**self.conan_data["sources"][self.version], filename=filename, - destination=self._source_subfolder, strip_root=True) + def validate(self): + # FIXME: Need to build with Mac M1 + if self.settings.arch in ["armv8", "armv8.3"] and cross_building(self): + raise ConanInvalidConfiguration(f"Conan recipe {self.ref} does not support armv8. Contributions are welcome!") - @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)), - "LD": "{} link -nologo".format(tools.unix_path(self._user_info_build["automake"].compile)), - } - with tools.environment_append(env): - yield + def build_requirements(self): + 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") + self.tool_requires("winflexbison/2.5.25") else: - yield - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - host = build = None - if self.settings.compiler == "Visual Studio": - self._autotools.defines.append("YY_NO_UNISTD_H") - host = build = False - self._autotools.configure(configure_dir=self._source_subfolder, host=host, build=build) - return self._autotools + self.tool_requires("bison/3.8.2") + self.tool_requires("flex/2.6.4") + + def source(self): + filename = "pexports.tar.xz" + get(self, **self.conan_data["sources"][self.version], filename=filename, 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"--prefix={unix_path(self, self.package_folder)}") + if is_msvc(self): + tc.extra_defines.append("YY_NO_UNISTD_H") + tc.generate() + + if is_msvc(self): + env = Environment() + automake_conf = self.dependencies.build["automake"].conf_info + compile_wrapper = unix_path(self, automake_conf.get("user.automake:compile-wrapper", check_type=str)) + env.define("CC", f"{compile_wrapper} cl -nologo") + env.define("LD", "link -nologo") + env.vars(self).save_script("conanbuild_msvc") + + def _patch_sources(self): + apply_conandata_patches(self) + # Fix for: Invalid configuration `aarch64-apple-darwin': machine `aarch64-apple' not recognized + replace_in_file(self, os.path.join(self.source_folder, "build-aux", "config.sub"), + "avr | avr32 ", "avr | avr32 | aarch64") 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() + self._patch_sources() + with chdir(self, self.source_folder): + 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() + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + suffix = ".exe" if self.settings.os == "Windows" else "" + copy(self, "pexports" + suffix, src=self.source_folder, dst=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: 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.env_info.PATH.append(bin_path) diff --git a/recipes/pexports/all/test_package/CMakeLists.txt b/recipes/pexports/all/test_package/CMakeLists.txt index 7345b4f993eae..c25a9626aeb52 100644 --- a/recipes/pexports/all/test_package/CMakeLists.txt +++ b/recipes/pexports/all/test_package/CMakeLists.txt @@ -1,13 +1,10 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package C) if(NOT WIN32) message(FATAL_ERROR "pexports only supports Windows") endif() -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - find_program(PEXPORTS_BIN "pexports") set(EXPORTS_DEF_PATH "${CMAKE_BINARY_DIR}/exports.def") if(MSVC) diff --git a/recipes/pexports/all/test_package/conanfile.py b/recipes/pexports/all/test_package/conanfile.py index cd2e47277e1d7..8919154c6885e 100644 --- a/recipes/pexports/all/test_package/conanfile.py +++ b/recipes/pexports/all/test_package/conanfile.py @@ -1,11 +1,22 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanException import os +from conan import ConanFile +from conan.errors import ConanException +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +from conan.tools.files import load + class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def build_requirements(self): + self.tool_requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): if self.settings.os == "Windows": @@ -14,13 +25,14 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self, skip_x64_x86=True): - self.run("pexports -H", run_environment=True) + if can_run(self): + self.run("pexports -H") + if self.settings.os == "Windows": - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + self.run(bin_path, env="conanrun") exports_def_path = os.path.join(self.build_folder, "exports.def") - exports_def_contents = tools.load(exports_def_path) - self.output.info("{} contents:\n{}".format(exports_def_path, exports_def_contents)) - if not "test_package_function" in exports_def_contents: + exports_def_contents = load(self, exports_def_path) + self.output.info(f"{exports_def_path} contents:\n{exports_def_contents}") + if "test_package_function" not in exports_def_contents: raise ConanException("pexport could not detect `test_package_function` in the dll") diff --git a/recipes/pexports/all/test_v1_package/CMakeLists.txt b/recipes/pexports/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/pexports/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/pexports/all/test_v1_package/conanfile.py b/recipes/pexports/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..ecb888f16f156 --- /dev/null +++ b/recipes/pexports/all/test_v1_package/conanfile.py @@ -0,0 +1,26 @@ +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): + if self.settings.os == "Windows": + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self, skip_x64_x86=True): + self.run("pexports -H", run_environment=True) + if self.settings.os == "Windows": + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) + exports_def_path = os.path.join(self.build_folder, "exports.def") + exports_def_contents = tools.load(exports_def_path) + self.output.info("{} contents:\n{}".format(exports_def_path, exports_def_contents)) + if not "test_package_function" in exports_def_contents: + raise ConanException("pexport could not detect `test_package_function` in the dll") 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 dd8ef2bef04e2..ad60c0a68373e 100644 --- a/recipes/pfr/all/conandata.yml +++ b/recipes/pfr/all/conandata.yml @@ -1,13 +1,19 @@ sources: - "1.0.4": - 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" + "2.2.0": + url: "https://github.com/boostorg/pfr/archive/refs/tags/2.2.0.tar.gz" + sha256: "6f490ec1383de5855dcf801c23f0a967f888eb6e1440b6ca0bf36c12d4ae7ac7" + "2.1.0": + url: "https://github.com/boostorg/pfr/archive/refs/tags/2.1.0.tar.gz" + sha256: "7c18a4ab73b70f8b3513fa3a836c6f4310f627bbf55f62b89bdd7aa787c7da31" "2.0.3": url: "https://github.com/boostorg/pfr/archive/refs/tags/2.0.3.tar.gz" sha256: "c7d1950b56a07678423759f0bcdf37312f9861e3e9e59c45331903891213e2f2" + "2.0.2": + url: "https://github.com/boostorg/pfr/archive/refs/tags/2.0.2.tar.gz" + sha256: "1f03ebd3728d7df166d40d992ac071927d483474aa0f947e78a573c4ca288c04" + "1.0.4": + url: "https://github.com/boostorg/pfr/archive/refs/tags/1.0.4.tar.gz" + sha256: "01ecb27c850f50c589bad9a741ec9af6b06fe07ed673946c4bbb1960eb0f126e" patches: "1.0.4": - patch_file: "patches/50_add_license.patch" diff --git a/recipes/pfr/all/conanfile.py b/recipes/pfr/all/conanfile.py index 06c6ea4370d7e..ce6b5d6b573d9 100644 --- a/recipes/pfr/all/conanfile.py +++ b/recipes/pfr/all/conanfile.py @@ -13,15 +13,16 @@ class PfrConan(ConanFile): name = "pfr" description = "std::tuple like methods for user defined types without any macro or boilerplate code" - topics = ("boost", "pfr", "reflection", "magic_get") + topics = ("boost", "reflection", "magic_get") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/boostorg/pfr" license = "BSL-1.0" - settings = "os", "compiler", "build_type", "arch" + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" @property - def _minimum_cpp_standard(self): - return 14 + def _min_cppstd(self): + return "14" @property def _minimum_compilers_version(self): @@ -30,35 +31,30 @@ def _minimum_compilers_version(self): "clang": "3.8", "gcc": "5.5", "Visual Studio": "14", + "msvc": "190", } def export_sources(self): export_conandata_patches(self) def layout(self): - basic_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) + check_min_cppstd(self, self._min_cppstd) - compiler = self.settings.compiler - try: - min_version = self._minimum_compilers_version[str(compiler)] - 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) - 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) + 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 build(self): apply_conandata_patches(self) @@ -69,5 +65,6 @@ def package(self): 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.clear() + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/pfr/all/test_package/conanfile.py b/recipes/pfr/all/test_package/conanfile.py index 55a69638597a2..06c6a80cfff92 100644 --- a/recipes/pfr/all/test_package/conanfile.py +++ b/recipes/pfr/all/test_package/conanfile.py @@ -7,20 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + generators = "CMakeDeps", "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 generate(self): + tc = CMakeToolchain(self) + tc.variables["PfrMajorVersion"] = Version(self.dependencies["pfr"].ref.version).major + tc.generate() + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/pfr/config.yml b/recipes/pfr/config.yml index 8d5c58d4522af..979e702ffcb5f 100644 --- a/recipes/pfr/config.yml +++ b/recipes/pfr/config.yml @@ -1,7 +1,11 @@ versions: - "1.0.4": + "2.2.0": folder: "all" - "2.0.2": + "2.1.0": folder: "all" "2.0.3": folder: "all" + "2.0.2": + folder: "all" + "1.0.4": + folder: "all" 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/conandata.yml b/recipes/physfs/all/conandata.yml index 5504750a8f897..a392b6a19517f 100644 --- a/recipes/physfs/all/conandata.yml +++ b/recipes/physfs/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.2.0": + url: "https://github.com/icculus/physfs/archive/refs/tags/release-3.2.0.tar.gz" + sha256: "1991500eaeb8d5325e3a8361847ff3bf8e03ec89252b7915e1f25b3f8ab5d560" "3.0.2": url: "https://icculus.org/physfs/downloads/physfs-3.0.2.tar.bz2" sha256: "304df76206d633df5360e738b138c94e82ccf086e50ba84f456d3f8432f9f863" diff --git a/recipes/physfs/all/conanfile.py b/recipes/physfs/all/conanfile.py index cf3dc0b2a76db..7f695f2305b04 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) @@ -106,6 +99,7 @@ def package(self): 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", "PhysFS")) # TODO: to remove in conan v2 once cmake_find_package* generators removed self._create_cmake_module_alias_targets( @@ -116,17 +110,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 +131,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/physfs/config.yml b/recipes/physfs/config.yml index 12c582e98f963..1531809cbbd7b 100644 --- a/recipes/physfs/config.yml +++ b/recipes/physfs/config.yml @@ -1,3 +1,5 @@ versions: + "3.2.0": + folder: all "3.0.2": folder: all diff --git a/recipes/physx/4.x.x/CMakeLists.txt b/recipes/physx/4.x.x/CMakeLists.txt deleted file mode 100644 index 8d0517deecfde..0000000000000 --- a/recipes/physx/4.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/physx/compiler/public") diff --git a/recipes/physx/4.x.x/conandata.yml b/recipes/physx/4.x.x/conandata.yml index 46b51857501a4..3407713e50946 100644 --- a/recipes/physx/4.x.x/conandata.yml +++ b/recipes/physx/4.x.x/conandata.yml @@ -1,16 +1,34 @@ sources: + "4.1.2": + url: "https://github.com/NVIDIAGameWorks/PhysX/archive/a2c0428acab643e60618c681b501e86f7fd558cc.zip" + sha256: "d9c1939490a990277f8c773f288294cecb10e6fad8c820acad90fd4168b8ace3" "4.1.1": url: "https://github.com/NVIDIAGameWorks/PhysX/archive/ae80dede0546d652040ae6260a810e53e20a06fa.zip" sha256: "dd7db4c7879659658753029de57d04b18047ec04687b60f70335cde148a48d68" patches: + "4.1.2": + - patch_file: "patches/0003-PsWindowsInlineAoS-msvc142-bug-workaround.patch" + patch_description: "Workaround for a MSVC 142 bug on V3LoadA" + patch_type: "portability" + - patch_file: "patches/0004-Conan-PhysXGpu-name-workaround.patch" + patch_description: "Fix PhysXGpu library name" + patch_type: "conan" + - patch_file: "patches/0005-CMake-macos-ios-android-install-targets.patch" + patch_description: "Add installation targets for iOS, MacOS, Android" + patch_type: "portability" "4.1.1": - patch_file: "patches/0001-PsAllocator-include-typeinfo.patch" - base_path: "source_subfolder" + patch_description: "Fixed typeinfo inclusion for some VS versions" + patch_type: "portability" - patch_file: "patches/0002-GuGJKType-const-discard-qualifiers.patch" - base_path: "source_subfolder" + patch_description: "Add missing const qualifier to GuGJKType" + patch_type: "portability" - patch_file: "patches/0003-PsWindowsInlineAoS-msvc142-bug-workaround.patch" - base_path: "source_subfolder" + patch_description: "Workaround for a MSVC 142 bug on V3LoadA" + patch_type: "portability" - patch_file: "patches/0004-Conan-PhysXGpu-name-workaround.patch" - base_path: "source_subfolder" + patch_description: "Fix PhysXGpu library name" + patch_type: "conan" - patch_file: "patches/0005-CMake-macos-ios-android-install-targets.patch" - base_path: "source_subfolder" + patch_description: "Add installation targets for iOS, MacOS, Android" + patch_type: "portability" diff --git a/recipes/physx/4.x.x/conanfile.py b/recipes/physx/4.x.x/conanfile.py index 0bb8f44d71f7b..35264535f45b5 100644 --- a/recipes/physx/4.x.x/conanfile.py +++ b/recipes/physx/4.x.x/conanfile.py @@ -1,12 +1,12 @@ -from conan.tools.microsoft import msvc_runtime_flag -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 CMakeToolchain, CMake, cmake_layout +from conan.tools.files import load, get, apply_conandata_patches, export_conandata_patches, rmdir, copy, replace_in_file, save +from conan.tools.build import valid_min_cppstd +from conan.tools.microsoft import msvc_runtime_flag, is_msvc import os -import shutil - -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class PhysXConan(ConanFile): name = "physx" @@ -14,10 +14,11 @@ class PhysXConan(ConanFile): "physics solution supporting a wide range of devices, " \ "from smartphones to high-end multicore CPUs and GPUs." license = "BSD-3-Clause" - topics = ("PhysX", "physics", "physics-engine", "physics-simulation", "game-development", "cuda") + topics = ("physx", "physics", "physics-engine", "physics-simulation", "game-development", "cuda") homepage = "https://github.com/NVIDIAGameWorks/PhysX" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "compiler", "arch", "build_type" options = { "shared": [True, False], @@ -34,27 +35,14 @@ class PhysXConan(ConanFile): "enable_float_point_precise_math": False, } - no_copy_source = True short_paths = True - - generators = "cmake" - - @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"] + no_copy_source = 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 layout(self): + cmake_layout(self, src_folder="src") def config_options(self): if self.settings.os == "Windows": @@ -68,86 +56,111 @@ 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 not in ["Windows", "Linux", "Macos", "Android", "iOS"]: raise ConanInvalidConfiguration("Current os is not supported") - if self.settings.os == "Macos" and self.settings.arch not in ["x86", "x86_64"]: - raise ConanInvalidConfiguration("{} only supports x86 and x86_64 on macOS".format(self.name)) + if self.settings.os == "Macos": + if self.settings.arch not in ["x86", "x86_64"]: + raise ConanInvalidConfiguration(f"{self.name} only supports x86 and x86_64 on macOS") + + if valid_min_cppstd(self, 17): + raise ConanInvalidConfiguration(f"{self.name} is not supported with C++ 17. Contributions are welcome.") build_type = self.settings.build_type if build_type not in ["Debug", "RelWithDebInfo", "Release"]: raise ConanInvalidConfiguration("Current build_type is not supported") - if self.settings.os == "Windows" and not self._is_msvc: - raise ConanInvalidConfiguration("{} only supports Visual Studio on Windows".format(self.name)) + if self.settings.os == "Windows" and not is_msvc(self): + raise ConanInvalidConfiguration(f"{self.name} only supports Visual Studio on Windows") - if self.settings.compiler == "Visual Studio" and tools.Version(self.settings.compiler.version) < 9: - raise ConanInvalidConfiguration("Visual Studio versions < 9 are not supported") - - if self._is_msvc: + if is_msvc(self): allowed_runtimes = ["MDd", "MTd"] if build_type == "Debug" else ["MD", "MT"] if msvc_runtime_flag(self) not in allowed_runtimes: raise ConanInvalidConfiguration( - "Visual Studio runtime {0} is required for {1} build type".format( - " or ".join(allowed_runtimes), - build_type, - ) + f"Visual Studio runtime {' or '.join(allowed_runtimes)} is required for {build_type} build type" ) 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) + self._patch_sources() + + def generate(self): + tc = CMakeToolchain(self) + + # Needed. See https://github.com/conan-io/conan-center-index/pull/16583#discussion_r1188548265 for details + tc.cache_variables["CMAKE_POSITION_INDEPENDENT_CODE"] = self.options.get_safe("fPIC", True) + + # Options defined in physx/compiler/public/CMakeLists.txt + tc.cache_variables["TARGET_BUILD_PLATFORM"] = self._get_target_build_platform() + tc.cache_variables["PX_BUILDSNIPPETS"] = False + tc.cache_variables["PX_BUILDPUBLICSAMPLES"] = False + tc.cache_variables["PX_CMAKE_SUPPRESS_REGENERATION"] = False + cmakemodules_abspath = os.path.join( + self.build_folder, + self.source_folder, + "externals", + self._get_cmakemodules_subfolder() + ) + tc.cache_variables["CMAKEMODULES_PATH"] = cmakemodules_abspath.replace("\\", "/") + tc.cache_variables["PHYSX_ROOT_DIR"] = os.path.join(self.source_folder, "physx").replace("\\", "/") + + # Options defined in physx/source/compiler/cmake/CMakeLists.txt + if self.settings.os in ["Windows", "Android"]: + tc.cache_variables["PX_SCALAR_MATH"] = not self.options.enable_simd # this value doesn't matter on other os + tc.cache_variables["PX_GENERATE_STATIC_LIBRARIES"] = not self.options.shared + tc.cache_variables["PX_EXPORT_LOWLEVEL_PDB"] = False + tc.cache_variables["PXSHARED_PATH"] = os.path.join(self.source_folder, "pxshared").replace("\\", "/") + tc.cache_variables["PXSHARED_INSTALL_PREFIX"] = self.package_folder.replace("\\", "/") + tc.cache_variables["PX_GENERATE_SOURCE_DISTRO"] = False + + # Options defined in externals/cmakemodules/NVidiaBuildOptions.cmake + tc.cache_variables["NV_APPEND_CONFIG_NAME"] = False + tc.cache_variables["NV_USE_GAMEWORKS_OUTPUT_DIRS"] = False + if is_msvc(self): + tc.cache_variables["NV_USE_STATIC_WINCRT"] = "MT" in msvc_runtime_flag(self) + tc.cache_variables["NV_USE_DEBUG_WINCRT"] = "d" in msvc_runtime_flag(self) + tc.cache_variables["NV_FORCE_64BIT_SUFFIX"] = False + tc.cache_variables["NV_FORCE_32BIT_SUFFIX"] = False + tc.cache_variables["PX_ROOT_LIB_DIR"] = os.path.join(self.package_folder, "lib").replace("\\", "/") + + if self.settings.os == "Windows": + # Options defined in physx/source/compiler/cmake/windows/CMakeLists.txt + tc.cache_variables["PX_COPY_EXTERNAL_DLL"] = False # External dll copy disabled, PhysXDevice dll copy is handled afterward during conan packaging + tc.cache_variables["PX_FLOAT_POINT_PRECISE_MATH"] = self.options.enable_float_point_precise_math + tc.cache_variables["PX_USE_NVTX"] = False # Could be controlled by an option if NVTX had a recipe, disabled for the moment + tc.cache_variables["GPU_DLL_COPIED"] = True # PhysXGpu dll copy disabled, this copy is handled afterward during conan packaging + + # Options used in physx/source/compiler/cmake/windows/PhysX.cmake + tc.cache_variables["PX_GENERATE_GPU_PROJECTS"] = False + + tc.generate() def build(self): - self._copy_sources() - self._patch_sources() - cmake = self._configure_cmake() - cmake.build() - - def _copy_sources(self): - # Copy CMakeLists wrapper - shutil.copy(os.path.join(self.source_folder, "CMakeLists.txt"), "CMakeLists.txt") - - # Copy patches - if "patches" in self.conan_data and not os.path.exists("patches"): - os.mkdir("patches") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - shutil.copy(os.path.join(self.source_folder, patch["patch_file"]), "patches") - - # Copy PhysX source code - subfolders_to_copy = [ - "pxshared", - os.path.join("externals", self._get_cmakemodules_subfolder()), - os.path.join("physx", "compiler"), - os.path.join("physx", "include"), - os.path.join("physx", "source"), - ] - for subfolder in subfolders_to_copy: - shutil.copytree(os.path.join(self.source_folder, self._source_subfolder, subfolder), - os.path.join(self._source_subfolder, subfolder)) + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, "physx/compiler/public")) + cmake.build(build_type=self._get_physx_build_type()) def _get_cmakemodules_subfolder(self): return "CMakeModules" if self.settings.os == "Windows" else "cmakemodules" def _patch_sources(self): - for patch in self.conan_data["patches"][self.version]: - tools.patch(**patch) + apply_conandata_patches(self) # There is no reason to force consumer of PhysX public headers to use one of # NDEBUG or _DEBUG, since none of them relies on NDEBUG or _DEBUG - tools.replace_in_file(os.path.join(self._source_subfolder, "pxshared", "include", "foundation", "PxPreprocessor.h"), + replace_in_file(self, os.path.join(self.source_folder, "pxshared", "include", "foundation", "PxPreprocessor.h"), "#error Exactly one of NDEBUG and _DEBUG needs to be defined!", "// #error Exactly one of NDEBUG and _DEBUG needs to be defined!") - physx_source_cmake_dir = os.path.join(self._source_subfolder, "physx", "source", "compiler", "cmake") + physx_source_cmake_dir = os.path.join(self.source_folder, "physx", "source", "compiler", "cmake") # Remove global and specifics hard-coded PIC settings # (conan's CMake build helper properly sets CMAKE_POSITION_INDEPENDENT_CODE # depending on options) - tools.replace_in_file(os.path.join(physx_source_cmake_dir, "CMakeLists.txt"), + replace_in_file(self, os.path.join(physx_source_cmake_dir, "CMakeLists.txt"), "SET(CMAKE_POSITION_INDEPENDENT_CODE ON)", "") for cmake_file in ( "FastXml.cmake", @@ -167,72 +180,16 @@ def _patch_sources(self): "SimulationController.cmake", ): target, _ = os.path.splitext(os.path.basename(cmake_file)) - tools.replace_in_file(os.path.join(physx_source_cmake_dir, cmake_file), - "SET_TARGET_PROPERTIES({} PROPERTIES POSITION_INDEPENDENT_CODE TRUE)".format(target), - "") + replace_in_file(self, os.path.join(physx_source_cmake_dir, cmake_file), + f"SET_TARGET_PROPERTIES({target} PROPERTIES POSITION_INDEPENDENT_CODE TRUE)", "") # No error for compiler warnings - tools.replace_in_file(os.path.join(physx_source_cmake_dir, "windows", "CMakeLists.txt"), + replace_in_file(self, os.path.join(physx_source_cmake_dir, "windows", "CMakeLists.txt"), "/WX", "") for cmake_os in ("linux", "mac", "android", "ios"): - tools.replace_in_file(os.path.join(physx_source_cmake_dir, cmake_os, "CMakeLists.txt"), + replace_in_file(self, os.path.join(physx_source_cmake_dir, cmake_os, "CMakeLists.txt"), "-Werror", "") - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self, build_type=self._get_physx_build_type()) - - cmake.definitions["CMAKE_POSITION_INDEPENDENT_CODE"] = self.options.get_safe("fPIC", True) - - # Options defined in physx/compiler/public/CMakeLists.txt - cmake.definitions["TARGET_BUILD_PLATFORM"] = self._get_target_build_platform() - cmake.definitions["PX_BUILDSNIPPETS"] = False - cmake.definitions["PX_BUILDPUBLICSAMPLES"] = False - cmake.definitions["PX_CMAKE_SUPPRESS_REGENERATION"] = False - cmakemodules_abspath = os.path.join( - self.build_folder, - self._source_subfolder, - "externals", - self._get_cmakemodules_subfolder() - ) - cmake.definitions["CMAKEMODULES_PATH"] = cmakemodules_abspath.replace("\\", "/") - cmake.definitions["PHYSX_ROOT_DIR"] = os.path.join(self.build_folder, self._source_subfolder, "physx").replace("\\", "/") - - # Options defined in physx/source/compiler/cmake/CMakeLists.txt - if self.settings.os in ["Windows", "Android"]: - cmake.definitions["PX_SCALAR_MATH"] = not self.options.enable_simd # this value doesn't matter on other os - cmake.definitions["PX_GENERATE_STATIC_LIBRARIES"] = not self.options.shared - cmake.definitions["PX_EXPORT_LOWLEVEL_PDB"] = False - cmake.definitions["PXSHARED_PATH"] = os.path.join(self.build_folder, self._source_subfolder, "pxshared").replace("\\", "/") - cmake.definitions["PXSHARED_INSTALL_PREFIX"] = self.package_folder.replace("\\", "/") - cmake.definitions["PX_GENERATE_SOURCE_DISTRO"] = False - - # Options defined in externals/cmakemodules/NVidiaBuildOptions.cmake - cmake.definitions["NV_APPEND_CONFIG_NAME"] = False - cmake.definitions["NV_USE_GAMEWORKS_OUTPUT_DIRS"] = False - if self._is_msvc: - cmake.definitions["NV_USE_STATIC_WINCRT"] = "MT" in msvc_runtime_flag(self) - cmake.definitions["NV_USE_DEBUG_WINCRT"] = "d" in msvc_runtime_flag(self) - cmake.definitions["NV_FORCE_64BIT_SUFFIX"] = False - cmake.definitions["NV_FORCE_32BIT_SUFFIX"] = False - cmake.definitions["PX_ROOT_LIB_DIR"] = os.path.join(self.package_folder, "lib").replace("\\", "/") - - if self.settings.os == "Windows": - # Options defined in physx/source/compiler/cmake/windows/CMakeLists.txt - cmake.definitions["PX_COPY_EXTERNAL_DLL"] = False # External dll copy disabled, PhysXDevice dll copy is handled afterward during conan packaging - cmake.definitions["PX_FLOAT_POINT_PRECISE_MATH"] = self.options.enable_float_point_precise_math - cmake.definitions["PX_USE_NVTX"] = False # Could be controlled by an option if NVTX had a recipe, disabled for the moment - cmake.definitions["GPU_DLL_COPIED"] = True # PhysXGpu dll copy disabled, this copy is handled afterward during conan packaging - - # Options used in physx/source/compiler/cmake/windows/PhysX.cmake - cmake.definitions["PX_GENERATE_GPU_PROJECTS"] = False - - cmake.configure( - build_folder=os.path.join(self.build_folder, self._build_subfolder), - source_folder=os.path.join(self.build_folder), - ) - return cmake - def _get_physx_build_type(self): if self.settings.build_type == "Debug": return "debug" @@ -254,25 +211,28 @@ def _get_target_build_platform(self): }.get(str(self.settings.os)) def package(self): - cmake = self._configure_cmake() - cmake.install() + cmake = CMake(self) + cmake.install(build_type=self._get_physx_build_type()) - tools.save(os.path.join(self.package_folder, "licenses", "LICENSE"), self._get_license()) + save(self, os.path.join(self.package_folder, "licenses", "LICENSE"), self._get_license()) - out_lib_dir = os.path.join(self.package_folder, "lib", self._get_physx_build_type()) - self.copy(pattern="*.a", dst="lib", src=out_lib_dir, keep_path=False) - self.copy(pattern="*.so", dst="lib", src=out_lib_dir, keep_path=False) - self.copy(pattern="*.dylib*", dst="lib", src=out_lib_dir, keep_path=False) - self.copy(pattern="*.lib", dst="lib", src=out_lib_dir, keep_path=False) - self.copy(pattern="*.dll", dst="bin", src=out_lib_dir, keep_path=False) + cmake_installation_dir = os.path.join(self.package_folder, "lib", self._get_physx_build_type()) + package_dst_lib_dir = os.path.join(self.package_folder, "lib") + package_dst_bin_dir = os.path.join(self.package_folder, "bin") - tools.rmdir(out_lib_dir) - tools.rmdir(os.path.join(self.package_folder, "source")) + copy(self, pattern="*.a", dst=package_dst_lib_dir, src=cmake_installation_dir, keep_path=False) + copy(self, pattern="*.so", dst=package_dst_lib_dir, src=cmake_installation_dir, keep_path=False) + copy(self, pattern="*.dylib*", dst=package_dst_lib_dir, src=cmake_installation_dir, keep_path=False) + copy(self, pattern="*.lib", dst=package_dst_lib_dir, src=cmake_installation_dir, keep_path=False) + copy(self, pattern="*.dll", dst=package_dst_bin_dir, src=cmake_installation_dir, keep_path=False) + + rmdir(self, os.path.join(self.package_folder, "source")) + rmdir(self, cmake_installation_dir) self._copy_external_bin() def _get_license(self): - readme = tools.load(os.path.join(self.source_folder, self._source_subfolder, "README.md")) + readme = load(self, os.path.join(self.source_folder, "README.md")) begin = readme.find("Copyright") end = readme.find("\n## Introduction", begin) return readme[begin:end] @@ -281,28 +241,30 @@ def _copy_external_bin(self): # For Windows and Linux 64 bits, PhysXGpu (and PhysXDevice on Windows) # precompiled shared libs must also be provided to end-user if # application uses GPU features. - external_bin_dir = os.path.join(self.source_folder, self._source_subfolder, "physx", "bin") + external_bin_dir = os.path.join(self.source_folder, "physx", "bin") physx_build_type = self._get_physx_build_type() - compiler_version = tools.Version(self.settings.compiler.version) + compiler_version = self.settings.compiler.version if self.settings.os == "Linux" and self.settings.arch == "x86_64": + package_dst_lib_dir = os.path.join(self.package_folder, "lib") physx_gpu_dir = os.path.join(external_bin_dir, "linux.clang", physx_build_type) - self.copy(pattern="*PhysXGpu*.so", dst="lib", src=physx_gpu_dir, keep_path=False) - elif self.settings.os == "Windows" and \ - ((self.settings.compiler == "Visual Studio" and compiler_version >= "12") or \ - str(self.settings.compiler) == "msvc"): + copy(self, pattern="*PhysXGpu*.so", dst=package_dst_lib_dir, src=physx_gpu_dir, keep_path=False) + elif self.settings.os == "Windows" and is_msvc(self): physx_arch = {"x86": "x86_32", "x86_64": "x86_64"}.get(str(self.settings.arch)) dll_info_list = [{ "pattern": "PhysXGpu*.dll", "vc_ver": {"x86": "vc120", "x86_64": "vc140"}.get(str(self.settings.arch)) }, { "pattern": "PhysXDevice*.dll", - "vc_ver": {"12": "vc120", "14": "vc140", "15": "vc141"}.get(str(compiler_version), "vc142") + "vc_ver": {"180": "vc120", "190": "vc140", "191": "vc141"}.get(str(compiler_version), "vc142") }] + + package_dst_bin_dir = os.path.join(self.package_folder, "bin") + for dll_info in dll_info_list: dll_subdir = "win.{0}.{1}.mt".format(physx_arch, dll_info.get("vc_ver")) dll_dir = os.path.join(external_bin_dir, dll_subdir, physx_build_type) - self.copy(pattern=dll_info.get("pattern"), dst="bin", src=dll_dir, keep_path=False) + copy(self, pattern=dll_info.get("pattern"), dst=package_dst_bin_dir, src=dll_dir, keep_path=False) def package_info(self): self.cpp_info.set_property("cmake_file_name", "PhysX") @@ -314,6 +276,8 @@ def package_info(self): self.cpp_info.components["physxfoundation"].system_libs = ["m", "pthread", "rt"] elif self.settings.os == "Android": self.cpp_info.components["physxfoundation"].system_libs = ["log"] + elif self.settings.os == "Windows": + self.cpp_info.components["physxfoundation"].system_libs = ["ws2_32"] # PhysXCommon self.cpp_info.components["physxcommon"].set_property("cmake_target_name", "PhysX::PhysXCommon") diff --git a/recipes/physx/4.x.x/test_package/CMakeLists.txt b/recipes/physx/4.x.x/test_package/CMakeLists.txt index e6ab5b97e050a..b7cd3b4aec9e9 100644 --- a/recipes/physx/4.x.x/test_package/CMakeLists.txt +++ b/recipes/physx/4.x.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(PhysX REQUIRED PhysX PhysXExtensions CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) @@ -11,7 +8,7 @@ target_link_libraries(${PROJECT_NAME} PhysX::PhysX PhysX::PhysXExtensions) option(TEST_SHARED_LIBRARY "Build a test shared library") if(TEST_SHARED_LIBRARY) - find_package(PhysX REQUIRED PhysXFoundation) + find_package(PhysX REQUIRED PhysXFoundation CONFIG) add_library(${PROJECT_NAME}_lib SHARED test_library.cpp) target_link_libraries(${PROJECT_NAME}_lib PhysX::PhysXFoundation PhysX::PhysXExtensions) endif() diff --git a/recipes/physx/4.x.x/test_package/conanfile.py b/recipes/physx/4.x.x/test_package/conanfile.py index 4cdfb6a5e4042..ff6d00f1438e2 100644 --- a/recipes/physx/4.x.x/test_package/conanfile.py +++ b/recipes/physx/4.x.x/test_package/conanfile.py @@ -1,18 +1,30 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMakeToolchain, CMake, 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 requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["TEST_SHARED_LIBRARY"] = self.dependencies["physx"].options.get_safe("fPIC", True) + tc.generate() def build(self): cmake = CMake(self) - cmake.definitions["TEST_SHARED_LIBRARY"] = True if "fPIC" not in self.options["physx"].fields else self.options["physx"].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 can_run(self): + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/physx/4.x.x/test_v1_package/CMakeLists.txt b/recipes/physx/4.x.x/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..e6ab5b97e050a --- /dev/null +++ b/recipes/physx/4.x.x/test_v1_package/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(PhysX REQUIRED PhysX PhysXExtensions CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PhysX::PhysX PhysX::PhysXExtensions) + +option(TEST_SHARED_LIBRARY "Build a test shared library") +if(TEST_SHARED_LIBRARY) + find_package(PhysX REQUIRED PhysXFoundation) + add_library(${PROJECT_NAME}_lib SHARED test_library.cpp) + target_link_libraries(${PROJECT_NAME}_lib PhysX::PhysXFoundation PhysX::PhysXExtensions) +endif() diff --git a/recipes/physx/4.x.x/test_v1_package/conanfile.py b/recipes/physx/4.x.x/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..4cdfb6a5e4042 --- /dev/null +++ b/recipes/physx/4.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["TEST_SHARED_LIBRARY"] = True if "fPIC" not in self.options["physx"].fields else self.options["physx"].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) diff --git a/recipes/physx/4.x.x/test_v1_package/test_library.cpp b/recipes/physx/4.x.x/test_v1_package/test_library.cpp new file mode 100644 index 0000000000000..dbd8a536f547c --- /dev/null +++ b/recipes/physx/4.x.x/test_v1_package/test_library.cpp @@ -0,0 +1,25 @@ +#include "PxConfig.h" +#include "PxPhysicsAPI.h" + +using namespace physx; + +#if defined(_WINDOWS) +#include + +BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { + return TRUE; +} + +#define EXPORTS __declspec(dllexport) +#else +#define EXPORTS +#endif + +PxDefaultAllocator gAllocator; +PxDefaultErrorCallback gErrorCallback; + +EXPORTS +void some_func(void) { + PxFoundation *gFoundation = PxCreateFoundation(PX_PHYSICS_VERSION, gAllocator, gErrorCallback); + gFoundation->release(); +} diff --git a/recipes/physx/4.x.x/test_v1_package/test_package.cpp b/recipes/physx/4.x.x/test_v1_package/test_package.cpp new file mode 100644 index 0000000000000..984f48894974c --- /dev/null +++ b/recipes/physx/4.x.x/test_v1_package/test_package.cpp @@ -0,0 +1,143 @@ +#include + +#include "PxConfig.h" +#include "PxPhysicsAPI.h" + +#define PVD_HOST "127.0.0.1" +#define PX_RELEASE(x) if (x) {x->release(); x = NULL;} + +using namespace physx; + +PxDefaultAllocator gAllocator; +PxDefaultErrorCallback gErrorCallback; + +PxFoundation *gFoundation = NULL; +PxPhysics *gPhysics = NULL; + +PxDefaultCpuDispatcher *gDispatcher = NULL; +PxScene *gScene = NULL; + +PxMaterial *gMaterial = NULL; + +PxPvd *gPvd = NULL; + +#if PX_SUPPORT_GPU_PHYSX +PxCudaContextManager *gCudaContextManager = NULL; +#endif + +PxReal stackZ = 10.0f; + +PxRigidDynamic *createDynamic(const PxTransform &t, const PxGeometry &geometry, const PxVec3 &velocity = PxVec3(0)) { + PxRigidDynamic *dynamic = PxCreateDynamic(*gPhysics, t, geometry, *gMaterial, 10.0f); + dynamic->setAngularDamping(0.5f); + dynamic->setLinearVelocity(velocity); + gScene->addActor(*dynamic); + return dynamic; +} + +void createStack(const PxTransform &t, PxU32 size, PxReal halfExtent) { + PxShape *shape = gPhysics->createShape(PxBoxGeometry(halfExtent, halfExtent, halfExtent), *gMaterial); + for (PxU32 i = 0; i < size; ++i) { + for (PxU32 j = 0;j < size - i; ++j) { + PxTransform localTm(PxVec3(PxReal(j * 2) - PxReal(size - i), PxReal(i * 2 + 1), 0) * halfExtent); + PxRigidDynamic *body = gPhysics->createRigidDynamic(t.transform(localTm)); + body->attachShape(*shape); + PxRigidBodyExt::updateMassAndInertia(*body, 10.0f); + gScene->addActor(*body); + } + } + shape->release(); +} + +void initPhysics() { + gFoundation = PxCreateFoundation(PX_PHYSICS_VERSION, gAllocator, gErrorCallback); + + gPvd = PxCreatePvd(*gFoundation); + PxPvdTransport *transport = PxDefaultPvdSocketTransportCreate(PVD_HOST, 5425, 10); + gPvd->connect(*transport, PxPvdInstrumentationFlag::ePROFILE); + + gPhysics = PxCreatePhysics(PX_PHYSICS_VERSION, *gFoundation, PxTolerancesScale(), true, gPvd); + + PxSceneDesc sceneDesc(gPhysics->getTolerancesScale()); + sceneDesc.gravity = PxVec3(0.0f, -9.81f, 0.0f); + gDispatcher = PxDefaultCpuDispatcherCreate(4); + sceneDesc.cpuDispatcher = gDispatcher; + sceneDesc.filterShader = PxDefaultSimulationFilterShader; + +#if PX_SUPPORT_GPU_PHYSX + PxCudaContextManagerDesc cudaContextManagerDesc; + cudaContextManagerDesc.interopMode = PxCudaInteropMode::NO_INTEROP; + gCudaContextManager = PxCreateCudaContextManager(*gFoundation, cudaContextManagerDesc, PxGetProfilerCallback()); //Create the CUDA context manager, required for GRB to dispatch CUDA kernels. + if (gCudaContextManager) { + if (!gCudaContextManager->contextIsValid()) { + gCudaContextManager->release(); + gCudaContextManager = NULL; + } + } + sceneDesc.cudaContextManager = gCudaContextManager; //Set the CUDA context manager, used by GRB. + + sceneDesc.flags |= PxSceneFlag::eENABLE_GPU_DYNAMICS; //Enable GPU dynamics - without this enabled, simulation (contact gen and solver) will run on the CPU. + sceneDesc.flags |= PxSceneFlag::eENABLE_PCM; //Enable PCM. PCM NP is supported on GPU. Legacy contact gen will fall back to CPU + sceneDesc.flags |= PxSceneFlag::eENABLE_STABILIZATION; //Improve solver stability by enabling post-stabilization. + sceneDesc.broadPhaseType = PxBroadPhaseType::eGPU; //Enable GPU broad phase. Without this set, broad phase will run on the CPU. + sceneDesc.gpuMaxNumPartitions = 8; //Defines the maximum number of partitions used by the solver. Only power-of-2 values are valid. + //A value of 8 generally gives best balance between performance and stability. +#endif + + gScene = gPhysics->createScene(sceneDesc); + + PxPvdSceneClient *pvdClient = gScene->getScenePvdClient(); + if (pvdClient) { + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONSTRAINTS, true); + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONTACTS, true); + pvdClient->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_SCENEQUERIES, true); + } + gMaterial = gPhysics->createMaterial(0.5f, 0.5f, 0.6f); + + PxRigidStatic *groundPlane = PxCreatePlane(*gPhysics, PxPlane(0,1,0,0), *gMaterial); + gScene->addActor(*groundPlane); + + for (PxU32 i = 0; i < 40; ++i) { + createStack(PxTransform(PxVec3(0, 0, stackZ -= 10.0f)), 20, 1.0f); + } + + PxRigidDynamic *ball = createDynamic(PxTransform(PxVec3(0,20,100)), PxSphereGeometry(5), PxVec3(0,-25,-100)); + PxRigidBodyExt::updateMassAndInertia(*ball, 1000.f); +} + +void stepPhysics() { + gScene->simulate(1.0f / 60.0f); + gScene->fetchResults(true); +} + +void cleanupPhysics() { + PX_RELEASE(gScene); + PX_RELEASE(gDispatcher); + PX_RELEASE(gPhysics); + if (gPvd) { + PxPvdTransport *transport = gPvd->getTransport(); + gPvd->release(); + gPvd = NULL; + PX_RELEASE(transport); + } +#if PX_SUPPORT_GPU_PHYSX + PX_RELEASE(gCudaContextManager); +#endif + PX_RELEASE(gFoundation); +} + +int main(int, char **) { + static const PxU32 frameCount = 100; + initPhysics(); + for (PxU32 i = 0; i < frameCount; ++i) { + stepPhysics(); + } + cleanupPhysics(); + + std::cout << "Test of PhysX " + << PX_PHYSICS_VERSION_MAJOR << "." << PX_PHYSICS_VERSION_MINOR << "." << PX_PHYSICS_VERSION_BUGFIX + << " done.\n" + << std::endl; + + return 0; +} diff --git a/recipes/physx/config.yml b/recipes/physx/config.yml index ff5afb6866457..f46b35cc99652 100644 --- a/recipes/physx/config.yml +++ b/recipes/physx/config.yml @@ -1,3 +1,5 @@ versions: + "4.1.2": + folder: "4.x.x" "4.1.1": folder: "4.x.x" diff --git a/recipes/picobench/all/conandata.yml b/recipes/picobench/all/conandata.yml index 8377ab1b2c676..f6484b7236c42 100644 --- a/recipes/picobench/all/conandata.yml +++ b/recipes/picobench/all/conandata.yml @@ -1,8 +1,23 @@ sources: + "2.05": + url: "https://github.com/iboB/picobench/archive/v2.05.tar.gz" + sha256: "4e10c3c7042c0519662565eed8949f5eb328333d2c9a2443464dede04ce0b00d" + "2.02": + url: "https://github.com/iboB/picobench/archive/refs/tags/v2.02.tar.gz" + sha256: "22a896535d0e2fd8793cdc6c14bef42275f8de8d24ce2cfc55442ed1e0973c83" "2.01": url: "https://github.com/iboB/picobench/archive/refs/tags/v2.01.tar.gz" sha256: "164cb3b2d72a9b31e7559f6829ae38b6b955840571531117e0d6f53d669d3a2b" - patches: + "2.05": + - patch_file: "patches/2.02-0001-add-install.patch" + patch_description: "add installer" + patch_type: "conan" + "2.02": + - patch_file: "patches/2.02-0001-add-install.patch" + patch_description: "add installer" + patch_type: "conan" "2.01": - patch_file: "patches/2.01-0001-add-install.patch" + patch_description: "add installer" + patch_type: "conan" diff --git a/recipes/picobench/all/conanfile.py b/recipes/picobench/all/conanfile.py index f71d6aab09dbb..62918f33d6e78 100644 --- a/recipes/picobench/all/conanfile.py +++ b/recipes/picobench/all/conanfile.py @@ -25,27 +25,28 @@ class PicobenchConan(ConanFile): def export_sources(self): 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.cppstd: - check_min_cppstd(self, 11) - def package_id(self): - if self.options.with_cli: + if self.info.options.with_cli: del self.info.settings.compiler else: self.info.clear() + def validate(self): + if self.settings.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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["PICOBENCH_BUILD_TOOLS"] = self.options.with_cli + tc.variables["PICOBENCH_BUILD_TESTS"] = False + tc.variables["PICOBENCH_BUILD_EXAMPLES"] = False + tc.generate() def build(self): apply_conandata_patches(self) @@ -65,7 +66,7 @@ def package_info(self): binpath = os.path.join(self.package_folder, "bin") self.output.info("Appending PATH env var: {}".format(binpath)) self.env_info.PATH.append(binpath) + else: + self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] diff --git a/recipes/picobench/all/patches/2.02-0001-add-install.patch b/recipes/picobench/all/patches/2.02-0001-add-install.patch new file mode 100644 index 0000000000000..e3daaea325e76 --- /dev/null +++ b/recipes/picobench/all/patches/2.02-0001-add-install.patch @@ -0,0 +1,28 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 68bd3f9..32ef1ea 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -28,6 +28,11 @@ add_library(picobench INTERFACE) + add_library(picobench::picobench ALIAS picobench) + target_include_directories(picobench INTERFACE include) + ++include(GNUInstallDirs) ++ ++install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/picobench ++ DESTINATION include/) ++ + if(PICOBENCH_BUILD_TOOLS) + add_subdirectory(tools) + endif() +diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt +index cb7f584..cfefe5c 100644 +--- a/tools/CMakeLists.txt ++++ b/tools/CMakeLists.txt +@@ -10,3 +10,7 @@ add_executable(picobench-cli picobench.cpp) + target_link_libraries(picobench-cli picobench) + set_target_properties(picobench-cli PROPERTIES OUTPUT_NAME picobench) + set_target_properties(picobench-cli PROPERTIES FOLDER tools) ++ ++install(TARGETS picobench-cli ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++) diff --git a/recipes/picobench/all/test_package/conanfile.py b/recipes/picobench/all/test_package/conanfile.py index 48499fa0989d9..b9d7f11e89dcd 100644 --- a/recipes/picobench/all/test_package/conanfile.py +++ b/recipes/picobench/all/test_package/conanfile.py @@ -3,8 +3,6 @@ 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" diff --git a/recipes/picobench/all/test_v1_package/CMakeLists.txt b/recipes/picobench/all/test_v1_package/CMakeLists.txt index 426dbc1aa18df..be00a8c7f57c7 100644 --- a/recipes/picobench/all/test_v1_package/CMakeLists.txt +++ b/recipes/picobench/all/test_v1_package/CMakeLists.txt @@ -1,6 +1,5 @@ cmake_minimum_required(VERSION 3.8) - -project(test_package CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) diff --git a/recipes/picobench/config.yml b/recipes/picobench/config.yml index bc09c963d7fda..eb0d152fc4aa2 100644 --- a/recipes/picobench/config.yml +++ b/recipes/picobench/config.yml @@ -1,3 +1,7 @@ versions: + "2.05": + folder: all + "2.02": + folder: all "2.01": folder: all diff --git a/recipes/pipes/all/conanfile.py b/recipes/pipes/all/conanfile.py index 70bc84cbc789f..879b25bfc8b32 100644 --- a/recipes/pipes/all/conanfile.py +++ b/recipes/pipes/all/conanfile.py @@ -1,53 +1,64 @@ -from conans import ConanFile, 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.files import copy, get +from conan.tools.layout import basic_layout +from conan.tools.scm import Version + +required_conan_version = ">=1.50.0" + + class PipesConan(ConanFile): name = "pipes" description = "Pipelines for expressive code on collections in C++" license = "MIT" - topics = ("pipes", "functional-programming") - homepage = "https://github.com/joboccara/pipes" url = "https://github.com/conan-io/conan-center-index" - settings = "compiler" - no_copy_source = True + homepage = "https://github.com/joboccara/pipes" + topics = ("functional-programming", "header-only") - @property - def _source_subfolder(self): - return "source_subfolder" + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True @property - def _minimum_cpp_standard(self): + 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 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.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)) - 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)) + 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 package_id(self): - self.info.header_only() - def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename("pipes-{}".format(self.version), self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) 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"), keep_path=True) + copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, "*.hpp", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self.source_folder, "include"), keep_path=True) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/pipes/all/test_package/CMakeLists.txt b/recipes/pipes/all/test_package/CMakeLists.txt index f24c18a1bb2e1..f31e3a93080d6 100644 --- a/recipes/pipes/all/test_package/CMakeLists.txt +++ b/recipes/pipes/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.15) +project(test_package LANGUAGES CXX) find_package(pipes REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} pipes::pipes) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14) +target_link_libraries(${PROJECT_NAME} PRIVATE pipes::pipes) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/pipes/all/test_package/conanfile.py b/recipes/pipes/all/test_package/conanfile.py index 910ae60d10438..ef5d7042163ec 100644 --- a/recipes/pipes/all/test_package/conanfile.py +++ b/recipes/pipes/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", "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.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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/pipes/all/test_package/test_package.cpp b/recipes/pipes/all/test_package/test_package.cpp index 5279bc00ec63c..16c22b768a986 100644 --- a/recipes/pipes/all/test_package/test_package.cpp +++ b/recipes/pipes/all/test_package/test_package.cpp @@ -1,6 +1,15 @@ +// Workaround for pipes not finding size_t +#include +#include #include +// FIXME: https://github.com/joboccara/pipes/pull/73 +#if __cplusplus >= 201703L +#include +#endif + #include + int main() { auto source = std::vector{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; auto destination = std::vector{}; @@ -9,8 +18,5 @@ int main() { >>= pipes::transform([](int i){ return i * 2; }) >>= pipes::push_back(destination); - auto expected = std::vector{0, 4, 8, 12, 16}; - bool success = destination == expected; - - return success ? 0 : 1; + return EXIT_SUCCESS; } 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..7d45092404e53 100644 --- a/recipes/pistache/all/conandata.yml +++ b/recipes/pistache/all/conandata.yml @@ -1,10 +1,28 @@ sources: + "0.0.5": + url: "https://github.com/pistacheio/pistache/archive/refs/tags/0.0.5.tar.gz" + sha256: "e2da87ebc01367e33bd8d7800cb2bf5c23e9fb4e6f49dce2cab5f8756df8dca0" + "cci.20240107": + url: "https://github.com/pistacheio/pistache/archive/1c733a145b01a4737cf5c7dd3709bd85be404886.tar.gz" + sha256: "156d2a4503be3d6c0726009c83e6d2e6e2e6378e6136436fc2d82d13597b6b0b" "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: + "0.0.5": + - patch_file: "patches/0.0.5-0001-include-cstdint.patch" + patch_description: "include " + patch_type: "portability" + patch_source: "https://github.com/pistacheio/pistache/pull/1142" "cci.20201127": - - patch_file: "patches/0001-remove-fpic.patch" - base_path: "source_subfolder" - - patch_file: "patches/0002-include-stddef.patch" - base_path: "source_subfolder" + - patch_file: "patches/cci.20201127-0001-remove-fpic.patch" + patch_description: "disable fPIC" + patch_type: "conan" + - patch_file: "patches/cci.20201127-0002-include-stddef.patch" + patch_description: "include " + patch_type: "portability" + patch_source: "https://github.com/pistacheio/pistache/pull/965" + - patch_file: "patches/cci.20201127-0003-include-cstdint.patch" + patch_description: "include " + patch_type: "portability" + patch_source: "https://github.com/pistacheio/pistache/pull/1142" diff --git a/recipes/pistache/all/conanfile.py b/recipes/pistache/all/conanfile.py index 9152b1d421a18..3577526d2b30c 100644 --- a/recipes/pistache/all/conanfile.py +++ b/recipes/pistache/all/conanfile.py @@ -1,18 +1,27 @@ -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" + description = "Pistache is a modern and elegant HTTP and REST framework for C++" license = "Apache-2.0" - homepage = "https://github.com/pistacheio/pistache" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/pistacheio/pistache" topics = ("http", "rest", "framework", "networking") - description = "Pistache is a modern and elegant HTTP and REST framework for C++" - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -25,94 +34,146 @@ class PistacheConan(ConanFile): "with_ssl": False, } - 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 _compilers_minimum_version(self): + return { + "gcc": "7", + "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": + 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.20230929") if self.options.with_ssl: - self.requires("openssl/1.1.1q") + self.requires("openssl/[>=1.1 <4]") + if self.version != "cci.20201127": + self.requires("date/3.0.1") def validate(self): - compilers = { - "gcc": "7", - "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 == "clang" and self.version in ["cci.20201127", "0.0.5"]: + raise ConanInvalidConfiguration(f"{self.ref}'s clang support is broken. See pistacheio/pistache#835.") if self.settings.compiler.cppstd: - tools.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.") - else: - self.output.warn("Pistache requires c++17, but this compiler is unknown to this recipe. Assuming your compiler 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 build_requirements(self): + if self.version != "cci.20201127": + self.tool_requires("meson/1.3.1") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/2.1.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["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.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.version != "cci.20201127": + self.cpp_info.components["libpistache"].requires.append("date::date") + 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 in ["Linux", "FreeBSD"]: + self.cpp_info.components["libpistache"].system_libs = ["pthread"] + if self.version != "cci.20201127": + self.cpp_info.components["libpistache"].system_libs.append("m") + + # 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 - self.cpp_info.components["libpistache"].libs = tools.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"] diff --git a/recipes/pistache/all/patches/0.0.5-0001-include-cstdint.patch b/recipes/pistache/all/patches/0.0.5-0001-include-cstdint.patch new file mode 100644 index 0000000000000..459b71e89e5e7 --- /dev/null +++ b/recipes/pistache/all/patches/0.0.5-0001-include-cstdint.patch @@ -0,0 +1,13 @@ +diff --git a/include/pistache/flags.h b/include/pistache/flags.h +index 9be2b32..ed37150 100644 +--- a/include/pistache/flags.h ++++ b/include/pistache/flags.h +@@ -11,7 +11,7 @@ + */ + + #pragma once +- ++#include + #include + #include + #include diff --git a/recipes/pistache/all/patches/0001-remove-fpic.patch b/recipes/pistache/all/patches/cci.20201127-0001-remove-fpic.patch similarity index 100% rename from recipes/pistache/all/patches/0001-remove-fpic.patch rename to recipes/pistache/all/patches/cci.20201127-0001-remove-fpic.patch diff --git a/recipes/pistache/all/patches/0002-include-stddef.patch b/recipes/pistache/all/patches/cci.20201127-0002-include-stddef.patch similarity index 100% rename from recipes/pistache/all/patches/0002-include-stddef.patch rename to recipes/pistache/all/patches/cci.20201127-0002-include-stddef.patch diff --git a/recipes/pistache/all/patches/cci.20201127-0003-include-cstdint.patch b/recipes/pistache/all/patches/cci.20201127-0003-include-cstdint.patch new file mode 100644 index 0000000000000..93b9a3569853b --- /dev/null +++ b/recipes/pistache/all/patches/cci.20201127-0003-include-cstdint.patch @@ -0,0 +1,13 @@ +diff --git a/include/pistache/flags.h b/include/pistache/flags.h +index 2538773..fcd0252 100644 +--- a/include/pistache/flags.h ++++ b/include/pistache/flags.h +@@ -5,7 +5,7 @@ + */ + + #pragma once +- ++#include + #include + #include + #include diff --git a/recipes/pistache/all/test_package/CMakeLists.txt b/recipes/pistache/all/test_package/CMakeLists.txt index bf65e85023c4f..fd8a15bd81880 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} PRIVATE 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..3f8e40dcd1442 100644 --- a/recipes/pistache/config.yml +++ b/recipes/pistache/config.yml @@ -1,3 +1,7 @@ versions: + "0.0.5": + folder: all + "cci.20240107": + folder: all "cci.20201127": folder: all diff --git a/recipes/pixman/all/conandata.yml b/recipes/pixman/all/conandata.yml index 546b34a4fa24c..dc1f3f424ea14 100644 --- a/recipes/pixman/all/conandata.yml +++ b/recipes/pixman/all/conandata.yml @@ -1,18 +1,22 @@ -"sources": - "0.40.0": - "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" +sources: + "0.43.4": + url: + - "https://www.cairographics.org/releases/pixman-0.43.4.tar.gz" + - "https://www.x.org/releases/individual/lib/pixman-0.43.4.tar.gz" + sha256: "a0624db90180c7ddb79fc7a9151093dc37c646d8c38d3f232f767cf64b85a226" + "0.43.0": + url: + - "https://www.cairographics.org/releases/pixman-0.43.0.tar.gz" + - "https://www.x.org/releases/individual/lib/pixman-0.43.0.tar.gz" + sha256: "a65c28209858fb16bee50d809c80f90a8e415c0e4fd8321078a1822785a5560a" + "0.42.2": + url: + - "https://www.cairographics.org/releases/pixman-0.42.2.tar.gz" + - "https://www.x.org/releases/individual/lib/pixman-0.42.2.tar.gz" + sha256: "ea1480efada2fd948bc75366f7c349e1c96d3297d09a3fe62626e38e234a625e" patches: - "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: "backport" - patch_source: "https://gitlab.freedesktop.org/pixman/pixman/-/tree/pixman-0.40.0" - "0.40.0": - - patch_file: "patches/0001-incompatible-pointer-types.patch" - patch_description: "backport fix for clang build" - patch_type: "backport" - patch_source: "https://gitlab.freedesktop.org/pixman/pixman/-/merge_requests/48" + "0.42.2": + - patch_file: "patches/0.42.2-0001-pixman-arma64-Adjustments-to-build-with-llvm-integra.patch" + patch_description: "Adjustments to build for arm64 with LLVM's assembler" + patch_type: "portability" + patch_source: "https://gitlab.freedesktop.org/pixman/pixman/-/merge_requests/71" diff --git a/recipes/pixman/all/conanfile.py b/recipes/pixman/all/conanfile.py index 5abb4216a4203..d2d66d83f8c74 100644 --- a/recipes/pixman/all/conanfile.py +++ b/recipes/pixman/all/conanfile.py @@ -1,22 +1,27 @@ 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 ( + apply_conandata_patches, 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 import files, microsoft -from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import is_msvc -required_conan_version = ">=1.52.0" +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") + homepage = "https://gitlab.freedesktop.org/pixman/pixman" + license = ("MIT") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -27,13 +32,8 @@ class PixmanConan(ConanFile): "fPIC": True, } - @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": @@ -41,41 +41,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 - - def build_requirements(self): - self.tool_requires("meson/0.63.2") + 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.4.0") + + def source(self): + 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() - - env = VirtualBuildEnv(self) - env.generate() - def validate(self): - if self.info.settings.os == "Windows" and self.info.options.shared: - raise ConanInvalidConfiguration("pixman can only be built as a static library on Windows") + # Android armv7 build of Pixman makes use of cpu-features functionality, provided in the NDK + if self.settings.os == "Android": + android_ndk_home = self.conf.get("tools.android:ndk_path").replace("\\", "/") + cpu_features_path = os.path.join(android_ndk_home, "sources", "android", "cpufeatures") + tc.project_options.update({'cpu-features-path' : cpu_features_path}) - def export_sources(self): - files.export_conandata_patches(self) - - def source(self): - files.get(self, **self.conan_data["sources"][self.version], strip_root=True) + tc.generate() def _patch_sources(self): - files.apply_conandata_patches(self) - files.replace_in_file(self, os.path.join(self.source_folder, "meson.build"), "subdir('test')", "") - files.replace_in_file(self, os.path.join(self.source_folder, "meson.build"), "subdir('demos')", "") + 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() @@ -84,20 +83,21 @@ def build(self): meson.build() def package(self): + copy(self, "COPYING", self.source_folder, os.path.join(self.package_folder, "licenses")) meson = Meson(self) meson.install() - - files.copy(self, "COPYING", self.source_folder, os.path.join(self.package_folder, "licenses")) + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) lib_folder = os.path.join(self.package_folder, "lib") - files.rmdir(self, os.path.join(lib_folder, "pkgconfig")) - files.rm(self, "*.la", lib_folder) - if microsoft.is_msvc(self): + rmdir(self, os.path.join(lib_folder, "pkgconfig")) + rm(self, "*.la", lib_folder) + fix_apple_shared_install_name(self) + if is_msvc(self) and not self.options.shared: prefix = "libpixman-1" - files.rename(self, os.path.join(lib_folder, f"{prefix}.a"), os.path.join(lib_folder, f"{prefix}.lib")) + 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 = files.collect_libs(self) - self.cpp_info.includedirs.append(self._includedir) + self.cpp_info.libs = ['libpixman-1'] if self.settings.os == "Windows" and not self.options.shared else ['pixman-1'] + 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/0.42.2-0001-pixman-arma64-Adjustments-to-build-with-llvm-integra.patch b/recipes/pixman/all/patches/0.42.2-0001-pixman-arma64-Adjustments-to-build-with-llvm-integra.patch new file mode 100644 index 0000000000000..4507dc378d06c --- /dev/null +++ b/recipes/pixman/all/patches/0.42.2-0001-pixman-arma64-Adjustments-to-build-with-llvm-integra.patch @@ -0,0 +1,3290 @@ +From 58a85103ccaa90e217b081149d0a90837d791b14 Mon Sep 17 00:00:00 2001 +From: Heiko Lewin +Date: Tue, 18 Jul 2023 07:19:34 +0200 +Subject: [PATCH] pixman-arma64: Adjustments to build with llvm integrated + assembler + +This enables building the aarch64 assembly with clang. +Changes: +1. Use `.func` or `.endfunc` only if available +2. Prefix macro arg names with `\` +3. Use `\()` instead of `&` +4. Always use commas to separate macro arguments +5. Prefix asm symbols with an undderscore if necessary +--- + meson.build | 28 + + pixman/pixman-arm-asm.h | 32 +- + pixman/pixman-arma64-neon-asm-bilinear.S | 421 ++++++------- + pixman/pixman-arma64-neon-asm.S | 720 +++++++++++------------ + pixman/pixman-arma64-neon-asm.h | 684 ++++++++++----------- + test/utils.h | 2 +- + 6 files changed, 968 insertions(+), 919 deletions(-) + +diff --git a/meson.build b/meson.build +index 15bd4df..e05d73d 100644 +--- a/meson.build ++++ b/meson.build +@@ -243,6 +243,34 @@ if not use_vmx.disabled() + endif + endif + ++if cc.compiles(''' ++ __asm__ ( ++ ".func meson_test" ++ ".endfunc" ++ );''', ++ name : 'test for ASM .func directive') ++ config.set('ASM_HAVE_FUNC_DIRECTIVE', 1) ++endif ++ ++ ++if cc.links(''' ++ #include ++ ++ __asm__ ( ++ " .global _testlabel\n" ++ "_testlabel:\n" ++ ); ++ ++ int testlabel(); ++ int main(int argc, char* argv[]) { ++ return testlabel(); ++ }''', ++ name : 'test for ASM leading underscore') ++ config.set('ASM_LEADING_UNDERSCORE', 1) ++endif ++ ++ ++ + if have_vmx + config.set10('USE_VMX', true) + elif use_vmx.enabled() +diff --git a/pixman/pixman-arm-asm.h b/pixman/pixman-arm-asm.h +index ee78541..8253906 100644 +--- a/pixman/pixman-arm-asm.h ++++ b/pixman/pixman-arm-asm.h +@@ -25,13 +25,33 @@ + * + */ + ++ ++#include "config.h" ++ ++ + /* Supplementary macro for setting function attributes */ +-.macro pixman_asm_function fname +- .func fname +- .global fname ++.macro pixman_asm_function_impl fname ++#ifdef ASM_HAVE_FUNC_DIRECTIVE ++ .func \fname ++#endif ++ .global \fname + #ifdef __ELF__ +- .hidden fname +- .type fname, %function ++ .hidden \fname ++ .type \fname, %function ++#endif ++\fname: ++.endm ++ ++.macro pixman_asm_function fname ++#ifdef ASM_LEADING_UNDERSCORE ++ pixman_asm_function_impl _\fname ++#else ++ pixman_asm_function_impl \fname ++#endif ++.endm ++ ++.macro pixman_end_asm_function ++#ifdef ASM_HAVE_FUNC_DIRECTIVE ++ .endfunc + #endif +-fname: + .endm +diff --git a/pixman/pixman-arma64-neon-asm-bilinear.S b/pixman/pixman-arma64-neon-asm-bilinear.S +index 31d103d..7303bdc 100644 +--- a/pixman/pixman-arma64-neon-asm-bilinear.S ++++ b/pixman/pixman-arma64-neon-asm-bilinear.S +@@ -77,50 +77,50 @@ + asr WTMP1, X, #16 + add X, X, UX + add TMP1, TOP, TMP1, lsl #2 +- ld1 {®1&.2s}, [TMP1], STRIDE +- ld1 {®2&.2s}, [TMP1] ++ ld1 {\()\reg1\().2s}, [TMP1], STRIDE ++ ld1 {\()\reg2\().2s}, [TMP1] + .endm + + .macro bilinear_load_0565 reg1, reg2, tmp + asr WTMP1, X, #16 + add X, X, UX + add TMP1, TOP, TMP1, lsl #1 +- ld1 {®2&.s}[0], [TMP1], STRIDE +- ld1 {®2&.s}[1], [TMP1] +- convert_four_0565_to_x888_packed reg2, reg1, reg2, tmp ++ ld1 {\()\reg2\().s}[0], [TMP1], STRIDE ++ ld1 {\()\reg2\().s}[1], [TMP1] ++ convert_four_0565_to_x888_packed \reg2, \reg1, \reg2, \tmp + .endm + + .macro bilinear_load_and_vertical_interpolate_two_8888 \ + acc1, acc2, reg1, reg2, reg3, reg4, tmp1, tmp2 + +- bilinear_load_8888 reg1, reg2, tmp1 +- umull &acc1&.8h, ®1&.8b, v28.8b +- umlal &acc1&.8h, ®2&.8b, v29.8b +- bilinear_load_8888 reg3, reg4, tmp2 +- umull &acc2&.8h, ®3&.8b, v28.8b +- umlal &acc2&.8h, ®4&.8b, v29.8b ++ bilinear_load_8888 \reg1, \reg2, \tmp1 ++ umull \()\acc1\().8h, \()\reg1\().8b, v28.8b ++ umlal \()\acc1\().8h, \()\reg2\().8b, v29.8b ++ bilinear_load_8888 \reg3, \reg4, \tmp2 ++ umull \()\acc2\().8h, \()\reg3\().8b, v28.8b ++ umlal \()\acc2\().8h, \()\reg4\().8b, v29.8b + .endm + + .macro bilinear_load_and_vertical_interpolate_four_8888 \ +- xacc1, xacc2, xreg1, xreg2, xreg3, xreg4, xacc2lo, xacc2hi \ ++ xacc1, xacc2, xreg1, xreg2, xreg3, xreg4, xacc2lo, xacc2hi, \ + yacc1, yacc2, yreg1, yreg2, yreg3, yreg4, yacc2lo, yacc2hi + + bilinear_load_and_vertical_interpolate_two_8888 \ +- xacc1, xacc2, xreg1, xreg2, xreg3, xreg4, xacc2lo, xacc2hi ++ \xacc1, \xacc2, \xreg1, \xreg2, \xreg3, \xreg4, \xacc2lo, xacc2hi + bilinear_load_and_vertical_interpolate_two_8888 \ +- yacc1, yacc2, yreg1, yreg2, yreg3, yreg4, yacc2lo, yacc2hi ++ \yacc1, \yacc2, \yreg1, \yreg2, \yreg3, \yreg4, \yacc2lo, \yacc2hi + .endm + + .macro vzip reg1, reg2 +- zip1 v24.8b, reg1, reg2 +- zip2 reg2, reg1, reg2 +- mov reg1, v24.8b ++ zip1 v24.8b, \reg1, \reg2 ++ zip2 \reg2, \reg1, \reg2 ++ mov \reg1, v24.8b + .endm + + .macro vuzp reg1, reg2 +- uzp1 v24.8b, reg1, reg2 +- uzp2 reg2, reg1, reg2 +- mov reg1, v24.8b ++ uzp1 v24.8b, \reg1, \reg2 ++ uzp2 \reg2, \reg1, \reg2 ++ mov \reg1, v24.8b + .endm + + .macro bilinear_load_and_vertical_interpolate_two_0565 \ +@@ -131,23 +131,23 @@ + asr WTMP2, X, #16 + add X, X, UX + add TMP2, TOP, TMP2, lsl #1 +- ld1 {&acc2&.s}[0], [TMP1], STRIDE +- ld1 {&acc2&.s}[2], [TMP2], STRIDE +- ld1 {&acc2&.s}[1], [TMP1] +- ld1 {&acc2&.s}[3], [TMP2] +- convert_0565_to_x888 acc2, reg3, reg2, reg1 +- vzip ®1&.8b, ®3&.8b +- vzip ®2&.8b, ®4&.8b +- vzip ®3&.8b, ®4&.8b +- vzip ®1&.8b, ®2&.8b +- umull &acc1&.8h, ®1&.8b, v28.8b +- umlal &acc1&.8h, ®2&.8b, v29.8b +- umull &acc2&.8h, ®3&.8b, v28.8b +- umlal &acc2&.8h, ®4&.8b, v29.8b ++ ld1 {\()\acc2\().s}[0], [TMP1], STRIDE ++ ld1 {\()\acc2\().s}[2], [TMP2], STRIDE ++ ld1 {\()\acc2\().s}[1], [TMP1] ++ ld1 {\()\acc2\().s}[3], [TMP2] ++ convert_0565_to_x888 \acc2, \reg3, \reg2, \reg1 ++ vzip \()\reg1\().8b, \()\reg3\().8b ++ vzip \()\reg2\().8b, \()\reg4\().8b ++ vzip \()\reg3\().8b, \()\reg4\().8b ++ vzip \()\reg1\().8b, \()\reg2\().8b ++ umull \()\acc1\().8h, \()\reg1\().8b, v28.8b ++ umlal \()\acc1\().8h, \()\reg2\().8b, v29.8b ++ umull \()\acc2\().8h, \()\reg3\().8b, v28.8b ++ umlal \()\acc2\().8h, \()\reg4\().8b, v29.8b + .endm + + .macro bilinear_load_and_vertical_interpolate_four_0565 \ +- xacc1, xacc2, xreg1, xreg2, xreg3, xreg4, xacc2lo, xacc2hi \ ++ xacc1, xacc2, xreg1, xreg2, xreg3, xreg4, xacc2lo, xacc2hi, \ + yacc1, yacc2, yreg1, yreg2, yreg3, yreg4, yacc2lo, yacc2hi + + asr WTMP1, X, #16 +@@ -156,49 +156,49 @@ + asr WTMP2, X, #16 + add X, X, UX + add TMP2, TOP, TMP2, lsl #1 +- ld1 {&xacc2&.s}[0], [TMP1], STRIDE +- ld1 {&xacc2&.s}[2], [TMP2], STRIDE +- ld1 {&xacc2&.s}[1], [TMP1] +- ld1 {&xacc2&.s}[3], [TMP2] +- convert_0565_to_x888 xacc2, xreg3, xreg2, xreg1 ++ ld1 {\()\xacc2\().s}[0], [TMP1], STRIDE ++ ld1 {\()\xacc2\().s}[2], [TMP2], STRIDE ++ ld1 {\()\xacc2\().s}[1], [TMP1] ++ ld1 {\()\xacc2\().s}[3], [TMP2] ++ convert_0565_to_x888 \xacc2, \xreg3, \xreg2, \xreg1 + asr WTMP1, X, #16 + add X, X, UX + add TMP1, TOP, TMP1, lsl #1 + asr WTMP2, X, #16 + add X, X, UX + add TMP2, TOP, TMP2, lsl #1 +- ld1 {&yacc2&.s}[0], [TMP1], STRIDE +- vzip &xreg1&.8b, &xreg3&.8b +- ld1 {&yacc2&.s}[2], [TMP2], STRIDE +- vzip &xreg2&.8b, &xreg4&.8b +- ld1 {&yacc2&.s}[1], [TMP1] +- vzip &xreg3&.8b, &xreg4&.8b +- ld1 {&yacc2&.s}[3], [TMP2] +- vzip &xreg1&.8b, &xreg2&.8b +- convert_0565_to_x888 yacc2, yreg3, yreg2, yreg1 +- umull &xacc1&.8h, &xreg1&.8b, v28.8b +- vzip &yreg1&.8b, &yreg3&.8b +- umlal &xacc1&.8h, &xreg2&.8b, v29.8b +- vzip &yreg2&.8b, &yreg4&.8b +- umull &xacc2&.8h, &xreg3&.8b, v28.8b +- vzip &yreg3&.8b, &yreg4&.8b +- umlal &xacc2&.8h, &xreg4&.8b, v29.8b +- vzip &yreg1&.8b, &yreg2&.8b +- umull &yacc1&.8h, &yreg1&.8b, v28.8b +- umlal &yacc1&.8h, &yreg2&.8b, v29.8b +- umull &yacc2&.8h, &yreg3&.8b, v28.8b +- umlal &yacc2&.8h, &yreg4&.8b, v29.8b ++ ld1 {\()\yacc2\().s}[0], [TMP1], STRIDE ++ vzip \()\xreg1\().8b, \()\xreg3\().8b ++ ld1 {\()\yacc2\().s}[2], [TMP2], STRIDE ++ vzip \()\xreg2\().8b, \()\xreg4\().8b ++ ld1 {\()\yacc2\().s}[1], [TMP1] ++ vzip \()\xreg3\().8b, \()\xreg4\().8b ++ ld1 {\()\yacc2\().s}[3], [TMP2] ++ vzip \()\xreg1\().8b, \()\xreg2\().8b ++ convert_0565_to_x888 \yacc2, \yreg3, \yreg2, \yreg1 ++ umull \()\xacc1\().8h, \()\xreg1\().8b, v28.8b ++ vzip \()\yreg1\().8b, \()\yreg3\().8b ++ umlal \()\xacc1\().8h, \()\xreg2\().8b, v29.8b ++ vzip \()\yreg2\().8b, \()\yreg4\().8b ++ umull \()\xacc2\().8h, \()\xreg3\().8b, v28.8b ++ vzip \()\yreg3\().8b, \()\yreg4\().8b ++ umlal \()\xacc2\().8h, \()\xreg4\().8b, v29.8b ++ vzip \()\yreg1\().8b, \()\yreg2\().8b ++ umull \()\yacc1\().8h, \()\yreg1\().8b, v28.8b ++ umlal \()\yacc1\().8h, \()\yreg2\().8b, v29.8b ++ umull \()\yacc2\().8h, \()\yreg3\().8b, v28.8b ++ umlal \()\yacc2\().8h, \()\yreg4\().8b, v29.8b + .endm + + .macro bilinear_store_8888 numpix, tmp1, tmp2 +-.if numpix == 4 ++.if \numpix == 4 + st1 {v0.2s, v1.2s}, [OUT], #16 +-.elseif numpix == 2 ++.elseif \numpix == 2 + st1 {v0.2s}, [OUT], #8 +-.elseif numpix == 1 ++.elseif \numpix == 1 + st1 {v0.s}[0], [OUT], #4 + .else +- .error bilinear_store_8888 numpix is unsupported ++ .error bilinear_store_8888 \numpix is unsupported + .endif + .endm + +@@ -207,15 +207,15 @@ + vuzp v2.8b, v3.8b + vuzp v1.8b, v3.8b + vuzp v0.8b, v2.8b +- convert_8888_to_0565 v2, v1, v0, v1, tmp1, tmp2 +-.if numpix == 4 ++ convert_8888_to_0565 v2, v1, v0, v1, \tmp1, \tmp2 ++.if \numpix == 4 + st1 {v1.4h}, [OUT], #8 +-.elseif numpix == 2 ++.elseif \numpix == 2 + st1 {v1.s}[0], [OUT], #4 +-.elseif numpix == 1 ++.elseif \numpix == 1 + st1 {v1.h}[0], [OUT], #2 + .else +- .error bilinear_store_0565 numpix is unsupported ++ .error bilinear_store_0565 \numpix is unsupported + .endif + .endm + +@@ -228,20 +228,20 @@ + .endm + + .macro bilinear_load_mask_8 numpix, mask +-.if numpix == 4 +- ld1 {&mask&.s}[0], [MASK], #4 +-.elseif numpix == 2 +- ld1 {&mask&.h}[0], [MASK], #2 +-.elseif numpix == 1 +- ld1 {&mask&.b}[0], [MASK], #1 ++.if \numpix == 4 ++ ld1 {\()\mask\().s}[0], [MASK], #4 ++.elseif \numpix == 2 ++ ld1 {\()\mask\().h}[0], [MASK], #2 ++.elseif \numpix == 1 ++ ld1 {\()\mask\().b}[0], [MASK], #1 + .else +- .error bilinear_load_mask_8 numpix is unsupported ++ .error bilinear_load_mask_8 \numpix is unsupported + .endif +- prfm PREFETCH_MODE, [MASK, #prefetch_offset] ++ prfum PREFETCH_MODE, [MASK, #(prefetch_offset)] + .endm + + .macro bilinear_load_mask mask_fmt, numpix, mask +- bilinear_load_mask_&mask_fmt numpix, mask ++ bilinear_load_mask_\mask_fmt \numpix, \mask + .endm + + +@@ -256,30 +256,30 @@ + .endm + + .macro bilinear_load_dst_8888 numpix, dst0, dst1, dst01 +-.if numpix == 4 +- ld1 {&dst0&.2s, &dst1&.2s}, [OUT] +-.elseif numpix == 2 +- ld1 {&dst0&.2s}, [OUT] +-.elseif numpix == 1 +- ld1 {&dst0&.s}[0], [OUT] ++.if \numpix == 4 ++ ld1 {\()\dst0\().2s, \()\dst1\().2s}, [OUT] ++.elseif \numpix == 2 ++ ld1 {\()\dst0\().2s}, [OUT] ++.elseif \numpix == 1 ++ ld1 {\()\dst0\().s}[0], [OUT] + .else +- .error bilinear_load_dst_8888 numpix is unsupported ++ .error bilinear_load_dst_8888 \numpix is unsupported + .endif +- mov &dst01&.d[0], &dst0&.d[0] +- mov &dst01&.d[1], &dst1&.d[0] ++ mov \()\dst01\().d[0], \()\dst0\().d[0] ++ mov \()\dst01\().d[1], \()\dst1\().d[0] + prfm PREFETCH_MODE, [OUT, #(prefetch_offset * 4)] + .endm + + .macro bilinear_load_dst_8888_over numpix, dst0, dst1, dst01 +- bilinear_load_dst_8888 numpix, dst0, dst1, dst01 ++ bilinear_load_dst_8888 \numpix, \dst0, \dst1, \dst01 + .endm + + .macro bilinear_load_dst_8888_add numpix, dst0, dst1, dst01 +- bilinear_load_dst_8888 numpix, dst0, dst1, dst01 ++ bilinear_load_dst_8888 \numpix, \dst0, \dst1, \dst01 + .endm + + .macro bilinear_load_dst dst_fmt, op, numpix, dst0, dst1, dst01 +- bilinear_load_dst_&dst_fmt&_&op numpix, dst0, dst1, dst01 ++ bilinear_load_dst_\()\dst_fmt\()_\()\op \numpix, \dst0, \dst1, \dst01 + .endm + + /* +@@ -298,19 +298,19 @@ + .endm + + .macro bilinear_duplicate_mask_8 numpix, mask +-.if numpix == 4 +- dup &mask&.2s, &mask&.s[0] +-.elseif numpix == 2 +- dup &mask&.4h, &mask&.h[0] +-.elseif numpix == 1 +- dup &mask&.8b, &mask&.b[0] ++.if \numpix == 4 ++ dup \()\mask\().2s, \()\mask\().s[0] ++.elseif \numpix == 2 ++ dup \()\mask\().4h, \()\mask\().h[0] ++.elseif \numpix == 1 ++ dup \()\mask\().8b, \()\mask\().b[0] + .else +- .error bilinear_duplicate_mask_8 is unsupported ++ .error bilinear_duplicate_\mask_8 is unsupported + .endif + .endm + + .macro bilinear_duplicate_mask mask_fmt, numpix, mask +- bilinear_duplicate_mask_&mask_fmt numpix, mask ++ bilinear_duplicate_mask_\()\mask_fmt \numpix, \mask + .endm + + /* +@@ -318,14 +318,14 @@ + * Interleave should be done when maks is enabled or operator is 'over'. + */ + .macro bilinear_interleave src0, src1, src01, dst0, dst1, dst01 +- vuzp &src0&.8b, &src1&.8b +- vuzp &dst0&.8b, &dst1&.8b +- vuzp &src0&.8b, &src1&.8b +- vuzp &dst0&.8b, &dst1&.8b +- mov &src01&.d[1], &src1&.d[0] +- mov &src01&.d[0], &src0&.d[0] +- mov &dst01&.d[1], &dst1&.d[0] +- mov &dst01&.d[0], &dst0&.d[0] ++ vuzp \()\src0\().8b, \()\src1\().8b ++ vuzp \()\dst0\().8b, \()\dst1\().8b ++ vuzp \()\src0\().8b, \()\src1\().8b ++ vuzp \()\dst0\().8b, \()\dst1\().8b ++ mov \()\src01\().d[1], \()\src1\().d[0] ++ mov \()\src01\().d[0], \()\src0\().d[0] ++ mov \()\dst01\().d[1], \()\dst1\().d[0] ++ mov \()\dst01\().d[0], \()\dst0\().d[0] + .endm + + .macro bilinear_interleave_src_dst_x_src \ +@@ -335,37 +335,38 @@ + .macro bilinear_interleave_src_dst_x_over \ + numpix, src0, src1, src01, dst0, dst1, dst01 + +- bilinear_interleave src0, src1, src01, dst0, dst1, dst01 ++ bilinear_interleave \src0, \src1, \src01, \dst0, \dst1, \dst01 + .endm + + .macro bilinear_interleave_src_dst_x_add \ + numpix, src0, src1, src01, dst0, dst1, dst01 +- bilinear_interleave src0, src1, src01, dst0, dst1, dst01 ++ ++ bilinear_interleave \src0, \src1, \src01, \dst0, \dst1, \dst01 + .endm + + .macro bilinear_interleave_src_dst_8_src \ + numpix, src0, src1, src01, dst0, dst1, dst01 + +- bilinear_interleave src0, src1, src01, dst0, dst1, dst01 ++ bilinear_interleave \src0, \src1, \src01, \dst0, \dst1, \dst01 + .endm + + .macro bilinear_interleave_src_dst_8_over \ + numpix, src0, src1, src01, dst0, dst1, dst01 + +- bilinear_interleave src0, src1, src01, dst0, dst1, dst01 ++ bilinear_interleave \src0, \src1, \src01, \dst0, \dst1, \dst01 + .endm + + .macro bilinear_interleave_src_dst_8_add \ + numpix, src0, src1, src01, dst0, dst1, dst01 + +- bilinear_interleave src0, src1, src01, dst0, dst1, dst01 ++ bilinear_interleave \src0, \src1, \src01, \dst0, \dst1, \dst01 + .endm + + .macro bilinear_interleave_src_dst \ + mask_fmt, op, numpix, src0, src1, src01, dst0, dst1, dst01 + +- bilinear_interleave_src_dst_&mask_fmt&_&op \ +- numpix, src0, src1, src01, dst0, dst1, dst01 ++ bilinear_interleave_src_dst_\()\mask_fmt\()_\()\op \ ++ \numpix, \src0, \src1, \src01, \dst0, \dst1, \dst01 + .endm + + +@@ -383,25 +384,25 @@ + numpix, src0, src1, src01, mask, \ + tmp01, tmp23, tmp45, tmp67 + +- umull &tmp01&.8h, &src0&.8b, &mask&.8b +- umull &tmp23&.8h, &src1&.8b, &mask&.8b ++ umull \()\tmp01\().8h, \()\src0\().8b, \()\mask\().8b ++ umull \()\tmp23\().8h, \()\src1\().8b, \()\mask\().8b + /* bubbles */ +- urshr &tmp45&.8h, &tmp01&.8h, #8 +- urshr &tmp67&.8h, &tmp23&.8h, #8 ++ urshr \()\tmp45\().8h, \()\tmp01\().8h, #8 ++ urshr \()\tmp67\().8h, \()\tmp23\().8h, #8 + /* bubbles */ +- raddhn &src0&.8b, &tmp45&.8h, &tmp01&.8h +- raddhn &src1&.8b, &tmp67&.8h, &tmp23&.8h +- mov &src01&.d[0], &src0&.d[0] +- mov &src01&.d[1], &src1&.d[0] ++ raddhn \()\src0\().8b, \()\tmp45\().8h, \()\tmp01\().8h ++ raddhn \()\src1\().8b, \()\tmp67\().8h, \()\tmp23\().8h ++ mov \()\src01\().d[0], \()\src0\().d[0] ++ mov \()\src01\().d[1], \()\src1\().d[0] + .endm + + .macro bilinear_apply_mask_to_src \ + mask_fmt, numpix, src0, src1, src01, mask, \ + tmp01, tmp23, tmp45, tmp67 + +- bilinear_apply_mask_to_src_&mask_fmt \ +- numpix, src0, src1, src01, mask, \ +- tmp01, tmp23, tmp45, tmp67 ++ bilinear_apply_mask_to_src_\()\mask_fmt \ ++ \numpix, \src0, \src1, \src01, \mask, \ ++ \tmp01, \tmp23, \tmp45, \tmp67 + .endm + + +@@ -418,90 +419,90 @@ + numpix, src0, src1, src01, dst0, dst1, dst01, \ + tmp01, tmp23, tmp45, tmp67, tmp8 + +- dup &tmp8&.2s, &src1&.s[1] ++ dup \()\tmp8\().2s, \()\src1\().s[1] + /* bubbles */ +- mvn &tmp8&.8b, &tmp8&.8b ++ mvn \()\tmp8\().8b, \()\tmp8\().8b + /* bubbles */ +- umull &tmp01&.8h, &dst0&.8b, &tmp8&.8b ++ umull \()\tmp01\().8h, \()\dst0\().8b, \()\tmp8\().8b + /* bubbles */ +- umull &tmp23&.8h, &dst1&.8b, &tmp8&.8b ++ umull \()\tmp23\().8h, \()\dst1\().8b, \()\tmp8\().8b + /* bubbles */ +- urshr &tmp45&.8h, &tmp01&.8h, #8 +- urshr &tmp67&.8h, &tmp23&.8h, #8 ++ urshr \()\tmp45\().8h, \()\tmp01\().8h, #8 ++ urshr \()\tmp67\().8h, \()\tmp23\().8h, #8 + /* bubbles */ +- raddhn &dst0&.8b, &tmp45&.8h, &tmp01&.8h +- raddhn &dst1&.8b, &tmp67&.8h, &tmp23&.8h +- mov &dst01&.d[0], &dst0&.d[0] +- mov &dst01&.d[1], &dst1&.d[0] ++ raddhn \()\dst0\().8b, \()\tmp45\().8h, \()\tmp01\().8h ++ raddhn \()\dst1\().8b, \()\tmp67\().8h, \()\tmp23\().8h ++ mov \()\dst01\().d[0], \()\dst0\().d[0] ++ mov \()\dst01\().d[1], \()\dst1\().d[0] + /* bubbles */ +- uqadd &src0&.8b, &dst0&.8b, &src0&.8b +- uqadd &src1&.8b, &dst1&.8b, &src1&.8b +- mov &src01&.d[0], &src0&.d[0] +- mov &src01&.d[1], &src1&.d[0] ++ uqadd \()\src0\().8b, \()\dst0\().8b, \()\src0\().8b ++ uqadd \()\src1\().8b, \()\dst1\().8b, \()\src1\().8b ++ mov \()\src01\().d[0], \()\src0\().d[0] ++ mov \()\src01\().d[1], \()\src1\().d[0] + .endm + + .macro bilinear_combine_add \ + numpix, src0, src1, src01, dst0, dst1, dst01, \ + tmp01, tmp23, tmp45, tmp67, tmp8 + +- uqadd &src0&.8b, &dst0&.8b, &src0&.8b +- uqadd &src1&.8b, &dst1&.8b, &src1&.8b +- mov &src01&.d[0], &src0&.d[0] +- mov &src01&.d[1], &src1&.d[0] ++ uqadd \()\src0\().8b, \()\dst0\().8b, \()\src0\().8b ++ uqadd \()\src1\().8b, \()\dst1\().8b, \()\src1\().8b ++ mov \()\src01\().d[0], \()\src0\().d[0] ++ mov \()\src01\().d[1], \()\src1\().d[0] + .endm + + .macro bilinear_combine \ + op, numpix, src0, src1, src01, dst0, dst1, dst01, \ + tmp01, tmp23, tmp45, tmp67, tmp8 + +- bilinear_combine_&op \ +- numpix, src0, src1, src01, dst0, dst1, dst01, \ +- tmp01, tmp23, tmp45, tmp67, tmp8 ++ bilinear_combine_\()\op \ ++ \numpix, \src0, \src1, \src01, \dst0, \dst1, \dst01, \ ++ \tmp01, \tmp23, \tmp45, \tmp67, \tmp8 + .endm + + /* + * Macros for final deinterleaving of destination pixels if needed. + */ + .macro bilinear_deinterleave numpix, dst0, dst1, dst01 +- vuzp &dst0&.8b, &dst1&.8b ++ vuzp \()\dst0\().8b, \()\dst1\().8b + /* bubbles */ +- vuzp &dst0&.8b, &dst1&.8b +- mov &dst01&.d[0], &dst0&.d[0] +- mov &dst01&.d[1], &dst1&.d[0] ++ vuzp \()\dst0\().8b, \()\dst1\().8b ++ mov \()\dst01\().d[0], \()\dst0\().d[0] ++ mov \()\dst01\().d[1], \()\dst1\().d[0] + .endm + + .macro bilinear_deinterleave_dst_x_src numpix, dst0, dst1, dst01 + .endm + + .macro bilinear_deinterleave_dst_x_over numpix, dst0, dst1, dst01 +- bilinear_deinterleave numpix, dst0, dst1, dst01 ++ bilinear_deinterleave \numpix, \dst0, \dst1, \dst01 + .endm + + .macro bilinear_deinterleave_dst_x_add numpix, dst0, dst1, dst01 +- bilinear_deinterleave numpix, dst0, dst1, dst01 ++ bilinear_deinterleave \numpix, \dst0, \dst1, \dst01 + .endm + + .macro bilinear_deinterleave_dst_8_src numpix, dst0, dst1, dst01 +- bilinear_deinterleave numpix, dst0, dst1, dst01 ++ bilinear_deinterleave \numpix, \dst0, \dst1, \dst01 + .endm + + .macro bilinear_deinterleave_dst_8_over numpix, dst0, dst1, dst01 +- bilinear_deinterleave numpix, dst0, dst1, dst01 ++ bilinear_deinterleave \numpix, \dst0, \dst1, \dst01 + .endm + + .macro bilinear_deinterleave_dst_8_add numpix, dst0, dst1, dst01 +- bilinear_deinterleave numpix, dst0, dst1, dst01 ++ bilinear_deinterleave \numpix, \dst0, \dst1, \dst01 + .endm + + .macro bilinear_deinterleave_dst mask_fmt, op, numpix, dst0, dst1, dst01 +- bilinear_deinterleave_dst_&mask_fmt&_&op numpix, dst0, dst1, dst01 ++ bilinear_deinterleave_dst_\()\mask_fmt\()_\()\op \numpix, \dst0, \dst1, \dst01 + .endm + + + .macro bilinear_interpolate_last_pixel src_fmt, mask_fmt, dst_fmt, op +- bilinear_load_&src_fmt v0, v1, v2 +- bilinear_load_mask mask_fmt, 1, v4 +- bilinear_load_dst dst_fmt, op, 1, v18, v19, v9 ++ bilinear_load_\()\src_fmt v0, v1, v2 ++ bilinear_load_mask \mask_fmt, 1, v4 ++ bilinear_load_dst \dst_fmt, \op, 1, v18, v19, v9 + umull v2.8h, v0.8b, v28.8b + umlal v2.8h, v1.8b, v29.8b + /* 5 cycles bubble */ +@@ -509,28 +510,28 @@ + umlsl v0.4s, v2.4h, v15.h[0] + umlal2 v0.4s, v2.8h, v15.h[0] + /* 5 cycles bubble */ +- bilinear_duplicate_mask mask_fmt, 1, v4 ++ bilinear_duplicate_mask \mask_fmt, 1, v4 + shrn v0.4h, v0.4s, #(2 * BILINEAR_INTERPOLATION_BITS) + /* 3 cycles bubble */ + xtn v0.8b, v0.8h + /* 1 cycle bubble */ + bilinear_interleave_src_dst \ +- mask_fmt, op, 1, v0, v1, v0, v18, v19, v9 ++ \mask_fmt, \op, 1, v0, v1, v0, v18, v19, v9 + bilinear_apply_mask_to_src \ +- mask_fmt, 1, v0, v1, v0, v4, \ ++ \mask_fmt, 1, v0, v1, v0, v4, \ + v3, v8, v10, v11 + bilinear_combine \ +- op, 1, v0, v1, v0, v18, v19, v9, \ ++ \op, 1, v0, v1, v0, v18, v19, v9, \ + v3, v8, v10, v11, v5 +- bilinear_deinterleave_dst mask_fmt, op, 1, v0, v1, v0 +- bilinear_store_&dst_fmt 1, v17, v18 ++ bilinear_deinterleave_dst \mask_fmt, \op, 1, v0, v1, v0 ++ bilinear_store_\()\dst_fmt 1, v17, v18 + .endm + + .macro bilinear_interpolate_two_pixels src_fmt, mask_fmt, dst_fmt, op +- bilinear_load_and_vertical_interpolate_two_&src_fmt \ ++ bilinear_load_and_vertical_interpolate_two_\()\src_fmt \ + v1, v11, v18, v19, v20, v21, v22, v23 +- bilinear_load_mask mask_fmt, 2, v4 +- bilinear_load_dst dst_fmt, op, 2, v18, v19, v9 ++ bilinear_load_mask \mask_fmt, 2, v4 ++ bilinear_load_dst \dst_fmt, \op, 2, v18, v19, v9 + ushll v0.4s, v1.4h, #BILINEAR_INTERPOLATION_BITS + umlsl v0.4s, v1.4h, v15.h[0] + umlal2 v0.4s, v1.8h, v15.h[0] +@@ -539,25 +540,25 @@ + umlal2 v10.4s, v11.8h, v15.h[4] + shrn v0.4h, v0.4s, #(2 * BILINEAR_INTERPOLATION_BITS) + shrn2 v0.8h, v10.4s, #(2 * BILINEAR_INTERPOLATION_BITS) +- bilinear_duplicate_mask mask_fmt, 2, v4 ++ bilinear_duplicate_mask \mask_fmt, 2, v4 + ushr v15.8h, v12.8h, #(16 - BILINEAR_INTERPOLATION_BITS) + add v12.8h, v12.8h, v13.8h + xtn v0.8b, v0.8h + bilinear_interleave_src_dst \ +- mask_fmt, op, 2, v0, v1, v0, v18, v19, v9 ++ \mask_fmt, \op, 2, v0, v1, v0, v18, v19, v9 + bilinear_apply_mask_to_src \ +- mask_fmt, 2, v0, v1, v0, v4, \ ++ \mask_fmt, 2, v0, v1, v0, v4, \ + v3, v8, v10, v11 + bilinear_combine \ +- op, 2, v0, v1, v0, v18, v19, v9, \ ++ \op, 2, v0, v1, v0, v18, v19, v9, \ + v3, v8, v10, v11, v5 +- bilinear_deinterleave_dst mask_fmt, op, 2, v0, v1, v0 +- bilinear_store_&dst_fmt 2, v16, v17 ++ bilinear_deinterleave_dst \mask_fmt, \op, 2, v0, v1, v0 ++ bilinear_store_\()\dst_fmt 2, v16, v17 + .endm + + .macro bilinear_interpolate_four_pixels src_fmt, mask_fmt, dst_fmt, op +- bilinear_load_and_vertical_interpolate_four_&src_fmt \ +- v1, v11, v4, v5, v6, v7, v22, v23 \ ++ bilinear_load_and_vertical_interpolate_four_\()\src_fmt \ ++ v1, v11, v4, v5, v6, v7, v22, v23, \ + v3, v9, v16, v17, v20, v21, v18, v19 + prfm PREFETCH_MODE, [TMP1, PF_OFFS] + sub TMP1, TMP1, STRIDE +@@ -580,23 +581,23 @@ + shrn2 v0.8h, v10.4s, #(2 * BILINEAR_INTERPOLATION_BITS) + shrn v2.4h, v2.4s, #(2 * BILINEAR_INTERPOLATION_BITS) + shrn2 v2.8h, v8.4s, #(2 * BILINEAR_INTERPOLATION_BITS) +- bilinear_load_mask mask_fmt, 4, v4 +- bilinear_duplicate_mask mask_fmt, 4, v4 ++ bilinear_load_mask \mask_fmt, 4, v4 ++ bilinear_duplicate_mask \mask_fmt, 4, v4 + ushr v15.8h, v12.8h, #(16 - BILINEAR_INTERPOLATION_BITS) + xtn v0.8b, v0.8h + xtn v1.8b, v2.8h + add v12.8h, v12.8h, v13.8h +- bilinear_load_dst dst_fmt, op, 4, v2, v3, v21 ++ bilinear_load_dst \dst_fmt, \op, 4, v2, v3, v21 + bilinear_interleave_src_dst \ +- mask_fmt, op, 4, v0, v1, v0, v2, v3, v11 ++ \mask_fmt, \op, 4, v0, v1, v0, v2, v3, v11 + bilinear_apply_mask_to_src \ +- mask_fmt, 4, v0, v1, v0, v4, \ ++ \mask_fmt, 4, v0, v1, v0, v4, \ + v6, v8, v9, v10 + bilinear_combine \ +- op, 4, v0, v1, v0, v2, v3, v1, \ ++ \op, 4, v0, v1, v0, v2, v3, v1, \ + v6, v8, v9, v10, v23 +- bilinear_deinterleave_dst mask_fmt, op, 4, v0, v1, v0 +- bilinear_store_&dst_fmt 4, v6, v7 ++ bilinear_deinterleave_dst \mask_fmt, \op, 4, v0, v1, v0 ++ bilinear_store_\()\dst_fmt 4, v6, v7 + .endm + + .set BILINEAR_FLAG_USE_MASK, 1 +@@ -636,14 +637,14 @@ + prefetch_distance, \ + flags + +-pixman_asm_function fname +-.if pixblock_size == 8 +-.elseif pixblock_size == 4 ++pixman_asm_function \fname ++.if \pixblock_size == 8 ++.elseif \pixblock_size == 4 + .else + .error unsupported pixblock size + .endif + +-.if ((flags) & BILINEAR_FLAG_USE_MASK) == 0 ++.if ((\flags) & BILINEAR_FLAG_USE_MASK) == 0 + OUT .req x0 + TOP .req x1 + BOTTOM .req x2 +@@ -699,7 +700,7 @@ pixman_asm_function fname + STRIDE .req x15 + DUMMY .req x30 + +- .set prefetch_offset, prefetch_distance ++ .set prefetch_offset, \prefetch_distance + + stp x29, x30, [sp, -16]! + mov x29, sp +@@ -714,7 +715,7 @@ pixman_asm_function fname + sub sp, sp, 120 + .endif + +- mov WTMP1, #prefetch_distance ++ mov WTMP1, #\prefetch_distance + umull PF_OFFS, WTMP1, UX + + sub STRIDE, BOTTOM, TOP +@@ -735,11 +736,11 @@ pixman_asm_function fname + /* ensure good destination alignment */ + cmp WIDTH, #1 + blt 100f +- tst OUT, #(1 << dst_bpp_shift) ++ tst OUT, #(1 << \dst_bpp_shift) + beq 100f + ushr v15.8h, v12.8h, #(16 - BILINEAR_INTERPOLATION_BITS) + add v12.8h, v12.8h, v13.8h +- bilinear_process_last_pixel ++ \bilinear_process_last_pixel + sub WIDTH, WIDTH, #1 + 100: + add v13.8h, v13.8h, v13.8h +@@ -748,50 +749,50 @@ pixman_asm_function fname + + cmp WIDTH, #2 + blt 100f +- tst OUT, #(1 << (dst_bpp_shift + 1)) ++ tst OUT, #(1 << (\dst_bpp_shift + 1)) + beq 100f +- bilinear_process_two_pixels ++ \bilinear_process_two_pixels + sub WIDTH, WIDTH, #2 + 100: +-.if pixblock_size == 8 ++.if \pixblock_size == 8 + cmp WIDTH, #4 + blt 100f +- tst OUT, #(1 << (dst_bpp_shift + 2)) ++ tst OUT, #(1 << (\dst_bpp_shift + 2)) + beq 100f +- bilinear_process_four_pixels ++ \bilinear_process_four_pixels + sub WIDTH, WIDTH, #4 + 100: + .endif +- subs WIDTH, WIDTH, #pixblock_size ++ subs WIDTH, WIDTH, #\pixblock_size + blt 100f +- asr PF_OFFS, PF_OFFS, #(16 - src_bpp_shift) +- bilinear_process_pixblock_head +- subs WIDTH, WIDTH, #pixblock_size ++ asr PF_OFFS, PF_OFFS, #(16 - \src_bpp_shift) ++ \bilinear_process_pixblock_head ++ subs WIDTH, WIDTH, #\pixblock_size + blt 500f + 0: +- bilinear_process_pixblock_tail_head +- subs WIDTH, WIDTH, #pixblock_size ++ \bilinear_process_pixblock_tail_head ++ subs WIDTH, WIDTH, #\pixblock_size + bge 0b + 500: +- bilinear_process_pixblock_tail ++ \bilinear_process_pixblock_tail + 100: +-.if pixblock_size == 8 ++.if \pixblock_size == 8 + tst WIDTH, #4 + beq 200f +- bilinear_process_four_pixels ++ \bilinear_process_four_pixels + 200: + .endif + /* handle the remaining trailing pixels */ + tst WIDTH, #2 + beq 200f +- bilinear_process_two_pixels ++ \bilinear_process_two_pixels + 200: + tst WIDTH, #1 + beq 300f +- bilinear_process_last_pixel ++ \bilinear_process_last_pixel + 300: + +-.if ((flags) & BILINEAR_FLAG_USE_MASK) == 0 ++.if ((\flags) & BILINEAR_FLAG_USE_MASK) == 0 + sub x29, x29, 64 + ld1 {v8.8b, v9.8b, v10.8b, v11.8b}, [x29], 32 + ld1 {v12.8b, v13.8b, v14.8b, v15.8b}, [x29], 32 +@@ -829,11 +830,11 @@ pixman_asm_function fname + .unreq TMP3 + .unreq TMP4 + .unreq STRIDE +-.if ((flags) & BILINEAR_FLAG_USE_MASK) != 0 ++.if ((\flags) & BILINEAR_FLAG_USE_MASK) != 0 + .unreq MASK + .endif + +-.endfunc ++pixman_end_asm_function + + .endm + +diff --git a/pixman/pixman-arma64-neon-asm.S b/pixman/pixman-arma64-neon-asm.S +index 774d98d..107c133 100644 +--- a/pixman/pixman-arma64-neon-asm.S ++++ b/pixman/pixman-arma64-neon-asm.S +@@ -267,54 +267,54 @@ + sli v4.8h, v4.8h, #5 + ushll v14.8h, v17.8b, #7 + sli v14.8h, v14.8h, #1 +- PF add PF_X, PF_X, #8 ++ PF add, PF_X, PF_X, #8 + ushll v8.8h, v19.8b, #7 + sli v8.8h, v8.8h, #1 +- PF tst PF_CTL, #0xF ++ PF tst, PF_CTL, #0xF + sri v6.8b, v6.8b, #5 +- PF beq 10f +- PF add PF_X, PF_X, #8 ++ PF beq, 10f ++ PF add, PF_X, PF_X, #8 + 10: + mvn v3.8b, v3.8b +- PF beq 10f +- PF sub PF_CTL, PF_CTL, #1 ++ PF beq, 10f ++ PF sub, PF_CTL, PF_CTL, #1 + 10: + sri v7.8b, v7.8b, #6 + shrn v30.8b, v4.8h, #2 + umull v10.8h, v3.8b, v6.8b +- PF lsl DUMMY, PF_X, #src_bpp_shift +- PF prfm PREFETCH_MODE, [PF_SRC, DUMMY] ++ PF lsl, DUMMY, PF_X, #src_bpp_shift ++ PF prfm, PREFETCH_MODE, [PF_SRC, DUMMY] + umull v11.8h, v3.8b, v7.8b + umull v12.8h, v3.8b, v30.8b +- PF lsl DUMMY, PF_X, #dst_bpp_shift +- PF prfm PREFETCH_MODE, [PF_DST, DUMMY] ++ PF lsl, DUMMY, PF_X, #dst_bpp_shift ++ PF prfm, PREFETCH_MODE, [PF_DST, DUMMY] + sri v14.8h, v8.8h, #5 +- PF cmp PF_X, ORIG_W ++ PF cmp, PF_X, ORIG_W + ushll v9.8h, v18.8b, #7 + sli v9.8h, v9.8h, #1 + urshr v17.8h, v10.8h, #8 +- PF ble 10f +- PF sub PF_X, PF_X, ORIG_W ++ PF ble, 10f ++ PF sub, PF_X, PF_X, ORIG_W + 10: + urshr v19.8h, v11.8h, #8 + urshr v18.8h, v12.8h, #8 +- PF ble 10f +- PF subs PF_CTL, PF_CTL, #0x10 ++ PF ble, 10f ++ PF subs, PF_CTL, PF_CTL, #0x10 + 10: + sri v14.8h, v9.8h, #11 + mov v28.d[0], v14.d[0] + mov v29.d[0], v14.d[1] +- PF ble 10f +- PF lsl DUMMY, SRC_STRIDE, #src_bpp_shift +- PF ldrsb DUMMY, [PF_SRC, DUMMY] +- PF add PF_SRC, PF_SRC, #1 ++ PF ble, 10f ++ PF lsl, DUMMY, SRC_STRIDE, #src_bpp_shift ++ PF ldrsb, DUMMY, [PF_SRC, DUMMY] ++ PF add, PF_SRC, PF_SRC, #1 + 10: + raddhn v20.8b, v10.8h, v17.8h + raddhn v23.8b, v11.8h, v19.8h +- PF ble 10f +- PF lsl DUMMY, DST_STRIDE, #dst_bpp_shift +- PF ldrsb DUMMY, [PF_DST, DUMMY] +- PF add PF_DST, PF_SRC, #1 ++ PF ble, 10f ++ PF lsl, DUMMY, DST_STRIDE, #dst_bpp_shift ++ PF ldrsb, DUMMY, [PF_DST, DUMMY] ++ PF add, PF_DST, PF_SRC, #1 + 10: + raddhn v22.8b, v12.8h, v18.8h + st1 {v14.8h}, [DST_W], #16 +@@ -474,32 +474,32 @@ generate_composite_function \ + + .macro pixman_composite_src_8888_0565_process_pixblock_tail_head + sri v14.8h, v8.8h, #5 +- PF add PF_X, PF_X, #8 +- PF tst PF_CTL, #0xF ++ PF add, PF_X, PF_X, #8 ++ PF tst, PF_CTL, #0xF + fetch_src_pixblock +- PF beq 10f +- PF add PF_X, PF_X, #8 +- PF sub PF_CTL, PF_CTL, #1 ++ PF beq, 10f ++ PF add, PF_X, PF_X, #8 ++ PF sub, PF_CTL, PF_CTL, #1 + 10: + sri v14.8h, v9.8h, #11 + mov v28.d[0], v14.d[0] + mov v29.d[0], v14.d[1] +- PF cmp PF_X, ORIG_W +- PF lsl DUMMY, PF_X, #src_bpp_shift +- PF prfm PREFETCH_MODE, [PF_SRC, DUMMY] ++ PF cmp, PF_X, ORIG_W ++ PF lsl, DUMMY, PF_X, #src_bpp_shift ++ PF prfm, PREFETCH_MODE, [PF_SRC, DUMMY] + ushll v8.8h, v1.8b, #7 + sli v8.8h, v8.8h, #1 + st1 {v14.8h}, [DST_W], #16 +- PF ble 10f +- PF sub PF_X, PF_X, ORIG_W +- PF subs PF_CTL, PF_CTL, #0x10 ++ PF ble, 10f ++ PF sub, PF_X, PF_X, ORIG_W ++ PF subs, PF_CTL, PF_CTL, #0x10 + 10: + ushll v14.8h, v2.8b, #7 + sli v14.8h, v14.8h, #1 +- PF ble 10f +- PF lsl DUMMY, SRC_STRIDE, #src_bpp_shift +- PF ldrsb DUMMY, [PF_SRC, DUMMY] +- PF add PF_SRC, PF_SRC, #1 ++ PF ble, 10f ++ PF lsl, DUMMY, SRC_STRIDE, #src_bpp_shift ++ PF ldrsb, DUMMY, [PF_SRC, DUMMY] ++ PF add, PF_SRC, PF_SRC, #1 + 10: + ushll v9.8h, v0.8b, #7 + sli v9.8h, v9.8h, #1 +@@ -566,31 +566,31 @@ generate_composite_function \ + + .macro pixman_composite_add_8_8_process_pixblock_tail_head + fetch_src_pixblock +- PF add PF_X, PF_X, #32 +- PF tst PF_CTL, #0xF ++ PF add, PF_X, PF_X, #32 ++ PF tst, PF_CTL, #0xF + ld1 {v4.8b, v5.8b, v6.8b, v7.8b}, [DST_R], #32 +- PF beq 10f +- PF add PF_X, PF_X, #32 +- PF sub PF_CTL, PF_CTL, #1 ++ PF beq, 10f ++ PF add, PF_X, PF_X, #32 ++ PF sub, PF_CTL, PF_CTL, #1 + 10: + st1 {v28.8b, v29.8b, v30.8b, v31.8b}, [DST_W], #32 +- PF cmp PF_X, ORIG_W +- PF lsl DUMMY, PF_X, #src_bpp_shift +- PF prfm PREFETCH_MODE, [PF_SRC, DUMMY] +- PF lsl DUMMY, PF_X, #dst_bpp_shift +- PF prfm PREFETCH_MODE, [PF_DST, DUMMY] +- PF ble 10f +- PF sub PF_X, PF_X, ORIG_W +- PF subs PF_CTL, PF_CTL, #0x10 ++ PF cmp, PF_X, ORIG_W ++ PF lsl, DUMMY, PF_X, #src_bpp_shift ++ PF prfm, PREFETCH_MODE, [PF_SRC, DUMMY] ++ PF lsl, DUMMY, PF_X, #dst_bpp_shift ++ PF prfm, PREFETCH_MODE, [PF_DST, DUMMY] ++ PF ble, 10f ++ PF sub, PF_X, PF_X, ORIG_W ++ PF subs, PF_CTL, PF_CTL, #0x10 + 10: + uqadd v28.8b, v0.8b, v4.8b +- PF ble 10f +- PF lsl DUMMY, SRC_STRIDE, #src_bpp_shift +- PF ldrsb DUMMY, [PF_SRC, DUMMY] +- PF add PF_SRC, PF_SRC, #1 +- PF lsl DUMMY, DST_STRIDE, #dst_bpp_shift +- PF ldrsb DUMMY, [PF_DST, DUMMY] +- PF add PF_DST, PF_DST, #1 ++ PF ble, 10f ++ PF lsl, DUMMY, SRC_STRIDE, #src_bpp_shift ++ PF ldrsb, DUMMY, [PF_SRC, DUMMY] ++ PF add, PF_SRC, PF_SRC, #1 ++ PF lsl, DUMMY, DST_STRIDE, #dst_bpp_shift ++ PF ldrsb, DUMMY, [PF_DST, DUMMY] ++ PF add, PF_DST, PF_DST, #1 + 10: + uqadd v29.8b, v1.8b, v5.8b + uqadd v30.8b, v2.8b, v6.8b +@@ -612,31 +612,31 @@ generate_composite_function \ + + .macro pixman_composite_add_8888_8888_process_pixblock_tail_head + fetch_src_pixblock +- PF add PF_X, PF_X, #8 +- PF tst PF_CTL, #0xF ++ PF add, PF_X, PF_X, #8 ++ PF tst, PF_CTL, #0xF + ld1 {v4.8b, v5.8b, v6.8b, v7.8b}, [DST_R], #32 +- PF beq 10f +- PF add PF_X, PF_X, #8 +- PF sub PF_CTL, PF_CTL, #1 ++ PF beq, 10f ++ PF add, PF_X, PF_X, #8 ++ PF sub, PF_CTL, PF_CTL, #1 + 10: + st1 {v28.8b, v29.8b, v30.8b, v31.8b}, [DST_W], #32 +- PF cmp PF_X, ORIG_W +- PF lsl DUMMY, PF_X, #src_bpp_shift +- PF prfm PREFETCH_MODE, [PF_SRC, DUMMY] +- PF lsl DUMMY, PF_X, #dst_bpp_shift +- PF prfm PREFETCH_MODE, [PF_DST, DUMMY] +- PF ble 10f +- PF sub PF_X, PF_X, ORIG_W +- PF subs PF_CTL, PF_CTL, #0x10 ++ PF cmp, PF_X, ORIG_W ++ PF lsl, DUMMY, PF_X, #src_bpp_shift ++ PF prfm, PREFETCH_MODE, [PF_SRC, DUMMY] ++ PF lsl, DUMMY, PF_X, #dst_bpp_shift ++ PF prfm, PREFETCH_MODE, [PF_DST, DUMMY] ++ PF ble, 10f ++ PF sub, PF_X, PF_X, ORIG_W ++ PF subs, PF_CTL, PF_CTL, #0x10 + 10: + uqadd v28.8b, v0.8b, v4.8b +- PF ble 10f +- PF lsl DUMMY, SRC_STRIDE, #src_bpp_shift +- PF ldrsb DUMMY, [PF_SRC, DUMMY] +- PF add PF_SRC, PF_SRC, #1 +- PF lsl DUMMY, DST_STRIDE, #dst_bpp_shift +- PF ldrsb DUMMY, [PF_DST, DUMMY] +- PF add PF_DST, PF_DST, #1 ++ PF ble, 10f ++ PF lsl, DUMMY, SRC_STRIDE, #src_bpp_shift ++ PF ldrsb, DUMMY, [PF_SRC, DUMMY] ++ PF add, PF_SRC, PF_SRC, #1 ++ PF lsl, DUMMY, DST_STRIDE, #dst_bpp_shift ++ PF ldrsb, DUMMY, [PF_DST, DUMMY] ++ PF add, PF_DST, PF_DST, #1 + 10: + uqadd v29.8b, v1.8b, v5.8b + uqadd v30.8b, v2.8b, v6.8b +@@ -689,45 +689,45 @@ generate_composite_function_single_scanline \ + .macro pixman_composite_out_reverse_8888_8888_process_pixblock_tail_head + ld4 {v4.8b, v5.8b, v6.8b, v7.8b}, [DST_R], #32 + urshr v14.8h, v8.8h, #8 +- PF add PF_X, PF_X, #8 +- PF tst PF_CTL, #0xF ++ PF add, PF_X, PF_X, #8 ++ PF tst, PF_CTL, #0xF + urshr v15.8h, v9.8h, #8 + urshr v16.8h, v10.8h, #8 + urshr v17.8h, v11.8h, #8 +- PF beq 10f +- PF add PF_X, PF_X, #8 +- PF sub PF_CTL, PF_CTL, #1 ++ PF beq, 10f ++ PF add, PF_X, PF_X, #8 ++ PF sub, PF_CTL, PF_CTL, #1 + 10: + raddhn v28.8b, v14.8h, v8.8h + raddhn v29.8b, v15.8h, v9.8h +- PF cmp PF_X, ORIG_W ++ PF cmp, PF_X, ORIG_W + raddhn v30.8b, v16.8h, v10.8h + raddhn v31.8b, v17.8h, v11.8h + fetch_src_pixblock +- PF lsl DUMMY, PF_X, #src_bpp_shift +- PF prfm PREFETCH_MODE, [PF_SRC, DUMMY] ++ PF lsl, DUMMY, PF_X, #src_bpp_shift ++ PF prfm, PREFETCH_MODE, [PF_SRC, DUMMY] + mvn v22.8b, v3.8b +- PF lsl DUMMY, PF_X, #dst_bpp_shift +- PF prfm PREFETCH_MODE, [PF_DST, DUMMY] ++ PF lsl, DUMMY, PF_X, #dst_bpp_shift ++ PF prfm, PREFETCH_MODE, [PF_DST, DUMMY] + st4 {v28.8b, v29.8b, v30.8b, v31.8b}, [DST_W], #32 +- PF ble 10f +- PF sub PF_X, PF_X, ORIG_W ++ PF ble, 10f ++ PF sub, PF_X, PF_X, ORIG_W + 10: + umull v8.8h, v22.8b, v4.8b +- PF ble 10f +- PF subs PF_CTL, PF_CTL, #0x10 ++ PF ble, 10f ++ PF subs, PF_CTL, PF_CTL, #0x10 + 10: + umull v9.8h, v22.8b, v5.8b +- PF ble 10f +- PF lsl DUMMY, SRC_STRIDE, #src_bpp_shift +- PF ldrsb DUMMY, [PF_SRC, DUMMY] +- PF add PF_SRC, PF_SRC, #1 ++ PF ble, 10f ++ PF lsl, DUMMY, SRC_STRIDE, #src_bpp_shift ++ PF ldrsb, DUMMY, [PF_SRC, DUMMY] ++ PF add, PF_SRC, PF_SRC, #1 + 10: + umull v10.8h, v22.8b, v6.8b +- PF ble 10f +- PF lsl DUMMY, DST_STRIDE, #dst_bpp_shift +- PF ldrsb DUMMY, [PF_DST, DUMMY] +- PF add PF_DST, PF_DST, #1 ++ PF ble, 10f ++ PF lsl, DUMMY, DST_STRIDE, #dst_bpp_shift ++ PF ldrsb, DUMMY, [PF_DST, DUMMY] ++ PF add, PF_DST, PF_DST, #1 + 10: + umull v11.8h, v22.8b, v7.8b + .endm +@@ -759,18 +759,18 @@ generate_composite_function_single_scanline \ + .macro pixman_composite_over_8888_8888_process_pixblock_tail_head + ld4 {v4.8b, v5.8b, v6.8b, v7.8b}, [DST_R], #32 + urshr v14.8h, v8.8h, #8 +- PF add PF_X, PF_X, #8 +- PF tst PF_CTL, #0xF ++ PF add, PF_X, PF_X, #8 ++ PF tst, PF_CTL, #0xF + urshr v15.8h, v9.8h, #8 + urshr v16.8h, v10.8h, #8 + urshr v17.8h, v11.8h, #8 +- PF beq 10f +- PF add PF_X, PF_X, #8 +- PF sub PF_CTL, PF_CTL, #1 ++ PF beq, 10f ++ PF add, PF_X, PF_X, #8 ++ PF sub, PF_CTL, PF_CTL, #1 + 10: + raddhn v28.8b, v14.8h, v8.8h + raddhn v29.8b, v15.8h, v9.8h +- PF cmp PF_X, ORIG_W ++ PF cmp, PF_X, ORIG_W + raddhn v30.8b, v16.8h, v10.8h + raddhn v31.8b, v17.8h, v11.8h + uqadd v28.8b, v0.8b, v28.8b +@@ -778,30 +778,30 @@ generate_composite_function_single_scanline \ + uqadd v30.8b, v2.8b, v30.8b + uqadd v31.8b, v3.8b, v31.8b + fetch_src_pixblock +- PF lsl DUMMY, PF_X, #src_bpp_shift +- PF prfm PREFETCH_MODE, [PF_SRC, DUMMY] ++ PF lsl, DUMMY, PF_X, #src_bpp_shift ++ PF prfm, PREFETCH_MODE, [PF_SRC, DUMMY] + mvn v22.8b, v3.8b +- PF lsl DUMMY, PF_X, #dst_bpp_shift +- PF prfm PREFETCH_MODE, [PF_DST, DUMMY] ++ PF lsl, DUMMY, PF_X, #dst_bpp_shift ++ PF prfm, PREFETCH_MODE, [PF_DST, DUMMY] + st4 {v28.8b, v29.8b, v30.8b, v31.8b}, [DST_W], #32 +- PF ble 10f +- PF sub PF_X, PF_X, ORIG_W ++ PF ble, 10f ++ PF sub, PF_X, PF_X, ORIG_W + 10: + umull v8.8h, v22.8b, v4.8b +- PF ble 10f +- PF subs PF_CTL, PF_CTL, #0x10 ++ PF ble, 10f ++ PF subs, PF_CTL, PF_CTL, #0x10 + 10: + umull v9.8h, v22.8b, v5.8b +- PF ble 10f +- PF lsl DUMMY, SRC_STRIDE, #src_bpp_shift +- PF ldrsb DUMMY, [PF_SRC, DUMMY] +- PF add PF_SRC, PF_SRC, #1 ++ PF ble, 10f ++ PF lsl, DUMMY, SRC_STRIDE, #src_bpp_shift ++ PF ldrsb, DUMMY, [PF_SRC, DUMMY] ++ PF add, PF_SRC, PF_SRC, #1 + 10: + umull v10.8h, v22.8b, v6.8b +- PF ble 10f +- PF lsl DUMMY, DST_STRIDE, #dst_bpp_shift +- PF ldrsb DUMMY, [PF_DST, DUMMY] +- PF add PF_DST, PF_DST, #1 ++ PF ble, 10f ++ PF lsl, DUMMY, DST_STRIDE, #dst_bpp_shift ++ PF ldrsb, DUMMY, [PF_DST, DUMMY] ++ PF add, PF_DST, PF_DST, #1 + 10: + umull v11.8h, v22.8b, v7.8b + .endm +@@ -865,30 +865,30 @@ generate_composite_function_single_scanline \ + raddhn v31.8b, v17.8h, v11.8h + ld4 {v4.8b, v5.8b, v6.8b, v7.8b}, [DST_R], #32 + uqadd v28.8b, v0.8b, v28.8b +- PF add PF_X, PF_X, #8 +- PF tst PF_CTL, #0x0F +- PF beq 10f +- PF add PF_X, PF_X, #8 +- PF sub PF_CTL, PF_CTL, #1 ++ PF add, PF_X, PF_X, #8 ++ PF tst, PF_CTL, #0x0F ++ PF beq, 10f ++ PF add, PF_X, PF_X, #8 ++ PF sub, PF_CTL, PF_CTL, #1 + 10: + uqadd v29.8b, v1.8b, v29.8b + uqadd v30.8b, v2.8b, v30.8b + uqadd v31.8b, v3.8b, v31.8b +- PF cmp PF_X, ORIG_W ++ PF cmp, PF_X, ORIG_W + umull v8.8h, v24.8b, v4.8b +- PF lsl DUMMY, PF_X, #dst_bpp_shift +- PF prfm PREFETCH_MODE, [PF_DST, DUMMY] ++ PF lsl, DUMMY, PF_X, #dst_bpp_shift ++ PF prfm, PREFETCH_MODE, [PF_DST, DUMMY] + umull v9.8h, v24.8b, v5.8b +- PF ble 10f +- PF sub PF_X, PF_X, ORIG_W ++ PF ble, 10f ++ PF sub, PF_X, PF_X, ORIG_W + 10: + umull v10.8h, v24.8b, v6.8b +- PF subs PF_CTL, PF_CTL, #0x10 ++ PF subs, PF_CTL, PF_CTL, #0x10 + umull v11.8h, v24.8b, v7.8b +- PF ble 10f +- PF lsl DUMMY, DST_STRIDE, #dst_bpp_shift +- PF ldrsb DUMMY, [PF_DST, DUMMY] +- PF add PF_DST, PF_DST, #1 ++ PF ble, 10f ++ PF lsl, DUMMY, DST_STRIDE, #dst_bpp_shift ++ PF ldrsb, DUMMY, [PF_DST, DUMMY] ++ PF add, PF_DST, PF_DST, #1 + 10: + st4 {v28.8b, v29.8b, v30.8b, v31.8b}, [DST_W], #32 + .endm +@@ -917,18 +917,18 @@ generate_composite_function \ + + .macro pixman_composite_over_reverse_n_8888_process_pixblock_tail_head + urshr v14.8h, v8.8h, #8 +- PF add PF_X, PF_X, #8 +- PF tst PF_CTL, #0xF ++ PF add, PF_X, PF_X, #8 ++ PF tst, PF_CTL, #0xF + urshr v15.8h, v9.8h, #8 + urshr v12.8h, v10.8h, #8 + urshr v13.8h, v11.8h, #8 +- PF beq 10f +- PF add PF_X, PF_X, #8 +- PF sub PF_CTL, PF_CTL, #1 ++ PF beq, 10f ++ PF add, PF_X, PF_X, #8 ++ PF sub, PF_CTL, PF_CTL, #1 + 10: + raddhn v28.8b, v14.8h, v8.8h + raddhn v29.8b, v15.8h, v9.8h +- PF cmp PF_X, ORIG_W ++ PF cmp, PF_X, ORIG_W + raddhn v30.8b, v12.8h, v10.8h + raddhn v31.8b, v13.8h, v11.8h + uqadd v28.8b, v0.8b, v28.8b +@@ -937,22 +937,22 @@ generate_composite_function \ + uqadd v31.8b, v3.8b, v31.8b + ld4 {v0.8b, v1.8b, v2.8b, v3.8b}, [DST_R], #32 + mvn v22.8b, v3.8b +- PF lsl DUMMY, PF_X, #dst_bpp_shift +- PF prfm PREFETCH_MODE, [PF_DST, DUMMY] ++ PF lsl, DUMMY, PF_X, #dst_bpp_shift ++ PF prfm, PREFETCH_MODE, [PF_DST, DUMMY] + st4 {v28.8b, v29.8b, v30.8b, v31.8b}, [DST_W], #32 +- PF blt 10f +- PF sub PF_X, PF_X, ORIG_W ++ PF blt, 10f ++ PF sub, PF_X, PF_X, ORIG_W + 10: + umull v8.8h, v22.8b, v4.8b +- PF blt 10f +- PF subs PF_CTL, PF_CTL, #0x10 ++ PF blt, 10f ++ PF subs, PF_CTL, PF_CTL, #0x10 + 10: + umull v9.8h, v22.8b, v5.8b + umull v10.8h, v22.8b, v6.8b +- PF blt 10f +- PF lsl DUMMY, DST_STRIDE, #dst_bpp_shift +- PF ldrsb DUMMY, [PF_DST, DUMMY] +- PF add PF_DST, PF_DST, #1 ++ PF blt, 10f ++ PF lsl, DUMMY, DST_STRIDE, #dst_bpp_shift ++ PF ldrsb, DUMMY, [PF_DST, DUMMY] ++ PF add, PF_DST, PF_DST, #1 + 10: + umull v11.8h, v22.8b, v7.8b + .endm +@@ -1410,35 +1410,35 @@ generate_composite_function \ + + .macro pixman_composite_src_n_8_8888_process_pixblock_tail_head + fetch_mask_pixblock +- PF add PF_X, PF_X, #8 ++ PF add, PF_X, PF_X, #8 + rshrn v28.8b, v8.8h, #8 +- PF tst PF_CTL, #0x0F ++ PF tst, PF_CTL, #0x0F + rshrn v29.8b, v9.8h, #8 +- PF beq 10f +- PF add PF_X, PF_X, #8 ++ PF beq, 10f ++ PF add, PF_X, PF_X, #8 + 10: + rshrn v30.8b, v10.8h, #8 +- PF beq 10f +- PF sub PF_CTL, PF_CTL, #1 ++ PF beq, 10f ++ PF sub, PF_CTL, PF_CTL, #1 + 10: + rshrn v31.8b, v11.8h, #8 +- PF cmp PF_X, ORIG_W ++ PF cmp, PF_X, ORIG_W + umull v8.8h, v24.8b, v0.8b +- PF lsl DUMMY, PF_X, #mask_bpp_shift +- PF prfm PREFETCH_MODE, [PF_MASK, DUMMY] ++ PF lsl, DUMMY, PF_X, #mask_bpp_shift ++ PF prfm, PREFETCH_MODE, [PF_MASK, DUMMY] + umull v9.8h, v24.8b, v1.8b +- PF ble 10f +- PF sub PF_X, PF_X, ORIG_W ++ PF ble, 10f ++ PF sub, PF_X, PF_X, ORIG_W + 10: + umull v10.8h, v24.8b, v2.8b +- PF ble 10f +- PF subs PF_CTL, PF_CTL, #0x10 ++ PF ble, 10f ++ PF subs, PF_CTL, PF_CTL, #0x10 + 10: + umull v11.8h, v24.8b, v3.8b +- PF ble 10f +- PF lsl DUMMY, MASK_STRIDE, #mask_bpp_shift +- PF ldrsb DUMMY, [PF_MASK, DUMMY] +- PF add PF_MASK, PF_MASK, #1 ++ PF ble, 10f ++ PF lsl, DUMMY, MASK_STRIDE, #mask_bpp_shift ++ PF ldrsb, DUMMY, [PF_MASK, DUMMY] ++ PF add, PF_MASK, PF_MASK, #1 + 10: + st4 {v28.8b, v29.8b, v30.8b, v31.8b}, [DST_W], #32 + ursra v8.8h, v8.8h, #8 +@@ -1491,35 +1491,35 @@ generate_composite_function \ + + .macro pixman_composite_src_n_8_8_process_pixblock_tail_head + fetch_mask_pixblock +- PF add PF_X, PF_X, #8 ++ PF add, PF_X, PF_X, #8 + rshrn v28.8b, v0.8h, #8 +- PF tst PF_CTL, #0x0F ++ PF tst, PF_CTL, #0x0F + rshrn v29.8b, v1.8h, #8 +- PF beq 10f +- PF add PF_X, PF_X, #8 ++ PF beq, 10f ++ PF add, PF_X, PF_X, #8 + 10: + rshrn v30.8b, v2.8h, #8 +- PF beq 10f +- PF sub PF_CTL, PF_CTL, #1 ++ PF beq, 10f ++ PF sub, PF_CTL, PF_CTL, #1 + 10: + rshrn v31.8b, v3.8h, #8 +- PF cmp PF_X, ORIG_W ++ PF cmp, PF_X, ORIG_W + umull v0.8h, v24.8b, v16.8b +- PF lsl DUMMY, PF_X, mask_bpp_shift +- PF prfm PREFETCH_MODE, [PF_MASK, DUMMY] ++ PF lsl, DUMMY, PF_X, mask_bpp_shift ++ PF prfm, PREFETCH_MODE, [PF_MASK, DUMMY] + umull v1.8h, v25.8b, v16.8b +- PF ble 10f +- PF sub PF_X, PF_X, ORIG_W ++ PF ble, 10f ++ PF sub, PF_X, PF_X, ORIG_W + 10: + umull v2.8h, v26.8b, v16.8b +- PF ble 10f +- PF subs PF_CTL, PF_CTL, #0x10 ++ PF ble, 10f ++ PF subs, PF_CTL, PF_CTL, #0x10 + 10: + umull v3.8h, v27.8b, v16.8b +- PF ble 10f +- PF lsl DUMMY, MASK_STRIDE, #mask_bpp_shift +- PF ldrsb DUMMY, [PF_MASK, DUMMY] +- PF add PF_MASK, PF_MASK, #1 ++ PF ble, 10f ++ PF lsl, DUMMY, MASK_STRIDE, #mask_bpp_shift ++ PF ldrsb, DUMMY, [PF_MASK, DUMMY] ++ PF add, PF_MASK, PF_MASK, #1 + 10: + st1 {v28.8b, v29.8b, v30.8b, v31.8b}, [DST_W], #32 + ursra v0.8h, v0.8h, #8 +@@ -1599,44 +1599,44 @@ generate_composite_function \ + urshr v17.8h, v13.8h, #8 + fetch_mask_pixblock + urshr v18.8h, v14.8h, #8 +- PF add PF_X, PF_X, #8 ++ PF add, PF_X, PF_X, #8 + urshr v19.8h, v15.8h, #8 +- PF tst PF_CTL, #0x0F ++ PF tst, PF_CTL, #0x0F + raddhn v28.8b, v16.8h, v12.8h +- PF beq 10f +- PF add PF_X, PF_X, #8 ++ PF beq, 10f ++ PF add, PF_X, PF_X, #8 + 10: + raddhn v29.8b, v17.8h, v13.8h +- PF beq 10f +- PF sub PF_CTL, PF_CTL, #1 ++ PF beq, 10f ++ PF sub, PF_CTL, PF_CTL, #1 + 10: + raddhn v30.8b, v18.8h, v14.8h +- PF cmp PF_X, ORIG_W ++ PF cmp, PF_X, ORIG_W + raddhn v31.8b, v19.8h, v15.8h +- PF lsl DUMMY, PF_X, #dst_bpp_shift +- PF prfm PREFETCH_MODE, [PF_DST, DUMMY] ++ PF lsl, DUMMY, PF_X, #dst_bpp_shift ++ PF prfm, PREFETCH_MODE, [PF_DST, DUMMY] + umull v16.8h, v24.8b, v8.8b +- PF lsl DUMMY, PF_X, #mask_bpp_shift +- PF prfm PREFETCH_MODE, [PF_MASK, DUMMY] ++ PF lsl, DUMMY, PF_X, #mask_bpp_shift ++ PF prfm, PREFETCH_MODE, [PF_MASK, DUMMY] + umull v17.8h, v24.8b, v9.8b +- PF ble 10f +- PF sub PF_X, PF_X, ORIG_W ++ PF ble, 10f ++ PF sub, PF_X, PF_X, ORIG_W + 10: + umull v18.8h, v24.8b, v10.8b +- PF ble 10f +- PF subs PF_CTL, PF_CTL, #0x10 ++ PF ble, 10f ++ PF subs, PF_CTL, PF_CTL, #0x10 + 10: + umull v19.8h, v24.8b, v11.8b +- PF ble 10f +- PF lsl DUMMY, DST_STRIDE, #dst_bpp_shift +- PF ldrsb DUMMY, [PF_DST, DUMMY] +- PF add PF_DST, PF_DST, #1 ++ PF ble, 10f ++ PF lsl, DUMMY, DST_STRIDE, #dst_bpp_shift ++ PF ldrsb, DUMMY, [PF_DST, DUMMY] ++ PF add, PF_DST, PF_DST, #1 + 10: + uqadd v28.8b, v0.8b, v28.8b +- PF ble 10f +- PF lsl DUMMY, MASK_STRIDE, #mask_bpp_shift +- PF ldrsb DUMMY, [PF_MASK, DUMMY] +- PF add PF_MASK, PF_MASK, #1 ++ PF ble, 10f ++ PF lsl, DUMMY, MASK_STRIDE, #mask_bpp_shift ++ PF ldrsb, DUMMY, [PF_MASK, DUMMY] ++ PF add, PF_MASK, PF_MASK, #1 + 10: + uqadd v29.8b, v1.8b, v29.8b + uqadd v30.8b, v2.8b, v30.8b +@@ -2412,7 +2412,7 @@ generate_composite_function_single_scanline \ + default_cleanup_need_all_regs, \ + pixman_composite_out_reverse_8888_n_8888_process_pixblock_head, \ + pixman_composite_out_reverse_8888_n_8888_process_pixblock_tail, \ +- pixman_composite_out_reverse_8888_8888_8888_process_pixblock_tail_head \ ++ pixman_composite_out_reverse_8888_8888_8888_process_pixblock_tail_head, \ + 28, /* dst_w_basereg */ \ + 4, /* dst_r_basereg */ \ + 0, /* src_basereg */ \ +@@ -2487,7 +2487,7 @@ generate_composite_function \ + default_cleanup_need_all_regs, \ + pixman_composite_over_8888_n_8888_process_pixblock_head, \ + pixman_composite_over_8888_n_8888_process_pixblock_tail, \ +- pixman_composite_over_8888_8888_8888_process_pixblock_tail_head \ ++ pixman_composite_over_8888_8888_8888_process_pixblock_tail_head, \ + 28, /* dst_w_basereg */ \ + 4, /* dst_r_basereg */ \ + 0, /* src_basereg */ \ +@@ -2501,7 +2501,7 @@ generate_composite_function_single_scanline \ + default_cleanup_need_all_regs, \ + pixman_composite_over_8888_n_8888_process_pixblock_head, \ + pixman_composite_over_8888_n_8888_process_pixblock_tail, \ +- pixman_composite_over_8888_8888_8888_process_pixblock_tail_head \ ++ pixman_composite_over_8888_8888_8888_process_pixblock_tail_head, \ + 28, /* dst_w_basereg */ \ + 4, /* dst_r_basereg */ \ + 0, /* src_basereg */ \ +@@ -2529,7 +2529,7 @@ generate_composite_function \ + default_cleanup_need_all_regs, \ + pixman_composite_over_8888_n_8888_process_pixblock_head, \ + pixman_composite_over_8888_n_8888_process_pixblock_tail, \ +- pixman_composite_over_8888_8_8888_process_pixblock_tail_head \ ++ pixman_composite_over_8888_8_8888_process_pixblock_tail_head, \ + 28, /* dst_w_basereg */ \ + 4, /* dst_r_basereg */ \ + 0, /* src_basereg */ \ +@@ -2680,11 +2680,11 @@ generate_composite_function \ + urshr v13.8h, v10.8h, #8 + fetch_src_pixblock + raddhn v30.8b, v11.8h, v8.8h +- PF add PF_X, PF_X, #8 +- PF tst PF_CTL, #0xF +- PF beq 10f +- PF add PF_X, PF_X, #8 +- PF sub PF_CTL, PF_CTL, #1 ++ PF add, PF_X, PF_X, #8 ++ PF tst, PF_CTL, #0xF ++ PF beq, 10f ++ PF add, PF_X, PF_X, #8 ++ PF sub, PF_CTL, PF_CTL, #1 + 10: + raddhn v29.8b, v12.8h, v9.8h + raddhn v28.8b, v13.8h, v10.8h +@@ -2692,16 +2692,16 @@ generate_composite_function \ + umull v9.8h, v3.8b, v1.8b + umull v10.8h, v3.8b, v2.8b + st4 {v28.8b, v29.8b, v30.8b, v31.8b}, [DST_W], #32 +- PF cmp PF_X, ORIG_W +- PF lsl DUMMY, PF_X, src_bpp_shift +- PF prfm PREFETCH_MODE, [PF_SRC, DUMMY] +- PF ble 10f +- PF sub PF_X, PF_X, ORIG_W +- PF subs PF_CTL, PF_CTL, #0x10 +- PF ble 10f +- PF lsl DUMMY, SRC_STRIDE, #src_bpp_shift +- PF ldrsb DUMMY, [PF_SRC, DUMMY] +- PF add PF_SRC, PF_SRC, #1 ++ PF cmp, PF_X, ORIG_W ++ PF lsl, DUMMY, PF_X, src_bpp_shift ++ PF prfm, PREFETCH_MODE, [PF_SRC, DUMMY] ++ PF ble, 10f ++ PF sub, PF_X, PF_X, ORIG_W ++ PF subs, PF_CTL, PF_CTL, #0x10 ++ PF ble, 10f ++ PF lsl, DUMMY, SRC_STRIDE, #src_bpp_shift ++ PF ldrsb, DUMMY, [PF_SRC, DUMMY] ++ PF add, PF_SRC, PF_SRC, #1 + 10: + .endm + +@@ -2749,11 +2749,11 @@ generate_composite_function \ + urshr v13.8h, v10.8h, #8 + fetch_src_pixblock + raddhn v28.8b, v11.8h, v8.8h +- PF add PF_X, PF_X, #8 +- PF tst PF_CTL, #0xF +- PF beq 10f +- PF add PF_X, PF_X, #8 +- PF sub PF_CTL, PF_CTL, #1 ++ PF add, PF_X, PF_X, #8 ++ PF tst, PF_CTL, #0xF ++ PF beq, 10f ++ PF add, PF_X, PF_X, #8 ++ PF sub, PF_CTL, PF_CTL, #1 + 10: + raddhn v29.8b, v12.8h, v9.8h + raddhn v30.8b, v13.8h, v10.8h +@@ -2761,16 +2761,16 @@ generate_composite_function \ + umull v9.8h, v3.8b, v1.8b + umull v10.8h, v3.8b, v2.8b + st4 {v28.8b, v29.8b, v30.8b, v31.8b}, [DST_W], #32 +- PF cmp PF_X, ORIG_W +- PF lsl DUMMY, PF_X, src_bpp_shift +- PF prfm PREFETCH_MODE, [PF_SRC, DUMMY] +- PF ble 10f +- PF sub PF_X, PF_X, ORIG_W +- PF subs PF_CTL, PF_CTL, #0x10 +- PF ble 10f +- PF lsl DUMMY, SRC_STRIDE, #src_bpp_shift +- PF ldrsb DUMMY, [PF_SRC, DUMMY] +- PF add PF_SRC, PF_SRC, #1 ++ PF cmp, PF_X, ORIG_W ++ PF lsl, DUMMY, PF_X, src_bpp_shift ++ PF prfm, PREFETCH_MODE, [PF_SRC, DUMMY] ++ PF ble, 10f ++ PF sub, PF_X, PF_X, ORIG_W ++ PF subs, PF_CTL, PF_CTL, #0x10 ++ PF ble, 10f ++ PF lsl, DUMMY, SRC_STRIDE, #src_bpp_shift ++ PF ldrsb, DUMMY, [PF_SRC, DUMMY] ++ PF add, PF_SRC, PF_SRC, #1 + 10: + .endm + +@@ -3131,53 +3131,53 @@ generate_composite_function_nearest_scanline \ + asr TMP1, X, #16 + add X, X, UX + add TMP1, TOP, TMP1, lsl #2 +- ld1 {®1&.2s}, [TMP1], STRIDE +- ld1 {®2&.2s}, [TMP1] ++ ld1 {\()\reg1\().2s}, [TMP1], STRIDE ++ ld1 {\()\reg2\().2s}, [TMP1] + .endm + + .macro bilinear_load_0565 reg1, reg2, tmp + asr TMP1, X, #16 + add X, X, UX + add TMP1, TOP, TMP1, lsl #1 +- ld1 {®2&.s}[0], [TMP1], STRIDE +- ld1 {®2&.s}[1], [TMP1] +- convert_four_0565_to_x888_packed reg2, reg1, reg2, tmp ++ ld1 {\()\reg2\().s}[0], [TMP1], STRIDE ++ ld1 {\()\reg2\().s}[1], [TMP1] ++ convert_four_0565_to_x888_packed \reg2, \reg1, \reg2, \tmp + .endm + + .macro bilinear_load_and_vertical_interpolate_two_8888 \ + acc1, acc2, reg1, reg2, reg3, reg4, tmp1, tmp2 + +- bilinear_load_8888 reg1, reg2, tmp1 +- umull &acc1&.8h, ®1&.8b, v28.8b +- umlal &acc1&.8h, ®2&.8b, v29.8b +- bilinear_load_8888 reg3, reg4, tmp2 +- umull &acc2&.8h, ®3&.8b, v28.8b +- umlal &acc2&.8h, ®4&.8b, v29.8b ++ bilinear_load_8888 \reg1, \reg2, \tmp1 ++ umull \()\acc1\().8h, \()\reg1\().8b, v28.8b ++ umlal \()\acc1\().8h, \()\reg2\().8b, v29.8b ++ bilinear_load_8888 \reg3, \reg4, \tmp2 ++ umull \()\acc2\().8h, \()\reg3\().8b, v28.8b ++ umlal \()\acc2\().8h, \()\reg4\().8b, v29.8b + .endm + + .macro bilinear_load_and_vertical_interpolate_four_8888 \ +- xacc1, xacc2, xreg1, xreg2, xreg3, xreg4, xacc2lo, xacc2hi \ ++ xacc1, xacc2, xreg1, xreg2, xreg3, xreg4, xacc2lo, xacc2hi, \ + yacc1, yacc2, yreg1, yreg2, yreg3, yreg4, yacc2lo, yacc2hi + + bilinear_load_and_vertical_interpolate_two_8888 \ +- xacc1, xacc2, xreg1, xreg2, xreg3, xreg4, xacc2lo, xacc2hi ++ \xacc1, \xacc2, \xreg1, \xreg2, \xreg3, \xreg4, \xacc2lo, \xacc2hi + bilinear_load_and_vertical_interpolate_two_8888 \ +- yacc1, yacc2, yreg1, yreg2, yreg3, yreg4, yacc2lo, yacc2hi ++ \yacc1, \yacc2, \yreg1, \yreg2, \yreg3, \yreg4, \yacc2lo, \yacc2hi + .endm + + .macro vzip reg1, reg2 + umov TMP4, v31.d[0] +- zip1 v31.8b, reg1, reg2 +- zip2 reg2, reg1, reg2 +- mov reg1, v31.8b ++ zip1 v31.8b, \reg1, \reg2 ++ zip2 \reg2, \reg1, \reg2 ++ mov \reg1, v31.8b + mov v31.d[0], TMP4 + .endm + + .macro vuzp reg1, reg2 + umov TMP4, v31.d[0] +- uzp1 v31.8b, reg1, reg2 +- uzp2 reg2, reg1, reg2 +- mov reg1, v31.8b ++ uzp1 v31.8b, \reg1, \reg2 ++ uzp2 \reg2, \reg1, \reg2 ++ mov \reg1, v31.8b + mov v31.d[0], TMP4 + .endm + +@@ -3189,23 +3189,23 @@ generate_composite_function_nearest_scanline \ + asr TMP2, X, #16 + add X, X, UX + add TMP2, TOP, TMP2, lsl #1 +- ld1 {&acc2&.s}[0], [TMP1], STRIDE +- ld1 {&acc2&.s}[2], [TMP2], STRIDE +- ld1 {&acc2&.s}[1], [TMP1] +- ld1 {&acc2&.s}[3], [TMP2] +- convert_0565_to_x888 acc2, reg3, reg2, reg1 +- vzip ®1&.8b, ®3&.8b +- vzip ®2&.8b, ®4&.8b +- vzip ®3&.8b, ®4&.8b +- vzip ®1&.8b, ®2&.8b +- umull &acc1&.8h, ®1&.8b, v28.8b +- umlal &acc1&.8h, ®2&.8b, v29.8b +- umull &acc2&.8h, ®3&.8b, v28.8b +- umlal &acc2&.8h, ®4&.8b, v29.8b ++ ld1 {\()\acc2\().s}[0], [TMP1], STRIDE ++ ld1 {\()\acc2\().s}[2], [TMP2], STRIDE ++ ld1 {\()\acc2\().s}[1], [TMP1] ++ ld1 {\()\acc2\().s}[3], [TMP2] ++ convert_0565_to_x888 \acc2, \reg3, \reg2, \reg1 ++ vzip \()\reg1\().8b, \()\reg3\().8b ++ vzip \()\reg2\().8b, \()\reg4\().8b ++ vzip \()\reg3\().8b, \()\reg4\().8b ++ vzip \()\reg1\().8b, \()\reg2\().8b ++ umull \()\acc1\().8h, \()\reg1\().8b, v28.8b ++ umlal \()\acc1\().8h, \()\reg2\().8b, v29.8b ++ umull \()\acc2\().8h, \()\reg3\().8b, v28.8b ++ umlal \()\acc2\().8h, \()\reg4\().8b, v29.8b + .endm + + .macro bilinear_load_and_vertical_interpolate_four_0565 \ +- xacc1, xacc2, xreg1, xreg2, xreg3, xreg4, xacc2lo, xacc2hi \ ++ xacc1, xacc2, xreg1, xreg2, xreg3, xreg4, xacc2lo, xacc2hi, \ + yacc1, yacc2, yreg1, yreg2, yreg3, yreg4, yacc2lo, yacc2hi + asr TMP1, X, #16 + add X, X, UX +@@ -3213,49 +3213,49 @@ generate_composite_function_nearest_scanline \ + asr TMP2, X, #16 + add X, X, UX + add TMP2, TOP, TMP2, lsl #1 +- ld1 {&xacc2&.s}[0], [TMP1], STRIDE +- ld1 {&xacc2&.s}[2], [TMP2], STRIDE +- ld1 {&xacc2&.s}[1], [TMP1] +- ld1 {&xacc2&.s}[3], [TMP2] +- convert_0565_to_x888 xacc2, xreg3, xreg2, xreg1 ++ ld1 {\()\xacc2\().s}[0], [TMP1], STRIDE ++ ld1 {\()\xacc2\().s}[2], [TMP2], STRIDE ++ ld1 {\()\xacc2\().s}[1], [TMP1] ++ ld1 {\()\xacc2\().s}[3], [TMP2] ++ convert_0565_to_x888 \xacc2, \xreg3, \xreg2, \xreg1 + asr TMP1, X, #16 + add X, X, UX + add TMP1, TOP, TMP1, lsl #1 + asr TMP2, X, #16 + add X, X, UX + add TMP2, TOP, TMP2, lsl #1 +- ld1 {&yacc2&.s}[0], [TMP1], STRIDE +- vzip &xreg1&.8b, &xreg3&.8b +- ld1 {&yacc2&.s}[2], [TMP2], STRIDE +- vzip &xreg2&.8b, &xreg4&.8b +- ld1 {&yacc2&.s}[1], [TMP1] +- vzip &xreg3&.8b, &xreg4&.8b +- ld1 {&yacc2&.s}[3], [TMP2] +- vzip &xreg1&.8b, &xreg2&.8b +- convert_0565_to_x888 yacc2, yreg3, yreg2, yreg1 +- umull &xacc1&.8h, &xreg1&.8b, v28.8b +- vzip &yreg1&.8b, &yreg3&.8b +- umlal &xacc1&.8h, &xreg2&.8b, v29.8b +- vzip &yreg2&.8b, &yreg4&.8b +- umull &xacc2&.8h, &xreg3&.8b, v28.8b +- vzip &yreg3&.8b, &yreg4&.8b +- umlal &xacc2&.8h, &xreg4&.8b, v29.8b +- vzip &yreg1&.8b, &yreg2&.8b +- umull &yacc1&.8h, &yreg1&.8b, v28.8b +- umlal &yacc1&.8h, &yreg2&.8b, v29.8b +- umull &yacc2&.8h, &yreg3&.8b, v28.8b +- umlal &yacc2&.8h, &yreg4&.8b, v29.8b ++ ld1 {\()\yacc2\().s}[0], [TMP1], STRIDE ++ vzip \()\xreg1\().8b, \()\xreg3\().8b ++ ld1 {\()\yacc2\().s}[2], [TMP2], STRIDE ++ vzip \()\xreg2\().8b, \()\xreg4\().8b ++ ld1 {\()\yacc2\().s}[1], [TMP1] ++ vzip \()\xreg3\().8b, \()\xreg4\().8b ++ ld1 {\()\yacc2\().s}[3], [TMP2] ++ vzip \()\xreg1\().8b, \()\xreg2\().8b ++ convert_0565_to_x888 \yacc2, \yreg3, \yreg2, \yreg1 ++ umull \()\xacc1\().8h, \()\xreg1\().8b, v28.8b ++ vzip \()\yreg1\().8b, \()\yreg3\().8b ++ umlal \()\xacc1\().8h, \()\xreg2\().8b, v29.8b ++ vzip \()\yreg2\().8b, \()\yreg4\().8b ++ umull \()\xacc2\().8h, \()\xreg3\().8b, v28.8b ++ vzip \()\yreg3\().8b, \()\yreg4\().8b ++ umlal \()\xacc2\().8h, \()\xreg4\().8b, v29.8b ++ vzip \()\yreg1\().8b, \()\yreg2\().8b ++ umull \()\yacc1\().8h, \()\yreg1\().8b, v28.8b ++ umlal \()\yacc1\().8h, \()\yreg2\().8b, v29.8b ++ umull \()\yacc2\().8h, \()\yreg3\().8b, v28.8b ++ umlal \()\yacc2\().8h, \()\yreg4\().8b, v29.8b + .endm + + .macro bilinear_store_8888 numpix, tmp1, tmp2 +-.if numpix == 4 ++.if \numpix == 4 + st1 {v0.2s, v1.2s}, [OUT], #16 +-.elseif numpix == 2 ++.elseif \numpix == 2 + st1 {v0.2s}, [OUT], #8 +-.elseif numpix == 1 ++.elseif \numpix == 1 + st1 {v0.s}[0], [OUT], #4 + .else +- .error bilinear_store_8888 numpix is unsupported ++ .error bilinear_store_8888 \numpix is unsupported + .endif + .endm + +@@ -3264,20 +3264,20 @@ generate_composite_function_nearest_scanline \ + vuzp v2.8b, v3.8b + vuzp v1.8b, v3.8b + vuzp v0.8b, v2.8b +- convert_8888_to_0565 v2, v1, v0, v1, tmp1, tmp2 +-.if numpix == 4 ++ convert_8888_to_0565 v2, v1, v0, v1, \tmp1, \tmp2 ++.if \numpix == 4 + st1 {v1.4h}, [OUT], #8 +-.elseif numpix == 2 ++.elseif \numpix == 2 + st1 {v1.s}[0], [OUT], #4 +-.elseif numpix == 1 ++.elseif \numpix == 1 + st1 {v1.h}[0], [OUT], #2 + .else +- .error bilinear_store_0565 numpix is unsupported ++ .error bilinear_store_0565 \numpix is unsupported + .endif + .endm + + .macro bilinear_interpolate_last_pixel src_fmt, dst_fmt +- bilinear_load_&src_fmt v0, v1, v2 ++ bilinear_load_\()\src_fmt v0, v1, v2 + umull v2.8h, v0.8b, v28.8b + umlal v2.8h, v1.8b, v29.8b + /* 5 cycles bubble */ +@@ -3289,11 +3289,11 @@ generate_composite_function_nearest_scanline \ + /* 3 cycles bubble */ + xtn v0.8b, v0.8h + /* 1 cycle bubble */ +- bilinear_store_&dst_fmt 1, v3, v4 ++ bilinear_store_\()\dst_fmt 1, v3, v4 + .endm + + .macro bilinear_interpolate_two_pixels src_fmt, dst_fmt +- bilinear_load_and_vertical_interpolate_two_&src_fmt \ ++ bilinear_load_and_vertical_interpolate_two_\()\src_fmt \ + v1, v11, v2, v3, v20, v21, v22, v23 + ushll v0.4s, v1.4h, #BILINEAR_INTERPOLATION_BITS + umlsl v0.4s, v1.4h, v15.h[0] +@@ -3306,12 +3306,12 @@ generate_composite_function_nearest_scanline \ + ushr v15.8h, v12.8h, #(16 - BILINEAR_INTERPOLATION_BITS) + add v12.8h, v12.8h, v13.8h + xtn v0.8b, v0.8h +- bilinear_store_&dst_fmt 2, v3, v4 ++ bilinear_store_\()\dst_fmt 2, v3, v4 + .endm + + .macro bilinear_interpolate_four_pixels src_fmt, dst_fmt +- bilinear_load_and_vertical_interpolate_four_&src_fmt \ +- v1, v11, v14, v20, v16, v17, v22, v23 \ ++ bilinear_load_and_vertical_interpolate_four_\()\src_fmt \ ++ v1, v11, v14, v20, v16, v17, v22, v23, \ + v3, v9, v24, v25, v26, v27, v18, v19 + prfm PREFETCH_MODE, [TMP1, PF_OFFS] + sub TMP1, TMP1, STRIDE +@@ -3338,54 +3338,54 @@ generate_composite_function_nearest_scanline \ + xtn v0.8b, v0.8h + xtn v1.8b, v2.8h + add v12.8h, v12.8h, v13.8h +- bilinear_store_&dst_fmt 4, v3, v4 ++ bilinear_store_\()\dst_fmt 4, v3, v4 + .endm + + .macro bilinear_interpolate_four_pixels_head src_fmt, dst_fmt +-.ifdef have_bilinear_interpolate_four_pixels_&src_fmt&_&dst_fmt +- bilinear_interpolate_four_pixels_&src_fmt&_&dst_fmt&_head ++.ifdef have_bilinear_interpolate_four_pixels_\()\src_fmt\()_\()\dst_fmt ++ bilinear_interpolate_four_pixels_\()\src_fmt\()_\()\dst_fmt\()_head + .else +- bilinear_interpolate_four_pixels src_fmt, dst_fmt ++ bilinear_interpolate_four_pixels \src_fmt, \dst_fmt + .endif + .endm + + .macro bilinear_interpolate_four_pixels_tail src_fmt, dst_fmt +-.ifdef have_bilinear_interpolate_four_pixels_&src_fmt&_&dst_fmt +- bilinear_interpolate_four_pixels_&src_fmt&_&dst_fmt&_tail ++.ifdef have_bilinear_interpolate_four_pixels_\()\src_fmt\()_\()\dst_fmt ++ bilinear_interpolate_four_pixels_\()\src_fmt\()_\()\dst_fmt\()_tail + .endif + .endm + + .macro bilinear_interpolate_four_pixels_tail_head src_fmt, dst_fmt +-.ifdef have_bilinear_interpolate_four_pixels_&src_fmt&_&dst_fmt +- bilinear_interpolate_four_pixels_&src_fmt&_&dst_fmt&_tail_head ++.ifdef have_bilinear_interpolate_four_pixels_\()\src_fmt\()_\()\dst_fmt ++ bilinear_interpolate_four_pixels_\()\src_fmt\()_\()\dst_fmt\()_tail_head + .else +- bilinear_interpolate_four_pixels src_fmt, dst_fmt ++ bilinear_interpolate_four_pixels \src_fmt, \dst_fmt + .endif + .endm + + .macro bilinear_interpolate_eight_pixels_head src_fmt, dst_fmt +-.ifdef have_bilinear_interpolate_eight_pixels_&src_fmt&_&dst_fmt +- bilinear_interpolate_eight_pixels_&src_fmt&_&dst_fmt&_head ++.ifdef have_bilinear_interpolate_eight_pixels_\()\src_fmt\()_\()\dst_fmt ++ bilinear_interpolate_eight_pixels_\()\src_fmt\()_\()\dst_fmt\()_head + .else +- bilinear_interpolate_four_pixels_head src_fmt, dst_fmt +- bilinear_interpolate_four_pixels_tail_head src_fmt, dst_fmt ++ bilinear_interpolate_four_pixels_head \src_fmt, \dst_fmt ++ bilinear_interpolate_four_pixels_tail_head \src_fmt, \dst_fmt + .endif + .endm + + .macro bilinear_interpolate_eight_pixels_tail src_fmt, dst_fmt +-.ifdef have_bilinear_interpolate_eight_pixels_&src_fmt&_&dst_fmt +- bilinear_interpolate_eight_pixels_&src_fmt&_&dst_fmt&_tail ++.ifdef have_bilinear_interpolate_eight_pixels_\()\src_fmt\()_\()\dst_fmt ++ bilinear_interpolate_eight_pixels_\()\src_fmt\()_\()\dst_fmt\()_tail + .else +- bilinear_interpolate_four_pixels_tail src_fmt, dst_fmt ++ bilinear_interpolate_four_pixels_tail \src_fmt, \dst_fmt + .endif + .endm + + .macro bilinear_interpolate_eight_pixels_tail_head src_fmt, dst_fmt +-.ifdef have_bilinear_interpolate_eight_pixels_&src_fmt&_&dst_fmt +- bilinear_interpolate_eight_pixels_&src_fmt&_&dst_fmt&_tail_head ++.ifdef have_bilinear_interpolate_eight_pixels_\()\src_fmt\()_\()\dst_fmt ++ bilinear_interpolate_eight_pixels_\()\src_fmt\()_\()\dst_fmt\()_tail_head + .else +- bilinear_interpolate_four_pixels_tail_head src_fmt, dst_fmt +- bilinear_interpolate_four_pixels_tail_head src_fmt, dst_fmt ++ bilinear_interpolate_four_pixels_tail_head \src_fmt, \dst_fmt ++ bilinear_interpolate_four_pixels_tail_head \src_fmt, \dst_fmt + .endif + .endm + +@@ -3410,7 +3410,7 @@ generate_composite_function_nearest_scanline \ + src_bpp_shift, dst_bpp_shift, \ + prefetch_distance, flags + +-pixman_asm_function fname ++pixman_asm_function \fname + OUT .req x0 + TOP .req x1 + BOTTOM .req x2 +@@ -3442,7 +3442,7 @@ pixman_asm_function fname + stp x10, x11, [x29, -96] + stp x12, x13, [x29, -112] + +- mov PF_OFFS, #prefetch_distance ++ mov PF_OFFS, #\prefetch_distance + mul PF_OFFS, PF_OFFS, UX + + subs STRIDE, BOTTOM, TOP +@@ -3463,11 +3463,11 @@ pixman_asm_function fname + /* ensure good destination alignment */ + cmp WIDTH, #1 + blt 100f +- tst OUT, #(1 << dst_bpp_shift) ++ tst OUT, #(1 << \dst_bpp_shift) + beq 100f + ushr v15.8h, v12.8h, #(16 - BILINEAR_INTERPOLATION_BITS) + add v12.8h, v12.8h, v13.8h +- bilinear_interpolate_last_pixel src_fmt, dst_fmt ++ bilinear_interpolate_last_pixel \src_fmt, \dst_fmt + sub WIDTH, WIDTH, #1 + 100: + add v13.8h, v13.8h, v13.8h +@@ -3476,62 +3476,62 @@ pixman_asm_function fname + + cmp WIDTH, #2 + blt 100f +- tst OUT, #(1 << (dst_bpp_shift + 1)) ++ tst OUT, #(1 << (\dst_bpp_shift + 1)) + beq 100f +- bilinear_interpolate_two_pixels src_fmt, dst_fmt ++ bilinear_interpolate_two_pixels \src_fmt, \dst_fmt + sub WIDTH, WIDTH, #2 + 100: +-.if ((flags) & BILINEAR_FLAG_UNROLL_8) != 0 ++.if ((\flags) & BILINEAR_FLAG_UNROLL_8) != 0 + /*********** 8 pixels per iteration *****************/ + cmp WIDTH, #4 + blt 100f +- tst OUT, #(1 << (dst_bpp_shift + 2)) ++ tst OUT, #(1 << (\dst_bpp_shift + 2)) + beq 100f +- bilinear_interpolate_four_pixels src_fmt, dst_fmt ++ bilinear_interpolate_four_pixels \src_fmt, \dst_fmt + sub WIDTH, WIDTH, #4 + 100: + subs WIDTH, WIDTH, #8 + blt 100f +- asr PF_OFFS, PF_OFFS, #(16 - src_bpp_shift) +- bilinear_interpolate_eight_pixels_head src_fmt, dst_fmt ++ asr PF_OFFS, PF_OFFS, #(16 - \src_bpp_shift) ++ bilinear_interpolate_eight_pixels_head \src_fmt, \dst_fmt + subs WIDTH, WIDTH, #8 + blt 500f + 1000: +- bilinear_interpolate_eight_pixels_tail_head src_fmt, dst_fmt ++ bilinear_interpolate_eight_pixels_tail_head \src_fmt, \dst_fmt + subs WIDTH, WIDTH, #8 + bge 1000b + 500: +- bilinear_interpolate_eight_pixels_tail src_fmt, dst_fmt ++ bilinear_interpolate_eight_pixels_tail \src_fmt, \dst_fmt + 100: + tst WIDTH, #4 + beq 200f +- bilinear_interpolate_four_pixels src_fmt, dst_fmt ++ bilinear_interpolate_four_pixels \src_fmt, \dst_fmt + 200: + .else + /*********** 4 pixels per iteration *****************/ + subs WIDTH, WIDTH, #4 + blt 100f +- asr PF_OFFS, PF_OFFS, #(16 - src_bpp_shift) +- bilinear_interpolate_four_pixels_head src_fmt, dst_fmt ++ asr PF_OFFS, PF_OFFS, #(16 - \src_bpp_shift) ++ bilinear_interpolate_four_pixels_head \src_fmt, \dst_fmt + subs WIDTH, WIDTH, #4 + blt 500f + 1000: +- bilinear_interpolate_four_pixels_tail_head src_fmt, dst_fmt ++ bilinear_interpolate_four_pixels_tail_head \src_fmt, \dst_fmt + subs WIDTH, WIDTH, #4 + bge 1000b + 500: +- bilinear_interpolate_four_pixels_tail src_fmt, dst_fmt ++ bilinear_interpolate_four_pixels_tail \src_fmt, \dst_fmt + 100: + /****************************************************/ + .endif + /* handle the remaining trailing pixels */ + tst WIDTH, #2 + beq 200f +- bilinear_interpolate_two_pixels src_fmt, dst_fmt ++ bilinear_interpolate_two_pixels \src_fmt, \dst_fmt + 200: + tst WIDTH, #1 + beq 300f +- bilinear_interpolate_last_pixel src_fmt, dst_fmt ++ bilinear_interpolate_last_pixel \src_fmt, \dst_fmt + 300: + sub x29, x29, 64 + ld1 {v8.8b, v9.8b, v10.8b, v11.8b}, [x29], #32 +@@ -3556,7 +3556,7 @@ pixman_asm_function fname + .unreq TMP3 + .unreq TMP4 + .unreq STRIDE +-.endfunc ++pixman_end_asm_function + + .endm + +diff --git a/pixman/pixman-arma64-neon-asm.h b/pixman/pixman-arma64-neon-asm.h +index 5d93172..6aa6838 100644 +--- a/pixman/pixman-arma64-neon-asm.h ++++ b/pixman/pixman-arma64-neon-asm.h +@@ -80,146 +80,146 @@ + */ + + .macro pixldst1 op, elem_size, reg1, mem_operand, abits +- op {v®1&.&elem_size}, [&mem_operand&], #8 ++ \op {v\()\reg1\().\()\elem_size}, [\()\mem_operand\()], #8 + .endm + + .macro pixldst2 op, elem_size, reg1, reg2, mem_operand, abits +- op {v®1&.&elem_size, v®2&.&elem_size}, [&mem_operand&], #16 ++ \op {v\()\reg1\().\()\elem_size, v\()\reg2\().\()\elem_size}, [\()\mem_operand\()], #16 + .endm + + .macro pixldst4 op, elem_size, reg1, reg2, reg3, reg4, mem_operand, abits +- op {v®1&.&elem_size, v®2&.&elem_size, v®3&.&elem_size, v®4&.&elem_size}, [&mem_operand&], #32 ++ \op {v\()\reg1\().\()\elem_size, v\()\reg2\().\()\elem_size, v\()\reg3\().\()\elem_size, v\()\reg4\().\()\elem_size}, [\()\mem_operand\()], #32 + .endm + + .macro pixldst0 op, elem_size, reg1, idx, mem_operand, abits, bytes +- op {v®1&.&elem_size}[idx], [&mem_operand&], #&bytes& ++ \op {v\()\reg1\().\()\elem_size}[\idx], [\()\mem_operand\()], #\()\bytes\() + .endm + + .macro pixldst3 op, elem_size, reg1, reg2, reg3, mem_operand +- op {v®1&.&elem_size, v®2&.&elem_size, v®3&.&elem_size}, [&mem_operand&], #24 ++ \op {v\()\reg1\().\()\elem_size, v\()\reg2\().\()\elem_size, v\()\reg3\().\()\elem_size}, [\()\mem_operand\()], #24 + .endm + + .macro pixldst30 op, elem_size, reg1, reg2, reg3, idx, mem_operand +- op {v®1&.&elem_size, v®2&.&elem_size, v®3&.&elem_size}[idx], [&mem_operand&], #3 ++ \op {v\()\reg1\().\()\elem_size, v\()\reg2\().\()\elem_size, v\()\reg3\().\()\elem_size}[\idx], [\()\mem_operand\()], #3 + .endm + + .macro pixldst numbytes, op, elem_size, basereg, mem_operand, abits +-.if numbytes == 32 +- .if elem_size==32 +- pixldst4 op, 2s, %(basereg+4), %(basereg+5), \ +- %(basereg+6), %(basereg+7), mem_operand, abits +- .elseif elem_size==16 +- pixldst4 op, 4h, %(basereg+4), %(basereg+5), \ +- %(basereg+6), %(basereg+7), mem_operand, abits ++.if \numbytes == 32 ++ .if \elem_size==32 ++ pixldst4 \op, 2s, %(\basereg+4), %(\basereg+5), \ ++ %(\basereg+6), %(\basereg+7), \mem_operand, \abits ++ .elseif \elem_size==16 ++ pixldst4 \op, 4h, %(\basereg+4), %(\basereg+5), \ ++ %(\basereg+6), %(\basereg+7), \mem_operand, \abits + .else +- pixldst4 op, 8b, %(basereg+4), %(basereg+5), \ +- %(basereg+6), %(basereg+7), mem_operand, abits ++ pixldst4 \op, 8b, %(\basereg+4), %(\basereg+5), \ ++ %(\basereg+6), %(\basereg+7), \mem_operand, \abits + .endif +-.elseif numbytes == 16 +- .if elem_size==32 +- pixldst2 op, 2s, %(basereg+2), %(basereg+3), mem_operand, abits +- .elseif elem_size==16 +- pixldst2 op, 4h, %(basereg+2), %(basereg+3), mem_operand, abits ++.elseif \numbytes == 16 ++ .if \elem_size==32 ++ pixldst2 \op, 2s, %(\basereg+2), %(\basereg+3), \mem_operand, \abits ++ .elseif \elem_size==16 ++ pixldst2 \op, 4h, %(\basereg+2), %(\basereg+3), \mem_operand, \abits + .else +- pixldst2 op, 8b, %(basereg+2), %(basereg+3), mem_operand, abits ++ pixldst2 \op, 8b, %(\basereg+2), %(\basereg+3), \mem_operand, \abits + .endif +-.elseif numbytes == 8 +- .if elem_size==32 +- pixldst1 op, 2s, %(basereg+1), mem_operand, abits +- .elseif elem_size==16 +- pixldst1 op, 4h, %(basereg+1), mem_operand, abits ++.elseif \numbytes == 8 ++ .if \elem_size==32 ++ pixldst1 \op, 2s, %(\basereg+1), \mem_operand, \abits ++ .elseif \elem_size==16 ++ pixldst1 \op, 4h, %(\basereg+1), \mem_operand, \abits + .else +- pixldst1 op, 8b, %(basereg+1), mem_operand, abits ++ pixldst1 \op, 8b, %(\basereg+1), \mem_operand, \abits + .endif +-.elseif numbytes == 4 +- .if !RESPECT_STRICT_ALIGNMENT || (elem_size == 32) +- pixldst0 op, s, %(basereg+0), 1, mem_operand, abits, 4 +- .elseif elem_size == 16 +- pixldst0 op, h, %(basereg+0), 2, mem_operand, abits, 2 +- pixldst0 op, h, %(basereg+0), 3, mem_operand, abits, 2 ++.elseif \numbytes == 4 ++ .if !RESPECT_STRICT_ALIGNMENT || (\elem_size == 32) ++ pixldst0 \op, s, %(\basereg+0), 1, \mem_operand, \abits, 4 ++ .elseif \elem_size == 16 ++ pixldst0 \op, h, %(\basereg+0), 2, \mem_operand, \abits, 2 ++ pixldst0 \op, h, %(\basereg+0), 3, \mem_operand, \abits, 2 + .else +- pixldst0 op, b, %(basereg+0), 4, mem_operand, abits, 1 +- pixldst0 op, b, %(basereg+0), 5, mem_operand, abits, 1 +- pixldst0 op, b, %(basereg+0), 6, mem_operand, abits, 1 +- pixldst0 op, b, %(basereg+0), 7, mem_operand, abits, 1 ++ pixldst0 \op, b, %(\basereg+0), 4, \mem_operand, \abits, 1 ++ pixldst0 \op, b, %(\basereg+0), 5, \mem_operand, \abits, 1 ++ pixldst0 \op, b, %(\basereg+0), 6, \mem_operand, \abits, 1 ++ pixldst0 \op, b, %(\basereg+0), 7, \mem_operand, \abits, 1 + .endif +-.elseif numbytes == 2 +- .if !RESPECT_STRICT_ALIGNMENT || (elem_size == 16) +- pixldst0 op, h, %(basereg+0), 1, mem_operand, abits, 2 ++.elseif \numbytes == 2 ++ .if !RESPECT_STRICT_ALIGNMENT || (\elem_size == 16) ++ pixldst0 \op, h, %(\basereg+0), 1, \mem_operand, \abits, 2 + .else +- pixldst0 op, b, %(basereg+0), 2, mem_operand, abits, 1 +- pixldst0 op, b, %(basereg+0), 3, mem_operand, abits, 1 ++ pixldst0 \op, b, %(\basereg+0), 2, \mem_operand, \abits, 1 ++ pixldst0 \op, b, %(\basereg+0), 3, \mem_operand, \abits, 1 + .endif +-.elseif numbytes == 1 +- pixldst0 op, b, %(basereg+0), 1, mem_operand, abits, 1 ++.elseif \numbytes == 1 ++ pixldst0 \op, b, %(\basereg+0), 1, \mem_operand, \abits, 1 + .else +- .error "unsupported size: numbytes" ++ .error "unsupported size: \numbytes" + .endif + .endm + + .macro pixld numpix, bpp, basereg, mem_operand, abits=0 +-.if bpp > 0 +-.if (bpp == 32) && (numpix == 8) && (DEINTERLEAVE_32BPP_ENABLED != 0) +- pixldst4 ld4, 8b, %(basereg+4), %(basereg+5), \ +- %(basereg+6), %(basereg+7), mem_operand, abits +-.elseif (bpp == 24) && (numpix == 8) +- pixldst3 ld3, 8b, %(basereg+3), %(basereg+4), %(basereg+5), mem_operand +-.elseif (bpp == 24) && (numpix == 4) +- pixldst30 ld3, b, %(basereg+0), %(basereg+1), %(basereg+2), 4, mem_operand +- pixldst30 ld3, b, %(basereg+0), %(basereg+1), %(basereg+2), 5, mem_operand +- pixldst30 ld3, b, %(basereg+0), %(basereg+1), %(basereg+2), 6, mem_operand +- pixldst30 ld3, b, %(basereg+0), %(basereg+1), %(basereg+2), 7, mem_operand +-.elseif (bpp == 24) && (numpix == 2) +- pixldst30 ld3, b, %(basereg+0), %(basereg+1), %(basereg+2), 2, mem_operand +- pixldst30 ld3, b, %(basereg+0), %(basereg+1), %(basereg+2), 3, mem_operand +-.elseif (bpp == 24) && (numpix == 1) +- pixldst30 ld3, b, %(basereg+0), %(basereg+1), %(basereg+2), 1, mem_operand ++.if \bpp > 0 ++.if (\bpp == 32) && (\numpix == 8) && (DEINTERLEAVE_32BPP_ENABLED != 0) ++ pixldst4 ld4, 8b, %(\basereg+4), %(\basereg+5), \ ++ %(\basereg+6), %(\basereg+7), \mem_operand, \abits ++.elseif (\bpp == 24) && (\numpix == 8) ++ pixldst3 ld3, 8b, %(\basereg+3), %(\basereg+4), %(\basereg+5), \mem_operand ++.elseif (\bpp == 24) && (\numpix == 4) ++ pixldst30 ld3, b, %(\basereg+0), %(\basereg+1), %(\basereg+2), 4, \mem_operand ++ pixldst30 ld3, b, %(\basereg+0), %(\basereg+1), %(\basereg+2), 5, \mem_operand ++ pixldst30 ld3, b, %(\basereg+0), %(\basereg+1), %(\basereg+2), 6, \mem_operand ++ pixldst30 ld3, b, %(\basereg+0), %(\basereg+1), %(\basereg+2), 7, \mem_operand ++.elseif (\bpp == 24) && (\numpix == 2) ++ pixldst30 ld3, b, %(\basereg+0), %(\basereg+1), %(\basereg+2), 2, \mem_operand ++ pixldst30 ld3, b, %(\basereg+0), %(\basereg+1), %(\basereg+2), 3, \mem_operand ++.elseif (\bpp == 24) && (\numpix == 1) ++ pixldst30 ld3, b, %(\basereg+0), %(\basereg+1), %(\basereg+2), 1, \mem_operand + .else +- pixldst %(numpix * bpp / 8), ld1, %(bpp), basereg, mem_operand, abits ++ pixldst %(\numpix * \bpp / 8), ld1, %(\bpp), \basereg, \mem_operand, \abits + .endif + .endif + .endm + + .macro pixst numpix, bpp, basereg, mem_operand, abits=0 +-.if bpp > 0 +-.if (bpp == 32) && (numpix == 8) && (DEINTERLEAVE_32BPP_ENABLED != 0) +- pixldst4 st4, 8b, %(basereg+4), %(basereg+5), \ +- %(basereg+6), %(basereg+7), mem_operand, abits +-.elseif (bpp == 24) && (numpix == 8) +- pixldst3 st3, 8b, %(basereg+3), %(basereg+4), %(basereg+5), mem_operand +-.elseif (bpp == 24) && (numpix == 4) +- pixldst30 st3, b, %(basereg+0), %(basereg+1), %(basereg+2), 4, mem_operand +- pixldst30 st3, b, %(basereg+0), %(basereg+1), %(basereg+2), 5, mem_operand +- pixldst30 st3, b, %(basereg+0), %(basereg+1), %(basereg+2), 6, mem_operand +- pixldst30 st3, b, %(basereg+0), %(basereg+1), %(basereg+2), 7, mem_operand +-.elseif (bpp == 24) && (numpix == 2) +- pixldst30 st3, b, %(basereg+0), %(basereg+1), %(basereg+2), 2, mem_operand +- pixldst30 st3, b, %(basereg+0), %(basereg+1), %(basereg+2), 3, mem_operand +-.elseif (bpp == 24) && (numpix == 1) +- pixldst30 st3, b, %(basereg+0), %(basereg+1), %(basereg+2), 1, mem_operand +-.elseif numpix * bpp == 32 && abits == 32 +- pixldst 4, st1, 32, basereg, mem_operand, abits +-.elseif numpix * bpp == 16 && abits == 16 +- pixldst 2, st1, 16, basereg, mem_operand, abits ++.if \bpp > 0 ++.if (\bpp == 32) && (\numpix == 8) && (DEINTERLEAVE_32BPP_ENABLED != 0) ++ pixldst4 st4, 8b, %(\basereg+4), %(\basereg+5), \ ++ %(\basereg+6), %(\basereg+7), \mem_operand, \abits ++.elseif (\bpp == 24) && (\numpix == 8) ++ pixldst3 st3, 8b, %(\basereg+3), %(\basereg+4), %(\basereg+5), \mem_operand ++.elseif (\bpp == 24) && (\numpix == 4) ++ pixldst30 st3, b, %(\basereg+0), %(\basereg+1), %(\basereg+2), 4, \mem_operand ++ pixldst30 st3, b, %(\basereg+0), %(\basereg+1), %(\basereg+2), 5, \mem_operand ++ pixldst30 st3, b, %(\basereg+0), %(\basereg+1), %(\basereg+2), 6, \mem_operand ++ pixldst30 st3, b, %(\basereg+0), %(\basereg+1), %(\basereg+2), 7, \mem_operand ++.elseif (\bpp == 24) && (\numpix == 2) ++ pixldst30 st3, b, %(\basereg+0), %(\basereg+1), %(\basereg+2), 2, \mem_operand ++ pixldst30 st3, b, %(\basereg+0), %(\basereg+1), %(\basereg+2), 3, \mem_operand ++.elseif (\bpp == 24) && (\numpix == 1) ++ pixldst30 st3, b, %(\basereg+0), %(\basereg+1), %(\basereg+2), 1, \mem_operand ++.elseif \numpix * \bpp == 32 && \abits == 32 ++ pixldst 4, st1, 32, \basereg, \mem_operand, \abits ++.elseif \numpix * \bpp == 16 && \abits == 16 ++ pixldst 2, st1, 16, \basereg, \mem_operand, \abits + .else +- pixldst %(numpix * bpp / 8), st1, %(bpp), basereg, mem_operand, abits ++ pixldst %(\numpix * \bpp / 8), st1, %(\bpp), \basereg, \mem_operand, \abits + .endif + .endif + .endm + + .macro pixld_a numpix, bpp, basereg, mem_operand +-.if (bpp * numpix) <= 128 +- pixld numpix, bpp, basereg, mem_operand, %(bpp * numpix) ++.if (\bpp * \numpix) <= 128 ++ pixld \numpix, \bpp, \basereg, \mem_operand, %(\bpp * \numpix) + .else +- pixld numpix, bpp, basereg, mem_operand, 128 ++ pixld \numpix, \bpp, \basereg, \mem_operand, 128 + .endif + .endm + + .macro pixst_a numpix, bpp, basereg, mem_operand +-.if (bpp * numpix) <= 128 +- pixst numpix, bpp, basereg, mem_operand, %(bpp * numpix) ++.if (\bpp * \numpix) <= 128 ++ pixst \numpix, \bpp, \basereg, \mem_operand, %(\bpp * \numpix) + .else +- pixst numpix, bpp, basereg, mem_operand, 128 ++ pixst \numpix, \bpp, \basereg, \mem_operand, 128 + .endif + .endm + +@@ -228,96 +228,96 @@ + * aliases to be defined) + */ + .macro pixld1_s elem_size, reg1, mem_operand +-.if elem_size == 16 ++.if \elem_size == 16 + asr TMP1, VX, #16 + adds VX, VX, UNIT_X + bmi 55f + 5: subs VX, VX, SRC_WIDTH_FIXED + bpl 5b + 55: +- add TMP1, mem_operand, TMP1, lsl #1 ++ add TMP1, \mem_operand, TMP1, lsl #1 + asr TMP2, VX, #16 + adds VX, VX, UNIT_X + bmi 55f + 5: subs VX, VX, SRC_WIDTH_FIXED + bpl 5b + 55: +- add TMP2, mem_operand, TMP2, lsl #1 +- ld1 {v®1&.h}[0], [TMP1] ++ add TMP2, \mem_operand, TMP2, lsl #1 ++ ld1 {v\()\reg1\().h}[0], [TMP1] + asr TMP1, VX, #16 + adds VX, VX, UNIT_X + bmi 55f + 5: subs VX, VX, SRC_WIDTH_FIXED + bpl 5b + 55: +- add TMP1, mem_operand, TMP1, lsl #1 +- ld1 {v®1&.h}[1], [TMP2] ++ add TMP1, \mem_operand, TMP1, lsl #1 ++ ld1 {v\()\reg1\().h}[1], [TMP2] + asr TMP2, VX, #16 + adds VX, VX, UNIT_X + bmi 55f + 5: subs VX, VX, SRC_WIDTH_FIXED + bpl 5b + 55: +- add TMP2, mem_operand, TMP2, lsl #1 +- ld1 {v®1&.h}[2], [TMP1] +- ld1 {v®1&.h}[3], [TMP2] +-.elseif elem_size == 32 ++ add TMP2, \mem_operand, TMP2, lsl #1 ++ ld1 {v\()\reg1\().h}[2], [TMP1] ++ ld1 {v\()\reg1\().h}[3], [TMP2] ++.elseif \elem_size == 32 + asr TMP1, VX, #16 + adds VX, VX, UNIT_X + bmi 55f + 5: subs VX, VX, SRC_WIDTH_FIXED + bpl 5b + 55: +- add TMP1, mem_operand, TMP1, lsl #2 ++ add TMP1, \mem_operand, TMP1, lsl #2 + asr TMP2, VX, #16 + adds VX, VX, UNIT_X + bmi 55f + 5: subs VX, VX, SRC_WIDTH_FIXED + bpl 5b + 55: +- add TMP2, mem_operand, TMP2, lsl #2 +- ld1 {v®1&.s}[0], [TMP1] +- ld1 {v®1&.s}[1], [TMP2] ++ add TMP2, \mem_operand, TMP2, lsl #2 ++ ld1 {v\()\reg1\().s}[0], [TMP1] ++ ld1 {v\()\reg1\().s}[1], [TMP2] + .else + .error "unsupported" + .endif + .endm + + .macro pixld2_s elem_size, reg1, reg2, mem_operand +-.if 0 /* elem_size == 32 */ ++.if 0 /* \elem_size == 32 */ + mov TMP1, VX, asr #16 + add VX, VX, UNIT_X, asl #1 +- add TMP1, mem_operand, TMP1, asl #2 ++ add TMP1, \mem_operand, TMP1, asl #2 + mov TMP2, VX, asr #16 + sub VX, VX, UNIT_X +- add TMP2, mem_operand, TMP2, asl #2 +- ld1 {v®1&.s}[0], [TMP1] ++ add TMP2, \mem_operand, TMP2, asl #2 ++ ld1 {v\()\reg1\().s}[0], [TMP1] + mov TMP1, VX, asr #16 + add VX, VX, UNIT_X, asl #1 +- add TMP1, mem_operand, TMP1, asl #2 +- ld1 {v®2&.s}[0], [TMP2, :32] ++ add TMP1, \mem_operand, TMP1, asl #2 ++ ld1 {v\()\reg2\().s}[0], [TMP2, :32] + mov TMP2, VX, asr #16 + add VX, VX, UNIT_X +- add TMP2, mem_operand, TMP2, asl #2 +- ld1 {v®1&.s}[1], [TMP1] +- ld1 {v®2&.s}[1], [TMP2] ++ add TMP2, \mem_operand, TMP2, asl #2 ++ ld1 {v\()\reg1\().s}[1], [TMP1] ++ ld1 {v\()\reg2\().s}[1], [TMP2] + .else +- pixld1_s elem_size, reg1, mem_operand +- pixld1_s elem_size, reg2, mem_operand ++ pixld1_s \elem_size, \reg1, \mem_operand ++ pixld1_s \elem_size, \reg2, \mem_operand + .endif + .endm + + .macro pixld0_s elem_size, reg1, idx, mem_operand +-.if elem_size == 16 ++.if \elem_size == 16 + asr TMP1, VX, #16 + adds VX, VX, UNIT_X + bmi 55f + 5: subs VX, VX, SRC_WIDTH_FIXED + bpl 5b + 55: +- add TMP1, mem_operand, TMP1, lsl #1 +- ld1 {v®1&.h}[idx], [TMP1] +-.elseif elem_size == 32 ++ add TMP1, \mem_operand, TMP1, lsl #1 ++ ld1 {v\()\reg1\().h}[\idx], [TMP1] ++.elseif \elem_size == 32 + asr DUMMY, VX, #16 + mov TMP1, DUMMY + adds VX, VX, UNIT_X +@@ -325,85 +325,85 @@ + 5: subs VX, VX, SRC_WIDTH_FIXED + bpl 5b + 55: +- add TMP1, mem_operand, TMP1, lsl #2 +- ld1 {v®1&.s}[idx], [TMP1] ++ add TMP1, \mem_operand, TMP1, lsl #2 ++ ld1 {v\()\reg1\().s}[\idx], [TMP1] + .endif + .endm + + .macro pixld_s_internal numbytes, elem_size, basereg, mem_operand +-.if numbytes == 32 +- pixld2_s elem_size, %(basereg+4), %(basereg+5), mem_operand +- pixld2_s elem_size, %(basereg+6), %(basereg+7), mem_operand +- pixdeinterleave elem_size, %(basereg+4) +-.elseif numbytes == 16 +- pixld2_s elem_size, %(basereg+2), %(basereg+3), mem_operand +-.elseif numbytes == 8 +- pixld1_s elem_size, %(basereg+1), mem_operand +-.elseif numbytes == 4 +- .if elem_size == 32 +- pixld0_s elem_size, %(basereg+0), 1, mem_operand +- .elseif elem_size == 16 +- pixld0_s elem_size, %(basereg+0), 2, mem_operand +- pixld0_s elem_size, %(basereg+0), 3, mem_operand ++.if \numbytes == 32 ++ pixld2_s \elem_size, %(\basereg+4), %(\basereg+5), \mem_operand ++ pixld2_s \elem_size, %(\basereg+6), %(\basereg+7), \mem_operand ++ pixdeinterleave \elem_size, %(\basereg+4) ++.elseif \numbytes == 16 ++ pixld2_s \elem_size, %(\basereg+2), %(\basereg+3), \mem_operand ++.elseif \numbytes == 8 ++ pixld1_s \elem_size, %(\basereg+1), \mem_operand ++.elseif \numbytes == 4 ++ .if \elem_size == 32 ++ pixld0_s \elem_size, %(\basereg+0), 1, \mem_operand ++ .elseif \elem_size == 16 ++ pixld0_s \elem_size, %(\basereg+0), 2, \mem_operand ++ pixld0_s \elem_size, %(\basereg+0), 3, \mem_operand + .else +- pixld0_s elem_size, %(basereg+0), 4, mem_operand +- pixld0_s elem_size, %(basereg+0), 5, mem_operand +- pixld0_s elem_size, %(basereg+0), 6, mem_operand +- pixld0_s elem_size, %(basereg+0), 7, mem_operand ++ pixld0_s \elem_size, %(\basereg+0), 4, \mem_operand ++ pixld0_s \elem_size, %(\basereg+0), 5, \mem_operand ++ pixld0_s \elem_size, %(\basereg+0), 6, \mem_operand ++ pixld0_s \elem_size, %(\basereg+0), 7, \mem_operand + .endif +-.elseif numbytes == 2 +- .if elem_size == 16 +- pixld0_s elem_size, %(basereg+0), 1, mem_operand ++.elseif \numbytes == 2 ++ .if \elem_size == 16 ++ pixld0_s \elem_size, %(\basereg+0), 1, \mem_operand + .else +- pixld0_s elem_size, %(basereg+0), 2, mem_operand +- pixld0_s elem_size, %(basereg+0), 3, mem_operand ++ pixld0_s \elem_size, %(\basereg+0), 2, \mem_operand ++ pixld0_s \elem_size, %(\basereg+0), 3, \mem_operand + .endif +-.elseif numbytes == 1 +- pixld0_s elem_size, %(basereg+0), 1, mem_operand ++.elseif \numbytes == 1 ++ pixld0_s \elem_size, %(\basereg+0), 1, \mem_operand + .else +- .error "unsupported size: numbytes" ++ .error "unsupported size: \numbytes" + .endif + .endm + + .macro pixld_s numpix, bpp, basereg, mem_operand +-.if bpp > 0 +- pixld_s_internal %(numpix * bpp / 8), %(bpp), basereg, mem_operand ++.if \bpp > 0 ++ pixld_s_internal %(\numpix * \bpp / 8), %(\bpp), \basereg, \mem_operand + .endif + .endm + + .macro vuzp8 reg1, reg2 + umov DUMMY, v16.d[0] +- uzp1 v16.8b, v®1&.8b, v®2&.8b +- uzp2 v®2&.8b, v®1&.8b, v®2&.8b +- mov v®1&.8b, v16.8b ++ uzp1 v16.8b, v\()\reg1\().8b, v\()\reg2\().8b ++ uzp2 v\()\reg2\().8b, v\()\reg1\().8b, v\()\reg2\().8b ++ mov v\()\reg1\().8b, v16.8b + mov v16.d[0], DUMMY + .endm + + .macro vzip8 reg1, reg2 + umov DUMMY, v16.d[0] +- zip1 v16.8b, v®1&.8b, v®2&.8b +- zip2 v®2&.8b, v®1&.8b, v®2&.8b +- mov v®1&.8b, v16.8b ++ zip1 v16.8b, v\()\reg1\().8b, v\()\reg2\().8b ++ zip2 v\()\reg2\().8b, v\()\reg1\().8b, v\()\reg2\().8b ++ mov v\()\reg1\().8b, v16.8b + mov v16.d[0], DUMMY + .endm + + /* deinterleave B, G, R, A channels for eight 32bpp pixels in 4 registers */ + .macro pixdeinterleave bpp, basereg +-.if (bpp == 32) && (DEINTERLEAVE_32BPP_ENABLED != 0) +- vuzp8 %(basereg+0), %(basereg+1) +- vuzp8 %(basereg+2), %(basereg+3) +- vuzp8 %(basereg+1), %(basereg+3) +- vuzp8 %(basereg+0), %(basereg+2) ++.if (\bpp == 32) && (DEINTERLEAVE_32BPP_ENABLED != 0) ++ vuzp8 %(\basereg+0), %(\basereg+1) ++ vuzp8 %(\basereg+2), %(\basereg+3) ++ vuzp8 %(\basereg+1), %(\basereg+3) ++ vuzp8 %(\basereg+0), %(\basereg+2) + .endif + .endm + + /* interleave B, G, R, A channels for eight 32bpp pixels in 4 registers */ + .macro pixinterleave bpp, basereg +-.if (bpp == 32) && (DEINTERLEAVE_32BPP_ENABLED != 0) +- vzip8 %(basereg+0), %(basereg+2) +- vzip8 %(basereg+1), %(basereg+3) +- vzip8 %(basereg+2), %(basereg+3) +- vzip8 %(basereg+0), %(basereg+1) ++.if (\bpp == 32) && (DEINTERLEAVE_32BPP_ENABLED != 0) ++ vzip8 %(\basereg+0), %(\basereg+2) ++ vzip8 %(\basereg+1), %(\basereg+3) ++ vzip8 %(\basereg+2), %(\basereg+3) ++ vzip8 %(\basereg+0), %(\basereg+1) + .endif + .endm + +@@ -437,52 +437,52 @@ + */ + .macro PF a, x:vararg + .if (PREFETCH_TYPE_CURRENT == PREFETCH_TYPE_ADVANCED) +- a x ++ \a \x + .endif + .endm + + .macro cache_preload std_increment, boost_increment + .if (src_bpp_shift >= 0) || (dst_r_bpp != 0) || (mask_bpp_shift >= 0) +-.if std_increment != 0 +- PF add PF_X, PF_X, #std_increment ++.if \std_increment != 0 ++ PF add, PF_X, PF_X, #\std_increment + .endif +- PF tst PF_CTL, #0xF +- PF beq 71f +- PF add PF_X, PF_X, #boost_increment +- PF sub PF_CTL, PF_CTL, #1 ++ PF tst, PF_CTL, #0xF ++ PF beq, 71f ++ PF add, PF_X, PF_X, #\boost_increment ++ PF sub, PF_CTL, PF_CTL, #1 + 71: +- PF cmp PF_X, ORIG_W ++ PF cmp, PF_X, ORIG_W + .if src_bpp_shift >= 0 +- PF lsl DUMMY, PF_X, #src_bpp_shift +- PF prfm PREFETCH_MODE, [PF_SRC, DUMMY] ++ PF lsl, DUMMY, PF_X, #src_bpp_shift ++ PF prfm, PREFETCH_MODE, [PF_SRC, DUMMY] + .endif + .if dst_r_bpp != 0 +- PF lsl DUMMY, PF_X, #dst_bpp_shift +- PF prfm PREFETCH_MODE, [PF_DST, DUMMY] ++ PF lsl, DUMMY, PF_X, #dst_bpp_shift ++ PF prfm, PREFETCH_MODE, [PF_DST, DUMMY] + .endif + .if mask_bpp_shift >= 0 +- PF lsl DUMMY, PF_X, #mask_bpp_shift +- PF prfm PREFETCH_MODE, [PF_MASK, DUMMY] ++ PF lsl, DUMMY, PF_X, #mask_bpp_shift ++ PF prfm, PREFETCH_MODE, [PF_MASK, DUMMY] + .endif +- PF ble 71f +- PF sub PF_X, PF_X, ORIG_W +- PF subs PF_CTL, PF_CTL, #0x10 ++ PF ble, 71f ++ PF sub, PF_X, PF_X, ORIG_W ++ PF subs, PF_CTL, PF_CTL, #0x10 + 71: +- PF ble 72f ++ PF ble, 72f + .if src_bpp_shift >= 0 +- PF lsl DUMMY, SRC_STRIDE, #src_bpp_shift +- PF ldrsb DUMMY, [PF_SRC, DUMMY] +- PF add PF_SRC, PF_SRC, #1 ++ PF lsl, DUMMY, SRC_STRIDE, #src_bpp_shift ++ PF ldrsb, DUMMY, [PF_SRC, DUMMY] ++ PF add, PF_SRC, PF_SRC, #1 + .endif + .if dst_r_bpp != 0 +- PF lsl DUMMY, DST_STRIDE, #dst_bpp_shift +- PF ldrsb DUMMY, [PF_DST, DUMMY] +- PF add PF_DST, PF_DST, #1 ++ PF lsl, DUMMY, DST_STRIDE, #dst_bpp_shift ++ PF ldrsb, DUMMY, [PF_DST, DUMMY] ++ PF add, PF_DST, PF_DST, #1 + .endif + .if mask_bpp_shift >= 0 +- PF lsl DUMMY, MASK_STRIDE, #mask_bpp_shift +- PF ldrsb DUMMY, [PF_MASK, DUMMY] +- PF add PF_MASK, PF_MASK, #1 ++ PF lsl, DUMMY, MASK_STRIDE, #mask_bpp_shift ++ PF ldrsb, DUMMY, [PF_MASK, DUMMY] ++ PF add, PF_MASK, PF_MASK, #1 + .endif + 72: + .endif +@@ -521,21 +521,21 @@ + + .if src_bpp > 0 || mask_bpp > 0 || dst_r_bpp > 0 + .irp lowbit, 1, 2, 4, 8, 16 +-local skip1 +-.if (dst_w_bpp <= (lowbit * 8)) && ((lowbit * 8) < (pixblock_size * dst_w_bpp)) +-.if lowbit < 16 /* we don't need more than 16-byte alignment */ +- tst DST_R, #lowbit ++ ++.if (dst_w_bpp <= (\lowbit * 8)) && ((\lowbit * 8) < (pixblock_size * dst_w_bpp)) ++.if \lowbit < 16 /* we don't need more than 16-byte alignment */ ++ tst DST_R, #\lowbit + beq 51f + .endif +- pixld_src (lowbit * 8 / dst_w_bpp), src_bpp, src_basereg, SRC +- pixld (lowbit * 8 / dst_w_bpp), mask_bpp, mask_basereg, MASK ++ pixld_src (\lowbit * 8 / dst_w_bpp), src_bpp, src_basereg, SRC ++ pixld (\lowbit * 8 / dst_w_bpp), mask_bpp, mask_basereg, MASK + .if dst_r_bpp > 0 +- pixld_a (lowbit * 8 / dst_r_bpp), dst_r_bpp, dst_r_basereg, DST_R ++ pixld_a (\lowbit * 8 / dst_r_bpp), dst_r_bpp, dst_r_basereg, DST_R + .else +- add DST_R, DST_R, #lowbit ++ add DST_R, DST_R, #\lowbit + .endif +- PF add PF_X, PF_X, #(lowbit * 8 / dst_w_bpp) +- sub W, W, #(lowbit * 8 / dst_w_bpp) ++ PF add, PF_X, PF_X, #(\lowbit * 8 / dst_w_bpp) ++ sub W, W, #(\lowbit * 8 / dst_w_bpp) + 51: + .endif + .endr +@@ -544,23 +544,23 @@ local skip1 + pixdeinterleave mask_bpp, mask_basereg + pixdeinterleave dst_r_bpp, dst_r_basereg + +- process_pixblock_head ++ \process_pixblock_head + cache_preload 0, pixblock_size + cache_preload_simple +- process_pixblock_tail ++ \process_pixblock_tail + + pixinterleave dst_w_bpp, dst_w_basereg + + .irp lowbit, 1, 2, 4, 8, 16 +-.if (dst_w_bpp <= (lowbit * 8)) && ((lowbit * 8) < (pixblock_size * dst_w_bpp)) +-.if lowbit < 16 /* we don't need more than 16-byte alignment */ +- tst DST_W, #lowbit ++.if (dst_w_bpp <= (\lowbit * 8)) && ((\lowbit * 8) < (pixblock_size * dst_w_bpp)) ++.if \lowbit < 16 /* we don't need more than 16-byte alignment */ ++ tst DST_W, #\lowbit + beq 51f + .endif + .if src_bpp == 0 && mask_bpp == 0 && dst_r_bpp == 0 +- sub W, W, #(lowbit * 8 / dst_w_bpp) ++ sub W, W, #(\lowbit * 8 / dst_w_bpp) + .endif +- pixst_a (lowbit * 8 / dst_w_bpp), dst_w_bpp, dst_w_basereg, DST_W ++ pixst_a (\lowbit * 8 / dst_w_bpp), dst_w_bpp, dst_w_basereg, DST_W + 51: + .endif + .endr +@@ -592,18 +592,18 @@ local skip1 + beq 52f + .if src_bpp > 0 || mask_bpp > 0 || dst_r_bpp > 0 + .irp chunk_size, 16, 8, 4, 2, 1 +-.if pixblock_size > chunk_size +- tst W, #chunk_size ++.if pixblock_size > \chunk_size ++ tst W, #\chunk_size + beq 51f +- pixld_src chunk_size, src_bpp, src_basereg, SRC +- pixld chunk_size, mask_bpp, mask_basereg, MASK +-.if dst_aligned_flag != 0 +- pixld_a chunk_size, dst_r_bpp, dst_r_basereg, DST_R ++ pixld_src \chunk_size, src_bpp, src_basereg, SRC ++ pixld \chunk_size, mask_bpp, mask_basereg, MASK ++.if \dst_aligned_flag != 0 ++ pixld_a \chunk_size, dst_r_bpp, dst_r_basereg, DST_R + .else +- pixld chunk_size, dst_r_bpp, dst_r_basereg, DST_R ++ pixld \chunk_size, dst_r_bpp, dst_r_basereg, DST_R + .endif +-.if cache_preload_flag != 0 +- PF add PF_X, PF_X, #chunk_size ++.if \cache_preload_flag != 0 ++ PF add, PF_X, PF_X, #\chunk_size + .endif + 51: + .endif +@@ -613,21 +613,21 @@ local skip1 + pixdeinterleave mask_bpp, mask_basereg + pixdeinterleave dst_r_bpp, dst_r_basereg + +- process_pixblock_head +-.if cache_preload_flag != 0 ++ \process_pixblock_head ++.if \cache_preload_flag != 0 + cache_preload 0, pixblock_size + cache_preload_simple + .endif +- process_pixblock_tail ++ \process_pixblock_tail + pixinterleave dst_w_bpp, dst_w_basereg + .irp chunk_size, 16, 8, 4, 2, 1 +-.if pixblock_size > chunk_size +- tst W, #chunk_size ++.if pixblock_size > \chunk_size ++ tst W, #\chunk_size + beq 51f +-.if dst_aligned_flag != 0 +- pixst_a chunk_size, dst_w_bpp, dst_w_basereg, DST_W ++.if \dst_aligned_flag != 0 ++ pixst_a \chunk_size, dst_w_bpp, dst_w_basereg, DST_W + .else +- pixst chunk_size, dst_w_bpp, dst_w_basereg, DST_W ++ pixst \chunk_size, dst_w_bpp, dst_w_basereg, DST_W + .endif + 51: + .endif +@@ -660,7 +660,7 @@ local skip1 + .endif + subs H, H, #1 + mov DST_R, DST_W +- bge start_of_loop_label ++ bge \start_of_loop_label + .endm + + /* +@@ -687,7 +687,7 @@ local skip1 + src_basereg_ = 0, \ + mask_basereg_ = 24 + +- pixman_asm_function fname ++ pixman_asm_function \fname + stp x29, x30, [sp, -16]! + mov x29, sp + sub sp, sp, 232 /* push all registers */ +@@ -712,10 +712,10 @@ local skip1 + * has to be used instead of ADVANCED. + */ + .set PREFETCH_TYPE_CURRENT, PREFETCH_TYPE_DEFAULT +-.if prefetch_distance == 0 ++.if \prefetch_distance == 0 + .set PREFETCH_TYPE_CURRENT, PREFETCH_TYPE_NONE + .elseif (PREFETCH_TYPE_CURRENT > PREFETCH_TYPE_SIMPLE) && \ +- ((src_bpp_ == 24) || (mask_bpp_ == 24) || (dst_w_bpp_ == 24)) ++ ((\src_bpp_ == 24) || (\mask_bpp_ == 24) || (\dst_w_bpp_ == 24)) + .set PREFETCH_TYPE_CURRENT, PREFETCH_TYPE_SIMPLE + .endif + +@@ -723,17 +723,17 @@ local skip1 + * Make some macro arguments globally visible and accessible + * from other macros + */ +- .set src_bpp, src_bpp_ +- .set mask_bpp, mask_bpp_ +- .set dst_w_bpp, dst_w_bpp_ +- .set pixblock_size, pixblock_size_ +- .set dst_w_basereg, dst_w_basereg_ +- .set dst_r_basereg, dst_r_basereg_ +- .set src_basereg, src_basereg_ +- .set mask_basereg, mask_basereg_ ++ .set src_bpp, \src_bpp_ ++ .set mask_bpp, \mask_bpp_ ++ .set dst_w_bpp, \dst_w_bpp_ ++ .set pixblock_size, \pixblock_size_ ++ .set dst_w_basereg, \dst_w_basereg_ ++ .set dst_r_basereg, \dst_r_basereg_ ++ .set src_basereg, \src_basereg_ ++ .set mask_basereg, \mask_basereg_ + + .macro pixld_src x:vararg +- pixld x ++ pixld \x + .endm + .macro fetch_src_pixblock + pixld_src pixblock_size, src_bpp, \ +@@ -810,22 +810,22 @@ local skip1 + .error "requested dst bpp (dst_w_bpp) is not supported" + .endif + +-.if (((flags) & FLAG_DST_READWRITE) != 0) ++.if (((\flags) & FLAG_DST_READWRITE) != 0) + .set dst_r_bpp, dst_w_bpp + .else + .set dst_r_bpp, 0 + .endif +-.if (((flags) & FLAG_DEINTERLEAVE_32BPP) != 0) ++.if (((\flags) & FLAG_DEINTERLEAVE_32BPP) != 0) + .set DEINTERLEAVE_32BPP_ENABLED, 1 + .else + .set DEINTERLEAVE_32BPP_ENABLED, 0 + .endif + +-.if prefetch_distance < 0 || prefetch_distance > 15 +- .error "invalid prefetch distance (prefetch_distance)" ++.if \prefetch_distance < 0 || \prefetch_distance > 15 ++ .error "invalid prefetch distance (\prefetch_distance)" + .endif + +- PF mov PF_X, #0 ++ PF mov, PF_X, #0 + mov DST_R, DST_W + + .if src_bpp == 24 +@@ -844,15 +844,15 @@ local skip1 + /* + * Setup advanced prefetcher initial state + */ +- PF mov PF_SRC, SRC +- PF mov PF_DST, DST_R +- PF mov PF_MASK, MASK +- /* PF_CTL = prefetch_distance | ((h - 1) << 4) */ +- PF lsl DUMMY, H, #4 +- PF mov PF_CTL, DUMMY +- PF add PF_CTL, PF_CTL, #(prefetch_distance - 0x10) +- +- init ++ PF mov, PF_SRC, SRC ++ PF mov, PF_DST, DST_R ++ PF mov, PF_MASK, MASK ++ /* PF_CTL = \prefetch_distance | ((h - 1) << 4) */ ++ PF lsl, DUMMY, H, #4 ++ PF mov, PF_CTL, DUMMY ++ PF add, PF_CTL, PF_CTL, #(\prefetch_distance - 0x10) ++ ++ \init + subs H, H, #1 + mov ORIG_W, W + blt 9f +@@ -863,9 +863,9 @@ local skip1 + * long scanlines + */ + 0: +- ensure_destination_ptr_alignment process_pixblock_head, \ +- process_pixblock_tail, \ +- process_pixblock_tail_head ++ ensure_destination_ptr_alignment \process_pixblock_head, \ ++ \process_pixblock_tail, \ ++ \process_pixblock_tail_head + + /* Implement "head (tail_head) ... (tail_head) tail" loop pattern */ + pixld_a pixblock_size, dst_r_bpp, \ +@@ -873,32 +873,32 @@ local skip1 + fetch_src_pixblock + pixld pixblock_size, mask_bpp, \ + (mask_basereg - pixblock_size * mask_bpp / 64), MASK +- PF add PF_X, PF_X, #pixblock_size +- process_pixblock_head ++ PF add, PF_X, PF_X, #pixblock_size ++ \process_pixblock_head + cache_preload 0, pixblock_size + cache_preload_simple + subs W, W, #(pixblock_size * 2) + blt 200f + + 100: +- process_pixblock_tail_head ++ \process_pixblock_tail_head + cache_preload_simple + subs W, W, #pixblock_size + bge 100b + + 200: +- process_pixblock_tail ++ \process_pixblock_tail + pixst_a pixblock_size, dst_w_bpp, \ + (dst_w_basereg - pixblock_size * dst_w_bpp / 64), DST_W + + /* Process the remaining trailing pixels in the scanline */ + process_trailing_pixels 1, 1, \ +- process_pixblock_head, \ +- process_pixblock_tail, \ +- process_pixblock_tail_head ++ \process_pixblock_head, \ ++ \process_pixblock_tail, \ ++ \process_pixblock_tail_head + advance_to_next_scanline 0b + +- cleanup ++ \cleanup + 1000: + /* pop all registers */ + sub x29, x29, 64 +@@ -925,16 +925,16 @@ local skip1 + */ + 800: + .if src_bpp_shift >= 0 +- PF lsl DUMMY, SRC_STRIDE, #src_bpp_shift +- PF prfm PREFETCH_MODE, [SRC, DUMMY] ++ PF lsl, DUMMY, SRC_STRIDE, #src_bpp_shift ++ PF prfm, PREFETCH_MODE, [SRC, DUMMY] + .endif + .if dst_r_bpp != 0 +- PF lsl DUMMY, DST_STRIDE, #dst_bpp_shift +- PF prfm PREFETCH_MODE, [DST_R, DUMMY] ++ PF lsl, DUMMY, DST_STRIDE, #dst_bpp_shift ++ PF prfm, PREFETCH_MODE, [DST_R, DUMMY] + .endif + .if mask_bpp_shift >= 0 +- PF lsl DUMMY, MASK_STRIDE, #mask_bpp_shift +- PF prfm PREFETCH_MODE, [MASK, DUMMY] ++ PF lsl, DUMMY, MASK_STRIDE, #mask_bpp_shift ++ PF prfm, PREFETCH_MODE, [MASK, DUMMY] + .endif + /* Process exactly pixblock_size pixels if needed */ + tst W, #pixblock_size +@@ -944,19 +944,19 @@ local skip1 + fetch_src_pixblock + pixld pixblock_size, mask_bpp, \ + (mask_basereg - pixblock_size * mask_bpp / 64), MASK +- process_pixblock_head +- process_pixblock_tail ++ \process_pixblock_head ++ \process_pixblock_tail + pixst pixblock_size, dst_w_bpp, \ + (dst_w_basereg - pixblock_size * dst_w_bpp / 64), DST_W + 100: + /* Process the remaining trailing pixels in the scanline */ + process_trailing_pixels 0, 0, \ +- process_pixblock_head, \ +- process_pixblock_tail, \ +- process_pixblock_tail_head ++ \process_pixblock_head, \ ++ \process_pixblock_tail, \ ++ \process_pixblock_tail_head + advance_to_next_scanline 800b + 9: +- cleanup ++ \cleanup + /* pop all registers */ + sub x29, x29, 64 + ld1 {v8.8b, v9.8b, v10.8b, v11.8b}, [x29], 32 +@@ -995,7 +995,7 @@ local skip1 + .unreq PF_DST + .unreq PF_MASK + .unreq DUMMY +- .endfunc ++ pixman_end_asm_function + .endm + + /* +@@ -1019,23 +1019,23 @@ local skip1 + src_basereg_ = 0, \ + mask_basereg_ = 24 + +- pixman_asm_function fname ++ pixman_asm_function \fname + .set PREFETCH_TYPE_CURRENT, PREFETCH_TYPE_NONE + + /* + * Make some macro arguments globally visible and accessible + * from other macros + */ +- .set src_bpp, src_bpp_ +- .set mask_bpp, mask_bpp_ +- .set dst_w_bpp, dst_w_bpp_ +- .set pixblock_size, pixblock_size_ +- .set dst_w_basereg, dst_w_basereg_ +- .set dst_r_basereg, dst_r_basereg_ +- .set src_basereg, src_basereg_ +- .set mask_basereg, mask_basereg_ +- +-.if use_nearest_scaling != 0 ++ .set src_bpp, \src_bpp_ ++ .set mask_bpp, \mask_bpp_ ++ .set dst_w_bpp, \dst_w_bpp_ ++ .set pixblock_size, \pixblock_size_ ++ .set dst_w_basereg, \dst_w_basereg_ ++ .set dst_r_basereg, \dst_r_basereg_ ++ .set src_basereg, \src_basereg_ ++ .set mask_basereg, \mask_basereg_ ++ ++.if \use_nearest_scaling != 0 + /* + * Assign symbolic names to registers for nearest scaling + */ +@@ -1052,7 +1052,7 @@ local skip1 + DUMMY .req x30 + + .macro pixld_src x:vararg +- pixld_s x ++ pixld_s \x + .endm + + sxtw x0, w0 +@@ -1080,7 +1080,7 @@ local skip1 + DUMMY .req x30 + + .macro pixld_src x:vararg +- pixld x ++ pixld \x + .endm + + sxtw x0, w0 +@@ -1093,12 +1093,12 @@ local skip1 + st1 {v12.8b, v13.8b, v14.8b, v15.8b}, [x29], 32 + .endif + +-.if (((flags) & FLAG_DST_READWRITE) != 0) ++.if (((\flags) & FLAG_DST_READWRITE) != 0) + .set dst_r_bpp, dst_w_bpp + .else + .set dst_r_bpp, 0 + .endif +-.if (((flags) & FLAG_DEINTERLEAVE_32BPP) != 0) ++.if (((\flags) & FLAG_DEINTERLEAVE_32BPP) != 0) + .set DEINTERLEAVE_32BPP_ENABLED, 1 + .else + .set DEINTERLEAVE_32BPP_ENABLED, 0 +@@ -1109,15 +1109,15 @@ local skip1 + (src_basereg - pixblock_size * src_bpp / 64), SRC + .endm + +- init ++ \init + mov DST_R, DST_W + + cmp W, #pixblock_size + blt 800f + +- ensure_destination_ptr_alignment process_pixblock_head, \ +- process_pixblock_tail, \ +- process_pixblock_tail_head ++ ensure_destination_ptr_alignment \process_pixblock_head, \ ++ \process_pixblock_tail, \ ++ \process_pixblock_tail_head + + subs W, W, #pixblock_size + blt 700f +@@ -1128,26 +1128,26 @@ local skip1 + fetch_src_pixblock + pixld pixblock_size, mask_bpp, \ + (mask_basereg - pixblock_size * mask_bpp / 64), MASK +- process_pixblock_head ++ \process_pixblock_head + subs W, W, #pixblock_size + blt 200f + 100: +- process_pixblock_tail_head ++ \process_pixblock_tail_head + subs W, W, #pixblock_size + bge 100b + 200: +- process_pixblock_tail ++ \process_pixblock_tail + pixst_a pixblock_size, dst_w_bpp, \ + (dst_w_basereg - pixblock_size * dst_w_bpp / 64), DST_W + 700: + /* Process the remaining trailing pixels in the scanline (dst aligned) */ + process_trailing_pixels 0, 1, \ +- process_pixblock_head, \ +- process_pixblock_tail, \ +- process_pixblock_tail_head ++ \process_pixblock_head, \ ++ \process_pixblock_tail, \ ++ \process_pixblock_tail_head + +- cleanup +-.if use_nearest_scaling != 0 ++ \cleanup ++.if \use_nearest_scaling != 0 + sub x29, x29, 64 + ld1 {v8.8b, v9.8b, v10.8b, v11.8b}, [x29], 32 + ld1 {v12.8b, v13.8b, v14.8b, v15.8b}, [x29], 32 +@@ -1167,12 +1167,12 @@ local skip1 + 800: + /* Process the remaining trailing pixels in the scanline (dst unaligned) */ + process_trailing_pixels 0, 0, \ +- process_pixblock_head, \ +- process_pixblock_tail, \ +- process_pixblock_tail_head ++ \process_pixblock_head, \ ++ \process_pixblock_tail, \ ++ \process_pixblock_tail_head + +- cleanup +-.if use_nearest_scaling != 0 ++ \cleanup ++.if \use_nearest_scaling != 0 + sub x29, x29, 64 + ld1 {v8.8b, v9.8b, v10.8b, v11.8b}, [x29], 32 + ld1 {v12.8b, v13.8b, v14.8b, v15.8b}, [x29], 32 +@@ -1213,15 +1213,15 @@ local skip1 + .purgem fetch_src_pixblock + .purgem pixld_src + +- .endfunc ++ pixman_end_asm_function + .endm + + .macro generate_composite_function_single_scanline x:vararg +- generate_composite_function_scanline 0, x ++ generate_composite_function_scanline 0, \x + .endm + + .macro generate_composite_function_nearest_scanline x:vararg +- generate_composite_function_scanline 1, x ++ generate_composite_function_scanline 1, \x + .endm + + /* Default prologue/epilogue, nothing special needs to be done */ +@@ -1255,22 +1255,22 @@ local skip1 + * value (in) is lost. + */ + .macro convert_0565_to_8888 in, out_a, out_r, out_g, out_b +- shrn &out_r&.8b, &in&.8h, #8 +- shrn &out_g&.8b, &in&.8h, #3 +- sli &in&.8h, &in&.8h, #5 +- movi &out_a&.8b, #255 +- sri &out_r&.8b, &out_r&.8b, #5 +- sri &out_g&.8b, &out_g&.8b, #6 +- shrn &out_b&.8b, &in&.8h, #2 ++ shrn \()\out_r\().8b, \()\in\().8h, #8 ++ shrn \()\out_g\().8b, \()\in\().8h, #3 ++ sli \()\in\().8h, \()\in\().8h, #5 ++ movi \()\out_a\().8b, #255 ++ sri \()\out_r\().8b, \()\out_r\().8b, #5 ++ sri \()\out_g\().8b, \()\out_g\().8b, #6 ++ shrn \()\out_b\().8b, \()\in\().8h, #2 + .endm + + .macro convert_0565_to_x888 in, out_r, out_g, out_b +- shrn &out_r&.8b, &in&.8h, #8 +- shrn &out_g&.8b, &in&.8h, #3 +- sli &in&.8h, &in&.8h, #5 +- sri &out_r&.8b, &out_r&.8b, #5 +- sri &out_g&.8b, &out_g&.8b, #6 +- shrn &out_b&.8b, &in&.8h, #2 ++ shrn \()\out_r\().8b, \()\in\().8h, #8 ++ shrn \()\out_g\().8b, \()\in\().8h, #3 ++ sli \()\in\().8h, \()\in\().8h, #5 ++ sri \()\out_r\().8b, \()\out_r\().8b, #5 ++ sri \()\out_g\().8b, \()\out_g\().8b, #6 ++ shrn \()\out_b\().8b, \()\in\().8h, #2 + .endm + + /* +@@ -1280,14 +1280,14 @@ local skip1 + * registers (tmp1, tmp2) + */ + .macro convert_8888_to_0565 in_r, in_g, in_b, out, tmp1, tmp2 +- ushll &tmp1&.8h, &in_g&.8b, #7 +- shl &tmp1&.8h, &tmp1&.8h, #1 +- ushll &out&.8h, &in_r&.8b, #7 +- shl &out&.8h, &out&.8h, #1 +- ushll &tmp2&.8h, &in_b&.8b, #7 +- shl &tmp2&.8h, &tmp2&.8h, #1 +- sri &out&.8h, &tmp1&.8h, #5 +- sri &out&.8h, &tmp2&.8h, #11 ++ ushll \()\tmp1\().8h, \()\in_g\().8b, #7 ++ shl \()\tmp1\().8h, \()\tmp1\().8h, #1 ++ ushll \()\out\().8h, \()\in_r\().8b, #7 ++ shl \()\out\().8h, \()\out\().8h, #1 ++ ushll \()\tmp2\().8h, \()\in_b\().8b, #7 ++ shl \()\tmp2\().8h, \()\tmp2\().8h, #1 ++ sri \()\out\().8h, \()\tmp1\().8h, #5 ++ sri \()\out\().8h, \()\tmp2\().8h, #11 + .endm + + /* +@@ -1297,14 +1297,14 @@ local skip1 + * value from 'in' is lost + */ + .macro convert_four_0565_to_x888_packed in, out0, out1, tmp +- shl &out0&.4h, &in&.4h, #5 /* G top 6 bits */ +- shl &tmp&.4h, &in&.4h, #11 /* B top 5 bits */ +- sri &in&.4h, &in&.4h, #5 /* R is ready in top bits */ +- sri &out0&.4h, &out0&.4h, #6 /* G is ready in top bits */ +- sri &tmp&.4h, &tmp&.4h, #5 /* B is ready in top bits */ +- ushr &out1&.4h, &in&.4h, #8 /* R is in place */ +- sri &out0&.4h, &tmp&.4h, #8 /* G & B is in place */ +- zip1 &tmp&.4h, &out0&.4h, &out1&.4h /* everything is in place */ +- zip2 &out1&.4h, &out0&.4h, &out1&.4h +- mov &out0&.d[0], &tmp&.d[0] ++ shl \()\out0\().4h, \()\in\().4h, #5 /* G top 6 bits */ ++ shl \()\tmp\().4h, \()\in\().4h, #11 /* B top 5 bits */ ++ sri \()\in\().4h, \()\in\().4h, #5 /* R is ready \in top bits */ ++ sri \()\out0\().4h, \()\out0\().4h, #6 /* G is ready \in top bits */ ++ sri \()\tmp\().4h, \()\tmp\().4h, #5 /* B is ready \in top bits */ ++ ushr \()\out1\().4h, \()\in\().4h, #8 /* R is \in place */ ++ sri \()\out0\().4h, \()\tmp\().4h, #8 /* G \() B is \in place */ ++ zip1 \()\tmp\().4h, \()\out0\().4h, \()\out1\().4h /* everything is \in place */ ++ zip2 \()\out1\().4h, \()\out0\().4h, \()\out1\().4h ++ mov \()\out0\().d[0], \()\tmp\().d[0] + .endm +diff --git a/test/utils.h b/test/utils.h +index 701417f..389b5c1 100644 +--- a/test/utils.h ++++ b/test/utils.h +@@ -3,7 +3,7 @@ + #endif + + #include +-#include "pixman-private.h" /* For 'inline' definition */ ++#include "pixman-compiler.h" /* For 'inline' definition */ + #include "utils-prng.h" + + #if defined(_MSC_VER) +-- +2.41.0 + diff --git a/recipes/pixman/all/patches/0001-incompatible-pointer-types.patch b/recipes/pixman/all/patches/0001-incompatible-pointer-types.patch deleted file mode 100644 index ee95a8b091433..0000000000000 --- a/recipes/pixman/all/patches/0001-incompatible-pointer-types.patch +++ /dev/null @@ -1,21 +0,0 @@ -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 deleted file mode 100644 index 6063b377301a8..0000000000000 --- a/recipes/pixman/all/patches/0002-meson-build.patch +++ /dev/null @@ -1,253 +0,0 @@ -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/conanfile.py b/recipes/pixman/all/test_package/conanfile.py index 567553303012f..e2fd2bc866104 100644 --- a/recipes/pixman/all/test_package/conanfile.py +++ b/recipes/pixman/all/test_package/conanfile.py @@ -1,27 +1,27 @@ import os from conan import ConanFile +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout -from conan.tools import build class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" + 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 requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if build.can_run(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/pixman/all/test_v1_package/CMakeLists.txt b/recipes/pixman/all/test_v1_package/CMakeLists.txt index c26627b9ba7cf..0d20897301b68 100644 --- a/recipes/pixman/all/test_v1_package/CMakeLists.txt +++ b/recipes/pixman/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(pixman REQUIRED) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE pixman::pixman) +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 index 3da371b660e0a..49a3a66ea5bad 100644 --- a/recipes/pixman/all/test_v1_package/conanfile.py +++ b/recipes/pixman/all/test_v1_package/conanfile.py @@ -4,7 +4,7 @@ class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" + generators = "cmake", "cmake_find_package_multi" def build(self): cmake = CMake(self) diff --git a/recipes/pixman/config.yml b/recipes/pixman/config.yml index 055ba303907d4..c3e710db89855 100644 --- a/recipes/pixman/config.yml +++ b/recipes/pixman/config.yml @@ -1,5 +1,7 @@ -"versions": - "0.40.0": - "folder": "all" - "0.38.4": - "folder": "all" +versions: + "0.43.4": + folder: "all" + "0.43.0": + folder: "all" + "0.42.2": + folder: "all" diff --git a/recipes/pkgconf/all/conandata.yml b/recipes/pkgconf/all/conandata.yml index 7616abd9442f1..33c2bc45652a3 100644 --- a/recipes/pkgconf/all/conandata.yml +++ b/recipes/pkgconf/all/conandata.yml @@ -1,30 +1,47 @@ sources: + "2.2.0": + url: "https://distfiles.ariadne.space/pkgconf/pkgconf-2.2.0.tar.xz" + sha256: "b06ff63a83536aa8c2f6422fa80ad45e4833f590266feb14eaddfe1d4c853c69" + "2.1.0": + url: "https://distfiles.ariadne.space/pkgconf/pkgconf-2.1.0.tar.xz" + sha256: "266d5861ee51c52bc710293a1d36622ae16d048d71ec56034a02eb9cf9677761" + "2.0.3": + url: "https://distfiles.ariadne.space/pkgconf/pkgconf-2.0.3.tar.xz" + sha256: "cabdf3c474529854f7ccce8573c5ac68ad34a7e621037535cbc3981f6b23836c" + "2.0.2": + url: "https://distfiles.ariadne.space/pkgconf/pkgconf-2.0.2.tar.xz" + sha256: "ea5a25ef8f251eb5377ec0e21c75fb61894433cfbdbf0b2559ba33e4c2664401" + "1.9.5": + url: "https://distfiles.ariadne.space/pkgconf/pkgconf-1.9.5.tar.xz" + sha256: "1ac1656debb27497563036f7bffc281490f83f9b8457c0d60bcfb638fb6b6171" "1.9.3": - url: "https://distfiles.dereferenced.org/pkgconf/pkgconf-1.9.3.tar.xz" + url: "https://distfiles.ariadne.space/pkgconf/pkgconf-1.9.3.tar.xz" sha256: "5fb355b487d54fb6d341e4f18d4e2f7e813a6622cf03a9e87affa6a40565699d" "1.7.4": - url: "https://distfiles.dereferenced.org/pkgconf/pkgconf-1.7.4.tar.xz" + url: "https://distfiles.ariadne.space/pkgconf/pkgconf-1.7.4.tar.xz" sha256: "d73f32c248a4591139a6b17777c80d4deab6b414ec2b3d21d0a24be348c476ab" "1.7.3": - url: "https://distfiles.dereferenced.org/pkgconf/pkgconf-1.7.3.tar.xz" + url: "https://distfiles.ariadne.space/pkgconf/pkgconf-1.7.3.tar.xz" sha256: "b846aea51cf696c3392a0ae58bef93e2e72f8e7073ca6ad1ed8b01c85871f9c0" patches: + "2.2.0": + - patch_file: "patches/2.2.0-0001-PKG_CONF_PATH-allow-colon+semicolon-separator.patch" + "2.1.0": + - patch_file: "patches/2.1.0-0001-PKG_CONF_PATH-allow-colon+semicolon-separator.patch" + "2.0.3": + - patch_file: "patches/1.9.3-0003-PKG_CONF_PATH-allow-colon+semicolon-separator.patch" + "2.0.2": + - patch_file: "patches/1.9.3-0003-PKG_CONF_PATH-allow-colon+semicolon-separator.patch" + "1.9.5": + - patch_file: "patches/1.9.3-0003-PKG_CONF_PATH-allow-colon+semicolon-separator.patch" "1.9.3": - patch_file: "patches/1.9.3-0003-PKG_CONF_PATH-allow-colon+semicolon-separator.patch" - base_path: "source_subfolder" "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..673b980405e75 100644 --- a/recipes/pkgconf/all/conanfile.py +++ b/recipes/pkgconf/all/conanfile.py @@ -1,19 +1,24 @@ -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 + + +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 +31,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 +43,82 @@ 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 + self.options.rm_safe("fPIC") + + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("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") + def package_id(self): + if not self.info.options.enable_lib: + del self.info.settings.compiler def build_requirements(self): - self.build_requires("meson/0.62.1") + self.tool_requires("meson/1.2.2") 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], 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) + if Version(self.version) >= "1.9.4": + tc.project_options["tests"] = "disabled" + else: + 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"), - 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")) - def package_id(self): - if not self.options.enable_lib: - del self.info.settings.compiler + 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")) + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) 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: @@ -140,20 +128,18 @@ def package_info(self): self.cpp_info.libdirs = [] bindir = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH env var: {}".format(bindir)) self.env_info.PATH.append(bindir) exesuffix = ".exe" if self.settings.os == "Windows" else "" 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("\\", "/")) - 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? + 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: to remove in conan v2 once pkg_config generator removed - if self.options.enable_lib: - self.cpp_info.names["pkg_config"] = "libpkgconf" + # TODO: remove in conanv2 + automake_extra_includes = unix_path_package_info_legacy(self, pkgconf_aclocal.replace("\\", "/")) + self.env_info.PKG_CONFIG = pkg_config + self.env_info.AUTOMAKE_CONAN_INCLUDES.append(automake_extra_includes) diff --git a/recipes/pkgconf/all/patches/2.1.0-0001-PKG_CONF_PATH-allow-colon+semicolon-separator.patch b/recipes/pkgconf/all/patches/2.1.0-0001-PKG_CONF_PATH-allow-colon+semicolon-separator.patch new file mode 100644 index 0000000000000..ad4d094366b00 --- /dev/null +++ b/recipes/pkgconf/all/patches/2.1.0-0001-PKG_CONF_PATH-allow-colon+semicolon-separator.patch @@ -0,0 +1,11 @@ +--- libpkgconf/path.c ++++ libpkgconf/path.c +@@ -170,7 +170,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/patches/2.2.0-0001-PKG_CONF_PATH-allow-colon+semicolon-separator.patch b/recipes/pkgconf/all/patches/2.2.0-0001-PKG_CONF_PATH-allow-colon+semicolon-separator.patch new file mode 100644 index 0000000000000..344efd99da6e2 --- /dev/null +++ b/recipes/pkgconf/all/patches/2.2.0-0001-PKG_CONF_PATH-allow-colon+semicolon-separator.patch @@ -0,0 +1,11 @@ +--- libpkgconf/path.c ++++ libpkgconf/path.c +@@ -170,7 +170,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/CMakeLists.txt b/recipes/pkgconf/all/test_package/CMakeLists.txt deleted file mode 100644 index f8b971e2db377..0000000000000 --- a/recipes/pkgconf/all/test_package/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - -add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) diff --git a/recipes/pkgconf/all/test_package/conanfile.py b/recipes/pkgconf/all/test_package/conanfile.py index b2a27f28edf88..b2de624f38ef9 100644 --- a/recipes/pkgconf/all/test_package/conanfile.py +++ b/recipes/pkgconf/all/test_package/conanfile.py @@ -1,12 +1,19 @@ -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" @property @@ -14,43 +21,63 @@ 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, run=True) + + def layout(self): + cmake_layout(self, src_folder="src") + + def generate(self): + + # Expose `PKG_CONFIG_PATH` to be able to find libexample1.pc + env = Environment() + self.output.info(f"Source folder: {self.source_folder}") + env.prepend_path("PKG_CONFIG_PATH", self.source_folder) + env.vars(self, scope="run").save_script("pkgconf-config-path") - 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") + # 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() + # Check build environment postconditions + buildenv = VirtualBuildEnv(self) + env = buildenv.vars(scope='build') + assert 'PKG_CONFIG' in env.keys() + assert 'ACLOCAL_PATH' in env.keys() + assert 'AUTOMAKE_CONAN_INCLUDES' in env.keys() + buildenv.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: + 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 + if can_run(self): + output = StringIO() + self.run("pkgconf --about", output, env="conanrun") + # 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() + + self.run("pkgconf libexample1 -cflags", env="conanrun") + + # 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/configure.ac b/recipes/pkgconf/all/test_package/configure.ac deleted file mode 100644 index f9bf1936b8123..0000000000000 --- a/recipes/pkgconf/all/test_package/configure.ac +++ /dev/null @@ -1,9 +0,0 @@ -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([sdl2], - [echo "found SDL2 :D"], - [echo "SDL2 not found :("]) 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/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/config.yml b/recipes/pkgconf/config.yml index 9816b088e4d7b..369e560764ca3 100644 --- a/recipes/pkgconf/config.yml +++ b/recipes/pkgconf/config.yml @@ -1,4 +1,14 @@ versions: + "2.2.0": + folder: "all" + "2.1.0": + folder: "all" + "2.0.3": + folder: "all" + "2.0.2": + folder: "all" + "1.9.5": + folder: "all" "1.9.3": folder: "all" "1.7.4": diff --git a/recipes/platform.converters/all/conandata.yml b/recipes/platform.converters/all/conandata.yml index dbc2ae3eae699..f7a43902b2ca7 100644 --- a/recipes/platform.converters/all/conandata.yml +++ b/recipes/platform.converters/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.4.0": + url: "https://github.com/linksplatform/Converters/archive/csharp_0.4.0.tar.gz" + sha256: "dd55cff0c66fbb169d255d12e62c0ceba2e9d5c94921786871945c3a5c2d7357" "0.1.0": - url: https://github.com/linksplatform/Converters/archive/refs/tags/cpp_0.1.0.zip - sha256: a1a9e566b6628b1e09875f9ee93fb7fb600a8371d07e00a25c127e1609375d96 + url: "https://github.com/linksplatform/Converters/archive/refs/tags/cpp_0.1.0.zip" + sha256: "a1a9e566b6628b1e09875f9ee93fb7fb600a8371d07e00a25c127e1609375d96" diff --git a/recipes/platform.converters/all/conanfile.py b/recipes/platform.converters/all/conanfile.py index 4991da89bae2c..898832d2cd9d4 100644 --- a/recipes/platform.converters/all/conanfile.py +++ b/recipes/platform.converters/all/conanfile.py @@ -1,65 +1,71 @@ -from conans import ConanFile, CMake, 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.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 PlatformConvertersConan(ConanFile): name = "platform.converters" + description = ( + "platform.converters is one of the libraries of the LinksPlatform " + "modular framework, to provide conversions between different types" + ) license = "MIT" - homepage = "https://github.com/linksplatform/Converters" url = "https://github.com/conan-io/conan-center-index" - description = "platform.converters is one of the libraries of the LinksPlatform modular framework, " \ - "to provide conversions between different types" - topics = ("linksplatform", "cpp20", "converters", "any", "native") - settings = "compiler", "arch" - no_copy_source = True + homepage = "https://github.com/linksplatform/Converters" + topics = ("linksplatform", "cpp20", "converters", "any", "native", "header-only") - @property - def _source_subfolder(self): - return "source_subfolder" + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True @property - def _internal_cpp_subfolder(self): - return os.path.join(self._source_subfolder, "cpp", "Platform.Converters") + def _min_cppstd(self): + return 20 @property def _compilers_minimum_version(self): return { "gcc": "10", "Visual Studio": "16", + "msvc": "192", "clang": "14", - "apple-clang": "14" + "apple-clang": "14", } - @property - def _minimum_cpp_standard(self): - return 20 - - def validate(self): - minimum_version = self._compilers_minimum_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)) + def layout(self): + basic_layout(self, src_folder="src") - elif tools.Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration("{}/{} requires c++{}, " - "which is not supported by {} {}.".format( - self.name, self.version, self._minimum_cpp_standard, self.settings.compiler, - self.settings.compiler.version)) + 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) - def package_id(self): - self.info.header_only() + minimum_version = self._compilers_minimum_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." + ) 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 _internal_cpp_subfolder(self): + return os.path.join(self.source_folder, "cpp", "Platform.Converters") def package(self): - self.copy("*.h", dst="include", src=self._internal_cpp_subfolder) - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + copy(self, "*.h", dst=os.path.join(self.package_folder, "include"), src=self._internal_cpp_subfolder) + copy(self, "LICENSE", 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/platform.converters/all/test_package/CMakeLists.txt b/recipes/platform.converters/all/test_package/CMakeLists.txt index 80c8108b7c3f7..3372d3e73b186 100644 --- a/recipes/platform.converters/all/test_package/CMakeLists.txt +++ b/recipes/platform.converters/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(platform.converters CONFIG REQUIRED) +find_package(platform.converters REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} platform.converters::platform.converters) diff --git a/recipes/platform.converters/all/test_package/conanfile.py b/recipes/platform.converters/all/test_package/conanfile.py index 49a3a66ea5bad..ef5d7042163ec 100644 --- a/recipes/platform.converters/all/test_package/conanfile.py +++ b/recipes/platform.converters/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/platform.converters/all/test_package/test_package.cpp b/recipes/platform.converters/all/test_package/test_package.cpp index 283e7f59b558b..47a24cfe4903b 100644 --- a/recipes/platform.converters/all/test_package/test_package.cpp +++ b/recipes/platform.converters/all/test_package/test_package.cpp @@ -5,8 +5,8 @@ using namespace Platform::Converters; int main() { - int source {48}; + int source{48}; char to = Converter::Convert(source); - std::cout<<"int value: "< +#include +#include +#include +#include + #include #include diff --git a/recipes/platform.equality/all/test_v1_package/CMakeLists.txt b/recipes/platform.equality/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/platform.equality/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/platform.equality/all/test_v1_package/conanfile.py b/recipes/platform.equality/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..49a3a66ea5bad --- /dev/null +++ b/recipes/platform.equality/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/platform.exceptions/all/conandata.yml b/recipes/platform.exceptions/all/conandata.yml index 9d13e79d6d995..cf054ea78bcab 100644 --- a/recipes/platform.exceptions/all/conandata.yml +++ b/recipes/platform.exceptions/all/conandata.yml @@ -1,7 +1,10 @@ sources: - "0.2.0": - url: https://github.com/linksplatform/Exceptions/archive/refs/tags/0.4.0_0.2.0.zip - sha256: 9e4513da667e41f0bbe776123747ac63958972edb00eaee300c495ae3b39eb9b - "0.3.0": - url: https://github.com/linksplatform/Exceptions/archive/refs/tags/cpp_0.3.0.zip - sha256: 08506f334098e8c9106ff357efd7f68b83a3c1f4dc03b6b97b6229b14737d0ce + "0.5.0": + url: "https://github.com/linksplatform/Exceptions/archive/csharp_0.5.0.tar.gz" + sha256: "5fbdd49adf7840431a581d0bfe61a5d247398a1fe622101b3985714d11d411f4" + "0.3.2": + url: "https://github.com/linksplatform/Exceptions/archive/refs/tags/cpp_0.3.2.tar.gz" + sha256: "f2d3af59fd66ef47f93557a2b64d0c8e7a1a0cd033f0e3ae2f09153f81117f71" + "0.2.1": + url: "https://github.com/linksplatform/Exceptions/archive/refs/tags/cpp_0.2.1.tar.gz" + sha256: "9e31f6162cd226a4be3eb0e263b8c1c00e5de1fb41575d4d19207e9ff55f2687" diff --git a/recipes/platform.exceptions/all/conanfile.py b/recipes/platform.exceptions/all/conanfile.py index e352e58aa4f01..28942c0367e11 100644 --- a/recipes/platform.exceptions/all/conanfile.py +++ b/recipes/platform.exceptions/all/conanfile.py @@ -1,28 +1,34 @@ -from conans import ConanFile, CMake, 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.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.52.0" class PlatformExceptionsConan(ConanFile): name = "platform.exceptions" + description = "platform.exceptions is one of the libraries of the LinksPlatform modular framework, to ensure exceptions" license = "MIT" - homepage = "https://github.com/linksplatform/Exceptions" url = "https://github.com/conan-io/conan-center-index" - description = "platform.exceptions is one of the libraries of the LinksPlatform modular framework, " \ - "to ensure exceptions" - topics = ("linksplatform", "cpp20", "exceptions", "any", "ranges", "native") - settings = "compiler", "arch" + homepage = "https://github.com/linksplatform/Exceptions" + topics = ("linksplatform", "cpp20", "exceptions", "any", "ranges", "native", "header-only") + + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True @property - def _source_subfolder(self): - return "source_subfolder" + def _minimum_cpp_standard(self): + return 20 @property def _internal_cpp_subfolder(self): - return os.path.join(self._source_subfolder, "cpp", "Platform.Exceptions") + return os.path.join(self.source_folder, "cpp", "Platform.Exceptions") @property def _compilers_minimum_version(self): @@ -30,42 +36,47 @@ def _compilers_minimum_version(self): "gcc": "10", "Visual Studio": "16", "clang": "11", - "apple-clang": "11" + "apple-clang": "11", } - @property - def _minimum_cpp_standard(self): - return 20 + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - if tools.Version(self.version) >= "0.3.0": - self.requires("platform.delegates/0.2.7") + if Version(self.version) >= "0.3.0": + self.requires("platform.delegates/0.3.7") else: self.requires("platform.delegates/0.1.3") + def package_id(self): + self.info.clear() + def validate(self): minimum_version = self._compilers_minimum_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)) + self.output.warning(f"{self.name} recipe lacks information about the {self.settings.compiler} compiler support.") - elif tools.Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration("{}/{} requires c++{}, " - "which is not supported by {} {}.".format( - self.name, self.version, self._minimum_cpp_standard, self.settings.compiler, - self.settings.compiler.version)) + elif Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.name}/{self.version} requires c++{self._minimum_cpp_standard}, which is not supported" + f" by {self.settings.compiler} {self.settings.compiler.version}." + ) if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, self._minimum_cpp_standard) - - def package_id(self): - self.info.header_only() + 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("*.h", dst="include", src=self._internal_cpp_subfolder) - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + copy(self, "*.h", + dst=os.path.join(self.package_folder, "include"), + src=self._internal_cpp_subfolder) + copy(self, "LICENSE", + 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/platform.exceptions/all/test_package/CMakeLists.txt b/recipes/platform.exceptions/all/test_package/CMakeLists.txt index dadfcbe5ecf0a..a63090495da9c 100644 --- a/recipes/platform.exceptions/all/test_package/CMakeLists.txt +++ b/recipes/platform.exceptions/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(platform.exceptions REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE platform.exceptions::platform.exceptions) set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 20) diff --git a/recipes/platform.exceptions/all/test_package/conanfile.py b/recipes/platform.exceptions/all/test_package/conanfile.py index d4128b0450777..ef5d7042163ec 100644 --- a/recipes/platform.exceptions/all/test_package/conanfile.py +++ b/recipes/platform.exceptions/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): - bin_path = os.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/platform.exceptions/all/test_v1_package/CMakeLists.txt b/recipes/platform.exceptions/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/platform.exceptions/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/platform.exceptions/all/test_v1_package/conanfile.py b/recipes/platform.exceptions/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..49a3a66ea5bad --- /dev/null +++ b/recipes/platform.exceptions/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/platform.exceptions/config.yml b/recipes/platform.exceptions/config.yml index 0906286bf1225..7914985fc71b1 100644 --- a/recipes/platform.exceptions/config.yml +++ b/recipes/platform.exceptions/config.yml @@ -1,5 +1,7 @@ versions: - "0.2.0": + "0.5.0": folder: all - "0.3.0": + "0.3.2": + folder: all + "0.2.1": folder: all diff --git a/recipes/platform.hashing/all/conandata.yml b/recipes/platform.hashing/all/conandata.yml index 82435a6d7e4a8..f7e585564ab8a 100644 --- a/recipes/platform.hashing/all/conandata.yml +++ b/recipes/platform.hashing/all/conandata.yml @@ -1,10 +1,16 @@ sources: - "0.2.0": - url: https://github.com/linksplatform/Hashing/archive/refs/tags/0.2.0.zip - sha256: 8e34a10d2768d0f2d9ba0cbb88ce193b32245c5a46f14f7ec860c9fddbe8f39f - "0.3.0": - url: https://github.com/linksplatform/Hashing/archive/refs/tags/cpp_0.3.0.zip - sha256: 8f7d6d401eaec1a78d1f10bfa3783b31ac6189a6ea8edf1ef7f300c47c0e5cb1 + "0.5.6": + url: "https://github.com/linksplatform/Hashing/archive/refs/tags/cpp_0.5.6.tar.gz" + sha256: "b387d772750eea2187ca7ca0651ddd701e8f2ef6eb8d86a6f8dfda00193a4123" + "0.5.5": + url: "https://github.com/linksplatform/Hashing/archive/refs/tags/cpp_0.5.5.tar.gz" + sha256: "8155f1d0b18cfdad7b93f6c41aaabbe655c9f7ce6bfddb10eae86156cbff02cf" "0.4.0": - url: https://github.com/linksplatform/Hashing/archive/refs/tags/cpp_0.4.0.zip - sha256: afb8a27a483f636515ca4289f2bfa80fbd37c8416631f0b3ff7001d17a054320 + url: "https://github.com/linksplatform/Hashing/archive/refs/tags/cpp_0.4.0.zip" + sha256: "afb8a27a483f636515ca4289f2bfa80fbd37c8416631f0b3ff7001d17a054320" + "0.3.0": + url: "https://github.com/linksplatform/Hashing/archive/refs/tags/cpp_0.3.0.zip" + sha256: "8f7d6d401eaec1a78d1f10bfa3783b31ac6189a6ea8edf1ef7f300c47c0e5cb1" + "0.2.0": + url: "https://github.com/linksplatform/Hashing/archive/refs/tags/0.2.0.zip" + sha256: "8e34a10d2768d0f2d9ba0cbb88ce193b32245c5a46f14f7ec860c9fddbe8f39f" diff --git a/recipes/platform.hashing/all/conanfile.py b/recipes/platform.hashing/all/conanfile.py index 7e465451b8a23..0e0affe79e746 100644 --- a/recipes/platform.hashing/all/conanfile.py +++ b/recipes/platform.hashing/all/conanfile.py @@ -1,91 +1,107 @@ from conan import ConanFile -try: - from conan.tools.build import check_min_cppstd -except ImportError: - from conans.tools import check_min_cppstd # FIXME : not in 1.49 -from conan.tools.files import get -from conan.tools.scm import Version 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 PlatformInterfacesConan(ConanFile): name = "platform.hashing" - license = "LGPL-3.0-only" - homepage = "https://github.com/linksplatform/Hashing" - url = "https://github.com/conan-io/conan-center-index" description = "platform.hashing is one of the libraries of the LinksPlatform modular framework, " \ "which contains std::hash specializations for:\n" \ " - trivial and standard-layout types\n" \ " - types constrained by std::ranges::range\n" \ " - std::any" - topics = ("linksplatform", "cpp20", "hashing", "any", "ranges", "native") - settings = "compiler", "arch" + license = "LGPL-3.0-only" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/linksplatform/Hashing" + topics = ("linksplatform", "cpp20", "hashing", "any", "ranges", "native", "header-only") + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True @property - def _source_subfolder(self): - return "source_subfolder" + def _internal_cpp_subfolder(self): + return os.path.join(self.source_folder, "cpp", "Platform.Hashing") @property - def _internal_cpp_subfolder(self): - return os.path.join(self._source_subfolder, "cpp", "Platform.Hashing") + def _min_cppstd(self): + return 20 @property def _compilers_minimum_version(self): return { "gcc": "10", "Visual Studio": "16", + "msvc": "192", "clang": "14", "apple-clang": "14" } - @property - def _minimum_cpp_standard(self): - return 20 - - def validate(self): - minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler)) + def layout(self): + basic_layout(self, src_folder="src") - if not minimum_version: - self.output.warn("{} recipe lacks information about the {} compiler support.".format( - self.name, self.settings.compiler)) + def requirements(self): + if Version(self.version) >= "0.5.6": + self.requires("cpuinfo/cci.20220228", transitive_headers=True) + elif Version(self.version) >= "0.5.0": + self.requires("cpu_features/0.9.0", transitive_headers=True) - elif Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration("{}/{} requires c++{}, " - "which is not supported by {} {}.".format( - self.name, self.version, self._minimum_cpp_standard, 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, self._minimum_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." + ) if self.settings.arch in ("x86", ): - raise ConanInvalidConfiguration("{} does not support arch={}".format(self.name, self.settings.arch)) - - def package_id(self): - self.info.header_only() + raise ConanInvalidConfiguration(f"{self.ref} does not support arch={self.settings.arch}") 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 package(self): - self.copy("*.h", dst="include", src=self._internal_cpp_subfolder) - 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 + ) + copy( + self, + pattern="*.h", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "cpp", "Platform.Hashing") + ) def package_info(self): self.cpp_info.libdirs = [] - suggested_flags = "" - if self.settings.compiler != "Visual Studio": + self.cpp_info.bindirs = [] + if is_msvc(self): + if Version(self.version) >= "0.5.0": + arch_macros = { + "x86_64": "_X86_64_", + "armv8": "_AARCH_", + }.get(str(self.settings.arch), "") + self.cpp_info.defines.append(arch_macros) + else: suggested_flags = { "x86_64": "-march=haswell", "armv7": "-march=armv7", "armv8": "-march=armv8-a", }.get(str(self.settings.arch), "") - self.user_info.suggested_flags = suggested_flags + self.conf_info.define("user.platform_hashing:suggested_flags", suggested_flags) - if "-march" not in "{} {}".format(os.environ.get("CPPFLAGS", ""), os.environ.get("CXXFLAGS", "")): - self.output.warn("platform.hashing needs to have `-march=ARCH` added to CPPFLAGS/CXXFLAGS. " - "A suggestion is available in deps_user_info[{name}].suggested_flags.".format(name=self.name)) + if "-march" not in "{} {}".format(os.environ.get("CPPFLAGS", ""), os.environ.get("CXXFLAGS", "")): + self.output.warning("platform.hashing needs to have `-march=ARCH` added to CPPFLAGS/CXXFLAGS. " + f"A suggestion is available in dependencies[{self.name}].conf_info.get(\"user.platform_hashing:suggested_flags\")") diff --git a/recipes/platform.hashing/all/test_package/CMakeLists.txt b/recipes/platform.hashing/all/test_package/CMakeLists.txt index f3ca06da8ddf9..bbee5010aae03 100644 --- a/recipes/platform.hashing/all/test_package/CMakeLists.txt +++ b/recipes/platform.hashing/all/test_package/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package CXX) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) set(EXTRA_FLAGS "" CACHE STRING "Extra compiler flags") separate_arguments(EXTRA_FLAGS UNIX_COMMAND ${EXTRA_FLAGS}) @@ -7,9 +7,8 @@ if(EXTRA_FLAGS) add_compile_options(${EXTRA_FLAGS}) endif() -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(platform.hashing REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) -set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 20) +target_link_libraries(${PROJECT_NAME} PRIVATE platform.hashing::platform.hashing) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) diff --git a/recipes/platform.hashing/all/test_package/conanfile.py b/recipes/platform.hashing/all/test_package/conanfile.py index ef7d3547638fa..f5e26207308c7 100644 --- a/recipes/platform.hashing/all/test_package/conanfile.py +++ b/recipes/platform.hashing/all/test_package/conanfile.py @@ -1,28 +1,38 @@ -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, CMakeToolchain, CMakeDeps +from conan.tools.microsoft import is_msvc import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + test_type = "explicit" @property def _extra_flags(self): - return self.deps_user_info["platform.hashing"].suggested_flags + return self.dependencies["platform.hashing"].conf_info.get("user.platform_hashing:suggested_flags", check_type=str) - def build(self): - if self.settings.compiler != "Visual Studio": - if not self._extra_flags: - raise ConanException("Suggested flags are not available for os={}/arch={}".format(self.settings.os, self.settings.arch)) + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + def generate(self): + tc = CMakeToolchain(self) + if not is_msvc(self): + tc.variables["EXTRA_FLAGS"] = self._extra_flags + tc.generate() + deps = CMakeDeps(self) + deps.generate() + + def build(self): cmake = CMake(self) - if self.settings.compiler != "Visual Studio": - cmake.definitions["EXTRA_FLAGS"] = self._extra_flags cmake.configure() cmake.build() 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/platform.hashing/config.yml b/recipes/platform.hashing/config.yml index ee25f0e067a38..4a9a6395456f8 100644 --- a/recipes/platform.hashing/config.yml +++ b/recipes/platform.hashing/config.yml @@ -1,7 +1,11 @@ versions: - "0.2.0": + "0.5.6": folder: all - "0.3.0": + "0.5.5": folder: all "0.4.0": folder: all + "0.3.0": + folder: all + "0.2.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/platformfolders/all/conandata.yml b/recipes/platformfolders/all/conandata.yml new file mode 100644 index 0000000000000..be79160f2c84f --- /dev/null +++ b/recipes/platformfolders/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "4.2.0": + url: "https://github.com/sago007/PlatformFolders/archive/refs/tags/4.2.0.tar.gz" + sha256: "31bb0f64a27315aec8994f226332aaafe9888d00bb69a2ff2dff9912e2f4ccf4" diff --git a/recipes/platformfolders/all/conanfile.py b/recipes/platformfolders/all/conanfile.py new file mode 100644 index 0000000000000..e9a661cbf1d78 --- /dev/null +++ b/recipes/platformfolders/all/conanfile.py @@ -0,0 +1,82 @@ +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout +from conan.tools.files import copy, get, rmdir +from conan.tools.microsoft import is_msvc +from conan.errors import ConanInvalidConfiguration +import os + +required_conan_version = ">=1.53.0" + + +class PlatformFoldersConan(ConanFile): + name = "platformfolders" + license = "MIT" + homepage = "https://github.com/sago007/PlatformFolders" + url = "https://github.com/conan-io/conan-center-index" + description = "A C++ library to look for special directories like My Documents and APPDATA so that you do not need to write Linux, Windows or Mac OS X specific code" + topics = ("multi-platform", "xdg", "standardpaths", "special-folders") + package_type = "library" + 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 validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._minimum_cpp_standard) + + 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 is_msvc(self): + self.package_type = "static-library" + del self.options.shared + + 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["PLATFORMFOLDERS_BUILD_TESTING"] = False + tc.variables["PLATFORMFOLDERS_BUILD_SHARED_LIBS"] = self.options.get_safe("shared", default=False) + tc.variables["PLATFORMFOLDERS_ENABLE_INSTALL"] = 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, "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + + def package_info(self): + self.cpp_info.libs = ["platform_folders"] + self.cpp_info.set_property("cmake_file_name", "platform_folders") + self.cpp_info.set_property("cmake_target_name", "sago::platform_folders") + self.cpp_info.set_property("cmake_target_aliases", ["platform_folders"]) + + if self.settings.os in ("Linux", "FreeBSD"): + self.cpp_info.system_libs.append("m") diff --git a/recipes/platformfolders/all/test_package/CMakeLists.txt b/recipes/platformfolders/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..c75dde66e6a67 --- /dev/null +++ b/recipes/platformfolders/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(platform_folders REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE sago::platform_folders) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/platformfolders/all/test_package/conanfile.py b/recipes/platformfolders/all/test_package/conanfile.py new file mode 100644 index 0000000000000..b8c7713c1ed31 --- /dev/null +++ b/recipes/platformfolders/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +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): + self.run(os.path.join(self.cpp.build.bindirs[0], "test_package"), env="conanrun") diff --git a/recipes/platformfolders/all/test_package/test_package.cpp b/recipes/platformfolders/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..4570e8f5de608 --- /dev/null +++ b/recipes/platformfolders/all/test_package/test_package.cpp @@ -0,0 +1,20 @@ +#include +#include + +#include + +int main() { + std::cout << "Config: " << sago::getConfigHome() << "\n"; + std::cout << "Data: " << sago::getDataHome() << "\n"; + std::cout << "State: " << sago::getStateDir() << "\n"; + std::cout << "Cache: " << sago::getCacheDir() << "\n"; + std::cout << "Documents: " << sago::getDocumentsFolder() << "\n"; + std::cout << "Desktop: " << sago::getDesktopFolder() << "\n"; + std::cout << "Pictures: " << sago::getPicturesFolder() << "\n"; + std::cout << "Music: " << sago::getMusicFolder() << "\n"; + std::cout << "Video: " << sago::getVideoFolder() << "\n"; + std::cout << "Download: " << sago::getDownloadFolder() << "\n"; + std::cout << "Save Games 1: " << sago::getSaveGamesFolder1() << "\n"; + std::cout << "Save Games 2: " << sago::getSaveGamesFolder2() << "\n"; + return 0; +} diff --git a/recipes/platformfolders/config.yml b/recipes/platformfolders/config.yml new file mode 100644 index 0000000000000..1b309b8e878d8 --- /dev/null +++ b/recipes/platformfolders/config.yml @@ -0,0 +1,3 @@ +versions: + "4.2.0": + folder: "all" diff --git a/recipes/playrho/all/CMakeLists.txt b/recipes/playrho/all/CMakeLists.txt deleted file mode 100644 index 7d5ba25565b0a..0000000000000 --- a/recipes/playrho/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/playrho/all/conandata.yml b/recipes/playrho/all/conandata.yml index 03bf919319da8..93527003a275f 100644 --- a/recipes/playrho/all/conandata.yml +++ b/recipes/playrho/all/conandata.yml @@ -1,9 +1,10 @@ sources: + "1.1.2": + url: "https://github.com/louis-langholtz/PlayRho/archive/refs/tags/v1.1.2.tar.gz" + sha256: "b8e61eace48607c545a495c742479fb58e7ea34b8dfe7f874a14b8414135cccc" "1.1.0": url: "https://github.com/louis-langholtz/PlayRho/archive/refs/tags/v1.1.0.tar.gz" sha256: "45c0337440387a85a97a4b7907b79f780233bf2062635471b71a32245b0c0158" - patches: "1.1.0": - patch_file: "patches/1.1.0-0001-fix-target-name.patch" - base_path: "source_subfolder" diff --git a/recipes/playrho/all/conanfile.py b/recipes/playrho/all/conanfile.py index 9aab4b29f12b3..57ba703a4b37c 100644 --- a/recipes/playrho/all/conanfile.py +++ b/recipes/playrho/all/conanfile.py @@ -1,9 +1,15 @@ -from conans import ConanFile, CMake, tools -from conans.tools import ConanInvalidConfiguration import os -import functools -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.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, rename +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" + class PlayrhoConan(ConanFile): name = "playrho" @@ -12,25 +18,34 @@ class PlayrhoConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/louis-langholtz/PlayRho/" topics = ("physics-engine", "collision-detection", "box2d") + + 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, } - generators = "cmake" @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return "17" + + @property + def _compilers_minimum_versions(self): + return { + "gcc": "8", + "clang": "7", + "apple-clang": "12", + "msvc": "192", + "Visual Studio": "16", + } 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,54 +53,51 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") - @property - def _compilers_minimum_versions(self): - return { - "gcc": "8", - "Visual Studio": "16", - "clang": "7", - "apple-clang": "12", - } + 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) - compilers_minimum_version = self._compilers_minimum_versions - 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++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)) + minimum_version = self._compilers_minimum_versions.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 build_requirements(self): + self.tool_requires("cmake/[>=3.16.3 <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], strip_root=True) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["PLAYRHO_BUILD_SHARED"] = self.options.shared - cmake.definitions["PLAYRHO_BUILD_STATIC"] = not self.options.shared - cmake.definitions["PLAYRHO_INSTALL"] = True - cmake.configure() - return cmake + def generate(self): + VirtualBuildEnv(self).generate() + + tc = CMakeToolchain(self) + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + tc.variables["PLAYRHO_BUILD_SHARED"] = self.options.shared + tc.variables["PLAYRHO_BUILD_STATIC"] = not self.options.shared + tc.variables["PLAYRHO_INSTALL"] = 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(pattern="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")) - tools.rmdir(os.path.join(self.package_folder, "lib", "PlayRho")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "PlayRho")) def package_info(self): self.cpp_info.libs = ["PlayRho"] diff --git a/recipes/playrho/all/test_package/CMakeLists.txt b/recipes/playrho/all/test_package/CMakeLists.txt index cf755d3555681..6486eec980147 100644 --- a/recipes/playrho/all/test_package/CMakeLists.txt +++ b/recipes/playrho/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(PlayRho REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/playrho/all/test_package/conanfile.py b/recipes/playrho/all/test_package/conanfile.py index 61ac8b9318290..ef5d7042163ec 100644 --- a/recipes/playrho/all/test_package/conanfile.py +++ b/recipes/playrho/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 -from conan.tools.build import cross_building -class PlayrhoTestConan(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 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/playrho/all/test_v1_package/CMakeLists.txt b/recipes/playrho/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/playrho/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/playrho/all/test_v1_package/conanfile.py b/recipes/playrho/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..61ac8b9318290 --- /dev/null +++ b/recipes/playrho/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +import os + +from conans import ConanFile, CMake, tools +from conan.tools.build import cross_building + +class PlayrhoTestConan(ConanFile): + settings = "os", "arch", "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/playrho/config.yml b/recipes/playrho/config.yml index 11b7aff3a5ac4..0108ac3e087d5 100644 --- a/recipes/playrho/config.yml +++ b/recipes/playrho/config.yml @@ -1,3 +1,5 @@ versions: + "1.1.2": + folder: "all" "1.1.0": folder: "all" diff --git a/recipes/plf_colony/all/conandata.yml b/recipes/plf_colony/all/conandata.yml index 273a9af551ece..796a27e497755 100644 --- a/recipes/plf_colony/all/conandata.yml +++ b/recipes/plf_colony/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "7.39": + url: "https://github.com/mattreecebentley/plf_colony/archive/5bb011979a33ee29b4c57ee6a7813a22efc419b7.tar.gz" + sha256: "15812bbd5899d6845d9aeb38ecc6b2884e221326516496a76ebbcc2fb7c3f48b" + "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" @@ -8,3 +14,16 @@ sources: "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 934e8ec85091c..36d026c86b004 100644 --- a/recipes/plf_colony/config.yml +++ b/recipes/plf_colony/config.yml @@ -1,4 +1,8 @@ versions: + "7.39": + folder: all + "7.06": + folder: all "7.03": folder: all "7.00": diff --git a/recipes/plf_indiesort/all/conandata.yml b/recipes/plf_indiesort/all/conandata.yml index 52221cecba4f6..9638aa153a749 100644 --- a/recipes/plf_indiesort/all/conandata.yml +++ b/recipes/plf_indiesort/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "1.41": + url: "https://github.com/mattreecebentley/plf_indiesort/archive/fce3d54ed1a43e9e7008703f79c4f4d2e5259176.tar.gz" + sha256: "34cca5e0a20f278dfcd963d18653b9440b1b590f5f193d0e68115f5a1a80bf6f" + "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..473415a4e082f 100644 --- a/recipes/plf_indiesort/config.yml +++ b/recipes/plf_indiesort/config.yml @@ -1,3 +1,7 @@ versions: + "1.41": + folder: all + "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 0df661a8bd89c..6f1a0b798e6f8 100644 --- a/recipes/plf_list/all/conandata.yml +++ b/recipes/plf_list/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "2.70": + url: "https://github.com/mattreecebentley/plf_list/archive/c48d271caad535a783a37e418e1f146040934a30.tar.gz" + sha256: "d6bd1dfb4e7e02804ad91c5a06c9d6f3a3512499ce5c3c0a633eba5e67e90930" + "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" @@ -8,3 +14,16 @@ sources: "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..a5286712197f8 100644 --- a/recipes/plf_list/all/conanfile.py +++ b/recipes/plf_list/all/conanfile.py @@ -1,8 +1,12 @@ from conan import ConanFile -from conan.tools.files import copy, get +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.layout import basic_layout +from conan.tools.scm import Version import os + required_conan_version = ">=1.50.0" @@ -10,11 +14,27 @@ 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 + + @property + def _min_cppstd(self): + return 17 + + @property + def _minimum_compilers_version(self): + return { + "gcc": "7", + "clang": "5", + "apple-clang": "9", + "msvc": "191", + "Visual Studio": "15", + } + + def export_sources(self): + export_conandata_patches(self) def package_id(self): self.info.clear() @@ -22,12 +42,21 @@ def package_id(self): def layout(self): basic_layout(self, src_folder="src") + def validate(self): + if Version(self.version) >= "2.70": + 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): - 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 + 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_package/CMakeLists.txt b/recipes/plf_list/all/test_package/CMakeLists.txt index 9871eca4a6f1f..0ca253af213ab 100644 --- a/recipes/plf_list/all/test_package/CMakeLists.txt +++ b/recipes/plf_list/all/test_package/CMakeLists.txt @@ -5,3 +5,6 @@ find_package(plf_list REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE plf_list::plf_list) +if (plf_list_VERSION VERSION_GREATER_EQUAL 2.70) + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +endif() 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 15af51efc0240..2dc3d36de7cf2 100644 --- a/recipes/plf_list/config.yml +++ b/recipes/plf_list/config.yml @@ -1,4 +1,8 @@ versions: + "2.70": + folder: all + "2.57": + folder: all "2.52": folder: all "2.50": diff --git a/recipes/plf_queue/all/conandata.yml b/recipes/plf_queue/all/conandata.yml index c0640bf1dd909..70bc260cc9892 100644 --- a/recipes/plf_queue/all/conandata.yml +++ b/recipes/plf_queue/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "2.0.2": + url: "https://github.com/mattreecebentley/plf_queue/archive/1fb9d87a210f7813450ee54a469f9f79ea4ec872.tar.gz" + sha256: "812976e4ebc50556891590e1ba066fbe7b73518749e86bbe227428152a3820c8" + "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" 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 229075fd3b93f..35e06c7f4e645 100644 --- a/recipes/plf_queue/config.yml +++ b/recipes/plf_queue/config.yml @@ -1,4 +1,8 @@ versions: + "2.0.2": + folder: all + "1.22": + folder: all "1.21": folder: all "1.19": diff --git a/recipes/plf_stack/all/conandata.yml b/recipes/plf_stack/all/conandata.yml index 3ddc3129ad01e..033e21f0986b6 100644 --- a/recipes/plf_stack/all/conandata.yml +++ b/recipes/plf_stack/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "2.0.1": + url: "https://github.com/mattreecebentley/plf_stack/archive/9d11bf2c5de5df739c0943af942a544c95b26ffa.tar.gz" + sha256: "2dd0092fbfc1e3d071398c6ef35cede807b4774fddfd892401f432e7d9efcc5b" + "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" 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 268e17f1a2972..d955d60d65ed1 100644 --- a/recipes/plf_stack/config.yml +++ b/recipes/plf_stack/config.yml @@ -1,4 +1,8 @@ versions: + "2.0.1": + folder: all + "1.64": + folder: all "1.63": folder: all "1.60": diff --git a/recipes/plog/all/conandata.yml b/recipes/plog/all/conandata.yml index 62dac8352bca6..d1c46d7ff154b 100644 --- a/recipes/plog/all/conandata.yml +++ b/recipes/plog/all/conandata.yml @@ -1,5 +1,10 @@ sources: + "1.1.10": + url: "https://github.com/SergiusTheBest/plog/archive/1.1.10.tar.gz" + sha256: "55a090fc2b46ab44d0dde562a91fe5fc15445a3caedfaedda89fe3925da4705a" + "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..5526e402261bc 100644 --- a/recipes/plog/config.yml +++ b/recipes/plog/config.yml @@ -1,3 +1,7 @@ versions: + "1.1.10": + folder: all + "1.1.9": + folder: all "1.1.5": folder: all diff --git a/recipes/plusaes/all/conandata.yml b/recipes/plusaes/all/conandata.yml index 539b28539b874..595f0e1a79d21 100644 --- a/recipes/plusaes/all/conandata.yml +++ b/recipes/plusaes/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.0.0": + url: "https://github.com/kkAyataka/plusaes/archive/refs/tags/v1.0.0.tar.gz" + sha256: "0e33e8d0e2ea5e6f9eb7a06093f576350ce8ef58339ce9de791514a8f433087d" "0.10.0": url: "https://github.com/kkAyataka/plusaes/archive/refs/tags/v0.10.0.tar.gz" sha256: "092d64f372f5b732c8e35ab8f1049d4c6ef2eaa4c6ababc56b541b26f4095e51" diff --git a/recipes/plusaes/all/conanfile.py b/recipes/plusaes/all/conanfile.py index 5d1248265e161..c073789122310 100644 --- a/recipes/plusaes/all/conanfile.py +++ b/recipes/plusaes/all/conanfile.py @@ -1,35 +1,48 @@ -from conans import ConanFile, tools import os -required_conan_version = ">=1.33.0" +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 + +required_conan_version = ">=1.52.0" + class PlusaesConan(ConanFile): name = "plusaes" description = "Header only C++ AES cipher library" - topics = ("encryption", "header-only") license = "BSL-1.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/kkAyataka/plusaes" + topics = ("encryption", "header-only") + + package_type = "header-library" 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.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, 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 package(self): - root_dir = self._source_subfolder + root_dir = self.source_folder include_dir = os.path.join(root_dir, "include") - self.copy(pattern="LICENSE_1_0.txt", dst="licenses", src=root_dir) - self.copy(pattern="*plusaes.hpp", dst="include", src=include_dir) + copy(self, "LICENSE_1_0.txt", dst=os.path.join(self.package_folder, "licenses"), src=root_dir) + copy(self, "*plusaes.hpp", dst=os.path.join(self.package_folder, "include"), src=include_dir) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/plusaes/all/test_package/CMakeLists.txt b/recipes/plusaes/all/test_package/CMakeLists.txt index 0a4d2fae5c706..8b5b4793ec8d8 100644 --- a/recipes/plusaes/all/test_package/CMakeLists.txt +++ b/recipes/plusaes/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.15) +project(test_package LANGUAGES CXX) find_package(plusaes REQUIRED CONFIG) diff --git a/recipes/plusaes/all/test_package/conanfile.py b/recipes/plusaes/all/test_package/conanfile.py index a500b98343c74..ef5d7042163ec 100644 --- a/recipes/plusaes/all/test_package/conanfile.py +++ b/recipes/plusaes/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", "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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/plusaes/all/test_v1_package/CMakeLists.txt b/recipes/plusaes/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/plusaes/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/plusaes/all/test_v1_package/conanfile.py b/recipes/plusaes/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..a500b98343c74 --- /dev/null +++ b/recipes/plusaes/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/plusaes/config.yml b/recipes/plusaes/config.yml index 1b582dcf6716b..f5fa9d899d244 100644 --- a/recipes/plusaes/config.yml +++ b/recipes/plusaes/config.yml @@ -1,3 +1,5 @@ versions: + "1.0.0": + folder: all "0.10.0": folder: all diff --git a/recipes/plutovg/all/conandata.yml b/recipes/plutovg/all/conandata.yml index dbcdf0e92b441..e2c28aa740d01 100644 --- a/recipes/plutovg/all/conandata.yml +++ b/recipes/plutovg/all/conandata.yml @@ -1,7 +1,24 @@ 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" + "0.0.8": + url: "https://github.com/sammycage/plutovg/archive/refs/tags/v0.0.8.tar.gz" + sha256: "090dd5d38e04e0900bf6843b2b38ce7108cab815c1b5496c934af65c51965618" + "0.0.7": + url: "https://github.com/sammycage/plutovg/archive/refs/tags/v0.0.7.tar.gz" + sha256: "31e264b6f451a0d18335d1596817c2b7f58e2fc6efeb63aac0ff9a7fbfc07c00" + "0.0.6": + url: "https://github.com/sammycage/plutovg/archive/refs/tags/v0.0.6.tar.gz" + sha256: "3be0e0d94ade3e739f60ac075c88c2e40d84a0ac05fc3ff8c7c97d0749e9a82b" + "0.0.5": + url: "https://github.com/sammycage/plutovg/archive/refs/tags/v0.0.5.tar.gz" + sha256: "bcc4301f1591d8b4172b7ca086fb9a2b250727848f5f30af4c625f043512ce10" + "0.0.4": + url: "https://github.com/sammycage/plutovg/archive/refs/tags/v0.0.4.tar.gz" + sha256: "6d7c6ad1ef3cf0085e0a375b770590a8cea79d4754b732e892635639c5546076" + "0.0.1": + url: "https://github.com/sammycage/plutovg/archive/refs/tags/v0.0.1.tar.gz" + sha256: "593653d226dd54dc322bc0874c19bd0a80314b5471ae4da6b9cd9e12211e3261" +patches: + "0.0.1": + - patch_file: "patches/0.0.1-0001-include-stdint.patch" + patch_description: "include stdint.h" + patch_type: "portability" diff --git a/recipes/plutovg/all/conanfile.py b/recipes/plutovg/all/conanfile.py index 13289c4f9dd84..be43bdb8956f4 100644 --- a/recipes/plutovg/all/conanfile.py +++ b/recipes/plutovg/all/conanfile.py @@ -1,19 +1,23 @@ from conan import ConanFile -from conan.tools.files import get, copy, replace_in_file -from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout - +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, rename +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 import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class PlutoVGConan(ConanFile): name = "plutovg" description = "Tiny 2D vector graphics library in C" + license = "MIT", topics = ("vector", "graphics", ) url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/sammycage/plutovg" - license = "MIT", - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -24,55 +28,65 @@ class PlutoVGConan(ConanFile): "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: - 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 + 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") + basic_layout(self, src_folder="src") + + def build_requirements(self): + self.tool_requires("meson/[>=1.2.3 <2]") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/2.0.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): - tc = CMakeToolchain(self) - tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + tc = MesonToolchain(self) + tc.project_options["examples"] = "disabled" + tc.project_options["tests"] = "disabled" + tc.generate() + tc = PkgConfigDeps(self) + tc.generate() + tc = VirtualBuildEnv(self) tc.generate() def build(self): - replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), - "add_library(plutovg STATIC)", "add_library(plutovg)") - replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), - "add_subdirectory(example)", "") - cmake = CMake(self) - cmake.configure() - cmake.build() + apply_conandata_patches(self) + 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) - 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) + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + 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, "lib", "pkgconfig")) + 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")) + + fix_apple_shared_install_name(self) + + if is_msvc(self) and not self.options.shared: + rename(self, os.path.join(self.package_folder, "lib", "libplutovg.a"), os.path.join(self.package_folder, "lib", "plutovg.lib")) def package_info(self): self.cpp_info.libs = ["plutovg"] if self.settings.os in ("FreeBSD", "Linux"): self.cpp_info.system_libs = ["m"] + if is_msvc(self) and not self.options.shared: + self.cpp_info.defines.append("PLUTOVG_BUILD_STATIC") diff --git a/recipes/plutovg/all/patches/0.0.1-0001-include-stdint.patch b/recipes/plutovg/all/patches/0.0.1-0001-include-stdint.patch new file mode 100644 index 0000000000000..38089ef589d9a --- /dev/null +++ b/recipes/plutovg/all/patches/0.0.1-0001-include-stdint.patch @@ -0,0 +1,12 @@ +diff --git a/source/plutovg-surface.c b/source/plutovg-surface.c +index f81a51b..70be9e2 100644 +--- a/source/plutovg-surface.c ++++ b/source/plutovg-surface.c +@@ -1,5 +1,7 @@ + #include "plutovg-private.h" + ++#include ++ + #define STB_IMAGE_IMPLEMENTATION + #define STB_IMAGE_WRITE_IMPLEMENTATION + diff --git a/recipes/plutovg/all/test_package/CMakeLists.txt b/recipes/plutovg/all/test_package/CMakeLists.txt deleted file mode 100644 index 05f05dd40b2ba..0000000000000 --- a/recipes/plutovg/all/test_package/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) - -find_package(plutovg REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} test_package.c) -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 a9fbb7f543162..7433710099642 100644 --- a/recipes/plutovg/all/test_package/conanfile.py +++ b/recipes/plutovg/all/test_package/conanfile.py @@ -1,25 +1,31 @@ from conan import ConanFile from conan.tools.build import can_run -from conan.tools.cmake import cmake_layout, CMake +from conan.tools.layout import basic_layout +from conan.tools.meson import Meson import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + generators = "PkgConfigDeps", "MesonToolchain", "VirtualRunEnv", "VirtualBuildEnv" test_type = "explicit" + def layout(self): + basic_layout(self) + def requirements(self): self.requires(self.tested_reference_str) - def layout(self): - cmake_layout(self) + def build_requirements(self): + self.tool_requires("meson/1.2.3") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/2.0.3") def build(self): - cmake = CMake(self) - cmake.configure() - cmake.build() + 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") + bin_path = os.path.join(self.cpp.build.bindir, "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/plutovg/all/test_package/meson.build b/recipes/plutovg/all/test_package/meson.build new file mode 100644 index 0000000000000..af5cd82ec83dc --- /dev/null +++ b/recipes/plutovg/all/test_package/meson.build @@ -0,0 +1,5 @@ +project('test_package', 'c') +package_dep = dependency('plutovg') +executable('test_package', + sources : ['test_package.c'], + dependencies : [package_dep]) diff --git a/recipes/plutovg/all/test_package/test_package.c b/recipes/plutovg/all/test_package/test_package.c index 528e8031367ec..e73c320347491 100644 --- a/recipes/plutovg/all/test_package/test_package.c +++ b/recipes/plutovg/all/test_package/test_package.c @@ -1,14 +1,14 @@ -#include "plutovg.h" +#include -int main(void) { +int main(void) { const int width = 150; const int height = 150; plutovg_surface_t* surface = plutovg_surface_create(width, height); - plutovg_t* pluto = plutovg_create(surface); + plutovg_canvas_t* canvas = plutovg_canvas_create(surface); plutovg_surface_destroy(surface); - plutovg_destroy(pluto); + plutovg_canvas_destroy(canvas); return 0; } diff --git a/recipes/plutovg/config.yml b/recipes/plutovg/config.yml index b7f8945df864d..e306407899e3b 100644 --- a/recipes/plutovg/config.yml +++ b/recipes/plutovg/config.yml @@ -1,5 +1,13 @@ versions: - "cci.20221030": + "0.0.8": folder: all - "cci.20220103": + "0.0.7": + folder: all + "0.0.6": + folder: all + "0.0.5": + folder: all + "0.0.4": + folder: all + "0.0.1": folder: all diff --git a/recipes/pngpp/all/conanfile.py b/recipes/pngpp/all/conanfile.py index 9693d59416e60..105bf9fe8f655 100644 --- a/recipes/pngpp/all/conanfile.py +++ b/recipes/pngpp/all/conanfile.py @@ -22,7 +22,7 @@ def layout(self): basic_layout(self, src_folder="src") def requirements(self): - self.requires("libpng/1.6.38") + self.requires("libpng/[>=1.6 <2]") def package_id(self): self.info.clear() diff --git a/recipes/pocketfft/all/conandata.yml b/recipes/pocketfft/all/conandata.yml new file mode 100644 index 0000000000000..afc3604e9585d --- /dev/null +++ b/recipes/pocketfft/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.0.0.cci.20240801": + url: "https://github.com/mreineck/pocketfft/archive/bb87ca50df0478415a12d9011dc374eeed4e9d93.tar.gz" + sha256: "434d6cfd38613fb17db2c006cd64991947bdf88fb3f750cf6bfbaa86083c5bbd" diff --git a/recipes/pocketfft/all/conanfile.py b/recipes/pocketfft/all/conanfile.py new file mode 100644 index 0000000000000..75e19754616a6 --- /dev/null +++ b/recipes/pocketfft/all/conanfile.py @@ -0,0 +1,82 @@ +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 + +required_conan_version = ">=1.52.0" + + +class PocketfftConan(ConanFile): + name = "pocketfft" + description = "PocketFFT: a heavily modified implementation of FFTPack" + license = "BSD-3-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/mreineck/pocketfft" + topics = ("fft", "fast-fourier-transform", "fftpack", "header-only") + + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + options = { + "cache_size": ["ANY"], + "multithreading": [True, False], + "pthread": [True, False], + "vectorization": [True, False], + } + default_options = { + "cache_size": 0, + "multithreading": True, + "pthread": False, + "vectorization": True, + } + + def configure(self): + if not self.options.multithreading: + del self.options.pthread + + def requirements(self): + if self.options.get_safe("pthread") and self.settings.os == "Windows": + self.requires("pthreads4w/3.0.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, 11) + + if not str(self.options.cache_size).isdigit() or int(str(self.options.cache_size)) < 0: + raise ConanInvalidConfiguration("cache_size option must be greater or equal to 0") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def package(self): + copy(self, "LICENSE.md", self.source_folder, os.path.join(self.package_folder, "licenses")) + copy(self, "*.h", self.source_folder, os.path.join(self.package_folder, "include")) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + self.cpp_info.defines.append(f"POCKETFFT_CACHE_SIZE={self.options.cache_size}") + if not self.options.multithreading: + self.cpp_info.defines.append("POCKETFFT_NO_MULTITHREADING") + if self.options.get_safe("pthread"): + self.cpp_info.defines.append("POCKETFFT_PTHREADS") + if not self.options.vectorization: + self.cpp_info.defines.append("POCKETFFT_NO_VECTORS") + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") + if self.options.multithreading: + self.cpp_info.system_libs.append("pthread") + + if self.options.get_safe("pthread") and self.settings.os == "Windows": + self.cpp_info.system_libs.append("pthreads4w::pthreads4w") diff --git a/recipes/pocketfft/all/test_package/CMakeLists.txt b/recipes/pocketfft/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..5d277cd110bf2 --- /dev/null +++ b/recipes/pocketfft/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(pocketfft REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE pocketfft::pocketfft) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/pocketfft/all/test_package/conanfile.py b/recipes/pocketfft/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/pocketfft/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/pocketfft/all/test_package/test_package.cpp b/recipes/pocketfft/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..04d8a1970ebf2 --- /dev/null +++ b/recipes/pocketfft/all/test_package/test_package.cpp @@ -0,0 +1,15 @@ +#include + +#include +#include + +using namespace pocketfft; + +int main() { + const int len = 16; + shape_t shape{len}; + stride_t stride{sizeof(std::complex)}; + shape_t axes = {0}; + std::vector> data(len), res(len); + c2c(shape, stride, stride, axes, FORWARD, data.data(), res.data(), 1.f); +} diff --git a/recipes/pocketfft/config.yml b/recipes/pocketfft/config.yml new file mode 100644 index 0000000000000..cecbc61c9639e --- /dev/null +++ b/recipes/pocketfft/config.yml @@ -0,0 +1,3 @@ +versions: + "0.0.0.cci.20240801": + folder: all diff --git a/recipes/poco/all/conandata.yml b/recipes/poco/all/conandata.yml index c1b33d73bc83f..c680025307662 100644 --- a/recipes/poco/all/conandata.yml +++ b/recipes/poco/all/conandata.yml @@ -1,4 +1,22 @@ sources: + "1.13.3": + url: "https://github.com/pocoproject/poco/archive/poco-1.13.3-release.tar.gz" + sha256: "9f074d230daf30f550c5bde5528037bdab6aa83b2a06c81a25e89dd3bcb7e419" + "1.13.2": + url: "https://github.com/pocoproject/poco/archive/poco-1.13.2-release.tar.gz" + sha256: "c01221870aa9bccedf1de39890279699207848fe61a0cfb6aeec7c5942c4627f" + "1.13.1": + url: "https://github.com/pocoproject/poco/archive/poco-1.13.1-release.tar.gz" + sha256: "8accf6c6ebb9ae686e7c8e2390a35beaab08d0ca1abda537cc2d0b7ab9296be5" + "1.13.0": + url: "https://github.com/pocoproject/poco/archive/poco-1.13.0-release.tar.gz" + sha256: "0135160663795901f317215272fadf71f3b526f38daacb2ae8d6b07ad11d319b" + "1.12.5p2": + url: "https://github.com/pocoproject/poco/archive/poco-1.12.5p2-release.tar.gz" + sha256: "08d201bb287cb59e13577901758aeb3ced7ea44627c79f5c162eb60323812685" + "1.12.5p1": + url: "https://github.com/pocoproject/poco/archive/poco-1.12.5p1-release.tar.gz" + sha256: "8ba10b69c815e95e1c8776af0143aa8603088b84e3f6a8447994c6b92d7522f0" "1.12.4": url: "https://github.com/pocoproject/poco/archive/poco-1.12.4-release.tar.gz" sha256: "71ef96c35fced367d6da74da294510ad2c912563f12cd716ab02b6ed10a733ef" @@ -17,66 +35,88 @@ sources: "1.11.3": url: "https://github.com/pocoproject/poco/archive/poco-1.11.3-release.tar.gz" sha256: "fb5e8e70c7dbc8f3b59ec8560140a267b4eaf06ee519dc21f312d0eb195cba37" - "1.11.2": - url: "https://github.com/pocoproject/poco/archive/poco-1.11.2-release.tar.gz" - sha256: "9774651a02e4cfa79fc43b7db617e45d353ede00b7be8afd0e74e6afb23d3793" - "1.11.1": - url: "https://github.com/pocoproject/poco/archive/poco-1.11.1-release.tar.gz" - sha256: "2412a5819a239ff2ee58f81033bcc39c40460d7a8b330013a687c8c0bd2b4ac0" - "1.11.0": - url: "https://github.com/pocoproject/poco/archive/poco-1.11.0-release.tar.gz" - sha256: "8a7bfd0883ee95e223058edce8364c7d61026ac1882e29643822ce9b753f3602" - "1.10.1": - url: "https://github.com/pocoproject/poco/archive/poco-1.10.1-release.tar.gz" - sha256: "44592a488d2830c0b4f3bfe4ae41f0c46abbfad49828d938714444e858a00818" - "1.10.0": - url: "https://github.com/pocoproject/poco/archive/poco-1.10.0-release.tar.gz" - sha256: "8047800d5a965d3177e614b4a4a162381e2638220b24d1d15ff5d6cac1738be8" - "1.9.4": - url: "https://github.com/pocoproject/poco/archive/poco-1.9.4-release.tar.gz" - sha256: "367014cdbcfe9df8f1d746239902149d2398af9b49ba2c1aaaa88616fd538f61" - "1.9.3": - url: "https://github.com/pocoproject/poco/archive/poco-1.9.3-release.tar.gz" - sha256: "73b9dfd1f57106eefb9b451d223579281acfb50b031424e9d0c6486ebb824d01" - "1.8.1": - url: "https://github.com/pocoproject/poco/archive/poco-1.8.1-release.tar.gz" - sha256: "43cc469c01d1f799efc51e2bfde6ffdf467b98a8a0901e6b33db86958619b3af" patches: + "1.13.3": + - patch_file: patches/1.13.0.patch + patch_description: "use cci's packages, use crypt32 symbol, add windmc.exe to find_program" + patch_type: "conan" + - patch_file: patches/1.13.0-0002-mysql-include.patch + patch_description: "include mysql.h instead of mysql/mysql.h" + patch_type: "portability" + "1.13.2": + - patch_file: patches/1.13.0.patch + patch_description: "use cci's packages, use crypt32 symbol, add windmc.exe to find_program" + patch_type: "conan" + - patch_file: patches/1.13.0-0002-mysql-include.patch + patch_description: "include mysql.h instead of mysql/mysql.h" + patch_type: "portability" + "1.13.1": + - patch_file: patches/1.13.0.patch + patch_description: "use cci's packages, use crypt32 symbol, add windmc.exe to find_program" + patch_type: "conan" + - patch_file: patches/1.13.0-0002-mysql-include.patch + patch_description: "include mysql.h instead of mysql/mysql.h" + patch_type: "portability" + "1.13.0": + - patch_file: patches/1.13.0.patch + patch_description: "use cci's packages, use crypt32 symbol, add windmc.exe to find_program" + patch_type: "conan" + - patch_file: patches/1.13.0-0002-mysql-include.patch + patch_description: "include mysql.h instead of mysql/mysql.h" + patch_type: "portability" + "1.12.5p2": + - patch_file: patches/1.12.3.patch + patch_description: "use cci's packages, use crypt32 symbol, add windmc.exe to find_program" + patch_type: "conan" + - patch_file: patches/1.12.5-0002-mysql-include.patch + patch_description: "include mysql.h instead of mysql/mysql.h" + patch_type: "portability" + "1.12.5p1": + - patch_file: patches/1.12.3.patch + patch_description: "use cci's packages, use crypt32 symbol, add windmc.exe to find_program" + patch_type: "conan" + - patch_file: patches/1.12.5-0002-mysql-include.patch + patch_description: "include mysql.h instead of mysql/mysql.h" + patch_type: "portability" "1.12.4": - - patch_file: patches/1.12.4.patch - - patch_file: patches/0002-mysql-include.patch + - patch_file: patches/1.12.3.patch + patch_description: "use cci's packages, use crypt32 symbol, add windmc.exe to find_program" + patch_type: "conan" + - patch_file: patches/1.11.0-0002-mysql-include.patch + patch_description: "include mysql.h instead of mysql/mysql.h" + patch_type: "portability" "1.12.3": - patch_file: patches/1.12.3.patch - - patch_file: patches/0002-mysql-include.patch + patch_description: "use cci's packages, use crypt32 symbol, add windmc.exe to find_program" + patch_type: "conan" + - patch_file: patches/1.11.0-0002-mysql-include.patch + patch_description: "include mysql.h instead of mysql/mysql.h" + patch_type: "portability" "1.12.2": - - patch_file: patches/1.12.2.patch - - patch_file: patches/0002-mysql-include.patch + - patch_file: patches/1.12.0.patch + patch_description: "use cci's packages, use crypt32 symbol, add windmc.exe to find_program" + patch_type: "conan" + - patch_file: patches/1.11.0-0002-mysql-include.patch + patch_description: "include mysql.h instead of mysql/mysql.h" + patch_type: "portability" "1.12.1": - - patch_file: patches/1.12.1.patch - - patch_file: patches/0002-mysql-include.patch + - patch_file: patches/1.12.0.patch + patch_description: "use cci's packages, use crypt32 symbol, add windmc.exe to find_program" + patch_type: "conan" + - patch_file: patches/1.11.0-0002-mysql-include.patch + patch_description: "include mysql.h instead of mysql/mysql.h" + patch_type: "portability" "1.12.0": - patch_file: patches/1.12.0.patch - - patch_file: patches/0002-mysql-include.patch + patch_description: "use cci's packages, use crypt32 symbol, add windmc.exe to find_program" + patch_type: "conan" + - patch_file: patches/1.11.0-0002-mysql-include.patch + patch_description: "include mysql.h instead of mysql/mysql.h" + patch_type: "portability" "1.11.3": - - patch_file: patches/1.11.1.patch - - patch_file: patches/0002-mysql-include.patch - "1.11.2": - - patch_file: patches/1.11.1.patch - - patch_file: patches/0002-mysql-include.patch - "1.11.1": - - patch_file: patches/1.11.1.patch - - patch_file: patches/0002-mysql-include.patch - "1.11.0": - - patch_file: patches/1.11.0.patch - - patch_file: patches/0002-mysql-include.patch - "1.10.1": - - patch_file: patches/1.10.1.patch - "1.10.0": - - patch_file: patches/1.10.0.patch - - patch_file: patches/1.10.0-set-missing-cmake-variable.patch - "1.9.4": - - patch_file: patches/1.9.2.patch - "1.9.3": - - patch_file: patches/1.9.2.patch - "1.8.1": - - patch_file: patches/1.8.1.patch + - patch_file: "patches/1.11.1.patch" + patch_description: "use cci's packages, use crypt32 symbol, add windmc.exe to find_program" + patch_type: "conan" + - patch_file: "patches/1.11.0-0002-mysql-include.patch" + patch_description: "include mysql.h instead of mysql/mysql.h" + patch_type: "portability" diff --git a/recipes/poco/all/conanfile.py b/recipes/poco/all/conanfile.py index 6cc8639d84d7a..8223c242f01e0 100644 --- a/recipes/poco/all/conanfile.py +++ b/recipes/poco/all/conanfile.py @@ -4,36 +4,43 @@ 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.build import check_min_cppstd from collections import namedtuple import os -required_conan_version = ">=1.53.0" +required_conan_version = ">=1.54.0" class PocoConan(ConanFile): name = "poco" - url = "https://github.com/conan-io/conan-center-index" - homepage = "https://pocoproject.org" - topics = ("building", "networking", "server", "mobile", "embedded") - license = "BSL-1.0" description = ( "Modern, powerful open source C++ class libraries for building " "network- and internet-based applications that run on desktop, server, " "mobile and embedded systems." ) - + license = "BSL-1.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://pocoproject.org" + topics = ("building", "networking", "server", "mobile", "embedded") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], "enable_fork": [True, False], "enable_active_record": [True, False, "deprecated"], + "log_debug": [True, False], + "with_sql_parser": [True, False], + "comp_foundation_sharedlibrary_debug_suffix": [True, False], } default_options = { "shared": False, "fPIC": True, "enable_fork": True, "enable_active_record": "deprecated", + "log_debug": False, + "with_sql_parser": True, + "comp_foundation_sharedlibrary_debug_suffix": True, } _PocoComponent = namedtuple("_PocoComponent", ("option", "default_option", "dependencies", "external_dependencies", "is_lib")) @@ -76,6 +83,39 @@ class PocoConan(ConanFile): default_options[comp.option] = comp.default_option del comp + @property + def _min_cppstd(self): + # Since 1.10.0, poco officially requires C++14 + # https://github.com/pocoproject/poco/releases/tag/poco-1.10.0-release + # But poco uses C++11 features only until 1.12.5 + # https://github.com/pocoproject/poco/commit/886b76f4faa2007cc0c09dad81f8dcdee6fcb4ac + if Version(self.version) < "1.12.5": + return "11" + # Since 1.13.0, poco requires C++17 + # https://github.com/pocoproject/poco/releases/tag/poco-1.13.0-release + if Version(self.version) < "1.13.0": + return "14" + return "17" + + @property + def _compilers_minimum_version(self): + return { + "14": { + "gcc": "6", + "clang": "5", + "apple-clang": "10", + "Visual Studio": "15", + "msvc": "191", + }, + "17": { + "gcc": "8", + "clang": "7", + "apple-clang": "12", + "Visual Studio": "16", + "msvc": "192", + }, + }.get(self._min_cppstd, {}) + def export_sources(self): export_conandata_patches(self) @@ -85,21 +125,16 @@ def config_options(self): del self.options.enable_fork else: del self.options.enable_netssl_win - if Version(self.version) < "1.9.0": - del self.options.enable_encodings - 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.0": - del self.options.enable_activerecord - del self.options.enable_activerecord_compiler if Version(self.version) < "1.12.0": del self.options.enable_prometheus + if Version(self.version) < "1.13.0": + del self.options.with_sql_parser + if self.settings.build_type != "Debug": + del self.options.comp_foundation_sharedlibrary_debug_suffix 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: self.options.rm_safe("fPIC") if not self.options.enable_xml: @@ -119,33 +154,42 @@ def requirements(self): if Version(self.version) < "1.12.0": self.requires("pcre/8.45") else: - self.requires("pcre2/10.40") - self.requires("zlib/1.2.13") + self.requires("pcre2/10.42") + self.requires("zlib/[>=1.2.11 <2]", transitive_headers=True) if self.options.enable_xml: - self.requires("expat/2.5.0") + self.requires("expat/[>=2.6.2 <3]", transitive_headers=True) if self.options.enable_data_sqlite: - self.requires("sqlite3/3.39.4") + self.requires("sqlite3/3.45.0") if self.options.enable_apacheconnector: - self.requires("apr/1.7.0") + self.requires("apr/1.7.4") 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.1s") + self.requires("openssl/[>=1.1 <4]", transitive_headers=True) if self.options.enable_data_odbc and self.settings.os != "Windows": self.requires("odbc/2.3.11") if self.options.get_safe("enable_data_postgresql"): - self.requires("libpq/14.5") + self.requires("libpq/15.4") if self.options.get_safe("enable_data_mysql"): - self.requires("libmysqlclient/8.0.30") + self.requires("libmysqlclient/8.1.0") def package_id(self): del self.info.options.enable_active_record + del self.info.options.log_debug def validate(self): - if self.info.options.enable_apacheconnector: + 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.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.info.options.shared and is_msvc_static_runtime(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: @@ -156,29 +200,28 @@ def validate(self): continue if not self.options.get_safe(self._poco_component_tree[compdep].option, False): raise ConanInvalidConfiguration(f"option {compopt.option} requires also option {self._poco_component_tree[compdep].option}") - if self.info.options.enable_data_sqlite: + if self.options.enable_data_sqlite: if self.dependencies["sqlite3"].options.threadsafe == 0: raise ConanInvalidConfiguration("sqlite3 must be built with threadsafe enabled") - if self.info.options.enable_netssl and self.options.get_safe("enable_netssl_win", False): + 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_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - def _dep_include_paths(self, dep): - dep_info = self.dependencies[dep] - return [os.path.join(dep_info.package_folder, dir).replace("\\", "/") for dir in dep_info.cpp_info.includedirs] + 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] - def _dep_lib_paths(self, dep): - dep_info = self.dependencies[dep] - return [os.path.join(dep_info.package_folder, dir).replace("\\", "/") for dir in dep_info.cpp_info.libdirs] + 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": - tc.variables["POCO_STATIC"] = not self.options.shared for comp in self._poco_component_tree.values(): if comp.option: tc.variables[comp.option.upper()] = self.options.get_safe(comp.option, False) @@ -205,13 +248,15 @@ def generate(self): # Disable fork if not self.options.get_safe("enable_fork", True): tc.variables["POCO_NO_FORK_EXEC"] = True + if self.options.get_safe("with_sql_parser", None) is False: + tc.variables["POCO_DATA_NO_SQL_PARSER"] = 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" - # 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.preprocessor_definitions["XML_DTD"] = "1" + # Disable SharedLibrary::suffix() including "d" as part of the platform-specific filename suffix + if not self.options.get_safe("comp_foundation_sharedlibrary_debug_suffix", True): + tc.preprocessor_definitions["POCO_NO_SHARED_LIBRARY_DEBUG_SUFFIX"] = "1" tc.generate() deps = CMakeDeps(self) @@ -277,6 +322,14 @@ def package(self): rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) rmdir(self, os.path.join(self.package_folder, "cmake")) rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + # INFO: missing headers https://github.com/pocoproject/poco/issues/4378 + if self.options.get_safe("with_sql_parser", False): + copy( + self, + "*.h", + os.path.join(self.source_folder, "Data", "src"), + os.path.join(self.package_folder, "include"), + ) def package_info(self): self.cpp_info.set_property("cmake_file_name", "Poco") @@ -306,6 +359,9 @@ def package_info(self): if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["poco_foundation"].system_libs.extend(["pthread", "dl", "rt"]) + if self.options.log_debug: + self.cpp_info.components["poco_foundation"].defines.append("POCO_LOG_DEBUG") + if is_msvc(self): self.cpp_info.components["poco_foundation"].defines.append("POCO_NO_AUTOMATIC_LIBS") if not self.options.shared: diff --git a/recipes/poco/all/patches/1.10.0-set-missing-cmake-variable.patch b/recipes/poco/all/patches/1.10.0-set-missing-cmake-variable.patch deleted file mode 100644 index 83c11982c1cfa..0000000000000 --- a/recipes/poco/all/patches/1.10.0-set-missing-cmake-variable.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -436,7 +436,7 @@ - VERSION ${PROJECT_VERSION} - COMPATIBILITY AnyNewerVersion - ) -- -+set(PocoConfigPackageLocation "lib${LIB_SUFFIX}/cmake/${PROJECT_NAME}") - configure_file(cmake/${PROJECT_NAME}Config.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}Config.cmake" @ONLY) - install( - FILES diff --git a/recipes/poco/all/patches/1.10.0.patch b/recipes/poco/all/patches/1.10.0.patch deleted file mode 100644 index a293b75b06fea..0000000000000 --- a/recipes/poco/all/patches/1.10.0.patch +++ /dev/null @@ -1,51 +0,0 @@ ---- 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 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") -@@ -278,7 +278,7 @@ - - if (MSVC) - # install the targets pdb -- POCO_INSTALL_PDB(${target_name}) -+ # POCO_INSTALL_PDB(${target_name}) - endif() - - endmacro() ---- 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::libpcre ZLIB::ZLIB) - target_compile_definitions(Foundation PUBLIC POCO_UNBUNDLED) - endif (POCO_UNBUNDLED) - ---- a/NetSSL_Win/CMakeLists.txt -+++ b/NetSSL_Win/CMakeLists.txt -@@ -21,7 +21,7 @@ - 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.lib ws2_32 ) - target_include_directories(NetSSLWin - PUBLIC - $ diff --git a/recipes/poco/all/patches/1.10.1.patch b/recipes/poco/all/patches/1.10.1.patch deleted file mode 100644 index 60675d563d9b5..0000000000000 --- a/recipes/poco/all/patches/1.10.1.patch +++ /dev/null @@ -1,51 +0,0 @@ ---- 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 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") -@@ -279,7 +279,7 @@ - - if(MSVC) - # install the targets pdb -- POCO_INSTALL_PDB(${target_name}) -+ # POCO_INSTALL_PDB(${target_name}) - endif() - - endmacro() ---- 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::libpcre ZLIB::ZLIB) - target_compile_definitions(Foundation PUBLIC POCO_UNBUNDLED) - endif(POCO_UNBUNDLED) - ---- a/NetSSL_Win/CMakeLists.txt -+++ b/NetSSL_Win/CMakeLists.txt -@@ -21,7 +21,7 @@ - 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.lib ws2_32 ) - target_include_directories(NetSSLWin - PUBLIC - $ diff --git a/recipes/poco/all/patches/0002-mysql-include.patch b/recipes/poco/all/patches/1.11.0-0002-mysql-include.patch similarity index 100% rename from recipes/poco/all/patches/0002-mysql-include.patch rename to recipes/poco/all/patches/1.11.0-0002-mysql-include.patch diff --git a/recipes/poco/all/patches/1.11.0.patch b/recipes/poco/all/patches/1.11.0.patch deleted file mode 100644 index 1e07c041d0c68..0000000000000 --- a/recipes/poco/all/patches/1.11.0.patch +++ /dev/null @@ -1,120 +0,0 @@ -diff --git a/ActiveRecord/Compiler/CMakeLists.txt b/ActiveRecord/Compiler/CMakeLists.txt -index 06749c1..40a8b23 100644 ---- a/ActiveRecord/Compiler/CMakeLists.txt -+++ b/ActiveRecord/Compiler/CMakeLists.txt -@@ -21,5 +21,6 @@ install( - LIBRARY DESTINATION lib${LIB_SUFFIX} - ARCHIVE DESTINATION lib${LIB_SUFFIX} - RUNTIME DESTINATION bin -+ BUNDLE DESTINATION bin - INCLUDES DESTINATION include - ) -diff --git a/Encodings/Compiler/CMakeLists.txt b/Encodings/Compiler/CMakeLists.txt -index 97eecfe..fa4e85b 100644 ---- a/Encodings/Compiler/CMakeLists.txt -+++ b/Encodings/Compiler/CMakeLists.txt -@@ -15,5 +15,6 @@ install( - LIBRARY DESTINATION lib${LIB_SUFFIX} - ARCHIVE DESTINATION lib${LIB_SUFFIX} - RUNTIME DESTINATION bin -+ BUNDLE DESTINATION bin - INCLUDES DESTINATION include - ) -diff --git a/Foundation/CMakeLists.txt b/Foundation/CMakeLists.txt -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::libpcre 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/PageCompiler/CMakeLists.txt b/PageCompiler/CMakeLists.txt -index d80fe73..48379eb 100644 ---- a/PageCompiler/CMakeLists.txt -+++ b/PageCompiler/CMakeLists.txt -@@ -23,5 +23,6 @@ install( - LIBRARY DESTINATION lib${LIB_SUFFIX} - ARCHIVE DESTINATION lib${LIB_SUFFIX} - RUNTIME DESTINATION bin -+ BUNDLE DESTINATION bin - INCLUDES DESTINATION include - ) -diff --git a/PocoDoc/CMakeLists.txt b/PocoDoc/CMakeLists.txt -index 92f37a9..49ad7b4 100644 ---- a/PocoDoc/CMakeLists.txt -+++ b/PocoDoc/CMakeLists.txt -@@ -11,5 +11,6 @@ install( - LIBRARY DESTINATION lib${LIB_SUFFIX} - ARCHIVE DESTINATION lib${LIB_SUFFIX} - RUNTIME DESTINATION bin -+ BUNDLE DESTINATION bin - INCLUDES DESTINATION include - ) -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 4e0527296..f6ceb699d 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -204,6 +204,15 @@ endif() - - include(DefinePlatformSpecifc) - -+# Disable fork exec -+option(POCO_NO_FORK_EXEC -+ "Set to OFF|ON (default is OFF) to control disable fork exec" OFF) -+ -+if(POCO_NO_FORK_EXEC) -+ add_definitions(-DPOCO_NO_FORK_EXEC=1) -+ message(STATUS "Building with fork exec disabled") -+endif() -+ - # Collect the built libraries and include dirs, the will be used to create the PocoConfig.cmake file - set(Poco_COMPONENTS "") - -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") -@@ -274,6 +274,7 @@ install( - LIBRARY DESTINATION lib${LIB_SUFFIX} - ARCHIVE DESTINATION lib${LIB_SUFFIX} - RUNTIME DESTINATION bin -+ BUNDLE DESTINATION bin - INCLUDES DESTINATION include - ) - diff --git a/recipes/poco/all/patches/1.12.1.patch b/recipes/poco/all/patches/1.12.1.patch deleted file mode 100644 index 0f5458cd155b5..0000000000000 --- a/recipes/poco/all/patches/1.12.1.patch +++ /dev/null @@ -1,36 +0,0 @@ -diff -ruN a/cmake/PocoMacros.cmake b/cmake/PocoMacros.cmake ---- a/cmake/PocoMacros.cmake 2022-07-08 18:28:44.000000000 +0200 -+++ b/cmake/PocoMacros.cmake 2022-07-11 17:50:48.547610971 +0200 -@@ -40,7 +40,7 @@ - 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 -ruN a/Foundation/CMakeLists.txt b/Foundation/CMakeLists.txt ---- a/Foundation/CMakeLists.txt 2022-07-08 18:28:44.000000000 +0200 -+++ b/Foundation/CMakeLists.txt 2022-07-11 17:54:24.035097782 +0200 -@@ -107,7 +107,7 @@ - ) - - 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 -ruN a/NetSSL_Win/CMakeLists.txt b/NetSSL_Win/CMakeLists.txt ---- a/NetSSL_Win/CMakeLists.txt 2022-07-08 18:28:44.000000000 +0200 -+++ b/NetSSL_Win/CMakeLists.txt 2022-07-11 17:50:09.841223897 +0200 -@@ -21,7 +21,7 @@ - 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/recipes/poco/all/patches/1.12.2.patch b/recipes/poco/all/patches/1.12.2.patch deleted file mode 100644 index 0f5458cd155b5..0000000000000 --- a/recipes/poco/all/patches/1.12.2.patch +++ /dev/null @@ -1,36 +0,0 @@ -diff -ruN a/cmake/PocoMacros.cmake b/cmake/PocoMacros.cmake ---- a/cmake/PocoMacros.cmake 2022-07-08 18:28:44.000000000 +0200 -+++ b/cmake/PocoMacros.cmake 2022-07-11 17:50:48.547610971 +0200 -@@ -40,7 +40,7 @@ - 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 -ruN a/Foundation/CMakeLists.txt b/Foundation/CMakeLists.txt ---- a/Foundation/CMakeLists.txt 2022-07-08 18:28:44.000000000 +0200 -+++ b/Foundation/CMakeLists.txt 2022-07-11 17:54:24.035097782 +0200 -@@ -107,7 +107,7 @@ - ) - - 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 -ruN a/NetSSL_Win/CMakeLists.txt b/NetSSL_Win/CMakeLists.txt ---- a/NetSSL_Win/CMakeLists.txt 2022-07-08 18:28:44.000000000 +0200 -+++ b/NetSSL_Win/CMakeLists.txt 2022-07-11 17:50:09.841223897 +0200 -@@ -21,7 +21,7 @@ - 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/recipes/poco/all/patches/1.12.4.patch b/recipes/poco/all/patches/1.12.4.patch deleted file mode 100644 index f1fb7b37a7386..0000000000000 --- a/recipes/poco/all/patches/1.12.4.patch +++ /dev/null @@ -1,39 +0,0 @@ -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.5-0002-mysql-include.patch b/recipes/poco/all/patches/1.12.5-0002-mysql-include.patch new file mode 100644 index 0000000000000..451cebc08e847 --- /dev/null +++ b/recipes/poco/all/patches/1.12.5-0002-mysql-include.patch @@ -0,0 +1,143 @@ +diff --git a/Data/MySQL/include/Poco/Data/MySQL/Binder.h b/Data/MySQL/include/Poco/Data/MySQL/Binder.h +index 82fa617..dd7bf60 100644 +--- a/Data/MySQL/include/Poco/Data/MySQL/Binder.h ++++ b/Data/MySQL/include/Poco/Data/MySQL/Binder.h +@@ -22,7 +22,7 @@ + #include "Poco/Data/AbstractBinder.h" + #include "Poco/Data/LOB.h" + #include "Poco/Data/MySQL/MySQLException.h" +-#include ++#include + + + namespace Poco { +diff --git a/Data/MySQL/include/Poco/Data/MySQL/MySQL.h b/Data/MySQL/include/Poco/Data/MySQL/MySQL.h +index 2386590..ba0fa3f 100644 +--- a/Data/MySQL/include/Poco/Data/MySQL/MySQL.h ++++ b/Data/MySQL/include/Poco/Data/MySQL/MySQL.h +@@ -19,7 +19,7 @@ + + + #include "Poco/Foundation.h" +-#include ++#include + + + // +diff --git a/Data/MySQL/include/Poco/Data/MySQL/MySQLException.h b/Data/MySQL/include/Poco/Data/MySQL/MySQLException.h +index 67692df..2d28da3 100644 +--- a/Data/MySQL/include/Poco/Data/MySQL/MySQLException.h ++++ b/Data/MySQL/include/Poco/Data/MySQL/MySQLException.h +@@ -20,7 +20,7 @@ + + #include "Poco/Data/MySQL/MySQL.h" + #include "Poco/Data/DataException.h" +-#include ++#include + #include + #include + +diff --git a/Data/MySQL/include/Poco/Data/MySQL/ResultMetadata.h b/Data/MySQL/include/Poco/Data/MySQL/ResultMetadata.h +index 8b45e2a..caee854 100644 +--- a/Data/MySQL/include/Poco/Data/MySQL/ResultMetadata.h ++++ b/Data/MySQL/include/Poco/Data/MySQL/ResultMetadata.h +@@ -19,7 +19,7 @@ + + + #include "Poco/Data/MetaColumn.h" +-#include ++#include + #include + + +diff --git a/Data/MySQL/include/Poco/Data/MySQL/SessionHandle.h b/Data/MySQL/include/Poco/Data/MySQL/SessionHandle.h +index 4f65ae5..f9df7ad 100644 +--- a/Data/MySQL/include/Poco/Data/MySQL/SessionHandle.h ++++ b/Data/MySQL/include/Poco/Data/MySQL/SessionHandle.h +@@ -19,7 +19,7 @@ + + + #include "Poco/Data/MySQL/MySQLException.h" +-#include ++#include + + + namespace Poco { +diff --git a/Data/MySQL/include/Poco/Data/MySQL/StatementExecutor.h b/Data/MySQL/include/Poco/Data/MySQL/StatementExecutor.h +index 6767b68..55f0991 100644 +--- a/Data/MySQL/include/Poco/Data/MySQL/StatementExecutor.h ++++ b/Data/MySQL/include/Poco/Data/MySQL/StatementExecutor.h +@@ -19,7 +19,7 @@ + + + #include "Poco/Data/MySQL/MySQLException.h" +-#include ++#include + + + namespace Poco { +diff --git a/Data/MySQL/include/Poco/Data/MySQL/Utility.h b/Data/MySQL/include/Poco/Data/MySQL/Utility.h +index d6d9b40..1e46074 100644 +--- a/Data/MySQL/include/Poco/Data/MySQL/Utility.h ++++ b/Data/MySQL/include/Poco/Data/MySQL/Utility.h +@@ -20,7 +20,7 @@ + + #include "Poco/Data/MySQL/MySQL.h" + #include "Poco/Data/Session.h" +-#include ++#include + + + namespace Poco { +diff --git a/Data/MySQL/src/Connector.cpp b/Data/MySQL/src/Connector.cpp +index b90abab..43e2432 100644 +--- a/Data/MySQL/src/Connector.cpp ++++ b/Data/MySQL/src/Connector.cpp +@@ -16,7 +16,7 @@ + #include "Poco/Data/MySQL/SessionImpl.h" + #include "Poco/Data/SessionFactory.h" + #include "Poco/Exception.h" +-#include ++#include + + + namespace Poco { +diff --git a/Data/MySQL/src/StatementExecutor.cpp b/Data/MySQL/src/StatementExecutor.cpp +index b7e8dbc..d1b512d 100644 +--- a/Data/MySQL/src/StatementExecutor.cpp ++++ b/Data/MySQL/src/StatementExecutor.cpp +@@ -14,7 +14,7 @@ + + #include "Poco/Data/MySQL/StatementExecutor.h" + #include "Poco/Format.h" +-#include ++#include + + + namespace Poco { +diff --git a/Data/MySQL/src/Utility.cpp b/Data/MySQL/src/Utility.cpp +index 84e5cfc..b711901 100644 +--- a/Data/MySQL/src/Utility.cpp ++++ b/Data/MySQL/src/Utility.cpp +@@ -15,7 +15,7 @@ + + + #include "Poco/Data/MySQL/Utility.h" +-#include ++#include + + + namespace Poco { +diff --git a/Data/MySQL/testsuite/src/SQLExecutor.cpp b/Data/MySQL/testsuite/src/SQLExecutor.cpp +index 10594be..3f4bcd7 100644 +--- a/Data/MySQL/testsuite/src/SQLExecutor.cpp ++++ b/Data/MySQL/testsuite/src/SQLExecutor.cpp +@@ -30,7 +30,7 @@ + #endif + + +-#include ++#include + #include + #include + diff --git a/recipes/poco/all/patches/1.13.0-0002-mysql-include.patch b/recipes/poco/all/patches/1.13.0-0002-mysql-include.patch new file mode 100644 index 0000000000000..259dda55b0a96 --- /dev/null +++ b/recipes/poco/all/patches/1.13.0-0002-mysql-include.patch @@ -0,0 +1,143 @@ +diff --git a/Data/MySQL/include/Poco/Data/MySQL/Binder.h b/Data/MySQL/include/Poco/Data/MySQL/Binder.h +index 82fa617..dd7bf60 100644 +--- a/Data/MySQL/include/Poco/Data/MySQL/Binder.h ++++ b/Data/MySQL/include/Poco/Data/MySQL/Binder.h +@@ -22,7 +22,7 @@ + #include "Poco/Data/AbstractBinder.h" + #include "Poco/Data/LOB.h" + #include "Poco/Data/MySQL/MySQLException.h" +-#include ++#include + + + namespace Poco { +diff --git a/Data/MySQL/include/Poco/Data/MySQL/MySQL.h b/Data/MySQL/include/Poco/Data/MySQL/MySQL.h +index 2386590..ba0fa3f 100644 +--- a/Data/MySQL/include/Poco/Data/MySQL/MySQL.h ++++ b/Data/MySQL/include/Poco/Data/MySQL/MySQL.h +@@ -19,7 +19,7 @@ + + + #include "Poco/Foundation.h" +-#include ++#include + + + // +diff --git a/Data/MySQL/include/Poco/Data/MySQL/MySQLException.h b/Data/MySQL/include/Poco/Data/MySQL/MySQLException.h +index 67692df..2d28da3 100644 +--- a/Data/MySQL/include/Poco/Data/MySQL/MySQLException.h ++++ b/Data/MySQL/include/Poco/Data/MySQL/MySQLException.h +@@ -20,7 +20,7 @@ + + #include "Poco/Data/MySQL/MySQL.h" + #include "Poco/Data/DataException.h" +-#include ++#include + #include + #include + +diff --git a/Data/MySQL/include/Poco/Data/MySQL/ResultMetadata.h b/Data/MySQL/include/Poco/Data/MySQL/ResultMetadata.h +index 8b45e2a..caee854 100644 +--- a/Data/MySQL/include/Poco/Data/MySQL/ResultMetadata.h ++++ b/Data/MySQL/include/Poco/Data/MySQL/ResultMetadata.h +@@ -19,7 +19,7 @@ + + + #include "Poco/Data/MetaColumn.h" +-#include ++#include + #include + + +diff --git a/Data/MySQL/include/Poco/Data/MySQL/SessionHandle.h b/Data/MySQL/include/Poco/Data/MySQL/SessionHandle.h +index ebfb73e..68ed74e 100644 +--- a/Data/MySQL/include/Poco/Data/MySQL/SessionHandle.h ++++ b/Data/MySQL/include/Poco/Data/MySQL/SessionHandle.h +@@ -19,7 +19,7 @@ + + + #include "Poco/Data/MySQL/MySQLException.h" +-#include ++#include + + + namespace Poco { +diff --git a/Data/MySQL/include/Poco/Data/MySQL/StatementExecutor.h b/Data/MySQL/include/Poco/Data/MySQL/StatementExecutor.h +index 6767b68..55f0991 100644 +--- a/Data/MySQL/include/Poco/Data/MySQL/StatementExecutor.h ++++ b/Data/MySQL/include/Poco/Data/MySQL/StatementExecutor.h +@@ -19,7 +19,7 @@ + + + #include "Poco/Data/MySQL/MySQLException.h" +-#include ++#include + + + namespace Poco { +diff --git a/Data/MySQL/include/Poco/Data/MySQL/Utility.h b/Data/MySQL/include/Poco/Data/MySQL/Utility.h +index d6d9b40..1e46074 100644 +--- a/Data/MySQL/include/Poco/Data/MySQL/Utility.h ++++ b/Data/MySQL/include/Poco/Data/MySQL/Utility.h +@@ -20,7 +20,7 @@ + + #include "Poco/Data/MySQL/MySQL.h" + #include "Poco/Data/Session.h" +-#include ++#include + + + namespace Poco { +diff --git a/Data/MySQL/src/Connector.cpp b/Data/MySQL/src/Connector.cpp +index b90abab..43e2432 100644 +--- a/Data/MySQL/src/Connector.cpp ++++ b/Data/MySQL/src/Connector.cpp +@@ -16,7 +16,7 @@ + #include "Poco/Data/MySQL/SessionImpl.h" + #include "Poco/Data/SessionFactory.h" + #include "Poco/Exception.h" +-#include ++#include + + + namespace Poco { +diff --git a/Data/MySQL/src/StatementExecutor.cpp b/Data/MySQL/src/StatementExecutor.cpp +index b7e8dbc..d1b512d 100644 +--- a/Data/MySQL/src/StatementExecutor.cpp ++++ b/Data/MySQL/src/StatementExecutor.cpp +@@ -14,7 +14,7 @@ + + #include "Poco/Data/MySQL/StatementExecutor.h" + #include "Poco/Format.h" +-#include ++#include + + + namespace Poco { +diff --git a/Data/MySQL/src/Utility.cpp b/Data/MySQL/src/Utility.cpp +index 84e5cfc..b711901 100644 +--- a/Data/MySQL/src/Utility.cpp ++++ b/Data/MySQL/src/Utility.cpp +@@ -15,7 +15,7 @@ + + + #include "Poco/Data/MySQL/Utility.h" +-#include ++#include + + + namespace Poco { +diff --git a/Data/MySQL/testsuite/src/SQLExecutor.cpp b/Data/MySQL/testsuite/src/SQLExecutor.cpp +index 3803223..2a6110f 100644 +--- a/Data/MySQL/testsuite/src/SQLExecutor.cpp ++++ b/Data/MySQL/testsuite/src/SQLExecutor.cpp +@@ -31,7 +31,7 @@ + #endif + + +-#include ++#include + #include + #include + diff --git a/recipes/poco/all/patches/1.13.0.patch b/recipes/poco/all/patches/1.13.0.patch new file mode 100644 index 0000000000000..063b45f860b0f --- /dev/null +++ b/recipes/poco/all/patches/1.13.0.patch @@ -0,0 +1,39 @@ +diff --git a/Foundation/CMakeLists.txt b/Foundation/CMakeLists.txt +index 41ba999..f4a1fe9 100644 +--- a/Foundation/CMakeLists.txt ++++ b/Foundation/CMakeLists.txt +@@ -99,7 +99,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 c0e1768..32a1187 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 2ef58c5..5d7d7fa 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 deleted file mode 100644 index a13cf433b0cbd..0000000000000 --- a/recipes/poco/all/patches/1.8.1.patch +++ /dev/null @@ -1,81 +0,0 @@ ---- a/cmake/PocoMacros.cmake -+++ b/cmake/PocoMacros.cmake -@@ -265,7 +265,7 @@ - - if (MSVC) - # install the targets pdb -- POCO_INSTALL_PDB(${target_name}) -+ # POCO_INSTALL_PDB(${target_name}) - endif() - - endmacro() ---- 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::SSL OpenSSL::Crypto) - target_include_directories( "${LIBNAME}" - PUBLIC - $ ---- a/Data/SQLite/CMakeLists.txt -+++ b/Data/SQLite/CMakeLists.txt -@@ -10,9 +10,9 @@ - POCO_HEADERS_AUTO( SQLITE_SRCS ${HDRS_G}) - - if (POCO_UNBUNDLED) -- find_package(SQLite3) -- set(DATASQLITELIBS ${SQLITE3_LIBRARIES}) -- include_directories("${SQLITE3_INCLUDE_DIRS}") -+ find_package(SQLite3 REQUIRED) -+ set(DATASQLITELIBS SQLite::SQLite3) -+ #include_directories(${SQLite3_INCLUDE_DIRS}) - else() - # sqlite3 - POCO_SOURCES( SQLITE_SRCS sqlite3 ---- 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 - ) - --target_link_libraries( "${LIBNAME}" Net Util Foundation Crypt32.lib ) -+target_link_libraries( "${LIBNAME}" Net Util Foundation Crypt32.lib ws2_32 ) - target_include_directories( "${LIBNAME}" - PUBLIC - $ diff --git a/recipes/poco/all/patches/1.9.2.patch b/recipes/poco/all/patches/1.9.2.patch deleted file mode 100644 index 2eab9fab22f69..0000000000000 --- a/recipes/poco/all/patches/1.9.2.patch +++ /dev/null @@ -1,81 +0,0 @@ ---- a/cmake/PocoMacros.cmake -+++ b/cmake/PocoMacros.cmake -@@ -278,7 +278,7 @@ - - if (MSVC) - # install the targets pdb -- POCO_INSTALL_PDB(${target_name}) -+ # POCO_INSTALL_PDB(${target_name}) - endif() - - endmacro() ---- 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::SSL OpenSSL::Crypto) - target_include_directories( "${LIBNAME}" - PUBLIC - $ ---- a/Data/SQLite/CMakeLists.txt -+++ b/Data/SQLite/CMakeLists.txt -@@ -16,9 +16,9 @@ - endif() - - if (POCO_UNBUNDLED) -- find_package(SQLite3) -- set(DATASQLITELIBS ${SQLITE3_LIBRARIES}) -- include_directories("${SQLITE3_INCLUDE_DIRS}") -+ find_package(SQLite3 REQUIRED) -+ set(DATASQLITELIBS SQLite::SQLite3) -+ #include_directories(${SQLite3_INCLUDE_DIRS}) - else() - # sqlite3 - POCO_SOURCES( SQLITE_SRCS sqlite3 ---- 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 - ) - --target_link_libraries( "${LIBNAME}" Net Util Foundation Crypt32.lib ) -+target_link_libraries( "${LIBNAME}" Net Util Foundation Crypt32.lib ws2_32 ) - target_include_directories( "${LIBNAME}" - PUBLIC - $ diff --git a/recipes/poco/all/test_package/CMakeLists.txt b/recipes/poco/all/test_package/CMakeLists.txt index e3134a6b1bd9a..99f190c6b84cd 100644 --- a/recipes/poco/all/test_package/CMakeLists.txt +++ b/recipes/poco/all/test_package/CMakeLists.txt @@ -1,6 +1,8 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.8) project(test_package LANGUAGES CXX) +enable_testing() + option(TEST_UTIL "Test Util" ON) option(TEST_CRYPTO "Test crypto" ON) option(TEST_NET "Test Net" ON) @@ -10,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) @@ -40,54 +40,78 @@ endif() find_package(Poco REQUIRED ${POCO_COMPONENTS} CONFIG) +if(Poco_VERSION VERSION_LESS "1.12.5") + set(POCO_CXX_STD cxx_std_11) +else() + set(POCO_CXX_STD cxx_std_14) +endif() + add_executable(core test_core.cpp) -target_link_libraries(core Poco::Foundation) +target_link_libraries(core PRIVATE Poco::Foundation) +target_compile_features(core PRIVATE ${POCO_CXX_STD}) 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 ${POCO_CXX_STD}) 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 ${POCO_CXX_STD}) + 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 ${POCO_CXX_STD}) + 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 ${POCO_CXX_STD}) + 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 ${POCO_CXX_STD}) + 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 ${POCO_CXX_STD}) + 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 ${POCO_CXX_STD}) + 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 ${POCO_CXX_STD}) + 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 ${POCO_CXX_STD}) + 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 f7bd335a861da..155f2e533fc71 100644 --- a/recipes/poco/all/test_package/conanfile.py +++ b/recipes/poco/all/test_package/conanfile.py @@ -1,7 +1,7 @@ from conan import ConanFile -from conan.tools.build import can_run +from conan.tools.build import build_jobs, can_run from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -import os +from conan.tools.files import chdir class TestPackageConan(ConanFile): @@ -9,25 +9,6 @@ class TestPackageConan(ConanFile): generators = "CMakeDeps", "VirtualRunEnv" test_type = "explicit" - @property - def _with_netssl(self): - return ( - ("enable_netssl" in self.dependencies["poco"].options and self.dependencies["poco"].options.enable_netssl) or - ("enable_netssl_win" in self.dependencies["poco"].options and self.dependencies["poco"].options.enable_netssl_win) - ) - - @property - def _with_encodings(self): - return "enable_encodings" in self.dependencies["poco"].options and self.dependencies["poco"].options.enable_encodings - - @property - def _with_jwt(self): - return "enable_jwt" in self.dependencies["poco"].options and self.dependencies["poco"].options.enable_jwt - - @property - def _with_prometheus(self): - return "enable_prometheus" in self.dependencies["poco"].options and self.dependencies["poco"].options.enable_prometheus - def layout(self): cmake_layout(self) @@ -36,14 +17,15 @@ def requirements(self): def generate(self): tc = CMakeToolchain(self) - tc.variables["TEST_CRYPTO"] = self.dependencies["poco"].options.enable_crypto - tc.variables["TEST_UTIL"] = self.dependencies["poco"].options.enable_util - tc.variables["TEST_NET"] = self.dependencies["poco"].options.enable_net - tc.variables["TEST_NETSSL"] = self._with_netssl - tc.variables["TEST_SQLITE"] = self.dependencies["poco"].options.enable_data_sqlite - tc.variables["TEST_ENCODINGS"] = self._with_encodings - tc.variables["TEST_JWT"] = self._with_jwt - tc.variables["TEST_PROMETHEUS"] = self._with_prometheus + 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"] = False + tc.variables["TEST_NETSSL"] = False + 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): @@ -53,26 +35,5 @@ def build(self): def test(self): if can_run(self): - if self.options["poco"].enable_util: - self.run(os.path.join(self.cpp.build.bindirs[0], "util"), env="conanrun") - if self.options["poco"].enable_crypto: - self.run("{} {}".format(os.path.join(self.cpp.build.bindirs[0], "crypto"), os.path.join(self.source_folder, "conanfile.py")), env="conanrun") - if self.options["poco"].enable_net: - self.run(os.path.join(self.cpp.build.bindirs[0], "net"), env="conanrun") - if self.options["poco"].enable_util: - self.run(os.path.join(self.cpp.build.bindirs[0], "net_2"), env="conanrun") - test_netssl = os.path.join(self.cpp.build.bindirs[0], "netssl") - if os.path.exists(test_netssl): - self.run(test_netssl, env="conanrun") - test_sqlite = os.path.join(self.cpp.build.bindirs[0], "sqlite") - if os.path.exists(test_sqlite): - self.run(test_sqlite, env="conanrun") - test_encodings = os.path.join(self.cpp.build.bindirs[0], "encodings") - if os.path.exists(test_encodings): - self.run(test_encodings, env="conanrun") - test_jwt = os.path.join(self.cpp.build.bindirs[0], "jwt") - if os.path.exists(test_jwt): - self.run(test_jwt, env="conanrun") - test_prometheus = os.path.join(self.cpp.build.bindirs[0], "prometheus") - if os.path.exists(test_prometheus): - self.run(test_prometheus, env="conanrun") + 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 index 0d20897301b68..c23ed5cfe6d98 100644 --- a/recipes/poco/all/test_v1_package/CMakeLists.txt +++ b/recipes/poco/all/test_v1_package/CMakeLists.txt @@ -1,5 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) +project(test_v1_package) + +enable_testing() include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) diff --git a/recipes/poco/all/test_v1_package/conanfile.py b/recipes/poco/all/test_v1_package/conanfile.py index 4183b8f616066..ef9bd9175eadb 100644 --- a/recipes/poco/all/test_v1_package/conanfile.py +++ b/recipes/poco/all/test_v1_package/conanfile.py @@ -1,61 +1,30 @@ from conans import CMake, ConanFile, tools -import os +from conans.errors import ConanException 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 + 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._with_netssl + cmake.definitions["TEST_NET"] = False + cmake.definitions["TEST_NETSSL"] = False 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.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(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) + 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 a8a61444c2607..a477d906ba0c3 100644 --- a/recipes/poco/config.yml +++ b/recipes/poco/config.yml @@ -1,29 +1,25 @@ versions: - "1.12.4": - folder: all - "1.12.3": + "1.13.3": folder: all - "1.12.2": + "1.13.2": folder: all - "1.12.1": - folder: all - "1.12.0": + "1.13.1": folder: all - "1.11.3": + "1.13.0": folder: all - "1.11.2": + "1.12.5p2": folder: all - "1.11.1": + "1.12.5p1": folder: all - "1.11.0": + "1.12.4": folder: all - "1.10.1": + "1.12.3": folder: all - "1.10.0": + "1.12.2": folder: all - "1.9.3": + "1.12.1": folder: all - "1.9.4": + "1.12.0": folder: all - "1.8.1": + "1.11.3": folder: all diff --git a/recipes/podofo/all/conandata.yml b/recipes/podofo/all/conandata.yml index 2735fdd5d425b..016e63cd90df6 100644 --- a/recipes/podofo/all/conandata.yml +++ b/recipes/podofo/all/conandata.yml @@ -2,15 +2,8 @@ sources: "0.9.7": url: "https://netcologne.dl.sourceforge.net/project/podofo/podofo/0.9.7/podofo-0.9.7.tar.gz" sha256: "7cf2e716daaef89647c54ffcd08940492fd40c385ef040ce7529396bfadc1eb8" - "0.9.6": - url: "https://netcologne.dl.sourceforge.net/project/podofo/podofo/0.9.6/podofo-0.9.6.tar.gz" - sha256: "e9163650955ab8e4b9532e7aa43b841bac45701f7b0f9b793a98c8ca3ef14072" patches: "0.9.7": - patch_file: "patches/0001-fix-cmake-0.9.7.patch" patch_description: "Link to conan libs and allow to build the tools without the tests and the examples" patch_type: "conan" - "0.9.6": - - patch_file: "patches/0001-fix-cmake-0.9.6.patch" - patch_description: "Link to conan libs and allow to build the tools without the tests and the examples" - patch_type: "conan" diff --git a/recipes/podofo/all/conanfile.py b/recipes/podofo/all/conanfile.py index 5046d4d4b8974..365ade4380f35 100644 --- a/recipes/podofo/all/conanfile.py +++ b/recipes/podofo/all/conanfile.py @@ -1,4 +1,4 @@ -from conan import ConanFile +from conan import ConanFile, conan_version 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 @@ -62,26 +62,33 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("freetype/2.12.1") - self.requires("zlib/1.2.13") + self.requires("freetype/2.13.2") + self.requires("zlib/[>=1.2.11 <2]") if self.settings.os != "Windows": - self.requires("fontconfig/2.13.93") + self.requires("fontconfig/2.15.0") if self.options.with_openssl: - self.requires("openssl/1.1.1s") + self.requires("openssl/[>=1.1 <4]") if self.options.with_libidn: self.requires("libidn/1.36") if self.options.with_jpeg: self.requires("libjpeg/9e") if self.options.with_tiff: - self.requires("libtiff/4.4.0") + self.requires("libtiff/4.6.0") if self.options.with_png: - self.requires("libpng/1.6.38") + self.requires("libpng/[>=1.6 <2]") if self.options.with_unistring: self.requires("libunistring/0.9.10") def validate(self): if self.info.settings.compiler.get_safe("cppstd") and Version(self.version) >= "0.9.7": check_min_cppstd(self, 11) + if conan_version.major >= 2 and Version(self.version) < "0.9.7": + # FIXME: linter complains, but function is there + # https://docs.conan.io/2.0/reference/tools/build.html?highlight=check_min_cppstd#conan-tools-build-check-max-cppstd + import sys + check_max_cppstd = getattr(sys.modules['conan.tools.build'], 'check_max_cppstd') + # INFO: error: no template named 'auto_ptr' in namespace 'std'. Removed in C++17. + check_max_cppstd(self, 14) def source(self): get(self, **self.conan_data["sources"][self.version], diff --git a/recipes/podofo/config.yml b/recipes/podofo/config.yml index ca2128b57488a..a6cc81e2fb933 100644 --- a/recipes/podofo/config.yml +++ b/recipes/podofo/config.yml @@ -1,5 +1,3 @@ versions: "0.9.7": folder: all - "0.9.6": - folder: all diff --git a/recipes/poly2tri/all/CMakeLists.txt b/recipes/poly2tri/all/CMakeLists.txt index 584d7ebc98cae..f72581637fe53 100644 --- a/recipes/poly2tri/all/CMakeLists.txt +++ b/recipes/poly2tri/all/CMakeLists.txt @@ -11,6 +11,11 @@ add_library(poly2tri ${POLY2TRI_SRC_DIR}/sweep/sweep_context.cc ) +# _USE_MATH_DEFINES is defined in utils.h where M_PI is used, but it can break because math.h or cmath +# may have already been included indirectly by other headers included by sweep.cc before inclusion of utils.h +# Therefore we ensure that _USE_MATH_DEFINES is defined before any inclusion of headers. +target_compile_definitions(poly2tri PRIVATE _USE_MATH_DEFINES) + if(MSVC AND BUILD_SHARED_LIBS) set_property(TARGET poly2tri PROPERTY WINDOWS_EXPORT_ALL_SYMBOLS ON) endif() diff --git a/recipes/poly2tri/all/conanfile.py b/recipes/poly2tri/all/conanfile.py index d1ceb49ce5b12..8890a1140dca4 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) @@ -58,3 +58,5 @@ def package(self): def package_info(self): self.cpp_info.libs = ["poly2tri"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") 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/conandata.yml b/recipes/polylabel/all/conandata.yml index efb6a522362e3..0857fe72ca3c7 100644 --- a/recipes/polylabel/all/conandata.yml +++ b/recipes/polylabel/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.0.0": + url: "https://github.com/mapbox/polylabel/archive/refs/tags/v2.0.0.tar.gz" + sha256: "9aba4320c6cb5a8e9a8d44feb0d68b79b3127bdcb759a26aca92ac637668d7b9" "1.1.0": url: "https://github.com/mapbox/polylabel/archive/refs/tags/v1.1.0.tar.gz" sha256: "3694a3127954fab760686c825e2e585684934c768b5f9d542b8701e54147f1a8" diff --git a/recipes/polylabel/all/conanfile.py b/recipes/polylabel/all/conanfile.py index 402d5fbafc219..2e5e1eaff3562 100644 --- a/recipes/polylabel/all/conanfile.py +++ b/recipes/polylabel/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.52.0" @@ -10,13 +12,28 @@ class PolylabelConan(ConanFile): name = "polylabel" description = "A fast algorithm for finding the pole of inaccessibility of a polygon." - topics = ("polygon", "pole-of-inaccessibility") license = "ISC" - homepage = "https://github.com/mapbox/polylabel" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/mapbox/polylabel" + topics = ("polygon", "pole-of-inaccessibility", "header-only") + package_type = "header-library" 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": "6", + "clang": "5", + "apple-clang": "10", + "Visual Studio": "15", + "msvc": "191", + } + def layout(self): basic_layout(self, src_folder="src") @@ -28,14 +45,15 @@ def package_id(self): def validate(self): if self.settings.compiler.get_safe("cppstd"): - 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 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 + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) diff --git a/recipes/polylabel/all/test_v1_package/CMakeLists.txt b/recipes/polylabel/all/test_v1_package/CMakeLists.txt deleted file mode 100644 index 0c0d215f97b42..0000000000000 --- a/recipes/polylabel/all/test_v1_package/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -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/config.yml b/recipes/polylabel/config.yml index b5c0d3cb2d409..2973f3b50e9e6 100644 --- a/recipes/polylabel/config.yml +++ b/recipes/polylabel/config.yml @@ -1,3 +1,5 @@ versions: + "2.0.0": + folder: all "1.1.0": folder: all 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/popl/all/conandata.yml b/recipes/popl/all/conandata.yml new file mode 100644 index 0000000000000..ecb4877cc3587 --- /dev/null +++ b/recipes/popl/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.3.0": + url: "https://github.com/badaix/popl/archive/refs/tags/v1.3.0.tar.gz" + sha256: "7c59554371da3c6c093bd79c2f403f921c1938bd523f1a48682352e0d92883a6" diff --git a/recipes/popl/all/conanfile.py b/recipes/popl/all/conanfile.py new file mode 100644 index 0000000000000..2d3d23c30b405 --- /dev/null +++ b/recipes/popl/all/conanfile.py @@ -0,0 +1,41 @@ +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 + +required_conan_version = ">=1.52.0" + + +class PoplConan(ConanFile): + name = "popl" + description = "Header-only C++ command line arguments parser that supports the same set of options as GNU's getopt." + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/badaix/popl" + topics = ("cli", "command-line-arguments", "getopt", "header-only") + package_type = "header-library" + 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 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], strip_root=True) + + def package(self): + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + copy(self, "popl.hpp", os.path.join(self.source_folder, "include"), os.path.join(self.package_folder, "include")) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/popl/all/test_package/CMakeLists.txt b/recipes/popl/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..7fec26ab44c8e --- /dev/null +++ b/recipes/popl/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(popl REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE popl::popl) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/popl/all/test_package/conanfile.py b/recipes/popl/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/popl/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/popl/all/test_package/test_package.cpp b/recipes/popl/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..3e0ed006d49d2 --- /dev/null +++ b/recipes/popl/all/test_package/test_package.cpp @@ -0,0 +1,12 @@ +#include + +#include + +using namespace popl; + +int main(int argc, char **argv) { + OptionParser op("Allowed options"); + auto help_option = op.add("h", "help", "produce help message"); + op.parse(argc, argv); + std::cout << op << "\n"; +} diff --git a/recipes/popl/config.yml b/recipes/popl/config.yml new file mode 100644 index 0000000000000..426a0e4c79e9b --- /dev/null +++ b/recipes/popl/config.yml @@ -0,0 +1,3 @@ +versions: + "1.3.0": + folder: all diff --git a/recipes/poppler/all/conanfile.py b/recipes/poppler/all/conanfile.py index b7d61c3e69e7e..c798993e27cdd 100644 --- a/recipes/poppler/all/conanfile.py +++ b/recipes/poppler/all/conanfile.py @@ -107,7 +107,7 @@ def requirements(self): if self.options.with_openjpeg: self.requires("openjpeg/2.5.0") if self.options.with_lcms: - self.requires("lcms/2.13.1") + self.requires("lcms/2.16") if self.options.with_libjpeg == "libjpeg": self.requires("libjpeg/9d") if self.options.with_png: diff --git a/recipes/popt/1.16/conandata.yml b/recipes/popt/1.16/conandata.yml new file mode 100644 index 0000000000000..943e3728397d7 --- /dev/null +++ b/recipes/popt/1.16/conandata.yml @@ -0,0 +1,10 @@ +sources: + "1.16": + url: "https://ftp.openbsd.org/pub/OpenBSD/distfiles/popt-1.16.tar.gz" + sha256: "e728ed296fe9f069a0e005003c3d6b2dde3d9cad453422a10d6558616d304cc8" +patches: + "1.16": + - patch_file: "patches/0004-vcpkg-fixmsvc.patch" + patch_description: "Windows portability" + patch_type: "portability" + patch_source: "https://github.com/microsoft/vcpkg/blob/master/ports/libpopt/0004-vcpkg-fixmsvc.patch" diff --git a/recipes/popt/1.16/conanfile.py b/recipes/popt/1.16/conanfile.py new file mode 100644 index 0000000000000..441401f46468c --- /dev/null +++ b/recipes/popt/1.16/conanfile.py @@ -0,0 +1,135 @@ +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, 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.54.0" + +class PoptConan(ConanFile): + name = "popt" + description = "Library for parsing command line parameters" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/rpm-software-management/popt" + topics = ("command line", "options", "parsing") + 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) + + 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 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 requirements(self): + if self.settings.os == "Neutrino": + self.requires("libiconv/[>=1.15]") + + def build_requirements(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") + if is_msvc(self): + self.tool_requires("automake/1.16.5") + + def source(self): + 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): + tc.extra_cflags.append("-FS") + tc.configure_args.extend([ + "--disable-dependency-tracking", + "--disable-nls", + ]) + tc.generate() + + if is_msvc(self): + env = Environment() + 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 _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=self.source_folder) + + def build(self): + self._patch_sources() + autotools = Autotools(self) + autotools.configure() + autotools.make() + + def package(self): + copy(self, pattern="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, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + + fix_apple_shared_install_name(self) + + def package_info(self): + self.cpp_info.libs = ["libpopt"] if self.settings.os == "Windows" else ["popt"] + + self.cpp_info.set_property("pkg_config_name", "popt") + + if is_apple_os(self): + self.cpp_info.system_libs = ["iconv"] diff --git a/recipes/popt/1.16/patches/0004-vcpkg-fixmsvc.patch b/recipes/popt/1.16/patches/0004-vcpkg-fixmsvc.patch new file mode 100644 index 0000000000000..d9bc082f3b53e --- /dev/null +++ b/recipes/popt/1.16/patches/0004-vcpkg-fixmsvc.patch @@ -0,0 +1,62 @@ +diff -Naur a/poptconfig.c b/poptconfig.c +--- a/poptconfig.c 2009-05-20 16:18:07.000000000 +0300 ++++ b/poptconfig.c 2017-01-21 03:10:17.116120500 +0300 +@@ -141,17 +141,23 @@ + int poptSaneFile(const char * fn) + { + struct stat sb; +- uid_t uid = getuid(); ++#ifndef _MSC_VER ++ uid_t uid = getuid(); ++#endif // ! _MSC_VER + + if (stat(fn, &sb) == -1) + return 1; ++#ifndef _MSC_VER + if ((uid_t)sb.st_uid != uid) + return 0; ++#endif // ! _MSC_VER + if (!S_ISREG(sb.st_mode)) + return 0; + /*@-bitwisesigned@*/ +- if (sb.st_mode & (S_IWGRP|S_IWOTH)) +- return 0; ++#ifndef _MSC_VER ++ if (sb.st_mode & (S_IWGRP | S_IWOTH)) ++ return 0; ++#endif // ! _MSC_VER + /*@=bitwisesigned@*/ + return 1; + } +diff -Naur a/popthelp.c b/popthelp.c +--- a/popthelp.c 2009-08-28 03:06:33.000000000 +0300 ++++ b/popthelp.c 2017-01-21 02:59:26.665695800 +0300 +@@ -10,7 +10,10 @@ + + #include "system.h" + +-#define POPT_USE_TIOCGWINSZ ++#ifndef _MSC_VER ++#define POPT_USE_TIOCGWINSZ ++#endif ++ + #ifdef POPT_USE_TIOCGWINSZ + #include + #endif +diff -Naur a/system.h b/system.h +--- a/system.h 2008-12-18 19:09:49.000000000 +0200 ++++ b/system.h 2017-01-21 03:10:59.195367500 +0300 +@@ -100,4 +100,13 @@ + #endif + #define UNUSED(x) x __attribute__((__unused__)) + ++#if defined(_MSC_VER) ++#define X_OK 0 ++ ++#include ++typedef SSIZE_T ssize_t; ++ ++#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) ++#endif ++ + #include "popt.h" diff --git a/recipes/popt/1.16/test_package/CMakeLists.txt b/recipes/popt/1.16/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..22ec2254e31d1 --- /dev/null +++ b/recipes/popt/1.16/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +find_package(popt REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE popt::popt) diff --git a/recipes/popt/1.16/test_package/conanfile.py b/recipes/popt/1.16/test_package/conanfile.py new file mode 100644 index 0000000000000..e845ae751a301 --- /dev/null +++ b/recipes/popt/1.16/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/popt/1.16/test_package/test_package.c b/recipes/popt/1.16/test_package/test_package.c new file mode 100644 index 0000000000000..1ba85997582a9 --- /dev/null +++ b/recipes/popt/1.16/test_package/test_package.c @@ -0,0 +1,17 @@ +#include +#include +#include "popt.h" + + +int main(int argc, const char* argv[]) { + struct poptOption table[] = { + POPT_AUTOHELP + POPT_TABLEEND + }; + + poptContext context = poptGetContext(NULL, argc, argv, table, 0); + poptGetNextOpt(context); + poptFreeContext(context); + + return EXIT_SUCCESS; +} diff --git a/recipes/popt/1.16/test_v1_package/CMakeLists.txt b/recipes/popt/1.16/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..cbe79d4195d31 --- /dev/null +++ b/recipes/popt/1.16/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(popt REQUIRED CONFIG) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/popt/1.16/test_v1_package/conanfile.py b/recipes/popt/1.16/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/popt/1.16/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/popt/1.19/conandata.yml b/recipes/popt/1.19/conandata.yml new file mode 100755 index 0000000000000..9154d03ec87c9 --- /dev/null +++ b/recipes/popt/1.19/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.19": + url: "http://ftp.rpm.org/popt/releases/popt-1.x/popt-1.19.tar.gz" + sha256: "c25a4838fc8e4c1c8aacb8bd620edb3084a3d63bf8987fdad3ca2758c63240f9" diff --git a/recipes/popt/1.19/conanfile.py b/recipes/popt/1.19/conanfile.py new file mode 100755 index 0000000000000..77c06c30fce86 --- /dev/null +++ b/recipes/popt/1.19/conanfile.py @@ -0,0 +1,88 @@ +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 collect_libs, copy, get, rmdir, rm +from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc +import os + + +required_conan_version = ">=1.54.0" + +class PoptConan(ConanFile): + name = "popt" + description = "Library for parsing command line parameters" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/rpm-software-management/popt" + topics = ("command line", "options", "parsing") + 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 requirements(self): + if self.settings.os == "Neutrino": + self.requires("libiconv/1.17") + + 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 is_msvc(self): + raise ConanInvalidConfiguration(f"{self.ref} can not be built with shared on Visual Studio and msvc, use mingw.") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + ad = AutotoolsDeps(self) + ad.generate() + + tc = AutotoolsToolchain(self) + tc.ldflags.append("-lintl") + tc.generate() + + def build(self): + autotools = Autotools(self) + autotools.configure() + autotools.make() + + def package(self): + copy(self, pattern="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, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + + fix_apple_shared_install_name(self) + + def package_info(self): + self.cpp_info.libs = collect_libs(self) + + if is_apple_os(self): + self.cpp_info.system_libs = ["iconv"] + + if self.settings.os == "Neutrino": + self.cpp_info.system_libs = ["intl"] diff --git a/recipes/popt/1.19/test_package/CMakeLists.txt b/recipes/popt/1.19/test_package/CMakeLists.txt new file mode 100755 index 0000000000000..22ec2254e31d1 --- /dev/null +++ b/recipes/popt/1.19/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +find_package(popt REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE popt::popt) diff --git a/recipes/popt/1.19/test_package/conanfile.py b/recipes/popt/1.19/test_package/conanfile.py new file mode 100755 index 0000000000000..e845ae751a301 --- /dev/null +++ b/recipes/popt/1.19/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/popt/1.19/test_package/test_package.c b/recipes/popt/1.19/test_package/test_package.c new file mode 100755 index 0000000000000..1ba85997582a9 --- /dev/null +++ b/recipes/popt/1.19/test_package/test_package.c @@ -0,0 +1,17 @@ +#include +#include +#include "popt.h" + + +int main(int argc, const char* argv[]) { + struct poptOption table[] = { + POPT_AUTOHELP + POPT_TABLEEND + }; + + poptContext context = poptGetContext(NULL, argc, argv, table, 0); + poptGetNextOpt(context); + poptFreeContext(context); + + return EXIT_SUCCESS; +} diff --git a/recipes/popt/config.yml b/recipes/popt/config.yml new file mode 100755 index 0000000000000..5701e758adc33 --- /dev/null +++ b/recipes/popt/config.yml @@ -0,0 +1,5 @@ +versions: + "1.19": + folder: "1.19" + "1.16": + folder: "1.16" diff --git a/recipes/portable-file-dialogs/all/conanfile.py b/recipes/portable-file-dialogs/all/conanfile.py index c45d2c0106dee..9ef96147823bf 100644 --- a/recipes/portable-file-dialogs/all/conanfile.py +++ b/recipes/portable-file-dialogs/all/conanfile.py @@ -1,36 +1,42 @@ import os -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 + +required_conan_version = ">=1.52.0" class PortableFileDialogsConan(ConanFile): name = "portable-file-dialogs" + description = "Portable GUI dialogs library, C++11, single-header" license = "WTFPL" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/samhocevar/portable-file-dialogs" - description = "Portable GUI dialogs library, C++11, single-header" - topics = ("conan", "gui", "dialogs") - no_copy_source = True - settings = "compiler" + topics = ("gui", "dialogs", "header-only") - @property - def _source_subfolder(self): - return "source_subfolder" + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True def configure(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) + check_min_cppstd(self, 11) + + 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("portable-file-dialogs.h", dst="include", src=self._source_subfolder) - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - - def package_id(self): - self.info.header_only() + copy(self, "COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, "portable-file-dialogs.h", dst=os.path.join(self.package_folder, "include"), src=self.source_folder) def package_info(self): self.cpp_info.libdirs = [] + self.cpp_info.bindirs = [] diff --git a/recipes/portable-file-dialogs/all/test_package/CMakeLists.txt b/recipes/portable-file-dialogs/all/test_package/CMakeLists.txt index 33ae887aa6aea..c54c9c2b41cf2 100644 --- a/recipes/portable-file-dialogs/all/test_package/CMakeLists.txt +++ b/recipes/portable-file-dialogs/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -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() +find_package(portable-file-dialogs REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE portable-file-dialogs::portable-file-dialogs) set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) diff --git a/recipes/portable-file-dialogs/all/test_package/conanfile.py b/recipes/portable-file-dialogs/all/test_package/conanfile.py index bd7165a553cf4..fae501d0afb9e 100644 --- a/recipes/portable-file-dialogs/all/test_package/conanfile.py +++ b/recipes/portable-file-dialogs/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" + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/poselib/all/conandata.yml b/recipes/poselib/all/conandata.yml new file mode 100644 index 0000000000000..32b5efa0b3081 --- /dev/null +++ b/recipes/poselib/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "2.0.4": + url: "https://github.com/PoseLib/PoseLib/archive/refs/tags/v2.0.4.tar.gz" + sha256: "caa0c1c9b882f6e36b5ced6f781406ed97d4c1f0f61aa31345ebe54633d67c16" + "2.0.3": + url: "https://github.com/PoseLib/PoseLib/archive/refs/tags/v2.0.3.tar.gz" + sha256: "ec52fe738a803e53c4cedc27f393a38b2dced63da6c73148e98965b338ca0efc" diff --git a/recipes/poselib/all/conanfile.py b/recipes/poselib/all/conanfile.py new file mode 100644 index 0000000000000..0282ec6f8bfdb --- /dev/null +++ b/recipes/poselib/all/conanfile.py @@ -0,0 +1,110 @@ +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, cmake_layout +from conan.tools.files import copy, get, replace_in_file, rmdir +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" + + +class PoselibConan(ConanFile): + name = "poselib" + description = "PoseLib: minimal solvers for calibrated camera pose estimation" + license = "BSD-3-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/PoseLib/PoseLib" + topics = ("pose", "camera", "estimation", "solver") + + package_type = "library" + 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 { + "gcc": "7", + "clang": "6", + "apple-clang": "10", + "msvc": "192", + "Visual Studio": "16", + } + + 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("eigen/3.4.0", transitive_headers=True, transitive_libs=True) + + 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" and self.options.shared: + raise ConanInvalidConfiguration( + f"{self.ref} does not export symbols on Windows for a shared library build." + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["MARCH_NATIVE"] = False + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + 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, "-march=native -Wall -Werror -fPIC", "") + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE", self.source_folder, 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", "PoseLib") + self.cpp_info.set_property("cmake_target_name", "PoseLib::PoseLib") + + suffix = "d" if self.settings.build_type == "Debug" else "" + self.cpp_info.libs = ["PoseLib" + suffix] + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") diff --git a/recipes/poselib/all/test_package/CMakeLists.txt b/recipes/poselib/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..ea7248e1ec70c --- /dev/null +++ b/recipes/poselib/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(PoseLib REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE PoseLib::PoseLib) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/poselib/all/test_package/conanfile.py b/recipes/poselib/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/poselib/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/poselib/all/test_package/test_package.cpp b/recipes/poselib/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..613b02cd52fa4 --- /dev/null +++ b/recipes/poselib/all/test_package/test_package.cpp @@ -0,0 +1,10 @@ +#include + +#include + +int main() { + std::vector x1(10, Eigen::Vector3d{}); + std::vector x2(10, Eigen::Vector3d{}); + Eigen::Matrix3d h; + int res = poselib::homography_4pt(x1, x2, &h); +} diff --git a/recipes/poselib/config.yml b/recipes/poselib/config.yml new file mode 100644 index 0000000000000..7776ab2d30335 --- /dev/null +++ b/recipes/poselib/config.yml @@ -0,0 +1,5 @@ +versions: + "2.0.4": + folder: all + "2.0.3": + folder: all diff --git a/recipes/poshlib/all/CMakeLists.txt b/recipes/poshlib/all/CMakeLists.txt index 7e123f6b4b780..ada768afc9da6 100644 --- a/recipes/poshlib/all/CMakeLists.txt +++ b/recipes/poshlib/all/CMakeLists.txt @@ -1,22 +1,16 @@ -cmake_minimum_required(VERSION 3.4) +cmake_minimum_required(VERSION 3.12) project(cmake_wrapper) -include(conanbuildinfo.cmake) -conan_basic_setup() - if(WIN32 AND BUILD_SHARED_LIBS) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) endif() -file(GLOB SRCS_FILES ${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder/*.c) -file(GLOB HDRS_FILES ${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder/*.h) +file(GLOB SRCS_FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.c) +file(GLOB HDRS_FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.h) add_library(posh ${SRCS_FILES}) -target_include_directories(posh PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder) +target_include_directories(posh PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src) -install(TARGETS posh - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib -) +include(GNUInstallDirs) +install(TARGETS posh) install(FILES ${HDRS_FILES} DESTINATION include) diff --git a/recipes/poshlib/all/conanfile.py b/recipes/poshlib/all/conanfile.py index 8a2c26baad724..7ad4e9bed544b 100644 --- a/recipes/poshlib/all/conanfile.py +++ b/recipes/poshlib/all/conanfile.py @@ -1,17 +1,21 @@ import os -import glob -from conans import ConanFile, CMake, tools + +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import collect_libs, copy, get, replace_in_file + +required_conan_version = ">=1.53.0" class PoshlibConan(ConanFile): name = "poshlib" description = "Posh is a software framework used in cross-platform software development." - homepage = "https://github.com/PhilipLudington/poshlib" - url = "https://github.com/conan-io/conan-center-index" - topics = ("conan", "posh", "framework", "cross-platform") license = "BSD-2-Clause" - exports_sources = ["CMakeLists.txt"] - generators = "cmake" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/PhilipLudington/poshlib" + topics = ("posh", "framework", "cross-platform") + + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -22,47 +26,51 @@ class PoshlibConan(ConanFile): "fPIC": True, } - _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('poshlib-*/')[0] - os.rename(extracted_dir, self._source_subfolder) + 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': + 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 source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + 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() - return self._cmake + def _patch_sources(self): + replace_in_file( + self, + os.path.join(self.source_folder, "posh.h"), + "defined _ARM", + "defined _ARM || defined __arm64 || defined __arm64__ || defined __aarch64__", + ) def build(self): - tools.replace_in_file(os.path.join(self._source_subfolder, "posh.h"), - "defined _ARM", - "defined _ARM || defined __arm64") - cmake = self._configure_cmake() + self._patch_sources() + cmake = CMake(self) + cmake.configure(build_script_folder=self.source_path.parent) cmake.build() def package(self): - cmake = self._configure_cmake() + copy(self, "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 = tools.collect_libs(self) - if self.settings.os == 'Windows' and self.options.shared: + self.cpp_info.libs = collect_libs(self) + if self.settings.os == "Windows" and self.options.shared: self.cpp_info.defines.append("POSH_DLL") diff --git a/recipes/poshlib/all/test_package/CMakeLists.txt b/recipes/poshlib/all/test_package/CMakeLists.txt index 7b9b613cbb24a..06a245507c563 100644 --- a/recipes/poshlib/all/test_package/CMakeLists.txt +++ b/recipes/poshlib/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ -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() +find_package(poshlib REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE poshlib::poshlib) diff --git a/recipes/poshlib/all/test_package/conanfile.py b/recipes/poshlib/all/test_package/conanfile.py index 16ec9f68ef974..ef5d7042163ec 100644 --- a/recipes/poshlib/all/test_package/conanfile.py +++ b/recipes/poshlib/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" + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/poshlib/all/test_v1_package/CMakeLists.txt b/recipes/poshlib/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/poshlib/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/poshlib/all/test_v1_package/conanfile.py b/recipes/poshlib/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..90eb89e3f2f46 --- /dev/null +++ b/recipes/poshlib/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/pprint/all/conanfile.py b/recipes/pprint/all/conanfile.py index bff4a1689bd94..364e5bce8ca73 100644 --- a/recipes/pprint/all/conanfile.py +++ b/recipes/pprint/all/conanfile.py @@ -1,48 +1,63 @@ -from conans import ConanFile, 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.files import copy, get +from conan.tools.layout import basic_layout +from conan.tools.scm import Version + +required_conan_version = ">=1.52.0" + class PprintConan(ConanFile): name = "pprint" - homepage = "https://github.com/p-ranav/pprint" - url = "https://github.com/conan-io/conan-center-index" description = "Pretty Printer for Modern C++" license = "MIT" - settings = "os", "compiler" - topics = ("conan", "pprint", "pretty", "printer") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/p-ranav/pprint" + topics = ("pretty", "printer", "header-only") + + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 17 - def configure(self): - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 17) + @property + def _compilers_minimum_version(self): + return { + "gcc": "7", + "clang": "7", + "apple-clang": "10", + "Visual Studio": "15", + } - min_compiler_version = { - "gcc": 7, - "clang": 7, - "apple-clang": 10, - "Visual Studio": 15, - }.get(str(self.settings.compiler), None) + def layout(self): + basic_layout(self, src_folder="src") - if min_compiler_version: - if tools.Version(self.settings.compiler.version) < min_compiler_version: - raise ConanInvalidConfiguration("The compiler does not support c++17") - else: - self.output.warn("pprint needs a c++17 capable compiler") + 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): - 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") + 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")) + 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.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/pprint/all/test_package/CMakeLists.txt b/recipes/pprint/all/test_package/CMakeLists.txt index 3572b806e9a79..58ce520a06b4f 100644 --- a/recipes/pprint/all/test_package/CMakeLists.txt +++ b/recipes/pprint/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(pprint REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE pprint::pprint) set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17) diff --git a/recipes/pprint/all/test_package/conanfile.py b/recipes/pprint/all/test_package/conanfile.py index bd7165a553cf4..e0e49c1e8d6b6 100644 --- a/recipes/pprint/all/test_package/conanfile.py +++ b/recipes/pprint/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", + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/pprint/all/test_v1_package/CMakeLists.txt b/recipes/pprint/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/pprint/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/pprint/all/test_v1_package/conanfile.py b/recipes/pprint/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..7e2dfe859bb27 --- /dev/null +++ b/recipes/pprint/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/pranav-csv2/all/conanfile.py b/recipes/pranav-csv2/all/conanfile.py index f73a81dd87306..ce5e7775c6355 100644 --- a/recipes/pranav-csv2/all/conanfile.py +++ b/recipes/pranav-csv2/all/conanfile.py @@ -1,100 +1,116 @@ +# TODO: verify the Conan v2 migration + import os -import functools import textwrap -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.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, rmdir, save +from conan.tools.scm import Version + +required_conan_version = ">=1.52.0" -required_conan_version = ">=1.33.0" class PranavCSV2Conan(ConanFile): name = "pranav-csv2" - license = "MIT" description = "Various header libraries mostly future std lib, replacements for(e.g. visit), or some misc" - topics = ("csv", "iterator", "header-only", ) + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/p-ranav/csv2" - settings = "os", "arch", "compiler", "build_type", - generators = "cmake", + topics = ("csv", "iterator", "header-only") + + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - _compiler_required_cpp11 = { - "Visual Studio": "16", - "gcc": "8", - "clang": "7", - "apple-clang": "12.0", - } + @property + def _min_cppstd(self): + return 11 @property - def _source_subfolder(self): - return "source_subfolder" + def _compilers_minimum_version(self): + return { + "Visual Studio": "16", + "gcc": "8", + "clang": "7", + "apple-clang": "12.0", + } + + 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, "11") + check_min_cppstd(self, self._min_cppstd) - minimum_version = self._compiler_required_cpp11.get(str(self.settings.compiler), False) + 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("{} requires C++11, which your compiler does not support.".format(self.name)) + if Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration(f"{self.name} requires C++11, which your compiler does not support.") else: - self.output.warn("{0} requires C++11. Your compiler is unknown. Assuming it supports C++11.".format(self.name)) + self.output.warning(f"{self.name} requires C++11. Your compiler is unknown. Assuming it supports C++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(source_folder=self._source_subfolder) - return cmake + def generate(self): + tc = CMakeToolchain(self) + tc.generate() - @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)) + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() - @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*", "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")) - 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")) self._create_cmake_module_alias_targets( os.path.join(self.package_folder, self._module_file_rel_path), {"csv2": "csv2::csv2"} ) - def package_id(self): - self.info.header_only() + @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, f"conan-official-{self.name}-targets.cmake") def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.set_property("cmake_file_name", "csv2") self.cpp_info.set_property("cmake_target_name", "csv2::csv2") + self.cpp_info.builddirs.append(self._module_subfolder) + self.cpp_info.filenames["cmake_find_package"] = "csv2" self.cpp_info.filenames["cmake_find_package_multi"] = "csv2" self.cpp_info.names["cmake_find_package"] = "csv2" self.cpp_info.names["cmake_find_package_multi"] = "csv2" - - 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/pranav-csv2/all/test_package/CMakeLists.txt b/recipes/pranav-csv2/all/test_package/CMakeLists.txt index f958b282d05ea..b8a570a3eafe7 100644 --- a/recipes/pranav-csv2/all/test_package/CMakeLists.txt +++ b/recipes/pranav-csv2/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(csv2 CONFIG REQUIRED) +find_package(csv2 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} csv2) +target_link_libraries(${PROJECT_NAME} csv2::csv2) set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) diff --git a/recipes/pranav-csv2/all/test_package/conanfile.py b/recipes/pranav-csv2/all/test_package/conanfile.py index 0197f07f63c5d..fae501d0afb9e 100644 --- a/recipes/pranav-csv2/all/test_package/conanfile.py +++ b/recipes/pranav-csv2/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 DawHeaderLibrariesTestConan(ConanFile): + +class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain" + 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/pranav-csv2/all/test_package/test_package.cpp b/recipes/pranav-csv2/all/test_package/test_package.cpp index 6119ae1a3e0f9..d415b3cf575ef 100644 --- a/recipes/pranav-csv2/all/test_package/test_package.cpp +++ b/recipes/pranav-csv2/all/test_package/test_package.cpp @@ -3,7 +3,7 @@ int main() { csv2::Reader< csv2::delimiter<','>, - csv2::quote_character<'"'>, + csv2::quote_character<'"'>, csv2::first_row_is_header, csv2::trim_policy::trim_whitespace> csv; diff --git a/recipes/pranav-csv2/all/test_v1_package/CMakeLists.txt b/recipes/pranav-csv2/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/pranav-csv2/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/pranav-csv2/all/test_v1_package/conanfile.py b/recipes/pranav-csv2/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..0197f07f63c5d --- /dev/null +++ b/recipes/pranav-csv2/all/test_v1_package/conanfile.py @@ -0,0 +1,16 @@ +import os +from conans import ConanFile, CMake, tools + +class DawHeaderLibrariesTestConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/premake/5.x/conandata.yml b/recipes/premake/5.x/conandata.yml index d96239dcf6113..91cb25d43c227 100644 --- a/recipes/premake/5.x/conandata.yml +++ b/recipes/premake/5.x/conandata.yml @@ -2,13 +2,6 @@ sources: "5.0.0-alpha15": url: "https://github.com/premake/premake-core/releases/download/v5.0.0-alpha15/premake-5.0.0-alpha15-src.zip" sha256: "880f56e7cb9f4945d1cb879f059189462c1b7bf62ef43ac7d25842dfb177dd53" - "5.0.0-alpha14": - url: "https://github.com/premake/premake-core/releases/download/v5.0.0-alpha14/premake-5.0.0-alpha14-src.zip" - sha256: "7c9fa4488156625c819dd03f2b48bfd4712fbfabdc2b5768e8c7f52dd7d16608" patches: "5.0.0-alpha15": - patch_file: "patches/0001-5.0.0-alpha15-mingw.patch" - base_path: "source_subfolder" - "5.0.0-alpha14": - - patch_file: "patches/0001-5.0.0-alpha14-mingw.patch" - base_path: "source_subfolder" diff --git a/recipes/premake/5.x/conanfile.py b/recipes/premake/5.x/conanfile.py index f0834e0449cd2..0a761c061731a 100644 --- a/recipes/premake/5.x/conanfile.py +++ b/recipes/premake/5.x/conanfile.py @@ -1,19 +1,33 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment, MSBuild -from conans.errors import ConanInvalidConfiguration import glob import os import re +import shutil + +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import cross_building +from conan.tools.files import apply_conandata_patches, chdir, copy, export_conandata_patches, get, replace_in_file +from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps +from conan.tools.layout import basic_layout +from conan.tools.microsoft import MSBuild, MSBuildToolchain, is_msvc, check_min_vs + +required_conan_version = ">=1.53.0" class PremakeConan(ConanFile): name = "premake" - topics = ("conan", "premake", "build", "build-systems") - description = "Describe your software project just once, using Premake's simple and easy to read syntax, and build it everywhere" + description = ( + "Describe your software project just once, " + "using Premake's simple and easy to read syntax, " + "and build it everywhere" + ) + license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://premake.github.io" - license = "BSD-3-Clause" + topics = ("build", "build-systems") + + package_type = "application" settings = "os", "arch", "compiler", "build_type" - exports_sources = "patches/**" options = { "lto": [True, False], } @@ -21,35 +35,49 @@ class PremakeConan(ConanFile): "lto": False, } - @property - def _source_subfolder(self): - return "source_subfolder" - - 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 export_sources(self): + export_conandata_patches(self) def config_options(self): - if self.settings.os != "Windows" or self.settings.compiler == "Visual Studio": - del self.options.lto + if self.settings.os != "Windows" or is_msvc(self): + self.options.rm_safe("lto") + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + del self.info.settings.compiler + + def requirements(self): + if self.settings.os != "Windows": + self.requires("util-linux-libuuid/2.39") def validate(self): - if hasattr(self, 'settings_build') and tools.cross_building(self, skip_x64_x86=True): + if hasattr(self, "settings_build") and cross_building(self, skip_x64_x86=True): raise ConanInvalidConfiguration("Cross-building not implemented") + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + @property - def _msvc_version(self): - return { - "12": "2013", - "14": "2015", - "15": "2017", - "16": "2019", - }.get(str(self.settings.compiler.version), "2017") + def _ide_version(self): + compiler_version = str(self.settings.compiler.version) + if str(self.settings.compiler) == "Visual Studio": + return {"17": "2022", + "16": "2019", + "15": "2017", + "14": "2015", + "12": "2013"}.get(compiler_version) + else: + return {"193": "2022", + "192": "2019", + "191": "2017", + "190": "2015", + "180": "2013"}.get(compiler_version) @property - def _msvc_build_dirname(self): - return "vs{}".format(self._msvc_version) + def _msvc_build_dir(self): + return os.path.join(self.source_folder, "build", f"vs{self._ide_version}") def _version_info(self, version): res = [] @@ -63,13 +91,6 @@ def _version_info(self, version): res.append(p) return tuple(res) - @property - def _gmake_directory_name_prefix(self): - if self._version_info(self.version) <= self._version_info("5.0.0-alpha14"): - return "gmake" - else: - return "gmake2" - @property def _gmake_platform(self): return { @@ -80,8 +101,8 @@ def _gmake_platform(self): }[str(self.settings.os)] @property - def _gmake_build_dirname(self): - return "{}.{}".format(self._gmake_directory_name_prefix, self._gmake_platform) + def _gmake_build_dir(self): + return os.path.join(self.source_folder, "build", f"gmake2.{self._gmake_platform}") @property def _gmake_config(self): @@ -91,35 +112,62 @@ def _gmake_config(self): "x86": "x86", "x86_64": "x64", }[str(self.settings.arch)] - config = "{}_{}".format(build_type, arch) + config = f"{build_type}_{arch}" else: config = build_type return config + def generate(self): + if is_msvc(self): + tc = MSBuildToolchain(self) + tc.generate() + else: + tc = AutotoolsToolchain(self) + tc.make_args = ["verbose=1", f"config={self._gmake_config}"] + tc.generate() + deps = AutotoolsDeps(self) + deps.generate() + def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - if self.options.get_safe("lto", None) == False: - for fn in glob.glob(os.path.join(self._source_subfolder, "build", self._gmake_build_dirname, "*.make")): - tools.replace_in_file(fn, "-flto", "", strict=False) + apply_conandata_patches(self) + if self.options.get_safe("lto", None) is False: + for fn in glob.glob(os.path.join(self._gmake_build_dir, "*.make")): + replace_in_file(self, fn, "-flto", "", strict=False) + if check_min_vs(self, 193, raise_invalid=False): + # Create VS 2022 project directory based on VS 2019 one + if "alpha" in str(self.version): + shutil.move(os.path.join(self.source_folder, "build", "vs2019"), + os.path.join(self.source_folder, "build", "vs2022")) + for vcxproj in glob.glob(os.path.join(self.source_folder, "build", "vs2022", "*.vcxproj")): + replace_in_file(self, vcxproj, "v142", "v143") def build(self): self._patch_sources() - if self.settings.compiler == "Visual Studio": - with tools.chdir(os.path.join(self._source_subfolder, "build", self._msvc_build_dirname)): + if is_msvc(self): + with chdir(self, self._msvc_build_dir): msbuild = MSBuild(self) - msbuild.build("Premake5.sln", platforms={"x86": "Win32", "x86_64": "x64"}) + msbuild.build(sln="Premake5.sln") else: - with tools.chdir(os.path.join(self._source_subfolder, "build", self._gmake_build_dirname)): - env_build = AutoToolsBuildEnvironment(self) - env_build.make(target="Premake5", args=["verbose=1", "config={}".format(self._gmake_config)]) + with chdir(self, self._gmake_build_dir): + autotools = Autotools(self) + autotools.make(target="Premake5") def package(self): - self.copy(pattern="LICENSE.txt", dst="licenses", src=self._source_subfolder) - self.copy(pattern="*premake5.exe", dst="bin", keep_path=False) - self.copy(pattern="*premake5", dst="bin", keep_path=False) + copy(self, "LICENSE.txt", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder) + suffix = ".exe" if self.settings.os == "Windows" else "" + copy(self, f"*/premake5{suffix}", + dst=os.path.join(self.package_folder, "bin"), + src=os.path.join(self.source_folder, "bin"), + keep_path=False) 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 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/premake/5.x/patches/0001-5.0.0-alpha14-mingw.patch b/recipes/premake/5.x/patches/0001-5.0.0-alpha14-mingw.patch deleted file mode 100644 index 0dd121be8b2ae..0000000000000 --- a/recipes/premake/5.x/patches/0001-5.0.0-alpha14-mingw.patch +++ /dev/null @@ -1,72 +0,0 @@ ---- a/contrib/curl/lib/select.h -+++ b/contrib/curl/lib/select.h -@@ -36,7 +36,8 @@ - - #if !defined(HAVE_STRUCT_POLLFD) && \ - !defined(HAVE_SYS_POLL_H) && \ -- !defined(HAVE_POLL_H) -+ !defined(HAVE_POLL_H) && \ -+ !defined(POLLIN) - - #define POLLIN 0x01 - #define POLLPRI 0x02 ---- src/host/os_isdir.c -+++ src/host/os_isdir.c -@@ -9,7 +9,7 @@ - #include "premake.h" - - #ifdef _WIN32 --#include -+#include - #endif - - int os_isdir(lua_State* L) ---- src/host/os_uuid.c -+++ src/host/os_uuid.c -@@ -7,7 +7,7 @@ - #include "premake.h" - - #if PLATFORM_WINDOWS --#include -+#include - #endif - - ---- build/gmake.windows/Premake5.make -+++ build/gmake.windows/Premake5.make -@@ -22,7 +22,7 @@ - ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m32 -flto -O3 -Wall -Wextra - ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m32 -flto -O3 -Wall -Wextra -fno-stack-protector - ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) -- LIBS += bin/x86/Release/lua-lib.lib bin/x86/Release/zip-lib.lib bin/x86/Release/zlib-lib.lib bin/x86/Release/curl-lib.lib -lole32 -lws2_32 -ladvapi32 -+ LIBS += bin/x86/Release/lua-lib.lib bin/x86/Release/zip-lib.lib bin/x86/Release/zlib-lib.lib bin/x86/Release/curl-lib.lib -lole32 -lws2_32 -ladvapi32 -lversion -lcrypt32 - LDDEPS += bin/x86/Release/lua-lib.lib bin/x86/Release/zip-lib.lib bin/x86/Release/zlib-lib.lib bin/x86/Release/curl-lib.lib - ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib32 -m32 -flto -s - LINKCMD = $(CC) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS) -@@ -49,7 +49,7 @@ ifeq ($(config),release_x64) - ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -flto -O3 -Wall -Wextra - ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -flto -O3 -Wall -Wextra -fno-stack-protector - ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) -- LIBS += bin/x64/Release/lua-lib.lib bin/x64/Release/zip-lib.lib bin/x64/Release/zlib-lib.lib bin/x64/Release/curl-lib.lib -lole32 -lws2_32 -ladvapi32 -+ LIBS += bin/x64/Release/lua-lib.lib bin/x64/Release/zip-lib.lib bin/x64/Release/zlib-lib.lib bin/x64/Release/curl-lib.lib -lole32 -lws2_32 -ladvapi32 -lversion -lcrypt32 - LDDEPS += bin/x64/Release/lua-lib.lib bin/x64/Release/zip-lib.lib bin/x64/Release/zlib-lib.lib bin/x64/Release/curl-lib.lib - ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib64 -m64 -flto -s - LINKCMD = $(CC) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS) -@@ -76,7 +76,7 @@ - ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m32 -g -Wall -Wextra - ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m32 -g -Wall -Wextra - ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) -- LIBS += bin/x86/Debug/lua-lib.lib bin/x86/Debug/zip-lib.lib bin/x86/Debug/zlib-lib.lib bin/x86/Debug/curl-lib.lib -lole32 -lws2_32 -ladvapi32 -+ LIBS += bin/x86/Debug/lua-lib.lib bin/x86/Debug/zip-lib.lib bin/x86/Debug/zlib-lib.lib bin/x86/Debug/curl-lib.lib -lole32 -lws2_32 -ladvapi32 -lversion -lcrypt32 - LDDEPS += bin/x86/Debug/lua-lib.lib bin/x86/Debug/zip-lib.lib bin/x86/Debug/zlib-lib.lib bin/x86/Debug/curl-lib.lib - ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib32 -m32 - LINKCMD = $(CC) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS) -@@ -103,7 +103,7 @@ - ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -g -Wall -Wextra - ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -g -Wall -Wextra - ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) -- LIBS += bin/x64/Debug/lua-lib.lib bin/x64/Debug/zip-lib.lib bin/x64/Debug/zlib-lib.lib bin/x64/Debug/curl-lib.lib -lole32 -lws2_32 -ladvapi32 -+ LIBS += bin/x64/Debug/lua-lib.lib bin/x64/Debug/zip-lib.lib bin/x64/Debug/zlib-lib.lib bin/x64/Debug/curl-lib.lib -lole32 -lws2_32 -ladvapi32 -lversion -lcrypt32 - LDDEPS += bin/x64/Debug/lua-lib.lib bin/x64/Debug/zip-lib.lib bin/x64/Debug/zlib-lib.lib bin/x64/Debug/curl-lib.lib - ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib64 -m64 - LINKCMD = $(CC) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS) diff --git a/recipes/premake/5.x/test_package/conanfile.py b/recipes/premake/5.x/test_package/conanfile.py index c300eaeb0abb7..0cbf9e48678a6 100644 --- a/recipes/premake/5.x/test_package/conanfile.py +++ b/recipes/premake/5.x/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 = "VirtualBuildEnv" + test_type = "explicit" + + def build_requirements(self): + self.tool_requires(self.tested_reference_str) def test(self): - if not tools.cross_building(self.settings): - self.run("premake5 --version", run_environment=True) + if can_run(self): + self.run("premake5 --version") diff --git a/recipes/premake/5.x/test_v1_package/conanfile.py b/recipes/premake/5.x/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..c300eaeb0abb7 --- /dev/null +++ b/recipes/premake/5.x/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.settings): + self.run("premake5 --version", run_environment=True) diff --git a/recipes/premake/config.yml b/recipes/premake/config.yml index e529cc98c1a62..95e71fee0aa88 100644 --- a/recipes/premake/config.yml +++ b/recipes/premake/config.yml @@ -1,5 +1,5 @@ versions: - "5.0.0-alpha14": - folder: "5.x" + # "5.0.0-beta2": + # folder: "5.x" "5.0.0-alpha15": folder: "5.x" diff --git a/recipes/pretty-name/all/conanfile.py b/recipes/pretty-name/all/conanfile.py index 994d455d12104..3cfd0f89c07f3 100644 --- a/recipes/pretty-name/all/conanfile.py +++ b/recipes/pretty-name/all/conanfile.py @@ -1,33 +1,30 @@ import os -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration -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.files import copy, get +from conan.tools.layout import basic_layout +from conan.tools.scm import Version + +required_conan_version = ">=1.52.0" class PrettyNameConan(ConanFile): name = "pretty-name" + description = "An easy and consistent way how to get type names in C++" license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/Rechip/pretty-name" - description = "An easy and consistent way how to get type names in C++" - topics = ("cpp", "typename") - settings = ["compiler"] + topics = ("cpp", "typename", "header-only") + + package_type = "header-library" + 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) - - def package(self): - self.copy(pattern="LICENSE", dst="licenses", - src=self._source_subfolder) - self.copy(pattern="*", dst="include", - src=os.path.join(self._source_subfolder, "include")) + def _min_cppstd(self): + return 14 @property def _minimum_compilers_version(self): @@ -38,21 +35,39 @@ def _minimum_compilers_version(self): "apple-clang": "5.1", } + 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) + 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( - "pretty-name requires C++14. Your compiler is unknown. Assuming it supports C++14.") - elif tools.Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration( - "pretty-name requires C++14, which your compiler does not support.") + self.output.warning("pretty-name requires C++14. Your compiler is unknown. Assuming it supports C++14.") + elif Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration("pretty-name requires C++14, which your compiler does not support.") - def package_id(self): - self.info.header_only() + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def package(self): + copy(self, "LICENSE", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder) + copy(self, "*", + 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", "pretty-name") + self.cpp_info.set_property("cmake_target_name", "pretty-name::pretty-name") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.names["cmake_find_package"] = "pretty-name" self.cpp_info.names["cmake_find_package_multi"] = "pretty-name" diff --git a/recipes/pretty-name/all/test_package/CMakeLists.txt b/recipes/pretty-name/all/test_package/CMakeLists.txt index 036c165068273..8cdadcdcea642 100644 --- a/recipes/pretty-name/all/test_package/CMakeLists.txt +++ b/recipes/pretty-name/all/test_package/CMakeLists.txt @@ -1,13 +1,10 @@ -cmake_minimum_required(VERSION 3.4) +cmake_minimum_required(VERSION 3.15) project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +find_package(pretty-name REQUIRED CONFIG) -find_package(pretty-name CONFIG REQUIRED) add_executable(${PROJECT_NAME} src/test.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE pretty-name::pretty-name) - set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 14 diff --git a/recipes/pretty-name/all/test_package/conanfile.py b/recipes/pretty-name/all/test_package/conanfile.py index cbe0be23191a2..fae501d0afb9e 100644 --- a/recipes/pretty-name/all/test_package/conanfile.py +++ b/recipes/pretty-name/all/test_package/conanfile.py @@ -1,17 +1,26 @@ +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", "arch", "build_type" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): - self.cmake = CMake(self) - self.cmake.configure() - self.cmake.build() + cmake = CMake(self) + cmake.configure() + cmake.build() 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/pretty-name/all/test_v1_package/CMakeLists.txt b/recipes/pretty-name/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/pretty-name/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/pretty-name/all/test_v1_package/conanfile.py b/recipes/pretty-name/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..cbe0be23191a2 --- /dev/null +++ b/recipes/pretty-name/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +import os +from conans import ConanFile, CMake, tools + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "arch", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + self.cmake = CMake(self) + self.cmake.configure() + 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) diff --git a/recipes/pretty-name/all/test_v1_package/src/test.cpp b/recipes/pretty-name/all/test_v1_package/src/test.cpp new file mode 100644 index 0000000000000..8c761f54ec31c --- /dev/null +++ b/recipes/pretty-name/all/test_v1_package/src/test.cpp @@ -0,0 +1,23 @@ +#include +#include +#include + +struct Test { + int a; + int b; +}; + +namespace Namespace { +template +struct Test { + A a; + B b; +}; +} // namespace Namespace + +int main() { + std::cout << pretty_name::pretty_name() << std::endl; + std::cout << pretty_name::pretty_name>() << std::endl; + + return EXIT_SUCCESS; +} diff --git a/recipes/primesieve/all/conandata.yml b/recipes/primesieve/all/conandata.yml new file mode 100644 index 0000000000000..c600acb0c9606 --- /dev/null +++ b/recipes/primesieve/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "12.1": + url: "https://github.com/kimwalisch/primesieve/archive/refs/tags/v12.1.tar.gz" + sha256: "64e7f5d3ce680262b865c7aec1381ffb13d13f75dd985b964ce33806e1bbf386" + "11.2": + url: "https://github.com/kimwalisch/primesieve/archive/refs/tags/v11.2.tar.gz" + sha256: "86c31bae9c378340b19669eafef8c5e45849adf7b9c92af1d212a2a2bfa0a5db" diff --git a/recipes/primesieve/all/conanfile.py b/recipes/primesieve/all/conanfile.py new file mode 100644 index 0000000000000..b2629bd8f8081 --- /dev/null +++ b/recipes/primesieve/all/conanfile.py @@ -0,0 +1,97 @@ +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 get, copy, rename, rm, rmdir +from conan.tools.microsoft import is_msvc_static_runtime, is_msvc +from conan.tools.scm import Version +import os + + +required_conan_version = ">=1.53.0" + +class PrimesieveConan(ConanFile): + name = "primesieve" + description = "Fast prime number generator" + license = "BSD-2-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/kimwalisch/primesieve" + topics = ("math", "prime-numbers", "sieve-of-eratosthenes") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_multiarch": [True, False], + "with_msvc_crt_static": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_multiarch": True, + "with_msvc_crt_static": False, + } + + @property + 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) + + if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) <= "5": + raise ConanInvalidConfiguration(f"{self.ref} doesn't support GCC<=5 currently. Contributions with fixes are welcome.") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_PRIMESIEVE"] = False + tc.variables["BUILD_DOC"] = False + tc.variables["BUILD_EXAMPLES"] = False + tc.variables["BUILD_TESTS"] = False + tc.variables["WITH_MULTIARCH"] = self.options.with_multiarch + tc.variables["BUILD_STATIC_LIBS"] = not self.options.shared + if is_msvc(self): + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0091"] = "NEW" + tc.variables["WITH_MSVC_CRT_STATIC"] = self.options.with_msvc_crt_static + tc.variables["USE_MSVC_RUNTIME_LIBRARY_DLL"] = not is_msvc_static_runtime(self) + tc.generate() + + def build(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() + 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")) + if is_msvc(self) and self.options.shared: + rename(self, os.path.join(self.package_folder, "lib", "primesieve.dll.lib"), os.path.join(self.package_folder, "lib", "primesieve.lib")) + + def package_info(self): + self.cpp_info.libs = ["primesieve"] + self.cpp_info.set_property("cmake_file_name", "primesieve") + self.cpp_info.set_property("cmake_target_name", "primesieve::primesieve") + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs = ["pthread", "m"] diff --git a/recipes/primesieve/all/test_package/CMakeLists.txt b/recipes/primesieve/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..457aa08f2e6d7 --- /dev/null +++ b/recipes/primesieve/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(primesieve REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE primesieve::primesieve) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/primesieve/all/test_package/conanfile.py b/recipes/primesieve/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fb96656f203 --- /dev/null +++ b/recipes/primesieve/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/primesieve/all/test_package/test_package.cpp b/recipes/primesieve/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..a8281d9952969 --- /dev/null +++ b/recipes/primesieve/all/test_package/test_package.cpp @@ -0,0 +1,15 @@ +#include + +#include +#include +#include + +int main() { + std::vector primes; + primesieve::generate_n_primes(5, &primes); + std::cout << "First 5 primes: "; + for (const auto prime : primes) { + std::cout << prime << ' '; + } + std::cout << '\n'; +} diff --git a/recipes/primesieve/config.yml b/recipes/primesieve/config.yml new file mode 100644 index 0000000000000..c488150c0dff2 --- /dev/null +++ b/recipes/primesieve/config.yml @@ -0,0 +1,5 @@ +versions: + "12.1": + folder: all + "11.2": + folder: all diff --git a/recipes/pro-mdnsd/all/CMakeLists.txt b/recipes/pro-mdnsd/all/CMakeLists.txt deleted file mode 100644 index 361b35d4c17d9..0000000000000 --- a/recipes/pro-mdnsd/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/pro-mdnsd/all/conandata.yml b/recipes/pro-mdnsd/all/conandata.yml index f4bf0e41133c5..3ab03deb075b4 100644 --- a/recipes/pro-mdnsd/all/conandata.yml +++ b/recipes/pro-mdnsd/all/conandata.yml @@ -5,4 +5,3 @@ sources: patches: "0.8.4": - patch_file: "patches/0001-cmake-install-bundle.patch" - base_path: "source_subfolder" diff --git a/recipes/pro-mdnsd/all/conanfile.py b/recipes/pro-mdnsd/all/conanfile.py index 8d1745ad0e35c..feeeec6738fe1 100644 --- a/recipes/pro-mdnsd/all/conanfile.py +++ b/recipes/pro-mdnsd/all/conanfile.py @@ -1,41 +1,37 @@ -from conans import ConanFile, CMake, tools import os import textwrap -required_conan_version = ">=1.43.0" +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.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, save, rename + +required_conan_version = ">=1.53.0" class mdnsdConan(ConanFile): name = "pro-mdnsd" + description = "Improved version of Jeremie Miller's MDNS-SD implementation" license = "BSD-3-Clause" - homepage = "https://github.com/Pro/mdnsd" url = "https://github.com/conan-io/conan-center-index" - description = "Improved version of Jeremie Miller's MDNS-SD implementation" + homepage = "https://github.com/Pro/mdnsd" topics = ("dns", "daemon", "multicast", "embedded", "c") - settings = "os", "compiler", "build_type", "arch" + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { - "fPIC": [True, False], "shared": [True, False], + "fPIC": [True, False], "compile_as_cpp": [True, False], } default_options = { - "fPIC": True, "shared": False, + "fPIC": True, "compile_as_cpp": False, } - 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": @@ -43,36 +39,38 @@ 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.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) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["MDNSD_ENABLE_SANITIZERS"] = False - self._cmake.definitions["MDNSD_COMPILE_AS_CXX"] = self.options.compile_as_cpp - 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["MDNSD_ENABLE_SANITIZERS"] = False + tc.variables["MDNSD_COMPILE_AS_CXX"] = 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() cmake.build() def package(self): - 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")) - tools.rmdir(os.path.join(self.package_folder, "share")) - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "share")) + fix_apple_shared_install_name(self) # TODO: to remove in conan v2 once cmake_find_package* generators removed self._create_cmake_module_alias_targets( @@ -80,28 +78,28 @@ def package(self): {"libmdnsd": "mdnsd::mdnsd"} ) - @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", "mdnsd") - self.cpp_info.set_property("cmake_target_name", "libmdnsd") + self.cpp_info.set_property("cmake_target_name", "libmdnsd") + self.cpp_info.set_property("cmake_target_aliases", ["mdnsd::mdnsd"]) self.cpp_info.libs = ["mdnsd"] if self.settings.os == "Windows": - self.cpp_info.system_libs.append("ws2_32") + self.cpp_info.system_libs = ["ws2_32", "wsock32"] # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.names["cmake_find_package"] = "mdnsd" diff --git a/recipes/pro-mdnsd/all/test_package/CMakeLists.txt b/recipes/pro-mdnsd/all/test_package/CMakeLists.txt index ff7f7e8ca3d71..5a773c9696280 100644 --- a/recipes/pro-mdnsd/all/test_package/CMakeLists.txt +++ b/recipes/pro-mdnsd/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ -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(mdnsd REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} libmdnsd) +target_link_libraries(${PROJECT_NAME} mdnsd::mdnsd) diff --git a/recipes/pro-mdnsd/all/test_package/conanfile.py b/recipes/pro-mdnsd/all/test_package/conanfile.py index 38f4483872d47..ef5d7042163ec 100644 --- a/recipes/pro-mdnsd/all/test_package/conanfile.py +++ b/recipes/pro-mdnsd/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/pro-mdnsd/all/test_v1_package/CMakeLists.txt b/recipes/pro-mdnsd/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/pro-mdnsd/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/pro-mdnsd/all/test_v1_package/conanfile.py b/recipes/pro-mdnsd/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/pro-mdnsd/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/procxx-boost-ext-simd/all/conanfile.py b/recipes/procxx-boost-ext-simd/all/conanfile.py index beacde6952502..58d22448c3e7e 100644 --- a/recipes/procxx-boost-ext-simd/all/conanfile.py +++ b/recipes/procxx-boost-ext-simd/all/conanfile.py @@ -1,61 +1,71 @@ -from conans import ConanFile, CMake, tools import os -required_conan_version = ">=1.33.0" +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 + +required_conan_version = ">=1.52.0" class ProCxxBoostExSimdConan(ConanFile): name = "procxx-boost-ext-simd" - description = ("Portable SIMD computation library - was proposed as a " - "Boost library" - ) - homepage = "https://github.com/procxx/boost.simd" - topics = ("conan", "boost", "simd") + description = "Portable SIMD computation library - was proposed as a Boost library" license = "BSL-1.0" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/procxx/boost.simd" + topics = ("boost", "simd", "header-only") + + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package" no_copy_source = True - - @property - def _source_subfolder(self): - return "source_subfolder" + short_paths = True @property def _min_cppstd(self): - return "11" + return 11 + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - self.requires("boost/1.76.0") + self.requires("boost/1.82.0") + + 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) - - def package_id(self): - self.info.header_only() + check_min_cppstd(self, self._min_cppstd) def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_folder = "boost.simd-" + self.version - os.rename(extracted_folder, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) 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, "*", + 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_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + # this technique was inspired by conan-center's "boost-ex-ut" recipe, # and has been fixed to use the upstream Capitalized `Boost::` # namespace for components - self.cpp_info.names["cmake_find_package"] = "Boost" - self.cpp_info.names["cmake_find_package_multi"] = "Boost" - + self.cpp_info.set_property("cmake_file_name", "Boost.SIMD") + self.cpp_info.set_property("cmake_target_name", "Boost") # The original find_package() name here: + self.cpp_info.components["SIMD"].set_property("cmake_target_name", "Boost::SIMD") + self.cpp_info.components["SIMD"].requires = ["boost::headers"] + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.filenames["cmake_find_package"] = "Boost.SIMD" self.cpp_info.filenames["cmake_find_package_multi"] = "Boost.SIMD" + self.cpp_info.names["cmake_find_package"] = "Boost" + self.cpp_info.names["cmake_find_package_multi"] = "Boost" self.cpp_info.components["SIMD"].names["cmake_find_package"] = "SIMD" - self.cpp_info.components["SIMD"].names["cmake_find_package_multi"] = \ - "SIMD" - self.cpp_info.components["SIMD"].requires = ["boost::headers"] + self.cpp_info.components["SIMD"].names["cmake_find_package_multi"] = "SIMD" diff --git a/recipes/procxx-boost-ext-simd/all/test_package/CMakeLists.txt b/recipes/procxx-boost-ext-simd/all/test_package/CMakeLists.txt index 36ff666d5a74f..f2ca319191721 100644 --- a/recipes/procxx-boost-ext-simd/all/test_package/CMakeLists.txt +++ b/recipes/procxx-boost-ext-simd/all/test_package/CMakeLists.txt @@ -1,19 +1,13 @@ -cmake_minimum_required(VERSION 3.1.0) -project(test_package) - -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup(TARGETS) - -find_package(Boost.SIMD REQUIRED) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) # FIXME: components from Boost.SIMD (target Boost::SIMD) don't work. # It should be: # find_package(BOOST REQUIRED COMPONENTS SIMD) # See https://github.com/conan-io/conan-center-index/issues/6682 for details. -find_package(Boost REQUIRED COMPONENTS date_time) # COMPONENTS SIMD) + +find_package(Boost.SIMD REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} Boost::headers Boost::SIMD) -# 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 11) diff --git a/recipes/procxx-boost-ext-simd/all/test_package/conanfile.py b/recipes/procxx-boost-ext-simd/all/test_package/conanfile.py index 3be12b2d6b0c5..ef5d7042163ec 100644 --- a/recipes/procxx-boost-ext-simd/all/test_package/conanfile.py +++ b/recipes/procxx-boost-ext-simd/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 ProCxxBoostExSimdConan(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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/procxx-boost-ext-simd/all/test_package/test_package.cpp b/recipes/procxx-boost-ext-simd/all/test_package/test_package.cpp index ddf7bb1fb383a..48b397b470c70 100644 --- a/recipes/procxx-boost-ext-simd/all/test_package/test_package.cpp +++ b/recipes/procxx-boost-ext-simd/all/test_package/test_package.cpp @@ -3,17 +3,16 @@ // or running library tests - just only check that package is properly created. // See docs for details: // https://docs.conan.io/en/latest/creating_packages/getting_started.html#the-test-package-folder -#include #include +#include #include namespace bs = boost::simd; -int main() -{ +int main() { using namespace boost::date_time; - bs::pack p{1.f,2.f,3.f,4.f}; - std::cout << "Boost.SIMD test from README.md : " << p + 10*p << "\n"; + bs::pack p{1.f, 2.f, 3.f, 4.f}; + std::cout << "Boost.SIMD test from README.md : " << p + 10 * p << "\n"; std::cout << "Boost.date_time interop test: " << boost::gregorian::date(2021, Aug, 4) << "\n"; return 0; } diff --git a/recipes/procxx-boost-ext-simd/all/test_v1_package/CMakeLists.txt b/recipes/procxx-boost-ext-simd/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/procxx-boost-ext-simd/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/procxx-boost-ext-simd/all/test_v1_package/conanfile.py b/recipes/procxx-boost-ext-simd/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..70611dabf01ae --- /dev/null +++ b/recipes/procxx-boost-ext-simd/all/test_v1_package/conanfile.py @@ -0,0 +1,16 @@ +from conans import ConanFile, CMake, tools +import os + + +class ProCxxBoostExSimdConan(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/proj/all/conandata.yml b/recipes/proj/all/conandata.yml index b3c7bcfc14d9d..376bfb62914e2 100644 --- a/recipes/proj/all/conandata.yml +++ b/recipes/proj/all/conandata.yml @@ -1,31 +1,22 @@ sources: - "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" - "9.0.0": - url: "https://github.com/OSGeo/PROJ/releases/download/9.0.0/proj-9.0.0.tar.gz" - sha256: "0620aa01b812de00b54d6c23e7c5cc843ae2cd129b24fabe411800302172b989" + "9.5.0": + url: "https://github.com/OSGeo/PROJ/releases/download/9.5.0/proj-9.5.0.tar.gz" + sha256: "659af0d558f7c5618c322fde2d3392910806faee8684687959339021fa207d99" + "9.4.1": + url: "https://github.com/OSGeo/PROJ/releases/download/9.4.1/proj-9.4.1.tar.gz" + sha256: "ffe20170ee2b952207adf8a195e2141eab12cda181e49fdeb54425d98c7171d7" + "9.3.1": + url: "https://github.com/OSGeo/PROJ/releases/download/9.3.1/proj-9.3.1.tar.gz" + sha256: "b0f919cb9e1f42f803a3e616c2b63a78e4d81ecfaed80978d570d3a5e29d10bc" + "9.3.0": + url: "https://github.com/OSGeo/PROJ/archive/9.3.0.tar.gz" + sha256: "f48c334eaf56c38d681bcfa37f188f422a562f45a66e6e646a79b4249641ecdb" + "9.2.1": + url: "https://github.com/OSGeo/PROJ/releases/download/9.2.1/proj-9.2.1.tar.gz" + sha256: "15ebf4afa8744b9e6fccb5d571fc9f338dc3adcf99907d9e62d1af815d4971a1" "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" @@ -33,45 +24,22 @@ sources: url: "https://github.com/OSGeo/PROJ/releases/download/6.3.1/proj-6.3.1.tar.gz" sha256: "6de0112778438dcae30fcc6942dee472ce31399b9e5a2b67e8642529868c86f8" patches: - "9.1.0": - - patch_file: "patches/0001-use-cmake-targets-9.1.0.patch" + "9.3.1": + - patch_file: "patches/0001-use-cmake-targets-9.2.1.patch" patch_type: "conan" patch_description: "Use cmake targets" - "9.0.1": - - patch_file: "patches/0001-use-cmake-targets-9.0.1.patch" + "9.3.0": + - patch_file: "patches/0001-use-cmake-targets-9.2.1.patch" patch_type: "conan" patch_description: "Use cmake targets" - "9.0.0": - - patch_file: "patches/0001-use-cmake-targets-9.0.0.patch" + "9.2.1": + - patch_file: "patches/0001-use-cmake-targets-9.2.1.patch" patch_type: "conan" patch_description: "Use cmake targets" - - patch_file: "patches/0002-cmake-configure-proj-pc.patch" - patch_type: "conan" - patch_description: "cmake configure proj pc (fixed by https://github.com/OSGeo/PROJ/pull/3087)" "8.2.1": - patch_file: "patches/0001-use-cmake-targets-8.2.0.patch" patch_type: "conan" patch_description: "Use cmake targets" - "8.2.0": - - patch_file: "patches/0001-use-cmake-targets-8.2.0.patch" - patch_type: "conan" - patch_description: "Use cmake targets" - "8.1.1": - - patch_file: "patches/0001-use-cmake-targets-8.1.1.patch" - patch_type: "conan" - patch_description: "Use cmake targets" - "8.1.0": - - patch_file: "patches/0001-use-cmake-targets-8.1.0.patch" - patch_type: "conan" - patch_description: "Use cmake targets" - "8.0.1": - - patch_file: "patches/0001-use-cmake-targets-8.0.0.patch" - patch_type: "conan" - patch_description: "Use cmake targets" - "8.0.0": - - patch_file: "patches/0001-use-cmake-targets-8.0.0.patch" - patch_type: "conan" - patch_description: "Use cmake targets" "7.2.1": - patch_file: "patches/0001-use-cmake-targets-7.2.1.patch" patch_type: "conan" diff --git a/recipes/proj/all/conanfile.py b/recipes/proj/all/conanfile.py index b4cde813263f5..ffa2b47c51958 100644 --- a/recipes/proj/all/conanfile.py +++ b/recipes/proj/all/conanfile.py @@ -1,7 +1,6 @@ from conan import ConanFile from conan.tools.apple import is_apple_os -from conans.tools import stdcpp_library -from conan.tools.build import cross_building +from conan.tools.build import 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 @@ -9,18 +8,17 @@ from conan.tools.scm import Version import os - -required_conan_version = ">=1.53.0" +required_conan_version = ">=1.60.0 <2 || >=2.0.5" class ProjConan(ConanFile): name = "proj" description = "Cartographic Projections and Coordinate Transformations Library." license = "MIT" - topics = "dsp", "proj", "proj4", "projections", "gis", "geospatial" - homepage = "https://proj.org" url = "https://github.com/conan-io/conan-center-index" - + homepage = "https://proj.org" + topics = ("dsp", "proj", "proj4", "projections", "gis", "geospatial") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -39,6 +37,10 @@ class ProjConan(ConanFile): "build_executables": True, } + @property + def _is_legacy_one_profile(self): + return not hasattr(self, "settings_build") + def export_sources(self): export_conandata_patches(self) @@ -57,25 +59,26 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("nlohmann_json/3.11.2") - self.requires("sqlite3/3.40.0") + self.requires("nlohmann_json/3.11.3") + self.requires("sqlite3/3.44.2") if self.options.get_safe("with_tiff"): - self.requires("libtiff/4.4.0") + self.requires("libtiff/4.6.0") if self.options.get_safe("with_curl"): - self.requires("libcurl/7.86.0") + self.requires("libcurl/[>=7.78.0 <9]") def build_requirements(self): - if hasattr(self, "settings_build") and cross_building(self): - self.tool_requires("sqlite3/3.40.0") + if Version(self.version) >= "9.4.0": + self.tool_requires("cmake/[>=3.16 <4]") + if not self._is_legacy_one_profile: + self.tool_requires("sqlite3/") 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 hasattr(self, "settings_build") and cross_building(self): - env = VirtualBuildEnv(self) - env.generate() - else: + env = VirtualBuildEnv(self) + env.generate() + if self._is_legacy_one_profile: env = VirtualRunEnv(self) env.generate(scope="build") @@ -103,7 +106,10 @@ def generate(self): 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) + if self.settings.os == "Linux": + # Workaround for: https://github.com/conan-io/conan/issues/13560 + libdirs_host = [l for dependency in self.dependencies.host.values() for l in dependency.cpp_info.aggregated_components().libdirs] + tc.variables["CMAKE_BUILD_RPATH"] = ";".join(libdirs_host) tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" tc.generate() @@ -114,19 +120,19 @@ def _patch_sources(self): apply_conandata_patches(self) 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)") + if Version(self.version) < "9.4.0": + 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 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)", - "") + if "7.1.0" <= Version(self.version) < "9.0.0": + replace_in_file(self, cmakelists, "set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)", "") # Aggressive workaround against SIP on macOS, to handle sqlite3 executable # linked to shared sqlite3 lib @@ -137,10 +143,10 @@ def _patch_sources(self): 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: + if self._is_legacy_one_profile: lib_paths = self.dependencies["sqlite3"].cpp_info.libdirs + else: + lib_paths = self.dependencies.build["sqlite3"].cpp_info.libdirs replace_in_file(self, os.path.join(self.source_folder, "data", cmake_sqlite_call), f"COMMAND {pattern}", @@ -151,6 +157,11 @@ def _patch_sources(self): if Version(self.version) < "8.1.0": rmdir(self, os.path.join(self.source_folder, "include", "proj", "internal", "nlohmann")) + # Remove warning flags that are unfamiliar to GCC 5 + if Version(self.version) >= "9.0" and self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "8.0": + replace_in_file(self, os.path.join(self.source_folder, "src", "CMakeLists.txt"), "${PROJ_C_WARN_FLAGS}", "") + replace_in_file(self, os.path.join(self.source_folder, "src", "CMakeLists.txt"), "${PROJ_CXX_WARN_FLAGS}", "") + def build(self): self._patch_sources() cmake = CMake(self) @@ -170,7 +181,6 @@ def package(self): 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 = Version(self.version) cmake_config_filename = "proj" if proj_version >= "7.0.0" else "proj4" @@ -181,9 +191,6 @@ def package_info(self): 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.components["projlib"].libs = collect_libs(self) if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["projlib"].system_libs.append("m") @@ -193,9 +200,11 @@ 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 stdcpp_library(self): - self.cpp_info.components["projlib"].system_libs.append(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") @@ -208,21 +217,23 @@ def package_info(self): 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(f"Prepending to PROJ_LIB environment variable: {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_LIB", res_path) - 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.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.env_info.PATH.append(os.path.join(self.package_folder, "bin")) 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 39da5da53f223..0000000000000 --- a/recipes/proj/all/patches/0001-use-cmake-targets-8.0.0.patch +++ /dev/null @@ -1,40 +0,0 @@ -diff -ru a/CMakeLists.txt b/CMakeLists.txt ---- a/CMakeLists.txt 2021-02-26 02:37:25.000000000 +0800 -+++ b/CMakeLists.txt 2022-12-14 21:26:48.404915901 +0800 -@@ -121,6 +121,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 2021-02-20 19:15:52.000000000 +0800 -+++ b/src/lib_proj.cmake 2022-12-14 21:25:41.713734988 +0800 -@@ -394,21 +394,18 @@ - 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 nlohmann_json::nlohmann_json PRIVATE SQLite::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 332c0650174f9..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 SQLite::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 bdb11d748aa62..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 SQLite::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-9.0.0.patch b/recipes/proj/all/patches/0001-use-cmake-targets-9.0.0.patch deleted file mode 100644 index c7cf8eab51037..0000000000000 --- a/recipes/proj/all/patches/0001-use-cmake-targets-9.0.0.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- a/src/lib_proj.cmake -+++ b/src/lib_proj.cmake -@@ -444,8 +444,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) -@@ -455,16 +454,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-9.0.1.patch b/recipes/proj/all/patches/0001-use-cmake-targets-9.0.1.patch deleted file mode 100644 index 6920410551838..0000000000000 --- a/recipes/proj/all/patches/0001-use-cmake-targets-9.0.1.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- a/src/lib_proj.cmake -+++ b/src/lib_proj.cmake -@@ -444,8 +444,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) -@@ -455,16 +454,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/patches/0001-use-cmake-targets-9.1.0.patch b/recipes/proj/all/patches/0001-use-cmake-targets-9.1.0.patch deleted file mode 100644 index 0a4659e2173fa..0000000000000 --- a/recipes/proj/all/patches/0001-use-cmake-targets-9.1.0.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- a/src/src/lib_proj.cmake 2022-08-29 01:53:05.000000000 +0800 -+++ b/src/lib_proj.cmake 2022-11-09 00:03:25.165493175 +0800 -@@ -447,8 +447,7 @@ - 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 +458,14 @@ - - 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/patches/0001-use-cmake-targets-9.2.1.patch b/recipes/proj/all/patches/0001-use-cmake-targets-9.2.1.patch new file mode 100644 index 0000000000000..0459aba7efc51 --- /dev/null +++ b/recipes/proj/all/patches/0001-use-cmake-targets-9.2.1.patch @@ -0,0 +1,12 @@ +--- a/src/lib_proj.cmake ++++ b/src/lib_proj.cmake +@@ -438,8 +438,7 @@ + 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) diff --git a/recipes/proj/all/patches/0002-cmake-configure-proj-pc.patch b/recipes/proj/all/patches/0002-cmake-configure-proj-pc.patch deleted file mode 100644 index e39909dc403a9..0000000000000 --- a/recipes/proj/all/patches/0002-cmake-configure-proj-pc.patch +++ /dev/null @@ -1,13 +0,0 @@ -fixed by https://github.com/OSGeo/PROJ/pull/3087 - ---- a/cmake/ProjUtilities.cmake -+++ b/cmake/ProjUtilities.cmake -@@ -98,7 +98,7 @@ function(configure_proj_pc) - list(APPEND EXTRA_LIBS -lole32 -lshell32) - else() - set(cxx_libs "${CMAKE_CXX_IMPLICIT_LINK_LIBRARIES}") -- list(REMOVE_ITEM cxx_libs ${CMAKE_C_IMPLICIT_LINK_LIBRARIES}) -+ list(REMOVE_ITEM cxx_libs ${CMAKE_C_IMPLICIT_LINK_LIBRARIES} CMake_3.19_quirk) - foreach(lib IN LISTS cxx_libs) - list(APPEND EXTRA_LIBS "-l${lib}") - endforeach() diff --git a/recipes/proj/all/test_package/CMakeLists.txt b/recipes/proj/all/test_package/CMakeLists.txt index 68d47d66efc39..4fa8bd93600fa 100644 --- a/recipes/proj/all/test_package/CMakeLists.txt +++ b/recipes/proj/all/test_package/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.8) -project(test_package C) +project(test_package LANGUAGES C) add_executable(test_package test_package.c) if(PROJ_VERSION_GE_7) diff --git a/recipes/proj/config.yml b/recipes/proj/config.yml index 0024c64a0bcb7..d52e34a81ac98 100644 --- a/recipes/proj/config.yml +++ b/recipes/proj/config.yml @@ -1,21 +1,15 @@ versions: - "9.1.0": + "9.5.0": folder: "all" - "9.0.1": + "9.4.1": folder: "all" - "9.0.0": + "9.3.1": folder: "all" - "8.2.1": - folder: "all" - "8.2.0": - folder: "all" - "8.1.1": + "9.3.0": folder: "all" - "8.1.0": + "9.2.1": folder: "all" - "8.0.1": - folder: "all" - "8.0.0": + "8.2.1": folder: "all" "7.2.1": folder: "all" diff --git a/recipes/prometheus-cpp/all/conandata.yml b/recipes/prometheus-cpp/all/conandata.yml index a1e0c249c424c..f087398f73aad 100644 --- a/recipes/prometheus-cpp/all/conandata.yml +++ b/recipes/prometheus-cpp/all/conandata.yml @@ -1,22 +1,13 @@ sources: + "1.3.0": + url: "https://github.com/jupp0r/prometheus-cpp/archive/v1.3.0.tar.gz" + sha256: "ac6e958405a29fbbea9db70b00fa3c420e16ad32e1baf941ab233ba031dd72ee" + "1.2.4": + url: "https://github.com/jupp0r/prometheus-cpp/archive/v1.2.4.tar.gz" + sha256: "48dbad454d314b836cc667ec4def93ec4a6e4255fc8387c20cacb3b8b6faee30" "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" - "1.0.0": - url: "https://github.com/jupp0r/prometheus-cpp/archive/v1.0.0.tar.gz" - sha256: "07018db604ea3e61f5078583e87c80932ea10c300d979061490ee1b7dc8e3a41" - "0.12.3": - url: "https://github.com/jupp0r/prometheus-cpp/archive/v0.12.3.tar.gz" - sha256: "e021e76e8e933672f1af0d223307282004f585a054354f8d894db39debddff8e" - "0.12.1": - url: "https://github.com/jupp0r/prometheus-cpp/archive/v0.12.1.tar.gz" - sha256: "2102609457f812dbeaaafd55736461fd0538fc7e7568174b1cdec43399dbded4" - "0.11.0": - url: "https://github.com/jupp0r/prometheus-cpp/archive/v0.11.0.tar.gz" - sha256: "aab4ef8342319f631969e01b8c41e355704847cbe76131cb1dd5ea1862000bda" -patches: - "0.11.0": - - patch_file: "patches/0001-include-limits.patch" diff --git a/recipes/prometheus-cpp/all/conanfile.py b/recipes/prometheus-cpp/all/conanfile.py index 413fb7b3f847a..06f45f304071f 100644 --- a/recipes/prometheus-cpp/all/conanfile.py +++ b/recipes/prometheus-cpp/all/conanfile.py @@ -1,14 +1,13 @@ 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.files import 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 import os -required_conan_version = ">=1.53.0" +required_conan_version = ">=2.0" class PrometheusCppConan(ConanFile): name = "prometheus-cpp" @@ -17,7 +16,7 @@ class PrometheusCppConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/jupp0r/prometheus-cpp" topics = ("metrics", "prometheus", "networking") - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -36,18 +35,7 @@ class PrometheusCppConan(ConanFile): @property def _min_cppstd(self): - return 11 if Version(self.version) < "1.1.0" else 14 - - @property - def _compilers_minimum_version(self): - return { - "gcc": "7", - "clang": "7", - "apple-clang": "10", - } - - def export_sources(self): - export_conandata_patches(self) + return "14" if Version(self.version) == "1.1.0" else "11" def config_options(self): if self.settings.os == "Windows": @@ -64,27 +52,18 @@ def layout(self): def requirements(self): if self.options.with_pull: - self.requires("civetweb/1.15") + self.requires("civetweb/1.16") if self.options.with_push: - self.requires("libcurl/7.86.0") + self.requires("libcurl/[>=7.78.0 <9]", transitive_headers=True) if self.options.get_safe("with_compression"): - self.requires("zlib/1.2.13") + self.requires("zlib/[>=1.2.11 <2]") def validate(self): 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): - 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) @@ -102,7 +81,6 @@ def generate(self): deps.generate() def build(self): - apply_conandata_patches(self) cmake = CMake(self) cmake.configure() cmake.build() diff --git a/recipes/prometheus-cpp/all/test_package/CMakeLists.txt b/recipes/prometheus-cpp/all/test_package/CMakeLists.txt index 0df7da5ba0a1f..f9aa39a0fc4fd 100644 --- a/recipes/prometheus-cpp/all/test_package/CMakeLists.txt +++ b/recipes/prometheus-cpp/all/test_package/CMakeLists.txt @@ -5,8 +5,8 @@ find_package(prometheus-cpp CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) 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() +if(${prometheus-cpp_VERSION} VERSION_EQUAL "1.1.0") target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) +else() + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) endif() diff --git a/recipes/prometheus-cpp/config.yml b/recipes/prometheus-cpp/config.yml index 3bfa3902dafa5..50ed34cd33932 100644 --- a/recipes/prometheus-cpp/config.yml +++ b/recipes/prometheus-cpp/config.yml @@ -1,13 +1,9 @@ versions: - "1.1.0": - folder: all - "1.0.1": + "1.3.0": folder: all - "1.0.0": + "1.2.4": folder: all - "0.12.3": - folder: all - "0.12.1": + "1.1.0": folder: all - "0.11.0": + "1.0.1": folder: all diff --git a/recipes/proposal/all/CMakeLists.txt b/recipes/proposal/all/CMakeLists.txt deleted file mode 100644 index b71c882d9d33f..0000000000000 --- a/recipes/proposal/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/proposal/all/conandata.yml b/recipes/proposal/all/conandata.yml index 9822195b42ce2..6fbf698e7992a 100644 --- a/recipes/proposal/all/conandata.yml +++ b/recipes/proposal/all/conandata.yml @@ -1,37 +1,10 @@ sources: - "7.0.2": - url: "https://github.com/tudo-astroparticlephysics/PROPOSAL/archive/refs/tags/7.0.2.tar.gz" - sha256: "8166ffca150abce77cc4254343bb89d3476e17910e96fa4936b87dafcc72d592" - "7.0.4": - url: "https://github.com/tudo-astroparticlephysics/PROPOSAL/archive/refs/tags/7.0.4.tar.gz" - sha256: "1442b9f5d8824e7794e97a2eca3f5f109e33c423a37714ada9ad98435b4d4b01" - "7.0.5": - url: "https://github.com/tudo-astroparticlephysics/PROPOSAL/archive/refs/tags/7.0.5.tar.gz" - sha256: "232f84e410f439e6bc1b721fc65280906e9f6ad5b39490561870d42a1ee1af17" - "7.0.7": - url: "https://github.com/tudo-astroparticlephysics/PROPOSAL/archive/refs/tags/7.0.7.tar.gz" - sha256: "e366e9280fbe99e68bc5b31a74f51610e27ca8a646dff28e883573893572ab75" - "7.1.0": - url: "https://github.com/tudo-astroparticlephysics/PROPOSAL/archive/refs/tags/7.1.0.tar.gz" - sha256: "98faba7cd9d743dae2a8bec70b1c4a382339b9fa40b71fda2936c9d7054d7a85" - "7.1.1": - url: "https://github.com/tudo-astroparticlephysics/PROPOSAL/archive/refs/tags/7.1.1.tar.gz" - sha256: "090e885d6f241b87a98234571cc1bd2ff935933365717e327602ea37f4d3548a" - "7.2.1": - url: "https://github.com/tudo-astroparticlephysics/PROPOSAL/archive/refs/tags/7.2.1.tar.gz" - sha256: "279c1b897c8ae426a493ca77e01c8cfd47e8cd313f3e35ed3ddf098dcccdeeda" - "7.3.0": - url: "https://github.com/tudo-astroparticlephysics/PROPOSAL/archive/refs/tags/7.3.0.tar.gz" - sha256: "fa3763fee656164e5f3a7d6a11f08771dd70700adb93de9db4625ad981e0defb" - "7.3.1": - url: "https://github.com/tudo-astroparticlephysics/PROPOSAL/archive/refs/tags/7.3.1.tar.gz" - sha256: "260426f71226c888832a6da47c55c05dab31b8240dbbc67b4b2466af24d962d3" - "7.4.0": - url: "https://github.com/tudo-astroparticlephysics/PROPOSAL/archive/refs/tags/7.4.0.tar.gz" - sha256: "34865a84052c670fbc4554361acef716655906f65f5bba88e3fd73dff92989de" - "7.4.1": - url: "https://github.com/tudo-astroparticlephysics/PROPOSAL/archive/refs/tags/7.4.1.tar.gz" - sha256: "e6ff9749f402dd77f320a2a28b77a45636cbe186f926d9b5a7b54ea6ee631ada" + "7.6.2": + url: "https://github.com/tudo-astroparticlephysics/PROPOSAL/archive/refs/tags/7.6.2.tar.gz" + sha256: "52e91807009b8e610deee485ea57523482cf5626a28f3e42b747dc58d9f505d8" + "7.5.1": + url: "https://github.com/tudo-astroparticlephysics/PROPOSAL/archive/refs/tags/7.5.1.tar.gz" + sha256: "2a283bfc335c4b6b01d2acc1eea1a5e4c456bd3dd11e41ef24ca3d955c9655a3" "7.4.2": url: "https://github.com/tudo-astroparticlephysics/PROPOSAL/archive/refs/tags/7.4.2.tar.gz" sha256: "f0db44c96a80a6ce3dda02c598574f5f0209376bd2c6c176797710da8eb3e108" diff --git a/recipes/proposal/all/conanfile.py b/recipes/proposal/all/conanfile.py index ee6b6552ac5bc..8f555fa886660 100644 --- a/recipes/proposal/all/conanfile.py +++ b/recipes/proposal/all/conanfile.py @@ -1,15 +1,20 @@ -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.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 -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class PROPOSALConan(ConanFile): name = "proposal" homepage = "https://github.com/tudo-astroparticlephysics/PROPOSAL" license = "LGPL-3.0" - exports_sources = "CMakeLists.txt" + package_type = "library" url = "https://github.com/conan-io/conan-center-index" description = "monte Carlo based lepton and photon propagator" topics = ("propagator", "lepton", "photon", "stochastic") @@ -26,79 +31,80 @@ class PROPOSALConan(ConanFile): "with_python": False, } - generators = "cmake", "cmake_find_package" - _cmake = None - @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return "14" @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] + def _minimum_compilers_version(self): + return { + "Visual Studio": "15", + "msvc": "191", + "gcc": "5", + "clang": "5", + "apple-clang": "5", + } 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 layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("cubicinterpolation/0.1.4") - self.requires("spdlog/1.9.2") - self.requires("nlohmann_json/3.10.5") + # cubicinterpolation: headers are transitively included, and function calls are made + # from implementation in headers (templates) + self.requires("cubicinterpolation/0.1.5", transitive_headers=True, transitive_libs=True) + # spdlog: requires transitive_libs due to direct calls to functionality from headers + self.requires("spdlog/[>=1.11 <2]", transitive_headers=True, transitive_libs=True) + # nlohmann_json: public headers include json.hpp and json_fwd.hpp + self.requires("nlohmann_json/[~3.11]", transitive_headers=True) if self.options.with_python: - self.requires("pybind11/2.9.1") - - @property - def _minimum_compilers_version(self): - return {"Visual Studio": "15", "gcc": "5", "clang": "5", "apple-clang": "5"} + self.requires("pybind11/2.10.1") def validate(self): - if self._is_msvc and self.options.shared: + if is_msvc(self) and self.options.shared: raise ConanInvalidConfiguration( "Can not build shared library on Visual Studio." ) 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( - "PROPOSAL requires C++14. Your compiler is unknown. Assuming it supports C++14." - ) - elif tools.Version(self.settings.compiler.version) < minimum_version: + if minimum_version and Version(self.settings.compiler.version) < minimum_version: raise ConanInvalidConfiguration( - "PROPOSAL requires gcc >= 5, clang >= 5 or Visual Studio >= 15 as a compiler!" + 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 self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BUILD_TESTING"] = False - self._cmake.definitions["BUILD_PYTHON"] = self.options.with_python - self._cmake.definitions["BUILD_DOCUMENTATION"] = False - self._cmake.configure() - return self._cmake + get(self, **self.conan_data["sources"][self.version], strip_root=True) def build(self): - 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", self.source_folder, 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 generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["BUILD_TESTING"] = False + tc.cache_variables["BUILD_PYTHON"] = self.options.with_python + tc.cache_variables["BUILD_DOCUMENTATION"] = False + tc.generate() + deps = CMakeDeps(self) + deps.generate() def package_info(self): self.cpp_info.set_property("cmake_file_name", "PROPOSAL") diff --git a/recipes/proposal/all/test_package/CMakeLists.txt b/recipes/proposal/all/test_package/CMakeLists.txt index 705e044c0e357..7263fd9e7da18 100644 --- a/recipes/proposal/all/test_package/CMakeLists.txt +++ b/recipes/proposal/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(PROPOSAL REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} PROPOSAL::PROPOSAL) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14) +target_link_libraries(${PROJECT_NAME} PRIVATE PROPOSAL::PROPOSAL) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/proposal/all/test_package/conanfile.py b/recipes/proposal/all/test_package/conanfile.py index 38f4483872d47..ab249f266b429 100644 --- a/recipes/proposal/all/test_package/conanfile.py +++ b/recipes/proposal/all/test_package/conanfile.py @@ -1,10 +1,17 @@ -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 = "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 +19,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/proposal/all/test_package/test_package.cpp b/recipes/proposal/all/test_package/test_package.cpp index da2ad7c9c7773..76ca13b1a3245 100644 --- a/recipes/proposal/all/test_package/test_package.cpp +++ b/recipes/proposal/all/test_package/test_package.cpp @@ -1,4 +1,5 @@ #include "PROPOSAL/PROPOSAL.h" +#include "PROPOSAL/Logging.h" #include #include @@ -18,4 +19,6 @@ int main() << particle.name << " in " << target.GetName() << " is: " << dEdx << " MeV * cm^2 / g" << std::endl; } + + PROPOSAL::Logging::Get("proposal.conan_test_package")->warn("logging test"); } diff --git a/recipes/proposal/all/test_v1_package/CMakeLists.txt b/recipes/proposal/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..7ea0378c83fe1 --- /dev/null +++ b/recipes/proposal/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/proposal/all/test_v1_package/conanfile.py b/recipes/proposal/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/proposal/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/proposal/config.yml b/recipes/proposal/config.yml index a8df5c3026f1b..eeec1942674b6 100644 --- a/recipes/proposal/config.yml +++ b/recipes/proposal/config.yml @@ -1,25 +1,7 @@ versions: - "7.0.2": + "7.6.2": folder: all - "7.0.4": - folder: all - "7.0.5": - folder: all - "7.0.7": - folder: all - "7.1.0": - folder: all - "7.1.1": - folder: all - "7.2.1": - folder: all - "7.3.0": - folder: all - "7.3.1": - folder: all - "7.4.0": - folder: all - "7.4.1": + "7.5.1": folder: all "7.4.2": folder: all diff --git a/recipes/protobuf-c/all/conandata.yml b/recipes/protobuf-c/all/conandata.yml new file mode 100644 index 0000000000000..76c13c0bb2057 --- /dev/null +++ b/recipes/protobuf-c/all/conandata.yml @@ -0,0 +1,17 @@ +sources: + "1.5.0": + url: "https://github.com/protobuf-c/protobuf-c/archive/v1.5.0.tar.gz" + sha256: "d4cb022d55f49796959b07a9d83040822e39129bc0eb28f4e8301da17d758f62" + "1.4.1": + url: https://github.com/protobuf-c/protobuf-c/archive/v1.4.1.tar.gz + sha256: 99be336cdb15dfc5827efe34e5ac9aaa962e2485db547dd254d2a122a7d23102 +patches: + "1.5.0": + - patch_file: "patches/1.5.0-disable-msvc-runtime.patch" + patch_description: "disable msvc runtime setting" + patch_type: conan + "1.4.1": + # TODO: This won't be needed once upstream PR (https://github.com/protobuf-c/protobuf-c/pull/555) gets merged + - patch_file: "patches/1.4.1-cmake-protobuf-target.patch" + patch_description: "Fit Protobuf directory variables to official targets" + patch_type: conan diff --git a/recipes/protobuf-c/all/conanfile.py b/recipes/protobuf-c/all/conanfile.py new file mode 100644 index 0000000000000..2111ba51320e0 --- /dev/null +++ b/recipes/protobuf-c/all/conanfile.py @@ -0,0 +1,108 @@ +from conan import ConanFile, __version__ as conan_version +from conan.tools.scm import Version +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.build import check_min_cppstd +from conan.tools.env import VirtualBuildEnv +import os + + +required_conan_version = ">=1.53.0" + + +class ProtobufCConan(ConanFile): + name = "protobuf-c" + description = "Protocol Buffers implementation in C" + license = "LicenseRef-LICENSE" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/protobuf-c/protobuf-c" + topics = ("protocol-buffers", "protocol-compiler", "serialization", "protocol-compiler") + # package_type = "library" + package_type = "static-library" + settings = "os", "arch", "compiler", "build_type" + options = { + "fPIC": [True, False], + "with_proto3": [True, False], + "with_protoc": [True, False] + } + default_options = { + "fPIC": True, + "with_proto3": True, + "with_protoc": True + } + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 14) + + def export_sources(self): + export_conandata_patches(self) + # TODO: This won't be needed once upstream PR (https://github.com/protobuf-c/protobuf-c/pull/555) gets merged + copy(self, "protobuf-c.cmake", src=self.recipe_folder, dst=self.export_sources_folder, keep_path=False) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def layout(self): + cmake_layout(self, src_folder="src") + + def build_requirements(self): + # Since the package using protobuf-c will also need to use protoc (part of protobuf), + # we want to make sure the protobuf dep is visible, but the visible param is only available in v2 + # TODO: Remove after dropping Conan 1.x + if conan_version >= Version("2"): + self.tool_requires("protobuf/3.21.9", visible=True) + else: + self.tool_requires("protobuf/3.21.9") + if Version(self.version) >= "1.5.0": + self.tool_requires("cmake/[>=3.19 <4]") + + def requirements(self): + self.requires("protobuf/3.21.9") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["BUILD_PROTO3"] = self.options.with_proto3 + tc.cache_variables["BUILD_PROTOC"] = self.options.with_protoc + # FIXME: Add shared library support. It was just too hairy to figure out initially + # tc.cache_variables["BUILD_SHARED_LIBS"] = self.options.shared + tc.cache_variables["BUILD_TESTS"] = False + tc.generate() + tc = CMakeDeps(self) + tc.generate() + tc = VirtualBuildEnv(self) + tc.generate(scope="build") + + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, "build-cmake")) + cmake.build() + + @property + def _cmake_install_base_path(self): + return os.path.join("lib", "cmake", "protobuf-c") + + def package(self): + cmake = CMake(self) + cmake.install() + copy(self, pattern="LICENSE", 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, "lib", "cmake")) + + # TODO: This won't be needed once upstream PR (https://github.com/protobuf-c/protobuf-c/pull/555) gets merged + copy(self, "protobuf-c.cmake", dst=os.path.join(self.package_folder, self._cmake_install_base_path), src=self.export_sources_folder) + + def package_info(self): + # upstream CMake config file name and target name matches the package name + self.cpp_info.libs = ["protobuf-c"] + self.cpp_info.builddirs.append(self._cmake_install_base_path) + # TODO: This won't be needed once upstream PR (https://github.com/protobuf-c/protobuf-c/pull/555) gets merged + self.cpp_info.set_property("cmake_build_modules", [ + os.path.join(self._cmake_install_base_path, "protobuf-c.cmake") + ]) + self.buildenv_info.append_path("PATH", os.path.join(self.package_folder, "bin")) diff --git a/recipes/protobuf-c/all/patches/1.4.1-cmake-protobuf-target.patch b/recipes/protobuf-c/all/patches/1.4.1-cmake-protobuf-target.patch new file mode 100644 index 0000000000000..fb664a553f528 --- /dev/null +++ b/recipes/protobuf-c/all/patches/1.4.1-cmake-protobuf-target.patch @@ -0,0 +1,56 @@ +diff --git a/build-cmake/CMakeLists.txt b/build-cmake/CMakeLists.txt +--- a/build-cmake/CMakeLists.txt (revision c8f1ff465b55b00114af07d15ceca2aeedee1a4b) ++++ b/build-cmake/CMakeLists.txt (revision cabf46a8ab076fdce0c7bef4e393ac7819bb4b68) +@@ -63,7 +63,6 @@ + endif (MSVC AND NOT BUILD_SHARED_LIBS) + + FIND_PACKAGE(Protobuf REQUIRED) +-INCLUDE_DIRECTORIES(${PROTOBUF_INCLUDE_DIR}) + + if (BUILD_PROTO3) + ADD_DEFINITIONS(-DHAVE_PROTO3) +@@ -92,16 +91,16 @@ + SET(CMAKE_CXX_STANDARD_REQUIRED ON) + SET(CMAKE_CXX_EXTENSIONS OFF) + ADD_CUSTOM_COMMAND(OUTPUT protobuf-c/protobuf-c.pb.cc protobuf-c/protobuf-c.pb.h +- COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} ++ COMMAND ${Protobuf_PROTOC_EXECUTABLE} + ARGS --cpp_out ${CMAKE_BINARY_DIR} -I${MAIN_DIR} ${MAIN_DIR}/protobuf-c/protobuf-c.proto) + FILE(GLOB PROTOC_GEN_C_SRC ${MAIN_DIR}/protoc-c/*.h ${MAIN_DIR}/protoc-c/*.cc ) + ADD_EXECUTABLE(protoc-gen-c ${PROTOC_GEN_C_SRC} protobuf-c/protobuf-c.pb.cc protobuf-c/protobuf-c.pb.h) + +-TARGET_LINK_LIBRARIES(protoc-gen-c ${PROTOBUF_PROTOC_LIBRARY} ${PROTOBUF_LIBRARY}) ++TARGET_LINK_LIBRARIES(protoc-gen-c protobuf::libprotoc protobuf::libprotobuf) + + IF (MSVC AND BUILD_SHARED_LIBS) + TARGET_COMPILE_DEFINITIONS(protoc-gen-c PRIVATE -DPROTOBUF_USE_DLLS) +- GET_FILENAME_COMPONENT(PROTOBUF_DLL_DIR ${PROTOBUF_PROTOC_EXECUTABLE} DIRECTORY) ++ GET_FILENAME_COMPONENT(PROTOBUF_DLL_DIR ${Protobuf_PROTOC_EXECUTABLE} DIRECTORY) + FILE(GLOB PROTOBUF_DLLS ${PROTOBUF_DLL_DIR}/*.dll) + FILE(COPY ${PROTOBUF_DLLS} DESTINATION ${CMAKE_BINARY_DIR}) + ENDIF (MSVC AND BUILD_SHARED_LIBS) +@@ -114,7 +113,7 @@ + + FUNCTION(GENERATE_TEST_SOURCES PROTO_FILE SRC HDR) + ADD_CUSTOM_COMMAND(OUTPUT ${SRC} ${HDR} +- COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} ++ COMMAND ${Protobuf_PROTOC_EXECUTABLE} + ARGS --plugin=$ -I${MAIN_DIR} ${PROTO_FILE} --c_out=${CMAKE_BINARY_DIR} + DEPENDS protoc-gen-c) + ENDFUNCTION() +@@ -130,13 +129,13 @@ + + + ADD_CUSTOM_COMMAND(OUTPUT t/test-full.pb.cc t/test-full.pb.h +- COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} ++ COMMAND ${Protobuf_PROTOC_EXECUTABLE} + ARGS --cpp_out ${CMAKE_BINARY_DIR} -I${MAIN_DIR} ${TEST_DIR}/test-full.proto) + + GENERATE_TEST_SOURCES(${TEST_DIR}/test-full.proto t/test-full.pb-c.c t/test-full.pb-c.h) + + ADD_EXECUTABLE(cxx-generate-packed-data ${TEST_DIR}/generated-code2/cxx-generate-packed-data.cc t/test-full.pb.h t/test-full.pb.cc protobuf-c/protobuf-c.pb.cc protobuf-c/protobuf-c.pb.h) +-TARGET_LINK_LIBRARIES(cxx-generate-packed-data ${PROTOBUF_LIBRARY}) ++TARGET_LINK_LIBRARIES(cxx-generate-packed-data protobuf::libprotobuf) + IF (MSVC AND BUILD_SHARED_LIBS) + TARGET_COMPILE_DEFINITIONS(cxx-generate-packed-data PRIVATE -DPROTOBUF_USE_DLLS) + ENDIF (MSVC AND BUILD_SHARED_LIBS) diff --git a/recipes/protobuf-c/all/patches/1.5.0-disable-msvc-runtime.patch b/recipes/protobuf-c/all/patches/1.5.0-disable-msvc-runtime.patch new file mode 100644 index 0000000000000..babf079071444 --- /dev/null +++ b/recipes/protobuf-c/all/patches/1.5.0-disable-msvc-runtime.patch @@ -0,0 +1,13 @@ +diff --git a/build-cmake/CMakeLists.txt b/build-cmake/CMakeLists.txt +index f46fba7..bac3ce4 100644 +--- a/build-cmake/CMakeLists.txt ++++ b/build-cmake/CMakeLists.txt +@@ -68,7 +68,7 @@ if(MSVC) + + # Allow matching protobuf runtime dependency + if(NOT BUILD_SHARED_LIBS) +- set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") ++# set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + endif(NOT BUILD_SHARED_LIBS) + + ENDIF() diff --git a/recipes/protobuf-c/all/protobuf-c.cmake b/recipes/protobuf-c/all/protobuf-c.cmake new file mode 100644 index 0000000000000..ad1143afc4edc --- /dev/null +++ b/recipes/protobuf-c/all/protobuf-c.cmake @@ -0,0 +1,72 @@ +find_package(Protobuf REQUIRED) +find_program(PROTOC_GEN_C protoc-gen-c REQUIRED) + +function(protobuf_generate_c SRCS HDRS) + cmake_parse_arguments(protobuf_generate_c "" "EXPORT_MACRO;DESCRIPTORS" "" + ${ARGN}) + + set(_proto_files "${protobuf_generate_c_UNPARSED_ARGUMENTS}") + if(NOT _proto_files) + message( + SEND_ERROR "Error: protobuf_generate_c() called without any proto files") + return() + endif() + + if(protobuf_generate_c_APPEND_PATH) + set(_append_arg APPEND_PATH) + endif() + + if(protobuf_generate_c_DESCRIPTORS) + set(_descriptors DESCRIPTORS) + endif() + + if(DEFINED Protobuf_IMPORT_DIRS) + set(_import_arg IMPORT_DIRS ${Protobuf_IMPORT_DIRS}) + endif() + + set(_outvar) + protobuf_generate( + ${_append_arg} + ${_descriptors} + LANGUAGE + c + PLUGIN + ${PROTOC_GEN_C} + GENERATE_EXTENSIONS + .pb-c.h + .pb-c.c + EXPORT_MACRO + ${protobuf_generate_c_EXPORT_MACRO} + OUT_VAR + _outvar + ${_import_arg} + PROTOS + ${_proto_files}) + + set(${SRCS}) + set(${HDRS}) + if(protobuf_generate_c_DESCRIPTORS) + set(${protobuf_generate_c_DESCRIPTORS}) + endif() + + foreach(_file ${_outvar}) + if(_file MATCHES "c$") + list(APPEND ${SRCS} ${_file}) + elseif(_file MATCHES "desc$") + list(APPEND ${protobuf_generate_c_DESCRIPTORS} ${_file}) + else() + list(APPEND ${HDRS} ${_file}) + endif() + endforeach() + set(${SRCS} + ${${SRCS}} + PARENT_SCOPE) + set(${HDRS} + ${${HDRS}} + PARENT_SCOPE) + if(protobuf_generate_c_DESCRIPTORS) + set(${protobuf_generate_c_DESCRIPTORS} + "${${protobuf_generate_c_DESCRIPTORS}}" + PARENT_SCOPE) + endif() +endfunction() diff --git a/recipes/protobuf-c/all/test_package/CMakeLists.txt b/recipes/protobuf-c/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..99e745b3cbd08 --- /dev/null +++ b/recipes/protobuf-c/all/test_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) + +find_package(protobuf-c CONFIG REQUIRED) + +protobuf_generate_c(TEST_PROTO_SRCS TEST_PROTO_HDRS hero.proto) + +add_executable(${PROJECT_NAME} test_package.c hero.proto ${TEST_PROTO_SRCS} ${TEST_PROTO_HDRS}) +target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) +target_link_libraries(${PROJECT_NAME} protobuf-c::protobuf-c) diff --git a/recipes/protobuf-c/all/test_package/conanfile.py b/recipes/protobuf-c/all/test_package/conanfile.py new file mode 100644 index 0000000000000..979cebae5cc2b --- /dev/null +++ b/recipes/protobuf-c/all/test_package/conanfile.py @@ -0,0 +1,40 @@ +from conan import ConanFile +from conan.tools.build import can_run, cross_building +from conan.tools.cmake import cmake_layout, CMake +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def build_requirements(self): + if cross_building(self) and hasattr(self, "settings_build"): + self.tool_requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def generate(self): + VirtualRunEnv(self).generate() + if cross_building(self) and hasattr(self, "settings_build"): + VirtualBuildEnv(self).generate() + else: + VirtualRunEnv(self).generate(scope="build") + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + # We need to be able to call protoc (from protobuf) under the hood + self.run("protoc --version", env="conanbuild") + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/protobuf-c/all/test_package/hero.proto b/recipes/protobuf-c/all/test_package/hero.proto new file mode 100644 index 0000000000000..5192fe660ef3c --- /dev/null +++ b/recipes/protobuf-c/all/test_package/hero.proto @@ -0,0 +1,6 @@ +syntax = "proto3"; +package the; + +message Hero { + string name = 1; +} diff --git a/recipes/protobuf-c/all/test_package/test_package.c b/recipes/protobuf-c/all/test_package/test_package.c new file mode 100644 index 0000000000000..7e9da10a4d2c4 --- /dev/null +++ b/recipes/protobuf-c/all/test_package/test_package.c @@ -0,0 +1,13 @@ +#include + +#include "hero.pb-c.h" + +int main() +{ + The__Hero hero; + hero.name = "the_storyteller"; + + printf("The hero's name is %s.\n", hero.name); + + return 0; +} diff --git a/recipes/protobuf-c/config.yml b/recipes/protobuf-c/config.yml new file mode 100644 index 0000000000000..e8bcb86099429 --- /dev/null +++ b/recipes/protobuf-c/config.yml @@ -0,0 +1,5 @@ +versions: + "1.5.0": + folder: all + "1.4.1": + 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 8c08d5344edff..c03c8334c3fff 100644 --- a/recipes/protobuf/all/conandata.yml +++ b/recipes/protobuf/all/conandata.yml @@ -1,26 +1,99 @@ sources: - "3.21.9": - url: "https://github.com/protocolbuffers/protobuf/archive/refs/tags/v21.9.tar.gz" - sha256: "0aa7df8289c957a4c54cbe694fbabe99b180e64ca0f8fdb5e2f76dcf56ff2422" - "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" - "3.18.1": - 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" - sha256: "036d66d6eec216160dd898cfb162e9d82c1904627642667cc32b104d407bb411" + "5.27.0": + url: "https://github.com/protocolbuffers/protobuf/archive/refs/tags/v5.27.0.tar.gz" + sha256: "1611a03e550c27c526bde1da544c94f7aa65c10687bbc8e570537dfa94069e1a" + "4.25.3": + url: "https://github.com/protocolbuffers/protobuf/archive/refs/tags/v4.25.3.tar.gz" + sha256: "1d6b8d9114cb5b33ce8711729893097a107d4fefff5423528eb1decb5451856c" + "3.21.12": + url: "https://github.com/protocolbuffers/protobuf/archive/refs/tags/v3.21.12.tar.gz" + sha256: "930c2c3b5ecc6c9c12615cf5ad93f1cd6e12d0aba862b572e076259970ac3a53" + "3.20.3": + url: "https://github.com/protocolbuffers/protobuf/archive/v3.20.3.tar.gz" + sha256: "9c0fd39c7a08dff543c643f0f4baf081988129a411b977a07c46221793605638" patches: - "3.19.4": - - patch_file: "patches/upstream-pr-9153-msvc-runtime.patch" - base_path: "source_subfolder" + "3.21.12": + - patch_file: "patches/protobuf-3.21.12-upstream-macos-macros.patch" + patch_description: "Handle case where macOS SDK macros may conflict with protobuf message types" + patch_type: "bugfix" + patch_source: "https://github.com/protocolbuffers/protobuf/pull/10103" + "3.20.3": + - patch_file: "patches/protobuf-3.20.0-upstream-macos-macros.patch" + patch_description: "Handle case where macOS SDK macros may conflict with protobuf message types" + patch_type: "bugfix" + patch_source: "https://github.com/protocolbuffers/protobuf/pull/10103" +absl_deps: + "5.27.0": + - absl_absl_check + - absl_absl_log + - absl_algorithm + - absl_base + - absl_bind_front + - absl_bits + - absl_btree + - absl_cleanup + - absl_cord + - absl_core_headers + - absl_debugging + - absl_die_if_null + - absl_dynamic_annotations + - absl_flags + - absl_flat_hash_map + - absl_flat_hash_set + - absl_function_ref + - absl_hash + - absl_if_constexpr + - absl_layout + - absl_log_initialize + - absl_log_globals + - absl_log_severity + - absl_memory + - absl_node_hash_map + - absl_node_hash_set + - absl_optional + - absl_random_distributions + - absl_random_random + - absl_span + - absl_status + - absl_statusor + - absl_strings + - absl_synchronization + - absl_time + - absl_type_traits + - absl_utility + - absl_variant + "4.25.3": + - absl_absl_check + - absl_absl_log + - absl_algorithm + - absl_base + - absl_bind_front + - absl_bits + - absl_btree + - absl_cleanup + - absl_cord + - absl_core_headers + - absl_debugging + - absl_die_if_null + - absl_dynamic_annotations + - absl_flags + - absl_flat_hash_map + - absl_flat_hash_set + - absl_function_ref + - absl_hash + - absl_layout + - absl_log_initialize + - absl_log_severity + - absl_memory + - absl_node_hash_map + - absl_node_hash_set + - absl_optional + - absl_span + - absl_status + - absl_statusor + - absl_strings + - absl_synchronization + - absl_time + - absl_type_traits + - absl_utility + - absl_variant diff --git a/recipes/protobuf/all/conanfile.py b/recipes/protobuf/all/conanfile.py index d23242627557d..6d85bc5225920 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.build import check_min_cppstd +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, save +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): @@ -21,7 +19,7 @@ class ProtobufConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/protocolbuffers/protobuf" license = "BSD-3-Clause" - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -29,6 +27,7 @@ class ProtobufConan(ConanFile): "with_zlib": [True, False], "with_rtti": [True, False], "lite": [True, False], + "upb": [True, False], "debug_suffix": [True, False], } default_options = { @@ -37,159 +36,149 @@ class ProtobufConan(ConanFile): "with_zlib": True, "with_rtti": True, "lite": False, + "upb": False, "debug_suffix": True, } 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): return self.settings.compiler == "clang" and self.settings.arch == "x86" - + @property - def _can_disable_rtti(self): - return Version(self.version) >= "3.15.4" + def _protobuf_release(self): + current_ver = Version(self.version) + return Version(f"{current_ver.minor}.{current_ver.patch}") 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) + copy(self, "protobuf-conan-protoc-target.cmake", self.recipe_folder, os.path.join(self.export_sources_folder, "src")) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - if not self._can_disable_rtti: - del self.options.with_rtti def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + if self._protobuf_release < "27.0": + self.options.rm_safe("upb") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.options.with_zlib: - self.requires("zlib/1.2.13") + self.requires("zlib/[>=1.2.11 <2]") + + if self._protobuf_release >= "22.0": + self.requires("abseil/20240116.2", transitive_headers=True) + + @property + def _compilers_minimum_version(self): + return { + "gcc": "6", + "clang": "5", + "apple-clang": "10", + "Visual Studio": "15", + "msvc": "191", + } 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.") + + if is_msvc(self) and self._protobuf_release >= "22" and self.options.shared and \ + not self.dependencies["abseil"].options.shared: + raise ConanInvalidConfiguration("When building protobuf as a shared library on Windows, " + "abseil needs to be a shared library too") + + if self._protobuf_release >= "22.0": + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 14) + else: + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), None) + compiler_version = Version(self.settings.compiler.version) + if minimum_version and compiler_version < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++14, which your compiler does not support.", + ) + + 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") + if Version(self.settings.compiler.version) < "4": + 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"] = "" - if Version(self.version) >= "3.14.0": - cmake.definitions["protobuf_BUILD_LIBPROTOC"] = True - if self._can_disable_rtti: - cmake.definitions["protobuf_DISABLE_RTTI"] = not self.options.with_rtti + tc.cache_variables["protobuf_DEBUG_POSTFIX"] = "" + tc.cache_variables["protobuf_BUILD_LIBPROTOC"] = self.settings.os != "tvOS" + tc.cache_variables["protobuf_DISABLE_RTTI"] = not self.options.with_rtti + tc.cache_variables["protobuf_BUILD_LIBUPB"] = self.options.get_safe("upb") + if self._protobuf_release >= "22.0": + tc.cache_variables["protobuf_ABSL_PROVIDER"] = "package" + if not self.settings.compiler.get_safe("cppstd") and self._protobuf_release >= "22.0": + tc.variables["CMAKE_CXX_STANDARD"] = 14 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" + + if self.settings.os == "Linux": + # Use RPATH instead of RUNPATH to help with specific case + # in the grpc recipe when grpc_cpp_plugin is run with protoc + # in the same build. RPATH ensures that the rpath in the binary + # is respected for transitive dependencies too + project_include = os.path.join(self.generators_folder, "protobuf_project_include.cmake") + save(self, project_include, "add_link_options(-Wl,--disable-new-dtags)") + tc.variables["CMAKE_PROJECT_INCLUDE"] = project_include + # Note: conan2 only could be: + # tc.extra_exelinkflags.append("-Wl,--disable-new-dtags") + # tc.extra_sharedlinkflags.append("-Wl,--disable-new-dtags") + + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def _patch_sources(self): apply_conandata_patches(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") - - replace_in_file(self, - protobuf_config_cmake, - "@_protobuf_FIND_ZLIB@", - "# BEGIN CONAN PATCH\n#_protobuf_FIND_ZLIB@\n# END CONAN PATCH" - ) - - exe_ext = ".exe" if self.settings.os == "Windows" else "" - protoc_filename = "protoc" + exe_ext - module_folder_depth = len(os.path.normpath(self._cmake_install_base_path).split(os.path.sep)) - protoc_rel_path = "{}bin/{}".format("".join(["../"] * module_folder_depth), protoc_filename) - protoc_target = textwrap.dedent("""\ - if(NOT TARGET protobuf::protoc) - if(CMAKE_CROSSCOMPILING) - find_program(PROTOC_PROGRAM protoc PATHS ENV PATH NO_DEFAULT_PATH) - endif() - if(NOT PROTOC_PROGRAM) - set(PROTOC_PROGRAM \"${{CMAKE_CURRENT_LIST_DIR}}/{protoc_rel_path}\") - endif() - get_filename_component(PROTOC_PROGRAM \"${{PROTOC_PROGRAM}}\" ABSOLUTE) - set(Protobuf_PROTOC_EXECUTABLE ${{PROTOC_PROGRAM}} CACHE FILEPATH \"The protoc compiler\") - add_executable(protobuf::protoc IMPORTED) - set_property(TARGET protobuf::protoc PROPERTY IMPORTED_LOCATION ${{Protobuf_PROTOC_EXECUTABLE}}) - endif() - """.format(protoc_rel_path=protoc_rel_path)) - replace_in_file(self, - protobuf_config_cmake, - "include(\"${CMAKE_CURRENT_LIST_DIR}/protobuf-targets.cmake\")", - 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}\" $" + if self._protobuf_release < "22.0": + # In older versions of protobuf, this file defines the `protobuf_generate` function + protobuf_config_cmake = os.path.join(self.source_folder, "cmake", "protobuf-config.cmake.in") + replace_in_file(self, protobuf_config_cmake, "@_protobuf_FIND_ZLIB@", "") + replace_in_file(self, protobuf_config_cmake, + "include(\"${CMAKE_CURRENT_LIST_DIR}/protobuf-targets.cmake\")", + "" ) # 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)", @@ -201,32 +190,31 @@ def _patch_sources(self): "endif()", ) - # 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"), - "#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")) - os.unlink(os.path.join(self.package_folder, self._cmake_install_base_path, "protobuf-targets.cmake")) - os.unlink(os.path.join(self.package_folder, self._cmake_install_base_path, "protobuf-targets-{}.cmake".format(str(self.settings.build_type).lower()))) - rename(self, os.path.join(self.package_folder, self._cmake_install_base_path, "protobuf-config.cmake"), - os.path.join(self.package_folder, self._cmake_install_base_path, "protobuf-generate.cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake", "utf8_range")) + if self._protobuf_release < "22.0": + rename(self, os.path.join(self.package_folder, self._cmake_install_base_path, "protobuf-config.cmake"), + os.path.join(self.package_folder, self._cmake_install_base_path, "protobuf-generate.cmake")) + + cmake_config_folder = os.path.join(self.package_folder, self._cmake_install_base_path) + rm(self, "protobuf-config*.cmake", folder=cmake_config_folder) + rm(self, "protobuf-targets*.cmake", folder=cmake_config_folder) + copy(self, "protobuf-conan-protoc-target.cmake", src=self.source_folder, dst=cmake_config_folder) 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") @@ -238,12 +226,32 @@ def package_info(self): os.path.join(self._cmake_install_base_path, "protobuf-generate.cmake"), os.path.join(self._cmake_install_base_path, "protobuf-module.cmake"), os.path.join(self._cmake_install_base_path, "protobuf-options.cmake"), + os.path.join(self._cmake_install_base_path, "protobuf-conan-protoc-target.cmake"), ] self.cpp_info.set_property("cmake_build_modules", build_modules) lib_prefix = "lib" if (is_msvc(self) or self._is_clang_cl) else "" lib_suffix = "d" if self.settings.build_type == "Debug" and self.options.debug_suffix else "" + if self._protobuf_release >= "22.0": + absl_deps = [f"abseil::{c}" for c in self.conan_data["absl_deps"][self.version]] + + if self._protobuf_release >= "22.0" and (not self.options.shared or self.options.get_safe("upb")): + # utf8 libraries + # it's a private dependency and unconditionally built as a static library, should only + # be exposed when protobuf itself is static (or if upb is being built) + self.cpp_info.components["utf8_range"].set_property("cmake_target_name", "utf8_range::utf8_range") + self.cpp_info.components["utf8_range"].libs = ["utf8_range"] + self.cpp_info.components["utf8_validity"].set_property("cmake_target_name", "utf8_range::utf8_validity") + self.cpp_info.components["utf8_validity"].libs = ["utf8_validity"] + self.cpp_info.components["utf8_validity"].requires = ["abseil::absl_strings"] + + if self.options.get_safe("upb"): + # upb libraries: note that these are unconditionally static + self.cpp_info.components["upb"].set_property("cmake_target_name", "protobuf::libupb") + self.cpp_info.components["upb"].libs = [lib_prefix + "upb" + lib_suffix] + self.cpp_info.components["upb"].requires = ["utf8_range"] + # libprotobuf self.cpp_info.components["libprotobuf"].set_property("cmake_target_name", "protobuf::libprotobuf") self.cpp_info.components["libprotobuf"].set_property("pkg_config_name", "protobuf") @@ -251,8 +259,13 @@ def package_info(self): self.cpp_info.components["libprotobuf"].libs = [lib_prefix + "protobuf" + lib_suffix] if self.options.with_zlib: self.cpp_info.components["libprotobuf"].requires = ["zlib::zlib"] + if self._protobuf_release >= "22.0": + self.cpp_info.components["libprotobuf"].requires.extend(absl_deps) + if not self.options.shared: + self.cpp_info.components["libprotobuf"].requires.extend(["utf8_validity"]) + 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 +275,12 @@ 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"] + if self._protobuf_release >= "22.0": + self.cpp_info.components["libprotoc"].requires.extend(absl_deps) # libprotobuf-lite if self.options.lite: @@ -273,7 +289,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": @@ -281,10 +297,10 @@ def package_info(self): self.cpp_info.components["libprotobuf-lite"].defines = ["PROTOBUF_USE_DLLS"] 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) + if self._protobuf_release >= "22.0": + self.cpp_info.components["libprotobuf-lite"].requires.extend(absl_deps) + if not self.options.shared: + self.cpp_info.components["libprotobuf-lite"].requires.extend(["utf8_validity"]) # TODO: to remove in conan v2 once cmake_find_package* & pkg_config generators removed self.cpp_info.filenames["cmake_find_package"] = "Protobuf" @@ -295,3 +311,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/protobuf-3.20.0-upstream-macos-macros.patch b/recipes/protobuf/all/patches/protobuf-3.20.0-upstream-macos-macros.patch new file mode 100644 index 0000000000000..df772b5958879 --- /dev/null +++ b/recipes/protobuf/all/patches/protobuf-3.20.0-upstream-macos-macros.patch @@ -0,0 +1,29 @@ +diff --git a/src/google/protobuf/port_def.inc b/src/google/protobuf/port_def.inc +index bdb2eec..e8d7dbc 100644 +--- a/src/google/protobuf/port_def.inc ++++ b/src/google/protobuf/port_def.inc +@@ -816,6 +816,11 @@ + #undef TRUE + #pragma push_macro("FALSE") + #undef FALSE ++// Inconvenient macro names from usr/include/sys/syslimits.h in some macOS SDKs. ++#pragma push_macro("UID_MAX") ++#undef UID_MAX ++#pragma push_macro("GID_MAX") ++#undef GID_MAX + #endif // __APPLE__ + + #if defined(__clang__) || PROTOBUF_GNUC_MIN(3, 0) || defined(_MSC_VER) +diff --git a/src/google/protobuf/port_undef.inc b/src/google/protobuf/port_undef.inc +index 58136a4..eb0fdc8 100644 +--- a/src/google/protobuf/port_undef.inc ++++ b/src/google/protobuf/port_undef.inc +@@ -134,6 +134,8 @@ + #pragma pop_macro("DOMAIN") + #pragma pop_macro("TRUE") + #pragma pop_macro("FALSE") ++#pragma pop_macro("UID_MAX") ++#pragma pop_macro("GID_MAX") + #endif // __APPLE__ + + #if defined(__clang__) || defined(__GNUC__) || defined(_MSC_VER) diff --git a/recipes/protobuf/all/patches/protobuf-3.21.12-upstream-macos-macros.patch b/recipes/protobuf/all/patches/protobuf-3.21.12-upstream-macos-macros.patch new file mode 100644 index 0000000000000..3a152f62bca69 --- /dev/null +++ b/recipes/protobuf/all/patches/protobuf-3.21.12-upstream-macos-macros.patch @@ -0,0 +1,25 @@ +diff --git a/src/google/protobuf/port_def.inc b/src/google/protobuf/port_def.inc +index f00daf7..d956db2 100644 +--- a/src/google/protobuf/port_def.inc ++++ b/src/google/protobuf/port_def.inc +@@ -870,6 +870,8 @@ + // Inconvenient macro names from usr/include/sys/syslimits.h in some macOS SDKs. + #pragma push_macro("UID_MAX") + #undef UID_MAX ++#pragma push_macro("GID_MAX") ++#undef GID_MAX + #endif // __APPLE__ + + #if defined(__clang__) || PROTOBUF_GNUC_MIN(3, 0) || defined(_MSC_VER) +diff --git a/src/google/protobuf/port_undef.inc b/src/google/protobuf/port_undef.inc +index e880fa5..f8968d9 100644 +--- a/src/google/protobuf/port_undef.inc ++++ b/src/google/protobuf/port_undef.inc +@@ -144,6 +144,7 @@ + #pragma pop_macro("TRUE") + #pragma pop_macro("FALSE") + #pragma pop_macro("UID_MAX") ++#pragma pop_macro("GID_MAX") + #endif // __APPLE__ + + #if defined(__clang__) || defined(__GNUC__) || defined(_MSC_VER) diff --git a/recipes/protobuf/all/patches/upstream-pr-9153-msvc-runtime.patch b/recipes/protobuf/all/patches/upstream-pr-9153-msvc-runtime.patch deleted file mode 100644 index e55d642882aa3..0000000000000 --- a/recipes/protobuf/all/patches/upstream-pr-9153-msvc-runtime.patch +++ /dev/null @@ -1,15 +0,0 @@ -upstream PR: https://github.com/protocolbuffers/protobuf/pull/9153 - ---- a/cmake/CMakeLists.txt -+++ b/cmake/CMakeLists.txt -@@ -182,7 +182,9 @@ 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>) -+ 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/protobuf-conan-protoc-target.cmake b/recipes/protobuf/all/protobuf-conan-protoc-target.cmake new file mode 100644 index 0000000000000..6165d8f1b731b --- /dev/null +++ b/recipes/protobuf/all/protobuf-conan-protoc-target.cmake @@ -0,0 +1,25 @@ +if(NOT TARGET protobuf::protoc) + # Locate protoc executable + ## Workaround for legacy "cmake" generator in case of cross-build + if(CMAKE_CROSSCOMPILING) + find_program(PROTOC_PROGRAM NAMES protoc PATHS ENV PATH NO_DEFAULT_PATH) + endif() + ## And here this will work fine with "CMakeToolchain" (for native & cross-build) + ## and legacy "cmake" generator in case of native build + if(NOT PROTOC_PROGRAM) + find_program(PROTOC_PROGRAM NAMES protoc) + endif() + ## Last resort: we search in package folder directly + if(NOT PROTOC_PROGRAM) + set(PROTOC_PROGRAM "${CMAKE_CURRENT_LIST_DIR}/../../../bin/protoc${CMAKE_EXECUTABLE_SUFFIX}") + endif() + get_filename_component(PROTOC_PROGRAM "${PROTOC_PROGRAM}" ABSOLUTE) + + # Give opportunity to users to provide an external protoc executable + # (this is a feature of official FindProtobuf.cmake) + set(Protobuf_PROTOC_EXECUTABLE ${PROTOC_PROGRAM} CACHE FILEPATH "The protoc compiler") + + # Create executable imported target protobuf::protoc + add_executable(protobuf::protoc IMPORTED) + set_property(TARGET protobuf::protoc PROPERTY IMPORTED_LOCATION ${Protobuf_PROTOC_EXECUTABLE}) +endif() diff --git a/recipes/protobuf/all/test_package/CMakeLists.txt b/recipes/protobuf/all/test_package/CMakeLists.txt index ca3bf5d188169..e8254a31a1247 100644 --- a/recipes/protobuf/all/test_package/CMakeLists.txt +++ b/recipes/protobuf/all/test_package/CMakeLists.txt @@ -1,21 +1,28 @@ -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}") +add_executable(${PROJECT_NAME} test_package.cpp) + +if(CONAN_TEST_USE_CXXSTD_14) + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) +else() + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +endif() + if (protobuf_LITE) - target_link_libraries(${PROJECT_NAME} protobuf::libprotobuf-lite) + target_link_libraries(${PROJECT_NAME} PRIVATE protobuf::libprotobuf-lite) + target_compile_definitions(${PROJECT_NAME} PRIVATE CONANTEST_PROTOBUF_LITE=1) 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(NOT TARGET protobuf::protoc) + message(FATAL_ERROR "protoc executable should have been defined as part of find_package(protobuf)") +endif() -protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS TARGET ${PROJECT_NAME}) -protobuf_generate(LANGUAGE cpp TARGET ${PROJECT_NAME} PROTOS addressbook.proto) +if(NOT COMMAND protobuf_generate) + message(FATAL_ERROR "protobuf_generate should have been defined as part of find_package(protobuf)") +endif() diff --git a/recipes/protobuf/all/test_package/addressbook.proto b/recipes/protobuf/all/test_package/addressbook.proto index b4b33b4c65892..be5732b3317e5 100644 --- a/recipes/protobuf/all/test_package/addressbook.proto +++ b/recipes/protobuf/all/test_package/addressbook.proto @@ -49,3 +49,16 @@ message AddressBook { repeated Person people = 1; } // [END messages] + +// Artibrary message with a GID type, to cause +// the .pb.h file to define `GID_MAX`, which +// may conflict with a macro defined by system +// headers on macOS. +message FooBar { + enum GID { + FOO = 0; + } + enum UID { + BAR = 0; + } +} diff --git a/recipes/protobuf/all/test_package/conanfile.py b/recipes/protobuf/all/test_package/conanfile.py index 06d5305cf8a67..880d1f9d7d72e 100644 --- a/recipes/protobuf/all/test_package/conanfile.py +++ b/recipes/protobuf/all/test_package/conanfile.py @@ -1,24 +1,40 @@ 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_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", "VirtualBuildEnv", "VirtualRunEnv" + test_type = "explicit" - def build_requirements(self): - if hasattr(self, "settings_build") and cross_building(self): - self.build_requires(str(self.requires["protobuf"])) + def layout(self): + cmake_layout(self) + + def requirements(self): + # note `run=True` so that the runenv can find protoc + self.requires(self.tested_reference_str, run=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["protobuf_LITE"] = self.dependencies[self.tested_reference_str].options.lite + protobuf_version = Version(self.dependencies[self.tested_reference_str].ref.version) + tc.cache_variables["CONAN_TEST_USE_CXXSTD_14"] = protobuf_version >= "3.22" + 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") + + # Invoke protoc in the same way CMake would + self.run(f"protoc --proto_path={self.source_folder} --cpp_out={self.build_folder} {self.source_folder}/addressbook.proto", env="conanrun") + assert os.path.exists(os.path.join(self.build_folder,"addressbook.pb.cc")) + assert os.path.exists(os.path.join(self.build_folder,"addressbook.pb.h")) diff --git a/recipes/protobuf/all/test_package/test_package.cpp b/recipes/protobuf/all/test_package/test_package.cpp index aee0c47205eed..292260cccf5c4 100644 --- a/recipes/protobuf/all/test_package/test_package.cpp +++ b/recipes/protobuf/all/test_package/test_package.cpp @@ -1,17 +1,23 @@ #include #include -#include "addressbook.pb.h" +#if !defined(CONANTEST_PROTOBUF_LITE) +#include +#include +#else +#include +#endif int main() { - std::cout << "Bincrafters\n"; - tutorial::Person p; - p.set_id(21); - p.set_name("conan-center-index"); - p.set_email("info@conan.io"); - - std::cout << p.SerializeAsString() << "\n"; +#if !defined(CONANTEST_PROTOBUF_LITE) + google::protobuf::Timestamp ts; + google::protobuf::util::TimeUtil::FromString("1972-01-01T10:00:20.021Z", &ts); + const auto nanoseconds = ts.nanos(); + std::cout << "1972-01-01T10:00:20.021Z in nanoseconds: " << nanoseconds << "\n"; +#else + google::protobuf::ShutdownProtobufLibrary(); +#endif return EXIT_SUCCESS; } diff --git a/recipes/protobuf/config.yml b/recipes/protobuf/config.yml index c22211a7a9d4e..cb567195f025d 100644 --- a/recipes/protobuf/config.yml +++ b/recipes/protobuf/config.yml @@ -1,15 +1,9 @@ versions: - "3.21.9": + "5.27.0": folder: all - "3.21.4": + "4.25.3": folder: all - "3.20.0": + "3.21.12": folder: all - "3.19.6": - folder: all - "3.19.4": - folder: all - "3.18.1": - folder: all - "3.17.1": + "3.20.3": folder: all diff --git a/recipes/protopuf/all/conandata.yml b/recipes/protopuf/all/conandata.yml index e3a4a402d6c55..70e206483f82b 100644 --- a/recipes/protopuf/all/conandata.yml +++ b/recipes/protopuf/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.0.0": + url: "https://github.com/PragmaTwice/protopuf/archive/v3.0.0.tar.gz" + sha256: "62f89b78989eb054bc52e80cc1517274f5621e32eda4758f123c66c7a3521ee3" "2.2.1": url: "https://github.com/PragmaTwice/protopuf/archive/v2.2.1.tar.gz" sha256: "8d4940206d8e8664f75ae1cdfff8c14fa9a196c03967d520725284429744c19c" diff --git a/recipes/protopuf/all/test_package/CMakeLists.txt b/recipes/protopuf/all/test_package/CMakeLists.txt index c049a9a330ddf..b96c930536a1d 100644 --- a/recipes/protopuf/all/test_package/CMakeLists.txt +++ b/recipes/protopuf/all/test_package/CMakeLists.txt @@ -1,9 +1,11 @@ cmake_minimum_required(VERSION 3.12) - -project(test_package CXX) +project(test_package LANGUAGES 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) +if(protopuf_VERSION VERSION_LESS 3.0.0) + target_compile_definitions(${PROJECT_NAME} PRIVATE PROTOPUF_V2) +endif() diff --git a/recipes/protopuf/all/test_package/test_package.cpp b/recipes/protopuf/all/test_package/test_package.cpp index 4204c6dc97e2a..e97fde64ca1d2 100644 --- a/recipes/protopuf/all/test_package/test_package.cpp +++ b/recipes/protopuf/all/test_package/test_package.cpp @@ -6,12 +6,12 @@ using namespace pp; using namespace std; using Student = message< - uint32_field<"id", 1>, + uint32_field<"id", 1>, string_field<"name", 3> >; using Class = message< - string_field<"name", 8>, + string_field<"name", 8>, message_field<"students", 3, Student, repeated> >; @@ -25,8 +25,12 @@ int main() { auto bufferEnd = message_coder::encode(myClass, buffer); // deserialization +#ifdef PROTOPUF_V2 auto [yourClass, bufferEnd2] = message_coder::decode(buffer); - +#else + auto result = message_coder::decode(buffer); + auto [yourClass, bufferEnd2] = *result; +#endif return 0; } diff --git a/recipes/protopuf/config.yml b/recipes/protopuf/config.yml index 346088b2bbe5f..3a574582d8d34 100644 --- a/recipes/protopuf/config.yml +++ b/recipes/protopuf/config.yml @@ -1,4 +1,6 @@ versions: + "3.0.0": + folder: all "2.2.1": folder: all "2.2.0": diff --git a/recipes/proxy/all/conandata.yml b/recipes/proxy/all/conandata.yml new file mode 100644 index 0000000000000..cb63d289fe25b --- /dev/null +++ b/recipes/proxy/all/conandata.yml @@ -0,0 +1,19 @@ +sources: + "3.0.0": + url: "https://github.com/microsoft/proxy/archive/refs/tags/3.0.0.tar.gz" + sha256: "7e073e217e5572bc4c17ed5893273c80ea34c87e1406c853beeb9ca9bdda9733" + "2.4.0": + url: "https://github.com/microsoft/proxy/archive/refs/tags/2.4.0.tar.gz" + sha256: "7eed973655938d681a90dcc0c200e6cc1330ea8611a9c1a9e1b30439514443cb" + "2.3.2": + url: "https://github.com/microsoft/proxy/archive/refs/tags/2.3.2.tar.gz" + sha256: "d592f70b82a452dc9834ac3a953039d4b0136eefc023503d37879aba5ced369f" + "2.3.1": + url: "https://github.com/microsoft/proxy/archive/refs/tags/2.3.1.tar.gz" + sha256: "bfec45ada9cd3dc576df34bbe877c5d03a81906a00759970c0197c3fa041c5c7" + "2.3.0": + url: "https://github.com/microsoft/proxy/archive/refs/tags/2.3.0.tar.gz" + sha256: "ff6f17c5360895776d29ce2b1235de7b42912468b52729810506431e352a78d0" + "2.2.1": + url: "https://github.com/microsoft/proxy/archive/refs/tags/2.2.1.tar.gz" + sha256: "096f0b2d793dffc54d41def2bca0ced594b6b8efe35ac5ae27db35802e742b96" diff --git a/recipes/proxy/all/conanfile.py b/recipes/proxy/all/conanfile.py new file mode 100644 index 0000000000000..eb01ebfdc540f --- /dev/null +++ b/recipes/proxy/all/conanfile.py @@ -0,0 +1,67 @@ +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.52.0" + + +class ProxyConan(ConanFile): + name = "proxy" + description = "Proxy: Next Generation Polymorphism in C++" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/microsoft/proxy" + topics = ("runtime-polymorphism", "polymorphism", "duck-typing", "metaprogramming", "header-only") + + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _min_cppstd(self): + return 20 + + @property + def _compilers_minimum_version(self): + return { + # proxy/2.3.0 has an internal compilation error on gcc 11. + "gcc": "11" if Version(self.version) < "2.3.0" else "12", + "clang": "15", + "apple-clang": "14", + "msvc": "193", + "Visual Studio": "17", + } + + 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, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + copy(self, "proxy.h", self.source_folder, os.path.join(self.package_folder, "include", "proxy")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "proxy") + self.cpp_info.set_property("cmake_target_name", "msft_proxy") + + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/proxy/all/test_package/CMakeLists.txt b/recipes/proxy/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..6ed6216423b01 --- /dev/null +++ b/recipes/proxy/all/test_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(proxy REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE msft_proxy) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) +if(proxy_VERSION VERSION_GREATER_EQUAL "3.0.0") + target_compile_definitions(${PROJECT_NAME} PRIVATE PROXY_VERSION_3_LATER) +endif() diff --git a/recipes/proxy/all/test_package/conanfile.py b/recipes/proxy/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/proxy/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/proxy/all/test_package/test_package.cpp b/recipes/proxy/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..4700fd6cd057e --- /dev/null +++ b/recipes/proxy/all/test_package/test_package.cpp @@ -0,0 +1,71 @@ +// https://github.com/microsoft/proxy/blob/2.1.0/samples/resource_dictionary/main.cpp +// Copyright (c) Microsoft Corporation. +// +// 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 + +#include + +#include +#include +#include +#include + +#ifdef PROXY_VERSION_3_LATER + +PRO_DEF_MEM_DISPATCH(MemAt, at); + +struct Dictionary : pro::facade_builder + ::add_convention + ::build {}; + +// This is a function, rather than a function template +void demo_print(pro::proxy dictionary) { + std::cout << dictionary->at(1) << "\n"; +} + +int main() { + static std::map container1{{1, "hello"}}; + auto container2 = std::make_shared>(); + container2->push_back("hello"); + container2->push_back("world"); + demo_print(&container1); // Prints: "hello" + demo_print(container2); // Prints: "world" +} + +#else + +namespace poly { + +PRO_DEF_MEMBER_DISPATCH(at, std::string(int)); +PRO_DEF_FACADE(Dictionary, at); + +} // namespace poly + +void demo_print(pro::proxy dictionary) { + std::cout << dictionary(1) << std::endl; +} + +int main() { + std::map container1{{1, "hello"}}; + std::vector container2{"hello", "world"}; + demo_print(&container1); // print: hello\n + demo_print(&container2); // print: world\n + return 0; +} +#endif diff --git a/recipes/proxy/config.yml b/recipes/proxy/config.yml new file mode 100644 index 0000000000000..fd53bc176b690 --- /dev/null +++ b/recipes/proxy/config.yml @@ -0,0 +1,13 @@ +versions: + "3.0.0": + folder: all + "2.4.0": + folder: all + "2.3.2": + folder: all + "2.3.1": + folder: all + "2.3.0": + folder: all + "2.2.1": + folder: all diff --git a/recipes/psimd/all/conanfile.py b/recipes/psimd/all/conanfile.py index 138520809226b..977da9b21114c 100644 --- a/recipes/psimd/all/conanfile.py +++ b/recipes/psimd/all/conanfile.py @@ -13,6 +13,7 @@ class PsimdConan(ConanFile): topics = ("psimd", "simd") homepage = "https://github.com/Maratyszcza/psimd" url = "https://github.com/conan-io/conan-center-index" + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -23,8 +24,7 @@ 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 diff --git a/recipes/ptex/all/conandata.yml b/recipes/ptex/all/conandata.yml index 7a294e96324ee..6d50d86a6dad6 100644 --- a/recipes/ptex/all/conandata.yml +++ b/recipes/ptex/all/conandata.yml @@ -1,7 +1,12 @@ sources: + "2.4.2": + url: "https://github.com/wdas/ptex/archive/refs/tags/v2.4.2.tar.gz" + sha256: "c8235fb30c921cfb10848f4ea04d5b662ba46886c5e32ad5137c5086f3979ee1" "2.4.0": url: "https://github.com/wdas/ptex/archive/refs/tags/v2.4.0.tar.gz" sha256: "690d66b72f34a92488d63134ad1f5736078677356b0004070b0169b9e3240f8e" patches: + "2.4.2": + - patch_file: "patches/2.4.2-0001-fix-cmake.patch" "2.4.0": - - patch_file: "patches/0001-fix-cmake.patch" + - patch_file: "patches/2.4.0-0001-fix-cmake.patch" diff --git a/recipes/ptex/all/conanfile.py b/recipes/ptex/all/conanfile.py index f8059fec65c6b..83f58340ae19c 100644 --- a/recipes/ptex/all/conanfile.py +++ b/recipes/ptex/all/conanfile.py @@ -1,8 +1,11 @@ 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.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, save import os +from conan.tools.gnu import PkgConfigDeps + required_conan_version = ">=1.53.0" @@ -40,7 +43,7 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("zlib/1.2.13") + self.requires("zlib/[>=1.2.11 <2]") def source(self): get(self, **self.conan_data["sources"][self.version], @@ -54,8 +57,15 @@ def generate(self): cd = CMakeDeps(self) cd.generate() - def build(self): + def _patch_sources(self): apply_conandata_patches(self) + # disable subdirs + save(self, os.path.join(self.source_folder, "src", "utils", "CMakeLists.txt"), "") + save(self, os.path.join(self.source_folder, "src", "tests", "CMakeLists.txt"), "") + save(self, os.path.join(self.source_folder, "src", "doc", "CMakeLists.txt"), "") + + def build(self): + self._patch_sources() cmake = CMake(self) cmake.configure() cmake.build() diff --git a/recipes/ptex/all/patches/0001-fix-cmake.patch b/recipes/ptex/all/patches/0001-fix-cmake.patch deleted file mode 100644 index f6481be77aa84..0000000000000 --- a/recipes/ptex/all/patches/0001-fix-cmake.patch +++ /dev/null @@ -1,57 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -33,6 +33,10 @@ enable_testing() - # Setup platform-specific threading flags. - find_package(Threads REQUIRED) - -+find_package(ZLIB REQUIRED) -+add_library(PkgConfig::Ptex_ZLIB INTERFACE IMPORTED) -+set_property(TARGET PkgConfig::Ptex_ZLIB PROPERTY INTERFACE_LINK_LIBRARIES ZLIB::ZLIB) -+if(0) - # Use pkg-config to create a PkgConfig::Ptex_ZLIB imported target - find_package(PkgConfig REQUIRED) - pkg_checK_modules(Ptex_ZLIB REQUIRED zlib IMPORTED_TARGET) -@@ -59,6 +63,7 @@ if (NOT DEFINED PTEX_VER) - OUTPUT_STRIP_TRAILING_WHITESPACE) - endif () - endif () -+endif() - # Provide a fallback version when the Git repository is unavailable. - if (NOT PTEX_VER) - set(PTEX_VER "v2.3.X") -@@ -76,7 +81,7 @@ endif () - list(GET PTEX_VER_LIST 0 PTEX_MAJOR_VERSION) - list(GET PTEX_VER_LIST 1 PTEX_MINOR_VERSION) - --if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) -+if (0) - # Detect the build type from the $FLAVOR environment variable - # Default to optimized Release builds when unspecified. - if ("$ENV{FLAVOR}" MATCHES "debug") -@@ -116,7 +121,4 @@ endif () - include_directories(src/ptex) - - add_subdirectory(src/ptex) --add_subdirectory(src/utils) --add_subdirectory(src/tests) --add_subdirectory(src/doc) - add_subdirectory(src/build) ---- a/src/ptex/CMakeLists.txt -+++ b/src/ptex/CMakeLists.txt -@@ -21,6 +21,7 @@ if(PTEX_BUILD_STATIC_LIBS) - $ - PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR}) -+ target_compile_definitions(Ptex_static PUBLIC PTEX_STATIC) - target_link_libraries(Ptex_static - PUBLIC Threads::Threads PkgConfig::Ptex_ZLIB) - install(TARGETS Ptex_static EXPORT Ptex DESTINATION ${CMAKE_INSTALL_LIBDIR}) -@@ -39,7 +40,7 @@ if(PTEX_BUILD_SHARED_LIBS) - target_compile_definitions(Ptex_dynamic PRIVATE PTEX_EXPORTS) - target_link_libraries(Ptex_dynamic - PUBLIC Threads::Threads PkgConfig::Ptex_ZLIB) -- install(TARGETS Ptex_dynamic EXPORT Ptex DESTINATION ${CMAKE_INSTALL_LIBDIR}) -+ install(TARGETS Ptex_dynamic EXPORT Ptex RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) - endif() - - install(FILES diff --git a/recipes/ptex/all/patches/2.4.0-0001-fix-cmake.patch b/recipes/ptex/all/patches/2.4.0-0001-fix-cmake.patch new file mode 100644 index 0000000000000..df8361be35c65 --- /dev/null +++ b/recipes/ptex/all/patches/2.4.0-0001-fix-cmake.patch @@ -0,0 +1,49 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -33,6 +33,10 @@ enable_testing() + # Setup platform-specific threading flags. + find_package(Threads REQUIRED) + ++find_package(ZLIB REQUIRED) ++add_library(PkgConfig::Ptex_ZLIB INTERFACE IMPORTED) ++set_property(TARGET PkgConfig::Ptex_ZLIB PROPERTY INTERFACE_LINK_LIBRARIES ZLIB::ZLIB) ++if(0) + # Use pkg-config to create a PkgConfig::Ptex_ZLIB imported target + find_package(PkgConfig REQUIRED) + pkg_checK_modules(Ptex_ZLIB REQUIRED zlib IMPORTED_TARGET) +@@ -59,6 +63,7 @@ if (NOT DEFINED PTEX_VER) + OUTPUT_STRIP_TRAILING_WHITESPACE) + endif () + endif () ++endif() + # Provide a fallback version when the Git repository is unavailable. + if (NOT PTEX_VER) + set(PTEX_VER "v2.3.X") +@@ -76,7 +81,7 @@ endif () + list(GET PTEX_VER_LIST 0 PTEX_MAJOR_VERSION) + list(GET PTEX_VER_LIST 1 PTEX_MINOR_VERSION) + +-if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) ++if (0) + # Detect the build type from the $FLAVOR environment variable + # Default to optimized Release builds when unspecified. + if ("$ENV{FLAVOR}" MATCHES "debug") +--- a/src/ptex/CMakeLists.txt ++++ b/src/ptex/CMakeLists.txt +@@ -21,6 +21,7 @@ if(PTEX_BUILD_STATIC_LIBS) + $ + PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}) ++ target_compile_definitions(Ptex_static PUBLIC PTEX_STATIC) + target_link_libraries(Ptex_static + PUBLIC Threads::Threads PkgConfig::Ptex_ZLIB) + install(TARGETS Ptex_static EXPORT Ptex DESTINATION ${CMAKE_INSTALL_LIBDIR}) +@@ -39,7 +40,7 @@ if(PTEX_BUILD_SHARED_LIBS) + target_compile_definitions(Ptex_dynamic PRIVATE PTEX_EXPORTS) + target_link_libraries(Ptex_dynamic + PUBLIC Threads::Threads PkgConfig::Ptex_ZLIB) +- install(TARGETS Ptex_dynamic EXPORT Ptex DESTINATION ${CMAKE_INSTALL_LIBDIR}) ++ install(TARGETS Ptex_dynamic EXPORT Ptex RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + endif() + + install(FILES diff --git a/recipes/ptex/all/patches/2.4.2-0001-fix-cmake.patch b/recipes/ptex/all/patches/2.4.2-0001-fix-cmake.patch new file mode 100644 index 0000000000000..cfb56ff285af6 --- /dev/null +++ b/recipes/ptex/all/patches/2.4.2-0001-fix-cmake.patch @@ -0,0 +1,19 @@ +--- a/src/ptex/CMakeLists.txt ++++ b/src/ptex/CMakeLists.txt +@@ -22,6 +22,7 @@ if(PTEX_BUILD_STATIC_LIBS) + $ + PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}) ++ target_compile_definitions(Ptex_static PUBLIC PTEX_STATIC) + target_link_libraries(Ptex_static + PUBLIC Threads::Threads ZLIB::ZLIB) + install(TARGETS Ptex_static EXPORT Ptex DESTINATION ${CMAKE_INSTALL_LIBDIR}) +@@ -40,7 +41,7 @@ if(PTEX_BUILD_SHARED_LIBS) + target_compile_definitions(Ptex_dynamic PRIVATE PTEX_EXPORTS) + target_link_libraries(Ptex_dynamic + PUBLIC Threads::Threads ZLIB::ZLIB) +- install(TARGETS Ptex_dynamic EXPORT Ptex DESTINATION ${CMAKE_INSTALL_LIBDIR}) ++ install(TARGETS Ptex_dynamic EXPORT Ptex RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + endif() + + install(FILES diff --git a/recipes/ptex/config.yml b/recipes/ptex/config.yml index e1d4aed9fe78f..a61c26db894b1 100644 --- a/recipes/ptex/config.yml +++ b/recipes/ptex/config.yml @@ -1,3 +1,5 @@ versions: + "2.4.2": + folder: all "2.4.0": folder: all diff --git a/recipes/pthreadpool/all/conandata.yml b/recipes/pthreadpool/all/conandata.yml index 4a1b5d58d8c57..5b276e0fd5b93 100644 --- a/recipes/pthreadpool/all/conandata.yml +++ b/recipes/pthreadpool/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "cci.20231129": + url: "https://github.com/Maratyszcza/pthreadpool/archive/4fe0e1e183925bf8cfa6aae24237e724a96479b8.zip" + sha256: "a4cf06de57bfdf8d7b537c61f1c3071bce74e57524fe053e0bbd2332feca7f95" "cci.20210218": url: "https://github.com/Maratyszcza/pthreadpool/archive/b4589998be9a0f794236cf46f1b5b232b2b15ca3.zip" sha256: "b09f79d1b609239861bce5ed4ba4fbcf04f36e2c31471276158c44e5e15fde95" diff --git a/recipes/pthreadpool/all/conanfile.py b/recipes/pthreadpool/all/conanfile.py index 026fed28423d8..23a05b7d46fd2 100644 --- a/recipes/pthreadpool/all/conanfile.py +++ b/recipes/pthreadpool/all/conanfile.py @@ -3,7 +3,7 @@ from conan.tools.files import copy, get, replace_in_file import os -required_conan_version = ">=1.51.1" +required_conan_version = ">=1.53.0" class PthreadpoolConan(ConanFile): @@ -15,7 +15,7 @@ class PthreadpoolConan(ConanFile): topics = ("multi-threading", "pthreads", "multi-core", "threadpool") homepage = "https://github.com/Maratyszcza/pthreadpool" url = "https://github.com/conan-io/conan-center-index" - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -36,18 +36,9 @@ def config_options(self): 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 + 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") @@ -56,15 +47,13 @@ def requirements(self): self.requires("fxdiv/cci.20200417") 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.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.cache_variables["PTHREADPOOL_SYNC_PRIMITIVE"] = 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 diff --git a/recipes/pthreadpool/all/test_v1_package/CMakeLists.txt b/recipes/pthreadpool/all/test_v1_package/CMakeLists.txt index c45c97cc93d2c..0d20897301b68 100644 --- a/recipes/pthreadpool/all/test_v1_package/CMakeLists.txt +++ b/recipes/pthreadpool/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES C) +cmake_minimum_required(VERSION 3.1) +project(test_package) 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) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/pthreadpool/config.yml b/recipes/pthreadpool/config.yml index 888d588d579dc..cb37cf1973096 100644 --- a/recipes/pthreadpool/config.yml +++ b/recipes/pthreadpool/config.yml @@ -1,3 +1,5 @@ versions: + "cci.20231129": + folder: all "cci.20210218": folder: all diff --git a/recipes/pthreads4w/all/conanfile.py b/recipes/pthreads4w/all/conanfile.py index 31dbe2fcc6986..2b65df1658831 100644 --- a/recipes/pthreads4w/all/conanfile.py +++ b/recipes/pthreads4w/all/conanfile.py @@ -1,12 +1,16 @@ -from conans import AutoToolsBuildEnvironment, VisualStudioBuildEnvironment, ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.tools.files import chdir, collect_libs, copy, get, mkdir, replace_in_file +from conan.tools.gnu import AutotoolsToolchain, Autotools +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, NMakeToolchain +from conan.errors import ConanInvalidConfiguration import os -required_conan_version = ">=1.33.0" - +required_conan_version = ">=1.57.0" class Pthreads4WConan(ConanFile): name = "pthreads4w" + package_type = "library" url = "https://github.com/conan-io/conan-center-index" homepage = "https://sourceforge.net/projects/pthreads4w/" description = "POSIX Threads for Windows" @@ -22,54 +26,55 @@ class Pthreads4WConan(ConanFile): "exception_scheme": "default", } - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _settings_build(self): return getattr(self, "settings_build", self.settings) 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.compiler != "Visual Studio": + if not is_msvc(self): 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") + 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 validate(self): if self.settings.os != "Windows": raise ConanInvalidConfiguration("pthreads4w can only target os=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 _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - self._autotools.configure() - return self._autotools + def generate(self): + if is_msvc(self): + tc = NMakeToolchain(self) + tc.generate() + else: + tc = AutotoolsToolchain(self) + tc.generate() def build(self): - with tools.chdir(self._source_subfolder): - if self.settings.compiler == "Visual Studio": - tools.replace_in_file("Makefile", + with chdir(self, self.source_folder): + if is_msvc(self): + makefile = os.path.join(self.source_folder, "Makefile") + replace_in_file(self, makefile, " copy pthreadV*.lib $(LIBDEST)", " if exist pthreadV*.lib copy pthreadV*.lib $(LIBDEST)") - tools.replace_in_file("Makefile", + replace_in_file(self, makefile, " copy libpthreadV*.lib $(LIBDEST)", " if exist libpthreadV*.lib copy libpthreadV*.lib $(LIBDEST)") - tools.replace_in_file("Makefile", "XCFLAGS=\"/MD\"", "") - tools.replace_in_file("Makefile", "XCFLAGS=\"/MDd\"", "") - tools.replace_in_file("Makefile", "XCFLAGS=\"/MT\"", "") - tools.replace_in_file("Makefile", "XCFLAGS=\"/MTd\"", "") + replace_in_file(self, makefile, "XCFLAGS=\"/MD\"", "") + replace_in_file(self, makefile, "XCFLAGS=\"/MDd\"", "") + replace_in_file(self, makefile, "XCFLAGS=\"/MT\"", "") + replace_in_file(self, makefile, "XCFLAGS=\"/MTd\"", "") target = { "CPP": "VCE", "SEH": "SSE", @@ -78,14 +83,13 @@ def build(self): target += "-static" if self.settings.build_type == "Debug": target += "-debug" - with tools.vcvars(self): - with tools.environment_append(VisualStudioBuildEnvironment(self).vars): - self.run("nmake {}".format(target)) - else: - self.run("{}".format(tools.get_env("AUTOHEADER")), win_bash=tools.os_info.is_windows) - self.run("{} -fiv".format(tools.get_env("AUTORECONF")), win_bash=tools.os_info.is_windows) - autotools = self._configure_autotools() + self.run(f"nmake {target}") + else: + autotools = Autotools(self) + self.run("autoheader") + autotools.autoreconf() + autotools.configure() make_target = "GCE" if self.options.exception_scheme == "CPP" else "GC" if not self.options.shared: @@ -95,26 +99,24 @@ def build(self): autotools.make(target=make_target, args=["-j1"]) def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - with tools.chdir(self._source_subfolder): - if self.settings.compiler == "Visual Studio": - with tools.vcvars(self): - with tools.environment_append(VisualStudioBuildEnvironment(self).vars): - self.run("nmake install DESTROOT={}".format(self.package_folder)) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + with chdir(self, self.source_folder): + if is_msvc(self): + self.run("nmake install DESTROOT={}".format(self.package_folder), env="conanbuild") else: - autotools = self._configure_autotools() - tools.mkdir(os.path.join(self.package_folder, "include")) - tools.mkdir(os.path.join(self.package_folder, "lib")) - autotools.make(target="install-headers") + autotools = Autotools(self) + mkdir(self, os.path.join(self.package_folder, "include")) + mkdir(self, os.path.join(self.package_folder, "lib")) + autotools.install(target="install-headers") if self.options.shared: - tools.mkdir(os.path.join(self.package_folder, "bin")) - autotools.make(target="install-dlls") - autotools.make(target="install-implib-default") + mkdir(self, os.path.join(self.package_folder, "bin")) + autotools.install(target="install-dlls") + autotools.install(target="install-implib-default") else: - autotools.make(target="install-lib-default") + autotools.install(target="install-lib-default") def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = collect_libs(self) self.cpp_info.defines.append(self._exception_scheme_definition) if not self.options.shared: self.cpp_info.defines.append("__PTW32_STATIC_LIB") diff --git a/recipes/pthreads4w/all/test_package/CMakeLists.txt b/recipes/pthreads4w/all/test_package/CMakeLists.txt index 7b9b613cbb24a..c870341fd9666 100644 --- a/recipes/pthreads4w/all/test_package/CMakeLists.txt +++ b/recipes/pthreads4w/all/test_package/CMakeLists.txt @@ -1,8 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package C) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(pthreads4w REQUIRED) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) + +target_link_libraries(${PROJECT_NAME} PRIVATE pthreads4w::pthreads4w) diff --git a/recipes/pthreads4w/all/test_package/conanfile.py b/recipes/pthreads4w/all/test_package/conanfile.py index d4128b0450777..a9fbb7f543162 100644 --- a/recipes/pthreads4w/all/test_package/conanfile.py +++ b/recipes/pthreads4w/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" + 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(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/pthreads4w/all/test_v1_package/CMakeLists.txt b/recipes/pthreads4w/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..993b1d536d435 --- /dev/null +++ b/recipes/pthreads4w/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() + +add_executable(${PROJECT_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) diff --git a/recipes/pthreads4w/all/test_v1_package/conanfile.py b/recipes/pthreads4w/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..d4128b0450777 --- /dev/null +++ b/recipes/pthreads4w/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" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if 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/conandata.yml b/recipes/pugixml/all/conandata.yml index 3576ef081c86d..cfdd629e0abb2 100644 --- a/recipes/pugixml/all/conandata.yml +++ b/recipes/pugixml/all/conandata.yml @@ -1,13 +1,16 @@ sources: + "1.14": + url: "https://github.com/zeux/pugixml/releases/download/v1.14/pugixml-1.14.tar.gz" + sha256: "2f10e276870c64b1db6809050a75e11a897a8d7456c4be5c6b2e35a11168a015" "1.13": - url: "https://github.com/zeux/pugixml/archive/v1.13.tar.gz" - sha256: "5c5ad5d7caeb791420408042a7d88c2c6180781bf218feca259fd9d840a888e1" + 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 e43b3ee095943..7ac623ed2f081 100644 --- a/recipes/pugixml/all/conanfile.py +++ b/recipes/pugixml/all/conanfile.py @@ -5,7 +5,7 @@ from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.54.0" class PugiXmlConan(ConanFile): @@ -15,6 +15,7 @@ class PugiXmlConan(ConanFile): license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://pugixml.org/" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { @@ -37,11 +38,9 @@ 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: - if self.settings.os != "Windows": - del self.options.fPIC del self.options.shared def layout(self): @@ -51,7 +50,7 @@ def layout(self): cmake_layout(self, src_folder="src") def package_id(self): - if self.options.header_only: + if self.info.options.header_only: self.info.clear() def validate(self): @@ -60,8 +59,7 @@ def validate(self): raise ConanInvalidConfiguration("Combination of 'shared' and 'wchar_mode' options 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: @@ -69,8 +67,6 @@ def generate(self): tc.variables["BUILD_TESTS"] = False # 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() def build(self): @@ -102,7 +98,8 @@ 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") - self.cpp_info.resdirs = [] + 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") diff --git a/recipes/pugixml/all/test_v1_package/CMakeLists.txt b/recipes/pugixml/all/test_v1_package/CMakeLists.txt index 4099ebfb2c5c9..0d20897301b68 100644 --- a/recipes/pugixml/all/test_v1_package/CMakeLists.txt +++ b/recipes/pugixml/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(pugixml REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE pugixml::pugixml) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/pugixml/config.yml b/recipes/pugixml/config.yml index 191cc957e0c3b..384412d36091f 100644 --- a/recipes/pugixml/config.yml +++ b/recipes/pugixml/config.yml @@ -1,4 +1,6 @@ versions: + "1.14": + folder: "all" "1.13": folder: "all" "1.12.1": diff --git a/recipes/pulseaudio/all/conanfile.py b/recipes/pulseaudio/all/conanfile.py index 8f2092db76bbf..002d47cbedf08 100644 --- a/recipes/pulseaudio/all/conanfile.py +++ b/recipes/pulseaudio/all/conanfile.py @@ -1,22 +1,25 @@ +import os + from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.env import VirtualBuildEnv +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, PkgConfigDeps 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,61 +48,60 @@ 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 + def layout(self): + basic_layout(self, src_folder="src") + def requirements(self): self.requires("libiconv/1.17") - self.requires("libsndfile/1.0.31") - self.requires("libcap/2.65") + self.requires("libsndfile/1.2.2") + self.requires("libcap/2.69") self.requires("libtool/2.4.7") if self.options.with_alsa: - self.requires("libalsa/1.2.7.2") + self.requires("libalsa/1.2.10") if self.options.with_glib: - self.requires("glib/2.73.3") + self.requires("glib/2.78.3") if self.options.get_safe("with_fftw"): - self.requires("fftw/3.3.9") + self.requires("fftw/3.3.10") if self.options.with_x11: self.requires("xorg/system") if self.options.with_openssl: - self.requires("openssl/1.1.1q") + self.requires("openssl/[>=1.1 <4]") if self.options.with_dbus: - self.requires("dbus/1.12.20") + self.requires("dbus/1.15.8") def validate(self): - if self.info.settings.os != "Linux": + if self.settings.os != "Linux": raise ConanInvalidConfiguration("pulseaudio supports only linux currently") if self.options.get_safe("with_fftw"): - fftw_precision = self.dependencies["fftw"].options.precision - if fftw_precision != "single": + if not self.dependencies["fftw"].options.precision_single: raise ConanInvalidConfiguration( - f"Pulse audio cannot use fftw {fftw_precision} precision. " - "Either set option fftw:precision=single or pulseaudio:with_fftw=False" + f"Pulse audio uses fftw single precision. " + "Either set option -o fftw/*:precision_single=True or -o pulseaudio/*:with_fftw=False" ) def build_requirements(self): self.tool_requires("gettext/0.21") 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/2.1.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() + 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([ @@ -107,11 +109,15 @@ def generate(self): f"--enable-static={yes_no(not self.options.shared)}", f"--enable-glib2={yes_no(self.options.with_glib)}", f"--with-fftw={yes_no(self.options.get_safe('with_fftw'))}", - f"--with-udev-rules-dir={os.path.join(self.package_folder, 'bin', 'udev', 'rules.d')}", + "--with-udev-rules-dir=${prefix}/bin/udev/rules.d", f"--with-systemduserunitdir={os.path.join(self.build_folder, 'ignore')}", ]) + # Workaround for https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=268250 + # clang-15 works, but we need to skip the gnu11 flag check + if self.settings.compiler == "clang" and self.settings.compiler.version == 15: + tc.configure_args.append("ax_cv_check_cflags__pedantic__Werror__std_gnu11=yes") for lib in ["alsa", "x11", "openssl", "dbus"]: - tc.configure_args.append(f"--enable-{lib}={yes_no(getattr(self.options, 'with_' + lib))}") + tc.configure_args.append(f"--enable-{lib}={yes_no(getattr(self.options, f'with_{lib}'))}") # TODO: to remove when automatically handled by AutotoolsToolchain tc.configure_args.append("--libexecdir=${prefix}/bin") tc.generate() @@ -119,8 +125,6 @@ def generate(self): deps.generate() pkg = PkgConfigDeps(self) pkg.generate() - env = VirtualBuildEnv(self) - env.generate() def build(self): autotools = Autotools(self) @@ -147,7 +151,7 @@ def package_info(self): if self.options.get_safe("with_fftw"): self.cpp_info.components["pulse"].requires.append("fftw::fftw") if self.options.with_x11: - self.cpp_info.components["pulse"].requires.append("xorg::xorg") + self.cpp_info.components["pulse"].requires.extend(["xorg::x11", "xorg::x11-xcb"]) if self.options.with_openssl: self.cpp_info.components["pulse"].requires.append("openssl::openssl") if self.options.with_dbus: 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/pulseaudio/config.yml b/recipes/pulseaudio/config.yml index 4aaa9c6cc7082..6c0f518e5ed25 100644 --- a/recipes/pulseaudio/config.yml +++ b/recipes/pulseaudio/config.yml @@ -1,4 +1,6 @@ versions: + "17.0": + folder: meson "14.2": folder: all "14.0": diff --git a/recipes/pulseaudio/meson/conandata.yml b/recipes/pulseaudio/meson/conandata.yml new file mode 100644 index 0000000000000..3380326dc7539 --- /dev/null +++ b/recipes/pulseaudio/meson/conandata.yml @@ -0,0 +1,4 @@ +sources: + "17.0": + url: "https://www.freedesktop.org/software/pulseaudio/releases/pulseaudio-17.0.tar.xz" + sha256: "053794d6671a3e397d849e478a80b82a63cb9d8ca296bd35b73317bb5ceb87b5" diff --git a/recipes/pulseaudio/meson/conanfile.py b/recipes/pulseaudio/meson/conanfile.py new file mode 100644 index 0000000000000..470080481b438 --- /dev/null +++ b/recipes/pulseaudio/meson/conanfile.py @@ -0,0 +1,148 @@ +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, rm, rmdir +from conan.tools.gnu import PkgConfigDeps +from conan.tools.meson import Meson, MesonToolchain +from conan.tools.layout import basic_layout +import os + +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", "audio", "sound-server") + url = "https://github.com/conan-io/conan-center-index" + homepage = "http://pulseaudio.org/" + license = "LGPL-2.1" + + package_type = "shared-library" + settings = "os", "arch", "compiler", "build_type" + options = { + "with_glib": [True, False], + "with_fftw": [True, False], + "with_x11": [True, False], + "with_openssl": [True, False], + "with_dbus": [True, False], + } + default_options = { + "with_glib": False, + "with_fftw": False, + "with_x11": True, + "with_openssl": True, + "with_dbus": False, + } + + def config_options(self): + if self.settings.os not in ['Linux', 'FreeBSD']: + del self.options.with_x11 + + def configure(self): + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + if not self.options.with_dbus: + del self.options.with_fftw + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("libgettext/0.22") + self.requires("libiconv/1.17") + self.requires("libsndfile/1.2.2") + if self.options.with_glib: + self.requires("glib/2.78.1") + if self.options.get_safe("with_fftw"): + self.requires("fftw/3.3.10") + if self.options.get_safe("with_x11"): + self.requires("xorg/system") + if self.options.with_openssl: + self.requires("openssl/[>=1.1 <4]") + if self.options.with_dbus: + self.requires("dbus/1.15.8") + + def validate(self): + if self.settings.os != "Linux": + raise ConanInvalidConfiguration(f"{self.ref} recipe is only compatible with Linux right now. Contributions are welcome.") + + if self.options.get_safe("with_fftw"): + if not self.dependencies["fftw"].options.precision_single: + raise ConanInvalidConfiguration( + "Pulse audio uses fftw single precision. " + "Either set option -o fftw/*:precision_single=True or -o pulseaudio/*:with_fftw=False" + ) + + def build_requirements(self): + self.tool_requires("m4/1.4.19") + self.tool_requires("meson/1.3.2") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/2.1.0") + + 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['udevrulesdir']="${prefix}/bin/udev/rules.d" + tc.project_options['systemduserunitdir'] = os.path.join(self.build_folder, 'ignore') + for lib in ["x11", "openssl", "dbus", "glib", "fftw"]: + tc.project_options[lib] = "enabled" if self.options.get_safe(f"with_{lib}") else "disabled" + tc.project_options['database'] = 'simple' + tc.project_options['tests'] = False + tc.project_options['man'] = False + tc.project_options['doxygen'] = False + tc.project_options["daemon"] = False + tc.generate() + pkg = PkgConfigDeps(self) + pkg.generate() + + def build(self): + meson = Meson(self) + meson.configure() + meson.build() + + def package(self): + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + meson = Meson(self) + meson.install() + rmdir(self, os.path.join(self.package_folder, "etc")) + 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")) + rm(self, "*.la", os.path.join(self.package_folder, "lib"), recursive=True) + + def package_info(self): + self.cpp_info.components["pulse"].set_property("pkg_config_name", "libpulse") + self.cpp_info.components["pulse"].libs = ["pulse", f"pulsecommon-{self.version}"] + self.cpp_info.components["pulse"].libdirs.append(os.path.join("lib", "pulseaudio")) + self.cpp_info.components["pulse"].requires = ["libiconv::libiconv", "libsndfile::libsndfile", "libgettext::libgettext"] + if self.options.get_safe("with_fftw"): + self.cpp_info.components["pulse"].requires.append("fftw::fftw") + if self.options.get_safe("with_x11"): + self.cpp_info.components["pulse"].requires.append("xorg::xorg") + if self.options.with_openssl: + self.cpp_info.components["pulse"].requires.append("openssl::openssl") + if self.options.with_dbus: + self.cpp_info.components["pulse"].requires.append("dbus::dbus") + + self.cpp_info.components["pulse-simple"].set_property("pkg_config_name", "libpulse-simple") + self.cpp_info.components["pulse-simple"].libs = ["pulse-simple"] + self.cpp_info.components["pulse-simple"].defines.append("_REENTRANT") + self.cpp_info.components["pulse-simple"].requires = ["pulse"] + + if self.options.with_glib: + self.cpp_info.components["pulse-mainloop-glib"].set_property("pkg_config_name", "libpulse-mainloop-glib") + self.cpp_info.components["pulse-mainloop-glib"].libs = ["pulse-mainloop-glib"] + self.cpp_info.components["pulse-mainloop-glib"].defines.append("_REENTRANT") + self.cpp_info.components["pulse-mainloop-glib"].requires = ["pulse", "glib::glib-2.0"] + + # FIXME: add cmake generators when conan can generate PULSEAUDIO_INCLUDE_DIR PULSEAUDIO_LIBRARY vars diff --git a/recipes/pulseaudio/meson/test_package/CMakeLists.txt b/recipes/pulseaudio/meson/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..a9b88d597549a --- /dev/null +++ b/recipes/pulseaudio/meson/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +find_package(pulseaudio REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE pulseaudio::pulseaudio) diff --git a/recipes/pulseaudio/meson/test_package/conanfile.py b/recipes/pulseaudio/meson/test_package/conanfile.py new file mode 100644 index 0000000000000..8a5bb47f50c4c --- /dev/null +++ b/recipes/pulseaudio/meson/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/pulseaudio/meson/test_package/test_package.c b/recipes/pulseaudio/meson/test_package/test_package.c new file mode 100644 index 0000000000000..bb944137b6045 --- /dev/null +++ b/recipes/pulseaudio/meson/test_package/test_package.c @@ -0,0 +1,8 @@ +#include +#include + +int main() +{ + printf("pulse audio verions %s\n", pa_get_library_version()); + return 0; +} diff --git a/recipes/pupnp/all/conandata.yml b/recipes/pupnp/all/conandata.yml index 388307853302a..7964480fefad5 100644 --- a/recipes/pupnp/all/conandata.yml +++ b/recipes/pupnp/all/conandata.yml @@ -8,3 +8,6 @@ sources: "1.14.12": url: "https://github.com/pupnp/pupnp/archive/release-1.14.12.tar.gz" sha256: "6a7f26818d5aa3949bc2e68739387a261c564430ba612f793c61d31619dde1e4" + "1.14.18": + url: "https://github.com/pupnp/pupnp/archive/release-1.14.18.tar.gz" + sha256: "8b038be04c04886b6304c0878f7eb502c8f4800524acf44ce8f9cd7f9319df90" diff --git a/recipes/pupnp/all/conanfile.py b/recipes/pupnp/all/conanfile.py index be3c8ca6dae34..718caaaae44f4 100644 --- a/recipes/pupnp/all/conanfile.py +++ b/recipes/pupnp/all/conanfile.py @@ -1,8 +1,15 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, 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 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 + +required_conan_version = ">=1.53.0" class PupnpConan(ConanFile): @@ -15,8 +22,10 @@ class PupnpConan(ConanFile): license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/pupnp/pupnp" - topics = ("conan", "upnp", "networking") - settings = "os", "compiler", "build_type", "arch" + topics = ("upnp", "networking") + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -28,7 +37,7 @@ class PupnpConan(ConanFile): "largefile": [True, False], "tools": [True, False], "blocking-tcp": [True, False], - "debug": [True, False] + "debug": [True, False], } default_options = { "shared": False, @@ -41,95 +50,75 @@ class PupnpConan(ConanFile): "largefile": True, "tools": True, "blocking-tcp": False, - "debug": True # Actually enables logging routines... + "debug": 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 + 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): + basic_layout(self, src_folder="src") def validate(self): - if self.settings.compiler == "Visual Studio": + if is_msvc(self): # Note, pupnp has build instructions for Visual Studio but they # include VC 6 and require pthreads-w32 library. # Someone who needs it and has possibility to build it could step in. raise ConanInvalidConfiguration("Visual Studio not supported yet in this recipe") - @property - def _settings_build(self): - return getattr(self, "settings_build", self.settings) - def build_requirements(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", default=False, check_type=str): + self.tool_requires("pkgconf/2.0.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) - - def _configure_autotools(self): - if not self._autotools: - args = [ - "--enable-static=%s" % ("no" if self.options.shared else "yes"), - "--enable-shared=%s" % ("yes" if self.options.shared else "no"), - "--disable-samples", - ] - - def enable_disable(opt): - what = "enable" if getattr(self.options, opt) else "disable" - return "--{}-{}".format(what, opt) - - args.extend( - map( - enable_disable, - ( - "ipv6", - "reuseaddr", - "webserver", - "client", - "device", - "largefile", - "tools", - "debug" - ), - ) - ) - - args.append("--%s-blocking_tcp_connections" % ("enable" if getattr(self.options, "blocking-tcp") else "disable")) - - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - 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): + env = VirtualBuildEnv(self) + env.generate() + tc = AutotoolsToolchain(self) + features = {} + features["samples"] = False + features["blocking_tcp_connections"] = self.options["blocking-tcp"] + for opt in ("ipv6", "reuseaddr", "webserver", "client", "device", "largefile", "tools", "debug"): + features[opt] = self.options.get_safe(opt) + for feature, enabled in features.items(): + what = "enable" if enabled else "disable" + tc.configure_args.append(f"--{what}-{feature}") + tc.generate() def build(self): - 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() + autotools.configure() autotools.make() def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - autotools = self._configure_autotools() + copy(self, "COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + 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", self.package_folder, recursive=True) + fix_apple_shared_install_name(self) def package_info(self): - self.cpp_info.names["pkg_config"] = "libupnp" + self.cpp_info.set_property("pkg_config_name", "libupnp") self.cpp_info.libs = ["upnp", "ixml"] self.cpp_info.includedirs.append(os.path.join("include", "upnp")) if self.settings.os in ["Linux", "FreeBSD"]: diff --git a/recipes/pupnp/all/test_package/CMakeLists.txt b/recipes/pupnp/all/test_package/CMakeLists.txt index 4715fd995b522..d453ce024a968 100644 --- a/recipes/pupnp/all/test_package/CMakeLists.txt +++ b/recipes/pupnp/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ -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(pupnp REQUIRED) +find_package(pupnp REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) target_link_libraries(${PROJECT_NAME} pupnp::pupnp) diff --git a/recipes/pupnp/all/test_package/conanfile.py b/recipes/pupnp/all/test_package/conanfile.py index 91263ae215697..ef5d7042163ec 100644 --- a/recipes/pupnp/all/test_package/conanfile.py +++ b/recipes/pupnp/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 CMake, ConanFile, tools +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" -class PupnpTestConan(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,5 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self, skip_x64_x86=True): - self.run(os.path.join("bin", "test_package"), 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/pupnp/all/test_v1_package/CMakeLists.txt b/recipes/pupnp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/pupnp/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/pupnp/all/test_v1_package/conanfile.py b/recipes/pupnp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..b1255b47b830e --- /dev/null +++ b/recipes/pupnp/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +import os + +from conans import CMake, ConanFile, tools + + +class PupnpTestConan(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): + self.run(os.path.join("bin", "test_package"), run_environment=True) diff --git a/recipes/pupnp/config.yml b/recipes/pupnp/config.yml index 700325f13fdc8..1338c7bbcf33f 100644 --- a/recipes/pupnp/config.yml +++ b/recipes/pupnp/config.yml @@ -5,3 +5,5 @@ versions: folder: all "1.14.12": folder: all + "1.14.18": + folder: all diff --git a/recipes/pybind11/all/conandata.yml b/recipes/pybind11/all/conandata.yml index d2814f09ff728..5901aae7c96f6 100644 --- a/recipes/pybind11/all/conandata.yml +++ b/recipes/pybind11/all/conandata.yml @@ -1,19 +1,43 @@ sources: - 2.7.1: - url: "https://github.com/pybind/pybind11/archive/v2.7.1.tar.gz" - sha256: "616d1c42e4cf14fa27b2a4ff759d7d7b33006fdc5ad8fd603bb2c22622f27020" - 2.8.1: - url: "https://github.com/pybind/pybind11/archive/v2.8.1.tar.gz" - sha256: "f1bcc07caa568eb312411dde5308b1e250bd0e1bc020fae855bf9f43209940cc" - 2.9.1: - url: "https://github.com/pybind/pybind11/archive/v2.9.1.tar.gz" - sha256: "c6160321dc98e6e1184cc791fbeadd2907bb4a0ce0e447f2ea4ff8ab56550913" - 2.9.2: - url: "https://github.com/pybind/pybind11/archive/v2.9.2.tar.gz" - sha256: "6bd528c4dbe2276635dc787b6b1f2e5316cf6b49ee3e150264e455a0d68d19c1" + "2.13.6": + url: "https://github.com/pybind/pybind11/archive/v2.13.6.tar.gz" + sha256: "e08cb87f4773da97fa7b5f035de8763abc656d87d5773e62f6da0587d1f0ec20" + "2.13.5": + url: "https://github.com/pybind/pybind11/archive/v2.13.5.tar.gz" + sha256: "b1e209c42b3a9ed74da3e0b25a4f4cd478d89d5efbb48f04b277df427faf6252" + "2.13.4": + url: "https://github.com/pybind/pybind11/archive/v2.13.4.tar.gz" + sha256: "efc901aa0aab439a3fea6efeaf930b5a349fb06394bf845c64ce15a9cf8f0240" + "2.13.2": + url: "https://github.com/pybind/pybind11/archive/v2.13.2.tar.gz" + sha256: "50eebef369d28f07ce1fe1797f38149e5928817be8e539239f2aadfd95b227f3" + "2.13.1": + url: "https://github.com/pybind/pybind11/archive/v2.13.1.tar.gz" + sha256: "51631e88960a8856f9c497027f55c9f2f9115cafb08c0005439838a05ba17bfc" + "2.12.0": + url: "https://github.com/pybind/pybind11/archive/v2.12.0.tar.gz" + sha256: "bf8f242abd1abcd375d516a7067490fb71abd79519a282d22b6e4d19282185a7" + "2.11.1": + url: "https://github.com/pybind/pybind11/archive/v2.11.1.tar.gz" + sha256: "d475978da0cdc2d43b73f30910786759d593a9d8ee05b1b6846d1eb16c6d2e0c" + "2.10.4": + url: "https://github.com/pybind/pybind11/archive/v2.10.4.tar.gz" + sha256: "832e2f309c57da9c1e6d4542dedd34b24e4192ecb4d62f6f4866a737454c9970" + "2.10.1": + url: "https://github.com/pybind/pybind11/archive/v2.10.1.tar.gz" + sha256: "111014b516b625083bef701df7880f78c2243835abdb263065b6b59b960b6bad" "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" + "2.9.2": + url: "https://github.com/pybind/pybind11/archive/v2.9.2.tar.gz" + sha256: "6bd528c4dbe2276635dc787b6b1f2e5316cf6b49ee3e150264e455a0d68d19c1" + "2.9.1": + url: "https://github.com/pybind/pybind11/archive/v2.9.1.tar.gz" + sha256: "c6160321dc98e6e1184cc791fbeadd2907bb4a0ce0e447f2ea4ff8ab56550913" + "2.8.1": + url: "https://github.com/pybind/pybind11/archive/v2.8.1.tar.gz" + sha256: "f1bcc07caa568eb312411dde5308b1e250bd0e1bc020fae855bf9f43209940cc" + "2.7.1": + url: "https://github.com/pybind/pybind11/archive/v2.7.1.tar.gz" + sha256: "616d1c42e4cf14fa27b2a4ff759d7d7b33006fdc5ad8fd603bb2c22622f27020" diff --git a/recipes/pybind11/all/conanfile.py b/recipes/pybind11/all/conanfile.py index 4ca688fce0b2b..8dc874bff4b37 100644 --- a/recipes/pybind11/all/conanfile.py +++ b/recipes/pybind11/all/conanfile.py @@ -2,6 +2,7 @@ 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 +from conan.tools.scm import Version import os @@ -11,18 +12,22 @@ class PyBind11Conan(ConanFile): name = "pybind11" description = "Seamless operability between C++11 and Python" - topics = "pybind11", "python", "binding" - homepage = "https://github.com/pybind/pybind11" license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/pybind/pybind11" + topics = ("pybind11", "python", "binding", "header-only") + package_type = "header-library" 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -45,16 +50,14 @@ def package(self): rmdir(self, os.path.join(self.package_folder, "share")) + checked_target = "lto" if self.version < Version("2.11.0") else "pybind11" replace_in_file(self, os.path.join(self.package_folder, "lib", "cmake", "pybind11", "pybind11Common.cmake"), - "if(TARGET pybind11::lto)", + f"if(TARGET pybind11::{checked_target})", "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") self.cpp_info.set_property("cmake_target_name", "pybind11_all_do_not_use") diff --git a/recipes/pybind11/all/test_package/CMakeLists.txt b/recipes/pybind11/all/test_package/CMakeLists.txt index d142acb135035..a0ddd8851c031 100644 --- a/recipes/pybind11/all/test_package/CMakeLists.txt +++ b/recipes/pybind11/all/test_package/CMakeLists.txt @@ -1,5 +1,7 @@ -cmake_minimum_required(VERSION 3.4) -project(test_package CXX) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + 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 8c98920d26587..1022e21500a40 100644 --- a/recipes/pybind11/all/test_package/conanfile.py +++ b/recipes/pybind11/all/test_package/conanfile.py @@ -9,7 +9,7 @@ class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" + settings = "os", "arch", "compiler", "build_type" test_type = "explicit" def requirements(self): @@ -20,6 +20,9 @@ def generate(self): deps.generate() toolchain = CMakeToolchain(self) + # Used by FindPython.cmake in CMake + toolchain.variables["Python_EXECUTABLE"] = PurePath(self._python_interpreter).as_posix() + # Used by FindPythonLibsNew.cmake in pybind11 toolchain.variables["PYTHON_EXECUTABLE"] = PurePath(self._python_interpreter).as_posix() toolchain.generate() @@ -47,4 +50,4 @@ def _python_interpreter(self): def test(self): if can_run(self): module_path = os.path.join(self.source_folder, "test.py") - self.run(f"{self._python_interpreter} {module_path}", env="conanrun") + 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 deleted file mode 100644 index 3cee2617c4143..0000000000000 --- a/recipes/pybind11/all/test_v1_package/CMakeLists.txt +++ /dev/null @@ -1,18 +0,0 @@ -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 deleted file mode 100644 index 922ac10548541..0000000000000 --- a/recipes/pybind11/all/test_v1_package/conanfile.py +++ /dev/null @@ -1,27 +0,0 @@ -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 d015836d04db4..cb2960aa24b66 100644 --- a/recipes/pybind11/config.yml +++ b/recipes/pybind11/config.yml @@ -1,13 +1,29 @@ versions: - "2.7.1": + "2.13.6": folder: all - "2.8.1": + "2.13.5": folder: all - "2.9.1": + "2.13.4": folder: all - "2.9.2": + "2.13.2": folder: all - "2.10.0": + "2.13.1": + folder: all + "2.12.0": + folder: all + "2.11.1": + folder: all + "2.10.4": folder: all "2.10.1": folder: all + "2.10.0": + folder: all + "2.9.2": + folder: all + "2.9.1": + folder: all + "2.8.1": + folder: all + "2.7.1": + folder: all diff --git a/recipes/pybind11_json/all/conanfile.py b/recipes/pybind11_json/all/conanfile.py index 4c4feedd8416a..829dedced7271 100644 --- a/recipes/pybind11_json/all/conanfile.py +++ b/recipes/pybind11_json/all/conanfile.py @@ -1,48 +1,47 @@ -from conans import ConanFile, tools import os -required_conan_version = ">=1.33.0" +from conan import ConanFile +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout + +required_conan_version = ">=1.52.0" class Pybind11JsonConan(ConanFile): name = "pybind11_json" - homepage = "https://github.com/pybind/pybind11_json" description = "An nlohmann_json to pybind11 bridge" - topics = ( - "conan", - "header-only", - "json", - "nlohmann_json", - "pybind11", - "pybind11_json", - "python", - "python-binding", - ) - url = "https://github.com/conan-io/conan-center-index" - no_copy_source = True license = "BSD-3-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/pybind/pybind11_json" + topics = ("header-only", "json", "nlohmann_json", "pybind11", "pybind11_json", "python", "python-binding") - @property - def _source_subfolder(self): - return "source_subfolder" + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True - def package_id(self): - self.info.header_only() + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - self.requires("nlohmann_json/3.9.1") - self.requires("pybind11/2.6.2") + self.requires("nlohmann_json/3.11.2") + self.requires("pybind11/2.10.4") + + def package_id(self): + 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(pattern="LICENSE*", src=self._source_subfolder, dst="licenses") - self.copy( - "*", dst="include", src=os.path.join(self._source_subfolder, "include") - ) + copy(self, "LICENSE*", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder) + copy(self, "*", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include")) def package_info(self): - self.cpp_info.names["cmake_find_package"] = "pybind11_json" - self.cpp_info.names["cmake_find_package_multi"] = "pybind11_json" + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + self.cpp_info.set_property("cmake_target_aliases", ["pybind11_json"]) diff --git a/recipes/pybind11_json/all/test_package/CMakeLists.txt b/recipes/pybind11_json/all/test_package/CMakeLists.txt index d1ca457a18f13..f795a0bec7158 100644 --- a/recipes/pybind11_json/all/test_package/CMakeLists.txt +++ b/recipes/pybind11_json/all/test_package/CMakeLists.txt @@ -1,12 +1,10 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) set(CMAKE_CXX_STANDARD 11) find_package(pybind11_json REQUIRED CONFIG) add_executable(test_package test_package.cpp) -target_link_libraries(test_package PUBLIC pybind11_json::pybind11_json) # FIXME: target should be pybind11_json + # FIXME: target should be pybind11_json, replace once Conan v1 has been dropped +target_link_libraries(test_package PUBLIC pybind11_json::pybind11_json) diff --git a/recipes/pybind11_json/all/test_package/conanfile.py b/recipes/pybind11_json/all/test_package/conanfile.py index 7e2dfe859bb27..fae501d0afb9e 100644 --- a/recipes/pybind11_json/all/test_package/conanfile.py +++ b/recipes/pybind11_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_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" + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/pybind11_json/all/test_package/test_package.cpp b/recipes/pybind11_json/all/test_package/test_package.cpp index 1e50fae0cd666..2ebca6ab52bbd 100644 --- a/recipes/pybind11_json/all/test_package/test_package.cpp +++ b/recipes/pybind11_json/all/test_package/test_package.cpp @@ -17,10 +17,10 @@ int main() { py::scoped_interpreter guard{}; const py::dict original_py_dict{"number"_a=1234, "hello"_a="world"}; - + const nl::json converted_nl_json{original_py_dict}; std::cout << "Converted nlohmann::json contents: " << converted_nl_json << std::endl; - + const py::dict converted_py_dict = converted_nl_json.front(); // assigning the only list element std::cout << "Converted py::dict contents: {hello:" << converted_py_dict["hello"].cast() diff --git a/recipes/pybind11_json/all/test_v1_package/CMakeLists.txt b/recipes/pybind11_json/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/pybind11_json/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/pybind11_json/all/test_v1_package/conanfile.py b/recipes/pybind11_json/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..7e2dfe859bb27 --- /dev/null +++ b/recipes/pybind11_json/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/pystring/all/conanfile.py b/recipes/pystring/all/conanfile.py index aae1b97c58843..1f4b786341b1d 100644 --- a/recipes/pystring/all/conanfile.py +++ b/recipes/pystring/all/conanfile.py @@ -11,10 +11,10 @@ class PystringConan(ConanFile): description = "Pystring is a collection of C++ functions which match the " \ "interface and behavior of python's string class methods using std::string." license = "BSD-3-Clause" - topics = ("pystring", "string") - homepage = "https://github.com/imageworks/pystring" url = "https://github.com/conan-io/conan-center-index" - + homepage = "https://github.com/imageworks/pystring" + topics = ("python", "string") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -39,8 +39,7 @@ 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/qarchive/all/conandata.yml b/recipes/qarchive/all/conandata.yml index 7ae24ee9ad7ca..5c350fe46c402 100644 --- a/recipes/qarchive/all/conandata.yml +++ b/recipes/qarchive/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "2.2.8": + url: "https://github.com/antony-jr/QArchive/archive/v2.2.8.tar.gz" + sha256: "2f231b48b51de5d730f98bffbff34d7791b61ea766429230d81bce82c7ce1bf9" + "2.2.6": + url: "https://github.com/antony-jr/QArchive/archive/v2.2.6.tar.gz" + sha256: "c0cad2bc79eeb4ab4180fd97822a967b8a0e3c594387ccf921733449ee5bd3e6" + "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" diff --git a/recipes/qarchive/all/conanfile.py b/recipes/qarchive/all/conanfile.py index 5cf8969c4ade0..e44b758e45244 100644 --- a/recipes/qarchive/all/conanfile.py +++ b/recipes/qarchive/all/conanfile.py @@ -1,11 +1,11 @@ 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.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.52.0" +required_conan_version = ">=1.53.0" class QarchiveConan(ConanFile): @@ -18,7 +18,7 @@ class QarchiveConan(ConanFile): "This library helps you to extract and compress archives supported by libarchive" ) topics = ("qt", "compress", "libarchive") - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -42,21 +42,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("libarchive/3.6.1") - self.requires("qt/5.15.7") + self.requires("libarchive/3.7.4") + self.requires("qt/[~5.15]", transitive_headers=True, transitive_libs=True) def build_requirements(self): - self.tool_requires("cmake/3.24.2") - - def layout(self): - cmake_layout(self, src_folder="src") + self.tool_requires("cmake/[>=3.17 <4]") 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) @@ -73,7 +72,7 @@ def build(self): cmake.build() def package(self): - self.copy("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() rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) @@ -105,7 +104,8 @@ def package_info(self): self.cpp_info.set_property("cmake_target_name", "QArchive") self.cpp_info.set_property("pkg_config_name", "QArchive") self.cpp_info.libs = ["QArchive"] - self.cpp_info.includedirs = [os.path.join("include", "QArchive")] + self.cpp_info.includedirs.append(os.path.join("include", "QArchive")) + self.cpp_info.requires = ["qt::qtCore", "libarchive::libarchive"] # TODO: to remove in conan v2 once cmake_find_package_* & pkg_config generators removed self.cpp_info.names["cmake_find_package"] = "QArchive" diff --git a/recipes/qarchive/all/test_package/conanfile.py b/recipes/qarchive/all/test_package/conanfile.py index 0a318ba85a952..8e6ae76816f4e 100644 --- a/recipes/qarchive/all/test_package/conanfile.py +++ b/recipes/qarchive/all/test_package/conanfile.py @@ -1,8 +1,8 @@ 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 +from conan.tools.cmake import CMake, cmake_layout + class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" diff --git a/recipes/qarchive/all/test_v1_package/CMakeLists.txt b/recipes/qarchive/all/test_v1_package/CMakeLists.txt index cf1b8efc8c833..0d20897301b68 100644 --- a/recipes/qarchive/all/test_v1_package/CMakeLists.txt +++ b/recipes/qarchive/all/test_v1_package/CMakeLists.txt @@ -1,13 +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(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) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/qarchive/config.yml b/recipes/qarchive/config.yml index c6b70feeb9340..201ce057fb3e5 100644 --- a/recipes/qarchive/config.yml +++ b/recipes/qarchive/config.yml @@ -1,4 +1,10 @@ versions: + "2.2.8": + folder: all + "2.2.6": + folder: all + "2.2.4": + folder: all "2.2.3": folder: all "2.1.1": diff --git a/recipes/qcbor/all/conandata.yml b/recipes/qcbor/all/conandata.yml index ffeff9a9da5a8..073ab369d8103 100644 --- a/recipes/qcbor/all/conandata.yml +++ b/recipes/qcbor/all/conandata.yml @@ -1,4 +1,16 @@ sources: + "1.5": + url: "https://github.com/laurencelundblade/QCBOR/archive/refs/tags/v1.5.tar.gz" + sha256: "fd71c2aa985575ea5e7df1540da54261f04af872fe4c4e76bfe56affc14dcd2a" + "1.4.1": + url: "https://github.com/laurencelundblade/QCBOR/archive/refs/tags/v1.4.1.tar.gz" + sha256: "c7ef031b60b23bf8ede47c66c9713982bba2608668b144280a65665bfcc94470" + "1.3": + url: "https://github.com/laurencelundblade/QCBOR/archive/refs/tags/v1.3.tar.gz" + sha256: "5acd3f3e7b19aad074813736a8776e71859d57c4dec9bfb85cd1dc6c219c8033" + "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" @@ -6,6 +18,22 @@ sources: url: "https://github.com/laurencelundblade/QCBOR/archive/refs/tags/v1.0.tar.gz" sha256: "961a46eb5a599cc040bfce4f4fade4427e046f1748f37ba4ebbc097fb9cdf1d3" patches: + "1.5": + - patch_file: "patches/1.5-0001-fix-cmake.patch" + patch_description: "disable fix fPIC and add installation" + patch_type: "conan" + "1.4.1": + - patch_file: "patches/1.4.1-0001-fix-cmake.patch" + patch_description: "disable fix fPIC and add installation" + patch_type: "conan" + "1.3": + - patch_file: "patches/1.2-0001-fix-cmake.patch" + patch_description: "disable fix fPIC and add installation" + patch_type: "conan" + "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" diff --git a/recipes/qcbor/all/conanfile.py b/recipes/qcbor/all/conanfile.py index 17104f105cbf8..68b5a4f311351 100644 --- a/recipes/qcbor/all/conanfile.py +++ b/recipes/qcbor/all/conanfile.py @@ -1,11 +1,12 @@ from conan import ConanFile -from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, rmdir, load, save +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, rmdir, load, save, copy from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.scm import Version import os import re -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class QCBORConan(ConanFile): name = "qcbor" @@ -14,14 +15,17 @@ class QCBORConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/laurencelundblade/QCBOR" topics = ("serialization", "cbor", "rfc-7049", "rfc-8949") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], + "disable_float": [False, "HW_USE", "PREFERRED", "ALL"], } default_options = { "shared": False, "fPIC": True, + "disable_float": False, } def export_sources(self): @@ -31,29 +35,32 @@ 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: - 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 + if self.settings.os == "Windows": + self.package_type = "static-library" + del self.options.shared + if self.options.get_safe("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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) + tc.variables["BUILD_QCBOR_TEST"] = False + 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): @@ -67,12 +74,16 @@ def package(self): cmake.install() rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) - # Extract the License/s from README.md to a file - tmp = load(self, os.path.join(self.source_folder, "inc", "qcbor", "qcbor.h")) - license_contents = re.search("( Copyright.*) =====", tmp, re.DOTALL)[1] - save(self, os.path.join(self.package_folder, "licenses", "LICENSE"), license_contents) + if Version(self.version) >= "1.5": + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + else: + # Extract the License/s from README.md to a file + tmp = load(self, os.path.join(self.source_folder, "inc", "qcbor", "qcbor.h")) + license_contents = re.search("( Copyright.*) =====", tmp, re.DOTALL)[1] + 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.0-0001-fix-cmake.patch b/recipes/qcbor/all/patches/1.0-0001-fix-cmake.patch index d5f6fcb7e4dba..87fc6cae3601f 100644 --- a/recipes/qcbor/all/patches/1.0-0001-fix-cmake.patch +++ b/recipes/qcbor/all/patches/1.0-0001-fix-cmake.patch @@ -2,14 +2,10 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt index 8a5bcd0..744662e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -17,3 +17,18 @@ set(SOURCE +@@ -17,3 +17,14 @@ set(SOURCE ) add_library(qcbor ${SOURCE}) -+set_target_properties(qcbor PROPERTIES -+ WINDOWS_EXPORT_ALL_SYMBOLS ON -+) -+ +find_library(LIBM m) +target_link_libraries(qcbor PRIVATE $<$:${LIBM}>) + diff --git a/recipes/qcbor/all/patches/1.1-0001-fix-cmake.patch b/recipes/qcbor/all/patches/1.1-0001-fix-cmake.patch index e5969488c2420..ca95e01302dce 100644 --- a/recipes/qcbor/all/patches/1.1-0001-fix-cmake.patch +++ b/recipes/qcbor/all/patches/1.1-0001-fix-cmake.patch @@ -2,15 +2,10 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt index f0b67b9..4b00b8b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -17,3 +17,19 @@ set(SOURCE +@@ -17,3 +17,14 @@ 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}>) + 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..f50844b0bec9a --- /dev/null +++ b/recipes/qcbor/all/patches/1.2-0001-fix-cmake.patch @@ -0,0 +1,29 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 486946c..4234a59 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -58,10 +58,10 @@ target_compile_definitions(qcbor + $<$:USEFULBUF_DISABLE_ALL_FLOAT> + ) + +-if (BUILD_SHARED_LIBS) ++if (0) + target_compile_options(qcbor PRIVATE -Os -fPIC) + endif() + + # 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 +75,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/patches/1.4.1-0001-fix-cmake.patch b/recipes/qcbor/all/patches/1.4.1-0001-fix-cmake.patch new file mode 100644 index 0000000000000..81b3950d82ca7 --- /dev/null +++ b/recipes/qcbor/all/patches/1.4.1-0001-fix-cmake.patch @@ -0,0 +1,26 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index e4aa83f..4878a31 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -58,10 +58,10 @@ target_compile_definitions(qcbor + $<$:USEFULBUF_DISABLE_ALL_FLOAT> + ) + +-if (BUILD_SHARED_LIBS) ++if (0) + target_compile_options(qcbor PRIVATE -Os -fPIC) + endif() + + # 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") +@@ -88,6 +88,9 @@ set_target_properties( + include(GNUInstallDirs) + install( + TARGETS qcbor ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/qcbor" + ) + diff --git a/recipes/qcbor/all/patches/1.5-0001-fix-cmake.patch b/recipes/qcbor/all/patches/1.5-0001-fix-cmake.patch new file mode 100644 index 0000000000000..e9e96ba504660 --- /dev/null +++ b/recipes/qcbor/all/patches/1.5-0001-fix-cmake.patch @@ -0,0 +1,23 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 1c7e081..6f4ea4e 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -58,7 +58,7 @@ target_compile_definitions(qcbor + $<$:USEFULBUF_DISABLE_ALL_FLOAT> + ) + +-if (BUILD_SHARED_LIBS) ++if (0) + target_compile_options(qcbor PRIVATE -Os -fPIC) + endif() + +@@ -90,6 +90,9 @@ set_target_properties( + include(GNUInstallDirs) + install( + TARGETS qcbor ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/qcbor" + ) + diff --git a/recipes/qcbor/all/test_v1_package/CMakeLists.txt b/recipes/qcbor/all/test_v1_package/CMakeLists.txt deleted file mode 100644 index 03775e81e82e6..0000000000000 --- a/recipes/qcbor/all/test_v1_package/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(qcbor REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE qcbor::qcbor) diff --git a/recipes/qcbor/config.yml b/recipes/qcbor/config.yml index cb6ed8aaedec6..9feea3cfb2036 100644 --- a/recipes/qcbor/config.yml +++ b/recipes/qcbor/config.yml @@ -1,4 +1,12 @@ versions: + "1.5": + folder: all + "1.4.1": + folder: all + "1.3": + folder: all + "1.2": + folder: all "1.1": folder: all "1.0": 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/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/qdbm/all/CMakeLists.txt b/recipes/qdbm/all/CMakeLists.txt index 39427c2f3ccc3..504c6e681a712 100644 --- a/recipes/qdbm/all/CMakeLists.txt +++ b/recipes/qdbm/all/CMakeLists.txt @@ -1,11 +1,7 @@ -cmake_minimum_required(VERSION 3.1) - +cmake_minimum_required(VERSION 3.12) project(qdbm_wrapper VERSION "${CONAN_qdbm_VERSION}" LANGUAGES C) -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup(TARGETS KEEP_RPATHS) - -set(QDBM_SRC_DIR ${PROJECT_SOURCE_DIR}/source_subfolder) +set(QDBM_SRC_DIR ${CMAKE_CURRENT_LIST_DIR}/src) # ---- Dependencies ---- @@ -64,9 +60,7 @@ set_target_properties( # ---- Install ---- include(GNUInstallDirs) - -install( - TARGETS qdbm +install(TARGETS qdbm RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" diff --git a/recipes/qdbm/all/conandata.yml b/recipes/qdbm/all/conandata.yml index c04a6ca2954e6..bd41a3e5c73fa 100644 --- a/recipes/qdbm/all/conandata.yml +++ b/recipes/qdbm/all/conandata.yml @@ -1,4 +1,4 @@ sources: "1.8.78": sha256: "b466fe730d751e4bfc5900d1f37b0fb955f2826ac456e70012785e012cdcb73e" - url: http://fallabs.com/qdbm/qdbm-1.8.78.tar.gz + url: "https://dbmx.net/qdbm/qdbm-1.8.78.tar.gz" diff --git a/recipes/qdbm/all/conanfile.py b/recipes/qdbm/all/conanfile.py index 476d0ec62783b..7de5afa132670 100644 --- a/recipes/qdbm/all/conanfile.py +++ b/recipes/qdbm/all/conanfile.py @@ -1,17 +1,22 @@ -from conans import ConanFile, CMake, tools -import functools +import os -required_conan_version = ">=1.33.0" +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get + +required_conan_version = ">=1.53.0" class QDBMConan(ConanFile): name = "qdbm" description = "QDBM is a library of routines for managing a database." - url = "https://github.com/conan-io/conan-center-index" - homepage = "http://fallabs.com/qdbm/" - topics = ("qdbm", "database", "db") license = "LGPL-2.1-or-later" - settings = ("os", "arch", "compiler", "build_type") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://dbmx.net/qdbm/" + topics = ("database", "db") + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -27,52 +32,50 @@ class QDBMConan(ConanFile): "with_zlib": True, } - generators = "cmake", "cmake_find_package" - exports_sources = "CMakeLists.txt" - - @property - def _source_subfolder(self): - return "source_subfolder" + 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 - del self.options.with_pthread + self.options.rm_safe("with_pthread") 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.with_iconv: - self.requires("libiconv/1.16") + self.requires("libiconv/1.17") if self.options.with_zlib: - self.requires("zlib/1.2.12") + self.requires("zlib/[>=1.2.11 <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) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["CONAN_qdbm_VERSION"] = self.version - cmake.definitions["MYICONV"] = self.options.with_iconv - cmake.definitions["MYZLIB"] = self.options.with_zlib - cmake.definitions["MYPTHREAD"] = self.options\ - .get_safe("with_pthread", False) - cmake.configure() - return cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CONAN_qdbm_VERSION"] = self.version + tc.variables["MYICONV"] = self.options.with_iconv + tc.variables["MYZLIB"] = self.options.with_zlib + tc.variables["MYPTHREAD"] = self.options.get_safe("with_pthread", False) + tc.generate() + tc = CMakeDeps(self) + tc.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=self.export_sources_folder) 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() def package_info(self): diff --git a/recipes/qdbm/all/test_package/CMakeLists.txt b/recipes/qdbm/all/test_package/CMakeLists.txt index ea1c210104fb1..5c076c42369f7 100644 --- a/recipes/qdbm/all/test_package/CMakeLists.txt +++ b/recipes/qdbm/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 KEEP_RPATHS) - find_package(qdbm REQUIRED CONFIG) add_executable(test_package test_package.c) diff --git a/recipes/qdbm/all/test_package/conanfile.py b/recipes/qdbm/all/test_package/conanfile.py index ec80e0c5cc134..ef5d7042163ec 100644 --- a/recipes/qdbm/all/test_package/conanfile.py +++ b/recipes/qdbm/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 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/qdbm/all/test_package/test_package.c b/recipes/qdbm/all/test_package/test_package.c index 68bad9e85cf15..3d79beba62257 100644 --- a/recipes/qdbm/all/test_package/test_package.c +++ b/recipes/qdbm/all/test_package/test_package.c @@ -1,12 +1,8 @@ #include #include -int main(int argc, char const* argv[]) +int main() { - (void)argc; - (void)argv; - - cbfree(NULL); - - return 0; + cbfree(NULL); + return 0; } diff --git a/recipes/qdbm/all/test_v1_package/CMakeLists.txt b/recipes/qdbm/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/qdbm/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/qdbm/all/test_v1_package/conanfile.py b/recipes/qdbm/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..ec80e0c5cc134 --- /dev/null +++ b/recipes/qdbm/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +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/qhull/all/conanfile.py b/recipes/qhull/all/conanfile.py index a8c732da75f89..79132e14aac7c 100644 --- a/recipes/qhull/all/conanfile.py +++ b/recipes/qhull/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.microsoft import is_msvc import os -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.53.0" class QhullConan(ConanFile): @@ -14,10 +14,11 @@ class QhullConan(ConanFile): "furthest-site Delaunay triangulation, and furthest-site " \ "Voronoi diagram." license = "Qhull" - topics = ("qhull", "geometry", "convex", "triangulation", "intersection") + topics = ("geometry", "convex", "triangulation", "intersection") homepage = "http://www.qhull.org" 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 QhullConan(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,25 +40,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.reentrant + 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.reentrant + 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) @@ -92,10 +85,6 @@ def package_info(self): if is_msvc(self) and self.options.shared: self.cpp_info.components["libqhull"].defines.extend(["qh_dllimport"]) - 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["cmake_find_package"] = "Qhull" self.cpp_info.names["cmake_find_package_multi"] = "Qhull" @@ -105,6 +94,7 @@ def package_info(self): self.cpp_info.components["libqhull"].names["pkg_config"] = self._qhull_pkgconfig_name self.cpp_info.components["libqhull"].set_property("cmake_target_name", f"Qhull::{self._qhull_cmake_name}") self.cpp_info.components["libqhull"].set_property("pkg_config_name", self._qhull_pkgconfig_name) + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) @property def _qhull_cmake_name(self): diff --git a/recipes/qhull/all/test_package/conanfile.py b/recipes/qhull/all/test_package/conanfile.py index c3880701eccbb..66e70cb957d6a 100644 --- a/recipes/qhull/all/test_package/conanfile.py +++ b/recipes/qhull/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["QHULL_REENTRANT"] = self.dependencies["qhull"].options.reentrant @@ -25,6 +26,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/qhull/all/test_v1_package/CMakeLists.txt b/recipes/qhull/all/test_v1_package/CMakeLists.txt index c52c2903741af..0d20897301b68 100644 --- a/recipes/qhull/all/test_v1_package/CMakeLists.txt +++ b/recipes/qhull/all/test_v1_package/CMakeLists.txt @@ -1,23 +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(Qhull REQUIRED CONFIG) - -if(QHULL_REENTRANT) - add_executable(${PROJECT_NAME} ../test_package/test_package_r.c) - if(TARGET Qhull::qhull_r) - target_link_libraries(${PROJECT_NAME} PRIVATE Qhull::qhull_r) - else() - target_link_libraries(${PROJECT_NAME} PRIVATE Qhull::qhullstatic_r) - endif() -else() - add_executable(${PROJECT_NAME} ../test_package/test_package.c) - if(TARGET Qhull::libqhull) - target_link_libraries(${PROJECT_NAME} PRIVATE Qhull::libqhull) - else() - target_link_libraries(${PROJECT_NAME} PRIVATE Qhull::qhullstatic) - endif() -endif() +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/qoi/all/conandata.yml b/recipes/qoi/all/conandata.yml new file mode 100644 index 0000000000000..85f3317442208 --- /dev/null +++ b/recipes/qoi/all/conandata.yml @@ -0,0 +1,5 @@ +sources: + # Newer versions at the top + "0.0.0.cci.20240906": + url: "https://github.com/phoboslab/qoi/archive/019020993ce33bdf56c876004e8b27139a0d011f.zip" + sha256: "b4785ed15a5a9d1084cc1ad72829e7bb16b9a7b597ac8aa8160f2788748614f3" diff --git a/recipes/qoi/all/conanfile.py b/recipes/qoi/all/conanfile.py new file mode 100644 index 0000000000000..8eb9a1ee17305 --- /dev/null +++ b/recipes/qoi/all/conanfile.py @@ -0,0 +1,46 @@ +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 QoiConan(ConanFile): + name = "qoi" + description = "The “Quite OK Image Format†for fast, lossless image compression" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://qoiformat.org/" + topics = ("image", "compression", "header-only") + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + def layout(self): + basic_layout(self, src_folder="src") + + # same package ID for any package + def package_id(self): + self.info.clear() + + 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, + "*.h", + self.source_folder, + os.path.join(self.package_folder, "include"), + ) + + def package_info(self): + # Folders not used for header-only + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/qoi/all/test_package/CMakeLists.txt b/recipes/qoi/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..f16d6221266fc --- /dev/null +++ b/recipes/qoi/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) # if the project is pure C + +find_package(qoi REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +# don't link to ${CONAN_LIBS} or CONAN_PKG::package +target_link_libraries(${PROJECT_NAME} PRIVATE qoi::qoi) diff --git a/recipes/qoi/all/test_package/conanfile.py b/recipes/qoi/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0a808db45f245 --- /dev/null +++ b/recipes/qoi/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/qoi/all/test_package/test_package.c b/recipes/qoi/all/test_package/test_package.c new file mode 100644 index 0000000000000..aca3fa09d9bc1 --- /dev/null +++ b/recipes/qoi/all/test_package/test_package.c @@ -0,0 +1,10 @@ +#include + +#define QOI_IMPLEMENTATION +#include "qoi.h" + +int main(void) { + printf("qoi_desc size: %d\n", sizeof(qoi_desc)); + + return EXIT_SUCCESS; +} diff --git a/recipes/qoi/config.yml b/recipes/qoi/config.yml new file mode 100644 index 0000000000000..97d1baf6d5919 --- /dev/null +++ b/recipes/qoi/config.yml @@ -0,0 +1,4 @@ +versions: + # Newer versions at the top + "0.0.0.cci.20240906": + folder: all diff --git a/recipes/qoixx/all/conandata.yml b/recipes/qoixx/all/conandata.yml new file mode 100644 index 0000000000000..17e77ab24163d --- /dev/null +++ b/recipes/qoixx/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.1.7": + url: "https://github.com/wx257osn2/qoixx/archive/refs/tags/v0.1.7.tar.gz" + sha256: "9da53e0fc035f4b75f872a196a76cd870b63568612254035dadc84e46f47d779" diff --git a/recipes/qoixx/all/conanfile.py b/recipes/qoixx/all/conanfile.py new file mode 100644 index 0000000000000..b18ef696aab67 --- /dev/null +++ b/recipes/qoixx/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.files import copy, get +from conan.tools.layout import basic_layout +from conan.tools.scm import Version +import os + +required_conan_version = ">=1.52.0" + +class QoixxConan(ConanFile): + name = "qoixx" + description = "Single Header Quite Fast QOI(Quite OK Image Format) Implementation written in C++20" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/wx257osn2/qoixx" + topics = ("qoi", "simd", "image", "header-only") + package_type = "header-library" + 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": "14", + "Visual Studio": "16", + "msvc": "192", + } + + 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, "LICENSE", 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_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/qoixx/all/test_package/CMakeLists.txt b/recipes/qoixx/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..23c2933ab08bc --- /dev/null +++ b/recipes/qoixx/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(qoixx REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE qoixx::qoixx) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) diff --git a/recipes/qoixx/all/test_package/conanfile.py b/recipes/qoixx/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/qoixx/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/qoixx/all/test_package/test_package.cpp b/recipes/qoixx/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..7d626bc32b672 --- /dev/null +++ b/recipes/qoixx/all/test_package/test_package.cpp @@ -0,0 +1,25 @@ +#include +#include +#include "qoixx.hpp" + +int main(void) { + constexpr qoixx::qoi::desc desc{ + .width = 8, + .height = 4, + .channels = 3, + .colorspace = qoixx::qoi::colorspace::srgb, + }; + + const std::vector original = { + 130, 0, 212, 124, 204, 88, 79, 26, 210, 104, 117, 4, 137, 191, 80, 204, + 65, 175, 38, 160, 207, 182, 174, 59, 83, 18, 227, 4, 234, 150, 97, 131, + 62, 95, 167, 236, 132, 143, 78, 175, 86, 172, 237, 113, 195, 87, 227, 242, + 13, 189, 125, 33, 16, 79, 165, 247, 216, 193, 192, 113, 254, 176, 172, 227, + 94, 105, 146, 232, 150, 39, 148, 238, 105, 65, 23, 4, 33, 252, 243, 111, + 120, 32, 150, 144, 96, 66, 9, 102, 226, 245, 145, 153, 240, 183, 60, 132 + }; + + const auto encoded = qoixx::qoi::encode>(original, desc); + const auto [decoded, decoded_desc] = qoixx::qoi::decode>(encoded); + return 0; +} diff --git a/recipes/qoixx/config.yml b/recipes/qoixx/config.yml new file mode 100644 index 0000000000000..e6830418cc45c --- /dev/null +++ b/recipes/qoixx/config.yml @@ -0,0 +1,3 @@ +versions: + "0.1.7": + folder: all diff --git a/recipes/qpdf/all/conanfile.py b/recipes/qpdf/all/conanfile.py index 749ef210e85f2..e97cf90bc30a7 100644 --- a/recipes/qpdf/all/conanfile.py +++ b/recipes/qpdf/all/conanfile.py @@ -1,22 +1,23 @@ 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 is_msvc, check_min_vs 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.52.0" +required_conan_version = ">=1.54.0" + -class PackageConan(ConanFile): +class QpdfConan(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") + topics = ("pdf",) + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -32,8 +33,8 @@ class PackageConan(ConanFile): } @property - def _minimum_cpp_standard(self): - return 14 + def _min_cppstd(self): + return "14" @property def _compilers_minimum_version(self): @@ -41,6 +42,8 @@ def _compilers_minimum_version(self): "gcc": "5", "clang": "3.4", "apple-clang": "10", + "Visual Studio": "14", + "msvc": "190", } def export_sources(self): @@ -52,48 +55,47 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + 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") + self.requires("zlib/[>=1.2.11 <2]") if self.options.with_ssl == "openssl": - self.requires("openssl/1.1.1q") - elif self.options.with_ssl == "gnutls": - raise ConanInvalidConfiguration("GnuTLS is not available in Conan Center yet.") + self.requires("openssl/[>=1.1 <4]") if self.options.with_jpeg == "libjpeg": self.requires("libjpeg/9e") elif self.options.with_jpeg == "libjpeg-turbo": - self.requires("libjpeg-turbo/2.1.4") + self.requires("libjpeg-turbo/3.0.0") elif self.options.with_jpeg == "mozjpeg": - self.requires("mozjpeg/4.1.1") - + self.requires("mozjpeg/4.1.3") def validate(self): - if self.info.settings.compiler.cppstd: - check_min_cppstd(self, self._minimum_cpp_standard) - if is_msvc(self): - check_min_vs(self, "150") - else: - 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.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." + ) + + if self.options.with_ssl == "gnutls": + raise ConanInvalidConfiguration("GnuTLS is not available in Conan Center yet.") def build_requirements(self): - self.tool_requires("cmake/3.24.1") - self.tool_requires("pkgconf/1.9.3") + self.tool_requires("cmake/[>=3.16 <4]") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/2.0.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): + tc = VirtualBuildEnv(self) + tc.generate() tc = CMakeToolchain(self) tc.variables["BUILD_STATIC_LIBS"] = not self.options.shared # https://qpdf.readthedocs.io/en/latest/installation.html#build-time-crypto-selection @@ -118,8 +120,6 @@ def generate(self): # 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) @@ -159,13 +159,17 @@ def package(self): def package_info(self): self.cpp_info.set_property("cmake_file_name", "qpdf") - + self.cpp_info.set_property("cmake_target_name", "qpdf::libqpdf") + self.cpp_info.set_property("pkg_config_name", "libqpdf") + # TODO: back to global scope in conan v2 once cmake_find_package_* generators removed 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_jpeg == "libjpeg": + self.cpp_info.components["libqpdf"].requires.append("libjpeg::libjpeg") + elif self.options.with_jpeg == "libjpeg-turbo": + self.cpp_info.components["libqpdf"].requires.append("libjpeg-turbo::jpeg") + elif self.options.with_jpeg == "mozjpeg": + self.cpp_info.components["libqpdf"].requires.append("mozjpeg::libjpeg") if self.options.with_ssl == "openssl": self.cpp_info.components["libqpdf"].requires.append("openssl::openssl") @@ -173,9 +177,9 @@ def package_info(self): 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" + self.cpp_info.components["libqpdf"].set_property("pkg_config_name", "libqpdf") + self.cpp_info.components["libqpdf"].set_property("cmake_target_name", "qpdf::libqpdf") diff --git a/recipes/qpdf/all/test_v1_package/CMakeLists.txt b/recipes/qpdf/all/test_v1_package/CMakeLists.txt index ccb1cc676af03..0d20897301b68 100644 --- a/recipes/qpdf/all/test_v1_package/CMakeLists.txt +++ b/recipes/qpdf/all/test_v1_package/CMakeLists.txt @@ -1,15 +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(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) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/qpdf/all/test_v1_package/conanfile.py b/recipes/qpdf/all/test_v1_package/conanfile.py index c492184eec19c..0f735b51a2642 100644 --- a/recipes/qpdf/all/test_v1_package/conanfile.py +++ b/recipes/qpdf/all/test_v1_package/conanfile.py @@ -1,9 +1,7 @@ -from conans import ConanFile, CMake -from conan.tools.build import cross_building +from conans import ConanFile, CMake, tools import os -# legacy validation with Conan 1.x class TestPackageV1Conan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "cmake", "cmake_find_package_multi" @@ -14,6 +12,6 @@ def build(self): cmake.build() def test(self): - if not cross_building(self): + if 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 60ddaa9f6b380..7629857f9b79e 100644 --- a/recipes/qr-code-generator/all/CMakeLists.txt +++ b/recipes/qr-code-generator/all/CMakeLists.txt @@ -1,9 +1,16 @@ cmake_minimum_required(VERSION 3.15) project(QR-Code-Generator) -include(src/files.cmake) -add_library(${LIBRARY_NAME} ${SRC}) +set(SRC_C ${CMAKE_SOURCE_DIR}/src/c/qrcodegen.c) +set(LIBRARY_NAME_C qrcodegenc) +set(HEADERS_C ${CMAKE_SOURCE_DIR}/src/c/qrcodegen.h) + +add_library(${LIBRARY_NAME_C} ${SRC_C}) +set_target_properties(${LIBRARY_NAME_C} PROPERTIES PUBLIC_HEADER "${HEADERS_C}") +install(TARGETS ${LIBRARY_NAME_C} RUNTIME LIBRARY ARCHIVE PUBLIC_HEADER DESTINATION include/qrcodegenc) +include(src/files.cmake) +add_library(${LIBRARY_NAME} ${SRC}) 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/conanfile.py b/recipes/qr-code-generator/all/conanfile.py index 84430d69ae1d0..656603b7ba557 100644 --- a/recipes/qr-code-generator/all/conanfile.py +++ b/recipes/qr-code-generator/all/conanfile.py @@ -101,8 +101,9 @@ def package(self): cmake.install() def package_info(self): - self.cpp_info.libs = [ - "qrcodegen" if Version(self.version) < "1.7.0" else "qrcodegencpp" - ] + self.cpp_info.components["qrcodegencpp"].set_property("cmake_target_name", "qr-code-generator::qrcodegencpp") + self.cpp_info.components["qrcodegencpp"].libs = ["qrcodegen" if Version(self.version) < "1.7.0" else "qrcodegencpp"] + self.cpp_info.components["qrcodegenc"].set_property("cmake_target_name", "qr-code-generator::qrcodegenc") + self.cpp_info.components["qrcodegenc"].libs = ["qrcodegenc"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("m") diff --git a/recipes/qt/5.x.x/conandata.yml b/recipes/qt/5.x.x/conandata.yml index 1ffad75cd4fb3..16b0489abd752 100644 --- a/recipes/qt/5.x.x/conandata.yml +++ b/recipes/qt/5.x.x/conandata.yml @@ -1,92 +1,67 @@ sources: - "5.15.7": + "5.15.14": url: - - "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.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" - - "https://qt-mirror.dannhauer.de/archive/qt/5.15/5.15.5/single/qt-everywhere-opensource-src-5.15.5.tar.xz" - - "https://www.funet.fi/pub/mirrors/download.qt-project.org/archive/qt/5.15/5.15.5/single/qt-everywhere-opensource-src-5.15.5.tar.xz" - - "https://ftp.fau.de/qtproject/archive/qt/5.15/5.15.5/single/qt-everywhere-opensource-src-5.15.5.tar.xz" - sha256: "5a97827bdf9fd515f43bc7651defaf64fecb7a55e051c79b8f80510d0e990f06" + - "https://download.qt.io/official_releases/qt/5.15/5.15.14/single/qt-everywhere-opensource-src-5.15.14.tar.xz" + - "https://download.qt.io/archive/qt/5.15/5.15.14/single/qt-everywhere-opensource-src-5.15.14.tar.xz" + - "https://qt-mirror.dannhauer.de/archive/qt/5.15/5.15.14/single/qt-everywhere-opensource-src-5.15.14.tar.xz" + - "https://mirror.netcologne.de/qtproject/archive/qt/5.15/5.15.14/single/qt-everywhere-opensource-src-5.15.14.tar.xz" + - "https://ftp.fau.de/qtproject/archive/qt/5.15/5.15.14/single/qt-everywhere-opensource-src-5.15.14.tar.xz" + - "https://ftp.nluug.nl/languages/qt/archive/qt/5.15/5.15.14/single/qt-everywhere-opensource-src-5.15.14.tar.xz" + - "https://mirrors.dotsrc.org/qtproject/archive/qt/5.15/5.15.14/single/qt-everywhere-opensource-src-5.15.14.tar.xz" + - "https://mirrors.20i.com/pub/qt.io/archive/qt/5.15/5.15.14/single/qt-everywhere-opensource-src-5.15.14.tar.xz" + - "https://mirrors.ukfast.co.uk/sites/qt.io/archive/qt/5.15/5.15.14/single/qt-everywhere-opensource-src-5.15.14.tar.xz" + - "https://ftp.icm.edu.pl/packages/qt/archive/qt/5.15/5.15.14/single/qt-everywhere-opensource-src-5.15.14.tar.xz" + - "https://ftp.acc.umu.se/mirror/qt.io/qtproject/archive/qt/5.15/5.15.14/single/qt-everywhere-opensource-src-5.15.14.tar.xz" + - "https://www.nic.funet.fi/pub/mirrors/download.qt-project.org/archive/qt/5.15/5.15.14/single/qt-everywhere-opensource-src-5.15.14.tar.xz" + - "https://qt.mirror.constant.com/archive/qt/5.15/5.15.14/single/qt-everywhere-opensource-src-5.15.14.tar.xz" + - "https://mirrors.sau.edu.cn/qt/archive/qt/5.15/5.15.14/single/qt-everywhere-opensource-src-5.15.14.tar.xz" + - "https://mirrors.cloud.tencent.com/qt/archive/qt/5.15/5.15.14/single/qt-everywhere-opensource-src-5.15.14.tar.xz" + - "https://mirror.bjtu.edu.cn/qt/archive/qt/5.15/5.15.14/single/qt-everywhere-opensource-src-5.15.14.tar.xz" + - "https://mirrors.sjtug.sjtu.edu.cn/qt/archive/qt/5.15/5.15.14/single/qt-everywhere-opensource-src-5.15.14.tar.xz" + - "https://ftp.jaist.ac.jp/pub/qtproject/archive/qt/5.15/5.15.14/single/qt-everywhere-opensource-src-5.15.14.tar.xz" + - "https://ftp.yz.yamagata-u.ac.jp/pub/qtproject/archive/qt/5.15/5.15.14/single/qt-everywhere-opensource-src-5.15.14.tar.xz" + - "https://mirror.aarnet.edu.au/pub/qtproject/archive/qt/5.15/5.15.14/single/qt-everywhere-opensource-src-5.15.14.tar.xz" + sha256: "fdd3a4f197d2c800ee0085c721f4bef60951cbda9e9c46e525d1412f74264ed7" patches: - "5.15.7": - - 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/dece6f5.diff" - base_path: "qt5/qtbase" - - patch_file: "patches/QTBUG-98813.patch" - base_path: "qt5/qtwebengine/src/3rdparty" - - patch_file: "patches/d3396fb6fc.patch" - base_path: "qt5/qtwebengine/src/3rdparty" - - patch_file: "patches/107ed30ec5.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" - - patch_file: "patches/0001-Find-fontconfig-using-pkg-config.patch" - base_path: "qt5/qtwebengine/src/3rdparty" - "5.15.6": - - 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/dece6f5.diff" - base_path: "qt5/qtbase" - - patch_file: "patches/QTBUG-98813.patch" - base_path: "qt5/qtwebengine/src/3rdparty" - - patch_file: "patches/d3396fb6fc.patch" - base_path: "qt5/qtwebengine/src/3rdparty" - - patch_file: "patches/107ed30ec5.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" - - patch_file: "patches/0001-Find-fontconfig-using-pkg-config.patch" - base_path: "qt5/qtwebengine/src/3rdparty" - "5.15.5": - - 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/dece6f5.diff" - base_path: "qt5/qtbase" - - patch_file: "patches/QTBUG-98813.patch" - base_path: "qt5/qtwebengine/src/3rdparty" - - patch_file: "patches/d3396fb6fc.patch" - base_path: "qt5/qtwebengine/src/3rdparty" - - patch_file: "patches/107ed30ec5.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" - - patch_file: "patches/0001-Find-fontconfig-using-pkg-config.patch" - base_path: "qt5/qtwebengine/src/3rdparty" + "5.15.14": + - "base_path": "qt5/qtbase" + "patch_file": "patches/aa2a39dea5.diff" + - "base_path": "qt5/qtwebengine" + "patch_file": "patches/c72097e.diff" + - "base_path": "qt5/qttools" + "patch_file": "patches/fix-macdeployqt.diff" + - "base_path": "qt5/qtwebengine/src/3rdparty" + "patch_file": "patches/0001-Find-fontconfig-using-pkg-config.patch" + - "base_path": "qt5/qtwebengine/src/3rdparty" + "patch_file": "patches/Fix-errors-and-warnings-for-perfetto.patch" + "patch_description": "Fix qtwebengine build issues for vs 2022 (backport QTBUG-117073)" + - "base_path": "qt5/qtbase" + "patch_file": "patches/android-openssl.diff" + - "base_path": "qt5/qtbase" + "patch_description": "Fix qmake build with apple-clang>=15" + "patch_file": "patches/5.15.8-fix-qmake-default-libdirs-apple-clang-15.patch" + "patch_source": "https://codereview.qt-project.org/c/qt/qtbase/+/503916" + "patch_type": "portability" + - "base_path": "qt5/qtbase" + "patch_description": "Fix usage of memory_resource with apple-clang>=15 and deployment\ + \ target of macOS < 14" + "patch_file": "patches/5.15.12-fix-macos-cpp-lib-memory-resource.patch" + "patch_source": "https://codereview.qt-project.org/c/qt/qtbase/+/482392" + "patch_type": "portability" + - "base_path": "qt5/qtwebengine" + "patch_description": "qtwebengine don't use rpath-link on macOS" + "patch_file": "patches/5.15.14-macos-qtwebengine-rpath-link.patch" + - "base_path": "qt5/qtlocation" + "patch_description": "qtlocation missing utility header" + "patch_file": "patches/5.15.14-macos-qtlocation-utility-header.patch" + - "base_path": "qt5/qtwebengine/src/3rdparty" + "patch_description": "qtwebengine fix missing headers" + "patch_file": "patches/5.15.14-qtwebengine-missing-deps.patch" + - "base_path": "qt5/qtwebengine/src/3rdparty" + "patch_description": "macos fix chromium build in newer macos SDKs" + "patch_file": "patches/5.15.14-macos-chromium-newer-sdks.patch" + - "patch_file": "patches/ffmpeg-x86-optimization.patch" + "base_path": "qt5/qtwebengine" + "patch_description": "Fix build error with binutils >= 2.41" + "patch_type": "portability" + "patch_source": "https://packages.ubuntu.com/source/focal-updates/qtwebengine-opensource-src" diff --git a/recipes/qt/5.x.x/conanfile.py b/recipes/qt/5.x.x/conanfile.py index 92a9bdac4701a..0ad50b6ce723c 100644 --- a/recipes/qt/5.x.x/conanfile.py +++ b/recipes/qt/5.x.x/conanfile.py @@ -1,41 +1,22 @@ -from conan import ConanFile -from conan.errors import ConanInvalidConfiguration +from conan import ConanFile, conan_version +from conan.errors import ConanException, ConanInvalidConfiguration +from conan.tools.android import android_abi 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, 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.env import Environment, VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import chdir, copy, get, load, replace_in_file, rm, rmdir, save, export_conandata_patches, apply_conandata_patches +from conan.tools.gnu import PkgConfigDeps +from conan.tools.microsoft import is_msvc, msvc_runtime_flag, is_msvc_static_runtime, VCVars from conan.tools.scm import Version -from conans import tools, RunEnvironment -from conans.model import Generator import configparser import glob +from io import StringIO import itertools import os import textwrap +import shutil -required_conan_version = ">=1.52.0" - - -class qt(Generator): - @property - def filename(self): - return "qt.conf" - - @property - def content(self): - return """[Paths] -Prefix = %s -ArchData = bin/archdatadir -HostData = bin/archdatadir -Data = bin/datadir -Sysconf = bin/sysconfdir -LibraryExecutables = bin/archdatadir/bin -Plugins = bin/archdatadir/plugins -Imports = bin/archdatadir/imports -Qml2Imports = bin/archdatadir/qml -Translations = bin/datadir/translations -Documentation = bin/datadir/doc -Examples = bin/datadir/examples""" % self.conanfile.deps_cpp_info["qt"].rootpath.replace("\\", "/") +required_conan_version = ">=1.60.0 <2 || >=2.0.5" class QtConan(ConanFile): @@ -47,13 +28,15 @@ class QtConan(ConanFile): "qtspeech", "qtnetworkauth", "qtremoteobjects", "qtwebglplugin", "qtlottie", "qtquicktimeline", "qtquick3d", "qtknx", "qtmqtt", "qtcoap", "qtopcua"] + _module_statuses = ["essential", "addon", "deprecated", "preview"] + name = "qt" description = "Qt is a cross-platform framework for graphical user interfaces." 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" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -85,17 +68,20 @@ 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], - "device": "ANY", - "cross_compile": "ANY", - "sysroot": "ANY", - "config": "ANY", + "android_sdk": [None, "ANY"], + "device": [None, "ANY"], + "cross_compile": [None, "ANY"], + "sysroot": [None, "ANY"], + "config": [None, "ANY"], "multiconfiguration": [True, False] } options.update({module: [True, False] for module in _submodules}) + options.update({f"{status}_modules": [True, False] for status in _module_statuses}) default_options = { "shared": False, @@ -126,52 +112,43 @@ class QtConan(ConanFile): "with_gssapi": False, "with_atspi": False, "with_md4c": True, + "with_x11": True, "gui": True, "widgets": True, + "android_sdk": None, "device": None, "cross_compile": None, "sysroot": None, "config": None, - "multiconfiguration": False + "multiconfiguration": False, } - default_options.update({module: (module in ["qttools", "qttranslations"]) for module in _submodules}) + # essential_modules, addon_modules, deprecated_modules, preview_modules: + # these are only provided for convenience, set to False by default + default_options.update({f"{status}_modules": False for status in _module_statuses}) no_copy_source = True short_paths = True - generators = "pkg_config" @property def _settings_build(self): return getattr(self, "settings_build", self.settings) def export(self): - self.copy(f"qtmodules{self.version}.conf") + copy(self, f"qtmodules{self.version}.conf", self.recipe_folder, self.export_folder) def export_sources(self): export_conandata_patches(self) - def build_requirements(self): - if self._settings_build.os == "Windows" and is_msvc(self): - self.build_requires("jom/1.1.3") + def validate_build(self): if self.options.qtwebengine: - self.build_requires("ninja/1.11.1") - self.build_requires("nodejs/16.3.0") - self.build_requires("gperf/3.1") - # gperf, bison, flex, python >= 2.7.5 & < 3 - if self.settings.os != "Windows": - self.build_requires("bison/3.8.2") - self.build_requires("flex/2.6.4") - else: - self.build_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 - python_exe = tools.which("python2") + python_exe = shutil.which("python2") if not python_exe: # Fall back on regular python - python_exe = tools.which("python") + python_exe = shutil.which("python") if not python_exe: msg = ("Python2 must be available in PATH " @@ -179,20 +156,17 @@ def build_requirements(self): raise ConanInvalidConfiguration(msg) # In any case, check its actual version for compatibility - from six import StringIO # Python 2 and 3 compatible - mybuf = StringIO() - cmd_v = f"\"{python_exe}\" --version" - self.run(cmd_v, output=mybuf) - verstr = mybuf.getvalue().strip().split("Python ")[1] - if verstr.endswith("+"): - verstr = verstr[:-1] + command_output = StringIO() + cmd_v = f"\"{python_exe}\" -c \"import platform;print(platform.python_version())\"" + self.run(cmd_v, command_output) + verstr = command_output.getvalue().strip() version = Version(verstr) # >= 2.7.5 & < 3 v_min = "2.7.5" v_max = "3.0.0" if (version >= v_min) and (version < v_max): msg = ("Found valid Python 2 required for QtWebengine:" - f" version={mybuf.getvalue()}, path={python_exe}") + f" version={verstr}, path={python_exe}") self.output.success(msg) else: msg = (f"Found Python 2 in path, but with invalid version {verstr}" @@ -201,14 +175,12 @@ def build_requirements(self): "python2(.exe)") raise ConanInvalidConfiguration(msg) - if self.options.qtwayland: - self.build_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": @@ -233,32 +205,30 @@ def config_options(self): if self.settings.os != "Macos": del self.options.qtmacextras + if self.settings.os != "Android": + del self.options.android_sdk + + def _debug_output(self, message): + if Version(conan_version) >= "2": + self.output.debug(message) + def configure(self): # if self.settings.os != "Linux": # self.options.with_libiconv = False # QTBUG-84708 if not self.options.gui: - del self.options.opengl - del self.options.with_vulkan - del self.options.with_freetype - del self.options.with_fontconfig - del self.options.with_harfbuzz - del self.options.with_libjpeg - del self.options.with_libpng - del self.options.with_md4c + self.options.rm_safe("opengl") + self.options.rm_safe("with_vulkan") + self.options.rm_safe("with_freetype") + self.options.rm_safe("with_fontconfig") + self.options.rm_safe("with_harfbuzz") + self.options.rm_safe("with_libjpeg") + self.options.rm_safe("with_libpng") + self.options.rm_safe("with_md4c") + self.options.rm_safe("with_x11") if not self.options.with_dbus: - del self.options.with_atspi - - if not self.options.qtmultimedia: - del self.options.with_libalsa - del self.options.with_openal - del self.options.with_gstreamer - del self.options.with_pulseaudio - - if self.settings.os in ("FreeBSD", "Linux"): - if self.options.qtwebengine: - self.options.with_fontconfig = True + self.options.rm_safe("with_atspi") if self.options.multiconfiguration: del self.settings.build_type @@ -274,6 +244,8 @@ def configure(self): modulename = section[section.find('"') + 1: section.rfind('"')] status = str(config.get(section, "status")) if status not in ("obsolete", "ignore"): + if status not in self._module_statuses: + raise ConanException(f"module {modulename} has status {status} which is not in self._module_statuses {self._module_statuses}") submodules_tree[modulename] = {"status": status, "path": str(config.get(section, "path")), "depends": []} if config.has_option(section, "depends"): @@ -282,19 +254,74 @@ def configure(self): for m in submodules_tree: assert m in ["qtbase", "qtqa", "qtrepotools"] or m in self._submodules, "module %s is not present in recipe options : (%s)" % (m, ",".join(self._submodules)) - for m in self._submodules: - if m not in submodules_tree: - delattr(self.options, m) + for module in self._submodules: + if module not in submodules_tree: + self._debug_output(f"qt5: removing {module} from options as it is not an option for this version, or it is ignored or obsolete") + self.options.rm_safe(module) + + # Requested modules: + # - any module for non-removed options that have 'True' value + # - any enabled via `xxx_modules` that does not have a 'False' value + # Note that at this point, the submodule options dont have a value unless one is given externally + # to the recipe (e.g. via the command line, a profile, or a consumer) + requested_modules = set([module for module in self._submodules if self.options.get_safe(module)]) + for module in [m for m in self._submodules if m in submodules_tree]: + status = submodules_tree[module]['status'] + is_disabled = self.options.get_safe(module) == False + if self.options.get_safe(f"{status}_modules"): + if not is_disabled: + requested_modules.add(module) + else: + self.output.warning(f"qt5: {module} requested because {status}_modules=True" + f" but it has been explicitly disabled with {module}=False") + + self.output.info(f"qt5: requested modules {list(requested_modules)}") + + required_modules = {} + for module in requested_modules: + deps = submodules_tree[module]["depends"] + for dep in deps: + required_modules.setdefault(dep,[]).append(module) + + required_but_disabled = [m for m in required_modules.keys() if self.options.get_safe(m) == False] + if required_modules: + self._debug_output(f"qt5: required_modules modules {list(required_modules.keys())}") + if required_but_disabled: + required_by = set() + for m in required_but_disabled: + required_by.update(required_modules[m]) + raise ConanInvalidConfiguration(f"Modules {required_but_disabled} are explicitly disabled, " + f"but are required by {list(required_by)}, enabled by other options") - def _enablemodule(mod): - if mod != "qtbase": - setattr(self.options, mod, True) - for req in submodules_tree[mod]["depends"]: - _enablemodule(req) + enabled_modules = requested_modules.union(set(required_modules.keys())) + enabled_modules.discard("qtbase") + + for module in list(enabled_modules): + setattr(self.options, module, True) for module in self._submodules: - if self.options.get_safe(module): - _enablemodule(module) + if module in self.options and not self.options.get_safe(module): + setattr(self.options, module, False) + + if not self.options.qtmultimedia: + self.options.rm_safe("with_libalsa") + del self.options.with_openal + del self.options.with_gstreamer + del self.options.with_pulseaudio + + if self.settings.os in ("FreeBSD", "Linux"): + if self.options.qtwebengine: + self.options.with_fontconfig = True + + for status in self._module_statuses: + # These are convenience only, should not affect package_id + option_name = f"{status}_modules" + self._debug_output(f"qt5 removing convenience option: {option_name}," + f" see individual module options") + self.options.rm_safe(option_name) + + for option in self.options.items(): + self._debug_output(f"qt5 option {option[0]}={option[1]}") def validate(self): if self.settings.compiler.get_safe("cppstd"): @@ -316,8 +343,11 @@ def validate(self): if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "5": raise ConanInvalidConfiguration("Compiling Qt WebEngine with gcc < 5 is not supported") - if self.settings.os == "Android" and self.options.get_safe("opengl", "no") == "desktop": - raise ConanInvalidConfiguration("OpenGL desktop is not supported on Android. Consider using OpenGL es2") + if self.settings.os == "Android": + if self.options.get_safe("opengl", "no") == "desktop": + raise ConanInvalidConfiguration("OpenGL desktop is not supported on Android. Consider using OpenGL es2") + if not self.options.get_safe("android_sdk", ""): + raise ConanInvalidConfiguration("Path to Android SDK is required to build Qt") if self.settings.os != "Windows" and self.options.get_safe("opengl", "no") == "dynamic": raise ConanInvalidConfiguration("Dynamic OpenGL is supported only on Windows.") @@ -329,7 +359,7 @@ def validate(self): raise ConanInvalidConfiguration("Qt without libc++ needs qt:with_doubleconversion. " "Either enable qt:with_doubleconversion or switch to libc++") - if "MT" in self.settings.get_safe("compiler.runtime", default="") and self.options.shared: + if is_msvc_static_runtime(self) and self.options.shared: raise ConanInvalidConfiguration("Qt cannot be built as shared library with static runtime") if self.settings.compiler == "apple-clang": @@ -339,93 +369,136 @@ def validate(self): if Version(self.settings.compiler.version) < "5.0": raise ConanInvalidConfiguration("qt 5.15.X does not support GCC or clang before 5.0") - if self.options.get_safe("with_pulseaudio", default=False) and not self.options["pulseaudio"].with_glib: + if self.options.get_safe("with_pulseaudio", default=False) and not self.dependencies["pulseaudio"].options.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 cross_building(self) and self.options.cross_compile == "None": + 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) and self.settings.os != "Android": raise ConanInvalidConfiguration("option cross_compile must be set for cross compilation " "cf https://doc.qt.io/qt-5/configure-options.html#cross-compilation-options") + if self.options.with_sqlite3 and not self.dependencies["sqlite3"].options.enable_column_metadata: + raise ConanInvalidConfiguration("sqlite3 option enable_column_metadata must be enabled for qt") + def requirements(self): - self.requires("zlib/1.2.13") + self.requires("zlib/[>=1.2.11 <2]") if self.options.openssl: - self.requires("openssl/1.1.1s") + self.requires("openssl/[>=1.1 <4]") if self.options.with_pcre2: - self.requires("pcre2/10.40") + self.requires("pcre2/10.42") if self.options.get_safe("with_vulkan"): - self.requires("vulkan-loader/1.3.224.0") + self.requires("vulkan-loader/1.3.268.0") if is_apple_os(self): - self.requires("moltenvk/1.1.10") + self.requires("moltenvk/1.2.2") if self.options.with_glib: - self.requires("glib/2.74.0") + self.requires("glib/2.78.3") # if self.options.with_libiconv: # QTBUG-84708 # self.requires("libiconv/1.16")# QTBUG-84708 if self.options.with_doubleconversion and not self.options.multiconfiguration: - self.requires("double-conversion/3.2.1") + self.requires("double-conversion/3.3.0") if self.options.get_safe("with_freetype", False) and not self.options.multiconfiguration: - self.requires("freetype/2.12.1") + self.requires("freetype/2.13.2") if self.options.get_safe("with_fontconfig", False): - self.requires("fontconfig/2.13.93") + self.requires("fontconfig/2.15.0") if self.options.get_safe("with_icu", False): - self.requires("icu/71.1") + self.requires("icu/74.2") if self.options.get_safe("with_harfbuzz", False) and not self.options.multiconfiguration: - self.requires("harfbuzz/5.3.1") + self.requires("harfbuzz/8.3.0") 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.4") + self.requires("libjpeg-turbo/[>=3.0 <3.1]") else: self.requires("libjpeg/9e") if self.options.get_safe("with_libpng", False) and not self.options.multiconfiguration: - self.requires("libpng/1.6.38") + self.requires("libpng/[>=1.6 <2]") if self.options.with_sqlite3 and not self.options.multiconfiguration: - self.requires("sqlite3/3.39.4") - self.options["sqlite3"].enable_column_metadata = True + self.requires("sqlite3/[>=3.45.0 <4]") if self.options.get_safe("with_mysql", False): - self.requires("libmysqlclient/8.0.30") + self.requires("libmysqlclient/8.1.0") if self.options.with_pq: - self.requires("libpq/14.5") + self.requires("libpq/15.4") if self.options.with_odbc: if self.settings.os != "Windows": self.requires("odbc/2.3.11") if self.options.get_safe("with_openal", False): - self.requires("openal/1.22.2") + self.requires("openal-soft/1.22.2") if self.options.get_safe("with_libalsa", False): - self.requires("libalsa/1.2.7.2") - if self.options.gui and not self.options.qtwayland and self.settings.os in ["Linux", "FreeBSD"]: + self.requires("libalsa/1.2.10") + if self.options.get_safe("with_x11"): self.requires("xorg/system") - self.requires("xkbcommon/1.4.1") + if self.options.get_safe("with_x11") or self.options.qtwayland: + self.requires("xkbcommon/1.5.0") if self.options.get_safe("opengl", "no") != "no": self.requires("opengl/system") if self.options.with_zstd: - self.requires("zstd/1.5.2") + self.requires("zstd/1.5.5") if self.options.qtwebengine and self.settings.os in ["Linux", "FreeBSD"]: - self.requires("expat/2.4.9") - self.requires("opus/1.3.1") + self.requires("expat/[>=2.6.2 <3]") + self.requires("opus/1.4") if not self.options.qtwayland: self.requires("xorg-proto/2022.2") self.requires("libxshmfence/1.3") - self.requires("nss/3.84") - self.requires("libdrm/2.4.109") + self.requires("nss/3.93") + self.requires("libdrm/2.4.119") 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.15.2") + self.requires("dbus/1.15.8") if self.options.qtwayland: - self.requires("wayland/1.21.0") + self.requires("wayland/1.22.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.46.0") + self.requires("at-spi2-core/2.51.0") if self.options.get_safe("with_md4c", False): self.requires("md4c/0.4.8") + def package_id(self): + del self.info.options.cross_compile + del self.info.options.sysroot + if self.info.options.multiconfiguration: + if self.info.settings.compiler == "Visual Studio": + if "MD" in self.info.settings.compiler.runtime: + self.info.settings.compiler.runtime = "MD/MDd" + else: + self.info.settings.compiler.runtime = "MT/MTd" + elif self.info.settings.compiler == "msvc": + self.info.settings.compiler.runtime_type = "Release/Debug" + if self.info.settings.os == "Android": + del self.info.options.android_sdk + + def build_requirements(self): + if self._settings_build.os == "Windows" and is_msvc(self): + self.tool_requires("jom/[>=1.1 <2]") + if self.options.qtwebengine: + self.tool_requires("ninja/[>=1.12 <2]") + self.tool_requires("nodejs/18.15.0") + self.tool_requires("gperf/3.1") + # gperf, bison, flex, python >= 2.7.5 & < 3 + if self._settings_build.os == "Windows": + self.tool_requires("winflexbison/2.5.25") + else: + self.tool_requires("bison/3.8.2") + self.tool_requires("flex/2.6.4") + if self.options.qtwayland: + self.tool_requires("wayland/") + + @property + def angle_path(self): + return os.path.join(self.source_folder, "angle") + def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True, destination="qt5") @@ -440,7 +513,29 @@ def source(self): "-ldbus-1d", "-ldbus-1" ) - open(os.path.join(self.source_folder, "qt5", "qtbase", "mkspecs", "features", "uikit", "bitcode.prf"), "w").close() + save(self, os.path.join(self.source_folder, "qt5", "qtbase", "mkspecs", "features", "uikit", "bitcode.prf"), "") + + # shorten the path to ANGLE to avoid the following error: + # C:\J2\w\prod-v2\bsr@4\104220\ebfcf\p\qtde01f793a6074\s\qt5\qtbase\src\3rdparty\angle\src\libANGLE\renderer\d3d\d3d11\texture_format_table_autogen.cpp : fatal error C1083: Cannot open compiler generated file: '': Invalid argument + copy(self, "*", os.path.join(self.source_folder, "qt5", "qtbase", "src", "3rdparty", "angle"), self.angle_path) + + def generate(self): + pc = PkgConfigDeps(self) + pc.generate() + ms = VCVars(self) + ms.generate() + vbe = VirtualBuildEnv(self) + vbe.generate() + if not cross_building(self): + vre = VirtualRunEnv(self) + vre.generate(scope="build") + env = Environment() + env.define("MAKEFLAGS", f"j{build_jobs(self)}") + env.define("ANGLE_DIR", self.angle_path) + env.prepend_path("PKG_CONFIG_PATH", self.generators_folder) + if self.settings.os == "Windows": + env.prepend_path("PATH", os.path.join(self.source_folder, "qt5", "gnuwin32", "bin")) + env.vars(self).save_script("conan_qt_env_file") def _make_program(self): if is_msvc(self): @@ -495,7 +590,7 @@ def _xplatform(self): elif self.settings.os == "WindowsStore": if is_msvc(self): - if self.settings.compiler == "Visual Studio": + if str(self.settings.compiler) == "Visual Studio": msvc_version = str(self.settings.compiler.version) else: msvc_version = { @@ -551,10 +646,9 @@ def _xplatform(self): def build(self): args = ["-confirm-license", "-silent", "-nomake examples", "-nomake tests", 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")) - args.append("-sysconfdir %s" % os.path.join(self.package_folder, "bin", "sysconfdir")) if self.options.commercial: args.append("-commercial") else: @@ -608,7 +702,7 @@ def build(self): if not self.options.openssl: args += ["-no-openssl"] else: - if self.options["openssl"].shared: + if self.dependencies["openssl"].options.shared: args += ["-openssl-runtime"] else: args += ["-openssl-linked"] @@ -670,45 +764,46 @@ def build(self): ("libpq", "PSQL"), ("odbc", "ODBC"), ("sdl2", "SDL2"), - ("openal", "OPENAL"), + ("openal-soft", "OPENAL"), ("zstd", "ZSTD"), ("libalsa", "ALSA"), ("xkbcommon", "XKBCOMMON"), ("md4c", "LIBMD4C")] for package, var in libmap: - if package in self.deps_cpp_info.deps: + if package in [d.ref.name for d in self.dependencies.direct_host.values()]: + p = self.dependencies[package] if package == "freetype": - args.append("\"%s_INCDIR=%s\"" % (var, self.deps_cpp_info[package].include_paths[-1])) + args.append("\"%s_INCDIR=%s\"" % (var, p.cpp_info.aggregated_components().includedirs[-1])) + args.append("\"%s_LIBS=%s\"" % (var, " ".join(self._gather_libs(p)))) - args.append("\"%s_LIBS=%s\"" % (var, " ".join(self._gather_libs(package)))) + for dependency in self.dependencies.direct_host.values(): + args += [f"-I \"{s}\"" for s in dependency.cpp_info.aggregated_components().includedirs] + args += [f"-D {s}" for s in dependency.cpp_info.aggregated_components().defines] - for package in self.deps_cpp_info.deps: - 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)) + libdirs = [l for dependency in self.dependencies.host.values() for l in dependency.cpp_info.aggregated_components().libdirs] + args.append("QMAKE_LIBDIR+=\"%s\"" % " ".join(libdirs)) 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)) + args.append("QMAKE_RPATHLINKDIR+=\"%s\"" % ":".join(libdirs)) - 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")) - if "libpq" in self.deps_cpp_info.deps: - args.append("-psql_config \"%s\"" % os.path.join(self.deps_cpp_info["libpq"].rootpath, "bin", "pg_config")) + if "libmysqlclient" in [d.ref.name for d in self.dependencies.direct_host.values()]: + args.append("-mysql_config \"%s\"" % os.path.join(self.dependencies["libmysqlclient"].package_folder, "bin", "mysql_config")) + if "libpq" in [d.ref.name for d in self.dependencies.direct_host.values()]: + args.append("-psql_config \"%s\"" % os.path.join(self.dependencies["libpq"].package_folder, "bin", "pg_config")) if self.settings.os == "Macos": args += ["-no-framework"] if self.settings.arch == "armv8": args.append('QMAKE_APPLE_DEVICE_ARCHS="arm64"') elif self.settings.os == "Android": args += [f"-android-ndk-platform android-{self.settings.os.api_level}"] - args += ["-android-abis %s" % {"armv7": "armeabi-v7a", - "armv8": "arm64-v8a", - "x86": "x86", - "x86_64": "x86_64"}.get(str(self.settings.arch))] + args += [f"-android-abis {android_abi(self)}"] if self.settings.get_safe("compiler.libcxx") == "libstdc++": args += ["-D_GLIBCXX_USE_CXX11_ABI=0"] elif self.settings.get_safe("compiler.libcxx") == "libstdc++11": args += ["-D_GLIBCXX_USE_CXX11_ABI=1"] + if self.options.get_safe("android_sdk", ""): + args += [f"-android-sdk {self.options.android_sdk}"] if self.options.sysroot: args += [f"-sysroot {self.options.sysroot}"] @@ -751,6 +846,26 @@ def _getenvpath(var): if self._settings_build.os == "Linux" and self.settings.compiler == "clang": args += ['QMAKE_CXXFLAGS+="-ftemplate-depth=1024"'] + if self._settings_build.os == "Macos": + # On macOS, SIP resets DYLD_LIBRARY_PATH injected by VirtualBuildEnv & VirtualRunEnv. + # Qt builds several executables (moc etc) which are called later on during build of + # libraries, and these executables link to several external dependencies in requirements(). + # If these external libs are shared, moc calls fail because its dylib dependencies + # are not found (unless they can be accidentally found in system paths). + # So the workaround is to add libdirs of these external dependencies to LC_RPATH + # of runtime artifacts. + if not cross_building(self): + for libpath in VirtualRunEnv(self).vars().get("DYLD_LIBRARY_PATH", "").split(":"): + # see https://doc.qt.io/qt-5/qmake-variable-reference.html#qmake-rpathdir + args += [f"QMAKE_RPATHDIR+=\"{libpath}\""] + + if self.settings.compiler == "apple-clang" and self.options.qtmultimedia: + # XCode 14.3 finally removes std::unary_function, so compilation fails + # when using newer SDKs when using C++17 or higher. + # This macro re-enables them. Should be safe to pass this macro even + # in earlier versions, as it would have no effect. + args += ['QMAKE_CXXFLAGS+="-D_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION=1"'] + if self.options.qtwebengine and self.settings.os in ["Linux", "FreeBSD"]: args += ["-qt-webengine-ffmpeg", "-system-webengine-opus", @@ -761,24 +876,12 @@ def _getenvpath(var): os.mkdir("build_folder") with chdir(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 self._settings_build.os == "Macos": - save(self, ".qmake.stash" , "") - save(self, ".qmake.super" , "") + if self._settings_build.os == "Macos": + save(self, ".qmake.stash" , "") + save(self, ".qmake.super" , "") - 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 self._settings_build.os == "Macos" else tools.no_op(): - self.run(self._make_program(), run_environment=True) + self.run("%s %s" % (os.path.join(self.source_folder, "qt5", "configure"), " ".join(args))) + self.run(self._make_program()) @property def _cmake_core_extras_file(self): @@ -791,19 +894,9 @@ def package(self): with chdir(self, "build_folder"): self.run(f"{self._make_program()} install") save(self, os.path.join(self.package_folder, "bin", "qt.conf"), """[Paths] -Prefix = .. -ArchData = bin/archdatadir -HostData = bin/archdatadir -Data = bin/datadir -Sysconf = bin/sysconfdir -LibraryExecutables = bin/archdatadir/bin -Plugins = bin/archdatadir/plugins -Imports = bin/archdatadir/imports -Qml2Imports = bin/archdatadir/qml -Translations = bin/datadir/translations -Documentation = bin/datadir/doc -Examples = bin/datadir/examples""") - self.copy("*LICENSE*", src="qt5/", dst="licenses") +Prefix = ..""") + copy(self, "*LICENSE*", os.path.join(self.source_folder, "qt5/"), os.path.join(self.package_folder, "licenses"), + excludes="qtbase/examples/*") for module in self._submodules: if not self.options.get_safe(module): rmdir(self, os.path.join(self.package_folder, "licenses", module)) @@ -813,6 +906,7 @@ def package(self): rm(self, "*.la*", os.path.join(self.package_folder, "lib"), recursive=True) rm(self, "*.pdb*", os.path.join(self.package_folder, "lib"), recursive=True) rm(self, "*.pdb", os.path.join(self.package_folder, "bin"), recursive=True) + rm(self, "*.pdb", os.path.join(self.package_folder, "plugins"), recursive=True) # "Qt5Bootstrap" is internal Qt library - removing it to avoid linking error, since it contains # symbols that are also in "Qt5Core.lib". It looks like there is no "Qt5Bootstrap.dll". for fl in glob.glob(os.path.join(self.package_folder, "lib", "*Qt5Bootstrap*")): @@ -913,21 +1007,12 @@ def _create_private_module(module, dependencies=[]): if self.options.qtdeclarative: _create_private_module("Qml", ["CorePrivate", "Qml"]) - - def package_id(self): - del self.info.options.cross_compile - del self.info.options.sysroot - 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" - else: - self.info.settings.compiler.runtime = "MT/MTd" - else: - self.info.settings.compiler.runtime_type = "Release/Debug" + if self.options.gui: + _create_private_module("Quick", ["CorePrivate", "GuiPrivate", "QmlPrivate", "Quick"]) def package_info(self): self.cpp_info.set_property("cmake_file_name", "Qt5") + self.cpp_info.set_property("pkg_config_name", "qt5") self.cpp_info.names["cmake_find_package"] = "Qt5" self.cpp_info.names["cmake_find_package_multi"] = "Qt5" @@ -942,6 +1027,8 @@ def _add_build_module(component, module): self.cpp_info.components[component].build_modules["cmake_find_package_multi"].append(module) libsuffix = "" + if self.settings.os == "Android": + libsuffix = f"_{android_abi(self)}" if not self.options.multiconfiguration: if self.settings.build_type == "Debug": if self.settings.os == "Windows" and is_msvc(self): @@ -952,13 +1039,19 @@ def _add_build_module(component, module): def _get_corrected_reqs(requires): reqs = [] for r in requires: - reqs.append(r if "::" in r else f"qt{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 = 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].set_property("pkg_config_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"): @@ -968,7 +1061,14 @@ def _create_module(module, requires=[], has_include_dir=True): 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", f"Qt{module}")] - self.cpp_info.components[componentname].defines = [f"QT_{module.upper()}_LIB"] + define = module.upper() + if define == "TEST": + define = "TESTLIB" + elif define == "XCBQPA": + define = "XCB_QPA_LIB" + elif define.endswith("SUPPORT"): + define = define.replace("SUPPORT", "_SUPPORT") + self.cpp_info.components[componentname].defines = [f"QT_{define}_LIB"] if module != "Core" and "Core" not in requires: requires.append("Core") self.cpp_info.components[componentname].requires = _get_corrected_reqs(requires) @@ -981,7 +1081,7 @@ def _create_plugin(pluginname, libname, plugintype, requires): self.cpp_info.components[componentname].names["cmake_find_package_multi"] = pluginname if not self.options.shared: self.cpp_info.components[componentname].libs = [libname + libsuffix] - self.cpp_info.components[componentname].libdirs = [os.path.join("bin", "archdatadir", "plugins", plugintype)] + self.cpp_info.components[componentname].libdirs = [os.path.join("plugins", plugintype)] self.cpp_info.components[componentname].includedirs = [] if "Core" not in requires: requires.append("Core") @@ -1000,6 +1100,12 @@ def _create_plugin(pluginname, libname, plugintype, requires): core_reqs.append("glib::glib-2.0") _create_module("Core", core_reqs) + pkg_config_vars = [ + "host_bins=${prefix}/bin", + "exec_prefix=${prefix}", + ] + self.cpp_info.components["qtCore"].set_property("pkg_config_custom_content", "\n".join(pkg_config_vars)) + if self.settings.os == "Windows": module = "WinMain" componentname = f"qt{module}" @@ -1010,6 +1116,8 @@ def _create_plugin(pluginname, libname, plugintype, requires): self.cpp_info.components[componentname].includedirs = [] self.cpp_info.components[componentname].defines = [] + if self.options.with_dbus: + _create_module("DBus", ["dbus::dbus"]) if self.options.gui: gui_reqs = [] if self.options.with_dbus: @@ -1020,8 +1128,11 @@ def _create_plugin(pluginname, libname, plugintype, requires): gui_reqs.append("libpng::libpng") if self.options.get_safe("with_fontconfig", False): gui_reqs.append("fontconfig::fontconfig") - if not self.options.qtwayland and self.settings.os in ["Linux", "FreeBSD"]: - gui_reqs.extend(["xorg::xorg", "xkbcommon::xkbcommon"]) + if self.settings.os in ["Linux", "FreeBSD"]: + 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): @@ -1060,6 +1171,14 @@ def _create_plugin(pluginname, libname, plugintype, requires): 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"] @@ -1111,15 +1230,17 @@ def _create_plugin(pluginname, libname, plugintype, requires): service_support_reqs.append("DBus") _create_module("ServiceSupport", service_support_reqs) _create_module("EdidSupport") - if not self.options.qtwayland: + 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") - if not self.options.qtwayland: + 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"]) @@ -1140,19 +1261,10 @@ 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"]) - _add_build_module("qtWidgets", self._cmake_qt5_private_file("Widgets")) - if self.options.gui and self.options.widgets and 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["PrintSupport"].system_libs.append("cups") 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("OpenGLExtensions", ["Gui"]) - if self.options.with_dbus: - _create_module("DBus", ["dbus::dbus"]) _create_module("Concurrent") _create_module("Xml") @@ -1166,6 +1278,7 @@ def _create_plugin(pluginname, libname, plugintype, requires): self.cpp_info.components["qtQmlImportScanner"].requires = _get_corrected_reqs(["Qml"]) if self.options.gui: _create_module("Quick", ["Gui", "Qml", "QmlModels"]) + _add_build_module("qtQuick", self._cmake_qt5_private_file("Quick")) if self.options.widgets: _create_module("QuickWidgets", ["Gui", "Qml", "Quick", "Widgets"]) _create_module("QuickShapes", ["Gui", "Qml", "Quick"]) @@ -1186,8 +1299,8 @@ def _create_plugin(pluginname, libname, plugintype, requires): if self.options.qtquick3d and self.options.gui: _create_module("Quick3DUtils", ["Gui"]) - _create_module("Quick3DAssetImport", ["Gui", "Qml", "Quick3DRender", "Quick3DUtils"]) _create_module("Quick3DRender", ["Quick3DUtils", "Quick"]) + _create_module("Quick3DAssetImport", ["Gui", "Qml", "Quick3DRender", "Quick3DUtils"]) _create_module("Quick3DRuntimeRender", ["Quick3DRender", "Quick3DAssetImport", "Quick3DUtils"]) _create_module("Quick3D", ["Gui", "Qml", "Quick", "Quick3DRuntimeRender"]) @@ -1197,6 +1310,8 @@ def _create_plugin(pluginname, libname, plugintype, requires): if self.options.qtsvg and self.options.gui: _create_module("Svg", ["Gui"]) + _create_plugin("QSvgIconPlugin", "qsvgicon", "iconengines", []) + _create_plugin("QSvgPlugin", "qsvg", "imageformats", []) if self.options.qtwayland and self.options.gui: _create_module("WaylandClient", ["Gui", "wayland::wayland-client"]) @@ -1234,7 +1349,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", []) @@ -1259,6 +1374,15 @@ def _create_plugin(pluginname, libname, plugintype, requires): if self.options.qtcharts: _create_module("Charts", ["Gui", "Widgets"]) + if self.options.qtgamepad: + _create_module("Gamepad", ["Gui"]) + if self.settings.os == "Linux": + _create_plugin("QEvdevGamepadBackendPlugin", "evdevgamepad", "gamepads", []) + if self.settings.os == "Macos": + _create_plugin("QDarwinGamepadBackendPlugin", "darwingamepad", "gamepads", []) + if self.settings.os =="Windows": + _create_plugin("QXInputGamepadBackendPlugin", "xinputgamepad", "gamepads", []) + if self.options.qt3d: _create_module("3DCore", ["Gui", "Network"]) @@ -1271,7 +1395,7 @@ def _create_plugin(pluginname, libname, plugintype, requires): _create_plugin("Scene2DPlugin", "scene2d", "renderplugins", []) _create_module("3DAnimation", ["3DRender", "3DCore", "Gui"]) - _create_module("3DInput", ["3DCore", "Gamepad", "Gui"]) + _create_module("3DInput", ["3DCore", "Gui"] + (["Gamepad"] if self.options.qtgamepad else [])) _create_module("3DLogic", ["3DCore", "Gui"]) _create_module("3DExtras", ["3DRender", "3DInput", "3DLogic", "3DCore", "Gui"]) _create_module("3DQuick", ["3DCore", "Quick", "Gui", "Qml"]) @@ -1281,21 +1405,12 @@ def _create_plugin(pluginname, libname, plugintype, requires): _create_module("3DQuickRender", ["3DRender", "3DQuick", "3DCore", "Gui", "Qml"]) _create_module("3DQuickScene2D", ["3DRender", "3DQuick", "3DCore", "Gui", "Qml"]) - if self.options.qtgamepad: - _create_module("Gamepad", ["Gui"]) - if self.settings.os == "Linux": - _create_plugin("QEvdevGamepadBackendPlugin", "evdevgamepad", "gamepads", []) - if self.settings.os == "Macos": - _create_plugin("QDarwinGamepadBackendPlugin", "darwingamepad", "gamepads", []) - if self.settings.os =="Windows": - _create_plugin("QXInputGamepadBackendPlugin", "xinputgamepad", "gamepads", []) - if self.options.qtmultimedia: multimedia_reqs = ["Network", "Gui"] if self.options.get_safe("with_libalsa", False): multimedia_reqs.append("libalsa::libalsa") if self.options.with_openal: - multimedia_reqs.append("openal::openal") + multimedia_reqs.append("openal-soft::openal-soft") if self.options.get_safe("with_pulseaudio", False): multimedia_reqs.append("pulseaudio::pulse") _create_module("Multimedia", multimedia_reqs) @@ -1309,8 +1424,10 @@ def _create_plugin(pluginname, libname, plugintype, requires): _create_plugin("QGstreamerCaptureServicePlugin", "gstmediacapture", "mediaservice", []) _create_plugin("QGstreamerPlayerServicePlugin", "gstmediaplayer", "mediaservice", []) if self.settings.os == "Linux": - _create_plugin("CameraBinServicePlugin", "gstcamerabin", "mediaservice", []) - _create_plugin("QAlsaPlugin", "qtaudio_alsa", "audio", []) + if self.options.with_gstreamer: + _create_plugin("CameraBinServicePlugin", "gstcamerabin", "mediaservice", []) + if self.options.get_safe("with_libalsa", False): + _create_plugin("QAlsaPlugin", "qtaudio_alsa", "audio", []) if self.settings.os == "Windows": _create_plugin("AudioCaptureServicePlugin", "qtmedia_audioengine", "mediaservice", []) _create_plugin("DSServicePlugin", "dsengine", "mediaservice", []) @@ -1391,7 +1508,7 @@ def _create_plugin(pluginname, libname, plugintype, requires): self.cpp_info.components["qtNetwork"].system_libs.append("dnsapi") # qtnetwork from qtbase requires "DnsFree" which is in "Dnsapi.lib" library self.cpp_info.components["qtNetwork"].system_libs.append("iphlpapi") if self.options.widgets: - self.cpp_info.components["qtWidgets"].system_libs.append("UxTheme") + self.cpp_info.components["qtWidgets"].system_libs.append("uxtheme") self.cpp_info.components["qtWidgets"].system_libs.append("dwmapi") if self.options.get_safe("qtwinextras"): self.cpp_info.components["qtWinExtras"].system_libs.append("dwmapi") # qtwinextras requires "DwmGetColorizationColor" which is in "dwmapi.lib" library @@ -1403,12 +1520,13 @@ def _create_plugin(pluginname, libname, plugintype, requires): 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": + if self.settings.os == "Macos" or (self.settings.os == "iOS" and Version(self.settings.compiler.version) >= "14.0"): self.cpp_info.components["qtCore"].frameworks.append("IOKit") # qtcore requires "_IORegistryEntryCreateCFProperty", "_IOServiceGetMatchingService" and much more which are in "IOKit" framework + if self.settings.os == "Macos": 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["qtCore"].builddirs.append(os.path.join("bin","archdatadir","bin")) + self.cpp_info.components["qtCore"].builddirs.append(os.path.join("bin")) _add_build_module("qtCore", self._cmake_core_extras_file) _add_build_module("qtCore", self._cmake_qt5_private_file("Core")) @@ -1423,8 +1541,7 @@ def _create_plugin(pluginname, libname, plugintype, requires): os.path.join("lib", "cmake", "Qt5Core", "Qt5CoreConfigExtrasMkspecDir.cmake")) mkspecs_dir_begin = qt5core_config_extras_mkspec_dir_cmake.find("mkspecs/") mkspecs_dir_end = qt5core_config_extras_mkspec_dir_cmake.find("\"", mkspecs_dir_begin) - mkspecs_dir = qt5core_config_extras_mkspec_dir_cmake[mkspecs_dir_begin:mkspecs_dir_end].split('/') - mkspecs_path = os.path.join("bin", "archdatadir", *mkspecs_dir) + mkspecs_path = qt5core_config_extras_mkspec_dir_cmake[mkspecs_dir_begin:mkspecs_dir_end] assert os.path.exists(mkspecs_path) self.cpp_info.components["qtCore"].includedirs.append(mkspecs_path) @@ -1464,12 +1581,10 @@ def _remove_duplicate(l): yield element def _gather_libs(self, p): - 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] + libs = ["-l" + i for i in p.cpp_info.aggregated_components().libs + p.cpp_info.aggregated_components().system_libs] if is_apple_os(self): - libs += ["-framework " + i for i in self.deps_cpp_info[p].frameworks] - libs += self.deps_cpp_info[p].sharedlinkflags - for dep in self.deps_cpp_info[p].public_deps: + libs += ["-framework " + i for i in p.cpp_info.aggregated_components().frameworks] + libs += p.cpp_info.aggregated_components().sharedlinkflags + for dep in p.dependencies.direct_host.values(): libs += self._gather_libs(dep) return self._remove_duplicate(libs) diff --git a/recipes/qt/5.x.x/patches/107ed30ec5.patch b/recipes/qt/5.x.x/patches/107ed30ec5.patch deleted file mode 100644 index 3dd48a20a04ce..0000000000000 --- a/recipes/qt/5.x.x/patches/107ed30ec5.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 107ed30ec505f20f166cf7df3b99c5c73a680796 Mon Sep 17 00:00:00 2001 -From: Peter Varga -Date: Fri, 4 Mar 2022 10:42:25 +0100 -Subject: [PATCH] [Backport] Fix for non-constant SIGSTKSZ - -On glibc > 2.33, `SIGSTKSZ` might not be constant (in which case -it expands to a call to `sysconf` which returns a `long int`); see -https://sourceware.org/pipermail/libc-alpha/2020-October/118513.html - -Pass unsigned explicitly to std::max, to avoid relying on template -argument deduction. This works both with the old-style constant -`SIGSTKSZ` and the new configurable one. - -Initially based on https://chromium-review.googlesource.com/c/2776379 - -Change-Id: I2279e8423aa70987ce4537674c7291216d23062f -Review-URL: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3340721 -Reviewed-by: Allan Sandfeld Jensen ---- - .../breakpad/src/client/linux/handler/exception_handler.cc | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/chromium/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc b/chromium/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc -index ca353c40997..4c73053c513 100644 ---- a/chromium/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc -+++ b/chromium/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc -@@ -138,7 +138,7 @@ void InstallAlternateStackLocked() { - // SIGSTKSZ may be too small to prevent the signal handlers from overrunning - // the alternative stack. Ensure that the size of the alternative stack is - // large enough. -- static const unsigned kSigStackSize = std::max(16384, SIGSTKSZ); -+ static const unsigned kSigStackSize = std::max(16384, SIGSTKSZ); - - // Only set an alternative stack if there isn't already one, or if the current - // one is too small. 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/5.15.10-fix-macos-cpp-lib-memory-resource.patch b/recipes/qt/5.x.x/patches/5.15.10-fix-macos-cpp-lib-memory-resource.patch new file mode 100644 index 0000000000000..21112d5316d7a --- /dev/null +++ b/recipes/qt/5.x.x/patches/5.15.10-fix-macos-cpp-lib-memory-resource.patch @@ -0,0 +1,43 @@ +--- a/src/corelib/global/qcompilerdetection.h ++++ b/src/corelib/global/qcompilerdetection.h +@@ -1050,16 +1050,22 @@ + # endif // !_HAS_CONSTEXPR + # endif // !__GLIBCXX__ && !_LIBCPP_VERSION + # endif // Q_OS_QNX +-# if (defined(Q_CC_CLANG) || defined(Q_CC_INTEL)) && defined(Q_OS_MAC) && defined(__GNUC_LIBSTD__) \ +- && ((__GNUC_LIBSTD__-0) * 100 + __GNUC_LIBSTD_MINOR__-0 <= 402) ++# if (defined(Q_CC_CLANG) || defined(Q_CC_INTEL)) && defined(Q_OS_MAC) ++# if defined(__GNUC_LIBSTD__) && ((__GNUC_LIBSTD__-0) * 100 + __GNUC_LIBSTD_MINOR__-0 <= 402) + // Apple has not updated libstdc++ since 2007, which means it does not have + // or std::move. Let's disable these features +-# undef Q_COMPILER_INITIALIZER_LISTS +-# undef Q_COMPILER_RVALUE_REFS +-# undef Q_COMPILER_REF_QUALIFIERS ++# undef Q_COMPILER_INITIALIZER_LISTS ++# undef Q_COMPILER_RVALUE_REFS ++# undef Q_COMPILER_REF_QUALIFIERS + // Also disable , since it's clearly not there +-# undef Q_COMPILER_ATOMICS +-# endif ++# undef Q_COMPILER_ATOMICS ++# endif ++# if defined(__cpp_lib_memory_resource) \ ++ && ((defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < 140000) \ ++ || (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < 170000)) ++# undef __cpp_lib_memory_resource // Only supported on macOS 14 and iOS 17 ++# endif ++# endif // (defined(Q_CC_CLANG) || defined(Q_CC_INTEL)) && defined(Q_OS_MAC) + # if defined(Q_CC_CLANG) && defined(Q_CC_INTEL) && Q_CC_INTEL >= 1500 + // ICC 15.x and 16.0 have their own implementation of std::atomic, which is activated when in Clang mode + // (probably because libc++'s on OS X failed to compile), but they're missing some +--- a/src/corelib/tools/qduplicatetracker_p.h ++++ b/src/corelib/tools/qduplicatetracker_p.h +@@ -52,7 +52,7 @@ + + #include + +-#if QT_HAS_INCLUDE() && __cplusplus > 201402L ++#if defined(__cpp_lib_memory_resource) && __cplusplus > 201402L + # include + # include + #else diff --git a/recipes/qt/5.x.x/patches/5.15.12-fix-macos-cpp-lib-memory-resource.patch b/recipes/qt/5.x.x/patches/5.15.12-fix-macos-cpp-lib-memory-resource.patch new file mode 100644 index 0000000000000..96fc7fd858e95 --- /dev/null +++ b/recipes/qt/5.x.x/patches/5.15.12-fix-macos-cpp-lib-memory-resource.patch @@ -0,0 +1,43 @@ +--- a/src/corelib/global/qcompilerdetection.h ++++ b/src/corelib/global/qcompilerdetection.h +@@ -1055,16 +1055,22 @@ + # endif // !_HAS_CONSTEXPR + # endif // !__GLIBCXX__ && !_LIBCPP_VERSION + # endif // Q_OS_QNX +-# if (defined(Q_CC_CLANG) || defined(Q_CC_INTEL)) && defined(Q_OS_MAC) && defined(__GNUC_LIBSTD__) \ +- && ((__GNUC_LIBSTD__-0) * 100 + __GNUC_LIBSTD_MINOR__-0 <= 402) ++# if (defined(Q_CC_CLANG) || defined(Q_CC_INTEL)) && defined(Q_OS_MAC) ++# if defined(__GNUC_LIBSTD__) && ((__GNUC_LIBSTD__-0) * 100 + __GNUC_LIBSTD_MINOR__-0 <= 402) + // Apple has not updated libstdc++ since 2007, which means it does not have + // or std::move. Let's disable these features +-# undef Q_COMPILER_INITIALIZER_LISTS +-# undef Q_COMPILER_RVALUE_REFS +-# undef Q_COMPILER_REF_QUALIFIERS ++# undef Q_COMPILER_INITIALIZER_LISTS ++# undef Q_COMPILER_RVALUE_REFS ++# undef Q_COMPILER_REF_QUALIFIERS + // Also disable , since it's clearly not there +-# undef Q_COMPILER_ATOMICS +-# endif ++# undef Q_COMPILER_ATOMICS ++# endif ++# if defined(__cpp_lib_memory_resource) \ ++ && ((defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < 140000) \ ++ || (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < 170000)) ++# undef __cpp_lib_memory_resource // Only supported on macOS 14 and iOS 17 ++# endif ++# endif // (defined(Q_CC_CLANG) || defined(Q_CC_INTEL)) && defined(Q_OS_MAC) + # if defined(Q_CC_CLANG) && defined(Q_CC_INTEL) && Q_CC_INTEL >= 1500 + // ICC 15.x and 16.0 have their own implementation of std::atomic, which is activated when in Clang mode + // (probably because libc++'s on OS X failed to compile), but they're missing some +--- a/src/corelib/tools/qduplicatetracker_p.h ++++ b/src/corelib/tools/qduplicatetracker_p.h +@@ -52,7 +52,7 @@ + + #include + +-#if QT_HAS_INCLUDE() && __cplusplus > 201402L ++#if defined(__cpp_lib_memory_resource) && __cplusplus > 201402L + # include + # include + #else diff --git a/recipes/qt/5.x.x/patches/5.15.14-macos-chromium-newer-sdks.patch b/recipes/qt/5.x.x/patches/5.15.14-macos-chromium-newer-sdks.patch new file mode 100644 index 0000000000000..cb5ec1fca2189 --- /dev/null +++ b/recipes/qt/5.x.x/patches/5.15.14-macos-chromium-newer-sdks.patch @@ -0,0 +1,13 @@ +diff --git a/chromium/base/strings/utf_string_conversions.cc b/chromium/base/strings/utf_string_conversions.cc +index 12ed1f3e0..004ac6855 100644 +--- a/chromium/base/strings/utf_string_conversions.cc ++++ b/chromium/base/strings/utf_string_conversions.cc +@@ -15,7 +15,7 @@ + #include "base/third_party/icu/icu_utf.h" + #include "build/build_config.h" + +-#if defined(OS_MAC) ++#if defined(OS_MAC) && __MAC_OS_X_VERSION_MAX_ALLOWED < 120300 + namespace std { + inline namespace __1 { + template class basic_string; diff --git a/recipes/qt/5.x.x/patches/5.15.14-macos-qtlocation-utility-header.patch b/recipes/qt/5.x.x/patches/5.15.14-macos-qtlocation-utility-header.patch new file mode 100644 index 0000000000000..000965fda4346 --- /dev/null +++ b/recipes/qt/5.x.x/patches/5.15.14-macos-qtlocation-utility-header.patch @@ -0,0 +1,13 @@ +diff --git a/src/3rdparty/mapbox-gl-native/include/mbgl/util/unique_any.hpp b/src/3rdparty/mapbox-gl-native/include/mbgl/util/unique_any.hpp +index c7dc8b38e..d9e3709b1 100644 +--- a/src/3rdparty/mapbox-gl-native/include/mbgl/util/unique_any.hpp ++++ b/src/3rdparty/mapbox-gl-native/include/mbgl/util/unique_any.hpp +@@ -3,6 +3,8 @@ + #include + #include + #include ++#include ++ + namespace mbgl { + namespace util { + \ No newline at end of file diff --git a/recipes/qt/5.x.x/patches/5.15.14-macos-qtwebengine-rpath-link.patch b/recipes/qt/5.x.x/patches/5.15.14-macos-qtwebengine-rpath-link.patch new file mode 100644 index 0000000000000..2fb28c93ca411 --- /dev/null +++ b/recipes/qt/5.x.x/patches/5.15.14-macos-qtwebengine-rpath-link.patch @@ -0,0 +1,13 @@ +diff --git a/mkspecs/features/gn_generator.prf b/mkspecs/features/gn_generator.prf +index 306e58db1..a42059e82 100644 +--- a/mkspecs/features/gn_generator.prf ++++ b/mkspecs/features/gn_generator.prf +@@ -166,7 +166,7 @@ for (flag, GN_FLAGS): GN_CONTENTS += " \"$$flag\"," + unix:!macos: GN_CONTENTS += " \"-Wl,-rpath=$${rpath}\"," + } + } +-!isEmpty(QMAKE_RPATHLINKDIR): GN_CONTENTS += " \"-Wl,-rpath-link=$${QMAKE_RPATHLINKDIR}\"," ++!isEmpty(QMAKE_LFLAGS_RPATHLINK):!isEmpty(QMAKE_RPATHLINKDIR): GN_CONTENTS += " \"-Wl,-rpath-link=$${QMAKE_RPATHLINKDIR}\"," + GN_CONTENTS += " ]" + + GN_CONTENTS += " lib_dirs = [" diff --git a/recipes/qt/5.x.x/patches/5.15.14-qtwebengine-missing-deps.patch b/recipes/qt/5.x.x/patches/5.15.14-qtwebengine-missing-deps.patch new file mode 100644 index 0000000000000..fafd46513f4b8 --- /dev/null +++ b/recipes/qt/5.x.x/patches/5.15.14-qtwebengine-missing-deps.patch @@ -0,0 +1,12 @@ +diff --git a/chromium/content/public/browser/BUILD.gn b/chromium/content/public/browser/BUILD.gn +index 7cf82a4..0e0dda2 100644 +--- a/chromium/content/public/browser/BUILD.gn ++++ b/chromium/content/public/browser/BUILD.gn +@@ -469,6 +469,7 @@ jumbo_source_set("browser_sources") { + "//build:chromeos_buildflags", + "//cc", + "//components/viz/host", ++ "//components/spellcheck:buildflags", + "//content/browser", # Must not be public_deps! + "//device/fido", + "//gpu", diff --git a/recipes/qt/5.x.x/patches/5.15.7-fix-macos-cpp-lib-memory-resource.patch b/recipes/qt/5.x.x/patches/5.15.7-fix-macos-cpp-lib-memory-resource.patch new file mode 100644 index 0000000000000..2eb73ac2b79b5 --- /dev/null +++ b/recipes/qt/5.x.x/patches/5.15.7-fix-macos-cpp-lib-memory-resource.patch @@ -0,0 +1,43 @@ +--- a/src/corelib/global/qcompilerdetection.h ++++ b/src/corelib/global/qcompilerdetection.h +@@ -1041,16 +1041,22 @@ + # endif // !_HAS_CONSTEXPR + # endif // !__GLIBCXX__ && !_LIBCPP_VERSION + # endif // Q_OS_QNX +-# if (defined(Q_CC_CLANG) || defined(Q_CC_INTEL)) && defined(Q_OS_MAC) && defined(__GNUC_LIBSTD__) \ +- && ((__GNUC_LIBSTD__-0) * 100 + __GNUC_LIBSTD_MINOR__-0 <= 402) ++# if (defined(Q_CC_CLANG) || defined(Q_CC_INTEL)) && defined(Q_OS_MAC) ++# if defined(__GNUC_LIBSTD__) && ((__GNUC_LIBSTD__-0) * 100 + __GNUC_LIBSTD_MINOR__-0 <= 402) + // Apple has not updated libstdc++ since 2007, which means it does not have + // or std::move. Let's disable these features +-# undef Q_COMPILER_INITIALIZER_LISTS +-# undef Q_COMPILER_RVALUE_REFS +-# undef Q_COMPILER_REF_QUALIFIERS ++# undef Q_COMPILER_INITIALIZER_LISTS ++# undef Q_COMPILER_RVALUE_REFS ++# undef Q_COMPILER_REF_QUALIFIERS + // Also disable , since it's clearly not there +-# undef Q_COMPILER_ATOMICS +-# endif ++# undef Q_COMPILER_ATOMICS ++# endif ++# if defined(__cpp_lib_memory_resource) \ ++ && ((defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < 140000) \ ++ || (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < 170000)) ++# undef __cpp_lib_memory_resource // Only supported on macOS 14 and iOS 17 ++# endif ++# endif // (defined(Q_CC_CLANG) || defined(Q_CC_INTEL)) && defined(Q_OS_MAC) + # if defined(Q_CC_CLANG) && defined(Q_CC_INTEL) && Q_CC_INTEL >= 1500 + // ICC 15.x and 16.0 have their own implementation of std::atomic, which is activated when in Clang mode + // (probably because libc++'s on OS X failed to compile), but they're missing some +--- a/src/corelib/tools/qduplicatetracker_p.h ++++ b/src/corelib/tools/qduplicatetracker_p.h +@@ -52,7 +52,7 @@ + + #include + +-#if QT_HAS_INCLUDE() && __cplusplus > 201402L ++#if defined(__cpp_lib_memory_resource) && __cplusplus > 201402L + # include + # include + #else diff --git a/recipes/qt/5.x.x/patches/5.15.8-fix-qmake-default-libdirs-apple-clang-15.patch b/recipes/qt/5.x.x/patches/5.15.8-fix-qmake-default-libdirs-apple-clang-15.patch new file mode 100644 index 0000000000000..a058fb5245ef2 --- /dev/null +++ b/recipes/qt/5.x.x/patches/5.15.8-fix-qmake-default-libdirs-apple-clang-15.patch @@ -0,0 +1,26 @@ +--- a/mkspecs/features/toolchain.prf ++++ b/mkspecs/features/toolchain.prf +@@ -288,9 +288,12 @@ isEmpty($${target_prefix}.INCDIRS) { + } + } + } +- isEmpty(QMAKE_DEFAULT_LIBDIRS)|isEmpty(QMAKE_DEFAULT_INCDIRS): \ ++ isEmpty(QMAKE_DEFAULT_INCDIRS): \ + !integrity: \ +- error("failed to parse default search paths from compiler output") ++ error("failed to parse default include paths from compiler output") ++ isEmpty(QMAKE_DEFAULT_LIBDIRS): \ ++ !integrity:!darwin: \ ++ error("failed to parse default library paths from compiler output") + QMAKE_DEFAULT_LIBDIRS = $$unique(QMAKE_DEFAULT_LIBDIRS) + } else: ghs { + cmd = $$QMAKE_CXX $$QMAKE_CXXFLAGS -$${LITERAL_HASH} -o /tmp/fake_output /tmp/fake_input.cpp +@@ -412,7 +415,7 @@ isEmpty($${target_prefix}.INCDIRS) { + QMAKE_DEFAULT_INCDIRS = $$split(INCLUDE, $$QMAKE_DIRLIST_SEP) + } + +- unix:if(!cross_compile|host_build) { ++ unix:!darwin:if(!cross_compile|host_build) { + isEmpty(QMAKE_DEFAULT_INCDIRS): QMAKE_DEFAULT_INCDIRS = /usr/include /usr/local/include + isEmpty(QMAKE_DEFAULT_LIBDIRS): QMAKE_DEFAULT_LIBDIRS = /lib /usr/lib + } diff --git a/recipes/qt/5.x.x/patches/Fix-errors-and-warnings-for-perfetto.patch b/recipes/qt/5.x.x/patches/Fix-errors-and-warnings-for-perfetto.patch new file mode 100644 index 0000000000000..abd82e1674e40 --- /dev/null +++ b/recipes/qt/5.x.x/patches/Fix-errors-and-warnings-for-perfetto.patch @@ -0,0 +1,101 @@ +From 851cd7c7a079fa5da63770c49724036e8338e813 Mon Sep 17 00:00:00 2001 +From: Michal Klocek +Date: Wed, 20 Sep 2023 07:45:29 +0200 +Subject: [PATCH] Fix errors and warnings for perfetto +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf8 +Content-Transfer-Encoding: 8bit + +It seems newest msvc compiler does not like perfetto circualar queue +const iterator, which ends in issues with std::swap of std::sort. +Make sure it is non const. + +Fix warnings. + +Deals with: "error C2672: 'swap': no matching overloaded function +found." + +Fixes: QTBUG-117073 +Change-Id: I02901e61a1bb8863d72ca02a0ccd841e54309d6e +Reviewed-on: https://codereview.qt-project.org/c/qt/qtwebengine-chromium/+/505412 +Reviewed-by: Martin Negyokru +Reviewed-by: Michael Brüning +--- + .../perfetto/include/perfetto/ext/base/circular_queue.h | 9 ++------- + .../third_party/perfetto/src/trace_processor/storage/metadata.h | 2 ++ + .../third_party/perfetto/src/trace_processor/storage/stats.h | 2 ++ + .../perfetto/src/trace_processor/tables/macros_internal.h | 2 ++ + 4 files changed, 8 insertions(+), 7 deletions(-) + +diff --git a/chromium/third_party/perfetto/include/perfetto/ext/base/circular_queue.h b/chromium/third_party/perfetto/include/perfetto/ext/base/circular_queue.h +index 18ca7702614..ec46e69f817 100644 +--- a/chromium/third_party/perfetto/include/perfetto/ext/base/circular_queue.h ++++ b/chromium/third_party/perfetto/include/perfetto/ext/base/circular_queue.h +@@ -67,19 +67,14 @@ class CircularQueue { + ignore_result(generation); + } + +- T* operator->() { ++ T* operator->() const { + #if PERFETTO_DCHECK_IS_ON() + PERFETTO_DCHECK(generation_ == queue_->generation()); + #endif + return queue_->Get(pos_); + } + +- const T* operator->() const { +- return const_cast::Iterator*>(this)->operator->(); +- } +- +- T& operator*() { return *(operator->()); } +- const T& operator*() const { return *(operator->()); } ++ T& operator*() const { return *(operator->()); } + + value_type& operator[](difference_type i) { return *(*this + i); } + +diff --git a/chromium/third_party/perfetto/src/trace_processor/storage/metadata.h b/chromium/third_party/perfetto/src/trace_processor/storage/metadata.h +index 4796ae4edcd..30e534b216b 100644 +--- a/chromium/third_party/perfetto/src/trace_processor/storage/metadata.h ++++ b/chromium/third_party/perfetto/src/trace_processor/storage/metadata.h +@@ -59,8 +59,10 @@ namespace metadata { + F(kMulti, "multi") + // clang-format + ++#if PERFETTO_BUILDFLAG(PERFETTO_COMPILER_GCC) + // Ignore GCC warning about a missing argument for a variadic macro parameter. + #pragma GCC system_header ++#endif + + #define PERFETTO_TP_META_TYPE_ENUM(varname, ...) varname + enum class KeyType : size_t { +diff --git a/chromium/third_party/perfetto/src/trace_processor/storage/stats.h b/chromium/third_party/perfetto/src/trace_processor/storage/stats.h +index 7f14803244e..30b56c62544 100644 +--- a/chromium/third_party/perfetto/src/trace_processor/storage/stats.h ++++ b/chromium/third_party/perfetto/src/trace_processor/storage/stats.h +@@ -189,7 +189,9 @@ enum Source { + }; + + // Ignore GCC warning about a missing argument for a variadic macro parameter. ++#if PERFETTO_BUILDFLAG(PERFETTO_COMPILER_GCC) + #pragma GCC system_header ++#endif + + // Declares an enum of literals (one for each stat). The enum values of each + // literal corresponds to the string index in the arrays below. +diff --git a/chromium/third_party/perfetto/src/trace_processor/tables/macros_internal.h b/chromium/third_party/perfetto/src/trace_processor/tables/macros_internal.h +index 875efd62e0d..1ca5068cc32 100644 +--- a/chromium/third_party/perfetto/src/trace_processor/tables/macros_internal.h ++++ b/chromium/third_party/perfetto/src/trace_processor/tables/macros_internal.h +@@ -140,7 +140,9 @@ class MacroTable : public Table { + } // namespace macros_internal + + // Ignore GCC warning about a missing argument for a variadic macro parameter. ++#if PERFETTO_BUILDFLAG(PERFETTO_COMPILER_GCC) + #pragma GCC system_header ++#endif + + // Basic helper macros. + #define PERFETTO_TP_NOOP(...) +-- +2.16.3 + diff --git a/recipes/qt/5.x.x/patches/QTBUG-98813.patch b/recipes/qt/5.x.x/patches/QTBUG-98813.patch deleted file mode 100644 index c7d6fe522ebcf..0000000000000 --- a/recipes/qt/5.x.x/patches/QTBUG-98813.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 7ff159da128c4f249b468f3ff972f864d243c742 Mon Sep 17 00:00:00 2001 -From: Allan Sandfeld Jensen -Date: Tue, 7 Dec 2021 10:44:51 +0100 -Subject: [PATCH] Try to fix build on Apple Monterey -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -std::basic_string::shrink_to_fit appears to not be inline - -Change-Id: I5bca251bdde433e917879947f97659973c430f54 -Fixes: QTBUG-98813 -Reviewed-by: Peter Varga -Reviewed-by: Allan Sandfeld Jensen -Reviewed-by: Michael Brüning ---- - chromium/base/strings/utf_string_conversions.cc | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/chromium/base/strings/utf_string_conversions.cc b/chromium/base/strings/utf_string_conversions.cc -index 0b55cd9e59d..12ed1f3e010 100644 ---- a/chromium/base/strings/utf_string_conversions.cc -+++ b/chromium/base/strings/utf_string_conversions.cc -@@ -15,6 +15,14 @@ - #include "base/third_party/icu/icu_utf.h" - #include "build/build_config.h" - -+#if defined(OS_MAC) -+namespace std { -+inline namespace __1 { -+template class basic_string; -+} // namespace __1 -+} // namespace std -+#endif // defined(OS_MAC) -+ - namespace base { - - namespace { diff --git a/recipes/qt/5.x.x/patches/android-backtrace.diff b/recipes/qt/5.x.x/patches/android-backtrace.diff new file mode 100644 index 0000000000000..0fba728e174c6 --- /dev/null +++ b/recipes/qt/5.x.x/patches/android-backtrace.diff @@ -0,0 +1,19 @@ +diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp +index 89f49324c..dedf78fe5 100644 +--- a/src/corelib/global/qlogging.cpp ++++ b/src/corelib/global/qlogging.cpp +@@ -107,7 +107,13 @@ + # define QLOGGING_HAVE_BACKTRACE + # endif + # elif (defined(__GLIBC__) && defined(__GLIBCXX__)) || (__has_include() && __has_include()) +-# define QLOGGING_HAVE_BACKTRACE ++# ifdef __ANDROID_API__ ++# if __ANDROID_API__ >= 33 ++# define QLOGGING_HAVE_BACKTRACE ++# endif ++# else ++# define QLOGGING_HAVE_BACKTRACE ++# endif + # endif + #endif + diff --git a/recipes/qt/5.x.x/patches/android-new-ndk.diff b/recipes/qt/5.x.x/patches/android-new-ndk.diff new file mode 100644 index 0000000000000..44b38b694fe19 --- /dev/null +++ b/recipes/qt/5.x.x/patches/android-new-ndk.diff @@ -0,0 +1,27 @@ +From 49f62e8c5a8aef4c0b7fd6867a30e653d2f5dd98 Mon Sep 17 00:00:00 2001 +From: Alexey Edelev +Date: Mon, 21 Nov 2022 15:03:17 +0100 +Subject: [PATCH] Remove QMAKE_RANLIB and QMAKE_LINK_SHLIB from android/default_pre.prf + +The values should come from android-clang mkspecs. The hardcoded +values don't work correctly with recent Android NDKs. + +Pick-to: 6.4 6.2 5.15 +Fixes: QTBUG-108662 +Change-Id: Ie153a50ee0c49bd4f0704b588a4e2c87a05c1063 +Reviewed-by: Assam Boudjelthia +--- + +diff --git a/mkspecs/features/android/default_pre.prf b/mkspecs/features/android/default_pre.prf +index 9f90dcb..2328b72 100644 +--- a/mkspecs/features/android/default_pre.prf ++++ b/mkspecs/features/android/default_pre.prf +@@ -76,8 +76,6 @@ + else: equals(QT_ARCH, arm64-v8a): CROSS_COMPILE = $$NDK_LLVM_PATH/bin/aarch64-linux-android- + else: CROSS_COMPILE = $$NDK_LLVM_PATH/bin/arm-linux-androideabi- + +-QMAKE_RANLIB = $${CROSS_COMPILE}ranlib +-QMAKE_LINK_SHLIB = $$QMAKE_LINK + QMAKE_LFLAGS = + + QMAKE_LIBS_PRIVATE = -llog -lz -lm -ldl -lc diff --git a/recipes/qt/5.x.x/patches/android-openssl.diff b/recipes/qt/5.x.x/patches/android-openssl.diff new file mode 100644 index 0000000000000..6091b9f19c46b --- /dev/null +++ b/recipes/qt/5.x.x/patches/android-openssl.diff @@ -0,0 +1,13 @@ +diff --git a/src/network/ssl/ssl.pri b/src/network/ssl/ssl.pri +index 230c45c26..d7527949e 100644 +--- a/src/network/ssl/ssl.pri ++++ b/src/network/ssl/ssl.pri +@@ -117,7 +117,7 @@ qtConfig(ssl) { + + qtConfig(openssl-linked): { + android { +- build_pass|single_android_abi: LIBS_PRIVATE += -lssl_$${QT_ARCH} -lcrypto_$${QT_ARCH} ++ build_pass|single_android_abi: LIBS_PRIVATE += -lssl -lcrypto + } else: QMAKE_USE_FOR_PRIVATE += openssl + } else: \ + QMAKE_USE_FOR_PRIVATE += openssl/nolink diff --git a/recipes/qt/5.x.x/patches/d3396fb6fc.patch b/recipes/qt/5.x.x/patches/d3396fb6fc.patch deleted file mode 100644 index 5f832ae4c3873..0000000000000 --- a/recipes/qt/5.x.x/patches/d3396fb6fc.patch +++ /dev/null @@ -1,30 +0,0 @@ -From d3396fb6fcf9e1846de3091ada99284e10e9ee54 Mon Sep 17 00:00:00 2001 -From: Peter Varga -Date: Fri, 10 Dec 2021 14:40:20 +0100 -Subject: [PATCH] [Backport] abseil-cpp: Fixes build with latest glibc - -Fixes https://github.com/abseil/abseil-cpp/issues/952 - -This fix is extracted from: -https://github.com/abseil/abseil-cpp/commit/a9831f1cbf93fb18dd951453635f488037454ce9 - -Change-Id: I337c8c900ef569853046bb9adc3807a3ed12b13b -Reviewed-by: Allan Sandfeld Jensen ---- - .../abseil-cpp/absl/debugging/failure_signal_handler.cc | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/chromium/third_party/abseil-cpp/absl/debugging/failure_signal_handler.cc b/chromium/third_party/abseil-cpp/absl/debugging/failure_signal_handler.cc -index 5d13bdbbbd1..2ed137b58f1 100644 ---- a/chromium/third_party/abseil-cpp/absl/debugging/failure_signal_handler.cc -+++ b/chromium/third_party/abseil-cpp/absl/debugging/failure_signal_handler.cc -@@ -135,7 +135,8 @@ static bool SetupAlternateStackOnce() { - #else - const size_t page_mask = sysconf(_SC_PAGESIZE) - 1; - #endif -- size_t stack_size = (std::max(SIGSTKSZ, 65536) + page_mask) & ~page_mask; -+ size_t stack_size = -+ (std::max(SIGSTKSZ, 65536) + page_mask) & ~page_mask; - #if defined(ABSL_HAVE_ADDRESS_SANITIZER) || \ - defined(ABSL_HAVE_MEMORY_SANITIZER) || defined(ABSL_HAVE_THREAD_SANITIZER) - // Account for sanitizer instrumentation requiring additional stack space. diff --git a/recipes/qt/5.x.x/patches/dece6f5.diff b/recipes/qt/5.x.x/patches/dece6f5.diff deleted file mode 100644 index cd70c3d8f67ab..0000000000000 --- a/recipes/qt/5.x.x/patches/dece6f5.diff +++ /dev/null @@ -1,14 +0,0 @@ -diff --git a/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.h b/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.h -index e070ba977d..35a62f59e3 100644 ---- a/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.h -+++ b/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.h -@@ -43,6 +43,9 @@ - #include - #include - -+ -+#include -+ - QT_BEGIN_NAMESPACE - - class QIOSurfaceGraphicsBuffer : public QPlatformGraphicsBuffer diff --git a/recipes/qt/5.x.x/patches/ffmpeg-x86-optimization.patch b/recipes/qt/5.x.x/patches/ffmpeg-x86-optimization.patch new file mode 100644 index 0000000000000..cff8df9a43395 --- /dev/null +++ b/recipes/qt/5.x.x/patches/ffmpeg-x86-optimization.patch @@ -0,0 +1,64 @@ +Description: avcodec/x86/mathops: clip constants used with shift instructions within inline assembly + Fixes assembling with gas from binutils >= 2.41. +Origin: upstream, https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/effadce6c756247e +Bug: https://bugs.debian.org/1038132 +Last-Update: 2023-07-21 + +--- a/src/3rdparty/chromium/third_party/ffmpeg/libavcodec/x86/mathops.h ++++ b/src/3rdparty/chromium/third_party/ffmpeg/libavcodec/x86/mathops.h +@@ -35,12 +35,20 @@ + static av_always_inline av_const int MULL(int a, int b, unsigned shift) + { + int rt, dummy; ++ if (__builtin_constant_p(shift)) + __asm__ ( + "imull %3 \n\t" + "shrdl %4, %%edx, %%eax \n\t" + :"=a"(rt), "=d"(dummy) +- :"a"(a), "rm"(b), "ci"((uint8_t)shift) ++ :"a"(a), "rm"(b), "i"(shift & 0x1F) + ); ++ else ++ __asm__ ( ++ "imull %3 \n\t" ++ "shrdl %4, %%edx, %%eax \n\t" ++ :"=a"(rt), "=d"(dummy) ++ :"a"(a), "rm"(b), "c"((uint8_t)shift) ++ ); + return rt; + } + +@@ -113,19 +121,31 @@ __asm__ volatile(\ + // avoid +32 for shift optimization (gcc should do that ...) + #define NEG_SSR32 NEG_SSR32 + static inline int32_t NEG_SSR32( int32_t a, int8_t s){ ++ if (__builtin_constant_p(s)) + __asm__ ("sarl %1, %0\n\t" + : "+r" (a) +- : "ic" ((uint8_t)(-s)) ++ : "i" (-s & 0x1F) + ); ++ else ++ __asm__ ("sarl %1, %0\n\t" ++ : "+r" (a) ++ : "c" ((uint8_t)(-s)) ++ ); + return a; + } + + #define NEG_USR32 NEG_USR32 + static inline uint32_t NEG_USR32(uint32_t a, int8_t s){ ++ if (__builtin_constant_p(s)) + __asm__ ("shrl %1, %0\n\t" + : "+r" (a) +- : "ic" ((uint8_t)(-s)) ++ : "i" (-s & 0x1F) + ); ++ else ++ __asm__ ("shrl %1, %0\n\t" ++ : "+r" (a) ++ : "c" ((uint8_t)(-s)) ++ ); + return a; + } + diff --git a/recipes/qt/5.x.x/qtmodules5.15.5.conf b/recipes/qt/5.x.x/qtmodules5.15.10.conf similarity index 100% rename from recipes/qt/5.x.x/qtmodules5.15.5.conf rename to recipes/qt/5.x.x/qtmodules5.15.10.conf diff --git a/recipes/qt/5.x.x/qtmodules5.15.6.conf b/recipes/qt/5.x.x/qtmodules5.15.11.conf similarity index 100% rename from recipes/qt/5.x.x/qtmodules5.15.6.conf rename to recipes/qt/5.x.x/qtmodules5.15.11.conf diff --git a/recipes/qt/5.x.x/qtmodules5.15.7.conf b/recipes/qt/5.x.x/qtmodules5.15.12.conf similarity index 100% rename from recipes/qt/5.x.x/qtmodules5.15.7.conf rename to recipes/qt/5.x.x/qtmodules5.15.12.conf diff --git a/recipes/qt/5.x.x/qtmodules5.15.13.conf b/recipes/qt/5.x.x/qtmodules5.15.13.conf new file mode 100644 index 0000000000000..452233655f279 --- /dev/null +++ b/recipes/qt/5.x.x/qtmodules5.15.13.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.14.conf b/recipes/qt/5.x.x/qtmodules5.15.14.conf new file mode 100644 index 0000000000000..452233655f279 --- /dev/null +++ b/recipes/qt/5.x.x/qtmodules5.15.14.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.9.conf b/recipes/qt/5.x.x/qtmodules5.15.9.conf new file mode 100644 index 0000000000000..452233655f279 --- /dev/null +++ b/recipes/qt/5.x.x/qtmodules5.15.9.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/CMakeLists.txt b/recipes/qt/5.x.x/test_package/CMakeLists.txt index 8ef3702021088..6c9a4ef2b991c 100644 --- a/recipes/qt/5.x.x/test_package/CMakeLists.txt +++ b/recipes/qt/5.x.x/test_package/CMakeLists.txt @@ -1,23 +1,9 @@ -cmake_minimum_required(VERSION 3.1.0) - -set(CMAKE_CXX_STANDARD 11) - -project(test_package) - -cmake_policy(SET CMP0020 NEW) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_set_vs_runtime() -conan_set_libcxx() -conan_output_dirs_setup() +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(Qt5 COMPONENTS Core Network Sql Concurrent Xml REQUIRED CONFIG) -set(CMAKE_AUTOMOC ON) -set(CMAKE_AUTORCC ON) - -set(SOURCES test_package.cpp greeter.h example.qrc) - -add_executable(${PROJECT_NAME} WIN32 ${SOURCES}) - -target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Network Qt5::Sql Qt5::Concurrent Qt5::Xml) +add_executable(${PROJECT_NAME} test_package.cpp greeter.h example.qrc) +target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core Qt5::Network Qt5::Sql Qt5::Concurrent Qt5::Xml) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +set_target_properties(${PROJECT_NAME} PROPERTIES AUTOMOC ON AUTORCC ON) diff --git a/recipes/qt/5.x.x/test_package/conanfile.py b/recipes/qt/5.x.x/test_package/conanfile.py index 427887bd514f2..9146ff6c3fbe3 100644 --- a/recipes/qt/5.x.x/test_package/conanfile.py +++ b/recipes/qt/5.x.x/test_package/conanfile.py @@ -1,129 +1,47 @@ import os -import shutil +import textwrap from conan import ConanFile -from conans import tools, Meson, RunEnvironment, CMake -from conan.tools.build import cross_building -from conan.errors import ConanInvalidConfiguration - +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +from conan.tools.env import VirtualRunEnv +from conan.tools.files import copy, save class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "qt", "cmake", "cmake_find_package_multi", "qmake" - - @property - def _settings_build(self): - return getattr(self, "settings_build", self.settings) - - def build_requirements(self): - if self._settings_build.os == "Windows" and self.settings.compiler == "Visual Studio": - self.build_requires("jom/1.1.3") - if self._meson_supported(): - self.build_requires("meson/0.59.3") - - def _is_mingw(self): - return self.settings.os == "Windows" and self.settings.compiler == "gcc" - - def _meson_supported(self): - return self.options["qt"].shared 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") + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualBuildEnv" + test_type = "explicit" - with tools.vcvars(self.settings) if self.settings.compiler == "Visual Studio" else tools.no_op(): - args = [self.source_folder, "DESTDIR=bin"] + def layout(self): + cmake_layout(self) - def _getenvpath(var): - val = os.getenv(var) - if val and tools.os_info.is_windows: - val = val.replace("\\", "/") - os.environ[var] = val - return val + def requirements(self): + self.requires(self.tested_reference_str, run=can_run(self)) - value = _getenvpath("CC") - if value: - args += ['QMAKE_CC="' + value + '"', - 'QMAKE_LINK_C="' + value + '"', - 'QMAKE_LINK_C_SHLIB="' + value + '"'] - - value = _getenvpath('CXX') - if value: - args += ['QMAKE_CXX="' + value + '"', - 'QMAKE_LINK="' + value + '"', - 'QMAKE_LINK_SHLIB="' + value + '"'] - - self.run("qmake %s" % " ".join(args), run_environment=True) - if tools.os_info.is_windows: - if self.settings.compiler == "Visual Studio": - self.run("jom", run_environment=True) - else: - self.run("mingw32-make", run_environment=True) - else: - self.run("make", run_environment=True) - - def _build_with_meson(self): - if self._meson_supported(): - self.output.info("Building with Meson") - tools.mkdir("meson_folder") - with tools.environment_append(RunEnvironment(self).vars): - meson = Meson(self) - try: - meson.configure(build_folder="meson_folder", defs={"cpp_std": "c++11"}) - except ConanInvalidConfiguration: - self.output.info(open("meson_folder/meson-logs/meson-log.txt", 'r').read()) - raise - meson.build() + def build_requirements(self): + if not can_run(self): + self.tool_requires(self.tested_reference_str) - def _build_with_cmake_find_package_multi(self): - self.output.info("Building with cmake_find_package_multi") - env_build = RunEnvironment(self) - with tools.environment_append(env_build.vars): - cmake = CMake(self, set_cmake_flags=True) - if self.settings.os == "Macos": - cmake.definitions['CMAKE_OSX_DEPLOYMENT_TARGET'] = '10.14' + def generate(self): + qt_install_prefix = self.dependencies["qt"].package_folder.replace("\\", "/") + qt_conf = textwrap.dedent(f"""\ + [Paths] + Prefix = {qt_install_prefix} + """) + save(self, "qt.conf", qt_conf) - cmake.configure() - cmake.build() + VirtualRunEnv(self).generate() + if can_run(self): + VirtualRunEnv(self).generate(scope="build") def build(self): - self._build_with_qmake() - self._build_with_meson() - 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: - 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) - - def _test_with_meson(self): - if self._meson_supported(): - self.output.info("Testing Meson") - shutil.copy("qt.conf", "meson_folder") - self.run(os.path.join("meson_folder", "test_package"), run_environment=True) - - def _test_with_cmake_find_package_multi(self): - self.output.info("Testing CMake_find_package_multi") - shutil.copy("qt.conf", "bin") - self.run(os.path.join("bin", "test_package"), run_environment=True) + cmake = CMake(self) + cmake.configure() + cmake.build() def test(self): - if not cross_building(self, skip_x64_x86=True): - self._test_with_qmake() - self._test_with_meson() - self._test_with_cmake_find_package_multi() + if can_run(self): + copy(self, "qt.conf", src=self.generators_folder, dst=os.path.join(self.cpp.build.bindirs[0])) + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/qt/5.x.x/test_package/meson.build b/recipes/qt/5.x.x/test_package/meson.build deleted file mode 100644 index 9ca197c37965e..0000000000000 --- a/recipes/qt/5.x.x/test_package/meson.build +++ /dev/null @@ -1,6 +0,0 @@ -project('test_package', 'cpp') -qt5 = import('qt5') -qt5_dep = dependency('qt5', modules: ['Core', 'Network', 'Sql', 'Concurrent', 'Xml']) -moc_files = qt5.preprocess(moc_headers : 'greeter.h', qresources : 'example.qrc') -executable('test_package', 'test_package.cpp', moc_files, - dependencies : qt5_dep) diff --git a/recipes/qt/5.x.x/test_package/test_package.pro b/recipes/qt/5.x.x/test_package/test_package.pro deleted file mode 100644 index 58325c643ef64..0000000000000 --- a/recipes/qt/5.x.x/test_package/test_package.pro +++ /dev/null @@ -1,14 +0,0 @@ -SOURCES += test_package.cpp - -HEADERS += greeter.h - -RESOURCES = example.qrc - -QT -= gui -QT += network sql concurrent xml - -CONFIG += console - -CONFIG += conan_basic_setup -include($$OUT_PWD/../conanbuildinfo.pri) -LIBS -= $$CONAN_LIBS_QT diff --git a/recipes/qt/5.x.x/test_v1_package/CMakeLists.txt b/recipes/qt/5.x.x/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..a56d8c5c4fe51 --- /dev/null +++ b/recipes/qt/5.x.x/test_v1_package/CMakeLists.txt @@ -0,0 +1,23 @@ +cmake_minimum_required(VERSION 3.1.0) + +set(CMAKE_CXX_STANDARD 11) + +project(test_package) + +cmake_policy(SET CMP0020 NEW) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_set_vs_runtime() +conan_set_libcxx() +conan_output_dirs_setup() + +find_package(Qt5 COMPONENTS Core Network Sql Concurrent Xml REQUIRED CONFIG) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) + +set(SOURCES ../test_package/test_package.cpp ../test_package/greeter.h ../test_package/example.qrc) + +add_executable(${PROJECT_NAME} ${SOURCES}) + +target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Network Qt5::Sql Qt5::Concurrent Qt5::Xml) diff --git a/recipes/qt/5.x.x/test_v1_package/conanfile.py b/recipes/qt/5.x.x/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..45d17b452e41f --- /dev/null +++ b/recipes/qt/5.x.x/test_v1_package/conanfile.py @@ -0,0 +1,134 @@ +import os +import shutil + +from conan import ConanFile +from conans import tools, Meson, RunEnvironment, CMake +from conan.tools.build import cross_building +from conan.tools.files import save +from conan.errors import ConanInvalidConfiguration + + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi", "qmake" + + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) + + def build_requirements(self): + if self._settings_build.os == "Windows" and self.settings.compiler == "Visual Studio": + self.build_requires("jom/1.1.3") + if self._meson_supported(): + self.build_requires("meson/1.1.1") + + def generate(self): + save(self, "qt.conf", """[Paths] +Prefix = {}""".format(self.dependencies["qt"].package_folder.replace('\\', '/'))) + + def _is_mingw(self): + return self.settings.os == "Windows" and self.settings.compiler == "gcc" + + def _meson_supported(self): + return self.options["qt"].shared 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") + + with tools.vcvars(self.settings) if self.settings.compiler == "Visual Studio" else tools.no_op(): + args = [self.source_folder, "DESTDIR=bin"] + + def _getenvpath(var): + val = os.getenv(var) + if val and tools.os_info.is_windows: + val = val.replace("\\", "/") + os.environ[var] = val + return val + + value = _getenvpath("CC") + if value: + args += ['QMAKE_CC="' + value + '"', + 'QMAKE_LINK_C="' + value + '"', + 'QMAKE_LINK_C_SHLIB="' + value + '"'] + + value = _getenvpath('CXX') + if value: + args += ['QMAKE_CXX="' + value + '"', + 'QMAKE_LINK="' + value + '"', + 'QMAKE_LINK_SHLIB="' + value + '"'] + + self.run("qmake %s" % " ".join(args), run_environment=True) + if tools.os_info.is_windows: + if self.settings.compiler == "Visual Studio": + self.run("jom", run_environment=True) + else: + self.run("mingw32-make", run_environment=True) + else: + self.run("make", run_environment=True) + + def _build_with_meson(self): + if self._meson_supported(): + self.output.info("Building with Meson") + tools.mkdir("meson_folder") + with tools.environment_append(RunEnvironment(self).vars): + meson = Meson(self) + try: + meson.configure(build_folder="meson_folder", defs={"cpp_std": "c++11"}) + except ConanInvalidConfiguration: + self.output.info(open("meson_folder/meson-logs/meson-log.txt", 'r').read()) + raise + meson.build() + + def _build_with_cmake_find_package_multi(self): + self.output.info("Building with cmake_find_package_multi") + env_build = RunEnvironment(self) + with tools.environment_append(env_build.vars): + cmake = CMake(self, set_cmake_flags=True) + if self.settings.os == "Macos": + cmake.definitions['CMAKE_OSX_DEPLOYMENT_TARGET'] = '10.14' + + cmake.configure() + cmake.build() + + def build(self): + self._build_with_qmake() + self._build_with_meson() + 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: + bin_path = os.path.join(bin_path, "test_package.app", "Contents", "MacOS") + shutil.copy(os.path.join(self.generators_folder, "qt.conf"), bin_path) + self.run(os.path.join(bin_path, "test_package"), run_environment=True) + + def _test_with_meson(self): + if self._meson_supported(): + self.output.info("Testing Meson") + shutil.copy(os.path.join(self.generators_folder, "qt.conf"), "meson_folder") + self.run(os.path.join("meson_folder", "test_package"), run_environment=True) + + def _test_with_cmake_find_package_multi(self): + self.output.info("Testing CMake_find_package_multi") + shutil.copy(os.path.join(self.generators_folder, "qt.conf"), "bin") + self.run(os.path.join("bin", "test_package"), run_environment=True) + + def test(self): + 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/5.x.x/test_v1_package/meson.build b/recipes/qt/5.x.x/test_v1_package/meson.build new file mode 100644 index 0000000000000..cc717d4f23da5 --- /dev/null +++ b/recipes/qt/5.x.x/test_v1_package/meson.build @@ -0,0 +1,6 @@ +project('test_package', 'cpp') +qt5 = import('qt5') +qt5_dep = dependency('qt5', modules: ['Core', 'Network', 'Sql', 'Concurrent', 'Xml']) +moc_files = qt5.preprocess(moc_headers : '../test_package/greeter.h', qresources : '../test_package/example.qrc') +executable('test_package', '../test_package/test_package.cpp', moc_files, + dependencies : qt5_dep) diff --git a/recipes/qt/5.x.x/test_v1_package/test_package.pro b/recipes/qt/5.x.x/test_v1_package/test_package.pro new file mode 100644 index 0000000000000..3b3ce9cba0343 --- /dev/null +++ b/recipes/qt/5.x.x/test_v1_package/test_package.pro @@ -0,0 +1,14 @@ +SOURCES += ../test_package/test_package.cpp + +HEADERS += ../test_package/greeter.h + +RESOURCES = ../test_package/example.qrc + +QT -= gui +QT += network sql concurrent xml + +CONFIG += console + +CONFIG += conan_basic_setup +include($$OUT_PWD/../conanbuildinfo.pri) +LIBS -= $$CONAN_LIBS_QT diff --git a/recipes/qt/6.x.x/conandata.yml b/recipes/qt/6.x.x/conandata.yml index 9e25152cc68fc..13ed2f886559f 100644 --- a/recipes/qt/6.x.x/conandata.yml +++ b/recipes/qt/6.x.x/conandata.yml @@ -1,65 +1,95 @@ sources: - "6.4.1": + "6.7.3": url: - - "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": + - "https://download.qt.io/official_releases/qt/6.7/6.7.3/single/qt-everywhere-src-6.7.3.tar.xz" + - "https://download.qt.io/archive/qt/6.7/6.7.3/single/qt-everywhere-src-6.7.3.tar.xz" + - "https://mirrors.ukfast.co.uk/sites/qt.io/archive/qt/6.7/6.7.3/single/qt-everywhere-src-6.7.3.tar.xz" + - "https://mirrors.20i.com/pub/qt.io/archive/qt/6.7/6.7.3/single/qt-everywhere-src-6.7.3.tar.xz" + - "https://ftp.nluug.nl/languages/qt/archive/qt/6.7/6.7.3/single/qt-everywhere-src-6.7.3.tar.xz" + - "https://mirror.netcologne.de/qtproject/archive/qt/6.7/6.7.3/single/qt-everywhere-src-6.7.3.tar.xz" + - "https://qt-mirror.dannhauer.de/archive/qt/6.7/6.7.3/single/qt-everywhere-src-6.7.3.tar.xz" + - "https://ftp.fau.de/qtproject/archive/qt/6.7/6.7.3/single/qt-everywhere-src-6.7.3.tar.xz" + - "https://mirrors.dotsrc.org/qtproject/archive/qt/6.7/6.7.3/single/qt-everywhere-src-6.7.3.tar.xz" + - "https://ftp.icm.edu.pl/packages/qt/archive/qt/6.7/6.7.3/single/qt-everywhere-src-6.7.3.tar.xz" + - "https://ftp.acc.umu.se/mirror/qt.io/qtproject/archive/qt/6.7/6.7.3/single/qt-everywhere-src-6.7.3.tar.xz" + - "https://www.nic.funet.fi/pub/mirrors/download.qt-project.org/archive/qt/6.7/6.7.3/single/qt-everywhere-src-6.7.3.tar.xz" + - "https://qt.mirror.constant.com/archive/qt/6.7/6.7.3/single/qt-everywhere-src-6.7.3.tar.xz" + - "https://mirrors.sau.edu.cn/qt/archive/qt/6.7/6.7.3/single/qt-everywhere-src-6.7.3.tar.xz" + - "https://mirrors.cloud.tencent.com/qt/archive/qt/6.7/6.7.3/single/qt-everywhere-src-6.7.3.tar.xz" + - "https://mirror.bjtu.edu.cn/qt/archive/qt/6.7/6.7.3/single/qt-everywhere-src-6.7.3.tar.xz" + - "https://mirrors.sjtug.sjtu.edu.cn/qt/archive/qt/6.7/6.7.3/single/qt-everywhere-src-6.7.3.tar.xz" + - "https://ftp.jaist.ac.jp/pub/qtproject/archive/qt/6.7/6.7.3/single/qt-everywhere-src-6.7.3.tar.xz" + - "https://ftp.yz.yamagata-u.ac.jp/pub/qtproject/archive/qt/6.7/6.7.3/single/qt-everywhere-src-6.7.3.tar.xz" + sha256: "a3f1d257cbb14c6536585ffccf7c203ce7017418e1a0c2ed7c316c20c729c801" + "6.6.3": 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": + - "https://download.qt.io/official_releases/qt/6.6/6.6.3/single/qt-everywhere-src-6.6.3.tar.xz" + - "https://download.qt.io/archive/qt/6.6/6.6.3/single/qt-everywhere-src-6.6.3.tar.xz" + - "https://qt.mirror.constant.com/archive/qt/6.6/6.6.3/single/qt-everywhere-src-6.6.3.tar.xz" + - "https://mirrors.ukfast.co.uk/sites/qt.io/archive/qt/6.6/6.6.3/single/qt-everywhere-src-6.6.3.tar.xz" + - "https://mirrors.20i.com/pub/qt.io/archive/qt/6.6/6.6.3/single/qt-everywhere-src-6.6.3.tar.xz" + - "https://ftp.nluug.nl/languages/qt/archive/qt/6.6/6.6.3/single/qt-everywhere-src-6.6.3.tar.xz" + - "https://mirror.netcologne.de/qtproject/archive/qt/6.6/6.6.3/single/qt-everywhere-src-6.6.3.tar.xz" + - "https://qt-mirror.dannhauer.de/archive/qt/6.6/6.6.3/single/qt-everywhere-src-6.6.3.tar.xz" + - "https://ftp.fau.de/qtproject/archive/qt/6.6/6.6.3/single/qt-everywhere-src-6.6.3.tar.xz" + - "https://mirrors.dotsrc.org/qtproject/archive/qt/6.6/6.6.3/single/qt-everywhere-src-6.6.3.tar.xz" + - "https://ftp.icm.edu.pl/packages/qt/archive/qt/6.6/6.6.3/single/qt-everywhere-src-6.6.3.tar.xz" + - "https://ftp.acc.umu.se/mirror/qt.io/qtproject/archive/qt/6.6/6.6.3/single/qt-everywhere-src-6.6.3.tar.xz" + - "https://www.nic.funet.fi/pub/mirrors/download.qt-project.org/archive/qt/6.6/6.6.3/single/qt-everywhere-src-6.6.3.tar.xz" + - "https://qtproject.mirror.liquidtelecom.com/archive/qt/6.6/6.6.3/single/qt-everywhere-src-6.6.3.tar.xz" + - "https://mirrors.sau.edu.cn/qt/archive/qt/6.6/6.6.3/single/qt-everywhere-src-6.6.3.tar.xz" + - "https://mirrors.tuna.tsinghua.edu.cn/qt/archive/qt/6.6/6.6.3/single/qt-everywhere-src-6.6.3.tar.xz" + - "https://mirrors.ustc.edu.cn/qtproject/archive/qt/6.6/6.6.3/single/qt-everywhere-src-6.6.3.tar.xz" + - "https://mirrors.sjtug.sjtu.edu.cn/qt/archive/qt/6.6/6.6.3/single/qt-everywhere-src-6.6.3.tar.xz" + - "https://ftp.jaist.ac.jp/pub/qtproject/archive/qt/6.6/6.6.3/single/qt-everywhere-src-6.6.3.tar.xz" + - "https://ftp.yz.yamagata-u.ac.jp/pub/qtproject/archive/qt/6.6/6.6.3/single/qt-everywhere-src-6.6.3.tar.xz" + sha256: "69d0348fef415da98aa890a34651e9cfb232f1bffcee289b7b4e21386bf36104" + "6.5.3": url: - - "https://download.qt.io/archive/qt/6.2/6.2.4/single/qt-everywhere-src-6.2.4.tar.xz" - - "https://qt-mirror.dannhauer.de/archive/qt/6.2/6.2.4/single/qt-everywhere-src-6.2.4.tar.xz" - - "https://www.funet.fi/pub/mirrors/download.qt-project.org/archive/qt/6.2/6.2.4/single/qt-everywhere-src-6.2.4.tar.xz" - - "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" + - "https://download.qt.io/official_releases/qt/6.5/6.5.3/single/qt-everywhere-src-6.5.3.tar.xz" + - "https://download.qt.io/archive/qt/6.5/6.5.3/single/qt-everywhere-src-6.5.3.tar.xz" + - "https://mirrors.20i.com/pub/qt.io/archive/qt/6.5/6.5.3/single/qt-everywhere-src-6.5.3.tar.xz" + - "https://mirrors.ukfast.co.uk/sites/qt.io/archive/qt/6.5/6.5.3/single/qt-everywhere-src-6.5.3.tar.xz" + - "https://ftp.nluug.nl/languages/qt/archive/qt/6.5/6.5.3/single/qt-everywhere-src-6.5.3.tar.xz" + - "https://mirror.netcologne.de/qtproject/archive/qt/6.5/6.5.3/single/qt-everywhere-src-6.5.3.tar.xz" + - "https://qt-mirror.dannhauer.de/archive/qt/6.5/6.5.3/single/qt-everywhere-src-6.5.3.tar.xz" + - "https://ftp.fau.de/qtproject/archive/qt/6.5/6.5.3/single/qt-everywhere-src-6.5.3.tar.xz" + - "https://mirrors.dotsrc.org/qtproject/archive/qt/6.5/6.5.3/single/qt-everywhere-src-6.5.3.tar.xz" + - "https://ftp.acc.umu.se/mirror/qt.io/qtproject/archive/qt/6.5/6.5.3/single/qt-everywhere-src-6.5.3.tar.xz" + - "https://mirror.web4africa.ng/qt/archive/qt/6.5/6.5.3/single/qt-everywhere-src-6.5.3.tar.xz" + - "https://qtproject.mirror.liquidtelecom.com/archive/qt/6.5/6.5.3/single/qt-everywhere-src-6.5.3.tar.xz" + - "https://qt.mirror.constant.com/archive/qt/6.5/6.5.3/single/qt-everywhere-src-6.5.3.tar.xz" + - "https://mirrors.cloud.tencent.com/qt/archive/qt/6.5/6.5.3/single/qt-everywhere-src-6.5.3.tar.xz" + - "https://mirrors.sjtug.sjtu.edu.cn/qt/archive/qt/6.5/6.5.3/single/qt-everywhere-src-6.5.3.tar.xz" + - "https://ftp.jaist.ac.jp/pub/qtproject/archive/qt/6.5/6.5.3/single/qt-everywhere-src-6.5.3.tar.xz" + - "https://ftp.yz.yamagata-u.ac.jp/pub/qtproject/archive/qt/6.5/6.5.3/single/qt-everywhere-src-6.5.3.tar.xz" + sha256: "7cda4d119aad27a3887329cfc285f2aba5da85601212bcb0aea27bd6b7b544cb" patches: - "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: "qtdeclarative" - patch_file: "patches/32451d5.diff" - - base_path: "qtbase/cmake" - patch_file: "patches/qt6-pri-helpers-fix.diff" - - patch_file: "patches/c72097e.diff" - base_path: "qtwebengine" - - patch_file: "patches/138a720.diff" - base_path: "qtwebengine/src/3rdparty" - - patch_file: "patches/CVE-2022-1096-qtwebengine-6.2.diff" - base_path: "qtwebengine" - - patch_file: "patches/CVE-2022-25255-qprocess6-2.diff" - base_path: "qtbase" - - patch_file: "patches/CVE-2022-25643-6.2.diff" - base_path: "qtbase" - - patch_file: "patches/d13958d_.diff" - base_path: "qtbase" + "6.7.3": + - "base_path": "qtwebengine" + "patch_description": "Workaround for too long .rps file name" + "patch_file": "patches/c72097e_6.6.0.diff" + "patch_source": "https://codereview.qt-project.org/c/yocto/meta-qt5/+/192172" + "patch_type": "bugfix" + "6.6.3": + - "base_path": "qtwebengine" + "patch_description": "Workaround for too long .rps file name" + "patch_file": "patches/c72097e_6.6.0.diff" + "patch_source": "https://codereview.qt-project.org/c/yocto/meta-qt5/+/192172" + "patch_type": "bugfix" + "6.5.3": + - "base_path": "qtwebengine" + "patch_description": "Workaround for too long .rps file name" + "patch_file": "patches/c72097e.diff" + "patch_type": "bugfix" + "patch_source": "https://codereview.qt-project.org/c/yocto/meta-qt5/+/192172" + - "base_path": "qtbase" + "patch_description": "Fix build error with lambda on GCC 9.2" + "patch_file": "patches/32fa63f_6.5.0.patch" + "patch_type": "bugfix" + "patch_source": "https://bugreports.qt.io/browse/QTBUG-112920" + - "base_path": "qtbase" + "patch_description": "Use absolute path in the generated header files to avoid relative path longer than 250 characters (not supported on by msvc compiler)" + "patch_file": "patches/fix-long-path-on-windows_6.5.3.patch" + "patch_type": "bugfix" + "patch_source": "https://code.qt.io/cgit/qt/qtbase.git/commit/?id=b4246a5c28472de3c4b6a85a3daf4a1d578894ab" diff --git a/recipes/qt/6.x.x/conanfile.py b/recipes/qt/6.x.x/conanfile.py index e85efa6366d9e..508b43c683f44 100644 --- a/recipes/qt/6.x.x/conanfile.py +++ b/recipes/qt/6.x.x/conanfile.py @@ -1,74 +1,42 @@ -from contextlib import contextmanager - import configparser import glob import os +import platform import textwrap -from conan import ConanFile +from conan import ConanFile, conan_version from conan.tools.apple import is_apple_os +from conan.tools.build import cross_building, check_min_cppstd, default_cppstd from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout -from conan.tools.build import cross_building, check_min_cppstd, build_jobs -from conan.tools.env import VirtualBuildEnv, Environment -from conan.tools.files import get, replace_in_file, apply_conandata_patches, save, rm, rmdir, export_conandata_patches +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv, 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.52.0" - - -class qt(Generator): - @staticmethod - def content_template(path, folder, os_): - return textwrap.dedent("""\ - [Paths] - Prefix = {0} - ArchData = {1}/archdatadir - HostData = {1}/archdatadir - Data = {1}/datadir - Sysconf = {1}/sysconfdir - LibraryExecutables = {1}/archdatadir/{2} - HostLibraryExecutables = bin - Plugins = {1}/archdatadir/plugins - Imports = {1}/archdatadir/imports - Qml2Imports = {1}/archdatadir/qml - Translations = {1}/datadir/translations - Documentation = {1}/datadir/doc - Examples = {1}/datadir/examples""").format(path, folder, - "bin" if os_ == "Windows" else "libexec") - - @property - def filename(self): - return "qt.conf" +from conan.errors import ConanException, ConanInvalidConfiguration - @property - def content(self): - return qt.content_template( - self.conanfile.deps_cpp_info["qt"].rootpath.replace("\\", "/"), - "res", - self.conanfile.settings.os) +required_conan_version = ">=1.55.0" class QtConan(ConanFile): _submodules = ["qtsvg", "qtdeclarative", "qttools", "qttranslations", "qtdoc", - "qtwayland","qtquickcontrols2", "qtquicktimeline", "qtquick3d", "qtshadertools", "qt5compat", + "qtwayland", "qtquickcontrols2", "qtquicktimeline", "qtquick3d", "qtshadertools", "qt5compat", "qtactiveqt", "qtcharts", "qtdatavis3d", "qtlottie", "qtscxml", "qtvirtualkeyboard", "qt3d", "qtimageformats", "qtnetworkauth", "qtcoap", "qtmqtt", "qtopcua", "qtmultimedia", "qtlocation", "qtsensors", "qtconnectivity", "qtserialbus", "qtserialport", "qtwebsockets", "qtwebchannel", "qtwebengine", "qtwebview", "qtremoteobjects", "qtpositioning", "qtlanguageserver", - "qtspeech", "qthttpserver", "qtquick3dphysics"] + "qtspeech", "qthttpserver", "qtquick3dphysics", "qtgrpc", "qtquickeffectmaker"] + _submodules += ["qtgraphs"] # new modules for qt 6.6.0 + + _module_statuses = ["essential", "addon", "deprecated", "preview"] 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 = { @@ -98,17 +66,20 @@ class QtConan(ConanFile): "with_pulseaudio": [True, False], "with_gssapi": [True, False], "with_md4c": [True, False], + "with_x11": [True, False], + "with_egl": [True, False], "gui": [True, False], "widgets": [True, False], - "device": "ANY", - "cross_compile": "ANY", - "sysroot": "ANY", + "device": [None, "ANY"], + "cross_compile": [None, "ANY"], + "sysroot": [None, "ANY"], "multiconfiguration": [True, False], - "disabled_features": "ANY", + "disabled_features": [None, "ANY"], } options.update({module: [True, False] for module in _submodules}) + options.update({f"{status}_modules": [True, False] for status in _module_statuses}) # this significantly speeds up windows builds no_copy_source = True @@ -140,6 +111,8 @@ class QtConan(ConanFile): "with_pulseaudio": False, "with_gssapi": False, "with_md4c": True, + "with_x11": True, + "with_egl": False, "gui": True, "widgets": True, @@ -150,18 +123,24 @@ class QtConan(ConanFile): "multiconfiguration": False, "disabled_features": "", } - default_options.update({module: False for module in _submodules}) + # essential_modules, addon_modules, deprecated_modules, preview_modules: + # these are only provided for convenience, set to False by default + default_options.update({f"{status}_modules": False for status in _module_statuses}) short_paths = True _submodules_tree = None + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) + @property def _get_module_tree(self): if self._submodules_tree: return self._submodules_tree 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")) self._submodules_tree = {} assert config.sections(), f"no qtmodules.conf file for version {self.version}" for s in config.sections(): @@ -169,23 +148,25 @@ def _get_module_tree(self): assert section.startswith("submodule ") assert section.count('"') == 2 modulename = section[section.find('"') + 1: section.rfind('"')] + if modulename in ["qtbase", "qtqa", "qtrepotools"]: + continue status = str(config.get(section, "status")) if status not in ["obsolete", "ignore", "additionalLibrary"]: + if status not in self._module_statuses: + raise ConanException(f"module {modulename} has status {status} which is not in self._module_statuses {self._module_statuses}") + assert modulename in self._submodules, f"module {modulename} not in self._submodules" self._submodules_tree[modulename] = {"status": status, "path": str(config.get(section, "path")), "depends": []} if config.has_option(section, "depends"): self._submodules_tree[modulename]["depends"] = [str(i) for i in config.get(section, "depends").split()] - for m in self._submodules_tree: - assert m in ["qtbase", "qtqa", "qtrepotools"] or m in self._submodules, "module %s not in self._submodules" % m - return self._submodules_tree def export_sources(self): 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 +174,8 @@ def config_options(self): del self.options.with_fontconfig self.options.with_glib = False del self.options.with_libalsa + del self.options.with_x11 + del self.options.with_egl if self.settings.os == "Windows": self.options.opengl = "dynamic" @@ -200,33 +183,88 @@ def config_options(self): if self.settings.os != "Linux": self.options.qtwayland = False - for m in self._submodules: - if m not in self._get_module_tree: - delattr(self.options, m) + for submodule in self._submodules: + if submodule not in self._get_module_tree: + self._debug_output(f"Qt6: Removing {submodule} option as it is not in the module tree for this version, or is marked as obsolete or ignore") + self.options.rm_safe(submodule) @property def _minimum_compilers_version(self): # Qt6 requires C++17 return { "Visual Studio": "16", + "msvc": "192", "gcc": "8", "clang": "9", - "apple-clang": "11" + "apple-clang": "12" if Version(self.version) >= "6.5.0" else "11" } + def _debug_output(self, message): + if Version(conan_version) >= "2": + self.output.debug(message) + def configure(self): if not self.options.gui: del self.options.opengl del self.options.with_vulkan del self.options.with_freetype - del self.options.with_fontconfig + self.options.rm_safe("with_fontconfig") del self.options.with_harfbuzz del self.options.with_libjpeg del self.options.with_libpng del self.options.with_md4c + self.options.rm_safe("with_x11") + self.options.rm_safe("with_egl") + + if self.options.multiconfiguration: + del self.settings.build_type + + # Requested modules: + # - any module for non-removed options that have 'True' value + # - any enabled via `xxx_modules` that does not have a 'False' value + # Note that at this point, the submodule options dont have a value unless one is given externally + # to the recipe (e.g. via the command line, a profile, or a consumer) + requested_modules = set([module for module in self._submodules if self.options.get_safe(module)]) + for module in [m for m in self._submodules if m in self._get_module_tree]: + status = self._get_module_tree[module]['status'] + is_disabled = self.options.get_safe(module) == False + if self.options.get_safe(f"{status}_modules"): + if not is_disabled: + requested_modules.add(module) + else: + self.output.warning(f"qt6: {module} requested because {status}_modules=True" + f" but it has been explicitly disabled with {module}=False") + + self.output.info(f"qt6: requested modules {list(requested_modules)}") + + required_modules = {} + for module in requested_modules: + deps = self._get_module_tree[module]["depends"] + for dep in deps: + required_modules.setdefault(dep,[]).append(module) + + required_but_disabled = [m for m in required_modules.keys() if self.options.get_safe(m) == False] + if required_modules: + self._debug_output(f"qt6: required_modules modules {list(required_modules.keys())}") + if required_but_disabled: + required_by = set() + for m in required_but_disabled: + required_by.update(required_modules[m]) + raise ConanInvalidConfiguration(f"Modules {required_but_disabled} are explicitly disabled, " + f"but are required by {list(required_by)}, enabled by other options") + + enabled_modules = requested_modules.union(set(required_modules.keys())) + enabled_modules.discard("qtbase") + + for module in list(enabled_modules): + setattr(self.options, module, True) + + for module in self._submodules: + if module in self.options and not self.options.get_safe(module): + setattr(self.options, module, False) if not self.options.get_safe("qtmultimedia"): - del self.options.with_libalsa + self.options.rm_safe("with_libalsa") del self.options.with_openal del self.options.with_gstreamer del self.options.with_pulseaudio @@ -235,43 +273,36 @@ def configure(self): if self.options.get_safe("qtwebengine"): self.options.with_fontconfig = True - if self.options.multiconfiguration: - del self.settings.build_type + for status in self._module_statuses: + # These are convenience only, should not affect package_id + option_name = f"{status}_modules" + self._debug_output(f"qt6 removing convenience option: {option_name}," + f" see individual module options") + self.options.rm_safe(option_name) - def _enablemodule(mod): - if mod != "qtbase": - setattr(self.options, mod, True) - for req in self._get_module_tree[mod]["depends"]: - _enablemodule(req) - - for module in self._get_module_tree: - if self.options.get_safe(module): - _enablemodule(module) + for option in self.options.items(): + self._debug_output(f"qt6 option: {option}") def validate(self): - if os.getenv('NOT_ON_C3I', '0') == '0': + if os.getenv('CONAN_CENTER_BUILD_SERVICE') is not None: 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") + raise ConanInvalidConfiguration("qt is not supported on gcc11 and clang >= 12 on C3I until conan-io/conan-center-index#13472 is fixed") # C++ minimum standard required if self.settings.compiler.get_safe("cppstd"): 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.") + self.output.warning("C++17 support required. Your compiler is unknown. Assuming it supports C++17.") elif Version(self.settings.compiler.version) < minimum_version: raise ConanInvalidConfiguration("C++17 support required, which your compiler does not support.") 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 Version(self.version) >= "6.6.1" and self.settings.compiler == "apple-clang" and Version(self.settings.compiler.version) < "13.1": + raise ConanInvalidConfiguration("apple-clang >= 13.1 is required by qt >= 6.6.1 cf QTBUG-119490") if self.options.get_safe("qtwebengine"): if not self.options.shared: @@ -285,42 +316,6 @@ def validate(self): if hasattr(self, "settings_build") and cross_building(self, skip_x64_x86=True): raise ConanInvalidConfiguration("Cross compiling Qt WebEngine is not supported") - 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") - if not python_exe: - # Fall back on regular python - python_exe = tools.which("python") - - if not python_exe: - msg = ("Python2 must be available in PATH " - "in order to build Qt WebEngine") - raise ConanInvalidConfiguration(msg) - - # 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) - self.run(cmd_v, output=mybuf) - verstr = mybuf.getvalue().strip().split("Python ")[1] - if verstr.endswith("+"): - verstr = verstr[:-1] - version = Version(verstr) - # >= 2.7.5 & < 3 - v_min = "2.7.5" - v_max = "3.0.0" - if v_min <= version < v_max: - msg = ("Found valid Python 2 required for QtWebengine:" - " version={}, path={}".format(mybuf.getvalue(), 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)) - raise ConanInvalidConfiguration(msg) - if self.options.widgets and not self.options.gui: raise ConanInvalidConfiguration("using option qt:widgets without option qt:gui is not possible. " "You can either disable qt:widgets or enable qt:gui") @@ -344,103 +339,123 @@ 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") + if self.options.with_sqlite3 and not self.dependencies["sqlite3"].options.enable_column_metadata: + raise ConanInvalidConfiguration("sqlite3 option enable_column_metadata must be enabled for qt") + + if self.options.get_safe("qtspeech") and not self.options.qtdeclarative: + raise ConanInvalidConfiguration("qtspeech requires qtdeclarative, cf QTBUG-108381") + def layout(self): - cmake_layout(self, src_folder="qt6") + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("zlib/1.2.13") + self.requires("zlib/[>=1.2.11 <2]") if self.options.openssl: - self.requires("openssl/1.1.1s") + self.requires("openssl/[>=1.1 <4]") if self.options.with_pcre2: - self.requires("pcre2/10.40") + self.requires("pcre2/10.42") if self.options.get_safe("with_vulkan"): - self.requires("vulkan-loader/1.3.231.0") + # Note: the versions of vulkan-loader and moltenvk + # must be exactly part of the same Vulkan SDK version + # do not update either without checking both + # require exactly the same version of vulkan-headers + self.requires("vulkan-loader/1.3.239.0") + self.requires("vulkan-headers/1.3.239.0", transitive_headers=True) if is_apple_os(self): - self.requires("moltenvk/1.2.0") + self.requires("moltenvk/1.2.2") if self.options.with_glib: - self.requires("glib/2.75.0") + self.requires("glib/2.78.3") if self.options.with_doubleconversion and not self.options.multiconfiguration: - self.requires("double-conversion/3.2.1") + self.requires("double-conversion/3.3.0") if self.options.get_safe("with_freetype", False) and not self.options.multiconfiguration: - self.requires("freetype/2.12.1") + self.requires("freetype/2.13.2") if self.options.get_safe("with_fontconfig", False): - self.requires("fontconfig/2.13.93") + self.requires("fontconfig/2.15.0") if self.options.get_safe("with_icu", False): - self.requires("icu/72.1") + self.requires("icu/74.2") if self.options.get_safe("with_harfbuzz", False) and not self.options.multiconfiguration: - self.requires("harfbuzz/5.3.1") + self.requires("harfbuzz/8.3.0") 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.4") + self.requires("libjpeg-turbo/[>=3.0 <3.1]") else: self.requires("libjpeg/9e") if self.options.get_safe("with_libpng", False) and not self.options.multiconfiguration: - self.requires("libpng/1.6.39") + self.requires("libpng/[>=1.6 <2]") if self.options.with_sqlite3 and not self.options.multiconfiguration: - self.requires("sqlite3/3.40.0") - self.options["sqlite3"].enable_column_metadata = True + self.requires("sqlite3/[>=3.45.0 <4]") if self.options.get_safe("with_mysql", False): - self.requires("libmysqlclient/8.0.30") + self.requires("libmysqlclient/8.1.0") if self.options.with_pq: - self.requires("libpq/14.5") + self.requires("libpq/15.4") if self.options.with_odbc: if self.settings.os != "Windows": self.requires("odbc/2.3.11") if self.options.get_safe("with_openal", False): - self.requires("openal/1.22.2") + self.requires("openal-soft/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("libalsa/1.2.10") + if self.options.get_safe("with_x11") or self.options.qtwayland: + self.requires("xkbcommon/1.5.0") + if self.options.get_safe("with_x11", False): self.requires("xorg/system") - self.requires("xkbcommon/1.4.1") + if self.options.get_safe("with_egl"): + self.requires("egl/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") + self.requires("zstd/1.5.5") if self.options.qtwayland: - self.requires("wayland/1.21.0") + self.requires("wayland/1.22.0") if self.options.with_brotli: - self.requires("brotli/1.0.9") + self.requires("brotli/1.1.0") if self.options.get_safe("qtwebengine") and self.settings.os == "Linux": - self.requires("expat/2.5.0") - self.requires("opus/1.3.1") + self.requires("expat/[>=2.6.2 <3]") + self.requires("opus/1.4") self.requires("xorg-proto/2022.2") self.requires("libxshmfence/1.3") - self.requires("nss/3.85") - self.requires("libdrm/2.4.109") + self.requires("nss/3.93") + self.requires("libdrm/2.4.119") if self.options.get_safe("with_gstreamer", False): + self.requires("gstreamer/1.19.2") 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.15.2") + self.requires("dbus/1.15.8") 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.25.0") - self.build_requires("ninja/1.11.1") - self.build_requires("pkgconf/1.9.3") + self.tool_requires("cmake/[>=3.21.1 <4]") + self.tool_requires("ninja/[>=1.12 <2]") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/[>=2.2 <3]") if self.settings.os == "Windows": - self.build_requires('strawberryperl/5.32.1.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/18.15.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.8.2") - self.build_requires("flex/2.6.4") + if self._settings_build.os == "Windows": + self.tool_requires("winflexbison/2.5.25") else: - self.build_requires("winflexbison/2.5.24") + self.tool_requires("bison/3.8.2") + self.tool_requires("flex/2.6.4") if self.options.qtwayland: - self.build_requires("wayland/1.21.0") + self.tool_requires("wayland/1.22.0") if cross_building(self): self.tool_requires(f"qt/{self.version}") @@ -449,6 +464,23 @@ def generate(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") + + # override https://github.com/qt/qtbase/blob/dev/cmake/3rdparty/extra-cmake-modules/find-modules/FindEGL.cmake + tc.set_property("egl", "cmake_file_name", "EGL") + tc.set_property("egl", "cmake_find_mode", "module") + tc.set_property("egl::egl", "cmake_target_name", "EGL::EGL") + + # don't override https://github.com/qt/qtmultimedia/blob/dev/cmake/FindGStreamer.cmake + tc.set_property("gstreamer", "cmake_file_name", "gstreamer_conan") + tc.set_property("gstreamer", "cmake_find_mode", "module") + tc.generate() for f in glob.glob("*.cmake"): @@ -459,19 +491,32 @@ def generate(self): pc = PkgConfigDeps(self) pc.generate() + vbe = VirtualBuildEnv(self) + vbe.generate() + if not cross_building(self): + vre = VirtualRunEnv(self) + vre.generate(scope="build") # TODO: to remove when properly handled by conan (see https://github.com/conan-io/conan/issues/11962) env = Environment() + env.unset("VCPKG_ROOT") env.prepend_path("PKG_CONFIG_PATH", self.generators_folder) env.vars(self).save_script("conanbuildenv_pkg_config_path") + if self._settings_build.os == "Macos": + # On macOS, SIP resets DYLD_LIBRARY_PATH injected by VirtualBuildEnv & VirtualRunEnv + dyld_library_path = "$DYLD_LIBRARY_PATH" + dyld_library_path_build = vbe.vars().get("DYLD_LIBRARY_PATH") + if dyld_library_path_build: + dyld_library_path = f"{dyld_library_path_build}:{dyld_library_path}" + if not cross_building(self): + dyld_library_path_host = vre.vars().get("DYLD_LIBRARY_PATH") + if dyld_library_path_host: + dyld_library_path = f"{dyld_library_path_host}:{dyld_library_path}" + save(self, "bash_env", f'export DYLD_LIBRARY_PATH="{dyld_library_path}"') + env.define_path("BASH_ENV", os.path.abspath("bash_env")) 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.absolute_paths = True tc.variables["QT_BUILD_TESTS"] = "OFF" tc.variables["QT_BUILD_EXAMPLES"] = "OFF" @@ -484,8 +529,9 @@ def generate(self): 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[f"BUILD_{module}"] = ("ON" if getattr(self.options, module) else "OFF") + tc.variables["BUILD_qtqa"] = "OFF" + tc.variables["BUILD_qtrepotools"] = "OFF" tc.variables["FEATURE_system_zlib"] = "ON" @@ -496,10 +542,16 @@ def generate(self): tc.variables["INPUT_openssl"] = "no" else: tc.variables["HAVE_openssl"] = "ON" - if self.options["openssl"].shared: + if self.dependencies["openssl"].options.shared: tc.variables["INPUT_openssl"] = "runtime" + tc.variables["QT_FEATURE_openssl_runtime"] = "ON" else: tc.variables["INPUT_openssl"] = "linked" + tc.variables["QT_FEATURE_openssl_linked"] = "ON" + + # 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) if self.options.with_dbus: tc.variables["INPUT_dbus"] = "linked" @@ -507,6 +559,16 @@ def generate(self): tc.variables["FEATURE_dbus"] = "OFF" tc.variables["CMAKE_FIND_DEBUG_MODE"] = "FALSE" + if not self.options.with_zstd: + tc.variables["CMAKE_DISABLE_FIND_PACKAGE_WrapZSTD"] = "ON" + + if not self.options.get_safe("with_vulkan"): + tc.variables["CMAKE_DISABLE_FIND_PACKAGE_WrapVulkanHeaders"] = "ON" + + # Prevent finding LibClang from the system + # this is needed by the QDoc tool inside Qt Tools + # See: https://github.com/conan-io/conan-center-index/issues/24729#issuecomment-2255291495 + tc.variables["CMAKE_DISABLE_FIND_PACKAGE_WrapLibClang"] = "ON" for opt, conf_arg in [("with_glib", "glib"), ("with_icu", "icu"), @@ -519,8 +581,10 @@ def generate(self): ("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") + ("with_gssapi", "gssapi"), + ("with_egl", "egl"), + ("with_gstreamer", "gstreamer")]: + tc.variables[f"FEATURE_{conf_arg}"] = ("ON" if self.options.get_safe(opt, False) else "OFF") for opt, conf_arg in [ @@ -533,12 +597,12 @@ def generate(self): ("with_pcre2", "pcre2"),]: if self.options.get_safe(opt, False): if self.options.multiconfiguration: - tc.variables["FEATURE_%s" % conf_arg] = "ON" + tc.variables[f"FEATURE_{conf_arg}"] = "ON" else: - tc.variables["FEATURE_system_%s" % conf_arg] = "ON" + tc.variables[f"FEATURE_system_{conf_arg}"] = "ON" else: - tc.variables["FEATURE_%s" % conf_arg] = "OFF" - tc.variables["FEATURE_system_%s" % conf_arg] = "OFF" + tc.variables[f"FEATURE_{conf_arg}"] = "OFF" + tc.variables[f"FEATURE_system_{conf_arg}"] = "OFF" for opt, conf_arg in [ ("with_doubleconversion", "doubleconversion"), @@ -550,20 +614,20 @@ def generate(self): ("with_pcre2", "pcre"),]: if self.options.get_safe(opt, False): if self.options.multiconfiguration: - tc.variables["INPUT_%s" % conf_arg] = "qt" + tc.variables[f"INPUT_{conf_arg}"] = "qt" else: - tc.variables["INPUT_%s" % conf_arg] = "system" + tc.variables[f"INPUT_{conf_arg}"] = "system" else: - tc.variables["INPUT_%s" % conf_arg] = "no" + tc.variables[f"INPUT_{conf_arg}"] = "no" for feature in str(self.options.disabled_features).split(): - tc.variables["FEATURE_%s" % feature] = "OFF" + tc.variables[f"FEATURE_{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", + tc.variables["ANDROID_ABI"] = {"armv7": "armeabi-v7a", "armv8": "arm64-v8a", "x86": "x86", "x86_64": "x86_64"}.get(str(self.settings.arch)) @@ -578,60 +642,97 @@ def generate(self): 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)) + self.output.warning(f"host not supported: {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["QT_QMAKE_DEVICE_OPTIONS"] = f"CROSS_COMPILE={self.options.cross_compile}" + if cross_building(self): + tc.variables["QT_HOST_PATH"] = self.dependencies.direct_build["qt"].package_folder 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 + 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 + tc.variables["HOST_PERL"] = self.dependencies.build["strawberryperl"].conf_info.get("user.strawberryperl:perl", check_type=str) #"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 = { + 11: "FEATURE_cxx11", + 14: "FEATURE_cxx14", + 17: "FEATURE_cxx17", + 20: "FEATURE_cxx20" + } + if Version(self.version) >= "6.5.0": + cpp_std_map[23] = "FEATURE_cxx2b" + + for std, feature in cpp_std_map.items(): + tc.variables[feature] = "ON" if int(current_cpp_std) >= std else "OFF" + + tc.variables["QT_USE_VCPKG"] = False + tc.cache_variables["QT_USE_VCPKG"] = False + tc.generate() + def package_id(self): + del self.info.options.cross_compile + del self.info.options.sysroot + if self.info.options.multiconfiguration: + if self.info.settings.compiler == "Visual Studio": + if "MD" in self.info.settings.compiler.runtime: + self.info.settings.compiler.runtime = "MD/MDd" + else: + self.info.settings.compiler.runtime = "MT/MTd" + elif self.info.settings.compiler == "msvc": + self.info.settings.compiler.runtime_type = "Release/Debug" + if self.info.settings.os == "Android": + del self.info.options.android_sdk + def source(self): destination = self.source_folder - if self.settings.os == "Windows": + if platform.system() == "Windows": # Don't use os.path.join, or it removes the \\?\ prefix, which enables long paths - destination = f"\\\\?\\{self.source_folder}" + destination = rf"\\?\{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 - 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")]: - 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) {" - ) - - 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 ["renderer", os.path.join("renderer", "core"), os.path.join("renderer", "platform")]: + 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) {" + ) + for f in ["FindPostgreSQL.cmake"]: file = os.path.join(self.source_folder, "qtbase", "cmake", f) if os.path.isfile(file): os.remove(file) # workaround QTBUG-94356 - 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)", - "") + replace_in_file(self, os.path.join(self.source_folder, "qtbase", "cmake", "FindWrapSystemZLIB.cmake"), '"-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") + replace_in_file(self, + os.path.join(self.source_folder, "qtbase", "cmake", "QtAutoDetect.cmake" if Version(self.version) < "6.6.2" else "QtAutoDetectHelpers.cmake"), + "qt_auto_detect_vcpkg()", + "# qt_auto_detect_vcpkg()") + + # Handle locating moltenvk headers when vulkan is enabled on macOS + replace_in_file(self, os.path.join(self.source_folder, "qtbase", "cmake", "FindWrapVulkanHeaders.cmake"), + "if(APPLE)", "if(APPLE)\n" + " find_package(moltenvk REQUIRED QUIET)\n" + " target_include_directories(WrapVulkanHeaders::WrapVulkanHeaders INTERFACE ${moltenvk_INCLUDE_DIR})" + ) + def _xplatform(self): if self.settings.os == "Linux": if self.settings.compiler == "gcc": @@ -711,7 +812,7 @@ def _xplatform(self): if self.settings.compiler == "sun-cc": if self.settings.arch == "sparc": return "solaris-cc-stlport" if self.settings.compiler.libcxx == "libstlport" else "solaris-cc" - elif self.settings.arch == "sparcv9": + if self.settings.arch == "sparcv9": return "solaris-cc64-stlport" if self.settings.compiler.libcxx == "libstlport" else "solaris-cc64" elif self.settings.compiler == "gcc": return {"sparc": "solaris-g++", @@ -730,40 +831,13 @@ def _xplatform(self): return None - @contextmanager - def _build_context(self): - 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 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, "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 self.settings.os == "Macos": - save(self, ".qmake.stash" , "") - save(self, ".qmake.super" , "") - yield - def build(self): - with self._build_context(): - 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 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() + if self.settings.os == "Macos": + save(self, ".qmake.stash", "") + save(self, ".qmake.super", "") + cmake = CMake(self) + cmake.configure() + cmake.build() @property def _cmake_executables_file(self): @@ -774,16 +848,18 @@ def _cmake_entry_point_file(self): return os.path.join("lib", "cmake", "Qt6Core", "conan_qt_entry_point.cmake") def _cmake_qt6_private_file(self, module): - return os.path.join("lib", "cmake", "Qt6{0}".format(module), "conan_qt_qt6_{0}private.cmake".format(module.lower())) + return os.path.join("lib", "cmake", f"Qt6{module}", f"conan_qt_qt6_{module.lower()}private.cmake") def package(self): - with self._build_context(): - cmake = CMake(self) - cmake.install() - save(self, os.path.join(self.package_folder, "bin", "qt.conf"), qt.content_template("..", "res", self.settings.os)) - self.copy("*LICENSE*", src=self.source_folder, dst="licenses") + if self.settings.os == "Macos": + save(self, ".qmake.stash", "") + save(self, ".qmake.super", "") + cmake = CMake(self) + cmake.install() + copy(self, "*LICENSE*", self.source_folder, os.path.join(self.package_folder, "licenses"), + excludes="qtbase/examples/*") for module in self._get_module_tree: - if module != "qtbase" and not self.options.get_safe(module): + if not getattr(self.options, module): 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"]: @@ -791,22 +867,29 @@ def package(self): 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")) + os.remove(os.path.join(self.package_folder, "libexec" if Version(self.version) >= "6.5.0" and self.settings.os != "Windows" else "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: - rmdir(self, os.path.join(self.package_folder, "lib", "cmake", m)) + if os.path.isfile(os.path.join(self.package_folder, "lib", "cmake", m, f"{m}Macros.cmake")): + continue + if glob.glob(os.path.join(self.package_folder, "lib", "cmake", m, "QtPublic*Helpers.cmake")): + continue + if m.endswith("Tools"): + if os.path.isfile(os.path.join(self.package_folder, "lib", "cmake", m, f"{m[:-5]}Macros.cmake")): + continue + + 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 = 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 + filecontents += f"set(QT_VERSION_MAJOR {ver.major})\n" + filecontents += f"set(QT_VERSION_MINOR {ver.minor})\n" + filecontents += f"set(QT_VERSION_PATCH {ver.patch})\n" + if self.settings.os == "Macos": + filecontents += 'set(__qt_internal_cmake_apple_support_files_path "${CMAKE_CURRENT_LIST_DIR}/../../../lib/cmake/Qt6/macos")\n' targets = ["moc", "rcc", "tracegen", "cmake_automoc_parser", "qlalr", "qmake"] if self.options.with_dbus: targets.extend(["qdbuscpp2xml", "qdbusxml2cpp"]) @@ -814,59 +897,67 @@ def package(self): targets.append("qvkgen") if self.options.widgets: targets.append("uic") + if self._settings_build.os == "Macos" and self.settings.os != "iOS": + targets.extend(["macdeployqt"]) + if self.settings.os == "Windows": + targets.extend(["windeployqt"]) if self.options.qttools: targets.extend(["qhelpgenerator", "qtattributionsscanner"]) - if self.settings.os == "Windows": - targets.extend(["windeployqt"]) targets.extend(["lconvert", "lprodump", "lrelease", "lrelease-pro", "lupdate", "lupdate-pro"]) if self.options.qtshadertools: targets.append("qsb") if self.options.qtdeclarative: targets.extend(["qmltyperegistrar", "qmlcachegen", "qmllint", "qmlimportscanner"]) - targets.extend(["qmlformat", "qml", "qmlprofiler", "qmlpreview", "qmltestrunner"]) + targets.extend(["qmlformat", "qml", "qmlprofiler", "qmlpreview"]) + # Note: consider "qmltestrunner", see https://github.com/conan-io/conan-center-index/issues/24276 if self.options.get_safe("qtremoteobjects"): targets.append("repc") + if self.options.get_safe("qtscxml"): + targets.append("qscxmlc") for target in targets: exe_path = None - for path_ in ["bin/{0}{1}".format(target, extension), - "lib/{0}{1}".format(target, extension)]: + for path_ in [f"bin/{target}{extension}", + f"lib/{target}{extension}", + f"libexec/{target}{extension}"]: if os.path.isfile(os.path.join(self.package_folder, path_)): exe_path = path_ break + else: + assert False, f"Could not find executable {target}{extension} in {self.package_folder}" if not exe_path: - self.output.warn("Could not find path to {0}{1}".format(target, extension)) - filecontents += textwrap.dedent("""\ - if(NOT TARGET ${{QT_CMAKE_EXPORT_NAMESPACE}}::{0}) - add_executable(${{QT_CMAKE_EXPORT_NAMESPACE}}::{0} IMPORTED) - set_target_properties(${{QT_CMAKE_EXPORT_NAMESPACE}}::{0} PROPERTIES IMPORTED_LOCATION ${{CMAKE_CURRENT_LIST_DIR}}/../../../{1}) + self.output.warning(f"Could not find path to {target}{extension}") + filecontents += textwrap.dedent(f"""\ + if(NOT TARGET ${{QT_CMAKE_EXPORT_NAMESPACE}}::{target}) + add_executable(${{QT_CMAKE_EXPORT_NAMESPACE}}::{target} IMPORTED) + set_target_properties(${{QT_CMAKE_EXPORT_NAMESPACE}}::{target} PROPERTIES IMPORTED_LOCATION ${{CMAKE_CURRENT_LIST_DIR}}/../../../{exe_path}) endif() - """.format(target, exe_path)) + """) - 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 {ver.major}) endif() - """ % ver.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_executables_file), filecontents) - def _create_private_module(module, dependencies=[]): - dependencies_string = ';'.join('Qt6::%s' % dependency for dependency in dependencies) - contents = textwrap.dedent("""\ - if(NOT TARGET Qt6::{0}Private) - add_library(Qt6::{0}Private INTERFACE IMPORTED) + def _create_private_module(module, dependencies): + dependencies_string = ';'.join(f"Qt6::{dependency}" for dependency in dependencies) + contents = textwrap.dedent(f"""\ + if(NOT TARGET Qt6::{module}Private) + add_library(Qt6::{module}Private INTERFACE IMPORTED) - set_target_properties(Qt6::{0}Private PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${{CMAKE_CURRENT_LIST_DIR}}/../../../include/Qt{0}/{1};${{CMAKE_CURRENT_LIST_DIR}}/../../../include/Qt{0}/{1}/Qt{0}" - INTERFACE_LINK_LIBRARIES "{2}" + set_target_properties(Qt6::{module}Private PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${{CMAKE_CURRENT_LIST_DIR}}/../../../include/Qt{module}/{self.version};${{CMAKE_CURRENT_LIST_DIR}}/../../../include/Qt{module}/{self.version}/Qt{module}" + INTERFACE_LINK_LIBRARIES "{dependencies_string}" ) - add_library(Qt::{0}Private INTERFACE IMPORTED) - set_target_properties(Qt::{0}Private PROPERTIES - INTERFACE_LINK_LIBRARIES "Qt6::{0}Private" + add_library(Qt::{module}Private INTERFACE IMPORTED) + set_target_properties(Qt::{module}Private PROPERTIES + INTERFACE_LINK_LIBRARIES "Qt6::{module}Private" _qt_is_versionless_target "TRUE" ) - endif()""".format(module, self.version, dependencies_string)) + endif()""") save(self, os.path.join(self.package_folder, self._cmake_qt6_private_file(module)), contents) @@ -880,6 +971,11 @@ def _create_private_module(module, dependencies=[]): if self.options.qtdeclarative: _create_private_module("Qml", ["CorePrivate", "Qml"]) + save(self, os.path.join(self.package_folder, "lib", "cmake", "Qt6Qml", "conan_qt_qt6_policies.cmake"), textwrap.dedent("""\ + set(QT_KNOWN_POLICY_QTP0001 TRUE) + """)) + if self.options.gui and self.options.qtshadertools: + _create_private_module("Quick", ["CorePrivate", "GuiPrivate", "QmlPrivate", "Quick"]) if self.settings.os in ["Windows", "iOS"]: contents = textwrap.dedent("""\ @@ -896,32 +992,16 @@ def _create_private_module(module, dependencies=[]): )""") 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 is_msvc(self): - if self.settings.compiler == "Visual Studio": - if "MD" in self.settings.compiler.runtime: - self.info.settings.compiler.runtime = "MD/MDd" - else: - self.info.settings.compiler.runtime = "MT/MTd" - 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") + self.cpp_info.set_property("pkg_config_name", "qt6") self.cpp_info.names["cmake_find_package"] = "Qt6" self.cpp_info.names["cmake_find_package_multi"] = "Qt6" # consumers will need the QT_PLUGIN_PATH defined in runenv - 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")) + self.runenv_info.define("QT_PLUGIN_PATH", os.path.join(self.package_folder, "plugins")) + self.buildenv_info.define("QT_PLUGIN_PATH", os.path.join(self.package_folder, "plugins")) self.buildenv_info.define("QT_HOST_PATH", self.package_folder) @@ -935,7 +1015,7 @@ def _add_build_module(component, module): libsuffix = "" if self.settings.build_type == "Debug": - if self.settings.os == "Windows": + if is_msvc(self): libsuffix = "d" if is_apple_os(self): libsuffix = "_debug" @@ -951,33 +1031,34 @@ def _get_corrected_reqs(requires): 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", "Qt6::{}".format(module)) + def _create_module(module, requires, has_include_dir=True): + 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"Qt6::{module}") + self.cpp_info.components[componentname].set_property("pkg_config_name", f"Qt6{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 = ["Qt6%s%s" % (libname, libsuffix)] + self.cpp_info.components[componentname].libs = [f"Qt6{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, type, 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", "Qt6::{}".format(pluginname)) + def _create_plugin(pluginname, libname, plugintype, requires): + 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"Qt6::{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: self.cpp_info.components[componentname].libs = [libname + libsuffix] - self.cpp_info.components[componentname].libdirs = [os.path.join("res", "archdatadir", "plugins", type)] + self.cpp_info.components[componentname].libdirs = [os.path.join("plugins", plugintype)] self.cpp_info.components[componentname].includedirs = [] if "Core" not in requires: requires.append("Core") @@ -994,25 +1075,38 @@ def _create_plugin(pluginname, libname, type, requires): core_reqs.append("zstd::zstd") if self.options.with_glib: core_reqs.append("glib::glib") + if self.options.openssl: + core_reqs.append("openssl::openssl") # used by QCryptographicHash _create_module("Core", core_reqs) + pkg_config_vars = [ + "bindir=${prefix}/bin", + "libexecdir=${prefix}/libexec", + "exec_prefix=${prefix}", + ] + self.cpp_info.components["qtCore"].set_property("pkg_config_custom_content", "\n".join(pkg_config_vars)) + + if self.settings.build_type != "Debug": + self.cpp_info.components['qtCore'].defines.append('QT_NO_DEBUG') if self.settings.os == "Windows": - if Version(self.version) >= "6.3.0": - self.cpp_info.components["qtCore"].system_libs.append("authz") + self.cpp_info.components["qtCore"].system_libs.append("authz") if is_msvc(self): - if Version(self.version) >= "6.3.0": - self.cpp_info.components["qtCore"].cxxflags.append("-permissive-") - 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 Version(self.version) >= "6.2.1": - self.cpp_info.components["qtCore"].system_libs.append("runtimeobject") + self.cpp_info.components["qtCore"].cxxflags.append("-permissive-") + self.cpp_info.components["qtCore"].cxxflags.append("-Zc:__cplusplus") + self.cpp_info.components["qtCore"].system_libs.append("synchronization") + 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 Version(self.version) < "6.1.0": - self.cpp_info.components["qtCore"].libs.append("Qt6Core_qobject%s" % libsuffix) + self.cpp_info.components["qtPlatform"].includedirs = [os.path.join("mkspecs", self._xplatform())] + if self.options.with_dbus: + _create_module("DBus", ["dbus::dbus"]) + if self.settings.os == "Windows": + # https://github.com/qt/qtbase/blob/v6.6.1/src/dbus/CMakeLists.txt#L71-L77 + self.cpp_info.components["qtDBus"].system_libs.append("advapi32") + self.cpp_info.components["qtDBus"].system_libs.append("netapi32") + self.cpp_info.components["qtDBus"].system_libs.append("user32") + self.cpp_info.components["qtDBus"].system_libs.append("ws2_32") if self.options.gui: gui_reqs = [] if self.options.with_dbus: @@ -1024,11 +1118,17 @@ 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.options.get_safe("with_egl"): + gui_reqs.append("egl::egl") 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") + gui_reqs.append("vulkan-headers::vulkan-headers") if is_apple_os(self): gui_reqs.append("moltenvk::moltenvk") if self.options.with_harfbuzz: @@ -1042,30 +1142,76 @@ def _create_plugin(pluginname, libname, type, requires): _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"] + # https://github.com/qt/qtbase/blob/v6.6.1/src/gui/CMakeLists.txt#L419-L429 + self.cpp_info.components["qtGui"].system_libs += [ + "advapi32", "gdi32", "ole32", "shell32", "user32", "d3d11", "dxgi", "dxguid" + ] + # https://github.com/qt/qtbase/blob/v6.6.1/src/gui/CMakeLists.txt#L729 + self.cpp_info.components["qtGui"].system_libs.append("d2d1") + # https://github.com/qt/qtbase/blob/v6.6.1/src/gui/CMakeLists.txt#L732-L742 + self.cpp_info.components["qtGui"].system_libs.append("dwrite") + if self.settings.compiler == "gcc": + # https://github.com/qt/qtbase/blob/v6.6.1/src/gui/CMakeLists.txt#L746 + self.cpp_info.components["qtGui"].system_libs.append("uuid") + if Version(self.version) >= "6.6.0": + # https://github.com/qt/qtbase/blob/v6.6.0/src/gui/CMakeLists.txt#L428 + self.cpp_info.components["qtGui"].system_libs.append("d3d12") + if Version(self.version) >= "6.7.0": + # https://github.com/qt/qtbase/blob/v6.7.0-beta1/src/gui/CMakeLists.txt#L430 + self.cpp_info.components["qtGui"].system_libs.append("uxtheme") if self.settings.compiler == "gcc": self.cpp_info.components["qtGui"].system_libs.append("uuid") + # https://github.com/qt/qtbase/blob/v6.6.1/src/plugins/platforms/direct2d/CMakeLists.txt#L60-L82 + self.cpp_info.components["qtGui"].system_libs += [ + "advapi32", "d2d1", "d3d11", "dwmapi", "dwrite", "dxgi", "dxguid", "gdi32", "imm32", "ole32", + "oleaut32", "setupapi", "shell32", "shlwapi", "user32", "version", "winmm", "winspool", + "wtsapi32", "shcore", "comdlg32", "d3d9", "runtimeobject" + ] _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", - "ole32", "oleaut32", "shell32", "shlwapi", "user32", "winmm", "winspool", "wtsapi32"] + # https://github.com/qt/qtbase/commit/65d58e6c41e3c549c89ea4f05a8e467466e79ca3 + if Version(self.version) >= "6.7.0": + _create_plugin("QModernWindowsStylePlugin", "qmodernwindowsstyle", "styles", ["Core", "Gui"]) + else: + _create_plugin("QWindowsVistaStylePlugin", "qwindowsvistastyle", "styles", ["Core", "Gui"]) + # https://github.com/qt/qtbase/blob/v6.6.1/src/plugins/platforms/windows/CMakeLists.txt#L53-L69 + self.cpp_info.components["qtQWindowsIntegrationPlugin"].system_libs += [ + "advapi32", "dwmapi", "gdi32", "imm32", "ole32", "oleaut32", "setupapi", "shell32", "shlwapi", + "user32", "winmm", "winspool", "wtsapi32", "shcore", "comdlg32", "d3d9", "runtimeobject" + ] elif self.settings.os == "Android": _create_plugin("QAndroidIntegrationPlugin", "qtforandroid", "platforms", ["Core", "Gui"]) + # https://github.com/qt/qtbase/blob/v6.6.1/src/plugins/platforms/android/CMakeLists.txt#L68-L70 self.cpp_info.components["qtQAndroidIntegrationPlugin"].system_libs = ["android", "jnigraphics"] - elif self.settings.os == "Macos": - _create_plugin("QCocoaIntegrationPlugin", "qcocoa", "platforms", ["Core", "Gui"]) - self.cpp_info.components["QCocoaIntegrationPlugin"].frameworks = ["AppKit", "Carbon", "CoreServices", "CoreVideo", - "IOKit", "IOSurface", "Metal", "QuartzCore"] - elif self.settings.os in ["iOS", "tvOS"]: - _create_plugin("QIOSIntegrationPlugin", "qios", "platforms", []) - self.cpp_info.components["QIOSIntegrationPlugin"].frameworks = ["AudioToolbox", "Foundation", "Metal", - "QuartzCore", "UIKit"] - elif self.settings.os == "watchOS": - _create_plugin("QMinimalIntegrationPlugin", "qminimal", "platforms", []) + elif is_apple_os(self): + # https://github.com/qt/qtbase/blob/v6.6.1/src/gui/CMakeLists.txt#L388-L394 + self.cpp_info.components["qtGui"].frameworks = ["CoreFoundation", "CoreGraphics", "CoreText", "Foundation", "ImageIO"] + if self.options.get_safe("opengl", "no") != "no": + # https://github.com/qt/qtbase/commit/2ed63e587eefb246dba9e69aa01fdb2abb2def13 + self.cpp_info.components["qtGui"].frameworks.append("AGL") + if self.settings.os == "Macos": + # https://github.com/qt/qtbase/blob/v6.6.1/src/gui/CMakeLists.txt#L362-L370 + self.cpp_info.components["qtGui"].frameworks += ["AppKit", "Carbon"] + _create_plugin("QCocoaIntegrationPlugin", "qcocoa", "platforms", ["Core", "Gui"]) + # https://github.com/qt/qtbase/blob/v6.6.1/src/plugins/platforms/cocoa/CMakeLists.txt#L51-L58 + self.cpp_info.components["QCocoaIntegrationPlugin"].frameworks = [ + "AppKit", "Carbon", "CoreServices", "CoreVideo", "IOKit", "IOSurface", "Metal", "QuartzCore" + ] + elif self.settings.os in ["iOS", "tvOS"]: + _create_plugin("QIOSIntegrationPlugin", "qios", "platforms", []) + # https://github.com/qt/qtbase/blob/v6.6.1/src/plugins/platforms/ios/CMakeLists.txt#L32-L37 + self.cpp_info.components["QIOSIntegrationPlugin"].frameworks = [ + "AudioToolbox", "Foundation", "Metal", "QuartzCore", "UIKit", "CoreGraphics" + ] + if self.settings.os != "tvOS": + # https://github.com/qt/qtbase/blob/v6.6.1/src/plugins/platforms/ios/CMakeLists.txt#L66-L68 + self.cpp_info.components["QIOSIntegrationPlugin"].frameworks += [ + "AssetsLibrary", "UniformTypeIdentifiers", "Photos", + ] + elif self.settings.os == "watchOS": + _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"]) @@ -1084,8 +1230,11 @@ def _create_plugin(pluginname, libname, type, requires): if self.options.with_pq: _create_plugin("QPSQLDriverPlugin", "qsqlpsql", "sqldrivers", ["libpq::libpq"]) if self.options.with_odbc: + _create_plugin("QODBCDriverPlugin", "qsqlodbc", "sqldrivers", []) if self.settings.os != "Windows": - _create_plugin("QODBCDriverPlugin", "qsqlodbc", "sqldrivers", ["odbc::odbc"]) + self.cpp_info.components["QODBCDriverPlugin"].requires.append("odbc::odbc") + else: + self.cpp_info.components["QODBCDriverPlugin"].system_libs.append("odbc32") networkReqs = [] if self.options.openssl: networkReqs.append("openssl::openssl") @@ -1094,27 +1243,30 @@ def _create_plugin(pluginname, libname, type, requires): if self.settings.os in ['Linux', 'FreeBSD'] and self.options.with_gssapi: networkReqs.append("krb5::krb5-gssapi") _create_module("Network", networkReqs) - _create_module("Sql") - _create_module("Test") + _create_module("Sql", []) + _create_module("Test", []) if self.options.widgets: _create_module("Widgets", ["Gui"]) _add_build_module("qtWidgets", self._cmake_qt6_private_file("Widgets")) + if self.settings.os == "Windows": + # https://github.com/qt/qtbase/blob/v6.6.1/src/widgets/CMakeLists.txt#L316-L321 + self.cpp_info.components["qtWidgets"].system_libs += [ + "dwmapi", "shell32", "uxtheme", + ] 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") + _create_module("Concurrent", []) + _create_module("Xml", []) if self.options.qt5compat: - _create_module("Core5Compat") + _create_module("Core5Compat", []) # since https://github.com/qt/qtdeclarative/commit/4fb84137f1c0a49d64b8bef66fef8a4384cc2a68 - qt_quick_enabled = self.options.gui and (Version(self.version) < "6.2.0" or self.options.qtshadertools) + qt_quick_enabled = self.options.gui and self.options.qtshadertools if self.options.qtdeclarative: _create_module("Qml", ["Network"]) @@ -1126,9 +1278,11 @@ def _create_plugin(pluginname, libname, type, requires): self.cpp_info.components["qtQmlImportScanner"].requires = _get_corrected_reqs(["Qml"]) if qt_quick_enabled: _create_module("Quick", ["Gui", "Qml", "QmlModels"]) + _add_build_module("qtQuick", self._cmake_qt6_private_file("Quick")) if self.options.widgets: _create_module("QuickWidgets", ["Gui", "Qml", "Quick", "Widgets"]) _create_module("QuickShapes", ["Gui", "Qml", "Quick"]) + _create_module("QuickTest", ["Test", "Quick"]) _create_module("QmlWorkerScript", ["Qml"]) if self.options.qttools and self.options.gui and self.options.widgets: @@ -1142,22 +1296,23 @@ 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"]) _create_module("Quick3DRuntimeRender", ["Gui", "Quick", "Quick3DAssetImport", "Quick3DUtils", "ShaderTools"]) _create_module("Quick3D", ["Gui", "Qml", "Quick", "Quick3DRuntimeRender"]) - if (self.options.get_safe("qtquickcontrols2") or \ - (self.options.qtdeclarative and Version(self.version) >= "6.2.0")) and qt_quick_enabled: + if (self.options.get_safe("qtquickcontrols2") or self.options.qtdeclarative) 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"]) + _create_plugin("QSvgIconPlugin", "qsvgicon", "iconengines", []) + _create_plugin("QSvgPlugin", "qsvg", "imageformats", []) if self.options.widgets: _create_module("SvgWidgets", ["Gui", "Svg", "Widgets"]) @@ -1178,9 +1333,9 @@ def _create_plugin(pluginname, libname, type, requires): if self.options.get_safe("qtlottie"): _create_module("Bodymovin", ["Gui"]) if self.options.get_safe("qtscxml"): - _create_module("StateMachine") + _create_module("StateMachine", []) _create_module("StateMachineQml", ["StateMachine", "Qml"]) - _create_module("Scxml") + _create_module("Scxml", []) _create_plugin("QScxmlEcmaScriptDataModelPlugin", "qscxmlecmascriptdatamodel", "scxmldatamodel", ["Scxml", "Qml"]) _create_module("ScxmlQml", ["Scxml", "Qml"]) if self.options.get_safe("qtvirtualkeyboard") and qt_quick_enabled: @@ -1231,39 +1386,25 @@ def _create_plugin(pluginname, libname, type, requires): if self.options.get_safe("with_libalsa", False): multimedia_reqs.append("libalsa::libalsa") if self.options.with_openal: - multimedia_reqs.append("openal::openal") + multimedia_reqs.append("openal-soft::openal-soft") if self.options.get_safe("with_pulseaudio", False): multimedia_reqs.append("pulseaudio::pulse") _create_module("Multimedia", multimedia_reqs) _create_module("MultimediaWidgets", ["Multimedia", "Widgets", "Gui"]) if self.options.qtdeclarative and qt_quick_enabled: _create_module("MultimediaQuick", ["Multimedia", "Quick"]) - _create_plugin("QM3uPlaylistPlugin", "qtmultimedia_m3u", "playlistformats", []) if self.options.with_gstreamer: - _create_module("MultimediaGstTools", ["Multimedia", "MultimediaWidgets", "Gui", "gst-plugins-base::gst-plugins-base"]) - _create_plugin("QGstreamerAudioDecoderServicePlugin", "gstaudiodecoder", "mediaservice", []) - _create_plugin("QGstreamerCaptureServicePlugin", "gstmediacapture", "mediaservice", []) - _create_plugin("QGstreamerPlayerServicePlugin", "gstmediaplayer", "mediaservice", []) - if self.settings.os == "Linux": - _create_plugin("CameraBinServicePlugin", "gstcamerabin", "mediaservice", []) - _create_plugin("QAlsaPlugin", "qtaudio_alsa", "audio", []) - if self.settings.os == "Windows": - _create_plugin("AudioCaptureServicePlugin", "qtmedia_audioengine", "mediaservice", []) - _create_plugin("DSServicePlugin", "dsengine", "mediaservice", []) - _create_plugin("QWindowsAudioPlugin", "qtaudio_windows", "audio", []) - if self.settings.os == "Macos": - _create_plugin("AudioCaptureServicePlugin", "qtmedia_audioengine", "mediaservice", []) - _create_plugin("AVFMediaPlayerServicePlugin", "qavfmediaplayer", "mediaservice", []) - _create_plugin("AVFServicePlugin", "qavfcamera", "mediaservice", []) - _create_plugin("CoreAudioPlugin", "qtaudio_coreaudio", "audio", []) - - if self._has_positioning: - _create_module("Positioning") + _create_plugin("QGstreamerMediaPlugin", "gstreamermediaplugin", "multimedia", [ + "gstreamer::gstreamer", + "gst-plugins-base::gst-plugins-base"]) + + if self.options.get_safe("qtpositioning"): + _create_module("Positioning", []) _create_plugin("QGeoPositionInfoSourceFactoryGeoclue2", "qtposition_geoclue2", "position", []) _create_plugin("QGeoPositionInfoSourceFactoryPoll", "qtposition_positionpoll", "position", []) if self.options.get_safe("qtsensors"): - _create_module("Sensors") + _create_module("Sensors", []) _create_plugin("genericSensorPlugin", "qtsensors_generic", "sensors", []) _create_plugin("IIOSensorProxySensorPlugin", "qtsensors_iio-sensor-proxy", "sensors", []) if self.settings.os == "Linux": @@ -1276,10 +1417,10 @@ def _create_plugin(pluginname, libname, type, requires): _create_module("Nfc", []) if self.options.get_safe("qtserialport"): - _create_module("SerialPort") + _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", []) @@ -1294,7 +1435,7 @@ def _create_plugin(pluginname, libname, type, requires): if self.options.get_safe("qtwebengine") and qt_quick_enabled: webenginereqs = ["Gui", "Quick", "WebChannel"] - if self._has_positioning: + if self.options.get_safe("qtpositioning"): webenginereqs.append("Positioning") if self.settings.os == "Linux": webenginereqs.extend(["expat::expat", "opus::libopus", "xorg-proto::xorg-proto", "libxshmfence::libxshmfence", \ @@ -1304,17 +1445,30 @@ def _create_plugin(pluginname, libname, type, requires): _create_module("WebEngineWidgets", ["WebEngineCore", "Quick", "PrintSupport", "Widgets", "Gui", "Network"]) if self.options.get_safe("qtremoteobjects"): - _create_module("RemoteObjects") + _create_module("RemoteObjects", []) if self.options.get_safe("qtwebview"): _create_module("WebView", ["Core", "Gui"]) + if self.options.get_safe("qtspeech"): + _create_module("TextToSpeech", []) + + if self.options.get_safe("qthttpserver"): + http_server_deps = ["Core", "Network"] + if self.options.get_safe("qtwebsockets"): + http_server_deps.append("WebSockets") + _create_module("HttpServer", http_server_deps) + + if self.options.get_safe("qtgrpc"): + _create_module("Protobuf", []) + _create_module("Grpc", ["Core", "Protobuf", "Network"]) + if self.settings.os in ["Windows", "iOS"]: if self.settings.os == "Windows": self.cpp_info.components["qtEntryPointImplementation"].set_property("cmake_target_name", "Qt6::EntryPointImplementation") self.cpp_info.components["qtEntryPointImplementation"].names["cmake_find_package"] = "EntryPointImplementation" self.cpp_info.components["qtEntryPointImplementation"].names["cmake_find_package_multi"] = "EntryPointImplementation" - self.cpp_info.components["qtEntryPointImplementation"].libs = ["Qt6EntryPoint%s" % libsuffix] + self.cpp_info.components["qtEntryPointImplementation"].libs = [f"Qt6EntryPoint{libsuffix}"] self.cpp_info.components["qtEntryPointImplementation"].system_libs = ["shell32"] if self.settings.compiler == "gcc": @@ -1341,43 +1495,100 @@ def _create_plugin(pluginname, libname, type, requires): if not self.options.shared: if self.settings.os == "Windows": - self.cpp_info.components["qtCore"].system_libs.append("version") # qtcore requires "GetFileVersionInfoW" and "VerQueryValueW" which are in "Version.lib" library - self.cpp_info.components["qtCore"].system_libs.append("winmm") # qtcore requires "__imp_timeSetEvent" which is in "Winmm.lib" library - self.cpp_info.components["qtCore"].system_libs.append("netapi32") # qtcore requires "NetApiBufferFree" which is in "Netapi32.lib" library - self.cpp_info.components["qtCore"].system_libs.append("userenv") # qtcore requires "__imp_GetUserProfileDirectoryW " which is in "UserEnv.Lib" library - self.cpp_info.components["qtCore"].system_libs.append("ws2_32") # qtcore requires "WSAStartup " which is in "Ws2_32.Lib" library - self.cpp_info.components["qtNetwork"].system_libs.append("dnsapi") # qtnetwork from qtbase requires "DnsFree" which is in "Dnsapi.lib" library + # https://github.com/qt/qtbase/blob/v6.6.1/src/corelib/CMakeLists.txt#L527-L541 + self.cpp_info.components["qtCore"].system_libs.append("advapi32") + self.cpp_info.components["qtCore"].system_libs.append("authz") + self.cpp_info.components["qtCore"].system_libs.append("kernel32") + self.cpp_info.components["qtCore"].system_libs.append("netapi32") + self.cpp_info.components["qtCore"].system_libs.append("ole32") + self.cpp_info.components["qtCore"].system_libs.append("shell32") + self.cpp_info.components["qtCore"].system_libs.append("user32") + self.cpp_info.components["qtCore"].system_libs.append("uuid") + self.cpp_info.components["qtCore"].system_libs.append("version") + self.cpp_info.components["qtCore"].system_libs.append("winmm") + self.cpp_info.components["qtCore"].system_libs.append("ws2_32") + self.cpp_info.components["qtCore"].system_libs.append("mpr") + self.cpp_info.components["qtCore"].system_libs.append("userenv") + # https://github.com/qt/qtbase/blob/v6.6.1/src/network/CMakeLists.txt#L196-L200 + self.cpp_info.components["qtNetwork"].system_libs.append("advapi32") + self.cpp_info.components["qtNetwork"].system_libs.append("dnsapi") self.cpp_info.components["qtNetwork"].system_libs.append("iphlpapi") - self.cpp_info.components["qtNetwork"].system_libs.extend(["winhttp", "secur32"]) - + self.cpp_info.components["qtNetwork"].system_libs.append("secur32") + self.cpp_info.components["qtNetwork"].system_libs.append("winhttp") + # https://github.com/qt/qtbase/blob/v6.6.1/src/printsupport/CMakeLists.txt#L70-L75 + self.cpp_info.components["qtPrintSupport"].system_libs.append("gdi32") + self.cpp_info.components["qtPrintSupport"].system_libs.append("user32") + self.cpp_info.components["qtPrintSupport"].system_libs.append("comdlg32") + self.cpp_info.components["qtPrintSupport"].system_libs.append("winspool") - 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 is_apple_os(self): + # https://github.com/qt/qtbase/blob/v6.6.1/src/corelib/CMakeLists.txt#L580-L584 + self.cpp_info.components["qtCore"].frameworks.append("CoreFoundation") + self.cpp_info.components["qtCore"].frameworks.append("Foundation") + self.cpp_info.components["qtCore"].frameworks.append("IOKit") + # https://github.com/qt/qtbase/blob/v6.6.1/src/network/CMakeLists.txt#L205-L214 + self.cpp_info.components["qtNetwork"].frameworks.append("CFNetwork") + # https://github.com/qt/qtbase/blob/v6.6.1/src/network/CMakeLists.txt#L216-L221 + # qtcore requires "_OBJC_CLASS_$_NSApplication" and more, which are in "Cocoa" framework + self.cpp_info.components["qtCore"].frameworks.append("Cocoa") + self.cpp_info.components["qtNetwork"].system_libs.append("resolv") if self.options.with_gssapi: + # https://github.com/qt/qtbase/blob/v6.6.1/src/network/CMakeLists.txt#L250C56-L253 self.cpp_info.components["qtNetwork"].frameworks.append("GSS") if self.options.gui and self.options.widgets: + # https://github.com/qt/qtbase/blob/v6.6.1/src/printsupport/CMakeLists.txt#L52-L63 self.cpp_info.components["qtPrintSupport"].system_libs.append("cups") + self.cpp_info.components["qtPrintSupport"].frameworks.append("ApplicationServices") + if self.settings.os == "Macos": + # https://github.com/qt/qtbase/blob/v6.6.1/src/corelib/CMakeLists.txt#L598-L606 + self.cpp_info.components["qtCore"].frameworks.append("AppKit") + self.cpp_info.components["qtCore"].frameworks.append("ApplicationServices") + self.cpp_info.components["qtCore"].frameworks.append("CoreServices") + self.cpp_info.components["qtCore"].frameworks.append("CoreServices") + self.cpp_info.components["qtCore"].frameworks.append("Security") + self.cpp_info.components["qtCore"].frameworks.append("DiskArbitration") + else: + # https://github.com/qt/qtbase/blob/v6.6.1/src/corelib/CMakeLists.txt#L969-L972 + self.cpp_info.components["qtCore"].frameworks.append("MobileCoreServices") + if self.settings.os not in ["iOS", "tvOS"]: + self.cpp_info.components["qtNetwork"].frameworks.append("CoreServices") + self.cpp_info.components["qtNetwork"].frameworks.append("SystemConfiguration") + else: + # https://github.com/qt/qtbase/blob/v6.6.1/src/corelib/CMakeLists.txt#L1074-L1077 + self.cpp_info.components["qtCore"].frameworks.append("UIKit") + if self.settings.os == "watchOS": + # https://github.com/qt/qtbase/blob/v6.6.1/src/corelib/CMakeLists.txt#L1079-L1082 + self.cpp_info.components["qtCore"].frameworks.append("WatchKit") - self.cpp_info.components["qtCore"].builddirs.append(os.path.join("res","archdatadir","bin")) + self.cpp_info.components["qtCore"].builddirs.append(os.path.join("bin")) _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"]: _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) component_name = m.replace("Qt6", "qt") if component_name == "qt": component_name = "qtCore" - if os.path.isfile(module): - _add_build_module(component_name, module) - 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)) + if component_name in self.cpp_info.components: + module = os.path.join("lib", "cmake", m, f"{m}Macros.cmake") + if os.path.isfile(module): + _add_build_module(component_name, module) + + module = os.path.join("lib", "cmake", m, f"{m}ConfigExtras.cmake") + if os.path.isfile(module): + _add_build_module(component_name, module) + + 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)) + + elif component_name.endswith("Tools") and component_name[:-5] in self.cpp_info.components: + module = os.path.join("lib", "cmake", f"{m}", f"{m[:-5]}Macros.cmake") + if os.path.isfile(module): + _add_build_module(component_name[:-5], module) + self.cpp_info.components[component_name[:-5]].builddirs.append(os.path.join("lib", "cmake", m)) objects_dirs = glob.glob(os.path.join(self.package_folder, "lib", "objects-*/")) for object_dir in objects_dirs: @@ -1385,15 +1596,16 @@ def _create_plugin(pluginname, libname, type, requires): component = "qt" + m[:m.find("_")] if component not in self.cpp_info.components: continue - submodules_dir = os.path.join(object_dir, m) - for sub_dir in os.listdir(submodules_dir): - submodule_dir = os.path.join(submodules_dir, sub_dir) - obj_files = [os.path.join(submodule_dir, file) for file in os.listdir(submodule_dir)] + for root, _, files in os.walk(os.path.join(object_dir, m)): + obj_files = [os.path.join(root, file) for file in files] self.cpp_info.components[component].exelinkflags.extend(obj_files) self.cpp_info.components[component].sharedlinkflags.extend(obj_files) build_modules_list = [] + if self.options.qtdeclarative: + build_modules_list.append(os.path.join(self.package_folder, "lib", "cmake", "Qt6Qml", "conan_qt_qt6_policies.cmake")) + def _add_build_modules_for_component(component): for req in self.cpp_info.components[component].requires: if "::" in req: # not a qt component diff --git a/recipes/qt/6.x.x/patches/138a720.diff b/recipes/qt/6.x.x/patches/138a720.diff deleted file mode 100644 index 0d48b6636dade..0000000000000 --- a/recipes/qt/6.x.x/patches/138a720.diff +++ /dev/null @@ -1,21 +0,0 @@ -From 138a7203f16cf356e9d4dac697920a22437014b0 Mon Sep 17 00:00:00 2001 -From: Peter Varga -Date: Fri, 13 Nov 2020 11:09:23 +0100 -Subject: [PATCH] Fix build with msvc2019 16.8.0 - -Fixes: QTBUG-88708 -Change-Id: I3554ceec0437801b4861f68edd504d01fc01cf93 -Reviewed-by: Allan Sandfeld Jensen ---- - -diff --git a/chromium/third_party/blink/renderer/platform/graphics/dark_mode_lab_color_space.h b/chromium/third_party/blink/renderer/platform/graphics/dark_mode_lab_color_space.h -index 78c316e..136c796 100644 ---- a/chromium/third_party/blink/renderer/platform/graphics/dark_mode_lab_color_space.h -+++ b/chromium/third_party/blink/renderer/platform/graphics/dark_mode_lab_color_space.h -@@ -145,5 +145,5 @@ - // https://en.wikipedia.org/wiki/CIELAB_color_space#Forward_transformation. - SkV3 ToXYZ(const SkV3& lab) const { - auto invf = [](float x) -> float { -- 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); - }; diff --git a/recipes/qt/6.x.x/patches/311d29d.patch b/recipes/qt/6.x.x/patches/311d29d.patch deleted file mode 100644 index 600bcca81e265..0000000000000 --- a/recipes/qt/6.x.x/patches/311d29d.patch +++ /dev/null @@ -1,30 +0,0 @@ -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/32451d5.diff b/recipes/qt/6.x.x/patches/32451d5.diff deleted file mode 100644 index f9388cbc4f1b8..0000000000000 --- a/recipes/qt/6.x.x/patches/32451d5.diff +++ /dev/null @@ -1,32 +0,0 @@ -From 32451d5c9126921180aad4bf78ec6af5eb27ec2a Mon Sep 17 00:00:00 2001 -From: Ulf Hermann -Date: Tue, 13 Jul 2021 11:05:51 +0200 -Subject: [PATCH] Directly include Unicode.h in YarrCanonicalize.h - -The redirection via utypes.h can be problematic if you have another -utypes.h around in a prominent place. It's easily avoided, though. - -Fixes: QTBUG-77528 -Change-Id: I50368f56b0d7eb957955900a32dbb625a38d02af ---- - -diff --git a/src/3rdparty/masm/stubs/wtf/unicode/utypes.h b/src/3rdparty/masm/stubs/wtf/unicode/utypes.h -deleted file mode 100644 -index e1b4ff9..0000000 ---- a/src/3rdparty/masm/stubs/wtf/unicode/utypes.h -+++ /dev/null -@@ -1 +0,0 @@ --#include -diff --git a/src/3rdparty/masm/yarr/YarrCanonicalize.h b/src/3rdparty/masm/yarr/YarrCanonicalize.h -index cbd279e..17c9831 100644 ---- a/src/3rdparty/masm/yarr/YarrCanonicalize.h -+++ b/src/3rdparty/masm/yarr/YarrCanonicalize.h -@@ -26,7 +26,7 @@ - #pragma once - - #include --#include -+#include - - namespace JSC { namespace Yarr { - diff --git a/recipes/qt/6.x.x/patches/32fa63f.patch b/recipes/qt/6.x.x/patches/32fa63f.patch new file mode 100644 index 0000000000000..733b0c131f1f5 --- /dev/null +++ b/recipes/qt/6.x.x/patches/32fa63f.patch @@ -0,0 +1,28 @@ +From b404930e122013e76ba8fe165f3432288c051438 Mon Sep 17 00:00:00 2001 +From: shjiu +Date: Fri, 17 Nov 2023 09:41:31 +0900 +Subject: [PATCH] Fix build error with lambda on GCC 9.2 + +This patch is specific to the return type of updatePtrSimd function as boolean to avoid the bug of GCC 9.2. + +Fixes: QTBUG-112920 +Pick-to: 6.7 6.6 6.5 +Change-Id: I21cb1f6dda34448b2290ab72ec280b6b2a3732c9 +Reviewed-by: Volker Hilsheimer +--- + src/corelib/text/qstring.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp +index 2dc415584f3..d9e89f8e5bb 100644 +--- a/src/corelib/text/qstring.cpp ++++ b/src/corelib/text/qstring.cpp +@@ -471,7 +471,7 @@ static bool simdTestMask(const char *&ptr, const char *end, quint32 maskval) + if constexpr (UseSse4_1) { + # ifndef Q_OS_QNX // compiler fails in the code below + __m128i mask; +- auto updatePtrSimd = [&](__m128i data) { ++ auto updatePtrSimd = [&](__m128i data) -> bool { + __m128i masked = _mm_and_si128(mask, data); + __m128i comparison = _mm_cmpeq_epi16(masked, _mm_setzero_si128()); + uint result = _mm_movemask_epi8(comparison); diff --git a/recipes/qt/6.x.x/patches/32fa63f_6.5.0.patch b/recipes/qt/6.x.x/patches/32fa63f_6.5.0.patch new file mode 100644 index 0000000000000..3675cf9dd16d7 --- /dev/null +++ b/recipes/qt/6.x.x/patches/32fa63f_6.5.0.patch @@ -0,0 +1,28 @@ +From b404930e122013e76ba8fe165f3432288c051438 Mon Sep 17 00:00:00 2001 +From: shjiu +Date: Fri, 17 Nov 2023 09:41:31 +0900 +Subject: [PATCH] Fix build error with lambda on GCC 9.2 + +This patch is specific to the return type of updatePtrSimd function as boolean to avoid the bug of GCC 9.2. + +Fixes: QTBUG-112920 +Pick-to: 6.7 6.6 6.5 +Change-Id: I21cb1f6dda34448b2290ab72ec280b6b2a3732c9 +Reviewed-by: Volker Hilsheimer +--- + src/corelib/text/qstring.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp +index 2dc415584f3..d9e89f8e5bb 100644 +--- a/src/corelib/text/qstring.cpp ++++ b/src/corelib/text/qstring.cpp +@@ -461,7 +461,7 @@ static bool simdTestMask(const char *&ptr, const char *end, quint32 maskval) + if constexpr (UseSse4_1) { + # ifndef Q_OS_QNX // compiler fails in the code below + __m128i mask; +- auto updatePtrSimd = [&](__m128i data) { ++ auto updatePtrSimd = [&](__m128i data) -> bool { + __m128i masked = _mm_and_si128(mask, data); + __m128i comparison = _mm_cmpeq_epi16(masked, _mm_setzero_si128()); + uint result = _mm_movemask_epi8(comparison); diff --git a/recipes/qt/6.x.x/patches/3801bba82.patch b/recipes/qt/6.x.x/patches/3801bba82.patch deleted file mode 100644 index 79b347ce90a23..0000000000000 --- a/recipes/qt/6.x.x/patches/3801bba82.patch +++ /dev/null @@ -1,27 +0,0 @@ -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/5fe0b82.patch b/recipes/qt/6.x.x/patches/5fe0b82.patch deleted file mode 100644 index ae2f8aae34ea9..0000000000000 --- a/recipes/qt/6.x.x/patches/5fe0b82.patch +++ /dev/null @@ -1,23 +0,0 @@ -From bb01af1c36cebd08d407c9a06e5a3c906bd9a660 Mon Sep 17 00:00:00 2001 -From: Mark Jan van Kampen -Date: Wed, 27 Oct 2021 06:49:11 +0200 -Subject: [PATCH] Adds missing includes to utf8_strings.h - ---- - include/litehtml/utf8_strings.h | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/include/litehtml/utf8_strings.h b/include/litehtml/utf8_strings.h -index c5b2421..35d474f 100644 ---- a/include/litehtml/utf8_strings.h -+++ b/include/litehtml/utf8_strings.h -@@ -1,6 +1,9 @@ - #ifndef LH_UTF8_STRINGS_H - #define LH_UTF8_STRINGS_H - -+#include "os_types.h" -+#include "types.h" -+ - namespace litehtml - { - class utf8_to_wchar diff --git a/recipes/qt/6.x.x/patches/CVE-2022-1096-qtwebengine-6.2.diff b/recipes/qt/6.x.x/patches/CVE-2022-1096-qtwebengine-6.2.diff deleted file mode 100644 index 157d0781d4702..0000000000000 --- a/recipes/qt/6.x.x/patches/CVE-2022-1096-qtwebengine-6.2.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 -@@ -2513,6 +2513,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); -@@ -2533,10 +2539,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/CVE-2022-25255-qprocess6-2.diff b/recipes/qt/6.x.x/patches/CVE-2022-25255-qprocess6-2.diff deleted file mode 100644 index 3a566b1b64daa..0000000000000 --- a/recipes/qt/6.x.x/patches/CVE-2022-25255-qprocess6-2.diff +++ /dev/null @@ -1,25 +0,0 @@ ---- a/src/corelib/io/qprocess_unix.cpp -+++ b/src/corelib/io/qprocess_unix.cpp -@@ -1,7 +1,7 @@ - /**************************************************************************** - ** - ** Copyright (C) 2020 The Qt Company Ltd. --** Copyright (C) 2021 Intel Corporation. -+** Copyright (C) 2022 Intel Corporation. - ** Copyright (C) 2021 Alex Trotsenko. - ** Contact: https://www.qt.io/licensing/ - ** -@@ -437,9 +437,10 @@ static QString resolveExecutable(const QString &program) - #endif - - if (!program.contains(QLatin1Char('/'))) { -- QString exeFilePath = QStandardPaths::findExecutable(program); -- if (!exeFilePath.isEmpty()) -- return exeFilePath; -+ // findExecutable() returns its argument if it's an absolute path, -+ // otherwise it searches $PATH; returns empty if not found (we handle -+ // that case much later) -+ return QStandardPaths::findExecutable(program); - } - return program; - } diff --git a/recipes/qt/6.x.x/patches/CVE-2022-25643-6.2.diff b/recipes/qt/6.x.x/patches/CVE-2022-25643-6.2.diff deleted file mode 100644 index c71c32e4002b3..0000000000000 --- a/recipes/qt/6.x.x/patches/CVE-2022-25643-6.2.diff +++ /dev/null @@ -1,73 +0,0 @@ -diff --git a/src/plugins/platforms/windows/qwindowsglcontext.cpp b/src/plugins/platforms/windows/qwindowsglcontext.cpp -index 1a7be0d271..9a8506d971 100644 ---- a/src/plugins/platforms/windows/qwindowsglcontext.cpp -+++ b/src/plugins/platforms/windows/qwindowsglcontext.cpp -@@ -47,7 +47,7 @@ - #include - #include - #include -- -+#include - #include - - #include -@@ -162,19 +162,25 @@ QFunctionPointer QWindowsOpengl32DLL::resolve(const char *name) - - bool QWindowsOpengl32DLL::init(bool softwareRendering) - { -- const QByteArray opengl32 = QByteArrayLiteral("opengl32.dll"); -- const QByteArray swopengl = QByteArrayLiteral("opengl32sw.dll"); -+ const QByteArray opengl32 = QByteArrayLiteral("opengl32"); -+ const QByteArray swopengl = QByteArrayLiteral("opengl32sw"); -+ bool useSystemLib = false; - - QByteArray openglDll = qgetenv("QT_OPENGL_DLL"); -- if (openglDll.isEmpty()) -+ if (openglDll.isEmpty()) { - openglDll = softwareRendering ? swopengl : opengl32; -+ useSystemLib = !softwareRendering; -+ } - - openglDll = openglDll.toLower(); - m_nonOpengl32 = openglDll != opengl32; - - qCDebug(lcQpaGl) << "Qt: Using WGL and OpenGL from" << openglDll; - -- m_lib = ::LoadLibraryA(openglDll.constData()); -+ if (useSystemLib) -+ m_lib = QSystemLibrary::load((wchar_t*)(QString::fromLatin1(openglDll).utf16())); -+ else -+ m_lib = LoadLibraryA(openglDll.constData()); - if (!m_lib) { - qErrnoWarning(::GetLastError(), "Failed to load %s", openglDll.constData()); - return false; -@@ -184,7 +190,7 @@ bool QWindowsOpengl32DLL::init(bool softwareRendering) - // Load opengl32.dll always. GDI functions like ChoosePixelFormat do - // GetModuleHandle for opengl32.dll and behave differently (and call back into - // opengl32) when the module is present. This is fine for dummy contexts and windows. -- ::LoadLibraryA("opengl32.dll"); -+ QSystemLibrary::load(L"opengl32"); - } - - wglCreateContext = reinterpret_cast(resolve("wglCreateContext")); -diff --git a/src/plugins/platforms/windows/qwindowsopengltester.cpp b/src/plugins/platforms/windows/qwindowsopengltester.cpp -index 0b1af47a65..1757b6a0dc 100644 ---- a/src/plugins/platforms/windows/qwindowsopengltester.cpp -+++ b/src/plugins/platforms/windows/qwindowsopengltester.cpp -@@ -49,6 +49,7 @@ - #include - #include - #include -+#include - - #ifndef QT_NO_OPENGL - #include -@@ -358,7 +359,7 @@ bool QWindowsOpenGLTester::testDesktopGL() - - // Test #1: Load opengl32.dll and try to resolve an OpenGL 2 function. - // This will typically fail on systems that do not have a real OpenGL driver. -- lib = LoadLibraryA("opengl32.dll"); -+ lib = QSystemLibrary::load(L"opengl32"); - if (lib) { - CreateContext = reinterpret_cast( - reinterpret_cast(::GetProcAddress(lib, "wglCreateContext"))); diff --git a/recipes/qt/6.x.x/patches/c72097e_6.6.0.diff b/recipes/qt/6.x.x/patches/c72097e_6.6.0.diff new file mode 100644 index 0000000000000..968f4abf220b6 --- /dev/null +++ b/recipes/qt/6.x.x/patches/c72097e_6.6.0.diff @@ -0,0 +1,42 @@ +From c72097e8790553771daf3231124c3fbe1a438379 Mon Sep 17 00:00:00 2001 +From: Samuli Piippo +Date: Thu, 30 Mar 2017 11:37:24 +0300 +Subject: [PATCH] chromium: workaround for too long .rps file name + +Ninja may fail when the build directory is too long: + +ninja: error: WriteFile(__third_party_WebKit_Source_bindings_modules_\ +interfaces_info_individual_modules__home_qt_work_build_build-nitrogen\ +6x_tmp_work_cortexa9hf-neon-mx6qdl-poky-linux-gnueabi_qtwebengine_5.9\ +.0_gitAUTOINC_29afdb0a34_049134677a-r0_build_src_toolchain_target__ru\ +le.rsp): Unable to create file. File name too long + +Task-number: QTBUG-59769 +Change-Id: I73c5e64ae5174412be2a675e35b0b6047f2bf4c1 +--- + src/3rdparty/gn/src/gn/ninja_action_target_writer.cc | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/src/3rdparty/gn/src/gn/ninja_action_target_writer.cc b/src/3rdparty/gn/src/gn/ninja_action_target_writer.cc +index a5bc6cd..5cefbfe 100644 +--- a/src/3rdparty/gn/src/gn/ninja_action_target_writer.cc ++++ b/src/3rdparty/gn/tosrcols/gn/ninja_action_target_writer.cc +@@ -125,9 +125,18 @@ std::string NinjaActionTargetWriter::WriteRuleDefinition() { + // strictly necessary for regular one-shot actions, but it's easier to + // just always define unique_name. + std::string rspfile = custom_rule_name; ++ ++ //quick workaround if filename length > 255 - ".rsp", just cut the dirs starting from the end ++ //please note ".$unique_name" is not used at the moment ++ int pos = 0; ++ std::string delimiter("_"); ++ while (rspfile.length() > 250 && (pos = rspfile.find_last_of(delimiter)) != std::string::npos) ++ rspfile = rspfile.substr(0,pos); ++ + if (!target_->sources().empty()) + rspfile += ".$unique_name"; + rspfile += ".rsp"; ++ + out_ << " rspfile = " << rspfile << std::endl; + + // Response file contents. diff --git a/recipes/qt/6.x.x/patches/c76d2f6.patch b/recipes/qt/6.x.x/patches/c76d2f6.patch deleted file mode 100644 index 8c701061dd5d0..0000000000000 --- a/recipes/qt/6.x.x/patches/c76d2f6.patch +++ /dev/null @@ -1,70 +0,0 @@ -From c76d2f6e997d84d81b0b22e0bd3afdaf7acfe3b3 Mon Sep 17 00:00:00 2001 -From: Allan Sandfeld Jensen -Date: Wed, 13 Oct 2021 12:36:02 +0200 -Subject: [PATCH] Fix build with Win10 21H1 SDK and Win11 SDK - -Different parts are not fully defined - -Task-number: QTBUG-96533 -Change-Id: I4fcb795cea33c519ee082aa69a63660e581a2759 -Reviewed-by: Allan Sandfeld Jensen ---- - chromium/media/gpu/windows/d3d11_av1_accelerator.cc | 2 ++ - chromium/sandbox/win/src/process_mitigations.h | 13 +++++++++---- - 2 files changed, 11 insertions(+), 4 deletions(-) - -diff --git a/chromium/media/gpu/windows/d3d11_av1_accelerator.cc b/chromium/media/gpu/windows/d3d11_av1_accelerator.cc -index 8d2d808ed2a..a4d3a79d7c5 100644 ---- a/chromium/media/gpu/windows/d3d11_av1_accelerator.cc -+++ b/chromium/media/gpu/windows/d3d11_av1_accelerator.cc -@@ -15,6 +15,7 @@ - #include "media/gpu/codec_picture.h" - #include "media/gpu/windows/d3d11_picture_buffer.h" - -+#if !defined(NTDDI_WIN10_FE) // Windows 10.0.20348.0 - // These are from in a newer SDK than the one Chrome ships with. They - // should be deleted once Chrome switches to the updated SDK; they have been - // copied from: https://www.microsoft.com/en-us/download/details.aspx?id=101577 -@@ -279,6 +280,7 @@ typedef struct _DXVA_Tile_AV1 { - UCHAR Reserved8Bits; - } DXVA_Tile_AV1, *LPDXVA_Tile_AV1; - #pragma pack(pop) -+#endif // !defined(NTDDI_WIN10_FE) - - namespace media { - -diff --git a/chromium/sandbox/win/src/process_mitigations.h b/chromium/sandbox/win/src/process_mitigations.h -index 3b511fe2bd9..72b314c335e 100644 ---- a/chromium/sandbox/win/src/process_mitigations.h -+++ b/chromium/sandbox/win/src/process_mitigations.h -@@ -12,21 +12,26 @@ - #include "sandbox/win/src/security_level.h" - - // This will be defined in an upcoming Windows SDK release --#ifndef COMPONENT_KTM -+#ifndef PROC_THREAD_ATTRIBUTE_MACHINE_TYPE - -+#ifndef COMPONENT_KTM - #define COMPONENT_KTM 0x01 - #define COMPONENT_VALID_FLAGS (COMPONENT_KTM) --#define ProcThreadAttributeComponentFilter 26 - - typedef struct _COMPONENT_FILTER { - ULONG ComponentFlags; - } COMPONENT_FILTER, *PCOMPONENT_FILTER; -+#endif // COMPONENT_KTM - -+#define ProcThreadAttributeComponentFilter 26 -+#endif // PROC_THREAD_ATTRIBUTE_MACHINE_TYPE -+ -+// This seems to remain undefined in newer SDKs -+#ifndef PROC_THREAD_ATTRIBUTE_COMPONENT_FILTER - #define PROC_THREAD_ATTRIBUTE_COMPONENT_FILTER \ - ProcThreadAttributeValue(ProcThreadAttributeComponentFilter, FALSE, TRUE, \ - FALSE) -- --#endif // COMPONENT_KTM -+#endif - - namespace sandbox { - diff --git a/recipes/qt/6.x.x/patches/d13958d_.diff b/recipes/qt/6.x.x/patches/d13958d_.diff deleted file mode 100644 index 2e9d40bd0efc0..0000000000000 --- a/recipes/qt/6.x.x/patches/d13958d_.diff +++ /dev/null @@ -1,23 +0,0 @@ -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/patches/dece6f5.patch b/recipes/qt/6.x.x/patches/dece6f5.patch deleted file mode 100644 index 16a69952d4016..0000000000000 --- a/recipes/qt/6.x.x/patches/dece6f5.patch +++ /dev/null @@ -1,25 +0,0 @@ -From dece6f5840463ae2ddf927d65eb1b3680e34a547 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?=C3=98ystein=20Heskestad?= -Date: Wed, 27 Oct 2021 13:07:46 +0200 -Subject: Add missing macOS header file that was indirectly included before - -Change-Id: I4d4c7d4f957fc36dea5e06eb6d661aeecf6385f1 -Reviewed-by: Timur Pocheptsov ---- - src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.h | 1 + - 1 file changed, 1 insertion(+) - -(limited to 'src/plugins/platforms/cocoa') - -diff --git a/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.h b/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.h -index 5d4b6d6a71..cc7193d8b7 100644 ---- a/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.h -+++ b/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.h -@@ -43,6 +43,7 @@ - #include - #include - -+#include - #include - - QT_BEGIN_NAMESPACE diff --git a/recipes/qt/6.x.x/patches/fix-long-path-on-windows_6.5.3.patch b/recipes/qt/6.x.x/patches/fix-long-path-on-windows_6.5.3.patch new file mode 100644 index 0000000000000..2b9a861e60903 --- /dev/null +++ b/recipes/qt/6.x.x/patches/fix-long-path-on-windows_6.5.3.patch @@ -0,0 +1,16 @@ +--- a/src/tools/syncqt/main.cpp ++++ b/src/tools/syncqt/main.cpp +@@ -851,12 +851,7 @@ + + bool headerFileExists = std::filesystem::exists(headerFile); + +- std::filesystem::path headerFileRootName = +- std::filesystem::weakly_canonical(headerFile, ec).root_name(); +- std::string aliasedFilepath = !ec && headerFileRootName == m_outputRootName +- ? std::filesystem::relative(headerFile, outputDir).generic_string() +- : headerFile.generic_string(); +- ec.clear(); ++ std::string aliasedFilepath = headerFile.generic_string(); + + std::string aliasPath = outputDir + '/' + m_currentFilename; + diff --git a/recipes/qt/6.x.x/patches/fix-long-path-on-windows_6.6.0.patch b/recipes/qt/6.x.x/patches/fix-long-path-on-windows_6.6.0.patch new file mode 100644 index 0000000000000..2dd2a1e5feed3 --- /dev/null +++ b/recipes/qt/6.x.x/patches/fix-long-path-on-windows_6.6.0.patch @@ -0,0 +1,16 @@ +--- a/src/tools/syncqt/main.cpp ++++ b/src/tools/syncqt/main.cpp +@@ -875,12 +875,7 @@ + + bool headerFileExists = std::filesystem::exists(headerFile); + +- std::filesystem::path headerFileRootName = +- std::filesystem::weakly_canonical(headerFile, ec).root_name(); +- std::string aliasedFilepath = !ec && headerFileRootName == m_outputRootName +- ? std::filesystem::relative(headerFile, outputDir).generic_string() +- : headerFile.generic_string(); +- ec.clear(); ++ std::string aliasedFilepath = headerFile.generic_string(); + + std::string aliasPath = outputDir + '/' + m_currentFilename; + diff --git a/recipes/qt/6.x.x/patches/fix-long-path-on-windows_6.6.1.patch b/recipes/qt/6.x.x/patches/fix-long-path-on-windows_6.6.1.patch new file mode 100644 index 0000000000000..67967d9240077 --- /dev/null +++ b/recipes/qt/6.x.x/patches/fix-long-path-on-windows_6.6.1.patch @@ -0,0 +1,16 @@ +--- a/src/tools/syncqt/main.cpp ++++ b/src/tools/syncqt/main.cpp +@@ -866,12 +866,7 @@ + + bool headerFileExists = std::filesystem::exists(headerFile); + +- std::filesystem::path headerFileRootName = +- std::filesystem::weakly_canonical(headerFile, ec).root_name(); +- std::string aliasedFilepath = !ec && headerFileRootName == m_outputRootName +- ? std::filesystem::relative(headerFile, outputDir).generic_string() +- : headerFile.generic_string(); +- ec.clear(); ++ std::string aliasedFilepath = headerFile.generic_string(); + + std::string aliasPath = outputDir + '/' + m_currentFilename; + diff --git a/recipes/qt/6.x.x/patches/fix_cmake3.28.patch b/recipes/qt/6.x.x/patches/fix_cmake3.28.patch new file mode 100644 index 0000000000000..c89a9544ff61f --- /dev/null +++ b/recipes/qt/6.x.x/patches/fix_cmake3.28.patch @@ -0,0 +1,45 @@ +From 0efea8020c1d221635aaa0a71529edb392cfe3cc Mon Sep 17 00:00:00 2001 +From: Joerg Bornemann +Date: Mon, 11 Sep 2023 14:48:32 +0200 +Subject: [PATCH] CMake: Fix build with CMake 3.28 on macOS + +FindWrapOpenGL.cmake assumed that IMPORTED_LOCATION is the absolute path +of the library within the framework. That's not the case with CMake 3.28 +anymore. There, IMPORTED_LOCATION is the absolute path of the framework +directory. + +The relevant upstream CMake change is +6b01a27f901b5eb392955fea322cde44a1b782a3. + +Pick-to: 6.2 6.5 6.6 +Change-Id: I6b702a28318e0978c56dec83c398965aa77ef020 +Reviewed-by: Alexandru Croitor +--- + cmake/FindWrapOpenGL.cmake | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/cmake/FindWrapOpenGL.cmake b/cmake/FindWrapOpenGL.cmake +index 3e6abaf4dda..7295a159caf 100644 +--- a/cmake/FindWrapOpenGL.cmake ++++ b/cmake/FindWrapOpenGL.cmake +@@ -14,14 +14,18 @@ + + add_library(WrapOpenGL::WrapOpenGL INTERFACE IMPORTED) + if(APPLE) ++ # CMake 3.27 and older: + # On Darwin platforms FindOpenGL sets IMPORTED_LOCATION to the absolute path of the library + # within the framework. This ends up as an absolute path link flag, which we don't want, + # because that makes our .prl files un-relocatable. + # Extract the framework path instead, and use that in INTERFACE_LINK_LIBRARIES, +- # which CMake ends up transforming into a reloctable -framework flag. ++ # which CMake ends up transforming into a relocatable -framework flag. + # See https://gitlab.kitware.com/cmake/cmake/-/issues/20871 for details. ++ # ++ # CMake 3.28 and above: ++ # IMPORTED_LOCATION is the absolute path the the OpenGL.framework folder. + get_target_property(__opengl_fw_lib_path OpenGL::GL IMPORTED_LOCATION) +- if(__opengl_fw_lib_path) ++ if(__opengl_fw_lib_path AND NOT __opengl_fw_lib_path MATCHES "/([^/]+)\\.framework$") + get_filename_component(__opengl_fw_path "${__opengl_fw_lib_path}" DIRECTORY) + endif() + diff --git a/recipes/qt/6.x.x/qtmodules6.2.4.conf b/recipes/qt/6.x.x/qtmodules6.2.4.conf deleted file mode 100644 index 92bee3c5b0551..0000000000000 --- a/recipes/qt/6.x.x/qtmodules6.2.4.conf +++ /dev/null @@ -1,299 +0,0 @@ -[submodule "qtbase"] - path = qtbase - url = ../qtbase.git - branch = 6.2.4 - status = essential -[submodule "qtsvg"] - depends = qtbase - path = qtsvg - url = ../qtsvg.git - branch = 6.2.4 - status = addon -[submodule "qtdeclarative"] - depends = qtbase - recommends = qtimageformats qtshadertools qtsvg - path = qtdeclarative - url = ../qtdeclarative.git - branch = 6.2.4 - status = essential -[submodule "qtactiveqt"] - depends = qtbase - path = qtactiveqt - url = ../qtactiveqt.git - branch = 6.2.4 - status = addon -[submodule "qtmultimedia"] - depends = qtbase qtshadertools - recommends = qtdeclarative - path = qtmultimedia - url = ../qtmultimedia.git - branch = 6.2.4 - status = addon -[submodule "qttools"] - depends = qtbase - recommends = qtdeclarative qtactiveqt - path = qttools - url = ../qttools.git - branch = 6.2.4 - status = essential -[submodule "qtxmlpatterns"] - depends = qtbase - recommends = qtdeclarative - path = qtxmlpatterns - url = ../qtxmlpatterns.git - branch = 6.2.4 - status = ignore -[submodule "qttranslations"] - depends = qttools - path = qttranslations - url = ../qttranslations.git - branch = 6.2.4 - status = essential - priority = 30 -[submodule "qtdoc"] - depends = qtdeclarative qttools - recommends = qtmultimedia - path = qtdoc - url = ../qtdoc.git - branch = 6.2.4 - 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.2.4 - status = ignore -[submodule "qtpositioning"] - depends = qtbase - recommends = qtdeclarative qtserialport - path = qtpositioning - url = ../qtpositioning.git - branch = 6.2.4 - status = addon -[submodule "qtsensors"] - depends = qtbase - recommends = qtdeclarative - path = qtsensors - url = ../qtsensors.git - branch = 6.2.4 - 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.2.4 - status = addon -[submodule "qtwayland"] - depends = qtbase - recommends = qtdeclarative - path = qtwayland - url = ../qtwayland.git - branch = 6.2.4 - status = addon -[submodule "qt3d"] - depends = qtbase - recommends = qtdeclarative qtshadertools - path = qt3d - url = ../qt3d.git - branch = 6.2.4 - status = addon -[submodule "qtimageformats"] - depends = qtbase - path = qtimageformats - url = ../qtimageformats.git - branch = 6.2.4 - status = addon -[submodule "qtserialbus"] - depends = qtbase - recommends = qtserialport - path = qtserialbus - url = ../qtserialbus.git - branch = 6.2.4 - status = addon -[submodule "qtserialport"] - depends = qtbase - path = qtserialport - url = ../qtserialport.git - branch = 6.2.4 - status = addon -[submodule "qtwebsockets"] - depends = qtbase - recommends = qtdeclarative - path = qtwebsockets - url = ../qtwebsockets.git - branch = 6.2.4 - status = addon -[submodule "qtwebchannel"] - depends = qtbase - recommends = qtdeclarative qtwebsockets - path = qtwebchannel - url = ../qtwebchannel.git - branch = 6.2.4 - status = addon -[submodule "qtwebengine"] - depends = qtdeclarative - recommends = qtwebchannel qttools qtpositioning - path = qtwebengine - url = ../qtwebengine.git - branch = 6.2.4 - status = addon - priority = 10 -[submodule "qtcanvas3d"] - depends = qtdeclarative - path = qtcanvas3d - url = ../qtcanvas3d.git - branch = 6.2.4 - status = ignore -[submodule "qtwebview"] - depends = qtdeclarative - recommends = qtwebengine - path = qtwebview - url = ../qtwebview.git - branch = 6.2.4 - status = addon -[submodule "qtcharts"] - depends = qtbase - recommends = qtdeclarative qtmultimedia - path = qtcharts - url = ../qtcharts.git - branch = 6.2.4 - status = addon -[submodule "qtdatavis3d"] - depends = qtbase - recommends = qtdeclarative qtmultimedia - path = qtdatavis3d - url = ../qtdatavis3d.git - branch = 6.2.4 - status = addon -[submodule "qtvirtualkeyboard"] - depends = qtbase qtdeclarative qtsvg - recommends = qtmultimedia - path = qtvirtualkeyboard - url = ../qtvirtualkeyboard.git - branch = 6.2.4 - status = addon -[submodule "qtgamepad"] - depends = qtbase - recommends = qtdeclarative - path = qtgamepad - url = ../qtgamepad.git - branch = 6.2.4 - status = ignore -[submodule "qtscxml"] - depends = qtbase qtdeclarative - path = qtscxml - url = ../qtscxml.git - branch = 6.2.4 - status = addon -[submodule "qtspeech"] - depends = qtbase - recommends = qtdeclarative qtmultimedia - path = qtspeech - url = ../qtspeech.git - branch = 6.2.4 - status = ignore -[submodule "qtnetworkauth"] - depends = qtbase - path = qtnetworkauth - url = ../qtnetworkauth.git - branch = 6.2.4 - status = addon -[submodule "qtremoteobjects"] - depends = qtbase - recommends = qtdeclarative - path = qtremoteobjects - url = ../qtremoteobjects.git - branch = 6.2.4 - status = addon -[submodule "qtwebglplugin"] - depends = qtbase qtwebsockets - recommends = qtdeclarative - path = qtwebglplugin - url = ../qtwebglplugin.git - branch = 6.2.4 - status = ignore -[submodule "qtlottie"] - depends = qtbase qtdeclarative - path = qtlottie - url = ../qtlottie.git - branch = 6.2.4 - status = addon -[submodule "qtquicktimeline"] - depends = qtbase qtdeclarative - path = qtquicktimeline - url = ../qtquicktimeline - branch = 6.2.4 - status = addon -[submodule "qtquick3d"] - depends = qtbase qtdeclarative qtshadertools - recommends = qtquicktimeline - path = qtquick3d - url = ../qtquick3d.git - branch = 6.2.4 - status = addon -[submodule "qtshadertools"] - depends = qtbase - path = qtshadertools - url = ../qtshadertools.git - branch = 6.2.4 - status = addon -[submodule "qt5compat"] - depends = qtbase qtdeclarative - path = qt5compat - url = ../qt5compat.git - branch = 6.2.4 - status = deprecated -[submodule "qtcoap"] - depends = qtbase - path = qtcoap - url = ../qtcoap.git - branch = 6.2.4 - status = addon -[submodule "qtmqtt"] - depends = qtbase qtdeclarative - path = qtmqtt - url = ../qtmqtt.git - branch = 6.2.4 - status = addon -[submodule "qtopcua"] - depends = qtbase qtdeclarative - path = qtopcua - url = ../qtopcua.git - branch = 6.2.4 - status = addon \ No newline at end of file diff --git a/recipes/qt/6.x.x/qtmodules6.3.2.conf b/recipes/qt/6.x.x/qtmodules6.3.2.conf deleted file mode 100644 index b0e0878e68e97..0000000000000 --- a/recipes/qt/6.x.x/qtmodules6.3.2.conf +++ /dev/null @@ -1,305 +0,0 @@ -[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 deleted file mode 100644 index 0ab0c4ef10277..0000000000000 --- a/recipes/qt/6.x.x/qtmodules6.4.1.conf +++ /dev/null @@ -1,318 +0,0 @@ -[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.5.3.conf b/recipes/qt/6.x.x/qtmodules6.5.3.conf new file mode 100644 index 0000000000000..aee8d5684dcec --- /dev/null +++ b/recipes/qt/6.x.x/qtmodules6.5.3.conf @@ -0,0 +1,332 @@ +[submodule "qtbase"] + path = qtbase + url = ../qtbase.git + branch = 6.5.3 + status = essential +[submodule "qtsvg"] + depends = qtbase + path = qtsvg + url = ../qtsvg.git + branch = 6.5.3 + status = addon +[submodule "qtdeclarative"] + depends = qtbase + recommends = qtimageformats qtshadertools qtsvg qtlanguageserver + path = qtdeclarative + url = ../qtdeclarative.git + branch = 6.5.3 + status = essential +[submodule "qtactiveqt"] + depends = qtbase + path = qtactiveqt + url = ../qtactiveqt.git + branch = 6.5.3 + status = addon +[submodule "qtmultimedia"] + depends = qtbase qtshadertools + recommends = qtdeclarative qtquick3d + path = qtmultimedia + url = ../qtmultimedia.git + branch = 6.5.3 + status = addon +[submodule "qttools"] + depends = qtbase + recommends = qtdeclarative qtactiveqt + path = qttools + url = ../qttools.git + branch = 6.5.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.5.3 + status = essential + priority = 30 +[submodule "qtdoc"] + depends = qtdeclarative qttools + recommends = qtmultimedia qtshadertools qtwebengine + path = qtdoc + url = ../qtdoc.git + branch = 6.5.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 qtpositioning + recommends = qtdeclarative + path = qtlocation + url = ../qtlocation.git + branch = 6.5.3 + status = preview +[submodule "qtpositioning"] + depends = qtbase + recommends = qtdeclarative qtserialport + path = qtpositioning + url = ../qtpositioning.git + branch = 6.5.3 + status = addon +[submodule "qtsensors"] + depends = qtbase + recommends = qtdeclarative + path = qtsensors + url = ../qtsensors.git + branch = 6.5.3 + 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.5.3 + status = addon +[submodule "qtwayland"] + depends = qtbase + recommends = qtdeclarative + path = qtwayland + url = ../qtwayland.git + branch = 6.5.3 + status = addon +[submodule "qt3d"] + depends = qtbase + recommends = qtdeclarative qtshadertools + path = qt3d + url = ../qt3d.git + branch = 6.5.3 + status = addon +[submodule "qtimageformats"] + depends = qtbase + path = qtimageformats + url = ../qtimageformats.git + branch = 6.5.3 + status = addon +[submodule "qtserialbus"] + depends = qtbase + recommends = qtserialport + path = qtserialbus + url = ../qtserialbus.git + branch = 6.5.3 + status = addon +[submodule "qtserialport"] + depends = qtbase + path = qtserialport + url = ../qtserialport.git + branch = 6.5.3 + status = addon +[submodule "qtwebsockets"] + depends = qtbase + recommends = qtdeclarative + path = qtwebsockets + url = ../qtwebsockets.git + branch = 6.5.3 + status = addon +[submodule "qtwebchannel"] + depends = qtbase + recommends = qtdeclarative qtwebsockets + path = qtwebchannel + url = ../qtwebchannel.git + branch = 6.5.3 + status = addon +[submodule "qtwebengine"] + depends = qtdeclarative + recommends = qtwebchannel qttools qtpositioning + path = qtwebengine + url = ../qtwebengine.git + branch = 6.5.3 + 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.5.3 + status = addon +[submodule "qtcharts"] + depends = qtbase + recommends = qtdeclarative qtmultimedia + path = qtcharts + url = ../qtcharts.git + branch = 6.5.3 + status = addon +[submodule "qtdatavis3d"] + depends = qtbase + recommends = qtdeclarative qtmultimedia + path = qtdatavis3d + url = ../qtdatavis3d.git + branch = 6.5.3 + status = addon +[submodule "qtvirtualkeyboard"] + depends = qtbase qtdeclarative qtsvg + recommends = qtmultimedia + path = qtvirtualkeyboard + url = ../qtvirtualkeyboard.git + branch = 6.5.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.5.3 + status = addon +[submodule "qtspeech"] + depends = qtbase + recommends = qtdeclarative qtmultimedia + path = qtspeech + url = ../qtspeech.git + branch = 6.5.3 + status = addon +[submodule "qtnetworkauth"] + depends = qtbase + path = qtnetworkauth + url = ../qtnetworkauth.git + branch = 6.5.3 + status = addon +[submodule "qtremoteobjects"] + depends = qtbase + recommends = qtdeclarative + path = qtremoteobjects + url = ../qtremoteobjects.git + branch = 6.5.3 + 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.5.3 + status = addon +[submodule "qtquicktimeline"] + depends = qtbase qtdeclarative + path = qtquicktimeline + url = ../qtquicktimeline + branch = 6.5.3 + status = addon +[submodule "qtquick3d"] + depends = qtbase qtdeclarative qtshadertools + recommends = qtquicktimeline + path = qtquick3d + url = ../qtquick3d.git + branch = 6.5.3 + status = addon +[submodule "qtshadertools"] + depends = qtbase + path = qtshadertools + url = ../qtshadertools.git + branch = 6.5.3 + status = addon +[submodule "qt5compat"] + depends = qtbase qtdeclarative + path = qt5compat + url = ../qt5compat.git + branch = 6.5.3 + status = deprecated +[submodule "qtcoap"] + depends = qtbase + path = qtcoap + url = ../qtcoap.git + branch = 6.5.3 + status = addon +[submodule "qtmqtt"] + depends = qtbase qtdeclarative + path = qtmqtt + url = ../qtmqtt.git + branch = 6.5.3 + status = addon +[submodule "qtopcua"] + depends = qtbase qtdeclarative + path = qtopcua + url = ../qtopcua.git + branch = 6.5.3 + status = addon +[submodule "qtlanguageserver"] + depends = qtbase + path = qtlanguageserver + url = ../qtlanguageserver.git + branch = 6.5.3 + status = preview +[submodule "qthttpserver"] + depends = qtbase + recommends = qtwebsockets + path = qthttpserver + url = ../qthttpserver.git + branch = 6.5.3 + status = preview +[submodule "qtquick3dphysics"] + depends = qtbase qtdeclarative qtquick3d qtshadertools + path = qtquick3dphysics + url = ../qtquick3dphysics.git + branch = 6.5.3 + status = addon +[submodule "qtgrpc"] + depends = qtbase + recommends = qtdeclarative + path = qtgrpc + url = ../qtgrpc.git + branch = 6.5.3 + status = preview +[submodule "qtquickeffectmaker"] + depends = qtbase qtdeclarative qtshadertools + recommends = qtquick3d + path = qtquickeffectmaker + url = ../qtquickeffectmaker.git + branch = 6.5.3 + status = addon diff --git a/recipes/qt/6.x.x/qtmodules6.6.3.conf b/recipes/qt/6.x.x/qtmodules6.6.3.conf new file mode 100644 index 0000000000000..9ab358b10e06c --- /dev/null +++ b/recipes/qt/6.x.x/qtmodules6.6.3.conf @@ -0,0 +1,338 @@ +[submodule "qtbase"] + path = qtbase + url = ../qtbase.git + branch = 6.6.3 + status = essential +[submodule "qtsvg"] + depends = qtbase + path = qtsvg + url = ../qtsvg.git + branch = 6.6.3 + status = addon +[submodule "qtdeclarative"] + depends = qtbase + recommends = qtimageformats qtshadertools qtsvg qtlanguageserver + path = qtdeclarative + url = ../qtdeclarative.git + branch = 6.6.3 + status = essential +[submodule "qtactiveqt"] + depends = qtbase + path = qtactiveqt + url = ../qtactiveqt.git + branch = 6.6.3 + status = addon +[submodule "qtmultimedia"] + depends = qtbase qtshadertools + recommends = qtdeclarative qtquick3d + path = qtmultimedia + url = ../qtmultimedia.git + branch = 6.6.3 + status = addon +[submodule "qttools"] + depends = qtbase + recommends = qtdeclarative qtactiveqt + path = qttools + url = ../qttools.git + branch = 6.6.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.6.3 + status = essential + priority = 30 +[submodule "qtdoc"] + depends = qtdeclarative qttools + recommends = qtmultimedia qtshadertools qtwebengine + path = qtdoc + url = ../qtdoc.git + branch = 6.6.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 qtpositioning + recommends = qtdeclarative + path = qtlocation + url = ../qtlocation.git + branch = 6.6.3 + status = preview +[submodule "qtpositioning"] + depends = qtbase + recommends = qtdeclarative qtserialport + path = qtpositioning + url = ../qtpositioning.git + branch = 6.6.3 + status = addon +[submodule "qtsensors"] + depends = qtbase + recommends = qtdeclarative + path = qtsensors + url = ../qtsensors.git + branch = 6.6.3 + 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.6.3 + status = addon +[submodule "qtwayland"] + depends = qtbase + recommends = qtdeclarative + path = qtwayland + url = ../qtwayland.git + branch = 6.6.3 + status = addon +[submodule "qt3d"] + depends = qtbase + recommends = qtdeclarative qtshadertools qtmultimedia + path = qt3d + url = ../qt3d.git + branch = 6.6.3 + status = addon +[submodule "qtimageformats"] + depends = qtbase + path = qtimageformats + url = ../qtimageformats.git + branch = 6.6.3 + status = addon +[submodule "qtserialbus"] + depends = qtbase + recommends = qtserialport + path = qtserialbus + url = ../qtserialbus.git + branch = 6.6.3 + status = addon +[submodule "qtserialport"] + depends = qtbase + path = qtserialport + url = ../qtserialport.git + branch = 6.6.3 + status = addon +[submodule "qtwebsockets"] + depends = qtbase + recommends = qtdeclarative + path = qtwebsockets + url = ../qtwebsockets.git + branch = 6.6.3 + status = addon +[submodule "qtwebchannel"] + depends = qtbase + recommends = qtdeclarative qtwebsockets + path = qtwebchannel + url = ../qtwebchannel.git + branch = 6.6.3 + status = addon +[submodule "qtwebengine"] + depends = qtdeclarative + recommends = qtwebchannel qttools qtpositioning + path = qtwebengine + url = ../qtwebengine.git + branch = 6.6.3 + 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.6.3 + status = addon +[submodule "qtcharts"] + depends = qtbase + recommends = qtdeclarative qtmultimedia + path = qtcharts + url = ../qtcharts.git + branch = 6.6.3 + status = addon +[submodule "qtdatavis3d"] + depends = qtbase + recommends = qtdeclarative qtmultimedia + path = qtdatavis3d + url = ../qtdatavis3d.git + branch = 6.6.3 + status = addon +[submodule "qtvirtualkeyboard"] + depends = qtbase qtdeclarative qtsvg + recommends = qtmultimedia + path = qtvirtualkeyboard + url = ../qtvirtualkeyboard.git + branch = 6.6.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.6.3 + status = addon +[submodule "qtspeech"] + depends = qtbase + recommends = qtdeclarative qtmultimedia + path = qtspeech + url = ../qtspeech.git + branch = 6.6.3 + status = addon +[submodule "qtnetworkauth"] + depends = qtbase + path = qtnetworkauth + url = ../qtnetworkauth.git + branch = 6.6.3 + status = addon +[submodule "qtremoteobjects"] + depends = qtbase + recommends = qtdeclarative + path = qtremoteobjects + url = ../qtremoteobjects.git + branch = 6.6.3 + 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.6.3 + status = addon +[submodule "qtquicktimeline"] + depends = qtbase qtdeclarative + path = qtquicktimeline + url = ../qtquicktimeline + branch = 6.6.3 + status = addon +[submodule "qtquick3d"] + depends = qtbase qtdeclarative qtshadertools + recommends = qtquicktimeline + path = qtquick3d + url = ../qtquick3d.git + branch = 6.6.3 + status = addon +[submodule "qtshadertools"] + depends = qtbase + path = qtshadertools + url = ../qtshadertools.git + branch = 6.6.3 + status = addon +[submodule "qt5compat"] + depends = qtbase qtdeclarative + path = qt5compat + url = ../qt5compat.git + branch = 6.6.3 + status = deprecated +[submodule "qtcoap"] + depends = qtbase + path = qtcoap + url = ../qtcoap.git + branch = 6.6.3 + status = addon +[submodule "qtmqtt"] + depends = qtbase qtdeclarative + path = qtmqtt + url = ../qtmqtt.git + branch = 6.6.3 + status = addon +[submodule "qtopcua"] + depends = qtbase qtdeclarative + path = qtopcua + url = ../qtopcua.git + branch = 6.6.3 + status = addon +[submodule "qtlanguageserver"] + depends = qtbase + path = qtlanguageserver + url = ../qtlanguageserver.git + branch = 6.6.3 + status = preview +[submodule "qthttpserver"] + depends = qtbase + recommends = qtwebsockets + path = qthttpserver + url = ../qthttpserver.git + branch = 6.6.3 + status = preview +[submodule "qtquick3dphysics"] + depends = qtbase qtdeclarative qtquick3d qtshadertools + path = qtquick3dphysics + url = ../qtquick3dphysics.git + branch = 6.6.3 + status = addon +[submodule "qtgrpc"] + depends = qtbase + recommends = qtdeclarative + path = qtgrpc + url = ../qtgrpc.git + branch = 6.6.3 + status = preview +[submodule "qtquickeffectmaker"] + depends = qtbase qtdeclarative qtshadertools + recommends = qtquick3d + path = qtquickeffectmaker + url = ../qtquickeffectmaker.git + branch = 6.6.3 + status = addon +[submodule "qtgraphs"] + depends = qtbase qtdeclarative qtquick3d + path = qtgraphs + url = ../qtgraphs.git + branch = 6.6.3 + status = preview diff --git a/recipes/qt/6.x.x/qtmodules6.7.3.conf b/recipes/qt/6.x.x/qtmodules6.7.3.conf new file mode 100644 index 0000000000000..416cfaa7ace55 --- /dev/null +++ b/recipes/qt/6.x.x/qtmodules6.7.3.conf @@ -0,0 +1,338 @@ +[submodule "qtbase"] + path = qtbase + url = ../qtbase.git + branch = 6.7.3 + status = essential +[submodule "qtsvg"] + depends = qtbase + path = qtsvg + url = ../qtsvg.git + branch = 6.7.3 + status = addon +[submodule "qtdeclarative"] + depends = qtbase + recommends = qtimageformats qtshadertools qtsvg qtlanguageserver + path = qtdeclarative + url = ../qtdeclarative.git + branch = 6.7.3 + status = essential +[submodule "qtactiveqt"] + depends = qtbase + path = qtactiveqt + url = ../qtactiveqt.git + branch = 6.7.3 + status = addon +[submodule "qtmultimedia"] + depends = qtbase qtshadertools + recommends = qtdeclarative qtquick3d + path = qtmultimedia + url = ../qtmultimedia.git + branch = 6.7.3 + status = addon +[submodule "qttools"] + depends = qtbase + recommends = qtdeclarative qtactiveqt + path = qttools + url = ../qttools.git + branch = 6.7.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.7.3 + status = essential + priority = 30 +[submodule "qtdoc"] + depends = qtdeclarative qttools + recommends = qtmultimedia qtshadertools qtwebengine + path = qtdoc + url = ../qtdoc.git + branch = 6.7.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 qtpositioning + recommends = qtdeclarative + path = qtlocation + url = ../qtlocation.git + branch = 6.7.3 + status = preview +[submodule "qtpositioning"] + depends = qtbase + recommends = qtdeclarative qtserialport + path = qtpositioning + url = ../qtpositioning.git + branch = 6.7.3 + status = addon +[submodule "qtsensors"] + depends = qtbase + recommends = qtdeclarative + path = qtsensors + url = ../qtsensors.git + branch = 6.7.3 + 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.7.3 + status = addon +[submodule "qtwayland"] + depends = qtbase + recommends = qtdeclarative + path = qtwayland + url = ../qtwayland.git + branch = 6.7.3 + status = addon +[submodule "qt3d"] + depends = qtbase + recommends = qtdeclarative qtshadertools qtmultimedia + path = qt3d + url = ../qt3d.git + branch = 6.7.3 + status = addon +[submodule "qtimageformats"] + depends = qtbase + path = qtimageformats + url = ../qtimageformats.git + branch = 6.7.3 + status = addon +[submodule "qtserialbus"] + depends = qtbase + recommends = qtserialport + path = qtserialbus + url = ../qtserialbus.git + branch = 6.7.3 + status = addon +[submodule "qtserialport"] + depends = qtbase + path = qtserialport + url = ../qtserialport.git + branch = 6.7.3 + status = addon +[submodule "qtwebsockets"] + depends = qtbase + recommends = qtdeclarative + path = qtwebsockets + url = ../qtwebsockets.git + branch = 6.7.3 + status = addon +[submodule "qtwebchannel"] + depends = qtbase + recommends = qtdeclarative qtwebsockets + path = qtwebchannel + url = ../qtwebchannel.git + branch = 6.7.3 + status = addon +[submodule "qtwebengine"] + depends = qtdeclarative + recommends = qtwebchannel qttools qtpositioning + path = qtwebengine + url = ../qtwebengine.git + branch = 6.7.3 + 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.7.3 + status = addon +[submodule "qtcharts"] + depends = qtbase + recommends = qtdeclarative qtmultimedia + path = qtcharts + url = ../qtcharts.git + branch = 6.7.3 + status = addon +[submodule "qtdatavis3d"] + depends = qtbase + recommends = qtdeclarative qtmultimedia + path = qtdatavis3d + url = ../qtdatavis3d.git + branch = 6.7.3 + status = addon +[submodule "qtvirtualkeyboard"] + depends = qtbase qtdeclarative qtsvg + recommends = qtmultimedia + path = qtvirtualkeyboard + url = ../qtvirtualkeyboard.git + branch = 6.7.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.7.3 + status = addon +[submodule "qtspeech"] + depends = qtbase qtmultimedia + recommends = qtdeclarative + path = qtspeech + url = ../qtspeech.git + branch = 6.7.3 + status = addon +[submodule "qtnetworkauth"] + depends = qtbase + path = qtnetworkauth + url = ../qtnetworkauth.git + branch = 6.7.3 + status = addon +[submodule "qtremoteobjects"] + depends = qtbase + recommends = qtdeclarative + path = qtremoteobjects + url = ../qtremoteobjects.git + branch = 6.7.3 + 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.7.3 + status = addon +[submodule "qtquicktimeline"] + depends = qtbase qtdeclarative + path = qtquicktimeline + url = ../qtquicktimeline + branch = 6.7.3 + status = addon +[submodule "qtquick3d"] + depends = qtbase qtdeclarative qtshadertools + recommends = qtquicktimeline + path = qtquick3d + url = ../qtquick3d.git + branch = 6.7.3 + status = addon +[submodule "qtshadertools"] + depends = qtbase + path = qtshadertools + url = ../qtshadertools.git + branch = 6.7.3 + status = addon +[submodule "qt5compat"] + depends = qtbase qtdeclarative + path = qt5compat + url = ../qt5compat.git + branch = 6.7.3 + status = deprecated +[submodule "qtcoap"] + depends = qtbase + path = qtcoap + url = ../qtcoap.git + branch = 6.7.3 + status = addon +[submodule "qtmqtt"] + depends = qtbase qtdeclarative + path = qtmqtt + url = ../qtmqtt.git + branch = 6.7.3 + status = addon +[submodule "qtopcua"] + depends = qtbase qtdeclarative + path = qtopcua + url = ../qtopcua.git + branch = 6.7.3 + status = addon +[submodule "qtlanguageserver"] + depends = qtbase + path = qtlanguageserver + url = ../qtlanguageserver.git + branch = 6.7.3 + status = preview +[submodule "qthttpserver"] + depends = qtbase + recommends = qtwebsockets + path = qthttpserver + url = ../qthttpserver.git + branch = 6.7.3 + status = preview +[submodule "qtquick3dphysics"] + depends = qtbase qtdeclarative qtquick3d qtshadertools + path = qtquick3dphysics + url = ../qtquick3dphysics.git + branch = 6.7.3 + status = addon +[submodule "qtgrpc"] + depends = qtbase + recommends = qtdeclarative + path = qtgrpc + url = ../qtgrpc.git + branch = 6.7.3 + status = preview +[submodule "qtquickeffectmaker"] + depends = qtbase qtdeclarative qtshadertools + recommends = qtquick3d + path = qtquickeffectmaker + url = ../qtquickeffectmaker.git + branch = 6.7.3 + status = addon +[submodule "qtgraphs"] + depends = qtbase qtdeclarative qtquick3d + path = qtgraphs + url = ../qtgraphs.git + branch = 6.7.3 + status = preview diff --git a/recipes/qt/6.x.x/test_package/CMakeLists.txt b/recipes/qt/6.x.x/test_package/CMakeLists.txt index 3a020d154ec7c..45e4bb9ec9ab7 100644 --- a/recipes/qt/6.x.x/test_package/CMakeLists.txt +++ b/recipes/qt/6.x.x/test_package/CMakeLists.txt @@ -1,25 +1,18 @@ -cmake_minimum_required(VERSION 3.3.0) - -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_set_vs_runtime() -conan_set_libcxx() -conan_output_dirs_setup() +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(Qt6 COMPONENTS Core Network Sql Concurrent Xml REQUIRED CONFIG) -set(CMAKE_AUTOMOC ON) -set(CMAKE_AUTORCC ON) add_executable(${PROJECT_NAME} test_package.cpp greeter.h example.qrc) - -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17) - -target_link_libraries(${PROJECT_NAME} Qt6::Core Qt6::Network Qt6::Sql Qt6::Concurrent Qt6::Xml) - -# check if extra qt cmake functions are usable -qt_add_executable(${PROJECT_NAME}2 test_package.cpp greeter.h example.qrc) - -set_property(TARGET ${PROJECT_NAME}2 PROPERTY CXX_STANDARD 17) - -target_link_libraries(${PROJECT_NAME}2 PRIVATE Qt6::Core Qt6::Network Qt6::Sql Qt6::Concurrent Qt6::Xml) +target_link_libraries(${PROJECT_NAME} PRIVATE Qt6::Core Qt6::Network Qt6::Sql Qt6::Concurrent Qt6::Xml Qt6::Widgets) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +set_target_properties(${PROJECT_NAME} PROPERTIES AUTOMOC ON AUTORCC ON) + +# Only running this Qt macros in macOS +if (APPLE) + # Related to https://github.com/conan-io/conan-center-index/issues/20574 + qt_standard_project_setup() + qt_add_executable(test_macos_bundle MACOSX_BUNDLE test_macos_bundle.cpp) + target_link_libraries(test_macos_bundle PRIVATE Qt6::Core) + target_compile_features(test_macos_bundle PRIVATE cxx_std_17) +endif() diff --git a/recipes/qt/6.x.x/test_package/conanfile.py b/recipes/qt/6.x.x/test_package/conanfile.py index fd00ecad1f71c..11efc3f08b07a 100644 --- a/recipes/qt/6.x.x/test_package/conanfile.py +++ b/recipes/qt/6.x.x/test_package/conanfile.py @@ -1,129 +1,47 @@ import os -import shutil 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 +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +from conan.tools.env import VirtualRunEnv +from conan.tools.files import copy, save class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "qt", "cmake", "cmake_find_package_multi", "cmake_find_package", "pkg_config", "qmake" - - def build_requirements(self): - self.tool_requires("cmake/3.25.0") - if self._meson_supported(): - self.tool_requires("meson/0.60.2") - - def _is_mingw(self): - return self.settings.os == "Windows" and self.settings.compiler == "gcc" - - def _meson_supported(self): - return False and self.options["qt"].shared and\ - not cross_building(self) and\ - not self.settings.os == "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 - mkdir(self, "qmake_folder") - with chdir(self, "qmake_folder"): - self.output.info("Building with qmake") - - with tools.vcvars(self.settings) if is_msvc(self) else tools.no_op(): - args = [self.source_folder, "DESTDIR=bin"] - - def _getenvpath(var): - val = os.getenv(var) - if val and tools.os_info.is_windows: - val = val.replace("\\", "/") - os.environ[var] = val - return val + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualBuildEnv" + test_type = "explicit" - value = _getenvpath('CC') - if value: - args.append('QMAKE_CC="%s"' % value) + def layout(self): + cmake_layout(self) - value = _getenvpath('CXX') - if value: - args.append('QMAKE_CXX="%s"' % value) + def requirements(self): + self.requires(self.tested_reference_str, run=can_run(self)) - value = _getenvpath('LD') - if value: - args.append('QMAKE_LINK_C="%s"' % value) - args.append('QMAKE_LINK_C_SHLIB="%s"' % value) - args.append('QMAKE_LINK="%s"' % value) - args.append('QMAKE_LINK_SHLIB="%s"' % value) - - self.run("qmake %s" % " ".join(args), run_environment=True) - if tools.os_info.is_windows: - if is_msvc(self): - self.run("nmake", run_environment=True) - else: - self.run("mingw32-make", run_environment=True) - else: - self.run("make", run_environment=True) - - def _build_with_meson(self): - if self._meson_supported(): - self.output.info("Building with Meson") - mkdir(self, "meson_folder") - with tools.environment_append(RunEnvironment(self).vars): - meson = Meson(self) - try: - meson.configure(build_folder="meson_folder", defs={"cpp_std": "c++11"}) - except ConanException: - self.output.info(open("meson_folder/meson-logs/meson-log.txt", 'r').read()) - raise - meson.build() + def build_requirements(self): + if not can_run(self): + self.tool_requires(self.tested_reference_str) - def _build_with_cmake_find_package_multi(self): - self.output.info("Building with cmake_find_package_multi") - env_build = RunEnvironment(self) - with tools.environment_append(env_build.vars): - cmake = CMake(self, set_cmake_flags=True) - if self.settings.os == "Macos": - cmake.definitions['CMAKE_OSX_DEPLOYMENT_TARGET'] = '10.14' + def generate(self): + path = self.dependencies["qt"].package_folder.replace("\\", "/") + save(self, "qt.conf", f"""[Paths] +Prefix = {path}""") - cmake.configure() - cmake.build() + VirtualRunEnv(self).generate() + if can_run(self): + VirtualRunEnv(self).generate(scope="build") def build(self): - self._build_with_qmake() - self._build_with_meson() - 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 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) - - def _test_with_meson(self): - if self._meson_supported(): - self.output.info("Testing Meson") - shutil.copy("qt.conf", "meson_folder") - self.run(os.path.join("meson_folder", "test_package"), run_environment=True) - - def _test_with_cmake_find_package_multi(self): - self.output.info("Testing CMake_find_package_multi") - shutil.copy("qt.conf", "bin") - self.run(os.path.join("bin", "test_package"), run_environment=True) + cmake = CMake(self) + cmake.configure() + cmake.build() def test(self): - if not cross_building(self, skip_x64_x86=True): - self._test_with_qmake() - self._test_with_meson() - self._test_with_cmake_find_package_multi() + if can_run(self): + copy(self, "qt.conf", src=self.generators_folder, dst=os.path.join(self.cpp.build.bindirs[0])) + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") + # Related to https://github.com/conan-io/conan-center-index/issues/20574 + if self.settings.os == "Macos": + bin_macos_path = os.path.join(self.cpp.build.bindirs[0], "test_macos_bundle.app", "Contents", "MacOS", "test_macos_bundle") + self.run(bin_macos_path, env="conanrun") diff --git a/recipes/qt/6.x.x/test_package/test_macos_bundle.cpp b/recipes/qt/6.x.x/test_package/test_macos_bundle.cpp new file mode 100644 index 0000000000000..fb10bbf49cdff --- /dev/null +++ b/recipes/qt/6.x.x/test_package/test_macos_bundle.cpp @@ -0,0 +1,7 @@ +#include + +int main(int argc, char *argv[]) +{ + QCoreApplication app(argc, argv); + return 0; + } diff --git a/recipes/qt/6.x.x/test_package/test_package.pro b/recipes/qt/6.x.x/test_package/test_package.pro deleted file mode 100644 index 92b10f85fb96e..0000000000000 --- a/recipes/qt/6.x.x/test_package/test_package.pro +++ /dev/null @@ -1,15 +0,0 @@ - include($$OUT_PWD/../conanbuildinfo.pri) - - LIBS += $$CONAN_LIBDIRS - - SOURCES += test_package.cpp - -HEADERS += greeter.h - -RESOURCES = example.qrc - -QT += network sql concurrent xml - -QT -= gui - -CONFIG += console diff --git a/recipes/qt/6.x.x/test_v1_package/CMakeLists.txt b/recipes/qt/6.x.x/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..60524d0bb25e1 --- /dev/null +++ b/recipes/qt/6.x.x/test_v1_package/CMakeLists.txt @@ -0,0 +1,25 @@ +cmake_minimum_required(VERSION 3.3.0) + +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_set_vs_runtime() +conan_set_libcxx() +conan_output_dirs_setup() + +find_package(Qt6 COMPONENTS Core Network Sql Concurrent Xml REQUIRED CONFIG) +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp ../test_package/greeter.h ../test_package/example.qrc) + +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17) + +target_link_libraries(${PROJECT_NAME} Qt6::Core Qt6::Network Qt6::Sql Qt6::Concurrent Qt6::Xml) + +# check if extra qt cmake functions are usable +qt_add_executable(${PROJECT_NAME}2 ../test_package/test_package.cpp ../test_package/greeter.h ../test_package/example.qrc) + +set_property(TARGET ${PROJECT_NAME}2 PROPERTY CXX_STANDARD 17) + +target_link_libraries(${PROJECT_NAME}2 PRIVATE Qt6::Core Qt6::Network Qt6::Sql Qt6::Concurrent Qt6::Xml) diff --git a/recipes/qt/6.x.x/test_v1_package/conanfile.py b/recipes/qt/6.x.x/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..a586ad3bd4cbc --- /dev/null +++ b/recipes/qt/6.x.x/test_v1_package/conanfile.py @@ -0,0 +1,134 @@ +import os +import shutil + +from conan import ConanFile +from conan.tools.build import cross_building +from conan.tools.files import mkdir, chdir, save +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version + +from conans import tools, Meson, RunEnvironment, CMake +from conan.errors import ConanException + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi", "cmake_find_package", "pkg_config", "qmake" + + def build_requirements(self): + self.tool_requires("cmake/3.25.3") + if self._meson_supported(): + self.tool_requires("meson/1.1.0") + + def generate(self): + save(self, "qt.conf", """[Paths] +Prefix = {}""".format(self.dependencies["qt"].package_folder.replace('\\', '/'))) + + def _is_mingw(self): + return self.settings.os == "Windows" and self.settings.compiler == "gcc" + + def _meson_supported(self): + return False and self.options["qt"].shared and\ + not cross_building(self) and\ + not self.settings.os == "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 + mkdir(self, "qmake_folder") + with chdir(self, "qmake_folder"): + self.output.info("Building with qmake") + + with tools.vcvars(self.settings) if is_msvc(self) else tools.no_op(): + args = [self.source_folder, "DESTDIR=bin"] + + def _getenvpath(var): + val = os.getenv(var) + if val and tools.os_info.is_windows: + val = val.replace("\\", "/") + os.environ[var] = val + return val + + value = _getenvpath('CC') + if value: + args.append(f"QMAKE_CC=\"{value}\"") + + value = _getenvpath('CXX') + if value: + args.append(f"QMAKE_CXX=\"{value}\"") + + value = _getenvpath('LD') + if value: + args.append(f"QMAKE_LINK_C=\"{value}\"") + args.append(f"QMAKE_LINK_C_SHLIB=\"{value}\"") + args.append(f"QMAKE_LINK=\"{value}\"") + args.append(f"QMAKE_LINK_SHLIB=\"{value}\"") + + self.run(f"qmake {' '.join(args)}", run_environment=True) + if tools.os_info.is_windows: + if is_msvc(self): + self.run("nmake", run_environment=True) + else: + self.run("mingw32-make", run_environment=True) + else: + self.run("make", run_environment=True) + + def _build_with_meson(self): + if self._meson_supported(): + self.output.info("Building with Meson") + mkdir(self, "meson_folder") + with tools.environment_append(RunEnvironment(self).vars): + meson = Meson(self) + try: + meson.configure(build_folder="meson_folder", defs={"cpp_std": "c++11"}) + except ConanException: + self.output.info(open("meson_folder/meson-logs/meson-log.txt", 'r').read()) + raise + meson.build() + + def _build_with_cmake_find_package_multi(self): + self.output.info("Building with cmake_find_package_multi") + env_build = RunEnvironment(self) + with tools.environment_append(env_build.vars): + cmake = CMake(self, set_cmake_flags=True) + if self.settings.os == "Macos": + cmake.definitions['CMAKE_OSX_DEPLOYMENT_TARGET'] = '10.15' if Version(self.deps_cpp_info["qt"].version) >= "6.5.0" else "10.14" + + cmake.configure() + cmake.build() + + def build(self): + self._build_with_qmake() + self._build_with_meson() + 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 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) + + def _test_with_meson(self): + if self._meson_supported(): + self.output.info("Testing Meson") + shutil.copy("qt.conf", "meson_folder") + self.run(os.path.join("meson_folder", "test_package"), run_environment=True) + + def _test_with_cmake_find_package_multi(self): + self.output.info("Testing CMake_find_package_multi") + shutil.copy("qt.conf", "bin") + self.run(os.path.join("bin", "test_package"), run_environment=True) + + def test(self): + 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/test_package/meson.build b/recipes/qt/6.x.x/test_v1_package/meson.build similarity index 100% rename from recipes/qt/6.x.x/test_package/meson.build rename to recipes/qt/6.x.x/test_v1_package/meson.build diff --git a/recipes/qt/6.x.x/test_v1_package/test_package.pro b/recipes/qt/6.x.x/test_v1_package/test_package.pro new file mode 100644 index 0000000000000..3b3ce9cba0343 --- /dev/null +++ b/recipes/qt/6.x.x/test_v1_package/test_package.pro @@ -0,0 +1,14 @@ +SOURCES += ../test_package/test_package.cpp + +HEADERS += ../test_package/greeter.h + +RESOURCES = ../test_package/example.qrc + +QT -= gui +QT += network sql concurrent xml + +CONFIG += console + +CONFIG += conan_basic_setup +include($$OUT_PWD/../conanbuildinfo.pri) +LIBS -= $$CONAN_LIBS_QT diff --git a/recipes/qt/config.yml b/recipes/qt/config.yml index caf36e07d009d..9272ecb61ec93 100644 --- a/recipes/qt/config.yml +++ b/recipes/qt/config.yml @@ -1,13 +1,9 @@ versions: - "6.4.1": + "6.7.3": folder: 6.x.x - "6.3.2": + "6.6.3": folder: 6.x.x - "6.2.4": + "6.5.3": folder: 6.x.x - "5.15.7": - folder: 5.x.x - "5.15.6": - folder: 5.x.x - "5.15.5": + "5.15.14": folder: 5.x.x diff --git a/recipes/qtawesome/all/conandata.yml b/recipes/qtawesome/all/conandata.yml new file mode 100644 index 0000000000000..f5b2397c54cc5 --- /dev/null +++ b/recipes/qtawesome/all/conandata.yml @@ -0,0 +1,14 @@ +sources: + "6.4.0": + url: "https://github.com/gamecreature/QtAwesome/archive/font-awesome-6.4.0.tar.gz" + sha256: "4310aba189e0bba4090997ecfefe27c2c7595aa499b790389dabdce5b4e54f5a" +patches: + "6.4.0": + - patch_file: "patches/0001-add-install.patch" + patch_description: "Add install target to CMakeLists.txt" + patch_type: "bugfix" + patch_source: "https://github.com/gamecreature/QtAwesome/pull/52" + - patch_file: "patches/0002-ce7784e-add-header.patch" + patch_description: "Add header to CMakeLists.txt" + patch_type: "bugfix" + patch_source: "https://github.com/gamecreature/QtAwesome/pull/50" diff --git a/recipes/qtawesome/all/conanfile.py b/recipes/qtawesome/all/conanfile.py new file mode 100644 index 0000000000000..915710817d984 --- /dev/null +++ b/recipes/qtawesome/all/conanfile.py @@ -0,0 +1,106 @@ +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 +from conan.tools.build import check_min_cppstd +from conan.tools.env import VirtualRunEnv +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 QtAwesomeConan(ConanFile): + name = "qtawesome" + description = "Font Awesome for Qt Applications" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/gamecreature/QtAwesome" + # no "conan" and project name in topics. Use topics from the upstream listed on GH + topics = ("font", "icons", "qt") + package_type = "library" + 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 { + "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 configure(self): + if self.options.shared: + 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 layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires("qt/5.15.9", transitive_headers=True, transitive_libs=True) + + def validate(self): + 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." + ) + if self.settings.os == "Linux": + raise ConanInvalidConfiguration("Linux is not supported yet") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + if not self.settings.compiler.cppstd: + tc.variables["CMAKE_CXX_STANDARD"] = self._min_cppstd + 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() + vre = VirtualRunEnv(self) + vre.generate(scope="build") + + def build(self): + apply_conandata_patches(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() + + def package_info(self): + self.cpp_info.libs = ["QtAwesome"] diff --git a/recipes/qtawesome/all/patches/0001-add-install.patch b/recipes/qtawesome/all/patches/0001-add-install.patch new file mode 100644 index 0000000000000..b3851eb38d11e --- /dev/null +++ b/recipes/qtawesome/all/patches/0001-add-install.patch @@ -0,0 +1,23 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 94b36d7..f92ec26 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -23,3 +23,18 @@ target_include_directories(QtAwesome + target_link_libraries(QtAwesome PUBLIC + Qt${QT_VERSION_MAJOR}::Widgets + ) ++ ++install(TARGETS QtAwesome ++ RUNTIME DESTINATION bin ++ LIBRARY DESTINATION lib ++ ARCHIVE DESTINATION lib ++) ++ ++install(FILES ++ QtAwesome/QtAwesome.h ++ QtAwesome/QtAwesomeAnim.h ++ QtAwesome/QtAwesomeEnumGenerated.h ++ QtAwesome/QtAwesomeStringGenerated.h ++ DESTINATION include ++ ) ++ diff --git a/recipes/qtawesome/all/patches/0002-ce7784e-add-header.patch b/recipes/qtawesome/all/patches/0002-ce7784e-add-header.patch new file mode 100644 index 0000000000000..1dc32834b35c8 --- /dev/null +++ b/recipes/qtawesome/all/patches/0002-ce7784e-add-header.patch @@ -0,0 +1,23 @@ +commit d0398003e820300f902263e67ec06afbdef90c7c +Author: Martin Delille +Date: Fri Mar 31 18:32:51 2023 +0200 + + Add headers to CMakeLists.txt + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f92ec26..93f030d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -11,8 +11,12 @@ set(CMAKE_AUTORCC ON) + set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + + add_library(QtAwesome ++ QtAwesome/QtAwesome.h + QtAwesome/QtAwesome.cpp ++ QtAwesome/QtAwesomeAnim.h + QtAwesome/QtAwesomeAnim.cpp ++ QtAwesome/QtAwesomeEnumGenerated.h ++ QtAwesome/QtAwesomeStringGenerated.h + QtAwesome/QtAwesomeFree.qrc + ) + diff --git a/recipes/qtawesome/all/test_package/CMakeLists.txt b/recipes/qtawesome/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..4a085bcb1915d --- /dev/null +++ b/recipes/qtawesome/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.15) + +project(test_package CXX) + +find_package(QtAwesome REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE qtawesome::qtawesome) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/qtawesome/all/test_package/conanfile.py b/recipes/qtawesome/all/test_package/conanfile.py new file mode 100644 index 0000000000000..ef5d7042163ec --- /dev/null +++ b/recipes/qtawesome/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/qtawesome/all/test_package/test_package.cpp b/recipes/qtawesome/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..cca63995ee056 --- /dev/null +++ b/recipes/qtawesome/all/test_package/test_package.cpp @@ -0,0 +1,8 @@ +#include "QtAwesome.h" + +int main(void) { + fa::QtAwesome awesome(nullptr); + awesome.font(10, 12); + + return EXIT_SUCCESS; +} diff --git a/recipes/qtawesome/config.yml b/recipes/qtawesome/config.yml new file mode 100644 index 0000000000000..773fa8e42ed56 --- /dev/null +++ b/recipes/qtawesome/config.yml @@ -0,0 +1,3 @@ +versions: + "6.4.0": + folder: all diff --git a/recipes/qtxlsxwriter/all/conanfile.py b/recipes/qtxlsxwriter/all/conanfile.py index a67db1337017f..e8b849d77cbf6 100644 --- a/recipes/qtxlsxwriter/all/conanfile.py +++ b/recipes/qtxlsxwriter/all/conanfile.py @@ -7,7 +7,7 @@ from conan.tools.scm import Version import os -required_conan_version = ">=1.53.0" +required_conan_version = ">=1.63.0" class QtXlsxWriterConan(ConanFile): @@ -19,6 +19,7 @@ class QtXlsxWriterConan(ConanFile): topics = ("excel", "xlsx") settings = "os", "arch", "compiler", "build_type" + package_type = "library" options = { "shared": [True, False], "fPIC": [True, False], @@ -44,7 +45,7 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("qt/5.15.7") + self.requires("qt/[~5.15]", transitive_headers=True, transitive_libs=True) def validate(self): if not self.dependencies["qt"].options.gui: @@ -55,7 +56,7 @@ def validate(self): def build_requirements(self): if hasattr(self, "settings_build") and cross_building(self): - self.tool_requires("qt/5.15.7") + self.tool_requires("qt/") def source(self): get(self, **self.conan_data["sources"][self.version]["source"], diff --git a/recipes/quantlib/all/conandata.yml b/recipes/quantlib/all/conandata.yml index 92d444f47a0c7..e51c457667afd 100644 --- a/recipes/quantlib/all/conandata.yml +++ b/recipes/quantlib/all/conandata.yml @@ -1,7 +1,13 @@ sources: + "1.30": + url: "https://github.com/lballabio/QuantLib/releases/download/QuantLib-v1.30/QuantLib-1.30.tar.gz" + sha256: "10159054b68cb9a39480d9000b87851f49e6f42474a4cb9367e934bece2363f3" "1.22": url: "https://github.com/lballabio/QuantLib/releases/download/QuantLib-v1.22/QuantLib-1.22.tar.gz" sha256: "85c81816f689f458596dd7073e4da8fd7f596c1e4c8ada81a6300389a39588af" patches: + "1.30": + - patch_file: "patches/1.30-backport-pr-1644.patch" + - patch_file: "patches/1.30-fix-cmake.patch" "1.22": - - patch_file: "patches/0001-fix-cmake.patch" + - patch_file: "patches/1.22-fix-cmake.patch" diff --git a/recipes/quantlib/all/conanfile.py b/recipes/quantlib/all/conanfile.py index 33792726d5185..117151188f5e9 100644 --- a/recipes/quantlib/all/conanfile.py +++ b/recipes/quantlib/all/conanfile.py @@ -43,13 +43,15 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("boost/1.80.0") + self.requires("boost/1.80.0", transitive_headers=True) def validate(self): if self.info.settings.compiler.get_safe("cppstd"): - check_min_cppstd(self, 11) + check_min_cppstd(self, 14 if self.version >= "1.24" else 11) if self.info.settings.compiler == "gcc" and Version(self.info.settings.compiler.version) < "5": raise ConanInvalidConfiguration("gcc < 5 not supported") + if self.version >= "1.24" and is_msvc(self) and self.options.shared: + raise ConanInvalidConfiguration("MSVC DLL build is not supported by upstream") def source(self): get(self, **self.conan_data["sources"][self.version], @@ -57,13 +59,22 @@ def source(self): 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" + if self.version >= "1.24": + tc.cache_variables["QL_BUILD_BENCHMARK"] = False + tc.cache_variables["QL_BUILD_EXAMPLES"] = False + tc.cache_variables["QL_BUILD_TEST_SUITE"] = False + tc.cache_variables["QL_INSTALL_BENCHMARK"] = False + tc.cache_variables["QL_INSTALL_EXAMPLES"] = False + tc.cache_variables["QL_INSTALL_TEST_SUITE"] = False + else: + # even if boost shared, the underlying upstream logic doesn't matter for conan + tc.variables["USE_BOOST_DYNAMIC_LIBRARIES"] = False + 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 tc.generate() deps = CMakeDeps(self) deps.generate() @@ -85,6 +96,8 @@ def package_info(self): self.cpp_info.set_property("pkg_config_name", "quantlib") self.cpp_info.libs = collect_libs(self) self.cpp_info.requires = ["boost::headers"] + if self.settings.os in ["Linux", "FreeBSD"] and self.options.shared: + self.cpp_info.system_libs.append("m") # TODO: to remove in conan v2 self.cpp_info.names["cmake_find_package"] = "QuantLib" diff --git a/recipes/quantlib/all/patches/0001-fix-cmake.patch b/recipes/quantlib/all/patches/1.22-fix-cmake.patch similarity index 100% rename from recipes/quantlib/all/patches/0001-fix-cmake.patch rename to recipes/quantlib/all/patches/1.22-fix-cmake.patch diff --git a/recipes/quantlib/all/patches/1.30-backport-pr-1644.patch b/recipes/quantlib/all/patches/1.30-backport-pr-1644.patch new file mode 100644 index 0000000000000..0356ad72ec47e --- /dev/null +++ b/recipes/quantlib/all/patches/1.30-backport-pr-1644.patch @@ -0,0 +1,25 @@ +diff --git a/cmake/GenerateHeaders.cmake b/cmake/GenerateHeaders.cmake +index 3e032e537..9d5a8bea9 100644 +--- a/cmake/GenerateHeaders.cmake ++++ b/cmake/GenerateHeaders.cmake +@@ -64,14 +64,12 @@ function(generate_dir_headers source_dir binary_dir) + generate_dir_headers("${source_dir}/${child}" "${binary_dir}/${child}") + endif() + endforeach() +- if (children_all) +- file(WRITE "${binary_dir}/all.hpp" +- "/* This file is automatically generated; do not edit. */\n\n") +- foreach(child ${children_all}) +- file(RELATIVE_PATH all_path ${SOURCE_DIR} ${child}) +- file(APPEND "${binary_dir}/all.hpp" "#include <${all_path}>\n") +- endforeach() +- endif() ++ file(WRITE "${binary_dir}/all.hpp" ++ "/* This file is automatically generated; do not edit. */\n\n") ++ foreach(child ${children_all}) ++ file(RELATIVE_PATH all_path ${SOURCE_DIR} ${child}) ++ file(APPEND "${binary_dir}/all.hpp" "#include <${all_path}>\n") ++ endforeach() + endfunction() + + # Call generate_dir_headers for each directory at this top level (ql/) diff --git a/recipes/quantlib/all/patches/1.30-fix-cmake.patch b/recipes/quantlib/all/patches/1.30-fix-cmake.patch new file mode 100644 index 0000000000000..0fb576b009a2b --- /dev/null +++ b/recipes/quantlib/all/patches/1.30-fix-cmake.patch @@ -0,0 +1,125 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 542877163..83e919784 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -69,40 +69,6 @@ option(QL_USE_STD_TUPLE "Use std::tuple instead of boost::tuple" OFF) + set(QL_EXTERNAL_SUBDIRECTORIES "" CACHE STRING "Optional list of external source directories to be added to the build (semicolon-separated)") + set(QL_EXTRA_LINK_LIBRARIES "" CACHE STRING "Optional extra link libraries to add to QuantLib") + +-# Require C++14 or higher +-if (NOT DEFINED CMAKE_CXX_STANDARD) +- set(CMAKE_CXX_STANDARD 14) +-elseif(CMAKE_CXX_STANDARD LESS 14) +- message(FATAL_ERROR "Please specify CMAKE_CXX_STANDARD of 14 or higher") +-endif() +-if (NOT DEFINED CMAKE_CXX_STANDARD_REQUIRED) +- set(CMAKE_CXX_STANDARD_REQUIRED ON) +-endif() +-# Avoid use of compiler language extensions, i.e. -std=c++14 not -std=gnu++14 +-if (NOT DEFINED CMAKE_CXX_EXTENSIONS) +- set(CMAKE_CXX_EXTENSIONS FALSE) +-endif() +- +-# Convenience option to activate all STD options +-if (QL_USE_STD_CLASSES) +- if (CMAKE_CXX_STANDARD GREATER_EQUAL 17) +- set(QL_USE_STD_ANY ON) +- set(QL_USE_STD_OPTIONAL ON) +- endif() +- set(QL_USE_STD_FUNCTION ON) +- set(QL_USE_STD_SHARED_PTR ON) +- set(QL_USE_STD_TUPLE ON) +-endif() +- +-if (CMAKE_CXX_STANDARD LESS 17) +- if (QL_USE_STD_ANY) +- message(FATAL_ERROR "QL_USE_STD_ANY requires at least C++17") +- endif() +- if (QL_USE_STD_OPTIONAL) +- message(FATAL_ERROR "QL_USE_STD_OPTIONAL requires at least C++17") +- endif() +-endif () +- + # Set the default warning level we use to pass the GitHub workflows + if (QL_ENABLE_DEFAULT_WARNING_LEVEL) + if (MSVC) +@@ -229,7 +195,7 @@ if (QL_TAGGED_LAYOUT) + endif() + set(DEBUG_POSTFIX ${DEBUG_POSTFIX}-mt) + set(RELEASE_POSTFIX ${RELEASE_POSTFIX}-mt) +- if (CMAKE_MSVC_RUNTIME_LIBRARY MATCHES ".*DLL$") ++ if (CMAKE_MSVC_RUNTIME_LIBRARY MATCHES "DLL") + set(DEBUG_POSTFIX ${DEBUG_POSTFIX}-gd) + else() + set(DEBUG_POSTFIX ${DEBUG_POSTFIX}-sgd) +diff --git a/cmake/Platform.cmake b/cmake/Platform.cmake +index 1da2834bc..aa4530798 100644 +--- a/cmake/Platform.cmake ++++ b/cmake/Platform.cmake +@@ -1,12 +1,5 @@ + # Platform-specific flags and settings + if (MSVC) +- # See cmake policy CMP00091 +- # One of "MultiThreaded", "MultiThreadedDebug", "MultiThreadedDLL", "MultiThreadedDebugDLL" +- if (NOT DEFINED CMAKE_MSVC_RUNTIME_LIBRARY) +- set(CMAKE_MSVC_RUNTIME_LIBRARY +- "MultiThreaded$<$:Debug>") +- endif() +- + # Export all symbols so MSVC can populate the .lib and .dll + if (BUILD_SHARED_LIBS) + # Temp: disable DLL builds on MSVC +diff --git a/ql/CMakeLists.txt b/ql/CMakeLists.txt +index fc137f41d..883b8a670 100644 +--- a/ql/CMakeLists.txt ++++ b/ql/CMakeLists.txt +@@ -2344,6 +2344,8 @@ add_library(ql_library + ${QL_CONFIGURED_HEADERS} + ${QL_GENERATED_HEADERS}) + ++target_compile_features(ql_library PUBLIC cxx_std_14) ++ + set_target_properties(ql_library PROPERTIES + EXPORT_NAME ${PACKAGE_NAME} + OUTPUT_NAME ${PACKAGE_NAME} +@@ -2378,6 +2380,7 @@ target_link_libraries(ql_library PUBLIC + ${OpenMP_CXX_LIBRARIES}) + + install(TARGETS ql_library EXPORT QuantLibTargets ++ RUNTIME DESTINATION ${QL_INSTALL_BINDIR} + ARCHIVE DESTINATION ${QL_INSTALL_LIBDIR} + LIBRARY DESTINATION ${QL_INSTALL_LIBDIR}) + +@@ -2398,32 +2401,3 @@ foreach(file ${QL_GENERATED_HEADERS}) + file(RELATIVE_PATH path ${PROJECT_BINARY_DIR} ${dir}) + install(FILES ${file} DESTINATION "${QL_INSTALL_INCLUDEDIR}/${path}") + endforeach() +- +-# Install config scripts for people using `find_package(QuantLib::QuantLib CONFIG ...)` +-include(CMakePackageConfigHelpers) +-write_basic_package_version_file( +- "${PROJECT_BINARY_DIR}/cmake/QuantLibConfigVersion.cmake" +- VERSION ${QL_VERSION} +- COMPATIBILITY AnyNewerVersion +-) +-export(EXPORT QuantLibTargets +- FILE "${PROJECT_BINARY_DIR}/cmake/QuantLibTargets.cmake" +- NAMESPACE QuantLib:: +-) +-configure_file("${PROJECT_SOURCE_DIR}/cmake/QuantLibConfig.cmake.in" +- "${PROJECT_BINARY_DIR}/cmake/QuantLibConfig.cmake" +- COPYONLY +-) +-configure_package_config_file("${PROJECT_SOURCE_DIR}/cmake/QuantLibConfig.cmake.in" +- "${PROJECT_BINARY_DIR}/cmake/QuantLibConfig.cmake" +- INSTALL_DESTINATION "${QL_INSTALL_CMAKEDIR}" +-) +-install(EXPORT QuantLibTargets +- FILE QuantLibTargets.cmake +- NAMESPACE QuantLib:: +- DESTINATION "${QL_INSTALL_CMAKEDIR}" +-) +-install(FILES "${PROJECT_BINARY_DIR}/cmake/QuantLibConfig.cmake" +- "${PROJECT_BINARY_DIR}/cmake/QuantLibConfigVersion.cmake" +- DESTINATION "${QL_INSTALL_CMAKEDIR}" +-) diff --git a/recipes/quantlib/all/test_package/CMakeLists.txt b/recipes/quantlib/all/test_package/CMakeLists.txt index 8fdec262bfc09..365925ecff2bd 100644 --- a/recipes/quantlib/all/test_package/CMakeLists.txt +++ b/recipes/quantlib/all/test_package/CMakeLists.txt @@ -5,4 +5,4 @@ find_package(QuantLib REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE QuantLib::QuantLib) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/quantlib/config.yml b/recipes/quantlib/config.yml index a04ddfaf17d5f..c89bef5d1ecd3 100644 --- a/recipes/quantlib/config.yml +++ b/recipes/quantlib/config.yml @@ -1,3 +1,5 @@ versions: + "1.30": + folder: "all" "1.22": folder: "all" diff --git a/recipes/quaternions/all/conanfile.py b/recipes/quaternions/all/conanfile.py index 53d02dd9ca8a2..3270c603bde8d 100644 --- a/recipes/quaternions/all/conanfile.py +++ b/recipes/quaternions/all/conanfile.py @@ -1,36 +1,54 @@ import os -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 +from conan.tools.layout import basic_layout + +required_conan_version = ">=1.52.0" + class QuaternionsConan(ConanFile): name = "quaternions" description = "A blazingly fast C++ library to work with quaternions." - topics = ("conan", "quaternions", "mathematics") + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/ferd36/quaternions" - license = "MIT" - settings = "compiler" + topics = ("mathematics", "header-only") + + package_type = "header-library" + 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 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.cppstd: + check_min_cppstd(self, self._min_cppstd) def source(self): - tools.get(**self.conan_data["sources"][self.version]) - url = self.conan_data["sources"][self.version]["url"] - extracted_dir = self.name + "-" + os.path.splitext(os.path.basename(url))[0] - os.rename(extracted_dir, self._source_subfolder) - tools.replace_in_file(os.path.join(self._source_subfolder, "include", "quaternion.h"), - "#include ", "") + get(self, **self.conan_data["sources"][self.version], strip_root=True) + replace_in_file(self, + os.path.join(self.source_folder, "include", "quaternion.h"), + "#include ", + "") 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", + 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")) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/quaternions/all/test_package/CMakeLists.txt b/recipes/quaternions/all/test_package/CMakeLists.txt index 33ae887aa6aea..a5abaf06c8332 100644 --- a/recipes/quaternions/all/test_package/CMakeLists.txt +++ b/recipes/quaternions/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -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() +find_package(quaternions REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE quaternions::quaternions) set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) diff --git a/recipes/quaternions/all/test_package/conanfile.py b/recipes/quaternions/all/test_package/conanfile.py index ea57a464900be..fae501d0afb9e 100644 --- a/recipes/quaternions/all/test_package/conanfile.py +++ b/recipes/quaternions/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" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain" + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/quaternions/all/test_v1_package/CMakeLists.txt b/recipes/quaternions/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/quaternions/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/quaternions/all/test_v1_package/conanfile.py b/recipes/quaternions/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..84ee68733e516 --- /dev/null +++ b/recipes/quaternions/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.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/quazip/all/conandata.yml b/recipes/quazip/all/conandata.yml index 33493bd93aef7..9ffb2b7d9ce95 100644 --- a/recipes/quazip/all/conandata.yml +++ b/recipes/quazip/all/conandata.yml @@ -1,13 +1,13 @@ 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" "1.2": url: "https://github.com/stachenov/quazip/archive/v1.2.tar.gz" sha256: "2dfb911d6b27545de0b98798d967c40430312377e6ade57096d6ec80c720cb61" - "1.1": - url: "https://github.com/stachenov/quazip/archive/v1.1.tar.gz" - sha256: "54edce9c11371762bd4f0003c2937b5d8806a2752dd9c0fd9085e90792612ad0" patches: "1.3": - patch_file: "patches/1.3-0001-use-cpp17-for-qt6.patch" diff --git a/recipes/quazip/all/conanfile.py b/recipes/quazip/all/conanfile.py index d7d6399aa11b0..0d9d896af6cc1 100644 --- a/recipes/quazip/all/conanfile.py +++ b/recipes/quazip/all/conanfile.py @@ -3,7 +3,6 @@ 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.53.0" @@ -19,7 +18,7 @@ class QuaZIPConan(ConanFile): homepage = "https://github.com/stachenov/quazip" license = "LGPL-2.1-linking-exception" topics = ("zip", "unzip", "compress") - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -32,7 +31,7 @@ class QuaZIPConan(ConanFile): @property def _qt_major(self): - return Version(self.deps_cpp_info["qt"].version).major + return Version(self.dependencies["qt"].ref.version).major def export_sources(self): export_conandata_patches(self) @@ -49,12 +48,13 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("zlib/1.2.13") - self.requires("qt/5.15.6") + self.requires("qt/[~5.15]", transitive_headers=True, transitive_libs=True) + self.requires("zlib/[>=1.2.11 <2]", transitive_headers=True) + if Version(self.version) >= "1.4": + self.requires("bzip2/1.0.8") 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) @@ -65,8 +65,6 @@ def generate(self): tc.generate() tc = CMakeDeps(self) tc.generate() - tc = VirtualBuildEnv(self) - tc.generate(scope="build") def build(self): apply_conandata_patches(self) diff --git a/recipes/quazip/config.yml b/recipes/quazip/config.yml index 6a1ab98d02ce1..f55a2df2807c5 100644 --- a/recipes/quazip/config.yml +++ b/recipes/quazip/config.yml @@ -1,7 +1,7 @@ versions: + "1.4": + folder: all "1.3": folder: all "1.2": folder: all - "1.1": - folder: all diff --git a/recipes/quickcpplib/all/conandata.yml b/recipes/quickcpplib/all/conandata.yml new file mode 100644 index 0000000000000..c89f6afe4befd --- /dev/null +++ b/recipes/quickcpplib/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "cci.20231208": + url: "https://github.com/ned14/quickcpplib/archive/72277c70f925829935a2af846731ab36063ec16f.tar.gz" + sha256: "bb9da86efa2f262e6a292453775fa9b999b422700eb1c1ac390b7cbe5f0ec92f" diff --git a/recipes/quickcpplib/all/conanfile.py b/recipes/quickcpplib/all/conanfile.py new file mode 100644 index 0000000000000..be93e0eb71c55 --- /dev/null +++ b/recipes/quickcpplib/all/conanfile.py @@ -0,0 +1,105 @@ +import os +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, rm +from conan.tools.layout import basic_layout +from conan.tools.scm import Version + +required_conan_version = ">=1.54.0" + + +class QuickcpplibCodeConan(ConanFile): + name = "quickcpplib" + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/ned14/quickcpplib" + description = "Eliminate all the tedious hassle when making state-of-the-art C++ 17 - 23 libraries!" + topics = ("header-only", "common") + package_type = "header-library" + settings = "os", "compiler", "build_type", "arch" + + @property + def _compiler_required_version(self): + return { + "gcc": "9", + "clang": "10", + "Visual Studio": "15", + "msvc": "191", + } + + @property + def _needs_span_lite(self): + # TODO: Conan 1 only has check_min_cppstd, move to `valid_max_cppstd` when only Conan 2 is required + try: + check_min_cppstd(self, "20") + return False + except ConanInvalidConfiguration: + return True + + @property + def _min_cppstd(self): + return "17" + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + if self._needs_span_lite: + self.requires("span-lite/0.10.3") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + # To simplify library integration to CCI + # we require C++17 to be dependency free. + check_min_cppstd(self, self._min_cppstd) + + min_version = self._compiler_required_version.get(str(self.settings.compiler)) + if min_version: + if Version(self.settings.compiler.version) < min_version: + raise ConanInvalidConfiguration(f"This package requires c++ {self._min_cppstd} support. The current compiler does not support it.") + + 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, "*.hpp", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) + copy(self, "*.ipp", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) + copy(self, "*.h", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) + rmdir(self, os.path.join(self.package_folder, "include", "quickcpplib", "byte")) + rmdir(self, os.path.join(self.package_folder, "include", "quickcpplib", "boost")) + rmdir(self, os.path.join(self.package_folder, "include", "quickcpplib", "optional")) + rmdir(self, os.path.join(self.package_folder, "include", "quickcpplib", "span-lite")) + rm(self, "allocator_testing.hpp", os.path.join(self.package_folder, "include", "quickcpplib")) + copy(self, "Licence.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", "quickcpplib") + self.cpp_info.set_property("cmake_target_name", "quickcpplib::hl") + + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] + + if self._needs_span_lite: + self.cpp_info.requires = ["span-lite::span-lite"] + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs = ["dl", "pthread", "rt"] + + self.cpp_info.defines.append("QUICKCPPLIB_DISABLE_ABI_PERMUTATION") + + if self._needs_span_lite: + self.cpp_info.defines.append("QUICKCPPLIB_USE_SYSTEM_SPAN_LITE=1") + else: + self.cpp_info.defines.append("QUICKCPPLIB_USE_STD_SPAN=1") + + self.cpp_info.defines.append("QUICKCPPLIB_USE_STD_BYTE=1") + self.cpp_info.defines.append("QUICKCPPLIB_USE_STD_OPTIONAL=1") diff --git a/recipes/quickcpplib/all/test_package/CMakeLists.txt b/recipes/quickcpplib/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..fc0e3e545987e --- /dev/null +++ b/recipes/quickcpplib/all/test_package/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package) + +find_package(quickcpplib REQUIRED CONFIG) + +add_executable(test_package test_package.cpp) +target_link_libraries(test_package quickcpplib::hl) + +if (TARGET nonstd::span-lite) +target_compile_features(test_package PRIVATE cxx_std_17) +else () +target_compile_features(test_package PRIVATE cxx_std_20) +endif() diff --git a/recipes/quickcpplib/all/test_package/conanfile.py b/recipes/quickcpplib/all/test_package/conanfile.py new file mode 100644 index 0000000000000..e845ae751a301 --- /dev/null +++ b/recipes/quickcpplib/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/quickcpplib/all/test_package/test_package.cpp b/recipes/quickcpplib/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..54a5243de2818 --- /dev/null +++ b/recipes/quickcpplib/all/test_package/test_package.cpp @@ -0,0 +1,53 @@ +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace ql = ::quickcpplib; + +int main() { + std::uint64_t x = 20230904ULL; + std::uint64_t y = 42ULL; + if( ql::algorithm::hash::fast_hash::hash(reinterpret_cast(&x), sizeof(x)) + == ql::algorithm::hash::fast_hash::hash(reinterpret_cast(&y), sizeof(y)) ) + { + return -1; + } + + return 0; +} diff --git a/recipes/quickcpplib/config.yml b/recipes/quickcpplib/config.yml new file mode 100644 index 0000000000000..1f4ea336bc936 --- /dev/null +++ b/recipes/quickcpplib/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20231208": + folder: all diff --git a/recipes/quickfast/all/CMakeLists.txt b/recipes/quickfast/all/CMakeLists.txt index 99facf34f7dda..69448bef01a75 100644 --- a/recipes/quickfast/all/CMakeLists.txt +++ b/recipes/quickfast/all/CMakeLists.txt @@ -1,75 +1,58 @@ -# based on: https://github.com/microsoft/vcpkg/blob/master/ports/quickfast/CMakeLists.txt - -# Copyright (c) Microsoft Corporation - -# All rights reserved. - -# MIT License - -# 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.13) +cmake_minimum_required(VERSION 3.15) project(quickfast CXX) -include(${PROJECT_BINARY_DIR}/../conanbuildinfo.cmake) -conan_basic_setup() +find_package(Boost REQUIRED CONFIG) +find_package(XercesC REQUIRED CONFIG) file(GLOB SOURCES - source_subfolder/src/Application/*.cpp - source_subfolder/src/Common/*.cpp - source_subfolder/src/Codecs/*.cpp - source_subfolder/src/Communication/*.cpp - source_subfolder/src/Messages/*.cpp + src/Application/*.cpp + src/Common/*.cpp + src/Codecs/*.cpp + src/Communication/*.cpp + src/Messages/*.cpp ) -file(GLOB HEADERS RELATIVE ${PROJECT_SOURCE_DIR} - source_subfolder/src/Application/*.h - source_subfolder/src/Common/*.h - source_subfolder/src/Codecs/*.h - source_subfolder/src/Communication/*.h - source_subfolder/src/Messages/*.h +file(GLOB HEADERS + src/Application/*.h + src/Common/*.h + src/Codecs/*.h + src/Communication/*.h + src/Messages/*.h ) add_library(quickfast ${HEADERS} ${SOURCES}) +# Needed to keep support for deprecated placeholders in boost::bind +target_compile_definitions(quickfast PRIVATE -DBOOST_BIND_GLOBAL_PLACEHOLDERS) + if(BUILD_SHARED_LIBS) - target_compile_definitions(quickfast PRIVATE -DQUICKFAST_BUILD_DLL) + target_compile_definitions(quickfast PUBLIC QUICKFAST_BUILD_DLL) else() - target_compile_definitions(quickfast PUBLIC -DQUICKFAST_HAS_DLL=0) + target_compile_definitions(quickfast PUBLIC QUICKFAST_HAS_DLL=0) endif() target_compile_features(quickfast PUBLIC cxx_std_11) - -target_include_directories(quickfast PUBLIC - source_subfolder/src +target_include_directories(quickfast PRIVATE src) +target_link_libraries(${PROJECT_NAME} + Boost::boost + Boost::thread + Boost::system + Boost::filesystem + XercesC::XercesC +) +set_target_properties(quickfast PROPERTIES + PUBLIC_HEADER "${HEADERS}" ) - -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) install(TARGETS quickfast - RUNTIME DESTINATION bin - ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME} ) foreach (HEADER ${HEADERS}) - file(RELATIVE_PATH HEADER_REL ${PROJECT_SOURCE_DIR}/source_subfolder/src ${PROJECT_SOURCE_DIR}/${HEADER}) - get_filename_component(HEADER_DIR ${HEADER_REL} DIRECTORY) - install(FILES ${HEADER} DESTINATION include/quickfast/${HEADER_DIR}) + file(RELATIVE_PATH HEADER_REL ${PROJECT_SOURCE_DIR}/src ${HEADER}) + get_filename_component(HEADER_DIR ${HEADER_REL} DIRECTORY) + install(FILES ${HEADER} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}/${HEADER_DIR}) endforeach() diff --git a/recipes/quickfast/all/conandata.yml b/recipes/quickfast/all/conandata.yml index f9690b9e48e93..be365a50cf527 100644 --- a/recipes/quickfast/all/conandata.yml +++ b/recipes/quickfast/all/conandata.yml @@ -1,14 +1,16 @@ sources: - "1.5": - url: "https://github.com/objectcomputing/quickfast/archive/V1_5.tar.gz" - sha256: "7ae22d28cc13967a2815c09bec027ce01f2f3e30b6ed752bea00649581e728df" "cci.20170314": url: "https://github.com/objectcomputing/quickfast/archive/f9403cfb20ae5383a04772112728d233502e31c0.tar.gz" sha256: "29f40fa383643bfa381315148c6c985fe41159342706f0d0a274fcf45cf36f49" -patches: "1.5": - - patch_file: "patches/00001-fix-boost-asio.patch" - base_path: "source_subfolder" + url: "https://github.com/objectcomputing/quickfast/archive/V1_5.tar.gz" + sha256: "7ae22d28cc13967a2815c09bec027ce01f2f3e30b6ed752bea00649581e728df" +patches: "cci.20170314": - - patch_file: "patches/00002-fix-boost-asio.patch" - base_path: "source_subfolder" + - patch_file: "patches/0001-cci.20170314-fix-boost-asio.patch" + patch_type: "portability" + patch_description: "Fix compilation issues with newer Boost.Asio" + "1.5": + - patch_file: "patches/0001-1.5-fix-boost-asio.patch" + patch_type: "portability" + patch_description: "Fix compilation issues with newer Boost.Asio" diff --git a/recipes/quickfast/all/conanfile.py b/recipes/quickfast/all/conanfile.py index c5aa454e68422..29ce60d7e04be 100644 --- a/recipes/quickfast/all/conanfile.py +++ b/recipes/quickfast/all/conanfile.py @@ -1,70 +1,83 @@ -from conans import ConanFile, CMake, tools import os -import shutil -import glob + +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.microsoft import is_msvc + +required_conan_version = ">=1.53.0" class QuickfastConan(ConanFile): name = "quickfast" + description = "QuickFAST is an Open Source native C++ implementation of the FAST Protocol" license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" - homepage = "https://objectcomputing.com/" - description = "QuickFAST is an Open Source native C++ implementation of the FAST Protocol" - topics = ("conan", "QuickFAST", "FAST", "FIX", "Fix Adapted for STreaming", "Financial Information Exchange", - "libraries", "cpp") - settings = "os", "compiler", "build_type", "arch" - options = {"fPIC": [True, False], - "shared": [True, False]} - default_options = {"fPIC": True, - "shared": False} - requires = ["boost/1.75.0", "xerces-c/3.2.3"] - 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 _configure_cmake(self): - if not self._cmake: - self._cmake = CMake(self) - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + homepage = "https://github.com/objectcomputing/quickfast" + topics = ("fast-protocol", "fast", "fix-adapted-for-streaming", "fpl", "fix-protocol-limited") - def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = glob.glob("quickfast-*")[0] - os.rename(extracted_dir, self._source_subfolder) + 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): + copy(self, "CMakeLists.txt", self.recipe_folder, os.path.join(self.export_sources_folder, "src")) + 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): + # Uses Boost.Asio transitively + self.requires("boost/1.85.0", transitive_headers=True, transitive_libs=True) + self.requires("xerces-c/3.2.5") + + def validate(self): if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, "11") + check_min_cppstd(self, 11) - def build(self): - patches = self.conan_data["patches"][self.version] - for patch in patches: - tools.patch(**patch) + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) - cmake = self._configure_cmake() - cmake.build(target="quickfast") + def generate(self): + tc = CMakeToolchain(self) + tc.generate() + tc = CMakeDeps(self) + tc.generate() + + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() + cmake.build() def package(self): - cmake = self._configure_cmake() + copy(self, "license.txt", self.source_folder, os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - 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 = ["quickfast"] self.cpp_info.includedirs.append(os.path.join("include", "quickfast")) - if not self.options.shared: + # Needed to keep support for deprecated placeholders in boost::bind + self.cpp_info.defines.append("BOOST_BIND_GLOBAL_PLACEHOLDERS") + + if is_msvc(self) and not self.options.shared: self.cpp_info.defines.append("QUICKFAST_HAS_DLL=0") diff --git a/recipes/quickfast/all/patches/00001-fix-boost-asio.patch b/recipes/quickfast/all/patches/00001-fix-boost-asio.patch deleted file mode 100644 index 02dcc3611cf5c..0000000000000 --- a/recipes/quickfast/all/patches/00001-fix-boost-asio.patch +++ /dev/null @@ -1,42 +0,0 @@ -Patch taken from: -https://raw.githubusercontent.com/microsoft/vcpkg/master/ports/quickfast/00001-fix-boost-asio.patch - -diff --git a/src/Common/QuickFASTPch.h b/src/Common/QuickFASTPch.h -index 3574df8..c4ef4e1 100644 ---- a/src/Common/QuickFASTPch.h -+++ b/src/Common/QuickFASTPch.h -@@ -32,7 +32,7 @@ - #include - - // If building for .NET, must link boost threads dynamically --#define BOOST_THREAD_USE_DLL -+// #define BOOST_THREAD_USE_DLL - // This reports at compile time which boost libraries will be used - // #define BOOST_LIB_DIAGNOSTIC - -diff --git a/src/Communication/AsioService.h b/src/Communication/AsioService.h -index 4f61915..96f2198 100644 ---- a/src/Communication/AsioService.h -+++ b/src/Communication/AsioService.h -@@ -99,6 +99,7 @@ namespace QuickFAST - { - return ioService_; - } -+ boost::asio::io_service::executor_type get_executor() BOOST_ASIO_NOEXCEPT { return ioService_.get_executor();} - - ///@brief Post a completion handler for later processing (usually in a different thread) - /// @param handler is the handler to be posted -diff --git a/src/Communication/AsioService_fwd.h b/src/Communication/AsioService_fwd.h -index dc2f235..6ad5e68 100644 ---- a/src/Communication/AsioService_fwd.h -+++ b/src/Communication/AsioService_fwd.h -@@ -17,7 +17,8 @@ namespace boost - { - namespace asio - { -- class io_service; -+ class io_context; -+ typedef io_context io_service; - } - } - diff --git a/recipes/quickfast/all/patches/00002-fix-boost-asio.patch b/recipes/quickfast/all/patches/00002-fix-boost-asio.patch deleted file mode 100644 index 62dc10d507afe..0000000000000 --- a/recipes/quickfast/all/patches/00002-fix-boost-asio.patch +++ /dev/null @@ -1,42 +0,0 @@ -Patch adapted from: -https://raw.githubusercontent.com/microsoft/vcpkg/master/ports/quickfast/00001-fix-boost-asio.patch - -diff --git a/src/Common/QuickFASTPch.h b/src/Common/QuickFASTPch.h -index 381f846..e6f6b13 100644 ---- a/src/Common/QuickFASTPch.h -+++ b/src/Common/QuickFASTPch.h -@@ -36,7 +36,7 @@ - #include - - // If building for .NET, must link boost threads dynamically --#define BOOST_THREAD_USE_DLL -+// #define BOOST_THREAD_USE_DLL - // This reports at compile time which boost libraries will be used - // #define BOOST_LIB_DIAGNOSTIC - -diff --git a/src/Communication/AsioService.h b/src/Communication/AsioService.h -index 4f61915..54f92ed 100644 ---- a/src/Communication/AsioService.h -+++ b/src/Communication/AsioService.h -@@ -58,6 +58,7 @@ namespace QuickFAST - { - return ioService_.poll(); - } -+ boost::asio::io_service::executor_type get_executor() BOOST_ASIO_NOEXCEPT { return ioService_.get_executor();} - - /// @brief execute at most one ready event handler than return. - size_t poll_one() -diff --git a/src/Communication/AsioService_fwd.h b/src/Communication/AsioService_fwd.h -index dc2f235..6ad5e68 100644 ---- a/src/Communication/AsioService_fwd.h -+++ b/src/Communication/AsioService_fwd.h -@@ -17,7 +17,8 @@ namespace boost - { - namespace asio - { -- class io_service; -+ class io_context; -+ typedef io_context io_service; - } - } - diff --git a/recipes/quickfast/all/patches/0001-1.5-fix-boost-asio.patch b/recipes/quickfast/all/patches/0001-1.5-fix-boost-asio.patch new file mode 100644 index 0000000000000..379f2376249fb --- /dev/null +++ b/recipes/quickfast/all/patches/0001-1.5-fix-boost-asio.patch @@ -0,0 +1,44 @@ +diff --git a/src/Common/QuickFASTPch.h b/src/Common/QuickFASTPch.h +index 3574df8..5e21e89 100644 +--- a/src/Common/QuickFASTPch.h ++++ b/src/Common/QuickFASTPch.h +@@ -32,7 +32,6 @@ + #include + + // If building for .NET, must link boost threads dynamically +-#define BOOST_THREAD_USE_DLL + // This reports at compile time which boost libraries will be used + // #define BOOST_LIB_DIAGNOSTIC + +diff --git a/src/Communication/AsioService.h b/src/Communication/AsioService.h +index 4f61915..b5fa821 100644 +--- a/src/Communication/AsioService.h ++++ b/src/Communication/AsioService.h +@@ -24,7 +24,7 @@ namespace QuickFAST + /// Normal case is for all classes derived from AsioService to share + /// the same boost::io_service. The alternate constructor gives the + /// application more control if it is needed. +- class QuickFAST_Export AsioService ++ class QuickFAST_Export AsioService : public boost::asio::io_service + { + public: + /// @brief Construct using the internal, common io service +diff --git a/src/Communication/AsioService_fwd.h b/src/Communication/AsioService_fwd.h +index dc2f235..8d9be19 100644 +--- a/src/Communication/AsioService_fwd.h ++++ b/src/Communication/AsioService_fwd.h +@@ -13,13 +13,7 @@ + + // forward declare io_service without including + // boost header +-namespace boost +-{ +- namespace asio +- { +- class io_service; +- } +-} ++#include + + namespace QuickFAST + { diff --git a/recipes/quickfast/all/patches/0001-cci.20170314-fix-boost-asio.patch b/recipes/quickfast/all/patches/0001-cci.20170314-fix-boost-asio.patch new file mode 100644 index 0000000000000..c18362970703c --- /dev/null +++ b/recipes/quickfast/all/patches/0001-cci.20170314-fix-boost-asio.patch @@ -0,0 +1,44 @@ +diff --git a/src/Common/QuickFASTPch.h b/src/Common/QuickFASTPch.h +index 381f846..d3016bd 100644 +--- a/src/Common/QuickFASTPch.h ++++ b/src/Common/QuickFASTPch.h +@@ -36,7 +36,6 @@ + #include + + // If building for .NET, must link boost threads dynamically +-#define BOOST_THREAD_USE_DLL + // This reports at compile time which boost libraries will be used + // #define BOOST_LIB_DIAGNOSTIC + +diff --git a/src/Communication/AsioService.h b/src/Communication/AsioService.h +index 4f61915..b5fa821 100644 +--- a/src/Communication/AsioService.h ++++ b/src/Communication/AsioService.h +@@ -24,7 +24,7 @@ namespace QuickFAST + /// Normal case is for all classes derived from AsioService to share + /// the same boost::io_service. The alternate constructor gives the + /// application more control if it is needed. +- class QuickFAST_Export AsioService ++ class QuickFAST_Export AsioService : public boost::asio::io_service + { + public: + /// @brief Construct using the internal, common io service +diff --git a/src/Communication/AsioService_fwd.h b/src/Communication/AsioService_fwd.h +index dc2f235..8d9be19 100644 +--- a/src/Communication/AsioService_fwd.h ++++ b/src/Communication/AsioService_fwd.h +@@ -13,13 +13,7 @@ + + // forward declare io_service without including + // boost header +-namespace boost +-{ +- namespace asio +- { +- class io_service; +- } +-} ++#include + + namespace QuickFAST + { diff --git a/recipes/quickfast/all/test_package/CMakeLists.txt b/recipes/quickfast/all/test_package/CMakeLists.txt index 05ee1b02f3e86..de906d5745a41 100644 --- a/recipes/quickfast/all/test_package/CMakeLists.txt +++ b/recipes/quickfast/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(PackageTest CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(quickfast REQUIRED CONFIG) add_executable(test ${PROJECT_SOURCE_DIR}/main.cpp) - -target_link_libraries(test ${CONAN_LIBS}) - -set_property(TARGET test PROPERTY CXX_STANDARD 11) +target_link_libraries(test PRIVATE quickfast::quickfast) +target_compile_features(test PRIVATE cxx_std_11) diff --git a/recipes/quickfast/all/test_package/conanfile.py b/recipes/quickfast/all/test_package/conanfile.py index 9f2cb9b06805b..ab9a844efa050 100644 --- a/recipes/quickfast/all/test_package/conanfile.py +++ b/recipes/quickfast/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 QuickfastTestConan(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,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindir, "test") + self.run(bin_path, env="conanrun") diff --git a/recipes/quickfast/all/test_package/main.cpp b/recipes/quickfast/all/test_package/main.cpp index 5adcb1b48cd8f..035eaf9d16cd3 100644 --- a/recipes/quickfast/all/test_package/main.cpp +++ b/recipes/quickfast/all/test_package/main.cpp @@ -1,37 +1,12 @@ -#include "Application/QuickFAST.h" -#include "Codecs/MessageConsumer.h" -#include "Codecs/GenericMessageBuilder.h" +#include +#include -using namespace QuickFAST; +#include +#include -class MessageInterpreter : public Codecs::MessageConsumer -{ -public: - MessageInterpreter(std::ostream & out, bool silent = false){ }; - virtual ~MessageInterpreter(){ }; - void setLogLevel(Common::Logger::LogLevel level){ }; - virtual bool consumeMessage(Messages::Message & message){return true;} - virtual bool wantLog(unsigned short level){return true;} - virtual bool logMessage(unsigned short level, const std::string & logMessage){return true;} - virtual bool reportDecodingError(const std::string & errorMessage){return true;} - virtual bool reportCommunicationError(const std::string & errorMessage){return true;} - virtual void decodingStarted(){ } - virtual void decodingStopped(){ } -}; +int main() { + const auto field = QuickFAST::Messages::FieldAscii::create("Hello, World!"); + std::cout << field->toAscii() << std::endl; -int main(int argc, char* argv[]) -{ - Application::DecoderConfiguration configuration_; - Application::DecoderConnection connection_; - - try - { - MessageInterpreter handler(std::cout); - Codecs::GenericMessageBuilder builder(handler); - connection_.configure(builder, configuration_); - connection_.run(); - } - catch (std::exception &) - { - } + return EXIT_SUCCESS; } diff --git a/recipes/quickfast/all/test_v1_package/CMakeLists.txt b/recipes/quickfast/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/quickfast/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/quickfast/all/test_v1_package/conanfile.py b/recipes/quickfast/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..600f82de3b940 --- /dev/null +++ b/recipes/quickfast/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +import os + +from conans import ConanFile, CMake, tools + + +class QuickfastTestConan(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") + self.run(bin_path, run_environment=True) diff --git a/recipes/quickfast/config.yml b/recipes/quickfast/config.yml index 4aad8295800a6..aafc5449a0ecd 100644 --- a/recipes/quickfast/config.yml +++ b/recipes/quickfast/config.yml @@ -1,5 +1,5 @@ versions: - "1.5": - folder: all "cci.20170314": folder: all + "1.5": + folder: all diff --git a/recipes/quickfix/all/conandata.yml b/recipes/quickfix/all/conandata.yml index 863c20f1e79d6..bec3ce0e03d95 100644 --- a/recipes/quickfix/all/conandata.yml +++ b/recipes/quickfix/all/conandata.yml @@ -5,20 +5,11 @@ sources: patches: "1.15.1": - patch_file: "patches/0001-Fix-build-for-C-17-replace-throw-.-with-EXCEPT.patch" - base_path: "source_subfolder" - patch_file: "patches/0002-except-copy.patch" - base_path: "source_subfolder" - patch_file: "patches/0003-fix-condition-for-using-tr1-namespace.patch" - base_path: "source_subfolder" - patch_file: "patches/0004-remove-tests-from-compilatin-unit-performance-and-ac.patch" - base_path: "source_subfolder" - patch_file: "patches/0005-inc.-required-CMake-version-add-conan-basic-setup-an.patch" - base_path: "source_subfolder" - patch_file: "patches/0006-manage-postgres-through-conan.patch" - base_path: "source_subfolder" - patch_file: "patches/0007-add-support-to-static-libraries-for-non-windows-buil.patch" - base_path: "source_subfolder" - patch_file: "patches/0008-manage-mysql-through-conan.patch" - base_path: "source_subfolder" - patch_file: "patches/0009-downgrade-cmake-minimum-required.patch" - base_path: "source_subfolder" diff --git a/recipes/quickfix/all/conanfile.py b/recipes/quickfix/all/conanfile.py index c5c614561ff61..adfbbac153de5 100644 --- a/recipes/quickfix/all/conanfile.py +++ b/recipes/quickfix/all/conanfile.py @@ -1,48 +1,42 @@ -from conans import ConanFile, CMake, 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 is_apple_os +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, collect_libs + +required_conan_version = ">=1.53.0" + class QuickfixConan(ConanFile): name = "quickfix" + description = "QuickFIX is a free and open source implementation of the FIX protocol" license = "The QuickFIX Software License, Version 1.0" url = "https://github.com/conan-io/conan-center-index" homepage = "http://www.quickfixengine.org" - description = "QuickFIX is a free and open source implementation of the FIX protocol" - topics = ("conan", "QuickFIX", "FIX", "Financial Information Exchange", "libraries", "cpp") - settings = "os", "compiler", "build_type", "arch" - options = {"fPIC": [True, False], - "shared": [True, False], - "with_ssl": [True, False], - "with_postgres": [True, False], - "with_mysql": [None, "libmysqlclient"]} - default_options = {"fPIC": True, - "shared": False, - "with_ssl": False, - "with_postgres": False, - "with_mysql": None} - generators = "cmake" - exports_sources = "patches/**" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - - def requirements(self): - if self.options.with_ssl: - self.requires("openssl/1.1.1q") - - if self.options.with_postgres: - self.requires("libpq/14.2") - - if self.options.with_mysql == "libmysqlclient": - self.requires("libmysqlclient/8.0.29") + topics = ("FIX", "Financial Information Exchange", "libraries", "cpp") + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_ssl": [True, False], + "with_postgres": [True, False], + "with_mysql": [None, "libmysqlclient"], + } + default_options = { + "shared": False, + "fPIC": True, + "with_ssl": False, + "with_postgres": False, + "with_mysql": None, + } + + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -50,43 +44,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): + if self.options.with_ssl: + self.requires("openssl/[>=1.1 <4]") + + if self.options.with_postgres: + self.requires("libpq/15.3") + + if self.options.with_mysql == "libmysqlclient": + self.requires("libmysqlclient/8.0.31") def validate(self): if self.settings.os == "Windows" and self.options.shared: raise ConanInvalidConfiguration("QuickFIX cannot be built as shared lib on Windows") - if self.settings.os == "Macos" and self.settings.arch == "armv8": - raise ConanInvalidConfiguration("QuickFIX doesn't support ARM compilation") # See issue: https://github.com/quickfix/quickfix/issues/206 + if is_apple_os(self) and self.settings.arch == "armv8": + # See issue: https://github.com/quickfix/quickfix/issues/206 + raise ConanInvalidConfiguration("QuickFIX doesn't support ARM compilation") - def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + def build_requirements(self): + self.tool_requires("cmake/[>=3.16 <4]") - def _configure_cmake(self): - if not self._cmake: - self._cmake = CMake(self) - self._cmake.definitions["HAVE_SSL"] = self.options.with_ssl - self._cmake.definitions["HAVE_POSTGRESQL"] = self.options.with_postgres - self._cmake.definitions["HAVE_MYSQL"] = bool(self.options.with_mysql) - self._cmake.configure(source_folder=self._source_subfolder, 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.variables["HAVE_SSL"] = self.options.with_ssl + tc.variables["HAVE_POSTGRESQL"] = self.options.with_postgres + tc.variables["HAVE_MYSQL"] = bool(self.options.with_mysql) + tc.generate() + tc = CMakeDeps(self) + tc.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(target="quickfix") def package(self): - cmake = self._configure_cmake() + cmake = CMake(self) cmake.install() - self.copy("config.h", dst=os.path.join("include", "quickfix"), src=self._build_subfolder) - self.copy("Except.h", dst="include", src=os.path.join(self._source_subfolder, "src", "C++")) - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - tools.rmdir(os.path.join(self.package_folder, "share")) + copy(self, "config.h", + dst=os.path.join(self.package_folder, "include", "quickfix"), + src=self.build_folder) + copy(self, "Except.h", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "src", "C++")) + copy(self, "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): - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = collect_libs(self) if self.options.with_ssl: self.cpp_info.defines.append("HAVE_SSL=1") diff --git a/recipes/quickfix/all/patches/0005-inc.-required-CMake-version-add-conan-basic-setup-an.patch b/recipes/quickfix/all/patches/0005-inc.-required-CMake-version-add-conan-basic-setup-an.patch index 3480935d8cd0e..fbea88ec0b6c1 100644 --- a/recipes/quickfix/all/patches/0005-inc.-required-CMake-version-add-conan-basic-setup-an.patch +++ b/recipes/quickfix/all/patches/0005-inc.-required-CMake-version-add-conan-basic-setup-an.patch @@ -25,8 +25,8 @@ index 48908ead..8789432c 100644 endif() project(${quickfix_PROJECT_NAME} VERSION 0.1 LANGUAGES CXX C) -+include(${PROJECT_BINARY_DIR}/../conanbuildinfo.cmake) -+conan_basic_setup() ++ ++ message("-- Project name ${CMAKE_PROJECT_NAME}") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/") diff --git a/recipes/quickfix/all/test_package/CMakeLists.txt b/recipes/quickfix/all/test_package/CMakeLists.txt index 57cf0bfd3debb..59fa2d07ab926 100644 --- a/recipes/quickfix/all/test_package/CMakeLists.txt +++ b/recipes/quickfix/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(PackageTest CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(quickfix REQUIRED CONFIG) add_executable(executor ${PROJECT_SOURCE_DIR}/executor.cpp) -target_link_libraries(executor ${CONAN_LIBS}) +target_link_libraries(executor PRIVATE quickfix::quickfix) diff --git a/recipes/quickfix/all/test_package/conanfile.py b/recipes/quickfix/all/test_package/conanfile.py index a68d648c5c5b5..bf3ebab04211e 100644 --- a/recipes/quickfix/all/test_package/conanfile.py +++ b/recipes/quickfix/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 QuickfixTestConan(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,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "executor") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindir, "executor") + self.run(bin_path, env="conanrun") diff --git a/recipes/quickfix/all/test_v1_package/CMakeLists.txt b/recipes/quickfix/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/quickfix/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/quickfix/all/test_v1_package/conanfile.py b/recipes/quickfix/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..3148dc9605e6c --- /dev/null +++ b/recipes/quickfix/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +import os + +from conans import ConanFile, CMake, tools + + +class QuickfixTestConan(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", "executor") + self.run(bin_path, run_environment=True) diff --git a/recipes/quickjs/all/CMakeLists.txt b/recipes/quickjs/all/CMakeLists.txt index bd4c048f85e13..bcb68cb57eccd 100644 --- a/recipes/quickjs/all/CMakeLists.txt +++ b/recipes/quickjs/all/CMakeLists.txt @@ -42,6 +42,10 @@ set_target_properties(quickjs PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON ) +if(USE_BIGNUM) + target_compile_definitions(quickjs PRIVATE CONFIG_BIGNUM) +endif() + find_library(LIBM m) target_link_libraries(quickjs PRIVATE $<$:${LIBM}>) diff --git a/recipes/quickjs/all/conandata.yml b/recipes/quickjs/all/conandata.yml index b6c326416c7bf..ab82a3e06acc3 100644 --- a/recipes/quickjs/all/conandata.yml +++ b/recipes/quickjs/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "2024-01-13": + url: "https://bellard.org/quickjs/quickjs-2024-01-13.tar.xz" + sha256: "3c4bf8f895bfa54beb486c8d1218112771ecfc5ac3be1036851ef41568212e03" + "2023-12-09": + url: "https://bellard.org/quickjs/quickjs-2023-12-09.tar.xz" + sha256: "e8afe386f875d0e52310ea91aa48e2b0e04182e821f19147794e3e272f4c8d8c" "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 index 8e68a544366f1..6d4979abaf7f7 100644 --- a/recipes/quickjs/all/conanfile.py +++ b/recipes/quickjs/all/conanfile.py @@ -6,7 +6,7 @@ import os -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.53.0" class QuickJSConan(ConanFile): name = "quickjs" @@ -35,21 +35,14 @@ def export_sources(self): def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + if self.version >= "2023-12-09": + del self.options.use_bignum 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 + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def validate(self): # TODO: there are forked repository to support MSVC. (https://github.com/c-smile/quickjspp) @@ -60,12 +53,12 @@ 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["QUICKJS_SRC_DIR"] = self.source_folder.replace("\\", "/") - tc.variables["USE_BIGNUM"] = self.options.use_bignum + tc.variables["USE_BIGNUM"] = self.options.get_safe("use_bignum", True) tc.variables["DUMP_LEAKS"] = self.options.dump_leaks tc.generate() @@ -82,7 +75,7 @@ def package(self): def package_info(self): self.cpp_info.libs = ["quickjs"] - if self.options.use_bignum == True: + if self.options.get_safe("use_bignum", True): self.cpp_info.defines.append("CONFIG_BIGNUM") if self.settings.os in ["Linux", "FreeBSD"]: diff --git a/recipes/quickjs/all/test_package/CMakeLists.txt b/recipes/quickjs/all/test_package/CMakeLists.txt index e6ebd1f3afdc4..d1a90ff4e16f0 100644 --- a/recipes/quickjs/all/test_package/CMakeLists.txt +++ b/recipes/quickjs/all/test_package/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.0) -project(test_package C) +project(test_package LANGUAGES C) find_package(quickjs REQUIRED CONFIG) diff --git a/recipes/quickjs/all/test_v1_package/CMakeLists.txt b/recipes/quickjs/all/test_v1_package/CMakeLists.txt index 4c0436c623e76..2162b4d53343a 100644 --- a/recipes/quickjs/all/test_v1_package/CMakeLists.txt +++ b/recipes/quickjs/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.0) -project(test_package C) +project(test_package) 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) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/quickjs/config.yml b/recipes/quickjs/config.yml index 4110c6ceb7c0f..3e2d478571404 100644 --- a/recipes/quickjs/config.yml +++ b/recipes/quickjs/config.yml @@ -1,3 +1,7 @@ versions: + "2024-01-13": + folder: "all" + "2023-12-09": + folder: "all" "2021-03-27": folder: "all" diff --git a/recipes/quill/all/conandata.yml b/recipes/quill/all/conandata.yml index 67985d018cfe1..e135337274f21 100644 --- a/recipes/quill/all/conandata.yml +++ b/recipes/quill/all/conandata.yml @@ -1,37 +1,31 @@ sources: - "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.3.3": - url: "https://github.com/odygrd/quill/archive/v2.3.3.tar.gz" - sha256: "2979c96123a1cf1afc14a931aab7a1376986e047b0927f450093f4cbae4eb04c" - "2.3.2": - url: "https://github.com/odygrd/quill/archive/v2.3.2.tar.gz" - sha256: "41c3410ff0a6c0eac175dcd3f8c07d920c5a681fa6801fd3172926d8c3cbe0fc" - "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" + "7.5.0": + url: "https://github.com/odygrd/quill/releases/download/v7.5.0/quill-7.5.0.zip" + sha256: "cb0b7d43e54af7cb7ea912d2079eb439d185ddc5fe684f8297d28bb25015d503" + "7.4.0": + url: "https://github.com/odygrd/quill/releases/download/v7.4.0/quill-7.4.0.zip" + sha256: "298820c6e18e87070e01d0d11cb35de2d5007718e2a81f9ec9533b75d6233eac" + "7.3.0": + url: "https://github.com/odygrd/quill/releases/download/v7.3.0/quill-7.3.0.zip" + sha256: "ec58fadeecae50a331018ac0893d9d5d4dec7726cc213f9a343e12bb3fd4e50a" + "7.2.2": + url: "https://github.com/odygrd/quill/releases/download/v7.2.2/quill-7.2.2.zip" + sha256: "3b908f498e1a04b5bf2098108461ff2fab9c3350fccae62c96e54c0f868c00be" + "7.2.1": + url: "https://github.com/odygrd/quill/releases/download/v7.2.1/quill-7.2.1.zip" + sha256: "5ca27bbb8866489a9c2fb1da628d9ddfed423cbba1dd1d07c793d7a8237cfaab" + "7.1.0": + url: "https://github.com/odygrd/quill/releases/download/v7.1.0/quill-7.1.0.zip" + sha256: "3edd1e142ae1a5b6d548c8af5bcf4339bf5889e49ade0806a4269c9587b954ae" + "6.1.0": + url: "https://github.com/odygrd/quill/releases/download/v6.1.0/quill-6.1.0.zip" + sha256: "114bea9d3e4f1ef06a3c48c4e5554a1a3cba182731495e229f2d28f8aef04467" + "6.0.0": + url: "https://github.com/odygrd/quill/releases/download/v6.0.0/quill-6.0.0.zip" + sha256: "912de8486ce781d06e3f03c4267d112a0c7f20f93f0470f6ac66a52774c08283" + "4.5.0": + url: "https://github.com/odygrd/quill/releases/download/v4.5.0/quill-4.5.0.zip" + sha256: "cfd579e58c71f884835079287fb0212278de56c0fbbb1484a8e8b26a5e73642e" + "4.4.1": + url: "https://github.com/odygrd/quill/releases/download/v4.4.1/quill-v4.4.1.zip" + sha256: "56587af304f152445bc3594c328521666e04e580200f7a4bbc5e842fc0d7868f" diff --git a/recipes/quill/all/conanfile.py b/recipes/quill/all/conanfile.py index 13d5e8e84bc02..beadc3d51e802 100644 --- a/recipes/quill/all/conanfile.py +++ b/recipes/quill/all/conanfile.py @@ -1,9 +1,9 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.files import get, copy, rmdir, replace_in_file +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 conan.tools.layout import basic_layout import os @@ -15,50 +15,28 @@ class QuillConan(ConanFile): license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/odygrd/quill/" - topics = ("quill", "logging", "log", "async") + topics = ("logging", "log", "async", "header-only") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" - options = { - "fPIC": [True, False], - "with_bounded_queue": [True, False], - "with_no_exceptions": [True, False], - } - default_options = { - "fPIC": True, - "with_bounded_queue": False, - "with_no_exceptions": False, - } + + @property + def _min_cppstd(self): + return "17" @property def _compilers_minimum_versions(self): return { - "14": - { - "gcc": "5", - "Visual Studio": "15", - "clang": "5", - "apple-clang": "10", - }, - "17": - { - "gcc": "8", - "Visual Studio": "16", - "clang": "7", - "apple-clang": "12", - }, + "gcc": "8", + "Visual Studio": "16", + "clang": "7", + "apple-clang": "12", } - def config_options(self): - if self.settings.os == "Windows": - del self.options.fPIC - def layout(self): - cmake_layout(self, src_folder="src") + basic_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 package_id(self): + self.info.clear() def validate(self): supported_archs = ["x86", "x86_64", "armv6", "armv7", "armv7hf", "armv8"] @@ -66,68 +44,52 @@ def validate(self): if not any(arch in str(self.settings.arch) for arch in supported_archs): raise ConanInvalidConfiguration(f"{self.settings.arch} is not supported by {self.ref}") - cxx_std = "17" if Version(self.version) >= "2.0.0" else "14" - if self.settings.compiler.get_safe("cppstd"): - check_min_cppstd(self, cxx_std) + check_min_cppstd(self, self._min_cppstd) - compilers_minimum_version = self._compilers_minimum_versions[cxx_std] + compilers_minimum_version = self._compilers_minimum_versions minimum_version = compilers_minimum_version.get(str(self.settings.compiler), False) if minimum_version: 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(f"{self.ref} requires C++{cxx_std}. Your compiler is unknown. Assuming it supports C++{cxx_std}.") + raise ConanInvalidConfiguration(f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.") - if Version(self.version) >= "2.0.0" and \ - self.settings.compiler== "clang" and Version(self.settings.compiler.version).major == "11" and \ + if self.settings.compiler== "clang" and Version(self.settings.compiler.version).major == "11" and \ self.settings.compiler.libcxx == "libstdc++": raise ConanInvalidConfiguration(f"{self.ref} requires C++ filesystem library, which your compiler doesn't 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["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 - tc.generate() - - deps = CMakeDeps(self) - deps.generate() - - def build(self): - 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")""" - ) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + 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")) - cmake = CMake(self) - cmake.configure() - cmake.build() + def build(self): + self._patch_sources() 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, "pkgconfig")) - rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + if Version(self.version) < "7.0.0": + copy( + self, + "*.h", + os.path.join(self.source_folder, "quill", "include"), + os.path.join(self.package_folder, "include"), + ) + else: + copy( + self, + "*.h", + os.path.join(self.source_folder, "include"), + os.path.join(self.package_folder, "include"), + ) def package_info(self): - self.cpp_info.libs = ["quill"] - self.cpp_info.defines = ["QUILL_FMT_EXTERNAL"] + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("pthread") - 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("rt") + if 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 417fe001a3312..a6b5b0e801c6c 100644 --- a/recipes/quill/all/test_package/CMakeLists.txt +++ b/recipes/quill/all/test_package/CMakeLists.txt @@ -4,9 +4,7 @@ project(test_package LANGUAGES CXX) find_package(quill REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} quill::quill) -if(quill_VERSION VERSION_GREATER_EQUAL "2.0.0") - target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) -else() - target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) -endif() + +target_link_libraries(${PROJECT_NAME} PRIVATE quill::quill) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +target_compile_definitions(${PROJECT_NAME} PRIVATE QUILL_FILE_HANDLERS_API_V3_3) diff --git a/recipes/quill/all/test_package/test_package.cpp b/recipes/quill/all/test_package/test_package.cpp index db27c1e9dc225..f3e9e28471bde 100644 --- a/recipes/quill/all/test_package/test_package.cpp +++ b/recipes/quill/all/test_package/test_package.cpp @@ -1,11 +1,45 @@ -#include "quill/Quill.h" +#include "quill/Backend.h" +#include "quill/Frontend.h" +#include "quill/LogMacros.h" +#include "quill/Logger.h" +#include "quill/sinks/ConsoleSink.h" + +#include +#include + +/** + * Trivial logging example to console + */ int main() { - quill::start(); - quill::Handler *file_handler = quill::file_handler("logfile.log", "w"); - quill::Logger *my_logger = quill::create_logger("my_logger", file_handler); + // Start the backend thread + quill::BackendOptions backend_options; + quill::Backend::start(backend_options); + + // Frontend + auto console_sink = quill::Frontend::create_or_get_sink("sink_id_1"); + quill::Logger* logger = quill::Frontend::create_or_get_logger("root", std::move(console_sink)); + + // Change the LogLevel to print everything + logger->set_log_level(quill::LogLevel::TraceL3); + + LOG_TRACE_L3(logger, "This is a log trace l3 example {}", 1); + LOG_TRACE_L2(logger, "This is a log trace l2 example {} {}", 2, 2.3); + LOG_TRACE_L1(logger, "This is a log trace l1 {} example", "string"); + LOG_DEBUG(logger, "This is a log debug example {}", 4); + LOG_INFO(logger, "This is a log info example {}", sizeof(std::string)); + LOG_WARNING(logger, "This is a log warning example {}", sizeof(std::string)); + LOG_ERROR(logger, "This is a log error example {}", sizeof(std::string)); + LOG_CRITICAL(logger, "This is a log critical example {}", sizeof(std::string)); + + // libfmt format specification mini language is supported + // note: named arguments are not supported + LOG_INFO(logger, "Support for int: {0:d}; hex: {0:x}; oct: {0:o}; bin: {0:b}", 42); + LOG_INFO(logger, "Easy padding in numbers like {:08d}", 12); + LOG_INFO(logger, "{:>30}", "right aligned"); + LOG_INFO(logger, "Positional arguments {1} {2} {0} ", "too", "are", "supported"); + LOG_INFO(logger, "Support for precision {:.4f}", 1.23456); - LOG_INFO(my_logger, "Hello from {}", "Quill"); - LOG_CRITICAL(my_logger, "This is a conan example {}", 1234); + return 0; } diff --git a/recipes/quill/config.yml b/recipes/quill/config.yml index dfa317084ea31..dd0889f70fe54 100644 --- a/recipes/quill/config.yml +++ b/recipes/quill/config.yml @@ -1,25 +1,21 @@ versions: - "2.5.1": + "7.5.0": folder: "all" - "2.4.2": + "7.4.0": folder: "all" - "2.3.4": + "7.3.0": folder: "all" - "2.3.3": + "7.2.2": folder: "all" - "2.3.2": + "7.2.1": folder: "all" - "2.2.0": + "7.1.0": folder: "all" - "2.1.0": + "6.1.0": folder: "all" - "2.0.2": + "6.0.0": folder: "all" - "2.0.1": + "4.5.0": folder: "all" - "1.7.3": - folder: "all" - "1.6.3": - folder: "all" - "1.5.2": + "4.4.1": folder: "all" diff --git a/recipes/quirc/all/conandata.yml b/recipes/quirc/all/conandata.yml index 91fd4b44c4dfb..a6863036da2b5 100644 --- a/recipes/quirc/all/conandata.yml +++ b/recipes/quirc/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.2": + url: "https://github.com/dlbeer/quirc/archive/v1.2.tar.gz" + sha256: "73c12ea33d337ec38fb81218c7674f57dba7ec0570bddd5c7f7a977c0deb64c5" "1.1": url: "https://github.com/dlbeer/quirc/archive/v1.1.tar.gz" sha256: "5102ccb57639cb355642c1f8af0d815026c948d85d99bf9b86be5746e759f8e6" @@ -8,5 +11,11 @@ sources: patches: "1.1": - patch_file: "patches/remove-c99-features.patch" + patch_description: "remove c99 features" + patch_type: "portability" + patch_source: "https://github.com/dlbeer/quirc/issues/68" "1.0": - patch_file: "patches/replace-vla.patch" + patch_description: "threshold() uses now the row_average member of struct quirc." + patch_type: "portability" + patch_source: "https://github.com/dlbeer/quirc/commit/90371f36a034312f264f2589ff218dad62bee4a4" diff --git a/recipes/quirc/all/conanfile.py b/recipes/quirc/all/conanfile.py index fae8ea08285f2..c8baf1e6dbb2c 100644 --- a/recipes/quirc/all/conanfile.py +++ b/recipes/quirc/all/conanfile.py @@ -13,7 +13,7 @@ class QuircConan(ConanFile): topics = ("qr", "decoder") homepage = "https://github.com/dlbeer/quirc" url = "https://github.com/conan-io/conan-center-index" - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -44,8 +44,7 @@ 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/quirc/config.yml b/recipes/quirc/config.yml index d5affdb292771..db25e2b16686a 100644 --- a/recipes/quirc/config.yml +++ b/recipes/quirc/config.yml @@ -1,6 +1,7 @@ versions: + "1.2": + folder: all "1.1": folder: all "1.0": folder: all - diff --git a/recipes/qwt/all/conanfile.py b/recipes/qwt/all/conanfile.py index e2134db89385f..631bed2233c8a 100644 --- a/recipes/qwt/all/conanfile.py +++ b/recipes/qwt/all/conanfile.py @@ -7,7 +7,7 @@ from conan.tools.scm import Version import os -required_conan_version = ">=1.53.0" +required_conan_version = ">=1.60.0 <2.0 || >=2.0.5" class QwtConan(ConanFile): @@ -15,7 +15,8 @@ class QwtConan(ConanFile): license = "LGPL-2.1-or-later" url = "https://github.com/conan-io/conan-center-index" homepage = "https://qwt.sourceforge.io/" - topics = ("archive", "compression") + topics = ("chart", "data-visualization", "graph", "plot", "qt") + package_type = "library" 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, " @@ -43,6 +44,10 @@ class QwtConan(ConanFile): "polar": True, } + @property + def _is_legacy_one_profile(self): + return not hasattr(self, "settings_build") + def export_sources(self): export_conandata_patches(self) @@ -58,39 +63,39 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("qt/5.15.7") + self.requires("qt/[~5.15]", transitive_headers=True, transitive_libs=True) 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: + if self.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: + if self.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": + if self.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): + if self.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_requirements(self): - if hasattr(self, "settings_build") and cross_building(self): - self.tool_requires("qt/5.15.7") + if not self._is_legacy_one_profile: + self.tool_requires("qt/") 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 hasattr(self, "settings_build") and cross_building(self): - env = VirtualBuildEnv(self) - env.generate() - else: + if self._is_legacy_one_profile: env = VirtualRunEnv(self) env.generate(scope="build") + else: + env = VirtualBuildEnv(self) + env.generate() tc = CMakeToolchain(self) tc.variables["QWT_DLL"] = self.options.shared - tc.variables["QWT_STATIC "] = not 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 diff --git a/recipes/qxlsx/all/conandata.yml b/recipes/qxlsx/all/conandata.yml index 7e3a5bc31390d..6fe82782f6bed 100644 --- a/recipes/qxlsx/all/conandata.yml +++ b/recipes/qxlsx/all/conandata.yml @@ -1,11 +1,18 @@ sources: - "1.4.4": - url: "https://github.com/QtExcel/QXlsx/archive/refs/tags/v1.4.4.zip" - sha256: "3efbd6f63a1ffd521c535dce7b5a5a7e9ebd23db51e6ae8e3e2eb89796e57675" - "1.4.3": - url: "https://github.com/QtExcel/QXlsx/archive/refs/tags/v1.4.3.zip" - sha256: "d2f7c6aff71f2f30ade8d8020682e36a3d63f422a5d2f1c5831b55573241bd4a" + "1.4.9": + url: "https://github.com/QtExcel/QXlsx/archive/refs/tags/v1.4.9.zip" + sha256: "2582c8929163c267658ed65b5b1d3e2edff34c2dd53a6e34ea5f4d3e3f7359cd" + "1.4.5": + url: "https://github.com/QtExcel/QXlsx/archive/refs/tags/v1.4.5.zip" + sha256: "eadcad2718335673f86fe20fd91e822e6c1e3624483be9d79cf79254e5426067" patches: - "1.4.3": - - patch_file: "patches/0001-allow-shared.patch" - - patch_file: "patches/0002-add-install-target.patch" + "1.4.5": + - patch_file: "patches/1.4.5-0001-fix-qt6-version.patch" + patch_description: "Fix Qt find package version" + patch_type: "portability" + patch_source: "https://github.com/QtExcel/QXlsx/commit/08c8128e9b533de15127a5cfd0fc69122a2d82d9" + "1.4.9": + - patch_file: "patches/1.4.9-0001-fix-qstring-error.patch" + patch_description: "Fix a QString compilation error" + patch_type: "backport" + patch_source: "https://github.com/QtExcel/QXlsx/commit/11bafef83286e79a95f17773926b62253ba53cab" diff --git a/recipes/qxlsx/all/conanfile.py b/recipes/qxlsx/all/conanfile.py index 2323a1dec48f6..c4f0d548df54a 100644 --- a/recipes/qxlsx/all/conanfile.py +++ b/recipes/qxlsx/all/conanfile.py @@ -1,55 +1,73 @@ 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.files import export_conandata_patches, apply_conandata_patches, copy, get, rmdir from conan.tools.scm import Version +from conan.tools.env import VirtualRunEnv +from conan.tools.microsoft import is_msvc +from conan.tools.build import check_min_cppstd +from conan.errors import ConanInvalidConfiguration import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=2.0.9" class QXlsxConan(ConanFile): name = "qxlsx" - description = "Excel file(*.xlsx) reader/writer library using Qt 5 or 6." + description = "Excel file (*.xlsx) reader/writer library using Qt 5 or 6." license = "MIT" - topics = ("qxlsx", "excel", "xlsx") + topics = ("excel", "xlsx") homepage = "https://github.com/QtExcel/QXlsx" 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, } + implements = ["auto_shared_fpic"] - 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) + @property + def _qt_version(self): + return str(Version(self.dependencies["qt"].ref.version).major) - def config_options(self): - if self.settings.os == "Windows": - del self.options.fPIC + def export_sources(self): + export_conandata_patches(self) - def configure(self): - if self.options.shared: - del self.options.fPIC + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("qt/5.15.5") + # INFO: QXlsx/xlsxdocument.h includes QtGlobal + # INFO: transitive libs: undefined reference to symbol '_ZN10QArrayData10deallocateEPS_mm@@Qt_5' + self.requires("qt/[>=6.7 <7]", transitive_headers=True, transitive_libs=True) - def layout(self): - cmake_layout(self) + def validate(self): + check_min_cppstd(self, 11) + if not self.dependencies["qt"].options.gui: + raise ConanInvalidConfiguration(f"{self.ref} requires Qt with gui component. Use '-o qt/*:gui=True'") + + def build_requirements(self): + self.tool_requires("cmake/[>=3.16 <4]") + # INFO: QXlsx use Qt automoc: https://github.com/QtExcel/QXlsx/blob/v1.4.9/QXlsx/CMakeLists.txt#L12 + self.tool_requires("qt/") 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): + # INFO: In order to find Qt moc application + env = VirtualRunEnv(self) + env.generate(scope="build") + tc = CMakeToolchain(self) - tc.variables["QT_VERSION_MAJOR"] = Version(self.deps_cpp_info["qt"].version).major + tc.cache_variables["QT_VERSION_MAJOR"] = self._qt_version + # INFO: QXlsx use cached CMAKE_CXX_STANDARD value: + # https://github.com/QtExcel/QXlsx/blob/v1.4.9/QXlsx/CMakeLists.txt#L23 + tc.cache_variables["CMAKE_CXX_STANDARD"] = self.settings.get_safe("compiler.cppstd").replace("gnu", "") tc.generate() tc = CMakeDeps(self) tc.generate() @@ -57,26 +75,23 @@ def generate(self): def build(self): apply_conandata_patches(self) cmake = CMake(self) - cmake.configure(build_script_folder="QXlsx") + cmake.configure(build_script_folder=os.path.join(self.source_folder, "QXlsx")) cmake.build() def package(self): - copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "LICENSE", self.source_folder, 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", "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"] - self.cpp_info.components["qxlsx_core"].includedirs = [os.path.join("include", "QXlsx")] - self.cpp_info.components["qxlsx_core"].requires = ["qt::qtCore", "qt::qtGui"] - - # TODO: to remove in conan v2 once cmake_find_package* generators removed - self.cpp_info.names["cmake_find_package"] = "QXlsx" - self.cpp_info.names["cmake_find_package_multi"] = "QXlsx" - self.cpp_info.components["qxlsx_core"].names["cmake_find_package"] = "Core" - self.cpp_info.components["qxlsx_core"].names["cmake_find_package_multi"] = "Core" - self.cpp_info.components["qxlsx_core"].set_property("cmake_target_name", "QXlsx::Core") + cmake_name = f"QXlsxQt{self._qt_version}" + self.cpp_info.set_property("cmake_file_name", cmake_name) + self.cpp_info.set_property("cmake_target_name", "QXlsx::QXlsx") + self.cpp_info.set_property("cmake_target_aliases", ["QXlsx"]) + self.cpp_info.libs = [cmake_name] + includedir = f"QXlsxQt{self._qt_version}" if Version(self.version) >= "1.4.6" else "QXlsx" + self.cpp_info.includedirs = ["include", os.path.join("include", includedir)] + self.cpp_info.requires = ["qt::qtCore", "qt::qtGui"] + if is_msvc(self) and self.options.shared: + self.cpp_info.defines = ["QXlsx_SHAREDLIB"] diff --git a/recipes/qxlsx/all/patches/0001-allow-shared.patch b/recipes/qxlsx/all/patches/0001-allow-shared.patch deleted file mode 100644 index b640cac70894b..0000000000000 --- a/recipes/qxlsx/all/patches/0001-allow-shared.patch +++ /dev/null @@ -1,218 +0,0 @@ ---- a/QXlsx/CMakeLists.txt -+++ b/QXlsx/CMakeLists.txt -@@ -39,7 +39,7 @@ file(GLOB QXLSX_H "${QXLSX_HEADERPATH}/*.h") - set(SRC_FILES ${QXLSX_CPP}) - list(APPEND SRC_FILES ${QXLSX_H}) - --add_library(QXlsx STATIC -+add_library(QXlsx - ${SRC_FILES} ) - - target_include_directories(QXlsx PRIVATE ${QXLSX_HEADERPATH}) -@@ -50,3 +50,6 @@ target_link_libraries(${PROJECT_NAME} - ) - - target_compile_definitions(QXlsx PRIVATE QXLSX_LIBRARY) -+if (BUILD_SHARED_LIBS) -+ target_compile_definitions(QXlsx PRIVATE QXLSX_SHARED) -+endif() ---- a/QXlsx/header/xlsxabstractooxmlfile.h -+++ b/QXlsx/header/xlsxabstractooxmlfile.h -@@ -10,7 +10,7 @@ QT_BEGIN_NAMESPACE_XLSX - class Relationships; - class AbstractOOXmlFilePrivate; - --class AbstractOOXmlFile -+class QXLSX_EXPORT AbstractOOXmlFile - { - Q_DECLARE_PRIVATE(AbstractOOXmlFile) - ---- a/QXlsx/header/xlsxabstractsheet.h -+++ b/QXlsx/header/xlsxabstractsheet.h -@@ -12,7 +12,7 @@ class Workbook; - class Drawing; - class AbstractSheetPrivate; - --class AbstractSheet : public AbstractOOXmlFile -+class QXLSX_EXPORT AbstractSheet : public AbstractOOXmlFile - { - Q_DECLARE_PRIVATE(AbstractSheet) - ---- a/QXlsx/header/xlsxcell.h -+++ b/QXlsx/header/xlsxcell.h -@@ -24,7 +24,7 @@ class CellFormula; - class CellPrivate; - class WorksheetPrivate; - --class Cell -+class QXLSX_EXPORT Cell - { - Q_DECLARE_PRIVATE(Cell) - ---- a/QXlsx/header/xlsxcellformula.h -+++ b/QXlsx/header/xlsxcellformula.h -@@ -17,7 +17,7 @@ class CellRange; - class Worksheet; - class WorksheetPrivate; - --class CellFormula -+class QXLSX_EXPORT CellFormula - { - public: - enum FormulaType { NormalType, ArrayType, DataTableType, SharedType }; ---- a/QXlsx/header/xlsxcelllocation.h -+++ b/QXlsx/header/xlsxcelllocation.h -@@ -17,7 +17,7 @@ QT_BEGIN_NAMESPACE_XLSX - - class Cell; - --class CellLocation -+class QXLSX_EXPORT CellLocation - { - public: - CellLocation(); ---- a/QXlsx/header/xlsxcellrange.h -+++ b/QXlsx/header/xlsxcellrange.h -@@ -12,7 +12,7 @@ - QT_BEGIN_NAMESPACE_XLSX - - // dev57 --class CellRange -+class QXLSX_EXPORT CellRange - { - public: - CellRange(); ---- a/QXlsx/header/xlsxcellreference.h -+++ b/QXlsx/header/xlsxcellreference.h -@@ -9,7 +9,7 @@ - - QT_BEGIN_NAMESPACE_XLSX - --class CellReference -+class QXLSX_EXPORT CellReference - { - public: - CellReference(); ---- a/QXlsx/header/xlsxchart.h -+++ b/QXlsx/header/xlsxchart.h -@@ -18,7 +18,7 @@ class ChartPrivate; - class CellRange; - class DrawingAnchor; - --class Chart : public AbstractOOXmlFile -+class QXLSX_EXPORT Chart : public AbstractOOXmlFile - { - Q_DECLARE_PRIVATE(Chart) - public: ---- a/QXlsx/header/xlsxchartsheet.h -+++ b/QXlsx/header/xlsxchartsheet.h -@@ -16,7 +16,7 @@ class DocumentPrivate; - class ChartsheetPrivate; - class Chart; - --class Chartsheet : public AbstractSheet -+class QXLSX_EXPORT Chartsheet : public AbstractSheet - { - Q_DECLARE_PRIVATE(Chartsheet) - ---- a/QXlsx/header/xlsxconditionalformatting.h -+++ b/QXlsx/header/xlsxconditionalformatting.h -@@ -24,7 +24,7 @@ class Worksheet; - class Styles; - class ConditionalFormattingPrivate; - --class ConditionalFormatting -+class QXLSX_EXPORT ConditionalFormatting - { - public: - enum HighlightRuleType { ---- a/QXlsx/header/xlsxdatavalidation.h -+++ b/QXlsx/header/xlsxdatavalidation.h -@@ -22,7 +22,7 @@ class CellRange; - class CellReference; - - class DataValidationPrivate; --class DataValidation -+class QXLSX_EXPORT DataValidation - { - public: - enum ValidationType ---- a/QXlsx/header/xlsxdatetype.h -+++ b/QXlsx/header/xlsxdatetype.h -@@ -15,7 +15,7 @@ - - QT_BEGIN_NAMESPACE_XLSX - --class DateType -+class QXLSX_EXPORT DateType - { - public: - DateType(); ---- a/QXlsx/header/xlsxdocument.h -+++ b/QXlsx/header/xlsxdocument.h -@@ -24,7 +24,7 @@ class Chart; - class CellReference; - class DocumentPrivate; - --class Document : public QObject -+class QXLSX_EXPORT Document : public QObject - { - Q_OBJECT - Q_DECLARE_PRIVATE(Document) // D-Pointer. Qt classes have a Q_DECLARE_PRIVATE ---- a/QXlsx/header/xlsxformat.h -+++ b/QXlsx/header/xlsxformat.h -@@ -24,7 +24,7 @@ class SharedStrings; - - class FormatPrivate; - --class Format -+class QXLSX_EXPORT Format - { - public: - enum FontScript ---- a/QXlsx/header/xlsxglobal.h -+++ b/QXlsx/header/xlsxglobal.h -@@ -30,4 +30,10 @@ - #define Q_DECL_NOTHROW - #endif - -+#ifdef QXLSX_SHARED -+#define QXLSX_EXPORT Q_DECL_EXPORT -+#else -+#define QXLSX_EXPORT -+#endif -+ - #endif // XLSXGLOBAL_H ---- a/QXlsx/header/xlsxrichstring.h -+++ b/QXlsx/header/xlsxrichstring.h -@@ -37,7 +37,7 @@ class RichString; - // qHash is a friend, but we can't use default arguments for friends (§8.3.6.4) - uint qHash(const RichString &rs, uint seed = 0) Q_DECL_NOTHROW; - --class RichString -+class QXLSX_EXPORT RichString - { - public: - RichString(); ---- a/QXlsx/header/xlsxworkbook.h -+++ b/QXlsx/header/xlsxworkbook.h -@@ -28,7 +28,7 @@ class Chartsheet; - class Worksheet; - class WorkbookPrivate; - --class Workbook : public AbstractOOXmlFile -+class QXLSX_EXPORT Workbook : public AbstractOOXmlFile - { - Q_DECLARE_PRIVATE(Workbook) - public: ---- a/QXlsx/header/xlsxworksheet.h -+++ b/QXlsx/header/xlsxworksheet.h -@@ -37,7 +37,7 @@ class Relationships; - class Chart; - - class WorksheetPrivate; --class Worksheet : public AbstractSheet -+class QXLSX_EXPORT Worksheet : public AbstractSheet - { - Q_DECLARE_PRIVATE(Worksheet) - diff --git a/recipes/qxlsx/all/patches/0002-add-install-target.patch b/recipes/qxlsx/all/patches/0002-add-install-target.patch deleted file mode 100644 index 48125aa4d3f43..0000000000000 --- a/recipes/qxlsx/all/patches/0002-add-install-target.patch +++ /dev/null @@ -1,37 +0,0 @@ ---- a/QXlsx/CMakeLists.txt -+++ b/QXlsx/CMakeLists.txt -@@ -53,3 +53,34 @@ target_compile_definitions(QXlsx PRIVATE QXLSX_LIBRARY) - if (BUILD_SHARED_LIBS) - target_compile_definitions(QXlsx PRIVATE QXLSX_SHARED) - endif() -+ -+set(QXLSX_PUBLIC_HEADERS -+ header/xlsxdocument.h -+ header/xlsxabstractooxmlfile.h -+ header/xlsxabstractsheet.h -+ header/xlsxabstractsheet_p.h -+ header/xlsxcellformula.h -+ header/xlsxcell.h -+ header/xlsxcelllocation.h -+ header/xlsxcellrange.h -+ header/xlsxcellreference.h -+ header/xlsxchart.h -+ header/xlsxchartsheet.h -+ header/xlsxconditionalformatting.h -+ header/xlsxdatavalidation.h -+ header/xlsxdatetype.h -+ header/xlsxdocument.h -+ header/xlsxformat.h -+ header/xlsxglobal.h -+ header/xlsxrichstring.h -+ header/xlsxworkbook.h -+ header/xlsxworksheet.h -+) -+set_property(TARGET QXlsx PROPERTY PUBLIC_HEADER ${QXLSX_PUBLIC_HEADERS}) -+include(GNUInstallDirs) -+install(TARGETS QXlsx -+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} -+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} -+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} -+ PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/QXlsx -+) diff --git a/recipes/qxlsx/all/patches/1.4.5-0001-fix-qt6-version.patch b/recipes/qxlsx/all/patches/1.4.5-0001-fix-qt6-version.patch new file mode 100644 index 0000000000000..74dd1e56db069 --- /dev/null +++ b/recipes/qxlsx/all/patches/1.4.5-0001-fix-qt6-version.patch @@ -0,0 +1,13 @@ +diff --git a/QXlsx/CMakeLists.txt b/QXlsx/CMakeLists.txt +index 7207f94..5cbb2dd 100644 +--- a/QXlsx/CMakeLists.txt ++++ b/QXlsx/CMakeLists.txt +@@ -16,7 +16,7 @@ include(GNUInstallDirs) + if(NOT DEFINED QT_VERSION_MAJOR) + find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Gui REQUIRED) + endif() +-find_package(Qt${QT_VERSION_MAJOR} 5.9 COMPONENTS Core Gui REQUIRED) ++find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Gui REQUIRED) + set(EXPORT_NAME QXlsxQt${QT_VERSION_MAJOR}) + + if (QT_VERSION_MAJOR EQUAL 6) diff --git a/recipes/qxlsx/all/patches/1.4.9-0001-fix-qstring-error.patch b/recipes/qxlsx/all/patches/1.4.9-0001-fix-qstring-error.patch new file mode 100644 index 0000000000000..2371f39b2580a --- /dev/null +++ b/recipes/qxlsx/all/patches/1.4.9-0001-fix-qstring-error.patch @@ -0,0 +1,22 @@ +A fix for https://github.com/QtExcel/QXlsx/issues/349 based on +https://github.com/QtExcel/QXlsx/commit/11bafef83286e79a95f17773926b62253ba53cab +--- a/QXlsx/source/xlsxworkbook.cpp ++++ b/QXlsx/source/xlsxworkbook.cpp +@@ -607,7 +607,7 @@ + + AbstractSheet *sheet = addSheet(name, sheetId, type); + sheet->setSheetState(state); +- if (relationship.target.startsWith("/")) { ++ if (relationship.target.startsWith(u'/')) { + QString fullPath = QDir::cleanPath(relationship.target.mid(1)); + + sheet->setFilePath(fullPath); +@@ -618,7 +618,7 @@ + // QLatin1String("/") + relationship.target); + const auto parts = splitPath(strFilePath); + QString fullPath = +- QDir::cleanPath(parts.first() + QLatin1String("/") + relationship.target); ++ QDir::cleanPath(parts.first() + u'/' + relationship.target); + + sheet->setFilePath(fullPath); + } diff --git a/recipes/qxlsx/all/test_package/CMakeLists.txt b/recipes/qxlsx/all/test_package/CMakeLists.txt index d57016937dd42..a923ec44aef44 100644 --- a/recipes/qxlsx/all/test_package/CMakeLists.txt +++ b/recipes/qxlsx/all/test_package/CMakeLists.txt @@ -1,8 +1,8 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package LANGUAGES CXX) -find_package(QXlsx REQUIRED CONFIG) +find_package(QXlsxQt5 QUIET CONFIG) +find_package(QXlsxQt6 QUIET CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE QXlsx::Core) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17) +target_link_libraries(${PROJECT_NAME} PRIVATE QXlsx::QXlsx) diff --git a/recipes/qxlsx/all/test_package/conanfile.py b/recipes/qxlsx/all/test_package/conanfile.py index 6d529581ba2f5..d551a686af756 100644 --- a/recipes/qxlsx/all/test_package/conanfile.py +++ b/recipes/qxlsx/all/test_package/conanfile.py @@ -1,23 +1,18 @@ from conan import ConanFile from conan.tools.build import can_run -from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "CMakeDeps", "VirtualRunEnv" - + generators = "CMakeToolchain", "CMakeDeps" 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() @@ -25,5 +20,5 @@ def build(self): def test(self): if can_run(self): - bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + bin_path = os.path.join(self.cpp.build.bindir, "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/qxlsx/all/test_package/test_package.cpp b/recipes/qxlsx/all/test_package/test_package.cpp index ec71d1106e960..14f8874944818 100644 --- a/recipes/qxlsx/all/test_package/test_package.cpp +++ b/recipes/qxlsx/all/test_package/test_package.cpp @@ -1,15 +1,9 @@ -#include -#include #include int main() { - QBuffer device; - device.open(QIODevice::WriteOnly); - - QXlsx::Document xlsx1; - xlsx1.write("A1", true); - xlsx1.write("A2", false); - xlsx1.saveAs(&device); + // INFO: Document does not exist. Only for test package purposes. + QXlsx::Document xlsxR("Test.xlsx"); + xlsxR.load(); return 0; } diff --git a/recipes/qxlsx/all/test_v1_package/CMakeLists.txt b/recipes/qxlsx/all/test_v1_package/CMakeLists.txt deleted file mode 100644 index 098ce8b428891..0000000000000 --- a/recipes/qxlsx/all/test_v1_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(TARGETS) - -find_package(QXlsx REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} QXlsx::Core) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17) diff --git a/recipes/qxlsx/config.yml b/recipes/qxlsx/config.yml index c3a2585d47075..37a3a269ffdb9 100644 --- a/recipes/qxlsx/config.yml +++ b/recipes/qxlsx/config.yml @@ -1,5 +1,5 @@ versions: - "1.4.4": + "1.4.9": folder: "all" - "1.4.3": + "1.4.5": folder: "all" diff --git a/recipes/qxmpp/all/CMakeLists.txt b/recipes/qxmpp/all/CMakeLists.txt deleted file mode 100644 index 59052ada070a2..0000000000000 --- a/recipes/qxmpp/all/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS KEEP_RPATHS) - -set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) - -add_subdirectory(source_subfolder) diff --git a/recipes/qxmpp/all/conandata.yml b/recipes/qxmpp/all/conandata.yml index 57b44e43f1da6..d54578ee2ca20 100644 --- a/recipes/qxmpp/all/conandata.yml +++ b/recipes/qxmpp/all/conandata.yml @@ -4,7 +4,9 @@ sources: sha256: "2148162138eaf4b431a6ee94104f87877b85a589da803dff9433c698b4cf4f19" patches: "1.4.0": - - patch_file: "patches/001-add_conan_1.4.0.patch" - base_path: "source_subfolder" - - patch_file: "patches/002-add_gstreamer_1.4.0.patch" - base_path: "source_subfolder" + - patch_file: "patches/001-skip-module-path.patch" + patch_description: "Do not use module path provided by the upstream" + patch_type: "conan" + - patch_file: "patches/002-use-conan-gstreamer.patch" + patch_description: "Adapt to consume gstreamer from Conan" + patch_type: "conan" diff --git a/recipes/qxmpp/all/conanfile.py b/recipes/qxmpp/all/conanfile.py index b89c7627065d2..e57f163a543f8 100644 --- a/recipes/qxmpp/all/conanfile.py +++ b/recipes/qxmpp/all/conanfile.py @@ -1,20 +1,27 @@ -from conan import ConanFile -from conan.tools import files -from conans import CMake -import functools 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.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, rename, mkdir +from conan.tools.microsoft import is_msvc +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.scm import Version + +required_conan_version = ">=1.60.0 <2 || >=2.0.5" class QxmppConan(ConanFile): name = "qxmpp" + description = ("Cross-platform C++ XMPP client and server library. " + "It is written in C++ and uses Qt framework.") license = "LGPL-2.1" - homepage = "https://github.com/qxmpp-project/qxmpp" url = "https://github.com/conan-io/conan-center-index" - description = "Cross-platform C++ XMPP client and server library. It is written in C++ and uses Qt framework." - topics = "qt", "qt6", "xmpp", "xmpp-library", "xmpp-server", "xmpp-client" + homepage = "https://github.com/qxmpp-project/qxmpp" + topics = ("qt", "qt6", "xmpp", "xmpp-library", "xmpp-server", "xmpp-client") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -27,62 +34,84 @@ class QxmppConan(ConanFile): "with_gstreamer": False, } - generators = "cmake", "cmake_find_package_multi" + @property + def _min_cppstd(self): + return 17 @property - def _source_subfolder(self): - return "source_subfolder" + def _compilers_minimum_version(self): + return { + "gcc": "10", + "Visual Studio": "17", + "msvc": "192", + "clang": "8", + "apple-clang": "13", + } 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 + if self.options.get_safe("shared"): + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("qt/6.2.4") + self.requires("qt/[>=5.15 <7]", transitive_headers=True, transitive_libs=True) if self.options.with_gstreamer: - self.requires("gstreamer/1.19.2") - self.requires("glib/2.70.1") + self.requires("gstreamer/1.22.6") + self.requires("glib/2.78.3") + + 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.") + + def build_requirements(self): + self.tool_requires("qt/") 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): + venv = VirtualBuildEnv(self) + venv.generate() + venv = VirtualRunEnv(self) + venv.generate(scope="build") + tc = CMakeToolchain(self) + tc.variables["BUILD_DOCUMENTATION"] = False + tc.variables["BUILD_TESTS"] = False + tc.variables["BUILD_EXAMPLES"] = False + tc.variables["WITH_GSTREAMER"] = self.options.with_gstreamer + tc.variables["BUILD_SHARED"] = self.options.get_safe("shared") + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + 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_DOCUMENTATION"] = "OFF" - cmake.definitions["BUILD_TESTS"] = "OFF" - cmake.definitions["BUILD_EXAMPLES"] = "OFF" - cmake.definitions["WITH_GSTREAMER"] = self.options.with_gstreamer - cmake.definitions["BUILD_SHARED"] = self.options.shared cmake.configure() - return cmake - - def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - files.patch(self, **patch) - cmake = self._configure_cmake() cmake.build() def package(self): - self.copy("LICENSE.LGPL", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE.LGPL", 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")) - files.rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) - - if self.options.shared and self.settings.os == "Windows": - 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")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + if is_msvc(self) and self.options.shared: + mkdir(self, os.path.join(self.package_folder, "bin")) + rename(self, os.path.join(self.package_folder, "lib", "qxmpp.dll"), os.path.join(self.package_folder, "bin", "qxmpp.dll")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "QXmpp") @@ -91,7 +120,5 @@ def package_info(self): self.cpp_info.libs = ["qxmpp"] self.cpp_info.includedirs.append(os.path.join("include", "qxmpp")) self.cpp_info.requires = ["qt::qtCore", "qt::qtNetwork", "qt::qtXml"] - - # TODO: to remove in conan v2 once cmake_find_package* generators removed - self.cpp_info.names["cmake_find_package"] = "QXmpp" - self.cpp_info.names["cmake_find_package_multi"] = "QXmpp" + if self.options.with_gstreamer: + self.cpp_info.requires.extend(["gstreamer::gstreamer", "glib::glib"]) diff --git a/recipes/qxmpp/all/patches/001-add_conan_1.4.0.patch b/recipes/qxmpp/all/patches/001-add_conan_1.4.0.patch deleted file mode 100644 index da7431faa740a..0000000000000 --- a/recipes/qxmpp/all/patches/001-add_conan_1.4.0.patch +++ /dev/null @@ -1,20 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 550ea39a..9ed4d825 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -8,10 +8,12 @@ set(CMAKE_CXX_STANDARD 17) - set(CMAKE_CXX_STANDARD_REQUIRED ON) - set(CMAKE_CXX_EXTENSIONS OFF) - --set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake/modules") - --find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Network Xml) --find_package(Qt${QT_VERSION_MAJOR} 5.7.0 REQUIRED COMPONENTS Core Network Xml) -+list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR}) -+list(APPEND CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR}) -+ -+find_package(Qt6 COMPONENTS Core Network Xml REQUIRED) -+set(QT_VERSION_MAJOR 6) - - set(CMAKE_AUTOMOC ON) - set(CMAKE_AUTORCC ON) diff --git a/recipes/qxmpp/all/patches/001-skip-module-path.patch b/recipes/qxmpp/all/patches/001-skip-module-path.patch new file mode 100644 index 0000000000000..d499e412b3ef3 --- /dev/null +++ b/recipes/qxmpp/all/patches/001-skip-module-path.patch @@ -0,0 +1,15 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 550ea39..e550959 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -8,10 +8,8 @@ set(CMAKE_CXX_STANDARD 17) + set(CMAKE_CXX_STANDARD_REQUIRED ON) + set(CMAKE_CXX_EXTENSIONS OFF) + +-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake/modules") + + find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Network Xml) +-find_package(Qt${QT_VERSION_MAJOR} 5.7.0 REQUIRED COMPONENTS Core Network Xml) + + set(CMAKE_AUTOMOC ON) + set(CMAKE_AUTORCC ON) diff --git a/recipes/qxmpp/all/patches/002-add_gstreamer_1.4.0.patch b/recipes/qxmpp/all/patches/002-use-conan-gstreamer.patch similarity index 100% rename from recipes/qxmpp/all/patches/002-add_gstreamer_1.4.0.patch rename to recipes/qxmpp/all/patches/002-use-conan-gstreamer.patch diff --git a/recipes/qxmpp/all/test_package/CMakeLists.txt b/recipes/qxmpp/all/test_package/CMakeLists.txt index 4398033dd2797..d6ea9ec68f7ad 100644 --- a/recipes/qxmpp/all/test_package/CMakeLists.txt +++ b/recipes/qxmpp/all/test_package/CMakeLists.txt @@ -1,12 +1,8 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(QXmpp REQUIRED CONFIG) -set(CMAKE_CXX_STANDARD 17) - add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} QXmpp::QXmpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/qxmpp/all/test_package/conanfile.py b/recipes/qxmpp/all/test_package/conanfile.py index 1bf1c7e26255d..ef5d7042163ec 100644 --- a/recipes/qxmpp/all/test_package/conanfile.py +++ b/recipes/qxmpp/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/qxmpp/all/test_package/test_package.cpp b/recipes/qxmpp/all/test_package/test_package.cpp index dabb1c214e126..213a59473e7a4 100644 --- a/recipes/qxmpp/all/test_package/test_package.cpp +++ b/recipes/qxmpp/all/test_package/test_package.cpp @@ -1,7 +1,9 @@ +#include #include #include int main() { QXmppClient client; client.logger()->setLoggingType(QXmppLogger::StdoutLogging); + return EXIT_SUCCESS; } 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..1e70527306c74 100644 --- a/recipes/r8brain-free-src/all/conandata.yml +++ b/recipes/r8brain-free-src/all/conandata.yml @@ -1,4 +1,16 @@ sources: + "6.5": + url: "https://github.com/avaneev/r8brain-free-src/archive/refs/tags/version-6.5.tar.gz" + sha256: "09114b9e6dc6ccee3049534bbb94a7d40a8a07fdfe86e4edce03f76078cee45d" + "6.4": + url: "https://github.com/avaneev/r8brain-free-src/archive/refs/tags/version-6.4.tar.gz" + sha256: "27e6749e140648894b79003fe16a4d416eca3bed8d067e0f00cfb2e246c556ca" + "6.3": + url: "https://github.com/avaneev/r8brain-free-src/archive/refs/tags/version-6.3.tar.gz" + sha256: "f2cd46cd8806294d9be45ed4e6bda5f8ef1dc808625eec3facde784953d2bc23" + "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..50f5693f0f6cb 100644 --- a/recipes/r8brain-free-src/all/conanfile.py +++ b/recipes/r8brain-free-src/all/conanfile.py @@ -1,27 +1,33 @@ +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") + package_type = "library" + 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 +35,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": - self.cpp_info.system_libs.append("pthread") + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["pthread", "m",]) + + 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..79caa70a836d2 100644 --- a/recipes/r8brain-free-src/config.yml +++ b/recipes/r8brain-free-src/config.yml @@ -1,3 +1,11 @@ versions: + "6.5": + folder: all + "6.4": + folder: all + "6.3": + folder: all + "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..2457475388964 100755 --- a/recipes/rabbitmq-c/all/conandata.yml +++ b/recipes/rabbitmq-c/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "0.15.0": + url: "https://github.com/alanxz/rabbitmq-c/archive/v0.15.0.tar.gz" + sha256: "7b652df52c0de4d19ca36c798ed81378cba7a03a0f0c5d498881ae2d79b241c2" + "0.14.0": + url: "https://github.com/alanxz/rabbitmq-c/archive/v0.14.0.tar.gz" + sha256: "839b28eae20075ac58f45925fe991d16a3138cbde015db0ee11df1acb1c493df" + "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..278092bcc50b8 100755 --- a/recipes/rabbitmq-c/all/conanfile.py +++ b/recipes/rabbitmq-c/all/conanfile.py @@ -1,19 +1,21 @@ 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 +from conan.tools.env import VirtualBuildEnv import os -required_conan_version = ">=1.46.0" +required_conan_version = ">=1.53.0" class RabbitmqcConan(ConanFile): name = "rabbitmq-c" + description = "This is a C-language AMQP client library for use with v2.0+ of the RabbitMQ broker." license = "MIT" 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") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -32,19 +34,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.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 <4]") + + def build_requirements(self): + if Version(self.version) >= "0.14.0": + self.tool_requires("cmake/[>=3.22 <4]") def layout(self): cmake_layout(self, src_folder="src") @@ -58,7 +58,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 @@ -70,6 +73,10 @@ def generate(self): deps = CMakeDeps(self) deps.generate() + if Version(self.version) >= "0.14.0": + venv = VirtualBuildEnv(self) + venv.generate(scope="build") + def build(self): cmake = CMake(self) cmake.configure() @@ -77,6 +84,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 +109,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/conanfile.py b/recipes/rabbitmq-c/all/test_package/conanfile.py index ca71e7a1bae14..82d331c47fc53 100644 --- a/recipes/rabbitmq-c/all/test_package/conanfile.py +++ b/recipes/rabbitmq-c/all/test_package/conanfile.py @@ -7,6 +7,10 @@ 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) @@ -17,9 +21,6 @@ def generate(self): tc.variables["WITH_SSL"] = self.dependencies["rabbitmq-c"].options.ssl tc.generate() - def layout(self): - cmake_layout(self) - def build(self): cmake = CMake(self) cmake.configure() 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..b74d07f4b3c76 100644 --- a/recipes/rabbitmq-c/config.yml +++ b/recipes/rabbitmq-c/config.yml @@ -1,8 +1,13 @@ versions: + "0.15.0": + folder: all + "0.14.0": + folder: all + "0.13.0": + folder: all "0.11.0": folder: all "0.10.0": folder: all "0.9.0": folder: all - diff --git a/recipes/ragel/all/CMakeLists.txt b/recipes/ragel/all/CMakeLists.txt index b4afee381476c..1d3d3c24617fe 100644 --- a/recipes/ragel/all/CMakeLists.txt +++ b/recipes/ragel/all/CMakeLists.txt @@ -1,133 +1,131 @@ cmake_minimum_required(VERSION 3.0) -project(ragel) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +project(ragel LANGUAGES CXX) file(GLOB HEADERS - source_subfolder/ragel/buffer.h - source_subfolder/ragel/cdgoto.h - source_subfolder/ragel/cscodegen.h - source_subfolder/ragel/csipgoto.h - source_subfolder/ragel/inputdata.h - source_subfolder/ragel/rbxgoto.h - source_subfolder/ragel/rubyflat.h - source_subfolder/ragel/cdcodegen.h - source_subfolder/ragel/cdipgoto.h - source_subfolder/ragel/csfflat.h - source_subfolder/ragel/cssplit.h - source_subfolder/ragel/javacodegen.h - source_subfolder/ragel/redfsm.h - source_subfolder/ragel/rubyftable.h - source_subfolder/ragel/cdfflat.h - source_subfolder/ragel/cdsplit.h - source_subfolder/ragel/csfgoto.h - source_subfolder/ragel/cstable.h - source_subfolder/ragel/parsedata.h - source_subfolder/ragel/rlparse.h - source_subfolder/ragel/rubytable.h - source_subfolder/ragel/cdfgoto.h - source_subfolder/ragel/cdtable.h - source_subfolder/ragel/csflat.h - source_subfolder/ragel/dotcodegen.h - source_subfolder/ragel/parsetree.h - source_subfolder/ragel/rlscan.h - source_subfolder/ragel/version.h - source_subfolder/ragel/cdflat.h - source_subfolder/ragel/common.h - source_subfolder/ragel/csftable.h - source_subfolder/ragel/fsmgraph.h - source_subfolder/ragel/pcheck.h - source_subfolder/ragel/rubycodegen.h - source_subfolder/ragel/xmlcodegen.h - source_subfolder/ragel/cdftable.h - source_subfolder/ragel/csgoto.h - source_subfolder/ragel/gendata.h - source_subfolder/ragel/ragel.h - source_subfolder/ragel/rubyfflat.h - source_subfolder/ragel/gocodegen.h - source_subfolder/ragel/gotable.h - source_subfolder/ragel/goftable.h - source_subfolder/ragel/goflat.h - source_subfolder/ragel/gofflat.h - source_subfolder/ragel/gogoto.h - source_subfolder/ragel/gofgoto.h - source_subfolder/ragel/goipgoto.h - source_subfolder/ragel/gotablish.h - source_subfolder/ragel/mlcodegen.h - source_subfolder/ragel/mltable.h - source_subfolder/ragel/mlftable.h - source_subfolder/ragel/mlflat.h - source_subfolder/ragel/mlfflat.h - source_subfolder/ragel/mlgoto.h - source_subfolder/ragel/mlfgoto.h + ${RAGEL_SOURCE_DIR}/ragel/buffer.h + ${RAGEL_SOURCE_DIR}/ragel/cdgoto.h + ${RAGEL_SOURCE_DIR}/ragel/cscodegen.h + ${RAGEL_SOURCE_DIR}/ragel/csipgoto.h + ${RAGEL_SOURCE_DIR}/ragel/inputdata.h + ${RAGEL_SOURCE_DIR}/ragel/rbxgoto.h + ${RAGEL_SOURCE_DIR}/ragel/rubyflat.h + ${RAGEL_SOURCE_DIR}/ragel/cdcodegen.h + ${RAGEL_SOURCE_DIR}/ragel/cdipgoto.h + ${RAGEL_SOURCE_DIR}/ragel/csfflat.h + ${RAGEL_SOURCE_DIR}/ragel/cssplit.h + ${RAGEL_SOURCE_DIR}/ragel/javacodegen.h + ${RAGEL_SOURCE_DIR}/ragel/redfsm.h + ${RAGEL_SOURCE_DIR}/ragel/rubyftable.h + ${RAGEL_SOURCE_DIR}/ragel/cdfflat.h + ${RAGEL_SOURCE_DIR}/ragel/cdsplit.h + ${RAGEL_SOURCE_DIR}/ragel/csfgoto.h + ${RAGEL_SOURCE_DIR}/ragel/cstable.h + ${RAGEL_SOURCE_DIR}/ragel/parsedata.h + ${RAGEL_SOURCE_DIR}/ragel/rlparse.h + ${RAGEL_SOURCE_DIR}/ragel/rubytable.h + ${RAGEL_SOURCE_DIR}/ragel/cdfgoto.h + ${RAGEL_SOURCE_DIR}/ragel/cdtable.h + ${RAGEL_SOURCE_DIR}/ragel/csflat.h + ${RAGEL_SOURCE_DIR}/ragel/dotcodegen.h + ${RAGEL_SOURCE_DIR}/ragel/parsetree.h + ${RAGEL_SOURCE_DIR}/ragel/rlscan.h + ${RAGEL_SOURCE_DIR}/ragel/version.h + ${RAGEL_SOURCE_DIR}/ragel/cdflat.h + ${RAGEL_SOURCE_DIR}/ragel/common.h + ${RAGEL_SOURCE_DIR}/ragel/csftable.h + ${RAGEL_SOURCE_DIR}/ragel/fsmgraph.h + ${RAGEL_SOURCE_DIR}/ragel/pcheck.h + ${RAGEL_SOURCE_DIR}/ragel/rubycodegen.h + ${RAGEL_SOURCE_DIR}/ragel/xmlcodegen.h + ${RAGEL_SOURCE_DIR}/ragel/cdftable.h + ${RAGEL_SOURCE_DIR}/ragel/csgoto.h + ${RAGEL_SOURCE_DIR}/ragel/gendata.h + ${RAGEL_SOURCE_DIR}/ragel/ragel.h + ${RAGEL_SOURCE_DIR}/ragel/rubyfflat.h + ${RAGEL_SOURCE_DIR}/ragel/gocodegen.h + ${RAGEL_SOURCE_DIR}/ragel/gotable.h + ${RAGEL_SOURCE_DIR}/ragel/goftable.h + ${RAGEL_SOURCE_DIR}/ragel/goflat.h + ${RAGEL_SOURCE_DIR}/ragel/gofflat.h + ${RAGEL_SOURCE_DIR}/ragel/gogoto.h + ${RAGEL_SOURCE_DIR}/ragel/gofgoto.h + ${RAGEL_SOURCE_DIR}/ragel/goipgoto.h + ${RAGEL_SOURCE_DIR}/ragel/gotablish.h + ${RAGEL_SOURCE_DIR}/ragel/mlcodegen.h + ${RAGEL_SOURCE_DIR}/ragel/mltable.h + ${RAGEL_SOURCE_DIR}/ragel/mlftable.h + ${RAGEL_SOURCE_DIR}/ragel/mlflat.h + ${RAGEL_SOURCE_DIR}/ragel/mlfflat.h + ${RAGEL_SOURCE_DIR}/ragel/mlgoto.h + ${RAGEL_SOURCE_DIR}/ragel/mlfgoto.h ) file(GLOB SRC - source_subfolder/ragel/main.cpp - source_subfolder/ragel/parsetree.cpp - source_subfolder/ragel/parsedata.cpp - source_subfolder/ragel/fsmstate.cpp - source_subfolder/ragel/fsmbase.cpp - source_subfolder/ragel/fsmattach.cpp - source_subfolder/ragel/fsmmin.cpp - source_subfolder/ragel/fsmgraph.cpp - source_subfolder/ragel/fsmap.cpp - source_subfolder/ragel/rlscan.cpp - source_subfolder/ragel/rlparse.cpp - source_subfolder/ragel/inputdata.cpp - source_subfolder/ragel/common.cpp - source_subfolder/ragel/redfsm.cpp - source_subfolder/ragel/gendata.cpp - source_subfolder/ragel/cdcodegen.cpp - source_subfolder/ragel/cdtable.cpp - source_subfolder/ragel/cdftable.cpp - source_subfolder/ragel/cdflat.cpp - source_subfolder/ragel/cdfflat.cpp - source_subfolder/ragel/cdgoto.cpp - source_subfolder/ragel/cdfgoto.cpp - source_subfolder/ragel/cdipgoto.cpp - source_subfolder/ragel/cdsplit.cpp - source_subfolder/ragel/javacodegen.cpp - source_subfolder/ragel/rubycodegen.cpp - source_subfolder/ragel/rubytable.cpp - source_subfolder/ragel/rubyftable.cpp - source_subfolder/ragel/rubyflat.cpp - source_subfolder/ragel/rubyfflat.cpp - source_subfolder/ragel/rbxgoto.cpp - source_subfolder/ragel/cscodegen.cpp - source_subfolder/ragel/cstable.cpp - source_subfolder/ragel/csftable.cpp - source_subfolder/ragel/csflat.cpp - source_subfolder/ragel/csfflat.cpp - source_subfolder/ragel/csgoto.cpp - source_subfolder/ragel/csfgoto.cpp - source_subfolder/ragel/csipgoto.cpp - source_subfolder/ragel/cssplit.cpp - source_subfolder/ragel/dotcodegen.cpp - source_subfolder/ragel/xmlcodegen.cpp - source_subfolder/ragel/gocodegen.cpp - source_subfolder/ragel/gotable.cpp - source_subfolder/ragel/goftable.cpp - source_subfolder/ragel/goflat.cpp - source_subfolder/ragel/gofflat.cpp - source_subfolder/ragel/gogoto.cpp - source_subfolder/ragel/gofgoto.cpp - source_subfolder/ragel/goipgoto.cpp - source_subfolder/ragel/gotablish.cpp - source_subfolder/ragel/mlcodegen.cpp - source_subfolder/ragel/mltable.cpp - source_subfolder/ragel/mlftable.cpp - source_subfolder/ragel/mlflat.cpp - source_subfolder/ragel/mlfflat.cpp - source_subfolder/ragel/mlgoto.cpp - source_subfolder/ragel/mlfgoto.cpp + ${RAGEL_SOURCE_DIR}/ragel/main.cpp + ${RAGEL_SOURCE_DIR}/ragel/parsetree.cpp + ${RAGEL_SOURCE_DIR}/ragel/parsedata.cpp + ${RAGEL_SOURCE_DIR}/ragel/fsmstate.cpp + ${RAGEL_SOURCE_DIR}/ragel/fsmbase.cpp + ${RAGEL_SOURCE_DIR}/ragel/fsmattach.cpp + ${RAGEL_SOURCE_DIR}/ragel/fsmmin.cpp + ${RAGEL_SOURCE_DIR}/ragel/fsmgraph.cpp + ${RAGEL_SOURCE_DIR}/ragel/fsmap.cpp + ${RAGEL_SOURCE_DIR}/ragel/rlscan.cpp + ${RAGEL_SOURCE_DIR}/ragel/rlparse.cpp + ${RAGEL_SOURCE_DIR}/ragel/inputdata.cpp + ${RAGEL_SOURCE_DIR}/ragel/common.cpp + ${RAGEL_SOURCE_DIR}/ragel/redfsm.cpp + ${RAGEL_SOURCE_DIR}/ragel/gendata.cpp + ${RAGEL_SOURCE_DIR}/ragel/cdcodegen.cpp + ${RAGEL_SOURCE_DIR}/ragel/cdtable.cpp + ${RAGEL_SOURCE_DIR}/ragel/cdftable.cpp + ${RAGEL_SOURCE_DIR}/ragel/cdflat.cpp + ${RAGEL_SOURCE_DIR}/ragel/cdfflat.cpp + ${RAGEL_SOURCE_DIR}/ragel/cdgoto.cpp + ${RAGEL_SOURCE_DIR}/ragel/cdfgoto.cpp + ${RAGEL_SOURCE_DIR}/ragel/cdipgoto.cpp + ${RAGEL_SOURCE_DIR}/ragel/cdsplit.cpp + ${RAGEL_SOURCE_DIR}/ragel/javacodegen.cpp + ${RAGEL_SOURCE_DIR}/ragel/rubycodegen.cpp + ${RAGEL_SOURCE_DIR}/ragel/rubytable.cpp + ${RAGEL_SOURCE_DIR}/ragel/rubyftable.cpp + ${RAGEL_SOURCE_DIR}/ragel/rubyflat.cpp + ${RAGEL_SOURCE_DIR}/ragel/rubyfflat.cpp + ${RAGEL_SOURCE_DIR}/ragel/rbxgoto.cpp + ${RAGEL_SOURCE_DIR}/ragel/cscodegen.cpp + ${RAGEL_SOURCE_DIR}/ragel/cstable.cpp + ${RAGEL_SOURCE_DIR}/ragel/csftable.cpp + ${RAGEL_SOURCE_DIR}/ragel/csflat.cpp + ${RAGEL_SOURCE_DIR}/ragel/csfflat.cpp + ${RAGEL_SOURCE_DIR}/ragel/csgoto.cpp + ${RAGEL_SOURCE_DIR}/ragel/csfgoto.cpp + ${RAGEL_SOURCE_DIR}/ragel/csipgoto.cpp + ${RAGEL_SOURCE_DIR}/ragel/cssplit.cpp + ${RAGEL_SOURCE_DIR}/ragel/dotcodegen.cpp + ${RAGEL_SOURCE_DIR}/ragel/xmlcodegen.cpp + ${RAGEL_SOURCE_DIR}/ragel/gocodegen.cpp + ${RAGEL_SOURCE_DIR}/ragel/gotable.cpp + ${RAGEL_SOURCE_DIR}/ragel/goftable.cpp + ${RAGEL_SOURCE_DIR}/ragel/goflat.cpp + ${RAGEL_SOURCE_DIR}/ragel/gofflat.cpp + ${RAGEL_SOURCE_DIR}/ragel/gogoto.cpp + ${RAGEL_SOURCE_DIR}/ragel/gofgoto.cpp + ${RAGEL_SOURCE_DIR}/ragel/goipgoto.cpp + ${RAGEL_SOURCE_DIR}/ragel/gotablish.cpp + ${RAGEL_SOURCE_DIR}/ragel/mlcodegen.cpp + ${RAGEL_SOURCE_DIR}/ragel/mltable.cpp + ${RAGEL_SOURCE_DIR}/ragel/mlftable.cpp + ${RAGEL_SOURCE_DIR}/ragel/mlflat.cpp + ${RAGEL_SOURCE_DIR}/ragel/mlfflat.cpp + ${RAGEL_SOURCE_DIR}/ragel/mlgoto.cpp + ${RAGEL_SOURCE_DIR}/ragel/mlfgoto.cpp ) add_executable(${CMAKE_PROJECT_NAME} ${SRC} ${HEADERS}) target_link_libraries(${CMAKE_PROJECT_NAME} PUBLIC ${CONAN_LIBS}) -target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE source_subfolder/aapl - PRIVATE ${CMAKE_BINARY_DIR}) +target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE ${RAGEL_SOURCE_DIR}/aapl + PRIVATE ${CMAKE_SOURCE_DIR} + PRIVATE ${CMAKE_BINARY_DIR}) install(TARGETS ${CMAKE_PROJECT_NAME} RUNTIME DESTINATION bin) diff --git a/recipes/ragel/all/conandata.yml b/recipes/ragel/all/conandata.yml index a561cfe4c7dce..cef6c070a411d 100644 --- a/recipes/ragel/all/conandata.yml +++ b/recipes/ragel/all/conandata.yml @@ -2,8 +2,8 @@ sources: "6.10": url: "http://www.colm.net/files/ragel/ragel-6.10.tar.gz" sha256: "5f156edb65d20b856d638dd9ee2dfb43285914d9aa2b6ec779dac0270cd56c3f" - patches: "6.10": - patch_file: "patches/0001-unistd.patch" - base_path: "source_subfolder" + patch_description: "don't include unistd.h on MSVC" + patch_type: "portability" diff --git a/recipes/ragel/all/conanfile.py b/recipes/ragel/all/conanfile.py index ab235df3cddb0..f91723125a17b 100644 --- a/recipes/ragel/all/conanfile.py +++ b/recipes/ragel/all/conanfile.py @@ -1,68 +1,89 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment, CMake +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, export_conandata_patches, get, copy, rmdir +from conan.tools.layout import basic_layout +from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.env import VirtualBuildEnv import os -import glob +required_conan_version = ">=1.53.0" class RagelConan(ConanFile): name = "ragel" description = "Ragel compiles executable finite state machines from regular languages" - homepage = "http://www.colm.net/open-source/ragel" - url = "https://github.com/conan-io/conan-center-index" license = "GPL-2.0-or-later" - topics = ("ragel", "FSM", "regex", "fsm-compiler") - exports_sources = ["CMakeLists.txt", "config.h", "patches/*"] - generators = "cmake" + url = "https://github.com/conan-io/conan-center-index" + homepage = "http://www.colm.net/open-source/ragel" + topics = ("FSM", "regex", "fsm-compiler") + package_type = "application" settings = "os", "arch", "compiler", "build_type" - _cmake = None - _autotools = None - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder) + copy(self, "config.h", src=self.recipe_folder, dst=self.export_sources_folder) + export_conandata_patches(self) + + def layout(self): + if self.settings.os == "Windows": + cmake_layout(self, src_folder="src") + else: + basic_layout(self, src_folder="src") + + 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 generate(self): + if self.settings.os == "Windows": + tc = CMakeToolchain(self) + tc.variables["RAGEL_SOURCE_DIR"] = self.source_folder.replace("\\", "/") + tc.generate() - def _configure_autotools(self): - if not self._autotools: - self._autotools = AutoToolsBuildEnvironment(self) - self._autotools.configure(configure_dir=self._source_subfolder) - return self._autotools + dpes = CMakeDeps(self) + dpes.generate() + else: + env = VirtualBuildEnv(self) + env.generate() + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") + tc = AutotoolsToolchain(self) + tc.generate() - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.configure() - return self._cmake + 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(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() 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) - self.copy(pattern="CREDITS", dst="licenses", src=self._source_subfolder) + copy(self, pattern="COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, pattern="CREDITS", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) if self.settings.os == "Windows": - cmake = self._configure_cmake() + cmake = CMake(self) cmake.install() else: - autotools = self._configure_autotools() + autotools = Autotools(self) autotools.install() - 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, "share")) def package_info(self): + self.cpp_info.includedirs = [] + self.cpp_info.libdirs = [] + self.env_info.RAGEL_ROOT = self.package_folder bindir = os.path.join(self.package_folder, "bin") self.output.info("Appending PATH environment variable: {}".format(bindir)) diff --git a/recipes/ragel/all/test_package/conanfile.py b/recipes/ragel/all/test_package/conanfile.py index 0299aedde34df..9eec930f11301 100644 --- a/recipes/ragel/all/test_package/conanfile.py +++ b/recipes/ragel/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, 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" + + def layout(self): + cmake_layout(self) - settings = "os", "arch", "build_type", "compiler" + def requirements(self): + self.requires(self.tested_reference_str) def test(self): - if not tools.cross_building(self): - self.run("ragel --version", run_environment=True) + if can_run(self): + self.run("ragel --version", env="conanrun") diff --git a/recipes/ragel/all/test_v1_package/conanfile.py b/recipes/ragel/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..0299aedde34df --- /dev/null +++ b/recipes/ragel/all/test_v1_package/conanfile.py @@ -0,0 +1,10 @@ +from conans import ConanFile, tools + + +class TestPackageConan(ConanFile): + + settings = "os", "arch", "build_type", "compiler" + + def test(self): + if not tools.cross_building(self): + self.run("ragel --version", run_environment=True) diff --git a/recipes/rang/all/conanfile.py b/recipes/rang/all/conanfile.py index eea064dea63c0..b3e6ab15e5261 100644 --- a/recipes/rang/all/conanfile.py +++ b/recipes/rang/all/conanfile.py @@ -1,6 +1,10 @@ -from conans import ConanFile, Meson, 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.50.0" + class RangConan(ConanFile): name = "rang" @@ -8,18 +12,29 @@ class RangConan(ConanFile): homepage = "https://github.com/agauniyal/rang" url = "https://github.com/conan-io/conan-center-index" license = "Unlicense" - topics = ("conan", "cli", "colors", "terminal", "console") + topics = ("cli", "colors", "terminal", "console") + package_type = "header-library" + 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]) - 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 build(self): + pass def package(self): - self.copy("*.hpp", src=self._source_subfolder) - 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")) + 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", "rang") + self.cpp_info.set_property("cmake_target_name", "rang::rang") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/rang/all/test_package/CMakeLists.txt b/recipes/rang/all/test_package/CMakeLists.txt index aede60e3b1e4a..ad056deea8682 100644 --- a/recipes/rang/all/test_package/CMakeLists.txt +++ b/recipes/rang/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(rang 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 rang::rang) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/rang/all/test_package/conanfile.py b/recipes/rang/all/test_package/conanfile.py index 560a8369d4fa0..0a6bc68712d90 100644 --- a/recipes/rang/all/test_package/conanfile.py +++ b/recipes/rang/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(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/rang/all/test_v1_package/CMakeLists.txt b/recipes/rang/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/rang/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/rang/all/test_v1_package/conanfile.py b/recipes/rang/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/rang/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/range-v3/all/conandata.yml b/recipes/range-v3/all/conandata.yml index 1e7ea8c024212..0b45a37f14d0e 100644 --- a/recipes/range-v3/all/conandata.yml +++ b/recipes/range-v3/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "cci.20240905": + url: https://github.com/ericniebler/range-v3/archive/a33616bfdb642744acaa937a3f258fba384b7fd4.tar.gz + sha256: d5cc3bf42825097c55c1c6a1f0158eb8fbceb0653935f2f7d2b5286c827dd834 "0.12.0": url: https://github.com/ericniebler/range-v3/archive/refs/tags/0.12.0.tar.gz sha256: 015adb2300a98edfceaf0725beec3337f542af4915cec4d0b89fa0886f4ba9cb diff --git a/recipes/range-v3/all/conanfile.py b/recipes/range-v3/all/conanfile.py index 4f9a2a5174d9a..a5064cb229661 100644 --- a/recipes/range-v3/all/conanfile.py +++ b/recipes/range-v3/all/conanfile.py @@ -16,7 +16,8 @@ class Rangev3Conan(ConanFile): license = "BSL-1.0" homepage = "https://github.com/ericniebler/range-v3" url = "https://github.com/conan-io/conan-center-index" - description = "Experimental range library for C++11/14/17" + package_type = "header-library" + description = "Range library for C++14/17/20, basis for C++20's std::ranges" topics = ("range", "range-library", "proposal", "iterator", "header-only") settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -36,9 +37,9 @@ def _min_cppstd(self): return "17" else: return "14" - + def layout(self): - basic_layout(self) + basic_layout(self, src_folder="src") def package_id(self): self.info.clear() @@ -67,6 +68,8 @@ def package(self): self.package_folder, "licenses"), src=self.source_folder) def package_info(self): + self.cpp_info.libdirs = [] + self.cpp_info.bindirs = [] 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 is_msvc(self): diff --git a/recipes/range-v3/config.yml b/recipes/range-v3/config.yml index 5ed235c09031b..8df94b876518b 100644 --- a/recipes/range-v3/config.yml +++ b/recipes/range-v3/config.yml @@ -1,4 +1,6 @@ versions: + "cci.20240905": + folder: all "0.12.0": folder: all "0.11.0": diff --git a/recipes/rangeless/all/conanfile.py b/recipes/rangeless/all/conanfile.py index d37a7eb54aeb3..4eb06ece4e627 100644 --- a/recipes/rangeless/all/conanfile.py +++ b/recipes/rangeless/all/conanfile.py @@ -1,34 +1,66 @@ -from conans import ConanFile, tools import os -import glob + +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.52.0" + class RangelessConan(ConanFile): name = "rangeless" description = "c++ LINQ -like library of higher-order functions for data manipulation" license = "MIT" - homepage = "https://github.com/ast-al/rangeless" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/ast-al/rangeless" topics = ("range", "linq", "lazy-evaluation", "header-only") - settings = "compiler" + + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 14 - def configure(self): - minimal_cpp_standard = "14" - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, minimal_cpp_standard) + @property + def _compilers_minimum_version(self): + return { + "gcc": "5", + "clang": "3.4", + "apple-clang": "10", + "Visual Studio": "14", + "msvc": "191", + } + + 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.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.get_safe("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 = glob.glob(self.name + "-*/")[0] - os.rename(extracted_dir, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) 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", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder) + 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.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/rangeless/all/test_package/CMakeLists.txt b/recipes/rangeless/all/test_package/CMakeLists.txt index 5e1e9d9b89fe0..6f31fb97ff44c 100644 --- a/recipes/rangeless/all/test_package/CMakeLists.txt +++ b/recipes/rangeless/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(rangeless REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE rangeless::rangeless) set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14) diff --git a/recipes/rangeless/all/test_package/conanfile.py b/recipes/rangeless/all/test_package/conanfile.py index 6c9d5dba712c7..ef5d7042163ec 100644 --- a/recipes/rangeless/all/test_package/conanfile.py +++ b/recipes/rangeless/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.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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/rangeless/all/test_package/test_package.cpp b/recipes/rangeless/all/test_package/test_package.cpp index 4f49c17e155f2..96e45179153e6 100644 --- a/recipes/rangeless/all/test_package/test_package.cpp +++ b/recipes/rangeless/all/test_package/test_package.cpp @@ -11,7 +11,7 @@ int main() { values = std::move(values) % fn::where([](auto&& _) { return _ % 2 == 0; }) % fn::transform([] (auto&& _) { return _ * 3; }); - + auto expected = std::vector{0,6,12,18,24,30}; bool success = values == expected; diff --git a/recipes/rangeless/all/test_v1_package/CMakeLists.txt b/recipes/rangeless/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/rangeless/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/rangeless/all/test_v1_package/conanfile.py b/recipes/rangeless/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..6c9d5dba712c7 --- /dev/null +++ b/recipes/rangeless/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_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/rangesnext/all/conandata.yml b/recipes/rangesnext/all/conandata.yml index 72383f2492ee7..f52ac4400f69a 100644 --- a/recipes/rangesnext/all/conandata.yml +++ b/recipes/rangesnext/all/conandata.yml @@ -1,8 +1,4 @@ sources: "cci.20210426": url: "https://github.com/cor3ntin/rangesnext/archive/10fd1cffe7a2a9688a31f91ec8754668c4cdd9a6.tar.gz" - sha256: 8b4ba9129346818d1ad2ab1fe00ccb85c5c1b35fef91868aece97aa079e0dec4 -patches: - "cci.20210426": - - patch_file: "patches/0001-cmake-disable-tests.patch" - base_path: "source_subfolder" + sha256: "8b4ba9129346818d1ad2ab1fe00ccb85c5c1b35fef91868aece97aa079e0dec4" diff --git a/recipes/rangesnext/all/conanfile.py b/recipes/rangesnext/all/conanfile.py index b438391b226f9..6c7782838deee 100644 --- a/recipes/rangesnext/all/conanfile.py +++ b/recipes/rangesnext/all/conanfile.py @@ -1,37 +1,68 @@ -from conans import ConanFile, 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.files import copy, get +from conan.tools.layout import basic_layout +from conan.tools.scm import Version + +required_conan_version = ">=1.52.0" + class RangesnextConan(ConanFile): name = "rangesnext" description = "ranges features for C++23 ported to C++20" - topics = ("conan", "rangesnext", "ranges", "backport", "backport-cpp") + license = "BSL-1.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/cor3ntin/rangesnext" - license = "BSL-1.0" - settings = "compiler" + topics = ("ranges", "backport", "backport-cpp", "header-only") + + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - _compilers_minimum_version = { - "gcc": "10", - "Visual Studio": "19", - "clang": "13" - } - _source_subfolder = "source_subfolder" + @property + def _min_cppstd(self): + return 20 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "10", + "msvc": "193", + "Visual Studio": "17", + } + + 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, "20") + check_min_cppstd(self, self._min_cppstd) + + if "clang" in str(self.settings.compiler): + raise ConanInvalidConfiguration("rangesnext is not compatible with Clang") minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) - if not minimum_version or tools.Version(self.settings.compiler.version) < minimum_version: + if not minimum_version or Version(self.settings.compiler.version) < minimum_version: raise ConanInvalidConfiguration("rangesnext requires C++20, which your compiler does not fully support.") 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): - include_folder = os.path.join(self._source_subfolder, "include") - self.copy(pattern="LICENSE.md", dst="licenses", src=self._source_subfolder) - self.copy(pattern="*", dst="include", src=include_folder) + include_folder = os.path.join(self.source_folder, "include") + copy(self, "LICENSE.md", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder) + copy(self, "*", + dst=os.path.join(self.package_folder, "include"), + src=include_folder) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/rangesnext/all/test_package/CMakeLists.txt b/recipes/rangesnext/all/test_package/CMakeLists.txt index 2bd2a465ffb06..9b8b15ab7a013 100644 --- a/recipes/rangesnext/all/test_package/CMakeLists.txt +++ b/recipes/rangesnext/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.15) +project(test_package LANGUAGES CXX) find_package(rangesnext REQUIRED CONFIG) diff --git a/recipes/rangesnext/all/test_package/conanfile.py b/recipes/rangesnext/all/test_package/conanfile.py index 6c9d5dba712c7..ef5d7042163ec 100644 --- a/recipes/rangesnext/all/test_package/conanfile.py +++ b/recipes/rangesnext/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.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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/rangesnext/all/test_package/test_package.cpp b/recipes/rangesnext/all/test_package/test_package.cpp index e25f23d096604..f1a7ea7bef564 100644 --- a/recipes/rangesnext/all/test_package/test_package.cpp +++ b/recipes/rangesnext/all/test_package/test_package.cpp @@ -1,6 +1,7 @@ -#include #include +#include + namespace rangesnext = cor3ntin::rangesnext; template @@ -12,11 +13,11 @@ bool test_enumerate_with(RangeT &&range) { bool success = true; for (auto &&[i, v] : enumerated_range) { - std::cout << i << " - " << v << "\n"; + std::cout << i << " - " << v << "\n"; success = (i == idx_ref++) && (v == *it_ref++); if (success == false) { - return false; + return false; } } diff --git a/recipes/rangesnext/all/test_v1_package/CMakeLists.txt b/recipes/rangesnext/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/rangesnext/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/rangesnext/all/test_v1_package/conanfile.py b/recipes/rangesnext/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..6c9d5dba712c7 --- /dev/null +++ b/recipes/rangesnext/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_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/rapidcheck/all/CMakeLists.txt b/recipes/rapidcheck/all/CMakeLists.txt deleted file mode 100644 index a69305eb3971f..0000000000000 --- a/recipes/rapidcheck/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/rapidcheck/all/conandata.yml b/recipes/rapidcheck/all/conandata.yml index 816066e810095..b501c3fddaaca 100644 --- a/recipes/rapidcheck/all/conandata.yml +++ b/recipes/rapidcheck/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "cci.20230815": + url: "https://github.com/emil-e/rapidcheck/archive/1c91f40e64d87869250cfb610376c629307bf77d.zip" + sha256: "21dc5ed99390bc62e10f45698aff2704cf994c27cb388b0296db741bf128d803" "cci.20220514": url: "https://github.com/emil-e/rapidcheck/archive/8fafda42e732164db58003e542196e94a28481f9.zip" sha256: "63853f74026678b5cfed5f18f5d8cbd4eccb2f48bb89a8f8cb1cd1cc69f22db8" @@ -14,13 +17,17 @@ sources: patches: "cci.20220514": - patch_file: "patches/0001-gtest-catch-integration-20220514.patch" - base_path: "source_subfolder" + patch_description: "Remove dependency on test frameworks for for rapidcheck tests" + patch_type: "conan" "cci.20210702": - patch_file: "patches/0001-gtest-catch-integration-20210702.patch" - base_path: "source_subfolder" + patch_description: "Remove dependency on test frameworks for for rapidcheck tests" + patch_type: "conan" "cci.20210107": - patch_file: "patches/0001-gtest-catch-integration-20210107.patch" - base_path: "source_subfolder" + patch_description: "Remove dependency on test frameworks for for rapidcheck tests" + patch_type: "conan" "cci.20200131": - patch_file: "patches/0001-gtest-catch-integration-20200131.patch" - base_path: "source_subfolder" + patch_description: "Remove dependency on test frameworks for for rapidcheck tests" + patch_type: "conan" diff --git a/recipes/rapidcheck/all/conanfile.py b/recipes/rapidcheck/all/conanfile.py index 3d44c790196ba..8f0ec69d27e6a 100644 --- a/recipes/rapidcheck/all/conanfile.py +++ b/recipes/rapidcheck/all/conanfile.py @@ -1,10 +1,14 @@ -from conans import CMake, ConanFile, tools -from conans.errors import ConanInvalidConfiguration -import os -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, export_conandata_patches, get, copy, rmdir, save +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version +from os.path import join import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class RapidcheckConan(ConanFile): @@ -14,7 +18,7 @@ class RapidcheckConan(ConanFile): homepage = "https://github.com/emil-e/rapidcheck" license = "BSD-2-Clause" topics = ("quickcheck", "testing", "property-testing") - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -33,24 +37,12 @@ class RapidcheckConan(ConanFile): "enable_gtest": False, } - generators = "cmake", "cmake_find_package" - - @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": @@ -58,53 +50,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): if self.options.enable_catch: - self.requires("catch2/2.13.9") + self.requires("catch2/2.13.10") if self.options.enable_gmock or self.options.enable_gtest: - self.requires("gtest/1.11.0") + self.requires("gtest/1.12.1") 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("shared is not supported using Visual Studio") - if self.options.enable_gmock and not self.deps_cpp_info["gtest"].build_gmock: - raise ConanInvalidConfiguration("The option `rapidcheck:enable_gmock` requires gtest:build_gmock=True`") + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + 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 self.options.enable_gmock and not self.dependencies["gtest"].options.build_gmock: + raise ConanInvalidConfiguration("The option `rapidcheck:enable_gmock` requires `gtest/*:build_gmock=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], strip_root=True) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["RC_ENABLE_RTTI"] = self.options.enable_rtti - cmake.definitions["RC_ENABLE_TESTS"] = False - cmake.definitions["RC_ENABLE_EXAMPLES"] = False - cmake.definitions["RC_ENABLE_CATCH"] = self.options.enable_catch - cmake.definitions["RC_ENABLE_GMOCK"] = self.options.enable_gmock - cmake.definitions["RC_ENABLE_GTEST"] = self.options.enable_gtest - cmake.configure(build_folder=self._build_subfolder) - return cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["RC_ENABLE_RTTI"] = self.options.enable_rtti + tc.variables["RC_ENABLE_TESTS"] = False + tc.variables["RC_ENABLE_EXAMPLES"] = False + tc.variables["RC_ENABLE_CATCH"] = self.options.enable_catch + tc.variables["RC_ENABLE_GMOCK"] = self.options.enable_gmock + tc.variables["RC_ENABLE_GTEST"] = self.options.enable_gtest + 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 package(self): - self.copy(pattern="LICENSE*", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, pattern="LICENSE*", dst=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, 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), + join(self.package_folder, self._module_file_rel_path), { "rapidcheck": "rapidcheck::rapidcheck_rapidcheck", "rapidcheck_catch":"rapidcheck::rapidcheck_catch", @@ -113,8 +109,7 @@ 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("""\ @@ -123,11 +118,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 join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") def package_info(self): self.cpp_info.set_property("cmake_file_name", "rapidcheck") @@ -135,7 +130,7 @@ def package_info(self): self.cpp_info.components["rapidcheck_rapidcheck"].set_property("cmake_target_name", "rapidcheck") self.cpp_info.components["rapidcheck_rapidcheck"].libs = ["rapidcheck"] version = str(self.version)[4:] - if tools.Version(version) < "20201218": + if Version(version) < "20201218": if self.options.enable_rtti: self.cpp_info.components["rapidcheck_rapidcheck"].defines.append("RC_USE_RTTI") else: @@ -152,6 +147,9 @@ def package_info(self): self.cpp_info.components["rapidcheck_gtest"].set_property("cmake_target_name", "rapidcheck_gtest") self.cpp_info.components["rapidcheck_gtest"].requires = ["rapidcheck_rapidcheck", "gtest::gtest"] + 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["rapidcheck_rapidcheck"].build_modules["cmake_find_package"] = [self._module_file_rel_path] self.cpp_info.components["rapidcheck_rapidcheck"].build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] diff --git a/recipes/rapidcheck/all/test_package/CMakeLists.txt b/recipes/rapidcheck/all/test_package/CMakeLists.txt index f139bd8803fd4..dd2ba2ff70ddf 100644 --- a/recipes/rapidcheck/all/test_package/CMakeLists.txt +++ b/recipes/rapidcheck/all/test_package/CMakeLists.txt @@ -1,11 +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(TARGETS) +project(test_package CXX) find_package(rapidcheck REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} rapidcheck) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE rapidcheck::rapidcheck) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/rapidcheck/all/test_package/conanfile.py b/recipes/rapidcheck/all/test_package/conanfile.py index 49a3a66ea5bad..a9fb96656f203 100644 --- a/recipes/rapidcheck/all/test_package/conanfile.py +++ b/recipes/rapidcheck/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/rapidcheck/all/test_v1_package/CMakeLists.txt b/recipes/rapidcheck/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/rapidcheck/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/rapidcheck/all/test_v1_package/conanfile.py b/recipes/rapidcheck/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..8037a9296cc42 --- /dev/null +++ b/recipes/rapidcheck/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/rapidcheck/config.yml b/recipes/rapidcheck/config.yml index c35d572c8cdf5..02c0d5b9f9431 100644 --- a/recipes/rapidcheck/config.yml +++ b/recipes/rapidcheck/config.yml @@ -1,4 +1,6 @@ versions: + "cci.20230815": + folder: all "cci.20220514": folder: all "cci.20210702": diff --git a/recipes/rapidcsv/all/conandata.yml b/recipes/rapidcsv/all/conandata.yml index 1cab273fd5038..12ca9bb815fc4 100644 --- a/recipes/rapidcsv/all/conandata.yml +++ b/recipes/rapidcsv/all/conandata.yml @@ -1,10 +1,31 @@ sources: + "8.84": + url: "https://github.com/d99kris/rapidcsv/archive/refs/tags/v8.84.tar.gz" + sha256: "213699f46a2a29fc2f45c2f9f66ccbe5383aebe6061445d91ac196e3cf7029c8" + "8.83": + url: "https://github.com/d99kris/rapidcsv/archive/refs/tags/v8.83.tar.gz" + sha256: "9342eeb0ce37e30b778c4c030129d03e99f44a66d4710ac19627187bee774097" + "8.82": + url: "https://github.com/d99kris/rapidcsv/archive/refs/tags/v8.82.tar.gz" + sha256: "4f1f57ca9db0f5447416acbef4e059cbd7cb03f6eb39fec1301732bbedaac927" + "8.80": + url: "https://github.com/d99kris/rapidcsv/archive/refs/tags/v8.80.tar.gz" + sha256: "4c9e01cb2554cc76acac61532ef33b59e5b1f822160d2eb7efee2c128ea7f4c5" + "8.77": + url: "https://github.com/d99kris/rapidcsv/archive/refs/tags/v8.77.tar.gz" + sha256: "2513c05e1a39799edd93787e86bdd83462bee06150b40942879af955288fa495" + "8.75": + url: "https://github.com/d99kris/rapidcsv/archive/refs/tags/v8.75.tar.gz" + sha256: "004454890d371b4db370dfd44d64077f8f9b2b92e59d1d6471e1923f891485be" + "8.69": + url: "https://github.com/d99kris/rapidcsv/archive/refs/tags/v8.69.tar.gz" + sha256: "b63e58b1d18277f0331e211bbe6740587069fcd3e5b5a5fb63be7d2f17250d54" "8.64": - url: "https://github.com/d99kris/rapidcsv/archive/v8.64.tar.gz" + url: "https://github.com/d99kris/rapidcsv/archive/refs/tags/v8.64.tar.gz" sha256: "e2ab5231b6e65f1e168dc279bbba2e34afd43c7bc6e2522726b107bcc4e8ebac" "8.62": url: "https://github.com/d99kris/rapidcsv/archive/refs/tags/v8.62.tar.gz" - sha256: a7efda6324420f2b69d3448672a9553dc91520632409661f9f83ac0425faa31d + sha256: "a7efda6324420f2b69d3448672a9553dc91520632409661f9f83ac0425faa31d" "8.53": url: "https://github.com/d99kris/rapidcsv/archive/refs/tags/v8.53.tar.gz" - sha256: 27cc1d6b924e91b99640aae5c6c286bb60494d0bee1ec10e1bfd39698d30007b + sha256: "27cc1d6b924e91b99640aae5c6c286bb60494d0bee1ec10e1bfd39698d30007b" diff --git a/recipes/rapidcsv/all/conanfile.py b/recipes/rapidcsv/all/conanfile.py index cc5590d743532..758f7e3653563 100644 --- a/recipes/rapidcsv/all/conanfile.py +++ b/recipes/rapidcsv/all/conanfile.py @@ -1,28 +1,48 @@ -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") + package_type = "header-library" + 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..0085f337a09cb 100644 --- a/recipes/rapidcsv/config.yml +++ b/recipes/rapidcsv/config.yml @@ -1,4 +1,18 @@ versions: + "8.84": + folder: "all" + "8.83": + folder: "all" + "8.82": + folder: "all" + "8.80": + folder: "all" + "8.77": + folder: "all" + "8.75": + folder: "all" + "8.69": + folder: "all" "8.64": folder: "all" "8.62": diff --git a/recipes/rapidfuzz/all/conandata.yml b/recipes/rapidfuzz/all/conandata.yml index 25b5f191ef69e..ad858e9a9155c 100644 --- a/recipes/rapidfuzz/all/conandata.yml +++ b/recipes/rapidfuzz/all/conandata.yml @@ -1,4 +1,28 @@ sources: - "cci.20210513": - url: "https://github.com/maxbachmann/rapidfuzz-cpp/archive/d1e82379395cafc6d439c1c1e2cbe7512eaf2518.tar.gz" - sha256: "e5c306aae2fb4b34a381fbffaa97399114f20de14d83914ac2c9013b0226ce57" + "3.1.1": + url: "https://github.com/rapidfuzz/rapidfuzz-cpp/archive/refs/tags/v3.1.1.tar.gz" + sha256: "5a72811a9f5a890c69cb479551c19517426fb793a10780f136eb482c426ec3c8" + "3.0.4": + url: "https://github.com/rapidfuzz/rapidfuzz-cpp/archive/refs/tags/v3.0.4.tar.gz" + sha256: "18d1c41575ceddd6308587da8befc98c85d3b5bc2179d418daffed6d46b8cb0a" + "3.0.2": + url: "https://github.com/rapidfuzz/rapidfuzz-cpp/archive/refs/tags/v3.0.2.tar.gz" + sha256: "4fddce5c0368e78bd604c6b820e6be248d669754715e39b4a8a281bda4c06de1" + "3.0.0": + url: "https://github.com/rapidfuzz/rapidfuzz-cpp/archive/refs/tags/v3.0.0.tar.gz" + sha256: "26a76c5a881c07638567557c1d73f6601f0d444816de03f297d731b1e019f21b" + "2.2.3": + url: "https://github.com/rapidfuzz/rapidfuzz-cpp/archive/refs/tags/v2.2.3.tar.gz" + sha256: "df4412e9593945782de2212095bd4b70a8f8e63ae8f313976c616809be124d2c" + "2.2.0": + url: "https://github.com/rapidfuzz/rapidfuzz-cpp/archive/refs/tags/v2.2.0.tar.gz" + sha256: "8fe2d2792ee8b32598f4aa3aad5db7d449fb3c4a32387080f650335cf4faef81" + "2.1.1": + url: "https://github.com/rapidfuzz/rapidfuzz-cpp/archive/refs/tags/v2.1.1.tar.gz" + sha256: "1680c0dbf77d228ea81825c24755db99ee0e21a8db3663b5136741b3e108c3f2" + "2.0.0": + url: "https://github.com/rapidfuzz/rapidfuzz-cpp/archive/refs/tags/v2.0.0.tar.gz" + sha256: "0d6d399be1de151631bbc189b72089600884831a4dac91e22f17351cef18ae64" + "1.10.4": + url: "https://github.com/rapidfuzz/rapidfuzz-cpp/archive/refs/tags/v1.10.4.tar.gz" + sha256: "84a1ea8759aaa5bc8587c26504421d6fd34ad2a8dc74bf469b0cc3cc6758e17a" diff --git a/recipes/rapidfuzz/all/conanfile.py b/recipes/rapidfuzz/all/conanfile.py index cb32b0856539d..16f3766c7f789 100644 --- a/recipes/rapidfuzz/all/conanfile.py +++ b/recipes/rapidfuzz/all/conanfile.py @@ -1,28 +1,63 @@ -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 +import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" -class RapidFuzzConan(ConanFile): + +class PackageConan(ConanFile): name = "rapidfuzz" - description = "Rapid fuzzy string matching in C++ using the Levenshtein Distance " - topics = ("conan", "cpp", "levenshtein", "string-matching", "string-similarity", "string-comparison") - url = "https://github.com/conan-io/conan-center-index" - homepage = "https://github.com/maxbachmann/rapidfuzz-cpp" + description = "Rapid fuzzy string matching in C++ using the Levenshtein Distance" license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/rapidfuzz/rapidfuzz-cpp" + topics = ("levenshtein", "string-matching", "string-similarity", "string-comparison", "header-only") + package_type = "header-library" + 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): + return { + "Visual Studio": "16", + "msvc": "192", + "gcc": "6", + "clang": "6", + "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): - 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(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - self.copy(pattern="rapidfuzz/*.hpp", dst="include", src=self._source_subfolder) + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + copy(self, "rapidfuzz/*.hpp", self.source_folder, os.path.join(self.package_folder, "include")) + copy(self, "rapidfuzz/*.impl", self.source_folder, 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/rapidfuzz/all/test_package/CMakeLists.txt b/recipes/rapidfuzz/all/test_package/CMakeLists.txt index f32c5aba73017..91a5e1677ee9b 100644 --- a/recipes/rapidfuzz/all/test_package/CMakeLists.txt +++ b/recipes/rapidfuzz/all/test_package/CMakeLists.txt @@ -1,8 +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(rapidfuzz REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE rapidfuzz::rapidfuzz) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/rapidfuzz/all/test_package/conanfile.py b/recipes/rapidfuzz/all/test_package/conanfile.py index bd7165a553cf4..e845ae751a301 100644 --- a/recipes/rapidfuzz/all/test_package/conanfile.py +++ b/recipes/rapidfuzz/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/rapidfuzz/all/test_v1_package/CMakeLists.txt b/recipes/rapidfuzz/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..9d54a092e0a67 --- /dev/null +++ b/recipes/rapidfuzz/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/rapidfuzz/all/test_v1_package/conanfile.py b/recipes/rapidfuzz/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/rapidfuzz/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/rapidfuzz/config.yml b/recipes/rapidfuzz/config.yml index ae15efb3dde59..a9e82dc805840 100644 --- a/recipes/rapidfuzz/config.yml +++ b/recipes/rapidfuzz/config.yml @@ -1,3 +1,19 @@ versions: - "cci.20210513": + "3.1.1": + folder: "all" + "3.0.4": + folder: "all" + "3.0.2": + folder: "all" + "3.0.0": + folder: "all" + "2.2.3": + folder: "all" + "2.2.0": + folder: "all" + "2.1.1": + folder: "all" + "2.0.0": + folder: "all" + "1.10.4": folder: "all" diff --git a/recipes/rapidhash/all/conandata.yml b/recipes/rapidhash/all/conandata.yml new file mode 100644 index 0000000000000..88a70b679bdb8 --- /dev/null +++ b/recipes/rapidhash/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.0": + url: "https://github.com/Nicoshev/rapidhash/archive/refs/tags/rapidhash_v1.0.tar.gz" + sha256: "d295e66eec6745cc0e0c8c65fb8b5edf08ab3af83b0a503c54c6705144b53848" diff --git a/recipes/rapidhash/all/conanfile.py b/recipes/rapidhash/all/conanfile.py new file mode 100644 index 0000000000000..1678dff3fea60 --- /dev/null +++ b/recipes/rapidhash/all/conanfile.py @@ -0,0 +1,49 @@ +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 RapidHashConan(ConanFile): + name = "rapidhash" + description = "Very fast, high quality, platform-independent hashing algorithm" + license = "BSD-2-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/Nicoshev/rapidhash" + topics = ("hash", "wyhash", "header-only") + package_type = "header-library" + 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, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + copy( + self, + "rapidhash.h", + self.source_folder, + os.path.join(self.package_folder, "include"), + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/rapidhash/all/test_package/CMakeLists.txt b/recipes/rapidhash/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..e07f48f4eb8f3 --- /dev/null +++ b/recipes/rapidhash/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(rapidhash REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE rapidhash::rapidhash) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/rapidhash/all/test_package/conanfile.py b/recipes/rapidhash/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/rapidhash/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/rapidhash/all/test_package/test_package.cpp b/recipes/rapidhash/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..5bbba469ee0d5 --- /dev/null +++ b/recipes/rapidhash/all/test_package/test_package.cpp @@ -0,0 +1,12 @@ +#include +#include + +#include "rapidhash.h" + +int main() { + std::string text = "Hello, rapidhash."; + + std::cout << rapidhash(text.data(), text.size()) << '\n'; + + return 0; +} diff --git a/recipes/rapidhash/config.yml b/recipes/rapidhash/config.yml new file mode 100644 index 0000000000000..edab1ee152d36 --- /dev/null +++ b/recipes/rapidhash/config.yml @@ -0,0 +1,3 @@ +versions: + "1.0": + folder: all diff --git a/recipes/rapidjson/all/conandata.yml b/recipes/rapidjson/all/conandata.yml index dd7649f2b814f..4f7c0b1008ac2 100644 --- a/recipes/rapidjson/all/conandata.yml +++ b/recipes/rapidjson/all/conandata.yml @@ -3,6 +3,9 @@ sources: url: "https://github.com/Tencent/rapidjson/archive/v1.1.0.tar.gz" sha256: bf7ced29704a1e696fbccf2a2b4ea068e7774fa37f6d7dd4039d0787f8bed98e # More recent unofficial releases based on commits + "cci.20230929": + url: "https://github.com/Tencent/rapidjson/archive/f9d53419e912910fd8fa57d5705fa41425428c35.tar.gz" + sha256: "2b521dba5c22eaae6e6e7d4d304cb317e2cf8c687c70046b02792c02f78c127e" "cci.20220822": url: "https://github.com/Tencent/rapidjson/archive/06d58b9e848c650114556a23294d0b6440078c61.tar.gz" sha256: 30d28bbe0bfff9d8dc5d3cf62799b6ee550499cc1520e44bdece81e002480d19 diff --git a/recipes/rapidjson/all/conanfile.py b/recipes/rapidjson/all/conanfile.py index 01002651291b6..c1c772ac9d842 100644 --- a/recipes/rapidjson/all/conanfile.py +++ b/recipes/rapidjson/all/conanfile.py @@ -13,11 +13,13 @@ class RapidjsonConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "http://rapidjson.org" license = "MIT" + package_type = "header-library" + package_id_embed_mode = "minor_mode" settings = "os", "arch", "compiler", "build_type" no_copy_source = True def layout(self): - basic_layout(self) + basic_layout(self, src_folder="src") def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True, @@ -33,6 +35,8 @@ def package_id(self): def package_info(self): self.cpp_info.set_property("cmake_file_name", "RapidJSON") self.cpp_info.set_property("cmake_target_name", "rapidjson") + 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"] = "RapidJSON" diff --git a/recipes/rapidjson/config.yml b/recipes/rapidjson/config.yml index 82e5350012d0b..e55a15ea06b31 100644 --- a/recipes/rapidjson/config.yml +++ b/recipes/rapidjson/config.yml @@ -1,6 +1,8 @@ versions: "1.1.0": folder: "all" + "cci.20230929": + folder: "all" "cci.20220822": folder: "all" "cci.20211112": diff --git a/recipes/rapidxml/all/conandata.yml b/recipes/rapidxml/all/conandata.yml index dd0dff4e0d309..76068c74da698 100644 --- a/recipes/rapidxml/all/conandata.yml +++ b/recipes/rapidxml/all/conandata.yml @@ -2,3 +2,9 @@ sources: "1.13": url: "https://sourceforge.net/projects/rapidxml/files/rapidxml/rapidxml%201.13/rapidxml-1.13.zip/download" sha256: "c3f0b886374981bb20fabcf323d755db4be6dba42064599481da64a85f5b3571" +patches: + "1.13": + - patch_file: "patches/1.13-fix-template-compile-issue.patch" + patch_description: "Fix compilation issue: call to function 'print_declaration_node' that is neither visible in the template definition nor found by argument-dependent lookup" + patch_type: "portability" + patch_source: "https://sourceforge.net/p/rapidxml/bugs/16/" diff --git a/recipes/rapidxml/all/conanfile.py b/recipes/rapidxml/all/conanfile.py index f0f3a82548298..5a9da57877b5d 100644 --- a/recipes/rapidxml/all/conanfile.py +++ b/recipes/rapidxml/all/conanfile.py @@ -1,9 +1,9 @@ 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 -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.52.0" class RapiXMLConan(ConanFile): @@ -22,12 +22,15 @@ def package_id(self): def layout(self): basic_layout(self, src_folder="src") + def export_sources(self): + export_conandata_patches(self) + 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.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) diff --git a/recipes/rapidxml/all/patches/1.13-fix-template-compile-issue.patch b/recipes/rapidxml/all/patches/1.13-fix-template-compile-issue.patch new file mode 100644 index 0000000000000..a9cede875ca45 --- /dev/null +++ b/recipes/rapidxml/all/patches/1.13-fix-template-compile-issue.patch @@ -0,0 +1,36 @@ +--- rapidxml_print.hpp ++++ rapidxml_print.hpp +@@ -102,6 +102,33 @@ namespace rapidxml + /////////////////////////////////////////////////////////////////////////// + // Internal printing operations + ++ template ++ inline OutIt print_children(OutIt out, const xml_node *node, int flags, int indent); ++ ++ template ++ inline OutIt print_attributes(OutIt out, const xml_node *node, int flags); ++ ++ template ++ inline OutIt print_data_node(OutIt out, const xml_node *node, int flags, int indent); ++ ++ template ++ inline OutIt print_cdata_node(OutIt out, const xml_node *node, int flags, int indent); ++ ++ template ++ inline OutIt print_element_node(OutIt out, const xml_node *node, int flags, int indent); ++ ++ template ++ inline OutIt print_declaration_node(OutIt out, const xml_node *node, int flags, int indent); ++ ++ template ++ inline OutIt print_comment_node(OutIt out, const xml_node *node, int flags, int indent); ++ ++ template ++ inline OutIt print_doctype_node(OutIt out, const xml_node *node, int flags, int indent); ++ ++ template ++ inline OutIt print_pi_node(OutIt out, const xml_node *node, int flags, int indent); ++ + // Print node + template + inline OutIt print_node(OutIt out, const xml_node *node, int flags, int indent) diff --git a/recipes/rapidxml/all/test_package/test_package.cpp b/recipes/rapidxml/all/test_package/test_package.cpp index 6918baa0545da..efdb15bdbb996 100644 --- a/recipes/rapidxml/all/test_package/test_package.cpp +++ b/recipes/rapidxml/all/test_package/test_package.cpp @@ -1,4 +1,5 @@ #include +#include #include #include @@ -41,5 +42,8 @@ int main(int argc, char **argv) std::cout << std::endl; } + std::cout << "Original xml document:" << std::endl; + std::cout << doc; + return 0; } diff --git a/recipes/rapidyaml/all/conandata.yml b/recipes/rapidyaml/all/conandata.yml index 28db57dc0078f..42ba70633e2ac 100644 --- a/recipes/rapidyaml/all/conandata.yml +++ b/recipes/rapidyaml/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "0.7.1": + url: "https://github.com/biojppm/rapidyaml/releases/download/v0.7.1/rapidyaml-0.7.1-src.tgz" + sha256: "9f7c0df2117c09ea409afef38f27605f79f4455dd73b6b9d6afaed099a627c8a" + "0.7.0": + url: "https://github.com/biojppm/rapidyaml/releases/download/v0.7.0/rapidyaml-0.7.0-src.tgz" + sha256: "ef9f89b68de711c561720f1e70d1594e953356a07d297d36b8ccd3ded0589715" + "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,6 +18,18 @@ sources: url: "https://github.com/biojppm/rapidyaml/releases/download/v0.3.0/rapidyaml-0.3.0-src.tgz" sha256: "38854b8359eaf42cc27352f4b7321f509f6775445a3e2746cc8cd1e468a52aa9" patches: + "0.7.1": + - patch_file: "patches/0.7.1-001-remove-internal-c4core.patch" + patch_description: "disable using internal c4core" + patch_type: "conan" + "0.7.0": + - patch_file: "patches/0.7.0-001-remove-internal-c4core.patch" + patch_description: "disable using internal c4core" + patch_type: "conan" + "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" patch_description: "disable using internal c4core" diff --git a/recipes/rapidyaml/all/conanfile.py b/recipes/rapidyaml/all/conanfile.py index fbdfd5da9b5b7..01c81be0b90ae 100644 --- a/recipes/rapidyaml/all/conanfile.py +++ b/recipes/rapidyaml/all/conanfile.py @@ -6,7 +6,7 @@ from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class RapidYAMLConan(ConanFile): name = "rapidyaml" @@ -21,12 +21,16 @@ class RapidYAMLConan(ConanFile): "fPIC": [True, False], "with_default_callbacks": [True, False], "with_tab_tokens": [True, False], + "with_default_callback_uses_exceptions": [True, False], + "with_assert": [True, False], } default_options = { "shared": False, "fPIC": True, "with_default_callbacks": True, "with_tab_tokens": False, + "with_default_callback_uses_exceptions": False, + "with_assert": False, } @property @@ -41,19 +45,25 @@ def config_options(self): del self.options.fPIC if Version(self.version) < "0.4.0": del self.options.with_tab_tokens + if Version(self.version) < "0.6.0": + del self.options.with_default_callback_uses_exceptions + del self.options.with_assert def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") + # with_default_callback_uses_exceptions should only be valid if with_default_callbacks is true + if not self.options.with_default_callbacks: + self.options.rm_safe("with_default_callback_uses_exceptions") def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("c4core/0.1.10") + if Version(self.version) < "0.6.0": + self.requires("c4core/0.1.11", transitive_headers=True) + else: + self.requires("c4core/0.2.0", transitive_headers=True) def validate(self): if self.info.settings.compiler.cppstd: @@ -68,6 +78,9 @@ def generate(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 + if Version(self.version) >= "0.6.0": + tc.variables["RYML_DEFAULT_CALLBACK_USES_EXCEPTIONS"] = self.options.with_default_callback_uses_exceptions + tc.variables["RYML_USE_ASSERT"] = self.options.with_assert tc.generate() deps = CMakeDeps(self) 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/patches/0.7.0-001-remove-internal-c4core.patch b/recipes/rapidyaml/all/patches/0.7.0-001-remove-internal-c4core.patch new file mode 100644 index 0000000000000..00f7a998b45ee --- /dev/null +++ b/recipes/rapidyaml/all/patches/0.7.0-001-remove-internal-c4core.patch @@ -0,0 +1,53 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 762bb97..d1bc8a7 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -6,7 +6,7 @@ project(ryml + LANGUAGES CXX) + include(./compat.cmake) + +-c4_project(VERSION 0.7.0 STANDALONE ++c4_project(VERSION 0.7.0 + AUTHOR "Joao Paulo Magalhaes ") + + +@@ -27,11 +27,11 @@ option(RYML_INSTALL "Enable install target" ON) + + #------------------------------------------------------- + +-c4_require_subproject(c4core INCORPORATE +- SUBDIRECTORY ${RYML_EXT_DIR}/c4core +- OVERRIDE C4CORE_INSTALL ${RYML_INSTALL} +-) +- ++# c4_require_subproject(c4core INCORPORATE ++# SUBDIRECTORY ${RYML_EXT_DIR}/c4core ++# OVERRIDE C4CORE_INSTALL ${RYML_INSTALL} ++# ) ++find_package(c4core REQUIRED CONFIG) + c4_add_library(ryml + SOURCES + ryml.hpp +@@ -77,10 +77,10 @@ c4_add_library(ryml + INC_DIRS + $ + $ +- LIBS c4core +- INCORPORATE c4core ++ # LIBS c4core ++ LIBS c4core::c4core ++ # INCORPORATE c4core + ) +- + if(RYML_WITH_TAB_TOKENS) + target_compile_definitions(ryml PUBLIC RYML_WITH_TAB_TOKENS) + endif() +@@ -113,7 +113,7 @@ endif() + + if(RYML_INSTALL) + c4_install_target(ryml) +- c4_install_exports(DEPENDENCIES c4core) ++# c4_install_exports(DEPENDENCIES c4core) + c4_pack_project() + endif() + diff --git a/recipes/rapidyaml/all/patches/0.7.1-001-remove-internal-c4core.patch b/recipes/rapidyaml/all/patches/0.7.1-001-remove-internal-c4core.patch new file mode 100644 index 0000000000000..e110ab49f9654 --- /dev/null +++ b/recipes/rapidyaml/all/patches/0.7.1-001-remove-internal-c4core.patch @@ -0,0 +1,50 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index c3841a2..affaa56 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -6,7 +6,7 @@ project(ryml + LANGUAGES CXX) + include(./compat.cmake) + +-c4_project(VERSION 0.7.1 STANDALONE ++c4_project(VERSION 0.7.1 + AUTHOR "Joao Paulo Magalhaes ") + + +@@ -27,11 +27,11 @@ option(RYML_INSTALL "Enable install target" ON) + + #------------------------------------------------------- + +-c4_require_subproject(c4core INCORPORATE +- SUBDIRECTORY ${RYML_EXT_DIR}/c4core +- OVERRIDE C4CORE_INSTALL ${RYML_INSTALL} +-) +- ++# c4_require_subproject(c4core INCORPORATE ++# SUBDIRECTORY ${RYML_EXT_DIR}/c4core ++# OVERRIDE C4CORE_INSTALL ${RYML_INSTALL} ++# ) ++find_package(c4core REQUIRED CONFIG) + c4_add_library(ryml + SOURCES + ryml.hpp +@@ -77,8 +77,8 @@ c4_add_library(ryml + INC_DIRS + $ + $ +- LIBS c4core +- INCORPORATE c4core ++ LIBS c4core::c4core ++# INCORPORATE c4core + ) + + if(RYML_WITH_TAB_TOKENS) +@@ -113,7 +113,7 @@ endif() + + if(RYML_INSTALL) + c4_install_target(ryml) +- c4_install_exports(DEPENDENCIES c4core) ++# c4_install_exports(DEPENDENCIES c4core) + c4_pack_project() + endif() + diff --git a/recipes/rapidyaml/all/test_v1_package/CMakeLists.txt b/recipes/rapidyaml/all/test_v1_package/CMakeLists.txt index 2cbec639fb36c..bc541ea90b512 100644 --- a/recipes/rapidyaml/all/test_v1_package/CMakeLists.txt +++ b/recipes/rapidyaml/all/test_v1_package/CMakeLists.txt @@ -1,15 +1,9 @@ cmake_minimum_required(VERSION 3.8) -project(test_package CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(ryml REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -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) -endif() +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/rapidyaml/config.yml b/recipes/rapidyaml/config.yml index 0c5f8691c06f8..5345cf4f908f1 100644 --- a/recipes/rapidyaml/config.yml +++ b/recipes/rapidyaml/config.yml @@ -1,4 +1,10 @@ versions: + "0.7.1": + folder: all + "0.7.0": + folder: all + "0.5.0": + folder: all "0.4.1": folder: all "0.4.0": diff --git a/recipes/raylib/all/CMakeLists.txt b/recipes/raylib/all/CMakeLists.txt deleted file mode 100644 index 0496b29838549..0000000000000 --- a/recipes/raylib/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/raylib/all/conandata.yml b/recipes/raylib/all/conandata.yml index 17c0c7abb4dfd..ee35279981eed 100644 --- a/recipes/raylib/all/conandata.yml +++ b/recipes/raylib/all/conandata.yml @@ -1,15 +1,27 @@ sources: - "3.5.0": - url: "https://github.com/raysan5/raylib/archive/3.5.0.tar.gz" - sha256: "761985876092fa98a99cbf1fef7ca80c3ee0365fb6a107ab901a272178ba69f5" + "5.5": + url: "https://github.com/raysan5/raylib/archive/refs/tags/5.5.tar.gz" + sha256: "aea98ecf5bc5c5e0b789a76de0083a21a70457050ea4cc2aec7566935f5e258e" + "5.0": + url: "https://github.com/raysan5/raylib/archive/refs/tags/5.0.tar.gz" + sha256: "98f049b9ea2a9c40a14e4e543eeea1a7ec3090ebdcd329c4ca2cf98bc9793482" "4.0.0": - url: "https://github.com/raysan5/raylib/archive/4.0.0.tar.gz" + url: "https://github.com/raysan5/raylib/archive/refs/tags/4.0.0.tar.gz" sha256: "11f6087dc7bedf9efb3f69c0c872f637e421d914e5ecea99bbe7781f173dc38c" - -patches: "3.5.0": - - patch_file: "patches/0001-3.5.0-enable-cmake-build.patch" - base_path: "source_subfolder" + url: "https://github.com/raysan5/raylib/archive/refs/tags/3.5.0.tar.gz" + sha256: "761985876092fa98a99cbf1fef7ca80c3ee0365fb6a107ab901a272178ba69f5" +patches: "4.0.0": - - patch_file: "patches/0001-4.0.0-enable-cmake-build.patch" - base_path: "source_subfolder" + - patch_file: "patches/4.0.0-0001-enable-cmake-build-android.patch" + - patch_file: "patches/4.0.0-0002-win32-glfw3native.patch" + patch_description: "Win32: resolve some symbols re-definition of windows.h in glfw3native.h" + patch_type: "portability" + patch_source: "https://github.com/raysan5/raylib/pull/2643" + "3.5.0": + - patch_file: "patches/3.5.0-0001-enable-cmake-build-android.patch" + - patch_file: "patches/3.5.0-0002-cmake-project.patch" + - patch_file: "patches/3.5.0-0003-win32-glfw3native.patch" + patch_description: "Win32: resolve some symbols re-definition of windows.h in glfw3native.h" + patch_type: "portability" + patch_source: "https://github.com/raysan5/raylib/pull/2643" diff --git a/recipes/raylib/all/conanfile.py b/recipes/raylib/all/conanfile.py index 6003a95f7be72..55bd54cf54ec2 100644 --- a/recipes/raylib/all/conanfile.py +++ b/recipes/raylib/all/conanfile.py @@ -1,8 +1,12 @@ -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 +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.54.0" class RaylibConan(ConanFile): @@ -11,95 +15,138 @@ class RaylibConan(ConanFile): license = "Zlib" url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.raylib.com/" - topics = ("raylib", "gamedev") - + topics = ("gamedev",) + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], - "use_external_glfw": [True, False], - "opengl_version":[None, "3.3","2.1","1.1","ES-2.0"] + "opengl_version": [None, "4.3", "3.3", "2.1", "1.1", "ES-2.0"], + + "customize_build": [True, False], + "module_raudio": [True, False], + "camera_system": [True, False], + "gestures_system": [True, False], + "rprand_generator": [True, False], + "events_waiting": [True, False], + "custom_frame_control": [True, False] } default_options = { "shared": False, "fPIC": True, - "use_external_glfw": True, - "opengl_version" : None + "opengl_version": None, + + "customize_build": False, + "module_raudio": True, + "camera_system": True, + "gestures_system": True, + "rprand_generator": True, + "events_waiting": False, + "custom_frame_control": False } - exports_sources = ["CMakeLists.txt","patches/**"] - generators = "cmake", "cmake_find_package_multi" - _cmake = None - @property - def _source_subfolder(self): - return "source_subfolder" + def _support_custom_modules(self): + return Version(self.version) >= "4.2.0" @property - def _build_subfolder(self): - return "build_subfolder" + def _support_rprand_generator(self): + return Version(self.version) >= "5.0" @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] + def _support_frame_control(self): + return Version(self.version) >= "4.6" + + 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 == "Android": + del self.options.opengl_version + if not self._support_custom_modules: + del self.options.module_raudio + if not self._support_rprand_generator: + del self.options.rprand_generator + if not self._support_frame_control: + del self.options.custom_frame_control 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 not self.options.customize_build: + self.options.rm_safe("module_raudio") + del self.options.camera_system + del self.options.gestures_system + self.options.rm_safe("rprand_generator") + del self.options.events_waiting + self.options.rm_safe("custom_frame_control") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - - if self.options.use_external_glfw and self.settings.os != "Android": - self.requires("glfw/3.3.6") - - if self.settings.os != "Android": + if self.settings.os not in ["Android", "Emscripten"]: + self.requires("glfw/3.4") self.requires("opengl/system") - - if self.settings.os == "Linux": - self.requires("xorg/system") - - def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - + 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.definitions["BUILD_EXAMPLES"] = False + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_EXAMPLES"] = False + if self.settings.os == "Emscripten": + tc.variables["PLATFORM"] = "Web" + tc.variables["USE_EXTERNAL_GLFW"] = "ON" + tc.variables["OPENGL_VERSION"] = "ES 2.0" if self.settings.os == "Android": - self._cmake.definitions["PLATFORM"] = "Android" - self._cmake.definitions["USE_EXTERNAL_GLFW"] = "OFF" - self._cmake.definitions["OPENGL_VERSION"] = "ES 2.0" + tc.variables["PLATFORM"] = "Android" + tc.variables["USE_EXTERNAL_GLFW"] = "OFF" + tc.variables["OPENGL_VERSION"] = "ES 2.0" else: - self._cmake.definitions["USE_EXTERNAL_GLFW"] = "OFF" if self.options.use_external_glfw else "ON" - self._cmake.definitions["OPENGL_VERSION"] = "OFF" if not self.options.opengl_version else self.options.opengl_version - - self._cmake.definitions["WITH_PIC"] = self.options.get_safe("fPIC", True) - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + tc.variables["USE_EXTERNAL_GLFW"] = "ON" + tc.variables["OPENGL_VERSION"] = "OFF" if not self.options.opengl_version else self.options.opengl_version + tc.variables["WITH_PIC"] = self.options.get_safe("fPIC", True) + + tc.variables["CUSTOMIZE_BUILD"] = self.options.customize_build + if self.options.customize_build: + if self._support_custom_modules: + tc.variables["SUPPORT_MODULE_RAUDIO"] = self.options.module_raudio + tc.variables["SUPPORT_EVENTS_WAITING"] = self.options.events_waiting + if self._support_frame_control: + tc.variables["SUPPORT_CUSTOM_FRAME_CONTROL"] = self.options.custom_frame_control + + # this makes it include the headers rcamera.h, rgesture.h and rprand.h + tc.variables["SUPPORT_CAMERA_SYSTEM"] = self.options.camera_system + tc.variables["SUPPORT_GESTURES_SYSTEM"] = self.options.gestures_system + if self._support_rprand_generator: + tc.variables["SUPPORT_RPRAND_GENERATOR"] = self.options.rprand_generator + + # Due to a specific logic of cmakedeps_macros.cmake used by CMakeDeps to try to locate shared libs on Windows + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0054"] = "NEW" + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0091"] = "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", 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")) # TODO: to remove in conan v2 once cmake_find_package* generators removed self._create_cmake_module_alias_targets( @@ -107,44 +154,45 @@ def package(self): {"raylib": "raylib::raylib"} ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + # INFO: Custom modules are enabled by default but need to copy the headers manually + include_path = os.path.join(self.package_folder, "include") + if self.options.get_safe("camera_system", True): + copy(self, pattern="*camera.h", dst=include_path, src=os.path.join(self.source_folder, "src")) + if self.options.get_safe("gestures_system", True): + copy(self, pattern="*gestures.h", dst=include_path, src=os.path.join(self.source_folder, "src")) + if self._support_rprand_generator and self.options.get_safe("rprand_generator", True): + copy(self, pattern="rprand.h", dst=include_path, src=os.path.join(self.source_folder, "src", "external")) + + 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", "raylib") self.cpp_info.set_property("cmake_target_name", "raylib") self.cpp_info.set_property("pkg_config_name", "raylib") libname = "raylib" - if self._is_msvc and not self.options.shared and self.version == '3.5.0': + if is_msvc(self) and not self.options.shared and Version(self.version) < "4.0.0": libname += "_static" self.cpp_info.libs = [libname] - if self._is_msvc and self.options.shared: + if is_msvc(self) and self.options.shared: self.cpp_info.defines.append("USE_LIBTYPE_SHARED") if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.extend(["m", "pthread"]) elif self.settings.os == "Windows": self.cpp_info.system_libs.append("winmm") - self.cpp_info.builddirs.append(self._module_subfolder) - # 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/raylib/all/patches/0001-3.5.0-enable-cmake-build.patch b/recipes/raylib/all/patches/0001-3.5.0-enable-cmake-build.patch deleted file mode 100644 index db2fcdc698196..0000000000000 --- a/recipes/raylib/all/patches/0001-3.5.0-enable-cmake-build.patch +++ /dev/null @@ -1,123 +0,0 @@ -diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt -index 57ba74d4..4f019db1 100644 ---- a/examples/CMakeLists.txt -+++ b/examples/CMakeLists.txt -@@ -28,7 +28,6 @@ if (APPLE AND NOT CMAKE_SYSTEM STRLESS "Darwin-18.0.0") - add_definitions(-DGL_SILENCE_DEPRECATION) - MESSAGE(AUTHOR_WARNING "OpenGL is deprecated starting with macOS 10.14 (Mojave)!") - endif() --list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/rlgl_standalone.c) - - include(CheckIncludeFile) - CHECK_INCLUDE_FILE("stdatomic.h" HAVE_STDATOMIC_H) -@@ -51,6 +50,7 @@ endif() - if(${PLATFORM} MATCHES "Android") - list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/rlgl_standalone.c) - list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/standard_lighting.c) -+ list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/opengl_interop.c) - list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/core/core_3d_picking.c) - list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/core/core_vr_simulator.c) - list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/core/core_3d_camera_free.c) -@@ -119,19 +119,5 @@ foreach(example_source ${example_sources}) - endif() - endforeach() - --if (${PLATFORM} MATCHES "Desktop") -- # rlgl_standalone can't be linked with raylib because of duplicate rlgl symbols -- foreach (example_source "others/rlgl_standalone.c") -- # Create the basename for the example -- get_filename_component(example_name ${example_source} NAME) -- string(REPLACE ".c" "" example_name ${example_name}) -- add_executable(${example_name} ${example_source}) -- add_dependencies(${example_name} raylib) -- target_link_libraries(${example_name} ${raylib_LDFLAGS}) -- target_include_directories(${example_name} PRIVATE ${raylib_INCLUDE_DIRS}) -- -- endforeach() --endif() -- - # Copy all of the resource files to the destination - file(COPY ${example_resources} DESTINATION "resources/") -diff --git a/examples/shapes/shapes_draw_circle_sector.c b/examples/shapes/shapes_draw_circle_sector.c -index 8b1cf6ec..b58f3f35 100644 ---- a/examples/shapes/shapes_draw_circle_sector.c -+++ b/examples/shapes/shapes_draw_circle_sector.c -@@ -57,11 +57,11 @@ int main(void) - - // Draw GUI controls - //------------------------------------------------------------------------------ -- startAngle = GuiSliderBar((Rectangle){ 600, 40, 120, 20}, "StartAngle", startAngle, 0, 720, true ); -- endAngle = GuiSliderBar((Rectangle){ 600, 70, 120, 20}, "EndAngle", endAngle, 0, 720, true); -+ startAngle = GuiSliderBar((Rectangle){ 600, 40, 120, 20}, "StartAngle",NULL, startAngle, 0, 720); -+ endAngle = GuiSliderBar((Rectangle){ 600, 70, 120, 20}, "EndAngle", NULL, endAngle, 0, 720); - -- outerRadius = GuiSliderBar((Rectangle){ 600, 140, 120, 20}, "Radius", outerRadius, 0, 200, true); -- segments = GuiSliderBar((Rectangle){ 600, 170, 120, 20}, "Segments", segments, 0, 100, true); -+ outerRadius = GuiSliderBar((Rectangle){ 600, 140, 120, 20}, "Radius", NULL, outerRadius, 0, 200); -+ segments = GuiSliderBar((Rectangle){ 600, 170, 120, 20}, "Segments", NULL, segments, 0, 100); - //------------------------------------------------------------------------------ - - DrawText(TextFormat("MODE: %s", (segments >= 4)? "MANUAL" : "AUTO"), 600, 200, 10, (segments >= 4)? MAROON : DARKGRAY); -diff --git a/examples/shapes/shapes_draw_ring.c b/examples/shapes/shapes_draw_ring.c -index b363dc07..a18fdaf2 100644 ---- a/examples/shapes/shapes_draw_ring.c -+++ b/examples/shapes/shapes_draw_ring.c -@@ -64,13 +64,13 @@ int main(void) - - // Draw GUI controls - //------------------------------------------------------------------------------ -- startAngle = GuiSliderBar((Rectangle){ 600, 40, 120, 20 }, "StartAngle", startAngle, -450, 450, true); -- endAngle = GuiSliderBar((Rectangle){ 600, 70, 120, 20 }, "EndAngle", endAngle, -450, 450, true); -+ startAngle = GuiSliderBar((Rectangle){ 600, 40, 120, 20 }, "StartAngle", NULL, startAngle, -450, 450); -+ endAngle = GuiSliderBar((Rectangle){ 600, 70, 120, 20 }, "EndAngle", NULL, endAngle, -450, 450); - -- innerRadius = GuiSliderBar((Rectangle){ 600, 140, 120, 20 }, "InnerRadius", innerRadius, 0, 100, true); -- outerRadius = GuiSliderBar((Rectangle){ 600, 170, 120, 20 }, "OuterRadius", outerRadius, 0, 200, true); -+ innerRadius = GuiSliderBar((Rectangle){ 600, 140, 120, 20 }, NULL, "InnerRadius", innerRadius, 0, 100); -+ outerRadius = GuiSliderBar((Rectangle){ 600, 170, 120, 20 }, NULL, "OuterRadius", outerRadius, 0, 200); - -- segments = GuiSliderBar((Rectangle){ 600, 240, 120, 20 }, "Segments", segments, 0, 100, true); -+ segments = GuiSliderBar((Rectangle){ 600, 240, 120, 20 }, "Segments", NULL, segments, 0, 100); - - drawRing = GuiCheckBox((Rectangle){ 600, 320, 20, 20 }, "Draw Ring", drawRing); - drawRingLines = GuiCheckBox((Rectangle){ 600, 350, 20, 20 }, "Draw RingLines", drawRingLines); -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 2e9861f8..08b149f1 100644 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -108,7 +108,7 @@ elseif(${PLATFORM} MATCHES "Android") - add_if_flag_compiles(-Wa,--noexecstack CMAKE_C_FLAGS) - add_if_flag_compiles(-no-canonical-prefixes CMAKE_C_FLAGS) - add_definitions(-DANDROID -D__ANDROID_API__=21) -- include_directories(external/android/native_app_glue) -+ include_directories(${ANDROID_NDK}/sources/android/native_app_glue) - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--exclude-libs,libatomic.a -Wl,--build-id -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--warn-shared-textrel -Wl,--fatal-warnings -uANativeActivity_onCreate") - - find_library(OPENGL_LIBRARY OpenGL) -diff --git a/src/core.c b/src/core.c -index e6d27e5f..fb7014b0 100644 ---- a/src/core.c -+++ b/src/core.c -@@ -186,7 +186,7 @@ - - // Support retrieving native window handlers - #if defined(_WIN32) -- #define GLFW_EXPOSE_NATIVE_WIN32 -+ - #include // WARNING: It requires customization to avoid windows.h inclusion! - - #if !defined(SUPPORT_BUSY_WAIT_LOOP) -@@ -3346,10 +3346,12 @@ static bool InitGraphicsDevice(int width, int height) - glfwSwapInterval(0); // No V-Sync by default - #endif - --#if defined(PLATFORM_DESKTOP) -+#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB) - // Load OpenGL 3.3 extensions - // NOTE: GLFW loader function is passed as parameter - rlLoadExtensions(glfwGetProcAddress); -+#else -+ rlLoadExtensions(eglGetProcAddress); - #endif - - // Try to enable GPU V-Sync, so frames are limited to screen refresh rate (60Hz -> 60 FPS) diff --git a/recipes/raylib/all/patches/0001-4.0.0-enable-cmake-build.patch b/recipes/raylib/all/patches/0001-4.0.0-enable-cmake-build.patch deleted file mode 100644 index 9ef917874947c..0000000000000 --- a/recipes/raylib/all/patches/0001-4.0.0-enable-cmake-build.patch +++ /dev/null @@ -1,38 +0,0 @@ -diff --git a/cmake/LibraryConfigurations.cmake b/cmake/LibraryConfigurations.cmake -index c156d6b3..608fe531 100644 ---- a/cmake/LibraryConfigurations.cmake -+++ b/cmake/LibraryConfigurations.cmake -@@ -42,7 +42,7 @@ elseif (${PLATFORM} MATCHES "Android") - set(CMAKE_POSITION_INDEPENDENT_CODE ON) - - add_definitions(-DANDROID -D__ANDROID_API__=21) -- include_directories(external/android/native_app_glue) -+ include_directories(${ANDROID_NDK}/sources/android/native_app_glue) - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--exclude-libs,libatomic.a -Wl,--build-id -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--warn-shared-textrel -Wl,--fatal-warnings -uANativeActivity_onCreate") - - find_library(OPENGL_LIBRARY OpenGL) -diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt -index 6ade9686..4e849ce4 100644 ---- a/examples/CMakeLists.txt -+++ b/examples/CMakeLists.txt -@@ -66,6 +66,7 @@ endif () - if (${PLATFORM} MATCHES "Android") - list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/rlgl_standalone.c) - list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/standard_lighting.c) -+ list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/raylib_opengl_interop.c) - list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/core/core_3d_picking.c) - list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/core/core_vr_simulator.c) - list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/core/core_3d_camera_free.c) -diff --git a/src/rcore.c b/src/rcore.c -index 3b451552..d7e58c1c 100644 ---- a/src/rcore.c -+++ b/src/rcore.c -@@ -196,7 +196,7 @@ - - // Support retrieving native window handlers - #if defined(_WIN32) -- #define GLFW_EXPOSE_NATIVE_WIN32 -+ - #include "GLFW/glfw3native.h" // WARNING: It requires customization to avoid windows.h inclusion! - - #if defined(SUPPORT_WINMM_HIGHRES_TIMER) && !defined(SUPPORT_BUSY_WAIT_LOOP) diff --git a/recipes/raylib/all/patches/3.5.0-0001-enable-cmake-build-android.patch b/recipes/raylib/all/patches/3.5.0-0001-enable-cmake-build-android.patch new file mode 100644 index 0000000000000..18b6559a6f285 --- /dev/null +++ b/recipes/raylib/all/patches/3.5.0-0001-enable-cmake-build-android.patch @@ -0,0 +1,31 @@ +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 2e9861f8..08b149f1 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -108,7 +108,7 @@ elseif(${PLATFORM} MATCHES "Android") + add_if_flag_compiles(-Wa,--noexecstack CMAKE_C_FLAGS) + add_if_flag_compiles(-no-canonical-prefixes CMAKE_C_FLAGS) + add_definitions(-DANDROID -D__ANDROID_API__=21) +- include_directories(external/android/native_app_glue) ++ include_directories(${ANDROID_NDK}/sources/android/native_app_glue) + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--exclude-libs,libatomic.a -Wl,--build-id -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--warn-shared-textrel -Wl,--fatal-warnings -uANativeActivity_onCreate") + + find_library(OPENGL_LIBRARY OpenGL) +diff --git a/src/core.c b/src/core.c +index e6d27e5f..fb7014b0 100644 +--- a/src/core.c ++++ b/src/core.c +@@ -3346,10 +3346,12 @@ static bool InitGraphicsDevice(int width, int height) + glfwSwapInterval(0); // No V-Sync by default + #endif + +-#if defined(PLATFORM_DESKTOP) ++#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB) + // Load OpenGL 3.3 extensions + // NOTE: GLFW loader function is passed as parameter + rlLoadExtensions(glfwGetProcAddress); ++#else ++ rlLoadExtensions(eglGetProcAddress); + #endif + + // Try to enable GPU V-Sync, so frames are limited to screen refresh rate (60Hz -> 60 FPS) diff --git a/recipes/raylib/all/patches/3.5.0-0002-cmake-project.patch b/recipes/raylib/all/patches/3.5.0-0002-cmake-project.patch new file mode 100644 index 0000000000000..03464a8959dfc --- /dev/null +++ b/recipes/raylib/all/patches/3.5.0-0002-cmake-project.patch @@ -0,0 +1,8 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,4 +1,5 @@ + cmake_minimum_required(VERSION 3.0) ++project(raylib) + set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) + + if ("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") diff --git a/recipes/raylib/all/patches/3.5.0-0003-win32-glfw3native.patch b/recipes/raylib/all/patches/3.5.0-0003-win32-glfw3native.patch new file mode 100644 index 0000000000000..d302d880e5990 --- /dev/null +++ b/recipes/raylib/all/patches/3.5.0-0003-win32-glfw3native.patch @@ -0,0 +1,14 @@ +--- a/src/core.c ++++ b/src/core.c +@@ -186,7 +186,11 @@ + + // Support retrieving native window handlers + #if defined(_WIN32) ++ typedef void *PVOID; ++ typedef PVOID HANDLE; ++ typedef HANDLE HWND; + #define GLFW_EXPOSE_NATIVE_WIN32 ++ #define GLFW_NATIVE_INCLUDE_NONE // To avoid some symbols re-definition in windows.h + #include // WARNING: It requires customization to avoid windows.h inclusion! + + #if !defined(SUPPORT_BUSY_WAIT_LOOP) diff --git a/recipes/raylib/all/patches/4.0.0-0001-enable-cmake-build-android.patch b/recipes/raylib/all/patches/4.0.0-0001-enable-cmake-build-android.patch new file mode 100644 index 0000000000000..4ff586ccfe20d --- /dev/null +++ b/recipes/raylib/all/patches/4.0.0-0001-enable-cmake-build-android.patch @@ -0,0 +1,13 @@ +diff --git a/cmake/LibraryConfigurations.cmake b/cmake/LibraryConfigurations.cmake +index c156d6b3..608fe531 100644 +--- a/cmake/LibraryConfigurations.cmake ++++ b/cmake/LibraryConfigurations.cmake +@@ -42,7 +42,7 @@ elseif (${PLATFORM} MATCHES "Android") + set(CMAKE_POSITION_INDEPENDENT_CODE ON) + + add_definitions(-DANDROID -D__ANDROID_API__=21) +- include_directories(external/android/native_app_glue) ++ include_directories(${ANDROID_NDK}/sources/android/native_app_glue) + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--exclude-libs,libatomic.a -Wl,--build-id -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--warn-shared-textrel -Wl,--fatal-warnings -uANativeActivity_onCreate") + + find_library(OPENGL_LIBRARY OpenGL) diff --git a/recipes/raylib/all/patches/4.0.0-0002-win32-glfw3native.patch b/recipes/raylib/all/patches/4.0.0-0002-win32-glfw3native.patch new file mode 100644 index 0000000000000..292c7cf7b3f37 --- /dev/null +++ b/recipes/raylib/all/patches/4.0.0-0002-win32-glfw3native.patch @@ -0,0 +1,14 @@ +--- a/src/rcore.c ++++ b/src/rcore.c +@@ -196,7 +196,11 @@ + + // Support retrieving native window handlers + #if defined(_WIN32) ++ typedef void *PVOID; ++ typedef PVOID HANDLE; ++ typedef HANDLE HWND; + #define GLFW_EXPOSE_NATIVE_WIN32 ++ #define GLFW_NATIVE_INCLUDE_NONE // To avoid some symbols re-definition in windows.h + #include "GLFW/glfw3native.h" // WARNING: It requires customization to avoid windows.h inclusion! + + #if defined(SUPPORT_WINMM_HIGHRES_TIMER) && !defined(SUPPORT_BUSY_WAIT_LOOP) diff --git a/recipes/raylib/all/test_package/CMakeLists.txt b/recipes/raylib/all/test_package/CMakeLists.txt index a1f55e19ef5a2..b4df9cc28b40d 100644 --- a/recipes/raylib/all/test_package/CMakeLists.txt +++ b/recipes/raylib/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(raylib REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} raylib) +target_link_libraries(${PROJECT_NAME} PRIVATE raylib) diff --git a/recipes/raylib/all/test_package/conanfile.py b/recipes/raylib/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/raylib/all/test_package/conanfile.py +++ b/recipes/raylib/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/raylib/all/test_package/test_package.c b/recipes/raylib/all/test_package/test_package.c index 97c33c55b19d9..30f0b1d640db4 100644 --- a/recipes/raylib/all/test_package/test_package.c +++ b/recipes/raylib/all/test_package/test_package.c @@ -8,5 +8,6 @@ int main(void) { if (CheckCollisionSpheres(center, r, center, r)) { printf("unit sphere collides with itself!\n"); } + return 0; } diff --git a/recipes/raylib/all/test_v1_package/CMakeLists.txt b/recipes/raylib/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/raylib/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/raylib/all/test_v1_package/conanfile.py b/recipes/raylib/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/raylib/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/raylib/config.yml b/recipes/raylib/config.yml index 9d0cb9313a0f3..47a9490c7f44f 100644 --- a/recipes/raylib/config.yml +++ b/recipes/raylib/config.yml @@ -1,5 +1,9 @@ versions: - "3.5.0": + "5.5": + folder: "all" + "5.0": folder: "all" "4.0.0": folder: "all" + "3.5.0": + folder: "all" diff --git a/recipes/rc_ptr/all/conandata.yml b/recipes/rc_ptr/all/conandata.yml new file mode 100644 index 0000000000000..64179a15ea35b --- /dev/null +++ b/recipes/rc_ptr/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.0.2": + url: "https://github.com/Chylynsky/rc_ptr/archive/refs/tags/v0.0.2.tar.gz" + sha256: "4682e0235b6def843b52e9327c7f1f87c98998b58c1b39a27cbf13dae27f7977" diff --git a/recipes/rc_ptr/all/conanfile.py b/recipes/rc_ptr/all/conanfile.py new file mode 100644 index 0000000000000..4325cec38cda1 --- /dev/null +++ b/recipes/rc_ptr/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.files import copy, get +from conan.tools.layout import basic_layout +from conan.tools.scm import Version +import os + +required_conan_version = ">=1.52.0" + +class RcPtrConan(ConanFile): + name = "rc_ptr" + description = "Reference counted smart pointer for single-threaded environments" + license = "BSL-1.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/Chylynsky/rc_ptr" + topics = ("memory", "smart-pointer", "header-only") + package_type = "header-library" + 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", + "Visual Studio": "16", + "msvc": "192", + } + + 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, "LICENSE_1_0.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_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/rc_ptr/all/test_package/CMakeLists.txt b/recipes/rc_ptr/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..06ceb32987cf9 --- /dev/null +++ b/recipes/rc_ptr/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(rc_ptr REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE rc_ptr::rc_ptr) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/rc_ptr/all/test_package/conanfile.py b/recipes/rc_ptr/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/rc_ptr/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/rc_ptr/all/test_package/test_package.cpp b/recipes/rc_ptr/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..1ecc4ab4aea91 --- /dev/null +++ b/recipes/rc_ptr/all/test_package/test_package.cpp @@ -0,0 +1,6 @@ +#include "rc_ptr/rc_ptr.hpp" + +int main() { + auto first = memory::rc_ptr{new int{24}}; + auto second = first; +} diff --git a/recipes/rc_ptr/config.yml b/recipes/rc_ptr/config.yml new file mode 100644 index 0000000000000..8c82b1d025a67 --- /dev/null +++ b/recipes/rc_ptr/config.yml @@ -0,0 +1,3 @@ +versions: + "0.0.2": + folder: all diff --git a/recipes/rdma-core/all/conandata.yml b/recipes/rdma-core/all/conandata.yml new file mode 100644 index 0000000000000..2871466545995 --- /dev/null +++ b/recipes/rdma-core/all/conandata.yml @@ -0,0 +1,10 @@ +sources: + "52.0": + url: "https://github.com/linux-rdma/rdma-core/releases/download/v52.0/rdma-core-52.0.tar.gz" + sha256: "1f0ce5f2462c982b20d21156707076278807a7adf4d10e9142f3be4bec1b2b83" + "51.0": + url: "https://github.com/linux-rdma/rdma-core/releases/download/v51.0/rdma-core-51.0.tar.gz" + sha256: "0a4a55b1351356c2750f26ec9010e8c7370402a13c95799cb8b447cf0134dd61" + "49.0": + url: "https://github.com/linux-rdma/rdma-core/releases/download/v49.0/rdma-core-49.0.tar.gz" + sha256: "953546ad2b179f9ce68dc21eb1eb26003098ea1bf0f87a4baed45bcea134b2b4" diff --git a/recipes/rdma-core/all/conanfile.py b/recipes/rdma-core/all/conanfile.py new file mode 100644 index 0000000000000..b7c0f7ab5ef82 --- /dev/null +++ b/recipes/rdma-core/all/conanfile.py @@ -0,0 +1,137 @@ +import os +import re + +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout, CMakeDeps +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import get, copy, rmdir, load, save, replace_in_file +from conan.tools.gnu import PkgConfigDeps + +required_conan_version = ">=1.53.0" + +class PackageConan(ConanFile): + name = "rdma-core" + description = ("RDMA core userspace libraries and daemons. " + "Provides userspace components for the Linux Kernel's drivers/infiniband subsystem.") + license = ("GPL-2.0", "Linux-OpenIB", "BSD-2-Clause") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/linux-rdma/rdma-core" + topics = ("linux-kernel", "rdma", "infiniband", "iwarp", "roce", "kernel-rdma-drivers", + "libefa", "libibmad", "libibnetdisc", "libibumad", "libibverbs", "libmana", + "libmlx4", "libmlx5", "librdmacm") + + package_type = "shared-library" + settings = "os", "arch", "compiler", "build_type" + options = { + "build_libefa": [True, False], + "build_libibnetdisc": [True, False], + "build_libmana": [True, False], + "build_libmlx4": [True, False], + "build_libmlx5": [True, False], + "build_librdmacm": [True, False], + } + default_options = { + "build_libefa": True, + "build_libibnetdisc": True, + "build_libmana": True, + "build_libmlx4": True, + "build_libmlx5": True, + "build_librdmacm": True, + } + + def configure(self): + 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("libnl/3.8.0") + self.requires("libudev/system") + + def validate(self): + if self.settings.os not in ["Linux", "FreeBSD"]: + # libnl is only available on Linux + raise ConanInvalidConfiguration("rdma-core is only supported on Linux") + + def build_requirements(self): + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/2.2.0") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = VirtualBuildEnv(self) + tc.generate() + tc = CMakeToolchain(self) + # Shared libraries are built by default and even if ENABLE_STATIC is turned on, + # the static libraries still have dependencies on the shared libraries. + # tc.variables["ENABLE_STATIC"] = not self.options.shared + tc.variables["NO_PYVERBS"] = True + tc.variables["NO_MAN_PAGES"] = True + # Otherwise get set to ${install_prefix}/car/run and the paths in + # https://github.com/linux-rdma/rdma-core/blob/v52.0/buildlib/config.h.in + # can exceed the 108-character limit for socket paths on Linux + if "CMAKE_INSTALL_RUNDIR" not in self.conf.get("tools.cmake.cmaketoolchain:extra_variables", check_type=dict, default={}): + tc.variables["CMAKE_INSTALL_RUNDIR"] = "/var/run" + tc.generate() + deps = CMakeDeps(self) + deps.generate() + deps = PkgConfigDeps(self) + deps.generate() + + def _patch_sources(self): + # Build only the libraries and disable everything else + allowed_subdirs = ["ccan", "kernel-boot", "kernel-headers", "libibmad", "libibnetdisc", "libibumad", "libibverbs", + "librdmacm", "providers/efa", "providers/mana", "providers/mlx4", "providers/mlx5", "util"] + allowed_subdirs = [ + subdir for subdir in allowed_subdirs + if self.options.get_safe(f"build_{subdir.replace('providers/', 'lib')}", True) + ] + cmakelists_path = os.path.join(self.source_folder, "CMakeLists.txt") + cmakelists_content = load(self, cmakelists_path) + patched_content = re.sub(r"add_subdirectory\((?!({})\)).+\)".format("|".join(allowed_subdirs)), r"", cmakelists_content) + save(self, cmakelists_path, patched_content) + # Adjust the pkg-config target for libnl + replace_in_file(self, cmakelists_path, "libnl-3.0 libnl-route-3.0", "libnl") + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + 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", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "etc")) + + def package_info(self): + def _add_component(name, requires, pthread=False): + if not self.options.get_safe(f"build_{name}", True): + return + component = self.cpp_info.components[name] + component.set_property("pkg_config_name", name) + component.libs = [name.replace("lib", "")] + component.requires = requires + ["libudev::libudev"] + if pthread and self.settings.os in ["Linux", "FreeBSD"]: + component.system_libs = ["pthread"] + + _add_component("libefa", ["libibverbs"], pthread=True) + _add_component("libibmad", ["libibumad"]) + _add_component("libibnetdisc", ["libibmad", "libibumad"]) + _add_component("libibumad", []) + _add_component("libibverbs", ["libnl::nl", "libnl::nl-route"], pthread=True) + _add_component("libmana", ["libibverbs"], pthread=True) + _add_component("libmlx4", ["libibverbs"], pthread=True) + _add_component("libmlx5", ["libibverbs"], pthread=True) + _add_component("librdmacm", ["libibverbs", "libnl::nl", "libnl::nl-route"], pthread=True) + diff --git a/recipes/rdma-core/all/test_package/CMakeLists.txt b/recipes/rdma-core/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..232275e72fa44 --- /dev/null +++ b/recipes/rdma-core/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package) + +find_package(rdma-core REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE rdma-core::libibverbs) diff --git a/recipes/rdma-core/all/test_package/conanfile.py b/recipes/rdma-core/all/test_package/conanfile.py new file mode 100644 index 0000000000000..ef5d7042163ec --- /dev/null +++ b/recipes/rdma-core/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/rdma-core/all/test_package/test_package.cpp b/recipes/rdma-core/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..abeb298aef336 --- /dev/null +++ b/recipes/rdma-core/all/test_package/test_package.cpp @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2004 Topspin Communications. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * 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. + * + * 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. + */ + +#include + +#include + +#include + +int main(int argc, char *argv[]) +{ + struct ibv_device **dev_list; + int num_devices, i; + + dev_list = ibv_get_device_list(&num_devices); + if (!dev_list) { + perror("Failed to get IB devices list"); + return 0; + } + + printf(" %-16s\t node GUID\n", "device"); + printf(" %-16s\t----------------\n", "------"); + + for (i = 0; i < num_devices; ++i) { + printf(" %-16s\t%016llx\n", + ibv_get_device_name(dev_list[i]), + (unsigned long long) be64toh(ibv_get_device_guid(dev_list[i]))); + } + + ibv_free_device_list(dev_list); + + return 0; +} diff --git a/recipes/rdma-core/config.yml b/recipes/rdma-core/config.yml new file mode 100644 index 0000000000000..4e3149e77dd3c --- /dev/null +++ b/recipes/rdma-core/config.yml @@ -0,0 +1,7 @@ +versions: + "52.0": + folder: all + "51.0": + folder: all + "49.0": + folder: all diff --git a/recipes/re2/all/conandata.yml b/recipes/re2/all/conandata.yml index 5f09249638cad..718ca942e6960 100644 --- a/recipes/re2/all/conandata.yml +++ b/recipes/re2/all/conandata.yml @@ -1,4 +1,31 @@ sources: + "20240702": + url: "https://github.com/google/re2/releases/download/2024-07-02/re2-2024-07-02.tar.gz" + sha256: "eb2df807c781601c14a260a507a5bb4509be1ee626024cb45acbd57cb9d4032b" + "20240301": + url: "https://github.com/google/re2/releases/download/2024-03-01/re2-2024-03-01.tar.gz" + sha256: "7b2b3aa8241eac25f674e5b5b2e23d4ac4f0a8891418a2661869f736f03f57f4" + "20231101": + url: "https://github.com/google/re2/releases/download/2023-11-01/re2-2023-11-01.tar.gz" + sha256: "4e6593ac3c71de1c0f322735bc8b0492a72f66ffccfad76e259fa21c41d27d8a" + "20230901": + url: "https://github.com/google/re2/releases/download/2023-09-01/re2-2023-09-01.tar.gz" + sha256: "5bb6875ae1cd1e9fedde98018c346db7260655f86fdb8837e3075103acd3649b" + "20230801": + url: "https://github.com/google/re2/releases/download/2023-08-01/re2-2023-08-01.tar.gz" + sha256: "d82d0efe2389949244445e7a6ac9a10fccc3d6a3d267ec4652991a51291647b0" + "20230701": + url: "https://github.com/google/re2/releases/download/2023-07-01/re2-2023-07-01.tar.gz" + sha256: "18cf85922e27fad3ed9c96a27733037da445f35eb1a2744c306a37c6d11e95c4" + "20230602": + url: "https://github.com/google/re2/releases/download/2023-06-02/re2-2023-06-02.tar.gz" + sha256: "4ccdd5aafaa1bcc24181e6dd3581c3eee0354734bb9f3cb4306273ffa434b94f" + "20230301": + url: "https://github.com/google/re2/archive/refs/tags/2023-03-01.tar.gz" + sha256: "7a9a4824958586980926a300b4717202485c4b4115ac031822e29aa4ef207e48" + "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" @@ -14,39 +41,3 @@ sources: "20210901": url: "https://github.com/google/re2/archive/refs/tags/2021-09-01.tar.gz" sha256: "42a2e1d56b5de252f5d418dc1cc0848e9e52ca22b056453988b18c6195ec7f8d" - "20210601": - url: "https://github.com/google/re2/archive/refs/tags/2021-06-01.tar.gz" - sha256: "26155e050b10b5969e986dab35654247a3b1b295e0532880b5a9c13c0a700ceb" - "20210401": - url: "https://github.com/google/re2/archive/refs/tags/2021-04-01.tar.gz" - sha256: "358aedf71dbf26506848905f5d4417b7adba5cf44d3bbcf70bf4ef68ccb0871e" - "20210202": - url: "https://github.com/google/re2/archive/2021-02-02.tar.gz" - sha256: "1396ab50c06c1a8885fb68bf49a5ecfd989163015fd96699a180d6414937f33f" - "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 a4b44532b5660..caa9278099d00 100644 --- a/recipes/re2/all/conanfile.py +++ b/recipes/re2/all/conanfile.py @@ -1,33 +1,55 @@ 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.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout from conan.tools.files import copy, get, rmdir +from conan.tools.scm import Version import os -required_conan_version = ">=1.53.0" - +required_conan_version = ">=1.54.0" class Re2Conan(ConanFile): name = "re2" description = "Fast, safe, thread-friendly regular expression library" - topics = ("regex") + topics = ("regex",) url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/google/re2" license = "BSD-3-Clause" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], + "with_icu": [True, False], } default_options = { "shared": False, "fPIC": True, + "with_icu": False, } + @property + def _min_cppstd(self): + return 14 if Version(self.version) >= "20230601" else 11 + + @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 config_options(self): if self.settings.os == "Windows": del self.options.fPIC + if Version(self.version) < "20230201": + del self.options.with_icu def configure(self): if self.options.shared: @@ -36,21 +58,33 @@ def configure(self): def layout(self): cmake_layout(self, src_folder="src") + def requirements(self): + if self.options.get_safe("with_icu"): + self.requires("icu/73.2") + if Version(self.version) >= "20230601": + self.requires("abseil/20240116.1", transitive_headers=True) + def validate(self): - if self.info.settings.compiler.get_safe("cppstd"): - check_min_cppstd(self, 11) + 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], - 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["RE2_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() + deps = CMakeDeps(self) + deps.generate() + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/re2/all/test_package/CMakeLists.txt b/recipes/re2/all/test_package/CMakeLists.txt index dee70b6be9bd8..f2cb6370aee9f 100644 --- a/recipes/re2/all/test_package/CMakeLists.txt +++ b/recipes/re2/all/test_package/CMakeLists.txt @@ -5,4 +5,8 @@ find_package(re2 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE re2::re2) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +if (re2_VERSION VERSION_GREATER_EQUAL "20230602") + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) +else() + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +endif() diff --git a/recipes/re2/config.yml b/recipes/re2/config.yml index 2eb4d5ecd73f0..bfce54f7e636d 100644 --- a/recipes/re2/config.yml +++ b/recipes/re2/config.yml @@ -1,35 +1,29 @@ versions: - "20221201": - folder: all - "20220601": + "20240702": folder: all - "20220201": + "20240301": folder: all - "20211101": - folder: all - "20210901": + "20231101": folder: all - "20210601": + "20230901": folder: all - "20210401": + "20230801": folder: all - "20210202": + "20230701": folder: all - "20201101": + "20230602": folder: all - "20201001": + "20230301": folder: all - "20200801": + "20230201": folder: all - "20200701": - folder: all - "20200601": + "20221201": folder: all - "20200501": + "20220601": folder: all - "20200401": + "20220201": folder: all - "20200301": + "20211101": folder: all - "20191101": + "20210901": folder: all diff --git a/recipes/re2c/all/conandata.yml b/recipes/re2c/all/conandata.yml index 6123ba01ce5a3..e8f43a925d5ec 100644 --- a/recipes/re2c/all/conandata.yml +++ b/recipes/re2c/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.1": + url: "https://github.com/skvadrik/re2c/releases/download/3.1/re2c-3.1.tar.xz" + sha256: "0ac299ad359e3f512b06a99397d025cfff81d3be34464ded0656f8a96676c029" "3.0": url: "https://github.com/skvadrik/re2c/releases/download/3.0/re2c-3.0.tar.xz" sha256: "b3babbbb1461e13fe22c630a40c43885efcfbbbb585830c6f4c0d791cf82ba0b" @@ -15,20 +18,5 @@ sources: url: "https://github.com/skvadrik/re2c/releases/download/1.3/re2c-1.3.tar.xz" sha256: "f37f25ff760e90088e7d03d1232002c2c2672646d5844fdf8e0d51a5cd75a503" patches: - "3.0": - - patch_file: "patches/0001-add-msvc_cl-sh.patch" - base_path: "" - "2.2": - - patch_file: "patches/0001-add-msvc_cl-sh.patch" - base_path: "" - "2.1.1": - - patch_file: "patches/0001-add-msvc_cl-sh.patch" - base_path: "" "2.0.3": - - patch_file: "patches/0001-add-msvc_cl-sh.patch" - base_path: "" - patch_file: "patches/2.0.3-0001-add-missing-include.patch" - base_path: "source_subfolder" - "1.3": - - patch_file: "patches/0001-add-msvc_cl-sh.patch" - base_path: "" diff --git a/recipes/re2c/all/conanfile.py b/recipes/re2c/all/conanfile.py index fd56a51318aa2..99f065993da70 100644 --- a/recipes/re2c/all/conanfile.py +++ b/recipes/re2c/all/conanfile.py @@ -1,95 +1,115 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, tools -from contextlib import contextmanager 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, chdir, copy, export_conandata_patches, get, rmdir, replace_in_file +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc + +required_conan_version = ">=1.53.0" class Re2CConan(ConanFile): name = "re2c" - description = "re2c is a free and open-source lexer generator for C, C++ and Go." - topics = ("re2c", "lexer", "language", "tokenizer", "flex") + description = "re2c is a free and open-source lexer generator for C/C++, Go and Rust." + license = "LicenseRef-re2c" url = "https://github.com/conan-io/conan-center-index" homepage = "http://re2c.org/" - license = "Unlicense" - settings = "os", "arch", "build_type", "compiler" - - _autotools = None + topics = ("lexer", "language", "tokenizer", "flex") - @property - def _source_subfolder(self): - return "source_subfolder" + package_type = "application" + settings = "os", "arch", "compiler", "build_type" @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 + 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 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) - def build_requirements(self): - 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): - env = { - "CC": "{} -nologo".format(tools.unix_path(os.path.join(self.build_folder, "msvc_cl.sh"))), - "CXX": "{} -nologo".format(tools.unix_path(os.path.join(self.build_folder, "msvc_cl.sh"))), - "LD": "{} -nologo".format(tools.unix_path(os.path.join(self.build_folder, "msvc_cl.sh"))), - "CXXLD": "{} -nologo".format(tools.unix_path(os.path.join(self.build_folder, "msvc_cl.sh"))), - "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) - if self.settings.compiler == "Visual Studio": - self._autotools.flags.append("-FS") - self._autotools.cxx_flags.append("-EHsc") - self._autotools.configure(configure_dir=self._source_subfolder) - return self._autotools + 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("winflexbison/2.5.24") + if is_msvc(self): + self.tool_requires("cccl/1.3") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + VirtualBuildEnv(self).generate() + tc = AutotoolsToolchain(self) + tc.configure_args.append("--disable-benchmarks") + env = tc.environment() + if is_msvc(self): + tc.extra_cxxflags.append("-EHsc") + env.define("CC", "cccl -FS") + env.define("CXX", "cccl -FS") + env.define("LD", "cccl") + env.define("CXXLD", "cccl") + tc.generate(env) + + def _patch_sources(self): + apply_conandata_patches(self) + # Don't copy benchmark files, which cause the build to fail on Windows + replace_in_file(self, os.path.join(self.source_folder, "configure"), + '"$ac_config_files Makefile ', + '"$ac_config_files Makefile" #', + strict=False) + replace_in_file(self, os.path.join(self.source_folder, "configure"), + '"$ac_config_links ', + '"$ac_config_links" #', + strict=False) 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() + self._patch_sources() + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.configure() autotools.make(args=["V=1"]) def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses", keep_path=False) - self.copy("NO_WARRANTY", src=self._source_subfolder, dst="licenses", keep_path=False) - with self._build_context(): - autotools = self._configure_autotools() + copy(self, "LICENSE", + src=self.source_folder, + dst=os.path.join(self.package_folder, "licenses"), + keep_path=False) + copy(self, "NO_WARRANTY", + src=self.source_folder, + dst=os.path.join(self.package_folder, "licenses"), + keep_path=False) + copy(self, "*.re", + src=os.path.join(self.source_folder, "include"), + dst=os.path.join(self.package_folder, "include"), + keep_path=False) + with chdir(self, self.source_folder): + 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.frameworkdirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] + self.cpp_info.includedirs = [] + + include_dir = os.path.join(self.package_folder, "include") + self.buildenv_info.define("RE2C_STDLIB_DIR", include_dir) + + # 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.env_info.PATH.append(bin_path) + self.env_info.RE2C_STDLIB_DIR = include_dir diff --git a/recipes/re2c/all/patches/0001-add-msvc_cl-sh.patch b/recipes/re2c/all/patches/0001-add-msvc_cl-sh.patch deleted file mode 100644 index c9bc0abc63639..0000000000000 --- a/recipes/re2c/all/patches/0001-add-msvc_cl-sh.patch +++ /dev/null @@ -1,94 +0,0 @@ -new file mode 100755 ---- /dev/null -+++ msvc_cl.sh -@@ -0,0 +1,90 @@ -+#!/bin/sh -+clopts=() -+ldopts=() -+sources=0 -+link=0 -+while test $# -gt 0; do -+ case "$1" in -+ -lm | -pthread | -lpthread | -std=c++98) -+ # ignore -+ ;; -+ -Xlinker) -+ shift -+ ;; -+ -W* | -w* | -pedantic) -+ # ignore warnings -+ ;; -+ -D*) -+ clopts+=("$1") -+ ;; -+ -I*) -+ clopts+=("$1") -+ ;; -+ -l*) -+ ldopts+=("`echo "$1.lib" | sed "s/^-l//"`") -+ ;; -+ -LIBPATH*) -+ ldopts+=("$1") -+ ;; -+ -L*) -+ ldopts+=("`echo "$1" | sed "s/^-L/-LIBPATH:/"`") -+ ;; -+ *.obj | *.o) -+ link=1 -+ ldopts+=("$1") -+ ;; -+ -Wl,*) -+ for linkarg in `echo '$1' | sed -e 's/-Wl,//' -e 's/,/ /'`; do -+ ldopts+=("${linkarg}") -+ done -+ ;; -+ *.lib) -+ ldopts+=("$1") -+ ;; -+ -o) -+ shift -+ case "$1" in -+ *.dll | *.exe) -+ link=1 -+ ldopts+=("-out:$1") -+ ;; -+ *.o | *.obj) -+ link=0 -+ clopts+=("-Fo$1") -+ ;; -+ esac -+ ;; -+ -implib* | -IMPLIB*) -+ ldopts+=("$1") -+ ;; -+ -c | *.c | *.C | *.cxx | *.cpp | *.cc | *.CC) -+ sources=1 -+ clopts+=("$1") -+ ;; -+ *) -+ clopts+=("$1") -+ ;; -+ esac -+ shift -+done -+ -+args="${clopts[@]}" -+if test $link = 1; then -+ if test $sources = 0; then -+ args="${ldopts[@]}" -+cat <<-EOF -+ Creating program/library -+ ** ld options: "$args" -+EOF -+ LINK= exec link -nologo $args -+ else -+ args="$args -link ${ldopts[@]}" -+ fi -+fi -+ -+cat <<-EOF -+ Compiling source -+ ** cl options: "$args" -+EOF -+ -+LINK= exec cl -nologo $args diff --git a/recipes/re2c/all/test_package/CMakeLists.txt b/recipes/re2c/all/test_package/CMakeLists.txt index 9f0917e64ea34..9ba5cb966b406 100644 --- a/recipes/re2c/all/test_package/CMakeLists.txt +++ b/recipes/re2c/all/test_package/CMakeLists.txt @@ -1,11 +1,10 @@ -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_program(RE2C NAMES re2c) add_custom_command(OUTPUT test_package.c - COMMAND re2c -W "${PROJECT_SOURCE_DIR}/syntax.re" -o test_package.c + COMMAND "${RE2C}" -W "${CMAKE_CURRENT_LIST_DIR}/syntax.re" -I "$ENV{RE2C_STDLIB_DIR}" -o test_package.c ) add_executable(${PROJECT_NAME} test_package.c) diff --git a/recipes/re2c/all/test_package/conanfile.py b/recipes/re2c/all/test_package/conanfile.py index a886f5f0a7632..91315a6314ef7 100644 --- a/recipes/re2c/all/test_package/conanfile.py +++ b/recipes/re2c/all/test_package/conanfile.py @@ -1,18 +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", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + 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 can_run(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) + 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/re2c/all/test_package/syntax.re b/recipes/re2c/all/test_package/syntax.re index b1b909b54562f..b2d424b9894c3 100644 --- a/recipes/re2c/all/test_package/syntax.re +++ b/recipes/re2c/all/test_package/syntax.re @@ -1,16 +1,21 @@ #include +#include + +/*!include:re2c "unicode_categories.re" */ /*!max:re2c*/ /*!re2c digit = [0-9]; number = digit+; + word = L+; */ static int lex(const char *YYCURSOR) { const char *YYMARKER; /*!re2c - re2c:define:YYCTYPE = char; + re2c:flags:utf-8 = 1; + re2c:define:YYCTYPE = 'unsigned char'; re2c:yyfill:enable = 0; * { return 1; } @@ -20,12 +25,18 @@ static int lex(const char *YYCURSOR) return 0; } + word { + printf("word\n"); + return 0; + } + */ } int main() { - lex("1024"); - lex(";]"); + assert(lex("1024") == 0); + assert(lex(";]") == 1); + assert(lex("Слово") == 0); return 0; } diff --git a/recipes/re2c/config.yml b/recipes/re2c/config.yml index ca4059985b6a4..fd91d5170215c 100644 --- a/recipes/re2c/config.yml +++ b/recipes/re2c/config.yml @@ -1,4 +1,6 @@ versions: + "3.1": + folder: "all" "3.0": folder: "all" "2.2": diff --git a/recipes/reactiveplusplus/all/conandata.yml b/recipes/reactiveplusplus/all/conandata.yml index b01e397208475..fc0d0114cf28b 100644 --- a/recipes/reactiveplusplus/all/conandata.yml +++ b/recipes/reactiveplusplus/all/conandata.yml @@ -1,4 +1,19 @@ sources: + "2.2.1": + url: "https://github.com/victimsnino/ReactivePlusPlus/archive/refs/tags/v2.2.1.tar.gz" + sha256: "4d44da273a8f7401b8ebf6973ae06246505e204e9c491b435f0e1b223d6841fe" + "2.2.0": + url: "https://github.com/victimsnino/ReactivePlusPlus/archive/refs/tags/v2.2.0.tar.gz" + sha256: "10b3969956ff05fa4ebd62245b616731d9c12fb5b57c4cecb2c4ee418303dbea" + "2.1.1": + url: "https://github.com/victimsnino/ReactivePlusPlus/archive/refs/tags/v2.1.1.tar.gz" + sha256: "0b962478d7c973a1f74062ce7f8d24c2fdcd2733031b1f014e65d252d59ebe6a" + "2.0.0": + url: "https://github.com/victimsnino/ReactivePlusPlus/archive/v2.0.0.tar.gz" + sha256: "8950fe579aea23be1a6affd4ec8845c78016454aaf875dbae6a52d10eeb6df02" + "0.2.3": + url: "https://github.com/victimsnino/ReactivePlusPlus/archive/v0.2.3.tar.gz" + sha256: "9542419f8d7da98126ba2c6ae08fab287b4b3798d89cf75ed9bed2a9e3ec1678" "0.2.1": url: "https://github.com/victimsnino/ReactivePlusPlus/archive/refs/tags/v0.2.1.tar.gz" sha256: "c41f9a0b727d5bdbc92390b3f075bfa280fd4f6f2aa7db51428fc30023b518d0" diff --git a/recipes/reactiveplusplus/all/conanfile.py b/recipes/reactiveplusplus/all/conanfile.py index d8d1eb5567b3d..10cc3f19849e6 100644 --- a/recipes/reactiveplusplus/all/conanfile.py +++ b/recipes/reactiveplusplus/all/conanfile.py @@ -3,9 +3,10 @@ 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" +required_conan_version = ">=2.0" class ReactivePlusPlusConan(ConanFile): @@ -16,25 +17,32 @@ class ReactivePlusPlusConan(ConanFile): "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" + homepage = "https://github.com/victimsnino/ReactivePlusPlus" + topics = ("reactivex", "asynchronous", "event", "observable", "values-distributed-in-time") + package_type = "header-library" 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", - } + if Version(self.version) >= "2.0.0": + # For 'consteval' support + return { + "Visual Studio": "17", + "msvc": "193", + "gcc": "12", + "clang": "14", + "apple-clang": "14", + } + else: + return { + "Visual Studio": "16.10", + "msvc": "192", + "gcc": "10", + "clang": "12", + "apple-clang": "14", + } def layout(self): basic_layout(self, src_folder="src") @@ -43,24 +51,16 @@ 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] - + required_cppstd = "20" + check_min_cppstd(self, required_cppstd) 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): + 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.", + f"{self.name} {self.version} requires C++{required_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 build(self): pass @@ -70,6 +70,11 @@ def package(self): copy(self, "*", src=os.path.join(self.source_folder, "src", "rpp", "rpp"), dst=os.path.join(self.package_folder, "include", "rpp")) + # Copy extensions (available since v2.2.0) + for extension in ["rppasio", "rppgrpc", "rppqt"]: + copy(self, "*", + src=os.path.join(self.source_folder, "src", "extensions", extension, extension), + dst=os.path.join(self.package_folder, "include", extension)) def package_info(self): self.cpp_info.set_property("cmake_file_name", "RPP") @@ -77,11 +82,6 @@ def package_info(self): 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 index 96e89147f81a9..1809dd95e5019 100644 --- a/recipes/reactiveplusplus/all/test_package/CMakeLists.txt +++ b/recipes/reactiveplusplus/all/test_package/CMakeLists.txt @@ -3,6 +3,10 @@ project(test_package LANGUAGES CXX) find_package(RPP REQUIRED CONFIG) -add_executable(${PROJECT_NAME} test_package.cpp) +if(RPP_VERSION VERSION_GREATER_EQUAL 2) + add_executable(${PROJECT_NAME} test_package_v2.cpp) +else() + add_executable(${PROJECT_NAME} test_package.cpp) +endif() 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/test_package_v2.cpp b/recipes/reactiveplusplus/all/test_package/test_package_v2.cpp new file mode 100644 index 0000000000000..392c29a4ae623 --- /dev/null +++ b/recipes/reactiveplusplus/all/test_package/test_package_v2.cpp @@ -0,0 +1,18 @@ +// Source: https://github.com/victimsnino/ReactivePlusPlus/tree/v2/docs#operators + +#include + +#include +#include +#include + +int main() +{ + rpp::source::from_callable(&::getchar) + | rpp::operators::repeat() + | rpp::operators::take_while([](char v) { return v != '0'; }) + | rpp::operators::filter(std::not_fn(&::isdigit)) + | rpp::operators::map(&::toupper); + + return 0; +} diff --git a/recipes/reactiveplusplus/config.yml b/recipes/reactiveplusplus/config.yml index 4fec465c4ccad..44a35cf248ea6 100644 --- a/recipes/reactiveplusplus/config.yml +++ b/recipes/reactiveplusplus/config.yml @@ -1,4 +1,14 @@ versions: + "2.2.1": + folder: all + "2.2.0": + folder: all + "2.1.1": + folder: all + "2.0.0": + folder: all + "0.2.3": + folder: all "0.2.1": folder: all "0.1.2": diff --git a/recipes/read-excel/all/test_package/conanfile.py b/recipes/read-excel/all/test_package/conanfile.py index bddb5e263d5d6..8a5bb47f50c4c 100644 --- a/recipes/read-excel/all/test_package/conanfile.py +++ b/recipes/read-excel/all/test_package/conanfile.py @@ -23,5 +23,4 @@ def build(self): def test(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, "sample.xls") - self.run("{} \"{}\"".format(bin_path, xls_path), env="conanrun") + self.run(bin_path, env="conanrun") diff --git a/recipes/read-excel/all/test_package/sample.xls b/recipes/read-excel/all/test_package/sample.xls deleted file mode 100644 index ecf08ebffbbb9..0000000000000 Binary files a/recipes/read-excel/all/test_package/sample.xls and /dev/null differ diff --git a/recipes/read-excel/all/test_package/test_package.cpp b/recipes/read-excel/all/test_package/test_package.cpp index 847cfd34b125e..f8edcee4eecf3 100644 --- a/recipes/read-excel/all/test_package/test_package.cpp +++ b/recipes/read-excel/all/test_package/test_package.cpp @@ -6,31 +6,11 @@ int main(int argc, char ** argv) { - if (argc < 2) { - std::cerr << "Need an argument\n"; - return 1; - } - try { - Excel::Book book( argv[1] ); - - Excel::Sheet * sheet = book.sheet( 0 ); - - if(sheet->cell( 0, 0 ).getString() == L"This is a string.") - return 0; - - return 1; + Excel::Book book( "non-real-file.xls" ); } catch(const Excel::Exception &) { - return 1; - } - catch(const CompoundFile::Exception &) - { - return 1; - } - catch(const std::exception &) - { - return 1; + printf("Test\n"); } } diff --git a/recipes/read-excel/all/test_v1_package/conanfile.py b/recipes/read-excel/all/test_v1_package/conanfile.py index 3524db189d6f0..38f4483872d47 100644 --- a/recipes/read-excel/all/test_v1_package/conanfile.py +++ b/recipes/read-excel/all/test_v1_package/conanfile.py @@ -14,5 +14,4 @@ def build(self): 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) + self.run(bin_path, run_environment=True) diff --git a/recipes/readerwriterqueue/all/conanfile.py b/recipes/readerwriterqueue/all/conanfile.py index bcc34e3602e6d..8dfe0c0be7d93 100644 --- a/recipes/readerwriterqueue/all/conanfile.py +++ b/recipes/readerwriterqueue/all/conanfile.py @@ -1,6 +1,10 @@ -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.50.0" + class ReaderWriterQueue(ConanFile): name = "readerwriterqueue" @@ -11,27 +15,26 @@ class ReaderWriterQueue(ConanFile): license = "BSD-2-Clause" no_copy_source = True settings = "os" - - @property - def _source_subfolder(self): - return "sources_subfolder" + + def layout(self): + basic_layout(self, src_folder="src") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename("readerwriterqueue-{}".format(self.version), - self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - def package(self): - self.copy("atomicops.h", src=self._source_subfolder, dst=os.path.join("include", "readerwriterqueue")) - self.copy("readerwriterqueue.h", src=self._source_subfolder, dst=os.path.join("include", "readerwriterqueue")) - if tools.Version(self.version) >= "1.0.5": - self.copy("readerwritercircularbuffer.h", src=self._source_subfolder, dst=os.path.join("include", "readerwriterqueue")) + def build(self): + pass - self.copy("LICENSE.md", src=self._source_subfolder, dst="licenses") + def package(self): + copy(self, "LICENSE.md", 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", "readerwriterqueue"), + excludes=["benchmarks", "tests"]) def package_id(self): - self.info.header_only() + self.info.clear() 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 = ["pthread"] diff --git a/recipes/readerwriterqueue/all/test_package/CMakeLists.txt b/recipes/readerwriterqueue/all/test_package/CMakeLists.txt index 454c47bb2cbab..eceb6e660004e 100644 --- a/recipes/readerwriterqueue/all/test_package/CMakeLists.txt +++ b/recipes/readerwriterqueue/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(readerwriterqueue 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 readerwriterqueue::readerwriterqueue) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/readerwriterqueue/all/test_package/conanfile.py b/recipes/readerwriterqueue/all/test_package/conanfile.py index ee6b872776556..a348a04e88cb6 100644 --- a/recipes/readerwriterqueue/all/test_package/conanfile.py +++ b/recipes/readerwriterqueue/all/test_package/conanfile.py @@ -1,9 +1,17 @@ -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 ConcurrentqueueTestConan(ConanFile): +class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + 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 +19,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/readerwriterqueue/all/test_v1_package/CMakeLists.txt b/recipes/readerwriterqueue/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/readerwriterqueue/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/readerwriterqueue/all/test_v1_package/conanfile.py b/recipes/readerwriterqueue/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..b340bdd7fabce --- /dev/null +++ b/recipes/readerwriterqueue/all/test_v1_package/conanfile.py @@ -0,0 +1,15 @@ +from conans import ConanFile, CMake, tools +import os + +class ConcurrentqueueTestConan(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): + self.run(os.path.join("bin", "test_package"), run_environment=True) diff --git a/recipes/readline/all/conandata.yml b/recipes/readline/all/conandata.yml index 08a67ab543d70..e8d782e286b8b 100644 --- a/recipes/readline/all/conandata.yml +++ b/recipes/readline/all/conandata.yml @@ -5,3 +5,6 @@ sources: "8.1.2": url: "https://ftp.gnu.org/pub/gnu/readline/readline-8.1.2.tar.gz" sha256: "7589a2381a8419e68654a47623ce7dfcb756815c8fee726b98f90bf668af7bc6" + "8.2": + url: "https://ftp.gnu.org/pub/gnu/readline/readline-8.2.tar.gz" + sha256: "3feb7171f16a84ee82ca18a36d7b9be109a52c04f492a053331d7d1095007c35" diff --git a/recipes/readline/all/conanfile.py b/recipes/readline/all/conanfile.py index 2062f025d7a28..d5b233744c63a 100644 --- a/recipes/readline/all/conanfile.py +++ b/recipes/readline/all/conanfile.py @@ -1,6 +1,15 @@ import os -from conans import ConanFile, AutoToolsBuildEnvironment, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.tools.files import get, replace_in_file, rmdir, copy +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.build import cross_building +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc +from conan.tools.env import VirtualRunEnv +from conan.tools.gnu import AutotoolsToolchain, AutotoolsDeps, Autotools +from conan.errors import ConanInvalidConfiguration + +required_conan_version = ">=1.53.0" class ReadLineConan(ConanFile): @@ -10,6 +19,8 @@ class ReadLineConan(ConanFile): license = "GPL-3.0-only" homepage = "https://tiswww.case.edu/php/chet/readline/rltop.html" url = "https://github.com/conan-io/conan-center-index" + + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -22,12 +33,6 @@ class ReadLineConan(ConanFile): "with_library": "termcap", } - @property - def _source_subfolder(self): - return "source_subfolder" - - _autotools = None - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC @@ -36,60 +41,64 @@ def requirements(self): if self.options.with_library == "termcap": self.requires("termcap/1.3.1") elif self.options.with_library == "curses": - self.requires("ncurses/6.2") + self.requires("ncurses/6.4", transitive_headers=True, transitive_libs=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.libcxx") + self.settings.rm_safe("compiler.cppstd") def validate(self): - if self.settings.compiler == "Visual Studio": + if is_msvc(self): raise ConanInvalidConfiguration("readline does not support Visual Studio") + 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], strip_root=True) - def _configure_autotools(self): - if self._autotools: - return self._autotools + def generate(self): + if not cross_building(self): + # Expose LD_LIBRARY_PATH when there are shared dependencies, + # as configure tries to run a test executable (when not cross-building) + env = VirtualRunEnv(self) + env.generate(scope="build") - configure_args = [ + tc = AutotoolsToolchain(self) + tc.configure_args.extend([ "--with-curses={}".format("yes" if self.options.with_library == "curses" else "no"), - ] - if self.options.shared: - configure_args.extend(["--enable-shared", "--disable-static"]) - else: - configure_args.extend(["--enable-static", "--disable-shared"]) - if tools.cross_building(self.settings): - configure_args.append("bash_cv_wcwidth_broken=yes") - - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - if self.settings.os == "Macos" and self.settings.arch == "armv8": - # this should be really done automatically by the AutoToolsBuildEnvironment helper, - # but very unlikely old helper will be fixed any time soon - self._autotools.link_flags.extend(["-arch", "arm64"]) - self._autotools.configure(args=configure_args, configure_dir=self._source_subfolder) - return self._autotools + ]) + if cross_building(self): + tc.configure_args.append("bash_cv_wcwidth_broken=yes") + + tc.configure_args.append("--disable-install-examples") + + tc.generate() + deps = AutotoolsDeps(self) + deps.generate() def _patch_sources(self): - tools.replace_in_file(os.path.join(self._source_subfolder, "shlib", "Makefile.in"), "-o $@ $(SHARED_OBJ) $(SHLIB_LIBS)", + if self.options.with_library == "termcap": + replace_in_file(self, os.path.join(self.source_folder, "shlib", "Makefile.in"), "-o $@ $(SHARED_OBJ) $(SHLIB_LIBS)", "-o $@ $(SHARED_OBJ) $(SHLIB_LIBS) -ltermcap") - tools.replace_in_file(os.path.join(self._source_subfolder, "Makefile.in"), "@TERMCAP_LIB@", "-ltermcap") + replace_in_file(self, os.path.join(self.source_folder, "Makefile.in"), "@TERMCAP_LIB@", "-ltermcap") def build(self): self._patch_sources() - autotools = self._configure_autotools() + 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, "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.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")) + fix_apple_shared_install_name(self) def package_info(self): self.cpp_info.libs = ["history", "readline"] diff --git a/recipes/readline/all/test_package/CMakeLists.txt b/recipes/readline/all/test_package/CMakeLists.txt index e6c520fdaeb88..0ba8423464ca0 100644 --- a/recipes/readline/all/test_package/CMakeLists.txt +++ b/recipes/readline/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(readline CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.c) diff --git a/recipes/readline/all/test_package/conanfile.py b/recipes/readline/all/test_package/conanfile.py index 49a3a66ea5bad..0170011d8e2d2 100644 --- a/recipes/readline/all/test_package/conanfile.py +++ b/recipes/readline/all/test_package/conanfile.py @@ -1,10 +1,18 @@ -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", "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 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/readline/all/test_v1_package/CMakeLists.txt b/recipes/readline/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/readline/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/readline/all/test_v1_package/conanfile.py b/recipes/readline/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..49a3a66ea5bad --- /dev/null +++ b/recipes/readline/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/readline/config.yml b/recipes/readline/config.yml index aafdae05d7dc8..2aedc51249c31 100644 --- a/recipes/readline/config.yml +++ b/recipes/readline/config.yml @@ -3,3 +3,5 @@ versions: folder: "all" "8.1.2": folder: "all" + "8.2": + folder: "all" diff --git a/recipes/readosm/all/conandata.yml b/recipes/readosm/all/conandata.yml index db13b0c83d55b..c2fb67bfed2fc 100644 --- a/recipes/readosm/all/conandata.yml +++ b/recipes/readosm/all/conandata.yml @@ -4,5 +4,6 @@ sources: sha256: "db7c051d256cec7ecd4c3775ab9bc820da5a4bf72ffd4e9f40b911d79770f145" patches: "1.1.0a": - - patch_file: "patches/0001-nmake-honor-flags.patch" - base_path: "source_subfolder" + - patch_file: "patches/0001-fix-nmake.patch" + patch_description: "Remove hardcoded paths in NMake" + patch_type: "conan" diff --git a/recipes/readosm/all/conanfile.py b/recipes/readosm/all/conanfile.py index b804820f05054..8a9b5054afef4 100644 --- a/recipes/readosm/all/conanfile.py +++ b/recipes/readosm/all/conanfile.py @@ -1,8 +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, 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, NMakeDeps, NMakeToolchain import os -required_conan_version = ">=1.36.0" +required_conan_version = ">=1.58.0" class ReadosmConan(ConanFile): @@ -12,10 +18,11 @@ class ReadosmConan(ConanFile): "an Open Street Map input file." ) license = ("MPL-1.1", "GPL-2.0-or-later", "LGPL-2.1-or-later") - topics = ("readosm", "osm", "open-street-map", "xml", "protobuf") + topics = ("osm", "open-street-map", "xml", "protobuf") homepage = "https://www.gaia-gis.it/fossil/readosm" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -26,21 +33,12 @@ class ReadosmConan(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": @@ -48,86 +46,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") + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - self.requires("expat/2.4.8") - self.requires("zlib/1.2.12") + self.requires("expat/[>=2.6.2 <3]") + self.requires("zlib/[>=1.2.11 <2]") def build_requirements(self): - if 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 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) - - def _build_msvc(self): - target = "readosm_i.lib" if self.options.shared else "readosm.lib" - optflags = ["-DDLL_EXPORT"] if self.options.shared else [] - system_libs = [lib + ".lib" for lib in self.deps_cpp_info.system_libs] - with tools.chdir(self._source_subfolder): - with tools.vcvars(self): - with tools.environment_append(VisualStudioBuildEnvironment(self).vars): - self.run("nmake -f makefile.vc {} OPTFLAGS=\"{}\" SYSTEM_LIBS=\"{}\"".format(target, - " ".join(optflags), - " ".join(system_libs))) - - def _build_autotools(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + if is_msvc(self): + tc = NMakeToolchain(self) + if self.options.shared: + tc.extra_defines.append("DLL_EXPORT") + 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.configure_args.append("--disable-gcov") + tc.generate() + deps = AutotoolsDeps(self) + deps.generate() + + def _patch_sources(self): + apply_conandata_patches(self) # fix MinGW - tools.replace_in_file(os.path.join(self._source_subfolder, "configure.ac"), - "AC_CHECK_LIB(z,", - "AC_CHECK_LIB({},".format(self.deps_cpp_info["zlib"].libs[0])) + zlib_lib = self.dependencies["zlib"].cpp_info.aggregated_components().libs[0] + replace_in_file( + self, os.path.join(self.source_folder, "configure.ac"), + "AC_CHECK_LIB(z,", f"AC_CHECK_LIB({zlib_lib},", + ) # Disable tests & examples - tools.replace_in_file(os.path.join(self._source_subfolder, "Makefile.am"), - "SUBDIRS = headers src tests examples", - "SUBDIRS = headers src") - - with tools.chdir(self._source_subfolder): - self.run("{} -fiv".format(tools.get_env("AUTORECONF")), win_bash=tools.os_info.is_windows) - # Relocatable shared lib for Apple platforms - tools.replace_in_file("configure", "-install_name \\$rpath/", "-install_name @rpath/") - autotools = self._configure_autotools() - autotools.make() - - @functools.lru_cache(1) - def _configure_autotools(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)), - "--disable-gcov", - ] - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - autotools.configure(args=args) - return autotools + replace_in_file( + self, os.path.join(self.source_folder, "Makefile.am"), + "SUBDIRS = headers src tests examples", "SUBDIRS = headers src", + ) def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - if self._is_msvc: - self._build_msvc() + self._patch_sources() + if is_msvc(self): + with chdir(self, self.source_folder): + target = "readosm_i.lib" if self.options.shared else "readosm.lib" + self.run(f"nmake -f makefile.vc {target}") else: - self._build_autotools() + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.autoreconf() + autotools.configure() + autotools.make() def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - if self._is_msvc: - self.copy("readosm.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, "readosm.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: - with tools.chdir(self._source_subfolder): - autotools = self._configure_autotools() + with chdir(self, self.source_folder): + 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_info(self): self.cpp_info.set_property("pkg_config_name", "readosm") - suffix = "_i" if self._is_msvc and self.options.shared else "" - self.cpp_info.libs = ["readosm{}".format(suffix)] + suffix = "_i" if is_msvc(self) and self.options.shared else "" + self.cpp_info.libs = [f"readosm{suffix}"] diff --git a/recipes/readosm/all/patches/0001-fix-nmake.patch b/recipes/readosm/all/patches/0001-fix-nmake.patch new file mode 100644 index 0000000000000..43d9d7d1957a1 --- /dev/null +++ b/recipes/readosm/all/patches/0001-fix-nmake.patch @@ -0,0 +1,27 @@ +--- a/makefile.vc ++++ b/makefile.vc +@@ -2,13 +2,12 @@ + # + # NMAKE Makefile to build libreadosm on Windows + # +-!INCLUDE nmake.opt + + LIBOBJ = src\readosm.obj src\osmxml.obj \ + src\protobuf.obj src\osm_objects.obj + READOSM_DLL = readosm$(VERSION).dll + +-CFLAGS = /nologo -I. -Iheaders -IC:\OSGeo4W\include $(OPTFLAGS) ++CFLAGS = /nologo -I. -Iheaders $(CFLAGS) $(OPTFLAGS) + + default: all + +@@ -22,8 +21,7 @@ $(READOSM_DLL): readosm_i.lib + + readosm_i.lib: $(LIBOBJ) + link /dll /out:$(READOSM_DLL) \ +- /implib:readosm_i.lib $(LIBOBJ) \ +- C:\OSGeo4w\lib\libexpat.lib C:\OSGeo4w\lib\zlib.lib ++ /implib:readosm_i.lib $(LIBOBJ) + if exist $(READOSM_DLL).manifest mt -manifest \ + $(READOSM_DLL).manifest -outputresource:$(READOSM_DLL);2 + diff --git a/recipes/readosm/all/patches/0001-nmake-honor-flags.patch b/recipes/readosm/all/patches/0001-nmake-honor-flags.patch deleted file mode 100644 index f8f590069d552..0000000000000 --- a/recipes/readosm/all/patches/0001-nmake-honor-flags.patch +++ /dev/null @@ -1,32 +0,0 @@ -This patch for msvc build allows to: -* define OPTFLAG ourself from conanfile (allow to honor profile) -* inject a custom SYSTEM_LIBS variable from conanfile (allow robust shared build) -* not hardcode this very specific C:\OSGeo4W environment - ---- a/makefile.vc -+++ b/makefile.vc -@@ -2,13 +2,12 @@ - # - # NMAKE Makefile to build libreadosm on Windows - # --!INCLUDE nmake.opt - - LIBOBJ = src\readosm.obj src\osmxml.obj \ - src\protobuf.obj src\osm_objects.obj - READOSM_DLL = readosm$(VERSION).dll - --CFLAGS = /nologo -I. -Iheaders -IC:\OSGeo4W\include $(OPTFLAGS) -+CFLAGS = /nologo -I. -Iheaders $(CFLAGS) $(OPTFLAGS) - - default: all - -@@ -22,8 +21,7 @@ $(READOSM_DLL): readosm_i.lib - - readosm_i.lib: $(LIBOBJ) - link /dll /out:$(READOSM_DLL) \ -- /implib:readosm_i.lib $(LIBOBJ) \ -- C:\OSGeo4w\lib\libexpat.lib C:\OSGeo4w\lib\zlib.lib -+ /implib:readosm_i.lib $(LIBOBJ) $(SYSTEM_LIBS) - if exist $(READOSM_DLL).manifest mt -manifest \ - $(READOSM_DLL).manifest -outputresource:$(READOSM_DLL);2 - diff --git a/recipes/readosm/all/test_package/CMakeLists.txt b/recipes/readosm/all/test_package/CMakeLists.txt index ac8d4c253bde9..8ea28640523dd 100644 --- a/recipes/readosm/all/test_package/CMakeLists.txt +++ b/recipes/readosm/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(readosm REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} readosm::readosm) +target_link_libraries(${PROJECT_NAME} PRIVATE readosm::readosm) diff --git a/recipes/readosm/all/test_package/conanfile.py b/recipes/readosm/all/test_package/conanfile.py index 697dfef261b53..0a6bc68712d90 100644 --- a/recipes/readosm/all/test_package/conanfile.py +++ b/recipes/readosm/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/readosm/all/test_v1_package/CMakeLists.txt b/recipes/readosm/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/readosm/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/readosm/all/test_v1_package/conanfile.py b/recipes/readosm/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/readosm/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/rebound/all/conandata.yml b/recipes/rebound/all/conandata.yml new file mode 100644 index 0000000000000..9c806c1b5b5a5 --- /dev/null +++ b/recipes/rebound/all/conandata.yml @@ -0,0 +1,10 @@ +sources: + "4.4.1": + url: "https://github.com/hannorein/rebound/archive/refs/tags/4.4.1.tar.gz" + sha256: "0ae7bdf20750cd0a83c4905a66c3cde211f09ac732ffb4cba9887e68aba5273b" +patches: + "4.4.1": + - patch_file: "patches/0001-4.4.1-stdio-legacy-fix.patch" + patch_description: "Link to legacy_stdio only when MSVC" + patch_type: "backport" + patch_source: "https://github.com/hannorein/rebound/pull/777" diff --git a/recipes/rebound/all/conanfile.py b/recipes/rebound/all/conanfile.py new file mode 100644 index 0000000000000..eb8767e10950a --- /dev/null +++ b/recipes/rebound/all/conanfile.py @@ -0,0 +1,78 @@ +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 chdir, copy, get, rm, rmdir, export_conandata_patches, apply_conandata_patches +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +import os + + +required_conan_version = ">=1.54.0" + + +class ReboundConan(ConanFile): + name = "rebound" + description = "REBOUND is an N-body integrator, i.e. a software package that can integrate the motion of particles under the influence of gravity." + license = "GPL-3.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/hannorein/rebound" + topics = ("physics", "simulation", "n-body", "gravity", "integrator") + package_type = "shared-library" + # Scripts always compile with optimizations enabled + settings = "os", "arch", "compiler" + + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) + + def export_sources(self): + export_conandata_patches(self) + + def configure(self): + 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 in ["Windows", "Macos"]: + raise ConanInvalidConfiguration(f"{self.ref} recipe does not support {self.settings.os}, contributions welcomed!") + + def validate_build(self): + if cross_building(self): + raise ConanInvalidConfiguration(f"{self.ref} cross-building is not supported yet, contributions welcomed!") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = AutotoolsToolchain(self) + tc.generate() + + def build(self): + apply_conandata_patches(self) + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.make(target="librebound") + + def package(self): + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + copy(self, "librebound.so", os.path.join(self.source_folder, "src"), os.path.join(self.package_folder, "lib")) + + copy(self, "*.h", os.path.join(self.source_folder, "src"), os.path.join(self.package_folder, "include")) + + # some files extensions and folders are not allowed. Please, read the FAQs to get informed. + 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")) + + # 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 = ["rebound"] + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("pthread") diff --git a/recipes/rebound/all/patches/0001-4.4.1-stdio-legacy-fix.patch b/recipes/rebound/all/patches/0001-4.4.1-stdio-legacy-fix.patch new file mode 100644 index 0000000000000..9fe5511878c30 --- /dev/null +++ b/recipes/rebound/all/patches/0001-4.4.1-stdio-legacy-fix.patch @@ -0,0 +1,24 @@ +From e775c5c070093facb17a732c3b509bfe0ca8ade7 Mon Sep 17 00:00:00 2001 +From: Uilian Ries +Date: Tue, 18 Jun 2024 11:39:22 +0200 +Subject: [PATCH] Link to legacy_stdio only when MSVC + +Signed-off-by: Uilian Ries +--- + src/rebound.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/rebound.c b/src/rebound.c +index 18267206b..40afe76f4 100644 +--- a/src/rebound.c ++++ b/src/rebound.c +@@ -23,7 +23,9 @@ + * + */ + #define _NO_CRT_STDIO_INLINE // WIN32 to use _vsprintf_s ++#if defined(_WIN32) && defined(_MSC_VER) + #pragma comment(lib, "legacy_stdio_definitions.lib") ++#endif + #include + #include + #include // for offsetof() diff --git a/recipes/rebound/all/test_package/CMakeLists.txt b/recipes/rebound/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..f16f7cf26d671 --- /dev/null +++ b/recipes/rebound/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) + +find_package(rebound REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE rebound::rebound) diff --git a/recipes/rebound/all/test_package/conanfile.py b/recipes/rebound/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0a808db45f245 --- /dev/null +++ b/recipes/rebound/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/rebound/all/test_package/test_package.c b/recipes/rebound/all/test_package/test_package.c new file mode 100644 index 0000000000000..1cf6ab75b9e69 --- /dev/null +++ b/recipes/rebound/all/test_package/test_package.c @@ -0,0 +1,31 @@ +#include "rebound.h" +#include +#include + + +// Simplified from the simplest.c example in the REBOUND source code. +int main(int argc, char* argv[]) { + struct reb_simulation* r = reb_simulation_create(); + + reb_simulation_add_fmt(r, "m", 1.); // Central object + reb_simulation_add_fmt(r, "m a e", 1e-3, 1., 0.1); // Jupiter mass planet + reb_simulation_add_fmt(r, "a e", 1.4, 0.1); // Massless test particle + + // First integrate for 1 time units. + reb_simulation_integrate(r, 1.); + + // Then output some coordinates and orbital elements. + for (int i=0; iN; i++){ + struct reb_particle p = r->particles[i]; + printf("%f %f %f\n", p.x, p.y, p.z); + } + struct reb_particle primary = r->particles[0]; + for (int i=1; iN; i++){ + struct reb_particle p = r->particles[i]; + struct reb_orbit o = reb_orbit_from_particle(r->G, p, primary); + printf("%f %f %f\n", o.a, o.e, o.f); + } + + // Cleanup + reb_simulation_free(r); +} diff --git a/recipes/rebound/config.yml b/recipes/rebound/config.yml new file mode 100644 index 0000000000000..695144f0acbc9 --- /dev/null +++ b/recipes/rebound/config.yml @@ -0,0 +1,3 @@ +versions: + "4.4.1": + folder: "all" diff --git a/recipes/recastnavigation/all/conandata.yml b/recipes/recastnavigation/all/conandata.yml index eeea285038775..e686b4b075c59 100644 --- a/recipes/recastnavigation/all/conandata.yml +++ b/recipes/recastnavigation/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.6.0": + url: "https://github.com/recastnavigation/recastnavigation/archive/refs/tags/v1.6.0.tar.gz" + sha256: "d48ca0121962fa0639502c0f56c4e3ae72f98e55d88727225444f500775c0074" "cci.20200511": url: "https://github.com/recastnavigation/recastnavigation/archive/df27e4eb1a4ade9912f8b7d75c25769a3193dbd0.tar.gz" sha256: "299fdcfe14749a26041f54b4a018b8c4918e0dd0283f77823b96247bc97c9400" diff --git a/recipes/recastnavigation/all/conanfile.py b/recipes/recastnavigation/all/conanfile.py index cc3eb12118665..b65376a3de248 100644 --- a/recipes/recastnavigation/all/conanfile.py +++ b/recipes/recastnavigation/all/conanfile.py @@ -1,6 +1,6 @@ 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 +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, mkdir, move_folder_contents, rmdir, rm import os required_conan_version = ">=1.52.0" @@ -35,23 +35,21 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + 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) - tc.variables["RECASTNAVIGATION_DEMO"] = False - tc.variables["RECASTNAVIGATION_TESTS"] = False - tc.variables["RECASTNAVIGATION_EXAMPLES"] = False + tc.cache_variables["RECASTNAVIGATION_DEMO"] = False + tc.cache_variables["RECASTNAVIGATION_TESTS"] = False + tc.cache_variables["RECASTNAVIGATION_EXAMPLES"] = False + tc.cache_variables["RECASTNAVIGATION_STATIC"] = not self.options.shared + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = self.options.shared tc.generate() def build(self): @@ -64,29 +62,45 @@ 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", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rm(self, "*.pdb", self.package_folder, recursive=True) + if self.version == "cci.20200511": + # Move the includes under recastnavigation/ prefix for future compatibility + mkdir(self, os.path.join(self.package_folder, "include", "recastnavigation")) + move_folder_contents(self, os.path.join(self.package_folder, "include"), + os.path.join(self.package_folder, "include", "recastnavigation")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "recastnavigation") self.cpp_info.set_property("pkg_config_name", "recastnavigation") + suffix = "" + if self.settings.build_type == "Debug" and self.version != "cci.20200511": + suffix = "-d" + self.cpp_info.components["Recast"].set_property("cmake_target_name", "RecastNavigation::Recast") - self.cpp_info.components["Recast"].libs = ["Recast"] + self.cpp_info.components["Recast"].libs = ["Recast" + suffix] self.cpp_info.components["Detour"].set_property("cmake_target_name", "RecastNavigation::Detour") - self.cpp_info.components["Detour"].libs = ["Detour"] + self.cpp_info.components["Detour"].libs = ["Detour" + suffix] self.cpp_info.components["DetourCrowd"].set_property("cmake_target_name", "RecastNavigation::DetourCrowd") - self.cpp_info.components["DetourCrowd"].libs = ["DetourCrowd"] + self.cpp_info.components["DetourCrowd"].libs = ["DetourCrowd" + suffix] self.cpp_info.components["DetourCrowd"].requires = ["Detour"] self.cpp_info.components["DetourTileCache"].set_property("cmake_target_name", "RecastNavigation::DetourTileCache") - self.cpp_info.components["DetourTileCache"].libs = ["DetourTileCache"] + self.cpp_info.components["DetourTileCache"].libs = ["DetourTileCache" + suffix] self.cpp_info.components["DetourTileCache"].requires = ["Detour"] self.cpp_info.components["DebugUtils"].set_property("cmake_target_name", "RecastNavigation::DebugUtils") - self.cpp_info.components["DebugUtils"].libs = ["DebugUtils"] + self.cpp_info.components["DebugUtils"].libs = ["DebugUtils" + suffix] self.cpp_info.components["DebugUtils"].requires = ["Recast", "Detour", "DetourTileCache"] + if self.version == "cci.20200511": + for component in self.cpp_info.components.values(): + component.includedirs.append(os.path.join("include", "recastnavigation")) + # TODO: to remove in conan v2 self.cpp_info.filenames["cmake_find_package"] = "recastnavigation" self.cpp_info.filenames["cmake_find_package_multi"] = "recastnavigation" diff --git a/recipes/recastnavigation/all/patches/001_fix_shared_option.patch b/recipes/recastnavigation/all/patches/001_fix_shared_option.patch index bacfaff6244ab..3d9c7f9ec982f 100644 --- a/recipes/recastnavigation/all/patches/001_fix_shared_option.patch +++ b/recipes/recastnavigation/all/patches/001_fix_shared_option.patch @@ -1,129 +1,50 @@ ---- CMakeLists.txt 2020-05-11 12:26:17.000000000 -0400 -+++ CMakeLists.txt 2020-08-07 12:39:31.306787200 -0400 -@@ -9,7 +9,10 @@ - option(RECASTNAVIGATION_DEMO "Build demo" ON) - option(RECASTNAVIGATION_TESTS "Build tests" ON) - option(RECASTNAVIGATION_EXAMPLES "Build examples" ON) --option(RECASTNAVIGATION_STATIC "Build static libraries" ON) -+ -+if(MSVC AND BUILD_SHARED_LIBS) -+ set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) -+endif() - - add_subdirectory(DebugUtils) - add_subdirectory(Detour) -@@ -25,3 +28,4 @@ - enable_testing() - add_subdirectory(Tests) - endif () -+ --- DebugUtils/CMakeLists.txt 2020-05-11 12:26:17.000000000 -0400 +++ DebugUtils/CMakeLists.txt 2020-08-07 12:40:03.921473100 -0400 -@@ -1,10 +1,6 @@ - file(GLOB SOURCES Source/*.cpp) - --if (RECASTNAVIGATION_STATIC) -- add_library(DebugUtils STATIC ${SOURCES}) --else() -- add_library(DebugUtils SHARED ${SOURCES}) --endif() -+add_library(DebugUtils ${SOURCES}) - - add_library(RecastNavigation::DebugUtils ALIAS DebugUtils) - -@@ -26,6 +22,7 @@ +@@ -26,6 +26,7 @@ ) install(TARGETS DebugUtils -+ RUNTIME DESTINATION bin ++ RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib COMPONENT library --- Detour/CMakeLists.txt 2020-05-11 12:26:17.000000000 -0400 +++ Detour/CMakeLists.txt 2020-08-07 12:40:36.783319300 -0400 -@@ -1,10 +1,6 @@ - file(GLOB SOURCES Source/*.cpp) - --if(RECASTNAVIGATION_STATIC) -- add_library(Detour STATIC ${SOURCES}) --else() -- add_library(Detour SHARED ${SOURCES}) --endif() -+add_library(Detour ${SOURCES}) - - add_library(RecastNavigation::Detour ALIAS Detour) - -@@ -20,6 +16,7 @@ +@@ -20,6 +10,7 @@ ) install(TARGETS Detour -+ RUNTIME DESTINATION bin ++ RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib COMPONENT library --- DetourCrowd/CMakeLists.txt 2020-05-11 12:26:17.000000000 -0400 +++ DetourCrowd/CMakeLists.txt 2020-08-07 12:41:02.664066800 -0400 -@@ -1,10 +1,6 @@ - file(GLOB SOURCES Source/*.cpp) - --if (RECASTNAVIGATION_STATIC) -- add_library(DetourCrowd STATIC ${SOURCES}) --else () -- add_library(DetourCrowd SHARED ${SOURCES}) --endif () -+add_library(DetourCrowd ${SOURCES}) - - add_library(RecastNavigation::DetourCrowd ALIAS DetourCrowd) - -@@ -24,6 +20,7 @@ +@@ -24,6 +24,7 @@ ) install(TARGETS DetourCrowd -+ RUNTIME DESTINATION bin ++ RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib COMPONENT library --- DetourTileCache/CMakeLists.txt 2020-05-11 12:26:17.000000000 -0400 +++ DetourTileCache/CMakeLists.txt 2020-08-07 12:41:30.253060000 -0400 -@@ -1,10 +1,6 @@ - file(GLOB SOURCES Source/*.cpp) - --if (RECASTNAVIGATION_STATIC) -- add_library(DetourTileCache STATIC ${SOURCES}) --else () -- add_library(DetourTileCache SHARED ${SOURCES}) --endif () -+add_library(DetourTileCache ${SOURCES}) - - add_library(RecastNavigation::DetourTileCache ALIAS DetourTileCache) - -@@ -25,6 +21,7 @@ +@@ -25,6 +25,7 @@ install(TARGETS DetourTileCache -+ RUNTIME DESTINATION bin ++ RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib COMPONENT library --- Recast/CMakeLists.txt 2020-05-11 12:26:17.000000000 -0400 +++ Recast/CMakeLists.txt 2020-08-07 12:41:53.370875500 -0400 -@@ -1,10 +1,6 @@ - file(GLOB SOURCES Source/*.cpp) - --if (RECASTNAVIGATION_STATIC) -- add_library(Recast STATIC ${SOURCES}) --else () -- add_library(Recast SHARED ${SOURCES}) --endif () -+add_library(Recast ${SOURCES}) - - add_library(RecastNavigation::Recast ALIAS Recast) - -@@ -20,6 +16,7 @@ +@@ -20,6 +20,7 @@ ) install(TARGETS Recast -+ RUNTIME DESTINATION bin ++ RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib COMPONENT library diff --git a/recipes/recastnavigation/all/test_package/test_package.cpp b/recipes/recastnavigation/all/test_package/test_package.cpp index d2e829330dc17..3d78635409b1f 100644 --- a/recipes/recastnavigation/all/test_package/test_package.cpp +++ b/recipes/recastnavigation/all/test_package/test_package.cpp @@ -1,4 +1,4 @@ -#include "Recast.h" +#include "recastnavigation/Recast.h" int main() { rcSqrt(2); diff --git a/recipes/recastnavigation/config.yml b/recipes/recastnavigation/config.yml index 1a308ccfdedcc..a9e154d1a98c6 100644 --- a/recipes/recastnavigation/config.yml +++ b/recipes/recastnavigation/config.yml @@ -1,3 +1,5 @@ versions: + "1.6.0": + folder: all "cci.20200511": - folder: "all" + folder: all diff --git a/recipes/rectanglebinpack/all/CMakeLists.txt b/recipes/rectanglebinpack/all/CMakeLists.txt deleted file mode 100644 index eab353d687736..0000000000000 --- a/recipes/rectanglebinpack/all/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 3.8) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) - -add_subdirectory("source_subfolder") diff --git a/recipes/rectanglebinpack/all/conandata.yml b/recipes/rectanglebinpack/all/conandata.yml index 076654555cbc6..d50cf8d87d51a 100644 --- a/recipes/rectanglebinpack/all/conandata.yml +++ b/recipes/rectanglebinpack/all/conandata.yml @@ -1,10 +1,10 @@ sources: + "cci.20230923": + - url: "https://github.com/juj/RectangleBinPack/archive/83e7e1132d93777e3732dfaae26b0f3703be2036.zip" + sha256: "ec8f20227fc79467cf7c5b5656e3e520712ee446fb9e449d42e1e5b4565f6bdc" "cci.20210901": - url: "https://github.com/juj/RectangleBinPack/archive/a40fcaf3871da57b0f6a080655b3387374840877.zip" sha256: "88cec105ca8d90d09e9e81f9862caa0cc1cdb851560fb701555eb58b29515748" - - url: "https://unlicense.org/UNLICENSE" - sha256: "7e12e5df4bae12cb21581ba157ced20e1986a0508dd10d0e8a4ab9a4cf94e85c" patches: "cci.20210901": - patch_file: "patches/0001_fix_win32_build.patch" - base_path: "source_subfolder" diff --git a/recipes/rectanglebinpack/all/conanfile.py b/recipes/rectanglebinpack/all/conanfile.py index c7332f9531164..f77182eff1815 100644 --- a/recipes/rectanglebinpack/all/conanfile.py +++ b/recipes/rectanglebinpack/all/conanfile.py @@ -1,19 +1,23 @@ -from conans import ConanFile, CMake, tools import os -required_conan_version = ">=1.33.0" +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, load, save + +required_conan_version = ">=1.53.0" class RectangleBinPackConan(ConanFile): name = "rectanglebinpack" - license = "Unlicense" + description = "The code can be used to solve the problem of packing a set of 2D rectangles into a larger bin." + license = "LicenseRef-rectanglebinpack-public-domain" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/juj/RectangleBinPack" - description = "The code can be used to solve the problem of packing a set of 2D rectangles into a larger bin." topics = ("rectangle", "packing", "bin") - exports_sources = ["CMakeLists.txt", "patches/**"] - 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,15 +27,8 @@ class RectangleBinPackConan(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": @@ -39,40 +36,58 @@ 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) + check_min_cppstd(self, 11) def source(self): - tools.get(**self.conan_data["sources"][self.version][0], - strip_root=True, destination=self._source_subfolder) - tools.download(filename="LICENSE", **self.conan_data["sources"][self.version][1]) + get(self, **self.conan_data["sources"][self.version][0], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = 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 _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 _extract_license(self): + readme_content = load(self, os.path.join(self.source_folder, "Readme.txt"), encoding="latin-1") + license_content = "\n".join(readme_content.splitlines()[-4:]) + save(self, os.path.join(self.package_folder, "licenses", "LICENSE"), license_content) def package(self): - self.copy("LICENSE", dst="licenses") - self.copy("*.h", dst=os.path.join("include", self.name), src=self._source_subfolder, excludes="old/**") - self.copy("*.dll", dst="bin", keep_path=False) - self.copy("*.lib", dst="lib", keep_path=False) - self.copy("*.so", dst="lib", keep_path=False) - self.copy("*.dylib", dst="lib", keep_path=False) - self.copy("*.a", dst="lib", keep_path=False) + self._extract_license() + copy(self, "*.h", + dst=os.path.join(self.package_folder, "include", self.name), + src=self.source_folder, + excludes="old/**") + copy(self, "*.dll", + dst=os.path.join(self.package_folder, "bin"), + src=self.build_folder, + keep_path=False) + for pattern in ["*.lib", "*.so", "*.dylib", "*.a"]: + copy(self, pattern, + dst=os.path.join(self.package_folder, "lib"), + src=self.build_folder, + keep_path=False) def package_info(self): self.cpp_info.libs = ["RectangleBinPack"] + self.cpp_info.set_property("cmake_file_name", "RectangleBinPack") + self.cpp_info.set_property("cmake_target_name", "RectangleBinPack::RectangleBinPack") + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs = ["m"] + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.names["cmake_find_package"] = "RectangleBinPack" self.cpp_info.names["cmake_find_package_multi"] = "RectangleBinPack" diff --git a/recipes/rectanglebinpack/all/test_package/CMakeLists.txt b/recipes/rectanglebinpack/all/test_package/CMakeLists.txt index 2d0f2eeb0d746..4147475a867bb 100644 --- a/recipes/rectanglebinpack/all/test_package/CMakeLists.txt +++ b/recipes/rectanglebinpack/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.4) -project(test_package) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(RectangleBinPack REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE RectangleBinPack::RectangleBinPack) set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) diff --git a/recipes/rectanglebinpack/all/test_package/conanfile.py b/recipes/rectanglebinpack/all/test_package/conanfile.py index 16ec9f68ef974..ef5d7042163ec 100644 --- a/recipes/rectanglebinpack/all/test_package/conanfile.py +++ b/recipes/rectanglebinpack/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" + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/rectanglebinpack/all/test_package/test_package.cpp b/recipes/rectanglebinpack/all/test_package/test_package.cpp index b5c67148547b0..7a8bca93d7839 100644 --- a/recipes/rectanglebinpack/all/test_package/test_package.cpp +++ b/recipes/rectanglebinpack/all/test_package/test_package.cpp @@ -5,43 +5,38 @@ #include #include -#include #include +#include using namespace rbp; -bool AreDisjoint(const Rect &a, const Rect &b) -{ - return a.x >= b.x + b.width || a.x + a.width <= b.x || - a.y >= b.y + b.height || a.y + a.height <= b.y; +bool AreDisjoint(const Rect &a, const Rect &b) { + return a.x >= b.x + b.width || a.x + a.width <= b.x || a.y >= b.y + b.height || + a.y + a.height <= b.y; } -bool AllRectsDisjoint(std::vector &packed) -{ - for(size_t i = 0; i < packed.size(); ++i) - for(size_t j = i+1; j < packed.size(); ++j) - { - if (!AreDisjoint(packed[i], packed[j])) - return false; - } - return true; +bool AllRectsDisjoint(std::vector &packed) { + for (size_t i = 0; i < packed.size(); ++i) + for (size_t j = i + 1; j < packed.size(); ++j) { + if (!AreDisjoint(packed[i], packed[j])) + return false; + } + return true; } -int main() -{ - MaxRectsBinPack pack(256, 256, true); +int main() { + MaxRectsBinPack pack(256, 256, true); - std::vector packed; - srand(12412); - for(int i = 1; i < 128; ++i) - { - int a = (rand() % 128) + 1; - int b = (rand() % 128) + 1; - Rect r = pack.Insert(a, b, MaxRectsBinPack::RectBestShortSideFit); - if (!r.width) - break; - packed.push_back(r); - } - printf("Packed %d rectangles. All rects disjoint: %s. Occupancy: %f\n", - (int)packed.size(), AllRectsDisjoint(packed) ? "yes" : "NO!", pack.Occupancy()); + std::vector packed; + srand(12412); + for (int i = 1; i < 128; ++i) { + int a = (rand() % 128) + 1; + int b = (rand() % 128) + 1; + Rect r = pack.Insert(a, b, MaxRectsBinPack::RectBestShortSideFit); + if (!r.width) + break; + packed.push_back(r); + } + printf("Packed %d rectangles. All rects disjoint: %s. Occupancy: %f\n", (int)packed.size(), + AllRectsDisjoint(packed) ? "yes" : "NO!", pack.Occupancy()); } diff --git a/recipes/rectanglebinpack/all/test_v1_package/CMakeLists.txt b/recipes/rectanglebinpack/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/rectanglebinpack/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/rectanglebinpack/all/test_v1_package/conanfile.py b/recipes/rectanglebinpack/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..90eb89e3f2f46 --- /dev/null +++ b/recipes/rectanglebinpack/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/rectanglebinpack/config.yml b/recipes/rectanglebinpack/config.yml index 610b8f5b3b81f..b499d3b7e32dc 100644 --- a/recipes/rectanglebinpack/config.yml +++ b/recipes/rectanglebinpack/config.yml @@ -1,3 +1,5 @@ versions: + "cci.20230923": + folder: "all" "cci.20210901": folder: "all" diff --git a/recipes/rectpack2d/all/conanfile.py b/recipes/rectpack2d/all/conanfile.py index f4e81a4a0bdcb..3c0eda3c2b8b3 100644 --- a/recipes/rectpack2d/all/conanfile.py +++ b/recipes/rectpack2d/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 copy, get +from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.50.0" class Rectpack2dConan(ConanFile): @@ -12,49 +15,56 @@ class Rectpack2dConan(ConanFile): description = "C++17 rectangle packing library" topics = ("header-only", "rectpack2d", "graphical", "cpp17") license = "MIT" + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - settings = "compiler" @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return "17" @property - def _minimum_cpp_standard(self): - return 17 - - @property - def _minimum_compilers_version(self): + def _min_compilers_version(self): return { "Visual Studio": "15.7", + "msvc": "191", "gcc": "7", "clang": "5", "apple-clang": "10", } - 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.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)) + 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._min_compilers_version.get(str(self.settings.compiler), False) + if min_version and loose_lt_semver(str(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], strip_root=True) - def package(self): - self.copy(pattern="LICENSE", dst="licenses", - src=self._source_subfolder) - self.copy(pattern="*.h", dst=os.path.join("include", "rectpack2d"), - src=os.path.join(self._source_subfolder, "src")) + 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=os.path.join(self.source_folder, "src"), dst=os.path.join(self.package_folder, "include", "rectpack2d")) + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/rectpack2d/all/test_package/CMakeLists.txt b/recipes/rectpack2d/all/test_package/CMakeLists.txt index cb7ed1d19feb8..5676b880e88bb 100644 --- a/recipes/rectpack2d/all/test_package/CMakeLists.txt +++ b/recipes/rectpack2d/all/test_package/CMakeLists.txt @@ -1,12 +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() - -set(CMAKE_CXX_STANDARD 17) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS OFF) +find_package(rectpack2d REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE rectpack2d::rectpack2d) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/rectpack2d/all/test_package/conanfile.py b/recipes/rectpack2d/all/test_package/conanfile.py index 5493d58611803..0a6bc68712d90 100644 --- a/recipes/rectpack2d/all/test_package/conanfile.py +++ b/recipes/rectpack2d/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" + 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/rectpack2d/all/test_v1_package/CMakeLists.txt b/recipes/rectpack2d/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/rectpack2d/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/rectpack2d/all/test_v1_package/conanfile.py b/recipes/rectpack2d/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/rectpack2d/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/redboltz-mqtt_cpp/all/conandata.yml b/recipes/redboltz-mqtt_cpp/all/conandata.yml index ad87340ad9e35..edcba50235f7c 100644 --- a/recipes/redboltz-mqtt_cpp/all/conandata.yml +++ b/recipes/redboltz-mqtt_cpp/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "13.2.1": + url: "https://github.com/redboltz/mqtt_cpp/archive/v13.2.1.tar.gz" + sha256: "7607536cb7e0e4d32831ef068c48d3d62707df80ba35c5a3fdc31851e7876a9d" "13.0.0": url: "https://github.com/redboltz/mqtt_cpp/archive/refs/tags/v13.0.0.tar.gz" sha256: "5d06caa1218feb23d0a63892ced7b0edfd1f686002676175f6e384275a27a1e7" diff --git a/recipes/redboltz-mqtt_cpp/all/conanfile.py b/recipes/redboltz-mqtt_cpp/all/conanfile.py index 8fdf7f70084cf..2b3717a2d67c0 100644 --- a/recipes/redboltz-mqtt_cpp/all/conanfile.py +++ b/recipes/redboltz-mqtt_cpp/all/conanfile.py @@ -1,8 +1,14 @@ -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.52.0" + class MqttCPPConan(ConanFile): name = "redboltz-mqtt_cpp" @@ -10,50 +16,60 @@ class MqttCPPConan(ConanFile): license = "BSL-1.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/redboltz/mqtt_cpp" - topics = ("mqtt", "boost", "asio") + topics = ("mqtt", "boost", "asio", "header-only") + + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" - generators = "cmake" no_copy_source = True @property - def _source_subfolder(self): - return "source_subfolder" - - def requirements(self): - self.requires("boost/1.79.0") - - def package_id(self): - self.info.header_only() + def _min_cppstd(self): + return 14 @property def _compilers_minimum_version(self): return { "gcc": "6", - "Visual Studio": "15.0", + "Visual Studio": "15", + "msvc": "191", "clang": "5", "apple-clang": "10", } - + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("boost/1.83.0") + + 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) 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("{} requires C++14, which your compiler does not support.".format(self.name)) - else: - self.output.warn("{} requires C++14. Your compiler is unknown. Assuming it supports C++14.".format(self.name)) - + 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 package(self): - self.copy(pattern="LICENSE_1_0.txt", dst="licenses", src=self._source_subfolder) - self.copy(pattern="*.hpp", dst="include", src=os.path.join(self._source_subfolder, "include")) + copy(self, "LICENSE_1_0.txt", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder) + 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.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.set_property("cmake_file_name", "mqtt_cpp") self.cpp_info.set_property("cmake_target_name", "mqtt_cpp::mqtt_cpp") diff --git a/recipes/redboltz-mqtt_cpp/all/test_package/CMakeLists.txt b/recipes/redboltz-mqtt_cpp/all/test_package/CMakeLists.txt index d57b3a725b42c..bb306edeaaa9c 100644 --- a/recipes/redboltz-mqtt_cpp/all/test_package/CMakeLists.txt +++ b/recipes/redboltz-mqtt_cpp/all/test_package/CMakeLists.txt @@ -1,10 +1,6 @@ -cmake_minimum_required(VERSION 3.8) - +cmake_minimum_required(VERSION 3.15) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(mqtt_cpp REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/redboltz-mqtt_cpp/all/test_package/conanfile.py b/recipes/redboltz-mqtt_cpp/all/test_package/conanfile.py index 38f4483872d47..ef5d7042163ec 100644 --- a/recipes/redboltz-mqtt_cpp/all/test_package/conanfile.py +++ b/recipes/redboltz-mqtt_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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/redboltz-mqtt_cpp/all/test_package/test_package.cpp b/recipes/redboltz-mqtt_cpp/all/test_package/test_package.cpp index 65e10348b409b..a75d73b3ececd 100644 --- a/recipes/redboltz-mqtt_cpp/all/test_package/test_package.cpp +++ b/recipes/redboltz-mqtt_cpp/all/test_package/test_package.cpp @@ -6,7 +6,7 @@ int main() { boost::asio::io_context ioc; auto c = MQTT_NS::make_async_client(ioc, "localhost", "40000"); - + c->set_client_id("test_package"); c->set_clean_session(true); diff --git a/recipes/redboltz-mqtt_cpp/all/test_v1_package/CMakeLists.txt b/recipes/redboltz-mqtt_cpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/redboltz-mqtt_cpp/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/redboltz-mqtt_cpp/all/test_v1_package/conanfile.py b/recipes/redboltz-mqtt_cpp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/redboltz-mqtt_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/redboltz-mqtt_cpp/config.yml b/recipes/redboltz-mqtt_cpp/config.yml index ed9e26c6552eb..3eb6ce30d6747 100644 --- a/recipes/redboltz-mqtt_cpp/config.yml +++ b/recipes/redboltz-mqtt_cpp/config.yml @@ -1,3 +1,5 @@ versions: + "13.2.1": + folder: all "13.0.0": folder: all diff --git a/recipes/redis-plus-plus/all/conandata.yml b/recipes/redis-plus-plus/all/conandata.yml index ce8377c9cadd8..87ed20e99676e 100644 --- a/recipes/redis-plus-plus/all/conandata.yml +++ b/recipes/redis-plus-plus/all/conandata.yml @@ -1,17 +1,56 @@ sources: + "1.3.13": + url: "https://github.com/sewenew/redis-plus-plus/archive/1.3.13.tar.gz" + sha256: "678a61898ed72f0c692102c7ce103a1bcae1e6ff85a4ad03e6002c1ba8fe1e08" + "1.3.12": + url: "https://github.com/sewenew/redis-plus-plus/archive/1.3.12.tar.gz" + sha256: "26c1e45cdbafe1af4d2cf756957b2268baab6f802b53bcdd435864620e2c03c7" + "1.3.11": + url: "https://github.com/sewenew/redis-plus-plus/archive/1.3.11.tar.gz" + sha256: "bb4990eed60d3654cd6902b9e67b3ab43e52557e84315560660b0c9e64b6ff77" + "1.3.10": + url: "https://github.com/sewenew/redis-plus-plus/archive/1.3.10.tar.gz" + sha256: "85d9d9ff84c873c4a14bd28bee569a1f311285fad8d4f2fb0e472f65d4bb842a" + "1.3.8": + url: "https://github.com/sewenew/redis-plus-plus/archive/1.3.8.tar.gz" + sha256: "ad521b4a24d1591a1564f945ba6370875b501210222e324f398065251df41641" + "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 - "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.3.tar.gz" + sha256: "1a3336752133019c963e06c28667b96690d6395b804e5e326671777ff88982ea" patches: + "1.3.13": + - patch_file: "patches/1.3.13-0001-fix-dependencies-injection.patch" + patch_description: "Robust discovery & injection of dependencies, and handle missing hiredis_ssl-config.cmake" + patch_type: "conan" + "1.3.12": + - patch_file: "patches/1.3.8-0001-fix-dependencies-injection.patch" + patch_description: "Robust discovery & injection of dependencies, and handle missing hiredis_ssl-config.cmake" + patch_type: "conan" + "1.3.11": + - patch_file: "patches/1.3.8-0001-fix-dependencies-injection.patch" + patch_description: "Robust discovery & injection of dependencies, and handle missing hiredis_ssl-config.cmake" + patch_type: "conan" + "1.3.10": + - patch_file: "patches/1.3.8-0001-fix-dependencies-injection.patch" + patch_description: "Robust discovery & injection of dependencies, and handle missing hiredis_ssl-config.cmake" + patch_type: "conan" + "1.3.8": + - patch_file: "patches/1.3.8-0001-fix-dependencies-injection.patch" + patch_description: "Robust discovery & injection of dependencies, and handle missing hiredis_ssl-config.cmake" + patch_type: "conan" + "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-0001-fix-dependencies-injection.patch" patch_description: "Robust discovery & injection of dependencies, and handle missing hiredis_ssl-config.cmake" @@ -24,10 +63,3 @@ patches: - 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/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 0fdfa9ba24d64..6370311a8d6a8 100644 --- a/recipes/redis-plus-plus/all/conanfile.py +++ b/recipes/redis-plus-plus/all/conanfile.py @@ -2,21 +2,21 @@ 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.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir from conan.tools.scm import Version import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class RedisPlusPlusConan(ConanFile): name = "redis-plus-plus" - homepage = "https://github.com/sewenew/redis-plus-plus" description = "Redis client written in C++" - topics = ("database", "redis", "client", "tls") - url = "https://github.com/conan-io/conan-center-index" license = "Apache-2.0" - + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/sewenew/redis-plus-plus" + topics = ("database", "redis", "client", "tls") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -33,7 +33,7 @@ class RedisPlusPlusConan(ConanFile): @property def _min_cppstd(self): - return "11" if Version(self.version) < "1.3.0" else "17" + return "11" @property def _compilers_minimum_version(self): @@ -58,18 +58,15 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("hiredis/1.0.2") + self.requires("hiredis/1.2.0", transitive_headers=True, transitive_libs=True) if self.options.get_safe("build_async"): - self.requires("libuv/1.44.2") + self.requires("libuv/1.47.0") def validate(self): if self.info.settings.compiler.get_safe("cppstd"): @@ -85,34 +82,25 @@ def validate(self): raise ConanInvalidConfiguration(f"{self.name}:with_tls=True requires hiredis:with_ssl=True") 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) - 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 + cppstd = str(self.settings.get_safe("compiler.cppstd", 11)).replace("gnu", "") + 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.variables["REDIS_PLUS_PLUS_BUILD_STATIC_WITH_PIC"] = self.options.shared tc.generate() deps = CMakeDeps(self) deps.generate() def _patch_sources(self): 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() @@ -142,6 +130,7 @@ def package_info(self): 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++" diff --git a/recipes/redis-plus-plus/all/patches/1.2.1-0001-fix-hiredis-consumption.patch b/recipes/redis-plus-plus/all/patches/1.2.1-0001-fix-hiredis-consumption.patch deleted file mode 100644 index de2b4ddbe2f80..0000000000000 --- a/recipes/redis-plus-plus/all/patches/1.2.1-0001-fix-hiredis-consumption.patch +++ /dev/null @@ -1,62 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -29,6 +29,7 @@ if (REDIS_PLUS_PLUS_USE_TLS) - message(STATUS "Build with TLS support") - - set(TLS_SUB_DIR "${PROJECT_SOURCE_DIR}/tls") -+ find_package(hiredis REQUIRED hiredis_ssl CONFIG) - else() - set(TLS_SUB_DIR "${PROJECT_SOURCE_DIR}/no_tls") - endif() -@@ -36,8 +37,7 @@ endif() - file(GLOB TLS_SOURCE_FILES "${TLS_SUB_DIR}/*.cpp") - - # hiredis dependency --find_path(HIREDIS_HEADER hiredis) --find_library(HIREDIS_LIB hiredis) -+find_package(hiredis REQUIRED hiredis CONFIG) - - # Build static library - option(REDIS_PLUS_PLUS_BUILD_STATIC "Build static library" ON) -@@ -48,7 +48,7 @@ if (REDIS_PLUS_PLUS_BUILD_STATIC) - add_library(${STATIC_LIB} STATIC ${PROJECT_SOURCE_FILES} ${TLS_SOURCE_FILES}) - - target_include_directories(${STATIC_LIB} PUBLIC ${PROJECT_SOURCE_DIR} ${TLS_SUB_DIR}) -- target_include_directories(${STATIC_LIB} PUBLIC ${HIREDIS_HEADER}) -+ target_link_libraries(${STATIC_LIB} PUBLIC hiredis::hiredis) - - if (WIN32) - target_compile_definitions(${STATIC_LIB} PRIVATE NOMINMAX) -@@ -58,6 +58,10 @@ if (REDIS_PLUS_PLUS_BUILD_STATIC) - set_target_properties(${STATIC_LIB} PROPERTIES OUTPUT_NAME ${PROJECT_NAME}) - endif() - -+ if (REDIS_PLUS_PLUS_USE_TLS) -+ target_link_libraries(${STATIC_LIB} PUBLIC hiredis::hiredis_ssl) -+ endif() -+ - set_target_properties(${STATIC_LIB} PROPERTIES CLEAN_DIRECT_OUTPUT 1) - set_target_properties(${STATIC_LIB} PROPERTIES POSITION_INDEPENDENT_CODE ON) - endif() -@@ -71,7 +75,7 @@ if (REDIS_PLUS_PLUS_BUILD_SHARED) - add_library(${SHARED_LIB} SHARED ${PROJECT_SOURCE_FILES} ${TLS_SOURCE_FILES}) - - target_include_directories(${SHARED_LIB} PUBLIC ${PROJECT_SOURCE_DIR} ${TLS_SUB_DIR}) -- target_include_directories(${SHARED_LIB} PUBLIC ${HIREDIS_HEADER}) -+ target_link_libraries(${SHARED_LIB} PUBLIC hiredis::hiredis) - - if (WIN32) - target_compile_definitions(${SHARED_LIB} PRIVATE NOMINMAX) -@@ -79,11 +83,9 @@ if (REDIS_PLUS_PLUS_BUILD_SHARED) - set_target_properties(${SHARED_LIB} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE) - endif() - -- target_link_libraries(${SHARED_LIB} ${HIREDIS_LIB}) - - if (REDIS_PLUS_PLUS_USE_TLS) -- find_library(HIREDIS_TLS_LIB hiredis_ssl) -- target_link_libraries(${SHARED_LIB} ${HIREDIS_TLS_LIB}) -+ target_link_libraries(${SHARED_LIB} PUBLIC hiredis::hiredis_ssl) - endif() - - set_target_properties(${SHARED_LIB} PROPERTIES OUTPUT_NAME ${PROJECT_NAME}) 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 deleted file mode 100644 index d00f3b331f4ab..0000000000000 --- a/recipes/redis-plus-plus/all/patches/1.2.1-0002-cmake-minimum-required.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- 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.3.13-0001-fix-dependencies-injection.patch b/recipes/redis-plus-plus/all/patches/1.3.13-0001-fix-dependencies-injection.patch new file mode 100644 index 0000000000000..ab8824faf6a00 --- /dev/null +++ b/recipes/redis-plus-plus/all/patches/1.3.13-0001-fix-dependencies-injection.patch @@ -0,0 +1,59 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index ae2507e..8ef058b 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -45,8 +45,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() +@@ -144,7 +143,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) + find_package(OpenSSL REQUIRED) + list(APPEND REDIS_PLUS_PLUS_HIREDIS_LIBS ${OPENSSL_LIBRARIES}) +@@ -174,17 +172,12 @@ endif() + set(HIREDIS_FEATURE_TEST_HEADER "${HIREDIS_FEATURE_TEST_INCLUDE}/hiredis/hiredis.h") + + include(CheckSymbolExists) +-set(CMAKE_REQUIRED_LIBRARIES_BACK ${CMAKE_REQUIRED_LIBRARIES}) +-set(CMAKE_REQUIRED_LIBRARIES ${HIREDIS_FEATURE_TEST_LIB}) + + CHECK_SYMBOL_EXISTS(redisEnableKeepAliveWithInterval ${HIREDIS_FEATURE_TEST_HEADER} REDIS_PLUS_PLUS_HAS_redisEnableKeepAliveWithInterval) + + set(REDIS_PLUS_PLUS_GENERATED_HEADER_DIR ${CMAKE_CURRENT_BINARY_DIR}/${REDIS_PLUS_PLUS_HEADER_DIR}) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/hiredis_features.h.in ${CMAKE_CURRENT_BINARY_DIR}/${REDIS_PLUS_PLUS_SOURCE_DIR}/hiredis_features.h) + +-# Restore CMAKE_REQUIRED_LIBRARIES +-set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES_BACK}) +- + # Build static library + option(REDIS_PLUS_PLUS_BUILD_STATIC "Build static library" ON) + message(STATUS "redis-plus-plus build static library: ${REDIS_PLUS_PLUS_BUILD_STATIC}") +@@ -228,7 +221,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() +@@ -283,8 +276,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.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..0dcd6b097c60a --- /dev/null +++ b/recipes/redis-plus-plus/all/patches/1.3.7-0001-fix-dependencies-injection.patch @@ -0,0 +1,41 @@ +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() +@@ -131,7 +130,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) + find_package(OpenSSL REQUIRED) + list(APPEND REDIS_PLUS_PLUS_HIREDIS_LIBS ${OPENSSL_LIBRARIES}) +@@ -191,7 +189,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/patches/1.3.8-0001-fix-dependencies-injection.patch b/recipes/redis-plus-plus/all/patches/1.3.8-0001-fix-dependencies-injection.patch new file mode 100644 index 0000000000000..620986816daec --- /dev/null +++ b/recipes/redis-plus-plus/all/patches/1.3.8-0001-fix-dependencies-injection.patch @@ -0,0 +1,58 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 6470b32..d372d3d 100644 +--- 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() +@@ -133,7 +132,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) + find_package(OpenSSL REQUIRED) + list(APPEND REDIS_PLUS_PLUS_HIREDIS_LIBS ${OPENSSL_LIBRARIES}) +@@ -163,16 +161,10 @@ endif() + set(HIREDIS_FEATURE_TEST_HEADER "${HIREDIS_FEATURE_TEST_INCLUDE}/hiredis/hiredis.h") + + include(CheckSymbolExists) +-set(CMAKE_REQUIRED_LIBRARIES_BACK ${CMAKE_REQUIRED_LIBRARIES}) +-set(CMAKE_REQUIRED_LIBRARIES ${HIREDIS_FEATURE_TEST_LIB}) +- + CHECK_SYMBOL_EXISTS(redisEnableKeepAliveWithInterval ${HIREDIS_FEATURE_TEST_HEADER} REDIS_PLUS_PLUS_HAS_redisEnableKeepAliveWithInterval) + + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/hiredis_features.h.in ${CMAKE_CURRENT_SOURCE_DIR}/${REDIS_PLUS_PLUS_SOURCE_DIR}/hiredis_features.h) + +-# Restore CMAKE_REQUIRED_LIBRARIES +-set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES_BACK}) +- + # Build static library + option(REDIS_PLUS_PLUS_BUILD_STATIC "Build static library" ON) + message(STATUS "redis-plus-plus build static library: ${REDIS_PLUS_PLUS_BUILD_STATIC}") +@@ -214,7 +206,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() +@@ -267,8 +259,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 df9a8c785c48c..a2c2b3348228e 100644 --- a/recipes/redis-plus-plus/all/test_package/CMakeLists.txt +++ b/recipes/redis-plus-plus/all/test_package/CMakeLists.txt @@ -9,10 +9,15 @@ if(TARGET 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() - # 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) + +if(NOT CMAKE_CXX_STANDARD) + # Cover the case where compiler.cppstd is not defined in the Conan profile + # (e.g. Conan 1.x), and define the compiler standard assuming the library defaults instead + if(redis++_VERSION VERSION_GREATER_EQUAL "1.3.0") + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) + else() + # 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() endif() diff --git a/recipes/redis-plus-plus/config.yml b/recipes/redis-plus-plus/config.yml index c4181ae02bba7..e058f2167283c 100644 --- a/recipes/redis-plus-plus/config.yml +++ b/recipes/redis-plus-plus/config.yml @@ -1,9 +1,19 @@ versions: + "1.3.13": + folder: all + "1.3.12": + folder: all + "1.3.11": + folder: all + "1.3.10": + folder: all + "1.3.8": + folder: all + "1.3.7": + folder: all "1.3.3": folder: all "1.3.2": folder: all "1.2.3": folder: all - "1.2.1": - folder: all diff --git a/recipes/redradist-icc/all/CMakeLists.txt b/recipes/redradist-icc/all/CMakeLists.txt deleted file mode 100644 index bd3083b512cb9..0000000000000 --- a/recipes/redradist-icc/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/redradist-icc/all/conanfile.py b/recipes/redradist-icc/all/conanfile.py index 926df39193116..1c501628eb1da 100644 --- a/recipes/redradist-icc/all/conanfile.py +++ b/recipes/redradist-icc/all/conanfile.py @@ -1,33 +1,35 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration, ConanException -import os +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 export_conandata_patches, get + +required_conan_version = ">=1.53.0" class ICCConan(ConanFile): - name = 'redradist-icc' - homepage = 'https://github.com/redradist/Inter-Component-Communication' - license = 'MIT' - url = 'https://github.com/conan-io/conan-center-index' - description = "I.C.C. - Inter Component Communication, This is a library created to simplify communication between " \ - "components inside of single application. It is thread safe and could be used for creating " \ - "components that works in different threads. " + name = "redradist-icc" + description = ( + "I.C.C. - Inter Component Communication, This is a library created to simplify communication between " + "components inside of single application. It is thread safe and could be used for creating " + "components that works in different threads. " + ) + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/redradist/Inter-Component-Communication" topics = ("thread-safe", "active-object", "communication") - settings = "os", "compiler", "build_type", "arch" + + 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, + "shared": False, + "fPIC": True, } - generators = "cmake", "cmake_find_package", "cmake_find_package_multi" - - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" @property def _minimum_cpp_standard(self): @@ -37,79 +39,75 @@ def _minimum_cpp_standard(self): def _minimum_compilers_version(self): return { "Visual Studio": "15", + "msvc": "191", "apple-clang": "9.4", "clang": "3.3", - "gcc": "4.9.4" + "gcc": "4.9.4", } - def _configure_cmake(self): - if self._cmake: - return self._cmake - cmake = CMake(self) - cmake.definitions['ICC_BUILD_SHARED'] = self.options.shared - cmake.configure() - self._cmake = cmake - return self._cmake - - def validate(self): - if self.settings.get_safe("compiler.cppstd"): - tools.check_min_cppstd(self, self._minimum_cpp_standard) - - os = self.settings.os - if os not in ("Windows", "Linux"): - msg = ( - "OS {} is not supported !!" - ).format(os) - raise ConanInvalidConfiguration(msg) - - compiler = self.settings.compiler - try: - min_version = self._minimum_compilers_version[str(compiler)] - 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) + 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 export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._minimum_cpp_standard) + + if is_apple_os(self): + raise ConanInvalidConfiguration(f"OS {self.settings.os} is not supported") + + def lazy_lt_semver(v1, v2): + # To allow version "9" >= "9.4" for apple-clang + return all(int(p1) < int(p2) for p1, p2 in zip(str(v1).split("."), str(v2).split("."))) + + compiler = self.settings.compiler + min_version = self._minimum_compilers_version.get(str(compiler)) + if min_version and lazy_lt_semver(compiler.version, min_version): + raise ConanInvalidConfiguration( + f"{self.name} requires C++{self._minimum_cpp_standard} features " + f"which are not supported by compiler {compiler} {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], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["ICC_BUILD_SHARED"] = 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() + cmake = CMake(self) cmake.install() def package_info(self): - self.cpp_info.names["cmake_find_package"] = "icc" - self.cpp_info.names["cmake_find_package_multi"] = "icc" + self.cpp_info.set_property("cmake_file_name", "icc") + self.cpp_info.set_property("cmake_target_name", "icc::icc") + if self.options.shared: self.cpp_info.libs = ["ICC"] else: self.cpp_info.libs = ["ICC_static"] - if self.settings.os == 'Windows': - self.cpp_info.system_libs = ['ws2_32', 'wsock32'] - if self.settings.os == 'Linux': - self.cpp_info.system_libs = ['pthread'] + if self.settings.os == "Windows": + self.cpp_info.system_libs = ["ws2_32", "wsock32"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs = ["pthread"] + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.names["cmake_find_package"] = "icc" + self.cpp_info.names["cmake_find_package_multi"] = "icc" diff --git a/recipes/redradist-icc/all/test_package/CMakeLists.txt b/recipes/redradist-icc/all/test_package/CMakeLists.txt index de507b485e0da..1e80ea5e97b76 100644 --- a/recipes/redradist-icc/all/test_package/CMakeLists.txt +++ b/recipes/redradist-icc/all/test_package/CMakeLists.txt @@ -1,12 +1,9 @@ -cmake_minimum_required(VERSION 3.1) -project(PackageTest) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) set(CMAKE_CXX_STANDARD 11) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - -find_package(icc REQUIRED) +find_package(icc REQUIRED CONFIG) add_executable(example example.cpp) target_link_libraries(example PRIVATE icc::icc) diff --git a/recipes/redradist-icc/all/test_package/conanfile.py b/recipes/redradist-icc/all/test_package/conanfile.py index b80e4a18de9ec..8d52b7021efe1 100644 --- a/recipes/redradist-icc/all/test_package/conanfile.py +++ b/recipes/redradist-icc/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 ICCTestConan(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,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.bindir, "example") + self.run(bin_path, env="conanrun") diff --git a/recipes/redradist-icc/all/test_package/example.cpp b/recipes/redradist-icc/all/test_package/example.cpp index cbf15d36a28cd..2a8c9ea6d9adf 100644 --- a/recipes/redradist-icc/all/test_package/example.cpp +++ b/recipes/redradist-icc/all/test_package/example.cpp @@ -1,14 +1,15 @@ #include #include #include -#include #include +#include + int main() { auto timer = icc::os::Timer::createTimer(); - timer->setInterval(std::chrono::seconds(10)); + timer->setInterval(std::chrono::milliseconds(100)); timer->enableContinuous(); timer->start(); - std::this_thread::sleep_for(std::chrono::seconds(25)); + std::this_thread::sleep_for(std::chrono::seconds(1)); return 0; } diff --git a/recipes/redradist-icc/all/test_v1_package/CMakeLists.txt b/recipes/redradist-icc/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/redradist-icc/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/redradist-icc/all/test_v1_package/conanfile.py b/recipes/redradist-icc/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..fc78d14187e40 --- /dev/null +++ b/recipes/redradist-icc/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class ICCTestConan(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', 'example') + self.run(bin_path, run_environment=True) 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..cfecdf8a0b5ec 100644 --- a/recipes/refl-cpp/all/conanfile.py +++ b/recipes/refl-cpp/all/conanfile.py @@ -1,52 +1,69 @@ -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" + package_type = "header-library" + 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) - 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)) + 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." + ) + + 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: - 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)) + 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/reflect-cpp/all/conandata.yml b/recipes/reflect-cpp/all/conandata.yml new file mode 100644 index 0000000000000..cb9c3acfa130e --- /dev/null +++ b/recipes/reflect-cpp/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.16.0": + url: "https://github.com/getml/reflect-cpp/archive/refs/tags/v0.16.0.tar.gz" + sha256: "a84d94dbd353d788926d6e54507b44c046863f7bc4ecb35afe0338374a68a77d" diff --git a/recipes/reflect-cpp/all/conanfile.py b/recipes/reflect-cpp/all/conanfile.py new file mode 100644 index 0000000000000..86e30443a2c97 --- /dev/null +++ b/recipes/reflect-cpp/all/conanfile.py @@ -0,0 +1,145 @@ +from conan import ConanFile +from conan.tools.files import get, copy, rmdir, replace_in_file +from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps +from conan.tools.env import VirtualBuildEnv +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration + +import os + +required_conan_version = ">=2.0.9" + + +class ReflectCppConan(ConanFile): + name = "reflect-cpp" + description = "C++-20 library for fast serialization, deserialization and validation using reflection" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/getml/reflect-cpp" + topics = ( + "reflection", + "serialization", + "memory", + "cbor", + "flatbuffers", + "json", + "msgpack", + "toml", + "xml", + "yaml", + ) + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + + @property + def _compilers_minimum_version(self): + # TODO: MSVC 19.38 is required, but ConanCenterIndex CI has update 6 installed. + # Update msvc to 193 when having the CI updated to the latest update. + return { + "msvc": "194", + "gcc": "11", + "clang": "13", + "apple-clang": "15", + } + + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_cbor": [True, False], + "with_flatbuffers": [True, False], + "with_msgpack": [True, False], + "with_toml": [True, False], + "with_ubjson": [True, False], + "with_xml": [True, False], + "with_yaml": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_cbor": False, + "with_flatbuffers": False, + "with_msgpack": False, + "with_toml": False, + "with_ubjson": False, + "with_xml": False, + "with_yaml": False, + } + implements = ["auto_shared_fpic"] + + def requirements(self): + self.requires("ctre/3.9.0", transitive_headers=True) + # INFO: include/rfl/json/Writer.hpp includes yyjson.h + # INFO: Transitive lib needed to avoid undefined reference to symbol 'yyjson_mut_doc_new' + self.requires("yyjson/0.10.0", transitive_headers=True, transitive_libs=True) + if self.options.with_cbor: + self.requires("tinycbor/0.6.0", transitive_headers=True) + if self.options.with_flatbuffers: + self.requires("flatbuffers/24.3.25", transitive_headers=True) + if self.options.with_msgpack: + self.requires("msgpack-c/6.0.0", transitive_headers=True) + if self.options.with_toml: + self.requires("tomlplusplus/3.4.0", transitive_headers=True) + if self.options.with_ubjson: + self.requires("jsoncons/0.176.0", transitive_headers=True) + if self.options.with_xml: + self.requires("pugixml/1.14", transitive_headers=True) + if self.options.with_yaml: + self.requires("yaml-cpp/0.8.0", transitive_headers=True) + + def build_requirements(self): + self.tool_requires("cmake/[>=3.23 <4]") + + def validate(self): + check_min_cppstd(self, 20) + 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++20 features, which your compiler does not fully support.") + + def layout(self): + cmake_layout(self, src_folder="src") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + # INFO: Let Conan handle the C++ standard used via settings.compiler.cppstd + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "set(CMAKE_CXX_STANDARD 20)", "") + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + deps = CMakeDeps(self) + if self.options.with_flatbuffers: + deps.set_property("flatbuffers", "cmake_target_name", "flatbuffers::flatbuffers") + deps.generate() + tc = CMakeToolchain(self) + tc.cache_variables["REFLECTCPP_BUILD_SHARED"] = self.options.shared + tc.cache_variables["REFLECTCPP_USE_BUNDLED_DEPENDENCIES"] = False + tc.cache_variables["REFLECTCPP_USE_VCPKG"] = False + tc.cache_variables["REFLECTCPP_CBOR"] = self.options.with_cbor + tc.cache_variables["REFLECTCPP_FLEXBUFFERS"] = self.options.with_flatbuffers + tc.cache_variables["REFLECTCPP_MSGPACK"] = self.options.with_msgpack + tc.cache_variables["REFLECTCPP_TOML"] = self.options.with_toml + tc.cache_variables["REFLECTCPP_XML"] = self.options.with_xml + tc.cache_variables["REFLECTCPP_YAML"] = self.options.with_yaml + 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 = ["reflectcpp"] + self.cpp_info.set_property("cmake_target_name", "reflectcpp::reflectcpp") + self.cpp_info.set_property("cmake_file_name", "reflectcpp") diff --git a/recipes/reflect-cpp/all/test_package/CMakeLists.txt b/recipes/reflect-cpp/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..74f3b52f1538e --- /dev/null +++ b/recipes/reflect-cpp/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(reflectcpp REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} reflectcpp::reflectcpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) + diff --git a/recipes/reflect-cpp/all/test_package/conanfile.py b/recipes/reflect-cpp/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a66d61a9b1e97 --- /dev/null +++ b/recipes/reflect-cpp/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): + 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/reflect-cpp/all/test_package/test_package.cpp b/recipes/reflect-cpp/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..1c46040d570e8 --- /dev/null +++ b/recipes/reflect-cpp/all/test_package/test_package.cpp @@ -0,0 +1,15 @@ +#include +#include +#include + +#include "rfl.hpp" +#include "rfl/Generic.hpp" +#include "rfl/json.hpp" + +int main(void) { + auto person = rfl::Generic::Object(); + person["first_name"] = "John"; + person["last_name"] = "Doe"; + rfl::json::write(person, std::cout) << std::endl; + return EXIT_SUCCESS; +} diff --git a/recipes/reflect-cpp/config.yml b/recipes/reflect-cpp/config.yml new file mode 100644 index 0000000000000..e5e40881d5003 --- /dev/null +++ b/recipes/reflect-cpp/config.yml @@ -0,0 +1,3 @@ +versions: + "0.16.0": + folder: all diff --git a/recipes/replxx/all/CMakeLists.txt b/recipes/replxx/all/CMakeLists.txt deleted file mode 100644 index d17aaff199b4a..0000000000000 --- a/recipes/replxx/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/replxx/all/conandata.yml b/recipes/replxx/all/conandata.yml index dc32e4cea0525..cc779ef163dc2 100644 --- a/recipes/replxx/all/conandata.yml +++ b/recipes/replxx/all/conandata.yml @@ -1,10 +1,18 @@ sources: - "0.0.2": - sha256: 6f5c58b4cd23550d5a589d134727296438793cb818ce7158fbd5e1b0db1548ba - url: https://github.com/AmokHuginnsson/replxx/archive/release-0.0.2.tar.gz - "0.0.3": - sha256: 72ad0655eead16544645b1724b27a988543fcefd14d46df6e8dfef17d9ba50ac - url: https://github.com/AmokHuginnsson/replxx/archive/release-0.0.3.tar.gz "0.0.4": url: "https://github.com/AmokHuginnsson/replxx/archive/release-0.0.4.tar.gz" sha256: "a22988b2184e1d256e2d111b5749e16ffb1accbf757c7b248226d73c426844c4" + "0.0.3": + url: "https://github.com/AmokHuginnsson/replxx/archive/release-0.0.3.tar.gz" + sha256: "72ad0655eead16544645b1724b27a988543fcefd14d46df6e8dfef17d9ba50ac" +patches: + "0.0.4": + - patch_file: "patches/0.0.4-0001-fix-export-symbols-windows.patch" + patch_description: "Fix export of symbols for Windows" + patch_type: "portability" + patch_source: "https://github.com/AmokHuginnsson/replxx/pull/151" + "0.0.3": + - patch_file: "patches/0.0.3-0001-fix-export-symbols-windows.patch" + patch_description: "Fix export of symbols for Windows" + patch_type: "portability" + patch_source: "https://github.com/AmokHuginnsson/replxx/pull/151" diff --git a/recipes/replxx/all/conanfile.py b/recipes/replxx/all/conanfile.py index 072b7fd6bb25f..72beed1028bdc 100644 --- a/recipes/replxx/all/conanfile.py +++ b/recipes/replxx/all/conanfile.py @@ -1,7 +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, export_conandata_patches, get, rmdir +from conan.tools.microsoft import is_msvc import os -from conans import CMake, ConanFile, tools -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class ReplxxConan(ConanFile): name = "replxx" @@ -9,12 +13,11 @@ class ReplxxConan(ConanFile): A readline and libedit replacement that supports UTF-8, syntax highlighting, hints and Windows and is BSD licensed. """ + license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/AmokHuginnsson/replxx" topics = ("readline", "libedit", "UTF-8") - license = "BSD-3-Clause" - exports_sources = ["CMakeLists.txt"] - generators = "cmake" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -25,15 +28,12 @@ class ReplxxConan(ConanFile): "fPIC": True, } - _cmake = None - @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 11 - def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -41,37 +41,49 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") - def _configure_cmake(self): - if not self._cmake: - self._cmake = CMake(self) - self._cmake.definitions["REPLXX_BuildExamples"] = False - self._cmake.definitions["BUILD_STATIC_LIBS"] = not self.options.shared - self._cmake.configure() - return self._cmake + 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): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["REPLXX_BUILD_EXAMPLES"] = False + tc.variables["REPLXX_BUILD_PACKAGE"] = False + tc.generate() def build(self): - if tools.Version(self.version) < "0.0.3": - tools.replace_in_file( - os.path.join(self._source_subfolder, "src", "io.cxx"), - "#include \n", - "#include \n#include \n" - ) - 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, 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, "share")) + 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", "replxx") + self.cpp_info.set_property("cmake_target_name", "replxx::replxx") + libname = "replxx" + if is_msvc(self) and not self.options.shared: + libname += "-static" + if self.settings.build_type == "Debug": + libname += "-d" + elif self.settings.build_type == "RelWithDebInfo": + libname += "-rd" + self.cpp_info.libs = [libname] + + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["pthread", "m"] if not self.options.shared: self.cpp_info.defines.append("REPLXX_STATIC") - self.cpp_info.filenames["cmake_find_package"] = "replxx" - self.cpp_info.filenames["cmake_find_package_multi"] = "replxx" diff --git a/recipes/replxx/all/patches/0.0.3-0001-fix-export-symbols-windows.patch b/recipes/replxx/all/patches/0.0.3-0001-fix-export-symbols-windows.patch new file mode 100644 index 0000000000000..752c888324f23 --- /dev/null +++ b/recipes/replxx/all/patches/0.0.3-0001-fix-export-symbols-windows.patch @@ -0,0 +1,51 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -15,7 +15,6 @@ if (NOT DEFINED CMAKE_C_STANDARD) + set(CMAKE_C_STANDARD 99) + endif() + +-set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + set(CMAKE_CXX_STANDARD_REQUIRED ON) + set(CMAKE_CXX_EXTENSIONS ON) + +@@ -77,8 +76,8 @@ target_compile_definitions( + replxx + PUBLIC + $<$>:REPLXX_STATIC> +- $<$:REPLXX_BUILDING_DLL> + PRIVATE ++ $<$:REPLXX_BUILDING_DLL> + $<$:_CRT_SECURE_NO_WARNINGS=1 /ignore:4503> + ) + target_compile_options( +--- a/include/replxx.h ++++ b/include/replxx.h +@@ -435,7 +435,7 @@ REPLXX_IMPEXP void replxx_bind_key( Replxx*, int code, key_press_handler_t handl + * \param actionName - name of internal action to be invoked on key press. + * \return -1 if invalid action name was used, 0 otherwise. + */ +-int replxx_bind_key_internal( Replxx*, int code, char const* actionName ); ++REPLXX_IMPEXP int replxx_bind_key_internal( Replxx*, int code, char const* actionName ); + + REPLXX_IMPEXP void replxx_set_preload_buffer( Replxx*, const char* preloadText ); + +@@ -552,7 +552,7 @@ REPLXX_IMPEXP int replxx_history_load( Replxx*, const char* filename ); + REPLXX_IMPEXP void replxx_history_clear( Replxx* ); + REPLXX_IMPEXP void replxx_clear_screen( Replxx* ); + #ifdef __REPLXX_DEBUG__ +-void replxx_debug_dump_print_codes(void); ++REPLXX_IMPEXP void replxx_debug_dump_print_codes(void); + #endif + /* the following is extension to the original linenoise API */ + REPLXX_IMPEXP int replxx_install_window_change_handler( Replxx* ); +--- a/include/replxx.hxx ++++ b/include/replxx.hxx +@@ -242,7 +242,7 @@ public: + } + }; + class HistoryScanImpl; +- class HistoryScan { ++ class REPLXX_IMPEXP HistoryScan { + public: + typedef std::unique_ptr impl_t; + private: diff --git a/recipes/replxx/all/patches/0.0.4-0001-fix-export-symbols-windows.patch b/recipes/replxx/all/patches/0.0.4-0001-fix-export-symbols-windows.patch new file mode 100644 index 0000000000000..12104832cd70d --- /dev/null +++ b/recipes/replxx/all/patches/0.0.4-0001-fix-export-symbols-windows.patch @@ -0,0 +1,151 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -15,7 +15,6 @@ if (NOT DEFINED CMAKE_C_STANDARD) + set(CMAKE_C_STANDARD 99) + endif() + +-set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + set(CMAKE_CXX_STANDARD_REQUIRED ON) + set(CMAKE_CXX_EXTENSIONS ON) + +@@ -77,8 +76,8 @@ target_compile_definitions( + replxx + PUBLIC + $<$>:REPLXX_STATIC> +- $<$:REPLXX_BUILDING_DLL> + PRIVATE ++ $<$:REPLXX_BUILDING_DLL> + $<$:_CRT_SECURE_NO_WARNINGS=1 /ignore:4503> + ) + target_compile_options( +--- a/include/replxx.h ++++ b/include/replxx.h +@@ -449,7 +449,7 @@ REPLXX_IMPEXP void replxx_bind_key( Replxx*, int code, key_press_handler_t handl + * \param actionName - name of internal action to be invoked on key press. + * \return -1 if invalid action name was used, 0 otherwise. + */ +-int replxx_bind_key_internal( Replxx*, int code, char const* actionName ); ++REPLXX_IMPEXP int replxx_bind_key_internal( Replxx*, int code, char const* actionName ); + + REPLXX_IMPEXP void replxx_set_preload_buffer( Replxx*, const char* preloadText ); + +@@ -572,7 +572,7 @@ REPLXX_IMPEXP int replxx_history_load( Replxx*, const char* filename ); + REPLXX_IMPEXP void replxx_history_clear( Replxx* ); + REPLXX_IMPEXP void replxx_clear_screen( Replxx* ); + #ifdef __REPLXX_DEBUG__ +-void replxx_debug_dump_print_codes(void); ++REPLXX_IMPEXP void replxx_debug_dump_print_codes(void); + #endif + /* the following is extension to the original linenoise API */ + REPLXX_IMPEXP int replxx_install_window_change_handler( Replxx* ); +@@ -587,35 +587,35 @@ REPLXX_IMPEXP void replxx_disable_bracketed_paste( Replxx* ); + * \param color2 - second input color. + * \return A new color definition that represent combined input colors. + */ +-ReplxxColor replxx_color_combine( ReplxxColor color1, ReplxxColor color2 ); ++REPLXX_IMPEXP ReplxxColor replxx_color_combine( ReplxxColor color1, ReplxxColor color2 ); + + /*! \brief Transform foreground color definition into a background color definition. + * + * \param color - an input foreground color definition. + * \return A background color definition that is a transformed input \e color. + */ +-ReplxxColor replxx_color_bg( ReplxxColor color ); ++REPLXX_IMPEXP ReplxxColor replxx_color_bg( ReplxxColor color ); + + /*! \brief Add `bold` attribute to color definition. + * + * \param color - an input color definition. + * \return A new color definition with bold attribute set. + */ +-ReplxxColor replxx_color_bold( ReplxxColor color ); ++REPLXX_IMPEXP ReplxxColor replxx_color_bold( ReplxxColor color ); + + /*! \brief Add `underline` attribute to color definition. + * + * \param color - an input color definition. + * \return A new color definition with underline attribute set. + */ +-ReplxxColor replxx_color_underline( ReplxxColor color ); ++REPLXX_IMPEXP ReplxxColor replxx_color_underline( ReplxxColor color ); + + /*! \brief Create a new grayscale color of given brightness level. + * + * \param level - a brightness level for new color, must be between 0 (darkest) and 23 (brightest). + * \return A new grayscale color of a given brightest \e level. + */ +-ReplxxColor replxx_color_grayscale( int level ); ++REPLXX_IMPEXP ReplxxColor replxx_color_grayscale( int level ); + + /*! \brief Create a new color in 6×6×6 RGB color space from base component levels. + * +@@ -624,7 +624,7 @@ ReplxxColor replxx_color_grayscale( int level ); + * \param blue - a blue (of RGB) component level, must be 0 and 5. + * \return A new color in 6×6×6 RGB color space. + */ +-ReplxxColor replxx_color_rgb666( int red, int green, int blue ); ++REPLXX_IMPEXP ReplxxColor replxx_color_rgb666( int red, int green, int blue ); + + #ifdef __cplusplus + } +--- a/include/replxx.hxx ++++ b/include/replxx.hxx +@@ -249,7 +249,7 @@ public: + } + }; + class HistoryScanImpl; +- class HistoryScan { ++ class REPLXX_IMPEXP HistoryScan { + public: + typedef std::unique_ptr impl_t; + private: +@@ -646,35 +646,35 @@ namespace color { + * \param color2 - second input color. + * \return A new color definition that represent combined input colors. + */ +-Replxx::Color operator | ( Replxx::Color color1, Replxx::Color color2 ); ++REPLXX_IMPEXP Replxx::Color operator | ( Replxx::Color color1, Replxx::Color color2 ); + + /*! \brief Transform foreground color definition into a background color definition. + * + * \param color - an input foreground color definition. + * \return A background color definition that is a transformed input \e color. + */ +-Replxx::Color bg( Replxx::Color color ); ++REPLXX_IMPEXP Replxx::Color bg( Replxx::Color color ); + + /*! \brief Add `bold` attribute to color definition. + * + * \param color - an input color definition. + * \return A new color definition with bold attribute set. + */ +-Replxx::Color bold( Replxx::Color color ); ++REPLXX_IMPEXP Replxx::Color bold( Replxx::Color color ); + + /*! \brief Add `underline` attribute to color definition. + * + * \param color - an input color definition. + * \return A new color definition with underline attribute set. + */ +-Replxx::Color underline( Replxx::Color color ); ++REPLXX_IMPEXP Replxx::Color underline( Replxx::Color color ); + + /*! \brief Create a new grayscale color of given brightness level. + * + * \param level - a brightness level for new color, must be between 0 (darkest) and 23 (brightest). + * \return A new grayscale color of a given brightest \e level. + */ +-Replxx::Color grayscale( int level ); ++REPLXX_IMPEXP Replxx::Color grayscale( int level ); + + /*! \brief Create a new color in 6×6×6 RGB color space from base component levels. + * +@@ -683,7 +683,7 @@ Replxx::Color grayscale( int level ); + * \param blue - a blue (of RGB) component level, must be 0 and 5. + * \return A new color in 6×6×6 RGB color space. + */ +-Replxx::Color rgb666( int red, int green, int blue ); ++REPLXX_IMPEXP Replxx::Color rgb666( int red, int green, int blue ); + + } + diff --git a/recipes/replxx/all/test_package/CMakeLists.txt b/recipes/replxx/all/test_package/CMakeLists.txt index 55da8e6493036..8b0f16b38a428 100644 --- a/recipes/replxx/all/test_package/CMakeLists.txt +++ b/recipes/replxx/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(replxx CONFIG REQUIRED) +find_package(replxx REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} replxx::replxx) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE replxx::replxx) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/replxx/all/test_package/conanfile.py b/recipes/replxx/all/test_package/conanfile.py index 7e2dfe859bb27..ef5d7042163ec 100644 --- a/recipes/replxx/all/test_package/conanfile.py +++ b/recipes/replxx/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/replxx/all/test_v1_package/CMakeLists.txt b/recipes/replxx/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..be00a8c7f57c7 --- /dev/null +++ b/recipes/replxx/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/replxx/all/test_v1_package/conanfile.py b/recipes/replxx/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/replxx/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/replxx/config.yml b/recipes/replxx/config.yml index 234def7eb2dfa..9579ce3b8a9cd 100644 --- a/recipes/replxx/config.yml +++ b/recipes/replxx/config.yml @@ -1,8 +1,5 @@ ---- versions: - "0.0.2": + "0.0.4": folder: "all" "0.0.3": folder: "all" - "0.0.4": - folder: "all" diff --git a/recipes/reproc/all/conandata.yml b/recipes/reproc/all/conandata.yml new file mode 100644 index 0000000000000..a3605662cc0ab --- /dev/null +++ b/recipes/reproc/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "14.2.5": + url: "https://github.com/DaanDeMeyer/reproc/archive/refs/tags/v14.2.5.tar.gz" + sha256: "69467be0cfc80734b821c54ada263c8f1439f964314063f76b7cf256c3dc7ee8" diff --git a/recipes/reproc/all/conanfile.py b/recipes/reproc/all/conanfile.py new file mode 100644 index 0000000000000..9097df0dcfa45 --- /dev/null +++ b/recipes/reproc/all/conanfile.py @@ -0,0 +1,98 @@ +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, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, rm, rmdir +from conan.tools.scm import Version + + +class PackageConan(ConanFile): + name = "reproc" + description = "A cross-platform C99 process library" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/DaanDeMeyer/reproc" + topics = ("process-management", "process", "cross-platform") + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "cxx": [True, False], + "multithreaded": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "cxx": True, + "multithreaded": 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") + if not self.options.cxx: + 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.cxx: + check_min_cppstd(self, 11) + if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "6": + # drain.hpp:55:43: error: ‘stream’ is not a class, namespace, or enumeration + raise ConanInvalidConfiguration("GCC < 6 is not supported") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["REPROC++"] = self.options.cxx + tc.variables["REPROC_MULTITHREADED"] = self.options.multithreaded + tc.variables["REPROC_TEST"] = False + tc.variables["REPROC_EXAMPLES"] = False + tc.generate() + + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + 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")) + rm(self, "*.pdb", self.package_folder, recursive=True) + + def package_info(self): + cmake_config_name = "reproc++" if self.options.cxx else "reproc" + self.cpp_info.set_property("cmake_file_name", cmake_config_name) + + self.cpp_info.components["reproc_c"].set_property("pkg_config_name", "reproc") + self.cpp_info.components["reproc_c"].set_property("cmake_target_name", "reproc") + self.cpp_info.components["reproc_c"].libs = ["reproc"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["reproc_c"].system_libs.append("rt") + if self.options.multithreaded: + self.cpp_info.components["reproc_c"].system_libs.append("pthread") + elif self.settings.os == "Windows": + self.cpp_info.components["reproc_c"].system_libs.append("Ws2_32") + + if self.options.cxx: + self.cpp_info.components["reproc_cxx"].set_property("pkg_config_name", "reproc++") + self.cpp_info.components["reproc_cxx"].set_property("cmake_target_name", "reproc++") + self.cpp_info.components["reproc_cxx"].libs = ["reproc++"] + self.cpp_info.components["reproc_cxx"].requires = ["reproc_c"] diff --git a/recipes/reproc/all/test_package/CMakeLists.txt b/recipes/reproc/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..c9164d8e481d9 --- /dev/null +++ b/recipes/reproc/all/test_package/CMakeLists.txt @@ -0,0 +1,18 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C CXX) + +if(WITH_CXX) + find_package(reproc++ REQUIRED CONFIG) +else() + find_package(reproc REQUIRED CONFIG) +endif() + +add_executable(${PROJECT_NAME}_c test_package.c) +target_link_libraries(${PROJECT_NAME}_c PRIVATE reproc) +target_compile_features(${PROJECT_NAME}_c PRIVATE c_std_99) + +if(WITH_CXX) + add_executable(${PROJECT_NAME}_cpp test_package.cpp) + target_link_libraries(${PROJECT_NAME}_cpp PRIVATE reproc++) + target_compile_features(${PROJECT_NAME}_cpp PRIVATE cxx_std_11) +endif() diff --git a/recipes/reproc/all/test_package/conanfile.py b/recipes/reproc/all/test_package/conanfile.py new file mode 100644 index 0000000000000..564792987ded2 --- /dev/null +++ b/recipes/reproc/all/test_package/conanfile.py @@ -0,0 +1,34 @@ +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["WITH_CXX"] = self.dependencies["reproc"].options.get_safe("cxx") + 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.bindir, "test_package_c") + self.run(bin_path, env="conanrun") + if (self.dependencies["reproc"].options.get_safe("cxx")): + bin_path = os.path.join(self.cpp.build.bindir, "test_package_cpp") + self.run(bin_path, env="conanrun") diff --git a/recipes/reproc/all/test_package/test_package.c b/recipes/reproc/all/test_package/test_package.c new file mode 100644 index 0000000000000..8faa1f59953e3 --- /dev/null +++ b/recipes/reproc/all/test_package/test_package.c @@ -0,0 +1,14 @@ +#include +#include + +int main() +{ + reproc_t *process = reproc_new(); + if (!process) { + fprintf(stderr, "Failed to create reproc process.\n"); + return 1; + } + printf("reproc setup successful. Process object created.\n"); + reproc_destroy(process); + return 0; +} diff --git a/recipes/reproc/all/test_package/test_package.cpp b/recipes/reproc/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..e21d308880ab5 --- /dev/null +++ b/recipes/reproc/all/test_package/test_package.cpp @@ -0,0 +1,16 @@ +#include +#include + +int main() +{ + try { + reproc::process process; + reproc::options options; + options.redirect.parent = true; + std::cout << "reproc++ setup successful. Process object created.\n"; + } catch (const std::exception &e) { + std::cerr << "Error: " << e.what() << '\n'; + return 1; + } + return 0; +} diff --git a/recipes/reproc/config.yml b/recipes/reproc/config.yml new file mode 100644 index 0000000000000..b315d53552983 --- /dev/null +++ b/recipes/reproc/config.yml @@ -0,0 +1,3 @@ +versions: + "14.2.5": + folder: all diff --git a/recipes/resiprocate/all/conandata.yml b/recipes/resiprocate/all/conandata.yml index 30a690c6f981a..3c5856f5a74a9 100644 --- a/recipes/resiprocate/all/conandata.yml +++ b/recipes/resiprocate/all/conandata.yml @@ -1,4 +1,4 @@ sources: "1.12.0": - url: https://www.resiprocate.org/files/pub/reSIProcate/releases/resiprocate-1.12.0.tar.gz - sha256: 046826503d3c8682ae0e42101b28f903c5f988235f1ff4a98dbfb9066d0d3d49 + url: "https://github.com/resiprocate/resiprocate/archive/refs/tags/resiprocate-1.12.0.tar.gz" + sha256: "aa8906082e4221bffbfab3210df68a6ba1f57ba1532d89ea4572b4fa9877914f" diff --git a/recipes/resiprocate/all/conanfile.py b/recipes/resiprocate/all/conanfile.py index 54400194c9ba3..65f010b869c78 100644 --- a/recipes/resiprocate/all/conanfile.py +++ b/recipes/resiprocate/all/conanfile.py @@ -1,94 +1,106 @@ import os -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.env import VirtualRunEnv +from conan.tools.files import copy, get, rm, rmdir, chdir +from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps +from conan.tools.layout import basic_layout + +required_conan_version = ">=1.53.0" -required_conan_version = ">=1.29.1" class ResiprocateConan(ConanFile): name = "resiprocate" - description = "The project is dedicated to maintaining a complete, correct, and commercially usable implementation of SIP and a few related protocols. " - topics = ("sip", "voip", "communication", "signaling") - url = "https://github.com/conan-io/conan-center-index" - homepage = "http://www.resiprocate.org" + description = ( + "The project is dedicated to maintaining a complete, correct, " + "and commercially usable implementation of SIP and a few related protocols." + ) license = "VSL-1.0" - settings = "os", "compiler", "build_type", "arch" - options = {"fPIC": [True, False], - "shared": [True, False], - "with_ssl": [True, False], - "with_postgresql": [True, False], - "with_mysql": [True, False]} - default_options = {"fPIC": True, - "shared": False, - "with_ssl": True, - "with_postgresql": True, - "with_mysql": True} - _autotools = None + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/resiprocate/resiprocate/wiki/" + topics = ("sip", "voip", "communication", "signaling") - @property - def _source_subfolder(self): - return "source_subfolder" + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_ssl": [True, False], + "with_postgresql": [True, False], + "with_mysql": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_ssl": True, + "with_postgresql": True, + "with_mysql": False, + } def config_options(self): - if self.settings.os == 'Windows': + if self.settings.os == "Windows": del self.options.fPIC def configure(self): - if self.settings.os in ("Windows", "Macos"): - # FIXME: Visual Studio project & Mac support seems available in resiprocate - raise ConanInvalidConfiguration("reSIProcate recipe does not currently support {}.".format(self.settings.os)) + if self.settings.os == "Windows" or is_apple_os(self): + # FIXME: unreleased versions of resiprocate use CMake and should support Windows and macOS + raise ConanInvalidConfiguration(f"reSIProcate recipe does not currently support {self.settings.os}.") 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): if self.options.with_ssl: - self.requires("openssl/1.1.1q") + self.requires("openssl/1.1.1w") # OpenSSL 3.x is not supported if self.options.with_postgresql: - self.requires("libpq/14.2") + self.requires("libpq/15.4") if self.options.with_mysql: - self.requires("libmysqlclient/8.0.29") + self.requires("libmysqlclient/8.1.0") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename("{}-{}".format(self.name, self.version), self._source_subfolder) - - 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)), - "--with-pic={}".format(yes_no(self.options.get_safe("fPIC", True))) - ] + get(self, **self.conan_data["sources"][self.version], strip_root=True) + def generate(self): + if not cross_building(self): + venv = VirtualRunEnv(self) + venv.generate(scope="build") + tc = AutotoolsToolchain(self) # These options do not support yes/no if self.options.with_ssl: - configure_args.append("--with-ssl") + tc.configure_args.append("--with-ssl") if self.options.with_mysql: - configure_args.append("--with-mysql") + tc.configure_args.append("--with-mysql") if self.options.with_postgresql: - configure_args.append("--with-postgresql") - - self._autotools.configure(configure_dir=self._source_subfolder, args=configure_args) - return self._autotools + tc.configure_args.append("--with-postgresql") + tc.generate() + deps = AutotoolsDeps(self) + deps.generate() def build(self): - autotools = self._configure_autotools() - autotools.make() + with chdir(self, self.source_folder): + 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() - autotools.install() - tools.rmdir(os.path.join(os.path.join(self.package_folder, "share"))) - tools.remove_files_by_mask(os.path.join(self.package_folder), "*.la") + copy(self, "COPYING", self.source_folder, os.path.join(self.package_folder, "licenses")) + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.install() + rmdir(self, os.path.join(os.path.join(self.package_folder, "share"))) + rm(self, "*.la", os.path.join(self.package_folder), recursive=True) def package_info(self): self.cpp_info.libs = ["resip", "rutil", "dum", "resipares"] if self.settings.os in ("Linux", "FreeBSD"): self.cpp_info.system_libs = ["pthread"] + + # TODO: Legacy, to be removed on Conan 2.0 bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) - self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) + self.env_info.PATH.append(bin_path) diff --git a/recipes/resiprocate/all/test_package/CMakeLists.txt b/recipes/resiprocate/all/test_package/CMakeLists.txt index 33ae887aa6aea..9a3b67fc7fe91 100644 --- a/recipes/resiprocate/all/test_package/CMakeLists.txt +++ b/recipes/resiprocate/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -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() +find_package(resiprocate REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE resiprocate::resiprocate) set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) diff --git a/recipes/resiprocate/all/test_package/conanfile.py b/recipes/resiprocate/all/test_package/conanfile.py index ea57a464900be..ef5d7042163ec 100644 --- a/recipes/resiprocate/all/test_package/conanfile.py +++ b/recipes/resiprocate/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" + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/resiprocate/all/test_v1_package/CMakeLists.txt b/recipes/resiprocate/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/resiprocate/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/resiprocate/all/test_v1_package/conanfile.py b/recipes/resiprocate/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..84ee68733e516 --- /dev/null +++ b/recipes/resiprocate/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.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/resource_pool/all/conanfile.py b/recipes/resource_pool/all/conanfile.py index 0e8accc6eec6a..fc3ecee6a8761 100644 --- a/recipes/resource_pool/all/conanfile.py +++ b/recipes/resource_pool/all/conanfile.py @@ -1,32 +1,30 @@ -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration -from conans.tools import check_min_cppstd import os -import glob + +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.52.0" class ResourcePool(ConanFile): name = "resource_pool" description = "C++ header only library purposed to create pool of some resources like keepalive connections" - topics = ("conan", "resource pool", "resource_pool", "asio", "elsid", "c++17", "cpp17") + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "http://github.com/elsid/resource_pool" - license = "MIT" + topics = ("resource pool", "asio", "elsid", "c++17", "cpp17", "header-only") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" - requires = ( - "boost/1.75.0" - ) - generators = "cmake_find_package" no_copy_source = True @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): @@ -37,44 +35,56 @@ def _compilers_minimum_version(self): "apple-clang": "10", } - def _validate_compiler_settings(self): + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + # Only compatible with Boost up to v1.79 + self.requires("boost/1.79.0") + + def package_id(self): + self.info.clear() + + def validate(self): compiler = self.settings.compiler if compiler.get_safe("cppstd"): - check_min_cppstd(self, "17") + 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("resource_pool requires C++17. Your compiler is unknown. Assuming it supports C++17.") - elif tools.Version(self.settings.compiler.version) < minimum_version: + self.output.warning("resource_pool requires C++17. Your compiler is unknown. Assuming it supports C++17.") + elif Version(self.settings.compiler.version) < minimum_version: raise ConanInvalidConfiguration("resource_pool requires a compiler that supports at least C++17") - def validate(self): - self._validate_compiler_settings() - 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 package(self): - self.copy(pattern="*", dst=os.path.join("include", "yamail"), src=os.path.join(self._source_subfolder, "include", "yamail")) - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - - def package_id(self): - self.info.header_only() + copy(self, "LICENSE", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder) + copy(self, "*", + dst=os.path.join(self.package_folder, "include", "yamail"), + src=os.path.join(self.source_folder, "include", "yamail")) def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + main_comp = self.cpp_info.components["_resource_pool"] main_comp.requires = ["boost::boost", "boost::system", "boost::thread"] main_comp.defines = ["BOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT"] - main_comp.names["cmake_find_package"] = "resource_pool" - main_comp.names["cmake_find_package_multi"] = "resource_pool" if self.settings.os == "Windows": main_comp.system_libs.append("ws2_32") - # Set up for compatibility with existing cmake configuration + # Set up for compatibility with existing cmake configuration: + # https://github.com/elsid/resource_pool/blob/3ea1f95/examples/CMakeLists.txt#L6C34-L6C54 + self.cpp_info.set_property("cmake_target_name", "elsid::resource_pool") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.filenames["cmake_find_package"] = "resource_pool" self.cpp_info.filenames["cmake_find_package_multi"] = "resource_pool" self.cpp_info.names["cmake_find_package"] = "elsid" self.cpp_info.names["cmake_find_package_multi"] = "elsid" + main_comp.names["cmake_find_package"] = "resource_pool" + main_comp.names["cmake_find_package_multi"] = "resource_pool" diff --git a/recipes/resource_pool/all/test_package/CMakeLists.txt b/recipes/resource_pool/all/test_package/CMakeLists.txt index 6e5e189f75c43..e10fab1825ee4 100644 --- a/recipes/resource_pool/all/test_package/CMakeLists.txt +++ b/recipes/resource_pool/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ -cmake_minimum_required(VERSION 3.12) +cmake_minimum_required(VERSION 3.15) project(PackageTest CXX) -find_package(resource_pool REQUIRED) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +find_package(resource_pool REQUIRED CONFIG) add_executable(example coro.cc) target_compile_features(example PRIVATE cxx_std_17) diff --git a/recipes/resource_pool/all/test_package/conanfile.py b/recipes/resource_pool/all/test_package/conanfile.py index 2f970874682b0..8d52b7021efe1 100644 --- a/recipes/resource_pool/all/test_package/conanfile.py +++ b/recipes/resource_pool/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 ResourcePoolTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake_find_package", "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.bindir, "example") + self.run(bin_path, env="conanrun") diff --git a/recipes/resource_pool/all/test_package/coro.cc b/recipes/resource_pool/all/test_package/coro.cc index 0e0b304948775..88ad6ceb45f48 100644 --- a/recipes/resource_pool/all/test_package/coro.cc +++ b/recipes/resource_pool/all/test_package/coro.cc @@ -7,12 +7,14 @@ using ofstream_pool = yamail::resource_pool::async::pool>; using time_traits = yamail::resource_pool::time_traits; -struct null_buffer : std::streambuf { int overflow(int c) override { return c; } } null_buf; +struct null_buffer : std::streambuf { + int overflow(int c) override { return c; } +} null_buf; int main() { boost::asio::io_context service; ofstream_pool pool(1, 10); - boost::asio::spawn(service, [&](boost::asio::yield_context yield){ + boost::asio::spawn(service, [&](boost::asio::yield_context yield) { boost::system::error_code ec; auto handle = pool.get_auto_waste(service, yield[ec], time_traits::duration::max()); if (ec) { diff --git a/recipes/resource_pool/all/test_v1_package/CMakeLists.txt b/recipes/resource_pool/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/resource_pool/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/resource_pool/all/test_v1_package/conanfile.py b/recipes/resource_pool/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..fdaba4642f464 --- /dev/null +++ b/recipes/resource_pool/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +import os +from conans import ConanFile, CMake, tools + + +class ResourcePoolTestConan(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.settings): + bin_path = os.path.join("bin", "example") + self.run(bin_path, run_environment=True) diff --git a/recipes/restbed/all/conanfile.py b/recipes/restbed/all/conanfile.py index 0a5e2d6cfc925..f63b47dfcb4cd 100644 --- a/recipes/restbed/all/conanfile.py +++ b/recipes/restbed/all/conanfile.py @@ -8,7 +8,7 @@ import os import re -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class RestbedConan(ConanFile): @@ -18,7 +18,7 @@ class RestbedConan(ConanFile): 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) - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -51,15 +51,19 @@ def export_sources(self): def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + del self.options.ipc 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 + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires("asio/1.27.0") + if self.options.with_openssl: + self.requires("openssl/[>=1.1 <4]") def validate(self): if getattr(self.info.settings.compiler, "cppstd"): @@ -71,17 +75,8 @@ def validate(self): 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/restbed/all/test_v1_package/CMakeLists.txt b/recipes/restbed/all/test_v1_package/CMakeLists.txt index 87b1318ff1676..0d20897301b68 100644 --- a/recipes/restbed/all/test_v1_package/CMakeLists.txt +++ b/recipes/restbed/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") +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) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/restinio/all/conandata.yml b/recipes/restinio/all/conandata.yml index b680851d1b67a..06ced9d2281b3 100644 --- a/recipes/restinio/all/conandata.yml +++ b/recipes/restinio/all/conandata.yml @@ -1,34 +1,10 @@ sources: + "0.6.19": + url: "https://github.com/Stiffstream/restinio/archive/v.0.6.19.tar.gz" + sha256: "5a739cac8f3148e7e94f05bb08f5cf569dd31f6f3ea2b893eddfffb0a155eb52" + "0.6.18": + url: "https://github.com/Stiffstream/restinio/archive/v.0.6.18.tar.gz" + sha256: "16fa041f4603746c6cd0f29ab126d02d220034535e7019c6ca1b8b9f58bfeee0" "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 a9df43d526e76..576da558e85ba 100644 --- a/recipes/restinio/all/conanfile.py +++ b/recipes/restinio/all/conanfile.py @@ -18,7 +18,7 @@ class RestinioConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" description = "RESTinio is a header-only C++14 library that gives you an embedded HTTP/Websocket server." topics = ("http-server", "websockets", "rest", "tls-support") - + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" options = { "asio": ["boost", "standalone"], @@ -34,42 +34,31 @@ class RestinioConan(ConanFile): } def layout(self): - basic_layout(self) + basic_layout(self, src_folder="src") def requirements(self): self.requires("http_parser/2.9.4") - - if Version(self.version) >= "0.6.16": - self.requires("fmt/9.0.0") - else: - self.requires("fmt/8.1.1") - - self.requires("expected-lite/0.5.0") + self.requires("fmt/10.1.1") + self.requires("expected-lite/0.6.3") self.requires("optional-lite/3.5.0") - self.requires("string-view-lite/1.6.0") + self.requires("string-view-lite/1.7.0") self.requires("variant-lite/2.0.0") if self.options.asio == "standalone": - if Version(self.version) >= "0.6.9": - self.requires("asio/1.22.1") - else: - self.requires("asio/1.16.1") + self.requires("asio/1.28.1") else: - if Version(self.version) >= "0.6.9": - self.requires("boost/1.78.0") - else: - self.requires("boost/1.73.0") + self.requires("boost/1.83.0") if self.options.with_openssl: - self.requires("openssl/1.1.1n") + self.requires("openssl/[>=1.1 <4]") if self.options.with_zlib: - self.requires("zlib/1.2.12") + self.requires("zlib/[>=1.2.11 <2]") if self.options.with_pcre == 1: self.requires("pcre/8.45") elif self.options.with_pcre == 2: - self.requires("pcre2/10.40") + self.requires("pcre2/10.42") def package_id(self): self.info.clear() @@ -105,8 +94,7 @@ def generate(self): deps.generate() 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 package(self): copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) @@ -117,7 +105,6 @@ def package(self): 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") diff --git a/recipes/restinio/config.yml b/recipes/restinio/config.yml index b071e4e40bed7..385096b41a86b 100644 --- a/recipes/restinio/config.yml +++ b/recipes/restinio/config.yml @@ -1,23 +1,13 @@ versions: - "0.6.17": - folder: all - "0.6.16": - folder: all - "0.6.15": - folder: all - "0.6.14": - folder: all - "0.6.13": + "0.7.2": + folder: "v0.7" + "0.7.1": + folder: "v0.7" + "0.7.0": + folder: "v0.7" + "0.6.19": folder: all - "0.6.12": + "0.6.18": folder: all - "0.6.11": - folder: all - "0.6.10": - folder: all - "0.6.9": - folder: all - "0.6.8.1": - folder: all - "0.6.8": + "0.6.17": folder: all diff --git a/recipes/restinio/v0.7/conandata.yml b/recipes/restinio/v0.7/conandata.yml new file mode 100644 index 0000000000000..7eae58a5c9bb2 --- /dev/null +++ b/recipes/restinio/v0.7/conandata.yml @@ -0,0 +1,10 @@ +sources: + "0.7.2": + url: "https://github.com/Stiffstream/restinio/archive/v.0.7.2.tar.gz" + sha256: "8d48dcf0e01a30562d7357f95048f43fa7c08db69eabef00540d60a3278523cb" + "0.7.1": + url: "https://github.com/Stiffstream/restinio/archive/v.0.7.1.tar.gz" + sha256: "46a3224ad23f768412c3494cd11f973b753b0d0be51906c46176ea7bafa687f6" + "0.7.0": + url: "https://github.com/Stiffstream/restinio/archive/v.0.7.0.tar.gz" + sha256: "1d6ad5812c02ee42342ed0ed78678a4e37c1cfe87f2f7c32c2862f825062feaa" diff --git a/recipes/restinio/v0.7/conanfile.py b/recipes/restinio/v0.7/conanfile.py new file mode 100644 index 0000000000000..b9976dbf00f14 --- /dev/null +++ b/recipes/restinio/v0.7/conanfile.py @@ -0,0 +1,102 @@ +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 +import os + +required_conan_version = ">=1.52.0" + + +class RestinioConan(ConanFile): + name = "restinio" + license = "BSD-3-Clause" + homepage = "https://github.com/Stiffstream/restinio" + url = "https://github.com/conan-io/conan-center-index" + description = "RESTinio is a header-only C++17 library that gives you an embedded HTTP/Websocket server." + topics = ("http-server", "websockets", "rest", "tls-support") + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + options = { + "asio": ["boost", "standalone"], + "with_openssl": [True, False], + "with_zlib": [True, False], + "with_pcre": [1, 2, None], + } + default_options = { + "asio": "standalone", + "with_openssl": False, + "with_zlib": False, + "with_pcre": None, + } + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("llhttp/9.1.3") + self.requires("fmt/10.2.1") + self.requires("expected-lite/0.6.3") + + if self.options.asio == "standalone": + self.requires("asio/1.29.0") + else: + self.requires("boost/1.84.0") + + if self.options.with_openssl: + self.requires("openssl/[>=1.1 <4]") + + if self.options.with_zlib: + self.requires("zlib/[>=1.2.11 <2]") + + if self.options.with_pcre == 1: + self.requires("pcre/8.45") + elif self.options.with_pcre == 2: + self.requires("pcre2/10.42") + + def package_id(self): + self.info.clear() + + def validate(self): + minimal_cpp_standard = "17" + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, minimal_cpp_standard) + + minimal_version = { + "gcc": "9", + "clang": "10", + "apple-clang": "11", + "Visual Studio": "15", + "msvc": "191" + } + + compiler = str(self.settings.compiler) + if compiler not in minimal_version: + self.output.warning( + "%s recipe lacks information about the %s compiler standard version support" % (self.name, compiler)) + self.output.warning( + "%s requires a compiler that supports at least C++%s" % (self.name, minimal_cpp_standard)) + return + + version = 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 build(self): + pass + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def package(self): + copy(self, "*.*pp", src=os.path.join(self.source_folder, "dev", "restinio"), dst=os.path.join(self.package_folder, "include", "restinio")) + 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 = [] + self.cpp_info.set_property("cmake_file_name", "restinio") + self.cpp_info.set_property("cmake_target_name", "restinio::restinio") + if self.options.asio == "boost": + self.cpp_info.defines.append("RESTINIO_USE_BOOST_ASIO") diff --git a/recipes/restinio/v0.7/test_package/CMakeLists.txt b/recipes/restinio/v0.7/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..1f4ba6e706df2 --- /dev/null +++ b/recipes/restinio/v0.7/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package CXX) + +find_package(restinio REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} restinio::restinio) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/restinio/v0.7/test_package/conanfile.py b/recipes/restinio/v0.7/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fb96656f203 --- /dev/null +++ b/recipes/restinio/v0.7/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/restinio/v0.7/test_package/test_package.cpp b/recipes/restinio/v0.7/test_package/test_package.cpp new file mode 100644 index 0000000000000..ac78ee51f9a8d --- /dev/null +++ b/recipes/restinio/v0.7/test_package/test_package.cpp @@ -0,0 +1,21 @@ +#include +#include + +using namespace restinio; + +int main() { + // Create express router for our service. + auto router = std::make_unique>(); + router->http_get( + R"(/data/meter/:meter_id(\d+))", + [](auto req, auto params) { + const auto qp = parse_query(req->header().query()); + return req->create_response() + .set_body(fmt::format("meter_id={}", cast_to(params["meter_id"]))) + .done(); + }); + + std::cout << "success\n"; + + return 0; +} diff --git a/recipes/rg-etc1/all/CMakeLists.txt b/recipes/rg-etc1/all/CMakeLists.txt index 5f0b2b410ca60..5d4d0f4829476 100644 --- a/recipes/rg-etc1/all/CMakeLists.txt +++ b/recipes/rg-etc1/all/CMakeLists.txt @@ -1,22 +1,16 @@ 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() -file(GLOB SRCS_FILES ${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder/*.cpp) -file(GLOB HDRS_FILES ${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder/*.h) +file(GLOB SRCS_FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) +file(GLOB HDRS_FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.h) add_library(rg_etc1 ${SRCS_FILES}) -target_include_directories(rg_etc1 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder) +target_include_directories(rg_etc1 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src) -install(TARGETS rg_etc1 - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib -) +include(GNUInstallDirs) +install(TARGETS rg_etc1) install(FILES ${HDRS_FILES} DESTINATION include) diff --git a/recipes/rg-etc1/all/conanfile.py b/recipes/rg-etc1/all/conanfile.py index 43c69a50b6b5c..1a5ed53523f88 100644 --- a/recipes/rg-etc1/all/conanfile.py +++ b/recipes/rg-etc1/all/conanfile.py @@ -1,17 +1,22 @@ import os -import glob -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 collect_libs, copy, get, save + +required_conan_version = ">=1.53.0" class RgEtc1Conan(ConanFile): name = "rg-etc1" description = "A performant, easy to use, and high quality 4x4 pixel block packer/unpacker for the ETC1." - homepage = "https://github.com/richgel999/rg-etc1" - url = "https://github.com/conan-io/conan-center-index" - topics = ("conan", "etc1", "packer", "unpacker") license = "Zlib" - exports_sources = ["CMakeLists.txt"] - generators = "cmake" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/richgel999/rg-etc1" + topics = ("etc1", "packer", "unpacker") + + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -22,53 +27,51 @@ class RgEtc1Conan(ConanFile): "fPIC": 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]) - extracted_dir = glob.glob('rg-etc1-*/')[0] - os.rename(extracted_dir, self._source_subfolder) + 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': + 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 _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 validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, 11) + + 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 = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=self.export_sources_folder) cmake.build() def _extract_license(self): - with open(os.path.join(self._source_subfolder, "rg_etc1.h")) as f: + with open(os.path.join(self.source_folder, "rg_etc1.h")) as f: content_lines = f.readlines() license_content = [] for i in range(52, 75): license_content.append(content_lines[i][2:-1]) - tools.save("LICENSE", "\n".join(license_content)) + save(self, os.path.join(self.package_folder, "licenses", "LICENSE"), "\n".join(license_content)) def package(self): - cmake = self._configure_cmake() - cmake.install() self._extract_license() - self.copy(pattern="LICENSE", dst="licenses") + cmake = CMake(self) + cmake.install() def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = ["rg_etc1"] + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs = ["m"] diff --git a/recipes/rg-etc1/all/test_package/CMakeLists.txt b/recipes/rg-etc1/all/test_package/CMakeLists.txt index 196188113685c..249e96fb582fb 100644 --- a/recipes/rg-etc1/all/test_package/CMakeLists.txt +++ b/recipes/rg-etc1/all/test_package/CMakeLists.txt @@ -1,8 +1,8 @@ -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() +find_package(rg-etc1 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE rg-etc1::rg-etc1) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/rg-etc1/all/test_package/conanfile.py b/recipes/rg-etc1/all/test_package/conanfile.py index bd7165a553cf4..ef5d7042163ec 100644 --- a/recipes/rg-etc1/all/test_package/conanfile.py +++ b/recipes/rg-etc1/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/rg-etc1/all/test_v1_package/CMakeLists.txt b/recipes/rg-etc1/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/rg-etc1/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/rg-etc1/all/test_v1_package/conanfile.py b/recipes/rg-etc1/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..7e2dfe859bb27 --- /dev/null +++ b/recipes/rg-etc1/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/rgbcx/all/conanfile.py b/recipes/rgbcx/all/conanfile.py index 62f3ee9f485a5..2978797a9067e 100644 --- a/recipes/rgbcx/all/conanfile.py +++ b/recipes/rgbcx/all/conanfile.py @@ -1,34 +1,53 @@ import os -import glob -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 +from conan.tools.layout import basic_layout + +required_conan_version = ">=1.52.0" class RgbcxConan(ConanFile): name = "rgbcx" description = "High-performance scalar BC1-5 encoders." - homepage = "https://github.com/richgel999/bc7enc" + license = ("MIT", "Unlicense") url = "https://github.com/conan-io/conan-center-index" - topics = ("conan", "BC1", "BC5", "BCx", "encoding") - license = "MIT", "Unlicense" + homepage = "https://github.com/richgel999/bc7enc" + topics = ("BC1", "BC5", "BCx", "encoding", "header-only") + + package_type = "header-library" + 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.cppstd: + check_min_cppstd(self, self._min_cppstd) def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = glob.glob('bc7enc-*/')[0] - os.rename(extracted_dir, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def build(self): - tools.replace_in_file(os.path.join(self._source_subfolder, "rgbcx.h"), - "#include ", - "#include \n#include ") + replace_in_file(self, + os.path.join(self.source_folder, "rgbcx.h"), + "#include ", + "#include \n#include ") def package(self): - self.copy("rgbcx.h", dst="include", src=self._source_subfolder) - self.copy("rgbcx_table4.h", dst="include", src=self._source_subfolder) - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + copy(self, "rgbcx.h", dst=os.path.join(self.package_folder, "include"), src=self.source_folder) + copy(self, "rgbcx_table4.h", dst=os.path.join(self.package_folder, "include"), src=self.source_folder) + copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) - def package_id(self): - self.info.header_only() + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/rgbcx/all/test_package/CMakeLists.txt b/recipes/rgbcx/all/test_package/CMakeLists.txt index 454c47bb2cbab..e86d42248fffd 100644 --- a/recipes/rgbcx/all/test_package/CMakeLists.txt +++ b/recipes/rgbcx/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(rgbcx REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE rgbcx::rgbcx) set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) diff --git a/recipes/rgbcx/all/test_package/conanfile.py b/recipes/rgbcx/all/test_package/conanfile.py index be0a94674e5bd..ef5d7042163ec 100644 --- a/recipes/rgbcx/all/test_package/conanfile.py +++ b/recipes/rgbcx/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 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,5 +21,6 @@ def build(self): cmake.build() def test(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/rgbcx/all/test_package/test_package.cpp b/recipes/rgbcx/all/test_package/test_package.cpp index 136968a37d7d1..c4faf6d5e5b49 100644 --- a/recipes/rgbcx/all/test_package/test_package.cpp +++ b/recipes/rgbcx/all/test_package/test_package.cpp @@ -1,3 +1,6 @@ +// Workaround for a missing math.h include in rgbcx.h +#include + #define RGBCX_IMPLEMENTATION #include "rgbcx.h" diff --git a/recipes/rgbcx/all/test_v1_package/CMakeLists.txt b/recipes/rgbcx/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/rgbcx/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/rgbcx/all/test_v1_package/conanfile.py b/recipes/rgbcx/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..f96c48347ffda --- /dev/null +++ b/recipes/rgbcx/all/test_v1_package/conanfile.py @@ -0,0 +1,19 @@ +import os + +from conan.tools.build import can_run +from conans import ConanFile, CMake + + +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 can_run(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/ring-span-lite/all/conandata.yml b/recipes/ring-span-lite/all/conandata.yml index ecb24a4b876e4..4919bacb7f2d0 100644 --- a/recipes/ring-span-lite/all/conandata.yml +++ b/recipes/ring-span-lite/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.7.0": + url: "https://github.com/martinmoene/ring-span-lite/archive/v0.7.0.tar.gz" + sha256: "7650bb1bcf76cb0f7ac75240c5346203cbe7eb7027c0843c60253f6db08a93c1" "0.6.0": url: "https://github.com/martinmoene/ring-span-lite/archive/v0.6.0.tar.gz" sha256: "3248ee40a3147e6ba3cee051a838f727770654ade0c9852b1640f0f40d2e0573" diff --git a/recipes/ring-span-lite/all/conanfile.py b/recipes/ring-span-lite/all/conanfile.py index b99c854a61b09..fa9939f4bd005 100644 --- a/recipes/ring-span-lite/all/conanfile.py +++ b/recipes/ring-span-lite/all/conanfile.py @@ -8,12 +8,13 @@ class RingSpanLiteConan(ConanFile): name = "ring-span-lite" + description = ( + "ring-span lite - A ring_span type for C++98, C++11 and later in a single-file header-only library ") + license = "BSL-1.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/martinmoene/ring-span-lite" - description = ("ring-span lite - A ring_span type for C++98, C++11 and later in a \ - single-file header-only library ") - topics = ("cpp98", "cpp11", "cpp14", "cpp17", "ring-span") - license = "BSL-1.0" + topics = ("cpp98", "cpp11", "cpp14", "cpp17", "ring-span", "header-only") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -24,32 +25,33 @@ 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 + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): - 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")) + 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", "ring-span-lite") - self.cpp_info.set_property("cmake_target_name", "nonstd::ring-span-lite") + self.cpp_info.set_property( + "cmake_target_name", "nonstd::ring-span-lite") 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 + # TODO: to remove in conan v2 once cmake_find_package* generators + # removed. self.cpp_info.filenames["cmake_find_package"] = "ring-span-lite" self.cpp_info.filenames["cmake_find_package_multi"] = "ring-span-lite" self.cpp_info.names["cmake_find_package"] = "nonstd" self.cpp_info.names["cmake_find_package_multi"] = "nonstd" self.cpp_info.components["ringspanlite"].names["cmake_find_package"] = "ring-span-lite" self.cpp_info.components["ringspanlite"].names["cmake_find_package_multi"] = "ring-span-lite" - self.cpp_info.components["ringspanlite"].set_property("cmake_target_name", "nonstd::ring-span-lite") + self.cpp_info.components["ringspanlite"].set_property( + "cmake_target_name", "nonstd::ring-span-lite") self.cpp_info.components["ringspanlite"].bindirs = [] self.cpp_info.components["ringspanlite"].frameworkdirs = [] self.cpp_info.components["ringspanlite"].libdirs = [] diff --git a/recipes/ring-span-lite/all/test_package/conanfile.py b/recipes/ring-span-lite/all/test_package/conanfile.py index d120a992c06a6..8a5bb47f50c4c 100644 --- a/recipes/ring-span-lite/all/test_package/conanfile.py +++ b/recipes/ring-span-lite/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/ring-span-lite/config.yml b/recipes/ring-span-lite/config.yml index babcbfb79d964..a0804c43130f1 100644 --- a/recipes/ring-span-lite/config.yml +++ b/recipes/ring-span-lite/config.yml @@ -1,4 +1,6 @@ versions: + "0.7.0": + folder: all "0.6.0": folder: all "0.5.0": diff --git a/recipes/rmlui/4.x/conandata.yml b/recipes/rmlui/4.x/conandata.yml index f35a5c4a8e8db..e272e1d8e0557 100644 --- a/recipes/rmlui/4.x/conandata.yml +++ b/recipes/rmlui/4.x/conandata.yml @@ -14,3 +14,24 @@ sources: "4.4": url: "https://github.com/mikke89/RmlUi/archive/4.4.tar.gz" sha256: "9e45176e47154616253c4e5c78368f4af4b4379278b73066c3fb5a338f9c655a" +patches: + "4.0": + - patch_file: "patches/4.0-fix-cmake-targets-and-config.patch" + patch_description: "Make external libraries work when provided by conan and remove the generation of a config file" + patch_type: "conan" + "4.1": + - patch_file: "patches/4.1-fix-cmake-targets-and-config.patch" + patch_description: "Make external libraries work when provided by conan and remove the generation of a config file" + patch_type: "conan" + "4.2": + - patch_file: "patches/4.2-fix-cmake-targets-and-config.patch" + patch_description: "Make external libraries work when provided by conan and remove the generation of a config file" + patch_type: "conan" + "4.3": + - patch_file: "patches/4.3-fix-cmake-targets-and-config.patch" + patch_description: "Make external libraries work when provided by conan and remove the generation of a config file" + patch_type: "conan" + "4.4": + - patch_file: "patches/4.4-fix-cmake-targets-and-config.patch" + patch_description: "Make external libraries work when provided by conan and remove the generation of a config file" + patch_type: "conan" diff --git a/recipes/rmlui/4.x/conanfile.py b/recipes/rmlui/4.x/conanfile.py index 1266df20bec90..1bd6398f97698 100644 --- a/recipes/rmlui/4.x/conanfile.py +++ b/recipes/rmlui/4.x/conanfile.py @@ -1,18 +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.cmake import CMakeToolchain, CMakeDeps, CMake, cmake_layout +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, replace_in_file, copy, export_conandata_patches, apply_conandata_patches import os +required_conan_version = ">=1.53.0" + class RmluiConan(ConanFile): name = "rmlui" description = "RmlUi - The HTML/CSS User Interface Library Evolved" - homepage = "https://github.com/mikke89/RmlUi" - url = "https://github.com/conan-io/conan-center-index" license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/mikke89/RmlUi" topics = ("css", "gui", "html", "lua", "rmlui") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { - "enable_rtti_and_exceptions": [True, False], "font_interface": ["freetype", None], "fPIC": [True, False], "matrix_mode": ["column_major", "row_major"], @@ -21,7 +26,6 @@ class RmluiConan(ConanFile): "with_thirdparty_containers": [True, False] } default_options = { - "enable_rtti_and_exceptions": True, "font_interface": "freetype", "fPIC": True, "matrix_mode": "column_major", @@ -29,9 +33,6 @@ class RmluiConan(ConanFile): "with_lua_bindings": False, "with_thirdparty_containers": True } - build_requires = ["cmake/3.23.2"] - exports_sources = ["CMakeLists.txt"] - generators = ["cmake", "cmake_find_package"] @property def _minimum_compilers_version(self): @@ -49,18 +50,21 @@ def _minimum_compilers_version(self): def _minimum_cpp_standard(self): return 14 + 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 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) + def lazy_lt_semver(v1, v2): lv1 = [int(v) for v in v1.split(".")] lv2 = [int(v) for v in v2.split(".")] @@ -70,12 +74,10 @@ def lazy_lt_semver(v1, v2): 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(f"{self.ref} recipe lacks information about the {self.settings.compiler} compiler support.") else: if lazy_lt_semver(str(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)) + raise ConanInvalidConfiguration(f"{self.ref} requires C++{self._minimum_cpp_standard} support. The current compiler {self.settings.compiler} {self.settings.compiler.version} does not support it.") def requirements(self): if self.options.font_interface == "freetype": @@ -85,79 +87,55 @@ def requirements(self): self.requires("lua/5.3.5") if self.options.with_thirdparty_containers: - self.requires("robin-hood-hashing/3.11.3") + self.requires("robin-hood-hashing/3.11.3", transitive_headers=True) - @property - def _source_subfolder(self): - return "source_subfolder" + 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 not hasattr(self, "_cmake"): - self._cmake = CMake(self) - self._cmake.definitions["BUILD_LUA_BINDINGS"] = self.options.with_lua_bindings - self._cmake.definitions["BUILD_SAMPLES"] = False - self._cmake.definitions["CUSTOM_CONFIGURATION"] = True - self._cmake.definitions["CUSTOM_INCLUDE_DIRS"] = ";".join(self.deps_cpp_info["robin-hood-hashing"].include_paths) - self._cmake.definitions["DISABLE_RTTI_AND_EXCEPTIONS"] = not self.options.enable_rtti_and_exceptions - self._cmake.definitions["ENABLE_PRECOMPILED_HEADERS"] = True - self._cmake.definitions["ENABLE_TRACY_PROFILING"] = False - self._cmake.definitions["MATRIX_ROW_MAJOR"] = self.options.matrix_mode == "row_major" - self._cmake.definitions["NO_FONT_INTERFACE_DEFAULT"] = self.options.font_interface is None - self._cmake.definitions["NO_THIRDPARTY_CONTAINERS"] = not self.options.with_thirdparty_containers - - 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.cache_variables["BUILD_LUA_BINDINGS"] = self.options.with_lua_bindings + tc.cache_variables["BUILD_SAMPLES"] = False + tc.cache_variables["DISABLE_RTTI_AND_EXCEPTIONS"] = False + tc.cache_variables["ENABLE_PRECOMPILED_HEADERS"] = True + tc.cache_variables["ENABLE_TRACY_PROFILING"] = False + tc.cache_variables["MATRIX_ROW_MAJOR"] = self.options.matrix_mode == "row_major" + tc.cache_variables["NO_FONT_INTERFACE_DEFAULT"] = not self.options.font_interface + tc.cache_variables["NO_THIRDPARTY_CONTAINERS"] = not self.options.with_thirdparty_containers + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def _patch_sources(self): - # The *.cmake files that conan generates using cmake_find_package for CMake's find_package to consume use - # different variable naming than described in CMake's documentation, thus the need for most of the replacements. - # References: - # * https://cmake.org/cmake/help/latest/module/FindFreetype.html - # * https://cmake.org/cmake/help/latest/module/FindLua.html - replace_mapping = { - "FREETYPE_FOUND": "Freetype_FOUND", - "FREETYPE_INCLUDE_DIRS": "Freetype_INCLUDE_DIRS", - "FREETYPE_LINK_DIRS": "Freetype_LINK_DIRS", - "FREETYPE_LIBRARY": "Freetype_LIBRARIES", - "FREETYPE_LIBRARIES": "Freetype_LIBRARIES", - "LUA_FOUND": "lua_FOUND", - "LUA_INCLUDE_DIR": "lua_INCLUDE_DIR", - "LUA_LIBRARIES": "lua_LIBRARIES", - # disables the built-in generation of package configuration files - "if(PkgHelpers_AVAILABLE)": "if(FALSE)" - } - - cmakelists_path = os.path.join( - self._source_subfolder, "CMakeLists.txt") - for key, value in replace_mapping.items(): - tools.replace_in_file(cmakelists_path, key, value, strict=False) + apply_conandata_patches(self) + # If we are using robin_hood hashing provided by conan, we need to change its include path if self.options.with_thirdparty_containers: - config_path = os.path.join(self._source_subfolder, + config_path = os.path.join(self.source_folder, "Include", "RmlUi", "Config", "Config.h") - tools.replace_in_file( - config_path, "\"../Core/Containers/robin_hood.h\"", "") + replace_in_file( + self, config_path, "\"../Core/Containers/robin_hood.h\"", "") def build(self): self._patch_sources() - self._configure_cmake().build() + cmake = CMake(self) + cmake.configure() + cmake.build() def package(self): - self._configure_cmake().install() - self.copy("*LICENSE.txt", dst="licenses", src=self._source_subfolder, excludes=("Samples/*", "Tests/*")) + copy(self, pattern="*LICENSE.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder, excludes=("Samples/*", "Tests/*")) + cmake = CMake(self) + cmake.install() def package_info(self): if self.options.matrix_mode == "row_major": self.cpp_info.defines.append("RMLUI_MATRIX_ROW_MAJOR") - if not self.options.enable_rtti_and_exceptions: - self.cpp_info.defines.append("RMLUI_USE_CUSTOM_RTTI") - if not self.options.shared: self.cpp_info.defines.append("RMLUI_STATIC_LIB") diff --git a/recipes/rmlui/4.x/patches/4.0-fix-cmake-targets-and-config.patch b/recipes/rmlui/4.x/patches/4.0-fix-cmake-targets-and-config.patch new file mode 100644 index 0000000000000..cb97ad8c3eb6e --- /dev/null +++ b/recipes/rmlui/4.x/patches/4.0-fix-cmake-targets-and-config.patch @@ -0,0 +1,88 @@ +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -322,21 +322,13 @@ + # FreeType + if(NOT NO_FONT_INTERFACE_DEFAULT) + find_package(Freetype REQUIRED) +- +- if(FREETYPE_FOUND) +- include_directories(${FREETYPE_INCLUDE_DIRS}) +- link_directories(${FREETYPE_LINK_DIRS}) +- list(APPEND CORE_LINK_LIBS ${FREETYPE_LIBRARY}) +- endif() ++ list(APPEND CORE_LINK_LIBS freetype) + endif() + + # Lua + if(BUILD_LUA_BINDINGS) +- find_package(Lua REQUIRED) +- if(LUA_FOUND) +- include_directories(${LUA_INCLUDE_DIR}) +- list(APPEND LUA_BINDINGS_LINK_LIBS ${LUA_LIBRARIES}) +- endif() ++ find_package(lua REQUIRED CONFIG) ++ list(APPEND LUA_BINDINGS_LINK_LIBS lua::lua) + endif() + + # rlottie +@@ -445,6 +437,10 @@ + if( MATRIX_ROW_MAJOR ) + target_compile_definitions(RmlCore PUBLIC -DRMLUI_MATRIX_ROW_MAJOR) + endif () ++if ( NOT NO_THIRDPARTY_CONTAINERS ) ++ find_package(robin_hood REQUIRED) ++ target_link_libraries(RmlCore robin_hood::robin_hood) ++endif() + if( CUSTOM_CONFIGURATION AND CUSTOM_LINK_LIBRARIES ) + target_link_libraries(RmlCore PUBLIC ${CUSTOM_LINK_LIBRARIES}) + endif () +@@ -891,49 +887,3 @@ + ) + endif() + endif() +- +-#=================================== +-# Generate Config.cmake files ====== +-#=================================== +- +-# Try to include helper module +-include(CMakePackageConfigHelpers OPTIONAL RESULT_VARIABLE PkgHelpers_AVAILABLE) +- +-# guard against older versions of cmake which do not provide it +-if(PkgHelpers_AVAILABLE) +- set (INCLUDE_INSTALL_DIR "include") +- set (LIB_INSTALL_DIR "lib") +- set (INCLUDE_DIR "${PROJECT_SOURCE_DIR}/Include") +- +- # generate configuration for install tree +- configure_package_config_file(${PROJECT_SOURCE_DIR}/CMake/RmlUiConfig.cmake.install.in +- ${CMAKE_CURRENT_BINARY_DIR}/install/RmlUiConfig.cmake +- INSTALL_DESTINATION ${LIB_INSTALL_DIR}/RmlUi/cmake +- PATH_VARS INCLUDE_INSTALL_DIR LIB_INSTALL_DIR) +- write_basic_package_version_file( +- ${CMAKE_CURRENT_BINARY_DIR}/install/RmlUiConfigVersion.cmake +- VERSION ${PROJECT_VERSION} +- COMPATIBILITY SameMajorVersion ) +- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/install/RmlUiConfig.cmake +- ${CMAKE_CURRENT_BINARY_DIR}/install/RmlUiConfigVersion.cmake +- DESTINATION ${LIB_INSTALL_DIR}/RmlUi/cmake ) +- install(EXPORT RmlUiTargets +- DESTINATION ${LIB_INSTALL_DIR}/RmlUi/cmake) +- +- # generate configuration for build tree +- configure_package_config_file(${PROJECT_SOURCE_DIR}/CMake/RmlUiConfig.cmake.build.in +- ${CMAKE_CURRENT_BINARY_DIR}/RmlUiConfig.cmake +- INSTALL_DESTINATION ${CMAKE_CURRENT_BINARY_DIR} +- PATH_VARS INCLUDE_DIR CMAKE_CURRENT_BINARY_DIR) +- export(TARGETS ${RMLUI_EXPORTED_TARGETS} +- FILE "${CMAKE_CURRENT_BINARY_DIR}/RmlUiTargets.cmake") +- write_basic_package_version_file( +- ${CMAKE_CURRENT_BINARY_DIR}/RmlUiConfigVersion.cmake +- VERSION ${PROJECT_VERSION} +- COMPATIBILITY SameMajorVersion ) +- set(RmlUi_DIR "${CMAKE_CURRENT_BINARY_DIR}" CACHE PATH "The directory containing a CMake configuration file for RmlUi.") +-else() +- message("If you wish to use find_package(RmlUi) in your own project to find RmlUi library" +- " please update cmake to version which provides CMakePackageConfighelpers module" +- " or write generators for RmlUiConfig.cmake by yourself.") +-endif() diff --git a/recipes/rmlui/4.x/patches/4.1-fix-cmake-targets-and-config.patch b/recipes/rmlui/4.x/patches/4.1-fix-cmake-targets-and-config.patch new file mode 100644 index 0000000000000..6f33ce9a7d1cc --- /dev/null +++ b/recipes/rmlui/4.x/patches/4.1-fix-cmake-targets-and-config.patch @@ -0,0 +1,82 @@ +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -323,15 +323,13 @@ + # FreeType + if(NOT NO_FONT_INTERFACE_DEFAULT) + find_package(Freetype REQUIRED) +- list(APPEND CORE_LINK_LIBS ${FREETYPE_LIBRARIES}) +- list(APPEND CORE_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIRS}) ++ list(APPEND CORE_LINK_LIBS freetype) + endif() + + # Lua + if(BUILD_LUA_BINDINGS) +- find_package(Lua REQUIRED) +- list(APPEND LUA_BINDINGS_INCLUDE_DIRS ${LUA_INCLUDE_DIR}) +- list(APPEND LUA_BINDINGS_LINK_LIBS ${LUA_LIBRARIES}) ++ find_package(lua REQUIRED CONFIG) ++ list(APPEND LUA_BINDINGS_LINK_LIBS lua::lua) + endif() + + # rlottie +@@ -437,6 +435,10 @@ + if( MATRIX_ROW_MAJOR ) + list(APPEND CORE_PUBLIC_DEFS -DRMLUI_MATRIX_ROW_MAJOR) + endif () ++if ( NOT NO_THIRDPARTY_CONTAINERS ) ++ find_package(robin_hood REQUIRED) ++ target_link_libraries(RmlCore robin_hood::robin_hood) ++endif() + if( CUSTOM_CONFIGURATION AND CUSTOM_LINK_LIBRARIES ) + target_link_libraries(RmlCore PUBLIC ${CUSTOM_LINK_LIBRARIES}) + endif () +@@ -890,49 +892,3 @@ + ) + endif() + endif() +- +-#=================================== +-# Generate Config.cmake files ====== +-#=================================== +- +-# Try to include helper module +-include(CMakePackageConfigHelpers OPTIONAL RESULT_VARIABLE PkgHelpers_AVAILABLE) +- +-# guard against older versions of cmake which do not provide it +-if(PkgHelpers_AVAILABLE) +- set (INCLUDE_INSTALL_DIR "include") +- set (LIB_INSTALL_DIR "lib") +- set (INCLUDE_DIR "${PROJECT_SOURCE_DIR}/Include") +- +- # generate configuration for install tree +- configure_package_config_file(${PROJECT_SOURCE_DIR}/CMake/RmlUiConfig.cmake.install.in +- ${CMAKE_CURRENT_BINARY_DIR}/install/RmlUiConfig.cmake +- INSTALL_DESTINATION ${LIB_INSTALL_DIR}/RmlUi/cmake +- PATH_VARS INCLUDE_INSTALL_DIR LIB_INSTALL_DIR) +- write_basic_package_version_file( +- ${CMAKE_CURRENT_BINARY_DIR}/install/RmlUiConfigVersion.cmake +- VERSION ${PROJECT_VERSION} +- COMPATIBILITY SameMajorVersion ) +- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/install/RmlUiConfig.cmake +- ${CMAKE_CURRENT_BINARY_DIR}/install/RmlUiConfigVersion.cmake +- DESTINATION ${LIB_INSTALL_DIR}/RmlUi/cmake ) +- install(EXPORT RmlUiTargets +- DESTINATION ${LIB_INSTALL_DIR}/RmlUi/cmake) +- +- # generate configuration for build tree +- configure_package_config_file(${PROJECT_SOURCE_DIR}/CMake/RmlUiConfig.cmake.build.in +- ${CMAKE_CURRENT_BINARY_DIR}/RmlUiConfig.cmake +- INSTALL_DESTINATION ${CMAKE_CURRENT_BINARY_DIR} +- PATH_VARS INCLUDE_DIR CMAKE_CURRENT_BINARY_DIR) +- export(TARGETS ${RMLUI_EXPORTED_TARGETS} +- FILE "${CMAKE_CURRENT_BINARY_DIR}/RmlUiTargets.cmake") +- write_basic_package_version_file( +- ${CMAKE_CURRENT_BINARY_DIR}/RmlUiConfigVersion.cmake +- VERSION ${PROJECT_VERSION} +- COMPATIBILITY SameMajorVersion ) +- set(RmlUi_DIR "${CMAKE_CURRENT_BINARY_DIR}" CACHE PATH "The directory containing a CMake configuration file for RmlUi.") +-else() +- message("If you wish to use find_package(RmlUi) in your own project to find RmlUi library" +- " please update cmake to version which provides CMakePackageConfighelpers module" +- " or write generators for RmlUiConfig.cmake by yourself.") +-endif() diff --git a/recipes/rmlui/4.x/patches/4.2-fix-cmake-targets-and-config.patch b/recipes/rmlui/4.x/patches/4.2-fix-cmake-targets-and-config.patch new file mode 100644 index 0000000000000..6f33ce9a7d1cc --- /dev/null +++ b/recipes/rmlui/4.x/patches/4.2-fix-cmake-targets-and-config.patch @@ -0,0 +1,82 @@ +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -323,15 +323,13 @@ + # FreeType + if(NOT NO_FONT_INTERFACE_DEFAULT) + find_package(Freetype REQUIRED) +- list(APPEND CORE_LINK_LIBS ${FREETYPE_LIBRARIES}) +- list(APPEND CORE_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIRS}) ++ list(APPEND CORE_LINK_LIBS freetype) + endif() + + # Lua + if(BUILD_LUA_BINDINGS) +- find_package(Lua REQUIRED) +- list(APPEND LUA_BINDINGS_INCLUDE_DIRS ${LUA_INCLUDE_DIR}) +- list(APPEND LUA_BINDINGS_LINK_LIBS ${LUA_LIBRARIES}) ++ find_package(lua REQUIRED CONFIG) ++ list(APPEND LUA_BINDINGS_LINK_LIBS lua::lua) + endif() + + # rlottie +@@ -437,6 +435,10 @@ + if( MATRIX_ROW_MAJOR ) + list(APPEND CORE_PUBLIC_DEFS -DRMLUI_MATRIX_ROW_MAJOR) + endif () ++if ( NOT NO_THIRDPARTY_CONTAINERS ) ++ find_package(robin_hood REQUIRED) ++ target_link_libraries(RmlCore robin_hood::robin_hood) ++endif() + if( CUSTOM_CONFIGURATION AND CUSTOM_LINK_LIBRARIES ) + target_link_libraries(RmlCore PUBLIC ${CUSTOM_LINK_LIBRARIES}) + endif () +@@ -890,49 +892,3 @@ + ) + endif() + endif() +- +-#=================================== +-# Generate Config.cmake files ====== +-#=================================== +- +-# Try to include helper module +-include(CMakePackageConfigHelpers OPTIONAL RESULT_VARIABLE PkgHelpers_AVAILABLE) +- +-# guard against older versions of cmake which do not provide it +-if(PkgHelpers_AVAILABLE) +- set (INCLUDE_INSTALL_DIR "include") +- set (LIB_INSTALL_DIR "lib") +- set (INCLUDE_DIR "${PROJECT_SOURCE_DIR}/Include") +- +- # generate configuration for install tree +- configure_package_config_file(${PROJECT_SOURCE_DIR}/CMake/RmlUiConfig.cmake.install.in +- ${CMAKE_CURRENT_BINARY_DIR}/install/RmlUiConfig.cmake +- INSTALL_DESTINATION ${LIB_INSTALL_DIR}/RmlUi/cmake +- PATH_VARS INCLUDE_INSTALL_DIR LIB_INSTALL_DIR) +- write_basic_package_version_file( +- ${CMAKE_CURRENT_BINARY_DIR}/install/RmlUiConfigVersion.cmake +- VERSION ${PROJECT_VERSION} +- COMPATIBILITY SameMajorVersion ) +- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/install/RmlUiConfig.cmake +- ${CMAKE_CURRENT_BINARY_DIR}/install/RmlUiConfigVersion.cmake +- DESTINATION ${LIB_INSTALL_DIR}/RmlUi/cmake ) +- install(EXPORT RmlUiTargets +- DESTINATION ${LIB_INSTALL_DIR}/RmlUi/cmake) +- +- # generate configuration for build tree +- configure_package_config_file(${PROJECT_SOURCE_DIR}/CMake/RmlUiConfig.cmake.build.in +- ${CMAKE_CURRENT_BINARY_DIR}/RmlUiConfig.cmake +- INSTALL_DESTINATION ${CMAKE_CURRENT_BINARY_DIR} +- PATH_VARS INCLUDE_DIR CMAKE_CURRENT_BINARY_DIR) +- export(TARGETS ${RMLUI_EXPORTED_TARGETS} +- FILE "${CMAKE_CURRENT_BINARY_DIR}/RmlUiTargets.cmake") +- write_basic_package_version_file( +- ${CMAKE_CURRENT_BINARY_DIR}/RmlUiConfigVersion.cmake +- VERSION ${PROJECT_VERSION} +- COMPATIBILITY SameMajorVersion ) +- set(RmlUi_DIR "${CMAKE_CURRENT_BINARY_DIR}" CACHE PATH "The directory containing a CMake configuration file for RmlUi.") +-else() +- message("If you wish to use find_package(RmlUi) in your own project to find RmlUi library" +- " please update cmake to version which provides CMakePackageConfighelpers module" +- " or write generators for RmlUiConfig.cmake by yourself.") +-endif() diff --git a/recipes/rmlui/4.x/patches/4.3-fix-cmake-targets-and-config.patch b/recipes/rmlui/4.x/patches/4.3-fix-cmake-targets-and-config.patch new file mode 100644 index 0000000000000..ed5a7e097948b --- /dev/null +++ b/recipes/rmlui/4.x/patches/4.3-fix-cmake-targets-and-config.patch @@ -0,0 +1,82 @@ +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -328,15 +328,13 @@ + message(WARNING "You are using FreeType version 2.11.0 which introduced an issue that causes a crash on startup on some of the samples. Please avoid this version specifically.") + endif() + +- list(APPEND CORE_LINK_LIBS ${FREETYPE_LIBRARIES}) +- list(APPEND CORE_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIRS}) ++ list(APPEND CORE_LINK_LIBS freetype) + endif() + + # Lua + if(BUILD_LUA_BINDINGS) +- find_package(Lua REQUIRED) +- list(APPEND LUA_BINDINGS_INCLUDE_DIRS ${LUA_INCLUDE_DIR}) +- list(APPEND LUA_BINDINGS_LINK_LIBS ${LUA_LIBRARIES}) ++ find_package(lua REQUIRED CONFIG) ++ list(APPEND LUA_BINDINGS_LINK_LIBS lua::lua) + endif() + + # rlottie +@@ -442,6 +440,10 @@ + if( MATRIX_ROW_MAJOR ) + list(APPEND CORE_PUBLIC_DEFS -DRMLUI_MATRIX_ROW_MAJOR) + endif () ++if ( NOT NO_THIRDPARTY_CONTAINERS ) ++ find_package(robin_hood REQUIRED) ++ target_link_libraries(RmlCore robin_hood::robin_hood) ++endif() + if( CUSTOM_CONFIGURATION AND CUSTOM_LINK_LIBRARIES ) + target_link_libraries(RmlCore PUBLIC ${CUSTOM_LINK_LIBRARIES}) + endif () +@@ -895,49 +897,3 @@ + ) + endif() + endif() +- +-#=================================== +-# Generate Config.cmake files ====== +-#=================================== +- +-# Try to include helper module +-include(CMakePackageConfigHelpers OPTIONAL RESULT_VARIABLE PkgHelpers_AVAILABLE) +- +-# guard against older versions of cmake which do not provide it +-if(PkgHelpers_AVAILABLE) +- set (INCLUDE_INSTALL_DIR "include") +- set (LIB_INSTALL_DIR "lib") +- set (INCLUDE_DIR "${PROJECT_SOURCE_DIR}/Include") +- +- # generate configuration for install tree +- configure_package_config_file(${PROJECT_SOURCE_DIR}/CMake/RmlUiConfig.cmake.install.in +- ${CMAKE_CURRENT_BINARY_DIR}/install/RmlUiConfig.cmake +- INSTALL_DESTINATION ${LIB_INSTALL_DIR}/RmlUi/cmake +- PATH_VARS INCLUDE_INSTALL_DIR LIB_INSTALL_DIR) +- write_basic_package_version_file( +- ${CMAKE_CURRENT_BINARY_DIR}/install/RmlUiConfigVersion.cmake +- VERSION ${PROJECT_VERSION} +- COMPATIBILITY SameMajorVersion ) +- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/install/RmlUiConfig.cmake +- ${CMAKE_CURRENT_BINARY_DIR}/install/RmlUiConfigVersion.cmake +- DESTINATION ${LIB_INSTALL_DIR}/RmlUi/cmake ) +- install(EXPORT RmlUiTargets +- DESTINATION ${LIB_INSTALL_DIR}/RmlUi/cmake) +- +- # generate configuration for build tree +- configure_package_config_file(${PROJECT_SOURCE_DIR}/CMake/RmlUiConfig.cmake.build.in +- ${CMAKE_CURRENT_BINARY_DIR}/RmlUiConfig.cmake +- INSTALL_DESTINATION ${CMAKE_CURRENT_BINARY_DIR} +- PATH_VARS INCLUDE_DIR CMAKE_CURRENT_BINARY_DIR) +- export(TARGETS ${RMLUI_EXPORTED_TARGETS} +- FILE "${CMAKE_CURRENT_BINARY_DIR}/RmlUiTargets.cmake") +- write_basic_package_version_file( +- ${CMAKE_CURRENT_BINARY_DIR}/RmlUiConfigVersion.cmake +- VERSION ${PROJECT_VERSION} +- COMPATIBILITY SameMajorVersion ) +- set(RmlUi_DIR "${CMAKE_CURRENT_BINARY_DIR}" CACHE PATH "The directory containing a CMake configuration file for RmlUi.") +-else() +- message("If you wish to use find_package(RmlUi) in your own project to find RmlUi library" +- " please update cmake to version which provides CMakePackageConfighelpers module" +- " or write generators for RmlUiConfig.cmake by yourself.") +-endif() diff --git a/recipes/rmlui/4.x/patches/4.4-fix-cmake-targets-and-config.patch b/recipes/rmlui/4.x/patches/4.4-fix-cmake-targets-and-config.patch new file mode 100644 index 0000000000000..7aad2d5041e22 --- /dev/null +++ b/recipes/rmlui/4.x/patches/4.4-fix-cmake-targets-and-config.patch @@ -0,0 +1,82 @@ +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -328,15 +328,13 @@ + message(WARNING "You are using FreeType version 2.11.0 which introduced an issue that causes a crash on startup on some of the samples. Please avoid this version specifically.") + endif() + +- list(APPEND CORE_LINK_LIBS ${FREETYPE_LIBRARIES}) +- list(APPEND CORE_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIRS}) ++ list(APPEND CORE_LINK_LIBS freetype) + endif() + + # Lua + if(BUILD_LUA_BINDINGS) +- find_package(Lua REQUIRED) +- list(APPEND LUA_BINDINGS_INCLUDE_DIRS ${LUA_INCLUDE_DIR}) +- list(APPEND LUA_BINDINGS_LINK_LIBS ${LUA_LIBRARIES}) ++ find_package(lua REQUIRED CONFIG) ++ list(APPEND LUA_BINDINGS_LINK_LIBS lua::lua) + endif() + + # rlottie +@@ -442,6 +440,10 @@ + if( MATRIX_ROW_MAJOR ) + list(APPEND CORE_PUBLIC_DEFS -DRMLUI_MATRIX_ROW_MAJOR) + endif () ++if ( NOT NO_THIRDPARTY_CONTAINERS ) ++ find_package(robin_hood REQUIRED) ++ target_link_libraries(RmlCore PUBLIC robin_hood::robin_hood) ++endif() + if( CUSTOM_CONFIGURATION AND CUSTOM_LINK_LIBRARIES ) + target_link_libraries(RmlCore PUBLIC ${CUSTOM_LINK_LIBRARIES}) + endif () +@@ -909,49 +911,3 @@ + ) + endif() + endif() +- +-#=================================== +-# Generate Config.cmake files ====== +-#=================================== +- +-# Try to include helper module +-include(CMakePackageConfigHelpers OPTIONAL RESULT_VARIABLE PkgHelpers_AVAILABLE) +- +-# guard against older versions of cmake which do not provide it +-if(PkgHelpers_AVAILABLE) +- set (INCLUDE_INSTALL_DIR "include") +- set (LIB_INSTALL_DIR "lib") +- set (INCLUDE_DIR "${PROJECT_SOURCE_DIR}/Include") +- +- # generate configuration for install tree +- configure_package_config_file(${PROJECT_SOURCE_DIR}/CMake/RmlUiConfig.cmake.install.in +- ${CMAKE_CURRENT_BINARY_DIR}/install/RmlUiConfig.cmake +- INSTALL_DESTINATION ${LIB_INSTALL_DIR}/RmlUi/cmake +- PATH_VARS INCLUDE_INSTALL_DIR LIB_INSTALL_DIR) +- write_basic_package_version_file( +- ${CMAKE_CURRENT_BINARY_DIR}/install/RmlUiConfigVersion.cmake +- VERSION ${PROJECT_VERSION} +- COMPATIBILITY SameMajorVersion ) +- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/install/RmlUiConfig.cmake +- ${CMAKE_CURRENT_BINARY_DIR}/install/RmlUiConfigVersion.cmake +- DESTINATION ${LIB_INSTALL_DIR}/RmlUi/cmake ) +- install(EXPORT RmlUiTargets +- DESTINATION ${LIB_INSTALL_DIR}/RmlUi/cmake) +- +- # generate configuration for build tree +- configure_package_config_file(${PROJECT_SOURCE_DIR}/CMake/RmlUiConfig.cmake.build.in +- ${CMAKE_CURRENT_BINARY_DIR}/RmlUiConfig.cmake +- INSTALL_DESTINATION ${CMAKE_CURRENT_BINARY_DIR} +- PATH_VARS INCLUDE_DIR CMAKE_CURRENT_BINARY_DIR) +- export(TARGETS ${RMLUI_EXPORTED_TARGETS} +- FILE "${CMAKE_CURRENT_BINARY_DIR}/RmlUiTargets.cmake") +- write_basic_package_version_file( +- ${CMAKE_CURRENT_BINARY_DIR}/RmlUiConfigVersion.cmake +- VERSION ${PROJECT_VERSION} +- COMPATIBILITY SameMajorVersion ) +- set(RmlUi_DIR "${CMAKE_CURRENT_BINARY_DIR}" CACHE PATH "The directory containing a CMake configuration file for RmlUi.") +-else() +- message("If you wish to use find_package(RmlUi) in your own project to find RmlUi library" +- " please update cmake to version which provides CMakePackageConfighelpers module" +- " or write generators for RmlUiConfig.cmake by yourself.") +-endif() diff --git a/recipes/rmlui/4.x/test_package/CMakeLists.txt b/recipes/rmlui/4.x/test_package/CMakeLists.txt index a4e52d4d781fe..e73da164625e9 100644 --- a/recipes/rmlui/4.x/test_package/CMakeLists.txt +++ b/recipes/rmlui/4.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) - find_package(rmlui REQUIRED CONFIG) add_executable(${PROJECT_NAME} example.cpp) -target_compile_Features(${PROJECT_NAME} PRIVATE cxx_std_14) -target_link_libraries(${PROJECT_NAME} rmlui::rmlui) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) +target_link_libraries(${PROJECT_NAME} PRIVATE rmlui::rmlui) diff --git a/recipes/rmlui/4.x/test_package/conanfile.py b/recipes/rmlui/4.x/test_package/conanfile.py index dd013f432a8f6..e5cc6d82624f5 100644 --- a/recipes/rmlui/4.x/test_package/conanfile.py +++ b/recipes/rmlui/4.x/test_package/conanfile.py @@ -1,11 +1,22 @@ +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 ConanRmluiTestConan(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 configure(self): + self.options[self.tested_reference_str].with_thirdparty_containers = True + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -13,6 +24,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/rmlui/4.x/test_v1_package/CMakeLists.txt b/recipes/rmlui/4.x/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..e8b0466c90698 --- /dev/null +++ b/recipes/rmlui/4.x/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/rmlui/4.x/test_v1_package/conanfile.py b/recipes/rmlui/4.x/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..bfe2d3a5c6032 --- /dev/null +++ b/recipes/rmlui/4.x/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, RunEnvironment, tools +from conan.tools.build import cross_building +import os + +# legacy validation with Conan 1.x +class ConanRmluiTestV1Conan(ConanFile): + settings = "os", "arch", "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/rmm/all/conandata.yml b/recipes/rmm/all/conandata.yml new file mode 100644 index 0000000000000..31ecfbfa6c6ef --- /dev/null +++ b/recipes/rmm/all/conandata.yml @@ -0,0 +1,10 @@ +sources: + "24.04.00": + url: "https://github.com/rapidsai/rmm/archive/v24.04.00a.tar.gz" + sha256: "47a5d28a99165fc6e1f02399e0cc8b304f5bbc9aaf2071288ae92638ecdf516c" + "23.10.00": + url: "https://github.com/rapidsai/rmm/archive/v23.10.00.tar.gz" + sha256: "4e2408073662fdfd92ca21d87f7d2afc64d2595fd5a1e3fa321d3472cfbd7f7a" + "23.06.00": + url: "https://github.com/rapidsai/rmm/archive/refs/tags/v23.06.00.tar.gz" + sha256: "3dade75a6ba21041e47493a6514513aa01d40e19bba500f5e648e399744e1a24" diff --git a/recipes/rmm/all/conanfile.py b/recipes/rmm/all/conanfile.py new file mode 100644 index 0000000000000..91388dbe02f58 --- /dev/null +++ b/recipes/rmm/all/conanfile.py @@ -0,0 +1,111 @@ +import os +import textwrap + +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy, replace_in_file, save +from conan.tools.layout import basic_layout +from conan.tools.scm import Version + +required_conan_version = ">=1.52.0" + + +class RmmConan(ConanFile): + name = "rmm" + description = "RAPIDS Memory Manager" + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/rapidsai/rmm" + topics = ("cuda", "memory-management", "memory-allocation", "rapids", "header-only") + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _min_cppstd(self): + return 17 + + @property + def _compilers_minimum_version(self): + # Based partially on https://github.com/rapidsai/rmm/tree/v23.06.00#get-rmm-dependencies + return { + "Visual Studio": "15", + "msvc": "191", + "gcc": "9.3", + "clang": "8", + "apple-clang": "14.0", + } + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("thrust/1.17.2") + self.requires("spdlog/1.13.0") + self.requires("fmt/10.2.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) + + def lazy_lt_semver(v1, v2): + # Needed to allow version "9" >= "9.3" for gcc + return all(int(p1) < int(p2) for p1, p2 in zip(str(v1).split("."), str(v2).split("."))) + + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and lazy_lt_semver(self.settings.compiler.version, minimum_version): + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) + + if self.dependencies["thrust"].options.get_safe("backend") != "cuda": + self.output.warning( + "RMM requires the CUDA backend to be enabled in Thrust by setting thrust/*:backend=cuda." + ) + + def _write_version_header(self): + # Workaround for the `rapids_cmake_write_version_file(include/rmm/version_config.hpp)` CMakeLists.txt step + # https://github.com/rapidsai/rapids-cmake/blob/branch-23.08/rapids-cmake/cmake/write_version_file.cmake + # https://github.com/rapidsai/rapids-cmake/blob/branch-23.08/rapids-cmake/cmake/template/version.hpp.in + major, minor, patch = self.version.split(".")[:3] + save(self, os.path.join(self.source_folder, "include", "rmm", "version_config.hpp"), + textwrap.dedent(f"""\ + #pragma once + #define RMM_VERSION_MAJOR {int(major)} + #define RMM_VERSION_MINOR {int(minor)} + #define RMM_VERSION_PATCH {int(patch)} + """) + ) + + def _patch_sources(self): + if Version(self.version) < "23.08": + # https://github.com/rapidsai/rmm/pull/1295 + # Add missing include in logger.hpp + replace_in_file(self, os.path.join(self.source_folder, "include", "rmm", "logger.hpp"), + "#include ", "#include \n#include ") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + self._write_version_header() + self._patch_sources() + + def package(self): + copy(self, "LICENSE", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder) + for pattern in ["*.hpp", "*.h"]: + copy(self, pattern, + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include")) + + def package_info(self): + self.cpp_info.frameworkdirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("dl") diff --git a/recipes/rmm/all/test_package/CMakeLists.txt b/recipes/rmm/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..678b3e6095ba7 --- /dev/null +++ b/recipes/rmm/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(rmm REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE rmm::rmm) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/rmm/all/test_package/conanfile.py b/recipes/rmm/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/rmm/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/rmm/all/test_package/test_package.cpp b/recipes/rmm/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..981cc677b6529 --- /dev/null +++ b/recipes/rmm/all/test_package/test_package.cpp @@ -0,0 +1,10 @@ +#include +#include +#include +#include + +int main() { + // The log output will be sent to rmm_log.txt in the build directory by default + RMM_LOG_INFO("rmm version: {}.{}.{}", RMM_VERSION_MAJOR, RMM_VERSION_MINOR, RMM_VERSION_PATCH); + return EXIT_SUCCESS; +} diff --git a/recipes/rmm/config.yml b/recipes/rmm/config.yml new file mode 100644 index 0000000000000..396bbc9cfd497 --- /dev/null +++ b/recipes/rmm/config.yml @@ -0,0 +1,7 @@ +versions: + "24.04.00": + folder: all + "23.10.00": + folder: all + "23.06.00": + folder: all diff --git a/recipes/roaring/all/conandata.yml b/recipes/roaring/all/conandata.yml index 62857710d6c8c..1cf5a2a6090e4 100644 --- a/recipes/roaring/all/conandata.yml +++ b/recipes/roaring/all/conandata.yml @@ -1,31 +1,28 @@ sources: - "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.7.2": - url: "https://github.com/RoaringBitmap/CRoaring/archive/v0.7.2.tar.gz" - sha256: "534d7504e648ba4ce8a2e5e0b5416ad4c6d0f5b9d9f23b3849f19118b753dc3e" - "0.7.1": - url: "https://github.com/RoaringBitmap/CRoaring/archive/v0.7.1.tar.gz" - sha256: "77faa22b8c1226c9a7bdbca2dbb9c73ea6db9e98db9bfbb6391996cfa7a93d17" - "0.6.0": - url: "https://github.com/RoaringBitmap/CRoaring/archive/refs/tags/v0.6.0.tar.gz" - sha256: "b8e2499ca9ac6ba0d18dbbcde4bae3752acf81f08ea6309ea2a88d27972dffcf" - "0.5.0": - url: "https://github.com/RoaringBitmap/CRoaring/archive/refs/tags/v0.5.0.tar.gz" - sha256: "edab1b1a464e5a361ff622dc833170b2f33729c161aee4c2e53a324ac62ef78f" - "0.4.0": - url: "https://github.com/RoaringBitmap/CRoaring/archive/refs/tags/v0.4.0.tar.gz" - sha256: "0faf6ac893694d5c283a729373af74f813989ef0257781636ac4c397b48c1219" - "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" + "4.2.1": + url: "https://github.com/RoaringBitmap/CRoaring/archive/refs/tags/v4.2.1.tar.gz" + sha256: "3514728e9eb8c90dbc00a9e337302eb458c65be2f9501a3e882d051599c4a74c" + "4.2.0": + url: "https://github.com/RoaringBitmap/CRoaring/archive/refs/tags/v4.2.0.tar.gz" + sha256: "b5f2d184b0872f57dce911cb520925539cfa851deda516d1239e8e06aff96439" + "4.1.7": + url: "https://github.com/RoaringBitmap/CRoaring/archive/refs/tags/v4.1.7.tar.gz" + sha256: "ea235796c074c3a8a8c3e5c84bb5f09619723b8e4913cf99cc349f626c193569" + "4.1.2": + url: "https://github.com/RoaringBitmap/CRoaring/archive/refs/tags/v4.1.2.tar.gz" + sha256: "dd9e9d9a28dcf9ba1622fb4a3a7b4d7f5e12732bb35e99a7cb028b7512731a7b" + "4.1.1": + url: "https://github.com/RoaringBitmap/CRoaring/archive/refs/tags/v4.1.1.tar.gz" + sha256: "42804cc2bb5c9279ec4fcaa56d2d6b389da934634abcce8dbc4e4c1d60e1468d" + "4.1.0": + url: "https://github.com/RoaringBitmap/CRoaring/archive/refs/tags/v4.1.0.tar.gz" + sha256: "0596c6e22bcccb56f38260142b435f1f72aef7721fa370fd9f2b88380245fc1d" + "4.0.0": + url: "https://github.com/RoaringBitmap/CRoaring/archive/refs/tags/v4.0.0.tar.gz" + sha256: "a8b98db3800cd10979561a1388e4e970886a24015bd6cfabb08ba7917f541b0d" + "3.0.0": + url: "https://github.com/RoaringBitmap/CRoaring/archive/refs/tags/v3.0.0.tar.gz" + sha256: "25183bc54ab650d964256d547869a34573a13d06f7e6a369b79e77f5c1feb8ba" + "2.1.2": + url: "https://github.com/RoaringBitmap/CRoaring/archive/refs/tags/v2.1.2.tar.gz" + sha256: "a53d2f540f78ddae31e30c573b1b7fd41d7257d6a090507ba35d9c398712e5ad" diff --git a/recipes/roaring/all/conanfile.py b/recipes/roaring/all/conanfile.py index 30e359a8ff020..beeff0a3255bd 100644 --- a/recipes/roaring/all/conanfile.py +++ b/recipes/roaring/all/conanfile.py @@ -2,7 +2,7 @@ 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.files import copy, get, rmdir from conan.tools.scm import Version import os @@ -16,11 +16,13 @@ class RoaringConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/RoaringBitmap/CRoaring" topics = ("bitset", "compression", "index", "format") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], "with_avx": [True, False], + "with_avx512": [True, False], "with_neon": [True, False], "native_optimization": [True, False], } @@ -28,15 +30,21 @@ class RoaringConan(ConanFile): "shared": False, "fPIC": True, "with_avx": True, + "with_avx512": True, "with_neon": True, "native_optimization": False, } + @property + def _min_cppstd(self): + return 11 + 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.with_avx + del self.options.with_avx512 if not str(self.settings.arch).startswith("arm"): del self.options.with_neon @@ -48,21 +56,21 @@ 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 Version(self.version) >= "0.3.0": - if self.info.settings.compiler == "apple-clang" and Version(self.info.settings.compiler.version) < "11": - raise ConanInvalidConfiguration( - f"{self.ref} requires at least apple-clang 11 to support runtime dispatching.", + 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) < "11": + raise ConanInvalidConfiguration( + f"{self.ref} requires at least apple-clang 11 to support runtime dispatching.", ) 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["ROARING_DISABLE_AVX"] = not self.options.get_safe("with_avx", False) + if "with_avx512" in self.options: + tc.variables["ROARING_DISABLE_AVX512"] = not self.options.with_avx512 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 @@ -72,7 +80,6 @@ def generate(self): tc.generate() def build(self): - replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "set(CMAKE_MACOSX_RPATH OFF)", "") cmake = CMake(self) cmake.configure() cmake.build() diff --git a/recipes/roaring/all/test_package/CMakeLists.txt b/recipes/roaring/all/test_package/CMakeLists.txt index 60d328135f926..6e9e7fadde265 100644 --- a/recipes/roaring/all/test_package/CMakeLists.txt +++ b/recipes/roaring/all/test_package/CMakeLists.txt @@ -6,6 +6,3 @@ find_package(roaring REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) 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") -endif() diff --git a/recipes/roaring/all/test_package/test_package.cpp b/recipes/roaring/all/test_package/test_package.cpp index 456ab7f7990a4..18169725770ed 100644 --- a/recipes/roaring/all/test_package/test_package.cpp +++ b/recipes/roaring/all/test_package/test_package.cpp @@ -5,9 +5,7 @@ #include "roaring/roaring.hh" #include "roaring/roaring.h" -#ifndef ROARING_NO_NAMESPACE using namespace roaring; -#endif void test_example_cpp(bool copy_on_write) { // create a new empty bitmap diff --git a/recipes/roaring/config.yml b/recipes/roaring/config.yml index 1dc23bfdde0f2..589d7841508de 100644 --- a/recipes/roaring/config.yml +++ b/recipes/roaring/config.yml @@ -1,21 +1,19 @@ versions: - "0.8.0": + "4.2.1": folder: all - "0.7.3": + "4.2.0": folder: all - "0.7.2": + "4.1.7": folder: all - "0.7.1": + "4.1.2": folder: all - "0.6.0": + "4.1.1": folder: all - "0.5.0": + "4.1.0": folder: all - "0.4.0": + "4.0.0": folder: all - "0.3.4": + "3.0.0": folder: all - "0.3.3": - folder: all - "0.2.66": + "2.1.2": folder: all diff --git a/recipes/robin-hood-hashing/all/conandata.yml b/recipes/robin-hood-hashing/all/conandata.yml index 7fca23b191c8f..b2a3052ae54cb 100644 --- a/recipes/robin-hood-hashing/all/conandata.yml +++ b/recipes/robin-hood-hashing/all/conandata.yml @@ -1,22 +1,39 @@ sources: - "3.7.0": - url: "https://github.com/martinus/robin-hood-hashing/archive/3.7.0.tar.gz" - sha256: "1c4a107865becbabc0da337f9cf06f3aa6112f733efcbed0703238362a25b330" - "3.8.0": - url: "https://github.com/martinus/robin-hood-hashing/archive/3.8.0.tar.gz" - sha256: "422a0727b07cd495bf90ecbb15d4aa64e209f0accc8eba51a121843fd32abaf9" + "3.11.5": + url: "https://github.com/martinus/robin-hood-hashing/archive/refs/tags/3.11.5.tar.gz" + sha256: "3693e44dda569e9a8b87ce8263f7477b23af448a3c3600c8ab9004fe79c20ad0" + "3.11.4": + url: "https://github.com/martinus/robin-hood-hashing/archive/refs/tags/3.11.4.tar.gz" + sha256: "99d3624069a0b06df2675b4ba9d2ebac1a1236dbc52326cd6f31ca056c24eb89" + "3.11.3": + url: "https://github.com/martinus/robin-hood-hashing/archive/refs/tags/3.11.3.tar.gz" + sha256: "dcf2b7fa9ef9dd0c67102d94c28e8df3effbe1845e0ed1f31f4772ca5e857fc4" + "3.11.1": + url: "https://github.com/martinus/robin-hood-hashing/archive/refs/tags/3.11.1.tar.gz" + sha256: "31143d316b49e29b57773e720ec9ac3f7a8223dc7710329b566c874c69e1d087" "3.9.1": - url: "https://github.com/martinus/robin-hood-hashing/archive/3.9.1.tar.gz" + url: "https://github.com/martinus/robin-hood-hashing/archive/refs/tags/3.9.1.tar.gz" sha256: "d6d15546a58d170717b2be5311425f80dc06f087a0885bd95de61a727bf9adef" + "3.8.0": + url: "https://github.com/martinus/robin-hood-hashing/archive/refs/tags/3.8.0.tar.gz" + sha256: "422a0727b07cd495bf90ecbb15d4aa64e209f0accc8eba51a121843fd32abaf9" + "3.7.0": + url: "https://github.com/martinus/robin-hood-hashing/archive/refs/tags/3.7.0.tar.gz" + sha256: "1c4a107865becbabc0da337f9cf06f3aa6112f733efcbed0703238362a25b330" +patches: "3.11.1": - url: "https://github.com/martinus/robin-hood-hashing/archive/3.11.1.tar.gz" - sha256: "31143d316b49e29b57773e720ec9ac3f7a8223dc7710329b566c874c69e1d087" - "3.11.3": - url: "https://github.com/martinus/robin-hood-hashing/archive/3.11.3.tar.gz" - sha256: "dcf2b7fa9ef9dd0c67102d94c28e8df3effbe1845e0ed1f31f4772ca5e857fc4" - "3.11.4": - url: "https://github.com/martinus/robin-hood-hashing/archive/3.11.4.tar.gz" - sha256: "99d3624069a0b06df2675b4ba9d2ebac1a1236dbc52326cd6f31ca056c24eb89" - "3.11.5": - url: "https://github.com/martinus/robin-hood-hashing/archive/3.11.5.tar.gz" - sha256: "3693e44dda569e9a8b87ce8263f7477b23af448a3c3600c8ab9004fe79c20ad0" + - patch_file: "patches/3.11.1-0001-fix-missing-limits-include.patch" + patch_description: "Add missing limits include" + patch_type: "portability" + "3.9.1": + - patch_file: "patches/3.9.1-0001-fix-missing-limits-include.patch" + patch_description: "Add missing limits include" + patch_type: "portability" + "3.8.0": + - patch_file: "patches/3.8.0-0001-fix-missing-limits-include.patch" + patch_description: "Add missing limits include" + patch_type: "portability" + "3.7.0": + - patch_file: "patches/3.7.0-0001-fix-missing-limits-include.patch" + patch_description: "Add missing limits include" + patch_type: "portability" diff --git a/recipes/robin-hood-hashing/all/conanfile.py b/recipes/robin-hood-hashing/all/conanfile.py index efc53472ad008..50472c6e29a8f 100644 --- a/recipes/robin-hood-hashing/all/conanfile.py +++ b/recipes/robin-hood-hashing/all/conanfile.py @@ -1,10 +1,10 @@ from conan import ConanFile 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 RobinHoodHashingConan(ConanFile): @@ -14,9 +14,15 @@ class RobinHoodHashingConan(ConanFile): homepage = "https://github.com/martinus/robin-hood-hashing" url = "https://github.com/conan-io/conan-center-index" license = "MIT" - no_copy_source = True + package_type = "header-library" 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): self.info.clear() @@ -24,15 +30,11 @@ 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) + get(self, **self.conan_data["sources"][self.version], 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")) @@ -43,9 +45,7 @@ def package_info(self): self.cpp_info.set_property("cmake_file_name", "robin_hood") self.cpp_info.set_property("cmake_target_name", "robin_hood::robin_hood") 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"] = "robin_hood" diff --git a/recipes/robin-hood-hashing/all/patches/3.11.1-0001-fix-missing-limits-include.patch b/recipes/robin-hood-hashing/all/patches/3.11.1-0001-fix-missing-limits-include.patch new file mode 100644 index 0000000000000..eafff0438a4cc --- /dev/null +++ b/recipes/robin-hood-hashing/all/patches/3.11.1-0001-fix-missing-limits-include.patch @@ -0,0 +1,10 @@ +--- a/src/include/robin_hood.h ++++ b/src/include/robin_hood.h +@@ -42,6 +42,7 @@ + #include + #include + #include ++#include + #include // only to support hash of smart pointers + #include + #include diff --git a/recipes/robin-hood-hashing/all/patches/3.7.0-0001-fix-missing-limits-include.patch b/recipes/robin-hood-hashing/all/patches/3.7.0-0001-fix-missing-limits-include.patch new file mode 100644 index 0000000000000..f9bbca512bff4 --- /dev/null +++ b/recipes/robin-hood-hashing/all/patches/3.7.0-0001-fix-missing-limits-include.patch @@ -0,0 +1,10 @@ +--- a/src/include/robin_hood.h ++++ b/src/include/robin_hood.h +@@ -43,6 +43,7 @@ + #include + #include + #include ++#include + #include + #include + #include diff --git a/recipes/robin-hood-hashing/all/patches/3.8.0-0001-fix-missing-limits-include.patch b/recipes/robin-hood-hashing/all/patches/3.8.0-0001-fix-missing-limits-include.patch new file mode 100644 index 0000000000000..3c731c48ad9d6 --- /dev/null +++ b/recipes/robin-hood-hashing/all/patches/3.8.0-0001-fix-missing-limits-include.patch @@ -0,0 +1,10 @@ +--- a/src/include/robin_hood.h ++++ b/src/include/robin_hood.h +@@ -43,6 +43,7 @@ + #include + #include + #include ++#include + #include // only to support hash of smart pointers + #include + #include diff --git a/recipes/robin-hood-hashing/all/patches/3.9.1-0001-fix-missing-limits-include.patch b/recipes/robin-hood-hashing/all/patches/3.9.1-0001-fix-missing-limits-include.patch new file mode 100644 index 0000000000000..eafff0438a4cc --- /dev/null +++ b/recipes/robin-hood-hashing/all/patches/3.9.1-0001-fix-missing-limits-include.patch @@ -0,0 +1,10 @@ +--- a/src/include/robin_hood.h ++++ b/src/include/robin_hood.h +@@ -42,6 +42,7 @@ + #include + #include + #include ++#include + #include // only to support hash of smart pointers + #include + #include diff --git a/recipes/robin-hood-hashing/all/test_package/conanfile.py b/recipes/robin-hood-hashing/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/robin-hood-hashing/all/test_package/conanfile.py +++ b/recipes/robin-hood-hashing/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/robin-hood-hashing/all/test_v1_package/CMakeLists.txt b/recipes/robin-hood-hashing/all/test_v1_package/CMakeLists.txt index 6a850df07259f..0d20897301b68 100644 --- a/recipes/robin-hood-hashing/all/test_v1_package/CMakeLists.txt +++ b/recipes/robin-hood-hashing/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(robin_hood REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE robin_hood::robin_hood) -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/robin-hood-hashing/config.yml b/recipes/robin-hood-hashing/config.yml index 48ca6a8497c8b..82de5fd6e0c45 100644 --- a/recipes/robin-hood-hashing/config.yml +++ b/recipes/robin-hood-hashing/config.yml @@ -1,15 +1,15 @@ versions: - "3.7.0": + "3.11.5": folder: all - "3.8.0": + "3.11.4": folder: all - "3.9.1": + "3.11.3": folder: all "3.11.1": folder: all - "3.11.3": + "3.9.1": folder: all - "3.11.4": + "3.8.0": folder: all - "3.11.5": + "3.7.0": folder: all diff --git a/recipes/rocket/all/conandata.yml b/recipes/rocket/all/conandata.yml new file mode 100644 index 0000000000000..03683863693df --- /dev/null +++ b/recipes/rocket/all/conandata.yml @@ -0,0 +1,10 @@ +sources: + "cci.20200603": + url: "https://github.com/tripleslash/rocket/archive/348869fcda83f8b8b521c7654f83fea07ebe7a0a.tar.gz" + sha256: "de03b9c7f9b9478cfaa60683f95a7b0773dc0929d14e510c23f53b3804cc921f" +patches: + "cci.20200603": + - patch_file: "patches/0001-fix-thread_id.patch" + patch_description: "Fix compilation on different C++ std versions" + patch_type: "backport" + patch_source: "https://github.com/tripleslash/rocket/issues/10" diff --git a/recipes/rocket/all/conanfile.py b/recipes/rocket/all/conanfile.py new file mode 100644 index 0000000000000..7e395c84d11ae --- /dev/null +++ b/recipes/rocket/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 apply_conandata_patches, copy, export_conandata_patches, get, load, save +from conan.tools.scm import Version +import os + +required_conan_version = ">=1.53.0" + + +class RocketConan(ConanFile): + name = "rocket" + description = "Fast single header signal/slots library for C++" + license = "DocumentRef-README.md:LicenseRef-Rocket-public-domain" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/tripleslash/rocket" + topics = ("signal-slots", "observer-pattern", "header-only") + package_type = "header-library" + settings = "os", "compiler", "build_type", "arch" + + @property + def _min_cppstd(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "7", + "clang": "6", + "apple-clang": "10", + "Visual Studio": "15", + "msvc": "191", + } + + def export_sources(self): + export_conandata_patches(self) + + 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." + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def package_id(self): + self.info.clear() + + def build(self): + apply_conandata_patches(self) + + def _extract_license(self): + readme_content = load(self, os.path.join(self.source_folder, "README.md")) + first = readme_content.find("# rocket") + last = readme_content.find("signals2).") + license_content = readme_content[first:last+len("signals2).")] + # Make sure the extracted text from README has the license type + assert license_content.find("public-domain") != -1 + save(self, os.path.join(self.package_folder, "licenses", "LICENSE"), license_content) + + def package(self): + self._extract_license() + copy(self, "rocket.hpp", self.build_folder, os.path.join(self.package_folder, "include")) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + diff --git a/recipes/rocket/all/patches/0001-fix-thread_id.patch b/recipes/rocket/all/patches/0001-fix-thread_id.patch new file mode 100644 index 0000000000000..793c870ed12dc --- /dev/null +++ b/recipes/rocket/all/patches/0001-fix-thread_id.patch @@ -0,0 +1,16 @@ +diff --git a/rocket.hpp b/rocket.hpp +index 8c4e539..47d650a 100644 +--- a/rocket.hpp ++++ b/rocket.hpp +@@ -2082,8 +2082,8 @@ namespace rocket + + bool is_queued() const ROCKET_NOEXCEPT + { +- return thread_id != std::thread::id{} +- && thread_id != std::this_thread::get_id(); ++ return !(thread_id == std::thread::id{}) ++ && !(thread_id == std::this_thread::get_id()); + } + + #ifndef ROCKET_NO_BLOCKING_CONNECTIONS + diff --git a/recipes/rocket/all/test_package/CMakeLists.txt b/recipes/rocket/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..6555535f21daa --- /dev/null +++ b/recipes/rocket/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(rocket REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE rocket::rocket) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/rocket/all/test_package/conanfile.py b/recipes/rocket/all/test_package/conanfile.py new file mode 100644 index 0000000000000..b4c8de77c89d8 --- /dev/null +++ b/recipes/rocket/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 RocketTestConan(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/rocket/all/test_package/test_package.cpp b/recipes/rocket/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..33702a87e060d --- /dev/null +++ b/recipes/rocket/all/test_package/test_package.cpp @@ -0,0 +1,16 @@ +#include +#include +#include + +int main() +{ + rocket::signal test; + test.connect([](int x) + { return x * 3; }); + + constexpr int value = 2; + + const auto result{test(value) == value * 3}; + std::cout << "Rocket test success: " << std::boolalpha << result << '\n'; + return result? EXIT_SUCCESS : EXIT_FAILURE; +} diff --git a/recipes/rocket/config.yml b/recipes/rocket/config.yml new file mode 100644 index 0000000000000..0496cb4bde798 --- /dev/null +++ b/recipes/rocket/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20200603": + folder: "all" diff --git a/recipes/rocksdb/all/CMakeLists.txt b/recipes/rocksdb/all/CMakeLists.txt deleted file mode 100644 index f287ed21516c7..0000000000000 --- a/recipes/rocksdb/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.9) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory(source_subfolder) diff --git a/recipes/rocksdb/all/conandata.yml b/recipes/rocksdb/all/conandata.yml index 2e0d65d48f078..786900e6c8b94 100644 --- a/recipes/rocksdb/all/conandata.yml +++ b/recipes/rocksdb/all/conandata.yml @@ -1,38 +1,41 @@ sources: + "9.7.4": + url: "https://github.com/facebook/rocksdb/archive/refs/tags/v9.7.4.tar.gz" + sha256: "9b810c81731835fda0d4bbdb51d3199d901fa4395733ab63752d297da84c5a47" + "9.5.2": + url: "https://github.com/facebook/rocksdb/archive/refs/tags/v9.5.2.tar.gz" + sha256: "B20780586D3DF4A3C5BCBDE341A2C1946B03D18237960BDA5BC5E9538F42AF40" + "9.4.0": + url: "https://github.com/facebook/rocksdb/archive/refs/tags/v9.4.0.tar.gz" + sha256: "1f829976aa24b8ba432e156f52c9e0f0bd89c46dc0cc5a9a628ea70571c1551c" + "8.8.1": + url: "https://github.com/facebook/rocksdb/archive/refs/tags/v8.8.1.tar.gz" + sha256: "056c7e21ad8ae36b026ac3b94b9d6e0fcc60e1d937fc80330921e4181be5c36e" "6.29.5": - url: "https://github.com/facebook/rocksdb/archive/v6.29.5.tar.gz" + url: "https://github.com/facebook/rocksdb/archive/refs/tags/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" - "6.10.2": - url: "https://github.com/facebook/rocksdb/archive/v6.10.2.tar.gz" - sha256: "514b315c64159dd767bbbf6430d33313903c0c9240d4249bddead5c4297d128f" - "6.8.1": - url: "https://github.com/facebook/rocksdb/archive/v6.8.1.tar.gz" - sha256: "ca192a06ed3bcb9f09060add7e9d0daee1ae7a8705a3d5ecbe41867c5e2796a2" - "6.0.2": - url: "https://github.com/facebook/rocksdb/archive/v6.0.2.tar.gz" - sha256: "89e0832f1fb00ac240a9438d4bbdae37dd3e52f7c15c3f646dc26887da16f342" patches: + "9.7.4": + - patch_file: "patches/9.x.x-0001-exclude-thirdparty.patch" + patch_description: "Do not include thirdparty.inc" + patch_type: "portability" + "9.5.2": + - patch_file: "patches/9.x.x-0001-exclude-thirdparty.patch" + patch_description: "Do not include thirdparty.inc" + patch_type: "portability" + "9.4.0": + - patch_file: "patches/9.x.x-0001-exclude-thirdparty.patch" + patch_description: "Do not include thirdparty.inc" + patch_type: "portability" + "8.8.1": + - patch_file: "patches/8.8.1-0001-exclude-thirdparty.patch" + patch_description: "Do not include thirdparty.inc" + patch_type: "portability" "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" - "6.10.2": - - patch_file: "patches/6.10.2/0001-Rename-jemalloc-according-to-conan-packages.patch" - base_path: "source_subfolder" - "6.8.1": - - patch_file: "patches/6.8.1/0001-Rename-jemalloc-according-to-conan-packages.patch" - base_path: "source_subfolder" - "6.0.2": - - patch_file: "patches/6.0.2/0001-Rename-jemalloc-according-to-conan-packages.patch" - base_path: "source_subfolder" + - patch_file: "patches/6.29.5-0001-add-include-cstdint-for-gcc-13.patch" + patch_description: "Fix build with gcc 13 by including cstdint" + patch_type: "portability" + patch_source: "https://github.com/facebook/rocksdb/pull/11118" + - patch_file: "patches/6.29.5-0002-exclude-thirdparty.patch" + patch_description: "Do not include thirdparty.inc" + patch_type: "portability" diff --git a/recipes/rocksdb/all/conanfile.py b/recipes/rocksdb/all/conanfile.py index b10e35fb91648..36406c6b10c4d 100644 --- a/recipes/rocksdb/all/conanfile.py +++ b/recipes/rocksdb/all/conanfile.py @@ -1,22 +1,27 @@ -from conan.tools.microsoft import msvc_runtime_flag -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -import os import glob +import os import shutil -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.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, collect_libs, copy, export_conandata_patches, get, rm, rmdir +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +from conan.tools.scm import Version + +required_conan_version = ">=2.0" -class RocksDB(ConanFile): +class RocksDBConan(ConanFile): name = "rocksdb" - homepage = "https://github.com/facebook/rocksdb" + description = "A library that provides an embeddable, persistent key-value store for fast storage" license = ("GPL-2.0-only", "Apache-2.0") url = "https://github.com/conan-io/conan-center-index" - description = "A library that provides an embeddable, persistent key-value store for fast storage" - topics = ("rocksdb", "database", "leveldb", "facebook", "key-value") - - settings = "os", "compiler", "build_type", "arch" + homepage = "https://github.com/facebook/rocksdb" + topics = ("database", "leveldb", "facebook", "key-value") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -46,25 +51,12 @@ class RocksDB(ConanFile): "use_rtti": 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" if Version(self.version) < "8.8.1" else "17" 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,115 +68,94 @@ 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_gflags: self.requires("gflags/2.2.2") if self.options.with_snappy: - self.requires("snappy/1.1.9") + self.requires("snappy/1.1.10") if self.options.with_lz4: - self.requires("lz4/1.9.3") + self.requires("lz4/1.9.4") if self.options.with_zlib: - self.requires("zlib/1.2.12") + self.requires("zlib/[>=1.2.11 <2]") if self.options.with_zstd: - self.requires("zstd/1.5.2") + self.requires("zstd/1.5.5") if self.options.get_safe("with_tbb"): - self.requires("onetbb/2020.3") + self.requires("onetbb/2021.10.0") if self.options.with_jemalloc: - self.requires("jemalloc/5.2.1") + self.requires("jemalloc/5.3.0") def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) + check_min_cppstd(self, self._min_cppstd) + if self.settings.arch not in ["x86_64", "ppc64le", "ppc64", "mips64", "armv8"]: raise ConanInvalidConfiguration("Rocksdb requires 64 bits") - if self.settings.os == "Windows" and \ - self.settings.compiler == "Visual Studio" and \ - tools.Version(self.settings.compiler.version) < "15": - raise ConanInvalidConfiguration("Rocksdb requires Visual Studio 15 or later.") - - if self.version == "6.0.2" and \ - self.settings.os == "Windows" and \ - self.settings.compiler == "Visual Studio" and \ - tools.Version(self.settings.compiler.version) > "15": - raise ConanInvalidConfiguration("Rocksdb 6.0.2 is not compilable with Visual Studio >15.") # See https://github.com/facebook/rocksdb/issues/6048 - - if self.version == "6.0.2" and \ - self.settings.os == "Linux" and \ - self.settings.compiler == "clang" and \ - tools.Version(self.settings.compiler.version) > "9": - raise ConanInvalidConfiguration("Rocksdb 6.0.2 is not compilable with clang >9.") # See https://github.com/facebook/rocksdb/pull/7265 - - if self.version == "6.20.3" and \ - self.settings.os == "Linux" and \ - self.settings.compiler == "gcc" and \ - tools.Version(self.settings.compiler.version) < "5": - raise ConanInvalidConfiguration("Rocksdb 6.20.3 is not compilable with gcc <5.") # See https://github.com/facebook/rocksdb/issues/3522 + if is_msvc(self) and Version(self.settings.compiler.version) < "191": + raise ConanInvalidConfiguration("Rocksdb requires MSVC version >= 191") 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["FAIL_ON_WARNINGS"] = False - self._cmake.definitions["WITH_TESTS"] = False - self._cmake.definitions["WITH_TOOLS"] = False - self._cmake.definitions["WITH_CORE_TOOLS"] = False - self._cmake.definitions["WITH_BENCHMARK_TOOLS"] = False - self._cmake.definitions["WITH_FOLLY_DISTRIBUTED_MUTEX"] = False - if self._is_msvc: - self._cmake.definitions["WITH_MD_LIBRARY"] = "MD" in msvc_runtime_flag(self) - self._cmake.definitions["ROCKSDB_INSTALL_ON_WINDOWS"] = self.settings.os == "Windows" - self._cmake.definitions["ROCKSDB_LITE"] = self.options.lite - self._cmake.definitions["WITH_GFLAGS"] = self.options.with_gflags - self._cmake.definitions["WITH_SNAPPY"] = self.options.with_snappy - self._cmake.definitions["WITH_LZ4"] = self.options.with_lz4 - self._cmake.definitions["WITH_ZLIB"] = self.options.with_zlib - self._cmake.definitions["WITH_ZSTD"] = self.options.with_zstd - self._cmake.definitions["WITH_TBB"] = self.options.get_safe("with_tbb", False) - self._cmake.definitions["WITH_JEMALLOC"] = self.options.with_jemalloc - self._cmake.definitions["ROCKSDB_BUILD_SHARED"] = self.options.shared - self._cmake.definitions["ROCKSDB_LIBRARY_EXPORTS"] = self.settings.os == "Windows" and self.options.shared - self._cmake.definitions["ROCKSDB_DLL" ] = self.settings.os == "Windows" and self.options.shared - - self._cmake.definitions["USE_RTTI"] = self.options.use_rtti - if self.options.enable_sse == "False": - self._cmake.definitions["PORTABLE"] = True - self._cmake.definitions["FORCE_SSE42"] = False + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["FAIL_ON_WARNINGS"] = False + tc.variables["WITH_TESTS"] = False + tc.variables["WITH_TOOLS"] = False + tc.variables["WITH_CORE_TOOLS"] = False + tc.variables["WITH_BENCHMARK_TOOLS"] = False + tc.variables["WITH_FOLLY_DISTRIBUTED_MUTEX"] = False + if is_msvc(self): + tc.variables["WITH_MD_LIBRARY"] = not is_msvc_static_runtime(self) + tc.variables["ROCKSDB_INSTALL_ON_WINDOWS"] = self.settings.os == "Windows" + tc.variables["ROCKSDB_LITE"] = self.options.lite + tc.variables["WITH_GFLAGS"] = self.options.with_gflags + tc.variables["WITH_SNAPPY"] = self.options.with_snappy + tc.variables["WITH_LZ4"] = self.options.with_lz4 + tc.variables["WITH_ZLIB"] = self.options.with_zlib + tc.variables["WITH_ZSTD"] = self.options.with_zstd + tc.variables["WITH_TBB"] = self.options.get_safe("with_tbb", False) + tc.variables["WITH_JEMALLOC"] = self.options.with_jemalloc + tc.variables["ROCKSDB_BUILD_SHARED"] = self.options.shared + tc.variables["ROCKSDB_LIBRARY_EXPORTS"] = self.settings.os == "Windows" and self.options.shared + tc.variables["ROCKSDB_DLL" ] = self.settings.os == "Windows" and self.options.shared + tc.variables["USE_RTTI"] = self.options.use_rtti + if not bool(self.options.enable_sse): + tc.variables["PORTABLE"] = True + tc.variables["FORCE_SSE42"] = False elif self.options.enable_sse == "sse42": - self._cmake.definitions["PORTABLE"] = True - self._cmake.definitions["FORCE_SSE42"] = True + tc.variables["PORTABLE"] = True + tc.variables["FORCE_SSE42"] = True elif self.options.enable_sse == "avx2": - self._cmake.definitions["PORTABLE"] = False - self._cmake.definitions["FORCE_SSE42"] = False - + tc.variables["PORTABLE"] = False + tc.variables["FORCE_SSE42"] = False # not available yet in CCI + tc.variables["WITH_NUMA"] = False + tc.generate() - self._cmake.definitions["WITH_NUMA"] = False - - if self.settings.os == "Macos" and self.settings.arch == "armv8": - self._cmake.definitions["CMAKE_CXX_FLAGS"] = "-march=armv8-a" - - 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) + deps = CMakeDeps(self) + if self.options.with_jemalloc: + deps.set_property("jemalloc", "cmake_file_name", "JeMalloc") + deps.set_property("jemalloc", "cmake_target_name", "JeMalloc::JeMalloc") + if self.options.with_zstd: + deps.set_property("zstd", "cmake_target_name", "zstd::zstd") + deps.generate() def build(self): - self._patch_sources() - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def _remove_static_libraries(self): - for static_lib_name in ["lib*.a", "rocksdb.lib"]: - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), static_lib_name) + rm(self, "rocksdb.lib", os.path.join(self.package_folder, "lib")) + for lib in glob.glob(os.path.join(self.package_folder, "lib", "*.a")): + if not lib.endswith(".dll.a"): + os.remove(lib) def _remove_cpp_headers(self): for path in glob.glob(os.path.join(self.package_folder, "include", "rocksdb", "*")): @@ -195,21 +166,22 @@ def _remove_cpp_headers(self): shutil.rmtree(path) 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, "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() if self.options.shared: self._remove_static_libraries() self._remove_cpp_headers() # Force stable ABI for shared libraries - 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")) def package_info(self): cmake_target = "rocksdb-shared" if self.options.shared else "rocksdb" self.cpp_info.set_property("cmake_file_name", "RocksDB") - self.cpp_info.set_property("cmake_target_name", "RocksDB::{}".format(cmake_target)) + self.cpp_info.set_property("cmake_target_name", f"RocksDB::{cmake_target}") # TODO: back to global scope in conan v2 once cmake_find_package* generators removed - self.cpp_info.components["librocksdb"].libs = tools.collect_libs(self) + self.cpp_info.components["librocksdb"].libs = collect_libs(self) if self.settings.os == "Windows": self.cpp_info.components["librocksdb"].system_libs = ["shlwapi", "rpcrt4"] if self.options.shared: @@ -219,12 +191,7 @@ def package_info(self): if self.options.lite: self.cpp_info.components["librocksdb"].defines.append("ROCKSDB_LITE") - # TODO: to remove in conan v2 once cmake_find_package* generators removed - self.cpp_info.names["cmake_find_package"] = "RocksDB" - self.cpp_info.names["cmake_find_package_multi"] = "RocksDB" - self.cpp_info.components["librocksdb"].names["cmake_find_package"] = cmake_target - self.cpp_info.components["librocksdb"].names["cmake_find_package_multi"] = cmake_target - self.cpp_info.components["librocksdb"].set_property("cmake_target_name", "RocksDB::{}".format(cmake_target)) + self.cpp_info.components["librocksdb"].set_property("cmake_target_name", f"RocksDB::{cmake_target}") if self.options.with_gflags: self.cpp_info.components["librocksdb"].requires.append("gflags::gflags") if self.options.with_snappy: diff --git a/recipes/rocksdb/all/patches/6.0.2/0001-Rename-jemalloc-according-to-conan-packages.patch b/recipes/rocksdb/all/patches/6.0.2/0001-Rename-jemalloc-according-to-conan-packages.patch deleted file mode 100644 index fa3904b84954a..0000000000000 --- a/recipes/rocksdb/all/patches/6.0.2/0001-Rename-jemalloc-according-to-conan-packages.patch +++ /dev/null @@ -1,9 +0,0 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -66,5 +66,5 @@ else() - set(WITH_JEMALLOC ON) - else() - if(WITH_JEMALLOC) -- find_package(JeMalloc REQUIRED) -+ find_package(jemalloc REQUIRED) - add_definitions(-DROCKSDB_JEMALLOC -DJEMALLOC_NO_DEMANGLE) diff --git a/recipes/rocksdb/all/patches/6.10.2/0001-Rename-jemalloc-according-to-conan-packages.patch b/recipes/rocksdb/all/patches/6.10.2/0001-Rename-jemalloc-according-to-conan-packages.patch deleted file mode 100644 index 2e8cfd1a8a8aa..0000000000000 --- a/recipes/rocksdb/all/patches/6.10.2/0001-Rename-jemalloc-according-to-conan-packages.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -101,9 +101,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.20.3/0001-Rename-jemalloc-according-to-conan-packages.patch b/recipes/rocksdb/all/patches/6.20.3/0001-Rename-jemalloc-according-to-conan-packages.patch deleted file mode 100644 index 99195907c0c6a..0000000000000 --- a/recipes/rocksdb/all/patches/6.20.3/0001-Rename-jemalloc-according-to-conan-packages.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -100,9 +100,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.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 deleted file mode 100644 index 862805a12fdf1..0000000000000 --- a/recipes/rocksdb/all/patches/6.27.3/0001-Rename-jemalloc-according-to-conan-packages.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- 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-add-include-cstdint-for-gcc-13.patch b/recipes/rocksdb/all/patches/6.29.5-0001-add-include-cstdint-for-gcc-13.patch new file mode 100644 index 0000000000000..05725bf2c9a65 --- /dev/null +++ b/recipes/rocksdb/all/patches/6.29.5-0001-add-include-cstdint-for-gcc-13.patch @@ -0,0 +1,30 @@ +--- a/include/rocksdb/utilities/checkpoint.h ++++ b/include/rocksdb/utilities/checkpoint.h +@@ -8,6 +8,7 @@ + #pragma once + #ifndef ROCKSDB_LITE + ++#include + #include + #include + #include "rocksdb/status.h" +--- a/table/block_based/data_block_hash_index.h ++++ b/table/block_based/data_block_hash_index.h +@@ -5,6 +5,7 @@ + + #pragma once + ++#include + #include + #include + +--- a/util/string_util.h ++++ b/util/string_util.h +@@ -6,6 +6,7 @@ + + #pragma once + ++#include + #include + #include + #include diff --git a/recipes/rocksdb/all/patches/6.29.5-0002-exclude-thirdparty.patch b/recipes/rocksdb/all/patches/6.29.5-0002-exclude-thirdparty.patch new file mode 100644 index 0000000000000..fb0dd0c46b4f2 --- /dev/null +++ b/recipes/rocksdb/all/patches/6.29.5-0002-exclude-thirdparty.patch @@ -0,0 +1,16 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index ec59d4491..35577c998 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -101 +100,0 @@ if(MSVC) +- option(WITH_GFLAGS "build with GFlags" OFF) +@@ -103,2 +102,2 @@ if(MSVC) +- include(${CMAKE_CURRENT_SOURCE_DIR}/thirdparty.inc) +-else() ++endif() ++ +@@ -117 +116 @@ else() +- if(MINGW) ++ if(MINGW OR MSVC) +@@ -183 +181,0 @@ else() +-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 deleted file mode 100644 index 862805a12fdf1..0000000000000 --- a/recipes/rocksdb/all/patches/6.29.5/0001-Rename-jemalloc-according-to-conan-packages.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- 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.8.1/0001-Rename-jemalloc-according-to-conan-packages.patch b/recipes/rocksdb/all/patches/6.8.1/0001-Rename-jemalloc-according-to-conan-packages.patch deleted file mode 100644 index acaacf5868a66..0000000000000 --- a/recipes/rocksdb/all/patches/6.8.1/0001-Rename-jemalloc-according-to-conan-packages.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -97,9 +97,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/8.8.1-0001-exclude-thirdparty.patch b/recipes/rocksdb/all/patches/8.8.1-0001-exclude-thirdparty.patch new file mode 100644 index 0000000000000..c059220524e41 --- /dev/null +++ b/recipes/rocksdb/all/patches/8.8.1-0001-exclude-thirdparty.patch @@ -0,0 +1,30 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index b475a22..1d846dc 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -88,14 +88,9 @@ endif() + include(CMakeDependentOption) + + if(MSVC) +- option(WITH_GFLAGS "build with GFlags" OFF) + option(WITH_XPRESS "build with windows built in compression" OFF) +- option(ROCKSDB_SKIP_THIRDPARTY "skip thirdparty.inc" OFF) +- +- if(NOT ROCKSDB_SKIP_THIRDPARTY) +- include(${CMAKE_CURRENT_SOURCE_DIR}/thirdparty.inc) +- endif() +-else() ++endif() ++if(TRUE) + if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD" AND NOT CMAKE_SYSTEM_NAME MATCHES "kFreeBSD") + # FreeBSD has jemalloc as default malloc + # but it does not have all the jemalloc files in include/... +@@ -108,7 +103,7 @@ else() + endif() + endif() + +- if(MINGW) ++ if(MSVC OR MINGW) + option(WITH_GFLAGS "build with GFlags" OFF) + else() + option(WITH_GFLAGS "build with GFlags" ON) diff --git a/recipes/rocksdb/all/patches/9.x.x-0001-exclude-thirdparty.patch b/recipes/rocksdb/all/patches/9.x.x-0001-exclude-thirdparty.patch new file mode 100644 index 0000000000000..69aca45670016 --- /dev/null +++ b/recipes/rocksdb/all/patches/9.x.x-0001-exclude-thirdparty.patch @@ -0,0 +1,30 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 93b884d..b715cb6 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -106,14 +106,9 @@ endif() + include(CMakeDependentOption) + + if(MSVC) +- option(WITH_GFLAGS "build with GFlags" OFF) + option(WITH_XPRESS "build with windows built in compression" OFF) +- option(ROCKSDB_SKIP_THIRDPARTY "skip thirdparty.inc" OFF) +- +- if(NOT ROCKSDB_SKIP_THIRDPARTY) +- include(${CMAKE_CURRENT_SOURCE_DIR}/thirdparty.inc) +- endif() +-else() ++endif() ++if(TRUE) + if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD" AND NOT CMAKE_SYSTEM_NAME MATCHES "kFreeBSD") + # FreeBSD has jemalloc as default malloc + # but it does not have all the jemalloc files in include/... +@@ -126,7 +121,7 @@ else() + endif() + endif() + +- if(MINGW) ++ if(MSVC OR MINGW) + option(WITH_GFLAGS "build with GFlags" OFF) + else() + option(WITH_GFLAGS "build with GFlags" ON) diff --git a/recipes/rocksdb/all/test_package/CMakeLists.txt b/recipes/rocksdb/all/test_package/CMakeLists.txt index cab2ad0ef9d57..b23ea40acdad9 100644 --- a/recipes/rocksdb/all/test_package/CMakeLists.txt +++ b/recipes/rocksdb/all/test_package/CMakeLists.txt @@ -1,18 +1,23 @@ -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() find_package(RocksDB REQUIRED CONFIG) add_executable(${PROJECT_NAME}_stable_abi test_package_stable_abi.cpp) +add_test(NAME ${PROJECT_NAME}_stable_abi COMMAND ${PROJECT_NAME}_stable_abi) if(ROCKSDB_SHARED) - target_link_libraries(${PROJECT_NAME}_stable_abi RocksDB::rocksdb-shared) + target_link_libraries(${PROJECT_NAME}_stable_abi PRIVATE RocksDB::rocksdb-shared) else() - target_link_libraries(${PROJECT_NAME}_stable_abi RocksDB::rocksdb) + target_link_libraries(${PROJECT_NAME}_stable_abi PRIVATE RocksDB::rocksdb) - add_executable(${PROJECT_NAME}_cpp test_package.cpp) - target_link_libraries(${PROJECT_NAME}_cpp RocksDB::rocksdb) - set_property(TARGET ${PROJECT_NAME}_cpp PROPERTY CXX_STANDARD 11) + add_executable(${PROJECT_NAME}_cpp test_package.cpp) + target_link_libraries(${PROJECT_NAME}_cpp PRIVATE RocksDB::rocksdb) + if(RocksDB_VERSION VERSION_LESS "8.8.1") + target_compile_features(${PROJECT_NAME}_cpp PRIVATE cxx_std_11) + else() + target_compile_features(${PROJECT_NAME}_cpp PRIVATE cxx_std_17) + endif() + add_test(NAME ${PROJECT_NAME}_cpp COMMAND ${PROJECT_NAME}_cpp) endif() diff --git a/recipes/rocksdb/all/test_package/conanfile.py b/recipes/rocksdb/all/test_package/conanfile.py index 326ef695da52e..06b097c220e7c 100644 --- a/recipes/rocksdb/all/test_package/conanfile.py +++ b/recipes/rocksdb/all/test_package/conanfile.py @@ -1,22 +1,29 @@ -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_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["ROCKSDB_SHARED"] = self.dependencies["rocksdb"].options.shared + tc.generate() def build(self): cmake = CMake(self) - cmake.definitions["ROCKSDB_SHARED"] = self.options["rocksdb"].shared cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self): - if not self.options["rocksdb"].shared: - bin_path = os.path.join("bin", "test_package_cpp") - self.run(bin_path, run_environment=True) - - bin_path = os.path.join("bin", "test_package_stable_abi") - self.run(bin_path, run_environment=True) + if can_run(self): + self.run(f"ctest --output-on-failure -C {self.settings.build_type}", env="conanrun") diff --git a/recipes/rocksdb/all/test_v1_package/CMakeLists.txt b/recipes/rocksdb/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..c23ed5cfe6d98 --- /dev/null +++ b/recipes/rocksdb/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/rocksdb/all/test_v1_package/conanfile.py b/recipes/rocksdb/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5fc2cee9c5517 --- /dev/null +++ b/recipes/rocksdb/all/test_v1_package/conanfile.py @@ -0,0 +1,16 @@ +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["ROCKSDB_SHARED"] = self.options["rocksdb"].shared + 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}", run_environment=True) diff --git a/recipes/rocksdb/config.yml b/recipes/rocksdb/config.yml index 51a8046980930..1c535f1fa5e8e 100644 --- a/recipes/rocksdb/config.yml +++ b/recipes/rocksdb/config.yml @@ -1,13 +1,11 @@ versions: - "6.29.5": - folder: all - "6.27.3": + "9.7.4": folder: all - "6.20.3": + "9.5.2": folder: all - "6.10.2": + "9.4.0": folder: all - "6.8.1": + "8.8.1": folder: all - "6.0.2": + "6.29.5": folder: all diff --git a/recipes/rotor/all/conandata.yml b/recipes/rotor/all/conandata.yml index 89c8d3a93a7f8..216ceff141b71 100644 --- a/recipes/rotor/all/conandata.yml +++ b/recipes/rotor/all/conandata.yml @@ -1,10 +1,25 @@ sources: - "0.21": - url: "https://github.com/basiliscos/cpp-rotor/archive/refs/tags/v0.21.tar.gz" - sha256: "1a5bc1919fe1052c8ad148707708b19fad903ff3db33015710cfb4f89baab8fa" - "0.23": - url: "https://github.com/basiliscos/cpp-rotor/archive/refs/tags/v0.23.tar.gz" - sha256: "8f89f9d0a561ab7cc90253cc761d8b5a78887c99ef488e75ae4c49abb44ddac4" + "0.31": + url: "https://github.com/basiliscos/cpp-rotor/archive/refs/tags/v0.31.tar.gz" + sha256: "c8d9b28083c7a9c32af2cbff1d90fe1e62def989f0f89baba1244c44fb8ec9e4" + "0.30": + url: "https://github.com/basiliscos/cpp-rotor/archive/refs/tags/v0.30.tar.gz" + sha256: "d143bfce1d18d42ab0f072acfe239d1cc07a495411537579e02260673cbe8121" + "0.29": + url: "https://github.com/basiliscos/cpp-rotor/archive/refs/tags/v0.29.tar.gz" + sha256: "e17e25f2d6402389e8fde07a158ca952b815666f0a2b5e07748dfc062834c522" + "0.28": + url: "https://github.com/basiliscos/cpp-rotor/archive/refs/tags/v0.28.tar.gz" + sha256: "9fc7d1721379adca228ca45d0240b5a0060c993de984f0288c9e4b9cf667b971" + "0.25": + url: "https://github.com/basiliscos/cpp-rotor/archive/refs/tags/v0.25.tar.gz" + sha256: "b1de95937adb8d7a9beb93bc4956d8e28ff64a6c0a898e7ce12b22a224bb8f6f" "0.24": url: "https://github.com/basiliscos/cpp-rotor/archive/refs/tags/v0.24.tar.gz" sha256: "3a360d6ce7c743b740b9c6c4063493f67298690fc51e29efa19811bb3d11fa86" + "0.23": + url: "https://github.com/basiliscos/cpp-rotor/archive/refs/tags/v0.23.tar.gz" + sha256: "8f89f9d0a561ab7cc90253cc761d8b5a78887c99ef488e75ae4c49abb44ddac4" + "0.21": + url: "https://github.com/basiliscos/cpp-rotor/archive/refs/tags/v0.21.tar.gz" + sha256: "1a5bc1919fe1052c8ad148707708b19fad903ff3db33015710cfb4f89baab8fa" diff --git a/recipes/rotor/all/conanfile.py b/recipes/rotor/all/conanfile.py index df5b949027913..e7aca39a8475a 100644 --- a/recipes/rotor/all/conanfile.py +++ b/recipes/rotor/all/conanfile.py @@ -1,19 +1,21 @@ -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.54.0" class RotorConan(ConanFile): name = "rotor" + description = "Event loop friendly C++ actor micro-framework, supervisable" license = "MIT" homepage = "https://github.com/basiliscos/cpp-rotor" url = "https://github.com/conan-io/conan-center-index" - description = ( - "Event loop friendly C++ actor micro-framework, supervisable" - ) topics = ("concurrency", "actor-framework", "actors", "actor-model", "erlang", "supervising", "supervisor") - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "fPIC": [True, False], @@ -21,6 +23,8 @@ class RotorConan(ConanFile): "enable_asio": [True, False], "enable_thread": [True, False], "multithreading": [True, False], # enables multithreading support + "enable_ev": [True, False], + "enable_fltk": [True, False], } default_options = { "fPIC": True, @@ -28,91 +32,94 @@ class RotorConan(ConanFile): "enable_asio": False, "enable_thread": False, "multithreading": True, + "enable_ev": False, + "enable_fltk": False, } - exports_sources = "CMakeLists.txt" - 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 _compilers_minimum_version(self): + return { + "Visual Studio": "16", + "msvc": "192", + "gcc": "8", + "clang": "7", + "apple-clang": "12", + } + + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + if Version(self.version) < "0.26": + del self.options.enable_ev + if Version(self.version) < "0.30": + del self.options.enable_fltk 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.84.0", transitive_headers=True) + if self.options.get_safe("enable_ev", False): + self.requires("libev/4.33") + if self.options.get_safe("enable_fltk", False): + self.requires("fltk/1.3.9") + + 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 + if Version(self.version) >= "0.26": + tc.variables["BUILD_EV"] = self.options.enable_ev + if Version(self.version) >= "0.30": + tc.variables["BUILD_FLTK"] = self.options.enable_fltk + 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) - minimal_version = { - "gcc": "7", - "clang": "6", - "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 - - compiler_version = tools.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)) - - if self.options.shared and tools.Version(self.version) < "0.23": - raise ConanInvalidConfiguration("shared option is available from v0.23") - + 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 _configure_cmake(self): - if self._cmake: - return self._cmake + if self.options.shared and Version(self.version) < "0.23": + raise ConanInvalidConfiguration("shared option is available from v0.23") - 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") @@ -124,6 +131,13 @@ def package_info(self): self.cpp_info.components["thread"].libs = ["rotor_thread"] self.cpp_info.components["thread"].requires = ["core"] - # TODO: to remove in conan v2 once cmake_find_package* generators removed - self.cpp_info.names["cmake_find_package"] = "rotor" + if self.options.get_safe("enable_ev", False): + self.cpp_info.components["ev"].libs = ["rotor_ev"] + self.cpp_info.components["ev"].requires = ["core", "libev::libev"] + + if self.options.get_safe("enable_fltk", False): + self.cpp_info.components["fltk"].libs = ["rotor_fltk"] + self.cpp_info.components["fltk"].requires = ["core", "fltk::fltk"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["core"].system_libs.append("m") diff --git a/recipes/rotor/all/test_package/CMakeLists.txt b/recipes/rotor/all/test_package/CMakeLists.txt index b48e565513a1d..027b2945e0aad 100644 --- a/recipes/rotor/all/test_package/CMakeLists.txt +++ b/recipes/rotor/all/test_package/CMakeLists.txt @@ -1,12 +1,8 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) -find_package("rotor" REQUIRED) +find_package("rotor" COMPONENTS asio thread REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) target_link_libraries(${PROJECT_NAME} rotor::core) - - diff --git a/recipes/rotor/all/test_package/conanfile.py b/recipes/rotor/all/test_package/conanfile.py index 6dfcc57d996c4..a9fb96656f203 100644 --- a/recipes/rotor/all/test_package/conanfile.py +++ b/recipes/rotor/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,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/rotor/all/test_v1_package/CMakeLists.txt b/recipes/rotor/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..027b2945e0aad --- /dev/null +++ b/recipes/rotor/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package CXX) + +find_package("rotor" COMPONENTS asio thread REQUIRED) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +target_link_libraries(${PROJECT_NAME} rotor::core) diff --git a/recipes/rotor/all/test_v1_package/conanfile.py b/recipes/rotor/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..a9fb96656f203 --- /dev/null +++ b/recipes/rotor/all/test_v1_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/rotor/all/test_v1_package/test_package.cpp b/recipes/rotor/all/test_v1_package/test_package.cpp new file mode 100644 index 0000000000000..bfb89c9986e86 --- /dev/null +++ b/recipes/rotor/all/test_v1_package/test_package.cpp @@ -0,0 +1,58 @@ +#include +#include + + +namespace { +namespace to { +struct on_timer_trigger {}; +} // namespace to +} // namespace + +namespace rotor { +template <> +inline auto rotor::actor_base_t::access(request_id_t request_id, + bool cancelled) noexcept { + on_timer_trigger(request_id, cancelled); +} +} // namespace rotor + +struct dummy_supervisor_t : public rotor::supervisor_t { + using rotor::supervisor_t::supervisor_t; + using timers_map_t = std::unordered_map; + + timers_map_t timers_map; + + void do_start_timer(const rotor::pt::time_duration &, rotor::timer_handler_base_t &handler) noexcept override { + timers_map.emplace(handler.request_id, &handler); + } + + void do_cancel_timer(rotor::request_id_t timer_id) noexcept override { + auto it = timers_map.find(timer_id); + auto &actor_ptr = it->second->owner; + actor_ptr->access(timer_id, true); + timers_map.erase(it); + } + + void start() noexcept override {} + void shutdown() noexcept override {} + void enqueue(rotor::message_ptr_t) noexcept override {} +}; + +struct hello_actor : public rotor::actor_base_t { + using rotor::actor_base_t::actor_base_t; + void on_start() noexcept override { + rotor::actor_base_t::on_start(); + std::cout << "hello world\n"; + supervisor->do_shutdown(); + } +}; + +int main() { + rotor::system_context_t ctx{}; + auto timeout = boost::posix_time::milliseconds{500}; /* does not matter */ + auto sup = ctx.create_supervisor().timeout(timeout).finish(); + sup->create_actor().timeout(timeout).finish(); + sup->do_process(); + return 0; +} + diff --git a/recipes/rotor/config.yml b/recipes/rotor/config.yml index 79c6911176994..b97b8fdf6c94f 100644 --- a/recipes/rotor/config.yml +++ b/recipes/rotor/config.yml @@ -1,7 +1,17 @@ versions: - "0.21": + "0.31": folder: all - "0.23": + "0.30": + folder: all + "0.29": + folder: all + "0.28": + folder: all + "0.25": folder: all "0.24": folder: all + "0.23": + folder: all + "0.21": + folder: all diff --git a/recipes/rpclib/all/CMakeLists.txt b/recipes/rpclib/all/CMakeLists.txt deleted file mode 100644 index de7e444eb2469..0000000000000 --- a/recipes/rpclib/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/rpclib/all/conandata.yml b/recipes/rpclib/all/conandata.yml index 696b41e86b171..d7b9eea3bb30c 100644 --- a/recipes/rpclib/all/conandata.yml +++ b/recipes/rpclib/all/conandata.yml @@ -2,3 +2,9 @@ sources: "2.3.0": url: "https://github.com/rpclib/rpclib/archive/refs/tags/v2.3.0.tar.gz" sha256: "eb9e6fa65e1a79b37097397f60599b93cb443d304fbc0447c50851bc3452fdef" +patches: + "2.3.0": + - patch_file: "patches/2.3.0-0001-win-link-winsock.patch" + patch_description: "Link to mswsock and ws2_32 if windows" + patch_type: "portability" + patch_source: "https://github.com/rpclib/rpclib/pull/287" diff --git a/recipes/rpclib/all/conanfile.py b/recipes/rpclib/all/conanfile.py index 30a8488efd8a1..111d6614af1be 100644 --- a/recipes/rpclib/all/conanfile.py +++ b/recipes/rpclib/all/conanfile.py @@ -1,37 +1,39 @@ -from conans import ConanFile, tools, CMake -from conan.tools.microsoft import msvc_runtime_flag import os -required_conan_version = ">=1.43.0" +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, mkdir, rename, rmdir +from conan.tools.microsoft import is_msvc_static_runtime + +required_conan_version = ">=1.53.0" class rpclibConan(ConanFile): name = "rpclib" description = "A modern C++ msgpack-RPC server and client library." license = "MIT" - topics = ("rpc", "ipc", "rpc-server") - homepage = "https://github.com/rpclib/rpclib/" url = "https://github.com/conan-io/conan-center-index" - exports_sources = ["CMakeLists.txt", "patches/*"] - generators = "cmake" + homepage = "https://github.com/rpclib/rpclib/" + topics = ("rpc", "ipc", "rpc-server") + + 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, } - _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 export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -39,49 +41,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 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 generate(self): + tc = CMakeToolchain(self) + if is_msvc_static_runtime(self): + tc.variables["RPCLIB_MSVC_STATIC_RUNTIME"] = True + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = self.options.shared + tc.generate() + tc = CMakeDeps(self) + 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) - if "MT" in str(msvc_runtime_flag(self)): - self._cmake.definitions["RPCLIB_MSVC_STATIC_RUNTIME"] = True - 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", + 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")) + if self.settings.os == "Windows" and self.options.shared: + mkdir(self, self.package_path / "bin") + for dll in (self.package_path / "lib").glob("*.dll"): + rename(self, dll, self.package_path / "bin" / dll.name) def package_info(self): self.cpp_info.set_property("cmake_file_name", "rpclib") self.cpp_info.set_property("cmake_target_name", "rpclib::rpc") self.cpp_info.set_property("pkg_config_name", "rpclib") - # Fix for installing dll to lib folder - # - Default CMAKE installs the dll to the lib folder - # causing the test_package to fail - if self.settings.os in ["Windows"]: - if self.options.shared: - self.cpp_info.components["_rpc"].bindirs.append( - os.path.join(self.package_folder, "lib")) + # TODO: back to global scope after Conan 2.0 + self.cpp_info.components["_rpc"].libs = ["rpc"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["_rpc"].system_libs.extend(["m", "pthread"]) + elif self.settings.os == "Windows": + self.cpp_info.components["_rpc"].system_libs.extend(["mswsock", "ws2_32"]) # TODO: Remove after Conan 2.0 self.cpp_info.components["_rpc"].names["cmake_find_package"] = "rpc" self.cpp_info.components["_rpc"].names["cmake_find_package_multi"] = "rpc" - self.cpp_info.components["_rpc"].libs = ["rpc"] - if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.components["_rpc"].system_libs = ["pthread"] - self.cpp_info.names["pkg_config"] = "librpc" + self.cpp_info.components["_rpc"].set_property("cmake_target_name", "rpclib::rpc") + self.cpp_info.components["_rpc"].set_property("pkg_config_name", "rpclib") diff --git a/recipes/rpclib/all/patches/2.3.0-0001-win-link-winsock.patch b/recipes/rpclib/all/patches/2.3.0-0001-win-link-winsock.patch new file mode 100644 index 0000000000000..47ffb5454d1b3 --- /dev/null +++ b/recipes/rpclib/all/patches/2.3.0-0001-win-link-winsock.patch @@ -0,0 +1,12 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -167,6 +167,9 @@ if(RPCLIB_COMPILE_DEFINITIONS) + endif() + + target_link_libraries(${PROJECT_NAME} ${RPCLIB_DEP_LIBRARIES}) ++if (WIN32) ++ target_link_libraries(${PROJECT_NAME} mswsock ws2_32) ++endif() + target_include_directories( + ${PROJECT_NAME} PUBLIC + $ diff --git a/recipes/rpclib/all/test_package/CMakeLists.txt b/recipes/rpclib/all/test_package/CMakeLists.txt index e585430312fe0..6ea9e950e13d6 100644 --- a/recipes/rpclib/all/test_package/CMakeLists.txt +++ b/recipes/rpclib/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1.3) -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(rpclib REQUIRED CONFIG) -find_package(rpclib CONFIG REQUIRED) - -add_executable(example example.cpp) -set_target_properties(example PROPERTIES CXX_STANDARD 14) -target_link_libraries(example rpclib::rpc) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE rpclib::rpc) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/rpclib/all/test_package/conanfile.py b/recipes/rpclib/all/test_package/conanfile.py index 67c12602a84f3..3a91c9439218e 100644 --- a/recipes/rpclib/all/test_package/conanfile.py +++ b/recipes/rpclib/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", "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) @@ -11,5 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - self.run( os.path.join("bin", "example"), 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/rpclib/all/test_package/example.cpp b/recipes/rpclib/all/test_package/test_package.cpp similarity index 100% rename from recipes/rpclib/all/test_package/example.cpp rename to recipes/rpclib/all/test_package/test_package.cpp diff --git a/recipes/rpclib/all/test_v1_package/CMakeLists.txt b/recipes/rpclib/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/rpclib/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/rpclib/all/test_v1_package/conanfile.py b/recipes/rpclib/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..d2f62e670fcd2 --- /dev/null +++ b/recipes/rpclib/all/test_v1_package/conanfile.py @@ -0,0 +1,15 @@ +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): + self.run( os.path.join("bin", "test_package"), run_environment=True ) diff --git a/recipes/rsync/all/conandata.yml b/recipes/rsync/all/conandata.yml new file mode 100644 index 0000000000000..a7d6fc86710c8 --- /dev/null +++ b/recipes/rsync/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "3.2.7": + url: "https://download.samba.org/pub/rsync/src/rsync-3.2.7.tar.gz" + sha256: "4e7d9d3f6ed10878c58c5fb724a67dacf4b6aac7340b13e488fb2dc41346f2bb" diff --git a/recipes/rsync/all/conanfile.py b/recipes/rsync/all/conanfile.py new file mode 100644 index 0000000000000..c1c2765fe7084 --- /dev/null +++ b/recipes/rsync/all/conanfile.py @@ -0,0 +1,114 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps +from conan.tools.files import copy, get, rmdir +from conan.tools.layout import basic_layout +from conan.tools.apple import is_apple_os +import os + +required_conan_version = ">=1.60.0" + +class RsyncConan(ConanFile): + name = "rsync" + description = "rsync is an open source utility that provides fast incremental file transfer" + topics = ("backup", "transferring", "file-transfer", "ssh", "compression") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://rsync.samba.org/" + license = ("GPL-3.0", "LGPL-3.0") + package_type = "application" + settings = "os", "arch", "compiler", "build_type" + + options = { + "with_zlib": [True, False], + "with_openssl": [True, False], + "with_zstd": [True, False], + "with_xxhash": [True, False], + "with_lz4": [True, False], + "enable_acl": [True, False] + } + default_options = { + "with_zlib": True, + "with_openssl": True, + "with_zstd": True, + "with_xxhash": True, + "with_lz4": True, + "enable_acl": False + } + + def configure(self): + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + basic_layout(self, src_folder="src") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def package_id(self): + del self.info.settings.compiler + + def requirements(self): + if self.options.with_openssl: + self.requires("openssl/[>=1.1 <4]") + + if self.options.with_zlib: + self.requires("zlib/[>=1.2.11 <2]") + + if self.options.with_zstd: + self.requires("zstd/1.5.5") + + if self.options.with_lz4: + self.requires("lz4/1.9.2") + + if self.options.with_xxhash: + self.requires("xxhash/0.8.1") + + def validate(self): + if self.settings.os == "Windows": + raise ConanInvalidConfiguration(f"{self.ref} is not supported on Windows.") + + if is_apple_os(self): + raise ConanInvalidConfiguration(f"{self.ref} is not supported on Apple systems.") + + def generate(self): + ad = AutotoolsDeps(self) + ad.generate() + + yes_no = lambda v: "yes" if v else "no" + tc = AutotoolsToolchain(self) + tc.configure_args.extend([ + f"--enable-acl-support={yes_no(self.options.enable_acl)}", + f"--with-included-zlib={yes_no(not self.options.with_zlib)}", + "--disable-openssl" if not self.options.with_openssl else "--enable-openssl", + f"--with-zstd={yes_no(self.options.with_zstd)}", + f"--with-lz4={yes_no(self.options.with_lz4)}", + f"--with-xxhash={yes_no(self.options.with_xxhash)}", + + "--enable-manpages=no", + ]) + + if self.settings.os == "Neutrino": + tc.extra_defines.append("MAKEDEV_TAKES_3_ARGS") + + tc.generate() + + def build(self): + autotools = Autotools(self) + autotools.configure() + autotools.make() + + def package(self): + autotools = Autotools(self) + autotools.install() + + rmdir(self, os.path.join(self.package_folder, "share")) + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"), ignore_case=True) + + def package_info(self): + self.cpp_info.includedirs = [] + self.cpp_info.libdirs = [] + + # TODO: Remove after dropping Conan 1.x from ConanCenterIndex + bindir = os.path.join(self.package_folder, "bin") + self.runenv_info.prepend_path("PATH", bindir) diff --git a/recipes/rsync/all/test_package/conanfile.py b/recipes/rsync/all/test_package/conanfile.py new file mode 100644 index 0000000000000..92140298fe340 --- /dev/null +++ b/recipes/rsync/all/test_package/conanfile.py @@ -0,0 +1,17 @@ +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 can_run(self): + return + + self.run("rsync --version", env="conanrun") diff --git a/recipes/rsync/config.yml b/recipes/rsync/config.yml new file mode 100644 index 0000000000000..115b04e9ac779 --- /dev/null +++ b/recipes/rsync/config.yml @@ -0,0 +1,3 @@ +versions: + "3.2.7": + folder: all diff --git a/recipes/rtklib/all/CMakeLists.txt b/recipes/rtklib/all/CMakeLists.txt new file mode 100644 index 0000000000000..6f87c0e328a59 --- /dev/null +++ b/recipes/rtklib/all/CMakeLists.txt @@ -0,0 +1,38 @@ +# Based largely on https://github.com/tomojitakasu/RTKLIB/blob/v2.4.3-b34/app/consapp/rnx2rtkp/gcc/makefile +cmake_minimum_required(VERSION 3.15) +project(rtklib C) + +if (NOT MSVC) + add_compile_options(-ansi $<$>:-O3>) +# add_compile_options(-Wall -pedantic) +# if (GCC) +# add_compile_options(-Wno-unused-but-set-variable) +# endif() +else() + add_compile_options( /D_CRT_SECURE_NO_WARNINGS $<$>:/O2>) +# add_compile_options(/W4) +endif() + +if (APPLE) + # Allow extern functions (showmsg(), settspan() and settime()) to be found at runtime + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -undefined dynamic_lookup") +endif() + +file(GLOB_RECURSE RTKLIB_SOURCES "src/*.c") + +find_package(Threads REQUIRED) + +add_library(rtklib ${RTKLIB_SOURCES}) +target_include_directories(rtklib PUBLIC src) +target_link_libraries(rtklib PUBLIC Threads::Threads) + +if (WIN32) + target_link_libraries(rtklib PRIVATE + ws2_32 # sockets + winmm # timeGetTime() + ) +endif() + +include(GNUInstallDirs) +install(TARGETS rtklib) +install(FILES src/rtklib.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) diff --git a/recipes/rtklib/all/conandata.yml b/recipes/rtklib/all/conandata.yml new file mode 100644 index 0000000000000..7dc67f1d1ed6d --- /dev/null +++ b/recipes/rtklib/all/conandata.yml @@ -0,0 +1,9 @@ +sources: + "2.4.3-b34": + url: "https://github.com/tomojitakasu/RTKLIB/archive/refs/tags/v2.4.3-b34.tar.gz" + sha256: "a9ce13293ef71b028036cb98a114b9bba96bdd439a0aeebca8e9c73156e461cf" +patches: + "2.4.3-b34": + - patch_file: "patches/fix-dll-export-of-global-vars.patch" + patch_description: "Fix missing EXPORT attributes on global variables required for shared Windows builds" + patch_type: "portability" diff --git a/recipes/rtklib/all/conanfile.py b/recipes/rtklib/all/conanfile.py new file mode 100644 index 0000000000000..ea091707cc7ee --- /dev/null +++ b/recipes/rtklib/all/conanfile.py @@ -0,0 +1,138 @@ +import os + +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 get, copy, export_conandata_patches, apply_conandata_patches + +required_conan_version = ">=1.53.0" + + +class RtklibConan(ConanFile): + name = "rtklib" + description = "Library for standard and precise positioning with GNSS" + license = "BSD-3-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/tomojitakasu/RTKLIB" + topics = ("gnss", "rtk", "ppp", "rinex", "rtcm", "ublox", "novatel", "septentrio") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "trace": [True, False], + "enable_glonass": [True, False], + "enable_qzss": [True, False], + "enable_galileo": [True, False], + "enable_beidou": [True, False], + "enable_irnss": [True, False], + "num_frequencies": ["ANY"], + "num_ext_obs_codes": ["ANY"], + } + default_options = { + "shared": False, + "fPIC": True, + "trace": False, + "enable_glonass": True, + "enable_qzss": True, + "enable_galileo": True, + "enable_beidou": True, + "enable_irnss": True, + "num_frequencies": 5, + "num_ext_obs_codes": 3, + } + + def export_sources(self): + copy(self, "CMakeLists.txt", + src=self.recipe_folder, + dst=os.path.join(self.export_sources_folder, "src")) + 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) + + @property + def _public_defines(self): + # Values used in the public header + # https://github.com/tomojitakasu/RTKLIB/blob/v2.4.3-b34/src/rtklib.h#L6-L15 + # Default values are based on + # https://github.com/tomojitakasu/RTKLIB/blob/v2.4.3-b34/app/consapp/rnx2rtkp/gcc/makefile#L5 + # https://github.com/tomojitakasu/RTKLIB/blob/v2.4.3-b34/app/consapp/convbin/gcc/makefile#L10 + defs = {} + defs["ENAGLO"] = self.options.enable_glonass + defs["ENAQZS"] = self.options.enable_qzss + defs["ENAGAL"] = self.options.enable_galileo + defs["ENACMP"] = self.options.enable_beidou + defs["ENAIRN"] = self.options.enable_irnss + defs["NFREQ"] = str(self.options.num_frequencies) + defs["NEXOBS"] = str(self.options.num_ext_obs_codes) + defs["WIN32"] = self.settings.os == "Windows" + defs["WIN_DLL"] = self.settings.os == "Windows" and self.options.shared + return defs + + def generate(self): + tc = CMakeToolchain(self) + defs = self._public_defines + defs["TRACE"] = self.options.trace + # TODO: add as options and set libraries correctly + defs["LAPACK"] = False + defs["MKL"] = False + # Set default values + defs["SVR_REUSEADDR"] = True # reuse tcp server address + defs["NOCALLOC"] = False # use calloc for zero matrix + defs["CPUTIME_IN_GPST"] = False # cputime operated in gpst + defs["RRCENA"] = False # enable rrc correction + defs["OUTSTAT_AMB"] = False # output ambiguity parameters to solution status + defs["IERS_MODEL"] = False # use IERS tide model + if is_apple_os(self): + # Add baud rates missing from termios.h for stream.c + defs["B460800"] = 460800 + defs["B921600"] = 921600 + for k, v in defs.items(): + if type(v) in (str, int): + tc.preprocessor_definitions[k] = v + elif v: + tc.preprocessor_definitions[k] = "" + tc.generate() + tc = CMakeDeps(self) + tc.generate() + + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "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 = ["rtklib"] + + for k, v in self._public_defines.items(): + if type(v) in (str, int): + self.cpp_info.defines.append(f"{k}={v}") + elif v: + self.cpp_info.defines.append(k) + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs = ["m", "pthread", "rt"] + elif self.settings.os == "Windows": + self.cpp_info.system_libs = ["ws2_32", "winmm"] diff --git a/recipes/rtklib/all/patches/fix-dll-export-of-global-vars.patch b/recipes/rtklib/all/patches/fix-dll-export-of-global-vars.patch new file mode 100644 index 0000000000000..f52bd22d8d75b --- /dev/null +++ b/recipes/rtklib/all/patches/fix-dll-export-of-global-vars.patch @@ -0,0 +1,23 @@ +--- src/rtklib.h ++++ src/rtklib.h +@@ -1293,13 +1293,13 @@ + typedef void fatalfunc_t(const char *); /* fatal callback function type */ + + /* global variables ----------------------------------------------------------*/ +-extern const double chisqr[]; /* chi-sqr(n) table (alpha=0.001) */ +-extern const prcopt_t prcopt_default; /* default positioning options */ +-extern const solopt_t solopt_default; /* default solution output options */ +-extern const sbsigpband_t igpband1[9][8]; /* SBAS IGP band 0-8 */ +-extern const sbsigpband_t igpband2[2][5]; /* SBAS IGP band 9-10 */ +-extern const char *formatstrs[]; /* stream format strings */ +-extern opt_t sysopts[]; /* system options table */ ++EXPORT extern const double chisqr[]; /* chi-sqr(n) table (alpha=0.001) */ ++EXPORT extern const prcopt_t prcopt_default; /* default positioning options */ ++EXPORT extern const solopt_t solopt_default; /* default solution output options */ ++EXPORT extern const sbsigpband_t igpband1[9][8]; /* SBAS IGP band 0-8 */ ++EXPORT extern const sbsigpband_t igpband2[2][5]; /* SBAS IGP band 9-10 */ ++EXPORT extern const char *formatstrs[]; /* stream format strings */ ++EXPORT extern opt_t sysopts[]; /* system options table */ + + /* satellites, systems, codes functions --------------------------------------*/ + EXPORT int satno (int sys, int prn); diff --git a/recipes/rtklib/all/test_package/CMakeLists.txt b/recipes/rtklib/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..326ac56093a5e --- /dev/null +++ b/recipes/rtklib/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(rtklib REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE rtklib::rtklib) diff --git a/recipes/rtklib/all/test_package/conanfile.py b/recipes/rtklib/all/test_package/conanfile.py new file mode 100644 index 0000000000000..02eb5ce439fb4 --- /dev/null +++ b/recipes/rtklib/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/rtklib/all/test_package/test_package.cpp b/recipes/rtklib/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..51c8582d96563 --- /dev/null +++ b/recipes/rtklib/all/test_package/test_package.cpp @@ -0,0 +1,18 @@ +#include +#undef lock + +#include +#include + +// Extern functions meant to be defined by the user +extern int showmsg(const char *format, ...) { return 0; } +extern void settspan(gtime_t ts, gtime_t te) {} +extern void settime(gtime_t time) {} + +int main() { + int week = 0; + double sec = time2gpst(timeget(), &week); + std::cout << "Current GPS time: week " << week << ", " << sec << " seconds of week" + << std::endl; + return EXIT_SUCCESS; +} diff --git a/recipes/rtklib/config.yml b/recipes/rtklib/config.yml new file mode 100644 index 0000000000000..8faa0eba5645f --- /dev/null +++ b/recipes/rtklib/config.yml @@ -0,0 +1,3 @@ +versions: + "2.4.3-b34": + folder: all diff --git a/recipes/rtm/all/conandata.yml b/recipes/rtm/all/conandata.yml index 09d3d16ab4076..e9ca9adc1569f 100644 --- a/recipes/rtm/all/conandata.yml +++ b/recipes/rtm/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "2.3.0": + url: "https://github.com/nfrechette/rtm/archive/v2.3.0.tar.gz" + sha256: "2b5f2c3761bb52ae89802a574e9dc9949aec3b183f7e100b9b66a65adcc6f5ab" + "2.2.1": + url: "https://github.com/nfrechette/rtm/archive/v2.2.1.tar.gz" + sha256: "678989368bc9859138db00719ad9e2f82b51acb0d8da6905426e4134223cee2a" + "2.2.0": + url: "https://github.com/nfrechette/rtm/archive/v2.2.0.tar.gz" + sha256: "e627c46de1895b78eee63612ce4e5ade3af28e040edab6ec6f6521366b4e8b9b" "2.1.5": url: "https://github.com/nfrechette/rtm/archive/v2.1.5.tar.gz" sha256: "afb05cb00b59498756ca197028de291a1960e58d5f6fcad161d8240682481eae" diff --git a/recipes/rtm/all/conanfile.py b/recipes/rtm/all/conanfile.py index ab6e02732c88c..232084322c1ed 100644 --- a/recipes/rtm/all/conanfile.py +++ b/recipes/rtm/all/conanfile.py @@ -1,28 +1,46 @@ import os -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 + +required_conan_version = ">=1.52.0" class Rtmonan(ConanFile): name = "rtm" description = "Realtime Math" - topics = ("realtime", "math") license = "MIT" - homepage = "https://github.com/nfrechette/rtm" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/nfrechette/rtm" + topics = ("realtime", "math", "header-only") + + package_type = "header-library" + 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 = 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("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("*.h", dst="include", src=os.path.join(self._source_subfolder, "includes")) + copy(self, "LICENSE", 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, "includes")) - def package_id(self): - self.info.header_only() + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/rtm/all/test_package/CMakeLists.txt b/recipes/rtm/all/test_package/CMakeLists.txt index 33ae887aa6aea..6cc064494767b 100644 --- a/recipes/rtm/all/test_package/CMakeLists.txt +++ b/recipes/rtm/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -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() +find_package(rtm REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE rtm::rtm) set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) diff --git a/recipes/rtm/all/test_package/conanfile.py b/recipes/rtm/all/test_package/conanfile.py index a59a26a52c8dc..fae501d0afb9e 100644 --- a/recipes/rtm/all/test_package/conanfile.py +++ b/recipes/rtm/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" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain" + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/rtm/all/test_package/test_package.cpp b/recipes/rtm/all/test_package/test_package.cpp index 5e13600bd88fc..5392fd6c1108b 100644 --- a/recipes/rtm/all/test_package/test_package.cpp +++ b/recipes/rtm/all/test_package/test_package.cpp @@ -1,3 +1,6 @@ +// workaround for a missing include in rtm +#include + #include #include #include diff --git a/recipes/rtm/all/test_v1_package/CMakeLists.txt b/recipes/rtm/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/rtm/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/rtm/all/test_v1_package/conanfile.py b/recipes/rtm/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..abcaeed3f89b6 --- /dev/null +++ b/recipes/rtm/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.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/rtm/config.yml b/recipes/rtm/config.yml index 891ce064b3b74..92f533de05d77 100644 --- a/recipes/rtm/config.yml +++ b/recipes/rtm/config.yml @@ -1,4 +1,10 @@ versions: + "2.3.0": + folder: "all" + "2.2.1": + folder: "all" + "2.2.0": + folder: "all" "2.1.5": folder: "all" "2.1.4": 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..ad84f3a29f6e6 100644 --- a/recipes/rtmidi/all/conandata.yml +++ b/recipes/rtmidi/all/conandata.yml @@ -1,13 +1,30 @@ sources: + "6.0.0": + url: + - "https://www.music.mcgill.ca/~gary/rtmidi/release/rtmidi-6.0.0.tar.gz" + - "http://www.music.mcgill.ca/~gary/rtmidi/release/rtmidi-6.0.0.tar.gz" + sha256: "5960ccf64b42c23400720ccc880e2f205677ce9457f747ef758b598acd64db5b" "5.0.0": - url: "https://www.music.mcgill.ca/~gary/rtmidi/release/rtmidi-5.0.0.tar.gz" + url: + - "https://www.music.mcgill.ca/~gary/rtmidi/release/rtmidi-5.0.0.tar.gz" + - "http://www.music.mcgill.ca/~gary/rtmidi/release/rtmidi-5.0.0.tar.gz" sha256: "48db0ed58c8c0e207b5d7327a0210b5bcaeb50e26387935d02829239b0f3c2b9" "4.0.0": - url: "http://www.music.mcgill.ca/~gary/rtmidi/release/rtmidi-4.0.0.tar.gz" + url: + - "https://www.music.mcgill.ca/~gary/rtmidi/release/rtmidi-4.0.0.tar.gz" + - "http://www.music.mcgill.ca/~gary/rtmidi/release/rtmidi-4.0.0.tar.gz" sha256: "370cfe710f43fbeba8d2b8c8bc310f314338c519c2cf2865e2d2737b251526cd" patches: "4.0.0": - patch_file: "patches/4.0.0-0001-add-a-separate-licence-file-0b5d67c.patch" - base_path: "source_subfolder" + patch_description: "Add a separate LICENCE file" + patch_source: "https://github.com/thestk/rtmidi/commit/0b5d67c" + patch_type: "conan" - patch_file: "patches/4.0.0-0002-rtmidiconfig-install-location-da51f21.patch" - base_path: "source_subfolder" + patch_description: "Install rtmidiconfig in the correct location" + patch_source: "https://github.com/conan-io/conan-center-index/issues/252" + patch_type: "conan" + - patch_file: "patches/4.0.0-0003-relocatable-macos.patch" + patch_description: "Relocatable shared lib on macOS" + patch_source: "https://github.com/thestk/rtmidi/pull/211" + patch_type: "conan" diff --git a/recipes/rtmidi/all/conanfile.py b/recipes/rtmidi/all/conanfile.py index dddecdb71bc7b..c7428d7707336 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,100 @@ 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 layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self._with_alsa: - self.requires("libalsa/1.2.4") + self.requires("libalsa/1.2.10") def build_requirements(self): - if self._with_alsa: - self.build_requires("pkgconf/1.7.4") + self.tool_requires("cmake/[>=3.24 <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], strip_root=True) - 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 generate(self): + tc = CMakeToolchain(self) + tc.variables["RTMIDI_BUILD_TESTING"] = False + tc.generate() + deps = CMakeDeps(self) + deps.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + if Version(self.version) < "6.0.0": + 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/rtmidi/config.yml b/recipes/rtmidi/config.yml index 30e9497f54064..f7c2ad14131bc 100644 --- a/recipes/rtmidi/config.yml +++ b/recipes/rtmidi/config.yml @@ -1,4 +1,6 @@ versions: + "6.0.0": + folder: "all" "5.0.0": folder: "all" "4.0.0": diff --git a/recipes/rttr/all/conanfile.py b/recipes/rttr/all/conanfile.py index 05c885a8c43e2..bf4bdedfe2e83 100644 --- a/recipes/rttr/all/conanfile.py +++ b/recipes/rttr/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, 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.50.0" +required_conan_version = ">=1.53.0" class RTTRConan(ConanFile): name = "rttr" description = "Run Time Type Reflection library" - topics = ("reflection", "rttr", ) + topics = ("reflection",) url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/rttrorg/rttr" license = "MIT" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -28,8 +29,7 @@ class RTTRConan(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) diff --git a/recipes/rttr/all/test_package/conanfile.py b/recipes/rttr/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/rttr/all/test_package/conanfile.py +++ b/recipes/rttr/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/rttr/all/test_v1_package/CMakeLists.txt b/recipes/rttr/all/test_v1_package/CMakeLists.txt index 4531fed838b7e..0d20897301b68 100644 --- a/recipes/rttr/all/test_v1_package/CMakeLists.txt +++ b/recipes/rttr/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(rttr REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) -if(TARGET RTTR::Core) - target_link_libraries(${PROJECT_NAME} PRIVATE RTTR::Core) -else() - target_link_libraries(${PROJECT_NAME} PRIVATE RTTR::Core_Lib) -endif() +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/runtimeqml/all/conanfile.py b/recipes/runtimeqml/all/conanfile.py index 8ed18efdf54c9..cae0fb3d308bb 100644 --- a/recipes/runtimeqml/all/conanfile.py +++ b/recipes/runtimeqml/all/conanfile.py @@ -41,8 +41,7 @@ def _compilers_minimum_version(self): } def export_sources(self): - copy(self, "CMakeLists.txt", self.recipe_folder, - self.export_sources_folder) + copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=os.path.join(self.export_sources_folder, "src")) def config_options(self): if self.settings.os == "Windows": @@ -50,19 +49,16 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") def layout(self): - cmake_layout(self) + cmake_layout(self, src_folder="src") def requirements(self): if Version(self.version) <= "cci.20211220": - self.requires("qt/5.15.5") + self.requires("qt/5.15.13") else: - self.requires("qt/6.3.1") + self.requires("qt/6.6.2") def validate(self): if self.info.settings.compiler.cppstd: @@ -81,8 +77,7 @@ def validate(self): 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) + get(self, **self.conan_data["sources"][str(self.version)], strip_root=True) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/ruy/all/CMakeLists.txt b/recipes/ruy/all/CMakeLists.txt deleted file mode 100644 index 71b8f00c724a8..0000000000000 --- a/recipes/ruy/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() - -set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) - -add_subdirectory(source_subfolder) diff --git a/recipes/ruy/all/conandata.yml b/recipes/ruy/all/conandata.yml index 229ad4f509a81..d072c208fb5e1 100644 --- a/recipes/ruy/all/conandata.yml +++ b/recipes/ruy/all/conandata.yml @@ -1,7 +1,7 @@ sources: - "cci.20210622": - url: "https://github.com/google/ruy/archive/9c56af3fce210a8a103eda19bd6f47c08a9e3d90.tar.gz" - sha256: "8895874cfbf7263b028a6ec55b4b1737af0ea2b7bfedac90fd14d0b0a654f2dc" + "cci.20231129": + url: "https://github.com/google/ruy/archive/690c14c441387a4ea6e07a9ed89657cec8200b92.tar.gz" + sha256: "98077cf3c38f0d8c5156953c4044a6104108f247fab021477d1cff1012eb82f3" "cci.20220628": url: "https://github.com/google/ruy/archive/841ea4172ba904fe3536789497f9565f2ef64129.tar.gz" sha256: "fbd20e6c8cd5cf8ef159f69600ea0c7ef0f1401a4c16a9cd04e5a12ffa9c6e14" diff --git a/recipes/ruy/all/conanfile.py b/recipes/ruy/all/conanfile.py index be75423bd7fe7..5ff76e6c68a9c 100644 --- a/recipes/ruy/all/conanfile.py +++ b/recipes/ruy/all/conanfile.py @@ -1,8 +1,12 @@ import os -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, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, replace_in_file, rmdir +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.57.0" class RuyConan(ConanFile): @@ -13,8 +17,6 @@ class RuyConan(ConanFile): homepage = "https://github.com/google/ruy" license = "Apache-2.0" topics = ("matrix", "multiplication", "neural", "network", "AI", "tensorflow") - exports_sources = "CMakeLists.txt" - generators = "cmake" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -25,91 +27,88 @@ class RuyConan(ConanFile): "fPIC": True, } - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _minimum_compilers_version(self): return { "Visual Studio": "15", + "msvc": "191", "gcc": "5", "clang": "3.4", "apple-clang": "5.1", } 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, 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: + self.output.warning("Compiler is unknown. Assuming it supports C++14.") + elif 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 str(self.settings.compiler) == "clang" and tools.Version(self.settings.compiler.version) <= 5 and self.settings.build_type == "Debug": + if str(self.settings.compiler) == "clang" and Version(self.settings.compiler.version) <= 5 and self.settings.build_type == "Debug": raise ConanInvalidConfiguration("Debug builds are not supported on older versions of Clang (<=5)") 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): - self.requires("cpuinfo/cci.20201217") + self.requires("cpuinfo/cci.20231129") - 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["RUY_MINIMAL_BUILD"] = True - self._cmake.configure() - return self._cmake + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["RUY_MINIMAL_BUILD"] = True + tc.cache_variables["RUY_FIND_CPUINFO"] = True + # Ruy public headers don't have API decorators, + # export everything to support shared libraries on Windows + 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_folder, "CMakeLists.txt") + patches = { + #Remove the invocation after project(), see https://github.com/google/ruy/issues/328 + "cmake_minimum_required(VERSION 3.13)": "", + # Ensure `cmake_minimum_required` is called first + "# Copyright 2021 Google LLC": "# Copyright 2021 Google LLC\ncmake_minimum_required(VERSION 3.13)", + } + for pattern, patch in patches.items(): + replace_in_file(self, cmakelists, pattern, patch) - def build(self): # 1. Allow Shared builds - tools.replace_in_file(os.path.join(self._source_subfolder, "cmake", "ruy_cc_library.cmake"), + replace_in_file(self, os.path.join(self.source_folder, "cmake", "ruy_cc_library.cmake"), "add_library(${_NAME} STATIC", "add_library(${_NAME}" ) - # 2. Shared builds fail with undefined symbols without this fix. - # This is because ruy only links to 'cpuinfo' but it also needs 'clog' (from the same package) - cpuinfoLibs = self.deps_cpp_info["cpuinfo"].libs + self.deps_cpp_info["cpuinfo"].system_libs - libsListAsString = ";".join(cpuinfoLibs) - if int(self.version.strip('cci.')) < 20220628: - tools.replace_in_file(os.path.join(self._source_subfolder, "ruy", "CMakeLists.txt"), - "set(ruy_6_cpuinfo \"cpuinfo\")", - f"set(ruy_6_cpuinfo \"{libsListAsString}\")" - ) - else: - tools.replace_in_file(os.path.join(self._source_subfolder, "ruy", "CMakeLists.txt"), - "set(ruy_6_cpuinfo_cpuinfo \"cpuinfo::cpuinfo\")", - f"set(ruy_6_cpuinfo_cpuinfo \"{libsListAsString}\")" - ) - - 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) - self.copy(pattern="*.h", dst=os.path.join("include", "ruy"), src=os.path.join(self._source_subfolder, "ruy")) - self.copy(pattern="*", dst="lib", src="lib") - self.copy(pattern="*", dst="bin", src="bin") - - tools.remove_files_by_mask(self.package_folder, "*.pdb") + cmake = CMake(self) + cmake.install() + copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): self.cpp_info.libs = ["ruy_frontend", diff --git a/recipes/ruy/all/test_package/CMakeLists.txt b/recipes/ruy/all/test_package/CMakeLists.txt index ad23fc4ce0674..cfcdc6768e411 100644 --- a/recipes/ruy/all/test_package/CMakeLists.txt +++ b/recipes/ruy/all/test_package/CMakeLists.txt @@ -1,11 +1,10 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) +cmake_minimum_required(VERSION 3.15) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) -find_package(ruy REQUIRED) +find_package(ruy REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ruy::ruy) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) + +target_link_libraries(${PROJECT_NAME} PRIVATE ruy::ruy) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/ruy/all/test_package/conanfile.py b/recipes/ruy/all/test_package/conanfile.py index cb4e2b3389e8f..aa876670f64fd 100644 --- a/recipes/ruy/all/test_package/conanfile.py +++ b/recipes/ruy/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, CMakeToolchain 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 = "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/ruy/all/test_v1_package/CMakeLists.txt b/recipes/ruy/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..ad23fc4ce0674 --- /dev/null +++ b/recipes/ruy/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(ruy REQUIRED) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} ruy::ruy) +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) diff --git a/recipes/ruy/all/test_v1_package/conanfile.py b/recipes/ruy/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..cb4e2b3389e8f --- /dev/null +++ b/recipes/ruy/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" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/ruy/all/test_v1_package/test_package.cpp b/recipes/ruy/all/test_v1_package/test_package.cpp new file mode 100644 index 0000000000000..9e1b8a13b5564 --- /dev/null +++ b/recipes/ruy/all/test_v1_package/test_package.cpp @@ -0,0 +1,27 @@ +#include +#include + +#include "ruy/ruy.h" + +int main() { + + ruy::Context context; + const float lhs_data[] = {1, 2, 3, 4}; + const float rhs_data[] = {1, 2, 3, 4}; + float dst_data[4]; + + ruy::Matrix lhs; + ruy::MakeSimpleLayout(2, 2, ruy::Order::kRowMajor, lhs.mutable_layout()); + lhs.set_data(lhs_data); + ruy::Matrix rhs; + ruy::MakeSimpleLayout(2, 2, ruy::Order::kColMajor, rhs.mutable_layout()); + rhs.set_data(rhs_data); + ruy::Matrix dst; + ruy::MakeSimpleLayout(2, 2, ruy::Order::kColMajor, dst.mutable_layout()); + dst.set_data(dst_data); + + ruy::MulParams mul_params; + ruy::Mul(lhs, rhs, mul_params, &context, &dst); + + std::cout << "ruy's test_package ran successfully \n"; +} diff --git a/recipes/ruy/config.yml b/recipes/ruy/config.yml index 7d2f41fbdce17..1535fe201a121 100644 --- a/recipes/ruy/config.yml +++ b/recipes/ruy/config.yml @@ -1,5 +1,5 @@ versions: - "cci.20210622": + "cci.20231129": folder: all "cci.20220628": folder: all diff --git a/recipes/rvo2/all/CMakeLists.txt b/recipes/rvo2/all/CMakeLists.txt deleted file mode 100644 index 4e4f66d9ee7ef..0000000000000 --- a/recipes/rvo2/all/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -include("${CMAKE_BINARY_DIR}/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/rvo2/all/conanfile.py b/recipes/rvo2/all/conanfile.py index c7ee9cc9e4688..f5f8524c916a7 100644 --- a/recipes/rvo2/all/conanfile.py +++ b/recipes/rvo2/all/conanfile.py @@ -1,16 +1,23 @@ import os -from conans import ConanFile, tools, CMake + +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.files import copy, get, replace_in_file + +required_conan_version = ">=1.53.0" class Rvo2Conan(ConanFile): name = "rvo2" description = "Optimal Reciprocal Collision Avoidance" - topics = ("conan", "collision", "avoidance", ) + license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/snape/RVO2" - license = "Apache-2.0" + topics = ("collision", "avoidance") - settings = "os", "compiler", "build_type", "arch" + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -20,55 +27,51 @@ class Rvo2Conan(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 + 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 = "RVO2-{}".format(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.configure() - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + tc.generate() def _patch_sources(self): - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "add_subdirectory(examples)", - "") - tools.replace_in_file(os.path.join(self._source_subfolder, "src", "CMakeLists.txt"), - "DESTINATION include", - "DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}") - tools.replace_in_file(os.path.join(self._source_subfolder, "src", "CMakeLists.txt"), - "RVO DESTINATION lib", - "RVO RUNTIME LIBRARY ARCHIVE") + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "add_subdirectory(examples)", "") + replace_in_file( + self, + os.path.join(self.source_folder, "src", "CMakeLists.txt"), + "DESTINATION include", + "DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}", + ) + replace_in_file( + self, + os.path.join(self.source_folder, "src", "CMakeLists.txt"), + "RVO DESTINATION lib", + "RVO RUNTIME LIBRARY ARCHIVE", + ) 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") - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + 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 = ["RVO"] diff --git a/recipes/rvo2/all/test_package/CMakeLists.txt b/recipes/rvo2/all/test_package/CMakeLists.txt index 196188113685c..17ebed2c5661d 100644 --- a/recipes/rvo2/all/test_package/CMakeLists.txt +++ b/recipes/rvo2/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() +find_package(rvo2 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE rvo2::rvo2) diff --git a/recipes/rvo2/all/test_package/conanfile.py b/recipes/rvo2/all/test_package/conanfile.py index bd7165a553cf4..ef5d7042163ec 100644 --- a/recipes/rvo2/all/test_package/conanfile.py +++ b/recipes/rvo2/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/rvo2/all/test_v1_package/CMakeLists.txt b/recipes/rvo2/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/rvo2/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/rvo2/all/test_v1_package/conanfile.py b/recipes/rvo2/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..7e2dfe859bb27 --- /dev/null +++ b/recipes/rvo2/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/rxcpp/all/conanfile.py b/recipes/rxcpp/all/conanfile.py index d05961ecfc442..61160297e88db 100644 --- a/recipes/rxcpp/all/conanfile.py +++ b/recipes/rxcpp/all/conanfile.py @@ -1,9 +1,11 @@ from conan import ConanFile +from conan.errors import ConanInvalidConfiguration 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" +required_conan_version = ">=2.1" class RxcppConan(ConanFile): @@ -14,6 +16,7 @@ class RxcppConan(ConanFile): homepage = "https://github.com/ReactiveX/RxCpp" url = "https://github.com/conan-io/conan-center-index" settings = "os", "arch", "compiler", "build_type" + package_type = "header-library" no_copy_source = True def package_id(self): @@ -21,6 +24,11 @@ def package_id(self): def layout(self): basic_layout(self, src_folder="src") + + def validate_build(self): + if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) >= "14": + raise ConanInvalidConfiguration("This package can't be built for gcc >= 14. " + "You can compile it with a lower version and consume it later with your compiler.") def source(self): get(self, **self.conan_data["sources"][self.version], diff --git a/recipes/rxcpp/all/test_v1_package/CMakeLists.txt b/recipes/rxcpp/all/test_v1_package/CMakeLists.txt deleted file mode 100644 index f776bf6153687..0000000000000 --- a/recipes/rxcpp/all/test_v1_package/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(rxcpp REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE rxcpp::rxcpp) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/s2geometry/all/conandata.yml b/recipes/s2geometry/all/conandata.yml new file mode 100644 index 0000000000000..5cd6ac69f48bf --- /dev/null +++ b/recipes/s2geometry/all/conandata.yml @@ -0,0 +1,16 @@ +sources: + "0.11.1": + url: "https://github.com/google/s2geometry/archive/refs/tags/v0.11.1.tar.gz" + sha256: "bdbeb8ebdb88fa934257caf81bb44b55711617a3ab4fdec2c3cfd6cc31b61734" + "0.10.0": + url: "https://github.com/google/s2geometry/archive/refs/tags/v0.10.0.tar.gz" + sha256: "1c17b04f1ea20ed09a67a83151ddd5d8529716f509dde49a8190618d70532a3d" +patches: + "0.10.0": + - patch_description: "Bump CMAKE_CXX_STANDARD to 14" + patch_file: "patches/bump_cmake_cxx_standard.patch" + patch_source: "https://github.com/google/s2geometry/issues/317" + patch_type: "portability" + - patch_description: "Add message to static_assert to be compatible with c++14 (MSVC)" + patch_file: "patches/add_message_to_static_assert.patch" + patch_type: "portability" diff --git a/recipes/s2geometry/all/conanfile.py b/recipes/s2geometry/all/conanfile.py new file mode 100644 index 0000000000000..fd54c4b79443f --- /dev/null +++ b/recipes/s2geometry/all/conanfile.py @@ -0,0 +1,104 @@ +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, cmake_layout +from conan.tools.files import get, copy, rmdir, export_conandata_patches, apply_conandata_patches +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version + +required_conan_version = ">=1.54.0" + + +class S2GeometryConan(ConanFile): + name = "s2geometry" + description = "Computational geometry and spatial indexing on the sphere" + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/google/s2geometry" + topics = ("geometry", "spherical-geometry", "spatial-indexing") + package_type = "library" + 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": "6", + "clang": "7", + "apple-clang": "10", + "Visual Studio": "15", + "msvc": "191", + } + + 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("abseil/20230802.1", transitive_headers=True, transitive_libs=True) + self.requires("openssl/[>=1.1 <4]", transitive_headers=True) + + 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 is_msvc(self) and self.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} can not be built as shared 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["GOOGLETEST_ROOT"] = False + tc.variables["BUILD_EXAMPLES"] = False + tc.variables["BUILD_TESTS"] = False + tc.generate() + tc = CMakeDeps(self) + 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, "share")) + + def package_info(self): + self.cpp_info.libs = ["s2"] + self.cpp_info.set_property("cmake_file_name", "s2") + self.cpp_info.set_property("cmake_target_name", "s2::s2") diff --git a/recipes/s2geometry/all/patches/add_message_to_static_assert.patch b/recipes/s2geometry/all/patches/add_message_to_static_assert.patch new file mode 100644 index 0000000000000..1a458e9936c5d --- /dev/null +++ b/recipes/s2geometry/all/patches/add_message_to_static_assert.patch @@ -0,0 +1,13 @@ +diff --git a/src/s2/s2lax_polygon_shape.cc b/src/s2/s2lax_polygon_shape.cc +index e71476a..7bfe874 100644 +--- a/src/s2/s2lax_polygon_shape.cc ++++ b/src/s2/s2lax_polygon_shape.cc +@@ -33,7 +33,7 @@ namespace { + template + std::unique_ptr make_unique_for_overwrite(size_t n) { + // We only need to support this one variant. +- static_assert(std::is_array::value); ++ static_assert(std::is_array::value, ""); + return std::unique_ptr(new typename absl::remove_extent_t[n]); + } + } // namespace diff --git a/recipes/s2geometry/all/patches/bump_cmake_cxx_standard.patch b/recipes/s2geometry/all/patches/bump_cmake_cxx_standard.patch new file mode 100644 index 0000000000000..4bb8e07c25908 --- /dev/null +++ b/recipes/s2geometry/all/patches/bump_cmake_cxx_standard.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f080b4b..b2699ee 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -19,7 +19,7 @@ endif() + # undefined symbol errors since ABSL_HAVE_STD_STRING_VIEW etc will + # end up defined differently. There is probably a better way to achieve + # this than assuming what absl used. +-set(CMAKE_CXX_STANDARD 11) ++set(CMAKE_CXX_STANDARD 14 CACHE STRING "The C++ standard to build with") + set(CMAKE_CXX_STANDARD_REQUIRED ON) + # No compiler-specific extensions, i.e. -std=c++11, not -std=gnu++11. + set(CMAKE_CXX_EXTENSIONS OFF) diff --git a/recipes/s2geometry/all/test_package/CMakeLists.txt b/recipes/s2geometry/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..629a8c3aedf01 --- /dev/null +++ b/recipes/s2geometry/all/test_package/CMakeLists.txt @@ -0,0 +1,18 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(s2 REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE s2::s2) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) +if(MSVC) + # Use unsigned characters + target_compile_options(${PROJECT_NAME} PRIVATE "-J") + target_compile_definitions(${PROJECT_NAME} PRIVATE + # Make sure cmath header defines things like M_PI + "_USE_MATH_DEFINES" + # Make sure Windows doesn't define min/max macros that interfere with STL + "NOMINMAX" + ) +endif() diff --git a/recipes/s2geometry/all/test_package/conanfile.py b/recipes/s2geometry/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/s2geometry/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/s2geometry/all/test_package/test_package.cpp b/recipes/s2geometry/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..1f6da7a09f6f2 --- /dev/null +++ b/recipes/s2geometry/all/test_package/test_package.cpp @@ -0,0 +1,18 @@ +#include +#include +#include +#include + +#include +#include + +int main() +{ + S2Builder builder{S2Builder::Options()}; + S2Polygon output; + builder.StartLayer(std::make_unique(&output)); + auto input = s2textformat::MakePolygonOrDie("0:0, 0:5, 5:5, 5:0; 1:1, 1:4, 4:4, 4:1"); + builder.AddShape(*input->index().shape(0)); + S2Error error; + std::cout << "Builder: " << (builder.Build(&error) ? "OK" : error.text()) << std::endl; +} diff --git a/recipes/s2geometry/config.yml b/recipes/s2geometry/config.yml new file mode 100644 index 0000000000000..3a159672513b1 --- /dev/null +++ b/recipes/s2geometry/config.yml @@ -0,0 +1,5 @@ +versions: + "0.11.1": + folder: all + "0.10.0": + folder: all diff --git a/recipes/s2let/all/CMakeLists.txt b/recipes/s2let/all/CMakeLists.txt deleted file mode 100644 index 0496b29838549..0000000000000 --- a/recipes/s2let/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/s2let/all/conandata.yml b/recipes/s2let/all/conandata.yml index 93e1e80ecc199..9a04386d3631c 100644 --- a/recipes/s2let/all/conandata.yml +++ b/recipes/s2let/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.2.6": + url: "https://github.com/astro-informatics/s2let/archive/v2.2.6.tar.gz" + sha256: "0ce214e110305fdd3729875add515ca00c23dde3329af43d1fff763514607381" "2.2.3": url: "https://github.com/astro-informatics/s2let/archive/refs/tags/v2.2.3.tar.gz" sha256: "1321e1bc96ba200e4cd4056843cd4075de1c05be20e64185f065f48b9cefe3f8" diff --git a/recipes/s2let/all/conanfile.py b/recipes/s2let/all/conanfile.py index 1fc2aa8dc0cd5..a68602d8d89c3 100644 --- a/recipes/s2let/all/conanfile.py +++ b/recipes/s2let/all/conanfile.py @@ -1,17 +1,24 @@ -from conans import CMake, ConanFile, 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.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, rm +from conan.tools.microsoft import is_msvc + +required_conan_version = ">=1.53.0" class S2let(ConanFile): name = "s2let" + description = "Fast wavelets on the sphere" license = "GPL-3.0-or-later" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/astro-informatics/s2let" - description = "Fast wavelets on the sphere" - settings = "os", "arch", "compiler", "build_type" topics = ("physics", "astrophysics", "radio interferometry") + + package_type = "static-library" + settings = "os", "arch", "compiler", "build_type" options = { "fPIC": [True, False], "with_cfitsio": [True, False], @@ -20,62 +27,50 @@ class S2let(ConanFile): "fPIC": True, "with_cfitsio": False, } - generators = "cmake", "cmake_find_package" - exports_sources = ["CMakeLists.txt"] - - @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): - 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): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("astro-informatics-so3/1.3.4") + self.requires("astro-informatics-so3/1.3.6", transitive_headers=True, transitive_libs=True) if self.options.with_cfitsio: - self.requires("cfitsio/3.490") + self.requires("cfitsio/4.3.1") def validate(self): - if self.settings.compiler == "Visual Studio": - raise ConanInvalidConfiguration( - "S2LET requires C99 support for complex numbers." - ) + if is_msvc(self): + raise ConanInvalidConfiguration("S2LET requires C99 support for complex numbers.") 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 _cmake(self): - if not hasattr(self, "_cmake_instance"): - self._cmake_instance = CMake(self) - self._cmake_instance.definitions["BUILD_TESTING"] = False - self._cmake_instance.definitions["cfitsio"] = self.options.with_cfitsio - self._cmake_instance.configure(build_folder=self._build_subfolder) - return self._cmake_instance + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTING"] = False + tc.variables["cfitsio"] = self.options.with_cfitsio + tc.generate() + tc = CMakeDeps(self) + tc.generate() def build(self): - self._cmake.build() + cmake = CMake(self) + cmake.configure() + cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self._cmake.install() + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + rm(self, "*.cmake", self.package_folder, recursive=True) def package_info(self): - self.cpp_info.names["cmake_find_package"] = "s2let" - self.cpp_info.names["cmake_find_package_multi"] = "s2let" self.cpp_info.libs = ["s2let"] - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["m"] diff --git a/recipes/s2let/all/test_package/CMakeLists.txt b/recipes/s2let/all/test_package/CMakeLists.txt index 87839a22ea4e7..d0ee79e2b9187 100644 --- a/recipes/s2let/all/test_package/CMakeLists.txt +++ b/recipes/s2let/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.15) project(test_package C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(s2let REQUIRED NO_MODULE) +find_package(s2let REQUIRED CONFIG) add_executable(${PROJECT_NAME} example.c) target_compile_features(${PROJECT_NAME} PUBLIC c_std_99) diff --git a/recipes/s2let/all/test_package/conanfile.py b/recipes/s2let/all/test_package/conanfile.py index abcaeed3f89b6..ef5d7042163ec 100644 --- a/recipes/s2let/all/test_package/conanfile.py +++ b/recipes/s2let/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.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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/s2let/all/test_v1_package/CMakeLists.txt b/recipes/s2let/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/s2let/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/s2let/all/test_v1_package/conanfile.py b/recipes/s2let/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..abcaeed3f89b6 --- /dev/null +++ b/recipes/s2let/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.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/s2let/config.yml b/recipes/s2let/config.yml index a0d8538280848..880dc7c80ba70 100644 --- a/recipes/s2let/config.yml +++ b/recipes/s2let/config.yml @@ -1,3 +1,5 @@ versions: + "2.2.6": + folder: all "2.2.3": folder: all diff --git a/recipes/s2n/all/CMakeLists.txt b/recipes/s2n/all/CMakeLists.txt index 881539f76bdb6..c7d1ca7e609e6 100644 --- a/recipes/s2n/all/CMakeLists.txt +++ b/recipes/s2n/all/CMakeLists.txt @@ -1,13 +1,11 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.15) project(cmake_wrapper LANGUAGES C) -include(conanbuildinfo.cmake) -conan_basic_setup() - -find_package(OpenSSL REQUIRED COMPONENTS Crypto) +# We want to discover OpenSSL through CMakeDeps and use OpenSSL::Crypto target for linking +# https://github.com/aws/s2n-tls/blob/v1.3.31/CMakeLists.txt#L27-L28 +# https://github.com/aws/s2n-tls/blob/v1.3.31/CMakeLists.txt#L379-L381 +find_package(OpenSSL REQUIRED) add_library(crypto INTERFACE IMPORTED) set_target_properties(crypto PROPERTIES INTERFACE_LINK_LIBRARIES "OpenSSL::Crypto") -set(SEARCH_LIBCRYPTO OFF) - -add_subdirectory(source_subfolder) +add_subdirectory(src) diff --git a/recipes/s2n/all/conandata.yml b/recipes/s2n/all/conandata.yml index 119cdd4f58eb5..15f9995438330 100644 --- a/recipes/s2n/all/conandata.yml +++ b/recipes/s2n/all/conandata.yml @@ -1,29 +1,28 @@ sources: - "1.3.31": - url: "https://github.com/aws/s2n-tls/archive/v1.3.31.tar.gz" - sha256: "23cfb42f82cbe1ce94b59f3b1c1c8eb9d24af2a1ae4c8f854209ff88fddd3900" + "1.5.7": + url: "https://github.com/aws/s2n-tls/archive/refs/tags/v1.5.7.tar.gz" + sha256: "c30b97c8bcccc0557331dd1a043010a70984c9cff11b0bbd769651db68f8b91d" + "1.5.6": + url: "https://github.com/aws/s2n-tls/archive/refs/tags/v1.5.6.tar.gz" + sha256: "85602d0ad672cb233052504624dec23b47fc6d324bb82bd6eaff13b8f652dec3" + "1.5.5": + url: "https://github.com/aws/s2n-tls/archive/refs/tags/v1.5.5.tar.gz" + sha256: "6316e1ad2c8ef5807519758bb159d314b9fef31d79ae27bc8f809104b978bb04" + "1.5.3": + url: "https://github.com/aws/s2n-tls/archive/refs/tags/v1.5.3.tar.gz" + sha256: "609d4ab5747e592a8749f2db7ff6422ea2e0aff3d2790b6d36defe276f422a71" + "1.5.2": + url: "https://github.com/aws/s2n-tls/archive/refs/tags/v1.5.2.tar.gz" + sha256: "896d9f8f8e9bd2fdcb9a21b18aede4f7afc65bde279afabc60abf97fa5069dd1" + "1.5.1": + url: "https://github.com/aws/s2n-tls/archive/refs/tags/v1.5.1.tar.gz" + sha256: "d79710d6ef089097a3b84fc1e5cec2f08d1ec46e93b1d400df59fcfc859e15a3" + "1.5.0": + url: "https://github.com/aws/s2n-tls/archive/refs/tags/v1.5.0.tar.gz" + sha256: "5e86d97d8f24653ef3dff3abe6165169f0ba59cdf52b5264987125bba070174d" + "1.4.16": + url: "https://github.com/aws/s2n-tls/archive/refs/tags/v1.4.16.tar.gz" + sha256: "84fdbaa894c722bf13cac87b8579f494c1c2d66de642e5e6104638fddea76ad9" "1.3.15": url: "https://github.com/aws/s2n-tls/archive/v1.3.15.tar.gz" sha256: "e3fc3405bb56334cbec90c35cbdf0e8a0f53199749a3f4b8fddb8d8a41e6db8b" - "1.3.9": - url: "https://github.com/aws/s2n-tls/archive/refs/tags/v1.3.9.tar.gz" - sha256: "09f03600d45cac99b8495f9c7aa5f70a83b5c02867a3018a1ba9975d53184658" - "1.2.0": - url: "https://github.com/aws/s2n-tls/archive/refs/tags/v1.2.0.tar.gz" - sha256: "90c1b5f4ac2c46774c8f100cac4f2a951715ae0bf2661799b9aaa891e6fb1f30" - "1.1.1": - url: "https://github.com/aws/s2n-tls/archive/refs/tags/v1.1.1.tar.gz" - sha256: "a17ef1e55b0a6c3d422b8b857bcfd26af7d2f8b33628a540854a6c17b8bed4d8" - "1.1.0": - url: "https://github.com/aws/s2n-tls/archive/refs/tags/v1.1.0.tar.gz" - sha256: "e094fd1f2044cfaeedb534ef1d7e4fd8745d8c07a247ce383cd8a6a5288e195c" - "1.0.11": - url: "https://github.com/aws/s2n-tls/archive/refs/tags/v1.0.11.tar.gz" - sha256: "dbe886cf8cd6658cce571cdaba81e9a93d8c914fd1eba0d3233fec64ed53224b" -patches: - "1.1.0": - - patch_file: "patches/1.1.0/001-try-compile.patch" - base_path: "source_subfolder" - "1.0.11": - - patch_file: "patches/1.0.11/001-try-compile.patch" - base_path: "source_subfolder" diff --git a/recipes/s2n/all/conanfile.py b/recipes/s2n/all/conanfile.py index ab4c2448a8e94..6fc1e08a65355 100644 --- a/recipes/s2n/all/conanfile.py +++ b/recipes/s2n/all/conanfile.py @@ -1,19 +1,21 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.files import apply_conandata_patches, get, rmdir -from conans import CMake +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.53.0" -class S2n(ConanFile): +class S2nConan(ConanFile): name = "s2n" description = "An implementation of the TLS/SSL protocols" - topics = ("aws", "amazon", "cloud", ) + license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/aws/s2n-tls" - license = "Apache-2.0", + topics = ("aws", "amazon", "cloud", ) + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -24,68 +26,77 @@ class S2n(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"]) + copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder) 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("openssl/1.1.1s") + self.requires("openssl/[>=1.1 <4]") def validate(self): if self.settings.os == "Windows": raise ConanInvalidConfiguration("Not supported (yet)") def source(self): - 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_TESTING"] = False - self._cmake.definitions["UNSAFE_TREAT_WARNINGS_AS_ERRORS"] = False - 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_TESTING"] = False + tc.variables["UNSAFE_TREAT_WARNINGS_AS_ERRORS"] = False + tc.variables["SEARCH_LIBCRYPTO"] = False # see CMakeLists wrapper + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - apply_conandata_patches(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() rmdir(self, os.path.join(self.package_folder, "lib", "s2n")) + # 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), + {"AWS::s2n": "s2n::s2n"} + ) + + 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", "s2n") self.cpp_info.set_property("cmake_target_name", "AWS::s2n") - # TODO: back to global scope in conan v2 once cmake_find_package* generators removed - self.cpp_info.components["s2n-lib"].libs = ["s2n"] - self.cpp_info.components["s2n-lib"].requires = ["openssl::crypto"] + self.cpp_info.libs = ["s2n"] + self.cpp_info.requires = ["openssl::crypto"] if self.settings.os in ("FreeBSD", "Linux"): - self.cpp_info.components["s2n-lib"].system_libs = ["m", "pthread"] + self.cpp_info.system_libs = ["m", "pthread"] # TODO: to remove in conan v2 once cmake_find_package* generators removed - self.cpp_info.filenames["cmake_find_package"] = "s2n" - self.cpp_info.filenames["cmake_find_package_multi"] = "s2n" - self.cpp_info.names["cmake_find_package"] = "AWS" - self.cpp_info.names["cmake_find_package_multi"] = "AWS" - self.cpp_info.components["s2n-lib"].names["cmake_find_package"] = "s2n" - self.cpp_info.components["s2n-lib"].names["cmake_find_package_multi"] = "s2n" + 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/s2n/all/test_package/CMakeLists.txt b/recipes/s2n/all/test_package/CMakeLists.txt index 9863eadbdbe6b..2f57c92d6fe12 100644 --- a/recipes/s2n/all/test_package/CMakeLists.txt +++ b/recipes/s2n/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(s2n REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} AWS::s2n) +target_link_libraries(${PROJECT_NAME} PRIVATE AWS::s2n) diff --git a/recipes/s2n/all/test_package/conanfile.py b/recipes/s2n/all/test_package/conanfile.py index 49a3a66ea5bad..0a6bc68712d90 100644 --- a/recipes/s2n/all/test_package/conanfile.py +++ b/recipes/s2n/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/s2n/all/test_v1_package/CMakeLists.txt b/recipes/s2n/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/s2n/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/s2n/all/test_v1_package/conanfile.py b/recipes/s2n/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/s2n/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/s2n/config.yml b/recipes/s2n/config.yml index 611e0f7be0d88..32caa1c5d08da 100644 --- a/recipes/s2n/config.yml +++ b/recipes/s2n/config.yml @@ -1,15 +1,21 @@ versions: - "1.3.31": + "1.5.7": folder: all - "1.3.15": + "1.5.6": + folder: all + "1.5.5": folder: all - "1.3.9": + "1.5.3": folder: all - "1.2.0": + "1.5.2": folder: all - "1.1.1": + "1.5.1": folder: all - "1.1.0": + "1.5.0": folder: all - "1.0.11": + # keep 1.4.16 for aws-sdk-cpp, aws-c-io + "1.4.16": + folder: all + # keep 1.3.15 for aws-sdk-cpp, aws-c-io + "1.3.15": folder: all diff --git a/recipes/safe/all/conandata.yml b/recipes/safe/all/conandata.yml new file mode 100644 index 0000000000000..fb5bd5ef42e56 --- /dev/null +++ b/recipes/safe/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "2.0.0": + url: "https://github.com/LouisCharlesC/safe/archive/v2.0.0.tar.gz" + sha256: "1684c61212d01d1b20db77d17ddd795badc7c1b9feb06ef93ef453c6cb4a1642" + "1.1.1": + url: "https://github.com/LouisCharlesC/safe/archive/v1.1.1.tar.gz" + sha256: "A6E161EAFC32AA522CD2CE1A5F95A3DF963C51263053089FC8F7A9765D054F00" diff --git a/recipes/safe/all/conanfile.py b/recipes/safe/all/conanfile.py new file mode 100644 index 0000000000000..c7c9d401cf1af --- /dev/null +++ b/recipes/safe/all/conanfile.py @@ -0,0 +1,48 @@ +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.51.1" + +class SafeConan(ConanFile): + name = "safe" + description = "Header only read and write locks for mutexes" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/LouisCharlesC/safe" + topics = ("multi-threading ", "lock", "guard", "raii", "thread-safety", "mutexes", "lock-guard", "header-only") + package_type = "header-library" + 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.get_safe("compiler.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="*.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/safe/all/test_package/CMakeLists.txt b/recipes/safe/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..13fdc6eda90ab --- /dev/null +++ b/recipes/safe/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.12) +project(test_package LANGUAGES CXX) + +find_package(safe REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE safe::safe) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/safe/all/test_package/conanfile.py b/recipes/safe/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fb96656f203 --- /dev/null +++ b/recipes/safe/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/safe/all/test_package/test_package.cpp b/recipes/safe/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..9286960794fc7 --- /dev/null +++ b/recipes/safe/all/test_package/test_package.cpp @@ -0,0 +1,12 @@ +#include "safe/safe.h" + +int main(void) { + safe::Safe safeValue; + + { + safe::WriteAccess> value(safeValue); + *value = 5; + } + + return 0; +} diff --git a/recipes/safe/config.yml b/recipes/safe/config.yml new file mode 100644 index 0000000000000..eb4c9584b610a --- /dev/null +++ b/recipes/safe/config.yml @@ -0,0 +1,5 @@ +versions: + "2.0.0": + folder: all + "1.1.1": + folder: all diff --git a/recipes/safeint/all/conandata.yml b/recipes/safeint/all/conandata.yml index 4a9ad7617a715..d7d9da2a8ca9b 100644 --- a/recipes/safeint/all/conandata.yml +++ b/recipes/safeint/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.0.28": + url: "https://github.com/dcleblanc/SafeInt/archive/refs/tags/3.0.28.tar.gz" + sha256: "d6b164bcea92a746e4d44132e505c7ab1816d1089ba99ebc674ccd4b70262ed5" "3.0.27": url: "https://github.com/dcleblanc/SafeInt/archive/refs/tags/3.0.27.tar.gz" sha256: "489abb253514f819adb7e3aab3273b184c484dfe082fbe2166de2fd3a88dfb2b" diff --git a/recipes/safeint/all/conanfile.py b/recipes/safeint/all/conanfile.py index 4130a0caf6073..4684b477dabb7 100644 --- a/recipes/safeint/all/conanfile.py +++ b/recipes/safeint/all/conanfile.py @@ -11,7 +11,8 @@ class SafeintConan(ConanFile): name = "safeint" description = "SafeInt is a class library for C++ that manages integer overflows." license = "MIT" - topics = ("integer", "overflow") + topics = ("integer", "overflow", "header-only") + package_type = "header-library" homepage = "https://github.com/dcleblanc/SafeInt" url = "https://github.com/conan-io/conan-center-index" settings = "os", "arch", "compiler", "build_type" diff --git a/recipes/safeint/config.yml b/recipes/safeint/config.yml index 375ce5296b1af..42f746c8b3d65 100644 --- a/recipes/safeint/config.yml +++ b/recipes/safeint/config.yml @@ -1,4 +1,6 @@ versions: + "3.0.28": + folder: all "3.0.27": folder: all "3.0.26": 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..028d8d21524f6 100644 --- a/recipes/sail/all/conandata.yml +++ b/recipes/sail/all/conandata.yml @@ -1,8 +1,16 @@ sources: - "0.9.0-pre23": - url: "https://github.com/smoked-herring/sail/archive/v0.9.0-pre23.tar.gz" - sha256: "6c5314561fda3d388b4653e7424cdf2ae2c65767e79203576804ca41fc930a6b" -patches: - "0.9.0-pre23": - - patch_file: "patches/0.9.0-pre23-avif-find-package.patch" - base_path: "src" + "0.9.6": + url: "https://github.com/HappySeaFox/sail/archive/v0.9.6.tar.gz" + sha256: "4e46b1a5cd0e23f78fbeef085340779c9d4a7d5dd731ffd1df8fdfb343befbc4" + "0.9.5": + url: "https://github.com/HappySeaFox/sail/archive/v0.9.5.tar.gz" + sha256: "28c601c0399be1940710afc150b5836f8b3f5f6a35b98d7ac1467e62bc568e20" + "0.9.4": + url: "https://github.com/HappySeaFox/sail/archive/v0.9.4.tar.gz" + sha256: "9a8b93c15c4a1afe07c760d2087895a18626034f55917f333aaabe9c9704438f" + "0.9.1": + url: "https://github.com/HappySeaFox/sail/archive/v0.9.1.tar.gz" + sha256: "d02ce889b70d9e237b64806df26b044753e3edf3e87c8af42c32ec9968133a88" + "0.9.0": + url: "https://github.com/HappySeaFox/sail/archive/v0.9.0.tar.gz" + sha256: "892738e0f56fed8c6387e1045bba2bfbf1b095024a495845d4879edb310cd1a7" diff --git a/recipes/sail/all/conanfile.py b/recipes/sail/all/conanfile.py index ad93abfe3ed64..8afbd6f8c8980 100644 --- a/recipes/sail/all/conanfile.py +++ b/recipes/sail/all/conanfile.py @@ -1,12 +1,15 @@ -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 copy, get, rename, 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.53.0" class SAILConan(ConanFile): name = "sail" + package_type = "library" description = "The missing small and fast image decoding library for humans (not for machines)" url = "https://github.com/conan-io/conan-center-index" homepage = "https://sail.software" @@ -17,116 +20,109 @@ class SAILConan(ConanFile): "shared": [True, False], "fPIC": [True, False], "thread_safe": [True, False], - "with_avif": [True, False], - "with_gif": [True, False], - "with_jpeg2000": [True, False], - "with_jpeg": [True, False], - "with_png": [True, False], - "with_tiff": [True, False], - "with_webp": [True, False], + "with_highest_priority_codecs": [True, False], + "with_high_priority_codecs": [True, False], + "with_medium_priority_codecs": [True, False], + "with_low_priority_codecs": [True, False], + "with_lowest_priority_codecs": [True, False], } default_options = { "shared": False, "fPIC": True, "thread_safe": True, - "with_avif": True, - "with_gif": True, - "with_jpeg2000": True, - "with_jpeg": True, - "with_png": True, - "with_tiff": True, - "with_webp": True, + "with_highest_priority_codecs": True, + "with_high_priority_codecs": True, + "with_medium_priority_codecs": True, + "with_low_priority_codecs": True, + "with_lowest_priority_codecs": True, + } + options_description = { + "with_highest_priority_codecs": "Enable codecs: GIF, JPEG, PNG, TIFF", + "with_high_priority_codecs": "Enable codecs: BMP, SVG", + "with_medium_priority_codecs": "Enable codecs: AVIF, JPEG2000, JPEGXL, WEBL", + "with_low_priority_codecs": "Enable codecs: ICO, PCX, PNM, PSD, QOI, TGA", + "with_lowest_priority_codecs": "Enable codecs: WAL, XBM", } - 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"]) 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") - 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_png: - self.requires("libpng/1.6.37") - if self.options.with_tiff: - self.requires("libtiff/4.3.0") - if self.options.with_webp: - self.requires("libwebp/1.2.2") + if self.options.with_highest_priority_codecs: + self.requires("giflib/5.2.2") + self.requires("libjpeg/9e") + self.requires("libpng/[>=1.6 <2]") + self.requires("libtiff/4.6.0") + if self.options.with_high_priority_codecs: + if Version(self.version) >= "0.9.1": + self.requires("nanosvg/cci.20231025") + if self.options.with_medium_priority_codecs: + self.requires("libavif/1.0.4") + self.requires("jasper/4.2.0") + self.requires("libjxl/0.8.2") + self.requires("libwebp/1.3.2") + + 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") - - 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) - - return cmake + get(self, **self.conan_data["sources"][self.version], + strip_root=True, destination=self.source_folder) + + def generate(self): + only_codecs = [] + + if self.options.with_highest_priority_codecs: + only_codecs.append("highest-priority") + if self.options.with_high_priority_codecs: + only_codecs.append("high-priority") + if self.options.with_medium_priority_codecs: + only_codecs.append("medium-priority") + if self.options.with_low_priority_codecs: + only_codecs.append("low-priority") + if self.options.with_lowest_priority_codecs: + only_codecs.append("lowest-priority") + + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTING"] = False + tc.variables["SAIL_BUILD_APPS"] = False + tc.variables["SAIL_BUILD_EXAMPLES"] = False + tc.variables["SAIL_COMBINE_CODECS"] = True + tc.variables["SAIL_ENABLE_OPENMP"] = False + tc.variables["SAIL_ONLY_CODECS"] = ";".join(only_codecs) + # SVG with nanosvg is supported in >= 0.9.1 + if Version(self.version) < "0.9.1": + tc.variables["SAIL_DISABLE_CODECS"] = "svg" + 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 + tc.cache_variables["CMAKE_TRY_COMPILE_CONFIGURATION"] = str(self.settings.build_type) + 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() + 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")) @@ -151,19 +147,18 @@ def package_info(self): self.cpp_info.components["sail-codecs"].names["cmake_find_package_multi"] = "SailCodecs" self.cpp_info.components["sail-codecs"].libs = ["sail-codecs"] self.cpp_info.components["sail-codecs"].requires = ["sail-common"] - if self.options.with_avif: - self.cpp_info.components["sail-codecs"].requires.append("libavif::libavif") - if self.options.with_gif: + + if self.options.with_highest_priority_codecs: self.cpp_info.components["sail-codecs"].requires.append("giflib::giflib") - 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") - if self.options.with_png: self.cpp_info.components["sail-codecs"].requires.append("libpng::libpng") - if self.options.with_tiff: self.cpp_info.components["sail-codecs"].requires.append("libtiff::libtiff") - if self.options.with_webp: + if Version(self.version) >= "0.9.1": + self.cpp_info.components["sail-codecs"].requires.append("nanosvg::nanosvg") + if self.options.with_medium_priority_codecs: + self.cpp_info.components["sail-codecs"].requires.append("libavif::libavif") + self.cpp_info.components["sail-codecs"].requires.append("jasper::jasper") + self.cpp_info.components["sail-codecs"].requires.append("libjxl::libjxl") self.cpp_info.components["sail-codecs"].requires.append("libwebp::libwebp") self.cpp_info.components["libsail"].set_property("cmake_target_name", "SAIL::Sail") 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/test_package/CMakeLists.txt b/recipes/sail/all/test_package/CMakeLists.txt index 63838b328e8e7..cb86fe79928de 100644 --- a/recipes/sail/all/test_package/CMakeLists.txt +++ b/recipes/sail/all/test_package/CMakeLists.txt @@ -7,17 +7,12 @@ 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_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_link_libraries(test_package_cxx PRIVATE SAIL::SailC++) diff --git a/recipes/sail/all/test_package/conanfile.py b/recipes/sail/all/test_package/conanfile.py index e1256a3fd44fe..fb321506e5e83 100644 --- a/recipes/sail/all/test_package/conanfile.py +++ b/recipes/sail/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", "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 +21,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..59c23fda941fb 100644 --- a/recipes/sail/all/test_package/test_package.c +++ b/recipes/sail/all/test_package/test_package.c @@ -1,26 +1,9 @@ #include - +#include #include -int main(int argc, char *argv[]) -{ - (void)argc; - (void)argv; - +int main() { struct sail_image *image; - - SAIL_TRY_OR_EXECUTE(sail_load_image_from_file(SAIL_DEMO_FILE_PATH, &image), - /* on error */ return 1); - - printf("Size: %ux%u, bytes per line: %u, " - "pixel format: %s, pixels: %p\n", - image->width, - image->height, - image->bytes_per_line, - sail_pixel_format_to_string(image->pixel_format), - image->pixels); - - sail_destroy_image(image); - - return 0; + sail_status_t status = sail_load_from_file("binary-file.bmp", &image); + printf("Error - file not found generate: status %d\n", status); } diff --git a/recipes/sail/all/test_package/test_package.cpp b/recipes/sail/all/test_package/test_package.cpp index efad1f9a8c2e3..918cafc9fb33d 100644 --- a/recipes/sail/all/test_package/test_package.cpp +++ b/recipes/sail/all/test_package/test_package.cpp @@ -4,25 +4,13 @@ int main(int argc, char *argv[]) { - (void)argc; - (void)argv; - - const sail::image image(SAIL_DEMO_FILE_PATH); - - if (!image.is_valid()) { - return 1; + const char* filename = "my-binary.bmp"; + try { + const sail::image image(filename); + std::cout << "Size: " << image.width() << std::endl; // Never reached + } catch (const std::exception& e) { + std::cerr << "Error - file not found generate: " << e.what() << std::endl; } - std::cout - << "Size: " - << image.width() << 'x' << image.height() - << ", bytes per line: " - << image.bytes_per_line() - << ", pixel format: " - << sail::image::pixel_format_to_string(image.pixel_format()) - << ", pixels: " - << image.pixels() - << std::endl; - return 0; } 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/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..750e4f96fe594 100644 --- a/recipes/sail/config.yml +++ b/recipes/sail/config.yml @@ -1,3 +1,11 @@ versions: - "0.9.0-pre23": + "0.9.6": + folder: all + "0.9.5": + folder: all + "0.9.4": + folder: all + "0.9.1": + folder: all + "0.9.0": folder: all diff --git a/recipes/samurai/all/conandata.yml b/recipes/samurai/all/conandata.yml new file mode 100644 index 0000000000000..39739edcf25df --- /dev/null +++ b/recipes/samurai/all/conandata.yml @@ -0,0 +1,25 @@ +sources: + "0.16.0": + url: "https://github.com/hpc-maths/samurai/archive/v0.16.0.tar.gz" + sha256: "61616de42557e5cd5e9483103fd640f94f3235354e42a22a0ec76520196059a5" + "0.13.0": + url: "https://github.com/hpc-maths/samurai/archive/v0.13.0.tar.gz" + sha256: "f38e379218b1206fc5c5e157ee5e80687721a896f70b892623d9f30280529448" + "0.9.0": + url: "https://github.com/hpc-maths/samurai/archive/v0.9.0.tar.gz" + sha256: "49f94a7451b1b50cab335a62e294e612fea27cbf5b131827eb69a8e228ad8010" + "0.8.0": + url: "https://github.com/hpc-maths/samurai/archive/v0.8.0.tar.gz" + sha256: "c20c4cdcc7c5a29d6f44369d5b1addee4237b8282b5cce88be4113367d90d82d" + "0.7.0": + url: "https://github.com/hpc-maths/samurai/archive/v0.7.0.tar.gz" + sha256: "159dea32bdce95ddc6bc62c202e60754407d4e5e910d0a382c2030410fe2e729" + "0.6.0": + url: "https://github.com/hpc-maths/samurai/archive/v0.6.0.tar.gz" + sha256: "bab96adac8e1553b79678a22de2248bec67c7c205b5fd35e9e1aaccaca41286e" + "0.3.0": + url: "https://github.com/hpc-maths/samurai/archive/v0.3.0.tar.gz" + sha256: "5e6313d92fa2cd23941192c74014749acfcfbcfd5fdc1601cb3c9f4d151c7f4e" + "0.2.0": + url: "https://github.com/hpc-maths/samurai/archive/v0.2.0.tar.gz" + sha256: "2cc885211fcee2582d9219588d474071c1fa75d52fc43d976f538d739ad71b48" diff --git a/recipes/samurai/all/conanfile.py b/recipes/samurai/all/conanfile.py new file mode 100644 index 0000000000000..3667d0c5edfed --- /dev/null +++ b/recipes/samurai/all/conanfile.py @@ -0,0 +1,75 @@ +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 = "samurai" + description = "Intervals coupled with algebra of set to handle adaptive mesh refinement and operators on it" + license = "BSD-3-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/hpc-maths/samurai" + topics = ("scientific computing", "adaptive mesh refinement", "header-only") + package_type = "header-library" + 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.9", + "msvc": "192", + "gcc": "12", + "clang": "13", + "apple-clang": "14", + } + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("cli11/2.3.2") + self.requires("fmt/10.1.1") + self.requires("highfive/2.7.1") + self.requires("pugixml/1.14") + self.requires("xsimd/13.0.0") + self.requires("xtensor/0.24.7") + + 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/samurai/all/test_package/CMakeLists.txt b/recipes/samurai/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..533cf0729a819 --- /dev/null +++ b/recipes/samurai/all/test_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(samurai REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) + +target_link_libraries(${PROJECT_NAME} PRIVATE samurai::samurai) + +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/samurai/all/test_package/conanfile.py b/recipes/samurai/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/samurai/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/samurai/all/test_package/test_package.cpp b/recipes/samurai/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..378797846ff9e --- /dev/null +++ b/recipes/samurai/all/test_package/test_package.cpp @@ -0,0 +1,13 @@ +#include +#include + +int main(void) +{ + constexpr std::size_t dim = 2; + using Config = samurai::UniformConfig; + + samurai::Box box({-1}, {1}); + samurai::UniformMesh umesh{box, 10}; + + return EXIT_SUCCESS; +} diff --git a/recipes/samurai/config.yml b/recipes/samurai/config.yml new file mode 100644 index 0000000000000..87628f14bd6dd --- /dev/null +++ b/recipes/samurai/config.yml @@ -0,0 +1,17 @@ +versions: + "0.16.0": + folder: all + "0.13.0": + folder: all + "0.9.0": + folder: all + "0.8.0": + folder: all + "0.7.0": + folder: all + "0.6.0": + folder: all + "0.3.0": + folder: all + "0.2.0": + folder: all diff --git a/recipes/sassc/all/conandata.yml b/recipes/sassc/all/conandata.yml index 5119b677bea74..23ccaaba2c88a 100644 --- a/recipes/sassc/all/conandata.yml +++ b/recipes/sassc/all/conandata.yml @@ -2,6 +2,3 @@ sources: "3.6.2": url: "https://github.com/sass/sassc/archive/3.6.2.tar.gz" sha256: "608dc9002b45a91d11ed59e352469ecc05e4f58fc1259fc9a9f5b8f0f8348a03" - "3.6.1": - sha256: 8cee391c49a102b4464f86fc40c4ceac3a2ada52a89c4c933d8348e3e4542a60 - url: https://github.com/sass/sassc/archive/3.6.1.tar.gz diff --git a/recipes/sassc/all/conanfile.py b/recipes/sassc/all/conanfile.py index b9452a96ffc40..4aed7995e790a 100644 --- a/recipes/sassc/all/conanfile.py +++ b/recipes/sassc/all/conanfile.py @@ -1,91 +1,138 @@ +import os + 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 +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import chdir, copy, get, replace_in_file, save +from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps +from conan.tools.layout import basic_layout +from conan.tools.microsoft import MSBuild, is_msvc, MSBuildToolchain, MSBuildDeps -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.53.0" class SasscConan(ConanFile): name = "sassc" + description = "libsass command line driver" license = "MIT" - homepage = "https://sass-lang.com/libsass" url = "https://github.com/conan-io/conan-center-index" - description = "libsass command line driver" - topics = ("Sass", "sassc", "compiler") - settings = "os", "compiler", "build_type", "arch" - generators = "visual_studio" - - _autotools = None + homepage = "https://sass-lang.com/libsass" + topics = ("Sass", "compiler") - @property - def _source_subfolder(self): - return "source_subfolder" + package_type = "application" + settings = "os", "arch", "compiler", "build_type" def config_options(self): - 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 requirements(self): + self.requires("libsass/3.6.5") 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.5") + raise ConanInvalidConfiguration( + "sassc supports only Linux, FreeBSD, Macos and Windows Visual Studio at this time," + " contributions are welcomed" + ) def build_requirements(self): if not is_msvc(self): self.tool_requires("libtool/2.4.7") 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 _msbuild_configuration(self): + return "Debug" if self.settings.build_type == "Debug" else "Release" + + @property + def _msbuild_platform(self): + return "Win32" if self.settings.arch == "x86" else "Win64" + + def generate(self): + if is_msvc(self): + tc = MSBuildToolchain(self) + tc.configuration = self._msbuild_configuration + tc.platform = self._msbuild_platform + # FIXME: setting this property does not work, applied as a patch instead + # tc.properties["LIBSASS_DIR"] = self.dependencies["libsass"].package_folder + tc.generate() + deps = MSBuildDeps(self) + deps.configuration = self._msbuild_configuration + deps.generate() + else: + env = VirtualBuildEnv(self) + env.generate() + tc = AutotoolsToolchain(self) + tc.configure_args += ["--disable-tests"] + tc.generate() + deps = AutotoolsDeps(self) + deps.generate() def _patch_sources(self): - 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")) - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self) - self._autotools.configure(args=["--disable-tests"]) - return self._autotools - - def _build_msbuild(self): - msbuild = MSBuild(self) - platforms = { - "x86": "Win32", - "x86_64": "Win64" - } - msbuild.build("win/sassc.sln", platforms=platforms) + 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'' + vcxproj_file = os.path.join(self.source_folder, "win", "sassc.vcxproj") + for existing_toolset in ["v120", "v140", "v141", "v142", "v143"]: + replace_in_file(self, vcxproj_file, + f"{existing_toolset}", + f"{platform_toolset}", strict=False) + # Inject VS 2022 support + replace_in_file(self, vcxproj_file, + '\n' + f' {platform_toolset}\n' + '\n' + '..\\..', + f"{self.dependencies['libsass'].package_folder}") + replace_in_file(self, vcxproj_file, r'', "") + if props_path: + replace_in_file(self, vcxproj_file, + r'', + rf'{import_conan_generators}') def build(self): self._patch_sources() - with chdir(self, self._source_subfolder): + with chdir(self, self.source_folder): if is_msvc(self): - self._build_msbuild() + msbuild = MSBuild(self) + msbuild.build_type = self._msbuild_configuration + msbuild.platform = self._msbuild_platform + msbuild.build(sln=os.path.join("win", "sassc.sln")) else: - self.run("{} -fiv".format(tools.get_env("AUTORECONF")), run_environment=True) save(self, path="VERSION", content=f"{self.version}") - autotools = self._configure_autotools() + autotools = Autotools(self) + autotools.autoreconf() + autotools.configure() autotools.make() def package(self): - with chdir(self, self._source_subfolder): + with chdir(self, self.source_folder): if is_msvc(self): - self.copy("*.exe", dst="bin", src=os.path.join(self._source_subfolder, "bin"), keep_path=False) + copy(self, "*.exe", + dst=os.path.join(self.package_folder, "bin"), + src=os.path.join(self.source_folder, "bin"), + keep_path=False) else: - autotools = self._configure_autotools() + autotools = Autotools(self) 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")) def package_info(self): self.cpp_info.frameworkdirs = [] @@ -93,6 +140,6 @@ def package_info(self): 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 + bin_folder = os.path.join(self.package_folder, "bin") self.env_info.PATH.append(bin_folder) diff --git a/recipes/sassc/all/test_package/conanfile.py b/recipes/sassc/all/test_package/conanfile.py index 70d62ab9bfc61..cad02af78d9e1 100644 --- a/recipes/sassc/all/test_package/conanfile.py +++ b/recipes/sassc/all/test_package/conanfile.py @@ -1,9 +1,13 @@ -from conans import ConanFile, tools +from conan import ConanFile -class LibsassTestConan(ConanFile): - settings = "os", "compiler", "build_type", "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("sassc --version", run_environment=True) + self.run("sassc --version") diff --git a/recipes/sassc/all/test_v1_package/conanfile.py b/recipes/sassc/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..70d62ab9bfc61 --- /dev/null +++ b/recipes/sassc/all/test_v1_package/conanfile.py @@ -0,0 +1,9 @@ +from conans import ConanFile, tools + + +class LibsassTestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + + def test(self): + if not tools.cross_building(self): + self.run("sassc --version", run_environment=True) diff --git a/recipes/sassc/config.yml b/recipes/sassc/config.yml index bfe5b909d834d..4c410b4e03fe2 100644 --- a/recipes/sassc/config.yml +++ b/recipes/sassc/config.yml @@ -1,5 +1,3 @@ versions: "3.6.2": folder: all - "3.6.1": - folder: all diff --git a/recipes/sbepp/all/cmake/sbeppcTargets.cmake b/recipes/sbepp/all/cmake/sbeppcTargets.cmake new file mode 100644 index 0000000000000..826e03f948da8 --- /dev/null +++ b/recipes/sbepp/all/cmake/sbeppcTargets.cmake @@ -0,0 +1,34 @@ +# mimicking flatbuffers/all/cmake/FlatcTargets.cmake +if(NOT TARGET sbepp::sbeppc) + if(CMAKE_CROSSCOMPILING) + find_program(SBEPP_SBEPPC_EXECUTABLE + NAMES sbeppc + PATHS ENV PATH + NO_DEFAULT_PATH + ) + else() + find_program(SBEPP_SBEPPC_EXECUTABLE + NAMES sbeppc + PATHS "${CMAKE_CURRENT_LIST_DIR}/../../bin/" + NO_DEFAULT_PATH + ) + endif() + # TODO: In conan v2 with CMakeToolchain, can be replaced by: + # find_program(SBEPP_SBEPPC_EXECUTABLE NAMES sbeppc) + # # Nice enough to handle sbeppc not in build_requires for native build + # if(NOT SBEPP_SBEPPC_EXECUTABLE AND NOT CMAKE_CROSSCOMPILING) + # find_program(SBEPP_SBEPPC_EXECUTABLE + # NAMES flatc + # PATHS "${CMAKE_CURRENT_LIST_DIR}/../../bin/" + # NO_DEFAULT_PATH + # ) + # endif() + + if(SBEPP_SBEPPC_EXECUTABLE) + get_filename_component( + SBEPP_SBEPPC_EXECUTABLE "${SBEPP_SBEPPC_EXECUTABLE}" ABSOLUTE) + add_executable(sbepp::sbeppc IMPORTED) + set_property(TARGET sbepp::sbeppc + PROPERTY IMPORTED_LOCATION ${SBEPP_SBEPPC_EXECUTABLE}) + endif() +endif() diff --git a/recipes/sbepp/all/conandata.yml b/recipes/sbepp/all/conandata.yml new file mode 100644 index 0000000000000..7006e2b3c44d3 --- /dev/null +++ b/recipes/sbepp/all/conandata.yml @@ -0,0 +1,22 @@ +sources: + "1.4.2": + url: "https://github.com/OleksandrKvl/sbepp/archive/refs/tags/1.4.2.tar.gz" + sha256: "4af544262cd447f0fad45db850ab82b3318ff75e47dbdbdd5150437ca7d523c5" + "1.4.1": + url: "https://github.com/OleksandrKvl/sbepp/archive/refs/tags/1.4.1.tar.gz" + sha256: "1e5913372e3f4871a7aa3d8ac94759cdcc9df61a3865ce99944f74cc0672795d" + "1.4.0": + url: "https://github.com/OleksandrKvl/sbepp/archive/refs/tags/1.4.0.tar.gz" + sha256: "64112ed22d6c82debc70a4c097f3fcd05a4bd280dca7e2013edbd6bebfd1da56" + "1.3.0": + url: "https://github.com/OleksandrKvl/sbepp/archive/refs/tags/1.3.0.tar.gz" + sha256: "44caa61681c7f94c840a2f2a247a0385e9e61c6e8639b9f7561c9d62125f9486" + "1.2.0": + url: "https://github.com/OleksandrKvl/sbepp/archive/refs/tags/1.2.0.tar.gz" + sha256: "068cb8bc940316f8817af8da5c8de577ab49281308b2125c30f2f4e00431a68a" + "1.1.0": + url: "https://github.com/OleksandrKvl/sbepp/archive/refs/tags/1.1.0.tar.gz" + sha256: "a5787c7204a2509c8d1eb6c65f0143020d7c7ceadd4a53d2cb9a64dc4f6b9e9a" + "1.0.1": + url: "https://github.com/OleksandrKvl/sbepp/archive/refs/tags/1.0.1.tar.gz" + sha256: "c8ee54df0ae670bd7508a48947da6c6987eeb72481f1ab8cc05b8d4d03aaec8b" diff --git a/recipes/sbepp/all/conanfile.py b/recipes/sbepp/all/conanfile.py new file mode 100644 index 0000000000000..85e391e2ff327 --- /dev/null +++ b/recipes/sbepp/all/conanfile.py @@ -0,0 +1,136 @@ +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 PackageConan(ConanFile): + name = "sbepp" + description = "C++ implementation of the FIX Simple Binary Encoding" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/OleksandrKvl/sbepp" + topics = ("trading", "fix", "sbe") + settings = "os", "arch", "compiler", "build_type" + options = { + "with_sbeppc": [True, False] + } + default_options = { + "with_sbeppc": True + } + + @property + def _min_cppstd(self): + if self.options.with_sbeppc: + return 17 + else: + return 11 + + @property + def _compilers_minimum_version(self): + if self.options.with_sbeppc: + return { + "gcc": "8", + "clang": "9", + "apple-clang": "11" + } + else: + return { + "gcc": "4.8.1", + "clang": "3.3", + "apple-clang": "9.4" + } + + def export_sources(self): + copy(self, os.path.join("cmake", "sbeppcTargets.cmake"), + self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) + + def layout(self): + cmake_layout(self, src_folder="src") + + def package_id(self): + if not self.info.options.with_sbeppc: + self.info.clear() + else: + del self.info.settings.compiler + + def requirements(self): + if self.options.with_sbeppc: + # sbepp/<1.1.0 requires fmt and pugixml with hardcoded versions + if Version(self.version) < "1.1.0": + self.requires("fmt/9.1.0") + self.requires("pugixml/1.12.1") + else: + self.requires("fmt/10.2.0") + self.requires("pugixml/1.14") + + def validate(self): + 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." + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + if not self.options.with_sbeppc: + tc.variables["SBEPP_BUILD_SBEPPC"] = False + + tc.generate() + + if self.options.with_sbeppc: + tc = CMakeDeps(self) + 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")) + copy(self, "sbeppcTargets.cmake", + src=os.path.join(self.source_folder, os.pardir, "cmake"), + dst=os.path.join(self.package_folder, self._module_path)) + if Version(self.version) >= "1.2.0": + copy(self, "sbeppcHelpers.cmake", + src=os.path.join(self.source_folder, "cmake"), + dst=os.path.join(self.package_folder, self._module_path)) + + @property + def _module_path(self): + return os.path.join("lib", "cmake") + + def package_info(self): + # provide sbepp::sbeppc target and CMake helpers from sbeppcHelpers.cmake + build_modules = [ + os.path.join(self._module_path, "sbeppcTargets.cmake") + ] + if Version(self.version) >= "1.2.0": + build_modules.append(os.path.join(self._module_path, "sbeppcHelpers.cmake")) + + self.cpp_info.builddirs.append(self._module_path) + self.cpp_info.set_property("cmake_build_modules", build_modules) + + # TODO: to remove in conan v2 + if self.options.with_sbeppc: + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/sbepp/all/test_package/CMakeLists.txt b/recipes/sbepp/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..de42d2a9dbead --- /dev/null +++ b/recipes/sbepp/all/test_package/CMakeLists.txt @@ -0,0 +1,49 @@ +cmake_minimum_required(VERSION 3.15) + +project(test_package CXX) + +find_package(sbepp REQUIRED CONFIG) + +# test `sbepp::sbeppc` executable +if(TARGET sbepp::sbeppc) + set(sbeppc_test_name "test_sbeppc") + set(schema "test_schema") + set(schema_path "${CMAKE_CURRENT_LIST_DIR}/${schema}.xml") + + add_executable(${sbeppc_test_name}) + target_sources(${sbeppc_test_name} PRIVATE test_sbeppc.cpp) + target_compile_features(${sbeppc_test_name} PRIVATE cxx_std_11) + + # `sbeppc_compile_schema` was introduced only in `1.2.0` + if(SBEPP_VERSION VERSION_GREATER_EQUAL "1.2.0") + sbeppc_compile_schema( + TARGET_NAME compiled_schema + SCHEMA_FILE "${schema_path}" + ) + + target_link_libraries(${sbeppc_test_name} PRIVATE compiled_schema) + else() + set(output_file "${CMAKE_CURRENT_BINARY_DIR}/${schema}/${schema}.hpp") + + add_custom_command( + OUTPUT "${output_file}" + COMMAND $ "${schema_path}" + DEPENDS "${schema_path}" + ) + + add_custom_target(compile_schema DEPENDS "${output_file}") + add_dependencies(${sbeppc_test_name} compile_schema) + target_include_directories(${sbeppc_test_name} + SYSTEM PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}" + ) + + target_link_libraries(${sbeppc_test_name} PRIVATE sbepp::sbepp) + endif() +endif() + +# test `sbepp::sbepp` header-only library +add_executable(${PROJECT_NAME}) +target_sources(${PROJECT_NAME} PRIVATE test_sbepp.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE sbepp::sbepp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/sbepp/all/test_package/conanfile.py b/recipes/sbepp/all/test_package/conanfile.py new file mode 100644 index 0000000000000..f673d7c44446b --- /dev/null +++ b/recipes/sbepp/all/test_package/conanfile.py @@ -0,0 +1,32 @@ +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", "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["SBEPP_VERSION"] = self.dependencies["sbepp"].ref.version + 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/sbepp/all/test_package/test_sbepp.cpp b/recipes/sbepp/all/test_package/test_sbepp.cpp new file mode 100644 index 0000000000000..8d76c1e4c80fb --- /dev/null +++ b/recipes/sbepp/all/test_package/test_sbepp.cpp @@ -0,0 +1,16 @@ +#include + +#include + +enum class Enum +{ + A, + B +}; + +int main() +{ + auto underlying = sbepp::to_underlying(Enum::A); + + return EXIT_SUCCESS; +} diff --git a/recipes/sbepp/all/test_package/test_sbeppc.cpp b/recipes/sbepp/all/test_package/test_sbeppc.cpp new file mode 100644 index 0000000000000..a2cc1c925f8a5 --- /dev/null +++ b/recipes/sbepp/all/test_package/test_sbeppc.cpp @@ -0,0 +1,12 @@ +#include + +#include +#include + +int main(void) +{ + std::array buf{}; + auto msg = sbepp::make_view( + buf.data(), buf.size()); + return EXIT_SUCCESS; +} diff --git a/recipes/sbepp/all/test_package/test_schema.xml b/recipes/sbepp/all/test_package/test_schema.xml new file mode 100644 index 0000000000000..e3d30c765baa7 --- /dev/null +++ b/recipes/sbepp/all/test_package/test_schema.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/recipes/sbepp/all/test_v1_package/CMakeLists.txt b/recipes/sbepp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/sbepp/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/sbepp/all/test_v1_package/conanfile.py b/recipes/sbepp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..f15a1e8fcf232 --- /dev/null +++ b/recipes/sbepp/all/test_v1_package/conanfile.py @@ -0,0 +1,25 @@ +from conans import ConanFile, CMake +from conan.tools.cmake import CMakeToolchain +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 generate(self): + tc = CMakeToolchain(self) + tc.variables["SBEPP_VERSION"] = self.deps_cpp_info["sbepp"].version + tc.generate() + + 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/sbepp/config.yml b/recipes/sbepp/config.yml new file mode 100644 index 0000000000000..548ae00c17fa2 --- /dev/null +++ b/recipes/sbepp/config.yml @@ -0,0 +1,15 @@ +versions: + "1.4.2": + folder: all + "1.4.1": + folder: all + "1.4.0": + folder: all + "1.3.0": + folder: all + "1.2.0": + folder: all + "1.1.0": + folder: all + "1.0.1": + folder: all diff --git a/recipes/sbp/all/CMakeLists.txt b/recipes/sbp/all/CMakeLists.txt deleted file mode 100644 index 454b398b885e5..0000000000000 --- a/recipes/sbp/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/c") diff --git a/recipes/sbp/all/conandata.yml b/recipes/sbp/all/conandata.yml index f640026c27acb..517606eaacf88 100644 --- a/recipes/sbp/all/conandata.yml +++ b/recipes/sbp/all/conandata.yml @@ -1,15 +1,29 @@ sources: - "3.4.10": + "5.0.4": cmake: - url: "https://github.com/swift-nav/cmake/archive/373d4fcafbbc0c208dc9ecb278d36ed8c9448eda.zip" - sha256: 6077d2a754d013e3cb9826f589e47b19ab01f4d91ede4f5bfc14db74bc5dc894 + url: "https://github.com/swift-nav/cmake/archive/954e6cebe4c902d07d33beef166df89073a7b4f2.zip" + sha256: "910e14e35d02fd766bc885cfc9b99626006c12ef26d6446cfbf728862d7cebab" source: - url: "https://github.com/swift-nav/libsbp/archive/refs/tags/v3.4.10.tar.gz" - sha256: f2fb738f49112b25e7849ca0c75415159127e9b5373b13e7027362b8fa0b1224 + url: "https://github.com/swift-nav/libsbp/archive/refs/tags/v5.0.4.tar.gz" + sha256: "0b51707780dec08f24fac091b935e041d0d61abf2093562df829e85b9510d72b" + "4.15.0": + cmake: + url: "https://github.com/swift-nav/cmake/archive/12b7f037e7cc721a9a36c7342ba2ca2b0cafc01e.zip" + sha256: "6a725914bf8c3ed13065812cf4d7b0a69e478eaa150561e0e3be4cd01bf3798f" + source: + url: "https://github.com/swift-nav/libsbp/archive/refs/tags/v4.15.0.tar.gz" + sha256: "e71fd7dd5536058d6b93ade443913e68da7b4f1896aa720dc369baab1864e9e9" "4.2.0": cmake: url: "https://github.com/swift-nav/cmake/archive/31604e72e72c09fa32effdbc37acc79dda7c99d7.zip" - sha256: 22e0ef6915ad5accfa6c0b30cb75a7d409ee1e08746f5ee92311015aa3826246 + sha256: "22e0ef6915ad5accfa6c0b30cb75a7d409ee1e08746f5ee92311015aa3826246" source: url: "https://github.com/swift-nav/libsbp/archive/refs/tags/v4.2.0.tar.gz" - sha256: 9ee9808394867405938505fb0aa52ffeb8d98b7ce222e47629ffabdc9e23d3e4 + sha256: "9ee9808394867405938505fb0aa52ffeb8d98b7ce222e47629ffabdc9e23d3e4" + "3.4.10": + cmake: + url: "https://github.com/swift-nav/cmake/archive/373d4fcafbbc0c208dc9ecb278d36ed8c9448eda.zip" + sha256: "6077d2a754d013e3cb9826f589e47b19ab01f4d91ede4f5bfc14db74bc5dc894" + source: + url: "https://github.com/swift-nav/libsbp/archive/refs/tags/v3.4.10.tar.gz" + sha256: "f2fb738f49112b25e7849ca0c75415159127e9b5373b13e7027362b8fa0b1224" diff --git a/recipes/sbp/all/conanfile.py b/recipes/sbp/all/conanfile.py index 77edf2fd79a3e..b94c371fc9b5b 100644 --- a/recipes/sbp/all/conanfile.py +++ b/recipes/sbp/all/conanfile.py @@ -1,27 +1,30 @@ import os -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 get, copy + +required_conan_version = ">=1.53.0" class SbpConan(ConanFile): name = "sbp" + description = "Swift Binary Protocol client library" license = "MIT" - homepage = "https://github.com/swift-nav/libsbp" url = "https://github.com/conan-io/conan-center-index" - description = "Swift Binary Protocol client library" + homepage = "https://github.com/swift-nav/libsbp" topics = ("gnss",) - 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", "c" - - _cmake = None - - @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, + } def config_options(self): if self.settings.os == "Windows": @@ -29,41 +32,46 @@ 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 validate(self): if self.settings.os == "Windows" and self.options.shared: - raise ConanInvalidConfiguration("Windows shared builds are not supported right now, see issue https://github.com/swift-nav/libsbp/issues/1062") + raise ConanInvalidConfiguration( + "Windows shared builds are not supported right now, " + "see issue https://github.com/swift-nav/libsbp/issues/1062" + ) + + def layout(self): + cmake_layout(self, src_folder="src") def source(self): data = self.conan_data["sources"][self.version] + get(self, **data["source"], strip_root=True) + get(self, **data["cmake"], strip_root=True, destination=os.path.join("c", "cmake", "common")) - tools.get(**data["source"], strip_root=True, destination=self._source_subfolder) - tools.get(**data["cmake"], strip_root=True, destination=os.path.join(self._source_subfolder, "c", "cmake", "common")) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - - self._cmake = CMake(self) - self._cmake.definitions["libsbp_ENABLE_TESTS"] = False - self._cmake.definitions["libsbp_ENABLE_DOCS"] = False - self._cmake.configure() - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["libsbp_ENABLE_TESTS"] = False + tc.variables["libsbp_ENABLE_DOCS"] = False + tc.generate() + tc = CMakeDeps(self) + tc.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder="c") cmake.build() def package(self): - self.copy( - "LICENSE", - src=self._source_subfolder, - dst="licenses", - ignore_case=True, - keep_path=False, + copy( + self, + pattern="LICENSE", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder, ) - cmake = self._configure_cmake() + cmake = CMake(self) cmake.install() def package_info(self): diff --git a/recipes/sbp/all/test_package/CMakeLists.txt b/recipes/sbp/all/test_package/CMakeLists.txt index d9693fa5cada2..6da47266b9454 100644 --- a/recipes/sbp/all/test_package/CMakeLists.txt +++ b/recipes/sbp/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.15) +project(test_package LANGUAGES C) find_package(sbp REQUIRED CONFIG) diff --git a/recipes/sbp/all/test_package/conanfile.py b/recipes/sbp/all/test_package/conanfile.py index 38f4483872d47..ef5d7042163ec 100644 --- a/recipes/sbp/all/test_package/conanfile.py +++ b/recipes/sbp/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/sbp/config.yml b/recipes/sbp/config.yml index 84cd65924d4fb..e2fec4a93304d 100644 --- a/recipes/sbp/config.yml +++ b/recipes/sbp/config.yml @@ -1,5 +1,9 @@ versions: - "3.4.10": + "5.0.4": + folder: "all" + "4.15.0": folder: "all" "4.2.0": folder: "all" + "3.4.10": + folder: "all" diff --git a/recipes/scc/all/CMakeLists.txt b/recipes/scc/all/CMakeLists.txt deleted file mode 100644 index 19bdb7e7f5fb7..0000000000000 --- a/recipes/scc/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(scc C) - -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS KEEP_RPATHS) - -add_subdirectory(source_subfolder) diff --git a/recipes/scc/all/conandata.yml b/recipes/scc/all/conandata.yml index bd7433056072d..a492e239a4b1c 100644 --- a/recipes/scc/all/conandata.yml +++ b/recipes/scc/all/conandata.yml @@ -1,4 +1,13 @@ sources: - "2022.08": - url: "https://github.com/Minres/SystemC-Components/releases/download/2022.08/systemc-components.tar.gz" - sha256: "825dfc38e7b00df34330f01ba38f5913e1a88c5002344e433b972faf0e6c4501" + "2023.06": + url: "https://github.com/Minres/SystemC-Components/releases/download/2023.06/SCC-2023.06-full.tar.gz" + sha256: "6d1a842f474daa512030d61526e83182f9289b977a3a7cb88ed151050c33c4e9" +patches: + "2023.06": + - patch_file: "patches/2023.06-fix-conan-targets.patch" + patch_description: "add find_package()-s and disable automatic Conan setup" + patch_type: "conan" + - patch_file: "patches/2023.06-add-fmt-10-support.patch" + patch_description: "fix incompatibility with fmt 10.x and newer" + patch_type: "portability" + patch_source: "https://github.com/Minres/SystemC-Components/pull/51" diff --git a/recipes/scc/all/conanfile.py b/recipes/scc/all/conanfile.py index c95474718f1dd..5f82f6e023588 100644 --- a/recipes/scc/all/conanfile.py +++ b/recipes/scc/all/conanfile.py @@ -1,89 +1,166 @@ +import os + from conan import ConanFile -from conan.tools.scm import Version -from conan.tools.files import get -from conans import tools, CMake from conan.errors import ConanInvalidConfiguration -import functools +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, CMakeDeps +from conan.tools.files import copy, get, export_conandata_patches, apply_conandata_patches, replace_in_file, rmdir +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" -required_conan_version = ">=1.50.0" class SystemcComponentsConan(ConanFile): name = "scc" - description = """A light weight productivity library for SystemC and TLM 2.0""" - homepage = "https://minres.github.io/SystemC-Components" - url = "https://github.com/conan-io/conan-center-index" + description = "A light-weight productivity library for SystemC and TLM 2.0" license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://minres.github.io/SystemC-Components" topics = ("systemc", "modeling", "tlm", "scc") - settings = "os", "compiler", "build_type", "arch" + + package_type = "static-library" + settings = "os", "arch", "compiler", "build_type" options = { "fPIC": [True, False], "enable_phase_callbacks": [True, False], - "enable_phase_callbacks_tracing": [True, False] + "enable_phase_callbacks_tracing": [True, False], } default_options = { "fPIC": True, "enable_phase_callbacks": False, - "enable_phase_callbacks_tracing": False + "enable_phase_callbacks_tracing": False, } - generators = "cmake" - - @property - def _source_subfolder(self): - return "source_subfolder" - @property - def _build_subfolder(self): - return "build_subfolder" - - # no exports_sources attribute, but export_sources(self) method instead - # this allows finer grain exportation of patches per version def export_sources(self): - self.copy("CMakeLists.txt") - + 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): + # https://github.com/Minres/SystemC-Components/blob/2023.06/src/sysc/scc/perf_estimator.h#L20 + self.requires("boost/1.83.0", transitive_headers=True, transitive_libs=True) + # https://github.com/Minres/SystemC-Components/blob/2023.06/src/sysc/scc/trace/vcd_trace.hh#L28 + self.requires("fmt/10.2.1", transitive_headers=True, transitive_libs=True) + # https://github.com/Minres/SystemC-Components/blob/2023.06/src/common/util/lz4_streambuf.h#L13 + self.requires("lz4/1.9.4", transitive_headers=True, transitive_libs=True) + self.requires("rapidjson/cci.20220822") + self.requires("spdlog/1.13.0") + # https://github.com/Minres/SystemC-Components/blob/2023.06/src/sysc/tlm/scc/lwtr/tlm2_lwtr.h + self.requires("systemc-cci/1.0.0", transitive_headers=True, transitive_libs=True) + self.requires("systemc/2.3.4", transitive_headers=True, transitive_libs=True) + # https://github.com/Minres/SystemC-Components/blob/2023.06/src/sysc/scc/trace/gz_writer.hh#L18 + self.requires("zlib/[>=1.2.11 <2]", transitive_headers=True, transitive_libs=True) + self.requires("yaml-cpp/0.8.0") + def validate(self): + if is_apple_os(self): + raise ConanInvalidConfiguration(f"{self.name} is not supported on {self.settings.os}.") + if is_msvc(self): + # Fails with + # src\sysc\tlm\scc\tlm_mm.h(116,114): error C2259: 'tlm::scc::tlm_gp_mm_t<16,false>': cannot instantiate abstract class + # (compiling source file '../../../src/src/sysc/tlm/scc/lwtr/tlm2_lwtr.cpp') + # src\sysc\tlm\scc\tlm_mm.h(116,48): + # see declaration of 'tlm::scc::tlm_gp_mm_t<16,false>' + # src\sysc\tlm\scc\tlm_mm.h(116,114): + # due to following members: + # src\sysc\tlm\scc\tlm_mm.h(116,114): + # 'void tlm::tlm_extension::copy_from(const tlm::tlm_extension_base &)': is abstract + # systemc-2.3.4\p\include\tlm_core\tlm_2\tlm_generic_payload\tlm_gp.h(78,18): + # see declaration of 'tlm::tlm_extension::copy_from' + # and + # src\sysc\tlm\scc\tlm_mm.h(31,20): error C2061: syntax error: identifier '__attribute__' + raise ConanInvalidConfiguration(f"{self.ref} recipe is not supported on MSVC. Contributions are welcome!") if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) - if self.settings.os == "Macos": - raise ConanInvalidConfiguration(f"{self.name} is not suppported on {self.settings.os}.") + check_min_cppstd(self, 11) if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "7": raise ConanInvalidConfiguration("GCC < version 7 is not supported") - def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - def build_requirements(self): - self.tool_requires("cmake/3.24.0") + self.tool_requires("cmake/[>=3.24 <4]") - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["SC_WITH_PHASE_CALLBACKS"] = self.options.enable_phase_callbacks - cmake.definitions["SC_WITH_PHASE_CALLBACK_TRACING"] = self.options.enable_phase_callbacks_tracing - cmake.definitions["BUILD_SCC_DOCUMENTATION"] = False - cmake.definitions["SCC_LIB_ONLY"] = True + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["SC_WITH_PHASE_CALLBACKS"] = self.options.enable_phase_callbacks + tc.cache_variables["SC_WITH_PHASE_CALLBACK_TRACING"] = self.options.enable_phase_callbacks_tracing + tc.cache_variables["BUILD_SCC_DOCUMENTATION"] = False + tc.cache_variables["SCC_LIB_ONLY"] = True + tc.cache_variables["ENABLE_CONAN"] = False if self.settings.os == "Windows": - cmake.definitions["SCC_LIMIT_TRACE_TYPE_LIST"] = True - cmake.configure(build_folder=self._build_subfolder) - return cmake + tc.cache_variables["SCC_LIMIT_TRACE_TYPE_LIST"] = True + # Used at https://github.com/Minres/SystemC-Components/blob/2023.06/src/common/util/pool_allocator.h#L110 + # but is not set anywhere + tc.preprocessor_definitions["_GLIBCXX_USE_NOEXCEPT"] = "noexcept" + tc.generate() + + deps = CMakeDeps(self) + deps.set_property("systemc", "cmake_file_name", "SystemC") + deps.set_property("systemc-cci", "cmake_target_name", "systemc-cci::systemc-cci") + deps.set_property("yaml-cpp", "cmake_target_name", "yaml-cpp::yaml-cpp") + deps.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + replace_in_file(self, os.path.join(self.source_folder, "third_party", "axi_chi", "CMakeLists.txt"), + " STATIC", "") def build(self): - cmake = self._configure_cmake() + self._patch_sources() + 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", + 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.components["busses"].libs = ["busses"] self.cpp_info.components["scc-sysc"].libs = ["scc-sysc"] + self.cpp_info.components["scc-sysc"].requires = [ + "fstapi", + "lwtr", + "scc-util", + "scv-tr", + "boost::date_time", + "fmt::fmt", + "lz4::lz4", + "rapidjson::rapidjson", + "spdlog::spdlog", + "systemc-cci::systemc-cci", + "systemc::systemc", + "yaml-cpp::yaml-cpp", + "zlib::zlib", + ] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["scc-sysc"].system_libs = ["pthread", "dl"] + + self.cpp_info.components["busses"].libs = ["busses"] + self.cpp_info.components["busses"].requires = ["tlm-interfaces", "scc-sysc"] + + self.cpp_info.components["fstapi"].libs = ["fstapi"] + self.cpp_info.components["fstapi"].requires = ["zlib::zlib", "lz4::lz4"] + + self.cpp_info.components["lwtr"].libs = ["lwtr"] + self.cpp_info.components["lwtr"].requires = ["zlib::zlib", "lz4::lz4", "systemc::systemc", "fmt::fmt"] + self.cpp_info.components["scc-util"].libs = ["scc-util"] + self.cpp_info.components["scc-util"].requires = ["lz4::lz4"] + self.cpp_info.components["scv-tr"].libs = ["scv-tr"] + self.cpp_info.components["scv-tr"].requires = ["fmt::fmt", "systemc::systemc"] + self.cpp_info.components["tlm-interfaces"].libs = ["tlm-interfaces"] + self.cpp_info.components["tlm-interfaces"].requires = ["scc-sysc", "systemc::systemc"] diff --git a/recipes/scc/all/patches/2023.06-add-fmt-10-support.patch b/recipes/scc/all/patches/2023.06-add-fmt-10-support.patch new file mode 100644 index 0000000000000..e07a125098cc9 --- /dev/null +++ b/recipes/scc/all/patches/2023.06-add-fmt-10-support.patch @@ -0,0 +1,11 @@ +--- src/sysc/scc/trace/vcd_trace.hh ++++ src/sysc/scc/trace/vcd_trace.hh +@@ -53,7 +53,7 @@ + + template + inline void vcdEmitValueChangeReal(FPTR os, std::string const& handle, unsigned bits, T val){ +- auto buf = fmt::format("r{:.16g} {}\n", val, handle); ++ auto buf = fmt::format("r{:.16g} {}\n", static_cast(val), handle); + FWRITE(buf.c_str(), 1, buf.size(), os); + } + diff --git a/recipes/scc/all/patches/2023.06-fix-conan-targets.patch b/recipes/scc/all/patches/2023.06-fix-conan-targets.patch new file mode 100644 index 0000000000000..052ef97ffbc9f --- /dev/null +++ b/recipes/scc/all/patches/2023.06-fix-conan-targets.patch @@ -0,0 +1,17 @@ +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -24,5 +24,13 @@ + include(Common) + +-if(CMAKE_PROJECT_NAME STREQUAL "scc") ++find_package(SystemC REQUIRED CONFIG) ++find_package(systemc-cci REQUIRED CONFIG) ++find_package(fmt REQUIRED CONFIG) ++find_package(spdlog REQUIRED CONFIG) ++find_package(Boost REQUIRED CONFIG) ++find_package(yaml-cpp REQUIRED CONFIG) ++find_package(lz4 REQUIRED CONFIG) ++if(TRUE) ++elseif(CMAKE_PROJECT_NAME STREQUAL "scc") + message(STATUS "Building SCC in standalone mode") + include(GNUInstallDirs) diff --git a/recipes/scc/all/test_package/CMakeLists.txt b/recipes/scc/all/test_package/CMakeLists.txt index b74b2d8e566a6..32a369fbfeb6a 100644 --- a/recipes/scc/all/test_package/CMakeLists.txt +++ b/recipes/scc/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(scc REQUIRED CONFIG) add_executable(${PROJECT_NAME} example.cpp) diff --git a/recipes/scc/all/test_package/conanfile.py b/recipes/scc/all/test_package/conanfile.py index 48f7a8523a636..ef5d7042163ec 100644 --- a/recipes/scc/all/test_package/conanfile.py +++ b/recipes/scc/all/test_package/conanfile.py @@ -1,18 +1,26 @@ +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 -from conan.tools.build import cross_building -class SystemcComponentsTestConan(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) 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/scc/all/test_package/example.cpp b/recipes/scc/all/test_package/example.cpp index 2de9f26d9f75d..4f5ccf21b1e5c 100644 --- a/recipes/scc/all/test_package/example.cpp +++ b/recipes/scc/all/test_package/example.cpp @@ -1,7 +1,9 @@ +#include #include #include -int main(int argc, char* argv[]) { +int main() { + util::IoRedirector::get(); std::cout << "scc loaded successfully. Mini test: util::ilog2(32) = " << util::ilog2(32) << std::endl; return 0; } diff --git a/recipes/scc/config.yml b/recipes/scc/config.yml index f8b19962361c1..f334fc74322ea 100644 --- a/recipes/scc/config.yml +++ b/recipes/scc/config.yml @@ -1,3 +1,3 @@ versions: - "2022.08": - folder: "all" + "2023.06": + folder: all diff --git a/recipes/scdoc/all/conandata.yml b/recipes/scdoc/all/conandata.yml index 9859fdd9fbe4b..e10d90bd8274f 100644 --- a/recipes/scdoc/all/conandata.yml +++ b/recipes/scdoc/all/conandata.yml @@ -1,4 +1,4 @@ sources: - "1.11.12": + "1.11.2": url: "https://git.sr.ht/~sircmpwn/scdoc/archive/1.11.2.tar.gz" sha256: "e9ff9981b5854301789a6778ee64ef1f6d1e5f4829a9dd3e58a9a63eacc2e6f0" diff --git a/recipes/scdoc/all/conanfile.py b/recipes/scdoc/all/conanfile.py index 511b322627676..648e2b1eff89f 100644 --- a/recipes/scdoc/all/conanfile.py +++ b/recipes/scdoc/all/conanfile.py @@ -1,79 +1,88 @@ -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 is_apple_os +from conan.tools.files import chdir, copy, get, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout + +required_conan_version = ">=1.53.0" class ScdocInstallerConan(ConanFile): name = "scdoc" description = "scdoc is a simple man page generator for POSIX systems written in C99." - topics = ("manpage", "documentation", "posix") + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://git.sr.ht/~sircmpwn/scdoc" - license = "MIT" - settings = "os", "arch", "compiler", "build_type" - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" + topics = ("manpage", "documentation", "posix") - def build_requirements(self): - self.build_requires("make/4.3") + package_type = "application" + settings = "os", "arch", "compiler", "build_type" 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 layout(self): + basic_layout(self, src_folder="src") def package_id(self): del self.info.settings.compiler - def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, - destination=self._source_subfolder) + def validate(self): + if self.settings.os == "Windows" or is_apple_os(self): + raise ConanInvalidConfiguration(f"Builds aren't supported on {self.settings.os}") - @staticmethod - def _chmod_plus_x(filename): - if os.name == "posix": - os.chmod(filename, os.stat(filename).st_mode | 0o111) + def build_requirements(self): + if not self.conf.get("tools.gnu:make_program", check_type=str): + self.tool_requires("make/4.3") - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self) - return self._autotools + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = AutotoolsToolchain(self) + tc.make_args = ["PREFIX=/"] + tc.generate() def build(self): - autotools = self._configure_autotools() - with tools.chdir(self._source_subfolder): + with chdir(self, self.source_folder): + autotools = Autotools(self) autotools.make() def package(self): - autotools = self._configure_autotools() - with tools.chdir(self._source_subfolder): - autotools.install(args=[f"PREFIX={self.package_folder}"]) - self.copy(pattern="COPYING", dst="licenses", - src=self._source_subfolder) - tools.rmdir(os.path.join(self.package_folder, "share")) + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.install() + copy(self, "COPYING", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder) + rmdir(self, os.path.join(self.package_folder, "share")) + + @staticmethod + def _chmod_plus_x(filename): + if os.name == "posix": + os.chmod(filename, os.stat(filename).st_mode | 0o111) def package_info(self): + self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] + self.cpp_info.includedirs = [] scdoc_root = os.path.join(self.package_folder, "bin") - self.output.info( - "Appending PATH environment variable: {}".format(scdoc_root)) - self.env_info.PATH.append(scdoc_root) self._chmod_plus_x(os.path.join(scdoc_root, "scdoc")) pkgconfig_variables = { - 'exec_prefix': '${prefix}/bin', - 'scdoc': '${exec_prefix}/scdoc', + "exec_prefix": "${prefix}/bin", + "scdoc": "${exec_prefix}/scdoc", } self.cpp_info.set_property( "pkg_config_custom_content", - "\n".join("%s=%s" % (key, value) for key,value in pkgconfig_variables.items())) + "\n".join(f"{key}={value}" for key, value in pkgconfig_variables.items()), + ) - def validate(self): - if self.settings.os in ["Macos", "Windows"]: - raise ConanInvalidConfiguration( - f"Builds aren't supported on {self.settings.os}") + # TODO: Legacy, to be removed on Conan 2.0 + self.output.info(f"Appending PATH environment variable: {scdoc_root}") + self.env_info.PATH.append(scdoc_root) diff --git a/recipes/scdoc/all/test_package/conanfile.py b/recipes/scdoc/all/test_package/conanfile.py index 4864f9fac5f47..3d9ce4cf8ad9b 100644 --- a/recipes/scdoc/all/test_package/conanfile.py +++ b/recipes/scdoc/all/test_package/conanfile.py @@ -1,10 +1,22 @@ -from conans import ConanFile, tools import os +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.layout import basic_layout + 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 test(self): - if not tools.cross_building(self): - self.run( - f"scdoc < {os.path.join(self.source_folder,'test_package.1.scd')}", run_environment=True) + if can_run(self): + scd_path = os.path.join(self.source_folder, "test_package.1.scd") + self.run(f"scdoc < {scd_path}") diff --git a/recipes/scdoc/all/test_v1_package/conanfile.py b/recipes/scdoc/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..4e046a6fb6265 --- /dev/null +++ b/recipes/scdoc/all/test_v1_package/conanfile.py @@ -0,0 +1,10 @@ +from conans import ConanFile, tools +import os + + +class TestPackageConan(ConanFile): + + def test(self): + if not tools.cross_building(self): + scd_path = os.path.join(self.source_folder, os.pardir, "test_package", "test_package.1.scd") + self.run(f"scdoc < {scd_path}", run_environment=True) diff --git a/recipes/scdoc/config.yml b/recipes/scdoc/config.yml index 4e3c90e52dc99..68804c58d126a 100644 --- a/recipes/scdoc/config.yml +++ b/recipes/scdoc/config.yml @@ -1,3 +1,3 @@ versions: - "1.11.12": + "1.11.2": folder: all diff --git a/recipes/scip/all/conandata.yml b/recipes/scip/all/conandata.yml new file mode 100644 index 0000000000000..3da148cb520bd --- /dev/null +++ b/recipes/scip/all/conandata.yml @@ -0,0 +1,37 @@ +sources: + "9.2.0": + url: "https://github.com/scipopt/scip/archive/refs/tags/v920.tar.gz" + sha256: "a22dc20f44e99bfec071889fd5af2bfc57c4af14b76d777d1312006616346f7c" + "9.0.1": + url: "https://github.com/scipopt/scip/archive/refs/tags/v901.tar.gz" + sha256: "08ad3e7ad6f84f457d95bb70ab21fa7fc648dd43103099359ef8a8f30fcce32e" + "8.1.0": + url: "https://github.com/scipopt/scip/archive/refs/tags/v810.tar.gz" + sha256: "b6daf54c37d02564b12fb32ec3bb7a105710eb0026adeafc602af4435fa94685" + "8.0.4": + url: "https://github.com/scipopt/scip/archive/refs/tags/v804.tar.gz" + sha256: "48be3f568763e3fc209803e9426389df107491371cfcce38f73dcc99ede69a51" + "8.0.3": + url: "https://github.com/scipopt/scip/archive/refs/tags/v803.tar.gz" + sha256: "fe7636f8165a8c9298ff55ed3220d084d4ea31ba9b69d2733beec53e0e4335d6" +patches: + "9.2.0": + - patch_file: "patches/0001-bliss-include-dir.patch" + patch_description: "Change hard-coded paths to conan includes" + patch_type: "conan" +version_mappings: + "9.2.0": + soplex: "7.1.2" + default_sym: "snauty" + "9.0.1": + soplex: "7.0.1" + default_sym: "bliss" + "8.1.0": + soplex: "6.0.4" + default_sym: "bliss" + "8.0.4": + soplex: "6.0.4" + default_sym: "bliss" + "8.0.3": + soplex: "6.0.3" + default_sym: "bliss" diff --git a/recipes/scip/all/conanfile.py b/recipes/scip/all/conanfile.py new file mode 100644 index 0000000000000..0c642f80cc866 --- /dev/null +++ b/recipes/scip/all/conanfile.py @@ -0,0 +1,159 @@ +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.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import apply_conandata_patches, export_conandata_patches, copy, get +from conan.tools.microsoft import check_min_vs, is_msvc +from conan.tools.scm import Version +from os.path import join + +required_conan_version = ">=1.53.0" + + +class SCIPConan(ConanFile): + name = "scip" + description = "SCIP mixed integer (nonlinear) programming solver" + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://scipopt.org/" + topics = ("mip", "solver", "linear", "programming") + settings = "os", "arch", "compiler", "build_type" + package_type = "library" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_gmp": [True, False], + "with_tpi": [False, "omp", "tny"], + "with_sym": [False, "bliss", "snauty"], + } + default_options = { + "shared": False, + "fPIC": True, + "with_gmp": True, + "with_tpi": False + } + + @property + def _min_cppstd(self): + return 14 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "5", + "clang": "4", + "apple-clang": "7", + } + + def export_sources(self): + export_conandata_patches(self) + + def validate(self): + 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." + ) + 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 self.options.shared and self.options.with_sym == "bliss": + raise ConanInvalidConfiguration("Bliss is not supported in shared mode.") + comp = self.settings.compiler + if self.options.with_sym == "bliss" and comp == 'clang' and comp.libcxx and comp.libcxx == 'libc++': + raise ConanInvalidConfiguration("Bliss does not support libc++.") + if self.dependencies["soplex"].options.with_gmp and not self.options.with_gmp: + raise ConanInvalidConfiguration("The options 'with_gmp' should be aligned with 'soplex:with_gmp' too.") + if Version(self.version) >= "9.0.1" and is_msvc(self) and self.settings.build_type == "Debug": + # lpi_spx2.cpp : error C1128: number of sections exceeded object file format limit: compile with /bigobj + raise ConanInvalidConfiguration(f"{self.ref} can not be build in Debug with MSVC.") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def requirements(self): + def _mapping_requires(dep, **kwargs): + required_version = self.conan_data["version_mappings"][self.version][dep] + self.requires(f"{dep}/{required_version}", **kwargs) + + if self.options.with_gmp: + self.requires("gmp/6.3.0") + if self.options.with_sym == "bliss": + self.requires("bliss/0.77") + _mapping_requires("soplex") + self.requires("zlib/[>=1.2.11 <2]") + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + if self.options.with_sym == None: + self.options.with_sym = self.conan_data["version_mappings"][self.version]["default_sym"] + + def configure(self): + self.options["soplex"].with_gmp = self.options.with_gmp + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + + @staticmethod + def _to_cmake(*arrays): + return ";".join(item.replace("\\", "/") for sublist in arrays for item in sublist) + + def generate(self): + apply_conandata_patches(self) + tc = CMakeToolchain(self) + tc.variables["SHARED"] = self.options.shared + tc.variables["READLINE"] = False # required for interactive stuff + tc.variables["GMP"] = self.options.with_gmp + tc.variables["TPI"] = self.options.with_tpi or "none" + tc.variables["LPS"] = "spx" + tc.variables["SYM"] = self.options.with_sym or "none" + tc.variables["SOPLEX_INCLUDE_DIRS"] = self._to_cmake(self.dependencies["soplex"].cpp_info.includedirs) + if self.options.shared: + # CMakeLists accesses different variables for SoPlex depending on the SHARED option + tc.variables["SOPLEX_PIC_LIBRARIES"] = "soplex" + if self.dependencies["soplex"].options.with_boost: + # INFO: docu states BOOST_ROOT, yet that does not exist in CMakeLists + tc.variables["SOPLEX_INCLUDE_DIRS"] = self._to_cmake( + self.dependencies["soplex"].cpp_info.includedirs, + self.dependencies["boost"].cpp_info.includedirs + ) + tc.variables["PAPILO"] = False # LGPL + tc.variables["ZIMPL"] = False # LPGL + tc.variables["IPOPT"] = False # no such coin package on conan center yet + tc.variables["BUILD_TESTING"] = False # do not build documentation and examples + tc.generate() + deps = CMakeDeps(self) + deps.set_property("sopex", "cmake_file_name", "SOPEX") + deps.set_property("gmp", "cmake_file_name", "GMP") + deps.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build(target="libscip") + + def package(self): + copy(self, pattern="LICENSE", src=self.source_folder, dst=join(self.package_folder, "licenses")) + # cmake install is not used as this requires the command line tools to be built, which we do not do + copy(self, pattern="*.h", src=join(self.source_folder, "src"), dst=join(self.package_folder, "include")) + copy(self, pattern="*.h", src=join(self.build_folder, "scip"), dst=join(self.package_folder, "include", "scip")) + 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) + copy(self, pattern="*.lib", src=self.build_folder, dst=join(self.package_folder, "lib"), keep_path=False) + fix_apple_shared_install_name(self) + + def package_info(self): + self.cpp_info.libs = ["libscip" if is_msvc(self) else "scip"] + if self.options.with_tpi == "omp": + self.cpp_info.system_libs.append("-fopenmp") diff --git a/recipes/scip/all/patches/0001-bliss-include-dir.patch b/recipes/scip/all/patches/0001-bliss-include-dir.patch new file mode 100644 index 0000000000000..c47daafc7bbb7 --- /dev/null +++ b/recipes/scip/all/patches/0001-bliss-include-dir.patch @@ -0,0 +1,20 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index c23a1a85c9..f288b2b89d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -133,11 +133,10 @@ if(SYM STREQUAL "bliss" OR SYM STREQUAL "sbliss") + + find_package(Bliss CONFIG HINTS ${BLISS_DIR}) + if(Bliss_FOUND) +- get_filename_component(BLISS_ABSOLUTE_PATH ${Bliss_DIR}/../../.. REALPATH) +- include_directories(${BLISS_ABSOLUTE_PATH}/include) +- set(SYM_LIBRARIES ${BLISS_ABSOLUTE_PATH}/lib/libbliss.a) +- set(SYM_PIC_LIBRARIES ${BLISS_ABSOLUTE_PATH}/lib/libbliss.a) +- message(STATUS "Found Bliss: ${BLISS_ABSOLUTE_PATH}") ++ include_directories("${bliss_INCLUDE_DIRS}") ++ set(SYM_LIBRARIES "bliss::bliss") ++ set(SYM_PIC_LIBRARIES "bliss::bliss") ++ message(STATUS "Found Bliss via Conan") + else() + # Utilities to automatically download missing dependencies + include(cmake/Dependencies.cmake) diff --git a/recipes/scip/all/test_package/CMakeLists.txt b/recipes/scip/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..a3b0a4eba8335 --- /dev/null +++ b/recipes/scip/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package CXX) +set(CMAKE_CXX_STANDARD 14) + +find_package(scip REQUIRED CONFIG) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE scip::scip) diff --git a/recipes/scip/all/test_package/conanfile.py b/recipes/scip/all/test_package/conanfile.py new file mode 100644 index 0000000000000..8a5bb47f50c4c --- /dev/null +++ b/recipes/scip/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/scip/all/test_package/test_package.cpp b/recipes/scip/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..36b9c1c15a47d --- /dev/null +++ b/recipes/scip/all/test_package/test_package.cpp @@ -0,0 +1,12 @@ +#include + +#include "scip/scip.h" + + +int main() { + SCIP* scip; + SCIPcreate(&scip); + SCIPprintVersion(scip, NULL); + SCIPinfoMessage(scip, NULL, "\n"); + return EXIT_SUCCESS; +} diff --git a/recipes/scip/config.yml b/recipes/scip/config.yml new file mode 100644 index 0000000000000..73c7b80b6ca0b --- /dev/null +++ b/recipes/scip/config.yml @@ -0,0 +1,11 @@ +versions: + "9.2.0": + folder: all + "9.0.1": + folder: all + "8.1.0": + folder: all + "8.0.4": + folder: all + "8.0.3": + folder: all diff --git a/recipes/scippp/all/conandata.yml b/recipes/scippp/all/conandata.yml new file mode 100644 index 0000000000000..39c343801470f --- /dev/null +++ b/recipes/scippp/all/conandata.yml @@ -0,0 +1,14 @@ +sources: + "1.2.0": + url: "https://github.com/scipopt/SCIPpp/archive/refs/tags/1.2.0.tar.gz" + sha256: "8fa4b819734b9841eda1ec1c9266fb07144be490c3f24be46271c538ab18da61" + "1.1.0": + url: "https://github.com/scipopt/SCIPpp/archive/refs/tags/1.1.0.tar.gz" + sha256: "808b58e8ddd873ec403c021f9255004120e58d7ec6fb4b7d99ff6f21950ff8fb" + "1.0.2": + url: "https://github.com/scipopt/SCIPpp/archive/refs/tags/1.0.2.tar.gz" + sha256: "d51dfd0f1ca1b57619f7c82e32d5390d99d5cdaee98ae1ace99ec05a394dcee3" +scip_mapping: + "1.2.0": "9.0.1" + "1.1.0": "8.0.4" + "1.0.2": "8.0.4" diff --git a/recipes/scippp/all/conanfile.py b/recipes/scippp/all/conanfile.py new file mode 100644 index 0000000000000..55ee8105f9224 --- /dev/null +++ b/recipes/scippp/all/conanfile.py @@ -0,0 +1,98 @@ +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 +from conan.tools.microsoft import check_min_vs, is_msvc +from conan.tools.scm import Version +from os.path import join + + +class ScipPlusPlus(ConanFile): + name = "scippp" + settings = "os", "compiler", "build_type", "arch" + generators = "CMakeDeps" + description = "SCIP++ is a C++ wrapper for SCIP's C interface" + package_type = "library" + topics = ("mip", "solver", "linear", "programming") + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/scipopt/SCIPpp" + 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): + # see https://github.com/scipopt/SCIPpp/commit/faa80e753f96094004467c1daa98a7ab4d86f279 + if Version(self.version) >= "1.1.0": + return { + "gcc": "8", + "clang": "7", + "apple-clang": "11", + "msvc": "192" + } + else: + return { + "gcc": "7", + "clang": "7", + "apple-clang": "10", + "msvc": "192" + } + + 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 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: + self.options.rm_safe("fPIC") + + def requirements(self): + # see https://github.com/scipopt/SCIPpp/blob/1.0.0/conanfile.py#L25 + self.requires(f"scip/{self.conan_data['scip_mapping'][self.version]}", transitive_headers=True) + + def generate(self): + tc = CMakeToolchain(self) + # In upstream, the version is injected into CMake via git. + tc.variables["scippp_version"] = self.version + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, pattern="LICENSE", dst=join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) + cmake.install() + + def package_info(self): + self.cpp_info.libs = ["ScipPP"] diff --git a/recipes/scippp/all/test_package/CMakeLists.txt b/recipes/scippp/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..877c0c21bd3c0 --- /dev/null +++ b/recipes/scippp/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package CXX) +set(CMAKE_CXX_STANDARD 17) + +find_package(scippp REQUIRED CONFIG) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE scippp::scippp) diff --git a/recipes/scippp/all/test_package/conanfile.py b/recipes/scippp/all/test_package/conanfile.py new file mode 100644 index 0000000000000..8a5bb47f50c4c --- /dev/null +++ b/recipes/scippp/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/scippp/all/test_package/test_package.cpp b/recipes/scippp/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..5244632b87e16 --- /dev/null +++ b/recipes/scippp/all/test_package/test_package.cpp @@ -0,0 +1,13 @@ +#include +#include +#include +using namespace scippp; +int main() { + std::cout << "This is SCIP++ version " << scippp::getVersion() << std::endl; + Model model("Simple"); + auto x1 = model.addVar("x_1", 1); + auto x2 = model.addVar("x_2", 1); + model.addConstr(3 * x1 + 2 * x2 <= 1, "capacity"); + model.setObjsense(Sense::MAXIMIZE); + model.solve(); +} diff --git a/recipes/scippp/config.yml b/recipes/scippp/config.yml new file mode 100644 index 0000000000000..eb9a4f6036cd3 --- /dev/null +++ b/recipes/scippp/config.yml @@ -0,0 +1,7 @@ +versions: + "1.2.0": + folder: all + "1.1.0": + folder: all + "1.0.2": + folder: all diff --git a/recipes/scnlib/all/conandata.yml b/recipes/scnlib/all/conandata.yml index 3a41a75a21f73..14fe174ba433a 100644 --- a/recipes/scnlib/all/conandata.yml +++ b/recipes/scnlib/all/conandata.yml @@ -1,35 +1,13 @@ sources: - "1.1.2": - url: "https://github.com/eliaskosunen/scnlib/archive/refs/tags/v1.1.2.tar.gz" - sha256: "5ed3ec742302c7304bf188bde9c4012a65dc8124ff4e1a69b598480d664250e6" - "1.0": - url: "https://github.com/eliaskosunen/scnlib/archive/refs/tags/v1.0.tar.gz" - sha256: "5b8333e522206c2a74e57a9c9544c4fe4e7858cfe93e216905b463eaf91af5fe" - "0.4": - url: "https://github.com/eliaskosunen/scnlib/archive/refs/tags/v0.4.tar.gz" - sha256: "f23e66b00c9d38671b39b83c082a5b2db1cf05b3e3eff7b4a769487d9ed9d366" -patches: - "1.1.2": - - patch_file: "patches/1.1.2-0001-install-dll-windows.patch" - patch_description: "add runtime destination path on install" - patch_type: "portability" - - patch_file: "patches/1.1.2-0002-remove-header-only-target.patch" - 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" - patch_description: "add runtime destination path on install" - patch_type: "portability" - - patch_file: "patches/1.0-0002-remove-header-only-target.patch" - 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" - patch_description: "add runtime destination path on install" - patch_type: "portability" + "4.0.1": + url: "https://github.com/eliaskosunen/scnlib/archive/refs/tags/v4.0.1.tar.gz" + sha256: "ece17b26840894cc57a7127138fe4540929adcb297524dec02c490c233ff46a7" + "3.0.2": + url: "https://github.com/eliaskosunen/scnlib/archive/refs/tags/v3.0.2.tar.gz" + sha256: "27f17420ddad6971339e6d5db0d915204181c31f5cb0e92a63b9998d98e2852b" + "3.0.1": + url: "https://github.com/eliaskosunen/scnlib/archive/refs/tags/v3.0.1.tar.gz" + sha256: "bc8a668873601d00cce6841c2d0f2c93f836f63f0fbc77997834dea12e951eb1" + "2.0.3": + url: "https://github.com/eliaskosunen/scnlib/archive/refs/tags/v2.0.3.tar.gz" + sha256: "507ed0e988f1d9460a9c921fc21f5a5244185a4015942f235522fbe5c21e6a51" diff --git a/recipes/scnlib/all/conanfile.py b/recipes/scnlib/all/conanfile.py index 0d9ca778edb5a..14a3e596b4a2a 100644 --- a/recipes/scnlib/all/conanfile.py +++ b/recipes/scnlib/all/conanfile.py @@ -1,14 +1,15 @@ 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.files import 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 +from conan.tools.microsoft import is_msvc +from conan.errors import ConanInvalidConfiguration import os -required_conan_version = ">=1.53.0" +required_conan_version = ">=2.0" class ScnlibConan(ConanFile): name = "scnlib" @@ -17,59 +18,81 @@ class ScnlibConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/eliaskosunen/scnlib" topics = ("parsing", "io", "scanf") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "header_only": [True, False], "shared": [True, False], "fPIC": [True, False], + "regex_backend": ["None", "std", "boost", "boost_icu", "re2"], } default_options = { "header_only": False, "shared": False, "fPIC": True, + "regex_backend": "std", } @property def _min_cppstd(self): - return 11 - - def export_sources(self): - export_conandata_patches(self) + # scn/2.0.0 has complation error on MSVC c++17 + # we have to use versions which support c++20 + # https://github.com/eliaskosunen/scnlib/issues/97 + # https://github.com/conan-io/conan-center-index/pull/22455#issuecomment-1924444193 + return "20" if is_msvc(self) else "17" def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): - if self.options.header_only or self.options.shared: + if self.options.get_safe("header_only") or self.options.shared: self.options.rm_safe("fPIC") - if self.options.header_only: + if self.options.get_safe("header_only"): del self.options.shared + self.package_type = "header-library" def layout(self): - if self.options.header_only: + if self.options.get_safe("header_only"): basic_layout(self, src_folder="src") else: cmake_layout(self, src_folder="src") def requirements(self): - if Version(self.version) >= "1.0": - self.requires("fast_float/3.8.1") - - def validate(self): - 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) + self.requires("fast_float/6.1.0") + if Version(self.version) < "3.0": + self.requires("simdutf/4.0.5") + if self.options.get_safe("regex_backend") in ["boost", "boost_icu"]: + self.requires("boost/1.83.0") + elif self.options.get_safe("regex_backend") == "re2": + self.requires("re2/20231101") def package_id(self): - if self.options.header_only: + if self.info.options.get_safe("header_only"): self.info.clear() + def validate(self): + check_min_cppstd(self, self._min_cppstd) + + if self.options.get_safe("regex_backend") == "boost_icu" and \ + not self.dependencies["boost"].options.get_safe("i18n_backend_icu"): + raise ConanInvalidConfiguration( + f"{self.ref} with regex_backend=Boost_icu option requires boost::i18n_backend_icu to be enabled." + ) + # TODO: This should probably be a del self.options.header_only in config_options once the CI supports it + if self.options.header_only: + raise ConanInvalidConfiguration(f"{self.ref} doesn't support header only mode.") + if self.settings.compiler == "gcc" and Version(self.settings.compiler.version).major == "11": + raise ConanInvalidConfiguration(f"{self.ref} doesn't support gcc 11.x due to std::regex_constants::multiline is not defined.") + + def build_requirements(self): + self.tool_requires("cmake/[>=3.16 <4]") + 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 self.options.header_only: + if self.options.get_safe("header_only"): return tc = CMakeToolchain(self) @@ -79,53 +102,57 @@ def generate(self): 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.variables["SCN_USE_EXTERNAL_SIMDUTF"] = True + tc.variables["SCN_USE_EXTERNAL_FAST_FLOAT"] = True + tc.variables["SCN_BENCHMARKS_BUILDTIME"] = False + tc.variables["SCN_BENCHMARKS_BINARYSIZE"] = False + tc.variables["SCN_DISABLE_REGEX"] = self.options.regex_backend is None + if self.options.regex_backend is not None: + tc.variables["SCN_REGEX_BACKEND"] = self.options.regex_backend + tc.variables["SCN_USE_EXTERNAL_REGEX_BACKEND"] = True tc.generate() deps = CMakeDeps(self) deps.generate() def build(self): - apply_conandata_patches(self) - if not self.options.header_only: + if not self.options.get_safe("header_only"): 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: + if self.options.get_safe("header_only"): 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(self.package_folder, "include", "scn", "detail"), src=os.path.join(self.source_folder, "src")) + src_folder = os.path.join(self.source_folder, "src") + copy(self, "reader_*.cpp", src=src_folder, dst=os.path.join(self.package_folder, "include", "scn", "reader")) + copy(self, "vscan.cpp", src=src_folder, dst=os.path.join(self.package_folder, "include", "scn", "scan")) + copy(self, "locale.cpp", src=src_folder, dst=os.path.join(self.package_folder, "include", "scn", "detail")) + copy(self, "file.cpp", src=src_folder, dst=os.path.join(self.package_folder, "include", "scn", "detail")) 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")) - 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")) + 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" + target = "scn-header-only" if self.options.get_safe("header_only") else "scn" self.cpp_info.set_property("cmake_file_name", "scn") - self.cpp_info.set_property("cmake_target_name", "scn::{}".format(target)) + self.cpp_info.set_property("cmake_target_name", f"scn::{target}") # TODO: back to global scope in conan v2 once cmake_find_package* generators removed - if self.options.header_only: + if self.options.get_safe("header_only"): self.cpp_info.components["_scnlib"].defines = ["SCN_HEADER_ONLY=1"] else: self.cpp_info.components["_scnlib"].defines = ["SCN_HEADER_ONLY=0"] self.cpp_info.components["_scnlib"].libs = ["scn"] - if Version(self.version) >= "1.0": - self.cpp_info.components["_scnlib"].requires = ["fast_float::fast_float"] + self.cpp_info.components["_scnlib"].requires.append("fast_float::fast_float") + if Version(self.version) < "3.0": + self.cpp_info.components["_scnlib"].requires.append("simdutf::simdutf") if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["_scnlib"].system_libs.append("m") @@ -135,4 +162,4 @@ def package_info(self): self.cpp_info.names["cmake_find_package_multi"] = "scn" self.cpp_info.components["_scnlib"].names["cmake_find_package"] = target self.cpp_info.components["_scnlib"].names["cmake_find_package_multi"] = target - self.cpp_info.components["_scnlib"].set_property("cmake_target_name", "scn::{}".format(target)) + self.cpp_info.components["_scnlib"].set_property("cmake_target_name", f"scn::{target}") diff --git a/recipes/scnlib/all/patches/0.4-0001-install-dll-windows.patch b/recipes/scnlib/all/patches/0.4-0001-install-dll-windows.patch deleted file mode 100644 index 8928ce2f8c250..0000000000000 --- a/recipes/scnlib/all/patches/0.4-0001-install-dll-windows.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -145,6 +145,7 @@ if (SCN_INSTALL) - - install(TARGETS ${SCN_EXPORT_TARGETS_LIST} - EXPORT scnTargets -+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) diff --git a/recipes/scnlib/all/patches/1.0-0001-install-dll-windows.patch b/recipes/scnlib/all/patches/1.0-0001-install-dll-windows.patch deleted file mode 100644 index c2d5fe9c223ea..0000000000000 --- a/recipes/scnlib/all/patches/1.0-0001-install-dll-windows.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index d960eb9..c914832 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -167,6 +167,7 @@ if (SCN_INSTALL) - - install(TARGETS ${SCN_EXPORT_TARGETS_LIST} - EXPORT scnTargets -+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) diff --git a/recipes/scnlib/all/patches/1.0-0002-remove-header-only-target.patch b/recipes/scnlib/all/patches/1.0-0002-remove-header-only-target.patch deleted file mode 100644 index 6c35d57c4ca41..0000000000000 --- a/recipes/scnlib/all/patches/1.0-0002-remove-header-only-target.patch +++ /dev/null @@ -1,18 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index c914832..1aba404 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -106,12 +106,10 @@ function(generate_header_only_target target_name) - endfunction() - - generate_library_target(scn) --generate_header_only_target(scn-header-only) - - set(SCN_EXPORT_TARGETS_LIST -- scn scn-header-only) -+ scn) - add_library(scn::scn ALIAS scn) --add_library(scn::scn-header-only ALIAS scn-header-only) - - set_property(TARGET scn PROPERTY SOVERSION 0) - 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 deleted file mode 100644 index 5b5354a04f783..0000000000000 --- a/recipes/scnlib/all/patches/1.0-0003-use-conan-package.patch +++ /dev/null @@ -1,35 +0,0 @@ -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-0001-install-dll-windows.patch b/recipes/scnlib/all/patches/1.1.2-0001-install-dll-windows.patch deleted file mode 100644 index ee64fa9407251..0000000000000 --- a/recipes/scnlib/all/patches/1.1.2-0001-install-dll-windows.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index f1864c6..b42736e 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -171,6 +171,7 @@ if (SCN_INSTALL) - - install(TARGETS ${SCN_EXPORT_TARGETS_LIST} - EXPORT scnTargets -+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) diff --git a/recipes/scnlib/all/patches/1.1.2-0002-remove-header-only-target.patch b/recipes/scnlib/all/patches/1.1.2-0002-remove-header-only-target.patch deleted file mode 100644 index 08f98586c6b5b..0000000000000 --- a/recipes/scnlib/all/patches/1.1.2-0002-remove-header-only-target.patch +++ /dev/null @@ -1,18 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index b42736e..87cb1f7 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -110,12 +110,10 @@ function(generate_header_only_target target_name) - endfunction() - - generate_library_target(scn) --generate_header_only_target(scn-header-only) - - set(SCN_EXPORT_TARGETS_LIST -- scn scn-header-only) -+ scn) - add_library(scn::scn ALIAS scn) --add_library(scn::scn-header-only ALIAS scn-header-only) - - set_property(TARGET scn PROPERTY SOVERSION 0) - 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 deleted file mode 100644 index 9fedf6c33071c..0000000000000 --- a/recipes/scnlib/all/patches/1.1.2-0003-fix-link-keyword.patch +++ /dev/null @@ -1,22 +0,0 @@ -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 811e01a046f7e..ebeda65ce06fe 100644 --- a/recipes/scnlib/all/test_package/CMakeLists.txt +++ b/recipes/scnlib/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(scn REQUIRED CONFIG) @@ -9,4 +9,9 @@ if(TARGET scn::scn-header-only) else() target_link_libraries(${PROJECT_NAME} PRIVATE scn::scn) endif() -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +if (scn_VERSION VERSION_LESS "2.0.0") + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +else() + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) + target_compile_definitions(${PROJECT_NAME} PUBLIC SCNLIB_V2) +endif() diff --git a/recipes/scnlib/all/test_package/test_package.cpp b/recipes/scnlib/all/test_package/test_package.cpp index 148a9caff4852..276439b1c0eb3 100644 --- a/recipes/scnlib/all/test_package/test_package.cpp +++ b/recipes/scnlib/all/test_package/test_package.cpp @@ -1,9 +1,27 @@ +#include +#include + +#ifndef SCNLIB_V2 + #include -#include +int main() { + std::string word; + auto result = scn::scan("Hello world", "{}", word); + std::cout << word << '\n'; + std::cout << result.range_as_string() << '\n'; +} + +#else + +#include int main() { - std::string s{"conan-center-index"}; - auto span = scn::make_span(s); - return 0; + if (auto result = scn::scan("Hello world!", "{}")) { + std::cout << result->value() << '\n'; + } else { + std::cout << "Couldn't parse a word: " << result.error().msg() << '\n'; + } } + +#endif diff --git a/recipes/scnlib/config.yml b/recipes/scnlib/config.yml index 7205ca311ab8d..a66959b861c3f 100644 --- a/recipes/scnlib/config.yml +++ b/recipes/scnlib/config.yml @@ -1,7 +1,9 @@ versions: - "1.1.2": + "4.0.1": folder: all - "1.0": + "3.0.2": folder: all - "0.4": + "3.0.1": + folder: all + "2.0.3": folder: all diff --git a/recipes/scons/all/conandata.yml b/recipes/scons/all/conandata.yml index 5c49097cbf659..5a281fd5282bb 100644 --- a/recipes/scons/all/conandata.yml +++ b/recipes/scons/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "4.6.0": + url: "http://prdownloads.sourceforge.net/scons/SCons-4.6.0.tar.gz" + sha256: "7db28958b188b800f803c287d0680cc3ac7c422ed0b1cf9895042c52567803ec" "4.3.0": url: "http://prdownloads.sourceforge.net/scons/SCons-4.3.0.tar.gz" sha256: "2efc81754a4491299c0c64a6230715dfe33f7a3a42a0834a4ce1756af117bdec" diff --git a/recipes/scons/all/conanfile.py b/recipes/scons/all/conanfile.py index f52d4fa5ffabe..c3cafc92f9e09 100644 --- a/recipes/scons/all/conanfile.py +++ b/recipes/scons/all/conanfile.py @@ -1,4 +1,6 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.files import copy, get, save +from conan.tools.scm import Version import os import shutil import textwrap @@ -11,17 +13,17 @@ class SConsConan(ConanFile): url = "https://github.com/conan-io/conan-center-index/" homepage = "https://scons.org" topics = ("scons", "build", "configuration", "development") - settings = "os" # Added to let the CI test this package on all os'es + settings = "os" + package_type = "application" + no_copy_source = True + short_paths = True - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + self.folders.source = "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, destination=self.source_folder) def _chmod_x(self, path): if os.name == "posix": @@ -36,19 +38,19 @@ def _scons_cmd(self): return os.path.join(self.package_folder, "bin", "scons.cmd") def package_id(self): - self.info.header_only() + self.info.clear() 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 tools.Version(self.version) < 4: - shutil.copytree(os.path.join(self._source_subfolder, "engine", "SCons"), + if Version(self.version) < 4: + shutil.copytree(os.path.join(self.source_folder, "engine", "SCons"), os.path.join(self.package_folder, "res", "SCons")) else: - shutil.copytree(os.path.join(self._source_subfolder, "SCons"), + shutil.copytree(os.path.join(self.source_folder, "SCons"), os.path.join(self.package_folder, "res", "SCons")) - tools.save(self._scons_sh, textwrap.dedent("""\ + save(self, self._scons_sh, textwrap.dedent("""\ #!/bin/sh realpath() ( @@ -70,7 +72,7 @@ def package(self): exec ${PYTHON:-python3} "$currentdir/../res/SCons/__main__.py" "$@" """)) self._chmod_x(self._scons_sh) - tools.save(self._scons_cmd, textwrap.dedent(r""" + save(self, self._scons_cmd, textwrap.dedent(r""" @echo off set currentdir=%~dp0 if not defined PYTHON ( @@ -80,18 +82,14 @@ def package(self): CALL %PYTHON% %currentdir%\\..\\res\\SCons\\__main__.py %* """)) - # Mislead CI and create an empty header in the include directory - include_dir = os.path.join(self.package_folder, "include") - os.mkdir(include_dir) - tools.save(os.path.join(include_dir, "__nop.h"), "") - def package_info(self): self.cpp_info.includedirs = [] self.cpp_info.libdirs = [] self._chmod_x(self._scons_sh) - bindir = os.path.join(self.package_folder, "bin") + + # For Conan 1.x downstream consumers, can be removed once recipe is Conan 2.x only: self.output.info("Appending PATH environment var: {}".format(bindir)) self.env_info.PATH.append(bindir) diff --git a/recipes/scons/all/test_package/SConscript b/recipes/scons/all/test_package/SConscript index 4292c616da88f..d87b9971cdc64 100644 --- a/recipes/scons/all/test_package/SConscript +++ b/recipes/scons/all/test_package/SConscript @@ -3,15 +3,6 @@ import os env = Environment() -conan = SConscript("SConscript_conan") -if not conan: - print("File `SConscript_conan` is missing.") - print("It should be generated by running `conan install`.") - sys.exit(1) - -flags = conan["conan"] -env.MergeFlags(flags) - print("CC is: {}".format(env.subst('$CC'))) test_package = env.Program(["test_package.c"]) diff --git a/recipes/scons/all/test_package/SConstruct b/recipes/scons/all/test_package/SConstruct index a01f66f16099c..ef39d8e2323d3 100644 --- a/recipes/scons/all/test_package/SConstruct +++ b/recipes/scons/all/test_package/SConstruct @@ -2,5 +2,6 @@ import os SConsignFile(os.path.join(GetLaunchDir(), "db")) SConscript('SConscript', - variant_dir=GetLaunchDir(), + build_dir='build', + src='.', duplicate=False) diff --git a/recipes/scons/all/test_package/conanfile.py b/recipes/scons/all/test_package/conanfile.py index 315bdaa33b945..ae2a5c9cf4727 100644 --- a/recipes/scons/all/test_package/conanfile.py +++ b/recipes/scons/all/test_package/conanfile.py @@ -1,43 +1,37 @@ -from conans import ConanFile, tools -from conans.errors import ConanException +from conan import ConanFile +from conan.tools.build import build_jobs, cross_building +from conan.tools.layout import basic_layout from io import StringIO import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "scons" + generators = "VirtualBuildEnv" + test_type = "explicit" - def build(self): - scons_path = self.deps_user_info["scons"].scons - if not scons_path: - raise ConanException("scons could not be found") - if not scons_path.replace("\\", "/").startswith(self.deps_cpp_info["scons"].rootpath.replace("\\", "/")): - raise ConanException("an external scons was found") + def build_requirements(self): + self.tool_requires(self.tested_reference_str) + def layout(self): + basic_layout(self) + + def build(self): output = StringIO() - self.run("{} --version".format(scons_path), run_environment=True, output=output, ignore_errors=True) - self.output.info("output: %s" % output.getvalue()) - output = StringIO() - self.run("{} --version".format(scons_path), run_environment=True, output=output) - text = output.getvalue() - if self.deps_cpp_info["scons"].version not in text: - raise ConanException("scons --version does not return correct version") + self.run("scons --version", output) + self.output.info(output.getvalue()) + assert("SCons by Steven Knight" in output.getvalue()) scons_args = [ - "-j", str(tools.cpu_count()), + "-j", str(build_jobs(self)), "-C", self.source_folder, "-f", os.path.join(self.source_folder, "SConstruct"), ] - self.run("scons {}".format(" ".join(scons_args)), run_environment=True) + self.run("scons {}".format(" ".join(scons_args))) def test(self): - from io import StringIO - - if not tools.cross_building(self): - bin_path = os.path.join(".", "test_package") - output = StringIO() - self.run(bin_path, run_environment=True, ignore_errors=True, output=output) - self.output.info("output: %s" % output.getvalue()) - self.run(bin_path, run_environment=True) + if not cross_building(self): + # Scons build put executable righe here + bin_path = os.path.join(self.recipe_folder, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/scons/config.yml b/recipes/scons/config.yml index 26cb9a182f8d1..39ec99bde0cb3 100644 --- a/recipes/scons/config.yml +++ b/recipes/scons/config.yml @@ -1,4 +1,6 @@ versions: + "4.6.0": + folder: all "4.3.0": folder: all "4.2.0": diff --git a/recipes/screen_capture_lite/all/conandata.yml b/recipes/screen_capture_lite/all/conandata.yml index ebf387ff02ee5..7bc7e84245c17 100644 --- a/recipes/screen_capture_lite/all/conandata.yml +++ b/recipes/screen_capture_lite/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "17.1.1369": + url: "https://github.com/smasherprog/screen_capture_lite/archive/refs/tags/17.1.1369.tar.gz" + sha256: "72abf1cd9fc538e98547841ec56396ba75a36853e861f7bf721f21c64c34453e" + "17.1.1327": + url: "https://github.com/smasherprog/screen_capture_lite/archive/refs/tags/17.1.1327.tar.gz" + sha256: "bc5c17f3df14c1013268fc0107b52a98c6d032803fd1faea1983772f3b7ac5ed" + "17.1.1173": + url: "https://github.com/smasherprog/screen_capture_lite/archive/refs/tags/17.1.1173.tar.gz" + sha256: "17875fb58f0e5920b13b6ef2516c8e973055347339d3dbaabfa97ef448fdfff2" "17.1.613": url: "https://github.com/smasherprog/screen_capture_lite/archive/refs/tags/17.1.613.tar.gz" sha256: "ab111e52379fc4bca852b9a79535329e12dca9b25a0b87a2ef84ab7348a64064" @@ -8,7 +17,6 @@ sources: "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" diff --git a/recipes/screen_capture_lite/all/conanfile.py b/recipes/screen_capture_lite/all/conanfile.py index b435b4fa5fdfb..9f864ff248956 100644 --- a/recipes/screen_capture_lite/all/conanfile.py +++ b/recipes/screen_capture_lite/all/conanfile.py @@ -1,14 +1,14 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.microsoft import check_min_vs, is_msvc +from conan.tools.microsoft import 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" +required_conan_version = ">=1.54.0" + class ScreenCaptureLiteConan(ConanFile): name = "screen_capture_lite" @@ -18,6 +18,7 @@ class ScreenCaptureLiteConan(ConanFile): homepage = "https://github.com/smasherprog/screen_capture_lite" topics = ("screen-capture", "screen-ercorder") settings = "os", "arch", "compiler", "build_type" + package_type = "library" options = { "shared": [True, False], "fPIC": [True, False], @@ -28,8 +29,8 @@ class ScreenCaptureLiteConan(ConanFile): } @property - def _minimum_cpp_standard(self): - return 20 + def _min_cppstd(self): + return "20" if Version(self.version) < "17.1.596" else "17" @property def _compilers_minimum_version(self): @@ -37,6 +38,8 @@ def _compilers_minimum_version(self): "gcc": "11", "clang": "10", "apple-clang": "10", + "Visual Studio": "16", + "msvc": "192", } def export_sources(self): @@ -48,10 +51,7 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") @@ -61,41 +61,28 @@ def requirements(self): 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++": + 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." + ) + + if self.settings.compiler == "clang" and self.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": + self.settings.compiler == "apple-clang" and Version(self.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") + if Version(self.version) >= "17.1.596": + self.tool_requires("cmake/[>=3.16 <4]") 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) @@ -105,7 +92,6 @@ def generate(self): 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) diff --git a/recipes/screen_capture_lite/all/test_v1_package/conanfile.py b/recipes/screen_capture_lite/all/test_v1_package/conanfile.py index 132c03950e167..5a05af3c2dfd2 100644 --- a/recipes/screen_capture_lite/all/test_v1_package/conanfile.py +++ b/recipes/screen_capture_lite/all/test_v1_package/conanfile.py @@ -1,6 +1,5 @@ from conans import ConanFile, CMake from conan.tools.build import cross_building -from conan.tools.microsoft import is_msvc import os diff --git a/recipes/screen_capture_lite/config.yml b/recipes/screen_capture_lite/config.yml index f8e73a4caff7b..d2022be0c81a1 100644 --- a/recipes/screen_capture_lite/config.yml +++ b/recipes/screen_capture_lite/config.yml @@ -1,4 +1,10 @@ versions: + "17.1.1369": + folder: "all" + "17.1.1327": + folder: "all" + "17.1.1173": + folder: "all" "17.1.613": folder: "all" "17.1.462": diff --git a/recipes/sdbus-cpp/all/conandata.yml b/recipes/sdbus-cpp/all/conandata.yml index 4c4e5beb4bad0..597865c12dd7d 100644 --- a/recipes/sdbus-cpp/all/conandata.yml +++ b/recipes/sdbus-cpp/all/conandata.yml @@ -1,4 +1,16 @@ sources: + "2.0.0": + url: "https://github.com/Kistler-Group/sdbus-cpp/archive/v2.0.0.tar.gz" + sha256: "88af4569161a0d0192f0f4a94582a1af4e75722499d06984fb7f91f638f5afb3" + "1.5.0": + url: "https://github.com/Kistler-Group/sdbus-cpp/archive/v1.5.0.tar.gz" + sha256: "577986929f911320fb9ef6a3e2badd464dc38411ebc25d2966f5cb85c39f0897" + "1.4.0": + url: "https://github.com/Kistler-Group/sdbus-cpp/archive/v1.4.0.tar.gz" + sha256: "ca7405c7f0f9ae3023dcfa37bc68974c4b8a1c9ea2909b970e0aedc3e8657ee6" + "1.3.0": + url: "https://github.com/Kistler-Group/sdbus-cpp/archive/v1.3.0.tar.gz" + sha256: "d44f59abdd64d8f1ca3af7db58bc6518cb081fc9ff16285c3d75a68f5c073d10" "1.2.0": url: "https://github.com/Kistler-Group/sdbus-cpp/archive/v1.2.0.tar.gz" sha256: "7f7231904abb6a996b8c18ddc5fb50078ef5dff5191649abf9f127aff41d24e9" @@ -11,15 +23,3 @@ sources: "0.8.3": url: "https://github.com/Kistler-Group/sdbus-cpp/archive/v0.8.3.tar.gz" sha256: "0fd575ae0f463773dd9141242d1133731e2b780fd6526650ce992ba711d88628" - -patches: - "1.0.0": - - patch_file: "patches/0002-correct-readme-cpack-resource-path.patch" - patch_description: "fix out of tree build by using proper paths in cmake file" - patch_type: "backport" - patch_source: "https://github.com/Kistler-Group/sdbus-cpp/commit/0b8f2d97524f354bcaf816b27b6139a5b0c480ba" - "0.8.3": - - patch_file: "patches/0001-xml2cpp-Add-missing-EXPAT-include-dirs-136.patch" - patch_description: "fix build error by adding missing headers" - patch_type: "backport" - patch_source: "https://github.com/Kistler-Group/sdbus-cpp/commit/fb008445b15b452f461c34667f4991f5ce06e481" diff --git a/recipes/sdbus-cpp/all/conanfile.py b/recipes/sdbus-cpp/all/conanfile.py index c9aa7c7a53b7a..18ebec3e55883 100644 --- a/recipes/sdbus-cpp/all/conanfile.py +++ b/recipes/sdbus-cpp/all/conanfile.py @@ -3,11 +3,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.env import VirtualBuildEnv +from conan.tools.files import copy, get, rmdir +from conan.tools.gnu import PkgConfigDeps from conan.tools.scm import Version -required_conan_version = ">=1.51.0" +required_conan_version = ">=1.55.0" class SdbusCppConan(ConanFile): @@ -18,18 +20,20 @@ class SdbusCppConan(ConanFile): description = "High-level C++ D-Bus library for Linux designed" \ " to provide easy-to-use yet powerful API in modern C++" topics = ("dbus", "sd-bus", "sdbus-c++") + package_type = "library" settings = "os", "compiler", "build_type", "arch" options = { "shared": [True, False], "fPIC": [True, False], "with_code_gen": [True, False], + "with_sdbus": ["systemd", "basu"], } default_options = { "shared": False, "fPIC": True, "with_code_gen": False, + "with_sdbus": "systemd", } - generators = "PkgConfigDeps", "VirtualBuildEnv" @property def _minimum_cpp_standard(self): @@ -37,15 +41,26 @@ def _minimum_cpp_standard(self): @property def _minimum_compilers_version(self): + # non-trivial designated initializers are not supported in gcc < 8 + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55606 return { - "gcc": "7", + "gcc": "7" if Version(self.version) < "2.0.0" else "8", "clang": "6", } - 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) + @property + def _supported_os(self): + return (["Linux"] if Version(self.version) < "1.4.0" + else ["Linux", "FreeBSD"]) + + @property + def _with_sdbus(self): + return ("basu" if self.settings.os == "FreeBSD" + else self.options.get_safe("with_sdbus", "systemd")) + + def config_options(self): + if Version(self.version) < "1.4.0" or self.settings.os != "Linux": + del self.options.with_sdbus def configure(self): if Version(self.version) < "0.9.0": @@ -54,48 +69,63 @@ def configure(self): if self.options.shared: del self.options.fPIC + def layout(self): + cmake_layout(self, src_folder="src") + def requirements(self): - self.requires("libsystemd/251.4") + if self._with_sdbus == "systemd": + self.requires("libsystemd/255.2") + elif self._with_sdbus == "basu": + self.requires("basu/0.2.1") + if self.options.with_code_gen: + # Trick: always force transitive_libs=False, in order to not propagate expat lib + # transitively even when sdbus-cpp is static, since expat is a dependency of the executable, not the lib + self.requires("expat/[>=2.6.2 <3]", transitive_libs=False) def validate(self): - if self.info.settings.compiler.get_safe("cppstd"): + if self.settings.os not in self._supported_os: + raise ConanInvalidConfiguration( + f"{self.ref} does not support {self.settings.os}") + + if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, self._minimum_cpp_standard) - min_version = self._minimum_compilers_version.get(str(self.info.settings.compiler)) - if not min_version: - self.output.warn("{} recipe lacks information about the {} compiler support.".format( - self.name, self.info.settings.compiler)) - else: - if Version(self.info.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.info.settings.compiler, self.info.settings.compiler.version)) - if self.info.settings.os != "Linux": - raise ConanInvalidConfiguration("Only Linux supported") + min_version = self._minimum_compilers_version.get(str(self.settings.compiler)) + if min_version and 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 build_requirements(self): - self.tool_requires("pkgconf/1.7.4") - if self.options.with_code_gen: - self.tool_requires("expat/2.4.8") - - 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/[>=2.2 <3]") 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.variables["BUILD_CODE_GEN"] = self.options.with_code_gen + if Version(self.version) >= "2.0.0": + tc.variables["SDBUSCPP_BUILD_CODEGEN"] = self.options.with_code_gen + else: + tc.variables["BUILD_CODE_GEN"] = self.options.with_code_gen tc.variables["BUILD_DOC"] = False tc.variables["BUILD_TESTS"] = False tc.variables["BUILD_LIBSYSTEMD"] = False + tc.variables["SDBUSCPP_BUILD_DOCS"] = False + tc.variables["SDBUSCPP_SDBUS_LIB"] = self._with_sdbus tc.generate() - # workaround for https://gitlab.kitware.com/cmake/cmake/-/issues/18150 - copy(self, "*.pc", self.generators_folder, - os.path.join(self.generators_folder, "lib", "pkgconfig")) + deps = PkgConfigDeps(self) + deps.generate() + + if self.options.with_code_gen: + deps = CMakeDeps(self) + deps.set_property("expat", "cmake_file_name", "EXPAT") + deps.generate() def build(self): - apply_conandata_patches(self) cmake = CMake(self) cmake.configure() cmake.build() @@ -129,9 +159,16 @@ def package_info(self): "cmake_target_name", "SDBusCpp::sdbus-c++") self.cpp_info.components["sdbus-c++"].set_property( "pkg_config_name", "sdbus-c++") - self.cpp_info.components["sdbus-c++"].requires.append( - "libsystemd::libsystemd") + if self._with_sdbus == "systemd": + self.cpp_info.components["sdbus-c++"].requires.append( + "libsystemd::libsystemd") + elif self._with_sdbus == "basu": + self.cpp_info.components["sdbus-c++"].requires.append( + "basu::basu") + if self.options.with_code_gen: + # Not a dependency of the lib, only of executable, but there is no way to modelize this + # with conan + self.cpp_info.components["sdbus-c++"].requires.append("expat::expat") if self.options.with_code_gen: 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/sdbus-cpp/all/patches/0001-xml2cpp-Add-missing-EXPAT-include-dirs-136.patch b/recipes/sdbus-cpp/all/patches/0001-xml2cpp-Add-missing-EXPAT-include-dirs-136.patch deleted file mode 100644 index 3d0422bc85f54..0000000000000 --- a/recipes/sdbus-cpp/all/patches/0001-xml2cpp-Add-missing-EXPAT-include-dirs-136.patch +++ /dev/null @@ -1,35 +0,0 @@ -From fb008445b15b452f461c34667f4991f5ce06e481 Mon Sep 17 00:00:00 2001 -From: bobrofon -Date: Fri, 12 Mar 2021 19:17:55 +0700 -Subject: [PATCH] xml2cpp: Add missing EXPAT include dirs (#136) - -This patch is required if EXPAT library is installed in non-standard location. -Without 'target_include_directories' cmake will find EXPAT library: - ... - -- Found EXPAT: .../lib/libexpat.a (found version "2.2.10") - ... - -But 'xml.cpp' compilation will fail with error: - ... - tools/xml2cpp-codegen/xml.cpp:7:10: fatal error: expat.h: No such file or directory - 7 | #include - ... ---- - tools/CMakeLists.txt | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt -index 375c379..8d7a3d0 100644 ---- a/tools/CMakeLists.txt -+++ b/tools/CMakeLists.txt -@@ -43,6 +43,7 @@ set(CMAKE_CXX_STANDARD 14) - - add_executable(sdbus-c++-xml2cpp ${SDBUSCPP_XML2CPP_SRCS}) - target_link_libraries (sdbus-c++-xml2cpp ${EXPAT_LIBRARIES}) -+target_include_directories(sdbus-c++-xml2cpp PRIVATE ${EXPAT_INCLUDE_DIRS}) - - #---------------------------------- - # INSTALLATION --- -2.31.1 - diff --git a/recipes/sdbus-cpp/all/patches/0002-correct-readme-cpack-resource-path.patch b/recipes/sdbus-cpp/all/patches/0002-correct-readme-cpack-resource-path.patch deleted file mode 100644 index 5b37424cc3112..0000000000000 --- a/recipes/sdbus-cpp/all/patches/0002-correct-readme-cpack-resource-path.patch +++ /dev/null @@ -1,20 +0,0 @@ -diff --color -Naur --label a/CMakeLists.txt --label b/CMakeLists.txt a/CMakeLists.txt b/CMakeLists.txt ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -180,7 +180,6 @@ - #---------------------------------- - - option(BUILD_DOC "Build documentation for sdbus-c++" ON) -- - if(BUILD_DOC) - message(STATUS "Building with documentation") - option(BUILD_DOXYGEN_DOC "Build doxygen documentation for sdbus-c++ API" OFF) -@@ -217,7 +216,7 @@ - set(CPACK_PACKAGE_VENDOR "Kistler") - set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "high-level C++ D-Bus library") - set(CPACK_PACKAGE_CONTACT "info@kistler.com") --set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.md") -+set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md") - set(CPACK_COMPONENTS_ALL runtime dev doc) - set(CPACK_COMPONENT_DEV_DEPENDS "runtime") - diff --git a/recipes/sdbus-cpp/all/test_pkgconf/conanfile.py b/recipes/sdbus-cpp/all/test_pkgconf/conanfile.py index 14a7f949ac19a..3b0485074eb5d 100644 --- a/recipes/sdbus-cpp/all/test_pkgconf/conanfile.py +++ b/recipes/sdbus-cpp/all/test_pkgconf/conanfile.py @@ -3,7 +3,6 @@ from conan import ConanFile from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout -from conan.tools.files import copy class SdbusCppTestConan(ConanFile): @@ -11,19 +10,14 @@ class SdbusCppTestConan(ConanFile): 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): - # workaround for https://gitlab.kitware.com/cmake/cmake/-/issues/18150 - copy(self, "*.pc", self.generators_folder, - os.path.join(self.generators_folder, "lib", "pkgconfig")) + self.tool_requires("pkgconf/[>=2.2 <3]") def build(self): cmake = CMake(self) diff --git a/recipes/sdbus-cpp/all/test_v1_pkgconf/conanfile.py b/recipes/sdbus-cpp/all/test_v1_pkgconf/conanfile.py index 22690852ece67..710a613734954 100644 --- a/recipes/sdbus-cpp/all/test_v1_pkgconf/conanfile.py +++ b/recipes/sdbus-cpp/all/test_v1_pkgconf/conanfile.py @@ -11,7 +11,7 @@ class SdbusCppTestConan(ConanFile): generators = ("cmake", "pkg_config") def build_requirements(self): - self.tool_requires("pkgconf/1.7.4") + self.tool_requires("pkgconf/[>=2.2 <3]") def build(self): cmake = CMake(self) diff --git a/recipes/sdbus-cpp/config.yml b/recipes/sdbus-cpp/config.yml index 027c0dc56075d..b633474143962 100644 --- a/recipes/sdbus-cpp/config.yml +++ b/recipes/sdbus-cpp/config.yml @@ -1,4 +1,12 @@ versions: + "2.0.0": + folder: all + "1.5.0": + folder: all + "1.4.0": + folder: all + "1.3.0": + folder: all "1.2.0": folder: all "1.1.0": diff --git a/recipes/sdf/all/test_package/CMakeLists.txt b/recipes/sdf/all/test_package/CMakeLists.txt index afcf11bbd8776..0e0a1b879f436 100644 --- a/recipes/sdf/all/test_package/CMakeLists.txt +++ b/recipes/sdf/all/test_package/CMakeLists.txt @@ -2,7 +2,6 @@ cmake_minimum_required(VERSION 3.1) project(test_package LANGUAGES C) find_package(sdf REQUIRED CONFIG) -find_package(stb REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE sdf::sdf stb::stb) +target_link_libraries(${PROJECT_NAME} PRIVATE sdf::sdf) diff --git a/recipes/sdf/all/test_package/conanfile.py b/recipes/sdf/all/test_package/conanfile.py index ad5b8f9465ed6..0a6bc68712d90 100644 --- a/recipes/sdf/all/test_package/conanfile.py +++ b/recipes/sdf/all/test_package/conanfile.py @@ -14,7 +14,6 @@ def layout(self): def requirements(self): self.requires(self.tested_reference_str) - self.requires("stb/cci.20210910") def build(self): cmake = CMake(self) @@ -24,5 +23,4 @@ def build(self): def test(self): 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(f"{bin_path} {img_path}", env="conanrun") + self.run(bin_path, env="conanrun") diff --git a/recipes/sdf/all/test_package/test.png b/recipes/sdf/all/test_package/test.png deleted file mode 100644 index 568aa3449320a..0000000000000 Binary files a/recipes/sdf/all/test_package/test.png and /dev/null differ diff --git a/recipes/sdf/all/test_package/test_package.c b/recipes/sdf/all/test_package/test_package.c index 808fd873709a9..01f233e85fca3 100644 --- a/recipes/sdf/all/test_package/test_package.c +++ b/recipes/sdf/all/test_package/test_package.c @@ -3,35 +3,14 @@ #define SDF_IMPLEMENTATION #include "sdf.h" -#define STB_IMAGE_IMPLEMENTATION -#include "stb_image.h" - int main(int argc, char **argv) { - if (argc < 2) { - fprintf(stderr, "Need at least one argument\n"); - return 1; - } - - int width, height, bpp; - unsigned char* img_data = stbi_load(argv[1], &width, &height, &bpp, 0); - if(img_data == NULL) - { - fprintf(stderr, "Could not load image: %s\n", stbi_failure_reason()); - return 1; - } - - unsigned char* dest_data = malloc(width * height * bpp); - if(dest_data == NULL) - { - stbi_image_free(img_data); - return 1; - } - - sdfBuildDistanceField(dest_data, width, 2.0f, img_data, width, height, width); + unsigned char* dest_data = malloc(0); + int result = sdfBuildDistanceField(dest_data, 0, 2.0f, NULL, 0, 0, 0); + printf("Result: %d\n", result); + printf("Test"); free(dest_data); - stbi_image_free(img_data); return 0; } diff --git a/recipes/sdf/all/test_v1_package/CMakeLists.txt b/recipes/sdf/all/test_v1_package/CMakeLists.txt index ee4e3e06a56c5..a27e3332baf0d 100644 --- a/recipes/sdf/all/test_v1_package/CMakeLists.txt +++ b/recipes/sdf/all/test_v1_package/CMakeLists.txt @@ -5,7 +5,6 @@ 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) +target_link_libraries(${PROJECT_NAME} PRIVATE sdf::sdf) diff --git a/recipes/sdf/all/test_v1_package/conanfile.py b/recipes/sdf/all/test_v1_package/conanfile.py index 855f0ca3462a1..38f4483872d47 100644 --- a/recipes/sdf/all/test_v1_package/conanfile.py +++ b/recipes/sdf/all/test_v1_package/conanfile.py @@ -6,9 +6,6 @@ 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() @@ -17,5 +14,4 @@ def build(self): 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) + self.run(bin_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 e96121e1d9435..a225ab98d3530 100644 --- a/recipes/sdl/all/conandata.yml +++ b/recipes/sdl/all/conandata.yml @@ -1,36 +1,33 @@ sources: - "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" + "2.30.9": + url: "https://www.libsdl.org/release/SDL2-2.30.9.tar.gz" + sha256: "24b574f71c87a763f50704bbb630cbe38298d544a1f890f099a4696b1d6beba4" + "2.30.8": + url: "https://www.libsdl.org/release/SDL2-2.30.8.tar.gz" + sha256: "380c295ea76b9bd72d90075793971c8bcb232ba0a69a9b14da4ae8f603350058" + "2.30.7": + url: "https://www.libsdl.org/release/SDL2-2.30.7.tar.gz" + sha256: "2508c80438cd5ff3bbeb8fe36b8f3ce7805018ff30303010b61b03bb83ab9694" + "2.30.6": + url: "https://www.libsdl.org/release/SDL2-2.30.6.tar.gz" + sha256: "c6ef64ca18a19d13df6eb22df9aff19fb0db65610a74cc81dae33a82235cacd4" + "2.30.5": + url: "https://www.libsdl.org/release/SDL2-2.30.5.tar.gz" + sha256: "f374f3fa29c37dfcc20822d4a7d7dc57e58924d1a5f2ad511bfab4c8193de63b" + "2.30.4": + url: "https://www.libsdl.org/release/SDL2-2.30.4.tar.gz" + sha256: "59c89d0ed40d4efb23b7318aa29fe7039dbbc098334b14f17f1e7e561da31a26" + "2.28.5": + url: "https://www.libsdl.org/release/SDL2-2.28.5.tar.gz" + sha256: "332cb37d0be20cb9541739c61f79bae5a477427d79ae85e352089afdaf6666e4" + "2.28.3": + url: "https://www.libsdl.org/release/SDL2-2.28.3.tar.gz" + sha256: "7acb8679652701a2504d734e2ba7543ec1a83e310498ddd22fd44bf965eb5518" "2.0.20": url: "https://www.libsdl.org/release/SDL2-2.0.20.tar.gz" sha256: "c56aba1d7b5b0e7e999e4a7698c70b63a3394ff9704b5f6e1c57e0c16f04dd06" - "2.0.18": - url: "https://www.libsdl.org/release/SDL2-2.0.18.tar.gz" - sha256: "94d40cd73dbfa10bb6eadfbc28f355992bb2d6ef6761ad9d4074eff95ee5711c" - "2.0.16": - url: "https://www.libsdl.org/release/SDL2-2.0.16.tar.gz" - sha256: "65be9ff6004034b5b2ce9927b5a4db1814930f169c4b2dae0a1e4697075f287b" - "2.0.14": - url: "https://www.libsdl.org/release/SDL2-2.0.14.tar.gz" - sha256: "d8215b571a581be1332d2106f8036fcb03d12a70bae01e20f424976d275432bc" patches: "2.0.20": - patch_file: "patches/0004-2.0.20-ndk.patch" - base_path: "source_subfolder" - "2.0.16": - - patch_file: "patches/0003-2.0.16-wayland-scanner-buildrequires.patch" - base_path: "source_subfolder" - "2.0.14": - - patch_file: "patches/0001-fix-cmake-ios-tvos.patch" - base_path: "source_subfolder" - - patch_file: "patches/0002-mingw-improvements.patch" - base_path: "source_subfolder" - - patch_file: "patches/0003-2.0.14-wayland-scanner-buildrequires.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "ndk patch" diff --git a/recipes/sdl/all/conanfile.py b/recipes/sdl/all/conanfile.py index 698a088fe228a..7da398025b290 100644 --- a/recipes/sdl/all/conanfile.py +++ b/recipes/sdl/all/conanfile.py @@ -1,25 +1,25 @@ 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.55.0" class SDLConan(ConanFile): name = "sdl" description = "Access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL, Direct3D and Vulkan" - topics = ("sdl2", "audio", "keyboard", "graphics", "opengl") + license = "Zlib" url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.libsdl.org" - license = "Zlib" - + topics = ("sdl2", "audio", "keyboard", "graphics", "opengl") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -49,6 +49,7 @@ class SDLConan(ConanFile): "opengles": [True, False], "vulkan": [True, False], "libunwind": [True, False], + "hidapi": [True, False], } default_options = { "shared": False, @@ -58,7 +59,7 @@ class SDLConan(ConanFile): "jack": False, "pulse": True, "sndio": False, - "nas": True, + "nas": False, "esd": False, "arts": False, "x11": True, @@ -71,34 +72,46 @@ class SDLConan(ConanFile): "xvm": True, "wayland": True, "directfb": False, - "iconv": True, "video_rpi": False, "sdl2main": True, "opengl": True, "opengles": True, "vulkan": True, "libunwind": True, + "hidapi": True, } - - generators = ["cmake", "pkg_config"] + generators = "CMakeDeps", "PkgConfigDeps", "VirtualBuildEnv" @property - def _source_subfolder(self): - return "source_subfolder" + def _is_clang_cl(self): + return self.settings.os == "Windows" and self.settings.compiler == "clang" and \ + self.settings.compiler.get_safe("runtime") - @property - def _build_subfolder(self): - return "build_subfolder" + def layout(self): + cmake_layout(self, src_folder="src") + + 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)) + + 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): + # Don't depend on iconv on macOS by default + # SDL2 depends on many system freamworks, + # which depend on the system-provided iconv + # and can conflict with the Conan provided one + self.options.iconv = self.settings.os != "Macos" + if self.settings.os == "Windows": del self.options.fPIC - if is_msvc(self): + if (is_msvc(self) or self._is_clang_cl): del self.options.iconv if self.settings.os != "Linux": del self.options.alsa @@ -125,35 +138,34 @@ 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") + # TODO: C++ is also required for WinRT and Haiku + if not (self.settings.os == "Android" and self.options.hidapi): + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") def requirements(self): if self.options.get_safe("iconv", False): self.requires("libiconv/1.17") if self.settings.os == "Linux": if self.options.alsa: - self.requires("libalsa/1.2.7.2") + self.requires("libalsa/1.2.10") if self.options.pulse: self.requires("pulseaudio/14.2") if self.options.opengl: self.requires("opengl/system") if self.options.nas: - self.requires("nas/1.9.4") + self.requires("nas/1.9.5") if self.options.wayland: - self.requires("wayland/1.21.0") - self.requires("xkbcommon/1.4.1") + self.requires("wayland/1.22.0") + self.requires("xkbcommon/1.6.0") self.requires("egl/system") if self.options.libunwind: - self.requires("libunwind/1.6.2") + self.requires("libunwind/1.8.0") def validate(self): - if self.settings.os == "Macos" and not self.options.iconv: - raise ConanInvalidConfiguration("On macOS iconv can't be disabled") - # SDL>=2.0.18 requires xcode 12 or higher because it uses CoreHaptics. - if Version(self.version) >= "2.0.18" and is_apple_os(self) and Version(self.settings.compiler.version) < "12": + if is_apple_os(self) and Version(self.settings.compiler.version) < "12": raise ConanInvalidConfiguration("{}/{} requires xcode 12 or higher".format(self.name, self.version)) if self.settings.os == "Linux": @@ -171,213 +183,171 @@ def package_id(self): del self.info.options.sdl2main def build_requirements(self): - if self.settings.os == "Macos" and cross_building(self): - # 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") - if self.settings.os == "Linux": - self.build_requires("pkgconf/1.7.4") + self.tool_requires("cmake/[>3.27 <4]") + if self.settings.os == "Linux" and not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/2.1.0") if hasattr(self, "settings_build") and self.options.get_safe("wayland"): - self.build_requires("wayland/1.20.0") # Provides wayland-scanner + self.build_requires("wayland/1.22.0") # Provides wayland-scanner 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) def _patch_sources(self): apply_conandata_patches(self) - replace_in_file(self, os.path.join(self._source_subfolder, "CMakeLists.txt"), - 'check_library_exists(c iconv_open "" HAVE_BUILTIN_ICONV)', - '# check_library_exists(c iconv_open "" HAVE_BUILTIN_ICONV)') + if Version(self.version) < "2.30.0": + cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") + if self.settings.os == "Macos": + if self.options.iconv: + # If using conan-provided iconv, search for the symbol "libiconv_open" + replace_check = "check_library_exists(iconv libiconv_open" + else: + # When no tusing conan-provided icon, don't check for iconv at all + replace_check = "#check_library_exists(iconv iconv_open" + replace_in_file(self, cmakelists, "check_library_exists(iconv iconv_open", + replace_check) + + # Avoid assuming iconv is available if it is provided by the C runtime, + # and let SDL build the fallback implementation + replace_in_file(self, cmakelists, + 'check_library_exists(c iconv_open "" HAVE_BUILTIN_ICONV)', + '# check_library_exists(c iconv_open "" HAVE_BUILTIN_ICONV)') # Ensure to find wayland-scanner from wayland recipe in build requirements (or requirements if 1 profile) - 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) + if self.options.get_safe("wayland"): replace_in_file(self, - os.path.join(self._source_subfolder, "cmake", "sdlchecks.cmake"), + 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), + 'find_program(WAYLAND_SCANNER NAMES wayland-scanner REQUIRED PATHS "${WAYLAND_BIN_DIR}" NO_DEFAULT_PATH)', ) + if Version(self.version) >= "2.30.6" and not self.options.shared: + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "list(APPEND targets SDL2-static)", "set(targets SDL2-static)") - @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 - 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 - - 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 - if self.settings.os == "Linux": - # See https://github.com/bincrafters/community/issues/696 - cmake.definitions["SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS"] = 1 - - cmake.definitions["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 - if self.options.jack: - cmake.definitions["JACK_SHARED"] = self.deps_cpp_info["jack"].shared - cmake.definitions["ESD"] = self.options.esd - if self.options.esd: - cmake.definitions["ESD_SHARED"] = self.deps_cpp_info["esd"].shared - cmake.definitions["PULSEAUDIO"] = self.options.pulse - if self.options.pulse: - cmake.definitions["PULSEAUDIO_SHARED"] = self.deps_cpp_info["pulseaudio"].shared - cmake.definitions["SNDIO"] = self.options.sndio - if self.options.sndio: - cmake.definitions["SNDIO_SHARED"] = self.deps_cpp_info["sndio"].shared - cmake.definitions["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 - if self.options.x11: - cmake.definitions["HAVE_XEXT_H"] = True - cmake.definitions["VIDEO_X11_XCURSOR"] = self.options.xcursor - if self.options.xcursor: - cmake.definitions["HAVE_XCURSOR_H"] = True - cmake.definitions["VIDEO_X11_XINERAMA"] = self.options.xinerama - if self.options.xinerama: - cmake.definitions["HAVE_XINERAMA_H"] = True - cmake.definitions["VIDEO_X11_XINPUT"] = self.options.xinput - if self.options.xinput: - cmake.definitions["HAVE_XINPUT_H"] = True - cmake.definitions["VIDEO_X11_XRANDR"] = self.options.xrandr - if self.options.xrandr: - cmake.definitions["HAVE_XRANDR_H"] = True - cmake.definitions["VIDEO_X11_XSCRNSAVER"] = self.options.xscrnsaver - if self.options.xscrnsaver: - cmake.definitions["HAVE_XSS_H"] = True - cmake.definitions["VIDEO_X11_XSHAPE"] = self.options.xshape - if self.options.xshape: - cmake.definitions["HAVE_XSHAPE_H"] = True - cmake.definitions["VIDEO_X11_XVM"] = self.options.xvm - if self.options.xvm: - cmake.definitions["HAVE_XF86VM_H"] = True - cmake.definitions["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.definitions["VIDEO_DIRECTFB"] = self.options.directfb - cmake.definitions["VIDEO_RPI"] = self.options.video_rpi - cmake.definitions["HAVE_LIBUNWIND_H"] = self.options.libunwind - elif self.settings.os == "Windows": - cmake.definitions["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 - if self.settings.os == "Linux": - # See https://github.com/bincrafters/community/issues/696 - cmake.definitions["SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS"] = 1 - - cmake.definitions["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 - if self.options.jack: - cmake.definitions["SDL_JACK_SHARED"] = self.deps_cpp_info["jack"].shared - cmake.definitions["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 - if self.options.pulse: - cmake.definitions["SDL_PULSEAUDIO_SHARED"] = self.deps_cpp_info["pulseaudio"].shared - cmake.definitions["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 - 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 - if self.options.x11: - cmake.definitions["HAVE_XEXT_H"] = True - cmake.definitions["SDL_X11_XCURSOR"] = self.options.xcursor - if self.options.xcursor: - cmake.definitions["HAVE_XCURSOR_H"] = True - cmake.definitions["SDL_X11_XINERAMA"] = self.options.xinerama - if self.options.xinerama: - cmake.definitions["HAVE_XINERAMA_H"] = True - cmake.definitions["SDL_X11_XINPUT"] = self.options.xinput - if self.options.xinput: - cmake.definitions["HAVE_XINPUT_H"] = True - cmake.definitions["SDL_X11_XRANDR"] = self.options.xrandr - if self.options.xrandr: - cmake.definitions["HAVE_XRANDR_H"] = True - cmake.definitions["SDL_X11_XSCRNSAVER"] = self.options.xscrnsaver - if self.options.xscrnsaver: - cmake.definitions["HAVE_XSS_H"] = True - cmake.definitions["SDL_X11_XSHAPE"] = self.options.xshape - if self.options.xshape: - cmake.definitions["HAVE_XSHAPE_H"] = True - cmake.definitions["SDL_X11_XVM"] = self.options.xvm - if self.options.xvm: - cmake.definitions["HAVE_XF86VM_H"] = True - cmake.definitions["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.definitions["SDL_DIRECTFB"] = self.options.directfb - cmake.definitions["SDL_RPI"] = self.options.video_rpi - cmake.definitions["HAVE_LIBUNWIND_H"] = self.options.libunwind - elif self.settings.os == "Windows": - cmake.definitions["SDL_DIRECTX"] = self.options.directx + tc.variables["SDL_STATIC_PIC"] = self.options.fPIC + if (is_msvc(self) or self._is_clang_cl) and not self.options.shared: + tc.variables["HAVE_LIBC"] = True + tc.variables["SDL_SHARED"] = self.options.shared + tc.variables["SDL_STATIC"] = not self.options.shared + tc.variables["SDL_TEST"] = False + tc.variables["SDL_OPENGL"] = self.options.opengl + tc.variables["SDL_OPENGLES"] = self.options.opengles + tc.variables["SDL_VULKAN"] = self.options.vulkan + tc.variables["SDL_HIDAPI"] = self.options.hidapi + if self.settings.os == "Linux": + # See https://github.com/bincrafters/community/issues/696 + tc.variables["SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS"] = 1 + + tc.variables["SDL_ALSA"] = self.options.alsa + if self.options.alsa: + tc.variables["SDL_ALSA_SHARED"] = self.dependencies["libalsa"].options.shared + tc.variables["HAVE_ASOUNDLIB_H"] = True + tc.variables["HAVE_LIBASOUND"] = True + tc.variables["SDL_JACK"] = self.options.jack + if self.options.jack: + tc.variables["SDL_JACK_SHARED"] = self.options["jack"].shared + tc.variables["SDL_ESD"] = self.options.esd + if self.options.esd: + tc.variables["SDL_ESD_SHARED"] = self.options["esd"].shared + tc.variables["SDL_PULSEAUDIO"] = self.options.pulse + if self.options.pulse: + tc.variables["SDL_PULSEAUDIO_SHARED"] = self.dependencies["pulseaudio"].options.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: + 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 += self.dependencies["nas"].cpp_info.includedirs + tc.variables["SDL_NAS_SHARED"] = self.dependencies["nas"].options.shared + tc.variables["SDL_X11"] = self.options.x11 + if self.options.x11: + tc.variables["HAVE_XEXT_H"] = True + tc.variables["SDL_X11_XCURSOR"] = self.options.xcursor + if self.options.xcursor: + tc.variables["HAVE_XCURSOR_H"] = True + tc.variables["SDL_X11_XINERAMA"] = self.options.xinerama + if self.options.xinerama: + tc.variables["HAVE_XINERAMA_H"] = True + tc.variables["SDL_X11_XINPUT"] = self.options.xinput + if self.options.xinput: + tc.variables["HAVE_XINPUT_H"] = True + tc.variables["SDL_X11_XRANDR"] = self.options.xrandr + if self.options.xrandr: + tc.variables["HAVE_XRANDR_H"] = True + tc.variables["SDL_X11_XSCRNSAVER"] = self.options.xscrnsaver + if self.options.xscrnsaver: + tc.variables["HAVE_XSS_H"] = True + tc.variables["SDL_X11_XSHAPE"] = self.options.xshape + if self.options.xshape: + tc.variables["HAVE_XSHAPE_H"] = True + tc.variables["SDL_X11_XVM"] = self.options.xvm + if self.options.xvm: + 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(it) for it in self.dependencies["wayland"].cpp_info.libdirs] + tc.variables["SDL_WAYLAND_SHARED"] = self.dependencies["wayland"].options.shared + + wayland = self.dependencies["wayland"] if not hasattr(self, "settings_build") else self.dependencies.build["wayland"] + wayland_bin_dir = wayland.cpp_info.bindirs[0] # for wayland scanner + tc.variables["WAYLAND_BIN_DIR"] = wayland_bin_dir + + 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": + 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 + if Version(self.version) >= "2.30.0": + tc.variables["SDL_LIBICONV"] = self.options.get_safe("iconv", False) + tc.variables["SDL_SYSTEM_ICONV"] = False # 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).replace(os.sep, '/') + tc.variables["EXTRA_LIBS"] = ";".join(cmake_extra_libs) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + 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): - if self.version >= "2.0.16": - self.copy(pattern="LICENSE.txt", dst="licenses", src=self._source_subfolder) - else: - self.copy(pattern="COPYING.txt", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + cmake = CMake(self) cmake.install() + + copy(self, pattern="LICENSE.txt", src=os.path.join(self.source_folder), dst=os.path.join(self.package_folder, "licenses")) rm(self, "sdl2-config", os.path.join(self.package_folder, "bin")) + 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, "cmake")) rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) @@ -394,7 +364,7 @@ def package_info(self): # SDL2 lib_postfix = postfix - if self.version >= "2.0.24" and is_msvc(self) and not self.options.shared: + if self.version >= "2.0.24" and (is_msvc(self) or self._is_clang_cl) and not self.options.shared: lib_postfix = "-static" + postfix self.cpp_info.components["libsdl2"].set_property("cmake_target_name", "SDL2::SDL2") @@ -449,28 +419,35 @@ def package_info(self): "CoreVideo", "CoreAudio", "AudioToolbox", "AVFoundation", "Foundation", "QuartzCore", ] - add_core_haptics = False if self.settings.os == "Macos": - self.cpp_info.components["libsdl2"].frameworks.extend(["Cocoa", "Carbon", "IOKit", "ForceFeedback"]) - if Version(self.version) >= "2.0.18": - self.cpp_info.components["libsdl2"].frameworks.append("GameController") + self.cpp_info.components["libsdl2"].frameworks.extend([ + "Cocoa", + "Carbon", + "IOKit", + "ForceFeedback", + "CoreFoundation", + "CoreServices", + "AppKit" + ]) + self.cpp_info.components["libsdl2"].frameworks.append("GameController") elif self.settings.os in ["iOS", "tvOS", "watchOS"]: self.cpp_info.components["libsdl2"].frameworks.extend([ "UIKit", "OpenGLES", "GameController", "CoreMotion", "CoreGraphics", "CoreBluetooth", ]) - add_core_haptics = True - if Version(self.version) >= "2.0.14": - self.cpp_info.components["libsdl2"].frameworks.append("Metal") - if Version(self.version) >= "2.0.18": - add_core_haptics = True - if add_core_haptics: - self.cpp_info.components["libsdl2"].sharedlinkflags.append("-Wl,-weak_framework,CoreHaptics") - self.cpp_info.components["libsdl2"].exelinkflags.append("-Wl,-weak_framework,CoreHaptics") + + self.cpp_info.components["libsdl2"].frameworks.append("Metal") + self.cpp_info.components["libsdl2"].sharedlinkflags.append("-Wl,-weak_framework,CoreHaptics") + self.cpp_info.components["libsdl2"].exelinkflags.append("-Wl,-weak_framework,CoreHaptics") elif self.settings.os == "Windows": 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"]) + self.cpp_info.components["libsdl2"].system_libs.append("OpenSLES") # SDL2main if self.options.sdl2main: diff --git a/recipes/sdl/all/patches/0001-fix-cmake-ios-tvos.patch b/recipes/sdl/all/patches/0001-fix-cmake-ios-tvos.patch deleted file mode 100644 index 7a56e3d843ff6..0000000000000 --- a/recipes/sdl/all/patches/0001-fix-cmake-ios-tvos.patch +++ /dev/null @@ -1,26 +0,0 @@ -see https://github.com/libsdl-org/SDL/commit/471d3c363e654c7ad10782f50cb47e639c0646c3 - ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -131,6 +131,8 @@ elseif(APPLE) - set(MACOSX TRUE) - elseif(CMAKE_SYSTEM_NAME MATCHES ".*tvOS.*") - set(TVOS TRUE) -+ elseif(CMAKE_SYSTEM_NAME MATCHES ".*iOS.*") -+ set(IOS TRUE) - endif() - # TODO: iOS? - elseif(CMAKE_SYSTEM_NAME MATCHES "BeOS.*") -@@ -1668,7 +1670,11 @@ elseif(APPLE) - message_error("SDL_FILE must be enabled to build on MacOS X") - endif() - -- file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/macosx/*.m) -+ if(IOS OR TVOS) -+ file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/ios/*.m) -+ else() -+ file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/macosx/*.m) -+ endif() - set(SOURCE_FILES ${SOURCE_FILES} ${MISC_SOURCES}) - set(HAVE_SDL_MISC TRUE) - diff --git a/recipes/sdl/all/patches/0002-mingw-improvements.patch b/recipes/sdl/all/patches/0002-mingw-improvements.patch deleted file mode 100644 index 250f0b8951359..0000000000000 --- a/recipes/sdl/all/patches/0002-mingw-improvements.patch +++ /dev/null @@ -1,27 +0,0 @@ -Upstream-pull-request: https://github.com/libsdl-org/SDL/pull/4492 -Upstream-pull-request-status: Merged ---- - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index b9b9eb62..454a0bbd 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -2092,7 +2092,8 @@ if(NOT CMAKE_HOST_WIN32) - execute_process(COMMAND sh ${SDL2_SOURCE_DIR}/build-scripts/updaterev.sh - WORKING_DIRECTORY ${SDL2_BINARY_DIR}) - endif() --if(NOT WINDOWS OR CYGWIN) -+if(NOT WINDOWS OR CYGWIN OR MINGW) -+ - set(prefix ${CMAKE_INSTALL_PREFIX}) - set(exec_prefix "\${prefix}") - set(libdir "\${exec_prefix}/lib${LIB_SUFFIX}") -@@ -2361,7 +2361,7 @@ else() - set(SOPOSTFIX "") - endif() - --if(NOT (WINDOWS OR CYGWIN)) -+if(NOT (WINDOWS OR CYGWIN OR MINGW)) - if(SDL_SHARED) - set(SOEXT ${CMAKE_SHARED_LIBRARY_SUFFIX}) # ".so", ".dylib", etc. - get_target_property(SONAME SDL2 OUTPUT_NAME) diff --git a/recipes/sdl/all/patches/0003-2.0.14-wayland-scanner-buildrequires.patch b/recipes/sdl/all/patches/0003-2.0.14-wayland-scanner-buildrequires.patch deleted file mode 100644 index d6352aaac4789..0000000000000 --- a/recipes/sdl/all/patches/0003-2.0.14-wayland-scanner-buildrequires.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- a/cmake/sdlchecks.cmake -+++ b/cmake/sdlchecks.cmake -@@ -593,9 +593,10 @@ endmacro() - # - HAVE_DLOPEN opt - macro(CheckWayland) - if(VIDEO_WAYLAND) -- pkg_check_modules(WAYLAND wayland-client wayland-scanner wayland-egl wayland-cursor egl xkbcommon) -+ pkg_check_modules(WAYLAND wayland-client wayland-egl wayland-cursor egl xkbcommon) - - if(WAYLAND_FOUND) -+ if(0) - execute_process( - COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=wayland_scanner wayland-scanner - WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" -@@ -607,6 +608,8 @@ macro(CheckWayland) - if(NOT WAYLAND_SCANNER_RC EQUAL 0) - set(WAYLAND_FOUND FALSE) - endif() -+ endif() -+ set(WAYLAND_SCANNER "wayland-scanner") - endif() - - if(WAYLAND_FOUND) diff --git a/recipes/sdl/all/patches/0003-2.0.16-wayland-scanner-buildrequires.patch b/recipes/sdl/all/patches/0003-2.0.16-wayland-scanner-buildrequires.patch deleted file mode 100644 index 664a37968e03a..0000000000000 --- a/recipes/sdl/all/patches/0003-2.0.16-wayland-scanner-buildrequires.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- a/cmake/sdlchecks.cmake -+++ b/cmake/sdlchecks.cmake -@@ -628,10 +628,10 @@ endmacro() - # - HAVE_DLOPEN opt - macro(CheckWayland) - if(VIDEO_WAYLAND) -- pkg_check_modules(WAYLAND wayland-client wayland-scanner wayland-egl wayland-cursor egl xkbcommon) -- pkg_check_modules(WAYLAND_SCANNER_1_15 "wayland-scanner>=1.15") -+ pkg_check_modules(WAYLAND wayland-client wayland-egl wayland-cursor egl xkbcommon) - - if(WAYLAND_FOUND AND HAVE_VIDEO_OPENGL_EGL) -+ if(0) - execute_process( - COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=wayland_scanner wayland-scanner - WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" -@@ -643,6 +643,8 @@ macro(CheckWayland) - if(NOT WAYLAND_SCANNER_RC EQUAL 0) - set(WAYLAND_FOUND FALSE) - endif() -+ endif() -+ set(WAYLAND_SCANNER "wayland-scanner") - endif() - - if(WAYLAND_FOUND) 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..c21bd201e65b8 100644 --- a/recipes/sdl/all/test_package/conanfile.py +++ b/recipes/sdl/all/test_package/conanfile.py @@ -1,27 +1,31 @@ -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 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 54cef5c632d3a..dab026397aa4f 100644 --- a/recipes/sdl/config.yml +++ b/recipes/sdl/config.yml @@ -1,15 +1,23 @@ versions: - "2.26.0": + "2.30.9": folder: all - "2.24.1": + "2.30.8": folder: all - "2.24.0": + "2.30.7": folder: all - "2.0.20": + "2.30.6": + folder: all + # keep 2.30.5 for sdl_mixer + "2.30.5": folder: all - "2.0.18": + "2.30.4": folder: all - "2.0.16": + # keep 2.28.5 for pdcurses, ffmpeg, sdl_net, sdl_mixer + "2.28.5": folder: all - "2.0.14": + # keep 2.28.3 for sdl_image, sdl_ttf + "2.28.3": + folder: all + # keep 2.0.20 for magnum, ogre + "2.0.20": folder: all diff --git a/recipes/sdl_image/all/CMakeLists.txt b/recipes/sdl_image/all/CMakeLists.txt index 0a8d9782df248..6554bf914af3f 100644 --- a/recipes/sdl_image/all/CMakeLists.txt +++ b/recipes/sdl_image/all/CMakeLists.txt @@ -7,9 +7,6 @@ macro(add_image_option type) option(${type} "${type} images support" ON) if(${type}) add_definitions("-DLOAD_${type}") - if(${type}_DYNAMIC) - add_definitions("-DLOAD_${type}_DYNAMIC") - endif() endif() endmacro() diff --git a/recipes/sdl_image/all/conandata.yml b/recipes/sdl_image/all/conandata.yml index bc34556c048dd..b4f1bea806d43 100644 --- a/recipes/sdl_image/all/conandata.yml +++ b/recipes/sdl_image/all/conandata.yml @@ -1,4 +1,16 @@ sources: + "2.8.2": + url: "https://github.com/libsdl-org/SDL_image/releases/download/release-2.8.2/SDL2_image-2.8.2.tar.gz" + sha256: "8f486bbfbcf8464dd58c9e5d93394ab0255ce68b51c5a966a918244820a76ddc" + "2.6.3": + url: "https://github.com/libsdl-org/SDL_image/releases/download/release-2.6.3/SDL2_image-2.6.3.tar.gz" + sha256: "931c9be5bf1d7c8fae9b7dc157828b7eee874e23c7f24b44ba7eff6b4836312c" "2.0.5": url: "https://www.libsdl.org/projects/SDL_image/release/SDL2_image-2.0.5.tar.gz" sha256: "bdd5f6e026682f7d7e1be0b6051b209da2f402a2dd8bd1c4bd9c25ad263108d0" +patches: + "2.8.2": + - patch_description: "Fix webpdemux cmake target name" + patch_file: "patches/webpdemux-target.patch" + patch_source: "https://github.com/libsdl-org/SDL_image/pull/479" + patch_type: "portability" diff --git a/recipes/sdl_image/all/conanfile.py b/recipes/sdl_image/all/conanfile.py index b297bb8f25f5a..876e5bdbad7be 100644 --- a/recipes/sdl_image/all/conanfile.py +++ b/recipes/sdl_image/all/conanfile.py @@ -2,20 +2,22 @@ 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 +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 SDLImageConan(ConanFile): name = "sdl_image" description = "SDL_image is an image file loading library" - topics = ("sdl_image", "sdl_image", "sdl2", "sdl", "images", "opengl") + topics = ("sdl2", "sdl", "images", "opengl") url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.libsdl.org/projects/SDL_image/" license = "MIT" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -27,6 +29,7 @@ class SDLImageConan(ConanFile): "pnm": [True, False], "svg": [True, False], "tga": [True, False], + "qoi": [True, False], "xcf": [True, False], "xpm": [True, False], "xv": [True, False], @@ -34,7 +37,10 @@ class SDLImageConan(ConanFile): "with_libtiff": [True, False], "with_libpng": [True, False], "with_libwebp": [True, False], + "with_avif": [True, False], + "with_jxl": [True, False], "imageio": [True, False], + "wic": [True, False], } default_options = { "shared": False, @@ -46,6 +52,7 @@ class SDLImageConan(ConanFile): "pnm": True, "svg": True, "tga": True, + "qoi": True, "xcf": True, "xpm": True, "xv": True, @@ -53,78 +60,116 @@ class SDLImageConan(ConanFile): "with_libtiff": True, "with_libpng": True, "with_libwebp": True, + "with_avif": False, + "with_jxl": False, "imageio": False, + "wic": False, } - exports_sources = "CMakeLists.txt" + def export_sources(self): + export_conandata_patches(self) + if Version(self.version) < "2.6": + 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 if not is_apple_os(self): del self.options.imageio + if Version(self.version) < "2.6": + del self.options.qoi + del self.options.with_avif + del self.options.with_jxl + if self.settings.os != "Windows": + del self.options.wic 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 self.options.shared: # sdl static into sdl_image shared is not allowed self.options["sdl"].shared = True + def layout(self): + cmake_layout(self, src_folder="src") + def requirements(self): - self.requires("sdl/2.0.20") + # Headers are exposed https://github.com/conan-io/conan-center-index/pull/16167#issuecomment-1508347351 + self.requires("sdl/2.28.3", transitive_headers=True) if self.options.with_libtiff: - self.requires("libtiff/4.4.0") + self.requires("libtiff/4.6.0") if self.options.with_libjpeg: self.requires("libjpeg/9e") if self.options.with_libpng: - self.requires("libpng/1.6.37") + self.requires("libpng/[>=1.6 <2]") if self.options.with_libwebp: - self.requires("libwebp/1.2.4") + self.requires("libwebp/1.3.2") + if self.options.get_safe("with_avif"): + self.requires("libavif/1.0.1") def validate(self): - if self.info.options.shared and not self.dependencies["sdl"].options.shared: - raise ConanInvalidConfiguration("sdl_image shared requires sdl shared") + if self.options.shared and not self.dependencies["sdl"].options.shared: + raise ConanInvalidConfiguration(f"{self.ref} shared requires sdl shared") + # TODO: libjxl doesn't support conan v2(yet) + if self.options.get_safe("with_jxl"): + raise ConanInvalidConfiguration(f"{self.ref} doesn't support with_jxl (yet)") - def layout(self): - cmake_layout(self, src_folder="src") + def build_requirements(self): + if Version(self.version) >= "2.6": + self.tool_requires("cmake/[>=3.16 <4]") + + def _patch_sources(self): + apply_conandata_patches(self) 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) + self._patch_sources() def generate(self): tc = CMakeToolchain(self) - tc.variables["SDL_IMAGE_SRC_DIR"] = self.source_folder.replace("\\", "/") - tc.variables["BMP"] = self.options.bmp - tc.variables["GIF"] = self.options.gif - tc.variables["IMAGEIO"] = self.options.get_safe("imageio") - tc.variables["JPG"] = self.options.with_libjpeg - tc.variables["LBM"] = self.options.lbm - tc.variables["PCX"] = self.options.pcx - tc.variables["PNG"] = self.options.with_libpng - tc.variables["PNM"] = self.options.pnm - tc.variables["SVG"] = self.options.svg - tc.variables["TGA"] = self.options.tga - tc.variables["TIF"] = self.options.with_libtiff - tc.variables["WEBP"] = self.options.with_libwebp - tc.variables["XCF"] = self.options.xcf - tc.variables["XPM"] = self.options.xpm - tc.variables["XV"] = self.options.xv - # TODO: https://github.com/bincrafters/community/pull/1317#pullrequestreview-584847138 - tc.variables["TIF_DYNAMIC"] = self.dependencies["libtiff"].options.shared if self.options.with_libtiff else False - tc.variables["JPG_DYNAMIC"] = self.dependencies["libjpeg"].options.shared if self.options.with_libjpeg else False - tc.variables["PNG_DYNAMIC"] = self.dependencies["libpng"].options.shared if self.options.with_libpng else False - tc.variables["WEBP_DYNAMIC"] = self.dependencies["libwebp"].options.shared if self.options.with_libwebp else False - tc.variables["SDL_IS_SHARED"] = self.dependencies["sdl"].options.shared + if Version(self.version) < "2.6": + tc.variables["SDL_IMAGE_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.variables["BMP"] = self.options.bmp + tc.variables["GIF"] = self.options.gif + tc.variables["IMAGEIO"] = self.options.get_safe("imageio") + tc.variables["JPG"] = self.options.with_libjpeg + tc.variables["LBM"] = self.options.lbm + tc.variables["PCX"] = self.options.pcx + tc.variables["PNG"] = self.options.with_libpng + tc.variables["PNM"] = self.options.pnm + tc.variables["SVG"] = self.options.svg + tc.variables["TGA"] = self.options.tga + tc.variables["TIF"] = self.options.with_libtiff + tc.variables["WEBP"] = self.options.with_libwebp + tc.variables["XCF"] = self.options.xcf + tc.variables["XPM"] = self.options.xpm + tc.variables["XV"] = self.options.xv + tc.variables["SDL_IS_SHARED"] = self.dependencies["sdl"].options.shared + else: + tc.variables["SDL2IMAGE_VENDORED"] = False + tc.variables["SDL2IMAGE_DEPS_SHARED"] = False + tc.variables["SDL2IMAGE_SAMPLES"] = False + tc.variables["SDL2IMAGE_AVIF"] = self.options.get_safe("with_avif") + tc.variables["SDL2IMAGE_BMP"] = self.options.bmp + tc.variables["SDL2IMAGE_GIF"] = self.options.gif + tc.variables["SDL2IMAGE_JPG"] = self.options.with_libjpeg + tc.variables["SDL2IMAGE_JXL"] = self.options.get_safe("with_jxl") + tc.variables["SDL2IMAGE_LBM"] = self.options.lbm + tc.variables["SDL2IMAGE_PCX"] = self.options.pcx + tc.variables["SDL2IMAGE_PNG"] = self.options.with_libpng + tc.variables["SDL2IMAGE_PNM"] = self.options.pnm + tc.variables["SDL2IMAGE_QOI"] = self.options.get_safe("qoi") + tc.variables["SDL2IMAGE_SVG"] = self.options.svg + tc.variables["SDL2IMAGE_TGA"] = self.options.tga + tc.variables["SDL2IMAGE_TIF"] = self.options.with_libtiff + tc.variables["SDL2IMAGE_WEBP"] = self.options.with_libwebp + tc.variables["SDL2IMAGE_XCF"] = self.options.xcf + tc.variables["SDL2IMAGE_XPM"] = self.options.xpm + tc.variables["SDL2IMAGE_XV"] = self.options.xv + tc.variables["SDL2IMAGE_BACKEND_WIC"] = self.options.get_safe("wic") + tc.variables["SDL2IMAGE_BACKEND_IMAGEIO"] = self.options.get_safe("imageio") tc.generate() cd = CMakeDeps(self) cd.generate() @@ -132,22 +177,46 @@ def generate(self): def build(self): rmdir(self, os.path.join(self.source_folder, "external")) cmake = CMake(self) - cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) + if Version(self.version) < "2.6": + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) + else: + cmake.configure() cmake.build() + if Version(self.version) >= "2.6": + 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(self): - copy(self, "COPYING.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + if Version(self.version) < "2.6": + copy(self, "COPYING.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + else: + 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")) + 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, "SDL2_image.framework")) + rmdir(self, os.path.join(self.package_folder, "cmake")) + def package_info(self): + lib_postfix = "" + if Version(self.version) >= "2.6": + if self.settings.os == "Windows" and not self.options.shared: + lib_postfix += "-static" + if self.settings.build_type == "Debug": + lib_postfix += "d" + self.cpp_info.set_property("cmake_file_name", "SDL2_image") self.cpp_info.set_property("cmake_target_name", "SDL2_image::SDL2_image") if not self.options.shared: self.cpp_info.set_property("cmake_target_aliases", ["SDL2_image::SDL2_image-static"]) self.cpp_info.set_property("pkg_config_name", "SDL2_image") # TODO: back to global scope in conan v2 once legacy generators removed - self.cpp_info.components["_sdl_image"].libs = ["SDL2_image"] + self.cpp_info.components["_sdl_image"].libs = [f"SDL2_image{lib_postfix}"] self.cpp_info.components["_sdl_image"].includedirs.append(os.path.join("include", "SDL2")) # TODO: to remove in conan v2 once legacy generators removed @@ -168,6 +237,8 @@ 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("with_avif"): + self.cpp_info.components["_sdl_image"].requires.append("libavif::libavif") if self.options.get_safe("imageio") and not self.options.shared: self.cpp_info.components["_sdl_image"].frameworks = [ "CoreFoundation", @@ -182,3 +253,7 @@ def package_info(self): "MobileCoreServices", "UIKit", ]) + if self.options.get_safe("wic"): + self.cpp_info.system_libs.extend([ + "windowscodecs", + ]) diff --git a/recipes/sdl_image/all/patches/webpdemux-target.patch b/recipes/sdl_image/all/patches/webpdemux-target.patch new file mode 100644 index 0000000000000..beff89d55cb0a --- /dev/null +++ b/recipes/sdl_image/all/patches/webpdemux-target.patch @@ -0,0 +1,23 @@ +From 35e3cb865f8394bdc8bb2d2cf6e9f91dfd3c94bd Mon Sep 17 00:00:00 2001 +From: Andrey Filipenkov +Date: Sat, 23 Nov 2024 00:47:15 +0300 +Subject: [PATCH] fix name case of webpdemux target + +(cherry picked from commit 0d418a2a2dc562699854d9c2fc264304ec404e2c) +--- + cmake/Findwebp.cmake | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/cmake/Findwebp.cmake b/cmake/Findwebp.cmake +index 58891318..e07b377c 100644 +--- a/cmake/Findwebp.cmake ++++ b/cmake/Findwebp.cmake +@@ -43,7 +43,7 @@ if (webp_FOUND) + INTERFACE_LINK_FLAGS "${webp_LINK_FLAGS}" + ) + endif() +- if (NOT TARGET WEBP::webpdemux) ++ if (NOT TARGET WebP::webpdemux) + add_library(WebP::webpdemux UNKNOWN IMPORTED) + set_target_properties(WebP::webpdemux PROPERTIES + IMPORTED_LOCATION "${webpdemux_LIBRARY}" diff --git a/recipes/sdl_image/all/test_package/conanfile.py b/recipes/sdl_image/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/sdl_image/all/test_package/conanfile.py +++ b/recipes/sdl_image/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/sdl_image/all/test_v1_package/CMakeLists.txt b/recipes/sdl_image/all/test_v1_package/CMakeLists.txt index aff8e8c685605..0d20897301b68 100644 --- a/recipes/sdl_image/all/test_v1_package/CMakeLists.txt +++ b/recipes/sdl_image/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(SDL2_image REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -if(TARGET SDL2_image::SDL2_image-static) - target_link_libraries(${PROJECT_NAME} PRIVATE SDL2_image::SDL2_image-static) -else() - target_link_libraries(${PROJECT_NAME} PRIVATE SDL2_image::SDL2_image) -endif() +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/sdl_image/config.yml b/recipes/sdl_image/config.yml index 1630e08ca5f32..12dfc58746326 100644 --- a/recipes/sdl_image/config.yml +++ b/recipes/sdl_image/config.yml @@ -1,3 +1,7 @@ versions: + "2.8.2": + folder: "all" + "2.6.3": + folder: "all" "2.0.5": folder: "all" diff --git a/recipes/sdl_mixer/all/CMakeLists.txt b/recipes/sdl_mixer/all/CMakeLists.txt index fa206e6c5d5c7..2dfb3ecfdb114 100644 --- a/recipes/sdl_mixer/all/CMakeLists.txt +++ b/recipes/sdl_mixer/all/CMakeLists.txt @@ -1,19 +1,13 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.15) project(sdl2_mixer) -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - include(CheckTypeSize) macro(add_music_option type) option(${type} "${type} music support" OFF) message(STATUS "${type} ${${type}}") - if(${${type}}) + if(${type}) add_definitions("-DMUSIC_${type}") - if(${${type}_DYNAMIC}) - add_definitions("-D${type}_DYNAMIC") - endif() endif() endmacro() @@ -30,73 +24,78 @@ add_music_option(MID_NATIVE) add_music_option(MID_FLUIDSYNTH) add_music_option(MID_TINYMIDI) -if(${MID_NATIVE}) - -set(NATIVE_MIDI_SOURCES -source_subfolder/native_midi/native_midi_common.c -source_subfolder/native_midi/native_midi_common.h -source_subfolder/native_midi/native_midi_haiku.cpp -source_subfolder/native_midi/native_midi_mac.c -source_subfolder/native_midi/native_midi_macosx.c -source_subfolder/native_midi/native_midi_win32.c -) - -set(NATIVE_MIDI_HEADERS -source_subfolder/native_midi/native_midi.h -) - +if(MIDI_NATIVE) + set(NATIVE_MIDI_SOURCES + src/native_midi/native_midi_common.c + src/native_midi/native_midi_common.h + src/native_midi/native_midi_haiku.cpp + src/native_midi/native_midi_mac.c + src/native_midi/native_midi_macosx.c + src/native_midi/native_midi_win32.c + ) + + set(NATIVE_MIDI_HEADERS + src/native_midi/native_midi.h + ) endif() set(SOURCES -source_subfolder/effect_position.c -source_subfolder/effect_stereoreverse.c -source_subfolder/effects_internal.c -source_subfolder/load_aiff.c -source_subfolder/load_voc.c -source_subfolder/mixer.c -source_subfolder/music.c -source_subfolder/music_cmd.c -source_subfolder/music_flac.c -source_subfolder/music_fluidsynth.c -source_subfolder/music_mad.c -source_subfolder/music_mikmod.c -source_subfolder/music_modplug.c -source_subfolder/music_mpg123.c -source_subfolder/music_nativemidi.c -source_subfolder/music_ogg.c -source_subfolder/music_opus.c -source_subfolder/music_timidity.c -source_subfolder/music_wav.c -${NATIVE_MIDI_SOURCES} + src/effect_position.c + src/effect_stereoreverse.c + src/effects_internal.c + src/load_aiff.c + src/load_voc.c + src/mixer.c + src/music.c + src/music_cmd.c + src/music_flac.c + src/music_fluidsynth.c + src/music_mad.c + src/music_mikmod.c + src/music_modplug.c + src/music_mpg123.c + src/music_nativemidi.c + src/music_ogg.c + src/music_opus.c + src/music_timidity.c + src/music_wav.c + ${NATIVE_MIDI_SOURCES} ) set(HEADERS -source_subfolder/effects_internal.h -source_subfolder/load_aiff.h -source_subfolder/load_voc.h -source_subfolder/mixer.h -source_subfolder/music.h -source_subfolder/music_cmd.h -source_subfolder/music_flac.h -source_subfolder/music_fluidsynth.h -source_subfolder/music_mad.h -source_subfolder/music_mikmod.h -source_subfolder/music_modplug.h -source_subfolder/music_mpg123.h -source_subfolder/music_nativemidi.h -source_subfolder/music_ogg.h -source_subfolder/music_opus.h -source_subfolder/music_timidity.h -source_subfolder/music_wav.h -${NATIVE_MIDI_HEADERS} + src/effects_internal.h + src/load_aiff.h + src/load_voc.h + src/mixer.h + src/music.h + src/music_cmd.h + src/music_flac.h + src/music_fluidsynth.h + src/music_mad.h + src/music_mikmod.h + src/music_modplug.h + src/music_mpg123.h + src/music_nativemidi.h + src/music_ogg.h + src/music_opus.h + src/music_timidity.h + src/music_wav.h + ${NATIVE_MIDI_HEADERS} ) add_library(${PROJECT_NAME} ${SOURCES} ${HEADERS}) -target_include_directories(${PROJECT_NAME} PRIVATE "source_subfolder") +target_include_directories(${PROJECT_NAME} PRIVATE "src") -if(${MID_NATIVE}) - target_include_directories(${PROJECT_NAME} PRIVATE "source_subfolder/native_midi") +if(MIDI_NATIVE) + target_include_directories(${PROJECT_NAME} PRIVATE "src/native_midi") + if(APPLE) + # https://github.com/libsdl-org/SDL_mixer/blob/release-2.0.4/configure.in#L380 + target_link_libraries(${PROJECT_NAME} PRIVATE "-framework AudioToolbox" "-framework AudioUnit" "-framework CoreServices") + elseif(WIN32) + # https://github.com/libsdl-org/SDL_mixer/blob/release-2.0.4/configure.in#L376 + target_link_libraries(${PROJECT_NAME} PRIVATE winmm) + endif() endif() find_package(SDL2 CONFIG REQUIRED) @@ -146,9 +145,9 @@ if(MID_TINYMIDI) target_link_libraries(${PROJECT_NAME} PRIVATE tinymidi::tinymidi) endif() -set_target_properties(${PROJECT_NAME} PROPERTIES PUBLIC_HEADER source_subfolder/SDL_mixer.h) +set_target_properties(${PROJECT_NAME} PROPERTIES PUBLIC_HEADER src/SDL_mixer.h) -if(${BUILD_SHARED_LIBS}) +if(BUILD_SHARED_LIBS) target_compile_definitions(${PROJECT_NAME} PRIVATE DLL_EXPORT) endif() @@ -160,8 +159,8 @@ if(SSIZE_T STREQUAL "") endif() install(TARGETS ${PROJECT_NAME} - ARCHIVE DESTINATION "lib" - LIBRARY DESTINATION "lib" - RUNTIME DESTINATION "bin" - PUBLIC_HEADER DESTINATION "include/SDL2" + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin + PUBLIC_HEADER DESTINATION include/SDL2 ) diff --git a/recipes/sdl_mixer/all/conanfile.py b/recipes/sdl_mixer/all/conanfile.py index 7139d07a2b4ea..d2133052c545d 100644 --- a/recipes/sdl_mixer/all/conanfile.py +++ b/recipes/sdl_mixer/all/conanfile.py @@ -1,144 +1,155 @@ -from conans import CMake, tools +import os + 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 copy from conan.tools.files import get, rmdir -import os -import functools + +required_conan_version = ">=1.57.0" class SDLMixerConan(ConanFile): name = "sdl_mixer" description = "SDL_mixer is a sample multi-channel audio mixer library" - topics = ("sdl_mixer", "sdl2", "sdl", "mixer", "audio", "multimedia", "sound", "music") + license = "Zlib" url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.libsdl.org/projects/SDL_mixer/" - license = "Zlib" - exports_sources = ["CMakeLists.txt"] - generators = "cmake", "cmake_find_package_multi" + topics = ("sdl2", "sdl", "mixer", "audio", "multimedia", "sound", "music") + + package_type = "library" settings = "os", "arch", "compiler", "build_type" - options = {"shared": [True, False], - "fPIC": [True, False], - "cmd": [True, False], - "wav": [True, False], - "flac": [True, False], - "mpg123": [True, False], - "mad": [True, False], - "ogg": [True, False], - "opus": [True, False], - "mikmod": [True, False], - "modplug": [True, False], - "fluidsynth": [True, False], - "nativemidi": [True, False], - "tinymidi": [True, False]} - default_options = {"shared": False, - "fPIC": True, - "cmd": False, # needs sys/wait.h - "wav": True, - "flac": True, - "mpg123": True, - "mad": True, - "ogg": True, - "opus": True, - "mikmod": True, - "modplug": True, - "fluidsynth": False, # TODO: add fluidsynth to Conan Center - "nativemidi": True, - "tinymidi": True} - _source_subfolder = "source_subfolder" - _build_subfolder = "build_subfolder" + options = { + "shared": [True, False], + "fPIC": [True, False], + "cmd": [True, False], + "wav": [True, False], + "flac": [True, False], + "mpg123": [True, False], + "mad": [True, False], + "ogg": [True, False], + "opus": [True, False], + "mikmod": [True, False], + "modplug": [True, False], + "nativemidi": [True, False], + "tinymidi": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "cmd": False, + "wav": True, + "flac": True, + "mpg123": True, + "mad": True, + "ogg": True, + "opus": True, + "mikmod": True, + "modplug": True, + "nativemidi": True, + "tinymidi": 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 - if self.settings.os != "Linux": - del self.options.tinymidi + if self.settings.os in ["Linux", "FreeBSD"]: + self.options.rm_safe("nativemidi") else: - del self.options.nativemidi + self.options.rm_safe("tinymidi") def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") 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("sdl/2.0.20") + self.requires("sdl/2.30.5", transitive_headers=True, transitive_libs=True) if self.options.flac: - self.requires("flac/1.3.3") + self.requires("flac/1.4.2") if self.options.mpg123: - self.requires("mpg123/1.29.3") + self.requires("mpg123/1.31.2") if self.options.mad: self.requires("libmad/0.15.1b") if self.options.ogg: self.requires("ogg/1.3.5") self.requires("vorbis/1.3.7") if self.options.opus: - self.requires("openssl/1.1.1q") - self.requires("opus/1.3.1") + self.requires("openssl/[>=1.1 <4]") + self.requires("opus/1.4") self.requires("opusfile/0.12") if self.options.mikmod: self.requires("libmikmod/3.3.11.1") if self.options.modplug: self.requires("libmodplug/0.8.9.0") - if self.options.fluidsynth: - self.requires("fluidsynth/2.2") # TODO: this package is missing on the conan-center-index - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: if self.options.tinymidi: self.requires("tinymidi/cci.20130325") 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) + rmdir(self, os.path.join(self.source_folder, "external")) - rmdir(self, os.path.join(self._source_subfolder, "external")) - - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["CMD"] = self.options.cmd - cmake.definitions["WAV"] = self.options.wav - cmake.definitions["FLAC"] = self.options.flac - cmake.definitions["MP3_MPG123"] = self.options.mpg123 - cmake.definitions["MP3_MAD"] = self.options.mad - cmake.definitions["OGG"] = self.options.ogg - cmake.definitions["OPUS"] = self.options.opus - cmake.definitions["MOD_MIKMOD"] = self.options.mikmod - cmake.definitions["MOD_MODPLUG"] = self.options.modplug - cmake.definitions["MID_FLUIDSYNTH"] = self.options.fluidsynth - if self.settings.os == "Linux": - cmake.definitions["MID_TINYMIDI"] = self.options.tinymidi - cmake.definitions["MID_NATIVE"] = False + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CMD"] = self.options.cmd + tc.variables["WAV"] = self.options.wav + tc.variables["FLAC"] = self.options.flac + tc.variables["MP3_MPG123"] = self.options.mpg123 + tc.variables["MP3_MAD"] = self.options.mad + tc.variables["OGG"] = self.options.ogg + tc.variables["OPUS"] = self.options.opus + tc.variables["MOD_MIKMOD"] = self.options.mikmod + tc.variables["MOD_MODPLUG"] = self.options.modplug + tc.variables["MID_FLUIDSYNTH"] = False + if self.settings.os in ["Linux", "FreeBSD"]: + tc.variables["MID_TINYMIDI"] = self.options.tinymidi + tc.variables["MIDI_NATIVE"] = False else: - cmake.definitions["MID_TINYMIDI"] = False - cmake.definitions["MID_NATIVE"] = self.options.nativemidi - - cmake.definitions["FLAC_DYNAMIC"] = self.options["flac"].shared if self.options.flac else False - cmake.definitions["MP3_MPG123_DYNAMIC"] = self.options["mpg123"].shared if self.options.mpg123 else False - cmake.definitions["OGG_DYNAMIC"] = self.options["ogg"].shared if self.options.ogg else False - cmake.definitions["OPUS_DYNAMIC"] = self.options["opus"].shared if self.options.opus else False - cmake.definitions["MOD_MIKMOD_DYNAMIC"] = self.options["libmikmod"].shared if self.options.mikmod else False - cmake.definitions["MOD_MODPLUG_DYNAMIC"] = self.options["libmodplug"].shared if self.options.modplug else False - - cmake.configure(build_folder=self._build_subfolder) - - return cmake + tc.variables["MID_TINYMIDI"] = False + tc.variables["MIDI_NATIVE"] = self.options.nativemidi + tc.generate() + tc = CMakeDeps(self) + tc.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=self.source_path.parent) cmake.build() def package(self): - self.copy(pattern="COPYING.txt", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "COPYING.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.set_property("pkg_config_name", "SDL2_mixer") self.cpp_info.set_property("cmake_file_name", "SDL2_mixer") self.cpp_info.set_property("cmake_target_name", "SDL2_mixer::SDL2_mixer") self.cpp_info.set_property("pkg_config_name", "SDL2_mixer") + self.cpp_info.libs = ["SDL2_mixer"] self.cpp_info.includedirs.append(os.path.join("include", "SDL2")) + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs = ["m"] + + if self.options.get_safe("nativemidi"): + if is_apple_os(self): + # https://github.com/libsdl-org/SDL_mixer/blob/release-2.0.4/configure.in#L380 + self.cpp_info.frameworks.extend(["AudioToolbox", "AudioUnit", "CoreServices"]) + elif self.settings.os == "Windows": + # https://github.com/libsdl-org/SDL_mixer/blob/release-2.0.4/configure.in#L376 + self.cpp_info.system_libs.extend(["winmm"]) self.cpp_info.names["cmake_find_package"] = "SDL2_mixer" self.cpp_info.names["cmake_find_package_multi"] = "SDL2_mixer" diff --git a/recipes/sdl_mixer/all/test_package/CMakeLists.txt b/recipes/sdl_mixer/all/test_package/CMakeLists.txt index cbb6dbc11043a..d1c846300657f 100644 --- a/recipes/sdl_mixer/all/test_package/CMakeLists.txt +++ b/recipes/sdl_mixer/all/test_package/CMakeLists.txt @@ -1,11 +1,7 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package LANGUAGES C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(SDL2_mixer CONFIG REQUIRED) +find_package(SDL2_mixer REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) target_link_libraries(${PROJECT_NAME} PRIVATE SDL2_mixer::SDL2_mixer) diff --git a/recipes/sdl_mixer/all/test_package/conanfile.py b/recipes/sdl_mixer/all/test_package/conanfile.py index 49a3a66ea5bad..ef5d7042163ec 100644 --- a/recipes/sdl_mixer/all/test_package/conanfile.py +++ b/recipes/sdl_mixer/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/sdl_mixer/all/test_v1_package/CMakeLists.txt b/recipes/sdl_mixer/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/sdl_mixer/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/sdl_mixer/all/test_v1_package/conanfile.py b/recipes/sdl_mixer/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..49a3a66ea5bad --- /dev/null +++ b/recipes/sdl_mixer/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/sdl_mixer/cmake/conandata.yml b/recipes/sdl_mixer/cmake/conandata.yml new file mode 100644 index 0000000000000..67acbdb598f69 --- /dev/null +++ b/recipes/sdl_mixer/cmake/conandata.yml @@ -0,0 +1,6 @@ +sources: + "2.8.0": + url: + - "https://github.com/libsdl-org/SDL_mixer/releases/download/release-2.8.0/SDL2_mixer-2.8.0.tar.gz" + - "https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.8.0.tar.gz" + sha256: "1cfb34c87b26dbdbc7afd68c4f545c0116ab5f90bbfecc5aebe2a9cb4bb31549" diff --git a/recipes/sdl_mixer/cmake/conanfile.py b/recipes/sdl_mixer/cmake/conanfile.py new file mode 100644 index 0000000000000..5180b62854006 --- /dev/null +++ b/recipes/sdl_mixer/cmake/conanfile.py @@ -0,0 +1,269 @@ +import os + +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 copy, get, rmdir +from conan.tools.microsoft import is_msvc +from conan.errors import ConanInvalidConfiguration + +required_conan_version = ">=1.57.0" + + +class SDLMixerConan(ConanFile): + name = "sdl_mixer" + description = "SDL_mixer is a sample multi-channel audio mixer library" + license = "Zlib" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://www.libsdl.org/projects/SDL_mixer/" + topics = ("sdl2", "sdl", "mixer", "audio", "multimedia", "sound", "music") + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "cmd": [True, False], + "wav": [True, False], + "flac": [True, False], + "gme": [True, False], + "minimp3": [True, False], + "mpg123": [True, False], + "opus": [True, False], + "modplug": [True, False], + "fluidsynth": [True, False], + "nativemidi": [True, False], + "tinymidi": [True, False], + "vorbis": [False, "vorbisfile", "tremor", "stb"], + "wavpack": [True, False], + "xmp": [False, "libxmp", "libxmp-lite"], + } + default_options = { + "shared": False, + "fPIC": True, + "cmd": False, + "wav": True, + "flac": True, + "gme": False, + "minimp3": False, + "mpg123": True, + "opus": True, + "modplug": True, + "fluidsynth": False, + "nativemidi": True, + "tinymidi": True, + "vorbis": "stb", + "wavpack": False, + "xmp": False + } + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + if self.settings.os not in ["Linux", "FreeBSD"]: + del self.options.tinymidi + if not (self.settings.os == "Windows" or self.settings.os == "Macos"): + del self.options.nativemidi + + 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 validate(self): + if not self.options.flac and self.options.gme: + raise ConanInvalidConfiguration("gme is not yet available in CCI, contributions are welcome") + if self.options.vorbis == "tremor": + raise ConanInvalidConfiguration("tremor is not yet available in CCI, contributions are welcome") + if self.options.xmp == "libxmp": + raise ConanInvalidConfiguration("libxmp is not yet available in CCI, contributions are welcome") + if self.options.xmp == "libxmp-lite": + raise ConanInvalidConfiguration("libxmp-lite is not yet available in CCI, contributions are welcome") + if self.options.fluidsynth: + raise ConanInvalidConfiguration("fluidsynth is not yet available in CCI, contributions are welcome") + if self.options.wavpack: + raise ConanInvalidConfiguration("wavpack is not yet available in CCI, contributions are welcome") + + def requirements(self): + self.requires("sdl/2.28.5", transitive_headers=True, transitive_libs=True) + if self.options.flac: + self.requires("flac/1.4.2") + elif self.options.gme: + # TODO: not available on CCI + # self.requires("gme/x.y.z") + pass + if self.options.mpg123: + self.requires("mpg123/1.31.2") + if self.options.minimp3: + self.requires("minimp3/cci.20211201") + if self.options.vorbis == "stb": + self.requires("stb/cci.20230920") + elif self.options.vorbis == "vorbisfile": + self.requires("vorbis/1.3.7") + elif self.options.vorbis == "tremor": + # TODO: not available on CCI + # self.requires("tremor/1.2.1") + pass + if self.options.opus: + self.requires("opusfile/0.12") + if self.options.modplug: + self.requires("libmodplug/0.8.9.0") + if self.options.xmp == "libxmp": + # TODO: not available on CCI + # self.requires("libxmp/x.y.z") + pass + elif self.options.xmp == "libxmp-lite": + # TODO: not available on CCI + # self.requires("libxmp-lite/x.y.z") + pass + if self.options.fluidsynth: + # TODO: not available on CCI + # self.requires("fluidsynth/2.2") + pass + if self.options.get_safe("tinymidi"): + self.requires("tinymidi/cci.20130325") + # https://github.com/libsdl-org/SDL_mixer/blob/release-2.6.3/CMakeLists.txt#L148-L162 + if self.options.vorbis or self.options.flac or self.options.opus: + self.requires("ogg/1.3.5") + if self.options.wavpack: + # TODO: not available on CCI + # self.requires("wavpack/x.y.z") + pass + + def build_requirements(self): + self.tool_requires("cmake/[>=3.16 <4]") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + rmdir(self, os.path.join(self.source_folder, "external")) + + def generate(self): + tc = CMakeToolchain(self) + # Disable debug postfix as it's not relevant to single-configuration Conan builds + # and will be removed in v3.0 anyway. + tc.variables["SDL2MIXER_DEBUG_POSTFIX"] = "" + tc.variables["SDL2MIXER_VENDORED"] = False + tc.variables["SDL2MIXER_SAMPLES"] = False + tc.variables["SDL2MIXER_CMD"] = self.options.cmd + # WAVE + tc.variables["SDL2MIXER_WAVE"] = self.options.wav + # FLAC + tc.variables["SDL2MIXER_FLAC"] = self.options.flac + # GME + tc.variables["SDL2MIXER_GME"] = self.options.gme + # MOD + tc.variables["SDL2MIXER_MOD"] = self.options.modplug or bool(self.options.xmp) + tc.variables["SDL2MIXER_MOD_MODPLUG"] = self.options.modplug + tc.variables["SDL2MIXER_MOD_XMP"] = self.options.xmp == "libxmp" + tc.variables["SDL2MIXER_MOD_XMP_LITE"] = self.options.xmp == "libxmp-lite" + # MP3 + tc.variables["SDL2MIXER_MP3"] = self.options.mpg123 or self.options.minimp3 + tc.variables["SDL2MIXER_MP3_MPG123"] = self.options.mpg123 + tc.variables["SDL2MIXER_MP3_MINIMP3"] = self.options.minimp3 + # MIDI + tc.variables["SDL2MIXER_MIDI"] = self.options.get_safe("nativemidi", False) or self.options.get_safe("tinymidi", False) or self.options.fluidsynth + tc.variables["SDL2MIXER_MIDI_FLUIDSYNTH"] = self.options.fluidsynth + tc.variables["SDL2MIXER_MIDI_TIMIDITY"] = self.options.get_safe("tinymidi", False) + tc.variables["SDL2MIXER_MIDI_NATIVE"] = self.options.get_safe("nativemidi", False) + # OPUS + tc.variables["SDL2MIXER_OPUS"] = self.options.opus + # VORBIS + if self.options.vorbis == "stb": + tc.variables["SDL2MIXER_VORBIS"] = "STB" + elif self.options.vorbis == "vorbisfile": + tc.variables["SDL2MIXER_VORBIS"] = "VORBISFILE" + elif self.options.vorbis == "tremor": + tc.variables["SDL2MIXER_VORBIS"] = "TREMOR" + else: + tc.variables["SDL2MIXER_VORBIS"] = False + # WavPack + tc.variables["SDL2MIXER_WAVPACK"] = self.options.wavpack + + # TODO: add support for dynamic loading of dependencies + tc.variables["SDL2MIXER_DEPS_SHARED"] = False + tc.variables["SDL2MIXER_FLAC_LIBFLAC_SHARED"] = False + tc.variables["SDL2MIXER_GME_SHARED"] = False + tc.variables["SDL2MIXER_MIDI_FLUIDSYNTH_SHARED"] = False + tc.variables["SDL2MIXER_MIDI_TIMIDITY_SHARED"] = False + tc.variables["SDL2MIXER_MOD_MODPLUG_SHARED"] = False + tc.variables["SDL2MIXER_MOD_XMP_SHARED"] = False + tc.variables["SDL2MIXER_MP3_MPG123_SHARED"] = False + tc.variables["SDL2MIXER_OGG_SHARED"] = False + tc.variables["SDL2MIXER_OPUS_SHARED"] = False + tc.variables["SDL2MIXER_SNDFILE_SHARED"] = False + tc.variables["SDL2MIXER_VORBIS_TREMOR_SHARED"] = False + tc.variables["SDL2MIXER_VORBIS_VORBISFILE_SHARED"] = False + tc.variables["SDL2MIXER_WAVPACK_SHARED"] = False + tc.generate() + + deps = CMakeDeps(self) + deps.set_property("flac", "cmake_file_name", "FLAC") + deps.set_property("flac", "cmake_target_name", "FLAC::FLAC") + deps.set_property("fluidsynth", "cmake_file_name", "FluidSynth") + deps.set_property("fluidsynth", "cmake_target_name", "FluidSynth::libfluidsynth") + deps.set_property("gme", "cmake_file_name", "gme") + deps.set_property("gme", "cmake_target_name", "gme::gme") + deps.set_property("libxmp", "cmake_file_name", "libxmp") + deps.set_property("libxmp", "cmake_target_name", "libxmp::libxmp") + deps.set_property("libxmp-lite", "cmake_file_name", "libxmp-lite") + deps.set_property("libxmp-lite", "cmake_target_name", "libxmp-lite::libxmp-lite") + deps.set_property("libmodplug", "cmake_file_name", "modplug") + deps.set_property("libmodplug", "cmake_target_name", "modplug::modplug") + deps.set_property("mpg123", "cmake_file_name", "mpg123") + deps.set_property("mpg123", "cmake_target_name", "MPG123::libmpg123") + deps.set_property("opusfile", "cmake_file_name", "OpusFile") + deps.set_property("opusfile", "cmake_target_name", "OpusFile::opusfile") + deps.set_property("tremor", "cmake_file_name", "tremor") + deps.set_property("tremor", "cmake_target_name", "tremor::tremor") + deps.set_property("vorbis", "cmake_file_name", "Vorbis") + deps.set_property("vorbis::vorbisfile", "cmake_target_name", "Vorbis::vorbisfile") + deps.set_property("wavpack", "cmake_file_name", "wavpack") + deps.set_property("wavpack", "cmake_target_name", "WavPack::WavPack") + + deps.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE.txt", self.source_folder, os.path.join(self.package_folder, "licenses")) + 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, "cmake")) + rmdir(self, os.path.join(self.package_folder, "share")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "SDL2_mixer") + self.cpp_info.set_property("cmake_target_name", "SDL2_mixer::SDL2_mixer") + # https://github.com/libsdl-org/SDL_mixer/blob/release-2.6.3/CMakeLists.txt#L164-L172 + if not self.options.shared: + self.cpp_info.set_property("cmake_target_aliases", ["SDL2_mixer::SDL2_mixer-static"]) + # The project only creates a pkg-config file for a shared lib, but add it for static as well, unofficially + # https://github.com/libsdl-org/SDL_mixer/blob/release-2.6.3/CMakeLists.txt#L828 + self.cpp_info.set_property("pkg_config_name", "SDL2_mixer") + + if is_msvc(self) and not self.options.shared: + self.cpp_info.libs = ["SDL2_mixer-static"] + else: + self.cpp_info.libs = ["SDL2_mixer"] + self.cpp_info.includedirs.append(os.path.join("include", "SDL2")) + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs = ["m"] + if self.settings.os == "Windows": + if self.options.nativemidi: + self.cpp_info.system_libs.append("winmm") + elif is_apple_os(self) and not self.options.shared: + self.cpp_info.frameworks.extend(["AudioToolbox", "CoreServices", "CoreGraphics", "CoreFoundation"]) + if self.settings.os == "Macos": + self.cpp_info.frameworks.extend(["AppKit", "AudioUnit"]) + + self.cpp_info.names["cmake_find_package"] = "SDL2_mixer" + self.cpp_info.names["cmake_find_package_multi"] = "SDL2_mixer" diff --git a/recipes/sdl_mixer/cmake/test_package/CMakeLists.txt b/recipes/sdl_mixer/cmake/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..d1c846300657f --- /dev/null +++ b/recipes/sdl_mixer/cmake/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) + +find_package(SDL2_mixer REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE SDL2_mixer::SDL2_mixer) diff --git a/recipes/sdl_mixer/cmake/test_package/conanfile.py b/recipes/sdl_mixer/cmake/test_package/conanfile.py new file mode 100644 index 0000000000000..ef5d7042163ec --- /dev/null +++ b/recipes/sdl_mixer/cmake/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/sdl_mixer/cmake/test_package/test_package.c b/recipes/sdl_mixer/cmake/test_package/test_package.c new file mode 100644 index 0000000000000..c0bb50e718473 --- /dev/null +++ b/recipes/sdl_mixer/cmake/test_package/test_package.c @@ -0,0 +1,43 @@ +#include +#include + +#include +#include + +int main(int argc, char *argv[]) +{ + int audio_rate = MIX_DEFAULT_FREQUENCY; + int audio_format = MIX_DEFAULT_FORMAT; + int audio_channels = 2; + const SDL_version * version = Mix_Linked_Version(); + printf("%s", "SDL2_mixer version: "); + printf("%d.", (int)(version->major)); + printf("%d.", (int)(version->minor)); + printf("%d\n", (int)(version->patch)); + + if (SDL_Init(SDL_INIT_AUDIO) == 0) { + int initted = Mix_Init(MIX_INIT_FLAC | MIX_INIT_MOD | MIX_INIT_MP3 | MIX_INIT_OGG | MIX_INIT_MID | MIX_INIT_OPUS); + printf("%s %s\n", "Supported MIX_INIT_MOD: " , (initted & MIX_INIT_MOD ? "Yes" : "No")); + printf("%s %s\n", "Supported MIX_INIT_MP3: " , (initted & MIX_INIT_MP3 ? "Yes" : "No")); + printf("%s %s\n", "Supported MIX_INIT_OGG: " , (initted & MIX_INIT_OGG ? "Yes" : "No")); + printf("%s %s\n", "Supported MIX_INIT_FLAC: ", (initted & MIX_INIT_FLAC ? "Yes" : "No")); + printf("%s %s\n", "Supported MIX_INIT_MID: " , (initted & MIX_INIT_MID ? "Yes" : "No")); + printf("%s %s\n", "Supported MIX_INIT_OPUS: ", (initted & MIX_INIT_OPUS ? "Yes" : "No")); + + if (Mix_OpenAudio(audio_rate, audio_format, audio_channels, 4096) == 0) { + int num_chunk_decoders = Mix_GetNumChunkDecoders(); + int num_music_decoders = Mix_GetNumMusicDecoders(); + int i = 0; + printf("%s\n", "chunk decoders:"); + for (i = 0; i < num_chunk_decoders; ++i) + printf("\t%s\n", Mix_GetChunkDecoder(i)); + printf("%s\n", "music decoders:"); + for (i = 0; i < num_music_decoders; ++i) + printf("\t%s\n", Mix_GetMusicDecoder(i)); + Mix_CloseAudio(); + Mix_Quit(); + } + } + + return 0; +} diff --git a/recipes/sdl_mixer/cmake/test_v1_package/CMakeLists.txt b/recipes/sdl_mixer/cmake/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/sdl_mixer/cmake/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/sdl_mixer/cmake/test_v1_package/conanfile.py b/recipes/sdl_mixer/cmake/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..49a3a66ea5bad --- /dev/null +++ b/recipes/sdl_mixer/cmake/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/sdl_mixer/config.yml b/recipes/sdl_mixer/config.yml index 303d89a72ec25..ddf82f5ad0c18 100644 --- a/recipes/sdl_mixer/config.yml +++ b/recipes/sdl_mixer/config.yml @@ -1,3 +1,5 @@ versions: + "2.8.0": + folder: "cmake" "2.0.4": folder: "all" diff --git a/recipes/sdl_net/all/conandata.yml b/recipes/sdl_net/all/conandata.yml index d051057513001..941ee319ca346 100644 --- a/recipes/sdl_net/all/conandata.yml +++ b/recipes/sdl_net/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.2.0": + url: "https://github.com/libsdl-org/SDL_net/releases/download/release-2.2.0/SDL2_net-2.2.0.tar.gz" + sha256: "4e4a891988316271974ff4e9585ed1ef729a123d22c08bd473129179dc857feb" "2.0.1": url: "https://www.libsdl.org/projects/SDL_net/release/SDL2_net-2.0.1.tar.gz" sha256: "15ce8a7e5a23dafe8177c8df6e6c79b6749a03fff1e8196742d3571657609d21" diff --git a/recipes/sdl_net/all/conanfile.py b/recipes/sdl_net/all/conanfile.py index c899c658f21bc..6a4d6d8994d74 100644 --- a/recipes/sdl_net/all/conanfile.py +++ b/recipes/sdl_net/all/conanfile.py @@ -15,7 +15,7 @@ class SdlnetConan(ConanFile): topics = ("sdl2", "sdl2_net", "sdl", "sdl_net", "net", "networking") homepage = "https://www.libsdl.org/projects/SDL_net" url = "https://github.com/conan-io/conan-center-index" - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -42,15 +42,15 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("sdl/2.26.0") + # SDL_net.h includes SDL.h, SDL_endian.h and SDL_version.h + self.requires("sdl/2.28.5", transitive_headers=True) def validate(self): 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): - 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) @@ -65,7 +65,8 @@ def build(self): cmake.build() def package(self): - copy(self, "COPYING.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + license_file = "COPYING.txt" if Version(self.version) < "2.2.0" else "LICENSE.txt" + copy(self, license_file, self.source_folder, os.path.join(self.package_folder, "licenses")) cmake = CMake(self) cmake.install() diff --git a/recipes/sdl_net/all/test_package/CMakeLists.txt b/recipes/sdl_net/all/test_package/CMakeLists.txt index 2337a1a3efdef..221605e46a6cf 100644 --- a/recipes/sdl_net/all/test_package/CMakeLists.txt +++ b/recipes/sdl_net/all/test_package/CMakeLists.txt @@ -1,7 +1,8 @@ cmake_minimum_required(VERSION 3.1) project(test_package LANGUAGES C) +find_package(SDL2 REQUIRED CONFIG) find_package(SDL2_net REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE SDL2_net::SDL2_net) +target_link_libraries(${PROJECT_NAME} PRIVATE SDL2::SDL2 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 744f9cf00c80f..4c58e9c67e01f 100644 --- a/recipes/sdl_net/all/test_package/conanfile.py +++ b/recipes/sdl_net/all/test_package/conanfile.py @@ -14,6 +14,7 @@ def layout(self): def requirements(self): self.requires(self.tested_reference_str) + self.requires("sdl/2.28.5") def build(self): cmake = CMake(self) diff --git a/recipes/sdl_net/config.yml b/recipes/sdl_net/config.yml index bb7eb85dfac49..0323e9f109615 100644 --- a/recipes/sdl_net/config.yml +++ b/recipes/sdl_net/config.yml @@ -1,3 +1,5 @@ versions: + "2.2.0": + folder: all "2.0.1": folder: all diff --git a/recipes/sdl_ttf/all/conandata.yml b/recipes/sdl_ttf/all/conandata.yml index 181f9cf9a91d8..047b9b76b8975 100644 --- a/recipes/sdl_ttf/all/conandata.yml +++ b/recipes/sdl_ttf/all/conandata.yml @@ -1,12 +1,36 @@ sources: + "2.22.0": + url: "https://github.com/libsdl-org/SDL_ttf/releases/download/release-2.22.0/SDL2_ttf-2.22.0.tar.gz" + sha256: "d48cbd1ce475b9e178206bf3b72d56b66d84d44f64ac05803328396234d67723" + "2.20.2": + url: "https://github.com/libsdl-org/SDL_ttf/releases/download/release-2.20.2/SDL2_ttf-2.20.2.tar.gz" + sha256: "9dc71ed93487521b107a2c4a9ca6bf43fb62f6bddd5c26b055e6b91418a22053" + "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" + - patch_file: "patches/2.20.1-0002-remove-unsupported-property.patch" + patch_description: "remove DEPRECATION property is available on CMake 3.17+ (Linux C3i is 3.15 and the Conan min)" + patch_type: "portability" + patch_source: "https://github.com/libsdl-org/SDL_ttf/commit/e49b6030bd57b7aa3f0e4e42cb7ccc5fee876184" "2.0.18": - - patch_file: "patches/cmake-fix-link-target-2.0.18.patch" + - 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" + - 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 acc311e2039d1..fe9ee6f453b29 100644 --- a/recipes/sdl_ttf/all/conanfile.py +++ b/recipes/sdl_ttf/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, 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.53.0" +required_conan_version = ">=1.54.0" class SdlttfConan(ConanFile): @@ -21,10 +22,12 @@ class SdlttfConan(ConanFile): options = { "shared": [True, False], "fPIC": [True, False], + "with_harfbuzz": [True, False], } default_options = { "shared": False, "fPIC": True, + "with_harfbuzz": False, } def export_sources(self): @@ -33,32 +36,52 @@ def export_sources(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: 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.12.1") - self.requires("sdl/2.26.0") + self.requires("freetype/2.13.2") + # https://github.com/conan-io/conan-center-index/pull/18366#issuecomment-1625464996 + self.requires("sdl/2.28.3", transitive_headers=True, transitive_libs=True) + if self.options.get_safe("with_harfbuzz"): + self.requires("harfbuzz/8.3.0") def validate(self): - if is_msvc(self) and self.info.options.shared: - raise ConanInvalidConfiguration("sdl_ttf shared is not supported with Visual Studio") 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 build_requirements(self): + self.tool_requires("cmake/[>=3.16 <4]") + 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) + 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() @@ -82,22 +105,34 @@ def build(self): def package(self): 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() 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.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"].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") + if Version(self.version) <= "2.0.18" and is_apple_os(self) and self.options.shared: + self.cpp_info.components["_sdl2_ttf"].frameworks = [ + "AppKit", "CoreGraphics", "CoreFoundation", "CoreServices" + ] # 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.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/patches/2.20.1-0002-remove-unsupported-property.patch b/recipes/sdl_ttf/all/patches/2.20.1-0002-remove-unsupported-property.patch new file mode 100644 index 0000000000000..b1c27e03bcce2 --- /dev/null +++ b/recipes/sdl_ttf/all/patches/2.20.1-0002-remove-unsupported-property.patch @@ -0,0 +1,25 @@ +From e49b6030bd57b7aa3f0e4e42cb7ccc5fee876184 Mon Sep 17 00:00:00 2001 +From: Anonymous Maarten +Date: Sat, 23 Jul 2022 17:28:28 +0200 +Subject: [PATCH] cmake: DEPRECATION property is available on CMake 3.17+ + +--- + CMakeLists.txt | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index ebbe692d..64854ad3 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -401,6 +401,9 @@ endif() + add_library(SDL2::ttf INTERFACE IMPORTED GLOBAL) + set_target_properties(SDL2::ttf PROPERTIES + INTERFACE_LINK_LIBRARIES "SDL2_ttf" +- DEPRECATION "Use SDL2_ttf::SDL2_ttf or SDL2_ttf::SDL2_ttf-static instead" + ) +- ++if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.17") ++ set_target_properties(SDL2::ttf PROPERTIES ++ DEPRECATION "Use SDL2_ttf::SDL2_ttf or SDL2_ttf::SDL2_ttf-static instead" ++ ) ++endif() diff --git a/recipes/sdl_ttf/all/test_package/CMakeLists.txt b/recipes/sdl_ttf/all/test_package/CMakeLists.txt index c54ede24b9752..a17e98d94db30 100644 --- a/recipes/sdl_ttf/all/test_package/CMakeLists.txt +++ b/recipes/sdl_ttf/all/test_package/CMakeLists.txt @@ -4,4 +4,8 @@ project(test_package LANGUAGES C) find_package(SDL2_ttf REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE 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/OpenSans-Bold.ttf b/recipes/sdl_ttf/all/test_package/OpenSans-Bold.ttf deleted file mode 100644 index fd79d43bea029..0000000000000 Binary files a/recipes/sdl_ttf/all/test_package/OpenSans-Bold.ttf and /dev/null differ diff --git a/recipes/sdl_ttf/all/test_package/conanfile.py b/recipes/sdl_ttf/all/test_package/conanfile.py index c4fdfb4dbdc98..0a6bc68712d90 100644 --- a/recipes/sdl_ttf/all/test_package/conanfile.py +++ b/recipes/sdl_ttf/all/test_package/conanfile.py @@ -23,5 +23,4 @@ def build(self): def test(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") - self.run(f"{bin_path} {ttf_path}", env="conanrun") + self.run(bin_path, env="conanrun") diff --git a/recipes/sdl_ttf/all/test_package/test_package.c b/recipes/sdl_ttf/all/test_package/test_package.c index 2050bc43e4215..20d9fde4b5f07 100644 --- a/recipes/sdl_ttf/all/test_package/test_package.c +++ b/recipes/sdl_ttf/all/test_package/test_package.c @@ -4,23 +4,11 @@ #include int main(int argc, char **argv) { - if (argc < 2) { - fprintf(stderr, "Need at least one argument\n"); - return 1; - } - if (TTF_Init() == -1) { fprintf(stderr, "Failed to initialize TTF: %s\n", SDL_GetError()); return 1; } - TTF_Font *font = TTF_OpenFont(argv[1], 16); - - if (font == NULL) { - fprintf(stderr, "Failed to load font: %s\n", SDL_GetError()); - return 1; - } - printf("SDL2_ttf is working!\n"); return 0; diff --git a/recipes/sdl_ttf/all/test_v1_package/conanfile.py b/recipes/sdl_ttf/all/test_v1_package/conanfile.py index 7b775db727c08..38f4483872d47 100644 --- a/recipes/sdl_ttf/all/test_v1_package/conanfile.py +++ b/recipes/sdl_ttf/all/test_v1_package/conanfile.py @@ -14,5 +14,4 @@ def build(self): 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) + self.run(bin_path, run_environment=True) diff --git a/recipes/sdl_ttf/config.yml b/recipes/sdl_ttf/config.yml index 3340e30c9939c..46db183bdc30c 100644 --- a/recipes/sdl_ttf/config.yml +++ b/recipes/sdl_ttf/config.yml @@ -1,4 +1,10 @@ versions: + "2.22.0": + folder: all + "2.20.2": + folder: all + "2.20.1": + folder: all "2.0.18": folder: all "2.0.15": diff --git a/recipes/seadex-essentials/all/conandata.yml b/recipes/seadex-essentials/all/conandata.yml new file mode 100644 index 0000000000000..113d034e0a06a --- /dev/null +++ b/recipes/seadex-essentials/all/conandata.yml @@ -0,0 +1,5 @@ +sources: + "2.1.3": + url: + - "https://github.com/SeadexGmbH/essentials/archive/refs/tags/2.1.3.tar.gz" + sha256: "c0f758279b90fcf6a3e0a511978d0fa3bf4934fe600bb6e69cc8feb65221bd58" diff --git a/recipes/seadex-essentials/all/conanfile.py b/recipes/seadex-essentials/all/conanfile.py new file mode 100644 index 0000000000000..118460968da91 --- /dev/null +++ b/recipes/seadex-essentials/all/conanfile.py @@ -0,0 +1,97 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import check_min_vs, is_msvc +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, CMakeToolchain, cmake_layout +import os + +required_conan_version = ">=1.53.0" + +class SeadexEssentialsConan(ConanFile): + name = "seadex-essentials" + description = "essentials is a small c++ library that offers very basic capabilities for applications and libraries." + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://essentials.seadex.de/" + topics = ("utility", "c++") + package_type = "library" + 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 { + "gcc": "8.3", + "clang": "12", + "Visual Studio": "16", + "msvc": "192", + "apple-clang": "10" + } + + 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): + # Headers are exposed https://github.com/SeadexGmbH/essentials/blob/622a07dc1530f5668f5dde0ce18007d420c371cd/essentials/include/essentials/log/log_level.hpp#L15 + self.requires("spdlog/1.12.0", transitive_headers=True) + # Exposes headers and symbols https://github.com/SeadexGmbH/essentials/blob/622a07dc1530f5668f5dde0ce18007d420c371cd/essentials/include/essentials/type_wrapper.hpp#L282 + self.requires("fmt/10.1.0", transitive_headers=True, transitive_libs=True) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + 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 at least {self.settings.compiler} {minimum_version}." + ) + 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 not self.dependencies["spdlog"].options.header_only: + raise ConanInvalidConfiguration("Spdlog must be header only!") + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["ESS_BUILD_UNIT_TESTS"] = False + tc.cache_variables["ESS_BUILD_EXAMPLES"] = False + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE.md", self.source_folder, os.path.join(self.package_folder, "licenses") ) + cmake = CMake(self) + cmake.configure() + cmake.install() + + def package_info(self): + self.cpp_info.libs = ["essentials"] diff --git a/recipes/seadex-essentials/all/test_package/CMakeLists.txt b/recipes/seadex-essentials/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..cfd0f452a3ad8 --- /dev/null +++ b/recipes/seadex-essentials/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(seadex-essentials REQUIRED CONFIG) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE seadex-essentials::seadex-essentials) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/seadex-essentials/all/test_package/conanfile.py b/recipes/seadex-essentials/all/test_package/conanfile.py new file mode 100644 index 0000000000000..63dab6b31486d --- /dev/null +++ b/recipes/seadex-essentials/all/test_package/conanfile.py @@ -0,0 +1,31 @@ +import os +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + 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() + tc = CMakeDeps(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/seadex-essentials/all/test_package/test_package.cpp b/recipes/seadex-essentials/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..442d07091ff95 --- /dev/null +++ b/recipes/seadex-essentials/all/test_package/test_package.cpp @@ -0,0 +1,20 @@ +#include + +#include "essentials/log/log.hpp" + +int main() { + + auto& logger = sxe::logger::get_instance(); + sxe::logger_manager::get_instance().set_logger( logger ); + logger.set_log_level( LL_TRACE ); + logger.add_std_out_sink(); + + SXE_LOG_LOCATED( LL_TRACE, "main.cpp", __LINE__, "{}) Hello {}!", __LINE__, "John Doe" ); + SXE_LOG_LOCATED( LL_DEBUG, "main.cpp", __LINE__, "{}) Hello {}!", __LINE__, "John Doe" ); + SXE_LOG_LOCATED( LL_INFO, "main.cpp", __LINE__, "{}) Hello {}!", __LINE__, "John Doe" ); + SXE_LOG_LOCATED( LL_WARN, "main.cpp", __LINE__, "{}) Hello {}!", __LINE__, "John Doe" ); + SXE_LOG_LOCATED( LL_ERROR, "main.cpp", __LINE__, "{}) Hello {}!", __LINE__, "John Doe" ); + SXE_LOG_LOCATED( LL_FATAL, "main.cpp", __LINE__, "{}) Hello {}!", __LINE__, "John Doe" ); + + return EXIT_SUCCESS; +} diff --git a/recipes/seadex-essentials/all/test_v1_package/CMakeLists.txt b/recipes/seadex-essentials/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/seadex-essentials/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/seadex-essentials/all/test_v1_package/conanfile.py b/recipes/seadex-essentials/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..c492184eec19c --- /dev/null +++ b/recipes/seadex-essentials/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/seadex-essentials/config.yml b/recipes/seadex-essentials/config.yml new file mode 100644 index 0000000000000..e6ceade928280 --- /dev/null +++ b/recipes/seadex-essentials/config.yml @@ -0,0 +1,3 @@ +versions: + "2.1.3": + folder: all diff --git a/recipes/seadex-genesis/all/conandata.yml b/recipes/seadex-genesis/all/conandata.yml new file mode 100644 index 0000000000000..176a61239e9e8 --- /dev/null +++ b/recipes/seadex-genesis/all/conandata.yml @@ -0,0 +1,5 @@ +sources: + "2.0.0": + url: + - "https://github.com/SeadexGmbH/genesis/archive/refs/tags/2.0.0.tar.gz" + sha256: "22bd4e438c1475d7b023d6f8f7d541f49f55784c89e8607acc68a73157bb4ea4" diff --git a/recipes/seadex-genesis/all/conanfile.py b/recipes/seadex-genesis/all/conanfile.py new file mode 100644 index 0000000000000..2328e60870392 --- /dev/null +++ b/recipes/seadex-genesis/all/conanfile.py @@ -0,0 +1,92 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import check_min_vs, is_msvc +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, CMakeToolchain, cmake_layout +import os + +required_conan_version = ">=1.53.0" + +class SeadexGenesisConan(ConanFile): + name = "seadex-genesis" + description = "genesis is a generator library developed by Seadex (written in C++11)." + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://genesis.seadex.de/" + topics = ("generator", "c++") + 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 { + "gcc": "8.3", + "clang": "12", + "Visual Studio": "16", + "msvc": "192", + "apple-clang": "10" + } + + 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): + # Exposes headers and symbols: https://github.com/SeadexGmbH/genesis/blob/master/genesis/source/version.cpp + self.requires("fmt/10.1.0", transitive_headers=True, transitive_libs=True) + self.requires("seadex-essentials/2.1.3", transitive_headers=True, transitive_libs=True) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + 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." + ) + 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 generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["GEN_BUILD_EXAMPLES"] = False + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE.md", self.source_folder, os.path.join(self.package_folder, "licenses") ) + cmake = CMake(self) + cmake.configure() + cmake.install() + + def package_info(self): + self.cpp_info.libs = ["genesis"] diff --git a/recipes/seadex-genesis/all/test_package/CMakeLists.txt b/recipes/seadex-genesis/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..028f0b497eb5e --- /dev/null +++ b/recipes/seadex-genesis/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(seadex-genesis REQUIRED CONFIG) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PUBLIC seadex-genesis::seadex-genesis) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/seadex-genesis/all/test_package/conanfile.py b/recipes/seadex-genesis/all/test_package/conanfile.py new file mode 100644 index 0000000000000..63dab6b31486d --- /dev/null +++ b/recipes/seadex-genesis/all/test_package/conanfile.py @@ -0,0 +1,31 @@ +import os +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + 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() + tc = CMakeDeps(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/seadex-genesis/all/test_package/test_package.cpp b/recipes/seadex-genesis/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..48dc86c10dbd5 --- /dev/null +++ b/recipes/seadex-genesis/all/test_package/test_package.cpp @@ -0,0 +1,11 @@ +#include + +#include "genesis/grammar.hpp" + + +int main() { + + std::cout<< sx::genesis::LOOP_START_COMMAND << " test " << sx::genesis::LOOP_END_COMMAND << std::endl; + + return EXIT_SUCCESS; +} diff --git a/recipes/seadex-genesis/all/test_v1_package/CMakeLists.txt b/recipes/seadex-genesis/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/seadex-genesis/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/seadex-genesis/all/test_v1_package/conanfile.py b/recipes/seadex-genesis/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..c492184eec19c --- /dev/null +++ b/recipes/seadex-genesis/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/seadex-genesis/config.yml b/recipes/seadex-genesis/config.yml new file mode 100644 index 0000000000000..d77ad03cbf510 --- /dev/null +++ b/recipes/seadex-genesis/config.yml @@ -0,0 +1,3 @@ +versions: + "2.0.0": + folder: all diff --git a/recipes/seasocks/all/conandata.yml b/recipes/seasocks/all/conandata.yml index 1cc1c6a9f403a..412d4f0b76fdd 100644 --- a/recipes/seasocks/all/conandata.yml +++ b/recipes/seasocks/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "1.4.6": + url: "https://github.com/mattgodbolt/seasocks/archive/v1.4.6.tar.gz" + sha256: "fc69636ce1205d338d4c02784333b04cd774fa368843fcf9f4fe6f8530a2cd67" + "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..1662f1e11775f 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.11 <2]") 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..b2a6b234212ab 100644 --- a/recipes/seasocks/config.yml +++ b/recipes/seasocks/config.yml @@ -1,3 +1,7 @@ versions: + "1.4.6": + folder: "all" + "1.4.5": + folder: "all" "1.4.4": folder: "all" diff --git a/recipes/semimap/all/conandata.yml b/recipes/semimap/all/conandata.yml new file mode 100644 index 0000000000000..6af7c8e19bc89 --- /dev/null +++ b/recipes/semimap/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "cci.20181023": + url: "https://github.com/hogliux/semimap/archive/de556c74721a5017f5a03faf2fbd1c6e5a768a32.tar.gz" + sha256: "af4689afb3809664507e2ae77332650b658175d5382cbe63957707547d7ee76e" diff --git a/recipes/semimap/all/conanfile.py b/recipes/semimap/all/conanfile.py new file mode 100644 index 0000000000000..bd330607698a4 --- /dev/null +++ b/recipes/semimap/all/conanfile.py @@ -0,0 +1,64 @@ +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 SemimapConan(ConanFile): + name = "semimap" + description = "A semi compile-/run-time associative map container with compile-time lookup and run-time storage" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/hogliux/semimap" + topics = ("containers", "constexpr", "hashmap", "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.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=self.source_folder, + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/semimap/all/test_package/CMakeLists.txt b/recipes/semimap/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..07f01c03a2b1b --- /dev/null +++ b/recipes/semimap/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(semimap REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE semimap::semimap) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/semimap/all/test_package/conanfile.py b/recipes/semimap/all/test_package/conanfile.py new file mode 100644 index 0000000000000..b9d7f11e89dcd --- /dev/null +++ b/recipes/semimap/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 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/semimap/all/test_package/test_package.cpp b/recipes/semimap/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..00f62373a05d4 --- /dev/null +++ b/recipes/semimap/all/test_package/test_package.cpp @@ -0,0 +1,43 @@ +#include +#include + +#include "semimap.h" + +#define ID(x) \ + []() constexpr { return x; } + +int main() { + + // Test compile-time only load/store + { + struct Tag { + }; + using map = semi::static_map; + + auto& food = map::get(ID("food")); + assert(food.empty()); + + food = "pizza"; + assert(map::get(ID("food")) == "pizza"); + + auto& drink = map::get(ID("drink")); + assert(drink.empty()); + + drink = "beer"; + assert(map::get(ID("food")) == "pizza"); + assert(map::get(ID("drink")) == "beer"); + + map::get(ID("food")) = "spaghetti"; + assert(map::get(ID("food")) == "spaghetti"); + assert(map::get(ID("drink")) == "beer"); + + map::get(ID("drink")) = "soda"; + assert(map::get(ID("food")) == "spaghetti"); + assert(map::get(ID("drink")) == "soda"); + + assert(map::get(ID("starter"), "soup") == "soup"); + assert(map::get(ID("starter"), "salad") == "soup"); + } + + return 0; +} diff --git a/recipes/semimap/all/test_v1_package/CMakeLists.txt b/recipes/semimap/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..be00a8c7f57c7 --- /dev/null +++ b/recipes/semimap/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/semimap/all/test_v1_package/conanfile.py b/recipes/semimap/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/semimap/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/semimap/config.yml b/recipes/semimap/config.yml new file mode 100644 index 0000000000000..b3eb9a995d928 --- /dev/null +++ b/recipes/semimap/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20181023": + 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..2687fcfc48fd4 100644 --- a/recipes/sentry-breakpad/all/conandata.yml +++ b/recipes/sentry-breakpad/all/conandata.yml @@ -1,20 +1,62 @@ sources: - "0.5.0": - url: "https://github.com/getsentry/sentry-native/releases/download/0.5.0/sentry-native.zip" - sha256: "1a65767a7c6c368a6dea44125eb268ed8374100f33168829f21df78cbfa8632b" + "0.6.5": + url: "https://github.com/getsentry/sentry-native/releases/download/0.6.5/sentry-native.zip" + sha256: "5f74a5c5c3abc6e1e7825d3306be9e3b3fd4e0f586f3cf7e86607d6f56a71995" + "0.6.4": + url: "https://github.com/getsentry/sentry-native/releases/download/0.6.4/sentry-native.zip" + sha256: "e00278bf9a4821bb4008985a5a552a84aba6ebb06d3f9e828082fcbf06b04a38" + "0.6.3": + url: "https://github.com/getsentry/sentry-native/releases/download/0.6.3/sentry-native.zip" + sha256: "6b515c17a9b860ea47c6a5fd7abdfdc89b4b8cbc654c23a8bb42a39bfcb87ad9" + "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: +patches: + "0.6.5": + - patch_file: "patches/0.6.x-0001-remove-third-pary-lss.patch" + patch_description: "Remove third party lss from include" + patch_type: "conan" + patch_source: "https://github.com/getsentry/breakpad/pull/37" + - patch_file: "patches/0.6.x-0002-install-breakpad-header.patch" + patch_description: "Install breakpad header" + patch_type: "conan" + patch_source: "https://github.com/getsentry/sentry-native/pull/872" + "0.6.4": + - patch_file: "patches/0.6.x-0001-remove-third-pary-lss.patch" + patch_description: "Remove third party lss from include" + patch_type: "conan" + patch_source: "https://github.com/getsentry/breakpad/pull/37" + - patch_file: "patches/0.6.x-0002-install-breakpad-header.patch" + patch_description: "Install breakpad header" + patch_type: "conan" + patch_source: "https://github.com/getsentry/sentry-native/pull/872" + "0.6.3": + - patch_file: "patches/0.6.x-0001-remove-third-pary-lss.patch" + patch_description: "Remove third party lss from include" + patch_type: "conan" + patch_source: "https://github.com/getsentry/breakpad/pull/37" + - patch_file: "patches/0.6.x-0002-install-breakpad-header.patch" + patch_description: "Install breakpad header" + patch_type: "conan" + patch_source: "https://github.com/getsentry/sentry-native/pull/872" + "0.5.4": + - patch_file: "patches/0.5.4-0001-remove-third-pary-lss.patch" + patch_description: "Remove third party lss from include" + patch_type: "conan" + patch_source: "https://github.com/getsentry/breakpad/pull/37" + - patch_file: "patches/0.5.4-0002-install-breakpad-header.patch" + patch_description: "Install breakpad header" + patch_type: "conan" + patch_source: "https://github.com/getsentry/sentry-native/pull/872" + "0.4.18": + - patch_file: "patches/0.4.18-0001-remove-third-pary-lss.patch" + patch_description: "Remove third party lss from include" + patch_type: "conan" + patch_source: "https://github.com/getsentry/breakpad/pull/37" + - patch_file: "patches/0.4.18-0002-install-breakpad-header.patch" + patch_description: "Install breakpad header" + patch_type: "conan" + patch_source: "https://github.com/getsentry/sentry-native/pull/872" diff --git a/recipes/sentry-breakpad/all/conanfile.py b/recipes/sentry-breakpad/all/conanfile.py index be30e6c723ff0..8e95117df3a32 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 apply_conandata_patches, copy, export_conandata_patches, get +from conan.tools.scm import Version import os -required_conan_version = ">=1.45.0" +required_conan_version = ">=1.51.3" class SentryBreakpadConan(ConanFile): @@ -12,8 +16,9 @@ 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" + package_type = "static-library" settings = "os", "arch", "compiler", "build_type" options = { "fPIC": [True, False], @@ -21,130 +26,73 @@ 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) + 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): if self.settings.os in ("FreeBSD", "Linux"): - self.requires("linux-syscall-support/cci.20200813") + # linux-syscal-support is a public dependency + # see https://github.com/conan-io/conan-center-index/pull/16752#issuecomment-1487241864 + self.requires("linux-syscall-support/cci.20200813", transitive_headers=True) 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) - - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.configure() - return cmake + get(self, **self.conan_data["sources"][self.version]) - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - - # FIXME: convert to patches - import textwrap - - files_to_patch = [ - # "src/tools/linux/md2core/minidump-2-core.cc", - # "src/processor/testdata/linux_test_app.cc", - "src/common/memory_allocator.h", - "src/common/linux/memory_mapped_file.cc", - "src/common/linux/file_id.cc", - "src/common/linux/safe_readlink.cc", - "src/client/minidump_file_writer.cc", - "src/client/linux/handler/exception_handler.cc", - "src/client/linux/handler/exception_handler_unittest.cc", - "src/client/linux/log/log.cc", - "src/client/linux/crash_generation/crash_generation_client.cc", - "src/client/linux/minidump_writer/linux_dumper.cc", - "src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc", - "src/client/linux/minidump_writer/proc_cpuinfo_reader.h", - "src/client/linux/minidump_writer/minidump_writer.cc", - "src/client/linux/minidump_writer/linux_ptrace_dumper.cc", - "src/client/linux/minidump_writer/cpu_set.h", - "src/client/linux/minidump_writer/directory_reader.h", - "src/client/linux/minidump_writer/line_reader.h" - ] - - for file in files_to_patch: - tools.replace_in_file( - os.path.join(self._source_subfolder, "external", "breakpad", file), - "#include \"third_party/lss/linux_syscall_support.h\"", - "#include " - ) - - tools.save(os.path.join(self._source_subfolder, "external", "CMakeLists.txt"), - textwrap.dedent("""\ - install(TARGETS breakpad_client - ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib - RUNTIME DESTINATION bin - ) - file(GLOB COMMON_FILES breakpad/src/common/*.h) - install(FILES ${COMMON_FILES} - DESTINATION include/breakpad/common - ) - set(PLATFORM_FOLDER) - if(IOS) - set(PLATFORM_FOLDER ios) - elseif(APPLE) - set(PLATFORM_FOLDER mac) - elseif(UNIX) - set(PLATFORM_FOLDER linux) - endif() - if(WIN32) - set(PLATFORM_FOLDER windows) - endif() - if(NOT PLATFORM_FOLDER) - message(FATAL_ERROR "Unknown os -> don't know how to install headers") - endif() - file(GLOB COMMON_PLATFORM_HEADERS breakpad/src/common/${PLATFORM_FOLDER}/*.h) - install(FILES ${COMMON_PLATFORM_HEADERS} - DESTINATION include/breakpad/common/${PLATFORM_FOLDER}) - install(DIRECTORY breakpad/src/client/${PLATFORM_FOLDER} - DESTINATION include/breakpad/client - FILES_MATCHING PATTERN *.h - ) - install(DIRECTORY breakpad/src/google_breakpad/common - DESTINATION include/breakpad/google_breakpad - FILES_MATCHING PATTERN *.h - ) - """), append=True) + def generate(self): + tc = CMakeToolchain(self) + if self.settings.os in ["Linux", "FreeBSD"]: + tc.variables["LINUX"] = True + 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", 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/patches/0.4.18-0001-remove-third-pary-lss.patch b/recipes/sentry-breakpad/all/patches/0.4.18-0001-remove-third-pary-lss.patch new file mode 100644 index 0000000000000..a573e142644bb --- /dev/null +++ b/recipes/sentry-breakpad/all/patches/0.4.18-0001-remove-third-pary-lss.patch @@ -0,0 +1,227 @@ +commit a9d52d999e0450a2f6b7ca24b245e718ab537cec +Author: Martin Delille +Date: Tue Aug 8 11:59:04 2023 +0200 + + Remove third_party/lss + +diff --git a/external/breakpad/src/client/linux/crash_generation/crash_generation_client.cc b/external/breakpad/src/client/linux/crash_generation/crash_generation_client.cc +index d8bfbbad..b7b43cff 100644 +--- a/external/breakpad/src/client/linux/crash_generation/crash_generation_client.cc ++++ b/external/breakpad/src/client/linux/crash_generation/crash_generation_client.cc +@@ -37,7 +37,7 @@ + + #include "common/linux/eintr_wrapper.h" + #include "common/linux/ignore_ret.h" +-#include "third_party/lss/linux_syscall_support.h" ++#include "linux_syscall_support.h" + + namespace google_breakpad { + +diff --git a/external/breakpad/src/client/linux/handler/exception_handler.cc b/external/breakpad/src/client/linux/handler/exception_handler.cc +index 499be0a9..d6c3ba71 100644 +--- a/external/breakpad/src/client/linux/handler/exception_handler.cc ++++ b/external/breakpad/src/client/linux/handler/exception_handler.cc +@@ -95,7 +95,7 @@ + #include "client/linux/minidump_writer/linux_dumper.h" + #include "client/linux/minidump_writer/minidump_writer.h" + #include "common/linux/eintr_wrapper.h" +-#include "third_party/lss/linux_syscall_support.h" ++#include "linux_syscall_support.h" + + #if defined(__ANDROID__) + #include "linux/sched.h" +diff --git a/external/breakpad/src/client/linux/handler/exception_handler_unittest.cc b/external/breakpad/src/client/linux/handler/exception_handler_unittest.cc +index 35dcbfd4..21647998 100644 +--- a/external/breakpad/src/client/linux/handler/exception_handler_unittest.cc ++++ b/external/breakpad/src/client/linux/handler/exception_handler_unittest.cc +@@ -50,7 +50,7 @@ + #include "common/linux/linux_libc_support.h" + #include "common/tests/auto_tempdir.h" + #include "common/using_std_string.h" +-#include "third_party/lss/linux_syscall_support.h" ++#include "linux_syscall_support.h" + #include "google_breakpad/processor/minidump.h" + + using namespace google_breakpad; +diff --git a/external/breakpad/src/client/linux/log/log.cc b/external/breakpad/src/client/linux/log/log.cc +index 31879409..072377ed 100644 +--- a/external/breakpad/src/client/linux/log/log.cc ++++ b/external/breakpad/src/client/linux/log/log.cc +@@ -33,7 +33,7 @@ + #include + #include + #else +-#include "third_party/lss/linux_syscall_support.h" ++#include "linux_syscall_support.h" + #endif + + namespace logger { +diff --git a/external/breakpad/src/client/linux/minidump_writer/cpu_set.h b/external/breakpad/src/client/linux/minidump_writer/cpu_set.h +index 1cca9aa5..50f83d8c 100644 +--- a/external/breakpad/src/client/linux/minidump_writer/cpu_set.h ++++ b/external/breakpad/src/client/linux/minidump_writer/cpu_set.h +@@ -35,7 +35,7 @@ + #include + + #include "common/linux/linux_libc_support.h" +-#include "third_party/lss/linux_syscall_support.h" ++#include "linux_syscall_support.h" + + namespace google_breakpad { + +diff --git a/external/breakpad/src/client/linux/minidump_writer/directory_reader.h b/external/breakpad/src/client/linux/minidump_writer/directory_reader.h +index a4bde180..e1c69a23 100644 +--- a/external/breakpad/src/client/linux/minidump_writer/directory_reader.h ++++ b/external/breakpad/src/client/linux/minidump_writer/directory_reader.h +@@ -38,7 +38,7 @@ + #include + + #include "common/linux/linux_libc_support.h" +-#include "third_party/lss/linux_syscall_support.h" ++#include "linux_syscall_support.h" + + namespace google_breakpad { + +diff --git a/external/breakpad/src/client/linux/minidump_writer/line_reader.h b/external/breakpad/src/client/linux/minidump_writer/line_reader.h +index 9fc4b7cc..cf75dfe0 100644 +--- a/external/breakpad/src/client/linux/minidump_writer/line_reader.h ++++ b/external/breakpad/src/client/linux/minidump_writer/line_reader.h +@@ -35,7 +35,7 @@ + #include + + #include "common/linux/linux_libc_support.h" +-#include "third_party/lss/linux_syscall_support.h" ++#include "linux_syscall_support.h" + + namespace google_breakpad { + +diff --git a/external/breakpad/src/client/linux/minidump_writer/linux_dumper.cc b/external/breakpad/src/client/linux/minidump_writer/linux_dumper.cc +index 44430c4e..a702ee68 100644 +--- a/external/breakpad/src/client/linux/minidump_writer/linux_dumper.cc ++++ b/external/breakpad/src/client/linux/minidump_writer/linux_dumper.cc +@@ -51,7 +51,7 @@ + #include "common/linux/memory_mapped_file.h" + #include "common/linux/safe_readlink.h" + #include "google_breakpad/common/minidump_exception_linux.h" +-#include "third_party/lss/linux_syscall_support.h" ++#include "linux_syscall_support.h" + + using google_breakpad::elf::FileID; + +diff --git a/external/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc b/external/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc +index 331f4bb3..c4c5bd42 100644 +--- a/external/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc ++++ b/external/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc +@@ -39,7 +39,7 @@ + #include + + #include "common/scoped_ptr.h" +-#include "third_party/lss/linux_syscall_support.h" ++#include "linux_syscall_support.h" + + #if defined(__ARM_EABI__) + #define TID_PTR_REGISTER "r3" +diff --git a/external/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc b/external/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc +index e3ddb81a..6712af94 100644 +--- a/external/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc ++++ b/external/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc +@@ -57,7 +57,7 @@ + #include "client/linux/minidump_writer/directory_reader.h" + #include "client/linux/minidump_writer/line_reader.h" + #include "common/linux/linux_libc_support.h" +-#include "third_party/lss/linux_syscall_support.h" ++#include "linux_syscall_support.h" + + // Suspends a thread by attaching to it. + static bool SuspendThread(pid_t pid) { +diff --git a/external/breakpad/src/client/linux/minidump_writer/minidump_writer.cc b/external/breakpad/src/client/linux/minidump_writer/minidump_writer.cc +index 7ce9ac57..4d9f1e21 100644 +--- a/external/breakpad/src/client/linux/minidump_writer/minidump_writer.cc ++++ b/external/breakpad/src/client/linux/minidump_writer/minidump_writer.cc +@@ -79,7 +79,7 @@ + #include "common/linux/linux_libc_support.h" + #include "common/minidump_type_helper.h" + #include "google_breakpad/common/minidump_format.h" +-#include "third_party/lss/linux_syscall_support.h" ++#include "linux_syscall_support.h" + + namespace { + +diff --git a/external/breakpad/src/client/linux/minidump_writer/proc_cpuinfo_reader.h b/external/breakpad/src/client/linux/minidump_writer/proc_cpuinfo_reader.h +index d9461bf3..a915a88b 100644 +--- a/external/breakpad/src/client/linux/minidump_writer/proc_cpuinfo_reader.h ++++ b/external/breakpad/src/client/linux/minidump_writer/proc_cpuinfo_reader.h +@@ -36,7 +36,7 @@ + + #include "client/linux/minidump_writer/line_reader.h" + #include "common/linux/linux_libc_support.h" +-#include "third_party/lss/linux_syscall_support.h" ++#include "linux_syscall_support.h" + + namespace google_breakpad { + +diff --git a/external/breakpad/src/client/minidump_file_writer.cc b/external/breakpad/src/client/minidump_file_writer.cc +index 5c3c5cbb..6b0e2dd0 100644 +--- a/external/breakpad/src/client/minidump_file_writer.cc ++++ b/external/breakpad/src/client/minidump_file_writer.cc +@@ -41,7 +41,7 @@ + #include "common/linux/linux_libc_support.h" + #include "common/string_conversion.h" + #if defined(__linux__) && __linux__ +-#include "third_party/lss/linux_syscall_support.h" ++#include "linux_syscall_support.h" + #endif + + #if defined(__ANDROID__) +diff --git a/external/breakpad/src/common/linux/file_id.cc b/external/breakpad/src/common/linux/file_id.cc +index b483eb5c..eff1e8ce 100644 +--- a/external/breakpad/src/common/linux/file_id.cc ++++ b/external/breakpad/src/common/linux/file_id.cc +@@ -46,7 +46,7 @@ + #include "common/linux/linux_libc_support.h" + #include "common/linux/memory_mapped_file.h" + #include "common/using_std_string.h" +-#include "third_party/lss/linux_syscall_support.h" ++#include "linux_syscall_support.h" + + namespace google_breakpad { + namespace elf { +diff --git a/external/breakpad/src/common/linux/memory_mapped_file.cc b/external/breakpad/src/common/linux/memory_mapped_file.cc +index 99362945..efaae8ec 100644 +--- a/external/breakpad/src/common/linux/memory_mapped_file.cc ++++ b/external/breakpad/src/common/linux/memory_mapped_file.cc +@@ -40,7 +40,7 @@ + #include + + #include "common/memory_range.h" +-#include "third_party/lss/linux_syscall_support.h" ++#include "linux_syscall_support.h" + + namespace google_breakpad { + +diff --git a/external/breakpad/src/common/linux/safe_readlink.cc b/external/breakpad/src/common/linux/safe_readlink.cc +index 870c28af..37872b5b 100644 +--- a/external/breakpad/src/common/linux/safe_readlink.cc ++++ b/external/breakpad/src/common/linux/safe_readlink.cc +@@ -32,7 +32,7 @@ + + #include + +-#include "third_party/lss/linux_syscall_support.h" ++#include "linux_syscall_support.h" + + namespace google_breakpad { + +diff --git a/external/breakpad/src/common/memory_allocator.h b/external/breakpad/src/common/memory_allocator.h +index d28fbfc3..fbf8c977 100644 +--- a/external/breakpad/src/common/memory_allocator.h ++++ b/external/breakpad/src/common/memory_allocator.h +@@ -47,7 +47,7 @@ + #define sys_munmap munmap + #define MAP_ANONYMOUS MAP_ANON + #else +-#include "third_party/lss/linux_syscall_support.h" ++#include "linux_syscall_support.h" + #endif + + namespace google_breakpad { diff --git a/recipes/sentry-breakpad/all/patches/0.4.18-0002-install-breakpad-header.patch b/recipes/sentry-breakpad/all/patches/0.4.18-0002-install-breakpad-header.patch new file mode 100644 index 0000000000000..2956814e8f096 --- /dev/null +++ b/recipes/sentry-breakpad/all/patches/0.4.18-0002-install-breakpad-header.patch @@ -0,0 +1,54 @@ +commit 6f1543b58c2ae4dbe129aec0123e45461da24c3c +Author: Martin Delille +Date: Tue Aug 8 12:45:23 2023 +0200 + + Update external/CMakeLists.txt to install breakpad headers + +diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt +index ca807f7..41d7cd4 100644 +--- a/external/CMakeLists.txt ++++ b/external/CMakeLists.txt +@@ -177,3 +177,43 @@ target_include_directories(breakpad_client + PUBLIC + "$" + ) ++ ++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 ++ RUNTIME DESTINATION bin ++) ++file(GLOB COMMON_FILES breakpad/src/common/*.h) ++install(FILES ${COMMON_FILES} ++ DESTINATION include/breakpad/common ++) ++set(PLATFORM_FOLDER) ++if(IOS) ++ set(PLATFORM_FOLDER ios) ++elseif(APPLE) ++ set(PLATFORM_FOLDER mac) ++elseif(UNIX) ++ set(PLATFORM_FOLDER linux) ++endif() ++if(WIN32) ++ set(PLATFORM_FOLDER windows) ++endif() ++if(NOT PLATFORM_FOLDER) ++ message(FATAL_ERROR "Unknown os -> don't know how to install headers") ++endif() ++file(GLOB COMMON_PLATFORM_HEADERS breakpad/src/common/${PLATFORM_FOLDER}/*.h) ++install(FILES ${COMMON_PLATFORM_HEADERS} ++ DESTINATION include/breakpad/common/${PLATFORM_FOLDER}) ++install(DIRECTORY breakpad/src/client/${PLATFORM_FOLDER} ++ DESTINATION include/breakpad/client ++ FILES_MATCHING PATTERN *.h ++) ++install(DIRECTORY breakpad/src/google_breakpad/common ++ DESTINATION include/breakpad/google_breakpad ++ FILES_MATCHING PATTERN *.h ++) diff --git a/recipes/sentry-breakpad/all/patches/0.5.4-0001-remove-third-pary-lss.patch b/recipes/sentry-breakpad/all/patches/0.5.4-0001-remove-third-pary-lss.patch new file mode 100644 index 0000000000000..f97256dfd7ea1 --- /dev/null +++ b/recipes/sentry-breakpad/all/patches/0.5.4-0001-remove-third-pary-lss.patch @@ -0,0 +1,227 @@ +commit d4424474455a06293d64571b58bef889a8956c34 +Author: Martin Delille +Date: Tue Aug 8 11:59:04 2023 +0200 + + Remove third_party/lss + +diff --git a/external/breakpad/src/client/linux/crash_generation/crash_generation_client.cc b/external/breakpad/src/client/linux/crash_generation/crash_generation_client.cc +index 5a8c6b4c..ea502283 100644 +--- a/external/breakpad/src/client/linux/crash_generation/crash_generation_client.cc ++++ b/external/breakpad/src/client/linux/crash_generation/crash_generation_client.cc +@@ -36,7 +36,7 @@ + + #include "common/linux/eintr_wrapper.h" + #include "common/linux/ignore_ret.h" +-#include "third_party/lss/linux_syscall_support.h" ++#include "linux_syscall_support.h" + + namespace google_breakpad { + +diff --git a/external/breakpad/src/client/linux/handler/exception_handler.cc b/external/breakpad/src/client/linux/handler/exception_handler.cc +index bbdb798b..cc8e451b 100644 +--- a/external/breakpad/src/client/linux/handler/exception_handler.cc ++++ b/external/breakpad/src/client/linux/handler/exception_handler.cc +@@ -94,7 +94,7 @@ + #include "client/linux/minidump_writer/linux_dumper.h" + #include "client/linux/minidump_writer/minidump_writer.h" + #include "common/linux/eintr_wrapper.h" +-#include "third_party/lss/linux_syscall_support.h" ++#include "linux_syscall_support.h" + + #if defined(__ANDROID__) + #include "linux/sched.h" +diff --git a/external/breakpad/src/client/linux/handler/exception_handler_unittest.cc b/external/breakpad/src/client/linux/handler/exception_handler_unittest.cc +index 691ea133..93ae3cae 100644 +--- a/external/breakpad/src/client/linux/handler/exception_handler_unittest.cc ++++ b/external/breakpad/src/client/linux/handler/exception_handler_unittest.cc +@@ -49,7 +49,7 @@ + #include "common/linux/linux_libc_support.h" + #include "common/tests/auto_tempdir.h" + #include "common/using_std_string.h" +-#include "third_party/lss/linux_syscall_support.h" ++#include "linux_syscall_support.h" + #include "google_breakpad/processor/minidump.h" + + using namespace google_breakpad; +diff --git a/external/breakpad/src/client/linux/log/log.cc b/external/breakpad/src/client/linux/log/log.cc +index c45de64b..69b8832a 100644 +--- a/external/breakpad/src/client/linux/log/log.cc ++++ b/external/breakpad/src/client/linux/log/log.cc +@@ -32,7 +32,7 @@ + #include + #include + #else +-#include "third_party/lss/linux_syscall_support.h" ++#include "linux_syscall_support.h" + #endif + + namespace logger { +diff --git a/external/breakpad/src/client/linux/minidump_writer/cpu_set.h b/external/breakpad/src/client/linux/minidump_writer/cpu_set.h +index 70c1c758..92f7cdec 100644 +--- a/external/breakpad/src/client/linux/minidump_writer/cpu_set.h ++++ b/external/breakpad/src/client/linux/minidump_writer/cpu_set.h +@@ -34,7 +34,7 @@ + #include + + #include "common/linux/linux_libc_support.h" +-#include "third_party/lss/linux_syscall_support.h" ++#include "linux_syscall_support.h" + + namespace google_breakpad { + +diff --git a/external/breakpad/src/client/linux/minidump_writer/directory_reader.h b/external/breakpad/src/client/linux/minidump_writer/directory_reader.h +index 62bba877..568278ff 100644 +--- a/external/breakpad/src/client/linux/minidump_writer/directory_reader.h ++++ b/external/breakpad/src/client/linux/minidump_writer/directory_reader.h +@@ -37,7 +37,7 @@ + #include + + #include "common/linux/linux_libc_support.h" +-#include "third_party/lss/linux_syscall_support.h" ++#include "linux_syscall_support.h" + + namespace google_breakpad { + +diff --git a/external/breakpad/src/client/linux/minidump_writer/line_reader.h b/external/breakpad/src/client/linux/minidump_writer/line_reader.h +index d54a67d0..9ba8cd4c 100644 +--- a/external/breakpad/src/client/linux/minidump_writer/line_reader.h ++++ b/external/breakpad/src/client/linux/minidump_writer/line_reader.h +@@ -34,7 +34,7 @@ + #include + + #include "common/linux/linux_libc_support.h" +-#include "third_party/lss/linux_syscall_support.h" ++#include "linux_syscall_support.h" + + namespace google_breakpad { + +diff --git a/external/breakpad/src/client/linux/minidump_writer/linux_dumper.cc b/external/breakpad/src/client/linux/minidump_writer/linux_dumper.cc +index 01b06fac..d967034d 100644 +--- a/external/breakpad/src/client/linux/minidump_writer/linux_dumper.cc ++++ b/external/breakpad/src/client/linux/minidump_writer/linux_dumper.cc +@@ -50,7 +50,7 @@ + #include "common/linux/memory_mapped_file.h" + #include "common/linux/safe_readlink.h" + #include "google_breakpad/common/minidump_exception_linux.h" +-#include "third_party/lss/linux_syscall_support.h" ++#include "linux_syscall_support.h" + + using google_breakpad::elf::FileID; + +diff --git a/external/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc b/external/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc +index bc1e4fbe..01fa6bd4 100644 +--- a/external/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc ++++ b/external/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc +@@ -38,7 +38,7 @@ + #include + + #include "common/scoped_ptr.h" +-#include "third_party/lss/linux_syscall_support.h" ++#include "linux_syscall_support.h" + + #if defined(__ARM_EABI__) + #define TID_PTR_REGISTER "r3" +diff --git a/external/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc b/external/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc +index 718fab7c..51be53ea 100644 +--- a/external/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc ++++ b/external/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc +@@ -56,7 +56,7 @@ + #include "client/linux/minidump_writer/directory_reader.h" + #include "client/linux/minidump_writer/line_reader.h" + #include "common/linux/linux_libc_support.h" +-#include "third_party/lss/linux_syscall_support.h" ++#include "linux_syscall_support.h" + + // Suspends a thread by attaching to it. + static bool SuspendThread(pid_t pid) { +diff --git a/external/breakpad/src/client/linux/minidump_writer/minidump_writer.cc b/external/breakpad/src/client/linux/minidump_writer/minidump_writer.cc +index a5f9b841..6b9241a8 100644 +--- a/external/breakpad/src/client/linux/minidump_writer/minidump_writer.cc ++++ b/external/breakpad/src/client/linux/minidump_writer/minidump_writer.cc +@@ -78,7 +78,7 @@ + #include "common/linux/linux_libc_support.h" + #include "common/minidump_type_helper.h" + #include "google_breakpad/common/minidump_format.h" +-#include "third_party/lss/linux_syscall_support.h" ++#include "linux_syscall_support.h" + + namespace { + +diff --git a/external/breakpad/src/client/linux/minidump_writer/proc_cpuinfo_reader.h b/external/breakpad/src/client/linux/minidump_writer/proc_cpuinfo_reader.h +index 5ae16dfb..dcbb2e63 100644 +--- a/external/breakpad/src/client/linux/minidump_writer/proc_cpuinfo_reader.h ++++ b/external/breakpad/src/client/linux/minidump_writer/proc_cpuinfo_reader.h +@@ -35,7 +35,7 @@ + + #include "client/linux/minidump_writer/line_reader.h" + #include "common/linux/linux_libc_support.h" +-#include "third_party/lss/linux_syscall_support.h" ++#include "linux_syscall_support.h" + + namespace google_breakpad { + +diff --git a/external/breakpad/src/client/minidump_file_writer.cc b/external/breakpad/src/client/minidump_file_writer.cc +index d5193e2c..e9d0b3bd 100644 +--- a/external/breakpad/src/client/minidump_file_writer.cc ++++ b/external/breakpad/src/client/minidump_file_writer.cc +@@ -40,7 +40,7 @@ + #include "common/linux/linux_libc_support.h" + #include "common/string_conversion.h" + #if defined(__linux__) && __linux__ +-#include "third_party/lss/linux_syscall_support.h" ++#include "linux_syscall_support.h" + #endif + + #if defined(__ANDROID__) +diff --git a/external/breakpad/src/common/linux/file_id.cc b/external/breakpad/src/common/linux/file_id.cc +index 0bd2a759..a330f9c1 100644 +--- a/external/breakpad/src/common/linux/file_id.cc ++++ b/external/breakpad/src/common/linux/file_id.cc +@@ -45,7 +45,7 @@ + #include "common/linux/linux_libc_support.h" + #include "common/linux/memory_mapped_file.h" + #include "common/using_std_string.h" +-#include "third_party/lss/linux_syscall_support.h" ++#include "linux_syscall_support.h" + + namespace google_breakpad { + namespace elf { +diff --git a/external/breakpad/src/common/linux/memory_mapped_file.cc b/external/breakpad/src/common/linux/memory_mapped_file.cc +index 7e444607..f193163b 100644 +--- a/external/breakpad/src/common/linux/memory_mapped_file.cc ++++ b/external/breakpad/src/common/linux/memory_mapped_file.cc +@@ -39,7 +39,7 @@ + #include + + #include "common/memory_range.h" +-#include "third_party/lss/linux_syscall_support.h" ++#include "linux_syscall_support.h" + + namespace google_breakpad { + +diff --git a/external/breakpad/src/common/linux/safe_readlink.cc b/external/breakpad/src/common/linux/safe_readlink.cc +index 97ea62c0..27f39326 100644 +--- a/external/breakpad/src/common/linux/safe_readlink.cc ++++ b/external/breakpad/src/common/linux/safe_readlink.cc +@@ -31,7 +31,7 @@ + + #include + +-#include "third_party/lss/linux_syscall_support.h" ++#include "linux_syscall_support.h" + + namespace google_breakpad { + +diff --git a/external/breakpad/src/common/memory_allocator.h b/external/breakpad/src/common/memory_allocator.h +index 1c99913a..5fa3c337 100644 +--- a/external/breakpad/src/common/memory_allocator.h ++++ b/external/breakpad/src/common/memory_allocator.h +@@ -46,7 +46,7 @@ + #define sys_munmap munmap + #define MAP_ANONYMOUS MAP_ANON + #else +-#include "third_party/lss/linux_syscall_support.h" ++#include "linux_syscall_support.h" + #endif + + namespace google_breakpad { diff --git a/recipes/sentry-breakpad/all/patches/0.5.4-0002-install-breakpad-header.patch b/recipes/sentry-breakpad/all/patches/0.5.4-0002-install-breakpad-header.patch new file mode 100644 index 0000000000000..4af6201d0565f --- /dev/null +++ b/recipes/sentry-breakpad/all/patches/0.5.4-0002-install-breakpad-header.patch @@ -0,0 +1,54 @@ +commit 32bf5d991a43151e149a88ee77d600170713ad69 +Author: Martin Delille +Date: Tue Aug 8 12:45:23 2023 +0200 + + Update external/CMakeLists.txt to install breakpad headers + +diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt +index ca807f7..41d7cd4 100644 +--- a/external/CMakeLists.txt ++++ b/external/CMakeLists.txt +@@ -177,3 +177,43 @@ target_include_directories(breakpad_client + PUBLIC + "$" + ) ++ ++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 ++ RUNTIME DESTINATION bin ++) ++file(GLOB COMMON_FILES breakpad/src/common/*.h) ++install(FILES ${COMMON_FILES} ++ DESTINATION include/breakpad/common ++) ++set(PLATFORM_FOLDER) ++if(IOS) ++ set(PLATFORM_FOLDER ios) ++elseif(APPLE) ++ set(PLATFORM_FOLDER mac) ++elseif(UNIX) ++ set(PLATFORM_FOLDER linux) ++endif() ++if(WIN32) ++ set(PLATFORM_FOLDER windows) ++endif() ++if(NOT PLATFORM_FOLDER) ++ message(FATAL_ERROR "Unknown os -> don't know how to install headers") ++endif() ++file(GLOB COMMON_PLATFORM_HEADERS breakpad/src/common/${PLATFORM_FOLDER}/*.h) ++install(FILES ${COMMON_PLATFORM_HEADERS} ++ DESTINATION include/breakpad/common/${PLATFORM_FOLDER}) ++install(DIRECTORY breakpad/src/client/${PLATFORM_FOLDER} ++ DESTINATION include/breakpad/client ++ FILES_MATCHING PATTERN *.h ++) ++install(DIRECTORY breakpad/src/google_breakpad/common ++ DESTINATION include/breakpad/google_breakpad ++ FILES_MATCHING PATTERN *.h ++) diff --git a/recipes/sentry-breakpad/all/patches/0.6.x-0001-remove-third-pary-lss.patch b/recipes/sentry-breakpad/all/patches/0.6.x-0001-remove-third-pary-lss.patch new file mode 100644 index 0000000000000..5134a67b8fcd0 --- /dev/null +++ b/recipes/sentry-breakpad/all/patches/0.6.x-0001-remove-third-pary-lss.patch @@ -0,0 +1,227 @@ +commit 2f63423367c2624a26e60b3867dd2462530d9334 +Author: Martin Delille +Date: Tue Aug 8 11:59:04 2023 +0200 + + Remove third_party/lss + +diff --git a/external/breakpad/src/client/linux/crash_generation/crash_generation_client.cc b/external/breakpad/src/client/linux/crash_generation/crash_generation_client.cc +index f06273d5..45599971 100644 +--- a/external/breakpad/src/client/linux/crash_generation/crash_generation_client.cc ++++ b/external/breakpad/src/client/linux/crash_generation/crash_generation_client.cc +@@ -40,7 +40,7 @@ + + #include "common/linux/eintr_wrapper.h" + #include "common/linux/ignore_ret.h" +-#include "third_party/lss/linux_syscall_support.h" ++#include "linux_syscall_support.h" + + namespace google_breakpad { + +diff --git a/external/breakpad/src/client/linux/handler/exception_handler.cc b/external/breakpad/src/client/linux/handler/exception_handler.cc +index 9e23c119..4edd781c 100644 +--- a/external/breakpad/src/client/linux/handler/exception_handler.cc ++++ b/external/breakpad/src/client/linux/handler/exception_handler.cc +@@ -98,7 +98,7 @@ + #include "client/linux/minidump_writer/linux_dumper.h" + #include "client/linux/minidump_writer/minidump_writer.h" + #include "common/linux/eintr_wrapper.h" +-#include "third_party/lss/linux_syscall_support.h" ++#include "linux_syscall_support.h" + + #if defined(__ANDROID__) + #include "linux/sched.h" +diff --git a/external/breakpad/src/client/linux/handler/exception_handler_unittest.cc b/external/breakpad/src/client/linux/handler/exception_handler_unittest.cc +index b2d8d468..a9199e2d 100644 +--- a/external/breakpad/src/client/linux/handler/exception_handler_unittest.cc ++++ b/external/breakpad/src/client/linux/handler/exception_handler_unittest.cc +@@ -53,7 +53,7 @@ + #include "common/linux/linux_libc_support.h" + #include "common/tests/auto_tempdir.h" + #include "common/using_std_string.h" +-#include "third_party/lss/linux_syscall_support.h" ++#include "linux_syscall_support.h" + #include "google_breakpad/processor/minidump.h" + + using namespace google_breakpad; +diff --git a/external/breakpad/src/client/linux/log/log.cc b/external/breakpad/src/client/linux/log/log.cc +index 2a48d7fe..0e3329a4 100644 +--- a/external/breakpad/src/client/linux/log/log.cc ++++ b/external/breakpad/src/client/linux/log/log.cc +@@ -36,7 +36,7 @@ + #include + #include + #else +-#include "third_party/lss/linux_syscall_support.h" ++#include "linux_syscall_support.h" + #endif + + namespace logger { +diff --git a/external/breakpad/src/client/linux/minidump_writer/cpu_set.h b/external/breakpad/src/client/linux/minidump_writer/cpu_set.h +index 70c1c758..92f7cdec 100644 +--- a/external/breakpad/src/client/linux/minidump_writer/cpu_set.h ++++ b/external/breakpad/src/client/linux/minidump_writer/cpu_set.h +@@ -34,7 +34,7 @@ + #include + + #include "common/linux/linux_libc_support.h" +-#include "third_party/lss/linux_syscall_support.h" ++#include "linux_syscall_support.h" + + namespace google_breakpad { + +diff --git a/external/breakpad/src/client/linux/minidump_writer/directory_reader.h b/external/breakpad/src/client/linux/minidump_writer/directory_reader.h +index 62bba877..568278ff 100644 +--- a/external/breakpad/src/client/linux/minidump_writer/directory_reader.h ++++ b/external/breakpad/src/client/linux/minidump_writer/directory_reader.h +@@ -37,7 +37,7 @@ + #include + + #include "common/linux/linux_libc_support.h" +-#include "third_party/lss/linux_syscall_support.h" ++#include "linux_syscall_support.h" + + namespace google_breakpad { + +diff --git a/external/breakpad/src/client/linux/minidump_writer/line_reader.h b/external/breakpad/src/client/linux/minidump_writer/line_reader.h +index d54a67d0..9ba8cd4c 100644 +--- a/external/breakpad/src/client/linux/minidump_writer/line_reader.h ++++ b/external/breakpad/src/client/linux/minidump_writer/line_reader.h +@@ -34,7 +34,7 @@ + #include + + #include "common/linux/linux_libc_support.h" +-#include "third_party/lss/linux_syscall_support.h" ++#include "linux_syscall_support.h" + + namespace google_breakpad { + +diff --git a/external/breakpad/src/client/linux/minidump_writer/linux_dumper.cc b/external/breakpad/src/client/linux/minidump_writer/linux_dumper.cc +index 85922a9c..3df94a6b 100644 +--- a/external/breakpad/src/client/linux/minidump_writer/linux_dumper.cc ++++ b/external/breakpad/src/client/linux/minidump_writer/linux_dumper.cc +@@ -54,7 +54,7 @@ + #include "common/linux/memory_mapped_file.h" + #include "common/linux/safe_readlink.h" + #include "google_breakpad/common/minidump_exception_linux.h" +-#include "third_party/lss/linux_syscall_support.h" ++#include "linux_syscall_support.h" + + using google_breakpad::elf::FileID; + +diff --git a/external/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc b/external/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc +index 5a135fda..9f27f8d9 100644 +--- a/external/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc ++++ b/external/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc +@@ -42,7 +42,7 @@ + #include + + #include "common/scoped_ptr.h" +-#include "third_party/lss/linux_syscall_support.h" ++#include "linux_syscall_support.h" + + #if defined(__ARM_EABI__) + #define TID_PTR_REGISTER "r3" +diff --git a/external/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc b/external/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc +index 0e58236b..d8613cd3 100644 +--- a/external/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc ++++ b/external/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc +@@ -60,7 +60,7 @@ + #include "client/linux/minidump_writer/directory_reader.h" + #include "client/linux/minidump_writer/line_reader.h" + #include "common/linux/linux_libc_support.h" +-#include "third_party/lss/linux_syscall_support.h" ++#include "linux_syscall_support.h" + + // Suspends a thread by attaching to it. + static bool SuspendThread(pid_t pid) { +diff --git a/external/breakpad/src/client/linux/minidump_writer/minidump_writer.cc b/external/breakpad/src/client/linux/minidump_writer/minidump_writer.cc +index a95dd254..a0ed1e1d 100644 +--- a/external/breakpad/src/client/linux/minidump_writer/minidump_writer.cc ++++ b/external/breakpad/src/client/linux/minidump_writer/minidump_writer.cc +@@ -82,7 +82,7 @@ + #include "common/linux/linux_libc_support.h" + #include "common/minidump_type_helper.h" + #include "google_breakpad/common/minidump_format.h" +-#include "third_party/lss/linux_syscall_support.h" ++#include "linux_syscall_support.h" + + namespace { + +diff --git a/external/breakpad/src/client/linux/minidump_writer/proc_cpuinfo_reader.h b/external/breakpad/src/client/linux/minidump_writer/proc_cpuinfo_reader.h +index 5ae16dfb..dcbb2e63 100644 +--- a/external/breakpad/src/client/linux/minidump_writer/proc_cpuinfo_reader.h ++++ b/external/breakpad/src/client/linux/minidump_writer/proc_cpuinfo_reader.h +@@ -35,7 +35,7 @@ + + #include "client/linux/minidump_writer/line_reader.h" + #include "common/linux/linux_libc_support.h" +-#include "third_party/lss/linux_syscall_support.h" ++#include "linux_syscall_support.h" + + namespace google_breakpad { + +diff --git a/external/breakpad/src/client/minidump_file_writer.cc b/external/breakpad/src/client/minidump_file_writer.cc +index c00af36c..acf5a520 100644 +--- a/external/breakpad/src/client/minidump_file_writer.cc ++++ b/external/breakpad/src/client/minidump_file_writer.cc +@@ -44,7 +44,7 @@ + #include "common/linux/linux_libc_support.h" + #include "common/string_conversion.h" + #if defined(__linux__) && __linux__ +-#include "third_party/lss/linux_syscall_support.h" ++#include "linux_syscall_support.h" + #endif + + #if defined(__ANDROID__) +diff --git a/external/breakpad/src/common/linux/file_id.cc b/external/breakpad/src/common/linux/file_id.cc +index d8fcbd8d..c81e43bc 100644 +--- a/external/breakpad/src/common/linux/file_id.cc ++++ b/external/breakpad/src/common/linux/file_id.cc +@@ -49,7 +49,7 @@ + #include "common/linux/linux_libc_support.h" + #include "common/linux/memory_mapped_file.h" + #include "common/using_std_string.h" +-#include "third_party/lss/linux_syscall_support.h" ++#include "linux_syscall_support.h" + + namespace google_breakpad { + namespace elf { +diff --git a/external/breakpad/src/common/linux/memory_mapped_file.cc b/external/breakpad/src/common/linux/memory_mapped_file.cc +index a7b96eb5..b89a3c95 100644 +--- a/external/breakpad/src/common/linux/memory_mapped_file.cc ++++ b/external/breakpad/src/common/linux/memory_mapped_file.cc +@@ -43,7 +43,7 @@ + #include + + #include "common/memory_range.h" +-#include "third_party/lss/linux_syscall_support.h" ++#include "linux_syscall_support.h" + + namespace google_breakpad { + +diff --git a/external/breakpad/src/common/linux/safe_readlink.cc b/external/breakpad/src/common/linux/safe_readlink.cc +index a42b01a5..939e5309 100644 +--- a/external/breakpad/src/common/linux/safe_readlink.cc ++++ b/external/breakpad/src/common/linux/safe_readlink.cc +@@ -35,7 +35,7 @@ + + #include + +-#include "third_party/lss/linux_syscall_support.h" ++#include "linux_syscall_support.h" + + namespace google_breakpad { + +diff --git a/external/breakpad/src/common/memory_allocator.h b/external/breakpad/src/common/memory_allocator.h +index 1c99913a..5fa3c337 100644 +--- a/external/breakpad/src/common/memory_allocator.h ++++ b/external/breakpad/src/common/memory_allocator.h +@@ -46,7 +46,7 @@ + #define sys_munmap munmap + #define MAP_ANONYMOUS MAP_ANON + #else +-#include "third_party/lss/linux_syscall_support.h" ++#include "linux_syscall_support.h" + #endif + + namespace google_breakpad { diff --git a/recipes/sentry-breakpad/all/patches/0.6.x-0002-install-breakpad-header.patch b/recipes/sentry-breakpad/all/patches/0.6.x-0002-install-breakpad-header.patch new file mode 100644 index 0000000000000..e71cb09fcd187 --- /dev/null +++ b/recipes/sentry-breakpad/all/patches/0.6.x-0002-install-breakpad-header.patch @@ -0,0 +1,54 @@ +commit 78914ad6c0099d1ca4d891435c85ba0a6289814d +Author: Martin Delille +Date: Tue Aug 8 12:45:23 2023 +0200 + + Update external/CMakeLists.txt to install breakpad headers + +diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt +index 9f3a298..31ac3f8 100644 +--- a/external/CMakeLists.txt ++++ b/external/CMakeLists.txt +@@ -185,3 +185,43 @@ target_include_directories(breakpad_client + PUBLIC + "$" + ) ++ ++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 ++ RUNTIME DESTINATION bin ++) ++file(GLOB COMMON_FILES breakpad/src/common/*.h) ++install(FILES ${COMMON_FILES} ++ DESTINATION include/breakpad/common ++) ++set(PLATFORM_FOLDER) ++if(IOS) ++ set(PLATFORM_FOLDER ios) ++elseif(APPLE) ++ set(PLATFORM_FOLDER mac) ++elseif(UNIX) ++ set(PLATFORM_FOLDER linux) ++endif() ++if(WIN32) ++ set(PLATFORM_FOLDER windows) ++endif() ++if(NOT PLATFORM_FOLDER) ++ message(FATAL_ERROR "Unknown os -> don't know how to install headers") ++endif() ++file(GLOB COMMON_PLATFORM_HEADERS breakpad/src/common/${PLATFORM_FOLDER}/*.h) ++install(FILES ${COMMON_PLATFORM_HEADERS} ++ DESTINATION include/breakpad/common/${PLATFORM_FOLDER}) ++install(DIRECTORY breakpad/src/client/${PLATFORM_FOLDER} ++ DESTINATION include/breakpad/client ++ FILES_MATCHING PATTERN *.h ++) ++install(DIRECTORY breakpad/src/google_breakpad/common ++ DESTINATION include/breakpad/google_breakpad ++ FILES_MATCHING PATTERN *.h ++) 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..8cff93402e6c4 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/2.0.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..3450228c14b09 100644 --- a/recipes/sentry-breakpad/config.yml +++ b/recipes/sentry-breakpad/config.yml @@ -1,13 +1,11 @@ versions: - "0.5.0": + "0.6.5": folder: all - "0.4.18": - folder: all - "0.4.17": + "0.6.4": folder: all - "0.4.15": + "0.6.3": folder: all - "0.4.13": + "0.5.4": 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..26aa302e7bd27 100644 --- a/recipes/sentry-crashpad/all/conandata.yml +++ b/recipes/sentry-crashpad/all/conandata.yml @@ -1,23 +1,23 @@ sources: - "0.5.0": - url: "https://github.com/getsentry/sentry-native/releases/download/0.5.0/sentry-native.zip" - sha256: "1a65767a7c6c368a6dea44125eb268ed8374100f33168829f21df78cbfa8632b" + "0.6.5": + url: "https://github.com/getsentry/sentry-native/releases/download/0.6.5/sentry-native.zip" + sha256: "5f74a5c5c3abc6e1e7825d3306be9e3b3fd4e0f586f3cf7e86607d6f56a71995" + "0.6.4": + url: "https://github.com/getsentry/sentry-native/releases/download/0.6.4/sentry-native.zip" + sha256: "e00278bf9a4821bb4008985a5a552a84aba6ebb06d3f9e828082fcbf06b04a38" + "0.6.3": + url: "https://github.com/getsentry/sentry-native/releases/download/0.6.3/sentry-native.zip" + sha256: "6b515c17a9b860ea47c6a5fd7abdfdc89b4b8cbc654c23a8bb42a39bfcb87ad9" + "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" + "0.6.5": + - patch_file: "patches/0.6.5-0001-fix-for-gcc13.patch" + patch_type: "backport" + patch_description: "Extra header required for gcc13" + patch_source: "https://chromium-review.googlesource.com/c/chromium/mini_chromium/+/4847514" diff --git a/recipes/sentry-crashpad/all/conanfile.py b/recipes/sentry-crashpad/all/conanfile.py index 502e2bdfac30e..b18eacff4f64c 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.53.0" class SentryCrashpadConan(ConanFile): @@ -12,9 +18,8 @@ class SentryCrashpadConan(ConanFile): homepage = "https://github.com/getsentry/sentry-native" license = "Apache-2.0" topics = ("crashpad", "error-reporting", "crash-reporting") - provides = "crashpad", "mini_chromium" - + package_type = "static-library" settings = "os", "arch", "compiler", "build_type" options = { "fPIC": [True, False], @@ -26,96 +31,87 @@ 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", + "msvc": "191", "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("zlib/[>=1.2.11 <2]") + if self.settings.os in ("Linux", "FreeBSD"): + self.requires("libcurl/[>=7.78.0 <9]") if self.options.get_safe("with_tls"): - self.requires("openssl/1.1.1n") + self.requires("openssl/[>=1.1 <4]") 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") + self.output.warning("Compiler is unknown. Assuming it supports C++14.") + 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 "" + if Version(self.version) < "0.6.1": + 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=os.path.join(self.source_folder, "external", "crashpad"), + 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 +122,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 +133,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") @@ -148,6 +144,8 @@ def package_info(self): self.cpp_info.components["crashpad_util"].requires = ["crashpad_compat", "crashpad_mini_chromium", "zlib::zlib"] if self.settings.os in ("Linux", "FreeBSD"): self.cpp_info.components["crashpad_util"].system_libs.extend(["pthread", "rt"]) + # Requires libcurl https://github.com/getsentry/crashpad/blob/2237d97ee2c38c930c07001e660be57324f69a37/util/CMakeLists.txt#L256 + self.cpp_info.components["crashpad_util"].requires.extend(["libcurl::libcurl"]) elif self.settings.os == "Windows": self.cpp_info.components["crashpad_util"].system_libs.append("winhttp") elif self.settings.os == "Macos": @@ -179,28 +177,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 +215,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/patches/0.2.6-0001-missing-installed-headers.patch b/recipes/sentry-crashpad/all/patches/0.2.6-0001-missing-installed-headers.patch deleted file mode 100644 index 4f57a94cccd7d..0000000000000 --- a/recipes/sentry-crashpad/all/patches/0.2.6-0001-missing-installed-headers.patch +++ /dev/null @@ -1,66 +0,0 @@ ---- external/crashpad/compat/CMakeLists.txt -+++ external/crashpad/compat/CMakeLists.txt -@@ -108,12 +108,13 @@ - endif() - - if(LINUX OR ANDROID) -- target_include_directories(crashpad_compat ${TI_YPE} "$") -+ target_include_directories(crashpad_compat ${TI_TYPE} "$") -+ target_link_libraries(crashpad_compat ${TI_TYPE} ${CMAKE_DL_LIBS}) - endif() - - if(ANDROID) -- target_include_directories(crashpad_compat ${TI_YPE} "$") -+ target_include_directories(crashpad_compat ${TI_TYPE} "$") - endif() - - set_property(TARGET crashpad_compat PROPERTY EXPORT_NAME compat) - add_library(crashpad::compat ALIAS crashpad_compat) ---- external/crashpad/third_party/mini_chromium/CMakeLists.txt -+++ external/crashpad/third_party/mini_chromium/CMakeLists.txt -@@ -172,3 +172,7 @@ - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/crashpad" - FILES_MATCHING PATTERN "*.h" - ) -+crashpad_install_dev(DIRECTORY build -+ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/crashpad/mini_chromium" -+ FILES_MATCHING PATTERN "*.h" -+) ---- external/crashpad/util/CMakeLists.txt -+++ external/crashpad/util/CMakeLists.txt -@@ -237,7 +237,7 @@ - linux/thread_info.cc - linux/thread_info.h - linux/traits.h -- misc/capture_context_linux.S -+ misc/capture_context_linux.S misc/time_linux.cc - misc/paths_linux.cc - posix/process_info_linux.cc - process/process_memory_linux.cc -@@ -353,7 +353,7 @@ - target_include_directories(crashpad_util PRIVATE - $ - ) - target_link_libraries(crashpad_util - PRIVATE - $ - PUBLIC -@@ -371,6 +371,10 @@ - ) - endif() - -+if(LINUX) -+ target_link_libraries(crashpad_util PRIVATE rt pthread) -+endif() -+ - if(WIN32) - target_link_libraries(crashpad_util PRIVATE user32 version winhttp) - if(MSVC) -@@ -395,3 +399,7 @@ - add_library(crashpad::util ALIAS crashpad_util) - - crashpad_install_target(crashpad_util) -+crashpad_install_dev(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/" -+ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/crashpad/util" -+ FILES_MATCHING PATTERN "*.h" -+) diff --git a/recipes/sentry-crashpad/all/patches/0.6.5-0001-fix-for-gcc13.patch b/recipes/sentry-crashpad/all/patches/0.6.5-0001-fix-for-gcc13.patch new file mode 100644 index 0000000000000..b3a766009b3a7 --- /dev/null +++ b/recipes/sentry-crashpad/all/patches/0.6.5-0001-fix-for-gcc13.patch @@ -0,0 +1,20 @@ +--- a/external/crashpad/third_party/mini_chromium/mini_chromium/base/logging.h 2023-08-25 09:55:27.677142704 +0800 ++++ b/external/crashpad/third_party/mini_chromium/mini_chromium/base/logging.h 2023-08-25 10:06:01.654142494 +0800 +@@ -11,6 +11,7 @@ + #include + #include + #include ++#include + + #include "base/check.h" + #include "base/check_op.h" +--- a/external/crashpad/third_party/mini_chromium/mini_chromium/base/strings/utf_string_conversion_utils.h 2023-08-25 10:11:28.084886020 +0800 ++++ b/external/crashpad/third_party/mini_chromium/mini_chromium/base/strings/utf_string_conversion_utils.h 2023-08-25 11:06:37.044297949 +0800 +@@ -6,6 +6,7 @@ + #define MINI_CHROMIUM_BASE_STRINGS_UTF_STRING_CONVERSION_UTILS_H_ + + #include ++#include + + namespace base { + diff --git a/recipes/sentry-crashpad/all/test_package/CMakeLists.txt b/recipes/sentry-crashpad/all/test_package/CMakeLists.txt index e918f75812c63..f90e3b77e86ad 100644 --- a/recipes/sentry-crashpad/all/test_package/CMakeLists.txt +++ b/recipes/sentry-crashpad/all/test_package/CMakeLists.txt @@ -1,11 +1,13 @@ 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) +if(HAS_PROXY) + add_compile_definitions(HAS_PROXY) +endif() + 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..7088406970539 100644 --- a/recipes/sentry-crashpad/all/test_package/conanfile.py +++ b/recipes/sentry-crashpad/all/test_package/conanfile.py @@ -1,10 +1,29 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.files import mkdir, save, load +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 requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["HAS_PROXY"] = Version(self.dependencies[self.tested_reference_str].ref.version) > "0.6.2" + tc.generate() + handler_exe = "crashpad_handler.exe" if self.settings.os == "Windows" else "crashpad_handler" + handler_bin_path = os.path.join(self.dependencies[self.tested_reference_str].package_folder, "bin", handler_exe) + save(self, os.path.join(self.build_folder, "handler_bin_path"), handler_bin_path) def build(self): cmake = CMake(self) @@ -12,10 +31,9 @@ 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") - 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) + mkdir(self, test_env_dir) + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + handler_bin_path = load(self, os.path.join(self.build_folder, "handler_bin_path")) + self.run(f"{bin_path} {test_env_dir} {handler_bin_path}", env="conanrun") diff --git a/recipes/sentry-crashpad/all/test_package/test_package.cpp b/recipes/sentry-crashpad/all/test_package/test_package.cpp index 8f5ca824f1a03..e968f17053dfa 100644 --- a/recipes/sentry-crashpad/all/test_package/test_package.cpp +++ b/recipes/sentry-crashpad/all/test_package/test_package.cpp @@ -21,6 +21,9 @@ bool startCrashpad(const base::FilePath &db, db, db, url, +#ifdef HAS_PROXY + "", +#endif annotations, arguments, 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..62bd626cd935e --- /dev/null +++ b/recipes/sentry-crashpad/all/test_v1_package/conanfile.py @@ -0,0 +1,25 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +from conan.tools.files import mkdir +from conan.tools.scm import Version +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["HAS_PROXY"] = Version(self.deps_cpp_info["sentry-crashpad"].version) > "0.6.2" + 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..3450228c14b09 100644 --- a/recipes/sentry-crashpad/config.yml +++ b/recipes/sentry-crashpad/config.yml @@ -1,13 +1,11 @@ versions: - "0.5.0": + "0.6.5": folder: all - "0.4.18": - folder: all - "0.4.17": + "0.6.4": folder: all - "0.4.15": + "0.6.3": folder: all - "0.4.13": + "0.5.4": 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..d293ef70c288e 100644 --- a/recipes/sentry-native/all/conandata.yml +++ b/recipes/sentry-native/all/conandata.yml @@ -1,25 +1,16 @@ sources: - "0.5.0": - url: "https://github.com/getsentry/sentry-native/releases/download/0.5.0/sentry-native.zip" - sha256: "1a65767a7c6c368a6dea44125eb268ed8374100f33168829f21df78cbfa8632b" - "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-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" + "0.7.15": + url: "https://github.com/getsentry/sentry-native/releases/download/0.7.15/sentry-native.zip" + sha256: "9880614984c75fc6ed1967b7aa29aebbea2f0c88f2d7c707b18391b5632091c0" + "0.7.12": + url: "https://github.com/getsentry/sentry-native/releases/download/0.7.12/sentry-native.zip" + sha256: "03c99ef84992fddd37f79c63ae78a69ec49b1b1d7598c7a7c5d8e6742b97ea0a" + "0.7.11": + url: "https://github.com/getsentry/sentry-native/releases/download/0.7.11/sentry-native.zip" + sha256: "7fb41a8e5270168958d867504f503beb014035f382edaa07132be65348df27e0" + "0.6.6": + url: "https://github.com/getsentry/sentry-native/releases/download/0.6.6/sentry-native.zip" + sha256: "7a98467c0b2571380a3afc5e681cb13aa406a709529be12d74610b0015ccde0c" + "0.5.4": + url: "https://github.com/getsentry/sentry-native/releases/download/0.5.4/sentry-native.zip" + sha256: "e151bdc76894eb964ba4637361b2a96b7447fb04212053cf695fd7f72b636e4d" diff --git a/recipes/sentry-native/all/conanfile.py b/recipes/sentry-native/all/conanfile.py index 83f02115c148a..8c7c36679a563 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 import os -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 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.scm import Version + +required_conan_version = ">=2.1" 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], @@ -26,8 +33,9 @@ class SentryNativeConan(ConanFile): "transport": ["none", "curl", "winhttp"], "qt": [True, False], "with_crashpad": ["google", "sentry"], + "crashpad_with_tls": ["openssl", False], "with_breakpad": ["google", "sentry"], - "performance": [True, False], + "wer": [True, False], } default_options = { "shared": False, @@ -36,160 +44,260 @@ class SentryNativeConan(ConanFile): "transport": "curl", # overwritten in config_options "qt": False, "with_crashpad": "sentry", + "crashpad_with_tls": "openssl", "with_breakpad": "sentry", - "performance": False, + "wer": False, } - generators = "cmake", "cmake_find_package", "cmake_find_package_multi", "pkg_config" - @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + if Version(self.version) >= "0.7.8" and self.options.get_safe("with_crashpad") == "sentry": + return "20" + else: + return "17" @property def _minimum_compilers_version(self): + if Version(self.version) >= "0.7.8" and self.options.get_safe("with_crashpad") == "sentry": + # Sentry-native 0.7.8 requires C++20: Concepts and bit_cast + # https://github.com/chromium/mini_chromium/blob/e49947ad445c4ed4bc1bb4ed60bbe0fe17efe6ec/base/numerics/byte_conversions.h#L88 + return { + "Visual Studio": "16", + "msvc": "192", + "gcc": "11", + "clang": "14", + "apple-clang": "14", + } + minimum_gcc_version = "5" + if self.options.get_safe("backend") == "breakpad" or self.options.get_safe("backend") == "crashpad": + minimum_gcc_version = "7" return { "Visual Studio": "15", - "gcc": "5", + "msvc": "191", + "gcc": minimum_gcc_version, "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 + if self.settings.os != "Windows" or Version(self.version) < "0.6.0": + del self.options.wer + # Configure default transport if self.settings.os == "Windows": + self.options.backend = "crashpad" self.options.transport = "winhttp" - elif self.settings.os in ("FreeBSD", "Linux") or self.settings.os == "Macos": # Don't use tools.is_apple_os(os) here - self.options.transport = "curl" - else: + elif self.settings.os == "Android": self.options.transport = "none" # Configure default backend - if self.settings.os == "Windows" or self.settings.os == "Macos": # Don't use tools.is_apple_os(os) here - # FIXME: for self.version < 0.4: default backend is "breakpad" when building with MSVC for Windows xp; else: backend=none + # See https://github.com/getsentry/sentry-native/pull/927 + if self.settings.os == "Macos": self.options.backend = "crashpad" - elif self.settings.os in ("FreeBSD", "Linux"): - self.options.backend = "breakpad" - elif self.settings.os == "Android": - self.options.backend = "inproc" - else: - self.options.backend = "inproc" + if self.settings.os in ("FreeBSD", "Linux"): + self.options.backend = "breakpad" if Version(self.version) < "0.7.0" else "crashpad" + if self.settings.os not in ("Linux", "Android") or self.options.backend != "crashpad" or self.options.with_crashpad != "sentry": + del self.options.crashpad_with_tls 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.78.0 <9]") if self.options.backend == "crashpad": - if self.options.with_crashpad == "sentry": - self.requires("sentry-crashpad/{}".format(self.version)) if self.options.with_crashpad == "google": - self.requires("crashpad/cci.20210507") + self.requires("crashpad/cci.20220219") + else: + self.requires("zlib/[>=1.2.11 <2]") + if self.options.get_safe("crashpad_with_tls"): + self.requires("openssl/[>=1.1 <4]") elif self.options.backend == "breakpad": - if self.options.with_breakpad == "sentry": - self.requires("sentry-breakpad/{}".format(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.11") + self.requires("openssl/[>=1.1 <4]") def validate(self): - if self.settings.compiler.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("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": - 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": - raise ConanInvalidConfiguration("Performance monitoring is only valid in 0.4.14 and 0.4.15") 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.options.backend == "breakpad": - self.build_requires("pkgconf/1.7.4") + if self.settings.os == "Windows": + self.tool_requires("cmake/[>=3.16.4 <4]") 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.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 generate(self): + VirtualBuildEnv(self).generate() + tc = CMakeToolchain(self) + tc.variables["SENTRY_BACKEND"] = self.options.backend + # See https://github.com/getsentry/sentry-native/pull/928 + if Version(self.version) < "0.7.0" and self.options.backend == "crashpad": + tc.variables["SENTRY_CRASHPAD_SYSTEM"] = self.options.with_crashpad == "google" + if self.options.backend == "breakpad": + tc.variables["SENTRY_BREAKPAD_SYSTEM"] = self.options.with_breakpad == "google" + 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_BUILD_TESTS"] = False + tc.variables["SENTRY_BUILD_EXAMPLES"] = False + tc.variables["SENTRY_INTEGRATION_QT"] = self.options.qt + if self.options.get_safe("wer", False): + tc.variables["CRASHPAD_WER_ENABLED"] = True + tc.generate() + CMakeDeps(self).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", 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") - self.cpp_info.set_property("cmake_target_name", "sentry::sentry") - self.cpp_info.libs = ["sentry"] + + self.cpp_info.components["sentry"].set_property("cmake_target_name", "sentry::sentry") + self.cpp_info.components["sentry"].libs = ["sentry"] + if self.settings.os in ("Android", "FreeBSD", "Linux"): - self.cpp_info.exelinkflags = ["-Wl,-E,--build-id=sha1"] - self.cpp_info.sharedlinkflags = ["-Wl,-E,--build-id=sha1"] + self.cpp_info.components["sentry"].exelinkflags = ["-Wl,-E,--build-id=sha1"] + self.cpp_info.components["sentry"].sharedlinkflags = ["-Wl,-E,--build-id=sha1"] if self.settings.os in ("FreeBSD", "Linux"): - self.cpp_info.system_libs = ["pthread", "dl"] + self.cpp_info.components["sentry"].system_libs = ["pthread", "dl"] + elif is_apple_os(self): + self.cpp_info.components["sentry"].frameworks = ["CoreGraphics", "CoreText"] elif self.settings.os == "Android": - self.cpp_info.system_libs = ["dl", "log"] + self.cpp_info.components["sentry"].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.components["sentry"].system_libs = ["shlwapi", "dbghelp", "version"] if self.options.transport == "winhttp": - self.cpp_info.system_libs.append("winhttp") + self.cpp_info.components["sentry"].system_libs.append("winhttp") + if self.options.transport == "curl": + self.cpp_info.components["sentry"].requires.extend(["libcurl::libcurl"]) + if self.options.get_safe("qt"): + self.cpp_info.components["sentry"].requires.extend(["qt::qt", "openssl::openssl"]) if not self.options.shared: - self.cpp_info.defines = ["SENTRY_BUILD_STATIC"] + self.cpp_info.components["sentry"].defines = ["SENTRY_BUILD_STATIC"] + + if self.options.backend == "breakpad" and self.options.with_breakpad == "sentry": + self.cpp_info.components["breakpad"].set_property("cmake_target_name", "breakpad_client") + self.cpp_info.components["breakpad"].libs = [] if self.options.shared else ["breakpad_client"] + if is_apple_os(self): + self.cpp_info.components["breakpad"].frameworks.append("CoreFoundation") + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["breakpad"].system_libs.append("pthread") + + self.cpp_info.components["sentry"].requires.append("breakpad") + + if self.options.backend == "crashpad" and self.options.with_crashpad == "sentry": + # mini_chromium + self.cpp_info.components["crashpad_mini_chromium"].set_property("cmake_target_name", "crashpad::mini_chromium") + self.cpp_info.components["crashpad_mini_chromium"].libs = [] if self.options.shared else ["mini_chromium"] + if self.settings.os in ("Linux", "FreeBSD"): + self.cpp_info.components["crashpad_mini_chromium"].system_libs.append("pthread") + 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"]) + else: # iOS + self.cpp_info.components["crashpad_mini_chromium"].frameworks.extend(["CoreGraphics", "CoreText"]) + + # compat + self.cpp_info.components["crashpad_compat"].set_property("cmake_target_name", "crashpad::compat") + # On Apple crashpad_compat is an interface library + if not is_apple_os(self): + self.cpp_info.components["crashpad_compat"].libs = [] if self.options.shared else ["crashpad_compat"] + if self.settings.os in ("Linux", "FreeBSD"): + self.cpp_info.components["crashpad_compat"].system_libs.append("dl") + + # util + self.cpp_info.components["crashpad_util"].set_property("cmake_target_name", "crashpad::util") + self.cpp_info.components["crashpad_util"].libs = [] if self.options.shared else ["crashpad_util"] + self.cpp_info.components["crashpad_util"].requires = ["crashpad_compat", "crashpad_mini_chromium", "zlib::zlib"] + if self.settings.os in ("Linux", "FreeBSD"): + self.cpp_info.components["crashpad_util"].system_libs.extend(["pthread", "rt"]) + elif self.settings.os == "Windows": + self.cpp_info.components["crashpad_util"].system_libs.append("winhttp") + elif self.settings.os == "Macos": + self.cpp_info.components["crashpad_util"].frameworks.extend(["CoreFoundation", "Foundation", "IOKit"]) + self.cpp_info.components["crashpad_util"].system_libs.append("bsm") + if self.options.get_safe("crashpad_with_tls") == "openssl": + self.cpp_info.components["crashpad_util"].requires.append("openssl::openssl") + + # client + self.cpp_info.components["crashpad_client"].set_property("cmake_target_name", "crashpad::client") + self.cpp_info.components["crashpad_client"].libs = [] if self.options.shared else ["crashpad_client"] + self.cpp_info.components["crashpad_client"].requires = ["crashpad_util", "crashpad_mini_chromium"] + + self.cpp_info.components["sentry"].requires.append("crashpad_client") + + # snapshot + self.cpp_info.components["crashpad_snapshot"].set_property("cmake_target_name", "crashpad::snapshot") + self.cpp_info.components["crashpad_snapshot"].libs = [] if self.options.shared else ["crashpad_snapshot"] + self.cpp_info.components["crashpad_snapshot"].requires = [ + "crashpad_client", "crashpad_compat", + "crashpad_util", "crashpad_mini_chromium", + ] + if self.settings.os == "Windows": + self.cpp_info.components["snapshot"].system_libs.append("powrprof") + + # minidump + self.cpp_info.components["crashpad_minidump"].set_property("cmake_target_name", "crashpad::minidump") + self.cpp_info.components["crashpad_minidump"].libs = [] if self.options.shared else ["crashpad_minidump"] + self.cpp_info.components["crashpad_minidump"].requires = [ + "crashpad_compat", "crashpad_snapshot", + "crashpad_util", "crashpad_mini_chromium", + ] + + 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 = [] if self.options.shared else ["crashpad_getopt"] + + # handler + self.cpp_info.components["crashpad_handler"].set_property("cmake_target_name", "crashpad::handler") + self.cpp_info.components["crashpad_handler"].libs = [] if self.options.shared else ["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 = [] if self.options.shared else ["crashpad_tools"] - # TODO: to remove in conan v2 once cmake_find_package* generators removed - self.cpp_info.names["cmake_find_package"] = "sentry" - self.cpp_info.names["cmake_find_package_multi"] = "sentry" + 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/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..37f553d142dc1 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_17) diff --git a/recipes/sentry-native/all/test_package/conanfile.py b/recipes/sentry-native/all/test_package/conanfile.py index 697dfef261b53..9c636a97657a4 100644 --- a/recipes/sentry-native/all/test_package/conanfile.py +++ b/recipes/sentry-native/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.files import mkdir, save, load +from conan.tools.cmake import cmake_layout, CMake, CMakeToolchain 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 layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def generate(self): + tc = CMakeToolchain(self) + tc.generate() + handler_exe = "crashpad_handler.exe" if self.settings.os == "Windows" else "crashpad_handler" + handler_bin_path = os.path.join(self.dependencies[self.tested_reference_str].package_folder, "bin", handler_exe) + save(self, os.path.join(self.build_folder, "handler_bin_path"), handler_bin_path) def build(self): cmake = CMake(self) @@ -21,6 +29,9 @@ 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): + test_env_dir = "test_env" + mkdir(self, test_env_dir) + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + handler_bin_path = load(self, os.path.join(self.build_folder, "handler_bin_path")) + self.run(f"{bin_path} {test_env_dir} {handler_bin_path}", env="conanrun") diff --git a/recipes/sentry-native/config.yml b/recipes/sentry-native/config.yml index 69f2362e8a2a3..089b115c055c4 100644 --- a/recipes/sentry-native/config.yml +++ b/recipes/sentry-native/config.yml @@ -1,13 +1,11 @@ versions: - "0.5.0": + "0.7.15": folder: all - "0.4.18": + "0.7.12": folder: all - "0.4.17": + "0.7.11": folder: all - "0.4.15": + "0.6.6": folder: all - "0.4.13": - folder: all - "0.2.6": + "0.5.4": folder: all diff --git a/recipes/seqan/2.x.x/conanfile.py b/recipes/seqan/2.x.x/conanfile.py index 5f567373a4d1a..fb2227d760d8f 100644 --- a/recipes/seqan/2.x.x/conanfile.py +++ b/recipes/seqan/2.x.x/conanfile.py @@ -1,56 +1,81 @@ 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 copy, get +from conan.tools.layout import basic_layout +from conan.tools.scm import Version + +required_conan_version = ">=1.52.0" + class SeqanConan(ConanFile): name = "seqan" + description = ( + "SeqAn is an open source C++ library of efficient algorithms and data structures for the analysis of sequences " + "with the focus on biological data. Our library applies a unique generic design that guarantees high performance, " + "generality, extensibility, and integration with other libraries. " + "SeqAn is easy to use and simplifies the development of new software tools with a minimal loss of performance." + ) + license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/seqan/seqan" - description = """ -SeqAn is an open source C++ library of efficient algorithms and data structures for the analysis of sequences -with the focus on biological data. Our library applies a unique generic design that guarantees high performance, -generality, extensibility, and integration with other libraries. -SeqAn is easy to use and simplifies the development of new software tools with a minimal loss of performance. -""" - topics = ("conan", "cpp98", "cpp11", "cpp14", "cpp17", - "algorithms", "data structures", "biological sequences") - license = "BSD-3-Clause" - settings = "compiler" + topics = ("algorithms", "data structures", "biological sequences", "header-only") + + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True @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", "clang": "3.4", - "apple-clang": "3.4" + "apple-clang": "3.4", + "msvc": "190", + "Visual Studio": "14", } - def configure(self): + 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("seqan requires C++14, which your compiler does not fully support.") - else: - self.output.warn("seqan requires C++14. Your compiler is unknown. Assuming it supports C++14.") + if not minimum_version: + self.output.warning( + f"{self.name} requires C++{self._min_cppstd}. " + f"Your compiler is unknown. Assuming it supports C++{self._min_cppstd}." + ) + elif Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.name} requires C++{self._min_cppstd}, which your compiler does not fully support." + ) + + 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 = "seqan-seqan-v" + 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("*", dst="include", - src=os.path.join(self._source_subfolder, "include"), keep_path=True) - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + copy(self, "*", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include"), + 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() + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + if self.settings.os == "Windows": + self.cpp_info.defines = ["NOMINMAX"] diff --git a/recipes/seqan/2.x.x/test_package/CMakeLists.txt b/recipes/seqan/2.x.x/test_package/CMakeLists.txt index 64fd988616e27..6fdde597b12f4 100644 --- a/recipes/seqan/2.x.x/test_package/CMakeLists.txt +++ b/recipes/seqan/2.x.x/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +find_package(seqan REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} CONAN_PKG::seqan) +target_link_libraries(${PROJECT_NAME} PRIVATE seqan::seqan) set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14) diff --git a/recipes/seqan/2.x.x/test_package/conanfile.py b/recipes/seqan/2.x.x/test_package/conanfile.py index a59a26a52c8dc..fae501d0afb9e 100644 --- a/recipes/seqan/2.x.x/test_package/conanfile.py +++ b/recipes/seqan/2.x.x/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" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain" + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/seqan/2.x.x/test_package/test_package.cpp b/recipes/seqan/2.x.x/test_package/test_package.cpp index dd08405d3402d..d9a44258b866d 100644 --- a/recipes/seqan/2.x.x/test_package/test_package.cpp +++ b/recipes/seqan/2.x.x/test_package/test_package.cpp @@ -1,8 +1,9 @@ // Demo program for clipping with Gaps objects. -#include -#include #include +#include + +#include using namespace seqan; diff --git a/recipes/seqan/2.x.x/test_v1_package/CMakeLists.txt b/recipes/seqan/2.x.x/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/seqan/2.x.x/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/seqan/2.x.x/test_v1_package/conanfile.py b/recipes/seqan/2.x.x/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..abcaeed3f89b6 --- /dev/null +++ b/recipes/seqan/2.x.x/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.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/seqan3/all/conandata.yml b/recipes/seqan3/all/conandata.yml index 7b4ddfdc76fc6..ee19f74eeca81 100644 --- a/recipes/seqan3/all/conandata.yml +++ b/recipes/seqan3/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.3.0": + url: "https://github.com/seqan/seqan3/releases/download/3.3.0/seqan3-3.3.0-Source.tar.xz" + sha256: "da2fb621268ebc52b9cc26087e96f4a94109db1f4f28d363d19c7c9cdbd788b1" "3.1.0": - url: https://github.com/seqan/seqan3/releases/download/3.1.0/seqan3-3.1.0-Source.tar.xz - sha256: 0b37b1c3450e19c0ebe42c052c3f87babb8074bd772f10a553949c312c285726 + url: "https://github.com/seqan/seqan3/releases/download/3.1.0/seqan3-3.1.0-Source.tar.xz" + sha256: "0b37b1c3450e19c0ebe42c052c3f87babb8074bd772f10a553949c312c285726" diff --git a/recipes/seqan3/all/conanfile.py b/recipes/seqan3/all/conanfile.py index ef55f38b024ff..9ea0680d5bf45 100644 --- a/recipes/seqan3/all/conanfile.py +++ b/recipes/seqan3/all/conanfile.py @@ -1,60 +1,68 @@ -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.52.0" class Seqan3Conan(ConanFile): name = "seqan3" - url = "https://github.com/conan-io/conan-center-index" - homepage = "https://github.com/seqan/seqan3" description = "SeqAn3 is the new version of the popular SeqAn template library for the analysis of biological sequences." - topics = ("cpp20", "algorithms", "data structures", "biological sequences") license = "BSD-3-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/seqan/seqan3" + topics = ("cpp20", "algorithms", "data structures", "biological sequences", "header-only") + + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 20 @property def _compilers_minimum_version(self): - return { - "gcc": "10", - } + if Version(self.version) < "3.3.0": + return {"gcc": "10"} + return {"gcc": "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 != "gcc": raise ConanInvalidConfiguration("SeqAn3 only supports GCC.") 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 minimum_version: - if tools.Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration("SeqAn3 requires C++20, which your compiler does not fully support.") - else: - self.output.warn("SeqAn3 requires C++20. Your compiler is unknown. Assuming it supports C++20.") + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration("SeqAn3 requires C++20, which your compiler does not fully support.") if self.settings.compiler == "gcc" and self.settings.compiler.libcxx != "libstdc++11": - self.output.warn("SeqAn3 does not actively support libstdc++, consider using libstdc++11 instead.") + self.output.warning("SeqAn3 does not actively support libstdc++, consider using libstdc++11 instead.") 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("*", dst="include", - src=os.path.join(self._source_subfolder, "include"), keep_path=True) + copy(self, "*", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self.source_folder, "include"), keep_path=True) + copy(self, "LICENSE.md", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) for submodule in ["range-v3", "cereal", "sdsl-lite"]: - self.copy("*.hpp", dst="include", - src=os.path.join(self._source_subfolder, "submodules", submodule, "include"), keep_path=True) - self.copy("LICENSE.md", dst="licenses", src=self._source_subfolder) + copy(self, "*.hpp", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "submodules", submodule, "include"), + keep_path=True) def package_info(self): self.cpp_info.set_property("cmake_file_name", "seqan3") diff --git a/recipes/seqan3/all/test_package/CMakeLists.txt b/recipes/seqan3/all/test_package/CMakeLists.txt index 8c21ec19c6384..11e58315f3f7e 100644 --- a/recipes/seqan3/all/test_package/CMakeLists.txt +++ b/recipes/seqan3/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ -cmake_minimum_required(VERSION 3.12) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(seqan3 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/seqan3/all/test_package/conanfile.py b/recipes/seqan3/all/test_package/conanfile.py index 38f4483872d47..ef5d7042163ec 100644 --- a/recipes/seqan3/all/test_package/conanfile.py +++ b/recipes/seqan3/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/seqan3/all/test_v1_package/CMakeLists.txt b/recipes/seqan3/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/seqan3/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/seqan3/all/test_v1_package/conanfile.py b/recipes/seqan3/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/seqan3/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/seqan3/config.yml b/recipes/seqan3/config.yml index 9370babb6565a..8d4de7c167625 100644 --- a/recipes/seqan3/config.yml +++ b/recipes/seqan3/config.yml @@ -1,3 +1,5 @@ versions: + "3.3.0": + folder: "all" "3.1.0": folder: "all" diff --git a/recipes/serd/all/conandata.yml b/recipes/serd/all/conandata.yml index b401b2ad15e33..87d44aaa3ef2a 100644 --- a/recipes/serd/all/conandata.yml +++ b/recipes/serd/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.32.0": + url: "https://gitlab.com/drobilla/serd/-/archive/v0.32.0/serd-v0.32.0.tar.gz" + sha256: "355bc7c7fe366e5d4ce32641e4f55d35f8226169ac2d9a2824b1443ab7c03ec8" "0.30.16": url: "https://gitlab.com/drobilla/serd/-/archive/v0.30.16/serd-v0.30.16.tar.gz" sha256: "c139e02af039e277fb1b7deb2a687477bf6ec46cd6348bbb1232c2727a1dd744" diff --git a/recipes/serd/all/conanfile.py b/recipes/serd/all/conanfile.py index dc19503eb153b..cfa7c895a4697 100644 --- a/recipes/serd/all/conanfile.py +++ b/recipes/serd/all/conanfile.py @@ -5,9 +5,10 @@ from conan.tools.layout import basic_layout from conan.tools.meson import Meson, MesonToolchain 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 SerdConan(ConanFile): @@ -18,6 +19,7 @@ class SerdConan(ConanFile): topics = "linked-data", "semantic-web", "rdf", "turtle", "trig", "ntriples", "nquads" license = "ISC" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -34,40 +36,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 - - def build_requirements(self): - self.tool_requires("meson/0.63.1") - self.tool_requires("pkgconf/1.7.4") + 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.2.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): + env = VirtualBuildEnv(self) + env.generate() tc = MesonToolchain(self) tc.project_options["docs"] = "disabled" tc.project_options["tests"] = "disabled" tc.project_options["tools"] = "disabled" - # 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() @@ -85,7 +75,7 @@ def package(self): def package_info(self): self.cpp_info.set_property("pkg_config_name", "serd-0") libname = "serd" - if not (is_msvc(self) and self.options.shared): + if (not (is_msvc(self) and self.options.shared)) or (Version(self.version) >= "0.32.0" and is_msvc(self)): libname += "-0" self.cpp_info.libs = [libname] self.cpp_info.includedirs = [os.path.join("include", "serd-0")] @@ -95,10 +85,10 @@ def package_info(self): self.cpp_info.system_libs.append("m") 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/serd/all/test_package/conanfile.py b/recipes/serd/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/serd/all/test_package/conanfile.py +++ b/recipes/serd/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/serd/all/test_v1_package/CMakeLists.txt b/recipes/serd/all/test_v1_package/CMakeLists.txt index b65b8d3f7b2d9..0d20897301b68 100644 --- a/recipes/serd/all/test_v1_package/CMakeLists.txt +++ b/recipes/serd/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(serd REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE serd::serd) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/serd/config.yml b/recipes/serd/config.yml index 9877695aeb2f5..bfcc718ff5128 100644 --- a/recipes/serd/config.yml +++ b/recipes/serd/config.yml @@ -1,4 +1,6 @@ versions: + "0.32.0": + folder: all "0.30.16": folder: all "0.30.14": diff --git a/recipes/serdepp/all/conandata.yml b/recipes/serdepp/all/conandata.yml index a5bc02fad6305..48987703821e7 100644 --- a/recipes/serdepp/all/conandata.yml +++ b/recipes/serdepp/all/conandata.yml @@ -2,3 +2,9 @@ sources: "0.1.4.1": url: "https://github.com/injae/serdepp/archive/refs/tags/v0.1.4.1.tar.gz" sha256: "0a1112e5fb929e22eba14c8699cfcd4b58cfcbb70068149a6a7ed2a532800972" +patches: + "0.1.4.1": + - patch_file: "patches/0.1.4.1-0001-fix-magic_enum-path.patch" + patch_description: "fix magic_enum path" + patch_type: "conan" + patch_source: "https://github.com/injae/serdepp/pull/57" diff --git a/recipes/serdepp/all/conanfile.py b/recipes/serdepp/all/conanfile.py index 539c3a27d063b..8db8ca27da233 100644 --- a/recipes/serdepp/all/conanfile.py +++ b/recipes/serdepp/all/conanfile.py @@ -1,21 +1,26 @@ import os -from conans.errors import ConanInvalidConfiguration -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 copy, get, apply_conandata_patches, export_conandata_patches +from conan.tools.layout import basic_layout +from conan.tools.scm import Version -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class SerdeppConan(ConanFile): name = "serdepp" description = "c++ serialize and deserialize adaptor library like rust serde.rs" license = "MIT" - topics = ("yaml", "toml", "serialization", "json", "reflection") - homepage = "https://github.com/injae/serdepp" url = "https://github.com/conan-io/conan-center-index" - settings = "arch", "build_type", "compiler", "os" + homepage = "https://github.com/injae/serdepp" + topics = ("yaml", "toml", "serialization", "json", "reflection", "header-only") + + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" options = { - # keeping the option in case upstream support dynamic linking "with_nlohmann_json": [True, False], "with_rapidjson": [True, False], "with_fmt": [True, False], @@ -32,16 +37,8 @@ class SerdeppConan(ConanFile): no_copy_source = 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) - - def package_id(self): - self.info.header_only() + def _min_cppstd(self): + return 17 @property def _compilers_minimum_version(self): @@ -52,48 +49,68 @@ def _compilers_minimum_version(self): "apple-clang": "10", } + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("nameof/0.10.3") + self.requires("magic_enum/0.9.5") + if self.options.with_toml11: + self.requires("toml11/3.8.1") + if self.options.with_yamlcpp: + self.requires("yaml-cpp/0.8.0") + if self.options.with_rapidjson: + self.requires("rapidjson/1.1.0") + if self.options.with_fmt: + self.requires("fmt/10.2.1") + if self.options.with_nlohmann_json: + self.requires("nlohmann_json/3.11.3") + + def package_id(self): + self.info.clear() + def validate(self): compiler = self.settings.compiler if compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, "17") + 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(f"{self.name} requires C++17. Your compiler is unknown. Assuming it supports C++17.") - elif tools.Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration(f"{self.name} requires a compiler that supports at least C++17") + self.output.warning(f"{self.name} requires C++{self._min_cppstd}. Your compiler is unknown. Assuming it supports C++{self._min_cppstd}.") + elif Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration(f"{self.name} requires a compiler that supports at least C++{self._min_cppstd}") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def build(self): + apply_conandata_patches(self) def package(self): - s = lambda x: os.path.join(self._source_subfolder, x) - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - include = os.path.join('include', 'serdepp') - self.copy('*.hpp', dst=include, src=s(include)) - attribute = os.path.join(include, 'attribute') - self.copy('*.hpp', dst=attribute, src=s(attribute)) - adaptor = os.path.join(include, 'adaptor') - self.copy('reflection.hpp', dst=adaptor, src=s(adaptor)) - self.copy('sstream.hpp', dst=adaptor, src=s(adaptor)) + s = lambda x: os.path.join(self.source_folder, x) + p = lambda x: os.path.join(self.package_folder, x) + copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + include = os.path.join("include", "serdepp") + copy(self, "*.hpp", dst=p(include), src=s(include)) + attribute = os.path.join(include, "attribute") + copy(self, "*.hpp", dst=p(attribute), src=s(attribute)) + adaptor = os.path.join(include, "adaptor") + copy(self, "reflection.hpp", dst=p(adaptor), src=s(adaptor)) + copy(self, "sstream.hpp", dst=p(adaptor), src=s(adaptor)) if self.options.with_toml11: - self.copy('toml11.hpp', dst=adaptor, src=s(adaptor)) + copy(self, "toml11.hpp", dst=p(adaptor), src=s(adaptor)) if self.options.with_yamlcpp: - self.copy('yaml-cpp.hpp', dst=adaptor, src=s(adaptor)) + copy(self, "yaml-cpp.hpp", dst=p(adaptor), src=s(adaptor)) if self.options.with_rapidjson: - self.copy('rapidjson.hpp', dst=adaptor, src=s(adaptor)) + copy(self, "rapidjson.hpp", dst=p(adaptor), src=s(adaptor)) if self.options.with_fmt: - self.copy('fmt.hpp', dst=adaptor, src=s(adaptor)) + copy(self, "fmt.hpp", dst=p(adaptor), src=s(adaptor)) if self.options.with_nlohmann_json: - self.copy('nlohmann_json.hpp', dst=adaptor, src=s(adaptor)) + copy(self, "nlohmann_json.hpp", dst=p(adaptor), src=s(adaptor)) - def requirements(self): - self.requires("nameof/0.10.1") - self.requires("magic_enum/0.7.3") - if self.options.with_toml11: - self.requires("toml11/3.7.0") - if self.options.with_yamlcpp: - self.requires("yaml-cpp/0.7.0") - if self.options.with_rapidjson: - self.requires("rapidjson/1.1.0") - if self.options.with_fmt: - self.requires("fmt/8.1.1") - if self.options.with_nlohmann_json: - self.requires("nlohmann_json/3.10.5") + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/serdepp/all/patches/0.1.4.1-0001-fix-magic_enum-path.patch b/recipes/serdepp/all/patches/0.1.4.1-0001-fix-magic_enum-path.patch new file mode 100644 index 0000000000000..1d276241e168b --- /dev/null +++ b/recipes/serdepp/all/patches/0.1.4.1-0001-fix-magic_enum-path.patch @@ -0,0 +1,26 @@ +diff --git a/include/serdepp/meta.hpp b/include/serdepp/meta.hpp +index d0a607a..5e6674f 100644 +--- a/include/serdepp/meta.hpp ++++ b/include/serdepp/meta.hpp +@@ -11,7 +11,7 @@ + #include + #include + #include +-#include ++#include + #include + + #ifndef __SERDEPP_META_HPP__ +diff --git a/include/serdepp/serializer.hpp b/include/serdepp/serializer.hpp +index 2e984af..d8b7247 100644 +--- a/include/serdepp/serializer.hpp ++++ b/include/serdepp/serializer.hpp +@@ -14,7 +14,7 @@ + #include + #include + #include +-#include ++#include + #include + #include + #include "serdepp/meta.hpp" diff --git a/recipes/serdepp/all/test_package/CMakeLists.txt b/recipes/serdepp/all/test_package/CMakeLists.txt index a4620c9ed66c9..f8c810f0f3968 100644 --- a/recipes/serdepp/all/test_package/CMakeLists.txt +++ b/recipes/serdepp/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) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) find_package(serdepp REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/serdepp/all/test_package/conanfile.py b/recipes/serdepp/all/test_package/conanfile.py index e788460ad0765..fae501d0afb9e 100644 --- a/recipes/serdepp/all/test_package/conanfile.py +++ b/recipes/serdepp/all/test_package/conanfile.py @@ -1,11 +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 = "CMakeDeps", "CMakeToolchain" + test_type = "explicit" - 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 +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/serdepp/all/test_package/test_package.cpp b/recipes/serdepp/all/test_package/test_package.cpp index 427fde86f750f..c7b4aeafe407d 100644 --- a/recipes/serdepp/all/test_package/test_package.cpp +++ b/recipes/serdepp/all/test_package/test_package.cpp @@ -1,7 +1,9 @@ -#include -#include #include #include + +#include +#include + class test { public: template diff --git a/recipes/serdepp/all/test_v1_package/CMakeLists.txt b/recipes/serdepp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/serdepp/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/serdepp/all/test_v1_package/conanfile.py b/recipes/serdepp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..e788460ad0765 --- /dev/null +++ b/recipes/serdepp/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): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/serf/all/CMakeLists.txt b/recipes/serf/all/CMakeLists.txt deleted file mode 100644 index a69305eb3971f..0000000000000 --- a/recipes/serf/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/serf/all/conandata.yml b/recipes/serf/all/conandata.yml index 10d6d086a2a84..6a0aa39d546ff 100644 --- a/recipes/serf/all/conandata.yml +++ b/recipes/serf/all/conandata.yml @@ -1,19 +1,12 @@ sources: "1.3.9": - url: [ - "https://www.apache.org/dist/serf/serf-1.3.9.tar.bz2", - "https://github.com/apache/serf/archive/1.3.9.tar.gz", - ] + url: "https://archive.apache.org/dist/serf/serf-1.3.9.tar.bz2" sha256: "549c2d21c577a8a9c0450facb5cca809f26591f048e466552240947bdf7a87cc" patches: "1.3.9": - patch_file: "patches/0001-1.3.9-scons-python3.patch" - base_path: "source_subfolder" - patch_file: "patches/0002-1.3.9-scons-respect-flags.patch" - base_path: "source_subfolder" - patch_file: "patches/0003-1.3.9-scons-msvc.patch" - base_path: "source_subfolder" - patch_file: "patches/0004-1.3.9-scons-python-spaces.patch" - base_path: "source_subfolder" - patch_file: "patches/0005-1.3.9-serf-openssl-3.x.patch" - base_path: "source_subfolder" + - patch_file: "patches/0006-1.3.9-scons-fix-zlib-shared-name.patch" diff --git a/recipes/serf/all/conanfile.py b/recipes/serf/all/conanfile.py index 389e7ad59c4e3..cf758acbc390f 100644 --- a/recipes/serf/all/conanfile.py +++ b/recipes/serf/all/conanfile.py @@ -1,19 +1,28 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, tools -from conans.errors import ConanException -from contextlib import contextmanager -import glob import os import re +from conan import ConanFile +from conan.tools.apple import fix_apple_shared_install_name, is_apple_os +from conan.tools.env import Environment, VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, chdir, copy, export_conandata_patches, get, load, mkdir, rm, rmdir, save +from conan.tools.gnu import AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, unix_path, msvs_toolset +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" + class SerfConan(ConanFile): name = "serf" - description = "The serf library is a high performance C-based HTTP client library built upon the Apache Portable Runtime (APR) library." + description = ("The serf library is a high performance C-based HTTP client library " + "built upon the Apache Portable Runtime (APR) library.") license = "Apache-2.0" - topics = ("conan", "serf", "apache", "http", "library") - homepage = "https://serf.apache.org/" url = "https://github.com/conan-io/conan-center-index" - exports_sources = "patches/**" + homepage = "https://serf.apache.org/" + topics = ("apache", "http", "library") + + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -24,91 +33,100 @@ class SerfConan(ConanFile): "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: - 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") - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - self.requires("apr-util/1.6.1") - self.requires("zlib/1.2.12") - self.requires("openssl/3.0.3") + self.requires("apr-util/1.6.1", transitive_headers=True, transitive_libs=True) + self.requires("zlib/[>=1.2.11 <2]") + self.requires("openssl/[>=1.1 <4]") def build_requirements(self): - self.build_requires("scons/4.3.0") + self.tool_requires("scons/4.3.0") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename(glob.glob("serf-*")[0], self._source_subfolder) - - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - pc_in = os.path.join(self._source_subfolder, "build", "serf.pc.in") - tools.save(pc_in, tools.load(pc_in)) + get(self, **self.conan_data["sources"][self.version], strip_root=True) @property def _cc(self): - if tools.get_env("CC"): - return tools.get_env("CC") - if tools.is_apple_os(self.settings.os): + if "CC" in os.environ: + return os.environ["CC"] + if is_apple_os(self): return "clang" - return { - "Visual Studio": "cl", - }.get(str(self.settings.compiler), str(self.settings.compiler)) + if is_msvc(self): + return "cl" + return str(self.settings.compiler) def _lib_path_arg(self, path): - argname = "LIBPATH:" if self.settings.compiler == "Visual Studio" else "L" - return "-{}'{}'".format(argname, path.replace("\\", "/")) - - @contextmanager - def _build_context(self): - extra_env = {} - if self.settings.compiler == "Visual Studio": - extra_env["OPENSSL_LIBS"] = ";".join("{}.lib".format(lib) for lib in self.deps_cpp_info["openssl"].libs) - with tools.environment_append(extra_env): - with tools.vcvars(self.settings) if self.settings.compiler == "Visual Studio" else tools.no_op(): - yield - - def build(self): - self._patch_sources() - autotools = AutoToolsBuildEnvironment(self) - args = ["-Y", os.path.join(self.source_folder, self._source_subfolder)] + argname = "LIBPATH:" if is_msvc(self) else "L" + return "-{}'{}'".format(argname, unix_path(self, path)) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + + autotools = AutotoolsToolchain(self) + args = ["-Y", self.source_folder] + libdirs = sum([dep.cpp_info.libdirs for dep in self.dependencies.values()], []) + sharedlinkflags = sum([dep.cpp_info.sharedlinkflags for dep in self.dependencies.values()], []) + includedirs = sum([dep.cpp_info.includedirs for dep in self.dependencies.values()], []) + cflags = sum([dep.cpp_info.cflags for dep in self.dependencies.values()], []) + cflags += autotools.cflags + libs = sum([dep.cpp_info.libs for dep in self.dependencies.values()], []) + if self.options.get_safe("fPIC"): + cflags.append("-fPIC") kwargs = { - "APR": self.deps_cpp_info["apr"].rootpath.replace("\\", "/"), - "APU": self.deps_cpp_info["apr-util"].rootpath.replace("\\", "/"), - "OPENSSL": self.deps_cpp_info["openssl"].rootpath.replace("\\", "/"), - "PREFIX": self.package_folder.replace("\\", "/"), - "LIBDIR": os.path.join(self.package_folder, "lib").replace("\\", "/"), - "ZLIB": self.deps_cpp_info["zlib"].rootpath.replace("\\", "/"), + "APR": unix_path(self, self.dependencies["apr"].package_folder), + "APU": unix_path(self, self.dependencies["apr-util"].package_folder), + "OPENSSL": unix_path(self, self.dependencies["openssl"].package_folder), + "PREFIX": unix_path(self, self.package_folder), + "LIBDIR": unix_path(self, os.path.join(self.package_folder, "lib")), + "ZLIB": unix_path(self, self.dependencies["zlib"].package_folder), "DEBUG": self.settings.build_type == "Debug", - "APR_STATIC": not self.options["apr"].shared, - "CFLAGS": " ".join(self.deps_cpp_info.cflags + (["-fPIC"] if self.options.get_safe("fPIC") else []) + autotools.flags), - "LINKFLAGS": " ".join(self.deps_cpp_info.sharedlinkflags) + " " + " ".join(self._lib_path_arg(l) for l in self.deps_cpp_info.lib_paths), - "CPPFLAGS": " ".join("-D{}".format(d) for d in autotools.defines) + " " + " ".join("-I'{}'".format(inc.replace("\\", "/")) for inc in self.deps_cpp_info.include_paths), + "APR_STATIC": not self.dependencies["apr"].options.shared, + "CFLAGS": " ".join(cflags), + "LINKFLAGS": " ".join(sharedlinkflags + [self._lib_path_arg(l) for l in libdirs]), + "CPPFLAGS": " ".join([f"-D{d}" for d in autotools.defines] + [f"-I'{unix_path(self, inc)}'" for inc in includedirs]), "CC": self._cc, "SOURCE_LAYOUT": "False", } - if self.settings.compiler == "Visual Studio": - kwargs.update({ - "TARGET_ARCH": str(self.settings.arch), - "MSVC_VERSION": "{:.1f}".format(float(tools.msvs_toolset(self.settings).lstrip("v")) / 10), - }) + if is_msvc(self): + kwargs["TARGET_ARCH"] = str(self.settings.arch) + kwargs["MSVC_VERSION"] = "{:.1f}".format(float(msvs_toolset(self).lstrip("v")) / 10) + kwargs["ZLIB_LIBNAME"] = f"{self.dependencies['zlib'].cpp_info.libs[0]}" + env = Environment() + env.define("OPENSSL_LIBS", os.pathsep.join(f"{lib}.lib" for lib in self.dependencies["openssl"].cpp_info.aggregated_components().libs)) + env.vars(self).save_script("conanbuild_msvc") + else: + kwargs["LIBS"] = " ".join(libs) + + escape_str = lambda x: f'"{x}"' + scons_args = " ".join([escape_str(s) for s in args] + [f"{k}={escape_str(v)}" for k, v in kwargs.items()]) + save(self, os.path.join(self.source_folder, "scons_args"), scons_args) - escape_str = lambda x : "\"{}\"".format(x) - with tools.chdir(self._source_subfolder): - with self._build_context(): - self.run("scons {} {}".format(" ".join(escape_str(s) for s in args), " ".join("{}={}".format(k, escape_str(v)) for k, v in kwargs.items())), run_environment=True) + def _patch_sources(self): + apply_conandata_patches(self) + pc_in = os.path.join(self.source_folder, "build", "serf.pc.in") + save(self, pc_in, load(self, pc_in)) + + def build(self): + self._patch_sources() + with chdir(self, self.source_folder): + self.run("scons {}".format(load(self, "scons_args"))) @property def _static_ext(self): @@ -116,50 +134,47 @@ def _static_ext(self): @property def _shared_ext(self): - if tools.is_apple_os(self.settings.os): + if is_apple_os(self): return "dylib" - return { - "Windows": "dll", - }.get(str(self.settings.os), "so") + if self.settings.os == "Windows": + return "dll" + return "so" + + @property + def _version_major(self): + return Version(self.version).major def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - with tools.chdir(self._source_subfolder): - with self._build_context(): - self.run("scons install -Y \"{}\"".format(os.path.join(self.source_folder, self._source_subfolder)), run_environment=True) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + with chdir(self, self.source_folder): + self.run(f'scons install -Y "{self.source_folder}"') - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) if self.settings.os == "Windows": - for file in glob.glob(os.path.join(self.package_folder, "lib", "*.exp")): - os.unlink(file) - for file in glob.glob(os.path.join(self.package_folder, "lib", "*.pdb")): - os.unlink(file) + rm(self, "*.exp", os.path.join(self.package_folder, "lib"), recursive=True) + rm(self, "*.pdb", os.path.join(self.package_folder, "lib"), recursive=True) if self.options.shared: - for file in glob.glob(os.path.join(self.package_folder, "lib", "serf-{}.*".format(self._version_major))): - os.unlink(file) - tools.mkdir(os.path.join(self.package_folder, "bin")) - os.rename(os.path.join(self.package_folder, "lib", "libserf-{}.dll".format(self._version_major)), - os.path.join(self.package_folder, "bin", "libserf-{}.dll".format(self._version_major))) + rm(self, f"serf-{self._version_major}.*", os.path.join(self.package_folder, "lib"), recursive=True) + mkdir(self, os.path.join(self.package_folder, "bin")) + os.rename(os.path.join(self.package_folder, "lib", f"libserf-{self._version_major}.dll"), + os.path.join(self.package_folder, "bin", f"libserf-{self._version_major}.dll")) else: - for file in glob.glob(os.path.join(self.package_folder, "lib", "libserf-{}.*".format(self._version_major))): - os.unlink(file) + rm(self, f"libserf-{self._version_major}.*", os.path.join(self.package_folder, "lib"), recursive=True) else: ext_to_remove = self._static_ext if self.options.shared else self._shared_ext for fn in os.listdir(os.path.join(self.package_folder, "lib")): if any(re.finditer("\\.{}(\.?|$)".format(ext_to_remove), fn)): os.unlink(os.path.join(self.package_folder, "lib", fn)) - - @property - def _version_major(self): - return self.version.split(".", 1)[0] + fix_apple_shared_install_name(self) def package_info(self): libprefix = "" if self.settings.os == "Windows" and self.options.shared: libprefix = "lib" - libname = "{}serf-{}".format(libprefix, self._version_major) + version_major = Version(self.version).major + libname = f"{libprefix}serf-{version_major}" self.cpp_info.libs = [libname] - self.cpp_info.includedirs.append(os.path.join("include", "serf-{}".format(self._version_major))) - self.cpp_info.names["pkg_config"] = libname + self.cpp_info.includedirs.append(os.path.join("include", f"serf-{version_major}")) + self.cpp_info.set_property("pkg_config_name", libname) if self.settings.os == "Windows": self.cpp_info.system_libs = ["user32", "advapi32", "gdi32", "ws2_32", "crypt32", "mswsock", "rpcrt4", "secur32"] diff --git a/recipes/serf/all/patches/0006-1.3.9-scons-fix-zlib-shared-name.patch b/recipes/serf/all/patches/0006-1.3.9-scons-fix-zlib-shared-name.patch new file mode 100644 index 0000000000000..144bdf9d5c3cc --- /dev/null +++ b/recipes/serf/all/patches/0006-1.3.9-scons-fix-zlib-shared-name.patch @@ -0,0 +1,19 @@ +--- SConstruct 2015-09-17 14:46:24.000000000 +0200 ++++ SConstruct 2023-10-23 12:11:41.087125000 +0200 +@@ -117,6 +117,7 @@ + None), + RawListVariable('CPPFLAGS', "Extra flags for the C preprocessor " + "(space separated)", None), ++ RawListVariable('ZLIB_LIBNAME', 'Name of the zlib library file', 'zlib.lib'), + ) + + if sys.platform == 'win32': +@@ -326,7 +327,7 @@ + CPPPATH=['$APR/include', '$APU/include']) + + # zlib +- env.Append(LIBS=['zlib.lib']) ++ env.Append(LIBS=[env['ZLIB_LIBNAME'][0]]) + if not env.get('SOURCE_LAYOUT', None): + env.Append(CPPPATH=['$ZLIB/include'], + LIBPATH=['$ZLIB/lib']) diff --git a/recipes/serf/all/test_package/CMakeLists.txt b/recipes/serf/all/test_package/CMakeLists.txt index f8b971e2db377..6423a8f84e174 100644 --- a/recipes/serf/all/test_package/CMakeLists.txt +++ b/recipes/serf/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(serf REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE serf::serf) diff --git a/recipes/serf/all/test_package/conanfile.py b/recipes/serf/all/test_package/conanfile.py index 4aebe114eeb59..ef5d7042163ec 100644 --- a/recipes/serf/all/test_package/conanfile.py +++ b/recipes/serf/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 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.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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/serf/all/test_v1_package/CMakeLists.txt b/recipes/serf/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/serf/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/serf/all/test_v1_package/conanfile.py b/recipes/serf/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..3f4a9f50f389e --- /dev/null +++ b/recipes/serf/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +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.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/serial/all/CMakeLists.txt b/recipes/serial/all/CMakeLists.txt index 25209c318b985..bb8bfce6bd49d 100644 --- a/recipes/serial/all/CMakeLists.txt +++ b/recipes/serial/all/CMakeLists.txt @@ -1,9 +1,6 @@ -cmake_minimum_required(VERSION 3.5) +cmake_minimum_required(VERSION 3.12) project(cmake_wrapper) -include(conanbuildinfo.cmake) -conan_basic_setup() - # Work-around for https://github.com/wjwwood/serial/issues/135 list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) @@ -11,6 +8,6 @@ if(WIN32 AND BUILD_SHARED_LIBS) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) endif() -add_subdirectory(source_subfolder) +add_subdirectory(src) install(TARGETS serial) diff --git a/recipes/serial/all/conanfile.py b/recipes/serial/all/conanfile.py index d5553000bbddb..b0bd05408cdc0 100644 --- a/recipes/serial/all/conanfile.py +++ b/recipes/serial/all/conanfile.py @@ -1,17 +1,22 @@ import os -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration, ConanException + +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 copy, get + +required_conan_version = ">=1.53.0" class ConanRecipe(ConanFile): name = "serial" description = "Cross-platform library for interfacing with rs-232 serial like ports" - topics = ("serial", "rs-232", "com") - homepage = "http://wjwwood.io/serial/" - url = "https://github.com/conan-io/conan-center-index" license = "MIT" - exports_sources = ["CMakeLists.txt", "Findcatkin.cmake"] - generators = "cmake" + url = "https://github.com/conan-io/conan-center-index" + homepage = "http://wjwwood.io/serial/" + topics = ("rs-232", "com") + + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -22,11 +27,9 @@ class ConanRecipe(ConanFile): "fPIC": True, } - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder) + copy(self, "Findcatkin.cmake", src=self.recipe_folder, dst=self.export_sources_folder) def config_options(self): if self.settings.os == "Windows": @@ -34,35 +37,38 @@ 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]) - os.rename("{}-{}".format(self.name, 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 - self._cmake = CMake(self) - self._cmake.configure() - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + # Relocatable shared lib on Macos + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" + tc.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=self.export_sources_folder) cmake.build() def package(self): - self.copy("README.md", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "README.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 = ["serial"] - if self.settings.os == "Linux": - self.cpp_info.system_libs = ["rt", "pthread"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs = ["m", "rt", "pthread"] elif self.settings.os == "Windows": self.cpp_info.system_libs = ["setupapi"] - elif tools.is_apple_os(self.settings.os): - self.cpp_info.frameworks = ["IOKit", "Foundation"] + elif is_apple_os(self): + self.cpp_info.frameworks = ["IOKit", "Foundation", "CoreFoundation"] diff --git a/recipes/serial/all/test_package/CMakeLists.txt b/recipes/serial/all/test_package/CMakeLists.txt index 328eaf93b7304..344a587ace219 100644 --- a/recipes/serial/all/test_package/CMakeLists.txt +++ b/recipes/serial/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(serial REQUIRED) +find_package(serial REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} serial::serial) diff --git a/recipes/serial/all/test_package/conanfile.py b/recipes/serial/all/test_package/conanfile.py index 5493d58611803..ef5d7042163ec 100644 --- a/recipes/serial/all/test_package/conanfile.py +++ b/recipes/serial/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" + 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/serial/all/test_v1_package/CMakeLists.txt b/recipes/serial/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/serial/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/serial/all/test_v1_package/conanfile.py b/recipes/serial/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..1bf1c7e26255d --- /dev/null +++ b/recipes/serial/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_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/serial/all/test_v1_package/test_package.cpp b/recipes/serial/all/test_v1_package/test_package.cpp new file mode 100644 index 0000000000000..8cb01ed6a8b53 --- /dev/null +++ b/recipes/serial/all/test_v1_package/test_package.cpp @@ -0,0 +1,23 @@ +#include +#include +#include +#include + +#include "serial/serial.h" + +using namespace std; + +int main() { + vector devices_found = serial::list_ports(); + + vector::iterator iter = devices_found.begin(); + + while (iter != devices_found.end()) { + serial::PortInfo device = *iter++; + + printf("(%s, %s, %s)\n", device.port.c_str(), + device.description.c_str(), device.hardware_id.c_str()); + } + + return 0; +} diff --git a/recipes/sfl/all/conandata.yml b/recipes/sfl/all/conandata.yml new file mode 100644 index 0000000000000..6e0da0d8aaa7b --- /dev/null +++ b/recipes/sfl/all/conandata.yml @@ -0,0 +1,31 @@ +sources: + "1.8.2": + url: "https://github.com/slavenf/sfl-library/archive/refs/tags/1.8.2.tar.gz" + sha256: "06dc215f73ebfbbcbb4ef39cd556bffe0da16918f542045407f51c4b9effcabb" + "1.8.0": + url: "https://github.com/slavenf/sfl-library/archive/refs/tags/1.8.0.tar.gz" + sha256: "bb473a8e0b46ecff957c06112593b9a4104e0d1ec8e9d5840ff33c20ad3a243e" + "1.7.0": + url: "https://github.com/slavenf/sfl-library/archive/refs/tags/1.7.0.tar.gz" + sha256: "9e09bacc51cfb085c4a6030f90cbea45685de608900d6b7b3c0a9f4971682652" + "1.6.0": + url: "https://github.com/slavenf/sfl-library/archive/refs/tags/1.6.0.tar.gz" + sha256: "f5121d95c2f3922da4f1cec9bb6045d8733892ddc55ee3c47c99e761e5df5ec4" + "1.5.0": + url: "https://github.com/slavenf/sfl-library/archive/refs/tags/1.5.0.tar.gz" + sha256: "767d9b3627540071d2a80f18f034d80d6e9eaffc027876c7898c51aeebd3bf37" + "1.4.0": + url: "https://github.com/slavenf/sfl-library/archive/refs/tags/1.4.0.tar.gz" + sha256: "dcdc6c40a60116075910e3321fe12065142d78f4947826aac263ade1d84d449a" + "1.3.1": + url: "https://github.com/slavenf/sfl-library/archive/refs/tags/1.3.1.tar.gz" + sha256: "e541857067ae3e6c8d9933736e70ef92c1ce0a0e374872497328edd2e4e47ae9" + "1.3.0": + url: "https://github.com/slavenf/sfl-library/archive/refs/tags/1.3.0.tar.gz" + sha256: "1d0e797c5e11bbc861f9f1ae8eb7d9378d456d6cd1c43e00cdec6d3664e745e6" + "1.2.4": + url: "https://github.com/slavenf/sfl-library/archive/refs/tags/1.2.4.tar.gz" + sha256: "e24d4adb1aff638e17ef49841881992a1020dc951e4e9721b81b76d44ef89f5b" + "1.2.3": + url: "https://github.com/slavenf/sfl-library/archive/refs/tags/1.2.3.tar.gz" + sha256: "6111a81b5dcad091c5c8a420d127c1bbfb06f8fbb7d915e6a30b4b7d2d67db71" diff --git a/recipes/sfl/all/conanfile.py b/recipes/sfl/all/conanfile.py new file mode 100644 index 0000000000000..ef6582dd3b15f --- /dev/null +++ b/recipes/sfl/all/conanfile.py @@ -0,0 +1,45 @@ +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.62.0" + + +class SflConan(ConanFile): + name = "sfl" + description = "A header-only C++11 library that offers several new containers" + license = "Zlib" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/slavenf/sfl-library" + topics = ("containers", "header-only") + package_type = "header-library" + 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, "LICENSE.txt", 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.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/sfl/all/test_package/CMakeLists.txt b/recipes/sfl/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..f8085bbcbe2d6 --- /dev/null +++ b/recipes/sfl/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(sfl REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE sfl::sfl) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/sfl/all/test_package/conanfile.py b/recipes/sfl/all/test_package/conanfile.py new file mode 100644 index 0000000000000..e62d4fe972ff2 --- /dev/null +++ b/recipes/sfl/all/test_package/conanfile.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python3 + +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/sfl/all/test_package/test_package.cpp b/recipes/sfl/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..78ba6f47df1d5 --- /dev/null +++ b/recipes/sfl/all/test_package/test_package.cpp @@ -0,0 +1,23 @@ +#include + +#include "sfl/small_vector.hpp" +#include "sfl/small_flat_set.hpp" +#include "sfl/small_flat_map.hpp" +#include "sfl/small_flat_multiset.hpp" +#include "sfl/small_flat_multimap.hpp" +#include "sfl/small_unordered_flat_set.hpp" +#include "sfl/small_unordered_flat_map.hpp" +#include "sfl/small_unordered_flat_multiset.hpp" +#include "sfl/small_unordered_flat_multimap.hpp" +#include "sfl/compact_vector.hpp" +#include "sfl/segmented_vector.hpp" + +int main() { + sfl::small_vector v1; + v1.push_back(123); + + sfl::segmented_vector v2; + v2.push_back(123); + + return EXIT_SUCCESS; +} diff --git a/recipes/sfl/config.yml b/recipes/sfl/config.yml new file mode 100644 index 0000000000000..6954c22c7ff15 --- /dev/null +++ b/recipes/sfl/config.yml @@ -0,0 +1,21 @@ +versions: + "1.8.2": + folder: "all" + "1.8.0": + folder: "all" + "1.7.0": + folder: "all" + "1.6.0": + folder: "all" + "1.5.0": + folder: "all" + "1.4.0": + folder: "all" + "1.3.1": + folder: "all" + "1.3.0": + folder: "all" + "1.2.4": + folder: "all" + "1.2.3": + folder: "all" diff --git a/recipes/sfml/all/conandata.yml b/recipes/sfml/all/conandata.yml index 7ee890396d833..e8b0f34c7c588 100644 --- a/recipes/sfml/all/conandata.yml +++ b/recipes/sfml/all/conandata.yml @@ -1,10 +1,73 @@ sources: + "2.6.2": + url: "https://www.sfml-dev.org/files/SFML-2.6.2-sources.zip" + sha256: "19d6dbd9c901c74441d9888c13cb1399f614fe8993d59062a72cfbceb00fed04" + "2.6.1": + url: "https://www.sfml-dev.org/files/SFML-2.6.1-sources.zip" + sha256: "5bf19e5c303516987f7f54d4ff1b208a0f9352ffa1cd55f992527016de0e8cb7" + "2.6.0": + url: "https://www.sfml-dev.org/files/SFML-2.6.0-sources.zip" + sha256: "dc477fc7266641709046bd38628c909f5748bd2564b388cf6c750a9e20cdfef1" "2.5.1": url: "https://www.sfml-dev.org/files/SFML-2.5.1-sources.zip" sha256: "bf1e0643acb92369b24572b703473af60bac82caf5af61e77c063b779471bb7f" patches: + "2.6.2": + - patch_file: "patches/2.6.2-0001-cmake-robust-find-deps.patch" + patch_description: "Robust discovery of dependencies" + patch_type: "conan" + - patch_file: "patches/2.6.2-0003-allow-shared-MT.patch" + patch_description: "Allow to build shared SFML with MT runtime" + patch_type: "portability" + - patch_file: "patches/2.6.1-0006-disable-warning-flags.patch" + patch_description: "Disable warning flags which may cause compilation errors" + patch_type: "portability" + "2.6.1": + - patch_file: "patches/2.6.0-0001-cmake-robust-find-deps.patch" + patch_description: "Robust discovery of dependencies" + patch_type: "conan" + - patch_file: "patches/2.6.0-0003-allow-shared-MT.patch" + patch_description: "Allow to build shared SFML with MT runtime" + patch_type: "portability" + - patch_file: "patches/2.6.0-0004-fix-ios.patch" + patch_description: "Fix iOS detection logic in CMakeLists" + patch_type: "portability" + - patch_file: "patches/2.6.1-0006-disable-warning-flags.patch" + patch_description: "Disable warning flags which may cause compilation errors" + patch_type: "portability" + - patch_file: "patches/2.6.0-0007-use-cci-minimp3.patch" + patch_description: "use cci minimp3 recipe" + patch_type: "conan" + "2.6.0": + - patch_file: "patches/2.6.0-0001-cmake-robust-find-deps.patch" + patch_description: "Robust discovery of dependencies" + patch_type: "conan" + - patch_file: "patches/2.6.0-0003-allow-shared-MT.patch" + patch_description: "Allow to build shared SFML with MT runtime" + patch_type: "portability" + - patch_file: "patches/2.6.0-0004-fix-ios.patch" + patch_description: "Fix iOS detection logic in CMakeLists" + patch_type: "portability" + - patch_file: "patches/2.6.0-0006-disable-warning-flags.patch" + patch_description: "Disable warning flags which may cause compilation errors" + patch_type: "portability" + - patch_file: "patches/2.6.0-0007-use-cci-minimp3.patch" + patch_description: "use cci minimp3 recipe" + patch_type: "conan" "2.5.1": - - patch_file: "patches/0001-cmake-robust-find-deps.patch" - - patch_file: "patches/0002-allow-non-x86-64-macos.patch" - - patch_file: "patches/0003-allow-shared-MT.patch" - - patch_file: "patches/0004-fix-ios.patch" + - patch_file: "patches/2.5.1-0001-cmake-robust-find-deps.patch" + patch_description: "Robust discovery of dependencies" + patch_type: "conan" + - patch_file: "patches/2.5.1-0002-allow-non-x86-64-macos.patch" + patch_description: "Allow compilation for macOS arm" + patch_type: "portability" + - patch_file: "patches/2.5.1-0003-allow-shared-MT.patch" + patch_description: "Allow to build shared SFML with MT runtime" + patch_type: "portability" + - patch_file: "patches/2.5.1-0004-fix-ios.patch" + patch_description: "Fix iOS detection logic in CMakeLists" + patch_type: "portability" + - patch_file: "patches/2.5.1-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 fbbe0cc38f82f..54c2d3087bcf4 100644 --- a/recipes/sfml/all/conanfile.py +++ b/recipes/sfml/all/conanfile.py @@ -2,22 +2,23 @@ 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.files import apply_conandata_patches, export_conandata_patches, get, rmdir, save, copy 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.52.0" +required_conan_version = ">=1.53.0" class SfmlConan(ConanFile): name = "sfml" description = "Simple and Fast Multimedia Library." license = "Zlib" - topics = ("multimedia", "games", "graphics", "audio") - homepage = "https://www.sfml-dev.org" url = "https://github.com/conan-io/conan-center-index" - + homepage = "https://www.sfml-dev.org" + topics = ("multimedia", "games", "graphics", "audio") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -45,39 +46,40 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") def requirements(self): if self.options.window: + # FIXME: use cci's glad if self.settings.os in ["Windows", "Linux", "FreeBSD", "Macos"]: self.requires("opengl/system") if self.settings.os == "Linux": self.requires("libudev/system") self.requires("xorg/system") if self.options.graphics: - self.requires("freetype/2.12.1") - self.requires("stb/cci.20210910") + self.requires("freetype/2.13.2") + self.requires("stb/cci.20230920") if self.options.audio: - self.requires("flac/1.3.3") - self.requires("openal/1.22.2") + self.requires("flac/1.4.3") + self.requires("openal-soft/1.22.2") self.requires("vorbis/1.3.7") + if Version(self.version) >= "2.6.0": + self.requires("minimp3/cci.20211201") def validate(self): - if self.info.settings.os not in ["Windows", "Linux", "FreeBSD", "Android", "Macos", "iOS"]: - raise ConanInvalidConfiguration(f"{self.ref} not supported on {self.info.settings.os}") - if self.info.options.graphics and not self.info.options.window: + if self.settings.os not in ["Windows", "Linux", "FreeBSD", "Android", "Macos", "iOS"]: + 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): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) - rmdir(self, os.path.join(self.source_folder, "extlibs")) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + # sfml/2.6.0 uses minimp3 and glad in extlibs + if Version(self.version) < "2.6.0": + rmdir(self, os.path.join(self.source_folder, "extlibs")) def generate(self): tc = CMakeToolchain(self) @@ -90,10 +92,20 @@ def generate(self): tc.variables["SFML_INSTALL_PKGCONFIG_FILES"] = False tc.variables["SFML_GENERATE_PDB"] = False tc.variables["SFML_USE_SYSTEM_DEPS"] = True + tc.variables["WARNINGS_AS_ERRORS"] = False + if Version(self.version) >= "2.6.0": + tc.variables["CMAKE_CXX_STANDARD"] = 11 if is_msvc(self): tc.variables["SFML_USE_STATIC_STD_LIBS"] = is_msvc_static_runtime(self) tc.generate() deps = CMakeDeps(self) + if Version(self.version) >= "2.6.2": + if self.options.audio: + deps.set_property("vorbis", "cmake_file_name", "VORBIS") + if self.options.graphics: + deps.set_property("freetype", "cmake_file_name", "Freetype") + deps.set_property("freetype", "cmake_additional_variables_prefixes", ["FREETYPE"]) + deps.set_property("freetype", "cmake_target_name", "Freetype") deps.generate() def build(self): @@ -103,30 +115,12 @@ def build(self): cmake.build() def package(self): + if Version(self.version) >= "2.6.0": + 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")) - - # 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"]: f"SFML::{component}" for component, values in self._sfml_components.items()} - ) - - 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") + rmdir(self, os.path.join(self.package_folder, "share")) @property def _sfml_components(self): @@ -139,6 +133,9 @@ def winmm(): def ws2_32(): return ["ws2_32"] if self.settings.os == "Windows" else [] + def dl(): + return ["dl"] if self.settings.os in ["Linux", "FreeBSD"] and Version(self.version) >= "2.6.0" else [] + def libudev(): return ["libudev::libudev"] if self.settings.os == "Linux" else [] @@ -172,6 +169,9 @@ def carbon(): def iokit(): return ["IOKit"] if self.settings.os == "Macos" else [] + def coreservices(): + return ["CoreServices"] if self.settings.os == "Macos" else [] + def coregraphics(): return ["CoreGraphics"] if self.settings.os == "iOS" else [] @@ -193,6 +193,9 @@ def opengles_android(): def opengles_ios(): return ["OpenGLES"] if self.settings.os == "iOS" else [] + def objc(): + return ["-ObjC"] if not self.options.shared and self.settings.os == "Macos" else [] + suffix = "" if self.options.shared else "-s" suffix += "-d" if self.settings.build_type == "Debug" else "" @@ -221,10 +224,11 @@ def opengles_ios(): "target": "sfml-window", "libs": [f"sfml-window{suffix}"], "requires": ["system"] + opengl() + xorg() + libudev(), - "system_libs": gdi32() + winmm() + usbhid() + android() + opengles_android(), + "system_libs": dl() + gdi32() + winmm() + usbhid() + android() + opengles_android(), "frameworks": foundation() + appkit() + iokit() + carbon() + uikit() + coregraphics() + quartzcore() + - coremotion() + opengles_ios(), + coreservices() + coremotion() + opengles_ios(), + "exelinkflags": objc(), }, }) if self.options.graphics: @@ -245,11 +249,14 @@ def opengles_ios(): }, }) if self.options.audio: + audio_requires = ["system", "flac::flac", "openal-soft::openal-soft", "vorbis::vorbis"] + if Version(self.version) >= "2.6.0": + audio_requires.append("minimp3::minimp3") sfml_components.update({ "audio": { "target": "sfml-audio", "libs": [f"sfml-audio{suffix}"], - "requires": ["system", "flac::flac", "openal::openal", "vorbis::vorbis"], + "requires": audio_requires, "system_libs": android(), }, }) @@ -268,6 +275,7 @@ def _register_components(components): requires = values.get("requires", []) system_libs = values.get("system_libs", []) frameworks = values.get("frameworks", []) + exelinkflags = values.get("exelinkflags", []) # TODO: Properly model COMPONENTS names in CMakeDeps for find_package() call # (see https://github.com/conan-io/conan/issues/10258) # It should be: @@ -281,14 +289,6 @@ def _register_components(components): self.cpp_info.components[component].requires = requires self.cpp_info.components[component].system_libs = system_libs self.cpp_info.components[component].frameworks = frameworks - - # TODO: to remove in conan v2 once cmake_find_package* generators removed - self.cpp_info.components[component].build_modules["cmake_find_package"] = [self._module_file_rel_path] - self.cpp_info.components[component].build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] + self.cpp_info.components[component].exelinkflags = exelinkflags _register_components(self._sfml_components) - - # TODO: to remove in conan v2 once cmake_find_package* & pkg_config generators removed - self.cpp_info.names["cmake_find_package"] = "SFML" - self.cpp_info.names["cmake_find_package_multi"] = "SFML" - self.cpp_info.names["pkgconfig"] = "sfml-all" diff --git a/recipes/sfml/all/patches/0001-cmake-robust-find-deps.patch b/recipes/sfml/all/patches/2.5.1-0001-cmake-robust-find-deps.patch similarity index 100% rename from recipes/sfml/all/patches/0001-cmake-robust-find-deps.patch rename to recipes/sfml/all/patches/2.5.1-0001-cmake-robust-find-deps.patch diff --git a/recipes/sfml/all/patches/0002-allow-non-x86-64-macos.patch b/recipes/sfml/all/patches/2.5.1-0002-allow-non-x86-64-macos.patch similarity index 100% rename from recipes/sfml/all/patches/0002-allow-non-x86-64-macos.patch rename to recipes/sfml/all/patches/2.5.1-0002-allow-non-x86-64-macos.patch diff --git a/recipes/sfml/all/patches/0003-allow-shared-MT.patch b/recipes/sfml/all/patches/2.5.1-0003-allow-shared-MT.patch similarity index 100% rename from recipes/sfml/all/patches/0003-allow-shared-MT.patch rename to recipes/sfml/all/patches/2.5.1-0003-allow-shared-MT.patch diff --git a/recipes/sfml/all/patches/0004-fix-ios.patch b/recipes/sfml/all/patches/2.5.1-0004-fix-ios.patch similarity index 100% rename from recipes/sfml/all/patches/0004-fix-ios.patch rename to recipes/sfml/all/patches/2.5.1-0004-fix-ios.patch diff --git a/recipes/sfml/all/patches/2.5.1-0005-remove-auto-ptr.patch b/recipes/sfml/all/patches/2.5.1-0005-remove-auto-ptr.patch new file mode 100644 index 0000000000000..63069f1d9cab4 --- /dev/null +++ b/recipes/sfml/all/patches/2.5.1-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/patches/2.6.0-0001-cmake-robust-find-deps.patch b/recipes/sfml/all/patches/2.6.0-0001-cmake-robust-find-deps.patch new file mode 100644 index 0000000000000..1e4a21511eb3b --- /dev/null +++ b/recipes/sfml/all/patches/2.6.0-0001-cmake-robust-find-deps.patch @@ -0,0 +1,57 @@ +diff --git a/src/SFML/Audio/CMakeLists.txt b/src/SFML/Audio/CMakeLists.txt +index d27dc6d..27c3386 100644 +--- a/src/SFML/Audio/CMakeLists.txt ++++ b/src/SFML/Audio/CMakeLists.txt +@@ -69,19 +69,17 @@ endif() + + # find external libraries + sfml_find_package(OpenAL INCLUDE "OPENAL_INCLUDE_DIR" LINK "OPENAL_LIBRARY") +-sfml_find_package(VORBIS INCLUDE "VORBIS_INCLUDE_DIRS" LINK "VORBIS_LIBRARIES") ++sfml_find_package(Vorbis INCLUDE "VORBIS_INCLUDE_DIRS" LINK "VORBIS_LIBRARIES") + sfml_find_package(FLAC INCLUDE "FLAC_INCLUDE_DIR" LINK "FLAC_LIBRARY") + + # avoids warnings in vorbisfile.h +-target_compile_definitions(VORBIS INTERFACE "OV_EXCLUDE_STATIC_CALLBACKS") +-target_compile_definitions(FLAC INTERFACE "FLAC__NO_DLL") + + # define the sfml-audio target + sfml_add_library(sfml-audio + SOURCES ${SRC} ${CODECS_SRC}) + + # setup dependencies +-target_link_libraries(sfml-audio PRIVATE OpenAL) ++target_link_libraries(sfml-audio PRIVATE OpenAL::OpenAL) + + # minimp3 sources + target_include_directories(sfml-audio SYSTEM PRIVATE "${PROJECT_SOURCE_DIR}/extlibs/headers/minimp3") +@@ -92,4 +90,4 @@ endif() + + target_link_libraries(sfml-audio + PUBLIC sfml-system +- PRIVATE VORBIS FLAC) ++ PRIVATE Vorbis::vorbisenc Vorbis::vorbisfile FLAC::FLAC) +diff --git a/src/SFML/Graphics/CMakeLists.txt b/src/SFML/Graphics/CMakeLists.txt +index a939a98..bd6a89b 100644 +--- a/src/SFML/Graphics/CMakeLists.txt ++++ b/src/SFML/Graphics/CMakeLists.txt +@@ -93,7 +93,8 @@ sfml_add_library(sfml-graphics + target_link_libraries(sfml-graphics PUBLIC sfml-window) + + # stb_image sources +-target_include_directories(sfml-graphics SYSTEM PRIVATE "${PROJECT_SOURCE_DIR}/extlibs/headers/stb_image") ++find_package(stb REQUIRED CONFIG) ++target_link_libraries(sfml-graphics PRIVATE stb::stb) + + # glad sources + target_include_directories(sfml-graphics SYSTEM PRIVATE "${PROJECT_SOURCE_DIR}/extlibs/headers/glad/include") +@@ -123,8 +124,8 @@ if((SFML_COMPILER_MSVC AND SFML_MSVC_VERSION GREATER_EQUAL 14) OR (SFML_COMPILER + target_link_libraries(sfml-graphics PRIVATE legacy_stdio_definitions.lib) + endif() + +-sfml_find_package(Freetype INCLUDE "FREETYPE_INCLUDE_DIRS" LINK "FREETYPE_LIBRARY") +-target_link_libraries(sfml-graphics PRIVATE Freetype) ++find_package(freetype REQUIRED) ++target_link_libraries(sfml-graphics PRIVATE freetype) + + # add preprocessor symbols + target_compile_definitions(sfml-graphics PRIVATE "STBI_FAILURE_USERMSG") diff --git a/recipes/sfml/all/patches/2.6.0-0003-allow-shared-MT.patch b/recipes/sfml/all/patches/2.6.0-0003-allow-shared-MT.patch new file mode 100644 index 0000000000000..59b4bbd230de7 --- /dev/null +++ b/recipes/sfml/all/patches/2.6.0-0003-allow-shared-MT.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 9e3f89d..003857e 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -223,7 +223,7 @@ if(SFML_OS_WINDOWS) + sfml_set_option(SFML_USE_STATIC_STD_LIBS FALSE BOOL "TRUE to statically link to the standard libraries, FALSE to use them as DLLs") + + # the following combination of flags is not valid +- if(BUILD_SHARED_LIBS AND SFML_USE_STATIC_STD_LIBS) ++ if(0) + message(FATAL_ERROR "BUILD_SHARED_LIBS and SFML_USE_STATIC_STD_LIBS cannot be used together") + endif() + diff --git a/recipes/sfml/all/patches/2.6.0-0004-fix-ios.patch b/recipes/sfml/all/patches/2.6.0-0004-fix-ios.patch new file mode 100644 index 0000000000000..34b49a186218d --- /dev/null +++ b/recipes/sfml/all/patches/2.6.0-0004-fix-ios.patch @@ -0,0 +1,28 @@ +diff --git a/cmake/Config.cmake b/cmake/Config.cmake +index 2ce5ac4..3cd3a07 100644 +--- a/cmake/Config.cmake ++++ b/cmake/Config.cmake +@@ -39,13 +39,12 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "^NetBSD$") + set(SFML_OS_NETBSD 1) + # don't use the OpenGL ES implementation on NetBSD + set(OPENGL_ES 0) +-elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") +- if(IOS) ++elseif(${CMAKE_SYSTEM_NAME} STREQUAL "iOS") + set(SFML_OS_IOS 1) + + # use the OpenGL ES implementation on iOS + set(OPENGL_ES 1) +- else() ++elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") + set(SFML_OS_MACOSX 1) + + # don't use the OpenGL ES implementation on Mac OS X +@@ -58,7 +57,6 @@ elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") + message(FATAL_ERROR "Unsupported version of OS X: ${MACOSX_VERSION_RAW}") + return() + endif() +- endif() + elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Android") + set(SFML_OS_ANDROID 1) + diff --git a/recipes/sfml/all/patches/2.6.0-0006-disable-warning-flags.patch b/recipes/sfml/all/patches/2.6.0-0006-disable-warning-flags.patch new file mode 100644 index 0000000000000..362c57e93365a --- /dev/null +++ b/recipes/sfml/all/patches/2.6.0-0006-disable-warning-flags.patch @@ -0,0 +1,22 @@ +diff --git a/cmake/Macros.cmake b/cmake/Macros.cmake +index e0118eb..85a7714 100644 +--- a/cmake/Macros.cmake ++++ b/cmake/Macros.cmake +@@ -66,8 +66,6 @@ macro(sfml_add_library target) + add_library(${target} ${THIS_SOURCES}) + endif() + +- set_file_warnings(${THIS_SOURCES}) +- + # define the export symbol of the module + string(REPLACE "-" "_" NAME_UPPER "${target}") + string(TOUPPER "${NAME_UPPER}" NAME_UPPER) +@@ -265,8 +263,6 @@ macro(sfml_add_example target) + add_executable(${target} ${target_input}) + endif() + +- set_file_warnings(${target_input}) +- + # set the debug suffix + set_target_properties(${target} PROPERTIES DEBUG_POSTFIX -d) + diff --git a/recipes/sfml/all/patches/2.6.0-0007-use-cci-minimp3.patch b/recipes/sfml/all/patches/2.6.0-0007-use-cci-minimp3.patch new file mode 100644 index 0000000000000..d63dc230ed817 --- /dev/null +++ b/recipes/sfml/all/patches/2.6.0-0007-use-cci-minimp3.patch @@ -0,0 +1,14 @@ +diff --git a/src/SFML/Audio/CMakeLists.txt b/src/SFML/Audio/CMakeLists.txt +index 27c3386..6c455ca 100644 +--- a/src/SFML/Audio/CMakeLists.txt ++++ b/src/SFML/Audio/CMakeLists.txt +@@ -82,7 +82,8 @@ sfml_add_library(sfml-audio + target_link_libraries(sfml-audio PRIVATE OpenAL::OpenAL) + + # minimp3 sources +-target_include_directories(sfml-audio SYSTEM PRIVATE "${PROJECT_SOURCE_DIR}/extlibs/headers/minimp3") ++find_package(minimp3 REQUIRED CONFIG) ++target_include_directories(sfml-audio SYSTEM PRIVATE ${minimp3_INCLUDE_DIRS}) + + if(SFML_OS_ANDROID) + target_link_libraries(sfml-audio PRIVATE android OpenSLES) diff --git a/recipes/sfml/all/patches/2.6.1-0006-disable-warning-flags.patch b/recipes/sfml/all/patches/2.6.1-0006-disable-warning-flags.patch new file mode 100644 index 0000000000000..5d44e698e2bfb --- /dev/null +++ b/recipes/sfml/all/patches/2.6.1-0006-disable-warning-flags.patch @@ -0,0 +1,22 @@ +diff --git a/cmake/Macros.cmake b/cmake/Macros.cmake +index 65f6977..645fa20 100644 +--- a/cmake/Macros.cmake ++++ b/cmake/Macros.cmake +@@ -61,7 +61,7 @@ macro(sfml_add_library target) + add_library(${target} ${THIS_SOURCES}) + endif() + +- set_file_warnings(${THIS_SOURCES}) ++# set_file_warnings(${THIS_SOURCES}) + + # define the export symbol of the module + string(REPLACE "-" "_" NAME_UPPER "${target}") +@@ -260,7 +260,7 @@ macro(sfml_add_example target) + add_executable(${target} ${target_input}) + endif() + +- set_file_warnings(${target_input}) ++# set_file_warnings(${target_input}) + + # set the debug suffix + set_target_properties(${target} PROPERTIES DEBUG_POSTFIX -d) diff --git a/recipes/sfml/all/patches/2.6.2-0001-cmake-robust-find-deps.patch b/recipes/sfml/all/patches/2.6.2-0001-cmake-robust-find-deps.patch new file mode 100644 index 0000000000000..5cd33b253b9f0 --- /dev/null +++ b/recipes/sfml/all/patches/2.6.2-0001-cmake-robust-find-deps.patch @@ -0,0 +1,54 @@ +diff --git a/src/SFML/Audio/CMakeLists.txt b/src/SFML/Audio/CMakeLists.txt +index 8158365..a2e029a 100644 +--- a/src/SFML/Audio/CMakeLists.txt ++++ b/src/SFML/Audio/CMakeLists.txt +@@ -73,8 +73,8 @@ sfml_find_package(VORBIS INCLUDE "VORBIS_INCLUDE_DIRS" LINK "VORBIS_LIBRARIES") + sfml_find_package(FLAC INCLUDE "FLAC_INCLUDE_DIR" LINK "FLAC_LIBRARY") + + # avoids warnings in vorbisfile.h +-target_compile_definitions(VORBIS INTERFACE "OV_EXCLUDE_STATIC_CALLBACKS") +-target_compile_definitions(FLAC INTERFACE "FLAC__NO_DLL") ++# target_compile_definitions(VORBIS INTERFACE "OV_EXCLUDE_STATIC_CALLBACKS") ++# target_compile_definitions(FLAC INTERFACE "FLAC__NO_DLL") + + # define the sfml-audio target + sfml_add_library(sfml-audio +@@ -84,7 +84,8 @@ sfml_add_library(sfml-audio + target_link_libraries(sfml-audio PRIVATE OpenAL::OpenAL) + + # minimp3 sources +-target_include_directories(sfml-audio SYSTEM PRIVATE "${PROJECT_SOURCE_DIR}/extlibs/headers/minimp3") ++find_package(minimp3 REQUIRED CONFIG) ++target_include_directories(sfml-audio SYSTEM PRIVATE ${minimp3_INCLUDE_DIRS}) + + if(SFML_OS_ANDROID) + target_link_libraries(sfml-audio PRIVATE android OpenSLES) +@@ -92,4 +93,4 @@ endif() + + target_link_libraries(sfml-audio + PUBLIC sfml-system +- PRIVATE VORBIS FLAC) ++ PRIVATE Vorbis::vorbisenc Vorbis::vorbisfile FLAC::FLAC minimp3::minimp3) +diff --git a/src/SFML/Graphics/CMakeLists.txt b/src/SFML/Graphics/CMakeLists.txt +index a939a98..6f16273 100644 +--- a/src/SFML/Graphics/CMakeLists.txt ++++ b/src/SFML/Graphics/CMakeLists.txt +@@ -93,7 +93,8 @@ sfml_add_library(sfml-graphics + target_link_libraries(sfml-graphics PUBLIC sfml-window) + + # stb_image sources +-target_include_directories(sfml-graphics SYSTEM PRIVATE "${PROJECT_SOURCE_DIR}/extlibs/headers/stb_image") ++find_package(stb REQUIRED CONFIG) ++target_link_libraries(sfml-graphics PRIVATE stb::stb) + + # glad sources + target_include_directories(sfml-graphics SYSTEM PRIVATE "${PROJECT_SOURCE_DIR}/extlibs/headers/glad/include") +@@ -123,7 +124,7 @@ if((SFML_COMPILER_MSVC AND SFML_MSVC_VERSION GREATER_EQUAL 14) OR (SFML_COMPILER + target_link_libraries(sfml-graphics PRIVATE legacy_stdio_definitions.lib) + endif() + +-sfml_find_package(Freetype INCLUDE "FREETYPE_INCLUDE_DIRS" LINK "FREETYPE_LIBRARY") ++find_package(Freetype REQUIRED) + target_link_libraries(sfml-graphics PRIVATE Freetype) + + # add preprocessor symbols diff --git a/recipes/sfml/all/patches/2.6.2-0003-allow-shared-MT.patch b/recipes/sfml/all/patches/2.6.2-0003-allow-shared-MT.patch new file mode 100644 index 0000000000000..57308c95f28c9 --- /dev/null +++ b/recipes/sfml/all/patches/2.6.2-0003-allow-shared-MT.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index a302f23..afe1830 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -208,7 +208,7 @@ if(SFML_OS_WINDOWS) + sfml_set_option(SFML_USE_STATIC_STD_LIBS FALSE BOOL "TRUE to statically link to the standard libraries, FALSE to use them as DLLs") + + # the following combination of flags is not valid +- if(BUILD_SHARED_LIBS AND SFML_USE_STATIC_STD_LIBS) ++ if(0) + message(FATAL_ERROR "BUILD_SHARED_LIBS and SFML_USE_STATIC_STD_LIBS cannot be used together") + endif() + diff --git a/recipes/sfml/all/test_v1_package/CMakeLists.txt b/recipes/sfml/all/test_v1_package/CMakeLists.txt deleted file mode 100644 index 5ac31c943d9c4..0000000000000 --- a/recipes/sfml/all/test_v1_package/CMakeLists.txt +++ /dev/null @@ -1,33 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) - -set(SFML_COMPONENTS system) -set(SFML_TARGETS sfml-system) -if(SFML_WITH_WINDOW) - target_compile_definitions(${PROJECT_NAME} PRIVATE SFML_WITH_WINDOW) - list(APPEND SFML_COMPONENTS window) - list(APPEND SFML_TARGETS sfml-window) -endif() -if(SFML_WITH_GRAPHICS) - target_compile_definitions(${PROJECT_NAME} PRIVATE SFML_WITH_GRAPHICS) - list(APPEND SFML_COMPONENTS graphics) - list(APPEND SFML_TARGETS sfml-graphics) -endif() -if(SFML_WITH_NETWORK) - target_compile_definitions(${PROJECT_NAME} PRIVATE SFML_WITH_NETWORK) - list(APPEND SFML_COMPONENTS network) - list(APPEND SFML_TARGETS sfml-network) -endif() -if(SFML_WITH_AUDIO) - target_compile_definitions(${PROJECT_NAME} PRIVATE SFML_WITH_AUDIO) - list(APPEND SFML_COMPONENTS audio) - list(APPEND SFML_TARGETS sfml-audio) -endif() - -find_package(SFML REQUIRED ${SFML_COMPONENTS} CONFIG) -target_link_libraries(${PROJECT_NAME} PRIVATE ${SFML_TARGETS}) diff --git a/recipes/sfml/all/test_v1_package/conanfile.py b/recipes/sfml/all/test_v1_package/conanfile.py deleted file mode 100644 index d431379ec6c21..0000000000000 --- a/recipes/sfml/all/test_v1_package/conanfile.py +++ /dev/null @@ -1,21 +0,0 @@ -from conans import ConanFile, CMake, tools -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/sfml/config.yml b/recipes/sfml/config.yml index eab83a303df52..20ad3255593e1 100644 --- a/recipes/sfml/config.yml +++ b/recipes/sfml/config.yml @@ -1,3 +1,9 @@ versions: + "2.6.2": + folder: all + "2.6.1": + folder: all + "2.6.0": + folder: all "2.5.1": folder: all diff --git a/recipes/shaderc/all/CMakeLists.txt b/recipes/shaderc/all/CMakeLists.txt deleted file mode 100644 index 4d393c7a86c09..0000000000000 --- a/recipes/shaderc/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/shaderc/all/conandata.yml b/recipes/shaderc/all/conandata.yml index 36e3a9f3b6b76..25858ddef7954 100644 --- a/recipes/shaderc/all/conandata.yml +++ b/recipes/shaderc/all/conandata.yml @@ -1,16 +1,47 @@ sources: + "2024.1": + url: "https://github.com/google/shaderc/archive/refs/tags/v2024.1.tar.gz" + sha256: "eb3b5f0c16313d34f208d90c2fa1e588a23283eed63b101edd5422be6165d528" + "2023.6": + url: "https://github.com/google/shaderc/archive/refs/tags/v2023.6.tar.gz" + sha256: "e40fd4a87a56f6610e223122179f086d5c4f11a7e0e2aa461f0325c3a0acc6ae" "2021.1": url: "https://github.com/google/shaderc/archive/v2021.1.tar.gz" sha256: "047113bc4628da164a3cb845efc20d442728873f6054a68ab56d04a053f2c32b" - "2019.0": - url: "https://github.com/google/shaderc/archive/v2019.0.tar.gz" - sha256: "1018cd02be52295272fdbffa056ee24b881be277c83d039ad554d91230f4e11b" patches: + "2024.1": + - patch_file: "patches/2023.6/use-conan-dependencies.patch" + patch_description: "Replace third_party with Conan dependencies" + patch_type: "conan" + - patch_file: "patches/2021.1/adapt-update_build_version.py.patch" + patch_description: "Adapt update_build_version.py for Conan" + patch_type: "conan" + - patch_file: "patches/2021.1/install-shaderc_util.patch" + patch_description: "install() shaderc_util" + patch_type: "conan" + "2023.6": + - patch_file: "patches/2023.6/use-conan-dependencies.patch" + patch_description: "Replace third_party with Conan dependencies" + patch_type: "conan" + - patch_file: "patches/2021.1/adapt-update_build_version.py.patch" + patch_description: "Adapt update_build_version.py for Conan" + patch_type: "conan" + - patch_file: "patches/2021.1/install-shaderc_util.patch" + patch_description: "install() shaderc_util" + patch_type: "conan" "2021.1": - - patch_file: "patches/2021.1/fix-cmake.patch" - base_path: "source_subfolder" - "2019.0": - - patch_file: "patches/2019.0/fix-cmake.patch" - base_path: "source_subfolder" - - patch_file: "patches/2019.0/fix-spvc.patch" - base_path: "source_subfolder" + - patch_file: "patches/2021.1/use-conan-dependencies.patch" + patch_description: "Replace third_party with Conan dependencies" + patch_type: "conan" + - patch_file: "patches/2021.1/adapt-update_build_version.py.patch" + patch_description: "Adapt update_build_version.py for Conan" + patch_type: "conan" + - patch_file: "patches/2021.1/install-shaderc_util.patch" + patch_description: "install() shaderc_util" + patch_type: "conan" +siprv_mapping: + # TODO: bump me once newer versions are available on CCI + "2024.1": "1.3.261.1" + # "2023.6": "1.3.261.1" + "2023.6": "1.3.239.0" + "2021.1": "1.3.224.0" diff --git a/recipes/shaderc/all/conanfile.py b/recipes/shaderc/all/conanfile.py index 431f1292c6d2f..309b53f6cb235 100644 --- a/recipes/shaderc/all/conanfile.py +++ b/recipes/shaderc/all/conanfile.py @@ -1,131 +1,133 @@ -from conans import ConanFile, CMake, tools import os -required_conan_version = ">=1.36.0" +from conan import ConanFile +from conan.tools.build import check_min_cppstd, stdcpp_library +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 +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +from conan.tools.apple import fix_apple_shared_install_name + +required_conan_version = ">=1.53.0" class ShadercConan(ConanFile): name = "shaderc" description = "A collection of tools, libraries and tests for shader compilation." license = "Apache-2.0" - topics = ("glsl", "hlsl", "msl", "spirv", "spir-v", "glslc", "spvc") - homepage = "https://github.com/google/shaderc" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/google/shaderc" + topics = ("glsl", "hlsl", "msl", "spirv", "spir-v", "glslc") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], - "spvc": [True, False], } default_options = { "shared": False, "fPIC": True, - "spvc": False, } - 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": del self.options.fPIC - if tools.Version(self.version) >= "2020.4": - del self.options.spvc def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") - @property - def _get_compatible_spirv_tools_version(self): - return { - "2021.1": "2021.2", - "2019.0": "2020.5" - }.get(str(self.version), False) + def layout(self): + cmake_layout(self, src_folder="src") @property - def _get_compatible_glslang_version(self): - return { - "2021.1": "11.5.0", - "2019.0": "8.13.3559" - }.get(str(self.version), False) + def _spirv_version(self): + return self.conan_data.get("siprv_mapping")[self.version] def requirements(self): - self.requires("glslang/{}".format(self._get_compatible_glslang_version)) - self.requires("spirv-tools/{}".format(self._get_compatible_spirv_tools_version)) - if self.options.get_safe("spvc", False): - self.requires("spirv-cross/20210115") + # transitive_headers=True is not required for any of the dependencies + self.requires(f"glslang/{self._spirv_version}") + self.requires(f"spirv-tools/{self._spirv_version}") + self.requires(f"spirv-headers/{self._spirv_version}") def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) + check_min_cppstd(self, 11) + + def build_requirements(self): + self.tool_requires("cmake/[>=3.17.2 <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], strip_root=True) + + def generate(self): + venv = VirtualBuildEnv(self) + venv.generate() + + tc = CMakeToolchain(self) + tc.cache_variables["SHADERC_SKIP_INSTALL"] = False + tc.cache_variables["SHADERC_SKIP_EXAMPLES"] = True + tc.cache_variables["SHADERC_SKIP_TESTS"] = True + tc.cache_variables["ENABLE_CODE_COVERAGE"] = False + tc.cache_variables["SHADERC_ENABLE_WERROR_COMPILE"] = False + if is_msvc(self): + tc.cache_variables["SHADERC_ENABLE_SHARED_CRT"] = not is_msvc_static_runtime(self) + tc.generate() + + self.dependencies["glslang"].cpp_info.components["glslang-core"].includedirs.append( + os.path.join(self.dependencies["glslang"].package_folder, "include", "glslang") + ) + + deps = CMakeDeps(self) + deps.set_property("glslang::glslang-core", "cmake_target_name", "glslang") + deps.set_property("glslang::osdependent", "cmake_target_name", "OSDependent") + deps.set_property("glslang::oglcompiler", "cmake_target_name", "OGLCompiler") + deps.set_property("glslang::hlsl", "cmake_target_name", "HLSL") + deps.set_property("glslang::spirv", "cmake_target_name", "SPIRV") + 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["CMAKE_POSITION_INDEPENDENT_CODE"] = self.options.get_safe("fPIC", True) - self._cmake.definitions["SHADERC_ENABLE_SPVC"] = self.options.get_safe("spvc", False) - self._cmake.definitions["SHADERC_SKIP_INSTALL"] = False - self._cmake.definitions["SHADERC_SKIP_TESTS"] = True - self._cmake.definitions["SHADERC_SPVC_ENABLE_DIRECT_LOGGING"] = False - self._cmake.definitions["SHADERC_SPVC_DISABLE_CONTEXT_LOGGING"] = False - self._cmake.definitions["SHADERC_ENABLE_WERROR_COMPILE"] = False - if self.settings.compiler == "Visual Studio": - self._cmake.definitions["SHADERC_ENABLE_SHARED_CRT"] = str(self.settings.compiler.runtime).startswith("MD") - self._cmake.definitions["ENABLE_CODE_COVERAGE"] = False - if tools.is_apple_os(self.settings.os): - self._cmake.definitions["CMAKE_MACOSX_BUNDLE"] = False - 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", 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")) + fix_apple_shared_install_name(self) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): - self.cpp_info.set_property("pkg_config_name", "shaderc" if self.options.shared else "shaderc_static") - self.cpp_info.libs = self._get_ordered_libs() - if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.system_libs.append("pthread") - if not self.options.shared and tools.stdcpp_library(self): - self.cpp_info.system_libs.append(tools.stdcpp_library(self)) if self.options.shared: + self.cpp_info.set_property("pkg_config_name", "shaderc") + self.cpp_info.libs = ["shaderc_shared"] self.cpp_info.defines.append("SHADERC_SHAREDLIB") + else: + self.cpp_info.set_property("pkg_config_name", "shaderc_static") + self.cpp_info.libs = ["shaderc", "shaderc_util"] + if stdcpp_library(self): + self.cpp_info.system_libs.append(stdcpp_library(self)) + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("pthread") + + self.cpp_info.requires = [ + "glslang::glslang-core", + "glslang::osdependent", + "glslang::oglcompiler", + "glslang::hlsl", + "glslang::spirv", + "spirv-tools::spirv-tools-core", + "spirv-tools::spirv-tools-opt", + "spirv-headers::spirv-headers" + ] + + # 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.env_info.PATH.append(bin_path) - - def _get_ordered_libs(self): - libs = ["shaderc_shared" if self.options.shared else "shaderc"] - if not self.options.shared: - libs.append("shaderc_util") - if self.options.get_safe("spvc", False): - libs.append("shaderc_spvc_shared" if self.options.shared else "shaderc_spvc") - return libs diff --git a/recipes/shaderc/all/patches/2019.0/fix-cmake.patch b/recipes/shaderc/all/patches/2019.0/fix-cmake.patch deleted file mode 100644 index 1fee3bf35ecf3..0000000000000 --- a/recipes/shaderc/all/patches/2019.0/fix-cmake.patch +++ /dev/null @@ -1,402 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -70,7 +70,6 @@ endif(MSVC) - - # Configure subdirectories. - # We depend on these for later projects, so they should come first. --add_subdirectory(third_party) - - if(SHADERC_ENABLE_SPVC) - add_subdirectory(libshaderc_spvc) -@@ -79,12 +78,11 @@ endif() - add_subdirectory(libshaderc_util) - add_subdirectory(libshaderc) - add_subdirectory(glslc) --add_subdirectory(examples) - - add_custom_target(build-version - ${PYTHON_EXECUTABLE} - ${CMAKE_CURRENT_SOURCE_DIR}/utils/update_build_version.py -- ${shaderc_SOURCE_DIR} ${spirv-tools_SOURCE_DIR} ${glslang_SOURCE_DIR} -+ ${shaderc_SOURCE_DIR} - COMMENT "Update build-version.inc in the Shaderc build directory (if necessary).") - - function(define_pkg_config_file NAME LIBS) ---- a/cmake/utils.cmake -+++ b/cmake/utils.cmake -@@ -11,7 +11,6 @@ function(shaderc_default_c_compile_options TARGET) - if (NOT "${MSVC}") - target_compile_options(${TARGET} PRIVATE -Wall -Werror -fvisibility=hidden) - if (NOT "${MINGW}") -- target_compile_options(${TARGET} PRIVATE -fPIC) - endif() - if (ENABLE_CODE_COVERAGE) - # The --coverage option is a synonym for -fprofile-arcs -ftest-coverage -@@ -24,10 +23,6 @@ function(shaderc_default_c_compile_options TARGET) - endif() - if (NOT SHADERC_ENABLE_SHARED_CRT) - if (WIN32) -- # For MinGW cross compile, statically link to the libgcc runtime. -- # But it still depends on MSVCRT.dll. -- set_target_properties(${TARGET} PROPERTIES -- LINK_FLAGS "-static -static-libgcc") - endif(WIN32) - endif(NOT SHADERC_ENABLE_SHARED_CRT) - else() -@@ -40,13 +35,8 @@ endfunction(shaderc_default_c_compile_options) - function(shaderc_default_compile_options TARGET) - shaderc_default_c_compile_options(${TARGET}) - if (NOT "${MSVC}") -- target_compile_options(${TARGET} PRIVATE -std=c++11) - if (NOT SHADERC_ENABLE_SHARED_CRT) - if (WIN32) -- # For MinGW cross compile, statically link to the C++ runtime. -- # But it still depends on MSVCRT.dll. -- set_target_properties(${TARGET} PROPERTIES -- LINK_FLAGS "-static -static-libgcc -static-libstdc++") - endif(WIN32) - endif(NOT SHADERC_ENABLE_SHARED_CRT) - endif() ---- a/glslc/CMakeLists.txt -+++ b/glslc/CMakeLists.txt -@@ -16,31 +16,19 @@ add_library(glslc STATIC - ) - - shaderc_default_compile_options(glslc) --target_include_directories(glslc PUBLIC ${glslang_SOURCE_DIR}) --target_link_libraries(glslc PRIVATE glslang OSDependent OGLCompiler -- HLSL glslang SPIRV ${CMAKE_THREAD_LIBS_INIT}) --target_link_libraries(glslc PRIVATE shaderc_util shaderc) -+target_link_libraries(glslc PRIVATE ${CMAKE_THREAD_LIBS_INIT}) -+target_link_libraries(glslc PUBLIC shaderc_util shaderc) - - add_executable(glslc_exe src/main.cc) - shaderc_default_compile_options(glslc_exe) --target_include_directories(glslc_exe PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/.. ${spirv-tools_SOURCE_DIR}/include) -+target_include_directories(glslc_exe PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/..) - set_target_properties(glslc_exe PROPERTIES OUTPUT_NAME glslc) --target_link_libraries(glslc_exe PRIVATE glslc shaderc_util shaderc) -+target_link_libraries(glslc_exe PRIVATE glslc shaderc_util shaderc CONAN_PKG::spirv-tools) - add_dependencies(glslc_exe build-version) - --shaderc_add_tests( -- TEST_PREFIX glslc -- LINK_LIBS glslc shaderc_util shaderc -- TEST_NAMES -- file -- resource_parse -- stage) -- - shaderc_add_asciidoc(glslc_doc_README README) - - if(SHADERC_ENABLE_INSTALL) - install(TARGETS glslc_exe - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) - endif(SHADERC_ENABLE_INSTALL) -- --add_subdirectory(test) ---- a/libshaderc/CMakeLists.txt -+++ b/libshaderc/CMakeLists.txt -@@ -10,18 +10,16 @@ set(SHADERC_SOURCES - src/shaderc_private.h - ) - --add_library(shaderc STATIC ${SHADERC_SOURCES}) -+add_library(shaderc ${SHADERC_SOURCES}) - shaderc_default_compile_options(shaderc) --target_include_directories(shaderc PUBLIC include PRIVATE ${glslang_SOURCE_DIR}) -- --add_library(shaderc_shared SHARED ${SHADERC_SOURCES}) --shaderc_default_compile_options(shaderc_shared) --target_include_directories(shaderc_shared PUBLIC include PRIVATE ${glslang_SOURCE_DIR}) --target_compile_definitions(shaderc_shared -- PRIVATE SHADERC_IMPLEMENTATION -- PUBLIC SHADERC_SHAREDLIB --) --set_target_properties(shaderc_shared PROPERTIES SOVERSION 1) -+target_include_directories(shaderc PUBLIC include) -+if(BUILD_SHARED_LIBS) -+ target_compile_definitions(shaderc -+ PRIVATE SHADERC_IMPLEMENTATION -+ PUBLIC SHADERC_SHAREDLIB -+ ) -+ set_target_properties(shaderc PROPERTIES OUTPUT_NAME "shaderc_shared" SOVERSION 1) -+endif() - - if(SHADERC_ENABLE_INSTALL) - install( -@@ -34,70 +32,19 @@ if(SHADERC_ENABLE_INSTALL) - DESTINATION - ${CMAKE_INSTALL_INCLUDEDIR}/shaderc) - -- install(TARGETS shaderc shaderc_shared -+ install(TARGETS shaderc - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) - endif(SHADERC_ENABLE_INSTALL) - --find_package(Threads) - set(SHADERC_LIBS -- glslang OSDependent OGLCompiler glslang ${CMAKE_THREAD_LIBS_INIT} - shaderc_util -- SPIRV # from glslang -- SPIRV-Tools -+ "CONAN_PKG::glslang" -+ "CONAN_PKG::spirv-tools" - ) - - target_link_libraries(shaderc PRIVATE ${SHADERC_LIBS}) --target_link_libraries(shaderc_shared PRIVATE ${SHADERC_LIBS}) -- --shaderc_add_tests( -- TEST_PREFIX shaderc -- LINK_LIBS shaderc -- INCLUDE_DIRS include ${shaderc_SOURCE_DIR}/libshaderc_util/include ${glslang_SOURCE_DIR} -- ${spirv-tools_SOURCE_DIR}/include -- TEST_NAMES -- shaderc -- shaderc_cpp -- shaderc_private) -- --shaderc_add_tests( -- TEST_PREFIX shaderc_shared -- LINK_LIBS shaderc_shared SPIRV-Tools -- INCLUDE_DIRS include ${shaderc_SOURCE_DIR}/libshaderc_util/include ${glslang_SOURCE_DIR} -- ${spirv-tools_SOURCE_DIR}/include -- TEST_NAMES -- shaderc -- shaderc_cpp -- shaderc_private) -- --shaderc_combine_static_lib(shaderc_combined shaderc) -- --if(SHADERC_ENABLE_INSTALL) -- # Since shaderc_combined is defined as an imported library, we cannot use the -- # install() directive to install it. Install it like a normal file. -- get_target_property(generated_location shaderc_combined LOCATION) -- string(REGEX MATCH "Visual Studio .*" vs_generator "${CMAKE_GENERATOR}") -- if (NOT "${vs_generator}" STREQUAL "") -- # With Visual Studio generators, the LOCATION property is not properly -- # expanded according to the current build configuration. We need to work -- # around this problem by manually substitution. -- string(REPLACE "$(Configuration)" "\${CMAKE_INSTALL_CONFIG_NAME}" -- install_location "${generated_location}") -- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${install_location} DESTINATION ${CMAKE_INSTALL_LIBDIR}) -- else() -- install(FILES ${generated_location} DESTINATION ${CMAKE_INSTALL_LIBDIR}) -- endif() --endif(SHADERC_ENABLE_INSTALL) -- --shaderc_add_tests( -- TEST_PREFIX shaderc_combined -- LINK_LIBS shaderc_combined ${CMAKE_THREAD_LIBS_INIT} -- INCLUDE_DIRS include ${shaderc_SOURCE_DIR}/libshaderc_util/include ${glslang_SOURCE_DIR} -- ${spirv-tools_SOURCE_DIR}/include -- TEST_NAMES -- shaderc -- shaderc_cpp) - - if(${SHADERC_ENABLE_TESTS}) - add_executable(shaderc_c_smoke_test ./src/shaderc_c_smoke_test.c) ---- a/libshaderc_spvc/CMakeLists.txt -+++ b/libshaderc_spvc/CMakeLists.txt -@@ -9,26 +9,22 @@ set(SPVC_SOURCES - src/spvc.cc - ) - --add_library(shaderc_spvc STATIC ${SPVC_SOURCES}) -+add_library(shaderc_spvc ${SPVC_SOURCES}) - shaderc_default_compile_options(shaderc_spvc) --target_include_directories(shaderc_spvc PUBLIC include PRIVATE ${shaderc_SOURCE_DIR}/libshaderc/include ${shaderc_SOURCE_DIR}/libshaderc_util/include ${spirv-tools_SOURCE_DIR}/include ${SPIRV-Cross_SOURCE_DIR}/..) -- --add_library(shaderc_spvc_shared SHARED ${SPVC_SOURCES}) --shaderc_default_compile_options(shaderc_spvc_shared) --target_include_directories(shaderc_spvc_shared PUBLIC include PRIVATE ${shaderc_SOURCE_DIR}/libshaderc/include ${shaderc_SOURCE_DIR}/libshaderc_util/include ${spirv-tools_SOURCE_DIR}/include ${SPIRV-Cross_SOURCE_DIR}/..) -- --target_compile_definitions(shaderc_spvc_shared -- PRIVATE SHADERC_IMPLEMENTATION -- PUBLIC SHADERC_SHAREDLIB --) -+target_include_directories(shaderc_spvc -+ PUBLIC include ${shaderc_SOURCE_DIR}/libshaderc/include PRIVATE ${shaderc_SOURCE_DIR}/libshaderc_util/include) -+if(BUILD_SHARED_LIBS) -+ target_compile_definitions(shaderc_spvc -+ PRIVATE SHADERC_IMPLEMENTATION -+ PUBLIC SHADERC_SHAREDLIB -+ ) -+ set_target_properties(shaderc_spvc PROPERTIES OUTPUT_NAME "shaderc_spvc_shared" SOVERSION 1) -+endif() - - if (DISABLE_EXCEPTIONS) - target_compile_definitions(shaderc_spvc PRIVATE SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS) -- target_compile_definitions(shaderc_spvc_shared PRIVATE SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS) - endif (DISABLE_EXCEPTIONS) - --set_target_properties(shaderc_spvc_shared PROPERTIES SOVERSION 1) -- - if(SHADERC_ENABLE_INSTALL) - install( - FILES -@@ -37,71 +33,18 @@ if(SHADERC_ENABLE_INSTALL) - DESTINATION - ${CMAKE_INSTALL_INCLUDEDIR}/shaderc) - -- install(TARGETS shaderc_spvc shaderc_spvc_shared -+ install(TARGETS shaderc_spvc - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) - endif(SHADERC_ENABLE_INSTALL) - --find_package(Threads) - set(SPVC_LIBS -- ${CMAKE_THREAD_LIBS_INIT} -- SPIRV-Tools -- SPIRV-Tools-opt -- spirv-cross-glsl -- spirv-cross-hlsl -- spirv-cross-msl -+ "CONAN_PKG::spirv-cross" -+ "CONAN_PKG::spirv-tools" - ) - - target_link_libraries(shaderc_spvc PRIVATE ${SPVC_LIBS}) --target_link_libraries(shaderc_spvc_shared PRIVATE ${SPVC_LIBS}) -- --shaderc_add_tests( -- TEST_PREFIX shaderc -- LINK_LIBS shaderc_spvc -- INCLUDE_DIRS include ${shaderc_SOURCE_DIR}/libshaderc/include ${SPIRV-Cross_SOURCE_DIR}/.. -- TEST_NAMES -- spvc -- spvc_cpp -- spvc_webgpu -- spvc_webgpu_cpp) -- --shaderc_add_tests( -- TEST_PREFIX shaderc_shared -- LINK_LIBS shaderc_spvc_shared SPIRV-Tools SPIRV-Tools-opt -- INCLUDE_DIRS include ${shaderc_SOURCE_DIR}/libshaderc/include ${SPIRV-Cross_SOURCE_DIR}/.. -- TEST_NAMES -- spvc -- spvc_cpp -- spvc_webgpu -- spvc_webgpu_cpp) -- --shaderc_combine_static_lib(shaderc_spvc_combined shaderc_spvc) -- --if(SHADERC_ENABLE_INSTALL) -- # Since shaderc_combined is defined as an imported library, we cannot use the -- # install() directive to install it. Install it like a normal file. -- get_target_property(generated_location shaderc_spvc_combined LOCATION) -- string(REGEX MATCH "Visual Studio .*" vs_generator "${CMAKE_GENERATOR}") -- if (NOT "${vs_generator}" STREQUAL "") -- # With Visual Studio generators, the LOCATION property is not properly -- # expanded according to the current build configuration. We need to work -- # around this problem by manually substitution. -- string(REPLACE "$(Configuration)" "\${CMAKE_INSTALL_CONFIG_NAME}" -- install_location "${generated_location}") -- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${install_location} DESTINATION ${CMAKE_INSTALL_LIBDIR}) -- else() -- install(FILES ${generated_location} DESTINATION ${CMAKE_INSTALL_LIBDIR}) -- endif() --endif(SHADERC_ENABLE_INSTALL) -- --shaderc_add_tests( -- TEST_PREFIX shaderc_spvc_combined -- LINK_LIBS shaderc_spvc_combined ${CMAKE_THREAD_LIBS_INIT} shaderc_util -- INCLUDE_DIRS include ${shaderc_SOURCE_DIR}/libshaderc/include ${spirv-tools_SOURCE_DIR}/include -- TEST_NAMES -- spvc -- spvc_cpp) - - if(${SHADERC_ENABLE_TESTS}) - add_executable(spvc_c_smoke_test ./src/spvc_smoke_test_util.c ./src/spvc_c_smoke_test.c) ---- a/libshaderc_util/CMakeLists.txt -+++ b/libshaderc_util/CMakeLists.txt -@@ -24,25 +24,20 @@ add_library(shaderc_util STATIC - - shaderc_default_compile_options(shaderc_util) - target_include_directories(shaderc_util -- PUBLIC include PRIVATE ${glslang_SOURCE_DIR}) -+ PUBLIC include) - - find_package(Threads) --target_link_libraries(shaderc_util PRIVATE -- glslang OSDependent OGLCompiler HLSL glslang SPIRV -- SPIRV-Tools-opt ${CMAKE_THREAD_LIBS_INIT}) -- --shaderc_add_tests( -- TEST_PREFIX shaderc_util -- LINK_LIBS shaderc_util -- TEST_NAMES -- counting_includer -- string_piece -- format -- file_finder -- io -- message -- mutex -- version_profile) -+target_link_libraries(shaderc_util PUBLIC -+ CONAN_PKG::glslang -+ CONAN_PKG::spirv-tools -+ ${CMAKE_THREAD_LIBS_INIT}) -+ -+if(SHADERC_ENABLE_INSTALL AND NOT BUILD_SHARED_LIBS) -+ install(TARGETS shaderc_util -+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} -+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} -+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) -+endif(SHADERC_ENABLE_INSTALL) - - if(${SHADERC_ENABLE_TESTS}) - target_include_directories(shaderc_util_counting_includer_test -@@ -51,15 +46,6 @@ if(${SHADERC_ENABLE_TESTS}) - PRIVATE ${glslang_SOURCE_DIR}) - endif() - --shaderc_add_tests( -- TEST_PREFIX shaderc_util -- LINK_LIBS shaderc_util -- INCLUDE_DIRS -- ${glslang_SOURCE_DIR} -- ${spirv-tools_SOURCE_DIR}/include -- TEST_NAMES -- compiler) -- - # This target copies content of testdata into the build directory. - add_custom_target(testdata COMMAND - ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/testdata/copy-to-build.cmake ---- a/spvc/CMakeLists.txt -+++ b/spvc/CMakeLists.txt -@@ -1,8 +1,8 @@ - add_executable(spvc_exe src/main.cc) - shaderc_default_compile_options(spvc_exe) --target_include_directories(spvc_exe PRIVATE ${shaderc_SOURCE_DIR}/libshaderc/include ${spirv-tools_SOURCE_DIR}/include) -+target_include_directories(spvc_exe PRIVATE ${shaderc_SOURCE_DIR}/libshaderc/include) - set_target_properties(spvc_exe PROPERTIES OUTPUT_NAME spvc) --target_link_libraries(spvc_exe PRIVATE shaderc_spvc shaderc_util) -+target_link_libraries(spvc_exe PRIVATE shaderc_spvc shaderc_util CONAN_PKG::spirv-tools) - add_dependencies(spvc_exe build-version) - - shaderc_add_asciidoc(spvc_doc_README README) ---- a/utils/update_build_version.py -+++ b/utils/update_build_version.py -@@ -114,12 +114,12 @@ def get_version_string(project, directory): - - - def main(): -- if len(sys.argv) != 4: -- print('usage: {} '.format( -+ if len(sys.argv) != 2: -+ print('usage: {} '.format( - sys.argv[0])) - sys.exit(1) - -- projects = ['shaderc', 'spirv-tools', 'glslang'] -+ projects = ['shaderc'] - new_content = ''.join([ - '"{}\\n"\n'.format(get_version_string(p, d)) - for (p, d) in zip(projects, sys.argv[1:]) diff --git a/recipes/shaderc/all/patches/2019.0/fix-spvc.patch b/recipes/shaderc/all/patches/2019.0/fix-spvc.patch deleted file mode 100644 index 682a95ac5deb9..0000000000000 --- a/recipes/shaderc/all/patches/2019.0/fix-spvc.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- a/libshaderc_spvc/src/spvc.cc -+++ b/libshaderc_spvc/src/spvc.cc -@@ -15,9 +15,9 @@ - #include "shaderc/spvc.h" - - #include "libshaderc_util/exceptions.h" --#include "spirv-cross/spirv_glsl.hpp" --#include "spirv-cross/spirv_hlsl.hpp" --#include "spirv-cross/spirv_msl.hpp" -+#include "spirv_glsl.hpp" -+#include "spirv_hlsl.hpp" -+#include "spirv_msl.hpp" - #include "spirv-tools/libspirv.hpp" - #include "spirv-tools/optimizer.hpp" - -@@ -169,7 +169,7 @@ size_t shaderc_spvc_compile_options_set_for_fuzzing( - shaderc_spvc_compile_options_t options, const uint8_t* data, size_t size) { - if (!data || size < sizeof(*options)) return 0; - -- memcpy(options, data, sizeof(*options)); -+ memcpy(static_cast(options), data, sizeof(*options)); - return sizeof(*options); - } - diff --git a/recipes/shaderc/all/patches/2021.1/adapt-update_build_version.py.patch b/recipes/shaderc/all/patches/2021.1/adapt-update_build_version.py.patch new file mode 100644 index 0000000000000..a53d4b7300f53 --- /dev/null +++ b/recipes/shaderc/all/patches/2021.1/adapt-update_build_version.py.patch @@ -0,0 +1,25 @@ +diff --git a/utils/update_build_version.py b/utils/update_build_version.py +--- a/utils/update_build_version.py ++++ b/utils/update_build_version.py +@@ -128,18 +128,18 @@ + + + def main(): +- if len(sys.argv) != 5: ++ if len(sys.argv) < 5: + print(('usage: {} '.format( + sys.argv[0]))) + sys.exit(1) + +- projects = ['shaderc', 'spirv-tools', 'glslang'] ++ projects = ['shaderc'] + new_content = ''.join([ + '"{}\\n"\n'.format(get_version_string(p, d)) + for (p, d) in zip(projects, sys.argv[1:]) + ]) + +- output_file = sys.argv[4] ++ output_file = sys.argv[-1] + mkdir_p(os.path.dirname(output_file)) + + if os.path.isfile(output_file): diff --git a/recipes/shaderc/all/patches/2021.1/fix-cmake.patch b/recipes/shaderc/all/patches/2021.1/fix-cmake.patch deleted file mode 100644 index ac2fd7ef1015f..0000000000000 --- a/recipes/shaderc/all/patches/2021.1/fix-cmake.patch +++ /dev/null @@ -1,324 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 0c8d1ae..4f4e6e0 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -112,19 +112,16 @@ endif(MSVC) - - # Configure subdirectories. - # We depend on these for later projects, so they should come first. --add_subdirectory(third_party) -+ - - add_subdirectory(libshaderc_util) - add_subdirectory(libshaderc) - add_subdirectory(glslc) --if(${SHADERC_ENABLE_EXAMPLES}) -- add_subdirectory(examples) --endif() - - add_custom_target(build-version - ${PYTHON_EXECUTABLE} - ${CMAKE_CURRENT_SOURCE_DIR}/utils/update_build_version.py -- ${shaderc_SOURCE_DIR} ${spirv-tools_SOURCE_DIR} ${glslang_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/build-version.inc -+ ${shaderc_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/build-version.inc - COMMENT "Update build-version.inc in the Shaderc build directory (if necessary).") - - function(define_pkg_config_file NAME LIBS) -diff --git a/cmake/utils.cmake b/cmake/utils.cmake -index d64757d..0adc008 100644 ---- a/cmake/utils.cmake -+++ b/cmake/utils.cmake -@@ -41,14 +41,6 @@ function(shaderc_default_c_compile_options TARGET) - # requires clang to be built with compiler-rt. - target_link_libraries(${TARGET} PRIVATE --coverage) - endif() -- if (NOT SHADERC_ENABLE_SHARED_CRT) -- if (WIN32) -- # For MinGW cross compile, statically link to the libgcc runtime. -- # But it still depends on MSVCRT.dll. -- set_target_properties(${TARGET} PROPERTIES -- LINK_FLAGS "-static -static-libgcc") -- endif(WIN32) -- endif(NOT SHADERC_ENABLE_SHARED_CRT) - else() - # disable warning C4800: 'int' : forcing value to bool 'true' or 'false' - # (performance warning) -@@ -58,17 +50,6 @@ endfunction(shaderc_default_c_compile_options) - - function(shaderc_default_compile_options TARGET) - shaderc_default_c_compile_options(${TARGET}) -- if (NOT "${MSVC}") -- target_compile_options(${TARGET} PRIVATE -std=c++11) -- if (NOT SHADERC_ENABLE_SHARED_CRT) -- if (WIN32) -- # For MinGW cross compile, statically link to the C++ runtime. -- # But it still depends on MSVCRT.dll. -- set_target_properties(${TARGET} PROPERTIES -- LINK_FLAGS "-static -static-libgcc -static-libstdc++") -- endif(WIN32) -- endif(NOT SHADERC_ENABLE_SHARED_CRT) -- endif() - endfunction(shaderc_default_compile_options) - - # Build an asciidoc file; additional arguments past the base filename specify -diff --git a/glslc/CMakeLists.txt b/glslc/CMakeLists.txt -index 31664d1..a962c2e 100644 ---- a/glslc/CMakeLists.txt -+++ b/glslc/CMakeLists.txt -@@ -30,7 +30,6 @@ add_library(glslc STATIC - ) - - shaderc_default_compile_options(glslc) --target_include_directories(glslc PUBLIC ${glslang_SOURCE_DIR}) - - if (SHADERC_ENABLE_WGSL_OUTPUT) - if (IS_DIRECTORY "${tint_SOURCE_DIR}/include") -@@ -43,26 +42,17 @@ if (SHADERC_ENABLE_WGSL_OUTPUT) - endif(SHADERC_ENABLE_WGSL_OUTPUT) - - target_link_libraries(glslc PRIVATE -- glslang OSDependent OGLCompiler HLSL glslang SPIRV # Glslang libraries - $<$:libtint> # Tint libraries, optional - shaderc_util shaderc # internal Shaderc libraries - ${CMAKE_THREAD_LIBS_INIT}) - - add_executable(glslc_exe src/main.cc) - shaderc_default_compile_options(glslc_exe) --target_include_directories(glslc_exe PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/.. ${spirv-tools_SOURCE_DIR}/include) -+target_include_directories(glslc_exe PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/.. ${CONAN_INCLUDE_DIRS}) - set_target_properties(glslc_exe PROPERTIES OUTPUT_NAME glslc) --target_link_libraries(glslc_exe PRIVATE glslc shaderc_util shaderc) -+target_link_libraries(glslc_exe PRIVATE glslc shaderc_util shaderc CONAN_PKG::spirv-tools) - add_dependencies(glslc_exe build-version) - --shaderc_add_tests( -- TEST_PREFIX glslc -- LINK_LIBS glslc shaderc_util shaderc -- TEST_NAMES -- file -- resource_parse -- stage) -- - shaderc_add_asciidoc(glslc_doc_README README) - - if(SHADERC_ENABLE_INSTALL) -@@ -70,4 +60,3 @@ if(SHADERC_ENABLE_INSTALL) - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) - endif(SHADERC_ENABLE_INSTALL) - --add_subdirectory(test) -diff --git a/libshaderc/CMakeLists.txt b/libshaderc/CMakeLists.txt -index 3ada419..08cf265 100644 ---- a/libshaderc/CMakeLists.txt -+++ b/libshaderc/CMakeLists.txt -@@ -24,24 +24,19 @@ set(SHADERC_SOURCES - src/shaderc_private.h - ) - --add_library(shaderc STATIC ${SHADERC_SOURCES}) -+add_library(shaderc ${SHADERC_SOURCES}) - shaderc_default_compile_options(shaderc) - target_include_directories(shaderc -- PUBLIC include -- PRIVATE ${glslang_SOURCE_DIR} -- ${SPIRV-Headers_SOURCE_DIR}/include) -+ PUBLIC include) - --add_library(shaderc_shared SHARED ${SHADERC_SOURCES}) --shaderc_default_compile_options(shaderc_shared) --target_include_directories(shaderc_shared -- PUBLIC include -- PRIVATE ${glslang_SOURCE_DIR} -- ${SPIRV-Headers_SOURCE_DIR}/include) --target_compile_definitions(shaderc_shared -- PRIVATE SHADERC_IMPLEMENTATION -- PUBLIC SHADERC_SHAREDLIB --) --set_target_properties(shaderc_shared PROPERTIES SOVERSION 1) -+target_include_directories(shaderc PUBLIC include) -+if(BUILD_SHARED_LIBS) -+ target_compile_definitions(shaderc -+ PRIVATE SHADERC_IMPLEMENTATION -+ PUBLIC SHADERC_SHAREDLIB -+ ) -+ set_target_properties(shaderc PROPERTIES OUTPUT_NAME "shaderc_shared" SOVERSION 1) -+endif() - - if(SHADERC_ENABLE_INSTALL) - install( -@@ -54,73 +49,21 @@ if(SHADERC_ENABLE_INSTALL) - DESTINATION - ${CMAKE_INSTALL_INCLUDEDIR}/shaderc) - -- install(TARGETS shaderc shaderc_shared -+ install(TARGETS shaderc - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) - endif(SHADERC_ENABLE_INSTALL) - --find_package(Threads) - set(SHADERC_LIBS -- glslang OSDependent OGLCompiler glslang ${CMAKE_THREAD_LIBS_INIT} - shaderc_util -- SPIRV # from glslang -- SPIRV-Tools -+ "CONAN_PKG::glslang" -+ "CONAN_PKG::spirv-tools" - ) - - target_link_libraries(shaderc PRIVATE ${SHADERC_LIBS}) --target_link_libraries(shaderc_shared PRIVATE ${SHADERC_LIBS}) -- --shaderc_add_tests( -- TEST_PREFIX shaderc -- LINK_LIBS shaderc -- INCLUDE_DIRS include ${shaderc_SOURCE_DIR}/libshaderc_util/include ${glslang_SOURCE_DIR} -- ${spirv-tools_SOURCE_DIR}/include -- ${SPIRV-Headers_SOURCE_DIR}/include -- TEST_NAMES -- shaderc -- shaderc_cpp -- shaderc_private) -- --shaderc_add_tests( -- TEST_PREFIX shaderc_shared -- LINK_LIBS shaderc_shared SPIRV-Tools -- INCLUDE_DIRS include ${shaderc_SOURCE_DIR}/libshaderc_util/include ${glslang_SOURCE_DIR} -- ${spirv-tools_SOURCE_DIR}/include -- ${SPIRV-Headers_SOURCE_DIR}/include -- TEST_NAMES -- shaderc -- shaderc_cpp -- shaderc_private) - --shaderc_combine_static_lib(shaderc_combined shaderc) -- --if(SHADERC_ENABLE_INSTALL) -- # Since shaderc_combined is defined as an imported library, we cannot use the -- # install() directive to install it. Install it like a normal file. -- get_target_property(generated_location shaderc_combined LOCATION) -- string(REGEX MATCH "Visual Studio .*" vs_generator "${CMAKE_GENERATOR}") -- if (NOT "${vs_generator}" STREQUAL "") -- # With Visual Studio generators, the LOCATION property is not properly -- # expanded according to the current build configuration. We need to work -- # around this problem by manually substitution. -- string(REPLACE "$(Configuration)" "\${CMAKE_INSTALL_CONFIG_NAME}" -- install_location "${generated_location}") -- install(FILES ${install_location} DESTINATION ${CMAKE_INSTALL_LIBDIR}) -- else() -- install(FILES ${generated_location} DESTINATION ${CMAKE_INSTALL_LIBDIR}) -- endif() --endif(SHADERC_ENABLE_INSTALL) - --shaderc_add_tests( -- TEST_PREFIX shaderc_combined -- LINK_LIBS shaderc_combined ${CMAKE_THREAD_LIBS_INIT} -- INCLUDE_DIRS include ${shaderc_SOURCE_DIR}/libshaderc_util/include ${glslang_SOURCE_DIR} -- ${spirv-tools_SOURCE_DIR}/include -- ${SPIRV-Headers_SOURCE_DIR}/include -- TEST_NAMES -- shaderc -- shaderc_cpp) - - if(${SHADERC_ENABLE_TESTS}) - add_executable(shaderc_c_smoke_test ./src/shaderc_c_smoke_test.c) -diff --git a/libshaderc_util/CMakeLists.txt b/libshaderc_util/CMakeLists.txt -index 99ce3c4..3eb57d5 100644 ---- a/libshaderc_util/CMakeLists.txt -+++ b/libshaderc_util/CMakeLists.txt -@@ -39,28 +39,23 @@ add_library(shaderc_util STATIC - - shaderc_default_compile_options(shaderc_util) - target_include_directories(shaderc_util -- PUBLIC include PRIVATE ${glslang_SOURCE_DIR}) -+ PUBLIC include) - # We use parts of Glslang's HLSL compilation interface, which - # now requires this preprocessor definition. - add_definitions(-DENABLE_HLSL) - - find_package(Threads) - target_link_libraries(shaderc_util PRIVATE -- glslang OSDependent OGLCompiler HLSL glslang SPIRV -- SPIRV-Tools-opt ${CMAKE_THREAD_LIBS_INIT}) -+ CONAN_PKG::glslang -+ CONAN_PKG::spirv-tools -+ ${CMAKE_THREAD_LIBS_INIT}) - --shaderc_add_tests( -- TEST_PREFIX shaderc_util -- LINK_LIBS shaderc_util -- TEST_NAMES -- counting_includer -- string_piece -- format -- file_finder -- io_shaderc -- message -- mutex -- version_profile) -+if(SHADERC_ENABLE_INSTALL AND NOT BUILD_SHARED_LIBS) -+ install(TARGETS shaderc_util -+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} -+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} -+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) -+endif(SHADERC_ENABLE_INSTALL) - - if(${SHADERC_ENABLE_TESTS}) - target_include_directories(shaderc_util_counting_includer_test -@@ -69,15 +64,6 @@ if(${SHADERC_ENABLE_TESTS}) - PRIVATE ${glslang_SOURCE_DIR}) - endif() - --shaderc_add_tests( -- TEST_PREFIX shaderc_util -- LINK_LIBS shaderc_util -- INCLUDE_DIRS -- ${glslang_SOURCE_DIR} -- ${spirv-tools_SOURCE_DIR}/include -- TEST_NAMES -- compiler) -- - # This target copies content of testdata into the build directory. - add_custom_target(testdata COMMAND - ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/testdata/copy-to-build.cmake -diff --git a/libshaderc_util/src/compiler.cc b/libshaderc_util/src/compiler.cc -index 8a8d12b..92d8279 100644 ---- a/libshaderc_util/src/compiler.cc -+++ b/libshaderc_util/src/compiler.cc -@@ -20,7 +20,7 @@ - #include - #include - --#include "SPIRV/GlslangToSpv.h" -+#include "glslang/SPIRV/GlslangToSpv.h" - #include "libshaderc_util/format.h" - #include "libshaderc_util/io_shaderc.h" - #include "libshaderc_util/message.h" -diff --git a/utils/update_build_version.py b/utils/update_build_version.py -index 5785390..7801a02 100755 ---- a/utils/update_build_version.py -+++ b/utils/update_build_version.py -@@ -128,18 +128,18 @@ def get_version_string(project, directory): - - - def main(): -- if len(sys.argv) != 5: -- print(('usage: {} '.format( -+ if len(sys.argv) != 3: -+ print(('usage: {} '.format( - sys.argv[0]))) - sys.exit(1) - -- projects = ['shaderc', 'spirv-tools', 'glslang'] -+ projects = ['shaderc'] - new_content = ''.join([ - '"{}\\n"\n'.format(get_version_string(p, d)) - for (p, d) in zip(projects, sys.argv[1:]) - ]) - -- output_file = sys.argv[4] -+ output_file = sys.argv[2] - mkdir_p(os.path.dirname(output_file)) - - if os.path.isfile(output_file): diff --git a/recipes/shaderc/all/patches/2021.1/install-shaderc_util.patch b/recipes/shaderc/all/patches/2021.1/install-shaderc_util.patch new file mode 100644 index 0000000000000..c2806270e883d --- /dev/null +++ b/recipes/shaderc/all/patches/2021.1/install-shaderc_util.patch @@ -0,0 +1,14 @@ +diff --git a/libshaderc_util/CMakeLists.txt b/libshaderc_util/CMakeLists.txt +--- a/libshaderc_util/CMakeLists.txt ++++ b/libshaderc_util/CMakeLists.txt +@@ -87,3 +87,10 @@ + add_dependencies(shaderc_util_file_finder_test testdata) + add_dependencies(shaderc_util_io_shaderc_test testdata) + endif() ++ ++if(SHADERC_ENABLE_INSTALL AND NOT BUILD_SHARED_LIBS) ++ install(TARGETS shaderc_util ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) ++endif() diff --git a/recipes/shaderc/all/patches/2021.1/use-conan-dependencies.patch b/recipes/shaderc/all/patches/2021.1/use-conan-dependencies.patch new file mode 100644 index 0000000000000..667cfb6d0a4fb --- /dev/null +++ b/recipes/shaderc/all/patches/2021.1/use-conan-dependencies.patch @@ -0,0 +1,17 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -112,7 +112,12 @@ + + # Configure subdirectories. + # We depend on these for later projects, so they should come first. +-add_subdirectory(third_party) ++find_package(glslang REQUIRED CONFIG) ++find_package(SPIRV-Headers REQUIRED CONFIG) ++find_package(SPIRV-Tools REQUIRED CONFIG) ++set(glslang_SOURCE_DIR ${glslang_INCLUDE_DIRS}) ++set(SPIRV-Headers_SOURCE_DIR ${SPIRV-Headers_INCLUDE_DIR}/..) ++set(spirv-tools_SOURCE_DIR ${SPIRV-Tools_INCLUDE_DIR}/..) + + add_subdirectory(libshaderc_util) + add_subdirectory(libshaderc) diff --git a/recipes/shaderc/all/patches/2023.6/use-conan-dependencies.patch b/recipes/shaderc/all/patches/2023.6/use-conan-dependencies.patch new file mode 100644 index 0000000000000..b28517493c7a8 --- /dev/null +++ b/recipes/shaderc/all/patches/2023.6/use-conan-dependencies.patch @@ -0,0 +1,17 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -120,7 +120,12 @@ + + # Configure subdirectories. + # We depend on these for later projects, so they should come first. +-add_subdirectory(third_party) ++find_package(glslang REQUIRED CONFIG) ++find_package(SPIRV-Headers REQUIRED CONFIG) ++find_package(SPIRV-Tools REQUIRED CONFIG) ++set(glslang_SOURCE_DIR ${glslang_INCLUDE_DIRS}) ++set(SPIRV-Headers_SOURCE_DIR ${SPIRV-Headers_INCLUDE_DIR}/..) ++set(spirv-tools_SOURCE_DIR ${SPIRV-Tools_INCLUDE_DIR}/..) + + add_subdirectory(libshaderc_util) + add_subdirectory(libshaderc) diff --git a/recipes/shaderc/all/test_package/CMakeLists.txt b/recipes/shaderc/all/test_package/CMakeLists.txt index 492695489b31c..e88a76ff2e432 100644 --- a/recipes/shaderc/all/test_package/CMakeLists.txt +++ b/recipes/shaderc/all/test_package/CMakeLists.txt @@ -1,21 +1,11 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(shaderc REQUIRED CONFIG) add_executable(${PROJECT_NAME}_shaderc_c test_package_shaderc.c) -target_link_libraries(${PROJECT_NAME}_shaderc_c ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME}_shaderc_c PRIVATE shaderc::shaderc) add_executable(${PROJECT_NAME}_shaderc_cpp test_package_shaderc.cpp) -target_link_libraries(${PROJECT_NAME}_shaderc_cpp ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME}_shaderc_cpp PRIVATE shaderc::shaderc) set_property(TARGET ${PROJECT_NAME}_shaderc_cpp PROPERTY CXX_STANDARD 11) - -if(SHADERC_WITH_SPVC) - add_executable(${PROJECT_NAME}_spvc_c test_package_spvc.c) - target_link_libraries(${PROJECT_NAME}_spvc_c ${CONAN_LIBS}) - - add_executable(${PROJECT_NAME}_spvc_cpp test_package_spvc.cpp) - target_link_libraries(${PROJECT_NAME}_spvc_cpp ${CONAN_LIBS}) - set_property(TARGET ${PROJECT_NAME}_spvc_cpp PROPERTY CXX_STANDARD 11) -endif() diff --git a/recipes/shaderc/all/test_package/conanfile.py b/recipes/shaderc/all/test_package/conanfile.py index e6ac9a4c93682..4613db3f59c9f 100644 --- a/recipes/shaderc/all/test_package/conanfile.py +++ b/recipes/shaderc/all/test_package/conanfile.py @@ -1,32 +1,34 @@ -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_layout, CMake + 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, run=True) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) - cmake.definitions["SHADERC_WITH_SPVC"] = self.options["shaderc"].spvc if "spvc" in self.options["shaderc"] else False cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self): + if can_run(self): # Test programs consuming shaderc lib - bin_path_shaderc_c = os.path.join("bin", "test_package_shaderc_c") - self.run(bin_path_shaderc_c, run_environment=True) - bin_path_shaderc_cpp = os.path.join("bin", "test_package_shaderc_cpp") - self.run(bin_path_shaderc_cpp, run_environment=True) + bin_path_shaderc_c = os.path.join(self.cpp.build.bindir, "test_package_shaderc_c") + self.run(bin_path_shaderc_c, env="conanrun") + + bin_path_shaderc_cpp = os.path.join(self.cpp.build.bindir, "test_package_shaderc_cpp") + self.run(bin_path_shaderc_cpp, env="conanrun") + # Test glslc executable - in_glsl_name = os.path.join(self.source_folder, "test_package.vert") - spv_name = "test_package.spv" - self.run("glslc \"{0}\" -o {1}".format(in_glsl_name, spv_name), run_environment=True) - - if "spvc" in self.options["shaderc"] and self.options["shaderc"].spvc: - # Test programs consuming shaderc_spvc lib - bin_path_spvc_c = os.path.join("bin", "test_package_spvc_c") - self.run(bin_path_spvc_c, run_environment=True) - bin_path_spvc_cpp = os.path.join("bin", "test_package_spvc_cpp") - self.run(bin_path_spvc_cpp, run_environment=True) + self.run(f"glslc -h", env="conanrun") diff --git a/recipes/shaderc/all/test_package/test_package.vert b/recipes/shaderc/all/test_package/test_package.vert deleted file mode 100644 index 8f349eebab57e..0000000000000 --- a/recipes/shaderc/all/test_package/test_package.vert +++ /dev/null @@ -1,8 +0,0 @@ -#version 450 -#extension GL_ARB_separate_shader_objects : enable - -layout(location = 0) in vec2 inPosition; - -void main() { - gl_Position = vec4(inPosition, 0.0, 1.0); -} diff --git a/recipes/shaderc/all/test_package/test_package_spvc.c b/recipes/shaderc/all/test_package/test_package_spvc.c deleted file mode 100644 index c9fc709f30096..0000000000000 --- a/recipes/shaderc/all/test_package/test_package_spvc.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -int main() { - shaderc_spvc_compiler_t shaderc_spvc_compiler = shaderc_spvc_compiler_initialize(); - shaderc_spvc_compiler_release(shaderc_spvc_compiler); - - return 0; -} diff --git a/recipes/shaderc/all/test_package/test_package_spvc.cpp b/recipes/shaderc/all/test_package/test_package_spvc.cpp deleted file mode 100644 index 40978d50d1c6c..0000000000000 --- a/recipes/shaderc/all/test_package/test_package_spvc.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include - -int main() { - shaderc_spvc::Compiler compiler; - shaderc_spvc::CompileOptions compile_options; - - return 0; -} diff --git a/recipes/shaderc/all/test_v1_package/CMakeLists.txt b/recipes/shaderc/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/shaderc/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/shaderc/all/test_v1_package/conanfile.py b/recipes/shaderc/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..fdb8622025dbc --- /dev/null +++ b/recipes/shaderc/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.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + # Test programs consuming shaderc lib + bin_path_shaderc_c = os.path.join("bin", "test_package_shaderc_c") + self.run(bin_path_shaderc_c, run_environment=True) + bin_path_shaderc_cpp = os.path.join("bin", "test_package_shaderc_cpp") + self.run(bin_path_shaderc_cpp, run_environment=True) + + self.run(f"glslc -h", run_environment=True) diff --git a/recipes/shaderc/config.yml b/recipes/shaderc/config.yml index 15d431909e594..7b4ff24649925 100644 --- a/recipes/shaderc/config.yml +++ b/recipes/shaderc/config.yml @@ -1,5 +1,7 @@ versions: - "2021.1": + "2024.1": + folder: all + "2023.6": folder: all - "2019.0": + "2021.1": folder: all diff --git a/recipes/shapelib/all/conandata.yml b/recipes/shapelib/all/conandata.yml index 5dde0cb6bfee1..b4cae11fb3a97 100644 --- a/recipes/shapelib/all/conandata.yml +++ b/recipes/shapelib/all/conandata.yml @@ -1,14 +1,27 @@ sources: + "1.6.1": + url: "https://github.com/OSGeo/shapelib/archive/v1.6.1.tar.gz" + sha256: "72a30ed408edee0dc9eaa81255e634af6706f9192b5ed5b536013f1cc4b327c4" + "1.6.0": + url: "https://github.com/OSGeo/shapelib/archive/v1.6.0.tar.gz" + sha256: "0bfd1eab9616ca3c420a5ad674b0d07c7c5018620d6ab6ae43917daa18ff0d1e" "1.5.0": - url: "https://github.com/OSGeo/shapelib/archive/v1.5.0.zip" - sha256: "673b00ef6caef254fe16d831b982e6bbed7397615c57b9ed92cf8b59017dd06b" + url: "https://github.com/OSGeo/shapelib/archive/v1.5.0.tar.gz" + sha256: "48de3a6a8691b0b111b909c0b908af4627635c75322b3a501c0c0885f3558cad" patches: + "1.6.0": + - patch_file: "patches/1.6.0-0003-relocatable-shared-macos.patch" + patch_description: "Relocatable shared lib on macOS" + patch_type: "conan" "1.5.0": - - patch_file: "patches/0001-cmake-minimum-required.patch" + - patch_file: "patches/1.5.0-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_file: "patches/1.5.0-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" + - patch_file: "patches/1.5.0-0003-relocatable-shared-macos.patch" + patch_description: "Relocatable shared lib on macOS" + patch_type: "conan" diff --git a/recipes/shapelib/all/conanfile.py b/recipes/shapelib/all/conanfile.py index 19059022ab189..56012aa251125 100644 --- a/recipes/shapelib/all/conanfile.py +++ b/recipes/shapelib/all/conanfile.py @@ -4,16 +4,17 @@ 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" +required_conan_version = ">=1.54.0" class ShapelibConan(ConanFile): name = "shapelib" description = "C library for reading and writing ESRI Shapefiles" - license = "LGPL-2.0-or-later" - topics = ("osgeo", "shapefile", "esri", "geospatial") - homepage = "https://github.com/OSGeo/shapelib" + license = "LGPL-2.0-or-later", "MIT" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/OSGeo/shapelib" + topics = ("osgeo", "shapefile", "esri", "geospatial") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -45,9 +46,8 @@ def source(self): 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.cache_variables["USE_RPATH"] = False tc.generate() def build(self): @@ -58,10 +58,12 @@ def build(self): def package(self): copy(self, "COPYING", self.source_folder, os.path.join(self.package_folder, "licenses")) + copy(self, "license.html", os.path.join(self.source_folder, "web"), 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")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) 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/1.5.0-0001-cmake-minimum-required.patch similarity index 100% rename from recipes/shapelib/all/patches/0001-cmake-minimum-required.patch rename to recipes/shapelib/all/patches/1.5.0-0001-cmake-minimum-required.patch diff --git a/recipes/shapelib/all/patches/0002-build-testing.patch b/recipes/shapelib/all/patches/1.5.0-0002-build-testing.patch similarity index 100% rename from recipes/shapelib/all/patches/0002-build-testing.patch rename to recipes/shapelib/all/patches/1.5.0-0002-build-testing.patch diff --git a/recipes/shapelib/all/patches/1.5.0-0003-relocatable-shared-macos.patch b/recipes/shapelib/all/patches/1.5.0-0003-relocatable-shared-macos.patch new file mode 100644 index 0000000000000..5994e77d745e1 --- /dev/null +++ b/recipes/shapelib/all/patches/1.5.0-0003-relocatable-shared-macos.patch @@ -0,0 +1,10 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -117,7 +117,6 @@ set_target_properties(shp + PROPERTIES + SOVERSION ${shp_SOVERSION} + VERSION ${shp_VERSION} +- INSTALL_NAME_DIR "${CMAKE_INSTALL_LIBDIR}" + ) + + if(USE_RPATH) diff --git a/recipes/shapelib/all/patches/1.6.0-0003-relocatable-shared-macos.patch b/recipes/shapelib/all/patches/1.6.0-0003-relocatable-shared-macos.patch new file mode 100644 index 0000000000000..13deeaed93d83 --- /dev/null +++ b/recipes/shapelib/all/patches/1.6.0-0003-relocatable-shared-macos.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 893328e..7d907ad 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -137,7 +137,7 @@ set(shp_VERSION ${PROJECT_VERSION}) + set_target_properties(${PACKAGE} PROPERTIES + SOVERSION ${shp_SOVERSION} + VERSION ${shp_VERSION} +- INSTALL_NAME_DIR "${CMAKE_INSTALL_LIBDIR}" ++# INSTALL_NAME_DIR "${CMAKE_INSTALL_LIBDIR}" + ) + + if(USE_RPATH) diff --git a/recipes/shapelib/all/test_package/CMakeLists.txt b/recipes/shapelib/all/test_package/CMakeLists.txt index 30289c1a8112b..2d8b5a050f64f 100644 --- a/recipes/shapelib/all/test_package/CMakeLists.txt +++ b/recipes/shapelib/all/test_package/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package LANGUAGES C) find_package(shapelib REQUIRED CONFIG) diff --git a/recipes/shapelib/all/test_v1_package/CMakeLists.txt b/recipes/shapelib/all/test_v1_package/CMakeLists.txt index 925ecbe19e448..2f11d9b196ef7 100644 --- a/recipes/shapelib/all/test_v1_package/CMakeLists.txt +++ b/recipes/shapelib/all/test_v1_package/CMakeLists.txt @@ -1,5 +1,5 @@ -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(TARGETS) diff --git a/recipes/shapelib/config.yml b/recipes/shapelib/config.yml index 7f3d5d7f62dd8..7da8bd84259cd 100644 --- a/recipes/shapelib/config.yml +++ b/recipes/shapelib/config.yml @@ -1,3 +1,7 @@ versions: + "1.6.1": + folder: all + "1.6.0": + folder: all "1.5.0": folder: all diff --git a/recipes/shield/all/conandata.yml b/recipes/shield/all/conandata.yml index 7af74449cf6b7..7719bd88959d1 100644 --- a/recipes/shield/all/conandata.yml +++ b/recipes/shield/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "0.6": + url: "https://github.com/holoplot/shield/archive/0.6.tar.gz" + sha256: "9ed05e2be8268dc634367ce87aff8b4878b481353eacfdbd8d1f303888c9e3bb" + "0.5": + url: "https://github.com/holoplot/shield/archive/0.5.tar.gz" + sha256: "f6494b1c95aeddb23fe507ab8da17234ecd7ca6aff97a92112e1e6459b343ff3" + "0.4": + url: "https://github.com/holoplot/shield/archive/0.4.tar.gz" + sha256: "b93661c463b6a3af1900b9ea94bf0f75bc1bc6bd4d98b700cb29a62249fb6089" "0.3": url: "https://github.com/holoplot/shield/archive/0.3.tar.gz" sha256: "125767e64c84e701f87eb52d7882b5214db375aa19798a5fda23eacce50bd564" diff --git a/recipes/shield/all/conanfile.py b/recipes/shield/all/conanfile.py index e19e3f524d98a..b390de96bd44f 100644 --- a/recipes/shield/all/conanfile.py +++ b/recipes/shield/all/conanfile.py @@ -1,32 +1,43 @@ -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.52.0" class ShieldConan(ConanFile): name = "shield" - topics = ("utility", "warnings", "suppression") description = "C++ warning suppression headers." - settings = "os", "compiler", "build_type", "arch" + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/holoplot/shield" - license = "MIT" + topics = ("utility", "warnings", "suppression", "header-only") + package_type = "header-library" + settings = "os", "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.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(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - self.copy(pattern="*", 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="*", + 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 = [] + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.names["cmake_find_package"] = "shield" self.cpp_info.names["cmake_find_package_multi"] = "shield" diff --git a/recipes/shield/all/test_package/CMakeLists.txt b/recipes/shield/all/test_package/CMakeLists.txt index b51384ec420b1..93639374653d7 100644 --- a/recipes/shield/all/test_package/CMakeLists.txt +++ b/recipes/shield/all/test_package/CMakeLists.txt @@ -1,10 +1,6 @@ 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(shield CONFIG REQUIRED) -add_executable(${PROJECT_NAME} main.cpp) -target_link_libraries(${PROJECT_NAME} shield::shield) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE shield::shield) diff --git a/recipes/shield/all/test_package/conanfile.py b/recipes/shield/all/test_package/conanfile.py index 49a3a66ea5bad..b9d7f11e89dcd 100644 --- a/recipes/shield/all/test_package/conanfile.py +++ b/recipes/shield/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/shield/all/test_package/main.cpp b/recipes/shield/all/test_package/test_package.cpp similarity index 100% rename from recipes/shield/all/test_package/main.cpp rename to recipes/shield/all/test_package/test_package.cpp diff --git a/recipes/shield/all/test_v1_package/CMakeLists.txt b/recipes/shield/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/shield/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/shield/all/test_v1_package/conanfile.py b/recipes/shield/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..20d4d2e28d57e --- /dev/null +++ b/recipes/shield/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/shield/config.yml b/recipes/shield/config.yml index 3ff0a59a3da7e..0afee7e4b4830 100644 --- a/recipes/shield/config.yml +++ b/recipes/shield/config.yml @@ -1,4 +1,10 @@ versions: + "0.6": + folder: all + "0.5": + folder: all + "0.4": + folder: all "0.3": folder: all "0.2": diff --git a/recipes/si/all/CMakeLists.txt b/recipes/si/all/CMakeLists.txt deleted file mode 100644 index 6c3ae2de9686d..0000000000000 --- a/recipes/si/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/si/all/conandata.yml b/recipes/si/all/conandata.yml index 5576f1491e1a5..b17e4f76ae2c0 100644 --- a/recipes/si/all/conandata.yml +++ b/recipes/si/all/conandata.yml @@ -1,28 +1,19 @@ sources: - 1.7.6: - url: https://github.com/bernedom/SI/archive/1.7.6.tar.gz - sha256: 88041156890c34f7ca92f3ae385b19189583aa5c59ac470bfe2db6df5d5c954b - 2.0.4: - url: https://github.com/bernedom/SI/archive/2.0.4.tar.gz - sha256: 459936b913e887325e6ad69e9d64389b80f49e700aa8e5308df2bd77b8c74a0e - 2.1.3: - url: https://github.com/bernedom/SI/archive/2.1.3.tar.gz - sha256: c4728155bd8878fecc5c71c006e01cb193e6084d1604f79edc71ee723027534b - 2.2.0: - url: https://github.com/bernedom/SI/archive/2.2.0.tar.gz - sha256: 4b42dbe878995e19991487b60e235699b02858a5036a1729890d7adc865794bf - 2.3.0: - url: https://github.com/bernedom/SI/archive/2.3.0.tar.gz - sha256: b714162a933ddf1be66c8f2f2d31b52626189d6e4b292770bbb899106e8f6ac1 - 2.4.0: - url: https://github.com/bernedom/SI/archive/2.4.0.tar.gz - sha256: 84e13b52520808d9a55a073b1bb98376be03dc3b09ddee862a1418ef543e9f2d - 2.4.1: - url: https://github.com/bernedom/SI/archive/2.4.1.tar.gz - sha256: 6bfdbebb549da1b2db93b55c1c7f8228a0cdc6144a815319918237ca8601ad3a - 2.5.0: - url: https://github.com/bernedom/SI/archive/2.5.0.tar.gz - sha256: dc00eb8cfaa32e19c83595b238726188d2b857f8999dae08fe3001d0107ba276 + 2.5.3: + url: "https://github.com/bernedom/SI/archive/2.5.3.tar.gz" + sha256: "5c06f9f471474b97ed16e0f63f301d41702d27f6b9f340f0420eb0cfb928d0c6" 2.5.1: - url: https://github.com/bernedom/SI/archive/2.5.1.tar.gz - sha256: b7b977c04c220a47a2bd3b8e2b6acfd640d286dfe1ae609f20e184cfec998798 + url: "https://github.com/bernedom/SI/archive/2.5.1.tar.gz" + sha256: "b7b977c04c220a47a2bd3b8e2b6acfd640d286dfe1ae609f20e184cfec998798" + 2.5.0: + url: "https://github.com/bernedom/SI/archive/2.5.0.tar.gz" + sha256: "dc00eb8cfaa32e19c83595b238726188d2b857f8999dae08fe3001d0107ba276" + 2.4.1: + url: "https://github.com/bernedom/SI/archive/2.4.1.tar.gz" + sha256: "6bfdbebb549da1b2db93b55c1c7f8228a0cdc6144a815319918237ca8601ad3a" + 2.3.0: + url: "https://github.com/bernedom/SI/archive/2.3.0.tar.gz" + sha256: "b714162a933ddf1be66c8f2f2d31b52626189d6e4b292770bbb899106e8f6ac1" + 1.7.6: + url: "https://github.com/bernedom/SI/archive/1.7.6.tar.gz" + sha256: "88041156890c34f7ca92f3ae385b19189583aa5c59ac470bfe2db6df5d5c954b" diff --git a/recipes/si/all/conanfile.py b/recipes/si/all/conanfile.py index 38915243d0bef..ef396846127aa 100644 --- a/recipes/si/all/conanfile.py +++ b/recipes/si/all/conanfile.py @@ -1,31 +1,33 @@ -from conans import CMake, 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.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, rmdir +from conan.tools.scm import Version + +required_conan_version = ">=1.52.0" + class SiConan(ConanFile): name = "si" + description = ( + "A header only c++ library that provides type safety and user defined literals " + "for handling physical values defined in the International System of Units." + ) license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/bernedom/SI" - description = "A header only c++ library that provides type safety and user defined literals \ - for handling pyhsical values defined in the International System of Units." - topics = ("physical units", "SI-unit-conversion", - "cplusplus-library", "cplusplus-17") - exports_sources = "CMakeLists.txt" + topics = ("physical units", "SI-unit-conversion", "cplusplus-library", "cplusplus-17", "header-only") + + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True - 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): @@ -36,38 +38,51 @@ def _compilers_minimum_version(self): "apple-clang": "10", } + def layout(self): + cmake_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) - minimum_version = self._compilers_minimum_version.get( - str(self.settings.compiler), False) + 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("'si' requires C++17, which your compiler ({} {}) does not support.".format( - self.settings.compiler, self.settings.compiler.version)) + if Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + "'si' requires C++17, which your compiler " + f"({self.settings.compiler} {self.settings.compiler.version}) does not support.") else: - self.output.warn( - "'si' requires C++17. Your compiler is unknown. Assuming it supports C++17.") + self.output.warning("'si' requires C++17. Your compiler is unknown. Assuming it supports C++17.") - def package_id(self): - self.info.header_only() + def build_requirements(self): + if Version(self.version) >= "2.5.1": + self.tool_requires("cmake/[>=3.23 <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], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["SI_BUILD_TESTING"] = False + tc.variables["SI_BUILD_DOC"] = False + tc.variables["SI_INSTALL_LIBRARY"] = True + tc.generate() 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["SI_BUILD_TESTING"] = False - cmake.definitions["SI_BUILD_DOC"] = False - cmake.definitions["SI_INSTALL_LIBRARY"] = True - cmake.configure(build_folder=self._build_subfolder) + cmake.configure() 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.bindirs = [] + self.cpp_info.libdirs = [] + + self.cpp_info.set_property("cmake_file_name", "SI") self.cpp_info.set_property("cmake_target_name", "SI::SI") self.cpp_info.names["cmake_find_package"] = "SI" diff --git a/recipes/si/all/test_package/CMakeLists.txt b/recipes/si/all/test_package/CMakeLists.txt index 14c1322818a6b..b7052eb3cd9b3 100644 --- a/recipes/si/all/test_package/CMakeLists.txt +++ b/recipes/si/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) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) find_package(SI REQUIRED CONFIG) diff --git a/recipes/si/all/test_package/conanfile.py b/recipes/si/all/test_package/conanfile.py index 8ae9b638e62fe..ef5d7042163ec 100644 --- a/recipes/si/all/test_package/conanfile.py +++ b/recipes/si/all/test_package/conanfile.py @@ -1,11 +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) @@ -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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/si/all/test_v1_package/CMakeLists.txt b/recipes/si/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/si/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/si/all/test_v1_package/conanfile.py b/recipes/si/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..8ae9b638e62fe --- /dev/null +++ b/recipes/si/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): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/si/config.yml b/recipes/si/config.yml index 8530898d2c4b5..338eb274bf5be 100644 --- a/recipes/si/config.yml +++ b/recipes/si/config.yml @@ -1,19 +1,13 @@ versions: - 1.7.6: - folder: all - 2.0.4: - folder: all - 2.1.3: + 2.5.3: folder: all - 2.2.0: - folder: all - 2.3.0: + 2.5.1: folder: all - 2.4.0: + 2.5.0: folder: all 2.4.1: folder: all - 2.5.0: + 2.3.0: folder: all - 2.5.1: + 1.7.6: folder: all diff --git a/recipes/signals-light/all/conandata.yml b/recipes/signals-light/all/conandata.yml new file mode 100644 index 0000000000000..6255a706e185e --- /dev/null +++ b/recipes/signals-light/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "cci.20210616": + url: "https://github.com/a-n-t-h-o-n-y/signals-light/archive/1070e931d20e6d0bf6dacfdca7c2b6094975fb16.tar.gz" + sha256: "b1dfcd5dced5b8e6aef066bc8f5d541f1122a4b807911bfb77b3ed0f4b2d4fec" diff --git a/recipes/signals-light/all/conanfile.py b/recipes/signals-light/all/conanfile.py new file mode 100644 index 0000000000000..c2bd67ed6c42a --- /dev/null +++ b/recipes/signals-light/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.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 SignalsLightConan(ConanFile): + name = "signals-light" + description = "Lightweight Signals & Slots Library" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/a-n-t-h-o-n-y/signals-light/" + topics = ("signals", "slot", "header-only") + package_type = "header-library" + 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", + "Visual Studio": "16", + "msvc": "192", + } + + 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/signals-light/all/test_package/CMakeLists.txt b/recipes/signals-light/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..d1721523eaa2c --- /dev/null +++ b/recipes/signals-light/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(signals-light REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE signals-light::signals-light) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/signals-light/all/test_package/conanfile.py b/recipes/signals-light/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/signals-light/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/signals-light/all/test_package/test_package.cpp b/recipes/signals-light/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..94e057ccb6137 --- /dev/null +++ b/recipes/signals-light/all/test_package/test_package.cpp @@ -0,0 +1,10 @@ +#include +#include "signals_light/signal.hpp" + +int main(void) { + auto signal = sl::Signal{}; + signal.connect([](int i){ std::cout << i << '\n'; }); + signal.connect([](int i){ std::cout << i * 2 << '\n'; }); + + signal(4); // prints "4\n8\n" to standard output. +} diff --git a/recipes/signals-light/config.yml b/recipes/signals-light/config.yml new file mode 100644 index 0000000000000..cbec618d4f846 --- /dev/null +++ b/recipes/signals-light/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20210616": + folder: all diff --git a/recipes/sigslot/all/conandata.yml b/recipes/sigslot/all/conandata.yml index dbc7b100ed289..eddec82a6c447 100644 --- a/recipes/sigslot/all/conandata.yml +++ b/recipes/sigslot/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.2.2": + url: "https://github.com/palacaze/sigslot/archive/v1.2.2.tar.gz" + sha256: "d2dd0f91c13dbec1026aa5f393e511db863a8c32146c68c10888a9c193458437" "1.2.1": url: "https://github.com/palacaze/sigslot/archive/v1.2.1.tar.gz" sha256: "180b45e41676a730220e3a9af6ee71b761f23b8f6ade73c8f2aa20b677504934" diff --git a/recipes/sigslot/all/conanfile.py b/recipes/sigslot/all/conanfile.py index 825750d347511..7d60d57972bfa 100644 --- a/recipes/sigslot/all/conanfile.py +++ b/recipes/sigslot/all/conanfile.py @@ -1,8 +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 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.43.0" +required_conan_version = ">=1.50.0" class SigslotConan(ConanFile): @@ -12,58 +17,61 @@ class SigslotConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/palacaze/sigslot" license = "MIT" + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return "14" @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - - def validate(self): - minimal_cpp_standard = "14" - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, minimal_cpp_standard) - minimal_version = { + def _compilers_minimum_version(self): + return { "gcc": "5", "clang": "3.4", "apple-clang": "10", - "Visual Studio": "15" # 14 is not supported by the library + "Visual Studio": "15", # 14 is not supported by the library + "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 - 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.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], strip_root=True) + + def build(self): + pass def package(self): - self.copy(pattern="LICENSE", src=self._source_subfolder, dst="licenses") - self.copy(pattern="signal.hpp", src=os.path.join(self._source_subfolder, "include", "sigslot"), dst=os.path.join("include", "sigslot")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "signal.hpp", src=os.path.join(self.source_folder, "include", "sigslot"), + dst=os.path.join(self.package_folder, "include", "sigslot")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "PalSigslot") self.cpp_info.set_property("cmake_target_name", "Pal::Sigslot") # TODO: back to global scope in conan v2 once cmake_find_package* generators removed - self.cpp_info.components["_sigslot"].libs = [] + self.cpp_info.components["_sigslot"].bindirs = [] + self.cpp_info.components["_sigslot"].libdirs = [] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["_sigslot"].system_libs.append("pthread") elif self.settings.os == "Windows": - if self._is_msvc or self.settings.compiler == "clang": + if is_msvc(self) or self.settings.compiler == "clang": self.cpp_info.components["_sigslot"].exelinkflags.append('-OPT:NOICF') # TODO: to remove in conan v2 once cmake_find_package* generators removed diff --git a/recipes/sigslot/all/test_package/CMakeLists.txt b/recipes/sigslot/all/test_package/CMakeLists.txt index 41de8359000fc..b2d6dadc6457d 100644 --- a/recipes/sigslot/all/test_package/CMakeLists.txt +++ b/recipes/sigslot/all/test_package/CMakeLists.txt @@ -1,18 +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(PalSigslot REQUIRED) +find_package(PalSigslot REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) - -set_target_properties( - ${PROJECT_NAME} PROPERTIES - - CXX_STANDARD 14 - CXX_STANDARD_REQUIRED ON -) - -target_link_libraries(${PROJECT_NAME} Pal::Sigslot) +target_link_libraries(${PROJECT_NAME} PRIVATE Pal::Sigslot) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/sigslot/all/test_package/conanfile.py b/recipes/sigslot/all/test_package/conanfile.py index 19e6a0c06e3d8..0a6bc68712d90 100644 --- a/recipes/sigslot/all/test_package/conanfile.py +++ b/recipes/sigslot/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/sigslot/all/test_v1_package/CMakeLists.txt b/recipes/sigslot/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/sigslot/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/sigslot/all/test_v1_package/conanfile.py b/recipes/sigslot/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/sigslot/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/sigslot/config.yml b/recipes/sigslot/config.yml index 9f174d514c33f..e7ad2033c3161 100644 --- a/recipes/sigslot/config.yml +++ b/recipes/sigslot/config.yml @@ -1,4 +1,6 @@ versions: + "1.2.2": + folder: all "1.2.1": folder: all "1.2.0": diff --git a/recipes/simd/all/conandata.yml b/recipes/simd/all/conandata.yml new file mode 100644 index 0000000000000..4806772037748 --- /dev/null +++ b/recipes/simd/all/conandata.yml @@ -0,0 +1,10 @@ +sources: + "6.1.143": + url: "https://github.com/ermig1979/Simd/archive/refs/tags/v6.1.143.tar.gz" + sha256: "f6cd1031eddc8f1f2bd0140a766e242ab2a9f8e38f133748187fe2cd51ac94cb" + "6.1.142": + url: "https://github.com/ermig1979/Simd/archive/refs/tags/v6.1.142.tar.gz" + sha256: "e9b83b91d38d0c1b1e50e1cee51314f036f6f96efc3f035314cb59ff6345c393" + "6.1.138": + url: "https://github.com/ermig1979/Simd/archive/refs/tags/v6.1.138.tar.gz" + sha256: "5090e4879d48851d5d7d9605485f517dea9a27d9431ec2d54a74a6f04cf3ba00" diff --git a/recipes/simd/all/conanfile.py b/recipes/simd/all/conanfile.py new file mode 100644 index 0000000000000..37b86bba68c29 --- /dev/null +++ b/recipes/simd/all/conanfile.py @@ -0,0 +1,130 @@ +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, CMakeToolchain, cmake_layout +from conan.tools.files import get, copy, rmdir, replace_in_file, collect_libs +from conan.tools.microsoft import is_msvc, MSBuild, MSBuildToolchain, is_msvc_static_runtime, msvs_toolset +from conan.tools.scm import Version + +required_conan_version = ">=1.59.0" + + +class SimdConan(ConanFile): + name = "simd" + description = "C++ image processing and machine learning library with SIMD" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/ermig1979/Simd" + topics = ("sse", "avx", "avx-512", "amx", "vmx", "vsx", "neon") + package_type = "library" + 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 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) + if self.settings.os == "Windows" and self.settings.arch not in ["x86", "x86_64"]: + raise ConanInvalidConfiguration("Windows only supports x86/x64 architectures.") + if is_msvc(self) and self.settings.arch == "armv8": + raise ConanInvalidConfiguration("ARM64 building with MSVC is not supported.") + if Version(self.version) >= "6.1.142" and \ + self.settings.arch in ["x86", "x86_64"] and \ + self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "9": + raise ConanInvalidConfiguration("${self.ref} requires GCC >= 9") + + 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.generate() + else: + tc = CMakeToolchain(self) + tc.variables["SIMD_TEST"] = False + tc.variables["SIMD_SHARED"] = self.options.shared + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() + + @property + def vs_proj_folder(self): + """Return the vsXXXX/ folder given the MSVC compiler version""" + toolset = msvs_toolset(self) + # By default, v2022 folder + return {"v140": "vs2015", + "v141": "vs2017", + "v142": "vs2019"}.get(toolset, "vs2022") + + def _patch_sources(self): + if is_msvc(self): + if not self.options.shared: + replace_in_file(self, os.path.join(self.source_folder, "src", "Simd", "SimdConfig.h"), "//#define SIMD_STATIC", "#define SIMD_STATIC") + replace_in_file(self, os.path.join(self.source_folder, "prj", self.vs_proj_folder, "Simd.vcxproj"), + "DynamicLibrary", + "StaticLibrary") + for prj in ("AmxBf16", "Avx2", "Avx512bw", "Avx512vnni", "Base", "Neon", "Simd", "Sse41"): + replace_in_file(self, os.path.join(self.source_folder, "prj", self.vs_proj_folder, f"{prj}.vcxproj"), + " ", + " OldStyle\n ") + + if not is_msvc_static_runtime(self): + for prj in ("AmxBf16", "Avx2", "Avx512bw", "Avx512vnni", "Base", "Neon", "Simd", "Sse41"): + replace_in_file(self, os.path.join(self.source_folder, "prj", self.vs_proj_folder, f"{prj}.vcxproj"), + " ", + " MultiThreadedDebugDLL\n" + " MultiThreadedDLL\n" + " ") + + def build(self): + self._patch_sources() + if is_msvc(self): + msbuild = MSBuild(self) + msbuild.build(os.path.join(self.source_folder, "prj", self.vs_proj_folder, "Simd.vcxproj")) + else: + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, "prj", "cmake")) + 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): + copy(self, pattern="*.h*", dst=os.path.join(self.package_folder, "include", "Simd"), src=os.path.join(self.source_folder, "src", "Simd"), keep_path=True) + copy(self, pattern="*.lib", dst=os.path.join(self.package_folder, "lib"), src=self.source_folder, keep_path=False) + copy(self, pattern="*.dll", dst=os.path.join(self.package_folder, "bin"), src=self.source_folder, keep_path=False) + else: + cmake = CMake(self) + cmake.install() + rmdir(self, os.path.join(self.package_folder, "share")) + + def package_info(self): + self.cpp_info.libs = collect_libs(self) + self.cpp_info.set_property("cmake_file_name", "Simd") + self.cpp_info.set_property("cmake_target_name", "Simd::Simd") + if not self.options.shared and is_msvc(self): + self.cpp_info.defines.append("SIMD_STATIC") + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["pthread", "m"]) diff --git a/recipes/simd/all/test_package/CMakeLists.txt b/recipes/simd/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..eef0ed5180fa2 --- /dev/null +++ b/recipes/simd/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(Simd REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE Simd::Simd) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/simd/all/test_package/conanfile.py b/recipes/simd/all/test_package/conanfile.py new file mode 100644 index 0000000000000..d7de1f914ce42 --- /dev/null +++ b/recipes/simd/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/simd/all/test_package/test_package.cpp b/recipes/simd/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..9618b4bc617e4 --- /dev/null +++ b/recipes/simd/all/test_package/test_package.cpp @@ -0,0 +1,6 @@ +#include +#include "Simd/SimdLib.hpp" + +int main(void) { + Simd::PrintInfo(std::cout); +} diff --git a/recipes/simd/config.yml b/recipes/simd/config.yml new file mode 100644 index 0000000000000..27fd4dbf8a73a --- /dev/null +++ b/recipes/simd/config.yml @@ -0,0 +1,7 @@ +versions: + "6.1.143": + folder: all + "6.1.142": + folder: all + "6.1.138": + folder: all diff --git a/recipes/simde/all/conandata.yml b/recipes/simde/all/conandata.yml new file mode 100644 index 0000000000000..4819243883706 --- /dev/null +++ b/recipes/simde/all/conandata.yml @@ -0,0 +1,13 @@ +sources: + "0.8.2": + url: "https://github.com/simd-everywhere/simde/archive/refs/tags/v0.8.2.tar.gz" + sha256: "ed2a3268658f2f2a9b5367628a85ccd4cf9516460ed8604eed369653d49b25fb" + "0.8.0": + # same as 0.7.6 + url: "https://github.com/simd-everywhere/simde/archive/refs/tags/v0.8.0.tar.gz" + sha256: "d7c1aef6dd9ef0fbe6f521d1ca3e79afc26deda7d8f857544ca020b42a4b9b97" + "0.7.6": + # A release tarball exists, but I want to use the archive tarball. + # Because the release tarball has only amalgatated(with lots of duplicate lines) header files. + url: "https://github.com/simd-everywhere/simde/archive/refs/tags/v0.7.6.tar.gz" + sha256: "c63e6c61392e324728da1c7e5de308cb31410908993a769594f5e21ff8de962b" diff --git a/recipes/simde/all/conanfile.py b/recipes/simde/all/conanfile.py new file mode 100644 index 0000000000000..492893a0540fb --- /dev/null +++ b/recipes/simde/all/conanfile.py @@ -0,0 +1,59 @@ +from conan import ConanFile +from conan.tools.files import copy, get, rmdir +from conan.tools.gnu import PkgConfigDeps +from conan.tools.layout import basic_layout +from conan.tools.meson import Meson, MesonToolchain +import os + +required_conan_version = ">=1.52.0" + + +class SIMEeConan(ConanFile): + name = "simde" + description = "Implementations of SIMD instruction sets for systems which don't natively support them." + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/simd-everywhere/simde" + topics = ("neon", "avx", "sse", "simd", "header-only") + package_type = "header-library" + 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 build_requirements(self): + self.tool_requires("meson/1.2.2") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/2.0.3") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = MesonToolchain(self) + tc.project_options["tests"] = False + tc.generate() + pkg = PkgConfigDeps(self) + pkg.generate() + + def build(self): + meson = Meson(self) + meson.configure() + meson.build() + + def package(self): + copy(self, pattern="COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + meson = Meson(self) + meson.install() + + rmdir(self, os.path.join(self.package_folder, "lib")) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + self.cpp_info.set_property("pkg_config_name", "SIMDe") diff --git a/recipes/simde/all/test_package/CMakeLists.txt b/recipes/simde/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..142cf36ac18b4 --- /dev/null +++ b/recipes/simde/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) + +find_package(simde REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE simde::simde) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) diff --git a/recipes/simde/all/test_package/conanfile.py b/recipes/simde/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/simde/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/simde/all/test_package/test_package.c b/recipes/simde/all/test_package/test_package.c new file mode 100644 index 0000000000000..7257838559828 --- /dev/null +++ b/recipes/simde/all/test_package/test_package.c @@ -0,0 +1,26 @@ +#include +#include + +int main(void) { + simde__m128i a = simde_mm_set_epi8( + INT8_C(-105), INT8_C(-116), INT8_C( -45), INT8_C(-102), + INT8_C( -3), INT8_C( 92), INT8_C( -99), INT8_C( 100), + INT8_C( 30), INT8_C(-115), INT8_C( 82), INT8_C( 84), + INT8_C(-106), INT8_C( 66), INT8_C(-107), INT8_C( 116) + ); + int la = 0; + simde__m128i b = simde_mm_set_epi8( + INT8_C( -89), INT8_C( 65), INT8_C( 68), INT8_C( -29), + INT8_C(-101), INT8_C( 113), INT8_C( -11), INT8_C( 53), + INT8_C( -5), INT8_C( -76), INT8_C( 28), INT8_C(-120), + INT8_C( 64), INT8_C( 43), INT8_C(-127), INT8_C( -44) + ); + int lb = 2; + int r = simde_mm_cmpestrs(a, la, b, lb, 0); + + if (r != 1) { + return 1; + } + + return 0; +} diff --git a/recipes/simde/config.yml b/recipes/simde/config.yml new file mode 100644 index 0000000000000..63dd232920b7f --- /dev/null +++ b/recipes/simde/config.yml @@ -0,0 +1,7 @@ +versions: + "0.8.2": + folder: all + "0.8.0": + folder: all + "0.7.6": + folder: all diff --git a/recipes/simdjson/all/conandata.yml b/recipes/simdjson/all/conandata.yml index e013ffe19b37c..9697453b1dc9f 100644 --- a/recipes/simdjson/all/conandata.yml +++ b/recipes/simdjson/all/conandata.yml @@ -1,37 +1,34 @@ sources: - "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.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" - "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" - "1.0.2": - url: "https://github.com/simdjson/simdjson/archive/v1.0.2.tar.gz" - sha256: "46d5995488de76ae61f1c3bcff445a9085c8d34f6cbc9bf0422a99c6d98a002c" - "0.9.7": - url: "https://github.com/simdjson/simdjson/archive/v0.9.7.tar.gz" - sha256: "a21279ae4cf0049234a822c5c3550f99ec1707d3cda12156d331dcc8cd411ba0" + "3.10.1": + url: "https://github.com/simdjson/simdjson/archive/v3.10.1.tar.gz" + sha256: "1e8f881cb2c0f626c56cd3665832f1e97b9d4ffc648ad9e1067c134862bba060" + "3.10.0": + url: "https://github.com/simdjson/simdjson/archive/v3.10.0.tar.gz" + sha256: "9c30552f1dd0ee3d0832bb1c6b7b97d813b18d5ef294c10dcb6fc242e5947de8" + "3.9.3": + url: "https://github.com/simdjson/simdjson/archive/v3.9.3.tar.gz" + sha256: "2e3d10abcde543d3dd8eba9297522cafdcebdd1db4f51b28f3bc95bf1d6ad23c" + "3.9.2": + url: "https://github.com/simdjson/simdjson/archive/v3.9.2.tar.gz" + sha256: "79fbe700f4ac3dd69c4f08275af58399daabd612bca0c0465aea959c60256651" + "3.9.1": + url: "https://github.com/simdjson/simdjson/archive/v3.9.1.tar.gz" + sha256: "a4b6e7cd83176e0ccb107ce38521da40a8df41c2d3c90566f2a0af05b0cd05c4" + "3.8.0": + url: "https://github.com/simdjson/simdjson/archive/v3.8.0.tar.gz" + sha256: "e28e3f46f0012d405b67de6c0a75e8d8c9a612b0548cb59687822337d73ca78b" + "3.7.0": + url: "https://github.com/simdjson/simdjson/archive/v3.7.0.tar.gz" + sha256: "27315c4861893b3e036c1f672b1c238ee86be6edb84c0824d1ed20dea5999777" + "3.6.4": + url: "https://github.com/simdjson/simdjson/archive/v3.6.4.tar.gz" + sha256: "7e93d5094a47180a3d451cb261ba29ac66f3f6ceb7c2a0884955e9a2bb06d818" + "3.5.0": + url: "https://github.com/simdjson/simdjson/archive/v3.5.0.tar.gz" + sha256: "942c9462b3c046e12b898cbf5e198f31a377ab40bb2bde5be98440d1f9212ee0" + "3.3.0": + url: "https://github.com/simdjson/simdjson/archive/v3.3.0.tar.gz" + sha256: "a8c9feff2f19c3ff281d42f0b6b4b18f02236513b99229756fa9a1b14787a58a" + "3.2.0": + url: "https://github.com/simdjson/simdjson/archive/v3.2.0.tar.gz" + sha256: "75a684dbbe38cf72b8b3bdbdc430764813f3615899a6029931c26ddd89812da4" diff --git a/recipes/simdjson/all/conanfile.py b/recipes/simdjson/all/conanfile.py index e8b764c5b7dc2..2f8062c7b4ea4 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.0" class SimdjsonConan(ConanFile): @@ -18,6 +18,7 @@ class SimdjsonConan(ConanFile): homepage = "https://github.com/lemire/simdjson" topics = ("json", "parser", "simd", "format") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -30,12 +31,16 @@ class SimdjsonConan(ConanFile): "threads": True, } + @property + def _min_cppstd(self): + return "17" + @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,11 +51,14 @@ 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: - check_min_cppstd(self, "17") + 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(".")] @@ -58,48 +66,23 @@ 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 not minimum_version: - self.output.warn("{} requires C++17. Your compiler is unknown. Assuming it supports C++17.".format(self.name)) - 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)) - - 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)) - if self.info.settings.build_type == "Debug": - raise ConanInvalidConfiguration("{}/{} doesn't support GCC 9 with Debug build type.".format(self.name, self.version)) - - def layout(self): - cmake_layout(self, src_folder="src") + 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 fully 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) tc.variables["SIMDJSON_ENABLE_THREADS"] = self.options.threads - if Version(self.version) < "1.0.0": - tc.variables["SIMDJSON_BUILD_STATIC"] = not self.options.shared - tc.variables["SIMDJSON_SANITIZE"] = False - tc.variables["SIMDJSON_JUST_LIBRARY"] = True - else: - tc.variables["SIMDJSON_DEVELOPER_MODE"] = False + tc.variables["SIMDJSON_DEVELOPER_MODE"] = False tc.generate() def _patch_sources(self): - if Version(self.version) < "1.0.0": - simd_flags_file = os.path.join(self.source_folder, "cmake", "simdjson-flags.cmake") - # Those flags are not set in >=1.0.0 since we disable SIMDJSON_DEVELOPER_MODE - replace_in_file(self, simd_flags_file, "target_compile_options(simdjson-internal-flags INTERFACE -fPIC)", "") - replace_in_file(self, simd_flags_file, "-Werror", "") - replace_in_file(self, simd_flags_file, "/WX", "") - # Relocatable shared lib on macOS - replace_in_file(self, simd_flags_file, "set(CMAKE_MACOSX_RPATH OFF)", "") - else: + if Version(self.version) < "3.3.0": developer_options = os.path.join(self.source_folder, "cmake", "developer-options.cmake") # Relocatable shared lib on macOS replace_in_file(self, developer_options, "set(CMAKE_MACOSX_RPATH OFF)", "") @@ -120,8 +103,7 @@ def package(self): 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.set_property("pkg_config_name", "simdjson") self.cpp_info.libs = ["simdjson"] if self.settings.os in ["Linux", "FreeBSD"]: diff --git a/recipes/simdjson/all/test_package/conanfile.py b/recipes/simdjson/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/simdjson/all/test_package/conanfile.py +++ b/recipes/simdjson/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/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 3e7ad49018ff0..8dc9180fc8813 100644 --- a/recipes/simdjson/config.yml +++ b/recipes/simdjson/config.yml @@ -1,25 +1,24 @@ versions: - "3.0.1": + "3.10.1": folder: all - "3.0.0": + "3.10.0": folder: all - "2.2.3": + "3.9.3": folder: all - "2.2.2": + "3.9.2": folder: all - "2.2.0": + "3.9.1": folder: all - "2.1.0": + "3.8.0": folder: all - "2.0.4": + "3.7.0": folder: all - "2.0.3": + "3.6.4": folder: all - "2.0.1": + "3.5.0": folder: all - "1.1.0": + "3.3.0": folder: all - "1.0.2": - folder: all - "0.9.7": + # fastgltf requires simdjson/3.2.0 + "3.2.0": folder: all diff --git a/recipes/simdutf/all/conandata.yml b/recipes/simdutf/all/conandata.yml index 2ba4399d0df48..50f57687007b9 100644 --- a/recipes/simdutf/all/conandata.yml +++ b/recipes/simdutf/all/conandata.yml @@ -1,57 +1,32 @@ sources: - "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/refs/tags/v2.0.8.tar.gz" - sha256: "bd7aa550a8d9a1aba2c0b4eb2088f90c964375b13394f9076f7ba49f51dc40b5" - "2.0.6": - url: "https://github.com/simdutf/simdutf/archive/refs/tags/v2.0.6.tar.gz" - sha256: "40f1f9a4403f81c2c3d736ef9c73662835b2241871caa262fcd654e0898f9e4e" - "2.0.3": - url: "https://github.com/simdutf/simdutf/archive/refs/tags/v2.0.3.tar.gz" - sha256: "076bd07f6fd88c5befba28992cd5a9bf033225c5564d8b88559b8059c3c49cfc" - "2.0.2": - url: "https://github.com/simdutf/simdutf/archive/refs/tags/v2.0.2.tar.gz" - sha256: "ae02a923434c32a9c800e6b136ac039708838ba1f7f6d338175ecb35bf959173" - "1.0.1": - url: "https://github.com/simdutf/simdutf/archive/refs/tags/v1.0.1.tar.gz" - sha256: "e7832ba58fb95fe00de76dbbb2f17d844a7ad02a6f5e3e9e5ce9520e820049a0" -patches: - "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" - "2.0.3": - - 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.2-0002-add-workaround-gcc9.patch" - patch_description: "apply gcc8 workaround to gcc9" - patch_type: "portability" - "2.0.2": - - patch_file: "patches/2.0.2-0001-fix-cmake.patch" - patch_description: "remove static build, stop to link static libc++ and enable\ - \ rpath on macOS" - patch_type: "conan" - - patch_file: "patches/2.0.2-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" - 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" - patch_description: "remove static build only" - patch_type: "conan" + "5.6.3": + url: "https://github.com/simdutf/simdutf/archive/v5.6.3.tar.gz" + sha256: "503070ddf27e26c051b9500dfc7354ec8850e11076f47db32635931c85b630c0" + "5.6.2": + url: "https://github.com/simdutf/simdutf/archive/v5.6.2.tar.gz" + sha256: "c71b5478c9b912e07f75098f3a60920f1c4de3227b5285ea8a90a2fcf8bd6a89" + "5.6.0": + url: "https://github.com/simdutf/simdutf/archive/v5.6.0.tar.gz" + sha256: "98cc5761b638642b018a628b1609f1b2df489b555836fa88706055bb56a4d6fe" + "5.5.0": + url: "https://github.com/simdutf/simdutf/archive/v5.5.0.tar.gz" + sha256: "47090a770b8eecf610ac4d1fafadde60bb7ba3c9d576d2a3a545aba989a3d749" + "5.4.15": + url: "https://github.com/simdutf/simdutf/archive/v5.4.15.tar.gz" + sha256: "188a9516ee208659cab9a1e5063c1b8385d63d171c2381e9ce18af97936d9879" + "5.3.7": + url: "https://github.com/simdutf/simdutf/archive/v5.3.7.tar.gz" + sha256: "731fb29c8c0b05c77b0a29dc37ab8eabe09533f000864a7c55e1ed2e1d33d1e7" + "5.3.5": + url: "https://github.com/simdutf/simdutf/archive/v5.3.5.tar.gz" + sha256: "e6706d7fc68f6e1541414dcf45abe6190d591505d08bff3cc53f55642568f28d" + "5.3.2": + url: "https://github.com/simdutf/simdutf/archive/v5.3.2.tar.gz" + sha256: "3c146fb80d775b869ae9b132f41981dc3266f616f589b5f45045d6a22fdabdca" + "5.3.1": + url: "https://github.com/simdutf/simdutf/archive/v5.3.1.tar.gz" + sha256: "373e1e66a1c245817f0aa08ae8693b71d1703f9355d364e0d9d002929738ddcc" + # 4.0.5 is required by scnlib + "4.0.5": + url: "https://github.com/simdutf/simdutf/archive/v4.0.5.tar.gz" + sha256: "040d80ff4321f89ea9739ccc7f468ece9c4bc2630f3d4762b6d829000d2ec625" diff --git a/recipes/simdutf/all/conanfile.py b/recipes/simdutf/all/conanfile.py index 47c94ebd381ae..7f4c06e0624c0 100644 --- a/recipes/simdutf/all/conanfile.py +++ b/recipes/simdutf/all/conanfile.py @@ -1,12 +1,13 @@ from conan import ConanFile -from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import 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 -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class SimdutfConan(ConanFile): name = "simdutf" @@ -15,6 +16,7 @@ class SimdutfConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/simdutf/simdutf" topics = ("unicode", "transcoding", "neon", "simd", "avx2", "sse2", "utf8", "utf16", ) + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -26,48 +28,44 @@ class SimdutfConan(ConanFile): } @property - def _minimum_cpp_standard(self): + 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: - try: - del self.options.fPIC - except Exception: - pass + 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, self._minimum_cpp_standard) + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "9.0": + raise ConanInvalidConfiguration(f"{self.ref} doesn't support gcc < 9.") + if self.settings.compiler == "gcc" and self.settings.build_type == "Debug" and \ + Version(self.settings.compiler.version) < "10.0": + raise ConanInvalidConfiguration(f"{self.ref} doesn't support gcc < 10 with debug build") 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["SIMDUTF_BENCHMARKS"] = False - tc.variables["BUILD_TESTING"] = False + tc.variables["SIMDUTF_TESTS"] = 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.variables["SIMDUTF_TOOLS"] = False tc.generate() - deps = CMakeDeps(self) deps.generate() def build(self): - apply_conandata_patches(self) cmake = CMake(self) cmake.configure() cmake.build() @@ -77,6 +75,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.libs = ["simdutf"] diff --git a/recipes/simdutf/all/patches/1.0.1-0001-fix-cmake.patch b/recipes/simdutf/all/patches/1.0.1-0001-fix-cmake.patch deleted file mode 100644 index 7110c904b0efe..0000000000000 --- a/recipes/simdutf/all/patches/1.0.1-0001-fix-cmake.patch +++ /dev/null @@ -1,39 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index cb8fb1f..66f76ec 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -14,17 +14,17 @@ include(cmake/simdutf-flags.cmake) - - set(SIMDUTF_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) - --enable_testing() -+#enable_testing() - add_subdirectory(src) --add_subdirectory(tests) -+# add_subdirectory(tests) - - - --if(CMAKE_CXX_COMPILER_ID MATCHES GNU AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0) -- message(STATUS "The benchmark tool requires GCC 8.0 or better.") --else() -- add_subdirectory(benchmarks) --endif() -+#if(CMAKE_CXX_COMPILER_ID MATCHES GNU AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0) -+# message(STATUS "The benchmark tool requires GCC 8.0 or better.") -+#else() -+# add_subdirectory(benchmarks) -+#endif() - - - # ---- Install rules ---- -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/recipes/simdutf/all/patches/1.0.1-0002-remove-static.patch b/recipes/simdutf/all/patches/1.0.1-0002-remove-static.patch deleted file mode 100644 index cdc06b6c7fd09..0000000000000 --- a/recipes/simdutf/all/patches/1.0.1-0002-remove-static.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 4322f3f..476fd35 100644 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -3,7 +3,7 @@ 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.2-0001-fix-cmake.patch b/recipes/simdutf/all/patches/2.0.2-0001-fix-cmake.patch deleted file mode 100644 index 3721ff5c027be..0000000000000 --- a/recipes/simdutf/all/patches/2.0.2-0001-fix-cmake.patch +++ /dev/null @@ -1,55 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 3a41c60..9b66f11 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -34,11 +34,6 @@ else() - endif(BUILD_TESTING) - - --if(CMAKE_CXX_COMPILER_ID MATCHES GNU AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0) -- message(STATUS "The benchmark tool requires GCC 8.0 or better.") --else() -- add_subdirectory(tools) --endif() - - if (SIMDUTF_BENCHMARKS) - if((CMAKE_CXX_COMPILER_ID MATCHES GNU) AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "8.0")) -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,7 +3,7 @@ target_include_directories(simdutf-include-sourceâ–½g 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/tools/CMakeLists.txt b/tools/CMakeLists.txt -index 3af1e39..e1223c1 100644 ---- a/tools/CMakeLists.txt -+++ b/tools/CMakeLists.txt -@@ -17,11 +17,6 @@ else(Iconv_FOUND) - message(STATUS "Iconv was not found!") - endif(Iconv_FOUND) - --if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")) -- target_link_options(sutf PRIVATE "-static-libstdc++") -- target_link_options(sutf PRIVATE "-Wl,--gc-sections") -- endif() -- - set_property(TARGET sutf PROPERTY CXX_STANDARD 17) - set_property(TARGET sutf PROPERTY CXX_STANDARD_REQUIRED ON) - diff --git a/recipes/simdutf/all/patches/2.0.2-0002-add-workaround-gcc9.patch b/recipes/simdutf/all/patches/2.0.2-0002-add-workaround-gcc9.patch deleted file mode 100644 index 0ea0932649144..0000000000000 --- a/recipes/simdutf/all/patches/2.0.2-0002-add-workaround-gcc9.patch +++ /dev/null @@ -1,35 +0,0 @@ -diff --git a/src/icelake/icelake_utf8_common.inl.cpp b/src/icelake/icelake_utf8_common.inl.cpp -index 475fb0c..883547e 100644 ---- a/src/icelake/icelake_utf8_common.inl.cpp -+++ b/src/icelake/icelake_utf8_common.inl.cpp -@@ -439,12 +439,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 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 deleted file mode 100644 index 6bedd6c48eb5d..0000000000000 --- a/recipes/simdutf/all/patches/2.0.3-0001-fix-cmake.patch +++ /dev/null @@ -1,23 +0,0 @@ -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 deleted file mode 100644 index 957a9759ee2fa..0000000000000 --- a/recipes/simdutf/all/patches/2.0.6-0002-add-workaround-gcc9.patch +++ /dev/null @@ -1,42 +0,0 @@ -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/config.yml b/recipes/simdutf/config.yml index c018870b2e9a0..b6e34e53a5f9e 100644 --- a/recipes/simdutf/config.yml +++ b/recipes/simdutf/config.yml @@ -1,13 +1,21 @@ versions: - "2.0.9": + "5.6.3": folder: all - "2.0.8": + "5.6.2": folder: all - "2.0.6": + "5.6.0": folder: all - "2.0.3": + "5.5.0": folder: all - "2.0.2": + "5.4.15": folder: all - "1.0.1": + "5.3.7": + folder: all + "5.3.5": + folder: all + "5.3.2": + folder: all + "5.3.1": + folder: all + "4.0.5": folder: all diff --git a/recipes/simfil/all/conandata.yml b/recipes/simfil/all/conandata.yml new file mode 100644 index 0000000000000..ee332d47a6410 --- /dev/null +++ b/recipes/simfil/all/conandata.yml @@ -0,0 +1,25 @@ +sources: + "0.3.3": + url: "https://github.com/Klebert-Engineering/simfil/archive/refs/tags/v0.3.3.tar.gz" + sha256: "1e09c3785dc14e0a9a6c2c64962debd6ab1c7f7750a2de49dbb5dea18a461973" + "0.3.2": + url: "https://github.com/Klebert-Engineering/simfil/archive/refs/tags/v0.3.2.tar.gz" + sha256: "b8357db1d46058bb5b02eee4945801fc96cf06736c15195235a4b35da72e2ac2" + "0.3.1": + url: "https://github.com/Klebert-Engineering/simfil/archive/refs/tags/v0.3.1.tar.gz" + sha256: "caddee2e338041ae5ec56c6a92f14e79ee3d5a0f7eaf327d6b8418fe06dd484e" + "0.3.0": + url: "https://github.com/Klebert-Engineering/simfil/archive/refs/tags/v0.3.0.tar.gz" + sha256: "dea7b063f3f062772fcb49b368954814fc04d66c55db327a53ea008d698cd171" + "0.2.1": + url: "https://github.com/Klebert-Engineering/simfil/archive/refs/tags/v0.2.1.tar.gz" + sha256: "d3114900f121013cbffe42b0a70c66a47846c9326f6327d2ce0dd2e841919fd9" + "0.1.3": + url: "https://github.com/Klebert-Engineering/simfil/archive/refs/tags/v0.1.3.tar.gz" + sha256: "e42004b46118950e95b22430e4580fb89d1e6d2a1399e209d1aa4310944962e5" + "0.1.2": + url: "https://github.com/Klebert-Engineering/simfil/archive/refs/tags/v0.1.2.tar.gz" + sha256: "a903658ff37fa304dc6d8cb65e7923b6857b825ce2ac205522b84e4785d80e8d" + "0.1.1": + url: "https://github.com/Klebert-Engineering/simfil/archive/refs/tags/v0.1.1.tar.gz" + sha256: "e82a9d92ec65b7e27776d5507c78571cecc234f2b6fcdacc7ffcece6198f7f9a" diff --git a/recipes/simfil/all/conanfile.py b/recipes/simfil/all/conanfile.py new file mode 100644 index 0000000000000..55dad5c2c07b1 --- /dev/null +++ b/recipes/simfil/all/conanfile.py @@ -0,0 +1,106 @@ +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout +from conan.tools.files import copy, get +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration +import os + + +required_conan_version = ">=1.53.0" + + +class SimfilRecipe(ConanFile): + name = "simfil" + description = "simfil is a C++ 17 library and a language for querying structured map feature data. The library provides an efficient in-memory storage pool for map data, optimized for the simfil query language, along with a query interpreter to query the actual data." + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/Klebert-Engineering/simfil" + license = "BSD-3-Clause" + package_type = "library" + topics = ["query-language", "json", "data-model"] + + # Binary configuration + settings = "os", "compiler", "build_type", "arch" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_json": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_json": True, + } + + @property + def _minimum_compilers_version(self): + return { + "Visual Studio": "16", + "msvc": "192", + "gcc": "10", + "clang": "10", + "apple-clang": "14", + } + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def validate(self): + check_min_cppstd(self, 20) + + min_version = self._minimum_compilers_version.get(str(self.settings.compiler)) + if not min_version: + self.output.warning(f"{self.name} 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 Concepts support. The current compiler {self.settings.compiler} {self.settings.compiler.version} does not support it.") + + def build_requirements(self): + self.tool_requires("cmake/[>3.19 <4]") + + def requirements(self): + self.requires("sfl/1.2.4", transitive_headers=True) + self.requires("fmt/10.0.0", transitive_headers=True) + self.requires("bitsery/5.2.3", transitive_headers=True) + if self.options.with_json: + self.requires("nlohmann_json/3.11.2", transitive_headers=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): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["SIMFIL_CONAN"] = True + tc.cache_variables["SIMFIL_SHARED"] = self.options.get_safe("shared") + tc.cache_variables["SIMFIL_WITH_REPL"] = False + tc.cache_variables["SIMFIL_WITH_COVERAGE"] = False + tc.cache_variables["SIMFIL_WITH_TESTS"] = False + tc.cache_variables["SIMFIL_WITH_EXAMPLES"] = False + tc.cache_variables["SIMFIL_WITH_MODEL_JSON"] = self.options.with_json + tc.generate() + deps = CMakeDeps(self) + deps.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + cmake = CMake(self) + cmake.install() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + + def package_info(self): + self.cpp_info.libs = ["simfil"] + if self.options.with_json: + self.cpp_info.defines = ["SIMFIL_WITH_MODEL_JSON=1"] diff --git a/recipes/simfil/all/test_package/CMakeLists.txt b/recipes/simfil/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..33e4104ed085d --- /dev/null +++ b/recipes/simfil/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(PackageTest CXX) + +find_package(simfil CONFIG REQUIRED) + +add_executable(test_package src/example.cpp) +target_link_libraries(test_package simfil::simfil) +target_compile_features(test_package PRIVATE cxx_std_20) diff --git a/recipes/simfil/all/test_package/conanfile.py b/recipes/simfil/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0c831359c3d24 --- /dev/null +++ b/recipes/simfil/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_layout, CMake + +class SimfilTestPackageConanFile(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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/simfil/all/test_package/src/example.cpp b/recipes/simfil/all/test_package/src/example.cpp new file mode 100644 index 0000000000000..e263d12871d8b --- /dev/null +++ b/recipes/simfil/all/test_package/src/example.cpp @@ -0,0 +1,8 @@ +#include "simfil/value.h" + +int main() { + auto value = simfil::Value::make((int64_t)123); + (void)value; + + return 0; +} diff --git a/recipes/simfil/config.yml b/recipes/simfil/config.yml new file mode 100644 index 0000000000000..c35577e608344 --- /dev/null +++ b/recipes/simfil/config.yml @@ -0,0 +1,17 @@ +versions: + "0.3.3": + folder: all + "0.3.2": + folder: all + "0.3.1": + folder: all + "0.3.0": + folder: all + "0.2.1": + folder: all + "0.1.3": + folder: all + "0.1.2": + folder: all + "0.1.1": + folder: all diff --git a/recipes/simple-websocket-server/all/conanfile.py b/recipes/simple-websocket-server/all/conanfile.py index 7af11bfe301d4..c4f98b42cbc3d 100644 --- a/recipes/simple-websocket-server/all/conanfile.py +++ b/recipes/simple-websocket-server/all/conanfile.py @@ -1,65 +1,76 @@ 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 copy, get +from conan.tools.layout import basic_layout +from conan.tools.scm import Version + +required_conan_version = ">=1.52.0" class SimpleWebSocketServerConan(ConanFile): name = "simple-websocket-server" + description = ( + "A very simple, fast, multithreaded, platform independent WebSocket (WS) " + "and WebSocket Secure (WSS) server and client library." + ) + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" homepage = "https://gitlab.com/eidheim/Simple-WebSocket-Server" - description = "A very simple, fast, multithreaded, platform independent WebSocket (WS) and WebSocket Secure (WSS) server and client library." topics = ("websocket", "socket", "server", "client", "header-only") - url = "https://github.com/conan-io/conan-center-index" - settings = "os", "compiler", "arch", "build_type" + + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + options = {"use_asio_standalone": [True, False]} + default_options = {"use_asio_standalone": True} no_copy_source = True - license = "MIT" - options = { - "use_asio_standalone": [True, False], - } - default_options = { - "use_asio_standalone": True, - } - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - self.requires("openssl/1.1.1q") + self.requires("openssl/[>=1.1 <4]") # only version 2.0.2 upwards is able to build against asio 1.18.0 or higher - if tools.Version(self.version) <= "2.0.1": + if Version(self.version) <= "2.0.1": if self.options.use_asio_standalone: self.requires("asio/1.16.1") else: self.requires("boost/1.73.0") else: if self.options.use_asio_standalone: - self.requires("asio/1.23.0") + self.requires("asio/1.28.1") else: - self.requires("boost/1.79.0") + self.requires("boost/1.83.0") - def configure(self): - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, "11") + def package_id(self): + self.info.clear() - def build(self): - if tools.Version(self.version) <= "2.0.1" and "asio" in self.deps_cpp_info.deps and tools.Version(self.deps_cpp_info["asio"].version) >= "1.18.0": - raise ConanInvalidConfiguration("simple-websocket-server versions <=2.0.1 require asio < 1.18.0") - elif tools.Version(self.version) <= "2.0.1" and "boost" in self.deps_cpp_info.deps and tools.Version(self.deps_cpp_info["boost"].version) >= "1.74.0": - raise ConanInvalidConfiguration("simple-websocket-server versions <=2.0.1 require boost < 1.74.0") + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, 11) + if Version(self.version) <= "2.0.1": + if self.dependencies.get("asio"): + if Version(self.dependencies["asio"].ref.version) >= "1.18.0": + raise ConanInvalidConfiguration("simple-websocket-server versions <=2.0.1 require asio < 1.18.0") + elif self.dependencies.get("boost"): + if Version(self.dependencies["boost"].ref.version) >= "1.74.0": + raise ConanInvalidConfiguration("simple-websocket-server versions <=2.0.1 require boost < 1.74.0") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = "Simple-WebSocket-Server-v" + 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(pattern="*.hpp", dst=os.path.join("include", "simple-websocket-server"), src=self._source_subfolder) + copy(self, "LICENSE", + dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, "*.hpp", + dst=os.path.join(self.package_folder, "include", "simple-websocket-server"), + src=self.source_folder) def package_info(self): - if self.options.use_asio_standalone: - self.cpp_info.defines.append('USE_STANDALONE_ASIO') + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] - def package_id(self): - self.info.header_only() + if self.options.use_asio_standalone: + self.cpp_info.defines.append("USE_STANDALONE_ASIO") diff --git a/recipes/simple-websocket-server/all/test_package/CMakeLists.txt b/recipes/simple-websocket-server/all/test_package/CMakeLists.txt index d50531ac251fb..fc5fbf247dae0 100644 --- a/recipes/simple-websocket-server/all/test_package/CMakeLists.txt +++ b/recipes/simple-websocket-server/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 LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(simple-websocket-server REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE simple-websocket-server::simple-websocket-server) set_target_properties( ${PROJECT_NAME} PROPERTIES CXX_STANDARD 11 diff --git a/recipes/simple-websocket-server/all/test_package/conanfile.py b/recipes/simple-websocket-server/all/test_package/conanfile.py index bd7165a553cf4..fae501d0afb9e 100644 --- a/recipes/simple-websocket-server/all/test_package/conanfile.py +++ b/recipes/simple-websocket-server/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" + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/simple-websocket-server/all/test_v1_package/CMakeLists.txt b/recipes/simple-websocket-server/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/simple-websocket-server/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/simple-websocket-server/all/test_v1_package/conanfile.py b/recipes/simple-websocket-server/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..7e2dfe859bb27 --- /dev/null +++ b/recipes/simple-websocket-server/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/simple-yaml/all/conanfile.py b/recipes/simple-yaml/all/conanfile.py index fea9f3e7e071f..afb2abee08c4c 100644 --- a/recipes/simple-yaml/all/conanfile.py +++ b/recipes/simple-yaml/all/conanfile.py @@ -1,74 +1,88 @@ import os -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration -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.files import copy, get +from conan.tools.layout import basic_layout +from conan.tools.scm import Version + +required_conan_version = ">=1.52.0" class SimpleYamlConan(ConanFile): name = "simple-yaml" + description = "Read configuration files in YAML format by code structure" license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/Rechip/simple-yaml" - description = "Read configuration files in YAML format by code structure" - topics = ("cpp", "yaml", "configuration") - settings = ["compiler"] - no_copy_source = True + topics = ("cpp", "yaml", "configuration", "header-only") + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" options = { "enable_enum": [True, False], } default_options = { - "enable_enum": True + "enable_enum": True, } + 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) - - def requirements(self): - self.requires("pretty-name/1.0.0") - self.requires("yaml-cpp/0.7.0") - self.requires("source_location/0.2.0") - if self.options.enable_enum: - self.requires("magic_enum/0.7.3") - - def package(self): - self.copy(pattern="LICENSE", dst="licenses", - src=self._source_subfolder) - self.copy(pattern="*", dst="include", - src=os.path.join(self._source_subfolder, "include")) + def _min_cppstd(self): + return 20 @property def _minimum_compilers_version(self): return { - "Visual Studio": "16.3", "gcc": "10", "clang": "11", "apple-clang": "13.3", + "msvc": "193", + "Visual Studio": "16.3", } + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("pretty-name/1.0.0") + self.requires("yaml-cpp/0.8.0") + self.requires("source_location/0.2.1") + if self.options.enable_enum: + self.requires("magic_enum/0.9.3") + + def package_id(self): + self.info.clear() + def validate(self): if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, "20") - if self.settings.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") - minimum_version = self._minimum_compilers_version.get( - str(self.settings.compiler), False) - if not minimum_version: - self.output.warn( - "simple-yaml requires C++20. Your compiler is unknown. Assuming it fully supports C++20.") - elif tools.Version(self.settings.compiler.version) < minimum_version: + check_min_cppstd(self, self._min_cppstd) + if ( + self.settings.compiler == "clang" + and self.settings.compiler.libcxx in ["libstdc++", "libstdc++11"] + and self.settings.compiler.version == "11" + ): raise ConanInvalidConfiguration( - "simple-yaml requires C++20, which your compiler does not support.") + "clang 11 with libstdc++ is not supported due to old libstdc++ missing C++17 support" + ) + minimum_version = self._minimum_compilers_version.get(str(self.settings.compiler), False) + if not minimum_version: + self.output.warning("simple-yaml requires C++20. Your compiler is unknown. Assuming it fully supports C++20.") + elif Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration("simple-yaml requires C++20, which your compiler does not support.") - def package_id(self): - self.info.header_only() + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def package(self): + copy(self, "LICENSE", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder) + copy(self, "*", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include")) def package_info(self): - self.cpp_info.names["cmake_find_package"] = "simple-yaml" - self.cpp_info.names["cmake_find_package_multi"] = "simple-yaml" + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/simple-yaml/all/test_package/CMakeLists.txt b/recipes/simple-yaml/all/test_package/CMakeLists.txt index 506dba003a47f..08e8ff623e894 100644 --- a/recipes/simple-yaml/all/test_package/CMakeLists.txt +++ b/recipes/simple-yaml/all/test_package/CMakeLists.txt @@ -1,10 +1,8 @@ -cmake_minimum_required(VERSION 3.4) +cmake_minimum_required(VERSION 3.15) project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +find_package(simple-yaml REQUIRED CONFIG) -find_package(simple-yaml CONFIG REQUIRED) add_executable(${PROJECT_NAME} src/test.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE simple-yaml::simple-yaml) diff --git a/recipes/simple-yaml/all/test_package/conanfile.py b/recipes/simple-yaml/all/test_package/conanfile.py index cbe0be23191a2..fae501d0afb9e 100644 --- a/recipes/simple-yaml/all/test_package/conanfile.py +++ b/recipes/simple-yaml/all/test_package/conanfile.py @@ -1,17 +1,26 @@ +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", "arch", "build_type" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): - self.cmake = CMake(self) - self.cmake.configure() - self.cmake.build() + cmake = CMake(self) + cmake.configure() + cmake.build() 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/simple_enum/all/conandata.yml b/recipes/simple_enum/all/conandata.yml new file mode 100644 index 0000000000000..6c936b9324135 --- /dev/null +++ b/recipes/simple_enum/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.8.0": + url: "https://github.com/arturbac/simple_enum/archive/refs/tags/v0.8.0.tar.gz" + sha256: "b32e723ddb29b6cb2ab93f2376157ee6fd7a4f3c170edddb6a3fb7186068e6ee" diff --git a/recipes/simple_enum/all/conanfile.py b/recipes/simple_enum/all/conanfile.py new file mode 100644 index 0000000000000..6be80c9e19d4d --- /dev/null +++ b/recipes/simple_enum/all/conanfile.py @@ -0,0 +1,74 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, export_conandata_patches, get +from conan.tools.layout import basic_layout +from conan.tools.scm import Version +import os + +required_conan_version = ">=1.52.0" + +class SimpleEnumConan(ConanFile): + name = "simple_enum" + description = "An Fast, Intuitive and Type-Safe C++ Enumeration Support Library" + license = "BSL-1.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/arturbac/simple_enum" + topics = ("serialization", "type-safe", "header-only") + package_type = "header-library" + 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": "14", # apple-clang/13 doesn't support std::convertible_to + "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.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, "LICENSE", 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"), + ) + copy( + self, + "*.h", + os.path.join(self.source_folder, "include"), + os.path.join(self.package_folder, "include"), + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/simple_enum/all/test_package/CMakeLists.txt b/recipes/simple_enum/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..6835a49d78e83 --- /dev/null +++ b/recipes/simple_enum/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(simple_enum REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE simple_enum::simple_enum) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) diff --git a/recipes/simple_enum/all/test_package/conanfile.py b/recipes/simple_enum/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/simple_enum/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/simple_enum/all/test_package/test_package.cpp b/recipes/simple_enum/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..694699608c7ba --- /dev/null +++ b/recipes/simple_enum/all/test_package/test_package.cpp @@ -0,0 +1,8 @@ +#include + +int main() { + enum struct enum_bounded { v1 = 1, v2, v3, first = v1, last = v3 }; + static_assert(simple_enum::enum_name(enum_bounded::v2) == "v2"); + + return 0; +} diff --git a/recipes/simple_enum/config.yml b/recipes/simple_enum/config.yml new file mode 100644 index 0000000000000..675f954f2770e --- /dev/null +++ b/recipes/simple_enum/config.yml @@ -0,0 +1,3 @@ +versions: + "0.8.0": + folder: all diff --git a/recipes/sioclient/all/conandata.yml b/recipes/sioclient/all/conandata.yml new file mode 100644 index 0000000000000..ae83b98849ee1 --- /dev/null +++ b/recipes/sioclient/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "cci.20240405": + url: "https://github.com/socketio/socket.io-client-cpp/archive/c6be96b226f0fe3853beaeaa99c06834342a78db.zip" + sha256: "7c68117185dbc49579bba09a3e877f2a716cc331c28b3d8b6d3f867c4346b639" diff --git a/recipes/sioclient/all/conanfile.py b/recipes/sioclient/all/conanfile.py new file mode 100644 index 0000000000000..28f6a1a4ad91a --- /dev/null +++ b/recipes/sioclient/all/conanfile.py @@ -0,0 +1,112 @@ +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, cmake_layout +from conan.tools.env import VirtualBuildEnv +from conan.tools.microsoft import is_msvc +from conan.tools.files import copy, get, replace_in_file, rm, rmdir, save + +required_conan_version = ">=1.53.0" + + +class SioclientConan(ConanFile): + name = "sioclient" + description = "C++11 implementation of Socket.IO client" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/socketio/socket.io-client-cpp" + topics = ("websocket", "client") + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_openssl": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_openssl": 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") + if is_msvc(self): + self.options.rm_safe("shared") + self.package_type = "static-library" + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires("websocketpp/0.8.2") + self.requires("asio/1.30.2") + self.requires("rapidjson/cci.20230929") + if self.options.with_openssl: + self.requires("openssl/[>=1.1 <4]") + + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, 11) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["USE_SUBMODULES"] = False + tc.variables["BUILD_UNIT_TESTS"] = False + tc.variables["BUILD_TESTING"] = False + tc.generate() + + deps = CMakeDeps(self) + deps.generate() + + def _patch_sources(self): + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "asio asio::asio", "asio::asio") + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE", self.source_folder, 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", "sioclient") + + self.cpp_info.components["sioclient_"].set_property("cmake_target_name", "sioclient::sioclient") + self.cpp_info.components["sioclient_"].libs = ["sioclient"] + self.cpp_info.components["sioclient_"].requires = [ + "websocketpp::websocketpp", + "asio::asio", + "rapidjson::rapidjson", + ] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["sioclient_"].system_libs.extend(["m", "pthread"]) + + if self.options.with_openssl: + self.cpp_info.components["sioclient_tls"].set_property("cmake_target_name", "sioclient::sioclient_tls") + self.cpp_info.components["sioclient_tls"].libs = ["sioclient_tls"] + self.cpp_info.components["sioclient_tls"].requires = [ + "websocketpp::websocketpp", + "asio::asio", + "rapidjson::rapidjson", + "openssl::openssl", + ] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["sioclient_tls"].system_libs.extend(["m", "pthread"]) diff --git a/recipes/sioclient/all/test_package/CMakeLists.txt b/recipes/sioclient/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..4985d53cb13ca --- /dev/null +++ b/recipes/sioclient/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(sioclient REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE sioclient::sioclient) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/sioclient/all/test_package/conanfile.py b/recipes/sioclient/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/sioclient/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/sioclient/all/test_package/test_package.cpp b/recipes/sioclient/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..646e232b2bda0 --- /dev/null +++ b/recipes/sioclient/all/test_package/test_package.cpp @@ -0,0 +1,6 @@ +#include + +int main() { + sio::client h; + h.socket(); +} diff --git a/recipes/sioclient/config.yml b/recipes/sioclient/config.yml new file mode 100644 index 0000000000000..f1cb71fea7cad --- /dev/null +++ b/recipes/sioclient/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20240405": + folder: all diff --git a/recipes/sjson-cpp/all/conandata.yml b/recipes/sjson-cpp/all/conandata.yml index be9ad1f93084e..3e86876d293d0 100644 --- a/recipes/sjson-cpp/all/conandata.yml +++ b/recipes/sjson-cpp/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.9.0": + url: "https://github.com/nfrechette/sjson-cpp/archive/v0.9.0.tar.gz" + sha256: "61b8ea49acce6fa6c48db2c70a6fd7514e219c17b276bff2da3bfc510840320f" "0.8.3": url: "https://github.com/nfrechette/sjson-cpp/archive/v0.8.3.tar.gz" sha256: "3a6188bea5f00161a9e4508078f95637e303b3fce108c8dc9dc2a5b871d9e43d" diff --git a/recipes/sjson-cpp/all/conanfile.py b/recipes/sjson-cpp/all/conanfile.py index 98115a520a666..cf743b47f8442 100644 --- a/recipes/sjson-cpp/all/conanfile.py +++ b/recipes/sjson-cpp/all/conanfile.py @@ -1,34 +1,50 @@ -from conans import ConanFile, tools import os -required_conan_version = ">=1.33.0" +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 + +required_conan_version = ">=1.52.0" class SjsonCppConan(ConanFile): name = "sjson-cpp" description = "An Simplified JSON (SJSON) C++ reader and writer" - topics = ("json", "sjson", "simplified") license = "MIT" - homepage = "https://github.com/nfrechette/sjson-cpp" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/nfrechette/sjson-cpp" + topics = ("json", "sjson", "simplified", "header-only") + + package_type = "header-library" 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.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, 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 package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("*.h", dst="include", src=os.path.join(self._source_subfolder, "includes")) + copy(self, "LICENSE", + 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, "includes")) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/sjson-cpp/all/test_package/CMakeLists.txt b/recipes/sjson-cpp/all/test_package/CMakeLists.txt index f5f3393af5f9a..401e13d3abd40 100644 --- a/recipes/sjson-cpp/all/test_package/CMakeLists.txt +++ b/recipes/sjson-cpp/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) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) find_package(sjson-cpp REQUIRED CONFIG) diff --git a/recipes/sjson-cpp/all/test_package/conanfile.py b/recipes/sjson-cpp/all/test_package/conanfile.py index 38f4483872d47..fae501d0afb9e 100644 --- a/recipes/sjson-cpp/all/test_package/conanfile.py +++ b/recipes/sjson-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" + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/sjson-cpp/all/test_v1_package/CMakeLists.txt b/recipes/sjson-cpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/sjson-cpp/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/sjson-cpp/all/test_v1_package/conanfile.py b/recipes/sjson-cpp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/sjson-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/sjson-cpp/config.yml b/recipes/sjson-cpp/config.yml index a3d24ea0c5588..49ca784cf528f 100644 --- a/recipes/sjson-cpp/config.yml +++ b/recipes/sjson-cpp/config.yml @@ -1,4 +1,6 @@ versions: + "0.9.0": + folder: "all" "0.8.3": folder: "all" "0.8.2": diff --git a/recipes/skyr-url/all/CMakeLists.txt b/recipes/skyr-url/all/CMakeLists.txt deleted file mode 100644 index 16d33ed296f4b..0000000000000 --- a/recipes/skyr-url/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/skyr-url/all/conandata.yml b/recipes/skyr-url/all/conandata.yml index 25a1fe3b1c9e0..13a1cba86dd1e 100644 --- a/recipes/skyr-url/all/conandata.yml +++ b/recipes/skyr-url/all/conandata.yml @@ -5,11 +5,12 @@ sources: "1.12.0": url: "https://github.com/cpp-netlib/url/archive/v1.12.0.tar.gz" sha256: "42ede3666a4c40828aa74e4b35bf43dfc79de9329e6463ff90f9bb727b3a06f0" - patches: "1.13.0": - patch_file: "patches/1.13.0-0001-fix-cmake.patch" - base_path: "source_subfolder" + patch_description: "fix installer, fix range-v3 name" + patch_type: "conan" "1.12.0": - patch_file: "patches/1.12.0-0001-fix-cmake.patch" - base_path: "source_subfolder" + patch_description: "fix installer, fix range-v3 name" + patch_type: "conan" diff --git a/recipes/skyr-url/all/conanfile.py b/recipes/skyr-url/all/conanfile.py index d73a94e93ebb3..86286a2a911c0 100644 --- a/recipes/skyr-url/all/conanfile.py +++ b/recipes/skyr-url/all/conanfile.py @@ -1,10 +1,14 @@ -from conans import ConanFile, tools, CMake -from conans.errors import ConanInvalidConfiguration -from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +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, rm, rmdir, replace_in_file, 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 +from conan.tools.env import VirtualBuildEnv import os -import functools -required_conan_version = ">=1.45.0" +required_conan_version = ">=1.53.0" class SkyrUrlConan(ConanFile): name = "skyr-url" @@ -13,6 +17,7 @@ class SkyrUrlConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://cpp-netlib.github.io/url" topics = ("whatwg", "url", "parser") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -26,19 +31,9 @@ class SkyrUrlConan(ConanFile): "with_json": True, "with_fs": 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" - - @property - def _minimum_cpp_standard(self): + def _min_cppstd(self): return 17 @property @@ -46,15 +41,15 @@ def _minimum_compilers_version(self): # https://github.com/cpp-netlib/url/tree/v1.12.0#requirements return { "Visual Studio": "16", + "msvc": "192", "gcc": "7", - "clang": "6" if tools.Version(self.version) <= "1.12.0" else "8", + "clang": "6" if Version(self.version) <= "1.12.0" else "8", "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"]) + 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": @@ -62,72 +57,77 @@ 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("tl-expected/1.1.0", transitive_headers=True) + self.requires("range-v3/0.12.0", transitive_headers=True) + if self.options.with_json: + self.requires("nlohmann_json/3.11.3") 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 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++17 support. " + f"The current compiler {self.settings.compiler} {self.settings.compiler.version} does not support it.") if self.options.with_fs and self.settings.compiler == "apple-clang": raise ConanInvalidConfiguration("apple-clang currently does not support with filesystem") if self.settings.compiler.get_safe("libcxx") == "libstdc++": - raise ConanInvalidConfiguration("{} supports only libstdc++'s new ABI".format(self.name)) - - def requirements(self): - self.requires("tl-expected/1.0.0") - self.requires("range-v3/0.12.0") - if self.options.with_json: - self.requires("nlohmann_json/3.10.5") + raise ConanInvalidConfiguration(f"{self.ref} supports only libstdc++'s new ABI") 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["skyr_BUILD_TESTS"] = False - cmake.definitions["skyr_FULL_WARNINGS"] = False - cmake.definitions["skyr_WARNINGS_AS_ERRORS"] = False - cmake.definitions["skyr_ENABLE_JSON_FUNCTIONS"] = self.options.with_json - cmake.definitions["skyr_ENABLE_FILESYSTEM_FUNCTIONS"] = self.options.with_fs + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["skyr_BUILD_TESTS"] = False + tc.variables["skyr_FULL_WARNINGS"] = False + tc.variables["skyr_WARNINGS_AS_ERRORS"] = False + tc.variables["skyr_ENABLE_JSON_FUNCTIONS"] = self.options.with_json + tc.variables["skyr_ENABLE_FILESYSTEM_FUNCTIONS"] = self.options.with_fs + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True if is_msvc(self): - cmake.definitions["skyr_USE_STATIC_CRT"] = is_msvc_static_runtime(self) - cmake.configure(build_folder=self._build_subfolder) - return cmake + tc.variables["skyr_USE_STATIC_CRT"] = 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): - self.copy("LICENSE_1_0.txt", src=self._source_subfolder, dst="licenses") - 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, "share")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "skyr-url") self.cpp_info.set_property("cmake_target_name", "skyr::skyr-url") self.cpp_info.components["url"].name = "skyr-url" - self.cpp_info.components["url"].libs = tools.collect_libs(self) + self.cpp_info.components["url"].libs = ["skyr-urld" if self.settings.build_type == "Debug" else "skyr-url"] self.cpp_info.components["url"].requires = ["tl-expected::tl-expected", "range-v3::range-v3"] if self.options.with_json: self.cpp_info.components["url"].requires.append("nlohmann_json::nlohmann_json") if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["url"].system_libs.append("m") + # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.filenames["cmake_find_package"] = "skyr-url" self.cpp_info.filenames["cmake_find_package_multi"] = "skyr-url" self.cpp_info.names["cmake_find_package"] = "skyr" diff --git a/recipes/skyr-url/all/test_package/CMakeLists.txt b/recipes/skyr-url/all/test_package/CMakeLists.txt index 96bec18bacbdc..5ca2e760876e8 100644 --- a/recipes/skyr-url/all/test_package/CMakeLists.txt +++ b/recipes/skyr-url/all/test_package/CMakeLists.txt @@ -1,10 +1,8 @@ -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(skyr-url CONFIG REQUIRED) +find_package(skyr-url REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} skyr::skyr-url) diff --git a/recipes/skyr-url/all/test_package/conanfile.py b/recipes/skyr-url/all/test_package/conanfile.py index 5120e440ae5fb..f5cf204295e19 100644 --- a/recipes/skyr-url/all/test_package/conanfile.py +++ b/recipes/skyr-url/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 = "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 +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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/skyr-url/all/test_v1_package/CMakeLists.txt b/recipes/skyr-url/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..54d2c07bb9d41 --- /dev/null +++ b/recipes/skyr-url/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +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/skyr-url/all/test_v1_package/conanfile.py b/recipes/skyr-url/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/skyr-url/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/sleef/all/CMakeLists.txt b/recipes/sleef/all/CMakeLists.txt deleted file mode 100644 index bd3083b512cb9..0000000000000 --- a/recipes/sleef/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/sleef/all/conandata.yml b/recipes/sleef/all/conandata.yml index d1737a7a842cf..2cb4098c3fd69 100644 --- a/recipes/sleef/all/conandata.yml +++ b/recipes/sleef/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.6": + url: "https://github.com/shibatch/sleef/archive/3.6.tar.gz" + sha256: "de4f3d992cf2183a872cd397f517c1defcd3ee6cafa2ce5fa36963bd7e562446" "3.5.1": url: "https://github.com/shibatch/sleef/archive/3.5.1.tar.gz" sha256: "415ee9b1bcc5816989d3d4d92afd0cd3f9ee89cbd5a33eb008e69751e40438ab" diff --git a/recipes/sleef/all/conanfile.py b/recipes/sleef/all/conanfile.py index 0496b1b63c7cd..7cba3764e2337 100644 --- a/recipes/sleef/all/conanfile.py +++ b/recipes/sleef/all/conanfile.py @@ -1,19 +1,25 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration import os -required_conan_version = ">=1.32.0" +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.env import VirtualBuildEnv +from conan.tools.files import copy, get, rmdir +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" class SleefConan(ConanFile): name = "sleef" - description = "SLEEF is a library that implements vectorized versions " \ - "of C standard math functions." + description = "SLEEF is a library that implements vectorized versions of C standard math functions." license = "BSL-1.0" - topics = ("conan", "sleef", "vectorization", "simd") - homepage = "https://sleef.org" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://sleef.org" + topics = ("vectorization", "simd") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -24,75 +30,92 @@ class SleefConan(ConanFile): "fPIC": True, } - 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" - 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 validate(self): if self.settings.os == "Windows" and self.options.shared: - raise ConanInvalidConfiguration("shared sleef not supported on Windows, it produces runtime errors") + raise ConanInvalidConfiguration( + "shared sleef not supported on Windows, it produces runtime errors" + ) + if self.settings.compiler == "apple-clang": + if cross_building(self): + # Fails with "No rule to make target `/bin/mkrename'" + # https://github.com/shibatch/sleef/issues/308 + raise ConanInvalidConfiguration(f"{self.ref} does not support cross-building with apple-clang") + if Version(self.version) < "3.6" and self.settings.arch == "armv8": + # clang: error: the clang compiler does not support '-march=armv7-a' + # clang: warning: argument unused during compilation: '-mfpu=vfpv4' [-Wunused-command-line-argument] + # clang: warning: argument unused during compilation: '-arch arm64' [-Wunused-command-line-argument] + # clang: warning: argument unused during compilation: '-mmacosx-version-min=11.0' [-Wunused-command-line-argument] + raise ConanInvalidConfiguration(f"{self.ref} does not support Mac M1. Please, use {self.name} version >=3.6.") + + def build_requirements(self): + if Version(self.version) >= "3.6": + self.tool_requires("cmake/[>=3.18 <4]") 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["BUILD_STATIC_TEST_BINS"] = False - self._cmake.definitions["ENABLE_LTO"] = False - self._cmake.definitions["BUILD_LIBM"] = True - self._cmake.definitions["BUILD_DFT"] = False - self._cmake.definitions["BUILD_QUAD"] = False - self._cmake.definitions["BUILD_GNUABI_LIBS"] = False - self._cmake.definitions["BUILD_TESTS"] = False - self._cmake.definitions["BUILD_INLINE_HEADERS"] = False - self._cmake.definitions["SLEEF_TEST_ALL_IUT"] = False - self._cmake.definitions["SLEEF_SHOW_CONFIG"] = True - self._cmake.definitions["SLEEF_SHOW_ERROR_LOG"] = False - self._cmake.definitions["ENFORCE_TESTER"] = False - self._cmake.definitions["ENFORCE_TESTER3"] = False - self._cmake.definitions["ENABLE_ALTDIV"] = False - self._cmake.definitions["ENABLE_ALTSQRT"] = False - self._cmake.definitions["DISABLE_FFTW"] = 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): + VirtualBuildEnv(self).generate() + + tc = CMakeToolchain(self) + tc.cache_variables["BUILD_SHARED_LIBS"] = self.options.shared + if Version(self.version) >= "3.6": + tc.cache_variables["SLEEF_BUILD_STATIC_TEST_BINS"] = False + tc.cache_variables["SLEEF_BUILD_LIBM"] = True + tc.cache_variables["SLEEF_BUILD_DFT"] = False + tc.cache_variables["SLEEF_BUILD_QUAD"] = False + tc.cache_variables["SLEEF_BUILD_GNUABI_LIBS"] = False + tc.cache_variables["SLEEF_BUILD_SCALAR_LIB"] = False + tc.cache_variables["SLEEF_BUILD_TESTS"] = False + tc.cache_variables["SLEEF_BUILD_INLINE_HEADERS"] = False + tc.cache_variables["SLEEF_SHOW_CONFIG"] = True + tc.cache_variables["SLEEF_SHOW_ERROR_LOG"] = False + tc.cache_variables["SLEEF_ENABLE_ALTDIV"] = False + tc.cache_variables["SLEEF_ENABLE_ALTSQRT"] = False + tc.cache_variables["SLEEF_DISABLE_FFTW"] = True + tc.cache_variables["SLEEF_DISABLE_MPFR"] = True + tc.cache_variables["SLEEF_DISABLE_SSL"] = True + tc.cache_variables["SLEEF_ENABLE_CUDA"] = False + tc.cache_variables["SLEEF_ENABLE_CXX"] = False + else: + tc.cache_variables["BUILD_DFT"] = False + tc.cache_variables["BUILD_GNUABI_LIBS"] = False + tc.cache_variables["BUILD_TESTS"] = False + tc.cache_variables["DISABLE_FFTW"] = True + tc.generate() def build(self): - 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", + 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")) + 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, "dummy")) def package_info(self): - self.cpp_info.names["pkg_config"] = "sleef" + self.cpp_info.set_property("pkg_config_name", "sleef") self.cpp_info.libs = ["sleef"] if self.settings.os == "Windows" and not self.options.shared: self.cpp_info.defines = ["SLEEF_STATIC_LIBS"] - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["m"] diff --git a/recipes/sleef/all/test_package/CMakeLists.txt b/recipes/sleef/all/test_package/CMakeLists.txt index 7b9b613cbb24a..a5f1ed24ef5f7 100644 --- a/recipes/sleef/all/test_package/CMakeLists.txt +++ b/recipes/sleef/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ -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() +find_package(sleef REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE sleef::sleef) diff --git a/recipes/sleef/all/test_package/conanfile.py b/recipes/sleef/all/test_package/conanfile.py index 5216332f39f5c..ef5d7042163ec 100644 --- a/recipes/sleef/all/test_package/conanfile.py +++ b/recipes/sleef/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.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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/sleef/all/test_v1_package/CMakeLists.txt b/recipes/sleef/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/sleef/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/sleef/all/test_v1_package/conanfile.py b/recipes/sleef/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..a9f777f7680ff --- /dev/null +++ b/recipes/sleef/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.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/sleef/config.yml b/recipes/sleef/config.yml index 2276d8a2cd6a8..3c718426b97bd 100644 --- a/recipes/sleef/config.yml +++ b/recipes/sleef/config.yml @@ -1,3 +1,5 @@ versions: + "3.6": + folder: all "3.5.1": folder: all diff --git a/recipes/sml/all/conandata.yml b/recipes/sml/all/conandata.yml index cfb630a1d7b27..886d2f2728c4c 100644 --- a/recipes/sml/all/conandata.yml +++ b/recipes/sml/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "1.1.11": + url: "https://github.com/boost-ext/sml/archive/refs/tags/v1.1.11.tar.gz" + sha256: "8773efd639ce9649dc449135c8c53232e1cb5f4037d44be02c1b9ccc343f246d" + "1.1.9": + url: "https://github.com/boost-ext/sml/archive/refs/tags/v1.1.9.tar.gz" + sha256: "c5ebffcf791ca0b89fd49a410b720432de748a31b7e0c9e5bd5c567d11c8c477" + "1.1.8": + url: "https://github.com/boost-ext/sml/archive/refs/tags/v1.1.8.tar.gz" + sha256: "d2626b2fd249fa0788ca364a2f8dcb4762dd72195f86d43370e4cad4c02262c5" "1.1.6": url: "https://github.com/boost-ext/sml/archive/refs/tags/v1.1.6.tar.gz" sha256: "08a6d80eb9aa6ee4e462c1b802b9d7db8a39758746565f13cc4d2459ed49a29e" @@ -9,5 +18,10 @@ sources: url: "https://github.com/boost-ext/sml/archive/v1.1.4.tar.gz" sha256: "897c78077f5a4d22b0de253b8689a8ea6d8adfba8d7b4877d6f5c76277e00976" patches: + "1.1.8": + - patch_file: "patches/0001-arrow_up-1.1.8.patch" + patch_type: backport + patch_source: https://github.com/boost-ext/sml/commit/9d7cc3d43f1a619a84049d6786054f31d6d1ab86 + patch_description: Backport C++ compatibility fixes and release version bump. "1.1.4": - patch_file: "patches/0001-fix-clang12-error.patch" diff --git a/recipes/sml/all/conanfile.py b/recipes/sml/all/conanfile.py index ba7c5897722f0..f69ae30abf611 100644 --- a/recipes/sml/all/conanfile.py +++ b/recipes/sml/all/conanfile.py @@ -1,22 +1,23 @@ 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.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 SMLConan(ConanFile): name = "sml" homepage = "https://github.com/boost-ext/sml" description = "SML: C++14 State Machine Library" - topics = ("state-machine", "metaprogramming", "design-patterns", "sml") + topics = ("state-machine", "metaprogramming", "design-patterns") license = "BSL-1.0" url = "https://github.com/conan-io/conan-center-index" settings = "os", "arch", "compiler", "build_type" + package_type = "header-library" @property def _min_cppstd(self): @@ -33,8 +34,7 @@ def _minimum_compilers_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 layout(self): basic_layout(self, src_folder="src") @@ -44,7 +44,7 @@ def package_id(self): def validate(self): if self.settings.compiler.get_safe("cppstd"): - 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 minimum_version and Version(self.settings.compiler.version) < minimum_version: raise ConanInvalidConfiguration( diff --git a/recipes/sml/all/patches/0001-arrow_up-1.1.8.patch b/recipes/sml/all/patches/0001-arrow_up-1.1.8.patch new file mode 100644 index 0000000000000..b980c919a6312 --- /dev/null +++ b/recipes/sml/all/patches/0001-arrow_up-1.1.8.patch @@ -0,0 +1,68 @@ +From 9d7cc3d43f1a619a84049d6786054f31d6d1ab86 Mon Sep 17 00:00:00 2001 +From: Kris Jusiak +Date: Sun, 21 May 2023 10:55:42 -0500 +Subject: [PATCH] :arrow_up: 1.1.8 + +--- + CMakeLists.txt | 2 +- + Makefile | 2 +- + include/boost/sml.hpp | 6 +++--- + 3 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 12fa670..dee81c1 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -177,7 +177,7 @@ configure_package_config_file( + + write_basic_package_version_file( + ${CMAKE_CURRENT_BINARY_DIR}/smlConfigVersion.cmake +- VERSION 1.1.6 ++ VERSION 1.1.8 + COMPATIBILITY SameMajorVersion + ) + +diff --git a/Makefile b/Makefile +index b00c9ee..8046400 100644 +--- a/Makefile ++++ b/Makefile +@@ -26,7 +26,7 @@ DRMEMORY:=drmemory -light -batch -exit_code_if_errors 1 -- + GCOV:=-fprofile-arcs -ftest-coverage + CLANG_FORMAT?=clang-format + CLANG_TIDY?=clang-tidy +-PYTHON?=python2 ++PYTHON?=python3 + MKDOCS?=mkdocs + MKDOCS_THEME?=boost-modern + MKDOCS_SITE?=site +diff --git a/include/boost/sml.hpp b/include/boost/sml.hpp +index 8143249..2a5dac9 100644 +--- a/include/boost/sml.hpp ++++ b/include/boost/sml.hpp +@@ -9,12 +9,12 @@ + #if (__cplusplus < 201305L && _MSC_VER < 1900) + #error "[Boost::ext].SML requires C++14 support (Clang-3.4+, GCC-5.1+, MSVC-2015+)" + #else +-#define BOOST_SML_VERSION 1'1'6 ++#define BOOST_SML_VERSION 1'1'8 + #define BOOST_SML_NAMESPACE_BEGIN \ + namespace boost { \ + inline namespace ext { \ + namespace sml { \ +- inline namespace v1_1_6 { ++ inline namespace v1_1_8 { + #define BOOST_SML_NAMESPACE_END \ + } \ + } \ +@@ -422,7 +422,7 @@ struct pool : pool_type... { + template <> + struct pool<> { + using boost_di_inject__ = type_list<>; +- constexpr pool() = default; ++ pool() = default; + template + constexpr explicit pool(Ts &&...) {} + __BOOST_SML_ZERO_SIZE_ARRAY(byte); +-- +2.40.1 + diff --git a/recipes/sml/config.yml b/recipes/sml/config.yml index fa8612a6d0ffa..a97246e773800 100644 --- a/recipes/sml/config.yml +++ b/recipes/sml/config.yml @@ -1,4 +1,10 @@ versions: + "1.1.11": + folder: all + "1.1.9": + folder: all + "1.1.8": + folder: all "1.1.6": folder: all "1.1.5": diff --git a/recipes/snappy/all/conandata.yml b/recipes/snappy/all/conandata.yml index 6c12aed54a1a4..501018a1c4174 100644 --- a/recipes/snappy/all/conandata.yml +++ b/recipes/snappy/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "1.2.1": + url: "https://github.com/google/snappy/archive/1.2.1.tar.gz" + sha256: "736aeb64d86566d2236ddffa2865ee5d7a82d26c9016b36218fcc27ea4f09f86" + "1.2.0": + url: "https://github.com/google/snappy/archive/1.2.0.tar.gz" + sha256: "9b8f10fbb5e3bc112f2e5e64f813cb73faea42ec9c533a5023b5ae08aedef42e" + "1.1.10": + url: "https://github.com/google/snappy/archive/1.1.10.tar.gz" + sha256: "49d831bffcc5f3d01482340fe5af59852ca2fe76c3e05df0e67203ebbe0f1d90" "1.1.9": url: "https://github.com/google/snappy/archive/1.1.9.tar.gz" sha256: "75c1fbb3d618dd3a0483bff0e26d0a92b495bbe5059c8b4f1c962b478b6e06e7" @@ -9,8 +18,55 @@ sources: url: "https://github.com/google/snappy/archive/1.1.7.tar.gz" sha256: "3dfa02e873ff51a11ee02b9ca391807f0c8ea0529a4924afa645fbf97163f9d4" patches: + "1.2.1": + - patch_file: "patches/1.1.10-0001-fix-inlining-failure.patch" + patch_description: "disable inlining for compilation error" + patch_type: "portability" + - patch_file: "patches/1.1.9-0002-no-Werror.patch" + patch_description: "disable 'warning as error' options" + patch_type: "portability" + - patch_file: "patches/1.2.0-0003-fix-clobber-list-older-llvm.patch" + patch_description: "disable inline asm on apple-clang" + patch_type: "portability" + - patch_file: "patches/1.2.0-0004-rtti-by-default.patch" + patch_description: "remove 'disable rtti'" + patch_type: "conan" + "1.2.0": + - patch_file: "patches/1.1.10-0001-fix-inlining-failure.patch" + patch_description: "disable inlining for compilation error" + patch_type: "portability" + - patch_file: "patches/1.1.9-0002-no-Werror.patch" + patch_description: "disable 'warning as error' options" + patch_type: "portability" + - patch_file: "patches/1.2.0-0003-fix-clobber-list-older-llvm.patch" + patch_description: "disable inline asm on apple-clang" + patch_type: "portability" + - patch_file: "patches/1.2.0-0004-rtti-by-default.patch" + patch_description: "remove 'disable rtti'" + patch_type: "conan" + "1.1.10": + - patch_file: "patches/1.1.10-0001-fix-inlining-failure.patch" + patch_description: "disable inlining for compilation error" + patch_type: "portability" + - patch_file: "patches/1.1.9-0002-no-Werror.patch" + patch_description: "disable 'warning as error' options" + patch_type: "portability" + - patch_file: "patches/1.1.10-0003-fix-clobber-list-older-llvm.patch" + patch_description: "disable inline asm on apple-clang" + patch_type: "portability" + - patch_file: "patches/1.1.9-0004-rtti-by-default.patch" + patch_description: "remove 'disable rtti'" + patch_type: "conan" "1.1.9": - patch_file: "patches/1.1.9-0001-fix-inlining-failure.patch" + patch_description: "disable inlining for compilation error" + patch_type: "portability" - patch_file: "patches/1.1.9-0002-no-Werror.patch" + patch_description: "disable 'warning as error' options" + patch_type: "portability" - patch_file: "patches/1.1.9-0003-fix-clobber-list-older-llvm.patch" + patch_description: "disable inline asm on apple-clang" + patch_type: "portability" - patch_file: "patches/1.1.9-0004-rtti-by-default.patch" + patch_description: "remove 'disable rtti'" + patch_type: "conan" diff --git a/recipes/snappy/all/conanfile.py b/recipes/snappy/all/conanfile.py index e4b1a8a763fb0..d60c824527335 100644 --- a/recipes/snappy/all/conanfile.py +++ b/recipes/snappy/all/conanfile.py @@ -1,67 +1,77 @@ 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], "fPIC": [True, False], + "with_bmi2": [True, False, "auto"], + "with_ssse3": [True, False, "auto"], } default_options = { "shared": False, "fPIC": True, + "with_bmi2": "auto", + "with_ssse3": "auto", } 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 self.settings.arch not in ["x86", "x86_64"]: + del self.options.with_bmi2 + del self.options.with_ssse3 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["SNAPPY_BUILD_TESTS"] = False if Version(self.version) >= "1.1.8": tc.variables["SNAPPY_FUZZING_BUILD"] = False + # Don't use these avx options. These are useless. + # https://github.com/conan-io/conan-center-index/pull/16495 tc.variables["SNAPPY_REQUIRE_AVX"] = False tc.variables["SNAPPY_REQUIRE_AVX2"] = False 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" + if self.settings.arch in ["x86", "x86_64"]: + if self.options.with_bmi2 != "auto": + tc.variables["SNAPPY_HAVE_BMI2"] = self.options.with_bmi2 + if self.options.with_ssse3 != "auto": + tc.variables["SNAPPY_HAVE_SSSE3"] = self.options.with_ssse3 tc.generate() def build(self): @@ -82,7 +92,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/patches/1.1.10-0001-fix-inlining-failure.patch b/recipes/snappy/all/patches/1.1.10-0001-fix-inlining-failure.patch new file mode 100644 index 0000000000000..66b0f05521962 --- /dev/null +++ b/recipes/snappy/all/patches/1.1.10-0001-fix-inlining-failure.patch @@ -0,0 +1,13 @@ +diff --git a/snappy-stubs-internal.h b/snappy-stubs-internal.h +index 1548ed7..3b4a9f3 100644 +--- a/snappy-stubs-internal.h ++++ b/snappy-stubs-internal.h +@@ -100,7 +100,7 @@ + + // Inlining hints. + #if HAVE_ATTRIBUTE_ALWAYS_INLINE +-#define SNAPPY_ATTRIBUTE_ALWAYS_INLINE __attribute__((always_inline)) ++#define SNAPPY_ATTRIBUTE_ALWAYS_INLINE + #else + #define SNAPPY_ATTRIBUTE_ALWAYS_INLINE + #endif // HAVE_ATTRIBUTE_ALWAYS_INLINE diff --git a/recipes/snappy/all/patches/1.1.10-0003-fix-clobber-list-older-llvm.patch b/recipes/snappy/all/patches/1.1.10-0003-fix-clobber-list-older-llvm.patch new file mode 100644 index 0000000000000..969ce3805dadf --- /dev/null +++ b/recipes/snappy/all/patches/1.1.10-0003-fix-clobber-list-older-llvm.patch @@ -0,0 +1,13 @@ +diff --git a/snappy.cc b/snappy.cc +index d414718..e4efb59 100644 +--- a/snappy.cc ++++ b/snappy.cc +@@ -1132,7 +1132,7 @@ inline size_t AdvanceToNextTagX86Optimized(const uint8_t** ip_p, size_t* tag) { + size_t literal_len = *tag >> 2; + size_t tag_type = *tag; + bool is_literal; +-#if defined(__GCC_ASM_FLAG_OUTPUTS__) && defined(__x86_64__) ++#if defined(__GCC_ASM_FLAG_OUTPUTS__) && defined(__x86_64__) && ( (!defined(__clang__) && !defined(__APPLE__)) || (!defined(__APPLE__) && defined(__clang__) && (__clang_major__ >= 9)) || (defined(__APPLE__) && defined(__clang__) && (__clang_major__ > 11)) ) + // TODO clang misses the fact that the (c & 3) already correctly + // sets the zero flag. + asm("and $3, %k[tag_type]\n\t" diff --git a/recipes/snappy/all/patches/1.2.0-0003-fix-clobber-list-older-llvm.patch b/recipes/snappy/all/patches/1.2.0-0003-fix-clobber-list-older-llvm.patch new file mode 100644 index 0000000000000..05accb60abfba --- /dev/null +++ b/recipes/snappy/all/patches/1.2.0-0003-fix-clobber-list-older-llvm.patch @@ -0,0 +1,13 @@ +diff --git a/snappy.cc b/snappy.cc +index 08c2a98..151de55 100644 +--- a/snappy.cc ++++ b/snappy.cc +@@ -1311,7 +1311,7 @@ inline size_t AdvanceToNextTagX86Optimized(const uint8_t** ip_p, size_t* tag) { + size_t literal_len = *tag >> 2; + size_t tag_type = *tag; + bool is_literal; +-#if defined(__GCC_ASM_FLAG_OUTPUTS__) && defined(__x86_64__) ++#if defined(__GCC_ASM_FLAG_OUTPUTS__) && defined(__x86_64__) && ( (!defined(__clang__) && !defined(__APPLE__)) || (!defined(__APPLE__) && defined(__clang__) && (__clang_major__ >= 9)) || (defined(__APPLE__) && defined(__clang__) && (__clang_major__ > 11)) ) + // TODO clang misses the fact that the (c & 3) already correctly + // sets the zero flag. + asm("and $3, %k[tag_type]\n\t" diff --git a/recipes/snappy/all/patches/1.2.0-0004-rtti-by-default.patch b/recipes/snappy/all/patches/1.2.0-0004-rtti-by-default.patch new file mode 100644 index 0000000000000..7ca0e721fadea --- /dev/null +++ b/recipes/snappy/all/patches/1.2.0-0004-rtti-by-default.patch @@ -0,0 +1,26 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 01eb2d7..fb4e6bf 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -53,8 +53,8 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + add_definitions(-D_HAS_EXCEPTIONS=0) + + # Disable RTTI. +- string(REGEX REPLACE "/GR" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GR-") ++# string(REGEX REPLACE "/GR" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") ++# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GR-") + else(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + # Use -Wall for clang and gcc. + if(NOT CMAKE_CXX_FLAGS MATCHES "-Wall") +@@ -83,8 +83,8 @@ endif() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions") + + # Disable RTTI. +- string(REGEX REPLACE "-frtti" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti") ++# string(REGEX REPLACE "-frtti" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") ++# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti") + endif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + + # BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to make 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/snappy/config.yml b/recipes/snappy/config.yml index da7c72c3a201a..4059143be6e19 100644 --- a/recipes/snappy/config.yml +++ b/recipes/snappy/config.yml @@ -1,4 +1,10 @@ versions: + "1.2.1": + folder: all + "1.2.0": + folder: all + "1.1.10": + folder: all "1.1.9": folder: all "1.1.8": diff --git a/recipes/snitch/all/conandata.yml b/recipes/snitch/all/conandata.yml new file mode 100644 index 0000000000000..c99303582e711 --- /dev/null +++ b/recipes/snitch/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "1.2.3": + url: "https://github.com/snitch-org/snitch/archive/refs/tags/v1.2.3.zip" + sha256: "f2649e716b612f3dbb5f109b7250be80e2d7e43c7827034a270bd1ca91eafb12" + "1.2.2": + url: "https://github.com/snitch-org/snitch/archive/refs/tags/v1.2.2.zip" + sha256: "01eefb4a5368974cbfc14fbae93a5ccdd1f9d7f63d102784f914083b79d264a0" diff --git a/recipes/snitch/all/conanfile.py b/recipes/snitch/all/conanfile.py new file mode 100644 index 0000000000000..a4bcbd5587b10 --- /dev/null +++ b/recipes/snitch/all/conanfile.py @@ -0,0 +1,199 @@ +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.scm import Version +import os + +required_conan_version = ">=1.53.0" + + +class SnitchConan(ConanFile): + name = "snitch" + description = "Lightweight C++20 testing framework" + topics = ("snitch", "unit-test") + license = "BSL-1.0" + homepage = "https://github.com/snitch-org/snitch" + 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], + "header_only": [True, False], + "with_main": [True, False], + "with_exceptions": [True, False], + "with_timings": [True, False], + "with_shorthand_macros": [True, False], + "with_default_color": [True, False], + "with_success_decompose": [True, False], + "with_reporters": [None, "ANY"], + "max_test_cases": ["ANY"], # integer + "max_nested_sections": ["ANY"], # integer + "max_expr_length": ["ANY"], # integer + "max_message_length": ["ANY"], # integer + "max_test_name_length": ["ANY"], # integer + "max_tag_length": ["ANY"], # integer + "max_captures": ["ANY"], # integer + "max_capture_length": ["ANY"], # integer + "max_unique_tags": ["ANY"], # integer + "max_command_line_args": ["ANY"], # integer + "max_registered_reporters": ["ANY"], # integer + "max_path_length": ["ANY"] # integer + } + default_options = { + "shared": False, + "fPIC": True, + "header_only": False, + "with_main": True, + "with_exceptions": True, + "with_timings": True, + "with_shorthand_macros": True, + "with_default_color": True, + "with_success_decompose": False, + "with_reporters": "all", + "max_test_cases": 5000, + "max_nested_sections": 8, + "max_expr_length": 1024, + "max_message_length": 1024, + "max_test_name_length": 1024, + "max_tag_length": 256, + "max_captures": 8, + "max_capture_length": 256, + "max_unique_tags": 1024, + "max_command_line_args": 1024, + "max_registered_reporters": 8, + "max_path_length": 1024 + } + + @property + def _min_cppstd(self): + return "20" + + @property + def _compilers_minimum_version(self): + return { + "gcc": "10", + "Visual Studio": "17", + "msvc": "193", + "clang": "10", + "apple-clang": "10", + } + + @property + def _available_reporters(self): + return ["xml", "teamcity"] + + def config_options(self): + if self.settings.os == "Windows": + # Position-independent code is irrelevant on Windows; this is UNIX only. + del self.options.fPIC + + def configure(self): + if self.options.shared or self.options.header_only: + # Position-independent code is only relevant for static builds. + self.options.rm_safe("fPIC") + + if self.options.header_only: + # Shared vs static is irrelevant in header-only mode, so should be removed. + del self.options.shared + + def package_id(self): + if self.info.options.header_only: + # In header-only mode, the OS, architecture, and compiler don't matter. + # However do not clear options; they influence the content of the header file. + self.info.settings.clear() + + 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 doesn't support") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + + # Basic configuration + tc.cache_variables["SNITCH_DO_TEST"] = False + tc.cache_variables["SNITCH_UNITY_BUILD"] = True + + # Library format + tc.cache_variables["SNITCH_HEADER_ONLY"] = self.options.header_only + + # Feature toggles + tc.cache_variables["SNITCH_DEFINE_MAIN"] = self.options.with_main + tc.cache_variables["SNITCH_WITH_EXCEPTIONS"] = self.options.with_exceptions + tc.cache_variables["SNITCH_WITH_TIMINGS"] = self.options.with_timings + tc.cache_variables["SNITCH_WITH_SHORTHAND_MACROS"] = self.options.with_shorthand_macros + tc.cache_variables["SNITCH_DEFAULT_WITH_COLOR"] = self.options.with_default_color + tc.cache_variables["SNITCH_DECOMPOSE_SUCCESSFUL_ASSERTIONS"] = self.options.with_success_decompose + + for reporter in str(self.options.with_reporters).split(','): + reporter = reporter.strip() + if reporter == "all": + tc.cache_variables["SNITCH_WITH_ALL_REPORTERS"] = True + break + elif reporter in self._available_reporters: + tc.cache_variables["SNITCH_WITH_ALL_REPORTERS"] = False + tc.cache_variables[f"SNITCH_WITH_{reporter.upper()}_REPORTER"] = True + else: + raise ConanInvalidConfiguration(f"unknown reporter '{reporter}'") + + # Configurable limits + tc.cache_variables["SNITCH_MAX_TEST_CASES"] = str(self.options.max_test_cases) + tc.cache_variables["SNITCH_MAX_NESTED_SECTIONS"] = str(self.options.max_nested_sections) + tc.cache_variables["SNITCH_MAX_EXPR_LENGTH"] = str(self.options.max_expr_length) + tc.cache_variables["SNITCH_MAX_MESSAGE_LENGTH"] = str(self.options.max_message_length) + tc.cache_variables["SNITCH_MAX_TEST_NAME_LENGTH"] = str(self.options.max_test_name_length) + tc.cache_variables["SNITCH_MAX_TAG_LENGTH"] = str(self.options.max_tag_length) + tc.cache_variables["SNITCH_MAX_CAPTURES"] = str(self.options.max_captures) + tc.cache_variables["SNITCH_MAX_CAPTURE_LENGTH"] = str(self.options.max_capture_length) + tc.cache_variables["SNITCH_MAX_UNIQUE_TAGS"] = str(self.options.max_unique_tags) + tc.cache_variables["SNITCH_MAX_COMMAND_LINE_ARGS"] = str(self.options.max_command_line_args) + tc.cache_variables["SNITCH_MAX_REGISTERED_REPORTERS"] = str(self.options.max_registered_reporters) + tc.cache_variables["SNITCH_MAX_PATH_LENGTH"] = str(self.options.max_path_length) + + 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): + target = "snitch-header-only" if self.options.header_only else "snitch" + + self.cpp_info.set_property("cmake_file_name", "snitch") + self.cpp_info.set_property("cmake_target_name", f"snitch::{target}") + self.cpp_info.set_property("pkg_config_name", "snitch") + + if self.options.header_only: + self.cpp_info.components["_snitch"].bindirs = [] + self.cpp_info.components["_snitch"].libdirs = [] + else: + self.cpp_info.components["_snitch"].libs = ['snitch'] + 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.names["cmake_find_package"] = "snitch" + self.cpp_info.names["cmake_find_package_multi"] = "snitch" + self.cpp_info.names["pkg_config"] = "snitch" + self.cpp_info.components["_snitch"].names["cmake_find_package"] = target + self.cpp_info.components["_snitch"].names["cmake_find_package_multi"] = target + self.cpp_info.components["_snitch"].set_property("cmake_target_name", f"snitch::{target}") diff --git a/recipes/snitch/all/test_package/100-standalone.cpp b/recipes/snitch/all/test_package/100-standalone.cpp new file mode 100644 index 0000000000000..a3fbd51a23a25 --- /dev/null +++ b/recipes/snitch/all/test_package/100-standalone.cpp @@ -0,0 +1,11 @@ +#if defined(HEADER_ONLY) +# define SNITCH_IMPLEMENTATION +# include +#else +# include +# include +#endif + +SNITCH_TEST_CASE("compiles and runs") { + SNITCH_REQUIRE(true == !false); +} diff --git a/recipes/snitch/all/test_package/200-standalone-with-shorthand.cpp b/recipes/snitch/all/test_package/200-standalone-with-shorthand.cpp new file mode 100644 index 0000000000000..bfdc6f47fe273 --- /dev/null +++ b/recipes/snitch/all/test_package/200-standalone-with-shorthand.cpp @@ -0,0 +1,11 @@ +#if defined(HEADER_ONLY) +# define SNITCH_IMPLEMENTATION +# include +#else +# include +# include +#endif + +TEST_CASE("compiles and runs") { + REQUIRE(true == !false); +} diff --git a/recipes/snitch/all/test_package/CMakeLists.txt b/recipes/snitch/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..19d7688a6e4c0 --- /dev/null +++ b/recipes/snitch/all/test_package/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(snitch REQUIRED CONFIG) + +if (WITH_SHORTHAND) + add_executable(standalone 200-standalone-with-shorthand.cpp) +else() + add_executable(standalone 100-standalone.cpp) +endif() + +if (HEADER_ONLY) + target_compile_definitions(standalone PRIVATE HEADER_ONLY) + target_link_libraries(standalone PRIVATE snitch::snitch-header-only) +else() + target_link_libraries(standalone PRIVATE snitch::snitch) +endif() + +target_compile_features(standalone PRIVATE cxx_std_20) diff --git a/recipes/snitch/all/test_package/conanfile.py b/recipes/snitch/all/test_package/conanfile.py new file mode 100644 index 0000000000000..21081577ec035 --- /dev/null +++ b/recipes/snitch/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["WITH_SHORTHAND"] = self.dependencies[self.tested_reference_str].options.with_shorthand_macros + tc.variables["HEADER_ONLY"] = self.dependencies[self.tested_reference_str].options.header_only + tc.generate() + + 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], "standalone"), env="conanrun") diff --git a/recipes/snitch/all/test_v1_package/CMakeLists.txt b/recipes/snitch/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/snitch/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/snitch/all/test_v1_package/conanfile.py b/recipes/snitch/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..c8d1d20a4e7d2 --- /dev/null +++ b/recipes/snitch/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["WITH_SHORTHAND"] = self.options["snitch"].with_shorthand_macros + cmake.definitions["HEADER_ONLY"] = self.options["snitch"].header_only + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + self.run(os.path.join("bin", "standalone"), run_environment=True) diff --git a/recipes/snitch/config.yml b/recipes/snitch/config.yml new file mode 100644 index 0000000000000..6d9f399765e2d --- /dev/null +++ b/recipes/snitch/config.yml @@ -0,0 +1,5 @@ +versions: + "1.2.3": + folder: all + "1.2.2": + folder: all diff --git a/recipes/snowhouse/all/conanfile.py b/recipes/snowhouse/all/conanfile.py index 8bca8ddf11dc6..ec6ca8d607092 100644 --- a/recipes/snowhouse/all/conanfile.py +++ b/recipes/snowhouse/all/conanfile.py @@ -1,28 +1,50 @@ -from conans import ConanFile, tools import os -required_conan_version = ">=1.33.0" +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 + +required_conan_version = ">=1.52.0" class SnowHouseConan(ConanFile): name = "snowhouse" description = "An assertion library for C++" - topics = ("assertion", "header-only") + license = "BSL-1.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/banditcpp/snowhouse" - license = "BSL-1.0" + topics = ("assertion", "header-only") + + package_type = "header-library" + 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_1_0.txt", dst="licenses", src=self._source_subfolder) - self.copy(pattern="*", dst="include", src=os.path.join(self._source_subfolder, "include")) + copy(self, "LICENSE_1_0.txt", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder) + copy(self, "*", + 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/snowhouse/all/test_package/CMakeLists.txt b/recipes/snowhouse/all/test_package/CMakeLists.txt index 33ae887aa6aea..2fd896601b32f 100644 --- a/recipes/snowhouse/all/test_package/CMakeLists.txt +++ b/recipes/snowhouse/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -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() +find_package(snowhouse REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE snowhouse::snowhouse) set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) diff --git a/recipes/snowhouse/all/test_package/conanfile.py b/recipes/snowhouse/all/test_package/conanfile.py index d4128b0450777..fae501d0afb9e 100644 --- a/recipes/snowhouse/all/test_package/conanfile.py +++ b/recipes/snowhouse/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" + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/snowhouse/all/test_v1_package/CMakeLists.txt b/recipes/snowhouse/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/snowhouse/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/snowhouse/all/test_v1_package/conanfile.py b/recipes/snowhouse/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..49a3a66ea5bad --- /dev/null +++ b/recipes/snowhouse/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/so5extra/all/conandata.yml b/recipes/so5extra/all/conandata.yml index 18c9023e61809..3b66eb81644a0 100644 --- a/recipes/so5extra/all/conandata.yml +++ b/recipes/so5extra/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "1.6.1": + url: "https://github.com/Stiffstream/so5extra/archive/v.1.6.1.tar.gz" + sha256: "03934e0e59c7b73d33b671910976ea01e8704472f39e485df88ddc3b6e5f8c83" + "1.6.0": + url: "https://github.com/Stiffstream/so5extra/archive/v.1.6.0.tar.gz" + sha256: "224a156a840d707138189da5ebe78d87814832252f90673db631e93e0171433f" "1.5.2": url: "https://github.com/Stiffstream/so5extra/archive/v.1.5.2.tar.gz" sha256: "5409dc255c970d2085381ceded122b80b9ac896a34bafc5ffc431bae304d485d" diff --git a/recipes/so5extra/all/conanfile.py b/recipes/so5extra/all/conanfile.py index 080aef9395558..d9201d13883b2 100644 --- a/recipes/so5extra/all/conanfile.py +++ b/recipes/so5extra/all/conanfile.py @@ -1,63 +1,93 @@ -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.52.0" class So5extraConan(ConanFile): name = "so5extra" + description = "A collection of various SObjectizer's extensions." license = "BSD-3-Clause" - homepage = "https://github.com/Stiffstream/so5extra" url = "https://github.com/conan-io/conan-center-index" - description = "A collection of various SObjectizer's extensions." - topics = ("concurrency", "actor-framework", "actors", "agents", "sobjectizer") + homepage = "https://github.com/Stiffstream/so5extra" + topics = ("concurrency", "actor-framework", "actors", "agents", "sobjectizer", "header-only") + + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 17 - def requirements(self): - self.requires("sobjectizer/5.7.4") - - def validate(self): - minimal_cpp_standard = "17" - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, minimal_cpp_standard) - minimal_version = { + @property + def _compilers_minimum_version(self): + if self.version >= Version("1.6.0"): + # Since v1.6.0 requirements to compilers were updated: + return { + "gcc": "10", + "clang": "11", + "apple-clang": "13", + "Visual Studio": "17", + "msvc": "192" + } + return { "gcc": "7", "clang": "6", "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 - 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 requirements(self): + if self.version >= Version("1.6.0"): + self.requires("sobjectizer/5.8.1") + else: + self.requires("sobjectizer/5.7.4") 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) + compiler = str(self.settings.compiler) + if compiler not in self._compilers_minimum_version: + 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++{self._min_cppstd}") + return + version = Version(self.settings.compiler.version) + if version < self._compilers_minimum_version[compiler]: + raise ConanInvalidConfiguration(f"{self.name} requires a compiler that supports at least C++{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 package(self): - self.copy("*.hpp", dst="include/so_5_extra", src=os.path.join(self._source_subfolder, "dev", "so_5_extra")) - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + copy(self, "*.hpp", + dst=os.path.join(self.package_folder, "include/so_5_extra"), + src=os.path.join(self.source_folder, "dev", "so_5_extra")) + copy(self, "LICENSE", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder) def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.set_property("cmake_file_name", "so5extra") self.cpp_info.set_property("cmake_target_name", "sobjectizer::so5extra") + self.cpp_info.components["so_5_extra"].set_property("cmake_target_name", "sobjectizer::so5extra") + self.cpp_info.components["so_5_extra"].requires = ["sobjectizer::sobjectizer"] # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.filenames["cmake_find_package"] = "so5extra" @@ -66,5 +96,3 @@ def package_info(self): self.cpp_info.names["cmake_find_package_multi"] = "sobjectizer" self.cpp_info.components["so_5_extra"].names["cmake_find_package"] = "so5extra" self.cpp_info.components["so_5_extra"].names["cmake_find_package_multi"] = "so5extra" - self.cpp_info.components["so_5_extra"].set_property("cmake_target_name", "sobjectizer::so5extra") - self.cpp_info.components["so_5_extra"].requires = ["sobjectizer::sobjectizer"] diff --git a/recipes/so5extra/all/test_package/CMakeLists.txt b/recipes/so5extra/all/test_package/CMakeLists.txt index 933e0f59b04bd..6797a4d254c0a 100644 --- a/recipes/so5extra/all/test_package/CMakeLists.txt +++ b/recipes/so5extra/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(so5extra REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/so5extra/all/test_package/conanfile.py b/recipes/so5extra/all/test_package/conanfile.py index 38f4483872d47..ef5d7042163ec 100644 --- a/recipes/so5extra/all/test_package/conanfile.py +++ b/recipes/so5extra/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/so5extra/all/test_v1_package/CMakeLists.txt b/recipes/so5extra/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/so5extra/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/so5extra/all/test_v1_package/conanfile.py b/recipes/so5extra/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/so5extra/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/so5extra/config.yml b/recipes/so5extra/config.yml index f77c4a7405ffe..424326d97fc77 100644 --- a/recipes/so5extra/config.yml +++ b/recipes/so5extra/config.yml @@ -1,4 +1,8 @@ versions: + "1.6.1": + folder: all + "1.6.0": + folder: all "1.5.2": folder: all "1.5.1": diff --git a/recipes/sobjectizer/all/CMakeLists.txt b/recipes/sobjectizer/all/CMakeLists.txt deleted file mode 100644 index 20ac539cce862..0000000000000 --- a/recipes/sobjectizer/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.8) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory(source_subfolder/dev/so_5) diff --git a/recipes/sobjectizer/all/conandata.yml b/recipes/sobjectizer/all/conandata.yml index edb04804cef50..e7e112967920a 100644 --- a/recipes/sobjectizer/all/conandata.yml +++ b/recipes/sobjectizer/all/conandata.yml @@ -1,29 +1,13 @@ sources: - "5.7.2.2": - url: "https://github.com/Stiffstream/sobjectizer/archive/v.5.7.2.2.tar.gz" - sha256: "85f6cdd10bc4b05b8e7eeff7cd6eb76cc0338810114ba6d517163f143676054f" - "5.7.2.3": - url: "https://github.com/Stiffstream/sobjectizer/archive/v.5.7.2.3.tar.gz" - sha256: "3dd3936fdd5443056fb0698477ad2b299c11b90ff6f551fa2dfb031a17930ee2" - "5.7.2.4": - url: "https://github.com/Stiffstream/sobjectizer/archive/v.5.7.2.4.tar.gz" - sha256: "1ab370e430a1621c7f3ec8a530c3933efed1c5718953fbea214c1694fecc7128" - "5.7.2.5": - url: "https://github.com/Stiffstream/sobjectizer/archive/v.5.7.2.5.tar.gz" - sha256: "0bf87f9a4ec631b2dd53033cbb9a8b84a09a8e499f4edf6504121c6a7d1ef459" - "5.7.2.6": - url: "https://github.com/Stiffstream/sobjectizer/archive/v.5.7.2.6.tar.gz" - sha256: "62f1cfca8181bd60af2fb31b295471d0494b7ba72ab23e5a749bd70c9aa9e7b2" - "5.7.3": - url: "https://github.com/Stiffstream/sobjectizer/archive/v.5.7.3.tar.gz" - sha256: "15ddaa69861e2853fb8888faf70766e7c56c3cf66a6293f72848e0909875a4c3" "5.7.4": url: "https://github.com/Stiffstream/sobjectizer/archive/v.5.7.4.tar.gz" sha256: "f032d071579d80fb423171d411ae0e33af0da46776ca0db7eb1d933c69fb0726" - - "5.7.4.1": - url: "https://github.com/Stiffstream/sobjectizer/archive/v.5.7.4.1.tar.gz" - sha256: "9f5fb9d0be46d427be17f1c47cfa3d332dfe40877d1f9fafd38bcc05c46ff013" - "5.7.4.2": - url: "https://github.com/Stiffstream/sobjectizer/archive/v.5.7.4.2.tar.gz" - sha256: "defaec29e135a21b1b279b1db8eb56993099a7368baae93e7ea1f3f79909f3d8" + "5.7.5": + url: "https://github.com/Stiffstream/sobjectizer/archive/v.5.7.5.tar.gz" + sha256: "282b7c72f6a6ee30b9c08b5339c3e327452903e1b246a163a7c8e57b3e37932f" + "5.8.1": + url: "https://github.com/Stiffstream/sobjectizer/archive/v.5.8.1.tar.gz" + sha256: "2d6a1d57ecb1263d00460fd2dbf386e7323ab8643d10667d1646c3bbc91ef764" + "5.8.3": + url: "https://github.com/Stiffstream/sobjectizer/archive/v.5.8.3.tar.gz" + sha256: "c76661771c7a0a272ff2cefc62cf3100e9530ec670f225c0e11c6bfa2cc6974e" diff --git a/recipes/sobjectizer/all/conanfile.py b/recipes/sobjectizer/all/conanfile.py index 6ebed35c1f830..6dfd80e4c926f 100644 --- a/recipes/sobjectizer/all/conanfile.py +++ b/recipes/sobjectizer/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, CMakeDeps, cmake_layout +from conan.tools.files import get, copy, rmdir, collect_libs +from conan.tools.scm import Version import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class SobjectizerConan(ConanFile): @@ -27,80 +31,85 @@ class SobjectizerConan(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 configure(self): if self.options.shared: - del self.options.fPIC - - def validate(self): - minimal_cpp_standard = "17" - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, minimal_cpp_standard) - minimal_version = { + self.options.rm_safe("fPIC") + + def _compiler_support_lut(self): + if self.version >= Version("5.8.0"): + # Since v5.8.0 requirements to compilers were updated: + return { + "gcc": "10", + "clang": "11", + "apple-clang": "13", + "Visual Studio": "17", + "msvc": "192" + } + + return { "gcc": "7", "clang": "6", "apple-clang": "10", - "Visual Studio": "15" + "Visual Studio": "15", + "msvc": "191" } + + def validate(self): + minimal_cpp_standard = "17" + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, minimal_cpp_standard) + minimal_version = self._compiler_support_lut() + compiler = str(self.settings.compiler) if compiler not in minimal_version: - self.output.warn( + self.output.warning( "%s recipe lacks information about the %s compiler standard version support" % (self.name, compiler)) - self.output.warn( + self.output.warning( "%s requires a compiler that supports at least C++%s" % (self.name, minimal_cpp_standard)) return - version = tools.Version(self.settings.compiler.version) + version = 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 + def generate(self): + tc = CMakeToolchain(self) + tc.variables["SOBJECTIZER_BUILD_SHARED"] = self.options.shared + tc.variables["SOBJECTIZER_BUILD_STATIC"] = not self.options.shared + tc.variables["SOBJECTIZER_INSTALL"] = True + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0091"] = "NEW" + tc.generate() - self._cmake = CMake(self) - self._cmake.definitions["SOBJECTIZER_BUILD_SHARED"] = self.options.shared - self._cmake.definitions["SOBJECTIZER_BUILD_STATIC"] = not self.options.shared - self._cmake.definitions["SOBJECTIZER_INSTALL"] = True + cmake_deps = CMakeDeps(self) + cmake_deps.generate() - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def layout(self): + cmake_layout(self, src_folder="src") def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, "dev", "so_5")) 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], strip_root=True) 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", 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): cmake_target = "SharedLib" if self.options.shared else "StaticLib" self.cpp_info.set_property("cmake_file_name", "sobjectizer") self.cpp_info.set_property("cmake_target_name", "sobjectizer::{}".format(cmake_target)) # TODO: back to global scope in conan v2 once cmake_find_package* generators removed - self.cpp_info.components["_sobjectizer"].libs = tools.collect_libs(self) + self.cpp_info.components["_sobjectizer"].libs = collect_libs(self) if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["_sobjectizer"].system_libs = ["pthread", "m"] if not self.options.shared: diff --git a/recipes/sobjectizer/all/test_package/CMakeLists.txt b/recipes/sobjectizer/all/test_package/CMakeLists.txt index 9a72279fda74f..38c12b1dc72ca 100644 --- a/recipes/sobjectizer/all/test_package/CMakeLists.txt +++ b/recipes/sobjectizer/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(sobjectizer REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/sobjectizer/all/test_package/conanfile.py b/recipes/sobjectizer/all/test_package/conanfile.py index 38f4483872d47..a9fb96656f203 100644 --- a/recipes/sobjectizer/all/test_package/conanfile.py +++ b/recipes/sobjectizer/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/sobjectizer/all/test_v1_package/CMakeLists.txt b/recipes/sobjectizer/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..c960a336839f6 --- /dev/null +++ b/recipes/sobjectizer/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(sobjectizer REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +if(TARGET sobjectizer::SharedLib) + target_link_libraries(${PROJECT_NAME} sobjectizer::SharedLib) +else() + target_link_libraries(${PROJECT_NAME} sobjectizer::StaticLib) +endif() diff --git a/recipes/sobjectizer/all/test_v1_package/conanfile.py b/recipes/sobjectizer/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..9b63bd176646b --- /dev/null +++ b/recipes/sobjectizer/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/sobjectizer/config.yml b/recipes/sobjectizer/config.yml index 9bfbd2833f9cd..0ebef8a63c5ee 100644 --- a/recipes/sobjectizer/config.yml +++ b/recipes/sobjectizer/config.yml @@ -1,19 +1,9 @@ versions: - "5.7.2.2": + "5.7.4": # Used in so5extra folder: all - "5.7.2.3": + "5.7.5": folder: all - "5.7.2.4": + "5.8.1": # Used in so5extra folder: all - "5.7.2.5": - folder: all - "5.7.2.6": - folder: all - "5.7.3": - folder: all - "5.7.4": - folder: all - "5.7.4.1": - folder: all - "5.7.4.2": + "5.8.3": folder: all diff --git a/recipes/soci/all/CMakeLists.txt b/recipes/soci/all/CMakeLists.txt deleted file mode 100644 index 9079100af539d..0000000000000 --- a/recipes/soci/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/soci/all/conandata.yml b/recipes/soci/all/conandata.yml index f28c4f0941684..fec95012281aa 100644 --- a/recipes/soci/all/conandata.yml +++ b/recipes/soci/all/conandata.yml @@ -2,13 +2,8 @@ sources: "4.0.3": url: "https://github.com/SOCI/soci/archive/v4.0.3.tar.gz" sha256: "4b1ff9c8545c5d802fbe06ee6cd2886630e5c03bf740e269bb625b45cf934928" - "4.0.2": - url: "https://github.com/SOCI/soci/archive/v4.0.2.tar.gz" - sha256: "f293192a412ed82693d17dfe46e2734b140bff835bc3259e3cbd7c315e5e2d74" - "4.0.1": - url: "https://github.com/SOCI/soci/archive/4.0.1.tar.gz" - sha256: "fa69347b1a1ef74450c0382b665a67bd6777cc7005bbe09726479625bcf1e29c" patches: - "4.0.2": - - patch_file: "patches/0001-handle-libmysqlclient8.patch" - base_path: "source_subfolder" + "4.0.3": + - patch_file: "patches/0001-Remove-hardcoded-INSTALL_NAME_DIR-for-relocatable-li.patch" + patch_description: "Generate relocatable libraries on MacOS" + patch_type: "portability" diff --git a/recipes/soci/all/conanfile.py b/recipes/soci/all/conanfile.py index dcf4cd5ecdfb6..1f10648c31235 100644 --- a/recipes/soci/all/conanfile.py +++ b/recipes/soci/all/conanfile.py @@ -1,9 +1,13 @@ -from conan.tools.files import rename -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, 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 +from conan.errors import ConanInvalidConfiguration import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.55.0" class SociConan(ConanFile): @@ -42,41 +46,31 @@ class SociConan(ConanFile): "with_boost": False, } - 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 layout(self): + cmake_layout(self, src_folder="src") 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_sqlite3: - self.requires("sqlite3/3.38.0") + self.requires("sqlite3/3.44.2") 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_mysql: - self.requires("libmysqlclient/8.0.25") + self.requires("libmysqlclient/8.1.0") if self.options.with_postgresql: - self.requires("libpq/13.4") + self.requires("libpq/15.4") if self.options.with_boost: - self.requires("boost/1.78.0") + self.requires("boost/1.83.0") @property def _minimum_compilers_version(self): @@ -89,12 +83,12 @@ def _minimum_compilers_version(self): def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) + check_min_cppstd(self, 11) compiler = str(self.settings.compiler) - compiler_version = tools.Version(self.settings.compiler.version.value) + compiler_version = Version(self.settings.compiler.version.value) if compiler not in self._minimum_compilers_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)) elif compiler_version < self._minimum_compilers_version[compiler]: raise ConanInvalidConfiguration("{} requires a {} version >= {}".format(self.name, compiler, compiler_version)) @@ -111,84 +105,54 @@ def validate(self): raise ConanInvalidConfiguration("{} firebird {} ".format(prefix, message)) 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) - cmakelists = os.path.join(self._source_subfolder, "CMakeLists.txt") - tools.replace_in_file(cmakelists, - "set(CMAKE_MODULE_PATH ${SOCI_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})", - "list(APPEND CMAKE_MODULE_PATH ${SOCI_SOURCE_DIR}/cmake)") - tools.replace_in_file(cmakelists, - "set(CMAKE_MODULE_PATH ${SOCI_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH})", - "list(APPEND CMAKE_MODULE_PATH ${SOCI_SOURCE_DIR}/cmake/modules)") - - # Remove hardcoded install_name_dir, it prevents relocatable shared lib on macOS - soci_backend_cmake = os.path.join(self._source_subfolder, "cmake", "SociBackend.cmake") - soci_core_cmake = os.path.join(self._source_subfolder, "src", "core", "CMakeLists.txt") - tools.replace_in_file(soci_backend_cmake, "INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/lib", "") - tools.replace_in_file(soci_core_cmake, "INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/lib", "") - - def _configure_cmake(self): - if self._cmake: - return self._cmake - - self._cmake = CMake(self) - - self._cmake.definitions["SOCI_SHARED"] = self.options.shared - self._cmake.definitions["SOCI_TESTS"] = False - self._cmake.definitions["SOCI_CXX11"] = True - - if self.options.shared: - self._cmake.definitions["SOCI_STATIC"] = False - - self._cmake.definitions["SOCI_EMPTY"] = self.options.empty - self._cmake.definitions["WITH_SQLITE3"] = self.options.with_sqlite3 - self._cmake.definitions["WITH_DB2"] = self.options.with_db2 - self._cmake.definitions["WITH_ODBC"] = self.options.with_odbc - self._cmake.definitions["WITH_ORACLE"] = self.options.with_oracle - self._cmake.definitions["WITH_FIREBIRD"] = self.options.with_firebird - self._cmake.definitions["WITH_MYSQL"] = self.options.with_mysql - self._cmake.definitions["WITH_POSTGRESQL"] = self.options.with_postgresql - self._cmake.definitions["WITH_BOOST"] = self.options.with_boost - - # Relocatable shared lib on macOS - self._cmake.definitions["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" - - self._cmake.configure() - - return self._cmake + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + + # MacOS @rpath + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" + tc.variables["SOCI_SHARED"] = self.options.shared + tc.variables["SOCI_STATIC"] = not self.options.shared + tc.variables["SOCI_TESTS"] = False + tc.variables["SOCI_CXX11"] = True + tc.variables["SOCI_EMPTY"] = self.options.empty + tc.variables["WITH_SQLITE3"] = self.options.with_sqlite3 + tc.variables["WITH_DB2"] = self.options.with_db2 + tc.variables["WITH_ODBC"] = self.options.with_odbc + tc.variables["WITH_ORACLE"] = self.options.with_oracle + tc.variables["WITH_FIREBIRD"] = self.options.with_firebird + tc.variables["WITH_MYSQL"] = self.options.with_mysql + tc.variables["WITH_POSTGRESQL"] = self.options.with_postgresql + tc.variables["WITH_BOOST"] = self.options.with_boost + tc.generate() + + deps = CMakeDeps(self) + deps.set_property("mysql", "cmake_file_name", "MYSQL") + deps.set_property("libpq", "cmake_file_name", "POSTGRESQL") + deps.set_property("sqlite3", "cmake_file_name", "SQLITE3") + 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_1_0.txt", dst="licenses", src=self._source_subfolder) + copy(self, "LICENSE_1_0.txt", 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, "cmake")) - - if os.path.isdir(os.path.join(self.package_folder, "lib64")): - if os.path.isdir(os.path.join(self.package_folder, "lib")): - self.copy("*", dst="lib", src="lib64", keep_path=False, symlinks=True) - tools.rmdir(os.path.join(self.package_folder, "lib64")) - else: - rename(self, os.path.join(self.package_folder, "lib64"), os.path.join(self.package_folder, "lib")) - os.remove(os.path.join(self.package_folder, "include", "soci", "soci-config.h.in")) - 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", "SOCI") target_suffix = "" if self.options.shared else "_static" - lib_prefix = "lib" if self._is_msvc and not self.options.shared else "" - version = tools.Version(self.version) + lib_prefix = "lib" if is_msvc(self) and not self.options.shared else "" + version = Version(self.version) lib_suffix = "_{}_{}".format(version.major, version.minor) if self.settings.os == "Windows" else "" # soci_core diff --git a/recipes/soci/all/patches/0001-Remove-hardcoded-INSTALL_NAME_DIR-for-relocatable-li.patch b/recipes/soci/all/patches/0001-Remove-hardcoded-INSTALL_NAME_DIR-for-relocatable-li.patch new file mode 100644 index 0000000000000..5de0027f7500e --- /dev/null +++ b/recipes/soci/all/patches/0001-Remove-hardcoded-INSTALL_NAME_DIR-for-relocatable-li.patch @@ -0,0 +1,39 @@ +From d491bf7b5040d314ffd0c6310ba01f78ff44c85e Mon Sep 17 00:00:00 2001 +From: Rasmus Thomsen +Date: Fri, 14 Apr 2023 09:16:29 +0200 +Subject: [PATCH] Remove hardcoded INSTALL_NAME_DIR for relocatable libraries + on MacOS + +--- + cmake/SociBackend.cmake | 2 +- + src/core/CMakeLists.txt | 1 - + 2 files changed, 1 insertion(+), 2 deletions(-) + +diff --git a/cmake/SociBackend.cmake b/cmake/SociBackend.cmake +index 5d4ef0df..39fe1f77 100644 +--- a/cmake/SociBackend.cmake ++++ b/cmake/SociBackend.cmake +@@ -171,7 +171,7 @@ macro(soci_backend NAME) + set_target_properties(${THIS_BACKEND_TARGET} + PROPERTIES + SOVERSION ${${PROJECT_NAME}_SOVERSION} +- INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/lib) ++ ) + + if(APPLE) + set_target_properties(${THIS_BACKEND_TARGET} +diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt +index 3e7deeae..f9eae564 100644 +--- a/src/core/CMakeLists.txt ++++ b/src/core/CMakeLists.txt +@@ -59,7 +59,6 @@ if (SOCI_SHARED) + PROPERTIES + VERSION ${SOCI_VERSION} + SOVERSION ${SOCI_SOVERSION} +- INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/lib + CLEAN_DIRECT_OUTPUT 1) + endif() + +-- +2.25.1 + diff --git a/recipes/soci/all/patches/0001-handle-libmysqlclient8.patch b/recipes/soci/all/patches/0001-handle-libmysqlclient8.patch deleted file mode 100644 index 67b492e4ec099..0000000000000 --- a/recipes/soci/all/patches/0001-handle-libmysqlclient8.patch +++ /dev/null @@ -1,17 +0,0 @@ -From https://github.com/SOCI/soci/commit/7c431d9f073dec786fede7a78d6ff4ed44bbdb92 - ---- a/src/backends/mysql/session.cpp -+++ b/src/backends/mysql/session.cpp -@@ -355,7 +355,11 @@ mysql_session_backend::mysql_session_backend( - } - if (reconnect_p) - { -- my_bool reconnect = 1; -+#if MYSQL_VERSION_ID < 8 -+ my_bool reconnect = 1; -+#else -+ bool reconnect = 1; -+#endif - if (0 != mysql_options(conn_, MYSQL_OPT_RECONNECT, &reconnect)) - { - clean_up(); diff --git a/recipes/soci/all/test_package/CMakeLists.txt b/recipes/soci/all/test_package/CMakeLists.txt index b2d9b8214b5b3..070af95d1baf0 100644 --- a/recipes/soci/all/test_package/CMakeLists.txt +++ b/recipes/soci/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(SOCI REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/soci/all/test_package/conanfile.py b/recipes/soci/all/test_package/conanfile.py index 38f4483872d47..84eaa369e4a72 100644 --- a/recipes/soci/all/test_package/conanfile.py +++ b/recipes/soci/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" + 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 can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/soci/all/test_v1_package/CMakeLists.txt b/recipes/soci/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/soci/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/soci/all/test_v1_package/conanfile.py b/recipes/soci/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/soci/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/soci/config.yml b/recipes/soci/config.yml index 434258b9cffeb..404a7ddf18bdf 100644 --- a/recipes/soci/config.yml +++ b/recipes/soci/config.yml @@ -1,7 +1,3 @@ versions: "4.0.3": folder: all - "4.0.2": - folder: all - "4.0.1": - folder: all diff --git a/recipes/sofa/all/conandata.yml b/recipes/sofa/all/conandata.yml index 7a99aaa5b5893..d4de8c6bcf502 100644 --- a/recipes/sofa/all/conandata.yml +++ b/recipes/sofa/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "20231011": + url: "http://www.iausofa.org/2023_1011_C/sofa_c-20231011.tar.gz" + sha256: "d9c10833cae8b4d9361a0ffda31ec361fd1262362025bec4d4e51a880150ace2" "20210512": url: "http://www.iausofa.org/2021_0512_C/sofa_c-20210512.tar.gz" sha256: "3362baba47ce965af1fc6a3141052a0e1f643d186e8deca83df1ea97455bb2fd" 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/sofa/config.yml b/recipes/sofa/config.yml index de0c26b7bcf2a..a6912b42b0a98 100644 --- a/recipes/sofa/config.yml +++ b/recipes/sofa/config.yml @@ -1,4 +1,6 @@ versions: + "20231011": + folder: all "20210512": folder: all "20210125_a": diff --git a/recipes/sokol/all/conandata.yml b/recipes/sokol/all/conandata.yml index 28862f2194627..dd1a5b6930328 100644 --- a/recipes/sokol/all/conandata.yml +++ b/recipes/sokol/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "cci.20230925": + url: "https://github.com/floooh/sokol/archive/5633a0f91bf3354320837ce0c7b4748a953a1401.zip" + sha256: 9c854bc7e6f73024a99554e8e1c8850fddfc325bb2b1ece2c59502c0e3cef68d "cci.20210304": url: "https://github.com/floooh/sokol/archive/c5d55faa1036af9919bd28400e97d37548bb3789.zip" sha256: e61c782e287543ffb8077ac24a7bfee05e867ee27f6c3e9487a2dbfa1ca2b466 diff --git a/recipes/sokol/config.yml b/recipes/sokol/config.yml index 25320f6c19961..d5b10b1bcb9c1 100644 --- a/recipes/sokol/config.yml +++ b/recipes/sokol/config.yml @@ -1,3 +1,5 @@ versions: + "cci.20230925": + folder: "all" "cci.20210304": folder: "all" 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..f83f4a6a36735 --- /dev/null +++ b/recipes/sol2/all/conandata.yml @@ -0,0 +1,16 @@ +sources: + "3.3.1": + url: "https://github.com/ThePhD/sol2/archive/v3.3.1.tar.gz" + sha256: "ad121461047d52b449aa84234a6b578fa3ed95d67d1a0703902eba72417f61bb" + "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..4ebb24964da6a --- /dev/null +++ b/recipes/sol2/all/conanfile.py @@ -0,0 +1,118 @@ +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", "header-only") + package_type = "header-library" + 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.6") + 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..d6be5bd0bfdf0 100644 --- a/recipes/sol2/config.yml +++ b/recipes/sol2/config.yml @@ -1,15 +1,11 @@ versions: + "3.3.1": + folder: "all" "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/conanfile.py b/recipes/sole/all/conanfile.py index e15d1c06c6dc1..ac242d0a91892 100644 --- a/recipes/sole/all/conanfile.py +++ b/recipes/sole/all/conanfile.py @@ -14,6 +14,7 @@ class SoleConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/r-lyeh-archived/sole" topics = ("uuid", "header-only") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" def export_sources(self): @@ -30,19 +31,14 @@ def validate(self): 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 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=self.source_folder, - ) + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + copy(self, "*.hpp", self.source_folder, os.path.join(self.package_folder, "include")) def package_info(self): self.cpp_info.bindirs = [] diff --git a/recipes/sole/all/test_package/CMakeLists.txt b/recipes/sole/all/test_package/CMakeLists.txt index 829b5ca81b9ce..a08164097e4da 100644 --- a/recipes/sole/all/test_package/CMakeLists.txt +++ b/recipes/sole/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -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() +find_package(sole 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 sole::sole) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/sole/all/test_package/conanfile.py b/recipes/sole/all/test_package/conanfile.py index bd7165a553cf4..ef5d7042163ec 100644 --- a/recipes/sole/all/test_package/conanfile.py +++ b/recipes/sole/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/sonic-cpp/all/conandata.yml b/recipes/sonic-cpp/all/conandata.yml new file mode 100644 index 0000000000000..1b94133aa026e --- /dev/null +++ b/recipes/sonic-cpp/all/conandata.yml @@ -0,0 +1,16 @@ +sources: + "1.0.1": + url: "https://github.com/bytedance/sonic-cpp/archive/refs/tags/v1.0.1.tar.gz" + sha256: "c78fb90c56ba235e8867888c0b1af0e96d7b0b86829381b3cca94f61f83d41e5" + "1.0.0": + url: "https://github.com/bytedance/sonic-cpp/archive/refs/tags/v1.0.0.tar.gz" + sha256: "78af626fa070a2702fe9586d90617292b421d97d7ab1fe27a02cc20434467a80" +patches: + "1.0.1": + - patch_file: "patches/1.0.0-0001-use-cci.patch" + patch_description: "use cci recipes" + patch_type: "conan" + "1.0.0": + - patch_file: "patches/1.0.0-0001-use-cci.patch" + patch_description: "use cci recipes" + patch_type: "conan" diff --git a/recipes/sonic-cpp/all/conanfile.py b/recipes/sonic-cpp/all/conanfile.py new file mode 100644 index 0000000000000..533e9e8146a77 --- /dev/null +++ b/recipes/sonic-cpp/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.files import apply_conandata_patches, export_conandata_patches, get, copy +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.53.0" + + +class SonicCppConan(ConanFile): + name = "sonic-cpp" + description = "A fast JSON serializing & deserializing library, accelerated by SIMD." + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/bytedance/sonic-cpp" + topics = ("json", "parser", "writer", "serializer", "deserializer", "header-only") + package_type = "header-library" + 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") + + @property + def _compilers_minimum_version(self): + return { + "gcc": "8", + "clang": "7", + "apple-clang": "12", + } + + def requirements(self): + cppstd = self.settings.get_safe("compiler.cppstd") + # Assume we would need it if not told otherwise + if not cppstd or cppstd < "17": + self.requires("string-view-lite/1.7.0") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + + supported_archs = ["x86", "x86_64"] + if Version(self.version) >= "1.0.1": + supported_archs.extend(["armv8", "armv8.3"]) + if self.settings.arch not in supported_archs: + raise ConanInvalidConfiguration(f"{self.ref} doesn't support {self.settings.arch}.") + + if is_msvc(self): + raise ConanInvalidConfiguration(f"{self.ref} doesn't support MSVC now.") + + 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="*.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 = [] + + if self.settings.compiler in ["gcc", "clang", "apple-clang"]: + self.cpp_info.cxxflags.extend(["-mavx2", "-mpclmul"]) diff --git a/recipes/sonic-cpp/all/patches/1.0.0-0001-use-cci.patch b/recipes/sonic-cpp/all/patches/1.0.0-0001-use-cci.patch new file mode 100644 index 0000000000000..340323cf63a9a --- /dev/null +++ b/recipes/sonic-cpp/all/patches/1.0.0-0001-use-cci.patch @@ -0,0 +1,13 @@ +diff --git a/include/sonic/string_view.h b/include/sonic/string_view.h +index 67dfe2f..1fb2379 100644 +--- a/include/sonic/string_view.h ++++ b/include/sonic/string_view.h +@@ -21,7 +21,7 @@ namespace sonic_json { + using StringView = std::string_view; + } // namespace sonic_json + #else +-#include "thirdparty/string-view-lite/string_view.h" ++#include "nonstd/string_view.hpp" + namespace sonic_json { + using StringView = nonstd::string_view; + } // namespace sonic_json diff --git a/recipes/sonic-cpp/all/test_package/CMakeLists.txt b/recipes/sonic-cpp/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..2af5927a3f12f --- /dev/null +++ b/recipes/sonic-cpp/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(sonic-cpp REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE sonic-cpp::sonic-cpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/sonic-cpp/all/test_package/conanfile.py b/recipes/sonic-cpp/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fb96656f203 --- /dev/null +++ b/recipes/sonic-cpp/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/sonic-cpp/all/test_package/test_package.cpp b/recipes/sonic-cpp/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..384ea13453551 --- /dev/null +++ b/recipes/sonic-cpp/all/test_package/test_package.cpp @@ -0,0 +1,23 @@ +#include "sonic/sonic.h" + +#include +#include + +int main() +{ + std::string json = R"( + { + "a": 1, + "b": 2 + } + )"; + + sonic_json::Document doc; + doc.Parse(json); + if (doc.HasParseError()) { + std::cout << "Parse failed!\n"; + } else { + std::cout << "Parse successful!\n"; + } + return 0; +} diff --git a/recipes/sonic-cpp/all/test_v1_package/CMakeLists.txt b/recipes/sonic-cpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..be00a8c7f57c7 --- /dev/null +++ b/recipes/sonic-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/sonic-cpp/all/test_v1_package/conanfile.py b/recipes/sonic-cpp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/sonic-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/sonic-cpp/config.yml b/recipes/sonic-cpp/config.yml new file mode 100644 index 0000000000000..af3bb0714e65c --- /dev/null +++ b/recipes/sonic-cpp/config.yml @@ -0,0 +1,5 @@ +versions: + "1.0.1": + folder: all + "1.0.0": + folder: all diff --git a/recipes/sophus/all/conandata.yml b/recipes/sophus/all/conandata.yml index cc44a93d24470..5ba97a496abc6 100644 --- a/recipes/sophus/all/conandata.yml +++ b/recipes/sophus/all/conandata.yml @@ -1,10 +1,10 @@ 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" + "1.22.10": + url: "https://github.com/strasdat/Sophus/archive/refs/tags/1.22.10.tar.gz" + sha256: "eb1da440e6250c5efc7637a0611a5b8888875ce6ac22bf7ff6b6769bbc958082" + "1.22.4": + url: "https://github.com/strasdat/Sophus/archive/refs/tags/1.22.4.tar.gz" + sha256: "13597381636c5a0757bb89451bf3c98a0978e49b89739b66571a4bdd950caa81" "1.0.0": url: "https://github.com/strasdat/Sophus/archive/v1.0.0.tar.gz" sha256: "b4c8808344fe429ec026eca7eb921cef27fe9ff8326a48b72c53c4bf0804ad53" diff --git a/recipes/sophus/all/conanfile.py b/recipes/sophus/all/conanfile.py index 6b71153ca9340..ef703f320333f 100644 --- a/recipes/sophus/all/conanfile.py +++ b/recipes/sophus/all/conanfile.py @@ -4,18 +4,17 @@ from conan.tools.scm import Version import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class SophusConan(ConanFile): name = "sophus" description = "C++ implementation of Lie Groups using Eigen." - topics = ("eigen", "numerical", "math") + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://strasdat.github.io/Sophus/" - license = "MIT" - no_copy_source = True - + topics = ("eigen", "numerical", "math", "header-only") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" options = { "with_fmt": [True, False], @@ -23,23 +22,28 @@ class SophusConan(ConanFile): default_options = { "with_fmt": True, } + no_copy_source = True + + def configure(self): + if Version(self.version) < "1.22.4": + del self.options.with_fmt + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - self.requires("eigen/3.4.0") - 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") + self.requires("eigen/3.4.0", transitive_headers=True) + if self.options.get_safe("with_fmt"): + if Version(self.version) >= "1.22.10": + self.requires("fmt/10.1.0", transitive_headers=True) + else: + self.requires("fmt/8.1.1", transitive_headers=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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): copy(self, "LICENSE.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) @@ -51,18 +55,10 @@ def package_info(self): self.cpp_info.set_property("cmake_target_name", "Sophus::Sophus") self.cpp_info.set_property("pkg_config_name", "sophus") self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] - if not self.options.with_fmt: + if self.options.get_safe("with_fmt") == False: self.cpp_info.defines.append("SOPHUS_USE_BASIC_LOGGING=1") - # 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 = ["eigen::eigen"] - if self.options.with_fmt and Version(self.version) >= Version("22.04.1"): - self.cpp_info.requires.append("fmt::fmt") - # TODO: to remove in conan v2 once cmake_find_package* generator removed self.cpp_info.names["cmake_find_package"] = "Sophus" self.cpp_info.names["cmake_find_package_multi"] = "Sophus" diff --git a/recipes/sophus/config.yml b/recipes/sophus/config.yml index 89d44f82139c3..44d3b5bd2a8c9 100644 --- a/recipes/sophus/config.yml +++ b/recipes/sophus/config.yml @@ -1,7 +1,7 @@ versions: - "22.10": + "1.22.10": folder: all - "22.04.1": + "1.22.4": folder: all "1.0.0": folder: all diff --git a/recipes/soplex/all/conandata.yml b/recipes/soplex/all/conandata.yml new file mode 100644 index 0000000000000..aa0fdcefcf969 --- /dev/null +++ b/recipes/soplex/all/conandata.yml @@ -0,0 +1,22 @@ +sources: + "7.1.2": + url: "https://github.com/scipopt/soplex/archive/refs/tags/release-712.tar.gz" + sha256: "a1a7d7f7e30d1db65548b32f75d6f2ed9bd0bf289f639eb4481d3d141c67a332" + "7.1.1": + url: "https://github.com/scipopt/soplex/archive/refs/tags/release-711.tar.gz" + sha256: "75752dca395e219e350f3b462f1f4c08e9d3c2deb2782414862f546a9489cdeb" + "7.1.0": + url: "https://github.com/scipopt/soplex/archive/refs/tags/release-710.tar.gz" + sha256: "ec177fdb688346287d5f211dd7ec4a0195c8ec9b3a5314d38aca383b6fa1418e" + "7.0.1": + url: "https://github.com/scipopt/soplex/archive/refs/tags/release-701.tar.gz" + sha256: "80cce994dcbe45fd52b60e31a3aeb5d2c60a7ddbaae495e0ce6bf58481675696" + "7.0.0": + url: "https://github.com/scipopt/soplex/archive/refs/tags/release-700.tar.gz" + sha256: "ab1906d3afb1793a6f129a5baef9dd8eee929ee945aade427cb9f0b17888239c" + "6.0.4": + url: "https://github.com/scipopt/soplex/archive/refs/tags/release-604.tar.gz" + sha256: "691f5b593cb85c2586522d5de5a5a7692958d22ff1ddffb4fc395f4696590b6f" + "6.0.3": + url: "https://github.com/scipopt/soplex/archive/refs/tags/release-603.tar.gz" + sha256: "2bdf9adc9ac6ad48f98056679b7b852e626ac4aaaf277e7d4ce17794ed1097be" diff --git a/recipes/soplex/all/conanfile.py b/recipes/soplex/all/conanfile.py new file mode 100644 index 0000000000000..9dc99e1409055 --- /dev/null +++ b/recipes/soplex/all/conanfile.py @@ -0,0 +1,132 @@ +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.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import collect_libs, copy, get +from conan.tools.scm import Version +from os.path import join + +required_conan_version = ">=1.53.0" + + +class SoPlexConan(ConanFile): + name = "soplex" + description = "SoPlex linear programming solver" + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://soplex.zib.de" + topics = ("simplex", "solver", "linear", "programming") + settings = "os", "arch", "compiler", "build_type" + package_type = "library" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_boost": [True, False], + "with_gmp": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_boost": True, + "with_gmp": True, + } + + @property + def _min_cppstd(self): + return 14 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "5", + "clang": "4", + "apple-clang": "7", + "msvc": "191", + "Visual Studio": "15", + } + + def _determine_lib_name(self): + if self.options.shared: + return "soplexshared" + elif self.options.get_safe("fPIC"): + return "soplex-pic" + else: + return "soplex" + + 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): + # transitive libs as anything using soplex requires gzread, gzwrite, gzclose, gzopen + self.requires("zlib/[>=1.2.11 <2]", transitive_headers=True, transitive_libs=True) + if self.options.with_gmp: + # transitive libs as anything using soplex requires __gmpz_init_set_si + # see https://github.com/conan-io/conan-center-index/pull/16017#issuecomment-1495688452 + self.requires("gmp/6.3.0", transitive_headers=True, transitive_libs=True) + if self.options.with_boost: + self.requires("boost/1.84.0", transitive_headers=True) # also update Boost_VERSION_MACRO below! + + 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." + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["MPFR"] = False + tc.variables["GMP"] = self.options.with_gmp + tc.variables["BOOST"] = self.options.with_boost + tc.variables["Boost_VERSION_MACRO"] = "108400" + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() + deps = CMakeDeps(self) + if self.options.with_gmp: + deps.set_property("gmp", "cmake_file_name", "GMP") + deps.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build(target=f"lib{self._determine_lib_name()}") + + def package(self): + copy(self, pattern="LICENSE", src=self.source_folder, dst=join(self.package_folder, "licenses")) + copy(self, pattern="soplex.h", src=join(self.source_folder, "src"), dst=join(self.package_folder, "include")) + copy(self, pattern="soplex.hpp", src=join(self.source_folder, "src"), dst=join(self.package_folder, "include")) + copy(self, pattern="soplex_interface.h", src=join(self.source_folder, "src"), dst=join(self.package_folder, "include")) + copy(self, pattern="*.h", src=join(self.source_folder, "src", "soplex"), dst=join(self.package_folder, "include", "soplex")) + copy(self, pattern="*.hpp", src=join(self.source_folder, "src", "soplex"), dst=join(self.package_folder, "include", "soplex")) + copy(self, pattern="*.h", src=join(self.build_folder, "soplex"), dst=join(self.package_folder, "include", "soplex")) + copy(self, pattern="*.lib", src=join(self.build_folder, "lib"), dst=join(self.package_folder, "lib"), keep_path=False) + if self.options.shared: + copy(self, pattern="*.so*", src=join(self.build_folder, "lib"), dst=join(self.package_folder, "lib"), keep_path=False) + copy(self, pattern="*.dylib*", src=join(self.build_folder, "lib"), dst=join(self.package_folder, "lib"), keep_path=False) + copy(self, pattern="*.dll", src=join(self.build_folder, "bin"), dst=join(self.package_folder, "bin"), keep_path=False) + copy(self, pattern="*.dll.a", src=join(self.build_folder, "lib"), dst=join(self.package_folder, "lib"), keep_path=False) + else: + copy(self, pattern="*.a", 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) + # https://github.com/conan-io/conan-center-index/pull/16017#discussion_r1156484737 + self.cpp_info.set_property("cmake_target_name", "soplex") + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") diff --git a/recipes/soplex/all/test_package/CMakeLists.txt b/recipes/soplex/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..f734804072478 --- /dev/null +++ b/recipes/soplex/all/test_package/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package CXX) +set(CMAKE_CXX_STANDARD 14) + +find_package(soplex REQUIRED CONFIG) +# work around v1 legacy generators always having namespaces +if(TARGET soplex::soplex) + add_library(soplex INTERFACE IMPORTED) + set_target_properties(soplex PROPERTIES INTERFACE_LINK_LIBRARIES soplex::soplex) +endif() + +if (MSVC) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj") +endif () + +add_executable(${PROJECT_NAME} main.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE soplex) diff --git a/recipes/soplex/all/test_package/conanfile.py b/recipes/soplex/all/test_package/conanfile.py new file mode 100644 index 0000000000000..8a5bb47f50c4c --- /dev/null +++ b/recipes/soplex/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/soplex/all/test_package/main.cpp b/recipes/soplex/all/test_package/main.cpp new file mode 100644 index 0000000000000..65c9a2cdd5cbb --- /dev/null +++ b/recipes/soplex/all/test_package/main.cpp @@ -0,0 +1,26 @@ +#include +#include + +using namespace soplex; +using namespace std; + +int main() { + SoPlex mysoplex; + mysoplex.setIntParam(SoPlex::OBJSENSE, SoPlex::OBJSENSE_MAXIMIZE); + + DSVector dummycol(0); // obj: max x + 3y + mysoplex.addColReal(LPCol(1.0, dummycol, 1.0, 0.0)); + mysoplex.addColReal(LPCol(3.0, dummycol, 1.0, 0.0)); + + DSVector row1(2); + row1.add(0, 1.0); + row1.add(1, 1.0); + mysoplex.addRowReal(LPRow(0.0, row1, 2.0)); // x + y <= 2 + mysoplex.addRowReal(LPRow(1.0, row1, infinity)); // 1 <= x + y + + mysoplex.optimize(); + + auto objective = mysoplex.objValueReal(); + bool objectiveValueIsFour = objective > 3.9 && objective < 4.1; + return objectiveValueIsFour ? EXIT_SUCCESS : EXIT_FAILURE; +} diff --git a/recipes/soplex/config.yml b/recipes/soplex/config.yml new file mode 100644 index 0000000000000..7c8e24f77726a --- /dev/null +++ b/recipes/soplex/config.yml @@ -0,0 +1,15 @@ +versions: + "7.1.2": + folder: all + "7.1.1": + folder: all + "7.1.0": + folder: all + "7.0.1": + folder: all + "7.0.0": + folder: all + "6.0.4": + folder: all + "6.0.3": + folder: all diff --git a/recipes/soundtouch/all/conandata.yml b/recipes/soundtouch/all/conandata.yml index ed99d82ff219b..0d3d865ce3fdb 100644 --- a/recipes/soundtouch/all/conandata.yml +++ b/recipes/soundtouch/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.3.3": + url: "https://www.surina.net/soundtouch/soundtouch-2.3.3.tar.gz" + sha256: "43b23dfac2f64a3aff55d64be096ffc7b73842c3f5665caff44975633a975a99" "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 index dd8ee78498090..dc042457b29be 100644 --- a/recipes/soundtouch/all/conanfile.py +++ b/recipes/soundtouch/all/conanfile.py @@ -1,11 +1,14 @@ from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd from conan.tools.microsoft import is_msvc -from conan.tools.files import get, copy, rm, rmdir +from conan.tools.files import get, copy, rm, rmdir, replace_in_file from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.scm import Version import os -required_conan_version = ">=1.53.0" +required_conan_version = ">=2.0" class SoundTouchConan(ConanFile): name = "soundtouch" @@ -14,6 +17,8 @@ class SoundTouchConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://codeberg.org/soundtouch/soundtouch" topics = ("audio", "processing", "tempo", "pitch", "playback") + + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -43,15 +48,39 @@ def configure(self): def layout(self): cmake_layout(self, src_folder="src") + def validate(self): + if Version(self.version) >= "2.3.3": + check_min_cppstd(self, 17) + + if self.settings.os == "Macos" and self.options.integer_samples and self.options.with_dll: + # Undefined symbols for architecture arm64: + # "soundtouch::BPMDetect::inputSamples(float const*, int)", referenced from: + # _bpm_putSamples in SoundTouchDLL.cpp.o + # _bpm_putSamples_i16 in SoundTouchDLL.cpp.o + raise ConanInvalidConfiguration('The -o="&:integer_samples=True" option is incompatible with -o="&:with_dll=True"') + def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + self._patch_sources() + + def _patch_sources(self): + if Version(self.version) >= "2.3.3": + # Let Conan handle the C++ standard + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "set(CMAKE_CXX_STANDARD 17)", "") 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.cache_variables["INTEGER_SAMPLES"] = self.options.integer_samples + tc.cache_variables["SOUNDTOUCH_DLL"] = self.options.with_dll + tc.cache_variables["SOUNDSTRETCH"] = self.options.with_util + tc.cache_variables["OPENMP"] = self.options.with_openmp + # The finite-math-only optimization has no effect and can cause linking errors + # when linked against glibc >= 2.31 + tc.blocks["cmake_flags_init"].template = tc.blocks["cmake_flags_init"].template + """ + string(APPEND CMAKE_CXX_FLAGS_INIT " -fno-finite-math-only") + string(APPEND CMAKE_C_FLAGS_INIT " -fno-finite-math-only") + """ tc.generate() def build(self): @@ -99,15 +128,5 @@ def package_info(self): 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/config.yml b/recipes/soundtouch/config.yml index aee8de619ec30..5ca4acfdc4f7b 100644 --- a/recipes/soundtouch/config.yml +++ b/recipes/soundtouch/config.yml @@ -1,3 +1,5 @@ versions: + "2.3.3": + folder: all "2.3.2": folder: all diff --git a/recipes/source_location/all/conanfile.py b/recipes/source_location/all/conanfile.py index cbc67bb2eac20..305de2e31b857 100644 --- a/recipes/source_location/all/conanfile.py +++ b/recipes/source_location/all/conanfile.py @@ -1,33 +1,30 @@ import os -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration -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.files import copy, get +from conan.tools.layout import basic_layout +from conan.tools.scm import Version + +required_conan_version = ">=1.52.0" class SourceLocationConan(ConanFile): name = "source_location" + description = "source_location header for some older compilers" license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/Rechip/source_location" - description = "source_location header for some older compilers" - topics = ("cpp", "source_location", "header-only") - settings = ["compiler"] + topics = ("cpp", "header-only") + + package_type = "header-library" + 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) - - def package(self): - self.copy(pattern="LICENSE", dst="licenses", - src=self._source_subfolder) - self.copy(pattern="*", dst="include", - src=os.path.join(self._source_subfolder, "include")) + def _min_cppstd(self): + return 11 @property def _minimum_compilers_version(self): @@ -38,17 +35,32 @@ def _minimum_compilers_version(self): "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"): - tools.check_min_cppstd(self, "11") - minimum_version = self._minimum_compilers_version.get( - str(self.settings.compiler), False) + 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( - "source_location requires C++11. Your compiler is unknown. Assuming it supports C++11 and required functionality.") - elif tools.Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration( - "source_location requires C++11 and some embedded functionality, which your compiler does not support.") + self.output.warning("source_location requires C++11. Your compiler is unknown. Assuming it supports C++11 and required functionality.") + elif Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration("source_location requires C++11 and some embedded functionality, which your compiler does not support.") - def package_id(self): - self.info.header_only() + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def package(self): + copy(self, "LICENSE", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder) + copy(self, "*", + 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/source_location/all/test_package/CMakeLists.txt b/recipes/source_location/all/test_package/CMakeLists.txt index 955a59f6e9c84..27bf673b3e4ae 100644 --- a/recipes/source_location/all/test_package/CMakeLists.txt +++ b/recipes/source_location/all/test_package/CMakeLists.txt @@ -1,13 +1,10 @@ -cmake_minimum_required(VERSION 3.4) +cmake_minimum_required(VERSION 3.15) project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +find_package(source_location REQUIRED CONFIG) -find_package(source_location CONFIG REQUIRED) add_executable(${PROJECT_NAME} src/test.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE source_location::source_location) - set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 11 diff --git a/recipes/source_location/all/test_package/conanfile.py b/recipes/source_location/all/test_package/conanfile.py index cbe0be23191a2..fae501d0afb9e 100644 --- a/recipes/source_location/all/test_package/conanfile.py +++ b/recipes/source_location/all/test_package/conanfile.py @@ -1,17 +1,26 @@ +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", "arch", "build_type" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): - self.cmake = CMake(self) - self.cmake.configure() - self.cmake.build() + cmake = CMake(self) + cmake.configure() + cmake.build() 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/source_location/all/test_v1_package/CMakeLists.txt b/recipes/source_location/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/source_location/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/source_location/all/test_v1_package/conanfile.py b/recipes/source_location/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..cbe0be23191a2 --- /dev/null +++ b/recipes/source_location/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +import os +from conans import ConanFile, CMake, tools + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "arch", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + self.cmake = CMake(self) + self.cmake.configure() + 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) diff --git a/recipes/source_location/all/test_v1_package/src/test.cpp b/recipes/source_location/all/test_v1_package/src/test.cpp new file mode 100644 index 0000000000000..1e3734bb24378 --- /dev/null +++ b/recipes/source_location/all/test_v1_package/src/test.cpp @@ -0,0 +1,8 @@ +#include +#include + +int main() { + constexpr auto loc = std::source_location::current(); + + return loc.line() == 5 ? EXIT_SUCCESS : EXIT_FAILURE; +} 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..1e3e515a65407 100644 --- a/recipes/soxr/all/conandata.yml +++ b/recipes/soxr/all/conandata.yml @@ -1,10 +1,15 @@ sources: "0.1.3": - url: https://sourceforge.net/projects/soxr/files/soxr-0.1.3-Source.tar.xz + url: "https://sourceforge.net/projects/soxr/files/soxr-0.1.3-Source.tar.xz" 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/0.1.3-0001-findpackage-openmp.patch" + patch_description: "make OpenMP required to fail when not found" + patch_type: "conan" + - patch_file: "patches/0.1.3-0002-cmake-source-dir.patch" + patch_description: "point to the right source dir" + patch_type: "conan" + - patch_file: "patches/0.1.3-0003-relocatable-macos.patch" + patch_description: "Relocatable shared libs on macOS" + patch_type: "conan" diff --git a/recipes/soxr/all/conanfile.py b/recipes/soxr/all/conanfile.py index 78d30ad3efdeb..452e658b2375d 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.tools.microsoft import msvc_runtime_flag, is_msvc +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 is_msvc, is_msvc_static_runtime +from conan.tools.scm import Version -required_conan_version = ">=1.45.0" +required_conan_version = ">=1.54.0" class SoxrConan(ConanFile): @@ -14,33 +16,23 @@ class SoxrConan(ConanFile): topics = ("resampling", "audio", "sample-rate", "conversion") license = "LGPL-2.1-or-later" url = "https://github.com/conan-io/conan-center-index" - settings = "os", "compiler", "build_type", "arch" + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], "with_openmp": [True, False], - "with_lsr_bindings": [True, False] + "with_lsr_bindings": [True, False], } default_options = { "shared": False, "fPIC": True, "with_openmp": False, - "with_lsr_bindings": True + "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,55 +40,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 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) 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"] = not is_msvc_static_runtime(self) + # 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")) - 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) + pffft_c = load(self, os.path.join(self.source_folder, "src", "pffft.c")) + return pffft_c[pffft_c.find("/* Copyright")+3:pffft_c.find("modern CPUs.")+13] def package(self): - self.copy("LICENCE", dst="licenses", src=self._source_subfolder) - self._extract_pffft_license() - cmake = self._configure_cmake() + copy(self, "COPYING*", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "LICENCE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + save(self, os.path.join(self.package_folder, "licenses", "LICENSE_pffft"), self._extract_pffft_license()) + 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"] if self.settings.os == "Windows" and self.options.shared: self.cpp_info.components["core"].defines.append("SOXR_DLL") if not self.options.shared and self.options.with_openmp: - if self.settings.compiler in ("Visual Studio", "msvc"): + if is_msvc(self): openmp_flags = ["-openmp"] elif self.settings.compiler in ("gcc", "clang"): openmp_flags = ["-fopenmp"] @@ -108,7 +104,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/patches/findpackage-openmp.patch b/recipes/soxr/all/patches/0.1.3-0001-findpackage-openmp.patch similarity index 100% rename from recipes/soxr/all/patches/findpackage-openmp.patch rename to recipes/soxr/all/patches/0.1.3-0001-findpackage-openmp.patch diff --git a/recipes/soxr/all/patches/cmake-source-dir.patch b/recipes/soxr/all/patches/0.1.3-0002-cmake-source-dir.patch similarity index 100% rename from recipes/soxr/all/patches/cmake-source-dir.patch rename to recipes/soxr/all/patches/0.1.3-0002-cmake-source-dir.patch diff --git a/recipes/soxr/all/patches/0.1.3-0003-relocatable-macos.patch b/recipes/soxr/all/patches/0.1.3-0003-relocatable-macos.patch new file mode 100644 index 0000000000000..4ee1529626038 --- /dev/null +++ b/recipes/soxr/all/patches/0.1.3-0003-relocatable-macos.patch @@ -0,0 +1,18 @@ +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -81,7 +81,6 @@ target_link_libraries (${PROJECT_NAME} PRIVATE ${LIBS} ${LIBM_LIBRARIES}) + set_target_properties (${PROJECT_NAME} PROPERTIES + VERSION "${SO_VERSION}" + SOVERSION ${SO_VERSION_MAJOR} +- INSTALL_NAME_DIR ${LIB_INSTALL_DIR} + LINK_INTERFACE_LIBRARIES "" + PUBLIC_HEADER "${PROJECT_NAME}.h") + if (BUILD_FRAMEWORK) +@@ -105,7 +104,6 @@ if (WITH_LSR_BINDINGS) + set_target_properties (${LSR} PROPERTIES + VERSION "${LSR_SO_VERSION}" + SOVERSION ${LSR_SO_VERSION_MAJOR} +- INSTALL_NAME_DIR ${LIB_INSTALL_DIR} + LINK_INTERFACE_LIBRARIES "" + PUBLIC_HEADER "${LSR}.h") + if (BUILD_FRAMEWORK) diff --git a/recipes/soxr/all/test_package/CMakeLists.txt b/recipes/soxr/all/test_package/CMakeLists.txt index 1bade61abc3e3..bd7a2c60dd458 100644 --- a/recipes/soxr/all/test_package/CMakeLists.txt +++ b/recipes/soxr/all/test_package/CMakeLists.txt @@ -1,15 +1,16 @@ 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) +enable_testing() find_package(soxr CONFIG REQUIRED) add_executable(test_package_core test_package_core.c) target_link_libraries(test_package_core soxr::core) +add_test(NAME test_package_core COMMAND test_package_core) if(TARGET soxr::lsr) add_executable(test_package_lsr test_package_lsr.c) target_link_libraries(test_package_lsr soxr::lsr) + add_test(NAME test_package_lsr COMMAND test_package_lsr) endif() diff --git a/recipes/soxr/all/test_package/conanfile.py b/recipes/soxr/all/test_package/conanfile.py index f8d479ac7b138..c22030a639898 100644 --- a/recipes/soxr/all/test_package/conanfile.py +++ b/recipes/soxr/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 build_jobs, can_run +from conan.tools.cmake import CMake, cmake_layout +from conan.tools.files import chdir + 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) @@ -11,11 +21,6 @@ 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) + 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/soxr/all/test_v1_package/CMakeLists.txt b/recipes/soxr/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..c23ed5cfe6d98 --- /dev/null +++ b/recipes/soxr/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/soxr/all/test_v1_package/conanfile.py b/recipes/soxr/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..4240acdf711cd --- /dev/null +++ b/recipes/soxr/all/test_v1_package/conanfile.py @@ -0,0 +1,15 @@ +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.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/span-lite/all/conandata.yml b/recipes/span-lite/all/conandata.yml index fe2adde8330d8..f5a6e5aa8bfcb 100644 --- a/recipes/span-lite/all/conandata.yml +++ b/recipes/span-lite/all/conandata.yml @@ -1,28 +1,22 @@ sources: - "0.6.0": - url: https://github.com/martinmoene/span-lite/archive/v0.6.0.tar.gz - sha256: da97ea5922a3c6129fe2ce89b95b471ae40e2ad921b354e472236a5ad57c5053 - "0.7.0": - url: https://github.com/martinmoene/span-lite/archive/v0.7.0.tar.gz - sha256: e95a9b281b46eb2b44257c6c4ec218c1741144c1167644896e29fd6aed9bbcf4 - "0.8.0": - url: https://github.com/martinmoene/span-lite/archive/v0.8.0.tar.gz - sha256: cca1c9de1dd1b7244ee8e5a093cc38b869d972154db61932b7dd22bd7a9d609c - "0.8.1": - url: https://github.com/martinmoene/span-lite/archive/v0.8.1.tar.gz - sha256: 2136dba54988c16b03f7c652ea977205bf624bfde90c24331177027d6529386d - "0.9.0": - url: https://github.com/martinmoene/span-lite/archive/v0.9.0.tar.gz - sha256: cdb5f86e5f5e679d63700a56de734c44fe22a574a17347d09dbaaef80619af91 - "0.9.2": - url: https://github.com/martinmoene/span-lite/archive/v0.9.2.tar.gz - sha256: 7562802aac9b78e0140c3d59933cf4dc5825c0712c63daad2f7fff8c67e62eb4 - "0.10.0": - url: https://github.com/martinmoene/span-lite/archive/v0.10.0.tar.gz - sha256: fd2ca42c18b4d5fae869752d18cf414bb4a3e4f01e617835a79ddb54a207889c - "0.10.1": - url: "https://github.com/martinmoene/span-lite/archive/v0.10.1.tar.gz" - sha256: "f915bca2d1e8357efdd043a5dc88047b390a76d77fb8cc1b6de831f7f43e397b" + "0.11.0": + url: "https://github.com/martinmoene/span-lite/archive/v0.11.0.tar.gz" + sha256: "ef4e028e18ff21044da4b4641ca1bc8a2e2d656e2028322876c0e1b9b6904f9d" "0.10.3": url: "https://github.com/martinmoene/span-lite/archive/v0.10.3.tar.gz" sha256: "04ac8148760369f11d4cdbc7969d66cb3d372357b6b5c7744841a60551ccb50b" + "0.10.1": + url: "https://github.com/martinmoene/span-lite/archive/v0.10.1.tar.gz" + sha256: "f915bca2d1e8357efdd043a5dc88047b390a76d77fb8cc1b6de831f7f43e397b" + "0.10.0": + url: https://github.com/martinmoene/span-lite/archive/v0.10.0.tar.gz + sha256: fd2ca42c18b4d5fae869752d18cf414bb4a3e4f01e617835a79ddb54a207889c + "0.9.2": + url: https://github.com/martinmoene/span-lite/archive/v0.9.2.tar.gz + sha256: 7562802aac9b78e0140c3d59933cf4dc5825c0712c63daad2f7fff8c67e62eb4 + "0.9.0": + url: https://github.com/martinmoene/span-lite/archive/v0.9.0.tar.gz + sha256: cdb5f86e5f5e679d63700a56de734c44fe22a574a17347d09dbaaef80619af91 + "0.8.1": + url: https://github.com/martinmoene/span-lite/archive/v0.8.1.tar.gz + sha256: 2136dba54988c16b03f7c652ea977205bf624bfde90c24331177027d6529386d diff --git a/recipes/span-lite/all/conanfile.py b/recipes/span-lite/all/conanfile.py index a3cdfec98fc6a..1ff14a35802e5 100644 --- a/recipes/span-lite/all/conanfile.py +++ b/recipes/span-lite/all/conanfile.py @@ -8,11 +8,12 @@ class SpanLiteConan(ConanFile): name = "span-lite" + description = "A C++20-like span for C++98, C++11 and later in a single-file header-only library" + license = "BSL-1.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/martinmoene/span-lite" - description = "span lite - A C++20-like span for C++98, C++11 and later in a single-file header-only library" - topics = ("cpp98", "cpp11", "cpp14", "cpp17", "span", "span-implementations") - license = "BSL-1.0" + topics = ("cpp98", "cpp11", "cpp14", "cpp17", "span", "span-implementations", "header-only") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -23,11 +24,7 @@ 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 + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): copy(self, "*.hpp", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) @@ -38,7 +35,6 @@ def package_info(self): 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" @@ -48,6 +44,5 @@ 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/config.yml b/recipes/span-lite/config.yml index ebfb72f91ca97..cd3bc2b5634a7 100644 --- a/recipes/span-lite/config.yml +++ b/recipes/span-lite/config.yml @@ -1,19 +1,15 @@ versions: - "0.6.0": + "0.11.0": folder: all - "0.7.0": - folder: all - "0.8.0": + "0.10.3": folder: all - "0.8.1": + "0.10.1": folder: all - "0.9.0": + "0.10.0": folder: all "0.9.2": folder: all - "0.10.0": - folder: all - "0.10.1": + "0.9.0": folder: all - "0.10.3": + "0.8.1": folder: all diff --git a/recipes/spdlog/all/conandata.yml b/recipes/spdlog/all/conandata.yml index 60c6a1f3b520c..e6248ae597ba5 100644 --- a/recipes/spdlog/all/conandata.yml +++ b/recipes/spdlog/all/conandata.yml @@ -1,4 +1,19 @@ sources: + "1.15.0": + url: "https://github.com/gabime/spdlog/archive/v1.15.0.tar.gz" + sha256: "9962648c9b4f1a7bbc76fd8d9172555bad1871fdb14ff4f842ef87949682caa5" + "1.14.1": + url: "https://github.com/gabime/spdlog/archive/v1.14.1.tar.gz" + sha256: "1586508029a7d0670dfcb2d97575dcdc242d3868a259742b69f100801ab4e16b" + "1.14.0": + url: "https://github.com/gabime/spdlog/archive/v1.14.0.tar.gz" + sha256: "429a6b73ade8285cb21f83bacf89e2821dd1720ea7faa3cb518ffe04b4e00efc" + "1.13.0": + url: "https://github.com/gabime/spdlog/archive/v1.13.0.tar.gz" + sha256: "534f2ee1a4dcbeb22249856edfb2be76a1cf4f708a20b0ac2ed090ee24cfdbc9" + "1.12.0": + url: "https://github.com/gabime/spdlog/archive/v1.12.0.tar.gz" + sha256: "4dccf2d10f410c1e2feaff89966bfc49a1abb29ef6f08246335b110e001e09a9" "1.11.0": url: "https://github.com/gabime/spdlog/archive/v1.11.0.tar.gz" sha256: "ca5cae8d6cac15dae0ec63b21d6ad3530070650f68076f3a4a862ca293a858bb" @@ -8,6 +23,27 @@ sources: "1.9.2": url: "https://github.com/gabime/spdlog/archive/v1.9.2.tar.gz" sha256: "6fff9215f5cb81760be4cc16d033526d1080427d236e86d70bb02994f85e3d38" + "1.9.1": + url: "https://github.com/gabime/spdlog/archive/v1.9.1.tar.gz" + sha256: "9a452cfa24408baccc9b2bc2d421d68172a7630c99e9504a14754be840d31a62" "1.8.5": url: "https://github.com/gabime/spdlog/archive/v1.8.5.tar.gz" sha256: "944d0bd7c763ac721398dca2bb0f3b5ed16f67cef36810ede5061f35a543b4b8" +patches: + "1.11.0": + - patch_file: "patches/1.11.0-0001-fix-fmt10-build.patch" + patch_description: "Fix fmt 10.0.0 build" + patch_type: "conan" + patch_source: "https://github.com/gabime/spdlog/pull/2694" +# Each release is intended to work with some specific versions +fmt_version_mapping: + "1.15.0": "11.0.2" + "1.14.1": "10.2.1" + "1.14.0": "10.2.1" + "1.13.0": "10.2.1" + "1.12.0": "10.2.1" + "1.11.0": "10.0.0" + "1.10.0": "8.1.1" + "1.9.2": "8.0.1" + "1.9.1": "8.0.1" + "1.8.5": "7.1.3" diff --git a/recipes/spdlog/all/conanfile.py b/recipes/spdlog/all/conanfile.py index da547548f01b6..26289fe3fbce1 100644 --- a/recipes/spdlog/all/conanfile.py +++ b/recipes/spdlog/all/conanfile.py @@ -2,8 +2,8 @@ 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.microsoft import is_msvc_static_runtime +from conan.tools.files import get, copy, rmdir, replace_in_file, apply_conandata_patches, export_conandata_patches +from conan.tools.microsoft import check_min_vs, is_msvc, is_msvc_static_runtime from conan.tools.scm import Version import os @@ -12,6 +12,7 @@ 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" @@ -24,7 +25,9 @@ class SpdlogConan(ConanFile): "header_only": [True, False], "wchar_support": [True, False], "wchar_filenames": [True, False], + "wchar_console": [True, False], "no_exceptions": [True, False], + "use_std_fmt": [True, False], } default_options = { "shared": False, @@ -32,67 +35,95 @@ class SpdlogConan(ConanFile): "header_only": False, "wchar_support": False, "wchar_filenames": False, + "wchar_console": False, "no_exceptions": False, + "use_std_fmt": False, } + def export_sources(self): + export_conandata_patches(self) + def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + else: + del self.options.wchar_support + del self.options.wchar_filenames + del self.options.wchar_console + if Version(self.version) < "1.10.0": + del self.options.use_std_fmt + if Version(self.version) < "1.15.0": + self.options.rm_safe("wchar_console") def configure(self): - if self.options.shared or self.options.header_only: + if self.options.get_safe("shared") or self.options.header_only: self.options.rm_safe("fPIC") if self.options.header_only: - del self.options.shared + self.options.rm_safe("shared") def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - if Version(self.version) >= "1.11.0": - self.requires("fmt/9.1.0", transitive_headers=True) - elif Version(self.version) >= "1.10.0": - self.requires("fmt/8.1.1", transitive_headers=True) - elif Version(self.version) >= "1.9.0": - self.requires("fmt/8.0.1", transitive_headers=True) - elif Version(self.version) >= "1.7.0": - self.requires("fmt/7.1.3", transitive_headers=True) - elif Version(self.version) >= "1.5.0": - self.requires("fmt/6.2.1", transitive_headers=True) - else: - self.requires("fmt/6.0.0", transitive_headers=True) + if not self.options.get_safe("use_std_fmt"): + fmt_version = self.conan_data["fmt_version_mapping"][self.version] + 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() + + @property + def _std_fmt_compilers_minimum_version(self): + return { + "gcc": "13", + "clang": "14", + "apple-clang": "15", + "Visual Studio": "16", + "msvc": "192", + } def validate(self): - if self.settings.get_safe("compiler.cppstd"): + if self.options.get_safe("use_std_fmt"): + check_min_cppstd(self, 20) + else: 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.options.get_safe("use_std_fmt"): + compiler_name = str(self.settings.compiler) + minimum_version = self._std_fmt_compilers_minimum_version.get(compiler_name, False) + if not minimum_version: + self.output.warning(f"{self.name} recipe lacks information about the {compiler_name} compiler support.") + elif Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} using std::fmt requires std::fmt, which your compiler does not support." + ) def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): if not self.options.header_only: - fmt = self.dependencies["fmt"] tc = CMakeToolchain(self) tc.variables["SPDLOG_BUILD_EXAMPLE"] = False tc.variables["SPDLOG_BUILD_EXAMPLE_HO"] = False tc.variables["SPDLOG_BUILD_TESTS"] = False tc.variables["SPDLOG_BUILD_TESTS_HO"] = False tc.variables["SPDLOG_BUILD_BENCH"] = False - tc.variables["SPDLOG_FMT_EXTERNAL"] = not fmt.options.header_only - tc.variables["SPDLOG_FMT_EXTERNAL_HO"] = fmt.options.header_only + if not self.options.get_safe("use_std_fmt"): + fmt = self.dependencies["fmt"] + 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 - tc.variables["SPDLOG_WCHAR_FILENAMES"] = self.options.wchar_filenames + tc.variables["SPDLOG_WCHAR_SUPPORT"] = self.options.get_safe("wchar_support", False) + tc.variables["SPDLOG_WCHAR_FILENAMES"] = self.options.get_safe("wchar_filenames", False) + if Version(self.version) >= "1.15.0": + tc.variables["SDPLOG_WCHAR_CONSOLE"] = self.options.get_safe("wchar_console", False) tc.variables["SPDLOG_INSTALL"] = True tc.variables["SPDLOG_NO_EXCEPTIONS"] = self.options.no_exceptions + tc.variables["SPDLOG_USE_STD_FORMAT"] = self.options.get_safe("use_std_fmt") if self.settings.os in ("iOS", "tvOS", "watchOS"): tc.variables["SPDLOG_NO_TLS"] = True tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0091"] = "NEW" @@ -100,11 +131,17 @@ def generate(self): cmake_deps = CMakeDeps(self) cmake_deps.generate() - def _disable_werror(self): + + def _patch_sources(self): + apply_conandata_patches(self) replace_in_file(self, os.path.join(self.source_folder, "cmake", "utils.cmake"), "/WX", "") + # This is properly set in later versions + if self.options.get_safe("use_std_fmt") and Version(self.version) < "1.12": + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "CMAKE_CXX_STANDARD 11", "CMAKE_CXX_STANDARD 20") def build(self): - self._disable_werror() + self._patch_sources() if not self.options.header_only: cmake = CMake(self) cmake.configure() @@ -113,7 +150,11 @@ def build(self): def package(self): copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) if self.options.header_only: - copy(self, pattern="*.h", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self.source_folder, "include")) + copy(self, + src=os.path.join(self.source_folder, "include"), + pattern="*.h", dst=os.path.join(self.package_folder, "include"), + # Unvendor bundled dependencies https://github.com/gabime/spdlog/commit/18495bf25dad3a4e8c2fe3777a5f79acecde27e3 + excludes=("spdlog/fmt/bundled/*")) else: cmake = CMake(self) cmake.install() @@ -129,25 +170,27 @@ def package_info(self): # 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"] + if self.options.get_safe("use_std_fmt"): + self.cpp_info.components["libspdlog"].defines.append("SPDLOG_USE_STD_FORMAT") + else: + self.cpp_info.components["libspdlog"].requires = ["fmt::fmt"] + self.cpp_info.components["libspdlog"].defines.append("SPDLOG_FMT_EXTERNAL") - if not self.options.header_only: + if self.options.header_only: + self.cpp_info.components["libspdlog"].libdirs = [] + else: suffix = "d" if self.settings.build_type == "Debug" else "" self.cpp_info.components["libspdlog"].libs = [f"spdlog{suffix}"] self.cpp_info.components["libspdlog"].defines.append("SPDLOG_COMPILED_LIB") - if self.options.wchar_support: + if self.options.get_safe("wchar_support"): self.cpp_info.components["libspdlog"].defines.append("SPDLOG_WCHAR_TO_UTF8_SUPPORT") - if self.options.wchar_filenames: + if self.options.get_safe("wchar_filenames"): self.cpp_info.components["libspdlog"].defines.append("SPDLOG_WCHAR_FILENAMES") + if self.options.get_safe("wchar_console"): + self.cpp_info.components["libspdlog"].defines.append("SPDLOG_UTF8_TO_WCHAR_CONSOLE") if self.options.no_exceptions: self.cpp_info.components["libspdlog"].defines.append("SPDLOG_NO_EXCEPTIONS") if self.settings.os in ["Linux", "FreeBSD"]: 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/patches/1.11.0-0001-fix-fmt10-build.patch b/recipes/spdlog/all/patches/1.11.0-0001-fix-fmt10-build.patch new file mode 100644 index 0000000000000..613990e4eb052 --- /dev/null +++ b/recipes/spdlog/all/patches/1.11.0-0001-fix-fmt10-build.patch @@ -0,0 +1,34 @@ +From 576210a1363822a132657090b9f37e305bd0e2c2 Mon Sep 17 00:00:00 2001 +From: pwqbot +Date: Tue, 20 Jun 2023 10:41:48 +0800 +Subject: [PATCH] fix fmt build + +--- + include/spdlog/common.h | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/include/spdlog/common.h b/include/spdlog/common.h +index f97fd48c..00f4d728 100644 +--- a/include/spdlog/common.h ++++ b/include/spdlog/common.h +@@ -160,12 +160,19 @@ using format_string_t = fmt::format_string; + template + using remove_cvref_t = typename std::remove_cv::type>::type; + ++template ++# if FMT_VERSION >= 90101 ++using fmt_runtime_string = fmt::runtime_format_string; ++# else ++using fmt_runtime_string = fmt::basic_runtime; ++# endif ++ + // clang doesn't like SFINAE disabled constructor in std::is_convertible<> so have to repeat the condition from basic_format_string here, + // in addition, fmt::basic_runtime is only convertible to basic_format_string but not basic_string_view + template + struct is_convertible_to_basic_format_string + : std::integral_constant>::value || std::is_same, fmt::basic_runtime>::value> ++ std::is_convertible>::value || std::is_same, fmt_runtime_string>::value> + {}; + + # if defined(SPDLOG_WCHAR_FILENAMES) || defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT) diff --git a/recipes/spdlog/all/test_package/CMakeLists.txt b/recipes/spdlog/all/test_package/CMakeLists.txt index d31b151d6390c..f43e46db5a77d 100644 --- a/recipes/spdlog/all/test_package/CMakeLists.txt +++ b/recipes/spdlog/all/test_package/CMakeLists.txt @@ -9,4 +9,9 @@ if(SPDLOG_HEADER_ONLY) else() target_link_libraries(${PROJECT_NAME} PUBLIC spdlog::spdlog) endif() -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) + +if(SPDLOG_USE_STD_FORMAT) + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) +else() + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +endif() diff --git a/recipes/spdlog/all/test_package/conanfile.py b/recipes/spdlog/all/test_package/conanfile.py index 81d7c956cf9d2..346d9bd744058 100644 --- a/recipes/spdlog/all/test_package/conanfile.py +++ b/recipes/spdlog/all/test_package/conanfile.py @@ -19,6 +19,7 @@ def requirements(self): def generate(self): tc = CMakeToolchain(self) tc.variables["SPDLOG_HEADER_ONLY"] = self.dependencies["spdlog"].options.header_only + tc.variables["SPDLOG_USE_STD_FORMAT"] = self.dependencies["spdlog"].options.get_safe("use_std_fmt", False) tc.generate() def build(self): diff --git a/recipes/spdlog/all/test_package/test_package.cpp b/recipes/spdlog/all/test_package/test_package.cpp index d6547ebd86186..74aba1fd54ff9 100644 --- a/recipes/spdlog/all/test_package/test_package.cpp +++ b/recipes/spdlog/all/test_package/test_package.cpp @@ -1,6 +1,12 @@ #include #include "spdlog/spdlog.h" +#if defined __has_include +# if __has_include ("spdlog/fmt/bundled/core.h") +# error "bundled fmt within spdlog should not be present" +# endif +#endif + int main(void) { spdlog::info("Welcome to spdlog version {}.{}.{} !", SPDLOG_VER_MAJOR, SPDLOG_VER_MINOR, SPDLOG_VER_PATCH); return EXIT_SUCCESS; diff --git a/recipes/spdlog/all/test_v1_package/conanfile.py b/recipes/spdlog/all/test_v1_package/conanfile.py deleted file mode 100644 index 30ca1d12b0933..0000000000000 --- a/recipes/spdlog/all/test_v1_package/conanfile.py +++ /dev/null @@ -1,18 +0,0 @@ -from conans import ConanFile, CMake, tools -import os - - -class TestPackageConan(ConanFile): - settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" - - def build(self): - cmake = CMake(self) - cmake.configure() - 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) diff --git a/recipes/spdlog/config.yml b/recipes/spdlog/config.yml index 2efd56b833781..8eb73c576f53e 100644 --- a/recipes/spdlog/config.yml +++ b/recipes/spdlog/config.yml @@ -1,9 +1,21 @@ versions: + "1.15.0": + folder: "all" + "1.14.1": + folder: "all" + "1.14.0": + folder: "all" + "1.13.0": + folder: "all" + "1.12.0": + folder: "all" "1.11.0": folder: "all" "1.10.0": folder: "all" "1.9.2": folder: "all" + "1.9.1": + folder: "all" "1.8.5": folder: "all" diff --git a/recipes/spectra/all/conanfile.py b/recipes/spectra/all/conanfile.py index 084f85d8c4950..7f108912c8a5c 100644 --- a/recipes/spectra/all/conanfile.py +++ b/recipes/spectra/all/conanfile.py @@ -15,6 +15,7 @@ class SpectraConan(ConanFile): topics = ("eigenvalue", "header-only") homepage = "https://spectralib.org" url = "https://github.com/conan-io/conan-center-index" + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -33,8 +34,7 @@ def validate(self): 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 build(self): pass diff --git a/recipes/speedb/all/conandata.yml b/recipes/speedb/all/conandata.yml new file mode 100644 index 0000000000000..63a7ae1e28120 --- /dev/null +++ b/recipes/speedb/all/conandata.yml @@ -0,0 +1,12 @@ +sources: + "2.8.0": + url: "https://github.com/speedb-io/speedb/archive/refs/tags/speedb/v2.8.0.tar.gz" + sha256: "ee7a55942a23d9589e5d3527364a2f9ae552ef7d52f6fd303dda25e4f27786ba" +patches: + "2.8.0": + - patch_file: "patches/2.8.0-0001-use-cci.patch" + patch_description: "use cci's package" + patch_type: "conan" + - patch_file: "patches/2.8.0-0002-fix-install.patch" + patch_description: "disable static lib installation on shared build" + patch_type: "conan" diff --git a/recipes/speedb/all/conanfile.py b/recipes/speedb/all/conanfile.py new file mode 100644 index 0000000000000..043f01899c023 --- /dev/null +++ b/recipes/speedb/all/conanfile.py @@ -0,0 +1,141 @@ +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 +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 + + +required_conan_version = ">=1.53.0" + +class SpeedbConan(ConanFile): + name = "speedb" + description = "A RocksDB compliant high performance scalable embedded key-value store" + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/speedb-io/speedb" + topics = ("rocksdb", "embedded", "key-value-store", "kvs", "storage-engine") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_snappy": [True, False], + "with_lz4": [True, False], + "with_zlib": [True, False], + "with_zstd": [True, False], + "with_core_tools": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_snappy": True, + "with_lz4": True, + "with_zlib": True, + "with_zstd": True, + "with_core_tools": True, + } + + @property + def _min_cppstd(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "8", + "clang": "7", + "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): + # TODO: support jemalloc, liburing + if self.options.with_snappy: + self.requires("snappy/1.1.10") + if self.options.with_lz4: + self.requires("lz4/1.9.4") + if self.options.with_zlib: + self.requires("zlib/[>=1.2.11 <2]") + if self.options.with_zstd: + self.requires("zstd/1.5.5") + if self.options.with_core_tools: + self.requires("gflags/2.2.2") + self.requires("readline/8.2") + + 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." + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["WITH_JEMALLOC"] = False + tc.variables["WITH_LIBURING"] = False + tc.variables["WITH_SNAPPY"] = self.options.with_snappy + tc.variables["WITH_LZ4"] = self.options.with_lz4 + tc.variables["WITH_ZLIB"] = self.options.with_zlib + tc.variables["WITH_ZSTD"] = self.options.with_zstd + tc.variables["WITH_TESTS"] = False + tc.variables["WITH_BENCHMARK_TOOLS"] = False + tc.variables["WITH_CORE_TOOLS"] = self.options.with_core_tools + tc.variables["WITH_GFLAGS"] = self.options.with_core_tools + tc.variables["WITH_TOOLS"] = False + tc.variables["ROCKSDB_BUILD_SHARED"] = self.options.shared + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() + deps = CMakeDeps(self) + deps.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + # to avoid wrong CPU detection, modify not to use "-march=native" in apple-clang + if cross_building(self) and self.settings.compiler == "apple-clang": + replace_in_file(self, + os.path.join(self.source_folder, "CMakeLists.txt"), + """elseif(NOT CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64" AND NOT HAS_ARMV8_CRC)""", + "elseif(FALSE)" + ) + + def build(self): + self._patch_sources() + 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")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + + def package_info(self): + self.cpp_info.libs = ["speedb"] + self.cpp_info.set_property("pkg_config_name", "speedb") + self.cpp_info.set_property("cmake_file_name", "Speedb") + self.cpp_info.set_property("cmake_target_name", "Speedb::speedb") diff --git a/recipes/speedb/all/patches/2.8.0-0001-use-cci.patch b/recipes/speedb/all/patches/2.8.0-0001-use-cci.patch new file mode 100644 index 0000000000000..0c321d827ce99 --- /dev/null +++ b/recipes/speedb/all/patches/2.8.0-0001-use-cci.patch @@ -0,0 +1,35 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index a579792..62299e9 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -195,7 +195,11 @@ else() + find_package(zstd REQUIRED) + add_definitions(-DZSTD) + include_directories(${ZSTD_INCLUDE_DIR}) +- list(APPEND THIRDPARTY_LIBS zstd::zstd) ++ if (TARGET zstd::libzstd_shared) ++ list(APPEND THIRDPARTY_LIBS zstd::libzstd_shared) ++ else() ++ list(APPEND THIRDPARTY_LIBS zstd::libzstd_static) ++ endif() + endif() + endif() + +diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt +index 90e76e2..96180cc 100644 +--- a/tools/CMakeLists.txt ++++ b/tools/CMakeLists.txt +@@ -2,11 +2,12 @@ set(CORE_TOOLS + sst_dump.cc + ldb.cc + beezcli.cc) ++find_package(readline REQUIRED) + foreach(src ${CORE_TOOLS}) + get_filename_component(exename ${src} NAME_WE) + add_executable(${exename}${ARTIFACT_SUFFIX} + ${src}) +- target_link_libraries(${exename}${ARTIFACT_SUFFIX} ${ROCKSDB_LIB} readline) ++ target_link_libraries(${exename}${ARTIFACT_SUFFIX} ${ROCKSDB_LIB} readline::readline) + list(APPEND core_tool_deps ${exename}) + endforeach() + diff --git a/recipes/speedb/all/patches/2.8.0-0002-fix-install.patch b/recipes/speedb/all/patches/2.8.0-0002-fix-install.patch new file mode 100644 index 0000000000000..8306a64425750 --- /dev/null +++ b/recipes/speedb/all/patches/2.8.0-0002-fix-install.patch @@ -0,0 +1,22 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 62299e9..43fe51d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1290,7 +1290,7 @@ if(NOT WIN32 OR ROCKSDB_INSTALL_ON_WINDOWS) + endforeach() + + install(DIRECTORY "${PROJECT_SOURCE_DIR}/cmake/modules" COMPONENT devel DESTINATION ${package_config_destination}) +- ++ if(NOT ROCKSDB_BUILD_SHARED) + install( + TARGETS ${ROCKSDB_STATIC_LIB} + EXPORT SpeedbTargets +@@ -1298,7 +1298,7 @@ if(NOT WIN32 OR ROCKSDB_INSTALL_ON_WINDOWS) + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" + INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" + ) +- ++ endif() + if(ROCKSDB_BUILD_SHARED) + install( + TARGETS ${ROCKSDB_SHARED_LIB} diff --git a/recipes/speedb/all/test_package/CMakeLists.txt b/recipes/speedb/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..4353233f81e9a --- /dev/null +++ b/recipes/speedb/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(Speedb REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE Speedb::speedb) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/speedb/all/test_package/conanfile.py b/recipes/speedb/all/test_package/conanfile.py new file mode 100644 index 0000000000000..ef5d7042163ec --- /dev/null +++ b/recipes/speedb/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/speedb/all/test_package/test_package.cpp b/recipes/speedb/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..2d49c4d14da21 --- /dev/null +++ b/recipes/speedb/all/test_package/test_package.cpp @@ -0,0 +1,93 @@ +// Copyright (c) 2011-present, Facebook, Inc. All rights reserved. +// This source code is licensed under both the GPLv2 (found in the +// COPYING file in the root directory) and Apache 2.0 License +// (found in the LICENSE.Apache file in the root directory). + +#include +#include + +#include "rocksdb/db.h" +#include "rocksdb/options.h" +#include "rocksdb/slice.h" + +using ROCKSDB_NAMESPACE::DB; +using ROCKSDB_NAMESPACE::Options; +using ROCKSDB_NAMESPACE::PinnableSlice; +using ROCKSDB_NAMESPACE::ReadOptions; +using ROCKSDB_NAMESPACE::Status; +using ROCKSDB_NAMESPACE::WriteBatch; +using ROCKSDB_NAMESPACE::WriteOptions; + +#if defined(OS_WIN) +std::string kDBPath = "C:\\Windows\\TEMP\\rocksdb_simple_example"; +#else +std::string kDBPath = "/tmp/rocksdb_simple_example"; +#endif + +int main() { + DB* db; + Options options; + // Optimize RocksDB. This is the easiest way to get RocksDB to perform well + options.IncreaseParallelism(); + options.OptimizeLevelStyleCompaction(); + // create the DB if it's not already present + options.create_if_missing = true; + + // open DB + Status s = DB::Open(options, kDBPath, &db); + assert(s.ok()); + + // Put key-value + s = db->Put(WriteOptions(), "key1", "value"); + assert(s.ok()); + std::string value; + // get value + s = db->Get(ReadOptions(), "key1", &value); + assert(s.ok()); + assert(value == "value"); + + // atomically apply a set of updates + { + WriteBatch batch; + batch.Delete("key1"); + batch.Put("key2", value); + s = db->Write(WriteOptions(), &batch); + } + + s = db->Get(ReadOptions(), "key1", &value); + assert(s.IsNotFound()); + + db->Get(ReadOptions(), "key2", &value); + assert(value == "value"); + + { + PinnableSlice pinnable_val; + db->Get(ReadOptions(), db->DefaultColumnFamily(), "key2", &pinnable_val); + assert(pinnable_val == "value"); + } + + { + std::string string_val; + // If it cannot pin the value, it copies the value to its internal buffer. + // The intenral buffer could be set during construction. + PinnableSlice pinnable_val(&string_val); + db->Get(ReadOptions(), db->DefaultColumnFamily(), "key2", &pinnable_val); + assert(pinnable_val == "value"); + // If the value is not pinned, the internal buffer must have the value. + assert(pinnable_val.IsPinned() || string_val == "value"); + } + + PinnableSlice pinnable_val; + s = db->Get(ReadOptions(), db->DefaultColumnFamily(), "key1", &pinnable_val); + assert(s.IsNotFound()); + // Reset PinnableSlice after each use and before each reuse + pinnable_val.Reset(); + db->Get(ReadOptions(), db->DefaultColumnFamily(), "key2", &pinnable_val); + assert(pinnable_val == "value"); + pinnable_val.Reset(); + // The Slice pointed by pinnable_val is not valid after this point + + delete db; + + return 0; +} diff --git a/recipes/speedb/config.yml b/recipes/speedb/config.yml new file mode 100644 index 0000000000000..64a500c0f05d7 --- /dev/null +++ b/recipes/speedb/config.yml @@ -0,0 +1,3 @@ +versions: + "2.8.0": + folder: all diff --git a/recipes/spirv-cross/all/CMakeLists.txt b/recipes/spirv-cross/all/CMakeLists.txt deleted file mode 100644 index 61f3d3b039e2b..0000000000000 --- a/recipes/spirv-cross/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/spirv-cross/all/conandata.yml b/recipes/spirv-cross/all/conandata.yml index 5df0322ea02ea..40968efaae61f 100644 --- a/recipes/spirv-cross/all/conandata.yml +++ b/recipes/spirv-cross/all/conandata.yml @@ -1,70 +1,26 @@ sources: - "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" - "1.3.211.0": - url: "https://github.com/KhronosGroup/SPIRV-Cross/archive/refs/tags/sdk-1.3.211.0.tar.gz" - sha256: "0f56755caa78765ab6c2467909c06dea63e6826ee824b496e73469c0d6a9d318" - "1.3.204.0": - url: "https://github.com/KhronosGroup/SPIRV-Cross/archive/refs/tags/sdk-1.3.204.0.tar.gz" - sha256: "1b5a9b5b3b333411164fe29de1969d5b590d83891aad14eb49be3c41eccd9edf" + "1.3.296.0": + url: "https://github.com/KhronosGroup/SPIRV-Cross/archive/refs/tags/vulkan-sdk-1.3.296.0.tar.gz" + sha256: "4f7f9a8a643e6694f155712016b9b572c13a9444e65b3f43b27bb464c0ab76e0" + "1.3.268.0": + url: "https://github.com/KhronosGroup/SPIRV-Cross/archive/refs/tags/vulkan-sdk-1.3.268.0.tar.gz" + sha256: "dd656a51ba4c229c1a0bb220b7470723e8fd4b68abb7f2cf2ca4027df824f4a0" + "1.3.261.1": + url: "https://github.com/KhronosGroup/SPIRV-Cross/archive/refs/tags/sdk-1.3.261.1.tar.gz" + sha256: "a5cf99ed62e93800232e50b782890321d4d7e053dcaa71bd8efc0c48a00bd1dd" + "1.3.250.1": + url: "https://github.com/KhronosGroup/SPIRV-Cross/archive/refs/tags/sdk-1.3.250.1.tar.gz" + sha256: "5b7402d7078eeffca0926875b1dcd0f5dd78791a30529de7c8456686f6fc52ce" + "1.3.246.1": + url: "https://github.com/KhronosGroup/SPIRV-Cross/archive/refs/tags/sdk-1.3.246.1.tar.gz" + sha256: "44d1aef7e6e247b4b7ec6a1ef0bbb43cc9b681ee689393db90ac815d240808b1" + "1.3.243.0": + url: "https://github.com/KhronosGroup/SPIRV-Cross/archive/refs/tags/sdk-1.3.243.0.tar.gz" + sha256: "549fff809de2b3484bcc5d710ccd76ca29cbd764dd304c3687252e2f3d034e06" + "1.3.239.0": + url: "https://github.com/KhronosGroup/SPIRV-Cross/archive/refs/tags/sdk-1.3.239.0.tar.gz" + sha256: "a1695022880e7ef3c2d407647f79876045dc2a3ed012753adc71ead5cc5178ba" + # commit used in Vulkan SDK 1.2.198.0 "cci.20211113": url: "https://github.com/KhronosGroup/SPIRV-Cross/archive/7c3cb0b12c9965497b08403c82ac1b82846fa7be.tar.gz" sha256: "5bb6837e2b75db1a9e36e7d6eac40d905e3460ff3b5234f391adc6bdf6aadcdf" - "cci.20210930": - url: "https://github.com/KhronosGroup/SPIRV-Cross/archive/97a438d214b24e4958ca137a18639670648cedd0.tar.gz" - sha256: "dd07ce3c261fe8c08dbfbb3dd274f35de50ea8610f57fe5de4fe2b782c4accbd" - "cci.20210823": - url: "https://github.com/KhronosGroup/SPIRV-Cross/archive/0e2880ab990e79ce6cc8c79c219feda42d98b1e8.tar.gz" - sha256: "611cf4d30d88c48a4a04848a66ae4c5d3a63ccf965fd6017d9ea86ec5c7a088d" - "cci.20210621": - url: "https://github.com/KhronosGroup/SPIRV-Cross/archive/9cdeefb5e322fc26b5fed70795fe79725648df1f.tar.gz" - sha256: "3742c24e7ccc09fce10e9d88c2f9a2e85f5142cc742be6df5cc3ba3f96defa92" - "20210115": - url: "https://github.com/KhronosGroup/SPIRV-Cross/archive/2021-01-15.tar.gz" - sha256: "d700863b548cbc7f27a678cee305f561669a126eb2cc11d36a7023dfc462b9c4" - "20200917": - url: "https://github.com/KhronosGroup/SPIRV-Cross/archive/2020-09-17.tar.gz" - sha256: "a3351742fe1fae9a15e91abbfb5314d96f5f77927ed07f55124d6df830ac97a7" - "20200629": - url: "https://github.com/KhronosGroup/SPIRV-Cross/archive/2020-06-29.tar.gz" - sha256: "29523168867fcfa55b03a65970a8572be67e37accb08ce1051b2d3ae19011452" - "20200519": - url: "https://github.com/KhronosGroup/SPIRV-Cross/archive/2020-05-19.tar.gz" - sha256: "6cf18ee3fe1a8d64a20da3c5fac334da4c4762d29d7e55a2f0b555cbf5cff708" - "20200403": - 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" - "20210115": - - patch_file: "patches/0001-fix-bundle-install-20210115.patch" - base_path: "source_subfolder" - "20200917": - - patch_file: "patches/0001-fix-bundle-install-20200403.patch" - base_path: "source_subfolder" - "20200629": - - patch_file: "patches/0001-fix-bundle-install-20200403.patch" - base_path: "source_subfolder" - "20200519": - - patch_file: "patches/0001-fix-bundle-install-20200403.patch" - base_path: "source_subfolder" - "20200403": - - patch_file: "patches/0001-fix-bundle-install-20200403.patch" - base_path: "source_subfolder" diff --git a/recipes/spirv-cross/all/conanfile.py b/recipes/spirv-cross/all/conanfile.py index 30a688b542978..d98d3ab1b2503 100644 --- a/recipes/spirv-cross/all/conanfile.py +++ b/recipes/spirv-cross/all/conanfile.py @@ -1,11 +1,12 @@ 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 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.52.0" +required_conan_version = ">=1.54.0" class SpirvCrossConan(ConanFile): @@ -17,6 +18,7 @@ class SpirvCrossConan(ConanFile): homepage = "https://github.com/KhronosGroup/SPIRV-Cross" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -30,7 +32,7 @@ class SpirvCrossConan(ConanFile): "reflect": [True, False], "c_api": [True, False], "util": [True, False], - "namespace": "ANY", + "namespace": ["ANY"], } default_options = { "shared": False, @@ -47,19 +49,7 @@ class SpirvCrossConan(ConanFile): "namespace": "spirv_cross", } - generators = "cmake" - _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): @@ -68,87 +58,66 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") # these options don't contribute to shared binary del self.options.c_api del self.options.util def layout(self): - pass + cmake_layout(self, src_folder="src") def validate(self): - 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): + if not self.options.glsl and \ + (self.options.hlsl or self.options.msl or self.options.cpp or self.options.reflect): raise ConanInvalidConfiguration("hlsl, msl, cpp and reflect require glsl enabled") + if self.options.build_executable and \ + not (self.options.glsl and self.options.hlsl and self.options.msl and + self.options.cpp and self.options.reflect and self.options.get_safe("util", True)): + raise ConanInvalidConfiguration("executable can't be built without glsl, hlsl, msl, cpp, reflect and util") + 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["SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS"] = not self.options.exceptions + tc.variables["SPIRV_CROSS_SHARED"] = self.options.shared + tc.variables["SPIRV_CROSS_STATIC"] = not self.options.shared or self.options.build_executable + tc.variables["SPIRV_CROSS_CLI"] = self.options.build_executable + tc.variables["SPIRV_CROSS_ENABLE_TESTS"] = False + tc.variables["SPIRV_CROSS_ENABLE_GLSL"] = self.options.glsl + tc.variables["SPIRV_CROSS_ENABLE_HLSL"] = self.options.hlsl + tc.variables["SPIRV_CROSS_ENABLE_MSL"] = self.options.msl + tc.variables["SPIRV_CROSS_ENABLE_CPP"] = self.options.cpp + tc.variables["SPIRV_CROSS_ENABLE_REFLECT"] = self.options.reflect + tc.variables["SPIRV_CROSS_ENABLE_C_API"] = self.options.get_safe("c_api", True) + tc.variables["SPIRV_CROSS_ENABLE_UTIL"] = self.options.get_safe("util", False) or self.options.build_executable + tc.variables["SPIRV_CROSS_SKIP_INSTALL"] = False + tc.variables["SPIRV_CROSS_FORCE_PIC"] = self.options.get_safe("fPIC", True) + tc.variables["SPIRV_CROSS_NAMESPACE_OVERRIDE"] = self.options.namespace + tc.generate() def build(self): apply_conandata_patches(self) - cmake = self._configure_cmake() - cmake.build() - if self.options.build_executable and not self._are_proper_binaries_available_for_executable: - self._build_exe() - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS"] = not self.options.exceptions - self._cmake.definitions["SPIRV_CROSS_SHARED"] = self.options.shared - self._cmake.definitions["SPIRV_CROSS_STATIC"] = not self.options.shared - self._cmake.definitions["SPIRV_CROSS_CLI"] = self.options.build_executable and self._are_proper_binaries_available_for_executable - self._cmake.definitions["SPIRV_CROSS_ENABLE_TESTS"] = False - self._cmake.definitions["SPIRV_CROSS_ENABLE_GLSL"] = self.options.glsl - self._cmake.definitions["SPIRV_CROSS_ENABLE_HLSL"] = self.options.hlsl - self._cmake.definitions["SPIRV_CROSS_ENABLE_MSL"] = self.options.msl - self._cmake.definitions["SPIRV_CROSS_ENABLE_CPP"] = self.options.cpp - self._cmake.definitions["SPIRV_CROSS_ENABLE_REFLECT"] = self.options.reflect - self._cmake.definitions["SPIRV_CROSS_ENABLE_C_API"] = self.options.get_safe("c_api", True) - self._cmake.definitions["SPIRV_CROSS_ENABLE_UTIL"] = self.options.get_safe("util", False) - self._cmake.definitions["SPIRV_CROSS_SKIP_INSTALL"] = False - self._cmake.definitions["SPIRV_CROSS_FORCE_PIC"] = self.options.get_safe("fPIC", True) - self._cmake.definitions["SPIRV_CROSS_NAMESPACE_OVERRIDE"] = self.options.namespace - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake - - @property - def _are_proper_binaries_available_for_executable(self): - return (not self.options.shared and self.options.glsl and self.options.hlsl - and self.options.msl and self.options.cpp and self.options.reflect - and self.options.util) - - def _build_exe(self): cmake = CMake(self) - cmake.definitions["SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS"] = False - cmake.definitions["SPIRV_CROSS_SHARED"] = False - cmake.definitions["SPIRV_CROSS_STATIC"] = True - cmake.definitions["SPIRV_CROSS_CLI"] = True - cmake.definitions["SPIRV_CROSS_ENABLE_TESTS"] = False - cmake.definitions["SPIRV_CROSS_ENABLE_GLSL"] = True - cmake.definitions["SPIRV_CROSS_ENABLE_HLSL"] = True - cmake.definitions["SPIRV_CROSS_ENABLE_MSL"] = True - cmake.definitions["SPIRV_CROSS_ENABLE_CPP"] = True - cmake.definitions["SPIRV_CROSS_ENABLE_REFLECT"] = True - cmake.definitions["SPIRV_CROSS_ENABLE_C_API"] = False - cmake.definitions["SPIRV_CROSS_ENABLE_UTIL"] = True - cmake.definitions["SPIRV_CROSS_SKIP_INSTALL"] = True - cmake.definitions["SPIRV_CROSS_FORCE_PIC"] = False - cmake.configure(build_folder="build_subfolder_exe") + cmake.configure() cmake.build() def package(self): - 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() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - if self.options.build_executable and not self._are_proper_binaries_available_for_executable: - 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")) + if self.options.shared and self.options.build_executable: + for static_lib in [ + "spirv-cross-core", "spirv-cross-glsl", "spirv-cross-hlsl", "spirv-cross-msl", + "spirv-cross-cpp", "spirv-cross-reflect", "spirv-cross-c", "spirv-cross-util", + ]: + rm(self, f"*{static_lib}.*", os.path.join(self.package_folder, "lib")) # TODO: to remove in conan v2 once legacy generators removed self._create_cmake_module_alias_targets( @@ -219,7 +188,7 @@ def _register_component(target_lib, 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: - libcxx = tools_legacy.stdcpp_library(self) + libcxx = stdcpp_library(self) if libcxx: self.cpp_info.components[target_lib].system_libs.append(libcxx) @@ -234,6 +203,4 @@ def _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(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/spirv-cross/all/patches/0001-fix-bundle-install-20200403.patch b/recipes/spirv-cross/all/patches/0001-fix-bundle-install-20200403.patch deleted file mode 100644 index 9334dea225892..0000000000000 --- a/recipes/spirv-cross/all/patches/0001-fix-bundle-install-20200403.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -433,7 +433,7 @@ if (SPIRV_CROSS_CLI) - target_compile_definitions(spirv-cross PRIVATE ${spirv-compiler-defines} HAVE_SPIRV_CROSS_GIT_VERSION) - set_target_properties(spirv-cross PROPERTIES LINK_FLAGS "${spirv-cross-link-flags}") - if (NOT SPIRV_CROSS_SKIP_INSTALL) -- install(TARGETS spirv-cross RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) -+ install(TARGETS spirv-cross DESTINATION ${CMAKE_INSTALL_BINDIR}) - endif() - target_link_libraries(spirv-cross PRIVATE - spirv-cross-glsl diff --git a/recipes/spirv-cross/all/patches/0001-fix-bundle-install-20210115.patch b/recipes/spirv-cross/all/patches/0001-fix-bundle-install-20210115.patch deleted file mode 100644 index 5a9c531331845..0000000000000 --- a/recipes/spirv-cross/all/patches/0001-fix-bundle-install-20210115.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -441,7 +441,7 @@ if (SPIRV_CROSS_CLI) - target_compile_definitions(spirv-cross PRIVATE ${spirv-compiler-defines} HAVE_SPIRV_CROSS_GIT_VERSION) - set_target_properties(spirv-cross PROPERTIES LINK_FLAGS "${spirv-cross-link-flags}") - if (NOT SPIRV_CROSS_SKIP_INSTALL) -- install(TARGETS spirv-cross RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) -+ install(TARGETS spirv-cross DESTINATION ${CMAKE_INSTALL_BINDIR}) - endif() - target_link_libraries(spirv-cross PRIVATE - spirv-cross-glsl diff --git a/recipes/spirv-cross/all/patches/0001-fix-bundle-install-cci.20210621.patch b/recipes/spirv-cross/all/patches/0001-fix-bundle-install-cci.20210621.patch deleted file mode 100644 index 1e4e265cd5154..0000000000000 --- a/recipes/spirv-cross/all/patches/0001-fix-bundle-install-cci.20210621.patch +++ /dev/null @@ -1,13 +0,0 @@ -fixed in https://github.com/KhronosGroup/SPIRV-Cross/pull/1706 - ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -442,7 +442,7 @@ if (SPIRV_CROSS_CLI) - target_compile_definitions(spirv-cross PRIVATE ${spirv-compiler-defines} HAVE_SPIRV_CROSS_GIT_VERSION) - set_target_properties(spirv-cross PROPERTIES LINK_FLAGS "${spirv-cross-link-flags}") - if (NOT SPIRV_CROSS_SKIP_INSTALL) -- install(TARGETS spirv-cross RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) -+ install(TARGETS spirv-cross DESTINATION ${CMAKE_INSTALL_BINDIR}) - endif() - target_link_libraries(spirv-cross PRIVATE - spirv-cross-glsl 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 deleted file mode 100644 index 70c5857924141..0000000000000 --- a/recipes/spirv-cross/all/patches/1.3.236.0-0001-fix-gcc5.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- 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/config.yml b/recipes/spirv-cross/config.yml index efd74cc767f9f..b8b365f369ae0 100644 --- a/recipes/spirv-cross/config.yml +++ b/recipes/spirv-cross/config.yml @@ -1,31 +1,17 @@ versions: - "1.3.236.0": + "1.3.296.0": + folder: all + "1.3.268.0": folder: all - "1.3.231.1": + "1.3.261.1": folder: all - "1.3.224.0": + "1.3.250.1": folder: all - "1.3.216.0": + "1.3.246.1": folder: all - "1.3.211.0": + "1.3.243.0": folder: all - "1.3.204.0": + "1.3.239.0": folder: all "cci.20211113": folder: all - "cci.20210930": - folder: all - "cci.20210823": - folder: all - "cci.20210621": - folder: all - "20210115": - folder: all - "20200917": - folder: all - "20200629": - folder: all - "20200519": - folder: all - "20200403": - folder: all diff --git a/recipes/spirv-headers/all/conandata.yml b/recipes/spirv-headers/all/conandata.yml index d22eade00a524..20f89cd355d4d 100644 --- a/recipes/spirv-headers/all/conandata.yml +++ b/recipes/spirv-headers/all/conandata.yml @@ -1,43 +1,19 @@ sources: - "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" - "1.3.216.0": - url: "https://github.com/KhronosGroup/SPIRV-Headers/archive/refs/tags/sdk-1.3.216.0.tar.gz" - sha256: "46c49a0e49ea120138102b1dcb3778e5a4f2267c45b9e937810a4cf4fb889e3d" - "1.3.211.0": - url: "https://github.com/KhronosGroup/SPIRV-Headers/archive/refs/tags/sdk-1.3.211.0.tar.gz" - sha256: "30a78e61bd812c75e09fdc7a319af206b1044536326bc3e85fea818376a12568" - "1.3.204.0": - url: "https://github.com/KhronosGroup/SPIRV-Headers/archive/refs/tags/sdk-1.3.204.0.tar.gz" - sha256: "519d09906dcdd4bf27089ff136d4e8c70abe2915bbde17a1d5ac18c5de6aee67" + "1.3.296.0": + url: "https://github.com/KhronosGroup/SPIRV-Headers/archive/refs/tags/vulkan-sdk-1.3.296.0.tar.gz" + sha256: "1423d58a1171611d5aba2bf6f8c69c72ef9c38a0aca12c3493e4fda64c9b2dc6" + "1.3.268.0": + url: "https://github.com/KhronosGroup/SPIRV-Headers/archive/refs/tags/vulkan-sdk-1.3.268.0.tar.gz" + sha256: "1022379e5b920ae21ccfb5cb41e07b1c59352a18c3d3fdcbf38d6ae7733384d4" + "1.3.261.1": + url: "https://github.com/KhronosGroup/SPIRV-Headers/archive/refs/tags/sdk-1.3.261.1.tar.gz" + sha256: "32b4c6ae6a2fa9b56c2c17233c8056da47e331f76e117729925825ea3e77a739" + "1.3.243.0": + url: "https://github.com/KhronosGroup/SPIRV-Headers/archive/refs/tags/sdk-1.3.243.0.tar.gz" + sha256: "16927b1868e7891377d059cd549484e4158912439cf77451ae7e01e2a3bcd28b" + "1.3.239.0": + url: "https://github.com/KhronosGroup/SPIRV-Headers/archive/refs/tags/sdk-1.3.239.0.tar.gz" + sha256: "fdaf6670e311cd1c08ae90bf813e89dd31630205bc60030ffd25fb0af39b51fe" "1.2.198.0": url: "https://github.com/KhronosGroup/SPIRV-Headers/archive/refs/tags/sdk-1.2.198.0.tar.gz" sha256: "3301a23aca0434336a643e433dcacacdd60000ab3dd35dc0078a297c06124a12" - "cci.20211010": - url: "https://github.com/KhronosGroup/SPIRV-Headers/archive/814e728b30ddd0f4509233099a3ad96fd4318c07.tar.gz" - sha256: "c262d3c0c36ad5c87fbe3572aa292d2aed4dcd9b1ca4868eff9ec180e3f994f2" - "cci.20210811": - url: "https://github.com/KhronosGroup/SPIRV-Headers/archive/e71feddb3f17c5586ff7f4cfb5ed1258b800574b.tar.gz" - sha256: "9eb56548460fd8850250ebf78071528fb66c2a5db2ef535edc1d493b2581ec66" - "cci.20210616": - url: "https://github.com/KhronosGroup/SPIRV-Headers/archive/07f259e68af3a540038fa32df522554e74f53ed5.tar.gz" - sha256: "ce7d299c9e688fe536e106605235dbb7f81613daa7995d4d99d002c808f126f8" - "cci.20210414": - url: "https://github.com/KhronosGroup/SPIRV-Headers/archive/dafead1765f6c1a5f9f8a76387dcb2abe4e54acd.tar.gz" - sha256: "e1c8530c95fc8c70fa6a7cbc269ebd1b10da3872efa0e3c6eb82452c3e180cda" - "1.5.4": - url: "https://github.com/KhronosGroup/SPIRV-Headers/archive/1.5.4.tar.gz" - sha256: "fc026b6566167f6db03dc48779f0f986f9ff8c93ed651a557f28cfbe2dff4ede" - "1.5.3": - url: "https://github.com/KhronosGroup/SPIRV-Headers/archive/1.5.3.tar.gz" - sha256: "eece8a9e147d37997d425d5d2eeb2e757ad25adc30d6651467094f3b18609b5a" - "1.5.1": - url: "https://github.com/KhronosGroup/SPIRV-Headers/archive/1.5.1.corrected.tar.gz" - sha256: "2b6a0ce1c02b9fe7b9ef727369168fe579e5256f1ea013993acdb8d8f06b7e89" diff --git a/recipes/spirv-headers/all/conanfile.py b/recipes/spirv-headers/all/conanfile.py index 852af3d493684..0d28680817678 100644 --- a/recipes/spirv-headers/all/conanfile.py +++ b/recipes/spirv-headers/all/conanfile.py @@ -1,6 +1,7 @@ from conan import ConanFile 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" @@ -13,6 +14,7 @@ class SpirvheadersConan(ConanFile): license = "MIT-KhronosGroup" topics = ("spirv", "spirv-v", "vulkan", "opengl", "opencl", "khronos") url = "https://github.com/conan-io/conan-center-index" + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" def layout(self): @@ -22,12 +24,13 @@ 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 generate(self): tc = CMakeToolchain(self) tc.variables["SPIRV_HEADERS_SKIP_EXAMPLES"] = True + if Version(self.version) > "1.3.275.0": + tc.variables["SPIRV_HEADERS_ENABLE_TESTS"] = False tc.generate() def build(self): diff --git a/recipes/spirv-headers/config.yml b/recipes/spirv-headers/config.yml index a72817462daf8..7154e9cb262ce 100644 --- a/recipes/spirv-headers/config.yml +++ b/recipes/spirv-headers/config.yml @@ -1,29 +1,13 @@ versions: - "1.3.236.0": + "1.3.296.0": folder: all - "1.3.231.1": + "1.3.268.0": folder: all - "1.3.224.0": + "1.3.261.1": folder: all - "1.3.216.0": + "1.3.243.0": folder: all - "1.3.211.0": - folder: all - "1.3.204.0": + "1.3.239.0": folder: all "1.2.198.0": folder: all - "cci.20211010": - folder: all - "cci.20210811": - folder: all - "cci.20210616": - folder: all - "cci.20210414": - folder: all - "1.5.4": - folder: all - "1.5.3": - folder: all - "1.5.1": - folder: all diff --git a/recipes/spirv-tools/all/conandata.yml b/recipes/spirv-tools/all/conandata.yml index 53ccca3d5fe72..aec3e6ece4050 100644 --- a/recipes/spirv-tools/all/conandata.yml +++ b/recipes/spirv-tools/all/conandata.yml @@ -1,55 +1,20 @@ +# Add only the SDK release versions from https://github.com/KhronosGroup/SPIRV-Tools/tags for consistency sources: + "1.3.268.0": + url: "https://github.com/KhronosGroup/SPIRV-Tools/archive/refs/tags/vulkan-sdk-1.3.268.0.tar.gz" + sha256: "4c19fdcffb5fe8ef8dc93d7a65ae78b64edc7a5688893ee381c57f70be77deaf" + "1.3.261.1": + url: "https://github.com/KhronosGroup/SPIRV-Tools/archive/refs/tags/sdk-1.3.261.1.tar.gz" + sha256: "ead95c626ad482882a141d1aa0ce47b9453871f72c42c0b28d39c82f60a52008" + "1.3.243.0": + url: "https://github.com/KhronosGroup/SPIRV-Tools/archive/refs/tags/sdk-1.3.243.0.tar.gz" + sha256: "684a29e37bfdc6e151fe1d3ec4b87c5396c17a439de545d81ea05d4ee6fbc86e" + "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" - "1.3.216.0": - url: "https://github.com/KhronosGroup/SPIRV-Tools/archive/refs/tags/sdk-1.3.216.0.tar.gz" - sha256: "b4b9abeb59deda20c41808ac4cd5f9faf6f0a9daa51a8c82e13ca47c045e982f" - "1.3.211.0": - url: "https://github.com/KhronosGroup/SPIRV-Tools/archive/refs/tags/sdk-1.3.211.0.tar.gz" - sha256: "5466e628c92c30aeb45547b9d836dcf7b6249afb94de9dea4ac4449a82202b50" - "1.3.204.0": - url: "https://github.com/KhronosGroup/SPIRV-Tools/archive/refs/tags/sdk-1.3.204.0.tar.gz" - sha256: "86787c26b86e35406020356c9d5e312c65edbd039d0eca5579b21d0ab9795758" - "2021.4": - url: "https://github.com/KhronosGroup/SPIRV-Tools/archive/refs/tags/v2021.4.tar.gz" - sha256: "d68de260708dda785d109ff1ceeecde2d2ab71142fa5bf59061bb9f47dd3bb2c" - "2021.3": - url: "https://github.com/KhronosGroup/SPIRV-Tools/archive/refs/tags/v2021.3.tar.gz" - sha256: "b6b4194121ee8084c62b20f8d574c32f766e4e9237dfe60b0658b316d19c6b13" - "2021.2": - url: "https://github.com/KhronosGroup/SPIRV-Tools/archive/v2021.2.tar.gz" - sha256: "2416a0354a0b14b8e7b671f6f99652cc8a8a83dc9acf195dafd22fbee5e92035" - "2020.5": - url: "https://github.com/KhronosGroup/SPIRV-Tools/archive/v2020.5.tar.gz" - sha256: "947ee994ba416380bd7ccc1c6377ac28a4802a55ca81ccc06796c28e84c00b71" - "2020.3": - url: "https://github.com/KhronosGroup/SPIRV-Tools/archive/v2020.3.tar.gz" - sha256: "8b538a1cb2a4275ef9617abcb047d54e8292f975ac1d93323d5dd1e19c85280b" - "2019.2": - url: "https://github.com/KhronosGroup/SPIRV-Tools/archive/v2019.2.tar.gz" - sha256: "1fde9d2a0df920a401441cd77253fc7b3b9ab0578eabda8caaaceaa6c7638440" -patches: - "2021.4": - - patch_file: "patches/0001-fix-cmake-iOS-tvOS-watchOS-2021.3.patch" - "2021.3": - - patch_file: "patches/0001-fix-cmake-iOS-tvOS-watchOS-2021.3.patch" - "2021.2": - - patch_file: "patches/0001-fix-cmake-iOS-tvOS-watchOS-2021.2.patch" - - patch_file: "patches/0002-allow-more-platforms-2020.3.patch" - "2020.5": - - patch_file: "patches/0001-fix-cmake-iOS-tvOS-watchOS-2020.5.patch" - - patch_file: "patches/0002-allow-more-platforms-2020.3.patch" - - patch_file: "patches/0003-support-SPV_KHR_fragment_shading_rate.patch" - "2020.3": - - patch_file: "patches/0001-fix-cmake-iOS-tvOS-watchOS-2020.3.patch" - - patch_file: "patches/0002-allow-more-platforms-2020.3.patch" - "2019.2": - - patch_file: "patches/0001-fix-cmake-iOS-tvOS-watchOS-2019.2.patch" - - patch_file: "patches/0002-allow-more-platforms-2019.2.patch" + "1.2.198.0": + url: "https://github.com/KhronosGroup/SPIRV-Tools/archive/refs/tags/sdk-1.2.198.0.tar.gz" + sha256: "e8a9fec946f8473129374ad6b98ee690ac9a4574ace7cb3b46bbeb4eddfdc33b" diff --git a/recipes/spirv-tools/all/conanfile.py b/recipes/spirv-tools/all/conanfile.py index 2ad27d812da9b..5530f21ad5289 100644 --- a/recipes/spirv-tools/all/conanfile.py +++ b/recipes/spirv-tools/all/conanfile.py @@ -1,16 +1,14 @@ from conan import ConanFile -from conan.errors import ConanException -from conan.tools.build import check_min_cppstd +from conan.errors import ConanInvalidConfiguration +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, export_conandata_patches, get, replace_in_file, rm, rmdir, save +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import copy, get, replace_in_file, rm, rmdir, save from conan.tools.scm import Version -from conans.tools import stdcpp_library # TODO: import from conan.tools.build in conan 1.54.0 (https://github.com/conan-io/conan/pull/12269) -import functools import os import textwrap -import yaml -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.54.0" class SpirvtoolsConan(ConanFile): @@ -21,6 +19,7 @@ class SpirvtoolsConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" license = "Apache-2.0" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -35,46 +34,21 @@ class SpirvtoolsConan(ConanFile): short_paths = True - @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 - - @property - def _dependencies_filename(self): - return f"dependencies-{self.version}.yml" - @property - @functools.lru_cache(1) - def _dependencies_versions(self): - dependencies_filepath = os.path.join(self.recipe_folder, "dependencies", self._dependencies_filename) - if not os.path.isfile(dependencies_filepath): - raise ConanException(f"Cannot find {dependencies_filepath}") - cached_dependencies = yaml.safe_load(open(dependencies_filepath)) - return cached_dependencies + def _min_cppstd(self): + return "11" if Version(self.version) < "1.3.243" else "17" @property - def _has_spirv_tools_lint(self): - return (Version(self.version) < "2016.6" or # spirv-tools with vulkan versioning - Version(self.version) >= "2021.3") - - @property - def _has_spirv_tools_diff(self): - # TODO: use tools.Version comparison once https://github.com/conan-io/conan/issues/10000 is fixed - return ((self._greater_equal_semver(self.version, "1.3.211") and Version(self.version) < "2016.6") or # spirv-tools with vulkan versioning - Version(self.version) >= "2022.2") - - def export(self): - copy(self, f"dependencies/{self._dependencies_filename}", self.recipe_folder, self.export_folder) - - def export_sources(self): - export_conandata_patches(self) + def _compilers_minimum_version(self): + return { + "17": { + "apple-clang": "10", + "clang": "7" if Version(self.version) >= "1.3.250" else "5", + "gcc": "8" if Version(self.version) >= "1.3.250" else "7", + "msvc": "191", + "Visual Studio": "15", + } + }.get(self._min_cppstd, {}) def config_options(self): if self.settings.os == "Windows": @@ -82,31 +56,35 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + 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: - raise ConanException(f"{recipe_name} is missing in {self._dependencies_filename}") - return f"{recipe_name}/{self._dependencies_versions[recipe_name]}" - def requirements(self): - self.requires(self._require("spirv-headers")) + self.requires(f"spirv-headers/{self.version}") def validate(self): - if self.info.settings.compiler.get_safe("cppstd"): - check_min_cppstd(self, 11) + 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 build_requirements(self): + if Version(self.version) >= "1.3.239": + self.tool_requires("cmake/[>=3.17.2 <4]") 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) #==================== @@ -117,19 +95,11 @@ def generate(self): # of above issue before allowing to build shared for all Spirv-Tools libs. # - Build and package shared libs with all symbols exported # (it would require CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS for msvc) - # Currently this recipe implements the first solution - # - Before 2020.5, the shared lib is always built, but static libs might be built as shared - # with BUILD_SHARED_LIBS injection (which doesn't work due to symbols visibility, at least for msvc) - # - From 2020.5, static and shared libs are fully controlled by upstream CMakeLists.txt - if Version(self.version) >= "2016.6" and Version(self.version) < "2020.5": - tc.blocks.remove("shared") - tc.variables["BUILD_SHARED_LIBS"] = False - # From 2020.6, same behavior than above but through a weird combination + # Static and shared libs are controlled by a weird combination # of SPIRV_TOOLS_BUILD_STATIC and BUILD_SHARED_LIBS. - if Version(self.version) < "2016.6" or Version(self.version) >= "2020.6": - tc.variables["SPIRV_TOOLS_BUILD_STATIC"] = True + tc.variables["SPIRV_TOOLS_BUILD_STATIC"] = True #============ # Required by the project's CMakeLists.txt @@ -146,12 +116,14 @@ 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": + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" + # For iOS/tvOS/watchOS + tc.variables["CMAKE_MACOSX_BUNDLE"] = False tc.generate() def _patch_sources(self): - apply_conandata_patches(self) # CMAKE_POSITION_INDEPENDENT_CODE was set ON for the entire # project in the lists file. replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), @@ -176,6 +148,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", @@ -197,11 +170,9 @@ def package(self): "SPIRV-Tools-opt": "spirv-tools::SPIRV-Tools-opt", "SPIRV-Tools-link": "spirv-tools::SPIRV-Tools-link", "SPIRV-Tools-reduce": "spirv-tools::SPIRV-Tools-reduce", + "SPIRV-Tools-lint": "spirv-tools::SPIRV-Tools-lint", + "SPIRV-Tools-diff": "spirv-tools::SPIRV-Tools-diff", } - if self._has_spirv_tools_lint: - targets.update({"SPIRV-Tools-lint": "spirv-tools::SPIRV-Tools-lint"}) - if self._has_spirv_tools_diff: - targets.update({"SPIRV-Tools-diff": "spirv-tools::SPIRV-Tools-diff"}) self._create_cmake_module_alias_targets( os.path.join(self.package_folder, self._module_file_rel_path), targets, @@ -263,21 +234,17 @@ def package_info(self): self.cpp_info.components["spirv-tools-reduce"].requires = ["spirv-tools-core", "spirv-tools-opt"] # SPIRV-Tools-lint - if self._has_spirv_tools_lint: - self.cpp_info.components["spirv-tools-lint"].set_property("cmake_target_name", "SPIRV-Tools-lint") - self.cpp_info.components["spirv-tools-lint"].libs = ["SPIRV-Tools-lint"] - self.cpp_info.components["spirv-tools-lint"].requires = ["spirv-tools-core", "spirv-tools-opt"] + self.cpp_info.components["spirv-tools-lint"].set_property("cmake_target_name", "SPIRV-Tools-lint") + self.cpp_info.components["spirv-tools-lint"].libs = ["SPIRV-Tools-lint"] + self.cpp_info.components["spirv-tools-lint"].requires = ["spirv-tools-core", "spirv-tools-opt"] # SPIRV-Tools-diff - if self._has_spirv_tools_diff: - self.cpp_info.components["spirv-tools-diff"].set_property("cmake_target_name", "SPIRV-Tools-diff") - self.cpp_info.components["spirv-tools-diff"].libs = ["SPIRV-Tools-diff"] - self.cpp_info.components["spirv-tools-diff"].requires = ["spirv-tools-core", "spirv-tools-opt"] + self.cpp_info.components["spirv-tools-diff"].set_property("cmake_target_name", "SPIRV-Tools-diff") + self.cpp_info.components["spirv-tools-diff"].libs = ["SPIRV-Tools-diff"] + 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" @@ -300,13 +267,14 @@ def package_info(self): self.cpp_info.components["spirv-tools-reduce"].names["cmake_find_package_multi"] = "SPIRV-Tools-reduce" self.cpp_info.components["spirv-tools-reduce"].build_modules["cmake_find_package"] = [self._module_file_rel_path] self.cpp_info.components["spirv-tools-reduce"].build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] - if self._has_spirv_tools_lint: - self.cpp_info.components["spirv-tools-lint"].names["cmake_find_package"] = "SPIRV-Tools-lint" - self.cpp_info.components["spirv-tools-lint"].names["cmake_find_package_multi"] = "SPIRV-Tools-lint" - self.cpp_info.components["spirv-tools-lint"].build_modules["cmake_find_package"] = [self._module_file_rel_path] - self.cpp_info.components["spirv-tools-lint"].build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] - if self._has_spirv_tools_diff: - self.cpp_info.components["spirv-tools-diff"].names["cmake_find_package"] = "SPIRV-Tools-diff" - self.cpp_info.components["spirv-tools-diff"].names["cmake_find_package_multi"] = "SPIRV-Tools-diff" - self.cpp_info.components["spirv-tools-diff"].build_modules["cmake_find_package"] = [self._module_file_rel_path] - self.cpp_info.components["spirv-tools-diff"].build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] + self.cpp_info.components["spirv-tools-lint"].names["cmake_find_package"] = "SPIRV-Tools-lint" + self.cpp_info.components["spirv-tools-lint"].names["cmake_find_package_multi"] = "SPIRV-Tools-lint" + self.cpp_info.components["spirv-tools-lint"].build_modules["cmake_find_package"] = [self._module_file_rel_path] + self.cpp_info.components["spirv-tools-lint"].build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] + self.cpp_info.components["spirv-tools-diff"].names["cmake_find_package"] = "SPIRV-Tools-diff" + self.cpp_info.components["spirv-tools-diff"].names["cmake_find_package_multi"] = "SPIRV-Tools-diff" + self.cpp_info.components["spirv-tools-diff"].build_modules["cmake_find_package"] = [self._module_file_rel_path] + self.cpp_info.components["spirv-tools-diff"].build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] + + if Version(self.version) < "1.3" and not self.options.shared: + del self.cpp_info.components["spirv-tools-diff"] diff --git a/recipes/spirv-tools/all/dependencies/dependencies-1.3.204.0.yml b/recipes/spirv-tools/all/dependencies/dependencies-1.3.204.0.yml deleted file mode 100644 index 43572f8e0b17d..0000000000000 --- a/recipes/spirv-tools/all/dependencies/dependencies-1.3.204.0.yml +++ /dev/null @@ -1 +0,0 @@ -spirv-headers: "1.3.204.0" diff --git a/recipes/spirv-tools/all/dependencies/dependencies-1.3.211.0.yml b/recipes/spirv-tools/all/dependencies/dependencies-1.3.211.0.yml deleted file mode 100644 index 9f7968c50691a..0000000000000 --- a/recipes/spirv-tools/all/dependencies/dependencies-1.3.211.0.yml +++ /dev/null @@ -1 +0,0 @@ -spirv-headers: "1.3.211.0" diff --git a/recipes/spirv-tools/all/dependencies/dependencies-1.3.216.0.yml b/recipes/spirv-tools/all/dependencies/dependencies-1.3.216.0.yml deleted file mode 100644 index 08fc67132f957..0000000000000 --- a/recipes/spirv-tools/all/dependencies/dependencies-1.3.216.0.yml +++ /dev/null @@ -1 +0,0 @@ -spirv-headers: "1.3.216.0" diff --git a/recipes/spirv-tools/all/dependencies/dependencies-1.3.224.0.yml b/recipes/spirv-tools/all/dependencies/dependencies-1.3.224.0.yml deleted file mode 100644 index fbe7be91a9a03..0000000000000 --- a/recipes/spirv-tools/all/dependencies/dependencies-1.3.224.0.yml +++ /dev/null @@ -1 +0,0 @@ -spirv-headers: "1.3.224.0" 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 deleted file mode 100644 index c7958b90b620e..0000000000000 --- a/recipes/spirv-tools/all/dependencies/dependencies-1.3.231.1.yml +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index f9007ad197d24..0000000000000 --- a/recipes/spirv-tools/all/dependencies/dependencies-1.3.236.0.yml +++ /dev/null @@ -1 +0,0 @@ -spirv-headers: "1.3.236.0" diff --git a/recipes/spirv-tools/all/dependencies/dependencies-2019.2.yml b/recipes/spirv-tools/all/dependencies/dependencies-2019.2.yml deleted file mode 100644 index 65a98f17df9ed..0000000000000 --- a/recipes/spirv-tools/all/dependencies/dependencies-2019.2.yml +++ /dev/null @@ -1 +0,0 @@ -spirv-headers: "1.5.1" diff --git a/recipes/spirv-tools/all/dependencies/dependencies-2020.3.yml b/recipes/spirv-tools/all/dependencies/dependencies-2020.3.yml deleted file mode 100644 index 66b9ce2858da6..0000000000000 --- a/recipes/spirv-tools/all/dependencies/dependencies-2020.3.yml +++ /dev/null @@ -1 +0,0 @@ -spirv-headers: "1.5.3" diff --git a/recipes/spirv-tools/all/dependencies/dependencies-2020.5.yml b/recipes/spirv-tools/all/dependencies/dependencies-2020.5.yml deleted file mode 100644 index c1d1a00b17b22..0000000000000 --- a/recipes/spirv-tools/all/dependencies/dependencies-2020.5.yml +++ /dev/null @@ -1 +0,0 @@ -spirv-headers: "1.5.4" diff --git a/recipes/spirv-tools/all/dependencies/dependencies-2021.2.yml b/recipes/spirv-tools/all/dependencies/dependencies-2021.2.yml deleted file mode 100644 index 65339a051aa56..0000000000000 --- a/recipes/spirv-tools/all/dependencies/dependencies-2021.2.yml +++ /dev/null @@ -1 +0,0 @@ -spirv-headers: "cci.20210616" diff --git a/recipes/spirv-tools/all/dependencies/dependencies-2021.3.yml b/recipes/spirv-tools/all/dependencies/dependencies-2021.3.yml deleted file mode 100644 index c2baefe5349ed..0000000000000 --- a/recipes/spirv-tools/all/dependencies/dependencies-2021.3.yml +++ /dev/null @@ -1 +0,0 @@ -spirv-headers: "cci.20210811" diff --git a/recipes/spirv-tools/all/dependencies/dependencies-2021.4.yml b/recipes/spirv-tools/all/dependencies/dependencies-2021.4.yml deleted file mode 100644 index 2657ddb54c2ee..0000000000000 --- a/recipes/spirv-tools/all/dependencies/dependencies-2021.4.yml +++ /dev/null @@ -1 +0,0 @@ -spirv-headers: "1.2.198.0" diff --git a/recipes/spirv-tools/all/patches/0001-fix-cmake-iOS-tvOS-watchOS-2019.2.patch b/recipes/spirv-tools/all/patches/0001-fix-cmake-iOS-tvOS-watchOS-2019.2.patch deleted file mode 100644 index 4aa4e6a793542..0000000000000 --- a/recipes/spirv-tools/all/patches/0001-fix-cmake-iOS-tvOS-watchOS-2019.2.patch +++ /dev/null @@ -1,33 +0,0 @@ -see https://github.com/KhronosGroup/SPIRV-Tools/pull/4619 - ---- a/tools/CMakeLists.txt -+++ b/tools/CMakeLists.txt -@@ -42,7 +42,7 @@ if (NOT ${SPIRV_SKIP_EXECUTABLES}) - add_spvtools_tool(TARGET spirv-dis SRCS dis/dis.cpp LIBS ${SPIRV_TOOLS}) - add_spvtools_tool(TARGET spirv-val SRCS val/val.cpp util/cli_consumer.cpp LIBS ${SPIRV_TOOLS}) - add_spvtools_tool(TARGET spirv-opt SRCS opt/opt.cpp util/cli_consumer.cpp LIBS SPIRV-Tools-opt ${SPIRV_TOOLS}) -- if (NOT DEFINED IOS_PLATFORM) # iOS does not allow std::system calls which spirv-reduce requires -+ if(NOT (${CMAKE_SYSTEM_NAME} STREQUAL "iOS")) # iOS does not allow std::system calls which spirv-reduce requires - add_spvtools_tool(TARGET spirv-reduce SRCS reduce/reduce.cpp util/cli_consumer.cpp LIBS SPIRV-Tools-reduce ${SPIRV_TOOLS}) - endif() - add_spvtools_tool(TARGET spirv-link SRCS link/linker.cpp LIBS SPIRV-Tools-link ${SPIRV_TOOLS}) -@@ -65,7 +65,7 @@ if (NOT ${SPIRV_SKIP_EXECUTABLES}) - - set(SPIRV_INSTALL_TARGETS spirv-as spirv-dis spirv-val spirv-opt spirv-stats - spirv-cfg spirv-link) -- if(NOT DEFINED IOS_PLATFORM) -+ if(NOT (${CMAKE_SYSTEM_NAME} STREQUAL "iOS")) - set(SPIRV_INSTALL_TARGETS ${SPIRV_INSTALL_TARGETS} spirv-reduce) - endif() - -@@ -81,9 +81,6 @@ if (NOT ${SPIRV_SKIP_EXECUTABLES}) - endif(SPIRV_BUILD_COMPRESSION) - - if(ENABLE_SPIRV_TOOLS_INSTALL) -- install(TARGETS ${SPIRV_INSTALL_TARGETS} -- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} -- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} -- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) -+ install(TARGETS ${SPIRV_INSTALL_TARGETS} DESTINATION ${CMAKE_INSTALL_BINDIR}) - endif(ENABLE_SPIRV_TOOLS_INSTALL) - endif() diff --git a/recipes/spirv-tools/all/patches/0001-fix-cmake-iOS-tvOS-watchOS-2020.3.patch b/recipes/spirv-tools/all/patches/0001-fix-cmake-iOS-tvOS-watchOS-2020.3.patch deleted file mode 100644 index a2b20f79bb617..0000000000000 --- a/recipes/spirv-tools/all/patches/0001-fix-cmake-iOS-tvOS-watchOS-2020.3.patch +++ /dev/null @@ -1,33 +0,0 @@ -see https://github.com/KhronosGroup/SPIRV-Tools/pull/4619 - ---- a/tools/CMakeLists.txt -+++ b/tools/CMakeLists.txt -@@ -44,7 +44,7 @@ if (NOT ${SPIRV_SKIP_EXECUTABLES}) - add_spvtools_tool(TARGET spirv-dis SRCS dis/dis.cpp LIBS ${SPIRV_TOOLS}) - add_spvtools_tool(TARGET spirv-val SRCS val/val.cpp util/cli_consumer.cpp LIBS ${SPIRV_TOOLS}) - add_spvtools_tool(TARGET spirv-opt SRCS opt/opt.cpp util/cli_consumer.cpp LIBS SPIRV-Tools-opt ${SPIRV_TOOLS}) -- if (NOT DEFINED IOS_PLATFORM) # iOS does not allow std::system calls which spirv-reduce requires -+ if(NOT (${CMAKE_SYSTEM_NAME} STREQUAL "iOS")) # iOS does not allow std::system calls which spirv-reduce requires - add_spvtools_tool(TARGET spirv-reduce SRCS reduce/reduce.cpp util/cli_consumer.cpp LIBS SPIRV-Tools-reduce ${SPIRV_TOOLS}) - endif() - add_spvtools_tool(TARGET spirv-link SRCS link/linker.cpp LIBS SPIRV-Tools-link ${SPIRV_TOOLS}) -@@ -57,7 +57,7 @@ if (NOT ${SPIRV_SKIP_EXECUTABLES}) - ${SPIRV_HEADER_INCLUDE_DIR}) - set(SPIRV_INSTALL_TARGETS spirv-as spirv-dis spirv-val spirv-opt - spirv-cfg spirv-link) -- if(NOT DEFINED IOS_PLATFORM) -+ if(NOT (${CMAKE_SYSTEM_NAME} STREQUAL "iOS")) - set(SPIRV_INSTALL_TARGETS ${SPIRV_INSTALL_TARGETS} spirv-reduce) - endif() - -@@ -67,9 +67,6 @@ if (NOT ${SPIRV_SKIP_EXECUTABLES}) - endif(SPIRV_BUILD_FUZZER) - - if(ENABLE_SPIRV_TOOLS_INSTALL) -- install(TARGETS ${SPIRV_INSTALL_TARGETS} -- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} -- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} -- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) -+ install(TARGETS ${SPIRV_INSTALL_TARGETS} DESTINATION ${CMAKE_INSTALL_BINDIR}) - endif(ENABLE_SPIRV_TOOLS_INSTALL) - endif() diff --git a/recipes/spirv-tools/all/patches/0001-fix-cmake-iOS-tvOS-watchOS-2020.5.patch b/recipes/spirv-tools/all/patches/0001-fix-cmake-iOS-tvOS-watchOS-2020.5.patch deleted file mode 100644 index feb4ac759d93f..0000000000000 --- a/recipes/spirv-tools/all/patches/0001-fix-cmake-iOS-tvOS-watchOS-2020.5.patch +++ /dev/null @@ -1,33 +0,0 @@ -see https://github.com/KhronosGroup/SPIRV-Tools/pull/4619 - ---- a/tools/CMakeLists.txt -+++ b/tools/CMakeLists.txt -@@ -44,7 +44,7 @@ if (NOT ${SPIRV_SKIP_EXECUTABLES}) - add_spvtools_tool(TARGET spirv-dis SRCS dis/dis.cpp LIBS ${SPIRV_TOOLS}-static) - add_spvtools_tool(TARGET spirv-val SRCS val/val.cpp util/cli_consumer.cpp LIBS ${SPIRV_TOOLS}-static) - add_spvtools_tool(TARGET spirv-opt SRCS opt/opt.cpp util/cli_consumer.cpp LIBS SPIRV-Tools-opt ${SPIRV_TOOLS}-static) -- if (NOT DEFINED IOS_PLATFORM) # iOS does not allow std::system calls which spirv-reduce requires -+ if(NOT (${CMAKE_SYSTEM_NAME} STREQUAL "iOS")) # iOS does not allow std::system calls which spirv-reduce requires - add_spvtools_tool(TARGET spirv-reduce SRCS reduce/reduce.cpp util/cli_consumer.cpp LIBS SPIRV-Tools-reduce ${SPIRV_TOOLS}-static) - endif() - add_spvtools_tool(TARGET spirv-link SRCS link/linker.cpp LIBS SPIRV-Tools-link ${SPIRV_TOOLS}-static) -@@ -57,7 +57,7 @@ if (NOT ${SPIRV_SKIP_EXECUTABLES}) - ${SPIRV_HEADER_INCLUDE_DIR}) - set(SPIRV_INSTALL_TARGETS spirv-as spirv-dis spirv-val spirv-opt - spirv-cfg spirv-link) -- if(NOT DEFINED IOS_PLATFORM) -+ if(NOT (${CMAKE_SYSTEM_NAME} STREQUAL "iOS")) - set(SPIRV_INSTALL_TARGETS ${SPIRV_INSTALL_TARGETS} spirv-reduce) - endif() - -@@ -67,9 +67,6 @@ if (NOT ${SPIRV_SKIP_EXECUTABLES}) - endif(SPIRV_BUILD_FUZZER) - - if(ENABLE_SPIRV_TOOLS_INSTALL) -- install(TARGETS ${SPIRV_INSTALL_TARGETS} -- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} -- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} -- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) -+ install(TARGETS ${SPIRV_INSTALL_TARGETS} DESTINATION ${CMAKE_INSTALL_BINDIR}) - endif(ENABLE_SPIRV_TOOLS_INSTALL) - endif() diff --git a/recipes/spirv-tools/all/patches/0001-fix-cmake-iOS-tvOS-watchOS-2021.2.patch b/recipes/spirv-tools/all/patches/0001-fix-cmake-iOS-tvOS-watchOS-2021.2.patch deleted file mode 100644 index c5c15677ae55a..0000000000000 --- a/recipes/spirv-tools/all/patches/0001-fix-cmake-iOS-tvOS-watchOS-2021.2.patch +++ /dev/null @@ -1,33 +0,0 @@ -see https://github.com/KhronosGroup/SPIRV-Tools/pull/4619 - ---- a/tools/CMakeLists.txt -+++ b/tools/CMakeLists.txt -@@ -44,7 +44,7 @@ if (NOT ${SPIRV_SKIP_EXECUTABLES}) - add_spvtools_tool(TARGET spirv-dis SRCS dis/dis.cpp LIBS ${SPIRV_TOOLS_FULL_VISIBILITY}) - add_spvtools_tool(TARGET spirv-val SRCS val/val.cpp util/cli_consumer.cpp LIBS ${SPIRV_TOOLS_FULL_VISIBILITY}) - add_spvtools_tool(TARGET spirv-opt SRCS opt/opt.cpp util/cli_consumer.cpp LIBS SPIRV-Tools-opt ${SPIRV_TOOLS_FULL_VISIBILITY}) -- if (NOT DEFINED IOS_PLATFORM) # iOS does not allow std::system calls which spirv-reduce requires -+ if(NOT (${CMAKE_SYSTEM_NAME} STREQUAL "iOS")) # iOS does not allow std::system calls which spirv-reduce requires - add_spvtools_tool(TARGET spirv-reduce SRCS reduce/reduce.cpp util/cli_consumer.cpp LIBS SPIRV-Tools-reduce ${SPIRV_TOOLS_FULL_VISIBILITY}) - endif() - add_spvtools_tool(TARGET spirv-link SRCS link/linker.cpp LIBS SPIRV-Tools-link ${SPIRV_TOOLS_FULL_VISIBILITY}) -@@ -57,7 +57,7 @@ if (NOT ${SPIRV_SKIP_EXECUTABLES}) - ${SPIRV_HEADER_INCLUDE_DIR}) - set(SPIRV_INSTALL_TARGETS spirv-as spirv-dis spirv-val spirv-opt - spirv-cfg spirv-link) -- if(NOT DEFINED IOS_PLATFORM) -+ if(NOT (${CMAKE_SYSTEM_NAME} STREQUAL "iOS")) - set(SPIRV_INSTALL_TARGETS ${SPIRV_INSTALL_TARGETS} spirv-reduce) - endif() - -@@ -67,9 +67,6 @@ if (NOT ${SPIRV_SKIP_EXECUTABLES}) - endif(SPIRV_BUILD_FUZZER) - - if(ENABLE_SPIRV_TOOLS_INSTALL) -- install(TARGETS ${SPIRV_INSTALL_TARGETS} -- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} -- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} -- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) -+ install(TARGETS ${SPIRV_INSTALL_TARGETS} DESTINATION ${CMAKE_INSTALL_BINDIR}) - endif(ENABLE_SPIRV_TOOLS_INSTALL) - endif() diff --git a/recipes/spirv-tools/all/patches/0001-fix-cmake-iOS-tvOS-watchOS-2021.3.patch b/recipes/spirv-tools/all/patches/0001-fix-cmake-iOS-tvOS-watchOS-2021.3.patch deleted file mode 100644 index 69bc71bb9381d..0000000000000 --- a/recipes/spirv-tools/all/patches/0001-fix-cmake-iOS-tvOS-watchOS-2021.3.patch +++ /dev/null @@ -1,33 +0,0 @@ -see https://github.com/KhronosGroup/SPIRV-Tools/pull/4619 - ---- a/tools/CMakeLists.txt -+++ b/tools/CMakeLists.txt -@@ -44,7 +44,7 @@ if (NOT ${SPIRV_SKIP_EXECUTABLES}) - add_spvtools_tool(TARGET spirv-dis SRCS dis/dis.cpp LIBS ${SPIRV_TOOLS_FULL_VISIBILITY}) - add_spvtools_tool(TARGET spirv-val SRCS val/val.cpp util/cli_consumer.cpp LIBS ${SPIRV_TOOLS_FULL_VISIBILITY}) - add_spvtools_tool(TARGET spirv-opt SRCS opt/opt.cpp util/cli_consumer.cpp LIBS SPIRV-Tools-opt ${SPIRV_TOOLS_FULL_VISIBILITY}) -- if (NOT DEFINED IOS_PLATFORM) # iOS does not allow std::system calls which spirv-reduce requires -+ if(NOT (${CMAKE_SYSTEM_NAME} STREQUAL "iOS")) # iOS does not allow std::system calls which spirv-reduce requires - add_spvtools_tool(TARGET spirv-reduce SRCS reduce/reduce.cpp util/cli_consumer.cpp LIBS SPIRV-Tools-reduce ${SPIRV_TOOLS_FULL_VISIBILITY}) - endif() - add_spvtools_tool(TARGET spirv-link SRCS link/linker.cpp LIBS SPIRV-Tools-link ${SPIRV_TOOLS_FULL_VISIBILITY}) -@@ -58,7 +58,7 @@ if (NOT ${SPIRV_SKIP_EXECUTABLES}) - ${SPIRV_HEADER_INCLUDE_DIR}) - set(SPIRV_INSTALL_TARGETS spirv-as spirv-dis spirv-val spirv-opt - spirv-cfg spirv-link spirv-lint) -- if(NOT DEFINED IOS_PLATFORM) -+ if(NOT (${CMAKE_SYSTEM_NAME} STREQUAL "iOS")) - set(SPIRV_INSTALL_TARGETS ${SPIRV_INSTALL_TARGETS} spirv-reduce) - endif() - -@@ -68,9 +68,6 @@ if (NOT ${SPIRV_SKIP_EXECUTABLES}) - endif(SPIRV_BUILD_FUZZER) - - if(ENABLE_SPIRV_TOOLS_INSTALL) -- install(TARGETS ${SPIRV_INSTALL_TARGETS} -- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} -- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} -- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) -+ install(TARGETS ${SPIRV_INSTALL_TARGETS} DESTINATION ${CMAKE_INSTALL_BINDIR}) - endif(ENABLE_SPIRV_TOOLS_INSTALL) - endif() diff --git a/recipes/spirv-tools/all/patches/0002-allow-more-platforms-2019.2.patch b/recipes/spirv-tools/all/patches/0002-allow-more-platforms-2019.2.patch deleted file mode 100644 index aa84eb941b534..0000000000000 --- a/recipes/spirv-tools/all/patches/0002-allow-more-platforms-2019.2.patch +++ /dev/null @@ -1,46 +0,0 @@ -from: -https://github.com/KhronosGroup/SPIRV-Tools/pull/2948 -https://github.com/KhronosGroup/SPIRV-Tools/pull/3001 -https://github.com/KhronosGroup/SPIRV-Tools/pull/3062 -https://github.com/KhronosGroup/SPIRV-Tools/pull/4329 - ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -39,17 +39,25 @@ option(SPIRV_ALLOW_TIMERS "Allow timers via clock_gettime on supported platforms - if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") - add_definitions(-DSPIRV_LINUX) - set(SPIRV_TIMER_ENABLED ${SPIRV_ALLOW_TIMERS}) -+elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Emscripten") -+ add_definitions(-DSPIRV_EMSCRIPTEN) - elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") - add_definitions(-DSPIRV_WINDOWS) - elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN") - add_definitions(-DSPIRV_WINDOWS) - elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin") - add_definitions(-DSPIRV_MAC) -+elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "iOS") -+ add_definitions(-DSPIRV_IOS) -+elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "tvOS") -+ add_definitions(-DSPIRV_TVOS) - elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Android") - add_definitions(-DSPIRV_ANDROID) - set(SPIRV_TIMER_ENABLED ${SPIRV_ALLOW_TIMERS}) - elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD") - add_definitions(-DSPIRV_FREEBSD) -+elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Fuchsia") -+ add_definitions(-DSPIRV_FUCHSIA) - else() - message(FATAL_ERROR "Your platform '${CMAKE_SYSTEM_NAME}' is not supported!") - endif() ---- a/source/print.cpp -+++ b/source/print.cpp -@@ -15,7 +15,8 @@ - #include "source/print.h" - - #if defined(SPIRV_ANDROID) || defined(SPIRV_LINUX) || defined(SPIRV_MAC) || \ -- defined(SPIRV_FREEBSD) -+ defined(SPIRV_IOS) || defined(SPIRV_TVOS) || defined(SPIRV_FREEBSD) || \ -+ defined(SPIRV_EMSCRIPTEN) || defined(SPIRV_FUCHSIA) - namespace spvtools { - - clr::reset::operator const char*() { return "\x1b[0m"; } diff --git a/recipes/spirv-tools/all/patches/0002-allow-more-platforms-2020.3.patch b/recipes/spirv-tools/all/patches/0002-allow-more-platforms-2020.3.patch deleted file mode 100644 index d20929a790776..0000000000000 --- a/recipes/spirv-tools/all/patches/0002-allow-more-platforms-2020.3.patch +++ /dev/null @@ -1,24 +0,0 @@ -from https://github.com/KhronosGroup/SPIRV-Tools/pull/4329 - ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -48,6 +48,8 @@ elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin") - add_definitions(-DSPIRV_MAC) - elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "iOS") - add_definitions(-DSPIRV_IOS) -+elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "tvOS") -+ add_definitions(-DSPIRV_TVOS) - elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Android") - add_definitions(-DSPIRV_ANDROID) - set(SPIRV_TIMER_ENABLED ${SPIRV_ALLOW_TIMERS}) ---- a/source/print.cpp -+++ b/source/print.cpp -@@ -15,7 +15,7 @@ - #include "source/print.h" - - #if defined(SPIRV_ANDROID) || defined(SPIRV_LINUX) || defined(SPIRV_MAC) || \ -- defined(SPIRV_IOS) || defined(SPIRV_FREEBSD) || \ -+ defined(SPIRV_IOS) || defined(SPIRV_TVOS) || defined(SPIRV_FREEBSD) || \ - defined(SPIRV_EMSCRIPTEN) || defined(SPIRV_FUCHSIA) - namespace spvtools { - diff --git a/recipes/spirv-tools/all/patches/0003-support-SPV_KHR_fragment_shading_rate.patch b/recipes/spirv-tools/all/patches/0003-support-SPV_KHR_fragment_shading_rate.patch deleted file mode 100644 index 67d7765e7856e..0000000000000 --- a/recipes/spirv-tools/all/patches/0003-support-SPV_KHR_fragment_shading_rate.patch +++ /dev/null @@ -1,243 +0,0 @@ -Patch from 2 PR: -https://github.com/KhronosGroup/SPIRV-Tools/pull/3943 -https://github.com/KhronosGroup/SPIRV-Tools/pull/4014 -Mandatory in v2020.5 with spirv-headers 1.5.4, otherwise compilation fails -with 'SPV_OPERAND_TYPE_FRAGMENT_SHADING_RATE': undeclared identifier ---- a/include/spirv-tools/libspirv.h -+++ b/include/spirv-tools/libspirv.h -@@ -182,6 +182,7 @@ typedef enum spv_operand_type_t { - SPV_OPERAND_TYPE_LOOP_CONTROL, // SPIR-V Sec 3.23 - SPV_OPERAND_TYPE_FUNCTION_CONTROL, // SPIR-V Sec 3.24 - SPV_OPERAND_TYPE_MEMORY_ACCESS, // SPIR-V Sec 3.26 -+ SPV_OPERAND_TYPE_FRAGMENT_SHADING_RATE, // SPIR-V Sec 3.FSR - - // The remaining operand types are only used internally by the assembler. - // There are two categories: ---- a/source/operand.cpp -+++ b/source/operand.cpp -@@ -208,6 +208,8 @@ const char* spvOperandTypeStr(spv_operand_type_t type) { - case SPV_OPERAND_TYPE_MEMORY_ACCESS: - case SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS: - return "memory access"; -+ case SPV_OPERAND_TYPE_FRAGMENT_SHADING_RATE: -+ return "shading rate"; - case SPV_OPERAND_TYPE_SCOPE_ID: - return "scope ID"; - case SPV_OPERAND_TYPE_GROUP_OPERATION: -@@ -360,6 +362,7 @@ bool spvOperandIsConcreteMask(spv_operand_type_t type) { - case SPV_OPERAND_TYPE_LOOP_CONTROL: - case SPV_OPERAND_TYPE_FUNCTION_CONTROL: - case SPV_OPERAND_TYPE_MEMORY_ACCESS: -+ case SPV_OPERAND_TYPE_FRAGMENT_SHADING_RATE: - case SPV_OPERAND_TYPE_DEBUG_INFO_FLAGS: - case SPV_OPERAND_TYPE_CLDEBUG100_DEBUG_INFO_FLAGS: - return true; ---- a/source/val/validate_builtins.cpp -+++ b/source/val/validate_builtins.cpp -@@ -230,6 +230,12 @@ class BuiltInsValidator { - spv_result_t ValidateComputeI32InputAtDefinition(const Decoration& decoration, - const Instruction& inst); - -+ spv_result_t ValidatePrimitiveShadingRateAtDefinition( -+ const Decoration& decoration, const Instruction& inst); -+ -+ spv_result_t ValidateShadingRateAtDefinition(const Decoration& decoration, -+ const Instruction& inst); -+ - // The following section contains functions which are called when id defined - // by |referenced_inst| is - // 1. referenced by |referenced_from_inst| -@@ -383,6 +389,16 @@ class BuiltInsValidator { - const Instruction& referenced_inst, - const Instruction& referenced_from_inst); - -+ spv_result_t ValidatePrimitiveShadingRateAtReference( -+ const Decoration& decoration, const Instruction& built_in_inst, -+ const Instruction& referenced_inst, -+ const Instruction& referenced_from_inst); -+ -+ spv_result_t ValidateShadingRateAtReference( -+ const Decoration& decoration, const Instruction& built_in_inst, -+ const Instruction& referenced_inst, -+ const Instruction& referenced_from_inst); -+ - // Validates that |built_in_inst| is not (even indirectly) referenced from - // within a function which can be called with |execution_model|. - // -@@ -3314,6 +3330,142 @@ spv_result_t BuiltInsValidator::ValidateSMBuiltinsAtReference( - return SPV_SUCCESS; - } - -+spv_result_t BuiltInsValidator::ValidatePrimitiveShadingRateAtDefinition( -+ const Decoration& decoration, const Instruction& inst) { -+ if (spvIsVulkanEnv(_.context()->target_env)) { -+ if (spv_result_t error = ValidateI32( -+ decoration, inst, -+ [this, &inst, -+ &decoration](const std::string& message) -> spv_result_t { -+ return _.diag(SPV_ERROR_INVALID_DATA, &inst) -+ << _.VkErrorID(4486) -+ << "According to the Vulkan spec BuiltIn " -+ << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, -+ decoration.params()[0]) -+ << " variable needs to be a 32-bit int scalar. " -+ << message; -+ })) { -+ return error; -+ } -+ } -+ -+ // Seed at reference checks with this built-in. -+ return ValidatePrimitiveShadingRateAtReference(decoration, inst, inst, inst); -+} -+ -+spv_result_t BuiltInsValidator::ValidatePrimitiveShadingRateAtReference( -+ const Decoration& decoration, const Instruction& built_in_inst, -+ const Instruction& referenced_inst, -+ const Instruction& referenced_from_inst) { -+ if (spvIsVulkanEnv(_.context()->target_env)) { -+ const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); -+ if (storage_class != SpvStorageClassMax && -+ storage_class != SpvStorageClassOutput) { -+ return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) -+ << _.VkErrorID(4485) << "Vulkan spec allows BuiltIn " -+ << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, -+ decoration.params()[0]) -+ << " to be only used for variables with Output storage class. " -+ << GetReferenceDesc(decoration, built_in_inst, referenced_inst, -+ referenced_from_inst) -+ << " " << GetStorageClassDesc(referenced_from_inst); -+ } -+ -+ for (const SpvExecutionModel execution_model : execution_models_) { -+ switch (execution_model) { -+ case SpvExecutionModelVertex: -+ case SpvExecutionModelGeometry: -+ case SpvExecutionModelMeshNV: -+ break; -+ default: { -+ return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) -+ << _.VkErrorID(4484) << "Vulkan spec allows BuiltIn " -+ << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, -+ decoration.params()[0]) -+ << " to be used only with Vertex, Geometry, or MeshNV " -+ "execution models. " -+ << GetReferenceDesc(decoration, built_in_inst, referenced_inst, -+ referenced_from_inst, execution_model); -+ } -+ } -+ } -+ } -+ -+ if (function_id_ == 0) { -+ // Propagate this rule to all dependant ids in the global scope. -+ id_to_at_reference_checks_[referenced_from_inst.id()].push_back( -+ std::bind(&BuiltInsValidator::ValidatePrimitiveShadingRateAtReference, -+ this, decoration, built_in_inst, referenced_from_inst, -+ std::placeholders::_1)); -+ } -+ -+ return SPV_SUCCESS; -+} -+ -+spv_result_t BuiltInsValidator::ValidateShadingRateAtDefinition( -+ const Decoration& decoration, const Instruction& inst) { -+ if (spvIsVulkanEnv(_.context()->target_env)) { -+ if (spv_result_t error = ValidateI32( -+ decoration, inst, -+ [this, &inst, -+ &decoration](const std::string& message) -> spv_result_t { -+ return _.diag(SPV_ERROR_INVALID_DATA, &inst) -+ << _.VkErrorID(4492) -+ << "According to the Vulkan spec BuiltIn " -+ << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, -+ decoration.params()[0]) -+ << " variable needs to be a 32-bit int scalar. " -+ << message; -+ })) { -+ return error; -+ } -+ } -+ -+ // Seed at reference checks with this built-in. -+ return ValidateShadingRateAtReference(decoration, inst, inst, inst); -+} -+ -+spv_result_t BuiltInsValidator::ValidateShadingRateAtReference( -+ const Decoration& decoration, const Instruction& built_in_inst, -+ const Instruction& referenced_inst, -+ const Instruction& referenced_from_inst) { -+ if (spvIsVulkanEnv(_.context()->target_env)) { -+ const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); -+ if (storage_class != SpvStorageClassMax && -+ storage_class != SpvStorageClassInput) { -+ return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) -+ << _.VkErrorID(4491) << "Vulkan spec allows BuiltIn " -+ << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, -+ decoration.params()[0]) -+ << " to be only used for variables with Input storage class. " -+ << GetReferenceDesc(decoration, built_in_inst, referenced_inst, -+ referenced_from_inst) -+ << " " << GetStorageClassDesc(referenced_from_inst); -+ } -+ -+ for (const SpvExecutionModel execution_model : execution_models_) { -+ if (execution_model != SpvExecutionModelFragment) { -+ return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) -+ << _.VkErrorID(4490) << "Vulkan spec allows BuiltIn " -+ << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, -+ decoration.params()[0]) -+ << " to be used only with the Fragment execution model. " -+ << GetReferenceDesc(decoration, built_in_inst, referenced_inst, -+ referenced_from_inst, execution_model); -+ } -+ } -+ } -+ -+ if (function_id_ == 0) { -+ // Propagate this rule to all dependant ids in the global scope. -+ id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind( -+ &BuiltInsValidator::ValidateShadingRateAtReference, this, decoration, -+ built_in_inst, referenced_from_inst, std::placeholders::_1)); -+ } -+ -+ return SPV_SUCCESS; -+} -+ - spv_result_t BuiltInsValidator::ValidateSingleBuiltInAtDefinition( - const Decoration& decoration, const Instruction& inst) { - const SpvBuiltIn label = SpvBuiltIn(decoration.params()[0]); -@@ -3515,6 +3667,12 @@ spv_result_t BuiltInsValidator::ValidateSingleBuiltInAtDefinition( - // No validation rules (for the moment). - break; - } -+ case SpvBuiltInPrimitiveShadingRateKHR: { -+ return ValidatePrimitiveShadingRateAtDefinition(decoration, inst); -+ } -+ case SpvBuiltInShadingRateKHR: { -+ return ValidateShadingRateAtDefinition(decoration, inst); -+ } - } - return SPV_SUCCESS; - } ---- a/source/val/validation_state.cpp -+++ b/source/val/validation_state.cpp -@@ -1517,6 +1517,18 @@ std::string ValidationState_t::VkErrorID(uint32_t id, - return VUID_WRAP(VUID-WorkgroupSize-WorkgroupSize-04426); - case 4427: - return VUID_WRAP(VUID-WorkgroupSize-WorkgroupSize-04427); -+ case 4484: -+ return VUID_WRAP(VUID-PrimitiveShadingRateKHR-PrimitiveShadingRateKHR-04484); -+ case 4485: -+ return VUID_WRAP(VUID-PrimitiveShadingRateKHR-PrimitiveShadingRateKHR-04485); -+ case 4486: -+ return VUID_WRAP(VUID-PrimitiveShadingRateKHR-PrimitiveShadingRateKHR-04486); -+ case 4490: -+ return VUID_WRAP(VUID-ShadingRateKHR-ShadingRateKHR-04490); -+ case 4491: -+ return VUID_WRAP(VUID-ShadingRateKHR-ShadingRateKHR-04491); -+ case 4492: -+ return VUID_WRAP(VUID-ShadingRateKHR-ShadingRateKHR-04492); - default: - return ""; // unknown id - }; diff --git a/recipes/spirv-tools/all/test_package/CMakeLists.txt b/recipes/spirv-tools/all/test_package/CMakeLists.txt index cd25f7b050b0e..71afec6288abe 100644 --- a/recipes/spirv-tools/all/test_package/CMakeLists.txt +++ b/recipes/spirv-tools/all/test_package/CMakeLists.txt @@ -16,5 +16,9 @@ endif() if(TARGET SPIRV-Tools-opt) add_executable(${PROJECT_NAME}_cpp test_package.cpp) target_link_libraries(${PROJECT_NAME}_cpp PRIVATE SPIRV-Tools-opt) - target_compile_features(${PROJECT_NAME}_cpp PRIVATE cxx_std_11) + if(SPIRV-Tools_VERSION VERSION_LESS "1.3.243.0") + target_compile_features(${PROJECT_NAME}_cpp PRIVATE cxx_std_11) + else() + target_compile_features(${PROJECT_NAME}_cpp PRIVATE cxx_std_17) + endif() endif() diff --git a/recipes/spirv-tools/config.yml b/recipes/spirv-tools/config.yml index 3b316bc946761..87519b61c9623 100644 --- a/recipes/spirv-tools/config.yml +++ b/recipes/spirv-tools/config.yml @@ -1,25 +1,13 @@ versions: - "1.3.236.0": - folder: all - "1.3.231.1": - folder: all - "1.3.224.0": - folder: all - "1.3.216.0": + "1.3.268.0": folder: all - "1.3.211.0": + "1.3.261.1": folder: all - "1.3.204.0": + "1.3.243.0": folder: all - "2021.4": + "1.3.239.0": folder: all - "2021.3": - folder: all - "2021.2": - folder: all - "2020.5": - folder: all - "2020.3": + "1.3.236.0": folder: all - "2019.2": + "1.2.198.0": folder: all diff --git a/recipes/spix/all/conandata.yml b/recipes/spix/all/conandata.yml index ff0ecd093dc69..40af11d5a96ee 100644 --- a/recipes/spix/all/conandata.yml +++ b/recipes/spix/all/conandata.yml @@ -2,8 +2,12 @@ sources: "0.4": url: "https://github.com/faaxm/spix/archive/refs/tags/v0.4.tar.gz" sha256: "e787c08840c37e5b153c0139f3bb613a2729ae8f6ccd0fb450fef92971cd8b53" -patches: - "0.4": - - patch_file: "patches/0001-use-conan-libs-0.4.patch" - patch_description: "Link to conan libs" - patch_type: "conan" + "0.5": + url: "https://github.com/faaxm/spix/archive/refs/tags/v0.5.tar.gz" + sha256: "d3fd9bb069aef6ff6c93c69524ed3603afd24e6b52e4bb8d093c80cec255d4dc" + "0.6": + url: "https://github.com/faaxm/spix/archive/refs/tags/v0.6.tar.gz" + sha256: "5b2f4b89e112f3b31d8576923c2ac4a6913ae3c2a0042640846a65c4af39ac05" + "0.7": + url: "https://github.com/faaxm/spix/archive/refs/tags/v0.7.tar.gz" + sha256: "a5b290d4959d1e57397eb2b03fb8965150cd3f0c18c13933dbbd4f75a09e8437" diff --git a/recipes/spix/all/conanfile.py b/recipes/spix/all/conanfile.py index b91ead2c5c6d3..a7b8b05ad6264 100644 --- a/recipes/spix/all/conanfile.py +++ b/recipes/spix/all/conanfile.py @@ -1,13 +1,13 @@ 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.files import 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.52.0" +required_conan_version = ">=1.53.0" class SpixConan(ConanFile): @@ -29,19 +29,26 @@ class SpixConan(ConanFile): @property def _minimum_cpp_standard(self): - return 14 + return 14 if self.version == "0.4" else 17 @property def _compilers_minimum_version(self): - return { - "Visual Studio": "14", - "gcc": "5", - "clang": "3.4", - "apple-clang": "10" - } - - def export_sources(self): - export_conandata_patches(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 config_options(self): if self.settings.os == "Windows": @@ -49,35 +56,31 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + 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.3.1") - self.requires("expat/2.4.9") - + self.requires("qt/6.6.1") + def validate(self): - if self.info.settings.compiler.cppstd: + if self.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: + 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: + if Version(self.dependencies["qt"].ref.version).major == 6 and not self.dependencies["qt"].options.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): + if not (self.dependencies["qt"].options.gui and self.dependencies["qt"].options.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], 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,12 +90,15 @@ def generate(self): 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 Version(self.deps_cpp_info["qt"].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)") + rmdir(self, os.path.join(self.source_folder, "cmake", "modules")) + 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() @@ -114,9 +120,9 @@ def package(self): def package_info(self): self.cpp_info.libs = ["Spix"] - self.cpp_info.set_property("cmake_file_name", "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 deleted file mode 100644 index d150594e10d1e..0000000000000 --- a/recipes/spix/all/patches/0001-use-conan-libs-0.4.patch +++ /dev/null @@ -1,35 +0,0 @@ ---- 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/lib/CMakeLists.txt b/lib/CMakeLists.txt -index 723de5e..f234bec 100644 ---- a/lib/CMakeLists.txt -+++ b/lib/CMakeLists.txt -@@ -8,7 +8,7 @@ include(CMakePackageConfigHelpers) - # Dependencies - # - find_package(Threads REQUIRED) --find_package(AnyRPC REQUIRED) -+find_package(anyrpc REQUIRED) - find_package(Qt${SPIX_QT_MAJOR} - COMPONENTS - Core -@@ -128,7 +128,7 @@ target_link_libraries(Spix - Qt${SPIX_QT_MAJOR}::Gui - Qt${SPIX_QT_MAJOR}::Quick - PRIVATE -- AnyRPC::anyrpc -+ anyrpc::anyrpc - ) - - # --- -2.36.1.windows.1 - diff --git a/recipes/spix/all/test_package/CMakeLists.txt b/recipes/spix/all/test_package/CMakeLists.txt index f4d576ca7ff77..8b674ce10f424 100644 --- a/recipes/spix/all/test_package/CMakeLists.txt +++ b/recipes/spix/all/test_package/CMakeLists.txt @@ -6,4 +6,4 @@ 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_14) +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 index f3a70da6e11bc..ec84e70261ab1 100644 --- a/recipes/spix/all/test_package/conanfile.py +++ b/recipes/spix/all/test_package/conanfile.py @@ -1,8 +1,6 @@ from conan import ConanFile from conan.tools.build import can_run from conan.tools.cmake import cmake_layout, CMake -from conan.tools.files import replace_in_file -from conan.tools.scm import Version import os @@ -17,12 +15,7 @@ def requirements(self): def layout(self): cmake_layout(self) - def _patch_sources(self): - if Version(self.deps_cpp_info["qt"].version).major == 6: - replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "cxx_std_14", "cxx_std_17") - def build(self): - self._patch_sources() cmake = CMake(self) cmake.configure() cmake.build() diff --git a/recipes/spix/all/test_v1_package/conanfile.py b/recipes/spix/all/test_v1_package/conanfile.py index 5f9491697c82b..c71bbcebecf4a 100644 --- a/recipes/spix/all/test_v1_package/conanfile.py +++ b/recipes/spix/all/test_v1_package/conanfile.py @@ -1,7 +1,5 @@ from conans import ConanFile, CMake from conan.tools.build import cross_building -from conan.tools.files import replace_in_file -from conan.tools.scm import Version import os @@ -9,12 +7,7 @@ class TestSpixV1Conan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "cmake", "cmake_find_package_multi" - def _patch_sources(self): - if Version(self.deps_cpp_info["qt"].version).major == 6: - replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "cxx_std_14", "cxx_std_17") - def build(self): - self._patch_sources() cmake = CMake(self) cmake.configure() cmake.build() diff --git a/recipes/spix/config.yml b/recipes/spix/config.yml index 5d8da8efb5763..39966b3a9945b 100644 --- a/recipes/spix/config.yml +++ b/recipes/spix/config.yml @@ -1,3 +1,9 @@ versions: "0.4": folder: all + "0.5": + folder: all + "0.6": + folder: all + "0.7": + folder: all diff --git a/recipes/splunk-opentelemetry-cpp/all/CMakeLists.txt b/recipes/splunk-opentelemetry-cpp/all/CMakeLists.txt deleted file mode 100644 index c0238c83236f9..0000000000000 --- a/recipes/splunk-opentelemetry-cpp/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.5.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/splunk-opentelemetry-cpp/all/conandata.yml b/recipes/splunk-opentelemetry-cpp/all/conandata.yml index d5ceac8af92c2..abbaf169e8c5c 100644 --- a/recipes/splunk-opentelemetry-cpp/all/conandata.yml +++ b/recipes/splunk-opentelemetry-cpp/all/conandata.yml @@ -2,3 +2,8 @@ sources: 0.4.0: url: "https://github.com/signalfx/splunk-otel-cpp/archive/refs/tags/v0.4.0.tar.gz" sha256: "e44f3167cecfea6d1fb0fa3060cc479a0873ab6d481b9b9f57629cbc7d17bfd4" +patches: + "0.4.0": + - patch_file: "patches/0.4.0-001-fix-cmake.patch" + patch_description: "Make CMakeLists.txt compatible with Conan" + patch_type: "conan" diff --git a/recipes/splunk-opentelemetry-cpp/all/conanfile.py b/recipes/splunk-opentelemetry-cpp/all/conanfile.py index 96d1153587973..45da1f403d709 100644 --- a/recipes/splunk-opentelemetry-cpp/all/conanfile.py +++ b/recipes/splunk-opentelemetry-cpp/all/conanfile.py @@ -1,83 +1,115 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration import os -import glob + +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, export_conandata_patches, apply_conandata_patches +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" class SplunkOpentelemetryConan(ConanFile): name = "splunk-opentelemetry-cpp" + description = "Splunk's distribution of OpenTelemetry C++" license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/signalfx/splunk-otel-cpp" - description = "Splunk's distribution of OpenTelemetry C++" topics = ("opentelemetry", "observability", "tracing") - settings = "os", "compiler", "build_type", "arch" + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { - "fPIC": [True, False], "shared": [True, False], + "fPIC": [True, False], + "build_jaeger_exporter": [True, False], } default_options = { - "fPIC": True, "shared": False, + "fPIC": True, + "build_jaeger_exporter": True, } - generators = "cmake", "cmake_find_package_multi" - requires = "opentelemetry-cpp/1.0.1" - exports_sources = "CMakeLists.txt" - short_paths = True - _cmake = None - def validate(self): - if self.settings.arch != "x86_64": - raise ConanInvalidConfiguration("Architecture not supported") + @property + def _min_cppstd(self): + return 14 - def configure(self): - if self.options.shared: - del self.options.fPIC + @property + def _compilers_minimum_version(self): + return { + "gcc": "6", + "clang": "5", + "apple-clang": "10", + "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 - @property - def _source_subfolder(self): - return "source_subfolder" + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") - @property - def _build_subfolder(self): - return "build_subfolder" + def layout(self): + cmake_layout(self, src_folder="src") - def _remove_unnecessary_package_files(self): - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + def requirements(self): + self.requires("opentelemetry-cpp/1.8.3", transitive_headers=True) # v1.12 is not compatible + self.requires("grpc/1.54.3") + self.requires("nlohmann_json/3.11.3") + if self.options.build_jaeger_exporter: + self.requires("thrift/0.17.0") + self.requires("libcurl/[>=7.78.0 <9]") + + def validate(self): + if self.settings.arch != "x86_64": + raise ConanInvalidConfiguration(f"{self.settings.arch} architecture not supported") + if self.options.build_jaeger_exporter and not self.dependencies["opentelemetry-cpp"].options.get_safe("with_jaeger"): + raise ConanInvalidConfiguration("Cannot build Jaeger exporter without with_jaeger=True in opentelemetry-cpp") + + 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], - strip_root=True, - destination=self._source_subfolder - ) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - - self._cmake = CMake(self) - defs = { - "SPLUNK_CPP_EXAMPLES": False - } - self._cmake.configure(defs=defs, 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["SPLUNK_CPP_TESTS"] = False + tc.variables["SPLUNK_CPP_EXAMPLES"] = False + tc.variables["SPLUNK_CPP_WITH_JAEGER_EXPORTER"] = self.options.build_jaeger_exporter + tc.generate() + tc = CMakeDeps(self) + 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", 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() - self._remove_unnecessary_package_files() + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): + self.cpp_info.set_property("cmake_file_name", "SplunkOpenTelemetry") + self.cpp_info.set_property("cmake_target_name", "SplunkOpenTelemetry::SplunkOpenTelemetry") + self.cpp_info.libs = ["SplunkOpenTelemetry"] + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.names["cmake_find_package"] = "SplunkOpenTelemetry" self.cpp_info.names["cmake_find_package_multi"] = "SplunkOpenTelemetry" - self.cpp_info.libs = ["SplunkOpenTelemetry"] diff --git a/recipes/splunk-opentelemetry-cpp/all/patches/0.4.0-001-fix-cmake.patch b/recipes/splunk-opentelemetry-cpp/all/patches/0.4.0-001-fix-cmake.patch new file mode 100644 index 0000000000000..c4db3358cce46 --- /dev/null +++ b/recipes/splunk-opentelemetry-cpp/all/patches/0.4.0-001-fix-cmake.patch @@ -0,0 +1,26 @@ +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -1,4 +1,4 @@ +-cmake_minimum_required(VERSION 3.5.1) ++cmake_minimum_required(VERSION 3.15) + + project(SplunkOpenTelemetry CXX) + +@@ -6,8 +6,6 @@ + include(GenerateExportHeader) + + set(PACKAGE_VERSION "0.1.0") +- +-set(CMAKE_CXX_STANDARD 11) + + option(SPLUNK_CPP_TESTS "Enable building of tests" OFF) + option(SPLUNK_CPP_EXAMPLES "Enable building of examples" ON) +@@ -36,7 +34,7 @@ + + target_link_libraries(SplunkOpenTelemetry + PUBLIC +- ${OPENTELEMETRY_CPP_LIBRARIES} ++ opentelemetry-cpp::opentelemetry-cpp + gRPC::grpc++ + protobuf::libprotobuf + ${SPLUNK_CPP_JAEGER_EXPORTER_LIBS} diff --git a/recipes/splunk-opentelemetry-cpp/all/test_package/CMakeLists.txt b/recipes/splunk-opentelemetry-cpp/all/test_package/CMakeLists.txt index 66cd3ac3bbc17..a7bd5843a1ba9 100644 --- a/recipes/splunk-opentelemetry-cpp/all/test_package/CMakeLists.txt +++ b/recipes/splunk-opentelemetry-cpp/all/test_package/CMakeLists.txt @@ -1,13 +1,8 @@ -cmake_minimum_required(VERSION 3.12) - +cmake_minimum_required(VERSION 3.15) project(test_package CXX) -set(CMAKE_CXX_STANDARD 11) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) find_package(SplunkOpenTelemetry CONFIG REQUIRED) add_executable(test_package test_package.cpp) - target_link_libraries(test_package SplunkOpenTelemetry::SplunkOpenTelemetry) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/splunk-opentelemetry-cpp/all/test_package/conanfile.py b/recipes/splunk-opentelemetry-cpp/all/test_package/conanfile.py index 49a3a66ea5bad..ef5d7042163ec 100644 --- a/recipes/splunk-opentelemetry-cpp/all/test_package/conanfile.py +++ b/recipes/splunk-opentelemetry-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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/splunk-opentelemetry-cpp/all/test_package/test_package.cpp b/recipes/splunk-opentelemetry-cpp/all/test_package/test_package.cpp index c32b8e88e812f..5b8740706dcc0 100644 --- a/recipes/splunk-opentelemetry-cpp/all/test_package/test_package.cpp +++ b/recipes/splunk-opentelemetry-cpp/all/test_package/test_package.cpp @@ -1,22 +1,8 @@ -#include #include -#include - -int main(int argc, char** argv) { +int main() { splunk::OpenTelemetryOptions otelOptions = splunk::OpenTelemetryOptions() .WithServiceName("my-service") .WithServiceVersion("1.0") - .WithExporter(splunk::ExporterType_JaegerThriftHttp) .WithDeploymentEnvironment("test"); - auto provider = splunk::InitOpentelemetry(otelOptions); - auto span = opentelemetry::trace::Tracer::GetCurrentSpan(); - - char traceId[32] = {0}; - char spanId[16] = {0}; - span->GetContext().trace_id().ToLowerBase16(traceId); - span->GetContext().span_id().ToLowerBase16(spanId); - printf("current span: %.*s:%.*s\n", 32, traceId, 16, spanId); - - return 0; } diff --git a/recipes/splunk-opentelemetry-cpp/all/test_v1_package/CMakeLists.txt b/recipes/splunk-opentelemetry-cpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/splunk-opentelemetry-cpp/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/splunk-opentelemetry-cpp/all/test_v1_package/conanfile.py b/recipes/splunk-opentelemetry-cpp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..49a3a66ea5bad --- /dev/null +++ b/recipes/splunk-opentelemetry-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/spy/all/conandata.yml b/recipes/spy/all/conandata.yml index a03c066af9192..a6f3a70ed4537 100644 --- a/recipes/spy/all/conandata.yml +++ b/recipes/spy/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.1.0": + url: "https://github.com/jfalcou/spy/archive/1.1.0.tar.gz" + sha256: "35e15dfe7bebcb03fb28c249d2c2c4ed302dadafbfd5f81e71c31b95d1e3b2dd" "1.0.0": url: "https://github.com/jfalcou/spy/archive/1.0.0.tar.gz" sha256: "ae2f508460b3b21436a652e281e1cf44370da5871a9d13086daa04a9e2bd7d1b" diff --git a/recipes/spy/all/conanfile.py b/recipes/spy/all/conanfile.py index 4e3adabd43a05..5d68cfa807921 100644 --- a/recipes/spy/all/conanfile.py +++ b/recipes/spy/all/conanfile.py @@ -10,11 +10,12 @@ class SpyConan(ConanFile): name = "spy" + description = "C++ 17 for constexpr-proof detection and classification of informations about OS, compiler, etc..." license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://jfalcou.github.io/spy/" - description = "C++ 17 for constexpr-proof detection and classification of informations about OS, compiler, etc..." - topics = ("c++17", "config", "metaprogramming") + topics = ("config", "metaprogramming", "header-only") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -27,6 +28,7 @@ def _compilers_minimum_version(self): return { "gcc": "7.4", "Visual Studio": "15.7", + "msvc": "191", "clang": "6", "apple-clang": "10", } @@ -54,11 +56,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) - - def build(self): - pass + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): copy(self, "LICENSE.md", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) @@ -66,6 +64,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/spy/all/test_package/conanfile.py b/recipes/spy/all/test_package/conanfile.py index d120a992c06a6..8a5bb47f50c4c 100644 --- a/recipes/spy/all/test_package/conanfile.py +++ b/recipes/spy/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/spy/config.yml b/recipes/spy/config.yml index 1d92b70b7b274..cab874d2d97fa 100644 --- a/recipes/spy/config.yml +++ b/recipes/spy/config.yml @@ -1,4 +1,6 @@ versions: + "1.1.0": + folder: all "1.0.0": folder: all "0.0.4": diff --git a/recipes/sqlcipher/all/conandata.yml b/recipes/sqlcipher/all/conandata.yml index 1c771e01ba689..5d877e92e6fb1 100644 --- a/recipes/sqlcipher/all/conandata.yml +++ b/recipes/sqlcipher/all/conandata.yml @@ -1,4 +1,16 @@ sources: + "4.6.1": + url: "https://github.com/sqlcipher/sqlcipher/archive/v4.6.1.zip" + sha256: "93a7475183d47e2d33f85aefa7518e8730796f103612d36ae191ae56209104e0" + "4.6.0": + url: "https://github.com/sqlcipher/sqlcipher/archive/v4.6.0.zip" + sha256: "2d41ba2bf09c74a488f546551f65f0fa8517413307a0509dd2c87d66df6bff95" + "4.5.7": + url: "https://github.com/sqlcipher/sqlcipher/archive/v4.5.7.zip" + sha256: "4f7e00e4b485d162d638094daba354d04aabb0ca68b72cc1826f082b40c9fd7d" + "4.5.6": + url: "https://github.com/sqlcipher/sqlcipher/archive/v4.5.6.zip" + sha256: "5d269166c33c39c4dc6fc14be4ac8cd78b022f8bd59b0775becf0c896331a539" "4.5.1": url: "https://github.com/sqlcipher/sqlcipher/archive/v4.5.1.zip" sha256: "08a1024b299b5527d5b5ed79f67957938b516567f68662e973c4bec1b843b28e" @@ -18,45 +30,43 @@ sources: url: "https://github.com/sqlcipher/sqlcipher/archive/v4.3.0.zip" sha256: "41e1408465488e9c478ca5b7c5f8410405a10caa73b82db60ac115a76c563c05" patches: + "4.6.1": + - patch_file: patches/Makefile.in-v4.6.1.patch + - patch_file: patches/Makefile.msc-v4.6.1.patch + - patch_file: patches/fix_configure-v4.5.7.patch + "4.6.0": + - patch_file: patches/Makefile.in-v4.5.7.patch + - patch_file: patches/Makefile.msc-v4.5.7.patch + - patch_file: patches/fix_configure-v4.5.7.patch + "4.5.7": + - patch_file: patches/Makefile.in-v4.5.7.patch + - patch_file: patches/Makefile.msc-v4.5.7.patch + - patch_file: patches/fix_configure-v4.5.7.patch + "4.5.6": + - patch_file: patches/Makefile.in-v4.5.6.patch + - patch_file: patches/Makefile.msc-v4.5.6.patch + - patch_file: patches/fix_configure-v4.5.6.patch "4.5.1": - patch_file: patches/Makefile.in-v4.5.1.patch - base_path: source_subfolder - patch_file: patches/Makefile.msc-v4.5.1.patch - base_path: source_subfolder - patch_file: patches/fix_configure-v4.5.1.patch - base_path: source_subfolder "4.5.0": - patch_file: patches/Makefile.in-v4.5.0.patch - base_path: source_subfolder - patch_file: patches/Makefile.msc-v4.5.0.patch - base_path: source_subfolder - patch_file: patches/fix_configure-v4.5.0.patch - base_path: source_subfolder "4.4.3": - patch_file: patches/Makefile.in-v4.4.3.patch - base_path: source_subfolder - patch_file: patches/Makefile.msc-v4.4.3.patch - base_path: source_subfolder - patch_file: patches/fix_configure-v4.4.3.patch - base_path: source_subfolder "4.4.2": - patch_file: patches/Makefile.in-v4.4.2.patch - base_path: source_subfolder - patch_file: patches/Makefile.msc-v4.4.2.patch - base_path: source_subfolder - patch_file: patches/fix_configure-v4.4.2.patch - base_path: source_subfolder "4.4.0": - patch_file: patches/Makefile.in-v4.4.0.patch - base_path: source_subfolder - patch_file: patches/Makefile.msc-v4.4.0.patch - base_path: source_subfolder - patch_file: patches/fix_configure-v4.4.0.patch - base_path: source_subfolder "4.3.0": - patch_file: patches/Makefile.in-v4.3.0.patch - base_path: source_subfolder - patch_file: patches/Makefile.msc-v4.3.0.patch - base_path: source_subfolder - patch_file: patches/fix_configure-v4.3.0.patch - base_path: source_subfolder diff --git a/recipes/sqlcipher/all/conanfile.py b/recipes/sqlcipher/all/conanfile.py index 8b2584d0bea74..103c2ec526cd3 100644 --- a/recipes/sqlcipher/all/conanfile.py +++ b/recipes/sqlcipher/all/conanfile.py @@ -1,28 +1,36 @@ -from conan.tools.microsoft import msvc_runtime_flag -from conans import tools, ConanFile, AutoToolsBuildEnvironment -from conans.errors import ConanInvalidConfiguration -import functools import os -import shutil -required_conan_version = ">=1.36.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 +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 VCVars, is_msvc, is_msvc_static_runtime, NMakeToolchain, NMakeDeps +from conan.tools.scm import Version + +required_conan_version = ">=1.58.0" class SqlcipherConan(ConanFile): name = "sqlcipher" + description = "SQLite extension that provides 256 bit AES encryption of database files." license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.zetetic.net/sqlcipher/" - description = "SQLite extension that provides 256 bit AES encryption of database files." - topics = ("database", "encryption", "SQLite") + topics = ("database", "encryption", "sqlite") - settings = "os", "compiler", "build_type", "arch" + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], "crypto_library": ["openssl", "libressl", "commoncrypto"], "with_largefile": [True, False], "temporary_store": ["always_file", "default_file", "default_memory", "always_memory"], + "enable_column_metadata": [True, False], } default_options = { "shared": False, @@ -30,202 +38,218 @@ class SqlcipherConan(ConanFile): "crypto_library": "openssl", "with_largefile": True, "temporary_store": "default_memory", + "enable_column_metadata": 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) - @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": del self.options.fPIC - if self.settings.os != "Linux": - del self.options.with_largefile + if self.settings.os not in ["Linux", "FreeBSD"]: + self.options.rm_safe("with_largefile") 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.crypto_library == "openssl": - self.requires("openssl/1.1.1n") + self.requires("openssl/[>=1.1 <4]") elif self.options.crypto_library == "libressl": - self.requires("libressl/3.4.3") + self.requires("libressl/3.5.3") def validate(self): - if self.options.crypto_library == "commoncrypto" and not tools.is_apple_os(self.settings.os): + if self.options.crypto_library == "commoncrypto" and not is_apple_os(self): raise ConanInvalidConfiguration("commoncrypto is only supported on Macos") def build_requirements(self): - self.build_requires("tcl/8.6.11") - 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("tcl/8.6.13") + 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) + @property def _temp_store_nmake_value(self): - return {"always_file": "0", - "default_file": "1", - "default_memory": "2", - "always_memory": "3"}.get(str(self.options.temporary_store)) + return { + "always_file": "0", + "default_file": "1", + "default_memory": "2", + "always_memory": "3", + }.get(str(self.options.temporary_store)) @property def _temp_store_autotools_value(self): - return {"always_file": "never", - "default_file": "no", - "default_memory": "yes", - "always_memory": "always"}.get(str(self.options.temporary_store)) - - def _build_visual(self): - crypto_dep = self.deps_cpp_info[str(self.options.crypto_library)] - crypto_incdir = crypto_dep.include_paths[0] - crypto_libdir = crypto_dep.lib_paths[0] - libs = map(lambda lib : lib + ".lib", crypto_dep.libs) - system_libs = map(lambda lib : lib + ".lib", crypto_dep.system_libs) - - nmake_flags = [ - "TLIBS=\"%s %s\"" % (" ".join(libs), " ".join(system_libs)), - "LTLIBPATHS=/LIBPATH:%s" % crypto_libdir, - "OPTS=\"-I%s -DSQLITE_HAS_CODEC\"" % (crypto_incdir), - "NO_TCL=1", - "USE_AMALGAMATION=1", - "OPT_FEATURE_FLAGS=-DSQLCIPHER_CRYPTO_OPENSSL", - "SQLITE_TEMP_STORE=%s" % self._temp_store_nmake_value, - "TCLSH_CMD=%s" % self.deps_env_info.TCLSH, - ] - - main_target = "dll" if self.options.shared else "sqlcipher.lib" - - if msvc_runtime_flag(self) in ["MD", "MDd"]: - nmake_flags.append("USE_CRT_DLL=1") + return { + "always_file": "never", + "default_file": "no", + "default_memory": "yes", + "always_memory": "always", + }.get(str(self.options.temporary_store)) + + def _generate_msvc(self): + env = VirtualBuildEnv(self) + env.generate() + + tc = NMakeToolchain(self) + env = tc.environment() + crypto_dep = self.dependencies[str(self.options.crypto_library)].cpp_info + env.define("TLIBS", " ".join(lib + ".lib" for lib in crypto_dep.libs + crypto_dep.system_libs)) + env.define("LTLIBPATHS", f"/LIBPATH:{crypto_dep.libdir}") + env.define("OPTS", f'-I{crypto_dep.includedir} -DSQLITE_HAS_CODEC') + env.define("NO_TCL", "1") + env.define("USE_AMALGAMATION", "1") + opt_feature_flags = "-DSQLCIPHER_CRYPTO_OPENSSL" + if self.options.enable_column_metadata: + opt_feature_flags += " -DSQLITE_ENABLE_COLUMN_METADATA" + env.define("OPT_FEATURE_FLAGS", opt_feature_flags) + env.define("SQLITE_TEMP_STORE", self._temp_store_nmake_value) + env.define("TCLSH_CMD", self.dependencies.build['tcl'].runenv_info.vars(self)['TCLSH']) + + if not is_msvc_static_runtime(self): + env.define("USE_CRT_DLL", "1") if self.settings.build_type == "Debug": - nmake_flags.append("DEBUG=2") - nmake_flags.append("FOR_WIN10=1") - platforms = {"x86": "x86", "x86_64": "x64"} - nmake_flags.append("PLATFORM=%s" % platforms[str(self.settings.arch)]) - vcvars = tools.vcvars_command(self.settings) - self.run("%s && nmake /f Makefile.msc %s %s" % (vcvars, main_target, " ".join(nmake_flags)), cwd=self._source_subfolder) + env.define("DEBUG", "2") + env.define("FOR_WIN10", "1") + env.define("PLATFORM", {"x86": "x86", "x86_64": "x64"}[str(self.settings.arch)]) + tc.generate(env) - @staticmethod - def _chmod_plus_x(filename): - if os.name == "posix": - os.chmod(filename, os.stat(filename).st_mode | 0o111) + tc = NMakeDeps(self) + tc.generate() - 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")) - configure = os.path.join(self._source_subfolder, "configure") - self._chmod_plus_x(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), - ) - autotools = self._configure_autotools() - autotools.make() - - @functools.lru_cache(1) - def _configure_autotools(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-tempstore={}".format(self._temp_store_autotools_value), + vcvars = VCVars(self) + vcvars.generate() + + @property + def _use_commoncrypto(self): + return self.options.crypto_library == "commoncrypto" and is_apple_os(self) + + def _generate_unix(self): + env = VirtualBuildEnv(self) + env.generate() + + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") + + tc = AutotoolsToolchain(self) + tc.configure_args += [ + f"--enable-tempstore={self._temp_store_autotools_value}", "--disable-tcl", ] if self.settings.os == "Windows": - args.extend(["config_BUILD_EXEEXT='.exe'", "config_TARGET_EXEEXT='.exe'"]) + tc.configure_args += [ + "config_BUILD_EXEEXT='.exe'", + "config_TARGET_EXEEXT='.exe'", + ] - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - if self.settings.os == "Linux": - autotools.libs.append("dl") + if self.settings.os in ["Linux", "FreeBSD"]: + tc.extra_ldflags.append("-ldl") if not self.options.with_largefile: - autotools.defines.append("SQLITE_DISABLE_LFS=1") - autotools.defines.append("SQLITE_HAS_CODEC") - - env_vars = autotools.vars - tclsh_cmd = self.deps_env_info.TCLSH - env_vars["TCLSH_CMD"] = tclsh_cmd.replace("\\", "/") - if self._use_commoncrypto(): - env_vars["LDFLAGS"] += " -framework Security -framework CoreFoundation " - args.append("--with-crypto-lib=commoncrypto") + tc.extra_defines.append("SQLITE_DISABLE_LFS=1") + tc.extra_defines.append("SQLITE_HAS_CODEC") + + if self._use_commoncrypto: + tc.extra_ldflags += [ + "-framework", "Security", + "-framework", "CoreFoundation", + ] + tc.configure_args.append("--with-crypto-lib=commoncrypto") else: - autotools.defines.append("SQLCIPHER_CRYPTO_OPENSSL") + tc.extra_defines.append("SQLCIPHER_CRYPTO_OPENSSL") + tc.generate() - autotools.configure(configure_dir=self._source_subfolder, args=args, vars=env_vars) - if self.settings.os == "Windows": - # sqlcipher will create .exe for the build machine, which we defined to Linux... - tools.replace_in_file("Makefile", "BEXE = .exe", "BEXE = ") - return autotools - - def _use_commoncrypto(self): - return self.options.crypto_library == "commoncrypto" and tools.is_apple_os(self.settings.os) + 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_visual() + def generate(self): + if is_msvc(self): + self._generate_msvc() else: - self._build_autotools() + self._generate_unix() + + @staticmethod + def _chmod_plus_x(filename): + if os.name == "posix": + os.chmod(filename, os.stat(filename).st_mode | 0o111) - def _package_unix(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")) + def _patch_sources_unix(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), os.path.dirname(gnu_config), os.path.join(self.source_folder, "build-aux")) + configure = os.path.join(self.source_folder, "configure") + self._chmod_plus_x(configure) + # relocatable shared libs on macOS + replace_in_file(self, configure, "-install_name \\$rpath/", "-install_name @rpath/") + # avoid SIP issues on macOS when dependencies are shared + if is_apple_os(self): + libdirs = sum([dep.cpp_info.libdirs for dep in self.dependencies.values()], []) + libpaths = ":".join(libdirs) + replace_in_file(self, configure, + "#! /bin/sh\n", + f"#! /bin/sh\nexport DYLD_LIBRARY_PATH={libpaths}:$DYLD_LIBRARY_PATH\n") - def _package_visual(self): - self.copy("*.dll", dst="bin", keep_path=False) - self.copy("*.lib", dst="lib", keep_path=False) - self.copy("sqlite3.h", src=self._source_subfolder, dst=os.path.join("include", "sqlcipher")) + def build(self): + apply_conandata_patches(self) + if is_msvc(self): + with chdir(self, self.source_folder): + main_target = "dll" if self.options.shared else "sqlcipher.lib" + self.run(f"nmake /f Makefile.msc {main_target}") + else: + self._patch_sources_unix() + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.configure() + if self.settings.os == "Windows": + # sqlcipher will create .exe for the build machine, which we defined to Linux... + replace_in_file(self, "Makefile", "BEXE = .exe", "BEXE = ") + autotools.make() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - if self._is_msvc: - self._package_visual() + copy(self, "LICENSE*", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + if is_msvc(self): + copy(self, "*.dll", dst=os.path.join(self.package_folder, "bin"), src=self.source_folder, keep_path=False) + copy(self, "*.lib", dst=os.path.join(self.package_folder, "lib"), src=self.source_folder, keep_path=False) + copy(self, "sqlite3.h", dst=os.path.join(self.package_folder, "include", "sqlcipher"), src=self.source_folder) else: - self._package_unix() + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.install() + rm(self, "*.la", self.package_folder, recursive=True) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): self.cpp_info.set_property("pkg_config_name", "sqlcipher") self.cpp_info.libs = ["sqlcipher"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.extend(["pthread", "dl"]) - if tools.Version(self.version) >= "4.5.0": + if Version(self.version) >= "4.5.0": self.cpp_info.system_libs.append("m") - self.cpp_info.defines = ["SQLITE_HAS_CODEC", "SQLITE_TEMP_STORE={}".format(self._temp_store_nmake_value)] - if self._use_commoncrypto(): + self.cpp_info.defines = [ + "SQLITE_HAS_CODEC", + f"SQLITE_TEMP_STORE={self._temp_store_nmake_value}" + ] + if self._use_commoncrypto: self.cpp_info.frameworks = ["Security", "CoreFoundation"] else: self.cpp_info.defines.append("SQLCIPHER_CRYPTO_OPENSSL") diff --git a/recipes/sqlcipher/all/patches/Makefile.in-v4.5.6.patch b/recipes/sqlcipher/all/patches/Makefile.in-v4.5.6.patch new file mode 100644 index 0000000000000..ea44332dff260 --- /dev/null +++ b/recipes/sqlcipher/all/patches/Makefile.in-v4.5.6.patch @@ -0,0 +1,25 @@ +diff --git a/Makefile.in b/Makefile.in +index 870c5d30..4dc5d292 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -672,8 +672,7 @@ SQLITE3_SHELL_TARGET = $(SQLITE3_SHELL_TARGET_@HAVE_WASI_SDK@) + # This is the default Makefile target. The objects listed here + # are what get build when you type just "make" with no arguments. + # +-all: sqlite3.h libsqlcipher.la $(SQLITE3_SHELL_TARGET) \ +- $(HAVE_TCL:1=libtclsqlite3.la) ++all: sqlite3.h libsqlcipher.la + + Makefile: $(TOP)/Makefile.in + ./config.status +@@ -1557,9 +1556,8 @@ lib_install: libsqlcipher.la + $(INSTALL) -d $(DESTDIR)$(libdir) + $(LTINSTALL) libsqlcipher.la $(DESTDIR)$(libdir) + +-install: sqlcipher$(TEXE) lib_install sqlite3.h sqlcipher.pc ${HAVE_TCL:1=tcl_install} ++install: lib_install sqlite3.h sqlcipher.pc + $(INSTALL) -d $(DESTDIR)$(bindir) +- $(LTINSTALL) sqlcipher$(TEXE) $(DESTDIR)$(bindir) + $(INSTALL) -d $(DESTDIR)$(includedir) + $(INSTALL) -m 0644 sqlite3.h $(DESTDIR)$(includedir) + $(INSTALL) -m 0644 $(TOP)/src/sqlite3ext.h $(DESTDIR)$(includedir) diff --git a/recipes/sqlcipher/all/patches/Makefile.in-v4.5.7.patch b/recipes/sqlcipher/all/patches/Makefile.in-v4.5.7.patch new file mode 100644 index 0000000000000..8c0ff8f52c2da --- /dev/null +++ b/recipes/sqlcipher/all/patches/Makefile.in-v4.5.7.patch @@ -0,0 +1,25 @@ +diff --git a/Makefile.in b/Makefile.in +index ce2617c..77242fc 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -677,8 +677,7 @@ SQLITE3_SHELL_TARGET = $(SQLITE3_SHELL_TARGET_@HAVE_WASI_SDK@) + # This is the default Makefile target. The objects listed here + # are what get build when you type just "make" with no arguments. + # +-all: sqlite3.h libsqlcipher.la $(SQLITE3_SHELL_TARGET) \ +- $(HAVE_TCL:1=libtclsqlite3.la) ++all: sqlite3.h libsqlcipher.la + + Makefile: $(TOP)/Makefile.in + ./config.status +@@ -1579,9 +1578,8 @@ lib_install: libsqlcipher.la + $(INSTALL) -d $(DESTDIR)$(libdir) + $(LTINSTALL) libsqlcipher.la $(DESTDIR)$(libdir) + +-install: sqlcipher$(TEXE) lib_install sqlite3.h sqlcipher.pc ${HAVE_TCL:1=tcl_install} ++install: lib_install sqlite3.h sqlcipher.pc + $(INSTALL) -d $(DESTDIR)$(bindir) +- $(LTINSTALL) sqlcipher$(TEXE) $(DESTDIR)$(bindir) + $(INSTALL) -d $(DESTDIR)$(includedir) + $(INSTALL) -m 0644 sqlite3.h $(DESTDIR)$(includedir) + $(INSTALL) -m 0644 $(TOP)/src/sqlite3ext.h $(DESTDIR)$(includedir) diff --git a/recipes/sqlcipher/all/patches/Makefile.in-v4.6.1.patch b/recipes/sqlcipher/all/patches/Makefile.in-v4.6.1.patch new file mode 100644 index 0000000000000..318c717c81e5a --- /dev/null +++ b/recipes/sqlcipher/all/patches/Makefile.in-v4.6.1.patch @@ -0,0 +1,27 @@ +diff --git a/Makefile.in b/Makefile.in +index 8431c25..2c1d4fd 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -676,8 +676,8 @@ SQLITE3_SHELL_TARGET = $(SQLITE3_SHELL_TARGET_@HAVE_WASI_SDK@) + # This is the default Makefile target. The objects listed here + # are what get build when you type just "make" with no arguments. + # +-all: sqlite3.h libsqlcipher.la $(SQLITE3_SHELL_TARGET) \ +- $(HAVE_TCL:1=libtclsqlite3.la) ++all: sqlite3.h libsqlcipher.la ++ + + Makefile: $(TOP)/Makefile.in + ./config.status +@@ -1578,9 +1578,9 @@ lib_install: libsqlcipher.la + $(INSTALL) -d $(DESTDIR)$(libdir) + $(LTINSTALL) libsqlcipher.la $(DESTDIR)$(libdir) + +-install: sqlcipher$(TEXE) lib_install sqlite3.h sqlcipher.pc ${HAVE_TCL:1=tcl_install} ++install: lib_install sqlite3.h sqlcipher.pc + $(INSTALL) -d $(DESTDIR)$(bindir) +- $(LTINSTALL) sqlcipher$(TEXE) $(DESTDIR)$(bindir) ++# $(LTINSTALL) sqlcipher$(TEXE) $(DESTDIR)$(bindir) + $(INSTALL) -d $(DESTDIR)$(includedir) + $(INSTALL) -m 0644 sqlite3.h $(DESTDIR)$(includedir) + $(INSTALL) -m 0644 $(TOP)/src/sqlite3ext.h $(DESTDIR)$(includedir) diff --git a/recipes/sqlcipher/all/patches/Makefile.msc-v4.5.6.patch b/recipes/sqlcipher/all/patches/Makefile.msc-v4.5.6.patch new file mode 100644 index 0000000000000..94b469d07e19d --- /dev/null +++ b/recipes/sqlcipher/all/patches/Makefile.msc-v4.5.6.patch @@ -0,0 +1,161 @@ +diff --git a/Makefile.msc b/Makefile.msc +index 85487315..e3c00752 100644 +--- a/Makefile.msc ++++ b/Makefile.msc +@@ -299,9 +299,9 @@ SQLITE3H = sqlite3.h + # + !IFNDEF SQLITE3DLL + !IF $(FOR_WIN10)!=0 +-SQLITE3DLL = winsqlite3.dll ++SQLITE3DLL = sqlcipher.dll + !ELSE +-SQLITE3DLL = sqlite3.dll ++SQLITE3DLL = sqlcipher.dll + !ENDIF + !ENDIF + +@@ -309,9 +309,9 @@ SQLITE3DLL = sqlite3.dll + # + !IFNDEF SQLITE3LIB + !IF $(FOR_WIN10)!=0 +-SQLITE3LIB = winsqlite3.lib ++SQLITE3LIB = sqlcipher.lib + !ELSE +-SQLITE3LIB = sqlite3.lib ++SQLITE3LIB = sqlcipher.lib + !ENDIF + !ENDIF + +@@ -696,7 +696,7 @@ SHELL_CORE_SRC = $(SQLITE3C) + SHELL_CORE_DEP = $(SQLITE3DLL) + # <> + !ELSEIF $(USE_AMALGAMATION)==0 +-SHELL_CORE_DEP = libsqlite3.lib ++SHELL_CORE_DEP = sqlcipher.lib + # <> + !ELSE + SHELL_CORE_DEP = +@@ -719,7 +719,7 @@ TESTFIXTURE_DEP = zlib $(TESTFIXTURE_DEP) + SHELL_CORE_LIB = $(SQLITE3LIB) + # <> + !ELSEIF $(USE_AMALGAMATION)==0 +-SHELL_CORE_LIB = libsqlite3.lib ++SHELL_CORE_LIB = sqlcipher.lib + # <> + !ELSE + SHELL_CORE_LIB = +@@ -754,8 +754,9 @@ RCC = $(RCC) -DWINAPI_FAMILY=WINAPI_FAMILY_APP + # C compiler options for the Windows 10 platform (needs MSVC 2015). + # + !IF $(FOR_WIN10)!=0 +-TCC = $(TCC) /d2guard4 -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE +-BCC = $(BCC) /d2guard4 -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE ++# /d2guard4 requires /guard:cf to be present as well, but it doesn't work with /Zi (Debug builds) ++TCC = $(TCC) -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE ++BCC = $(BCC) -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE + !ENDIF + + # Also, we need to dynamically link to the correct MSVC runtime +@@ -1039,8 +1040,10 @@ TLIBS = + # default to file, 2 to default to memory, and 3 to force temporary + # tables to always be in memory. + # +-TCC = $(TCC) -DSQLITE_TEMP_STORE=1 +-RCC = $(RCC) -DSQLITE_TEMP_STORE=1 ++ ++# Allow overriding the value ++TCC = $(TCC) -DSQLITE_TEMP_STORE=$(SQLITE_TEMP_STORE) ++RCC = $(RCC) -DSQLITE_TEMP_STORE=$(SQLITE_TEMP_STORE) + + # Enable/disable loadable extensions, and other optional features + # based on configuration. (-DSQLITE_OMIT*, -DSQLITE_ENABLE*). +@@ -1206,14 +1209,15 @@ LTLINKOPTS = $(LTLINKOPTS) "/LIBPATH:$(WP81LIBPATH)" + !ENDIF + LTLINKOPTS = $(LTLINKOPTS) /DYNAMICBASE + LTLINKOPTS = $(LTLINKOPTS) WindowsPhoneCore.lib RuntimeObject.lib PhoneAppModelHost.lib +-LTLINKOPTS = $(LTLINKOPTS) /NODEFAULTLIB:kernel32.lib /NODEFAULTLIB:ole32.lib ++# Remove /NODEFAULTLIB:kernel32.lib, required by OpenSSL + !ENDIF + + # When compiling for UWP or the Windows 10 platform, some extra linker + # options are also required. + # + !IF $(FOR_UWP)!=0 || $(FOR_WIN10)!=0 +-LTLINKOPTS = $(LTLINKOPTS) /DYNAMICBASE /NODEFAULTLIB:kernel32.lib ++# Remove /NODEFAULTLIB:kernel32.lib, required by OpenSSL ++LTLINKOPTS = $(LTLINKOPTS) /DYNAMICBASE + LTLINKOPTS = $(LTLINKOPTS) mincore.lib + !IFDEF PSDKLIBPATH + LTLINKOPTS = $(LTLINKOPTS) "/LIBPATH:$(PSDKLIBPATH)" +@@ -1268,7 +1272,7 @@ LTLIBS = $(LTLIBS) $(LIBICU) + # + LIBOBJS0 = vdbe.lo parse.lo alter.lo analyze.lo attach.lo auth.lo \ + backup.lo bitvec.lo btmutex.lo btree.lo build.lo \ +- callback.lo complete.lo ctime.lo \ ++ callback.lo complete.lo crypto.lo crypto_impl.lo crypto_openssl.lo ctime.lo \ + date.lo dbpage.lo dbstat.lo delete.lo \ + expr.lo fault.lo fkey.lo \ + fts3.lo fts3_aux.lo fts3_expr.lo fts3_hash.lo fts3_icu.lo \ +@@ -1774,7 +1778,7 @@ ALL_TCL_TARGETS = + # This is the default Makefile target. The objects listed here + # are what get build when you type just "make" with no arguments. + # +-core: dll libsqlite3.lib shell ++core: dll sqlcipher.lib shell + + # Targets that require the Tcl library. + # +@@ -1793,11 +1797,12 @@ dll: $(SQLITE3DLL) + shell: $(SQLITE3EXE) + + # <> +-libsqlite3.lib: $(LIBOBJ) +- $(LTLIB) $(LTLIBOPTS) /OUT:$@ $(LIBOBJ) $(TLIBS) ++# LTLIBPATHS is required to find the openssl/libressl libs ++sqlcipher.lib: $(LIBOBJ) ++ $(LTLIB) $(LTLIBPATHS) $(LTLIBOPTS) /OUT:$@ $(LIBOBJ) $(TLIBS) + +-libtclsqlite3.lib: tclsqlite.lo libsqlite3.lib +- $(LTLIB) $(LTLIBOPTS) $(TCLLIBPATHS) $(LTLIBPATHS) /OUT:$@ tclsqlite.lo libsqlite3.lib $(LIBTCLSTUB) $(TLIBS) ++libtclsqlite3.lib: tclsqlite.lo sqlcipher.lib ++ $(LTLIB) $(LTLIBOPTS) $(TCLLIBPATHS) $(LTLIBPATHS) /OUT:$@ tclsqlite.lo sqlcipher.lib $(LIBTCLSTUB) $(TLIBS) + + tclsqlite3.def: tclsqlite.lo + echo EXPORTS > tclsqlite3.def +@@ -1819,9 +1824,9 @@ $(SQLITE3DLL): $(LIBOBJ) $(LIBRESOBJS) $(CORE_LINK_DEP) + $(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL $(CORE_LINK_OPTS) /OUT:$@ $(LIBOBJ) $(LIBRESOBJS) $(LTLIBS) $(TLIBS) + + # <> +-sqlite3.def: libsqlite3.lib ++sqlite3.def: sqlcipher.lib + echo EXPORTS > sqlite3.def +- dumpbin /all libsqlite3.lib \ ++ dumpbin /all sqlcipher.lib \ + | $(TCLSH_CMD) $(TOP)\tool\replace.tcl include "^\s+1 _?(sqlite3(?:session|changeset|changegroup|rebaser|rbu)?_[^@]*)(?:@\d+)?$$" \1 \ + | sort >> sqlite3.def + # <> +@@ -2008,6 +2013,15 @@ callback.lo: $(TOP)\src\callback.c $(HDR) + complete.lo: $(TOP)\src\complete.c $(HDR) + $(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\complete.c + ++crypto.lo: $(TOP)\src\crypto.c $(HDR) ++ $(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\crypto.c ++ ++crypto_impl.lo: $(TOP)\src\crypto_impl.c $(HDR) ++ $(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\crypto_impl.c ++ ++crypto_openssl.lo: $(TOP)\src\crypto_openssl.c $(HDR) ++ $(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\crypto_openssl.c ++ + ctime.lo: $(TOP)\src\ctime.c $(HDR) + $(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\ctime.c + +@@ -2427,7 +2441,7 @@ sqlite3rbu.lo: $(TOP)\ext\rbu\sqlite3rbu.c $(HDR) $(EXTHDR) + # Rules to build the 'testfixture' application. + # + # If using the amalgamation, use sqlite3.c directly to build the test +-# fixture. Otherwise link against libsqlite3.lib. (This distinction is ++# fixture. Otherwise link against sqlcipher.lib. (This distinction is + # necessary because the test fixture requires non-API symbols which are + # hidden when the library is built via the amalgamation). + # diff --git a/recipes/sqlcipher/all/patches/Makefile.msc-v4.5.7.patch b/recipes/sqlcipher/all/patches/Makefile.msc-v4.5.7.patch new file mode 100644 index 0000000000000..78ff7f03e70eb --- /dev/null +++ b/recipes/sqlcipher/all/patches/Makefile.msc-v4.5.7.patch @@ -0,0 +1,170 @@ +diff --git a/Makefile.msc b/Makefile.msc +index eb6461c..0e8907b 100644 +--- a/Makefile.msc ++++ b/Makefile.msc +@@ -299,9 +299,9 @@ SQLITE3H = sqlite3.h + # + !IFNDEF SQLITE3DLL + !IF $(FOR_WIN10)!=0 +-SQLITE3DLL = winsqlite3.dll ++SQLITE3DLL = sqlcipher.dll + !ELSE +-SQLITE3DLL = sqlite3.dll ++SQLITE3DLL = sqlcipher.dll + !ENDIF + !ENDIF + +@@ -309,9 +309,9 @@ SQLITE3DLL = sqlite3.dll + # + !IFNDEF SQLITE3LIB + !IF $(FOR_WIN10)!=0 +-SQLITE3LIB = winsqlite3.lib ++SQLITE3LIB = sqlcipher.lib + !ELSE +-SQLITE3LIB = sqlite3.lib ++SQLITE3LIB = sqlcipher.lib + !ENDIF + !ENDIF + +@@ -696,7 +696,7 @@ SHELL_CORE_SRC = $(SQLITE3C) + SHELL_CORE_DEP = $(SQLITE3DLL) + # <> + !ELSEIF $(USE_AMALGAMATION)==0 +-SHELL_CORE_DEP = libsqlite3.lib ++SHELL_CORE_DEP = sqlcipher.lib + # <> + !ELSE + SHELL_CORE_DEP = +@@ -719,7 +719,7 @@ TESTFIXTURE_DEP = zlib $(TESTFIXTURE_DEP) + SHELL_CORE_LIB = $(SQLITE3LIB) + # <> + !ELSEIF $(USE_AMALGAMATION)==0 +-SHELL_CORE_LIB = libsqlite3.lib ++SHELL_CORE_LIB = sqlcipher.lib + # <> + !ELSE + SHELL_CORE_LIB = +@@ -754,8 +754,9 @@ RCC = $(RCC) -DWINAPI_FAMILY=WINAPI_FAMILY_APP + # C compiler options for the Windows 10 platform (needs MSVC 2015). + # + !IF $(FOR_WIN10)!=0 +-TCC = $(TCC) /d2guard4 -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE +-BCC = $(BCC) /d2guard4 -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE ++# /d2guard4 requires /guard:cf to be present as well, but it doesn't work with /Zi (Debug builds) ++TCC = $(TCC) -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE ++BCC = $(BCC) -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE + !ENDIF + + # Also, we need to dynamically link to the correct MSVC runtime +@@ -1039,8 +1040,9 @@ TLIBS = + # default to file, 2 to default to memory, and 3 to force temporary + # tables to always be in memory. + # +-TCC = $(TCC) -DSQLITE_TEMP_STORE=1 +-RCC = $(RCC) -DSQLITE_TEMP_STORE=1 ++# Allow overriding the value ++TCC = $(TCC) -DSQLITE_TEMP_STORE=$(SQLITE_TEMP_STORE) ++RCC = $(RCC) -DSQLITE_TEMP_STORE=$(SQLITE_TEMP_STORE) + + # Enable/disable loadable extensions, and other optional features + # based on configuration. (-DSQLITE_OMIT*, -DSQLITE_ENABLE*). +@@ -1206,14 +1208,15 @@ LTLINKOPTS = $(LTLINKOPTS) "/LIBPATH:$(WP81LIBPATH)" + !ENDIF + LTLINKOPTS = $(LTLINKOPTS) /DYNAMICBASE + LTLINKOPTS = $(LTLINKOPTS) WindowsPhoneCore.lib RuntimeObject.lib PhoneAppModelHost.lib +-LTLINKOPTS = $(LTLINKOPTS) /NODEFAULTLIB:kernel32.lib /NODEFAULTLIB:ole32.lib ++# Remove /NODEFAULTLIB:kernel32.lib, required by OpenSSL + !ENDIF + + # When compiling for UWP or the Windows 10 platform, some extra linker + # options are also required. + # + !IF $(FOR_UWP)!=0 || $(FOR_WIN10)!=0 +-LTLINKOPTS = $(LTLINKOPTS) /DYNAMICBASE /NODEFAULTLIB:kernel32.lib ++# Remove /NODEFAULTLIB:kernel32.lib, required by OpenSSL ++LTLINKOPTS = $(LTLINKOPTS) /DYNAMICBASE + LTLINKOPTS = $(LTLINKOPTS) mincore.lib + !IFDEF PSDKLIBPATH + LTLINKOPTS = $(LTLINKOPTS) "/LIBPATH:$(PSDKLIBPATH)" +@@ -1268,7 +1271,7 @@ LTLIBS = $(LTLIBS) $(LIBICU) + # + LIBOBJS0 = vdbe.lo parse.lo alter.lo analyze.lo attach.lo auth.lo \ + backup.lo bitvec.lo btmutex.lo btree.lo build.lo \ +- callback.lo complete.lo ctime.lo \ ++ callback.lo complete.lo crypto.lo crypto_impl.lo crypto_openssl.lo ctime.lo \ + date.lo dbpage.lo dbstat.lo delete.lo \ + expr.lo fault.lo fkey.lo \ + fts3.lo fts3_aux.lo fts3_expr.lo fts3_hash.lo fts3_icu.lo \ +@@ -1603,7 +1606,7 @@ TESTEXT = \ + $(TOP)\ext\rtree\test_rtreedoc.c \ + $(TOP)\ext\recover\sqlite3recover.c \ + $(TOP)\ext\recover\test_recover.c \ +- $(TOP)\ext\recover\dbdata.c ++ $(TOP)\ext\recover\dbdata.c + + # If use of zlib is enabled, add the "zipfile.c" source file. + # +@@ -1779,7 +1782,7 @@ ALL_TCL_TARGETS = + # This is the default Makefile target. The objects listed here + # are what get build when you type just "make" with no arguments. + # +-core: dll libsqlite3.lib shell ++core: dll sqlcipher.lib shell + + # Targets that require the Tcl library. + # +@@ -1798,11 +1801,13 @@ dll: $(SQLITE3DLL) + shell: $(SQLITE3EXE) + + # <> +-libsqlite3.lib: $(LIBOBJ) +- $(LTLIB) $(LTLIBOPTS) /OUT:$@ $(LIBOBJ) $(TLIBS) ++# LTLIBPATHS is required to find the openssl/libressl libs ++sqlcipher.lib: $(LIBOBJ) ++ $(LTLIB) $(LTLIBPATHS) $(LTLIBOPTS) /OUT:$@ $(LIBOBJ) $(TLIBS) ++ ++libtclsqlite3.lib: tclsqlite.lo sqlcipher.lib ++ $(LTLIB) $(LTLIBOPTS) $(TCLLIBPATHS) $(LTLIBPATHS) /OUT:$@ tclsqlite.lo sqlcipher.lib $(LIBTCLSTUB) $(TLIBS) + +-libtclsqlite3.lib: tclsqlite.lo libsqlite3.lib +- $(LTLIB) $(LTLIBOPTS) $(TCLLIBPATHS) $(LTLIBPATHS) /OUT:$@ tclsqlite.lo libsqlite3.lib $(LIBTCLSTUB) $(TLIBS) + + tclsqlite3.def: tclsqlite.lo + echo EXPORTS > tclsqlite3.def +@@ -1824,9 +1829,9 @@ $(SQLITE3DLL): $(LIBOBJ) $(LIBRESOBJS) $(CORE_LINK_DEP) + $(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL $(CORE_LINK_OPTS) /OUT:$@ $(LIBOBJ) $(LIBRESOBJS) $(LTLIBS) $(TLIBS) + + # <> +-sqlite3.def: libsqlite3.lib ++sqlite3.def: sqlcipher.lib + echo EXPORTS > sqlite3.def +- dumpbin /all libsqlite3.lib \ ++ dumpbin /all sqlcipher.lib \ + | $(TCLSH_CMD) $(TOP)\tool\replace.tcl include "^\s+1 _?(sqlite3(?:session|changeset|changegroup|rebaser|rbu)?_[^@]*)(?:@\d+)?$$" \1 \ + | sort >> sqlite3.def + # <> +@@ -2013,6 +2018,15 @@ callback.lo: $(TOP)\src\callback.c $(HDR) + complete.lo: $(TOP)\src\complete.c $(HDR) + $(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\complete.c + ++crypto.lo: $(TOP)\src\crypto.c $(HDR) ++ $(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\crypto.c ++ ++crypto_impl.lo: $(TOP)\src\crypto_impl.c $(HDR) ++ $(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\crypto_impl.c ++ ++crypto_openssl.lo: $(TOP)\src\crypto_openssl.c $(HDR) ++ $(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\crypto_openssl.c ++ + ctime.lo: $(TOP)\src\ctime.c $(HDR) + $(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\ctime.c + +@@ -2432,7 +2446,7 @@ sqlite3rbu.lo: $(TOP)\ext\rbu\sqlite3rbu.c $(HDR) $(EXTHDR) + # Rules to build the 'testfixture' application. + # + # If using the amalgamation, use sqlite3.c directly to build the test +-# fixture. Otherwise link against libsqlite3.lib. (This distinction is ++# fixture. Otherwise link against sqlcipher.lib. (This distinction is + # necessary because the test fixture requires non-API symbols which are + # hidden when the library is built via the amalgamation). + # diff --git a/recipes/sqlcipher/all/patches/Makefile.msc-v4.6.1.patch b/recipes/sqlcipher/all/patches/Makefile.msc-v4.6.1.patch new file mode 100644 index 0000000000000..7edea48493167 --- /dev/null +++ b/recipes/sqlcipher/all/patches/Makefile.msc-v4.6.1.patch @@ -0,0 +1,160 @@ +diff --git a/Makefile.msc b/Makefile.msc +index d46cee1..899ce6a 100644 +--- a/Makefile.msc ++++ b/Makefile.msc +@@ -306,9 +306,9 @@ SQLITE3H = sqlite3.h + # + !IFNDEF SQLITE3DLL + !IF $(FOR_WIN10)!=0 +-SQLITE3DLL = winsqlite3.dll ++SQLITE3DLL = sqlcipher.dll + !ELSE +-SQLITE3DLL = sqlite3.dll ++SQLITE3DLL = sqlcipher.dll + !ENDIF + !ENDIF + +@@ -316,9 +316,9 @@ SQLITE3DLL = sqlite3.dll + # + !IFNDEF SQLITE3LIB + !IF $(FOR_WIN10)!=0 +-SQLITE3LIB = winsqlite3.lib ++SQLITE3LIB = sqlcipher.lib + !ELSE +-SQLITE3LIB = sqlite3.lib ++SQLITE3LIB = sqlcipher.lib + !ENDIF + !ENDIF + +@@ -703,7 +703,7 @@ SHELL_CORE_SRC = $(SQLITE3C) + SHELL_CORE_DEP = $(SQLITE3DLL) + # <> + !ELSEIF $(USE_AMALGAMATION)==0 +-SHELL_CORE_DEP = libsqlite3.lib ++SHELL_CORE_DEP = sqlcipher.lib + # <> + !ELSE + SHELL_CORE_DEP = +@@ -726,7 +726,7 @@ TESTFIXTURE_DEP = zlib $(TESTFIXTURE_DEP) + SHELL_CORE_LIB = $(SQLITE3LIB) + # <> + !ELSEIF $(USE_AMALGAMATION)==0 +-SHELL_CORE_LIB = libsqlite3.lib ++SHELL_CORE_LIB = sqlcipher.lib + # <> + !ELSE + SHELL_CORE_LIB = +@@ -761,8 +761,9 @@ RCC = $(RCC) -DWINAPI_FAMILY=WINAPI_FAMILY_APP + # C compiler options for the Windows 10 platform (needs MSVC 2015). + # + !IF $(FOR_WIN10)!=0 +-TCC = $(TCC) /d2guard4 -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE +-BCC = $(BCC) /d2guard4 -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE ++# /d2guard4 requires /guard:cf to be present as well, but it doesn't work with /Zi (Debug builds) ++TCC = $(TCC) -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE ++BCC = $(BCC) -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE + !ENDIF + + # Also, we need to dynamically link to the correct MSVC runtime +@@ -1046,8 +1047,9 @@ TLIBS = + # default to file, 2 to default to memory, and 3 to force temporary + # tables to always be in memory. + # +-TCC = $(TCC) -DSQLITE_TEMP_STORE=1 +-RCC = $(RCC) -DSQLITE_TEMP_STORE=1 ++# Allow overriding the value ++TCC = $(TCC) -DSQLITE_TEMP_STORE=$(SQLITE_TEMP_STORE) ++RCC = $(RCC) -DSQLITE_TEMP_STORE=$(SQLITE_TEMP_STORE) + + # Enable/disable loadable extensions, and other optional features + # based on configuration. (-DSQLITE_OMIT*, -DSQLITE_ENABLE*). +@@ -1213,14 +1215,15 @@ LTLINKOPTS = $(LTLINKOPTS) "/LIBPATH:$(WP81LIBPATH)" + !ENDIF + LTLINKOPTS = $(LTLINKOPTS) /DYNAMICBASE + LTLINKOPTS = $(LTLINKOPTS) WindowsPhoneCore.lib RuntimeObject.lib PhoneAppModelHost.lib +-LTLINKOPTS = $(LTLINKOPTS) /NODEFAULTLIB:kernel32.lib /NODEFAULTLIB:ole32.lib ++# Remove /NODEFAULTLIB:kernel32.lib, required by OpenSSL + !ENDIF + + # When compiling for UWP or the Windows 10 platform, some extra linker + # options are also required. + # + !IF $(FOR_UWP)!=0 || $(FOR_WIN10)!=0 +-LTLINKOPTS = $(LTLINKOPTS) /DYNAMICBASE /NODEFAULTLIB:kernel32.lib ++# Remove /NODEFAULTLIB:kernel32.lib, required by OpenSSL ++LTLINKOPTS = $(LTLINKOPTS) /DYNAMICBASE + LTLINKOPTS = $(LTLINKOPTS) mincore.lib + !IFDEF PSDKLIBPATH + LTLINKOPTS = $(LTLINKOPTS) "/LIBPATH:$(PSDKLIBPATH)" +@@ -1275,7 +1278,7 @@ LTLIBS = $(LTLIBS) $(LIBICU) + # + LIBOBJS0 = vdbe.lo parse.lo alter.lo analyze.lo attach.lo auth.lo \ + backup.lo bitvec.lo btmutex.lo btree.lo build.lo \ +- callback.lo complete.lo ctime.lo \ ++ callback.lo complete.lo crypto.lo crypto_impl.lo crypto_openssl.lo ctime.lo \ + date.lo dbpage.lo dbstat.lo delete.lo \ + expr.lo fault.lo fkey.lo \ + fts3.lo fts3_aux.lo fts3_expr.lo fts3_hash.lo fts3_icu.lo \ +@@ -1786,7 +1789,7 @@ ALL_TCL_TARGETS = + # This is the default Makefile target. The objects listed here + # are what get build when you type just "make" with no arguments. + # +-core: dll libsqlite3.lib shell ++core: dll sqlcipher.lib shell + + # Targets that require the Tcl library. + # +@@ -1805,11 +1808,12 @@ dll: $(SQLITE3DLL) + shell: $(SQLITE3EXE) + + # <> +-libsqlite3.lib: $(LIBOBJ) +- $(LTLIB) $(LTLIBOPTS) /OUT:$@ $(LIBOBJ) $(TLIBS) ++# LTLIBPATHS is required to find the openssl/libressl libs ++sqlcipher.lib: $(LIBOBJ) ++ $(LTLIB) $(LTLIBPATHS) $(LTLIBOPTS) /OUT:$@ $(LIBOBJ) $(TLIBS) + +-libtclsqlite3.lib: tclsqlite.lo libsqlite3.lib +- $(LTLIB) $(LTLIBOPTS) $(TCLLIBPATHS) $(LTLIBPATHS) /OUT:$@ tclsqlite.lo libsqlite3.lib $(LIBTCLSTUB) $(TLIBS) ++libtclsqlite3.lib: tclsqlite.lo sqlcipher.lib ++ $(LTLIB) $(LTLIBOPTS) $(TCLLIBPATHS) $(LTLIBPATHS) /OUT:$@ tclsqlite.lo sqlcipher.lib $(LIBTCLSTUB) $(TLIBS) + + tclsqlite3.def: tclsqlite.lo + echo EXPORTS > tclsqlite3.def +@@ -1831,9 +1835,9 @@ $(SQLITE3DLL): $(LIBOBJ) $(LIBRESOBJS) $(CORE_LINK_DEP) + $(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL $(CORE_LINK_OPTS) /OUT:$@ $(LIBOBJ) $(LIBRESOBJS) $(LTLIBS) $(TLIBS) + + # <> +-sqlite3.def: libsqlite3.lib ++sqlite3.def: sqlcipher.lib + echo EXPORTS > sqlite3.def +- dumpbin /all libsqlite3.lib \ ++ dumpbin /all sqlcipher.lib \ + | $(TCLSH_CMD) $(TOP)\tool\replace.tcl include "^\s+1 _?(sqlite3(?:session|changeset|changegroup|rebaser|rbu)?_[^@]*)(?:@\d+)?$$" \1 \ + | sort >> sqlite3.def + # <> +@@ -2020,6 +2024,15 @@ callback.lo: $(TOP)\src\callback.c $(HDR) + complete.lo: $(TOP)\src\complete.c $(HDR) + $(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\complete.c + ++crypto.lo: $(TOP)\src\crypto.c $(HDR) ++ $(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\crypto.c ++ ++crypto_impl.lo: $(TOP)\src\crypto_impl.c $(HDR) ++ $(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\crypto_impl.c ++ ++crypto_openssl.lo: $(TOP)\src\crypto_openssl.c $(HDR) ++ $(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\crypto_openssl.c ++ + ctime.lo: $(TOP)\src\ctime.c $(HDR) + $(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\ctime.c + +@@ -2444,7 +2457,7 @@ sqlite3rbu.lo: $(TOP)\ext\rbu\sqlite3rbu.c $(HDR) $(EXTHDR) + # Rules to build the 'testfixture' application. + # + # If using the amalgamation, use sqlite3.c directly to build the test +-# fixture. Otherwise link against libsqlite3.lib. (This distinction is ++# fixture. Otherwise link against sqlcipher.lib. (This distinction is + # necessary because the test fixture requires non-API symbols which are + # hidden when the library is built via the amalgamation). + # diff --git a/recipes/sqlcipher/all/patches/fix_configure-v4.5.6.patch b/recipes/sqlcipher/all/patches/fix_configure-v4.5.6.patch new file mode 100644 index 0000000000000..92c3d8c91d58c --- /dev/null +++ b/recipes/sqlcipher/all/patches/fix_configure-v4.5.6.patch @@ -0,0 +1,20 @@ +diff --git a/configure b/configure +index a2909ce..9c25987 100755 +--- a/configure ++++ b/configure +@@ -12732,7 +12732,6 @@ then : + printf %s "(cached) " >&6 + else $as_nop + ac_check_lib_save_LIBS=$LIBS +-LIBS="-lcrypto $LIBS" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + +@@ -12764,7 +12763,6 @@ if test "x$ac_cv_lib_crypto_HMAC_Init_ex" = xyes + then : + printf "%s\n" "#define HAVE_LIBCRYPTO 1" >>confdefs.h + +- LIBS="-lcrypto $LIBS" + + else $as_nop + as_fn_error $? "Library crypto not found. Install openssl!\"" "$LINENO" 5 diff --git a/recipes/sqlcipher/all/patches/fix_configure-v4.5.7.patch b/recipes/sqlcipher/all/patches/fix_configure-v4.5.7.patch new file mode 100644 index 0000000000000..902782af36686 --- /dev/null +++ b/recipes/sqlcipher/all/patches/fix_configure-v4.5.7.patch @@ -0,0 +1,20 @@ +diff --git a/configure b/configure +index 2ee4143..753e9b1 100755 +--- a/configure ++++ b/configure +@@ -12732,7 +12732,6 @@ then : + printf %s "(cached) " >&6 + else $as_nop + ac_check_lib_save_LIBS=$LIBS +-LIBS="-lcrypto $LIBS" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + +@@ -12764,7 +12763,6 @@ if test "x$ac_cv_lib_crypto_HMAC_Init_ex" = xyes + then : + printf "%s\n" "#define HAVE_LIBCRYPTO 1" >>confdefs.h + +- LIBS="-lcrypto $LIBS" + + else $as_nop + as_fn_error $? "Library crypto not found. Install openssl!\"" "$LINENO" 5 diff --git a/recipes/sqlcipher/all/test_package/CMakeLists.txt b/recipes/sqlcipher/all/test_package/CMakeLists.txt index fcf18155285d5..1a94b824ea1f5 100644 --- a/recipes/sqlcipher/all/test_package/CMakeLists.txt +++ b/recipes/sqlcipher/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(sqlcipher REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) diff --git a/recipes/sqlcipher/all/test_package/conanfile.py b/recipes/sqlcipher/all/test_package/conanfile.py index 5741e4e0cec54..f42142315949c 100644 --- a/recipes/sqlcipher/all/test_package/conanfile.py +++ b/recipes/sqlcipher/all/test_package/conanfile.py @@ -1,19 +1,20 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.apple import is_apple_os +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,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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/sqlcipher/all/test_v1_package/CMakeLists.txt b/recipes/sqlcipher/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/sqlcipher/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/sqlcipher/all/test_v1_package/conanfile.py b/recipes/sqlcipher/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..7bb57d9f4dc6a --- /dev/null +++ b/recipes/sqlcipher/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conan.tools.apple import is_apple_os +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "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/sqlcipher/config.yml b/recipes/sqlcipher/config.yml index 939fca7342f84..b3abcbf305759 100644 --- a/recipes/sqlcipher/config.yml +++ b/recipes/sqlcipher/config.yml @@ -1,4 +1,12 @@ versions: + "4.6.1": + folder: all + "4.6.0": + folder: all + "4.5.7": + folder: all + "4.5.6": + folder: all "4.5.1": folder: all "4.5.0": diff --git a/recipes/sqlite3/all/CMakeLists.txt b/recipes/sqlite3/all/CMakeLists.txt index 1f1e60b9b2dcf..9d6257e47853f 100644 --- a/recipes/sqlite3/all/CMakeLists.txt +++ b/recipes/sqlite3/all/CMakeLists.txt @@ -17,6 +17,7 @@ option(ENABLE_RTREE "Enable support for the R*Tree index extension") option(ENABLE_UNLOCK_NOTIFY "Enable support for the unlock notify API") option(ENABLE_DEFAULT_SECURE_DELETE "Turns on secure deletion by default") option(USE_ALLOCA "The alloca() memory allocator will be used in a few situations where it is appropriate.") +option(USE_URI "This option causes the URI filename process logic to be enabled by default.") option(OMIT_LOAD_EXTENSION "Omits the entire extension loading mechanism from SQLite") option(OMIT_DEPRECATED "Omits deprecated interfaces and features") if(SQLITE3_VERSION VERSION_GREATER_EQUAL "3.35.0") @@ -93,6 +94,9 @@ endif() if(USE_ALLOCA) target_compile_definitions(${PROJECT_NAME} PRIVATE SQLITE_USE_ALLOCA) endif() +if(USE_URI) + target_compile_definitions(${PROJECT_NAME} PRIVATE SQLITE_USE_URI) +endif() if(OMIT_LOAD_EXTENSION) target_compile_definitions(${PROJECT_NAME} PRIVATE SQLITE_OMIT_LOAD_EXTENSION) endif() diff --git a/recipes/sqlite3/all/conandata.yml b/recipes/sqlite3/all/conandata.yml index 62074c59a652e..e283b6b94455a 100644 --- a/recipes/sqlite3/all/conandata.yml +++ b/recipes/sqlite3/all/conandata.yml @@ -1,4 +1,58 @@ sources: + "3.47.1": + url: "https://sqlite.org/2024/sqlite-amalgamation-3470100.zip" + sha256: "9da21e6b14ef6a943cdc30f973df259fb390bb4483f77e7f171b9b6e977e5458" + "3.47.0": + url: "https://sqlite.org/2024/sqlite-amalgamation-3470000.zip" + sha256: "2842fddbb1cc33f66c7da998a57535f14a6bfee159676a07bb4bf3e59375d93e" + "3.46.1": + url: "https://sqlite.org/2024/sqlite-amalgamation-3460100.zip" + sha256: "77823cb110929c2bcb0f5d48e4833b5c59a8a6e40cdea3936b99e199dbbe5784" + "3.46.0": + url: "https://sqlite.org/2024/sqlite-amalgamation-3460000.zip" + sha256: "712a7d09d2a22652fb06a49af516e051979a3984adb067da86760e60ed51a7f5" + "3.45.3": + url: "https://sqlite.org/2024/sqlite-amalgamation-3450300.zip" + sha256: "ea170e73e447703e8359308ca2e4366a3ae0c4304a8665896f068c736781c651" + "3.45.2": + url: "https://sqlite.org/2024/sqlite-amalgamation-3450200.zip" + sha256: "65230414820d43a6d1445d1d98cfe57e8eb9f7ac0d6a96ad6932e0647cce51db" + "3.45.1": + url: "https://sqlite.org/2024/sqlite-amalgamation-3450100.zip" + sha256: "5592243caf28b2cdef41e6ab58d25d653dfc53deded8450eb66072c929f030c4" + "3.45.0": + url: "https://sqlite.org/2024/sqlite-amalgamation-3450000.zip" + sha256: "bde30d13ebdf84926ddd5e8b6df145be03a577a48fd075a087a5dd815bcdf740" + "3.44.2": + url: "https://sqlite.org/2023/sqlite-amalgamation-3440200.zip" + sha256: "833be89b53b3be8b40a2e3d5fedb635080e3edb204957244f3d6987c2bb2345f" + "3.44.1": + url: "https://sqlite.org/2023/sqlite-amalgamation-3440100.zip" + sha256: "cc6545b71ca188e245d5d668543c01f61175f0228a0e1b4ced76fabc75ea6b2e" + "3.44.0": + url: "https://sqlite.org/2023/sqlite-amalgamation-3440000.zip" + sha256: "93299c8d2c8397622fe00bd807204b1f58815f45bda8097bf93b3bf759a3ebad" + "3.43.2": + url: "https://sqlite.org/2023/sqlite-amalgamation-3430200.zip" + sha256: "a17ac8792f57266847d57651c5259001d1e4e4b46be96ec0d985c953925b2a1c" + "3.43.1": + url: "https://sqlite.org/2023/sqlite-amalgamation-3430100.zip" + sha256: "7e634bbd4b2870a83dc7c1e3cc02e4d30b8555cd7db7b332f24e0c447fd0dd16" + "3.43.0": + url: "https://sqlite.org/2023/sqlite-amalgamation-3430000.zip" + sha256: "bb5849ae4d7129c09d20596379a0b3f7b1ac59cf9998eba5ef283ea9b6c000a5" + "3.42.0": + url: "https://sqlite.org/2023/sqlite-amalgamation-3420000.zip" + sha256: "1cc824d0f5e675829fa37018318fda833ea56f7e9de2b41eddd9f7643b5ec29e" + "3.41.2": + url: "https://sqlite.org/2023/sqlite-amalgamation-3410200.zip" + sha256: "01df06a84803c1ab4d62c64e995b151b2dbcf5dbc93bbc5eee213cb18225d987" + "3.41.1": + url: "https://sqlite.org/2023/sqlite-amalgamation-3410100.zip" + sha256: "df0d54bf246521360c8148f64e7e5ad07a4665b4f902339e844f4c493d535ff5" + "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" diff --git a/recipes/sqlite3/all/conanfile.py b/recipes/sqlite3/all/conanfile.py index b5e1343cc1842..8c9aee8f54806 100644 --- a/recipes/sqlite3/all/conanfile.py +++ b/recipes/sqlite3/all/conanfile.py @@ -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], @@ -34,6 +35,7 @@ class Sqlite3Conan(ConanFile): "enable_preupdate_hook": [True, False], "enable_rtree": [True, False], "use_alloca": [True, False], + "use_uri": [True, False], "omit_load_extension": [True, False], "omit_deprecated": [True, False], "enable_math_functions": [True, False], @@ -63,6 +65,7 @@ class Sqlite3Conan(ConanFile): "enable_preupdate_hook": False, "enable_rtree": True, "use_alloca": False, + "use_uri": False, "omit_load_extension": False, "omit_deprecated": False, "enable_math_functions": True, @@ -99,16 +102,15 @@ 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 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,6 +132,7 @@ def generate(self): tc.variables["ENABLE_UNLOCK_NOTIFY"] = self.options.enable_unlock_notify tc.variables["ENABLE_DEFAULT_SECURE_DELETE"] = self.options.enable_default_secure_delete tc.variables["USE_ALLOCA"] = self.options.use_alloca + tc.variables["USE_URI"] = self.options.use_uri tc.variables["OMIT_LOAD_EXTENSION"] = self.options.omit_load_extension tc.variables["OMIT_DEPRECATED"] = self.options.omit_deprecated if self._has_enable_math_function_option: @@ -185,7 +188,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") @@ -208,11 +211,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" @@ -224,3 +222,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/test_package.c b/recipes/sqlite3/all/test_package/test_package.c index 123652e6e2b2c..a32b04528d029 100644 --- a/recipes/sqlite3/all/test_package/test_package.c +++ b/recipes/sqlite3/all/test_package/test_package.c @@ -25,7 +25,7 @@ int main() { printf("Done!\n"); printf("Creating new table...\n"); - result = sqlite3_exec(db_instance, "CREATE TABLE package(ID INT PRIMARY KEY NOT NULL);", NULL, 0, &errmsg); + result = sqlite3_exec(db_instance, "CREATE TABLE IF NOT EXISTS package(ID INT PRIMARY KEY NOT NULL);", NULL, 0, &errmsg); if(result != SQLITE_OK) { fprintf(stderr, "SQL error: %s\n", errmsg); sqlite3_free(errmsg); diff --git a/recipes/sqlite3/config.yml b/recipes/sqlite3/config.yml index 971a8b973abfd..07c91fa6c8739 100644 --- a/recipes/sqlite3/config.yml +++ b/recipes/sqlite3/config.yml @@ -1,4 +1,40 @@ versions: + "3.47.1": + folder: all + "3.47.0": + folder: all + "3.46.1": + folder: all + "3.46.0": + folder: all + "3.45.3": + folder: all + "3.45.2": + folder: all + "3.45.1": + folder: all + "3.45.0": + folder: all + "3.44.2": + folder: all + "3.44.1": + folder: all + "3.44.0": + folder: all + "3.43.2": + folder: all + "3.43.1": + folder: all + "3.43.0": + folder: all + "3.42.0": + folder: all + "3.41.2": + folder: all + "3.41.1": + folder: all + "3.40.1": + folder: all "3.40.0": folder: all "3.39.4": diff --git a/recipes/sqlite3mc/all/conandata.yml b/recipes/sqlite3mc/all/conandata.yml new file mode 100644 index 0000000000000..41db86853d2fd --- /dev/null +++ b/recipes/sqlite3mc/all/conandata.yml @@ -0,0 +1,13 @@ +sources: + "1.9.0": + url: "https://github.com/utelle/SQLite3MultipleCiphers/archive/refs/tags/v1.9.0.tar.gz" + sha256: "b30dcf695ad3a53b32b8907a3920ab2b38670c7d37232839d0fb3148c41166da" + "1.8.6": + url: "https://github.com/utelle/SQLite3MultipleCiphers/archive/refs/tags/v1.8.6.tar.gz" + sha256: "7250e3d9ca4368df00d0ebfaa744add66b458a5de318728b95369d621ebf2028" + "1.8.4": + url: "https://github.com/utelle/SQLite3MultipleCiphers/archive/refs/tags/v1.8.4.tar.gz" + sha256: "453e1938a02c91796a013169d56f746f153d7c7a77b59894bf8462b341a343ca" + "1.8.0": + url: "https://github.com/utelle/SQLite3MultipleCiphers/archive/refs/tags/v1.8.0.tar.gz" + sha256: "13D9B939BEF7C7371D58A3874F83B18CF330EB2171205B3680ACDDB2215BE0E5" diff --git a/recipes/sqlite3mc/all/conanfile.py b/recipes/sqlite3mc/all/conanfile.py new file mode 100644 index 0000000000000..f99b4eebdebe5 --- /dev/null +++ b/recipes/sqlite3mc/all/conanfile.py @@ -0,0 +1,226 @@ +import os +from conan import ConanFile +from conan.tools.cmake import cmake_layout, CMakeDeps, CMakeToolchain, CMake +from conan.tools.files import get, copy +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" + + +class sqlite3mc(ConanFile): + name = "sqlite3mc" + package_type = "library" + + license = "MIT" + homepage = "https://github.com/utelle/SQLite3MultipleCiphers" + url = "https://github.com/conan-io/conan-center-index" + description = "The project SQLite3 Multiple Ciphers implements an encryption extension for SQLite with support for multiple ciphers." + topics = ("sqlite", "sqlite3", "sqlite3-encryption", "database-encryption", "sqlite3-extension") + + settings = "os", "compiler", "build_type", "arch" + options = { + "shared": [True, False], + "fPIC": [True, False], + "require_zlib": [True, False], + "static_runtime_link": [True, False], + "build_shell": [True, False], + "with_icu": [True, False], + "enable_debug": [True, False], + "soundex": [True, False], + "enable_column_metadata": [True, False], + "secure_delete": [True, False], + "enable_fts3": [True, False], + "enable_fts3_paranthesis": [True, False], + "enable_fts4": [True, False], + "enable_fts5": [True, False], + "enable_carray": [True, False], + "enable_csv": [True, False], + "enable_extfunc": [True, False], + "enable_geopoly": [True, False], + "enable_rtree": [True, False], + "enable_uuid": [True, False], + "use_uri": [True, False], + "user_authentication": [True, False], + "enable_preupdate_hook": [True, False], + "enable_session": [True, False], + "shell_is_utf8": [True, False], + "enable_fileio": [True, False], + "enable_regexp": [True, False], + "enable_series": [True, False], + "enable_sha3": [True, False], + "enable_explain_comments": [True, False], + "enable_dbpage_vtab": [True, False], + "enable_dbstat_vtab": [True, False], + "enable_stmtvtab": [True, False], + "enable_unknown_sql_function": [True, False], + "use_miniz": [True, False], + "enable_compress": [True, False], + "enable_sqlar": [True, False], + "enable_zipfile": [True, False], + "use_sqleet_legacy": [True, False], + "use_sqlcipher_legacy": [True, False], + "secure_memory": [True, False], + "use_random_fill_memory": [True, False], + "omit_aes_hardware_support": [True, False] + } + default_options = { + "shared": False, + "fPIC": True, + "require_zlib": False, + "static_runtime_link": False, + "build_shell": False, + "with_icu": False, + "enable_debug": False, + "soundex": True, + "enable_column_metadata": True, + "secure_delete": True, + "enable_fts3": True, + "enable_fts3_paranthesis": True, + "enable_fts4": True, + "enable_fts5": True, + "enable_carray": True, + "enable_csv": True, + "enable_extfunc": True, + "enable_geopoly": True, + "enable_rtree": True, + "enable_uuid": True, + "use_uri": True, + "user_authentication": False, + "enable_preupdate_hook": False, + "enable_session": False, + "shell_is_utf8": True, + "enable_fileio": True, + "enable_regexp": True, + "enable_series": True, + "enable_sha3": True, + "enable_explain_comments": True, + "enable_dbpage_vtab": True, + "enable_dbstat_vtab": True, + "enable_stmtvtab": True, + "enable_unknown_sql_function": True, + "use_miniz": False, + "enable_compress": False, + "enable_sqlar": False, + "enable_zipfile": False, + "use_sqleet_legacy": False, + "use_sqlcipher_legacy": False, + "secure_memory": False, + "use_random_fill_memory": False, + "omit_aes_hardware_support": False + } + + def build_requirements(self): + self.tool_requires("cmake/[>=3.24 <4]") + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + if Version(self.version) < "1.8.4": + # INFO: https://github.com/utelle/SQLite3MultipleCiphers/commit/3bb033956816b3301f026abb5e83087799de5bee + self.options.user_authentication = True + + 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 source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + if self.options.require_zlib: + self.requires("zlib/[>=1.2.11 <2]") + if self.options.with_icu: + self.requires("icu/74.1") + + def generate(self): + deps = CMakeDeps(self) + deps.generate() + + tc = CMakeToolchain(self) + tc.variables["_SQLITE3MC_REQUIRE_ZLIB"] = self.options.require_zlib + tc.variables["SQLITE3MC_STATIC_RUNTIME_LINK"] = self.options.static_runtime_link + tc.variables["SQLITE3MC_STATIC"] = not self.options.shared + tc.variables["SQLITE3MC_BUILD_SHELL"] = self.options.build_shell + tc.variables["SQLITE3MC_WITH_ICU"] = self.options.with_icu + + tc.variables["SQLITE_ENABLE_DEBUG"] = self.options.enable_debug + tc.variables["SQLITE_SOUNDEX"] = self.options.soundex + tc.variables["SQLITE_ENABLE_COLUMN_METADATA"] = self.options.enable_column_metadata + tc.variables["SQLITE_SECURE_DELETE"] = self.options.secure_delete + tc.variables["SQLITE_ENABLE_FTS3"] = self.options.enable_fts3 + tc.variables["SQLITE_ENABLE_FTS3_PARENTHESIS"] = self.options.enable_fts3_paranthesis + tc.variables["SQLITE_ENABLE_FTS4"] = self.options.enable_fts4 + tc.variables["SQLITE_ENABLE_FTS5"] = self.options.enable_fts5 + + tc.variables["SQLITE_ENABLE_CARRAY"] = self.options.enable_carray + tc.variables["SQLITE_ENABLE_CSV"] = self.options.enable_csv + tc.variables["SQLITE_ENABLE_EXTFUNC"] = self.options.enable_extfunc + tc.variables["SQLITE_ENABLE_GEOPOLY"] = self.options.enable_geopoly + tc.variables["SQLITE_ENABLE_RTREE"] = self.options.enable_rtree + tc.variables["SQLITE_ENABLE_UUID"] = self.options.enable_uuid + tc.variables["SQLITE_USE_URI"] = self.options.use_uri + tc.variables["SQLITE_USER_AUTHENTICATION"] = self.options.user_authentication + tc.variables["SQLITE_ENABLE_PREUPDATE_HOOK"] = self.options.enable_preupdate_hook + tc.variables["SQLITE_ENABLE_SESSION"] = self.options.enable_session + tc.variables["SQLITE_SHELL_IS_UTF8"] = self.options.shell_is_utf8 + + # Options for library only + tc.variables["SQLITE_ENABLE_FILEIO"] = self.options.enable_fileio + tc.variables["SQLITE_ENABLE_REGEXP"] = self.options.enable_regexp + tc.variables["SQLITE_ENABLE_SERIES"] = self.options.enable_series + tc.variables["SQLITE_ENABLE_SHA3"] = self.options.enable_sha3 + + # Options for shell only (compatibility with official SQLite shell) + tc.variables["SQLITE_ENABLE_EXPLAIN_COMMENTS"] = self.options.enable_explain_comments + tc.variables["SQLITE_ENABLE_DBPAGE_VTAB"] = self.options.enable_dbpage_vtab + tc.variables["SQLITE_ENABLE_DBSTAT_VTAB"] = self.options.enable_dbstat_vtab + tc.variables["SQLITE_ENABLE_STMTVTAB"] = self.options.enable_stmtvtab + tc.variables["SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION"] = self.options.enable_unknown_sql_function + + # Embedded Compression + tc.variables["SQLITE3MC_USE_MINIZ"] = self.options.use_miniz + + # Compression/Options that require ZLIB + tc.variables["SQLITE_ENABLE_COMPRESS"] = self.options.enable_compress + tc.variables["SQLITE_ENABLE_SQLAR"] = self.options.enable_sqlar + tc.variables["SQLITE_ENABLE_ZIPFILE"] = self.options.enable_zipfile + + # Legacy Encryption Extensions + tc.variables["SQLITE3MC_USE_SQLEET_LEGACY"] = self.options.use_sqleet_legacy + tc.variables["SQLITE3MC_USE_SQLCIPHER_LEGACY"] = self.options.use_sqlcipher_legacy + + # Additional memory security (filling freed memory allocations with zeros or random data) + tc.variables["SQLITE3MC_SECURE_MEMORY"] = self.options.secure_memory + tc.variables["SQLITE3MC_USE_RANDOM_FILL_MEMORY"] = self.options.use_random_fill_memory + + # Omit AES hardware support + tc.variables["SQLITE3MC_OMIT_AES_HARDWARE_SUPPORT"] = self.options.omit_aes_hardware_support + + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + cmake = CMake(self) + cmake.install() + copy(self, "LICENSE*", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"), keep_path=False) + + def package_info(self): + if self.options.shared: + self.cpp_info.libs = ["sqlite3mc"] + else: + self.cpp_info.libs = ["sqlite3mc_static"] + if self.settings.os in ("Linux", "FreeBSD", "Macos"): + 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 == "Macos": + self.cpp_info.frameworks.append("Security") diff --git a/recipes/sqlite3mc/all/test_package/CMakeLists.txt b/recipes/sqlite3mc/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..79301e1094eb1 --- /dev/null +++ b/recipes/sqlite3mc/all/test_package/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.15) +project(test_sqlite3mc C) + +find_package(sqlite3mc REQUIRED) + +add_executable(${PROJECT_NAME} + main.c +) + +target_link_libraries(${PROJECT_NAME} + sqlite3mc::sqlite3mc +) diff --git a/recipes/sqlite3mc/all/test_package/conanfile.py b/recipes/sqlite3mc/all/test_package/conanfile.py new file mode 100644 index 0000000000000..1b70bb597a5da --- /dev/null +++ b/recipes/sqlite3mc/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 sqlite3mcTest(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + + 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 can_run(self): + cmd = os.path.join(self.cpp.build.bindir, "test_sqlite3mc") + self.run(cmd, env="conanrun") diff --git a/recipes/sqlite3mc/all/test_package/main.c b/recipes/sqlite3mc/all/test_package/main.c new file mode 100644 index 0000000000000..efb9f3b4c701d --- /dev/null +++ b/recipes/sqlite3mc/all/test_package/main.c @@ -0,0 +1,73 @@ +#include +#include +#include + +int main(int argc, char *argv[]) +{ + sqlite3 *db; + const char *key = "password"; + const char *wrongKey = "wrongPassword"; + + // Create database + int rc = sqlite3_open("test.db", &db); + if (rc != SQLITE_OK) + { + fprintf(stderr, "Failed to open database: %s\n", sqlite3_errmsg(db)); + sqlite3_close(db); + return 1; + } + + // Encrypt + sqlite3_key(db, key, strlen(key)); + + // Fill db with some data and close it + rc = sqlite3_exec(db, "CREATE TABLE users (name TEXT NOT NULL, ID INTEGER PRIMARY KEY UNIQUE)", NULL, NULL, NULL); + if (rc != SQLITE_OK) + { + fprintf(stderr, "SQL error: %s\n", sqlite3_errmsg(db)); + sqlite3_close(db); + return 1; + } + rc = sqlite3_exec(db, "INSERT INTO users (name, ID) VALUES ('testUser', '12345')", NULL, NULL, NULL); + if (rc != SQLITE_OK) + { + fprintf(stderr, "SQL error: %s\n", sqlite3_errmsg(db)); + sqlite3_close(db); + return 1; + } + rc = sqlite3_close(db); + if (rc != SQLITE_OK) + { + fprintf(stderr, "Failed to close database: %s\n", sqlite3_errmsg(db)); + return 1; + } + + // Reopen and provide wrong key + rc = sqlite3_open("test.db", &db); + if (rc != SQLITE_OK) + { + fprintf(stderr, "Failed to open database: %s\n", sqlite3_errmsg(db)); + sqlite3_close(db); + return 1; + } + sqlite3_key(db, wrongKey, strlen(wrongKey)); + + // Try to access the database, should fail + rc = sqlite3_exec(db, "SELECT name FROM users WHERE ID = '12345'", NULL, NULL, NULL); + if (rc == SQLITE_OK) + { + fprintf(stderr, "Access was provided without the proper key\n"); + sqlite3_close(db); + return 1; + } + rc = sqlite3_close(db); + if (rc != SQLITE_OK) + { + fprintf(stderr, "Failed to close database: %s\n", sqlite3_errmsg(db)); + return 1; + } + + + fprintf(stdout, "Test successful\n"); + return 0; +} diff --git a/recipes/sqlite3mc/config.yml b/recipes/sqlite3mc/config.yml new file mode 100644 index 0000000000000..6ebdf822191fc --- /dev/null +++ b/recipes/sqlite3mc/config.yml @@ -0,0 +1,9 @@ +versions: + "1.9.0": + folder: all + "1.8.6": + folder: all + "1.8.4": + folder: all + "1.8.0": + folder: all diff --git a/recipes/sqlite_orm/all/conandata.yml b/recipes/sqlite_orm/all/conandata.yml index 2ec409a66f212..a5275f45fe034 100644 --- a/recipes/sqlite_orm/all/conandata.yml +++ b/recipes/sqlite_orm/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "1.9": + url: "https://github.com/fnc12/sqlite_orm/archive/refs/tags/v1.9.tar.gz" + sha256: "a2fa433e24f6873a9e8cd9dd7e49d2d12640b458f3f6f941163cf60f6673b8a2" + "1.8.2": + url: "https://github.com/fnc12/sqlite_orm/archive/refs/tags/v1.8.2.tar.gz" + sha256: "56e0c7729800637a8061658d0fdad4424d2cdde77b063d23cc1b76aa20339072" + "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" @@ -14,3 +23,6 @@ sources: patches: "1.7": - patch_file: "patches/0001-declare-is-upsert-clause.patch" + 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 a3b8fcd9aac81..4c411ee943206 100644 --- a/recipes/sqlite_orm/all/conanfile.py +++ b/recipes/sqlite_orm/all/conanfile.py @@ -3,6 +3,7 @@ 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.scm import Version import os required_conan_version = ">=1.52.0" @@ -12,9 +13,10 @@ class SqliteOrmConan(ConanFile): name = "sqlite_orm" description = "SQLite ORM light header only library for modern C++." license = "BSD-3-Clause" - topics = ("sqlite", "sql", "database", "orm") - homepage = "https://github.com/fnc12/sqlite_orm" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/fnc12/sqlite_orm" + topics = ("sqlite", "sql", "database", "orm", "header-only") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" @property @@ -24,7 +26,7 @@ def _min_cppstd(self): @property def _compilers_minimum_version(self): return { - "gcc": "5", + "gcc": "5" if Version(self.version) < "1.9" else "8", "Visual Studio": "14", "msvc": "190", "clang": "3.4", @@ -38,7 +40,7 @@ def layout(self): basic_layout(self, src_folder="src") def requirements(self): - self.requires("sqlite3/3.39.4", transitive_headers=True, transitive_libs=True) + self.requires("sqlite3/3.45.0", transitive_headers=True, transitive_libs=True) def package_id(self): self.info.clear() diff --git a/recipes/sqlite_orm/all/test_v1_package/CMakeLists.txt b/recipes/sqlite_orm/all/test_v1_package/CMakeLists.txt index c4fec8ca6bb0b..be00a8c7f57c7 100644 --- a/recipes/sqlite_orm/all/test_v1_package/CMakeLists.txt +++ b/recipes/sqlite_orm/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(SqliteOrm REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE sqlite_orm::sqlite_orm) -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/sqlite_orm/config.yml b/recipes/sqlite_orm/config.yml index f4a2bdf415db3..62ef26b962237 100644 --- a/recipes/sqlite_orm/config.yml +++ b/recipes/sqlite_orm/config.yml @@ -1,4 +1,10 @@ versions: + "1.9": + folder: all + "1.8.2": + folder: all + "1.8.1": + folder: all "1.8": folder: all "1.7.1": diff --git a/recipes/sqlitecpp/all/conandata.yml b/recipes/sqlitecpp/all/conandata.yml index ee0a68eaa6f16..d52b243030764 100644 --- a/recipes/sqlitecpp/all/conandata.yml +++ b/recipes/sqlitecpp/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "3.3.2": + url: "https://github.com/SRombauts/SQLiteCpp/archive/3.3.2.tar.gz" + sha256: "5aa8eda130d0689bd5ed9b2074714c2dbc610f710483c61ba6cf944cebfe03af" + "3.3.1": + url: "https://github.com/SRombauts/SQLiteCpp/archive/3.3.1.tar.gz" + sha256: "71f990f9fb4b004533b6859ce40729af823b87fe691dd99ca084a7fd40db54b9" + "3.3.0": + url: "https://github.com/SRombauts/SQLiteCpp/archive/3.3.0.tar.gz" + sha256: "4a37dd63cf91235ea2ef4494054700c144b3f96e93a330ef61ed53d106353e9c" "3.2.1": url: "https://github.com/SRombauts/SQLiteCpp/archive/3.2.1.tar.gz" sha256: "70c67d5680c47460f82a7abf8e6b0329bf2fb10795a982a6d8abc06adb42d693" diff --git a/recipes/sqlitecpp/all/conanfile.py b/recipes/sqlitecpp/all/conanfile.py index 70dd5900f9a1a..fb8b5040fb9dc 100644 --- a/recipes/sqlitecpp/all/conanfile.py +++ b/recipes/sqlitecpp/all/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.files import copy, get, apply_conandata_patches, replace_in_file, rmdir, save +from conan.tools.files import copy, get, apply_conandata_patches, export_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 @@ -14,10 +14,11 @@ class SQLiteCppConan(ConanFile): name = "sqlitecpp" description = "SQLiteCpp is a smart and easy to use C++ sqlite3 wrapper" - topics = ("sqlite", "sqlite3", "data-base") + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/SRombauts/SQLiteCpp" - license = "MIT" + topics = ("sqlite", "sqlite3", "data-base") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -31,8 +32,7 @@ class SQLiteCppConan(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 +43,7 @@ def configure(self): self.options.rm_safe("fPIC") def requirements(self): - self.requires("sqlite3/3.40.0") + self.requires("sqlite3/3.45.0") def validate(self): if Version(self.version) >= "3.0.0" and self.info.settings.compiler.get_safe("cppstd"): diff --git a/recipes/sqlitecpp/config.yml b/recipes/sqlitecpp/config.yml index e29442357e51d..98605ec73a785 100644 --- a/recipes/sqlitecpp/config.yml +++ b/recipes/sqlitecpp/config.yml @@ -1,4 +1,10 @@ versions: + "3.3.2": + folder: all + "3.3.1": + folder: all + "3.3.0": + folder: all "3.2.1": folder: all "3.2.0": diff --git a/recipes/sqlpp11-connector-sqlite3/all/CMakeLists.txt b/recipes/sqlpp11-connector-sqlite3/all/CMakeLists.txt deleted file mode 100644 index 217b9530b904d..0000000000000 --- a/recipes/sqlpp11-connector-sqlite3/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/sqlpp11-connector-sqlite3/all/conandata.yml b/recipes/sqlpp11-connector-sqlite3/all/conandata.yml index 6f7198fb9a268..9beca69bcc840 100644 --- a/recipes/sqlpp11-connector-sqlite3/all/conandata.yml +++ b/recipes/sqlpp11-connector-sqlite3/all/conandata.yml @@ -8,7 +8,5 @@ sources: patches: "0.29": - patch_file: "patches/cmake-dependencies.patch" - base_path: "source_subfolder" "0.30": - patch_file: "patches/cmake-dependencies.patch" - base_path: "source_subfolder" diff --git a/recipes/sqlpp11-connector-sqlite3/all/conanfile.py b/recipes/sqlpp11-connector-sqlite3/all/conanfile.py index 964d73c54cc6d..ceff1e9e63969 100644 --- a/recipes/sqlpp11-connector-sqlite3/all/conanfile.py +++ b/recipes/sqlpp11-connector-sqlite3/all/conanfile.py @@ -1,30 +1,36 @@ -from conans import ConanFile, CMake, tools import os +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, replace_in_file + +required_conan_version = ">=1.53.0" + class sqlpp11Conan(ConanFile): name = "sqlpp11-connector-sqlite3" description = "A C++ wrapper for sqlite3 meant to be used in combination with sqlpp11." - topics = ("conan", "sqlpp11-connector-sqlite3", "sqlite3", "sqlpp11", "sql", "database") - settings = "os", "compiler", "build_type", "arch" + license = "BSD-2-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/rbock/sqlpp11-connector-sqlite3" - license = "BSD-2-Clause" - exports_sources = ["CMakeLists.txt", "patches/**"] - generators = "cmake" - options = {"shared": [True, False], "fPIC": [True, False], "with_sqlcipher": [True, False]} - default_options = {"shared": False, "fPIC": True, "with_sqlcipher": False} - short_paths = True - - _cmake = None + topics = ("sqlite3", "sqlpp11", "sql", "database") - @property - def _source_subfolder(self): - return "source_subfolder" + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_sqlcipher": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_sqlcipher": False, + } - @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": @@ -32,46 +38,54 @@ 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.cppstd: - tools.check_min_cppstd(self, 11) + check_min_cppstd(self, 11) def requirements(self): - self.requires("sqlpp11/0.59") + self.requires("sqlpp11/0.60", transitive_headers=True, transitive_libs=True) if self.options.with_sqlcipher: - self.requires("sqlcipher/4.4.0") + self.requires("sqlcipher/4.5.1", transitive_headers=True, transitive_libs=True) else: - self.requires("sqlite3/3.32.3") + self.requires("sqlite3/3.44.2", transitive_headers=True, transitive_libs=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 self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["ENABLE_TESTS"] = False - self._cmake.definitions["SQLCIPHER"] = self.options.with_sqlcipher - self._cmake.definitions["SQLPP11_INCLUDE_DIR"] = self.deps_cpp_info["sqlpp11"].include_paths[0] - 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["ENABLE_TESTS"] = False + tc.variables["SQLCIPHER"] = self.options.with_sqlcipher + tc.variables["SQLPP11_INCLUDE_DIR"] = self.dependencies["sqlpp11"].cpp_info.includedir.replace("\\", "/") + tc.generate() + tc = CMakeDeps(self) + tc.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "Sqlite3", "SQLite3") 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", 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() def package_info(self): self.cpp_info.libs = ["sqlpp11-connector-sqlite3"] - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["m"] if self.options.with_sqlcipher: self.cpp_info.defines = ["SQLPP_USE_SQLCIPHER"] diff --git a/recipes/sqlpp11-connector-sqlite3/all/patches/cmake-dependencies.patch b/recipes/sqlpp11-connector-sqlite3/all/patches/cmake-dependencies.patch index e9244768a488a..4404ff45a4a13 100644 --- a/recipes/sqlpp11-connector-sqlite3/all/patches/cmake-dependencies.patch +++ b/recipes/sqlpp11-connector-sqlite3/all/patches/cmake-dependencies.patch @@ -10,19 +10,21 @@ $ $) -@@ -58,14 +55,13 @@ endif() +@@ -58,14 +55,16 @@ endif() if (SQLCIPHER) target_compile_definitions(sqlpp11-connector-sqlite3 PUBLIC SQLPP_USE_SQLCIPHER) -- target_link_libraries(sqlpp11-connector-sqlite3 SQLCipher::SQLCipher) + target_link_libraries(sqlpp11-connector-sqlite3 SQLCipher::SQLCipher) if (SQLPP_DYNAMIC_LOADING) target_compile_definitions(sqlpp11-connector-sqlite3-dynamic PUBLIC SQLPP_USE_SQLCIPHER) target_include_directories(sqlpp11-connector-sqlite3-dynamic PUBLIC ${SQLCIPHER_INCLUDE_DIRS}) endif() else() - target_link_libraries(sqlpp11-connector-sqlite3 ${SQLITE3_LIBRARIES}) ++ target_link_libraries(sqlpp11-connector-sqlite3 SQLite::SQLite3) endif() -+target_link_libraries(sqlpp11-connector-sqlite3 ${CONAN_LIBS}) ++find_package(Sqlpp11 REQUIRED) ++target_link_libraries(sqlpp11-connector-sqlite3 sqlpp11::sqlpp11) install(TARGETS sqlpp11-connector-sqlite3 ARCHIVE DESTINATION lib diff --git a/recipes/sqlpp11-connector-sqlite3/all/test_package/CMakeLists.txt b/recipes/sqlpp11-connector-sqlite3/all/test_package/CMakeLists.txt index 33ae887aa6aea..b337307874b0e 100644 --- a/recipes/sqlpp11-connector-sqlite3/all/test_package/CMakeLists.txt +++ b/recipes/sqlpp11-connector-sqlite3/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -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() +find_package(sqlpp11-connector-sqlite3 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE sqlpp11-connector-sqlite3::sqlpp11-connector-sqlite3) set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) diff --git a/recipes/sqlpp11-connector-sqlite3/all/test_package/conanfile.py b/recipes/sqlpp11-connector-sqlite3/all/test_package/conanfile.py index 008c4dc3fb8e3..ad0d5f8f22ebd 100644 --- a/recipes/sqlpp11-connector-sqlite3/all/test_package/conanfile.py +++ b/recipes/sqlpp11-connector-sqlite3/all/test_package/conanfile.py @@ -1,11 +1,26 @@ -from conans import ConanFile, CMake, tools import os import sqlite3 +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +from conan.tools.files import save, load + 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 generate(self): + with_sqlcipher = bool(self.dependencies["sqlpp11-connector-sqlite3"].options.with_sqlcipher) + save(self, os.path.join(self.build_folder, "with_sqlcipher"), repr(with_sqlcipher)) def build(self): cmake = CMake(self) @@ -13,17 +28,18 @@ 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): + with_sqlcipher = load(self, os.path.join(self.build_folder, "with_sqlcipher")) == "True" + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + self.run(bin_path, env="conanrun") # test that the database is encrypted when sqlcipher is used con = sqlite3.connect("test.db") cursor = con.cursor() try: cursor.execute("select * from tab_sample") except sqlite3.DatabaseError: - assert self.options["sqlpp11-connector-sqlite3"].with_sqlcipher + assert with_sqlcipher self.output.info("database is encrypted with sqlcipher") return - assert not self.options["sqlpp11-connector-sqlite3"].with_sqlcipher + assert not with_sqlcipher self.output.info("database is not encrypted") diff --git a/recipes/sqlpp11-connector-sqlite3/all/test_v1_package/CMakeLists.txt b/recipes/sqlpp11-connector-sqlite3/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/sqlpp11-connector-sqlite3/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/sqlpp11-connector-sqlite3/all/test_v1_package/conanfile.py b/recipes/sqlpp11-connector-sqlite3/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..2e455dff72b5e --- /dev/null +++ b/recipes/sqlpp11-connector-sqlite3/all/test_v1_package/conanfile.py @@ -0,0 +1,29 @@ +from conans import ConanFile, CMake, tools +import os +import sqlite3 + + +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) + # test that the database is encrypted when sqlcipher is used + con = sqlite3.connect("test.db") + cursor = con.cursor() + try: + cursor.execute("select * from tab_sample") + except sqlite3.DatabaseError: + assert self.options["sqlpp11-connector-sqlite3"].with_sqlcipher + self.output.info("database is encrypted with sqlcipher") + return + assert not self.options["sqlpp11-connector-sqlite3"].with_sqlcipher + self.output.info("database is not encrypted") diff --git a/recipes/sqlpp11/all/conandata.yml b/recipes/sqlpp11/all/conandata.yml index 08915d57967e4..6b607672eff4f 100644 --- a/recipes/sqlpp11/all/conandata.yml +++ b/recipes/sqlpp11/all/conandata.yml @@ -1,13 +1,16 @@ sources: - "0.58": - url: "https://github.com/rbock/sqlpp11/archive/0.58.zip" - sha256: 8e2ba487b7a0ddc988bcfa5366443a0f5ca9f38ef86ac8e3f257801ab3cbf8eb - "0.59": - url: "https://github.com/rbock/sqlpp11/archive/0.59.zip" - sha256: 62ba9ba078e05901aa47cb056240bb474f9b8ef5cabf114f8219b4a6fa4f019b - "0.60": - url: "https://github.com/rbock/sqlpp11/archive/0.60.zip" - sha256: 27ccc750d5eb8f234445e26e41d53d72c9df329eb2b30d64dbf21078ae57c52c + "0.64": + url: "https://github.com/rbock/sqlpp11/archive/0.64.tar.gz" + sha256: "72e6d37c716cc45b38c3cf4541604f16224aaa3b511d1f1d0be0c49176c3be86" + "0.63": + url: "https://github.com/rbock/sqlpp11/archive/0.63.tar.gz" + sha256: "8e8229501679435e5052c2184d6772e4d6f61e6a9e2ec7231c5fb9a3d3b88d7e" + "0.62": + url: "https://github.com/rbock/sqlpp11/archive/0.62.tar.gz" + sha256: "6d8326e94c5b14a863ead15688d853ab7854136caa9ebc47389a833fe79db7c5" "0.61": url: "https://github.com/rbock/sqlpp11/archive/0.61.tar.gz" sha256: "d5a95e28ae93930f7701f517b1342ac14bcf33a9b1c5b5f0dff6aea5e315bb50" + "0.60": + url: "https://github.com/rbock/sqlpp11/archive/0.60.zip" + sha256: 27ccc750d5eb8f234445e26e41d53d72c9df329eb2b30d64dbf21078ae57c52c diff --git a/recipes/sqlpp11/all/conanfile.py b/recipes/sqlpp11/all/conanfile.py index 384cf91a4b695..9b3a725b38559 100644 --- a/recipes/sqlpp11/all/conanfile.py +++ b/recipes/sqlpp11/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 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.53.0" class Sqlpp11Conan(ConanFile): @@ -12,60 +16,53 @@ class Sqlpp11Conan(ConanFile): homepage = "https://github.com/rbock/sqlpp11" description = "A type safe SQL template library for C++" topics = ("sql", "dsl", "embedded", "data-base") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _min_stdcpp_version(self): - return 11 if tools.Version(self.version) < "0.61" else 14 + def _min_cppstd(self): + return 11 if Version(self.version) < "0.61" else 14 @property def _compilers_minimum_version(self): return { "gcc": "5", "Visual Studio": "14", + "msvc": "190", "clang": "3.4", "apple-clang": "10", } + def layout(self): + basic_layout(self, src_folder="src") + def requirements(self): self.requires("date/3.0.1") - def validate(self): - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, self._min_stdcpp_version) - - if self._min_stdcpp_version > 11: - 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(f"{self.name} requires C++14, which your compiler does not support.") - else: - self.output.warn(f"{self.name} requires C++14. Your compiler is unknown. Assuming it supports C++14.") - 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], strip_root=True) 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")) - self.copy("*", dst="bin", src=os.path.join(self._source_subfolder, "scripts")) + copy(self, pattern="LICENSE", 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, "*", dst=os.path.join(self.package_folder, "bin"), src=os.path.join(self.source_folder, "scripts")) def package_info(self): - self.cpp_info.filenames["cmake_find_package"] = "Sqlpp11" - self.cpp_info.filenames["cmake_find_package_multi"] = "Sqlpp11" + self.cpp_info.libdirs = [] + + self.cpp_info.set_property("cmake_file_name", "Sqlpp11") + self.cpp_info.set_property("cmake_target_name", "sqlpp11::sqlpp11") - 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_* generators removed + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/sqlpp11/all/test_package/CMakeLists.txt b/recipes/sqlpp11/all/test_package/CMakeLists.txt index 209e56f42630d..6c3b3cedf8364 100644 --- a/recipes/sqlpp11/all/test_package/CMakeLists.txt +++ b/recipes/sqlpp11/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(PackageTest CXX) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +find_package(Sqlpp11 REQUIRED CONFIG) -find_package(Sqlpp11 CONFIG REQUIRED) - -add_executable(example example.cpp) -set_property(TARGET example PROPERTY CXX_STANDARD 14) -target_link_libraries(example sqlpp11::sqlpp11) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE sqlpp11::sqlpp11) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/sqlpp11/all/test_package/conanfile.py b/recipes/sqlpp11/all/test_package/conanfile.py index 11eb01c13ada3..3a91c9439218e 100644 --- a/recipes/sqlpp11/all/test_package/conanfile.py +++ b/recipes/sqlpp11/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 Sqlpp11TestConan(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,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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/sqlpp11/all/test_package/example.cpp b/recipes/sqlpp11/all/test_package/example.cpp deleted file mode 100644 index 9b0644427156d..0000000000000 --- a/recipes/sqlpp11/all/test_package/example.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main() -{ - sqlpp::connection c; -} diff --git a/recipes/sqlpp11/all/test_package/test_package.cpp b/recipes/sqlpp11/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..aa306d637efdd --- /dev/null +++ b/recipes/sqlpp11/all/test_package/test_package.cpp @@ -0,0 +1,8 @@ +#include +#include +#include + +int main() { + select(sqlpp::value(false).as(sqlpp::alias::a)); + return EXIT_SUCCESS; +} diff --git a/recipes/sqlpp11/all/test_v1_package/CMakeLists.txt b/recipes/sqlpp11/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/sqlpp11/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/sqlpp11/all/test_v1_package/conanfile.py b/recipes/sqlpp11/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..37ada808989d9 --- /dev/null +++ b/recipes/sqlpp11/all/test_v1_package/conanfile.py @@ -0,0 +1,19 @@ +import os + +from conan.tools.build import cross_building +from conans import ConanFile, CMake + + +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/sqlpp11/config.yml b/recipes/sqlpp11/config.yml index a51d2c88cb4ae..cd4a669a1a8d7 100644 --- a/recipes/sqlpp11/config.yml +++ b/recipes/sqlpp11/config.yml @@ -1,9 +1,11 @@ versions: - "0.58": + "0.64": folder: "all" - "0.59": + "0.63": folder: "all" - "0.60": + "0.62": folder: "all" "0.61": folder: "all" + "0.60": + folder: "all" 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/srt/all/CMakeLists.txt b/recipes/srt/all/CMakeLists.txt deleted file mode 100644 index 591533b782973..0000000000000 --- a/recipes/srt/all/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -cmake_minimum_required(VERSION 2.8.11) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -if(CONAN_LIBS_PTHREADS4W) - set(PTHREAD_LIBRARY "${CONAN_LIBS_PTHREADS4W}") - set(PTHREAD_INCLUDE_DIR "${CONAN_INCLUDE_DIRS_PTHREADS4W}") -endif() - -add_subdirectory("source_subfolder") diff --git a/recipes/srt/all/conandata.yml b/recipes/srt/all/conandata.yml index e10fcb414463b..f2aa06e6bc0c5 100644 --- a/recipes/srt/all/conandata.yml +++ b/recipes/srt/all/conandata.yml @@ -1,17 +1,7 @@ sources: - "1.4.1": - sha256: e80ca1cd0711b9c70882c12ec365cda1ba852e1ce8acd43161a21a04de0cbf14 - url: https://github.com/Haivision/srt/archive/v1.4.1.tar.gz - "1.4.2": - sha256: 28a308e72dcbb50eb2f61b50cc4c393c413300333788f3a8159643536684a0c4 - url: https://github.com/Haivision/srt/archive/v1.4.2.tar.gz - "1.4.3": - sha256: c06e05664c71d635c37207a2b5a444f2c4a95950a3548402b3e0c524f735b33d - url: https://github.com/Haivision/srt/archive/refs/tags/v1.4.3.tar.gz + "1.5.3": + url: "https://github.com/Haivision/srt/archive/v1.5.3.tar.gz" + sha256: "befaeb16f628c46387b898df02bc6fba84868e86a6f6d8294755375b9932d777" "1.4.4": url: "https://github.com/Haivision/srt/archive/v1.4.4.tar.gz" sha256: "93f5f3715bd5bd522b8d65fc0d086ef2ad49db6a41ad2d7b35df2e8bd7094114" -patches: - "1.4.1": - - patch_file: "patches/no-delayload-libeay32.patch" - base_path: "source_subfolder" diff --git a/recipes/srt/all/conanfile.py b/recipes/srt/all/conanfile.py index dfed1538859cc..de823d876bdc8 100644 --- a/recipes/srt/all/conanfile.py +++ b/recipes/srt/all/conanfile.py @@ -1,41 +1,34 @@ -from conans import ConanFile, CMake, tools import os -required_conan_version = ">=1.33.0" +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 +from conan.tools.microsoft import is_msvc + +required_conan_version = ">=1.53.0" class SrtConan(ConanFile): name = "srt" - homepage = "https://github.com/Haivision/srt" - description = "Secure Reliable Transport (SRT) is an open source transport technology that optimizes streaming performance across unpredictable networks, such as the Internet." - topics = ("conan", "srt", "ip", "transport") - url = "https://github.com/conan-io/conan-center-index" + description = ( + "Secure Reliable Transport (SRT) is an open source transport technology that optimizes streaming" + " performance across unpredictable networks, such as the Internet." + ) license = "MPL-2.0" - settings = "os", "compiler", "build_type", "arch" - options = {"shared": [True, False], "fPIC": [True, False]} - default_options = {"shared": False, "fPIC": True} - short_paths = True - - 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" - - @property - def _has_stdcxx_sync(self): - return tools.Version(self.version) >= "1.4.2" - - @property - def _has_posix_threads(self): - return not (self.settings.os == "Windows" and (self.settings.compiler == "Visual Studio" or \ - (self.settings.compiler == "gcc" and self.settings.compiler.get_safe("threads") == "win32"))) + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/Haivision/srt" + topics = ("ip", "transport") + + 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": @@ -43,61 +36,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("openssl/1.1.1q") - if not self._has_posix_threads and not self._has_stdcxx_sync: - self.requires("pthreads4w/3.0.0") + self.requires("openssl/[>=1.1 <4]") 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) - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "set (CMAKE_MODULE_PATH \"${CMAKE_CURRENT_SOURCE_DIR}/scripts\")", - "list(APPEND CMAKE_MODULE_PATH \"${CMAKE_CURRENT_SOURCE_DIR}/scripts\")") - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["ENABLE_APPS"] = False - self._cmake.definitions["ENABLE_LOGGING"] = False - self._cmake.definitions["ENABLE_SHARED"] = self.options.shared - self._cmake.definitions["ENABLE_STATIC"] = not self.options.shared - if self._has_stdcxx_sync: - self._cmake.definitions["ENABLE_STDCXX_SYNC"] = True - self._cmake.definitions["ENABLE_ENCRYPTION"] = True - self._cmake.definitions["USE_OPENSSL_PC"] = False - if self.settings.compiler == "Visual Studio": + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["ENABLE_APPS"] = False + tc.variables["ENABLE_LOGGING"] = False + tc.variables["ENABLE_SHARED"] = self.options.shared + tc.variables["ENABLE_STATIC"] = not self.options.shared + tc.variables["ENABLE_STDCXX_SYNC"] = True + tc.variables["ENABLE_ENCRYPTION"] = True + tc.variables["USE_OPENSSL_PC"] = False + if is_msvc(self): # required to avoid warnings when srt shared, even if openssl shared, # otherwise upstream CMakeLists would add /DELAYLOAD:libeay32.dll to link flags - self._cmake.definitions["OPENSSL_USE_STATIC_LIBS"] = True - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + tc.variables["OPENSSL_USE_STATIC_LIBS"] = True + tc.generate() + + tc = CMakeDeps(self) + tc.generate() + + def _patch_sources(self): + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + 'set (CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/scripts")', + 'list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/scripts")') 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", 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")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): - self.cpp_info.names["pkg_config"] = "srt" - suffix = "_static" if self.settings.compiler == "Visual Studio" and not self.options.shared else "" + self.cpp_info.set_property("pkg_config_name", "srt") + suffix = "_static" if is_msvc(self) and not self.options.shared else "" self.cpp_info.libs = ["srt" + suffix] if self.options.shared: self.cpp_info.defines = ["SRT_DYNAMIC"] - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["pthread"] if self.settings.os == "Windows": self.cpp_info.system_libs = ["ws2_32"] diff --git a/recipes/srt/all/patches/no-delayload-libeay32.patch b/recipes/srt/all/patches/no-delayload-libeay32.patch deleted file mode 100644 index 9916c2deb6bec..0000000000000 --- a/recipes/srt/all/patches/no-delayload-libeay32.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -627,7 +627,11 @@ if (srt_libspec_shared) - endif() - if (MICROSOFT) - target_link_libraries(${TARGET_srt}_shared PRIVATE ws2_32.lib) -- set_target_properties(${TARGET_srt}_shared PROPERTIES LINK_FLAGS "/DELAYLOAD:libeay32.dll") -+ if (OPENSSL_USE_STATIC_LIBS) -+ target_link_libraries(${TARGET_srt}_shared PRIVATE crypt32.lib) -+ else() -+ set_target_properties(${TARGET_srt}_shared PROPERTIES LINK_FLAGS "/DELAYLOAD:libeay32.dll") -+ endif() - elseif (MINGW) - target_link_libraries(${TARGET_srt}_shared PRIVATE wsock32.lib ws2_32.lib) - elseif (APPLE) diff --git a/recipes/srt/all/test_package/CMakeLists.txt b/recipes/srt/all/test_package/CMakeLists.txt index dd27cce4bb0ad..d665f87ea9368 100644 --- a/recipes/srt/all/test_package/CMakeLists.txt +++ b/recipes/srt/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ -cmake_minimum_required(VERSION 3.1.2) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(srt REQUIRED) +find_package(srt REQUIRED CONFIG) add_executable(${CMAKE_PROJECT_NAME} test_package.cpp) target_link_libraries(${CMAKE_PROJECT_NAME} srt::srt) diff --git a/recipes/srt/all/test_package/conanfile.py b/recipes/srt/all/test_package/conanfile.py index 9294e13566895..ef5d7042163ec 100644 --- a/recipes/srt/all/test_package/conanfile.py +++ b/recipes/srt/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", "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,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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/srt/all/test_v1_package/CMakeLists.txt b/recipes/srt/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/srt/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/srt/all/test_v1_package/conanfile.py b/recipes/srt/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..b5ecfa88d3a13 --- /dev/null +++ b/recipes/srt/all/test_v1_package/conanfile.py @@ -0,0 +1,16 @@ +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.settings): + self.run(os.path.join("bin","test_package"), run_environment=True) diff --git a/recipes/srt/config.yml b/recipes/srt/config.yml index 09ca969e279a3..6cb0ec6a4e99a 100644 --- a/recipes/srt/config.yml +++ b/recipes/srt/config.yml @@ -1,9 +1,5 @@ versions: - "1.4.1": - folder: all - "1.4.2": - folder: all - "1.4.3": + "1.5.3": folder: all "1.4.4": folder: all diff --git a/recipes/ssht/all/conandata.yml b/recipes/ssht/all/conandata.yml index 077fff5429d55..dab3a69b6f7e9 100644 --- a/recipes/ssht/all/conandata.yml +++ b/recipes/ssht/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.5.2": + url: "https://github.com/astro-informatics/ssht/archive/v1.5.2.tar.gz" + sha256: "6ce3e48d36a4af57cab9d96f5f845f905808dac8ac8b3ec195f6b49d017a890d" "1.4.0": url: "https://github.com/astro-informatics/ssht/archive/v1.4.0.tar.gz" sha256: "b33f1b763a240df773a1900139aad6f6b5c676bb2b64a8c1062077fd95c08769" diff --git a/recipes/ssht/all/conanfile.py b/recipes/ssht/all/conanfile.py index bbf74c31ff0c0..aa4695a01d154 100644 --- a/recipes/ssht/all/conanfile.py +++ b/recipes/ssht/all/conanfile.py @@ -1,9 +1,13 @@ from conan import ConanFile -from conan.tools import files from conan.errors import ConanInvalidConfiguration -from conans import CMake +from conan.tools.microsoft import is_msvc +from conan.tools.files import get, copy, rmdir +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +import os + + +required_conan_version = ">=1.53.0" -required_conan_version = ">=1.50.0" class SshtConan(ConanFile): name = "ssht" @@ -13,47 +17,51 @@ class SshtConan(ConanFile): description = "Fast spin spherical harmonic transforms" settings = "os", "arch", "compiler", "build_type" topics = ("physics", "astrophysics", "radio interferometry") + package_type = "static-library" options = {"fPIC": [True, False]} default_options = {"fPIC": True} - requires = "fftw/3.3.9" - generators = "cmake", "cmake_find_package", "cmake_paths" - exports_sources = ["CMakeLists.txt"] - @property - def _source_subfolder(self): - return "source_subfolder" + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC - @property - def _build_subfolder(self): - return "build_subfolder" + def configure(self): + 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("fftw/3.3.10") - def config_options(self): - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx - def validate(self): - if self.settings.compiler == "Visual Studio": + if is_msvc(self): raise ConanInvalidConfiguration("SSHT requires C99 support for complex numbers.") def source(self): - files.get(self, **self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - @property - def cmake(self): - if not hasattr(self, "_cmake"): - self._cmake = CMake(self) - self._cmake.definitions["tests"] = False - self._cmake.definitions["python"] = False - 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.cache_variables["tests"] = False + tc.cache_variables["python"] = False + tc.generate() + deps = CMakeDeps(self) + deps.set_property("fftw", "cmake_target_name", "FFTW3::FFTW3") + deps.generate() + def build(self): - self.cmake.build() + cmake = CMake(self) + cmake.configure() + cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.cmake.install() + 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 = ["ssht"] diff --git a/recipes/ssht/all/test_package/CMakeLists.txt b/recipes/ssht/all/test_package/CMakeLists.txt index dfe499c06a976..ef70db67c0029 100644 --- a/recipes/ssht/all/test_package/CMakeLists.txt +++ b/recipes/ssht/all/test_package/CMakeLists.txt @@ -1,11 +1,9 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package C) +cmake_minimum_required(VERSION 3.15) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +project(test_package LANGUAGES C) find_package(Ssht REQUIRED NO_MODULE) add_executable(${PROJECT_NAME} example.c) target_compile_features(${PROJECT_NAME} PUBLIC c_std_99) -target_link_libraries(${PROJECT_NAME} ssht::ssht) +target_link_libraries(${PROJECT_NAME} PRIVATE ssht::ssht) diff --git a/recipes/ssht/all/test_package/conanfile.py b/recipes/ssht/all/test_package/conanfile.py index 4930d744506dc..ef5d7042163ec 100644 --- a/recipes/ssht/all/test_package/conanfile.py +++ b/recipes/ssht/all/test_package/conanfile.py @@ -1,13 +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 SshtTestConan(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 configure(self): - del self.settings.compiler.libcxx + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -15,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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/ssht/config.yml b/recipes/ssht/config.yml index fc50f8a9c5846..aca406dbf9f3f 100644 --- a/recipes/ssht/config.yml +++ b/recipes/ssht/config.yml @@ -1,4 +1,6 @@ versions: + "1.5.2": + folder: all "1.4.0": folder: all "1.3.7": diff --git a/recipes/ssp/all/conandata.yml b/recipes/ssp/all/conandata.yml new file mode 100644 index 0000000000000..220fd55612197 --- /dev/null +++ b/recipes/ssp/all/conandata.yml @@ -0,0 +1,13 @@ +sources: + "1.8.0": + url: "https://github.com/red0124/ssp/archive/refs/tags/v1.8.0.tar.gz" + sha256: "a4416746023c8a60f6808200193dd207f1044b6e37e6c5bc0462e85452307d1d" + "1.7.2": + url: "https://github.com/red0124/ssp/archive/refs/tags/v1.7.2.tar.gz" + sha256: "700e05d304fe10f05331d0a963757257632dddc1f9442b826a85efa545c64772" + "1.6.2": + url: "https://github.com/red0124/ssp/archive/refs/tags/v1.6.2.tar.gz" + sha256: "6fa5ae1cd458eae3c1931e8cbcbd8d97956eda37db1388358456ca0743b48b7c" + "1.6.1": + url: "https://github.com/red0124/ssp/archive/refs/tags/v1.6.1.tar.gz" + sha256: "4cdf75959b0a5fabd0b3e6ec1bad41d7c3f298d5b7f822d6e12b7e4d7dfcdd34" diff --git a/recipes/ssp/all/conanfile.py b/recipes/ssp/all/conanfile.py new file mode 100644 index 0000000000000..5cb7a535180b4 --- /dev/null +++ b/recipes/ssp/all/conanfile.py @@ -0,0 +1,68 @@ +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 SspConan(ConanFile): + name = "ssp" + description = "C++ CSV parser" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/red0124/ssp" + topics = ("csv", "parser", "header-only") + package_type = "header-library" + 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", + "Visual Studio": "16", + "msvc": "192", + } + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("fast_float/6.1.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) + 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/ssp/all/test_package/CMakeLists.txt b/recipes/ssp/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..16a9ddec50721 --- /dev/null +++ b/recipes/ssp/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(ssp REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE ssp::ssp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/ssp/all/test_package/conanfile.py b/recipes/ssp/all/test_package/conanfile.py new file mode 100644 index 0000000000000..e845ae751a301 --- /dev/null +++ b/recipes/ssp/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/ssp/all/test_package/test_package.cpp b/recipes/ssp/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..f3a0c45ba8513 --- /dev/null +++ b/recipes/ssp/all/test_package/test_package.cpp @@ -0,0 +1,12 @@ +#include "ss/converter.hpp" + +int main() { + auto converter = ss::converter{}; + + auto val = converter.convert("5"); + + if (val == 5) { + return 0; + } + return 1; +} diff --git a/recipes/ssp/config.yml b/recipes/ssp/config.yml new file mode 100644 index 0000000000000..e1c88426892a4 --- /dev/null +++ b/recipes/ssp/config.yml @@ -0,0 +1,9 @@ +versions: + "1.8.0": + folder: all + "1.7.2": + folder: all + "1.6.2": + folder: all + "1.6.1": + folder: all diff --git a/recipes/st_tree/all/conanfile.py b/recipes/st_tree/all/conanfile.py index 2654379b52b95..0f32eb68fb548 100644 --- a/recipes/st_tree/all/conanfile.py +++ b/recipes/st_tree/all/conanfile.py @@ -1,42 +1,36 @@ +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy import os -from conans.errors import ConanInvalidConfiguration -from conans import ConanFile, CMake, tools -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" class STTreeConan(ConanFile): name = "st_tree" + description = "A fast and flexible c++ template class for tree data structures" license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" - description = "A fast and flexible c++ template class for tree data structures" - topics = ("stl", "container", "data-structures") homepage = "https://github.com/erikerlandson/st_tree" + topics = ("stl", "container", "data-structures", "tree", "header-only") + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" + def package_id(self): + self.info.clear() - def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, 11) - def _configure_cmake(self): - cmake = CMake(self) - cmake.configure(source_folder=self._source_subfolder) - return cmake + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): - self.copy("LICENSE", "licenses", self._source_subfolder) - - cmake = self._configure_cmake() - cmake.install() - - tools.rmdir(os.path.join(self.package_folder, "lib")) - - 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="*.h", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self.source_folder, "include")) def package_info(self): - self.cpp_info.filenames["cmake_find_package"] = "st_tree" - self.cpp_info.filenames["cmake_find_package_multi"] = "st_tree" + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/st_tree/all/test_package/CMakeLists.txt b/recipes/st_tree/all/test_package/CMakeLists.txt index bce4a94d44821..221a27bafd9ef 100644 --- a/recipes/st_tree/all/test_package/CMakeLists.txt +++ b/recipes/st_tree/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(st_tree CONFIG REQUIRED) +find_package(st_tree REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} st_tree::st_tree) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE st_tree::st_tree) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/st_tree/all/test_package/conanfile.py b/recipes/st_tree/all/test_package/conanfile.py index 5d1d0c318d32c..ef5d7042163ec 100644 --- a/recipes/st_tree/all/test_package/conanfile.py +++ b/recipes/st_tree/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 STTreeTestConan(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 +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/statistic/all/conandata.yml b/recipes/statistic/all/conandata.yml new file mode 100644 index 0000000000000..c9f570c26cbed --- /dev/null +++ b/recipes/statistic/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.0.8": + url: "https://github.com/RobTillaart/Statistic/archive/refs/tags/1.0.8.tar.gz" + sha256: "44ed39d05fb9280ad88e88d732805a228a69110fac6d1377bcf64cc84a363241" diff --git a/recipes/statistic/all/conanfile.py b/recipes/statistic/all/conanfile.py new file mode 100644 index 0000000000000..612fd3e02ff8c --- /dev/null +++ b/recipes/statistic/all/conanfile.py @@ -0,0 +1,52 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout +from conan.tools.build import check_min_cppstd +from conan.tools.microsoft import is_msvc +import os + +required_conan_version = ">=1.52.0" + +class StatisticConan(ConanFile): + name = "statistic" + description = "Statistic library for Arduino includes sum, average, variance and std deviation" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/RobTillaart/Statistic" + topics = ("arduino", "statistics", "header-only") + package_type = "header-library" + 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 is_msvc(self): + raise ConanInvalidConfiguration(f"{self.ref} does not support Visual Studio") + 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, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + copy( + self, + "Statistic.h", + self.source_folder, + os.path.join(self.package_folder, "include"), + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/statistic/all/test_package/CMakeLists.txt b/recipes/statistic/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..9b9900a401fc1 --- /dev/null +++ b/recipes/statistic/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(statistic REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE statistic::statistic) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/statistic/all/test_package/conanfile.py b/recipes/statistic/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/statistic/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/statistic/all/test_package/test_package.cpp b/recipes/statistic/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..185ea7dc94706 --- /dev/null +++ b/recipes/statistic/all/test_package/test_package.cpp @@ -0,0 +1,20 @@ +#include +#if defined __has_include && __has_include() +# define HAVE_STDCXX_LIMITS 1 +#endif +#include "Statistic.h" + +int main(void) { + statistic::Statistic myStats; + + for (int i = 0; i < 10; i++) { + myStats.add(i); + } + std::cout << myStats.count() << std::endl; + std::cout << myStats.average() << std::endl; + std::cout << myStats.variance() << std::endl; + std::cout << myStats.minimum() << std::endl; + std::cout << myStats.maximum() << std::endl; + + return 0; +} diff --git a/recipes/statistic/config.yml b/recipes/statistic/config.yml new file mode 100644 index 0000000000000..28e3ee22ca8ac --- /dev/null +++ b/recipes/statistic/config.yml @@ -0,0 +1,3 @@ +versions: + "1.0.8": + folder: all diff --git a/recipes/statslib/all/conandata.yml b/recipes/statslib/all/conandata.yml index eeb058ec28754..c09ac70fd003b 100644 --- a/recipes/statslib/all/conandata.yml +++ b/recipes/statslib/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.4.0": + url: "https://github.com/kthohr/stats/archive/v3.4.0.tar.gz" + sha256: "aee9cadf0ab8c6fc26963d502eb62cd551f0e0e83388b72d61819308cc8bb17f" "3.2.0": url: "https://github.com/kthohr/stats/archive/v3.2.0.tar.gz" sha256: "1360ba4fbeed96db04e28541b8044daffecdbabc5565944d5cb67136477003ed" diff --git a/recipes/statslib/all/conanfile.py b/recipes/statslib/all/conanfile.py index 24315800e6c0d..15f4da77d6f72 100644 --- a/recipes/statslib/all/conanfile.py +++ b/recipes/statslib/all/conanfile.py @@ -1,31 +1,51 @@ -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 StatsLibConan(ConanFile): name = "statslib" description = "A C++ header-only library of statistical distribution functions." - topics = ("statistics", "constexpr", "probability", "stats") + license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.kthohr.com/statslib.html" - license = "Apache-2.0" + topics = ("statistics", "constexpr", "probability", "stats", "header-only") + package_type = "header-library" + 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 requirements(self): - self.requires("gcem/1.14.1") + self.requires("gcem/1.16.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) 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", dst="licenses", src=self._source_subfolder) - self.copy(pattern="*", dst="include", src=os.path.join(self._source_subfolder, "include")) + copy(self, pattern="LICENSE", 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_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/statslib/all/test_package/CMakeLists.txt b/recipes/statslib/all/test_package/CMakeLists.txt index 754ae16121d12..94c3b5a1feecb 100644 --- a/recipes/statslib/all/test_package/CMakeLists.txt +++ b/recipes/statslib/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(statslib CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} statslib::statslib) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE statslib::statslib) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/statslib/all/test_package/conanfile.py b/recipes/statslib/all/test_package/conanfile.py index 49a3a66ea5bad..e730ad6dc0dfc 100644 --- a/recipes/statslib/all/test_package/conanfile.py +++ b/recipes/statslib/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/statslib/all/test_v1_package/CMakeLists.txt b/recipes/statslib/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..be00a8c7f57c7 --- /dev/null +++ b/recipes/statslib/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/statslib/all/test_v1_package/conanfile.py b/recipes/statslib/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/statslib/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/statslib/config.yml b/recipes/statslib/config.yml index 0b639b7fca8af..fc55f9dac4247 100644 --- a/recipes/statslib/config.yml +++ b/recipes/statslib/config.yml @@ -1,4 +1,6 @@ versions: + "3.4.0": + folder: "all" "3.2.0": folder: "all" "3.1.2": diff --git a/recipes/status-code/all/conandata.yml b/recipes/status-code/all/conandata.yml new file mode 100644 index 0000000000000..70939803c28aa --- /dev/null +++ b/recipes/status-code/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "cci.20220616": + url: "https://github.com/ned14/status-code/archive/38e1e862386cb38d577664fd681ef829b0e03fba.tar.gz" + sha256: "faf112df1633a1ee1f58c8b056130154b7c0dbf12e7f006a04dc376500d271c3" + "cci.20240614": + url: "https://github.com/ned14/status-code/archive/a6689afceb19ed127ec4a828dcf1597102e6c02d.tar.gz" + sha256: "f9725675f9d124d2223f9554f11a7f9dcb4893ea2b8a73bd3f7b182f23ba26ca" diff --git a/recipes/status-code/all/conanfile.py b/recipes/status-code/all/conanfile.py new file mode 100644 index 0000000000000..9e9d6e1e369a2 --- /dev/null +++ b/recipes/status-code/all/conanfile.py @@ -0,0 +1,59 @@ +import os +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.scm import Version + +required_conan_version = ">=1.45.0" + +class StatusCodeConan(ConanFile): + name = "status-code" + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/ned14/status-code" + description = "Proposed SG14 status_code for the C++ standard" + topics = ("header-only", "proposal", "status", "return code") + package_type = "header-library" + settings = "os", "arch", "build_type", "compiler" + + @property + def _compiler_required_version(self): + return { + # Their README says gcc 5, but in testing only >=7 worked + "gcc": "7", + "clang": "3.3", + "Visual Studio": "14", + "apple-clang": "5", + } + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, "11") + + min_version = self._compiler_required_version.get(str(self.settings.compiler)) + if min_version: + if Version(self.settings.compiler.version) < min_version: + raise ConanInvalidConfiguration("This package requires c++11 support. The current compiler does not support it.") + else: + self.output.warning("This recipe has no support for the current compiler. Please consider adding it.") + + def package_id(self): + self.info.clear() + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def package(self): + copy(self, "Licence.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")) + copy(self, "*.ipp", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) + + def package_info(self): + # See https://github.com/ned14/status-code/blob/38e1e862386cb38d577664fd681ef829b0e03fba/CMakeLists.txt#L126 + self.cpp_info.set_property("cmake_file_name", "status-code") + self.cpp_info.set_property("cmake_target_name", "status-code::hl") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.components["hl"].names["cmake_find_package"] = "hl" + self.cpp_info.components["hl"].names["cmake_find_package_multi"] = "hl" diff --git a/recipes/status-code/all/test_package/CMakeLists.txt b/recipes/status-code/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..cd415d6aae8d1 --- /dev/null +++ b/recipes/status-code/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package) + +find_package(status-code REQUIRED CONFIG) + +add_executable(test_package test_package.cpp) +target_link_libraries(test_package status-code::hl) +target_compile_features(test_package PRIVATE cxx_std_11) diff --git a/recipes/status-code/all/test_package/conanfile.py b/recipes/status-code/all/test_package/conanfile.py new file mode 100644 index 0000000000000..e845ae751a301 --- /dev/null +++ b/recipes/status-code/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/status-code/all/test_package/test_package.cpp b/recipes/status-code/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..ac3726f0591c8 --- /dev/null +++ b/recipes/status-code/all/test_package/test_package.cpp @@ -0,0 +1,10 @@ +#if __has_include() +# include +#else +# include +#endif + +int main() { + system_error2::system_code sc; + bool isFailure = sc.failure(); +} diff --git a/recipes/status-code/all/test_v1_package/CMakeLists.txt b/recipes/status-code/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..54d2c07bb9d41 --- /dev/null +++ b/recipes/status-code/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +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/status-code/all/test_v1_package/conanfile.py b/recipes/status-code/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/status-code/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/status-code/config.yml b/recipes/status-code/config.yml new file mode 100644 index 0000000000000..9cd6d00352fb6 --- /dev/null +++ b/recipes/status-code/config.yml @@ -0,0 +1,5 @@ +versions: + "cci.20220616": + folder: all + "cci.20240614": + folder: all diff --git a/recipes/stb/all/conandata.yml b/recipes/stb/all/conandata.yml index 661745efcb3f0..1fad76276ca33 100644 --- a/recipes/stb/all/conandata.yml +++ b/recipes/stb/all/conandata.yml @@ -1,13 +1,13 @@ sources: + "cci.20240531": + url: "https://github.com/nothings/stb/archive/013ac3beddff3dbffafd5177e7972067cd2b5083.zip" + sha256: "b7f476902bbef1b30f8ecc2d9d95c459c32302c8b559d09b589b5955463b7af8" + "cci.20240213": + url: "https://github.com/nothings/stb/archive/ae721c50eaf761660b4f90cc590453cdb0c2acd0.zip" + sha256: "5d075769721e676746d0c25b698a0f00741f68252f9ab4b7ee245c513aeec3de" + "cci.20230920": + url: "https://github.com/nothings/stb/archive/5736b15f7ea0ffb08dd38af21067c314d6a3aae9.zip" + sha256: "b6601f182fa4bc04dd0f135e38231e8a2c6c9e7901c66a942871f03285713b05" "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" - "cci.20210713": - url: "https://github.com/nothings/stb/archive/3a1174060a7dd4eb652d4e6854bc4cd98c159200.zip" - sha256: "9313f6871195b97771ce7da1feae0b3d92c7936456f13099edb54a78096ca93c" - "cci.20200203": - url: "https://github.com/nothings/stb/archive/0224a44a10564a214595797b4c88323f79a5f934.zip" - sha256: "5dd9cf8a9a8c0f253fad3e9904923b2dfc740eddbc86415c3f76152bd534f23a" diff --git a/recipes/stb/all/conanfile.py b/recipes/stb/all/conanfile.py index 540bdbac942b9..c1669e45a6c47 100644 --- a/recipes/stb/all/conanfile.py +++ b/recipes/stb/all/conanfile.py @@ -10,13 +10,13 @@ class StbConan(ConanFile): name = "stb" description = "single-file public domain libraries for C/C++" - topics = ("stb", "single-file") + license = ("Unlicense", "MIT") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/nothings/stb" - license = ("Unlicense", "MIT") + topics = ("stb", "single-file", "header-only") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True - options = { "with_deprecated": [True, False], } @@ -39,14 +39,17 @@ def layout(self): basic_layout(self, src_folder="src") def package_id(self): - self.info.clear() + # Can't call self.info.clear() because options contribute to package id + self.info.settings.clear() + self.info.requires.clear() + try: + # conan v2 specific + self.info.conf.clear() + except AttributeError: + pass def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) - - def build(self): - pass + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) diff --git a/recipes/stb/config.yml b/recipes/stb/config.yml index 8542dee027505..ea0f41f79734d 100644 --- a/recipes/stb/config.yml +++ b/recipes/stb/config.yml @@ -1,9 +1,9 @@ versions: - "cci.20220909": + "cci.20240531": folder: all - "cci.20210910": + "cci.20240213": folder: all - "cci.20210713": + "cci.20230920": folder: all - "cci.20200203": + "cci.20220909": folder: all diff --git a/recipes/stc/all/conandata.yml b/recipes/stc/all/conandata.yml index 730d48a11b46d..a7dd10bef0b55 100644 --- a/recipes/stc/all/conandata.yml +++ b/recipes/stc/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "4.2": + url: "https://github.com/tylov/STC/archive/v4.2.tar.gz" + sha256: "f16c3185ba5693f0257e5b521f0b6b3c11041433a4abbbbc531370364eb75d0c" + "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 77e55502b4e8e..7b5788fb609c1 100644 --- a/recipes/stc/all/conanfile.py +++ b/recipes/stc/all/conanfile.py @@ -27,8 +27,7 @@ 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 diff --git a/recipes/stc/all/test_v1_package/CMakeLists.txt b/recipes/stc/all/test_v1_package/CMakeLists.txt index ec16b767312b6..be00a8c7f57c7 100644 --- a/recipes/stc/all/test_v1_package/CMakeLists.txt +++ b/recipes/stc/all/test_v1_package/CMakeLists.txt @@ -1,16 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(stc REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -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() +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/stc/config.yml b/recipes/stc/config.yml index 027ba252f62a1..3db9bf640436f 100644 --- a/recipes/stc/config.yml +++ b/recipes/stc/config.yml @@ -1,4 +1,8 @@ versions: + "4.2": + folder: "all" + "4.1.1": + folder: "all" "3.9": folder: "all" "3.5.1": diff --git a/recipes/stdgpu/all/cmake/stdgpu-dependencies-cuda.cmake b/recipes/stdgpu/all/cmake/stdgpu-dependencies-cuda.cmake new file mode 100644 index 0000000000000..d3b13dcffb9ee --- /dev/null +++ b/recipes/stdgpu/all/cmake/stdgpu-dependencies-cuda.cmake @@ -0,0 +1,6 @@ +# Mimics the behavior of stdgpu-dependencies.cmake exported by stdgpu for the CUDA backend + +find_dependency(CUDAToolkit 11.0 REQUIRED) +# Using ${stdgpu_LIBRARIES} to allow the target to be renamed using the "cmake_target_name" CMakeDeps property +target_link_libraries(${stdgpu_LIBRARIES} INTERFACE CUDA::cudart) +set_property(TARGET ${stdgpu_LIBRARIES} PROPERTY INTERFACE_COMPILE_FEATURES cuda_std_17) diff --git a/recipes/stdgpu/all/cmake/stdgpu-dependencies-hip.cmake b/recipes/stdgpu/all/cmake/stdgpu-dependencies-hip.cmake new file mode 100644 index 0000000000000..3b575a7ddbf0b --- /dev/null +++ b/recipes/stdgpu/all/cmake/stdgpu-dependencies-hip.cmake @@ -0,0 +1,9 @@ +# Mimics the behavior of stdgpu-dependencies.cmake exported by stdgpu for the HIP backend + +find_dependency(thrust 1.9.9 REQUIRED) + +find_dependency(hip 5.1 REQUIRED) + +# Using ${stdgpu_LIBRARIES} to allow the target to be renamed using the "cmake_target_name" CMakeDeps property +target_link_libraries(${stdgpu_LIBRARIES} INTERFACE hip::host) +set_property(TARGET ${stdgpu_LIBRARIES} PROPERTY INTERFACE_COMPILE_FEATURES hip_std_17) diff --git a/recipes/stdgpu/all/conandata.yml b/recipes/stdgpu/all/conandata.yml new file mode 100644 index 0000000000000..34e0429d48408 --- /dev/null +++ b/recipes/stdgpu/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "cci.20230913": + url: "https://github.com/stotko/stdgpu/archive/b70405bc62958f1f1334a936a20cd025351816fb.zip" + sha256: "f94c0352fdf2d2bc5490791a56cf42b562a5222e58ce5676510a07bb72ce75b6" + "1.3.0": + url: "https://github.com/stotko/stdgpu/archive/refs/tags/1.3.0.tar.gz" + sha256: "c527dabc6735d8b320b316e9a5b120d258d49c2b7ff9689c8a9b5ad474532a05" diff --git a/recipes/stdgpu/all/conanfile.py b/recipes/stdgpu/all/conanfile.py new file mode 100644 index 0000000000000..7dfe706fa8ef8 --- /dev/null +++ b/recipes/stdgpu/all/conanfile.py @@ -0,0 +1,213 @@ +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, cmake_layout +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import copy, get, rm, rmdir, replace_in_file +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" + + +class StdgpuConan(ConanFile): + name = "stdgpu" + description = "Efficient STL-like Data Structures on the GPU" + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://stotko.github.io/stdgpu/" + topics = ("cuda", "data-structures", "gpgpu", "gpu", "hip", "openmp", "rocm", "stl", "thrust") + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "backend": ["cuda", "openmp", "hip"], + "setup_compiler_flags": [True, False], + "enable_contract_checks": [None, True, False], + "use_32_bit_index": [True, False], + "openmp": ["llvm", "system"], + } + default_options = { + "shared": False, + "fPIC": True, + "backend": "openmp", + "setup_compiler_flags": False, + "enable_contract_checks": None, + "use_32_bit_index": True, + "openmp": "llvm", + } + + @property + def _min_cppstd(self): + if self.version == "1.3.0": + return 14 + else: + return 17 + + @property + def _compilers_min_versions(self): + if self.version == "1.3.0": + # Based on https://github.com/stotko/stdgpu/tree/1.3.0#building + return { + "gcc": "7", + "clang": "6", + "apple-clang": "6", + "msvc": "192", + "Visual Studio": "16", + } + else: + # > 1.3.0 + # Based on https://github.com/stotko/stdgpu/tree/32e0517#building + return { + "gcc": "9", + "clang": "10", + "apple-clang": "12", + "msvc": "192", + "Visual Studio": "16", + } + + def export_sources(self): + copy(self, "cmake/*", dst=self.export_sources_folder, src=self.recipe_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") + if self.options.backend == "cuda": + self.options["thrust"].device_system = "cuda" + elif self.options.backend == "openmp": + self.options["thrust"].device_system = "omp" + + def package_id(self): + if self.info.options.backend != "openmp": + del self.info.options.openmp + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + if self.options.backend != "hip": + self.requires("thrust/1.17.2", transitive_headers=True) + else: + # The baseline Thrust version provided by Nvidia and Conan is not compatible with HIP. + self.output.warning("HIP support requires Thrust with ROCm. " + "Using Thrust from system instead of Conan.") + if self.options.backend == "openmp": + if self.options.openmp == "llvm": + self.requires("llvm-openmp/12.0.1", transitive_headers=True, transitive_libs=True) + else: + self.output.info("Using OpenMP backend with system OpenMP") + + def build_requirements(self): + if Version(self.version) > "1.3.0": + self.tool_requires("cmake/[>=3.18 <4]") + + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + minimum_version = self._compilers_min_versions.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.backend == "cuda" and self.dependencies["thrust"].options.device_system != "cuda": + raise ConanInvalidConfiguration(f"{self.ref} option backend=cuda should use '-o thrust/*:device_system=cuda' as well.") + if self.options.backend == "openmp" and self.dependencies["thrust"].options.device_system != "omp": + raise ConanInvalidConfiguration(f"{self.ref} option backend=openmp should use '-o thrust/*:device_system=omp' as well.") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + # All the main params from https://github.com/stotko/#integration + backend = str(self.options.backend).upper() + tc.variables["STDGPU_BACKEND"] = f"STDGPU_BACKEND_{backend}" + tc.variables["STDGPU_BUILD_SHARED_LIBS"] = self.options.shared + tc.variables["STDGPU_SETUP_COMPILER_FLAGS"] = self.options.setup_compiler_flags + tc.variables["STDGPU_TREAT_WARNINGS_AS_ERRORS"] = False + tc.variables["STDGPU_BUILD_EXAMPLES"] = False + tc.variables["STDGPU_BUILD_BENCHMARKS"] = False + tc.variables["STDGPU_BUILD_TESTS"] = False + tc.variables["STDGPU_BUILD_TEST_COVERAGE"] = False + tc.variables["STDGPU_ANALYZE_WITH_CLANG_TIDY"] = False + tc.variables["STDGPU_ANALYZE_WITH_CPPCHECK"] = False + if self.options.enable_contract_checks is not None: + tc.variables["STDGPU_ENABLE_CONTRACT_CHECKS"] = self.options.enable_contract_checks + tc.variables["STDGPU_USE_32_BIT_INDEX"] = self.options.use_32_bit_index + tc.preprocessor_definitions["THRUST_IGNORE_CUB_VERSION_CHECK"] = "1" + tc.generate() + deps = CMakeDeps(self) + # FIXME: should be set by the thrust recipe instead + deps.set_property("thrust", "cmake_find_mode", "both") + deps.set_property("openmp", "cmake_find_mode", "both") + deps.generate() + env = VirtualBuildEnv(self) + env.generate() + + def _patch_sources(self): + # Fix repeated application of the THRUST_DEVICE_SYSTEM define + for backend in ["cuda", "openmp"]: + replace_in_file(self, os.path.join(self.source_folder, "src", "stdgpu", backend, "CMakeLists.txt"), + "THRUST_DEVICE_SYSTEM=", + ") # THRUST_DEVICE_SYSTEM=") + replace_in_file(self, os.path.join(self.source_folder, "src", "stdgpu", "openmp", "CMakeLists.txt"), + "find_package(OpenMP 2.0 REQUIRED)", + "find_package(OpenMP REQUIRED)") + + def build(self): + self._patch_sources() + 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() + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rm(self, "*.pdb", self.package_folder, recursive=True) + copy(self, "*.cmake", + dst=os.path.join(self.package_folder, "lib", "cmake"), + src=os.path.join(self.export_sources_folder, "cmake")) + + def _configure_system_openmp(self): + openmp_flags = [] + if is_msvc(self): + openmp_flags = ["-openmp"] + elif self.settings.compiler in ["clang", "apple-clang"]: + openmp_flags = ["-Xpreprocessor", "-fopenmp"] + elif self.settings.compiler == "gcc": + openmp_flags = ["-fopenmp"] + elif self.settings.compiler == "intel": + openmp_flags = ["/Qopenmp"] if self.settings.os == "Windows" else ["-Qopenmp"] + self.cpp_info.cflags += openmp_flags + self.cpp_info.cxxflags += openmp_flags + self.cpp_info.sharedlinkflags += openmp_flags + self.cpp_info.exelinkflags += openmp_flags + if self.settings.os == "Windows": + if is_msvc(self): + self.cpp_info.system_libs.append("delayimp") + elif self.settings.compiler == "gcc": + self.cpp_info.system_libs.append("gomp") + + def package_info(self): + self.cpp_info.libs = ["stdgpu"] + + if self.options.backend == "openmp": + if self.options.openmp == "system": + self._configure_system_openmp() + elif self.options.backend == "cuda": + module_path = os.path.join("lib", "cmake", "stdgpu-dependencies-cuda.cmake") + self.cpp_info.set_property("cmake_build_modules", [module_path]) + elif self.options.backend == "hip": + module_path = os.path.join("lib", "cmake", "stdgpu-dependencies-hip.cmake") + self.cpp_info.set_property("cmake_build_modules", [module_path]) + self.cpp_info.builddirs.append(os.path.join("lib", "cmake")) diff --git a/recipes/stdgpu/all/test_package/CMakeLists.txt b/recipes/stdgpu/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..a42458e26851c --- /dev/null +++ b/recipes/stdgpu/all/test_package/CMakeLists.txt @@ -0,0 +1,35 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package CXX) + +find_package(stdgpu CONFIG REQUIRED) + +if (stdgpu_VERSION_STRING EQUAL "1.3.0") + set(CMAKE_CXX_STANDARD 14) +else() + set(CMAKE_CXX_STANDARD 17) +endif() + +if (STDGPU_BACKEND STREQUAL "cuda") + cmake_minimum_required(VERSION 3.17 FATAL_ERROR) + enable_language(CUDA) + add_executable(${PROJECT_NAME}_cuda test_package_cuda.cu) + target_link_libraries(${PROJECT_NAME}_cuda stdgpu::stdgpu) + set_target_properties(${PROJECT_NAME}_cuda PROPERTIES CUDA_ARCHITECTURES OFF) +endif() +if (STDGPU_BACKEND STREQUAL "hip") + cmake_minimum_required(VERSION 3.21 FATAL_ERROR) + enable_language(HIP) + add_executable(${PROJECT_NAME}_hip test_package_hip.hip) + target_link_libraries(${PROJECT_NAME}_hip stdgpu::stdgpu) + set_target_properties(${PROJECT_NAME}_hip PROPERTIES HIP_ARCHITECTURES OFF) +endif() +if (STDGPU_BACKEND STREQUAL "openmp") + add_executable(${PROJECT_NAME}_openmp test_package_openmp.cpp) + target_link_libraries(${PROJECT_NAME}_openmp stdgpu::stdgpu) +endif() + +if (NOT stdgpu_VERSION_STRING STREQUAL "1.3.0") + # v1.3.0 does not have stdgpu/device.h + add_executable(${PROJECT_NAME}_basic test_package_basic.cpp) + target_link_libraries(${PROJECT_NAME}_basic stdgpu::stdgpu) +endif() diff --git a/recipes/stdgpu/all/test_package/conanfile.py b/recipes/stdgpu/all/test_package/conanfile.py new file mode 100644 index 0000000000000..179d561335ad3 --- /dev/null +++ b/recipes/stdgpu/all/test_package/conanfile.py @@ -0,0 +1,39 @@ +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 = "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) + backend = str(self.dependencies["stdgpu"].options.backend) + tc.variables["STDGPU_BACKEND"] = backend + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + for variant in ["basic", "openmp", "cuda", "hip"]: + if variant == "openmp" and self.settings.compiler == "apple-clang" and self.settings.build_type == "Debug": + # Skip OpenMP test for apple-clang in debug mode, which segfaults for some reason + # https://c3i.jfrog.io/c3i/misc/summary.html?json=https://c3i.jfrog.io/c3i/misc/logs/pr/17542/12-macos-clang/stdgpu/cci.20230903/summary.json + continue + bin_path = os.path.join(self.cpp.build.bindir, f"test_package_{variant}") + if os.path.exists(bin_path): + self.run(bin_path, env="conanrun") diff --git a/recipes/stdgpu/all/test_package/test_package_basic.cpp b/recipes/stdgpu/all/test_package/test_package_basic.cpp new file mode 100644 index 0000000000000..754072b6056b3 --- /dev/null +++ b/recipes/stdgpu/all/test_package/test_package_basic.cpp @@ -0,0 +1,10 @@ +#include +#include + +#include + +int main() { + // Minimal test to confirm that the non-platform-specific portion of the library links correctly + std::cout << "stdgpu version: " << STDGPU_VERSION_STRING << std::endl; + stdgpu::print_device_information(); +} diff --git a/recipes/stdgpu/all/test_package/test_package_cuda.cu b/recipes/stdgpu/all/test_package/test_package_cuda.cu new file mode 100644 index 0000000000000..bdcd95e9feb1e --- /dev/null +++ b/recipes/stdgpu/all/test_package/test_package_cuda.cu @@ -0,0 +1,55 @@ +// Based on https://github.com/stotko/stdgpu/blob/32e0517/examples/cuda/vector.cu +#include +#include +#include + +#include // device_begin, device_end +#include // createDeviceArray, destroyDeviceArray +#include // STDGPU_HOST_DEVICE +#include // stdgpu::vector + +#include +#include + +__global__ void insert_neighbors_with_duplicates(const int *d_input, const stdgpu::index_t n, + stdgpu::vector vec) { + stdgpu::index_t i = static_cast(blockIdx.x * blockDim.x + threadIdx.x); + + if (i >= n) + return; + + int num = d_input[i]; + int num_neighborhood[3] = {num - 1, num, num + 1}; + + for (int num_neighbor : num_neighborhood) { + vec.push_back(num_neighbor); + } +} + +int sum_stdgpu(stdgpu::index_t n) { + int *d_input = createDeviceArray(n); + auto vec = stdgpu::vector::createDeviceObject(3 * n); + + thrust::sequence(stdgpu::device_begin(d_input), stdgpu::device_end(d_input), 1); + + stdgpu::index_t threads = 32; + stdgpu::index_t blocks = (n + threads - 1) / threads; + insert_neighbors_with_duplicates<<(blocks), + static_cast(threads)>>>(d_input, n, vec); + cudaDeviceSynchronize(); + + auto range_vec = vec.device_range(); + int sum = thrust::reduce(range_vec.begin(), range_vec.end(), 0, thrust::plus()); + + destroyDeviceArray(d_input); + stdgpu::vector::destroyDeviceObject(vec); + + return sum; +} + +int main() { + const int n = 20; + const int sum_closed_form = 3 * (n * (n + 1) / 2); + std::cout << "Sum: " << sum_stdgpu(n) << ", expected: " << sum_closed_form << std::endl; + return EXIT_SUCCESS; +} diff --git a/recipes/stdgpu/all/test_package/test_package_hip.hip b/recipes/stdgpu/all/test_package/test_package_hip.hip new file mode 100644 index 0000000000000..dc4730565ae0e --- /dev/null +++ b/recipes/stdgpu/all/test_package/test_package_hip.hip @@ -0,0 +1,64 @@ +// https://github.com/stotko/stdgpu/blob/50530de/examples/hip/ranges.hip +/* + * Copyright 2020 Patrick Stotko + * Licensed 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 +#include +#include +#include + +#include // device_begin, device_end +#include // createDeviceArray, destroyDeviceArray +#include // STDGPU_HOST_DEVICE +#include // device_range +#include // stdgpu::unordered_set + +struct square_int +{ + STDGPU_HOST_DEVICE int + operator()(const int x) const + { + return x * x; + } +}; + +int +main() +{ + const stdgpu::index_t n = 100; + + int* d_input = createDeviceArray(n); + int* d_result = createDeviceArray(n); + stdgpu::unordered_set set = stdgpu::unordered_set::createDeviceObject(n); + + thrust::sequence(stdgpu::device_begin(d_input), stdgpu::device_end(d_input), 1); + + auto range_int = stdgpu::device_range(d_input); + thrust::transform(range_int.begin(), range_int.end(), stdgpu::device_begin(d_result), square_int()); + + set.insert(stdgpu::device_cbegin(d_result), stdgpu::device_cend(d_result)); + + auto range_set = set.device_range(); + int sum = thrust::reduce(range_set.begin(), range_set.end(), 0, thrust::plus()); + + const int sum_closed_form = n * (n + 1) * (2 * n + 1) / 6; + + std::cout << "The computed sum from i = 1 to " << n << " of i^2 is " << sum << " (" << sum_closed_form + << " expected)" << std::endl; + + destroyDeviceArray(d_input); + destroyDeviceArray(d_result); + stdgpu::unordered_set::destroyDeviceObject(set); +} diff --git a/recipes/stdgpu/all/test_package/test_package_openmp.cpp b/recipes/stdgpu/all/test_package/test_package_openmp.cpp new file mode 100644 index 0000000000000..87d3c025b094b --- /dev/null +++ b/recipes/stdgpu/all/test_package/test_package_openmp.cpp @@ -0,0 +1,47 @@ +// Based on https://github.com/stotko/stdgpu/blob/32e0517/examples/openmp/vector.cpp +#include +#include +#include + +#include // device_begin, device_end +#include // createDeviceArray, destroyDeviceArray +#include // STDGPU_HOST_DEVICE +#include // stdgpu::vector + +#include +#include + +void insert_neighbors_with_duplicates(const int *d_input, const stdgpu::index_t n, + stdgpu::vector &vec) { +#pragma omp parallel for + for (stdgpu::index_t i = 0; i < n; ++i) { + int num = d_input[i]; + int num_neighborhood[3] = {num - 1, num, num + 1}; + for (int num_neighbor : num_neighborhood) + vec.push_back(num_neighbor); + } +} + +int sum_stdgpu(stdgpu::index_t n) { + int *d_input = createDeviceArray(n); + auto vec = stdgpu::vector::createDeviceObject(3 * n); + + thrust::sequence(stdgpu::device_begin(d_input), stdgpu::device_end(d_input), 1); + + insert_neighbors_with_duplicates(d_input, n, vec); + + auto range_vec = vec.device_range(); + int sum = thrust::reduce(range_vec.begin(), range_vec.end(), 0, thrust::plus()); + + destroyDeviceArray(d_input); + stdgpu::vector::destroyDeviceObject(vec); + + return sum; +} + +int main() { + const int n = 20; + const int sum_closed_form = 3 * (n * (n + 1) / 2); + std::cout << "Sum: " << sum_stdgpu(n) << ", expected: " << sum_closed_form << std::endl; + return EXIT_SUCCESS; +} diff --git a/recipes/stdgpu/config.yml b/recipes/stdgpu/config.yml new file mode 100644 index 0000000000000..73334d8cce8e6 --- /dev/null +++ b/recipes/stdgpu/config.yml @@ -0,0 +1,5 @@ +versions: + "cci.20230913": + folder: all + "1.3.0": + folder: all diff --git a/recipes/stduuid/all/conandata.yml b/recipes/stduuid/all/conandata.yml index 0bc44aa93786c..106008491388a 100644 --- a/recipes/stduuid/all/conandata.yml +++ b/recipes/stduuid/all/conandata.yml @@ -1,7 +1,19 @@ 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" sha256: "e96f2ac7c950c3c24d7e2e44a84236277b7774ee346dcc620edf400d9eda0a3c" +patches: + "1.2.2": + - patch_file: "patches/1.2.2-handle-span-header.patch" + patch_description: "Conditionally include span header based on compiler definition" + patch_type: "conan" + "1.2.3": + - patch_file: "patches/1.2.3-handle-span-header.patch" + patch_description: "Conditionally include span header based on compiler definition" + patch_type: "conan" diff --git a/recipes/stduuid/all/conanfile.py b/recipes/stduuid/all/conanfile.py index 395e1f628efd7..740dfa380f1ad 100644 --- a/recipes/stduuid/all/conanfile.py +++ b/recipes/stduuid/all/conanfile.py @@ -1,7 +1,7 @@ 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.build import check_min_cppstd, valid_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.scm import Version import os @@ -12,22 +12,20 @@ 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", "arch", "compiler", "build_type" options = { + # True: Use std::span + # False: Use gsl::span "with_cxx20_span": [True, False], } - default_options = { - "with_cxx20_span": False, - } - no_copy_source = True @property def _min_cppstd(self): - return "20" if self.options.with_cxx20_span else "17" + return "20" if self.options.get_safe("with_cxx20_span") else "17" @property def _compilers_minimum_version(self): @@ -38,21 +36,34 @@ def _compilers_minimum_version(self): "msvc": "191", "Visual Studio": "15", } + + def export_sources(self): + export_conandata_patches(self) def layout(self): basic_layout(self, src_folder="src") + def config_options(self): + if Version(self.version) == "1.0": + # Version 1.0 unconditionally depends on gsl span + del self.options.with_cxx20_span + else: + # Conditionally set the default value of with_cxx20_span + # if cppstd is set and is 20 or greater + self.options.with_cxx20_span = (self.settings.compiler.get_safe("cppstd", False) + and valid_min_cppstd(self, 20)) + def requirements(self): - if not self.options.with_cxx20_span: - self.requires("ms-gsl/3.1.0", transitive_headers=True) + if not self.options.get_safe("with_cxx20_span") or Version(self.version) == "1.0": + self.requires("ms-gsl/4.0.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) + self.requires("util-linux-libuuid/2.39", transitive_headers=True, transitive_libs=True) def package_id(self): self.info.clear() def validate(self): - if self.settings.compiler.get_safe("cppsd"): + 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) @@ -62,8 +73,8 @@ def validate(self): ) 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) + apply_conandata_patches(self) def build(self): pass @@ -75,5 +86,5 @@ def package(self): 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.dependencies["ms-gsl"].cpp_info.includedirs[0], "gsl")) + if self.options.get_safe("with_cxx20_span"): + self.cpp_info.defines = ["LIBUUID_CPP20_OR_GREATER"] diff --git a/recipes/stduuid/all/patches/1.2.2-handle-span-header.patch b/recipes/stduuid/all/patches/1.2.2-handle-span-header.patch new file mode 100644 index 0000000000000..840c78174c772 --- /dev/null +++ b/recipes/stduuid/all/patches/1.2.2-handle-span-header.patch @@ -0,0 +1,26 @@ +diff --git a/include/uuid.h b/include/uuid.h +index 600846f..5f00a49 100644 +--- a/include/uuid.h ++++ b/include/uuid.h +@@ -15,7 +15,11 @@ + #include + #include + #include +-#include ++#if defined(LIBUUID_CPP20_OR_GREATER) ++# include ++#else ++# include ++#endif + + #ifdef _WIN32 + +@@ -51,7 +55,7 @@ + + namespace uuids + { +-#ifdef __cpp_lib_span ++#if defined(LIBUUID_CPP20_OR_GREATER) + template + using span = std::span; + #else diff --git a/recipes/stduuid/all/patches/1.2.3-handle-span-header.patch b/recipes/stduuid/all/patches/1.2.3-handle-span-header.patch new file mode 100644 index 0000000000000..fae5f65b66c25 --- /dev/null +++ b/recipes/stduuid/all/patches/1.2.3-handle-span-header.patch @@ -0,0 +1,29 @@ +diff --git a/include/uuid.h b/include/uuid.h +index d48059d..4d14e4d 100644 +--- a/include/uuid.h ++++ b/include/uuid.h +@@ -17,15 +17,6 @@ + #include + #include + +-#ifdef __cplusplus +- +-# if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) +-# define LIBUUID_CPP20_OR_GREATER +-# endif +- +-#endif +- +- + #ifdef LIBUUID_CPP20_OR_GREATER + #include + #else +@@ -66,7 +57,7 @@ + + namespace uuids + { +-#ifdef __cpp_lib_span ++#if defined(LIBUUID_CPP20_OR_GREATER) + template + using span = std::span; + #else 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/stella-cv-fbow/all/conandata.yml b/recipes/stella-cv-fbow/all/conandata.yml new file mode 100644 index 0000000000000..54c56ba718ab0 --- /dev/null +++ b/recipes/stella-cv-fbow/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "cci.20240508": + url: "https://github.com/stella-cv/FBoW/archive/c6e3c29e3332a0b0834021797e2aa4e8eb66a3c1.zip" + sha256: "23d866d86eaca6a85da8fe3e542b94324d5f6be4b37691cf82cd74a6cfd838bd" diff --git a/recipes/stella-cv-fbow/all/conanfile.py b/recipes/stella-cv-fbow/all/conanfile.py new file mode 100644 index 0000000000000..14eb8529d8c92 --- /dev/null +++ b/recipes/stella-cv-fbow/all/conanfile.py @@ -0,0 +1,127 @@ +import os + +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, rmdir, replace_in_file + +required_conan_version = ">=1.53.0" + + +class StellaCvFbowConan(ConanFile): + name = "stella-cv-fbow" + description = "FBoW (Fast Bag of Words) is an extremely optimized version of the DBoW2/DBoW3 libraries." + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/stella-cv/FBoW" + topics = ("bag-of-words", "computer-vision", "visual-slam", "dbow") + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "fast_math": [True, False], + "avx": [True, False], + "mmx": [True, False], + "sse": [True, False], + "sse2": [True, False], + "sse3": [True, False], + "sse4": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "fast_math": True, + "avx": True, + "mmx": True, + "sse": True, + "sse2": True, + "sse3": True, + "sse4": True, + } + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + if self.settings.arch not in ["x86", "x86_64"] or self.settings.compiler not in ["gcc", "clang", "apple-clang"]: + del self.options.avx + del self.options.mmx + del self.options.sse + del self.options.sse2 + del self.options.sse3 + del self.options.sse4 + + 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://github.com/stella-cv/FBoW/blob/master/include/fbow/vocabulary.h#L35 + self.requires("opencv/4.9.0", transitive_headers=True, transitive_libs=True) + self.requires("llvm-openmp/17.0.6") + + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, 11) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["USE_FAST_MATH"] = self.options.fast_math + tc.variables["USE_AVX"] = self.options.get_safe("avx", False) + tc.variables["USE_MMX"] = self.options.get_safe("mmx", False) + tc.variables["USE_SSE"] = self.options.get_safe("sse", False) + tc.variables["USE_SSE2"] = self.options.get_safe("sse2", False) + tc.variables["USE_SSE3"] = self.options.get_safe("sse3", False) + tc.variables["USE_SSE4"] = self.options.get_safe("sse4", False) + tc.variables["BUILD_UTILS"] = False + tc.variables["BUILD_TESTS"] = False + tc.variables["USE_CONTRIB"] = self.dependencies["opencv"].options.xfeatures2d + tc.generate() + + tc = CMakeDeps(self) + tc.generate() + + def _patch_sources(self): + # Let Conan set the C++ standard + if self.settings.compiler.cppstd: + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "set(CMAKE_CXX_STANDARD 11)", "") + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + 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("cmake_file_name", "fbow") + self.cpp_info.set_property("cmake_target_name", "fbow::fbow") + # unofficial + self.cpp_info.set_property("pkg_config_name", "fbow") + + self.cpp_info.libs = ["fbow"] + self.cpp_info.requires = [ + "opencv::opencv_core", + "opencv::opencv_features2d", + "opencv::opencv_highgui", + "llvm-openmp::llvm-openmp", + ] + if self.dependencies["opencv"].options.xfeatures2d: + self.cpp_info.requires.append("opencv::opencv_xfeatures2d") + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["m", "pthread"]) diff --git a/recipes/stella-cv-fbow/all/test_package/CMakeLists.txt b/recipes/stella-cv-fbow/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..825104df78ead --- /dev/null +++ b/recipes/stella-cv-fbow/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(fbow REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE fbow::fbow) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/stella-cv-fbow/all/test_package/conanfile.py b/recipes/stella-cv-fbow/all/test_package/conanfile.py new file mode 100644 index 0000000000000..ef5d7042163ec --- /dev/null +++ b/recipes/stella-cv-fbow/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/stella-cv-fbow/all/test_package/test_package.cpp b/recipes/stella-cv-fbow/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..f51d557796902 --- /dev/null +++ b/recipes/stella-cv-fbow/all/test_package/test_package.cpp @@ -0,0 +1,10 @@ +#include +#include +#include + +int main() { + auto features = fbow::cpu(); + features.detect_host(); + std::cout << "CPU Vendor String: " << fbow::cpu::get_vendor_string() << '\n'; + std::cout << "64-bit = " << features.OS_x64 << '\n'; +} diff --git a/recipes/stella-cv-fbow/config.yml b/recipes/stella-cv-fbow/config.yml new file mode 100644 index 0000000000000..ea26172cf981e --- /dev/null +++ b/recipes/stella-cv-fbow/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20240508": + folder: all diff --git a/recipes/stlab/all/conandata.yml b/recipes/stlab/all/conandata.yml index cde4739b5d32c..5b3683503f4d0 100644 --- a/recipes/stlab/all/conandata.yml +++ b/recipes/stlab/all/conandata.yml @@ -1,16 +1,4 @@ sources: - "1.6.2": - url: "https://github.com/stlab/libraries/archive/v1.6.2.tar.gz" - sha256: "d0369d889c7bf78068d0c4f4b5125d7e9fe9abb0ad7a3be35bf13b6e2c271676" - "1.5.6": - url: "https://github.com/stlab/libraries/archive/refs/tags/v1.5.6.tar.gz" - sha256: "a6b788848be637b6d6c471de76c38486789e708997648e9b9731fdb5a631030c" - "1.5.5": - url: "https://github.com/stlab/libraries/archive/v1.5.5.tar.gz" - sha256: "30ec5a36b4c074feac72a1b9a744f0b279010e18c7bb04bbdc5d44fe9eaf5ad8" - "1.5.4": - url: "https://github.com/stlab/libraries/archive/v1.5.4.tar.gz" - sha256: "87306f58f6614f4a1ca54dda52fedff7e610d3b3dae035829657bac77bc33640" - "1.5.2": - url: https://github.com/stlab/libraries/archive/v1.5.2.tar.gz - sha256: a82eb013e51d0bb3ee2050f0eda31e11997cb4ca74d2abfdc2c8249c5c67c9fb + "1.7.1": + url: "https://github.com/stlab/libraries/archive/refs/tags/v1.7.1.tar.gz" + sha256: "0160b5f7be7d423100a9a8b205a99285b106dd438f806978028a82b9f01c6b64" diff --git a/recipes/stlab/all/conanfile.py b/recipes/stlab/all/conanfile.py index b315741f04d56..b78d535f7ef8e 100644 --- a/recipes/stlab/all/conanfile.py +++ b/recipes/stlab/all/conanfile.py @@ -1,180 +1,179 @@ -from conans import ConanFile, tools -from conans.tools import Version -from conans.errors import ConanInvalidConfiguration import os +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd, cross_building +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, rm, rmdir +from conan.tools.microsoft import check_min_vs, is_msvc +from conan.tools.scm import Version + +required_conan_version = ">=1.52.0" + + class Stlab(ConanFile): name = 'stlab' description = 'The Software Technology Lab libraries.' url = 'https://github.com/conan-io/conan-center-index' homepage = 'https://github.com/stlab/libraries' license = 'BSL-1.0' - topics = 'conan', 'c++', 'concurrency', 'futures', 'channels' - - settings = "arch", "os", "compiler", "build_type", - + topics = 'concurrency', 'futures', 'channels' + settings = "arch", "os", "compiler", "build_type", options = { - "boost_optional": [True, False], - "boost_variant": [True, False], - "coroutines": [True, False], - "task_system": ["portable", "libdispatch", "emscripten", "pnacl", "windows", "auto"], + "with_boost": [True, False], + "no_std_coroutines": [True, False], + "future_coroutines": [True, False], + "task_system": ["portable", "libdispatch", "emscripten", "pnacl", "windows"], + "thread_system": ["win32", "pthread", "pthread-emscripten", "pthread-apple", "none"], } - default_options = { - "boost_optional": False, - "boost_variant": False, - "coroutines": False, - "task_system": "auto", + "with_boost": False, + "no_std_coroutines": True, + "future_coroutines": False + # Handle default value for `thread_system` in `config_options` method + # Handle default value for `task_system` in `config_options` method } + package_type = "header-library" + short_paths = True - no_copy_source = True - _source_subfolder = 'source_subfolder' + def config_options(self): + self.options.thread_system = {"Macos": "pthread-apple", + "Linux": "pthread", + "Windows": "win32", + "Emscripten": "pthread-emscripten"}.get(str(self.settings.os), "none") + self.options.task_system = {"Macos": "libdispatch", + "Windows": "windows"}.get(str(self.settings.os), "portable") - def _use_boost(self): - return self.options.boost_optional or self.options.boost_variant + @property + def _minimum_cpp_standard(self): + return 17 - def _requires_libdispatch(self): - # On macOS it is not necessary to use the libdispatch conan package, because the library is - # included in the OS. - return self.options.task_system == "libdispatch" and self.settings.os != "Macos" + @property + def _compilers_minimum_version(self): + return {"gcc": "9", + "clang": "8", + "apple-clang": "13"} + + def layout(self): + cmake_layout(self, src_folder="src") + + def build_requirements(self): + self.tool_requires("cmake/[>=3.23.3]") def requirements(self): - if self._use_boost(): - self.requires("boost/1.75.0") + if self.options.with_boost: + self.requires("boost/1.82.0") - if self._requires_libdispatch(): + # On macOS, it is not necessary to use the libdispatch conan package, because the library is + # included in the OS. + if self.options.task_system == "libdispatch" and self.settings.os != "Macos": self.requires("libdispatch/5.3.2") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = "libraries-" + self.version - os.rename(extracted_dir, self._source_subfolder) - - def _fix_boost_components(self): - if self.settings.os != "Macos": return - if self.settings.compiler != "apple-clang": return - if Version(self.settings.compiler.version) >= "12": return - - # - # On Apple we have to force the usage of boost.variant, because Apple's implementation of C++17 is not complete. - # - self.output.info("Apple-Clang versions less than 12 do not correctly support std::optional or std::variant, so we will use boost::optional and boost::variant instead.") - self.options.boost_optional = True - self.options.boost_variant = True - - def _default_task_system(self): - if self.settings.os == "Macos": - return "libdispatch" - - if self.settings.os == "Windows": - return "windows" - - if self.settings.os == "Emscripten": - return "emscripten" - - return "portable" - - def _validate_task_system_libdispatch(self): - if self.settings.os == "Linux": - if self.settings.compiler != "clang": - raise ConanInvalidConfiguration("{}/{} task_system=libdispatch needs Clang compiler when using OS: {}. Use Clang compiler or switch to task_system=portable or task_system=auto".format(self.name, self.version, self.settings.os)) - elif self.settings.os != "Macos": - raise ConanInvalidConfiguration("{}/{} task_system=libdispatch is not supported on {}. Try using task_system=auto".format(self.name, self.version, self.settings.os)) - - def _validate_task_system_windows(self): - if self.settings.os != "Windows": - self.output.info("Libdispatch is not supported on {}. The task system is changed to {}.".format(self.settings.os, self.options.task_system)) - raise ConanInvalidConfiguration("{}/{} task_system=windows is not supported on {}. Try using task_system=auto".format(self.name, self.version, self.settings.os)) - - def _validate_task_system_emscripten(self): - if self.settings.os != "Emscripten": - raise ConanInvalidConfiguration("{}/{} task_system=emscripten is not supported on {}. Try using task_system=auto".format(self.name, self.version, self.settings.os)) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) def _validate_task_system(self): if self.options.task_system == "libdispatch": - self._validate_task_system_libdispatch() - elif self.options.task_system == "windows": - self._validate_task_system_windows() - elif self.options.task_system == "emscripten": - self._validate_task_system_emscripten() + if self.settings.os == "Linux" and self.settings.compiler != "clang": + raise ConanInvalidConfiguration(f"{self.ref} task_system=libdispatch needs Clang compiler when using OS: {self.settings.os}." + f" Use Clang compiler or switch to task_system=portable") + elif self.settings.os != "Macos": + raise ConanInvalidConfiguration(f"{self.ref} task_system=libdispatch is not supported on {self.settings.os}") + elif self.options.task_system == "windows" and self.settings.os != "Windows": + raise ConanInvalidConfiguration(f"{self.ref} task_system=windows is not supported on {self.settings.os}") + + def _validate_thread_system(self): + if any([self.options.thread_system == "pthread-apple" and self.settings.os != "Macos", + self.options.thread_system == "pthread" and self.settings.os != "Linux", + self.options.thread_system == "win32" and self.settings.os != "Windows", + self.options.thread_system == "pthread-emscripten" and self.settings.os != "Emscripten"]): + raise ConanInvalidConfiguration(f"{self.ref} thread_system={self.options.thread_system} is not supported on {self.settings.os}") def _validate_boost_components(self): - if self.settings.os != "Macos": return - if self.settings.compiler != "apple-clang": return - if Version(self.settings.compiler.version) >= "12": return - if self.options.boost_optional and self.options.boost_variant: return - # - # On Apple we have to force the usage of boost.variant, because Apple's implementation of C++17 - # is not complete. - # - msg = "Apple-Clang versions less than 12 do not correctly support std::optional or std::variant, so we will use boost::optional and boost::variant instead. " - if not self.options.boost_optional and not self.options.boost_variant: - msg += "Try -o boost_optional=True -o boost_variant=True" - elif not self.options.boost_optional: - msg += "Try -o boost_optional=True." + if not any([self.settings.os != "Macos", self.settings.compiler != "apple-clang", + Version(str(self.settings.compiler.version)) >= "12", self.options.with_boost]): + # On Apple we have to force the usage of boost.variant and boost.optional, because Apple's implementation of C++17 + # is not complete. + raise ConanInvalidConfiguration( + f"Compiler Apple-Clang < 12 versions do not correctly support std::optional or std::variant, " + f"so we will use boost::optional and boost::variant instead. Try -o {self.ref}:with_boost=True.") + + def _validate_min_compiler_version(self): + if is_msvc(self): + check_min_vs(self, "192") else: - msg += "Try -o boost_variant=True." - - raise ConanInvalidConfiguration(msg) + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if not minimum_version: + self.output.warn(f"{self.ref} requires C++{self._minimum_cpp_standard}. " + f"Your compiler is unknown. Assuming it supports C++{self._minimum_cpp_standard}.") + elif Version(str(self.settings.compiler.version)) < minimum_version: + raise ConanInvalidConfiguration(f"{self.ref} requires C++{self._minimum_cpp_standard}, " + f"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 " + f"in an infinite build loop (smells like a compiler bug). Contributions are welcomed!") def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, '17') - - if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "9": - raise ConanInvalidConfiguration("Need GCC >= 9") - - if self.settings.compiler == "clang" and Version(self.settings.compiler.version) < "8": - raise ConanInvalidConfiguration("Need Clang >= 8") - - if self.settings.compiler == "Visual Studio" and Version(self.settings.compiler.version) < "15.8": - raise ConanInvalidConfiguration("Need Visual Studio >= 2017 15.8 (MSVC 19.15)") - - # Actually, we want *at least* 15.8 (MSVC 19.15), but we cannot check this for now with Conan. - if self.settings.compiler == "msvc" and Version(self.settings.compiler.version) < "19.15": - raise ConanInvalidConfiguration("Need msvc >= 19.15") + check_min_cppstd(self, self._minimum_cpp_standard) + self._validate_min_compiler_version() self._validate_task_system() + self._validate_thread_system() self._validate_boost_components() def configure(self): - if self.options.task_system == "auto": - self.options.task_system = self._default_task_system() - self.output.info("Stlab Task System: {}.".format(self.options.task_system)) + self.output.info("STLab With Boost: {}.".format(self.options.with_boost)) + self.output.info("STLab Future Coroutines: {}.".format(self.options.future_coroutines)) + self.output.info("STLab No Standard Coroutines: {}.".format(self.options.no_std_coroutines)) + self.output.info("STLab Task System: {}.".format(self.options.task_system)) + self.output.info("STLab Thread System: {}.".format(self.options.thread_system)) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables['BUILD_TESTING'] = not self.conf.get("tools.build:skip_test", default=True, check_type=bool) + tc.variables["STLAB_USE_BOOST_CPP17_SHIMS"] = self.options.with_boost + tc.variables["STLAB_NO_STD_COROUTINES"] = self.options.no_std_coroutines + tc.variables["STLAB_THREAD_SYSTEM"] = self.options.thread_system + tc.variables["STLAB_TASK_SYSTEM"] = self.options.task_system + if cross_building(self): + tc.variables["STLAB_HAVE_FUNCTIONAL_VARIANT_OPTIONAL"] = True + tc.generate() + + tc = CMakeDeps(self) + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() def package(self): - self.copy("*LICENSE", dst="licenses", keep_path=False) - self.copy("stlab/*", src=self._source_subfolder, dst='include/') + 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, "share")) + rm(self, "msvcp*.dll", os.path.join(self.package_folder, "bin")) + rm(self, "concrt*.dll", os.path.join(self.package_folder, "bin")) + rm(self, "vcruntime*.dll", os.path.join(self.package_folder, "bin")) def package_id(self): - self.info.header_only() - self.info.options.boost_optional = "ANY" - self.info.options.boost_variant = "ANY" + # TODO: is header only but needs a header modified by cmake + # self.info.settings.clear() + # self.info.header_only() + pass def package_info(self): - coroutines_value = 1 if self.options.coroutines else 0 + future_coroutines_value = 1 if self.options.future_coroutines else 0 self.cpp_info.defines = [ - 'STLAB_FUTURE_COROUTINES={}'.format(coroutines_value) + 'STLAB_FUTURE_COROUTINES={}'.format(future_coroutines_value) ] - if self.options.boost_optional: - self.cpp_info.defines.append("STLAB_FORCE_BOOST_OPTIONAL") - - if self.options.boost_variant: - self.cpp_info.defines.append("STLAB_FORCE_BOOST_VARIANT") - - if self.options.task_system == "portable": - self.cpp_info.defines.append("STLAB_FORCE_TASK_SYSTEM_PORTABLE") - elif self.options.task_system == "libdispatch": - self.cpp_info.defines.append("STLAB_FORCE_TASK_SYSTEM_LIBDISPATCH") - elif self.options.task_system == "emscripten": - self.cpp_info.defines.append("STLAB_FORCE_TASK_SYSTEM_EMSRIPTEN") #Note: there is a typo in Stlab Cmake. - self.cpp_info.defines.append("STLAB_FORCE_TASK_SYSTEM_EMSCRIPTEN") #Note: for typo fix in later versions - elif self.options.task_system == "pnacl": - self.cpp_info.defines.append("STLAB_FORCE_TASK_SYSTEM_PNACL") - elif self.options.task_system == "windows": - self.cpp_info.defines.append("STLAB_FORCE_TASK_SYSTEM_WINDOWS") + if self.settings.os == "Windows": + self.cpp_info.defines = ['NOMINMAX'] if self.settings.os == "Linux": self.cpp_info.system_libs = ["pthread"] diff --git a/recipes/stlab/all/test_package/CMakeLists.txt b/recipes/stlab/all/test_package/CMakeLists.txt index 98fa8e5af1b41..b52ae3503ebad 100644 --- a/recipes/stlab/all/test_package/CMakeLists.txt +++ b/recipes/stlab/all/test_package/CMakeLists.txt @@ -1,10 +1,10 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.15) -set(CMAKE_CXX_STANDARD 17) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +project(test_package CXX) # if the project uses c++ +find_package(stlab REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_compile_definitions( ${PROJECT_NAME} INTERFACE $<$:NOMINMAX> ) +target_link_libraries(${PROJECT_NAME} PRIVATE stlab::stlab) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) + diff --git a/recipes/stlab/all/test_package/conanfile.py b/recipes/stlab/all/test_package/conanfile.py index bd7165a553cf4..ab351a264621f 100644 --- a/recipes/stlab/all/test_package/conanfile.py +++ b/recipes/stlab/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_layout, CMake + class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + + 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/stlab/all/test_package/test_package.cpp b/recipes/stlab/all/test_package/test_package.cpp index cbf630bd2f9a3..b125ed3c4bd3d 100644 --- a/recipes/stlab/all/test_package/test_package.cpp +++ b/recipes/stlab/all/test_package/test_package.cpp @@ -16,6 +16,8 @@ int main() { while (!f.get_try()) { this_thread::sleep_for(chrono::milliseconds(1)); } cout << "The answer is " << *f.get_try() << "\n"; + + stlab::pre_exit(); } /* diff --git a/recipes/stlab/config.yml b/recipes/stlab/config.yml index 28a287ac4f61d..4821864cf318a 100644 --- a/recipes/stlab/config.yml +++ b/recipes/stlab/config.yml @@ -1,11 +1,3 @@ versions: - "1.6.2": - folder: all - "1.5.6": - folder: all - "1.5.5": - folder: all - "1.5.4": - folder: all - "1.5.2": + "1.7.1": folder: all diff --git a/recipes/strawberryperl/all/conanfile.py b/recipes/strawberryperl/all/conanfile.py index e5d600869e82f..f6b47f3dd18e0 100644 --- a/recipes/strawberryperl/all/conanfile.py +++ b/recipes/strawberryperl/all/conanfile.py @@ -14,6 +14,7 @@ class StrawberryPerlConan(ConanFile): homepage = "http://strawberryperl.com" url = "https://github.com/conan-io/conan-center-index" topics = ("perl", "interpreter", "windows") + package_type = "application" settings = "os", "arch", "compiler", "build_type" def layout(self): @@ -24,8 +25,10 @@ def package_id(self): 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.") + if self.settings.os != "Windows": + raise ConanInvalidConfiguration(f"{self.ref} is only intended to be used on Windows.") + if self.settings.arch not in ("x86", "x86_64"): + raise ConanInvalidConfiguration(f"{self.ref} is only available for x86 and x86_64 architectures.") def source(self): pass diff --git a/recipes/streaming-percentiles/all/conandata.yml b/recipes/streaming-percentiles/all/conandata.yml new file mode 100644 index 0000000000000..475aaed46b221 --- /dev/null +++ b/recipes/streaming-percentiles/all/conandata.yml @@ -0,0 +1,10 @@ +sources: + "3.1.0": + url: "https://github.com/sengelha/streaming-percentiles/archive/refs/tags/v3.1.0.tar.gz" + sha256: "196d76a7d7ce1bcdb6f720b1c2d8feb1cda62ac18cc6412f8bd907e4eafbab6c" +patches: + "3.1.0": + - patch_file: "patches/3.1.0-0001-add-includes.patch" + patch_description: "include missing headers (already applied to upstream)" + patch_type: "backport" + patch_source: "https://github.com/sengelha/streaming-percentiles/commit/058037eca3e05fafa1b53071137f3c168a9fdd92" diff --git a/recipes/streaming-percentiles/all/conanfile.py b/recipes/streaming-percentiles/all/conanfile.py new file mode 100644 index 0000000000000..6b5b0813aa365 --- /dev/null +++ b/recipes/streaming-percentiles/all/conanfile.py @@ -0,0 +1,54 @@ +from conan import ConanFile +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get +from conan.tools.layout import basic_layout +from conan.tools.build import check_min_cppstd +import os + +required_conan_version = ">=1.52.0" + +class StreamingPercentilesConan(ConanFile): + name = "streaming-percentiles" + description = "Cross-platform, multi-language implementation of multiple streaming percentile algorithms" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/sengelha/streaming-percentiles" + topics = ("streaming", "percentiles", "header-only") + package_type = "header-library" + 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.cppstd: + check_min_cppstd(self, self._min_cppstd) + + 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, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + copy( + self, + "*.hpp", + os.path.join(self.source_folder, "cpp", "src"), + self.package_folder, + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/streaming-percentiles/all/patches/3.1.0-0001-add-includes.patch b/recipes/streaming-percentiles/all/patches/3.1.0-0001-add-includes.patch new file mode 100644 index 0000000000000..8c015b7b047b4 --- /dev/null +++ b/recipes/streaming-percentiles/all/patches/3.1.0-0001-add-includes.patch @@ -0,0 +1,62 @@ +diff --git a/cpp/src/include/stmpct/ckms_hbq.hpp b/cpp/src/include/stmpct/ckms_hbq.hpp +index 87cf860..850d527 100644 +--- a/cpp/src/include/stmpct/ckms_hbq.hpp ++++ b/cpp/src/include/stmpct/ckms_hbq.hpp +@@ -4,6 +4,7 @@ + // quantiles as defined in the paper _Effective Computation of Biased + // Quantiles over Data Streams_ + ++#include + #include "ckms_impl.hpp" + + namespace stmpct { +diff --git a/cpp/src/include/stmpct/ckms_lbq.hpp b/cpp/src/include/stmpct/ckms_lbq.hpp +index fb932af..c62d61d 100644 +--- a/cpp/src/include/stmpct/ckms_lbq.hpp ++++ b/cpp/src/include/stmpct/ckms_lbq.hpp +@@ -4,6 +4,7 @@ + // quantiles as defined in the paper _Effective Computation of Biased + // Quantiles over Data Streams_ + ++#include + #include "ckms_impl.hpp" + + namespace stmpct { +diff --git a/cpp/src/include/stmpct/ckms_tq.hpp b/cpp/src/include/stmpct/ckms_tq.hpp +index ac9dde8..5d1f093 100644 +--- a/cpp/src/include/stmpct/ckms_tq.hpp ++++ b/cpp/src/include/stmpct/ckms_tq.hpp +@@ -4,6 +4,8 @@ + // quantiles as defined in the paper _Effective Computation of Biased + // Quantiles over Data Streams_ + ++#include ++#include + #include "ckms_impl.hpp" + #include "targeted_quantile.hpp" + +diff --git a/cpp/src/include/stmpct/ckms_uq.hpp b/cpp/src/include/stmpct/ckms_uq.hpp +index d0d3837..c417ddc 100644 +--- a/cpp/src/include/stmpct/ckms_uq.hpp ++++ b/cpp/src/include/stmpct/ckms_uq.hpp +@@ -5,6 +5,7 @@ + // Quantiles over Data Streams_. Conceptually nearly equivalent to + // the GK algorithm. + ++#include + #include "ckms_impl.hpp" + + namespace stmpct { +diff --git a/cpp/src/include/stmpct/gk.hpp b/cpp/src/include/stmpct/gk.hpp +index 6b7a1c6..bf4e163 100644 +--- a/cpp/src/include/stmpct/gk.hpp ++++ b/cpp/src/include/stmpct/gk.hpp +@@ -1,6 +1,8 @@ + #pragma once + ++#include + #include ++#include + + // The Greenwald-Khanna algorithm as defined in the paper + // Space-Efficient Online Computation of Quantile Summaries diff --git a/recipes/streaming-percentiles/all/test_package/CMakeLists.txt b/recipes/streaming-percentiles/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..0259c93280ffb --- /dev/null +++ b/recipes/streaming-percentiles/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(streaming-percentiles REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE streaming-percentiles::streaming-percentiles) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/streaming-percentiles/all/test_package/conanfile.py b/recipes/streaming-percentiles/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/streaming-percentiles/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/streaming-percentiles/all/test_package/test_package.cpp b/recipes/streaming-percentiles/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..6bead07a3dd0f --- /dev/null +++ b/recipes/streaming-percentiles/all/test_package/test_package.cpp @@ -0,0 +1,16 @@ +#include +#include + +#include "stmpct/gk.hpp" +int main(int argc, char* argv[]) { + double epsilon = 0.1; + stmpct::gk g(epsilon); + for (int i = 0; i < 1000; ++i) + g.insert(rand()); + double p50 = g.quantile(0.5); // Approx. median + double p95 = g.quantile(0.95); // Approx. 95th percentile + + std::cout << "median : " << p50 << " 95th percentile : " << p95 << std::endl; + + return 0; +} diff --git a/recipes/streaming-percentiles/config.yml b/recipes/streaming-percentiles/config.yml new file mode 100644 index 0000000000000..baa80af0c4b7d --- /dev/null +++ b/recipes/streaming-percentiles/config.yml @@ -0,0 +1,3 @@ +versions: + "3.1.0": + folder: all diff --git a/recipes/streamvbyte/all/conandata.yml b/recipes/streamvbyte/all/conandata.yml new file mode 100644 index 0000000000000..6ecc44a071052 --- /dev/null +++ b/recipes/streamvbyte/all/conandata.yml @@ -0,0 +1,14 @@ +sources: + "1.0.0": + url: "https://github.com/lemire/streamvbyte/archive/refs/tags/v1.0.0.tar.gz" + sha256: "6b1920e9865146ba444cc317aa61cd39cdf760236e354ef7956011a9fe577882" +patches: + "1.0.0": + - patch_file: "patches/1.0.0-0001-fix-cmake.patch" + patch_description: "fix install destination" + patch_source: "https://github.com/lemire/streamvbyte/pull/67" + patch_type: "portability" + - patch_file: "patches/1.0.0-0002-relocatable-shared-macos.patch" + patch_description: "Relocatable shared lib for macOS" + patch_source: "https://github.com/lemire/streamvbyte/pull/66" + patch_type: "portability" diff --git a/recipes/streamvbyte/all/conanfile.py b/recipes/streamvbyte/all/conanfile.py new file mode 100644 index 0000000000000..e296e0b170799 --- /dev/null +++ b/recipes/streamvbyte/all/conanfile.py @@ -0,0 +1,63 @@ +from conan import ConanFile +from conan.tools.files import get, copy, export_conandata_patches, apply_conandata_patches +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +import os + +required_conan_version = ">=1.53.0" + +class StreamvbyteConan(ConanFile): + name = "streamvbyte" + description = "Fast integer compression in C using the StreamVByte codec" + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/lemire/streamvbyte" + topics = ("compression", "simd") + 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") + 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) + tc.variables["STREAMVBYTE_WERROR"] = False + tc.variables["STREAMVBYTE_WALL"] = 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 = ["streamvbyte"] diff --git a/recipes/streamvbyte/all/patches/1.0.0-0001-fix-cmake.patch b/recipes/streamvbyte/all/patches/1.0.0-0001-fix-cmake.patch new file mode 100644 index 0000000000000..99ab62225b638 --- /dev/null +++ b/recipes/streamvbyte/all/patches/1.0.0-0001-fix-cmake.patch @@ -0,0 +1,17 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index b6aa73e..547c44d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -136,7 +136,11 @@ install( + ${PROJECT_SOURCE_DIR}/include/streamvbyte_zigzag.h + DESTINATION include + ) +-install(TARGETS streamvbyte DESTINATION lib) ++install(TARGETS streamvbyte ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++) + + option(STREAMVBYTE_SANITIZE_UNDEFINED "Sanitize undefined behavior" OFF) + if(STREAMVBYTE_SANITIZE_UNDEFINED) diff --git a/recipes/streamvbyte/all/patches/1.0.0-0002-relocatable-shared-macos.patch b/recipes/streamvbyte/all/patches/1.0.0-0002-relocatable-shared-macos.patch new file mode 100644 index 0000000000000..5d52b1fe170f0 --- /dev/null +++ b/recipes/streamvbyte/all/patches/1.0.0-0002-relocatable-shared-macos.patch @@ -0,0 +1,9 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,6 +1,4 @@ + cmake_minimum_required(VERSION 3.3) +- +-set(CMAKE_MACOSX_RPATH OFF) + project(STREAMVBYTE VERSION "1.0.0") + + set(STREAMVBYTE_LIB_VERSION "1.0.0" CACHE STRING "streamvbyte library version") diff --git a/recipes/streamvbyte/all/test_package/CMakeLists.txt b/recipes/streamvbyte/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..531d5c3182e36 --- /dev/null +++ b/recipes/streamvbyte/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) + +find_package(streamvbyte REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE streamvbyte::streamvbyte) diff --git a/recipes/streamvbyte/all/test_package/conanfile.py b/recipes/streamvbyte/all/test_package/conanfile.py new file mode 100644 index 0000000000000..ef5d7042163ec --- /dev/null +++ b/recipes/streamvbyte/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/streamvbyte/all/test_package/test_package.c b/recipes/streamvbyte/all/test_package/test_package.c new file mode 100644 index 0000000000000..bda2ad161f942 --- /dev/null +++ b/recipes/streamvbyte/all/test_package/test_package.c @@ -0,0 +1,29 @@ +#include +#include +#include + +#include "streamvbyte.h" + +#ifdef __clang__ +#pragma clang diagnostic ignored "-Wdeclaration-after-statement" +#pragma clang diagnostic ignored "-Wunused-variable" +#endif + +int main(void) { + uint32_t N = 100U; + uint32_t * datain = malloc(N * sizeof(uint32_t)); + uint8_t * compressedbuffer = malloc(streamvbyte_max_compressedbytes(N)); + uint32_t * recovdata = malloc(N * sizeof(uint32_t)); + for (uint32_t k = 0; k < N; ++k) + datain[k] = 120; + size_t compsize = streamvbyte_encode(datain, N, compressedbuffer); // encoding + // here the result is stored in compressedbuffer using compsize bytes + size_t compsize2 = streamvbyte_decode(compressedbuffer, recovdata, + N); // decoding (fast) + assert(compsize == compsize2); + free(datain); + free(compressedbuffer); + free(recovdata); + printf("Compressed %d integers down to %d bytes.\n",N,(int) compsize); + return 0; +} diff --git a/recipes/streamvbyte/config.yml b/recipes/streamvbyte/config.yml new file mode 100644 index 0000000000000..40341aa3db6cd --- /dev/null +++ b/recipes/streamvbyte/config.yml @@ -0,0 +1,3 @@ +versions: + "1.0.0": + folder: all diff --git a/recipes/string-view-lite/all/conandata.yml b/recipes/string-view-lite/all/conandata.yml index 84f246b4d8a4d..49123d0095698 100644 --- a/recipes/string-view-lite/all/conandata.yml +++ b/recipes/string-view-lite/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.8.0": + url: "https://github.com/martinmoene/string-view-lite/archive/v1.8.0.tar.gz" + sha256: "9b38c32621eb1a81a7fa59427144309225c414a7bae522ab3a2d9ae239dd35be" "1.7.0": url: "https://github.com/martinmoene/string-view-lite/archive/v1.7.0.tar.gz" sha256: "265eaec08c4555259b46f5b03004dbc0f7206384edfac1cd5a837efaa642e01c" diff --git a/recipes/string-view-lite/all/conanfile.py b/recipes/string-view-lite/all/conanfile.py index c9b87b4dca01f..05850dbb27134 100644 --- a/recipes/string-view-lite/all/conanfile.py +++ b/recipes/string-view-lite/all/conanfile.py @@ -8,11 +8,12 @@ class StringViewLite(ConanFile): name = "string-view-lite" - url = "https://github.com/conan-io/conan-center-index" - homepage = "https://github.com/martinmoene/string-view-lite" description = "string-view lite - A C++17-like string_view for C++98, C++11 and later in a single-file header-only library" - topics = ("cpp98", "cpp11", "cpp14", "cpp17", "string-view", "string-view-implementations") license = "BSL-1.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/martinmoene/string-view-lite" + topics = ("cpp98", "cpp11", "cpp14", "cpp17", "string-view", "string-view-implementations", "header-only") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -23,8 +24,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 @@ -37,9 +37,7 @@ def package_info(self): self.cpp_info.set_property("cmake_file_name", "string-view-lite") self.cpp_info.set_property("cmake_target_name", "nonstd::string-view-lite") 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"] = "string-view-lite" @@ -50,6 +48,4 @@ def package_info(self): self.cpp_info.components["stringviewlite"].names["cmake_find_package_multi"] = "string-view-lite" self.cpp_info.components["stringviewlite"].set_property("cmake_target_name", "nonstd::string-view-lite") self.cpp_info.components["stringviewlite"].bindirs = [] - self.cpp_info.components["stringviewlite"].frameworkdirs = [] self.cpp_info.components["stringviewlite"].libdirs = [] - self.cpp_info.components["stringviewlite"].resdirs = [] diff --git a/recipes/string-view-lite/config.yml b/recipes/string-view-lite/config.yml index f05245374fbdd..4a0cc99434665 100644 --- a/recipes/string-view-lite/config.yml +++ b/recipes/string-view-lite/config.yml @@ -1,4 +1,6 @@ versions: + "1.8.0": + folder: all "1.7.0": folder: all "1.6.0": diff --git a/recipes/stringtoolbox/all/conanfile.py b/recipes/stringtoolbox/all/conanfile.py index c1426333ba094..1753e2bcb8a5f 100644 --- a/recipes/stringtoolbox/all/conanfile.py +++ b/recipes/stringtoolbox/all/conanfile.py @@ -1,31 +1,41 @@ -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" -required_conan_version = ">=1.33.0" class DawHeaderLibrariesConan(ConanFile): name = "stringtoolbox" - license = "MIT" description = "A simple header-only, single-file string toolbox library for C++." - topics = ("string", "header-only",) + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/chrberger/stringtoolbox" - settings = "os", "arch", "compiler", "build_type", + topics = ("string", "header-only") + + 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 validate(self): if self.settings.get_safe("compiler.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], strip_root=True) def package(self): - self.copy("LICENSE*", "licenses", self._source_subfolder) - self.copy("stringtoolbox.hpp", "include", self._source_subfolder) + copy(self, "LICENSE*", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, "stringtoolbox.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/stringtoolbox/all/test_package/CMakeLists.txt b/recipes/stringtoolbox/all/test_package/CMakeLists.txt index 76fbeefd9810e..012002471f6a4 100644 --- a/recipes/stringtoolbox/all/test_package/CMakeLists.txt +++ b/recipes/stringtoolbox/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(stringtoolbox CONFIG REQUIRED) +find_package(stringtoolbox REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} stringtoolbox::stringtoolbox) diff --git a/recipes/stringtoolbox/all/test_package/conanfile.py b/recipes/stringtoolbox/all/test_package/conanfile.py index de03d357e14e0..ef5d7042163ec 100644 --- a/recipes/stringtoolbox/all/test_package/conanfile.py +++ b/recipes/stringtoolbox/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 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 +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/stringzilla/all/conandata.yml b/recipes/stringzilla/all/conandata.yml new file mode 100644 index 0000000000000..eb0fe1d568743 --- /dev/null +++ b/recipes/stringzilla/all/conandata.yml @@ -0,0 +1,34 @@ +sources: + "3.10.3": + url: "https://github.com/ashvardanian/StringZilla/archive/refs/tags/v3.10.3.tar.gz" + sha256: "8a19b5a8e24f4160dc8d00e77a308a75462c3d211c0879ac218887bb41d26ce6" + "3.10.0": + url: "https://github.com/ashvardanian/StringZilla/archive/refs/tags/v3.10.0.tar.gz" + sha256: "69729a1403c4609256f861a0221e5331f836b4945f6848472e81183726e436e6" + "3.9.6": + url: "https://github.com/ashvardanian/StringZilla/archive/refs/tags/v3.9.6.tar.gz" + sha256: "21577e967d79155f5bcbe9bfd885dd817a79666f384fb2a955c0ac5dbf0657a3" + "3.9.3": + url: "https://github.com/ashvardanian/StringZilla/archive/refs/tags/v3.9.3.tar.gz" + sha256: "7d24a2fc0e426a85eac0a2be965f64e0eee794d89a895c2b5dcb614b038af580" + "3.9.0": + url: "https://github.com/ashvardanian/StringZilla/archive/refs/tags/v3.9.0.tar.gz" + sha256: "26d282b7d5ba307de7fa80c41821526babf6c6cb8e808253af8bff7664275d5c" + "3.8.4": + url: "https://github.com/ashvardanian/StringZilla/archive/refs/tags/v3.8.4.tar.gz" + sha256: "4132957633d28ce2651e587f2ab736cdf174e61b8ab1bcef453b21d40a2d872e" + "2.0.4": + url: "https://github.com/ashvardanian/StringZilla/archive/refs/tags/v2.0.4.tar.gz" + sha256: "440d3d586f8cfe96bc7648f01f2d3c514c4e2dc22446caeb50599383d1970ed2" + "2.0.3": + url: "https://github.com/ashvardanian/StringZilla/archive/refs/tags/v2.0.3.tar.gz" + sha256: "6b52a7b4eb8383cbcf83608eaa08e5ba588a378449439b73584713a16d8920e3" + "2.0.1": + url: "https://github.com/ashvardanian/StringZilla/archive/refs/tags/v2.0.1.tar.gz" + sha256: "804baa0ed8bb530de25390b21d5d51059644d5b1306364edf948c27157029793" + "1.2.2": + url: "https://github.com/ashvardanian/StringZilla/archive/refs/tags/v1.2.2.tar.gz" + sha256: "2e17c49965841647a1c371247f53b2f576e5fb32fe4b84a080d425b12f17703c" + "1.1.3": + url: "https://github.com/ashvardanian/StringZilla/archive/refs/tags/v1.1.3.tar.gz" + sha256: "1856c4d780b2c9a12ccd14d04996b35bec9fe537d0a31209000e12777a86e495" diff --git a/recipes/stringzilla/all/conanfile.py b/recipes/stringzilla/all/conanfile.py new file mode 100644 index 0000000000000..af7a34cd5d72b --- /dev/null +++ b/recipes/stringzilla/all/conanfile.py @@ -0,0 +1,63 @@ +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.tools.scm import Version +import os + +required_conan_version = ">=1.52.0" + +class StringZillaConan(ConanFile): + name = "stringzilla" + description = "Fastest string sort, search, split, and shuffle for long strings and multi-gigabyte files in Python and C, leveraging SIMD with Arm Neon and x86 AVX2 & AVX-512 intrinsics." + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/ashvardanian/StringZilla/" + topics = ("string", "simd", "sse", "avx", "neon", "header-only") + package_type = "header-library" + 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) + if Version(self.version) < "3.0.0": + copy( + self, + pattern="*.h", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "stringzilla"), + ) + else: + 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"), + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/stringzilla/all/test_package/CMakeLists.txt b/recipes/stringzilla/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..5bcb77f146e86 --- /dev/null +++ b/recipes/stringzilla/all/test_package/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(stringzilla REQUIRED CONFIG) + +if (stringzilla_VERSION VERSION_LESS 2.0) + add_executable(${PROJECT_NAME} test_package.cpp) +elseif(stringzilla_VERSION VERSION_LESS 3.0) + add_executable(${PROJECT_NAME} test_package_2_0.cpp) +else() + add_executable(${PROJECT_NAME} test_package_3_0.cpp) +endif() +target_link_libraries(${PROJECT_NAME} PRIVATE stringzilla::stringzilla) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/stringzilla/all/test_package/conanfile.py b/recipes/stringzilla/all/test_package/conanfile.py new file mode 100644 index 0000000000000..dd09e74d7fe14 --- /dev/null +++ b/recipes/stringzilla/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/stringzilla/all/test_package/test_package.cpp b/recipes/stringzilla/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..6829d24ab3783 --- /dev/null +++ b/recipes/stringzilla/all/test_package/test_package.cpp @@ -0,0 +1,25 @@ +#include +#include + +#include "stringzilla.h" + +int main(void) { + // Initialize your haystack and needle + strzl_haystack_t haystack = { + "Fastest string sort, search, split, " + "and shuffle for long strings and multi-gigabyte files in Python and C, " + "leveraging SIMD with Arm Neon and x86 AVX2 & AVX-512 intrinsics.", + 171}; + strzl_needle_t needle = {"SIMD", 4}; + + // Count occurrences of a character like a boss 😎 + size_t count = strzl_naive_count_char(haystack, 'a'); + + // Find a character like you're searching for treasure ðŸ´â€â˜ ï¸ + size_t position = strzl_naive_find_char(haystack, 'a'); + + // Find a substring like it's Waldo 🕵ï¸â€â™‚ï¸ + size_t substring_position = strzl_naive_find_substr(haystack, needle); + + return EXIT_SUCCESS; +} diff --git a/recipes/stringzilla/all/test_package/test_package_2_0.cpp b/recipes/stringzilla/all/test_package/test_package_2_0.cpp new file mode 100644 index 0000000000000..c165ef341d114 --- /dev/null +++ b/recipes/stringzilla/all/test_package/test_package_2_0.cpp @@ -0,0 +1,26 @@ +#include +#include + +#include "stringzilla.h" + +int main(void) { + // Initialize your haystack and needle + sz_string_view_t haystack = { + "Fastest string sort, search, split, " + "and shuffle for long strings and multi-gigabyte files in Python and C, " + "leveraging SIMD with Arm Neon and x86 AVX2 & AVX-512 intrinsics.", + 171}; + sz_string_view_t needle = {"SIMD", 4}; + + // Perform string-level operations + sz_size_t character_count = sz_count_char(haystack.start, haystack.length, "a"); + sz_string_start_t substring_position = sz_find_substring( + haystack.start, haystack.length, + needle.start, needle.length + ); + + // Hash strings + sz_u32_t crc32 = sz_hash_crc32(haystack.start, haystack.length); + + return EXIT_SUCCESS; +} diff --git a/recipes/stringzilla/all/test_package/test_package_3_0.cpp b/recipes/stringzilla/all/test_package/test_package_3_0.cpp new file mode 100644 index 0000000000000..04385a3492e0c --- /dev/null +++ b/recipes/stringzilla/all/test_package/test_package_3_0.cpp @@ -0,0 +1,20 @@ +#include +#include + +#include "stringzilla/stringzilla.hpp" + +namespace sz = ashvardanian::stringzilla; + +int main(void) { + sz::string haystack = "some string"; + sz::string_view needle = sz::string_view(haystack).substr(0, 4); + + auto substring_position = haystack.find(needle); // Or `rfind` + + haystack.end() - haystack.begin() == haystack.size(); // Or `rbegin`, `rend` + haystack.find_first_of(" \v\t") == 4; // Or `find_last_of`, `find_first_not_of`, `find_last_not_of` + haystack.starts_with(needle) == true; // Or `ends_with` + haystack.remove_prefix(needle.size()); // Why is this operation in-place?! + + return EXIT_SUCCESS; +} diff --git a/recipes/stringzilla/config.yml b/recipes/stringzilla/config.yml new file mode 100644 index 0000000000000..1bc4b692fbdb2 --- /dev/null +++ b/recipes/stringzilla/config.yml @@ -0,0 +1,23 @@ +versions: + "3.10.3": + folder: all + "3.10.0": + folder: all + "3.9.6": + folder: all + "3.9.3": + folder: all + "3.9.0": + folder: all + "3.8.4": + folder: all + "2.0.4": + folder: all + "2.0.3": + folder: all + "2.0.1": + folder: all + "1.2.2": + folder: all + "1.1.3": + folder: all diff --git a/recipes/strong_type/all/conandata.yml b/recipes/strong_type/all/conandata.yml new file mode 100644 index 0000000000000..f9c56ef18c867 --- /dev/null +++ b/recipes/strong_type/all/conandata.yml @@ -0,0 +1,28 @@ +sources: + "v15": + url: "https://github.com/rollbear/strong_type/archive/refs/tags/v15.tar.gz" + sha256: "d445398d4c4d6795060ac2b60be146b3cd7e6039985244b2d56f9bc333f20bae" + "v14": + url: "https://github.com/rollbear/strong_type/archive/refs/tags/v14.tar.gz" + sha256: "6cc5a6f8de5b52e6c9e4c8b246b6052b5943d6de9b314660009e092af522d2fc" + "v13": + url: "https://github.com/rollbear/strong_type/archive/refs/tags/v13.tar.gz" + sha256: "96a799dff6ed8d83040703c6f79162fc5ddf13d1aea4e56ce456736a30e07c5a" + "v12": + url: "https://github.com/rollbear/strong_type/archive/refs/tags/v12.tar.gz" + sha256: "8af0400c7ae76c7ec8646e929bacb37fc7fcae33e54eeaa61fa9f9df508a9248" + "v11": + url: "https://github.com/rollbear/strong_type/archive/refs/tags/v11.tar.gz" + sha256: "b9879c8835501c05147603ac86097b263437f72a35299b5f96c90be789932418" + "v10": + url: "https://github.com/rollbear/strong_type/archive/refs/tags/v10.tar.gz" + sha256: "154e4ceda6cf8fe734deb7eafdf58df5052822d04425dc7c22711ef54cdaeefa" + "v9": + url: "https://github.com/rollbear/strong_type/archive/refs/tags/v9.tar.gz" + sha256: "9d71ee02256b99c7f0189295514dd683cc1be8886444d5c04623fd491cf5aa40" + "v8": + url: "https://github.com/rollbear/strong_type/archive/refs/tags/v8.tar.gz" + sha256: "31ee68e097fec2ce65dbf2ed683911c5ee6a7a37808b28d84479ef7e17990fad" + "v7": + url: "https://github.com/rollbear/strong_type/archive/refs/tags/v7.tar.gz" + sha256: "854365b28dfaaee5c2047dd4d2e746c809b76035191b22a4ce24f4cac49d0891" diff --git a/recipes/strong_type/all/conanfile.py b/recipes/strong_type/all/conanfile.py new file mode 100644 index 0000000000000..a5d80e301881b --- /dev/null +++ b/recipes/strong_type/all/conanfile.py @@ -0,0 +1,69 @@ +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" + description = "An additive strong typedef library for C++14/17/20" + license = "BSL-1.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/rollbear/strong_type" + topics = ("cpp14", "cpp17", "strong_type", "header-only") + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _min_cppstd(self): + return 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) + if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "7": + raise ConanInvalidConfiguration("GCC < version 7 is not supported") + + def source(self): + get(self, **self.conan_data["sources"][self.version], 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.libdirs = [] + + 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"].libdirs = [] + + # 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" 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..0a6bc68712d90 --- /dev/null +++ b/recipes/strong_type/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/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..b91eac17af3a4 --- /dev/null +++ b/recipes/strong_type/config.yml @@ -0,0 +1,19 @@ +versions: + "v15": + folder: all + "v14": + folder: all + "v13": + folder: all + "v12": + folder: all + "v11": + folder: all + "v10": + folder: all + "v9": + folder: all + "v8": + folder: all + "v7": + folder: all diff --git a/recipes/structopt/all/conandata.yml b/recipes/structopt/all/conandata.yml index 6f0c202add0e6..0ba29b1eb7e13 100644 --- a/recipes/structopt/all/conandata.yml +++ b/recipes/structopt/all/conandata.yml @@ -13,14 +13,10 @@ sources: sha256: "a0552e81312cfafcc5319a25c0571ca2470f43461e9f3f72e5f9d89ea4139505" patches: "0.1.3": - - base_path: "source_subfolder" - patch_file: "patches/0.1.0-0001-use-recipes.patch" + - patch_file: "patches/0.1.0-0001-use-recipes.patch" "0.1.2": - - base_path: "source_subfolder" - patch_file: "patches/0.1.0-0001-use-recipes.patch" + - patch_file: "patches/0.1.0-0001-use-recipes.patch" "0.1.1": - - base_path: "source_subfolder" - patch_file: "patches/0.1.0-0001-use-recipes.patch" + - patch_file: "patches/0.1.0-0001-use-recipes.patch" "0.1.0": - - base_path: "source_subfolder" - patch_file: "patches/0.1.0-0001-use-recipes.patch" + - patch_file: "patches/0.1.0-0001-use-recipes.patch" diff --git a/recipes/structopt/all/conanfile.py b/recipes/structopt/all/conanfile.py index 08d36a1d38388..bca62b435e167 100644 --- a/recipes/structopt/all/conanfile.py +++ b/recipes/structopt/all/conanfile.py @@ -1,36 +1,32 @@ import os -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -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, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir +from conan.tools.scm import Version + +required_conan_version = ">=1.52.0" + class StructoptConan(ConanFile): name = "structopt" description = "Parse command line arguments by defining a struct+" - topics = ("structopt", "argument-parser", "cpp17", "header-only", - "single-header-lib", "header-library", "command-line", "arguments", - "mit-license", "modern-cpp", "structopt", "lightweight", "reflection", - "cross-platform", "library", "type-safety", "type-safe", "argparse", - "clap",) license = "MIT" - homepage = "https://github.com/p-ranav/structopt" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/p-ranav/structopt" + topics = ("argument-parser", "cpp17", "header-only", "single-header-lib", "command-line", + "arguments", "mit-license", "modern-cpp", "lightweight", "reflection", + "cross-platform", "type-safety", "type-safe", "argparse", "clap") + + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" + no_copy_source = 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"]) - - def requirements(self): - self.requires("magic_enum/0.8.0") - self.requires("visit_struct/1.0") - - def package_id(self): - self.info.header_only() + def _min_cppstd(self): + return 17 @property def _compilers_minimum_version(self): @@ -39,39 +35,58 @@ def _compilers_minimum_version(self): "Visual Studio": "15.0", "clang": "5", "apple-clang": "10", + "msvc": "191", } + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires("magic_enum/0.9.2") + self.requires("visit_struct/1.1.0") + + 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) 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("structopt: Unsupported compiler: {}-{} " - "(https://github.com/p-ranav/structopt#compiler-compatibility)." - .format(self.settings.compiler, self.settings.compiler.version)) + if Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"structopt: Unsupported compiler: {self.settings.compiler}-{self.settings.compiler.version} " + f"(https://github.com/p-ranav/structopt#compiler-compatibility)." + ) else: - self.output.warn("{} requires C++14. Your compiler is unknown. Assuming it supports C++14.".format(self.name)) + self.output.warning("{} requires C++14. Your compiler is unknown. Assuming it supports C++14.".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], strip_root=True) - def _configure_cmake(self): - cmake = CMake(self) - cmake.configure(source_folder=self._source_subfolder) - return cmake + def generate(self): + tc = CMakeToolchain(self) + tc.generate() + tc = CMakeDeps(self) + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - tools.rmdir(os.path.join(self._source_subfolder, "include", "structopt", "third_party")) - + apply_conandata_patches(self) + rmdir(self, os.path.join(self.source_folder, "include", "structopt", "third_party")) def package(self): - self.copy(pattern="LICENSE", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.configure() 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.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/structopt/all/test_package/CMakeLists.txt b/recipes/structopt/all/test_package/CMakeLists.txt index edf44ae8164be..ea6a19b7561c5 100644 --- a/recipes/structopt/all/test_package/CMakeLists.txt +++ b/recipes/structopt/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(structopt REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/structopt/all/test_package/conanfile.py b/recipes/structopt/all/test_package/conanfile.py index 49a3a66ea5bad..fae501d0afb9e 100644 --- a/recipes/structopt/all/test_package/conanfile.py +++ b/recipes/structopt/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" + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/structopt/all/test_v1_package/CMakeLists.txt b/recipes/structopt/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/structopt/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/structopt/all/test_v1_package/conanfile.py b/recipes/structopt/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..49a3a66ea5bad --- /dev/null +++ b/recipes/structopt/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/stx/all/CMakeLists.txt b/recipes/stx/all/CMakeLists.txt deleted file mode 100644 index 8bdaa1e47bfa0..0000000000000 --- a/recipes/stx/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.5) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/stx/all/conandata.yml b/recipes/stx/all/conandata.yml index 8029486130779..d0f1a667ea097 100644 --- a/recipes/stx/all/conandata.yml +++ b/recipes/stx/all/conandata.yml @@ -1,10 +1,22 @@ sources: - "1.0.1": - url: https://github.com/lamarrr/STX/archive/v1.0.1.tar.gz - sha256: c491c888c56b9f800eb7c17a30c81afcf2d9fec4cdae9a73cd1145698a645dd9 + "1.0.5": + url: "https://github.com/lamarrr/STX/archive/v1.0.5.tar.gz" + sha256: "d21a1895bc7057c8c6118a042ec39f364b2ad768394d4facb2fd64b73b07d97f" + "1.0.4": + url: "https://github.com/lamarrr/STX/archive/v1.0.4.tar.gz" + sha256: "89c61efb84828e42ddd6765e323e12b7b8de7ff68116f93227a87c56159c34ab" patches: - "1.0.1": - - patch_file: patches/0001-abseil_find_package.patch - base_path: source_subfolder - - patch_file: patches/0002-cmake_module_path.patch - base_path: source_subfolder + "1.0.5": + - patch_file: "patches/1.0.4-0001-cmake_module_path.patch" + patch_description: "append CMAKE_MODULE_PATH instead of setting CMAKE_MODULE_PATH" + patch_type: "conan" + - patch_file: "patches/1.0.5-0002-add-installer.patch" + patch_description: "use GNUInstallDirs for target path" + patch_type: "portability" + "1.0.4": + - patch_file: "patches/1.0.4-0001-cmake_module_path.patch" + patch_description: "append CMAKE_MODULE_PATH instead of setting CMAKE_MODULE_PATH" + patch_type: "conan" + - patch_file: "patches/1.0.4-0002-add-installer.patch" + patch_description: "use GNUInstallDirs for target path" + patch_type: "portability" diff --git a/recipes/stx/all/conanfile.py b/recipes/stx/all/conanfile.py index b81962b835189..a4d52d28312f9 100644 --- a/recipes/stx/all/conanfile.py +++ b/recipes/stx/all/conanfile.py @@ -1,149 +1,104 @@ -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, stdcpp_library +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy +from conan.tools.scm import Version import os -required_conan_version = ">=1.33.0" - +required_conan_version = ">=1.53.0" class STXConan(ConanFile): name = 'stx' - homepage = 'https://github.com/lamarrr/STX' + description = 'C++17 & C++ 20 error-handling and utility extensions.' license = 'MIT' url = 'https://github.com/conan-io/conan-center-index' - description = 'C++17 & C++ 20 error-handling and utility extensions.' - topics = 'error-handling', 'result', 'option', 'backtrace', 'panic' - - settings = 'os', 'compiler', 'build_type', 'arch' + homepage = 'https://github.com/lamarrr/STX' + topics = ('error-handling', 'result', 'option', 'backtrace', 'panic') + package_type = "static-library" + settings = 'os', 'arch', 'compiler', 'build_type' options = { - 'shared': [True, False], 'fPIC': [True, False], 'backtrace': [True, False], - 'panic_handler': [None, 'default', 'backtrace'], - 'visible_panic_hook': [True, False], + 'custom_panic_handler': [True, False], } default_options = { - 'shared': False, 'fPIC': True, 'backtrace': False, - 'panic_handler': 'default', - 'visible_panic_hook': False, + 'custom_panic_handler': False, } - exports_sources = ['CMakeLists.txt', 'patches/*'] - generators = 'cmake', 'cmake_find_package' - @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 17 @property - def _build_subfolder(self): - return "build_subfolder" + def _compilers_minimum_version(self): + return { + "gcc": "8", + "clang": "7", + "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: - del self.options.fPIC + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.options.backtrace: - self.requires('abseil/20200923.1') + self.requires('abseil/20230125.3') def validate(self): - if (self.options.panic_handler == 'backtrace' and - not self.options.backtrace): - raise ConanInvalidConfiguration( - 'panic_handler=backtrace requires backtrace=True' - ) - - compiler = self.settings.compiler - compiler_version = tools.Version(self.settings.compiler.version) - - if compiler.get_safe('cppstd'): - tools.check_min_cppstd(self, 17) - - if compiler == 'Visual Studio' and compiler_version < 16: - raise ConanInvalidConfiguration( - 'STX requires C++17 language and standard library features ' - 'which VS < 2019 lacks' - ) - - if compiler == 'gcc' and compiler_version < 8: - raise ConanInvalidConfiguration( - 'STX requires C++17 language and standard library features ' - 'which GCC < 8 lacks' - ) + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) - if (compiler == 'clang' and compiler.libcxx and - compiler.libcxx in ['libstdc++', 'libstdc++11'] and - compiler_version < 9): + 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( - 'STX requires C++17 language and standard library features ' - 'which clang < 9 with libc++ lacks' + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." ) - if (compiler == 'clang' and compiler.libcxx and - compiler.libcxx == 'libc++' and - compiler_version < 10): - raise ConanInvalidConfiguration( - 'STX requires C++17 language and standard library features ' - 'which clang < 10 with libc++ lacks' - ) - - if compiler == 'apple-clang' and compiler_version < 12: - raise ConanInvalidConfiguration( - 'STX requires C++17 language and standard library features ' - 'which apple-clang < 12 with libc++ lacks' - ) - - if (compiler == 'Visual Studio' and self.options.shared and - tools.Version(self.version) <= '1.0.1'): - raise ConanInvalidConfiguration( - 'shared library build does not work on windows with ' - 'STX version <= 1.0.1' - ) + if self.settings.compiler == "clang": + libcxx = stdcpp_library(self) + compiler_version = Version(self.settings.compiler.version) + if (libcxx == "stdc++" and compiler_version < 9) or (libcxx == "c++" and compiler_version < 10): + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd} language and standard library features " + f"which clang < {compiler_version} with lib{libcxx} lacks" + ) 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): - for patch in self.conan_data.get('patches', {}).get(self.version, []): - tools.patch(**patch) + def generate(self): + tc = CMakeToolchain(self) + tc.variables['STX_ENABLE_BACKTRACE'] = self.options.backtrace + tc.variables['STX_CUSTOM_PANIC_HANDLER'] = self.options.custom_panic_handler + tc.generate() + deps = CMakeDeps(self) + deps.generate() + def build(self): + apply_conandata_patches(self) cmake = CMake(self) - cmake.definitions['STX_BUILD_SHARED'] = self.options.shared - cmake.definitions['STX_ENABLE_BACKTRACE'] = self.options.backtrace - cmake.definitions['STX_ENABLE_PANIC_BACKTRACE'] = \ - self.options.panic_handler == 'backtrace' - cmake.definitions['STX_OVERRIDE_PANIC_HANDLER'] = \ - self.options.panic_handler == None - cmake.definitions['STX_VISIBLE_PANIC_HOOK'] = \ - self.options.visible_panic_hook - - cmake.configure(build_folder=self._build_subfolder) + cmake.configure() cmake.build() def package(self): - self.copy( - '*.h', - dst='include', - src=os.path.join(self._source_subfolder, 'include') - ) - - self.copy('*.lib', dst='lib', keep_path=False) - self.copy('*.dll', dst='bin', keep_path=False) - self.copy('*.so', dst='lib', keep_path=False) - self.copy('*.dylib', dst='lib', keep_path=False) - self.copy('*.a', 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) + cmake = CMake(self) + cmake.install() def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = ["stx"] if self.options.backtrace: self.cpp_info.requires = [ @@ -151,14 +106,5 @@ def package_info(self): 'abseil::absl_symbolize' ] - if self.options.visible_panic_hook: - self.cpp_info.defines.append('STX_VISIBLE_PANIC_HOOK') - - if self.options.panic_handler == None: - self.cpp_info.defines.append('STX_OVERRIDE_PANIC_HANDLER') - - if self.options.panic_handler == 'backtrace': - self.cpp_info.defines.append('STX_ENABLE_PANIC_BACKTRACE') - - if self.settings.os == 'Android': + if self.settings.os in ["Linux", "FreeBSD", 'Android']: self.cpp_info.system_libs = ['atomic'] diff --git a/recipes/stx/all/patches/0001-abseil_find_package.patch b/recipes/stx/all/patches/0001-abseil_find_package.patch deleted file mode 100644 index 11c8ae870c7f2..0000000000000 --- a/recipes/stx/all/patches/0001-abseil_find_package.patch +++ /dev/null @@ -1,18 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index e4ed99e..5e155ec 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -204,12 +204,7 @@ endif() - # =============================================== - - if(STX_ENABLE_BACKTRACE) -- if(NOT EXISTS third_party/abseil) -- execute_process( -- COMMAND git submodule update --init --recursive third_party/abseil -- WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}) -- endif() -- add_subdirectory(third_party/abseil) -+ find_package(absl REQUIRED) - endif() - - # the atomics library doesn't automatically link on my Android phone diff --git a/recipes/stx/all/patches/0002-cmake_module_path.patch b/recipes/stx/all/patches/0002-cmake_module_path.patch deleted file mode 100644 index 909cc4eabba22..0000000000000 --- a/recipes/stx/all/patches/0002-cmake_module_path.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 5e155ec..d73691d 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -30,7 +30,7 @@ project( - HOMEPAGE_URL "https://github.com/lamarrr/STX" - LANGUAGES CXX) - --set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake-modules) -+list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake-modules) - - include(CMakeDependentOption) - include(HandleFlags) diff --git a/recipes/stx/all/patches/1.0.4-0001-cmake_module_path.patch b/recipes/stx/all/patches/1.0.4-0001-cmake_module_path.patch new file mode 100644 index 0000000000000..89363cb6ad87d --- /dev/null +++ b/recipes/stx/all/patches/1.0.4-0001-cmake_module_path.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 4a21163..d11d123 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -12,7 +12,7 @@ project( + HOMEPAGE_URL "https://github.com/lamarrr/STX" + LANGUAGES CXX) + +-set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake-modules) ++list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake-modules) + set(CMAKE_CXX_STANDARD 17) + set(CMAKE_CXX_STANDARD_REQUIRED ON) + diff --git a/recipes/stx/all/patches/1.0.4-0002-add-installer.patch b/recipes/stx/all/patches/1.0.4-0002-add-installer.patch new file mode 100644 index 0000000000000..102b4d0e1195c --- /dev/null +++ b/recipes/stx/all/patches/1.0.4-0002-add-installer.patch @@ -0,0 +1,20 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 4a21163..d24bb87 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -131,10 +131,14 @@ endif() + # === Install + # + # =============================================== ++include(GNUInstallDirs) + install( + TARGETS stx + EXPORT stx +- LIBRARY DESTINATION lib) ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++) + install(DIRECTORY include/stx DESTINATION include) + + # =============================================== diff --git a/recipes/stx/all/patches/1.0.5-0002-add-installer.patch b/recipes/stx/all/patches/1.0.5-0002-add-installer.patch new file mode 100644 index 0000000000000..76dc480783923 --- /dev/null +++ b/recipes/stx/all/patches/1.0.5-0002-add-installer.patch @@ -0,0 +1,20 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index ee82585..bea77c7 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -113,10 +113,14 @@ target_include_directories(stx PRIVATE src) + # === Install + # + # =============================================== ++include(GNUInstallDirs) + install( + TARGETS stx + EXPORT stx +- LIBRARY DESTINATION lib) ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++) + install(DIRECTORY include/stx DESTINATION include) + + # =============================================== diff --git a/recipes/stx/all/test_package/CMakeLists.txt b/recipes/stx/all/test_package/CMakeLists.txt index 985bbfd508f2e..6d43705b506c0 100644 --- a/recipes/stx/all/test_package/CMakeLists.txt +++ b/recipes/stx/all/test_package/CMakeLists.txt @@ -1,14 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(PackageTest LANGUAGES CXX) +cmake_minimum_required(VERSION 3.15) +project(test_package CXX) -set(CMAKE_CXX_STANDARD 17) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS OFF) +find_package(stx REQUIRED CONFIG) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - -find_package(stx CONFIG REQUIRED) - -add_executable(example example.cpp) -target_link_libraries(example PRIVATE stx::stx) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE stx::stx) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/stx/all/test_package/conanfile.py b/recipes/stx/all/test_package/conanfile.py index 46663ae7805d2..ef5d7042163ec 100644 --- a/recipes/stx/all/test_package/conanfile.py +++ b/recipes/stx/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 STXTestConan(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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/stx/all/test_package/example.cpp b/recipes/stx/all/test_package/test_package.cpp similarity index 100% rename from recipes/stx/all/test_package/example.cpp rename to recipes/stx/all/test_package/test_package.cpp diff --git a/recipes/stx/config.yml b/recipes/stx/config.yml index 715e55357a17b..267193202c4e1 100644 --- a/recipes/stx/config.yml +++ b/recipes/stx/config.yml @@ -1,3 +1,5 @@ versions: - "1.0.1": + "1.0.5": + folder: all + "1.0.4": folder: all diff --git a/recipes/subunit/all/conandata.yml b/recipes/subunit/all/conandata.yml index afbc1844ad677..565af62adb5d6 100644 --- a/recipes/subunit/all/conandata.yml +++ b/recipes/subunit/all/conandata.yml @@ -5,4 +5,3 @@ sources: patches: "1.4.0": - patch_file: "patches/0001-fix-ExtUtils-MakeMaker-error.patch" - base_path: "source_subfolder" diff --git a/recipes/subunit/all/conanfile.py b/recipes/subunit/all/conanfile.py index e662ea1d9f3b1..b1995dd599186 100644 --- a/recipes/subunit/all/conanfile.py +++ b/recipes/subunit/all/conanfile.py @@ -1,19 +1,28 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, tools -from conans.errors import ConanInvalidConfiguration -import contextlib import glob import os -required_conan_version = ">=1.33.0" +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +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, 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 +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" class SubunitConan(ConanFile): name = "subunit" description = "A streaming protocol for test results" - topics = "subunit", "streaming", "protocol", "test", "results" - license = "Apache-2.0", "BSD-3-Clause" - homepage = "https://launchpad.net/subunit" + license = ("Apache-2.0", "BSD-3-Clause") url = "https://github.com/conan-io/conan-center-index" + homepage = "https://launchpad.net/subunit" + topics = ("subunit", "streaming", "protocol", "test", "results") + + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -24,125 +33,135 @@ class SubunitConan(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 _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 def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") - def requirements(self): - self.requires("cppunit/1.15.1") + 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") + def requirements(self): + self.requires("cppunit/1.15.1", transitive_headers=True) def validate(self): if self.settings.os == "Windows" and self.options.shared: raise ConanInvalidConfiguration("Cannot build shared subunit libraries on Windows") - if self.settings.compiler == "apple-clang" and tools.Version(self.settings.compiler.version) < "10": + if self.settings.compiler == "apple-clang" and Version(self.settings.compiler.version) < "10": # Complete error is: # make[2]: *** No rule to make target `/Applications/Xcode-9.4.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE/config.h', needed by `Makefile'. Stop. raise ConanInvalidConfiguration("Due to weird make error involving missing config.h file in sysroot") + if self.settings.compiler == "apple-clang" and self.options.shared: + raise ConanInvalidConfiguration("Shared builds with apple-clang are not supported") + 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") + 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) - - @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 _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") - 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)), - "CHECK_CFLAGS=' '", - "CHECK_LIBS=' '", - "CPPUNIT_CFLAGS='{}'".format(" ".join("-I{}".format(inc) for inc in self.deps_cpp_info["cppunit"].include_paths).replace("\\", "/")), - "CPPUNIT_LIBS='{}'".format(" ".join(self.deps_cpp_info["cppunit"].libs)), + 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 = AutotoolsToolchain(self) + if is_msvc(self): + tc.extra_cflags.append("-FS") + tc.extra_cxxflags.append("-FS") + tc.extra_cxxflags.append("-EHsc") + tc.configure_args.append("CHECK_CFLAGS= ") + tc.configure_args.append("CHECK_LIBS= ") + cppunit_info = self.dependencies["cppunit"].cpp_info + tc.configure_args.append("CPPUNIT_LIBS='{}'".format(" ".join(cppunit_info.libs))) + tc.configure_args.append("CPPUNIT_CFLAGS= ") + # Avoid installing i18n + perl things in arch-dependent folders or in a `local` subfolder + tc.make_args += [ + f"INSTALLARCHLIB={unix_path(self, os.path.join(self.package_folder, 'lib'))}", + f"INSTALLSITEARCH={unix_path(self, os.path.join(self.build_folder, 'archlib'))}", + f"INSTALLVENDORARCH={unix_path(self, os.path.join(self.build_folder, 'archlib'))}", + f"INSTALLSITEBIN={unix_path(self, os.path.join(self.package_folder, 'bin'))}", + f"INSTALLSITESCRIPT={unix_path(self, os.path.join(self.package_folder, 'bin'))}", + f"INSTALLSITEMAN1DIR={unix_path(self, os.path.join(self.build_folder, 'share', 'man', 'man1'))}", + f"INSTALLSITEMAN3DIR={unix_path(self, os.path.join(self.build_folder, 'share', 'man', 'man3'))}", ] - self._autotools.configure(args=conf_args, configure_dir=self._source_subfolder) - return self._autotools + tc.generate() + + if is_msvc(self) or self._is_clang_cl: + # AutotoolsDeps causes ./configure to fail on Windows + # Possibly related to https://github.com/conan-io/conan/issues/12784 + env = Environment() + env.append("CPPFLAGS", [f"-I{unix_path(self, p)}" for p in cppunit_info.includedirs] + [f"-D{d}" for d in cppunit_info.defines]) + env.vars(self).save_script("conanautotoolsdeps_workaround") + else: + deps = AutotoolsDeps(self) + deps.generate() + + if is_msvc(self): + env = Environment() + 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') + env.define("NM", "dumpbin -symbols") + env.define("OBJDUMP", ":") + env.define("RANLIB", ":") + env.define("STRIP", ":") + env.vars(self).save_script("conanbuild_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) + with chdir(self, self.source_folder): + 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() - # Avoid installing i18n + perl things in arch-dependent folders or in a `local` subfolder - install_args = [ - "INSTALLARCHLIB={}".format(os.path.join(self.package_folder, "lib").replace("\\", "/")), - "INSTALLSITEARCH={}".format(os.path.join(self.build_folder, "archlib").replace("\\", "/")), - "INSTALLVENDORARCH={}".format(os.path.join(self.build_folder, "archlib").replace("\\", "/")), - "INSTALLSITEBIN={}".format(os.path.join(self.package_folder, "bin").replace("\\", "/")), - "INSTALLSITESCRIPT={}".format(os.path.join(self.package_folder, "bin").replace("\\", "/")), - "INSTALLSITEMAN1DIR={}".format(os.path.join(self.build_folder, "share", "man", "man1").replace("\\", "/")), - "INSTALLSITEMAN3DIR={}".format(os.path.join(self.build_folder, "share", "man", "man3").replace("\\", "/")), - ] - autotools.install(args=install_args) - - 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"), "*.pod") + 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() + rm(self, "*.la", self.package_folder, recursive=True) + rm(self, "*.pod", self.package_folder, recursive=True) for d in glob.glob(os.path.join(self.package_folder, "lib", "python*")): - tools.rmdir(d) + rmdir(self, d) for d in glob.glob(os.path.join(self.package_folder, "lib", "*")): if os.path.isdir(d): - tools.rmdir(d) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "Library")) + rmdir(self, d) + for d in glob.glob(os.path.join(self.package_folder, "*")): + if os.path.isdir(d) and os.path.basename(d) not in ["bin", "include", "lib", "licenses"]: + rmdir(self, d) def package_info(self): self.cpp_info.components["libsubunit"].libs = ["subunit"] - self.cpp_info.components["libsubunit"].names["pkgconfig"] = "libsubunit" + self.cpp_info.components["libsubunit"].set_property("pkg_config_name", "libsubunit") self.cpp_info.components["libcppunit_subunit"].libs = ["cppunit_subunit"] self.cpp_info.components["libcppunit_subunit"].requires = ["cppunit::cppunit"] - self.cpp_info.components["libcppunit_subunit"].names["pkgconfig"] = "libcppunit_subunit" + self.cpp_info.components["libcppunit_subunit"].set_property("pkg_config_name", "libcppunit_subunit") 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/subunit/all/test_package/CMakeLists.txt b/recipes/subunit/all/test_package/CMakeLists.txt index ec668b89c232d..10c8b53495cd6 100644 --- a/recipes/subunit/all/test_package/CMakeLists.txt +++ b/recipes/subunit/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package C CXX) -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup() +find_package(subunit REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE subunit::subunit) diff --git a/recipes/subunit/all/test_package/conanfile.py b/recipes/subunit/all/test_package/conanfile.py index d4128b0450777..ef5d7042163ec 100644 --- a/recipes/subunit/all/test_package/conanfile.py +++ b/recipes/subunit/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): - bin_path = os.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/subunit/all/test_v1_package/CMakeLists.txt b/recipes/subunit/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/subunit/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/subunit/all/test_v1_package/conanfile.py b/recipes/subunit/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..49a3a66ea5bad --- /dev/null +++ b/recipes/subunit/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/sundials/all/CMakeLists.txt b/recipes/sundials/all/CMakeLists.txt deleted file mode 100644 index 361b35d4c17d9..0000000000000 --- a/recipes/sundials/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/sundials/all/conandata.yml b/recipes/sundials/all/conandata.yml index c8039381646ea..d7e3f7fdd5714 100644 --- a/recipes/sundials/all/conandata.yml +++ b/recipes/sundials/all/conandata.yml @@ -8,13 +8,3 @@ sources: "5.2.0": url: "https://github.com/LLNL/sundials/releases/download/v5.2.0/sundials-5.2.0.tar.gz" sha256: "95f058acce5bd66e654de65acdbb1c9f44c90cf1b4e28f8d933cdb4415ebba3e" -patches: - "5.4.0": - - patch_file: "patches/0001-disable-in-source-fail.patch" - base_path: "source_subfolder" - "5.3.0": - - patch_file: "patches/0001-disable-in-source-fail.patch" - base_path: "source_subfolder" - "5.2.0": - - patch_file: "patches/0001-disable-in-source-fail.patch" - base_path: "source_subfolder" diff --git a/recipes/sundials/all/conanfile.py b/recipes/sundials/all/conanfile.py index 78c54bca4ac45..c431e2317a534 100644 --- a/recipes/sundials/all/conanfile.py +++ b/recipes/sundials/all/conanfile.py @@ -1,9 +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, mkdir import glob import os import shutil -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class SundialsConan(ConanFile): @@ -13,11 +15,11 @@ class SundialsConan(ConanFile): " with the goal of providing robust time integrators " "and nonlinear solvers that can easily be incorporated" "into existing simulation codes.") - topics = ("sundials", "integrators", "ode", "non-linear solvers") + topics = ("integrators", "ode", "non-linear solvers") homepage = "https://github.com/LLNL/sundials" url = "https://github.com/conan-io/conan-center-index" - - settings = "os", "compiler", "build_type", "arch" + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -39,14 +41,7 @@ class SundialsConan(ConanFile): "build_kinsol": True, } - exports_sources = "CMakeLists.txt", "patches/**" - generators = "cmake" short_paths = True - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" def config_options(self): if self.settings.os == "Windows": @@ -54,42 +49,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], strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BUILD_STATIC_LIBS"] = not self.options.shared - self._cmake.definitions["BUILD_ARKODE"] = self.options.build_arkode - self._cmake.definitions["BUILD_CVODE"] = self.options.build_cvode - self._cmake.definitions["BUILD_CVODES"] = self.options.build_cvodes - self._cmake.definitions["BUILD_IDA"] = self.options.build_ida - self._cmake.definitions["BUILD_IDAS"] = self.options.build_idas - self._cmake.definitions["BUILD_KINSOL"] = self.options.build_kinsol - self._cmake.definitions["EXAMPLES_ENABLE_C"] = False - self._cmake.definitions["EXAMPLES_INSTALL"] = False - self._cmake.configure() - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_STATIC_LIBS"] = not self.options.shared + tc.variables["BUILD_ARKODE"] = self.options.build_arkode + tc.variables["BUILD_CVODE"] = self.options.build_cvode + tc.variables["BUILD_CVODES"] = self.options.build_cvodes + tc.variables["BUILD_IDA"] = self.options.build_ida + tc.variables["BUILD_IDAS"] = self.options.build_idas + tc.variables["BUILD_KINSOL"] = self.options.build_kinsol + tc.variables["EXAMPLES_ENABLE_C"] = False + tc.variables["EXAMPLES_INSTALL"] = False + 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(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() if self.settings.os == "Windows" and self.options.shared: - tools.mkdir(os.path.join(self.package_folder, "bin")) + mkdir(self, os.path.join(self.package_folder, "bin")) for dll_path in glob.glob(os.path.join(self.package_folder, "lib", "*.dll")): shutil.move(dll_path, os.path.join(self.package_folder, "bin", os.path.basename(dll_path))) @@ -110,7 +103,7 @@ def package_info(self): self.cpp_info.components["sundials_sunmatrixsparse"].libs = ["sundials_sunmatrixsparse"] self.cpp_info.components["sundials_sunnonlinsolfixedpoint"].libs = ["sundials_sunnonlinsolfixedpoint"] self.cpp_info.components["sundials_sunnonlinsolnewton"].libs = ["sundials_sunnonlinsolnewton"] - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["sundials_nvecmanyvector"].system_libs = ["m"] self.cpp_info.components["sundials_nvecserial"].system_libs = ["m"] self.cpp_info.components["sundials_sunlinsolpcg"].system_libs = ["m"] @@ -125,25 +118,25 @@ def package_info(self): self.cpp_info.components["sundials_sunnonlinsolnewton"].system_libs = ["m"] if self.options.build_arkode: self.cpp_info.components["sundials_arkode"].libs = ["sundials_arkode"] - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["sundials_arkode"].system_libs = ["m"] if self.options.build_cvode: self.cpp_info.components["sundials_cvode"].libs = ["sundials_cvode"] - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["sundials_cvode"].system_libs = ["m"] if self.options.build_cvodes: self.cpp_info.components["sundials_cvodes"].libs = ["sundials_cvodes"] - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["sundials_cvodes"].system_libs = ["m"] if self.options.build_ida: self.cpp_info.components["sundials_ida"].libs = ["sundials_ida"] - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["sundials_ida"].system_libs = ["m"] if self.options.build_idas: self.cpp_info.components["sundials_idas"].libs = ["sundials_idas"] - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["sundials_idas"].system_libs = ["m"] if self.options.build_kinsol: self.cpp_info.components["sundials_kinsol"].libs = ["sundials_kinsol"] - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["sundials_kinsol"].system_libs = ["m"] diff --git a/recipes/sundials/all/patches/0001-disable-in-source-fail.patch b/recipes/sundials/all/patches/0001-disable-in-source-fail.patch deleted file mode 100644 index 73a6ba500d80c..0000000000000 --- a/recipes/sundials/all/patches/0001-disable-in-source-fail.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 6bd5cc3..52a7d05 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -48,10 +48,5 @@ endif() - - set_property(GLOBAL PROPERTY USE_FOLDERS ON) - --# Prohibit in-source build --if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") -- message(FATAL_ERROR "In-source build prohibited.") --endif("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") -- - # Hide some cache variables - mark_as_advanced(EXECUTABLE_OUTPUT_PATH LIBRARY_OUTPUT_PATH) diff --git a/recipes/sundials/all/test_package/CMakeLists.txt b/recipes/sundials/all/test_package/CMakeLists.txt index 7b9b613cbb24a..cf2fd2bc5a19e 100644 --- a/recipes/sundials/all/test_package/CMakeLists.txt +++ b/recipes/sundials/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(sundials REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE sundials::sundials) diff --git a/recipes/sundials/all/test_package/conanfile.py b/recipes/sundials/all/test_package/conanfile.py index 0926a977fb737..98ab55852ad56 100644 --- a/recipes/sundials/all/test_package/conanfile.py +++ b/recipes/sundials/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 SundialsTestConan(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,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/sundials/all/test_v1_package/CMakeLists.txt b/recipes/sundials/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/sundials/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/sundials/all/test_v1_package/conanfile.py b/recipes/sundials/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/sundials/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/suyash-ulid/all/conandata.yml b/recipes/suyash-ulid/all/conandata.yml new file mode 100644 index 0000000000000..31eb78c9466e9 --- /dev/null +++ b/recipes/suyash-ulid/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "cci.20201213": + url: "https://github.com/suyash/ulid/archive/3a46362db2c0f5fece10e59a52bdefbf7eec0877.tar.gz" + sha256: "4a9756e5d481f591c0ea4f4e767b5eecf05fea32e5b74915b044d1401548485a" diff --git a/recipes/suyash-ulid/all/conanfile.py b/recipes/suyash-ulid/all/conanfile.py new file mode 100644 index 0000000000000..df3cfccf4abd0 --- /dev/null +++ b/recipes/suyash-ulid/all/conanfile.py @@ -0,0 +1,51 @@ +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 SuyashUlidConan(ConanFile): + name = "suyash-ulid" + description = "ulids in C++, Header Only" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://suy.io/ulid/" + topics = ("ulid", "header-only") + package_type = "header-library" + 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) + + # Copy all files to the package folder + def package(self): + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + copy( + self, + "*.hh", + os.path.join(self.source_folder, "src"), + os.path.join(self.package_folder, "include"), + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/suyash-ulid/all/test_package/CMakeLists.txt b/recipes/suyash-ulid/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..16ec5b9fe9802 --- /dev/null +++ b/recipes/suyash-ulid/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(suyash-ulid REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE suyash-ulid::suyash-ulid) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/suyash-ulid/all/test_package/conanfile.py b/recipes/suyash-ulid/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/suyash-ulid/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/suyash-ulid/all/test_package/test_package.cpp b/recipes/suyash-ulid/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..c6c6528f85a1f --- /dev/null +++ b/recipes/suyash-ulid/all/test_package/test_package.cpp @@ -0,0 +1,11 @@ +#include + +#include "ulid.hh" + +int main(void) { + ulid::ULID ulid = ulid::Create(1484581420, []() { return 4; }); + std::string str = ulid::Marshal(ulid); + std::cout << str << '\n'; // 0001C7STHC0G2081040G208104 + + return EXIT_SUCCESS; +} diff --git a/recipes/suyash-ulid/config.yml b/recipes/suyash-ulid/config.yml new file mode 100644 index 0000000000000..3d9ceb6ab28c0 --- /dev/null +++ b/recipes/suyash-ulid/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20201213": + folder: all diff --git a/recipes/svector/all/conandata.yml b/recipes/svector/all/conandata.yml index 876425a447ec4..0a0746084cf0e 100644 --- a/recipes/svector/all/conandata.yml +++ b/recipes/svector/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.0.3": + url: "https://github.com/martinus/svector/archive/v1.0.3.tar.gz" + sha256: "40d597f5d8ade27059bef49012f23f2147c1a7dfbcd45492bb1057620c434b4f" "1.0.2": url: "https://github.com/martinus/svector/archive/refs/tags/v1.0.2.tar.gz" sha256: "317743113aff89c7c11682ad7ed504a043885be7497f791cb393ba5a7a8d3c41" diff --git a/recipes/svector/config.yml b/recipes/svector/config.yml index 8457ca9a4a8cd..f625d5d2b747f 100644 --- a/recipes/svector/config.yml +++ b/recipes/svector/config.yml @@ -1,3 +1,5 @@ versions: + "1.0.3": + folder: all "1.0.2": folder: all diff --git a/recipes/svgpp/all/conandata.yml b/recipes/svgpp/all/conandata.yml new file mode 100644 index 0000000000000..46ed1662b848f --- /dev/null +++ b/recipes/svgpp/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "1.3.1": + url: "https://github.com/svgpp/svgpp/archive/refs/tags/v1.3.1.tar.gz" + sha256: "be8a89df72d01cf062cc9815dd64c9576b4d20910d6d7aee7f0ea26484dc5e76" + "cci.20221030": + url: "https://github.com/svgpp/svgpp/archive/1583a7b209038bfd0d98c6ce7d4c93986f7b235e.tar.gz" + sha256: "95f4145c43aada913e7b24e37d20d0eef5f170a7c70e00ffcb318a3910b43ca6" diff --git a/recipes/svgpp/all/conanfile.py b/recipes/svgpp/all/conanfile.py new file mode 100644 index 0000000000000..f683b8d50fc0b --- /dev/null +++ b/recipes/svgpp/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 +from conan.tools.layout import basic_layout +import os + + +required_conan_version = ">=1.52.0" + + +class SvgPPConan(ConanFile): + name = "svgpp" + description = "SVG++ library contains parsers for various SVG syntaxes, " \ + "adapters that simplify handling of parsed data and a lot of other utilities and helpers for the most common tasks." + license = "BSL-1.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/svgpp/svgpp" + topics = ("svgpp", "svg", "parser", "header-only") + package_type = "header-library" + 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("boost/1.82.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) + + 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_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_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + self.cpp_info.requires.append("boost::headers") diff --git a/recipes/svgpp/all/test_package/CMakeLists.txt b/recipes/svgpp/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..366f84e91c306 --- /dev/null +++ b/recipes/svgpp/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(svgpp REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE svgpp::svgpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/svgpp/all/test_package/conanfile.py b/recipes/svgpp/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/svgpp/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/svgpp/all/test_package/test_package.cpp b/recipes/svgpp/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..cb8c51e57fb33 --- /dev/null +++ b/recipes/svgpp/all/test_package/test_package.cpp @@ -0,0 +1,23 @@ +#include +#include +#include + +using namespace svgpp; + +struct Context +{ + void transform_matrix(const boost::array & matrix) + { + std::copy(matrix.begin(), matrix.end(), + std::ostream_iterator(std::cout, " ")); + std::cout << "\n"; + } +}; + +int main() +{ + Context context; + value_parser::parse(tag::attribute::transform(), context, + std::string("translate(-10,-20) scale(2) rotate(45) translate(5,10)"), tag::source::attribute()); + return 0; +} diff --git a/recipes/svgpp/config.yml b/recipes/svgpp/config.yml new file mode 100644 index 0000000000000..cbf184c2b85d7 --- /dev/null +++ b/recipes/svgpp/config.yml @@ -0,0 +1,5 @@ +versions: + "1.3.1": + folder: "all" + "cci.20221030": + folder: "all" diff --git a/recipes/svgwrite/all/CMakeLists.txt b/recipes/svgwrite/all/CMakeLists.txt deleted file mode 100644 index a7a84f24be646..0000000000000 --- a/recipes/svgwrite/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(WIN32 AND BUILD_SHARED_LIBS) - -add_subdirectory("source_subfolder") diff --git a/recipes/svgwrite/all/conandata.yml b/recipes/svgwrite/all/conandata.yml index 2732ab9e3e8f7..d4fffab589e1b 100644 --- a/recipes/svgwrite/all/conandata.yml +++ b/recipes/svgwrite/all/conandata.yml @@ -1,13 +1,31 @@ sources: - "0.1.0": - url: "https://gitlab.com/dvd0101/svgwrite/-/archive/v0.1.0/svgwrite-v0.1.0.tar.gz" - sha256: "beca35ebd5f95fd8a09f6c5b612990c633fd1101e4dd4f72769d819e91ef27bb" "0.2.0": url: "https://gitlab.com/dvd0101/svgwrite/-/archive/v0.2.0/svgwrite-v0.2.0.tar.gz" sha256: "aec13438ac991b13c840488a8f7e878255bdbdf24e757aa3f75de4482eae8812" + "0.1.0": + url: "https://gitlab.com/dvd0101/svgwrite/-/archive/v0.1.0/svgwrite-v0.1.0.tar.gz" + sha256: "beca35ebd5f95fd8a09f6c5b612990c633fd1101e4dd4f72769d819e91ef27bb" patches: + "0.2.0": + - patch_file: "patches/0.2.0-0001-fix-cmake.patch" + patch_description: "remove old conan features" + patch_type: "conan" + - patch_file: "patches/0.2.0-0002-include-cstdint.patch" + patch_description: "include cstdint for gcc 13 or later" + patch_type: "portability" + - patch_file: "patches/0.1.0-0004-add-fmt-runtime.patch" + patch_description: "add fmt::runtime to non-constexpr string" + patch_type: "portability" "0.1.0": - - patch_file: "patches/0001-remove-gcc-flags.patch" - base_path: "source_subfolder" - - patch_file: "patches/0002-span-lite-ns.patch" - base_path: "source_subfolder" + - patch_file: "patches/0.1.0-0001-fix-cmake.patch" + patch_description: "remove old conan features" + patch_type: "conan" + - patch_file: "patches/0.1.0-0002-remove-gcc-flags.patch" + patch_description: "disable gcc flags" + patch_type: "portability" + - patch_file: "patches/0.1.0-0003-span-lite-ns.patch" + patch_description: "fix target name" + patch_type: "conan" + - patch_file: "patches/0.1.0-0004-add-fmt-runtime.patch" + patch_description: "add fmt::runtime to non-constexpr string" + patch_type: "portability" diff --git a/recipes/svgwrite/all/conanfile.py b/recipes/svgwrite/all/conanfile.py index bef96e5e83402..61be81d1368f4 100644 --- a/recipes/svgwrite/all/conanfile.py +++ b/recipes/svgwrite/all/conanfile.py @@ -1,79 +1,93 @@ +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.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 SvgwriteConan(ConanFile): name = "svgwrite" + description = "a streaming svg library" license = "BSL-1.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://gitlab.com/dvd0101/svgwrite" - description = "SVGWrite - a streaming svg library" - topics = ("svg", "stream", "vector", "image") - settings = "os", "compiler", "build_type", "arch" - options = {"shared": [True, False], "fPIC": [True, False]} - default_options = {"shared": False, "fPIC": True} - exports_sources = ("CMakeLists.txt", "patches/*") - requires = "span-lite/0.7.0", "fmt/6.1.2" - generators = "cmake", "cmake_find_package" - _cmake = None + topics = ("svg", "writer", "stream", "vector", "image") + 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" + def _min_cppstd(self): + return 17 @property - def _build_subfolder(self): - return "build_subfolder" + def _compilers_minimum_version(self): + return { + "gcc": "7", + "clang": "7", + "apple-clang": "10", + "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): - compiler = str(self.settings.compiler) - compiler_version = tools.Version(self.settings.compiler.version) + if self.options.shared: + 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") - minimal_version = { - "Visual Studio": "16", - "gcc": "7.3", - "clang": "6", - "apple-clang": "10.0" - } + def requirements(self): + self.requires("span-lite/0.10.3", transitive_headers=True) + self.requires("fmt/10.2.0") - if compiler not in minimal_version: - self.output.warn("{} recipe lacks information about the {} compiler" - " standard version support".format(self.name, compiler)) - elif compiler_version < minimal_version.get(compiler): - raise ConanInvalidConfiguration("%s requires a compiler that supports" - " at least C++17. %s %s is not" - " supported." % (self.name, compiler, compiler_version)) + 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." + ) def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_folder = self.name + "-v" + 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(build_folder=self._build_subfolder) - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = 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("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")) def package_info(self): self.cpp_info.libs = ["svgwrite"] diff --git a/recipes/svgwrite/all/patches/0.1.0-0001-fix-cmake.patch b/recipes/svgwrite/all/patches/0.1.0-0001-fix-cmake.patch new file mode 100644 index 0000000000000..1576eca80f5fc --- /dev/null +++ b/recipes/svgwrite/all/patches/0.1.0-0001-fix-cmake.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index d70de08..df997b1 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -9,7 +9,7 @@ else() + set(BUILD_THIS_PROJECT False) + endif() + +-if(BUILD_THIS_PROJECT) ++if(0) + include(${CMAKE_BINARY_DIR}/conan_paths.cmake) + + include(CTest) diff --git a/recipes/svgwrite/all/patches/0001-remove-gcc-flags.patch b/recipes/svgwrite/all/patches/0.1.0-0002-remove-gcc-flags.patch similarity index 100% rename from recipes/svgwrite/all/patches/0001-remove-gcc-flags.patch rename to recipes/svgwrite/all/patches/0.1.0-0002-remove-gcc-flags.patch diff --git a/recipes/svgwrite/all/patches/0002-span-lite-ns.patch b/recipes/svgwrite/all/patches/0.1.0-0003-span-lite-ns.patch similarity index 100% rename from recipes/svgwrite/all/patches/0002-span-lite-ns.patch rename to recipes/svgwrite/all/patches/0.1.0-0003-span-lite-ns.patch diff --git a/recipes/svgwrite/all/patches/0.1.0-0004-add-fmt-runtime.patch b/recipes/svgwrite/all/patches/0.1.0-0004-add-fmt-runtime.patch new file mode 100644 index 0000000000000..dd055f311c058 --- /dev/null +++ b/recipes/svgwrite/all/patches/0.1.0-0004-add-fmt-runtime.patch @@ -0,0 +1,13 @@ +diff --git a/src/writer.cpp b/src/writer.cpp +index 81da66e..cd2419b 100644 +--- a/src/writer.cpp ++++ b/src/writer.cpp +@@ -56,7 +56,7 @@ namespace svgw::v1 { + template + void print(std::ostream& os, std::vector& buffer, std::string_view format_str, Args&&... args) { + buffer.clear(); +- fmt::format_to(std::back_inserter(buffer), format_str, args...); ++ fmt::format_to(std::back_inserter(buffer), fmt::runtime(format_str), args...); + buffer.push_back(0); + os << buffer.data(); + } diff --git a/recipes/svgwrite/all/patches/0.2.0-0001-fix-cmake.patch b/recipes/svgwrite/all/patches/0.2.0-0001-fix-cmake.patch new file mode 100644 index 0000000000000..c47884c595ab0 --- /dev/null +++ b/recipes/svgwrite/all/patches/0.2.0-0001-fix-cmake.patch @@ -0,0 +1,18 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 4467941..0212c5a 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -6,13 +6,6 @@ option(SVGWRITE_BUILD_DOC "Build svgwrite documentation") + option(SVGWRITE_BUILD_EXAMPLES "Build svgwrite examples") + + if(SVGWRITE_BUILD_LIB) +- if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) +- include(${CMAKE_BINARY_DIR}/conan_paths.cmake) +- +- include(CTest) +- enable_testing() +- endif() +- + add_subdirectory(src) + + if(SVGWRITE_BUILD_EXAMPLES) diff --git a/recipes/svgwrite/all/patches/0.2.0-0002-include-cstdint.patch b/recipes/svgwrite/all/patches/0.2.0-0002-include-cstdint.patch new file mode 100644 index 0000000000000..a24c4a3a8233e --- /dev/null +++ b/recipes/svgwrite/all/patches/0.2.0-0002-include-cstdint.patch @@ -0,0 +1,19 @@ +diff --git a/include/svgwrite/writer.hpp b/include/svgwrite/writer.hpp +index d97bc96..711d453 100644 +--- a/include/svgwrite/writer.hpp ++++ b/include/svgwrite/writer.hpp +@@ -4,6 +4,7 @@ + #include + #include + #include ++#include + + /** + * The svgw namespace +@@ -255,4 +256,4 @@ namespace svgw { + std::ostream* os; + }; + } +-} +\ No newline at end of file ++} diff --git a/recipes/svgwrite/all/test_package/CMakeLists.txt b/recipes/svgwrite/all/test_package/CMakeLists.txt index 5f358b17c3b77..682e5fb4ea0e1 100644 --- a/recipes/svgwrite/all/test_package/CMakeLists.txt +++ b/recipes/svgwrite/all/test_package/CMakeLists.txt @@ -1,9 +1,9 @@ -cmake_minimum_required(VERSION 3.1) -project(PackageTest CXX) +cmake_minimum_required(VERSION 3.15) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +project(test_package LANGUAGES CXX) -add_executable(example example.cpp) -target_link_libraries(example ${CONAN_LIBS}) -set_property(TARGET example PROPERTY CXX_STANDARD 17) +find_package(svgwrite REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE svgwrite::svgwrite) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/svgwrite/all/test_package/conanfile.py b/recipes/svgwrite/all/test_package/conanfile.py index 4ead2ad43af38..ef5d7042163ec 100644 --- a/recipes/svgwrite/all/test_package/conanfile.py +++ b/recipes/svgwrite/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 SvgwriteTestConan(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,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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/svgwrite/all/test_package/example.cpp b/recipes/svgwrite/all/test_package/test_package.cpp similarity index 100% rename from recipes/svgwrite/all/test_package/example.cpp rename to recipes/svgwrite/all/test_package/test_package.cpp diff --git a/recipes/svgwrite/config.yml b/recipes/svgwrite/config.yml index f97c9e447ad07..fc6f796e2eea9 100644 --- a/recipes/svgwrite/config.yml +++ b/recipes/svgwrite/config.yml @@ -1,5 +1,5 @@ versions: - "0.1.0": - folder: all "0.2.0": folder: all + "0.1.0": + folder: all diff --git a/recipes/svtjpegxs/all/conandata.yml b/recipes/svtjpegxs/all/conandata.yml new file mode 100644 index 0000000000000..d22e8967fad5f --- /dev/null +++ b/recipes/svtjpegxs/all/conandata.yml @@ -0,0 +1,9 @@ +sources: + "0.9.0": + url: "https://github.com/OpenVisualCloud/SVT-JPEG-XS/archive/refs/tags/v0.9.0.tar.gz" + sha256: "ff5dfb3b98348a39049da4fd3062d3391cbadec4c4b61825a9f3435ca671effa" +patches: + "0.9.0": + - patch_file: "patches/0.9.0-0001-manage-fpic.patch" + patch_type: "conan" + patch_description: "Let Conan configure fPIC" diff --git a/recipes/svtjpegxs/all/conanfile.py b/recipes/svtjpegxs/all/conanfile.py new file mode 100644 index 0000000000000..2f024fb63798b --- /dev/null +++ b/recipes/svtjpegxs/all/conanfile.py @@ -0,0 +1,84 @@ +import os +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import cmake_layout, CMakeToolchain, CMake +from conan.tools.files import copy, get, rmdir, apply_conandata_patches, export_conandata_patches +from conan.tools.microsoft import is_msvc + +required_conan_version = ">=2.0.9" + + +class SvtJpegXsConan(ConanFile): + name = "svtjpegxs" + description = "A JPEG XS (ISO/IEC 21122) compatible software encoder/decoder library" + license = "BSD-2-Clause-Patent" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/OpenVisualCloud/SVT-JPEG-XS" + topics = ("jpegxs", "codec", "encoder", "decoder", "image", "video") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + implements = ["auto_shared_fpic"] + + def export_sources(self): + export_conandata_patches(self) + + 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 build_requirements(self): + self.tool_requires("yasm/1.3.0") + + def validate(self): + if self.settings.arch not in ["x86", "x86_64"]: + # INFO: The upstream mention about only supporting x86, SSE and AVX + # https://github.com/OpenVisualCloud/SVT-JPEG-XS/tree/v0.9.0?tab=readme-ov-file#environment-and-requirements + raise ConanInvalidConfiguration(f"{self.ref} does not support {self.settings.arch}. Only x86 and x86_64 are supported.") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + apply_conandata_patches(self) + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["BUILD_APPS"] = False + if self.settings.os != "Windows": + # INFO: The upstream use OBJECT library for shared library. CMake does not pass -fPIC to OBJECT library + tc.variables["CMAKE_POSITION_INDEPENDENT_CODE"] = self.options.get_safe("fPIC", True) + tc.generate() + + def build(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")) + cmake = CMake(self) + cmake.configure() + cmake.install() + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + + def package_info(self): + self.cpp_info.libs = ["SvtJpegxs"] + self.cpp_info.set_property("pkg_config_name", "SvtJpegxs") + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs = ["m", "pthread"] + + if is_msvc(self) and self.options.shared: + self.cpp_info.bindirs = ["lib"] + self.cpp_info.defines.append("DEF_DLL") diff --git a/recipes/svtjpegxs/all/patches/0.9.0-0001-manage-fpic.patch b/recipes/svtjpegxs/all/patches/0.9.0-0001-manage-fpic.patch new file mode 100644 index 0000000000000..a0d3589cc7639 --- /dev/null +++ b/recipes/svtjpegxs/all/patches/0.9.0-0001-manage-fpic.patch @@ -0,0 +1,40 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index e7cdc8d..6039b5c 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -88,7 +88,6 @@ else() + set_property(CACHE SANITIZER PROPERTY STRINGS Address Memory Thread Undefined Integer) + endif() + +-set(CMAKE_POSITION_INDEPENDENT_CODE ON) + set(CMAKE_C_STANDARD 99) + set(CMAKE_CXX_STANDARD 11) + +@@ -120,7 +119,6 @@ if(UNIX) + endif() + + # Always build with -fPIC +-set(CMAKE_POSITION_INDEPENDENT_CODE ON) + + function(check_flag lang flag) + string(REGEX REPLACE "[^A-Za-z0-9]" "_" flag_var "${flag}") +diff --git a/third_party/cpuinfo/CMakeLists.txt b/third_party/cpuinfo/CMakeLists.txt +index c994d47..7ca34bc 100644 +--- a/third_party/cpuinfo/CMakeLists.txt ++++ b/third_party/cpuinfo/CMakeLists.txt +@@ -112,7 +112,6 @@ CPUINFO_TARGET_ENABLE_C99(cpuinfo) + + INCLUDE_DIRECTORIES(deps/clog/include) + +-SET_PROPERTY(TARGET cpuinfo PROPERTY POSITION_INDEPENDENT_CODE ON) + + CPUINFO_TARGET_RUNTIME_LIBRARY(cpuinfo) + IF(CMAKE_SYSTEM_NAME MATCHES "^(Windows|CYGWIN|MSYS)$") +@@ -160,7 +159,6 @@ IF(NOT TARGET clog) + ADD_SUBDIRECTORY( + "${CLOG_SOURCE_DIR}") + # We build static version of clog but a dynamic library may indirectly depend on it +- SET_PROPERTY(TARGET clog PROPERTY POSITION_INDEPENDENT_CODE ON) + ENDIF() + + ADD_LIBRARY(cpuinfo_public INTERFACE) diff --git a/recipes/svtjpegxs/all/test_package/CMakeLists.txt b/recipes/svtjpegxs/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..7e22587af3e7c --- /dev/null +++ b/recipes/svtjpegxs/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(svtjpegxs REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE svtjpegxs::svtjpegxs) diff --git a/recipes/svtjpegxs/all/test_package/conanfile.py b/recipes/svtjpegxs/all/test_package/conanfile.py new file mode 100644 index 0000000000000..01276b37d172f --- /dev/null +++ b/recipes/svtjpegxs/all/test_package/conanfile.py @@ -0,0 +1,25 @@ +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" + + 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/svtjpegxs/all/test_package/test_package.cpp b/recipes/svtjpegxs/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..7660d632cd305 --- /dev/null +++ b/recipes/svtjpegxs/all/test_package/test_package.cpp @@ -0,0 +1,10 @@ +#include + +#include "svt-jpegxs/SvtJpegxs.h" +#include "svt-jpegxs/SvtJpegxsImageBufferTools.h" + +int main() +{ + svt_jpeg_xs_frame_pool_free(nullptr); + return EXIT_SUCCESS; +} diff --git a/recipes/svtjpegxs/config.yml b/recipes/svtjpegxs/config.yml new file mode 100644 index 0000000000000..7dbf8a1dbf4a8 --- /dev/null +++ b/recipes/svtjpegxs/config.yml @@ -0,0 +1,3 @@ +versions: + "0.9.0": + folder: all diff --git a/recipes/swig/all/cmake/conan-official-swig-targets.cmake b/recipes/swig/all/cmake/conan-official-swig-targets.cmake deleted file mode 100644 index 8740b23580975..0000000000000 --- a/recipes/swig/all/cmake/conan-official-swig-targets.cmake +++ /dev/null @@ -1,7 +0,0 @@ -find_program(SWIG_EXECUTABLE swig) -if(NOT SWIG_DIR) - execute_process(COMMAND ${SWIG_EXECUTABLE} -swiglib - OUTPUT_VARIABLE SWIG_lib_output OUTPUT_STRIP_TRAILING_WHITESPACE) - set(SWIG_DIR ${SWIG_lib_output} CACHE STRING "Location of SWIG library" FORCE) -endif() -mark_as_advanced(SWIG_DIR SWIG_EXECUTABLE) diff --git a/recipes/swig/all/cmake/conan-swig-variables.cmake b/recipes/swig/all/cmake/conan-swig-variables.cmake new file mode 100644 index 0000000000000..3421127d0076f --- /dev/null +++ b/recipes/swig/all/cmake/conan-swig-variables.cmake @@ -0,0 +1,3 @@ +find_program(SWIG_EXECUTABLE swig) +# CMakeDeps sets SWIG_DIR to the generators folder, override it to the correct value +get_filename_component(SWIG_DIR "${SWIG_EXECUTABLE}/../swiglib" ABSOLUTE) diff --git a/recipes/swig/all/conandata.yml b/recipes/swig/all/conandata.yml index 7c4f531b134a3..dbb625e2ee27c 100644 --- a/recipes/swig/all/conandata.yml +++ b/recipes/swig/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "4.2.1": + url: "https://github.com/swig/swig/archive/refs/tags/v4.2.1.tar.gz" + sha256: "8895878b9215612e73611203dc8f5232c626e4d07ffc4532922f375518f067ca" + "4.1.1": + url: "https://github.com/swig/swig/archive/refs/tags/v4.1.1.tar.gz" + sha256: "4d97f9528dda8ced8b762e405dff2da38cc4603ef5f868f7287c94872f693265" "4.1.0": url: "https://github.com/swig/swig/archive/refs/tags/v4.1.0.tar.gz" sha256: "5b9313b1af5edfcea158a389520be266f013bc9be4ce933d79a30c5659ba99fe" @@ -9,18 +15,38 @@ sources: url: "https://github.com/swig/swig/archive/rel-4.0.1.tar.gz" sha256: "2eaf6fb89d071d1be280bf995c63360b3729860c0da64948123b5d7e4cfb6cb7" patches: + "4.2.1": + - patch_file: "patches/0001-4.2.1-swig-linux-library-path.patch" + patch_type: "portability" + patch_description: "swig -swiglib should return the correct path next to the binary even when relocated" + - patch_file: "patches/0002-4.2.1-do-not-define-SWIG_LIB_WIN_UNIX.patch" + patch_type: "portability" + patch_description: "swig -swiglib should return the correct path next to the binary even when relocated" + "4.1.1": + - patch_file: "patches/0001-4.1.0-swig-linux-library-path.patch" + patch_type: "portability" + patch_description: "swig -swiglib should return the correct path next to the binary even when relocated" + - patch_file: "patches/0002-4.1.0-do-not-define-SWIG_LIB_WIN_UNIX.patch" + patch_type: "portability" + patch_description: "swig -swiglib should return the correct path next to the binary even when relocated" "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" + - patch_file: "patches/0001-4.1.0-swig-linux-library-path.patch" + patch_type: "portability" + patch_description: "swig -swiglib should return the correct path next to the binary even when relocated" + - patch_file: "patches/0002-4.1.0-do-not-define-SWIG_LIB_WIN_UNIX.patch" + patch_type: "portability" + patch_description: "swig -swiglib should return the correct path next to the binary even when relocated" "4.0.2": - - base_path: "source_subfolder" - patch_file: "patches/0001-swig-linux-library-path.patch" - - base_path: "source_subfolder" - patch_file: "patches/0002-4.0.2-do-not-define-SWIG_LIB_WIN_UNIX.patch" + - patch_file: "patches/0001-swig-linux-library-path.patch" + patch_type: "portability" + patch_description: "swig -swiglib should return the correct path next to the binary even when relocated" + - patch_file: "patches/0002-4.0.2-do-not-define-SWIG_LIB_WIN_UNIX.patch" + patch_type: "portability" + patch_description: "swig -swiglib should return the correct path next to the binary even when relocated" "4.0.1": - - base_path: "source_subfolder" - patch_file: "patches/0001-swig-linux-library-path.patch" - - base_path: "source_subfolder" - patch_file: "patches/0002-4.0.1-do-not-define-SWIG_LIB_WIN_UNIX.patch" + - patch_file: "patches/0001-swig-linux-library-path.patch" + patch_type: "portability" + patch_description: "swig -swiglib should return the correct path next to the binary even when relocated" + - patch_file: "patches/0002-4.0.1-do-not-define-SWIG_LIB_WIN_UNIX.patch" + patch_type: "portability" + patch_description: "swig -swiglib should return the correct path next to the binary even when relocated" diff --git a/recipes/swig/all/conanfile.py b/recipes/swig/all/conanfile.py index 432bfb37aeca5..fc0ddef14c147 100644 --- a/recipes/swig/all/conanfile.py +++ b/recipes/swig/all/conanfile.py @@ -1,170 +1,199 @@ -from conan import ConanFile -from conan.tools.files import get -from conans import AutoToolsBuildEnvironment, tools -import contextlib -import functools import os -required_conan_version = ">=1.33.0" +from conan import ConanFile +from conan.tools.apple import is_apple_os, to_apple_arch +from conan.tools.env import VirtualBuildEnv, Environment +from conan.tools.files import apply_conandata_patches, chdir, copy, export_conandata_patches, get, rmdir, replace_in_file +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 SwigConan(ConanFile): name = "swig" description = "SWIG is a software development tool that connects programs written in C and C++ with a variety of high-level programming languages." + license = "GPL-3.0-or-later" url = "https://github.com/conan-io/conan-center-index" homepage = "http://www.swig.org" - license = "GPL-3.0-or-later" - topics = ("swig", "python", "java", "wrapper") - exports_sources = "patches/**", "cmake/*" - settings = "os", "arch", "compiler", "build_type" + topics = ("python", "java", "wrapper") - @property - def _source_subfolder(self): - return "source_subfolder" + package_type = "static-library" + settings = "os", "arch", "compiler", "build_type" @property def _settings_build(self): return getattr(self, "settings_build", self.settings) + def configure(self): + # SWIG prefers static linking + self.options["pcre"].shared = False + self.options["pcre2"].shared = False + self.options["libgettext"].shared = False + + def export_sources(self): + copy(self, "cmake/*", src=self.recipe_folder, dst=self.export_sources_folder) + export_conandata_patches(self) + + def layout(self): + basic_layout(self, src_folder="src") + @property def _use_pcre2(self): - return self.version not in ['4.0.1', '4.0.2'] - + return Version(self.version) >= "4.1" def requirements(self): if self._use_pcre2: - self.requires("pcre2/10.40") + self.requires("pcre2/10.43") else: self.requires("pcre/8.45") - - 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("winflexbison/2.5.24") - else: - self.build_requires("bison/3.8.2") - self.build_requires("automake/1.16.5") + if is_apple_os(self): + self.requires("libgettext/0.22") def package_id(self): del self.info.settings.compiler - def source(self): - get(self, **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", self.deps_user_info) - - @contextlib.contextmanager - def _build_context(self): - env = {} - if self.settings.compiler != "Visual Studio": - env["YACC"] = self._user_info_build["bison"].YACC - if self.settings.compiler == "Visual Studio": - with tools.vcvars(self): - env.update({ - "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)), - "AR": "{} link".format(self._user_info_build["automake"].ar_lib), - "LD": "link", - }) - with tools.environment_append(env): - yield + 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") + if is_msvc(self): + self.tool_requires("cccl/1.3") + if Version(self.version) >= "4.2": + if is_msvc(self): + # bison 3.8.2 is not ready for msvc + self.tool_requires("bison/3.7.6") + else: + self.tool_requires("bison/3.8.2") else: - with tools.environment_append(env): - yield - - @functools.lru_cache(1) - def _configure_autotools(self): - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - deps_libpaths = autotools.library_paths - deps_libs = autotools.libs - deps_defines = autotools.defines - if self.settings.os == "Windows" and self.settings.compiler != "Visual Studio": - autotools.link_flags.append("-static") - - libargs = list("-L\"{}\"".format(p) for p in deps_libpaths) + list("-l\"{}\"".format(l) for l in deps_libs) - args = [ - "{}_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.os == "Linux": - args.append("LIBS=-ldl") - - host, build = None, None + if is_msvc(self): + self.tool_requires("winflexbison/2.5.25") + else: + self.tool_requires("bison/3.8.2") + self.tool_requires("automake/1.16.5") - if self.settings.compiler == "Visual Studio": - self.output.warn("Visual Studio compiler cannot create ccache-swig. Disabling ccache-swig.") - args.append("--disable-ccache") - autotools.flags.append("-FS") - # MSVC canonical names aren't understood - host, build = False, False - - if self.settings.os == "Macos" and self.settings.arch == "armv8": - # FIXME: Apple ARM should be handled by build helpers - autotools.flags.append("-arch arm64") - autotools.link_flags.append("-arch arm64") + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) - autotools.libs = [] - autotools.library_paths = [] + def generate(self): + build_env = VirtualBuildEnv(self) + build_env.generate() - if self.settings.os == "Windows" and self.settings.compiler != "Visual Studio": - autotools.libs.extend(["mingwex", "ssp"]) + tc = AutotoolsToolchain(self) + env = tc.environment() - autotools.configure(args=args, configure_dir=self._source_subfolder, - host=host, build=build) - return autotools + pcre = "pcre2" if self._use_pcre2 else "pcre" + tc.configure_args += [ + f"--host={self.settings.arch}", + "--with-swiglibdir=${prefix}/bin/swiglib", + f"--with-{pcre}-prefix={self.dependencies[pcre].package_folder}", + ] + tc.extra_cflags.append("-DHAVE_PCRE=1") + if self._use_pcre2: + env.define("PCRE2_LIBS", " ".join("-l" + lib for lib in self.dependencies["pcre2"].cpp_info.libs)) + + if self.settings.os in ["Linux", "FreeBSD"]: + tc.configure_args.append("LIBS=-ldl") + tc.extra_defines.append("HAVE_UNISTD_H=1") + elif self.settings.os == "Windows": + if is_msvc(self): + env.define("CC", "cccl -FS") + env.define("CXX", "cccl -FS") + tc.configure_args.append("--disable-ccache") + else: + tc.extra_ldflags.append("-static") + tc.configure_args.append("LIBS=-lmingwex -lssp") + elif is_apple_os(self): + tc.extra_cflags.append(f"-arch {to_apple_arch(self)}") + tc.extra_cxxflags.append(f"-arch {to_apple_arch(self)}") + tc.extra_ldflags.append(f"-arch {to_apple_arch(self)}") + 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 _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) + # Rely on AutotoolsDeps instead of pcre2-config + # https://github.com/swig/swig/blob/v4.1.1/configure.ac#L70-L92 + # https://github.com/swig/swig/blob/v4.0.2/configure.ac#L65-L86 + replace_in_file(self, os.path.join(self.source_folder, "configure.ac"), + 'AS_IF([test "x$with_pcre" != xno],', 'AS_IF([false],') def build(self): self._patch_sources() - with tools.chdir(os.path.join(self._source_subfolder)): - self.run("./autogen.sh", win_bash=tools.os_info.is_windows) - with self._build_context(): - autotools = self._configure_autotools() + with chdir(self, self.source_folder): + autotools = Autotools(self) + self.run("./autogen.sh") + autotools.configure() autotools.make() def package(self): - self.copy(pattern="LICENSE*", dst="licenses", src=self._source_subfolder) - self.copy(pattern="COPYRIGHT", dst="licenses", src=self._source_subfolder) - self.copy("*", src="cmake", dst=self._module_subfolder) - with self._build_context(): - autotools = self._configure_autotools() + copy(self, "LICENSE*", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, "COPYRIGHT", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, "*.cmake", + dst=os.path.join(self.package_folder, self._module_subfolder), + src=os.path.join(self.export_sources_folder, "cmake")) + with chdir(self, self.source_folder): + autotools = Autotools(self) autotools.install() - - @property - def _swiglibdir(self): - return os.path.join(self.package_folder, "bin", "swiglib").replace("\\", "/") + for path in self.package_path.iterdir(): + if path.is_dir() and path.name not in ["bin", "lib", "licenses"]: + rmdir(self, path) @property def _module_subfolder(self): return os.path.join("lib", "cmake") @property - def _module_file(self): - return "conan-official-{}-targets.cmake".format(self.name) + def _cmake_module_rel_path(self): + return os.path.join(self._module_subfolder, "conan-swig-variables.cmake") def package_info(self): - self.cpp_info.includedirs=[] + self.cpp_info.includedirs = [] + self.cpp_info.set_property("cmake_file_name", "SWIG") + self.cpp_info.set_property("cmake_target_name", "SWIG::SWIG") + self.cpp_info.set_property("cmake_build_modules", [self._cmake_module_rel_path]) + + self.buildenv_info.define_path("SWIG_LIB", os.path.join(self.package_folder, "bin", "swiglib")) + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.names["cmake_find_package"] = "SWIG" self.cpp_info.names["cmake_find_package_multi"] = "SWIG" - self.cpp_info.builddirs = [self._module_subfolder] - self.cpp_info.build_modules["cmake_find_package"] = \ - [os.path.join(self._module_subfolder, self._module_file)] - self.cpp_info.build_modules["cmake_find_package_multi"] = \ - [os.path.join(self._module_subfolder, self._module_file)] + self.cpp_info.build_modules["cmake_find_package"] = [self._cmake_module_rel_path] + self.cpp_info.build_modules["cmake_find_package_multi"] = [self._cmake_module_rel_path] 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.SWIG_LIB = os.path.join(self.package_folder, "bin", "swiglib") diff --git a/recipes/swig/all/patches/0001-4.2.1-swig-linux-library-path.patch b/recipes/swig/all/patches/0001-4.2.1-swig-linux-library-path.patch new file mode 100644 index 0000000000000..f3c40eb7eab79 --- /dev/null +++ b/recipes/swig/all/patches/0001-4.2.1-swig-linux-library-path.patch @@ -0,0 +1,51 @@ +--- Source/Modules/main.cxx ++++ Source/Modules/main.cxx +@@ -861,6 +861,32 @@ + + 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; + +@@ -900,12 +926,14 @@ + 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.2.1-do-not-define-SWIG_LIB_WIN_UNIX.patch b/recipes/swig/all/patches/0002-4.2.1-do-not-define-SWIG_LIB_WIN_UNIX.patch new file mode 100644 index 0000000000000..a58da257a1aef --- /dev/null +++ b/recipes/swig/all/patches/0002-4.2.1-do-not-define-SWIG_LIB_WIN_UNIX.patch @@ -0,0 +1,11 @@ +--- configure.ac ++++ configure.ac +@@ -2803,7 +2803,7 @@ + *-*-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/all/test_package/CMakeLists.txt b/recipes/swig/all/test_package/CMakeLists.txt index 3f3a1aa9d1821..767943c116cee 100644 --- a/recipes/swig/all/test_package/CMakeLists.txt +++ b/recipes/swig/all/test_package/CMakeLists.txt @@ -1,51 +1,20 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(PackageTest C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS NO_OUTPUT_DIRS) - -set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY $<1:${CMAKE_BINARY_DIR}>) -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY $<1:${CMAKE_BINARY_DIR}>) -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY $<1:${CMAKE_BINARY_DIR}>) - -find_package(SWIG REQUIRED) +find_package(SWIG REQUIRED CONFIG) include(UseSWIG) -set(Python_ADDITIONAL_VERSIONS 3) -find_package(PythonInterp) -find_package(PythonLibs 3) - -enable_testing() - -if(PYTHONINTERP_FOUND AND PYTHONLIBS_FOUND) - swig_add_library(${PROJECT_NAME} - LANGUAGE python - SOURCES - test.i - test_package.c - ) - - get_filename_component(PYTHON_LIBRARY_DIR "${PYTHON_LIBRARIES}" DIRECTORY) - - message(STATUS "PYTHON_INCLUDE_DIRS: ${PYTHON_INCLUDE_DIRS}") - message(STATUS "PYTHON_LIBRARIES: ${PYTHON_LIBRARIES}") - message(STATUS "PYTHON_LIBRARY_DIR: ${PYTHON_LIBRARY_DIR}") +find_package(Python REQUIRED COMPONENTS Interpreter Development) - #target_compile_definitions(_${PROJECT_NAME} PRIVATE MS_NO_COREDLL) - target_include_directories(_${PROJECT_NAME} PRIVATE ${PYTHON_INCLUDE_DIRS}) - target_link_directories(_${PROJECT_NAME} PRIVATE ${PYTHON_LIBRARY_DIR}) - target_link_libraries(_${PROJECT_NAME} PRIVATE ${PYTHON_LIBRARIES}) +swig_add_library(${PROJECT_NAME} + LANGUAGE python + SOURCES test.i test_package.c + OUTPUT_DIR ${CMAKE_BINARY_DIR} +) +target_link_libraries(${PROJECT_NAME} PRIVATE Python::Python) - add_test( - NAME gcd_test - COMMAND ${PYTHON_EXECUTABLE} -c "import PackageTest; assert PackageTest.gcd(12, 16) == 4" - WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" - ) - add_test( - NAME foo_test - COMMAND ${PYTHON_EXECUTABLE} -c "import PackageTest; assert PackageTest.cvar.foo == 3.14159265359" - WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" - ) -else() - message(STATUS "Not building swig python module") -endif() +# Note: this does not copy the generated *.py file +install(TARGETS ${PROJECT_NAME} + LIBRARY DESTINATION ${CMAKE_BINARY_DIR} + RUNTIME DESTINATION ${CMAKE_BINARY_DIR} +) diff --git a/recipes/swig/all/test_package/conanfile.py b/recipes/swig/all/test_package/conanfile.py index 5059612e70e16..f305f9b713d22 100644 --- a/recipes/swig/all/test_package/conanfile.py +++ b/recipes/swig/all/test_package/conanfile.py @@ -1,27 +1,73 @@ -from conans import CMake, ConanFile, tools +import importlib +import os +import sys +from pathlib import PurePath + +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake, CMakeToolchain, CMakeDeps +from conan.tools.env import VirtualRunEnv +from conan.tools.microsoft import is_msvc 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, visible=False, run=True) + + def layout(self): + cmake_layout(self) @property def _can_build(self): # FIXME: Python does not distribute debug libraries (use cci CPython recipe) - return not (self.settings.compiler == "Visual Studio" and self.settings.build_type == "Debug") + if is_msvc(self) and self.settings.build_type == "Debug": + return False + # FIXME: apple-clang fails with 'ld: library not found for -lintl' in CI, despite working ok locally + if self.settings.compiler == "apple-clang": + return False + return True + + @property + def _python_interpreter(self): + if getattr(sys, "frozen", False): + return "python" + return sys.executable + + def generate(self): + venv = VirtualRunEnv(self) + venv.generate(scope="build") + venv.generate(scope="run") + tc = CMakeToolchain(self) + tc.variables["Python_EXECUTABLE"] = PurePath(self._python_interpreter).as_posix() + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - if not tools.cross_building(self, skip_x64_x86=True): - self.run("swig -swiglib", run_environment=True) + if can_run(self): + self.run("swig -swiglib") if self._can_build: cmake = CMake(self) - cmake.verbose = True cmake.configure() cmake.build() + def _test_swig_module(self): + sys.path.append(self.build_folder) + sys.path.append(os.path.join(self.build_folder, str(self.settings.build_type))) + # Could also simply use 'import PackageTest' but this makes pylint angry + PackageTest = importlib.import_module("PackageTest") + assert PackageTest.gcd(12, 16) == 4 + self.output.info("PackageTest.gcd(12, 16) ran successfully") + assert PackageTest.cvar.foo == 3.14159265359 + self.output.info("PackageTest.cvar.foo == 3.14159265359 ran successfully") + sys.path.pop() + def test(self): - if not tools.cross_building(self): + if can_run(self): if self._can_build: - cmake = CMake(self) - cmake.test(output_on_failure=True) - self.run("swig -version", run_environment=True) + self._test_swig_module() + self.run("swig -version") + self.run("swig -swiglib") diff --git a/recipes/swig/all/test_v1_package/CMakeLists.txt b/recipes/swig/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/swig/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/swig/all/test_v1_package/conanfile.py b/recipes/swig/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..e7dbf9e47271c --- /dev/null +++ b/recipes/swig/all/test_v1_package/conanfile.py @@ -0,0 +1,53 @@ +import importlib +import sys +from pathlib import PurePath + +from conans import CMake, ConanFile, tools + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + @property + def _can_build(self): + # FIXME: Python does not distribute debug libraries (use cci CPython recipe) + if self.settings.compiler == "Visual Studio" and self.settings.build_type == "Debug": + return False + # FIXME: apple-clang fails with 'ld: library not found for -lintl' in CI, despite working ok locally + if self.settings.compiler == "apple-clang": + return False + return True + + @property + def _python_interpreter(self): + if getattr(sys, "frozen", False): + return "python" + return sys.executable + + def build(self): + if not tools.cross_building(self, skip_x64_x86=True): + self.run("swig -swiglib", run_environment=True) + if self._can_build: + cmake = CMake(self) + cmake.verbose = True + cmake.definitions["Python_EXECUTABLE"] = PurePath(self._python_interpreter).as_posix() + cmake.configure() + cmake.build() + cmake.install() + + def _test_swig_module(self): + sys.path.append(self.build_folder) + # Could also simply use 'import PackageTest' but this makes pylint angry + PackageTest = importlib.import_module("PackageTest") + assert PackageTest.gcd(12, 16) == 4 + self.output.info("PackageTest.gcd(12, 16) ran successfully") + assert PackageTest.cvar.foo == 3.14159265359 + self.output.info("PackageTest.cvar.foo == 3.14159265359 ran successfully") + sys.path.pop() + + def test(self): + if not tools.cross_building(self): + if self._can_build: + self._test_swig_module() + self.run("swig -version", run_environment=True) diff --git a/recipes/swig/config.yml b/recipes/swig/config.yml index 543f01b80f536..5a11eaadfdc07 100644 --- a/recipes/swig/config.yml +++ b/recipes/swig/config.yml @@ -1,4 +1,8 @@ versions: + "4.2.1": + folder: "all" + "4.1.1": + folder: "all" "4.1.0": folder: "all" "4.0.2": 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/conandata.yml b/recipes/symengine/all/conandata.yml index 57c2079d436f7..6cba7bfe87f6a 100644 --- a/recipes/symengine/all/conandata.yml +++ b/recipes/symengine/all/conandata.yml @@ -5,3 +5,18 @@ sources: "0.9.0": url: "https://github.com/symengine/symengine/releases/download/v0.9.0/symengine-0.9.0.tar.gz" sha256: "dcf174ac708ed2acea46691f6e78b9eb946d8a2ba62f75e87cf3bf4f0d651724" + "0.10.1": + url: "https://github.com/symengine/symengine/releases/download/v0.10.1/symengine-0.10.1.tar.gz" + sha256: "9c007c99e9633f5549a55fa7a66ebcbcf9e04092eb55f7bb781c22b9cf0570c4" + "0.11.1": + url: "https://github.com/symengine/symengine/releases/download/v0.11.1/symengine-0.11.1.tar.gz" + sha256: "217b39955dc19f920c6f54c057fdc89e8e155ddee8f0e3c3cacc67b3e3850b64" + "0.11.2": + url: "https://github.com/symengine/symengine/releases/download/v0.11.2/symengine-0.11.2.tar.gz" + sha256: "f6972acd6a65354f6414e69460d2e175729470632bdac05919bc2f7f32e48cbd" + "0.12.0": + url: "https://github.com/symengine/symengine/archive/refs/tags/v0.12.0.tar.gz" + sha256: "1b5c3b0bc6a9f187635f93585649f24a18e9c7f2167cebcd885edeaaf211d956" + "0.13.0": + url: "https://github.com/symengine/symengine/archive/refs/tags/v0.13.0.tar.gz" + sha256: "f46bcf037529cd1a422369327bf360ad4c7d2b02d0f607a62a5b09c74a55bb59" diff --git a/recipes/symengine/all/conanfile.py b/recipes/symengine/all/conanfile.py index f562e2020bf8a..270776ba7fe08 100644 --- a/recipes/symengine/all/conanfile.py +++ b/recipes/symengine/all/conanfile.py @@ -1,7 +1,21 @@ -from conans import ConanFile, CMake, tools -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, CMakeToolchain, CMakeDeps +from conan.tools.files import ( + collect_libs, + copy, + get, + rm, + rmdir, + replace_in_file, +) +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc_static_runtime +from conan.tools.scm import Version -required_conan_version = ">=1.33.0" +import os +required_conan_version = ">=2.1" class SymengineConan(ConanFile): @@ -11,9 +25,8 @@ class SymengineConan(ConanFile): topics = ("symbolic", "algebra") 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" + package_type = "library" options = { "shared": [True, False], "fPIC": [True, False], @@ -26,66 +39,104 @@ class SymengineConan(ConanFile): } short_paths = True - _cmake = None + def layout(self): + basic_layout(self, src_folder="src") - @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: + self.options.rm_safe("fPIC") + + def validate(self): + min_cppstd = "11" + check_min_cppstd(self, min_cppstd) + + if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "7": + raise ConanInvalidConfiguration(f"{self.ref} requires GCC >= 7") @property - def _build_subfolder(self): - return "build_subfolder" + def _needs_fast_float(self): + return Version(self.version) >= "0.13.0" def requirements(self): if self.options.integer_class == "boostmp": - self.requires("boost/1.79.0") + # symengine/mp_class.h:12 + self.requires("boost/1.86.0", transitive_headers=True) else: - self.requires("gmp/6.2.1") + self.requires("gmp/6.3.0", transitive_headers=True, transitive_libs=True) + if self._needs_fast_float: + self.requires("fast_float/6.1.5") 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 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"] = is_msvc_static_runtime(self) + if self._needs_fast_float: + tc.variables["WITH_SYSTEM_FASTFLOAT"] = True - def config_options(self): - if self.settings.os == "Windows": - del self.options.fPIC + tc.generate() + deps = CMakeDeps(self) + if self.options.integer_class == "gmp": + deps.set_property("gmp", "cmake_file_name", "GMP") + # If we ever add support for gmpxx, we should set this property + # if self.dependencies["gmp"].options.enable_cxx: + # deps.set_property("gmp::gmpxx", "cmake_target_name", "gmpxx") + if self._needs_fast_float: + deps.set_property("fast_float", "cmake_file_name", "FASTFLOAT") + deps.generate() - def configure(self): - if self.options.shared: - del self.options.fPIC + def _patch_sources(self): + # Disable hardcoded C++11 + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + 'set(CMAKE_CXX_FLAGS "${CXX11_OPTIONS} ${CMAKE_CXX_FLAGS}")', + '') + # Let Conan choose fPIC + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + 'set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${common}")', + '') + # cmake_target_name not working? + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "set(LIBS ${LIBS} ${GMP_TARGETS})", + "set(LIBS ${LIBS} gmp::gmp)") 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", 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") - 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" + if self.settings.os == "Linux": + self.cpp_info.system_libs.append("m") + + self.cpp_info.set_property("cmake_target_name", "symengine") diff --git a/recipes/symengine/all/test_package/CMakeLists.txt b/recipes/symengine/all/test_package/CMakeLists.txt index 62739795b7eca..db1bcb5e287ec 100644 --- a/recipes/symengine/all/test_package/CMakeLists.txt +++ b/recipes/symengine/all/test_package/CMakeLists.txt @@ -1,10 +1,8 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) 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` +target_link_libraries(${PROJECT_NAME} PRIVATE symengine) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/symengine/all/test_package/conanfile.py b/recipes/symengine/all/test_package/conanfile.py index 7e1802f4cdc24..f72d1f660e19f 100644 --- a/recipes/symengine/all/test_package/conanfile.py +++ b/recipes/symengine/all/test_package/conanfile.py @@ -1,18 +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, 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.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_package/test_package.cpp b/recipes/symengine/all/test_package/test_package.cpp index 62249dac49da7..da10361cc19de 100644 --- a/recipes/symengine/all/test_package/test_package.cpp +++ b/recipes/symengine/all/test_package/test_package.cpp @@ -2,12 +2,19 @@ #include #include #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; + std::cout << SymEngine::mp_perfect_power_p(SymEngine::integer_class("9")) << std::endl; + std::string input = "123.0"; + auto parsed_value = SymEngine::parse(input, true); + return 0; } diff --git a/recipes/symengine/config.yml b/recipes/symengine/config.yml index 5cc2c82abfc68..5536e9803e451 100644 --- a/recipes/symengine/config.yml +++ b/recipes/symengine/config.yml @@ -3,3 +3,13 @@ versions: folder: all "0.9.0": folder: all + "0.10.1": + folder: all + "0.11.1": + folder: all + "0.11.2": + folder: all + "0.12.0": + folder: all + "0.13.0": + folder: all diff --git a/recipes/systemc-cci/all/CMakeLists.txt b/recipes/systemc-cci/all/CMakeLists.txt index 747ee2684985a..5b34c9bd3214a 100644 --- a/recipes/systemc-cci/all/CMakeLists.txt +++ b/recipes/systemc-cci/all/CMakeLists.txt @@ -3,13 +3,10 @@ project(cci LANGUAGES CXX) set(LIBRARY_NAME cciapi) -include(${CMAKE_CURRENT_SOURCE_DIR}/conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - find_package(RapidJSON REQUIRED CONFIG) find_package(SystemCLanguage REQUIRED CONFIG) -set(SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder/src") +set(SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/src") set(CCI_CFG_DIR "${SOURCE_DIR}/cci_cfg") set(CCI_CORE_DIR "${SOURCE_DIR}/cci_core") set(CCI_UTILS_DIR "${SOURCE_DIR}/cci_utils") @@ -31,10 +28,11 @@ set(SOURCES add_library(${LIBRARY_NAME} ${SOURCES}) target_include_directories(${LIBRARY_NAME} PRIVATE ${SOURCE_DIR}) -target_link_libraries(${LIBRARY_NAME} PRIVATE RapidJSON::RapidJSON SystemC::SystemC) +target_link_libraries(${LIBRARY_NAME} PRIVATE rapidjson SystemC::systemc) set_target_properties(${LIBRARY_NAME} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE - VERSION ${CONAN_PACKAGE_VERSION}) + VERSION ${CONAN_PACKAGE_VERSION} + COMPILE_FEATURES cxx_std_11) target_compile_definitions(${LIBRARY_NAME} PRIVATE SC_INCLUDE_FX) install(TARGETS ${LIBRARY_NAME} diff --git a/recipes/systemc-cci/all/conandata.yml b/recipes/systemc-cci/all/conandata.yml index 6c1e792ccafa2..1c26e7784920a 100644 --- a/recipes/systemc-cci/all/conandata.yml +++ b/recipes/systemc-cci/all/conandata.yml @@ -5,8 +5,5 @@ sources: patches: "1.0.0": - patch_file: "patches/broker.patch" - base_path: "source_subfolder" - patch_file: "patches/cci_param_untyped_handle.patch" - base_path: "source_subfolder" - patch_file: "patches/cci_value_converter.patch" - base_path: "source_subfolder" diff --git a/recipes/systemc-cci/all/conanfile.py b/recipes/systemc-cci/all/conanfile.py index 57a3f498adec2..326fef01a251e 100644 --- a/recipes/systemc-cci/all/conanfile.py +++ b/recipes/systemc-cci/all/conanfile.py @@ -1,42 +1,36 @@ -from conans import tools, CMake +import os + from conan import ConanFile from conan.errors import ConanInvalidConfiguration -import functools - +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, export_conandata_patches, get -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class SystemccciConan(ConanFile): name = "systemc-cci" - description = """SystemC Configuration, Control and Inspection library""" - homepage = "https://www.accellera.org/" - url = "https://github.com/conan-io/conan-center-index" + description = "SystemC Configuration, Control and Inspection library" license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://www.accellera.org/" topics = ("simulation", "modeling", "esl", "cci") - settings = "os", "compiler", "build_type", "arch" + + 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, } - 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"]) + 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": @@ -44,36 +38,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 requirements(self): - self.requires("systemc/2.3.3") - self.requires("rapidjson/1.1.0") + self.requires("systemc/2.3.4", transitive_headers=True, transitive_libs=True) + self.requires("rapidjson/cci.20220822") def validate(self): - if self.settings.os == "Macos": - raise ConanInvalidConfiguration(f"{self.name} is not suppported on {self.settings.os}.") + if is_apple_os(self): + raise ConanInvalidConfiguration(f"{self.name} is not supported on {self.settings.os}.") 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(build_folder=self._build_subfolder) - return cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CONAN_PACKAGE_VERSION"] = self.version + tc.generate() + tc = CMakeDeps(self) + tc.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(build_script_folder=self.source_path.parent) 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, "LICENSE", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder) + copy(self, "NOTICE", + 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/systemc-cci/all/test_package/CMakeLists.txt b/recipes/systemc-cci/all/test_package/CMakeLists.txt index 062e855b87030..f489f5c553c0f 100644 --- a/recipes/systemc-cci/all/test_package/CMakeLists.txt +++ b/recipes/systemc-cci/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(systemc-cci REQUIRED CONFIG) add_executable(${PROJECT_NAME} example.cpp) diff --git a/recipes/systemc-cci/all/test_package/conanfile.py b/recipes/systemc-cci/all/test_package/conanfile.py index 189bd25a7c208..ef5d7042163ec 100644 --- a/recipes/systemc-cci/all/test_package/conanfile.py +++ b/recipes/systemc-cci/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 SystemccciTestConan(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 +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/systemc-cci/all/test_v1_package/CMakeLists.txt b/recipes/systemc-cci/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/systemc-cci/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/systemc-cci/all/test_v1_package/conanfile.py b/recipes/systemc-cci/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..189bd25a7c208 --- /dev/null +++ b/recipes/systemc-cci/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +import os + +from conans import ConanFile, CMake, tools + + +class SystemccciTestConan(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/systemc/all/CMakeLists.txt b/recipes/systemc/all/CMakeLists.txt deleted file mode 100644 index bd3083b512cb9..0000000000000 --- a/recipes/systemc/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/systemc/all/conandata.yml b/recipes/systemc/all/conandata.yml index bd45a2b685371..234032a9f92d2 100644 --- a/recipes/systemc/all/conandata.yml +++ b/recipes/systemc/all/conandata.yml @@ -2,11 +2,15 @@ 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" - base_path: "source_subfolder" - patch_file: "patches/0002-sc_string_view.patch" - 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" + - patch_file: "patches/0003-mingw.patch" + - patch_file: "patches/0004-cmake.patch" diff --git a/recipes/systemc/all/conanfile.py b/recipes/systemc/all/conanfile.py index e65862f8bd94b..a6161b53eeb5f 100644 --- a/recipes/systemc/all/conanfile.py +++ b/recipes/systemc/all/conanfile.py @@ -1,20 +1,24 @@ -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, cmake_layout +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.43.0" +required_conan_version = ">=1.53.0" class SystemcConan(ConanFile): name = "systemc" - description = """SystemC is a set of C++ classes and macros which provide - an event-driven simulation interface.""" - homepage = "https://www.accellera.org/" - url = "https://github.com/conan-io/conan-center-index" + description = ("SystemC is a set of C++ classes and macros which provide " + "an event-driven simulation interface.") license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://www.accellera.org/" topics = ("simulation", "modeling", "esl", "tlm") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -33,7 +37,7 @@ class SystemcConan(ConanFile): "fPIC": True, "disable_async_updates": False, "disable_copyright_msg": False, - "disable_virtual_bind": False, + "disable_virtual_bind": False, "enable_assertions": True, "enable_immediate_self_notifications": False, "enable_pthreads": False, @@ -41,85 +45,72 @@ class SystemcConan(ConanFile): "enable_phase_callbacks_tracing": False, } - generators = "cmake" - - @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": del self.options.fPIC - del self.options.enable_pthreads + self.options.rm_safe("enable_pthreads") 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 == "Macos": + if is_apple_os(self): raise ConanInvalidConfiguration("Macos build not supported") if self.settings.os == "Windows" and self.options.shared: - raise ConanInvalidConfiguration("Building SystemC as a shared library on Windows is currently not supported") + raise ConanInvalidConfiguration( + "Building SystemC as a shared library on Windows is currently 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], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["DISABLE_ASYNC_UPDATES"] = self.options.disable_async_updates + tc.variables["DISABLE_COPYRIGHT_MESSAGE"] = self.options.disable_copyright_msg + tc.variables["DISABLE_VIRTUAL_BIND"] = self.options.disable_virtual_bind + tc.variables["ENABLE_ASSERTIONS"] = self.options.enable_assertions + tc.variables["ENABLE_IMMEDIATE_SELF_NOTIFICATIONS"] = self.options.enable_immediate_self_notifications + tc.variables["ENABLE_PTHREADS"] = self.options.get_safe("enable_pthreads", False) + tc.variables["ENABLE_PHASE_CALLBACKS"] = self.options.get_safe("enable_phase_callbacks", False) + tc.variables["ENABLE_PHASE_CALLBACKS_TRACING"] = self.options.get_safe("enable_phase_callbacks_tracing", False) + tc.generate() - @functools.lru_cache(1) - def _configure_cmake(self): + def build(self): + apply_conandata_patches(self) cmake = CMake(self) - cmake.definitions["DISABLE_ASYNC_UPDATES"] = \ - self.options.disable_async_updates - cmake.definitions["DISABLE_COPYRIGHT_MESSAGE"] = \ - self.options.disable_copyright_msg - cmake.definitions["DISABLE_VIRTUAL_BIND"] = \ - self.options.disable_virtual_bind - cmake.definitions["ENABLE_ASSERTIONS"] = \ - self.options.enable_assertions - cmake.definitions["ENABLE_IMMEDIATE_SELF_NOTIFICATIONS"] = \ - self.options.enable_immediate_self_notifications - cmake.definitions["ENABLE_PTHREADS"] = \ - self.options.get_safe("enable_pthreads", False) - cmake.definitions["ENABLE_PHASE_CALLBACKS"] = \ - self.options.get_safe("enable_phase_callbacks", False) - cmake.definitions["ENABLE_PHASE_CALLBACKS_TRACING"] = \ - self.options.get_safe("enable_phase_callbacks_tracing", 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", dst="licenses", src=self._source_subfolder) - self.copy("NOTICE", 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) + copy(self, "NOTICE", + 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", "SystemCLanguage") self.cpp_info.set_property("cmake_target_name", "SystemC::systemc") + # TODO: back to global scope in conan v2 once cmake_find_package* generators removed self.cpp_info.components["_systemc"].libs = ["systemc"] if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.components["_systemc"].system_libs = ["pthread"] - if self._is_msvc: + self.cpp_info.components["_systemc"].system_libs = ["pthread", "m"] + if is_msvc(self): self.cpp_info.components["_systemc"].cxxflags.append("/vmg") # TODO: to remove in conan v2 once cmake_find_package* generators removed diff --git a/recipes/systemc/all/patches/0001-cmake.patch b/recipes/systemc/all/patches/0001-cmake.patch index 46f27b30da924..3598e00cb51a5 100644 --- a/recipes/systemc/all/patches/0001-cmake.patch +++ b/recipes/systemc/all/patches/0001-cmake.patch @@ -1,6 +1,6 @@ --- CMakeLists.txt +++ CMakeLists.txt -@@ -273,12 +273,12 @@ +@@ -273,12 +273,6 @@ FORCE) endif (NOT CMAKE_BUILD_TYPE) @@ -10,12 +10,6 @@ - "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, and 14.") -+#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/all/patches/0004-cmake.patch b/recipes/systemc/all/patches/0004-cmake.patch new file mode 100644 index 0000000000000..5c4004ed81fc2 --- /dev/null +++ b/recipes/systemc/all/patches/0004-cmake.patch @@ -0,0 +1,15 @@ +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -277,12 +277,6 @@ + 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) +- + if (NOT (WIN32 OR CYGWIN)) + option (BUILD_SHARED_LIBS "Build shared libraries." ON) + else (NOT (WIN32 OR CYGWIN)) diff --git a/recipes/systemc/all/test_package/CMakeLists.txt b/recipes/systemc/all/test_package/CMakeLists.txt index 5d31301bc9ee2..86a595ce48e9a 100644 --- a/recipes/systemc/all/test_package/CMakeLists.txt +++ b/recipes/systemc/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(SystemCLanguage REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/systemc/all/test_package/conanfile.py b/recipes/systemc/all/test_package/conanfile.py index 49a3a66ea5bad..ef5d7042163ec 100644 --- a/recipes/systemc/all/test_package/conanfile.py +++ b/recipes/systemc/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/systemc/all/test_v1_package/CMakeLists.txt b/recipes/systemc/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/systemc/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/systemc/all/test_v1_package/conanfile.py b/recipes/systemc/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..49a3a66ea5bad --- /dev/null +++ b/recipes/systemc/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/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/tabulate/all/conandata.yml b/recipes/tabulate/all/conandata.yml index b7efb75d88619..3b7ae6a3cb167 100644 --- a/recipes/tabulate/all/conandata.yml +++ b/recipes/tabulate/all/conandata.yml @@ -1,10 +1,13 @@ sources: - "1.0": - url: https://github.com/p-ranav/tabulate/archive/v1.0.tar.gz - sha256: 34eda3605e2ce0c7ca339fa2af6a0c77a5e49321b2f549ff5313f955273c8ac8 - "1.3": - url: https://github.com/p-ranav/tabulate/archive/v1.3.tar.gz - sha256: d1739e82f9f5acab084a5166a78714fde5198ce6b9448ec8ae8e403085048f7e + "1.5": + url: "https://github.com/p-ranav/tabulate/archive/v1.5.tar.gz" + sha256: "16b289f46306283544bb593f4601e80d6ea51248fde52e910cc569ef08eba3fb" "1.4": url: "https://github.com/p-ranav/tabulate/archive/v1.4.tar.gz" sha256: "c20cdc3175526a069e932136a7cbdf6f27b137bdb4fc5f574eb5a497228c8e11" + "1.3": + url: "https://github.com/p-ranav/tabulate/archive/v1.3.tar.gz" + sha256: "d1739e82f9f5acab084a5166a78714fde5198ce6b9448ec8ae8e403085048f7e" + "1.0": + url: "https://github.com/p-ranav/tabulate/archive/v1.0.tar.gz" + sha256: "34eda3605e2ce0c7ca339fa2af6a0c77a5e49321b2f549ff5313f955273c8ac8" diff --git a/recipes/tabulate/all/conanfile.py b/recipes/tabulate/all/conanfile.py index eaf38113a8053..9e38d9d4f8e7f 100644 --- a/recipes/tabulate/all/conanfile.py +++ b/recipes/tabulate/all/conanfile.py @@ -1,57 +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 -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration -from conans.tools import Version + +required_conan_version = ">=1.52.0" class Tabulate(ConanFile): name = "tabulate" + description = "Table Maker for Modern C++" + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/p-ranav/tabulate" - description = "Table Maker for Modern C++" - settings = "compiler" topics = ("header-only", "cpp17", "tabulate", "table", "cli") - license = "MIT" + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 17 - def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = self.name + "-" + self.version - os.rename(extracted_dir, self._source_subfolder) + @property + def _compilers_minimum_version(self): + return { + "Visual Studio": "16", + "msvc": "192", + "gcc": "8", + "clang": "7", + "apple-clang": "12.0", + } - def configure(self): - compiler = str(self.settings.compiler) - compiler_version = tools.Version(self.settings.compiler.version) + def layout(self): + basic_layout(self, src_folder="src") - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, "17") - else: - self.output.warn("%s recipe lacks information about the %s compiler" - " standard version support" % (self.name, compiler)) + def package_id(self): + self.info.clear() - minimal_version = { - "Visual Studio": "16", - "gcc": "7.3", - "clang": "6", - "apple-clang": "10.0" - } + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) - if compiler not in minimal_version: - self.output.info("%s requires a compiler that supports at least" - " C++17" % self.name) - return + 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 compiler_version < minimal_version[compiler]: - raise ConanInvalidConfiguration("%s requires a compiler that supports" - " at least C++17. %s %s is not" - " supported." % (self.name, compiler, Version(self.settings.compiler.version))) + def source(self): + 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", dst="licenses", 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=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/tabulate/all/test_package/CMakeLists.txt b/recipes/tabulate/all/test_package/CMakeLists.txt index 816587849ca90..30b68b896d39e 100644 --- a/recipes/tabulate/all/test_package/CMakeLists.txt +++ b/recipes/tabulate/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(tabulate REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) -set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 17) +target_link_libraries(${PROJECT_NAME} PRIVATE tabulate::tabulate) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/tabulate/all/test_package/conanfile.py b/recipes/tabulate/all/test_package/conanfile.py index be0a94674e5bd..b9d7f11e89dcd 100644 --- a/recipes/tabulate/all/test_package/conanfile.py +++ b/recipes/tabulate/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 - 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,5 +20,6 @@ def build(self): cmake.build() def test(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/tabulate/all/test_v1_package/CMakeLists.txt b/recipes/tabulate/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..be00a8c7f57c7 --- /dev/null +++ b/recipes/tabulate/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/tabulate/all/test_v1_package/conanfile.py b/recipes/tabulate/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/tabulate/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/tabulate/config.yml b/recipes/tabulate/config.yml index d49cf9dc4b385..38ba8a657ca2f 100644 --- a/recipes/tabulate/config.yml +++ b/recipes/tabulate/config.yml @@ -1,7 +1,9 @@ versions: - "1.0": + "1.5": + folder: all + "1.4": folder: all "1.3": folder: all - "1.4": + "1.0": folder: all diff --git a/recipes/taglib/all/conandata.yml b/recipes/taglib/all/conandata.yml index af90af9573848..9e6c9ce55c7d0 100644 --- a/recipes/taglib/all/conandata.yml +++ b/recipes/taglib/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "2.0": + url: "https://taglib.org/releases/taglib-2.0.tar.gz" + sha256: "e36ea877a6370810b97d84cf8f72b1e4ed205149ab3ac8232d44c850f38a2859" + "1.13.1": + url: "https://taglib.org/releases/taglib-1.13.1.tar.gz" + sha256: "c8da2b10f1bfec2cd7dbfcd33f4a2338db0765d851a50583d410bacf055cfd0b" "1.13": url: "https://taglib.org/releases/taglib-1.13.tar.gz" sha256: "58f08b4db3dc31ed152c04896ee9172d22052bc7ef12888028c01d8b1d60ade0" diff --git a/recipes/taglib/all/conanfile.py b/recipes/taglib/all/conanfile.py index f0f89efb0ca06..cbdc12fd0501f 100644 --- a/recipes/taglib/all/conanfile.py +++ b/recipes/taglib/all/conanfile.py @@ -1,11 +1,14 @@ +import os + from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import stdcpp_library, 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 +from conan.tools.microsoft import is_msvc_static_runtime from conan.tools.scm import Version -from conans import tools as tools_legacy -import os -required_conan_version = ">=1.53.0" +required_conan_version = ">=1.54.0" class TaglibConan(ConanFile): @@ -16,6 +19,7 @@ class TaglibConan(ConanFile): 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,6 +32,21 @@ class TaglibConan(ConanFile): "bindings": True, } + @property + def _min_cppstd(self): + # https://github.com/taglib/taglib/blob/v2.0beta/CMakeLists.txt#L5 + return 17 + + @property + def _compilers_minimum_version(self): + return { + "Visual Studio": "16", + "msvc": "192", + "gcc": "7", + "clang": "6", + "apple-clang": "10", + } + def export_sources(self): export_conandata_patches(self) @@ -43,11 +62,22 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("zlib/1.2.13") + self.requires("zlib/[>=1.2.11 <2]") + if Version(self.version) >= 2: + self.requires("utfcpp/4.0.4") + + def validate(self): + if Version(self.version) >= 2: + 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): - 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 +86,7 @@ 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.variables["ENABLE_STATIC_RUNTIME"] = is_msvc_static_runtime(self) tc.generate() cd = CMakeDeps(self) cd.generate() @@ -69,10 +98,7 @@ def _patch_sources(self): os.path.join(self.source_folder, "taglib", "CMakeLists.txt"), os.path.join(self.source_folder, "bindings", "c", "CMakeLists.txt"), ]: - 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}", "") + replace_in_file(self, cmakelists, "INSTALL_NAME_DIR ${", "# INSTALL_NAME_DIR ${") def build(self): self._patch_sources() @@ -85,6 +111,7 @@ def package(self): cmake = CMake(self) cmake.install() rm(self, "taglib-config", 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): @@ -94,14 +121,18 @@ def package_info(self): self.cpp_info.components["tag"].includedirs.append(os.path.join("include", "taglib")) self.cpp_info.components["tag"].libs = ["tag"] self.cpp_info.components["tag"].requires = ["zlib::zlib"] + if Version(self.version) >= 2: + self.cpp_info.components["tag"].requires.append("utfcpp::utfcpp") 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/CMakeLists.txt b/recipes/taglib/all/test_package/CMakeLists.txt index ada6c88956048..ff4fb5bbf84b0 100644 --- a/recipes/taglib/all/test_package/CMakeLists.txt +++ b/recipes/taglib/all/test_package/CMakeLists.txt @@ -5,3 +5,6 @@ find_package(taglib REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE taglib::taglib) +if (taglib_VERSION VERSION_GREATER_EQUAL 2) + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +endif() diff --git a/recipes/taglib/config.yml b/recipes/taglib/config.yml index c171123076114..72a875c97a160 100644 --- a/recipes/taglib/config.yml +++ b/recipes/taglib/config.yml @@ -1,4 +1,8 @@ versions: + "2.0": + folder: all + "1.13.1": + folder: all "1.13": folder: all "1.12": diff --git a/recipes/taocpp-json/all/conandata.yml b/recipes/taocpp-json/all/conandata.yml index 732888cb32c08..08a817ecfe94b 100644 --- a/recipes/taocpp-json/all/conandata.yml +++ b/recipes/taocpp-json/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.0.0-beta.14": + sha256: f9e44a1d6a70a6d39b9e45df76eac928e69f5318e5a957fd5c0efdf45dacaf5e + url: https://github.com/taocpp/json/archive/1.0.0-beta.14.tar.gz "1.0.0-beta.13": sha256: 2513b32d1883277f78071ff1cc55d4f35a979fffdaddf6412d3cb67852ce68b5 url: https://github.com/taocpp/json/archive/1.0.0-beta.13.tar.gz diff --git a/recipes/taocpp-json/all/conanfile.py b/recipes/taocpp-json/all/conanfile.py index fa81d8742b283..c4c33792ccb9b 100644 --- a/recipes/taocpp-json/all/conanfile.py +++ b/recipes/taocpp-json/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.51.1" class TaoCPPJSONConan(ConanFile): @@ -13,64 +17,65 @@ class TaoCPPJSONConan(ConanFile): description = "C++ header-only JSON library" topics = ("json", "jaxn", "cbor", "msgpack", "ubjson", "json-pointer", "json-patch") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return "11" if Version(self.version) < "1.0.0-beta.11" else "17" @property def _min_compilers_version(self): return { - "gcc": "7", - "clang": "6", - "apple-clang": "10", - "Visual Studio": "15", - } - - @property - def _min_cppstd_required(self): - return "11" if tools.Version(self.version) < "1.0.0-beta.11" else "17" + "17": { + "gcc": "7", + "clang": "6", + "apple-clang": "10", + "Visual Studio": "15", + "msvc": "191", + }, + }.get(self._min_cppstd, {}) @property def _requires_pegtl(self): - return tools.Version(self.version) >= "1.0.0-beta.13" + return Version(self.version) >= "1.0.0-beta.13" + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): if self._requires_pegtl: - self.requires("taocpp-pegtl/3.2.5") + self.requires("taocpp-pegtl/3.2.7") def package_id(self): - self.info.header_only() + self.info.clear() def validate(self): - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, self._min_cppstd_required) - if tools.Version(self.version) >= "1.0.0-beta.11": - 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-json requires C++17, which your compiler does not support.") - else: - self.output.warn("taocpp-json requires C++17. Your compiler is unknown. Assuming it supports C++17.") + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + min_compiler_version = self._min_compilers_version.get(str(self.settings.compiler), False) + if min_compiler_version and Version(self.settings.compiler.version) < min_compiler_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): - 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-json") self.cpp_info.set_property("cmake_target_name", "taocpp::json") # TODO: back to global scope in conan v2 once cmake_find_package_* generators removed self.cpp_info.components["json"].bindirs = [] - self.cpp_info.components["json"].frameworkdirs = [] self.cpp_info.components["json"].libdirs = [] - self.cpp_info.components["json"].resdirs = [] # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.filenames["cmake_find_package"] = "taocpp-json" diff --git a/recipes/taocpp-json/all/test_package/CMakeLists.txt b/recipes/taocpp-json/all/test_package/CMakeLists.txt index a7298e226f7ce..bf7290d1f3c3a 100644 --- a/recipes/taocpp-json/all/test_package/CMakeLists.txt +++ b/recipes/taocpp-json/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(taocpp-json REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} taocpp::json) +target_link_libraries(${PROJECT_NAME} PRIVATE taocpp::json) set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17) diff --git a/recipes/taocpp-json/all/test_package/conanfile.py b/recipes/taocpp-json/all/test_package/conanfile.py index 54b6b5990cb87..0a6bc68712d90 100644 --- a/recipes/taocpp-json/all/test_package/conanfile.py +++ b/recipes/taocpp-json/all/test_package/conanfile.py @@ -1,11 +1,19 @@ -import os.path - -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) @@ -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/taocpp-json/all/test_v1_package/CMakeLists.txt b/recipes/taocpp-json/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..2a4b77ef89cd7 --- /dev/null +++ b/recipes/taocpp-json/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +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/taocpp-json/all/test_v1_package/conanfile.py b/recipes/taocpp-json/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/taocpp-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/taocpp-json/config.yml b/recipes/taocpp-json/config.yml index 1c4b5480a0dce..fb0ab49d5fd2c 100644 --- a/recipes/taocpp-json/config.yml +++ b/recipes/taocpp-json/config.yml @@ -1,4 +1,6 @@ versions: + "1.0.0-beta.14": + folder: all "1.0.0-beta.13": folder: all "1.0.0-beta.12": diff --git a/recipes/taocpp-pegtl/2.x.x/conanfile.py b/recipes/taocpp-pegtl/2.x.x/conanfile.py index 63b3f85d3185b..76c67cc8e7e84 100644 --- a/recipes/taocpp-pegtl/2.x.x/conanfile.py +++ b/recipes/taocpp-pegtl/2.x.x/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 get, copy +from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.50.0" class TaoCPPPEGTLConan(ConanFile): @@ -15,24 +18,22 @@ class TaoCPPPEGTLConan(ConanFile): no_copy_source = True settings = "os", "arch", "compiler", "build_type" - @property - def _source_subfolder(self): - return "source_subfolder" - 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 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], strip_root=True) 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", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + 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", "pegtl") diff --git a/recipes/taocpp-pegtl/2.x.x/test_package/CMakeLists.txt b/recipes/taocpp-pegtl/2.x.x/test_package/CMakeLists.txt index f0ec8c369c969..70714c11e2405 100644 --- a/recipes/taocpp-pegtl/2.x.x/test_package/CMakeLists.txt +++ b/recipes/taocpp-pegtl/2.x.x/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(pegtl REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} taocpp::pegtl) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/taocpp-pegtl/2.x.x/test_package/conanfile.py b/recipes/taocpp-pegtl/2.x.x/test_package/conanfile.py index 38f4483872d47..a9fb96656f203 100644 --- a/recipes/taocpp-pegtl/2.x.x/test_package/conanfile.py +++ b/recipes/taocpp-pegtl/2.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_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/taocpp-pegtl/2.x.x/test_v1_package/CMakeLists.txt b/recipes/taocpp-pegtl/2.x.x/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..799649d28d583 --- /dev/null +++ b/recipes/taocpp-pegtl/2.x.x/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +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/taocpp-pegtl/2.x.x/test_v1_package/conanfile.py b/recipes/taocpp-pegtl/2.x.x/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..2490acfa82ff8 --- /dev/null +++ b/recipes/taocpp-pegtl/2.x.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 TestPackageConan(ConanFile): + settings = "os", "arch", "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/taocpp-pegtl/3.x.x/conandata.yml b/recipes/taocpp-pegtl/3.x.x/conandata.yml index 95cbe48c372b0..686f1e476aeff 100644 --- a/recipes/taocpp-pegtl/3.x.x/conandata.yml +++ b/recipes/taocpp-pegtl/3.x.x/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.2.8": + url: "https://github.com/taocpp/PEGTL/archive/3.2.8.tar.gz" + sha256: "319e8238daebc3a163f60c88c78922a8012772076fdd64a8dafaf5619cd64773" "3.2.7": url: "https://github.com/taocpp/PEGTL/archive/3.2.7.tar.gz" sha256: "d6cd113d8bd14e98bcbe7b7f8fc1e1e33448dc359e8cd4cca30e034ec2f0642d" diff --git a/recipes/taocpp-pegtl/3.x.x/conanfile.py b/recipes/taocpp-pegtl/3.x.x/conanfile.py index b44292c79da00..5ddd704b5c07c 100644 --- a/recipes/taocpp-pegtl/3.x.x/conanfile.py +++ b/recipes/taocpp-pegtl/3.x.x/conanfile.py @@ -1,19 +1,23 @@ -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout +from conan.errors import ConanInvalidConfiguration import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.50.0" class TaoCPPPEGTLConan(ConanFile): name = "taocpp-pegtl" + description = "Parsing Expression Grammar Template Library" license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/taocpp/pegtl" - description = "Parsing Expression Grammar Template Library" topics = ("peg", "header-only", "cpp", "parsing", "cpp17", "cpp11", "grammar") - no_copy_source = True + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" options = { "boost_filesystem": [True, False], @@ -21,10 +25,7 @@ class TaoCPPPEGTLConan(ConanFile): default_options = { "boost_filesystem": False, } - - @property - def _source_subfolder(self): - return "source_subfolder" + no_copy_source = True def requirements(self): if self.options.boost_filesystem: @@ -41,7 +42,7 @@ def _compilers_minimum_version(self): def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, "17") + check_min_cppstd(self, "17") def lazy_lt_semver(v1, v2): lv1 = [int(v) for v in v1.split(".")] @@ -50,31 +51,34 @@ def lazy_lt_semver(v1, v2): 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)) + if minimum_version and lazy_lt_semver(str(self.settings.compiler.version), minimum_version): + raise ConanInvalidConfiguration(f"{self.ref} requires C++17, which your compiler does not support.") - compiler_version = tools.Version(self.settings.compiler.version) + compiler_version = Version(self.settings.compiler.version) if self.version == "3.0.0" and self.settings.compiler == "clang" and \ compiler_version >= "10" and compiler_version < "12": - raise ConanInvalidConfiguration("{} {} doesn't support filesystem experimental".format(self.name, self.version)) + raise ConanInvalidConfiguration(f"{self.ref} doesn't support filesystem experimental") - if self.options.boost_filesystem and (self.options["boost"].header_only or self.options["boost"].without_filesystem): - raise ConanInvalidConfiguration("{} requires non header-only boost with filesystem component".format(self.name)) + if self.options.boost_filesystem and (self.dependencies["boost"].options.header_only or self.dependencies["boost"].options.without_filesystem): + raise ConanInvalidConfiguration("{self.ref} requires non header-only boost with filesystem component") 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], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) 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*", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, "*", 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", "pegtl") self.cpp_info.set_property("cmake_target_name", "taocpp::pegtl") # TODO: back to global scope in conan v2 once cmake_find_package_* generators removed @@ -82,7 +86,7 @@ def package_info(self): self.cpp_info.components["_taocpp-pegtl"].requires.append("boost::filesystem") self.cpp_info.components["_taocpp-pegtl"].defines.append("TAO_PEGTL_BOOST_FILESYSTEM") else: - compiler_version = tools.Version(self.settings.compiler.version) + compiler_version = Version(self.settings.compiler.version) if self.settings.compiler == "clang" and compiler_version >= "10" and compiler_version < "12": self.cpp_info.components["_taocpp-pegtl"].defines.append("TAO_PEGTL_STD_EXPERIMENTAL_FILESYSTEM") diff --git a/recipes/taocpp-pegtl/3.x.x/test_package/CMakeLists.txt b/recipes/taocpp-pegtl/3.x.x/test_package/CMakeLists.txt index 18041f3558cbd..5d60ca38b63f6 100644 --- a/recipes/taocpp-pegtl/3.x.x/test_package/CMakeLists.txt +++ b/recipes/taocpp-pegtl/3.x.x/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(pegtl REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} taocpp::pegtl) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/taocpp-pegtl/3.x.x/test_package/conanfile.py b/recipes/taocpp-pegtl/3.x.x/test_package/conanfile.py index 38f4483872d47..a9fb96656f203 100644 --- a/recipes/taocpp-pegtl/3.x.x/test_package/conanfile.py +++ b/recipes/taocpp-pegtl/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_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/taocpp-pegtl/3.x.x/test_v1_package/CMakeLists.txt b/recipes/taocpp-pegtl/3.x.x/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..799649d28d583 --- /dev/null +++ b/recipes/taocpp-pegtl/3.x.x/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +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/taocpp-pegtl/3.x.x/test_v1_package/conanfile.py b/recipes/taocpp-pegtl/3.x.x/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..2490acfa82ff8 --- /dev/null +++ b/recipes/taocpp-pegtl/3.x.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 TestPackageConan(ConanFile): + settings = "os", "arch", "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/taocpp-pegtl/config.yml b/recipes/taocpp-pegtl/config.yml index 768412ab23d94..10a10cf7e0ee7 100644 --- a/recipes/taocpp-pegtl/config.yml +++ b/recipes/taocpp-pegtl/config.yml @@ -1,4 +1,6 @@ versions: + "3.2.8": + folder: "3.x.x" "3.2.7": folder: "3.x.x" "3.2.6": 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..b23fe9c84afe7 100644 --- a/recipes/taocpp-taopq/all/conandata.yml +++ b/recipes/taocpp-taopq/all/conandata.yml @@ -1,7 +1,10 @@ sources: + "cci.20231219": + url: "https://github.com/taocpp/taopq/archive/855ae86e48f2380d230feae22830f0f9664859ed.tar.gz" + sha256: "bb23d88b8fb7737b8c99f8450b5ab19e1072260fc189634f23103198ac524511" "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..e186bb806ba1b 100644 --- a/recipes/taocpp-taopq/all/conanfile.py +++ b/recipes/taocpp-taopq/all/conanfile.py @@ -1,20 +1,23 @@ -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, copy +from conan.tools.scm import Version import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class TaoCPPTaopqConan(ConanFile): name = "taocpp-taopq" + description = "C++ client library for PostgreSQL" license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/taocpp/taopq" - description = "C++ client library for PostgreSQL" topics = ("cpp17", "postgresql", "libpq", "data-base", "sql") - - settings = "os", "build_type", "compiler", "arch" + package_type = "library" + settings = "os", "arch", "compiler", "build_type" 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" + def _min_cppstd(self): + return "17" @property - def _build_subfolder(self): - return "build_subfolder" - - @property - def _min_compilers_version(self): + def _compilers_minimum_version(self): return { - "gcc": "7", - "clang": "6", + "gcc": "7" if self.version < "cci.20231219" else "8", + "clang": "6" if self.version < "cci.20231219" else "7", "apple-clang": "10", - "Visual Studio": "15" + "Visual Studio": "15", + "msvc": "191", } def config_options(self): @@ -50,48 +47,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): - self.requires("libpq/14.2") + # libpq-fe.h is included by many public headers of taocpp-taopq, and also uses some symbols of the lib (see https://github.com/conan-io/conan-center-index/pull/19825#issuecomment-1720996359) + self.requires("libpq/15.4", transitive_headers=True, transitive_libs=True) 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) - - @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 + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + # Option names changed in https://github.com/taocpp/taopq/commit/d77896ab80369f13512a7f0ba8af818a03de1cdf + if Version(self.version) < "cci.20211017": + tc.variables["TAOPQ_BUILD_TESTS"] = False + tc.variables["TAOPQ_INSTALL_DOC_DIR"] = "licenses" + else: + 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() + copy(self, "LICENSE*", self.source_folder, 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): 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-taopq/config.yml b/recipes/taocpp-taopq/config.yml index 73c3d88a4e083..08774e1ebdda9 100644 --- a/recipes/taocpp-taopq/config.yml +++ b/recipes/taocpp-taopq/config.yml @@ -1,4 +1,6 @@ versions: + "cci.20231219": + folder: all "cci.20210727": folder: all "cci.20200222": diff --git a/recipes/tar/all/conandata.yml b/recipes/tar/all/conandata.yml index 7df28f6d96e37..ab2017a8f4ca5 100644 --- a/recipes/tar/all/conandata.yml +++ b/recipes/tar/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "1.35": + url: "https://ftp.gnu.org/gnu/tar/tar-1.35.tar.xz" + sha256: "4d62ff37342ec7aed748535323930c7cf94acf71c3591882b26a7ea50f3edc16" "1.32.90": url: "https://alpha.gnu.org/gnu/tar/tar-1.32.90.tar.gz" sha256: "641fe07b7403c8eb801e7bfb91d1b7e5800ab15df524e22e0b2e89501280b6d7" +patches: + "1.35": + - patch_file: "patches/1.35-001-fix-iconv-link.patch" + patch_description: "Fix iconv link" + patch_type: "portability" + patch_source: "http://git.savannah.gnu.org/cgit/tar.git/patch/?id=8632df398b2f548465ebe68b8f494c0d6f8d913d" diff --git a/recipes/tar/all/conanfile.py b/recipes/tar/all/conanfile.py index afe93c20c680f..9f5cf868bef7f 100644 --- a/recipes/tar/all/conanfile.py +++ b/recipes/tar/all/conanfile.py @@ -1,98 +1,123 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, 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.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.microsoft import is_msvc +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" class TarConan(ConanFile): name = "tar" description = "GNU Tar provides the ability to create tar archives, as well as various other kinds of manipulation." - topics = ("tar", "archive") license = "GPL-3-or-later" - homepage = "https://www.gnu.org/software/tar/" url = "https://github.com/conan-io/conan-center-index" - settings = "os", "arch", "compiler", "build_type" - - _autotools = None + homepage = "https://www.gnu.org/software/tar/" + topics = "archive" - @property - def _source_subfolder(self): - return "source_subfolder" + package_type = "application" + 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 layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + del self.info.settings.compiler def requirements(self): - self.requires("bzip2/1.0.8") - self.requires("lzip/1.21") - self.requires("xz_utils/5.2.5") + self.requires("bzip2/1.0.8", run=True, headers=False, libs=False) + self.requires("lzip/1.23", run=True, headers=False, libs=False) + self.requires("xz_utils/5.4.5", run=True, headers=False, libs=False) + self.requires("zstd/1.5.5", run=True, headers=False, libs=False) + # self.requires("lzo/2.10", run=True, headers=False, libs=False) + + def build_requirements(self): + if Version(self.version) == "1.35": + self.build_requires("automake/1.16.5") + self.build_requires("gettext/0.22.5") def validate(self): if self.settings.os == "Windows": raise ConanInvalidConfiguration("This recipe does not support Windows builds of tar") # FIXME: fails on MSVC and mingw-w64 - if not self.options["bzip2"].build_executable: + if not self.dependencies["bzip2"].options.build_executable: raise ConanInvalidConfiguration("bzip2:build_executable must be enabled") - 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) - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self) - self._autotools.libs = [] - bzip2_exe = "bzip2" # FIXME: get from bzip2 recipe - lzip_exe = "lzip" # FIXME: get from lzip recipe - lzma_exe = "lzma" # FIXME: get from xz_utils recipe - xz_exe = "xz" # FIXME: get from xz_utils recipe - args = [ + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + tc = AutotoolsToolchain(self) + tc.generate() + tc.configure_args += [ "--disable-acl", "--disable-nls", "--disable-rpath", - # "--without-gzip", # FIXME: this will use system gzip "--without-posix-acls", "--without-selinux", - "--with-bzip2={}".format(bzip2_exe), - "--with-lzip={}".format(lzip_exe), - "--with-lzma={}".format(lzma_exe), - # "--without-lzop", # FIXME: this will use sytem lzop - "--with-xz={}".format(xz_exe), - # "--without-zstd", # FIXME: this will use system zstd (current zstd recipe does not build programs) + "--with-gzip=gzip", # FIXME: this will use system gzip + "--with-bzip2=bzip2", + "--with-lzip=lzip", + "--with-lzma=lzma", + "--without-lzop", # FIXME: lzo package does not build an executable + "--with-xz=xz", + "--with-zstd=zstd", ] - self._autotools.configure(args=args, configure_dir=self._source_subfolder) - return self._autotools + tc.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + if is_msvc(self): + replace_in_file( + self, + os.path.join(self.source_folder, "gnu", "faccessat.c"), + "_GL_INCLUDING_UNISTD_H", + "_GL_INCLUDING_UNISTD_H_NOP", + ) def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - if self.settings.compiler == "Visual Studio": - tools.replace_in_file(os.path.join(self._source_subfolder, "gnu", "faccessat.c"), - "_GL_INCLUDING_UNISTD_H", "_GL_INCLUDING_UNISTD_H_NOP") - autotools = self._configure_autotools() + self._patch_sources() + autotools = Autotools(self) + if Version(self.version) == "1.35": + autotools.autoreconf() # autoreconf needed after patching + 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")) + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "libexec")) 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.frameworkdirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] + self.cpp_info.includedirs = [] tar_bin = os.path.join(self.package_folder, "bin", "tar") - self.user_info.tar = tar_bin + self.conf_info.define("user.tar:path", tar_bin) self.env_info.TAR = tar_bin + + # TODO: to remove in conan v2 + bin_path = os.path.join(self.package_folder, "bin") + self.env_info.PATH.append(bin_path) + self.user_info.tar = tar_bin diff --git a/recipes/tar/all/patches/1.35-001-fix-iconv-link.patch b/recipes/tar/all/patches/1.35-001-fix-iconv-link.patch new file mode 100644 index 0000000000000..e433aa6ead2da --- /dev/null +++ b/recipes/tar/all/patches/1.35-001-fix-iconv-link.patch @@ -0,0 +1,24 @@ +From 8632df398b2f548465ebe68b8f494c0d6f8d913d Mon Sep 17 00:00:00 2001 +From: Sergey Poznyakoff +Date: Tue, 18 Jul 2023 17:02:23 +0300 +Subject: Fix savannah bug #64441 + +* src/Makefile.am (tar_LDADD): Add libiconv libraries. +--- + src/Makefile.am | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/Makefile.am b/src/Makefile.am +index 36c9543..e2ec58d 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -52,4 +52,5 @@ AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS) + tar_LDADD = $(LIBS) ../lib/libtar.a ../gnu/libgnu.a\ + $(LIB_ACL) $(LIB_CLOCK_GETTIME) $(LIB_EACCESS)\ + $(LIB_GETRANDOM) $(LIB_HARD_LOCALE) $(FILE_HAS_ACL_LIB) $(LIB_MBRTOWC)\ +- $(LIB_SELINUX) $(LIB_SETLOCALE_NULL) ++ $(LIB_SELINUX) $(LIB_SETLOCALE_NULL) \ ++ $(LIBINTL) $(LIBICONV) +-- +cgit v1.1 + diff --git a/recipes/tar/all/test_package/conanfile.py b/recipes/tar/all/test_package/conanfile.py index 68b1151321a11..5e1618addc3d0 100644 --- a/recipes/tar/all/test_package/conanfile.py +++ b/recipes/tar/all/test_package/conanfile.py @@ -1,17 +1,40 @@ -from conans import ConanFile, tools import os +from conan import ConanFile +from conan.tools.cmake import cmake_layout +from conan.tools.files import chdir, load, save + class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" + settings = "os", "arch", "compiler", "build_type" + generators = "VirtualBuildEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def build_requirements(self): + self.tool_requires(self.tested_reference_str) + + def generate(self): + tar_bin = self.dependencies.build["tar"].conf_info.get("user.tar:path") + save(self, os.path.join(self.build_folder, "tar_bin"), tar_bin) def test(self): - tar_bin = self.deps_user_info["tar"].tar - if not tools.cross_building(self): - with tools.chdir(self.source_folder): - test_tar = os.path.join(self.build_folder, "test.tar.gz") - self.run("{} -czf {} conanfile.py".format(tar_bin, test_tar), run_environment=True) - assert os.path.isfile("test.tar.gz") - self.run("{} -tf test.tar.gz".format(tar_bin), run_environment=True) - self.run("{} -xf test.tar.gz".format(tar_bin), run_environment=True) - assert tools.load(os.path.join(self.source_folder, "conanfile.py")) == tools.load(os.path.join(self.build_folder, "conanfile.py")) + # Verify that the compression tools are available + self.run("gzip --version") + self.run("bzip2 --help") + self.run("lzip --version") + self.run("lzma --version") + self.run("zstd --version") + + tar_bin = load(self, os.path.join(self.build_folder, "tar_bin")) + with chdir(self, self.source_folder): + test_tar = os.path.join(self.build_folder, "test.tar.zstd") + self.run(f"{tar_bin} --zstd -cf {test_tar} conanfile.py") + assert os.path.isfile("test.tar.zstd") + self.run(f"{tar_bin} -tf test.tar.zstd") + self.run(f"{tar_bin} -xf test.tar.zstd") + f1 = load(self, os.path.join(self.source_folder, "conanfile.py")) + f2 = load(self, os.path.join(self.build_folder, "conanfile.py")) + assert f1 == f2 diff --git a/recipes/tar/all/test_v1_package/conanfile.py b/recipes/tar/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..68b1151321a11 --- /dev/null +++ b/recipes/tar/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + + def test(self): + tar_bin = self.deps_user_info["tar"].tar + if not tools.cross_building(self): + with tools.chdir(self.source_folder): + test_tar = os.path.join(self.build_folder, "test.tar.gz") + self.run("{} -czf {} conanfile.py".format(tar_bin, test_tar), run_environment=True) + assert os.path.isfile("test.tar.gz") + self.run("{} -tf test.tar.gz".format(tar_bin), run_environment=True) + self.run("{} -xf test.tar.gz".format(tar_bin), run_environment=True) + assert tools.load(os.path.join(self.source_folder, "conanfile.py")) == tools.load(os.path.join(self.build_folder, "conanfile.py")) diff --git a/recipes/tar/config.yml b/recipes/tar/config.yml index b21f806d0621e..65088c19d5771 100644 --- a/recipes/tar/config.yml +++ b/recipes/tar/config.yml @@ -1,3 +1,5 @@ versions: + "1.35": + folder: "all" "1.32.90": folder: "all" diff --git a/recipes/taskflow/all/conandata.yml b/recipes/taskflow/all/conandata.yml index dae7658daeb10..8d29a2455eda0 100644 --- a/recipes/taskflow/all/conandata.yml +++ b/recipes/taskflow/all/conandata.yml @@ -1,4 +1,16 @@ sources: + "3.8.0": + url: "https://github.com/taskflow/taskflow/archive/v3.8.0.tar.gz" + sha256: "51316ee5fbf0c8f8f4638eb7428430cadfe6e8910756593884710e99129fa0ab" + "3.7.0": + url: "https://github.com/taskflow/taskflow/archive/v3.7.0.tar.gz" + sha256: "788b88093fb3788329ebbf7c7ee05d1f8960d974985a301798df01e77e04233b" + "3.6.0": + url: "https://github.com/taskflow/taskflow/archive/v3.6.0.tar.gz" + sha256: "5a1cd9cf89f93a97fcace58fd73ed2fc8ee2053bcb43e047acb6bc121c3edf4c" + "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" @@ -11,18 +23,8 @@ sources: "3.1.0": url: "https://github.com/taskflow/taskflow/archive/v3.1.0.tar.gz" sha256: "B83E9A78C254D831B8401D0F8A766E3C5B60D8D20BE5AF6E2D2FAD4AA4A8B980" - "3.0.0": - url: "https://github.com/taskflow/taskflow/archive/v3.0.0.tar.gz" - sha256: "553C88A6E56E115D29AC1520B8A0FEA4557A5FCDA1AF1427BD3BA454926D03A2" - "2.7.0": - url: "https://github.com/taskflow/taskflow/archive/v2.7.0.tar.gz" - sha256: "BC2227DCABEC86ABEBA1FEE56BB357D9D3C0EF0184F7C2275D7008E8758DFC3E" - "2.6.0": - url: "https://github.com/taskflow/taskflow/archive/v2.6.0.tar.gz" - sha256: "2F511F4291653D759AF12A7854BABCEBF57CFBB8B49BF6CD3EB0DD98A1A4039C" - "2.5.0": - url: "https://github.com/taskflow/taskflow/archive/v2.5.0.tar.gz" - sha256: "B7016EE3486458AE401D521EA6BC0403DDE975828038B9734621A6A325ACAC1A" patches: "3.3.0": - 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 ec7156468a894..b7c01ed9815d0 100644 --- a/recipes/taskflow/all/conanfile.py +++ b/recipes/taskflow/all/conanfile.py @@ -19,32 +19,24 @@ class TaskflowConan(ConanFile): license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/taskflow/taskflow" - topics = ("tasking", "parallelism") + topics = ("tasking", "parallelism", "header-only") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" short_paths = True @property def _min_cppstd(self): - if Version(self.version) >= "3.0.0": - return "17" - return "14" + return "17" @property def _compilers_minimum_version(self): return { - "17": { - "Visual Studio": "16", - "gcc": "7.3", - "clang": "6.0", - "apple-clang": "10.0", - }, - "14": { - "Visual Studio": "15", - "gcc": "5", - "clang": "4.0", - "apple-clang": "8.0", - }, - }[self._min_cppstd] + "Visual Studio": "16", + "msvc": "192", + "gcc": "7.3" if Version(self.version) < "3.7.0" else "8.4", + "clang": "6.0", + "apple-clang": "10.0", + } def export_sources(self): export_conandata_patches(self) @@ -72,8 +64,7 @@ def loose_lt_semver(v1, v2): ) 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): apply_conandata_patches(self) @@ -85,6 +76,9 @@ def package(self): dst=os.path.join(self.package_folder, "include", "taskflow")) def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.set_property("cmake_file_name", "Taskflow") self.cpp_info.set_property("cmake_target_name", "Taskflow::Taskflow") if self.settings.os in ["Linux", "FreeBSD"]: diff --git a/recipes/taskflow/config.yml b/recipes/taskflow/config.yml index 943da98e3a4e4..94741c12af489 100644 --- a/recipes/taskflow/config.yml +++ b/recipes/taskflow/config.yml @@ -1,17 +1,17 @@ versions: - "3.4.0": + "3.8.0": folder: all - "3.3.0": + "3.7.0": folder: all - "3.2.0": + "3.6.0": folder: all - "3.1.0": + "3.5.0": folder: all - "3.0.0": + "3.4.0": folder: all - "2.7.0": + "3.3.0": folder: all - "2.6.0": + "3.2.0": folder: all - "2.5.0": + "3.1.0": folder: all diff --git a/recipes/taywee-args/all/conandata.yml b/recipes/taywee-args/all/conandata.yml index 50dde225215be..c1b7579a8628c 100644 --- a/recipes/taywee-args/all/conandata.yml +++ b/recipes/taywee-args/all/conandata.yml @@ -1,4 +1,10 @@ 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" diff --git a/recipes/taywee-args/config.yml b/recipes/taywee-args/config.yml index 9c5be1f93b429..49287304bfe93 100644 --- a/recipes/taywee-args/config.yml +++ b/recipes/taywee-args/config.yml @@ -1,4 +1,8 @@ versions: + "6.4.6": + folder: all + "6.4.4": + folder: all "6.4.2": folder: all "6.4.1": diff --git a/recipes/tcl/all/conandata.yml b/recipes/tcl/all/conandata.yml index 3968e17be34e3..027d30d480cf0 100644 --- a/recipes/tcl/all/conandata.yml +++ b/recipes/tcl/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "8.6.13": + url: "https://downloads.sourceforge.net/project/tcl/Tcl/8.6.13/tcl8.6.13-src.tar.gz" + sha256: "43a1fae7412f61ff11de2cfd05d28cfc3a73762f354a417c62370a54e2caf066" "8.6.11": url: "https://downloads.sourceforge.net/project/tcl/Tcl/8.6.11/tcl8.6.11-src.tar.gz" sha256: "8c0486668586672c5693d7d95817cb05a18c5ecca2f40e2836b9578064088258" @@ -6,9 +9,9 @@ sources: url: "https://downloads.sourceforge.net/project/tcl/Tcl/8.6.10/tcl8.6.10-src.tar.gz" sha256: "5196dbf6638e3df8d5c87b5815c8c2b758496eb6f0e41446596c9a4e638d87ed" patches: + "8.6.13": + - patch_file: "patches/0001-8.6.11-no-read-only-data.patch" "8.6.11": - patch_file: "patches/0001-8.6.11-no-read-only-data.patch" - base_path: "source_subfolder" "8.6.10": - patch_file: "patches/0001-8.6.10-no-read-only-data.patch" - base_path: "source_subfolder" diff --git a/recipes/tcl/all/conanfile.py b/recipes/tcl/all/conanfile.py index 62f11aa121847..f3487edb47074 100644 --- a/recipes/tcl/all/conanfile.py +++ b/recipes/tcl/all/conanfile.py @@ -1,41 +1,42 @@ -from conan.tools.microsoft import is_msvc, msvc_runtime_flag -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, 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, chdir, collect_libs, copy, export_conandata_patches, 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, is_msvc_static_runtime, msvc_runtime_flag, NMakeToolchain, NMakeDeps +from conan.tools.scm import Version import os -required_conan_version = ">=1.45.0" +required_conan_version = ">=1.55.0" class TclConan(ConanFile): name = "tcl" description = "Tcl is a very powerful but easy to learn dynamic programming language." - topics = ("tcl", "scripting", "programming") + license = "TCL" url = "https://github.com/conan-io/conan-center-index" homepage = "https://tcl.tk" - license = "TCL" - + topics = ("scripting", "programming") + package_type = "library" 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 _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": @@ -43,74 +44,103 @@ 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") + # source folder must be a sub-directory of the build folder + self.folders.build = "." def requirements(self): - self.requires("zlib/1.2.12") + self.requires("zlib/[>=1.2.11 <2]") def validate(self): if self.settings.os not in ("FreeBSD", "Linux", "Macos", "Windows"): - raise ConanInvalidConfiguration("Unsupported os") + raise ConanInvalidConfiguration(f"{self.ref} is not supported on {self.settings.os}.") 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") + 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 _get_default_build_system_subdir(self): - return { - "Macos": "macosx", - "Linux": "unix", - "Windows": "win", - }[str(self.settings.os)] + def generate(self): + if is_msvc(self): + tc = NMakeToolchain(self) + tc.generate() - def _get_configure_dir(self, build_system_subdir=None): - if build_system_subdir is None: - build_system_subdir = self._get_default_build_system_subdir() - return os.path.join(self.source_folder, self._source_subfolder, build_system_subdir) + 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) + def yes_no(v): return "yes" if v else "no" + tc.configure_args.extend([ + "--enable-threads", + "--enable-symbols={}".format(yes_no(self.settings.build_type == "Debug")), + "--enable-64bit={}".format(yes_no(self.settings.arch == "x86_64")), + ]) + tc.generate() + + deps = AutotoolsDeps(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) - if tools.is_apple_os(self.settings.os) and self.settings.arch not in ("x86", "x86_64"): - tools.replace_in_file(os.path.join(self._get_configure_dir(), "configure"), "#define HAVE_CPUID 1", "#undef HAVE_CPUID") + if is_apple_os(self) and self.settings.arch not in ("x86", "x86_64"): + macos_configure = os.path.join(self.source_folder, "macosx", "configure") + replace_in_file(self, macos_configure, "#define HAVE_CPUID 1", "#undef HAVE_CPUID") - unix_config_dir = self._get_configure_dir("unix") + unix_config_dir = os.path.join(self.source_folder, "unix") # When disabling 64-bit support (in 32-bit), this test must be 0 in order to use "long long" for 64-bit ints # (${tcl_type_64bit} can be either "__int64" or "long long") - tools.replace_in_file(os.path.join(unix_config_dir, "configure"), - "(sizeof(${tcl_type_64bit})==sizeof(long))", - "(sizeof(${tcl_type_64bit})!=sizeof(long))") + replace_in_file(self, os.path.join(unix_config_dir, "configure"), + "(sizeof(${tcl_type_64bit})==sizeof(long))", + "(sizeof(${tcl_type_64bit})!=sizeof(long))") unix_makefile_in = os.path.join(unix_config_dir, "Makefile.in") # Avoid building internal libraries as shared libraries - tools.replace_in_file(unix_makefile_in, "--enable-shared --enable-threads", "--enable-threads") + replace_in_file(self, unix_makefile_in, "--enable-shared --enable-threads", "--enable-threads") # Avoid clearing CFLAGS and LDFLAGS in the makefile - tools.replace_in_file(unix_makefile_in, "\nCFLAGS\t", "\n#CFLAGS\t") - tools.replace_in_file(unix_makefile_in, "\nLDFLAGS\t", "\n#LDFLAGS\t") + replace_in_file(self, unix_makefile_in, "\nCFLAGS\t", "\n#CFLAGS\t") + replace_in_file(self, unix_makefile_in, "\nLDFLAGS\t", "\n#LDFLAGS\t") # Use CFLAGS and CPPFLAGS as argument to CC - tools.replace_in_file(unix_makefile_in, "${CFLAGS}", "${CFLAGS} ${CPPFLAGS}") + replace_in_file(self, unix_makefile_in, "${CFLAGS}", "${CFLAGS} ${CPPFLAGS}") + + win_config_dir = os.path.join(self.source_folder, "win") + + # Fix install for MinGW + win_makefile_in = os.path.join(win_config_dir, "Makefile.in") + replace_in_file(self, win_makefile_in, "INSTALL_ROOT =", "INSTALL_ROOT = $(DESTDIR)") + # No link to static libgcc for MinGW + win_tcl_m4 = os.path.join(win_config_dir, "tcl.m4") + replace_in_file(self, win_tcl_m4, "-static-libgcc", "") + # nmake creates a temporary file with mixed forward/backward slashes # force the filename to avoid cryptic error messages - win_config_dir = self._get_configure_dir("win") win_makefile_vc = os.path.join(win_config_dir, "makefile.vc") - tools.replace_in_file(win_makefile_vc, "@type << >$@", "type <$@") + replace_in_file(self, win_makefile_vc, "@type << >$@", "type <$@") - win_rules_vc = os.path.join(self._source_subfolder, "win", "rules.vc") + win_rules_vc = os.path.join(self.source_folder, "win", "rules.vc") # do not treat nmake build warnings as errors - tools.replace_in_file(win_rules_vc, "cwarn = $(cwarn) -WX", "") + replace_in_file(self, win_rules_vc, "cwarn = $(cwarn) -WX", "") # disable whole program optimization to be portable across different MSVC versions. # See conan-io/conan-center-index#4811 conan-io/conan-center-index#4094 - tools.replace_in_file( - win_rules_vc, - "OPTIMIZATIONS = $(OPTIMIZATIONS) -GL", - "") + replace_in_file(self, + win_rules_vc, + "OPTIMIZATIONS = $(OPTIMIZATIONS) -GL", + "") def _build_nmake(self, targets): opts = [] @@ -119,125 +149,109 @@ def _build_nmake(self, targets): opts.append("static") if self.settings.build_type == "Debug": opts.append("symbols") - if "MD" in msvc_runtime_flag(self): - opts.append("msvcrt") - else: + if is_msvc_static_runtime(self): opts.append("nomsvcrt") + else: + opts.append("msvcrt") if "d" not in msvc_runtime_flag(self): opts.append("unchecked") - with tools.vcvars(self.settings): - with tools.chdir(self._get_configure_dir("win")): - self.run('nmake -nologo -f "{cfgdir}/makefile.vc" INSTALLDIR="{pkgdir}" OPTS={opts} {targets}'.format( - cfgdir=self._get_configure_dir("win"), - pkgdir=self.package_folder, - opts=",".join(opts), - targets=" ".join(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" - conf_args = [ - "--enable-threads", - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-symbols={}".format(yes_no(self.settings.build_type == "Debug")), - "--enable-64bit={}".format(yes_no(self.settings.arch == "x86_64")), - ] - 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: - tools.replace_in_file(os.path.join(root, "Makefile"), "-Dstrtod=fixstrtod", "", strict=False) - return autotools + + win_config_dir = os.path.join(self.source_folder, "win") + with chdir(self, win_config_dir): + self.run('nmake -nologo -f "{cfgdir}/makefile.vc" INSTALLDIR="{pkgdir}" OPTS={opts} {targets}'.format( + cfgdir=win_config_dir, + pkgdir=self.package_folder, + opts=",".join(opts), + targets=" ".join(targets), + )) + + def _get_configure_subdir(self): + return { + "Macos": "macosx", + "Linux": "unix", + "FreeBSD": "unix", + "Windows": "win", + }[str(self.settings.os)] def build(self): self._patch_sources() if is_msvc(self): self._build_nmake(["release"]) else: - autotools = self._configure_autotools() + autotools = Autotools(self) + autotools.configure(build_script_folder=self._get_configure_subdir()) + # https://core.tcl.tk/tcl/tktview/840660e5a1 + for root, _, list_of_files in os.walk(self.build_folder): + if "Makefile" in list_of_files: + replace_in_file(self, os.path.join(root, "Makefile"), "-Dstrtod=fixstrtod", "", strict=False) + # For some reason this target "binaries" may not be built before others + # on Windows while it's a dependency of many other targets + autotools.make(target="binaries") autotools.make() def package(self): - self.copy(pattern="license.terms", dst="licenses", src=self._source_subfolder) + copy(self, "license.terms", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) if is_msvc(self): self._build_nmake(["install-binaries", "install-libraries"]) else: - autotools = self._configure_autotools() + autotools = Autotools(self) autotools.install() - autotools.make(target="install-private-headers") + autotools.install(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")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "man")) + rmdir(self, os.path.join(self.package_folder, "share")) + fix_apple_shared_install_name(self) + # Relocatable tclConfig.sh tclConfigShPath = os.path.join(self.package_folder, "lib", "tclConfig.sh") - package_path = self.package_folder - build_folder = self.build_folder - if self.settings.os == "Windows" and not is_msvc(self): - package_path = package_path.replace("\\", "/") - drive, path = os.path.splitdrive(self.build_folder) - build_folder = "".join([drive, path.lower().replace("\\", "/")]) - - tools.replace_in_file(tclConfigShPath, - package_path, - "${TCL_ROOT}") - tools.replace_in_file(tclConfigShPath, - build_folder, - "${TCL_BUILD_ROOT}") - - tools.replace_in_file(tclConfigShPath, - "\nTCL_BUILD_", - "\n#TCL_BUILD_") - tools.replace_in_file(tclConfigShPath, - "\nTCL_SRC_DIR", - "\n#TCL_SRC_DIR") + ## Comment out references to build folder + replace_in_file(self, tclConfigShPath, "\nTCL_BUILD_", "\n#TCL_BUILD_") + replace_in_file(self, tclConfigShPath, "\nTCL_SRC_DIR", "\n#TCL_SRC_DIR") + ## Replace references to package folder by TCL_ROOT env var supposed to be defined by VirtualRunEnv + if is_msvc(self): + replace_in_file(self, tclConfigShPath, self.package_folder, "${TCL_ROOT}") + else: + replace_in_file(self, tclConfigShPath, "TCL_PREFIX='/'", "TCL_PREFIX='${TCL_ROOT}'") + replace_in_file(self, tclConfigShPath, "TCL_EXEC_PREFIX='/'", "TCL_EXEC_PREFIX='${TCL_ROOT}'") + for to_replace in ["//", "/"]: + replace_in_file(self, tclConfigShPath, f"-L{to_replace}lib", "-L${TCL_ROOT}/lib", strict=False) + replace_in_file(self, tclConfigShPath, f"{{{to_replace}lib}}", "{${TCL_ROOT}/lib}", strict=False) + replace_in_file(self, tclConfigShPath, f"='{to_replace}lib", "='${TCL_ROOT}/lib", strict=False) + replace_in_file(self, tclConfigShPath, f"-I{to_replace}include", "-I${TCL_ROOT}/include", strict=False) def package_info(self): - libs = [] - systemlibs = [] - libdirs = [] - for root, _, _ in os.walk(os.path.join(self.package_folder, "lib"), topdown=False): - newlibs = tools.collect_libs(self, root) - if newlibs: - libs.extend(newlibs) - libdirs.append(root) - if self.settings.os == "Windows": - systemlibs.extend(["ws2_32", "netapi32", "userenv"]) - elif self.settings.os in ("FreeBSD", "Linux"): - systemlibs.extend(["dl", "m", "pthread"]) + self.cpp_info.set_property("cmake_file_name", "TCL") - defines = [] - if not self.options.shared: - defines.append("STATIC_BUILD") - self.cpp_info.defines = defines + # There are other libs in subfolders, but they are only used + # for TCL extensions and should not be linked against. + self.cpp_info.libs = collect_libs(self, os.path.join(self.package_folder, "lib")) - self.cpp_info.libdirs = libdirs - self.cpp_info.libs = libs - self.cpp_info.system_libs = systemlibs - self.cpp_info.set_property("cmake_file_name", "TCL") - self.cpp_info.names["cmake_find_package"] = "TCL" - self.cpp_info.names["cmake_find_package_multi"] = "TCL" + if self.settings.os == "Windows": + self.cpp_info.system_libs.extend(["ws2_32", "netapi32", "userenv"]) + elif self.settings.os in ("FreeBSD", "Linux"): + self.cpp_info.system_libs.extend(["dl", "m", "pthread"]) + elif is_apple_os(self): + self.cpp_info.frameworks.append("CoreFoundation") - if self.settings.os == "Macos": - self.cpp_info.frameworks = ["CoreFoundation"] - self.cpp_info.sharedlinkflags = self.cpp_info.exelinkflags + if is_msvc(self) and not self.options.shared: + self.cpp_info.defines.append("STATIC_BUILD") - tcl_library = os.path.join(self.package_folder, "lib", "{}{}".format(self.name, ".".join(self.version.split(".")[:2]))) - self.output.info("Setting TCL_LIBRARY environment variable to {}".format(tcl_library)) - self.env_info.TCL_LIBRARY = tcl_library + tcl_version = Version(self.version) + tcl_library = os.path.join(self.package_folder, "lib", f"tcl{tcl_version.major}.{tcl_version.minor}") + self.runenv_info.define_path("TCL_LIBRARY", tcl_library) tcl_root = self.package_folder - self.output.info("Setting TCL_ROOT environment variable to {}".format(tcl_root)) - self.env_info.TCL_ROOT = tcl_root + self.runenv_info.define_path("TCL_ROOT", tcl_root) tclsh_list = list(filter(lambda fn: fn.startswith("tclsh"), os.listdir(os.path.join(self.package_folder, "bin")))) tclsh = os.path.join(self.package_folder, "bin", tclsh_list[0]) - self.output.info("Setting TCLSH environment variable to {}".format(tclsh)) - self.env_info.TCLSH = tclsh + self.runenv_info.define_path("TCLSH", tclsh) - bindir = os.path.join(self.package_folder, "bin") - self.output.info("Adding PATH environment variable: {}".format(bindir)) - self.env_info.PATH.append(bindir) + # TODO: to remove in conan v2 + self.cpp_info.names["cmake_find_package"] = "TCL" + self.cpp_info.names["cmake_find_package_multi"] = "TCL" + self.env_info.TCL_LIBRARY = tcl_library + self.env_info.TCL_ROOT = tcl_root + self.env_info.TCLSH = tclsh + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/tcl/all/test_package/CMakeLists.txt b/recipes/tcl/all/test_package/CMakeLists.txt index 3a403dc404b41..d66a20fd8057c 100644 --- a/recipes/tcl/all/test_package/CMakeLists.txt +++ b/recipes/tcl/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(TCL REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE tcl::tcl) diff --git a/recipes/tcl/all/test_package/conanfile.py b/recipes/tcl/all/test_package/conanfile.py index 51f56ce267b06..851bcca29ec58 100644 --- a/recipes/tcl/all/test_package/conanfile.py +++ b/recipes/tcl/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,8 +21,9 @@ 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) - assert(os.path.exists(os.environ["TCLSH"])) - self.run("{} {}".format(os.environ["TCLSH"], os.path.join(self.source_folder, "hello.tcl")), run_environment=True) + if can_run(self): + self.run(os.path.join(self.cpp.build.bindirs[0], "test_package"), env="conanrun") + if self.settings.os == "Windows": + self.run(os.path.join(self.source_folder, "hello.bat"), env="conanrun") + else: + self.run(f"$TCLSH {os.path.join(self.source_folder, 'hello.tcl')}", env="conanrun") diff --git a/recipes/tcl/all/test_package/hello.bat b/recipes/tcl/all/test_package/hello.bat new file mode 100644 index 0000000000000..91b1898381da6 --- /dev/null +++ b/recipes/tcl/all/test_package/hello.bat @@ -0,0 +1 @@ +%TCLSH% %~dp0hello.tcl diff --git a/recipes/tcl/all/test_v1_package/CMakeLists.txt b/recipes/tcl/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..33e5f24630032 --- /dev/null +++ b/recipes/tcl/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() + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) diff --git a/recipes/tcl/all/test_v1_package/conanfile.py b/recipes/tcl/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..a3f559c43d6bb --- /dev/null +++ b/recipes/tcl/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" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) + assert(os.path.exists(os.environ["TCLSH"])) + self.run("{} {}".format(os.environ["TCLSH"], os.path.join(self.source_folder, "..", "test_package", "hello.tcl")), run_environment=True) diff --git a/recipes/tcl/config.yml b/recipes/tcl/config.yml index 9e60b9c906676..108b4ab57b9c6 100644 --- a/recipes/tcl/config.yml +++ b/recipes/tcl/config.yml @@ -1,4 +1,6 @@ versions: + "8.6.13": + folder: "all" "8.6.11": folder: "all" "8.6.10": diff --git a/recipes/tclap/all/conandata.yml b/recipes/tclap/all/conandata.yml index f7a05c00a83b7..21dfdafb52e1c 100644 --- a/recipes/tclap/all/conandata.yml +++ b/recipes/tclap/all/conandata.yml @@ -1,10 +1,11 @@ +# INFO: Moved from a fork to the original repository sources: "1.2.5": - url: "https://github.com/xguerin/tclap/archive/v1.2.5.tar.gz" - sha256: "a475fc46d82092c5d244f6ca8b0d2c0010fcb2c41936afde10a9c950f42eb95f" + url: "https://github.com/mirror/tclap/archive/refs/tags/v1.2.5.tar.gz" + sha256: "7e87d13734076fa4f626f6144ce9a02717198b3f054341a6886e2107b048b235" "1.2.4": - url: "https://github.com/xguerin/tclap/archive/v1.2.4.tar.gz" - sha256: "7363f8f571e6e733b269c4b4e9c18f392d3cd7240d39a379d95de5a4c4bdc47f" + url: "https://sourceforge.net/projects/tclap/files/tclap-1.2.4.tar.gz" + sha256: "634c5b59dbb1ccbc9d6a5f6de494a257e29a3f59dcb6fc30445ff39b45188574" "1.2.3": - sha256: ccccd3471776f3198bb360aa6c09a1cd527d18b44360ff4d2b8356cdf984e980 - url: https://github.com/xguerin/tclap/archive/v1.2.3.tar.gz + url: "https://sourceforge.net/projects/tclap/files/tclap-1.2.3.tar.gz" + sha256: "19e7db5281540f154348770bc3a7484575f4f549aef8e00aabcc94b395f773c9" diff --git a/recipes/tclap/all/conanfile.py b/recipes/tclap/all/conanfile.py index 7eaf320075187..8b33301f47d32 100644 --- a/recipes/tclap/all/conanfile.py +++ b/recipes/tclap/all/conanfile.py @@ -1,30 +1,33 @@ -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 + class TclapConan(ConanFile): name = "tclap" license = "MIT" - homepage = "http://github.com/xguerin/tclap" + homepage = "https://sourceforge.net/projects/tclap/" url = "https://github.com/conan-io/conan-center-index" description = "Templatized Command Line Argument Parser" - topics = ("c++", "commandline parser") + topics = ("parser", "command-line", "header-only") + settings = "os", "compiler", "build_type", "arch" + package_type = "header-library" 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]) - os.rename(self.name + "-" + self.version, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") - self.copy(pattern="*", src=os.path.join(self._source_subfolder, "include"), dst="include", keep_path=True) + 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=os.path.join(self.source_folder, "include")) def package_info(self): - self.cpp_info.names["pkg_config"] = "tclap" - - def package_id(self): - self.info.header_only() + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/tclap/all/test_package/CMakeLists.txt b/recipes/tclap/all/test_package/CMakeLists.txt index 943ae4571dee7..abb2293e73c6e 100644 --- a/recipes/tclap/all/test_package/CMakeLists.txt +++ b/recipes/tclap/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(TARGETS) +find_package(tclap REQUIRED CONFIG) -add_executable(test_package test.cpp) -target_link_libraries(test_package CONAN_PKG::tclap) +add_executable(test_package test_package.cpp) +target_link_libraries(test_package tclap::tclap) diff --git a/recipes/tclap/all/test_package/conanfile.py b/recipes/tclap/all/test_package/conanfile.py index 78a3d05a29256..3a91c9439218e 100644 --- a/recipes/tclap/all/test_package/conanfile.py +++ b/recipes/tclap/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 TestTclapConan(ConanFile): - settings = "os", "compiler", "arch", "build_type" - 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) @@ -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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/tclap/all/test_package/test.cpp b/recipes/tclap/all/test_package/test_package.cpp similarity index 100% rename from recipes/tclap/all/test_package/test.cpp rename to recipes/tclap/all/test_package/test_package.cpp diff --git a/recipes/tclap/all/test_v1_package/CMakeLists.txt b/recipes/tclap/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/tclap/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/tclap/all/test_v1_package/conanfile.py b/recipes/tclap/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..49a3a66ea5bad --- /dev/null +++ b/recipes/tclap/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/tcp-wrappers/all/conandata.yml b/recipes/tcp-wrappers/all/conandata.yml index 59e770ecf55f2..9aa6d859497fa 100644 --- a/recipes/tcp-wrappers/all/conandata.yml +++ b/recipes/tcp-wrappers/all/conandata.yml @@ -5,8 +5,5 @@ sources: patches: "7.6": - patch_file: "patches/0001-shared-clang.patch" - base_path: "source_subfolder" - patch_file: "patches/0002-fix-warnings-by-include-headers.patch" - base_path: "source_subfolder" - patch_file: "patches/0003-add-severity-level-to-library.patch" - base_path: "source_subfolder" diff --git a/recipes/tcp-wrappers/all/conanfile.py b/recipes/tcp-wrappers/all/conanfile.py index 505aeec0d08d6..3089488940a7d 100644 --- a/recipes/tcp-wrappers/all/conanfile.py +++ b/recipes/tcp-wrappers/all/conanfile.py @@ -1,16 +1,26 @@ import os -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, is_apple_os +from conan.tools.build import cross_building +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 + +required_conan_version = ">=1.53.0" class TcpWrappersConan(ConanFile): name = "tcp-wrappers" - homepage = "ftp://ftp.porcupine.org/pub/security/index.html" description = "A security tool which acts as a wrapper for TCP daemons" - topics = ("conan", "tcp", "ip", "daemon", "wrapper") + license = "TCP-wrappers" url = "https://github.com/conan-io/conan-center-index" - license = "BSD" - exports_sources = "patches/**" + homepage = "http://ftp.porcupine.org/pub/security/" + topics = ("tcp", "ip", "daemon", "wrapper") + + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -20,76 +30,91 @@ class TcpWrappersConan(ConanFile): "shared": False, "fPIC": True, } - generators = "cmake" @property - def _source_subfolder(self): - return "source_subfolder" + def _settings_build(self): + return getattr(self, "settings_build", self.settings) - @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": - raise ConanInvalidConfiguration("Visual Studio is not supported") 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 source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename("tcp_wrappers_{}-ipv6.4".format(self.version), self._source_subfolder) + def layout(self): + basic_layout(self, src_folder="src") + + def validate(self): + if is_msvc(self): + raise ConanInvalidConfiguration("Visual Studio is not supported") + if cross_building(self): + raise ConanInvalidConfiguration("Cross-building is not current supported.") - def _patch_sources(self): - for patch in self.conan_data["patches"][self.version]: - tools.patch(**patch) + def build_requirements(self): + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:subsystem", check_type=str): + self.tool_requires("msys2/cci.latest") - def build(self): - self._patch_sources() - with tools.chdir(self._source_subfolder): - autotools = AutoToolsBuildEnvironment(self) - make_args = [ - "REAL_DAEMON_DIR={}".format(tools.unix_path(os.path.join(self.package_folder, "bin"))), - "-j1", - "SHEXT={}".format(self._shext), - ] - if self.options.shared: - make_args.append("shared=1") - env_vars = autotools.vars - if self.options.get_safe("fPIC", True): - env_vars["CFLAGS"] += " -fPIC" - env_vars["ENV_CFLAGS"] = env_vars["CFLAGS"] - # env_vars["SHEXT"] = self._shext - print(env_vars) - with tools.environment_append(env_vars): - autotools.make(target="linux", args=make_args) + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) @property def _shext(self): - if tools.is_apple_os(self.settings.os): + if is_apple_os(self): return ".dylib" return ".so" - def package(self): - self.copy(pattern="DISCLAIMER", src=self._source_subfolder, dst="licenses") + def generate(self): + tc = AutotoolsToolchain(self) + tc.make_args.append("REAL_DAEMON_DIR=/bin") + tc.make_args.append(f"SHEXT={self._shext}") + if self.options.shared: + tc.make_args.append("shared=1") + if self.options.get_safe("fPIC") or self.options.shared: + tc.make_args.append("ENV_CFLAGS=-fPIC") + tc.generate() + + def build(self): + apply_conandata_patches(self) + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.make(target="linux") + def package(self): + copy(self, "DISCLAIMER", + src=self.source_folder, + dst=os.path.join(self.package_folder, "licenses")) for exe in ("safe_finger", "tcpd", "tcpdchk", "tcpdmatch", "try-from"): - self.copy(exe, src=self._source_subfolder, dst="bin", keep_path=False) - self.copy("tcpd.h", src=self._source_subfolder, dst="include", keep_path=False) + copy(self, exe, + src=self.source_folder, + dst=os.path.join(self.package_folder, "bin"), + keep_path=False) + copy(self, "tcpd.h", + src=self.source_folder, + dst=os.path.join(self.package_folder, "include"), + keep_path=False) if self.options.shared: - self.copy("libwrap{}".format(self._shext), src=self._source_subfolder, dst="lib", keep_path=False) + copy(self, f"libwrap{self._shext}", + src=self.source_folder, + dst=os.path.join(self.package_folder, "lib"), + keep_path=False) else: - self.copy("libwrap.a", src=self._source_subfolder, dst="lib", keep_path=False) + copy(self, "libwrap.a", + src=self.source_folder, + dst=os.path.join(self.package_folder, "lib"), + keep_path=False) + fix_apple_shared_install_name(self) def package_info(self): self.cpp_info.libs = ["wrap"] - 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 once conan v1 not supported anymore + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/tcp-wrappers/all/test_package/CMakeLists.txt b/recipes/tcp-wrappers/all/test_package/CMakeLists.txt index 6226de918d1da..6bc29bd3fc5c5 100644 --- a/recipes/tcp-wrappers/all/test_package/CMakeLists.txt +++ b/recipes/tcp-wrappers/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -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() +find_package(tcp-wrappers REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE tcp-wrappers::tcp-wrappers) diff --git a/recipes/tcp-wrappers/all/test_package/conanfile.py b/recipes/tcp-wrappers/all/test_package/conanfile.py index bd7165a553cf4..ef5d7042163ec 100644 --- a/recipes/tcp-wrappers/all/test_package/conanfile.py +++ b/recipes/tcp-wrappers/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/tcp-wrappers/all/test_package/test_package.c b/recipes/tcp-wrappers/all/test_package/test_package.c index 99571f4211816..297a2849f1a11 100644 --- a/recipes/tcp-wrappers/all/test_package/test_package.c +++ b/recipes/tcp-wrappers/all/test_package/test_package.c @@ -6,6 +6,6 @@ int main (int argc, char *argv[]) { struct request_info req; request_init(&req, RQ_DAEMON, argv[0], RQ_FILE, 0, 0); - printf("host_acces: %d\n", hosts_access(&req)); + printf("host_access: %d\n", hosts_access(&req)); return 0; } diff --git a/recipes/tcp-wrappers/all/test_v1_package/CMakeLists.txt b/recipes/tcp-wrappers/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/tcp-wrappers/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/tcp-wrappers/all/test_v1_package/conanfile.py b/recipes/tcp-wrappers/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..7e2dfe859bb27 --- /dev/null +++ b/recipes/tcp-wrappers/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/tcsbank-uconfig/all/conandata.yml b/recipes/tcsbank-uconfig/all/conandata.yml index c292824b18361..2bda12ab98758 100644 --- a/recipes/tcsbank-uconfig/all/conandata.yml +++ b/recipes/tcsbank-uconfig/all/conandata.yml @@ -1,7 +1,7 @@ sources: - "2.0.3": - url: "https://github.com/TinkoffCreditSystems/uconfig/archive/refs/tags/v2.0.3.tar.gz" - sha256: "a1f6278ebd6c0c7ba391651ab6f0aceeb9cb77dc6936d45dc0e6fee3f27dfcbf" "2.1.0": url: "https://github.com/TinkoffCreditSystems/uconfig/archive/refs/tags/v2.1.0.tar.gz" sha256: "1a7a8ab97b6de7fa039031caa83d8ab889d874822b06c920af3e8ddd794ab9c6" + "2.0.3": + url: "https://github.com/TinkoffCreditSystems/uconfig/archive/refs/tags/v2.0.3.tar.gz" + sha256: "a1f6278ebd6c0c7ba391651ab6f0aceeb9cb77dc6936d45dc0e6fee3f27dfcbf" diff --git a/recipes/tcsbank-uconfig/all/conanfile.py b/recipes/tcsbank-uconfig/all/conanfile.py index cf5ea147a4f0e..c374a3551f1f2 100644 --- a/recipes/tcsbank-uconfig/all/conanfile.py +++ b/recipes/tcsbank-uconfig/all/conanfile.py @@ -1,20 +1,24 @@ -from conans import ConanFile, 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.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.52.0" class TCSBankUconfigConan(ConanFile): name = "tcsbank-uconfig" description = "Lightweight, header-only, C++17 configuration library" - topics = ("conan", "configuration", "env", "json") - url = "https://github.com/conan-io/conan-center-index" - homepage = "https://github.com/TinkoffCreditSystems/uconfig" license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/Tinkoff/uconfig" + topics = ("configuration", "env", "json", "header-only") - generators = "cmake", "cmake_find_package_multi" + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" options = { "with_rapidjson": [True, False], @@ -22,59 +26,67 @@ class TCSBankUconfigConan(ConanFile): default_options = { "with_rapidjson": True, } + no_copy_source = True @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 17 @property - def _build_subfolder(self): - return "build_subfolder" + def _compilers_minimum_version(self): + return { + "Visual Studio": "16", + "msvc": "192", + "gcc": "7.3", + "clang": "6.0", + "apple-clang": "10.0" + } + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): if self.options.with_rapidjson: - self.requires("rapidjson/1.1.0") + self.requires("rapidjson/cci.20220822") - def validate(self): - compiler = str(self.settings.compiler) - compiler_version = tools.Version(self.settings.compiler.version) + def package_id(self): + self.info.clear() - min_req_cppstd = "17" + def validate(self): if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, min_req_cppstd) - else: - self.output.warn("%s recipe lacks information about the %s compiler" - " standard version support." % (self.name, compiler)) + check_min_cppstd(self, self._min_cppstd) - minimal_version = { - "Visual Studio": "16", - "gcc": "7.3", - "clang": "6.0", - "apple-clang": "10.0", - } - # Exclude not supported compilers - if compiler not in minimal_version: - self.output.info("%s requires a compiler that supports at least C++%s" % (self.name, min_req_cppstd)) - return - if compiler_version < minimal_version[compiler]: + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler)) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: raise ConanInvalidConfiguration( - "%s requires a compiler that supports at least C++%s. %s %s is not supported." % - (self.name, min_req_cppstd, compiler, compiler_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], destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) 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("*.ipp", dst="include", src=os.path.join(self._source_subfolder, "include")) + copy(self, "LICENSE", + 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, "*.ipp", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include")) def package_info(self): - self.cpp_info.names["pkg_config"] = "uconfig" - self.cpp_info.names["cmake_find_package"] = "uconfig" - self.cpp_info.names["cmake_find_package_multi"] = "uconfig" + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + self.cpp_info.set_property("cmake_file_name", "uconfig") + self.cpp_info.set_property("cmake_target_name", "uconfig::uconfig") + self.cpp_info.set_property("pkg_config_name", "uconfig") + if self.options.with_rapidjson: self.cpp_info.defines = ["RAPIDJSON_HAS_STDSTRING=1"] - def package_id(self): - self.info.header_only() + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.names["cmake_find_package"] = "uconfig" + self.cpp_info.names["cmake_find_package_multi"] = "uconfig" diff --git a/recipes/tcsbank-uconfig/all/test_package/CMakeLists.txt b/recipes/tcsbank-uconfig/all/test_package/CMakeLists.txt index 6b713d97dfd9d..5f357d4371c77 100644 --- a/recipes/tcsbank-uconfig/all/test_package/CMakeLists.txt +++ b/recipes/tcsbank-uconfig/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.15) +project(test_package LANGUAGES CXX) find_package(uconfig CONFIG REQUIRED) diff --git a/recipes/tcsbank-uconfig/all/test_package/conanfile.py b/recipes/tcsbank-uconfig/all/test_package/conanfile.py index 49a3a66ea5bad..e77da04fcdfc5 100644 --- a/recipes/tcsbank-uconfig/all/test_package/conanfile.py +++ b/recipes/tcsbank-uconfig/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,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): + os.environ["APP_VARIABLE"] = "123456" + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/tcsbank-uconfig/all/test_package/test_package.cpp b/recipes/tcsbank-uconfig/all/test_package/test_package.cpp index fb3f52a80922c..c69d651b88257 100644 --- a/recipes/tcsbank-uconfig/all/test_package/test_package.cpp +++ b/recipes/tcsbank-uconfig/all/test_package/test_package.cpp @@ -1,7 +1,9 @@ -#include #include #include +#include +#include + struct AppConfig: public uconfig::Config { uconfig::Variable variable; @@ -15,8 +17,6 @@ struct AppConfig: public uconfig::Config }; int main() { - setenv("APP_VARIABLE", "123456", 1); - AppConfig app_config; uconfig::EnvFormat formatter; @@ -24,8 +24,8 @@ int main() { std::map config_map; app_config.Emit(formatter, "APP", &config_map); - for (const auto& [name, vlaue] : config_map) { - std::cout << name << "=" << vlaue << std::endl; + for (const auto& [name, value] : config_map) { + std::cout << name << "=" << value << std::endl; } return 0; } diff --git a/recipes/tcsbank-uconfig/all/test_v1_package/CMakeLists.txt b/recipes/tcsbank-uconfig/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/tcsbank-uconfig/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/tcsbank-uconfig/all/test_v1_package/conanfile.py b/recipes/tcsbank-uconfig/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..6bbeeb230e6b0 --- /dev/null +++ b/recipes/tcsbank-uconfig/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): + os.environ["APP_VARIABLE"] = "123456" + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/tcsbank-uconfig/config.yml b/recipes/tcsbank-uconfig/config.yml index 14f04caec446d..d149ea7c80af7 100644 --- a/recipes/tcsbank-uconfig/config.yml +++ b/recipes/tcsbank-uconfig/config.yml @@ -1,5 +1,5 @@ versions: - "2.0.3": - folder: all "2.1.0": folder: all + "2.0.3": + folder: all diff --git a/recipes/tcsbank-uri-template/all/CMakeLists.txt b/recipes/tcsbank-uri-template/all/CMakeLists.txt deleted file mode 100644 index 8bdaa1e47bfa0..0000000000000 --- a/recipes/tcsbank-uri-template/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.5) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/tcsbank-uri-template/all/conandata.yml b/recipes/tcsbank-uri-template/all/conandata.yml index f958e285c4af2..b24ca0f0a2b0f 100644 --- a/recipes/tcsbank-uri-template/all/conandata.yml +++ b/recipes/tcsbank-uri-template/all/conandata.yml @@ -1,7 +1,4 @@ sources: - "1.1.3": - url: "https://github.com/TinkoffCreditSystems/uri-template/archive/refs/tags/v1.1.3.tar.gz" - sha256: "4eaf984eb7857a56b09e9ad911a77042573d1540a19b9e945369ec6384f54131" "1.1.4": url: "https://github.com/TinkoffCreditSystems/uri-template/archive/refs/tags/v1.1.4.tar.gz" sha256: "5f6e562813f1cf9ce40137db88ea4db54dc4bd77a6e5f813b106d494bbfb72b3" diff --git a/recipes/tcsbank-uri-template/all/conanfile.py b/recipes/tcsbank-uri-template/all/conanfile.py index 03a96370cbb02..aed3fb5a97334 100644 --- a/recipes/tcsbank-uri-template/all/conanfile.py +++ b/recipes/tcsbank-uri-template/all/conanfile.py @@ -1,20 +1,24 @@ -from conans import ConanFile, CMake, 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.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import collect_libs, copy, export_conandata_patches, get, rmdir +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" class TCSBankUriTemplateConan(ConanFile): name = "tcsbank-uri-template" description = "URI Templates expansion and reverse-matching for C++" - topics = ("conan", "uri-template", "url-template", "rfc-6570") + license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/TinkoffCreditSystems/uri-template" - license = "Apache-2.0" + topics = ("uri-template", "url-template", "rfc-6570") - generators = "cmake", "cmake_find_package_multi" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -24,28 +28,9 @@ class TCSBankUriTemplateConan(ConanFile): "shared": False, "fPIC": True, } - exports_sources = [ - "CMakeLists.txt", - "patches/*", - ] - - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["URITEMPLATE_BUILD_TESTING"] = False - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -53,55 +38,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 validate(self): compiler_name = str(self.settings.compiler) - compiler_version = tools.Version(self.settings.compiler.version) + compiler_version = Version(self.settings.compiler.version) # Exclude compiler.cppstd < 17 min_req_cppstd = "17" if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, min_req_cppstd) - else: - self.output.warn("%s recipe lacks information about the %s compiler" - " standard version support." % (self.name, compiler_name)) + check_min_cppstd(self, min_req_cppstd) - # Exclude not supported compilers + # Exclude unsupported compilers compilers_required = { "Visual Studio": "16", + "msvc": "192", "gcc": "7.3", "clang": "6.0", "apple-clang": "10.0", } - if compiler_name not in compilers_required or compiler_version < compilers_required[compiler_name]: + if compiler_name in compilers_required and compiler_version < compilers_required[compiler_name]: raise ConanInvalidConfiguration( - "%s requires a compiler that supports at least C++%s. %s %s is not supported." % - (self.name, min_req_cppstd, compiler_name, compiler_version)) + f"{self.name} requires a compiler that supports at least C++{min_req_cppstd}. " + f"{compiler_name} {compiler_version} is not supported." + ) # Check stdlib ABI compatibility if compiler_name == "gcc" and self.settings.compiler.libcxx != "libstdc++11": - raise ConanInvalidConfiguration('Using %s with GCC requires "compiler.libcxx=libstdc++11"' % self.name) + raise ConanInvalidConfiguration( + f'Using {self.name} with GCC requires "compiler.libcxx=libstdc++11"' + ) elif compiler_name == "clang" and self.settings.compiler.libcxx not in ["libstdc++11", "libc++"]: - raise ConanInvalidConfiguration('Using %s with Clang requires either "compiler.libcxx=libstdc++11"' - ' or "compiler.libcxx=libc++"' % self.name) + raise ConanInvalidConfiguration( + f'Using {self.name} with Clang requires either "compiler.libcxx=libstdc++11" or "compiler.libcxx=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 generate(self): + tc = CMakeToolchain(self) + tc.variables["URITEMPLATE_BUILD_TESTING"] = False + tc.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")) - 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["pkg_config"] = "uri-template" + self.cpp_info.set_property("cmake_file_name", "uri-template") + self.cpp_info.set_property("cmake_target_name", "uri-template::uri-template") + self.cpp_info.set_property("pkg_config_name", "uri-template") + self.cpp_info.libs = collect_libs(self) + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.names["cmake_find_package"] = "uri-template" self.cpp_info.names["cmake_find_package_multi"] = "uri-template" - self.cpp_info.libs = tools.collect_libs(self) diff --git a/recipes/tcsbank-uri-template/all/test_package/CMakeLists.txt b/recipes/tcsbank-uri-template/all/test_package/CMakeLists.txt index cb4d85b99bbcf..bf76cb9ad5867 100644 --- a/recipes/tcsbank-uri-template/all/test_package/CMakeLists.txt +++ b/recipes/tcsbank-uri-template/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(uri-template REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/tcsbank-uri-template/all/test_package/conanfile.py b/recipes/tcsbank-uri-template/all/test_package/conanfile.py index 49a3a66ea5bad..ef5d7042163ec 100644 --- a/recipes/tcsbank-uri-template/all/test_package/conanfile.py +++ b/recipes/tcsbank-uri-template/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/tcsbank-uri-template/all/test_package/test_package.cpp b/recipes/tcsbank-uri-template/all/test_package/test_package.cpp index b8f028352cf82..91928632cfcba 100644 --- a/recipes/tcsbank-uri-template/all/test_package/test_package.cpp +++ b/recipes/tcsbank-uri-template/all/test_package/test_package.cpp @@ -1,6 +1,7 @@ -#include #include +#include + int main() { const std::string uri = "http://example.com/search?q=cat&lang=en"; // Parse the template diff --git a/recipes/tcsbank-uri-template/all/test_v1_package/CMakeLists.txt b/recipes/tcsbank-uri-template/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/tcsbank-uri-template/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/tcsbank-uri-template/all/test_v1_package/conanfile.py b/recipes/tcsbank-uri-template/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..49a3a66ea5bad --- /dev/null +++ b/recipes/tcsbank-uri-template/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/tcsbank-uri-template/config.yml b/recipes/tcsbank-uri-template/config.yml index c744acd213406..db1dc037a6a68 100644 --- a/recipes/tcsbank-uri-template/config.yml +++ b/recipes/tcsbank-uri-template/config.yml @@ -1,6 +1,4 @@ versions: - "1.1.3": - folder: all "1.1.4": folder: all "1.2.1": diff --git a/recipes/teemo/all/conandata.yml b/recipes/teemo/all/conandata.yml index 490c174ebfda5..0b1e02d58ccdc 100644 --- a/recipes/teemo/all/conandata.yml +++ b/recipes/teemo/all/conandata.yml @@ -1,7 +1,7 @@ sources: "2.7": url: "https://github.com/winsoft666/teemo/archive/refs/tags/v2.7.tar.gz" - sha256: "97be8ae62cd3e2e92ed0ff405dfaf5e6cb6e323b21c53e798adfa5872a2f7084" + sha256: "0cf4f90d22b1c19845db08ff1addc5872327b33f020e8d5409f3819391afaf79" patches: "2.7": diff --git a/recipes/teemo/all/conanfile.py b/recipes/teemo/all/conanfile.py index c34c6cc5a1060..1935bbe91290d 100644 --- a/recipes/teemo/all/conanfile.py +++ b/recipes/teemo/all/conanfile.py @@ -27,6 +27,7 @@ class TeemoConan(ConanFile): "shared": False, "fPIC": True, } + deprecated = "zoe" @property def _min_cppstd(self): @@ -47,13 +48,14 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("libcurl/7.86.0") + self.requires("libcurl/[>=7.78.0 <9]") + self.requires("openssl/[>=1.1 <4]", transitive_headers=True) 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.") + 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) @@ -96,6 +98,6 @@ def package_info(self): 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/tensorflow-lite/all/conandata.yml b/recipes/tensorflow-lite/all/conandata.yml index 42304f36f76b1..ab25e5805cf91 100644 --- a/recipes/tensorflow-lite/all/conandata.yml +++ b/recipes/tensorflow-lite/all/conandata.yml @@ -1,14 +1,49 @@ sources: + "2.15.0": + url: "https://github.com/tensorflow/tensorflow/archive/refs/tags/v2.15.0.tar.gz" + sha256: "9cec5acb0ecf2d47b16891f8bc5bc6fbfdffe1700bdadc0d9ebe27ea34f0c220" + "2.12.0": + url: "https://github.com/tensorflow/tensorflow/archive/refs/tags/v2.12.0.tar.gz" + sha256: "c030cb1905bff1d2446615992aad8d8d85cbe90c4fb625cee458c63bf466bc8e" "2.10.0": url: "https://github.com/tensorflow/tensorflow/archive/refs/tags/v2.10.0.tar.gz" sha256: "b5a1bb04c84b6fe1538377e5a1f649bb5d5f0b2e3625a3c526ff3a8af88633e8" patches: + "2.15.0": + - patch_file: "patches/2.15.0-0001-disable-fetch-content.patch" + patch_description: "Fail if the CMake build script tries to fetch external dependencies" + patch_type: "conan" + - patch_file: "patches/2.15.0-0002-windows-mmap.patch" + patch_description: "Disable mmap on Windows." + patch_type: "bugfix" + patch_source: "https://github.com/tensorflow/tensorflow/pull/62636" + - patch_file: "patches/2.15.0-0003-use-cci-dependencies.patch" + patch_description: "Dependency compatibility: Patch CMakeLists.txt, updating package names, target names, etc" + patch_type: "conan" + "2.12.0": + - patch_file: "patches/2.12.0-0001-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." + patch_type: "conan" + - patch_file: "patches/2.12.0-0002-disable-fetch-content.patch" + patch_description: "Fail if the CMake build script tries to fetch external dependencies" + patch_type: "conan" + - patch_file: "patches/2.12.0-0003-use-cci-dependencies.patch" + patch_description: "Dependency compatibility: Patch CMakeLists.txt, updating package names, target names, etc" + patch_type: "conan" + - patch_file: "patches/2.12.0-0004-use-add-stdint-for-int-types.patch" + patch_description: "Add stdint.h for int types in internal::Spectrogram" + patch_type: "bugfix" + patch_source: "https://github.com/tensorflow/tensorflow/pull/60299" "2.10.0": - - patch_file: "patches/remove_simple_memory_arena_debug_dump.patch" + - patch_file: "patches/2.10.0-0001-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." - - patch_file: "patches/disable_fetch_content.patch" + - patch_file: "patches/2.10.0-0002-disable_fetch_content.patch" patch_description: "Fail if the CMake build script tries to fetch external dependencies" patch_type: "conan" - - patch_file: "patches/dependencies_2_10.patch" + - patch_file: "patches/2.10.0-0003-use-cci-dependencies.patch" patch_description: "Dependency compatibility: Patch CMakeLists.txt, updating package names, target names, etc" patch_type: "conan" + - patch_file: "patches/2.10.0-0004-use-add-stdint-for-int-types.patch" + patch_description: "Add stdint.h for int types in internal::Spectrogram" + patch_type: "bugfix" + patch_source: "https://github.com/tensorflow/tensorflow/pull/60299" diff --git a/recipes/tensorflow-lite/all/conanfile.py b/recipes/tensorflow-lite/all/conanfile.py index f780e991d21b0..dd383c7b99b3e 100644 --- a/recipes/tensorflow-lite/all/conanfile.py +++ b/recipes/tensorflow-lite/all/conanfile.py @@ -1,13 +1,14 @@ from conan import ConanFile -from conan.tools.scm import Version -from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout +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.env import VirtualBuildEnv from conan.tools.files import get, save, copy, export_conandata_patches, apply_conandata_patches -from conan.errors import ConanInvalidConfiguration +from conan.tools.scm import Version from os.path import join import textwrap -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class TensorflowLiteConan(ConanFile): @@ -18,7 +19,7 @@ class TensorflowLiteConan(ConanFile): description = ("TensorFlow Lite is a set of tools that enables on-device machine learning " "by helping developers run their models on mobile, embedded, and IoT devices.") topics = ("machine-learning", "neural-networks", "deep-learning") - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -39,11 +40,16 @@ class TensorflowLiteConan(ConanFile): short_paths = True + @property + def _min_cppstd(self): + return "17" + @property def _compilers_minimum_version(self): return { "gcc": "8", "Visual Studio": "15.8", + "msvc": "191", "clang": "5", "apple-clang": "5.1", } @@ -61,30 +67,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") + + @property + def _needs_fxdiv(self): + return Version(self.version) >= "2.12.0" def requirements(self): - self.requires("abseil/20220623.0") + self.requires("abseil/20230125.3") self.requires("eigen/3.4.0") self.requires("farmhash/cci.20190513") self.requires("fft/cci.20061228") - self.requires("flatbuffers/2.0.6") + if Version(self.version) < "2.15.0": + self.requires("flatbuffers/23.3.3", transitive_headers=True) + else: + self.requires("flatbuffers/23.5.26", transitive_headers=True) self.requires("gemmlowp/cci.20210928") + self.requires("ruy/cci.20231129") 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.20220801") + self.requires("xnnpack/cci.20231026") + if Version(self.version) >= "2.12.0" or self.options.with_xnnpack: + self.requires("pthreadpool/cci.20231129") if self.options.with_xnnpack or self.options.get_safe("with_nnapi", False): self.requires("fp16/cci.20210320") + if self._needs_fxdiv: + self.requires("fxdiv/cci.20200417") + + def validate(self): + if self.settings.get_safe("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 build_requirements(self): - self.tool_requires("cmake/3.24.0") + self.tool_requires("cmake/[>=3.16 <4]") - def layout(self): - cmake_layout(self, build_folder=f"build_folder/{self.settings.build_type}") + 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.variables.update({ "CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS": True, @@ -94,6 +126,7 @@ def generate(self): "TFLITE_ENABLE_XNNPACK": self.options.with_xnnpack, "TFLITE_ENABLE_MMAP": self.options.get_safe("with_mmap", False), "FETCHCONTENT_FULLY_DISCONNECTED": True, + "SYSTEM_PTHREADPOOL": True, "clog_POPULATED": True, }) if self.settings.arch == "armv8": @@ -103,19 +136,6 @@ def generate(self): 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) @@ -141,9 +161,10 @@ def _module_file(self): def package(self): 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, "version.h", join(self.source_folder, "tensorflow", "core", "public"), join(self.package_folder, "include", "tensorflow", "core", "public")) + copy(self, "*.a", self.build_folder, join(self.package_folder, "lib"), keep_path=False) + copy(self, "*.so", self.build_folder, join(self.package_folder, "lib"), keep_path=False) + copy(self, "*.dylib", self.build_folder, join(self.package_folder, "lib"), keep_path=False) 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)) diff --git a/recipes/tensorflow-lite/all/patches/remove_simple_memory_arena_debug_dump.patch b/recipes/tensorflow-lite/all/patches/2.10.0-0001-remove_simple_memory_arena_debug_dump.patch similarity index 100% rename from recipes/tensorflow-lite/all/patches/remove_simple_memory_arena_debug_dump.patch rename to recipes/tensorflow-lite/all/patches/2.10.0-0001-remove_simple_memory_arena_debug_dump.patch diff --git a/recipes/tensorflow-lite/all/patches/disable_fetch_content.patch b/recipes/tensorflow-lite/all/patches/2.10.0-0002-disable_fetch_content.patch similarity index 100% rename from recipes/tensorflow-lite/all/patches/disable_fetch_content.patch rename to recipes/tensorflow-lite/all/patches/2.10.0-0002-disable_fetch_content.patch diff --git a/recipes/tensorflow-lite/all/patches/2.10.0-0003-use-cci-dependencies.patch b/recipes/tensorflow-lite/all/patches/2.10.0-0003-use-cci-dependencies.patch new file mode 100644 index 0000000000000..89fb68b136f0d --- /dev/null +++ b/recipes/tensorflow-lite/all/patches/2.10.0-0003-use-cci-dependencies.patch @@ -0,0 +1,78 @@ +--- a/tensorflow/lite/CMakeLists.txt 2023-04-12 18:04:31 ++++ b/tensorflow/lite/CMakeLists.txt 2023-04-13 08:40:25 +@@ -138,12 +138,11 @@ + 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(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) +@@ -151,6 +150,11 @@ + # We used to have an actual compilation logic with flatc but decided to use + # schema_generated.h since flatc doesn't work with cross compilation. + set(TFLITE_FLATBUFFERS_SCHEMA_DIR "${TFLITE_SOURCE_DIR}/schema") ++if(TARGET flatbuffers::flatbuffers_shared) ++ set(FLATBUFFERS_TARGET flatbuffers::flatbuffers_shared) ++else() ++ set(FLATBUFFERS_TARGET flatbuffers::flatbuffers) ++endif() + set(TF_TARGET_PRIVATE_OPTIONS "") + if(CMAKE_CXX_COMPILER_ID MATCHES "Clang$") + # TensorFlow uses a heap of deprecated proto fields so surpress these +@@ -162,6 +166,10 @@ + 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. +@@ -406,12 +414,14 @@ + if(TFLITE_ENABLE_XNNPACK) + find_package(fp16_headers REQUIRED) + find_package(xnnpack REQUIRED) ++ find_package(pthreadpool REQUIRED) + populate_tflite_source_vars("delegates/xnnpack" + TFLITE_DELEGATES_XNNPACK_SRCS + FILTER ".*(_test|_tester)\\.(cc|h)" + ) + list(APPEND TFLITE_TARGET_DEPENDENCIES +- XNNPACK ++ xnnpack::xnnpack ++ pthreadpool::pthreadpool + ) + list(APPEND TFLITE_TARGET_PUBLIC_OPTIONS "-DTFLITE_BUILD_WITH_XNNPACK_DELEGATE") + endif() +@@ -519,17 +529,16 @@ + 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_TARGET} ++ gemmlowp::eight_bit_int_gemm + ruy::ruy + ${CMAKE_DL_LIBS} + ${TFLITE_TARGET_DEPENDENCIES} diff --git a/recipes/tensorflow-lite/all/patches/2.10.0-0004-use-add-stdint-for-int-types.patch b/recipes/tensorflow-lite/all/patches/2.10.0-0004-use-add-stdint-for-int-types.patch new file mode 100644 index 0000000000000..b57b09d18bd58 --- /dev/null +++ b/recipes/tensorflow-lite/all/patches/2.10.0-0004-use-add-stdint-for-int-types.patch @@ -0,0 +1,12 @@ +diff --git a/tensorflow/lite/kernels/internal/spectrogram.cc b/tensorflow/lite/kernels/internal/spectrogram.cc +index a832962a..919eebeb 100644 +--- a/tensorflow/lite/kernels/internal/spectrogram.cc ++++ b/tensorflow/lite/kernels/internal/spectrogram.cc +@@ -17,6 +17,7 @@ limitations under the License. + + #include + #include ++#include + + #include "third_party/fft2d/fft.h" + diff --git a/recipes/tensorflow-lite/all/patches/2.12.0-0001-remove_simple_memory_arena_debug_dump.patch b/recipes/tensorflow-lite/all/patches/2.12.0-0001-remove_simple_memory_arena_debug_dump.patch new file mode 100644 index 0000000000000..4753a3d1bac63 --- /dev/null +++ b/recipes/tensorflow-lite/all/patches/2.12.0-0001-remove_simple_memory_arena_debug_dump.patch @@ -0,0 +1,14 @@ +diff --git a/tensorflow/lite/CMakeLists.txt b/tensorflow/lite/CMakeLists.txt +index c71a392..7260efe 100644 +--- a/tensorflow/lite/CMakeLists.txt ++++ b/tensorflow/lite/CMakeLists.txt +@@ -221,6 +221,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) ++if(CMAKE_SYSTEM_NAME MATCHES "Windows" AND BUILD_SHARED_LIBS) ++ list(FILTER TFLITE_SRCS EXCLUDE REGEX ".*simple_memory_arena_debug_dump\\.cc$") ++endif() + + # This particular file is excluded because the more explicit approach to enable + # XNNPACK delegate is preferred to the weak-symbol one. diff --git a/recipes/tensorflow-lite/all/patches/2.12.0-0002-disable-fetch-content.patch b/recipes/tensorflow-lite/all/patches/2.12.0-0002-disable-fetch-content.patch new file mode 100644 index 0000000000000..d3bfdf275681e --- /dev/null +++ b/recipes/tensorflow-lite/all/patches/2.12.0-0002-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 9ed9510..4a6a45d 100644 +--- a/tensorflow/lite/tools/cmake/modules/OverridableFetchContent.cmake ++++ b/tensorflow/lite/tools/cmake/modules/OverridableFetchContent.cmake +@@ -251,6 +251,7 @@ function(OverridableFetchContent_Declare CONTENT_NAME) + URL_HASH + URL_MD5 + ) ++ message(FATAL_ERROR "OverridableFetchContent_Declare called by ${CONTENT_NAME}! Failing build.") + set(ALL_VALUE_ARGS LICENSE_FILE LICENSE_URL ${OVERRIDABLE_ARGS}) + cmake_parse_arguments(ARGS + "" diff --git a/recipes/tensorflow-lite/all/patches/2.12.0-0003-use-cci-dependencies.patch b/recipes/tensorflow-lite/all/patches/2.12.0-0003-use-cci-dependencies.patch new file mode 100644 index 0000000000000..be146c5e56c09 --- /dev/null +++ b/recipes/tensorflow-lite/all/patches/2.12.0-0003-use-cci-dependencies.patch @@ -0,0 +1,103 @@ +diff --git a/tensorflow/lite/CMakeLists.txt b/tensorflow/lite/CMakeLists.txt +index 24b8265..d95c0ae 100644 +--- a/tensorflow/lite/CMakeLists.txt ++++ b/tensorflow/lite/CMakeLists.txt +@@ -142,31 +142,17 @@ endmacro() + find_package(absl REQUIRED) + find_package(Eigen3 REQUIRED) + find_package(farmhash REQUIRED) +-find_package(fft2d REQUIRED) ++find_package(fft REQUIRED) + find_package(Flatbuffers REQUIRED) + find_package(gemmlowp REQUIRED) +-find_package(NEON_2_SSE REQUIRED) + find_package(cpuinfo REQUIRED) #CPUINFO is used by XNNPACK and RUY library + find_package(ruy REQUIRED) +-# Download necessary dependencies. +-# Download pthreadpool source package if it doesn't exist. +-if(NOT DEFINED PTHREADPOOL_SOURCE_DIR) +- message(STATUS "Downloading pthreadpool to ${CMAKE_BINARY_DIR}/pthreadpool-source (define PTHREADPOOL_SOURCE_DIR to avoid it)") +- configure_file(cmake/DownloadPThreadPool.cmake "${CMAKE_BINARY_DIR}/pthreadpool-download/CMakeLists.txt") +- execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" . +- WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/pthreadpool-download") +- execute_process(COMMAND "${CMAKE_COMMAND}" --build . +- WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/pthreadpool-download") +- set(PTHREADPOOL_SOURCE_DIR "${CMAKE_BINARY_DIR}/pthreadpool-source" CACHE STRING "pthreadpool source directory") +-endif() +-# Configure pthreadpool +-if(NOT TARGET pthreadpool) +- set(PTHREADPOOL_BUILD_TESTS OFF CACHE BOOL "") +- set(PTHREADPOOL_BUILD_BENCHMARKS OFF CACHE BOOL "") +- set(PTHREADPOOL_ALLOW_DEPRECATED_API OFF CACHE BOOL "") +- add_subdirectory( +- "${PTHREADPOOL_SOURCE_DIR}" +- "${CMAKE_BINARY_DIR}/pthreadpool") ++find_package(pthreadpool REQUIRED) ++ ++if(TARGET flatbuffers::flatbuffers_shared) ++ set(FLATBUFFERS_TARGET flatbuffers::flatbuffers_shared) ++else() ++ set(FLATBUFFERS_TARGET flatbuffers::flatbuffers) + endif() + set(TF_TARGET_PRIVATE_OPTIONS "") + if(CMAKE_CXX_COMPILER_ID MATCHES "Clang$") +@@ -180,6 +166,10 @@ set(TFLITE_TARGET_PRIVATE_OPTIONS "") + set(TFLITE_TARGET_PRIVATE_DEFINITIONS "") + # 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. +@@ -429,13 +419,13 @@ else() + endif() + if(TFLITE_ENABLE_XNNPACK) + find_package(fp16_headers REQUIRED) +- find_package(XNNPACK REQUIRED) ++ find_package(xnnpack REQUIRED) + populate_tflite_source_vars("delegates/xnnpack" + TFLITE_DELEGATES_XNNPACK_SRCS + 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() +@@ -492,6 +482,7 @@ populate_tflite_source_vars("kernels/internal/reference/sparse_ops" + TFLITE_KERNEL_INTERNAL_REF_SPARSE_OPS_SRCS + ) + set(TFLITE_PROFILER_SRCS ++${TFLITE_SOURCE_DIR}/profiling/telemetry/telemetry.cc + ${TFLITE_SOURCE_DIR}/profiling/platform_profiler.cc + ${TFLITE_SOURCE_DIR}/profiling/root_profiler.h + ${TFLITE_SOURCE_DIR}/profiling/root_profiler.cc +@@ -555,19 +546,18 @@ target_include_directories(tensorflow-lite + target_link_libraries(tensorflow-lite + PUBLIC + Eigen3::Eigen +- NEON_2_SSE::NEON_2_SSE + absl::flags + absl::hash + absl::status + absl::strings + absl::synchronization + absl::variant +- farmhash +- fft2d_fftsg2d +- flatbuffers::flatbuffers +- gemmlowp ++ farmhash::farmhash ++ fft::fft ++ ${FLATBUFFERS_TARGET} ++ gemmlowp::eight_bit_int_gemm + ruy::ruy +- pthreadpool ++ pthreadpool::pthreadpool + ${CMAKE_DL_LIBS} + ${TFLITE_TARGET_DEPENDENCIES} + ) diff --git a/recipes/tensorflow-lite/all/patches/2.12.0-0004-use-add-stdint-for-int-types.patch b/recipes/tensorflow-lite/all/patches/2.12.0-0004-use-add-stdint-for-int-types.patch new file mode 100644 index 0000000000000..b57b09d18bd58 --- /dev/null +++ b/recipes/tensorflow-lite/all/patches/2.12.0-0004-use-add-stdint-for-int-types.patch @@ -0,0 +1,12 @@ +diff --git a/tensorflow/lite/kernels/internal/spectrogram.cc b/tensorflow/lite/kernels/internal/spectrogram.cc +index a832962a..919eebeb 100644 +--- a/tensorflow/lite/kernels/internal/spectrogram.cc ++++ b/tensorflow/lite/kernels/internal/spectrogram.cc +@@ -17,6 +17,7 @@ limitations under the License. + + #include + #include ++#include + + #include "third_party/fft2d/fft.h" + diff --git a/recipes/tensorflow-lite/all/patches/2.15.0-0001-disable-fetch-content.patch b/recipes/tensorflow-lite/all/patches/2.15.0-0001-disable-fetch-content.patch new file mode 100644 index 0000000000000..adc6f0561afef --- /dev/null +++ b/recipes/tensorflow-lite/all/patches/2.15.0-0001-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/2.15.0-0002-windows-mmap.patch b/recipes/tensorflow-lite/all/patches/2.15.0-0002-windows-mmap.patch new file mode 100644 index 0000000000000..1305e34c37c6d --- /dev/null +++ b/recipes/tensorflow-lite/all/patches/2.15.0-0002-windows-mmap.patch @@ -0,0 +1,20 @@ +commit 77056b1ab930c36c8066446615577be4d121e3ea +Author: talyz +Date: Thu Dec 14 11:43:16 2023 +0100 + + cmake: Disable the use of mmap on Windows + +diff --git a/tensorflow/lite/CMakeLists.txt b/tensorflow/lite/CMakeLists.txt +index 83bc7629004..0958ed1b9ce 100644 +--- a/tensorflow/lite/CMakeLists.txt ++++ b/tensorflow/lite/CMakeLists.txt +@@ -202,7 +202,8 @@ if(CMAKE_SYSTEM_NAME MATCHES "Windows") + # Use NOMINMAX to disable the min / max macros in windows.h as they break + # use of std::min std::max. + # Use NOGDI to ERROR macro which breaks TensorFlow logging. +- list(APPEND TFLITE_TARGET_PRIVATE_OPTIONS "-DNOMINMAX" "-DNOGDI") ++ # Disable mmap, which is not available on Windows. ++ list(APPEND TFLITE_TARGET_PRIVATE_OPTIONS "-DNOMINMAX" "-DNOGDI" "-DTFLITE_MMAP_DISABLED") + # lite/kernels/conv.cc has more than 64k sections so enable /bigobj to + # support compilation with MSVC2015. + if(MSVC) diff --git a/recipes/tensorflow-lite/all/patches/2.15.0-0003-use-cci-dependencies.patch b/recipes/tensorflow-lite/all/patches/2.15.0-0003-use-cci-dependencies.patch new file mode 100644 index 0000000000000..2c7c5965e2927 --- /dev/null +++ b/recipes/tensorflow-lite/all/patches/2.15.0-0003-use-cci-dependencies.patch @@ -0,0 +1,68 @@ +diff --git a/tensorflow/lite/CMakeLists.txt b/tensorflow/lite/CMakeLists.txt +index 0958ed1b9ce..13d06f12ca6 100644 +--- a/tensorflow/lite/CMakeLists.txt ++++ b/tensorflow/lite/CMakeLists.txt +@@ -147,7 +147,7 @@ set(TFLITE_TARGET_DEPENDENCIES "") + find_package(absl REQUIRED) + find_package(Eigen3 REQUIRED) + find_package(farmhash REQUIRED) +-find_package(fft2d REQUIRED) ++find_package(fft REQUIRED) + find_package(FlatBuffers REQUIRED) + find_package(gemmlowp REQUIRED) + if (NOT CMAKE_SYSTEM_PROCESSOR OR CMAKE_SYSTEM_PROCESSOR MATCHES "x86") +@@ -155,7 +155,6 @@ if (NOT CMAKE_SYSTEM_PROCESSOR OR CMAKE_SYSTEM_PROCESSOR MATCHES "x86") + list(APPEND TFLITE_TARGET_DEPENDENCIES NEON_2_SSE::NEON_2_SSE) + endif() + find_package(cpuinfo REQUIRED) #CPUINFO is used by XNNPACK and RUY library +-find_package(ml_dtypes REQUIRED) + find_package(ruy REQUIRED) + # Include TSL, which is in tensorflow/third_party + include_directories( +@@ -183,6 +182,11 @@ if(NOT SYSTEM_PTHREADPOOL AND NOT TARGET pthreadpool) + "${PTHREADPOOL_SOURCE_DIR}" + "${CMAKE_BINARY_DIR}/pthreadpool") + endif() ++if(TARGET flatbuffers::flatbuffers_shared) ++ set(FLATBUFFERS_TARGET flatbuffers::flatbuffers_shared) ++else() ++ set(FLATBUFFERS_TARGET flatbuffers::flatbuffers) ++endif() + set(TF_TARGET_PRIVATE_OPTIONS "") + if(CMAKE_CXX_COMPILER_ID MATCHES "Clang$") + # TensorFlow uses a heap of deprecated proto fields so surpress these +@@ -483,13 +487,13 @@ else() + endif() + if(TFLITE_ENABLE_XNNPACK) + find_package(fp16_headers REQUIRED) +- find_package(XNNPACK REQUIRED) ++ find_package(xnnpack REQUIRED) + populate_tflite_source_vars("delegates/xnnpack" + TFLITE_DELEGATES_XNNPACK_SRCS + 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() +@@ -633,13 +637,12 @@ target_link_libraries(tensorflow-lite + absl::strings + absl::synchronization + absl::variant +- farmhash +- fft2d_fftsg2d +- flatbuffers::flatbuffers +- gemmlowp::gemmlowp +- ml_dtypes ++ farmhash::farmhash ++ fft::fft ++ ${FLATBUFFERS_TARGET} ++ gemmlowp::eight_bit_int_gemm + ruy::ruy +- pthreadpool ++ pthreadpool::pthreadpool + ${CMAKE_DL_LIBS} + ${TFLITE_TARGET_DEPENDENCIES} + ) diff --git a/recipes/tensorflow-lite/all/patches/dependencies_2_10.patch b/recipes/tensorflow-lite/all/patches/dependencies_2_10.patch deleted file mode 100644 index a82533faee2e8..0000000000000 --- a/recipes/tensorflow-lite/all/patches/dependencies_2_10.patch +++ /dev/null @@ -1,68 +0,0 @@ -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/test_package/conanfile.py b/recipes/tensorflow-lite/all/test_package/conanfile.py index 841a097747d32..8321ed4e2de49 100644 --- a/recipes/tensorflow-lite/all/test_package/conanfile.py +++ b/recipes/tensorflow-lite/all/test_package/conanfile.py @@ -22,6 +22,5 @@ def build(self): def test(self): if can_run(self): - model_path = os.path.join(self.source_folder, "model.tflite") command = os.path.join(self.cpp.build.bindirs[0], "test_package") - self.run(f"{command} {model_path}", env="conanrun") + self.run(command, env="conanrun") diff --git a/recipes/tensorflow-lite/all/test_package/model.tflite b/recipes/tensorflow-lite/all/test_package/model.tflite deleted file mode 100644 index 281cb988ba465..0000000000000 Binary files a/recipes/tensorflow-lite/all/test_package/model.tflite and /dev/null differ diff --git a/recipes/tensorflow-lite/all/test_package/test_package.cpp b/recipes/tensorflow-lite/all/test_package/test_package.cpp index 4a4921bbf217f..21834b32a2984 100644 --- a/recipes/tensorflow-lite/all/test_package/test_package.cpp +++ b/recipes/tensorflow-lite/all/test_package/test_package.cpp @@ -1,40 +1,15 @@ -#include #include #include -#include - #include -#include int main(int argc, char * argv[]) { - if ( argc != 2) { - std::cerr << "Pass model file path as argument" << std::endl; - return -1; - } - auto model = tflite::FlatBufferModel::BuildFromFile(argv[1]); - if (!model) { - throw std::runtime_error("Failed to load TFLite model"); - } - - tflite::ops::builtin::BuiltinOpResolver resolver; - tflite::InterpreterBuilder builder(*model, resolver); std::unique_ptr interpreter; - builder(&interpreter); + interpreter = std::make_unique(); - if (interpreter->AllocateTensors() != kTfLiteOk) { - throw std::runtime_error("Failed to allocate tensors"); - } + const int num_tensors = interpreter->tensors_size(); + std::cout << "Number of tensors in the interpreter: " << num_tensors << std::endl; - tflite::PrintInterpreterState(interpreter.get()); - auto input = interpreter->typed_input_tensor(0); - *input = 42.0F; - std::cout << "==== Running SQUARE(x) Model ====\n\n"; - if (interpreter->Invoke() != kTfLiteOk) { - throw std::runtime_error("Failed to execute model"); - } - auto output = interpreter->typed_output_tensor(0); - std::cout << "SQUARE(" << *input << ") = " << *output << std::endl; return 0; } diff --git a/recipes/tensorflow-lite/all/test_v1_package/CMakeLists.txt b/recipes/tensorflow-lite/all/test_v1_package/CMakeLists.txt index ff2f7e7d39536..0d20897301b68 100644 --- a/recipes/tensorflow-lite/all/test_v1_package/CMakeLists.txt +++ b/recipes/tensorflow-lite/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(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) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/tensorflow-lite/all/test_v1_package/conanfile.py b/recipes/tensorflow-lite/all/test_v1_package/conanfile.py index 17a163fae24bd..b6d768011ed00 100644 --- a/recipes/tensorflow-lite/all/test_v1_package/conanfile.py +++ b/recipes/tensorflow-lite/all/test_v1_package/conanfile.py @@ -14,6 +14,5 @@ def build(self): 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) + self.run(command, run_environment=True) diff --git a/recipes/tensorflow-lite/config.yml b/recipes/tensorflow-lite/config.yml index 22d65dcfdfac6..7e71186249830 100644 --- a/recipes/tensorflow-lite/config.yml +++ b/recipes/tensorflow-lite/config.yml @@ -1,3 +1,7 @@ versions: + "2.15.0": + folder: all + "2.12.0": + folder: all "2.10.0": folder: all diff --git a/recipes/tensorpipe/all/conanfile.py b/recipes/tensorpipe/all/conanfile.py index 6b75a2b9a55d1..0979c77b009b6 100644 --- a/recipes/tensorpipe/all/conanfile.py +++ b/recipes/tensorpipe/all/conanfile.py @@ -17,10 +17,11 @@ class TensorpipeConan(ConanFile): "using the fastest transport for the tensors contained " \ "therein (e.g., CUDA device-to-device copy)." license = "BSD-3-Clause" - topics = ("tensorpipe", "tensor", "cuda") + topics = ("tensor", "cuda") homepage = "https://github.com/pytorch/tensorpipe" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -58,19 +59,18 @@ def layout(self): def requirements(self): self.requires("libnop/cci.20200728") - self.requires("libuv/1.44.1") + self.requires("libuv/1.44.2") def validate(self): - if self.info.settings.compiler.get_safe("cppstd"): + if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, 14) - if self.info.settings.os == "Windows": + if self.settings.os == "Windows": raise ConanInvalidConfiguration(f"{self.ref} doesn't support Windows") - if self.info.options.cuda: + if self.options.cuda: raise ConanInvalidConfiguration("cuda recipe not yet available in CCI") 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/tensorpipe/all/test_v1_package/CMakeLists.txt b/recipes/tensorpipe/all/test_v1_package/CMakeLists.txt index a071eb41c6bdd..0d20897301b68 100644 --- a/recipes/tensorpipe/all/test_v1_package/CMakeLists.txt +++ b/recipes/tensorpipe/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(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) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/termcap/all/conanfile.py b/recipes/termcap/all/conanfile.py index 5a7977cbd588b..0acd77cf30764 100644 --- a/recipes/termcap/all/conanfile.py +++ b/recipes/termcap/all/conanfile.py @@ -14,7 +14,7 @@ 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") - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -43,8 +43,7 @@ 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 _extract_sources(self): makefile_text = open(os.path.join(self.source_folder, "Makefile.in")).read() diff --git a/recipes/termcolor/all/conanfile.py b/recipes/termcolor/all/conanfile.py index 6c4c0eeda2585..1e7b2ef15d00e 100644 --- a/recipes/termcolor/all/conanfile.py +++ b/recipes/termcolor/all/conanfile.py @@ -1,36 +1,49 @@ import os -from conans import ConanFile, CMake, tools -required_conan_version = ">=1.33.0" +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, rmdir + +required_conan_version = ">=1.50.0" + class TermcolorConan(ConanFile): name = "termcolor" description = "Termcolor is a header-only C++ library for printing colored messages to the terminal." - topics = ("termcolor", "terminal", "color") + topics = ("terminal", "color") license = "BSD-3-Clause" homepage = "https://github.com/ikalnytskyi/termcolor" url = "https://github.com/conan-io/conan-center-index" + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - generators = "cmake" - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + cmake_layout(self, src_folder="src") + + def package_id(self): + 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_id(self): - self.info.header_only() + def generate(self): + tc = CMakeToolchain(self) + tc.generate() - def _configure_cmake(self): + def build(self): cmake = CMake(self) - cmake.configure(source_folder=self._source_subfolder) - return cmake + 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", "termcolor") + self.cpp_info.set_property("cmake_target_name", "termcolor::termcolor") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/termcolor/all/test_package/CMakeLists.txt b/recipes/termcolor/all/test_package/CMakeLists.txt index 07ff01a5a223c..1d45a2e0c344b 100644 --- a/recipes/termcolor/all/test_package/CMakeLists.txt +++ b/recipes/termcolor/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(termcolor REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} termcolor::termcolor) +target_link_libraries(${PROJECT_NAME} PRIVATE termcolor::termcolor) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/termcolor/all/test_package/conanfile.py b/recipes/termcolor/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/termcolor/all/test_package/conanfile.py +++ b/recipes/termcolor/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/termcolor/all/test_v1_package/CMakeLists.txt b/recipes/termcolor/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/termcolor/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/termcolor/all/test_v1_package/conanfile.py b/recipes/termcolor/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/termcolor/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/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..08462108f4e18 100644 --- a/recipes/tesseract/all/conandata.yml +++ b/recipes/tesseract/all/conandata.yml @@ -1,4 +1,22 @@ sources: + "5.5.0": + url: "https://github.com/tesseract-ocr/tesseract/archive/5.5.0.tar.gz" + sha256: "f2fb34ca035b6d087a42875a35a7a5c4155fa9979c6132365b1e5a28ebc3fc11" + "5.4.1": + url: "https://github.com/tesseract-ocr/tesseract/archive/5.4.1.tar.gz" + sha256: "c4bc2a81c12a472f445b7c2fb4705a08bd643ef467f51ec84f0e148bd368051b" + "5.4.0": + url: "https://github.com/tesseract-ocr/tesseract/archive/5.4.0.tar.gz" + sha256: "30ceffd9b86780f01cbf4eaf9b7fc59abddfcbaf5bbd52f9a633c6528cb183fd" + "5.3.4": + url: "https://github.com/tesseract-ocr/tesseract/archive/5.3.4.tar.gz" + sha256: "141afc12b34a14bb691a939b4b122db0d51bd38feda7f41696822bacea7710c7" + "5.3.3": + url: "https://github.com/tesseract-ocr/tesseract/archive/5.3.3.tar.gz" + sha256: "dc4329f85f41191b2d813b71b528ba6047745813474e583ccce8795ff2ff5681" + "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 +30,67 @@ sources: url: "https://github.com/tesseract-ocr/tesseract/archive/4.1.1.tar.gz" sha256: "2a66ff0d8595bff8f04032165e6c936389b1e5727c3ce5a27b3e059d218db1cb" patches: + "5.5.0": + - patch_file: "patches/0004-control-optimizations-5.4.0.patch" + patch_description: "fix condition for cpu optimizations" + patch_type: "portability" + - patch_file: "patches/0005-disable-install-pdb-5.5.0.patch" + patch_description: "disable installing PDB files" + patch_type: "portability" + "5.4.1": + - patch_file: "patches/0004-control-optimizations-5.4.0.patch" + patch_description: "fix condition for cpu optimizations" + patch_type: "portability" + - patch_file: "patches/0005-disable-install-pdb-5.4.1.patch" + patch_description: "disable installing PDB files" + patch_type: "portability" + "5.4.0": + - patch_file: "patches/0004-control-optimizations-5.4.0.patch" + patch_description: "fix condition for cpu optimizations" + patch_type: "portability" + "5.3.4": + - patch_file: "patches/0004-control-optimizations-5.3.3.patch" + patch_description: "fix condition for cpu optimizations" + patch_type: "portability" + "5.3.3": + - patch_file: "patches/0004-control-optimizations-5.3.3.patch" + patch_description: "fix condition for cpu optimizations" + patch_type: "portability" + "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..f4748d7b4ec1b 100644 --- a/recipes/tesseract/all/conanfile.py +++ b/recipes/tesseract/all/conanfile.py @@ -1,11 +1,14 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -from conan.tools.build import cross_building +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, export_conandata_patches, get, copy, rmdir, rm, save +from conan.tools.scm import Version + import os import textwrap -import functools -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.54.0" class TesseractConan(ConanFile): @@ -16,6 +19,7 @@ class TesseractConan(ConanFile): homepage = "https://github.com/tesseract-ocr/tesseract" topics = ("ocr", "image", "multimedia", "graphics") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -36,128 +40,122 @@ class TesseractConan(ConanFile): "with_libarchive": 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) < "5.0.0" else "17" @property - def _build_subfolder(self): - return "build_subfolder" + def _compilers_minimum_version(self): + return { + "11": { + "Visual Studio": "14", + "msvc": "190", + "gcc": "5", + "clang": "5", + "apple-clang": "6", + }, + "17": { + "Visual Studio": "16", + "msvc": "192", + "gcc": "7", + "clang": "7", + "apple-clang": "11", + }, + }.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": 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 - 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") + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("leptonica/1.82.0") + if Version(self.version) >= "5.2.0": + self.requires("leptonica/1.83.1") + else: + self.requires("leptonica/1.82.0") + if self.settings.os == "Windows" and Version(self.version) >= "5.0.0": + self.requires("libtiff/4.6.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.7.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.78.0 <9]") def validate(self): - # Check compiler version - compiler = str(self.settings.compiler) - compiler_version = tools.Version(self.settings.compiler.version.value) + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) - if tools.Version(self.version) >= "5.0.0": - # 5.0.0 requires C++-17 compiler - minimal_version = { - "Visual Studio": "16", - "gcc": "7", - "clang": "7", - "apple-clang": "11" - } - else: - minimal_version = { - "Visual Studio": "14", - "gcc": "5", - "clang": "5", - "apple-clang": "6" - } - if compiler not in minimal_version: - 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)) + 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.with_training: + # do not enforce failure and allow user to build with system cairo, pango, fontconfig + self.output.warning("*** Build with training is not yet supported, continue on your own") 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 - - 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 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.variables["Leptonica_DIR"] = self.dependencies["leptonica"].package_folder.replace("\\", "/") - cmake.configure(build_folder=self._build_subfolder) - return cmake + 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 + 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")) + 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( @@ -165,26 +163,25 @@ 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("""\ + 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): # Official CMake imported target is: # - libtesseract if < 5.0.0 - # - Tesseract::libtesseract if >= 5.0.0 (not yet released) + # - Tesseract::libtesseract if >= 5.0.0 # We provide both targets self.cpp_info.set_property("cmake_file_name", "Tesseract") self.cpp_info.set_property("cmake_target_name", "Tesseract::libtesseract") @@ -194,6 +191,8 @@ def package_info(self): # TODO: back to global scope once cmake_find_package* generators removed self.cpp_info.components["libtesseract"].libs = [self._libname] self.cpp_info.components["libtesseract"].requires = ["leptonica::leptonica"] + if self.settings.os == "Windows" and Version(self.version) >= "5.0.0": + self.cpp_info.components["libtesseract"].requires.append("libtiff::libtiff") if self.options.get_safe("with_libcurl", default=False): self.cpp_info.components["libtesseract"].requires.append("libcurl::libcurl") if self.options.get_safe("with_libarchive", default=True): @@ -205,10 +204,6 @@ def package_info(self): elif self.settings.os == "Windows": self.cpp_info.components["libtesseract"].system_libs = ["ws2_32"] - 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["cmake_find_package"] = "Tesseract" self.cpp_info.names["cmake_find_package_multi"] = "Tesseract" @@ -217,13 +212,14 @@ def package_info(self): self.cpp_info.components["libtesseract"].build_modules["cmake_find_package"] = [self._module_file_rel_path] self.cpp_info.components["libtesseract"].build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] self.cpp_info.components["libtesseract"].set_property("pkg_config_name", "tesseract") + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) @property def _libname(self): suffix = "" if self.settings.os == "Windows": - v = tools.Version(self.version) - suffix += "{}{}".format(v.major, v.minor) + v = Version(self.version) + suffix += f"{v.major}{v.minor}" if self.settings.build_type == "Debug": suffix += "d" - return "tesseract" + suffix + return f"tesseract{suffix}" 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/patches/0004-control-optimizations-5.3.3.patch b/recipes/tesseract/all/patches/0004-control-optimizations-5.3.3.patch new file mode 100644 index 0000000000000..20b11b48bfcb9 --- /dev/null +++ b/recipes/tesseract/all/patches/0004-control-optimizations-5.3.3.patch @@ -0,0 +1,11 @@ +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -166,7 +166,7 @@ + + 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) diff --git a/recipes/tesseract/all/patches/0004-control-optimizations-5.4.0.patch b/recipes/tesseract/all/patches/0004-control-optimizations-5.4.0.patch new file mode 100644 index 0000000000000..5f979a5a3b6c0 --- /dev/null +++ b/recipes/tesseract/all/patches/0004-control-optimizations-5.4.0.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 85af2df..aff97da 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -165,7 +165,7 @@ endif(ENABLE_NATIVE) + + 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) diff --git a/recipes/tesseract/all/patches/0005-disable-install-pdb-5.4.1.patch b/recipes/tesseract/all/patches/0005-disable-install-pdb-5.4.1.patch new file mode 100644 index 0000000000000..17461653a60f4 --- /dev/null +++ b/recipes/tesseract/all/patches/0005-disable-install-pdb-5.4.1.patch @@ -0,0 +1,179 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 0dec189..70a11c0 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -927,7 +927,7 @@ install( + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig + RENAME tesseract.pc) + install(TARGETS tesseract DESTINATION bin) +-if (MSVC) ++if (0) + install(FILES $ DESTINATION bin OPTIONAL) + endif() + install( +@@ -937,7 +937,7 @@ install( + RUNTIME DESTINATION bin + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) +-if (MSVC) ++if (0) + install(FILES $ DESTINATION bin OPTIONAL) + endif() + install( +diff --git a/src/training/CMakeLists.txt b/src/training/CMakeLists.txt +index 7fbf021..97fb7a4 100644 +--- a/src/training/CMakeLists.txt ++++ b/src/training/CMakeLists.txt +@@ -126,7 +126,7 @@ install( + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + generate_export_header(common_training EXPORT_MACRO_NAME + TESS_COMMON_TRAINING_API) +-if (MSVC) ++if (0) + install(FILES $ DESTINATION bin OPTIONAL) + endif() + project_group(common_training "Training Tools") +@@ -144,7 +144,7 @@ if(NOT DISABLED_LEGACY_ENGINE) + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) +- if (MSVC) ++ if (0) + install(FILES $ DESTINATION bin OPTIONAL) + endif() + endif() +@@ -162,7 +162,7 @@ if(NOT DISABLED_LEGACY_ENGINE) + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) +- if (MSVC) ++ if (0) + install(FILES $ DESTINATION bin OPTIONAL) + endif() + endif() +@@ -179,7 +179,7 @@ install( + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) +-if (MSVC) ++if (0) + install(FILES $ DESTINATION bin OPTIONAL) + endif() + +@@ -196,7 +196,7 @@ if(NOT DISABLED_LEGACY_ENGINE) + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) +- if (MSVC) ++ if (0) + install(FILES $ DESTINATION bin OPTIONAL) + endif() + endif() +@@ -213,7 +213,7 @@ install( + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) +-if (MSVC) ++if (0) + install(FILES $ DESTINATION bin OPTIONAL) + endif() + +@@ -230,7 +230,7 @@ if(NOT DISABLED_LEGACY_ENGINE) + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) +- if (MSVC) ++ if (0) + install(FILES $ DESTINATION bin OPTIONAL) + endif() + endif() +@@ -248,7 +248,7 @@ if(NOT DISABLED_LEGACY_ENGINE) + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) +- if (MSVC) ++ if (0) + install(FILES $ DESTINATION bin OPTIONAL) + endif() + endif() +@@ -265,7 +265,7 @@ install( + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) +-if (MSVC) ++if (0) + install(FILES $ DESTINATION bin OPTIONAL) + endif() + +@@ -298,7 +298,7 @@ if(ICU_FOUND) + RUNTIME DESTINATION bin + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) +- if (MSVC) ++ if (0) + install(FILES $ DESTINATION bin OPTIONAL) + endif() + generate_export_header(unicharset_training EXPORT_MACRO_NAME +@@ -317,7 +317,7 @@ if(ICU_FOUND) + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) +- if (MSVC) ++ if (0) + install(FILES $ DESTINATION bin OPTIONAL) + endif() + +@@ -333,7 +333,7 @@ if(ICU_FOUND) + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) +- if (MSVC) ++ if (0) + install(FILES $ DESTINATION bin OPTIONAL) + endif() + +@@ -349,7 +349,7 @@ if(ICU_FOUND) + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) +- if (MSVC) ++ if (0) + install(FILES $ DESTINATION bin OPTIONAL) + endif() + +@@ -365,7 +365,7 @@ if(ICU_FOUND) + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) +- if (MSVC) ++ if (0) + install(FILES $ DESTINATION bin OPTIONAL) + endif() + +@@ -381,7 +381,7 @@ if(ICU_FOUND) + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) +- if (MSVC) ++ if (0) + install(FILES $ DESTINATION bin OPTIONAL) + endif() + +@@ -398,7 +398,7 @@ if(ICU_FOUND) + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) +- if (MSVC) ++ if (0) + install(FILES $ DESTINATION bin OPTIONAL) + endif() + +@@ -457,7 +457,7 @@ if(ICU_FOUND) + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) +- if (MSVC) ++ if (0) + install(FILES $ DESTINATION bin OPTIONAL) + endif() + endif() diff --git a/recipes/tesseract/all/patches/0005-disable-install-pdb-5.5.0.patch b/recipes/tesseract/all/patches/0005-disable-install-pdb-5.5.0.patch new file mode 100644 index 0000000000000..4f18422a50e90 --- /dev/null +++ b/recipes/tesseract/all/patches/0005-disable-install-pdb-5.5.0.patch @@ -0,0 +1,179 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 6cb5a6c..1802e38 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -925,7 +925,7 @@ install( + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig + RENAME tesseract.pc) + install(TARGETS tesseract DESTINATION bin) +-if (MSVC) ++if (0) + install(FILES $ DESTINATION bin OPTIONAL) + endif() + install( +@@ -935,7 +935,7 @@ install( + RUNTIME DESTINATION bin + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) +-if (MSVC AND BUILD_SHARED_LIBS) ++if (0) + install(FILES $ DESTINATION bin OPTIONAL) + endif() + install( +diff --git a/src/training/CMakeLists.txt b/src/training/CMakeLists.txt +index c764442..97fb7a4 100644 +--- a/src/training/CMakeLists.txt ++++ b/src/training/CMakeLists.txt +@@ -126,7 +126,7 @@ install( + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + generate_export_header(common_training EXPORT_MACRO_NAME + TESS_COMMON_TRAINING_API) +-if (MSVC AND BUILD_SHARED_LIBS) ++if (0) + install(FILES $ DESTINATION bin OPTIONAL) + endif() + project_group(common_training "Training Tools") +@@ -144,7 +144,7 @@ if(NOT DISABLED_LEGACY_ENGINE) + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) +- if (MSVC) ++ if (0) + install(FILES $ DESTINATION bin OPTIONAL) + endif() + endif() +@@ -162,7 +162,7 @@ if(NOT DISABLED_LEGACY_ENGINE) + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) +- if (MSVC) ++ if (0) + install(FILES $ DESTINATION bin OPTIONAL) + endif() + endif() +@@ -179,7 +179,7 @@ install( + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) +-if (MSVC) ++if (0) + install(FILES $ DESTINATION bin OPTIONAL) + endif() + +@@ -196,7 +196,7 @@ if(NOT DISABLED_LEGACY_ENGINE) + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) +- if (MSVC) ++ if (0) + install(FILES $ DESTINATION bin OPTIONAL) + endif() + endif() +@@ -213,7 +213,7 @@ install( + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) +-if (MSVC) ++if (0) + install(FILES $ DESTINATION bin OPTIONAL) + endif() + +@@ -230,7 +230,7 @@ if(NOT DISABLED_LEGACY_ENGINE) + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) +- if (MSVC) ++ if (0) + install(FILES $ DESTINATION bin OPTIONAL) + endif() + endif() +@@ -248,7 +248,7 @@ if(NOT DISABLED_LEGACY_ENGINE) + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) +- if (MSVC) ++ if (0) + install(FILES $ DESTINATION bin OPTIONAL) + endif() + endif() +@@ -265,7 +265,7 @@ install( + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) +-if (MSVC) ++if (0) + install(FILES $ DESTINATION bin OPTIONAL) + endif() + +@@ -298,7 +298,7 @@ if(ICU_FOUND) + RUNTIME DESTINATION bin + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) +- if (MSVC AND BUILD_SHARED_LIBS) ++ if (0) + install(FILES $ DESTINATION bin OPTIONAL) + endif() + generate_export_header(unicharset_training EXPORT_MACRO_NAME +@@ -317,7 +317,7 @@ if(ICU_FOUND) + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) +- if (MSVC) ++ if (0) + install(FILES $ DESTINATION bin OPTIONAL) + endif() + +@@ -333,7 +333,7 @@ if(ICU_FOUND) + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) +- if (MSVC) ++ if (0) + install(FILES $ DESTINATION bin OPTIONAL) + endif() + +@@ -349,7 +349,7 @@ if(ICU_FOUND) + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) +- if (MSVC) ++ if (0) + install(FILES $ DESTINATION bin OPTIONAL) + endif() + +@@ -365,7 +365,7 @@ if(ICU_FOUND) + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) +- if (MSVC) ++ if (0) + install(FILES $ DESTINATION bin OPTIONAL) + endif() + +@@ -381,7 +381,7 @@ if(ICU_FOUND) + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) +- if (MSVC) ++ if (0) + install(FILES $ DESTINATION bin OPTIONAL) + endif() + +@@ -398,7 +398,7 @@ if(ICU_FOUND) + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) +- if (MSVC) ++ if (0) + install(FILES $ DESTINATION bin OPTIONAL) + endif() + +@@ -457,7 +457,7 @@ if(ICU_FOUND) + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) +- if (MSVC) ++ if (0) + install(FILES $ DESTINATION bin OPTIONAL) + endif() + endif() 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_package/test_package.cpp b/recipes/tesseract/all/test_package/test_package.cpp index c7c20b350dbbc..347eb5141c4c3 100644 --- a/recipes/tesseract/all/test_package/test_package.cpp +++ b/recipes/tesseract/all/test_package/test_package.cpp @@ -1,11 +1,9 @@ -#include -#include #include +#include + int main(int argc, char **argv) { - printf("Tesseract version: %s\n", tesseract::TessBaseAPI::Version()); - printf("Leptonica version: %d.%d.%d\n", LIBLEPT_MAJOR_VERSION, LIBLEPT_MINOR_VERSION, LIBLEPT_PATCH_VERSION); - printf("Lib versions: %s\n", getImagelibVersions()); - return 0; + printf("Tesseract version: %s\n", tesseract::TessBaseAPI::Version()); + return 0; } 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..231de224a5d0c 100644 --- a/recipes/tesseract/config.yml +++ b/recipes/tesseract/config.yml @@ -1,4 +1,16 @@ versions: + "5.5.0": + folder: all + "5.4.1": + folder: all + "5.4.0": + folder: all + "5.3.4": + folder: all + "5.3.3": + folder: all + "5.3.0": + folder: all "5.2.0": folder: all "5.1.0": diff --git a/recipes/tgbot/all/CMakeLists.txt b/recipes/tgbot/all/CMakeLists.txt deleted file mode 100644 index 959835f6b0885..0000000000000 --- a/recipes/tgbot/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/tgbot/all/conandata.yml b/recipes/tgbot/all/conandata.yml index 054b04f19ea35..c1de261e9fcc7 100644 --- a/recipes/tgbot/all/conandata.yml +++ b/recipes/tgbot/all/conandata.yml @@ -1,13 +1,14 @@ sources: + "1.8": + url: "https://github.com/reo7sp/tgbot-cpp/archive/v1.8.tar.gz" + sha256: "43ff1a359b8db026e58e517703e616accaae33e01ebc7e87613632b7e4653467" + # This is the last version for C++11. + "1.7.2": + url: "https://github.com/reo7sp/tgbot-cpp/archive/v1.7.2.tar.gz" + sha256: "3a41c25c5e4b60bda3f278550a380f1c7c382fd50ea1ab1801edc837d1535462" "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" - "1.2.1": - url: "https://github.com/reo7sp/tgbot-cpp/archive/v1.2.1.tar.gz" - sha256: "bcc82cc8c421e96098ba6ef350acc0c1ce9fbbc21a11b91eb8643324757d09f2" - "1.2": - url: "https://github.com/reo7sp/tgbot-cpp/archive/v1.2.tar.gz" - sha256: "6d5158db38fb092e12060080a611ccdccde35cfb85f030996daee9619bebc513" diff --git a/recipes/tgbot/all/conanfile.py b/recipes/tgbot/all/conanfile.py index b7db60eafd261..9d54fa2902dee 100644 --- a/recipes/tgbot/all/conanfile.py +++ b/recipes/tgbot/all/conanfile.py @@ -1,19 +1,25 @@ -from conans import ConanFile, CMake, 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.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 +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" class TgbotConan(ConanFile): name = "tgbot" - - url = "https://github.com/conan-io/conan-center-index" - homepage = "http://reo7sp.github.io/tgbot-cpp" description = "C++ library for Telegram bot API" - topics = ("tgbot", "telegram", "telegram-api", "telegram-bot", "bot") license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "http://reo7sp.github.io/tgbot-cpp" + topics = ("telegram", "telegram-api", "telegram-bot", "bot") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -24,14 +30,31 @@ class TgbotConan(ConanFile): "fPIC": True, } - generators = "cmake", "cmake_find_package" - exports_sources = ["CMakeLists.txt"] - - _cmake = None + @property + def _min_cppstd(self): + # tgbot requiroes C++17 since 1.7.3 + return "14" if Version(self.version) < "1.7.3" else "17" @property - def _source_subfolder(self): - return "source_subfolder" + def _compilers_minimum_version(self): + return { + "17": { + # tgbot/>= 1.7.3 require C++17 filesystem + "gcc": "9", + "clang": "9", + "apple-clang": "13", + "Visual Studio": "16", + "msvc": "192", + }, + "14": { + "gcc": "5", + "clang": "3", + "apple-clang": "10", + "Visual Studio": "15", + "msvc": "191", + } + }.get(self._min_cppstd, {}) + def config_options(self): if self.settings.os == "Windows": @@ -39,12 +62,17 @@ 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("libcurl/7.84.0") - self.requires("openssl/1.1.1q") + # tgbot/Api.h:#include + self.requires("boost/1.83.0", transitive_headers=True, transitive_libs=True) + # tgbot/net/CurlHttpClient.h:#include + self.requires("libcurl/[>=7.78 <9]", transitive_headers=True, transitive_libs=True) + self.requires("openssl/[>=1.1 <4]") @property def _required_boost_components(self): @@ -52,41 +80,67 @@ def _required_boost_components(self): def validate(self): if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 11) - 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: - raise ConanInvalidConfiguration("{0} requires non header-only boost with these components: {1}".format(self.name, ", ".join(self._required_boost_components))) + 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." + ) + + 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( + f"{self.name} requires non header-only boost with these components: " + + ", ".join(self._required_boost_components) + ) 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["ENABLE_TESTS"] = False + if not self.settings.compiler.cppstd: + tc.cache_variables["CMAKE_CXX_STANDARD"] = self._min_cppstd + tc.generate() + tc = CMakeDeps(self) + tc.generate() def _patch_sources(self): # Don't force PIC - 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_property(TARGET ${PROJECT_NAME} PROPERTY POSITION_INDEPENDENT_CODE ON)", - "" + "", ) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["ENABLE_TESTS"] = False - self._cmake.configure() - return self._cmake + # Don't force CMAKE_CXX_STANDARD + replace_in_file(self, + os.path.join(self.source_folder, "CMakeLists.txt"), + "set(CMAKE_CXX_STANDARD", + "#") 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("LICENSE", dst="licenses", src=self._source_subfolder) + copy(self, "LICENSE", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder) + fix_apple_shared_install_name(self) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): self.cpp_info.libs = ["TgBot"] - self.cpp_info.requires = ["boost::headers", "boost::system", "libcurl::libcurl", "openssl::openssl"] + self.cpp_info.defines = ["HAVE_CURL=1"] + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") diff --git a/recipes/tgbot/all/test_package/CMakeLists.txt b/recipes/tgbot/all/test_package/CMakeLists.txt index b41fdddf1c066..766207d11a696 100644 --- a/recipes/tgbot/all/test_package/CMakeLists.txt +++ b/recipes/tgbot/all/test_package/CMakeLists.txt @@ -1,11 +1,12 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(tgbot REQUIRED) +find_package(tgbot REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) -target_link_libraries(${PROJECT_NAME} tgbot::tgbot) +target_link_libraries(${PROJECT_NAME} PRIVATE tgbot::tgbot) +if(tvbot_VERSION VERSION_LESS "1.7.3") + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) +else() + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +endif() diff --git a/recipes/tgbot/all/test_package/conanfile.py b/recipes/tgbot/all/test_package/conanfile.py index 7122b776c7119..ef5d7042163ec 100644 --- a/recipes/tgbot/all/test_package/conanfile.py +++ b/recipes/tgbot/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", "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,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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/tgbot/all/test_v1_package/CMakeLists.txt b/recipes/tgbot/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/tgbot/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/tgbot/all/test_v1_package/conanfile.py b/recipes/tgbot/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..80f8edbcec938 --- /dev/null +++ b/recipes/tgbot/all/test_v1_package/conanfile.py @@ -0,0 +1,16 @@ +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): + self.run(os.path.join("bin", "test_package"), run_environment=True) diff --git a/recipes/tgbot/config.yml b/recipes/tgbot/config.yml index 220c83c443ceb..e9249e18493da 100644 --- a/recipes/tgbot/config.yml +++ b/recipes/tgbot/config.yml @@ -1,9 +1,9 @@ versions: - "1.5": + "1.8": folder: all - "1.3": + "1.7.2": folder: all - "1.2.1": + "1.5": folder: all - "1.2": + "1.3": folder: all 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/thelink2012-any/all/conandata.yml b/recipes/thelink2012-any/all/conandata.yml index 05fc280a1c100..71bf293016c65 100644 --- a/recipes/thelink2012-any/all/conandata.yml +++ b/recipes/thelink2012-any/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "cci.20230118": + url: "https://github.com/thelink2012/any/archive/e88b1bfc160fa9b01e6174dd29c812eeeece3be9.tar.gz" + sha256: "4be9b7be551a61730c85c3e08f8513ad217874d0c3f966d8f9eb5e0892424f55" "cci.20200719": url: "https://github.com/thelink2012/any/archive/f67bd5f8bbf7eb628bf38206d4ac5cb22438e6bb.tar.gz" sha256: "1cd121a2fb27936213397ff4ff94fe4d6d4e28cabc13894cc4512eb046d71be8" diff --git a/recipes/thelink2012-any/all/conanfile.py b/recipes/thelink2012-any/all/conanfile.py index 2ecc1a7f7608f..b909aaa407a58 100644 --- a/recipes/thelink2012-any/all/conanfile.py +++ b/recipes/thelink2012-any/all/conanfile.py @@ -1,37 +1,54 @@ -from conans import ConanFile, tools +# TODO: verify the Conan v2 migration +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 + +required_conan_version = ">=1.52.0" -required_conan_version = ">=1.33.0" class Thelink2012AnyConan(ConanFile): name = "thelink2012-any" - license = "BSL-1.0" description = "Implementation of std::experimental::any, including small object optimization, for C++11 compilers" - topics = ("any", "c++11", "data-structures") - homepage = "https://github.com/thelink2012/any" + license = "BSL-1.0" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/thelink2012/any" + topics = ("any", "c++11", "data-structures", "header-only") + + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" - generators = "cmake" 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"): - 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 package(self): - self.copy("LICENSE*", "licenses", self._source_subfolder) - self.copy("any.hpp", "include", self._source_subfolder) - - def package_id(self): - self.info.header_only() + copy(self, "LICENSE*", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, "any.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", "any") + self.cpp_info.set_property("cmake_target_name", "any::any") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.names["cmake_find_package"] = "any" self.cpp_info.names["cmake_find_package_multi"] = "any" - self.cpp_info.set_property("cmake_target_name", "any::any") diff --git a/recipes/thelink2012-any/all/test_package/CMakeLists.txt b/recipes/thelink2012-any/all/test_package/CMakeLists.txt index 5e31011d1713d..6e9d1837691aa 100644 --- a/recipes/thelink2012-any/all/test_package/CMakeLists.txt +++ b/recipes/thelink2012-any/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(any CONFIG REQUIRED) +find_package(any REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} any::any) diff --git a/recipes/thelink2012-any/all/test_package/conanfile.py b/recipes/thelink2012-any/all/test_package/conanfile.py index 6b551939fbde3..fae501d0afb9e 100644 --- a/recipes/thelink2012-any/all/test_package/conanfile.py +++ b/recipes/thelink2012-any/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" + 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/thelink2012-any/all/test_v1_package/CMakeLists.txt b/recipes/thelink2012-any/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/thelink2012-any/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/thelink2012-any/all/test_v1_package/conanfile.py b/recipes/thelink2012-any/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..6b551939fbde3 --- /dev/null +++ b/recipes/thelink2012-any/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/thelink2012-any/config.yml b/recipes/thelink2012-any/config.yml index 1eac063d13841..cdbc38379aaf4 100644 --- a/recipes/thelink2012-any/config.yml +++ b/recipes/thelink2012-any/config.yml @@ -1,3 +1,5 @@ versions: + "cci.20230118": + folder: all "cci.20200719": folder: all diff --git a/recipes/thorvg/all/conandata.yml b/recipes/thorvg/all/conandata.yml new file mode 100644 index 0000000000000..06a5832709b16 --- /dev/null +++ b/recipes/thorvg/all/conandata.yml @@ -0,0 +1,19 @@ +sources: + "0.15.4": + url: "https://github.com/thorvg/thorvg/archive/refs/tags/v0.15.4.tar.gz" + sha256: "3031a3e070322194fc5368419e996420f05f26ec2ec8137beca17eba5e5e8a58" + "0.15.3": + url: "https://github.com/thorvg/thorvg/archive/refs/tags/v0.15.3.tar.gz" + sha256: "c3d57167a54f0ecc3ead8bb33340593acc00bcd8477e784287307bc4e2c82b38" + "0.14.10": + url: "https://github.com/thorvg/thorvg/archive/refs/tags/v0.14.10.tar.gz" + sha256: "e11e2e27ef26ed018807e828cce3bca1fb9a7f25683a152c9cd1f7aac9f3b67a" + "0.14.6": + url: "https://github.com/thorvg/thorvg/archive/refs/tags/v0.14.6.tar.gz" + sha256: "13d7778968ce10f4f7dd1ea1f66861d4ee8ff22f669566992b4ac00e050496cf" + "0.13.8": + url: "https://github.com/thorvg/thorvg/archive/refs/tags/v0.13.8.tar.gz" + sha256: "ce49929a94d1686d4f1436da6ef5fa7a8439901c22b5fa0879d7d5879b8ba2bd" + "0.13.7": + url: "https://github.com/thorvg/thorvg/archive/refs/tags/v0.13.7.tar.gz" + sha256: "972c84e5670a7138eec24062d4ccc243d161158ecd9c53788300a8ca6aaf3426" diff --git a/recipes/thorvg/all/conanfile.py b/recipes/thorvg/all/conanfile.py new file mode 100644 index 0000000000000..f5807d200b459 --- /dev/null +++ b/recipes/thorvg/all/conanfile.py @@ -0,0 +1,198 @@ +import os + +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 copy, get, rmdir, rename, replace_in_file, rm +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 conan.tools.scm import Version + +required_conan_version = ">=1.64.0 <2 || >=2.2.0" + + +class ThorvgConan(ConanFile): + name = "thorvg" + description = "ThorVG is a platform-independent portable library that allows for drawing vector-based scenes and animations." + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/thorvg/thorvg" + topics = ("svg", "lottie", "animation", "graphics", "rendering") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_engines": ['sw', 'gl_beta', 'wg_beta', "gl"], + "with_loaders": [False, 'tvg', 'svg', 'png', 'jpg', 'lottie', 'ttf', 'webp', 'all'], + "with_savers": [False, 'tvg', 'gif', 'all'], + "with_bindings": [False, 'capi', 'wasm_beta'], + "with_tools": [False, 'svg2tvg', 'svg2png', 'lottie2gif', 'all'], + "with_threads": [True, False], + "with_simd": [True, False], + "with_examples": [True, False], + "with_extra": [False, 'lottie_expressions'], + } + default_options = { + "shared": False, + "fPIC": True, + "with_engines": 'sw', + "with_loaders": 'all', + "with_savers": False, + "with_bindings": 'capi', + "with_tools": False, + "with_threads": True, + "with_simd": False, + "with_examples": False, + "with_extra": 'lottie_expressions', + } + # See more here: https://github.com/thorvg/thorvg/blob/main/meson_options.txt + options_description = { + "with_engines": "Enable Rasterizer Engine in thorvg", + "with_loaders": "Enable File Loaders in thorvg", + "with_savers": "Enable File Savers in thorvg", + "with_threads": "Enable the multi-threading task scheduler in thorvg", + "with_simd": "Enable CPU Vectorization(SIMD) in thorvg", + "with_bindings": "Enable API bindings", + "with_tools": "Enable building thorvg tools", + "with_examples": "Enable building examples", + "with_extra": "Enable support for exceptionally advanced features", + } + short_paths = True + + @property + def _min_cppstd(self): + return 14 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "6", + "clang": "5", + "apple-clang": "10", + "Visual Studio": "15", + "msvc": "191", + } + + 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): + basic_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." + ) + + if is_msvc(self) and self.settings.build_type == "Debug": + raise ConanInvalidConfiguration( + f"{self.ref} doesn't support debug build on MSVC." + ) + + if Version(self.version) < "0.14.0" and self.options.with_engines in ["gl"]: + raise ConanInvalidConfiguration(f"{self.ref} doesn't support with_engines=gl, use with_engines=gl_beta instead") + if Version(self.version) >= "0.14.0" and self.options.with_engines in ["gl_beta"]: + raise ConanInvalidConfiguration(f"{self.ref} doesn't support with_engines=gl_beta, use with_engines=gl instead") + + def requirements(self): + loaders_opt = str(self.options.with_loaders) + if loaders_opt in ("all", "jpg"): + self.requires("libjpeg-turbo/3.0.2") + if loaders_opt in ("all", "png"): + self.requires("libpng/1.6.43") + if loaders_opt in ("all", "webp"): + self.requires("libwebp/1.4.0") + if self.settings.os == "Linux": + if self.options.with_engines in ["gl", "gl_beta"]: + self.requires("opengl/system") + + def build_requirements(self): + self.tool_requires("meson/[>=1.2.3 <2]") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/[>=2.2 <3]") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = MesonToolchain(self, backend=("vs" if is_msvc(self) else None)) + is_debug = self.settings.get_safe("build_type") == "Debug" + tc.project_options.update({ + "engines": str(self.options.with_engines), + "loaders": str(self.options.with_loaders) if self.options.with_loaders else '', + "savers": str(self.options.with_savers) if self.options.with_savers else '', + "bindings": str(self.options.with_bindings) if self.options.with_bindings else '', + "tools": str(self.options.with_tools )if self.options.with_tools else '', + "threads": bool(self.options.with_threads), + "examples": bool(self.options.with_examples), + "tests": False, + "log": is_debug, + }) + # Workaround to avoid: error D8016: '/O1' and '/RTC1' command-line options are incompatible + if is_msvc(self) and is_debug: + tc.project_options["optimization"] = "plain" + tc.project_options["simd"] = bool(self.options.with_simd) + if self.options.with_extra: + tc.project_options["extra"] = str(self.options.with_extra) + tc.generate() + tc = PkgConfigDeps(self) + tc.generate() + venv = VirtualBuildEnv(self) + venv.generate() + + def _patch_sources(self): + # Workaround to avoid: Stripping target 'src\\thorvg-0.dll'. + if is_msvc(self) and self.options.shared: + replace_in_file(self, os.path.join(self.source_folder, "meson.build"), ", 'strip=true'", "") + + # TODO: As OpenMP is tagged as "required: false", let's disable it for now to avoid extra flags and requirements injections. + if Version(self.version) >= "0.15.1" and self.options.with_threads: + # Notice that the use of disabler() is not working here. If it's used, there is no targets to build. + replace_in_file(self, os.path.join(self.source_folder, "src", "renderer", "sw_engine", "meson.build"), + "omp_dep = dependency('openmp', required: false)", + "omp_dep = []") + replace_in_file(self, os.path.join(self.source_folder, "src", "renderer", "sw_engine", "meson.build"), + "omp_dep.found()", + "false") + + def build(self): + self._patch_sources() + 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() + 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) + + if is_msvc(self) and not self.options.shared: + rename(self, os.path.join(self.package_folder, "lib", "libthorvg.a"), os.path.join(self.package_folder, "lib", "thorvg.lib")) + + def package_info(self): + self.cpp_info.libs = ["thorvg"] + + self.cpp_info.set_property("pkg_config_name", "libthorvg") + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["pthread", "m"]) + if not self.options.shared: + self.cpp_info.defines = ["TVG_STATIC"] + else: + self.cpp_info.defines = ["TVG_EXPORT", "TVG_BUILD"] diff --git a/recipes/thorvg/all/test_package/CMakeLists.txt b/recipes/thorvg/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..f35032cc2fe13 --- /dev/null +++ b/recipes/thorvg/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(thorvg REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE thorvg::thorvg) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/thorvg/all/test_package/conanfile.py b/recipes/thorvg/all/test_package/conanfile.py new file mode 100644 index 0000000000000..ef5d7042163ec --- /dev/null +++ b/recipes/thorvg/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/thorvg/all/test_package/test_package.cpp b/recipes/thorvg/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..9953a7b6e75e3 --- /dev/null +++ b/recipes/thorvg/all/test_package/test_package.cpp @@ -0,0 +1,32 @@ +#include "thorvg.h" + +int main() { + const int WIDTH = 800; + const int HEIGHT = 600; + + tvg::Initializer::init(tvg::CanvasEngine::Sw, 0); + + static uint32_t buffer[WIDTH * HEIGHT]; // canvas target buffer + + auto canvas = tvg::SwCanvas::gen(); // generate a canvas + canvas->target(buffer, WIDTH, WIDTH, HEIGHT, tvg::SwCanvas::ARGB8888); // buffer, stride, w, h, Colorspace + + auto rect = tvg::Shape::gen(); // generate a shape + rect->appendRect(50, 50, 200, 200, 20, 20); // define it as a rounded rectangle (x, y, w, h, rx, ry) + rect->fill(100, 100, 100, 255); // set its color (r, g, b, a) + canvas->push(std::move(rect)); // push the rectangle into the canvas + + auto circle = tvg::Shape::gen(); // generate a shape + circle->appendCircle(400, 400, 100, 100); // define it as a circle (cx, cy, rx, ry) + + auto fill = tvg::RadialGradient::gen(); // generate a radial gradient + fill->radial(400, 400, 150); // set the radial gradient geometry info (cx, cy, radius) + + tvg::Fill::ColorStop colorStops[2]; // gradient colors + colorStops[0] = {0.0, 255, 255, 255, 255}; // 1st color values (offset, r, g, b, a) + colorStops[1] = {1.0, 0, 0, 0, 255}; // 2nd color values (offset, r, g, b, a) + fill->colorStops(colorStops, 2); // set the gradient colors info + + circle->fill(std::move(fill)); // set the circle fill + canvas->push(std::move(circle)); // push the circle into the canvas +} diff --git a/recipes/thorvg/config.yml b/recipes/thorvg/config.yml new file mode 100644 index 0000000000000..8ba127d279335 --- /dev/null +++ b/recipes/thorvg/config.yml @@ -0,0 +1,13 @@ +versions: + "0.15.4": + folder: all + "0.15.3": + folder: all + "0.14.10": + folder: all + "0.14.6": + folder: all + "0.13.8": + folder: all + "0.13.7": + folder: all diff --git a/recipes/thrift/all/conandata.yml b/recipes/thrift/all/conandata.yml index f6caedc01b3c0..6ddf0c58f5a00 100644 --- a/recipes/thrift/all/conandata.yml +++ b/recipes/thrift/all/conandata.yml @@ -1,32 +1,54 @@ sources: + "0.20.0": + url: "http://archive.apache.org/dist/thrift/0.20.0/thrift-0.20.0.tar.gz" + sha256: "b5d8311a779470e1502c027f428a1db542f5c051c8e1280ccd2163fa935ff2d6" + "0.18.1": + url: "http://archive.apache.org/dist/thrift/0.18.1/thrift-0.18.1.tar.gz" + sha256: "04c6f10e5d788ca78e13ee2ef0d2152c7b070c0af55483d6b942e29cff296726" "0.17.0": - url: "https://github.com/apache/thrift/archive/v0.17.0.tar.gz" - sha256: "f5888bcd3b8de40c2c2ab86896867ad9b18510deb412cba3e5da76fb4c604c29" + url: "http://archive.apache.org/dist/thrift/0.17.0/thrift-0.17.0.tar.gz" + sha256: "b272c1788bb165d99521a2599b31b97fa69e5931d099015d91ae107a0b0cc58f" "0.16.0": - url: "https://github.com/apache/thrift/archive/refs/tags/v0.16.0.tar.gz" - sha256: "df2931de646a366c2e5962af679018bca2395d586e00ba82d09c0379f14f8e7b" + url: "http://archive.apache.org/dist/thrift/0.16.0/thrift-0.16.0.tar.gz" + sha256: "f460b5c1ca30d8918ff95ea3eb6291b3951cf518553566088f3f2be8981f6209" "0.15.0": - url: "https://github.com/apache/thrift/archive/refs/tags/v0.15.0.tar.gz" - sha256: "32d2f18aa9be114619ee54e1abc3bb497febb2a8aa917894c20bae21185fac15" + url: "http://archive.apache.org/dist/thrift/0.15.0/thrift-0.15.0.tar.gz" + sha256: "d5883566d161f8f6ddd4e21f3a9e3e6b8272799d054820f1c25b11e86718f86b" "0.14.2": - url: "https://github.com/apache/thrift/archive/v0.14.2.tar.gz" - sha256: "f966cdac6bb8d149a9950a761e6ee6f3b22d5a6073da43a333d3468f159ebeaa" + url: "http://archive.apache.org/dist/thrift/0.14.2/thrift-0.14.2.tar.gz" + sha256: "4191bfc0b7490e20cc69f9f4dc6e991fbb612d4551aa9eef1dbf7f4c47ce554d" "0.14.1": - url: "https://github.com/apache/thrift/archive/refs/tags/v0.14.1.tar.gz" - sha256: "5ae1c4d16452a22eaf9d802ba7489907147c2b316ff38c9758918552fae5132c" - "0.13.0": - url: "https://github.com/apache/thrift/archive/0.13.0.tar.gz" - sha256: "8469c8d72c684c6de72ddf55fc65d1c10868a576e7dc4d1f4a21a59814b97110" + url: "http://archive.apache.org/dist/thrift/0.14.1/thrift-0.14.1.tar.gz" + sha256: "13da5e1cd9c8a3bb89778c0337cc57eb0c29b08f3090b41cf6ab78594b410ca5" patches: + "0.20.0": + - patch_file: "patches/cmake-0.16.0.patch" + patch_description: "use cci packages" + patch_type: "conan" + "0.18.1": + - patch_file: "patches/cmake-0.16.0.patch" + patch_description: "use cci packages" + patch_type: "conan" + - patch_file: "patches/0.18.1-0002-include-stddef.patch" + patch_description: "include cstddef" + patch_type: "portability" "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" - "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 1403d889a9ab8..97debbded3cd9 100644 --- a/recipes/thrift/all/conanfile.py +++ b/recipes/thrift/all/conanfile.py @@ -1,13 +1,13 @@ 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, 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.microsoft import is_msvc, is_msvc_static_runtime from conan.tools.scm import Version import os import textwrap -required_conan_version = ">1.50.0" +required_conan_version = ">=1.54.0" class ThriftConan(ConanFile): @@ -17,6 +17,7 @@ class ThriftConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/apache/thrift" topics = ("thrift", "serialization", "rpc") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -52,8 +53,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": @@ -61,33 +61,31 @@ 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.80.0") + self.requires("boost/1.85.0", transitive_headers=True) if self.options.with_openssl: - self.requires("openssl/1.1.1q") + self.requires("openssl/[>=1.1 <4]") if self.options.with_zlib: - self.requires("zlib/1.2.13") + self.requires("zlib/[>=1.2.11 <2]") if self.options.with_libevent: self.requires("libevent/2.1.12") if self.options.with_qt5: - self.requires("qt/5.15.7") + self.requires("qt/5.15.13") 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) - if str(self._settings_build.compiler) in ["Visual Studio", "msvc"]: - self.tool_requires("winflexbison/2.5.24") + if self._settings_build.os == "Windows": + self.tool_requires("winflexbison/2.5.25") else: self.tool_requires("flex/2.6.4") - self.tool_requires("bison/3.7.6") - - def layout(self): - cmake_layout(self, src_folder="src") + self.tool_requires("bison/3.8.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 = CMakeToolchain(self) @@ -102,8 +100,6 @@ def generate(self): tc.variables["WITH_MT"] = is_msvc_static_runtime(self) # This policy doesn't matter for us, but avoids a warning tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0074"] = "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() cd = CMakeDeps(self) @@ -179,7 +175,6 @@ def package_info(self): self.cpp_info.components["libthrift"].set_property("pkg_config_name", "thrift") self.cpp_info.components["libthrift"].libs = [f"thrift{libsuffix}"] if self.settings.os == "Windows": - self.cpp_info.components["libthrift"].defines.append("NOMINMAX") if Version(self.version) >= "0.15.0": self.cpp_info.components["libthrift"].system_libs.append("shlwapi") elif self.settings.os in ["Linux", "FreeBSD"]: diff --git a/recipes/thrift/all/patches/0.18.1-0002-include-stddef.patch b/recipes/thrift/all/patches/0.18.1-0002-include-stddef.patch new file mode 100644 index 0000000000000..f8195ce2910ed --- /dev/null +++ b/recipes/thrift/all/patches/0.18.1-0002-include-stddef.patch @@ -0,0 +1,24 @@ +diff --git a/lib/cpp/src/thrift/numeric_cast.h b/lib/cpp/src/thrift/numeric_cast.h +index d7063db..8775121 100644 +--- a/lib/cpp/src/thrift/numeric_cast.h ++++ b/lib/cpp/src/thrift/numeric_cast.h +@@ -22,6 +22,7 @@ + + #include + #include ++#include + + #if defined(_MSC_VER) + // avoid compiler warnings and errors in MSVC if max is defined as a macro +diff --git a/lib/cpp/src/thrift/transport/TBufferTransports.h b/lib/cpp/src/thrift/transport/TBufferTransports.h +index f72d8f6..f745b8c 100644 +--- a/lib/cpp/src/thrift/transport/TBufferTransports.h ++++ b/lib/cpp/src/thrift/transport/TBufferTransports.h +@@ -22,6 +22,7 @@ + + #include + #include ++#include + #include + + #include diff --git a/recipes/thrift/all/patches/cmake-0.13.0.patch b/recipes/thrift/all/patches/cmake-0.13.0.patch deleted file mode 100644 index 1acf18b419ac5..0000000000000 --- a/recipes/thrift/all/patches/cmake-0.13.0.patch +++ /dev/null @@ -1,80 +0,0 @@ ---- a/build/cmake/DefineOptions.cmake -+++ b/build/cmake/DefineOptions.cmake -@@ -39,10 +39,6 @@ option(BUILD_LIBRARIES "Build Thrift libraries" ON) - # and enables the library if all are found. This means the default is to build as - # much as possible but leaving out libraries if their dependencies are not met. - --if (NOT Boost_USE_STATIC_LIBS) -- add_definitions(-DBOOST_ALL_DYN_LINK) -- add_definitions(-DBOOST_TEST_DYN_LINK) --endif() - - # as3 - option(WITH_AS3 "Build ActionScript 3 Thrift Library" ON) -@@ -118,7 +114,12 @@ CMAKE_DEPENDENT_OPTION(BUILD_HASKELL "Build GHC library" ON - # Common library options - # https://cmake.org/cmake/help/latest/variable/BUILD_SHARED_LIBS.html - # Default on Windows is static, shared mode library support needs work... --CMAKE_DEPENDENT_OPTION(BUILD_SHARED_LIBS "Build shared libraries" OFF "WIN32" ON) -+if(WIN32) -+ set(DEFAULT_BUILD_SHARED_LIBS ON) -+else() -+ set(DEFAULT_BUILD_SHARED_LIBS OFF) -+endif() -+option(BUILD_SHARED_LIBS "Build shared libraries" ${DEFAULT_BUILD_SHARED_LIBS}) - - if (WITH_SHARED_LIB) - message(WARNING "WITH_SHARED_LIB is deprecated; use -DBUILD_SHARED_LIBS=ON instead") ---- a/lib/c_glib/CMakeLists.txt -+++ b/lib/c_glib/CMakeLists.txt -@@ -59,13 +59,13 @@ set(thrift_c_glib_SOURCES - ) - - # If OpenSSL is not found just ignore the OpenSSL stuff --find_package(OpenSSL) --if(OPENSSL_FOUND AND WITH_OPENSSL) -+if(WITH_OPENSSL) -+ find_package(OpenSSL REQUIRED) - list( APPEND thrift_c_glib_SOURCES - src/thrift/c_glib/transport/thrift_ssl_socket.c - ) -- include_directories(SYSTEM "${OPENSSL_INCLUDE_DIR}") -- list(APPEND SYSLIBS "${OPENSSL_LIBRARIES}") -+ #include_directories(SYSTEM "${OPENSSL_INCLUDE_DIR}") -+ list(APPEND SYSLIBS OpenSSL::SSL OpenSSL::Crypto) - endif() - - ---- a/lib/cpp/CMakeLists.txt -+++ b/lib/cpp/CMakeLists.txt -@@ -98,13 +98,13 @@ else() - endif() - - # If OpenSSL is not found or disabled just ignore the OpenSSL stuff --if(OPENSSL_FOUND AND WITH_OPENSSL) -+if(WITH_OPENSSL) - list( APPEND thriftcpp_SOURCES - src/thrift/transport/TSSLSocket.cpp - src/thrift/transport/TSSLServerSocket.cpp - ) -- include_directories(SYSTEM "${OPENSSL_INCLUDE_DIR}") -- list(APPEND SYSLIBS "${OPENSSL_LIBRARIES}") -+ #include_directories(SYSTEM "${OPENSSL_INCLUDE_DIR}") -+ list(APPEND SYSLIBS OpenSSL::SSL OpenSSL::Crypto) - endif() - - if(UNIX) -@@ -152,11 +152,11 @@ ADD_PKGCONFIG_THRIFT(thrift) - - if(WITH_LIBEVENT) - find_package(Libevent REQUIRED) # Libevent comes with CMake support form upstream -- include_directories(SYSTEM ${LIBEVENT_INCLUDE_DIRS}) -+ #include_directories(SYSTEM ${LIBEVENT_INCLUDE_DIRS}) - - ADD_LIBRARY_THRIFT(thriftnb ${thriftcppnb_SOURCES}) - LINK_AGAINST_THRIFT_LIBRARY(thriftnb thrift) -- TARGET_LINK_LIBRARIES_THRIFT(thriftnb ${SYSLIBS} ${LIBEVENT_LIBRARIES}) -+ TARGET_LINK_LIBRARIES_THRIFT(thriftnb ${SYSLIBS} libevent::core libevent::extra) - ADD_PKGCONFIG_THRIFT(thrift-nb) - endif() - diff --git a/recipes/thrift/all/test_package/conanfile.py b/recipes/thrift/all/test_package/conanfile.py index cbbd8f2b5bc46..bf9e658fe8687 100644 --- a/recipes/thrift/all/test_package/conanfile.py +++ b/recipes/thrift/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, run=can_run(self)) + def build(self): cmake = CMake(self) cmake.configure() 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 66a1ad96af024..f54d46190d9d2 100644 --- a/recipes/thrift/config.yml +++ b/recipes/thrift/config.yml @@ -1,4 +1,8 @@ versions: + "0.20.0": + folder: all + "0.18.1": + folder: all "0.17.0": folder: all "0.16.0": @@ -9,5 +13,3 @@ versions: folder: all "0.14.1": folder: all - "0.13.0": - folder: all diff --git a/recipes/thrust/all/conandata.yml b/recipes/thrust/all/conandata.yml index 702d317873355..4912f01513e01 100644 --- a/recipes/thrust/all/conandata.yml +++ b/recipes/thrust/all/conandata.yml @@ -1,10 +1,10 @@ sources: - "1.9.5": - url: "https://github.com/thrust/thrust/archive/1.9.5.tar.gz" - sha256: "d155dc2a260fe0c75c63c185fa4c4b4c6c5b7c444fcdac7109bb71941c9603f1" "1.16.0": url: "https://github.com/thrust/thrust/archive/1.16.0.tar.gz" sha256: "93b9553e3ee544e05395022bea67e6d600f8f3eb680950ec7cf73c0f55162487" "1.17.0": url: "https://github.com/thrust/thrust/archive/1.17.0.tar.gz" sha256: "b02aca5d2325e9128ed9d46785b8e72366f758b873b95001f905f22afcf31bbf" + "1.17.2": + url: "https://github.com/thrust/thrust/archive/1.17.2.tar.gz" + sha256: "d021e37f5aac30fd1b9737865399feb57db8e601ae2fc0af3cd41784435e9523" diff --git a/recipes/thrust/all/conanfile.py b/recipes/thrust/all/conanfile.py index 55d9c443a7b03..1519ec256e76b 100644 --- a/recipes/thrust/all/conanfile.py +++ b/recipes/thrust/all/conanfile.py @@ -1,44 +1,74 @@ -from conans import ConanFile, tools import os -required_conan_version = ">=1.33.0" +from conan import ConanFile +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout + +required_conan_version = ">=1.52.0" class ThrustConan(ConanFile): name = "thrust" license = "Apache-2.0" - description = ("Thrust is a parallel algorithms library which resembles" - "the C++ Standard Template Library (STL).") - topics = ("parallel", "stl", "header-only") + description = ( + "Thrust is a parallel algorithms library which resembles " + "the C++ Standard Template Library (STL)." + ) + topics = ("parallel", "stl", "header-only", "cuda", "gpgpu") homepage = "https://thrust.github.io/" url = "https://github.com/conan-io/conan-center-index" + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - options = {"device_system": ["cuda", "cpp", "omp", "tbb"]} - default_options = {"device_system": "tbb"} + options = { + "device_system": ["cuda", "cpp", "omp", "tbb"], + } + default_options = { + "device_system": "tbb", + } - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): + # Otherwise CUB from system CUDA is used, which is not guaranteed to be compatible + self.requires("cub/1.17.2") + if self.options.device_system == "tbb": - self.requires("onetbb/2020.3") - elif self.options.device_system != "cpp": - self.output.warn('Conan package for {0} is not available,' - ' this package will use {0} from system.' - .format(str(self.options.device_system).upper())) + self.requires("onetbb/2021.10.0") + + if self.options.device_system in ["cuda", "omp"]: + dev = str(self.options.device_system).upper() + self.output.warning( + f"Conan package for {dev} is not available," + f" this package will use {dev} from system." + ) + + 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(self): - self.copy(pattern="LICENSE", src=self._source_subfolder, dst="licenses") - self.copy("*[.h|.inl]", src=os.path.join(self._source_subfolder, "thrust"), - dst=os.path.join("include", "thrust")) - - def package_id(self): - self.info.header_only() + copy( + self, + pattern="LICENSE", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder, + ) + for pattern in ["*.h", "*.inl"]: + copy( + self, + pattern=pattern, + src=os.path.join(self.source_folder, "thrust"), + dst=os.path.join(self.package_folder, "include", "thrust"), + ) def package_info(self): - self.cpp_info.defines = ["THRUST_DEVICE_SYSTEM=THRUST_DEVICE_SYSTEM_{}".format( - str(self.options.device_system).upper())] + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + dev = str(self.options.device_system).upper() + self.cpp_info.defines = [f"THRUST_DEVICE_SYSTEM=THRUST_DEVICE_SYSTEM_{dev}"] + # Since CUB and Thrust are provided separately, their versions are not guaranteed to match + self.cpp_info.defines += ["THRUST_IGNORE_CUB_VERSION_CHECK=1"] diff --git a/recipes/thrust/all/test_package/CMakeLists.txt b/recipes/thrust/all/test_package/CMakeLists.txt index 00c2a09754018..1a734eec44011 100644 --- a/recipes/thrust/all/test_package/CMakeLists.txt +++ b/recipes/thrust/all/test_package/CMakeLists.txt @@ -1,11 +1,23 @@ -cmake_minimum_required(VERSION 3.1) -project(PackageTest CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.15) +project(test_package CXX) find_package(thrust CONFIG REQUIRED) -add_executable(test_package test_package.cpp) -target_link_libraries(test_package thrust::thrust) -set_target_properties(test_package PROPERTIES CXX_STANDARD 11) +if (THRUST_BACKEND STREQUAL "CUDA") + cmake_minimum_required(VERSION 3.18) + enable_language(CUDA) + find_package(CUDAToolkit REQUIRED) + add_executable(${PROJECT_NAME} test_package.cu) + target_link_libraries(${PROJECT_NAME} CUDA::cudart) + if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24") + set_target_properties(${PROJECT_NAME} PROPERTIES CUDA_ARCHITECTURES native) + else() + # Use the defaults from nvcc + set_target_properties(${PROJECT_NAME} PROPERTIES CUDA_ARCHITECTURES OFF) + endif() +else() + add_executable(${PROJECT_NAME} test_package.cpp) +endif() + +target_link_libraries(${PROJECT_NAME} thrust::thrust) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/thrust/all/test_package/conanfile.py b/recipes/thrust/all/test_package/conanfile.py index 9058f6e9a3054..1a1d2d0117430 100644 --- a/recipes/thrust/all/test_package/conanfile.py +++ b/recipes/thrust/all/test_package/conanfile.py @@ -1,10 +1,26 @@ 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, CMakeToolchain, cmake_layout -class ThrustTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + +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) + backend = str(self.dependencies["thrust"].options.device_system).upper() + tc.variables["THRUST_BACKEND"] = backend + tc.generate() def build(self): cmake = CMake(self) @@ -12,6 +28,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/thrust/all/test_package/test_package.cpp b/recipes/thrust/all/test_package/test_package.cpp index 48b3f8b33f1f7..28f5508b5fd2f 100644 --- a/recipes/thrust/all/test_package/test_package.cpp +++ b/recipes/thrust/all/test_package/test_package.cpp @@ -1,81 +1,11 @@ -// Adapted from https://github.com/thrust/thrust/blob/master/examples/monte_carlo.cu - -#include -#include -#include -#include +#include "test_package.cuh" #include #include -#include - -// we could vary M & N to find the perf sweet spot - -__host__ __device__ -unsigned int hash(unsigned int a) -{ - a = (a+0x7ed55d16) + (a<<12); - a = (a^0xc761c23c) ^ (a>>19); - a = (a+0x165667b1) + (a<<5); - a = (a+0xd3a2646c) ^ (a<<9); - a = (a+0xfd7046c5) + (a<<3); - a = (a^0xb55a4f09) ^ (a>>16); - return a; -} - -struct estimate_pi : public thrust::unary_function -{ - __host__ __device__ - float operator()(unsigned int thread_id) - { - float sum = 0; - unsigned int N = 100; // samples per thread - - unsigned int seed = hash(thread_id); - - // seed a random number generator - thrust::default_random_engine rng(seed); - - // create a mapping from random numbers to [0,1) - thrust::uniform_real_distribution u01(0,1); - - // take N samples in a quarter circle - for(unsigned int i = 0; i < N; ++i) - { - // draw a sample from the unit square - float x = u01(rng); - float y = u01(rng); - - // measure distance from the origin - float dist = sqrtf(x*x + y*y); - - // add 1.0f if (u0,u1) is inside the quarter circle - if(dist <= 1.0f) - sum += 1.0f; - } - - // multiply by 4 to get the area of the whole circle - sum *= 4.0f; - - // divide by N - return sum / N; - } -}; int main(void) { - // use 30 independent seeds - int M = 300; - - float estimate = thrust::transform_reduce(thrust::counting_iterator(0), - thrust::counting_iterator(M), - estimate_pi(), - 0.0f, - thrust::plus()); - estimate /= M; - std::cout << std::setprecision(3); - std::cout << "pi is approximately " << estimate << std::endl; - + std::cout << "pi is approximately " << estimate() << std::endl; return 0; } diff --git a/recipes/thrust/all/test_package/test_package.cu b/recipes/thrust/all/test_package/test_package.cu new file mode 100644 index 0000000000000..28f5508b5fd2f --- /dev/null +++ b/recipes/thrust/all/test_package/test_package.cu @@ -0,0 +1,11 @@ +#include "test_package.cuh" + +#include +#include + +int main(void) +{ + std::cout << std::setprecision(3); + std::cout << "pi is approximately " << estimate() << std::endl; + return 0; +} diff --git a/recipes/thrust/all/test_package/test_package.cuh b/recipes/thrust/all/test_package/test_package.cuh new file mode 100644 index 0000000000000..ccaa3b425e151 --- /dev/null +++ b/recipes/thrust/all/test_package/test_package.cuh @@ -0,0 +1,75 @@ +// Adapted from https://github.com/thrust/thrust/blob/master/examples/monte_carlo.cu +#pragma once + +#include +#include +#include +#include + +#include + +// we could vary M & N to find the perf sweet spot + +__host__ __device__ +unsigned int hash(unsigned int a) +{ + a = (a+0x7ed55d16) + (a<<12); + a = (a^0xc761c23c) ^ (a>>19); + a = (a+0x165667b1) + (a<<5); + a = (a+0xd3a2646c) ^ (a<<9); + a = (a+0xfd7046c5) + (a<<3); + a = (a^0xb55a4f09) ^ (a>>16); + return a; +} + +struct estimate_pi : public thrust::unary_function +{ + __host__ __device__ + float operator()(unsigned int thread_id) + { + float sum = 0; + unsigned int N = 100; // samples per thread + + unsigned int seed = hash(thread_id); + + // seed a random number generator + thrust::default_random_engine rng(seed); + + // create a mapping from random numbers to [0,1) + thrust::uniform_real_distribution u01(0,1); + + // take N samples in a quarter circle + for(unsigned int i = 0; i < N; ++i) + { + // draw a sample from the unit square + float x = u01(rng); + float y = u01(rng); + + // measure distance from the origin + float dist = sqrtf(x*x + y*y); + + // add 1.0f if (u0,u1) is inside the quarter circle + if(dist <= 1.0f) + sum += 1.0f; + } + + // multiply by 4 to get the area of the whole circle + sum *= 4.0f; + + // divide by N + return sum / N; + } +}; + +float estimate() { + // use 30 independent seeds + int M = 300; + + float estimate = thrust::transform_reduce(thrust::counting_iterator(0), + thrust::counting_iterator(M), + estimate_pi(), + 0.0f, + thrust::plus()); + estimate /= M; + return estimate; +} diff --git a/recipes/thrust/config.yml b/recipes/thrust/config.yml index 995f77f066bf1..f07d47b001a70 100644 --- a/recipes/thrust/config.yml +++ b/recipes/thrust/config.yml @@ -1,7 +1,7 @@ versions: - "1.9.5": - folder: all "1.16.0": folder: all "1.17.0": folder: all + "1.17.2": + folder: all diff --git a/recipes/tidwall-neco/all/CMakeLists.txt b/recipes/tidwall-neco/all/CMakeLists.txt new file mode 100644 index 0000000000000..ee8e2e4c821d7 --- /dev/null +++ b/recipes/tidwall-neco/all/CMakeLists.txt @@ -0,0 +1,20 @@ +cmake_minimum_required(VERSION 3.15) +project(neco LANGUAGES C) + +include(GNUInstallDirs) + +add_library(neco ${TIDWALL_NECO_SRC_DIR}/neco.c) +target_include_directories(neco PRIVATE ${TIDWALL_NECO_SRC_DIR}) +set_target_properties(neco PROPERTIES + PUBLIC_HEADER ${TIDWALL_NECO_SRC_DIR}/neco.h + WINDOWS_EXPORT_ALL_SYMBOLS ON +) +target_compile_features(neco PRIVATE c_std_11) + +install( + TARGETS neco + 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/tidwall-neco/all/conandata.yml b/recipes/tidwall-neco/all/conandata.yml new file mode 100644 index 0000000000000..683bfe9e9152a --- /dev/null +++ b/recipes/tidwall-neco/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.3.2": + url: "https://github.com/tidwall/neco/archive/refs/tags/v0.3.2.tar.gz" + sha256: "ae3cefa6217428e992da0b30f254502b9974079dd9973eee9c482ea89df3fcef" diff --git a/recipes/tidwall-neco/all/conanfile.py b/recipes/tidwall-neco/all/conanfile.py new file mode 100644 index 0000000000000..5aea18d3be4d2 --- /dev/null +++ b/recipes/tidwall-neco/all/conanfile.py @@ -0,0 +1,69 @@ +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 +from conan.errors import ConanInvalidConfiguration +import os + +required_conan_version = ">=1.53.0" + +class TidwallNecoConan(ConanFile): + name = "tidwall-neco" + description = "Concurrency library for C (coroutines)" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/tidwall/neco" + topics = ("coroutine", "concurrency", "network") + 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): + 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") + 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 is_msvc(self): + raise ConanInvalidConfiguration(f"{self.ref} does not support Visual Studio (yet).") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["TIDWALL_NECO_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 = ["neco"] + if self.settings.os in ("FreeBSD", "Linux"): + self.cpp_info.system_libs = ["pthread", "dl"] diff --git a/recipes/tidwall-neco/all/test_package/CMakeLists.txt b/recipes/tidwall-neco/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..a57d060daf586 --- /dev/null +++ b/recipes/tidwall-neco/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) + +find_package(tidwall-neco REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE tidwall-neco::tidwall-neco) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_11) diff --git a/recipes/tidwall-neco/all/test_package/conanfile.py b/recipes/tidwall-neco/all/test_package/conanfile.py new file mode 100644 index 0000000000000..fafba71d30d56 --- /dev/null +++ b/recipes/tidwall-neco/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/tidwall-neco/all/test_package/test_package.c b/recipes/tidwall-neco/all/test_package/test_package.c new file mode 100644 index 0000000000000..463b07f3d9439 --- /dev/null +++ b/recipes/tidwall-neco/all/test_package/test_package.c @@ -0,0 +1,13 @@ +#include + +// #define _GNU_SOURCE +#include "neco.h" + +void coroutine(int argc, void *argv[]) { + printf("main coroutine started\n"); +} + +int main(int argc, char *argv[]) { + neco_start(coroutine, 0); + return 0; +} diff --git a/recipes/tidwall-neco/config.yml b/recipes/tidwall-neco/config.yml new file mode 100644 index 0000000000000..f2fc85b835922 --- /dev/null +++ b/recipes/tidwall-neco/config.yml @@ -0,0 +1,3 @@ +versions: + "0.3.2": + folder: all diff --git a/recipes/tidy-html5/all/CMakeLists.txt b/recipes/tidy-html5/all/CMakeLists.txt deleted file mode 100644 index e5cb637716b89..0000000000000 --- a/recipes/tidy-html5/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/tidy-html5/all/conandata.yml b/recipes/tidy-html5/all/conandata.yml index dbfb937f0f3c2..56deb76dc5c66 100644 --- a/recipes/tidy-html5/all/conandata.yml +++ b/recipes/tidy-html5/all/conandata.yml @@ -5,4 +5,3 @@ sources: patches: "5.8.0": - patch_file: "patches/0001-robust-install-pdb.patch" - base_path: "source_subfolder" diff --git a/recipes/tidy-html5/all/conanfile.py b/recipes/tidy-html5/all/conanfile.py index c7d99c3c56b67..cc182cadf26f4 100644 --- a/recipes/tidy-html5/all/conanfile.py +++ b/recipes/tidy-html5/all/conanfile.py @@ -1,17 +1,22 @@ -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 apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir +from conan.tools.microsoft import is_msvc + +required_conan_version = ">=1.53.0" class TidyHtml5Conan(ConanFile): name = "tidy-html5" - license = "W3C" + description = "The granddaddy of HTML tools, with support for modern standards" + license = "HTMLTIDY" url = "https://github.com/conan-io/conan-center-index" homepage = "http://www.html-tidy.org" - description = "The granddaddy of HTML tools, with support for modern standards" topics = ("html", "parser", "xml", "tools") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -24,17 +29,8 @@ class TidyHtml5Conan(ConanFile): "support_localizations": 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": @@ -42,51 +38,57 @@ 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], 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 - cmake = CMake(self) - cmake.definitions['BUILD_TAB2SPACE'] = False - cmake.definitions['BUILD_SAMPLE_CODE'] = False - cmake.definitions['TIDY_COMPAT_HEADERS'] = False - cmake.definitions['SUPPORT_CONSOLE_APP'] = False - cmake.definitions['SUPPORT_LOCALIZATIONS'] = self.options.support_localizations - cmake.definitions['ENABLE_DEBUG_LOG'] = False - cmake.definitions['ENABLE_ALLOC_DEBUG'] = False - cmake.definitions['ENABLE_MEMORY_DEBUG'] = False - cmake.definitions['BUILD_SHARED_LIB'] = self.options.shared - cmake.configure(build_folder=self._build_subfolder) - self._cmake = cmake - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TAB2SPACE"] = False + tc.variables["BUILD_SAMPLE_CODE"] = False + tc.variables["TIDY_COMPAT_HEADERS"] = False + tc.variables["SUPPORT_CONSOLE_APP"] = False + tc.variables["SUPPORT_LOCALIZATIONS"] = self.options.support_localizations + tc.variables["ENABLE_DEBUG_LOG"] = False + tc.variables["ENABLE_ALLOC_DEBUG"] = False + tc.variables["ENABLE_MEMORY_DEBUG"] = False + tc.variables["BUILD_SHARED_LIB"] = 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("COPYING", dst="licenses", src=self._source_subfolder) - self.copy("LICENSE.md", dst="licenses", src=os.path.join(self._source_subfolder, 'README')) - cmake = self._configure_cmake() + copy(self, "COPYING", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder) + copy(self, "LICENSE.md", + dst=os.path.join(self.package_folder, "licenses"), + src=os.path.join(self.source_folder, "README")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.pdb") + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.pdb", os.path.join(self.package_folder, "lib"), recursive=True) if self.options.shared: to_remove = "*tidy_static*" if self.settings.os == "Windows" else "*.a" - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), to_remove) + rm(self, to_remove, os.path.join(self.package_folder, "lib"), recursive=True) def package_info(self): - self.cpp_info.names["pkg_config"] = "tidy" - suffix = "_static" if self.settings.os == "Windows" and not self.options.shared else "" - suffix += "d" if self.settings.compiler == "Visual Studio" and self.settings.build_type == "Debug" else "" + self.cpp_info.set_property("pkg_config_name", "tidy") + suffix = "" + if self.settings.os == "Windows" and not self.options.shared: + suffix = "_static" + if is_msvc(self) and self.settings.build_type == "Debug": + suffix += "d" self.cpp_info.libs = ["tidy" + suffix] if self.settings.os == "Windows" and not self.options.shared: self.cpp_info.defines.append("TIDY_STATIC") diff --git a/recipes/tidy-html5/all/test_package/CMakeLists.txt b/recipes/tidy-html5/all/test_package/CMakeLists.txt index 7b9b613cbb24a..e21ed1c05b78f 100644 --- a/recipes/tidy-html5/all/test_package/CMakeLists.txt +++ b/recipes/tidy-html5/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ -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() +find_package(tidy-html5 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE tidy-html5::tidy-html5) diff --git a/recipes/tidy-html5/all/test_package/conanfile.py b/recipes/tidy-html5/all/test_package/conanfile.py index bd7165a553cf4..ef5d7042163ec 100644 --- a/recipes/tidy-html5/all/test_package/conanfile.py +++ b/recipes/tidy-html5/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/tidy-html5/all/test_v1_package/CMakeLists.txt b/recipes/tidy-html5/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/tidy-html5/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/tidy-html5/all/test_v1_package/conanfile.py b/recipes/tidy-html5/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..7e2dfe859bb27 --- /dev/null +++ b/recipes/tidy-html5/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/tiledb/all/conandata.yml b/recipes/tiledb/all/conandata.yml new file mode 100644 index 0000000000000..9683a1cfcc4e0 --- /dev/null +++ b/recipes/tiledb/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "2.26.1": + url: "https://github.com/TileDB-Inc/TileDB/archive/refs/tags/2.26.1.tar.gz" + sha256: "f90461850c6f87f63fe77788d7932fd53a4d1de7e2ba7263f5e8f2fd1df23e38" diff --git a/recipes/tiledb/all/conanfile.py b/recipes/tiledb/all/conanfile.py new file mode 100644 index 0000000000000..3a434ad427fa5 --- /dev/null +++ b/recipes/tiledb/all/conanfile.py @@ -0,0 +1,275 @@ +import os + +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +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 get, copy, rmdir, replace_in_file, save +from conan.tools.gnu import PkgConfigDeps +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" + +class TileDBConan(ConanFile): + name = "tiledb" + description = ("TileDB is a powerful engine for storing and accessing dense and sparse multi-dimensional arrays, " + "which can help you model any complex data efficiently.") + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/TileDB-Inc/TileDB" + topics = ("data-science", "storage-engine", "s3", "sparse-data", "scientific-computing", "s3-storage", + "arrays", "data-analysis", "dataframes", "dense-data", "sparse-arrays") + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "cpp_api": [True, False], + "s3": [True, False], + "azure": [True, False], + "gcs": [True, False], + "serialization": [True, False], + "webp": [True, False], + "tools": [True, False], + "remove_deprecations": [True, False], + "verbose": [True, False], + "stats": [True, False], + "experimental_features": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "cpp_api": True, + "s3": False, + "azure": False, + "gcs": False, + "serialization": False, + "webp": True, + "tools": False, + "remove_deprecations": False, + "verbose": False, + "stats": True, + "experimental_features": False, + } + options_description = { + "cpp_api": "Enable building of the TileDB C++ API", + "s3": "Support AWS S3 Storage", + "azure": "Support Azure Blob Storage", + "gcs": "Support Google Cloud Storage", + "serialization": "Enable TileDB Cloud support by building with support for query serialization.", + "webp": "Support WebP compression", + "tools": "Build tiledb command-line tool", + "remove_deprecations": "Do not build deprecated APIs", + "verbose": "Print TileDB errors with verbosity", + "stats": "Enable internal TileDB statistics gathering", + "experimental_features": "Build and include experimental features", + } + + @property + def _min_cppstd(self): + return 20 + + @property + def _compilers_minimum_version(self): + # https://github.com/TileDB-Inc/TileDB/blob/2.21.0/doc/dev/BUILD.md#prerequisites + return { + "gcc": "10", + "clang": "10", + "apple-clang": "14", + "msvc": "192", + "Visual Studio": "16", + } + + 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.serialization: + self.options["libcurl"].with_zstd = True + if self.options.azure: + self.options["azure-sdk-for-cpp"]["azure-storage-blobs"] = True + if self.options.s3: + self.options["aws-sdk-cpp"].s3 = True + self.options["aws-sdk-cpp"]["identity-management"] = True + self.options["aws-sdk-cpp"].sts = True + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + # TileDB has no transitive header deps + self.requires("bzip2/1.0.8") + self.requires("libxml2/[>=2.12.5 <3]") + self.requires("lz4/1.9.4") + self.requires("spdlog/1.14.1") + self.requires("xz_utils/[>=5.4.5 <6]") + self.requires("zlib/[>=1.2.11 <2]") + self.requires("zstd/[^1.5]") + if self.settings.os != "Windows": + self.requires("openssl/[>=1.1 <4]") + self.requires("libmagic/5.45") + if self.options.azure: + self.requires("azure-sdk-for-cpp/1.11.3") + if self.options.gcs: + self.requires("google-cloud-cpp/2.28.0") + if self.options.serialization: + self.requires("capnproto/1.0.2") + self.requires("libcurl/[>=7.78 <9]") + if self.options.s3: + self.requires("aws-sdk-cpp/1.11.352") + if self.options.tools: + self.requires("clipp/1.2.3") + if self.options.webp: + self.requires("libwebp/1.4.0") + + # TODO: unvendor + # - bitshuffle + # - blosc + # - boost::interprocess + # - nlohmann_json + # - tcb-span + + 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.options.serialization and not self.dependencies["libcurl"].options.with_zstd: + raise ConanInvalidConfiguration("TileDB serialization requires libcurl with with_zstd option enabled.") + if self.options.s3: + aws_opts = self.dependencies["aws-sdk-cpp"].options + if not (aws_opts.get_safe("s3") and aws_opts.get_safe("identity-management") and aws_opts.get_safe("sts")): + raise ConanInvalidConfiguration( + f"TileDB S3 support requires aws-sdk-cpp with 's3', 'identity-management' and 'sts' options enabled." + ) + + def build_requirements(self): + self.tool_requires("cmake/[>=3.21 <4]") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/[>=2.2 <3]") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + # https://github.com/TileDB-Inc/TileDB/blob/2.26.1/cmake/Options/BuildOptions.cmake + tc.cache_variables["BUILD_SHARED_LIBS"] = self.options.shared + tc.cache_variables["TILEDB_AZURE"] = self.options.azure + tc.cache_variables["TILEDB_CPP_API"] = self.options.cpp_api + tc.cache_variables["TILEDB_DISABLE_AUTO_VCPKG"] = True + tc.cache_variables["TILEDB_EXPERIMENTAL_FEATURES"] = self.options.experimental_features + tc.cache_variables["TILEDB_GCS"] = self.options.gcs + tc.cache_variables["TILEDB_INSTALL_LIBDIR"] = os.path.join(self.package_folder, "lib") + tc.cache_variables["TILEDB_REMOVE_DEPRECATIONS"] = self.options.remove_deprecations + tc.cache_variables["TILEDB_S3"] = self.options.s3 + tc.cache_variables["TILEDB_SERIALIZATION"] = self.options.serialization + tc.cache_variables["TILEDB_STATS"] = self.options.stats + tc.cache_variables["TILEDB_TESTS"] = False + tc.cache_variables["TILEDB_TOOLS"] = self.options.tools + tc.cache_variables["TILEDB_VERBOSE"] = self.options.verbose + tc.cache_variables["TILEDB_WEBP"] = self.options.webp + tc.cache_variables["TILEDB_WERROR"] = False + # Disable ExternalProject just in case + tc.cache_variables["FETCHCONTENT_FULLY_DISCONNECTED"] = True + tc.cache_variables["libmagic_DICTIONARY"] = os.path.join(self.dependencies["libmagic"].package_folder, "res", "magic.mgc").replace("\\", "/") + tc.generate() + + deps = CMakeDeps(self) + conan_to_cmake_name = { + "aws-sdk-cpp": "AWSSDK", + "azure-sdk-for-cpp": "azure-storage-blobs-cpp", + "bzip2": "BZip2", + "capnproto": "CapnProto", + "clipp": "clipp", + "google-cloud-cpp": "google_cloud_cpp_storage", + "libcurl": "CURL", + "libmagic": "unofficial-libmagic", + "libwebp": "WebP", + "libxml2": "LibXml2", + "lz4": "lz4", + "openssl": "OpenSSL", + "spdlog": "spdlog", + "zlib": "ZLIB", + "zstd": "zstd", + } + for conan_name, cmake_name in conan_to_cmake_name.items(): + deps.set_property(conan_name, "cmake_file_name", cmake_name) + + renamed_targets = { + "azure-sdk-for-cpp::azure-storage-blobs": "Azure::azure-storage-blobs", + "bzip2": "BZip2::BZip2", + "clipp": "clipp::clipp", + "google-cloud-cpp::storage": "google-cloud-cpp::storage", + "libmagic": "unofficial::libmagic::libmagic", + "libwebp::webp": "WebP::webp", + "libwebp::webpdecoder": "WebP::webpdecoder", + "libwebp::webpdemux": "WebP::webpdemux", + "libwebp::webpmux": "WebP::libwebpmux", + "lz4": "LZ4::LZ4", + "zlib": "ZLIB::ZLIB", + "zstd": "Zstd::Zstd", + } + for component, new_target_name in renamed_targets.items(): + deps.set_property(component, "cmake_target_name", new_target_name) + + deps.generate() + + deps = PkgConfigDeps(self) + deps.generate() + + def _patch_sources(self): + # Disable examples + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "add_subdirectory(examples)", "") + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "add_subdirectory(experimental/experimental_examples)", "") + # Don't actually run vcpkg + save(self, os.path.join(self.source_folder, "cmake", "Options", "TileDBToolchain.cmake"), "") + # No such target defined in CCI + if self.options.serialization: + capnproto_bindir = self.dependencies['capnproto'].cpp_info.bindir + replace_in_file(self, os.path.join(self.source_folder, "tiledb", "CMakeLists.txt"), + "set(CAPNP_PLUGIN_DIR $)", + f'set(CAPNP_PLUGIN_DIR "{capnproto_bindir}")') + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + # tools are not installed by CMake + if self.options.tools: + suffix = ".exe" if self.settings.os == "Windows" else "" + copy(self, f"tiledb{suffix}", + src=os.path.join(self.build_folder, "tools"), + dst=os.path.join(self.package_folder, "bin"), + keep_path=False) + 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", "TileDB") + suffix = "shared" if self.options.shared else "static" + self.cpp_info.set_property("cmake_target_name", f"TileDB::tiledb_{suffix}") + self.cpp_info.set_property("cmake_target_aliases", ["TileDB::tiledb"]) + self.cpp_info.set_property("pkg_config_name", "tiledb") + + self.cpp_info.libs = ["tiledb"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["m", "pthread", "dl"]) + if stdcpp_library(self): + self.cpp_info.system_libs.append(stdcpp_library(self)) diff --git a/recipes/tiledb/all/test_package/CMakeLists.txt b/recipes/tiledb/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..6de1a132987e0 --- /dev/null +++ b/recipes/tiledb/all/test_package/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package CXX C) + +find_package(TileDB REQUIRED CONFIG) + +if (TILEDB_CPP_API) + add_executable(${PROJECT_NAME}_cpp test_package.cpp) + target_link_libraries(${PROJECT_NAME}_cpp PRIVATE TileDB::tiledb) + target_compile_features(${PROJECT_NAME}_cpp PRIVATE cxx_std_17) +endif() + +add_executable(${PROJECT_NAME}_c test_package.c) +target_link_libraries(${PROJECT_NAME}_c PRIVATE TileDB::tiledb) +target_compile_features(${PROJECT_NAME}_c PRIVATE c_std_99) diff --git a/recipes/tiledb/all/test_package/conanfile.py b/recipes/tiledb/all/test_package/conanfile.py new file mode 100644 index 0000000000000..e12ef4e9a27cb --- /dev/null +++ b/recipes/tiledb/all/test_package/conanfile.py @@ -0,0 +1,42 @@ +import os + +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake, CMakeToolchain +from conan.tools.files import save, load + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str, run=True) + + def layout(self): + cmake_layout(self) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["TILEDB_CPP_API"] = self.dependencies["tiledb"].options.cpp_api + tc.generate() + save(self, os.path.join(self.build_folder, "have_tools"), str(self.dependencies["tiledb"].options.tools)) + + 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_cpp") + if os.path.exists(bin_path): + self.run(bin_path, env="conanrun") + + bin_path = os.path.join(self.cpp.build.bindir, "test_package_c") + self.run(bin_path, env="conanrun") + + have_tools = load(self, os.path.join(self.build_folder, "have_tools")) == "True" + if have_tools: + self.run("tiledb help info", env="conanrun") diff --git a/recipes/tiledb/all/test_package/test_package.c b/recipes/tiledb/all/test_package/test_package.c new file mode 100644 index 0000000000000..399f427b0fe86 --- /dev/null +++ b/recipes/tiledb/all/test_package/test_package.c @@ -0,0 +1,15 @@ +#include + +#include + +int main() { + tiledb_ctx_t* ctx; + tiledb_ctx_alloc(NULL, &ctx); + tiledb_ctx_free(&ctx); + + int32_t major, minor, rev; + tiledb_version(&major, &minor, &rev); + printf("TileDB version: %d.%d.%d\n", major, minor, rev); + + return 0; +} diff --git a/recipes/tiledb/all/test_package/test_package.cpp b/recipes/tiledb/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..a8b39dd993dc1 --- /dev/null +++ b/recipes/tiledb/all/test_package/test_package.cpp @@ -0,0 +1,14 @@ +#include + +#include + +int main() { + tiledb::Context ctx; + + auto version = tiledb::version(); + std::cout << "TileDB version: " + << std::get<0>(version) << "." << std::get<1>(version) << "." << std::get<2>(version) + << std::endl; + + return 0; +} diff --git a/recipes/tiledb/config.yml b/recipes/tiledb/config.yml new file mode 100644 index 0000000000000..a6f63ba7f5ece --- /dev/null +++ b/recipes/tiledb/config.yml @@ -0,0 +1,3 @@ +versions: + "2.26.1": + folder: all diff --git a/recipes/timsort/all/conandata.yml b/recipes/timsort/all/conandata.yml index 47ca98338210c..0a421d85bab63 100644 --- a/recipes/timsort/all/conandata.yml +++ b/recipes/timsort/all/conandata.yml @@ -1,25 +1,28 @@ sources: - "1.2.0": - sha256: 3a189cb8717efbf0442da1d62109b7e881c158ab8167f8997e79cdb3a2cd7c9a - url: https://github.com/timsort/cpp-TimSort/archive/v1.2.0.tar.gz - "1.2.1": - sha256: 4f32285926330c97290b102c92c4ae8c308f46f70488d383595ae5f191e1de55 - url: https://github.com/timsort/cpp-TimSort/archive/v1.2.1.tar.gz - "1.2.2": - sha256: 594a5e59248accd1caa6a9e0f145d91ed9cf5bf1044d46684df1e866a534ee76 - url: https://github.com/timsort/cpp-TimSort/archive/v1.2.2.tar.gz - "1.3.0": - sha256: 25fe8338ac053c09662d62bbcaab981e478054a75b9422c1a652e580026713f0 - url: https://github.com/timsort/cpp-TimSort/archive/v1.3.0.tar.gz - "2.0.0": - sha256: 6cb23b0efb83e1d4f6eab58cddd35b36ca49cd927a46294575b9c0d304a2e833 - url: https://github.com/timsort/cpp-TimSort/archive/v2.0.0.tar.gz - "2.0.1": - sha256: 5c7fe16ca8ead3a86691cb64c373b9ca634add6b6539254baa58f4e254e865c6 - url: https://github.com/timsort/cpp-TimSort/archive/v2.0.1.tar.gz - "2.0.2": - sha256: df15ac2cea751e573979ff97966f2b3d5d9c35a819c43d9944756974e069b2d7 - url: https://github.com/timsort/cpp-TimSort/archive/v2.0.2.tar.gz + "3.0.0": + url: "https://github.com/timsort/cpp-TimSort/archive/v3.0.0.tar.gz" + sha256: "d61b92850996305e5248d1621c8ac437c31b474f74907e223019739e2e556b1f" "2.1.0": - sha256: b16606f85316d9a3cfde638c02dd9ce23324b0a904bb020e4ad2497cb8cf9ebd - url: https://github.com/timsort/cpp-TimSort/archive/v2.1.0.tar.gz + url: "https://github.com/timsort/cpp-TimSort/archive/v2.1.0.tar.gz" + sha256: "b16606f85316d9a3cfde638c02dd9ce23324b0a904bb020e4ad2497cb8cf9ebd" + "2.0.2": + url: "https://github.com/timsort/cpp-TimSort/archive/v2.0.2.tar.gz" + sha256: "df15ac2cea751e573979ff97966f2b3d5d9c35a819c43d9944756974e069b2d7" + "2.0.1": + url: "https://github.com/timsort/cpp-TimSort/archive/v2.0.1.tar.gz" + sha256: "5c7fe16ca8ead3a86691cb64c373b9ca634add6b6539254baa58f4e254e865c6" + "2.0.0": + url: "https://github.com/timsort/cpp-TimSort/archive/v2.0.0.tar.gz" + sha256: "6cb23b0efb83e1d4f6eab58cddd35b36ca49cd927a46294575b9c0d304a2e833" + "1.3.0": + url: "https://github.com/timsort/cpp-TimSort/archive/v1.3.0.tar.gz" + sha256: "25fe8338ac053c09662d62bbcaab981e478054a75b9422c1a652e580026713f0" + "1.2.2": + url: "https://github.com/timsort/cpp-TimSort/archive/v1.2.2.tar.gz" + sha256: "594a5e59248accd1caa6a9e0f145d91ed9cf5bf1044d46684df1e866a534ee76" + "1.2.1": + url: "https://github.com/timsort/cpp-TimSort/archive/v1.2.1.tar.gz" + sha256: "4f32285926330c97290b102c92c4ae8c308f46f70488d383595ae5f191e1de55" + "1.2.0": + url: "https://github.com/timsort/cpp-TimSort/archive/v1.2.0.tar.gz" + sha256: "3a189cb8717efbf0442da1d62109b7e881c158ab8167f8997e79cdb3a2cd7c9a" diff --git a/recipes/timsort/all/conanfile.py b/recipes/timsort/all/conanfile.py index b1ba83d8496dd..2cf482ec5ce9d 100644 --- a/recipes/timsort/all/conanfile.py +++ b/recipes/timsort/all/conanfile.py @@ -1,48 +1,54 @@ -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 = ">=2.0.9" class TimsortConan(ConanFile): name = "timsort" description = "A C++ implementation of timsort" - topics = ("timsort", "sorting", "algorithms") + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/timsort/cpp-TimSort" - license = "MIT" + topics = ("sorting", "algorithms", "header-only") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + if Version(self.version) < "2.0.0": + return "98" + if Version(self.version) < "3.0.0": + return "11" + return "20" - def validate(self): - if self.settings.compiler.get_safe("cppstd"): - if tools.Version(self.version) >= "2.0.0": - 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): + 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 build(self): + pass 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, "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.set_property("cmake_file_name", "gfx-timsort") self.cpp_info.set_property("cmake_target_name", "gfx::timsort") - - # TODO: to remove in conan v2 once cmake_find_package* generators removed - self.cpp_info.filenames["cmake_find_package"] = "gfx-timsort" - self.cpp_info.filenames["cmake_find_package_multi"] = "gfx-timsort" - self.cpp_info.names["cmake_find_package"] = "gfx" - self.cpp_info.names["cmake_find_package_multi"] = "gfx" - self.cpp_info.components["gfx-timsort"].names["cmake_find_package"] = "timsort" - self.cpp_info.components["gfx-timsort"].names["cmake_find_package_multi"] = "timsort" self.cpp_info.components["gfx-timsort"].set_property("cmake_target_name", "gfx::timsort") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/timsort/all/test_package/CMakeLists.txt b/recipes/timsort/all/test_package/CMakeLists.txt index d7e20e564e8bd..a73e92bb7c600 100644 --- a/recipes/timsort/all/test_package/CMakeLists.txt +++ b/recipes/timsort/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(gfx-timsort REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} gfx::timsort) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE gfx::timsort) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) diff --git a/recipes/timsort/all/test_package/conanfile.py b/recipes/timsort/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/timsort/all/test_package/conanfile.py +++ b/recipes/timsort/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/timsort/config.yml b/recipes/timsort/config.yml index 95d7ff39635a1..81269db497bd6 100644 --- a/recipes/timsort/config.yml +++ b/recipes/timsort/config.yml @@ -1,17 +1,19 @@ versions: - "1.2.0": + "3.0.0": folder: all - "1.2.1": + "2.1.0": folder: all - "1.2.2": + "2.0.2": folder: all - "1.3.0": + "2.0.1": folder: all "2.0.0": folder: all - "2.0.1": + "1.3.0": folder: all - "2.0.2": + "1.2.2": folder: all - "2.1.0": + "1.2.1": + folder: all + "1.2.0": folder: all diff --git a/recipes/tinkerforge-bindings/all/CMakeLists.txt b/recipes/tinkerforge-bindings/all/CMakeLists.txt index 2ea059e4508ba..64a0e8e101bed 100644 --- a/recipes/tinkerforge-bindings/all/CMakeLists.txt +++ b/recipes/tinkerforge-bindings/all/CMakeLists.txt @@ -1,26 +1,22 @@ -cmake_minimum_required(VERSION 3.4) -project(tinkerforge_bindings) +cmake_minimum_required(VERSION 3.15) +project(tinkerforge_bindings LANGUAGES C) -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +file(GLOB TINK_SOURCES ${TINKERFORGE_BINDINGS_SRC_DIR}/source/*.c) +file(GLOB TINK_HEADERS ${TINKERFORGE_BINDINGS_SRC_DIR}/source/*.h) -file(GLOB SOURCES ${CMAKE_SOURCE_DIR}/source_subfolder/source/*.c) -file(GLOB HEADERS ${CMAKE_SOURCE_DIR}/source_subfolder/source/*.h) - -if(WIN32 AND BUILD_SHARED_LIBS) - set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) -endif() - -add_library(${PROJECT_NAME} ${SOURCES}) - -if(MSVC) - target_link_libraries(${PROJECT_NAME} PRIVATE ws2_32 advapi32) +add_library(${PROJECT_NAME} ${TINK_SOURCES}) +set_target_properties(${PROJECT_NAME} PROPERTIES + PUBLIC_HEADER "${TINK_HEADERS}" + WINDOWS_EXPORT_ALL_SYMBOLS ON +) +if(WIN32) + target_link_libraries(${PROJECT_NAME} PRIVATE ws2_32 advapi32) endif() -set_target_properties(${PROJECT_NAME} PROPERTIES PUBLIC_HEADER "${HEADERS}") +include(GNUInstallDirs) install(TARGETS ${PROJECT_NAME} - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib - RUNTIME DESTINATION bin - PUBLIC_HEADER DESTINATION include + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) diff --git a/recipes/tinkerforge-bindings/all/conandata.yml b/recipes/tinkerforge-bindings/all/conandata.yml index 4a2d6c836c7df..2db4c8cf9a932 100644 --- a/recipes/tinkerforge-bindings/all/conandata.yml +++ b/recipes/tinkerforge-bindings/all/conandata.yml @@ -1,5 +1,7 @@ sources: + "2.1.33": + url: "https://download.tinkerforge.com/bindings/c/tinkerforge_c_bindings_2_1_33.zip" + sha256: "50501ca76b574ed756fef8e647b2c0b14b8f970c3c7f28824db3b3a841d51798" "2.1.32": - url: https://download.tinkerforge.com/bindings/c/tinkerforge_c_bindings_2_1_32.zip + url: "https://download.tinkerforge.com/bindings/c/tinkerforge_c_bindings_2_1_32.zip" sha256: "228f8eb3e64170312ceaca7354ba5f3178e89389782b304657ccdd2a2fd2b6b5" - diff --git a/recipes/tinkerforge-bindings/all/conanfile.py b/recipes/tinkerforge-bindings/all/conanfile.py index fb57c7fccf3f7..43201b9ca3934 100644 --- a/recipes/tinkerforge-bindings/all/conanfile.py +++ b/recipes/tinkerforge-bindings/all/conanfile.py @@ -1,17 +1,23 @@ -from conans import ConanFile, tools, CMake -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.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get +from conan.tools.microsoft import is_msvc_static_runtime + +required_conan_version = ">=1.53.0" + class TinkerforgeBindingsConan(ConanFile): name = "tinkerforge-bindings" + description = "API bindings to control Tinkerforge's Bricks and Bricklets" + license = "CC0 1.0 Universal" url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.tinkerforge.com/" - license = "CC0 1.0 Universal" - description = "API bindings to control Tinkerforge's Bricks and Bricklets" - topics = "iot", "maker", "bindings" + topics = ("iot", "maker", "bindings") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -22,19 +28,8 @@ class TinkerforgeBindingsConan(ConanFile): "fPIC": True, } - _cmake = None - 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") + copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder) def config_options(self): if self.settings.os == "Windows": @@ -42,40 +37,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.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): - if self.settings.compiler == "Visual Studio" and self.options.shared and "MT" in self.settings.compiler.runtime: + if self.options.shared and is_msvc_static_runtime(self): raise ConanInvalidConfiguration("Static runtime + shared is failing to link") def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=False) + get(self, **self.conan_data["sources"][self.version], strip_root=False) - 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["TINKERFORGE_BINDINGS_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=self.source_path.parent) cmake.build() def package(self): - self.copy("license.txt", src=self._source_subfolder, dst="licenses") - 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() def package_info(self): + self.cpp_info.set_property("cmake_file_name", "tinkerforge-bindings") self.cpp_info.set_property("cmake_target_name", "tinkerforge::bindings") - self.cpp_info.names["cmake_find_package"] = "tinkerforge" - self.cpp_info.names["cmake_find_package_multi"] = "tinkerforge" - self.cpp_info.filenames["cmake_find_package"] = "tinkerforge-bindings" - self.cpp_info.filenames["cmake_find_package_multi"] = "tinkerforge-bindings" + self.cpp_info.components["_bindings"].set_property("cmake_target_name", "bindings") self.cpp_info.components["_bindings"].names["cmake_find_package"] = "bindings" self.cpp_info.components["_bindings"].names["cmake_find_package_multi"] = "bindings" self.cpp_info.components["_bindings"].libs = ["tinkerforge_bindings"] @@ -84,3 +81,9 @@ def package_info(self): self.cpp_info.components["_bindings"].system_libs = ["pthread"] elif self.settings.os == "Windows": self.cpp_info.components["_bindings"].system_libs = ["advapi32", "ws2_32"] + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.names["cmake_find_package"] = "tinkerforge" + self.cpp_info.names["cmake_find_package_multi"] = "tinkerforge" + self.cpp_info.filenames["cmake_find_package"] = "tinkerforge-bindings" + self.cpp_info.filenames["cmake_find_package_multi"] = "tinkerforge-bindings" diff --git a/recipes/tinkerforge-bindings/all/test_package/CMakeLists.txt b/recipes/tinkerforge-bindings/all/test_package/CMakeLists.txt index b831e148cc9c0..4be380621fecd 100644 --- a/recipes/tinkerforge-bindings/all/test_package/CMakeLists.txt +++ b/recipes/tinkerforge-bindings/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ -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(tinkerforge-bindings REQUIRED) +find_package(tinkerforge-bindings REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) target_link_libraries(${PROJECT_NAME} tinkerforge::bindings) diff --git a/recipes/tinkerforge-bindings/all/test_package/conanfile.py b/recipes/tinkerforge-bindings/all/test_package/conanfile.py index 0245c9a8028a3..ef5d7042163ec 100644 --- a/recipes/tinkerforge-bindings/all/test_package/conanfile.py +++ b/recipes/tinkerforge-bindings/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,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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/tinkerforge-bindings/all/test_v1_package/CMakeLists.txt b/recipes/tinkerforge-bindings/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/tinkerforge-bindings/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/tinkerforge-bindings/all/test_v1_package/conanfile.py b/recipes/tinkerforge-bindings/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..9b63bd176646b --- /dev/null +++ b/recipes/tinkerforge-bindings/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/tinkerforge-bindings/config.yml b/recipes/tinkerforge-bindings/config.yml index d03f744650d0a..a948d6b05afc2 100644 --- a/recipes/tinkerforge-bindings/config.yml +++ b/recipes/tinkerforge-bindings/config.yml @@ -1,3 +1,5 @@ versions: + "2.1.33": + folder: all "2.1.32": folder: all 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-dnn/all/CMakeLists.txt b/recipes/tiny-dnn/all/CMakeLists.txt deleted file mode 100644 index b71c882d9d33f..0000000000000 --- a/recipes/tiny-dnn/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/tiny-dnn/all/conanfile.py b/recipes/tiny-dnn/all/conanfile.py index b3a57165d52a3..d88cf7b9a6e9e 100644 --- a/recipes/tiny-dnn/all/conanfile.py +++ b/recipes/tiny-dnn/all/conanfile.py @@ -1,35 +1,28 @@ -from conans import ConanFile, CMake, 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.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, replace_in_file, rmdir +from conan.tools.scm import Version + +required_conan_version = ">=1.52.0" class TinyDnnConan(ConanFile): name = "tiny-dnn" + description = "tiny-dnn is a C++14 implementation of deep learning." license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/tiny-dnn/tiny-dnn" - description = "tiny-dnn is a C++14 implementation of deep learning." topics = ("header-only", "deep-learning", "embedded", "iot", "computational") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" - options = { - "with_tbb": [True, False], - } - default_options = { - "with_tbb": False, - } - - exports_sources = "CMakeLists.txt" - # TODO: if you move this recipe to CMakeDeps, be aware that tiny-dnn - # relies on CMake variables which are not defined in CMakeDeps, only - # in cmake_find_package. So patch it before. - generators = "cmake", "cmake_find_package" - - @property - def _source_subfolder(self): - return "source_subfolder" + options = {"with_tbb": [True, False]} + default_options = {"with_tbb": False} + no_copy_source = True @property def _min_cppstd(self): @@ -41,58 +34,71 @@ def _min_compilers_version(self): "gcc": "5", "clang": "3.4", "apple-clang": "10", - "Visual Studio": "14" + "msvc": "190", + "Visual Studio": "14", } + def layout(self): + cmake_layout(self, src_folder="src") + def requirements(self): self.requires("cereal/1.3.1") self.requires("stb/cci.20210713") if self.options.with_tbb: self.requires("onetbb/2020.3") + 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) compiler = str(self.settings.compiler) - version = tools.Version(self.settings.compiler.version) + version = Version(self.settings.compiler.version) if compiler in self._min_compilers_version and version < self._min_compilers_version[compiler]: - raise ConanInvalidConfiguration( - "{} requires a compiler that supports at least C++{}".format( - self.name, self._min_cppstd, - ) - ) - - def package_id(self): - self.info.header_only() + raise ConanInvalidConfiguration(f"{self.name} requires a compiler that supports at least C++{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_TBB"] = self.options.with_tbb + tc.variables["USE_GEMMLOWP"] = False + tc.generate() + tc = CMakeDeps(self) + tc.generate() def build(self): - tools.replace_in_file( - os.path.join(self._source_subfolder, "tiny_dnn", "util", "image.h"), - "third_party/", "", - ) + replace_in_file(self, + os.path.join(self.source_folder, "tiny_dnn", "util", "image.h"), + "third_party/", "") 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["USE_TBB"] = self.options.with_tbb - cmake.definitions["USE_GEMMLOWP"] = False cmake.configure() 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.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.set_property("cmake_file_name", "tinydnn") self.cpp_info.set_property("cmake_target_name", "TinyDNN::tiny_dnn") + # TODO: back to global scope in conan v2 once cmake_find_package* generators removed + self.cpp_info.components["tinydnn"].set_property("cmake_target_name", "TinyDNN::tiny_dnn") + self.cpp_info.components["tinydnn"].requires = ["cereal::cereal", "stb::stb"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["tinydnn"].system_libs = ["pthread"] if self.options.with_tbb: self.cpp_info.components["tinydnn"].defines = ["CNN_USE_TBB=1"] + self.cpp_info.components["tinydnn"].requires.append("onetbb::onetbb") # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.filenames["cmake_find_package"] = "tinydnn" @@ -101,7 +107,3 @@ def package_info(self): self.cpp_info.names["cmake_find_package_multi"] = "TinyDNN" self.cpp_info.components["tinydnn"].names["cmake_find_package"] = "tiny_dnn" self.cpp_info.components["tinydnn"].names["cmake_find_package_multi"] = "tiny_dnn" - self.cpp_info.components["tinydnn"].set_property("cmake_target_name", "TinyDNN::tiny_dnn") - self.cpp_info.components["tinydnn"].requires = ["cereal::cereal", "stb::stb"] - if self.options.with_tbb: - self.cpp_info.components["tinydnn"].requires.append("onetbb::onetbb") diff --git a/recipes/tiny-dnn/all/test_package/CMakeLists.txt b/recipes/tiny-dnn/all/test_package/CMakeLists.txt index e2d99200a80ab..efce3e2e31902 100644 --- a/recipes/tiny-dnn/all/test_package/CMakeLists.txt +++ b/recipes/tiny-dnn/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(tinydnn REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/tiny-dnn/all/test_package/conanfile.py b/recipes/tiny-dnn/all/test_package/conanfile.py index 38f4483872d47..fae501d0afb9e 100644 --- a/recipes/tiny-dnn/all/test_package/conanfile.py +++ b/recipes/tiny-dnn/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" + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/tiny-dnn/all/test_v1_package/CMakeLists.txt b/recipes/tiny-dnn/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/tiny-dnn/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/tiny-dnn/all/test_v1_package/conanfile.py b/recipes/tiny-dnn/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/tiny-dnn/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/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/tinyad/all/conandata.yml b/recipes/tinyad/all/conandata.yml new file mode 100644 index 0000000000000..a2c45fe6ad86b --- /dev/null +++ b/recipes/tinyad/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "cci.20240718": + url: "https://github.com/patr-schm/TinyAD/archive/29417031c185b6dc27b6d4b684550d844459b735.tar.gz" + sha256: "0458b9aabd31bff079aa5e9e559bd4753744c29f9ffce9d06a6510409c92e221" \ No newline at end of file diff --git a/recipes/tinyad/all/conanfile.py b/recipes/tinyad/all/conanfile.py new file mode 100644 index 0000000000000..a71ac5080cf3f --- /dev/null +++ b/recipes/tinyad/all/conanfile.py @@ -0,0 +1,68 @@ +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.microsoft import is_msvc +from conan.tools.scm import Version +import os + +required_conan_version = ">=1.52.0" + + +class TinyADConan(ConanFile): + name = "tinyad" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/patr-schm/TinyAD" + description = "TinyAD is a C++ header-only library for second-order automatic differentiation" + topics = ("algebra", "linear-algebra", "optimization", "autodiff", "numerical", "header-only") + package_type = "header-library" + license = ("MIT") + settings = "os", "arch", "compiler", "build_type" + + def requirements(self): + self.requires("eigen/3.4.0") + + @property + def _compilers_minimum_version(self): + return { + "gcc": "7", + "clang": "7", + "apple-clang": "12.0", + "Visual Studio": "15", + "msvc": "191", + } + + def validate(self): + required_min_cppstd = "17" + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, required_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++{required_min_cppstd}, which your compiler does not support." + ) + + 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): + # The project has a CMakelists.txt file, but it doesn't have "install" logic + # so we just copy the headers to the package folder + copy(self, "include/**", src=self.source_folder, dst=self.package_folder) + 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", "TinyAD") + self.cpp_info.set_property("cmake_target_name", "TinyAD") + + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + if is_msvc(self): + # https://github.com/patr-schm/TinyAD/blob/29417031c185b6dc27b6d4b684550d844459b735/CMakeLists.txt#L35 + self.cpp_info.cxxflags.append("/bigobj") diff --git a/recipes/tinyad/all/test_package/CMakeLists.txt b/recipes/tinyad/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..3deb656633e62 --- /dev/null +++ b/recipes/tinyad/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES CXX) + +find_package(TinyAD REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE TinyAD) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/tinyad/all/test_package/conanfile.py b/recipes/tinyad/all/test_package/conanfile.py new file mode 100644 index 0000000000000..c0ba081cf41ea --- /dev/null +++ b/recipes/tinyad/all/test_package/conanfile.py @@ -0,0 +1,25 @@ +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): + self.run(os.path.join(self.cpp.build.bindirs[0], "test_package"), env="conanrun") diff --git a/recipes/tinyad/all/test_package/test_package.cpp b/recipes/tinyad/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..2b49f0bdc7ad9 --- /dev/null +++ b/recipes/tinyad/all/test_package/test_package.cpp @@ -0,0 +1,21 @@ +#include +#include +#include + +int main(void) { + // Choose autodiff scalar type for 3 variables + using ADouble = TinyAD::Double<3>; + + // Init a 3D vector of active variables and a 3D vector of passive variables + Eigen::Vector3 x = ADouble::make_active({0.0, -1.0, 1.0}); + Eigen::Vector3 y(2.0, 3.0, 5.0); + + // Compute angle using Eigen functions and retrieve gradient and Hessian w.r.t. x + ADouble angle = acos(x.dot(y) / (x.norm() * y.norm())); + Eigen::Vector3d g = angle.grad; + Eigen::Matrix3d H = angle.Hess; + + std::cout << "TinyAD test package successful \n"; + + return 0; +} diff --git a/recipes/tinyad/config.yml b/recipes/tinyad/config.yml new file mode 100644 index 0000000000000..ade632d071b81 --- /dev/null +++ b/recipes/tinyad/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20240718": + folder: all diff --git a/recipes/tinyalsa/all/conandata.yml b/recipes/tinyalsa/all/conandata.yml index e736cb9ab9606..2fbff13d26bb3 100644 --- a/recipes/tinyalsa/all/conandata.yml +++ b/recipes/tinyalsa/all/conandata.yml @@ -8,4 +8,14 @@ sources: patches: "2.0.0": - patch_file: "patches/tinyalsa-2.0.0-strncpy-warning.patch" - base_path: "source_subfolder" + - patch_file: "patches/tinyalsa-2.0.0-fix-hardcoded-gcc.patch" + patch_description: "Fix hardcoded references to GCC" + patch_type: "portability" + "1.1.1": + - patch_file: "patches/tinyalsa-1.1.1-fix-make-clang-build.patch" + patch_description: "fix clang build using make" + patch_type: "backport" + patch_source: "https://github.com/tinyalsa/tinyalsa/commit/1c13f7cbe1ebee24c2b62d5ba16f2702882da49a" + - patch_file: "patches/tinyalsa-1.1.1-fix-hardcoded-gcc.patch" + patch_description: "Fix hardcoded references to GCC" + patch_type: "portability" diff --git a/recipes/tinyalsa/all/conanfile.py b/recipes/tinyalsa/all/conanfile.py index 3475e6c4f17af..e88da3d9b79db 100644 --- a/recipes/tinyalsa/all/conanfile.py +++ b/recipes/tinyalsa/all/conanfile.py @@ -1,68 +1,78 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.tools.files import get, export_conandata_patches, apply_conandata_patches, chdir, copy, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class TinyAlsaConan(ConanFile): name = "tinyalsa" + description = "A small library to interface with ALSA in the Linux kernel" license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/tinyalsa/tinyalsa" topics = ("tiny", "alsa", "sound", "audio", "tinyalsa") - description = "A small library to interface with ALSA in the Linux kernel" - exports_sources = ["patches/*",] - options = {"shared": [True, False], "with_utils": [True, False]} - default_options = {'shared': False, 'with_utils': False} + package_type = "library" settings = "os", "compiler", "build_type", "arch" + options = {"shared": [True, False], "with_utils": [True, False]} + default_options = {"shared": False, "with_utils": False} - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") def validate(self): if self.settings.os != "Linux": raise ConanInvalidConfiguration("{} only works for Linux.".format(self.name)) 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 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 = AutotoolsToolchain(self) + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - with tools.chdir(self._source_subfolder): - env_build = AutoToolsBuildEnvironment(self) - env_build.make() + apply_conandata_patches(self) + with chdir(self, self.source_folder): + at = Autotools(self) + at.make() def package(self): - self.copy("NOTICE", dst="licenses", src=self._source_subfolder) + copy(self, "NOTICE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) - with tools.chdir(self._source_subfolder): - env_build = AutoToolsBuildEnvironment(self) - env_build_vars = env_build.vars - env_build_vars['PREFIX'] = self.package_folder - env_build.install(vars=env_build_vars) + with chdir(self, self.source_folder): + at = Autotools(self) + at.install(args=[f"DESTDIR={self.package_folder}", "PREFIX="]) - tools.rmdir(os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "share")) - if not self.options.with_utils: - tools.rmdir(os.path.join(self.package_folder, "bin")) + pattern_to_remove = "*.a" if self.options.shared else "*.so" + rm(self, pattern_to_remove, os.path.join(self.package_folder, "lib")) - with tools.chdir(os.path.join(self.package_folder, "lib")): - files = os.listdir() - for f in files: - if (self.options.shared and f.endswith(".a")) or (not self.options.shared and not f.endswith(".a")): - os.unlink(f) + if not self.options.with_utils: + rmdir(self, os.path.join(self.package_folder, "bin")) def package_info(self): self.cpp_info.libs = ["tinyalsa"] - if tools.Version(self.version) >= "2.0.0": + if Version(self.version) >= "2.0.0": self.cpp_info.system_libs.append("dl") + if self.options.with_utils: bin_path = os.path.join(self.package_folder, "bin") - self.output.info('Appending PATH environment variable: %s' % bin_path) + self.output.info(f"Appending PATH environment variable: {bin_path}") self.env_info.path.append(bin_path) + + # Needed for compatibility with v1.x - Remove when 2.0 becomes the default + 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/tinyalsa/all/patches/tinyalsa-1.1.1-fix-hardcoded-gcc.patch b/recipes/tinyalsa/all/patches/tinyalsa-1.1.1-fix-hardcoded-gcc.patch new file mode 100644 index 0000000000000..06261e0620b0d --- /dev/null +++ b/recipes/tinyalsa/all/patches/tinyalsa-1.1.1-fix-hardcoded-gcc.patch @@ -0,0 +1,46 @@ +diff --git a/examples/Makefile b/examples/Makefile +index 807d4c8..32a8a9b 100644 +--- a/examples/Makefile ++++ b/examples/Makefile +@@ -1,6 +1,5 @@ + CROSS_COMPILE ?= + +-CC = $(CROSS_COMPILE)gcc + CFLAGS = -Wall -Wextra -Werror -Wfatal-errors -I ../include + + VPATH = ../src +diff --git a/src/Makefile b/src/Makefile +index d33c9f1..0e5c054 100644 +--- a/src/Makefile ++++ b/src/Makefile +@@ -7,9 +7,6 @@ LIBDIR := $(LIBDIR)/$(DEB_HOST_MULTIARCH) + endif + + CROSS_COMPILE = +-CC = $(CROSS_COMPILE)gcc +-AR = $(CROSS_COMPILE)ar +-LD = $(CROSS_COMPILE)gcc + + WARNINGS = -Wall -Wextra -Werror -Wfatal-errors + INCLUDE_DIRS = -I ../include +@@ -37,7 +34,7 @@ libtinyalsa.so.1: libtinyalsa.so.1.1.1 + ln -sf $< $@ + + libtinyalsa.so.1.1.1: $(OBJECTS) +- $(LD) $(LDFLAGS) -shared -Wl,-soname,libtinyalsa.so.1 $^ -o $@ ++ $(CC) $(LDFLAGS) -shared -Wl,-soname,libtinyalsa.so.1 $^ -o $@ + + .PHONY: clean + clean: +diff --git a/utils/Makefile b/utils/Makefile +index ad4bc5c..ab90c79 100644 +--- a/utils/Makefile ++++ b/utils/Makefile +@@ -4,7 +4,6 @@ BINDIR ?= $(PREFIX)/bin + MANDIR ?= $(PREFIX)/man + + CROSS_COMPILE ?= +-CC = $(CROSS_COMPILE)gcc + + CFLAGS += -Wall -Wextra -Werror -Wfatal-errors + CFLAGS += -I ../include diff --git a/recipes/tinyalsa/all/patches/tinyalsa-1.1.1-fix-make-clang-build.patch b/recipes/tinyalsa/all/patches/tinyalsa-1.1.1-fix-make-clang-build.patch new file mode 100644 index 0000000000000..c0749bfad8d12 --- /dev/null +++ b/recipes/tinyalsa/all/patches/tinyalsa-1.1.1-fix-make-clang-build.patch @@ -0,0 +1,40 @@ +diff --git a/utils/Makefile b/utils/Makefile +index ad4bc5c..fb52cd3 100644 +--- a/utils/Makefile ++++ b/utils/Makefile +@@ -8,21 +8,30 @@ CC = $(CROSS_COMPILE)gcc + + CFLAGS += -Wall -Wextra -Werror -Wfatal-errors + CFLAGS += -I ../include +-CFLAGS += -L ../src + CFLAGS += -O2 + ++LDFLAGS += -L ../src ++ + VPATH = ../src:../include/tinyalsa + + .PHONY: all + all: -ltinyalsa tinyplay tinycap tinymix tinypcminfo + +-tinyplay: tinyplay.c pcm.h mixer.h asoundlib.h libtinyalsa.a ++tinyplay: tinyplay.o libtinyalsa.a ++ ++tinyplay.o: tinyplay.c pcm.h mixer.h asoundlib.h ++ ++tinycap: tinycap.o libtinyalsa.a ++ ++tinycap.o: tinycap.c pcm.h mixer.h asoundlib.h ++ ++tinymix: tinymix.o libtinyalsa.a + +-tinycap: tinycap.c pcm.h mixer.h asoundlib.h libtinyalsa.a ++tinymix.o: tinymix.c pcm.h mixer.h asoundlib.h + +-tinymix: tinymix.c pcm.h mixer.h asoundlib.h libtinyalsa.a ++tinypcminfo: tinypcminfo.o libtinyalsa.a + +-tinypcminfo: tinypcminfo.c pcm.h mixer.h asoundlib.h libtinyalsa.a ++tinypcminfo.o: tinypcminfo.c pcm.h mixer.h asoundlib.h + + .PHONY: clean + clean: diff --git a/recipes/tinyalsa/all/patches/tinyalsa-2.0.0-fix-hardcoded-gcc.patch b/recipes/tinyalsa/all/patches/tinyalsa-2.0.0-fix-hardcoded-gcc.patch new file mode 100644 index 0000000000000..db679cccf2ab7 --- /dev/null +++ b/recipes/tinyalsa/all/patches/tinyalsa-2.0.0-fix-hardcoded-gcc.patch @@ -0,0 +1,46 @@ +diff --git a/examples/Makefile b/examples/Makefile +index 650966d..1f68ff6 100644 +--- a/examples/Makefile ++++ b/examples/Makefile +@@ -1,6 +1,5 @@ + CROSS_COMPILE ?= + +-CC = $(CROSS_COMPILE)gcc + CFLAGS = -Wall -Wextra -Werror -Wfatal-errors -I ../include + + VPATH = ../src +diff --git a/src/Makefile b/src/Makefile +index aaa84b8..ac86400 100644 +--- a/src/Makefile ++++ b/src/Makefile +@@ -6,9 +6,6 @@ ifdef DEB_HOST_MULTIARCH + LIBDIR := $(LIBDIR)/$(DEB_HOST_MULTIARCH) + endif + +-CC = $(CROSS_COMPILE)gcc +-AR = $(CROSS_COMPILE)ar +-LD = $(CROSS_COMPILE)gcc + + WARNINGS = -Wall -Wextra -Werror -Wfatal-errors + INCLUDE_DIRS = -I ../include +@@ -49,7 +46,7 @@ libtinyalsa.so.$(LIBVERSION_MAJOR): libtinyalsa.so.$(LIBVERSION) + ln -sf $< $@ + + libtinyalsa.so.$(LIBVERSION): $(OBJECTS) +- $(LD) $(LDFLAGS) -shared -Wl,-soname,libtinyalsa.so.$(LIBVERSION_MAJOR) $^ -o $@ ++ $(CC) $(LDFLAGS) -shared -Wl,-soname,libtinyalsa.so.$(LIBVERSION_MAJOR) $^ -o $@ + + .PHONY: clean + clean: +diff --git a/utils/Makefile b/utils/Makefile +index f733c39..38a9cb5 100644 +--- a/utils/Makefile ++++ b/utils/Makefile +@@ -4,7 +4,6 @@ BINDIR ?= $(PREFIX)/bin + MANDIR ?= $(PREFIX)/man + + CROSS_COMPILE ?= +-CC = $(CROSS_COMPILE)gcc + + CFLAGS += -Wall -Wextra -Werror -Wfatal-errors + CFLAGS += -I ../include diff --git a/recipes/tinyalsa/all/test_package/CMakeLists.txt b/recipes/tinyalsa/all/test_package/CMakeLists.txt index 05e771029ef2c..164aea9790081 100644 --- a/recipes/tinyalsa/all/test_package/CMakeLists.txt +++ b/recipes/tinyalsa/all/test_package/CMakeLists.txt @@ -1,8 +1,5 @@ cmake_minimum_required(VERSION 3.1) -project(PackageTest) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(PackageTest LANGUAGES C) find_package(tinyalsa CONFIG REQUIRED) diff --git a/recipes/tinyalsa/all/test_package/conanfile.py b/recipes/tinyalsa/all/test_package/conanfile.py index 481a3b9adeaa2..03f3d654478f9 100644 --- a/recipes/tinyalsa/all/test_package/conanfile.py +++ b/recipes/tinyalsa/all/test_package/conanfile.py @@ -1,9 +1,23 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +from conan.tools.files import load, save import os -from conans import ConanFile, CMake, tools -class LibalsaTestConan(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" + + def requirements(self): + self.requires(self.tested_reference_str, run=True) + + def layout(self): + cmake_layout(self) + + def generate(self): + save(self, os.path.join(self.build_folder, "with_utils"), + str(self.dependencies["tinyalsa"].options.with_utils)) def build(self): cmake = CMake(self) @@ -11,6 +25,8 @@ 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], "example") + self.run(bin_path, env="conanrun") + if load(self, os.path.join(self.build_folder, "with_utils")) == "True": + self.run("tinymix --help", env="conanrun") diff --git a/recipes/tinyalsa/all/test_v1_package/CMakeLists.txt b/recipes/tinyalsa/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/tinyalsa/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/tinyalsa/all/test_v1_package/conanfile.py b/recipes/tinyalsa/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..bb566468b9731 --- /dev/null +++ b/recipes/tinyalsa/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", "example") + self.run(bin_path, run_environment=True) diff --git a/recipes/tinycbor/all/conanfile.py b/recipes/tinycbor/all/conanfile.py index fbf3f3604b92f..61985ed700c30 100644 --- a/recipes/tinycbor/all/conanfile.py +++ b/recipes/tinycbor/all/conanfile.py @@ -1,14 +1,14 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration from conan.tools.apple import is_apple_os -from conan.tools.env import Environment, VirtualBuildEnv +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, unix_path, VCVars +from conan.tools.microsoft import is_msvc, NMakeToolchain import os -required_conan_version = ">=1.53.0" +required_conan_version = ">=1.55.0" class TinycborConan(ConanFile): @@ -53,8 +53,8 @@ def layout(self): basic_layout(self, src_folder="src") def validate(self): - if self.info.options.shared and (self.info.settings.os == "Windows" or is_apple_os(self)): - raise ConanInvalidConfiguration(f"{self.ref} shared not supported on {self.info.settings.os}") + 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}") def build_requirements(self): if self._settings_build.os == "Windows" and not is_msvc(self): @@ -63,29 +63,20 @@ def build_requirements(self): self.tool_requires("msys2/cci.latest") 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 is_msvc(self): - vc = VCVars(self) - vc.generate() - # FIXME: no conan v2 build helper for NMake yet (see https://github.com/conan-io/conan/issues/12188) - # So populate CL with AutotoolsToolchain cflags - env = Environment() - c_flags = AutotoolsToolchain(self).cflags - if c_flags: - env.define("CL", c_flags) - env.vars(self).save_script("conanbuildenv_nmake") + 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") - env.define_path("DESTDIR", unix_path(self, self.package_folder)) - tc.generate() + tc.generate(env) def build(self): apply_conandata_patches(self) @@ -110,8 +101,7 @@ def package(self): else: 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)}"]) + autotools.install() rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) rmdir(self, os.path.join(self.package_folder, "bin")) diff --git a/recipes/tinycolormap/all/conandata.yml b/recipes/tinycolormap/all/conandata.yml new file mode 100644 index 0000000000000..771edaa798dc0 --- /dev/null +++ b/recipes/tinycolormap/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "cci.20230223": + url: "https://github.com/yuki-koyama/tinycolormap/archive/0f62abbc269d9677829083d4d563643830ac7fb9.zip" + sha256: "f736d7b76ea07e43da6c6905d891bc58ef512a794bbc0ef3ba9b593b4c1e2d63" diff --git a/recipes/tinycolormap/all/conanfile.py b/recipes/tinycolormap/all/conanfile.py new file mode 100644 index 0000000000000..be4fc0dfc05d4 --- /dev/null +++ b/recipes/tinycolormap/all/conanfile.py @@ -0,0 +1,64 @@ +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 + +required_conan_version = ">=1.52.0" + + +class TinycolormapConan(ConanFile): + name = "tinycolormap" + description = "A header-only, single-file library for colormaps written in C++11" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/yuki-koyama/tinycolormap" + topics = ("color", "colormap", "visualization", "header-only") + package_type = "header-library" + + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + options = { + "with_eigen": [True, False], + "with_qt": [True, False], + } + default_options = { + "with_eigen": False, + "with_qt": False, + } + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def requirements(self): + if self.options.with_eigen: + self.requires("eigen/3.4.0") + if self.options.with_qt: + # Only Qt5 is supported + self.requires("qt/5.15.13") + + 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], strip_root=True) + + def package(self): + copy(self, "LICENSE", 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_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + if self.options.with_eigen: + self.cpp_info.defines.append("TINYCOLORMAP_WITH_EIGEN") + self.cpp_info.requires.append("eigen::eigen") + if self.options.with_qt: + self.cpp_info.defines.append("TINYCOLORMAP_WITH_QT5") + self.cpp_info.requires.append("qt::qtGui") diff --git a/recipes/tinycolormap/all/test_package/CMakeLists.txt b/recipes/tinycolormap/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..cafa69c0c2ce2 --- /dev/null +++ b/recipes/tinycolormap/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(tinycolormap REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE tinycolormap::tinycolormap) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/tinycolormap/all/test_package/conanfile.py b/recipes/tinycolormap/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0a808db45f245 --- /dev/null +++ b/recipes/tinycolormap/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/tinycolormap/all/test_package/test_package.cpp b/recipes/tinycolormap/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..fdc0a6b320ab7 --- /dev/null +++ b/recipes/tinycolormap/all/test_package/test_package.cpp @@ -0,0 +1,10 @@ +#include + +#include + +int main() { + double value = 0.75; + auto color = tinycolormap::GetColor(value, tinycolormap::ColormapType::Viridis); + std::cout << "Viridis RGB values at " << value << ": " + << (int)color.ri() << " " << (int)color.gi() << " " << (int)color.bi() << std::endl; +} diff --git a/recipes/tinycolormap/config.yml b/recipes/tinycolormap/config.yml new file mode 100644 index 0000000000000..5ebaf8fdf738e --- /dev/null +++ b/recipes/tinycolormap/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20230223": + folder: all diff --git a/recipes/tinycthread/all/CMakeLists.txt b/recipes/tinycthread/all/CMakeLists.txt deleted file mode 100644 index 02369ff70e932..0000000000000 --- a/recipes/tinycthread/all/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper C) - -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS KEEP_RPATHS) - -set(CMAKE_C_STANDARD 11) - -add_subdirectory(source_subfolder) diff --git a/recipes/tinycthread/all/conanfile.py b/recipes/tinycthread/all/conanfile.py index 9b30f020bc7d1..a3426b3f41922 100644 --- a/recipes/tinycthread/all/conanfile.py +++ b/recipes/tinycthread/all/conanfile.py @@ -1,65 +1,56 @@ -from conans import CMake, ConanFile, 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 get, copy, load, save from conan.tools.microsoft import msvc_runtime_flag, is_msvc -import functools import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.54.0" class TinycthreadConan(ConanFile): name = "tinycthread" description = "Small, portable implementation of the C11 threads API" - license = "zlib" + license = "Zlib" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/tinycthread/tinycthread" topics = ("thread", "c11", "portable") + package_type = "static-library" settings = "os", "arch", "compiler", "build_type" - 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 configure(self): - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.settings.compiler.rm_safe("libcxx") + self.settings.compiler.rm_safe("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) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["TINYCTHREAD_DISABLE_TESTS"] = True - cmake.definitions["TINYCTHREAD_INSTALL"] = True - cmake.configure(build_folder=self._build_subfolder) - return cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["TINYCTHREAD_DISABLE_TESTS"] = True + tc.variables["TINYCTHREAD_INSTALL"] = True + tc.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def _extract_license(self): - file = os.path.join(self.source_folder, self._source_subfolder, "source", "tinycthread.h") - file_content = tools.load(file) + file = os.path.join(self.source_folder, "source", "tinycthread.h") + file_content = load(self, file) license_start = file_content.find("Copyright") license_end = file_content.find("*/") license_contents = file_content[license_start:license_end] - 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._extract_license() - 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/tinycthread/all/test_package/CMakeLists.txt b/recipes/tinycthread/all/test_package/CMakeLists.txt index 44be8f2abcf9d..70582c5470eea 100644 --- a/recipes/tinycthread/all/test_package/CMakeLists.txt +++ b/recipes/tinycthread/all/test_package/CMakeLists.txt @@ -2,10 +2,6 @@ cmake_minimum_required(VERSION 3.1) project(test_package C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) - -conan_basic_setup(TARGETS) - find_package(tinycthread REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) diff --git a/recipes/tinycthread/all/test_package/conanfile.py b/recipes/tinycthread/all/test_package/conanfile.py index a500b98343c74..ef5d7042163ec 100644 --- a/recipes/tinycthread/all/test_package/conanfile.py +++ b/recipes/tinycthread/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", "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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/tinycthread/all/test_v1_package/CMakeLists.txt b/recipes/tinycthread/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/tinycthread/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/tinycthread/all/test_v1_package/conanfile.py b/recipes/tinycthread/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..a500b98343c74 --- /dev/null +++ b/recipes/tinycthread/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/tinycthreadpool/all/conandata.yml b/recipes/tinycthreadpool/all/conandata.yml new file mode 100644 index 0000000000000..a6b63fae3cefb --- /dev/null +++ b/recipes/tinycthreadpool/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.0": + url: "https://github.com/bennyhuo/tinycthreadpool/archive/refs/tags/v1.0.tar.gz" + sha256: "a3e9876d3e3008cffed96216d026504b57ab6be6ee3df62d5916fecd4106ede5" diff --git a/recipes/tinycthreadpool/all/conanfile.py b/recipes/tinycthreadpool/all/conanfile.py new file mode 100644 index 0000000000000..1cc771a3807a5 --- /dev/null +++ b/recipes/tinycthreadpool/all/conanfile.py @@ -0,0 +1,66 @@ +import os + +from conan import ConanFile +from conan.tools.files import get, copy +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout + +required_conan_version = ">=1.54.0" + + +class TinyCThreadPoolConan(ConanFile): + name = "tinycthreadpool" + description = "Portable C thread pool" + license = "BSD-2-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/bennyhuo/tinycthreadpool" + topics = ("thread-pool", "threading", "pure-c") + settings = "os", "compiler", "build_type", "arch" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + 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 config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires("tinycthread/cci.20161001", transitive_headers=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", 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 = ["tinycthreadpool"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("pthread") diff --git a/recipes/tinycthreadpool/all/test_package/CMakeLists.txt b/recipes/tinycthreadpool/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..873506d1a8b31 --- /dev/null +++ b/recipes/tinycthreadpool/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(PackageTest C) + +find_package(tinycthreadpool REQUIRED CONFIG) + +add_executable(example example.c) +target_link_libraries(example tinycthreadpool::tinycthreadpool) +target_compile_features(example PRIVATE c_std_11) diff --git a/recipes/tinycthreadpool/all/test_package/conanfile.py b/recipes/tinycthreadpool/all/test_package/conanfile.py new file mode 100644 index 0000000000000..5ebee977f3e4e --- /dev/null +++ b/recipes/tinycthreadpool/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 ThreadpoolTestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + 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) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + cmd = os.path.join(self.cpp.build.bindir, "example") + self.run(cmd, env="conanrun") diff --git a/recipes/tinycthreadpool/all/test_package/example.c b/recipes/tinycthreadpool/all/test_package/example.c new file mode 100644 index 0000000000000..af998ecc461c4 --- /dev/null +++ b/recipes/tinycthreadpool/all/test_package/example.c @@ -0,0 +1,14 @@ +#include +#include +#include + +int main(void) { + puts("Start Testing!"); + threadpool_t *threadpool = threadpool_create(3, 5, 0); + printf("Create thread pool: %#x.\n", threadpool); + if (threadpool){ + int result = threadpool_destroy(threadpool, 0); + printf("End Testing! result: %d\n", result); + } + return 0; +} diff --git a/recipes/tinycthreadpool/all/test_v1_package/CMakeLists.txt b/recipes/tinycthreadpool/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/tinycthreadpool/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/tinycthreadpool/all/test_v1_package/conanfile.py b/recipes/tinycthreadpool/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..2a41ea908ed28 --- /dev/null +++ b/recipes/tinycthreadpool/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", "example") + self.run(bin_path, run_environment=True) diff --git a/recipes/tinycthreadpool/config.yml b/recipes/tinycthreadpool/config.yml new file mode 100644 index 0000000000000..739bad18cc6dc --- /dev/null +++ b/recipes/tinycthreadpool/config.yml @@ -0,0 +1,4 @@ +versions: + # Newer versions at the top + "1.0": + folder: all diff --git a/recipes/tinydir/all/conandata.yml b/recipes/tinydir/all/conandata.yml index 16d1524b1696f..b8405fd5f1756 100644 --- a/recipes/tinydir/all/conandata.yml +++ b/recipes/tinydir/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.2.6": + url: "https://github.com/cxong/tinydir/archive/refs/tags/1.2.6.tar.gz" + sha256: "1ecbdf8d04b079f8a9404662708d2333d6b72b956effb0d5296d063db3a02b4e" "1.2.5": url: "https://github.com/cxong/tinydir/archive/refs/tags/1.2.5.tar.gz" sha256: "7ab150a16fa78ea76e9fd58ef88922c03eca2334c023b8d9bc94755fdde522c7" diff --git a/recipes/tinydir/all/conanfile.py b/recipes/tinydir/all/conanfile.py index 02a2a8bc1ce2e..05e3a7a3c83ca 100644 --- a/recipes/tinydir/all/conanfile.py +++ b/recipes/tinydir/all/conanfile.py @@ -1,7 +1,11 @@ import os -from conans import ConanFile, tools -required_conan_version = ">=1.33.0" +from conan import ConanFile +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout + +required_conan_version = ">=1.52.0" + class TinydirConan(ConanFile): name = "tinydir" @@ -10,19 +14,24 @@ class TinydirConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/cxong/tinydir" topics = ("portable", "filesystem", "directory", "posix", "header-only") + + 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.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], strip_root=True) def package(self): - self.copy("tinydir.h", dst="include", src=self._source_subfolder) - self.copy("COPYING", dst="licenses", src=self._source_subfolder) + copy(self, "tinydir.h", dst=os.path.join(self.package_folder, "include"), src=self.source_folder) + copy(self, "COPYING", 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/tinydir/all/test_package/CMakeLists.txt b/recipes/tinydir/all/test_package/CMakeLists.txt index bd0eb537bad62..f2b0b480c35cb 100644 --- a/recipes/tinydir/all/test_package/CMakeLists.txt +++ b/recipes/tinydir/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.15) +project(test_package LANGUAGES C) find_package(tinydir REQUIRED CONFIG) diff --git a/recipes/tinydir/all/test_package/conanfile.py b/recipes/tinydir/all/test_package/conanfile.py index 38f4483872d47..e0e49c1e8d6b6 100644 --- a/recipes/tinydir/all/test_package/conanfile.py +++ b/recipes/tinydir/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", + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/tinydir/all/test_v1_package/CMakeLists.txt b/recipes/tinydir/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/tinydir/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/tinydir/all/test_v1_package/conanfile.py b/recipes/tinydir/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/tinydir/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/tinydir/all/test_v1_package/test_package.c b/recipes/tinydir/all/test_v1_package/test_package.c new file mode 100644 index 0000000000000..cc0003c9c9d0c --- /dev/null +++ b/recipes/tinydir/all/test_v1_package/test_package.c @@ -0,0 +1,27 @@ +#include +#include + +#include "tinydir.h" + +int main() +{ + tinydir_dir dir; + tinydir_open(&dir, "."); + + while (dir.has_next) + { + tinydir_file file; + tinydir_readfile(&dir, &file); + + printf("%s", file.name); + if (file.is_dir) + { + printf("/"); + } + printf("\n"); + + tinydir_next(&dir); + } + + tinydir_close(&dir); +} diff --git a/recipes/tinydir/config.yml b/recipes/tinydir/config.yml index 712ebbf8b5754..065b272032773 100644 --- a/recipes/tinydir/config.yml +++ b/recipes/tinydir/config.yml @@ -1,4 +1,6 @@ versions: + "1.2.6": + folder: "all" "1.2.5": folder: "all" "1.2.4": diff --git a/recipes/tinyexif/all/conandata.yml b/recipes/tinyexif/all/conandata.yml new file mode 100644 index 0000000000000..71979e9e91636 --- /dev/null +++ b/recipes/tinyexif/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "cci.20210411": + url: "https://github.com/cdcseacave/TinyEXIF/archive/6e56015f56ee0f387f1b8c76e50eb35ac60372da.tar.gz" + sha256: "54031072382dbe9cc08ca18b40e39a6c2b248e83bd6263b29c70a4a8aa8affe7" + "1.0.2": + url: "https://github.com/cdcseacave/TinyEXIF/archive/refs/tags/1.0.2.tar.gz" + sha256: "427e02c38ee29d87bc82d08545d9f9a68c603af16e0b35f6807a4a8e63c14b86" diff --git a/recipes/tinyexif/all/conanfile.py b/recipes/tinyexif/all/conanfile.py new file mode 100644 index 0000000000000..08cc3c6b5f4f9 --- /dev/null +++ b/recipes/tinyexif/all/conanfile.py @@ -0,0 +1,92 @@ +from conan import ConanFile +from conan.tools.files import get, rmdir, save, load +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.microsoft import is_msvc_static_runtime +import os + +required_conan_version = ">=1.53.0" + +class TinyEXIFConan(ConanFile): + name = "tinyexif" + description = "Tiny ISO-compliant C++ EXIF and XMP parsing library for JPEG" + license = "BSD 2-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/cdcseacave/TinyEXIF/" + topics = ("exif", "exif-metadata", "exif-ata-extraction", "exif-reader", "xmp", "xmp-parsing-library") + package_type = "library" + 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 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("tinyxml2/9.0.0") + + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + + 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 + tc.variables["LINK_CRT_STATIC_LIBS"] = is_msvc_static_runtime(self) + tc.variables["BUILD_DEMO"] = False + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() + + tc = CMakeDeps(self) + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + filename = os.path.join(self.source_folder, self.source_folder, "TinyEXIF.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) + cmake = CMake(self) + cmake.install() + + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + + def package_info(self): + libpostfix = "d" if self.settings.build_type == "Debug" else "" + self.cpp_info.libs = [f"TinyEXIF{libpostfix}"] + + self.cpp_info.set_property("cmake_file_name", "TinyEXIF") + self.cpp_info.set_property("cmake_target_name", "TinyEXIF::TinyEXIF") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "TinyEXIF" + self.cpp_info.filenames["cmake_find_package_multi"] = "TinyEXIF" + self.cpp_info.names["cmake_find_package"] = "TinyEXIF" + self.cpp_info.names["cmake_find_package_multi"] = "TinyEXIF" diff --git a/recipes/tinyexif/all/test_package/CMakeLists.txt b/recipes/tinyexif/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..569754ada9dd8 --- /dev/null +++ b/recipes/tinyexif/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(TinyEXIF REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE TinyEXIF::TinyEXIF) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/tinyexif/all/test_package/conanfile.py b/recipes/tinyexif/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fbb7f543162 --- /dev/null +++ b/recipes/tinyexif/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/tinyexif/all/test_package/test_package.cpp b/recipes/tinyexif/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..30f098eca31a7 --- /dev/null +++ b/recipes/tinyexif/all/test_package/test_package.cpp @@ -0,0 +1,10 @@ +#include +#include "TinyEXIF.h" + +int main() { + TinyEXIF::EXIFInfo exif; + + std::cout << exif.Fields << std::endl; + + return 0; +} diff --git a/recipes/tinyexif/all/test_v1_package/CMakeLists.txt b/recipes/tinyexif/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..be00a8c7f57c7 --- /dev/null +++ b/recipes/tinyexif/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/tinyexif/all/test_v1_package/conanfile.py b/recipes/tinyexif/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/tinyexif/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/tinyexif/config.yml b/recipes/tinyexif/config.yml new file mode 100644 index 0000000000000..86908239eff55 --- /dev/null +++ b/recipes/tinyexif/config.yml @@ -0,0 +1,5 @@ +versions: + "cci.20210411": + folder: all + "1.0.2": + folder: all diff --git a/recipes/tinyexr/all/conandata.yml b/recipes/tinyexr/all/conandata.yml index 1cf53acb3c810..e57fb348a5c61 100644 --- a/recipes/tinyexr/all/conandata.yml +++ b/recipes/tinyexr/all/conandata.yml @@ -1,8 +1,23 @@ sources: + "1.0.7": + url: "https://github.com/syoyo/tinyexr/archive/v1.0.7.tar.gz" + sha256: "1ffcc4ce85edef4af955497417445c2a7d3565ad9f314cd69f33075a37a48359" + "1.0.6": + url: "https://github.com/syoyo/tinyexr/archive/v1.0.6.tar.gz" + sha256: "807a5665a7da8dc5ba4dd2c0f69079d87f37a147399680a54e3b38f86486aa67" + "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..cf57d86c16364 100644 --- a/recipes/tinyexr/all/conanfile.py +++ b/recipes/tinyexr/all/conanfile.py @@ -1,17 +1,19 @@ -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") - + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" options = { "with_z": ["zlib", "miniz"], @@ -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.2") else: - self.requires("zlib/1.2.12") + self.requires("zlib/[>=1.2.11 <2]") 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..e845ae751a301 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,6 @@ def build(self): 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, "test.exr") - self.run("{} {}".format(bin_path, img_path), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/tinyexr/all/test_package/test.exr b/recipes/tinyexr/all/test_package/test.exr deleted file mode 100644 index 5cc69a90c12ce..0000000000000 Binary files a/recipes/tinyexr/all/test_package/test.exr and /dev/null differ diff --git a/recipes/tinyexr/all/test_package/test_package.cpp b/recipes/tinyexr/all/test_package/test_package.cpp index 2cd0713e457c8..b1d9264dbf3c1 100644 --- a/recipes/tinyexr/all/test_package/test_package.cpp +++ b/recipes/tinyexr/all/test_package/test_package.cpp @@ -11,25 +11,15 @@ int main(int argc, const char *argv[]) { - if (argc < 2) { - std::cerr << "Need at least one argument\n"; - } - float* out; int width; int height; const char* err = nullptr; - int ret = LoadEXR(&out, &width, &height, argv[1], &err); + int ret = LoadEXR(&out, &width, &height, "non-real-file.exr", &err); - if (ret == TINYEXR_SUCCESS) { - free(out); - } else { - if(err) { - std::cerr << err << std::endl; - } else { - std::cerr << "Unknown error." << std::endl; - } + if (ret != TINYEXR_SUCCESS) { + std::cout << "Test message\n"; // Always prints } return 0; 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..20d4d2e28d57e --- /dev/null +++ b/recipes/tinyexr/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/tinyexr/config.yml b/recipes/tinyexr/config.yml index 40341aa3db6cd..675ce3be79396 100644 --- a/recipes/tinyexr/config.yml +++ b/recipes/tinyexr/config.yml @@ -1,3 +1,9 @@ versions: + "1.0.7": + folder: all + "1.0.6": + folder: all + "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 0e07d04c2de59..105809b76f50e 100644 --- a/recipes/tinygltf/all/conandata.yml +++ b/recipes/tinygltf/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "2.9.0": + url: "https://github.com/syoyo/tinygltf/archive/v2.9.0.tar.gz" + sha256: "76c4da3fcd664ccf1b3d35f1d934dd19820141c8705c4966d841176c4c10a2e9" + "2.8.19": + url: "https://github.com/syoyo/tinygltf/archive/v2.8.19.tar.gz" + sha256: "9e3f6206c6e922c7482e1b4612b62c5cddb7e053b6690fa20edfa5d97805053b" + "2.8.13": + url: "https://github.com/syoyo/tinygltf/archive/v2.8.13.tar.gz" + sha256: "72c3e5affa8389442582e4cf67426376e2dff418e998e19822260f4bf58b74b8" "2.5.0": url: "https://github.com/syoyo/tinygltf/archive/v2.5.0.tar.gz" sha256: "5d85bd556b60b1b69527189293cfa4902957d67fabb8582b6532f23a5ef27ec1" diff --git a/recipes/tinygltf/all/conanfile.py b/recipes/tinygltf/all/conanfile.py index 1d6e2279c2680..b9947293a173f 100644 --- a/recipes/tinygltf/all/conanfile.py +++ b/recipes/tinygltf/all/conanfile.py @@ -11,10 +11,10 @@ class TinygltfConan(ConanFile): name = "tinygltf" description = "Header only C++11 tiny glTF 2.0 library." license = "MIT" - topics = ("gltf") - homepage = "https://github.com/syoyo/tinygltf" url = "https://github.com/conan-io/conan-center-index" - + homepage = "https://github.com/syoyo/tinygltf" + topics = ("gltf", "header-only") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" options = { "draco": [True, False], @@ -34,19 +34,18 @@ def package_id(self): self.info.clear() def requirements(self): - self.requires("nlohmann_json/3.11.2") + self.requires("nlohmann_json/3.11.3") if self.options.draco: - self.requires("draco/1.5.5") + self.requires("draco/1.5.6") if self.options.stb_image or self.options.stb_image_write: - self.requires("stb/cci.20210910") + self.requires("stb/cci.20230920") 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 build(self): replace_in_file(self, os.path.join(self.source_folder, "tiny_gltf.h"), diff --git a/recipes/tinygltf/all/test_package/box01.glb b/recipes/tinygltf/all/test_package/box01.glb deleted file mode 100644 index 7477e897f06a5..0000000000000 Binary files a/recipes/tinygltf/all/test_package/box01.glb and /dev/null differ diff --git a/recipes/tinygltf/all/test_package/conanfile.py b/recipes/tinygltf/all/test_package/conanfile.py index 0708ee77c3850..0a6bc68712d90 100644 --- a/recipes/tinygltf/all/test_package/conanfile.py +++ b/recipes/tinygltf/all/test_package/conanfile.py @@ -23,5 +23,4 @@ def build(self): def test(self): 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") - self.run(f"{bin_path} {glb_path}", env="conanrun") + self.run(bin_path, env="conanrun") diff --git a/recipes/tinygltf/all/test_package/test_package.cpp b/recipes/tinygltf/all/test_package/test_package.cpp index ade21796f6efe..0dd78b403c96f 100644 --- a/recipes/tinygltf/all/test_package/test_package.cpp +++ b/recipes/tinygltf/all/test_package/test_package.cpp @@ -8,29 +8,13 @@ #include int main(int argc, char **argv) { - if (argc < 2) { - std::cerr << "Need at least one argument\n"; - return 1; - } tinygltf::Model model; tinygltf::TinyGLTF loader; std::string err; std::string warn; - bool ret = loader.LoadBinaryFromFile(&model, &err, &warn, argv[1]); - - if (!warn.empty()) { - printf("Warn: %s\n", warn.c_str()); - } - - if (!err.empty()) { - printf("Err: %s\n", err.c_str()); - } - - if (!ret) { - printf("Failed to parse glTF\n"); - return -1; - } + bool ret = loader.LoadBinaryFromFile(&model, &err, &warn, "non_existent_file.glb"); + printf("Test %d\n", ret); return 0; } diff --git a/recipes/tinygltf/all/test_v1_package/conanfile.py b/recipes/tinygltf/all/test_v1_package/conanfile.py index 6d85d0b397c56..38f4483872d47 100644 --- a/recipes/tinygltf/all/test_v1_package/conanfile.py +++ b/recipes/tinygltf/all/test_v1_package/conanfile.py @@ -14,5 +14,4 @@ def build(self): 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) + self.run(bin_path, run_environment=True) diff --git a/recipes/tinygltf/config.yml b/recipes/tinygltf/config.yml index a23d2b23eb439..3eba51a5b7276 100644 --- a/recipes/tinygltf/config.yml +++ b/recipes/tinygltf/config.yml @@ -1,4 +1,10 @@ versions: + "2.9.0": + folder: all + "2.8.19": + folder: all + "2.8.13": + folder: all "2.5.0": folder: all "2.4.0": diff --git a/recipes/tinymidi/all/CMakeLists.txt b/recipes/tinymidi/all/CMakeLists.txt new file mode 100644 index 0000000000000..094fa86cdf303 --- /dev/null +++ b/recipes/tinymidi/all/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.15) +project(tinymidi LANGUAGES C) + +add_library(tinymidi ${TINYMIDI_SRC_DIR}/rawmidi.c) + +include(GNUInstallDirs) +install(FILES ${TINYMIDI_SRC_DIR}/include/rawmidi.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +install( + TARGETS tinymidi + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR} +) diff --git a/recipes/tinymidi/all/conanfile.py b/recipes/tinymidi/all/conanfile.py index b2ff9ca52409d..02f50473bbbf6 100644 --- a/recipes/tinymidi/all/conanfile.py +++ b/recipes/tinymidi/all/conanfile.py @@ -1,17 +1,20 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, 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 copy, get import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class TinyMidiConan(ConanFile): name = "tinymidi" description = "A small C library for doing MIDI on GNU/Linux" - topics = ("conan", "tinymidi", "MIDI") + topics = ("audio", "MIDI") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/krgn/tinymidi" license = "LGPL-3.0-only" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -22,64 +25,38 @@ class TinyMidiConan(ConanFile): "fPIC": True, } - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" + exports_sources = "CMakeLists.txt" 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 validate(self): if self.settings.os not in ["Linux", "FreeBSD"]: raise ConanInvalidConfiguration("Only Linux and FreeBSD are supported") - def build_requirements(self): - self.build_requires("libtool/2.4.6") - 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 _get_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self) - self._autotools.libs = [] - return self._autotools - - def _make_args(self, autotools): - args = [ - "INSTALL_PREFIX={}".format(tools.unix_path(self.package_folder)), - "COMPILE_FLAGS={}".format(autotools.vars["CFLAGS"]), - "LINKING_FLAGS={} -o".format(autotools.vars["LDFLAGS"]), - ] - if tools.get_env("CC"): - args.append("CC={}".format(tools.get_env("CC"))) - return args + def generate(self): + tc = CMakeToolchain(self) + tc.variables["TINYMIDI_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.generate() def build(self): - with tools.chdir(self._source_subfolder): - autotools = self._get_autotools() - make_args = self._make_args(autotools) - autotools.make(args=make_args) + 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) - tools.mkdir(os.path.join(self.package_folder, "include")) - tools.mkdir(os.path.join(self.package_folder, "lib")) - with tools.chdir(self._source_subfolder): - autotools = self._get_autotools() - make_args = self._make_args(autotools) - autotools.install(args=make_args) - if self.options.shared: - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.a") - else: - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.so*") + 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.libs = ["tinymidi"] diff --git a/recipes/tinymidi/all/test_package/CMakeLists.txt b/recipes/tinymidi/all/test_package/CMakeLists.txt index afa2476357074..e64d0510b8470 100644 --- a/recipes/tinymidi/all/test_package/CMakeLists.txt +++ b/recipes/tinymidi/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(tinymidi REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE tinymidi::tinymidi) diff --git a/recipes/tinymidi/all/test_package/conanfile.py b/recipes/tinymidi/all/test_package/conanfile.py index 07847b3d9465f..98ab55852ad56 100644 --- a/recipes/tinymidi/all/test_package/conanfile.py +++ b/recipes/tinymidi/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,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/tinymidi/all/test_v1_package/CMakeLists.txt b/recipes/tinymidi/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/tinymidi/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/tinymidi/all/test_v1_package/conanfile.py b/recipes/tinymidi/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/tinymidi/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/tinyply/all/conanfile.py b/recipes/tinyply/all/conanfile.py index 04d436851cee5..97b1320f978d5 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], @@ -31,18 +32,17 @@ 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: + 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) @@ -74,3 +74,5 @@ def package_info(self): self.cpp_info.set_property("cmake_target_name", "tinyply::tinyply") self.cpp_info.set_property("pkg_config_name", "tinyply") 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/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/conanfile.py b/recipes/tinyxml/all/conanfile.py index b6d3aba1021b4..3616d277c7fb4 100644 --- a/recipes/tinyxml/all/conanfile.py +++ b/recipes/tinyxml/all/conanfile.py @@ -5,17 +5,17 @@ from conan.tools.microsoft import is_msvc import os -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.53.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 = ("xml", "parser") - homepage = "http://www.grinninglizard.com/tinyxml/" url = "https://github.com/conan-io/conan-center-index" - + homepage = "http://www.grinninglizard.com/tinyxml/" + topics = ("xml", "parser") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -25,7 +25,7 @@ class TinyXmlConan(ConanFile): default_options = { "shared": False, "fPIC": True, - "with_stl": False, + "with_stl": True, } exports_sources = "CMakeLists.txt" @@ -36,10 +36,7 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") @@ -49,8 +46,7 @@ def validate(self): raise ConanInvalidConfiguration(f"{self.ref} shared not supported by 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/tinyxml2/all/conandata.yml b/recipes/tinyxml2/all/conandata.yml index e2cd904cc1876..f8959f0c1aa8a 100644 --- a/recipes/tinyxml2/all/conandata.yml +++ b/recipes/tinyxml2/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "10.0.0": + url: "https://github.com/leethomason/tinyxml2/archive/refs/tags/10.0.0.tar.gz" + sha256: "3bdf15128ba16686e69bce256cc468e76c7b94ff2c7f391cc5ec09e40bff3839" "9.0.0": url: "https://github.com/leethomason/tinyxml2/archive/refs/tags/9.0.0.tar.gz" sha256: "cc2f1417c308b1f6acc54f88eb70771a0bf65f76282ce5c40e54cfe52952702c" 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/tinyxml2/config.yml b/recipes/tinyxml2/config.yml index 0458a9c7b0da4..08bc3b64c9acc 100644 --- a/recipes/tinyxml2/config.yml +++ b/recipes/tinyxml2/config.yml @@ -1,4 +1,6 @@ versions: + "10.0.0": + folder: all "9.0.0": folder: all "8.0.0": diff --git a/recipes/tixi3/all/conandata.yml b/recipes/tixi3/all/conandata.yml index 2336f6ccbdc16..0af8f2d8ae5cf 100644 --- a/recipes/tixi3/all/conandata.yml +++ b/recipes/tixi3/all/conandata.yml @@ -4,6 +4,10 @@ sources: url: "https://github.com/DLR-SC/tixi/archive/refs/tags/v3.3.0.tar.gz" patches: "3.3.0": + - patch_file: "patches/0001-missing-stdlib-include.patch" + patch_description: "fix missing stdlib include" + patch_type: "bugfix" + patch_source: "https://github.com/DLR-SC/tixi/pull/225" - patch_file: "patches/link_curl.patch" patch_description: "Fix CMake target name for libcurl" patch_type: "conan" diff --git a/recipes/tixi3/all/conanfile.py b/recipes/tixi3/all/conanfile.py index b8124c51186f6..d67da63a2bb15 100644 --- a/recipes/tixi3/all/conanfile.py +++ b/recipes/tixi3/all/conanfile.py @@ -33,12 +33,12 @@ def generate(self): deps.generate() def requirements(self): - self.requires("libxml2/2.9.14") - self.requires("libxslt/1.1.34") - self.requires("libcurl/7.84.0") + self.requires("libxml2/[>=2.12.5 <3]") + self.requires("libxslt/1.1.42") + self.requires("libcurl/[>=7.78.0 <9]") def layout(self): - cmake_layout(self) + cmake_layout(self, src_folder="src") def config_options(self): if self.settings.os == "Windows": @@ -46,20 +46,10 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass - + self.options.rm_safe("fPIC") # tixi is a c library - 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 export_sources(self): for patch in self.conan_data.get("patches", {}).get(self.version, []): diff --git a/recipes/tixi3/all/patches/0001-missing-stdlib-include.patch b/recipes/tixi3/all/patches/0001-missing-stdlib-include.patch new file mode 100644 index 0000000000000..1c8e8d048f4f9 --- /dev/null +++ b/recipes/tixi3/all/patches/0001-missing-stdlib-include.patch @@ -0,0 +1,88 @@ +From 53b324c41133ac72b36f2bcda0b75c2bf2f3bff0 Mon Sep 17 00:00:00 2001 +From: mayeut +Date: Sat, 20 Apr 2024 13:10:18 +0200 +Subject: [PATCH] fix issues with latest version of libxml2 + +--- + src/tixiImpl.c | 1 + + src/tixiInternal.c | 2 +- + src/tixiUtils.c | 1 + + src/uidHelper.c | 1 + + src/webMethods.c | 2 ++ + src/xpathFunctions.c | 1 + + 6 files changed, 7 insertions(+), 1 deletion(-) + +diff --git a/src/tixiImpl.c b/src/tixiImpl.c +index f9e08b9..aa306d1 100644 +--- a/src/tixiImpl.c ++++ b/src/tixiImpl.c +@@ -27,6 +27,7 @@ + #include + #include + #include ++#include + + #include "libxml/parser.h" + #include "libxml/xpath.h" +diff --git a/src/tixiInternal.c b/src/tixiInternal.c +index 5bf0712..b399b4d 100644 +--- a/src/tixiInternal.c ++++ b/src/tixiInternal.c +@@ -46,7 +46,7 @@ + + extern void printMsg(MessageType type, const char* message, ...); + +-void xmlStructuredErrorHandler(void * userData, xmlErrorPtr error) { ++void xmlStructuredErrorHandler(void * userData, xmlError const* error) { + printMsg(MESSAGETYPE_ERROR, "%s:%i: %s", error->file, error->line, error->message); + } + +diff --git a/src/tixiUtils.c b/src/tixiUtils.c +index 834be5d..bd42fc8 100644 +--- a/src/tixiUtils.c ++++ b/src/tixiUtils.c +@@ -32,6 +32,7 @@ + #include + #include + #endif ++#include + + extern void printMsg(MessageType type, const char* message, ...); + +diff --git a/src/uidHelper.c b/src/uidHelper.c +index 9c7a7bd..841774d 100644 +--- a/src/uidHelper.c ++++ b/src/uidHelper.c +@@ -17,6 +17,7 @@ + */ + #include "uidHelper.h" + #include "tixiInternal.h" ++#include + + extern void printMsg(MessageType type, const char* message, ...); + +diff --git a/src/webMethods.c b/src/webMethods.c +index f8372e9..16e6411 100644 +--- a/src/webMethods.c ++++ b/src/webMethods.c +@@ -25,6 +25,8 @@ + #include + #include + ++#include ++ + extern void printMsg(MessageType type, const char* message, ...); + + void* myrealloc(void* ptr, size_t size) +diff --git a/src/xpathFunctions.c b/src/xpathFunctions.c +index 25442f6..69ce60e 100644 +--- a/src/xpathFunctions.c ++++ b/src/xpathFunctions.c +@@ -21,6 +21,7 @@ + #include "libxml/xpathInternals.h" + + #include ++#include + + extern void printMsg(MessageType type, const char* message, ...); + diff --git a/recipes/tixi3/all/test_package/CMakeLists.txt b/recipes/tixi3/all/test_package/CMakeLists.txt index c9358ca94ac50..9d54bfb6f94d4 100644 --- a/recipes/tixi3/all/test_package/CMakeLists.txt +++ b/recipes/tixi3/all/test_package/CMakeLists.txt @@ -1,7 +1,7 @@ -cmake_minimum_required(VERSION 3.12) -project(Tixi-Conan-TestPackage CXX) +cmake_minimum_required(VERSION 3.15) +project(test_package CXX) find_package(tixi3 REQUIRED) -add_executable(tixi3_conan_test main.cpp) -target_link_libraries(tixi3_conan_test PRIVATE tixi3) +add_executable(${PROJECT_NAME} main.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE tixi3) diff --git a/recipes/tixi3/all/test_package/conanfile.py b/recipes/tixi3/all/test_package/conanfile.py index 0e104e3f9a662..ef5d7042163ec 100644 --- a/recipes/tixi3/all/test_package/conanfile.py +++ b/recipes/tixi3/all/test_package/conanfile.py @@ -1,13 +1,16 @@ - from conan import ConanFile -from conan.tools.cmake import CMake, cmake_layout 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) @@ -19,5 +22,5 @@ def build(self): def test(self): if can_run(self): - bin_path = os.path.join(self.cpp.build.bindirs[0], "tixi3_conan_test") + bin_path = os.path.join(self.cpp.build.bindir, "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/tixi3/all/test_v1_package/CMakeLists.txt b/recipes/tixi3/all/test_v1_package/CMakeLists.txt deleted file mode 100644 index 80f9071294122..0000000000000 --- a/recipes/tixi3/all/test_v1_package/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -cmake_minimum_required(VERSION 3.1.2) -project(tixi3_conan_test CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(tixi3 REQUIRED CONFIG) - -add_executable(tixi3_conan_test ../test_package/main.cpp) -target_link_libraries(tixi3_conan_test tixi3) diff --git a/recipes/tixi3/all/test_v1_package/conanfile.py b/recipes/tixi3/all/test_v1_package/conanfile.py deleted file mode 100644 index d620b7c8ee1ca..0000000000000 --- a/recipes/tixi3/all/test_v1_package/conanfile.py +++ /dev/null @@ -1,19 +0,0 @@ -import os - -from conan.tools.build import cross_building -from conans import ConanFile, CMake - - -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", "tixi3_conan_test") - self.run(bin_path, run_environment=True) diff --git a/recipes/tk/all/conandata.yml b/recipes/tk/all/conandata.yml index 8cbbcf9134e3c..ab60eb6021e47 100644 --- a/recipes/tk/all/conandata.yml +++ b/recipes/tk/all/conandata.yml @@ -2,3 +2,18 @@ sources: "8.6.10": url: "https://prdownloads.sourceforge.net/tcl/tk8.6.10-src.tar.gz" sha256: "63df418a859d0a463347f95ded5cd88a3dd3aaa1ceecaeee362194bc30f3e386" + +patches: + "8.6.10": + - patch_file: "patches/0001-Add-unix-conan-compatibility.patch" + patch_description: "Add unix conan compatibility" + patch_type: "conan" + - patch_file: "patches/0002-Add-windows-conan-compatibility.patch" + patch_description: "Add windows conan compatibility" + patch_type: "conan" + - patch_file: "patches/0003-Patch-tkConfig.sh.patch" + patch_description: "Remove TK_BUILD_* and TK_SRC_DIR from tkConfig.sh for portability" + patch_type: "portability" + - patch_file: "patches/0004-Fix-msvc-shared-build.patch" + patch_description: "Output an inline file directly to its final destination to avoid a failure in C3I" + patch_type: "conan" diff --git a/recipes/tk/all/conanfile.py b/recipes/tk/all/conanfile.py index 97130833734db..1d1ce6f92531f 100644 --- a/recipes/tk/all/conanfile.py +++ b/recipes/tk/all/conanfile.py @@ -1,8 +1,26 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, tools -from conans.errors import ConanException, ConanInvalidConfiguration, ConanExceptionInUserConanfileMethod import os -required_conan_version = ">=1.33.0" +from conan import ConanFile +from conan.errors import ConanException, ConanInvalidConfiguration +from conan.tools.apple import is_apple_os, 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, + replace_in_file, + rmdir, +) +from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import NMakeDeps, NMakeToolchain, is_msvc +from conan.tools.scm import Version + +required_conan_version = ">=1.55.0" + class TkConan(ConanFile): name = "tk" @@ -12,6 +30,7 @@ class TkConan(ConanFile): license = "TCL" url = "https://github.com/conan-io/conan-center-index" settings = "os", "compiler", "build_type", "arch" + package_type = "library" options = { "shared": [True, False], "fPIC": [True, False], @@ -21,24 +40,23 @@ class TkConan(ConanFile): "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": - 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("tcl/{}".format(self.version)) + self.requires( + f"tcl/{self.version}", transitive_headers=True, transitive_libs=True + ) if self.settings.os == "Linux": self.requires("fontconfig/2.13.93") self.requires("xorg/system") @@ -48,66 +66,86 @@ def _settings_build(self): return getattr(self, "settings_build", self.settings) def build_requirements(self): - if self.settings.compiler != "Visual Studio": - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): + if not is_msvc(self): + if ( + self._settings_build.os == "Windows" + and not self.conf.get("tools.microsoft.bash:path") + and not self.conf.get("tools.microsoft.bash:subsystem") + ): self.build_requires("msys2/cci.latest") def validate(self): - if self.options["tcl"].shared != self.options.shared: - raise ConanInvalidConfiguration("The shared option of tcl and tk must have the same value") - - def source(self): - tools.get(**self.conan_data["sources"][self.version], - strip_root=True, destination=self._source_subfolder) - - def _patch_sources(self): - for build_system in ("unix", "win", ): - config_dir = self._get_configure_folder(build_system) - - if build_system != "win": - # When disabling 64-bit support (in 32-bit), this test must be 0 in order to use "long long" for 64-bit ints - # (${tcl_type_64bit} can be either "__int64" or "long long") - tools.replace_in_file(os.path.join(config_dir, "configure"), - "(sizeof(${tcl_type_64bit})==sizeof(long))", - "(sizeof(${tcl_type_64bit})!=sizeof(long))") - - makefile_in = os.path.join(config_dir, "Makefile.in") - # Avoid clearing CFLAGS and LDFLAGS in the makefile - # tools.replace_in_file(makefile_in, "\nCFLAGS{}".format(" " if (build_system == "win" and name == "tcl") else "\t"), "\n#CFLAGS\t") - tools.replace_in_file(makefile_in, "\nLDFLAGS\t", "\n#LDFLAGS\t") - tools.replace_in_file(makefile_in, "${CFLAGS}", "${CFLAGS} ${CPPFLAGS}") - - rules_ext_vc = os.path.join(self.source_folder, self._source_subfolder, "win", "rules-ext.vc") - tools.replace_in_file(rules_ext_vc, - "\n_RULESDIR = ", - "\n_RULESDIR = .\n#_RULESDIR = ") - rules_vc = os.path.join(self.source_folder, self._source_subfolder, "win", "rules.vc") - tools.replace_in_file(rules_vc, - r"$(_TCLDIR)\generic", - r"$(_TCLDIR)\include") - tools.replace_in_file(rules_vc, - "\nTCLSTUBLIB", - "\n#TCLSTUBLIB") - tools.replace_in_file(rules_vc, - "\nTCLIMPLIB", - "\n#TCLIMPLIB") + if self.dependencies["tcl"].options.shared != self.options.shared: + raise ConanInvalidConfiguration( + "The shared option of tcl and tk must have the same value" + ) + if self.settings.os == "Macos" and cross_building(self): + raise ConanInvalidConfiguration("The tk conan recipe does not currently support Macos cross-builds. A contribution to add this functionality would be welcome.") - win_makefile_in = os.path.join(self._get_configure_folder("win"), "Makefile.in") - tools.replace_in_file(win_makefile_in, "\nTCL_GENERIC_DIR", "\n#TCL_GENERIC_DIR") + def layout(self): + basic_layout(self, src_folder="src") - win_rules_vc = os.path.join(self._source_subfolder, "win", "rules.vc") - tools.replace_in_file(win_rules_vc, - "\ncwarn = $(cwarn) -WX", - "\n# cwarn = $(cwarn) -WX") - # disable whole program optimization to be portable across different MSVC versions. - # See conan-io/conan-center-index#4811 conan-io/conan-center-index#4094 - tools.replace_in_file( - win_rules_vc, - "OPTIMIZATIONS = $(OPTIMIZATIONS) -GL", - "# OPTIMIZATIONS = $(OPTIMIZATIONS) -GL") + def source(self): + get( + self, + **self.conan_data["sources"][self.version], + strip_root=True, + destination=self.source_folder, + ) + + def generate(self): + buildenv = VirtualBuildEnv(self) + buildenv.generate() + + if is_msvc(self): + tc = NMakeToolchain(self) + tc.generate() + + deps = NMakeDeps(self) + deps.generate() + else: + # Inject runenv variables into buildenv + # This is required because tcl needs to be available when configure tries to + # run a test executable + if not cross_building(self): + runenv = VirtualRunEnv(self) + runenv.generate(scope="build") + + yes_no = lambda v: "yes" if v else "no" + tc = AutotoolsToolchain(self) + tc.configure_args.append("--enable-threads") + tc.configure_args.append( + f"--enable-symbols={yes_no(self.settings.build_type == 'Debug')}" + ) + tc.configure_args.append( + f"--enable-64bit={yes_no(self.settings.arch == 'x86_64')}" + ) + tc.configure_args.append(f"--enable-aqua={yes_no(is_apple_os(self))}") + tc.configure_args.append( + f"--with-tcl={os.path.join(self.dependencies['tcl'].package_folder, 'lib')}" + ) + tc.configure_args.append(f"--with-x={yes_no(self.settings.os == 'Linux')}") + tc.make_args.append( + f"TCL_GENERIC_DIR={os.path.join(self.dependencies['tcl'].package_folder, 'include')}" + ) + if self.settings.os == "Windows": + tc.extra_defines.extend( + [ + "UNICODE", + "_UNICODE", + "_ATL_XP_TARGETING", + ] + ) + if not is_apple_os(self): + tc.extra_ldflags.append("-Wl,--as-needed") + tc.generate() + + if self.settings.os == "Linux": + deps = AutotoolsDeps(self) + deps.generate() def _get_default_build_system(self): - if tools.is_apple_os(self.settings.os): + if is_apple_os(self): return "macosx" elif self.settings.os in ("Linux", "FreeBSD"): return "unix" @@ -120,8 +158,8 @@ def _get_configure_folder(self, build_system=None): if build_system is None: build_system = self._get_default_build_system() if build_system not in ["win", "unix", "macosx"]: - raise ConanExceptionInUserConanfileMethod("Invalid build system: {}".format(build_system)) - return os.path.join(self.source_folder, self._source_subfolder, build_system) + raise ConanException(f"Invalid build system: {build_system}") + return os.path.join(self.source_folder, build_system) def _build_nmake(self, target="release"): # https://core.tcl.tk/tips/doc/trunk/tip/477.md @@ -130,7 +168,7 @@ def _build_nmake(self, target="release"): opts.append("static") if self.settings.build_type == "Debug": opts.append("symbols") - if "MD" in str(self.settings.compiler.runtime): + if "dynamic" in str(self.settings.compiler.runtime) or "MD" in str(self.settings.compiler.runtime): opts.append("msvcrt") else: opts.append("nomsvcrt") @@ -138,121 +176,128 @@ def _build_nmake(self, target="release"): opts.append("unchecked") # https://core.tcl.tk/tk/tktview?name=3d34589aa0 # https://wiki.tcl-lang.org/page/Building+with+Visual+Studio+2017 - tcl_lib_path = os.path.join(self.deps_cpp_info["tcl"].rootpath, "lib") + tcl_lib_path = os.path.join(self.dependencies["tcl"].package_folder, "lib") tclimplib, tclstublib = None, None for lib in os.listdir(tcl_lib_path): if not lib.endswith(".lib"): continue if lib.startswith("tcl{}".format("".join(self.version.split(".")[:2]))): tclimplib = os.path.join(tcl_lib_path, lib) - elif lib.startswith("tclstub{}".format("".join(self.version.split(".")[:2]))): + elif lib.startswith( + "tclstub{}".format("".join(self.version.split(".")[:2])) + ): tclstublib = os.path.join(tcl_lib_path, lib) if tclimplib is None or tclstublib is None: raise ConanException("tcl dependency misses tcl and/or tclstub library") - with tools.vcvars(self.settings): - tcldir = self.deps_cpp_info["tcl"].rootpath.replace("/", "\\\\") + + flags = { + "INSTALLDIR": self.package_folder, + "OPTS": ",".join(opts), + "TCLDIR": self.dependencies["tcl"].package_folder, + "TCL_LIBRARY": self.dependencies["tcl"].runenv_info.vars(self).get("TCL_LIBRARY"), + "TCLIMPLIB": tclimplib, + "TCLSTUBLIB": tclstublib, + } + config_dir = self._get_configure_folder("win") + with chdir(self, config_dir): self.run( - """nmake -nologo -f "{cfgdir}/makefile.vc" INSTALLDIR="{pkgdir}" OPTS={opts} TCLDIR="{tcldir}" TCL_LIBRARY="{tcl_library}" TCLIMPLIB="{tclimplib}" TCLSTUBLIB="{tclstublib}" {target}""".format( - cfgdir=self._get_configure_folder("win"), - pkgdir=self.package_folder, - opts=",".join(opts), - tcldir=tcldir, - tclstublib=tclstublib, - tclimplib=tclimplib, - tcl_library=self.deps_env_info['tcl'].TCL_LIBRARY.replace("\\", "/"), - target=target, - ), cwd=self._get_configure_folder("win"), + f"""nmake -nologo -f makefile.vc {' '.join([f'{k}="{v}"' for k, v in flags.items()])} {target}""", + env="conanbuild", ) - def _configure_autotools(self): - tcl_root = self.deps_cpp_info["tcl"].rootpath - make_args = ["TCL_GENERIC_DIR={}".format(os.path.join(tcl_root, "include")).replace("\\", "/")] - if self._autotools: - return self._autotools, make_args - - tclConfigShFolder = os.path.join(tcl_root, "lib").replace("\\", "/") - - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - yes_no = lambda v: "yes" if v else "no" - conf_args = [ - "--with-tcl={}".format(tools.unix_path(tclConfigShFolder)), - "--enable-threads", - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-symbols={}".format(yes_no(self.settings.build_type == "Debug")), - "--enable-64bit={}".format(yes_no(self.settings.arch == "x86_64")), - "--with-x={}".format(yes_no(self.settings.os == "Linux")), - "--enable-aqua={}".format(yes_no(tools.is_apple_os(self.settings.os))), - ] - - if self.settings.os == "Windows": - self._autotools.defines.extend(["UNICODE", "_UNICODE", "_ATL_XP_TARGETING", ]) - self._autotools.libs = [] - self._autotools.configure(configure_dir=self._get_configure_folder(), args=conf_args) - return self._autotools, make_args - def build(self): - self._patch_sources() - - if self.settings.compiler == "Visual Studio": + apply_conandata_patches(self) + if is_msvc(self): self._build_nmake() else: - autotools, make_args = self._configure_autotools() - autotools.make(args=make_args) + autotools = Autotools(self) + autotools.configure(build_script_folder=self._get_configure_folder()) + autotools.make() def package(self): - self.copy(pattern="license.terms", src=self._source_subfolder, dst="licenses") - if self.settings.compiler == "Visual Studio": + copy( + self, + pattern="license.terms", + src=self.source_folder, + dst=os.path.join(self.package_folder, "licenses"), + ) + if is_msvc(self): self._build_nmake("install") else: - with tools.chdir(self.build_folder): - autotools, make_args = self._configure_autotools() - autotools.install(args=make_args) - autotools.make(target="install-private-headers", args=make_args) - 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")) + with chdir(self, self.build_folder): + autotools = Autotools(self) + autotools.install() + # DESTDIR is only default initialized for target="install" + autotools.make( + target="install-private-headers", + args=[f"DESTDIR={self.package_folder}"], + ) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "man")) + rmdir(self, os.path.join(self.package_folder, "share")) - # FIXME: move to patch tkConfigShPath = os.path.join(self.package_folder, "lib", "tkConfig.sh") if os.path.exists(tkConfigShPath): - pkg_path = os.path.join(self.package_folder).replace('\\', '/') - tools.replace_in_file(tkConfigShPath, - pkg_path, - "${TK_ROOT}") - tools.replace_in_file(tkConfigShPath, - "\nTK_BUILD_", - "\n#TK_BUILD_") - tools.replace_in_file(tkConfigShPath, - "\nTK_SRC_DIR", - "\n#TK_SRC_DIR") + # This can only be modified after build since the value being replaced is a result + # of variable substitution in tkConfig.sh.in + replace_in_file(self, tkConfigShPath, "//", "${TK_ROOT}/") + + fix_apple_shared_install_name(self) def package_info(self): - if self.settings.compiler == "Visual Studio": - tk_version = tools.Version(self.version) - lib_infix = "{}{}".format(tk_version.major, tk_version.minor) + tk_version = Version(self.version) + lib_infix = f"{tk_version.major}.{tk_version.minor}" + if is_msvc(self): + lib_infix = f"{tk_version.major}{tk_version.minor}" tk_suffix = "t{}{}{}".format( "" if self.options.shared else "s", "g" if self.settings.build_type == "Debug" else "", - "x" if "MD" in str(self.settings.compiler.runtime) and not self.options.shared else "", + "x" if ("dynamic" in str(self.settings.compiler.runtime) or "MD" in str(self.settings.compiler.runtime)) and not self.options.shared else "", ) else: - tk_version = tools.Version(self.version) - lib_infix = "{}.{}".format(tk_version.major, tk_version.minor) tk_suffix = "" - self.cpp_info.libs = ["tk{}{}".format(lib_infix, tk_suffix), "tkstub{}".format(lib_infix)] + self.cpp_info.libs = [f"tk{lib_infix}{tk_suffix}", f"tkstub{lib_infix}"] if self.settings.os == "Macos": self.cpp_info.frameworks = ["CoreFoundation", "Cocoa", "Carbon", "IOKit"] elif self.settings.os == "Windows": self.cpp_info.system_libs = [ - "netapi32", "kernel32", "user32", "advapi32", "userenv","ws2_32", "gdi32", - "comdlg32", "imm32", "comctl32", "shell32", "uuid", "ole32", "oleaut32" + "netapi32", + "kernel32", + "user32", + "advapi32", + "userenv", + "ws2_32", + "gdi32", + "comdlg32", + "imm32", + "comctl32", + "shell32", + "uuid", + "ole32", + "oleaut32", + ] + elif self.settings.os == "Linux": + self.cpp_info.requires = [ + "tcl::tcl", + "fontconfig::fontconfig", + "xorg::x11", + "xorg::xcb", + "xorg::xrender", + "xorg::xau", + "xorg::xdmcp", ] - tk_library = os.path.join(self.package_folder, "lib", "{}{}".format(self.name, ".".join(self.version.split(".")[:2]))).replace("\\", "/") - self.output.info("Setting TK_LIBRARY environment variable: {}".format(tk_library)) + tk_library = os.path.join( + self.package_folder, + "lib", + f"{self.name}{tk_version.major}.{tk_version.minor}", + ).replace("\\", "/") + self.output.info(f"Setting TK_LIBRARY environment variable: {tk_library}") self.env_info.TK_LIBRARY = tk_library + self.runenv_info.define("TK_LIBRARY", tk_library) - tcl_root = self.package_folder.replace("\\", "/") - self.output.info("Setting TCL_ROOT environment variable: {}".format(tcl_root)) - self.env_info.TCL_ROOT = tcl_root + tk_root = self.package_folder.replace("\\", "/") + self.output.info(f"Setting TK_ROOT environment variable: {tk_root}") + self.env_info.TK_ROOT = tk_root + self.runenv_info.define("TK_ROOT", tk_root) diff --git a/recipes/tk/all/patches/0001-Add-unix-conan-compatibility.patch b/recipes/tk/all/patches/0001-Add-unix-conan-compatibility.patch new file mode 100644 index 0000000000000..6fa4dea2761c6 --- /dev/null +++ b/recipes/tk/all/patches/0001-Add-unix-conan-compatibility.patch @@ -0,0 +1,80 @@ +Subject: [PATCH] Add unix conan compatibility + +--- + unix/Makefile.in | 11 +++++------ + unix/configure | 2 +- + 2 files changed, 6 insertions(+), 7 deletions(-) + +diff --git a/unix/Makefile.in b/unix/Makefile.in +index c6f8c25d7..7bc4a22ba 100644 +--- a/unix/Makefile.in ++++ b/unix/Makefile.in +@@ -143,7 +143,6 @@ CFLAGS = @CFLAGS_DEFAULT@ @CFLAGS@ + # Flags to pass to the linker + LDFLAGS_DEBUG = @LDFLAGS_DEBUG@ + LDFLAGS_OPTIMIZE = @LDFLAGS_OPTIMIZE@ +-LDFLAGS = @LDFLAGS_DEFAULT@ @LDFLAGS@ + + # A "-I" switch that can be used when compiling to make all of the + # X11 include files accessible (the configure script will try to +@@ -328,7 +327,7 @@ MAN_FLAGS = @MAN_FLAGS@ + + CC = @CC@ + +-CC_SWITCHES_NO_STUBS = ${CFLAGS} ${CFLAGS_WARNING} ${SHLIB_CFLAGS} \ ++CC_SWITCHES_NO_STUBS = ${CFLAGS} ${CPPFLAGS} ${CFLAGS_WARNING} ${SHLIB_CFLAGS} \ + -I${UNIX_DIR} -I${GENERIC_DIR} -I${BMAP_DIR} -I${TCL_GENERIC_DIR} \ + -I${TCL_PLATFORM_DIR} ${@TK_WINDOWINGSYSTEM@_INCLUDES} ${AC_FLAGS} \ + ${PROTO_FLAGS} ${SECURITY_FLAGS} ${MEM_DEBUG_FLAGS} ${KEYSYM_FLAGS} \ +@@ -338,7 +337,7 @@ CC_SWITCHES = $(CC_SWITCHES_NO_STUBS) @TCL_STUB_FLAGS@ + + APP_CC_SWITCHES = $(CC_SWITCHES_NO_STUBS) @EXTRA_APP_CC_SWITCHES@ + +-DEPEND_SWITCHES = ${CFLAGS} -I${UNIX_DIR} -I${GENERIC_DIR} -I${BMAP_DIR} \ ++DEPEND_SWITCHES = ${CFLAGS} ${CPPFLAGS} -I${UNIX_DIR} -I${GENERIC_DIR} -I${BMAP_DIR} \ + -I${TCL_GENERIC_DIR} -I${TCL_PLATFORM_DIR} ${@TK_WINDOWINGSYSTEM@_INCLUDES} \ + ${AC_FLAGS} ${PROTO_FLAGS} ${SECURITY_FLAGS} ${MEM_DEBUG_FLAGS} \ + ${KEYSYM_FLAGS} @EXTRA_CC_SWITCHES@ +@@ -620,7 +619,7 @@ objs: ${OBJS} + + + ${WISH_EXE}: $(TK_STUB_LIB_FILE) $(WISH_OBJS) $(TK_LIB_FILE) @APP_RSRC_FILE@ +- ${CC} ${CFLAGS} ${LDFLAGS} $(WISH_OBJS) @TK_BUILD_LIB_SPEC@ \ ++ ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} $(WISH_OBJS) @TK_BUILD_LIB_SPEC@ \ + $(WISH_LIBS) $(CC_SEARCH_FLAGS) -o ${WISH_EXE} + + # Resetting the LIB_RUNTIME_DIR below is required so that +@@ -633,7 +632,7 @@ $(TKTEST_EXE): $(TKTEST_OBJS) $(TK_LIB_FILE) + $(MAKE) tktest-real LIB_RUNTIME_DIR="`pwd`:$(TCL_BIN_DIR)" + + tktest-real: ${TK_STUB_LIB_FILE} +- ${CC} ${CFLAGS} ${LDFLAGS} $(TKTEST_OBJS) ${TK_STUB_LIB_FILE} ${TCL_STUB_LIB_SPEC} @TK_BUILD_LIB_SPEC@ \ ++ ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} $(TKTEST_OBJS) ${TK_STUB_LIB_FILE} ${TCL_STUB_LIB_SPEC} @TK_BUILD_LIB_SPEC@ \ + $(WISH_LIBS) $(CC_SEARCH_FLAGS) -o $(TKTEST_EXE) + + # # FIXME: This xttest rule seems to be broken in a number of ways. It should +@@ -641,7 +640,7 @@ tktest-real: ${TK_STUB_LIB_FILE} + # # tktest, and it is not clear where this test.o object file comes from. + # + # xttest: test.o tkTest.o tkSquare.o $(TK_LIB_FILE) ${TK_STUB_LIB_FILE} +-# ${CC} ${CFLAGS} ${LDFLAGS} test.o tkTest.o tkSquare.o \ ++# ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} test.o tkTest.o tkSquare.o \ + # @TK_BUILD_LIB_SPEC@ ${TK_STUB_LIB_FILE} ${TCL_STUB_LIB_SPEC} \ + # $(WISH_LIBS) $(LD_SEARCH_FLAGS) -lXt -o xttest + +diff --git a/unix/configure b/unix/configure +index fb0f5a3d9..77256a740 100755 +--- a/unix/configure ++++ b/unix/configure +@@ -7279,7 +7279,7 @@ int + main () + { + switch (0) { +- case 1: case (sizeof(${tcl_type_64bit})==sizeof(long)): ; ++ case 1: case (sizeof(${tcl_type_64bit})!=sizeof(long)): ; + } + ; + return 0; +-- +2.40.0 + diff --git a/recipes/tk/all/patches/0002-Add-windows-conan-compatibility.patch b/recipes/tk/all/patches/0002-Add-windows-conan-compatibility.patch new file mode 100644 index 0000000000000..bd293b31a745e --- /dev/null +++ b/recipes/tk/all/patches/0002-Add-windows-conan-compatibility.patch @@ -0,0 +1,145 @@ +Subject: [PATCH] Add windows conan compatibility + +* Disable whole program optimization to be portable across different MSVC + versions. See conan-io/conan-center-index#4811 and + conan-io/conan-center-index#4094. +--- + win/rules-ext.vc | 8 ++++---- + win/rules.vc | 23 +++++++---------------- + 2 files changed, 11 insertions(+), 20 deletions(-) + +diff --git a/win/rules-ext.vc b/win/rules-ext.vc +index 58c70fa26..e7f953b4c 100644 +--- a/win/rules-ext.vc ++++ b/win/rules-ext.vc +@@ -37,7 +37,7 @@ macro to the name of the project makefile. + # First locate the Tcl directory that we are working with. + !ifdef TCLDIR + +-_RULESDIR = $(TCLDIR:/=\) ++_RULESDIR = . + + !else + +@@ -49,7 +49,7 @@ _RULESDIR=$(INSTALLDIR:/=\) + # Locate Tcl sources + !if [echo _RULESDIR = \> nmakehlp.out] \ + || [nmakehlp -L generic\tcl.h >> nmakehlp.out] +-_RULESDIR = ..\..\tcl ++_RULESDIR = . + !else + !include nmakehlp.out + !endif +@@ -61,9 +61,9 @@ _RULESDIR = ..\..\tcl + # Now look for the targets.vc file under the Tcl root. Note we check this + # file and not rules.vc because the latter also exists on older systems. + !if exist("$(_RULESDIR)\lib\nmake\targets.vc") # Building against installed Tcl +-_RULESDIR = $(_RULESDIR)\lib\nmake ++_RULESDIR = . + !elseif exist("$(_RULESDIR)\win\targets.vc") # Building against Tcl sources +-_RULESDIR = $(_RULESDIR)\win ++_RULESDIR = . + !else + # If we have not located Tcl's targets file, most likely we are compiling + # against an older version of Tcl and so must use our own support files. +diff --git a/win/rules.vc b/win/rules.vc +index cf80c9122..fe4a95dc9 100644 +--- a/win/rules.vc ++++ b/win/rules.vc +@@ -262,7 +262,7 @@ TCLINSTALL = 0 # Tk always builds against Tcl source, not an installed Tcl + !endif # TCLDIR == "" + + _TCLDIR = $(TCLDIR:/=\) +-_TCL_H = $(_TCLDIR)\generic\tcl.h ++_TCL_H = $(_TCLDIR)\include\tcl.h + !if !exist("$(_TCL_H)") + !error Could not locate tcl.h. Please set the TCLDIR macro to point to the Tcl *source* directory. + !endif +@@ -283,9 +283,9 @@ _TCLDIR = $(TCLDIR:/=\) + !if exist("$(_TCLDIR)\include\tcl.h") # Case 2(c) with TCLDIR defined + TCLINSTALL = 1 + _TCL_H = $(_TCLDIR)\include\tcl.h +-!elseif exist("$(_TCLDIR)\generic\tcl.h") # Case 2(d) with TCLDIR defined ++!elseif exist("$(_TCLDIR)\include\tcl.h") # Case 2(d) with TCLDIR defined + TCLINSTALL = 0 +-_TCL_H = $(_TCLDIR)\generic\tcl.h ++_TCL_H = $(_TCLDIR)\include\tcl.h + !endif + + !else # # Case 2(c) for extensions with TCLDIR undefined +@@ -311,7 +311,7 @@ _TCL_H = $(_TCLDIR)\include\tcl.h + !include nmakehlp.out + TCLINSTALL = 0 + TCLDIR = $(_TCLDIR) +-_TCL_H = $(_TCLDIR)\generic\tcl.h ++_TCL_H = $(_TCLDIR)\include\tcl.h + + !endif # exist(...) && ! $(NEED_TCL_SOURCE) + +@@ -619,7 +619,7 @@ OPTIMIZATIONS = $(OPTIMIZATIONS) -GS + # generated libraries only usable by the specific VC++ version that + # created it. Requires /LTCG linker option + !if [nmakehlp -c -GL] +-OPTIMIZATIONS = $(OPTIMIZATIONS) -GL ++ + CC_GL_OPT_ENABLED = 1 + !else + # In newer compilers -GL and -YX are incompatible. +@@ -1085,12 +1085,9 @@ STUBPREFIX = $(PROJECT)stub + + TCLSHNAME = $(PROJECT)sh$(VERSION)$(SUFX).exe + TCLSH = $(OUT_DIR)\$(TCLSHNAME) +-TCLIMPLIB = $(OUT_DIR)\$(PROJECT)$(VERSION)$(SUFX).lib + TCLLIBNAME = $(PROJECT)$(VERSION)$(SUFX).$(EXT) + TCLLIB = $(OUT_DIR)\$(TCLLIBNAME) + +-TCLSTUBLIBNAME = $(STUBPREFIX)$(VERSION).lib +-TCLSTUBLIB = $(OUT_DIR)\$(TCLSTUBLIBNAME) + TCL_INCLUDES = -I"$(WIN_DIR)" -I"$(GENERICDIR)" + + !else # ! $(DOING_TCL) +@@ -1105,12 +1102,9 @@ TCLSH = $(_TCLDIR)\bin\tclsh$(TCL_VERSION)$(SUFX:t=).exe + TCLSH = $(_TCLDIR)\bin\tclsh$(TCL_VERSION)t$(SUFX:t=).exe + !endif + +-TCLSTUBLIB = $(_TCLDIR)\lib\tclstub$(TCL_VERSION).lib +-TCLIMPLIB = $(_TCLDIR)\lib\tcl$(TCL_VERSION)$(SUFX:t=).lib + # When building extensions, may be linking against Tcl that does not add + # "t" suffix (e.g. 8.5 or 8.7). If lib not found check for that possibility. + !if !exist("$(TCLIMPLIB)") +-TCLIMPLIB = $(_TCLDIR)\lib\tcl$(TCL_VERSION)t$(SUFX:t=).lib + !endif + TCL_LIBRARY = $(_TCLDIR)\lib + TCLREGLIB = $(_TCLDIR)\lib\tclreg13$(SUFX:t=).lib +@@ -1124,18 +1118,15 @@ TCLSH = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)$(SUFX:t=).exe + !if !exist($(TCLSH)) + TCLSH = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)t$(SUFX:t=).exe + !endif +-TCLSTUBLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclstub$(TCL_VERSION).lib +-TCLIMPLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tcl$(TCL_VERSION)$(SUFX:t=).lib + # When building extensions, may be linking against Tcl that does not add + # "t" suffix (e.g. 8.5 or 8.7). If lib not found check for that possibility. + !if !exist("$(TCLIMPLIB)") +-TCLIMPLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tcl$(TCL_VERSION)t$(SUFX:t=).lib + !endif + TCL_LIBRARY = $(_TCLDIR)\library + TCLREGLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclreg13$(SUFX:t=).lib + TCLDDELIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tcldde14$(SUFX:t=).lib + TCLTOOLSDIR = $(_TCLDIR)\tools +-TCL_INCLUDES = -I"$(_TCLDIR)\generic" -I"$(_TCLDIR)\win" ++TCL_INCLUDES = -I"$(_TCLDIR)\include" -I"$(_TCLDIR)\win" + + !endif # TCLINSTALL + +@@ -1393,7 +1384,7 @@ carch = + + !if $(DEBUG) + # Turn warnings into errors +-cwarn = $(cwarn) -WX ++ + !endif + + INCLUDES = $(TCL_INCLUDES) $(TK_INCLUDES) $(PRJ_INCLUDES) +-- +2.40.0 + diff --git a/recipes/tk/all/patches/0003-Patch-tkConfig.sh.patch b/recipes/tk/all/patches/0003-Patch-tkConfig.sh.patch new file mode 100644 index 0000000000000..ecabe8916794b --- /dev/null +++ b/recipes/tk/all/patches/0003-Patch-tkConfig.sh.patch @@ -0,0 +1,89 @@ +Subject: [PATCH] Patch tkConfig.sh to remove TK_BUILD_ directories and + TK_SRC_DIR + +--- + unix/tkConfig.sh.in | 8 ++++---- + win/tkConfig.sh.in | 8 ++++---- + 2 files changed, 8 insertions(+), 8 deletions(-) + +diff --git a/unix/tkConfig.sh.in b/unix/tkConfig.sh.in +index bb85ad0a2..e564ec1f9 100644 +--- a/unix/tkConfig.sh.in ++++ b/unix/tkConfig.sh.in +@@ -53,7 +53,7 @@ TK_LIB_FLAG='@TK_LIB_FLAG@' + + # String to pass to linker to pick up the Tk library from its + # build directory. +-TK_BUILD_LIB_SPEC='@TK_BUILD_LIB_SPEC@' ++#TK_BUILD_LIB_SPEC='@TK_BUILD_LIB_SPEC@' + + # String to pass to linker to pick up the Tk library from its + # installed directory. +@@ -69,7 +69,7 @@ TK_INCLUDE_SPEC='@TK_INCLUDE_SPEC@' + # different place than the directory containing the source files, this + # points to the location of the sources, not the location where Tk was + # compiled. +-TK_SRC_DIR='@TK_SRC_DIR@' ++#TK_SRC_DIR='@TK_SRC_DIR@' + + # Needed if you want to make a 'fat' shared library library + # containing tk objects or link a different wish. +@@ -84,14 +84,14 @@ TK_STUB_LIB_FLAG='@TK_STUB_LIB_FLAG@' + + # String to pass to linker to pick up the Tk stub library from its + # build directory. +-TK_BUILD_STUB_LIB_SPEC='@TK_BUILD_STUB_LIB_SPEC@' ++#TK_BUILD_STUB_LIB_SPEC='@TK_BUILD_STUB_LIB_SPEC@' + + # String to pass to linker to pick up the Tk stub library from its + # installed directory. + TK_STUB_LIB_SPEC='@TK_STUB_LIB_SPEC@' + + # Path to the Tk stub library in the build directory. +-TK_BUILD_STUB_LIB_PATH='@TK_BUILD_STUB_LIB_PATH@' ++#TK_BUILD_STUB_LIB_PATH='@TK_BUILD_STUB_LIB_PATH@' + + # Path to the Tk stub library in the install directory. + TK_STUB_LIB_PATH='@TK_STUB_LIB_PATH@' +diff --git a/win/tkConfig.sh.in b/win/tkConfig.sh.in +index c511312f0..d5330b829 100644 +--- a/win/tkConfig.sh.in ++++ b/win/tkConfig.sh.in +@@ -47,7 +47,7 @@ TK_LIB_FLAG='@TK_LIB_FLAG@' + + # String to pass to linker to pick up the Tk library from its + # build directory. +-TK_BUILD_LIB_SPEC='@TK_BUILD_LIB_SPEC@' ++#TK_BUILD_LIB_SPEC='@TK_BUILD_LIB_SPEC@' + + # String to pass to linker to pick up the Tk library from its + # installed directory. +@@ -59,7 +59,7 @@ TK_LIB_SPEC='@TK_LIB_SPEC@' + # different place than the directory containing the source files, this + # points to the location of the sources, not the location where Tk was + # compiled. +-TK_SRC_DIR='@TK_SRC_DIR@' ++#TK_SRC_DIR='@TK_SRC_DIR@' + + # Needed if you want to make a 'fat' shared library library + # containing tk objects or link a different wish. +@@ -74,14 +74,14 @@ TK_STUB_LIB_FLAG='@TK_STUB_LIB_FLAG@' + + # String to pass to linker to pick up the Tk stub library from its + # build directory. +-TK_BUILD_STUB_LIB_SPEC='@TK_BUILD_STUB_LIB_SPEC@' ++#TK_BUILD_STUB_LIB_SPEC='@TK_BUILD_STUB_LIB_SPEC@' + + # String to pass to linker to pick up the Tk stub library from its + # installed directory. + TK_STUB_LIB_SPEC='@TK_STUB_LIB_SPEC@' + + # Path to the Tk stub library in the build directory. +-TK_BUILD_STUB_LIB_PATH='@TK_BUILD_STUB_LIB_PATH@' ++#TK_BUILD_STUB_LIB_PATH='@TK_BUILD_STUB_LIB_PATH@' + + # Path to the Tk stub library in the install directory. + TK_STUB_LIB_PATH='@TK_STUB_LIB_PATH@' +-- +2.40.0 + diff --git a/recipes/tk/all/patches/0004-Fix-msvc-shared-build.patch b/recipes/tk/all/patches/0004-Fix-msvc-shared-build.patch new file mode 100644 index 0000000000000..1665cb737d8b1 --- /dev/null +++ b/recipes/tk/all/patches/0004-Fix-msvc-shared-build.patch @@ -0,0 +1,13 @@ +diff --git a/win/makefile.vc b/win/makefile.vc +index 6371f0f4b..b548f827d 100644 +--- a/win/makefile.vc ++++ b/win/makefile.vc +@@ -651,7 +651,7 @@ install-binaries: + @$(CPY) "$(TKSTUBLIB)" "$(LIB_INSTALL_DIR)\" + !if !$(STATIC_BUILD) + @echo creating package index +- @type << > $(OUT_DIR)\pkgIndex.tcl ++ @type <<$(OUT_DIR)\pkgIndex.tcl + if {[catch {package present Tcl 8.6.0}]} { return } + if {($$::tcl_platform(platform) eq "unix") && ([info exists ::env(DISPLAY)] + || ([info exists ::argv] && ("-display" in $$::argv)))} { diff --git a/recipes/tk/all/test_package/CMakeLists.txt b/recipes/tk/all/test_package/CMakeLists.txt index 7672a2d37cdd9..5cec06aa08035 100644 --- a/recipes/tk/all/test_package/CMakeLists.txt +++ b/recipes/tk/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(PackageTest C) -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup() +find_package(tk CONFIG REQUIRED) -add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +add_executable(example src/test_package.c) +target_link_libraries(example tk::tk) diff --git a/recipes/tk/all/test_package/conanfile.py b/recipes/tk/all/test_package/conanfile.py index a7a94271504b6..91a8fc7a09b42 100644 --- a/recipes/tk/all/test_package/conanfile.py +++ b/recipes/tk/all/test_package/conanfile.py @@ -1,17 +1,26 @@ -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 TclTestConan(ConanFile): + +class fooTestConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + generators = "CMakeDeps", "CMakeToolchain" + + 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.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + cmd = os.path.join(self.cpp.build.bindir, "example") + self.run(cmd, env="conanrun") diff --git a/recipes/tk/all/test_package/src/test_package.c b/recipes/tk/all/test_package/src/test_package.c new file mode 100644 index 0000000000000..9a62551dccab6 --- /dev/null +++ b/recipes/tk/all/test_package/src/test_package.c @@ -0,0 +1,24 @@ +#include +#include + +#include +#include + +int main (int argc ,char *argv[]) { + Tcl_FindExecutable(argv[0]); + Tcl_Interp *interp = Tcl_CreateInterp(); + if (Tcl_Init(interp) != TCL_OK) { + fprintf(stderr ,"Tcl_Init error: %s\n" ,Tcl_GetStringResult(interp)); + return EXIT_FAILURE; + } + + if (Tk_Init(interp) != TCL_OK) { + fprintf(stderr, "Tk_Init failed: %s\n", Tcl_GetStringResult(interp)); + fprintf(stderr, "But ignore it: there may not be a X server running.\n"); + return EXIT_SUCCESS; + } + + Tcl_Finalize(); + fprintf(stderr, "Test package success.\n"); + return EXIT_SUCCESS; +} diff --git a/recipes/tk/all/test_package/test_package.c b/recipes/tk/all/test_package/test_package.c deleted file mode 100644 index 601b2c8c2b4fc..0000000000000 --- a/recipes/tk/all/test_package/test_package.c +++ /dev/null @@ -1,23 +0,0 @@ -#include -#include - -#include -#include - -int main (int argc ,char *argv[]) { - Tcl_FindExecutable(argv[0]); - Tcl_Interp *interp = Tcl_CreateInterp(); - if (Tcl_Init(interp) != TCL_OK) { - fprintf(stderr ,"Tcl_Init error: %s\n" ,Tcl_GetStringResult(interp)); - return EXIT_FAILURE; - } - - if (Tk_Init(interp) != TCL_OK) { - fprintf(stderr, "Tk_Init failed: %s\n", Tcl_GetStringResult(interp)); - fprintf(stderr, "But ignore it: there may not be a X server running.\n"); - return EXIT_SUCCESS; - } - - Tcl_Finalize(); - return EXIT_SUCCESS; -} diff --git a/recipes/tk/all/test_v1_package/CMakeLists.txt b/recipes/tk/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0fe0f8ae90d2e --- /dev/null +++ b/recipes/tk/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +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}) diff --git a/recipes/tk/all/test_v1_package/conanfile.py b/recipes/tk/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..a7a94271504b6 --- /dev/null +++ b/recipes/tk/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TclTestConan(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/tl-expected/all/conandata.yml b/recipes/tl-expected/all/conandata.yml index 6ae0878704717..1dbeea5c36d21 100644 --- a/recipes/tl-expected/all/conandata.yml +++ b/recipes/tl-expected/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.1.0": + url: "https://github.com/TartanLlama/expected/archive/refs/tags/v1.1.0.tar.gz" + sha256: "1db357f46dd2b24447156aaf970c4c40a793ef12a8a9c2ad9e096d9801368df6" "20190710": url: "https://github.com/TartanLlama/expected/archive/6fe2af5191214cce620899f7f06585c047b9f1fc.zip" sha256: "25b009593fcb27aafd3e836e0e726da351b4be7a20703b9bb709a5efd61c26d0" diff --git a/recipes/tl-expected/all/conanfile.py b/recipes/tl-expected/all/conanfile.py index 9e0aa613d3d14..fcea2d681a64a 100644 --- a/recipes/tl-expected/all/conanfile.py +++ b/recipes/tl-expected/all/conanfile.py @@ -14,6 +14,7 @@ class TlExpectedConan(ConanFile): description = "C++11/14/17 std::expected with functional-style extensions" topics = ("cpp11", "cpp14", "cpp17", "expected") license = "CC0-1.0" + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True diff --git a/recipes/tl-expected/config.yml b/recipes/tl-expected/config.yml index 73c5695847183..513187394acf8 100644 --- a/recipes/tl-expected/config.yml +++ b/recipes/tl-expected/config.yml @@ -1,4 +1,6 @@ versions: + "1.1.0": + folder: all "20190710": folder: all "1.0.0": diff --git a/recipes/tl-function-ref/all/conanfile.py b/recipes/tl-function-ref/all/conanfile.py index 06ae98ab9af68..8868ec6b1b3e9 100644 --- a/recipes/tl-function-ref/all/conanfile.py +++ b/recipes/tl-function-ref/all/conanfile.py @@ -35,8 +35,10 @@ def build(self): pass def package(self): - copy(self, "COPYING", 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")) + copy(self, "COPYING", 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", "tl-function-ref") @@ -46,14 +48,16 @@ def package_info(self): self.cpp_info.libdirs = [] self.cpp_info.resdirs = [] - # TODO: to remove in conan v2 once cmake_find_package* generators removed + # TODO: to remove in conan v2 once cmake_find_package* generators + # removed. self.cpp_info.filenames["cmake_find_package"] = "tl-function-ref" self.cpp_info.filenames["cmake_find_package_multi"] = "tl-function-ref" self.cpp_info.names["cmake_find_package"] = "tl" self.cpp_info.names["cmake_find_package_multi"] = "tl" self.cpp_info.components["function-ref"].names["cmake_find_package"] = "function-ref" self.cpp_info.components["function-ref"].names["cmake_find_package_multi"] = "function-ref" - self.cpp_info.components["function-ref"].set_property("cmake_target_name", "tl::function-ref") + self.cpp_info.components["function-ref"].set_property( + "cmake_target_name", "tl::function-ref") self.cpp_info.components["function-ref"].bindirs = [] self.cpp_info.components["function-ref"].frameworkdirs = [] self.cpp_info.components["function-ref"].libdirs = [] diff --git a/recipes/tl-optional/all/conandata.yml b/recipes/tl-optional/all/conandata.yml index eb9035a81e907..bf26f6c9e3c77 100644 --- a/recipes/tl-optional/all/conandata.yml +++ b/recipes/tl-optional/all/conandata.yml @@ -2,3 +2,6 @@ sources: "1.0.0": url: https://github.com/TartanLlama/optional/archive/v1.0.0.zip sha256: 8bb68defc61da3de2b4cd73ef9792eba44570ec5cb52c4da731286f24aecbb95 + "1.1.0": + url: https://github.com/TartanLlama/optional/archive/v1.1.0.zip + sha256: a336bb10f51945369c1dd6dc6d2a7086602ab9cab52c98a7a6224bfd782bc0c7 diff --git a/recipes/tl-optional/config.yml b/recipes/tl-optional/config.yml index 40341aa3db6cd..b0abed6f3ca04 100644 --- a/recipes/tl-optional/config.yml +++ b/recipes/tl-optional/config.yml @@ -1,3 +1,5 @@ versions: "1.0.0": folder: all + "1.1.0": + folder: all diff --git a/recipes/tl-ranges/all/conandata.yml b/recipes/tl-ranges/all/conandata.yml new file mode 100644 index 0000000000000..52e4715a40621 --- /dev/null +++ b/recipes/tl-ranges/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "cci.20221207": + url: "https://github.com/TartanLlama/ranges/archive/361dae81e48ea9d0099e8783b56b903c2a6cd01c.tar.gz" + sha256: "9174e368d1f6e89d2ab5b059454dc402e68afdfe6d9bf5376d6634dab7aa2a36" diff --git a/recipes/tl-ranges/all/conanfile.py b/recipes/tl-ranges/all/conanfile.py new file mode 100644 index 0000000000000..a6ce8136be512 --- /dev/null +++ b/recipes/tl-ranges/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.files import copy, get +from conan.tools.layout import basic_layout +from conan.tools.scm import Version +import os + +required_conan_version = ">=1.52.0" + +class TLRangesConan(ConanFile): + name = "tl-ranges" + description = "Ranges that didn't make C++20" + license = "CC0-1.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/TartanLlama/ranges" + topics = ("ranges", "views", "header-only") + package_type = "header-library" + 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": "15", + "apple-clang": "14", + "Visual Studio": "16", + "msvc": "192", + } + + 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, "COPYING", 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_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/tl-ranges/all/test_package/CMakeLists.txt b/recipes/tl-ranges/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..03b4aa241a9d0 --- /dev/null +++ b/recipes/tl-ranges/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(tl-ranges REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE tl-ranges::tl-ranges) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) diff --git a/recipes/tl-ranges/all/test_package/conanfile.py b/recipes/tl-ranges/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/tl-ranges/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/tl-ranges/all/test_package/test_package.cpp b/recipes/tl-ranges/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..76c10d34a8bc4 --- /dev/null +++ b/recipes/tl-ranges/all/test_package/test_package.cpp @@ -0,0 +1,12 @@ +#include +#include + +#include "tl/enumerate.hpp" + +int main() { + std::vector data = {1, 2, 3, 4, 5}; + + for (auto&& [index, element] : data | tl::views::enumerate) { + std::cout << index << " " << element << '\n'; + } +} diff --git a/recipes/tl-ranges/config.yml b/recipes/tl-ranges/config.yml new file mode 100644 index 0000000000000..676cc76a125dc --- /dev/null +++ b/recipes/tl-ranges/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20221207": + folder: all diff --git a/recipes/tllist/all/conandata.yml b/recipes/tllist/all/conandata.yml index 57b91d7bbc8b2..b5b25e638eacf 100644 --- a/recipes/tllist/all/conandata.yml +++ b/recipes/tllist/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.1.0": + url: "https://codeberg.org/dnkl/tllist/archive/1.1.0.tar.gz" + sha256: "3f3fe2f7433719cec816c63937a7aa36e566bd317763ef46d11562073ab6361d" "1.0.5": url: "https://codeberg.org/dnkl/tllist/archive/1.0.5.tar.gz" - sha256: b0f32c9b2c2015c8d8dd068fd4e8b586aa91ca1670badc274ec962559ee0aadd + sha256: "b0f32c9b2c2015c8d8dd068fd4e8b586aa91ca1670badc274ec962559ee0aadd" diff --git a/recipes/tllist/all/conanfile.py b/recipes/tllist/all/conanfile.py index 3aefd5f1a8e81..35ff91663df3f 100644 --- a/recipes/tllist/all/conanfile.py +++ b/recipes/tllist/all/conanfile.py @@ -1,40 +1,70 @@ -from conan import ConanFile -from conans import 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.files import copy, get +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class TllistConan(ConanFile): name = "tllist" + description = "A C header file only implementation of a typed linked list." license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://codeberg.org/dnkl/tllist" - description = "A C header file only implementation of a typed linked list." - topics = ("list", "utils", "typed-linked-list") - settings = "os", "arch", "build_type", "compiler" + topics = ("list", "utils", "typed-linked-list", "header-only") + + package_type = "header-library" + 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): + return { + "Visual Studio": "15", + "gcc": "7", + "clang": "5.0", + "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"): + 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." + ) + # tllist relies on __typeof__, not implemented in Visual Studio - if self.settings.compiler == "Visual Studio": + if is_msvc(self): raise ConanInvalidConfiguration("Visual Studio compiler is 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], strip_root=True) def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - self.copy("*.h", src=self._source_subfolder, dst="include") - - def package_id(self): - self.info.header_only() + 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 = [] + self.cpp_info.set_property("pkg_config_name", "tllist") diff --git a/recipes/tllist/all/test_package/CMakeLists.txt b/recipes/tllist/all/test_package/CMakeLists.txt index 929cb14b5f70b..33ff310d27421 100644 --- a/recipes/tllist/all/test_package/CMakeLists.txt +++ b/recipes/tllist/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ -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(tllist CONFIG REQUIRED) +find_package(tllist REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) target_link_libraries(${PROJECT_NAME} tllist::tllist) diff --git a/recipes/tllist/all/test_package/conanfile.py b/recipes/tllist/all/test_package/conanfile.py index 49a3a66ea5bad..fae501d0afb9e 100644 --- a/recipes/tllist/all/test_package/conanfile.py +++ b/recipes/tllist/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" + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/tllist/all/test_v1_package/CMakeLists.txt b/recipes/tllist/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/tllist/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/tllist/all/test_v1_package/conanfile.py b/recipes/tllist/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..49a3a66ea5bad --- /dev/null +++ b/recipes/tllist/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/tllist/all/test_v1_package/test_package.c b/recipes/tllist/all/test_v1_package/test_package.c new file mode 100644 index 0000000000000..77b3400127915 --- /dev/null +++ b/recipes/tllist/all/test_v1_package/test_package.c @@ -0,0 +1,10 @@ +#include +#include + +int main(int argc, const char *const *argv) { + tll(int) l = tll_init(); + + tll_push_back(l, 43); + + return EXIT_SUCCESS; +} diff --git a/recipes/tllist/config.yml b/recipes/tllist/config.yml index 9d896aecb9356..2c85a5a09f1df 100644 --- a/recipes/tllist/config.yml +++ b/recipes/tllist/config.yml @@ -1,3 +1,5 @@ versions: + "1.1.0": + folder: "all" "1.0.5": folder: "all" diff --git a/recipes/tlx/all/conandata.yml b/recipes/tlx/all/conandata.yml index 5d98c93707e87..4dc1e534af439 100644 --- a/recipes/tlx/all/conandata.yml +++ b/recipes/tlx/all/conandata.yml @@ -1,8 +1,14 @@ sources: + "0.6.1": + url: "https://github.com/tlx/tlx/archive/refs/tags/v0.6.1.tar.gz" + sha256: "24dd1acf36dd43b8e0414420e3f9adc2e6bb0e75047e872a06167961aedad769" "0.5.20200222": url: "https://github.com/tlx/tlx/archive/refs/tags/v0.5.20200222.tar.gz" sha256: "99e63691af3ada066682243f3a65cd6eb32700071cdd6cfedb18777b5ff5ff4d" patches: + "0.6.1": + - patch_file: "patches/0001-fix-dll-install.patch" + - patch_file: "patches/0002-fix-shared-apple.patch" "0.5.20200222": - patch_file: "patches/0001-fix-dll-install.patch" - patch_file: "patches/0002-fix-shared-apple.patch" diff --git a/recipes/tlx/all/conanfile.py b/recipes/tlx/all/conanfile.py index c87b26dca7424..419a2fc27c4ef 100644 --- a/recipes/tlx/all/conanfile.py +++ b/recipes/tlx/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, collect_libs, copy, get, replace_in_file, rmdir, save +from conan.tools.files import apply_conandata_patches, collect_libs, copy, export_conandata_patches, get, replace_in_file, rmdir, save import os import textwrap -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class TlxConan(ConanFile): @@ -13,10 +13,11 @@ class TlxConan(ConanFile): description = "tlx is a collection of C++ helpers and extensions " \ "universally needed, but not found in the STL." license = "BSL-1.0" - topics = ("tlx", "data-structure", "algorithm") + topics = ("data-structure", "algorithm") homepage = "https://github.com/tlx/tlx" 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 TlxConan(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) @@ -111,7 +110,7 @@ def package_info(self): self.cpp_info.set_property("pkg_config_name", "tlx") self.cpp_info.libs = collect_libs(self) if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.system_libs.append("pthread") + self.cpp_info.system_libs.extend(["m", "pthread"]) # 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/tlx/all/test_package/conanfile.py b/recipes/tlx/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/tlx/all/test_package/conanfile.py +++ b/recipes/tlx/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/tlx/all/test_v1_package/CMakeLists.txt b/recipes/tlx/all/test_v1_package/CMakeLists.txt index b9c999f87aab7..0d20897301b68 100644 --- a/recipes/tlx/all/test_v1_package/CMakeLists.txt +++ b/recipes/tlx/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(tlx REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE tlx) -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/tlx/config.yml b/recipes/tlx/config.yml index 08dbe5e6d3977..1a2097579ad40 100644 --- a/recipes/tlx/config.yml +++ b/recipes/tlx/config.yml @@ -1,3 +1,5 @@ versions: + "0.6.1": + folder: all "0.5.20200222": folder: all diff --git a/recipes/tmx/all/conandata.yml b/recipes/tmx/all/conandata.yml index 015638445fd3e..8a82786790fb4 100644 --- a/recipes/tmx/all/conandata.yml +++ b/recipes/tmx/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "1.10.0": + url: "https://github.com/baylej/tmx/archive/refs/tags/tmx_1.10.0.tar.gz" + sha256: "8ee42d1728c567d6047a58b2624c39c8844aaf675c470f9f284c4ed17e94188f" "1.4.0": url: "https://github.com/baylej/tmx/archive/refs/tags/tmx_1.4.0.tar.gz" sha256: "5ab52e72976141260edd1b15ea34e1626c0f4ba9b8d2afe7f4d68b51fc9fedf7" +patches: + "1.4.0": + - patch_file: "patches/0001-missing-stdlib-include.patch" + patch_description: "fix missing stdlib include" + patch_type: "bugfix" + patch_source: "https://github.com/baylej/tmx/commit/2d20ed631618f5e9ca89d90147aab8157989f5da.patch" diff --git a/recipes/tmx/all/conanfile.py b/recipes/tmx/all/conanfile.py index 5a3b3214bc42f..30a73f62e1cfe 100644 --- a/recipes/tmx/all/conanfile.py +++ b/recipes/tmx/all/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 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.51.1" +required_conan_version = ">=1.53.0" class TmxConan(ConanFile): @@ -15,6 +15,7 @@ class TmxConan(ConanFile): homepage = "https://github.com/baylej/tmx" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -29,34 +30,28 @@ class TmxConan(ConanFile): "with_zstd": 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: - 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 + 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("libxml2/2.9.14") + self.requires("libxml2/[>=2.12.5 <3]") if self.options.with_zlib: - self.requires("zlib/1.2.13") + self.requires("zlib/[>=1.2.11 <2]") if self.options.with_zstd: - self.requires("zstd/1.5.2") + self.requires("zstd/1.5.5") def source(self): get(self, **self.conan_data["sources"][self.version], @@ -75,6 +70,7 @@ def generate(self): deps.generate() def build(self): + apply_conandata_patches(self) cmake = CMake(self) cmake.configure() cmake.build() diff --git a/recipes/tmx/all/patches/0001-missing-stdlib-include.patch b/recipes/tmx/all/patches/0001-missing-stdlib-include.patch new file mode 100644 index 0000000000000..9c45635658dfa --- /dev/null +++ b/recipes/tmx/all/patches/0001-missing-stdlib-include.patch @@ -0,0 +1,22 @@ +From 2d20ed631618f5e9ca89d90147aab8157989f5da Mon Sep 17 00:00:00 2001 +From: Connor Rigby +Date: Thu, 18 Jan 2024 18:40:53 -0700 +Subject: [PATCH] tmx_mem: add stdlib.h for free and realloc + +Signed-off-by: Connor Rigby +--- + src/tmx_mem.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/tmx_mem.c b/src/tmx_mem.c +index 5ff31c9..b421af6 100644 +--- a/src/tmx_mem.c ++++ b/src/tmx_mem.c +@@ -2,6 +2,7 @@ + Node allocation + */ + ++#include + #include + + #include diff --git a/recipes/tmx/config.yml b/recipes/tmx/config.yml index c957e4bc2d3c7..2403f62fecbf1 100644 --- a/recipes/tmx/config.yml +++ b/recipes/tmx/config.yml @@ -1,3 +1,5 @@ versions: + "1.10.0": + folder: all "1.4.0": folder: all diff --git a/recipes/tmxlite/all/conandata.yml b/recipes/tmxlite/all/conandata.yml index acb2db05df822..e7bc4087210dd 100644 --- a/recipes/tmxlite/all/conandata.yml +++ b/recipes/tmxlite/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.4.4": + url: "https://github.com/fallahn/tmxlite/archive/refs/tags/v1.4.4.tar.gz" + sha256: "ec8893efc8396308f291c284cb09f007441a15aabbb0e5722096cf79c65c9e58" "1.3.0": url: "https://github.com/fallahn/tmxlite/archive/refs/tags/v1.3.0.tar.gz" sha256: "f5d2abd23d4516168eb82bbe879998ce41cb17768f8cd72f643f394939123efe" diff --git a/recipes/tmxlite/all/conanfile.py b/recipes/tmxlite/all/conanfile.py index 44380126b8654..b272cebfd24cb 100644 --- a/recipes/tmxlite/all/conanfile.py +++ b/recipes/tmxlite/all/conanfile.py @@ -6,7 +6,7 @@ from conan.tools.scm import Version import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class TmxliteConan(ConanFile): @@ -17,6 +17,7 @@ class TmxliteConan(ConanFile): homepage = "https://github.com/fallahn/tmxlite" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -36,17 +37,18 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("miniz/2.2.0") - self.requires("pugixml/1.12.1") + if Version(self.version) < "1.4.1": + self.requires("miniz/3.0.2") + else: + self.requires("zlib/[>=1.2.11 <2]") + self.requires("zstd/1.5.5") + self.requires("pugixml/1.14") def validate(self): if self.info.settings.compiler.get_safe("cppstd"): @@ -55,28 +57,38 @@ def validate(self): raise ConanInvalidConfiguration("gcc < 5 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) tc.variables["TMXLITE_STATIC_LIB"] = not self.options.shared tc.variables["PROJECT_STATIC_RUNTIME"] = False tc.variables["USE_RTTI"] = True + if Version(self.version) >= "1.4.1": + tc.variables["USE_EXTLIBS"] = True tc.generate() deps = CMakeDeps(self) + if Version(self.version) >= "1.4.1": + deps.set_property("pugixml", "cmake_file_name", "PUGIXML") + deps.set_property("zstd", "cmake_file_name", "Zstd") + deps.set_property("zstd", "cmake_target_name", "zstd::libzstd") deps.generate() def _patch_sources(self): apply_conandata_patches(self) - # unvendor miniz - 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 - 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", "") + if Version(self.version) < "1.4.0": + # unvendor miniz + 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 + 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", "") + else: + replace_in_file(self, os.path.join(self.source_folder, "tmxlite", "CMakeLists.txt"), + "target_link_libraries(${PROJECT_NAME} ${ZLIB_LIBRARIES} ${PUGIXML_LIBRARY} ${ZSTD_LIBRARY})", + "target_link_libraries(${PROJECT_NAME} ZLIB::ZLIB pugixml::pugixml zstd::libzstd)") # Don't inject -O3 in compile flags replace_in_file(self, os.path.join(self.source_folder, "tmxlite", "CMakeLists.txt"), "-O3", "") @@ -91,6 +103,8 @@ 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")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): self.cpp_info.libs = collect_libs(self) diff --git a/recipes/tmxlite/config.yml b/recipes/tmxlite/config.yml index 426a0e4c79e9b..33f41bd49b3a4 100644 --- a/recipes/tmxlite/config.yml +++ b/recipes/tmxlite/config.yml @@ -1,3 +1,5 @@ versions: + "1.4.4": + folder: all "1.3.0": folder: all diff --git a/recipes/tng/all/conanfile.py b/recipes/tng/all/conanfile.py index 4a409ba3da2e2..326cababad6b6 100644 --- a/recipes/tng/all/conanfile.py +++ b/recipes/tng/all/conanfile.py @@ -41,7 +41,7 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("zlib/1.2.13") + self.requires("zlib/[>=1.2.11 <2]") def source(self): get(self, **self.conan_data["sources"][self.version], diff --git a/recipes/toml11/all/conandata.yml b/recipes/toml11/all/conandata.yml index 473d7afa5e2db..20b0be495cd07 100644 --- a/recipes/toml11/all/conandata.yml +++ b/recipes/toml11/all/conandata.yml @@ -1,22 +1,16 @@ sources: - "3.7.1": - url: "https://github.com/ToruNiina/toml11/archive/refs/tags/v3.7.1.tar.gz" - sha256: "afeaa9aa0416d4b6b2cd3897ca55d9317084103077b32a852247d8efd4cf6068" - "3.7.0": - url: "https://github.com/ToruNiina/toml11/archive/v3.7.0.tar.gz" - sha256: "a0b6bec77c0e418eea7d270a4437510884f2fe8f61e7ab121729624f04c4b58e" - "3.6.1": - url: "https://github.com/ToruNiina/toml11/archive/refs/tags/v3.6.1.tar.gz" - sha256: "ca4c390ed8da0d77ae6eca30e70ab0bf5cc92adfc1bc2f71a2066bc5656d8d96" - "3.6.0": - url: "https://github.com/ToruNiina/toml11/archive/v3.6.0.tar.gz" - sha256: "39e8d651db346ae8c7e3b39d6338a37232b9af3bba36ade45b241bf105c2226c" - "3.5.0": - url: "https://github.com/ToruNiina/toml11/archive/v3.5.0.tar.gz" - sha256: "fc613874c6e80dc740134a7353cf23c7f834b59cd601af84ab535ee16a53b1c3" - "3.4.0": - url: "https://github.com/ToruNiina/toml11/archive/v3.4.0.tar.gz" - sha256: "bc6d733efd9216af8c119d8ac64a805578c79cc82b813e4d1d880ca128bd154d" - "3.1.0": - url: "https://github.com/ToruNiina/toml11/archive/v3.1.0.tar.gz" - sha256: "3a118f32e5343998f37be9807c72fd11c3168fe12a5b1abfdc0f1e60de6380a4" + "4.2.0": + url: "https://github.com/ToruNiina/toml11/archive/refs/tags/v4.2.0.tar.gz" + sha256: "9287971cd4a1a3992ef37e7b95a3972d1ae56410e7f8e3f300727ab1d6c79c2c" + "4.1.0": + url: "https://github.com/ToruNiina/toml11/archive/refs/tags/v4.1.0.tar.gz" + sha256: "fb4c02cc708ae28e6fc3496514e3625e4b6738ed4ce40897710ca4d7a29de4f7" + "4.0.3": + url: "https://github.com/ToruNiina/toml11/archive/refs/tags/v4.0.3.tar.gz" + sha256: "c8cbc7839cb3f235153045ce550e559f55a04554dfcab8743ba8a1e8ef6a54bf" + "4.0.1": + url: "https://github.com/ToruNiina/toml11/archive/refs/tags/v4.0.1.tar.gz" + sha256: "96965cb00ca7757c611c169cd5a6fb15736eab1cd1c1a88aaa62ad9851d926aa" + "3.8.1": + url: "https://github.com/ToruNiina/toml11/archive/refs/tags/v3.8.1.tar.gz" + sha256: "6a3d20080ecca5ea42102c078d3415bef80920f6c4ea2258e87572876af77849" diff --git a/recipes/toml11/all/conanfile.py b/recipes/toml11/all/conanfile.py index 72284ac7310c2..a610df26ea139 100644 --- a/recipes/toml11/all/conanfile.py +++ b/recipes/toml11/all/conanfile.py @@ -2,6 +2,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" @@ -9,11 +10,12 @@ class Toml11Conan(ConanFile): name = "toml11" - url = "https://github.com/conan-io/conan-center-index" - homepage = "https://github.com/ToruNiina/toml11" description = "TOML for Modern C++" - topics = ("toml", "c-plus-plus-11", "c-plus-plus", "parser", "serializer") license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/ToruNiina/toml11" + topics = ("toml", "c-plus-plus-11", "c-plus-plus", "parser", "serializer", "header-only") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -28,20 +30,22 @@ def validate(self): 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 + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): - 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")) + if Version(self.version) < "4.0.0": + 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")) + else: + copy(self, "*.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 = [] + 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/config.yml b/recipes/toml11/config.yml index 2a3893e072fff..43dd6c9456dcb 100644 --- a/recipes/toml11/config.yml +++ b/recipes/toml11/config.yml @@ -1,15 +1,11 @@ versions: - "3.7.1": + "4.2.0": folder: all - "3.7.0": + "4.1.0": folder: all - "3.6.1": + "4.0.3": folder: all - "3.6.0": + "4.0.1": folder: all - "3.5.0": - folder: all - "3.4.0": - folder: all - "3.1.0": + "3.8.1": folder: all diff --git a/recipes/tomlplusplus/all/conandata.yml b/recipes/tomlplusplus/all/conandata.yml index 87d4f28e27277..63de1cac4b075 100644 --- a/recipes/tomlplusplus/all/conandata.yml +++ b/recipes/tomlplusplus/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "3.4.0": + url: "https://github.com/marzer/tomlplusplus/archive/v3.4.0.tar.gz" + sha256: "8517f65938a4faae9ccf8ebb36631a38c1cadfb5efa85d9a72e15b9e97d25155" + "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" diff --git a/recipes/tomlplusplus/all/conanfile.py b/recipes/tomlplusplus/all/conanfile.py index c919e5fc7388e..4743d8a6d4255 100644 --- a/recipes/tomlplusplus/all/conanfile.py +++ b/recipes/tomlplusplus/all/conanfile.py @@ -1,10 +1,12 @@ +import os + from conan import ConanFile -from conan.tools.microsoft import is_msvc +from conan.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 +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version required_conan_version = ">=1.51.3" @@ -17,46 +19,54 @@ class TomlPlusPlusConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/marzer/tomlplusplus" license = "MIT" - settings = ("compiler", "arch", "os", "build_type") + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + options = { + "exceptions": [True, False, None] + } + default_options = { + "exceptions": None + } no_copy_source = True @property - def _minimum_cpp_standard(self): - return 17 + def _min_cppstd(self): + return "17" @property def _minimum_compilers_version(self): return { "Visual Studio": "16" if Version(self.version) < "2.2.0" or Version(self.version) >= "3.0.0" else "15", - "msvc": "1913", + "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 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) - 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(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.ref} requires c++{self._minimum_cpp_standard} support." - " The current compiler {compiler} does not support it.") + 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.version) < "2.3.0": - raise ConanInvalidConfiguration(f"The compiler {compiler} is supported in version >= 2.3.0") + raise ConanInvalidConfiguration("apple-clang is not supported in versions < 2.3.0") 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") + raise ConanInvalidConfiguration("msvc is unable to build version 2.1.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 package(self): copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) @@ -65,10 +75,12 @@ def package(self): 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") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + # Casting as a String because None value would not be properly handled, this is a PackageOption, not the value itself + # which `is` never None + if str(self.options.exceptions) != "None": + define_value = "1" if self.options.exceptions is True else "0" + self.cpp_info.defines.append(f"TOML_EXCEPTIONS={define_value}") diff --git a/recipes/tomlplusplus/all/test_package/CMakeLists.txt b/recipes/tomlplusplus/all/test_package/CMakeLists.txt index 05dc03af86034..dfea477614e59 100644 --- a/recipes/tomlplusplus/all/test_package/CMakeLists.txt +++ b/recipes/tomlplusplus/all/test_package/CMakeLists.txt @@ -1,14 +1,14 @@ cmake_minimum_required(VERSION 3.8) -project(test_package) +project(test_package LANGUAGES CXX) find_package(tomlplusplus REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} tomlplusplus::tomlplusplus) +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) + 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 db279683bd8cc..57da1f7d0d18b 100644 --- a/recipes/tomlplusplus/all/test_package/conanfile.py +++ b/recipes/tomlplusplus/all/test_package/conanfile.py @@ -1,36 +1,41 @@ from conan import ConanFile from conan.tools.build import can_run -from conan.tools.cmake import CMake, cmake_layout +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout from conan.tools.scm import Version import os class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + generators = "CMakeDeps", "VirtualRunEnv" test_type = "explicit" + def layout(self): + cmake_layout(self) + def requirements(self): self.requires(self.tested_reference_str) + + @property + def _single_header_only(self): + return self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "8" - def layout(self): - cmake_layout(self) + def generate(self): + tc = CMakeToolchain(self) + if self._single_header_only: + tc.variables["TOMLPP_BUILD_SINGLE_ONLY"] = True + tc.generate() 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 - variables = {"TOMLPP_BUILD_SINGLE_ONLY": True} if hasattr(self, "single_header_only") else None - cmake.configure(variables=variables) + cmake.configure() cmake.build() def test(self): 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") + conf_path = os.path.join(self.source_folder, "configuration.toml") self.run(f"{bin_path} {conf_path}", env="conanrun") - if not hasattr(self, "single_header_only"): + if not self._single_header_only: 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 d50b3c6469741..96107c1712ae1 100644 --- a/recipes/tomlplusplus/all/test_package/test_package.cpp +++ b/recipes/tomlplusplus/all/test_package/test_package.cpp @@ -7,21 +7,25 @@ using namespace std::string_view_literals; int main(int argc, char* argv[]) { auto config = toml::parse_file(argv[1]); + // Important: this cast will convert from parse_result which is sometimes defined as a table + // and sometimes defined as it's own class that is castable to a table&. + auto& table = static_cast(config); // get key-value pairs - std::string_view library_name = config["library"]["name"].value_or(""sv); - std::string_view library_author = config["library"]["authors"][0].value_or(""sv); - int64_t depends_on_cpp_version = config["dependencies"]["cpp"].value_or(0); + std::string_view library_name = table["library"]["name"].value_or(""sv); + std::string_view library_author = table["library"]["authors"][0].value_or(""sv); + int64_t depends_on_cpp_version = table["dependencies"]["cpp"].value_or(0); // modify the data - config.insert_or_assign("alternatives", toml::array{ + table.insert_or_assign("alternatives", toml::array{ "cpptoml", "toml11", "Boost.TOML" }); + table.insert_or_assign("exceptions", TOML_EXCEPTIONS==1); // iterate & visit over the data - for (auto&& [k, v] : config) + for (auto&& [k, v] : table) { v.visit([](auto& node) noexcept { @@ -30,9 +34,9 @@ int main(int argc, char* argv[]) { } // re-serialize as TOML - std::cout << config << std::endl; + std::cout << table << std::endl; // re-serialize as JSON - std::cout << toml::json_formatter{ config } << std::endl; + std::cout << toml::json_formatter{ table } << std::endl; return 0; } diff --git a/recipes/tomlplusplus/all/test_package/test_package_multi.cpp b/recipes/tomlplusplus/all/test_package/test_package_multi.cpp index df195938cfdee..436a7391f96b1 100644 --- a/recipes/tomlplusplus/all/test_package/test_package_multi.cpp +++ b/recipes/tomlplusplus/all/test_package/test_package_multi.cpp @@ -7,21 +7,25 @@ using namespace std::string_view_literals; int main(int argc, char* argv[]) { auto config = toml::parse_file(argv[1]); + // Important: this cast will convert from parse_result which is sometimes defined as a table + // and sometimes defined as it's own class that is castable to a table&. + auto& table = static_cast(config); // get key-value pairs - std::string_view library_name = config["library"]["name"].value_or(""sv); - std::string_view library_author = config["library"]["authors"][0].value_or(""sv); - int64_t depends_on_cpp_version = config["dependencies"]["cpp"].value_or(0); + std::string_view library_name = table["library"]["name"].value_or(""sv); + std::string_view library_author = table["library"]["authors"][0].value_or(""sv); + int64_t depends_on_cpp_version = table["dependencies"]["cpp"].value_or(0); // modify the data - config.insert_or_assign("alternatives", toml::array{ + table.insert_or_assign("alternatives", toml::array{ "cpptoml", "toml11", "Boost.TOML" }); + table.insert_or_assign("exceptions", TOML_EXCEPTIONS==1); // iterate & visit over the data - for (auto&& [k, v] : config) + for (auto&& [k, v] : table) { v.visit([](auto& node) noexcept { @@ -30,9 +34,9 @@ int main(int argc, char* argv[]) { } // re-serialize as TOML - std::cout << config << std::endl; + std::cout << table << std::endl; // re-serialize as JSON - std::cout << toml::json_formatter{ config } << std::endl; + std::cout << toml::json_formatter{ table } << std::endl; return 0; } diff --git a/recipes/tomlplusplus/all/test_v1_package/CMakeLists.txt b/recipes/tomlplusplus/all/test_v1_package/CMakeLists.txt index 784a2cef5f284..a6b6b2e67ed13 100644 --- a/recipes/tomlplusplus/all/test_v1_package/CMakeLists.txt +++ b/recipes/tomlplusplus/all/test_v1_package/CMakeLists.txt @@ -4,14 +4,6 @@ project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(tomlplusplus REQUIRED CONFIG) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} 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/test_package_multi.cpp) - target_link_libraries(${PROJECT_NAME}_multi tomlplusplus::tomlplusplus) - target_compile_features(${PROJECT_NAME}_multi PRIVATE cxx_std_17) -endif() diff --git a/recipes/tomlplusplus/all/test_v1_package/conanfile.py b/recipes/tomlplusplus/all/test_v1_package/conanfile.py index aba957cc3efa9..0e8807dfd3ae4 100644 --- a/recipes/tomlplusplus/all/test_v1_package/conanfile.py +++ b/recipes/tomlplusplus/all/test_v1_package/conanfile.py @@ -10,8 +10,6 @@ class TestPackageConan(ConanFile): 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"): @@ -22,7 +20,7 @@ def build(self): 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") + conf_path = os.path.join(self.source_folder, os.pardir, "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") diff --git a/recipes/tomlplusplus/config.yml b/recipes/tomlplusplus/config.yml index 88f0048a82e4a..0705075264b76 100644 --- a/recipes/tomlplusplus/config.yml +++ b/recipes/tomlplusplus/config.yml @@ -1,4 +1,8 @@ versions: + "3.4.0": + folder: all + "3.3.0": + folder: all "3.2.0": folder: all "3.1.0": diff --git a/recipes/toon/all/conandata.yml b/recipes/toon/all/conandata.yml new file mode 100644 index 0000000000000..2e5eef4c5773f --- /dev/null +++ b/recipes/toon/all/conandata.yml @@ -0,0 +1,10 @@ +sources: + "3.2": + url: "https://github.com/edrosten/TooN/archive/refs/tags/TOON_3.2.tar.gz" + sha256: "62f30dfb92a6f8873e6a42649760e2d1b54e61e1d3bc023d0bb171600b41c759" +patches: + "3.2": + - patch_file: "patches/001-bugfixes-backport.patch" + patch_description: "apply unreleased minor fixes" + patch_type: "backport" + patch_source: "https://github.com/edrosten/TooN/compare/TOON_3.2...370dcd9" diff --git a/recipes/toon/all/conanfile.py b/recipes/toon/all/conanfile.py new file mode 100644 index 0000000000000..6756336186e83 --- /dev/null +++ b/recipes/toon/all/conanfile.py @@ -0,0 +1,99 @@ +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, export_conandata_patches, get, replace_in_file +from conan.tools.layout import basic_layout +from conan.tools.scm import Version + +required_conan_version = ">=1.52.0" + + +class ToonConan(ConanFile): + name = "toon" + description = "TooN - Tom's Object Oriented Numerics library" + license = "BSD-2-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://codedocs.xyz/edrosten/TooN/" + topics = ("numerical", "linear-algebra", "matrix", "vector", "optimization", "automatic-differentiation", "header-only") + + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + exports_sources = ["config.hh"] + + options = { + "with_lapack": [True, False] + } + default_options = { + "with_lapack": True + } + + @property + def _min_cppstd(self): + return 14 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "6", + "clang": "5", + "apple-clang": "10", + "msvc": "191", + "Visual Studio": "15", + } + + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + if self.options.with_lapack: + self.requires("openblas/0.3.26", options={"build_lapack": 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." + ) + + if self.options.with_lapack and not self.dependencies["openblas"].options.build_lapack: + raise ConanInvalidConfiguration(f"{self.ref} requires LAPACK support in OpenBLAS with -o='openblas/*:build_lapack=True'") + + 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, "COPYING", self.source_folder, os.path.join(self.package_folder, "licenses")) + copy(self, "*", + os.path.join(self.source_folder, "TooN"), + os.path.join(self.package_folder, "include", "TooN")) + copy(self, "config.hh", self.export_sources_folder, + os.path.join(self.package_folder, "include", "TooN", "internal")) + + if not self.options.with_lapack: + replace_in_file( + self, + os.path.join(self.package_folder, "include", "TooN", "internal", "config.hh"), + "define TOON_USE_LAPACK", + "undef TOON_USE_LAPACK" + ) + + def package_info(self): + self.cpp_info.set_property("pkg_config_name", "TooN") + + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["m", "pthread"]) diff --git a/recipes/toon/all/config.hh b/recipes/toon/all/config.hh new file mode 100644 index 0000000000000..ed689361e6c58 --- /dev/null +++ b/recipes/toon/all/config.hh @@ -0,0 +1,29 @@ +/* TooN/internal/config.hh. Generated from config.hh.in by configure. */ +/* TooN/internal/config.hh.in. Generated from configure.ac by autoheader. */ + +/* define if the compiler supports basic C++14 syntax */ +#undef HAVE_CXX14 + +/* Define to 1 if you have the `lapack' library (-llapack). */ +#define HAVE_LIBLAPACK 1 + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "https://github.com/edrosten/TooN" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "TooN" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "TooN version-3.2" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "toon" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "https://codedocs.xyz/edrosten/TooN/" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "version-3.2" + +/* Use LAPACK */ +#define TOON_USE_LAPACK diff --git a/recipes/toon/all/patches/001-bugfixes-backport.patch b/recipes/toon/all/patches/001-bugfixes-backport.patch new file mode 100644 index 0000000000000..634a27c8578c0 --- /dev/null +++ b/recipes/toon/all/patches/001-bugfixes-backport.patch @@ -0,0 +1,127 @@ +diff --git a/TooN/QR.h b/TooN/QR.h +index e2273cc..10b33c3 100644 +--- a/TooN/QR.h ++++ b/TooN/QR.h +@@ -29,6 +29,7 @@ + #ifndef TOON_INC_QR_H + #define TOON_INC_QR_H + #include ++#include + #include + + namespace TooN +diff --git a/TooN/QR_Lapack.h b/TooN/QR_Lapack.h +index 6b628d1..67f1fd0 100644 +--- a/TooN/QR_Lapack.h ++++ b/TooN/QR_Lapack.h +@@ -29,6 +29,7 @@ + + #include + #include ++#include + #include + + namespace TooN{ +diff --git a/TooN/SVD.h b/TooN/SVD.h +index a74deed..e22a437 100644 +--- a/TooN/SVD.h ++++ b/TooN/SVD.h +@@ -30,6 +30,7 @@ + + #include + #include ++#include + + namespace TooN { + +diff --git a/TooN/SymEigen.h b/TooN/SymEigen.h +index aa5b434..8c6d42f 100644 +--- a/TooN/SymEigen.h ++++ b/TooN/SymEigen.h +@@ -28,6 +28,7 @@ + #ifndef __SYMEIGEN_H + #define __SYMEIGEN_H + ++#include + #include + #include + #include +diff --git a/TooN/functions/derivatives.h b/TooN/functions/derivatives.h +index 791f71e..9749461 100644 +--- a/TooN/functions/derivatives.h ++++ b/TooN/functions/derivatives.h +@@ -27,6 +27,7 @@ + #define TOON_INCLUDE_DERIVATIVES_NUMERICAL_H + + #include ++#include + #include + #include + +diff --git a/TooN/helpers.h b/TooN/helpers.h +index 8204560..447bca3 100644 +--- a/TooN/helpers.h ++++ b/TooN/helpers.h +@@ -32,6 +32,7 @@ + + #include + #include ++#include + #include + #include + #include +diff --git a/TooN/optimization/brent.h b/TooN/optimization/brent.h +index e117a80..3e60251 100644 +--- a/TooN/optimization/brent.h ++++ b/TooN/optimization/brent.h +@@ -27,6 +27,7 @@ + #define TOON_BRENT_H + #include + #include ++#include + #include + #include + #include +diff --git a/doc/documentation.h b/doc/documentation.h +index 2df5d9e..95276b1 100644 +--- a/doc/documentation.h ++++ b/doc/documentation.h +@@ -1,15 +1,7 @@ + /* + Copyright (c) 2005 Paul Smith, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Edward Rosten + +- Permission is granted to copy, distribute and/or modify this document under +- the terms of the GNU Free Documentation License, Version 1.2 or any later +- version published by the Free Software Foundation; with no Invariant +- Sections, no Front-Cover Texts, and no Back-Cover Texts. +- +- You should have received a copy of the GNU Free Documentation License +- License along with this library; if not, write to the Free Software +- Foundation, Inc. +- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ This library is free software, see COPYING file for details + + */ + /////////////////////////////////////////////////////// +diff --git a/doc/linoperatorsdoc.h b/doc/linoperatorsdoc.h +index b7aa503..f2ec6b1 100644 +--- a/doc/linoperatorsdoc.h ++++ b/doc/linoperatorsdoc.h +@@ -1,16 +1,7 @@ + /* + Copyright (c) 2005 Paul Smith + +- Permission is granted to copy, distribute and/or modify this document under +- the terms of the GNU Free Documentation License, Version 1.2 or any later +- version published by the Free Software Foundation; with no Invariant +- Sections, no Front-Cover Texts, and no Back-Cover Texts. +- +- You should have received a copy of the GNU Free Documentation License +- License along with this library; if not, write to the Free Software +- Foundation, Inc. +- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +- ++ This library is free software, see COPYING file for details + */ + // A proxy version of the Matrix class, + // cleaned up to present a comprehensible diff --git a/recipes/toon/all/test_package/CMakeLists.txt b/recipes/toon/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..28a1d29b7ba57 --- /dev/null +++ b/recipes/toon/all/test_package/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(PkgConfig REQUIRED) +pkg_check_modules(TooN REQUIRED IMPORTED_TARGET TooN) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE PkgConfig::TooN) +if (WITH_LAPACK) + target_compile_definitions(${PROJECT_NAME} PRIVATE "WITH_LAPACK") +endif () +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/toon/all/test_package/conanfile.py b/recipes/toon/all/test_package/conanfile.py new file mode 100644 index 0000000000000..cfe5e425874fc --- /dev/null +++ b/recipes/toon/all/test_package/conanfile.py @@ -0,0 +1,35 @@ +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", "arch", "compiler", "build_type" + generators = "PkgConfigDeps", "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", default=False, check_type=str): + self.tool_requires("pkgconf/2.1.0") + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["WITH_LAPACK"] = self.dependencies[self.tested_reference_str].options.with_lapack + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/toon/all/test_package/test_package.cpp b/recipes/toon/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..da2c3199f9737 --- /dev/null +++ b/recipes/toon/all/test_package/test_package.cpp @@ -0,0 +1,38 @@ +#include +#include + +#ifdef USE_LAPACK +#include +#endif + +#include +#include + +using namespace TooN; + +void test_determinant() { + Matrix<3> t = Data( + 1, 0.5, 0.5, + 0.5, 2, 0.7, + 0.5, 0.7, 3); + std::cout << "determinant: " << determinant(t) << std::endl; +} + +#ifdef USE_LAPACK +void test_lapack() { + Matrix<3> t = Data( + 1, 0.5, 0.5, + 0.5, 2, 0.7, + 0.5, 0.7, 3); + Lapack_Cholesky<3> chol(t); + std::cout << "Lapack_Cholesky determinat: " << chol.determinant() << std::endl; +} +#endif + +int main() { + test_determinant(); + +#ifdef USE_LAPACK + test_lapack(); +#endif +} diff --git a/recipes/toon/config.yml b/recipes/toon/config.yml new file mode 100644 index 0000000000000..9b5abcde381a5 --- /dev/null +++ b/recipes/toon/config.yml @@ -0,0 +1,3 @@ +versions: + "3.2": + folder: all diff --git a/recipes/tqdm-cpp/all/conandata.yml b/recipes/tqdm-cpp/all/conandata.yml new file mode 100644 index 0000000000000..b887e54b61bb3 --- /dev/null +++ b/recipes/tqdm-cpp/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "cci.20200603": + url: "https://codeload.github.com/mraggi/tqdm-cpp/zip/7e57e58550ac14e580ac9eeb948956e541402083" + sha256: "a6f129d330b1e6f73a221758800fec669157587faa43b050f36458a414448dfe" diff --git a/recipes/tqdm-cpp/all/conanfile.py b/recipes/tqdm-cpp/all/conanfile.py new file mode 100644 index 0000000000000..70497c1b12381 --- /dev/null +++ b/recipes/tqdm-cpp/all/conanfile.py @@ -0,0 +1,66 @@ +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.52.0" + + +class TqdmCppConan(ConanFile): + name = "tqdm-cpp" + description = "Easily display progress in C++17. Inspired by python's awesome tqdm library." + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/mraggi/tqdm-cpp" + topics = ("progress", "progressbar", "command-line", "header-only") + + package_type = "header-library" + 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": "6", + "apple-clang": "11", + "msvc": "191", + "Visual Studio": "15", + } + + 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 build(self): + pass + + def package(self): + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + copy(self, "tqdm.hpp",self.source_folder, os.path.join(self.package_folder, "include")) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/tqdm-cpp/all/test_package/CMakeLists.txt b/recipes/tqdm-cpp/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..75f886c04d1ce --- /dev/null +++ b/recipes/tqdm-cpp/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(tqdm-cpp REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE tqdm-cpp::tqdm-cpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/tqdm-cpp/all/test_package/conanfile.py b/recipes/tqdm-cpp/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/tqdm-cpp/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/tqdm-cpp/all/test_package/test_package.cpp b/recipes/tqdm-cpp/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..a32056d993faa --- /dev/null +++ b/recipes/tqdm-cpp/all/test_package/test_package.cpp @@ -0,0 +1,16 @@ +#include + +#include +#include +#include + +int main() +{ + using namespace std::chrono_literals; + auto delay = 5ms; + std::vector A(50, 0); + for (int a : tq::tqdm(A)) { + std::this_thread::sleep_for(delay); + } + return 0; +} diff --git a/recipes/tqdm-cpp/config.yml b/recipes/tqdm-cpp/config.yml new file mode 100644 index 0000000000000..7208e0ea0a4e0 --- /dev/null +++ b/recipes/tqdm-cpp/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20200603": + folder: all diff --git a/recipes/tracy/all/conandata.yml b/recipes/tracy/all/conandata.yml index 266a1ecb7f6b1..b98d6d618bb5d 100644 --- a/recipes/tracy/all/conandata.yml +++ b/recipes/tracy/all/conandata.yml @@ -1,4 +1,16 @@ sources: + "0.11.1": + url: "https://github.com/wolfpld/tracy/archive/refs/tags/v0.11.1.tar.gz" + sha256: "2c11ca816f2b756be2730f86b0092920419f3dabc7a7173829ffd897d91888a1" + "0.11.0": + url: "https://github.com/wolfpld/tracy/archive/refs/tags/v0.11.0.tar.gz" + sha256: "b591ef2820c5575ccbf17e2e7a1dc1f6b9a2708f65bfd00f4ebefad2a1ccf830" + "0.10": + url: "https://github.com/wolfpld/tracy/archive/refs/tags/v0.10.tar.gz" + sha256: "a76017d928f3f2727540fb950edd3b736caa97b12dbb4e5edce66542cbea6600" + "0.9.1": + url: "https://github.com/wolfpld/tracy/archive/refs/tags/v0.9.1.tar.gz" + sha256: "c2de9f35ab2a516a9689ff18f5b62a55b73b93b66514bd09ba013d7957993cd7" "0.9": url: "https://github.com/wolfpld/tracy/archive/refs/tags/v0.9.tar.gz" sha256: "93a91544e3d88f3bc4c405bad3dbc916ba951cdaadd5fcec1139af6fa56e6bfc" diff --git a/recipes/tracy/all/conanfile.py b/recipes/tracy/all/conanfile.py index 46fb7f4931376..a83ee515f3fc9 100644 --- a/recipes/tracy/all/conanfile.py +++ b/recipes/tracy/all/conanfile.py @@ -1,7 +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 copy, get, rmdir +from conan.tools.gnu import PkgConfigDeps +from conan.tools.files import copy, get, rmdir, replace_in_file +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration import os required_conan_version = ">=1.53.0" @@ -10,25 +13,40 @@ class TracyConan(ConanFile): name = "tracy" description = "C++ frame profiler" - topics = ("profiler", "performance", "gamedev") - homepage = "https://github.com/wolfpld/tracy" - 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/wolfpld/tracy" + topics = ("profiler", "performance", "gamedev") + package_type = "library" 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_ipv4": ([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), + "manual_lifetime": ([True, False], False), + "fibers": ([True, False], False), + "no_crash_handler": ([True, False], False), + "timer_fallback": ([True, False], False), + "libunwind_backtrace": ([True, False], False), + "symbol_offline_resolve": ([True, False], False), + "libbacktrace_elf_dynload_support": ([True, False], False), + "verbose": ([True, False], False), } options = { "shared": [True, False], @@ -45,6 +63,30 @@ def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + if Version(self.version) < "0.9": + self.options.rm_safe("manual_lifetime") + self.options.rm_safe("fibers") + self.options.rm_safe("no_crash_handler") + self.options.rm_safe("timer_fallback") + + del self._tracy_options["manual_lifetime"] + del self._tracy_options["fibers"] + del self._tracy_options["no_crash_handler"] + del self._tracy_options["timer_fallback"] + + if Version(self.version) < "0.11.0": + self.options.rm_safe("libunwind_backtrace") + self.options.rm_safe("symbol_offline_resolve") + self.options.rm_safe("libbacktrace_elf_dynload_support") + + del self._tracy_options["libunwind_backtrace"] + del self._tracy_options["symbol_offline_resolve"] + del self._tracy_options["libbacktrace_elf_dynload_support"] + + if Version(self.version) < "0.11.1": + self.options.rm_safe("verbose") + del self._tracy_options["verbose"] + def configure(self): if self.options.shared: self.options.rm_safe("fPIC") @@ -52,13 +94,20 @@ def configure(self): def layout(self): cmake_layout(self, src_folder="src") + def requirements(self): + if self.options.get_safe("libunwind_backtrace"): + self.requires("libunwind/1.8.1", transitive_headers=True, transitive_libs=True) + def validate(self): if self.info.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, 11) + # libunwind_backtrace is not supported in 0.11.0. https://github.com/wolfpld/tracy/pull/841 + if Version(self.version) == "0.11.0" and self.options.get_safe("libunwind_backtrace"): + raise ConanInvalidConfiguration(f"libunwind_backtrace is not supported in {self.ref}") + 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 +118,9 @@ def generate(self): opt = f"TRACY_{opt.upper()}" tc.variables[opt] = switch tc.generate() + if self.options.get_safe("libunwind_backtrace"): + deps = PkgConfigDeps(self) + deps.generate() def build(self): cmake = CMake(self) @@ -76,7 +128,8 @@ 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() rmdir(self, os.path.join(self.package_folder, "share")) @@ -87,15 +140,34 @@ def package_info(self): # 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") + self.cpp_info.components["tracyclient"].defines.append( + "TRACY_IMPORTS") if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.components["tracyclient"].system_libs.append("pthread") + self.cpp_info.components["tracyclient"].system_libs.extend([ + "pthread", + "m" + ]) if self.settings.os == "Linux": self.cpp_info.components["tracyclient"].system_libs.append("dl") + if self.settings.os == "Windows": + self.cpp_info.components["tracyclient"].system_libs.extend([ + "dbghelp", + "ws2_32" + ]) + if self.options.get_safe("libunwind_backtrace"): + self.cpp_info.components["tracyclient"].requires.append("libunwind::libunwind") + + # 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") + self.cpp_info.components["tracyclient"].set_property( + "cmake_target_name", "Tracy::TracyClient") diff --git a/recipes/tracy/all/test_package/test_package.cpp b/recipes/tracy/all/test_package/test_package.cpp index 7d1382592d76d..3063aab0b6e28 100644 --- a/recipes/tracy/all/test_package/test_package.cpp +++ b/recipes/tracy/all/test_package/test_package.cpp @@ -5,7 +5,7 @@ #endif int main(int argc, char **argv) { - ZoneScopedN("main") + ZoneScopedN("main"); return 0; } diff --git a/recipes/tracy/config.yml b/recipes/tracy/config.yml index 77aaa018b1794..01f7199be9c6a 100644 --- a/recipes/tracy/config.yml +++ b/recipes/tracy/config.yml @@ -1,4 +1,12 @@ versions: + "0.11.1": + folder: all + "0.11.0": + folder: all + "0.10": + folder: all + "0.9.1": + folder: all "0.9": folder: all "0.8.2.1": diff --git a/recipes/trantor/all/conandata.yml b/recipes/trantor/all/conandata.yml index fba0b726613a2..8d5dd0ad82696 100644 --- a/recipes/trantor/all/conandata.yml +++ b/recipes/trantor/all/conandata.yml @@ -1,13 +1,58 @@ sources: - "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" - "1.5.5": - url: "https://github.com/an-tao/trantor/archive/refs/tags/v1.5.5.tar.gz" - sha256: "5a549c6efebe7ecba73a944cfba4a9713130704d4ccc82af534a2e108b9a0e71" + "1.5.22": + url: "https://github.com/an-tao/trantor/archive/v1.5.22.tar.gz" + sha256: "2f870b016a592228d617ef51eec4e9a9ab7dc56c066923af9bf6dd42fefb63de" + "1.5.21": + url: "https://github.com/an-tao/trantor/archive/v1.5.21.tar.gz" + sha256: "c267e8d3657a85751554a6877efd1199f6766a9fd6418d2c72839ad0a8943988" + "1.5.20": + url: "https://github.com/an-tao/trantor/archive/v1.5.20.tar.gz" + sha256: "4d3b98c228aafde1001cff581cf8d1a4a9f71f7b2a85a28978b560aefc21c038" + "1.5.19": + url: "https://github.com/an-tao/trantor/archive/v1.5.19.tar.gz" + sha256: "a2f55a98fd4b0737ba0e2cd77d2f237253e607b2047071be04a9ea76587bb608" + "1.5.16": + url: "https://github.com/an-tao/trantor/archive/v1.5.16.tar.gz" + sha256: "ef6f4d9c855ea7823dd9bfb094e852d23450b5fc149936f09964d19cb34741e9" + "1.5.15": + url: "https://github.com/an-tao/trantor/archive/v1.5.15.tar.gz" + sha256: "478d33bc2d48ef2511969c1024eeeee5cf0ef4eea6c65761d0a72b8b9b3004be" + "1.5.14": + url: "https://github.com/an-tao/trantor/archive/v1.5.14.tar.gz" + sha256: "80775d65fd49dfb0eb85d70cd9c0f0cff38a7f46c90db918862c46e03ae63810" + "1.5.13": + url: "https://github.com/an-tao/trantor/archive/v1.5.13.tar.gz" + sha256: "36f02302bff3ffa8d2b1bff29f451d7a11d215a43963fb95aa543b555de2f9bf" +patches: + "1.5.22": + - patch_file: "patches/1.5.19-0001-disable-werror.patch" + patch_description: "disable -Werror for gcc5" + patch_type: "portability" + "1.5.21": + - patch_file: "patches/1.5.19-0001-disable-werror.patch" + patch_description: "disable -Werror for gcc5" + patch_type: "portability" + "1.5.20": + - patch_file: "patches/1.5.19-0001-disable-werror.patch" + patch_description: "disable -Werror for gcc5" + patch_type: "portability" + "1.5.19": + - patch_file: "patches/1.5.19-0001-disable-werror.patch" + patch_description: "disable -Werror for gcc5" + patch_type: "portability" + "1.5.16": + - patch_file: "patches/1.5.15-0001-disable-werror.patch" + patch_description: "disable -Werror for gcc5" + patch_type: "portability" + "1.5.15": + - patch_file: "patches/1.5.15-0001-disable-werror.patch" + patch_description: "disable -Werror for gcc5" + patch_type: "portability" + "1.5.14": + - patch_file: "patches/1.5.12-0001-disable-werror.patch" + patch_description: "disable -Werror for gcc5" + patch_type: "portability" + "1.5.13": + - patch_file: "patches/1.5.12-0001-disable-werror.patch" + patch_description: "disable -Werror for gcc5" + patch_type: "portability" diff --git a/recipes/trantor/all/conanfile.py b/recipes/trantor/all/conanfile.py index aa966f7edb8a8..0f9e11378b1a8 100644 --- a/recipes/trantor/all/conanfile.py +++ b/recipes/trantor/all/conanfile.py @@ -1,99 +1,108 @@ 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.files import get, copy, rmdir, replace_in_file, export_conandata_patches, apply_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.52.0" +required_conan_version = ">=1.54.0" class TrantorConan(ConanFile): name = "trantor" description = "a non-blocking I/O tcp network lib based on c++14/17" + license = "BSD-3-Clause" 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" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "fPIC": [True, False], "shared": [True, False], "with_c_ares": [True, False], + "with_spdlog": [True, False], } default_options = { "fPIC": True, "shared": False, "with_c_ares": True, + "with_spdlog": False, + "spdlog/*:header_only": True, } @property - def _minimum_cpp_standard(self): + def _min_cppstd(self): return 14 @property def _compilers_minimum_version(self): return { "gcc": "5", - "Visual Studio": "15.0", + "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 + if Version(self.version) < "1.5.15": + del self.options.with_spdlog + del self.default_options["spdlog/*:header_only"] def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("openssl/1.1.1s") + self.requires("openssl/[>=1.1 <4]") if self.options.with_c_ares: - self.requires("c-ares/1.18.1") + self.requires("c-ares/1.25.0") + if self.options.get_safe("with_spdlog"): + self.requires("spdlog/1.13.0") def validate(self): if self.info.settings.compiler.get_safe("cppstd"): - check_min_cppstd(self, self._minimum_cpp_standard) + check_min_cppstd(self, self._min_cppstd) minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) - if minimum_version: - 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(f"{self.ref} requires C++{self._minimum_cpp_standard}. Your compiler is unknown. Assuming it supports C++{self._minimum_cpp_standard}.") + 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." + ) # 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.") + if self.options.get_safe("with_spdlog") and not self.dependencies["spdlog"].options.header_only: + raise ConanInvalidConfiguration(f"{self.ref} requires header_only spdlog.") + 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) - 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 + # TODO: support other tls providers + tc.variables["TRANTOR_USE_TLS"] = "openssl" tc.variables["BUILD_C-ARES"] = self.options.with_c_ares + tc.variables["USE_SPDLOG"] = self.options.get_safe("with_spdlog") tc.generate() tc = CMakeDeps(self) tc.generate() def _patch_sources(self): + apply_conandata_patches(self) cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") # fix c-ares imported target replace_in_file(self, cmakelists, "c-ares_lib", "c-ares::cares") diff --git a/recipes/trantor/all/patches/1.5.12-0001-disable-werror.patch b/recipes/trantor/all/patches/1.5.12-0001-disable-werror.patch new file mode 100644 index 0000000000000..ac4b2f2545dce --- /dev/null +++ b/recipes/trantor/all/patches/1.5.12-0001-disable-werror.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 810c2c1..a4f375d 100755 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -46,7 +46,7 @@ if(BUILD_SHARED_LIBS) + endif(BUILD_SHARED_LIBS) + + if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows" AND CMAKE_CXX_COMPILER_ID MATCHES Clang|GNU) +- target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Werror) ++ target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra) + endif() + + if(${CMAKE_SYSTEM_NAME} STREQUAL "Haiku") diff --git a/recipes/trantor/all/patches/1.5.15-0001-disable-werror.patch b/recipes/trantor/all/patches/1.5.15-0001-disable-werror.patch new file mode 100644 index 0000000000000..bbeb7c91c05b7 --- /dev/null +++ b/recipes/trantor/all/patches/1.5.15-0001-disable-werror.patch @@ -0,0 +1,13 @@ +diff --git a/a/CMakeLists.txt b/b/CMakeLists.txt +index 4ec5461..8ec652a 100755 +--- a/a/CMakeLists.txt ++++ b/b/CMakeLists.txt +@@ -55,7 +55,7 @@ if(MSVC AND MSVC_VERSION GREATER_EQUAL 1914) + endif(MSVC AND MSVC_VERSION GREATER_EQUAL 1914) + + if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows" AND CMAKE_CXX_COMPILER_ID MATCHES Clang|GNU) +- target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Werror) ++ target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra) + endif() + + if(${CMAKE_SYSTEM_NAME} STREQUAL "Haiku") diff --git a/recipes/trantor/all/patches/1.5.19-0001-disable-werror.patch b/recipes/trantor/all/patches/1.5.19-0001-disable-werror.patch new file mode 100644 index 0000000000000..c627d69cd2495 --- /dev/null +++ b/recipes/trantor/all/patches/1.5.19-0001-disable-werror.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index a0b10de..b2331dc 100755 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -76,7 +76,7 @@ if(NOT + "Windows" + AND CMAKE_CXX_COMPILER_ID MATCHES Clang|GNU + ) +- target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Werror) ++ target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra) + endif() + + if(${CMAKE_SYSTEM_NAME} STREQUAL "Haiku") diff --git a/recipes/trantor/all/test_package/CMakeLists.txt b/recipes/trantor/all/test_package/CMakeLists.txt index 6f1ffb862ba14..96e466512e5b2 100644 --- a/recipes/trantor/all/test_package/CMakeLists.txt +++ b/recipes/trantor/all/test_package/CMakeLists.txt @@ -1,8 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package CXX) +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_v1_package/CMakeLists.txt b/recipes/trantor/all/test_v1_package/CMakeLists.txt index b4e59cd2346d6..bc541ea90b512 100644 --- a/recipes/trantor/all/test_v1_package/CMakeLists.txt +++ b/recipes/trantor/all/test_v1_package/CMakeLists.txt @@ -1,12 +1,9 @@ cmake_minimum_required(VERSION 3.8) -project(test_package CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(Trantor REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE Trantor::Trantor) -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/trantor/config.yml b/recipes/trantor/config.yml index 962b694258815..1869cd2282d5e 100644 --- a/recipes/trantor/config.yml +++ b/recipes/trantor/config.yml @@ -1,9 +1,17 @@ versions: - "1.5.8": + "1.5.22": folder: "all" - "1.5.7": + "1.5.21": folder: "all" - "1.5.6": + "1.5.20": folder: "all" - "1.5.5": + "1.5.19": + folder: "all" + "1.5.16": + folder: "all" + "1.5.15": + folder: "all" + "1.5.14": + folder: "all" + "1.5.13": folder: "all" diff --git a/recipes/tre/all/CMakeLists.txt b/recipes/tre/all/CMakeLists.txt new file mode 100644 index 0000000000000..cf9c37d17b6e1 --- /dev/null +++ b/recipes/tre/all/CMakeLists.txt @@ -0,0 +1,24 @@ +cmake_minimum_required (VERSION 3.15) +project (tre) + +set(HEADERS + local_includes/regex.h + local_includes/tre.h + win32/tre-config.h +) +file(GLOB SRCS lib/*.c) + +include_directories(win32 local_includes) +add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS) +add_definitions(-DHAVE_CONFIG_H -DHAVE_MALLOC_H) +add_library(tre ${SRCS} win32/tre.def) + +install(TARGETS tre + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +) + +install(FILES ${HEADERS} + DESTINATION include/tre +) diff --git a/recipes/tre/all/conandata.yml b/recipes/tre/all/conandata.yml new file mode 100644 index 0000000000000..683be30ad0ede --- /dev/null +++ b/recipes/tre/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "cci.20230717": + url: "https://github.com/laurikari/tre/archive/07e66d07b44ae95a7a89f79c7ce1090f0f4d64db.tar.gz" + sha256: "f2390091a35c31e90efcce88006c2396f5698759f2f7abd136e771c3e0996961" diff --git a/recipes/tre/all/conanfile.py b/recipes/tre/all/conanfile.py new file mode 100644 index 0000000000000..a6886aa3b08d0 --- /dev/null +++ b/recipes/tre/all/conanfile.py @@ -0,0 +1,91 @@ +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.cmake import CMakeToolchain, CMake, cmake_layout +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import copy, get, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain + +required_conan_version = ">=1.53.0" + + +class TreConan(ConanFile): + name = "tre" + description = "TRE is a lightweight, robust, and efficient POSIX-compliant regexp matching library with some exciting features such as approximate (fuzzy) matching." + license = "BSD-2-Clause" + homepage = "https://github.com/laurikari/tre" + url = "https://github.com/conan-io/conan-center-index" + topics = "regex", "fuzzy matching" + + 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): + 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") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + cmake_layout(self, src_folder="src") + + def build_requirements(self): + if self.settings.os != "Windows": + self.tool_requires("gettext/0.21") + self.tool_requires("libtool/2.4.7") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + if self.settings.os == "Windows": + tc = CMakeToolchain(self) + tc.generate() + else: + env = VirtualBuildEnv(self) + env.generate() + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") + tc = AutotoolsToolchain(self) + tc.generate() + + def build(self): + if self.settings.os == "Windows": + copy(self, "CMakeLists.txt", src=self.export_sources_folder, dst=self.source_folder) + cmake = CMake(self) + cmake.configure() + cmake.build() + else: + autotools = Autotools(self) + autotools.autoreconf() + autotools.configure() + autotools.make() + + def package(self): + copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + if self.settings.os == "Windows": + cmake = CMake(self) + cmake.install() + 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")) + 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", "tre") + self.cpp_info.libs = ["tre"] diff --git a/recipes/tre/all/test_package/CMakeLists.txt b/recipes/tre/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..dff3b713e92cc --- /dev/null +++ b/recipes/tre/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) + +find_package(tre REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE tre::tre) diff --git a/recipes/tre/all/test_package/conanfile.py b/recipes/tre/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/tre/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/tre/all/test_package/test_package.c b/recipes/tre/all/test_package/test_package.c new file mode 100644 index 0000000000000..605527c604de8 --- /dev/null +++ b/recipes/tre/all/test_package/test_package.c @@ -0,0 +1,21 @@ +#include "tre/tre.h" +#include + +int main() +{ + regex_t rx; + tre_regcomp(&rx, "(January|February)", REG_EXTENDED); + + regaparams_t params = {0}; + tre_regaparams_default(¶ms); + + regamatch_t match = {0}; + + if (!tre_regaexec(&rx, "Janvary", &match, params, 0)) { + printf("Levenshtein distance: %d\n", match.cost); + } else { + printf("Failed to match\n"); + } + + return 0; +} diff --git a/recipes/tre/config.yml b/recipes/tre/config.yml new file mode 100644 index 0000000000000..b32c668575dde --- /dev/null +++ b/recipes/tre/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20230717": + folder: all diff --git a/recipes/tree-gen/all/conandata.yml b/recipes/tree-gen/all/conandata.yml new file mode 100644 index 0000000000000..ff188eda8fa4f --- /dev/null +++ b/recipes/tree-gen/all/conandata.yml @@ -0,0 +1,13 @@ +sources: + "1.0.9": + url: "https://github.com/QuTech-Delft/tree-gen/archive/refs/tags/1.0.9.tar.gz" + sha256: "4ae8bd44f281ec76f25ac6f8228586467f7c7b2b9f67c4dc38ca524fb4e94d3a" + "1.0.8": + url: "https://github.com/QuTech-Delft/tree-gen/archive/refs/tags/1.0.8.tar.gz" + sha256: "a840f1da2fa377d2d791885d83b95dc15f081b308208d3497c395721488a4130" + "1.0.7": + url: "https://github.com/QuTech-Delft/tree-gen/archive/refs/tags/1.0.7.tar.gz" + sha256: "bd27c88d789efe1d187846d3b819fbaa1ba3a520d6d4181d1216c4a2e73e4e85" + "1.0.6": + url: "https://github.com/QuTech-Delft/tree-gen/archive/refs/tags/1.0.6.tar.gz" + sha256: "a7f6617830b3817b21cddc0f4442a04c10fbb89a19cabb1bbd0e8facb040cba8" diff --git a/recipes/tree-gen/all/conanfile.py b/recipes/tree-gen/all/conanfile.py new file mode 100644 index 0000000000000..7c2572f700bf5 --- /dev/null +++ b/recipes/tree-gen/all/conanfile.py @@ -0,0 +1,111 @@ +import os + +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +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.scm import Version + +required_conan_version = ">=1.53.0" + + +class TreeGenConan(ConanFile): + name = "tree-gen" + license = "Apache-2.0" + homepage = "https://github.com/QuTech-Delft/tree-gen" + url = "https://github.com/conan-io/conan-center-index" + description = "C++ and Python code generator for tree-like structures common in parser and compiler codebases." + topics = ("code generation", "tree", "parser", "compiler") + settings = "os", "compiler", "build_type", "arch" + package_type = "library" + options = { + "shared": [True, False], + "fPIC": [True, False] + } + default_options = { + "shared": False, + "fPIC": True + } + + @property + def _should_build_test(self): + return not self.conf.get("tools.build:skip_test", default=True, check_type=bool) + + @property + def _min_cppstd(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "8", + "clang": "7", + "apple-clang": "14", + "Visual Studio": "16", + "msvc": "192" + } + + 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 build_requirements(self): + if self._should_build_test: + self.test_requires("gtest/1.15.0") + self.tool_requires("m4/1.4.19") + if self.settings.os == "Windows": + self.tool_requires("winflexbison/2.5.24") + else: + self.tool_requires("flex/2.6.4") + self.tool_requires("bison/3.8.2") + + 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.") + + def requirements(self): + if Version(self.version) < "1.0.8": + self.requires("fmt/10.2.1", transitive_headers=True) + else: + self.requires("fmt/11.0.2", transitive_headers=True) + self.requires("range-v3/0.12.0", transitive_headers=True) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + deps = CMakeDeps(self) + deps.generate() + tc = CMakeToolchain(self) + tc.variables["TREE_GEN_BUILD_TESTS"] = self._should_build_test + tc.generate() + env = VirtualBuildEnv(self) + env.generate() + + def build(self): + 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")) + copy(self, "generate_tree.cmake", src=os.path.join(self.source_folder, "cmake"), dst=os.path.join(self.package_folder, "lib", "cmake")) + cmake = CMake(self) + cmake.install() + + def package_info(self): + self.cpp_info.libs = ["tree-gen"] + self.cpp_info.builddirs.append(os.path.join("lib", "cmake")) + self.cpp_info.set_property("cmake_build_modules", [os.path.join("lib", "cmake", "generate_tree.cmake")]) diff --git a/recipes/tree-gen/all/test_package/CMakeLists.txt b/recipes/tree-gen/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..1da53d12a62a1 --- /dev/null +++ b/recipes/tree-gen/all/test_package/CMakeLists.txt @@ -0,0 +1,28 @@ +cmake_minimum_required(VERSION 3.12) + +project(PackageTest CXX) + +find_package(tree-gen REQUIRED CONFIG) + +find_program(TREE_GEN_EXECUTABLE tree-gen REQUIRED) + +# Generate the directory classes. +generate_tree_py( + "${TREE_GEN_EXECUTABLE}" + "${CMAKE_CURRENT_SOURCE_DIR}/res/directory.tree" + "${CMAKE_CURRENT_BINARY_DIR}/directory.hpp" + "${CMAKE_CURRENT_BINARY_DIR}/directory.cpp" + "${CMAKE_CURRENT_BINARY_DIR}/directory.py" +) + +add_executable(test_package + "${CMAKE_CURRENT_SOURCE_DIR}/src/test_package.cpp" + "${CMAKE_CURRENT_BINARY_DIR}/directory.cpp" +) + +target_include_directories(test_package + PRIVATE "${CMAKE_CURRENT_BINARY_DIR}" + PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/src" +) +target_compile_features(test_package PRIVATE cxx_std_17) +target_link_libraries(test_package PRIVATE tree-gen::tree-gen) diff --git a/recipes/tree-gen/all/test_package/conanfile.py b/recipes/tree-gen/all/test_package/conanfile.py new file mode 100644 index 0000000000000..d9214e3d91722 --- /dev/null +++ b/recipes/tree-gen/all/test_package/conanfile.py @@ -0,0 +1,30 @@ +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", "VirtualRunEnv" + test_type = "explicit" + + def build_requirements(self): + self.tool_requires(self.tested_reference_str) + + 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 can_run(self): + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/tree-gen/all/test_package/res/directory.tree b/recipes/tree-gen/all/test_package/res/directory.tree new file mode 100644 index 0000000000000..ef78a5d0d0d14 --- /dev/null +++ b/recipes/tree-gen/all/test_package/res/directory.tree @@ -0,0 +1,74 @@ +// Attach \file docstrings to the generated files for Doxygen. +# Implementation for classes representing a Windows directory tree. +source + +# Header for classes representing a Windows directory tree. +header + +// Include tree base classes. +include "tree-base.hpp" +tree_namespace tree::base + +// Include primitive types. +include "primitives.hpp" +import primitives + +// Initialization function to use to construct default values for the tree base +// classes and primitives. +initialize_function primitives::initialize +serdes_functions primitives::serialize primitives::deserialize + +// Set the namespace for the generated classes and attach a docstring. +# Namespace for classes representing a Windows directory tree. +namespace directory + +# Root node, containing the drives and associated directory trees. +system { + + # The drives available on the system. There must be at least one. + drives: Many; + +} + +# Represents a drive. +drive { + + # The drive letter used to identify it. + letter: primitives::Letter; + + # Root directory. + root_dir: One; + +} + +# Represents a directory entry. +entry { + + # Name of the directory entry. + name: primitives::String; + + # Represents a regular file. + file { + + # The file contents. + contents: primitives::String; + + } + + # Represents a (sub)directory. + directory { + + # The directory contents. Note that directories can be empty. + entries: Any; + + } + + # Represents a link to another directory. + mount { + + # The directory linked to. + target: Link; + + } + +} diff --git a/recipes/tree-gen/all/test_package/src/primitives.hpp b/recipes/tree-gen/all/test_package/src/primitives.hpp new file mode 100644 index 0000000000000..e4b04b69ada62 --- /dev/null +++ b/recipes/tree-gen/all/test_package/src/primitives.hpp @@ -0,0 +1,90 @@ +/** \file + * Defines primitives used in the generated directory tree structure. + */ + +#pragma once + +#include + +/** + * Namespace with primitives used in the generated directory tree structure. + */ +namespace primitives { + +/** + * Letter primitive, used to represent drive letters. + */ +using Letter = char; + +/** + * Strings, used to represent filenames and file contents. + */ +using String = std::string; + +/** + * Initialization function. This must be specialized for any types used as + * primitives in a tree that are actual C primitives (int, char, bool, etc), + * as these are not initialized by the T() construct. + */ +template +T initialize() { return T(); }; + +/** + * Declare the default initializer for drive letters. It's declared inline + * to avoid having to make a cpp file just for this. + */ +template <> +inline Letter initialize() { + return 'A'; +} + +/** + * Serialization function. This must be specialized for any types used as + * primitives in a tree. The default implementation doesn't do anything. + */ +template +void serialize(const T &obj, tree::cbor::MapWriter &map) { +} + +/** + * Serialization function for Letter. + */ +template <> +inline void serialize(const Letter &obj, tree::cbor::MapWriter &map) { + map.append_int("val", obj); +} + +/** + * Serialization function for String. + */ +template <> +inline void serialize(const String &obj, tree::cbor::MapWriter &map) { + map.append_string("val", obj); +} + +/** + * Deserialization function. This must be specialized for any types used as + * primitives in a tree. The default implementation doesn't do anything. + */ +template +T deserialize(const tree::cbor::MapReader &map) { + return initialize(); +} + +/** + * Deserialization function for Letter. + */ +template <> +inline Letter deserialize(const tree::cbor::MapReader &map) { + return map.at("val").as_int(); +} + +/** + * Deserialization function for String. + */ +template <> +inline String deserialize(const tree::cbor::MapReader &map) { + return map.at("val").as_string(); +} + +} // namespace primitives diff --git a/recipes/tree-gen/all/test_package/src/test_package.cpp b/recipes/tree-gen/all/test_package/src/test_package.cpp new file mode 100644 index 0000000000000..34ed4f5d4eea7 --- /dev/null +++ b/recipes/tree-gen/all/test_package/src/test_package.cpp @@ -0,0 +1,18 @@ +#include "directory.hpp" // the generated file +#include "utils.hpp" +#include "version.hpp" // tree-gen version + +#include + + +void print_tree_gen_version() { + std::cout << "tree-gen version: " << get_version() << "\n"; + std::cout << "tree-gen release year: " << get_release_year() << "\n"; +} + +int main() { + print_tree_gen_version(); + + auto system = tree::base::make(); + ASSERT(!system.is_well_formed()); +} diff --git a/recipes/tree-gen/all/test_package/src/utils.hpp b/recipes/tree-gen/all/test_package/src/utils.hpp new file mode 100644 index 0000000000000..09550ab4f6d8e --- /dev/null +++ b/recipes/tree-gen/all/test_package/src/utils.hpp @@ -0,0 +1,20 @@ +#pragma once + +#define ASSERT(x) \ + do { \ + if (!(x)) { \ + throw std::runtime_error("assertion failed: " #x " is false at " __FILE__ ":" + std::to_string(__LINE__)); \ + } \ + } while (0) + +#define ASSERT_RAISES(exc, x) \ + do { \ + try { \ + x; \ + throw std::runtime_error("assertion failed: no exception at " __FILE__ ":" + std::to_string(__LINE__)); \ + } catch (exc &e) { \ + std::cout << #exc << " exception message: " << e.what() << std::endl; \ + } \ + } while (0) + +#define MARKER std::cout << "###MARKER###" << std::endl; diff --git a/recipes/tree-gen/config.yml b/recipes/tree-gen/config.yml new file mode 100644 index 0000000000000..afebf2e48e20c --- /dev/null +++ b/recipes/tree-gen/config.yml @@ -0,0 +1,9 @@ +versions: + "1.0.9": + folder: all + "1.0.8": + folder: all + "1.0.7": + folder: all + "1.0.6": + folder: all diff --git a/recipes/tree-sitter-c/all/CMakeLists.txt b/recipes/tree-sitter-c/all/CMakeLists.txt index 2d76c83c9cbd4..afdc4445b1ec2 100644 --- a/recipes/tree-sitter-c/all/CMakeLists.txt +++ b/recipes/tree-sitter-c/all/CMakeLists.txt @@ -1,22 +1,26 @@ cmake_minimum_required(VERSION 3.0) -project(tree-sitter-c C) - -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(tree-sitter-c LANGUAGES C) find_package(tree-sitter REQUIRED CONFIG) include(GenerateExportHeader) file(WRITE api.h [[ #pragma once -#include #include "tree_sitter_c_export.h" -TREE_SITTER_C_EXPORT const TSLanguage *tree_sitter_c(void); +#ifdef __cplusplus +extern "C" { +#endif + +const TSLanguage *tree_sitter_c(void); + +#ifdef __cplusplus +} +#endif ]]) add_library(${PROJECT_NAME} - source_subfolder/src/parser.c + src/parser.c ) target_link_libraries(${PROJECT_NAME} PUBLIC @@ -24,8 +28,7 @@ target_link_libraries(${PROJECT_NAME} ) target_include_directories(${PROJECT_NAME} PRIVATE - $ - $ + $ ) set_target_properties(${PROJECT_NAME} PROPERTIES diff --git a/recipes/tree-sitter-c/all/conandata.yml b/recipes/tree-sitter-c/all/conandata.yml index fe7f567397167..95bb76f1a288f 100644 --- a/recipes/tree-sitter-c/all/conandata.yml +++ b/recipes/tree-sitter-c/all/conandata.yml @@ -1,7 +1,25 @@ sources: + "0.23.2": + url: "https://github.com/tree-sitter/tree-sitter-c/archive/refs/tags/v0.23.2.tar.gz" + sha256: "d8b9c1b2ffb6a42caf9bc76e07c52507d4e60b17175ed9beb0e779be8db1200c" + "0.23.1": + url: "https://github.com/tree-sitter/tree-sitter-c/archive/refs/tags/v0.23.1.tar.gz" + sha256: "8f90f481c28a45c7dcba84d05fc07853df043ff813868cdfa074a3835e89467a" + "0.20.7": + url: "https://github.com/tree-sitter/tree-sitter-c/archive/refs/tags/v0.20.7.tar.gz" + sha256: "00abd71259093983fc7e2b51f3efc724ccab3e69af3a37d3cdd0a2a01d703061" + "0.20.3": + url: "https://github.com/tree-sitter/tree-sitter-c/archive/refs/tags/v0.20.3.tar.gz" + sha256: "8c72a765230324f2b64e9ed66e027daf1a2ed24dde5fbf21398ad8ff7fca2a2d" "0.20.2": url: "https://github.com/tree-sitter/tree-sitter-c/archive/v0.20.2.tar.gz" sha256: "af66fde03feb0df4faf03750102a0d265b007e5d957057b6b293c13116a70af2" "0.20.1": url: "https://github.com/tree-sitter/tree-sitter-c/archive/refs/tags/v0.20.1.tar.gz" sha256: "ffcc2ef0eded59ad1acec9aec4f9b0c7dd209fc1a85d85f8b0e81298e3dddcc2" +patches: + "0.23.2": + - patch_file: "patches/0.23.2-0001-disable-gencode-fpic.patch" + patch_description: "disable gencode and fPIC" + patch_type: "portability" + diff --git a/recipes/tree-sitter-c/all/conanfile.py b/recipes/tree-sitter-c/all/conanfile.py index 84ab13ea08213..a31cd6efa959a 100644 --- a/recipes/tree-sitter-c/all/conanfile.py +++ b/recipes/tree-sitter-c/all/conanfile.py @@ -1,33 +1,47 @@ -from conans import CMake, ConanFile, tools -import functools +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import get, replace_in_file, apply_conandata_patches, copy, export_conandata_patches, rmdir + +from conan.tools.scm import Version import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class TreeSitterCConan(ConanFile): name = "tree-sitter-c" description = "C grammar for tree-sitter." - topics = ("parser", "grammar", "tree", "c", "ide") + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/tree-sitter/tree-sitter-c" - license = "MIT" + topics = ("parser", "grammar", "tree", "c", "ide") settings = "os", "arch", "compiler", "build_type" + package_type = "library" + options = { - "fPIC": [True, False], "shared": [True, False], + "fPIC": [True, False], } default_options = { - "fPIC": True, "shared": False, + "fPIC": True, } - generators = "cmake", "cmake_find_package_multi" - exports_sources = "CMakeLists.txt" + def layout(self): + cmake_layout(self, src_folder="src") - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + export_conandata_patches(self) + if Version(self.version) < "0.23.2": + copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=os.path.join(self.export_sources_folder, "src")) + + def generate(self): + tc = CMakeToolchain(self) + if Version(self.version) < "0.23.2": + tc.variables["TREE_SITTER_C_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.generate() + deps = CMakeDeps(self) + deps.generate() def config_options(self): if self.settings.os == "Windows": @@ -35,39 +49,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 - - def requirements(self): - self.requires("tree-sitter/0.20.0") + 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + apply_conandata_patches(self) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.configure() - return cmake + def requirements(self): + self.requires("tree-sitter/0.24.3", transitive_headers=True, transitive_libs=True) def _patch_sources(self): - if not self.options.shared: - tools.replace_in_file( - os.path.join(self._source_subfolder, "src", "parser.c"), + if Version(self.version) < "0.23.2" and not self.options.shared: + replace_in_file( + self, + os.path.join(self.source_folder, "src", "parser.c"), "__declspec(dllexport)", "" ) 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() + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): self.cpp_info.libs = ["tree-sitter-c"] diff --git a/recipes/tree-sitter-c/all/patches/0.23.2-0001-disable-gencode-fpic.patch b/recipes/tree-sitter-c/all/patches/0.23.2-0001-disable-gencode-fpic.patch new file mode 100644 index 0000000000000..db0bbdd64f019 --- /dev/null +++ b/recipes/tree-sitter-c/all/patches/0.23.2-0001-disable-gencode-fpic.patch @@ -0,0 +1,31 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 20754b4..7a2d575 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -14,7 +14,7 @@ if(NOT ${TREE_SITTER_ABI_VERSION} MATCHES "^[0-9]+$") + unset(TREE_SITTER_ABI_VERSION CACHE) + message(FATAL_ERROR "TREE_SITTER_ABI_VERSION must be an integer") + endif() +- ++if(0) + find_program(TREE_SITTER_CLI tree-sitter DOC "Tree-sitter CLI") + + add_custom_command(OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/src/parser.c" +@@ -23,7 +23,7 @@ add_custom_command(OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/src/parser.c" + --abi=${TREE_SITTER_ABI_VERSION} + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + COMMENT "Generating parser.c") +- ++endif() + add_library(tree-sitter-c src/parser.c) + if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/src/scanner.c) + target_sources(tree-sitter-c PRIVATE src/scanner.c) +@@ -37,7 +37,7 @@ target_compile_definitions(tree-sitter-c PRIVATE + set_target_properties(tree-sitter-c + PROPERTIES + C_STANDARD 11 +- POSITION_INDEPENDENT_CODE ON ++ # POSITION_INDEPENDENT_CODE ON + SOVERSION "${TREE_SITTER_ABI_VERSION}.${PROJECT_VERSION_MAJOR}" + DEFINE_SYMBOL "") + diff --git a/recipes/tree-sitter-c/all/test_package/CMakeLists.txt b/recipes/tree-sitter-c/all/test_package/CMakeLists.txt index 48140fe26ab46..a70c3e67c9d21 100644 --- a/recipes/tree-sitter-c/all/test_package/CMakeLists.txt +++ b/recipes/tree-sitter-c/all/test_package/CMakeLists.txt @@ -1,10 +1,10 @@ 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(tree-sitter-c REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} tree-sitter-c::tree-sitter-c) +target_link_libraries(${PROJECT_NAME} PRIVATE tree-sitter-c::tree-sitter-c) +if(tree-sitter-c_VERSION VERSION_LESS "0.23.2") + target_compile_definitions(${PROJECT_NAME} PRIVATE TREE_SITTER_C_API_H) +endif() \ No newline at end of file diff --git a/recipes/tree-sitter-c/all/test_package/conanfile.py b/recipes/tree-sitter-c/all/test_package/conanfile.py index 38f4483872d47..fc47f4cefd612 100644 --- a/recipes/tree-sitter-c/all/test_package/conanfile.py +++ b/recipes/tree-sitter-c/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", "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 +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): + cmd = os.path.join(self.cpp.build.bindir, "test_package") + self.run(cmd, env="conanrun") diff --git a/recipes/tree-sitter-c/all/test_package/test_package.c b/recipes/tree-sitter-c/all/test_package/test_package.c index d5f86eae18cce..cffc87a0869d4 100644 --- a/recipes/tree-sitter-c/all/test_package/test_package.c +++ b/recipes/tree-sitter-c/all/test_package/test_package.c @@ -1,8 +1,14 @@ #include + +#ifdef TREE_SITTER_C_API_H #include +#else +#include +#endif #include #include +#include int main() { TSParser *parser = ts_parser_new(); diff --git a/recipes/tree-sitter-c/config.yml b/recipes/tree-sitter-c/config.yml index 8304408636b4b..54a7df0c98705 100644 --- a/recipes/tree-sitter-c/config.yml +++ b/recipes/tree-sitter-c/config.yml @@ -1,4 +1,12 @@ versions: + "0.23.2": + folder: all + "0.23.1": + folder: all + "0.20.7": + folder: all + "0.20.3": + folder: all "0.20.2": folder: all "0.20.1": diff --git a/recipes/tree-sitter-cql/all/CMakeLists.txt b/recipes/tree-sitter-cql/all/CMakeLists.txt new file mode 100644 index 0000000000000..c382967b7491f --- /dev/null +++ b/recipes/tree-sitter-cql/all/CMakeLists.txt @@ -0,0 +1,29 @@ +cmake_minimum_required(VERSION 3.15) +project(tree-sitter-cql LANGUAGES C) + +find_package(tree-sitter REQUIRED CONFIG) + +add_library(${PROJECT_NAME} + "${CMAKE_CURRENT_SOURCE_DIR}/src/src/parser.c" +) +target_link_libraries(${PROJECT_NAME} + PUBLIC + tree-sitter::tree-sitter +) +target_include_directories(${PROJECT_NAME} + PRIVATE + $ +) +set_target_properties(${PROJECT_NAME} + PROPERTIES + C_STANDARD 99 + PUBLIC_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/src/bindings/c/tree-sitter-cql.h" +) + +include(GNUInstallDirs) +install(TARGETS ${PROJECT_NAME} + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" + PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" +) diff --git a/recipes/tree-sitter-cql/all/conandata.yml b/recipes/tree-sitter-cql/all/conandata.yml new file mode 100644 index 0000000000000..ceb9f8a016e2a --- /dev/null +++ b/recipes/tree-sitter-cql/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.2.0": + url: "https://github.com/shotover/tree-sitter-cql/archive/refs/tags/v0.2.0.tar.gz" + sha256: "fc5aa2c660b6e6daa48e14b4bb7aca0a5a69294229bfae4fdcd9761d288edf07" diff --git a/recipes/tree-sitter-cql/all/conanfile.py b/recipes/tree-sitter-cql/all/conanfile.py new file mode 100644 index 0000000000000..ba45993bad869 --- /dev/null +++ b/recipes/tree-sitter-cql/all/conanfile.py @@ -0,0 +1,72 @@ +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import get, copy +from conan.tools.microsoft import is_msvc +import os + +required_conan_version = ">=2.0.9" + + +class TreeSitterCQLConan(ConanFile): + name = "tree-sitter-cql" + description = "Tree-sitter parser for Cassandra CQL language" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/shotover/tree-sitter-cql" + topics = ("parser", "grammar", "tree", "CQL", "cassandra") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + implements = ["auto_shared_fpic"] + + def export_sources(self): + copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder) + + def configure(self): + if self.options.get_safe("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): + self.requires("tree-sitter/0.24.3", transitive_headers=True, transitive_libs=True) + + def generate(self): + tc = CMakeToolchain(self) + if is_msvc(self): + tc.variables.preprocessor_definitions["TREE_SITTER_HIDE_SYMBOLS"] = not self.options.shared + tc.generate() + deps = CMakeDeps(self) + deps.generate() + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + 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 = ["tree-sitter-cql"] + self.cpp_info.set_property("pkg_config_name", "tree-sitter-cql") diff --git a/recipes/tree-sitter-cql/all/test_package/CMakeLists.txt b/recipes/tree-sitter-cql/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..802cad95e018c --- /dev/null +++ b/recipes/tree-sitter-cql/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) + +find_package(tree-sitter-cql REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE tree-sitter-cql::tree-sitter-cql) diff --git a/recipes/tree-sitter-cql/all/test_package/conanfile.py b/recipes/tree-sitter-cql/all/test_package/conanfile.py new file mode 100644 index 0000000000000..cb81bc4873df8 --- /dev/null +++ b/recipes/tree-sitter-cql/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 = "CMakeToolchain", "CMakeDeps" + + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/tree-sitter-cql/all/test_package/test_package.c b/recipes/tree-sitter-cql/all/test_package/test_package.c new file mode 100644 index 0000000000000..5972b3828b0bb --- /dev/null +++ b/recipes/tree-sitter-cql/all/test_package/test_package.c @@ -0,0 +1,10 @@ +#include +#include + +int main() { + TSParser *parser = ts_parser_new(); + ts_parser_set_language(parser, tree_sitter_cql()); + ts_parser_delete(parser); + return 0; +} + diff --git a/recipes/tree-sitter-cql/config.yml b/recipes/tree-sitter-cql/config.yml new file mode 100644 index 0000000000000..b370fcee5fe7c --- /dev/null +++ b/recipes/tree-sitter-cql/config.yml @@ -0,0 +1,3 @@ +versions: + "0.2.0": + folder: all diff --git a/recipes/tree-sitter-sql/all/CMakeLists.txt b/recipes/tree-sitter-sql/all/CMakeLists.txt new file mode 100644 index 0000000000000..2c51456eb9a4e --- /dev/null +++ b/recipes/tree-sitter-sql/all/CMakeLists.txt @@ -0,0 +1,30 @@ +cmake_minimum_required(VERSION 3.15) +project(tree-sitter-sql LANGUAGES C) + +find_package(tree-sitter REQUIRED CONFIG) + +add_library(${PROJECT_NAME} + ${TREE_SITTER_SQL_SRC_DIR}/src/scanner.c + ${TREE_SITTER_SQL_SRC_DIR}/src/parser.c +) +target_link_libraries(${PROJECT_NAME} + PUBLIC + tree-sitter::tree-sitter +) +target_include_directories(${PROJECT_NAME} + PRIVATE + $ +) +set_target_properties(${PROJECT_NAME} + PROPERTIES + C_STANDARD 99 + PUBLIC_HEADER "${TREE_SITTER_SQL_SRC_DIR}/bindings/c/tree-sitter-sql.h" +) + +include(GNUInstallDirs) +install(TARGETS ${PROJECT_NAME} + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" + PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" +) diff --git a/recipes/tree-sitter-sql/all/conandata.yml b/recipes/tree-sitter-sql/all/conandata.yml new file mode 100644 index 0000000000000..818e7a2ebebb0 --- /dev/null +++ b/recipes/tree-sitter-sql/all/conandata.yml @@ -0,0 +1,15 @@ +sources: + # As per the official README, the release tarballs don't include the generated codes. + # > We don't commit the generated parser files to the main branch. Instead, you can find them on the gh-pages branch. + # We have to obtain the corresponding snapshot of the github-pages branch. + "0.3.7": + url: "https://github.com/DerekStride/tree-sitter-sql/archive/f58f33955ea0a3e6a0aa2ef4b90a133ebee02173.tar.gz" + sha256: "947f6236251b4e2388441f3748871e4a93884229a05b66c59603b80721c2c1fe" + "0.3.5": + url: "https://github.com/DerekStride/tree-sitter-sql/archive/c67ecbd37d8d12f22e4cc7138afd14bc20253e10.tar.gz" + sha256: "d8cd967ca4daa376614995fe8a439a957a303c7ca5b9858ca15ad243e6b176d3" +patches: + "0.3.7": + - patch_file: "patches/0.3.7-0001-fix-cmake.patch" + patch_description: "disable generating code and fPIC" + patch_type: "conan" diff --git a/recipes/tree-sitter-sql/all/conanfile.py b/recipes/tree-sitter-sql/all/conanfile.py new file mode 100644 index 0000000000000..b5038be7e60cf --- /dev/null +++ b/recipes/tree-sitter-sql/all/conanfile.py @@ -0,0 +1,83 @@ +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.53.0" + + +class TreeSitterSqlConan(ConanFile): + name = "tree-sitter-sql" + description = "SQL grammar for tree-sitter" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/DerekStride/tree-sitter-sql" + topics = ("tree-sitter", "sql", "parser") + 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): + if Version(self.version) < "0.3.7": + 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): + if is_msvc(self) and Version(self.version) < "0.3.7": + del self.options.shared + self.package_type = "static-library" + if self.options.get_safe("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): + self.requires("tree-sitter/0.24.3", transitive_headers=True) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + apply_conandata_patches(self) + + def generate(self): + tc = CMakeToolchain(self) + if Version(self.version) < "0.3.7": + tc.variables["TREE_SITTER_SQL_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.generate() + tc = CMakeDeps(self) + tc.generate() + + def build(self): + cmake = CMake(self) + if Version(self.version) < "0.3.7": + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) + else: + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + if Version(self.version) >= "0.3.7": + rmdir(self, os.path.join(self.package_folder, "share")) + + def package_info(self): + self.cpp_info.libs = ["tree-sitter-sql"] + self.cpp_info.set_property("pkg_config_name", "tree-sitter-sql") diff --git a/recipes/tree-sitter-sql/all/patches/0.3.7-0001-fix-cmake.patch b/recipes/tree-sitter-sql/all/patches/0.3.7-0001-fix-cmake.patch new file mode 100644 index 0000000000000..f6c65596a92c4 --- /dev/null +++ b/recipes/tree-sitter-sql/all/patches/0.3.7-0001-fix-cmake.patch @@ -0,0 +1,34 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index faaef1e..c939c26 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -14,7 +14,7 @@ if(NOT ${TREE_SITTER_ABI_VERSION} MATCHES "^[0-9]+$") + unset(TREE_SITTER_ABI_VERSION CACHE) + message(FATAL_ERROR "TREE_SITTER_ABI_VERSION must be an integer") + endif() +- ++if(0) + find_program(TREE_SITTER_CLI tree-sitter DOC "Tree-sitter CLI") + + add_custom_command(OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/src/parser.c" +@@ -23,9 +23,9 @@ add_custom_command(OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/src/parser.c" + --abi=${TREE_SITTER_ABI_VERSION} + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + COMMENT "Generating parser.c") +- ++endif() + add_library(tree-sitter-sql src/parser.c) +-if(EXISTS src/scanner.c) ++if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/src/scanner.c) + target_sources(tree-sitter-sql PRIVATE src/scanner.c) + endif() + target_include_directories(tree-sitter-sql PRIVATE src) +@@ -37,7 +37,7 @@ target_compile_definitions(tree-sitter-sql PRIVATE + set_target_properties(tree-sitter-sql + PROPERTIES + C_STANDARD 11 +- POSITION_INDEPENDENT_CODE ON ++ # POSITION_INDEPENDENT_CODE ON + SOVERSION "${TREE_SITTER_ABI_VERSION}.${PROJECT_VERSION_MAJOR}" + DEFINE_SYMBOL "") + diff --git a/recipes/tree-sitter-sql/all/test_package/CMakeLists.txt b/recipes/tree-sitter-sql/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..2f8015847ed2a --- /dev/null +++ b/recipes/tree-sitter-sql/all/test_package/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) + +find_package(PkgConfig) +pkg_check_modules(TREE_SITTER_SQL IMPORTED_TARGET "tree-sitter-sql") + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE PkgConfig::TREE_SITTER_SQL) +if(TREE_SITTER_SQL_VERSION VERSION_LESS "0.3.7") + target_compile_definitions(${PROJECT_NAME} PRIVATE TREE_SITTER_SQL_OLD_PATH) +endif() + diff --git a/recipes/tree-sitter-sql/all/test_package/conanfile.py b/recipes/tree-sitter-sql/all/test_package/conanfile.py new file mode 100644 index 0000000000000..e8f597c20ddd4 --- /dev/null +++ b/recipes/tree-sitter-sql/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 +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "PkgConfigDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build_requirements(self): + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/[>=2.2 <3]") + + 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/tree-sitter-sql/all/test_package/test_package.c b/recipes/tree-sitter-sql/all/test_package/test_package.c new file mode 100644 index 0000000000000..133b02dd2df77 --- /dev/null +++ b/recipes/tree-sitter-sql/all/test_package/test_package.c @@ -0,0 +1,30 @@ +#include +#include + +#include "tree_sitter/api.h" +#ifdef TREE_SITTER_SQL_OLD_PATH +#include "tree-sitter-sql.h" +#else +#include "tree_sitter/tree-sitter-sql.h" +#endif + +int main() { + TSParser *parser = ts_parser_new(); + ts_parser_set_language(parser, tree_sitter_sql()); + const char *source_code = "select * from dummy_table;\n"; + TSTree *tree = ts_parser_parse_string( + parser, + NULL, + source_code, + strlen(source_code) + ); + TSNode root_node = ts_tree_root_node(tree); + + char *string = ts_node_string(root_node); + printf("Syntax tree: %s\n", string); + free(string); + + ts_tree_delete(tree); + ts_parser_delete(parser); + return 0; +} diff --git a/recipes/tree-sitter-sql/config.yml b/recipes/tree-sitter-sql/config.yml new file mode 100644 index 0000000000000..92762b2a22839 --- /dev/null +++ b/recipes/tree-sitter-sql/config.yml @@ -0,0 +1,5 @@ +versions: + "0.3.7": + folder: all + "0.3.5": + folder: all diff --git a/recipes/tree-sitter/all/CMakeLists.txt b/recipes/tree-sitter/all/CMakeLists.txt index 2d67e95f598b6..25a592da8c101 100644 --- a/recipes/tree-sitter/all/CMakeLists.txt +++ b/recipes/tree-sitter/all/CMakeLists.txt @@ -1,29 +1,31 @@ cmake_minimum_required(VERSION 3.4) -project(tree-sitter C) - -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(tree-sitter LANGUAGES C) # Use cmake script instead of Makefile to support MSVC + follow fPIC option -file(GLOB SOURCES RELATIVE "${PROJECT_SOURCE_DIR}" source_subfolder/lib/src/*.c) -list(REMOVE_ITEM SOURCES source_subfolder/lib/src/lib.c) +file(GLOB SOURCES ${TREE_SITTER_SRC_DIR}/lib/src/*.c) +list(REMOVE_ITEM SOURCES ${TREE_SITTER_SRC_DIR}/lib/src/lib.c) -file(GLOB HEADERS source_subfolder/lib/include/tree_sitter/*.h) +file(GLOB HEADERS ${TREE_SITTER_SRC_DIR}/lib/include/tree_sitter/*.h) add_library(${PROJECT_NAME} ${SOURCES}) target_include_directories(${PROJECT_NAME} PRIVATE - $ - $ + $ + $ ) set_target_properties(${PROJECT_NAME} PROPERTIES - C_STANDARD 99 PUBLIC_HEADER "${HEADERS}" WINDOWS_EXPORT_ALL_SYMBOLS ON ) +if(TREE_SITTER_VERSION VERSION_LESS "0.21.0") + target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) +else() + target_compile_features(${PROJECT_NAME} PRIVATE c_std_11) +endif() + include(GNUInstallDirs) install(TARGETS ${PROJECT_NAME} ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" diff --git a/recipes/tree-sitter/all/conandata.yml b/recipes/tree-sitter/all/conandata.yml index d0e08afc47bc9..0ac2ffd32fc0b 100644 --- a/recipes/tree-sitter/all/conandata.yml +++ b/recipes/tree-sitter/all/conandata.yml @@ -1,10 +1,28 @@ sources: - "0.20.6": - url: "https://github.com/tree-sitter/tree-sitter/archive/v0.20.6.tar.gz" - sha256: "4d37eaef8a402a385998ff9aca3e1043b4a3bba899bceeff27a7178e1165b9de" - "0.20.0": - url: "https://github.com/tree-sitter/tree-sitter/archive/refs/tags/v0.20.0.tar.gz" - sha256: "4a8070b9de17c3b8096181fe8530320ab3e8cca685d8bee6a3e8d164b5fb47da" - "0.17.3": - url: "https://github.com/tree-sitter/tree-sitter/archive/0.17.3.tar.gz" - sha256: "a897e5c9a7ccb74271d9b20d59121d2d2e9de8b896c4d1cfaac0f8104c1ef9f8" + "0.24.4": + url: "https://github.com/tree-sitter/tree-sitter/archive/refs/tags/v0.24.4.tar.gz" + sha256: "d704832a6bfaac8b3cbca3b5d773cad613183ba8c04166638af2c6e5dfb9e2d2" + "0.24.3": + url: "https://github.com/tree-sitter/tree-sitter/archive/refs/tags/v0.24.3.tar.gz" + sha256: "0a8d0cf8e09caba22ed0d8439f7fa1e3d8453800038e43ccad1f34ef29537da1" + "0.23.1": + url: "https://github.com/tree-sitter/tree-sitter/archive/refs/tags/v0.23.1.tar.gz" + sha256: "30ea382bdaea8fc71e3d52850da509398f56d77b7c41e3494da46a1158d37b86" + "0.23.0": + url: "https://github.com/tree-sitter/tree-sitter/archive/refs/tags/v0.23.0.tar.gz" + sha256: "6403b361b0014999e96f61b9c84d6950d42f0c7d6e806be79382e0232e48a11b" + "0.22.6": + url: "https://github.com/tree-sitter/tree-sitter/archive/refs/tags/v0.22.6.tar.gz" + sha256: "e2b687f74358ab6404730b7fb1a1ced7ddb3780202d37595ecd7b20a8f41861f" + "0.22.5": + url: "https://github.com/tree-sitter/tree-sitter/archive/refs/tags/v0.22.5.tar.gz" + sha256: "6bc22ca7e0f81d77773462d922cf40b44bfd090d92abac75cb37dbae516c2417" + "0.22.1": + url: "https://github.com/tree-sitter/tree-sitter/archive/refs/tags/v0.22.1.tar.gz" + sha256: "b21065e78da33e529893c954e712ad15d9ad44a594b74567321d4a3a007d6090" + "0.21.0": + url: "https://github.com/tree-sitter/tree-sitter/archive/refs/tags/v0.21.0.tar.gz" + sha256: "6bb60e5b63c1dc18aba57a9e7b3ea775b4f9ceec44cc35dac4634d26db4eb69c" + "0.20.8": + url: "https://github.com/tree-sitter/tree-sitter/archive/refs/tags/v0.20.8.tar.gz" + sha256: "6181ede0b7470bfca37e293e7d5dc1d16469b9485d13f13a605baec4a8b1f791" diff --git a/recipes/tree-sitter/all/conanfile.py b/recipes/tree-sitter/all/conanfile.py index 0ab58caffc58f..ac605167e9581 100644 --- a/recipes/tree-sitter/all/conanfile.py +++ b/recipes/tree-sitter/all/conanfile.py @@ -1,16 +1,21 @@ -from conans import CMake, ConanFile, tools -import functools +import os -required_conan_version = ">=1.33.0" +from conan import ConanFile +from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout +from conan.tools.files import get, copy, rmdir +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" class TreeSitterConan(ConanFile): name = "tree-sitter" description = "Tree-sitter is a parser generator tool and an incremental parsing library. It can build a concrete syntax tree for a source file and efficiently update the syntax tree as the source file is edited." - topics = ("parser", "incremental", "rust") + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://tree-sitter.github.io/tree-sitter" - license = "MIT" + topics = ("parser", "incremental", "rust") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "fPIC": [True, False], @@ -21,42 +26,58 @@ class TreeSitterConan(ConanFile): "shared": False, } - generators = "cmake" - exports_sources = "CMakeLists.txt" - - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + if Version(self.version) < "0.24.1": + 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 + if Version(self.version) >= "0.24.1": + self.package_type = "static-library" def configure(self): - if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + if Version(self.version) >= "0.24.1" and self.settings.os == "Windows": + self.options.rm_safe("shared") + if self.options.get_safe("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): - 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) + if Version(self.version) < "0.24.1": + tc.variables["TREE_SITTER_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.variables["TREE_SITTER_VERSION"] = str(self.version) + else: + tc.cache_variables["BUILD_SHARED_LIBS"] = self.options.get_safe("shared", False) + tc.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + if Version(self.version) < "0.24.1": + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) + else: + cmake.configure(build_script_folder=os.path.join(self.source_folder, "lib")) 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() + rmdir(self, os.path.join(self.package_folder, "share")) + def package_info(self): - self.cpp_info.names["pkg_config"] = "tree-sitter" self.cpp_info.libs = ["tree-sitter"] diff --git a/recipes/tree-sitter/all/test_package/CMakeLists.txt b/recipes/tree-sitter/all/test_package/CMakeLists.txt index 1f6c3d19b27a6..5946342aa2496 100644 --- a/recipes/tree-sitter/all/test_package/CMakeLists.txt +++ b/recipes/tree-sitter/all/test_package/CMakeLists.txt @@ -1,10 +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) find_package(tree-sitter REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) target_link_libraries(${PROJECT_NAME} tree-sitter::tree-sitter) +if(tree-sitter_VERSION VERSION_LESS "0.21.0") + target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) +else() + target_compile_features(${PROJECT_NAME} PRIVATE c_std_11) +endif() diff --git a/recipes/tree-sitter/all/test_package/conanfile.py b/recipes/tree-sitter/all/test_package/conanfile.py index 38f4483872d47..a8ebbe0c45c36 100644 --- a/recipes/tree-sitter/all/test_package/conanfile.py +++ b/recipes/tree-sitter/all/test_package/conanfile.py @@ -1,17 +1,27 @@ -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", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + +class TestPacakgeConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + 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", "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/tree-sitter/all/test_package/test_package.c b/recipes/tree-sitter/all/test_package/test_package.c index 6ed5f62951a82..08527638921d3 100644 --- a/recipes/tree-sitter/all/test_package/test_package.c +++ b/recipes/tree-sitter/all/test_package/test_package.c @@ -1,8 +1,9 @@ #include -//More detailed example search at https://tree-sitter.github.io/tree-sitter/using-parsers#getting-started +// More detailed example search at +// https://tree-sitter.github.io/tree-sitter/using-parsers#getting-started int main() { - TSParser *parser = ts_parser_new(); - ts_parser_delete(parser); - return 0; + TSParser *parser = ts_parser_new(); + ts_parser_delete(parser); + return 0; } diff --git a/recipes/tree-sitter/config.yml b/recipes/tree-sitter/config.yml index be011f8935f2a..adc6affbd55b4 100644 --- a/recipes/tree-sitter/config.yml +++ b/recipes/tree-sitter/config.yml @@ -1,7 +1,20 @@ versions: - "0.20.6": + "0.24.4": folder: all - "0.20.0": + "0.24.3": folder: all - "0.17.3": + "0.23.1": + folder: all + "0.23.0": + folder: all + "0.22.6": + folder: all + "0.22.5": + folder: all + "0.22.1": + folder: all + "0.21.0": + folder: all + # keep 0.20.8 for tree-sitter-c + "0.20.8": folder: all diff --git a/recipes/troldal-zippy/all/conandata.yml b/recipes/troldal-zippy/all/conandata.yml index 0c73d6b1de095..c40a62c37d987 100644 --- a/recipes/troldal-zippy/all/conandata.yml +++ b/recipes/troldal-zippy/all/conandata.yml @@ -1,8 +1,7 @@ sources: "cci.20200622": url: "https://github.com/troldal/Zippy/archive/a838de8522f9051df0d1b202473bb6befe648702.tar.gz" - sha256: "8be803861b69c51179ade1f2ce62f07fb1f2d301a084d705c8ec2374db22071a" + sha256: "0233303a49bae9f705cb25c44e7f8c9917c49a90c8e314ca79f48dd23dd1a836" patches: "cci.20200622": - patch_file: "patches/zippy-archive-mkdir.patch" - base_path: "source_subfolder" diff --git a/recipes/troldal-zippy/all/conanfile.py b/recipes/troldal-zippy/all/conanfile.py index 9264f7d6a36ec..999217a8ec5a5 100644 --- a/recipes/troldal-zippy/all/conanfile.py +++ b/recipes/troldal-zippy/all/conanfile.py @@ -1,25 +1,27 @@ -from conans import ConanFile, 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.build import check_min_cppstd +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get +from conan.tools.microsoft import check_min_vs, is_msvc +from conan.tools.layout import basic_layout +from conan.tools.scm import Version + +required_conan_version = ">=1.52.0" + class TroldalZippyConan(ConanFile): name = "troldal-zippy" - description = "A simple C++ wrapper around the \"miniz\" zip library " - topics = ("wrapper", "compression", "zip") + description = 'A simple C++ wrapper around the "miniz" zip library ' + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/troldal/Zippy" - license = "MIT" - settings = "compiler" - exports_sources = "patches/*" + topics = ("wrapper", "compression", "zip", "header-only") - @property - def _source_subfolder(self): - return "source_subfolder" - - def requirements(self): - self.requires("miniz/2.2.0") + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True @property def _minimum_cpp_standard(self): @@ -28,40 +30,61 @@ def _minimum_cpp_standard(self): @property def _minimum_compilers_version(self): return { - "Visual Studio": "17", "gcc": "7", "clang": "6", "apple-clang": "10", } + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("miniz/3.0.2") + + 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) - 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)) + check_min_cppstd(self, self._minimum_cpp_standard) + if is_msvc(self): + check_min_vs(self, "192") 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)) + min_version = self._minimum_compilers_version.get(str(self.settings.compiler)) + if not min_version: + self.output.warning(f"{self.name} 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. The current compiler" + f" {self.settings.compiler} {self.settings.compiler.version} does not support it." + ) 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): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - self.copy(pattern="*.hpp", dst="include", src=os.path.join(self._source_subfolder, "library")) - - def package_id(self): - self.info.header_only() + apply_conandata_patches(self) + copy(self, "LICENSE", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder) + copy(self, "*.hpp", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "library")) def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + # To match the target created here - # https://github.com/troldal/Zippy/blob/a838de8522f9051df0d1b202473bb6befe648702/library/CMakeLists.txt#L10 + # https://github.com/troldal/Zippy/blob/a838de8522f9051df0d1b202473bb69befe648702/library/CMakeLists.txt#L10 + self.cpp_info.set_property("cmake_file_name", "Zippy") + self.cpp_info.set_property("cmake_target_name", "Zippy::Zippy") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.filenames["cmake_find_package"] = "Zippy" self.cpp_info.filenames["cmake_find_package_multi"] = "Zippy" self.cpp_info.names["cmake_find_package"] = "Zippy" diff --git a/recipes/troldal-zippy/all/test_package/CMakeLists.txt b/recipes/troldal-zippy/all/test_package/CMakeLists.txt index 6c1d84c7e3d82..90b1ca052dca1 100644 --- a/recipes/troldal-zippy/all/test_package/CMakeLists.txt +++ b/recipes/troldal-zippy/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -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() +find_package(Zippy REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE Zippy::Zippy) set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17) diff --git a/recipes/troldal-zippy/all/test_package/conanfile.py b/recipes/troldal-zippy/all/test_package/conanfile.py index bd7165a553cf4..fae501d0afb9e 100644 --- a/recipes/troldal-zippy/all/test_package/conanfile.py +++ b/recipes/troldal-zippy/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" + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/troldal-zippy/all/test_v1_package/CMakeLists.txt b/recipes/troldal-zippy/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/troldal-zippy/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/troldal-zippy/all/test_v1_package/conanfile.py b/recipes/troldal-zippy/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..7e2dfe859bb27 --- /dev/null +++ b/recipes/troldal-zippy/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/trompeloeil/all/conandata.yml b/recipes/trompeloeil/all/conandata.yml index bb27ac3c59d8a..8fdd3be7c6bf2 100644 --- a/recipes/trompeloeil/all/conandata.yml +++ b/recipes/trompeloeil/all/conandata.yml @@ -1,4 +1,19 @@ sources: + "49": + url: "https://github.com/rollbear/trompeloeil/archive/v49.tar.gz" + sha256: "2523571fb7920b2813cbc23b46e60294aba8ead7eba434bfec69c24408615593" + "48": + url: "https://github.com/rollbear/trompeloeil/archive/v48.tar.gz" + sha256: "eebd18456975251ea3450b815e241cccfefba5b883e4a36bd309f9cf629bdec6" + "47": + url: "https://github.com/rollbear/trompeloeil/archive/v47.tar.gz" + sha256: "4a1d79260c1e49e065efe0817c8b9646098ba27eed1802b0c3ba7d959e4e5e84" + "46": + url: "https://github.com/rollbear/trompeloeil/archive/v46.tar.gz" + sha256: "dc2c856ab7716ef659f8df7fc5f6740a40e736089f05e0a8251d4ad3ad17ad83" + "45": + url: "https://github.com/rollbear/trompeloeil/archive/v45.tar.gz" + sha256: "124b0aa45d84415193719376b6557fc1f1180cbfebf4dc4f7ca247cb404d6bd8" "43": url: "https://github.com/rollbear/trompeloeil/archive/v43.tar.gz" sha256: "86a0afa2e97347202a0a883ab43da78c1d4bfff0d6cb93205cfc433d0d9eb9eb" @@ -12,5 +27,5 @@ sources: url: "https://github.com/rollbear/trompeloeil/archive/v40.tar.gz" sha256: "e13e3649223a358a5a72fa5a8a1c36325b48e4f3d9d2f2277b17d746797e1734" "39": - url: https://github.com/rollbear/trompeloeil/archive/v39.tar.gz - sha256: 10506E48ABD605740BC9ED43E34059F5068BC80AF14476BD129A3ED3B54D522F + url: "https://github.com/rollbear/trompeloeil/archive/v39.tar.gz" + sha256: "10506E48ABD605740BC9ED43E34059F5068BC80AF14476BD129A3ED3B54D522F" diff --git a/recipes/trompeloeil/all/conanfile.py b/recipes/trompeloeil/all/conanfile.py index c2548bfe997b8..e3776238f24cf 100644 --- a/recipes/trompeloeil/all/conanfile.py +++ b/recipes/trompeloeil/all/conanfile.py @@ -1,22 +1,38 @@ 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 TrompeloeilConan(ConanFile): name = "trompeloeil" description = "Header only C++14 mocking framework" - topics = ("trompeloeil", "header-only", "mocking") - homepage = "https://github.com/rollbear/trompeloeil" - url = "https://github.com/conan-io/conan-center-index" license = "BSL-1.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/rollbear/trompeloeil" + topics = ("header-only", "mocking") + package_type = "header-library" 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": "190", + "gcc": "5", + "clang": "5", + "apple-clang": "5.1", + } + def layout(self): basic_layout(self, src_folder="src") @@ -25,14 +41,15 @@ def package_id(self): def validate(self): if self.settings.compiler.get_safe("cppstd"): - 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 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 + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): copy(self, "LICENSE*.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) @@ -43,4 +60,3 @@ def package_info(self): 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/test_package.cpp b/recipes/trompeloeil/all/test_package/test_package.cpp index 356b535560158..2d62e62471f0e 100644 --- a/recipes/trompeloeil/all/test_package/test_package.cpp +++ b/recipes/trompeloeil/all/test_package/test_package.cpp @@ -1,3 +1,4 @@ +#include #include struct S diff --git a/recipes/trompeloeil/config.yml b/recipes/trompeloeil/config.yml index 26645b05ba8da..39c766357c1eb 100644 --- a/recipes/trompeloeil/config.yml +++ b/recipes/trompeloeil/config.yml @@ -1,4 +1,14 @@ versions: + "49": + folder: all + "48": + folder: all + "47": + folder: all + "46": + folder: all + "45": + folder: all "43": folder: all "42": diff --git a/recipes/tscns/all/conanfile.py b/recipes/tscns/all/conanfile.py index f9a1b573dbe33..c1b715cc27747 100644 --- a/recipes/tscns/all/conanfile.py +++ b/recipes/tscns/all/conanfile.py @@ -1,13 +1,14 @@ +import os + 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.files import apply_conandata_patches, copy, export_conandata_patches, get 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" @@ -15,6 +16,7 @@ class TscnsConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/MengRao/tscns/" topics = ("timestamp", "x86_64", "header-only") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" @property @@ -37,7 +39,7 @@ def validate(self): 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def build(self): apply_conandata_patches(self) diff --git a/recipes/tscns/all/test_v1_package/CMakeLists.txt b/recipes/tscns/all/test_v1_package/CMakeLists.txt index eebfbab4ba7b5..0d20897301b68 100644 --- a/recipes/tscns/all/test_v1_package/CMakeLists.txt +++ b/recipes/tscns/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(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) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/tsil/all/conandata.yml b/recipes/tsil/all/conandata.yml index f95fe9a099612..3281d0221c878 100644 --- a/recipes/tsil/all/conandata.yml +++ b/recipes/tsil/all/conandata.yml @@ -1,7 +1,6 @@ sources: "1.45": - url: [ - "http://www.niu.edu/spmartin/TSIL/tsil-1.45.tar.gz", - "http://faculty.otterbein.edu/DRobertson/tsil/tsil-1.45.tar.gz" - ] + url: + - "http://www.niu.edu/spmartin/TSIL/tsil-1.45.tar.gz" + - "http://faculty.otterbein.edu/DRobertson/tsil/tsil-1.45.tar.gz" sha256: "420e389af9a77edcc373b88893bf13c9dddfea1d760219dc9a932f28ea0d5d24" diff --git a/recipes/tsil/all/conanfile.py b/recipes/tsil/all/conanfile.py index 81d982b72282a..049388ce41611 100644 --- a/recipes/tsil/all/conanfile.py +++ b/recipes/tsil/all/conanfile.py @@ -5,7 +5,7 @@ from conan.tools.microsoft import is_msvc import os -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.53.0" class TsilConan(ConanFile): @@ -16,6 +16,7 @@ class TsilConan(ConanFile): description = "Two-loop Self-energy Integral Library" topics = ("high-energy", "physics", "hep", "two-loop", "integrals") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -40,18 +41,9 @@ def config_options(self): 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 + 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") @@ -88,5 +80,4 @@ def package_info(self): # 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) diff --git a/recipes/tsl-array-hash/all/conanfile.py b/recipes/tsl-array-hash/all/conanfile.py index 8c6297fe62672..4e37fe94c1699 100644 --- a/recipes/tsl-array-hash/all/conanfile.py +++ b/recipes/tsl-array-hash/all/conanfile.py @@ -14,6 +14,7 @@ class TslArrayHashConan(ConanFile): topics = ("string", "structure", "hash map", "hash set") homepage = "https://github.com/Tessil/array-hash" url = "https://github.com/conan-io/conan-center-index" + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -28,8 +29,7 @@ def validate(self): 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 build(self): pass @@ -43,7 +43,6 @@ def package_info(self): 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" @@ -55,4 +54,3 @@ def package_info(self): 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_v1_package/CMakeLists.txt b/recipes/tsl-array-hash/all/test_v1_package/CMakeLists.txt index 15d716d7a9505..0d20897301b68 100644 --- a/recipes/tsl-array-hash/all/test_v1_package/CMakeLists.txt +++ b/recipes/tsl-array-hash/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(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) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/tsl-hat-trie/all/conanfile.py b/recipes/tsl-hat-trie/all/conanfile.py index fbce5d32f1f2b..0c2749d1da56d 100644 --- a/recipes/tsl-hat-trie/all/conanfile.py +++ b/recipes/tsl-hat-trie/all/conanfile.py @@ -14,7 +14,7 @@ class TslHatTrieConan(ConanFile): topics = ("string", "trie", "structure", "hash map", "hash set") homepage = "https://github.com/Tessil/hat-trie" url = "https://github.com/conan-io/conan-center-index" - + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" def layout(self): @@ -31,8 +31,7 @@ def validate(self): 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 build(self): rmdir(self, os.path.join(self.source_folder, "include", "tsl", "array-hash")) @@ -48,7 +47,6 @@ def package_info(self): 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" @@ -61,4 +59,3 @@ def package_info(self): 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_v1_package/CMakeLists.txt b/recipes/tsl-hat-trie/all/test_v1_package/CMakeLists.txt index 6a1b5a8c7df69..0d20897301b68 100644 --- a/recipes/tsl-hat-trie/all/test_v1_package/CMakeLists.txt +++ b/recipes/tsl-hat-trie/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(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) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/tsl-hopscotch-map/all/conandata.yml b/recipes/tsl-hopscotch-map/all/conandata.yml index 6166a7c7730e6..191b340d98e5d 100644 --- a/recipes/tsl-hopscotch-map/all/conandata.yml +++ b/recipes/tsl-hopscotch-map/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.3.1": + url: "https://github.com/Tessil/hopscotch-map/archive/v2.3.1.tar.gz" + sha256: "53dab49005cd5dc859f2546d0d3eef058ec7fb3b74fc3b19f4965a9a151e9b20" "2.3.0": url: "https://github.com/Tessil/hopscotch-map/archive/v2.3.0.tar.gz" sha256: "a59d65b552dc7682521989842418c92257147f5068152b5af50e917892ad9317" diff --git a/recipes/tsl-hopscotch-map/all/conanfile.py b/recipes/tsl-hopscotch-map/all/conanfile.py index 6772f3c321bc9..cb1372f74dd49 100644 --- a/recipes/tsl-hopscotch-map/all/conanfile.py +++ b/recipes/tsl-hopscotch-map/all/conanfile.py @@ -11,9 +11,10 @@ class TslHopscotchMapConan(ConanFile): name = "tsl-hopscotch-map" license = "MIT" description = "C++ implementation of a fast hash map and hash set using hopscotch hashing" - topics = ("structure", "hash map", "hash set") - homepage = "https://github.com/Tessil/hopscotch-map" + topics = ("structure", "hash map", "hash set", "header-only") url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/Tessil/hopscotch-map" + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -28,8 +29,7 @@ def validate(self): 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 build(self): pass @@ -43,7 +43,6 @@ def package_info(self): 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" @@ -55,4 +54,3 @@ def package_info(self): 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/config.yml b/recipes/tsl-hopscotch-map/config.yml index d724287fc23cb..7e1b2aadac1de 100644 --- a/recipes/tsl-hopscotch-map/config.yml +++ b/recipes/tsl-hopscotch-map/config.yml @@ -1,3 +1,5 @@ versions: + "2.3.1": + folder: all "2.3.0": folder: all 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 d13b78edda147..9883b71a12ac3 100644 --- a/recipes/tsl-ordered-map/all/conanfile.py +++ b/recipes/tsl-ordered-map/all/conanfile.py @@ -14,6 +14,7 @@ class TslOrderedMapConan(ConanFile): topics = ("ordered-map", "structure", "hash map", "hash set") homepage = "https://github.com/Tessil/ordered-map" url = "https://github.com/conan-io/conan-center-index" + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -28,8 +29,7 @@ def validate(self): 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 build(self): pass @@ -43,7 +43,6 @@ def package_info(self): 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" @@ -55,4 +54,3 @@ def package_info(self): 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_v1_package/CMakeLists.txt b/recipes/tsl-ordered-map/all/test_v1_package/CMakeLists.txt index 843a031b132e4..be00a8c7f57c7 100644 --- a/recipes/tsl-ordered-map/all/test_v1_package/CMakeLists.txt +++ b/recipes/tsl-ordered-map/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(tsl-ordered-map REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE tsl::ordered_map) -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/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..184cd30d5f022 100644 --- a/recipes/tsl-robin-map/all/conandata.yml +++ b/recipes/tsl-robin-map/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "1.3.0": + url: "https://github.com/Tessil/robin-map/archive/v1.3.0.tar.gz" + sha256: "a8424ad3b0affd4c57ed26f0f3d8a29604f0e1f2ef2089f497f614b1c94c7236" + "1.2.2": + url: "https://github.com/Tessil/robin-map/archive/v1.2.2.tar.gz" + sha256: "c72767ecea2a90074c7efbe91620c8f955af666505e22782e82813c652710821" + "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 60cfac70c1a0d..d6ee665d5c051 100644 --- a/recipes/tsl-robin-map/all/conanfile.py +++ b/recipes/tsl-robin-map/all/conanfile.py @@ -11,9 +11,10 @@ class TslRobinMapConan(ConanFile): name = "tsl-robin-map" license = "MIT" description = "C++ implementation of a fast hash map and hash set using robin hood hashing." - topics = ("robin-map", "structure", "hash map", "hash set") - homepage = "https://github.com/Tessil/robin-map" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/Tessil/robin-map" + topics = ("robin-map", "structure", "hash map", "hash set", "header-only") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -28,8 +29,7 @@ def validate(self): 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 build(self): pass @@ -43,7 +43,6 @@ def package_info(self): 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" @@ -55,4 +54,3 @@ def package_info(self): 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_v1_package/CMakeLists.txt b/recipes/tsl-robin-map/all/test_v1_package/CMakeLists.txt index 1fde03f4de7cd..be00a8c7f57c7 100644 --- a/recipes/tsl-robin-map/all/test_v1_package/CMakeLists.txt +++ b/recipes/tsl-robin-map/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(tsl-robin-map REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE tsl::robin_map) -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/tsl-robin-map/config.yml b/recipes/tsl-robin-map/config.yml index bfce952bf842d..05411da627de4 100644 --- a/recipes/tsl-robin-map/config.yml +++ b/recipes/tsl-robin-map/config.yml @@ -1,4 +1,10 @@ versions: + "1.3.0": + folder: all + "1.2.2": + folder: all + "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 4168882cba1a3..9afa37e182a6b 100644 --- a/recipes/tsl-sparse-map/all/conanfile.py +++ b/recipes/tsl-sparse-map/all/conanfile.py @@ -14,6 +14,7 @@ class TslSparseMapConan(ConanFile): topics = ("sparse-map", "structure", "hash map", "hash set") homepage = "https://github.com/Tessil/sparse-map" url = "https://github.com/conan-io/conan-center-index" + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -28,8 +29,7 @@ def validate(self): 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 build(self): pass @@ -43,7 +43,6 @@ def package_info(self): 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" @@ -55,4 +54,3 @@ def package_info(self): 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_v1_package/CMakeLists.txt b/recipes/tsl-sparse-map/all/test_v1_package/CMakeLists.txt index 3e681dedd0cd4..0d20897301b68 100644 --- a/recipes/tsl-sparse-map/all/test_v1_package/CMakeLists.txt +++ b/recipes/tsl-sparse-map/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(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) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/tuplet/all/conandata.yml b/recipes/tuplet/all/conandata.yml index a2444a74ca194..defd879c8e383 100644 --- a/recipes/tuplet/all/conandata.yml +++ b/recipes/tuplet/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "2.1.1": + url: "https://github.com/codeinred/tuplet/archive/v2.1.1.tar.gz" + sha256: "2df403ffeed38a9687a3f2a7d2a68419ba029f519244e9bcd30caa0e8ec2ead3" + "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" diff --git a/recipes/tuplet/all/conanfile.py b/recipes/tuplet/all/conanfile.py index 4e591fd1ac8d1..b8e4521ac3319 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" @@ -15,23 +16,35 @@ class TupletConan(ConanFile): homepage = "https://github.com/codeinred/tuplet" description = "A fast, simple tuple implementation that implements tuple as an aggregate" topics = ("tuple", "trivially-copyable", "modern-cpp") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @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 layout(self): + basic_layout(self, src_folder="src") + def package_id(self): self.info.clear() @@ -51,14 +64,10 @@ 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") - - def layout(self): - basic_layout(self, src_folder="src") + f"{self.ref} requires C++{self._min_cppstd} which your compiler ({compiler}-{version}) 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 build(self): pass diff --git a/recipes/tuplet/config.yml b/recipes/tuplet/config.yml index 9e6e28e463759..56682d1116e02 100644 --- a/recipes/tuplet/config.yml +++ b/recipes/tuplet/config.yml @@ -1,4 +1,8 @@ versions: + "2.1.1": + folder: all + "2.1.0": + folder: all "2.0.0": folder: all "1.2.2": diff --git a/recipes/turtle/all/conandata.yml b/recipes/turtle/all/conandata.yml index 1b973e23b0f99..3460796e19388 100644 --- a/recipes/turtle/all/conandata.yml +++ b/recipes/turtle/all/conandata.yml @@ -1,7 +1,10 @@ sources: - "1.3.1": - url: "https://github.com/mat007/turtle/archive/v1.3.1.tar.gz" - sha256: "1ea10600a4046286a781c898ed3110d48fdab473f5320dc48cc2775353039b8b" + "2.0.0": + url: "https://github.com/mat007/turtle/archive/v2.0.0.tar.gz" + sha256: "636a552fc442d452955eca1f554e6a962b38270c1a6290538c6405da59b49e45" "1.3.2": url: "https://github.com/mat007/turtle/archive/v1.3.2.tar.gz" sha256: "4dc0bd79ddecd337691d5805ecb25f427bd85d9549f44d06cd3a6b7f0f0235d4" + "1.3.1": + url: "https://github.com/mat007/turtle/archive/v1.3.1.tar.gz" + sha256: "1ea10600a4046286a781c898ed3110d48fdab473f5320dc48cc2775353039b8b" diff --git a/recipes/turtle/all/conanfile.py b/recipes/turtle/all/conanfile.py index 9e4b9153b69bc..6b80db4af4ab7 100644 --- a/recipes/turtle/all/conanfile.py +++ b/recipes/turtle/all/conanfile.py @@ -1,30 +1,66 @@ -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 import os +required_conan_version = ">=1.53.0" class TurtleConan(ConanFile): name = "turtle" description = "Turtle is a C++ mock object library based on Boost with a focus on usability, simplicity and flexibility." - topics = ("conan", "turtule", "mock", "test", "boost") + license = "BSL-1.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/mat007/turtle" - license = "BSL-1.0" + topics = ("mock", "test", "boost", "header-only") + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 14 + + @property + def _compilers_minimum_version(self): + return { + "apple-clang": "10", + "clang": "7", + "gcc": "7", + "msvc": "191", + "Visual Studio": "15", + } + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - self.requires("boost/1.73.0") + self.requires("boost/1.81.0") def package_id(self): - self.info.header_only() + self.info.clear() + + def validate(self): + if Version(self.version) < "2.0.0": + return + + 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]) - os.rename(self.name + "-" + self.version, self._source_subfolder) + 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("*.hpp", dst="include", src=os.path.join(self._source_subfolder, "include")) + copy(self, "LICENSE_1_0.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + 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.libdirs = [] + self.cpp_info.bindirs = [] diff --git a/recipes/turtle/all/test_package/CMakeLists.txt b/recipes/turtle/all/test_package/CMakeLists.txt index 232bbd2abd280..17dd4096afba2 100644 --- a/recipes/turtle/all/test_package/CMakeLists.txt +++ b/recipes/turtle/all/test_package/CMakeLists.txt @@ -1,10 +1,10 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - find_package(turtle REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} turtle::turtle) +if(turtle_VERSION VERSION_GREATER_EQUAL "2.0.0") + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) +endif() diff --git a/recipes/turtle/all/test_package/conanfile.py b/recipes/turtle/all/test_package/conanfile.py index 7e2dfe859bb27..f13196f305151 100644 --- a/recipes/turtle/all/test_package/conanfile.py +++ b/recipes/turtle/all/test_package/conanfile.py @@ -1,10 +1,17 @@ -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" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +19,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/turtle/config.yml b/recipes/turtle/config.yml index 266cd9ad48136..5a4bc86b61751 100644 --- a/recipes/turtle/config.yml +++ b/recipes/turtle/config.yml @@ -1,5 +1,7 @@ versions: - "1.3.1": + "2.0.0": folder: all "1.3.2": folder: all + "1.3.1": + folder: all diff --git a/recipes/tweenerspp/all/conandata.yml b/recipes/tweenerspp/all/conandata.yml new file mode 100644 index 0000000000000..1e9cad7f97a08 --- /dev/null +++ b/recipes/tweenerspp/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.1": + url: "https://github.com/j-jorge/tweenerspp/archive/refs/tags/v1.1.tar.gz" + sha256: "b3c111b05c5e480993238ed794cc524521bb2d4889e59c49a99b714fff566623" diff --git a/recipes/tweenerspp/all/conanfile.py b/recipes/tweenerspp/all/conanfile.py new file mode 100644 index 0000000000000..b4a432e3792d6 --- /dev/null +++ b/recipes/tweenerspp/all/conanfile.py @@ -0,0 +1,60 @@ +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.microsoft import is_msvc +import os + +required_conan_version = ">=1.52.0" + +class TweenersppConan(ConanFile): + name = "tweenerspp" + description = "Yet another C++ tweeners library" + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/j-jorge/tweenerspp" + topics = ("tweener", "header-only") + package_type = "header-library" + 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, "LICENSE", 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"), + ) + copy( + self, + "*.tpp", + os.path.join(self.source_folder, "include"), + os.path.join(self.package_folder, "include"), + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + if is_msvc(self): + self.cpp_info.defines = ["_USE_MATH_DEFINES"] + self.cpp_info.set_property("cmake_file_name", "tweeners") + self.cpp_info.set_property("cmake_target_name", "tweeners::tweeners") + self.cpp_info.set_property("cmake_target_aliases", ["tweeners"]) diff --git a/recipes/tweenerspp/all/test_package/CMakeLists.txt b/recipes/tweenerspp/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..7f72f56d7679a --- /dev/null +++ b/recipes/tweenerspp/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(tweeners REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE tweeners::tweeners) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/tweenerspp/all/test_package/conanfile.py b/recipes/tweenerspp/all/test_package/conanfile.py new file mode 100644 index 0000000000000..e730ad6dc0dfc --- /dev/null +++ b/recipes/tweenerspp/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 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/tweenerspp/all/test_package/test_package.cpp b/recipes/tweenerspp/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..ccc39ffab8d02 --- /dev/null +++ b/recipes/tweenerspp/all/test_package/test_package.cpp @@ -0,0 +1,27 @@ +#include + +#include +#include +#include + +auto main([[maybe_unused]] int argc, [[maybe_unused]] char* argv[]) -> int { + std::cout << std::boolalpha; + std::cin.tie(nullptr); + std::ios_base::sync_with_stdio(false); + + constexpr auto from = 0; + constexpr auto to = 100; + constexpr auto duration = 10.f; + + auto system = tweeners::system {}; + + auto x = 0; + tweeners::builder().range_transform(from, to, duration, x, tweeners::easing::sine<>).build(system); + + for (auto i = 0; i != 10; ++i) { + system.update(1.0f); + std::cout << i << "->" << x << std::endl; + } + + return 0; +} diff --git a/recipes/tweenerspp/config.yml b/recipes/tweenerspp/config.yml new file mode 100644 index 0000000000000..3f8a45fae5832 --- /dev/null +++ b/recipes/tweenerspp/config.yml @@ -0,0 +1,3 @@ +versions: + "1.1": + folder: all diff --git a/recipes/tweetnacl/all/CMakeLists.txt b/recipes/tweetnacl/all/CMakeLists.txt index 971f0647720b1..b90e7d4a682db 100644 --- a/recipes/tweetnacl/all/CMakeLists.txt +++ b/recipes/tweetnacl/all/CMakeLists.txt @@ -1,17 +1,10 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.12) project(tweetnacl C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - -include(GNUInstallDirs) - add_library(tweetnacl tweetnacl.c) set_target_properties(tweetnacl PROPERTIES PUBLIC_HEADER "tweetnacl.h") +include(GNUInstallDirs) install(TARGETS tweetnacl - ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" - LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" - RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" ) diff --git a/recipes/tweetnacl/all/conandata.yml b/recipes/tweetnacl/all/conandata.yml index 3dcc47bfef437..a3fbddf32a913 100644 --- a/recipes/tweetnacl/all/conandata.yml +++ b/recipes/tweetnacl/all/conandata.yml @@ -1,8 +1,6 @@ sources: "20140427": - url: https://tweetnacl.cr.yp.to/20140427/tweetnacl.c - sha256: 02e65bc3013ff2168983365e55906bc783c4c7e0a60d8100f17bb303a17175c4 + sha256: "02e65bc3013ff2168983365e55906bc783c4c7e0a60d8100f17bb303a17175c4" - url: https://tweetnacl.cr.yp.to/20140427/tweetnacl.h - sha256: 43f29ad721d9927b747b0100ab4160c119e7bb180c7c98a66e4bf79d31244287 - - url: https://unlicense.org/UNLICENSE - sha256: 7e12e5df4bae12cb21581ba157ced20e1986a0508dd10d0e8a4ab9a4cf94e85c + sha256: "43f29ad721d9927b747b0100ab4160c119e7bb180c7c98a66e4bf79d31244287" diff --git a/recipes/tweetnacl/all/conanfile.py b/recipes/tweetnacl/all/conanfile.py index b5b3d196ced3e..0c97672dae4cc 100644 --- a/recipes/tweetnacl/all/conanfile.py +++ b/recipes/tweetnacl/all/conanfile.py @@ -1,19 +1,24 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration import os -required_conan_version = ">=1.32.0" +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, download, save + +required_conan_version = ">=1.53.0" class TweetnaclConan(ConanFile): name = "tweetnacl" - license = "Unlicense" - homepage = "https://tweetnacl.cr.yp.to" - url = "https://github.com/conan-io/conan-center-index" description = "TweetNaCl is the world's first auditable high-security cryptographic library" - topics = ("nacl", "tweetnacl", "encryption", "signature", "hashing") - exports_sources = "CMakeLists.txt" - generators = "cmake" + license = "Public domain" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://tweetnacl.cr.yp.to" + topics = ("nacl", "encryption", "signature", "hashing") + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -22,44 +27,53 @@ class TweetnaclConan(ConanFile): "shared": False, "fPIC": True, } - settings = "os", "compiler", "build_type", "arch" - _cmake = None + def export_sources(self): + copy(self, "CMakeLists.txt", + src=self.recipe_folder, + dst=os.path.join(self.export_sources_folder, "src")) 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 + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") 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 in ("Windows", "Macos"): + if self.settings.os == "Windows" or is_apple_os(self): if self.options.shared: - raise ConanInvalidConfiguration("tweetnacl does not support shared on Windows and Madcos: it needs a randombytes implementation") + raise ConanInvalidConfiguration( + "tweetnacl does not support shared on Windows and Macos: it needs a randombytes implementation" + ) def source(self): for url_sha in self.conan_data["sources"][self.version]: - tools.download(url_sha["url"], os.path.basename(url_sha["url"])) - tools.check_sha256(os.path.basename(url_sha["url"]), url_sha["sha256"]) + download(self, **url_sha, filename=os.path.basename(url_sha["url"])) + + 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() - return self._cmake + tc = CMakeDeps(self) + tc.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("UNLICENSE", dst=os.path.join(self.package_folder, "licenses")) - cmake = self._configure_cmake() + save(self, + os.path.join(self.package_folder, "licenses", "LICENSE"), + "TweetNaCl is a self-contained public-domain C library.") + cmake = CMake(self) cmake.install() def package_info(self): diff --git a/recipes/tweetnacl/all/test_package/CMakeLists.txt b/recipes/tweetnacl/all/test_package/CMakeLists.txt index 7b9b613cbb24a..ff98951f060d9 100644 --- a/recipes/tweetnacl/all/test_package/CMakeLists.txt +++ b/recipes/tweetnacl/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ -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() +find_package(tweetnacl REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE tweetnacl::tweetnacl) diff --git a/recipes/tweetnacl/all/test_package/conanfile.py b/recipes/tweetnacl/all/test_package/conanfile.py index bd7165a553cf4..ef5d7042163ec 100644 --- a/recipes/tweetnacl/all/test_package/conanfile.py +++ b/recipes/tweetnacl/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/tweetnacl/all/test_v1_package/CMakeLists.txt b/recipes/tweetnacl/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/tweetnacl/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/tweetnacl/all/test_v1_package/conanfile.py b/recipes/tweetnacl/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..7e2dfe859bb27 --- /dev/null +++ b/recipes/tweetnacl/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/twitch-native-ipc/all/CMakeLists.txt b/recipes/twitch-native-ipc/all/CMakeLists.txt deleted file mode 100644 index 3f96a3374441c..0000000000000 --- a/recipes/twitch-native-ipc/all/CMakeLists.txt +++ /dev/null @@ -1,6 +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/twitch-native-ipc/all/conandata.yml b/recipes/twitch-native-ipc/all/conandata.yml index 4ddda5e545311..0ca341563c80b 100644 --- a/recipes/twitch-native-ipc/all/conandata.yml +++ b/recipes/twitch-native-ipc/all/conandata.yml @@ -5,8 +5,5 @@ sources: patches: "3.1.1": - patch_file: "patches/cmake-fixes.patch" - base_path: "source_subfolder" - patch_file: "patches/linux-build-fixes.patch" - base_path: "source_subfolder" - patch_file: "patches/export-fixes.patch" - base_path: "source_subfolder" diff --git a/recipes/twitch-native-ipc/all/conanfile.py b/recipes/twitch-native-ipc/all/conanfile.py index 9e025ba63f993..3f478da041a70 100644 --- a/recipes/twitch-native-ipc/all/conanfile.py +++ b/recipes/twitch-native-ipc/all/conanfile.py @@ -1,31 +1,38 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -from conans.tools import Version import os +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +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, export_conandata_patches, get, rm +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" + + class TwitchNativeIpcConan(ConanFile): name = "twitch-native-ipc" + description = "Twitch native IPC library" license = "MIT" - homepage = "https://github.com/twitchtv/twitch-native-ipc" url = "https://github.com/conan-io/conan-center-index" - description = "Twitch natve ipc library" + homepage = "https://github.com/twitchtv/twitch-native-ipc" topics = ("twitch", "ipc") - settings = "os", "compiler", "build_type", "arch" - options = {"shared": [True, False], "fPIC": [True, False]} - default_options = {"shared": False, "fPIC": True} - generators = "cmake" - exports = ["CMakeLists.txt", "patches/**"] - requires = "libuv/1.40.0" - - _cmake = None - @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 _build_subfolder(self): - return "build_subfolder" + def _min_cppstd(self): + return "17" @property def _compilers_min_version(self): @@ -33,63 +40,69 @@ def _compilers_min_version(self): "gcc": "8", "clang": "8", "apple-clang": "10", + "msvc": "191", "Visual Studio": "15", } + 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, 17) - - min_version = self._compilers_min_version.get(str(self.settings.compiler), False) - if min_version: - if tools.Version(self.settings.compiler.version) < min_version: - raise ConanInvalidConfiguration("twitch-native-ipc requires C++17") - else: - self.output.warn("unknown compiler, assuming C++17 support") - if self.options.shared: - del self.options.fPIC + 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 _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["ENABLE_CODE_FORMATTING"] = False - self._cmake.definitions["BUILD_TESTING"] = False + def requirements(self): + self.requires("libuv/1.46.0") - if self.settings.os == "Windows": - self._cmake.definitions["MSVC_DYNAMIC_RUNTIME"] = self.settings.compiler.runtime in ("MD", "MDd") + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + + minimum_version = self._compilers_min_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." + ) - 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): + tc = CMakeToolchain(self) + tc.variables["ENABLE_CODE_FORMATTING"] = False + tc.variables["BUILD_TESTING"] = False + if is_msvc(self): + tc.variables["MSVC_DYNAMIC_RUNTIME"] = not is_msvc_static_runtime(self) + 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 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.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.pdb") + rm(self, "*.pdb", os.path.join(self.package_folder, "lib"), recursive=True) def package_info(self): self.cpp_info.libs = ["nativeipc"] if self.settings.os == "Windows" and self.options.shared: self.cpp_info.defines = ["NATIVEIPC_IMPORT"] - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["m"] - if tools.stdcpp_library(self): - self.cpp_info.system_libs.append(tools.stdcpp_library(self)) + if stdcpp_library(self): + self.cpp_info.system_libs.append(stdcpp_library(self)) diff --git a/recipes/twitch-native-ipc/all/patches/cmake-fixes.patch b/recipes/twitch-native-ipc/all/patches/cmake-fixes.patch index e9ef8141281a0..0b516bd88e539 100644 --- a/recipes/twitch-native-ipc/all/patches/cmake-fixes.patch +++ b/recipes/twitch-native-ipc/all/patches/cmake-fixes.patch @@ -9,26 +9,30 @@ index 491ae46..c0a4f3d 100644 include(setup) project(nativeipc) -diff --git a/cmakeUtils/conanutils.cmake b/cmakeUtils/conanutils.cmake -index cc6c07c..cbf0cd6 100644 ---- a/cmakeUtils/conanutils.cmake -+++ b/cmakeUtils/conanutils.cmake -@@ -59,7 +59,8 @@ macro(run_conan) - set(_keeprpath "KEEP_RPATHS") - endif() - -- conan_cmake_run(CONANFILE conan/conanfile.py -+ if(NOT CONAN_EXPORTED) -+ conan_cmake_run(CONANFILE conan/conanfile.py - BASIC_SETUP - CMAKE_TARGETS - NO_OUTPUT_DIRS -@@ -71,4 +72,5 @@ macro(run_conan) - RELWITHDEBINFO_PROFILE ${_profile} - ENV "CONAN_CMAKE_BINARY_DIR_PATH=${CMAKE_BINARY_DIR}" - ) -+ endif() - endmacro() +diff --git a/cmakeUtils/setup.cmake b/cmakeUtils/setup.cmake +--- cmakeUtils/setup.cmake ++++ cmakeUtils/setup.cmake +@@ -1,6 +1,4 @@ + include(utilities) +-include(conan) +-include(conanutils) + + macro(setup_project) + if(NOT CMAKE_BUILD_TYPE) +@@ -13,13 +11,9 @@ + option(ENABLE_CODE_DOCUMENTATION "enable code documenation generation" OFF) + option(MSVC_DYNAMIC_RUNTIME "change default runtime" ON) + +- conan_check(VERSION 1.22.2 REQUIRED) +- + setup_default_cxx_compile_options() + + set_output_directories(${CMAKE_BINARY_DIR}/bin) +- +- run_conan() + + include(CTest) + if(BUILD_TESTING) diff --git a/cmakeUtils/unix.cmake b/cmakeUtils/unix.cmake index 5f4bb4c..9b2856a 100644 --- a/cmakeUtils/unix.cmake @@ -46,7 +50,18 @@ diff --git a/libnativeipc/CMakeLists.txt b/libnativeipc/CMakeLists.txt index fe5cc30..173a156 100644 --- a/libnativeipc/CMakeLists.txt +++ b/libnativeipc/CMakeLists.txt -@@ -81,7 +81,9 @@ if(MSVC) +@@ -59,8 +59,9 @@ + include/nativeipc + ) + ++find_package(libuv REQUIRED CONFIG) + target_link_libraries(nativeipc PRIVATE +- CONAN_PKG::libuv) ++ uv) + + target_compile_definitions(nativeipc PRIVATE) + +@@ -81,7 +82,9 @@ endif() install(TARGETS nativeipc diff --git a/recipes/twitch-native-ipc/all/patches/linux-build-fixes.patch b/recipes/twitch-native-ipc/all/patches/linux-build-fixes.patch index d62079e114cc8..6ce9e9cc4ff9b 100644 --- a/recipes/twitch-native-ipc/all/patches/linux-build-fixes.patch +++ b/recipes/twitch-native-ipc/all/patches/linux-build-fixes.patch @@ -83,3 +83,15 @@ index 40154b7..9772073 100644 ); #if DO_EXPLICIT_CHECKS +diff --git a/tests/UVServerTransport.h b/libnativeipc/src/UVServerTransport.h +index 40154b7..9772073 100644 +--- a/libnativeipc/src/UVServerTransport.h ++++ b/libnativeipc/src/UVServerTransport.h +@@ -7,6 +7,7 @@ + #include + #include + #include ++#include + + namespace Twitch::IPC { + class UVServerTransport diff --git a/recipes/twitch-native-ipc/all/test_package/CMakeLists.txt b/recipes/twitch-native-ipc/all/test_package/CMakeLists.txt index 667b93ec41536..9e540f91ccbcd 100644 --- a/recipes/twitch-native-ipc/all/test_package/CMakeLists.txt +++ b/recipes/twitch-native-ipc/all/test_package/CMakeLists.txt @@ -1,12 +1,11 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(PackageTest) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) +find_package(twitch-native-ipc REQUIRED CONFIG) add_executable(example example.c) -target_link_libraries(example ${CONAN_LIBS}) +target_link_libraries(example twitch-native-ipc::twitch-native-ipc) add_executable(example2 example2.cpp) -target_link_libraries(example2 ${CONAN_LIBS}) +target_link_libraries(example2 twitch-native-ipc::twitch-native-ipc) target_compile_features(example2 PRIVATE cxx_std_17) diff --git a/recipes/twitch-native-ipc/all/test_package/conanfile.py b/recipes/twitch-native-ipc/all/test_package/conanfile.py index d9dd1034a8272..673b6b659b166 100644 --- a/recipes/twitch-native-ipc/all/test_package/conanfile.py +++ b/recipes/twitch-native-ipc/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 TwitchNativeIpcTestConan(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,6 +21,8 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - self.run(os.path.join("bin", "example"), run_environment=True) - self.run(os.path.join("bin", "example2"), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindir, "example") + self.run(bin_path, env="conanrun") + bin_path = os.path.join(self.cpp.build.bindir, "example2") + self.run(bin_path, env="conanrun") diff --git a/recipes/twitch-native-ipc/all/test_package/example.c b/recipes/twitch-native-ipc/all/test_package/example.c index 5ba8bef81f80e..8d7d208570a6e 100644 --- a/recipes/twitch-native-ipc/all/test_package/example.c +++ b/recipes/twitch-native-ipc/all/test_package/example.c @@ -1,19 +1,17 @@ +#include + #include #include -#include int main() { void *server = Twitch_IPC_ConnectionCreateServer("test"); void *client = Twitch_IPC_ConnectionCreateClient("test"); - if(server && client) - { + if (server && client) { printf("success\n"); Twitch_IPC_ConnectionDestroy(server); Twitch_IPC_ConnectionDestroy(client); - } - else - { + } else { abort(); } } diff --git a/recipes/twitch-native-ipc/all/test_package/example2.cpp b/recipes/twitch-native-ipc/all/test_package/example2.cpp index 42a57ddd91913..e2e2490435629 100644 --- a/recipes/twitch-native-ipc/all/test_package/example2.cpp +++ b/recipes/twitch-native-ipc/all/test_package/example2.cpp @@ -1,12 +1,13 @@ -#include #include +#include + int main() { using namespace Twitch::IPC; auto server = ConnectionFactory::newServerConnection("test"); auto client = ConnectionFactory::newClientConnection("test"); - if(server && client) { + if (server && client) { std::cout << "success\n"; server.reset(); client.reset(); diff --git a/recipes/twitch-native-ipc/all/test_v1_package/CMakeLists.txt b/recipes/twitch-native-ipc/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/twitch-native-ipc/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/twitch-native-ipc/all/test_v1_package/conanfile.py b/recipes/twitch-native-ipc/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..bbac244c5a058 --- /dev/null +++ b/recipes/twitch-native-ipc/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +import os + +from conans import ConanFile, CMake, tools + + +class TwitchNativeIpcTestConan(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", "example"), run_environment=True) + self.run(os.path.join("bin", "example2"), run_environment=True) diff --git a/recipes/twitchtv-libsoundtrackutil/all/CMakeLists.txt b/recipes/twitchtv-libsoundtrackutil/all/CMakeLists.txt deleted file mode 100644 index 3f96a3374441c..0000000000000 --- a/recipes/twitchtv-libsoundtrackutil/all/CMakeLists.txt +++ /dev/null @@ -1,6 +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/twitchtv-libsoundtrackutil/all/conandata.yml b/recipes/twitchtv-libsoundtrackutil/all/conandata.yml index 4c0490bd52328..ba721a294a6f3 100644 --- a/recipes/twitchtv-libsoundtrackutil/all/conandata.yml +++ b/recipes/twitchtv-libsoundtrackutil/all/conandata.yml @@ -5,4 +5,4 @@ sources: patches: "0.0.8": - patch_file: "patches/clang-8-fix.patch" - base_path: "source_subfolder" + - patch_file: "patches/cmake-fixes.patch" diff --git a/recipes/twitchtv-libsoundtrackutil/all/conanfile.py b/recipes/twitchtv-libsoundtrackutil/all/conanfile.py index 8e59051225235..4ecfa76766259 100644 --- a/recipes/twitchtv-libsoundtrackutil/all/conanfile.py +++ b/recipes/twitchtv-libsoundtrackutil/all/conanfile.py @@ -1,33 +1,34 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -from conans.tools import Version import os +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +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, export_conandata_patches, get, rm, replace_in_file +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" + + class TwitchTvLibSoundtrackUtilConan(ConanFile): name = "twitchtv-libsoundtrackutil" + description = "Twitch Soundtrack utility library" license = "MIT" - homepage = "https://github.com/twitchtv/libsoundtrackutil" url = "https://github.com/conan-io/conan-center-index" - description = "Twitch Soundtrack utility library" + homepage = "https://github.com/twitchtv/libsoundtrackutil" topics = ("twitch", "soundtrack") - settings = "os", "compiler", "build_type", "arch" - options = {"fPIC": [True, False]} - default_options = {"fPIC": True} - generators = "cmake" - exports = ["CMakeLists.txt", "patches/**"] - requires = ("twitch-native-ipc/3.1.1", - "ms-gsl/2.0.0", - ) - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_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 _compilers_min_version(self): @@ -35,56 +36,67 @@ def _compilers_min_version(self): "gcc": "8", "clang": "8", "apple-clang": "10", + "msvc": "191", "Visual Studio": "15", } + 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("twitch-native-ipc/3.1.1", transitive_headers=True, transitive_libs=True) + self.requires("ms-gsl/4.0.0", transitive_headers=True) + + def validate(self): if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 17) + check_min_cppstd(self, 17) min_version = self._compilers_min_version.get(str(self.settings.compiler), False) if min_version: - if tools.Version(self.settings.compiler.version) < min_version: - raise ConanInvalidConfiguration("{} requires C++17".format(self.name)) - else: - self.output.warn("unknown compiler, assuming C++17 support") + if Version(self.settings.compiler.version) < min_version: + raise ConanInvalidConfiguration(f"{self.name} requires C++17") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename("{}-{}".format("libsoundtrackutil", self.version), self._source_subfolder) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - - self._cmake = CMake(self) - self._cmake.definitions["ENABLE_CODE_FORMATTING"] = False - self._cmake.definitions["BUILD_TESTING"] = False - - if self.settings.compiler == "Visual Studio": - self._cmake.definitions["MSVC_DYNAMIC_RUNTIME"] = self.settings.compiler.runtime in ("MD", "MDd") - - 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["ENABLE_CODE_FORMATTING"] = False + tc.variables["BUILD_TESTING"] = False + if is_msvc(self): + tc.variables["MSVC_DYNAMIC_RUNTIME"] = not is_msvc_static_runtime(self) + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = self.options.shared + 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 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.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.pdb") + rm(self, "*.pdb", os.path.join(self.package_folder, "lib"), recursive=True) def package_info(self): self.cpp_info.libs = ["libsoundtrackutil"] - if tools.stdcpp_library(self): - self.cpp_info.system_libs.append(tools.stdcpp_library(self)) + if stdcpp_library(self): + self.cpp_info.system_libs.append(stdcpp_library(self)) diff --git a/recipes/twitchtv-libsoundtrackutil/all/patches/cmake-fixes.patch b/recipes/twitchtv-libsoundtrackutil/all/patches/cmake-fixes.patch new file mode 100644 index 0000000000000..61fef8d1ecbf9 --- /dev/null +++ b/recipes/twitchtv-libsoundtrackutil/all/patches/cmake-fixes.patch @@ -0,0 +1,52 @@ +diff --git a/cmakeUtils/setup.cmake b/cmakeUtils/setup.cmake +--- cmakeUtils/setup.cmake ++++ cmakeUtils/setup.cmake +@@ -1,6 +1,4 @@ + include(utilities) +-include(conan) +-include(conanutils) + + macro(setup_project) + if(NOT CMAKE_BUILD_TYPE) +@@ -13,13 +11,9 @@ + option(ENABLE_CODE_DOCUMENTATION "enable code documenation generation" OFF) + option(MSVC_DYNAMIC_RUNTIME "change default runtime" ON) + +- conan_check(VERSION 1.22.2 REQUIRED) +- + setup_default_cxx_compile_options() + + set_output_directories(${CMAKE_BINARY_DIR}/bin) +- +- run_conan() + + include(CTest) + if(BUILD_TESTING) +diff --git a/libsoundtrackutil/CMakeLists.txt b/libsoundtrackutil/CMakeLists.txt +--- libsoundtrackutil/CMakeLists.txt ++++ libsoundtrackutil/CMakeLists.txt +@@ -1,8 +1,10 @@ +-add_library(libsoundtrackutil STATIC) ++add_library(libsoundtrackutil) + ++find_package(twitch-native-ipc REQUIRED CONFIG) ++find_package(Microsoft.GSL REQUIRED CONFIG) + target_link_libraries(libsoundtrackutil PUBLIC +- CONAN_PKG::twitch-native-ipc +- CONAN_PKG::ms-gsl ++ twitch-native-ipc::twitch-native-ipc ++ Microsoft.GSL::GSL + ) + + if(MSVC) +@@ -27,7 +29,9 @@ + target_compile_features(libsoundtrackutil PRIVATE cxx_std_17) + + install(TARGETS libsoundtrackutil +- LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX} ++ LIBRARY DESTINATION lib ++ ARCHIVE DESTINATION lib ++ RUNTIME DESTINATION bin + ) + + install(DIRECTORY include diff --git a/recipes/twitchtv-libsoundtrackutil/all/test_package/CMakeLists.txt b/recipes/twitchtv-libsoundtrackutil/all/test_package/CMakeLists.txt index 50f4073082df2..c9f535322388c 100644 --- a/recipes/twitchtv-libsoundtrackutil/all/test_package/CMakeLists.txt +++ b/recipes/twitchtv-libsoundtrackutil/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(PackageTest) +cmake_minimum_required(VERSION 3.15) +project(PackageTest LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(twitchtv-libsoundtrackutil REQUIRED CONFIG) add_executable(example example.cpp) -target_link_libraries(example ${CONAN_LIBS}) +target_link_libraries(example PRIVATE twitchtv-libsoundtrackutil::twitchtv-libsoundtrackutil) target_compile_features(example PRIVATE cxx_std_17) diff --git a/recipes/twitchtv-libsoundtrackutil/all/test_package/conanfile.py b/recipes/twitchtv-libsoundtrackutil/all/test_package/conanfile.py index 6f930d53958b3..8d52b7021efe1 100644 --- a/recipes/twitchtv-libsoundtrackutil/all/test_package/conanfile.py +++ b/recipes/twitchtv-libsoundtrackutil/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 TwitchNativeIpcTestConan(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): - self.run(os.path.join("bin", "example"), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindir, "example") + self.run(bin_path, env="conanrun") diff --git a/recipes/twitchtv-libsoundtrackutil/all/test_v1_package/CMakeLists.txt b/recipes/twitchtv-libsoundtrackutil/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/twitchtv-libsoundtrackutil/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/twitchtv-libsoundtrackutil/all/test_v1_package/conanfile.py b/recipes/twitchtv-libsoundtrackutil/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..a4ca380f17734 --- /dev/null +++ b/recipes/twitchtv-libsoundtrackutil/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +import os + +from conans import ConanFile, CMake, tools + + +class TwitchNativeIpcTestConan(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", "example"), run_environment=True) diff --git a/recipes/type_safe/all/conandata.yml b/recipes/type_safe/all/conandata.yml index 8703a48442789..1e778714e307e 100644 --- a/recipes/type_safe/all/conandata.yml +++ b/recipes/type_safe/all/conandata.yml @@ -1,7 +1,13 @@ sources: + "0.2.4": + url: "https://github.com/foonathan/type_safe/archive/v0.2.4.tar.gz" + sha256: "a631d03c18c65726b3d1b7d41ac5806e9121367afe10dd2f408a2d75e144b734" + "0.2.3": + url: "https://github.com/foonathan/type_safe/archive/v0.2.3.tar.gz" + sha256: "19008ab9526b0d2db1ae6bbd6640f5f7a398826bb2266561472e9f1b10d85bec" "0.2.2": url: "https://github.com/foonathan/type_safe/archive/v0.2.2.tar.gz" sha256: "34d97123fb9bca04a333565c4a2498425d602ec0c759de4be1b8cfae77d05823" '0.2.1': - url: https://github.com/foonathan/type_safe/archive/v0.2.1.zip - sha256: 1c941f7ecd5e17e80773a2d8c9c905f552cc80417f8006ade7e9fa3525ff1b55 + url: "https://github.com/foonathan/type_safe/archive/v0.2.1.tar.gz" + sha256: "49c703d52b724635cb9ee0cfeac9e2c9957134380da900a69791bd0e3d0c3673" diff --git a/recipes/type_safe/all/conanfile.py b/recipes/type_safe/all/conanfile.py index 0864c1a6720cf..a527bd249ec3e 100644 --- a/recipes/type_safe/all/conanfile.py +++ b/recipes/type_safe/all/conanfile.py @@ -1,37 +1,53 @@ -from conans import ConanFile, tools import os -class TypeSafe(ConanFile): - name = 'type_safe' - description = 'Zero overhead utilities for preventing bugs at compile time' - url = 'https://github.com/conan-io/conan-center-index' - homepage = 'https://foonathan.net/type_safe' - license = 'MIT' - topics = 'conan', 'c++', 'strong typing', 'vocabulary-types' +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 - settings = 'compiler' +required_conan_version = ">=1.52.0" - no_copy_source = True - _source_subfolder = 'source_subfolder' - requires = 'debug_assert/1.3.3' +class TypeSafe(ConanFile): + name = "type_safe" + description = "Zero overhead utilities for preventing bugs at compile time" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://type_safe.foonathan.net/" + topics = ("c++", "strong typing", "vocabulary-types", "header-only") + + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True @property - def _repo_folder(self): - return os.path.join(self.source_folder, self._source_subfolder) + def _min_cppstd(self): + return 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) + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("debug_assert/1.3.3") - 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, '11') + check_min_cppstd(self, self._min_cppstd) - def package(self): - self.copy("*LICENSE", dst="licenses", keep_path=False) - self.copy("*", src=os.path.join(self._repo_folder, 'include'), dst='include/') + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) - def package_id(self): - self.info.header_only() + def package(self): + copy(self, "*LICENSE", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder, keep_path=False) + copy(self, "*", + 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/type_safe/all/test_package/CMakeLists.txt b/recipes/type_safe/all/test_package/CMakeLists.txt index 33ae887aa6aea..d669047ac6039 100644 --- a/recipes/type_safe/all/test_package/CMakeLists.txt +++ b/recipes/type_safe/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -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() +find_package(type_safe 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 type_safe::type_safe) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/type_safe/all/test_package/conanfile.py b/recipes/type_safe/all/test_package/conanfile.py index bd7165a553cf4..fae501d0afb9e 100644 --- a/recipes/type_safe/all/test_package/conanfile.py +++ b/recipes/type_safe/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" + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/type_safe/all/test_v1_package/CMakeLists.txt b/recipes/type_safe/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/type_safe/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/type_safe/all/test_v1_package/conanfile.py b/recipes/type_safe/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..7e2dfe859bb27 --- /dev/null +++ b/recipes/type_safe/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/type_safe/config.yml b/recipes/type_safe/config.yml index 3d99cc668cde3..3e1d8c0bc781f 100644 --- a/recipes/type_safe/config.yml +++ b/recipes/type_safe/config.yml @@ -1,4 +1,8 @@ versions: + "0.2.4": + folder: all + "0.2.3": + folder: all "0.2.2": folder: all '0.2.1': diff --git a/recipes/tz/all/conandata.yml b/recipes/tz/all/conandata.yml new file mode 100644 index 0000000000000..dd6b60859c1a9 --- /dev/null +++ b/recipes/tz/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "2023c": + url: "https://github.com/eggert/tz/archive/refs/tags/2023c.tar.gz" + sha256: "9aa20ef838183e58f09acca92098cf6aa6d8e229aecf24e098c3af2a38e596f8" diff --git a/recipes/tz/all/conanfile.py b/recipes/tz/all/conanfile.py new file mode 100644 index 0000000000000..38bd6ee601c91 --- /dev/null +++ b/recipes/tz/all/conanfile.py @@ -0,0 +1,73 @@ +import os + +from conan import ConanFile +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.files import get, copy, rmdir, replace_in_file +from conan.tools.layout import basic_layout + +required_conan_version = ">=1.53.0" + +class TzConan(ConanFile): + name = "tz" + license = "Unlicense" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://www.iana.org/time-zones" + description = "The Time Zone Database contains data that represent the history of local time for many representative locations around the globe." + topics = ("tz", "tzdb", "time", "zone", "date") + settings = "os", "build_type", "arch", "compiler" + + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) + + def configure(self): + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + del self.info.settings.compiler + + def build_requirements(self): + self.tool_requires("mawk/1.3.4-20230404") + 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], strip_root=True) + + def generate(self): + tc = AutotoolsToolchain(self) + tc.generate() + + def _patch_sources(self): + # INFO: The Makefile enforces /usr/bin/awk, but we want to use tool requirements + awk_path = os.path.join(self.dependencies.direct_build['mawk'].package_folder, "bin", "mawk").replace("\\", "/") + replace_in_file(self, os.path.join(self.source_folder, "Makefile"), "AWK= awk", f"AWK={awk_path}") + + def build(self): + self._patch_sources() + autotools = Autotools(self) + autotools.make(args=["-C", self.source_folder.replace("\\", "/")]) + + def package(self): + copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + autotools = Autotools(self) + destdir = self.package_folder.replace('\\', '/') + autotools.install(args=["-C", self.source_folder.replace("\\", "/"), f"DESTDIR={destdir}"]) + rmdir(self, os.path.join(self.package_folder, "usr", "share", "man")) + # INFO: The library does not have a public API, it's used to build the zic and zdump tools + rmdir(self, os.path.join(self.package_folder, "usr", "lib")) + + def package_info(self): + self.cpp_info.libdirs = [] + self.cpp_info.includedirs = [] + self.cpp_info.frameworkdirs = [] + self.cpp_info.resdirs = [os.path.join("usr", "share")] + self.cpp_info.bindirs = [os.path.join("usr", "bin"), os.path.join("usr", "sbin")] + self.buildenv_info.define("TZDATA", os.path.join(self.package_folder, "usr", "share", "zoneinfo")) + self.runenv_info.define("TZDATA", os.path.join(self.package_folder, "usr", "share", "zoneinfo")) diff --git a/recipes/tz/all/test_package/conanfile.py b/recipes/tz/all/test_package/conanfile.py new file mode 100644 index 0000000000000..eaec136cd36cc --- /dev/null +++ b/recipes/tz/all/test_package/conanfile.py @@ -0,0 +1,35 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.errors import ConanException +import os + + +class TzTestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "VirtualBuildEnv", "VirtualRunEnv" + test_type = "explicit" + tzdata = None + + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) + + 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): + # INFO: zdump does not consume TZDATA, need to pass absolute path of the zoneinfo directory + self.tzdata = self.dependencies.build['tz'].buildenv_info.vars(self).get('TZDATA') + with open("tzdata.info", "w") as fd: + fd.write(self.tzdata) + + def build(self): + pass + + def test(self): + if can_run(self): + with open("tzdata.info", "r") as fd: + self.tzdata = fd.read() + self.run(f"zdump {os.path.join(self.tzdata, 'America', 'Los_Angeles')}") diff --git a/recipes/tz/config.yml b/recipes/tz/config.yml new file mode 100644 index 0000000000000..baca28b344a2b --- /dev/null +++ b/recipes/tz/config.yml @@ -0,0 +1,3 @@ +versions: + "2023c": + folder: all diff --git a/recipes/ua-nodeset/all/conanfile.py b/recipes/ua-nodeset/all/conanfile.py index 0414764f76035..b0566af78f907 100644 --- a/recipes/ua-nodeset/all/conanfile.py +++ b/recipes/ua-nodeset/all/conanfile.py @@ -1,7 +1,9 @@ -from conans import ConanFile, CMake, tools import os -required_conan_version = ">=1.33.0" +from conan import ConanFile +from conan.tools.files import copy, get, load, save + +required_conan_version = ">=1.47.0" class UaNodeSetConan(ConanFile): @@ -12,32 +14,34 @@ class UaNodeSetConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" topics = ("opc-ua-specifications", "uanodeset", "normative-files", "companion-specification") - no_copy_source = True - - @property - def _source_subfolder(self): - return "source_subfolder" + package_type = "build-scripts" + settings = "os", "arch", "compiler", "build_type" + short_paths = True - def _extract_license(self): - content = tools.load(os.path.join(self.source_folder, self._source_subfolder, "AnsiC", "opcua_clientapi.c")) - license_contents = content[2:content.find("*/", 1)] - tools.save("LICENSE", license_contents) + def layout(self): + pass - def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + def package_id(self): + self.info.clear() def build(self): - pass + get(self, **self.conan_data["sources"][self.version], strip_root=True) + def _extract_license(self): + content = load(self, os.path.join(self.build_folder, "AnsiC", "opcua_clientapi.c")) + license_contents = content[2 : content.find("*/", 1)] + save(self, os.path.join(self.package_folder, "licenses", "LICENSE"), license_contents) def package(self): self._extract_license() - self.copy("*", dst="res", src=self._source_subfolder) - self.copy("LICENSE", dst="licenses") - + copy(self, "*", dst=os.path.join(self.package_folder, "res"), src=self.build_folder) def package_info(self): - self.cpp_info.libdirs = [] + self.conf_info.define("user.ua-nodeset:nodeset_dir", os.path.join(self.package_folder, "res")) self.cpp_info.resdirs = ["res"] - self.user_info.nodeset_dir = os.path.join(self.package_folder, "res") + self.cpp_info.libdirs = [] + self.cpp_info.frameworkdirs = [] + self.cpp_info.includedirs = [] + # TODO: to remove in conan v2 + self.user_info.nodeset_dir = os.path.join(self.package_folder, "res") diff --git a/recipes/ua-nodeset/all/test_package/conanfile.py b/recipes/ua-nodeset/all/test_package/conanfile.py index 872e7a1f2874d..02a908bec924b 100644 --- a/recipes/ua-nodeset/all/test_package/conanfile.py +++ b/recipes/ua-nodeset/all/test_package/conanfile.py @@ -1,12 +1,24 @@ -from conans import ConanFile, CMake, tools import os +from conan import ConanFile +from conan.tools.files import load, save -class TestUaNodeSetConan(ConanFile): - def build(self): +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + test_type = "explicit" + + def layout(self): pass - def test(self): - assert os.path.exists(os.path.join(self.deps_user_info["ua-nodeset"].nodeset_dir, "PLCopen")) + def generate(self): + nodeset_dir = self.dependencies["ua-nodeset"].conf_info.get("user.ua-nodeset:nodeset_dir") + save(self, "nodeset_dir", nodeset_dir) + def requirements(self): + self.requires(self.tested_reference_str) + + def test(self): + nodeset_dir = load(self, "nodeset_dir") + test_path = os.path.join(nodeset_dir, "PLCopen") + assert os.path.exists(test_path) diff --git a/recipes/ua-nodeset/all/test_v1_package/conanfile.py b/recipes/ua-nodeset/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..872e7a1f2874d --- /dev/null +++ b/recipes/ua-nodeset/all/test_v1_package/conanfile.py @@ -0,0 +1,12 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestUaNodeSetConan(ConanFile): + + def build(self): + pass + + def test(self): + assert os.path.exists(os.path.join(self.deps_user_info["ua-nodeset"].nodeset_dir, "PLCopen")) + diff --git a/recipes/uchardet/all/CMakeLists.txt b/recipes/uchardet/all/CMakeLists.txt deleted file mode 100644 index a17cdee90b035..0000000000000 --- a/recipes/uchardet/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_RPATH) - -add_subdirectory("source_subfolder") diff --git a/recipes/uchardet/all/conandata.yml b/recipes/uchardet/all/conandata.yml index 30099f9e54a80..8d50fe442e1ff 100644 --- a/recipes/uchardet/all/conandata.yml +++ b/recipes/uchardet/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.0.8": + url: "https://www.freedesktop.org/software/uchardet/releases/uchardet-0.0.8.tar.xz" + sha256: "e97a60cfc00a1c147a674b097bb1422abd9fa78a2d9ce3f3fdcc2e78a34ac5f0" "0.0.7": - url: https://www.freedesktop.org/software/uchardet/releases/uchardet-0.0.7.tar.xz + url: "https://www.freedesktop.org/software/uchardet/releases/uchardet-0.0.7.tar.xz" sha256: "3fc79408ae1d84b406922fa9319ce005631c95ca0f34b205fad867e8b30e45b1" diff --git a/recipes/uchardet/all/conanfile.py b/recipes/uchardet/all/conanfile.py index bb92e982496c4..38d486d7a2d81 100644 --- a/recipes/uchardet/all/conanfile.py +++ b/recipes/uchardet/all/conanfile.py @@ -1,18 +1,28 @@ -from conans import ConanFile, CMake, tools import os -import functools -required_conan_version = ">=1.33.0" +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.files import copy, get, replace_in_file, rmdir, save +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" class UchardetConan(ConanFile): name = "uchardet" + description = ( + "uchardet is an encoding detector library, which takes a " + "sequence of bytes in an unknown character encoding and " + "attempts to determine the encoding of the text. " + "Returned encoding names are iconv-compatible." + ) + license = "MPL-1.1" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/freedesktop/uchardet" - description = "uchardet is an encoding detector library, which takes a sequence of bytes in an unknown character encoding and attempts to determine the encoding of the text. Returned encoding names are iconv-compatible." - topics = "encoding", "detector" - license = "MPL-1.1" + topics = ("encoding", "detector") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -25,79 +35,62 @@ class UchardetConan(ConanFile): "check_sse2": 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" - @property def _settings_build(self): return getattr(self, "settings_build", self.settings) def config_options(self): if self._settings_build not in ("x86", "x86_64"): - del self.options.check_sse2 + self.options.rm_safe("check_sse2") 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 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): - # the following fixes that apply to uchardet version 0.0.7 - # fix broken cmake - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "${CMAKE_BINARY_DIR}", - "${CMAKE_CURRENT_BINARY_DIR}") - # fix problem with mac os - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - 'string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} TARGET_ARCHITECTURE)', - 'string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" TARGET_ARCHITECTURE)') - # disable building tests - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "add_subdirectory(test)", - "#add_subdirectory(test)") + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CHECK_SSE2"] = self.options.get_safe("check_sse2", False) + tc.variables["BUILD_BINARY"] = False + tc.variables["BUILD_STATIC"] = not self.options.shared + tc.generate() - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["CHECK_SSE2"] = self.options.get_safe("check_sse2", False) - cmake.definitions["BUILD_BINARY"] = False - cmake.definitions["BUILD_STATIC"] = False # disable building static libraries when self.options.shared is True - cmake.configure(build_folder=self._build_subfolder) - return cmake + def _patch_sources(self): + if Version(self.version) < "0.0.8": + # fix problem with macOS + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} TARGET_ARCHITECTURE)", + 'string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" TARGET_ARCHITECTURE)') + # disable building of tests + save(self, os.path.join(self.source_folder, "doc", "CMakeLists.txt"), "") + save(self, os.path.join(self.source_folder, "test", "CMakeLists.txt"), "") 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", + 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", "cmake")) + 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("cmake_file_name", "uchardet") - self.cpp_info.set_property("cmake_target_name", "uchardet") self.cpp_info.set_property("pkg_config_name", "libuchardet") - - self.cpp_info.names["cmake_find_package"] = "uchardet" - self.cpp_info.names["cmake_find_package_multi"] = "uchardet" - self.cpp_info.names["pkgconfig"] = "libuchardet" self.cpp_info.libs = ["uchardet"] if self.options.shared: self.cpp_info.defines.append("UCHARDET_SHARED") diff --git a/recipes/uchardet/all/test_package/CMakeLists.txt b/recipes/uchardet/all/test_package/CMakeLists.txt index a726e6f66a3bd..6dbcda3f32f3c 100644 --- a/recipes/uchardet/all/test_package/CMakeLists.txt +++ b/recipes/uchardet/all/test_package/CMakeLists.txt @@ -1,12 +1,10 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) + 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(uchardet REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/uchardet/all/test_package/conanfile.py b/recipes/uchardet/all/test_package/conanfile.py index 38f4483872d47..ef5d7042163ec 100644 --- a/recipes/uchardet/all/test_package/conanfile.py +++ b/recipes/uchardet/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/uchardet/all/test_v1_package/CMakeLists.txt b/recipes/uchardet/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/uchardet/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/uchardet/all/test_v1_package/conanfile.py b/recipes/uchardet/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/uchardet/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/uchardet/config.yml b/recipes/uchardet/config.yml index 3b1adbf0ba92f..1c066f06099c5 100644 --- a/recipes/uchardet/config.yml +++ b/recipes/uchardet/config.yml @@ -1,3 +1,5 @@ versions: + "0.0.8": + folder: all "0.0.7": folder: all diff --git a/recipes/ulfius/all/conanfile.py b/recipes/ulfius/all/conanfile.py index 675ce5de0ba1e..22361ddec897d 100644 --- a/recipes/ulfius/all/conanfile.py +++ b/recipes/ulfius/all/conanfile.py @@ -6,7 +6,7 @@ import os import textwrap -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class UlfiusConan(ConanFile): @@ -16,6 +16,8 @@ class UlfiusConan(ConanFile): topics = ("web", "http", "rest", "endpoint", "json", "websocket") license = "LGPL-2.1-or-later" url = "https://github.com/conan-io/conan-center-index" + + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -29,8 +31,8 @@ class UlfiusConan(ConanFile): 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 + "enable_websockets": True, + "with_gnutls": True, "with_jansson": True, "with_libcurl": True, "with_yder": True, @@ -38,39 +40,34 @@ class UlfiusConan(ConanFile): def config_options(self): if self.settings.os == "Windows": - self.options.enable_websockets = False + # INSTALL.md says that websockets are not supported on Windows + del self.options.enable_websockets 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") + if self.options.get_safe("enable_websockets") and not self.options.with_gnutls: + raise ConanInvalidConfiguration(f"{self.ref} requires -o=&:with_gnutls=True when -o=&:enable_websockets=True") 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 + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def requirements(self): - self.requires("orcania/2.3.1") - self.requires("libmicrohttpd/0.9.75") + self.requires("orcania/2.3.3", transitive_headers=True) + self.requires("libmicrohttpd/0.9.75", transitive_headers=True) if self.options.with_yder: - self.requires("yder/1.4.18") + self.requires("yder/1.4.18", transitive_headers=True) if self.options.with_jansson: - self.requires("jansson/2.14") + self.requires("jansson/2.14", transitive_headers=True) if self.options.with_libcurl: - self.requires("libcurl/7.85.0") + self.requires("libcurl/[>=7.78.0 <9]") + if self.options.with_gnutls: + # Used in public ulfius.h:43 + self.requires("gnutls/3.8.2", transitive_headers=True) + if self.options.get_safe("enable_websockets"): + self.requires("zlib/[>=1.2.11 <2]") def source(self): get(self, **self.conan_data["sources"][self.version], @@ -88,62 +85,33 @@ def generate(self): 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_WEBSOCKET"] = self.options.get_safe("enable_websockets") tc.variables["WITH_CURL"] = self.options.with_libcurl tc.variables["WITH_JANSSON"] = self.options.with_jansson + + # Compilation issues when setting Ulifus as a dependency internally + tc.variables["BUILD_UWSC"] = False + 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() - """)) + deps.set_property("libmicrohttpd", "cmake_file_name", "MHD") + deps.set_property("libmicrohttpd", "cmake_target_name", "MHD::MHD") + + # Orcania generates -static targets for static libraries, but Ulfius does not check for them, + # unconditionally set the target name to Orcania::Orcania + deps.set_property("orcania", "cmake_target_name", "Orcania::Orcania") + + # Same for Yder + if self.options.with_yder: + deps.set_property("yder", "cmake_target_name", "Yder::Yder") - # 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) + deps.set_property("jansson", "cmake_file_name", "Jansson") + deps.set_property("jansson", "cmake_target_name", "Jansson::Jansson") - if self.options.with_gnutls: - # FIXME: make sure gnutls creates GnuTLSCOnfig.cmake + GnuTLS::GnuTLS target + GNUTLS_VERSION_STRING - pass + deps.generate() def _patch_sources(self): apply_conandata_patches(self) diff --git a/recipes/uncrustify/all/conandata.yml b/recipes/uncrustify/all/conandata.yml index 22c525b3881bd..e46325da0f342 100644 --- a/recipes/uncrustify/all/conandata.yml +++ b/recipes/uncrustify/all/conandata.yml @@ -1,7 +1,10 @@ sources: - "0.75.1": - url: "https://github.com/uncrustify/uncrustify/archive/refs/tags/uncrustify-0.75.1.tar.gz" - sha256: "fd14acc0a31ed88b33137bdc26d32964327488c835f885696473ef07caf2e182" - "0.74.0": - url: "https://github.com/uncrustify/uncrustify/archive/refs/tags/uncrustify-0.74.0.tar.gz" - sha256: "b7d24e256e7f919aa96289ac8167ac98340df7faa2d34b60d2242dc54700caaa" + "0.79.0": + url: "https://github.com/uncrustify/uncrustify/archive/uncrustify-0.79.0.tar.gz" + sha256: "e7afaeabf636b7f0ce4e3e9747b95f7bd939613a8db49579755dddf44fedca5f" + "0.78.1": + url: "https://github.com/uncrustify/uncrustify/archive/uncrustify-0.78.1.tar.gz" + sha256: "ecaf4c0adca14c36dfffa30bc28e69865115ecd602c90eb16a8cddccb41caad2" + "0.77.1": + url: "https://github.com/uncrustify/uncrustify/archive/refs/tags/uncrustify-0.77.1.tar.gz" + sha256: "414bbc9f7860eb18a53074f9af14ed04638a633b2216a73f2629291300d37c1b" diff --git a/recipes/uncrustify/all/conanfile.py b/recipes/uncrustify/all/conanfile.py index da8a4d29e3f0e..0c905f0cb5c35 100644 --- a/recipes/uncrustify/all/conanfile.py +++ b/recipes/uncrustify/all/conanfile.py @@ -16,6 +16,7 @@ class UncrustifyConan(ConanFile): topics = "beautifier", "command-line" homepage = "https://github.com/uncrustify/uncrustify" url = "https://github.com/conan-io/conan-center-index" + package_type = "application" settings = "os", "arch", "compiler", "build_type" def layout(self): @@ -29,8 +30,7 @@ def validate(self): raise ConanInvalidConfiguration(f"{self.ref} requires GCC >=7") 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) @@ -65,9 +65,6 @@ def package(self): 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.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/uncrustify/all/test_package/conanfile.py b/recipes/uncrustify/all/test_package/conanfile.py index ca7e7aabaf2bf..71b7668f5e09d 100644 --- a/recipes/uncrustify/all/test_package/conanfile.py +++ b/recipes/uncrustify/all/test_package/conanfile.py @@ -1,15 +1,13 @@ from conan import ConanFile -from conan.tools.build import can_run class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "VirtualRunEnv" + generators = "VirtualBuildEnv" test_type = "explicit" - def requirements(self): - self.requires(self.tested_reference_str) + def build_requirements(self): + self.tool_requires(self.tested_reference_str) def test(self): - if can_run(self): - self.run("uncrustify --version", env="conanrun") + self.run("uncrustify --version") diff --git a/recipes/uncrustify/config.yml b/recipes/uncrustify/config.yml index 27d29acb91740..2c75346920bc6 100644 --- a/recipes/uncrustify/config.yml +++ b/recipes/uncrustify/config.yml @@ -1,5 +1,7 @@ versions: - "0.75.1": + "0.79.0": folder: all - "0.74.0": + "0.78.1": + folder: all + "0.77.1": folder: all diff --git a/recipes/uni-algo/all/conandata.yml b/recipes/uni-algo/all/conandata.yml new file mode 100644 index 0000000000000..8d8acc924ed24 --- /dev/null +++ b/recipes/uni-algo/all/conandata.yml @@ -0,0 +1,28 @@ +sources: + "1.2.0": + url: "https://github.com/uni-algo/uni-algo/archive/v1.2.0.tar.gz" + sha256: "f2a1539cd8635bc6088d05144a73ecfe7b4d74ee0361fabed6f87f9f19e74ca9" + "1.1.0": + url: "https://github.com/uni-algo/uni-algo/archive/v1.1.0.tar.gz" + sha256: "f9aa30df9766fbbc7007b206c6db122313194e75b159dc222cddce016372d2de" + "1.0.0": + url: "https://github.com/uni-algo/uni-algo/archive/v1.0.0.tar.gz" + sha256: "a59d61cd4a4fff08672831c7e5a8c204bb6e96c21506b6471771c01b38958a15" + "0.8.2": + url: "https://github.com/uni-algo/uni-algo/archive/v0.8.2.tar.gz" + sha256: "c0dab8ae1dbbab3e33b0c5bb512e927badb57f53e7ee96517c1dfd2e078b7669" + "0.8.1": + url: "https://github.com/uni-algo/uni-algo/archive/v0.8.1.tar.gz" + sha256: "11192280fa435a9d68131d5368d2b314201d7089e6d2f38f29a8591c9aafa776" + "0.8.0": + url: "https://github.com/uni-algo/uni-algo/archive/refs/tags/v0.8.0.tar.gz" + sha256: "657f124f4fb4705f948e9c0835ec88484ee4745d7b19cb2ddb772119a7ea024e" + "0.7.1": + url: "https://github.com/uni-algo/uni-algo/archive/refs/tags/v0.7.1.tar.gz" + sha256: "9ff1f03d6ffd81df7a2a21df353502db55d198a940da0aef0546b37ca934fdfb" + "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..6db6b84997bdc --- /dev/null +++ b/recipes/uni-algo/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, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, rmdir +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.53.0" + + +class UniAlgoConan(ConanFile): + name = "uni-algo" + package_type = "library" + 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" + package_type = "library" + options = { + "shared": [True, False], + "fPIC": [True, False], + "header_only": [True, False] + } + default_options = { + "shared": False, + "fPIC": True, + "header_only": False + } + + @property + def _min_cppstd(self): + return "17" + + @property + def _compilers_minimum_version(self): + return { + "Visual Studio": "16", + "msvc": "192", + "gcc": "7", + "clang": "8", + "apple-clang": "11", + } + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.header_only: + self.options.rm_safe("fPIC") + self.options.rm_safe("shared") + elif self.options.shared: + 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: + 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." + ) + + if is_msvc(self) and self.options.get_safe("shared"): + raise ConanInvalidConfiguration(f"{self.ref} can not be built as shared with msvc") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + if not self.options.header_only: + tc = CMakeToolchain(self) + tc.variables["UNI_ALGO_HEADER_ONLY"] = self.options.header_only + tc.generate() + + def build(self): + if not self.options.header_only: + 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) + if self.options.header_only: + 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", "cmake")) + rmdir(self, os.path.join(self.package_folder, "share")) + + def package_info(self): + if self.options.header_only: + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + else: + if self.settings.build_type == "Debug": + if Version(self.version) < "0.7": + self.cpp_info.libs = [f"{self.name}d"] + else: + self.cpp_info.libs = [f"{self.name}-debug"] + else: + self.cpp_info.libs = [f"{self.name}"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") + + # see https://github.com/uni-algo/uni-algo/blob/v0.7.1/CMakeLists.txt#L75-L109 + self.cpp_info.set_property("cmake_file_name", "uni-algo") + self.cpp_info.set_property("cmake_target_name", "uni-algo::uni-algo") 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..53399e9671402 --- /dev/null +++ b/recipes/uni-algo/config.yml @@ -0,0 +1,19 @@ +versions: + "1.2.0": + folder: all + "1.1.0": + folder: all + "1.0.0": + folder: all + "0.8.2": + folder: all + "0.8.1": + folder: all + "0.8.0": + folder: all + "0.7.1": + folder: all + "0.7.0": + folder: all + "0.6.0": + folder: all diff --git a/recipes/unicorn/all/conanfile.py b/recipes/unicorn/all/conanfile.py index a304c26bd1555..10435417a72cf 100644 --- a/recipes/unicorn/all/conanfile.py +++ b/recipes/unicorn/all/conanfile.py @@ -1,13 +1,15 @@ 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.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, rm, rmdir, save from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version import os import stat import textwrap -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.54.0" class UnicornConan(ConanFile): @@ -17,6 +19,7 @@ class UnicornConan(ConanFile): homepage = "https://www.unicorn-engine.org/" url = "https://github.com/conan-io/conan-center-index" license = ("GPL-2-or-later", "LGPL-2-or-later") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -37,13 +40,20 @@ def _all_supported_archs(self): """ return sorted(["aarch64", "arm", "m68k", "mips", "sparc", "x86"]) - @property - def _supported_archs(self): + def _supported_archs(self, info=False): """ Get supported architectures of the current build/package (depends on self.options.supported_archs) :return: sorted list of strings """ - return sorted(set(str(self.options.supported_archs).split(","))) + options = self.info.options if info else self.options + return sorted(set(str(options.supported_archs).split(","))) + + @property + def _needs_jwasm(self): + return self.settings.os == "Windows" and not is_msvc(self) + + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -52,47 +62,61 @@ 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 - - @property - def _needs_jwasm(self): - return self.settings.os == "Windows" and not is_msvc(self) - - def export_sources(self): - export_conandata_patches(self) + 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 build_requirements(self): - if self._needs_jwasm: - 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) + self.info.options.supported_archs = ",".join(self._supported_archs(info=True)) def validate(self): - unsupported_archs = [arch for arch in self._supported_archs if arch not in self._all_supported_archs] + unsupported_archs = [arch for arch in self._supported_archs() if arch not in self._all_supported_archs] if unsupported_archs: - self.output.info(f"Valid supported architectures are: {self._all_supported_archs}") - raise ConanInvalidConfiguration(f"Invalid arch(s) in supported_archs option: {unsupported_archs}") + raise ConanInvalidConfiguration( + f"Invalid arch(s) in supported_archs option: {unsupported_archs}\n" + f"Valid supported architectures are: {self._all_supported_archs}" + ) if "arm" in self.settings.arch: # 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 build_requirements(self): + if self._needs_jwasm: + self.tool_requires("jwasm/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) @property def _jwasm_wrapper(self): return os.path.join(self.build_folder, "jwasm_wrapper.py") + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + + tc = CMakeToolchain(self) + tc.variables["UNICORN_INSTALL"] = True + tc.variables["UNICORN_BUILD_SAMPLES"] = False + tc.cache_variables["UNICORN_ARCH"] = ";".join(self._supported_archs()) + 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 _patch_sources(self): + apply_conandata_patches(self) if self._needs_jwasm: save(self, self._jwasm_wrapper, textwrap.dedent("""\ #!/usr/bin/env python @@ -115,28 +139,7 @@ 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 = CMake(self) cmake.configure() @@ -147,11 +150,14 @@ def package(self): copy(self, lic, 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")) + if Version(self.version) >= "2.0.0" and self.options.shared: + rm(self, "*unicorn.a", os.path.join(self.package_folder, "lib")) + rm(self, "*unicorn.lib", os.path.join(self.package_folder, "lib")) def package_info(self): - self.cpp_info.libs = ["unicorn"] self.cpp_info.set_property("pkg_config_name", "unicorn") + suffix = "-import" if Version(self.version) >= "2.0.0" and is_msvc(self) and self.options.shared else "" + self.cpp_info.libs = [f"unicorn{suffix}"] if self.settings.os in ("FreeBSD", "Linux"): self.cpp_info.system_libs = ["m", "pthread"] diff --git a/recipes/unicorn/all/test_package/CMakeLists.txt b/recipes/unicorn/all/test_package/CMakeLists.txt index 6c6411fee68ac..20222cfa58800 100644 --- a/recipes/unicorn/all/test_package/CMakeLists.txt +++ b/recipes/unicorn/all/test_package/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) find_package(unicorn REQUIRED CONFIG) diff --git a/recipes/unicorn/all/test_package/conanfile.py b/recipes/unicorn/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/unicorn/all/test_package/conanfile.py +++ b/recipes/unicorn/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/unicorn/all/test_v1_package/CMakeLists.txt b/recipes/unicorn/all/test_v1_package/CMakeLists.txt index 2318e761b0487..0d20897301b68 100644 --- a/recipes/unicorn/all/test_v1_package/CMakeLists.txt +++ b/recipes/unicorn/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package) 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) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/units/all/conanfile.py b/recipes/units/all/conanfile.py index abb3f73f19041..f5e7559e8b3b4 100644 --- a/recipes/units/all/conanfile.py +++ b/recipes/units/all/conanfile.py @@ -2,6 +2,7 @@ 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 @@ -20,6 +21,7 @@ class UnitsConan(ConanFile): "no-dependencies") homepage = "https://github.com/nholthaus/units" url = "https://github.com/conan-io/conan-center-index" + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -36,6 +38,9 @@ def _minimum_compilers_version(self): "msvc": "190", } + def layout(self): + basic_layout(self, src_folder="src") + def package_id(self): self.info.clear() @@ -49,8 +54,7 @@ def validate(self): ) 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 @@ -64,4 +68,3 @@ def package_info(self): 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_v1_package/CMakeLists.txt b/recipes/units/all/test_v1_package/CMakeLists.txt index b01d1d5fd06ef..0d20897301b68 100644 --- a/recipes/units/all/test_v1_package/CMakeLists.txt +++ b/recipes/units/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(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) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/unity/all/conandata.yml b/recipes/unity/all/conandata.yml new file mode 100644 index 0000000000000..99c6f0d9d4bf6 --- /dev/null +++ b/recipes/unity/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "2.6.0": + url: "https://github.com/ThrowTheSwitch/Unity/archive/refs/tags/v2.6.0.tar.gz" + sha256: "aa4c9fb1ae5fc5242f914c65f3557e817e40cb37f04a31e5ff76d1ab89dbf674" + "2.5.2": + url: "https://github.com/ThrowTheSwitch/Unity/archive/refs/tags/v2.5.2.tar.gz" + sha256: "3786de6c8f389be3894feae4f7d8680a02e70ed4dbcce36109c8f8646da2671a" diff --git a/recipes/unity/all/conanfile.py b/recipes/unity/all/conanfile.py new file mode 100644 index 0000000000000..7170cbf7699d0 --- /dev/null +++ b/recipes/unity/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, rmdir +import os + +required_conan_version = ">=1.53.0" + + +class UnityConan(ConanFile): + name = "unity" + description = "Unity Test is a unit testing framework built for C, with a focus on working with embedded toolchains" + topics = ("unit-test", "tdd", "bdd", "testing") + license = "MIT" + homepage = "http://www.throwtheswitch.org" + url = "https://github.com/conan-io/conan-center-index" + package_type = "static-library" + settings = "os", "arch", "compiler", "build_type" + options = { + "fPIC": [True, False], + "fixture_extension": [True, False], + "memory_extension": [True, False], + } + default_options = { + "fPIC": True, + "fixture_extension": False, + "memory_extension": False, + } + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + 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) + tc.cache_variables["UNITY_EXTENSION_FIXTURE"] = self.options.fixture_extension + tc.cache_variables["UNITY_EXTENSION_MEMORY"] = self.options.memory_extension + tc.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")) + cmake = CMake(self) + cmake.install() + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + + def package_info(self): + self.cpp_info.libs = ["unity"] + self.cpp_info.includedirs = ["include", "include/unity"] diff --git a/recipes/unity/all/test_package/CMakeLists.txt b/recipes/unity/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..ac959a17f44e2 --- /dev/null +++ b/recipes/unity/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES C) + +find_package(unity REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE unity::unity) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) diff --git a/recipes/unity/all/test_package/conanfile.py b/recipes/unity/all/test_package/conanfile.py new file mode 100644 index 0000000000000..254feca104287 --- /dev/null +++ b/recipes/unity/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 = "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): + self.run(os.path.join(self.cpp.build.bindirs[0], "test_package"), env="conanrun") diff --git a/recipes/unity/all/test_package/test_package.c b/recipes/unity/all/test_package/test_package.c new file mode 100644 index 0000000000000..ecc0ee2a6b4ef --- /dev/null +++ b/recipes/unity/all/test_package/test_package.c @@ -0,0 +1,22 @@ +#include + + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void test_Something(void) +{ + TEST_ASSERT_EQUAL_INT(1, 1); +} + +int main(void) +{ + UNITY_BEGIN(); + RUN_TEST(test_Something); + return UNITY_END(); +} diff --git a/recipes/unity/config.yml b/recipes/unity/config.yml new file mode 100644 index 0000000000000..a6bd532e688f8 --- /dev/null +++ b/recipes/unity/config.yml @@ -0,0 +1,5 @@ +versions: + "2.6.0": + folder: all + "2.5.2": + folder: all diff --git a/recipes/univalue/all/conanfile.py b/recipes/univalue/all/conanfile.py index c8a79f9bcd0b8..3111f6d607d1b 100644 --- a/recipes/univalue/all/conanfile.py +++ b/recipes/univalue/all/conanfile.py @@ -1,14 +1,13 @@ from conan import ConanFile from conan.tools.apple import fix_apple_shared_install_name -from conan.tools.env import Environment, VirtualBuildEnv +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, unix_path -from conan.tools.scm import Version +from conan.tools.microsoft import check_min_vs, is_msvc, unix_path import os -required_conan_version = ">=1.53.0" +required_conan_version = ">=1.57.0" class UnivalueConan(ConanFile): @@ -19,6 +18,7 @@ class UnivalueConan(ConanFile): homepage = "https://github.com/jgarzik/univalue" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -33,10 +33,6 @@ class UnivalueConan(ConanFile): 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) @@ -59,8 +55,7 @@ def build_requirements(self): self.tool_requires("msys2/cci.latest") 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) @@ -69,15 +64,13 @@ def generate(self): 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"): + if check_min_vs(self, "180", raise_invalid=False): tc.extra_cflags.append("-FS") tc.extra_cxxflags.append("-FS") - tc.generate() - + env = tc.environment() if is_msvc(self): - env = Environment() - ar_wrapper = unix_path(self, self._user_info_build["automake"].ar_lib) + automake_conf = self.dependencies.build["automake"].conf_info + ar_wrapper = unix_path(self, automake_conf.get("user.automake:lib-wrapper", check_type=str)) env.define("CC", "cl -nologo") env.define("CXX", "cl -nologo") env.define("CPP", "cl -nologo -EP") @@ -88,7 +81,7 @@ def generate(self): env.define("OBJDUMP", ":") env.define("RANLIB", ":") env.define("STRIP", ":") - env.vars(self).save_script("conanbuild_univalue_msvc") + tc.generate(env) def build(self): apply_conandata_patches(self) @@ -107,8 +100,7 @@ def build(self): def package(self): 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)}"]) + autotools.install() 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: @@ -121,3 +113,5 @@ def package_info(self): self.cpp_info.libs = ["univalue"] if self.options.shared: self.cpp_info.defines = ["UNIVALUE_SHARED"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") diff --git a/recipes/unleash-client-cpp/all/CMakeLists.txt b/recipes/unleash-client-cpp/all/CMakeLists.txt deleted file mode 100644 index b71c882d9d33f..0000000000000 --- a/recipes/unleash-client-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/unleash-client-cpp/all/conandata.yml b/recipes/unleash-client-cpp/all/conandata.yml index 76a5bca8da701..69cfd9795a61f 100644 --- a/recipes/unleash-client-cpp/all/conandata.yml +++ b/recipes/unleash-client-cpp/all/conandata.yml @@ -1,8 +1,4 @@ sources: - "1.1.1": - url: "https://github.com/aruizs/unleash-client-cpp/archive/refs/tags/v1.1.1.tar.gz" - sha256: "2750dc231bf608910d4270ac39d83d46d25b88cc547a9d4d31f7ce4950effa7c" -patches: - "1.1.1": - - patch_file: "patches/0001-no-conan-cmake.patch" - base_path: "source_subfolder" + "1.3.0": + url: "https://github.com/aruizs/unleash-client-cpp/archive/refs/tags/v1.3.0.tar.gz" + sha256: "fa0b8d6101c6dbd08db23a3d353f386c17e9436a63d658f88c7d0b8619b8d501" diff --git a/recipes/unleash-client-cpp/all/conanfile.py b/recipes/unleash-client-cpp/all/conanfile.py index 08a60bfc378de..5c84a2f78a279 100644 --- a/recipes/unleash-client-cpp/all/conanfile.py +++ b/recipes/unleash-client-cpp/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.build import check_min_cppstd +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" +from conan.tools.scm import Version +required_conan_version = ">=1.53.0" class UnleashConan(ConanFile): name = "unleash-client-cpp" - homepage = "https://github.com/aruizs/unleash-client-cpp/" + description = "Unleash Client SDK for C++ projects." license = "MIT" url = "https://github.com/conan-io/conan-center-index" - description = "Unleash Client SDK for C++ projects." + homepage = "https://github.com/aruizs/unleash-client-cpp/" topics = ("unleash", "feature", "flag", "toggle") - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -23,17 +27,6 @@ class UnleashConan(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" - @property def _min_cppstd(self): return "17" @@ -42,75 +35,61 @@ def _min_cppstd(self): def _compilers_min_version(self): return { "Visual Studio": "15", # Should we check toolset? + "msvc": "191", "gcc": "7", "clang": "4.0", "apple-clang": "3.8", "intel": "17", } - 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.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("cpr/1.7.2") - self.requires("nlohmann_json/3.10.5") + self.requires("cpr/1.10.5") + self.requires("nlohmann_json/3.11.3") def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.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] + check_min_cppstd(self, self._min_cppstd) min_version = self._compilers_min_version.get(str(self.settings.compiler), False) - if min_version and loose_lt_semver(str(self.settings.compiler.version), min_version): + if min_version and Version(self.settings.compiler.version) < min_version: raise ConanInvalidConfiguration( - "{} requires C++{}, which your compiler does not support.".format(self.name, self._min_cppstd) + 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], - strip_root=True, destination=self._source_subfolder) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["ENABLE_TESTING"] = False - self._cmake.definitions["ENABLE_TEST_COVERAGE"] = False - 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["ENABLE_TESTING"] = False + tc.variables["ENABLE_TESTING_COVERAGE"] = 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() + 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", self.source_folder, 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.libs = ["unleash"] self.cpp_info.set_property("cmake_file_name", "unleash") self.cpp_info.set_property("cmake_target_name", "unleash::unleash") - self.cpp_info.libs = ["unleash"] - - self.cpp_info.names["cmake_find_package"] = "unleash" - self.cpp_info.names["cmake_find_package_multi"] = "unleash" - diff --git a/recipes/unleash-client-cpp/all/patches/0001-no-conan-cmake.patch b/recipes/unleash-client-cpp/all/patches/0001-no-conan-cmake.patch deleted file mode 100644 index f88f88c81dde7..0000000000000 --- a/recipes/unleash-client-cpp/all/patches/0001-no-conan-cmake.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -25,8 +25,6 @@ if(DEFINED unleash_SHARED_LIBS) - endif() - - # External dependencies using Conan.io --include(cmake/Conan.cmake) --run_conan() - - # Create the main unleash library target - add_subdirectory(src) diff --git a/recipes/unleash-client-cpp/all/test_package/CMakeLists.txt b/recipes/unleash-client-cpp/all/test_package/CMakeLists.txt index 5dfa06d3b7057..bd4860f14d566 100644 --- a/recipes/unleash-client-cpp/all/test_package/CMakeLists.txt +++ b/recipes/unleash-client-cpp/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(unleash CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} unleash::unleash) +target_link_libraries(${PROJECT_NAME} PRIVATE unleash::unleash) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/unleash-client-cpp/all/test_package/conanfile.py b/recipes/unleash-client-cpp/all/test_package/conanfile.py index 38f4483872d47..ef5d7042163ec 100644 --- a/recipes/unleash-client-cpp/all/test_package/conanfile.py +++ b/recipes/unleash-client-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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/unleash-client-cpp/all/test_package/test_package.cpp b/recipes/unleash-client-cpp/all/test_package/test_package.cpp index 9af855c3e03d7..1eaf68256bc88 100644 --- a/recipes/unleash-client-cpp/all/test_package/test_package.cpp +++ b/recipes/unleash-client-cpp/all/test_package/test_package.cpp @@ -1,10 +1,11 @@ #include +#include +#include #include int main() { unleash::UnleashClient unleashClient = unleash::UnleashClient::create("production", "https://www.apple.com/%"); - unleashClient.initializeClient(); - return unleashClient.isEnabled("feature.toogle"); - + std::cout << "feature.toggle - is enabled: " << std::boolalpha << unleashClient.isEnabled("feature.toogle") << '\n'; + return 0; } diff --git a/recipes/unleash-client-cpp/config.yml b/recipes/unleash-client-cpp/config.yml index 60d31991f5141..426a0e4c79e9b 100644 --- a/recipes/unleash-client-cpp/config.yml +++ b/recipes/unleash-client-cpp/config.yml @@ -1,3 +1,3 @@ versions: - "1.1.1": + "1.3.0": folder: all diff --git a/recipes/unordered_dense/all/conandata.yml b/recipes/unordered_dense/all/conandata.yml index d1960fdae4ca4..86e169e3f5d8e 100644 --- a/recipes/unordered_dense/all/conandata.yml +++ b/recipes/unordered_dense/all/conandata.yml @@ -1,22 +1,43 @@ sources: - "3.0.0": - url: "https://github.com/martinus/unordered_dense/archive/v3.0.0.tar.gz" - sha256: "e73452d7c1e274b4a15b553c0904f1de4bcfa61b00514acd1eaad7deac805ef0" + "4.4.0": + url: "https://github.com/martinus/unordered_dense/archive/v4.4.0.tar.gz" + sha256: "3976399793e8cb4db1409ce15610fbd9e5e406ced4745f262d393a9311efbd88" + "4.3.1": + url: "https://github.com/martinus/unordered_dense/archive/v4.3.1.tar.gz" + sha256: "ff069b0b7697a3601cd674e4a4405edc6ec1d60a5cc3e7fff18db9e24ecc8ec3" + "4.3.0": + url: "https://github.com/martinus/unordered_dense/archive/v4.3.0.tar.gz" + sha256: "c8ffaf5277dd5c29871cc6359af7823c8137158d47511dd00c8193af84906b9c" + "4.1.2": + url: "https://github.com/martinus/unordered_dense/archive/v4.1.2.tar.gz" + sha256: "300410dbcd32800f83b2113dfecbdfe8cd256caa4cfeb117d646021d6e3209ae" + "4.1.0": + url: "https://github.com/martinus/unordered_dense/archive/v4.1.0.tar.gz" + sha256: "0f594cb3b08fc657db3843139000005b6827e5c69d00f5c8d74c1239bd21746f" + "4.0.4": + url: "https://github.com/martinus/unordered_dense/archive/v4.0.4.tar.gz" + sha256: "b34a8c942963e3a647f1bbc192a6391cd56d7ae615b2ddc1601c1779b5792206" + "4.0.1": + url: "https://github.com/martinus/unordered_dense/archive/v4.0.1.tar.gz" + sha256: "6c8be4f76fed592f8c1ae07ce07eaa8749ed3a929a84a502764564dcbcc53a76" + "4.0.0": + url: "https://github.com/martinus/unordered_dense/archive/v4.0.0.tar.gz" + sha256: "c9d43bfc60ed03e9aa667bc6d3c586f7a04dfb0082333b0e50624aac71c53172" + "3.1.1": + url: "https://github.com/martinus/unordered_dense/archive/v3.1.1.tar.gz" + sha256: "634194cec08f6a41aa72ed4804719cdf8ba94f9ba8575bf7a80496a33dfbbb12" + "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" "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 index 574ac33f1668f..a0da7f7d17e30 100644 --- a/recipes/unordered_dense/all/conanfile.py +++ b/recipes/unordered_dense/all/conanfile.py @@ -17,6 +17,7 @@ class PackageConan(ConanFile): 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") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -41,15 +42,14 @@ def package_id(self): self.info.clear() def validate(self): - if self.info.settings.get_safe("compiler.cppstd"): + 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def build(self): pass diff --git a/recipes/unordered_dense/config.yml b/recipes/unordered_dense/config.yml index de31902ca2258..10a6f06d5e35d 100644 --- a/recipes/unordered_dense/config.yml +++ b/recipes/unordered_dense/config.yml @@ -1,15 +1,29 @@ versions: - "3.0.0": + "4.4.0": folder: all - "2.0.1": + "4.3.1": folder: all - "2.0.0": + "4.3.0": folder: all - "1.4.0": + "4.1.2": folder: all - "1.3.3": + "4.1.0": + folder: all + "4.0.4": + folder: all + "4.0.1": + folder: all + "4.0.0": + folder: all + "3.1.1": folder: all - "1.3.2": + "3.1.0": folder: all - "1.3.1": + "3.0.2": + folder: all + "2.0.1": + folder: all + "1.4.0": + folder: all + "1.3.3": folder: all diff --git a/recipes/unqlite/all/conanfile.py b/recipes/unqlite/all/conanfile.py index 5d9c43417f4e1..b9783b0fc81d0 100644 --- a/recipes/unqlite/all/conanfile.py +++ b/recipes/unqlite/all/conanfile.py @@ -3,17 +3,17 @@ from conan.tools.files import copy, get import os -required_conan_version = ">=1.46.0" +required_conan_version = ">=1.53.0" class UnqliteConan(ConanFile): name = "unqlite" description = "An Embedded NoSQL, Transactional Database Engine." license = "BSD-2-Clause" - topics = ("unqlite", "nosql", "database", "transactional", "storage") + topics = ("nosql", "database", "transactional", "storage") homepage = "https://unqlite.org" url = "https://github.com/conan-io/conan-center-index" - + package_type = "static-library" settings = "os", "arch", "compiler", "build_type" options = { "fPIC": [True, False], @@ -27,21 +27,14 @@ def config_options(self): 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 + 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/unqlite/all/test_package/conanfile.py b/recipes/unqlite/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/unqlite/all/test_package/conanfile.py +++ b/recipes/unqlite/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/unqlite/all/test_v1_package/CMakeLists.txt b/recipes/unqlite/all/test_v1_package/CMakeLists.txt index 1b71e991cf942..0d20897301b68 100644 --- a/recipes/unqlite/all/test_v1_package/CMakeLists.txt +++ b/recipes/unqlite/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(unqlite REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE unqlite::unqlite) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/unqlite/all/test_v1_package/conanfile.py b/recipes/unqlite/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/unqlite/all/test_v1_package/conanfile.py +++ b/recipes/unqlite/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/upx/all/conandata.yml b/recipes/upx/all/conandata.yml index e774dc1feea4d..1f17ad4f588bc 100644 --- a/recipes/upx/all/conandata.yml +++ b/recipes/upx/all/conandata.yml @@ -1,4 +1,28 @@ sources: + "4.2.1": + "Linux": + "x86_64": + url: "https://github.com/upx/upx/releases/download/v4.2.1/upx-4.2.1-amd64_linux.tar.xz" + sha256: "936e67a23d72338dad3304526a29f405e44e440a9983bbdb2566657d015cc56d" + "armv8": + url: "https://github.com/upx/upx/releases/download/v4.2.1/upx-4.2.1-arm64_linux.tar.xz" + sha256: "922b4d021a1fdd68a883d9c837b09035317c9a52e8087403bd0d1b062c006f22" + "armv7": + url: "https://github.com/upx/upx/releases/download/v4.2.1/upx-4.2.1-arm_linux.tar.xz" + sha256: "0ea0ca497b8fd4ecfd9201d100a0fde251214042b09d5e070c3435aae75913e0" + "ppc32": + url: "https://github.com/upx/upx/releases/download/v4.2.1/upx-4.2.1-powerpc_linux.tar.xz" + sha256: "c96b6c196c31e2d78a4095d1a4c0b1a22050a2141d40c9387806d14d7ed75035" + "ppc64le": + url: "https://github.com/upx/upx/releases/download/v4.2.1/upx-4.2.1-powerpc64le_linux.tar.xz" + sha256: "3f683b6de4e25c135c8ff7c91f116514b6cb30834a9708f4516b897502f6d34a" + "Windows": + "x86": + url: "https://github.com/upx/upx/releases/download/v4.2.1/upx-4.2.1-win32.zip" + sha256: "475504d9b2ae5fd9ede27919ee3b3fa8869a1398645c1239fc19193022054268" + "x86_64": + url: "https://github.com/upx/upx/releases/download/v4.2.1/upx-4.2.1-win64.zip" + sha256: "b6e20e35303a390c3b1211f5ed0559def2c34ec5774176bb22afee19b35b2138" "3.96": "Linux": "x86_64": diff --git a/recipes/upx/all/conanfile.py b/recipes/upx/all/conanfile.py index ebbe1deba6846..4a0f911cedf71 100644 --- a/recipes/upx/all/conanfile.py +++ b/recipes/upx/all/conanfile.py @@ -1,23 +1,29 @@ -from conans import ConanFile, CMake, 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.files import copy, get + +required_conan_version = ">=1.47.0" class UPXConan(ConanFile): name = "upx" description = "UPX - the Ultimate Packer for eXecutables " - license = "GPL-2.0-or-later", "special-exception-for-compressed-executables" + license = ("GPL-2.0-or-later", "special-exception-for-compressed-executables") url = "https://github.com/conan-io/conan-center-index" homepage = "https://upx.github.io/" - topics = ("packer", "executable", "compression", "size", "reduction", "small", "footprintt") - no_copy_source = True - settings = "os", "arch" + topics = ("packer", "executable", "compression", "size", "reduction", "small", "footprintt", "pre-built") + + package_type = "application" + settings = "os", "arch", "compiler", "build_type" + + def layout(self): + pass - @property - def _source_subfolder(self): - return "source_subfolder" + def package_id(self): + del self.info.settings.compiler + del self.info.settings.build_type def _conan_data_sources(self): # Don't surround this with try/catch to catch unknown versions @@ -32,24 +38,32 @@ def validate(self): raise ConanInvalidConfiguration(f"This recipe has no upx binary for os/arch={self.settings.os}/{self.settings.arch}") def build(self): - tools.get(**self._conan_data_sources(), - destination=self._source_subfolder, strip_root=True) + get(self, **self._conan_data_sources(), strip_root=True) def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - self.copy("COPYING", src=self._source_subfolder, dst="licenses") - if self.settings.os == "Windows": - self.copy("upx.exe", src=self._source_subfolder, dst="bin") - else: - self.copy("upx", src=self._source_subfolder, dst="bin") + copy(self, "LICENSE", + src=self.source_folder, + dst=os.path.join(self.package_folder, "licenses")) + copy(self, "COPYING", + src=self.source_folder, + dst=os.path.join(self.package_folder, "licenses")) + extension = ".exe" if self.settings.os == "Windows" else "" + copy(self, f"upx{extension}", + src=self.source_folder, + dst=os.path.join(self.package_folder, "bin")) def package_info(self): + self.cpp_info.frameworkdirs = [] + self.cpp_info.resdirs = [] + self.cpp_info.includedirs = [] self.cpp_info.libdirs = [] 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) - bin_ext = ".exe" if self.settings.os == "Windows" else "" upx = os.path.join(bin_path, f"upx{bin_ext}") + self.conf_info.define("user.upx:upx", upx) + + # TODO: to remove in conan v2 + self.output.info(f"Appending PATH environment variable: {bin_path}") + self.env_info.PATH.append(bin_path) self.user_info.upx = upx diff --git a/recipes/upx/all/test_package/CMakeLists.txt b/recipes/upx/all/test_package/CMakeLists.txt index f31cfe1e1aa8e..e58a04fd19cf1 100644 --- a/recipes/upx/all/test_package/CMakeLists.txt +++ b/recipes/upx/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package C) if(CMAKE_C_COMPILER_ID MATCHES "AppleClang|Clang|GNU") add_link_options(-static) endif() -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - add_executable(${PROJECT_NAME} test_package.c) diff --git a/recipes/upx/all/test_package/conanfile.py b/recipes/upx/all/test_package/conanfile.py index 8274c17267c14..8d1367a88209a 100644 --- a/recipes/upx/all/test_package/conanfile.py +++ b/recipes/upx/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 build_requirements(self): + self.tool_requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,21 +21,20 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self, skip_x64_x86=True): + if can_run(self): bin_ext = ".exe" if self.settings.os == "Windows" else "" - bin_path = os.path.join("bin", f"test_package{bin_ext}") + bin_path = os.path.join(self.cpp.build.bindir, f"test_package{bin_ext}") - upx_bin = self.deps_user_info["upx"].upx - self.run(f"{upx_bin} --help", run_environment=True) + self.run(f"upx --help") original_size = os.stat(bin_path).st_size - self.run(f"{upx_bin} {bin_path}", run_environment=True) + self.run(f"upx {bin_path}") packed_size = os.stat(bin_path).st_size # Run the packed executable to see whether it still works - self.run(bin_path, run_environment=True) + self.run(bin_path, env="conanrun") self.output.info(f"File: {bin_path}") self.output.info(f"Original size: {original_size:>9}") diff --git a/recipes/upx/all/test_package/test_package.c b/recipes/upx/all/test_package/test_package.c index 725533f119f42..f81e0540072d7 100644 --- a/recipes/upx/all/test_package/test_package.c +++ b/recipes/upx/all/test_package/test_package.c @@ -1,6 +1,6 @@ #include -int main(int argc, char *argv[]) { +int main() { puts("Hello world!"); return 0; } diff --git a/recipes/upx/all/test_v1_package/CMakeLists.txt b/recipes/upx/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/upx/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/upx/all/test_v1_package/conanfile.py b/recipes/upx/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..2b7a8250c9937 --- /dev/null +++ b/recipes/upx/all/test_v1_package/conanfile.py @@ -0,0 +1,35 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "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_ext = ".exe" if self.settings.os == "Windows" else "" + bin_path = os.path.join("bin", f"test_package{bin_ext}") + + upx_bin = self.deps_user_info["upx"].upx + self.run(f"{upx_bin} --help", run_environment=True) + + original_size = os.stat(bin_path).st_size + + self.run(f"{upx_bin} {bin_path}", run_environment=True) + + packed_size = os.stat(bin_path).st_size + + # Run the packed executable to see whether it still works + self.run(bin_path, run_environment=True) + + self.output.info(f"File: {bin_path}") + self.output.info(f"Original size: {original_size:>9}") + self.output.info(f"Packed size: {packed_size:>9}") + self.output.info(f" ---------") + self.output.info(f"Size diff: {original_size-packed_size:>9}") diff --git a/recipes/upx/config.yml b/recipes/upx/config.yml index ec9befdb55388..417ec321f784d 100644 --- a/recipes/upx/config.yml +++ b/recipes/upx/config.yml @@ -1,3 +1,5 @@ versions: + "4.2.1": + folder: all "3.96": folder: all diff --git a/recipes/urdfdom/all/conandata.yml b/recipes/urdfdom/all/conandata.yml new file mode 100644 index 0000000000000..c8d87b45ad9b0 --- /dev/null +++ b/recipes/urdfdom/all/conandata.yml @@ -0,0 +1,36 @@ +sources: + "4.0.0": + urdfdom: + url: "https://github.com/ros/urdfdom/archive/refs/tags/4.0.0.tar.gz" + sha256: "9848d106dc88dc0b907d5667c09da3ca53241fbcf17e982d8c234fe3e0d6ddcc" + urdfdom_headers: + url: "https://github.com/ros/urdfdom_headers/archive/refs/tags/1.1.1.zip" + sha256: "dde77e3dd96ffa41e2ee0a20bddcd6ef05863e95ce0143ede77130d8cd46c644" + "3.1.1": + urdfdom: + url: "https://github.com/ros/urdfdom/archive/refs/tags/3.1.1.tar.gz" + sha256: "dd69b2077b8fc1bd2b67022c1dc861cd896ac882df065aa08cabdf2f945a9ac0" + urdfdom_headers: + # Latest unreleased version from 2023-04-25. + # Identical to the latest v1.0.5 release, except headers have been conveniently moved to include/. + # We merge the headers into the main source tree instead of packaging them separately. + url: "https://github.com/ros/urdfdom_headers/archive/1fd21b64ed78493508a174f98af982605d1e4607.zip" + sha256: "aba42c1c83d6d1fb94e54ec84680a8b9e2417337fbaa85424da0e069d0cc89b6" +patches: + "4.0.0": + - patch_file: "patches/4.0.0/001-optional-build-apps.patch" + patch_type: "conan" + patch_description: "Disable building of apps by default" + - patch_file: "patches/4.0.0/002-use-conan-dependencies.patch" + patch_type: "conan" + patch_description: "Use dependencies from Conan, use merged urdfdom_headers" + "3.1.1": + - patch_file: "patches/3.1.1/001-optional-build-apps.patch" + patch_type: "conan" + patch_description: "Disable building of apps by default" + - patch_file: "patches/3.1.1/002-use-conan-dependencies.patch" + patch_type: "conan" + patch_description: "Use dependencies (console_bridge, TinyXML) from Conan" + - patch_file: "patches/3.1.1/003-use-merged-urdfdom_headers.patch" + patch_type: "conan" + patch_description: "Use merged urdfdom_headers instead of a separate package" diff --git a/recipes/urdfdom/all/conanfile.py b/recipes/urdfdom/all/conanfile.py new file mode 100644 index 0000000000000..92fdbe4fc111e --- /dev/null +++ b/recipes/urdfdom/all/conanfile.py @@ -0,0 +1,115 @@ +import os + +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, replace_in_file, rm, rmdir +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" + + +class PackageConan(ConanFile): + name = "urdfdom" + description = "Data structures and parsers to access URDF files using the DOM model" + license = "BSD-3-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/ros/urdfdom" + topics = ("urdf", "ros", "robotics") + package_type = "library" + 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 + + 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 Version(self.version) >= "4.0": + self.requires("tinyxml2/10.0.0", transitive_headers=True, transitive_libs=True) + else: + self.requires("tinyxml/2.6.2", transitive_headers=True, transitive_libs=True) + self.requires("console_bridge/1.0.2") + + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + + def source(self): + # urdfdom packages its headers separately as urdfdom_headers. + # There is no obvious benefit of doing the same for the Conan package, + # so we simply merge the headers into the main source tree. + sources = self.conan_data["sources"][self.version] + get(self, **sources["urdfdom_headers"], strip_root=True, + destination=os.path.join(self.source_folder, "urdf_parser")) + get(self, **sources["urdfdom"], strip_root=True, destination=self.source_folder) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["APPEND_PROJECT_NAME_TO_INCLUDEDIR"] = False + tc.variables["BUILD_TESTING"] = False + tc.variables["BUILD_APPS"] = False + if not self.options.shared: + tc.preprocessor_definitions["URDFDOM_STATIC"] = "1" + # Need to set CMP0077 because CMake policy version is too old (3.5 as of v4.0.0) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() + CMakeDeps(self).generate() + + def _patch_sources(self): + apply_conandata_patches(self) + # Do not hard-code libraries to SHARED + parser_cmakelists = os.path.join(self.source_folder, "urdf_parser", "CMakeLists.txt") + replace_in_file(self, parser_cmakelists, " SHARED", "") + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + # Copy urdfdom_headers + copy(self, "*", + src=os.path.join(self.source_folder, "urdf_parser", "include"), + dst=os.path.join(self.package_folder, "include")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "urdfdom")) + rmdir(self, os.path.join(self.package_folder, "CMake")) + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "*.pdb", self.package_folder, recursive=True) + + def package_info(self): + self.cpp_info.libs = [ + "urdfdom_model", + "urdfdom_model_state", + "urdfdom_sensor", + "urdfdom_world", + ] + + if not self.options.shared: + self.cpp_info.defines.append("URDFDOM_STATIC=1") diff --git a/recipes/urdfdom/all/patches/3.1.1/001-optional-build-apps.patch b/recipes/urdfdom/all/patches/3.1.1/001-optional-build-apps.patch new file mode 100644 index 0000000000000..a89c2b010b26c --- /dev/null +++ b/recipes/urdfdom/all/patches/3.1.1/001-optional-build-apps.patch @@ -0,0 +1,34 @@ +--- a/urdf_parser/CMakeLists.txt ++++ b/urdf_parser/CMakeLists.txt +@@ -80,6 +78,7 @@ + + # -------------------------------- + ++if(BUILD_APPS) + add_executable(check_urdf src/check_urdf.cpp) + target_include_directories(check_urdf PUBLIC include) + target_link_libraries(check_urdf urdfdom_model urdfdom_world) +@@ -96,6 +95,7 @@ + add_executable(urdf_mem_test test/memtest.cpp) + target_include_directories(urdf_mem_test PUBLIC include) + target_link_libraries(urdf_mem_test urdfdom_model) ++endif() + + include(CTest) + if(BUILD_TESTING) +@@ -103,6 +103,7 @@ + add_subdirectory(test) + endif() + ++if(BUILD_APPS) + INSTALL( + TARGETS + check_urdf +@@ -113,6 +114,7 @@ + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + ) ++endif() + INSTALL( + TARGETS + urdfdom_model diff --git a/recipes/urdfdom/all/patches/3.1.1/002-use-conan-dependencies.patch b/recipes/urdfdom/all/patches/3.1.1/002-use-conan-dependencies.patch new file mode 100644 index 0000000000000..47e25f1f27284 --- /dev/null +++ b/recipes/urdfdom/all/patches/3.1.1/002-use-conan-dependencies.patch @@ -0,0 +1,48 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +--- a/CMakeLists.txt (revision 1ed7ca95b917f38feb4ff7bd1aa033baf2cfce0e) ++++ b/CMakeLists.txt (revision 6592c04e28cb59b8e9ac5944e3229c50d706a2ee) +@@ -45,19 +45,9 @@ + + set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") + +-find_package(tinyxml_vendor QUIET) +-find_package(TinyXML) +-# bionic has not cmake module, workaround +-if (NOT TinyXML_FOUND AND UNIX) +- include(FindPkgConfig) +- pkg_check_modules (TinyXML tinyxml) +-else() +- # Make it fail in platforms without pkgconfig +- find_package(TinyXML REQUIRED) # bionic has not cmake module +-endif() ++find_package(tinyxml REQUIRED CONFIG) + find_package(urdfdom_headers 1.0 REQUIRED) +-find_package(console_bridge_vendor QUIET) # Provides console_bridge 0.4.0 on platforms without it. +-find_package(console_bridge REQUIRED) ++find_package(console_bridge REQUIRED CONFIG) + + # Control where libraries and executables are placed during the build + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}") + +diff --git a/urdf_parser/CMakeLists.txt b/urdf_parser/CMakeLists.txt +--- a/urdf_parser/CMakeLists.txt (revision 1ed7ca95b917f38feb4ff7bd1aa033baf2cfce0e) ++++ b/urdf_parser/CMakeLists.txt (revision 6592c04e28cb59b8e9ac5944e3229c50d706a2ee) +@@ -5,8 +5,6 @@ + + add_library(${add_urdfdom_library_LIBNAME} SHARED + ${add_urdfdom_library_SOURCES}) +- target_include_directories(${add_urdfdom_library_LIBNAME} SYSTEM PUBLIC +- ${TinyXML_INCLUDE_DIRS}) + target_include_directories(${add_urdfdom_library_LIBNAME} PUBLIC + "$" + "$") +@@ -14,7 +12,7 @@ + ${add_urdfdom_library_LINK} + ${console_bridge_link_libs} + ${urdfdom_headers_link_libs} +- ${TinyXML_LIBRARIES}) ++ tinyxml::tinyxml) + if(NOT CMAKE_CXX_STANDARD) + target_compile_features(${add_urdfdom_library_LIBNAME} PUBLIC cxx_std_14) + endif() + diff --git a/recipes/urdfdom/all/patches/3.1.1/003-use-merged-urdfdom_headers.patch b/recipes/urdfdom/all/patches/3.1.1/003-use-merged-urdfdom_headers.patch new file mode 100644 index 0000000000000..0fc6cb3bfaa91 --- /dev/null +++ b/recipes/urdfdom/all/patches/3.1.1/003-use-merged-urdfdom_headers.patch @@ -0,0 +1,12 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +--- a/CMakeLists.txt (revision 82fb54588f3ba5091d9a73d072559ac7061eccdf) ++++ b/CMakeLists.txt (revision 1de2b88f231fa0f7f83a028e971d4ebaed1b164c) +@@ -46,7 +46,6 @@ + set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") + + find_package(tinyxml REQUIRED CONFIG) +-find_package(urdfdom_headers 1.0 REQUIRED) + find_package(console_bridge REQUIRED CONFIG) + + # Control where libraries and executables are placed during the build + diff --git a/recipes/urdfdom/all/patches/4.0.0/001-optional-build-apps.patch b/recipes/urdfdom/all/patches/4.0.0/001-optional-build-apps.patch new file mode 100644 index 0000000000000..65518ddc352d0 --- /dev/null +++ b/recipes/urdfdom/all/patches/4.0.0/001-optional-build-apps.patch @@ -0,0 +1,34 @@ +--- urdf_parser/CMakeLists.txt ++++ urdf_parser/CMakeLists.txt +@@ -81,6 +81,7 @@ + + # -------------------------------- + ++if(BUILD_APPS) + add_executable(check_urdf src/check_urdf.cpp) + target_include_directories(check_urdf PUBLIC include) + target_link_libraries(check_urdf urdfdom_model urdfdom_world) +@@ -97,6 +98,7 @@ + add_executable(urdf_mem_test test/memtest.cpp) + target_include_directories(urdf_mem_test PUBLIC include) + target_link_libraries(urdf_mem_test urdfdom_model) ++endif() + + include(CTest) + if(BUILD_TESTING) +@@ -104,6 +106,7 @@ + add_subdirectory(test) + endif() + ++if(BUILD_APPS) + INSTALL( + TARGETS + check_urdf +@@ -114,6 +117,7 @@ + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + ) ++endif() + INSTALL( + TARGETS + urdfdom_model diff --git a/recipes/urdfdom/all/patches/4.0.0/002-use-conan-dependencies.patch b/recipes/urdfdom/all/patches/4.0.0/002-use-conan-dependencies.patch new file mode 100644 index 0000000000000..9553d1b1c9713 --- /dev/null +++ b/recipes/urdfdom/all/patches/4.0.0/002-use-conan-dependencies.patch @@ -0,0 +1,14 @@ +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -45,11 +45,8 @@ + + list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") + +-find_package(tinyxml2_vendor QUIET) + find_package(TinyXML2 REQUIRED) + +-find_package(urdfdom_headers 1.0 REQUIRED) +-find_package(console_bridge_vendor QUIET) # Provides console_bridge 0.4.0 on platforms without it. + find_package(console_bridge REQUIRED) + + # Control where libraries and executables are placed during the build diff --git a/recipes/urdfdom/all/test_package/CMakeLists.txt b/recipes/urdfdom/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..2d7a881934a29 --- /dev/null +++ b/recipes/urdfdom/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package CXX) + +find_package(urdfdom REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE urdfdom::urdfdom) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/urdfdom/all/test_package/conanfile.py b/recipes/urdfdom/all/test_package/conanfile.py new file mode 100644 index 0000000000000..ef5d7042163ec --- /dev/null +++ b/recipes/urdfdom/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/urdfdom/all/test_package/test_package.cpp b/recipes/urdfdom/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..a7e4a0d704e35 --- /dev/null +++ b/recipes/urdfdom/all/test_package/test_package.cpp @@ -0,0 +1,15 @@ +#include +#include +#include + +#include + +int main() { + std::string test_str = + "" + " " + ""; + urdf::ModelInterfaceSharedPtr urdf = urdf::parseURDF(test_str); + std::cout << "urdf::parseURDF() ran successfully" << std::endl; + return EXIT_SUCCESS; +} diff --git a/recipes/urdfdom/config.yml b/recipes/urdfdom/config.yml new file mode 100644 index 0000000000000..1188e8479ce63 --- /dev/null +++ b/recipes/urdfdom/config.yml @@ -0,0 +1,5 @@ +versions: + "4.0.0": + folder: all + "3.1.1": + folder: all diff --git a/recipes/urdfdom_headers/all/conandata.yml b/recipes/urdfdom_headers/all/conandata.yml new file mode 100644 index 0000000000000..9c889de9abc7d --- /dev/null +++ b/recipes/urdfdom_headers/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.1.1": + url: "https://github.com/ros/urdfdom_headers/archive/refs/tags/1.1.1.zip" + sha256: "dde77e3dd96ffa41e2ee0a20bddcd6ef05863e95ce0143ede77130d8cd46c644" diff --git a/recipes/urdfdom_headers/all/conanfile.py b/recipes/urdfdom_headers/all/conanfile.py new file mode 100644 index 0000000000000..a374540200186 --- /dev/null +++ b/recipes/urdfdom_headers/all/conanfile.py @@ -0,0 +1,44 @@ +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 PackageConan(ConanFile): + name = "urdfdom_headers" + description = "Headers for URDF parsers" + license = "BSD-3-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/ros/urdfdom_headers" + topics = ("urdf", "ros", "robotics") + + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + + 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, 11) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def package(self): + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + # Add a project prefix to the headers to match the default APPEND_PROJECT_NAME_TO_INCLUDEDIR=ON + copy(self, "*.h", + os.path.join(self.source_folder, "include"), + os.path.join(self.package_folder, "include", "urdfdom")) + + def package_info(self): + self.cpp_info.includedirs.append(os.path.join("include", "urdfdom")) + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/urdfdom_headers/all/test_package/CMakeLists.txt b/recipes/urdfdom_headers/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..733e7c8f06684 --- /dev/null +++ b/recipes/urdfdom_headers/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package CXX) + +find_package(urdfdom_headers REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE urdfdom_headers::urdfdom_headers) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/urdfdom_headers/all/test_package/conanfile.py b/recipes/urdfdom_headers/all/test_package/conanfile.py new file mode 100644 index 0000000000000..ef5d7042163ec --- /dev/null +++ b/recipes/urdfdom_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_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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/urdfdom_headers/all/test_package/test_package.cpp b/recipes/urdfdom_headers/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..aa515bd58ffb9 --- /dev/null +++ b/recipes/urdfdom_headers/all/test_package/test_package.cpp @@ -0,0 +1,6 @@ +#include + +int main() { + urdf::World world; + return 0; +} diff --git a/recipes/urdfdom_headers/config.yml b/recipes/urdfdom_headers/config.yml new file mode 100644 index 0000000000000..60d31991f5141 --- /dev/null +++ b/recipes/urdfdom_headers/config.yml @@ -0,0 +1,3 @@ +versions: + "1.1.1": + folder: all diff --git a/recipes/uriparser/all/conandata.yml b/recipes/uriparser/all/conandata.yml index 2e0f68c6098de..e42d123f7e6e6 100644 --- a/recipes/uriparser/all/conandata.yml +++ b/recipes/uriparser/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.9.8": + url: "https://github.com/uriparser/uriparser/releases/download/uriparser-0.9.8/uriparser-0.9.8.tar.xz" + sha256: "1d71c054837ea32a31e462bce5a1af272379ecf511e33448e88100b87ff73b2e" "0.9.7": url: "https://github.com/uriparser/uriparser/releases/download/uriparser-0.9.7/uriparser-0.9.7.tar.xz" sha256: "1ddae35cb3cc2c36e8199829d46f1c7f8b222e74a723fdae67ec8561e1ac5a39" diff --git a/recipes/uriparser/all/conanfile.py b/recipes/uriparser/all/conanfile.py index 79bc7cd3ce078..c8edbccee9815 100644 --- a/recipes/uriparser/all/conanfile.py +++ b/recipes/uriparser/all/conanfile.py @@ -4,17 +4,17 @@ from conan.tools.microsoft import is_msvc, msvc_runtime_flag import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.54.0" class UriparserConan(ConanFile): name = "uriparser" description = "Strictly RFC 3986 compliant URI parsing and handling library written in C89" - topics = ("uriparser", "uri", "parser") + license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://uriparser.github.io/" - - license = "BSD-3-Clause" + topics = ("uri", "parser") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -38,25 +38,15 @@ def config_options(self): 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 + 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) @@ -67,8 +57,6 @@ def generate(self): tc.variables["URIPARSER_BUILD_WCHAR"] = self.options.with_wchar if is_msvc(self): tc.variables["URIPARSER_MSVC_RUNTIME"] = f"/{msvc_runtime_flag(self)}" - # Honor BUILD_SHARED_LIBS (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/uriparser/all/test_v1_package/CMakeLists.txt b/recipes/uriparser/all/test_v1_package/CMakeLists.txt index e330dcdb828b1..0d20897301b68 100644 --- a/recipes/uriparser/all/test_v1_package/CMakeLists.txt +++ b/recipes/uriparser/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(uriparser REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE uriparser::uriparser) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/uriparser/config.yml b/recipes/uriparser/config.yml index 983b5479ac5be..42a189b84f1e9 100644 --- a/recipes/uriparser/config.yml +++ b/recipes/uriparser/config.yml @@ -1,4 +1,6 @@ versions: + "0.9.8": + folder: "all" "0.9.7": folder: "all" "0.9.6": diff --git a/recipes/userspace-rcu/all/conandata.yml b/recipes/userspace-rcu/all/conandata.yml index 570705edb2dd6..63079c64c1840 100644 --- a/recipes/userspace-rcu/all/conandata.yml +++ b/recipes/userspace-rcu/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.14.0": + url: "https://github.com/urcu/userspace-rcu/archive/refs/tags/v0.14.0.tar.gz" + sha256: "42fb5129a3fffe5a4b790dfe1ea3a734c69ee095fefbf649326269bba94c262d" "0.11.4": - sha256: d995598482221587ff6753d2a8da6ac74ff0fa79fbea29ccee196f295834531d - url: https://github.com/urcu/userspace-rcu/archive/refs/tags/v0.11.4.tar.gz + url: "https://github.com/urcu/userspace-rcu/archive/refs/tags/v0.11.4.tar.gz" + sha256: "d995598482221587ff6753d2a8da6ac74ff0fa79fbea29ccee196f295834531d" diff --git a/recipes/userspace-rcu/all/conanfile.py b/recipes/userspace-rcu/all/conanfile.py index ad697812f9c26..bc82bbc3b711b 100644 --- a/recipes/userspace-rcu/all/conanfile.py +++ b/recipes/userspace-rcu/all/conanfile.py @@ -1,28 +1,25 @@ import os -from conans import ConanFile, AutoToolsBuildEnvironment, tools -from conan.tools.files import get, rmdir -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 chdir, copy, get, rm, 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 UserspaceRCUConan(ConanFile): name = "userspace-rcu" - homepage ="https://liburcu.org/" description = "Userspace RCU (read-copy-update) library" - topics = ("urcu") - url = "https://github.com/conan-io/conan-center-index" license = "LGPL-2.1" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://liburcu.org/" + topics = "urcu" - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - settings = "os", "compiler", "build_type", "arch" - + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -31,65 +28,58 @@ def _source_subfolder(self): "shared": False, "fPIC": True, } - build_requires = ( - "libtool/2.4.6", - ) - generators = "PkgConfigDeps" + def configure(self): + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + basic_layout(self, src_folder="src") def validate(self): if self.settings.os not in ["Linux", "FreeBSD", "Macos"]: - raise ConanInvalidConfiguration("Building for {} unsupported".format(self.settings.os)) + raise ConanInvalidConfiguration(f"Building for {self.settings.os} unsupported") + if self.version == "0.11.4" and self.settings.compiler == "apple-clang": + # Fails with "cds_hlist_add_head_rcu.c:19:10: fatal error: 'urcu/urcu-memb.h' file not found" + raise ConanInvalidConfiguration(f"{self.ref} is not compatible with apple-clang") - def configure(self): - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd - if self.options.shared: - del self.options.fPIC + def build_requirements(self): + self.tool_requires("libtool/2.4.7") def source(self): - get(self, **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" - 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], strip_root=True) + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + tc = AutotoolsToolchain(self) + tc.generate() def build(self): - with tools.chdir(self._source_subfolder): - self.run("./bootstrap") - autotools = self._configure_autotools() + autotools = Autotools(self) + autotools.autoreconf() + autotools.configure() autotools.make() def package(self): - self.copy(pattern="LICENSE*", src=self._source_subfolder, dst="licenses") - autotools = self._configure_autotools() + copy(self, "LICENSE*", + 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") + rm(self, "*.la", self.package_folder, 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): for lib_type in ["", "-bp", "-cds", "-mb", "-memb", "-qsbr", "-signal"]: - component_name = "urcu{}".format(lib_type) + component_name = f"urcu{lib_type}" self.cpp_info.components[component_name].libs = ["urcu-common", component_name] self.cpp_info.components[component_name].set_property("pkg_config_name", component_name) - self.cpp_info.components[component_name].names["pkg_config"] = component_name - # todo Remove in Conan version 1.50.0 where these are set by default for the PkgConfigDeps generator. - self.cpp_info.components[component_name].includedirs = ["include"] - self.cpp_info.components[component_name].libdirs = ["lib"] - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components[component_name].system_libs = ["pthread"] # Some definitions needed for MB and Signal variants diff --git a/recipes/userspace-rcu/all/test_package/CMakeLists.txt b/recipes/userspace-rcu/all/test_package/CMakeLists.txt index 2afe258693778..3dbdbb9223703 100644 --- a/recipes/userspace-rcu/all/test_package/CMakeLists.txt +++ b/recipes/userspace-rcu/all/test_package/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.15) -project(test_package) +project(test_package LANGUAGES C) find_package(userspace-rcu COMPONENTS urcu REQUIRED) diff --git a/recipes/userspace-rcu/all/test_package/conanfile.py b/recipes/userspace-rcu/all/test_package/conanfile.py index 78d6ce7aad715..28dc52eddfee5 100644 --- a/recipes/userspace-rcu/all/test_package/conanfile.py +++ b/recipes/userspace-rcu/all/test_package/conanfile.py @@ -1,15 +1,23 @@ +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 -from conan.tools.build import cross_building class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" 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(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -17,6 +25,7 @@ def build(self): cmake.build() def test(self): - if not cross_building(self): + if can_run(self): for test in ["", "-mb", "-signal"]: - self.run("test_package{}".format(test), run_environment=True) + bin_path = os.path.join(self.cpp.build.bindir, f"test_package{test}") + self.run(bin_path, env="conanrun") diff --git a/recipes/userspace-rcu/all/test_v1_package/CMakeLists.txt b/recipes/userspace-rcu/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/userspace-rcu/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/userspace-rcu/all/test_v1_package/conanfile.py b/recipes/userspace-rcu/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..a8ac0984771ba --- /dev/null +++ b/recipes/userspace-rcu/all/test_v1_package/conanfile.py @@ -0,0 +1,23 @@ +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 configure(self): + del self.settings.compiler.libcxx + del self.settings.compiler.cppstd + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + for test in ["", "-mb", "-signal"]: + bin_path = os.path.join("bin", f"test_package{test}") + self.run(bin_path, run_environment=True) diff --git a/recipes/userspace-rcu/config.yml b/recipes/userspace-rcu/config.yml index 813707cc5417d..8246204055b2f 100644 --- a/recipes/userspace-rcu/config.yml +++ b/recipes/userspace-rcu/config.yml @@ -1,3 +1,5 @@ versions: + "0.14.0": + folder: all "0.11.4": folder: all diff --git a/recipes/usockets/all/conandata.yml b/recipes/usockets/all/conandata.yml index c851ea9d76dea..3fbcf6ef2a19d 100644 --- a/recipes/usockets/all/conandata.yml +++ b/recipes/usockets/all/conandata.yml @@ -1,4 +1,19 @@ sources: + "0.8.8": + url: "https://github.com/uNetworking/uSockets/archive/v0.8.8.tar.gz" + sha256: "d14d2efe1df767dbebfb8d6f5b52aa952faf66b30c822fbe464debaa0c5c0b17" + "0.8.7": + url: "https://github.com/uNetworking/uSockets/archive/v0.8.7.tar.gz" + sha256: "920313a2ae42bbda17bded6fc83b3df635af24cc9abefc87905ad60fdc596edf" + "0.8.6": + url: "https://github.com/uNetworking/uSockets/archive/v0.8.6.tar.gz" + sha256: "16eba133dd33eade2f5f8dd87612c04b5dd711066e0471c60d641a2f6a988f16" + "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" @@ -15,48 +30,58 @@ sources: url: "https://github.com/uNetworking/uSockets/archive/v0.4.0.tar.gz" sha256: "f9f15b395def578cc79a5b32abc64fa9cff5dac873062911f515b984b90f7cc2" patches: + "0.8.8": + - patch_file: "patches/0001-makefile_0.8.6.patch" + patch_description: "remove lto options" + patch_type: "portability" + "0.8.7": + - patch_file: "patches/0001-makefile_0.8.6.patch" + patch_description: "remove lto options" + patch_type: "portability" + "0.8.6": + - patch_file: "patches/0001-makefile_0.8.6.patch" + patch_description: "remove lto options" + patch_type: "portability" + "0.8.5": + - patch_file: "patches/0001-makefile_0.8.3.patch" + patch_description: "remove lto options" + patch_type: "portability" + "0.8.3": + - patch_file: "patches/0001-makefile_0.8.3.patch" + 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" 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" patch_description: "build static library" patch_type: "conan" "0.4.0": - patch_file: "patches/0001-makefile.patch" - base_path: "source_subfolder" 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 265bb2485b4dc..0d84532828398 100644 --- a/recipes/usockets/all/conanfile.py +++ b/recipes/usockets/all/conanfile.py @@ -1,13 +1,16 @@ from conan import ConanFile -from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir, chdir +from conan.errors import ConanInvalidConfiguration from conan.tools.build import check_min_cppstd +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir, chdir, replace_in_file +from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, unix_path, MSBuild, MSBuildDeps, MSBuildToolchain from conan.tools.scm import Version -from conan.errors import ConanInvalidConfiguration -from conans import MSBuild, AutoToolsBuildEnvironment import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.57.0" class UsocketsConan(ConanFile): name = "usockets" @@ -16,6 +19,7 @@ class UsocketsConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/uNetworking/uSockets" topics = ("socket", "network", "web") + package_type = "static-library" settings = "os", "arch", "compiler", "build_type" options = { "fPIC": [True, False], @@ -29,37 +33,42 @@ class UsocketsConan(ConanFile): } @property - def _minimum_cpp_standard(self): - version = False + def _min_cppstd(self): if self.options.eventloop == "boost": - version = "14" + return "14" # OpenSSL wrapper of uSockets uses C++17 features. if self.options.with_ssl == "openssl": - version = "17" + return "17" - return version + return False - def _minimum_compilers_version(self, cppstd): - standards = { + @property + def _minimum_compilers_version(self): + return { "14": { "Visual Studio": "15", + "msvc": "191", "gcc": "5", "clang": "3.4", "apple-clang": "10", }, "17": { "Visual Studio": "16", + "msvc": "192", "gcc": "7", "clang": "6", "apple-clang": "10", }, - } - return standards.get(cppstd) or {} + }.get(self._min_cppstd, {}) + + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) @property - def _source_subfolder(self): - return "source_subfolder" + def _uses_msbuild(self): + return Version(self.version) < "0.8.3" and is_msvc(self) def export_sources(self): export_conandata_patches(self) @@ -69,76 +78,133 @@ def config_options(self): del self.options.fPIC self.options.eventloop = "libuv" + def configure(self): + if not bool(self._min_cppstd): + 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_ssl == "openssl": + self.requires("openssl/[>=1.1 <4]") + elif self.options.with_ssl == "wolfssl": + self.requires("wolfssl/5.6.3") + + if self.options.eventloop == "libuv": + self.requires("libuv/1.46.0") + elif self.options.eventloop == "gcd": + self.requires("libdispatch/5.3.2") + elif self.options.eventloop == "boost": + self.requires("boost/1.83.0") + def validate(self): - if self.options.eventloop == "syscall" and self.info.settings.os == "Windows": + if self.options.eventloop == "syscall" and self.settings.os == "Windows": raise ConanInvalidConfiguration("syscall is not supported on Windows") - if self.options.eventloop == "gcd" and (self.info.settings.os != "Linux" or self.info.settings.compiler != "clang"): + if self.options.eventloop == "gcd" and not (self.settings.os == "Linux" and self.settings.compiler == "clang"): raise ConanInvalidConfiguration("eventloop=gcd is only supported on Linux with clang") 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}") + raise ConanInvalidConfiguration(f"{self.ref} doesn't support eventloop={self.options.eventloop}") 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") + raise ConanInvalidConfiguration( + f"{self.ref} doesn't support with_ssl={self.options.with_ssl}. " + "See https://github.com/uNetworking/uSockets/issues/147" + ) - if self.options.with_ssl == "wolfssl" and not self.options["wolfssl"].opensslextra: + if self.options.with_ssl == "wolfssl" and not self.dependencies["wolfssl"].options.opensslextra: raise ConanInvalidConfiguration("wolfssl needs opensslextra option enabled for usockets") - cppstd = self._minimum_cpp_standard - if not cppstd: - return + if bool(self._min_cppstd): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) - if self.info.settings.compiler.get_safe("cppstd"): - check_min_cppstd(self, cppstd) - - minimum_version = self._minimum_compilers_version(cppstd).get(str(self.info.settings.compiler), False) - if 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)) + 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." + ) - def configure(self): - 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.1s") - elif self.options.with_ssl == "wolfssl": - self.requires("wolfssl/5.3.0") - - if self.options.eventloop == "libuv": - 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.80.0") + def build_requirements(self): + if self._settings_build.os == "Windows" and not self._uses_msbuild: + 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): - 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): apply_conandata_patches(self) + if self._uses_msbuild: + vcxproj_file = os.path.join(self.source_folder, "uSockets.vcxproj") + 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"" + + replace_in_file( + self, vcxproj_file, + "v141", + f"{platform_toolset}", + ) + if import_conan_generators: + replace_in_file( + self, vcxproj_file, + '''''', + f'''{import_conan_generators}\n''', + ) + + def generate(self): + if self._uses_msbuild: + tc = MSBuildToolchain(self) + tc.generate() + deps = MSBuildDeps(self) + deps.generate() + else: + 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", 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", f"{compile_wrapper} link -nologo") + env.define("AR", f"{ar_wrapper} \"lib -nologo\"") + env.define("NM", "dumpbin -symbols") + env.define("OBJDUMP", ":") + env.define("RANLIB", ":") + env.define("STRIP", ":") + + if self.options.eventloop == "libuv": + # Workaround for: https://github.com/conan-io/conan/issues/12784 + # Otherwise AutotoolsDeps should suffice + libuv_includes = self.dependencies["libuv"].cpp_info.aggregated_components().includedirs + env.append("CPPFLAGS", " ".join([f"-I{unix_path(self, p)}" for p in libuv_includes])) + tc.generate(env) + + deps = AutotoolsDeps(self) + deps.generate() def _build_msvc(self): - with chdir(self, os.path.join(self._source_subfolder)): + with chdir(self, os.path.join(self.source_folder)): msbuild = MSBuild(self) - msbuild.build(project_file="uSockets.vcxproj", platforms={"x86": "Win32"}) + msbuild.build("uSockets.vcxproj") - def _build_configure(self): - autotools = AutoToolsBuildEnvironment(self) - autotools.fpic = self.options.get_safe("fPIC", False) - with chdir(self, self._source_subfolder): - args = [] + def _build_autotools(self): + autotools = Autotools(self) + with chdir(self, self.source_folder): + args = ["WITH_LTO=0"] if self.options.with_ssl == "openssl": args.append("WITH_OPENSSL=1") elif self.options.with_ssl == "wolfssl": @@ -151,21 +217,20 @@ def _build_configure(self): elif self.options.eventloop == "boost": args.append("WITH_ASIO=1") - 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 self._uses_msbuild: self._build_msvc() else: - self._build_configure() + self._build_autotools() def package(self): - 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._source_subfolder, keep_path=False) - copy(self, pattern="*.lib", dst=os.path.join(self.package_folder, "lib"), src=self._source_subfolder, 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, "src"), keep_path=True) + 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.source_folder, keep_path=False) # drop internal headers rmdir(self, os.path.join(self.package_folder, "include", "internal")) 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/patches/0001-makefile_0.8.6.patch b/recipes/usockets/all/patches/0001-makefile_0.8.6.patch new file mode 100644 index 0000000000000..e77691ceeac47 --- /dev/null +++ b/recipes/usockets/all/patches/0001-makefile_0.8.6.patch @@ -0,0 +1,35 @@ +diff --git a/Makefile b/Makefile +index aa874b9..d58ac0a 100644 +--- a/Makefile ++++ b/Makefile +@@ -74,10 +74,10 @@ 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 src/io_uring/*.c ++ $(CC) $(CFLAGS) $(CPPFLAGS) -O3 -c src/*.c src/eventing/*.c src/crypto/*.c src/io_uring/*.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 +@@ -88,7 +88,7 @@ ifeq ($(WITH_BORINGSSL),1) + $(CXX) $(CXXFLAGS) -std=c++17 -flto -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 +@@ -98,7 +98,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) -O3 $(CFLAGS) $(CPPFLAGS) -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 8502a8260d7ce..be191d27f55a9 100644 --- a/recipes/usockets/all/test_package/CMakeLists.txt +++ b/recipes/usockets/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ cmake_minimum_required(VERSION 3.8) project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(usockets REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/usockets/all/test_package/conanfile.py b/recipes/usockets/all/test_package/conanfile.py index 7895db93c24a6..e845ae751a301 100644 --- a/recipes/usockets/all/test_package/conanfile.py +++ b/recipes/usockets/all/test_package/conanfile.py @@ -1,12 +1,19 @@ 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_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) @@ -14,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/usockets/config.yml b/recipes/usockets/config.yml index 76b81d9ebd690..a6ec735be30d3 100644 --- a/recipes/usockets/config.yml +++ b/recipes/usockets/config.yml @@ -1,4 +1,14 @@ versions: + "0.8.8": + folder: all + "0.8.7": + folder: all + "0.8.6": + folder: all + "0.8.5": + folder: all + "0.8.3": + folder: all "0.8.2": folder: all "0.8.1": diff --git a/recipes/usrsctp/all/CMakeLists.txt b/recipes/usrsctp/all/CMakeLists.txt deleted file mode 100644 index 3bead6a0d9320..0000000000000 --- a/recipes/usrsctp/all/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -include("${CMAKE_BINARY_DIR}/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/usrsctp/all/conandata.yml b/recipes/usrsctp/all/conandata.yml index 61e799fd3d464..9dffac4dd65c9 100644 --- a/recipes/usrsctp/all/conandata.yml +++ b/recipes/usrsctp/all/conandata.yml @@ -5,4 +5,3 @@ sources: patches: "0.9.5.0": - patch_file: "patches/0001-install.patch" - base_path: "source_subfolder" diff --git a/recipes/usrsctp/all/conanfile.py b/recipes/usrsctp/all/conanfile.py index 73752d1325d3b..9eba2832eb8dd 100644 --- a/recipes/usrsctp/all/conanfile.py +++ b/recipes/usrsctp/all/conanfile.py @@ -1,27 +1,33 @@ -from conans import ConanFile, CMake, tools 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, replace_in_file + +required_conan_version = ">=1.53.0" + class UsrsctpConan(ConanFile): name = "usrsctp" + description = " A portable SCTP userland stack" license = "BSD-3-Clause" - homepage = "https://github.com/sctplab/usrsctp" url = "https://github.com/conan-io/conan-center-index" - topics = ("conan", "network", "sctp") - description = " A portable SCTP userland stack" - settings = "os", "compiler", "arch", "build_type" - options = {"shared": [True, False], - "fPIC": [True, False]} - default_options = {"shared": False, - "fPIC": True} - exports_sources = ["CMakeLists.txt", "patches/*"] - generators = "cmake" + homepage = "https://github.com/sctplab/usrsctp" + topics = ("network", "sctp") - _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" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -29,46 +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 + 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]) - extracted_dir = "usrsctp-{}".format(self.version) - os.rename(extracted_dir, self._source_subfolder) + 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["sctp_debug"] = False + tc.variables["sctp_werror"] = False + tc.variables["sctp_build_shared_lib"] = self.options.shared + tc.variables["sctp_build_programs"] = False + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = self.options.shared + tc.generate() - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["sctp_debug"] = False - self._cmake.definitions["sctp_werror"] = False - self._cmake.definitions["sctp_build_shared_lib"] = self.options.shared - self._cmake.definitions["sctp_build_programs"] = False - self._cmake.configure() - return self._cmake + def _patch_sources(self): + apply_conandata_patches(self) + # Fix "The CMake policy CMP0091 must be NEW, but is ''" + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "project(usrsctplib C)\ncmake_minimum_required(VERSION 3.0)", + "cmake_minimum_required(VERSION 3.15)\nproject(usrsctplib C)") def build(self): self._patch_sources() - 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", + 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")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): - self.cpp_info.names["pkg_config"] = "usrsctp" + self.cpp_info.set_property("pkg_config_name", "usrsctp") if self.settings.os == "Windows": - self.cpp_info.system_libs.extend(['ws2_32', 'iphlpapi']) - elif self.settings.os == "Linux": - self.cpp_info.system_libs.extend(['pthread']) + self.cpp_info.system_libs = ["ws2_32", "iphlpapi"] + elif self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs = ["pthread"] suffix = "_import" if self.settings.os == "Windows" and self.options.shared else "" self.cpp_info.libs = ["usrsctp" + suffix] diff --git a/recipes/usrsctp/all/test_package/CMakeLists.txt b/recipes/usrsctp/all/test_package/CMakeLists.txt index a60174007a234..d8fa3f6efba33 100644 --- a/recipes/usrsctp/all/test_package/CMakeLists.txt +++ b/recipes/usrsctp/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(usrsctp REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) diff --git a/recipes/usrsctp/all/test_package/conanfile.py b/recipes/usrsctp/all/test_package/conanfile.py index 7e2dfe859bb27..ef5d7042163ec 100644 --- a/recipes/usrsctp/all/test_package/conanfile.py +++ b/recipes/usrsctp/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/usrsctp/all/test_v1_package/CMakeLists.txt b/recipes/usrsctp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/usrsctp/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/usrsctp/all/test_v1_package/conanfile.py b/recipes/usrsctp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..7e2dfe859bb27 --- /dev/null +++ b/recipes/usrsctp/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/utf8.h/all/conandata.yml b/recipes/utf8.h/all/conandata.yml index 8841db197744f..35ff55cfedc3d 100644 --- a/recipes/utf8.h/all/conandata.yml +++ b/recipes/utf8.h/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "cci.20240202": + url: "https://github.com/sheredom/utf8.h/archive/2aa5709fe39c66d2868c0d52d42788899b90dc92.tar.gz" + sha256: "1cce8cad2ab17b9ac4e59c8b06fa6f2bdf729893c7061b734164f2e87ff9f7f9" "cci.20210310": url: "https://github.com/sheredom/utf8.h/archive/ee5a7d4beb7755da13e4d4ec3eccfb65a0530456.tar.gz" sha256: "d7c9ad480b640c76292a1c4b9735497fd635cb8828e95beabb7db91ea4cecf55" diff --git a/recipes/utf8.h/all/conanfile.py b/recipes/utf8.h/all/conanfile.py index 3c63ca89d6157..5053468bc7039 100644 --- a/recipes/utf8.h/all/conanfile.py +++ b/recipes/utf8.h/all/conanfile.py @@ -13,6 +13,7 @@ class Utf8HConan(ConanFile): description = "Single header utf8 string functions for C and C++" topics = ("utf8", "unicode", "text") license = "Unlicense" + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -23,8 +24,7 @@ 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 @@ -36,4 +36,3 @@ def package(self): 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/test_package.cpp b/recipes/utf8.h/all/test_package/test_package.cpp index fd1eef99eafd8..66c337dd316fb 100644 --- a/recipes/utf8.h/all/test_package/test_package.cpp +++ b/recipes/utf8.h/all/test_package/test_package.cpp @@ -1,3 +1,9 @@ +#if defined(__cplusplus) && __cplusplus >= 202002L +using char_type = char8_t; +#else +typedef char char_type; +#endif + #include "utf8.h" int main() @@ -7,7 +13,7 @@ int main() char str[] = {'\xcf', '\xb4', '\xce', '\xb8', '\xce', '\x98', '\xcf', '\x91', '\0'}; - int r = utf8ncasecmp(ref, str, 8); + int r = utf8ncasecmp(reinterpret_cast(ref), reinterpret_cast(str), 8); return 0; } diff --git a/recipes/utf8.h/all/test_v1_package/CMakeLists.txt b/recipes/utf8.h/all/test_v1_package/CMakeLists.txt index e35aca1f7a135..0d20897301b68 100644 --- a/recipes/utf8.h/all/test_v1_package/CMakeLists.txt +++ b/recipes/utf8.h/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(utf8.h REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE utf8.h::utf8.h) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/utf8.h/config.yml b/recipes/utf8.h/config.yml index dc79ecf2dafac..fad837c21119c 100644 --- a/recipes/utf8.h/config.yml +++ b/recipes/utf8.h/config.yml @@ -1,3 +1,5 @@ versions: + "cci.20240202": + folder: all "cci.20210310": folder: all diff --git a/recipes/utf8proc/all/conandata.yml b/recipes/utf8proc/all/conandata.yml index 2e408e9011b37..c31447372a280 100644 --- a/recipes/utf8proc/all/conandata.yml +++ b/recipes/utf8proc/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.9.0": + url: "https://github.com/JuliaStrings/utf8proc/archive/v2.9.0.tar.gz" + sha256: "18c1626e9fc5a2e192311e36b3010bfc698078f692888940f1fa150547abb0c1" "2.8.0": url: "https://github.com/JuliaStrings/utf8proc/archive/v2.8.0.tar.gz" sha256: "a0a60a79fe6f6d54e7d411facbfcc867a6e198608f2cd992490e46f04b1bcecc" diff --git a/recipes/utf8proc/all/conanfile.py b/recipes/utf8proc/all/conanfile.py index 698e23be72ec9..39b2b7b1cced3 100644 --- a/recipes/utf8proc/all/conanfile.py +++ b/recipes/utf8proc/all/conanfile.py @@ -4,17 +4,17 @@ from conan.tools.microsoft import is_msvc import os -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.53.0" class Utf8ProcConan(ConanFile): name = "utf8proc" + description = "A clean C library for processing UTF-8 Unicode data" + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/JuliaStrings/utf8proc" - description = "A clean C library for processing UTF-8 Unicode data" topics = ("utf", "utf8", "unicode", "text") - license = "MIT expat" - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -31,28 +31,19 @@ def config_options(self): 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 + 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" tc.generate() def build(self): diff --git a/recipes/utf8proc/config.yml b/recipes/utf8proc/config.yml index 44b916f7f7e88..d7d36135481cf 100644 --- a/recipes/utf8proc/config.yml +++ b/recipes/utf8proc/config.yml @@ -1,4 +1,6 @@ versions: + "2.9.0": + folder: all "2.8.0": folder: all "2.7.0": diff --git a/recipes/utfcpp/all/conandata.yml b/recipes/utfcpp/all/conandata.yml index 42cbfd5cf5018..d1a732d445794 100644 --- a/recipes/utfcpp/all/conandata.yml +++ b/recipes/utfcpp/all/conandata.yml @@ -1,19 +1,22 @@ sources: - "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" - "3.2": - url: "https://github.com/nemtrif/utfcpp/archive/v3.2.tar.gz" - sha256: "cd4f9a66d23dc385bd7ea11bc0abfda8ea1ad1dcf5cd6d3a27bc551e86436364" + "4.0.5": + url: "https://github.com/nemtrif/utfcpp/archive/v4.0.5.tar.gz" + sha256: "ffc668a310e77607d393f3c18b32715f223da1eac4c4d6e0579a11df8e6b59cf" + "4.0.4": + url: "https://github.com/nemtrif/utfcpp/archive/v4.0.4.tar.gz" + sha256: "7c8a403d0c575d52473c8644cd9eb46c6ba028d2549bc3e0cdc2d45f5cfd78a0" + "4.0.1": + url: "https://github.com/nemtrif/utfcpp/archive/v4.0.1.tar.gz" + sha256: "9014342a716258da00b97bf8c201a2edc4d72d2025cd8d62f0650ac627038f95" + "4.0.0": + url: "https://github.com/nemtrif/utfcpp/archive/v4.0.0.tar.gz" + sha256: "ac44d9652aa2ee64d405c1705718f26b385337a9b8cf20bf2b2aac6435a16c1e" + "3.2.5": + url: "https://github.com/nemtrif/utfcpp/archive/v3.2.5.tar.gz" + sha256: "14fd1b3c466814cb4c40771b7f207b61d2c7a0aa6a5e620ca05c00df27f25afd" + "3.2.3": + url: "https://github.com/nemtrif/utfcpp/archive/v3.2.3.tar.gz" + sha256: "3ba9b0dbbff08767bdffe8f03b10e596ca351228862722e4c9d4d126d2865250" "3.1.2": url: "https://github.com/nemtrif/utfcpp/archive/v3.1.2.tar.gz" sha256: "fea3bfa39fb8bd7368077ea5e1e0db9a8951f7e6fb6d9400b00ab3d92b807c6d" - "3.1.1": - url: "https://github.com/nemtrif/utfcpp/archive/v3.1.1.tar.gz" - sha256: "33496a4c3cc2de80e9809c4997052331af5fb32079f43ab4d667cd48c3a36e88" - "3.1": - url: "https://github.com/nemtrif/utfcpp/archive/v3.1.tar.gz" - sha256: "ab531c3fd5d275150430bfaca01d7d15e017a188183be932322f2f651506b096" diff --git a/recipes/utfcpp/all/conanfile.py b/recipes/utfcpp/all/conanfile.py index 63d01a72ddc94..23b9e402630b2 100644 --- a/recipes/utfcpp/all/conanfile.py +++ b/recipes/utfcpp/all/conanfile.py @@ -9,26 +9,23 @@ class UtfCppConan(ConanFile): name = "utfcpp" - url = "https://github.com/conan-io/conan-center-index" - homepage = "https://github.com/nemtrif/utfcpp" description = "UTF-8 with C++ in a Portable Way" - topics = ("utf", "utf8", "unicode", "text") license = "BSL-1.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/nemtrif/utfcpp" + topics = ("utf", "utf8", "unicode", "text", "header-only") + package_type = "header-library" 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 package_id(self): + self.info.clear() - def build(self): - pass + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) @@ -38,7 +35,8 @@ def package(self): # 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), - {"utf8cpp": "utf8cpp::utf8cpp"}, + {"utf8cpp": "utf8cpp::utf8cpp", + "utf8::cpp": "utf8cpp::utf8cpp"}, ) def _create_cmake_module_alias_targets(self, module_file, targets): @@ -59,14 +57,12 @@ def _module_file_rel_path(self): def package_info(self): self.cpp_info.set_property("cmake_file_name", "utf8cpp") self.cpp_info.set_property("cmake_target_name", "utf8cpp") + self.cpp_info.set_property("cmake_target_aliases", ["utf8::cpp"]) 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" - self.cpp_info.names["cmake_find_package_multi"] = "utf8cpp" - 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] + for generator in ["cmake_find_package", "cmake_find_package_multi"]: + self.cpp_info.names[generator] = "utf8cpp" + self.cpp_info.build_modules[generator] = [self._module_file_rel_path] diff --git a/recipes/utfcpp/all/test_package/CMakeLists.txt b/recipes/utfcpp/all/test_package/CMakeLists.txt index fe794ae36be57..7624c13618914 100644 --- a/recipes/utfcpp/all/test_package/CMakeLists.txt +++ b/recipes/utfcpp/all/test_package/CMakeLists.txt @@ -5,4 +5,6 @@ find_package(utf8cpp REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE utf8cpp) +#check alias +target_link_libraries(${PROJECT_NAME} PRIVATE utf8::cpp) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/utfcpp/all/test_package/conanfile.py b/recipes/utfcpp/all/test_package/conanfile.py index d120a992c06a6..8a5bb47f50c4c 100644 --- a/recipes/utfcpp/all/test_package/conanfile.py +++ b/recipes/utfcpp/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/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 6d247e5ee8147..93af14ff8ed78 100644 --- a/recipes/utfcpp/config.yml +++ b/recipes/utfcpp/config.yml @@ -1,13 +1,15 @@ versions: - "3.2.2": + "4.0.5": folder: all - "3.2.1": + "4.0.4": folder: all - "3.2": + "4.0.1": folder: all - "3.1.2": + "4.0.0": + folder: all + "3.2.5": folder: all - "3.1.1": + "3.2.3": folder: all - "3.1": + "3.1.2": folder: all diff --git a/recipes/uthash/all/conandata.yml b/recipes/uthash/all/conandata.yml new file mode 100644 index 0000000000000..cecad30c0f60f --- /dev/null +++ b/recipes/uthash/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "2.3.0": + url: "https://github.com/troydhanson/uthash/archive/e493aa90a2833b4655927598f169c31cfcdf7861.tar.gz" + sha256: "2ddb6665e82ffd7e87a27b97081bddf8f09520b7a2cfd6ab011541e7cde991fa" diff --git a/recipes/uthash/all/conanfile.py b/recipes/uthash/all/conanfile.py new file mode 100644 index 0000000000000..ae3832c2b5a97 --- /dev/null +++ b/recipes/uthash/all/conanfile.py @@ -0,0 +1,38 @@ +import os + +from conan import ConanFile +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout + +required_conan_version = ">=1.53.0" + +class UthashConan(ConanFile): + name = "uthash" + description = "C macros for hash tables and more" + license = "BSD-1-Clause" + homepage = "https://troydhanson.github.io/uthash/" + url = "https://github.com/conan-io/conan-center-index" + topics = ("hash-table", "header-only") + + package_type = "header-library" + 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], strip_root=True) + + def package(self): + copy(self, "LICENSE", self.source_folder, 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/uthash/all/test_package/CMakeLists.txt b/recipes/uthash/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..13e75e619c30a --- /dev/null +++ b/recipes/uthash/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) + +find_package(uthash REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE uthash::uthash) diff --git a/recipes/uthash/all/test_package/conanfile.py b/recipes/uthash/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/uthash/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/uthash/all/test_package/test_package.c b/recipes/uthash/all/test_package/test_package.c new file mode 100644 index 0000000000000..368ee976d0fb4 --- /dev/null +++ b/recipes/uthash/all/test_package/test_package.c @@ -0,0 +1,53 @@ +// https://github.com/troydhanson/uthash/blob/v2.3.0/tests/test1.c +// Copyright (c) 2005-2022, Troy D. Hanson https://troydhanson.github.io/uthash/ +// 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. +// +// 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. + +#include "uthash.h" +#include /* malloc */ +#include /* printf */ + +typedef struct example_user_t { + int id; + int cookie; + UT_hash_handle hh; +} example_user_t; + +int main() +{ + int i; + example_user_t *user, *users=NULL; + + /* create elements */ + for(i=0; i<10; i++) { + user = (example_user_t*)malloc(sizeof(example_user_t)); + if (user == NULL) { + exit(-1); + } + user->id = i; + user->cookie = i*i; + HASH_ADD_INT(users,id,user); + } + + for(user=users; user != NULL; user=(example_user_t*)(user->hh.next)) { + printf("user %d, cookie %d\n", user->id, user->cookie); + } + return 0; +} diff --git a/recipes/uthash/config.yml b/recipes/uthash/config.yml new file mode 100644 index 0000000000000..d724287fc23cb --- /dev/null +++ b/recipes/uthash/config.yml @@ -0,0 +1,3 @@ +versions: + "2.3.0": + folder: all diff --git a/recipes/util-linux-libuuid/all/conandata.yml b/recipes/util-linux-libuuid/all/conandata.yml new file mode 100644 index 0000000000000..c84795c4daf4e --- /dev/null +++ b/recipes/util-linux-libuuid/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "2.39.2": + url: "https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/v2.39/util-linux-2.39.2.tar.xz" + sha256: "87abdfaa8e490f8be6dde976f7c80b9b5ff9f301e1b67e3899e1f05a59a1531f" + "2.39": + url: "https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/v2.39/util-linux-2.39.tar.xz" + sha256: "32b30a336cda903182ed61feb3e9b908b762a5e66fe14e43efb88d37162075cb" diff --git a/recipes/util-linux-libuuid/all/conanfile.py b/recipes/util-linux-libuuid/all/conanfile.py new file mode 100644 index 0000000000000..33b4289d276d1 --- /dev/null +++ b/recipes/util-linux-libuuid/all/conanfile.py @@ -0,0 +1,139 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name, is_apple_os, XCRun +from conan.tools.files import copy, get, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps +from conan.tools.layout import basic_layout +from conan.tools.scm import Version +import os + +required_conan_version = ">=1.53.0" + + +class UtilLinuxLibuuidConan(ConanFile): + name = "util-linux-libuuid" + description = "Universally unique id library" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/util-linux/util-linux.git" + license = "BSD-3-Clause" + topics = "id", "identifier", "unique", "uuid" + package_type = "library" + provides = "libuuid" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_python_bindings": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_python_bindings": True, + } + + @property + def _has_sys_file_header(self): + return self.settings.os in ["FreeBSD", "Linux", "Macos"] + + 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 _minimum_compiler_version(self, compiler, build_type): + min_version = { + "gcc": { + "Release": "4", + "Debug": "8", + }, + "clang": { + "Release": "3", + "Debug": "3", + }, + "apple-clang": { + "Release": "5", + "Debug": "5", + }, + } + return min_version.get(str(compiler), {}).get(str(build_type), "0") + + def validate(self): + min_version = self._minimum_compiler_version(self.settings.compiler, self.settings.build_type) + if Version(self.settings.compiler.version) < min_version: + raise ConanInvalidConfiguration(f"{self.settings.compiler} {self.settings.compiler.version} does not meet the minimum version requirement of version {min_version}") + if self.settings.os == "Windows": + raise ConanInvalidConfiguration(f"{self.ref} is not supported on Windows") + + def requirements(self): + if self.settings.os == "Macos": + # Required because libintl.{a,dylib} is not distributed via libc on Macos + self.requires("libgettext/0.22") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = AutotoolsToolchain(self) + tc.configure_args.append("--disable-all-programs") + tc.configure_args.append("--enable-libuuid") + if not self.options.with_python_bindings: + tc.configure_args.append("--without-python") + if self._has_sys_file_header: + tc.extra_defines.append("HAVE_SYS_FILE_H") + if "x86" in self.settings.arch: + tc.extra_cflags.append("-mstackrealign") + + # Based on https://github.com/conan-io/conan-center-index/blob/c647b1/recipes/libx264/all/conanfile.py#L94 + if is_apple_os(self) and self.settings.arch == "armv8": + tc.configure_args.append("--host=aarch64-apple-darwin") + tc.extra_asflags = ["-arch arm64"] + tc.extra_ldflags = ["-arch arm64"] + if self.settings.os != "Macos": + xcrun = XCRun(self) + platform_flags = ["-isysroot", xcrun.sdk_path] + apple_min_version_flag = AutotoolsToolchain(self).apple_min_version_flag + if apple_min_version_flag: + platform_flags.append(apple_min_version_flag) + tc.extra_asflags.extend(platform_flags) + tc.extra_cflags.extend(platform_flags) + tc.extra_ldflags.extend(platform_flags) + + tc.generate() + + deps = AutotoolsDeps(self) + deps.generate() + + def build(self): + autotools = Autotools(self) + autotools.configure() + autotools.make() + + def package(self): + copy(self, "COPYING.BSD-3-Clause", src=os.path.join(self.source_folder, "Documentation", "licenses"), 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, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "bin")) + 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, "usr")) + fix_apple_shared_install_name(self) + + def package_info(self): + self.cpp_info.set_property("pkg_config_name", "uuid") + self.cpp_info.set_property("cmake_target_name", "libuuid::libuuid") + self.cpp_info.set_property("cmake_file_name", "libuuid") + # Maintain alias to `LibUUID::LibUUID` for previous version of the recipe + self.cpp_info.set_property("cmake_target_aliases", ["LibUUID::LibUUID"]) + + self.cpp_info.libs = ["uuid"] + self.cpp_info.includedirs.append(os.path.join("include", "uuid")) diff --git a/recipes/util-linux-libuuid/all/test_package/CMakeLists.txt b/recipes/util-linux-libuuid/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..75c717f769900 --- /dev/null +++ b/recipes/util-linux-libuuid/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES C) + +find_package(libuuid REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE libuuid::libuuid) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) diff --git a/recipes/util-linux-libuuid/all/test_package/conanfile.py b/recipes/util-linux-libuuid/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0a6bc68712d90 --- /dev/null +++ b/recipes/util-linux-libuuid/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/util-linux-libuuid/all/test_package/test_package.c b/recipes/util-linux-libuuid/all/test_package/test_package.c new file mode 100644 index 0000000000000..792d1d3fbf414 --- /dev/null +++ b/recipes/util-linux-libuuid/all/test_package/test_package.c @@ -0,0 +1,33 @@ +#include + +#include "uuid/uuid.h" + +int main(int argc, char *argv[]) { + uuid_t uuid; + uuid_generate_time_safe(uuid); + + char uuid_str[37]; + uuid_unparse_lower(uuid, uuid_str); + printf("generate uuid=%s\n", uuid_str); + + uuid_t uuid2; + uuid_parse(uuid_str, uuid2); + + int rv; + rv = uuid_compare(uuid, uuid2); + printf("uuid_compare() result=%d\n", rv); + + uuid_t uuid3; + uuid_parse("1b4e28ba-2fa1-11d2-883f-0016d3cca427", uuid3); + rv = uuid_compare(uuid, uuid3); + printf("uuid_compare() result=%d\n", rv); + + rv = uuid_is_null(uuid); + printf("uuid_null() result=%d\n", rv); + + uuid_clear(uuid); + rv = uuid_is_null(uuid); + printf("uuid_null() result=%d\n", rv); + + return 0; +} diff --git a/recipes/util-linux-libuuid/config.yml b/recipes/util-linux-libuuid/config.yml new file mode 100644 index 0000000000000..4ab19fceb4d3b --- /dev/null +++ b/recipes/util-linux-libuuid/config.yml @@ -0,0 +1,5 @@ +versions: + "2.39.2": + folder: all + "2.39": + folder: all diff --git a/recipes/uvw/all/conandata.yml b/recipes/uvw/all/conandata.yml index f47d086dd6f95..9e2f0333781b4 100644 --- a/recipes/uvw/all/conandata.yml +++ b/recipes/uvw/all/conandata.yml @@ -1,4 +1,16 @@ sources: + "3.4.0": + url: "https://github.com/skypjack/uvw/archive/v3.4.0_libuv_v1.48.tar.gz" + sha256: "c16600573871a5feeb524234b378ab832c8971b2a68d030c6bd0e3077d416ade" + "3.3.0": + url: "https://github.com/skypjack/uvw/archive/v3.3.0_libuv_v1.47.tar.gz" + sha256: "aabb17d3d8f0b3481b44e981c889dd4a2a6a3f1a96a4d01055e669f4b7d37d0e" + "3.2.0": + url: "https://github.com/skypjack/uvw/archive/v3.2.0_libuv_v1.46.tar.gz" + sha256: "bd5aed741765950074b1ea2507291dce81e528abdf56c406991ad4a27d8d1714" + "3.1.0": + url: "https://github.com/skypjack/uvw/archive/v3.1.0_libuv_v1.45.tar.gz" + sha256: "0a612bd243150fbbe1365cdaf48203d32061c1d14f93825a31876b183922f93b" "2.12.1": url: "https://github.com/skypjack/uvw/archive/v2.12.1_libuv_v1.44.tar.gz" sha256: "3460842778e91e7d2fae4201e49e4521e9d94fbbf3891ae6c52d3c9fc0673598" @@ -8,12 +20,11 @@ sources: "2.10.0": url: "https://github.com/skypjack/uvw/archive/v2.10.0_libuv_v1.42.tar.gz" sha256: "30b0ba97a94d5e652490c6b1b32c95e608263f21cf3bc606308d09b3e3a114bf" - "2.9.0": - url: "https://github.com/skypjack/uvw/archive/v2.9.0_libuv_v1.41.tar.gz" - sha256: "dd610cb1626b8a7779ed251584bcc0362fb98fcee13e699680f61828a1ba55de" - "2.8.0": - url: "https://github.com/skypjack/uvw/archive/v2.8.0_libuv_v1.40.tar.gz" - sha256: "aa5769f5b9ba50de72ab02a8f8acf298b4aa9ceaef07992418a13a0fa119ce7d" - "2.6.0": - url: "https://github.com/skypjack/uvw/archive/v2.6.0_libuv-v1.38.tar.gz" - sha256: "2695276bb4b154174ac0a6401bde5c0768bca99a43c9a469af67526f7e2e9410" +libuv_version_mapping: + "3.4.0": "1.48.0" + "3.3.0": "1.47.0" + "3.2.0": "1.46.0" + "3.1.0": "1.45.0" + "2.12.1": "1.44.2" + "2.11.0": "1.43.0" + "2.10.0": "1.42.0" diff --git a/recipes/uvw/all/conanfile.py b/recipes/uvw/all/conanfile.py index c710f06618ebd..b1ed6df28cbd3 100644 --- a/recipes/uvw/all/conanfile.py +++ b/recipes/uvw/all/conanfile.py @@ -1,85 +1,69 @@ +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 glob -import re -from conans import ConanFile, tools -from conans.errors import ConanException, ConanInvalidConfiguration -required_conan_version = ">=1.33.0" + +required_conan_version = ">=1.54.0" + class UvwConan(ConanFile): name = "uvw" description = "Header-only, event based, tiny and easy to use libuv wrapper in modern C++." - topics = ("uvw", "libuv", "io", "networking", "header-only",) license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/skypjack/uvw" + topics = ("libuv", "io", "networking", "header-only",) + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - settings = "compiler" @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 17 @property - def _supported_compiler(self): - compiler = str(self.settings.compiler) - version = tools.Version(self.settings.compiler.version) - if compiler == "Visual Studio" and version >= "15": - return True - if compiler == "gcc" and version >= "7": - return True - if compiler == "clang" and version >= "5": - return True - if compiler == "apple-clang" and version >= "10": - return True - return False - - def configure(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, "17") - if not self._supported_compiler: - raise ConanInvalidConfiguration("uvw requires C++17. {} {} does not support it.".format( - str(self.settings.compiler), - self.settings.compiler.version) - ) + def _compilers_minimum_version(self): + return { + "Visual Studio": "15", + "msvc": "191", + "gcc": "7", + "clang": "5", + "apple-clang": "10", + } @property - def _required_EXACT_libuv_version(self): - """ Return *EXACT* libuv version to use with this uvw library """ - match = re.match(r".*libuv[_-]v([0-9]+\.[0-9]+).*", self.conan_data["sources"][self.version]["url"]) - if not match: - raise ConanException("uvw recipe does not know what version of libuv to use as dependency") - return tools.Version(match.group(1)) + def _required_libuv_version(self): + return self.conan_data["libuv_version_mapping"][self.version] + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - libuv_version = self._required_EXACT_libuv_version - revision = 0 - if libuv_version.major == "1" and libuv_version.minor == "44": - revision = 1 - self.requires("libuv/{}.{}.{}".format(libuv_version.major, libuv_version.minor, revision)) + self.requires(f"libuv/{self._required_libuv_version}") 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("{self.ref} requires C++{self._min_cppstd}, which your compiler doesn't 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 package(self): - self.copy("*.hpp", dst="include", src=os.path.join(self._source_subfolder, "src")) - self.copy("*", dst=os.path.join("include", "uvw"), src=os.path.join(self._source_subfolder, "src", "uvw")) - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + copy(self, "*.hpp", src=os.path.join(self.source_folder, "src"), dst=os.path.join(self.package_folder, "include")) + copy(self, "*", src=os.path.join(self.source_folder, "src", "uvw"), dst=os.path.join(self.package_folder, "include", "uvw")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) def package_info(self): - # Check whether the version of libuv used as a requirement is ok - required_version = self._required_EXACT_libuv_version - tuple_exact = (required_version.major, required_version.minor) - - current_version = tools.Version(self.deps_cpp_info["libuv"].version) - tuple_current = (current_version.major, current_version.minor) - - if tuple_exact != tuple_current: - raise ConanException("This version of uvw requires an exact libuv version as dependency: {}.{}".format( - required_version.major, - required_version.minor) - ) + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/uvw/all/test_package/CMakeLists.txt b/recipes/uvw/all/test_package/CMakeLists.txt index 6a744e56bf2d7..1bad80ec9ab42 100644 --- a/recipes/uvw/all/test_package/CMakeLists.txt +++ b/recipes/uvw/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(uvw REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} uvw::uvw) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17) +target_link_libraries(${PROJECT_NAME} PRIVATE uvw::uvw) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +if(uvw_VERSION VERSION_GREATER_EQUAL "3.0.0") + target_compile_definitions(${PROJECT_NAME} PRIVATE UVW_API_3_0) +endif() diff --git a/recipes/uvw/all/test_package/conanfile.py b/recipes/uvw/all/test_package/conanfile.py index 90eb89e3f2f46..9be22ab3d97f8 100644 --- a/recipes/uvw/all/test_package/conanfile.py +++ b/recipes/uvw/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" + 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/uvw/all/test_package/test_package.cpp b/recipes/uvw/all/test_package/test_package.cpp index dda75d5b7decc..864863c297929 100644 --- a/recipes/uvw/all/test_package/test_package.cpp +++ b/recipes/uvw/all/test_package/test_package.cpp @@ -1,8 +1,9 @@ -#include - #include int main() { - auto loop = uvw::Loop::getDefault(); - assert(loop != nullptr); +#ifdef UVW_API_3_0 + uvw::loop::get_default(); +#else + uvw::Loop::getDefault(); +#endif } diff --git a/recipes/uvw/all/test_v1_package/CMakeLists.txt b/recipes/uvw/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/uvw/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/uvw/all/test_v1_package/conanfile.py b/recipes/uvw/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..49a3a66ea5bad --- /dev/null +++ b/recipes/uvw/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/uvw/config.yml b/recipes/uvw/config.yml index 96dd6767e90c4..652dbe6c9d518 100644 --- a/recipes/uvw/config.yml +++ b/recipes/uvw/config.yml @@ -1,13 +1,15 @@ versions: - "2.12.1": + "3.4.0": folder: "all" - "2.11.0": + "3.3.0": folder: "all" - "2.10.0": + "3.2.0": folder: "all" - "2.9.0": + "3.1.0": folder: "all" - "2.8.0": + "2.12.1": folder: "all" - "2.6.0": + "2.11.0": + folder: "all" + "2.10.0": folder: "all" diff --git a/recipes/uwebsockets/all/conandata.yml b/recipes/uwebsockets/all/conandata.yml index fd940478e8566..d785e8d1b3db4 100644 --- a/recipes/uwebsockets/all/conandata.yml +++ b/recipes/uwebsockets/all/conandata.yml @@ -1,25 +1,26 @@ sources: - "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" - "20.9.0": - url: "https://github.com/uNetworking/uWebSockets/archive/v20.9.0.tar.gz" - sha256: "91897568291a2081ffc1ae27c354446cc130c168a25892b2289f25e185af8676" - "20.8.0": - url: "https://github.com/uNetworking/uWebSockets/archive/v20.8.0.tar.gz" - sha256: "6ab4bc0207f44eacbb9c82fd0dc59a49ef84e13698ccdbfb44b92c6a0eaa951a" - "19.3.0": - url: "https://github.com/uNetworking/uWebSockets/archive/v19.3.0.tar.gz" - sha256: "6f709b4e5fe053a94a952da93c07c919b36bcb8c838c69067560ae85f97c5621" - "19.2.0": - url: "https://github.com/uNetworking/uWebSockets/archive/v19.2.0.tar.gz" - sha256: "2956075293090754bc2431c53634f93a1e74739c61392be6040cb3ed29430ec2" - "19.1.0": - url: "https://github.com/uNetworking/uWebSockets/archive/v19.1.0.tar.gz" - sha256: "65afa329b0c768a7443ea2621f3f371bc5ce0e1c3518d59bb11b9a2c7adb65dd" - "18.3.0": - url: "https://github.com/uNetworking/uWebSockets/archive/v18.3.0.tar.gz" - sha256: "f51317e2a8cd743e6ff9dfd215569824eaca489c24f7d8fd94eaca44443a9728" + "20.70.0": + url: "https://github.com/uNetworking/uWebSockets/archive/v20.70.0.tar.gz" + sha256: "39a7e32182df2da02955ab1c1681af9710c82115075f4caabb8689a2c04460b9" + "20.68.0": + url: "https://github.com/uNetworking/uWebSockets/archive/v20.68.0.tar.gz" + sha256: "02dd1dd2925c639c01222d19f4ddd6fe12261571bcb3befc7eedaf8fa75c008f" + "20.67.0": + url: "https://github.com/uNetworking/uWebSockets/archive/v20.67.0.tar.gz" + sha256: "8124bb46326f81d99ad3552b7a3bf78489784d3660fb60d7fe5f5337a21203a3" + "20.66.0": + url: "https://github.com/uNetworking/uWebSockets/archive/v20.66.0.tar.gz" + sha256: "54d1a8cfb46e1814e1525e9bc72a4652aa708f352e55f35ef4b55804c98bfee1" + "20.65.0": + url: "https://github.com/uNetworking/uWebSockets/archive/v20.65.0.tar.gz" + sha256: "e261f7c124b3b9e217fc766d6e51d4fdc4b227aa52c7a0ca5952a9e65cea4213" + "20.64.0": + url: "https://github.com/uNetworking/uWebSockets/archive/v20.64.0.tar.gz" + sha256: "bb81fa773dcbd6bc738904ad496554fd131a33269570e0e86fa09213d82ba9ef" + "20.63.0": + url: "https://github.com/uNetworking/uWebSockets/archive/v20.63.0.tar.gz" + sha256: "3bcb3fab4242d312e227b05f34e21d8468960e5eea59e12799aa21a94f1b2b1f" + # keep 20.62.0, the last version to provide C-API + "20.62.0": + url: "https://github.com/uNetworking/uWebSockets/archive/v20.62.0.tar.gz" + sha256: "03dfc8037cf43856a41e64bbc7fc5a7cf5e6369c9158682753074ecbbe09eed1" diff --git a/recipes/uwebsockets/all/conanfile.py b/recipes/uwebsockets/all/conanfile.py index 4f786027696a4..e4cc307e9cf27 100644 --- a/recipes/uwebsockets/all/conanfile.py +++ b/recipes/uwebsockets/all/conanfile.py @@ -15,6 +15,7 @@ class UwebsocketsConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/uNetworking/uWebSockets" topics = ("websocket", "network", "server", "header-only") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" options = { "with_zlib": [True, False], @@ -35,31 +36,20 @@ 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", + "gcc": "8", + "clang": "7", "apple-clang": "10", } - def config_options(self): - # libdeflate is not supported before 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.13") - if self.options.get_safe("with_libdeflate"): - self.requires("libdeflate/1.14") - - if 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") + self.requires("zlib/[>=1.2.11 <2]") + if self.options.with_libdeflate: + self.requires("libdeflate/1.19") + self.requires("usockets/0.8.8") def package_id(self): self.info.clear() @@ -73,11 +63,11 @@ def validate(self): f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." ) - 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)) + if self.settings.compiler == "clang" and str(self.settings.compiler.libcxx) == "libstdc++": + raise ConanInvalidConfiguration(f"{self.ref} needs recent libstdc++ with charconv.") 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 package(self): copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) @@ -100,7 +90,7 @@ def package_info(self): if not self.options.with_zlib: self.cpp_info.defines.append("UWS_NO_ZLIB") - if self.options.get_safe("with_libdeflate"): + if self.options.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 38145240aeafa..4d46e640ceb5a 100644 --- a/recipes/uwebsockets/all/test_package/CMakeLists.txt +++ b/recipes/uwebsockets/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(uwebsockets REQUIRED CONFIG) diff --git a/recipes/uwebsockets/config.yml b/recipes/uwebsockets/config.yml index f1e4d88dc8fdf..11fa83a523312 100644 --- a/recipes/uwebsockets/config.yml +++ b/recipes/uwebsockets/config.yml @@ -1,17 +1,17 @@ versions: - "20.17.0": + "20.70.0": folder: all - "20.14.0": + "20.68.0": folder: all - "20.9.0": + "20.67.0": folder: all - "20.8.0": + "20.66.0": folder: all - "19.3.0": + "20.65.0": folder: all - "19.2.0": + "20.64.0": folder: all - "19.1.0": + "20.63.0": folder: all - "18.3.0": + "20.62.0": folder: all diff --git a/recipes/v-hacd/all/conanfile.py b/recipes/v-hacd/all/conanfile.py index 0121a2fed52b8..7b0d91b504084 100644 --- a/recipes/v-hacd/all/conanfile.py +++ b/recipes/v-hacd/all/conanfile.py @@ -16,6 +16,7 @@ class VhacdConan(ConanFile): topics = ("3d", "mesh", "shape", "decomposition", "convex") homepage = "https://github.com/kmammou/v-hacd" url = "https://github.com/conan-io/conan-center-index" + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -37,7 +38,7 @@ 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( @@ -45,8 +46,7 @@ def validate(self): ) 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 diff --git a/recipes/vaapi/all/conanfile.py b/recipes/vaapi/all/conanfile.py index 756d5ef4595be..4708e007dd88c 100644 --- a/recipes/vaapi/all/conanfile.py +++ b/recipes/vaapi/all/conanfile.py @@ -1,47 +1,31 @@ from conan import ConanFile -from conan.errors import ConanInvalidConfiguration, ConanException +from conan.errors import ConanInvalidConfiguration +from conan.tools.gnu import PkgConfig from conan.tools.system import package_manager -from conans import tools -required_conan_version = ">=1.47" +required_conan_version = ">=1.50.0" class SysConfigVAAPIConan(ConanFile): name = "vaapi" version = "system" description = "VA-API is an open-source library and API specification, which provides access to graphics hardware acceleration capabilities for video processing." - topics = ("conan", "vaapi", "hwaccel", "video") + topics = ("hwaccel", "video") url = "https://github.com/conan-io/conan-center-index" homepage = "https://01.org/linuxmedia/vaapi" license = "MIT" + package_type = "shared-library" 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 layout(self): + pass 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("VAAPI 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.info.clear() - 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) + def validate(self): + if self.settings.os not in ["Linux", "FreeBSD"]: + raise ConanInvalidConfiguration("This recipe supports only Linux and FreeBSD") def system_requirements(self): dnf = package_manager.Dnf(self) @@ -63,8 +47,9 @@ def system_requirements(self): pkg.install(["libva"], update=True, check=True) def package_info(self): - self.cpp_info.includedirs = [] - self.cpp_info.libdirs = [] if self.settings.os in ["Linux", "FreeBSD"]: for name in ['libva', 'libva-x11', 'libva-drm']: - self._fill_cppinfo_from_pkgconfig(name) + pkg_config = PkgConfig(self, name) + self.cpp_info.components[name].includedirs = [] + self.cpp_info.components[name].libdirs = [] + pkg_config.fill_cpp_info(self.cpp_info.components[name]) diff --git a/recipes/vaapi/all/test_package/CMakeLists.txt b/recipes/vaapi/all/test_package/CMakeLists.txt index 950b4165b7aa4..1cc7d1fad52a6 100644 --- a/recipes/vaapi/all/test_package/CMakeLists.txt +++ b/recipes/vaapi/all/test_package/CMakeLists.txt @@ -1,10 +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(xorg REQUIRED CONFIG) +find_package(vaapi REQUIRED CONFIG) -set(SOURCES test_package.c) - -add_executable(${PROJECT_NAME} ${SOURCES}) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +add_executable(test_package test_package.c) +target_link_libraries(test_package PRIVATE vaapi::vaapi xorg::xorg) diff --git a/recipes/vaapi/all/test_package/conanfile.py b/recipes/vaapi/all/test_package/conanfile.py index 1b482d65b9b4e..e81d71833c5a3 100644 --- a/recipes/vaapi/all/test_package/conanfile.py +++ b/recipes/vaapi/all/test_package/conanfile.py @@ -1,18 +1,27 @@ -from conans import ConanFile, CMake, tools import os +from conan import ConanFile +from conan.tools.build import cross_building +from conan.tools.cmake import CMake, cmake_layout + class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + generators = "CMakeToolchain", "CMakeDeps", "VirtualBuildEnv", "VirtualRunEnv" requires = ("xorg/system",) + 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 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/vaapi/all/test_v1_package/CMakeLists.txt b/recipes/vaapi/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..2f5bce0e6460d --- /dev/null +++ b/recipes/vaapi/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() + +set(SOURCES ../test_package/test_package.c) + +add_executable(${PROJECT_NAME} ${SOURCES}) +target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) diff --git a/recipes/vaapi/all/test_v1_package/conanfile.py b/recipes/vaapi/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..1b482d65b9b4e --- /dev/null +++ b/recipes/vaapi/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" + requires = ("xorg/system",) + + 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/valijson/all/conandata.yml b/recipes/valijson/all/conandata.yml index 7d91b8058deb9..3db6eca065b46 100644 --- a/recipes/valijson/all/conandata.yml +++ b/recipes/valijson/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "1.0.3": + url: "https://github.com/tristanpenman/valijson/archive/v1.0.3.tar.gz" + sha256: "0fbd3cd2312b441c6373ee116e9a162c400f9e3cd79f6b32665cdd22fa11ac3f" + "1.0.2": + url: "https://github.com/tristanpenman/valijson/archive/v1.0.2.tar.gz" + sha256: "35d86e54fc727f1265226434dc996e33000a570f833537a25c8b702b0b824431" + "1.0.1": + url: "https://github.com/tristanpenman/valijson/archive/v1.0.1.tar.gz" + sha256: "b478b82af1db1d98c2ce47de4ad28647ec66800eaf704dba8b5e785cbca1d785" "1.0": url: "https://github.com/tristanpenman/valijson/archive/v1.0.tar.gz" sha256: "6b9f0bc89880feb3fe09aa469cd81f6168897d2fbb4e715853da3b94afd3779a" diff --git a/recipes/valijson/all/conanfile.py b/recipes/valijson/all/conanfile.py index 4c1f0676480ad..9e8080a170f30 100644 --- a/recipes/valijson/all/conanfile.py +++ b/recipes/valijson/all/conanfile.py @@ -13,6 +13,7 @@ class ValijsonConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/tristanpenman/valijson" topics = ("json", "validator", "header-only") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -31,7 +32,7 @@ def validate(self): 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def build(self): pass @@ -46,12 +47,10 @@ def package(self): ) def package_info(self): + self.cpp_info.set_property("cmake_target_name", "ValiJSON::valijson") 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 @@ -59,3 +58,6 @@ def package_info(self): 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" + self.cpp_info.components["libvalijson"].set_property("cmake_target_name", "ValiJSON::valijson") + self.cpp_info.components["libvalijson"].bindirs = [] + self.cpp_info.components["libvalijson"].libdirs = [] diff --git a/recipes/valijson/all/test_package/CMakeLists.txt b/recipes/valijson/all/test_package/CMakeLists.txt index f283c4c7cf92c..9fa0294a2d6c6 100644 --- a/recipes/valijson/all/test_package/CMakeLists.txt +++ b/recipes/valijson/all/test_package/CMakeLists.txt @@ -8,11 +8,11 @@ find_package(RapidJSON REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries( - ${PROJECT_NAME} - PRIVATE - ValiJSON::valijson - nlohmann_json::nlohmann_json - picojson::picojson - rapidjson + ${PROJECT_NAME} + PRIVATE + ValiJSON::valijson + 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 44512632f983b..81b93054985f7 100644 --- a/recipes/valijson/all/test_package/conanfile.py +++ b/recipes/valijson/all/test_package/conanfile.py @@ -12,7 +12,7 @@ def layout(self): cmake_layout(self) def requirements(self): - self.requires("nlohmann_json/3.9.1") + self.requires("nlohmann_json/3.11.2") self.requires("rapidjson/cci.20200410") self.requires("picojson/1.3.0") self.requires(self.tested_reference_str) @@ -25,10 +25,7 @@ def build(self): def test(self): 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")) - self.run( - "{} {} {} {}".format(bin_path, schema_file, valid_file, invalid_file), - run_environment=True - ) + schema_file = os.path.join(self.source_folder, "schema.json") + valid_file = os.path.join(self.source_folder, "valid.json") + invalid_file = os.path.join(self.source_folder, "invalid.json") + self.run(f"{bin_path} {schema_file} {valid_file} {invalid_file}", env="conanrun") diff --git a/recipes/valijson/all/test_v1_package/CMakeLists.txt b/recipes/valijson/all/test_v1_package/CMakeLists.txt index 679bcbb3ab1fd..a2f6329c538d2 100644 --- a/recipes/valijson/all/test_v1_package/CMakeLists.txt +++ b/recipes/valijson/all/test_v1_package/CMakeLists.txt @@ -11,10 +11,10 @@ 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 + ${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 index 1ffe3deaeb51c..f02d6b2bb8320 100644 --- a/recipes/valijson/all/test_v1_package/conanfile.py +++ b/recipes/valijson/all/test_v1_package/conanfile.py @@ -4,7 +4,7 @@ class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package", "cmake_find_package_multi" + generators = "cmake", "cmake_find_package_multi" def build(self): cmake = CMake(self) @@ -12,17 +12,14 @@ def build(self): cmake.build() def requirements(self): - self.requires("nlohmann_json/3.9.1") + self.requires("nlohmann_json/3.11.2") 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 - ) + schema_file = os.path.join(self.source_folder, os.pardir, "test_package", "schema.json") + valid_file = os.path.join(self.source_folder, os.pardir, "test_package", "valid.json") + invalid_file = os.path.join(self.source_folder, os.pardir, "test_package", "invalid.json") + self.run(f"{bin_path} {schema_file} {valid_file} {invalid_file}", run_environment=True) diff --git a/recipes/valijson/config.yml b/recipes/valijson/config.yml index 3fcfb3c4539e9..b8be269bc2d5e 100644 --- a/recipes/valijson/config.yml +++ b/recipes/valijson/config.yml @@ -1,4 +1,10 @@ versions: + "1.0.3": + folder: "all" + "1.0.2": + folder: "all" + "1.0.1": + folder: "all" "1.0": folder: "all" "0.7": diff --git a/recipes/vc/all/conandata.yml b/recipes/vc/all/conandata.yml index b1e2f20f1981d..ef285ad3397b4 100644 --- a/recipes/vc/all/conandata.yml +++ b/recipes/vc/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.4.3": + url: "https://github.com/VcDevel/Vc/archive/1.4.3.tar.gz" + sha256: "988ea0053f3fbf17544ca776a2749c097b3139089408b0286fa4e9e8513e037f" "1.4.2": url: "https://github.com/VcDevel/Vc/releases/download/1.4.2/Vc-1.4.2.tar.gz" sha256: "50d3f151e40b0718666935aa71d299d6370fafa67411f0a9e249fbce3e6e3952" diff --git a/recipes/vc/all/conanfile.py b/recipes/vc/all/conanfile.py index 7cfaddf7b0838..12e8e45ebe604 100644 --- a/recipes/vc/all/conanfile.py +++ b/recipes/vc/all/conanfile.py @@ -4,17 +4,17 @@ from conan.tools.files import copy, get, replace_in_file, rmdir import os -required_conan_version = ">=1.51.1" +required_conan_version = ">=1.50.0" class VcConan(ConanFile): name = "vc" description = "SIMD Vector Classes for C++." license = "BSD-3-Clause" - topics = ("vc", "simd", "vectorization", "parallel", "sse", "avx", "neon") + topics = ("simd", "vectorization", "parallel", "sse", "avx", "neon") homepage = "https://github.com/VcDevel/Vc" url = "https://github.com/conan-io/conan-center-index" - + package_type = "static-library" settings = "os", "arch", "compiler", "build_type" options = { "fPIC": [True, False], @@ -31,12 +31,11 @@ def layout(self): cmake_layout(self, src_folder="src") def validate(self): - if self.info.settings.compiler.get_safe("cppstd"): + 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/vc/all/test_v1_package/CMakeLists.txt b/recipes/vc/all/test_v1_package/CMakeLists.txt index 492877a81dfa8..0d20897301b68 100644 --- a/recipes/vc/all/test_v1_package/CMakeLists.txt +++ b/recipes/vc/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(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) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/vc/config.yml b/recipes/vc/config.yml index 0ba616ecf92b2..f5a2ce84083be 100644 --- a/recipes/vc/config.yml +++ b/recipes/vc/config.yml @@ -1,4 +1,6 @@ versions: + "1.4.3": + folder: all "1.4.2": folder: all "1.4.1": diff --git a/recipes/vcglib/all/CMakeLists.txt b/recipes/vcglib/all/CMakeLists.txt index 503836eca235b..bea5e105e4ff6 100644 --- a/recipes/vcglib/all/CMakeLists.txt +++ b/recipes/vcglib/all/CMakeLists.txt @@ -16,8 +16,8 @@ install(TARGETS ${PROJECT_NAME} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) install(DIRECTORY "${VCGLIB_SRC_DIR}/vcg" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} - FILES_MATCHING PATTERN "*.h") + FILES_MATCHING PATTERN "*.h" PATTERN "*.ipp") install(DIRECTORY "${VCGLIB_SRC_DIR}/wrap" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} - FILES_MATCHING PATTERN "*.h") + FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp") install(DIRECTORY "${VCGLIB_SRC_DIR}/img" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} FILES_MATCHING PATTERN "*.h") diff --git a/recipes/vcglib/all/conandata.yml b/recipes/vcglib/all/conandata.yml index d8dc31a26ed34..f9800a56a86d4 100644 --- a/recipes/vcglib/all/conandata.yml +++ b/recipes/vcglib/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2023.12": + url: "https://github.com/cnr-isti-vclab/vcglib/archive/refs/tags/2023.12.tar.gz" + sha256: "5a84db6d596be1cb4abdc450d130dc8e2224a4c7b4198b60cd9ac55f45ac5c7b" "2022.02": url: "https://github.com/cnr-isti-vclab/vcglib/archive/refs/tags/2022.02.tar.gz" sha256: "724f5ef6ab9b9d21ff2e9e965c2ce909cc024b29f2aa7d39e2974b28ff25bc3f" @@ -6,6 +9,8 @@ sources: url: "https://github.com/cnr-isti-vclab/vcglib/archive/refs/tags/2020.12.tar.gz" sha256: "731c57435e39c4b958a1d766cadd9865d9db35e36410708f2da7818e9fa5f786" patches: + "2023.12": + - patch_file: "patches/0001-use-external-eigen.patch" "2022.02": - patch_file: "patches/0001-use-external-eigen.patch" "2020.12": diff --git a/recipes/vcglib/all/conanfile.py b/recipes/vcglib/all/conanfile.py index f452d7336181c..b05d8f64d4559 100644 --- a/recipes/vcglib/all/conanfile.py +++ b/recipes/vcglib/all/conanfile.py @@ -4,7 +4,7 @@ from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class VcglibConan(ConanFile): @@ -14,7 +14,7 @@ class VcglibConan(ConanFile): topics = ("vcglib", "mesh-processing") homepage = "https://github.com/cnr-isti-vclab/vcglib" url = "https://github.com/conan-io/conan-center-index" - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -35,24 +35,21 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("eigen/3.4.0") + # vcglib public headers include several eigen headers (for example vcg/math/matrix44.h includes Eigen/Core) + self.requires("eigen/3.4.0", transitive_headers=True) 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/vcglib/all/test_v1_package/CMakeLists.txt b/recipes/vcglib/all/test_v1_package/CMakeLists.txt index 0b93c9e9b9c66..0d20897301b68 100644 --- a/recipes/vcglib/all/test_v1_package/CMakeLists.txt +++ b/recipes/vcglib/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(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) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/vcglib/config.yml b/recipes/vcglib/config.yml index 8fa4c473789d6..0faefee3a8749 100644 --- a/recipes/vcglib/config.yml +++ b/recipes/vcglib/config.yml @@ -1,4 +1,6 @@ versions: + "2023.12": + folder: all "2022.02": folder: all "2020.12": diff --git a/recipes/vdpau/all/conanfile.py b/recipes/vdpau/all/conanfile.py index 037314ecd8e20..6c41a1e1b47da 100644 --- a/recipes/vdpau/all/conanfile.py +++ b/recipes/vdpau/all/conanfile.py @@ -1,47 +1,31 @@ from conan import ConanFile -from conan.errors import ConanInvalidConfiguration, ConanException +from conan.errors import ConanInvalidConfiguration +from conan.tools.gnu import PkgConfig from conan.tools.system import package_manager -from conans import tools -required_conan_version = ">=1.47" +required_conan_version = ">=1.50.0" class SysConfigVDPAUConan(ConanFile): name = "vdpau" version = "system" description = "VDPAU is the Video Decode and Presentation API for UNIX. It provides an interface to video decode acceleration and presentation hardware present in modern GPUs." - topics = ("conan", "vdpau", "hwaccel", "video") + topics = ("hwaccel", "video") url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.freedesktop.org/wiki/Software/VDPAU/" license = "MIT" + package_type = "shared-library" 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 layout(self): + pass 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("VDPAU 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.info.clear() - 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) + def validate(self): + if self.settings.os not in ["Linux", "FreeBSD"]: + raise ConanInvalidConfiguration("This recipe supports only Linux and FreeBSD") def system_requirements(self): dnf = package_manager.Dnf(self) @@ -66,4 +50,5 @@ def package_info(self): self.cpp_info.includedirs = [] self.cpp_info.libdirs = [] if self.settings.os in ["Linux", "FreeBSD"]: - self._fill_cppinfo_from_pkgconfig('vdpau') + pkg_config = PkgConfig(self, "vdpau") + pkg_config.fill_cpp_info(self.cpp_info) diff --git a/recipes/vdpau/all/test_package/CMakeLists.txt b/recipes/vdpau/all/test_package/CMakeLists.txt index 950b4165b7aa4..0fe5a1d45c245 100644 --- a/recipes/vdpau/all/test_package/CMakeLists.txt +++ b/recipes/vdpau/all/test_package/CMakeLists.txt @@ -1,10 +1,10 @@ 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(PkgConfig) -set(SOURCES test_package.c) +pkg_check_modules(VDPAU REQUIRED IMPORTED_TARGET vdpau) +find_package(xorg REQUIRED CONFIG) -add_executable(${PROJECT_NAME} ${SOURCES}) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +add_executable(test_package test_package.c) +target_link_libraries(test_package PRIVATE PkgConfig::VDPAU xorg::xorg) diff --git a/recipes/vdpau/all/test_package/conanfile.py b/recipes/vdpau/all/test_package/conanfile.py index 1b482d65b9b4e..e81d71833c5a3 100644 --- a/recipes/vdpau/all/test_package/conanfile.py +++ b/recipes/vdpau/all/test_package/conanfile.py @@ -1,18 +1,27 @@ -from conans import ConanFile, CMake, tools import os +from conan import ConanFile +from conan.tools.build import cross_building +from conan.tools.cmake import CMake, cmake_layout + class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + generators = "CMakeToolchain", "CMakeDeps", "VirtualBuildEnv", "VirtualRunEnv" requires = ("xorg/system",) + 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 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/vdpau/all/test_v1_package/CMakeLists.txt b/recipes/vdpau/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..9dfdf0083dcd8 --- /dev/null +++ b/recipes/vdpau/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) diff --git a/recipes/vdpau/all/test_v1_package/conanfile.py b/recipes/vdpau/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..1b482d65b9b4e --- /dev/null +++ b/recipes/vdpau/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" + requires = ("xorg/system",) + + 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/vectorclass/all/conanfile.py b/recipes/vectorclass/all/conanfile.py index 5696b99489d45..60e6bdcdc723a 100644 --- a/recipes/vectorclass/all/conanfile.py +++ b/recipes/vectorclass/all/conanfile.py @@ -5,7 +5,7 @@ from conan.tools.files import copy, get import os -required_conan_version = ">=1.51.1" +required_conan_version = ">=1.50.0" class VectorclassConan(ConanFile): @@ -18,7 +18,7 @@ class VectorclassConan(ConanFile): topics = ("vectorclass", "vector", "simd") homepage = "https://github.com/vectorclass/version2" url = "https://github.com/conan-io/conan-center-index" - + package_type = "static-library" settings = "os", "arch", "compiler", "build_type" options = { "fPIC": [True, False], @@ -37,6 +37,7 @@ def _min_cppstd(self): def _compilers_minimum_version(self): return { "Visual Studio": "15.7", + "msvc": "191", "gcc": "7", "clang": "4.0", "apple-clang": "9.1", @@ -50,10 +51,10 @@ def layout(self): cmake_layout(self, src_folder="src") def validate(self): - if self.info.settings.os not in ["Linux", "Windows", "Macos"] or self.info.settings.arch not in ["x86", "x86_64"]: + if self.settings.os not in ["Linux", "Windows", "Macos"] or self.settings.arch not in ["x86", "x86_64"]: raise ConanInvalidConfiguration("vectorclass supports Linux/Windows/macOS and x86/x86_64 only.") - if self.info.settings.compiler.get_safe("cppstd"): + if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, self._min_cppstd) def loose_lt_semver(v1, v2): @@ -62,15 +63,14 @@ 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.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) diff --git a/recipes/vectorclass/all/test_v1_package/CMakeLists.txt b/recipes/vectorclass/all/test_v1_package/CMakeLists.txt index 1d531c5d5a930..0d20897301b68 100644 --- a/recipes/vectorclass/all/test_v1_package/CMakeLists.txt +++ b/recipes/vectorclass/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(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) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/vectorial/all/conanfile.py b/recipes/vectorial/all/conanfile.py index fd7818ff4d997..91f7fd34d7f37 100644 --- a/recipes/vectorial/all/conanfile.py +++ b/recipes/vectorial/all/conanfile.py @@ -13,18 +13,18 @@ class VectorialConan(ConanFile): license = "BSD-2-Clause" homepage = "https://github.com/scoopr/vectorial" url = "https://github.com/conan-io/conan-center-index" + package_type = "header-library" 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 @@ -35,8 +35,6 @@ 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 = ["m"] diff --git a/recipes/vectorial/all/test_package/conanfile.py b/recipes/vectorial/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/vectorial/all/test_package/conanfile.py +++ b/recipes/vectorial/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/vectorial/all/test_v1_package/CMakeLists.txt b/recipes/vectorial/all/test_v1_package/CMakeLists.txt index 394022f35f7ca..0d20897301b68 100644 --- a/recipes/vectorial/all/test_v1_package/CMakeLists.txt +++ b/recipes/vectorial/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(vectorial REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE vectorial::vectorial) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/velodyne_decoder/all/conandata.yml b/recipes/velodyne_decoder/all/conandata.yml new file mode 100644 index 0000000000000..2e0d017fd8b08 --- /dev/null +++ b/recipes/velodyne_decoder/all/conandata.yml @@ -0,0 +1,10 @@ +sources: + "3.0.0": + url: "https://github.com/valgur/velodyne_decoder/archive/refs/tags/v3.0.0.tar.gz" + sha256: "bce471232205f9d559464ba8cb99bfb96a2245115e54b744115fe71cd9e42042" +patches: + "3.0.0": + - patch_file: "patches/3.0.0-001-fix-msvc-flags.patch" + patch_type: "portability" + patch_description: "Fix /O2 conflicting with debug flags on MSVC" + patch_source: "https://github.com/valgur/velodyne_decoder/commit/22809df3a4d550c3746b17aaca1d6c20692730c4" diff --git a/recipes/velodyne_decoder/all/conanfile.py b/recipes/velodyne_decoder/all/conanfile.py new file mode 100644 index 0000000000000..680c39d6c8c9b --- /dev/null +++ b/recipes/velodyne_decoder/all/conanfile.py @@ -0,0 +1,100 @@ +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, export_conandata_patches, apply_conandata_patches +from conan.tools.scm import Version +import os + +required_conan_version = ">=1.53.0" + +class PackageConan(ConanFile): + name = "velodyne_decoder" + description = "A decoder library for raw Velodyne data and telemetry info" + license = "BSD-3-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/valgur/velodyne_decoder" + topics = ("velodyne", "lidar", "point-cloud") + + package_type = "library" + 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 { + "gcc": "9", + "clang": "5", + "apple-clang": "10", + "Visual Studio": "15", + "msvc": "191", + } + + 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 export_sources(self): + export_conandata_patches(self) + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires("yaml-cpp/0.8.0") + self.requires("ms-gsl/4.0.0", transitive_headers=True) + + 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." + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["INSTALL_THIRD_PARTY"] = 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): + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + 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.set_property("cmake_file_name", "velodyne_decoder") + self.cpp_info.set_property("cmake_target_name", "velodyne_decoder::velodyne_decoder") + self.cpp_info.set_property("pkg_config_name", "velodyne_decoder") + + self.cpp_info.libs = ["velodyne_decoder"] + self.cpp_info.defines = ["_USE_MATH_DEFINES"] diff --git a/recipes/velodyne_decoder/all/patches/3.0.0-001-fix-msvc-flags.patch b/recipes/velodyne_decoder/all/patches/3.0.0-001-fix-msvc-flags.patch new file mode 100644 index 0000000000000..35a9576fc8880 --- /dev/null +++ b/recipes/velodyne_decoder/all/patches/3.0.0-001-fix-msvc-flags.patch @@ -0,0 +1,15 @@ +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -17,7 +17,11 @@ + set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + + if(MSVC) +- add_compile_options(/W4 /O2) ++ add_compile_options( ++ "$<$:/O2>" ++ "$<$:/O2>" ++ /W4 ++ ) + else() + add_compile_options( + "$<$:-ggdb3;-Og>" diff --git a/recipes/velodyne_decoder/all/test_package/CMakeLists.txt b/recipes/velodyne_decoder/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..6af2b5f009096 --- /dev/null +++ b/recipes/velodyne_decoder/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(velodyne_decoder REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE velodyne_decoder::velodyne_decoder) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/velodyne_decoder/all/test_package/conanfile.py b/recipes/velodyne_decoder/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/velodyne_decoder/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/velodyne_decoder/all/test_package/test_package.cpp b/recipes/velodyne_decoder/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..bc82a05812525 --- /dev/null +++ b/recipes/velodyne_decoder/all/test_package/test_package.cpp @@ -0,0 +1,9 @@ +#include +#include +#include +#include + +int main() { + velodyne_decoder::Config config; + velodyne_decoder::StreamDecoder stream_decoder(config); +} diff --git a/recipes/velodyne_decoder/config.yml b/recipes/velodyne_decoder/config.yml new file mode 100644 index 0000000000000..c6ac749e0b234 --- /dev/null +++ b/recipes/velodyne_decoder/config.yml @@ -0,0 +1,3 @@ +versions: + "3.0.0": + folder: all diff --git a/recipes/veque/all/conandata.yml b/recipes/veque/all/conandata.yml index 4a5e1d0f1ad9a..a57efe3175e66 100644 --- a/recipes/veque/all/conandata.yml +++ b/recipes/veque/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.3.7": + url: "https://github.com/Shmoopty/veque/archive/v1.3.7.tar.gz" + sha256: "f67ae3ce3f3e16e60f63bc8d4df0c606a6dfbc8651e01cba5a6c4ed1209349b1" "1.3.6": url: "https://github.com/Shmoopty/veque/archive/v1.3.6.tar.gz" sha256: "9d149b415d948529ac166c962501c59605ef24b3a8ab8561956a6d05f14870ea" diff --git a/recipes/veque/all/conanfile.py b/recipes/veque/all/conanfile.py index 54b31e162b380..8de4f7001f378 100644 --- a/recipes/veque/all/conanfile.py +++ b/recipes/veque/all/conanfile.py @@ -10,15 +10,19 @@ class VequeConan(ConanFile): name = "veque" - url = "https://github.com/conan-io/conan-center-index" - homepage = "https://github.com/Shmoopty/veque" description = "Fast C++ container combining the best features of std::vector and std::deque" - topics = ("cpp17", "vector", "deque") license = "BSL-1.0" - + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/Shmoopty/veque" + topics = ("cpp17", "vector", "deque", "header-only") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True + @property + def _min_cppstd(self): + return 17 + @property def _compilers_minimum_version(self): return { @@ -29,12 +33,15 @@ def _compilers_minimum_version(self): "msvc": "191", } + 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, "17") + check_min_cppstd(self, self._min_cppstd) def loose_lt_semver(v1, v2): lv1 = [int(v) for v in v1.split(".")] @@ -45,15 +52,11 @@ 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++17, which your compiler does not support.", + f"{self.ref} 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def build(self): pass @@ -64,6 +67,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/veque/all/test_package/conanfile.py b/recipes/veque/all/test_package/conanfile.py index d120a992c06a6..8a5bb47f50c4c 100644 --- a/recipes/veque/all/test_package/conanfile.py +++ b/recipes/veque/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/veque/config.yml b/recipes/veque/config.yml index 10d3a845bf8c7..3da45bc778250 100644 --- a/recipes/veque/config.yml +++ b/recipes/veque/config.yml @@ -1,4 +1,6 @@ versions: + "1.3.7": + folder: all "1.3.6": folder: all "1.3.5": diff --git a/recipes/verilator/all/conandata.yml b/recipes/verilator/all/conandata.yml index d1f4e9b1e9a56..5919b3eb0c751 100644 --- a/recipes/verilator/all/conandata.yml +++ b/recipes/verilator/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "5.004": + url: "https://github.com/verilator/verilator/archive/refs/tags/v5.004.tar.gz" + sha256: "7d193a09eebefdbec8defaabfc125663f10cf6ab0963ccbefdfe704a8a4784d2" "4.224": url: "https://github.com/verilator/verilator/archive/refs/tags/v4.224.tar.gz" sha256: "010ff2b5c76d4dbc2ed4a3278a5599ba35c8ed4c05690e57296d6b281591367b" diff --git a/recipes/verilator/config.yml b/recipes/verilator/config.yml index 63930f262a916..41c32c5e1838b 100644 --- a/recipes/verilator/config.yml +++ b/recipes/verilator/config.yml @@ -7,3 +7,5 @@ versions: folder: all "4.224": folder: all + "5.004": + folder: all diff --git a/recipes/very-simple-smtps/all/conandata.yml b/recipes/very-simple-smtps/all/conandata.yml new file mode 100644 index 0000000000000..4a556ac61a493 --- /dev/null +++ b/recipes/very-simple-smtps/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.0.0": + url: "https://github.com/matthewT53/Very-Simple-SMTPS/archive/refs/tags/v1.0.0.tar.gz" + sha256: "96e9a292db8d8137f776b97faff8482a1e7256ef63c1ac42625f581db634ebdf" diff --git a/recipes/very-simple-smtps/all/conanfile.py b/recipes/very-simple-smtps/all/conanfile.py new file mode 100644 index 0000000000000..d2c2b6bd073a1 --- /dev/null +++ b/recipes/very-simple-smtps/all/conanfile.py @@ -0,0 +1,120 @@ +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, rm, rmdir, collect_libs +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" + +class VerySimpleSmtpsConan(ConanFile): + name = "very-simple-smtps" + description = "Library that allows applications to send emails with binary attachments" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/matthewT53/Very-Simple-SMTPS/releases" + topics = ("email", "smtps", "attachments") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": False, + } + + @property + def _min_cppstd(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "9", + "clang": "9", + "apple-clang": "10", + } + + 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): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("doctest/2.4.11") + self.requires("libcurl/[>=7.78.0 <9]") + + def validate(self): + if self.settings.os != "Linux": + raise ConanInvalidConfiguration("very-simple-smtps is only supported by Linux") + + if self.settings.compiler == "clang" and self.settings.compiler.libcxx == "libc++": + raise ConanInvalidConfiguration("very-simple-smtps can not use libc++") + + 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." + ) + 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.") + + def build_requirements(self): + self.tool_requires("meson/1.2.3") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/2.0.3") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = MesonToolchain(self) + tc.generate() + tc = PkgConfigDeps(self) + tc.generate() + tc = VirtualBuildEnv(self) + tc.generate() + + def build(self): + 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) + copy(self, pattern="include/*.hpp", dst=os.path.join(self.package_folder, ""), src=self.source_folder) + meson = Meson(self) + meson.install() + + 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")) + + if self.options.shared: + rm(self, "*.a", os.path.join(self.package_folder, "lib")) + + fix_apple_shared_install_name(self) + + def package_info(self): + self.cpp_info.libs = collect_libs(self) + self.cpp_info.set_property("pkg_config_name", "very-simple-smtps") + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["m", "pthread", "dl"]) diff --git a/recipes/very-simple-smtps/all/test_package/conanfile.py b/recipes/very-simple-smtps/all/test_package/conanfile.py new file mode 100644 index 0000000000000..7433710099642 --- /dev/null +++ b/recipes/very-simple-smtps/all/test_package/conanfile.py @@ -0,0 +1,31 @@ +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): + 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/1.2.3") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/2.0.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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/very-simple-smtps/all/test_package/meson.build b/recipes/very-simple-smtps/all/test_package/meson.build new file mode 100644 index 0000000000000..fc49c0ed275f0 --- /dev/null +++ b/recipes/very-simple-smtps/all/test_package/meson.build @@ -0,0 +1,20 @@ +project('test_package', 'cpp') + +base_cpp_args = [ + '-std=c++17', + '-Werror', + '-Wall', + '-Wextra', + '-fsanitize=address', +] + +base_linker_args = [ + '-fsanitize=address', +] + +package_dep = dependency('very-simple-smtps') +executable('test_package', + sources : ['test_package.cpp'], + dependencies : [package_dep], + cpp_args : base_cpp_args, + link_args: base_linker_args) diff --git a/recipes/very-simple-smtps/all/test_package/test_package.cpp b/recipes/very-simple-smtps/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..d183aa32baa1f --- /dev/null +++ b/recipes/very-simple-smtps/all/test_package/test_package.cpp @@ -0,0 +1,41 @@ +#include +#include +#include +#include +#include +#include + +#include "very-simple-smtps/email.hpp" + +using namespace smtp; + +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. + */ + + EmailParams params{ + "user", // smtp username + "password", // smtp password + "hostname", // smtp server + "bigboss@gmail.com", // to + "tully@gmail.com", // from + "All the bosses at PWC", // cc + "PWC pay rise", // subject + "Hey mate, I have been working here for 5 years now, I think " + "its time for a pay rise.", // body + }; + + Email email(params); + + std::stringstream ss; + ss << email; + const std::string &actual = ss.str(); + + std::cout << actual << std::endl; + return EXIT_SUCCESS; +} diff --git a/recipes/very-simple-smtps/config.yml b/recipes/very-simple-smtps/config.yml new file mode 100644 index 0000000000000..40341aa3db6cd --- /dev/null +++ b/recipes/very-simple-smtps/config.yml @@ -0,0 +1,3 @@ +versions: + "1.0.0": + folder: all diff --git a/recipes/vigra/all/conandata.yml b/recipes/vigra/all/conandata.yml new file mode 100644 index 0000000000000..1d74fa25b7f22 --- /dev/null +++ b/recipes/vigra/all/conandata.yml @@ -0,0 +1,9 @@ +sources: + "1.11.2": + url: "https://github.com/ukoethe/vigra/archive/refs/tags/Version-1-11-2.tar.gz" + sha256: "4841936f5c3c137611ec782e293d961df29d3b5b70ade8cb711374de0f4cb5d3" +patches: + "1.11.2": + - patch_file: "patches/1.11.2-001-disable_doc_build.patch" + patch_description: "enable build to proceed when documentation is disabled" + patch_type: "conan" diff --git a/recipes/vigra/all/conanfile.py b/recipes/vigra/all/conanfile.py new file mode 100644 index 0000000000000..0ac9a204a6384 --- /dev/null +++ b/recipes/vigra/all/conanfile.py @@ -0,0 +1,123 @@ +import os +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMakeDeps, CMakeToolchain, CMake, cmake_layout +from conan.tools.files import get, export_conandata_patches, apply_conandata_patches, rm, copy, replace_in_file + + +class VigraConan(ConanFile): + name = "vigra" + description = "A generic C++ library for image analysis" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "http://ukoethe.github.io/vigra/" + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + topics = "image-processing", "computer-vision" + + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_hdf5": [True, False], + "with_openexr": [True, False], + "with_boost_graph": [True, False], + "with_lemon": [True, False], + } + + default_options = { + "shared": False, + "fPIC": True, + "with_hdf5": True, + "with_openexr": True, + "with_boost_graph": True, + "with_lemon": True, + } + + def export_sources(self): + export_conandata_patches(self) + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + apply_conandata_patches(self) + replace_in_file( + self, + os.path.join(self.source_folder, "src", "impex", "CMakeLists.txt"), + 'SOVERSION ${SOVERSION} INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}"', + 'SOVERSION ${SOVERSION} INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}" INSTALL_NAME_DIR "@rpath"' + ) + + 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 requirements(self): + self.requires("libtiff/4.6.0") + self.requires("libpng/[>=1.6 <2]") + self.requires("fftw/3.3.10") + self.requires("zlib/[>=1.2.11 <2]") + self.requires("libjpeg/9e") + + if self.options.with_hdf5: + self.requires("hdf5/1.14.3") + + if self.options.with_openexr: + self.requires("openexr/3.2.4") + self.requires("imath/3.1.9") + + if self.options.with_boost_graph: + self.requires("boost/1.85.0") + + if self.options.with_lemon: + self.requires("coin-lemon/1.3.1") + + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, 11) + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["WITH_VIGRANUMPY"] = False + tc.cache_variables["BUILD_DOCS"] = False + tc.cache_variables["BUILD_TESTS"] = False + + tc.cache_variables["WITH_OPENEXR"] = self.options.with_openexr + tc.cache_variables["WITH_BOOST_GRAPH"] = self.options.with_boost_graph + tc.cache_variables["WITH_LEMON"] = self.options.with_lemon + + tc.cache_variables["VIGRA_STATIC_LIB"] = not self.options.shared + tc.generate() + + deps = CMakeDeps(self) + deps.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE.txt", self.source_folder, os.path.join(self.package_folder, "licenses")) + cm = CMake(self) + cm.install() + rm(self, "*.cmake", self.package_folder, recursive=True) + #fix_apple_shared_install_name(self) + + def package_info(self): + if not self.options.shared: + self.cpp_info.defines = ["VIGRA_STATIC_LIB"] + + self.cpp_info.libs = ["vigraimpex"] + self.cpp_info.set_property("cmake_file_name", "Vigra") + self.cpp_info.set_property("cmake_target_name", "vigraimpex") + + if self.settings.os == "Windows": + self.cpp_info.system_libs.append("shlwapi") diff --git a/recipes/vigra/all/patches/1.11.2-001-disable_doc_build.patch b/recipes/vigra/all/patches/1.11.2-001-disable_doc_build.patch new file mode 100644 index 0000000000000..322479285c3dd --- /dev/null +++ b/recipes/vigra/all/patches/1.11.2-001-disable_doc_build.patch @@ -0,0 +1,13 @@ +Index: CMakeLists.txt +=================================================================== +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -341,7 +341,7 @@ add_custom_target(PACKAGE_SRC_TAR + COMMENT "Creating ${PROJECT_BINARY_DIR}/vigra-${vigra_version}-src.tar.gz") + + ADD_DEPENDENCIES(PACKAGE_SRC_TAR check) +-ADD_DEPENDENCIES(PACKAGE_SRC_TAR doc_cpp) ++#ADD_DEPENDENCIES(PACKAGE_SRC_TAR doc_cpp) + IF(WITH_VIGRANUMPY AND PYTHON_SPHINX) + ADD_DEPENDENCIES(PACKAGE_SRC_TAR doc_python) + ENDIF() diff --git a/recipes/vigra/all/test_package/CMakeLists.txt b/recipes/vigra/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..8063e47f90875 --- /dev/null +++ b/recipes/vigra/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(Vigra REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE vigraimpex) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/vigra/all/test_package/conanfile.py b/recipes/vigra/all/test_package/conanfile.py new file mode 100644 index 0000000000000..4385dcaa88926 --- /dev/null +++ b/recipes/vigra/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 = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cm = CMake(self) + cm.configure() + cm.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/vigra/all/test_package/test_package.cpp b/recipes/vigra/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..84b2dc0869089 --- /dev/null +++ b/recipes/vigra/all/test_package/test_package.cpp @@ -0,0 +1,18 @@ +#include +#include +#include + +using std::cout; +using std::endl; + +using namespace vigra; + +int main() +{ + cout << "creating a fixed size vigra array.." << endl; + + vigra::TinyVector arr = {1.1, 2.2, 3.3, 4.4, 5.5}; + + cout << "formats supported: " << endl; + cout << impexListFormats() << endl; +} diff --git a/recipes/vigra/config.yml b/recipes/vigra/config.yml new file mode 100644 index 0000000000000..68804c58d126a --- /dev/null +++ b/recipes/vigra/config.yml @@ -0,0 +1,3 @@ +versions: + "1.11.2": + folder: all diff --git a/recipes/vincentlaucsb-csv-parser/all/conandata.yml b/recipes/vincentlaucsb-csv-parser/all/conandata.yml index b2ca51139b4f8..ec36bbdac4426 100644 --- a/recipes/vincentlaucsb-csv-parser/all/conandata.yml +++ b/recipes/vincentlaucsb-csv-parser/all/conandata.yml @@ -1,4 +1,16 @@ sources: + "2.3.0": + url: "https://github.com/vincentlaucsb/csv-parser/archive/refs/tags/2.3.0.tar.gz" + sha256: "27b8ac51aa58b9a4debd8ccfb44738c8583a2e874da42f56bbdf3764b75f3af5" + "2.2.3": + url: "https://github.com/vincentlaucsb/csv-parser/archive/refs/tags/2.2.3.tar.gz" + sha256: "e70ea75612fb45f9a9dd83145fb3fbf0b5929a32683de478ad429cdd85f10e4e" + "2.2.2": + url: "https://github.com/vincentlaucsb/csv-parser/archive/refs/tags/2.2.2.tar.gz" + sha256: "8d7720021d19cf03880eb768d82d7f7e0a240b6d564bc6b495fceb4775b8f0c7" + "2.2.0": + url: "https://github.com/vincentlaucsb/csv-parser/archive/refs/tags/2.2.0.tar.gz" + sha256: "027fd894c5e6a59f5afcedd6cc071364611df5f35fcc6fc4a8e193712b2f1e73" "2.1.3": url: "https://github.com/vincentlaucsb/csv-parser/archive/refs/tags/2.1.3.tar.gz" - sha256: 3f6ce9212e66d273de12a9671dcbf7be7da0241334dc690585dd434dce5e5acf + sha256: "3f6ce9212e66d273de12a9671dcbf7be7da0241334dc690585dd434dce5e5acf" diff --git a/recipes/vincentlaucsb-csv-parser/all/conanfile.py b/recipes/vincentlaucsb-csv-parser/all/conanfile.py index d222c1760cf11..02f230bb6cf6b 100644 --- a/recipes/vincentlaucsb-csv-parser/all/conanfile.py +++ b/recipes/vincentlaucsb-csv-parser/all/conanfile.py @@ -1,43 +1,67 @@ -from conans import ConanFile, 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.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.scm import Version +from conan.tools.layout import basic_layout + +required_conan_version = ">=1.52.0" class VincentlaucsbCsvParserConan(ConanFile): name = "vincentlaucsb-csv-parser" description = "Vince's CSV Parser with simple and intuitive syntax" - topics = ("conan", "csv-parser", "csv", "rfc 4180", "parser", "generator") + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/vincentlaucsb/csv-parser" - license = "MIT" - settings = "os", "compiler" + topics = ("csv", "rfc 4180", "parser", "generator", "header-only") + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 14 - def validate(self): - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 11) + @property + def _compilers_minimum_version(self): + return { + "apple-clang": "10", + "clang": "7", + "gcc": "7", + "msvc": "191", + "Visual Studio": "15", + } - compiler = self.settings.compiler - compiler_version = tools.Version(self.settings.compiler.version) - if compiler == "gcc" and compiler_version < "7": - raise ConanInvalidConfiguration("gcc version < 7 not supported") + def layout(self): + basic_layout(self, src_folder="src") def package_id(self): - self.info.header_only() + self.info.clear() + + def validate(self): + # C++17 recommended: https://github.com/vincentlaucsb/csv-parser/blob/2.1.3/README.md + 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], 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="*", dst="include", src=os.path.join(self._source_subfolder, "single_include")) + copy(self, pattern="LICENSE", 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, "single_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("pthread") diff --git a/recipes/vincentlaucsb-csv-parser/all/test_package/CMakeLists.txt b/recipes/vincentlaucsb-csv-parser/all/test_package/CMakeLists.txt index 59a318147907d..3c123cd449689 100644 --- a/recipes/vincentlaucsb-csv-parser/all/test_package/CMakeLists.txt +++ b/recipes/vincentlaucsb-csv-parser/all/test_package/CMakeLists.txt @@ -1,8 +1,8 @@ -cmake_minimum_required(VERSION 3.9) -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(vincentlaucsb-csv-parser REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE vincentlaucsb-csv-parser::vincentlaucsb-csv-parser) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/vincentlaucsb-csv-parser/all/test_package/conanfile.py b/recipes/vincentlaucsb-csv-parser/all/test_package/conanfile.py index bd7165a553cf4..e845ae751a301 100644 --- a/recipes/vincentlaucsb-csv-parser/all/test_package/conanfile.py +++ b/recipes/vincentlaucsb-csv-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_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/vincentlaucsb-csv-parser/all/test_package/test_package.cpp b/recipes/vincentlaucsb-csv-parser/all/test_package/test_package.cpp index 03461987c25f7..75b3aaa727d63 100644 --- a/recipes/vincentlaucsb-csv-parser/all/test_package/test_package.cpp +++ b/recipes/vincentlaucsb-csv-parser/all/test_package/test_package.cpp @@ -1,4 +1,4 @@ -#include "csv.hpp" +#include #include #include diff --git a/recipes/vincentlaucsb-csv-parser/all/test_v1_package/CMakeLists.txt b/recipes/vincentlaucsb-csv-parser/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..acffc65296726 --- /dev/null +++ b/recipes/vincentlaucsb-csv-parser/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.9) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/vincentlaucsb-csv-parser/all/test_v1_package/conanfile.py b/recipes/vincentlaucsb-csv-parser/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..bd7165a553cf4 --- /dev/null +++ b/recipes/vincentlaucsb-csv-parser/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" + + 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/vincentlaucsb-csv-parser/config.yml b/recipes/vincentlaucsb-csv-parser/config.yml index e6ceade928280..0aa8e836c3b2f 100644 --- a/recipes/vincentlaucsb-csv-parser/config.yml +++ b/recipes/vincentlaucsb-csv-parser/config.yml @@ -1,3 +1,11 @@ versions: + "2.3.0": + folder: all + "2.2.3": + folder: all + "2.2.2": + folder: all + "2.2.0": + folder: all "2.1.3": folder: all diff --git a/recipes/vir-simd/all/conandata.yml b/recipes/vir-simd/all/conandata.yml new file mode 100644 index 0000000000000..00b8471475e1b --- /dev/null +++ b/recipes/vir-simd/all/conandata.yml @@ -0,0 +1,10 @@ +sources: + "0.3.1": + url: "https://github.com/mattkretz/vir-simd/archive/refs/tags/v0.3.1.tar.gz" + sha256: "552b80773a72db2ec2c82fd8fa70211c0fe8a7a3aa9dd7003541d99ff886a360" + "0.3.0": + url: "https://github.com/mattkretz/vir-simd/archive/refs/tags/v0.3.0.tar.gz" + sha256: "545c8c3254d8369fa01b2a5f8c674a8cb2703340eff63bca352bcd6d7147728f" + "0.2.0": + url: "https://github.com/mattkretz/vir-simd/archive/refs/tags/v0.2.0.tar.gz" + sha256: "197432196ec73009051188ba686124a469d75d639fc5408613b30ed2981f0b70" diff --git a/recipes/vir-simd/all/conanfile.py b/recipes/vir-simd/all/conanfile.py new file mode 100644 index 0000000000000..b79fe3dc61b1b --- /dev/null +++ b/recipes/vir-simd/all/conanfile.py @@ -0,0 +1,76 @@ +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 VirSIMDConan(ConanFile): + name = "vir-simd" + description = "A fallback std::experimental::simd (Parallelism TS 2) implementation with additional features" + license = "LGPL-3.0-or-later" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/mattkretz/vir-simd" + topics = ("simd", "parallelism-ts", "cpp17", "header-only") + package_type = "header-library" + 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": "191", + "gcc": "7", + "clang": "5", + "apple-clang": "5.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"): + 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} Windows support is not provided so far.") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def build(self): + # Nothing to do + return + + def package(self): + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, + pattern="vir/*.h", + dst=os.path.join(self.package_folder, "include"), + src=self.source_folder, + ) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "vir-simd") + self.cpp_info.set_property("cmake_target_name", "vir-simd::vir-simd") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/vir-simd/all/test_package/CMakeLists.txt b/recipes/vir-simd/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..2737b968f7f8b --- /dev/null +++ b/recipes/vir-simd/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(vir-simd REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE vir-simd::vir-simd) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/vir-simd/all/test_package/conanfile.py b/recipes/vir-simd/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/vir-simd/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/vir-simd/all/test_package/test_package.cpp b/recipes/vir-simd/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..fb0755d36c45f --- /dev/null +++ b/recipes/vir-simd/all/test_package/test_package.cpp @@ -0,0 +1,24 @@ +#include +#include +#include + +namespace stdx = vir::stdx; + +template +std::ostream& operator<<(std::ostream& s, const stdx::simd& v) { + s << '[' << v[0]; + for (std::size_t i = 1; i < v.size(); ++i) { + s << ", " << v[i]; + } + return s << ']'; +} + +int main(void) { + + using floatv = stdx::simd>; + const floatv a{5}; + + std::cout << a * 3<< std::endl; + + return EXIT_SUCCESS; +} diff --git a/recipes/vir-simd/all/test_v1_package/CMakeLists.txt b/recipes/vir-simd/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..54d2c07bb9d41 --- /dev/null +++ b/recipes/vir-simd/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +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/vir-simd/all/test_v1_package/conanfile.py b/recipes/vir-simd/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..c492184eec19c --- /dev/null +++ b/recipes/vir-simd/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/vir-simd/config.yml b/recipes/vir-simd/config.yml new file mode 100644 index 0000000000000..a996ca7a9b498 --- /dev/null +++ b/recipes/vir-simd/config.yml @@ -0,0 +1,8 @@ +versions: + # Newer versions at the top + "0.3.1": + folder: all + "0.3.0": + folder: all + "0.2.0": + folder: all diff --git a/recipes/visit_struct/all/conandata.yml b/recipes/visit_struct/all/conandata.yml index 959681c08c025..e688df3cb0abd 100644 --- a/recipes/visit_struct/all/conandata.yml +++ b/recipes/visit_struct/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.1.0": + url: "https://github.com/cbeck88/visit_struct/archive/refs/tags/v1.1.0.tar.gz" + sha256: "73a84f2d8a8844bc03a919163b27ee3b3f85d8c64f6151ce098ca50dbed6be51" "1.0": - url: "https://github.com/garbageslam/visit_struct/archive/refs/tags/v1.0.tar.gz" + url: "https://github.com/cbeck88/visit_struct/archive/refs/tags/v1.0.tar.gz" sha256: "7e5d727bd9fbe444d182840625f5eb21f2cf67f06f3aeab27a2d7c4724b3c09c" diff --git a/recipes/visit_struct/all/conanfile.py b/recipes/visit_struct/all/conanfile.py index f72295c8e8cc9..7cb8d11207ec2 100644 --- a/recipes/visit_struct/all/conanfile.py +++ b/recipes/visit_struct/all/conanfile.py @@ -1,15 +1,19 @@ +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 -from conans import ConanFile, tools -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" class VisitStructConan(ConanFile): name = "visit_struct" description = "A miniature library for struct-field reflection in C++" - topics = ("reflection", "introspection", "visitor", "struct-field-visitor",) - homepage = "https://github.com/garbageslam/visit_struct" - url = "https://github.com/conan-io/conan-center-index" license = "BSL-1.0" + topics = ("reflection", "introspection", "visitor", "struct-field-visitor", "header-only") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/cbeck88/visit_struct" + package_type = "header-library" settings = "os", "arch", "compiler", "build_type", options = { "with_boost_fusion": [True, False], @@ -22,28 +26,35 @@ class VisitStructConan(ConanFile): 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 requirements(self): if self.options.with_boost_fusion or self.options.with_boost_hana: - self.requires("boost/1.78.0") + self.requires("boost/1.83.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, "11") + 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", src=self._source_subfolder, dst="licenses") - self.copy(pattern="*visit_struct.hpp", src=os.path.join(self._source_subfolder, "include"), dst="include") - self.copy(pattern="*visit_struct_intrusive.hpp", src=os.path.join(self._source_subfolder, "include"), dst="include") + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, pattern="*visit_struct.hpp", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self.source_folder, "include")) + copy(self, pattern="*visit_struct_intrusive.hpp", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self.source_folder, "include")) if self.options.with_boost_fusion: - self.copy(pattern="*visit_struct_boost_fusion.hpp", src=os.path.join(self._source_subfolder, "include"), dst="include") + copy(self, pattern="*visit_struct_boost_fusion.hpp", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self.source_folder, "include")) if self.options.with_boost_hana: - self.copy(pattern="*visit_struct_boost_hana.hpp", src=os.path.join(self._source_subfolder, "include"), dst="include") + copy(self, pattern="*visit_struct_boost_hana.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/visit_struct/all/test_package/CMakeLists.txt b/recipes/visit_struct/all/test_package/CMakeLists.txt index 0b3daffae916f..24d52d34e85ac 100644 --- a/recipes/visit_struct/all/test_package/CMakeLists.txt +++ b/recipes/visit_struct/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(visit_struct REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} visit_struct::visit_struct) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE visit_struct::visit_struct) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/visit_struct/all/test_package/conanfile.py b/recipes/visit_struct/all/test_package/conanfile.py index 1d4478bedc297..3a91c9439218e 100644 --- a/recipes/visit_struct/all/test_package/conanfile.py +++ b/recipes/visit_struct/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" + 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/visit_struct/all/test_v1_package/CMakeLists.txt b/recipes/visit_struct/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..be00a8c7f57c7 --- /dev/null +++ b/recipes/visit_struct/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/visit_struct/all/test_v1_package/conanfile.py b/recipes/visit_struct/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/visit_struct/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/visit_struct/config.yml b/recipes/visit_struct/config.yml index cbd84c934d0b3..f936952d5165b 100644 --- a/recipes/visit_struct/config.yml +++ b/recipes/visit_struct/config.yml @@ -1,3 +1,5 @@ versions: + "1.1.0": + folder: "all" "1.0": folder: "all" diff --git a/recipes/vk-bootstrap/all/conandata.yml b/recipes/vk-bootstrap/all/conandata.yml index 7b7ae61282844..d3c923855081d 100644 --- a/recipes/vk-bootstrap/all/conandata.yml +++ b/recipes/vk-bootstrap/all/conandata.yml @@ -1,4 +1,7 @@ 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" diff --git a/recipes/vk-bootstrap/all/conanfile.py b/recipes/vk-bootstrap/all/conanfile.py index c8a66635b258c..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, 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.52.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,7 +39,7 @@ 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", } @@ -52,19 +52,19 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + 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.get_safe("cppstd"): + if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, self._min_cppstd) def loose_lt_semver(v1, v2): @@ -73,18 +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.ref} requires C++{self._min_cppstd}, which your compiler does not support.", ) - if is_msvc(self) and self.info.options.shared: + 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/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 c35636d87baa5..eaed33f60995e 100644 --- a/recipes/vk-bootstrap/config.yml +++ b/recipes/vk-bootstrap/config.yml @@ -1,4 +1,6 @@ versions: + "0.7": + folder: all "0.6": folder: all "0.5": diff --git a/recipes/vo-amrwbenc/all/conandata.yml b/recipes/vo-amrwbenc/all/conandata.yml new file mode 100644 index 0000000000000..942ba6a84fca6 --- /dev/null +++ b/recipes/vo-amrwbenc/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.1.3": + url: "https://downloads.sourceforge.net/project/opencore-amr/vo-amrwbenc/vo-amrwbenc-0.1.3.tar.gz" + sha256: "5652b391e0f0e296417b841b02987d3fd33e6c0af342c69542cbb016a71d9d4e" diff --git a/recipes/vo-amrwbenc/all/conanfile.py b/recipes/vo-amrwbenc/all/conanfile.py new file mode 100644 index 0000000000000..71830859a3a43 --- /dev/null +++ b/recipes/vo-amrwbenc/all/conanfile.py @@ -0,0 +1,108 @@ +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, 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.54.0" + + +class OpencoreAmrConan(ConanFile): + name = "vo-amrwbenc" + homepage = "https://sourceforge.net/projects/opencore-amr/" + description = "VisualOn AMR-WB encoder library." + topics = ("audio-codec", "amr-wb", "G.722.2") + url = "https://github.com/conan-io/conan-center-index" + license = "Apache-2.0" + package_type = "library" + settings = "os", "compiler", "build_type", "arch" + 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 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 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") + if is_msvc(self): + self.tool_requires("automake/1.16.5") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + tc = AutotoolsToolchain(self) + yes_no = lambda v: "yes" if v else "no" + if is_msvc(self): + tc.extra_cflags.append("-EHsc") + if check_min_vs(self, "180", raise_invalid=False): + tc.extra_cflags.append("-FS") + tc.generate() + + if is_msvc(self): + env = Environment() + 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): + autotools = Autotools(self) + autotools.configure() + autotools.make() + + def package(self): + copy(self, pattern="NOTICE", 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, "lib", "pkgconfig")) + + fix_apple_shared_install_name(self) + + if is_msvc(self) and self.options.shared: + for import_lib in ["vo-amrwbenc"]: + 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.libs = ["vo-amrwbenc"] + + self.cpp_info.set_property("pkg_config_name", "vo-amrwbenc") diff --git a/recipes/vo-amrwbenc/all/test_package/CMakeLists.txt b/recipes/vo-amrwbenc/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..996db2c8839df --- /dev/null +++ b/recipes/vo-amrwbenc/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) + +find_package(vo-amrwbenc REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE vo-amrwbenc::vo-amrwbenc) diff --git a/recipes/vo-amrwbenc/all/test_package/conanfile.py b/recipes/vo-amrwbenc/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/vo-amrwbenc/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/vo-amrwbenc/all/test_package/test_package.c b/recipes/vo-amrwbenc/all/test_package/test_package.c new file mode 100644 index 0000000000000..3680b1b652585 --- /dev/null +++ b/recipes/vo-amrwbenc/all/test_package/test_package.c @@ -0,0 +1,10 @@ +#include +#include "vo-amrwbenc/enc_if.h" + +int main(void) +{ + void* state = E_IF_init(); + E_IF_exit(state); + + return EXIT_SUCCESS; +} diff --git a/recipes/vo-amrwbenc/config.yml b/recipes/vo-amrwbenc/config.yml new file mode 100644 index 0000000000000..ce394846b7adb --- /dev/null +++ b/recipes/vo-amrwbenc/config.yml @@ -0,0 +1,3 @@ +versions: + "0.1.3": + folder: "all" diff --git a/recipes/volk/all/conandata.yml b/recipes/volk/all/conandata.yml index f99a39c644222..5f8a920ef96d6 100644 --- a/recipes/volk/all/conandata.yml +++ b/recipes/volk/all/conandata.yml @@ -1,40 +1,22 @@ 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" - "1.3.204": - url: "https://github.com/zeux/volk/archive/refs/tags/1.3.204.tar.gz" - sha256: "7776e7f3c70f199579da33d2ccd7152ca8b96182fa98c31fbe80880cef0fdf70" + "1.3.296.0": + url: "https://github.com/zeux/volk/archive/refs/tags/vulkan-sdk-1.3.296.0.tar.gz" + sha256: "8ffd0e81e29688f4abaa39e598937160b098228f37503903b10d481d4862ab85" + "1.3.268.0": + url: "https://github.com/zeux/volk/archive/refs/tags/vulkan-sdk-1.3.268.0.tar.gz" + sha256: "f1d30fac1cdc17a8fdc8c69f371663547f92db99cfd612962190bb1e2c8ce74d" + "1.3.261.1": + url: "https://github.com/zeux/volk/archive/refs/tags/sdk-1.3.261.1.tar.gz" + sha256: "052866c6cbff9efdf1e73e71c1d65070c36863730c95a4e93833500b4d894d69" + "1.3.250.0": + url: "https://github.com/zeux/volk/archive/refs/tags/sdk-1.3.250.0.tar.gz" + sha256: "5b6b6e8abcebe5a3e35ee7d1115d12dc976413da4f5dddf8b387e7769f92fc50" + "1.3.243.0": + url: "https://github.com/zeux/volk/archive/refs/tags/sdk-1.3.243.0.tar.gz" + sha256: "5cd92d592227d2d4d9af1b66662d4f92f84bbf431572c43889689e15b6da1dca" + "1.3.239.0": + url: "https://github.com/zeux/volk/archive/refs/tags/sdk-1.3.239.0.tar.gz" + sha256: "b628ae7d4e554c20763ac34e1fd18b87725c0c346e2a7106fa23701877bbac65" "1.2.198": - url: "https://github.com/zeux/volk/archive/1.2.198.tar.gz" + url: "https://github.com/zeux/volk/archive/refs/tags/1.2.198.tar.gz" sha256: "8f3869d94ccce265eaef064b1be0af2d8de925e512d3413c1cf02591b99597e2" - "1.2.195": - url: "https://github.com/zeux/volk/archive/713ab8bfcd9d8e5fe78ccf85806c0b4e5c566f71.tar.gz" - sha256: "affba674733e8bbf58e36534a1aba1c41cb4a457f0db13b415347fb541a69c04" - "1.2.190": - url: "https://github.com/zeux/volk/archive/1.2.190.tar.gz" - sha256: "07f03720b8c70a626c98cc9545350538122bca9f853e6ed20ccad5a25d55fa4b" - "1.2.182": - url: "https://github.com/zeux/volk/archive/1.2.182.tar.gz" - sha256: "5b03943ed26ce9ddf465ec3022c0ffcb264572cf8d467e6e2aad1a8917629057" - "1.2.170": - url: "https://github.com/zeux/volk/archive/1.2.170.tar.gz" - sha256: "01f37fc0c904afd2eb8060cada73f903ab1cdae87c7c24e77585ca7fb9bafae4" - "1.2.162": - url: "https://github.com/zeux/volk/archive/1.2.162.tar.gz" - sha256: "ac4d9d6e88dee5a83ad176e2da57f1989ca2c6df155a0aeb5e18e9471aa4d777" - "1.2.140": - url: "https://github.com/zeux/volk/archive/1.2.140.tar.gz" - sha256: "f4041baf7a19a996a0dc96763703751b1b15918b3a893bb77669755702c645cb" diff --git a/recipes/volk/all/conanfile.py b/recipes/volk/all/conanfile.py index 4d95cbead05b0..d15dc5ab17016 100644 --- a/recipes/volk/all/conanfile.py +++ b/recipes/volk/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, replace_in_file, rmdir +from conan.tools.scm import Version import os -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.53.0" class VolkConan(ConanFile): @@ -22,6 +23,7 @@ class VolkConan(ConanFile): ) topics = ("vulkan", "loader", "extension", "entrypoint", "graphics") + package_type = "static-library" settings = "os", "arch", "compiler", "build_type" options = { "fPIC": [True, False], @@ -35,24 +37,17 @@ def config_options(self): 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 + 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}") + self.requires(f"vulkan-headers/{self.version}", transitive_headers=True) 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 +59,25 @@ def generate(self): 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") + if Version(self.version) < "1.3.296": + replace_in_file(self, cmakelists, "find_package(Vulkan QUIET)", "find_package(VulkanHeaders REQUIRED)") + + if Version(self.version) < "1.3.261": + replace_in_file(self, cmakelists, "Vulkan::Vulkan", "Vulkan::Headers") + elif Version(self.version) < "1.3.296": + replace_in_file( + self, + cmakelists, + "if(VULKAN_HEADERS_INSTALL_DIR)", + "if(1)\nset(VOLK_INCLUDES ${VulkanHeaders_INCLUDE_DIRS})\nelseif(VULKAN_HEADERS_INSTALL_DIR)", + ) + else: + replace_in_file( + self, + cmakelists, + "if(VULKAN_HEADERS_INSTALL_DIR)", + "if(1)\nfind_package(VulkanHeaders REQUIRED)\nset(VOLK_INCLUDES ${VulkanHeaders_INCLUDE_DIRS})\nelseif(VULKAN_HEADERS_INSTALL_DIR)", + ) def build(self): self._patch_sources() diff --git a/recipes/volk/config.yml b/recipes/volk/config.yml index 863bb85e7f8b2..a4fde06481cb0 100644 --- a/recipes/volk/config.yml +++ b/recipes/volk/config.yml @@ -1,27 +1,15 @@ versions: - "1.3.236.0": + "1.3.296.0": folder: "all" - "1.3.231.1": + "1.3.268.0": folder: "all" - "1.3.224.1": + "1.3.261.1": folder: "all" - "1.3.224.0": + "1.3.250.0": folder: "all" - "1.3.216.0": + "1.3.243.0": folder: "all" - "1.3.204": + "1.3.239.0": folder: "all" "1.2.198": folder: "all" - "1.2.195": - folder: "all" - "1.2.190": - folder: "all" - "1.2.182": - folder: "all" - "1.2.170": - folder: "all" - "1.2.162": - folder: "all" - "1.2.140": - folder: "all" diff --git a/recipes/vorbis/all/conandata.yml b/recipes/vorbis/all/conandata.yml index 07b65e3a51126..870e86ced00f7 100644 --- a/recipes/vorbis/all/conandata.yml +++ b/recipes/vorbis/all/conandata.yml @@ -6,5 +6,12 @@ sources: url: "https://github.com/xiph/vorbis/archive/v1.3.6.tar.gz" sha256: "43fc4bc34f13da15b8acfa72fd594678e214d1cab35fc51d3a54969a725464eb" patches: + "1.3.7": + - patch_file: "patches/1.3.7-0001-mingw-shared-def.patch" + patch_description: "MinGW: fix .def file for shared lib" + patch_type: "portability" + patch_source: "https://github.com/xiph/vorbis/pull/76" "1.3.6": - - patch_file: "patches/link-libm-find-package-ogg.patch" + - patch_file: "patches/1.3.6-0001-link-libm-find-package-ogg.patch" + patch_description: "CMake: robust discovery and link of libm and Ogg" + patch_type: "conan" diff --git a/recipes/vorbis/all/conanfile.py b/recipes/vorbis/all/conanfile.py index 007a900f3ab52..58d7504b2daef 100644 --- a/recipes/vorbis/all/conanfile.py +++ b/recipes/vorbis/all/conanfile.py @@ -1,19 +1,19 @@ 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.50.0" +required_conan_version = ">=1.54.0" class VorbisConan(ConanFile): name = "vorbis" description = "The VORBIS audio codec library" - topics = ("vorbis", "audio", "codec") + topics = ("audio", "codec") url = "https://github.com/conan-io/conan-center-index" homepage = "https://xiph.org/vorbis/" license = "BSD-3-Clause" - + package_type = "library" settings = "os", "arch", "build_type", "compiler" options = { "shared": [True, False], @@ -25,8 +25,7 @@ class VorbisConan(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,32 +33,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 - - def requirements(self): - self.requires("ogg/1.3.5") + 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("ogg/1.3.5", transitive_headers=True, transitive_libs=True) + 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) # 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() cd = CMakeDeps(self) cd.generate() diff --git a/recipes/vorbis/all/patches/link-libm-find-package-ogg.patch b/recipes/vorbis/all/patches/1.3.6-0001-link-libm-find-package-ogg.patch similarity index 100% rename from recipes/vorbis/all/patches/link-libm-find-package-ogg.patch rename to recipes/vorbis/all/patches/1.3.6-0001-link-libm-find-package-ogg.patch diff --git a/recipes/vorbis/all/patches/1.3.7-0001-mingw-shared-def.patch b/recipes/vorbis/all/patches/1.3.7-0001-mingw-shared-def.patch new file mode 100644 index 0000000000000..e29a62c280484 --- /dev/null +++ b/recipes/vorbis/all/patches/1.3.7-0001-mingw-shared-def.patch @@ -0,0 +1,29 @@ +--- a/win32/vorbis.def ++++ b/win32/vorbis.def +@@ -1,6 +1,6 @@ + ; vorbis.def + ; +-LIBRARY ++ + EXPORTS + _floor_P + _mapping_P +--- a/win32/vorbisenc.def ++++ b/win32/vorbisenc.def +@@ -1,6 +1,5 @@ + ; vorbisenc.def + ; +-LIBRARY + + EXPORTS + vorbis_encode_init +--- a/win32/vorbisfile.def ++++ b/win32/vorbisfile.def +@@ -1,6 +1,6 @@ + ; vorbisfile.def + ; +-LIBRARY ++ + EXPORTS + ov_clear + ov_open diff --git a/recipes/vorbis/all/test_package/8kadpcm.wav b/recipes/vorbis/all/test_package/8kadpcm.wav deleted file mode 100644 index 40a362222bc7a..0000000000000 Binary files a/recipes/vorbis/all/test_package/8kadpcm.wav and /dev/null differ diff --git a/recipes/vorbis/all/test_package/conanfile.py b/recipes/vorbis/all/test_package/conanfile.py index 327c8dd400306..3a8c6c5442b33 100644 --- a/recipes/vorbis/all/test_package/conanfile.py +++ b/recipes/vorbis/all/test_package/conanfile.py @@ -22,6 +22,4 @@ def build(self): def test(self): if not cross_building(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") - in_wav_path = os.path.join(self.source_folder, "8kadpcm.wav") - out_ogg_path = os.path.join(self.cpp.build.bindirs[0], "sample.ogg") - self.run(f"{bin_path} < {in_wav_path} > {out_ogg_path}", env="conanrun") + self.run(bin_path, env="conanrun") diff --git a/recipes/vorbis/all/test_package/test_package.c b/recipes/vorbis/all/test_package/test_package.c index d8d92bc3cbff7..794aa0d6e61b5 100644 --- a/recipes/vorbis/all/test_package/test_package.c +++ b/recipes/vorbis/all/test_package/test_package.c @@ -1,252 +1,7 @@ -/******************************************************************** - * * - * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * - * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * - * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * - * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * - * * - * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: simple example encoder - last mod: $Id$ - - ********************************************************************/ - -/* takes a stereo 16bit 44.1kHz WAV file from stdin and encodes it into - a Vorbis bitstream */ - -/* Note that this is POSIX, not ANSI, code */ - #include -#include -#include -#include -#include #include -#ifdef _WIN32 /* We need the following two to set stdin/stdout to binary */ -#include -#include -#endif - -#if defined(__MACOS__) && defined(__MWERKS__) -#include /* CodeWarrior's Mac "command-line" support */ -#endif - -#define READ 1024 -signed char readbuffer[READ*4+44]; /* out of the data segment, not the stack */ - int main(){ - ogg_stream_state os; /* take physical pages, weld into a logical - stream of packets */ - ogg_page og; /* one Ogg bitstream page. Vorbis packets are inside */ - ogg_packet op; /* one raw packet of data for decode */ - - vorbis_info vi; /* struct that stores all the static vorbis bitstream - settings */ - vorbis_comment vc; /* struct that stores all the user comments */ - - vorbis_dsp_state vd; /* central working state for the packet->PCM decoder */ - vorbis_block vb; /* local working space for packet->PCM decode */ - - int eos=0,ret; - int i, founddata; - -#if defined(macintosh) && defined(__MWERKS__) - int argc = 0; - char **argv = NULL; - argc = ccommand(&argv); /* get a "command line" from the Mac user */ - /* this also lets the user set stdin and stdout */ -#endif - - /* we cheat on the WAV header; we just bypass 44 bytes (simplest WAV - header is 44 bytes) and assume that the data is 44.1khz, stereo, 16 bit - little endian pcm samples. This is just an example, after all. */ - -#ifdef _WIN32 /* We need to set stdin/stdout to binary mode. Damn windows. */ - /* if we were reading/writing a file, it would also need to in - binary mode, eg, fopen("file.wav","wb"); */ - /* Beware the evil ifdef. We avoid these where we can, but this one we - cannot. Don't add any more, you'll probably go to hell if you do. */ - _setmode( _fileno( stdin ), _O_BINARY ); - _setmode( _fileno( stdout ), _O_BINARY ); -#endif - - - /* we cheat on the WAV header; we just bypass the header and never - verify that it matches 16bit/stereo/44.1kHz. This is just an - example, after all. */ - - readbuffer[0] = '\0'; - for (i=0, founddata=0; i<30 && ! feof(stdin) && ! ferror(stdin); i++) - { - fread(readbuffer,1,2,stdin); - - if ( ! strncmp((char*)readbuffer, "da", 2) ){ - founddata = 1; - fread(readbuffer,1,6,stdin); - break; - } - } - - /********** Encode setup ************/ - - vorbis_info_init(&vi); - - /* choose an encoding mode. A few possibilities commented out, one - actually used: */ - - /********************************************************************* - Encoding using a VBR quality mode. The usable range is -.1 - (lowest quality, smallest file) to 1. (highest quality, largest file). - Example quality mode .4: 44kHz stereo coupled, roughly 128kbps VBR - - ret = vorbis_encode_init_vbr(&vi,2,44100,.4); - - --------------------------------------------------------------------- - - Encoding using an average bitrate mode (ABR). - example: 44kHz stereo coupled, average 128kbps VBR - - ret = vorbis_encode_init(&vi,2,44100,-1,128000,-1); - - --------------------------------------------------------------------- - - Encode using a quality mode, but select that quality mode by asking for - an approximate bitrate. This is not ABR, it is true VBR, but selected - using the bitrate interface, and then turning bitrate management off: - - ret = ( vorbis_encode_setup_managed(&vi,2,44100,-1,128000,-1) || - vorbis_encode_ctl(&vi,OV_ECTL_RATEMANAGE2_SET,NULL) || - vorbis_encode_setup_init(&vi)); - - *********************************************************************/ - - ret=vorbis_encode_init_vbr(&vi,2,44100,0.1); - - /* do not continue if setup failed; this can happen if we ask for a - mode that libVorbis does not support (eg, too low a bitrate, etc, - will return 'OV_EIMPL') */ - - if(ret)exit(1); - - /* add a comment */ + vorbis_comment vc; vorbis_comment_init(&vc); - vorbis_comment_add_tag(&vc,"ENCODER","encoder_example.c"); - - /* set up the analysis state and auxiliary encoding storage */ - vorbis_analysis_init(&vd,&vi); - vorbis_block_init(&vd,&vb); - - /* set up our packet->stream encoder */ - /* pick a random serial number; that way we can more likely build - chained streams just by concatenation */ - srand(time(NULL)); - ogg_stream_init(&os,rand()); - - /* Vorbis streams begin with three headers; the initial header (with - most of the codec setup parameters) which is mandated by the Ogg - bitstream spec. The second header holds any comment fields. The - third header holds the bitstream codebook. We merely need to - make the headers, then pass them to libvorbis one at a time; - libvorbis handles the additional Ogg bitstream constraints */ - - { - ogg_packet header; - ogg_packet header_comm; - ogg_packet header_code; - - vorbis_analysis_headerout(&vd,&vc,&header,&header_comm,&header_code); - ogg_stream_packetin(&os,&header); /* automatically placed in its own - page */ - ogg_stream_packetin(&os,&header_comm); - ogg_stream_packetin(&os,&header_code); - - /* This ensures the actual - * audio data will start on a new page, as per spec - */ - while(!eos){ - int result=ogg_stream_flush(&os,&og); - if(result==0)break; - fwrite(og.header,1,og.header_len,stdout); - fwrite(og.body,1,og.body_len,stdout); - } - - } - - while(!eos){ - long i; - long bytes=fread(readbuffer,1,READ*4,stdin); /* stereo hardwired here */ - - if(bytes==0){ - /* end of file. this can be done implicitly in the mainline, - but it's easier to see here in non-clever fashion. - Tell the library we're at end of stream so that it can handle - the last frame and mark end of stream in the output properly */ - vorbis_analysis_wrote(&vd,0); - - }else{ - /* data to encode */ - - /* expose the buffer to submit data */ - float **buffer=vorbis_analysis_buffer(&vd,READ); - - /* uninterleave samples */ - for(i=0;i {out_ogg_path}", run_environment=True) + self.run(bin_path, run_environment=True) diff --git a/recipes/voropp/all/conanfile.py b/recipes/voropp/all/conanfile.py index 1186fcf21f63b..c327986e7052b 100644 --- a/recipes/voropp/all/conanfile.py +++ b/recipes/voropp/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 VoroppConan(ConanFile): @@ -18,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], @@ -36,14 +37,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, verify=False) + get(self, **self.conan_data["sources"][self.version], strip_root=True, verify=False) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/voropp/all/test_v1_package/CMakeLists.txt b/recipes/voropp/all/test_v1_package/CMakeLists.txt index 5a80123211f89..0d20897301b68 100644 --- a/recipes/voropp/all/test_v1_package/CMakeLists.txt +++ b/recipes/voropp/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(voropp REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE voropp::voropp) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/vsg/all/conandata.yml b/recipes/vsg/all/conandata.yml new file mode 100644 index 0000000000000..3b2abd6731e51 --- /dev/null +++ b/recipes/vsg/all/conandata.yml @@ -0,0 +1,13 @@ +sources: + "1.0.0": + url: "https://github.com/vsg-dev/VulkanSceneGraph/archive/refs/tags/VulkanSceneGraph-1.0.0.tar.gz" + sha256: "5611284f4256893ea97a33f9e99f5ecc8bdda110cc9fb7770b291fb45e8f9cf6" + "1.0.3": + url: "https://github.com/vsg-dev/VulkanSceneGraph/archive/refs/tags/VulkanSceneGraph-1.0.3.tar.gz" + sha256: "84aa1d445ecdd2702843f8f01e760d4db32c2ab3fe8c5d6122f8a83b67a50e36" + "1.0.5": + url: "https://github.com/vsg-dev/VulkanSceneGraph/archive/refs/tags/v1.0.5.tar.gz" + sha256: "ff58260fcb88d19d92c40a70bc40ff06abb1a8805568eb76862a036d13ada75b" + "1.0.9": + url: "https://github.com/vsg-dev/VulkanSceneGraph/archive/v1.0.9.tar.gz" + sha256: "9a62be7facc13c391c33dc8356b147a3b86f531ea72a28f6b2c364777e761412" diff --git a/recipes/vsg/all/conanfile.py b/recipes/vsg/all/conanfile.py new file mode 100644 index 0000000000000..104e5dc3d7219 --- /dev/null +++ b/recipes/vsg/all/conanfile.py @@ -0,0 +1,118 @@ +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 get, copy, rm, rmdir, collect_libs +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMakeToolchain, CMakeDeps, CMake +import os + +required_conan_version = ">=1.53.0" + +class VsgConan(ConanFile): + name = "vsg" + description = "VulkanSceneGraph" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://www.vulkanscenegraph.org" + topics = ("vulkan", "scenegraph", "graphics", "3d") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "max_devices": [1,2,3,4], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "max_devices" : 1, + "fPIC": True, + } + + @property + def _min_cppstd(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "7", + "clang": "7", + "apple-clang": "10", + } + 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("vulkan-loader/1.3.239.0", transitive_headers=True) + + def validate(self): + if self.info.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + check_min_vs(self, 191) + + if is_msvc_static_runtime(self): + raise ConanInvalidConfiguration(f"{self.name} does not support MSVC static runtime (MT/MTd) configurations, only dynamic runtime (MD/MDd) is supported") + + 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) + if is_msvc(self): + tc.variables["USE_MSVC_RUNTIME_LIBRARY_DLL"] = False + tc.variables["BUILD_SHARED_LIBS"] = self.options.shared + tc.variables["VSG_SUPPORTS_ShaderCompiler"] = 0 + tc.variables["VSG_MAX_DEVICES"] = self.options.max_devices + tc.generate() + + deps = CMakeDeps(self) + + deps.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", "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")) + rm(self, "Find*.cmake", os.path.join(self.package_folder, "lib/cmake/vsg")) + rm(self, "*Config.cmake", os.path.join(self.package_folder, "lib/cmake/vsg")) + + def package_info(self): + self.cpp_info.libs = collect_libs(self) + + self.cpp_info.set_property("cmake_file_name", "vsg") + self.cpp_info.set_property("cmake_target_name", "vsg::vsg") + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("pthread") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "vsg" + self.cpp_info.filenames["cmake_find_package_multi"] = "vsg" + self.cpp_info.names["cmake_find_package"] = "VSG" + self.cpp_info.names["cmake_find_package_multi"] = "vsg" diff --git a/recipes/vsg/all/test_package/CMakeLists.txt b/recipes/vsg/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..5b45e894695a3 --- /dev/null +++ b/recipes/vsg/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package CXX) # if the project uses c++ + +find_package(vsg REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE vsg::vsg) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/vsg/all/test_package/conanfile.py b/recipes/vsg/all/test_package/conanfile.py new file mode 100644 index 0000000000000..1111583fea732 --- /dev/null +++ b/recipes/vsg/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/vsg/all/test_package/test_package.cpp b/recipes/vsg/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..ef112a2f69aaf --- /dev/null +++ b/recipes/vsg/all/test_package/test_package.cpp @@ -0,0 +1,24 @@ + +#include +#include +#include + + +#include + +#include +#include + +int main(int argc, char** argv) +{ + vsg::CommandLine arguments(&argc, argv); + auto numObjects = arguments.value(1u, {"---num-objects", "-n"}); + if (arguments.errors()) return arguments.writeErrorMessages(std::cerr); + + using Objects = std::vector>; + Objects objects; + objects.push_back(vsg::Node::create()); + + + return 0; +} diff --git a/recipes/vsg/config.yml b/recipes/vsg/config.yml new file mode 100644 index 0000000000000..9269a45607b90 --- /dev/null +++ b/recipes/vsg/config.yml @@ -0,0 +1,9 @@ +versions: + "1.0.9": + folder: all + "1.0.5": + folder: all + "1.0.3": + folder: all + "1.0.0": + folder: all diff --git a/recipes/vtu11/all/conandata.yml b/recipes/vtu11/all/conandata.yml new file mode 100644 index 0000000000000..bb58ee7fddaee --- /dev/null +++ b/recipes/vtu11/all/conandata.yml @@ -0,0 +1,5 @@ +sources: + "1.2": + url: + - "https://github.com/phmkopp/vtu11/archive/refs/tags/v1.2.tar.gz" + sha256: "c2b560d397c1a86c10e13f029b4ef08621f70ca4c897c44c19e7d025f11baec3" diff --git a/recipes/vtu11/all/conanfile.py b/recipes/vtu11/all/conanfile.py new file mode 100644 index 0000000000000..db420586fda77 --- /dev/null +++ b/recipes/vtu11/all/conanfile.py @@ -0,0 +1,75 @@ +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 + +from conan.tools.microsoft import is_msvc + +required_conan_version = ">=1.53.0" + + +class PackageConan(ConanFile): + name = "vtu11" + description = "Vtu11 is a small C++ header-only library to write unstructured grids using the vtu file format" + license = "BSD-3-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/phmkopp/vtu11" + topics = ("vtu", "c++11", "header-only") + + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + options = { + "with_zlib": [True, False], + } + default_options = { + "with_zlib": True, + } + + @property + def _min_cppstd(self): + return 11 + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + if self.options.with_zlib: + self.requires("zlib/[>=1.2.11 <2]") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.compiler.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", "vtu11"), + src=os.path.join(self.source_folder, "vtu11"), + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + if self.options.with_zlib: + self.cpp_info.defines = ["VTU11_ENABLE_ZLIB"] + + # The library uses __cplusplus for feature detection, ensure vs returns the proper one + if is_msvc(self): + self.cpp_info.cxxflags.append("/Zc:__cplusplus") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "vtu11" + self.cpp_info.filenames["cmake_find_package_multi"] = "vtu11" + self.cpp_info.names["cmake_find_package"] = "vtu11" + self.cpp_info.names["cmake_find_package_multi"] = "vtu11" diff --git a/recipes/vtu11/all/test_package/CMakeLists.txt b/recipes/vtu11/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..beca0132b2a57 --- /dev/null +++ b/recipes/vtu11/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package CXX) + +find_package(vtu11 REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE vtu11::vtu11) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/vtu11/all/test_package/conanfile.py b/recipes/vtu11/all/test_package/conanfile.py new file mode 100644 index 0000000000000..b04e2e18461e5 --- /dev/null +++ b/recipes/vtu11/all/test_package/conanfile.py @@ -0,0 +1,33 @@ +from conan import ConanFile +from conan.errors import ConanException +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake + +import os + +from pathlib import Path + + +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") + test_vtu = Path(self.build_folder, "test.vtu") + if not test_vtu.exists() or "VTKFile" not in test_vtu.read_text(encoding="utf-8"): + raise ConanException("Failed to generate a viable vtu file") diff --git a/recipes/vtu11/all/test_package/test_package.cpp b/recipes/vtu11/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..3fbb182b3ca59 --- /dev/null +++ b/recipes/vtu11/all/test_package/test_package.cpp @@ -0,0 +1,50 @@ +#include +#include +#include "vtu11/vtu11.hpp" + + +int main(void) { + // Create data for 3x2 quad mesh: (x, y, z) coordinates of mesh vertices + std::vector points + { + 0.0, 0.0, 0.5, 0.0, 0.3, 0.5, 0.0, 0.7, 0.5, 0.0, 1.0, 0.5, // 0, 1, 2, 3 + 0.5, 0.0, 0.5, 0.5, 0.3, 0.5, 0.5, 0.7, 0.5, 0.5, 1.0, 0.5, // 4, 5, 6, 7 + 1.0, 0.0, 0.5, 1.0, 0.3, 0.5, 1.0, 0.7, 0.5, 1.0, 1.0, 0.5 // 8, 9, 10, 11 + }; + + // Vertex indices of all cells + std::vector connectivity + { + 0, 4, 5, 1, // 0 + 1, 5, 6, 2, // 1 + 2, 6, 7, 3, // 2 + 4, 8, 9, 5, // 3 + 5, 9, 10, 6, // 4 + 6, 10, 11, 7 // 5 + }; + + // Separate cells in connectivity array + std::vector offsets { 4, 8, 12, 16, 20, 24 }; + + // Cell types of each cell, see [1] + std::vector types { 9, 9, 9, 9, 9, 9 }; + + // Create small proxy mesh type + vtu11::Vtu11UnstructuredMesh mesh { points, connectivity, offsets, types }; + + // Create some data associated to points and cells + std::vector pointData { 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0 }; + std::vector cellData { 3.2, 4.3, 5.4, 6.5, 7.6, 8.7 }; + + // Create tuples with (name, association, number of components) for each data set + std::vector dataSetInfo + { + vtu11::DataSetInfo{ "Temperature", vtu11::DataSetType::PointData, 1 }, + vtu11::DataSetInfo{ "Conductivity", vtu11::DataSetType::CellData, 1 }, + }; + + // Write data to .vtu file using Ascii format + vtu11::writeVtu( "test.vtu", mesh, dataSetInfo, { pointData, cellData }, "Ascii" ); + + return EXIT_SUCCESS; +} diff --git a/recipes/vtu11/all/test_v1_package/CMakeLists.txt b/recipes/vtu11/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/vtu11/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/vtu11/all/test_v1_package/conanfile.py b/recipes/vtu11/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..15d4a3b51a02d --- /dev/null +++ b/recipes/vtu11/all/test_v1_package/conanfile.py @@ -0,0 +1,25 @@ +from conans import ConanFile, CMake +from conan.errors import ConanException +from conan.tools.build import cross_building + +import os + +from pathlib import Path + + +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) + test_vtu = Path(self.build_folder, "test.vtu") + if not test_vtu.exists() or "VTKFile" not in test_vtu.read_text(): + raise ConanException("Failed to generate a viable vtu file") diff --git a/recipes/vtu11/config.yml b/recipes/vtu11/config.yml new file mode 100644 index 0000000000000..a0777b5aa931c --- /dev/null +++ b/recipes/vtu11/config.yml @@ -0,0 +1,3 @@ +versions: + "1.2": + folder: all diff --git a/recipes/vulkan-headers/all/conandata.yml b/recipes/vulkan-headers/all/conandata.yml index 6124eeccffa97..6aa8cd0d34424 100644 --- a/recipes/vulkan-headers/all/conandata.yml +++ b/recipes/vulkan-headers/all/conandata.yml @@ -1,148 +1,25 @@ sources: - "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" - "1.3.221": - url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/v1.3.221.tar.gz" - sha256: "75057d8231bb7a3f6ac091f1b08f50604f07a7e9b4424fd12c035f01787ebf0c" - "1.3.219": - url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/v1.3.219.tar.gz" - sha256: "3e5d1b727a5e3a5546e6b0709d520d3f522f0a83808277a313357140645be90c" - "1.3.216.0": - url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/sdk-1.3.216.0.tar.gz" - sha256: "2c98d1d819fde588fb0f71acebea177f805b3efa26e8260a707a94b1e633be6b" - "1.3.211.0": - url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/sdk-1.3.211.0.tar.gz" - sha256: "c464bcdc24b7541ac4378a270617a23d4d92699679a73f95dc4b9e1da924810a" - "1.3.211": - url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/v1.3.211.tar.gz" - sha256: "67ab69142f69389dfdf5f1c7922e62aa4a03ba286b9229dd7f7f3e827232463c" - "1.3.204.1": - url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/sdk-1.3.204.1.tar.gz" - sha256: "9c4d33f71467c915749fbf48c0c3a8ee7833f15babf398e3463cd88791fb592e" - "1.3.204.0": - url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/sdk-1.3.204.0.tar.gz" - sha256: "5c3fcfc5dc1daa5fa1f3a0983fdcb344848f846ae34d933412d13456ebee10c1" - "1.3.204": - url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/v1.3.204.tar.gz" - sha256: "2cde2c90975a8f36d00cf8eb6308cb00323aafbc0b7374f4b346f1140f760b3d" + "1.3.296.0": + url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/vulkan-sdk-1.3.296.0.tar.gz" + sha256: "1e872a0be3890784bbe68dcd89b7e017fed77ba95820841848718c98bda6dc33" + "1.3.290.0": + url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/vulkan-sdk-1.3.290.0.tar.gz" + sha256: "5b186e1492d97c44102fe858fb9f222b55524a8b6da940a8795c9e326ae6d722" + "1.3.268.0": + url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/vulkan-sdk-1.3.268.0.tar.gz" + sha256: "94993cbe2b1a604c0d5d9ea37a767e1aba4d771d2bfd4ddceefd66243095164f" + "1.3.261.1": + url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/sdk-1.3.261.1.tar.gz" + sha256: "7a25ebdb6325e626dc5d33bc937b289ccce7ddb7b0ac1a1b1d5d7ff33b6715d3" + "1.3.250.0": + url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/sdk-1.3.250.0.tar.gz" + sha256: "0da601a81b868bc543ec09ab7e514d1b059774993dfce81df7150f432c8bf33a" + "1.3.243.0": + url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/sdk-1.3.243.0.tar.gz" + sha256: "29ddb2ef931f5fb0cabd1a78398f9c4da44d37f8c8a1e110f834f4c260c9d548" + "1.3.239.0": + url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/sdk-1.3.239.0.tar.gz" + sha256: "865fa8e8e8314fcca60777a92f50bd0cf612205a36e719d6975482d3366f619e" "1.2.198.0": url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/sdk-1.2.198.0.tar.gz" sha256: "34782c61cad9b3ccf2fa0a31ec397d4fce99490500b4f3771cb1a48713fece80" - "1.2.198": - url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/v1.2.198.tar.gz" - sha256: "0b2c69bc392a0022652f65efe5c51ec39ae90ec427065a914ba74ac6c728db30" - "1.2.195": - url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/v1.2.195.tar.gz" - sha256: "8d6e561871bb4dbb7f83e80eac41b3a582dbd874382990c7e4972cb0258fa529" - "1.2.190": - url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/v1.2.190.tar.gz" - sha256: "ce997a3d6f43f9697c5ec232efb0f6e7826d0648412ed141f9495e88429075e0" - "1.2.189": - url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/v1.2.189.tar.gz" - sha256: "0939d6cb950746f6f9cab59399c0a99628ed186426a972996599f90d34d8a99a" - "1.2.184": - url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/v1.2.184.tar.gz" - sha256: "de1889ff550c1a78e752fbdf71117ac319fb674b0abe080a4e6e9053da2aea85" - "1.2.182": - url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/v1.2.182.tar.gz" - sha256: "38d1c953de7bb2d839556226851feeb690f0d23bc22ac46c823dcb66c97bfdc8" - "1.2.176.0": - url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/sdk-1.2.176.0.tar.gz" - sha256: "211d8552c5cf8b0607323d69c251d9c4639f89550f8de3d51d3995b5cdd737fb" - "1.2.176": - url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/v1.2.176.tar.gz" - sha256: "d77b033e74448341b42d1b6f2b380570e870b0443875f26c9e8a636f01ee6fe7" - "1.2.172": - url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/v1.2.172.tar.gz" - sha256: "c69619ac2001ac62378a99c56ced14a53801fdc204efb2b1f787c83b47829319" - "1.2.170.0": - url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/sdk-1.2.170.0.tar.gz" - sha256: "d8e6050230ca678bcb0e7dc68d5984290da6eb655e8da9d08b5eaab1e84a7da9" - "1.2.170": - url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/v1.2.170.tar.gz" - sha256: "6fa84897197bd72cf4b1a686c903df67fc0fe108e4ed02e6adb3d72c468f1c1f" - "1.2.162.0": - url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/sdk-1.2.162.0.tar.gz" - sha256: "eb0f6a79ac38e137f55a0e13641140e63b765c8ec717a65bf3904614ef754365" - "1.2.162": - url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/v1.2.162.tar.gz" - sha256: "deab1a7a28ad3e0a7a0a1c4cd9c54758dce115a5f231b7205432d2bbbfb4d456" - "1.2.154.0": - url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/sdk-1.2.154.0.tar.gz" - sha256: "a0528ade4dd3bd826b960ba4ccabc62e92ecedc3c70331b291e0a7671b3520f9" - "1.2.151": - url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/v1.2.151.tar.gz" - sha256: "9a3bb3077c9bb71347d6b9942fa5b728053b67dbd5c1eb9d75a774bccefa18d8" - "1.2.150": - url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/v1.2.150.tar.gz" - sha256: "dc6477b06ed04f4df72cb46915131c1a844980c6f4993954672893b69c2ffb57" - "1.2.149": - url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/v1.2.149.tar.gz" - sha256: "332e35104a911447915ccf03f2d61d7e061d3cf5a09419a032b3b09246dcca85" - "1.2.148.0": - url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/sdk-1.2.148.0.tar.gz" - sha256: "0803784b701c461ff5cce30bb8c598db5780032cf780c954d676e142bc3c373f" - "1.2.141.0": - url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/sdk-1.2.141.0.tar.gz" - sha256: "579d112433c89ac8a4a93741bfa6eee8dca4a1d8145363a28d6d9967babc2b07" - "1.2.140": - url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/v1.2.140.tar.gz" - sha256: "c708a05b0ef673ae783f8968c5396dc207b9f8c7cde2ddb4a9a281e04661185a" - "1.2.135.0": - url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/sdk-1.2.135.0.tar.gz" - sha256: "befc69991e1e268db75921c577be32a3f315d01d78b39b74ef87ba6908787b63" - "1.2.131.1": - url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/sdk-1.2.131.1.tar.gz" - sha256: "bd6873060c6988b62b938d7cb7e3152f006f44fbfaa9ce4b7f555b20ec77c53d" - "1.1.130.0": - url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/sdk-1.1.130.0.tar.gz" - sha256: "9afceeae5020b771246853ad5b098bd4bfeebc859759f26bbe0b87c9272c94d4" - "1.1.126.0": - url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/sdk-1.1.126.0.tar.gz" - sha256: "34a9a6d3e3bf0745e901f75a08f57d4ff388c7e1c59a8dad0dc8437c54236a13" - "1.1.121.0": - url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/sdk-1.1.121.0.tar.gz" - sha256: "4643e193a18ea06ff403da3672c86cc7792a77a4b6a1e70852090732792694ab" - "1.1.114.0": - url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/sdk-1.1.114.0.tar.gz" - sha256: "701cc5391c5c757b48f0b8bc6944586c3d479cff7e1803acac9f59c11e9cebf2" - "1.1.108.0": - url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/sdk-1.1.108.0.tar.gz" - sha256: "944e88911e47e5d34bc4360e3e5833a0d550e3e7483dfa27a5f4d38525a1b943" - "1.1.106.0": - url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/sdk-1.1.106.0.tar.gz" - sha256: "61eba1be3c4eed6bef9745ec8d8767869eacb6daff6d5b98951052910b73de8f" - "1.1.101.0": - url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/sdk-1.1.101.0.tar.gz" - sha256: "59e17335932574e736472b0677390f84150d6bd461e648b13e17d870c42c1c3b" - "1.1.97.0": - url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/sdk-1.1.97.0.tar.gz" - sha256: "a09c83df5647e53ef511a1f2563dec02fae8f13880808914175dc26b06159f16" - "1.1.92.0": - url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/sdk-1.1.92.0.tar.gz" - sha256: "89164ad4e2a4767357732fd92248b6ec36a5ab16d988b64f2aa75cdbc28f6f19" - "1.1.85.0": - url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/sdk-1.1.85.0.tar.gz" - sha256: "d3c6435d101bb9271019c9d0dd159e210a805958dda3bb13344fce9316c6d098" - "1.1.82.0": - url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/sdk-1.1.82.0.tar.gz" - sha256: "df73da07d547cfbe88a797802401ea8225e4844e13d4fde52a7cb6e00e5179e5" - "1.1.77.0": - url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/sdk-1.1.77.0.tar.gz" - sha256: "b2f532bfd1d8e7594f131a4aa79358bfe4fd0aa59d3292dbafd484223d56ef16" diff --git a/recipes/vulkan-headers/all/conanfile.py b/recipes/vulkan-headers/all/conanfile.py index 2926437171c3e..beae2e733b6b4 100644 --- a/recipes/vulkan-headers/all/conanfile.py +++ b/recipes/vulkan-headers/all/conanfile.py @@ -13,6 +13,8 @@ class VulkanHeadersConan(ConanFile): topics = ("vulkan-headers", "vulkan") homepage = "https://github.com/KhronosGroup/Vulkan-Headers" url = "https://github.com/conan-io/conan-center-index" + package_type = "header-library" + package_id_embed_mode = "patch_mode" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -23,14 +25,13 @@ 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 def package(self): - copy(self, "LICENSE.txt", 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")) copy(self, "*", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) copy(self, "*", src=os.path.join(self.source_folder, "registry"), dst=os.path.join(self.package_folder, "res", "vulkan", "registry")) diff --git a/recipes/vulkan-headers/all/test_v1_package/CMakeLists.txt b/recipes/vulkan-headers/all/test_v1_package/CMakeLists.txt index bc3d3088a8a02..0d20897301b68 100644 --- a/recipes/vulkan-headers/all/test_v1_package/CMakeLists.txt +++ b/recipes/vulkan-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(VulkanHeaders REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} Vulkan::Headers) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/vulkan-headers/config.yml b/recipes/vulkan-headers/config.yml index d0d206b7e299f..dca330da68efa 100644 --- a/recipes/vulkan-headers/config.yml +++ b/recipes/vulkan-headers/config.yml @@ -1,99 +1,17 @@ versions: - "1.3.236.0": + "1.3.296.0": folder: all - "1.3.231.1": + "1.3.290.0": folder: all - "1.3.231.0": + "1.3.268.0": folder: all - "1.3.231": + "1.3.261.1": folder: all - "1.3.224.1": + "1.3.250.0": folder: all - "1.3.224.0": + "1.3.243.0": folder: all - "1.3.221": - folder: all - "1.3.219": - folder: all - "1.3.216.0": - folder: all - "1.3.211.0": - folder: all - "1.3.211": - folder: all - "1.3.204.1": - folder: all - "1.3.204.0": - folder: all - "1.3.204": + "1.3.239.0": folder: all "1.2.198.0": folder: all - "1.2.198": - folder: all - "1.2.195": - folder: all - "1.2.190": - folder: all - "1.2.189": - folder: all - "1.2.184": - folder: all - "1.2.182": - folder: all - "1.2.176.0": - folder: all - "1.2.176": - folder: all - "1.2.172": - folder: all - "1.2.170.0": - folder: all - "1.2.170": - folder: all - "1.2.162.0": - folder: all - "1.2.162": - folder: all - "1.2.154.0": - folder: all - "1.2.151": - folder: all - "1.2.150": - folder: all - "1.2.149": - folder: all - "1.2.148.0": - folder: all - "1.2.141.0": - folder: all - "1.2.140": - folder: all - "1.2.135.0": - folder: all - "1.2.131.1": - folder: all - "1.1.130.0": - folder: all - "1.1.126.0": - folder: all - "1.1.121.0": - folder: all - "1.1.114.0": - folder: all - "1.1.108.0": - folder: all - "1.1.106.0": - folder: all - "1.1.101.0": - folder: all - "1.1.97.0": - folder: all - "1.1.92.0": - folder: all - "1.1.85.0": - folder: all - "1.1.82.0": - folder: all - "1.1.77.0": - folder: all diff --git a/recipes/vulkan-loader/all/conandata.yml b/recipes/vulkan-loader/all/conandata.yml index 27d770d5b2068..ad7d56b8cab7b 100644 --- a/recipes/vulkan-loader/all/conandata.yml +++ b/recipes/vulkan-loader/all/conandata.yml @@ -1,73 +1,25 @@ sources: - "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" - "1.3.221": - url: "https://github.com/KhronosGroup/Vulkan-Loader/archive/v1.3.221.tar.gz" - sha256: "ba7042b2b14a11646ba8bd33c041ccb4f1abe5bdfa2758e301a76bf6d31d2748" - "1.3.216.0": - url: "https://github.com/KhronosGroup/Vulkan-Loader/archive/refs/tags/sdk-1.3.216.0.tar.gz" - sha256: "46188d3db019409b82f850628d5c175cc59dcdb3ce146f5c023b97709f67e8f1" - "1.3.211.0": - url: "https://github.com/KhronosGroup/Vulkan-Loader/archive/refs/tags/sdk-1.3.211.0.tar.gz" - sha256: "bb42a8e0dda103f98bddb9ae2311ae8e8e988588b600a1114b74a1ba3a0843f4" - "1.3.204.1": - url: "https://github.com/KhronosGroup/Vulkan-Loader/archive/refs/tags/sdk-1.3.204.1.tar.gz" - sha256: "5dcd42b564804f4c01891ddd429a4a5028113c4cf39b44256689e8f543773134" - "1.3.204.0": - url: "https://github.com/KhronosGroup/Vulkan-Loader/archive/refs/tags/sdk-1.3.204.0.tar.gz" - sha256: "7e9700f454007ea6f1e6eb097a905e7c30ad2be740ddd9e76235658c98db2ddd" + "1.3.290.0": + url: "https://github.com/KhronosGroup/Vulkan-Loader/archive/refs/tags/v1.3.290.tar.gz" + sha256: "a1f0d80c4ee448d4fa37d1d4a4c4cf1d6d0f5873d3ca6dffe2a9498e6e654142" + "1.3.268.0": + url: "https://github.com/KhronosGroup/Vulkan-Loader/archive/refs/tags/vulkan-sdk-1.3.268.0.tar.gz" + sha256: "404fa621f1ab2731bcc68bcbff64d8c6de322faad2d87f9198641bd37255fd39" + "1.3.250.0": + url: "https://github.com/KhronosGroup/Vulkan-Loader/archive/refs/tags/sdk-1.3.250.0.tar.gz" + sha256: "17f8683fd8320d5dfebdb22879f26f82c014d320a6a0622118cd298887626295" + "1.3.243.0": + url: "https://github.com/KhronosGroup/Vulkan-Loader/archive/refs/tags/sdk-1.3.243.0.tar.gz" + sha256: "89a09547be30491ee0a11cd7c883e78a637fb761280d6c6c2174f37188527dc3" + "1.3.239.0": + url: "https://github.com/KhronosGroup/Vulkan-Loader/archive/refs/tags/sdk-1.3.239.0.tar.gz" + sha256: "fa2078408793b2173f174173a8784de56b6bbfbcb5fb958a07e46ef126c7eada" "1.2.198.0": url: "https://github.com/KhronosGroup/Vulkan-Loader/archive/refs/tags/sdk-1.2.198.0.tar.gz" sha256: "7d5d56296dcd88af84ed0fde969038370cac8600c4ef7e328788b7422d9025bb" - "1.2.190": - url: "https://github.com/KhronosGroup/Vulkan-Loader/archive/v1.2.190.tar.gz" - sha256: "f940bb72d123173187c5c341edb7af55fddc68efa79460f9b703a80e9f4bca44" - "1.2.189": - url: "https://github.com/KhronosGroup/Vulkan-Loader/archive/refs/tags/v1.2.189.tar.gz" - sha256: "6e05f54a0c6a35625e8974f88c197b1817b2bddb253c38540ced9d2bc8132d6c" - "1.2.182": - url: "https://github.com/KhronosGroup/Vulkan-Loader/archive/v1.2.182.tar.gz" - sha256: "0d1f9fde9d21642526e9baa55d30364c95035c4fe3c6db96836631991b44dd90" - "1.2.172": - url: "https://github.com/KhronosGroup/Vulkan-Loader/archive/v1.2.172.tar.gz" - sha256: "713dcb73c73194d17251fcd9cff62e5831d4ec30dac2efcf6440595016368ddb" - "1.2.170.0": - url: "https://github.com/KhronosGroup/Vulkan-Loader/archive/sdk-1.2.170.0.tar.gz" - sha256: "08c125987d4f6b086fcf952be7dce630b677fc943b336030178737bb1eb2ed49" - "1.2.162.0": - url: "https://github.com/KhronosGroup/Vulkan-Loader/archive/sdk-1.2.162.0.tar.gz" - sha256: "f8f5ec2485e7fdba3f58c1cde5a25145ece1c6a686c91ba4016b28c0af3f21dd" - "1.2.154.0": - url: "https://github.com/KhronosGroup/Vulkan-Loader/archive/sdk-1.2.154.0.tar.gz" - sha256: "418017d7bab907e72291476df231dd0e7dc7fe20b97e55389c975bcfc48d6433" patches: - "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" + "1.3.268.0": + - patch_file: "patches/1.3.268.0-0001-fix-apple-arm.patch" + patch_description: "Apple: fix M1 build, as well as iOS & tvOS" patch_type: "portability" - patch_source: "https://github.com/KhronosGroup/Vulkan-Loader/pull/1020" - sha256: "f08b35f57884624fea618405affff17215cd747740bbce11af53a69911b48452" - "1.2.182": - - patch_file: "patches/1.2.182-0001-fix-mingw.patch" - patch_description: "Fix MinGW" - patch_type: "portability" - sha256: "a05375c60b7f4a91f48df2278518be27e578e38190034bfcc887e5ceaa289c25" - "1.2.154.0": - - 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" - sha256: "034e4252276fde22f14630d36404338dc3fa08ebf8fe7d5affe9065e0239f165" + patch_source: "https://github.com/KhronosGroup/Vulkan-Loader/pull/1349" diff --git a/recipes/vulkan-loader/all/conanfile.py b/recipes/vulkan-loader/all/conanfile.py index e4bbfef3199d9..27aeb7d2928a6 100644 --- a/recipes/vulkan-loader/all/conanfile.py +++ b/recipes/vulkan-loader/all/conanfile.py @@ -1,14 +1,14 @@ 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.env import Environment, VirtualBuildEnv +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.microsoft import check_min_vs from conan.tools.scm import Version import os -required_conan_version = ">=1.53.0" +required_conan_version = ">=1.55.0" class VulkanLoaderConan(ConanFile): @@ -18,19 +18,15 @@ class VulkanLoaderConan(ConanFile): homepage = "https://github.com/KhronosGroup/Vulkan-Loader" url = "https://github.com/conan-io/conan-center-index" license = "Apache-2.0" - + package_type = "shared-library" settings = "os", "arch", "compiler", "build_type" options = { - "shared": [True, False], - "fPIC": [True, False], "with_wsi_xcb": [True, False], "with_wsi_xlib": [True, False], "with_wsi_wayland": [True, False], "with_wsi_directfb": [True, False], } default_options = { - "shared": True, - "fPIC": True, "with_wsi_xcb": True, "with_wsi_xlib": True, "with_wsi_wayland": True, @@ -50,8 +46,6 @@ 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.with_wsi_xcb del self.options.with_wsi_xlib @@ -59,8 +53,6 @@ def config_options(self): del self.options.with_wsi_directfb def configure(self): - if self.options.shared: - self.options.rm_safe("fPIC") self.settings.rm_safe("compiler.cppstd") self.settings.rm_safe("compiler.libcxx") @@ -68,48 +60,33 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires(f"vulkan-headers/{self.version}") + self.requires(f"vulkan-headers/{self.version}", transitive_headers=True) if self.options.get_safe("with_wsi_xcb") or self.options.get_safe("with_wsi_xlib"): self.requires("xorg/system") if Version(self.version) < "1.3.231" and self.options.get_safe("with_wsi_wayland"): - self.requires("wayland/1.21.0") + self.requires("wayland/1.22.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.options.shared: - raise ConanInvalidConfiguration(f"Static builds are not supported on {self.settings.os}") - 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") + # FIXME: It should build but Visual Studio 2015 container in CI of CCI seems to lack some Win SDK headers + check_min_vs(self, "191") # TODO: to replace by some version range check if self.dependencies["vulkan-headers"].ref.version != self.version: - self.output.warn("vulkan-loader should be built & consumed with the same version than vulkan-headers.") - - 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 + self.output.warning("vulkan-loader should be built & consumed with the same version than vulkan-headers.") def build_requirements(self): if self._is_pkgconf_needed: - self.tool_requires("pkgconf/1.9.3") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/2.1.0") if self._is_mingw: self.tool_requires("jwasm/2.13") - # see https://github.com/KhronosGroup/Vulkan-Loader/issues/1095#issuecomment-1352420456 - if Version(self.version) >= "1.3.232" and not self._cmake_new_enough("3.16"): - self.tool_requires("cmake/3.25.0") + if Version(self.version) >= "1.3.234": + self.tool_requires("cmake/[>=3.17.2 <4.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): if self._is_pkgconf_needed or self._is_mingw: @@ -127,8 +104,6 @@ def generate(self): tc.variables["BUILD_WSI_DIRECTFB_SUPPORT"] = self.options.with_wsi_directfb if self.settings.os == "Windows": tc.variables["ENABLE_WIN10_ONECORE"] = False - if is_apple_os(self): - tc.variables["BUILD_STATIC_LOADER"] = not self.options.shared tc.variables["BUILD_LOADER"] = True if self.settings.os == "Windows": tc.variables["USE_MASM"] = True @@ -140,10 +115,6 @@ def generate(self): if self._is_pkgconf_needed: pkg = PkgConfigDeps(self) pkg.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): apply_conandata_patches(self) @@ -152,23 +123,42 @@ def _patch_sources(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") - # Honor settings.compiler.runtime - replace_in_file(self, os.path.join(self.source_folder, "loader", "CMakeLists.txt"), - "if(${configuration} MATCHES \"/MD\")", - "if(FALSE)") cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") + + # Honor settings.compiler.runtime + if Version(self.version) < "1.3.254": + replace_in_file(self, os.path.join(self.source_folder, "loader", "CMakeLists.txt"), + "if(${configuration} MATCHES \"/MD\")", + "if(FALSE)") + else: + if Version(self.version) < "1.3.275": + replace_in_file( + self, + cmakelists, + "set(TESTS_STANDARD_CXX_PROPERTIES ${LOADER_STANDARD_CXX_PROPERTIES} MSVC_RUNTIME_LIBRARY \"MultiThreaded$<$:Debug>DLL\")", + "set(TESTS_STANDARD_CXX_PROPERTIES ${LOADER_STANDARD_CXX_PROPERTIES})", + ) + replace_in_file( + self, + cmakelists, + "set(CMAKE_MSVC_RUNTIME_LIBRARY \"MultiThreaded$<$:Debug>\")", + "", + ) + # No warnings as errors 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)") + if Version(self.version) < "1.3.234": + 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)") # 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)") + if Version(self.version) < "1.3.234": + replace_in_file(self, cmakelists, "find_package(DirectFB REQUIRED)", "find_package(DirectFB REQUIRED MODULE)") def build(self): self._patch_sources() @@ -180,33 +170,24 @@ def package(self): cmake = CMake(self) cmake.install() copy(self, "LICENSE.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")) rmdir(self, os.path.join(self.package_folder, "loader")) def package_info(self): self.cpp_info.set_property("cmake_find_mode", "both") - self.cpp_info.set_property("cmake_file_name", "Vulkan") - self.cpp_info.set_property("cmake_target_name", "Vulkan::Vulkan") + self.cpp_info.set_property("cmake_module_file_name", "Vulkan") + self.cpp_info.set_property("cmake_file_name", "VulkanLoader") + self.cpp_info.set_property("cmake_module_target_name", "Vulkan::Vulkan") + self.cpp_info.set_property("cmake_target_name", "Vulkan::Loader") self.cpp_info.set_property("pkg_config_name", "vulkan") suffix = "-1" if self.settings.os == "Windows" else "" self.cpp_info.libs = [f"vulkan{suffix}"] - # allow to properly set Vulkan_INCLUDE_DIRS in CMake like generators - vulkan_headers = self.dependencies["vulkan-headers"] - self.cpp_info.includedirs = [ - os.path.join(vulkan_headers.package_folder, includedir) for includedir in vulkan_headers.cpp_info.includedirs - ] + # allow to properly set Vulkan_INCLUDE_DIRS in FindVulkan.cmake + self.cpp_info.includedirs = self.dependencies["vulkan-headers"].cpp_info.aggregated_components().includedirs if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["dl", "pthread", "m"] elif self.settings.os == "Macos": self.cpp_info.frameworks = ["CoreFoundation"] - - vulkan_sdk_path = self.package_folder - self.output.info(f"Create VULKAN_SDK environment variable: {vulkan_sdk_path}") - self.env_info.VULKAN_SDK = vulkan_sdk_path - - # TODO: to remove in conan v2 once cmake_find_package* generators removed - self.cpp_info.names["cmake_find_package"] = "Vulkan" - self.cpp_info.names["cmake_find_package_multi"] = "Vulkan" - self.cpp_info.names["pkg_config"] = "vulkan" 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 deleted file mode 100644 index a585b5a17fff5..0000000000000 --- a/recipes/vulkan-loader/all/patches/1.2.154.0-0001-fix-mingw.patch +++ /dev/null @@ -1,77 +0,0 @@ ---- 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/1.2.182-0001-fix-mingw.patch b/recipes/vulkan-loader/all/patches/1.2.182-0001-fix-mingw.patch deleted file mode 100644 index b0cda85f0d738..0000000000000 --- a/recipes/vulkan-loader/all/patches/1.2.182-0001-fix-mingw.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- a/loader/CMakeLists.txt -+++ b/loader/CMakeLists.txt -@@ -229,7 +229,6 @@ if(WIN32) - $ - ${CMAKE_CURRENT_SOURCE_DIR}/vulkan-1.def - ${CMAKE_CURRENT_SOURCE_DIR}/loader.rc) -- if(MSVC) - set_target_properties(vulkan - PROPERTIES - #LINK_FLAGS_DEBUG "/ignore:4098" -@@ -237,13 +236,6 @@ if(WIN32) - vulkan-1 - PREFIX - "") -- else() -- set_target_properties(vulkan -- PROPERTIES -- LIBRARY_OUTPUT_NAME vulkan -- RUNTIME_OUTPUT_NAME vulkan-1 -- ARCHIVE_OUTPUT_NAME vulkan) -- endif() - target_link_libraries(vulkan Vulkan::Headers) - - if(MSVC AND ENABLE_WIN10_ONECORE) 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 deleted file mode 100644 index 0f841d44ccf38..0000000000000 --- a/recipes/vulkan-loader/all/patches/1.3.231.1-0001-no-find-package-wayland.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- 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.268.0-0001-fix-apple-arm.patch b/recipes/vulkan-loader/all/patches/1.3.268.0-0001-fix-apple-arm.patch new file mode 100644 index 0000000000000..28d9fbd552cb1 --- /dev/null +++ b/recipes/vulkan-loader/all/patches/1.3.268.0-0001-fix-apple-arm.patch @@ -0,0 +1,147 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 273c09f31..b06b7e73a 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -99,7 +99,13 @@ if(WIN32) + elseif(ANDROID) + message(FATAL_ERROR "Android build not supported!") + elseif(APPLE) +- target_compile_definitions(platform_wsi INTERFACE VK_USE_PLATFORM_MACOS_MVK VK_USE_PLATFORM_METAL_EXT) ++ target_compile_definitions(platform_wsi INTERFACE VK_USE_PLATFORM_METAL_EXT) ++ if (IOS) ++ target_compile_definitions(platform_wsi INTERFACE VK_USE_PLATFORM_IOS_MVK) ++ endif() ++ if (CMAKE_SYSTEM_NAME STREQUAL "Darwin") ++ target_compile_definitions(platform_wsi INTERFACE VK_USE_PLATFORM_MACOS_MVK) ++ endif() + elseif(UNIX AND NOT APPLE) # i.e.: Linux + option(BUILD_WSI_XCB_SUPPORT "Build XCB WSI support" ON) + option(BUILD_WSI_XLIB_SUPPORT "Build Xlib WSI support" ON) +@@ -149,12 +155,6 @@ set(LOADER_STANDARD_CXX_PROPERTIES CXX_STANDARD 17 CXX_STANDARD_REQUIRED YES CXX + + set(TESTS_STANDARD_CXX_PROPERTIES ${LOADER_STANDARD_CXX_PROPERTIES} MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>DLL") + +-# Build for iOS and tvOS +-option(APPLE_EMBEDDED "Apple non desktop devices" OFF) +-if (APPLE_EMBEDDED) +- add_definitions(-D__APPLE_EMBEDDED__) +-endif() +- + # Force the use of the multithreaded, static version of the C runtime. + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + +diff --git a/loader/CMakeLists.txt b/loader/CMakeLists.txt +index c6366eef5..c1e8c3477 100644 +--- a/loader/CMakeLists.txt ++++ b/loader/CMakeLists.txt +@@ -201,6 +201,21 @@ end + message(WARNING "Could not find working MASM assembler\n${ASM_FAILURE_MSG}") + endif() + elseif(UNIX) # i.e.: Linux & Apple ++ ++ # This is hacky but works for now to get iOS/tvOS working. ++ # The problem is CMAKE_SYSTEM_PROCESSOR is empty when compiling for these platforms. ++ # This is likely due to the fact that CMAKE_OSX_ARCHITECTURES lets you compile for ++ # multiple archs at the same time. ++ # ++ # EX: ++ # -D CMAKE_OSX_ARCHITECTURES="x86_64;arm64" ++ if (APPLE AND CMAKE_CROSSCOMPILING) ++ set(CMAKE_SYSTEM_PROCESSOR "${CMAKE_OSX_ARCHITECTURES}") ++ endif() ++ if ("${CMAKE_OSX_ARCHITECTURES}" MATCHES ";") ++ message(FATAL_ERROR "Cannot handle multiple archs ( ${CMAKE_OSX_ARCHITECTURES} ) at the same time!") ++ endif() ++ + option(USE_GAS "Use GAS" ON) + if(USE_GAS) + enable_language(ASM) +@@ -208,12 +223,12 @@ elseif(UNIX) # i.e.: Linux & Apple + set(CMAKE_ASM_FLAGS "${CMAKE_C_FLAGS}") + set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) + +- if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm64") ++ if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64|arm64") + try_compile(ASSEMBLER_WORKS ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/asm_test_aarch64.S) + if(ASSEMBLER_WORKS) + set(OPT_LOADER_SRCS ${OPT_LOADER_SRCS} unknown_ext_chain_gas_aarch64.S) + endif() +- elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "amd64" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86" OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES "^i.86$") ++ elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64|amd64|x86|^i.86$") + check_include_file("cet.h" HAVE_CET_H) + if(HAVE_CET_H) + target_compile_definitions(loader_specific_options INTERFACE HAVE_CET_H) +diff --git a/loader/vk_loader_platform.h b/loader/vk_loader_platform.h +index 3a8cafb7e..08e2d301b 100644 +--- a/loader/vk_loader_platform.h ++++ b/loader/vk_loader_platform.h +@@ -275,13 +275,16 @@ static inline char *loader_platform_executable_path(char *buffer, size_t size) { + return buffer; + } + #elif defined(__APPLE__) +-#if defined(__APPLE_EMBEDDED__) ++#include ++// TARGET_OS_IPHONE isn't just iOS it's also iOS/tvOS/watchOS. See TargetConditionals.h documentation. ++#if TARGET_OS_IPHONE + static inline char *loader_platform_executable_path(char *buffer, size_t size) { + (void)size; + buffer[0] = '\0'; + return buffer; + } +-#else ++#endif ++#if TARGET_OS_OSX + #include + static inline char *loader_platform_executable_path(char *buffer, size_t size) { + pid_t pid = getpid(); +diff --git a/loader/wsi.c b/loader/wsi.c +index 8c86733c5..bd9604a02 100644 +--- a/loader/wsi.c ++++ b/loader/wsi.c +@@ -1308,6 +1308,33 @@ out: + return vkRes; + } + ++// Ensure we are properly setting VK_USE_PLATFORM_METAL_EXT, VK_USE_PLATFORM_IOS_MVK, and VK_USE_PLATFORM_MACOS_MVK. ++#if __APPLE__ ++ ++#ifndef VK_USE_PLATFORM_METAL_EXT ++#error "VK_USE_PLATFORM_METAL_EXT not defined!" ++#endif ++ ++#include ++ ++#if TARGET_OS_IOS ++ ++#ifndef VK_USE_PLATFORM_IOS_MVK ++#error "VK_USE_PLATFORM_IOS_MVK not defined!" ++#endif ++ ++#endif // TARGET_OS_IOS ++ ++#if TARGET_OS_OSX ++ ++#ifndef VK_USE_PLATFORM_MACOS_MVK ++#error "VK_USE_PLATFORM_MACOS_MVK not defined!" ++#endif ++ ++#endif // TARGET_OS_OSX ++ ++#endif // __APPLE__ ++ + #if defined(VK_USE_PLATFORM_MACOS_MVK) + + // Functions for the VK_MVK_macos_surface extension: +diff --git a/scripts/parse_asm_values.py b/scripts/parse_asm_values.py +index e6ae90f5f..87d669326 100644 +--- a/scripts/parse_asm_values.py ++++ b/scripts/parse_asm_values.py +@@ -72,7 +72,7 @@ with open(destination_file, "w", encoding="utf-8") as dest: + # let the assembler know which platform to use + if arch == "x86_64": + dest.write(".set X86_64, 1\n") +- elif arch == "aarch64": ++ elif arch == "aarch64" or arch == "arm64": + dest.write(".set AARCH_64, 1\n") + # Nothing to write in the x86 case + diff --git a/recipes/vulkan-loader/all/test_package/CMakeLists.txt b/recipes/vulkan-loader/all/test_package/CMakeLists.txt index 5a43176c74c66..b086288213558 100644 --- a/recipes/vulkan-loader/all/test_package/CMakeLists.txt +++ b/recipes/vulkan-loader/all/test_package/CMakeLists.txt @@ -1,8 +1,8 @@ cmake_minimum_required(VERSION 3.8) project(test_package LANGUAGES CXX) -find_package(Vulkan REQUIRED) +find_package(VulkanLoader REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE Vulkan::Vulkan) +target_link_libraries(${PROJECT_NAME} PRIVATE Vulkan::Loader) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/vulkan-loader/config.yml b/recipes/vulkan-loader/config.yml index 14679d8e7f0e5..0254c0a572bb2 100644 --- a/recipes/vulkan-loader/config.yml +++ b/recipes/vulkan-loader/config.yml @@ -1,35 +1,13 @@ versions: - "1.3.236.0": + "1.3.290.0": folder: all - "1.3.231.1": + "1.3.268.0": folder: all - "1.3.231": + "1.3.250.0": folder: all - "1.3.224.0": + "1.3.243.0": folder: all - "1.3.221": - folder: all - "1.3.216.0": - folder: all - "1.3.211.0": - folder: all - "1.3.204.1": - folder: all - "1.3.204.0": + "1.3.239.0": folder: all "1.2.198.0": folder: all - "1.2.190": - folder: all - "1.2.189": - folder: all - "1.2.182": - folder: all - "1.2.172": - folder: all - "1.2.170.0": - folder: all - "1.2.162.0": - folder: all - "1.2.154.0": - folder: all diff --git a/recipes/vulkan-memory-allocator/all/conandata.yml b/recipes/vulkan-memory-allocator/all/conandata.yml index d35351a8d12e7..7d88177b91710 100644 --- a/recipes/vulkan-memory-allocator/all/conandata.yml +++ b/recipes/vulkan-memory-allocator/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "cci.20231120": + url: "https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator/archive/5e43c795daf43dd09398d8307212e85025215052.tar.gz" + sha256: "1ee9922fb059bc3b1dc5bbf71020e7a590b6ceb27fc3025d746e15be53fe31b7" "3.0.1": url: "https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator/archive/refs/tags/v3.0.1.tar.gz" sha256: "2a84762b2d10bf540b9dc1802a198aca8ad1f3d795a4ae144212c595696a360c" @@ -9,5 +12,22 @@ sources: url: "https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator/archive/v2.3.0.zip" sha256: "1c222c372e90f1a0d5e765420974842cf2503683ca14c30f8a0df340ba541f02" patches: + "3.0.1": + - patch_file: "patches/3.0.1-add-missing-cstdio.patch" + patch_source: https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator/commit/29d492b60c84ca784ea0943efc7d2e6e0f3bdaac + patch_type: backport + patch_description: Needed to build with GCC 13+ "3.0.0": - patch_file: "patches/0001-fix-appleclang.patch" + patch_source: https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator/commit/3f9f66740aa6cd8a329cc738c21aaff9020fed46 + patch_type: backport + patch_description: Needed to build with apple-clang 13.1+ + - patch_file: "patches/3.0.0-add-missing-cstdio.patch" + patch_source: https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator/commit/29d492b60c84ca784ea0943efc7d2e6e0f3bdaac + patch_type: backport + patch_description: Needed to build with GCC 13+ + "2.3.0": + - patch_file: "patches/2.3.0-add-missing-cstdio.patch" + patch_source: https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator/commit/29d492b60c84ca784ea0943efc7d2e6e0f3bdaac + patch_type: backport + patch_description: Needed to build with GCC 13+ diff --git a/recipes/vulkan-memory-allocator/all/conanfile.py b/recipes/vulkan-memory-allocator/all/conanfile.py index 5920e7735e904..88b01c7c9bcc1 100644 --- a/recipes/vulkan-memory-allocator/all/conanfile.py +++ b/recipes/vulkan-memory-allocator/all/conanfile.py @@ -15,6 +15,7 @@ class VulkanMemoryAllocatorConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" description = "Easy to integrate Vulkan memory allocation library." topics = ("vulkan", "memory-allocator", "graphics") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" @property @@ -28,7 +29,7 @@ def layout(self): basic_layout(self, src_folder="src") def requirements(self): - self.requires("vulkan-headers/1.3.236.0") + self.requires("vulkan-headers/1.3.243.0") def package_id(self): self.info.clear() diff --git a/recipes/vulkan-memory-allocator/all/patches/0001-fix-appleclang.patch b/recipes/vulkan-memory-allocator/all/patches/0001-fix-appleclang.patch index 85be3b03af743..0cfd3c5acf8f4 100644 --- a/recipes/vulkan-memory-allocator/all/patches/0001-fix-appleclang.patch +++ b/recipes/vulkan-memory-allocator/all/patches/0001-fix-appleclang.patch @@ -1,5 +1,3 @@ -from https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator/commit/3f9f66740aa6cd8a329cc738c21aaff9020fed46 - --- a/include/vk_mem_alloc.h +++ b/include/vk_mem_alloc.h @@ -2569,6 +2569,7 @@ VMA_CALL_PRE void VMA_CALL_POST vmaFreeStatsString( diff --git a/recipes/vulkan-memory-allocator/all/patches/2.3.0-add-missing-cstdio.patch b/recipes/vulkan-memory-allocator/all/patches/2.3.0-add-missing-cstdio.patch new file mode 100644 index 0000000000000..ef7fe08191476 --- /dev/null +++ b/recipes/vulkan-memory-allocator/all/patches/2.3.0-add-missing-cstdio.patch @@ -0,0 +1,15 @@ +diff --git a/src/vk_mem_alloc.h b/src/vk_mem_alloc.h +index 32258b4..8da6bba 100644 +--- a/src/vk_mem_alloc.h ++++ b/src/vk_mem_alloc.h +@@ -3470,6 +3470,10 @@ VMA_CALL_PRE void VMA_CALL_POST vmaDestroyImage( + #include + #include + ++#if VMA_STATS_STRING_ENABLED ++ #include // For snprintf ++#endif ++ + /******************************************************************************* + CONFIGURATION SECTION + diff --git a/recipes/vulkan-memory-allocator/all/patches/3.0.0-add-missing-cstdio.patch b/recipes/vulkan-memory-allocator/all/patches/3.0.0-add-missing-cstdio.patch new file mode 100644 index 0000000000000..2852a9bd33619 --- /dev/null +++ b/recipes/vulkan-memory-allocator/all/patches/3.0.0-add-missing-cstdio.patch @@ -0,0 +1,15 @@ +diff --git a/include/vk_mem_alloc.h b/include/vk_mem_alloc.h +index 3b395a7..542191c 100644 +--- a/include/vk_mem_alloc.h ++++ b/include/vk_mem_alloc.h +@@ -2575,6 +2575,10 @@ VMA_CALL_PRE void VMA_CALL_POST vmaFreeStatsString( + #include // For functions like __popcnt, _BitScanForward etc. + #endif + ++#if VMA_STATS_STRING_ENABLED ++ #include // For snprintf ++#endif ++ + /******************************************************************************* + CONFIGURATION SECTION + diff --git a/recipes/vulkan-memory-allocator/all/patches/3.0.1-add-missing-cstdio.patch b/recipes/vulkan-memory-allocator/all/patches/3.0.1-add-missing-cstdio.patch new file mode 100644 index 0000000000000..bab772d3242d7 --- /dev/null +++ b/recipes/vulkan-memory-allocator/all/patches/3.0.1-add-missing-cstdio.patch @@ -0,0 +1,15 @@ +diff --git a/include/vk_mem_alloc.h b/include/vk_mem_alloc.h +index 60f5720..31164bc 100644 +--- a/include/vk_mem_alloc.h ++++ b/include/vk_mem_alloc.h +@@ -2578,6 +2578,10 @@ VMA_CALL_PRE void VMA_CALL_POST vmaFreeStatsString( + #include // For std::popcount + #endif + ++#if VMA_STATS_STRING_ENABLED ++ #include // For snprintf ++#endif ++ + /******************************************************************************* + CONFIGURATION SECTION + diff --git a/recipes/vulkan-memory-allocator/config.yml b/recipes/vulkan-memory-allocator/config.yml index 6220702ac9b05..d260c9a9e2cad 100644 --- a/recipes/vulkan-memory-allocator/config.yml +++ b/recipes/vulkan-memory-allocator/config.yml @@ -1,4 +1,6 @@ versions: + "cci.20231120": + folder: all "3.0.1": folder: all "3.0.0": diff --git a/recipes/vulkan-validationlayers/all/CMakeLists.txt b/recipes/vulkan-validationlayers/all/CMakeLists.txt deleted file mode 100644 index 3206840c13b9f..0000000000000 --- a/recipes/vulkan-validationlayers/all/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -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(src) diff --git a/recipes/vulkan-validationlayers/all/conandata.yml b/recipes/vulkan-validationlayers/all/conandata.yml index 9df896ac76970..71fbe37f78e18 100644 --- a/recipes/vulkan-validationlayers/all/conandata.yml +++ b/recipes/vulkan-validationlayers/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "1.3.239.0": + url: "https://github.com/KhronosGroup/Vulkan-ValidationLayers/archive/refs/tags/sdk-1.3.239.0.tar.gz" + sha256: "7aa7fb46e25e5ef0144d29c92122b631dc7c7c6804a6339f195b368ad53328e4" + "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" @@ -11,35 +17,31 @@ sources: "1.3.211.0": url: "https://github.com/KhronosGroup/Vulkan-ValidationLayers/archive/refs/tags/sdk-1.3.211.0.tar.gz" sha256: "927c1cb98c81fe8a1a529cf2d977d701dcda49c495a19583dc00e178b6757203" - "1.3.204.1": - url: "https://github.com/KhronosGroup/Vulkan-ValidationLayers/archive/refs/tags/sdk-1.3.204.1.tar.gz" - sha256: "a5e658a4c1f504ae38488acdbe2ab2799e2ae4b626104d76776f1c24b079f341" - "1.2.198.0": - url: "https://github.com/KhronosGroup/Vulkan-ValidationLayers/archive/refs/tags/sdk-1.2.198.0.tar.gz" - sha256: "4a70cc5da26baf873fcf69b081eeeda545515dd66e5904f18fee32b4d275593a" - "1.2.189.2": - url: "https://github.com/KhronosGroup/Vulkan-ValidationLayers/archive/refs/tags/sdk-1.2.189.2.tar.gz" - sha256: "f59eb2c7d601c155a528b62637277b9ef4beb5132cbf868eb3779c7d4415bb1c" - "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.239.0": + - patch_file: "patches/1.3.239.0-0001-fix-cmake.patch" + patch_description: "CMake: Adapt to conan" + patch_type: "conan" + "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-cmake-no-werror.patch" + - 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" - sha256: "14678800b649c54dee25ee06d8c379f7abca2ae8a580a7fa64d4eb06b5080ecd" - "1.2.198.0": - - patch_file: "patches/0005-fix-cmake-1.2.198.0.patch" - "1.2.189.2": - - patch_file: "patches/0005-fix-cmake-1.2.189.2.patch" - "1.2.182": - - patch_file: "patches/0005-fix-cmake-1.2.182.patch" - "1.2.154.0": - - patch_file: "patches/0001-duplicated-declaration.patch" - - patch_file: "patches/0002-fix-mingw.patch" - - patch_file: "patches/0003-disable-nortti-and-warnings-as-errors.patch" - - patch_file: "patches/0004-fix-installation.patch" + "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" diff --git a/recipes/vulkan-validationlayers/all/conanfile.py b/recipes/vulkan-validationlayers/all/conanfile.py index cf06f5e8ad135..9806017bf17ae 100644 --- a/recipes/vulkan-validationlayers/all/conanfile.py +++ b/recipes/vulkan-validationlayers/all/conanfile.py @@ -1,8 +1,9 @@ -from conan import ConanFile +from conan import ConanFile, conan_version from conan.errors import ConanException, ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name 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.env import 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 @@ -12,7 +13,7 @@ import shutil import yaml -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.55.0" class VulkanValidationLayersConan(ConanFile): @@ -22,14 +23,16 @@ class VulkanValidationLayersConan(ConanFile): topics = ("vulkan", "validation-layers") homepage = "https://github.com/KhronosGroup/Vulkan-ValidationLayers" url = "https://github.com/conan-io/conan-center-index" - + package_type = "static-library" settings = "os", "arch", "compiler", "build_type" options = { + "fPIC": [True, False], "with_wsi_xcb": [True, False], "with_wsi_xlib": [True, False], "with_wsi_wayland": [True, False], } default_options = { + "fPIC": True, "with_wsi_xcb": True, "with_wsi_xlib": True, "with_wsi_wayland": True, @@ -60,11 +63,28 @@ def _needs_pkg_config(self): 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 { + "17": { + "apple-clang": "9", + "clang": "6", + "gcc": "7", + "msvc": "191", + "Visual Studio": "15.7", + }, + }.get(self._min_cppstd, {}) + def export(self): copy(self, f"dependencies/{self._dependencies_filename}", self.recipe_folder, self.export_folder) def export_sources(self): - copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) export_conandata_patches(self) def config_options(self): @@ -72,21 +92,25 @@ def config_options(self): del self.options.with_wsi_xcb del self.options.with_wsi_xlib del self.options.with_wsi_wayland + if self.settings.os == "Windows": + del self.options.fPIC def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - # 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 Version comparison once https://github.com/conan-io/conan/issues/10000 is fixed - if Version(self.version) >= "1.2.173": - self.requires("robin-hood-hashing/3.11.5") + self.requires("robin-hood-hashing/3.11.5") + self.requires(self._require("spirv-headers")) + if Version(conan_version).major < "2": + # 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")) + else: + self.requires(self._require("spirv-tools")) + self.requires(self._require("vulkan-headers"), transitive_headers=True) if self.options.get_safe("with_wsi_xcb") or self.options.get_safe("with_wsi_xlib"): self.requires("xorg/system") if self._needs_wayland_for_build: - self.requires("wayland/1.21.0") + self.requires("wayland/1.22.0") def _require(self, recipe_name): if recipe_name not in self._dependencies_versions: @@ -94,34 +118,52 @@ def _require(self, recipe_name): return f"{recipe_name}/{self._dependencies_versions[recipe_name]}" def validate(self): - if self.info.settings.compiler.get_safe("cppstd"): - check_min_cppstd(self, 11) + 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.dependencies["spirv-tools"].options.shared: raise ConanInvalidConfiguration("vulkan-validationlayers can't depend on shared spirv-tools") - 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("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") + self.tool_requires("pkgconf/2.1.0") + if Version(self.version) >= "1.3.239": + self.tool_requires("cmake/[>=3.17.2 <4]") 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["VULKAN_HEADERS_INSTALL_DIR"] = self.dependencies["vulkan-headers"].package_folder.replace("\\", "/") + 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_WSI_XCB_SUPPORT"] = self.options.get_safe("with_wsi_xcb") + tc.variables["BUILD_WSI_XLIB_SUPPORT"] = self.options.get_safe("with_wsi_xlib") + tc.variables["BUILD_WSI_WAYLAND_SUPPORT"] = self.options.get_safe("with_wsi_wayland") + elif self.settings.os == "Android": + tc.variables["BUILD_WSI_XCB_SUPPORT"] = False + tc.variables["BUILD_WSI_XLIB_SUPPORT"] = False + tc.variables["BUILD_WSI_WAYLAND_SUPPORT"] = False tc.variables["BUILD_WERROR"] = False tc.variables["BUILD_TESTS"] = False tc.variables["INSTALL_TESTS"] = False @@ -135,29 +177,20 @@ def generate(self): 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): apply_conandata_patches(self) - cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") - # Unusual but prefer custom FindVulkanHeaders.cmake from upstream instead of config file of conan - replace_in_file(self, cmakelists, - "find_package(VulkanHeaders REQUIRED)", - "find_package(VulkanHeaders REQUIRED MODULE)") - 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") - # Ensure to use upstream FindWayland.cmake - if self._needs_wayland_for_build: - replace_in_file(self, cmakelists, - "find_package(Wayland REQUIRED)", - "find_package(Wayland REQUIRED MODULE)") - # Useless and may fail - if Version(self.version) >= "1.3.231": - replace_in_file(self, cmakelists, "include(VVLGenerateSourceCode)", "") + # 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(os.path.join(self.generators_folder, "SPIRV-Tools-optConfig.cmake")): @@ -165,17 +198,26 @@ def _patch_sources(self): os.path.join(self.generators_folder, "SPIRV-ToolsConfig.cmake"), os.path.join(self.generators_folder, "SPIRV-Tools-optConfig.cmake"), ) + if self.settings.os == "Android": + # INFO: libVkLayer_utils.a: error: undefined symbol: __android_log_print + # https://github.com/KhronosGroup/Vulkan-ValidationLayers/commit/a26638ae9fdd8c40b56d4c7b72859a5b9a0952c9 + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "VkLayer_utils PUBLIC Vulkan::Headers", "VkLayer_utils PUBLIC Vulkan::Headers -landroid -llog") + if not self.options.get_safe("fPIC"): + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "CMAKE_POSITION_INDEPENDENT_CODE ON", "CMAKE_POSITION_INDEPENDENT_CODE OFF") def build(self): self._patch_sources() cmake = CMake(self) - cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) + cmake.configure() 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() + 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") @@ -191,13 +233,28 @@ def package(self): # Move json files to res, but keep in mind to preserve relative # path between module library and manifest json file rename(self, os.path.join(self.package_folder, "share"), os.path.join(self.package_folder, "res")) + fix_apple_shared_install_name(self) 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(f"Prepending to VK_LAYER_PATH runtime environment variable: {vk_layer_path}") self.runenv_info.prepend_path("VK_LAYER_PATH", vk_layer_path) + + # Update runtime discovery paths to allow libVkLayer_khronos_validation.{so,dll,dylib} to be discovered + # and loaded by vulkan-loader when the consumer executes + # This is necessary because this package exports a static lib to link against and a dynamic lib to load at runtime + runtime_lib_discovery_path = "LD_LIBRARY_PATH" + if self.settings.os == "Windows": + runtime_lib_discovery_path = "PATH" + if self.settings.os == "Macos": + runtime_lib_discovery_path = "DYLD_LIBRARY_PATH" + for libdir in [os.path.join(self.package_folder, libdir) for libdir in self.cpp_info.libdirs]: + self.runenv_info.prepend_path(runtime_lib_discovery_path, libdir) + # 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) + + if self.settings.os == "Android": + self.cpp_info.system_libs.extend(["android", "log"]) 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.2.182.yml b/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.2.182.yml deleted file mode 100644 index b9bba2753f36e..0000000000000 --- a/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.2.182.yml +++ /dev/null @@ -1,2 +0,0 @@ -spirv-tools: "2021.2" -vulkan-headers: "1.2.182" diff --git a/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.2.189.2.yml b/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.2.189.2.yml deleted file mode 100644 index d04ec5223c8dd..0000000000000 --- a/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.2.189.2.yml +++ /dev/null @@ -1,2 +0,0 @@ -spirv-tools: "2021.3" -vulkan-headers: "1.2.189" diff --git a/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.2.198.0.yml b/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.2.198.0.yml deleted file mode 100644 index 31b1b00476431..0000000000000 --- a/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.2.198.0.yml +++ /dev/null @@ -1,2 +0,0 @@ -spirv-tools: "2021.4" -vulkan-headers: "1.2.198.0" diff --git a/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.3.204.1.yml b/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.3.204.1.yml deleted file mode 100644 index 41940a6cde1f7..0000000000000 --- a/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.3.204.1.yml +++ /dev/null @@ -1,2 +0,0 @@ -spirv-tools: "1.3.204.0" -vulkan-headers: "1.3.204.1" diff --git a/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.3.211.0.yml b/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.3.211.0.yml index 0c38c431cad0f..d6b212b266991 100644 --- a/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.3.211.0.yml +++ b/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.3.211.0.yml @@ -1,2 +1,3 @@ +spirv-headers: "1.3.211.0" spirv-tools: "1.3.211.0" vulkan-headers: "1.3.211.0" diff --git a/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.3.216.0.yml b/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.3.216.0.yml index bcd70ac192233..3ca4ddaf45684 100644 --- a/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.3.216.0.yml +++ b/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.3.216.0.yml @@ -1,2 +1,3 @@ +spirv-headers: "1.3.216.0" spirv-tools: "1.3.216.0" vulkan-headers: "1.3.216.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 index 17115c7cd5750..5db991b2921eb 100644 --- a/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.3.224.1.yml +++ b/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.3.224.1.yml @@ -1,2 +1,3 @@ +spirv-headers: "1.3.224.0" 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 index bfd00812c5211..55064d8349ad8 100644 --- a/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.3.231.1.yml +++ b/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.3.231.1.yml @@ -1,2 +1,3 @@ +spirv-headers: "1.3.231.1" 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..6e9ed400844e9 --- /dev/null +++ b/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.3.236.0.yml @@ -0,0 +1,3 @@ +spirv-headers: "1.3.236.0" +spirv-tools: "1.3.236.0" +vulkan-headers: "1.3.236.0" diff --git a/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.3.239.0.yml b/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.3.239.0.yml new file mode 100644 index 0000000000000..a580c69936290 --- /dev/null +++ b/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.3.239.0.yml @@ -0,0 +1,3 @@ +spirv-headers: "1.3.239.0" +spirv-tools: "1.3.239.0" +vulkan-headers: "1.3.239.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.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-cmake-no-werror.patch b/recipes/vulkan-validationlayers/all/patches/1.3.231.1-0002-cmake-no-werror.patch similarity index 100% rename from recipes/vulkan-validationlayers/all/patches/1.3.231.1-cmake-no-werror.patch rename to recipes/vulkan-validationlayers/all/patches/1.3.231.1-0002-cmake-no-werror.patch 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/patches/1.3.239.0-0001-fix-cmake.patch b/recipes/vulkan-validationlayers/all/patches/1.3.239.0-0001-fix-cmake.patch new file mode 100644 index 0000000000000..e30c2cbd5ce46 --- /dev/null +++ b/recipes/vulkan-validationlayers/all/patches/1.3.239.0-0001-fix-cmake.patch @@ -0,0 +1,11 @@ +--- a/layers/CMakeLists.txt ++++ b/layers/CMakeLists.txt +@@ -134,7 +134,7 @@ endif() + + find_package(PythonInterp 3 QUIET) + +-if (PYTHONINTERP_FOUND) ++if (0) + # Get the include directory of the SPIRV-Headers + get_target_property(SPIRV_HEADERS_INCLUDE_DIR SPIRV-Headers::SPIRV-Headers INTERFACE_INCLUDE_DIRECTORIES) + diff --git a/recipes/vulkan-validationlayers/all/test_package/CMakeLists.txt b/recipes/vulkan-validationlayers/all/test_package/CMakeLists.txt index 29405b4177fbe..f968d5c77f977 100644 --- a/recipes/vulkan-validationlayers/all/test_package/CMakeLists.txt +++ b/recipes/vulkan-validationlayers/all/test_package/CMakeLists.txt @@ -5,4 +5,8 @@ find_package(vulkan-validationlayers REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE vulkan-validationlayers::vulkan-validationlayers) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +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/config.yml b/recipes/vulkan-validationlayers/config.yml index cc5317034e120..15d0c149a289c 100644 --- a/recipes/vulkan-validationlayers/config.yml +++ b/recipes/vulkan-validationlayers/config.yml @@ -1,4 +1,8 @@ versions: + "1.3.239.0": + folder: all + "1.3.236.0": + folder: all "1.3.231.1": folder: all "1.3.224.1": @@ -7,13 +11,3 @@ versions: folder: all "1.3.211.0": folder: all - "1.3.204.1": - folder: all - "1.2.198.0": - folder: all - "1.2.189.2": - folder: all - "1.2.182": - folder: all - "1.2.154.0": - folder: all diff --git a/recipes/vvenc/all/conandata.yml b/recipes/vvenc/all/conandata.yml new file mode 100644 index 0000000000000..cab7ae30015bb --- /dev/null +++ b/recipes/vvenc/all/conandata.yml @@ -0,0 +1,13 @@ +sources: + "1.12.0": + url: "https://github.com/fraunhoferhhi/vvenc/archive/refs/tags/v1.12.0.tar.gz" + sha256: "e7311ffcc87d8fcc4b839807061cca1b89be017ae7c449a69436dc2dd07615c2" + "1.11.1": + url: "https://github.com/fraunhoferhhi/vvenc/archive/refs/tags/v1.11.1.tar.gz" + sha256: "4f0c8ac3f03eb970bee7a0cacc57a886ac511d58f081bb08ba4bce6f547d92fa" + "1.10.0": + url: "https://github.com/fraunhoferhhi/vvenc/archive/refs/tags/v1.10.0.tar.gz" + sha256: "579e4b19de3b356a96ec436dbfeb3b9583cb0a854e55f81226990924a5cfd38c" + "1.8.0": + url: "https://github.com/fraunhoferhhi/vvenc/archive/refs/tags/v1.8.0.tar.gz" + sha256: "119970f1e00667045eb12775db10611fc04f9158348144913c9e233f98664714" diff --git a/recipes/vvenc/all/conanfile.py b/recipes/vvenc/all/conanfile.py new file mode 100644 index 0000000000000..c1b3ae45e3f99 --- /dev/null +++ b/recipes/vvenc/all/conanfile.py @@ -0,0 +1,127 @@ +import os +import sys + +from conan import ConanFile, conan_version +# FIXME: linter complains, but function is there +# https://docs.conan.io/2.0/reference/tools/build.html?highlight=check_min_cppstd#conan-tools-build-check-max-cppstd +# from conan.tools.build import stdcpp_library, check_min_cppstd, check_max_cppstd +from conan.tools.build import stdcpp_library, check_min_cppstd +from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps +from conan.tools.files import get, copy, rmdir, rm +from conan.tools.scm import Version + +required_conan_version = ">=1.60.1" + + +class vvencRecipe(ConanFile): + name = "vvenc" + description = "Fraunhofer Versatile Video Encoder (VVenC)" + license = "BSD-3-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://www.hhi.fraunhofer.de/en/departments/vca/technologies-and-solutions/h266-vvc.html" + topics = ("video", "encoder", "codec", "vvc", "h266") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + def validate_build(self): + if conan_version.major == 2: + self._validate_build2() + elif conan_version.major == 1: + self._validate_build1() + + def _validate_build1(self): + if self.settings.get_safe("compiler.cppstd"): + check_min_cppstd(self, 14) + # compiler.cppstd isn't set! but we still continue here in V1, + # imagining just like compiler.cppstd was set to 14 + # while package_id doesn't reflect that at all, and cppstd_default also + # might be different from 14, we silently force -std=c++14 to be + # specified during the build. it may produce more incompatibilities, + # and break user's expectation + # (like, output binary depends really on C++14 symbols libstdc++.so) + # it's V1 design flaw which isn't going to be addressed here + # (and probably nowhere, because conan V1 is going to be discontinued in CCI) + # once V1 is retired, that code will be removed altogether + self.output.warning("compiler.cppstd is not set, but we assume C++14") + + def _validate_build2(self): + # validates the minimum and maximum C++ standard supported + # currently, the project can only be built with C++14 standard + # it cannot be built with older standard because + # it doesn't have all the C++ features needed + # and it cannot be built with newer C++ standard + # because they have existing C++ features removed + check_min_cppstd(self, 14) + if Version(self.version) < "1.10.0": + # FIXME: linter complains, but function is there + # https://docs.conan.io/2.0/reference/tools/build.html?highlight=check_min_cppstd#conan-tools-build-check-max-cppstd + check_max_cppstd = getattr(sys.modules['conan.tools.build'], 'check_max_cppstd') + check_max_cppstd(self, 14) + + 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 layout(self): + cmake_layout(self, src_folder='src') + + def package_id(self): + # still important, older binutils cannot recognize + # object files created with newer binutils, + # thus linker cannot find any valid object and therefore symbols + # (fails to find `vvenc_get_version`, which is obviously always there) + # this is not exactly modeled by conan right now, + # so "compiler" setting is closest thing to avoid an issue + # (while technically it's not a compiler, but linker and archiver) + # del self.info.settings.compiler + pass + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + deps = CMakeDeps(self) + deps.generate() + tc = CMakeToolchain(self) + tc.variables["VVENC_ENABLE_LINK_TIME_OPT"] = False + tc.cache_variables["VVENC_ENABLE_LINK_TIME_OPT"] = False + if self.settings.compiler in ["gcc", 'clang']: + tc.blocks["cmake_flags_init"].template += '\nstring(APPEND CMAKE_C_FLAGS_INIT " -Wno-uninitialized")' + tc.blocks["cmake_flags_init"].template += '\nstring(APPEND CMAKE_CXX_FLAGS_INIT " -Wno-uninitialized")' + 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, "lib", 'pkgconfig')) + rmdir(self, os.path.join(self.package_folder, 'lib', "cmake")) + rm(self, "*.pdb", os.path.join(self.package_folder, 'bin')) + rm(self, '*.pdb', os.path.join(self.package_folder, "lib")) + + def package_info(self): + self.cpp_info.libs = ["vvenc"] + if self.options.shared: + self.cpp_info.defines.extend(["VVENC_DYN_LINK"]) # vvcencDecl.h + libcxx = stdcpp_library(self) # source code is C++, but interface is pure C + libcxx = [libcxx] if libcxx else [] + libm = ["m"] if self.settings.get_safe("os") == "Linux" else [] + libpthread = ['pthread'] if self.settings.get_safe('os') == 'Linux' else [] + self.cpp_info.system_libs.extend(libcxx + libm + libpthread) diff --git a/recipes/vvenc/all/test_package/CMakeLists.txt b/recipes/vvenc/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..c201147dc181d --- /dev/null +++ b/recipes/vvenc/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) + +find_package(vvenc CONFIG REQUIRED) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE vvenc::vvenc) diff --git a/recipes/vvenc/all/test_package/conanfile.py b/recipes/vvenc/all/test_package/conanfile.py new file mode 100644 index 0000000000000..2f7db800db937 --- /dev/null +++ b/recipes/vvenc/all/test_package/conanfile.py @@ -0,0 +1,27 @@ +import os + +from conan import ConanFile +from conan.tools.cmake import CMake, cmake_layout +from conan.tools.build import can_run + + +class vvencTestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "CMakeDeps", 'VirtualRunEnv', "CMakeToolchain" + 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 can_run(self): + cmd = os.path.join(self.cpp.build.bindir, "test_package") + self.run(cmd, env="conanrun") diff --git a/recipes/vvenc/all/test_package/test_package.c b/recipes/vvenc/all/test_package/test_package.c new file mode 100644 index 0000000000000..2a6652d65f4eb --- /dev/null +++ b/recipes/vvenc/all/test_package/test_package.c @@ -0,0 +1,6 @@ +#include +#include + +int main() { + printf("vvenc_get_version: %s\n", vvenc_get_version()); +} diff --git a/recipes/vvenc/config.yml b/recipes/vvenc/config.yml new file mode 100644 index 0000000000000..dcf5ab8c72631 --- /dev/null +++ b/recipes/vvenc/config.yml @@ -0,0 +1,9 @@ +versions: + "1.12.0": + folder: "all" + "1.11.1": + folder: "all" + "1.10.0": + folder: "all" + "1.8.0": + folder: "all" diff --git a/recipes/waf/all/conandata.yml b/recipes/waf/all/conandata.yml index 4d28ed8ee8074..07871b61a4101 100644 --- a/recipes/waf/all/conandata.yml +++ b/recipes/waf/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "2.0.26": + url: "https://waf.io/waf-2.0.26.tar.bz2" + sha256: "c33d19c1bdfae1b078edaef2fab19b1bc734294edd4cc005d4881e9d53ed219c" + "2.0.25": + url: "https://waf.io/waf-2.0.25.tar.bz2" + sha256: "66cff7beed0e77db874e9232cc08874abb3e866c7f0f1f34ba2f959fde44fdd4" "2.0.19": url: "https://waf.io/waf-2.0.19.tar.bz2" sha256: "d8402689b72fe75f759a83b5f6bdf9b4f34ca7fd6007d80680ecfcbef5c2bba5" diff --git a/recipes/waf/all/conanfile.py b/recipes/waf/all/conanfile.py index cc8d7cdece540..6d2f8a76078a0 100644 --- a/recipes/waf/all/conanfile.py +++ b/recipes/waf/all/conanfile.py @@ -1,28 +1,37 @@ -from conans import ConanFile, tools import os +from conan import ConanFile +from conan.tools.files import copy, get, save +from conan.tools.layout import basic_layout + +required_conan_version = ">=1.47.0" + class WafConan(ConanFile): name = "waf" description = "The Waf build system" - topics = ("conan", "waf", "builsystem") + license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://waf.io" - license = "BSD-3-Clause" - settings = "os", "arch" + topics = ("buildsystem", "pre-built") - @property - def _source_subfolder(self): - return "source_subfolder" + package_type = "application" + settings = "os", "arch", "compiler", "build_type" + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + del self.info.settings.compiler + del self.info.settings.build_type def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename("waf-{}".format(self.version), self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) @property def _license_text(self): - [_, license, _] = open(os.path.join(self.source_folder, self._source_subfolder, "waf"), "rb").read().split(b"\"\"\"", 3) - return license.decode().lstrip() + license_text = self.source_path.joinpath("waf").read_bytes().split(b'"""', 3)[1] + return license_text.decode().lstrip() def build(self): pass @@ -31,30 +40,28 @@ def package(self): binpath = os.path.join(self.package_folder, "bin") libpath = os.path.join(self.package_folder, "lib") - os.mkdir(binpath) - os.mkdir(libpath) + save(self, os.path.join(self.package_folder, "licenses", "LICENSE"), self._license_text) - tools.save(os.path.join(self.package_folder, "licenses", "LICENSE"), self._license_text) - - self.copy("waf", src=self._source_subfolder, dst=binpath) - self.copy("waf-light", src=self._source_subfolder, dst=binpath) - self.copy("waflib/*", src=self._source_subfolder, dst=libpath) + copy(self, "waf", src=self.source_folder, dst=binpath) + copy(self, "waf-light", src=self.source_folder, dst=binpath) + copy(self, "waflib/*", src=self.source_folder, dst=libpath) if self.settings.os == "Windows": - self.copy("waf.bat", src=os.path.join(self._source_subfolder, "utils"), dst=binpath) + copy(self, "waf.bat", src=os.path.join(self.source_folder, "utils"), dst=binpath) os.chmod(os.path.join(binpath, "waf"), 0o755) os.chmod(os.path.join(binpath, "waf-light"), 0o755) def package_info(self): + self.cpp_info.frameworkdirs = [] + self.cpp_info.resdirs = [] + self.cpp_info.includedirs = [] self.cpp_info.libdirs = [] + wafdir = os.path.join(self.package_folder, "lib") + self.buildenv_info.define_path("WAFDIR", wafdir) + + # TODO: Legacy, remove in 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) - - wafdir = os.path.join(self.package_folder, "lib") - self.output.info("Setting WAFDIR env var: {}".format(wafdir)) self.env_info.WAFDIR = wafdir - - diff --git a/recipes/waf/all/test_package/conanfile.py b/recipes/waf/all/test_package/conanfile.py index 9d956eec26829..f47744ecfec84 100644 --- a/recipes/waf/all/test_package/conanfile.py +++ b/recipes/waf/all/test_package/conanfile.py @@ -1,42 +1,45 @@ -from conans import ConanFile, tools -from contextlib import contextmanager import os import shutil +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.layout import basic_layout + class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" + settings = "os", "arch", "compiler", "build_type" + test_type = "explicit" exports_sources = "a.cpp", "b.cpp", "main.c", "main.cpp", "wscript" + def build_requirements(self): + self.tool_requires(self.tested_reference_str) + + def layout(self): + basic_layout(self) + + def generate(self): + buildenv = VirtualBuildEnv(self) + buildenv.generate() + + env = Environment() + for var in ["DYLD_LIBRARY_PATH", "LD_LIBRARY_PATH"]: + env.append_path(var, self.build_folder) + env.vars(self, scope="run").save_script("conanrun_macos_dyld_path") + def build(self): - if tools.cross_building(self.settings): - return - - for src in self.exports_sources: - shutil.copy(os.path.join(self.source_folder, src), self.build_folder) - - waf_path = tools.which("waf") - if waf_path: - waf_path = waf_path.replace("\\", "/") - assert waf_path.startswith(str(self.deps_cpp_info["waf"].rootpath)) - - with tools.vcvars(self.settings) if self.settings.compiler == "Visual Studio" else tools.no_op(): - self.run("waf -h") - self.run("waf configure") - self.run("waf") - - @contextmanager - def _add_ld_search_path(self): - env = {} - if self.settings.os == "Linux": - env["LD_LIBRARY_PATH"] = [os.path.join(os.getcwd(), "build")] - elif self.settings.os == "Macos": - env["DYLD_LIBRARY_PATH"] = [os.path.join(os.getcwd(), "build")] - with tools.environment_append(env): - yield + if can_run(self): + for src in self.exports_sources: + shutil.copy(os.path.join(self.source_folder, src), self.build_folder) + + with chdir(self, self.build_folder): + self.run(f"waf configure -o {self.cpp.build.bindir}") + self.run("waf") def test(self): - if not tools.cross_building(self.settings): - with self._add_ld_search_path(): - self.run(os.path.join("build", "app"), run_environment=True) - self.run(os.path.join("build", "app2"), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindir, "app") + self.run(bin_path, env="conanrun") + bin_path = os.path.join(self.cpp.build.bindir, "app2") + self.run(bin_path, env="conanrun") diff --git a/recipes/waf/all/test_v1_package/conanfile.py b/recipes/waf/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..252c1f1ae1d96 --- /dev/null +++ b/recipes/waf/all/test_v1_package/conanfile.py @@ -0,0 +1,43 @@ +from conan.tools.apple import is_apple_os +from conans import ConanFile, tools +from contextlib import contextmanager +import os +import shutil + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + exports_sources = "a.cpp", "b.cpp", "main.c", "main.cpp", "wscript" + + def build(self): + if tools.cross_building(self.settings): + return + + for src in self.exports_sources: + shutil.copy(os.path.join(self.source_folder, os.pardir, "test_package", src), self.build_folder) + + waf_path = tools.which("waf") + if waf_path: + waf_path = waf_path.replace("\\", "/") + assert waf_path.startswith(str(self.deps_cpp_info["waf"].rootpath)) + + with tools.vcvars(self.settings) if self.settings.compiler == "Visual Studio" else tools.no_op(): + self.run("waf -h") + self.run("waf configure") + self.run("waf") + + @contextmanager + def _add_ld_search_path(self): + env = {} + if self.settings.os in ["Linux", "FreeBSD"]: + env["LD_LIBRARY_PATH"] = [os.path.join(os.getcwd(), "build")] + elif is_apple_os(self): + env["DYLD_LIBRARY_PATH"] = [os.path.join(os.getcwd(), "build")] + with tools.environment_append(env): + yield + + def test(self): + if not tools.cross_building(self.settings): + with self._add_ld_search_path(): + self.run(os.path.join("build", "app"), run_environment=True) + self.run(os.path.join("build", "app2"), run_environment=True) diff --git a/recipes/waf/config.yml b/recipes/waf/config.yml index e3883114dd1bb..9df1d7fdf59a0 100644 --- a/recipes/waf/config.yml +++ b/recipes/waf/config.yml @@ -1,3 +1,7 @@ versions: + "2.0.26": + folder: all + "2.0.25": + folder: all "2.0.19": folder: all diff --git a/recipes/wasm-micro-runtime/all/conandata.yml b/recipes/wasm-micro-runtime/all/conandata.yml new file mode 100644 index 0000000000000..ba4fdc32928ed --- /dev/null +++ b/recipes/wasm-micro-runtime/all/conandata.yml @@ -0,0 +1,30 @@ +sources: + "2.2.0": + url: "https://github.com/bytecodealliance/wasm-micro-runtime/archive/refs/tags/WAMR-2.2.0.tar.gz" + sha256: "93b6ba03f681e061967106046b1908631ee705312b9a6410f3baee7af7c6aac9" + "1.3.3": + url: "https://github.com/bytecodealliance/wasm-micro-runtime/archive/refs/tags/WAMR-1.3.3.tar.gz" + sha256: "94d18b081b6fac0574faf36338c7762a659ff175b9ae2cbc1c0a8f045edcbe7a" + "1.2.3": + url: "https://github.com/bytecodealliance/wasm-micro-runtime/archive/refs/tags/WAMR-1.2.3.tar.gz" + sha256: "85057f788630dc1b8c371f5443cc192627175003a8ea63c491beaff29a338346" + "1.2.2": + url: "https://github.com/bytecodealliance/wasm-micro-runtime/archive/refs/tags/WAMR-1.2.2.tar.gz" + sha256: "d328fc1e19c54cfdb4248b861de54b62977b9b85c0a40eaaeb9cd9b628c0c788" +patches: + "2.2.0": + - patch_file: "patches/2.2.0-0001-fix-cmake.patch" + patch_description: "link ntdll on Windows" + patch_type: "conan" + "1.3.3": + - patch_file: "patches/1.3.3-0001-fix-cmake.patch" + patch_description: "separate static and shared build, link ntdll on Windows" + patch_type: "conan" + "1.2.3": + - patch_file: "patches/1.2.3-0001-fix-cmake.patch" + patch_description: "separate static and shasred build" + patch_type: "conan" + "1.2.2": + - patch_file: "patches/1.2.2-0001-fix-cmake.patch" + patch_description: "separate static and shasred build" + patch_type: "conan" diff --git a/recipes/wasm-micro-runtime/all/conanfile.py b/recipes/wasm-micro-runtime/all/conanfile.py new file mode 100644 index 0000000000000..e8354068cc7fd --- /dev/null +++ b/recipes/wasm-micro-runtime/all/conanfile.py @@ -0,0 +1,141 @@ +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.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version +import os + +required_conan_version = ">=1.53.0" + +class WasmMicroRuntimeConan(ConanFile): + name = "wasm-micro-runtime" + description = "WebAssembly Micro Runtime (WAMR)" + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://bytecodealliance.github.io/wamr.dev/" + topics = ("wasm", "embedded", "webassembly", "runtime") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_interp": [False, "fast", "classic"], + "with_aot": [True, False], + "with_jit": [True, False], + "with_fast_jit": [True, False], + "libc": ["builtin", "wasi", "uvwasi"], + "with_multi_module": [True, False], + "with_mini_loader": [True, False], + "with_pthread": [True, False], + "with_wasi_threads": [True, False], + "with_tail_call": [True, False], + "with_simd": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_interp": "fast", + "with_aot": True, + "with_jit": False, + "with_fast_jit": False, + "libc": "builtin", + "with_multi_module": False, + "with_mini_loader": False, + "with_pthread": False, + "with_wasi_threads": False, + "with_tail_call": False, + "with_simd": 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") + # When with_fast_jit is True, C++ is required. + if not self.options.with_fast_jit: + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + # When with_fast_jit is True, C++ is required. + if not self.options.with_fast_jit: + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) + if not self.options.with_interp and not self.options.with_aot: + raise ConanInvalidConfiguration(f"{self.ref} requires with_interp and with_aot at least one.") + if self.options.with_jit: + raise ConanInvalidConfiguration(f"{self.ref} doesn't support with_jit(yet).") + if self.options.with_multi_module and self.options.with_mini_loader: + raise ConanInvalidConfiguration(f"{self.ref} doesn't support both with_multi_module and with_mini_loader.") + if self.options.libc == "wasi" and self.settings.os == "Windows": + raise ConanInvalidConfiguration(f"{self.ref} doesn't support libc=wasi on Windows.") + if self.options.libc == "uvwasi": + raise ConanInvalidConfiguration(f"{self.ref} doesn't support libc=uvwasi(yet).") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + def is_enabled(value): + return 1 if value else 0 + + tc = CMakeToolchain(self) + # FIXME: it should use assembler code instead of C++ on MSVC + if is_msvc(self): + tc.variables["WAMR_BUILD_INVOKE_NATIVE_GENERAL"] = 1 + + # interpreters + tc.variables["WAMR_BUILD_INTERP"] = is_enabled(self.options.with_interp) + if self.options.with_interp: + tc.variables["WAMR_BUILD_FAST_INTERP"] = is_enabled(self.options.with_interp == "fast") + # AOT and JITs + tc.variables["WAMR_BUILD_AOT"] = is_enabled(self.options.with_aot) + tc.variables["WAMR_BUILD_JIT"] = is_enabled(self.options.with_jit) + tc.variables["WAMR_BUILD_FAST_JIT"] = is_enabled(self.options.with_fast_jit) + # LIBC + tc.variables["WAMR_BUILD_LIBC_BUILTIN"] = is_enabled(self.options.libc == "builtin") + tc.variables["WAMR_BUILD_LIBC_WASI"] = is_enabled(self.options.libc == "wasi") + tc.variables["WAMR_BUILD_LIBC_UVWASI"] = is_enabled(self.options.libc == "uvwasi") + # others + tc.variables["WAMR_BUILD_MULTI_MODULE"] = is_enabled(self.options.with_multi_module) + tc.variables["WAMR_BUILD_MINI_LOADER"] = is_enabled(self.options.with_mini_loader) + tc.variables["WAMR_BUILD_LIB_PTHREAD"] = is_enabled(self.options.with_pthread) + tc.variables["WAMR_BUILD_LIB_WASI_THREADS"] = is_enabled(self.options.with_wasi_threads) + tc.variables["WAMR_BUILD_TAIL_CALL"] = is_enabled(self.options.with_tail_call) + tc.variables["WAMR_BUILD_SIMD"] = is_enabled(self.options.with_simd) + 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 = ["iwasm" if self.options.shared else "vmlib"] + if self.settings.os == "Windows" and not self.options.shared: + self.cpp_info.defines.append("COMPILING_WASM_RUNTIME_API=0") + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") + self.cpp_info.system_libs.append("pthread") + if self.settings.os == "Windows": + self.cpp_info.system_libs.append("ws2_32") + if Version(self.version) >= "1.3.0": + self.cpp_info.system_libs.append("ntdll") diff --git a/recipes/wasm-micro-runtime/all/patches/1.2.2-0001-fix-cmake.patch b/recipes/wasm-micro-runtime/all/patches/1.2.2-0001-fix-cmake.patch new file mode 100644 index 0000000000000..baf12ba1a1b62 --- /dev/null +++ b/recipes/wasm-micro-runtime/all/patches/1.2.2-0001-fix-cmake.patch @@ -0,0 +1,57 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 1c87994..bbcb2fd 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -109,11 +109,6 @@ set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}) + + include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake) + +-set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security -Wshadow -Wno-unused-parameter") +-# set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wconversion -Wsign-conversion") +- +-set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wformat -Wformat-security -Wno-unused") +- + if (WAMR_BUILD_TARGET MATCHES "X86_.*" OR WAMR_BUILD_TARGET STREQUAL "AMD_64") + if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang")) + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mindirect-branch-register") +@@ -130,22 +125,29 @@ endif () + + include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake) + ++if (NOT BUILD_SHARED_LIBS) + # STATIC LIBRARY + add_library(iwasm_static STATIC ${WAMR_RUNTIME_LIB_SOURCE}) + set_target_properties (iwasm_static PROPERTIES OUTPUT_NAME vmlib) + target_include_directories(iwasm_static INTERFACE ${WAMR_ROOT_DIR}/core/iwasm/include) +-target_link_libraries (iwasm_static INTERFACE ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} -lm -ldl -lpthread) ++target_link_libraries (iwasm_static INTERFACE ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS}) ++if(NOT MSVC) ++target_link_libraries (iwasm_static INTERFACE -lm -ldl -lpthread) ++endif() + if (WAMR_BUILD_WASM_CACHE EQUAL 1) + target_link_libraries(iwasm_static INTERFACE boringssl_crypto) + endif () + + install (TARGETS iwasm_static ARCHIVE DESTINATION lib) +- ++else() + # SHARED LIBRARY + add_library (iwasm_shared SHARED ${WAMR_RUNTIME_LIB_SOURCE}) + set_target_properties (iwasm_shared PROPERTIES OUTPUT_NAME iwasm) + target_include_directories(iwasm_shared INTERFACE ${WAMR_ROOT_DIR}/core/iwasm/include) +-target_link_libraries (iwasm_shared INTERFACE ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} -lm -ldl -lpthread) ++target_link_libraries (iwasm_shared INTERFACE ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS}) ++if(NOT MSVC) ++target_link_libraries (iwasm_shared INTERFACE -lm -ldl -lpthread) ++endif() + if (WAMR_BUILD_WASM_CACHE EQUAL 1) + target_link_libraries(iwasm_shared INTERFACE boringssl_crypto) + endif () +@@ -155,6 +157,7 @@ if (MINGW) + endif () + + install (TARGETS iwasm_shared LIBRARY DESTINATION lib) ++endif() + + # HEADERS + install (FILES diff --git a/recipes/wasm-micro-runtime/all/patches/1.2.3-0001-fix-cmake.patch b/recipes/wasm-micro-runtime/all/patches/1.2.3-0001-fix-cmake.patch new file mode 100644 index 0000000000000..b67b2a33b5dea --- /dev/null +++ b/recipes/wasm-micro-runtime/all/patches/1.2.3-0001-fix-cmake.patch @@ -0,0 +1,88 @@ +diff --git a/a/CMakeLists.txt b/b/CMakeLists.txt +index fbea261..9f9892a 100644 +--- a/a/CMakeLists.txt ++++ b/b/CMakeLists.txt +@@ -108,17 +108,12 @@ endif () + set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}) + + # Set the strip command based on the system (GNU or Clang) +-if (CMAKE_STRIP) ++if (NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "AppleClang" AND CMAKE_STRIP) + set (CMAKE_STRIP_FLAGS "--strip-all") + endif () + + include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake) + +-set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security -Wshadow -Wno-unused-parameter") +-# set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wconversion -Wsign-conversion") +- +-set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wformat -Wformat-security -Wno-unused") +- + if (WAMR_BUILD_TARGET MATCHES "X86_.*" OR WAMR_BUILD_TARGET STREQUAL "AMD_64") + if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang")) + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mindirect-branch-register") +@@ -135,11 +130,15 @@ endif () + + include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake) + ++if (NOT BUILD_SHARED_LIBS) + # STATIC LIBRARY + add_library(iwasm_static STATIC ${WAMR_RUNTIME_LIB_SOURCE}) + set_target_properties (iwasm_static PROPERTIES OUTPUT_NAME vmlib) + target_include_directories(iwasm_static INTERFACE ${WAMR_ROOT_DIR}/core/iwasm/include) +-target_link_libraries (iwasm_static INTERFACE ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} -lm -ldl -lpthread) ++target_link_libraries (iwasm_static INTERFACE ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS}) ++if(NOT MSVC) ++ target_link_libraries (iwasm_static INTERFACE -lm -ldl -lpthread) ++endif() + if (WAMR_BUILD_WASM_CACHE EQUAL 1) + target_link_libraries(iwasm_static INTERFACE boringssl_crypto) + endif () +@@ -147,19 +146,22 @@ endif () + install (TARGETS iwasm_static ARCHIVE DESTINATION lib) + + # If it's a Release build, strip the static library +-if (CMAKE_STRIP AND CMAKE_BUILD_TYPE STREQUAL "Release") ++if (0) + # Strip static library + message (STATUS "Stripping static library after build!") + add_custom_command (TARGET iwasm_static POST_BUILD + COMMAND ${CMAKE_STRIP} ${CMAKE_STRIP_FLAGS} $ + ) + endif () +- ++else() + # SHARED LIBRARY + add_library (iwasm_shared SHARED ${WAMR_RUNTIME_LIB_SOURCE}) + set_target_properties (iwasm_shared PROPERTIES OUTPUT_NAME iwasm) + target_include_directories(iwasm_shared INTERFACE ${WAMR_ROOT_DIR}/core/iwasm/include) +-target_link_libraries (iwasm_shared INTERFACE ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} -lm -ldl -lpthread) ++target_link_libraries (iwasm_shared INTERFACE ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS}) ++if(NOT MSVC) ++ target_link_libraries (iwasm_shared INTERFACE -lm -ldl -lpthread) ++endif() + if (WAMR_BUILD_WASM_CACHE EQUAL 1) + target_link_libraries(iwasm_shared INTERFACE boringssl_crypto) + endif () +@@ -169,7 +171,7 @@ if (MINGW) + endif () + + install (TARGETS iwasm_shared LIBRARY DESTINATION lib) +- ++endif() + # HEADERS + install (FILES + ${WAMR_ROOT_DIR}/core/iwasm/include/wasm_c_api.h +@@ -177,6 +179,7 @@ install (FILES + ${WAMR_ROOT_DIR}/core/iwasm/include/lib_export.h + DESTINATION include) + ++if (NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "AppleClang" AND BUILD_SHARED_LIBS) + # If it's a Release build, strip the shared library + if (CMAKE_STRIP AND CMAKE_BUILD_TYPE STREQUAL "Release") + # Strip shared library +@@ -185,3 +188,4 @@ if (CMAKE_STRIP AND CMAKE_BUILD_TYPE STREQUAL "Release") + COMMAND ${CMAKE_STRIP} ${CMAKE_STRIP_FLAGS} $ + ) + endif () ++endif () diff --git a/recipes/wasm-micro-runtime/all/patches/1.3.3-0001-fix-cmake.patch b/recipes/wasm-micro-runtime/all/patches/1.3.3-0001-fix-cmake.patch new file mode 100644 index 0000000000000..c86c12d4bcbe1 --- /dev/null +++ b/recipes/wasm-micro-runtime/all/patches/1.3.3-0001-fix-cmake.patch @@ -0,0 +1,64 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 0ffba05..68d03d2 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -114,10 +114,10 @@ set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}) + + include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake) + +-set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security -Wshadow -Wno-unused-parameter") ++# set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security -Wshadow -Wno-unused-parameter") + # set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wconversion -Wsign-conversion") + +-set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wformat -Wformat-security -Wno-unused") ++# set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wformat -Wformat-security -Wno-unused") + + if (WAMR_BUILD_TARGET MATCHES "X86_.*" OR WAMR_BUILD_TARGET STREQUAL "AMD_64") + if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang")) +@@ -135,22 +135,34 @@ endif () + + include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake) + ++if (NOT BUILD_SHARED_LIBS) + # STATIC LIBRARY + add_library(iwasm_static STATIC ${WAMR_RUNTIME_LIB_SOURCE}) + set_target_properties (iwasm_static PROPERTIES OUTPUT_NAME vmlib) + target_include_directories(iwasm_static INTERFACE ${WAMR_ROOT_DIR}/core/iwasm/include) +-target_link_libraries (iwasm_static INTERFACE ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} -lm -ldl -lpthread) ++# target_link_libraries (iwasm_static INTERFACE ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} -lm -ldl -lpthread) ++target_link_libraries (iwasm_static INTERFACE ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS}) ++if(NOT MSVC) ++ target_link_libraries (iwasm_static INTERFACE -lm -ldl -lpthread) ++endif() + if (WAMR_BUILD_WASM_CACHE EQUAL 1) + target_link_libraries(iwasm_static INTERFACE boringssl_crypto) + endif () + + install (TARGETS iwasm_static ARCHIVE DESTINATION lib) +- ++else() + # SHARED LIBRARY + add_library (iwasm_shared SHARED ${WAMR_RUNTIME_LIB_SOURCE}) + set_target_properties (iwasm_shared PROPERTIES OUTPUT_NAME iwasm) + target_include_directories(iwasm_shared INTERFACE ${WAMR_ROOT_DIR}/core/iwasm/include) +-target_link_libraries (iwasm_shared INTERFACE ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} -lm -ldl -lpthread) ++# target_link_libraries (iwasm_shared INTERFACE ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} -lm -ldl -lpthread) ++target_link_libraries (iwasm_shared INTERFACE ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS}) ++if(NOT MSVC) ++ target_link_libraries (iwasm_shared INTERFACE -lm -ldl -lpthread) ++endif() ++if(WIN32) ++ target_link_libraries (iwasm_shared PUBLIC ntdll) ++endif() + if (WAMR_BUILD_WASM_CACHE EQUAL 1) + target_link_libraries(iwasm_shared INTERFACE boringssl_crypto) + endif () +@@ -160,6 +172,7 @@ if (MINGW) + endif () + + install (TARGETS iwasm_shared LIBRARY DESTINATION lib) ++endif() + + # HEADERS + install (FILES + diff --git a/recipes/wasm-micro-runtime/all/patches/2.2.0-0001-fix-cmake.patch b/recipes/wasm-micro-runtime/all/patches/2.2.0-0001-fix-cmake.patch new file mode 100644 index 0000000000000..c386cfb73769f --- /dev/null +++ b/recipes/wasm-micro-runtime/all/patches/2.2.0-0001-fix-cmake.patch @@ -0,0 +1,55 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 40658e9..05538a2 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -122,13 +122,13 @@ set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}) + include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake) + + if (NOT WIN32) +- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security \ +- -ffunction-sections -fdata-sections \ +- -Wno-unused-parameter -Wno-pedantic \ +- -fvisibility=hidden") ++ # set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security \ ++ # -ffunction-sections -fdata-sections \ ++ # -Wno-unused-parameter -Wno-pedantic \ ++ # -fvisibility=hidden") + # Remove the extra spaces for better make log + string (REGEX REPLACE " *" " " CMAKE_C_FLAGS ${CMAKE_C_FLAGS}) +- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wformat -Wformat-security -Wno-unused") ++ # set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wformat -Wformat-security -Wno-unused") + endif() + + if (WAMR_BUILD_TARGET MATCHES "X86_.*" OR WAMR_BUILD_TARGET STREQUAL "AMD_64") +@@ -159,7 +159,14 @@ if (WAMR_BUILD_STATIC) + add_library(iwasm_static STATIC ${WAMR_RUNTIME_LIB_SOURCE}) + set_target_properties (iwasm_static PROPERTIES OUTPUT_NAME vmlib) + target_include_directories(iwasm_static INTERFACE ${WAMR_ROOT_DIR}/core/iwasm/include) +- target_link_libraries (iwasm_static INTERFACE ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} -lm -ldl ${CMAKE_THREAD_LIBS_INIT}) ++ target_link_libraries (iwasm_static INTERFACE ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} ${CMAKE_THREAD_LIBS_INIT}) ++ target_link_libraries (iwasm_static INTERFACE ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} ${CMAKE_THREAD_LIBS_INIT}) ++ if(NOT MSVC) ++ target_link_libraries (iwasm_static INTERFACE -lm -ldl) ++ endif() ++ if(WIN32) ++ target_link_libraries (iwasm_static PUBLIC ntdll) ++ endif() + if (WAMR_BUILD_WASM_CACHE EQUAL 1) + target_link_libraries(iwasm_static INTERFACE boringssl_crypto) + endif () +@@ -180,7 +187,14 @@ if (WAMR_BUILD_SHARED) + add_library (iwasm_shared SHARED ${WAMR_RUNTIME_LIB_SOURCE}) + set_target_properties (iwasm_shared PROPERTIES OUTPUT_NAME iwasm) + target_include_directories(iwasm_shared INTERFACE ${WAMR_ROOT_DIR}/core/iwasm/include) +- target_link_libraries (iwasm_shared INTERFACE ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} -lm -ldl ${CMAKE_THREAD_LIBS_INIT}) ++ target_link_libraries (iwasm_shared INTERFACE ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} ${CMAKE_THREAD_LIBS_INIT}) ++ target_link_libraries (iwasm_shared INTERFACE ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} ${CMAKE_THREAD_LIBS_INIT}) ++ if(NOT MSVC) ++ target_link_libraries (iwasm_shared INTERFACE -lm -ldl) ++ endif() ++ if(WIN32) ++ target_link_libraries (iwasm_shared PUBLIC ntdll) ++ endif() + if (WAMR_BUILD_WASM_CACHE EQUAL 1) + target_link_libraries(iwasm_shared INTERFACE boringssl_crypto) + endif () diff --git a/recipes/wasm-micro-runtime/all/test_package/CMakeLists.txt b/recipes/wasm-micro-runtime/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..3cf7f573410ea --- /dev/null +++ b/recipes/wasm-micro-runtime/all/test_package/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(wasm-micro-runtime REQUIRED CONFIG) + +if(WAMR_NO_INTERP) +add_executable(${PROJECT_NAME} test_package_no_interp.cpp) +else() +add_executable(${PROJECT_NAME} test_package.cpp) +endif() + +target_link_libraries(${PROJECT_NAME} PRIVATE wasm-micro-runtime::wasm-micro-runtime) diff --git a/recipes/wasm-micro-runtime/all/test_package/conanfile.py b/recipes/wasm-micro-runtime/all/test_package/conanfile.py new file mode 100644 index 0000000000000..d56a8c50a887a --- /dev/null +++ b/recipes/wasm-micro-runtime/all/test_package/conanfile.py @@ -0,0 +1,33 @@ +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", "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) + if not self.dependencies["wasm-micro-runtime"].options.with_interp: + tc.variables["WAMR_NO_INTERP"] = True + 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.bindir, "test_package") + wat_path = os.path.join(self.source_folder, "test_package.wasm") + self.run(f"{bin_path} {wat_path}", env="conanrun") diff --git a/recipes/wasm-micro-runtime/all/test_package/test_package.cpp b/recipes/wasm-micro-runtime/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..6e413e2d402fc --- /dev/null +++ b/recipes/wasm-micro-runtime/all/test_package/test_package.cpp @@ -0,0 +1,65 @@ +#include +#include +#include +#include + +#include "wasm_c_api.h" + +#define own + +int main(int argc, const char* argv[]) { + // Initialize. + printf("Initializing...\n"); + wasm_engine_t* engine = wasm_engine_new(); + wasm_store_t* store = wasm_store_new(engine); + + // Load binary. + printf("Loading binary...\n"); + FILE* file = fopen(argv[1], "rb"); + if (!file) { + printf("> Error loading module!\n"); + return 1; + } + + int ret = fseek(file, 0L, SEEK_END); + if (ret == -1) { + printf("> Error loading module!\n"); + fclose(file); + return 1; + } + + long file_size = ftell(file); + if (file_size == -1) { + printf("> Error loading module!\n"); + fclose(file); + return 1; + } + + ret = fseek(file, 0L, SEEK_SET); + if (ret == -1) { + printf("> Error loading module!\n"); + fclose(file); + return 1; + } + + wasm_byte_vec_t binary; + wasm_byte_vec_new_uninitialized(&binary, file_size); + if (fread(binary.data, file_size, 1, file) != 1) { + printf("> Error loading module!\n"); + fclose(file); + return 1; + } + fclose(file); + + // Compile. + printf("Compiling module...\n"); + own wasm_module_t* module = wasm_module_new(store, &binary); + if (!module) { + printf("> Error compiling module!\n"); + return 1; + } + + wasm_byte_vec_delete(&binary); + + return 0; +} diff --git a/recipes/wasm-micro-runtime/all/test_package/test_package.wasm b/recipes/wasm-micro-runtime/all/test_package/test_package.wasm new file mode 100644 index 0000000000000..18ac7653b0301 Binary files /dev/null and b/recipes/wasm-micro-runtime/all/test_package/test_package.wasm differ diff --git a/recipes/wasm-micro-runtime/all/test_package/test_package_no_interp.cpp b/recipes/wasm-micro-runtime/all/test_package/test_package_no_interp.cpp new file mode 100644 index 0000000000000..8e9d61bfcf7f1 --- /dev/null +++ b/recipes/wasm-micro-runtime/all/test_package/test_package_no_interp.cpp @@ -0,0 +1,64 @@ +#include +#include +#include +#include + +#include "wasm_c_api.h" + +#define own + +// A function to be called from Wasm code. +own wasm_trap_t* hello_callback( + const wasm_val_vec_t* args, wasm_val_vec_t* results +) { + printf("Calling back...\n"); + printf("> Hello World!\n"); + return NULL; +} + +int main(int argc, const char* argv[]) { + // Initialize. + printf("Initializing...\n"); + wasm_engine_t* engine = wasm_engine_new(); + wasm_store_t* store = wasm_store_new(engine); + + // Load binary. + printf("Loading binary...\n"); + FILE* file = fopen(argv[1], "rb"); + if (!file) { + printf("> Error loading module!\n"); + return 1; + } + + long file_size = 10240; + + wasm_byte_vec_t binary; + wasm_byte_vec_new_uninitialized(&binary, file_size); + + // Compile. + printf("Compiling module...\n"); + own wasm_module_t* module = wasm_module_new(store, &binary); + + wasm_byte_vec_delete(&binary); + + // Create external print functions. + printf("Creating callback...\n"); + own wasm_functype_t* hello_type = wasm_functype_new_0_0(); + own wasm_func_t* hello_func = + wasm_func_new(store, hello_type, hello_callback); + + wasm_functype_delete(hello_type); + + wasm_func_delete(hello_func); + + wasm_module_delete(module); + + // Shut down. + printf("Shutting down...\n"); + wasm_store_delete(store); + wasm_engine_delete(engine); + + // All done. + printf("Done.\n"); + return 0; +} diff --git a/recipes/wasm-micro-runtime/config.yml b/recipes/wasm-micro-runtime/config.yml new file mode 100644 index 0000000000000..542597ea3f803 --- /dev/null +++ b/recipes/wasm-micro-runtime/config.yml @@ -0,0 +1,9 @@ +versions: + "2.2.0": + folder: all + "1.3.3": + folder: all + "1.2.3": + folder: all + "1.2.2": + folder: all diff --git a/recipes/wasmedge/all/conandata.yml b/recipes/wasmedge/all/conandata.yml index 363797364db78..9dcc47a29915a 100644 --- a/recipes/wasmedge/all/conandata.yml +++ b/recipes/wasmedge/all/conandata.yml @@ -1,4 +1,127 @@ sources: + "0.14.1": + Windows: + "x86_64": + Visual Studio: + - url: "https://github.com/WasmEdge/WasmEdge/releases/download/0.14.1/WasmEdge-0.14.1-windows.zip" + sha256: "cc38f2be3000743becaeb8b00871dcd04b0a0a47b8329735a71615ee06cf1d7b" + - url: "https://raw.githubusercontent.com/WasmEdge/WasmEdge/0.14.1/LICENSE" + sha256: "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" + Linux: + "x86_64": + "gcc": + - url: "https://github.com/WasmEdge/WasmEdge/releases/download/0.14.1/WasmEdge-0.14.1-manylinux2014_x86_64.tar.gz" + sha256: "a82f9fb01a6a6f1dfbd1cb069dc96d116f22c15cdb01207a5d0e65096055d092" + - url: "https://raw.githubusercontent.com/WasmEdge/WasmEdge/0.14.1/LICENSE" + sha256: "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" + "armv8": + "gcc": + - url: "https://github.com/WasmEdge/WasmEdge/releases/download/0.14.1/WasmEdge-0.14.1-manylinux2014_aarch64.tar.gz" + sha256: "d5ac5c2405ff8a878558379740498e5fe4b126fe746eac585f7efa9bb7f32e28" + - 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.14.1/WasmEdge-0.14.1-darwin_x86_64.tar.gz" + sha256: "96d01cf083d4f7e1c55683dc4b60acca6d8517ad901e2d7b4b5d64ca9a6532e0" + - url: "https://raw.githubusercontent.com/WasmEdge/WasmEdge/0.14.1/LICENSE" + sha256: "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" + "armv8": + "gcc": + - url: "https://github.com/WasmEdge/WasmEdge/releases/download/0.14.1/WasmEdge-0.14.1-darwin_arm64.tar.gz" + sha256: "38dd10f4e78d339be91e0c3501055d4dad9bf08c3dc648e07a30df9bea2d6c4a" + - url: "https://raw.githubusercontent.com/WasmEdge/WasmEdge/0.14.1/LICENSE" + sha256: "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" + Android: + "armv8": + "gcc": + - url: "https://github.com/WasmEdge/WasmEdge/releases/download/0.14.1/WasmEdge-0.14.1-android_aarch64.tar.gz" + sha256: "8d979abc7777d01a4ab99e20c1052ba34985e795b6dc84101a7958fb171767a6" + - url: "https://raw.githubusercontent.com/WasmEdge/WasmEdge/0.14.0/LICENSE" + sha256: "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" + "0.14.0": + Windows: + "x86_64": + Visual Studio: + - url: "https://github.com/WasmEdge/WasmEdge/releases/download/0.14.0/WasmEdge-0.14.0-windows.zip" + sha256: "cd0dd57df8f3e8cb7ef0e57d2d09f1740093c2179fad933b270979bafe8295a1" + - url: "https://raw.githubusercontent.com/WasmEdge/WasmEdge/0.14.0/LICENSE" + sha256: "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" + Linux: + "x86_64": + "gcc": + - url: "https://github.com/WasmEdge/WasmEdge/releases/download/0.14.0/WasmEdge-0.14.0-manylinux2014_x86_64.tar.gz" + sha256: "73b3892f94c143dc09d53415c6848bb8e87206a1f614fd0edfc89957a0f1b027" + - url: "https://raw.githubusercontent.com/WasmEdge/WasmEdge/0.14.0/LICENSE" + sha256: "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" + "armv8": + "gcc": + - url: "https://github.com/WasmEdge/WasmEdge/releases/download/0.14.0/WasmEdge-0.14.0-manylinux2014_aarch64.tar.gz" + sha256: "6136c42066cdd9a96170285af2613dc00f262f5758a03d7afb3ab12a36363c79" + - 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.14.0/WasmEdge-0.14.0-darwin_x86_64.tar.gz" + sha256: "03c5d77be63ecad54ed33a1885f170bc854246ed8f9ae8e366b114bc8c0c2422" + - url: "https://raw.githubusercontent.com/WasmEdge/WasmEdge/0.14.0/LICENSE" + sha256: "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" + "armv8": + "gcc": + - url: "https://github.com/WasmEdge/WasmEdge/releases/download/0.14.0/WasmEdge-0.14.0-darwin_arm64.tar.gz" + sha256: "4f2f34545a97768e28700099ac9cbb18e7b434779d237de860324de400922546" + - url: "https://raw.githubusercontent.com/WasmEdge/WasmEdge/0.14.0/LICENSE" + sha256: "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" + Android: + "armv8": + "gcc": + - url: "https://github.com/WasmEdge/WasmEdge/releases/download/0.14.0/WasmEdge-0.14.0-android_aarch64.tar.gz" + sha256: "58b834db8814b27051494df60588dc56f3a5d740604e92c1eac9e5021b311c03" + - url: "https://raw.githubusercontent.com/WasmEdge/WasmEdge/0.14.0/LICENSE" + sha256: "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" + "0.13.5": + Windows: + "x86_64": + Visual Studio: + - url: "https://github.com/WasmEdge/WasmEdge/releases/download/0.13.5/WasmEdge-0.13.5-windows.zip" + sha256: "db533289ba26ec557b5193593c9ed03db75be3bc7aa737e2caa5b56b8eef888a" + - url: "https://raw.githubusercontent.com/WasmEdge/WasmEdge/0.13.5/LICENSE" + sha256: "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" + Linux: + "x86_64": + "gcc": + - url: "https://github.com/WasmEdge/WasmEdge/releases/download/0.13.5/WasmEdge-0.13.5-manylinux2014_x86_64.tar.gz" + sha256: "3686e0226871bf17b62ec57e1c15778c2947834b90af0dfad14f2e0202bf9284" + - url: "https://raw.githubusercontent.com/WasmEdge/WasmEdge/0.13.5/LICENSE" + sha256: "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" + "armv8": + "gcc": + - url: "https://github.com/WasmEdge/WasmEdge/releases/download/0.13.5/WasmEdge-0.13.5-manylinux2014_aarch64.tar.gz" + sha256: "472de88e0257c539c120b33fdd1805e1e95063121acc2df1d5626e4676b93529" + - 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.13.5/WasmEdge-0.13.5-darwin_x86_64.tar.gz" + sha256: "b7fdfaf59805951241f47690917b501ddfa06d9b6f7e0262e44e784efe4a7b33" + - url: "https://raw.githubusercontent.com/WasmEdge/WasmEdge/0.13.5/LICENSE" + sha256: "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" + "armv8": + "gcc": + - url: "https://github.com/WasmEdge/WasmEdge/releases/download/0.13.5/WasmEdge-0.13.5-darwin_arm64.tar.gz" + sha256: "acc93721210294ced0887352f360e42e46dcc05332e6dd78c1452fb3a35d5255" + - url: "https://raw.githubusercontent.com/WasmEdge/WasmEdge/0.13.5/LICENSE" + sha256: "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" + Android: + "armv8": + "gcc": + - url: "https://github.com/WasmEdge/WasmEdge/releases/download/0.13.5/WasmEdge-0.13.5-android_aarch64.tar.gz" + sha256: "59a0d68a0c7368b51cc65cb5a44a68037d79fd449883ef42792178d57c8784a8" + - url: "https://raw.githubusercontent.com/WasmEdge/WasmEdge/0.13.5/LICENSE" + sha256: "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" "0.11.2": Windows: "x86_64": diff --git a/recipes/wasmedge/all/conanfile.py b/recipes/wasmedge/all/conanfile.py index 22d9509121432..b520078c1a85d 100644 --- a/recipes/wasmedge/all/conanfile.py +++ b/recipes/wasmedge/all/conanfile.py @@ -5,7 +5,7 @@ import os -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.53.0" class WasmedgeConan(ConanFile): name = "wasmedge" @@ -16,18 +16,19 @@ class WasmedgeConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/WasmEdge/WasmEdge/" topics = ("webassembly", "wasm", "wasi", "emscripten") + package_type = "shared-library" settings = "os", "arch", "compiler", "build_type" @property def _compiler_alias(self): return { - "Visual Studio": "Visual Studio", - "msvc": "Visual Studio", - }.get(str(self.settings.compiler), "gcc") + "Visual Studio": "msvc", + "msvc": "msvc", + }.get(str(self.info.settings.compiler), "gcc") def configure(self): - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.settings.compiler.rm_safe("libcxx") + self.settings.compiler.rm_safe("cppstd") def validate(self): try: @@ -39,7 +40,7 @@ def package_id(self): del self.info.settings.compiler.version self.info.settings.compiler = self._compiler_alias - def source(self): + def build(self): # 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) diff --git a/recipes/wasmedge/all/test_package/CMakeLists.txt b/recipes/wasmedge/all/test_package/CMakeLists.txt index a433b073bf6ea..d5682fcb1d31a 100644 --- a/recipes/wasmedge/all/test_package/CMakeLists.txt +++ b/recipes/wasmedge/all/test_package/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.8) -project(test_package C) +project(test_package LANGUAGES C) find_package(wasmedge REQUIRED CONFIG) diff --git a/recipes/wasmedge/config.yml b/recipes/wasmedge/config.yml index 26c6ed136a298..3eb29fd257a6f 100644 --- a/recipes/wasmedge/config.yml +++ b/recipes/wasmedge/config.yml @@ -1,4 +1,10 @@ versions: + "0.14.1": + folder: "all" + "0.14.0": + folder: "all" + "0.13.5": + folder: "all" "0.11.2": folder: "all" "0.11.1": diff --git a/recipes/wasmer/all/conandata.yml b/recipes/wasmer/all/conandata.yml index 7b9c9649cb8d8..0ac30b85d7ed6 100644 --- a/recipes/wasmer/all/conandata.yml +++ b/recipes/wasmer/all/conandata.yml @@ -1,4 +1,314 @@ sources: + "5.0.0": + Windows: + "x86_64": + "Visual Studio": + url: "https://github.com/wasmerio/wasmer/releases/download/v5.0.0/wasmer-windows-amd64.tar.gz" + sha256: "1da23b195fb44582f9ff798e5ff23b064ce94d918ff850e54e612c207c08caa6" + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v5.0.0/wasmer-windows-gnu64.tar.gz" + sha256: "9a9edeb9909b5314fd94a3afabf83d84ed0eb0ff52b29d3b425118b0df7c65c4" + Linux: + "x86_64": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v5.0.0/wasmer-linux-amd64.tar.gz" + sha256: "3293457cd2c7cdc9cdebd684c7b9c22ece90e05ea1b8f2a0a97ce9e2af560bcb" + "armv8": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v5.0.0/wasmer-linux-aarch64.tar.gz" + sha256: "99c5fbc2c448b089bb6195f0242ecca2a8ecc2bfb723400080ae653de59e34c1" + "riscv64": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v5.0.0/wasmer-linux-riscv64.tar.gz" + sha256: "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + Macos: + "x86_64": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v5.0.0/wasmer-darwin-amd64.tar.gz" + sha256: "b41d6120380add11ada9f4cbe8811bb3f051d0c00600bb2c20f2cfb10f99b4f9" + "armv8": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v5.0.0/wasmer-darwin-arm64.tar.gz" + sha256: "b114eb2b42e3140a74f212d58e3b622e395bd83dad97466e1aa191d2d4af20ab" + "4.4.0": + Windows: + "x86_64": + "Visual Studio": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.4.0/wasmer-windows-amd64.tar.gz" + sha256: "15565759624f6847135ea8f1d2ca94bc3c8971a32443df39ad0e5b04afc659b9" + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.4.0/wasmer-windows-gnu64.tar.gz" + sha256: "e4c275e52d74343abf03d231684d8e57f5d418eb28494972c7f311028cb4e433" + Linux: + "x86_64": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.4.0/wasmer-linux-amd64.tar.gz" + sha256: "5d29f37c52089c4f8c0303df9ba82ab03fe5cc2b6cbafa25e9535347f26ce6a5" + "armv8": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.4.0/wasmer-linux-aarch64.tar.gz" + sha256: "1efa2f6953248920cce1b27783ee3174bedcdb88b2e2bdca012446ad8a966261" + "riscv64": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.4.0/wasmer-linux-riscv64.tar.gz" + sha256: "34e4350c2bca7a542d7a41d82f8104998b45bdf1dbafae22dbb0b4e5ca83bf4e" + Macos: + "x86_64": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.4.0/wasmer-darwin-amd64.tar.gz" + sha256: "dd7a913e40e8d6a4051bf7430d5df15a818df0da6962ffdeb1a1c87860f5083f" + "armv8": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.4.0/wasmer-darwin-arm64.tar.gz" + sha256: "c703e3a94e5010e68abdedf832175c64388e749fdbe31b532a5bdc8cf8ab628e" + "4.3.3": + Windows: + "x86_64": + "Visual Studio": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.3.3/wasmer-windows-amd64.tar.gz" + sha256: "63239253e7dc5373a421941aaa9ac8ee2ddb2f34e3d94b12ea739319d7929bd4" + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.3.3/wasmer-windows-gnu64.tar.gz" + sha256: "6180ddaed4b758ddc563be493001204f067667406994b4a05bfeb8f7948d9898" + Linux: + "x86_64": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.3.3/wasmer-linux-amd64.tar.gz" + sha256: "817ce5b0ba0a97989fe390b16e76352632a3185ebd0ef3e5bfbaf0dbda73cd13" + "armv8": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.3.3/wasmer-linux-aarch64.tar.gz" + sha256: "d15b8170911b1dca69923844bd31f2ea8a73d6ac9ebe7de0d5a30f0cab4cc1b4" + "riscv64": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.3.3/wasmer-linux-riscv64.tar.gz" + sha256: "b0ddc5ed34506f2c2674d3d09996b4c3da500644bc65880e8eede0a149dfaeae" + Macos: + "x86_64": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.3.3/wasmer-darwin-amd64.tar.gz" + sha256: "cf49f6d421b0e8f00f3c4e96ac3ed1ee674b64e0e28f503ff46938cbf831c303" + "armv8": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.3.3/wasmer-darwin-arm64.tar.gz" + sha256: "4b6bc3fc10e22c5347e240df6be7d2ac8db4c930768d7ed7a3d99b086cad4ba0" + "4.3.0": + Windows: + "x86_64": + "Visual Studio": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.3.0/wasmer-windows-amd64.tar.gz" + sha256: "dc58db29591c3088da053336ddf52ab3f5c870daa0a6901e045a7f1a78b3358e" + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.3.0/wasmer-windows-gnu64.tar.gz" + sha256: "8d903af970293ab7987df71f31651e8a59911299c47c8062314dda28f8562556" + Linux: + "x86_64": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.3.0/wasmer-linux-amd64.tar.gz" + sha256: "664c0fd253e86e88afd3977c5a09a1d8162b1e80ce1421da92a310fccfc14243" + "armv8": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.3.0/wasmer-linux-aarch64.tar.gz" + sha256: "e4693e54e40c44957de78328b7711d2822a7e30c88119a68b1a2bd99fdd0a599" + "riscv64": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.3.0/wasmer-linux-riscv64.tar.gz" + sha256: "d4ba4ce197f7dbb8e900e6f515143c73934a91feec556bd2f928ba872ddd60b2" + Macos: + "x86_64": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.3.0/wasmer-darwin-amd64.tar.gz" + sha256: "7e58b848649ceba2f4d2d65ea34c72bf02f463327efc1549f027feb344525c69" + "armv8": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.3.0/wasmer-darwin-arm64.tar.gz" + sha256: "ddf4079e3e0432bb1c856720cef8266494cfae2f3b294dbaf18c9853d32fbc1f" + "4.2.7": + Windows: + "x86_64": + "Visual Studio": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.2.7/wasmer-windows-amd64.tar.gz" + sha256: "5e429450a997e9a23b4efb7ad1bfb57a8c4a77436ce2a0c7c160c26576a42562" + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.2.7/wasmer-windows-gnu64.tar.gz" + sha256: "82061836fe79e2d52710ebb48fdffbd82910663ac1bae5bb13e72e6e1a7f0a46" + Linux: + "x86_64": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.2.7/wasmer-linux-amd64.tar.gz" + sha256: "7fb9c34c42d31cd7ffed956d0e98d620b5fde0c5fccf9af5e58b9177664e25b1" + "armv8": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.2.7/wasmer-linux-aarch64.tar.gz" + sha256: "5915f617f966cdedd0fe18f26237ef04701c6475c34e5b1cd2ffc0f6e84ffd3a" + "riscv64": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.2.7/wasmer-linux-riscv64.tar.gz" + sha256: "bdb480c30ef07640edb63b59b84a5508e802571d8eab74d7a40ff1164e8b7151" + Macos: + "x86_64": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.2.7/wasmer-darwin-amd64.tar.gz" + sha256: "29748cdf51ecd11d10cc819bc568820e6267d658d495f08f4af7b90cf3bd0a35" + "armv8": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.2.7/wasmer-darwin-arm64.tar.gz" + sha256: "65de621cd931acee76e09505bda28d71b6d955a6b33481ae1251280f0f26ebfc" + "4.2.5": + Windows: + "x86_64": + "Visual Studio": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.2.5/wasmer-windows-amd64.tar.gz" + sha256: "3811f1637c8f32336aca159e63a0a4e09b3c7f713da3f5a58b0b3326e0ea941c" + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.2.5/wasmer-windows-gnu64.tar.gz" + sha256: "8176ae9a3d12d619aa4ef9a56ce6f669af11c4b33a900a73739f8586d3291981" + Linux: + "x86_64": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.2.5/wasmer-linux-amd64.tar.gz" + sha256: "9a21c3a60c2c1f9cdebe91ec56df2d2d753b15d9b7e0be1a67e7a29080ca75f9" + "armv8": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.2.5/wasmer-linux-aarch64.tar.gz" + sha256: "b29117eebce282b63d49de6bb11920da439d68937bd6bc69575fb8f5f29ef293" + "riscv64": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.2.5/wasmer-linux-riscv64.tar.gz" + sha256: "d2002afdce6ecdcd0e31efb47b50a8c195a12ab6b5127520870ece3a1338e889" + Macos: + "x86_64": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.2.5/wasmer-darwin-amd64.tar.gz" + sha256: "77d7baa0e54cbd310c53d93128240a098bf00d787bb7bb9b9661a0a5b09f1779" + "armv8": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.2.5/wasmer-darwin-arm64.tar.gz" + sha256: "0247863cc1546171305d556d69bf7fbad12a170b5a608ff8c9c01480a4af1ee7" + "4.2.0": + Windows: + "x86_64": + "Visual Studio": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.2.0/wasmer-windows-amd64.tar.gz" + sha256: "f2eeff46e6974f06d1ee3dc64515a2fbd9f0897575ce7e8ed5c6e3b4353ded24" + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.2.0/wasmer-windows-gnu64.tar.gz" + sha256: "13374b1d781a2aec2cb981f8c38ad0935476c7d508b993bc48f684a13e283943" + Linux: + "x86_64": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.2.0/wasmer-linux-amd64.tar.gz" + sha256: "3ea947b1accb6247aa90d914331132827c49a422d2dba8459e2f0cf02c1acf80" + "armv8": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.2.0/wasmer-linux-aarch64.tar.gz" + sha256: "681fe6ad3e7f139d3d2ed8cfbf6ceb4d54098c32da9663bbf849e6429d6e8f1c" + "riscv64": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.2.0/wasmer-linux-riscv64.tar.gz" + sha256: "3b2dd3172ffd0084367a07565259d76c99099f3c1b8467c5d7c2a6d5d158de64" + Macos: + "x86_64": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.2.0/wasmer-darwin-amd64.tar.gz" + sha256: "4d629eafe6d7249b276691cb0f834d7d00cf89953700628abe06a224f76b7d79" + "armv8": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.2.0/wasmer-darwin-arm64.tar.gz" + sha256: "ab928c3717c2597f484868d5d97baabe939bffeb1ba38f348bcda9c828022069" + "4.1.1": + Windows: + "x86_64": + "Visual Studio": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.1.1/wasmer-windows-amd64.tar.gz" + sha256: "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.1.1/wasmer-windows-gnu64.tar.gz" + sha256: "47fb2d9563995fe180fc2a56255f8eb2ffe19de6ee9d512920a7823bc12e66c5" + Linux: + "x86_64": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.1.1/wasmer-linux-amd64.tar.gz" + sha256: "778e87bb62748f2899bb06fe1d07ca3038705b996c93e0c28db12ccc032c0c4e" + "armv8": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.1.1/wasmer-linux-aarch64.tar.gz" + sha256: "74cc40fcfe4108c0240137a47704d4f6ade8895c70da25358b471fe32ce47a50" + "riscv64": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.1.1/wasmer-linux-riscv64.tar.gz" + sha256: "2ee1ee5759133802771018fccd1a4b39a36a1b7ed2bf0e6f38e83266ba5c8bdb" + Macos: + "x86_64": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.1.1/wasmer-darwin-amd64.tar.gz" + sha256: "113f58b1560c21607f0011ec6a835bdf109efc2f3be6f200ff8bc8b9591d021e" + "armv8": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.1.1/wasmer-darwin-arm64.tar.gz" + sha256: "5eaf3a3b5a2607dd29f70bf21008140a079662bddf42e75e97da71355a29d961" + "4.0.0": + Windows: + "x86_64": + "Visual Studio": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.0.0/wasmer-windows-amd64.tar.gz" + sha256: "1ecbff4959fda10b316bdda3ea2230dcfaafabd4372125829e5dfaf01a75b1b6" + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.0.0/wasmer-windows-gnu64.tar.gz" + sha256: "80a2d653254c59791faffa35c15f264c6e9fc5725ba0733b62ee1e0186f53294" + Linux: + "x86_64": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.0.0/wasmer-linux-amd64.tar.gz" + sha256: "6d905e328a155ef0059013d7315407bac13ea2a0cf9257e6cc957b96556df05e" + "armv8": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.0.0/wasmer-linux-aarch64.tar.gz" + sha256: "20f98f4be160e73e387444437f87aeaa276b46c1efee12729ab1108ebeda1d16" + "riscv64": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.0.0/wasmer-linux-riscv64.tar.gz" + sha256: "87ca77de67bd60a8ddc4c9fa9d9aaa647961826564051a40169cb0dddc2362ad" + Macos: + "x86_64": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.0.0/wasmer-darwin-amd64.tar.gz" + sha256: "435669d2bacf381f7c3c849a231825fb2d2126b0d3e90cb1298cc7a76d770184" + "armv8": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v4.0.0/wasmer-darwin-arm64.tar.gz" + sha256: "0505c8423830fb0ce1634a27ef52dfacb3d4bc711f9354535e4e874c044730f4" + "3.2.1": + Windows: + "x86_64": + "Visual Studio": + url: "https://github.com/wasmerio/wasmer/releases/download/v3.2.1/wasmer-windows-amd64.tar.gz" + sha256: "e5500d405de2f43ed00d4a3341e5dba463abc15ebbb2aac832aca9e18cbe090d" + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v3.2.1/wasmer-windows-gnu64.tar.gz" + sha256: "f16242f3ddca3c8a1294bb8feb34a2447f8d19f12e095fac7e7eb710a1f8ac9e" + Linux: + "x86_64": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v3.2.1/wasmer-linux-amd64.tar.gz" + sha256: "43e8c84460da374d78e9c527da10145143d8bd46e49e93e18efa27fed0c42683" + "armv8": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v3.2.1/wasmer-linux-aarch64.tar.gz" + sha256: "f1847405588339b4327ef9d68c266355b04d3d18d6fc2c9fdfb2c9f576f4d758" + "riscv64": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v3.2.1/wasmer-linux-riscv64.tar.gz" + sha256: "0408442c1da0d3bf1f83014adfe58d24a9ab5d3268db5a8a2dc05026f3a0650c" + Macos: + "x86_64": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v3.2.1/wasmer-darwin-amd64.tar.gz" + sha256: "c1bd3bf73cb13c0f8ba7015356964414979b2e145168eef4b81a921ff18f582c" + "armv8": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v3.2.1/wasmer-darwin-arm64.tar.gz" + sha256: "9e5360b4a494324824308891a7027bfd19199c53449a649f97a5db6e7ae028fb" "3.1.0": Windows: "x86_64": diff --git a/recipes/wasmer/all/conanfile.py b/recipes/wasmer/all/conanfile.py index 9db5f12cf18fe..06ec3aa8052ea 100644 --- a/recipes/wasmer/all/conanfile.py +++ b/recipes/wasmer/all/conanfile.py @@ -1,9 +1,10 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.microsoft import is_msvc +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime from conan.tools.files import get, copy, replace_in_file from conan.tools.layout import basic_layout from conan.tools.scm import Version +from conan.tools.apple import is_apple_os import os required_conan_version = ">=1.53.0" @@ -15,7 +16,8 @@ class WasmerConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/wasmerio/wasmer/" topics = ("webassembly", "wasm", "wasi", "emscripten") - settings = "os", "arch", "compiler" + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], } @@ -26,9 +28,9 @@ class WasmerConan(ConanFile): @property def _compiler_alias(self): return { - "Visual Studio": "Visual Studio", - "msvc": "Visual Studio", - }.get(str(self.settings.compiler), "gcc") + "Visual Studio": "msvc", + "msvc": "msvc", + }.get(str(self.info.settings.compiler), "gcc") def configure(self): self.settings.rm_safe("compiler.libcxx") @@ -46,40 +48,40 @@ def validate(self): raise ConanInvalidConfiguration("Binaries for this combination of version/os/arch/compiler are not available") 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)") + raise ConanInvalidConfiguration(f"Shared Windows build of {self.ref} are non-working atm (no import libraries are available)") 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") + raise ConanInvalidConfiguration(f"Shared Linux build of {self.ref} are not working. It requires glibc >= 2.25") - 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") + if is_msvc(self) and not self.options.shared and not is_msvc_static_runtime(self): + raise ConanInvalidConfiguration(f"{self.ref} is only available with compiler.runtime=static") def package_id(self): del self.info.settings.compiler.version self.info.settings.compiler = self._compiler_alias - def source(self): + def build(self): get( - self, - **self.conan_data["sources"][self.version][str(self.settings.os)][str(self.settings.arch)][self._compiler_alias], destination=self.source_folder + self, + **self.conan_data["sources"][self.version][str(self.settings.os)][str(self.settings.arch)][self._compiler_alias] ) def package(self): - copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.build_folder) - self.copy("*.h", src=os.path.join(self.source_folder, "include"), dst="include", keep_path=False) + copy(self, pattern="*.h", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self.build_folder, "include")) - srclibdir = os.path.join(self.source_folder, "lib") + srclibdir = os.path.join(self.build_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=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) + copy(self, pattern="wasmer.dll.lib", dst=dstlibdir, src=srclibdir) # FIXME: not available (yet) + copy(self, pattern="wasmer.dll", dst=dstbindir, src=srclibdir) + copy(self, pattern="libwasmer.so*", dst=dstlibdir, src=srclibdir) + copy(self, pattern="libwasmer.dylib", dst=dstlibdir, src=srclibdir) else: - self.copy("wasmer.lib", src=srclibdir, dst=dstlibdir, keep_path=False) - self.copy("libwasmer.a", src=srclibdir, dst=dstlibdir, keep_path=False) + copy(self, pattern="wasmer.lib", dst=dstlibdir, src=srclibdir) + copy(self, pattern="libwasmer.a", dst=dstlibdir, src=srclibdir) replace_in_file(self, os.path.join(self.package_folder, "include", "wasm.h"), "__declspec(dllimport)", "") @@ -92,3 +94,8 @@ def package_info(self): self.cpp_info.system_libs.append("rt") elif self.settings.os == "Windows": self.cpp_info.system_libs = ["bcrypt", "userenv", "ws2_32"] + elif is_apple_os(self): + if Version(self.version) >= "3.2.0": + self.cpp_info.frameworks += ["Security"] + if Version(self.version) >= "4.2.5": + self.cpp_info.frameworks += ["CoreFoundation", "SystemConfiguration"] diff --git a/recipes/wasmer/config.yml b/recipes/wasmer/config.yml index e0d445f36bd33..57768d8568a22 100644 --- a/recipes/wasmer/config.yml +++ b/recipes/wasmer/config.yml @@ -1,4 +1,24 @@ versions: + "5.0.0": + folder: "all" + "4.4.0": + folder: "all" + "4.3.3": + folder: "all" + "4.3.0": + folder: "all" + "4.2.7": + folder: "all" + "4.2.5": + folder: "all" + "4.2.0": + folder: "all" + "4.1.1": + folder: "all" + "4.0.0": + folder: "all" + "3.2.1": + folder: "all" "3.1.0": folder: "all" "3.0.2": diff --git a/recipes/wasmtime-cpp/all/conandata.yml b/recipes/wasmtime-cpp/all/conandata.yml index 5cdf05e0bfef2..35283cdf993b9 100644 --- a/recipes/wasmtime-cpp/all/conandata.yml +++ b/recipes/wasmtime-cpp/all/conandata.yml @@ -1,4 +1,19 @@ sources: + "18.0.0": + url: "https://github.com/bytecodealliance/wasmtime-cpp/archive/v18.0.0.tar.gz" + sha256: "94478a9465c6f766ebd7999438a89392dcb30f9fe10f772c8669dcd0b7ffbf86" + "9.0.0": + url: "https://github.com/bytecodealliance/wasmtime-cpp/archive/v9.0.0.tar.gz" + sha256: "0ff8242a9dcbe43eb38c6a3e02be40ed585e6b88efd89092bf1b5318cb8fece1" + "7.0.0": + url: "https://github.com/bytecodealliance/wasmtime-cpp/archive/v7.0.0.tar.gz" + sha256: "967df644901d9ade1568a9dcfd5f30a63ba44f8125a399842d192e258dbb7684" + "6.0.0": + url: "https://github.com/bytecodealliance/wasmtime-cpp/archive/v6.0.0.tar.gz" + sha256: "60907d4fcdb3dfbd3e36f75bb17b050662a1fc574c85b7341371426c372e75b4" + "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" @@ -23,6 +38,3 @@ sources: "0.35.0": url: "https://github.com/bytecodealliance/wasmtime-cpp/archive/refs/tags/v0.35.0.tar.gz" sha256: "af14d8f8f2922788d3d5e533c82b5ac86637e318c9a2fd2dc4fc42a147f89831" - "0.34.0": - url: "https://github.com/bytecodealliance/wasmtime-cpp/archive/refs/tags/v0.34.0.tar.gz" - sha256: "275483f87dadc183ed54708ccaeb025f33c040b8b3aeff797df6f9cd99f0abd8" diff --git a/recipes/wasmtime-cpp/all/conanfile.py b/recipes/wasmtime-cpp/all/conanfile.py index 482036a9eeb0c..9e61f74387ac9 100644 --- a/recipes/wasmtime-cpp/all/conanfile.py +++ b/recipes/wasmtime-cpp/all/conanfile.py @@ -14,7 +14,8 @@ class WasmtimeCppConan(ConanFile): license = 'Apache-2.0' url = 'https://github.com/conan-io/conan-center-index' homepage = 'https://github.com/bytecodealliance/wasmtime-cpp' - topics = ("webassembly", "wasm", "wasi", "c++") + topics = ("webassembly", "wasm", "wasi", "header-only") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -27,9 +28,9 @@ def _compilers_minimum_version(self): return { "Visual Studio": "16", "msvc": "192", - "apple-clang": "12.0", - "clang": "12.0", - "gcc": "10.0" + "apple-clang": "12", + "clang": "12", + "gcc": "10" } def layout(self): @@ -41,6 +42,9 @@ def requirements(self): "0.35.0": "0.35.1", "0.39.0": "0.39.1", "1.0.0": "1.0.1", + "6.0.0": "6.0.1", + "9.0.0": "12.0.2", + "18.0.0": "18.0.3", } self.requires(f"wasmtime/{version_map.get(version, version)}") @@ -57,8 +61,7 @@ def validate(self): ) 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 package(self): copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) diff --git a/recipes/wasmtime-cpp/all/test_package/CMakeLists.txt b/recipes/wasmtime-cpp/all/test_package/CMakeLists.txt index bbc7ba2fe6340..a815c3edc0b1a 100644 --- a/recipes/wasmtime-cpp/all/test_package/CMakeLists.txt +++ b/recipes/wasmtime-cpp/all/test_package/CMakeLists.txt @@ -1,11 +1,11 @@ cmake_minimum_required(VERSION 3.8) -project(test_package CXX) +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} PRIVATE WASMTIME_EXAMPLES_PATH="${CMAKE_SOURCE_DIR}") +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_v1_package/CMakeLists.txt b/recipes/wasmtime-cpp/all/test_v1_package/CMakeLists.txt index 3a1b8cf126d6f..bc541ea90b512 100644 --- a/recipes/wasmtime-cpp/all/test_v1_package/CMakeLists.txt +++ b/recipes/wasmtime-cpp/all/test_v1_package/CMakeLists.txt @@ -1,13 +1,9 @@ cmake_minimum_required(VERSION 3.8) -project(test_package CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(wasmtime-cpp REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE wasmtime-cpp::wasmtime-cpp) -target_compile_definitions(${PROJECT_NAME} PRIVATE WASMTIME_EXAMPLES_PATH="${CMAKE_SOURCE_DIR}/../test_package") -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/wasmtime-cpp/all/test_v1_package/conanfile.py b/recipes/wasmtime-cpp/all/test_v1_package/conanfile.py index c492184eec19c..5a05af3c2dfd2 100644 --- a/recipes/wasmtime-cpp/all/test_v1_package/conanfile.py +++ b/recipes/wasmtime-cpp/all/test_v1_package/conanfile.py @@ -3,7 +3,6 @@ import os -# legacy validation with Conan 1.x class TestPackageV1Conan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "cmake", "cmake_find_package_multi" diff --git a/recipes/wasmtime-cpp/config.yml b/recipes/wasmtime-cpp/config.yml index 39018b94a2586..49006a3577c70 100644 --- a/recipes/wasmtime-cpp/config.yml +++ b/recipes/wasmtime-cpp/config.yml @@ -1,4 +1,14 @@ versions: + "18.0.0": + folder: all + "9.0.0": + folder: all + "7.0.0": + folder: all + "6.0.0": + folder: all + "5.0.0": + folder: all "3.0.0": folder: all "2.0.0": @@ -15,5 +25,3 @@ versions: folder: all "0.35.0": folder: all - "0.34.0": - folder: all diff --git a/recipes/wasmtime/all/conandata.yml b/recipes/wasmtime/all/conandata.yml index a30b87d1de7eb..f552bb5d07af3 100644 --- a/recipes/wasmtime/all/conandata.yml +++ b/recipes/wasmtime/all/conandata.yml @@ -1,235 +1,241 @@ sources: - "3.0.0": + "21.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" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v21.0.0/wasmtime-v21.0.0-x86_64-windows-c-api.zip" + sha256: "aee0fb2d792f93d16cc3ae2857a384c1f3b105374dfdecb6ab3f3b2823e6acaf" 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" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v21.0.0/wasmtime-v21.0.0-x86_64-mingw-c-api.zip" + sha256: "d4253540cc201c12d356a0806786ea518577c486d66d83a0144b4227d559c507" 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" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v21.0.0/wasmtime-v21.0.0-x86_64-linux-c-api.tar.xz" + sha256: "e91b15f242454ab916dd895d326f6c2585a1f93f0df5aeb079e6f0511c90b37d" "armv8": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v3.0.0/wasmtime-v3.0.0-aarch64-linux-c-api.tar.xz" - sha256: "93c3dcd7b315a98de221d68e0d253cfcbf122328aea285c28e70aa0ea6582088" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v21.0.0/wasmtime-v21.0.0-aarch64-linux-c-api.tar.xz" + sha256: "b3e77e3eab5c0c4c3085364701bdb5cdd05e5ac4e3308d40263b06ac67bae610" "s390x": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v3.0.0/wasmtime-v3.0.0-s390x-linux-c-api.tar.xz" - sha256: "9e19c795996a94ece9d0bf00c88cbb1081552c4ae0590effd50121351fb8303e" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v21.0.0/wasmtime-v21.0.0-s390x-linux-c-api.tar.xz" + sha256: "dad2b4c43aaaa6734ac0d2825767759338b0273c46500b46ac071ddc7e853bec" 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" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v21.0.0/wasmtime-v21.0.0-x86_64-macos-c-api.tar.xz" + sha256: "f99c5682ce85f353645b2b642a90104d43f77eafe8a90faa2ecd9421c4d48d2f" "armv8": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v3.0.0/wasmtime-v3.0.0-aarch64-macos-c-api.tar.xz" - sha256: "253a3d1c79134665ab2d7ae0672227b8d88b2becbb84ab96ceeee897a074801a" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v21.0.0/wasmtime-v21.0.0-aarch64-macos-c-api.tar.xz" + sha256: "0414332f1d6c90e6226102a27e8b8767eba845f34f4c8cabab575b094a0500f1" 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": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v21.0.0/wasmtime-v21.0.0-aarch64-linux-c-api.tar.xz" + sha256: "b3e77e3eab5c0c4c3085364701bdb5cdd05e5ac4e3308d40263b06ac67bae610" + "20.0.1": 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" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v20.0.1/wasmtime-v20.0.1-x86_64-windows-c-api.zip" + sha256: "d9a8cfefe8684d7170b67ade0fda6da4ad21508909680a64eebe083b93aabc70" 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" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v20.0.1/wasmtime-v20.0.1-x86_64-mingw-c-api.zip" + sha256: "164ecbbe632d1368020bccf442a81b20ec1cb57f0d0cdfaccf92ed74bd2311e8" 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" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v20.0.1/wasmtime-v20.0.1-x86_64-linux-c-api.tar.xz" + sha256: "ba2e7ce72a50b0a472888249aecfb27aac841e5dfc72c845175fbeeaaf6862d4" "armv8": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v2.0.0/wasmtime-v2.0.0-aarch64-linux-c-api.tar.xz" - sha256: "9bbcfbcc68b9b8c4572f0bdd956e1a558f9a01e82bd099fac9c7755220c92189" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v20.0.1/wasmtime-v20.0.1-aarch64-linux-c-api.tar.xz" + sha256: "e5f383012c4cacbe5ab78dba334fa77793e109c0da5840a8c00cb63633043bee" "s390x": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v2.0.0/wasmtime-v2.0.0-s390x-linux-c-api.tar.xz" - sha256: "9bbe40d443a34b1d8f71c9239d87555e9f41e04a9d84f085186711b8075ec5ef" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v20.0.1/wasmtime-v20.0.1-s390x-linux-c-api.tar.xz" + sha256: "f331a0fee2856f42136aaf9fbdc413abae397070f7b688d4b8c4885ec04292ff" 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" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v20.0.1/wasmtime-v20.0.1-x86_64-macos-c-api.tar.xz" + sha256: "a4031456c2c1e406395457bd7f452e9e71e8e024b727cf47ebb4da996f9a0c51" "armv8": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v2.0.0/wasmtime-v2.0.0-aarch64-macos-c-api.tar.xz" - sha256: "08749d061565f9b48a29c57d3ef9ee2d432d531fad8758be97b1c98bfda1c14b" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v20.0.1/wasmtime-v20.0.1-aarch64-macos-c-api.tar.xz" + sha256: "4bce467752f64dc4632b7ccad52b7e2ea134ad02a23e6b540b39a11c8c4fa579" 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": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v20.0.1/wasmtime-v20.0.1-aarch64-linux-c-api.tar.xz" + sha256: "e5f383012c4cacbe5ab78dba334fa77793e109c0da5840a8c00cb63633043bee" + "19.0.2": 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" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v19.0.2/wasmtime-v19.0.2-x86_64-windows-c-api.zip" + sha256: "9814038a400680a322f8c287ccba68fc0c5ffccede31f9ed444e945bdeec5c70" 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" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v19.0.2/wasmtime-v19.0.2-x86_64-mingw-c-api.zip" + sha256: "0a1c37ec9eebc2322632c8275386f99cdb08c58020ad01409aecde874b8ad364" 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" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v19.0.2/wasmtime-v19.0.2-x86_64-linux-c-api.tar.xz" + sha256: "734f82bc0fcf9e3214db37f4275536ee3b59be8935ec3ffac379b312423ee3ae" "armv8": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v1.0.1/wasmtime-v1.0.1-aarch64-linux-c-api.tar.xz" - sha256: "aa950e47fdff4970efb7a59a3ea9e96b965180f9e84be46280915086f0ad7519" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v19.0.2/wasmtime-v19.0.2-aarch64-linux-c-api.tar.xz" + sha256: "6952c3ffcbb0d04c1c7f07c17e945d0fe2b756965d17717fde2c51dcce7465ab" "s390x": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v1.0.1/wasmtime-v1.0.1-s390x-linux-c-api.tar.xz" - sha256: "b197a1d8878ae98b2a6ca769bc89aeda9352cb516f94d5a8d84453666ba57ab6" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v19.0.2/wasmtime-v19.0.2-s390x-linux-c-api.tar.xz" + sha256: "536a9a676ffaa143c77fa4e9712e19f6035e93e0d58865d243ad5e15302ef9e8" 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" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v19.0.2/wasmtime-v19.0.2-x86_64-macos-c-api.tar.xz" + sha256: "42948b3dc8ba7061101d83c55d1fb2ed2f537061291739e0582aa8375d6baf76" "armv8": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v1.0.1/wasmtime-v1.0.1-aarch64-macos-c-api.tar.xz" - sha256: "48fe254302c6519bf289a4d1385dd425a1c65c4dd521d88dc6a1fab6f025bd19" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v19.0.2/wasmtime-v19.0.2-aarch64-macos-c-api.tar.xz" + sha256: "d5b1121219d3503dac0f8cfc04a0557eea2330107867d0b32b91bd9fe0b62322" 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": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v19.0.2/wasmtime-v19.0.2-aarch64-linux-c-api.tar.xz" + sha256: "6952c3ffcbb0d04c1c7f07c17e945d0fe2b756965d17717fde2c51dcce7465ab" + "18.0.3": Windows: "x86_64": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.39.1/wasmtime-v0.39.1-x86_64-windows-c-api.zip" - sha256: "1bf83b7bfda81e2b7df5cede0b0b3dd29ff615ecaccb2ad59f266651f13ccab4" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v18.0.3/wasmtime-v18.0.3-x86_64-windows-c-api.zip" + sha256: "d23c633e73424304bc926b028a3fb9bed2709bc872414729e356ae66e55eb705" MinGW: "x86_64": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.39.1/wasmtime-v0.39.1-x86_64-mingw-c-api.zip" - sha256: "802325d7f1bbacd8b4c439cac7df9cdd35a9e7285fcd70bee217967a0f8c7ee7" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v18.0.3/wasmtime-v18.0.3-x86_64-mingw-c-api.zip" + sha256: "d4b74cf84862c1a3bb29a7a11f6785ed1307628a3f3e9a2b850df19f0c4da659" Linux: "x86_64": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.39.1/wasmtime-v0.39.1-x86_64-linux-c-api.tar.xz" - sha256: "b8580211b10b4380039700c5dd75813fc56138faf79fc86d63cc1abfe84c099b" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v18.0.3/wasmtime-v18.0.3-x86_64-linux-c-api.tar.xz" + sha256: "c5c67a16386c1b2efc875246cb8c75f45faa806a16979c985842d3ba91502b34" "armv8": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.39.1/wasmtime-v0.39.1-aarch64-linux-c-api.tar.xz" - sha256: "3fb770e9afa3114c3ffe9f60e696ba3e4a74d34e4b50b59cce27c3d118f215b1" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v18.0.3/wasmtime-v18.0.3-aarch64-linux-c-api.tar.xz" + sha256: "c7c790b6e5e3f998f588f2aacda6b39daf4aa59b68e58578a477579312ca0756" "s390x": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.39.1/wasmtime-v0.39.1-s390x-linux-c-api.tar.xz" - sha256: "65d662cc3948b89aab1f56d44da129d117798a59bdc938e90d6412d620980d72" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v18.0.3/wasmtime-v18.0.3-s390x-linux-c-api.tar.xz" + sha256: "196ec417bd07fe2559381c922434c9908087bd238ed0811b0b81a6a860ff0145" Macos: "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" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v18.0.3/wasmtime-v18.0.3-x86_64-macos-c-api.tar.xz" + sha256: "48a8969fda0abaee08ce17acd1413f21cc1112b2b5de1af00baa647a32d3951f" "armv8": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.39.1/wasmtime-v0.39.1-aarch64-macos-c-api.tar.xz" - sha256: "a5e0e3b1acf924771d84beec6462baa00d9a436df2d65748bcd202cb8470d267" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v18.0.3/wasmtime-v18.0.3-aarch64-macos-c-api.tar.xz" + sha256: "f6faa6ae319d43c7f54892c10742be18aa7cca5ba72fd470a0926f64d0745050" Android: "armv8": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.39.1/wasmtime-v0.39.1-aarch64-linux-c-api.tar.xz" - sha256: "3fb770e9afa3114c3ffe9f60e696ba3e4a74d34e4b50b59cce27c3d118f215b1" - "0.38.0": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v18.0.3/wasmtime-v18.0.3-aarch64-linux-c-api.tar.xz" + sha256: "c7c790b6e5e3f998f588f2aacda6b39daf4aa59b68e58578a477579312ca0756" + "16.0.0": Windows: "x86_64": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.38.0/wasmtime-v0.38.0-x86_64-windows-c-api.zip" - sha256: "69b28fe9a89451e4561c628341c960c08d369caecfc319650660586dcf8c0c61" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v16.0.0/wasmtime-v16.0.0-x86_64-windows-c-api.zip" + sha256: "c832e904f0bf0e3958a82efd45f025bfa94bb5629825effb1c5700d47df79629" MinGW: "x86_64": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.38.0/wasmtime-v0.38.0-x86_64-mingw-c-api.zip" - sha256: "926177b45afe208e64011a2cb68dc73e064c25391269982ca74678eeade30faf" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v16.0.0/wasmtime-v16.0.0-x86_64-mingw-c-api.zip" + sha256: "dc6ea5781edaa1155cf38da30bf691d543010cb2a0c3c597d75a8e11df96ed25" Linux: "x86_64": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.38.0/wasmtime-v0.38.0-x86_64-linux-c-api.tar.xz" - sha256: "a4dfe18391feb807ae9c219734bc084ff11c1f2f26762dfb5252f5299cee434e" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v16.0.0/wasmtime-v16.0.0-x86_64-linux-c-api.tar.xz" + sha256: "5c67576f977c4373b77fc1304ff56b426a27b3f3ac481437ee51d5e915d43f7b" "armv8": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.38.0/wasmtime-v0.38.0-aarch64-linux-c-api.tar.xz" - sha256: "01dd81ac4eeff128ff762b6f2e61336b723a78b940006cd405f135e509046c4e" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v16.0.0/wasmtime-v16.0.0-aarch64-linux-c-api.tar.xz" + sha256: "373b2def51a2ba7d1f73e82a5adf62dcf8dfba27149f6ff6ff69cb6bd97a1bfc" "s390x": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.38.0/wasmtime-v0.38.0-s390x-linux-c-api.tar.xz" - sha256: "552c991ab894fa250a5be296befb1c9f44c115de760ffe80b9ddf430f3e30ec0" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v16.0.0/wasmtime-v16.0.0-s390x-linux-c-api.tar.xz" + sha256: "2340ca3abaaf0acf7185fe2e262e492c4b85c8d72fa9f8285ba58eb08418616b" Macos: "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" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v16.0.0/wasmtime-v16.0.0-x86_64-macos-c-api.tar.xz" + sha256: "f9e4b9df2993f6b0eb6a642b10fc38342e33fb3a9d5deb25dbf765b098bb9069" "armv8": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.38.0/wasmtime-v0.38.0-aarch64-macos-c-api.tar.xz" - sha256: "1e424122c73418c972287043a50555569afb09dc721fb6630503bf455cbd2856" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v16.0.0/wasmtime-v16.0.0-aarch64-macos-c-api.tar.xz" + sha256: "fff9a7516ea3befc23a0d7dcff6b2b23dbccc3674fb27359f2b2798242890943" Android: "armv8": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.38.0/wasmtime-v0.38.0-aarch64-linux-c-api.tar.xz" - sha256: "01dd81ac4eeff128ff762b6f2e61336b723a78b940006cd405f135e509046c4e" - "0.37.0": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v16.0.0/wasmtime-v16.0.0-aarch64-linux-c-api.tar.xz" + sha256: "373b2def51a2ba7d1f73e82a5adf62dcf8dfba27149f6ff6ff69cb6bd97a1bfc" + "12.0.2": Windows: "x86_64": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.37.0/wasmtime-v0.37.0-x86_64-windows-c-api.zip" - sha256: "1e2db8ccb86d2da0607aca783bb3c929562e4fa688a94452dffa745867494a2d" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v12.0.2/wasmtime-v12.0.2-x86_64-windows-c-api.zip" + sha256: "ad589d69722f0fdf0b6900fe1c708194575c487776504c44a5283c2960c03a92" MinGW: "x86_64": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.37.0/wasmtime-v0.37.0-x86_64-mingw-c-api.zip" - sha256: "62966da16277aaf3312525c1e5ce08202d56c8450855bfaf7b319ffa4355fd52" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v12.0.2/wasmtime-v12.0.2-x86_64-mingw-c-api.zip" + sha256: "773737d9072aed6efdbb6c8137561bd3d5e271008e6741687fa504ec384d0799" Linux: "x86_64": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.37.0/wasmtime-v0.37.0-x86_64-linux-c-api.tar.xz" - sha256: "7b8de351808eb4dd3186bcc18b8f54d6c486ec1f21961521be49d02d38833696" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v12.0.2/wasmtime-v12.0.2-x86_64-linux-c-api.tar.xz" + sha256: "9e02cd4201d74c68a236664f883873335c7427e820ce4a44c47c1cc98ec9e553" "armv8": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.37.0/wasmtime-v0.37.0-aarch64-linux-c-api.tar.xz" - sha256: "926c4736cc79835f880f5b6f193891960a4fc32464ca00871ffd7228605387d9" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v12.0.2/wasmtime-v12.0.2-aarch64-linux-c-api.tar.xz" + sha256: "daf6ca147b288cf915978f064853f403ca163b52806ae0a52ddd5bd91a5a2507" "s390x": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.37.0/wasmtime-v0.37.0-s390x-linux-c-api.tar.xz" - sha256: "cdcefd0394cfaefdac9eba9417016c7a916a063f567b483d6df09b883d9b5976" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v12.0.2/wasmtime-v12.0.2-s390x-linux-c-api.tar.xz" + sha256: "65e75ffe34ced6710b56da071e9eb734eabdad69be07f3e6baae27e6b1a95d41" Macos: "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" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v12.0.2/wasmtime-v12.0.2-x86_64-macos-c-api.tar.xz" + sha256: "35a0d3590afb147f9b312820df87189a9a376cc5bddc2d90b8d7e57b412c7dc6" "armv8": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.37.0/wasmtime-v0.37.0-aarch64-macos-c-api.tar.xz" - sha256: "0a0f5fd2283f52b3ab725650a5dfc77a8bf53de962344fabc37418af9e5e407a" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v12.0.2/wasmtime-v12.0.2-aarch64-macos-c-api.tar.xz" + sha256: "6b8a13fbe6c5440b30632a1f9178df1cdc07bbf34633a105666e506bc8db941d" Android: "armv8": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.37.0/wasmtime-v0.37.0-aarch64-linux-c-api.tar.xz" - sha256: "926c4736cc79835f880f5b6f193891960a4fc32464ca00871ffd7228605387d9" - "0.36.0": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v12.0.2/wasmtime-v12.0.2-aarch64-linux-c-api.tar.xz" + sha256: "daf6ca147b288cf915978f064853f403ca163b52806ae0a52ddd5bd91a5a2507" + "9.0.1": Windows: "x86_64": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.36.0/wasmtime-v0.36.0-x86_64-windows-c-api.zip" - sha256: "7c0cc05d73b376bce31964c99720cecd9f595fc4a338e4a45bbc04cca5780508" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v9.0.1/wasmtime-v9.0.1-x86_64-windows-c-api.zip" + sha256: "39bc0cf1a4e611427d7da9b16f7798321fe189ca2915a570f2df97d27848cfe3" MinGW: "x86_64": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.36.0/wasmtime-v0.36.0-x86_64-mingw-c-api.zip" - sha256: "c4a6d3f0e428f3c912bef930c2d332fe09939b01b59f37a16ec6f4f7a89119e4" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v9.0.1/wasmtime-v9.0.1-x86_64-mingw-c-api.zip" + sha256: "3672a99ba17c6755df5260f82916605ba36e2b9336fa2c16248c3b2c732e3318" Linux: "x86_64": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.36.0/wasmtime-v0.36.0-x86_64-linux-c-api.tar.xz" - sha256: "c82c9fd1449a4a78710b8ada47db7386edb1caafcb8baa7cdedb79539fedb372" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v9.0.1/wasmtime-v9.0.1-x86_64-linux-c-api.tar.xz" + sha256: "9141a08bec03cb727920f29c9f471b4b251613842096f65f0a462c838935bf41" "armv8": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.36.0/wasmtime-v0.36.0-aarch64-linux-c-api.tar.xz" - sha256: "865e73764fca8552734eea72d990d32a670e8e7079f8fc5f15d70cb03ef3c8d9" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v9.0.1/wasmtime-v9.0.1-aarch64-linux-c-api.tar.xz" + sha256: "6b50b8f04f1cb77c39665286125db3f111470483c594d5d323d49b927e46c07b" "s390x": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.36.0/wasmtime-v0.36.0-s390x-linux-c-api.tar.xz" - sha256: "ec36bacf5b24b9da5ef1cdc979caf224412146d683ed6021f3bbd75adcb3754e" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v9.0.1/wasmtime-v9.0.1-s390x-linux-c-api.tar.xz" + sha256: "701b1951325f0d9528ee7fd525afd1db059b8f38f0634c488e5f8a0418752983" Macos: "x86_64": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.36.0/wasmtime-v0.36.0-x86_64-macos-c-api.tar.xz" - sha256: "8a97dfce791d9ad0acb346cdd6aa8f0f9ca85a94aa4c456ac9534c1994867dbf" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v9.0.1/wasmtime-v9.0.1-x86_64-macos-c-api.tar.xz" + sha256: "b1bba66e2bcab5ff88f217eab58fe145f00c7655be023807ccdef23fde3e8795" + "armv8": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v9.0.1/wasmtime-v9.0.1-aarch64-macos-c-api.tar.xz" + sha256: "c275e91dffcb6d6a3fb6b10e5de93d2553646f0bbfa4756d36178d0fc51c6334" Android: "armv8": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.36.0/wasmtime-v0.36.0-aarch64-linux-c-api.tar.xz" - sha256: "865e73764fca8552734eea72d990d32a670e8e7079f8fc5f15d70cb03ef3c8d9" - "0.35.1": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v9.0.1/wasmtime-v9.0.1-aarch64-linux-c-api.tar.xz" + sha256: "6b50b8f04f1cb77c39665286125db3f111470483c594d5d323d49b927e46c07b" + "7.0.0": Windows: "x86_64": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.35.1/wasmtime-v0.35.1-x86_64-windows-c-api.zip" - sha256: "055d0fead69eaf906bb68dd758fe4d59ee3638888503832142857f35feaba782" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v7.0.0/wasmtime-v7.0.0-x86_64-windows-c-api.zip" + sha256: "d09f31a8dcc6d38ac442a3b1d653137d5814cddad006b5e38151bbc4a9b9d692" MinGW: "x86_64": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.35.1/wasmtime-v0.35.1-x86_64-mingw-c-api.zip" - sha256: "aee0f5f58915921191c4f9defda1a7172c6ca76c95e8d562e4cbefc5f0e1fff0" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v7.0.0/wasmtime-v7.0.0-x86_64-mingw-c-api.zip" + sha256: "1198d705bae1d09df15b8ae194d54dfd11bd90e2cc6fbb9aa13a7b000bd24ba9" Linux: "x86_64": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.35.1/wasmtime-v0.35.1-x86_64-linux-c-api.tar.xz" - sha256: "dd6ec4a87eed1a34ad386ca950ef01a7e9300b713beb38da8e51dd3f92ece002" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v7.0.0/wasmtime-v7.0.0-x86_64-linux-c-api.tar.xz" + sha256: "cc9b137c0fddeb57a2d439fb8ad57e224a51e0e949cd8ea3fb4a6ee8bb1085d2" "armv8": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.35.1/wasmtime-v0.35.1-aarch64-linux-c-api.tar.xz" - sha256: "8e263a62919a8dc8a7789abe3cfc69bdc0d6ea14b0cabee7a988bac250436785" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v7.0.0/wasmtime-v7.0.0-aarch64-linux-c-api.tar.xz" + sha256: "47a5fcad64a0e223cf1796eafd0fc9ca62c8b3e457942695397feb56382d3db1" "s390x": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.35.1/wasmtime-v0.35.1-s390x-linux-c-api.tar.xz" - sha256: "ed84e8b4c10c22ee5de3908aa006884bc1c38122e4a020cb9d91d86ed597d8a4" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v7.0.0/wasmtime-v7.0.0-s390x-linux-c-api.tar.xz" + sha256: "18d32031a731e9f7d9dfdc9e75ac8210f88321b4c99b21e24bed6a25ba6cf0ca" Macos: "x86_64": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.35.1/wasmtime-v0.35.1-x86_64-macos-c-api.tar.xz" - sha256: "e32b46a537cf4311435477336cbcd30d68099097963b55c62ec5c12834326560" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v7.0.0/wasmtime-v7.0.0-x86_64-macos-c-api.tar.xz" + sha256: "b2b9dd2a200e93889ce2bff637aacbc8c40dae9903fb30eda20ed52fd4ca83a4" + "armv8": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v7.0.0/wasmtime-v7.0.0-aarch64-macos-c-api.tar.xz" + sha256: "88bc1c36665d230206130a9d194b11b907438c86224ed184f2bee8ef348cf193" Android: "armv8": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.35.1/wasmtime-v0.35.1-aarch64-linux-c-api.tar.xz" - sha256: "8e263a62919a8dc8a7789abe3cfc69bdc0d6ea14b0cabee7a988bac250436785" + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v7.0.0/wasmtime-v7.0.0-aarch64-linux-c-api.tar.xz" + sha256: "47a5fcad64a0e223cf1796eafd0fc9ca62c8b3e457942695397feb56382d3db1" diff --git a/recipes/wasmtime/all/conanfile.py b/recipes/wasmtime/all/conanfile.py index 07cd7273e4731..4aec54bb577f2 100644 --- a/recipes/wasmtime/all/conanfile.py +++ b/recipes/wasmtime/all/conanfile.py @@ -1,12 +1,12 @@ +import os + 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.files import copy, get 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 WasmtimeConan(ConanFile): @@ -16,6 +16,7 @@ class WasmtimeConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/bytecodealliance/wasmtime" topics = ("webassembly", "wasm", "wasi") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -26,16 +27,17 @@ class WasmtimeConan(ConanFile): 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": "15", + "msvc": "191", "apple-clang": "9.4", "clang": "3.3", - "gcc": "5.1" + "gcc": "5.1", } @property @@ -47,46 +49,35 @@ def _sources_os_key(self): return str(self.settings.os) def configure(self): - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd - del self.settings.compiler.runtime + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") def package_id(self): del self.info.settings.compiler.version - if self.settings.compiler == "clang": + if self.info.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 Version(compiler.version) < min_version: - msg = ( - 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 = ( - 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: self.conan_data["sources"][self.version][self._sources_os_key][str(self.settings.arch)] except KeyError: raise ConanInvalidConfiguration("Binaries for this combination of architecture/version/os are not available") + 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 build(self): # This is packaging binaries so the download needs to be in build get(self, **self.conan_data["sources"][self.version][self._sources_os_key][str(self.settings.arch)], - destination=self.source_folder, strip_root=True) + destination=self.build_folder, strip_root=True) def package(self): - 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.build_folder, "include")) - srclibdir = os.path.join(self.source_folder, "lib") + srclibdir = os.path.join(self.build_folder, "lib") dstlibdir = os.path.join(self.package_folder, "lib") dstbindir = os.path.join(self.package_folder, "bin") if self.options.shared: @@ -99,7 +90,7 @@ def package(self): copy(self, "wasmtime.lib", dst=dstlibdir, src=srclibdir, keep_path=False) copy(self, "libwasmtime.a", dst=dstlibdir, src=srclibdir, keep_path=False) - copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.build_folder) def package_info(self): if self.options.shared: diff --git a/recipes/wasmtime/config.yml b/recipes/wasmtime/config.yml index 30c740d2e0859..5bcf55a2755ca 100644 --- a/recipes/wasmtime/config.yml +++ b/recipes/wasmtime/config.yml @@ -1,17 +1,19 @@ versions: - "3.0.0": + "21.0.0": folder: all - "2.0.0": + "20.0.1": folder: all - "1.0.1": + "19.0.2": folder: all - "0.39.1": + "18.0.3": folder: all - "0.38.0": + "16.0.0": folder: all - "0.37.0": + "12.0.2": folder: all - "0.36.0": + "9.0.1": folder: all - "0.35.1": + "7.0.0": + folder: all + "6.0.1": folder: all diff --git a/recipes/watcher/all/conandata.yml b/recipes/watcher/all/conandata.yml index 93e1e2ddd653f..6976da974f6c5 100644 --- a/recipes/watcher/all/conandata.yml +++ b/recipes/watcher/all/conandata.yml @@ -1,23 +1,25 @@ sources: - "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.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" + "0.12.0": + url: "https://github.com/e-dant/watcher/archive/release/0.12.0.tar.gz" + sha256: "9dd4758f4c45ae7925619ceee9e3bd5a0b33577aa5ac2cd857eca14d16749723" + "0.11.0": + url: "https://github.com/e-dant/watcher/archive/release/0.11.0.tar.gz" + sha256: "dd92496d77b6bc27e27ed28253faae4d81bc58b19407d154bb49504b2af73664" + "0.10.1": + url: "https://github.com/e-dant/watcher/archive/release/0.10.1.tar.gz" + sha256: "cc14b0adfc23ae90390cf8b4f20291abbc5bf0e358b5d12fa73f7e21d021ccd0" + "0.10.0": + url: "https://github.com/e-dant/watcher/archive/release/0.10.0.tar.gz" + sha256: "c15f088ddc41b58100921ea0b630bcbde83c9960aefecf82221da997f4d4b4ec" + "0.9.5": + url: "https://github.com/e-dant/watcher/archive/release/0.9.5.tar.gz" + sha256: "41b74d138eec106c35a99e7544def599453a8bf4cf4887ad627e1c9e3355287c" + "0.9.2": + url: "https://github.com/e-dant/watcher/archive/release/0.9.2.tar.gz" + sha256: "d728960cbf5cebb05e1e0b7d61482b1cfd10b6bc616f9e494168f7d5d2e689cf" + "0.8.8": + url: "https://github.com/e-dant/watcher/archive/release/0.8.8.tar.gz" + sha256: "51e61a096d072ae5c78df9318dec50fb5718c88b672305fc4b6bd2c7ba264bbe" + "0.8.7": + url: "https://github.com/e-dant/watcher/archive/release/0.8.7.tar.gz" + sha256: "e83eaf097f8ebe9b87bee2962e6e18f6f2597ae4e76d8d0258adc2c62fa545d2" diff --git a/recipes/watcher/all/conanfile.py b/recipes/watcher/all/conanfile.py index 583d57f7ba78b..167c9652d196e 100644 --- a/recipes/watcher/all/conanfile.py +++ b/recipes/watcher/all/conanfile.py @@ -1,10 +1,10 @@ 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.files import get, copy from conan.tools.build import check_min_cppstd from conan.tools.apple import is_apple_os -from conan.tools.microsoft import check_min_vs from conan.tools.layout import basic_layout +from conan.tools.scm import Version import os required_conan_version = ">=1.49.0" @@ -16,22 +16,32 @@ class WatcherConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/e-dant/watcher/" topics = ("watch", "filesystem", "event", "header-only") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" + no_copy_source = True @property - def _minimum_cpp_standard(self): - return 20 + def _min_cppstd(self): + return "20" if Version(self.version) < "0.9.0" else "17" @property def _compilers_minimum_version(self): return { - "gcc": "11", - "clang": "13", - "apple-clang": "13.1", - } - - def export_sources(self): - export_conandata_patches(self) + "17": { + "gcc": "8", + "clang": "7", + "apple-clang": "12", + "Visual Studio": "16", + "msvc": "192", + }, + "20": { + "gcc": "11", + "clang": "13", + "apple-clang": "13.1", + "Visual Studio": "16", + "msvc": "192", + }, + }.get(self._min_cppstd, {}) def layout(self): basic_layout(self, src_folder="src") @@ -41,8 +51,7 @@ def package_id(self): def validate(self): if self.settings.get_safe("compiler.cppstd"): - check_min_cppstd(self, self._minimum_cpp_standard) - check_min_vs(self, 192) + check_min_cppstd(self, self._min_cppstd) def loose_lt_semver(v1, v2): lv1 = [int(v) for v in v1.split(".")] @@ -53,14 +62,11 @@ 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.ref} requires C++{self._minimum_cpp_standard}, 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): - apply_conandata_patches(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) @@ -76,7 +82,6 @@ def package_info(self): self.cpp_info.libdirs = [] if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.system_libs.append("m") - + self.cpp_info.system_libs.extend(["m", "pthread"]) 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 deleted file mode 100644 index 1c3d12d2130de..0000000000000 --- a/recipes/watcher/all/patches/0.3.1-fix-include.patch +++ /dev/null @@ -1,12 +0,0 @@ -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/test_package/CMakeLists.txt b/recipes/watcher/all/test_package/CMakeLists.txt index 237b645236ec4..7cb2b32a687ee 100644 --- a/recipes/watcher/all/test_package/CMakeLists.txt +++ b/recipes/watcher/all/test_package/CMakeLists.txt @@ -1,5 +1,4 @@ cmake_minimum_required(VERSION 3.12) - project(test_package LANGUAGES CXX) find_package(watcher REQUIRED CONFIG) @@ -7,13 +6,26 @@ 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) + +if(watcher_VERSION VERSION_GREATER_EQUAL "0.9.0") + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +else() + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) +endif() + +if(watcher_VERSION VERSION_LESS "0.8.1") + target_compile_definitions(${PROJECT_NAME} PRIVATE WATCHER_EVENT_NAMESPACE=wtr::watcher::event) + target_compile_definitions(${PROJECT_NAME} PRIVATE WATCHER_EVENT_KIND_NAMESPACE=wtr::watcher::event) else() - target_compile_definitions(${PROJECT_NAME} PRIVATE WATCHER_NAMESPACE=wtr) + target_compile_definitions(${PROJECT_NAME} PRIVATE WATCHER_EVENT_NAMESPACE=wtr::watcher) + target_compile_definitions(${PROJECT_NAME} PRIVATE WATCHER_EVENT_KIND_NAMESPACE=wtr::watcher::event) endif() -if(watcher_VERSION VERSION_GREATER_EQUAL "0.5.0") +if(watcher_VERSION VERSION_GREATER_EQUAL "0.9.0") + target_compile_definitions(${PROJECT_NAME} PRIVATE WATCHER_RAII_SAFE) +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/test_package.cpp b/recipes/watcher/all/test_package/test_package.cpp index 787ba072e84c5..6e1dd6a280cc9 100644 --- a/recipes/watcher/all/test_package/test_package.cpp +++ b/recipes/watcher/all/test_package/test_package.cpp @@ -2,28 +2,43 @@ #include #include -#include "watcher/watcher.hpp" +#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) { + auto const show_event_json = [](const WATCHER_EVENT_NAMESPACE::event& this_event) { std::cout << " " << this_event; - if (this_event.kind != WATCHER_NAMESPACE::watcher::event::kind::watcher) { +#ifdef WATCHER_RAII_SAFE + if (this_event.path_type != WATCHER_EVENT_KIND_NAMESPACE::path_type::watcher) { +#else + if (this_event.kind != WATCHER_EVENT_KIND_NAMESPACE::kind::watcher) { +#endif std::cout << ","; } std::cout << "\n"; }; - std::thread([&]() { WATCHER_NAMESPACE::watcher::watch(".", show_event_json); }).detach(); 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); -#ifdef WATCHER_DIE_WITH_PATH - auto const is_watch_dead = WATCHER_NAMESPACE::watcher::die(".", show_event_json); + auto const is_watch_dead = lifetime.close(); #else - auto const is_watch_dead = WATCHER_NAMESPACE::watcher::die(show_event_json); + std::thread([&]() { wtr::watcher::watch(".", show_event_json); }).detach(); + std::this_thread::sleep_for(time_until_death); +# ifdef WATCHER_DIE_WITH_PATH + auto const is_watch_dead = wtr::watcher::die(".", show_event_json); +# else + auto const is_watch_dead = wtr::watcher::die(show_event_json); +# endif #endif std::cout << " },\n" diff --git a/recipes/watcher/config.yml b/recipes/watcher/config.yml index 8e8a861574ec0..4670527815f92 100644 --- a/recipes/watcher/config.yml +++ b/recipes/watcher/config.yml @@ -1,11 +1,17 @@ versions: - "0.5.2": + "0.12.0": folder: all - "0.4.3": + "0.11.0": folder: all - "0.3.3": + "0.10.1": folder: all - "0.3.2": + "0.10.0": folder: all - "0.3.1": + "0.9.5": + folder: all + "0.9.2": + folder: all + "0.8.8": + folder: all + "0.8.7": folder: all diff --git a/recipes/wavelet_buffer/all/conandata.yml b/recipes/wavelet_buffer/all/conandata.yml index fbf3768205fcc..16606180f5c32 100644 --- a/recipes/wavelet_buffer/all/conandata.yml +++ b/recipes/wavelet_buffer/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.7.1": + url: "https://github.com/panda-official/WaveletBuffer/archive/refs/tags/v0.7.1.tar.gz" + sha256: "34931da9a8f3c36a37e7e72c801f5ae139006e3c84013511e6baaae3f8d3da3c" "0.5.0": url: "https://github.com/panda-official/WaveletBuffer/archive/refs/tags/v0.5.0.tar.gz" sha256: "2b1fa552f9a6e032dfd9f59bd05c049bf0cac46aced7cd42f49ff0d020cfdb50" @@ -6,19 +9,26 @@ sources: url: "https://github.com/panda-official/WaveletBuffer/archive/refs/tags/v0.4.0.tar.gz" sha256: "0a30080a6d1e9e7f8947ae0c3395d3c86888900c7ae09730f8dd0ed5138daab2" patches: + "0.7.1": + - patch_file: "patches/0.7.1-0001-fix-packages.patch" + patch_description: "don't find catch2, use jpeg instead of libjpeg-turbo" + patch_type: "conan" + - patch_file: "patches/0.7.1-0002-use-cci-packages.patch" + patch_description: "use cci's packages" + patch_type: "conan" "0.5.0": - - patch_file: "patches/0001-0.4.0-cmake-no-openblas.patch" + - patch_file: "patches/0.4.0-0001-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_file: "patches/0.4.0-0002-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_file: "patches/0.4.0-0001-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_file: "patches/0.4.0-0002-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 index d2fc690c180b0..f322218f978f0 100644 --- a/recipes/wavelet_buffer/all/conanfile.py +++ b/recipes/wavelet_buffer/all/conanfile.py @@ -17,7 +17,7 @@ class WaveletBufferConan(ConanFile): topics = ("compression", "signal-processing", "wavelet") homepage = "https://github.com/panda-official/WaveletBuffer" url = "https://github.com/conan-io/conan-center-index" - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -60,12 +60,15 @@ def layout(self): def requirements(self): self.requires("blaze/3.8", transitive_headers=True) - self.requires("cimg/3.0.2") + self.requires("cimg/3.3.0") if self.options.jpeg == "libjpeg-turbo": - self.requires("libjpeg-turbo/2.1.4") + self.requires("libjpeg-turbo/3.0.1") else: self.requires("libjpeg/9e") # FIXME: unvendor SfCompressor which is currently downloaded at build time :s + if Version(self.version) >= "0.6.0": + self.requires("streamvbyte/1.0.0") + self.requires("fpzip/1.3.0") def validate(self): if self.settings.compiler.get_safe("cppstd"): @@ -80,24 +83,11 @@ def validate(self): 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") + self.tool_requires("cmake/[>=3.16 <4]") 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) @@ -118,12 +108,17 @@ def package(self): cmake = CMake(self) cmake.install() rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) 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 Version(self.version) >= "0.6.0": + self.cpp_info.libs = ["wavelet_buffer"] + self.cpp_info.requires.extend(["streamvbyte::streamvbyte", "fpzip::fpzip"]) + else: + self.cpp_info.libs = ["wavelet_buffer", "sf_compressor"] if self.options.jpeg == "libjpeg-turbo": self.cpp_info.requires.append("libjpeg-turbo::jpeg") else: diff --git a/recipes/wavelet_buffer/all/patches/0001-0.4.0-cmake-no-openblas.patch b/recipes/wavelet_buffer/all/patches/0.4.0-0001-cmake-no-openblas.patch similarity index 100% rename from recipes/wavelet_buffer/all/patches/0001-0.4.0-cmake-no-openblas.patch rename to recipes/wavelet_buffer/all/patches/0.4.0-0001-cmake-no-openblas.patch diff --git a/recipes/wavelet_buffer/all/patches/0002-0.4.0-cmake-find-jpeblib.patch b/recipes/wavelet_buffer/all/patches/0.4.0-0002-cmake-find-jpeblib.patch similarity index 100% rename from recipes/wavelet_buffer/all/patches/0002-0.4.0-cmake-find-jpeblib.patch rename to recipes/wavelet_buffer/all/patches/0.4.0-0002-cmake-find-jpeblib.patch diff --git a/recipes/wavelet_buffer/all/patches/0.7.1-0001-fix-packages.patch b/recipes/wavelet_buffer/all/patches/0.7.1-0001-fix-packages.patch new file mode 100644 index 0000000000000..6621e790da38b --- /dev/null +++ b/recipes/wavelet_buffer/all/patches/0.7.1-0001-fix-packages.patch @@ -0,0 +1,24 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index e2a6681..5ef9cbb 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -59,9 +59,8 @@ else() + endif() + + find_package(blaze REQUIRED) +-find_package(libjpeg-turbo REQUIRED) ++find_package(JPEG REQUIRED) + find_package(cimg REQUIRED) +-find_package(Catch2 REQUIRED) + + # Create wb target + set(WB_TARGET_NAME ${PROJECT_NAME}) +@@ -146,7 +145,7 @@ target_include_directories( + # Link dependencies + target_link_libraries(${WB_TARGET_NAME} PRIVATE streamvbyte) + target_link_libraries(${WB_TARGET_NAME} PRIVATE fpzip) +-target_link_libraries(${WB_TARGET_NAME} PRIVATE libjpeg-turbo::libjpeg-turbo) ++target_link_libraries(${WB_TARGET_NAME} PRIVATE JPEG::JPEG) + target_link_libraries(${WB_TARGET_NAME} PRIVATE cimg::cimg) + + target_link_libraries(${WB_TARGET_NAME} PUBLIC blaze::blaze) diff --git a/recipes/wavelet_buffer/all/patches/0.7.1-0002-use-cci-packages.patch b/recipes/wavelet_buffer/all/patches/0.7.1-0002-use-cci-packages.patch new file mode 100644 index 0000000000000..260b4ac4bbddc --- /dev/null +++ b/recipes/wavelet_buffer/all/patches/0.7.1-0002-use-cci-packages.patch @@ -0,0 +1,66 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 5ef9cbb..fed641b 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -80,39 +80,12 @@ add_library( + sources/internal/matrix_compressor.cc + ) + +-include(FetchContent) +- +-fetchcontent_declare( +- streamvbyte +- URL https://github.com/lemire/streamvbyte/archive/refs/tags/v1.0.0.zip +- URL_HASH MD5=3d1a01cfb704947fa6498944082aeed1 +-) +- +-fetchcontent_declare( +- fpzip +- URL https://github.com/LLNL/fpzip/releases/download/1.3.0/fpzip-1.3.0.zip +- URL_HASH MD5=933ed7628de406a24fe2de61c8c3356c +-) +- +-fetchcontent_makeavailable(streamvbyte) +- +-fetchcontent_getproperties(fpzip) +- +-if(NOT fpzip_POPULATED) +- fetchcontent_populate(fpzip) +- # Make subproject to use 'BUILD_SHARED_LIBS=ON' setting. +- set(BUILD_SHARED_LIBS OFF CACHE INTERNAL "Build SHARED libraries") +- add_subdirectory(${fpzip_SOURCE_DIR} ${fpzip_BINARY_DIR}) +-endif() ++find_package(streamvbyte REQUIRED CONFIG) ++find_package(fpzip REQUIRED CONFIG) + + # Add alias + add_library(${WB_TARGET_NAME}::${WB_TARGET_NAME} ALIAS ${WB_TARGET_NAME}) + +-# Set fPIC +-set_target_properties(${WB_TARGET_NAME} PROPERTIES POSITION_INDEPENDENT_CODE ON) +-set_target_properties(streamvbyte PROPERTIES POSITION_INDEPENDENT_CODE ON) +-set_target_properties(fpzip PROPERTIES POSITION_INDEPENDENT_CODE ON) +- + # Turn off parallelization in blaze + target_compile_definitions( + ${WB_TARGET_NAME} +@@ -143,8 +116,8 @@ target_include_directories( + ) + + # Link dependencies +-target_link_libraries(${WB_TARGET_NAME} PRIVATE streamvbyte) +-target_link_libraries(${WB_TARGET_NAME} PRIVATE fpzip) ++target_link_libraries(${WB_TARGET_NAME} PRIVATE streamvbyte::streamvbyte) ++target_link_libraries(${WB_TARGET_NAME} PRIVATE fpzip::fpzip) + target_link_libraries(${WB_TARGET_NAME} PRIVATE JPEG::JPEG) + target_link_libraries(${WB_TARGET_NAME} PRIVATE cimg::cimg) + +@@ -178,7 +151,7 @@ endif() + include(GNUInstallDirs) + + # Create package targets file +-install(TARGETS ${WB_TARGET_NAME} streamvbyte EXPORT ${WB_TARGET_NAME}-target) ++install(TARGETS ${WB_TARGET_NAME} EXPORT ${WB_TARGET_NAME}-target) + install( + EXPORT ${WB_TARGET_NAME}-target + FILE ${WB_TARGET_NAME}-targets.cmake diff --git a/recipes/wavelet_buffer/config.yml b/recipes/wavelet_buffer/config.yml index d13fcfd021b7b..80a49141e8ea4 100644 --- a/recipes/wavelet_buffer/config.yml +++ b/recipes/wavelet_buffer/config.yml @@ -1,4 +1,6 @@ versions: + "0.7.1": + folder: all "0.5.0": folder: all "0.4.0": diff --git a/recipes/wayland-protocols/all/conandata.yml b/recipes/wayland-protocols/all/conandata.yml index 57bce2d3e5da6..045450ce454eb 100644 --- a/recipes/wayland-protocols/all/conandata.yml +++ b/recipes/wayland-protocols/all/conandata.yml @@ -1,19 +1,31 @@ sources: + "1.36": + url: "https://gitlab.freedesktop.org/wayland/wayland-protocols/-/releases/1.36/downloads/wayland-protocols-1.36.tar.xz" + sha256: "71fd4de05e79f9a1ca559fac30c1f8365fa10346422f9fe795f74d77b9ef7e92" + "1.33": + url: "https://gitlab.freedesktop.org/wayland/wayland-protocols/-/releases/1.33/downloads/wayland-protocols-1.33.tar.xz" + sha256: "94f0c50b090d6e61a03f62048467b19abbe851be4e11ae7b36f65f8b98c3963a" + "1.32": + url: "https://gitlab.freedesktop.org/wayland/wayland-protocols/-/releases/1.32/downloads/wayland-protocols-1.32.tar.xz" + sha256: "7459799d340c8296b695ef857c07ddef24c5a09b09ab6a74f7b92640d2b1ba11" + "1.31": + url: "https://gitlab.freedesktop.org/wayland/wayland-protocols/-/releases/1.31/downloads/wayland-protocols-1.31.tar.xz" + sha256: "a07fa722ed87676ec020d867714bc9a2f24c464da73912f39706eeef5219e238" "1.27": - url: "https://github.com/wayland-project/wayland-protocols/archive/1.27.tar.gz" - sha256: "6dd6ee86478adf4347f3b8b4f3da62dbe9e44912c9cef21cf99abfe692313df4" + url: "https://gitlab.freedesktop.org/wayland/wayland-protocols/-/releases/1.27/downloads/wayland-protocols-1.27.tar.xz" + sha256: "9046f10a425d4e2a00965a03acfb6b3fb575a56503ac72c2b86821c69653375c" "1.26": - url: "https://github.com/wayland-project/wayland-protocols/archive/1.26.tar.gz" - sha256: "fe56386f436a84e97c3b6a61b76306f205a64425900f247ad0048174b9c32d4d" + url: "https://gitlab.freedesktop.org/wayland/wayland-protocols/-/archive/1.26/wayland-protocols-1.26.tar.bz2" + sha256: "0426ae92841cad054dac8565a90c282deabb60c46a3752c37788b8a322ad12a2" "1.25": - url: "https://github.com/wayland-project/wayland-protocols/archive/1.25.tar.gz" - sha256: "4326e2b5e04e459ab4522e83e19bff101a3faf9b085bcf46b6cabbd392cc4458" + url: "https://gitlab.freedesktop.org/wayland/wayland-protocols/-/archive/1.25/wayland-protocols-1.25.tar.bz2" + sha256: "633c9bed0efb8e773c5780d4442051264d179c154b7d1896ca3b56b5d4da4718" "1.24": - url: "https://github.com/wayland-project/wayland-protocols/archive/1.24.tar.gz" - sha256: "71a171f964e4fe25cede281a2939ac5298ddaba9a5dd8a217db66843a532d064" + url: "https://gitlab.freedesktop.org/wayland/wayland-protocols/-/archive/1.24/wayland-protocols-1.24.tar.bz2" + sha256: "a165e2da28197b1dcf97fd9ec06b16b030bdc5de6c92162c4b09026e62cfe8f9" "1.23": - url: "https://github.com/wayland-project/wayland-protocols/archive/1.23.tar.gz" - sha256: "1ffd6f90eb247ff79de50ac10490ed03100572fb571cebef4df9ec74a271b2af" + url: "https://gitlab.freedesktop.org/wayland/wayland-protocols/-/archive/1.23/wayland-protocols-1.23.tar.bz2" + sha256: "b860c692ff83b4bd6251dc74c579ced3a68ec0743b7af801ef3f501da3fde330" "1.21": - url: "https://github.com/wayland-project/wayland-protocols/archive/refs/tags/1.21.tar.gz" - sha256: "4cb4cd8c94534faf95243be957cd6b739b1a2d068218dc8f0762eac3d4707c04" + url: "https://gitlab.freedesktop.org/wayland/wayland-protocols/-/archive/1.21/wayland-protocols-1.21.tar.bz2" + sha256: "cf1a62195eb49622fc3c3eda440d0225ee49bd5aa9f1ee993c28fe0796dae783" diff --git a/recipes/wayland-protocols/all/conanfile.py b/recipes/wayland-protocols/all/conanfile.py index a31c28b9bbce5..6a19784308d45 100644 --- a/recipes/wayland-protocols/all/conanfile.py +++ b/recipes/wayland-protocols/all/conanfile.py @@ -1,4 +1,4 @@ -from conan import ConanFile +from conan import ConanFile, conan_version from conan.tools.env import VirtualBuildEnv from conan.tools.files import copy, get, replace_in_file, rmdir from conan.tools.layout import basic_layout @@ -7,17 +7,18 @@ from conan.errors import ConanInvalidConfiguration import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.64.0 <2 || >=2.2.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" + short_paths = True def package_id(self): self.info.clear() @@ -27,7 +28,7 @@ def validate(self): raise ConanInvalidConfiguration(f"{self.ref} only supports Linux") def build_requirements(self): - self.tool_requires("meson/0.64.1") + self.tool_requires("meson/1.3.0") def layout(self): basic_layout(self, src_folder="src") @@ -38,7 +39,8 @@ def source(self): def generate(self): tc = MesonToolchain(self) - tc.project_options["datadir"] = os.path.join(self.package_folder, "res") + # Using relative folder because of this https://github.com/conan-io/conan/pull/15706 + tc.project_options["datadir"] = "res" tc.project_options["tests"] = "false" tc.generate() virtual_build_env = VirtualBuildEnv(self) @@ -68,10 +70,10 @@ def package_info(self): 'datarootdir': '${prefix}/res', 'pkgdatadir': '${datarootdir}/wayland-protocols', } - self.cpp_info.set_property( - "pkg_config_custom_content", - "\n".join(f"{key}={value}" for key,value in pkgconfig_variables.items())) - + # TODO: Remove when Conan 1.x not supported + pkgconfig_variables = pkgconfig_variables if conan_version.major >= 2 \ + else "\n".join(f"{key}={value}" for key, value in pkgconfig_variables.items()) + self.cpp_info.set_property("pkg_config_custom_content", pkgconfig_variables) self.cpp_info.libdirs = [] self.cpp_info.includedirs = [] self.cpp_info.bindirs = [] diff --git a/recipes/wayland-protocols/all/test_package/conanfile.py b/recipes/wayland-protocols/all/test_package/conanfile.py index 37e15e8b2c559..d6a32dbe0d2d5 100644 --- a/recipes/wayland-protocols/all/test_package/conanfile.py +++ b/recipes/wayland-protocols/all/test_package/conanfile.py @@ -17,13 +17,13 @@ def _has_build_profile(self): def requirements(self): self.requires(self.tested_reference_str) - self.requires("wayland/1.21.0") + self.requires("wayland/1.22.0") def build_requirements(self): - self.tool_requires("meson/0.64.1") + self.tool_requires("meson/1.3.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") + self.tool_requires("pkgconf/2.1.0") + self.tool_requires("wayland/1.22.0") def layout(self): basic_layout(self) diff --git a/recipes/wayland-protocols/all/test_v1_package/conanfile.py b/recipes/wayland-protocols/all/test_v1_package/conanfile.py index 1edcdad3ee8ef..37376c2138077 100644 --- a/recipes/wayland-protocols/all/test_v1_package/conanfile.py +++ b/recipes/wayland-protocols/all/test_v1_package/conanfile.py @@ -10,7 +10,7 @@ class TestPackageConan(ConanFile): def build_requirements(self): self.build_requires("wayland/1.21.0") - self.build_requires("meson/0.64.1") + self.build_requires("meson/1.0.0") def requirements(self): self.requires("wayland/1.21.0") diff --git a/recipes/wayland-protocols/config.yml b/recipes/wayland-protocols/config.yml index 5a8aa4a9bbac3..08a4d22e31f12 100644 --- a/recipes/wayland-protocols/config.yml +++ b/recipes/wayland-protocols/config.yml @@ -1,4 +1,12 @@ versions: + "1.36": + folder: all + "1.33": + folder: all + "1.32": + folder: all + "1.31": + folder: all "1.27": folder: all "1.26": diff --git a/recipes/wayland/all/conandata.yml b/recipes/wayland/all/conandata.yml index b49acf6707671..fd05ff5a3e0d6 100644 --- a/recipes/wayland/all/conandata.yml +++ b/recipes/wayland/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "1.23.0": + url: "https://gitlab.freedesktop.org/wayland/wayland/-/releases/1.23.0/downloads/wayland-1.23.0.tar.xz" + sha256: "05b3e1574d3e67626b5974f862f36b5b427c7ceeb965cb36a4e6c2d342e45ab2" + "1.22.0": + url: "https://gitlab.freedesktop.org/wayland/wayland/-/releases/1.22.0/downloads/wayland-1.22.0.tar.xz" + sha256: "1540af1ea698a471c2d8e9d288332c7e0fd360c8f1d12936ebb7e7cbc2425842" "1.21.0": url: "https://gitlab.freedesktop.org/wayland/wayland/-/releases/1.21.0/downloads/wayland-1.21.0.tar.xz" sha256: "6dc64d7fc16837a693a51cfdb2e568db538bfdc9f457d4656285bb9594ef11ac" diff --git a/recipes/wayland/all/conanfile.py b/recipes/wayland/all/conanfile.py index 69f0aecd1c118..6f65f69cfb7a5 100644 --- a/recipes/wayland/all/conanfile.py +++ b/recipes/wayland/all/conanfile.py @@ -1,6 +1,6 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.env import VirtualBuildEnv, VirtualRunEnv from conan.tools.files import copy, get, replace_in_file, rmdir from conan.tools.gnu import PkgConfigDeps @@ -22,6 +22,7 @@ class WaylandConan(ConanFile): 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], @@ -42,37 +43,43 @@ def configure(self): 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.3") + self.requires("libffi/3.4.4") if self.options.enable_dtd_validation: - self.requires("libxml2/2.10.3") - self.requires("expat/2.5.0") + self.requires("libxml2/[>=2.12.5 <3]") + self.requires("expat/[>=2.6.2 <3]") def validate(self): - if self.info.settings.os != "Linux": + if self.settings.os != "Linux": raise ConanInvalidConfiguration(f"{self.ref} only supports Linux") def build_requirements(self): - self.tool_requires("meson/0.64.1") + self.tool_requires("meson/[>=1.4.0 <2]") 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("pkgconf/[>=2.2 <3]") + if not can_run(self): + 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 can_run(self): + env = VirtualRunEnv(self) + env.generate(scope="build") + pkg_config_deps = PkgConfigDeps(self) - if cross_building(self): + if not can_run(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()] + # 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" @@ -80,18 +87,12 @@ def generate(self): 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): + if not can_run(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() - env = VirtualBuildEnv(self) - env.generate() - if not cross_building(self): - env = VirtualRunEnv(self) - env.generate(scope="build") - def _patch_sources(self): replace_in_file(self, os.path.join(self.source_folder, "meson.build"), "subdir('tests')", "#subdir('tests')") @@ -173,8 +174,3 @@ def package_info(self): 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") - - # TODO: to remove in conan v2 - bindir = os.path.join(self.package_folder, "bin") - self.output.info(f"Appending PATH environment variable: {bindir}") - self.env_info.PATH.append(bindir) diff --git a/recipes/wayland/all/test_package/conanfile.py b/recipes/wayland/all/test_package/conanfile.py index c201ad68aff34..82a45a316a981 100644 --- a/recipes/wayland/all/test_package/conanfile.py +++ b/recipes/wayland/all/test_package/conanfile.py @@ -3,25 +3,18 @@ from conan import ConanFile 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" - 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") + self.tool_requires("pkgconf/[2.2 <3]") def layout(self): cmake_layout(self) @@ -32,21 +25,16 @@ def generate(self): 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): 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"] + pkg_config = PkgConfig(self, "wayland-scanner", self.generators_folder) + wayland_scanner = pkg_config.variables["wayland_scanner"] + if can_run(self): self.run(f"{wayland_scanner} --version", env="conanrun") def test(self): diff --git a/recipes/wayland/all/test_v1_package/conanfile.py b/recipes/wayland/all/test_v1_package/conanfile.py deleted file mode 100644 index e7b714f005817..0000000000000 --- a/recipes/wayland/all/test_v1_package/conanfile.py +++ /dev/null @@ -1,21 +0,0 @@ -import os - -from conan import ConanFile -from conan.tools.build import cross_building -from conans import CMake - - -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): - self.run("wayland-scanner --version", run_environment=True) - cmd = os.path.join(self.build_folder, "bin", "test_package") - self.run(cmd, run_environment=True) diff --git a/recipes/wayland/config.yml b/recipes/wayland/config.yml index 21b3598bd3d20..077dbaede856b 100644 --- a/recipes/wayland/config.yml +++ b/recipes/wayland/config.yml @@ -1,4 +1,8 @@ versions: + "1.23.0": + folder: all + "1.22.0": + folder: all "1.21.0": folder: all "1.20.0": diff --git a/recipes/websocketpp/all/conandata.yml b/recipes/websocketpp/all/conandata.yml index 0d6830659c436..f48a24b75f74d 100644 --- a/recipes/websocketpp/all/conandata.yml +++ b/recipes/websocketpp/all/conandata.yml @@ -6,7 +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" 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 11bf8a92665fc..8bc3d40999ef3 100644 --- a/recipes/websocketpp/all/conanfile.py +++ b/recipes/websocketpp/all/conanfile.py @@ -13,7 +13,7 @@ class WebsocketPPConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/zaphoyd/websocketpp" license = "BSD-3-Clause" - + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" options = { "asio": ["boost", "standalone", False], @@ -34,22 +34,21 @@ def layout(self): def requirements(self): if self.options.with_openssl: - self.requires("openssl/1.1.1s", transitive_headers=True, transitive_libs=True) + self.requires("openssl/[>=1.1 <4]", transitive_headers=True, transitive_libs=True) if self.options.with_zlib: - self.requires("zlib/1.2.13", transitive_headers=True, transitive_libs=True) + self.requires("zlib/[>=1.2.11 <2]", transitive_headers=True, transitive_libs=True) if self.options.asio == "standalone": - self.requires("asio/1.24.0", transitive_headers=True) + self.requires("asio/1.28.1", transitive_headers=True) elif self.options.asio == "boost": - self.requires("boost/1.80.0", transitive_headers=True) + self.requires("boost/1.83.0", transitive_headers=True) 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): apply_conandata_patches(self) 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/wg21-linear_algebra/all/conandata.yml b/recipes/wg21-linear_algebra/all/conandata.yml index ed955acfe45f0..8b447807d61bb 100644 --- a/recipes/wg21-linear_algebra/all/conandata.yml +++ b/recipes/wg21-linear_algebra/all/conandata.yml @@ -1,4 +1,4 @@ sources: - "0.7.2": - url: https://github.com/BobSteagall/wg21/archive/refs/tags/v0.7.2.tar.gz - sha256: 4a192d279491264be2d687f89c15432fcb4f2e2d113599152bd3df2df42ce9e1 + "0.7.3": + url: https://github.com/BobSteagall/wg21/archive/refs/tags/v0.7.3.tar.gz + sha256: ff4bc5788793e3c5f65d98f50029b4f762ffa38572867701053dacb572b85098 diff --git a/recipes/wg21-linear_algebra/all/conanfile.py b/recipes/wg21-linear_algebra/all/conanfile.py index 18df9664dab42..77b29cb972259 100644 --- a/recipes/wg21-linear_algebra/all/conanfile.py +++ b/recipes/wg21-linear_algebra/all/conanfile.py @@ -1,9 +1,12 @@ -from conans import ConanFile, 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.cmake import cmake_layout +from conan.tools.files import copy, get +from conan.tools.scm import Version -required_conan_version = ">=1.43.0" - +required_conan_version = ">=1.59.0" class LAConan(ConanFile): name = "wg21-linear_algebra" @@ -13,14 +16,11 @@ class LAConan(ConanFile): license = "NCSA" url = "https://github.com/conan-io/conan-center-index" settings = "os", "arch", "compiler", "build_type" + package_type = "header-library" no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" - def requirements(self): - self.requires("mdspan/0.1.0") + self.requires("mdspan/0.5.0") @property def _minimum_cpp_standard(self): @@ -30,40 +30,32 @@ def _minimum_cpp_standard(self): def _minimum_compilers_version(self): return { "Visual Studio": "16", - "gcc": "8", - "clang": "8", + "msvc": "192", + "gcc": "10", + "clang": "12", # Should be 11 but https://github.com/conan-io/conan-docker-tools/issues/251 "apple-clang": "11" } def validate(self): + compiler = self.settings.compiler 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)) + check_min_cppstd(self, self._minimum_cpp_standard) + min_version = self._minimum_compilers_version.get(str(compiler)) + if min_version and Version(self.settings.compiler.version) < min_version: + raise ConanInvalidConfiguration(f"{self.ref} requires at least {compiler} {min_version}") + + def layout(self): + cmake_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 package(self): - self.copy(pattern="*", dst="include", - src=os.path.join(self._source_subfolder, "include")) - self.copy("*LICENSE*", dst="licenses", keep_path=False) + copy(self, "LICENSE.txt", 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.set_property("cmake_file_name", "wg21_linear_algebra") diff --git a/recipes/wg21-linear_algebra/all/test_package/CMakeLists.txt b/recipes/wg21-linear_algebra/all/test_package/CMakeLists.txt index f17b9bfdd3170..61165ba3ffe02 100644 --- a/recipes/wg21-linear_algebra/all/test_package/CMakeLists.txt +++ b/recipes/wg21-linear_algebra/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(wg21_linear_algebra REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/wg21-linear_algebra/all/test_package/conanfile.py b/recipes/wg21-linear_algebra/all/test_package/conanfile.py index 9b63bd176646b..f7c2cd1e5e6ed 100644 --- a/recipes/wg21-linear_algebra/all/test_package/conanfile.py +++ b/recipes/wg21-linear_algebra/all/test_package/conanfile.py @@ -1,10 +1,18 @@ -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 +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/wg21-linear_algebra/all/test_package/test_package.cpp b/recipes/wg21-linear_algebra/all/test_package/test_package.cpp index e6eb293ce7222..9c94b3c914c33 100644 --- a/recipes/wg21-linear_algebra/all/test_package/test_package.cpp +++ b/recipes/wg21-linear_algebra/all/test_package/test_package.cpp @@ -1,11 +1,11 @@ -#include +#include using namespace STD_LA; int main() { - STD_LA::vector> v; - STD_LA::matrix> m; + STD_LA::fixed_size_matrix v; + STD_LA::fixed_size_matrix m; v*m; return EXIT_SUCCESS; diff --git a/recipes/wg21-linear_algebra/all/test_v1_package/CMakeLists.txt b/recipes/wg21-linear_algebra/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..daf2832b167b8 --- /dev/null +++ b/recipes/wg21-linear_algebra/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +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/wg21-linear_algebra/all/test_v1_package/conanfile.py b/recipes/wg21-linear_algebra/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..7e264aad8e8ec --- /dev/null +++ b/recipes/wg21-linear_algebra/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +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/wg21-linear_algebra/config.yml b/recipes/wg21-linear_algebra/config.yml index eb766ff2f024b..937a37094e188 100644 --- a/recipes/wg21-linear_algebra/config.yml +++ b/recipes/wg21-linear_algebra/config.yml @@ -1,3 +1,3 @@ versions: - "0.7.2": + "0.7.3": folder: all diff --git a/recipes/wglext/all/conanfile.py b/recipes/wglext/all/conanfile.py index 916b363760c68..7af57d6410b8e 100644 --- a/recipes/wglext/all/conanfile.py +++ b/recipes/wglext/all/conanfile.py @@ -1,37 +1,53 @@ import os -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, download, load, save +from conan.tools.layout import basic_layout + +required_conan_version = ">=1.52.0" -required_conan_version = ">=1.37.0" class WglextConan(ConanFile): name = "wglext" + description = "WGL extension interfaces" license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.khronos.org/registry/OpenGL/index_gl.php" - description = "WGL extension interfaces" - topics = ("opengl", "gl", "wgl", "wglext") + topics = ("opengl", "gl", "wgl", "wglext", "header-only") + + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - requires = "opengl/system" - settings = "os", + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("opengl/system") + + def package_id(self): + self.info.clear() def validate(self): if self.settings.os != "Windows": raise ConanInvalidConfiguration("wglext is only supported on Windows") def source(self): - tools.download(filename="wglext.h", **self.conan_data["sources"][self.version]) + download(self, filename="wglext.h", **self.conan_data["sources"][self.version]) - def package(self): - self.copy(pattern="wglext.h", dst=os.path.join("include", "GL")) - license_data = tools.load(os.path.join(self.source_folder, "wglext.h")) + def _extract_license(self): + license_data = load(self, os.path.join(self.source_folder, "wglext.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") + save(self, os.path.join(self.package_folder, "licenses", "LICENSE"), license_data) - def package_id(self): - self.info.header_only() + def package(self): + self._extract_license() + copy(self, pattern="wglext.h", dst=os.path.join(self.package_folder, "include", "GL"), src=self.source_folder) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/wglext/all/test_package/CMakeLists.txt b/recipes/wglext/all/test_package/CMakeLists.txt index 121f8f8e30a8e..06dc988df0340 100644 --- a/recipes/wglext/all/test_package/CMakeLists.txt +++ b/recipes/wglext/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(wglext REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) diff --git a/recipes/wglext/all/test_package/conanfile.py b/recipes/wglext/all/test_package/conanfile.py index 49a3a66ea5bad..ef5d7042163ec 100644 --- a/recipes/wglext/all/test_package/conanfile.py +++ b/recipes/wglext/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/whereami/all/CMakeLists.txt b/recipes/whereami/all/CMakeLists.txt index 9ad1b58bfdd92..4595ccd0654eb 100644 --- a/recipes/whereami/all/CMakeLists.txt +++ b/recipes/whereami/all/CMakeLists.txt @@ -1,14 +1,11 @@ -cmake_minimum_required(VERSION 3.4.3) +cmake_minimum_required(VERSION 3.12) project(whereami C) -include(conanbuildinfo.cmake) -conan_basic_setup() - if (WIN32 AND BUILD_SHARED_LIBS) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) endif() -set(WHEREAMI_SRC "${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder") +set(WHEREAMI_SRC "${CMAKE_CURRENT_SOURCE_DIR}/src") set(SOURCE_FILES ${WHEREAMI_SRC}/src/whereami.c) set(HEADER_FILES ${WHEREAMI_SRC}/src/whereami.h) @@ -17,9 +14,6 @@ add_library(${CMAKE_PROJECT_NAME} ${SOURCE_FILES} ${HEADER_FILES}) target_include_directories(${CMAKE_PROJECT_NAME} PUBLIC ${WHEREAMI_SRC}/src) set_property(TARGET ${CMAKE_PROJECT_NAME} PROPERTY C_STANDARD 99) -install(TARGETS ${CMAKE_PROJECT_NAME} - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib) - +include(GNUInstallDirs) +install(TARGETS ${CMAKE_PROJECT_NAME}) install(FILES ${HEADER_FILES} DESTINATION include) diff --git a/recipes/whereami/all/conanfile.py b/recipes/whereami/all/conanfile.py index 323a8747c8641..6035268b447ee 100644 --- a/recipes/whereami/all/conanfile.py +++ b/recipes/whereami/all/conanfile.py @@ -1,58 +1,64 @@ -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 copy, get + +required_conan_version = ">=1.53.0" class WhereamiConan(ConanFile): name = "whereami" description = "Locate the current executable and the current module/library on the file system" - topics = ("whereami", "introspection", "getmodulefilename", - "dladdr", "executable-path", "getexecutablepath") + license = ("MIT", "WTFPL") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/gpakosz/whereami" - license = ("MIT", "WTFPL") - 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} + topics = ("whereami", "introspection", "getmodulefilename", "dladdr", "executable-path", "getexecutablepath") - _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" + 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': + 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 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.configure() - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=self.export_sources_folder) cmake.build() def package(self): - self.copy(pattern="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() def package_info(self): diff --git a/recipes/whereami/all/test_package/CMakeLists.txt b/recipes/whereami/all/test_package/CMakeLists.txt index 7c0f4c847fb31..4789557edaa68 100644 --- a/recipes/whereami/all/test_package/CMakeLists.txt +++ b/recipes/whereami/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(whereami REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) diff --git a/recipes/whereami/all/test_package/conanfile.py b/recipes/whereami/all/test_package/conanfile.py index 49a3a66ea5bad..ef5d7042163ec 100644 --- a/recipes/whereami/all/test_package/conanfile.py +++ b/recipes/whereami/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/whereami/all/test_v1_package/CMakeLists.txt b/recipes/whereami/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/whereami/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/whereami/all/test_v1_package/conanfile.py b/recipes/whereami/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..49a3a66ea5bad --- /dev/null +++ b/recipes/whereami/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/whisper-cpp/all/conandata.yml b/recipes/whisper-cpp/all/conandata.yml new file mode 100644 index 0000000000000..09dcb08b0e9bb --- /dev/null +++ b/recipes/whisper-cpp/all/conandata.yml @@ -0,0 +1,15 @@ +sources: + "1.7.2": + url: "https://github.com/ggerganov/whisper.cpp/archive/refs/tags/v1.7.2.tar.gz" + sha256: "d48e1b5b6ee18b931e98ac791eba838f83eb3b81bb8917db37fe9a79fa5e3ccb" + "1.6.2": + url: "https://github.com/ggerganov/whisper.cpp/archive/refs/tags/v1.6.2.tar.gz" + sha256: "da7988072022acc3cfa61b370b3c51baad017f1900c3dc4e68cb276499f66894" + "1.5.2": + url: "https://github.com/ggerganov/whisper.cpp/archive/refs/tags/v1.5.2.tar.gz" + sha256: "be9c4d5d4b5f28f02e36f28e602b7d2dcfd734dd1c834ddae91ae8db601e951f" +patches: + "1.6.2": + - patch_file: "patches/1.6.2-0001-remove_hardcoded_cxxstd.patch" + patch_description: "Remove hardcoded CMAKE_CXX_STANDARD" + patch_type: "conan" diff --git a/recipes/whisper-cpp/all/conanfile.py b/recipes/whisper-cpp/all/conanfile.py new file mode 100644 index 0000000000000..7351a78bc7271 --- /dev/null +++ b/recipes/whisper-cpp/all/conanfile.py @@ -0,0 +1,215 @@ +import os + +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 +from conan.tools.scm import Version + +required_conan_version = ">=2.1" + + +class WhisperCppConan(ConanFile): + name = "whisper-cpp" + description = "High-performance inference of OpenAI's Whisper automatic speech recognition (ASR) model" + topics = ("whisper", "asr") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/ggerganov/whisper.cpp" + license = "MIT" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "sanitize_thread": [True, False], + "sanitize_address": [True, False], + "sanitize_undefined": [True, False], + "no_avx": [True, False], + "no_avx2": [True, False], + "no_fma": [True, False], + "no_f16c": [True, False], + "no_accelerate": [True, False], + "metal": [True, False], + "metal_ndebug": [True, False], + "with_coreml": [True, False], + "coreml_allow_fallback": [True, False], + "with_blas": [True, False], + "with_openvino": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "sanitize_thread": False, + "sanitize_address": False, + "sanitize_undefined": False, + "no_avx": False, + "no_avx2": False, + "no_fma": False, + "no_f16c": False, + "no_accelerate": False, + "metal": True, + "metal_ndebug": False, + "with_coreml": False, + "coreml_allow_fallback": False, + "with_blas": False, + "with_openvino": False, + } + package_type = "library" + + @property + def _min_cppstd(self): + return "14" + + @property + def _compilers_minimum_version(self): + return { + "14": { + "gcc": "9", + "clang": "5", + "apple-clang": "10", + "Visual Studio": "15", + "msvc": "191", + }, + }.get(self._min_cppstd, {}) + + @property + def _is_openvino_option_available(self): + return Version(self.version) >= "1.5.2" + + def config_options(self): + if is_apple_os(self): + del self.options.with_blas + else: + del self.options.metal + del self.options.metal_ndebug + del self.options.no_accelerate + del self.options.with_coreml + del self.options.coreml_allow_fallback + + if self.settings.os == "Windows": + del self.options.fPIC + + if not self._is_openvino_option_available: + del self.options.with_openvino + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + if is_apple_os(self): + if not self.options.with_coreml: + self.options.rm_safe("coreml_allow_fallback") + + 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." + ) + + def requirements(self): + if not is_apple_os(self): + if self.options.with_blas: + self.requires("openblas/0.3.24") + if self.options.get_safe("with_openvino"): + self.requires("openvino/2023.2.0") + + def layout(self): + cmake_layout(self, src_folder="src") + + def export_sources(self): + export_conandata_patches(self) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + deps = CMakeDeps(self) + deps.set_property("openblas", "cmake_file_name", "BLAS") + deps.generate() + + tc = CMakeToolchain(self) + tc.variables["WHISPER_BUILD_TESTS"] = False + tc.variables["WHISPER_BUILD_EXAMPLES"] = False + + if self.options.shared: + tc.variables["BUILD_SHARED_LIBS"] = True + if self.options.sanitize_thread: + tc.variables["WHISPER_SANITIZE_THREAD"] = True + if self.options.sanitize_address: + tc.variables["WHISPER_SANITIZE_ADDRESS"] = True + if self.options.sanitize_undefined: + tc.variables["WHISPER_SANITIZE_UNDEFINED"] = True + if self.options.no_avx: + tc.variables["WHISPER_NO_AVX"] = True + if self.options.no_avx2: + tc.variables["WHISPER_NO_AVX2"] = True + if self.options.no_fma: + tc.variables["WHISPER_NO_FMA"] = True + if self.options.no_f16c: + tc.variables["WHISPER_NO_F16C"] = True + + # TODO: Implement OpenMP support + tc.variables["GGML_OPENMP"] = False + + if self.options.get_safe("with_openvino"): + tc.variables["WHISPER_OPENVINO"] = True + # TODO: remove with Conan 1.x support + tc.variables["CMAKE_CXX_STANDARD"] = str(self.settings.get_safe("compiler.cppstd", 11)).replace("gnu", "") + + if is_apple_os(self): + if self.options.no_accelerate: + tc.variables["WHISPER_NO_ACCELERATE"] = True + if self.options.get_safe("metal_ndebug"): + tc.variables["WHISPER_METAL_NDEBUG"] = True + if self.options.with_coreml: + tc.variables["WHISPER_COREML"] = True + if self.options.coreml_allow_fallback: + tc.variables["WHISPER_COREML_ALLOW_FALLBACK"] = True + if Version(self.version) >= "1.7.0": + tc.variables["GGML_METAL"] = self.options.metal + else: + tc.variables["WHISPER_METAL"] = self.options.metal + else: + if self.options.with_blas: + if Version(self.version) >= "1.4.2": + tc.variables["WHISPER_OPENBLAS"] = True + else: + tc.variables["WHISPER_SUPPORT_OPENBLAS"] = 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() + copy(self, "*", os.path.join(self.source_folder, "models"), os.path.join(self.package_folder, "res", "models")) + + def package_info(self): + self.cpp_info.libs = ["whisper"] + if Version(self.version) >= "1.7.0": + self.cpp_info.libs.append("ggml") + self.cpp_info.resdirs = ["res"] + self.cpp_info.libdirs = ["lib", "lib/static"] + + if self.options.get_safe("with_openvino"): + self.cpp_info.requires = ["openvino::Runtime"] + + if is_apple_os(self): + if not self.options.no_accelerate: + self.cpp_info.frameworks.append("Accelerate") + if self.options.with_coreml: + self.cpp_info.frameworks.append("CoreML") + if self.options.get_safe("metal"): + self.cpp_info.frameworks.extend(["CoreFoundation", "Foundation", "Metal", "MetalKit"]) + elif self.settings.os in ("Linux", "FreeBSD"): + self.cpp_info.system_libs.extend(["dl", "m", "pthread"]) diff --git a/recipes/whisper-cpp/all/patches/1.6.2-0001-remove_hardcoded_cxxstd.patch b/recipes/whisper-cpp/all/patches/1.6.2-0001-remove_hardcoded_cxxstd.patch new file mode 100644 index 0000000000000..9e041fd99d19b --- /dev/null +++ b/recipes/whisper-cpp/all/patches/1.6.2-0001-remove_hardcoded_cxxstd.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 82913aa..f3a2d27 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -125,8 +125,6 @@ find_package(Threads REQUIRED) + #compile flag sycl + if (WHISPER_SYCL) + set(CMAKE_CXX_STANDARD 17) +-else() +- set(CMAKE_CXX_STANDARD 11) + endif() + + if (WHISPER_FFMPEG) diff --git a/recipes/whisper-cpp/all/test_package/CMakeLists.txt b/recipes/whisper-cpp/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..6a90512af2d73 --- /dev/null +++ b/recipes/whisper-cpp/all/test_package/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.15) + +project(test_package CXX) # if the project uses c++ + +find_package(whisper-cpp REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE whisper-cpp::whisper-cpp) + + +add_custom_command(TARGET test_package POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_directory + ${whisper-cpp_INCLUDE_DIR}/../res/models + ${CMAKE_CURRENT_BINARY_DIR}/models) diff --git a/recipes/whisper-cpp/all/test_package/conanfile.py b/recipes/whisper-cpp/all/test_package/conanfile.py new file mode 100644 index 0000000000000..7d2de09164073 --- /dev/null +++ b/recipes/whisper-cpp/all/test_package/conanfile.py @@ -0,0 +1,28 @@ +import os + +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake + + +# 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/whisper-cpp/all/test_package/test_package.cpp b/recipes/whisper-cpp/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..1bc036b7b08b7 --- /dev/null +++ b/recipes/whisper-cpp/all/test_package/test_package.cpp @@ -0,0 +1,17 @@ +#include +#include +#include +#include "whisper.h" + + +int main() { + auto context = std::unique_ptr( + whisper_init_from_file("models/for-tests-ggml-base.en.bin"), &whisper_free); + + if (context == nullptr) { + std::cout << "Failed to initialize whisper context!" << std::endl; + return 3; + } + + return EXIT_SUCCESS; +} diff --git a/recipes/whisper-cpp/config.yml b/recipes/whisper-cpp/config.yml new file mode 100644 index 0000000000000..de09f794ed1f1 --- /dev/null +++ b/recipes/whisper-cpp/config.yml @@ -0,0 +1,7 @@ +versions: + "1.7.2": + folder: "all" + "1.6.2": + folder: "all" + "1.5.2": + folder: "all" diff --git a/recipes/wide-integer/all/conandata.yml b/recipes/wide-integer/all/conandata.yml new file mode 100644 index 0000000000000..8e3a196e3ef2e --- /dev/null +++ b/recipes/wide-integer/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "cci.20231015": + url: "https://github.com/ckormanyos/wide-integer/archive/4c9711b463431c5b64c680444f35183c053be735.tar.gz" + sha256: "db5e5491d22fb5f1b9dd3ad6839e479e7d26670764d8e629cbc0b6a5f1b8c47d" diff --git a/recipes/wide-integer/all/conanfile.py b/recipes/wide-integer/all/conanfile.py new file mode 100644 index 0000000000000..b8ab834969f4b --- /dev/null +++ b/recipes/wide-integer/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.files import get, copy +from conan.tools.layout import basic_layout +from conan.tools.scm import Version +import os + +required_conan_version = ">=1.53.0" + +class WideIntegerConan(ConanFile): + name = "wide-integer" + description = "Wide-Integer implements a generic C++ template for uint128_t, uint256_t, uint512_t, uint1024_t, etc." + license = "BSL-1.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/ckormanyos/wide-integer/" + topics = ("arbitary-precision", "multiprecision", "big-integer", "header-only") + package_type = "header-library" + 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": "190", + "gcc": "5", + "clang": "5", + "apple-clang": "5.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"): + 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_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", "math"), + src=os.path.join(self.source_folder, "math"), + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/wide-integer/all/test_package/CMakeLists.txt b/recipes/wide-integer/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..8e666755a1135 --- /dev/null +++ b/recipes/wide-integer/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(wide-integer REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE wide-integer::wide-integer) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/wide-integer/all/test_package/conanfile.py b/recipes/wide-integer/all/test_package/conanfile.py new file mode 100644 index 0000000000000..e845ae751a301 --- /dev/null +++ b/recipes/wide-integer/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/wide-integer/all/test_package/test_package.cpp b/recipes/wide-integer/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..5b9232349b7ab --- /dev/null +++ b/recipes/wide-integer/all/test_package/test_package.cpp @@ -0,0 +1,13 @@ +#include + +int main(void) { + using math::wide_integer::uint256_t; + + uint256_t a("0xF4DF741DE58BCB2F37F18372026EF9CBCFC456CB80AF54D53BDEED78410065DE"); + uint256_t b("0x166D63E0202B3D90ECCEAA046341AB504658F55B974A7FD63733ECF89DD0DF75"); + + uint256_t c = (a * b); + uint256_t d = (a / b); + + return 0; +} diff --git a/recipes/wide-integer/config.yml b/recipes/wide-integer/config.yml new file mode 100644 index 0000000000000..6fb64b738b18e --- /dev/null +++ b/recipes/wide-integer/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20231015": + folder: all diff --git a/recipes/wil/all/conandata.yml b/recipes/wil/all/conandata.yml new file mode 100644 index 0000000000000..4dda604c7c75a --- /dev/null +++ b/recipes/wil/all/conandata.yml @@ -0,0 +1,33 @@ +sources: + "1.0.240803.1": + url: "https://github.com/microsoft/wil/archive/refs/tags/v1.0.240803.1.tar.gz" + sha256: "39910ab105c6df345e4018a2b61dfbc909a8816c971a3d2cebbefa1f8c481cc6" + "1.0.240122.1": + url: "https://github.com/microsoft/wil/archive/refs/tags/v1.0.240122.1.tar.gz" + sha256: "e599f2843c01b9e4827e46f11d3651180675c8ecdbba8bdae735f533672989d3" + "1.0.231216.1": + url: "https://github.com/microsoft/wil/archive/refs/tags/v1.0.231216.1.tar.gz" + sha256: "4c15ba5e357f19449222b89f6e34d590d9d3f3d67e704a5cc5f4caa74228dd7e" + "1.0.231028.1": + url: "https://github.com/microsoft/wil/archive/refs/tags/v1.0.231028.1.tar.gz" + sha256: "ac18bc7638f32ec2468bbde1f40153204ad9ae9016058720440bc8f5449f48c5" + "1.0.230824.2": + url: "https://github.com/microsoft/wil/archive/refs/tags/v1.0.230824.2.tar.gz" + sha256: "15c6f90653fe91d2ab3c0c010735aee629c80519b4237611344f2e623f06aad2" + "1.0.230629.1": + url: "https://github.com/microsoft/wil/archive/refs/tags/v1.0.230629.1.tar.gz" + sha256: "c0d9ad1f295e181aa28d7c9b219e7d530e6bc4b7533317be50e7eae760c8d63f" + "1.0.230411.1": + url: "https://github.com/microsoft/wil/archive/refs/tags/v1.0.230411.1.tar.gz" + sha256: "03742849f5cb458fcfe8d30ff7afb6ff4bd67fe3aee3768cd6fb1140c59fcfd3" + "1.0.230202.1": + url: "https://github.com/microsoft/wil/archive/refs/tags/v1.0.230202.1.tar.gz" + sha256: "7bf01e9d93fb93f0fe2614492fac4a423b3a97b435015db74f5ac4a0270ebc8a" +patches: + "1.0.230202.1": + - patch_file: "patches/1.0.230202.1-0001-fix-type-conversion.patch" + patch_description: "Explicitly writing the type instead of using decltype" + patch_source: | + https://github.com/microsoft/wil/issues/302#issuecomment-1482117200 + https://github.com/microsoft/wil/pull/316 + patch_type: portability diff --git a/recipes/wil/all/conanfile.py b/recipes/wil/all/conanfile.py new file mode 100644 index 0000000000000..f54643102b43b --- /dev/null +++ b/recipes/wil/all/conanfile.py @@ -0,0 +1,92 @@ +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 WilConan(ConanFile): + name = "wil" + description = ( + "The Windows Implementation Libraries (WIL) is a header-only C++ library" + "created to make life easier for developers on Windows through readable" + "type-safe C++ interfaces for common Windows coding patterns." + ) + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/microsoft/wil" + topics = ("win", "wil", "header-only") + package_type = "header-library" + # only arch is aplicable, windows library + settings = "os", "arch", "compiler", "build_type" + + no_copy_source = True + + @property + def _min_cppstd(self): + return 11 + + @property + def _compilers_minimum_version(self): + # About compiler version: https://github.com/microsoft/wil/issues/207#issuecomment-991722592 + return { + "Visual Studio": "15", + "msvc": "191" + } + + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() # same package ID for any package + + def validate(self): + 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." + ) + + if self.settings.os != "Windows": + raise ConanInvalidConfiguration(f"{self.ref} can be used only on Windows.") + + 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="*.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 + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + # https://github.com/microsoft/wil/blob/56e3e5aa79234f8de3ceeeaf05b715b823bc2cca/CMakeLists.txt#L53 + self.cpp_info.set_property("cmake_file_name", "wil") + self.cpp_info.set_property("cmake_target_name", "WIL::WIL") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "wil" + self.cpp_info.filenames["cmake_find_package_multi"] = "wil" + self.cpp_info.names["cmake_find_package"] = "WIL" + self.cpp_info.names["cmake_find_package_multi"] = "WIL" diff --git a/recipes/wil/all/patches/1.0.230202.1-0001-fix-type-conversion.patch b/recipes/wil/all/patches/1.0.230202.1-0001-fix-type-conversion.patch new file mode 100644 index 0000000000000..3144a0ddbd304 --- /dev/null +++ b/recipes/wil/all/patches/1.0.230202.1-0001-fix-type-conversion.patch @@ -0,0 +1,11 @@ +--- a/include/wil/resource.h ++++ b/include/wil/resource.h +@@ -2547,7 +2547,7 @@ namespace wil + } + + template +- using unique_private_namespace = unique_any_handle_null_only), &details::ClosePrivateNamespaceHelper>; ++ using unique_private_namespace = unique_any_handle_null_only>; + + using unique_private_namespace_close = unique_private_namespace<>; + using unique_private_namespace_destroy = unique_private_namespace; diff --git a/recipes/wil/all/test_package/CMakeLists.txt b/recipes/wil/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..69bc898ac6c03 --- /dev/null +++ b/recipes/wil/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(wil REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE WIL::WIL) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/wil/all/test_package/conanfile.py b/recipes/wil/all/test_package/conanfile.py new file mode 100644 index 0000000000000..48499fa0989d9 --- /dev/null +++ b/recipes/wil/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/wil/all/test_package/test_package.cpp b/recipes/wil/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..73b8b076ec5af --- /dev/null +++ b/recipes/wil/all/test_package/test_package.cpp @@ -0,0 +1,12 @@ +#include +#include +#include "wil/resource.h" + + +int main(void) { + SetLastError(42); + // check for simple function call: + auto error42 = wil::last_error_context(); + + return EXIT_SUCCESS; +} diff --git a/recipes/wil/all/test_v1_package/CMakeLists.txt b/recipes/wil/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..9d54a092e0a67 --- /dev/null +++ b/recipes/wil/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/wil/all/test_v1_package/conanfile.py b/recipes/wil/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..c492184eec19c --- /dev/null +++ b/recipes/wil/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/wil/config.yml b/recipes/wil/config.yml new file mode 100644 index 0000000000000..67c36e1a1f315 --- /dev/null +++ b/recipes/wil/config.yml @@ -0,0 +1,17 @@ +versions: + "1.0.240803.1": + folder: "all" + "1.0.240122.1": + folder: "all" + "1.0.231216.1": + folder: "all" + "1.0.231028.1": + folder: "all" + "1.0.230824.2": + folder: "all" + "1.0.230629.1": + folder: "all" + "1.0.230411.1": + folder: "all" + "1.0.230202.1": + folder: "all" diff --git a/recipes/wildcards/all/conandata.yml b/recipes/wildcards/all/conandata.yml new file mode 100644 index 0000000000000..466e54e9a7c61 --- /dev/null +++ b/recipes/wildcards/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.4.0": + url: "https://github.com/zemasoft/wildcards/archive/refs/tags/v1.4.0.tar.gz" + sha256: "da8846215df2c1493e9796392d9e17ca2da8cfeae0f718fe1d6e0544cbcfaa0f" diff --git a/recipes/wildcards/all/conanfile.py b/recipes/wildcards/all/conanfile.py new file mode 100644 index 0000000000000..ea532ea715b2a --- /dev/null +++ b/recipes/wildcards/all/conanfile.py @@ -0,0 +1,53 @@ +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +import os + + +required_conan_version = ">=1.52.0" + + +class PackageConan(ConanFile): + name = "wildcards" + description = "A simple C++ header-only template library implementing matching using wildcards" + license = "BSL-1.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/zemasoft/wildcards" + topics = ("template", "header-only") + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + def layout(self): + cmake_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], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["WILDCARDS_BUILD_TESTS"] = False + tc.variables["WILDCARDS_BUILD_EXAMPLES"] = False + tc.generate() + + def build(self): + # INFO: Wildcards uses CMake to generate wildcards.hpp + cmake = CMake(self) + cmake.configure() + + def package(self): + copy(self, "LICENSE_1_0.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", "wildcards")) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.includedirs.append(os.path.join("include", "wildcards")) diff --git a/recipes/wildcards/all/test_package/CMakeLists.txt b/recipes/wildcards/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..5d849260e8ce8 --- /dev/null +++ b/recipes/wildcards/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(wildcards REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE wildcards::wildcards) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/wildcards/all/test_package/conanfile.py b/recipes/wildcards/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/wildcards/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/wildcards/all/test_package/test_package.cpp b/recipes/wildcards/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..076aaeb8e51e2 --- /dev/null +++ b/recipes/wildcards/all/test_package/test_package.cpp @@ -0,0 +1,10 @@ +#include + +#include "wildcards.hpp" + + +int main(void) { + wildcards::match("Hello, World!", "H*World?"); + + return EXIT_SUCCESS; +} diff --git a/recipes/wildcards/config.yml b/recipes/wildcards/config.yml new file mode 100644 index 0000000000000..c957e4bc2d3c7 --- /dev/null +++ b/recipes/wildcards/config.yml @@ -0,0 +1,3 @@ +versions: + "1.4.0": + folder: all 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..4648d8d359fa3 --- /dev/null +++ b/recipes/wildmidi/all/conanfile.py @@ -0,0 +1,97 @@ +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") + 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") + 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" + self.cpp_info.components["libwildmidi"].set_property("cmake_target_name", "WildMidi::libwildmidi") + self.cpp_info.components["libwildmidi"].set_property("pkg_config_name", "wildmidi") 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/wilzegers-autotest/all/conanfile.py b/recipes/wilzegers-autotest/all/conanfile.py index 8ef12a62b9ce4..81cb48532fdf0 100644 --- a/recipes/wilzegers-autotest/all/conanfile.py +++ b/recipes/wilzegers-autotest/all/conanfile.py @@ -1,36 +1,70 @@ -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration import os -requires_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.files import copy, get +from conan.tools.layout import basic_layout +from conan.tools.scm import Version + +required_conan_version = ">=1.52.0" class WilzegersAutotestConan(ConanFile): name = "wilzegers-autotest" + description = "Autotest facilitates the testing of class interfaces" license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://gitlab.com/wilzegers/autotest" - description = "Autotest facilitates the testing of class interfaces" - topics = ("autotest", "testing") - settings = "compiler" + topics = ("autotest", "testing", "header-only") + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 17 - def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + @property + def _compilers_minimum_version(self): + return { + "Visual Studio": "15", + "msvc": "191", + "gcc": "7", + "clang": "5.0", + "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"): + 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.compiler != "clang": raise ConanInvalidConfiguration("Only clang allowed") - def package_id(self): - self.info.header_only() + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): - self.copy("*.hpp", src=os.path.join(self._source_subfolder, "autotest/include"), dst="include") - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) + copy(self, "*.hpp", + src=os.path.join(self.source_folder, "autotest/include"), + dst=os.path.join(self.package_folder, "include")) + copy(self, "LICENSE", + 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/wilzegers-autotest/all/test_package/CMakeLists.txt b/recipes/wilzegers-autotest/all/test_package/CMakeLists.txt index 041b6ec23c708..a64b138191fa5 100644 --- a/recipes/wilzegers-autotest/all/test_package/CMakeLists.txt +++ b/recipes/wilzegers-autotest/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.15) +project(test_package LANGUAGES CXX) find_package(wilzegers-autotest REQUIRED CONFIG) diff --git a/recipes/wilzegers-autotest/all/test_package/conanfile.py b/recipes/wilzegers-autotest/all/test_package/conanfile.py index 49a3a66ea5bad..fae501d0afb9e 100644 --- a/recipes/wilzegers-autotest/all/test_package/conanfile.py +++ b/recipes/wilzegers-autotest/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" + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/wilzegers-autotest/all/test_package/test_package.cpp b/recipes/wilzegers-autotest/all/test_package/test_package.cpp index 152f5d33d3410..26e0bb71eb0f0 100644 --- a/recipes/wilzegers-autotest/all/test_package/test_package.cpp +++ b/recipes/wilzegers-autotest/all/test_package/test_package.cpp @@ -1,3 +1,6 @@ +// Workaround for a missing include in wilzegers-autotest/cci.20200921 +#include + #include #include diff --git a/recipes/wilzegers-autotest/all/test_v1_package/CMakeLists.txt b/recipes/wilzegers-autotest/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/wilzegers-autotest/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/wilzegers-autotest/all/test_v1_package/conanfile.py b/recipes/wilzegers-autotest/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..49a3a66ea5bad --- /dev/null +++ b/recipes/wilzegers-autotest/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/wineditline/all/CMakeLists.txt b/recipes/wineditline/all/CMakeLists.txt deleted file mode 100644 index 1fedb144d2f6c..0000000000000 --- a/recipes/wineditline/all/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -cmake_minimum_required(VERSION 3.1) - -project(WinEditLineWrapper C) - -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup(TARGETS) - -add_subdirectory(source_subfolder) diff --git a/recipes/wineditline/all/conandata.yml b/recipes/wineditline/all/conandata.yml index 789f36bc66156..d9e2a2c6f39a9 100644 --- a/recipes/wineditline/all/conandata.yml +++ b/recipes/wineditline/all/conandata.yml @@ -1,8 +1,4 @@ sources: "2.206": sha256: "2d255c417244e963261dc6171684265f405df030e90ba6e6690a99284d645161" - url: https://sourceforge.net/projects/mingweditline/files/wineditline-2.206.zip/download -patches: - "2.206": - - patch_file: patches/0001-fix-cmakelists.patch - base_path: source_subfolder + url: "https://sourceforge.net/projects/mingweditline/files/wineditline-2.206.zip" diff --git a/recipes/wineditline/all/conanfile.py b/recipes/wineditline/all/conanfile.py index 3888bf2a8557f..1a01961f91168 100644 --- a/recipes/wineditline/all/conanfile.py +++ b/recipes/wineditline/all/conanfile.py @@ -1,64 +1,63 @@ -import functools import os -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 copy, get -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class WineditlineConan(ConanFile): name = "wineditline" - description = ( - "A BSD-licensed EditLine API implementation for the native " - "Windows Console" - ) + description = "A BSD-licensed EditLine API implementation for the native Windows Console" + license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "http://mingweditline.sourceforge.net/" topics = ("readline", "editline", "windows") - license = "BSD-3-Clause" - generators = ("cmake",) - settings = ("os", "arch", "compiler", "build_type") + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], } default_options = { "shared": False, } - exports_sources = ("patches/*", "CMakeLists.txt") + provides = "editline" + + @property + def _target_name(self): + return "edit" if self.options.shared else "edit_static" + + def configure(self): + 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 self.settings.os != "Windows": - message = "wineditline is supported only on Windows." - raise ConanInvalidConfiguration(message) - - @property - def _source_subfolder(self): - return "source_subfolder" + raise ConanInvalidConfiguration(f"{self.ref} is supported only on Windows.") 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], strip_root=True) - def configure(self): - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + def generate(self): + tc = CMakeToolchain(self) + tc.generate() - @functools.lru_cache(1) - def _configure_cmake(self): + def build(self): cmake = CMake(self) cmake.configure() - return cmake - - def build(self): - for patch in self.conan_data["patches"][self.version]: - tools.patch(**patch) - self._configure_cmake().build() + cmake.build(target=self._target_name) def package(self): - self.copy("COPYING", "licenses", self._source_subfolder) - self._configure_cmake().install() + copy(self, "COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, "*.h", dst=os.path.join(self.package_folder, "include", "editline"), src=os.path.join(self.source_folder, "src", "editline")) + copy(self, "*.lib", dst=os.path.join(self.package_folder, "lib"), src=self.build_folder, keep_path=False) + copy(self, "*.dll", dst=os.path.join(self.package_folder, "bin"), src=self.build_folder, keep_path=False) def package_info(self): - self.cpp_info.libs = ["edit"] + self.cpp_info.libs = [self._target_name] diff --git a/recipes/wineditline/all/patches/0001-fix-cmakelists.patch b/recipes/wineditline/all/patches/0001-fix-cmakelists.patch deleted file mode 100644 index ef01b0ca0616b..0000000000000 --- a/recipes/wineditline/all/patches/0001-fix-cmakelists.patch +++ /dev/null @@ -1,43 +0,0 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -1,25 +1,16 @@ --cmake_minimum_required (VERSION 2.6) --project (WinEditLine) --set (WinEditLine_VERSION_MAJOR 2) --set (WinEditLine_VERSION_MINOR 2) --if (MSVC AND MSVC_USE_STATIC_RUNTIME) --foreach(flag_var -- CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE -- CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO) -- if(${flag_var} MATCHES "/MD") -- string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") -- endif(${flag_var} MATCHES "/MD") --endforeach(flag_var) --endif() --if(NOT DEFINED LIB_SUFFIX) -- if(CMAKE_SIZEOF_VOID_P MATCHES 4) -- set(LIB_SUFFIX "32") -- else() -- set(LIB_SUFFIX "64") -- endif() --endif() --configure_file ( -- "${PROJECT_SOURCE_DIR}/src/config.h.in" -- "${PROJECT_BINARY_DIR}/config.h" -+cmake_minimum_required(VERSION 3.1) -+ -+project(WinEditLine C) -+ -+add_library(edit src/editline.c src/fn_complete.c src/history.c src/libedit.def) -+target_include_directories(edit PRIVATE src) -+ -+include(GNUInstallDirs) -+ -+install( -+ TARGETS edit -+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" -+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" - ) --add_subdirectory (src) -+ -+install(DIRECTORY src/editline DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") diff --git a/recipes/wineditline/all/test_package/CMakeLists.txt b/recipes/wineditline/all/test_package/CMakeLists.txt index 84a38c545c793..3d8aa097f7a2f 100644 --- a/recipes/wineditline/all/test_package/CMakeLists.txt +++ b/recipes/wineditline/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(wineditline REQUIRED CONFIG) add_executable(test_package test_package.c) diff --git a/recipes/wineditline/all/test_package/conanfile.py b/recipes/wineditline/all/test_package/conanfile.py index ec80e0c5cc134..ef5d7042163ec 100644 --- a/recipes/wineditline/all/test_package/conanfile.py +++ b/recipes/wineditline/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 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/wineditline/all/test_package/test_package.c b/recipes/wineditline/all/test_package/test_package.c index b51e6feba3274..452b5269fcee7 100644 --- a/recipes/wineditline/all/test_package/test_package.c +++ b/recipes/wineditline/all/test_package/test_package.c @@ -1,12 +1,7 @@ #include #include -int main(int argc, char const* argv[]) -{ - (void)argc; - (void)argv; - - free_history_entry(NULL); - - return 0; +int main() { + free_history_entry(NULL); + return 0; } diff --git a/recipes/wineditline/all/test_v1_package/CMakeLists.txt b/recipes/wineditline/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/wineditline/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/wineditline/all/test_v1_package/conanfile.py b/recipes/wineditline/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..ec80e0c5cc134 --- /dev/null +++ b/recipes/wineditline/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +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/winflexbison/all/conandata.yml b/recipes/winflexbison/all/conandata.yml index c1a75693f1653..44c1f53fdafb9 100644 --- a/recipes/winflexbison/all/conandata.yml +++ b/recipes/winflexbison/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.5.25": + url: "https://github.com/lexxmark/winflexbison/archive/v2.5.25.tar.gz" + sha256: "8e1b71e037b524ba3f576babb0cf59182061df1f19cd86112f085a882560f60b" "2.5.24": url: "https://github.com/lexxmark/winflexbison/archive/v2.5.24.tar.gz" sha256: "a49d6e310636e3487e1e066e411d908cfeae2d5b5fde1f3cf74fe1d6d4301062" @@ -6,6 +9,8 @@ sources: url: "https://github.com/lexxmark/winflexbison/archive/v2.5.22.tar.gz" sha256: "697c2c4af3308625605b75498bd63a9a294660f8e43a4c35452cf4334fa4a530" patches: + "2.5.25": + - patch_file: "patches/0001-2.5.25-mingw-support.patch" "2.5.24": - patch_file: "patches/0001-2.5.24-mingw-support.patch" "2.5.22": 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/patches/0001-2.5.25-mingw-support.patch b/recipes/winflexbison/all/patches/0001-2.5.25-mingw-support.patch new file mode 100644 index 0000000000000..54af813f75263 --- /dev/null +++ b/recipes/winflexbison/all/patches/0001-2.5.25-mingw-support.patch @@ -0,0 +1,177 @@ +--- bison/src/config.h ++++ bison/src/config.h +@@ -1,1 +1,2 @@ ++#pragma once + #define PACKAGE_BUGREPORT "https://github.com/lexxmark/winflexbison/issues" +--- bison/src/conflicts.c ++++ bison/src/conflicts.c +@@ -30,7 +30,7 @@ + #include "getargs.h" + #include "gram.h" + #include "lalr.h" +-#include "lr0.h" ++#include "LR0.h" + #include "print-xml.h" + #include "reader.h" + #include "state.h" +--- bison/src/lalr.c ++++ bison/src/lalr.c +@@ -33,7 +33,7 @@ + #include "getargs.h" + #include "gram.h" + #include "lalr.h" +-#include "lr0.h" ++#include "LR0.h" + #include "muscle-tab.h" + #include "nullable.h" + #include "reader.h" +--- bison/src/LR0.c ++++ bison/src/LR0.c +@@ -32,7 +32,7 @@ + #include "getargs.h" + #include "gram.h" + #include "lalr.h" +-#include "lr0.h" ++#include "LR0.h" + #include "reader.h" + #include "reduce.h" + #include "state.h" +--- bison/src/main.c ++++ bison/src/main.c +@@ -45,7 +45,7 @@ + #include "gram.h" + #include "ielr.h" + #include "lalr.h" +-#include "lr0.h" ++#include "LR0.h" + #include "muscle-tab.h" + #include "nullable.h" + #include "output.h" +--- bison/src/print.c ++++ bison/src/print.c +@@ -35,7 +35,7 @@ + #include "getargs.h" + #include "gram.h" + #include "lalr.h" +-#include "lr0.h" ++#include "LR0.h" + #include "muscle-tab.h" + #include "reader.h" + #include "reduce.h" +--- bison/src/print-graph.c ++++ bison/src/print-graph.c +@@ -31,7 +31,7 @@ + #include "gram.h" + #include "graphviz.h" + #include "lalr.h" +-#include "lr0.h" ++#include "LR0.h" + #include "reader.h" + #include "state.h" + #include "symtab.h" +--- bison/src/print-xml.c ++++ bison/src/print-xml.c +@@ -37,1 +37,1 @@ +-#include "lr0.h" ++#include "LR0.h" +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -2,23 +2,23 @@ + + project (winflexbison) + +-if(NOT MSVC) +- message( FATAL_ERROR "Visual Studio Build supported only" ) ++if(MSVC) ++ add_definitions(-D_CRT_SECURE_NO_WARNINGS) + endif() + +-add_definitions(-D_CRT_SECURE_NO_WARNINGS) ++ + + if(CMAKE_BUILD_TYPE STREQUAL "Debug") + add_definitions(-D_DEBUG) + endif() + + # next line needed for compile in C (nor CPP) mode (ucrt headers bug) + add_definitions(-Dinline=__inline) + # next line needed for VS2017 only + add_definitions(-Drestrict=__restrict) + +-set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /W3 /MD /Od /Zi /EHsc") +-set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /W3 /GL /Od /Oi /Gy /Zi /EHsc") ++#set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /W3 /MD /Od /Zi /EHsc") ++#set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /W3 /GL /Od /Oi /Gy /Zi /EHsc") + + # Define Release by default. + if(NOT CMAKE_BUILD_TYPE) +--- common/CMakeLists.txt ++++ common/CMakeLists.txt +@@ -4,6 +4,12 @@ + + project(${PROJECT_NAME} C) + ++include(CheckSymbolExists) ++check_symbol_exists(nanouptime "sys/time.h" HAVE_NANOUPTIME) ++check_symbol_exists(clock_gettime "time.h" HAVE_CLOCK_GETTIME) ++check_symbol_exists(microuptime "sys/time.h" HAVE_MICROUPTIME) ++check_symbol_exists(timespec_get "time.h" HAVE_TIMESPEC_GET) ++ + # Definition of Macros + add_definitions(-D_LIB) + +@@ -31,3 +37,9 @@ + add_library(${PROJECT_NAME} STATIC + ${SOURCE_FILES} + ) ++target_compile_definitions(${PROJECT_NAME} PRIVATE ++ $<$:HAVE_NANOUPTIME=1> ++ $<$:HAVE_CLOCK_GETTIME=1> ++ $<$:HAVE_MICROUPTIME=1> ++ $<$:HAVE_TIMESPEC_GET=1> ++) +--- common/m4/lib/clean-temp.h ++++ common/m4/lib/clean-temp.h +@@ -137,3 +137,3 @@ +- +-typedef int mode_t; +- ++#if defined _MSC_VER ++typedef int mode_t; ++#endif +--- common/misc/gethrxtime.c ++++ common/misc/gethrxtime.c +@@ -27,6 +27,6 @@ +-//#include + #include "timespec.h" +- ++#if HAVE_CLOCK_GETTIME ++#include ++#endif + /* Get the current time, as a count of the number of nanoseconds since + an arbitrary epoch (e.g., the system boot time). Prefer a +- high-resolution clock that is not subject to resetting or +@@ -49,8 +49,8 @@ + if (clock_gettime (CLOCK_MONOTONIC, &ts) == 0) + return xtime_make (ts.tv_sec, ts.tv_nsec); + } +-# endif +- ++# ++# else + # if HAVE_MICROUPTIME + { + struct timeval tv; +@@ -69,6 +69,6 @@ + } + # endif + # endif ++# endif + } +- + #endif +--- flex/CMakeLists.txt ++++ flex/CMakeLists.txt +@@ -25,1 +25,1 @@ +-target_link_libraries(${PROJECT_NAME} winflexbison_common kernel32.lib user32.lib) ++target_link_libraries(${PROJECT_NAME} winflexbison_common kernel32 user32) 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/winflexbison/config.yml b/recipes/winflexbison/config.yml index 480280b1fb8e8..4ae41b917c916 100644 --- a/recipes/winflexbison/config.yml +++ b/recipes/winflexbison/config.yml @@ -1,4 +1,6 @@ versions: + "2.5.25": + folder: all "2.5.24": folder: all "2.5.22": diff --git a/recipes/winmd/all/conanfile.py b/recipes/winmd/all/conanfile.py index 1882e7a4ae703..e37dc1cc239fe 100644 --- a/recipes/winmd/all/conanfile.py +++ b/recipes/winmd/all/conanfile.py @@ -5,10 +5,10 @@ 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 -from conan.tools.microsoft import is_msvc, check_min_vs -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.50.0" class WinMDConan(ConanFile): @@ -18,6 +18,7 @@ class WinMDConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/microsoft/winmd" topics = ("native", "C++", "WinRT", "WinMD") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -30,7 +31,9 @@ def _compilers_minimum_version(self): return { "gcc": "8", "clang": "12", - "apple-clang": "12.0", + "apple-clang": "12", + "Visual Studio": "15", + "msvc": "191", } def layout(self): @@ -40,20 +43,17 @@ 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." - ) + + 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) + 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) @@ -65,6 +65,8 @@ def package(self): ) def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] if not is_msvc(self): # ignore shadowing errors - self.cpp_info.cppflags = ['-fpermissive'] + self.cpp_info.cxxflags = ['-fpermissive'] diff --git a/recipes/winreg/all/conandata.yml b/recipes/winreg/all/conandata.yml new file mode 100644 index 0000000000000..4a90ca44d78e9 --- /dev/null +++ b/recipes/winreg/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "6.2.0": + url: "https://github.com/GiovanniDicanio/WinReg/archive/refs/tags/v6.2.0.tar.gz" + sha256: "9dc1b287fb8c765a35791bf0deea0da81e52a969827bc2d8777f54f26ade588d" diff --git a/recipes/winreg/all/conanfile.py b/recipes/winreg/all/conanfile.py new file mode 100644 index 0000000000000..13ef7cc69e291 --- /dev/null +++ b/recipes/winreg/all/conanfile.py @@ -0,0 +1,53 @@ +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 WinregConan(ConanFile): + name = "winreg" + homepage = "https://github.com/GiovanniDicanio/WinReg" + description = "Convenient high-level C++ wrapper around the Windows Registry API." + topics = "registry", "header-only" + url = "https://github.com/conan-io/conan-center-index" + license = "MIT" + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _minimum_cpp_standard(self): + return 17 + + 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) + if self.settings.os != "Windows": + raise ConanInvalidConfiguration("WinReg is only supported on Windows") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + pass + + def build(self): + pass + + def package(self): + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + copy(self, "*.hpp", os.path.join(self.source_folder, "WinReg"), os.path.join(self.package_folder, "include/WinReg")) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/winreg/all/test_package/CMakeLists.txt b/recipes/winreg/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..d6ae3f3d82d9a --- /dev/null +++ b/recipes/winreg/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(winreg REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE winreg::winreg) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/winreg/all/test_package/conanfile.py b/recipes/winreg/all/test_package/conanfile.py new file mode 100644 index 0000000000000..34be4a6e879fa --- /dev/null +++ b/recipes/winreg/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +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, run=can_run(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/winreg/all/test_package/test_package.cpp b/recipes/winreg/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..ff8ebb139790c --- /dev/null +++ b/recipes/winreg/all/test_package/test_package.cpp @@ -0,0 +1,12 @@ +#include +#include + +#include "WinReg/WinReg.hpp" + +int main() { + auto subkey = L"Environment"; + winreg::RegKey key{HKEY_CURRENT_USER, subkey}; + auto value = key.GetStringValue(L"Path"); + std::wcout << value << std::endl; + return 0; +} diff --git a/recipes/winreg/config.yml b/recipes/winreg/config.yml new file mode 100644 index 0000000000000..ff45ed79b1303 --- /dev/null +++ b/recipes/winreg/config.yml @@ -0,0 +1,3 @@ +versions: + "6.2.0": + folder: all diff --git a/recipes/wiringpi/all/CMakeLists.txt b/recipes/wiringpi/all/CMakeLists.txt index 12d3cd6bed196..80de9a56905b7 100644 --- a/recipes/wiringpi/all/CMakeLists.txt +++ b/recipes/wiringpi/all/CMakeLists.txt @@ -1,26 +1,27 @@ cmake_minimum_required(VERSION 2.8.11) -project(wiringPi C) +project(wiringPi LANGUAGES C) -include(conanbuildinfo.cmake) -conan_basic_setup() +file(GLOB SRC_FILES ${WIRINGPI_SRC_DIR}/wiringPi/*.c) -FILE(GLOB SRC_FILES source_subfolder/wiringPi/*.c) message(STATUS "SRC_FILES: ${SRC_FILES}") -if(NOT WITH_WPI_EXTENSIONS) +if(NOT WIRINGPI_WITH_WPI_EXTENSIONS) list(FILTER SRC_FILES EXCLUDE REGEX ".*wpiExtensions.c") list(FILTER SRC_FILES EXCLUDE REGEX ".*drcNet.c") endif() add_library(${PROJECT_NAME} ${SRC_FILES}) -target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder/wiringPi) -target_link_libraries(${PROJECT_NAME} PUBLIC ${CONAN_LIBS}) +target_include_directories(${PROJECT_NAME} PUBLIC ${WIRINGPI_SRC_DIR}/wiringPi) -if(WITH_DEV_LIB) - FILE(GLOB SRC_FILES source_subfolder/devLib//*.c) +if(WIRINGPI_WITH_DEV_LIB) + file(GLOB SRC_FILES ${WIRINGPI_SRC_DIR}/devLib/*.c) list(FILTER SRC_FILES EXCLUDE REGEX ".*piFaceOld.c") add_library(wiringPiDevLib ${SRC_FILES}) - target_include_directories(wiringPiDevLib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder/devLib - ${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder/wiringPi) + target_include_directories(wiringPiDevLib PUBLIC ${WIRINGPI_SRC_DIR}/devLib + ${WIRINGPI_SRC_DIR}/wiringPi) +endif() + +if(WIRINGPI_LINUX_HEADERS_DIR) + target_include_directories(${PROJECT_NAME} PUBLIC ${WIRINGPI_LINUX_HEADERS_DIR}) endif() install(TARGETS ${PROJECT_NAME} @@ -28,16 +29,16 @@ install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) -install(DIRECTORY source_subfolder/wiringPi/ DESTINATION include +install(DIRECTORY ${WIRINGPI_SRC_DIR}/wiringPi/ DESTINATION include FILES_MATCHING PATTERN "*.h") -if(WITH_DEV_LIB) +if(WIRINGPI_WITH_DEV_LIB) install(TARGETS wiringPiDevLib RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) - install(DIRECTORY source_subfolder/devLib/ DESTINATION include + install(DIRECTORY ${WIRINGPI_SRC_DIR}/devLib/ DESTINATION include FILES_MATCHING PATTERN "*.h") endif() diff --git a/recipes/wiringpi/all/conandata.yml b/recipes/wiringpi/all/conandata.yml index 676b9c65bf9fe..01a4914b9830b 100644 --- a/recipes/wiringpi/all/conandata.yml +++ b/recipes/wiringpi/all/conandata.yml @@ -1,4 +1,19 @@ sources: + "3.10": + url: "https://github.com/WiringPi/WiringPi/archive/refs/tags/3.10.tar.gz" + sha256: "d0a7b182154e763b4baff1a57a5e0fca093fcf081f663cb2fb17f5ada564e016" + "3.8": + url: "https://github.com/WiringPi/WiringPi/archive/refs/tags/3.8.tar.gz" + sha256: "6159764d3d036486f0a110cd5393b1413c1f334d464b7337117fece59ea04bc9" + "3.6": + url: "https://github.com/WiringPi/WiringPi/archive/refs/tags/3.6.tar.gz" + sha256: "bec180a14ccd2d6b4eb5248d6553593511e7881348f56f8c98515a6d5d5444ee" + "3.4": + url: "https://github.com/WiringPi/WiringPi/archive/refs/tags/3.4.tar.gz" + sha256: "a81219e9ea0ce08295d2fc0457c69c4df0c6d2e846cb5817ba3247f673480d55" + "3.2": + url: "https://github.com/WiringPi/WiringPi/archive/refs/tags/3.2.tar.gz" + sha256: "45aeaf52d86631edb7a5c82a4f6d0050ef10c8b4de6c566cd8017fc52a17b68e" "2.61-1": url: "https://github.com/WiringPi/WiringPi/archive/refs/tags/2.61-1.tar.gz" sha256: "b5dc6c6c2ba1349acf602fafd7b58aa81e3fc3216a33b983386264cca0033e12" diff --git a/recipes/wiringpi/all/conanfile.py b/recipes/wiringpi/all/conanfile.py index f592d334682a7..882e90a790561 100644 --- a/recipes/wiringpi/all/conanfile.py +++ b/recipes/wiringpi/all/conanfile.py @@ -1,66 +1,83 @@ -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.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import get, copy +from conan.tools.scm import Version -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class WiringpiConan(ConanFile): name = "wiringpi" - license = "LGPL-3.0" description = "GPIO Interface library for the Raspberry Pi" - homepage = "http://wiringpi.com" - topics = ("wiringpi", "gpio", "raspberrypi") + license = "LGPL-3.0" url = "https://github.com/conan-io/conan-center-index" - settings = "os", "compiler", "build_type", "arch" - options = {"shared": [True, False], - "fPIC": [True, False], - "wpi_extensions": [True, False], - "with_devlib": [True, False]} - default_options = {"shared": False, - "fPIC": True, - "wpi_extensions": False, - "with_devlib": True} - exports_sources = ["CMakeLists.txt"] - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" + homepage = "https://github.com/WiringPi/WiringPi" + topics = ("wiringpi", "gpio", "raspberrypi") + settings = "os", "arch", "compiler", "build_type" + package_type = "library" + options = { + "shared": [True, False], + "fPIC": [True, False], + "wpi_extensions": [True, False], + "with_devlib": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "wpi_extensions": False, + "with_devlib": True, + } - @property - def _build_subfolder(self): - return "build_subfolder" + def export_sources(self): + copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) 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 Version(self.version) >= "3.2": + self.requires("linux-headers-generic/6.5.9", transitive_headers=True) def validate(self): if self.settings.os != "Linux": - raise ConanInvalidConfiguration("{} only works for Linux.".format(self.name)) + raise ConanInvalidConfiguration(f"{self.ref} only works for Linux") + if Version(self.version) >= 3.0: + if self.settings.compiler == "gcc" and \ + Version(self.settings.compiler.version) < 8: + raise ConanInvalidConfiguration(f"{self.ref} requires gcc >= 8") + # wiringPi.c:1755:9: error: case label does not reduce to an integer constant + if self.settings.compiler == "gcc" and \ + Version(self.settings.compiler.version).major == 11 and \ + self.settings.build_type == "Debug": + raise ConanInvalidConfiguration(f"{self.ref} doesn't support gcc 11 in Debug 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], strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["WITH_WPI_EXTENSIONS"] = self.options.wpi_extensions - self._cmake.definitions["WITH_DEV_LIB"] = self.options.with_devlib - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["WIRINGPI_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.variables["WIRINGPI_WITH_WPI_EXTENSIONS"] = self.options.wpi_extensions + tc.variables["WIRINGPI_WITH_DEV_LIB"] = self.options.with_devlib + if Version(self.version) >= "3.2": + tc.variables["WIRINGPI_LINUX_HEADERS_DIR"] = self.dependencies["linux-headers-generic"].cpp_info.includedirs[0] + 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("COPYING*", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, pattern="COPYING*", 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/wiringpi/all/test_package/CMakeLists.txt b/recipes/wiringpi/all/test_package/CMakeLists.txt index 46e004f1a0907..3dfbe8a866f08 100644 --- a/recipes/wiringpi/all/test_package/CMakeLists.txt +++ b/recipes/wiringpi/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) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) find_package(wiringpi REQUIRED CONFIG) add_executable(test_package test_package.c) -target_link_libraries(test_package wiringpi::wiringpi) +target_link_libraries(test_package PRIVATE wiringpi::wiringpi) diff --git a/recipes/wiringpi/all/test_package/conanfile.py b/recipes/wiringpi/all/test_package/conanfile.py index 0a93a273ba575..a623031975d40 100644 --- a/recipes/wiringpi/all/test_package/conanfile.py +++ b/recipes/wiringpi/all/test_package/conanfile.py @@ -1,17 +1,27 @@ 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 can_run -class TestConan(ConanFile): + +class wiringPiTestConan(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 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", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/wiringpi/all/test_v1_package/CMakeLists.txt b/recipes/wiringpi/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..caae3a2fdfe40 --- /dev/null +++ b/recipes/wiringpi/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(wiringpi REQUIRED CONFIG) + +add_executable(test_package ../test_package/test_package.c) +target_link_libraries(test_package wiringpi::wiringpi) diff --git a/recipes/wiringpi/all/test_v1_package/conanfile.py b/recipes/wiringpi/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..0a93a273ba575 --- /dev/null +++ b/recipes/wiringpi/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/wiringpi/config.yml b/recipes/wiringpi/config.yml index b0d56a22c2e0d..36ce1b9437329 100644 --- a/recipes/wiringpi/config.yml +++ b/recipes/wiringpi/config.yml @@ -1,4 +1,14 @@ versions: + "3.10": + folder: "all" + "3.8": + folder: "all" + "3.6": + folder: "all" + "3.4": + folder: "all" + "3.2": + folder: "all" "2.61-1": folder: "all" "cci.20210727": diff --git a/recipes/wise_enum/all/conandata.yml b/recipes/wise_enum/all/conandata.yml index a7eb4605abb61..05e03d94a0301 100644 --- a/recipes/wise_enum/all/conandata.yml +++ b/recipes/wise_enum/all/conandata.yml @@ -1,4 +1,7 @@ -sources: +sources: + "3.1.0": + url: "https://github.com/quicknir/wise_enum/archive/refs/tags/3.1.0.tar.gz" + sha256: "79410816314941ea2c00b2bbd6932797caefa397a76db425d2b96e6211d1069b" "3.0.0": url: "https://github.com/quicknir/wise_enum/archive/refs/tags/3.0.0.tar.gz" sha256: "6e0d62855854ea755dd4277e74a599d1f4e7eec95562baf751151cc2e4df5eb8" diff --git a/recipes/wise_enum/all/conanfile.py b/recipes/wise_enum/all/conanfile.py index 8253de9c07846..88c84965977d4 100644 --- a/recipes/wise_enum/all/conanfile.py +++ b/recipes/wise_enum/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 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.43.0" +required_conan_version = ">=1.50.0" class WiseEnumConan(ConanFile): @@ -22,49 +28,55 @@ class WiseEnumConan(ConanFile): homepage = "https://github.com/quicknir/wise_enum" url = "https://github.com/conan-io/conan-center-index" license = "BSL-1.0" + package_type = "header-library" 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 validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, "11") + @property + def _compilers_minimum_version(self): + return { + "gcc": "5", + } - compiler = str(self.settings.compiler) - compiler_version = tools.Version(self.settings.compiler.version) + def layout(self): + basic_layout(self, src_folder="src") - minimal_version = { - "gcc": "5" - } - unsupported = {"Visual Studio"} - if compiler in unsupported: - raise ConanInvalidConfiguration( - "{} does not support {} compiler".format(self.name, compiler) - ) + def package_id(self): + self.info.clear() - if compiler in minimal_version and compiler_version < minimal_version[compiler]: + def validate(self): + if is_msvc(self): + raise ConanInvalidConfiguration("Visual Studio is not supported") + + 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( - "{} 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." ) - 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], strip_root=True) + + def build(self): + pass def package(self): - self.copy("*.h", dst="include", src=self._source_subfolder) - 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, "*.h", src=self.source_folder, dst=os.path.join(self.package_folder, "include")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "WiseEnum") self.cpp_info.set_property("cmake_target_name", "WiseEnum::wise_enum") self.cpp_info.set_property("pkg_config_name", "WiseEnum") + 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"] = "WiseEnum" @@ -74,3 +86,5 @@ def package_info(self): self.cpp_info.components["_wise_enum"].names["cmake_find_package_multi"] = "wise_enum" self.cpp_info.components["_wise_enum"].set_property("cmake_target_name", "WiseEnum::wise_enum") self.cpp_info.components["_wise_enum"].set_property("pkg_config_name", "WiseEnum") + self.cpp_info.components["_wise_enum"].bindirs = [] + self.cpp_info.components["_wise_enum"].libdirs = [] diff --git a/recipes/wise_enum/all/test_package/CMakeLists.txt b/recipes/wise_enum/all/test_package/CMakeLists.txt index fbc90fdad3ead..6131dd641fdb9 100644 --- a/recipes/wise_enum/all/test_package/CMakeLists.txt +++ b/recipes/wise_enum/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(WiseEnum REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) target_link_libraries(${PROJECT_NAME} WiseEnum::wise_enum) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/wise_enum/all/test_package/conanfile.py b/recipes/wise_enum/all/test_package/conanfile.py index 49a3a66ea5bad..0a6bc68712d90 100644 --- a/recipes/wise_enum/all/test_package/conanfile.py +++ b/recipes/wise_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): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/wise_enum/all/test_v1_package/CMakeLists.txt b/recipes/wise_enum/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/wise_enum/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/wise_enum/all/test_v1_package/conanfile.py b/recipes/wise_enum/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/wise_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/wise_enum/config.yml b/recipes/wise_enum/config.yml index 2570ef88d7259..fba1ec47d0659 100644 --- a/recipes/wise_enum/config.yml +++ b/recipes/wise_enum/config.yml @@ -1,3 +1,5 @@ versions: - "3.0.0": + "3.1.0": + folder: all + "3.0.0": folder: all diff --git a/recipes/wolfssl/all/conandata.yml b/recipes/wolfssl/all/conandata.yml index 6fec683102ea7..ac2d8b39c2b06 100644 --- a/recipes/wolfssl/all/conandata.yml +++ b/recipes/wolfssl/all/conandata.yml @@ -1,4 +1,19 @@ sources: + "5.7.2": + url: "https://github.com/wolfSSL/wolfssl/archive/v5.7.2-stable.tar.gz" + sha256: "0f2ed82e345b833242705bbc4b08a2a2037a33f7bf9c610efae6464f6b10e305" + "5.7.0": + url: "https://github.com/wolfSSL/wolfssl/archive/v5.7.0-stable.tar.gz" + sha256: "2de93e8af588ee856fe67a6d7fce23fc1b226b74d710b0e3946bc8061f6aa18f" + "5.6.6": + url: "https://github.com/wolfSSL/wolfssl/archive/v5.6.6-stable.tar.gz" + sha256: "3d2ca672d41c2c2fa667885a80d6fa03c3e91f0f4f72f87aef2bc947e8c87237" + "5.6.4": + url: "https://github.com/wolfSSL/wolfssl/archive/v5.6.4-stable.tar.gz" + sha256: "031691906794ff45e1e792561cf31759f5d29ac74936bc8dffb8b14f16d820b4" + "5.6.3": + url: "https://github.com/wolfSSL/wolfssl/archive/v5.6.3-stable.tar.gz" + sha256: "2e74a397fa797c2902d7467d500de904907666afb4ff80f6464f6efd5afb114a" "5.5.1": url: "https://github.com/wolfSSL/wolfssl/archive/v5.5.1-stable.tar.gz" sha256: "97339e6956c90e7c881ba5c748dd04f7c30e5dbe0c06da765418c51375a6dee3" @@ -14,21 +29,9 @@ sources: "5.1.1": url: "https://github.com/wolfSSL/wolfssl/archive/v5.1.1-stable.tar.gz" sha256: "d3e0544dbe7e9587c0f6538cdc671b6492663bb7a4281819538abe6c99cdbd92" - "5.0.0": - url: "https://github.com/wolfSSL/wolfssl/archive/v5.0.0-stable.tar.gz" - sha256: "908390282cc613a3943533f3d922b3c18dee3289f498b6f944cb86a19a5eeb56" "4.8.1": url: "https://github.com/wolfSSL/wolfssl/archive/v4.8.1-stable.tar.gz" sha256: "50db45f348f47e00c93dd244c24108220120cb3cc9d01434789229c32937c444" "4.7.1": url: "https://github.com/wolfSSL/wolfssl/archive/v4.7.1r.tar.gz" sha256: "bd13875b0b21e51b558ed797065937dc8530a5b09c219d966c3fc47a182d46a1" - "4.6.0": - url: "https://github.com/wolfSSL/wolfssl/archive/v4.6.0-stable.tar.gz" - sha256: "053aefbb02d0b06b27c5e2df6875b4b587318755b7db9d6aa8d72206b310a848" - "4.5.0": - url: "https://github.com/wolfSSL/wolfssl/archive/v4.5.0-stable.tar.gz" - sha256: "7de62300ce14daa0051bfefc7c4d6302f96cabc768b6ae49eda77523b118250c" - "4.4.0": - url: "https://github.com/wolfSSL/wolfssl/archive/v4.4.0-stable.tar.gz" - sha256: "7f854804c8ae0ca49cc77809e38e9a3b5a8c91ba7855ea928e6d6651b0d35f18" diff --git a/recipes/wolfssl/all/conanfile.py b/recipes/wolfssl/all/conanfile.py index 7f979bc1b4d81..71b7470fcdfeb 100644 --- a/recipes/wolfssl/all/conanfile.py +++ b/recipes/wolfssl/all/conanfile.py @@ -1,20 +1,29 @@ -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, is_apple_os +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 +from conan.tools.scm import Version import os - -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.54.0" class WolfSSLConan(ConanFile): name = "wolfssl" + description = ( + "wolfSSL (formerly CyaSSL) is a small, fast, portable implementation " + "of TLS/SSL for embedded devices to the cloud." + ) license = "GPL-2.0-or-later" url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.wolfssl.com/" - description = "wolfSSL (formerly CyaSSL) is a small, fast, portable implementation of TLS/SSL for embedded devices to the cloud." topics = ("wolfssl", "tls", "ssl", "iot", "fips", "secure", "cryptology", "secret") - settings = "os", "compiler", "build_type", "arch" + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -30,6 +39,10 @@ class WolfSSLConan(ConanFile): "sessioncerts": [True, False], "sni": [True, False], "testcert": [True, False], + "with_curl": [True, False], + "with_quic": [True, False], + "with_experimental": [True, False], + "with_rpk": [True, False], } default_options = { "shared": False, @@ -46,14 +59,12 @@ class WolfSSLConan(ConanFile): "sessioncerts": False, "sni": False, "testcert": False, + "with_curl": False, + "with_quic": False, + "with_experimental": False, + "with_rpk": False, } - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _settings_build(self): return getattr(self, "settings_build", self.settings) @@ -61,52 +72,46 @@ def _settings_build(self): def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + if Version(self.version) < "5.2.0": + del self.options.with_curl + if Version(self.version) < "5.5.0": + del self.options.with_quic + if Version(self.version) < "5.7.0": + del self.options.with_experimental + if Version(self.version) < "5.7.2": + del self.options.with_rpk 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 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("libtool/2.4.6") + def layout(self): + basic_layout(self, src_folder="src") def validate(self): if self.options.opensslall and not self.options.opensslextra: raise ConanInvalidConfiguration("The option 'opensslall' requires 'opensslextra=True'") + def build_requirements(self): + self.tool_requires("libtool/2.4.7") + self.tool_requires("cmake/[>=3.22 <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") + 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 = { - "CC": "{} cl -nolink".format(tools.unix_path(self.deps_user_info["automake"].compile)), - "CXX": "{} cl -nolink".format(tools.unix_path(self.deps_user_info["automake"].compile)), - "AR": "{} lib".format(tools.unix_path(self.deps_user_info["automake"].ar_lib)), - "LD": "{} cl -nolink".format(tools.unix_path(self.deps_user_info["automake"].compile)), - } - 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) - if self.settings.compiler == "Visual Studio": - self._autotools.link_flags.append("-ladvapi32") - self._autotools.libs = [] - if self.settings.compiler == "Visual Studio": - self._autotools.flags.append("-FS") + tc = AutotoolsToolchain(self) yes_no = lambda v: "yes" if v else "no" - conf_args = [ + tc.configure_args.extend([ "--disable-examples", "--disable-crypttests", "--enable-harden", @@ -116,7 +121,7 @@ def _configure_autotools(self): "--enable-sslv3={}".format(yes_no(self.options.sslv3)), "--enable-alpn={}".format(yes_no(self.options.alpn)), "--enable-des3={}".format(yes_no(self.options.des3)), - "--enable-tls13={}".format(yes_no(self.options.tls13)), + "--enable-tls13={}".format(yes_no(self.options.tls13 or self.options.get_safe("with_quic"))), "--enable-certgen={}".format(yes_no(self.options.certgen)), "--enable-dsa={}".format(yes_no(self.options.dsa)), "--enable-ripemd={}".format(yes_no(self.options.ripemd)), @@ -125,41 +130,60 @@ def _configure_autotools(self): "--enable-testcert={}".format(yes_no(self.options.testcert)), "--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 + ]) + if self.options.get_safe("with_curl"): + tc.configure_args.append("--enable-curl") + if self.options.get_safe("with_quic"): + tc.configure_args.append("--enable-quic") + if self.options.get_safe("with_experimental"): + tc.configure_args.append("--enable-experimental") + if self.options.get_safe("with_rpk"): + tc.configure_args.append("--enable-rpk") + if is_msvc(self): + tc.extra_ldflags.append("-ladvapi32") + if check_min_vs(self, "180", raise_invalid=False): + tc.extra_cflags.append("-FS") + env = tc.environment() + if is_msvc(self): + 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") + 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) - with self._build_context(): - autotools = self._configure_autotools() - if self.settings.compiler == "Visual Studio" and (tools.Version(self.version) < "4.7" or self.version == "5.0.0"): - tools.replace_in_file("libtool", - "AR_FLAGS=\"Ucru\"", "AR_FLAGS=\"cru\"") - autotools.make() + autotools = Autotools(self) + autotools.autoreconf() + autotools.configure() + autotools.make() def package(self): - self.copy(pattern="LICENSING", src=self._source_subfolder, dst="licenses") - with self._build_context(): - autotools = self._configure_autotools() - autotools.install() + copy(self, "LICENSING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + autotools.install() os.unlink(os.path.join(self.package_folder, "bin", "wolfssl-config")) - 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: - tools.rename(os.path.join(self.package_folder, "lib", "wolfssl.dll.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) + if is_msvc(self) and self.options.shared: + rename(self, os.path.join(self.package_folder, "lib", "wolfssl.dll.lib"), os.path.join(self.package_folder, "lib", "wolfssl.lib")) def package_info(self): - self.cpp_info.names["pkg_config"] = "wolfssl" - libname = "wolfssl" - self.cpp_info.libs = [libname] + self.cpp_info.set_property("pkg_config_name", "wolfssl") + self.cpp_info.libs = ["wolfssl"] if self.options.shared: self.cpp_info.defines.append("WOLFSSL_DLL") if not self.options.shared: - if self.settings.os == "Linux": - self.cpp_info.system_libs.append("m") + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["m", "pthread"]) elif self.settings.os == "Windows": self.cpp_info.system_libs.extend(["advapi32", "ws2_32"]) + if Version(self.version) >= "5.6.0": + self.cpp_info.system_libs.append("crypt32") + elif is_apple_os(self) and Version(self.version) >= "5.6.0": + self.cpp_info.frameworks.extend(["CoreFoundation", "Security"]) diff --git a/recipes/wolfssl/all/test_package/CMakeLists.txt b/recipes/wolfssl/all/test_package/CMakeLists.txt index 7b9b613cbb24a..56df34e610017 100644 --- a/recipes/wolfssl/all/test_package/CMakeLists.txt +++ b/recipes/wolfssl/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(wolfssl REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE wolfssl::wolfssl) diff --git a/recipes/wolfssl/all/test_package/conanfile.py b/recipes/wolfssl/all/test_package/conanfile.py index d4128b0450777..539e617675db7 100644 --- a/recipes/wolfssl/all/test_package/conanfile.py +++ b/recipes/wolfssl/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, run=True) 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/wolfssl/all/test_v1_package/CMakeLists.txt b/recipes/wolfssl/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/wolfssl/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/wolfssl/all/test_v1_package/conanfile.py b/recipes/wolfssl/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/wolfssl/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/wolfssl/config.yml b/recipes/wolfssl/config.yml index 84cd9530404f8..0734e5e20ba48 100644 --- a/recipes/wolfssl/config.yml +++ b/recipes/wolfssl/config.yml @@ -1,4 +1,14 @@ versions: + "5.7.2": + folder: all + "5.7.0": + folder: all + "5.6.6": + folder: all + "5.6.4": + folder: all + "5.6.3": + folder: all "5.5.1": folder: all "5.4.0": @@ -9,15 +19,7 @@ versions: folder: all "5.1.1": folder: all - "5.0.0": - folder: all "4.8.1": folder: all "4.7.1": folder: all - "4.6.0": - folder: all - "4.5.0": - folder: all - "4.4.0": - folder: all diff --git a/recipes/wslay/all/conanfile.py b/recipes/wslay/all/conanfile.py index 0891ca89ea5c3..0adf9718dbe26 100644 --- a/recipes/wslay/all/conanfile.py +++ b/recipes/wslay/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.50.0" +required_conan_version = ">=1.53.0" class WslayConan(ConanFile): @@ -15,6 +15,7 @@ class WslayConan(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], @@ -26,8 +27,7 @@ class WslayConan(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/wslay/all/patches/0001-msvc-support.patch b/recipes/wslay/all/patches/0001-msvc-support.patch index a689fc2452be1..b8e26fd0b44af 100644 --- a/recipes/wslay/all/patches/0001-msvc-support.patch +++ b/recipes/wslay/all/patches/0001-msvc-support.patch @@ -44,14 +44,14 @@ index 4af972e..96b5392 100644 if(WSLAY_STATIC) add_library(wslay STATIC ${SOURCES} ${HEADERS}) list(APPEND WSLAY_TARGETS wslay) -+ if(MSVC) ++ if(WIN32) + target_link_libraries(wslay PUBLIC ws2_32) + endif() endif() if(WSLAY_SHARED) add_library(wslay_shared SHARED ${SOURCES} ${HEADERS}) list(APPEND WSLAY_TARGETS wslay_shared) -+ if(MSVC) ++ if(WIN32) + target_link_libraries(wslay_shared PUBLIC ws2_32) + endif() endif() diff --git a/recipes/wslay/all/test_v1_package/CMakeLists.txt b/recipes/wslay/all/test_v1_package/CMakeLists.txt index b27e89de2a1f8..0d20897301b68 100644 --- a/recipes/wslay/all/test_v1_package/CMakeLists.txt +++ b/recipes/wslay/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(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() +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/wt/all/CMakeLists.txt b/recipes/wt/all/CMakeLists.txt deleted file mode 100644 index a8752cbde5db2..0000000000000 --- a/recipes/wt/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/wt/all/conandata.yml b/recipes/wt/all/conandata.yml index c2dc8b597da2e..7c33a1e76efa3 100644 --- a/recipes/wt/all/conandata.yml +++ b/recipes/wt/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "4.10.1": + url: "https://github.com/emweb/wt/archive/4.10.1.tar.gz" + sha256: "f6d6114416a628604793197cd077066a9d4d98799bbb288b97de42f66705bde5" + "4.10.0": + url: "https://github.com/emweb/wt/archive/4.10.0.tar.gz" + sha256: "7090023d4fc4b6594bf4cb11072d9d3d775269327aece9a8993c7bbe46decb9d" + "4.9.1": + url: "https://github.com/emweb/wt/archive/4.9.1.tar.gz" + sha256: "253c61779623ed125bdd604a7b7fe48e64bd991548d17180f040bfa88ccafd98" "4.8.0": url: "https://github.com/emweb/wt/archive/4.8.0.tar.gz" sha256: "e4030d8f530ec7bdd6b341a2bf31a608fb9ebcedb905155f83ec7f300a7d420d" @@ -11,25 +20,32 @@ sources: "4.6.0": url: "https://github.com/emweb/wt/archive/4.6.0.tar.gz" sha256: "7f709e132d32c4925e6db0a590c7ccc5613344e8b9052676ef891a25ccb550e6" - "4.5.1": - url: "https://github.com/emweb/wt/archive/4.5.1.tar.gz" - sha256: "c2820646095af5618fc235705c0108797e3898225fb1826f2c6185c405c21a17" - "4.5.0": - url: "https://github.com/emweb/wt/archive/4.5.0.tar.gz" - sha256: "119b1eae83285a153b9c901d3f4f25775c7a460d30b1e48242d7d2d649d61deb" - "4.4.0": - url: "https://github.com/emweb/wt/archive/4.4.0.tar.gz" - sha256: "2eabefea915ecc4deb36f9f67ab30dd3b1f6c73893d76c9d9fa39ac25f4f3690" - "4.3.1": - url: "https://github.com/emweb/wt/archive/4.3.1.tar.gz" - sha256: "6c0130f36c829ed67119679770c2f62d7768a62eaa281bb10070c4cf1b145139" patches: - "4.5.0": - - patch_file: "patches/wt_4_5_0_gcc_11.patch" - base_path: "source_subfolder" - "4.4.0": - - patch_file: "patches/wt_4_5_0_gcc_11.patch" - base_path: "source_subfolder" - "4.3.1": - - patch_file: "patches/wt_4_5_0_gcc_11.patch" - base_path: "source_subfolder" + "4.10.1": + - patch_file: "patches/4.8.0-0001-use-cci-package.patch" + patch_description: "use cci package" + patch_type: "conan" + "4.10.0": + - patch_file: "patches/4.8.0-0001-use-cci-package.patch" + patch_description: "use cci package" + patch_type: "conan" + "4.9.1": + - patch_file: "patches/4.8.0-0001-use-cci-package.patch" + patch_description: "use cci package" + patch_type: "conan" + "4.8.0": + - patch_file: "patches/4.8.0-0001-use-cci-package.patch" + patch_description: "use cci package" + patch_type: "conan" + "4.7.1": + - patch_file: "patches/4.7.1-0001-use-cci-package.patch" + patch_description: "use cci package" + patch_type: "conan" + "4.6.2": + - patch_file: "patches/4.6.2-0001-use-cci-package.patch" + patch_description: "use cci package" + patch_type: "conan" + "4.6.0": + - patch_file: "patches/4.6.2-0001-use-cci-package.patch" + patch_description: "use cci package" + patch_type: "conan" diff --git a/recipes/wt/all/conanfile.py b/recipes/wt/all/conanfile.py index 43df32f07c272..f52c69a8dfbb5 100644 --- a/recipes/wt/all/conanfile.py +++ b/recipes/wt/all/conanfile.py @@ -1,19 +1,24 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile, conan_version +from conan.errors import ConanException, ConanInvalidConfiguration +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 +from conan.tools.microsoft import is_msvc import os +import sys import shutil -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.54.0" class WtConan(ConanFile): name = "wt" description = "Wt is a C++ library for developing web applications" + license = "GPL-2.0-only" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/emweb/wt" - topics = ("wt", "web", "webapp") - license = "GPL-2.0-only" - + topics = ("server", "web", "webapp", "websocket", "cgi", "fastcgi", "orm") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -27,6 +32,8 @@ class WtConan(ConanFile): "with_dbo": [True, False], "with_opengl": [True, False], "with_unwind": [True, False], + "with_haru": [True, False], + "raster_image": ["none", "Direct2D", "GraphicsMagick"], "no_std_locale": [True, False], "no_std_wstring": [True, False], "multi_threaded": [True, False], @@ -46,6 +53,8 @@ class WtConan(ConanFile): "with_dbo": True, "with_opengl": False, "with_unwind": True, + "with_haru": False, + "raster_image": "none", "no_std_locale": False, "no_std_wstring": False, "multi_threaded": True, @@ -54,21 +63,8 @@ class WtConan(ConanFile): "connector_fcgi": False, } - 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": @@ -81,7 +77,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.with_dbo: del self.options.with_sqlite del self.options.with_postgres @@ -89,152 +85,218 @@ def configure(self): del self.options.with_mssql self._strict_options_requirements() + def layout(self): + cmake_layout(self, src_folder="src") + def _strict_options_requirements(self): self.options["boost"].header_only = False for boost_comp in self._required_boost_components: - setattr(self.options["boost"], "without_{}".format(boost_comp), False) + setattr(self.options["boost"], f"without_{boost_comp}", False) @property def _required_boost_components(self): return ["program_options", "filesystem", "thread"] def requirements(self): - if tools.Version(self.version) >= "4.6.0": - self.requires("boost/1.79.0") + if Version(self.version) < "4.9.0": + self.requires("boost/1.80.0", transitive_headers = True) else: - self.requires("boost/1.76.0") + self.requires("boost/1.83.0", transitive_headers = True) if self.options.connector_http: - self.requires("zlib/1.2.12") + self.requires("zlib/[>=1.2.11 <2]") if self.options.with_ssl: - self.requires("openssl/1.1.1q") + self.requires("openssl/[>=1.1 <4]") if self.options.get_safe("with_sqlite"): - self.requires("sqlite3/3.39.1") + self.requires("sqlite3/3.44.2") if self.options.get_safe("with_mysql"): - self.requires("libmysqlclient/8.0.29") + self.requires("libmysqlclient/8.1.0", transitive_headers=True, transitive_libs=True) if self.options.get_safe("with_postgres"): - self.requires("libpq/14.2") + self.requires("libpq/15.4", transitive_headers=True, transitive_libs=True) if self.options.get_safe("with_mssql") and self.settings.os != "Windows": - self.requires("odbc/2.3.9") + self.requires("odbc/2.3.11") if self.options.get_safe("with_unwind"): - self.requires("libunwind/1.6.2") - + self.requires("libunwind/1.7.2") + if self.options.with_haru: + self.requires("libharu/2.4.3") + 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: - raise ConanInvalidConfiguration("Wt requires these boost components: {}".format(", ".join(self._required_boost_components))) + 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( + f"{self.ref} requires non header-only boost with these components: " + f"{', '.join(self._required_boost_components)}" + ) + if self.options.get_safe("raster_image", "none") == "Direct2D" and self.settings.os != "Windows": + raise ConanInvalidConfiguration("Direct2D is supported only on Windows.") + + # FIXME: https://redmine.emweb.be/issues/12073w + if conan_version.major == 2 and Version(self.version) == "4.10.1" and is_msvc(self): + + # FIXME: check_max_cppstd is only available for Conan 2.x. Remove it after dropping support for Conan 1.x + # FIXME: linter complains, but function is there + # https://docs.conan.io/2.0/reference/tools/build.html?highlight=check_min_cppstd#conan-tools-build-check-max-cppstd + check_max_cppstd = getattr(sys.modules['conan.tools.build'], 'check_max_cppstd') + # INFO: error C2661: 'std::to_chars': no overloaded function takes 2 arguments. Removed in C++17. + check_max_cppstd(self, 14) 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) - - cmakelists = os.path.join(self._source_subfolder, "CMakeLists.txt") - tools.replace_in_file(cmakelists, "find_package(OpenSSL)", "#find_package(OpenSSL)") - tools.replace_in_file(cmakelists, "INCLUDE(cmake/WtFindMysql.txt)", "#INCLUDE(cmake/WtFindMysql.txt)") - tools.replace_in_file(cmakelists, "INCLUDE(cmake/WtFindPostgresql.txt)", "#INCLUDE(cmake/WtFindPostgresql.txt)") - if self.settings.os != "Windows": - tools.replace_in_file(cmakelists, "INCLUDE(cmake/WtFindOdbc.txt)", "#INCLUDE(cmake/WtFindOdbc.txt)") - - # Do not pollute rpath of shared libs of the install tree on macOS please - tools.replace_in_file( - cmakelists, - "IF(APPLE)\n SET(CMAKE_INSTALL_RPATH \"${CMAKE_INSTALL_PREFIX}/lib\")", - "if(0)", - ) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def _get_library_extension(self, dep): + if self.dependencies[dep].options.shared: + if self.settings.os == "Windows" : + if is_msvc(self): + return ".lib" + else: + return ".dll.a" + elif self.settings.os == "Macos": + return ".dylib" + else: + return ".so" + else: + if self.settings.os == "Windows" and is_msvc(self): + return ".lib" + else: + return ".a" - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["CONFIGDIR"] = os.path.join(self.package_folder, "bin") - self._cmake.definitions["SHARED_LIBS"] = self.options.shared - self._cmake.definitions["BUILD_EXAMPLES"] = False - self._cmake.definitions["BUILD_TESTS"] = False - self._cmake.definitions["ENABLE_SSL"] = self.options.with_ssl - self._cmake.definitions["ENABLE_HARU"] = False - self._cmake.definitions["ENABLE_PANGO"] = False - self._cmake.definitions["ENABLE_SQLITE"] = self.options.get_safe("with_sqlite", False) - self._cmake.definitions["ENABLE_POSTGRES"] = self.options.get_safe("with_postgres", False) - self._cmake.definitions["ENABLE_FIREBIRD"] = False - self._cmake.definitions["ENABLE_MYSQL"] = self.options.get_safe("with_mysql", False) - self._cmake.definitions["ENABLE_MSSQLSERVER"] = self.options.get_safe("with_mssql", False) - self._cmake.definitions["ENABLE_QT4"] = False - self._cmake.definitions["ENABLE_QT5"] = False - self._cmake.definitions["ENABLE_LIBWTTEST"] = self.options.with_test - self._cmake.definitions["ENABLE_LIBWTDBO"] = self.options.with_dbo - self._cmake.definitions["ENABLE_OPENGL"] = self.options.with_opengl - self._cmake.definitions["ENABLE_UNWIND"] = self.options.get_safe("with_unwind", False) - self._cmake.definitions["WT_NO_STD_LOCALE"] = self.options.no_std_locale - self._cmake.definitions["WT_NO_STD_WSTRING"] = self.options.no_std_wstring - self._cmake.definitions["MULTI_THREADED"] = self.options.multi_threaded - self._cmake.definitions["USE_SYSTEM_SQLITE3"] = True - self._cmake.definitions["DEBUG"] = self.settings.build_type == "Debug" - self._cmake.definitions["CONNECTOR_HTTP"] = self.options.connector_http - self._cmake.definitions["BOOST_DYNAMIC"] = self.options["boost"].shared - - def _gather_libs(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: - for l in _gather_libs(dep): - if not l in libs: - libs.append(l) - return libs + @property + def _get_library_prefix(self): + return "" if self.settings.os == "Windows" else "lib" + + def _cmakify_path_list(self, paths): + return ";".join([p.replace("\\", "/") for p in paths]) + + def _find_library(self, libname, dep): + for path in self.dependencies[dep].cpp_info.aggregated_components().libdirs: + lib_fullpath = os.path.join(path, self._get_library_prefix + libname + self._get_library_extension(dep)) + self.output.info("_find_library : " + str(lib_fullpath)) + if os.path.isfile(lib_fullpath): + return lib_fullpath + raise ConanException(f"Library {lib_fullpath} not found") + + def _find_libraries(self, dep): + + return [self._find_library(lib, dep) for lib in self.dependencies[dep].cpp_info.aggregated_components().libs] + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CONFIGDIR"] = os.path.join(self.package_folder, "bin").replace("\\", "/") + tc.variables["SHARED_LIBS"] = self.options.shared + tc.variables["BUILD_EXAMPLES"] = False + tc.variables["BUILD_TESTS"] = False + tc.variables["ENABLE_SSL"] = self.options.with_ssl + tc.variables["ENABLE_HARU"] = self.options.with_haru + tc.variables["ENABLE_PANGO"] = False + tc.variables["ENABLE_SQLITE"] = self.options.get_safe("with_sqlite", False) + tc.variables["ENABLE_POSTGRES"] = self.options.get_safe("with_postgres", False) + tc.variables["ENABLE_FIREBIRD"] = False + tc.variables["ENABLE_MYSQL"] = self.options.get_safe("with_mysql", False) + tc.variables["ENABLE_MSSQLSERVER"] = self.options.get_safe("with_mssql", False) + tc.variables["ENABLE_QT4"] = False + tc.variables["ENABLE_QT5"] = False + tc.variables["ENABLE_LIBWTTEST"] = self.options.with_test + tc.variables["ENABLE_LIBWTDBO"] = self.options.with_dbo + tc.variables["ENABLE_OPENGL"] = self.options.with_opengl + tc.variables["ENABLE_UNWIND"] = self.options.get_safe("with_unwind", False) + tc.variables["WT_WRASTERIMAGE_IMPLEMENTATION"] = self.options.get_safe("raster_image", "none") + tc.variables["WT_NO_STD_LOCALE"] = self.options.no_std_locale + tc.variables["WT_NO_STD_WSTRING"] = self.options.no_std_wstring + tc.variables["MULTI_THREADED"] = self.options.multi_threaded + tc.variables["USE_SYSTEM_SQLITE3"] = True + tc.variables["DEBUG"] = self.settings.build_type == "Debug" + tc.variables["CONNECTOR_HTTP"] = self.options.connector_http + tc.variables["BOOST_DYNAMIC"] = self.dependencies["boost"].options.get_safe("shared", False) # FIXME: all this logic coming from upstream custom find module files seems fragile, to improve later ! # we can't even inject cmake_find_package generator, it breaks the all upstream logic - self._cmake.definitions["BOOST_PREFIX"] = self.deps_cpp_info["boost"].rootpath + tc.variables["BOOST_PREFIX"] = self._cmakify_path_list([self.dependencies["boost"].package_folder]) if self.options.connector_http: - self._cmake.definitions["ZLIB_PREFIX"] = self.deps_cpp_info["zlib"].rootpath + tc.variables["ZLIB_PREFIX"] = self._cmakify_path_list([self.dependencies["zlib"].package_folder]) if self.options.with_ssl: - self._cmake.definitions["SSL_PREFIX"] = self.deps_cpp_info["openssl"].rootpath - self._cmake.definitions["OPENSSL_LIBRARIES"] = ";".join(_gather_libs("openssl")) - self._cmake.definitions["OPENSSL_INCLUDE_DIR"] = ";".join(self.deps_cpp_info["openssl"].include_paths) - self._cmake.definitions["OPENSSL_FOUND"] = True + tc.variables["SSL_PREFIX"] = self._cmakify_path_list([self.dependencies["openssl"].package_folder]) + tc.variables["OPENSSL_LIBRARIES"] = self._cmakify_path_list(self._find_libraries("openssl")) + tc.variables["OPENSSL_INCLUDE_DIR"] = self._cmakify_path_list(self.dependencies["openssl"].cpp_info.aggregated_components().includedirs) + tc.variables["OPENSSL_FOUND"] = True if self.options.get_safe("with_sqlite"): - self._cmake.definitions["SQLITE3_PREFIX"] = self.deps_cpp_info["sqlite3"].rootpath + tc.variables["SQLITE3_PREFIX"] = self._cmakify_path_list([self.dependencies["sqlite3"].package_folder]) if self.options.get_safe("with_mysql"): - self._cmake.definitions["MYSQL_PREFIX"] = self.deps_cpp_info["libmysqlclient"].rootpath - self._cmake.definitions["MYSQL_LIBRARIES"] = ";".join(_gather_libs("libmysqlclient")) - self._cmake.definitions["MYSQL_INCLUDE"] = ";".join(self.deps_cpp_info["libmysqlclient"].include_paths) - self._cmake.definitions["MYSQL_DEFINITIONS"] = ";".join("-D%s" % d for d in self.deps_cpp_info["libmysqlclient"].defines) - self._cmake.definitions["MYSQL_FOUND"] = True + tc.variables["MYSQL_LIBRARIES"] = self._cmakify_path_list(self._find_libraries("libmysqlclient")) + libmysqlclient_cppinfo = self.dependencies["libmysqlclient"].cpp_info.aggregated_components() + tc.variables["MYSQL_INCLUDE"] = self._cmakify_path_list(libmysqlclient_cppinfo.includedirs) + tc.variables["MYSQL_DEFINITIONS"] = ";".join(f"-D{d}" for d in libmysqlclient_cppinfo.defines) + tc.variables["MYSQL_FOUND"] = True if self.options.get_safe("with_postgres"): - self._cmake.definitions["POSTGRES_PREFIX"] = self.deps_cpp_info["libpq"].rootpath - self._cmake.definitions["POSTGRES_LIBRARIES"] = ";".join(_gather_libs("libpq")) - self._cmake.definitions["POSTGRES_INCLUDE"] = ";".join(self.deps_cpp_info["libpq"].include_paths) - self._cmake.definitions["POSTGRES_FOUND"] = True + tc.variables["POSTGRES_PREFIX"] = self._cmakify_path_list([self.dependencies["libpq"].package_folder]) + tc.variables["POSTGRES_LIBRARIES"] = self._cmakify_path_list(self._find_libraries("libpq")) + tc.variables["POSTGRES_INCLUDE"] = self._cmakify_path_list(self.dependencies["libpq"].cpp_info.aggregated_components().includedirs) + tc.variables["POSTGRES_FOUND"] = True if self.options.get_safe("with_mssql") and self.settings.os != "Windows": - self._cmake.definitions["ODBC_PREFIX"] = self.deps_cpp_info["odbc"].rootpath - self._cmake.definitions["ODBC_LIBRARIES"] = ";".join(_gather_libs("odbc")) - self._cmake.definitions["ODBC_INCLUDE"] = ";".join(self.deps_cpp_info["odbc"].include_paths) - self._cmake.definitions["ODBC_FOUND"] = True + tc.variables["ODBC_PREFIX"] = self._cmakify_path_list([self.dependencies["odbc"].package_folder]) + tc.variables["ODBC_LIBRARIES"] = self._cmakify_path_list(self._find_libraries("odbc")) + tc.variables["ODBC_INCLUDE"] = self._cmakify_path_list(self.dependencies["odbc"].cpp_info.aggregated_components().includedirs) + tc.variables["ODBC_FOUND"] = True + if self.options.with_haru: + tc.variables["HARU_PREFIX"] = self._cmakify_path_list(self.dependencies["libharu"].package_folder) if self.options.get_safe("with_unwind"): - self._cmake.definitions["UNWIND_PREFIX"] = self.deps_cpp_info["libunwind"].rootpath + tc.variables["UNWIND_PREFIX"] = self._cmakify_path_list([self.dependencies["libunwind"].package_folder]) if self.settings.os == "Windows": - self._cmake.definitions["CONNECTOR_FCGI"] = False - self._cmake.definitions["CONNECTOR_ISAPI"] = self.options.connector_isapi + tc.variables["CONNECTOR_FCGI"] = False + tc.variables["CONNECTOR_ISAPI"] = self.options.connector_isapi + else: + tc.variables["CONNECTOR_FCGI"] = self.options.connector_fcgi + tc.variables["CONNECTOR_ISAPI"] = False + 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, "INCLUDE(cmake/WtFindMysql.txt)", "#INCLUDE(cmake/WtFindMysql.txt)") + replace_in_file(self, cmakelists, "INCLUDE(cmake/WtFindPostgresql.txt)", "#INCLUDE(cmake/WtFindPostgresql.txt)") + if self.settings.os != "Windows": + replace_in_file(self, cmakelists, "INCLUDE(cmake/WtFindOdbc.txt)", "#INCLUDE(cmake/WtFindOdbc.txt)") + + if self.options.with_ssl: + # Ensure the conan-generated config is used for OpenSSL when required as a dependency + replace_in_file(self, cmakelists, "find_package(OpenSSL)", "find_package(OpenSSL CONFIG REQUIRED)") else: - self._cmake.definitions["CONNECTOR_FCGI"] = self.options.connector_fcgi - self._cmake.definitions["CONNECTOR_ISAPI"] = False - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + # Avoid searching for OpenSSL if it is not required + replace_in_file(self, cmakelists, "find_package(OpenSSL)", "") + + # Do not pollute rpath of shared libs of the install tree on macOS please + replace_in_file(self, + cmakelists, + "IF(APPLE)\n SET(CMAKE_INSTALL_RPATH \"${CMAKE_INSTALL_PREFIX}/lib\")", + "if(0)", + ) + + replace_in_file(self, + os.path.join(self.source_folder, "src", "CMakeLists.txt"), + "TARGET_LINK_LIBRARIES(wt PRIVATE Crypt32.lib)", + "TARGET_LINK_LIBRARIES(wt PUBLIC crypt32)" + ) + + dbo_cmakelsts = os.path.join(self.source_folder, "src", "Wt", "Dbo", "backend", "CMakeLists.txt") + replace_in_file(self, dbo_cmakelsts, "FIND_PACKAGE( Sqlite3 REQUIRED)", "FIND_PACKAGE( SQLite3 REQUIRED)") + replace_in_file(self, dbo_cmakelsts, '${SQLITE3_LIBRARIES}', '${SQLite3_LIBRARIES}') 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", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() shutil.move(os.path.join(self.package_folder, "share", "Wt"), os.path.join(self.package_folder, "bin")) - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.rmdir(os.path.join(self.package_folder, "var")) - 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, "var")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "wt") @@ -248,11 +310,15 @@ def package_info(self): self.cpp_info.components["wtmain"].system_libs = ["m", "rt"] elif self.settings.os == "Windows": self.cpp_info.components["wtmain"].system_libs = ["ws2_32", "mswsock", "winmm"] + if Version(self.version) >= "4.9.0": + self.cpp_info.components["wtmain"].system_libs.extend(["dwrite", "d2d1", "shlwapi"]) self.cpp_info.components["wtmain"].requires = ["boost::boost"] if self.options.with_ssl: self.cpp_info.components["wtmain"].requires.append("openssl::openssl") if self.options.get_safe("with_unwind"): self.cpp_info.components["wtmain"].requires.append("libunwind::libunwind") + if self.options.with_haru: + self.cpp_info.components["wtmain"].requires.append("libharu::libharu") # wttest if self.options.with_test: diff --git a/recipes/wt/all/patches/4.6.2-0001-use-cci-package.patch b/recipes/wt/all/patches/4.6.2-0001-use-cci-package.patch new file mode 100644 index 0000000000000..26c77ec5e6079 --- /dev/null +++ b/recipes/wt/all/patches/4.6.2-0001-use-cci-package.patch @@ -0,0 +1,32 @@ +diff --git a/src/Wt/Dbo/backend/CMakeLists.txt b/src/Wt/Dbo/backend/CMakeLists.txt +index e53075b..c470b8e 100644 +--- a/src/Wt/Dbo/backend/CMakeLists.txt ++++ b/src/Wt/Dbo/backend/CMakeLists.txt +@@ -118,11 +118,12 @@ IF(ENABLE_POSTGRES AND POSTGRES_FOUND) + SET_PROPERTY(TARGET wtdbopostgres PROPERTY CXX_VISIBILITY_PRESET hidden) + SET_PROPERTY(TARGET wtdbopostgres PROPERTY VISIBILITY_INLINES_HIDDEN YES) + ++ find_package(PostgreSQL REQUIRED CONFIG) + TARGET_LINK_LIBRARIES(wtdbopostgres + PUBLIC + wtdbo + PRIVATE +- ${POSTGRES_LIBRARIES} ++ PostgreSQL::PostgreSQL + ) + + IF(TARGET Boost::headers) +@@ -282,11 +283,12 @@ IF(ENABLE_MYSQL AND MYSQL_FOUND) + SET_PROPERTY(TARGET wtdbomysql PROPERTY CXX_VISIBILITY_PRESET hidden) + SET_PROPERTY(TARGET wtdbomysql PROPERTY VISIBILITY_INLINES_HIDDEN YES) + ++ find_package(libmysqlclient REQUIRED CONFIG) + TARGET_LINK_LIBRARIES(wtdbomysql + PUBLIC + wtdbo + PRIVATE +- ${MYSQL_LIBRARIES} ++ libmysqlclient::libmysqlclient + ) + + INCLUDE_DIRECTORIES(${MYSQL_INCLUDE}) diff --git a/recipes/wt/all/patches/4.7.1-0001-use-cci-package.patch b/recipes/wt/all/patches/4.7.1-0001-use-cci-package.patch new file mode 100644 index 0000000000000..26c77ec5e6079 --- /dev/null +++ b/recipes/wt/all/patches/4.7.1-0001-use-cci-package.patch @@ -0,0 +1,32 @@ +diff --git a/src/Wt/Dbo/backend/CMakeLists.txt b/src/Wt/Dbo/backend/CMakeLists.txt +index e53075b..c470b8e 100644 +--- a/src/Wt/Dbo/backend/CMakeLists.txt ++++ b/src/Wt/Dbo/backend/CMakeLists.txt +@@ -118,11 +118,12 @@ IF(ENABLE_POSTGRES AND POSTGRES_FOUND) + SET_PROPERTY(TARGET wtdbopostgres PROPERTY CXX_VISIBILITY_PRESET hidden) + SET_PROPERTY(TARGET wtdbopostgres PROPERTY VISIBILITY_INLINES_HIDDEN YES) + ++ find_package(PostgreSQL REQUIRED CONFIG) + TARGET_LINK_LIBRARIES(wtdbopostgres + PUBLIC + wtdbo + PRIVATE +- ${POSTGRES_LIBRARIES} ++ PostgreSQL::PostgreSQL + ) + + IF(TARGET Boost::headers) +@@ -282,11 +283,12 @@ IF(ENABLE_MYSQL AND MYSQL_FOUND) + SET_PROPERTY(TARGET wtdbomysql PROPERTY CXX_VISIBILITY_PRESET hidden) + SET_PROPERTY(TARGET wtdbomysql PROPERTY VISIBILITY_INLINES_HIDDEN YES) + ++ find_package(libmysqlclient REQUIRED CONFIG) + TARGET_LINK_LIBRARIES(wtdbomysql + PUBLIC + wtdbo + PRIVATE +- ${MYSQL_LIBRARIES} ++ libmysqlclient::libmysqlclient + ) + + INCLUDE_DIRECTORIES(${MYSQL_INCLUDE}) diff --git a/recipes/wt/all/patches/4.8.0-0001-use-cci-package.patch b/recipes/wt/all/patches/4.8.0-0001-use-cci-package.patch new file mode 100644 index 0000000000000..f44e45f2bd34c --- /dev/null +++ b/recipes/wt/all/patches/4.8.0-0001-use-cci-package.patch @@ -0,0 +1,32 @@ +diff --git a/src/Wt/Dbo/backend/CMakeLists.txt b/src/Wt/Dbo/backend/CMakeLists.txt +index 4121f68..457e95e 100644 +--- a/src/Wt/Dbo/backend/CMakeLists.txt ++++ b/src/Wt/Dbo/backend/CMakeLists.txt +@@ -122,11 +122,12 @@ IF(ENABLE_POSTGRES AND POSTGRES_FOUND) + SET_PROPERTY(TARGET wtdbopostgres PROPERTY VISIBILITY_INLINES_HIDDEN YES) + endif() + ++ find_package(PostgreSQL REQUIRED CONFIG) + TARGET_LINK_LIBRARIES(wtdbopostgres + PUBLIC + wtdbo + PRIVATE +- ${POSTGRES_LIBRARIES} ++ PostgreSQL::PostgreSQL + ) + + IF(TARGET Boost::headers) +@@ -290,11 +291,12 @@ IF(ENABLE_MYSQL AND MYSQL_FOUND) + SET_PROPERTY(TARGET wtdbomysql PROPERTY VISIBILITY_INLINES_HIDDEN YES) + endif() + ++ find_package(libmysqlclient REQUIRED CONFIG) + TARGET_LINK_LIBRARIES(wtdbomysql + PUBLIC + wtdbo + PRIVATE +- ${MYSQL_LIBRARIES} ++ libmysqlclient::libmysqlclient + ) + + INCLUDE_DIRECTORIES(${MYSQL_INCLUDE}) diff --git a/recipes/wt/all/patches/wt_4_5_0_gcc_11.patch b/recipes/wt/all/patches/wt_4_5_0_gcc_11.patch deleted file mode 100644 index 03d2aaff9236b..0000000000000 --- a/recipes/wt/all/patches/wt_4_5_0_gcc_11.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/src/Wt/Render/WTextRenderer.C -+++ b/src/Wt/Render/WTextRenderer.C -@@ -14,6 +14,7 @@ - #include "Block.h" - - #include -+#include - #include - - namespace { diff --git a/recipes/wt/all/test_package/CMakeLists.txt b/recipes/wt/all/test_package/CMakeLists.txt index d2fda9cef918e..634347f5dfc1c 100644 --- a/recipes/wt/all/test_package/CMakeLists.txt +++ b/recipes/wt/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) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) add_executable(${PROJECT_NAME} test_package.cpp) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) set(WT_COMPONENTS Wt HTTP) set(WT_TARGETS Wt::Wt Wt::HTTP) @@ -17,3 +13,9 @@ endif() find_package(wt REQUIRED ${WT_COMPONENTS} CONFIG) target_link_libraries(${PROJECT_NAME} PRIVATE ${WT_TARGETS}) + +if(wt_VERSION VERSION_LESS "4.5.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/wt/all/test_package/conanfile.py b/recipes/wt/all/test_package/conanfile.py index 0781b96f0c779..a9fb96656f203 100644 --- a/recipes/wt/all/test_package/conanfile.py +++ b/recipes/wt/all/test_package/conanfile.py @@ -1,11 +1,19 @@ -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 = "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,7 +21,6 @@ def build(self): cmake.build() def test(self): - if not cross_building(self): - bin_path = os.path.join("bin", "test_package") - args = " --docroot . --http-listen http://127.0.0.1:8080" - self.run(bin_path + args, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/wt/all/test_package/test_package.cpp b/recipes/wt/all/test_package/test_package.cpp index b29b66f7ec10f..16f166b0fac28 100644 --- a/recipes/wt/all/test_package/test_package.cpp +++ b/recipes/wt/all/test_package/test_package.cpp @@ -1,23 +1,9 @@ #include #include -#include -#include +#include -#ifdef WITH_DBO - -#include - -#endif - - -int main(int argc, char** argv) -{ - Wt::WLength l("10px"); -#ifdef WITH_DBO - Wt::Dbo::Session session; -#endif - - Wt::WServer server(argc, argv, WTHTTP_CONFIGURATION); +int main(void) { + std::cout << "WT Library version: " << Wt::WEnvironment::libraryVersion() << std::endl; return EXIT_SUCCESS; } diff --git a/recipes/wt/all/test_v1_package/CMakeLists.txt b/recipes/wt/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/wt/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/wt/all/test_v1_package/conanfile.py b/recipes/wt/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/wt/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/wt/config.yml b/recipes/wt/config.yml index 9d4f785027f9e..fec9d209ef876 100644 --- a/recipes/wt/config.yml +++ b/recipes/wt/config.yml @@ -1,4 +1,10 @@ versions: + "4.10.1": + folder: all + "4.10.0": + folder: all + "4.9.1": + folder: all "4.8.0": folder: all "4.7.1": @@ -7,11 +13,3 @@ versions: folder: all "4.6.0": folder: all - "4.5.1": - folder: all - "4.5.0": - folder: all - "4.4.0": - folder: all - "4.3.1": - folder: all diff --git a/recipes/wtl/all/conandata.yml b/recipes/wtl/all/conandata.yml index ff81fe89a2bae..1062fb5eccd19 100644 --- a/recipes/wtl/all/conandata.yml +++ b/recipes/wtl/all/conandata.yml @@ -1,7 +1,11 @@ sources: - "9.1.5321": - url: "https://iweb.dl.sourceforge.net/project/wtl/WTL%209.1/WTL%209.1.5321%20Final/WTL91_5321_Final.zip" - sha256: "c03f80c66f28e86b3cc7c98d14afab6bec8eb9366476f6bdda8469c35f52b18a" "10.0.9163": - url: "https://iweb.dl.sourceforge.net/project/wtl/WTL%2010/WTL%2010.0.9163/WTL10_9163.zip" + url: + - "https://master.dl.sourceforge.net/project/wtl/WTL%2010/WTL%2010.0.9163/WTL10_9163.zip" + - "https://iweb.dl.sourceforge.net/project/wtl/WTL%2010/WTL%2010.0.9163/WTL10_9163.zip" sha256: "b9fff11c36532c5fa0114b3c7ee4f752cbef71c7ddfd2e5f88f6f51f15431104" + "9.1.5321": + url: + - "https://master.dl.sourceforge.net/project/wtl/WTL%209.1/WTL%209.1.5321%20Final/WTL91_5321_Final.zip" + - "https://iweb.dl.sourceforge.net/project/wtl/WTL%209.1/WTL%209.1.5321%20Final/WTL91_5321_Final.zip" + sha256: "c03f80c66f28e86b3cc7c98d14afab6bec8eb9366476f6bdda8469c35f52b18a" diff --git a/recipes/wtl/all/conanfile.py b/recipes/wtl/all/conanfile.py index 7f344d54b158c..31f78cb05551e 100644 --- a/recipes/wtl/all/conanfile.py +++ b/recipes/wtl/all/conanfile.py @@ -1,24 +1,45 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout import os +required_conan_version = ">=1.54.0" + class WTLConan(ConanFile): name = "wtl" + description = "Windows Template Library (WTL) is a C++ library for developing Windows applications and UI components." license = "MS-PL" url = "https://github.com/conan-io/conan-center-index" homepage = "https://sourceforge.net/projects/wtl" - description = "Windows Template Library (WTL) is a C++ library for developing Windows applications and UI components." - topics = ("atl", "template library", "windows", "template", "ui", "gdi") + topics = ("atl", "template library", "windows", "template", "ui", "gdi", "header-only") - settings = {'os': ['Windows']} + settings = "os" no_copy_source = True + package_type = "header-library" + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.os != "Windows": + raise ConanInvalidConfiguration(f"{self.ref} can only be used on Windows.") + def source(self): - tools.get(**self.conan_data["sources"][self.version]) + get(self, **self.conan_data["sources"][self.version]) + + def build(self): + pass def package(self): - self.copy("*", dst="include", src=os.path.join(self.source_folder, "include")) - self.copy("MS-PL.TXT", dst="licenses", src=self.source_folder) + copy(self, "MS-PL.TXT", 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() + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/wtl/all/test_package/CMakeLists.txt b/recipes/wtl/all/test_package/CMakeLists.txt index ca6cdfccb74dd..7c87cbcfbe53b 100644 --- a/recipes/wtl/all/test_package/CMakeLists.txt +++ b/recipes/wtl/all/test_package/CMakeLists.txt @@ -1,10 +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(wtl REQUIRED CONFIG) add_executable(${PROJECT_NAME} example.cpp) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) - -conan_target_link_libraries(${PROJECT_NAME}) +target_link_libraries(${PROJECT_NAME} PRIVATE wtl::wtl) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/wtl/all/test_package/conanfile.py b/recipes/wtl/all/test_package/conanfile.py index bf31d11585919..48499fa0989d9 100644 --- a/recipes/wtl/all/test_package/conanfile.py +++ b/recipes/wtl/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 -class WTLTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + +# 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) @@ -12,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/wtl/all/test_v1_package/CMakeLists.txt b/recipes/wtl/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..9d54a092e0a67 --- /dev/null +++ b/recipes/wtl/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/wtl/all/test_v1_package/conanfile.py b/recipes/wtl/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..c492184eec19c --- /dev/null +++ b/recipes/wtl/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/wxwidgets/all/conandata.yml b/recipes/wxwidgets/all/conandata.yml new file mode 100644 index 0000000000000..0b2357cd4a254 --- /dev/null +++ b/recipes/wxwidgets/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "3.2.6": + url: "https://github.com/wxWidgets/wxWidgets/archive/v3.2.6.tar.gz" + sha256: "46372b2dbf976521e1d7cca22afc3d3542d171a488b391444cf89aba87ea7d16" + "3.2.5": + url: "https://github.com/wxWidgets/wxWidgets/archive/v3.2.5.tar.gz" + sha256: "c3a54d1c5dc3feefc2893c28923fd722c990c572253d5ad353eec99386ba11eb" diff --git a/recipes/wxwidgets/all/conanfile.py b/recipes/wxwidgets/all/conanfile.py new file mode 100644 index 0000000000000..2c7e205109d1f --- /dev/null +++ b/recipes/wxwidgets/all/conanfile.py @@ -0,0 +1,478 @@ +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, export_conandata_patches, get, replace_in_file, rmdir +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version +from conan.tools.system import package_manager +from conan.errors import ConanInvalidConfiguration +import os + +required_conan_version = ">=1.60.0 <2.0 || >=2.0.6" + + +class wxWidgetsConan(ConanFile): + name = "wxwidgets" + description = "wxWidgets is a C++ library that lets developers create applications for Windows, macOS, " \ + "Linux and other platforms with a single code base." + topics = ("wxwidgets", "gui", "ui") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://www.wxwidgets.org" + license = "wxWidgets" + settings = "os", "arch", "compiler", "build_type" + + options = {"shared": [True, False], + "fPIC": [True, False], + "jpeg": ["libjpeg", "libjpeg-turbo", "mozjpeg"], + "secretstore": [True, False], + "aui": [True, False], + "opengl": [True, False], + "html": [True, False], + "mediactrl": [True, False], + "propgrid": [True, False], + "debugreport": [True, False], + "ribbon": [True, False], + "richtext": [True, False], + "sockets": [True, False], + "stc": [True, False], + "webview": [True, False], + "xml": [True, False], + "xrc": [True, False], + "cairo": [True, False], + "help": [True, False], + "html_help": [True, False], + "url": [True, False], + "protocol": [True, False], + "fs_inet": [True, False], + "custom_enables": ["ANY"], # comma splitted list + "custom_disables": ["ANY"]} + default_options = { + "shared": False, + "fPIC": True, + "jpeg": "libjpeg", + "secretstore": True, + "aui": True, + "opengl": True, + "html": True, + "mediactrl": False, + "propgrid": True, + "debugreport": True, + "ribbon": True, + "richtext": True, + "sockets": True, + "stc": True, + # WebKitGTK for GTK2 is not available as a system dependency on modern distros. + # When gtk/system defaults to GTK3, turn this back on. + "webview": False, + "xml": True, + "xrc": True, + "cairo": True, + "help": True, + "html_help": True, + "url": True, + "protocol": True, + "fs_inet": True, + "custom_enables": "", + "custom_disables": "" + } + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + self.options.rm_safe("fPIC") + if self.settings.os != "Linux": + self.options.rm_safe("secretstore") + self.options.rm_safe("cairo") + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + @property + def _gtk_version(self): + return f"gtk{self.dependencies['gtk'].options.version}" + + def system_requirements(self): + apt = package_manager.Apt(self) + packages = [] + if self.options.get_safe("secretstore"): + packages.append("libsecret-1-dev") + if self.options.webview: + if self._gtk_version == "gtk2": + packages.extend(["libsoup2.4-dev", + "libwebkitgtk-dev"]) + else: + packages.extend(["libsoup3.0-dev", + "libwebkit2gtk-4.0-dev"]) + if self.options.get_safe("cairo"): + packages.append("libcairo2-dev") + apt.install(packages) + + yum = package_manager.Yum(self) + packages = [] + if self.options.get_safe("secretstore"): + packages.append("libsecret-devel") + if self.options.webview: + packages.extend(["libsoup3-devel", + "webkit2gtk4.1-devel"]) + if self.options.get_safe("cairo"): + packages.append("cairo-devel") + yum.install(packages) + + def build_requirements(self): + self.tool_requires("ninja/1.11.1") + self.tool_requires("cmake/[>=3.17]") + + # TODO: add support for gtk non system version when it's ready for Conan 2 + def requirements(self): + if self.settings.os == "Linux": + self.requires("xorg/system") + self.requires("gtk/system") + if self.options.get_safe("opengl", default=False): + self.requires("opengl/system") + self.requires("xkbcommon/1.6.0", options={"with_x11": True}) + # TODO: Does not work right now + # if self.options.get_safe("cairo"): + # self.requires("cairo/1.18.0") + if self.options.mediactrl: + self.requires("gstreamer/1.22.3") + self.requires("gst-plugins-base/1.19.2") + self.requires("libcurl/[>=7.78.0 <9]") + + if self.options.jpeg == "libjpeg": + self.requires("libjpeg/9e") + elif self.options.jpeg == "libjpeg-turbo": + self.requires("libjpeg-turbo/3.0.2") + elif self.options.jpeg == "mozjpeg": + self.requires("mozjpeg/4.1.5") + + self.requires("libpng/[>=1.6 <2]") + self.requires("libtiff/4.6.0") + self.requires("zlib/[>=1.2.11 <2]") + self.requires("expat/[>=2.6.2 <3]") + self.requires("pcre2/10.42") + self.requires("nanosvg/cci.20231025") + + def validate(self): + if self.settings.os == "Linux": + if not self.dependencies.direct_host["xkbcommon"].options.with_x11: + raise ConanInvalidConfiguration("The 'with_x11' option for the 'xkbcommon' package must be enabled") + + 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) + # Don't change library names when cross-compiling + replace_in_file(self, os.path.join(self.source_folder, "build", "cmake", "functions.cmake"), + 'set(cross_target "-${CMAKE_SYSTEM_NAME}")', + 'set(cross_target)') + # Don't override Conan's toolchain + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "CMAKE_OSX_DEPLOYMENT_TARGET", + "CMAKE_OSX_DEPLOYMENT_TARGET_IGNORED") + # Fix for strcpy_s (fix upstream?) + if is_apple_os(self): + cmake_version = "3.0" + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + f'cmake_minimum_required(VERSION {cmake_version})', + f'cmake_minimum_required(VERSION {cmake_version})\nadd_definitions(-D__STDC_WANT_LIB_EXT1__)') + + def generate(self): + tc = CMakeToolchain(self) + + # generic build options + tc.variables["wxBUILD_SHARED"] = self.options.shared + tc.variables["wxBUILD_SAMPLES"] = "OFF" + tc.variables["wxBUILD_TESTS"] = "OFF" + tc.variables["wxBUILD_DEMOS"] = "OFF" + tc.variables["wxBUILD_INSTALL"] = True + if self.settings.compiler == "clang": + tc.variables["wxBUILD_PRECOMP"] = "OFF" + + # platform-specific options + if is_msvc(self): + tc.variables["wxBUILD_USE_STATIC_RUNTIME"] = "MT" in str(self.settings.compiler.runtime) + tc.variables["wxBUILD_MSVC_MULTIPROC"] = True + if self.settings.os == "Linux": + tc.variables["wxBUILD_TOOLKIT"] = self._gtk_version + tc.variables["wxUSE_CAIRO"] = self.options.cairo + # Disable some optional libraries that will otherwise lead to non-deterministic builds + if self.settings.os != "Windows": + tc.variables["wxUSE_LIBSDL"] = "OFF" + tc.variables["wxUSE_LIBICONV"] = "OFF" + tc.variables["wxUSE_LIBNOTIFY"] = "OFF" + tc.variables["wxUSE_LIBMSPACK"] = "OFF" + tc.variables["wxUSE_LIBGNOMEVFS"] = "OFF" + + tc.variables["wxUSE_LIBPNG"] = "sys" + tc.variables["wxUSE_LIBJPEG"] = "sys" + tc.variables["wxUSE_LIBTIFF"] = "sys" + tc.variables["wxUSE_ZLIB"] = "sys" + tc.variables["wxUSE_EXPAT"] = "sys" + tc.variables["wxUSE_REGEX"] = "sys" + tc.variables["wxUSE_NANOSVG"] = "sys" + + # wxWidgets features + tc.variables["wxUSE_SECRETSTORE"] = self.options.get_safe("secretstore") + + # wxWidgets libraries + tc.variables["wxUSE_AUI"] = self.options.aui + tc.variables["wxUSE_OPENGL"] = self.options.get_safe("opengl", default=False) + tc.variables["wxUSE_HTML"] = self.options.html + tc.variables["wxUSE_MEDIACTRL"] = self.options.mediactrl + tc.variables["wxUSE_PROPGRID"] = self.options.propgrid + tc.variables["wxUSE_DEBUGREPORT"] = self.options.debugreport + tc.variables["wxUSE_RIBBON"] = self.options.ribbon + tc.variables["wxUSE_RICHTEXT"] = self.options.richtext + tc.variables["wxUSE_SOCKETS"] = self.options.sockets + tc.variables["wxUSE_STC"] = self.options.stc + tc.variables["wxUSE_WEBVIEW"] = self.options.webview + tc.variables["wxUSE_XML"] = self.options.xml + tc.variables["wxUSE_XRC"] = self.options.xrc + tc.variables["wxUSE_HELP"] = self.options.help + tc.variables["wxUSE_WXHTML_HELP"] = self.options.html_help + tc.variables["wxUSE_URL"] = self.options.protocol + tc.variables["wxUSE_PROTOCOL"] = self.options.protocol + tc.variables["wxUSE_FS_INET"] = self.options.fs_inet + tc.cache_variables["CMAKE_CONFIGURATION_TYPES"] = "Debug;Release;RelWithDebInfo;MinSizeRel" + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + + for item in str(self.options.custom_enables).split(","): + if len(item) > 0: + tc.variables[item] = True + for item in str(self.options.custom_disables).split(","): + if len(item) > 0: + tc.variables[item] = False + + tc.generate() + + deps = CMakeDeps(self) + deps.set_property("expat", "cmake_file_name", "EXPAT") + deps.set_property("expat", "cmake_target_name", "EXPAT") + deps.set_property("nanosvg", "cmake_file_name", "NanoSVG") + deps.set_property("nanosvg", "cmake_target_name", "NanoSVG::nanosvg") + deps.generate() + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, pattern="licence.txt", + src=os.path.join(self.source_folder, "docs"), + dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + # remove cmake files + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + # copy setup.h + copy(self, pattern="*setup.h", + src=os.path.join(self.build_folder, "lib"), + dst=os.path.join(self.package_folder, "include", "wx"), + keep_path=False) + + if self.settings.os == "Windows": + # copy wxrc.exe + copy(self, pattern="*", + src=os.path.join(self.build_folder, "bin"), + dst=os.path.join(self.package_folder, "bin"), + keep_path=False) + else: + # make relative symlink + bin_dir = os.path.join(self.package_folder, "bin") + for x in os.listdir(bin_dir): + filename = os.path.join(bin_dir, x) + if os.path.islink(filename): + target = os.readlink(filename) + if os.path.isabs(target): + rel = os.path.relpath(target, bin_dir) + os.remove(filename) + os.symlink(rel, filename) + + def package_info(self): + self.cpp_info.set_property("cmake_find_mode", "both") + self.cpp_info.set_property("cmake_file_name", "wxWidgets") + self.cpp_info.set_property("cmake_target_name", "wxWidgets::wxWidgets") + self.cpp_info.set_property("pkg_config_name", "wxwidgets") + + _version = Version(self.version) + version_suffix_major_minor = f"-{_version.major}.{_version.minor}" + + # wx no longer uses a debug suffix for non-windows platforms from 3.1.3 onwards + use_debug_suffix = False + if self.settings.build_type == "Debug" and self.settings.os == "Windows": + use_debug_suffix = True + + debug = "d" if use_debug_suffix else "" + + if self.settings.os == "Linux": + prefix = "wx_" + toolkit = self._gtk_version + version = "" + suffix = version_suffix_major_minor + elif self.settings.os == "Macos": + prefix = "wx_" + toolkit = "osx_cocoa" + version = "" + suffix = version_suffix_major_minor + elif self.settings.os == "Windows": + toolkit = "msw" + if is_msvc(self): + prefix = "wx" + version = f"{_version.major}{_version.minor}" + suffix = "" + else: + prefix = "wx_" + version = "" + suffix = version_suffix_major_minor + + def base_library_pattern(library): + return "{prefix}base{version}u{debug}_%s{suffix}" % library + + def library_pattern(library): + return "{prefix}{toolkit}{version}u{debug}_%s{suffix}" % library + + libs = [] + libs.append("{prefix}base{version}u{debug}{suffix}") + libs.append(library_pattern("core")) + libs.append(library_pattern("adv")) + if self.options.sockets: + libs.append(base_library_pattern("net")) + if self.options.xml: + libs.append(base_library_pattern("xml")) + if self.options.aui: + libs.append(library_pattern("aui")) + if self.options.get_safe("opengl", default=False): + libs.append(library_pattern("gl")) + if self.options.html: + libs.append(library_pattern("html")) + if self.options.mediactrl: + libs.append(library_pattern("media")) + if self.options.propgrid: + libs.append(library_pattern("propgrid")) + if self.options.debugreport: + libs.append(library_pattern("qa")) + if self.options.ribbon: + libs.append(library_pattern("ribbon")) + if self.options.richtext: + libs.append(library_pattern("richtext")) + if self.options.stc: + if not self.options.shared: + scintilla_suffix = "{debug}" if self.settings.os == "Windows" else "{suffix}" + libs.append("wxscintilla" + scintilla_suffix) + libs.append(library_pattern("stc")) + if self.options.webview: + libs.append(library_pattern("webview")) + if self.options.xrc: + libs.append(library_pattern("xrc")) + for lib in reversed(libs): + self.cpp_info.libs.append(lib.format(prefix=prefix, + toolkit=toolkit, + version=version, + debug=debug, + suffix=suffix)) + + self.cpp_info.defines.append("wxUSE_GUI=1") + if self.settings.build_type == "Debug": + self.cpp_info.defines.append("__WXDEBUG__") + if self.options.shared: + self.cpp_info.defines.append("WXUSINGDLL") + if self.settings.os == "Linux": + self.cpp_info.defines.append("__WXGTK__") + self.cpp_info.system_libs.extend(["dl", "pthread", "SM"]) + elif self.settings.os == "Macos": + self.cpp_info.defines.extend(["__WXMAC__", "__WXOSX__", "__WXOSX_COCOA__"]) + for framework in ["Carbon", + "Cocoa", + "AudioToolbox", + "OpenGL", + "AppKit", + "AVKit", + "AVFoundation", + "Foundation", + "IOKit", + "ApplicationServices", + "CoreFoundation", + "CoreText", + "CoreGraphics", + "CoreServices", + "CoreMedia", + "CFNetwork", + "Security", + "ImageIO", + "System", + "WebKit", + "QuartzCore"]: + self.cpp_info.frameworks.append(framework) + elif self.settings.os == "Windows": + # see cmake/init.cmake + compiler_prefix = {"Visual Studio": "vc", + "msvc": "vc", + "gcc": "gcc", + "clang": "clang"}.get(str(self.settings.compiler)) + + arch_suffix = "_x64" if self.settings.arch == "x86_64" else "" + lib_suffix = "_dll" if self.options.shared else "_lib" + libdir = f"{compiler_prefix}{arch_suffix}{lib_suffix}" + libdir = os.path.join("lib", libdir) + self.cpp_info.bindirs.append(libdir) + self.cpp_info.libdirs.append(libdir) + self.cpp_info.defines.append("__WXMSW__") + # disable annoying auto-linking + self.cpp_info.defines.extend(["wxNO_NET_LIB", + "wxNO_XML_LIB", + "wxNO_REGEX_LIB", + "wxNO_ZLIB_LIB", + "wxNO_JPEG_LIB", + "wxNO_PNG_LIB", + "wxNO_TIFF_LIB", + "wxNO_ADV_LIB", + "wxNO_HTML_LIB", + "wxNO_GL_LIB", + "wxNO_QA_LIB", + "wxNO_XRC_LIB", + "wxNO_AUI_LIB", + "wxNO_PROPGRID_LIB", + "wxNO_RIBBON_LIB", + "wxNO_RICHTEXT_LIB", + "wxNO_MEDIA_LIB", + "wxNO_STC_LIB", + "wxNO_WEBVIEW_LIB"]) + self.cpp_info.system_libs.extend(["kernel32", + "user32", + "gdi32", + "comdlg32", + "winspool", + "shell32", + "comctl32", + "ole32", + "oleaut32", + "imm32", + "uuid", + "wininet", + "rpcrt4", + "winmm", + "advapi32", + "msimg32", + "opengl32", + "ws2_32", + "wsock32"]) + # Link a few libraries that are needed when using gcc on windows + if self.settings.compiler == "gcc": + self.cpp_info.system_libs.extend(["uxtheme", + "version", + "shlwapi", + "oleacc"]) + if is_msvc(self): + self.cpp_info.includedirs.append(os.path.join("include", "msvc")) + else: + include_path = os.path.join("include", f"wx{version_suffix_major_minor}") + self.cpp_info.includedirs = [include_path] + self.cpp_info.includedirs diff --git a/recipes/wxwidgets/all/test_package/CMakeLists.txt b/recipes/wxwidgets/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..c4d40ad29eb0f --- /dev/null +++ b/recipes/wxwidgets/all/test_package/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +find_package(wxWidgets REQUIRED) + +if(MSVC) + add_definitions("-DUNICODE") + add_definitions("-D_UNICODE") + add_definitions("-D_CRT_SECURE_NO_WARNINGS") +endif() + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} wxWidgets::wxWidgets) diff --git a/recipes/wxwidgets/all/test_package/conanfile.py b/recipes/wxwidgets/all/test_package/conanfile.py new file mode 100644 index 0000000000000..91817d9f2df17 --- /dev/null +++ b/recipes/wxwidgets/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", "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/wxwidgets/all/test_package/test_package.cpp b/recipes/wxwidgets/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..40a8f99c42fac --- /dev/null +++ b/recipes/wxwidgets/all/test_package/test_package.cpp @@ -0,0 +1,27 @@ +#include +#include +#include +#include +#if wxUSE_STC +#include +#endif + +int main() +{ + int argc = 0; + wxChar * argv[] = {NULL}; + if (!wxEntryStart(argc, argv)) { + std::cerr << "wxEntryStart failed!" << std::endl; + return EXIT_FAILURE; + } + wxVersionInfo vi = wxGetLibraryVersionInfo(); + std::cout << "wxWidgets version: "; + std::cout << vi.GetMajor() << "."; + std::cout << vi.GetMinor() << "."; + std::cout << vi.GetMicro() << std::endl; +#if wxUSE_STC + wxStyledTextCtrl * stc = new wxStyledTextCtrl(); +#endif + wxEntryCleanup(); + return EXIT_SUCCESS; +} diff --git a/recipes/wxwidgets/config.yml b/recipes/wxwidgets/config.yml new file mode 100644 index 0000000000000..f849d473251f2 --- /dev/null +++ b/recipes/wxwidgets/config.yml @@ -0,0 +1,5 @@ +versions: + "3.2.6": + folder: "all" + "3.2.5": + folder: "all" diff --git a/recipes/wyhash/all/conandata.yml b/recipes/wyhash/all/conandata.yml index 97f88594e3ec8..585638f0f02fb 100644 --- a/recipes/wyhash/all/conandata.yml +++ b/recipes/wyhash/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "final4": + url: "https://github.com/wangyi-fudan/wyhash/archive/refs/tags/wyhash_final4.tar.gz" + sha256: "a3f2da3acf300fba43f51c8299dae71c4e0774cd6fdd96e264fad5777b12ae3a" "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 index 34e8d0350c888..1fde6aed28d50 100644 --- a/recipes/wyhash/all/conanfile.py +++ b/recipes/wyhash/all/conanfile.py @@ -4,7 +4,7 @@ import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.50.0" class WyhashConan(ConanFile): name = "wyhash" @@ -13,8 +13,10 @@ class WyhashConan(ConanFile): 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") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True + deprecated = "rapidhash" def layout(self): basic_layout(self, src_folder="src") @@ -23,7 +25,7 @@ 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 package(self): copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) diff --git a/recipes/wyhash/config.yml b/recipes/wyhash/config.yml index eec24bd72e90d..80db1803c9cf5 100644 --- a/recipes/wyhash/config.yml +++ b/recipes/wyhash/config.yml @@ -1,3 +1,5 @@ versions: + "final4": + folder: all "cci.20221102": folder: all diff --git a/recipes/xapian-core/all/conandata.yml b/recipes/xapian-core/all/conandata.yml index 3982cd0a47586..18806738cffac 100644 --- a/recipes/xapian-core/all/conandata.yml +++ b/recipes/xapian-core/all/conandata.yml @@ -1,24 +1,18 @@ sources: + "1.4.24": + url: "https://oligarchy.co.uk/xapian/1.4.24/xapian-core-1.4.24.tar.xz" + sha256: "eda5ae6dcf6b0553a8676af64b1fd304e998cd20f779031ccaaf7ab9a373531a" "1.4.19": url: "https://oligarchy.co.uk/xapian/1.4.19/xapian-core-1.4.19.tar.xz" sha256: "1fca48fca6cc3526cc4ba93dd194fe9c1326857b78edcfb37e68d086d714a9c3" "1.4.18": url: "https://oligarchy.co.uk/xapian/1.4.18/xapian-core-1.4.18.tar.xz" sha256: "196ddbb4ad10450100f0991a599e4ed944cbad92e4a6fe813be6dce160244b77" - "1.4.16": - url: "https://oligarchy.co.uk/xapian/1.4.16/xapian-core-1.4.16.tar.xz" - sha256: "4937f2f49ff27e39a42150e928c8b45877b0bf456510f0785f50159a5cb6bf70" patches: + "1.4.24": + - patch_file: "patches/0001-add-msvc-cl-sh.patch" "1.4.19": - patch_file: "patches/0001-add-msvc-cl-sh.patch" - base_path: "" "1.4.18": - patch_file: "patches/0001-add-msvc-cl-sh.patch" - base_path: "" - patch_file: "patches/0002-add-cerrno.patch" - base_path: "source_subfolder" - "1.4.16": - - patch_file: "patches/0001-add-msvc-cl-sh.patch" - base_path: "" - - patch_file: "patches/0003-missing-limits-include.patch" - base_path: "source_subfolder" diff --git a/recipes/xapian-core/all/conanfile.py b/recipes/xapian-core/all/conanfile.py index 257fe6219505e..fd5b09b5d2d5d 100644 --- a/recipes/xapian-core/all/conanfile.py +++ b/recipes/xapian-core/all/conanfile.py @@ -1,14 +1,16 @@ 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.scm import Version from conan.errors import ConanInvalidConfiguration -from conans import AutoToolsBuildEnvironment, tools -from contextlib import contextmanager -import functools +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 Environment, VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rename, rm, rmdir, save +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, unix_path_package_info_legacy +import os import textwrap -required_conan_version = ">=1.51.0" +required_conan_version = ">=1.57.0" class XapianCoreConan(ConanFile): @@ -22,6 +24,7 @@ class XapianCoreConan(ConanFile): homepage = "https://xapian.org/" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -32,17 +35,12 @@ class XapianCoreConan(ConanFile): "fPIC": True, } - @property - def _source_subfolder(self): - return "source_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"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -50,100 +48,121 @@ 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.13") + self.requires("zlib/[>=1.2.11 <2]") if self.settings.os != "Windows": - self.requires("libuuid/1.0.3") + self.requires("util-linux-libuuid/2.39") def validate(self): if self.options.shared and self.settings.os == "Windows": - raise ConanInvalidConfiguration("shared builds are unavailable due to libtool's inability to create shared libraries") + raise ConanInvalidConfiguration( + "shared builds are unavailable due to libtool's inability to create shared libraries" + ) 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): - 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) - @contextmanager - def _build_context(self): - if is_msvc(self): - with tools.vcvars(self.settings): - msvc_cl_sh = f"{self.build_folder}/msvc_cl.sh".replace("\\", "/") - env = { - "AR": "lib", - "CC": msvc_cl_sh, - "CXX": msvc_cl_sh, - "LD": msvc_cl_sh, - "NM": "dumpbin -symbols", - "OBJDUMP": ":", - "RANLIB": ":", - "STRIP": ":", - } - 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") - @property - def _datarootdir(self): - return f"{self.package_folder}/bin/share" - - @functools.lru_cache(1) - def _configure_autotools(self): - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - autotools.libs = [] - autotools.link_flags.extend(["-L{}".format(l.replace("\\", "/")) for l in autotools.library_paths]) - autotools.library_paths = [] + tc = AutotoolsToolchain(self) if is_msvc(self): - autotools.cxx_flags.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"): - autotools.flags.append("-FS") - conf_args = [ - "--datarootdir={}".format(self._datarootdir.replace("\\", "/")), + tc.extra_cxxflags.append("-EHsc") + if check_min_vs(self, "180", raise_invalid=False): + tc.extra_cflags.append("-FS") + tc.extra_cxxflags.append("-FS") + tc.configure_args.extend([ + "--datarootdir=${prefix}/res", "--disable-documentation", - ] - if self.options.shared: - conf_args.extend(["--enable-shared", "--disable-static"]) - else: - conf_args.extend(["--disable-shared", "--enable-static"]) - autotools.configure(args=conf_args, configure_dir=self._source_subfolder) - return autotools + ]) + env = tc.environment() + if is_msvc(self): + msvc_cl_sh = unix_path(self, os.path.join(self.source_folder, "msvc_cl.sh")) + env.define("AR", "lib") + env.define("CC", msvc_cl_sh) + env.define("CXX", msvc_cl_sh) + env.define("LD", msvc_cl_sh) + env.define("NM", "dumpbin -symbols") + env.define("OBJDUMP", ":") + env.define("RANLIB", ":") + env.define("STRIP", ":") + + if is_apple_os(self) and self.settings.arch == "armv8": + # A fix for ./configure issues on armv8 + tc.configure_args.append("--host=aarch64-apple-darwin") + tc.extra_ldflags.append("-arch arm64") + + tc.generate(env) - def _patch_sources(self): - apply_conandata_patches(self) - # Relocatable shared lib on macOS - replace_in_file(self, f"{self._source_subfolder}/configure", - "-install_name \\$rpath/", - "-install_name @rpath/") + 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("LIBS", [f"-l{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): - 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", 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() if is_msvc(self) and not self.options.shared: rename(self, f"{self.package_folder}/lib/libxapian.lib", f"{self.package_folder}/lib/xapian.lib") rm(self, "xapian-config", f"{self.package_folder}/bin") - rm(self, "libxapian.la", f"{self.package_folder}/lib") + rm(self, "*.la", f"{self.package_folder}/lib") rmdir(self, f"{self.package_folder}/lib/cmake") rmdir(self, f"{self.package_folder}/lib/pkgconfig") rmdir(self, f"{self._datarootdir}/doc") rmdir(self, f"{self._datarootdir}/man") + fix_apple_shared_install_name(self) + self._create_cmake_module_variables( f"{self.package_folder}/{self._module_file_rel_path}" ) @@ -168,12 +187,16 @@ def _create_cmake_module_variables(self, module_file): def _module_file_rel_path(self): return f"lib/cmake/conan-official-{self.name}-variables.cmake" + @property + def _datarootdir(self): + return os.path.join(self.package_folder, "res") + def package_info(self): self.cpp_info.set_property("cmake_file_name", "xapian") self.cpp_info.set_property("cmake_build_modules", [self._module_file_rel_path]) self.cpp_info.set_property("pkg_config_name", "xapian-core") - self.cpp_info.libs = ["xapian"] + self.cpp_info.resdirs = ["res"] if not self.options.shared: if self.settings.os in ("Linux", "FreeBSD"): self.cpp_info.system_libs = ["rt", "m"] @@ -182,16 +205,13 @@ def package_info(self): elif self.settings.os == "SunOS": self.cpp_info.system_libs = ["socket", "nsl"] - binpath = f"{self.package_folder}/bin" - self.output.info(f"Appending PATH environment variable: {binpath}") - self.env_info.PATH.append(binpath) - - xapian_aclocal = tools.unix_path(f"{self._datarootdir}/aclocal") - self.output.info(f"Appending AUTOMAKE_CONAN_INCLUDES environment variable: {xapian_aclocal}") - self.env_info.AUTOMAKE_CONAN_INCLUDES.append(tools.unix_path(xapian_aclocal)) + xapian_aclocal_dir = os.path.join(self._datarootdir, "aclocal") + self.buildenv_info.prepend_path("AUTOMAKE_CONAN_INCLUDES", xapian_aclocal_dir) # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.names["cmake_find_package"] = "xapian" self.cpp_info.names["cmake_find_package_multi"] = "xapian" 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")) + self.env_info.AUTOMAKE_CONAN_INCLUDES.append(unix_path_package_info_legacy(self, xapian_aclocal_dir)) diff --git a/recipes/xapian-core/all/patches/0003-missing-limits-include.patch b/recipes/xapian-core/all/patches/0003-missing-limits-include.patch deleted file mode 100644 index abcad94268aa8..0000000000000 --- a/recipes/xapian-core/all/patches/0003-missing-limits-include.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/api/omdocument.cc -+++ b/api/omdocument.cc -@@ -38,6 +38,7 @@ - #include - - #include -+#include - #include - - using namespace std; diff --git a/recipes/xapian-core/all/test_package/CMakeLists.txt b/recipes/xapian-core/all/test_package/CMakeLists.txt index 6d65c1295e47c..6d27b4aff7006 100644 --- a/recipes/xapian-core/all/test_package/CMakeLists.txt +++ b/recipes/xapian-core/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) +project(test_package LANGUAGES CXX) find_package(xapian REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_include_directories(${PROJECT_NAME} PRIVATE ${XAPIAN_INCLUDE_DIR}) -target_link_libraries(${PROJECT_NAME} ${XAPIAN_LIBRARIES}) +target_link_libraries(${PROJECT_NAME} PRIVATE ${XAPIAN_LIBRARIES}) diff --git a/recipes/xapian-core/all/test_package/conanfile.py b/recipes/xapian-core/all/test_package/conanfile.py index 38f4483872d47..98ab55852ad56 100644 --- a/recipes/xapian-core/all/test_package/conanfile.py +++ b/recipes/xapian-core/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/xapian-core/all/test_v1_package/CMakeLists.txt b/recipes/xapian-core/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/xapian-core/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/xapian-core/all/test_v1_package/conanfile.py b/recipes/xapian-core/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/xapian-core/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/xapian-core/config.yml b/recipes/xapian-core/config.yml index 6e1ece0ca59fb..9a97cca323477 100644 --- a/recipes/xapian-core/config.yml +++ b/recipes/xapian-core/config.yml @@ -1,7 +1,7 @@ versions: + "1.4.24": + folder: "all" "1.4.19": folder: "all" "1.4.18": folder: "all" - "1.4.16": - folder: "all" diff --git a/recipes/xbyak/all/conandata.yml b/recipes/xbyak/all/conandata.yml index 2e045a1c8a082..5fbe0f98a2367 100644 --- a/recipes/xbyak/all/conandata.yml +++ b/recipes/xbyak/all/conandata.yml @@ -1,4 +1,34 @@ sources: + "7.21": + url: "https://github.com/herumi/xbyak/archive/v7.21.tar.gz" + sha256: "23aad8abc682205ad718d77d51e8e66a569c66de1722b8772d1afb6cbb8d300b" + "7.20": + url: "https://github.com/herumi/xbyak/archive/v7.20.tar.gz" + sha256: "82824b436751d570f404f9d4598216dfd29596ac149bba8b6b5b4fc555061a12" + "7.10": + url: "https://github.com/herumi/xbyak/archive/v7.10.tar.gz" + sha256: "0f1060c9d14a090615f67391d7790ae596d0580726c79c9db6a249febda7ad63" + "7.08": + url: "https://github.com/herumi/xbyak/archive/v7.08.tar.gz" + sha256: "ef7f0504676635a04f2d0befdaf1c324bb1ea6af4e2636cb09eecb3da31d3402" + "7.07.1": + url: "https://github.com/herumi/xbyak/archive/v7.07.1.tar.gz" + sha256: "9f2a1215ed0511e421895d57e2681981f9f9f8fb952655919a9cf859cfe474ae" + "7.07": + url: "https://github.com/herumi/xbyak/archive/v7.07.tar.gz" + sha256: "7bd603fb8de9e605b86c1996a20111df66707c916a2ac0397424080cc0ad7bde" + "7.06": + url: "https://github.com/herumi/xbyak/archive/v7.06.tar.gz" + sha256: "686c710a67c7fb8e99d8e326cf22aea310a29db27a9db8ba19a9fee44f8ec097" + "7.05": + url: "https://github.com/herumi/xbyak/archive/v7.05.tar.gz" + sha256: "853b619a6615985dbb36e8c5528d96d83f7bba3d0728ed3b3ee8ac8f4f96d87f" + "7.00": + url: "https://github.com/herumi/xbyak/archive/v7.00.tar.gz" + sha256: "9bc479d99bb3bbd30669813ca9719126fe93ab1bae857bd799d2b16a1fcb4c32" + "6.73": + url: "https://github.com/herumi/xbyak/archive/v6.73.tar.gz" + sha256: "41f3dc7727a48c751024c92fa4da24a4a1e0ed16b7930c79d05b76960b19562d" "6.62": url: "https://github.com/herumi/xbyak/archive/v6.62.tar.gz" sha256: "fd5f074d64cdfcacad3bbe8664727a8eab569f131cadd725a778c028fa6b0ccd" diff --git a/recipes/xbyak/all/conanfile.py b/recipes/xbyak/all/conanfile.py index 9523784e16e7c..540cdf1443f84 100644 --- a/recipes/xbyak/all/conanfile.py +++ b/recipes/xbyak/all/conanfile.py @@ -1,6 +1,7 @@ from conan import ConanFile from conan.tools.files import copy, get from conan.tools.layout import basic_layout +from conan.errors import ConanInvalidConfiguration import os required_conan_version = ">=1.50.0" @@ -11,21 +12,25 @@ class XbyakConan(ConanFile): description = "Xbyak is a C++ header library that enables dynamically to " \ "assemble x86(IA32), x64(AMD64, x86-64) mnemonic." license = "BSD-3-Clause" - topics = ("xbyak", "jit", "assembler") - homepage = "https://github.com/herumi/xbyak" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/herumi/xbyak" + topics = ("jit", "assembler", "header-only") + package_type = "header-library" 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 layout(self): - basic_layout(self, src_folder="src") + def validate(self): + if self.settings.arch not in ("x86", "x86_64"): + raise ConanInvalidConfiguration(f"{self.ref} is only available for x86 and x86_64 architecture") 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 @@ -37,7 +42,6 @@ def package(self): def package_info(self): self.cpp_info.set_property("cmake_file_name", "xbyak") self.cpp_info.set_property("cmake_target_name", "xbyak::xbyak") + self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] diff --git a/recipes/xbyak/all/test_package/conanfile.py b/recipes/xbyak/all/test_package/conanfile.py index d120a992c06a6..8a5bb47f50c4c 100644 --- a/recipes/xbyak/all/test_package/conanfile.py +++ b/recipes/xbyak/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/xbyak/config.yml b/recipes/xbyak/config.yml index 9006396a7028a..00913bb048c6f 100644 --- a/recipes/xbyak/config.yml +++ b/recipes/xbyak/config.yml @@ -1,4 +1,24 @@ versions: + "7.21": + folder: all + "7.20": + folder: all + "7.10": + folder: all + "7.08": + folder: all + "7.07.1": + folder: all + "7.07": + folder: all + "7.06": + folder: all + "7.05": + folder: all + "7.00": + folder: all + "6.73": + folder: all "6.62": folder: all "6.61.2": diff --git a/recipes/xege/all/CMakeLists.txt b/recipes/xege/all/CMakeLists.txt deleted file mode 100644 index 0496b29838549..0000000000000 --- a/recipes/xege/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/xege/all/conandata.yml b/recipes/xege/all/conandata.yml index 2f7535221dfb9..fecd7fb356766 100644 --- a/recipes/xege/all/conandata.yml +++ b/recipes/xege/all/conandata.yml @@ -1,4 +1,4 @@ sources: "20.08": - url: "https://github.com/wysaid/xege/archive/refs/tags/20.08.tar.gz" + url: "https://github.com/wysaid/xege/archive/refs/tags/v20.08.tar.gz" sha256: "33bc63366d093902b5bc68d3d613ebd90e449bc22800b40f2dd98e2b5c44b88a" diff --git a/recipes/xege/all/conanfile.py b/recipes/xege/all/conanfile.py index e3d748b348f87..eb147f1dcfc1f 100644 --- a/recipes/xege/all/conanfile.py +++ b/recipes/xege/all/conanfile.py @@ -1,33 +1,37 @@ -from conans import ConanFile, CMake, 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.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get + +required_conan_version = ">=1.53.0" class XegeConan(ConanFile): name = "xege" + description = "Easy Graphics Engine, a lite graphics library in Windows" license = "LGPLv2.1" url = "https://github.com/conan-io/conan-center-index" homepage = "https://xege.org/" - description = "Easy Graphics Engine, a lite graphics library in Windows" topics = ("ege", "graphics", "gui") - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" - exports_sources = ["CMakeLists.txt"] - def configure(self): - if self.settings.os != "Windows": - raise ConanInvalidConfiguration( - "This library is only compatible for Windows") + package_type = "static-library" + settings = "os", "arch", "compiler", "build_type" - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + if self.settings.os != "Windows": + raise ConanInvalidConfiguration("This library is only compatible with 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 generate(self): + tc = CMakeToolchain(self) + tc.generate() def build(self): cmake = CMake(self) @@ -35,24 +39,21 @@ def build(self): cmake.build() def package(self): - self.copy("*.h", dst="include", src=self._source_subfolder+"/src") - self.copy("*.lib", dst="lib", keep_path=False) - self.copy("*.dll", dst="bin", keep_path=False) - self.copy("*.so", dst="lib", keep_path=False) - self.copy("*.a", dst="lib", keep_path=False) - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + copy(self, "LICENSE", + 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, "src")) + for pattern in ["*.lib", "*.a"]: + copy(self, pattern, + dst=os.path.join(self.package_folder, "lib"), + src=self.build_folder, + keep_path=False) def package_info(self): if self.settings.arch == "x86_64": self.cpp_info.libs = ["graphics64"] else: self.cpp_info.libs = ["graphics"] - self.cpp_info.system_libs = [ - "gdiplus", - "uuid", - "msimg32", - "gdi32", - "imm32", - "ole32", - "oleaut32" - ] + self.cpp_info.system_libs = ["gdiplus", "uuid", "msimg32", "gdi32", "imm32", "ole32", "oleaut32"] diff --git a/recipes/xege/all/test_package/CMakeLists.txt b/recipes/xege/all/test_package/CMakeLists.txt index dd28555a7ac65..26ea67c5823c3 100644 --- a/recipes/xege/all/test_package/CMakeLists.txt +++ b/recipes/xege/all/test_package/CMakeLists.txt @@ -1,12 +1,7 @@ -cmake_minimum_required(VERSION 3.1) -project(PackageTest CXX) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(xege REQUIRED CONFIG) -add_executable(example example.cpp) -target_link_libraries(example ${CONAN_LIBS}) - -if(MSYS OR MINGW) - target_link_libraries(example -static-libgcc -static-libstdc++) -endif() +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE xege::xege) diff --git a/recipes/xege/all/test_package/conanfile.py b/recipes/xege/all/test_package/conanfile.py index 2011b67ca68a5..e845ae751a301 100644 --- a/recipes/xege/all/test_package/conanfile.py +++ b/recipes/xege/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 XegeTestConan(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", "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/xege/all/test_package/example.cpp b/recipes/xege/all/test_package/example.cpp deleted file mode 100644 index e167cd38f70ed..0000000000000 --- a/recipes/xege/all/test_package/example.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include - -using namespace ege; - -int main() { - initgraph(640, 480); - circle(120, 120, 100); - Sleep(2000); - closegraph(); -} diff --git a/recipes/xege/all/test_package/test_package.cpp b/recipes/xege/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..658780d07761b --- /dev/null +++ b/recipes/xege/all/test_package/test_package.cpp @@ -0,0 +1,10 @@ +#include + +using namespace ege; + +int main() { + initgraph(640, 480); + circle(120, 120, 100); + Sleep(2000); + closegraph(); +} diff --git a/recipes/xege/all/test_v1_package/CMakeLists.txt b/recipes/xege/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/xege/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/xege/all/test_v1_package/conanfile.py b/recipes/xege/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..423b8142d5f25 --- /dev/null +++ b/recipes/xege/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class XegeTestConan(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/xerces-c/all/conandata.yml b/recipes/xerces-c/all/conandata.yml index b384861145f6b..7c2baf54d287f 100644 --- a/recipes/xerces-c/all/conandata.yml +++ b/recipes/xerces-c/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.2.5": + url: "https://github.com/apache/xerces-c/archive/v3.2.5.tar.gz" + sha256: "4042f6f11c9eba745dc0e5f8035d98b442097ee4efc69e4853410e4737a987f8" "3.2.4": url: "https://github.com/apache/xerces-c/archive/v3.2.4.tar.gz" sha256: "8dfaa30d6a641bda113625ef65e43c433e8ffd94fadd3b8d39dfe6faf450f26d" @@ -9,12 +12,19 @@ sources: url: "https://github.com/apache/xerces-c/archive/v3.2.2.tar.gz" sha256: "7fe5af7d7ad9d4a06503c15fb5bb0aa5f2ba7959700d16c21b8bd183ca542e7f" patches: + "3.2.5": + - patch_file: "patches/0002-find-icu-programs.patch" + patch_description: "Find ICU programs on environment" + patch_type: "conan" "3.2.4": - - patch_file: "patches/0001-remove-test-samples-324.patch" - patch_file: "patches/0002-find-icu-programs.patch" + patch_description: "Find ICU programs on environment" + patch_type: "conan" "3.2.3": - - patch_file: "patches/0001-remove-test-samples.patch" - patch_file: "patches/0002-find-icu-programs.patch" + patch_description: "Find ICU programs on environment" + patch_type: "conan" "3.2.2": - - patch_file: "patches/0001-remove-test-samples.patch" - patch_file: "patches/0002-find-icu-programs.patch" + patch_description: "Find ICU programs on environment" + patch_type: "conan" diff --git a/recipes/xerces-c/all/conanfile.py b/recipes/xerces-c/all/conanfile.py index 30133690332a3..a7daf64e71cdb 100644 --- a/recipes/xerces-c/all/conanfile.py +++ b/recipes/xerces-c/all/conanfile.py @@ -1,12 +1,12 @@ 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.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import apply_conandata_patches, collect_libs, copy, export_conandata_patches, get, rmdir, save from conan.tools.scm import Version import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.60.0 <2 || >=2.0.5" class XercesCConan(ConanFile): @@ -19,12 +19,14 @@ class XercesCConan(ConanFile): homepage = "http://xerces.apache.org/xerces-c/index.html" license = "Apache-2.0" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], # https://xerces.apache.org/xerces-c/build-3.html "char_type": ["uint16_t", "char16_t", "wchar_t"], + "network": [True, False], "network_accessor": ["curl", "socket", "cfurl", "winsock"], "transcoder": ["gnuiconv", "iconv", "icu", "macosunicodeconverter", "windows"], "message_loader": ["inmemory", "icu", "iconv"], @@ -34,12 +36,17 @@ class XercesCConan(ConanFile): "shared": False, "fPIC": True, "char_type": "uint16_t", + "network": True, "network_accessor": "socket", "transcoder": "gnuiconv", "message_loader": "inmemory", "mutex_manager": "standard", } + @property + def _is_legacy_one_profile(self): + return not hasattr(self, "settings_build") + def export_sources(self): export_conandata_patches(self) @@ -58,21 +65,20 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") + if not self.options.network: + self.options.rm_safe("network_accessor") 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/71.1") - if self.options.network_accessor == "curl": - self.requires("libcurl/7.85.0") + self.requires("icu/74.2") + if self.options.get_safe("network_accessor") == "curl": + self.requires("libcurl/[>=7.78.0 <9]") - def _validate(self, option, value, os): + def _validate(self, option, value, host_os): """ Validate that the given `option` has the required `value` for the given `os` If not raises a ConanInvalidConfiguration error @@ -82,11 +88,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.info.settings.os not in os and getattr(self.info.options, option) == value: - raise ConanInvalidConfiguration(f"Option '{option}={value}' is only supported on {os}") + if self.settings.os not in host_os and self.options.get_safe(option) == value: + raise ConanInvalidConfiguration(f"Option '{option}={value}' is only supported on {host_os}") def validate(self): - if self.info.settings.os not in ("Windows", "Macos", "Linux"): + if self.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", )) @@ -99,41 +105,61 @@ def validate(self): self._validate("mutex_manager", "windows", ("Windows", )) def build_requirements(self): - if hasattr(self, "settings_build") and self.options.message_loader == "icu": - self.tool_requires("icu/71.1") + if self.options.message_loader == "icu" and not self._is_legacy_one_profile: + self.tool_requires("icu/") 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 self.options.message_loader == "icu" and self._is_legacy_one_profile: + env = VirtualRunEnv(self) + env.generate(scope="build") 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" + + # Prevent linking against unused found library + tc.cache_variables["NSL_LIBRARY"] = "NSL_LIBRARY-NOTFOUND" + # https://xerces.apache.org/xerces-c/build-3.html - tc.variables["network-accessor"] = self.options.network_accessor + tc.variables["network"] = self.options.network + if self.options.network: + 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 - tc.variables["CMAKE_DISABLE_FIND_PACKAGE_CURL"] = self.options.network_accessor != "curl" + tc.variables["CMAKE_DISABLE_FIND_PACKAGE_CURL"] = self.options.get_safe("network_accessor") != "curl" tc.variables["CMAKE_DISABLE_FIND_PACKAGE_ICU"] = "icu" not in (self.options.transcoder, self.options.message_loader) + + # Fix compatibility with Clang on Windows + # https://issues.apache.org/jira/browse/XERCESC-2252 + if self.settings.os == "Windows" and self.settings.compiler == "clang": + tc.cache_variables["CMAKE_RC_FLAGS"] = "-C 1252" + tc.generate() deps = CMakeDeps(self) deps.generate() - def build(self): + def _patch_sources(self): apply_conandata_patches(self) + # Disable subdirectories + for subdir in ["doc", "tests", "samples"]: + save(self, os.path.join(self.source_folder, subdir, "CMakeLists.txt"), "") + + def build(self): + self._patch_sources() cmake = CMake(self) cmake.configure() cmake.build() def package(self): - for license in ("LICENSE", "NOTICE"): - copy(self, license, src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + for license_file in ("LICENSE", "NOTICE"): + copy(self, license_file, 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")) @@ -150,7 +176,7 @@ def package_info(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.system_libs.extend(["pthread"]) if Version(conan_version).major < 2: self.cpp_info.names["cmake_find_package"] = "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 deleted file mode 100644 index 248d7401136e7..0000000000000 --- a/recipes/xerces-c/all/patches/0001-remove-test-samples-324.patch +++ /dev/null @@ -1,27 +0,0 @@ -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/patches/0001-remove-test-samples.patch b/recipes/xerces-c/all/patches/0001-remove-test-samples.patch deleted file mode 100644 index 9b610bf94fb8e..0000000000000 --- a/recipes/xerces-c/all/patches/0001-remove-test-samples.patch +++ /dev/null @@ -1,27 +0,0 @@ -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 4254f89bb..dfd4bb01b 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -175,10 +175,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_v1_package/CMakeLists.txt b/recipes/xerces-c/all/test_v1_package/CMakeLists.txt index 7c3c78b82bae7..0d20897301b68 100644 --- a/recipes/xerces-c/all/test_v1_package/CMakeLists.txt +++ b/recipes/xerces-c/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(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) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/xerces-c/config.yml b/recipes/xerces-c/config.yml index 795ad892ef369..a8902c8d470c0 100644 --- a/recipes/xerces-c/config.yml +++ b/recipes/xerces-c/config.yml @@ -1,4 +1,6 @@ versions: + "3.2.5": + folder: all "3.2.4": folder: all "3.2.3": diff --git a/recipes/xkbcommon/all/conandata.yml b/recipes/xkbcommon/all/conandata.yml index eb163931d3401..35dd4985bdd4e 100644 --- a/recipes/xkbcommon/all/conandata.yml +++ b/recipes/xkbcommon/all/conandata.yml @@ -1,28 +1,25 @@ sources: + "1.6.0": + url: "https://xkbcommon.org/download/libxkbcommon-1.6.0.tar.xz" + sha256: "0edc14eccdd391514458bc5f5a4b99863ed2d651e4dd761a90abf4f46ef99c2b" + "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 a41c07e038a67..cedd8883aca46 100644 --- a/recipes/xkbcommon/all/conanfile.py +++ b/recipes/xkbcommon/all/conanfile.py @@ -1,20 +1,22 @@ import os +import textwrap 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.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import copy, get, replace_in_file, 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 from conan.errors import ConanInvalidConfiguration -required_conan_version = ">=1.53.0" +required_conan_version = ">=1.60.0 <2 || >=2.0.5" class XkbcommonConan(ConanFile): name = "xkbcommon" + package_type = "library" description = "keymap handling library for toolkits and window systems" topics = ("keyboard", "wayland", "x11", "xkb") url = "https://github.com/conan-io/conan-center-index" @@ -56,81 +58,88 @@ def configure(self): 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("xkeyboard-config/system") if self.options.with_x11: self.requires("xorg/system") if self.options.get_safe("xkbregistry"): - self.requires("libxml2/2.10.3") + self.requires("libxml2/[>=2.12.5 <3]") if self.options.get_safe("with_wayland"): - self.requires("wayland/1.21.0") - if not self._has_build_profile: - self.requires("wayland-protocols/1.27") + self.requires("wayland/1.22.0") def validate(self): - if self.info.settings.os not in ["Linux", "FreeBSD"]: + if self.settings.os not in ["Linux", "FreeBSD"]: raise ConanInvalidConfiguration(f"{self.ref} is only compatible with Linux and FreeBSD") def build_requirements(self): - self.tool_requires("meson/0.64.1") + self.tool_requires("meson/1.3.2") 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") - self.tool_requires("wayland-protocols/1.27") - - def layout(self): - basic_layout(self, src_folder="src") + self.tool_requires("pkgconf/2.1.0") + if self.options.get_safe("with_wayland"): + if self._has_build_profile: + self.tool_requires("wayland/") + self.tool_requires("wayland-protocols/1.33") 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 self.options.get_safe("with_wayland") and not self._has_build_profile: + env = VirtualRunEnv(self) + env.generate(scope="build") + tc = MesonToolchain(self) + if Version(self.version) >= "1.6": + tc.project_options["enable-bash-completion"] = False 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.project_options["build.pkg_config_path"] = self.generators_folder tc.generate() 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() - - virtual_build_env = VirtualBuildEnv(self) - virtual_build_env.generate() - - 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 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)") + pkg_config_deps.build_context_activated = ["wayland", "wayland-protocols"] + pkg_config_deps.build_context_suffix = {"wayland": "_BUILD"} 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()") + # Manually generate pkgconfig file of wayland-protocols since + # PkgConfigDeps.build_context_activated can't work with legacy 1 profile + wp_prefix = self.dependencies.build["wayland-protocols"].package_folder + wp_version = self.dependencies.build["wayland-protocols"].ref.version + wp_pkg_content = textwrap.dedent(f"""\ + prefix={wp_prefix} + datarootdir=${{prefix}}/res + pkgdatadir=${{datarootdir}}/wayland-protocols + Name: Wayland Protocols + Description: Wayland protocol files + Version: {wp_version} + """) + save(self, os.path.join(self.generators_folder, "wayland-protocols.pc"), wp_pkg_content) + 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 _patch_sources(self): + if self.options.get_safe("with_wayland"): + if self._has_build_profile: + # Patch the build system to use the pkg-config files generated for 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_BUILD', required: false, native: true)", + ) + def build(self): + self._patch_sources() meson = Meson(self) meson.configure() meson.build() @@ -139,9 +148,9 @@ def package(self): copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) meson = Meson(self) meson.install() - fix_apple_shared_install_name(self) 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") @@ -161,13 +170,9 @@ def package_info(self): 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-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.output.info(f"Appending PATH environment variable: {bindir}") - self.env_info.PATH.append(bindir) + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) # unofficial, but required to avoid side effects (libxkbcommon component # "steals" the default global pkg_config name) diff --git a/recipes/xkbcommon/config.yml b/recipes/xkbcommon/config.yml index b1ae06a7c3ea8..dc3bda303f68e 100644 --- a/recipes/xkbcommon/config.yml +++ b/recipes/xkbcommon/config.yml @@ -1,11 +1,11 @@ versions: - "1.4.1": + "1.6.0": folder: all - "1.4.0": + "1.5.0": folder: all - "1.3.1": + "1.4.1": folder: all - "1.3.0": + "1.3.1": folder: all "1.2.1": folder: all @@ -13,7 +13,5 @@ versions: 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 index a9f2fc053956c..bd171724a258d 100644 --- a/recipes/xkeyboard-config/all/conanfile.py +++ b/recipes/xkeyboard-config/all/conanfile.py @@ -3,11 +3,12 @@ from conan.tools.system import package_manager from conan.errors import ConanInvalidConfiguration -required_conan_version = ">=1.47" +required_conan_version = ">=1.50.0" class XkeyboardConfigConan(ConanFile): name = "xkeyboard-config" + package_type = "application" url = "https://github.com/conan-io/conan-center-index" license = "MIT" homepage = "https://www.freedesktop.org/wiki/Software/XKeyboardConfig/" @@ -20,7 +21,7 @@ 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 = package_manager.Apt(self) diff --git a/recipes/xlnt/all/conanfile.py b/recipes/xlnt/all/conanfile.py index d492b1f1070d1..b40b12448a161 100644 --- a/recipes/xlnt/all/conanfile.py +++ b/recipes/xlnt/all/conanfile.py @@ -17,6 +17,7 @@ class XlntConan(ConanFile): 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], @@ -43,11 +44,11 @@ def layout(self): def requirements(self): self.requires("libstudxml/1.1.0-b.10+1") - self.requires("miniz/3.0.1") - self.requires("utfcpp/3.2.2") + self.requires("miniz/3.0.2") + self.requires("utfcpp/3.2.3") def validate(self): - if self.info.settings.compiler.get_safe("cppstd"): + 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}" @@ -55,8 +56,7 @@ def validate(self): raise ConanInvalidConfiguration(f"{self.ref} not compatible with libstudxml < 1.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): tc = CMakeToolchain(self) diff --git a/recipes/xlsxio/all/conandata.yml b/recipes/xlsxio/all/conandata.yml new file mode 100644 index 0000000000000..026e7d4f464c4 --- /dev/null +++ b/recipes/xlsxio/all/conandata.yml @@ -0,0 +1,17 @@ +sources: + "0.2.34": + sha256: 726e3bc3cf571ac20e5c39b1f192f3793d24ebfdeaadcd210de74aa1ec100bb6 + url: https://github.com/brechtsanders/xlsxio/archive/refs/tags/0.2.34.tar.gz + "0.2.33": + sha256: f221ffff7d9ba33c87411ba76b371cac202f25e07bf4e740828592e1c7e79263 + url: https://github.com/brechtsanders/xlsxio/archive/refs/tags/0.2.33.tar.gz + +patches: + "0.2.34": + - patch_file: patches/0234_cmake.patch + patch_description: "conan build cmake support" + patch_type: "conan" + "0.2.33": + - patch_file: patches/0233_cmake.patch + patch_description: "conan build cmake support" + patch_type: "conan" diff --git a/recipes/xlsxio/all/conanfile.py b/recipes/xlsxio/all/conanfile.py new file mode 100644 index 0000000000000..ed6652c07a361 --- /dev/null +++ b/recipes/xlsxio/all/conanfile.py @@ -0,0 +1,154 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout, CMakeDeps +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.54.0" + + +class XlsxioConan(ConanFile): + name = "xlsxio" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/brechtsanders/xlsxio" + description = "Cross-platform C library for reading values from and writing values to .xlsx files." + topics = ("xlsx",) + license = "MIT" + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "fPIC":[True, False], + "shared": [True, False], + "with_libzip": [True, False], + "with_minizip_ng": [True, False], + "with_wide": [True, False], + } + default_options = { + "fPIC": True, + "shared": False, + "with_libzip": False, + "with_minizip_ng": False, + "with_wide": False, + } + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + if Version(self.version) < "0.2.34": + del self.options.with_minizip_ng + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + if self.options.with_wide: + self.options["expat"].char_type = "ushort" + if self.options.get_safe("with_minizip_ng"): + self.options["minizip-ng"].mz_compatibility = True + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + if self.options.with_libzip: + self.requires("libzip/1.10.1") + elif Version(self.version) >= "0.2.34" and self.options.with_minizip_ng : + self.requires("minizip-ng/4.0.1") + else: + self.requires("minizip/1.2.13") + self.requires("expat/[>=2.6.2 <3]") + + def validate(self): + if Version(self.version) >= "0.2.34": + if self.options.with_libzip and self.options.with_minizip_ng: + raise ConanInvalidConfiguration("with_libzip and with_minizip_ng are mutually exclusive") + + def source(self): + get(self, **self.conan_data["sources"][self.version], 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["WITH_LIBZIP"] = self.options.with_libzip + if Version(self.version) >= "0.2.34": + tc.variables["WITH_MINIZIP_NG"] = self.options.with_minizip_ng + tc.variables["WITH_WIDE"] = self.options.with_wide + # Relocatable shared lib on Macos + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" + tc.generate() + + tc = CMakeDeps(self) + tc.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.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, "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.set_property("cmake_file_name", "xlsxio") + + ziplib = "minizip::minizip" + if self.options.with_libzip: + ziplib = "libzip::libzip" + elif self.options.get_safe("with_minizip_ng"): + ziplib = "minizip-ng::minizip-ng" + + xlsxio_macro = "BUILD_XLSXIO_SHARED" if self.options.shared else "BUILD_XLSXIO_STATIC" + + self.cpp_info.components["xlsxio_read"].set_property("cmake_target_name", "xlsxio::xlsxio_read") + self.cpp_info.components["xlsxio_read"].set_property("pkg_config_name", "libxlsxio_read") + self.cpp_info.components["xlsxio_read"].libs = ["xlsxio_read"] + self.cpp_info.components["xlsxio_read"].requires = ["expat::expat", ziplib] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["xlsxio_read"].system_libs.append("pthread") + self.cpp_info.components["xlsxio_read"].defines.append(xlsxio_macro) + + self.cpp_info.components["xlsxio_write"].set_property("cmake_target_name", "xlsxio::xlsxio_write") + self.cpp_info.components["xlsxio_write"].set_property("pkg_config_name", "libxlsxio_write") + self.cpp_info.components["xlsxio_write"].libs = ["xlsxio_write"] + self.cpp_info.components["xlsxio_write"].requires = ["expat::expat", ziplib] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["xlsxio_write"].system_libs.append("pthread") + self.cpp_info.components["xlsxio_write"].defines.append(xlsxio_macro) + + if self.options.with_wide: + self.cpp_info.components["xlsxio_readw"].set_property("cmake_target_name", "xlsxio::xlsxio_readw") + self.cpp_info.components["xlsxio_readw"].set_property("pkg_config_name", "libxlsxio_readw") + self.cpp_info.components["xlsxio_readw"].libs = ["xlsxio_readw"] + self.cpp_info.components["xlsxio_readw"].requires = ["expat::expat", ziplib] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["xlsxio_readw"].system_libs.append("pthread") + self.cpp_info.components["xlsxio_readw"].defines.append(xlsxio_macro) + + # TODO: to remove in conan v2 + self.cpp_info.names["cmake_find_package"] = "xlsxio" + self.cpp_info.names["cmake_find_package_multi"] = "xlsxio" + self.cpp_info.components["xlsxio_read"].names["cmake_find_package"] = "xlsxio_read" + self.cpp_info.components["xlsxio_read"].names["cmake_find_package_multi"] = "xlsxio_read" + self.cpp_info.components["xlsxio_write"].names["cmake_find_package"] = "xlsxio_write" + self.cpp_info.components["xlsxio_write"].names["cmake_find_package_multi"] = "xlsxio_write" + if self.options.with_wide: + self.cpp_info.components["xlsxio_readw"].names["cmake_find_package"] = "xlsxio_readw" + self.cpp_info.components["xlsxio_readw"].names["cmake_find_package_multi"] = "xlsxio_readw" + diff --git a/recipes/xlsxio/all/patches/0233_cmake.patch b/recipes/xlsxio/all/patches/0233_cmake.patch new file mode 100644 index 0000000000000..a669955dfcba4 --- /dev/null +++ b/recipes/xlsxio/all/patches/0233_cmake.patch @@ -0,0 +1,86 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -46,13 +46,23 @@ ENDIF() + # dependancy: libzip + IF(WITH_LIBZIP) + FIND_PACKAGE(LibZip REQUIRED) +- SET(ANYZIP_INCLUDE_DIRS ${LIBZIP_INCLUDE_DIRS}) +- SET(ANYZIP_LIBRARIES ${LIBZIP_LIBRARIES}) ++ IF(LIBZIP_INCLUDE_DIRS) ++ SET(ANYZIP_INCLUDE_DIRS ${LIBZIP_INCLUDE_DIRS}) ++ SET(ANYZIP_LIBRARIES ${LIBZIP_LIBRARIES}) ++ ELSE() ++ SET(ANYZIP_INCLUDE_DIRS ${libzip_INCLUDE_DIRS}) ++ SET(ANYZIP_LIBRARIES ${libzip_LIBRARIES}) ++ ENDIF() + SET(ANYZIP_DEF USE_LIBZIP) + ELSE() +- FIND_PACKAGE(Minizip REQUIRED) +- SET(ANYZIP_INCLUDE_DIRS ${MINIZIP_INCLUDE_DIRS}) +- SET(ANYZIP_LIBRARIES ${MINIZIP_LIBRARIES}) ++ FIND_PACKAGE(Minizip 1 REQUIRED) ++ IF(MINIZIP_INCLUDE_DIRS) ++ SET(ANYZIP_INCLUDE_DIRS ${MINIZIP_INCLUDE_DIRS}) ++ SET(ANYZIP_LIBRARIES ${MINIZIP_LIBRARIES}) ++ ELSE() ++ SET(ANYZIP_INCLUDE_DIRS ${minizip_INCLUDE_DIRS}) ++ SET(ANYZIP_LIBRARIES ${minizip_LIBRARIES}) ++ ENDIF() + SET(ANYZIP_DEF USE_MINIZIP) + ENDIF() + # dependancy: expat +@@ -62,6 +72,9 @@ IF(EXPAT_DIR) + FIND_LIBRARY(EXPAT_LIBRARIES NAMES expat libexpat NO_DEFAULT_PATH PATHS ${EXPAT_DIR}/lib ${EXPAT_DIR}) + ELSE() + FIND_PACKAGE(EXPAT REQUIRED) ++ IF(NOT EXPAT_LIBRARIES) ++ SET(EXPAT_LIBRARIES ${expat_LIBRARIES}) ++ ENDIF() + ENDIF() + # dependancy: expatw (if wide library was requested) + IF(WITH_WIDE) +@@ -70,6 +83,9 @@ IF(WITH_WIDE) + ELSE() + FIND_LIBRARY(EXPATW_LIBRARIES NAMES expatw) + ENDIF() ++ IF(NOT EXPATW_LIBRARIES) ++ SET(EXPATW_LIBRARIES ${EXPAT_LIBRARIES}) ++ ENDIF() + ENDIF() + + # Doxygen +@@ -101,7 +117,9 @@ ENDIF() + + FOREACH(LINKTYPE ${LINKTYPES}) + ADD_LIBRARY(xlsxio_read_${LINKTYPE} ${LINKTYPE} lib/xlsxio_read.c lib/xlsxio_read_sharedstrings.c) +- SET_TARGET_PROPERTIES(xlsxio_read_${LINKTYPE} PROPERTIES COMPILE_DEFINITIONS "BUILD_XLSXIO;${ANYZIP_DEF};BUILD_XLSXIO_${LINKTYPE}") ++ TARGET_COMPILE_DEFINITIONS(xlsxio_read_${LINKTYPE} PUBLIC BUILD_XLSXIO) ++ TARGET_COMPILE_DEFINITIONS(xlsxio_read_${LINKTYPE} PUBLIC ${ANYZIP_DEF}) ++ TARGET_COMPILE_DEFINITIONS(xlsxio_read_${LINKTYPE} PUBLIC BUILD_XLSXIO_${LINKTYPE}) + SET_TARGET_PROPERTIES(xlsxio_read_${LINKTYPE} PROPERTIES OUTPUT_NAME xlsxio_read) + IF(MINGW AND LINKTYPE STREQUAL "SHARED") + SET_TARGET_PROPERTIES(xlsxio_read_${LINKTYPE} PROPERTIES LINK_FLAGS "-Wl,--output-def=libxlsxio_read.def") +@@ -112,7 +130,9 @@ FOREACH(LINKTYPE ${LINKTYPES}) + SET(ALLTARGETS_LIB ${ALLTARGETS_LIB} xlsxio_read_${LINKTYPE}) + + ADD_LIBRARY(xlsxio_write_${LINKTYPE} ${LINKTYPE} lib/xlsxio_write.c) +- SET_TARGET_PROPERTIES(xlsxio_write_${LINKTYPE} PROPERTIES COMPILE_DEFINITIONS "BUILD_XLSXIO;${ANYZIP_DEF};BUILD_XLSXIO_${LINKTYPE}") ++ TARGET_COMPILE_DEFINITIONS(xlsxio_write_${LINKTYPE} PUBLIC BUILD_XLSXIO) ++ TARGET_COMPILE_DEFINITIONS(xlsxio_write_${LINKTYPE} PUBLIC ${ANYZIP_DEF}) ++ TARGET_COMPILE_DEFINITIONS(xlsxio_write_${LINKTYPE} PUBLIC BUILD_XLSXIO_${LINKTYPE}) + SET_TARGET_PROPERTIES(xlsxio_write_${LINKTYPE} PROPERTIES OUTPUT_NAME xlsxio_write) + IF(MINGW AND LINKTYPE STREQUAL "SHARED") + SET_TARGET_PROPERTIES(xlsxio_write_${LINKTYPE} PROPERTIES LINK_FLAGS "-Wl,--output-def=libxlsxio_write.def") +@@ -122,8 +142,10 @@ FOREACH(LINKTYPE ${LINKTYPES}) + + IF(WITH_WIDE) + ADD_LIBRARY(xlsxio_readw_${LINKTYPE} ${LINKTYPE} lib/xlsxio_read.c lib/xlsxio_read_sharedstrings.c) +- SET_TARGET_PROPERTIES(xlsxio_readw_${LINKTYPE} PROPERTIES DEFINE_SYMBOL "BUILD_XLSXIO_DLL") +- SET_TARGET_PROPERTIES(xlsxio_readw_${LINKTYPE} PROPERTIES COMPILE_DEFINITIONS "XML_UNICODE;BUILD_XLSXIO;${ANYZIP_DEF}") ++ TARGET_COMPILE_DEFINITIONS(xlsxio_readw_${LINKTYPE} PUBLIC BUILD_XLSXIO_DLL) ++ TARGET_COMPILE_DEFINITIONS(xlsxio_readw_${LINKTYPE} PUBLIC XML_UNICODE) ++ TARGET_COMPILE_DEFINITIONS(xlsxio_readw_${LINKTYPE} PUBLIC BUILD_XLSXIO) ++ TARGET_COMPILE_DEFINITIONS(xlsxio_readw_${LINKTYPE} PUBLIC ${ANYZIP_DEF}) + SET_TARGET_PROPERTIES(xlsxio_readw_${LINKTYPE} PROPERTIES OUTPUT_NAME xlsxio_readw) + IF(MINGW AND LINKTYPE STREQUAL "SHARED") + SET_TARGET_PROPERTIES(xlsxio_readw_${LINKTYPE} PROPERTIES LINK_FLAGS "-Wl,--output-def=libxlsxio_readw.def") diff --git a/recipes/xlsxio/all/patches/0234_cmake.patch b/recipes/xlsxio/all/patches/0234_cmake.patch new file mode 100644 index 0000000000000..ea858da988ead --- /dev/null +++ b/recipes/xlsxio/all/patches/0234_cmake.patch @@ -0,0 +1,111 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index bf4e9bf..f0d6a0e 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -22,8 +22,6 @@ OPTION(BUILD_PC_FILES "Build pkg-config .pc" ON) + OPTION(BUILD_TOOLS "Build tools" ON) + OPTION(BUILD_EXAMPLES "Build examples" ON) + OPTION(WITH_LIBZIP "Use libzip instead of Minizip" OFF) +-OPTION(WITH_MINIZIP_NG "Use Minizip NG" OFF) +-OPTION(MINIZIP_NG_SUFFIX "Minizip NG suffix (default is empty)" "") + OPTION(WITH_WIDE "Also build UTF-16 library (libxlsxio_readw)" OFF) + SET(ZLIB_DIR "" CACHE PATH "Path to the zlib library") + IF(WITH_LIBZIP) +@@ -48,18 +46,33 @@ ENDIF() + # dependancy: libzip/minizip/minizip-ng + IF(WITH_LIBZIP) + FIND_PACKAGE(LibZip REQUIRED) +- SET(ANYZIP_INCLUDE_DIRS ${LIBZIP_INCLUDE_DIRS}) +- SET(ANYZIP_LIBRARIES ${LIBZIP_LIBRARIES}) ++ IF(LIBZIP_INCLUDE_DIRS) ++ SET(ANYZIP_INCLUDE_DIRS ${LIBZIP_INCLUDE_DIRS}) ++ SET(ANYZIP_LIBRARIES ${LIBZIP_LIBRARIES}) ++ ELSE() ++ SET(ANYZIP_INCLUDE_DIRS ${libzip_INCLUDE_DIRS}) ++ SET(ANYZIP_LIBRARIES ${libzip_LIBRARIES}) ++ ENDIF() + SET(ANYZIP_DEF USE_LIBZIP) + ELSEIF(WITH_MINIZIP_NG) +- FIND_PACKAGE(minizip${MINIZIP_NG_SUFFIX} REQUIRED) +- SET(ANYZIP_INCLUDE_DIRS "${minizip-ng_DIR}/../../../include/minizip${MINIZIP_NG_SUFFIX}") +- SET(ANYZIP_LIBRARIES minizip${MINIZIP_NG_SUFFIX}) ++ FIND_PACKAGE(minizip REQUIRED) ++ IF(minizip_INCLUDE_DIRS) ++ SET(ANYZIP_INCLUDE_DIRS ${minizip_INCLUDE_DIRS}) ++ SET(ANYZIP_LIBRARIES ${minizip_LIBRARIES}) ++ ELSE() ++ SET(ANYZIP_INCLUDE_DIRS "${minizip-ng_DIR}/../../../include/minizip${MINIZIP_NG_SUFFIX}") ++ SET(ANYZIP_LIBRARIES minizip${MINIZIP_NG_SUFFIX}) ++ ENDIF() + SET(ANYZIP_DEF USE_MINIZIP;USE_MINIZIP_NG) + ELSE() +- FIND_PACKAGE(Minizip REQUIRED) +- SET(ANYZIP_INCLUDE_DIRS ${MINIZIP_INCLUDE_DIRS}) +- SET(ANYZIP_LIBRARIES ${MINIZIP_LIBRARIES}) ++ FIND_PACKAGE(Minizip 1 REQUIRED) ++ IF(MINIZIP_INCLUDE_DIRS) ++ SET(ANYZIP_INCLUDE_DIRS ${MINIZIP_INCLUDE_DIRS}) ++ SET(ANYZIP_LIBRARIES ${MINIZIP_LIBRARIES}) ++ ELSE() ++ SET(ANYZIP_INCLUDE_DIRS ${minizip_INCLUDE_DIRS}) ++ SET(ANYZIP_LIBRARIES ${minizip_LIBRARIES}) ++ ENDIF() + SET(ANYZIP_DEF USE_MINIZIP) + ENDIF() + # dependancy: expat +@@ -69,6 +82,9 @@ IF(EXPAT_DIR) + FIND_LIBRARY(EXPAT_LIBRARIES NAMES expat libexpat NO_DEFAULT_PATH PATHS ${EXPAT_DIR}/lib ${EXPAT_DIR}) + ELSE() + FIND_PACKAGE(EXPAT REQUIRED) ++ IF(NOT EXPAT_LIBRARIES) ++ SET(EXPAT_LIBRARIES ${expat_LIBRARIES}) ++ ENDIF() + ENDIF() + # dependancy: expatw (if wide library was requested) + IF(WITH_WIDE) +@@ -77,6 +93,9 @@ IF(WITH_WIDE) + ELSE() + FIND_LIBRARY(EXPATW_LIBRARIES NAMES expatw) + ENDIF() ++ IF(NOT EXPATW_LIBRARIES) ++ SET(EXPATW_LIBRARIES ${EXPAT_LIBRARIES}) ++ ENDIF() + ENDIF() + + # Doxygen +@@ -108,7 +127,9 @@ ENDIF() + + FOREACH(LINKTYPE ${LINKTYPES}) + ADD_LIBRARY(xlsxio_read_${LINKTYPE} ${LINKTYPE} lib/xlsxio_read.c lib/xlsxio_read_sharedstrings.c) +- SET_TARGET_PROPERTIES(xlsxio_read_${LINKTYPE} PROPERTIES COMPILE_DEFINITIONS "BUILD_XLSXIO;${ANYZIP_DEF};BUILD_XLSXIO_${LINKTYPE}") ++ TARGET_COMPILE_DEFINITIONS(xlsxio_read_${LINKTYPE} PUBLIC BUILD_XLSXIO) ++ TARGET_COMPILE_DEFINITIONS(xlsxio_read_${LINKTYPE} PUBLIC ${ANYZIP_DEF}) ++ TARGET_COMPILE_DEFINITIONS(xlsxio_read_${LINKTYPE} PUBLIC BUILD_XLSXIO_${LINKTYPE}) + SET_TARGET_PROPERTIES(xlsxio_read_${LINKTYPE} PROPERTIES OUTPUT_NAME xlsxio_read) + IF(MINGW AND LINKTYPE STREQUAL "SHARED") + SET_TARGET_PROPERTIES(xlsxio_read_${LINKTYPE} PROPERTIES LINK_FLAGS "-Wl,--output-def=libxlsxio_read.def") +@@ -119,7 +140,9 @@ FOREACH(LINKTYPE ${LINKTYPES}) + SET(ALLTARGETS_LIB ${ALLTARGETS_LIB} xlsxio_read_${LINKTYPE}) + + ADD_LIBRARY(xlsxio_write_${LINKTYPE} ${LINKTYPE} lib/xlsxio_write.c) +- SET_TARGET_PROPERTIES(xlsxio_write_${LINKTYPE} PROPERTIES COMPILE_DEFINITIONS "BUILD_XLSXIO;${ANYZIP_DEF};BUILD_XLSXIO_${LINKTYPE}") ++ TARGET_COMPILE_DEFINITIONS(xlsxio_write_${LINKTYPE} PUBLIC BUILD_XLSXIO) ++ TARGET_COMPILE_DEFINITIONS(xlsxio_write_${LINKTYPE} PUBLIC ${ANYZIP_DEF}) ++ TARGET_COMPILE_DEFINITIONS(xlsxio_write_${LINKTYPE} PUBLIC BUILD_XLSXIO_${LINKTYPE}) + SET_TARGET_PROPERTIES(xlsxio_write_${LINKTYPE} PROPERTIES OUTPUT_NAME xlsxio_write) + IF(MINGW AND LINKTYPE STREQUAL "SHARED") + SET_TARGET_PROPERTIES(xlsxio_write_${LINKTYPE} PROPERTIES LINK_FLAGS "-Wl,--output-def=libxlsxio_write.def") +@@ -129,8 +152,11 @@ FOREACH(LINKTYPE ${LINKTYPES}) + + IF(WITH_WIDE) + ADD_LIBRARY(xlsxio_readw_${LINKTYPE} ${LINKTYPE} lib/xlsxio_read.c lib/xlsxio_read_sharedstrings.c) +- SET_TARGET_PROPERTIES(xlsxio_readw_${LINKTYPE} PROPERTIES DEFINE_SYMBOL "BUILD_XLSXIO_DLL") +- SET_TARGET_PROPERTIES(xlsxio_readw_${LINKTYPE} PROPERTIES COMPILE_DEFINITIONS "XML_UNICODE;BUILD_XLSXIO;${ANYZIP_DEF}") ++ TARGET_COMPILE_DEFINITIONS(xlsxio_readw_${LINKTYPE} PUBLIC BUILD_XLSXIO_DLL) ++ TARGET_COMPILE_DEFINITIONS(xlsxio_readw_${LINKTYPE} PUBLIC XML_UNICODE) ++ TARGET_COMPILE_DEFINITIONS(xlsxio_readw_${LINKTYPE} PUBLIC BUILD_XLSXIO) ++ TARGET_COMPILE_DEFINITIONS(xlsxio_readw_${LINKTYPE} PUBLIC ${ANYZIP_DEF}) ++ + SET_TARGET_PROPERTIES(xlsxio_readw_${LINKTYPE} PROPERTIES OUTPUT_NAME xlsxio_readw) + IF(MINGW AND LINKTYPE STREQUAL "SHARED") + SET_TARGET_PROPERTIES(xlsxio_readw_${LINKTYPE} PROPERTIES LINK_FLAGS "-Wl,--output-def=libxlsxio_readw.def") diff --git a/recipes/xlsxio/all/test_package/CMakeLists.txt b/recipes/xlsxio/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..a6b2c7649a0c8 --- /dev/null +++ b/recipes/xlsxio/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +find_package(xlsxio REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE xlsxio::xlsxio_read) +target_link_libraries(${PROJECT_NAME} PRIVATE xlsxio::xlsxio_write) diff --git a/recipes/xlsxio/all/test_package/conanfile.py b/recipes/xlsxio/all/test_package/conanfile.py new file mode 100644 index 0000000000000..8a5bb47f50c4c --- /dev/null +++ b/recipes/xlsxio/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/xlsxio/all/test_package/test_package.c b/recipes/xlsxio/all/test_package/test_package.c new file mode 100644 index 0000000000000..097bd99e0a65d --- /dev/null +++ b/recipes/xlsxio/all/test_package/test_package.c @@ -0,0 +1,49 @@ +#include +#include +#include + +int main(int argc, char** argv) { + xlsxiowriter xlsxwrite; + int i; + xlsxioreader xlsxioread; + + // open .xlsx file for writing (will overwrite if it already exists) + if ((xlsxwrite = xlsxiowrite_open("test_package.xlsx", "MySheet")) == NULL) { + fprintf(stderr, "Error creating .xlsx file\n"); + return 1; + } + // set row height + xlsxiowrite_set_row_height(xlsxwrite, 1); + // how many rows to buffer to detect column widths + xlsxiowrite_set_detection_rows(xlsxwrite, 10); + // write column names + xlsxiowrite_add_column(xlsxwrite, "Col1", 0); + xlsxiowrite_add_column(xlsxwrite, "Col2", 21); + xlsxiowrite_add_column(xlsxwrite, "Col3", 0); + xlsxiowrite_add_column(xlsxwrite, "Col4", 2); + xlsxiowrite_add_column(xlsxwrite, "Col5", 0); + xlsxiowrite_add_column(xlsxwrite, "Col6", 0); + xlsxiowrite_add_column(xlsxwrite, "Col7", 0); + xlsxiowrite_next_row(xlsxwrite); + // write data + for (i = 0; i < 1000; i++) { + xlsxiowrite_add_cell_string(xlsxwrite, "Test"); + xlsxiowrite_add_cell_string(xlsxwrite, "A b c d e f\nnew line"); + xlsxiowrite_add_cell_string(xlsxwrite, "&% \"'"); + xlsxiowrite_add_cell_string(xlsxwrite, NULL); + xlsxiowrite_add_cell_int(xlsxwrite, i); + xlsxiowrite_add_cell_datetime(xlsxwrite, time(NULL)); + xlsxiowrite_add_cell_float(xlsxwrite, 3.1415926); + xlsxiowrite_next_row(xlsxwrite); + } + // close .xlsx file + xlsxiowrite_close(xlsxwrite); + + // read .xlsx file + xlsxioread = xlsxioread_open("test_package.xlsx"); + + // close .xlsx file + xlsxioread_close(xlsxioread); + + return 0; +} diff --git a/recipes/xlsxio/all/test_v1_package/CMakeLists.txt b/recipes/xlsxio/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/xlsxio/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/xlsxio/all/test_v1_package/conanfile.py b/recipes/xlsxio/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..49a3a66ea5bad --- /dev/null +++ b/recipes/xlsxio/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/xlsxio/config.yml b/recipes/xlsxio/config.yml new file mode 100644 index 0000000000000..5b98871657b36 --- /dev/null +++ b/recipes/xlsxio/config.yml @@ -0,0 +1,5 @@ +versions: + "0.2.34": + folder: all + "0.2.33": + folder: all diff --git a/recipes/xmlsec/all/conandata.yml b/recipes/xmlsec/all/conandata.yml index 9b158696a96c9..387c156be7f71 100644 --- a/recipes/xmlsec/all/conandata.yml +++ b/recipes/xmlsec/all/conandata.yml @@ -1,10 +1,28 @@ sources: + "1.3.6": + url: "https://github.com/lsh123/xmlsec/releases/download/1.3.6/xmlsec1-1.3.6.tar.gz" + sha256: "952b626ad3f3be1a4598622dab52fdab2a8604d0837c1b00589f3637535af92f" + "1.3.4": + url: "https://github.com/lsh123/xmlsec/releases/download/1.3.4/xmlsec1-1.3.4.tar.gz" + sha256: "45ad9078d41ae76844ad2f8651600ffeec0fdd128ead988a8d69e907c57aee75" + "1.3.3": + url: "https://github.com/lsh123/xmlsec/releases/download/1.3.3/xmlsec1-1.3.3.tar.gz" + sha256: "ab5b9a9ffd6960f46f7466d9d91f174ec37e8c31989237ba6b9eacdd816464f2" + "1.3.2": + url: "https://github.com/lsh123/xmlsec/releases/download/xmlsec_1_3_2/xmlsec1-1.3.2.tar.gz" + sha256: "4003c56b3d356d21b1db7775318540fad6bfedaf5f117e8f7c010811219be3cf" + "1.2.38": + url: "https://github.com/lsh123/xmlsec/releases/download/xmlsec-1_2_38/xmlsec1-1.2.38.tar.gz" + sha256: "9de8cf8d7d2e288a9cef205cc6cb93c926a67dadfaf44aaff76ed63c28ce9902" + "1.2.33": + url: "https://www.aleksey.com/xmlsec/download/older-releases/xmlsec1-1.2.33.tar.gz" + sha256: "26041d35a20a245ed5a2fb9ee075f10825664d274220cb5190340fa87a4d0931" "1.2.32": - url: "https://github.com/lsh123/xmlsec/archive/xmlsec-1_2_32.tar.gz" - sha256: "e33e551fb9f6da5576b1a55ce962048adf337332c27e6be9dba04d360b6a5584" + url: "https://www.aleksey.com/xmlsec/download/older-releases/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: "https://www.aleksey.com/xmlsec/download/older-releases/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: "https://www.aleksey.com/xmlsec/download/older-releases/xmlsec1-1.2.30.tar.gz" + sha256: "2d84360b03042178def1d9ff538acacaed2b3a27411db7b2874f1612ed71abc8" diff --git a/recipes/xmlsec/all/conanfile.py b/recipes/xmlsec/all/conanfile.py index 6dc96aa50a99e..f6e3b2305fa3e 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,16 +52,19 @@ 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.12.5 <3]", transitive_headers=True) if self.options.with_openssl: - self.requires("openssl/1.1.1m") + self.requires("openssl/[>=1.1 <4]", transitive_headers=True) if self.options.with_xslt: - self.requires("libxslt/1.1.34") + self.requires("libxslt/1.1.42") def validate(self): if self.options.with_nss: @@ -78,147 +77,156 @@ 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/[>=2.2 <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", + ]) + if Version(self.version) >= "1.3.2": + tc.configure_args.append("--enable-pedantic=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) + if ov.major >= "3": + if Version(self.version) < "1.2.35": + # configure.js doesn't understand openssl=300 before xmlsec 1.2.35, + # For these xmlsec versions, setting 110 even for OpenSSL 3.x should be compatible + crypto_engines.append("openssl=110") + else: + crypto_engines.append("openssl=300") + else: + 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)), - "with-dl=no", - "xslt={}".format(yes_no(self.options.with_xslt)), - "iconv={}".format(yes_no(False)), + 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={}".format(yes_no(Version(self.version) >= "1.2.35" and self.options.shared)), + f"xslt={yes_no(self.options.with_xslt)}", + "iconv=no", "crypto={}".format(",".join(crypto_engines)), ] + if Version(self.version) >= "1.2.35": + args.append("pedantic=no") - 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") - 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")) + rm(self, "*.dll", os.path.join(self.package_folder, "bin")) + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + if Version(self.version) < "1.2.35": + 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 +240,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..80ae5f35a850c 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) +add_executable(${PROJECT_NAME} main.c) +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..98ab55852ad56 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,6 @@ 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") + self.run(bin_path, env="conanrun") diff --git a/recipes/xmlsec/all/test_package/main.c b/recipes/xmlsec/all/test_package/main.c new file mode 100644 index 0000000000000..10ac70841525b --- /dev/null +++ b/recipes/xmlsec/all/test_package/main.c @@ -0,0 +1,28 @@ +#include + + +#include + + +int main(int argc, char **argv) { + /* Init xmlsec library */ + if(xmlSecInit() < 0) { + fprintf(stderr, "Error: xmlsec initialization failed.\n"); + return(-1); + } + + /* Check loaded library version */ + if(xmlSecCheckVersion() != 1) { + fprintf(stderr, "Error: loaded xmlsec library version is not compatible.\n"); + return(-1); + } + + if(xmlSecCheckVersionExact() != 1) { + fprintf(stderr, "Error: loaded xmlsec library version is not exact.\n"); + return(-1); + } + + /* Shutdown xmlsec library */ + xmlSecShutdown(); + return(0); +} diff --git a/recipes/xmlsec/all/test_package/rsakey.pem b/recipes/xmlsec/all/test_package/rsakey.pem deleted file mode 100644 index de07b7803966b..0000000000000 --- a/recipes/xmlsec/all/test_package/rsakey.pem +++ /dev/null @@ -1,9 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIBPAIBAAJBANPQbQ92nlbeg1Q5JNHSO1Yey46nZ7GJltLWw1ccSvp7pnvmfUm+ -M521CpFpfr4EAE3UVBMoU9j/hqq3dFAc2H0CAwEAAQJBALFVCjmsAZyQ5jqZLO5N -qEfNuHZSSUol+xPBogFIOq3BWa269eNNcAK5or5g0XWWon7EPdyGT4qyDVH9KzXK -RLECIQDzm/Nj0epUGN51/rKJgRXWkXW/nfSCMO9fvQR6Ujoq3wIhAN6WeHK9vgWg -wBWqMdq5sR211+LlDH7rOUQ6rBpbsoQjAiEA7jzpfglgPPZFOOfo+oh/LuP6X3a+ -FER/FQXpRyb7M8kCIETUrwZ8WkiPPxbz/Fqw1W5kjw/g2I5e2uSYaCP2eyuVAiEA -mOI6RhRyMqgxQyy0plJVjG1s4fdu92AWYy9AwYeyd/8= ------END RSA PRIVATE KEY----- \ No newline at end of file diff --git a/recipes/xmlsec/all/test_package/sign1-tmpl.xml b/recipes/xmlsec/all/test_package/sign1-tmpl.xml deleted file mode 100644 index 1c50319fad562..0000000000000 --- a/recipes/xmlsec/all/test_package/sign1-tmpl.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - Hello, World! - - - - - - - - - - - - - - - - - - - diff --git a/recipes/xmlsec/all/test_package/sign1.c b/recipes/xmlsec/all/test_package/sign1.c deleted file mode 100644 index c081e62e344fd..0000000000000 --- a/recipes/xmlsec/all/test_package/sign1.c +++ /dev/null @@ -1,211 +0,0 @@ -/** - * XML Security Library example: Signing a template file. - * - * Signs a template file using a key from PEM file - * - * Usage: - * ./sign1 - * - * Example: - * ./sign1 sign1-tmpl.xml rsakey.pem > sign1-res.xml - * - * The result signature could be validated using verify1 example: - * ./verify1 sign1-res.xml rsapub.pem - * - * This is free software; see Copyright file in the source - * distribution for preciese wording. - * - * Copyright (C) 2002-2016 Aleksey Sanin . All Rights Reserved. - */ -#include -#include -#include - -#include -#include -#include - -#ifndef XMLSEC_NO_XSLT -#include -#include -#endif /* XMLSEC_NO_XSLT */ - -#include -#include -#include -#include - -int sign_file(const char* tmpl_file, const char* key_file); - -int -main(int argc, char **argv) { -#ifndef XMLSEC_NO_XSLT - xsltSecurityPrefsPtr xsltSecPrefs = NULL; -#endif /* XMLSEC_NO_XSLT */ - - assert(argv); - - if(argc != 3) { - fprintf(stderr, "Error: wrong number of arguments.\n"); - fprintf(stderr, "Usage: %s \n", argv[0]); - return(1); - } - - /* Init libxml and libxslt libraries */ - xmlInitParser(); - LIBXML_TEST_VERSION - xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS; - xmlSubstituteEntitiesDefault(1); -#ifndef XMLSEC_NO_XSLT - xmlIndentTreeOutput = 1; -#endif /* XMLSEC_NO_XSLT */ - - /* Init libxslt */ -#ifndef XMLSEC_NO_XSLT - /* disable everything */ - xsltSecPrefs = xsltNewSecurityPrefs(); - xsltSetSecurityPrefs(xsltSecPrefs, XSLT_SECPREF_READ_FILE, xsltSecurityForbid); - xsltSetSecurityPrefs(xsltSecPrefs, XSLT_SECPREF_WRITE_FILE, xsltSecurityForbid); - xsltSetSecurityPrefs(xsltSecPrefs, XSLT_SECPREF_CREATE_DIRECTORY, xsltSecurityForbid); - xsltSetSecurityPrefs(xsltSecPrefs, XSLT_SECPREF_READ_NETWORK, xsltSecurityForbid); - xsltSetSecurityPrefs(xsltSecPrefs, XSLT_SECPREF_WRITE_NETWORK, xsltSecurityForbid); - xsltSetDefaultSecurityPrefs(xsltSecPrefs); -#endif /* XMLSEC_NO_XSLT */ - - /* Init xmlsec library */ - if(xmlSecInit() < 0) { - fprintf(stderr, "Error: xmlsec initialization failed.\n"); - return(-1); - } - - /* Check loaded library version */ - if(xmlSecCheckVersion() != 1) { - fprintf(stderr, "Error: loaded xmlsec library version is not compatible.\n"); - return(-1); - } - - /* Load default crypto engine if we are supporting dynamic - * loading for xmlsec-crypto libraries. Use the crypto library - * name ("openssl", "nss", etc.) to load corresponding - * xmlsec-crypto library. - */ -#ifdef XMLSEC_CRYPTO_DYNAMIC_LOADING - if(xmlSecCryptoDLLoadLibrary(NULL) < 0) { - fprintf(stderr, "Error: unable to load default xmlsec-crypto library. Make sure\n" - "that you have it installed and check shared libraries path\n" - "(LD_LIBRARY_PATH and/or LTDL_LIBRARY_PATH) environment variables.\n"); - return(-1); - } -#endif /* XMLSEC_CRYPTO_DYNAMIC_LOADING */ - - /* Init crypto library */ - if(xmlSecCryptoAppInit(NULL) < 0) { - fprintf(stderr, "Error: crypto initialization failed.\n"); - return(-1); - } - - /* Init xmlsec-crypto library */ - if(xmlSecCryptoInit() < 0) { - fprintf(stderr, "Error: xmlsec-crypto initialization failed.\n"); - return(-1); - } - - if(sign_file(argv[1], argv[2]) < 0) { - return(-1); - } - - /* Shutdown xmlsec-crypto library */ - xmlSecCryptoShutdown(); - - /* Shutdown crypto library */ - xmlSecCryptoAppShutdown(); - - /* Shutdown xmlsec library */ - xmlSecShutdown(); - - /* Shutdown libxslt/libxml */ -#ifndef XMLSEC_NO_XSLT - xsltFreeSecurityPrefs(xsltSecPrefs); - xsltCleanupGlobals(); -#endif /* XMLSEC_NO_XSLT */ - xmlCleanupParser(); - - return(0); -} - -/** - * sign_file: - * @tmpl_file: the signature template file name. - * @key_file: the PEM private key file name. - * - * Signs the #tmpl_file using private key from #key_file. - * - * Returns 0 on success or a negative value if an error occurs. - */ -int -sign_file(const char* tmpl_file, const char* key_file) { - xmlDocPtr doc = NULL; - xmlNodePtr node = NULL; - xmlSecDSigCtxPtr dsigCtx = NULL; - int res = -1; - - assert(tmpl_file); - assert(key_file); - - /* load template */ - doc = xmlParseFile(tmpl_file); - if ((doc == NULL) || (xmlDocGetRootElement(doc) == NULL)){ - fprintf(stderr, "Error: unable to parse file \"%s\"\n", tmpl_file); - goto done; - } - - /* find start node */ - node = xmlSecFindNode(xmlDocGetRootElement(doc), xmlSecNodeSignature, xmlSecDSigNs); - if(node == NULL) { - fprintf(stderr, "Error: start node not found in \"%s\"\n", tmpl_file); - goto done; - } - - /* create signature context, we don't need keys manager in this example */ - dsigCtx = xmlSecDSigCtxCreate(NULL); - if(dsigCtx == NULL) { - fprintf(stderr,"Error: failed to create signature context\n"); - goto done; - } - - /* load private key, assuming that there is not password */ - dsigCtx->signKey = xmlSecCryptoAppKeyLoad(key_file, xmlSecKeyDataFormatPem, NULL, NULL, NULL); - if(dsigCtx->signKey == NULL) { - fprintf(stderr,"Error: failed to load private pem key from \"%s\"\n", key_file); - goto done; - } - - /* set key name to the file name, this is just an example! */ - if(xmlSecKeySetName(dsigCtx->signKey, key_file) < 0) { - fprintf(stderr,"Error: failed to set key name for key from \"%s\"\n", key_file); - goto done; - } - - /* sign the template */ - if(xmlSecDSigCtxSign(dsigCtx, node) < 0) { - fprintf(stderr,"Error: signature failed\n"); - goto done; - } - - /* print signed document to stdout */ - xmlDocDump(stdout, doc); - - /* success */ - res = 0; - -done: - /* cleanup */ - if(dsigCtx != NULL) { - xmlSecDSigCtxDestroy(dsigCtx); - } - - if(doc != NULL) { - xmlFreeDoc(doc); - } - return(res); -} 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..8a68c0f50f6f9 --- /dev/null +++ b/recipes/xmlsec/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", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.definitions["XMLSEC_WITH_XSLT"] = self.options["xmlsec"].with_xslt + 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/xmlsec/config.yml b/recipes/xmlsec/config.yml index be77378a24392..58bd6590d5b0d 100644 --- a/recipes/xmlsec/config.yml +++ b/recipes/xmlsec/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.38": + folder: all + "1.2.33": + folder: all "1.2.32": folder: all "1.2.31": diff --git a/recipes/xnnpack/all/CMakeLists.txt b/recipes/xnnpack/all/CMakeLists.txt deleted file mode 100644 index cde962d5658e3..0000000000000 --- a/recipes/xnnpack/all/CMakeLists.txt +++ /dev/null @@ -1,35 +0,0 @@ -cmake_minimum_required(VERSION 3.15) -project(cmake_wrapper) - -if(NOT CMAKE_SYSTEM_PROCESSOR AND CONAN_XNNPACK_SYSTEM_PROCESSOR) - set(CMAKE_SYSTEM_PROCESSOR ${CONAN_XNNPACK_SYSTEM_PROCESSOR}) -endif() - -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() - -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() - -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() - -# 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(src) diff --git a/recipes/xnnpack/all/conandata.yml b/recipes/xnnpack/all/conandata.yml index 5168859b5421f..94f6829c40eea 100644 --- a/recipes/xnnpack/all/conandata.yml +++ b/recipes/xnnpack/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "cci.20240229": + url: "https://github.com/google/XNNPACK/archive/fcbf55af6cf28a4627bcd1f703ab7ad843f0f3a2.tar.gz" + sha256: "96b2800652a605f0bd289faa09865792d139cadde89f681c79e1b2a08a7e0498" + "cci.20231026": + url: "https://github.com/google/XNNPACK/archive/ab16a544c1cbc5ee4ec105a2f35f8adca22e94c1.tar.gz" + sha256: "11c7e0555d2c2c14d812b3fba2a277d59121cfb898dcc99de1c76477ff2055a0" + "cci.20230715": + url: "https://github.com/google/XNNPACK/archive/645035286fe31d47eeb07900450f4f6540b75c2c.tar.gz" + sha256: "4c91153dfe4648dc3b325db0b4d6719d6e16f7ce30940b4ceb65abd033e5245e" "cci.20220801": url: "https://github.com/google/XNNPACK/archive/8e3d3359f9bec608e09fac1f7054a2a14b1bd73c.tar.gz" sha256: "c82327543249bd333034bbaa0300ed1fc9c7060fa73673a285042e3f042540e0" @@ -8,9 +17,3 @@ sources: "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 b4f316563dd04..81bd0455ccc87 100644 --- a/recipes/xnnpack/all/conanfile.py +++ b/recipes/xnnpack/all/conanfile.py @@ -15,11 +15,11 @@ class XnnpackConan(ConanFile): "neural network inference operators for ARM, WebAssembly, " \ "and x86 platforms." license = "BSD-3-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/google/XNNPACK" 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" - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -36,7 +36,8 @@ class XnnpackConan(ConanFile): "sparse": True, } - exports_sources = "CMakeLists.txt" + def export_sources(self): + copy(self, "xnnpack_project_include.cmake", self.recipe_folder, os.path.join(self.export_sources_folder, "src")) def config_options(self): if self.settings.os == "Windows": @@ -44,38 +45,43 @@ def config_options(self): 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 + 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("cpuinfo/cci.20220228") + if self.version in ["cci.20220801", "cci.20220621", "cci.20211210"]: + self.requires("cpuinfo/cci.20220228") + else: + self.requires("cpuinfo/cci.20231129") self.requires("fp16/cci.20210320") - self.requires("pthreadpool/cci.20210218") + # https://github.com/google/XNNPACK/blob/ed5f9c0562e016a08b274a4579de5ef500fec134/include/xnnpack.h#L15 + self.requires("pthreadpool/cci.20231129", transitive_headers=True) + self.requires("fxdiv/cci.20200417") def validate(self): check_min_vs(self, 192) - compiler = self.info.settings.compiler + compiler = self.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}") + if self.version < "cci.20230715": + 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}") + else: + # since cci.20230715, xnnpack requires avx512 header file + if (compiler == "gcc" and compiler_version < "11") or \ + (compiler == "clang" and compiler_version < "8"): + raise ConanInvalidConfiguration(f"{self.ref} doesn't support {compiler} {compiler.version}") + if self.options.assembly and compiler == "clang" and self.settings.arch == "armv6": + # clang assembly validator fails on XNNPACK's math.h for armv6: + # https://github.com/google/XNNPACK/issues/4348#issuecomment-1445437613 + raise ConanInvalidConfiguration(f"{self.ref} assembly option is incompatible with clang+armv6") 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,6 +92,7 @@ def generate(self): # Not defined by Conan for Apple Silicon. See https://github.com/conan-io/conan/pull/8026 tc.variables["CONAN_XNNPACK_SYSTEM_PROCESSOR"] = "arm64" tc.cache_variables["XNNPACK_LIBRARY_TYPE"] = "shared" if self.options.shared else "static" + tc.cache_variables["CMAKE_PROJECT_XNNPACK_INCLUDE"] = os.path.join(self.source_folder, "xnnpack_project_include.cmake") tc.variables["XNNPACK_ENABLE_ASSEMBLY"] = self.options.assembly tc.variables["XNNPACK_ENABLE_MEMOPT"] = self.options.memopt tc.variables["XNNPACK_ENABLE_SPARSE"] = self.options.sparse @@ -101,17 +108,33 @@ def generate(self): tc.generate() deps = CMakeDeps(self) + # The CMake scripts don't use targets prefixed with `namespace::` + # so we can coerce CMakeDeps to define the exact target names that + # are expected. This works in tandem with the file + # `CMAKE_PROJECT_XNNPACK_INCLUDE` which ensure an early call to + # the relevant `find_package` + deps.set_property("cpuinfo", "cmake_target_name", "cpuinfo") + deps.set_property("cpuinfo", "cmake_target_aliases", ["clog"] ) + deps.set_property("pthreadpool", "cmake_target_name", "pthreadpool") + deps.set_property("fp16", "cmake_target_name", "fp16") + deps.set_property("fxdiv", "cmake_target_name", "fxdiv") deps.generate() 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}") + if self.settings.compiler == "clang" and self.settings.arch == "armv7": + # https://github.com/google/XNNPACK/issues/4348 + # XNNPACK targets armv6, but clang fails to compile to due to a bug in the assembler (see linked issue). + # The user is targetting armv7, so adjust XNNPACK's -march accordingly to avoid the bug. + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "-march=armv6 -mfpu=vfp", "-march=armv7-a -mfpu=neon") def build(self): self._patch_sources() cmake = CMake(self) - cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) + cmake.configure() cmake.build(target="XNNPACK") def package(self): diff --git a/recipes/xnnpack/all/xnnpack_project_include.cmake b/recipes/xnnpack/all/xnnpack_project_include.cmake new file mode 100644 index 0000000000000..bbde492fd46a8 --- /dev/null +++ b/recipes/xnnpack/all/xnnpack_project_include.cmake @@ -0,0 +1,19 @@ +if(UNIX AND NOT APPLE) + # This project forces gcc to use C99 with GNU extensions disabled + # This may cause the `timespec` time (from POSIX) to not be defined + # at all - the macro below also causes POSIX types to be defined + # while remaining in C99 mode. + add_compile_definitions(_DEFAULT_SOURCE) +endif() + +if(NOT CMAKE_SYSTEM_PROCESSOR AND CONAN_XNNPACK_SYSTEM_PROCESSOR) + set(CMAKE_SYSTEM_PROCESSOR ${CONAN_XNNPACK_SYSTEM_PROCESSOR}) +endif() + +# The XNNPACK CMake scripts don't call find_package, +# but can work with targets - here we ensure we bring in those +# targets. +find_package(cpuinfo REQUIRED CONFIG) +find_package(pthreadpool REQUIRED CONFIG) +find_package(fp16 REQUIRED CONFIG) +find_package(fxdiv REQUIRED CONFIG) diff --git a/recipes/xnnpack/config.yml b/recipes/xnnpack/config.yml index 48525c3051347..5557e99d09d21 100644 --- a/recipes/xnnpack/config.yml +++ b/recipes/xnnpack/config.yml @@ -1,11 +1,13 @@ versions: + "cci.20240229": + folder: all + "cci.20231026": + folder: all + "cci.20230715": + folder: all "cci.20220801": folder: all "cci.20220621": folder: all "cci.20211210": folder: all - "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..658b472b4c45f 100644 --- a/recipes/xorg-cf-files/all/conandata.yml +++ b/recipes/xorg-cf-files/all/conandata.yml @@ -1,8 +1,12 @@ sources: + "1.0.8": + url: "https://www.x.org/pub/individual/util/xorg-cf-files-1.0.8.tar.gz" + sha256: "c6f1c9ffce96278a9d7c72d081e508d81c219dec69ae0dbaf8ae88f4bc9ef977" "1.0.7": url: "https://www.x.org/pub/individual/util/xorg-cf-files-1.0.7.tar.gz" sha256: "a49478ba0c2138bc53de38979cd2dee073b6fd6728597c552d266a707747f472" patches: + "1.0.8": + - patch_file: "patches/1.0.7-0001-win-fixes.patch" "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..1b0174ae22ceb 100644 --- a/recipes/xorg-cf-files/all/conanfile.py +++ b/recipes/xorg-cf-files/all/conanfile.py @@ -1,101 +1,103 @@ -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" # see https://github.com/conan-io/conan/issues/13431 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.") + if self.settings.compiler == "clang": + # See https://github.com/conan-io/conan-center-index/pull/16267#issuecomment-1469824504 + raise ConanInvalidConfiguration("Recipe cannot be built with clang") + + def build_requirements(self): + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/2.0.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..3f15b70b2d474 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.9") + if not self.conf_info.get("tools.gnu:make_program", check_type=str): + self.tool_requires("make/4.4") @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-cf-files/config.yml b/recipes/xorg-cf-files/config.yml index 377623d3a93f7..b0a4d47458ba1 100644 --- a/recipes/xorg-cf-files/config.yml +++ b/recipes/xorg-cf-files/config.yml @@ -1,3 +1,5 @@ versions: + "1.0.8": + folder: all "1.0.7": folder: all diff --git a/recipes/xorg-gccmakedep/all/conanfile.py b/recipes/xorg-gccmakedep/all/conanfile.py index 8381a9f3c1377..1aafda519a470 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/2.0.3") 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..2e869ee5f7766 100644 --- a/recipes/xorg-macros/all/conandata.yml +++ b/recipes/xorg-macros/all/conandata.yml @@ -1,8 +1,12 @@ sources: + "1.20.0": + url: "https://www.x.org/releases/individual/util/util-macros-1.20.0.tar.gz" + sha256: "8daf36913d551a90fd1013cb078401375dabae021cb4713b9b256a70f00eeb74" "1.19.3": url: "https://www.x.org/releases/individual/util/util-macros-1.19.3.tar.gz" sha256: "624bb6c3a4613d18114a7e3849a3d70f2d7af9dc6eabeaba98060d87e3aef35b" patches: + "1.20.0": + - patch_file: "patches/0001-export-XORG_MACROS_VERSION-macro.patch" "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/linter/__init__.py b/recipes/xorg-macros/all/test_package/src/Makefile.am similarity index 100% rename from linter/__init__.py rename to recipes/xorg-macros/all/test_package/src/Makefile.am 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-macros/config.yml b/recipes/xorg-macros/config.yml index 4d76ebbbccd62..5cecce18ebb70 100644 --- a/recipes/xorg-macros/config.yml +++ b/recipes/xorg-macros/config.yml @@ -1,3 +1,5 @@ versions: + "1.20.0": + folder: "all" "1.19.3": folder: "all" diff --git a/recipes/xorg-makedepend/all/conandata.yml b/recipes/xorg-makedepend/all/conandata.yml index 17712580498cb..f052e3d0c52d9 100644 --- a/recipes/xorg-makedepend/all/conandata.yml +++ b/recipes/xorg-makedepend/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.0.8": + url: "https://www.x.org/archive/individual/util/makedepend-1.0.8.tar.xz" + sha256: "bfb26f8025189b2a01286ce6daacc2af8fe647440b40bb741dd5c397572cba5b" "1.0.6": url: "https://www.x.org/archive/individual/util/makedepend-1.0.6.tar.gz" sha256: "845f6708fc850bf53f5b1d0fb4352c4feab3949f140b26f71b22faba354c3365" diff --git a/recipes/xorg-makedepend/all/conanfile.py b/recipes/xorg-makedepend/all/conanfile.py index 954b8aa995149..a0024be22451a 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): @@ -11,75 +14,72 @@ class XorgMakedepend(ConanFile): description = "Utility to parse C source files to make dependency lists for Makefiles" topics = ("xorg", "dependency", "obsolete") license = "MIT" - homepage = "https://gitlab.freedesktop.org/xorg/util/cf" + homepage = "https://gitlab.freedesktop.org/xorg/util/makedepend" 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") + self.build_requires("pkgconf/2.0.3") def validate(self): if self.settings.os == "Windows": 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-makedepend/config.yml b/recipes/xorg-makedepend/config.yml index c8c4465c97415..09dfd19800bb5 100644 --- a/recipes/xorg-makedepend/config.yml +++ b/recipes/xorg-makedepend/config.yml @@ -1,3 +1,5 @@ versions: + "1.0.8": + folder: all "1.0.6": folder: all diff --git a/recipes/xorg-proto/all/conandata.yml b/recipes/xorg-proto/all/conandata.yml index a78c2d2c2da43..31aa321346999 100644 --- a/recipes/xorg-proto/all/conandata.yml +++ b/recipes/xorg-proto/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2024.1": + url: "https://www.x.org/releases/individual/proto/xorgproto-2024.1.tar.gz" + sha256: "4f6b9b4faf91e5df8265b71843a91fc73dc895be6210c84117a996545df296ce" "2022.2": url: "https://www.x.org/releases/individual/proto/xorgproto-2022.2.tar.gz" sha256: "da351a403d07a7006d7bdc8dcfc14ddc1b588b38fb81adab9989a8eef605757b" diff --git a/recipes/xorg-proto/all/conanfile.py b/recipes/xorg-proto/all/conanfile.py index 47a81a9f8ca66..b6a780899bca5 100644 --- a/recipes/xorg-proto/all/conanfile.py +++ b/recipes/xorg-proto/all/conanfile.py @@ -1,97 +1,82 @@ from conan import ConanFile -from conan.tools.files import rmdir, mkdir, save, load, get, apply_conandata_patches -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.41.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/2.0.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. - del self.info.settings.arch - del self.info.settings.build_type - del self.info.settings.compiler + self.info.clear() + + def export_sources(self): + export_conandata_patches(self) 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.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): apply_conandata_patches(self) - with self._build_context(): - autotools = self._configure_autotools() - autotools.make() + + 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 2928e57dc1b28..0af5118e3b73a 100644 --- a/recipes/xorg-proto/config.yml +++ b/recipes/xorg-proto/config.yml @@ -1,4 +1,6 @@ versions: + "2024.1": + folder: "all" "2022.2": folder: "all" "2021.4": diff --git a/recipes/xorg/all/conanfile.py b/recipes/xorg/all/conanfile.py index 6182a83010618..18c7f048404e4 100644 --- a/recipes/xorg/all/conanfile.py +++ b/recipes/xorg/all/conanfile.py @@ -1,13 +1,15 @@ -from conan import ConanFile +from conan import ConanFile, conan_version from conan.tools.gnu import PkgConfig from conan.tools.system import package_manager from conan.errors import ConanInvalidConfiguration +from conan.tools.scm import Version -required_conan_version = ">=1.47" +required_conan_version = ">=1.50.0" class XorgConan(ConanFile): name = "xorg" + package_type = "shared-library" url = "https://github.com/conan-io/conan-center-index" license = "MIT" homepage = "https://www.x.org/wiki/" @@ -20,7 +22,7 @@ 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 = package_manager.Apt(self) @@ -28,57 +30,74 @@ def system_requirements(self): "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", "libxcb-render0-dev", + "libxv-dev", "libxxf86vm-dev", "libxcb-glx0-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", "libxcb-dri3-dev", "uuid-dev"], update=True, check=True) + "libxcb-xinerama0-dev", "libxcb-dri3-dev", "uuid-dev", "libxcb-cursor-dev", "libxcb-dri2-0-dev", + "libxcb-dri3-dev", "libxcb-present-dev", "libxcb-composite0-dev", "libxcb-ewmh-dev", + "libxcb-res0-dev"], update=True, check=True) apt.install_substitutes( ["libxcb-util-dev"], ["libxcb-util0-dev"], update=True, check=True) 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", + "libxkbfile-devel", "libXrandr-devel", "libXres-devel", "libXScrnSaver-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"], update=True, check=True) + "xcb-util-devel", "libuuid-devel", "xcb-util-cursor-devel"], update=True, check=True) 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", + "libxkbfile-devel", "libXrandr-devel", "libXres-devel", "libXScrnSaver-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"], update=True, check=True) + "xcb-util-devel", "libuuid-devel", "xcb-util-cursor-devel"], update=True, check=True) 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", + "libxkbfile-devel", "libXrandr-devel", "libXres-devel", "libXss-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"], update=True, check=True) + "xcb-util-devel", "libuuid-devel", "xcb-util-cursor-devel"], update=True, check=True) pacman = package_manager.PacMan(self) pacman.install(["libxcb", "libfontenc", "libice", "libsm", "libxaw", "libxcomposite", "libxcursor", "libxdamage", "libxdmcp", "libxtst", "libxinerama", "libxkbfile", "libxrandr", "libxres", - "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) + "libxss", "xcb-util-wm", "xcb-util-image", "xcb-util-keysyms", "xcb-util-renderutil", + "libxxf86vm", "libxv", "xcb-util", "util-linux-libs", "xcb-util-cursor"], update=True, check=True) package_manager.Pkg(self).install(["libX11", "libfontenc", "libice", "libsm", "libxaw", "libxcomposite", "libxcursor", "libxdamage", "libxdmcp", "libxtst", "libxinerama", "libxkbfile", "libxrandr", "libxres", - "libXScrnSaver", "libxvmc", "xcb-util-wm", "xcb-util-image", "xcb-util-keysyms", "xcb-util-renderutil", - "libxxf86vm", "libxv", "xkeyboard-config", "xcb-util"], update=True, check=True) + "libXScrnSaver", "xcb-util-wm", "xcb-util-image", "xcb-util-keysyms", "xcb-util-renderutil", + "libxxf86vm", "libxv", "xkeyboard-config", "xcb-util", "xcb-util-cursor"], update=True, check=True) + + if Version(conan_version) >= "2.0.10": + alpine = package_manager.Apk(self) + alpine.install(["libx11-dev", " libxcb-dev", "libfontenc-dev", "libice-dev", "libsm-dev", " libxau-dev", "libxaw-dev", + "libxcomposite-dev", "libxcursor-dev", "libxdamage-dev", "libxdmcp-dev", " libxext-dev", "libxfixes-dev", "libxi-dev", + "libxinerama-dev", "libxkbfile-dev", " libxmu-dev", "libxpm-dev", "libxrandr-dev", "libxrender-dev", "libxres-dev", + "libxscrnsaver-dev", "libxt-dev", "libxtst-dev", "libxv-dev", "libxxf86vm-dev", + "xcb-util-wm-dev", "xcb-util-image-dev", "xcb-util-keysyms-dev", "xcb-util-renderutil-dev", + "libxinerama-dev", "libxcb-dev", "xcb-util-dev", "xcb-util-cursor-dev"], update=True, check=True) def package_info(self): + if Version(conan_version) >= 2: + self.cpp_info.bindirs = [] + self.cpp_info.includedirs = [] + self.cpp_info.libdirs = [] + 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", + "xscrnsaver", "xt", "xtst", "xv", "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", "xcb-atom", "xcb-aux", "xcb-event", "xcb-util", - "xcb-dri3"] + ([] if self.settings.os == "FreeBSD" else ["uuid"]): + "xcb-dri3", "xcb-cursor", "xcb-dri2", "xcb-dri3", "xcb-glx", "xcb-present", + "xcb-composite", "xcb-ewmh", "xcb-res"] + ([] if self.settings.os == "FreeBSD" else ["uuid"]): pkg_config = PkgConfig(self, name) pkg_config.fill_cpp_info( self.cpp_info.components[name], is_system=self.settings.os != "FreeBSD") @@ -87,6 +106,9 @@ def package_info(self): "pkg_config_name", name) self.cpp_info.components[name].set_property( "component_version", pkg_config.version) + self.cpp_info.components[name].bindirs = [] + self.cpp_info.components[name].includedirs = [] + self.cpp_info.components[name].libdirs = [] self.cpp_info.components[name].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/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/xorstr/all/conanfile.py b/recipes/xorstr/all/conanfile.py index 2712a05ac7044..f5d66df51bfdb 100644 --- a/recipes/xorstr/all/conanfile.py +++ b/recipes/xorstr/all/conanfile.py @@ -15,8 +15,9 @@ class XorstrConan(ConanFile): topics = ("encryption", "string", "vectorized") homepage = "https://github.com/JustasMasiulis/xorstr" url = "https://github.com/conan-io/conan-center-index" - no_copy_source = True + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" + no_copy_source = True @property def _min_cppstd(self): @@ -55,8 +56,7 @@ def loose_lt_semver(v1, v2): ) 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 diff --git a/recipes/xoshiro-cpp/all/conanfile.py b/recipes/xoshiro-cpp/all/conanfile.py index 6530c076be41f..97eea31fdbb08 100644 --- a/recipes/xoshiro-cpp/all/conanfile.py +++ b/recipes/xoshiro-cpp/all/conanfile.py @@ -1,7 +1,12 @@ -from conans import ConanFile, 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.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.scm import Version + +required_conan_version = ">=1.50.0" class XoshiroCppConan(ConanFile): @@ -11,9 +16,12 @@ class XoshiroCppConan(ConanFile): homepage = "https://github.com/Reputeless/Xoshiro-cpp" url = "https://github.com/conan-io/conan-center-index" topics = ("prng", "xoshiro", "header-only") - settings = "arch", "build_type", "compiler", "os" - generators = "cmake" - no_copy_source = True + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + + @property + def _min_cppstd(self): + return "17" @property def _minimum_compilers_version(self): @@ -21,48 +29,32 @@ def _minimum_compilers_version(self): "apple-clang": "10", "clang": "6", "gcc": "7", - "Visual Studio": "16" + "Visual Studio": "16", + "msvc": "192", } - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _minimum_cpp_standard(self): - return 17 + 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._min_cppstd) - compiler = self.settings.compiler - try: - min_version = self._minimum_compilers_version[str(compiler)] - 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) + 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], - 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/xoshiro-cpp", - src=self._source_subfolder) - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - - def package_id(self): - self.info.header_only() + copy(self, "*.hpp", src=self.source_folder, + dst=os.path.join(self.package_folder, "include", "xoshiro-cpp")) + copy(self, "LICENSE", src=self.source_folder, + dst=os.path.join(self.package_folder, "licenses")) def package_info(self): - self.cpp_info.names["cmake_find_package"] = "xoshiro-cpp" - self.cpp_info.names["cmake_find_package_multi"] = "xoshiro-cpp" + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/xoshiro-cpp/all/test_package/CMakeLists.txt b/recipes/xoshiro-cpp/all/test_package/CMakeLists.txt index 10b7962b40da7..4a58eb5fc4eb1 100644 --- a/recipes/xoshiro-cpp/all/test_package/CMakeLists.txt +++ b/recipes/xoshiro-cpp/all/test_package/CMakeLists.txt @@ -1,13 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package) - -set(CMAKE_CXX_STANDARD 17) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(xoshiro-cpp REQUIRED CONFIG) -add_executable(${PROJECT_NAME} test_package.cpp) +add_executable(test_package test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE xoshiro-cpp::xoshiro-cpp) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_${CMAKE_CXX_STANDARD}) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/xoshiro-cpp/all/test_package/conanfile.py b/recipes/xoshiro-cpp/all/test_package/conanfile.py index 17a59b1022fd6..7e910b5e71329 100644 --- a/recipes/xoshiro-cpp/all/test_package/conanfile.py +++ b/recipes/xoshiro-cpp/all/test_package/conanfile.py @@ -1,18 +1,27 @@ 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 TestPackageConan(ConanFile): +class XoshiroCppTestConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" def build(self): cmake = CMake(self) cmake.configure() cmake.build() + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run("{0}".format(bin_path), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/xoshiro-cpp/all/test_v1_package/CMakeLists.txt b/recipes/xoshiro-cpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/xoshiro-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/xoshiro-cpp/all/test_v1_package/conanfile.py b/recipes/xoshiro-cpp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..2fc6ad2a6a2ba --- /dev/null +++ b/recipes/xoshiro-cpp/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +import os + +from conans import CMake, ConanFile, 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("{0}".format(bin_path), run_environment=True) diff --git a/recipes/xpack/all/conandata.yml b/recipes/xpack/all/conandata.yml index 28444be3a175d..1216e4df4ec82 100644 --- a/recipes/xpack/all/conandata.yml +++ b/recipes/xpack/all/conandata.yml @@ -1,4 +1,26 @@ sources: + "1.0.5": + url: "https://github.com/xyz347/xpack/archive/v1.0.5.tar.gz" + sha256: "ea8693dd3a53d54e0c1e3c9e6e06f31ff7f593f7f8cf8fb4889f5c3354dbae8e" + "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..278c5b2d134b0 100644 --- a/recipes/xpack/all/conanfile.py +++ b/recipes/xpack/all/conanfile.py @@ -1,28 +1,59 @@ -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, 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 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") + package_type = "header-library" + 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.20230929") + self.requires("rapidxml/1.13") + + 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", "rapidjson"], + ) - 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..8588b8510913c 100644 --- a/recipes/xpack/config.yml +++ b/recipes/xpack/config.yml @@ -1,3 +1,9 @@ versions: + "1.0.5": + folder: "all" + "1.0.4": + folder: "all" + "1.0.3": + folder: "all" "1.0.2": folder: "all" diff --git a/recipes/xproperty/all/conandata.yml b/recipes/xproperty/all/conandata.yml index e22cd28ead6ab..b13aae1530d67 100644 --- a/recipes/xproperty/all/conandata.yml +++ b/recipes/xproperty/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.12.0": + url: "https://github.com/jupyter-xeus/xproperty/archive/refs/tags/0.12.0.tar.gz" + sha256: "27cbc8e441dcc515a1ebbf11bad5ef240748d32f5e1adf84deed87a1dc57a440" "0.11.0": url: "https://github.com/jupyter-xeus/xproperty/archive/refs/tags/0.11.0.tar.gz" sha256: "bf86a11c6758308aa0aa0f64d8dd24cd3e9d78378467b74002f552bfb75fc0eb" diff --git a/recipes/xproperty/all/conanfile.py b/recipes/xproperty/all/conanfile.py index f3db566cfff6d..dce5d7f565304 100644 --- a/recipes/xproperty/all/conanfile.py +++ b/recipes/xproperty/all/conanfile.py @@ -2,38 +2,45 @@ from conan.tools.build import check_min_cppstd from conan.tools.files import copy, get, save from conan.tools.layout import basic_layout +from conan.tools.scm import Version import os import textwrap -required_conan_version = ">=1.52.0" +required_conan_version = ">=2.1.0" class XpropertyConan(ConanFile): name = "xproperty" description = "Traitlets-like C++ properties and implementation of the observer pattern." license = "BSD-3-Clause" - topics = ("observer", "traitlets") - homepage = "https://github.com/jupyter-xeus/xproperty" url = "https://github.com/conan-io/conan-center-index" - no_copy_source = True + homepage = "https://github.com/jupyter-xeus/xproperty" + topics = ("observer", "traitlets", "header-only") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _min_cppstd(self): + return "14" if Version(self.version) <= "0.12.0" else "17" def layout(self): basic_layout(self, src_folder="src") def requirements(self): - self.requires("xtl/0.7.4", transitive_headers=True, transitive_libs=True) + if Version(self.version) < "0.12.0": + self.requires("xtl/0.7.4", transitive_headers=True, transitive_libs=True) + else: + self.requires("nlohmann_json/3.11.3") def package_id(self): self.info.clear() def validate(self): - if self.settings.compiler.get_safe("cppstd"): - check_min_cppstd(self, 14) + 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def build(self): pass diff --git a/recipes/xproperty/all/test_package/CMakeLists.txt b/recipes/xproperty/all/test_package/CMakeLists.txt index 5115f7961f51a..b676192b1da44 100644 --- a/recipes/xproperty/all/test_package/CMakeLists.txt +++ b/recipes/xproperty/all/test_package/CMakeLists.txt @@ -5,4 +5,8 @@ find_package(xproperty REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE xproperty) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) +if(xproperty_VERSION VERSION_LESS "0.12.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/xproperty/config.yml b/recipes/xproperty/config.yml index 98fa57f62a6c8..b63b89545fb06 100644 --- a/recipes/xproperty/config.yml +++ b/recipes/xproperty/config.yml @@ -1,3 +1,5 @@ versions: + "0.12.0": + folder: all "0.11.0": folder: all diff --git a/recipes/xsd/all/conandata.yml b/recipes/xsd/all/conandata.yml index d0b47cfe2aef6..342ac8fd08fed 100644 --- a/recipes/xsd/all/conandata.yml +++ b/recipes/xsd/all/conandata.yml @@ -5,12 +5,7 @@ sources: patches: "4.0.0": - patch_file: "patches/0002-missing-include.patch" - base_path: "source_subfolder" - patch_file: "patches/0100-C++Parser_Expat_support.patch" - base_path: "source_subfolder" - patch_file: "patches/0105-Fix_path_handling_bug.patch" - base_path: "source_subfolder" - patch_file: "patches/0110-xerces-c3.2.patch" - base_path: "source_subfolder" - patch_file: "patches/0700_hurd_PATH_MAX.patch" - base_path: "source_subfolder" diff --git a/recipes/xsd/all/conanfile.py b/recipes/xsd/all/conanfile.py index 19183a5008e25..8d9e15a3818f4 100644 --- a/recipes/xsd/all/conanfile.py +++ b/recipes/xsd/all/conanfile.py @@ -1,91 +1,87 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration import os -required_conan_version = ">=1.40.0" +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, chdir, copy, export_conandata_patches, get, rmdir +from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain +from conan.tools.layout import basic_layout + +required_conan_version = ">=1.52.0" class ConanXqilla(ConanFile): name = "xsd" - description = ( - "XSD is a W3C XML Schema to C++ translator. It generates vocabulary-specific, statically-typed C++ mappings (also called bindings) from XML Schema definitions. XSD supports two C++ mappings: in-memory C++/Tree and event-driven C++/Parser." + "XSD is a W3C XML Schema to C++ translator. " + "It generates vocabulary-specific, statically-typed C++ mappings (also called bindings) from XML Schema definitions. " + "XSD supports two C++ mappings: in-memory C++/Tree and event-driven C++/Parser." ) - topics = ("xsd", "xml", "c++") + license = ("GPL-2.0", "FLOSSE") url = "https://github.com/conan-io/conan-center-index" homepage = "https://codesynthesis.com/projects/xsd/" - license = ("GPL-2.0","FLOSSE") + topics = ("xml", "c++") + + package_type = "application" settings = "os", "arch", "compiler", "build_type" - exports_sources = "patches/**" + 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 requirements(self): self.requires("xerces-c/3.2.3") - @property - def _doc_folder(self): - return os.path.join(self._source_subfolder,"xsd","doc") - - @property - def _make_cmd(self): - return self._gnumake_cmd - - @property - def _make_program(self): - return tools.get_env('CONAN_MAKE_PROGRAM', tools.which('make')) - - @property - def _gnumake_cmd(self): - make_ldflags = "LDFLAGS='{libs} -pthread'".format( - libs=" ".join(["-L{}".format(os.path.join(self.deps_cpp_info["xerces-c"].rootpath, it)) for it in self.deps_cpp_info["xerces-c"].libdirs])) - flags = [] - flags.append(' '.join(["-I{}".format(os.path.join(self.deps_cpp_info["xerces-c"].rootpath, it)) for it in self.deps_cpp_info["xerces-c"].includedirs])) - if self.settings.compiler == "gcc": - flags.append('-std=c++11') - make_ccpflags = "CPPFLAGS='{}'".format(" ".join(flags)) - make_cmd = f'{make_ldflags} {make_ccpflags} {self._make_program} -j{tools.cpu_count()}' - return make_cmd + def package_id(self): + del self.info.settings.compiler def validate(self): - if self.settings.os != "Linux": + if self.settings.os not in ["Linux", "FreeBSD"]: raise ConanInvalidConfiguration("The xsd recipe currently only supports Linux.") if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 11) - - def package_id(self): - del self.info.settings.compiler + 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], strip_root=True) + + def generate(self): + tc = AutotoolsToolchain(self) + tc.extra_cxxflags = ["-std=c++11"] + tc.extra_ldflags = ["-pthread"] + tc.generate() + tc = AutotoolsDeps(self) + tc.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(self._make_cmd) + apply_conandata_patches(self) + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.make() def package(self): - self.copy("LICENSE", dst="licenses", src=os.path.join(self._source_subfolder, "xsd")) - self.copy("GPLv2", dst="licenses", src=os.path.join(self._source_subfolder, "xsd")) - self.copy("FLOSSE", dst="licenses", src=os.path.join(self._source_subfolder, "xsd")) - - with tools.chdir(self._source_subfolder): - self.run(self._make_install_cmd) - - tools.rmdir(os.path.join(self.package_folder, "share")) + copy(self, "LICENSE", + dst=os.path.join(self.package_folder, "licenses"), + src=os.path.join(self.source_folder, "xsd")) + copy(self, "GPLv2", + dst=os.path.join(self.package_folder, "licenses"), + src=os.path.join(self.source_folder, "xsd")) + copy(self, "FLOSSE", + dst=os.path.join(self.package_folder, "licenses"), + src=os.path.join(self.source_folder, "xsd")) + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.install(args=[f"install_prefix={self.package_folder}"]) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): + self.cpp_info.frameworkdirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] + self.cpp_info.includedirs = [] + + # 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) - - @property - def _make_install_cmd(self): - make_install_cmd = f'{self._make_cmd} install_prefix={self.package_folder} install' - return make_install_cmd diff --git a/recipes/xsd/all/test_package/conanfile.py b/recipes/xsd/all/test_package/conanfile.py index 7ea50ba1ad430..fd802956c6269 100644 --- a/recipes/xsd/all/test_package/conanfile.py +++ b/recipes/xsd/all/test_package/conanfile.py @@ -1,10 +1,13 @@ -from conans import ConanFile, tools -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) def test(self): - if not tools.cross_building(self): - self.run("xsd --help", run_environment=True) + self.run("xsd --help") diff --git a/recipes/xsd/all/test_v1_package/conanfile.py b/recipes/xsd/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..7ea50ba1ad430 --- /dev/null +++ b/recipes/xsd/all/test_v1_package/conanfile.py @@ -0,0 +1,10 @@ +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("xsd --help", run_environment=True) diff --git a/recipes/xsimd/all/conandata.yml b/recipes/xsimd/all/conandata.yml index 2ed7aecb5b128..04062faa8cea0 100644 --- a/recipes/xsimd/all/conandata.yml +++ b/recipes/xsimd/all/conandata.yml @@ -1,4 +1,25 @@ sources: + "13.0.0": + url: "https://github.com/xtensor-stack/xsimd/archive/13.0.0.tar.gz" + sha256: "8bdbbad0c3e7afa38d88d0d484d70a1671a1d8aefff03f4223ab2eb6a41110a3" + "12.1.1": + url: "https://github.com/xtensor-stack/xsimd/archive/12.1.1.tar.gz" + sha256: "73f94a051278ef3da4533b691d31244d12074d5d71107473a9fd8d7be15f0110" + "12.1.0": + url: "https://github.com/xtensor-stack/xsimd/archive/12.1.0.tar.gz" + sha256: "86b86e0aeba7a85575f6e079728f0c2b65307dddb7210487f2b7cb261ac8a4a2" + "12.0.0": + url: "https://github.com/xtensor-stack/xsimd/archive/12.0.0.tar.gz" + sha256: "6f156ec9bcc602d2581ef023ef0e927e3759c30cf1405028210e8c103a4f846d" + "11.2.0": + url: "https://github.com/xtensor-stack/xsimd/archive/11.2.0.tar.gz" + sha256: "509bbfe12e78ee1a0e81711019e7c7a372dabcff566dbf15b95cc94339443242" + "11.1.0": + url: "https://github.com/xtensor-stack/xsimd/archive/11.1.0.tar.gz" + sha256: "aa54dba8daade472656eba0d27154f072fec06ee3831aefcac69a5f6c7dbbae7" + "11.0.0": + url: "https://github.com/xtensor-stack/xsimd/archive/11.0.0.tar.gz" + sha256: "50c31c319c8b36c8946eb954c7cca2e2ece86bf8a66a7ebf321b24cd273e7c47" "10.0.0": url: "https://github.com/xtensor-stack/xsimd/archive/10.0.0.tar.gz" sha256: "73f818368b3a4dad92fab1b2933d93694241bd2365a6181747b2df1768f6afdd" diff --git a/recipes/xsimd/all/conanfile.py b/recipes/xsimd/all/conanfile.py index 704d20b0065db..b22729f3e5ce1 100644 --- a/recipes/xsimd/all/conanfile.py +++ b/recipes/xsimd/all/conanfile.py @@ -4,6 +4,7 @@ from conan.tools.layout import basic_layout from conan.tools.scm import Version from conan.tools.apple import is_apple_os +from conan.tools.build import check_min_cppstd import os import textwrap @@ -12,12 +13,12 @@ class XsimdConan(ConanFile): name = "xsimd" + description = "C++ wrappers for SIMD intrinsics and parallelized, optimized mathematical functions (SSE, AVX, NEON, AVX512)" license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/xtensor-stack/xsimd" - description = "C++ wrappers for SIMD intrinsics and parallelized, optimized mathematical functions (SSE, AVX, NEON, AVX512)" - topics = ("simd-intrinsics", "vectorization", "simd") - + topics = ("simd-intrinsics", "vectorization", "simd", "header-only") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" options = { "xtl_complex": [True, False], @@ -25,27 +26,49 @@ class XsimdConan(ConanFile): default_options = { "xtl_complex": False, } - no_copy_source = True + @property + def _min_cppstd(self): + return 14 if self.options.xtl_complex else 11 + + @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 requirements(self): if self.options.xtl_complex: - self.requires("xtl/0.7.4") + self.requires("xtl/0.7.5") def package_id(self): self.info.clear() def validate(self): # TODO: check supported version (probably >= 8.0.0) - if Version(self.version) < "8.0.0" and self.settings.os == "Macos" and self.settings.arch in ["armv8", "armv8_32", "armv8.3"]: - raise ConanInvalidConfiguration(f"{self.name} doesn't support macOS M1") + if Version(self.version) < "8.0.0" and is_apple_os(self) and self.settings.arch in ["armv8", "armv8_32", "armv8.3"]: + raise ConanInvalidConfiguration(f"{self.ref} doesn't support macOS M1") + + 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 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 package(self): copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) @@ -80,9 +103,7 @@ def package_info(self): if self.options.xtl_complex: self.cpp_info.defines = ["XSIMD_ENABLE_XTL_COMPLEX=1"] self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] 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 \ diff --git a/recipes/xsimd/all/test_package/CMakeLists.txt b/recipes/xsimd/all/test_package/CMakeLists.txt index 5d39cde644c56..0624e265ce85e 100644 --- a/recipes/xsimd/all/test_package/CMakeLists.txt +++ b/recipes/xsimd/all/test_package/CMakeLists.txt @@ -7,7 +7,12 @@ find_package(xsimd REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE xsimd) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) + +if (XSIMD_WITH_XTL) + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) +else() + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +endif() if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") foreach(flag "/arch:AVX") diff --git a/recipes/xsimd/all/test_package/conanfile.py b/recipes/xsimd/all/test_package/conanfile.py index d120a992c06a6..21848efdbb9cb 100644 --- a/recipes/xsimd/all/test_package/conanfile.py +++ b/recipes/xsimd/all/test_package/conanfile.py @@ -1,18 +1,28 @@ from conan import ConanFile from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout +from conan.tools.cmake import CMakeDeps, CMakeToolchain +from conan.tools.env import VirtualBuildEnv import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + + def layout(self): + cmake_layout(self) def requirements(self): self.requires(self.tested_reference_str) - def layout(self): - cmake_layout(self) + def generate(self): + tc = CMakeToolchain(self) + tc.variables["XSIMD_WITH_XTL"] = self.dependencies["xsimd"].options.xtl_complex + tc.generate() + tc = CMakeDeps(self) + tc.generate() + tc = VirtualBuildEnv(self) + tc.generate(scope="build") def build(self): cmake = CMake(self) diff --git a/recipes/xsimd/all/test_package/test_package.cpp b/recipes/xsimd/all/test_package/test_package.cpp index be0d55dea1818..ed1e514c89b74 100644 --- a/recipes/xsimd/all/test_package/test_package.cpp +++ b/recipes/xsimd/all/test_package/test_package.cpp @@ -1,27 +1,17 @@ #include "xsimd/xsimd.hpp" #include -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[]) { + namespace xs = xsimd; #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); -#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}); + xs::batch a(1., 1.); + xs::batch b(2., 2.); #else - xs::batch a{1.5, 2.5, 3.5, 4.5}; - xs::batch b{2.5, 3.5, 4.5, 5.5}; + auto a = xs::broadcast(1.); + auto b = xs::broadcast(2.); #endif - auto mean = (a + b) / 2; - std::cout << mean << std::endl; + auto mean = (a + b) / 2.; + std::cout << "Mean: " << mean << std::endl; return 0; } diff --git a/recipes/xsimd/all/test_v1_package/CMakeLists.txt b/recipes/xsimd/all/test_v1_package/CMakeLists.txt index b2359dc86fc74..9d54a092e0a67 100644 --- a/recipes/xsimd/all/test_v1_package/CMakeLists.txt +++ b/recipes/xsimd/all/test_v1_package/CMakeLists.txt @@ -1,29 +1,8 @@ cmake_minimum_required(VERSION 3.8) project(test_package LANGUAGES CXX) -include(CheckCXXCompilerFlag) - include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(xsimd REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE xsimd) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) - -if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") - foreach(flag "/arch:AVX") - CHECK_CXX_COMPILER_FLAG(${flag} COMPILER_SUPPORTS_MARCH_NATIVE) - if(COMPILER_SUPPORTS_MARCH_NATIVE) - target_compile_options(${PROJECT_NAME} PRIVATE ${flag}) - endif() - endforeach() -elseif ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") OR (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")) - foreach(flag "-march=native" "-mtune=native") - CHECK_CXX_COMPILER_FLAG(${flag} COMPILER_SUPPORTS_MARCH_NATIVE) - if(COMPILER_SUPPORTS_MARCH_NATIVE) - target_compile_options(${PROJECT_NAME} PRIVATE ${flag}) - endif() - endforeach() -endif() +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/xsimd/all/test_v1_package/conanfile.py b/recipes/xsimd/all/test_v1_package/conanfile.py index 38f4483872d47..71bd246c37e4e 100644 --- a/recipes/xsimd/all/test_v1_package/conanfile.py +++ b/recipes/xsimd/all/test_v1_package/conanfile.py @@ -8,6 +8,7 @@ class TestPackageConan(ConanFile): def build(self): cmake = CMake(self) + cmake.definitions["XSIMD_WITH_XTL"] = self.options["xsimd"].xtl_complex cmake.configure() cmake.build() diff --git a/recipes/xsimd/config.yml b/recipes/xsimd/config.yml index 87c79dc95d5ef..1f8cc881d52a7 100644 --- a/recipes/xsimd/config.yml +++ b/recipes/xsimd/config.yml @@ -1,4 +1,18 @@ versions: + "13.0.0": + folder: all + "12.1.1": + folder: all + "12.1.0": + folder: all + "12.0.0": + folder: all + "11.2.0": + folder: all + "11.1.0": + folder: all + "11.0.0": + folder: all "10.0.0": folder: all "9.0.1": diff --git a/recipes/xtensor/all/conandata.yml b/recipes/xtensor/all/conandata.yml index 5b2596a448217..300c78982eca0 100644 --- a/recipes/xtensor/all/conandata.yml +++ b/recipes/xtensor/all/conandata.yml @@ -1,38 +1,27 @@ sources: - "0.24.2": - url: "https://github.com/xtensor-stack/xtensor/archive/0.24.2.tar.gz" - sha256: "790d9e449add817154177157a850b9afd0260dc0f9df857d8b3a38886a10ef8b" - "0.24.0": - url: "https://github.com/xtensor-stack/xtensor/archive/0.24.0.tar.gz" - sha256: "37738aa0865350b39f048e638735c05d78b5331073b6329693e8b8f0902df713" + "0.25.0": + url: "https://github.com/xtensor-stack/xtensor/archive/0.25.0.tar.gz" + sha256: "32d5d9fd23998c57e746c375a544edf544b74f0a18ad6bc3c38cbba968d5e6c7" + "0.24.7": + url: "https://github.com/xtensor-stack/xtensor/archive/0.24.7.tar.gz" + sha256: "0fbbd524dde2199b731b6af99b16063780de6cf1d0d6cb1f3f4d4ceb318f3106" + "0.24.6": + url: "https://github.com/xtensor-stack/xtensor/archive/0.24.6.tar.gz" + sha256: "f87259b51aabafdd1183947747edfff4cff75d55375334f2e81cee6dc68ef655" "0.23.10": 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 "0.21.5": - sha256: 30cb896b6686683ddaefb12c98bf1109fdfe666136dd027aba1a1e9aa825c241 - url: https://github.com/xtensor-stack/xtensor/archive/0.21.5.tar.gz - "0.21.4": - sha256: 143ef2536f1671e1c7c7834de4a040f1694112e23222fcd2ae59b0f5e5124b57 - url: https://github.com/xtensor-stack/xtensor/archive/0.21.4.tar.gz - "0.21.3": - sha256: f63c25cafea4bfc268edb26e6f5004a28a2f689e6a852bb3559c553106c8d6bf - url: https://github.com/xtensor-stack/xtensor/archive/0.21.3.tar.gz - "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.5.tar.gz" + sha256: "30cb896b6686683ddaefb12c98bf1109fdfe666136dd027aba1a1e9aa825c241" patches: - "0.24.2": - - patch_file: "patches/0.24.0-cxx11-abi.patch" - "0.24.0": - - patch_file: "patches/0.24.0-cxx11-abi.patch" "0.23.10": - patch_file: "patches/0.23.9-cxx11-abi.patch" - "0.23.9": - - patch_file: "patches/0.23.9-cxx11-abi.patch" + 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" - "0.21.4": - - patch_file: "patches/0.21.4-cxx11-abi.patch" + 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 52e5e88678830..1181b6ae698ab 100644 --- a/recipes/xtensor/all/conanfile.py +++ b/recipes/xtensor/all/conanfile.py @@ -12,6 +12,7 @@ class XtensorConan(ConanFile): name = "xtensor" + package_type = "header-library" description = "C++ tensors with broadcasting and lazy computing" license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" @@ -50,15 +51,15 @@ def layout(self): basic_layout(self, src_folder="src") def requirements(self): - self.requires("xtl/0.7.4") - self.requires("nlohmann_json/3.11.2") + self.requires("xtl/0.7.5") + self.requires("nlohmann_json/3.11.3") if self.options.xsimd: if Version(self.version) < "0.24.0": self.requires("xsimd/7.5.0") else: - self.requires("xsimd/9.0.1") + self.requires("xsimd/13.0.0") if self.options.tbb: - self.requires("onetbb/2021.7.0") + self.requires("onetbb/2021.10.0") def package_id(self): self.info.clear() diff --git a/recipes/xtensor/all/patches/0.21.4-cxx11-abi.patch b/recipes/xtensor/all/patches/0.21.4-cxx11-abi.patch deleted file mode 100644 index 785004e7c86cd..0000000000000 --- a/recipes/xtensor/all/patches/0.21.4-cxx11-abi.patch +++ /dev/null @@ -1,22 +0,0 @@ -diff --git a/include/xtensor/xutils.hpp b/include/xtensor/xutils.hpp -index ce3ce72..936d387 100644 ---- a/include/xtensor/xutils.hpp -+++ b/include/xtensor/xutils.hpp -@@ -611,12 +611,16 @@ namespace xt - /******************************************** - * xtrivial_default_construct implemenation * - ********************************************/ -- -+#if defined(_GLIBCXX_RELEASE) && _GLIBCXX_RELEASE >= 7 -+// has_trivial_default_constructor has not been available since libstdc++-7. -+#define XTENSOR_GLIBCXX_USE_CXX11_ABI 1 -+#else - #if defined(_GLIBCXX_USE_CXX11_ABI) - #if _GLIBCXX_USE_CXX11_ABI || (defined(_GLIBCXX_USE_DUAL_ABI) && !_GLIBCXX_USE_DUAL_ABI) - #define XTENSOR_GLIBCXX_USE_CXX11_ABI 1 - #endif - #endif -+#endif - - #if !defined(__GNUG__) || defined(_LIBCPP_VERSION) || defined(XTENSOR_GLIBCXX_USE_CXX11_ABI) - diff --git a/recipes/xtensor/all/patches/0.24.0-cxx11-abi.patch b/recipes/xtensor/all/patches/0.24.0-cxx11-abi.patch deleted file mode 100644 index b7c9e2acdedf0..0000000000000 --- a/recipes/xtensor/all/patches/0.24.0-cxx11-abi.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff --git a/include/xtensor/xutils.hpp b/include/xtensor/xutils.hpp -index ed8f2ea..ba7ccea 100644 ---- a/include/xtensor/xutils.hpp -+++ b/include/xtensor/xutils.hpp -@@ -637,11 +637,16 @@ namespace xt - * xtrivial_default_construct implemenation * - ********************************************/ - -+#if defined(_GLIBCXX_RELEASE) && _GLIBCXX_RELEASE >= 7 -+// has_trivial_default_constructor has not been available since libstdc++-7. -+#define XTENSOR_GLIBCXX_USE_CXX11_ABI 1 -+#else - #if defined(_GLIBCXX_USE_CXX11_ABI) - #if _GLIBCXX_USE_CXX11_ABI || (defined(_GLIBCXX_USE_DUAL_ABI) && !_GLIBCXX_USE_DUAL_ABI) - #define XTENSOR_GLIBCXX_USE_CXX11_ABI 1 - #endif - #endif -+#endif - - #if !defined(__GNUG__) || defined(_LIBCPP_VERSION) || defined(XTENSOR_GLIBCXX_USE_CXX11_ABI) - diff --git a/recipes/xtensor/config.yml b/recipes/xtensor/config.yml index 6237bf2c3ae5d..44984f8af502c 100644 --- a/recipes/xtensor/config.yml +++ b/recipes/xtensor/config.yml @@ -1,17 +1,11 @@ versions: - "0.24.2": + "0.25.0": folder: all - "0.24.0": + "0.24.7": folder: all - "0.23.10": + "0.24.6": folder: all - "0.23.9": + "0.23.10": folder: all "0.21.5": folder: all - "0.21.4": - folder: all - "0.21.3": - folder: all - "0.21.2": - folder: all diff --git a/recipes/xtl/all/conandata.yml b/recipes/xtl/all/conandata.yml index a693f0bb41b3b..de42ad34f303f 100644 --- a/recipes/xtl/all/conandata.yml +++ b/recipes/xtl/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "0.7.6": + url: "https://github.com/xtensor-stack/xtl/archive/0.7.6.tar.gz" + sha256: "dda442dc81f390f77561913062471c39b6ef19ffc6f64d3cd12b5c4b4607c957" + "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 +15,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..59f6a1275ac35 100644 --- a/recipes/xtl/config.yml +++ b/recipes/xtl/config.yml @@ -1,4 +1,8 @@ versions: + "0.7.6": + folder: all + "0.7.5": + folder: all "0.7.4": folder: all "0.7.3": diff --git a/recipes/xtr/all/conandata.yml b/recipes/xtr/all/conandata.yml index 73147ae073149..36f7c0c7ec615 100644 --- a/recipes/xtr/all/conandata.yml +++ b/recipes/xtr/all/conandata.yml @@ -1,13 +1,16 @@ sources: + "2.1.2": + url: "https://github.com/choll/xtr/archive/refs/tags/2.1.2.tar.gz" + sha256: "81ff3511e877db68882d01be9e521d317c8222838b0793e48cfd631f405bb3e8" + "2.1.1": + url: "https://github.com/choll/xtr/archive/refs/tags/2.1.1.tar.gz" + sha256: "dbd8d1fbb5308329fe21bbe704206e2e69a5d49696959d43a2504ea1bec00140" + "2.1.0": + url: "https://github.com/choll/xtr/archive/refs/tags/2.1.0.tar.gz" + sha256: "5abe2e53d91a893d63998968450d9bbfc23c45f552c81e2b7d17694699ab17c4" "2.0.1": url: "https://github.com/choll/xtr/archive/refs/tags/2.0.1.tar.gz" sha256: "92327264541900a2c9d43aaa3070d143d5e91879737fcea8cbf56065330af059" - "2.0.0": - url: "https://github.com/choll/xtr/archive/refs/tags/2.0.0.tar.gz" - sha256: "1d0113d3551e0d5f5b97228ba245d711c6b66a62a69d62bdf1b206fdf45edd41" "1.0.1": url: "https://github.com/choll/xtr/archive/refs/tags/1.0.1.tar.gz" sha256: "7cc5ec7a2d7d2979e33b928191def79dc05c8074f4c8bb76cd0a20d9b514be0c" - "1.0.0": - url: "https://github.com/choll/xtr/archive/refs/tags/1.0.0.tar.gz" - sha256: "c828883f3045762442fb8a69ed2633e523493a307a0cb2717ac0df93606db7fd" diff --git a/recipes/xtr/all/conanfile.py b/recipes/xtr/all/conanfile.py index 494c8ad3c65f3..d298982bf4d46 100644 --- a/recipes/xtr/all/conanfile.py +++ b/recipes/xtr/all/conanfile.py @@ -1,125 +1,161 @@ -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 check_min_cppstd +from conan.tools.cmake import CMakeToolchain, CMakeDeps, CMake +from conan.tools.files import copy, get, replace_in_file +from conan.tools.layout import basic_layout +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" + class XtrConan(ConanFile): name = "xtr" - description = \ - "C++ Logging Library for Low-latency or Real-time Environments" - topics = ("xtr", "logging", "logger") + description = "C++ Logging Library for Low-latency or Real-time Environments" + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/choll/xtr" - license = "MIT" + topics = ("logging", "logger") + + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { + "shared": [True, False], "fPIC": [True, False], "enable_exceptions": [True, False], "enable_lto": [True, False], "enable_io_uring": ["auto", True, False], "enable_io_uring_sqpoll": [True, False], - "sink_capacity_kb": "ANY" + "sink_capacity_kb": [None, "ANY"], } default_options = { + "shared": False, "fPIC": True, "enable_exceptions": True, "enable_lto": False, "enable_io_uring": "auto", "enable_io_uring_sqpoll": False, - "sink_capacity_kb": None + "sink_capacity_kb": None, } - generators = "make" + @property + def _min_cppstd(self): + return 20 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "10", + "clang": "12", + } + def config_options(self): - if tools.Version(self.version) < "1.0.1": - del self.options.sink_capacity_kb - if tools.Version(self.version) < "2.0.0": + if Version(self.version) >= "2.0.0" and self.settings.os == "Linux": + # Require liburing on any Linux system by default as a run-time check will be + # done to detect if the host kernel supports io_uring. + self.options.enable_io_uring = True + else: del self.options.enable_io_uring del self.options.enable_io_uring_sqpoll + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + basic_layout(self, src_folder="src") + def requirements(self): - self.requires("fmt/7.1.3") - # Require liburing on any Linux system as a run-time check will be - # done to detect if the host kernel supports io_uring. - if tools.Version(self.version) >= "2.0.0" and self.settings.os == "Linux" and self.options.get_safe("enable_io_uring"): - self.requires("liburing/2.1") + # INFO: https://github.com/choll/xtr/blob/2.1.0/include/xtr/detail/buffer.hpp#L27 + self.requires("fmt/10.1.1", transitive_headers=True, transitive_libs=True) + if self.options.get_safe("enable_io_uring"): + self.requires("liburing/2.4") def validate(self): - if self.settings.os not in ("FreeBSD", "Linux"): + if self.settings.os not in ["FreeBSD", "Linux"]: raise ConanInvalidConfiguration(f"Unsupported os={self.settings.os}") - if self.settings.compiler not in ("gcc", "clang"): - raise ConanInvalidConfiguration(f"Unsupported compiler={self.settings.compiler}") - if self.settings.arch not in ("x86_64", ): + if self.settings.arch not in ["x86_64"]: raise ConanInvalidConfiguration(f"Unsupported arch={self.settings.arch}") - if tools.Version(self.version) < "2.0.0" and self.settings.compiler == "clang" and self.settings.compiler.libcxx == "libc++": - raise ConanInvalidConfiguration(f"Use at least version 2.0.0 for libc++ compatibility") - if self.options.get_safe("enable_io_uring_sqpoll") and not self.options.get_safe("enable_io_uring"): - raise ConanInvalidConfiguration(f"io_uring must be enabled if io_uring_sqpoll is enabled") - if self.options.get_safe("sink_capacity_kb") and not str(self.options.get_safe("sink_capacity_kb")).isdigit(): - raise ConanInvalidConfiguration(f"The option 'sink_capacity_kb' must be an integer") - minimal_cpp_standard = 20 if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 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.") + if Version(self.version) < "2.0.0" and str(self.settings.compiler.libcxx) == "libc++": + raise ConanInvalidConfiguration("Use at least version 2.0.0 for libc++ compatibility") - minimum_version = {"gcc": 10, "clang": 12} - compiler = str(self.settings.compiler) - version = tools.Version(self.settings.compiler.version) + if self.options.get_safe("enable_io_uring_sqpoll") and not self.options.get_safe("enable_io_uring"): + raise ConanInvalidConfiguration("io_uring must be enabled if io_uring_sqpoll is enabled") + if self.options.get_safe("sink_capacity_kb") and not str(self.options.get_safe("sink_capacity_kb")).isdigit(): + raise ConanInvalidConfiguration("The option 'sink_capacity_kb' must be an integer") - if version < minimum_version[compiler]: - raise ConanInvalidConfiguration( - f"{self.name} requires {self.settings.compiler} version {minimum_version[compiler]} or later") + if Version(self.dependencies["fmt"].ref.version) < 6: + raise ConanInvalidConfiguration("The version of fmt must be >= 6.0.0") + if Version(self.dependencies["fmt"].ref.version) == "8.0.0" and self.settings.compiler == "clang": + raise ConanInvalidConfiguration("fmt/8.0.0 is known to not work with clang (https://github.com/fmtlib/fmt/issues/2377)") 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 get_defines(self): + def _get_defines(self): defines = [] enable_io_uring = self.options.get_safe("enable_io_uring") if enable_io_uring in (True, False): - defines += ["XTR_USE_IO_URING={}".format(int(bool(enable_io_uring)))] + defines += [f"XTR_USE_IO_URING={int(bool(enable_io_uring))}"] if self.options.get_safe("enable_io_uring_sqpoll"): defines += ["XTR_IO_URING_POLL=1"] capacity = self.options.get_safe("sink_capacity_kb") if capacity: - defines += ["XTR_SINK_CAPACITY={}".format(int(capacity) * 1024)] + defines += [f"XTR_SINK_CAPACITY={int(capacity) * 1024}"] return defines - def build(self): - # FIXME: should be done in validate (but version is not yet available there) - if tools.Version(self.deps_cpp_info["fmt"].version) < 6: - raise ConanInvalidConfiguration("The version of fmt must >= 6.0.0") - if tools.Version(self.deps_cpp_info["fmt"].version) == "8.0.0" and self.settings.compiler == "clang": - raise ConanInvalidConfiguration("fmt/8.0.0 is known to not work with clang (https://github.com/fmtlib/fmt/issues/2377)") + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["ENABLE_EXCEPTIONS"] = self.options.enable_exceptions + tc.cache_variables["ENABLE_LTO"] = self.options.enable_lto + tc.cache_variables["BUILD_SINGLE_HEADER"] = False + tc.cache_variables["BUILD_BENCHMARK"] = False + tc.cache_variables["BUILD_TESTING"] = False + tc.cache_variables["INSTALL_DOCS"] = False + tc.generate() + deps = CMakeDeps(self) + deps.generate() + + def _patch_sources(self): + if Version(self.version) >= "2.0.0": + # Ensure that liburing from Conan is used + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "find_package(liburing)", + "find_package(liburing REQUIRED NO_DEFAULT_PATH PATHS ${CMAKE_PREFIX_PATH})" + if self.options.get_safe("enable_io_uring") else + "") + if Version(self.version) < "2.1.2": + # Non-single header installation is broken until 2.1.2 + # https://github.com/choll/xtr/pull/4 + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + " PUBLIC_HEADER DESTINATION include)", + ")\ninstall(DIRECTORY ${CMAKE_SOURCE_DIR}/include/ DESTINATION include)") - autotools = AutoToolsBuildEnvironment(self) - env_build_vars = autotools.vars - # Conan uses LIBS, presumably following autotools conventions, while - # the XTR makefile follows GNU make conventions and uses LDLIBS - env_build_vars["LDLIBS"] = env_build_vars["LIBS"] - # fPIC and Release/Debug/RelWithDebInfo etc are set via CXXFLAGS, - # CPPFLAGS etc. - env_build_vars["EXCEPTIONS"] = \ - str(int(bool(self.options.enable_exceptions))) - env_build_vars["LTO"] = str(int(bool(self.options.enable_lto))) - env_build_vars["CXXFLAGS"] += "".join([" -D{}".format(d) for d in self.get_defines()]) - autotools.make(vars=env_build_vars) - autotools.make(vars=env_build_vars, target="xtrctl") + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() + cmake.build() def package(self): - self.copy("LICENSE", dst="licenses") - self.copy("*.hpp", src="include", dst="include") - self.copy("*/libxtr.a", src="build", dst="lib", keep_path=False) - self.copy("*/xtrctl", src="build", dst="bin", keep_path=False) - - tools.rmdir(os.path.join(self.package_folder, "man")) + 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 = ["xtr"] self.cpp_info.system_libs = ["pthread"] - self.cpp_info.defines = self.get_defines() + self.cpp_info.defines = self._get_defines() + + # TODO: Legacy, to be removed on Conan 2.0 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/xtr/all/test_package/CMakeLists.txt b/recipes/xtr/all/test_package/CMakeLists.txt index 921819122a4a1..3c2e1a85eb695 100644 --- a/recipes/xtr/all/test_package/CMakeLists.txt +++ b/recipes/xtr/all/test_package/CMakeLists.txt @@ -1,11 +1,9 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) set(CMAKE_CXX_STANDARD 20) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) -find_package(xtr REQUIRED) +find_package(xtr REQUIRED CONFIG) add_executable(${PROJECT_NAME} example.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE xtr::xtr) diff --git a/recipes/xtr/all/test_package/conanfile.py b/recipes/xtr/all/test_package/conanfile.py index 38f4483872d47..ef5d7042163ec 100644 --- a/recipes/xtr/all/test_package/conanfile.py +++ b/recipes/xtr/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/xtr/all/test_v1_package/CMakeLists.txt b/recipes/xtr/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/xtr/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/xtr/all/test_v1_package/conanfile.py b/recipes/xtr/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/xtr/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/xtr/config.yml b/recipes/xtr/config.yml index 066b0d5ac74d1..6712968772b74 100644 --- a/recipes/xtr/config.yml +++ b/recipes/xtr/config.yml @@ -1,9 +1,11 @@ versions: - "2.0.1": + "2.1.2": folder: all - "2.0.0": + "2.1.1": folder: all - "1.0.1": + "2.1.0": folder: all - "1.0.0": + "2.0.1": + folder: all + "1.0.1": folder: all diff --git a/recipes/xtrans/all/conanfile.py b/recipes/xtrans/all/conanfile.py index a420c87bd7d01..e9697205799d1 100644 --- a/recipes/xtrans/all/conanfile.py +++ b/recipes/xtrans/all/conanfile.py @@ -12,7 +12,7 @@ class XtransConan(ConanFile): 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 + settings = "os", "arch", "compiler", "build_type" topics = ("x11", "xorg") def validate(self): @@ -20,7 +20,9 @@ def validate(self): raise ConanInvalidConfiguration("This recipe supports only Linux and FreeBSD") def package_id(self): - self.info.header_only() + del self.info.settings.compiler + del self.info.settings.arch + del self.info.settings.build_type def system_requirements(self): apt = package_manager.Apt(self) diff --git a/recipes/xxhash/all/conandata.yml b/recipes/xxhash/all/conandata.yml index e7a7396a165a6..06fb02fd0ae83 100644 --- a/recipes/xxhash/all/conandata.yml +++ b/recipes/xxhash/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.8.2": + url: "https://github.com/Cyan4973/xxHash/archive/v0.8.2.tar.gz" + sha256: "baee0c6afd4f03165de7a4e67988d16f0f2b257b51d0e3cb91909302a26a79c4" "0.8.1": url: "https://github.com/Cyan4973/xxHash/archive/v0.8.1.tar.gz" sha256: "3bb6b7d6f30c591dd65aaaff1c8b7a5b94d81687998ca9400082c739a690436c" @@ -8,3 +11,9 @@ 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 7ce90e1beb92a..3e018a810c976 100644 --- a/recipes/xxhash/all/conanfile.py +++ b/recipes/xxhash/all/conanfile.py @@ -8,12 +8,12 @@ class XxHashConan(ConanFile): name = "xxhash" + description = "Extremely fast non-cryptographic hash algorithm" + license = "BSD-2-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/Cyan4973/xxHash" - description = "Extremely fast non-cryptographic hash algorithm" topics = ("hash", "algorithm", "fast", "checksum", "hash-functions") - license = "BSD-2-Clause" - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -43,8 +43,7 @@ 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/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/config.yml b/recipes/xxhash/config.yml index 20824a4afbb4d..50595ee5e4913 100644 --- a/recipes/xxhash/config.yml +++ b/recipes/xxhash/config.yml @@ -1,4 +1,6 @@ versions: + "0.8.2": + folder: all "0.8.1": folder: all "0.8.0": diff --git a/recipes/xxsds-sdsl-lite/all/conandata.yml b/recipes/xxsds-sdsl-lite/all/conandata.yml index b6d6545a3fc79..f215951543959 100644 --- a/recipes/xxsds-sdsl-lite/all/conandata.yml +++ b/recipes/xxsds-sdsl-lite/all/conandata.yml @@ -8,11 +8,7 @@ sources: patches: cci.20210329: - patch_file: patches/bits.hpp.patch - base_path: source_subfolder - patch_file: patches/util.hpp.patch - base_path: source_subfolder 3.0.0: - patch_file: patches/bits.hpp.patch - base_path: source_subfolder - patch_file: patches/util.hpp.patch - base_path: source_subfolder diff --git a/recipes/xxsds-sdsl-lite/all/conanfile.py b/recipes/xxsds-sdsl-lite/all/conanfile.py index de8842c0e754e..1b6126a2f3e15 100644 --- a/recipes/xxsds-sdsl-lite/all/conanfile.py +++ b/recipes/xxsds-sdsl-lite/all/conanfile.py @@ -1,46 +1,65 @@ import os -from conans import ConanFile, tools -required_conan_version = ">=1.33.0" +from conan import ConanFile +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 + +required_conan_version = ">=1.52.0" + class XXSDSSDSLLite(ConanFile): name = "xxsds-sdsl-lite" description = "SDSL - Succinct Data Structure Library" - homepage = "https://github.com/xxsds/sdsl-lite" - url = "https://github.com/conan-io/conan-center-index" license = "BSD-3-Clause" - topics = ("conan", "sdsl", "succint", "data-structures") - settings = "compiler" - exports_sources = "patches/*" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/xxsds/sdsl-lite" + topics = ("sdsl", "succint", "data-structures", "header-only") + + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True provides = "sdsl-lite" - @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.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) 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("*.hpp", dst="include", - src=os.path.join(self._source_subfolder, "include")) - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - - def package_id(self): - self.info.header_only() + copy(self, "*.hpp", + 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_info(self): - if self.settings.compiler == "Visual Studio": + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + self.cpp_info.set_property("cmake_file_name", "sdsl-lite") + self.cpp_info.set_property("cmake_target_name", "sdsl-lite::sdsl-lite") + self.cpp_info.set_property("pkg_config_name", "sdsl-lite") + + if is_msvc(self): self.cpp_info.defines.append("MSVC_COMPILER") - self.cpp_info.names["pkgconfig"] = "sdsl-lite" + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.names["cmake_find_package"] = "sdsl-lite" self.cpp_info.names["cmake_find_package_multi"] = "sdsl-lite" diff --git a/recipes/xxsds-sdsl-lite/all/test_package/CMakeLists.txt b/recipes/xxsds-sdsl-lite/all/test_package/CMakeLists.txt index 18fda057023dc..6b3bf7b3cbccb 100644 --- a/recipes/xxsds-sdsl-lite/all/test_package/CMakeLists.txt +++ b/recipes/xxsds-sdsl-lite/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.15) +project(test_package LANGUAGES CXX) find_package(sdsl-lite CONFIG REQUIRED) diff --git a/recipes/xxsds-sdsl-lite/all/test_package/conanfile.py b/recipes/xxsds-sdsl-lite/all/test_package/conanfile.py index 75634e62bcb66..fae501d0afb9e 100644 --- a/recipes/xxsds-sdsl-lite/all/test_package/conanfile.py +++ b/recipes/xxsds-sdsl-lite/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" + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/xxsds-sdsl-lite/all/test_v1_package/CMakeLists.txt b/recipes/xxsds-sdsl-lite/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/xxsds-sdsl-lite/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/xxsds-sdsl-lite/all/test_v1_package/conanfile.py b/recipes/xxsds-sdsl-lite/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..75634e62bcb66 --- /dev/null +++ b/recipes/xxsds-sdsl-lite/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +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/xz_utils/all/conandata.yml b/recipes/xz_utils/all/conandata.yml index c91700d02c91b..3274a9b4cdc21 100644 --- a/recipes/xz_utils/all/conandata.yml +++ b/recipes/xz_utils/all/conandata.yml @@ -1,7 +1,41 @@ sources: + "5.4.5": + url: + - "https://tukaani.org/xz/xz-5.4.5.tar.xz" + - "https://c3i.jfrog.io/artifactory/conan-center-backup-sources/da9dec6c12cf2ecf269c31ab65b5de18e8e52b96f35d5bcd08c12b43e6878803" + sha256: "da9dec6c12cf2ecf269c31ab65b5de18e8e52b96f35d5bcd08c12b43e6878803" + "5.4.4": + url: + - "https://tukaani.org/xz/xz-5.4.4.tar.gz" + - "https://c3i.jfrog.io/artifactory/conan-center-backup-sources/aae39544e254cfd27e942d35a048d592959bd7a79f9a624afb0498bb5613bdf8" + sha256: "aae39544e254cfd27e942d35a048d592959bd7a79f9a624afb0498bb5613bdf8" + "5.4.2": + url: + - "https://tukaani.org/xz/xz-5.4.2.tar.gz" + - "https://c3i.jfrog.io/artifactory/conan-center-backup-sources/87947679abcf77cc509d8d1b474218fd16b72281e2797360e909deaee1ac9d05" + sha256: "87947679abcf77cc509d8d1b474218fd16b72281e2797360e909deaee1ac9d05" + "5.4.0": + url: + - "https://tukaani.org/xz/xz-5.4.0.tar.gz" + - "https://c3i.jfrog.io/artifactory/conan-center-backup-sources/7471ef5991f690268a8f2be019acec2e0564b7b233ca40035f339fe9a07f830b" + sha256: "7471ef5991f690268a8f2be019acec2e0564b7b233ca40035f339fe9a07f830b" + "5.2.10": + url: + - "https://tukaani.org/xz/xz-5.2.10.tar.gz" + - "https://c3i.jfrog.io/artifactory/conan-center-backup-sources/eb7a3b2623c9d0135da70ca12808a214be9c019132baaa61c9e1d198d1d9ded3" + sha256: "eb7a3b2623c9d0135da70ca12808a214be9c019132baaa61c9e1d198d1d9ded3" "5.2.5": - url: "https://tukaani.org/xz/xz-5.2.5.tar.gz" + url: + - "https://tukaani.org/xz/xz-5.2.5.tar.gz" + - "https://c3i.jfrog.io/artifactory/conan-center-backup-sources/f6f4910fd033078738bd82bfba4f49219d03b17eb0794eb91efbae419f4aba10" sha256: "f6f4910fd033078738bd82bfba4f49219d03b17eb0794eb91efbae419f4aba10" "5.2.4": - url: "https://tukaani.org/xz/xz-5.2.4.tar.gz" + url: + - "https://tukaani.org/xz/xz-5.2.4.tar.gz" + - "https://c3i.jfrog.io/artifactory/conan-center-backup-sources/b512f3b726d3b37b6dc4c8570e137b9311e7552e8ccbab4d39d47ce5f4177145" 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 6c9f443898926..212eb51f593cc 100644 --- a/recipes/xz_utils/all/conanfile.py +++ b/recipes/xz_utils/all/conanfile.py @@ -1,19 +1,18 @@ from conan import ConanFile -from conan.errors import ConanException from conan.tools.apple import fix_apple_shared_install_name from conan.tools.env import VirtualBuildEnv -from conan.tools.files import collect_libs, copy, get, rename, replace_in_file, rm, rmdir, save +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, unix_path +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.52.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 " @@ -24,7 +23,7 @@ class XZUtils(ConanFile): homepage = "https://tukaani.org/xz" topics = ("lzma", "xz", "compression") license = "Unlicense", "LGPL-2.1-or-later", "GPL-2.0-or-later", "GPL-3.0-or-later" - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -48,125 +47,108 @@ def _effective_msbuild_type(self): "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" + + @property + def _use_msbuild(self): + assume_clang_cl = (self.settings.os == "Windows" + and self.settings.compiler == "clang" + and self.settings.get_safe("compiler.runtime") is not None) + return is_msvc(self) or assume_clang_cl + + 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 - 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 build_requirements(self): - if self._settings_build.os == "Windows" and not is_msvc(self): - if not self.conf.get("tools.microsoft.bash:path", default=False, check_type=bool): - self.tool_requires("msys2/cci.latest") + if self._settings_build.os == "Windows" and not self._use_msbuild: 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_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): - if is_msvc(self): + if self._use_msbuild: 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() - env = VirtualBuildEnv(self) - env.generate() - def _fix_msvc_platform_toolset(self, vcxproj_file, old_toolset): - platform_toolset = { - "Visual Studio": { - "8": "v80", - "9": "v90", - "10": "v100", - "11": "v110", - "12": "v120", - "14": "v140", - "15": "v141", - "16": "v142", - "17": "v143", - }, - "msvc": { - "170": "v110", - "180": "v120", - "190": "v140", - "191": "v141", - "192": "v142", - "193": "v143", - } - }.get(str(self.settings.compiler), {}).get(str(self.settings.compiler.version)) - if not platform_toolset: - raise ConanException( - f"Unkown platform toolset for {self.settings.compiler} {self.settings.compiler.version}", - ) - replace_in_file( - self, - vcxproj_file, - f"{old_toolset}", - f"{platform_toolset}", - ) + @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): - if Version(self.version) == "5.2.4": - # Relax Windows SDK restriction - # Workaround is required only for 5.2.4 because since 5.2.5 WindowsTargetPlatformVersion is dropped from vcproj file - # https://developercommunity.visualstudio.com/content/problem/140294/windowstargetplatformversion-makes-it-impossible-t.html - windows_target_platform_version_old = "10.0.15063.0" - replace_in_file(self, os.path.join(self.source_folder, "windows", "vs2017", "liblzma.vcxproj"), - windows_target_platform_version_old, "") - replace_in_file(self, os.path.join(self.source_folder, "windows", "vs2017", "liblzma_dll.vcxproj"), - windows_target_platform_version_old, "") - - # TODO: Find a way to inject conantoolchain.props content from MSBuildToolchain - # For the moment all the logic below is a big trick & doesn't honor custom cflags, cxxflags & ldflags from profile - # and arch different than x86 & x86_64 - - # windows\INSTALL-MSVC.txt - if (self.settings.compiler == "Visual Studio" and Version(self.settings.compiler) >= "15") or \ - (self.settings.compiler == "msvc" and Version(self.settings.compiler) >= "191"): - msvc_version = "vs2017" + 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: - msvc_version = "vs2013" old_toolset = "v120" - build_script_folder = os.path.join(self.source_folder, "windows", msvc_version) - - # TODO: replace by some conan helper function (https://github.com/conan-io/conan/issues/12155)? - liblzma_vcxproj = os.path.join(build_script_folder, "liblzma.vcxproj") - liblzma_dll_vcxproj = os.path.join(build_script_folder, "liblzma_dll.vcxproj") - self._fix_msvc_platform_toolset(liblzma_vcxproj, old_toolset) - self._fix_msvc_platform_toolset(liblzma_dll_vcxproj, old_toolset) + 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"", + ) + + if self.settings.arch == "armv8": + replace_in_file(self, vcxproj_file, "x64", "ARM64") + + solution_file = os.path.join(build_script_folder, "xz_win.sln") + if self.settings.arch == "armv8": + replace_in_file(self, solution_file, "x64", "ARM64") - # Patch Debug configuration if runtime is MT since there is no DebugMT configuration in upstream vcxproj - if self.settings.build_type == "Debug" and is_msvc_static_runtime(self): - replace_in_file(self, liblzma_vcxproj, "MultiThreadedDebugDLL", "MultiThreadedDebug") - replace_in_file(self, liblzma_dll_vcxproj, "MultiThreadedDebugDLL", "MultiThreadedDebug") + #============================== - target = "liblzma_dll" if self.options.shared else "liblzma" 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=[target]) + msbuild.build(os.path.join(build_script_folder, solution_file), targets=[self._msbuild_target]) def build(self): - if is_msvc(self): + apply_conandata_patches(self) + if self._use_msbuild: self._build_msvc() else: autotools = Autotools(self) @@ -175,27 +157,17 @@ def build(self): def package(self): copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) - if is_msvc(self): + if self._use_msbuild: 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"), keep_path=True) - arch = {"x86": "Win32", "x86_64": "x64"}.get(str(self.settings.arch)) - target = "liblzma_dll" if self.options.shared else "liblzma" - if (self.settings.compiler == "Visual Studio" and Version(self.settings.compiler) >= "15") or \ - (self.settings.compiler == "msvc" and Version(self.settings.compiler) >= "191"): - msvc_version = "vs2017" - else: - msvc_version = "vs2013" - bin_dir = os.path.join(self.source_folder, "windows", msvc_version, - self._effective_msbuild_type, arch, target) - copy(self, "*.lib", src=bin_dir, dst=os.path.join(self.package_folder, "lib"), keep_path=False) - if self.options.shared: - copy(self, "*.dll", src=bin_dir, dst=os.path.join(self.package_folder, "bin"), keep_path=False) + 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 = 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)}"]) + 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")) @@ -232,14 +204,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 = 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 72a4496088dd7..cd4e960a3ff01 100644 --- a/recipes/xz_utils/all/test_package/CMakeLists.txt +++ b/recipes/xz_utils/all/test_package/CMakeLists.txt @@ -18,7 +18,7 @@ set(_custom_vars LIBLZMA_VERSION_STRING ) foreach(_custom_var ${_custom_vars}) - if(DEFINED _custom_var) + if(DEFINED ${_custom_var}) message(STATUS "${_custom_var}: ${${_custom_var}}") else() message(FATAL_ERROR "${_custom_var} not defined") diff --git a/recipes/xz_utils/all/test_v1_package/CMakeLists.txt b/recipes/xz_utils/all/test_v1_package/CMakeLists.txt index 971f2caf78d9a..0d20897301b68 100644 --- a/recipes/xz_utils/all/test_v1_package/CMakeLists.txt +++ b/recipes/xz_utils/all/test_v1_package/CMakeLists.txt @@ -1,29 +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(LibLZMA REQUIRED) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -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() +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/xz_utils/config.yml b/recipes/xz_utils/config.yml index 4afb08d7749cb..d950dab72f7d0 100644 --- a/recipes/xz_utils/config.yml +++ b/recipes/xz_utils/config.yml @@ -1,4 +1,14 @@ versions: + "5.4.5": + folder: all + "5.4.4": + folder: all + "5.4.2": + folder: all + "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..49364fbee5eed --- /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, cmake_layout +from conan.tools.files import copy, get, export_conandata_patches, apply_conandata_patches, save +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") + package_type = "static-library" + 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 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"): + 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 generate(self): + tc = CMakeToolchain(self) + tc.variables["YACLIB_INSTALL"] = True + cppstd = self.settings.compiler.get_safe("cppstd") + if cppstd: + tc.variables["YACLIB_CXX_STANDARD"] = str(cppstd).replace("gnu", "") + + 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 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..22642ac137bfa --- /dev/null +++ b/recipes/yaclib/all/test_v1_package/conanfile.py @@ -0,0 +1,16 @@ +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/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/yajl/all/conandata.yml b/recipes/yajl/all/conandata.yml new file mode 100644 index 0000000000000..423a49f097b2a --- /dev/null +++ b/recipes/yajl/all/conandata.yml @@ -0,0 +1,9 @@ +sources: + "2.1.0": + url: "https://github.com/lloyd/yajl/archive/refs/tags/2.1.0.tar.gz" + sha256: "3fb73364a5a30efe615046d07e6db9d09fd2b41c763c5f7d3bfb121cd5c5ac5a" +patches: + "2.1.0": + - patch_file: "patches/2.1.0-0001-fix-cmake.patch" + patch_description: "CMake: fix mingw, disable build of doc/test/perf/example, relocatable shared lib for macos, install DLL into bin folder" + patch_type: "conan" diff --git a/recipes/yajl/all/conanfile.py b/recipes/yajl/all/conanfile.py new file mode 100644 index 0000000000000..0ce7fb086eb0d --- /dev/null +++ b/recipes/yajl/all/conanfile.py @@ -0,0 +1,74 @@ +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 +import os + +required_conan_version = ">=1.53.0" + + +class YAJLConan(ConanFile): + name = "yajl" + description = "A fast streaming JSON parsing library in C" + license = "ISC" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/lloyd/yajl" + topics = ("json", "encoding", "decoding", "manipulation") + 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") + 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) + tc.generate() + + 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() + rmdir(self, os.path.join(self.package_folder, "share")) + # Keep either shared or static lib depending on shared option + if self.options.shared: + rm(self, "*yajl_s.*", os.path.join(self.package_folder, "lib")) + else: + rm(self, "*yajl.*", os.path.join(self.package_folder, "bin")) + rm(self, "*yajl.*", os.path.join(self.package_folder, "lib")) + + def package_info(self): + self.cpp_info.libs = ["yajl"] if self.options.shared else ["yajl_s"] + if self.options.shared: + self.cpp_info.defines.append("YAJL_SHARED") + + # https://github.com/lloyd/yajl/blob/5e3a7856e643b4d6410ddc3f84bc2f38174f2872/src/CMakeLists.txt#L64 + self.cpp_info.set_property("pkg_config_name", "yajl") diff --git a/recipes/yajl/all/patches/2.1.0-0001-fix-cmake.patch b/recipes/yajl/all/patches/2.1.0-0001-fix-cmake.patch new file mode 100644 index 0000000000000..3ef6d80c27339 --- /dev/null +++ b/recipes/yajl/all/patches/2.1.0-0001-fix-cmake.patch @@ -0,0 +1,85 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -12,7 +12,10 @@ + # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +-CMAKE_MINIMUM_REQUIRED(VERSION 2.6) ++CMAKE_MINIMUM_REQUIRED(VERSION 3.15) ++if(POLICY CMP0026) ++ cmake_policy(SET CMP0026 OLD) ++endif() + + PROJECT(YetAnotherJSONParser C) + +@@ -26,6 +29,7 @@ IF (NOT CMAKE_BUILD_TYPE) + SET(CMAKE_BUILD_TYPE "Release") + ENDIF (NOT CMAKE_BUILD_TYPE) + ++if(0) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") + + IF (WIN32) +@@ -61,16 +65,13 @@ ELSE (WIN32) + SET(CMAKE_C_FLAGS_DEBUG "-DDEBUG -g") + SET(CMAKE_C_FLAGS_RELEASE "-DNDEBUG -O2 -Wuninitialized") + ENDIF (WIN32) ++endif() + + + ADD_SUBDIRECTORY(src) +-ADD_SUBDIRECTORY(test) + ADD_SUBDIRECTORY(reformatter) + ADD_SUBDIRECTORY(verify) +-ADD_SUBDIRECTORY(example) +-ADD_SUBDIRECTORY(perf) + +-INCLUDE(YAJLDoc.cmake) + + # a test target + ADD_CUSTOM_TARGET(test +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -25,7 +25,6 @@ SET (PUB_HDRS api/yajl_parse.h api/yajl_gen.h api/yajl_common.h api/yajl_tree.h) + # Ensure defined when building YAJL (as opposed to using it from + # another project). Used to ensure correct function export when + # building win32 DLL. +-ADD_DEFINITIONS(-DYAJL_BUILD) + + # set up some paths + SET (libDir ${CMAKE_CURRENT_BINARY_DIR}/../${YAJL_DIST_NAME}/lib) +@@ -37,20 +36,19 @@ SET(LIBRARY_OUTPUT_PATH ${libDir}) + + ADD_LIBRARY(yajl_s STATIC ${SRCS} ${HDRS} ${PUB_HDRS}) + ++target_compile_features(yajl_s PRIVATE c_std_99) + ADD_LIBRARY(yajl SHARED ${SRCS} ${HDRS} ${PUB_HDRS}) ++target_compile_features(yajl PRIVATE c_std_99) ++target_compile_definitions(yajl PUBLIC YAJL_SHARED) + + #### setup shared library version number + SET_TARGET_PROPERTIES(yajl PROPERTIES +- DEFINE_SYMBOL YAJL_SHARED ++ DEFINE_SYMBOL YAJL_BUILD ++ C_VISIBILITY_PRESET hidden + SOVERSION ${YAJL_MAJOR} + VERSION ${YAJL_MAJOR}.${YAJL_MINOR}.${YAJL_MICRO}) + + #### ensure a .dylib has correct absolute installation paths upon installation +-IF(APPLE) +- MESSAGE("INSTALL_NAME_DIR: ${CMAKE_INSTALL_PREFIX}/lib") +- SET_TARGET_PROPERTIES(yajl PROPERTIES +- INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib") +-ENDIF(APPLE) + + #### build up an sdk as a post build step + +@@ -78,7 +76,7 @@ INCLUDE_DIRECTORIES(${incDir}/..) + # at build time you may specify the cmake variable LIB_SUFFIX to handle + # 64-bit systems which use 'lib64' + INSTALL(TARGETS yajl +- RUNTIME DESTINATION lib${LIB_SUFFIX} ++ RUNTIME DESTINATION bin + LIBRARY DESTINATION lib${LIB_SUFFIX} + ARCHIVE DESTINATION lib${LIB_SUFFIX}) + INSTALL(TARGETS yajl_s ARCHIVE DESTINATION lib${LIB_SUFFIX}) diff --git a/recipes/yajl/all/test_package/CMakeLists.txt b/recipes/yajl/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..c1ab399f3fa7c --- /dev/null +++ b/recipes/yajl/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) + +project(test_package C) + +find_package(yajl REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE yajl::yajl) diff --git a/recipes/yajl/all/test_package/conanfile.py b/recipes/yajl/all/test_package/conanfile.py new file mode 100644 index 0000000000000..ef5d7042163ec --- /dev/null +++ b/recipes/yajl/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/yajl/all/test_package/test_package.c b/recipes/yajl/all/test_package/test_package.c new file mode 100644 index 0000000000000..9a2af8a9d4996 --- /dev/null +++ b/recipes/yajl/all/test_package/test_package.c @@ -0,0 +1,19 @@ +#include +#include +#include +#include + +#define CHK(x) if (x != yajl_gen_status_ok) return 1; + +int main(void) { + printf("Welcome to YAJL v%d.%d.%d!", YAJL_MAJOR, YAJL_MINOR, YAJL_MICRO); + yajl_gen yg; + yajl_gen_status s; + + yg = yajl_gen_alloc(NULL); + CHK(yajl_gen_map_open(yg)); + CHK(yajl_gen_map_close(yg)); + s = yajl_gen_map_close(yg); + + return yajl_gen_generation_complete == s ? EXIT_SUCCESS : EXIT_FAILURE; +} diff --git a/recipes/yajl/all/test_v1_package/CMakeLists.txt b/recipes/yajl/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/yajl/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/yajl/all/test_v1_package/conanfile.py b/recipes/yajl/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..c492184eec19c --- /dev/null +++ b/recipes/yajl/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/yajl/config.yml b/recipes/yajl/config.yml new file mode 100644 index 0000000000000..dfff490f9a9b6 --- /dev/null +++ b/recipes/yajl/config.yml @@ -0,0 +1,3 @@ +versions: + "2.1.0": + folder: all diff --git a/recipes/yaml-cpp/all/conandata.yml b/recipes/yaml-cpp/all/conandata.yml index 59546f980c76e..542de368538ce 100644 --- a/recipes/yaml-cpp/all/conandata.yml +++ b/recipes/yaml-cpp/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.8.0": + url: "https://github.com/jbeder/yaml-cpp/archive/refs/tags/0.8.0.tar.gz" + sha256: "fbe74bbdcee21d656715688706da3c8becfd946d92cd44705cc6098bb23b3a16" "0.7.0": url: "https://github.com/jbeder/yaml-cpp/archive/yaml-cpp-0.7.0.tar.gz" sha256: "43e6a9fcb146ad871515f0d0873947e5d497a1c9c60c58cb102a97b47208b7c3" @@ -8,4 +11,10 @@ sources: patches: "0.7.0": - patch_file: "patches/0001-install-0.7.0.patch" + patch_description: "trigger installation through add_subdirectory from another CMakeLists.txt" + patch_type: "conan" + patch_source: "https://github.com/jbeder/yaml-cpp/pull/847" - patch_file: "patches/0002-libcxx-and-gcc.patch" + patch_description: "Adds assert to enable compilation with libcxx + gcc" + patch_type: "portability" + patch_source: "https://github.com/jbeder/yaml-cpp/pull/947" diff --git a/recipes/yaml-cpp/all/conanfile.py b/recipes/yaml-cpp/all/conanfile.py index 50438ad9166b4..29c95c5649acc 100644 --- a/recipes/yaml-cpp/all/conanfile.py +++ b/recipes/yaml-cpp/all/conanfile.py @@ -4,6 +4,7 @@ from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout 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 +from conan.tools.scm import Version import os import textwrap @@ -17,6 +18,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], @@ -38,20 +40,19 @@ 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: + 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) @@ -103,15 +104,20 @@ def _module_file_rel_path(self): def package_info(self): self.cpp_info.set_property("cmake_file_name", "yaml-cpp") - self.cpp_info.set_property("cmake_target_name", "yaml-cpp") + self.cpp_info.set_property("cmake_target_name", "yaml-cpp::yaml-cpp") + self.cpp_info.set_property("cmake_target_aliases", ["yaml-cpp"]) # CMake imported target before 0.8.0 self.cpp_info.set_property("pkg_config_name", "yaml-cpp") self.cpp_info.libs = collect_libs(self) if self.settings.os in ("Linux", "FreeBSD"): self.cpp_info.system_libs.append("m") if is_msvc(self): self.cpp_info.defines.append("_NOEXCEPT=noexcept") - if self.options.shared: + if Version(self.version) < "0.8.0": + if self.settings.os == "Windows" and self.options.shared: self.cpp_info.defines.append("YAML_CPP_DLL") + else: + if not self.options.shared: + self.cpp_info.defines.append("YAML_CPP_STATIC_DEFINE") # 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/yaml-cpp/all/test_package/CMakeLists.txt b/recipes/yaml-cpp/all/test_package/CMakeLists.txt index 1872344e829cb..293d6d71bbc1c 100644 --- a/recipes/yaml-cpp/all/test_package/CMakeLists.txt +++ b/recipes/yaml-cpp/all/test_package/CMakeLists.txt @@ -4,5 +4,5 @@ project(test_package LANGUAGES CXX) find_package(yaml-cpp REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE yaml-cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE yaml-cpp::yaml-cpp) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/yaml-cpp/all/test_package/conanfile.py b/recipes/yaml-cpp/all/test_package/conanfile.py index 836780b694c10..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 @@ -9,18 +9,18 @@ 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() 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/config.yml b/recipes/yaml-cpp/config.yml index ecd70890a4473..3ad5266d60fe2 100644 --- a/recipes/yaml-cpp/config.yml +++ b/recipes/yaml-cpp/config.yml @@ -1,4 +1,6 @@ versions: + "0.8.0": + folder: all "0.7.0": folder: all "0.6.3": diff --git a/recipes/yandex-ozo/all/conandata.yml b/recipes/yandex-ozo/all/conandata.yml index 721b757b4db38..4d72913a6563c 100644 --- a/recipes/yandex-ozo/all/conandata.yml +++ b/recipes/yandex-ozo/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.1.0": + url: "https://github.com/yandex/ozo/archive/refs/tags/v0.1.0.tar.gz" + sha256: "bf4f07c8105f9d5ccf0eebf88d3e33ee440b5668493f63e62de2cd184e80b39a" "cci.20210509": url: "https://github.com/yandex/ozo/archive/1b06a00ec3cea09108557bbec71cc7a6455dfb6b.tar.gz" - sha256: 97eaa2145be4366c390762e8a4d63e507e8be02a37f2c50e5ba0104a1ca192ee + sha256: "97eaa2145be4366c390762e8a4d63e507e8be02a37f2c50e5ba0104a1ca192ee" diff --git a/recipes/yandex-ozo/all/conanfile.py b/recipes/yandex-ozo/all/conanfile.py index 109eee16dc1f2..4da522edd42b6 100644 --- a/recipes/yandex-ozo/all/conanfile.py +++ b/recipes/yandex-ozo/all/conanfile.py @@ -1,26 +1,30 @@ -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration -from conans.tools import check_min_cppstd, Version import os -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.files import copy, get +from conan.tools.layout import basic_layout +from conan.tools.scm import Version + +required_conan_version = ">=1.52.0" class YandexOzoConan(ConanFile): name = "yandex-ozo" description = "C++ header-only library for asynchronous access to PostgreSQL databases using ASIO" - topics = ("ozo", "yandex", "postgres", "postgresql", "cpp17", "database", "db", "asio") + license = "PostgreSQL" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/yandex/ozo" - license = "PostgreSQL" + topics = ("ozo", "yandex", "postgres", "postgresql", "cpp17", "database", "db", "asio", "header-only") - settings = "os", "compiler" - requires = ("boost/1.76.0", "resource_pool/cci.20210322", "libpq/13.2") + package_type = "header-library" + 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): @@ -31,15 +35,26 @@ def _compilers_minimum_version(self): "apple-clang": "10", } + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("boost/1.79.0") + self.requires("resource_pool/cci.20210322") + self.requires("libpq/15.4") + + def package_id(self): + self.info.clear() + def _validate_compiler_settings(self): compiler = self.settings.compiler if compiler.get_safe("cppstd"): - check_min_cppstd(self, "17") + 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("ozo requires C++17. Your compiler is unknown. Assuming it supports C++17.") - elif tools.Version(self.settings.compiler.version) < minimum_version: + self.output.warning("ozo requires C++17. Your compiler is unknown. Assuming it supports C++17.") + elif Version(self.settings.compiler.version) < minimum_version: raise ConanInvalidConfiguration("ozo requires a compiler that supports at least C++17") def validate(self): @@ -49,38 +64,37 @@ def validate(self): self._validate_compiler_settings() 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="*", dst=os.path.join("include", "ozo"), src=os.path.join(self._source_subfolder, "include", "ozo")) - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - - def package_id(self): - self.info.header_only() + copy(self, "*.h", + dst=os.path.join(self.package_folder, "include", "ozo"), + src=os.path.join(self.source_folder, "include", "ozo")) + copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.frameworkdirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] + main_comp = self.cpp_info.components["_ozo"] - main_comp.requires = [ - "boost::boost", "boost::system", "boost::thread", "boost::coroutine", - "resource_pool::resource_pool", - "libpq::pq", - ] - main_comp.defines = [ - "BOOST_HANA_CONFIG_ENABLE_STRING_UDL", - "BOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT", - ] - main_comp.names["cmake_find_package"] = "ozo" - main_comp.names["cmake_find_package_multi"] = "ozo" + main_comp.requires = ["boost::boost", "boost::system", "boost::thread", "boost::coroutine", "resource_pool::resource_pool", "libpq::pq"] + main_comp.defines = ["BOOST_HANA_CONFIG_ENABLE_STRING_UDL", "BOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT"] + main_comp.set_property("cmake_target_name", "yandex::ozo") compiler = self.settings.compiler version = Version(compiler.version) if compiler == "clang" or compiler == "apple-clang" or (compiler == "gcc" and version >= 9): - main_comp.cxxflags = [ - "-Wno-gnu-string-literal-operator-template", - "-Wno-gnu-zero-variadic-macro-arguments", - ] + main_comp.cxxflags = ["-Wno-gnu-string-literal-operator-template", "-Wno-gnu-zero-variadic-macro-arguments"] + self.cpp_info.set_property("cmake_file_name", "ozo") + self.cpp_info.set_property("cmake_target_name", "yandex::ozo") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.filenames["cmake_find_package"] = "ozo" self.cpp_info.filenames["cmake_find_package_multi"] = "ozo" self.cpp_info.names["cmake_find_package"] = "yandex" self.cpp_info.names["cmake_find_package_multi"] = "yandex" + main_comp.names["cmake_find_package"] = "ozo" + main_comp.names["cmake_find_package_multi"] = "ozo" diff --git a/recipes/yandex-ozo/all/test_package/CMakeLists.txt b/recipes/yandex-ozo/all/test_package/CMakeLists.txt index 3b7c3844b7820..c6f6cbeee93dc 100644 --- a/recipes/yandex-ozo/all/test_package/CMakeLists.txt +++ b/recipes/yandex-ozo/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.15) project(PackageTest CXX) find_package(ozo REQUIRED CONFIG) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - add_executable(example request.cpp) target_compile_features(example PRIVATE cxx_std_17) target_link_libraries(example PRIVATE yandex::ozo) diff --git a/recipes/yandex-ozo/all/test_package/conanfile.py b/recipes/yandex-ozo/all/test_package/conanfile.py index a614ddb69f634..8d52b7021efe1 100644 --- a/recipes/yandex-ozo/all/test_package/conanfile.py +++ b/recipes/yandex-ozo/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 YandexOzoTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake_find_package_multi", "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.bindir, "example") + self.run(bin_path, env="conanrun") diff --git a/recipes/yandex-ozo/all/test_v1_package/CMakeLists.txt b/recipes/yandex-ozo/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/yandex-ozo/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/yandex-ozo/all/test_v1_package/conanfile.py b/recipes/yandex-ozo/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..a614ddb69f634 --- /dev/null +++ b/recipes/yandex-ozo/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +import os +from conans import ConanFile, CMake, tools + + +class YandexOzoTestConan(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.settings): + bin_path = os.path.join("bin", "example") + self.run(bin_path, run_environment=True) diff --git a/recipes/yandex-ozo/config.yml b/recipes/yandex-ozo/config.yml index c03d35124053d..351234e35c85a 100644 --- a/recipes/yandex-ozo/config.yml +++ b/recipes/yandex-ozo/config.yml @@ -1,3 +1,5 @@ versions: + "0.1.0": + folder: all "cci.20210509": - folder: "all" + folder: all diff --git a/recipes/yas/all/conanfile.py b/recipes/yas/all/conanfile.py index 8cfe2a15884cf..4b089cd3a4efe 100644 --- a/recipes/yas/all/conanfile.py +++ b/recipes/yas/all/conanfile.py @@ -1,39 +1,53 @@ -from conans import ConanFile, tools import os -required_conan_version = ">=1.33.0" +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get, load, save +from conan.tools.layout import basic_layout + +required_conan_version = ">=1.52.0" class YasConan(ConanFile): name = "yas" description = "Yet Another Serialization" - topics = ("yas", "serialization", "header-only") + license = "BSL-1.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/niXman/yas" - license = "BSL-1.0" + topics = ("serialization", "header-only") + + package_type = "header-library" + 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], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def _extract_license(self): - header = tools.load(os.path.join( - self.source_folder, self._source_subfolder, - "include", "yas", "binary_oarchive.hpp")) - license_contents = header[:header.find("#")] \ - .replace("//", "").replace("\n ", "\n").lstrip() - tools.save("LICENSE", license_contents) + header = load(self, os.path.join(self.source_folder, "include", "yas", "binary_oarchive.hpp")) + license_contents = header[: header.find("#")].replace("//", "").replace("\n ", "\n").lstrip() + save(self, os.path.join(self.package_folder, "licenses", "LICENSE"), license_contents) def package(self): self._extract_license() - self.copy("LICENSE", dst="licenses") - self.copy("*", src=os.path.join(self._source_subfolder, "include"), - dst="include") + copy(self, "*", + 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/yas/all/test_package/CMakeLists.txt b/recipes/yas/all/test_package/CMakeLists.txt index 641059df6fa46..31c7068ad2a4f 100644 --- a/recipes/yas/all/test_package/CMakeLists.txt +++ b/recipes/yas/all/test_package/CMakeLists.txt @@ -1,10 +1,9 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) set(CMAKE_CXX_STANDARD 11) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(yas REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE yas::yas) diff --git a/recipes/yas/all/test_package/conanfile.py b/recipes/yas/all/test_package/conanfile.py index bd7165a553cf4..ef5d7042163ec 100644 --- a/recipes/yas/all/test_package/conanfile.py +++ b/recipes/yas/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/yas/all/test_v1_package/CMakeLists.txt b/recipes/yas/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/yas/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/yas/all/test_v1_package/conanfile.py b/recipes/yas/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..7e2dfe859bb27 --- /dev/null +++ b/recipes/yas/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/yasm/all/conanfile.py b/recipes/yasm/all/conanfile.py index 9c0aa2e39df15..7e50843bcd47e 100644 --- a/recipes/yasm/all/conanfile.py +++ b/recipes/yasm/all/conanfile.py @@ -4,14 +4,15 @@ 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, unix_path +from conan.tools.microsoft import is_msvc import os -required_conan_version = ">=1.52.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" @@ -27,14 +28,8 @@ def export_sources(self): export_conandata_patches(self) 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): if is_msvc(self): @@ -48,7 +43,7 @@ def package_id(self): 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", default=False, check_type=bool): + if not self.conf.get("tools.microsoft.bash:path", check_type=str): self.tool_requires("msys2/cci.latest") def source(self): @@ -104,8 +99,7 @@ def package(self): rmdir(self, os.path.join(self.package_folder, "lib")) else: 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)}"]) + autotools.install() rmdir(self, os.path.join(self.package_folder, "share")) rmdir(self, os.path.join(self.package_folder, "lib")) diff --git a/recipes/yasm/all/test_package/conanfile.py b/recipes/yasm/all/test_package/conanfile.py index df63a750624da..9f19c7186d640 100644 --- a/recipes/yasm/all/test_package/conanfile.py +++ b/recipes/yasm/all/test_package/conanfile.py @@ -1,15 +1,13 @@ from conan import ConanFile -from conan.tools.build import can_run class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "VirtualRunEnv" + generators = "VirtualBuildEnv" test_type = "explicit" - def requirements(self): - self.requires(self.tested_reference_str) + def build_requirements(self): + self.tool_requires(self.tested_reference_str) def test(self): - if can_run(self): - self.run("yasm --help", env="conanrun") + self.run("yasm --help") diff --git a/recipes/ydcpp-tcpcat/all/conandata.yml b/recipes/ydcpp-tcpcat/all/conandata.yml new file mode 100644 index 0000000000000..93679778e120e --- /dev/null +++ b/recipes/ydcpp-tcpcat/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.0.4": + url: "https://github.com/ydcpp/tcpcat/archive/refs/tags/1.0.4.tar.gz" + sha256: "3413e74eab0a1bf7927b747e393b1931e8a516ee769642ce89c558a93e00e38b" diff --git a/recipes/ydcpp-tcpcat/all/conanfile.py b/recipes/ydcpp-tcpcat/all/conanfile.py new file mode 100644 index 0000000000000..ff79b54fa821b --- /dev/null +++ b/recipes/ydcpp-tcpcat/all/conanfile.py @@ -0,0 +1,95 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMakeToolchain, CMake, CMakeDeps, cmake_layout +from conan.tools.microsoft import is_msvc +from conan.tools.files import copy, get +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +import os + + +class TcpcatConan(ConanFile): + name = "ydcpp-tcpcat" + + # Optional metadata + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/ydcpp/tcpcat" + description = "Simple C++ TCP Server and Client library." + topics = ("network", "tcp", "tcp-server", "tcp-client") + + # Binary configuration + package_type = "library" + settings = "os", "compiler", "build_type", "arch" + 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 { + "gcc": "7", + "Visual Studio": "16", + "msvc": "192", + "clang": "7", + "apple-clang": "12" + } + + 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 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) + + # Upstream meant to support Windows Shared builds, but they don't currently export any symbols + # Disable for now until fixed. As this is an upstream issue they want fixed, we don't set + # package_type = "static-library" in the configure() method so that users have a clear message error for now + if is_msvc(self) and self.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} does not currently support Windows shared builds due to an upstream issue") + + 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 requirements(self): + self.requires("asio/1.30.2", transitive_headers = True) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + deps = CMakeDeps(self) + deps.generate() + tc = CMakeToolchain(self) + 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")) + copy(self, "*", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) + cmake = CMake(self) + cmake.install() + + def package_info(self): + self.cpp_info.libs = ["ydcpp-tcpcat"] + self.cpp_info.set_property("cmake_target_name", "ydcpp-tcpcat") + if self.settings.os in ("Linux", "FreeBSD"): + self.cpp_info.system_libs.append("m") diff --git a/recipes/ydcpp-tcpcat/all/test_package/CMakeLists.txt b/recipes/ydcpp-tcpcat/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..0be8339e35258 --- /dev/null +++ b/recipes/ydcpp-tcpcat/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(PackageTest CXX) + +add_executable(test_package test_package.cpp) + +find_package(ydcpp-tcpcat CONFIG REQUIRED) +target_link_libraries(test_package ydcpp-tcpcat) +target_compile_features(test_package PRIVATE cxx_std_17) diff --git a/recipes/ydcpp-tcpcat/all/test_package/conanfile.py b/recipes/ydcpp-tcpcat/all/test_package/conanfile.py new file mode 100644 index 0000000000000..806fd5ae2a792 --- /dev/null +++ b/recipes/ydcpp-tcpcat/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 tcpcatTestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "CMakeDeps", "CMakeToolchain" + + 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 can_run(self): + cmd = os.path.join(self.cpp.build.bindir, "test_package") + self.run(cmd, env="conanrun") diff --git a/recipes/ydcpp-tcpcat/all/test_package/test_package.cpp b/recipes/ydcpp-tcpcat/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..aa337b33b0be6 --- /dev/null +++ b/recipes/ydcpp-tcpcat/all/test_package/test_package.cpp @@ -0,0 +1,11 @@ +#include + +#include +#include + +int main() +{ + tcpcat::TcpSession session(nullptr, nullptr, 0); + std::cout << "session id: " << session.GetId() << std::endl; + return 0; +} diff --git a/recipes/ydcpp-tcpcat/config.yml b/recipes/ydcpp-tcpcat/config.yml new file mode 100644 index 0000000000000..c20e44b006f1a --- /dev/null +++ b/recipes/ydcpp-tcpcat/config.yml @@ -0,0 +1,3 @@ +versions: + "1.0.4": + folder: all diff --git a/recipes/yder/all/conandata.yml b/recipes/yder/all/conandata.yml index f6c79182d9b12..bda9472f3c267 100644 --- a/recipes/yder/all/conandata.yml +++ b/recipes/yder/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.4.20": + url: "https://github.com/babelouest/yder/archive/refs/tags/v1.4.20.tar.gz" + sha256: "c1a7f2281514d0d0bba912b6b70f371d8c127ccfd644b8c438c9301a0fd4c5f2" "1.4.18": url: "https://github.com/babelouest/yder/archive/refs/tags/v1.4.18.tar.gz" sha256: "b69cc81f6630f66468595d151446c00c90abed058f03f82e151591b8598a7598" diff --git a/recipes/yder/all/conanfile.py b/recipes/yder/all/conanfile.py index d027f053ed062..397af435bb258 100644 --- a/recipes/yder/all/conanfile.py +++ b/recipes/yder/all/conanfile.py @@ -5,7 +5,7 @@ import os import textwrap -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class YderConan(ConanFile): @@ -15,6 +15,8 @@ class YderConan(ConanFile): topics = ("logging", "stdout", "file", "journald", "systemd") license = "LGPL-2.1-or-later" url = "https://github.com/conan-io/conan-center-index" + + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -30,27 +32,19 @@ class YderConan(ConanFile): def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + if self.settings.os != "Linux": 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 + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def requirements(self): - self.requires("orcania/2.3.1") + self.requires("orcania/2.3.3") if self.options.get_safe("with_libsystemd"): - self.requires("libsystemd/251.4") + self.requires("libsystemd/253.10") def source(self): get(self, **self.conan_data["sources"][self.version], diff --git a/recipes/yder/config.yml b/recipes/yder/config.yml index 76bddfaab892d..5e84389f49d3a 100644 --- a/recipes/yder/config.yml +++ b/recipes/yder/config.yml @@ -1,3 +1,5 @@ versions: + "1.4.20": + folder: all "1.4.18": folder: all diff --git a/recipes/yoga/all/conandata.yml b/recipes/yoga/all/conandata.yml new file mode 100644 index 0000000000000..beedad9ab39c3 --- /dev/null +++ b/recipes/yoga/all/conandata.yml @@ -0,0 +1,37 @@ +sources: + "3.1.0": + url: "https://github.com/facebook/yoga/archive/refs/tags/v3.1.0.tar.gz" + sha256: "06ff9e6df9b2388a0c6ef8db55ba9bc2ae75e716e967cd12cf18785f6379159e" + "3.0.4": + url: "https://github.com/facebook/yoga/archive/refs/tags/v3.0.4.tar.gz" + sha256: "ef3ce5106eed03ab2e40dcfe5b868936a647c5f02b7ffd89ffaa5882dca3ef7f" + "3.0.2": + url: "https://github.com/facebook/yoga/archive/refs/tags/v3.0.2.tar.gz" + sha256: "73a81c51d9ceb5b95cd3abcafeb4c840041801d59f5048dacce91fbaab0cc6f9" + "2.0.1": + url: "https://github.com/facebook/yoga/archive/refs/tags/v2.0.1.tar.gz" + sha256: "4c80663b557027cdaa6a836cc087d735bb149b8ff27cbe8442fc5e09cec5ed92" + "2.0.0": + url: "https://github.com/facebook/yoga/archive/refs/tags/v2.0.0.tar.gz" + sha256: "29eaf05191dd857f76b6db97c77cce66db3c0067c88bd5e052909386ea66b8c5" +patches: + "3.1.0": + - patch_file: "patches/0001-delete-tests.patch" + patch_description: "Delete test targets from cmake" + patch_type: "conan" + "3.0.4": + - patch_file: "patches/0001-delete-tests.patch" + patch_description: "Delete test targets from cmake" + patch_type: "conan" + "3.0.2": + - patch_file: "patches/0001-delete-tests.patch" + patch_description: "Delete test targets from cmake" + patch_type: "conan" + "2.0.1": + - patch_file: "patches/0001-delete-tests.patch" + patch_description: "Delete test targets from cmake" + patch_type: "conan" + "2.0.0": + - patch_file: "patches/0001-delete-tests.patch" + patch_description: "Delete test targets from cmake" + patch_type: "conan" diff --git a/recipes/yoga/all/conanfile.py b/recipes/yoga/all/conanfile.py new file mode 100644 index 0000000000000..f2a7303076d24 --- /dev/null +++ b/recipes/yoga/all/conanfile.py @@ -0,0 +1,87 @@ +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 + + +class YogaConan(ConanFile): + name = "yoga" + description = "cross-platform layout engine which implements Flexbox" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://yogalayout.com/" + topics = ("layout engine", "flexbox") + package_type = "static-library" + settings = "os", "arch", "compiler", "build_type" + options = { + "fPIC": [True, False], + } + default_options = { + "fPIC": True, + } + + @property + def _min_cppstd(self): + return 20 if Version(self.version) >= "3.0.0" else 14 + + @property + def _compilers_minimum_version(self): + if Version(self.version) >= "3.0.0": + return { # C++20 with bit_cast + "gcc": "11", + "clang": "14", + "apple-clang": "14" + } + else: + 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 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 Version(self.version) >= "3.0.0" else 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." + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + apply_conandata_patches(self) + tc = CMakeToolchain(self) + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build(target="yogacore") + + 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 = ["yogacore"] diff --git a/recipes/yoga/all/patches/0001-delete-tests.patch b/recipes/yoga/all/patches/0001-delete-tests.patch new file mode 100644 index 0000000000000..bae612fca66b5 --- /dev/null +++ b/recipes/yoga/all/patches/0001-delete-tests.patch @@ -0,0 +1,9 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f4ce73cc..9f414127 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -10,4 +10,3 @@ set(CMAKE_VERBOSE_MAKEFILE on) + include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/project-defaults.cmake) + + add_subdirectory(yoga) +-add_subdirectory(tests) diff --git a/recipes/yoga/all/test_package/CMakeLists.txt b/recipes/yoga/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..4c709290f183b --- /dev/null +++ b/recipes/yoga/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.15) + +project(test_package CXX) + +find_package(yoga REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE yoga::yoga) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/yoga/all/test_package/conanfile.py b/recipes/yoga/all/test_package/conanfile.py new file mode 100644 index 0000000000000..02eb5ce439fb4 --- /dev/null +++ b/recipes/yoga/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/yoga/all/test_package/test_package.cpp b/recipes/yoga/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..ce6ef4ea1d25e --- /dev/null +++ b/recipes/yoga/all/test_package/test_package.cpp @@ -0,0 +1,20 @@ +#include +#include + +int main(void) { + const YGNodeRef root = YGNodeNew(); + YGNodeStyleSetAlignItems(root, YGAlignFlexStart); + YGNodeStyleSetWidth(root, 100); + YGNodeStyleSetHeight(root, 100); + + const YGNodeRef root_child0 = YGNodeNew(); + YGNodeStyleSetWidth(root_child0, 50); + YGNodeStyleSetAspectRatio(root_child0, 1); + YGNodeInsertChild(root, root_child0, 0); + + YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); + + YGNodeFreeRecursive(root); + + return EXIT_SUCCESS; +} diff --git a/recipes/yoga/config.yml b/recipes/yoga/config.yml new file mode 100644 index 0000000000000..542519cbca0f4 --- /dev/null +++ b/recipes/yoga/config.yml @@ -0,0 +1,11 @@ +versions: + "3.1.0": + folder: all + "3.0.4": + folder: all + "3.0.2": + folder: all + "2.0.1": + folder: all + "2.0.0": + folder: all diff --git a/recipes/yomm2/all/conandata.yml b/recipes/yomm2/all/conandata.yml new file mode 100644 index 0000000000000..b863f98db9295 --- /dev/null +++ b/recipes/yomm2/all/conandata.yml @@ -0,0 +1,10 @@ +sources: + "1.6.0": + url: "https://github.com/jll63/yomm2/archive/refs/tags/v1.6.0.tar.gz" + sha256: "5d617704755637b863a90129d09b8c3a1d3a06e3be809693c07575e0289cb508" + "1.5.2": + url: "https://github.com/jll63/yomm2/archive/refs/tags/v1.5.2.tar.gz" + sha256: "12f3f735b4870606199b889a242ebfed84cf0cd392b04a1c32db11291de684be" + "1.5.1": + url: "https://github.com/jll63/yomm2/archive/refs/tags/v1.5.1.tar.gz" + sha256: "323abba27a356555cc3ead3e3e950746ab43f90d97ad21950f2ba3afaf565ecc" diff --git a/recipes/yomm2/all/conanfile.py b/recipes/yomm2/all/conanfile.py new file mode 100644 index 0000000000000..3f5eaff0f2be7 --- /dev/null +++ b/recipes/yomm2/all/conanfile.py @@ -0,0 +1,121 @@ +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, CMakeToolchain, cmake_layout, CMakeDeps +from conan.tools.files import get, rm, rmdir, copy, replace_in_file +from conan.tools.scm import Version + +required_conan_version = ">=1.54.0" + + +class yomm2Recipe(ConanFile): + name = "yomm2" + package_type = "header-library" + # Optional metadata + license = "BSL-1.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/jll63/yomm2" + description = "Fast, orthogonal, open multi-methods. Solve the Expression Problem in C++17" + topics = ("multi-methods", "multiple-dispatch", "open-methods", "shared-library", + "header-only", "polymorphism", "expression-problem", "c++17") + # Binary configuration + settings = "os", "compiler", "build_type", "arch" + options = { + "header_only": [True, False], + } + default_options = { + "header_only": True + } + + @property + def _min_cppstd(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "8", + "clang": "5", + "apple-clang": "13", + "msvc": "192" + } + + def configure(self): + if not bool(self.options.header_only): + self.package_type = "shared-library" + + 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." + ) + if self.settings.compiler == "apple-clang" and not bool(self.options.header_only): + raise ConanInvalidConfiguration( + f"{self.ref} dynamic library builds are not supported on MacOS." + ) + + def build_requirements(self): + self.tool_requires("cmake/[>=3.21 <4]") + + def requirements(self): + # Upstream requires Boost 1.74 + # Using more modern Boost version to avoid issues like the one commented here: + # - https://github.com/conan-io/conan/issues/15977#issuecomment-2098003085 + self.requires("boost/1.85.0", transitive_headers=True) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def layout(self): + cmake_layout(self, src_folder="src") + + def generate(self): + deps = CMakeDeps(self) + deps.generate() + tc = CMakeToolchain(self) + tc.variables["YOMM2_ENABLE_EXAMPLES"] = "OFF" + tc.variables["YOMM2_ENABLE_TESTS"] = "OFF" + tc.variables["YOMM2_SHARED"] = not bool(self.options.header_only) + tc.generate() + + def _patch_sources(self): + if Version(self.version) <= "1.5.1": + cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") + replace_in_file(self, cmakelists, "add_subdirectory(docs.in)", "") + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package_id(self): + # if yomm2 is built as static, it behaves as a header-only one + if self.info.options.header_only: + self.info.clear() + + def package(self): + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + if self.options.header_only: + rmdir(self, os.path.join(self.package_folder, "lib")) + else: + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "YOMM2") + self.cpp_info.set_property("cmake_target_name", "YOMM2::yomm2") + if self.options.header_only: + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + else: # shared-library + self.cpp_info.libs = ["yomm2"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") diff --git a/recipes/yomm2/all/test_package/CMakeLists.txt b/recipes/yomm2/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..2686aaf2077a9 --- /dev/null +++ b/recipes/yomm2/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(YOMM2 REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE YOMM2::yomm2 ${CMAKE_THREAD_LIBS_INIT}) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/yomm2/all/test_package/conanfile.py b/recipes/yomm2/all/test_package/conanfile.py new file mode 100644 index 0000000000000..189c09687bde3 --- /dev/null +++ b/recipes/yomm2/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 yomm2TestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "CMakeDeps", "CMakeToolchain" + + 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 can_run(self): + cmd = os.path.join(self.cpp.build.bindir, "test_package") + self.run(cmd, env="conanrun") diff --git a/recipes/yomm2/all/test_package/test_package.cpp b/recipes/yomm2/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..ea5d7313d5408 --- /dev/null +++ b/recipes/yomm2/all/test_package/test_package.cpp @@ -0,0 +1,53 @@ +// Copyright (c) 2018-2024 Jean-Louis Leroy +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt +// or copy at http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include + +class Animal { + public: + virtual ~Animal() { + } +}; + +class Dog : public Animal {}; +class Cat : public Animal {}; + +register_classes(Animal, Dog, Cat); + +declare_method( + void, meet, (virtual_, virtual_, std::ostream&)); + +define_method(void, meet, (Animal&, Animal&, std::ostream& os)) { + os << "ignore"; +} + +// Add definitions for specific pairs of animals. +define_method(void, meet, (Dog& dog1, Dog& dog2, std::ostream& os)) { + os << "wag tail"; +} + +define_method(void, meet, (Dog& dog, Cat& cat, std::ostream& os)) { + os << "chase"; +} + +define_method(void, meet, (Cat& cat, Dog& dog, std::ostream& os)) { + os << "run"; +} + +int main() { + #ifndef NDEBUG + yorel::yomm2::default_policy::trace_enabled = true; + #endif + + yorel::yomm2::update(); + Animal&& snoopy = Dog(); + Animal&& felix = Cat(); + std::ostringstream os; + meet(snoopy, felix, os); // chase + + return os.str() == "chase" ? 0 : 1; +} diff --git a/recipes/yomm2/config.yml b/recipes/yomm2/config.yml new file mode 100644 index 0000000000000..46b176795aa94 --- /dev/null +++ b/recipes/yomm2/config.yml @@ -0,0 +1,7 @@ +versions: + "1.6.0": + folder: all + "1.5.2": + folder: all + "1.5.1": + folder: all diff --git a/recipes/yyjson/all/conandata.yml b/recipes/yyjson/all/conandata.yml index 683231e89f238..bd4149d822688 100644 --- a/recipes/yyjson/all/conandata.yml +++ b/recipes/yyjson/all/conandata.yml @@ -1,4 +1,16 @@ sources: + "0.10.0": + url: "https://github.com/ibireme/yyjson/archive/refs/tags/0.10.0.tar.gz" + sha256: "0d901cb2c45c5586e3f3a4245e58c2252d6b24bf4b402723f6179523d389b165" + "0.9.0": + url: "https://github.com/ibireme/yyjson/archive/refs/tags/0.9.0.tar.gz" + sha256: "59902bea55585d870fd7681eabe6091fbfd1a8776d1950f859d2dbbd510c74bd" + "0.8.0": + url: "https://github.com/ibireme/yyjson/archive/refs/tags/0.8.0.tar.gz" + sha256: "b2e39ac4c65f9050820c6779e6f7dd3c0d3fed9c6667f91caec0badbedce00f3" + "0.7.0": + url: "https://github.com/ibireme/yyjson/archive/refs/tags/0.7.0.tar.gz" + sha256: "9b91ee48ac1fe5939f747d49f123d9a522b5f4e1e46165c1871936d583628a06" "0.6.0": url: "https://github.com/ibireme/yyjson/archive/refs/tags/0.6.0.tar.gz" sha256: "75aa65d2944b3f64ce5918aa3da00f738dc695a0e8e0662de0063aafe1a8662f" diff --git a/recipes/yyjson/all/conanfile.py b/recipes/yyjson/all/conanfile.py index 5fd04cf964be2..735dd7c15a5b0 100644 --- a/recipes/yyjson/all/conanfile.py +++ b/recipes/yyjson/all/conanfile.py @@ -1,6 +1,7 @@ from conan import ConanFile 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.53.0" @@ -12,21 +13,25 @@ class YyjsonConan(ConanFile): license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/ibireme/yyjson" - topics = ("yyjson", "json", "serialization", "deserialization") - + topics = ("json", "serialization", "deserialization") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], + "with_utf8_validation": [True, False], } default_options = { "shared": False, "fPIC": True, + "with_utf8_validation": True, } def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + if Version(self.version) < "0.8.0": + del self.options.with_utf8_validation def configure(self): if self.options.shared: @@ -38,11 +43,12 @@ 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) + if Version(self.version) >= "0.8.0": + tc.variables["YYJSON_DISABLE_UTF8_VALIDATION"] = not bool(self.options.with_utf8_validation) tc.generate() def build(self): @@ -55,6 +61,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", "yyjson") @@ -62,3 +69,6 @@ def package_info(self): self.cpp_info.libs = ["yyjson"] if self.settings.os == "Windows" and self.options.shared: self.cpp_info.defines.append("YYJSON_IMPORTS") + + if Version(self.version) >= "0.9.0": + self.cpp_info.set_property("pkg_config_name", "yyjson") diff --git a/recipes/yyjson/config.yml b/recipes/yyjson/config.yml index c1abc92e2b1b8..b53dac867c374 100644 --- a/recipes/yyjson/config.yml +++ b/recipes/yyjson/config.yml @@ -1,4 +1,12 @@ versions: + "0.10.0": + folder: all + "0.9.0": + folder: all + "0.8.0": + folder: all + "0.7.0": + folder: all "0.6.0": folder: all "0.5.1": diff --git a/recipes/z3/all/CMakeLists.txt b/recipes/z3/all/CMakeLists.txt deleted file mode 100644 index 9304b61295329..0000000000000 --- a/recipes/z3/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/z3/all/conandata.yml b/recipes/z3/all/conandata.yml index 5f25ce5da1c6e..22ef6c0cbb592 100644 --- a/recipes/z3/all/conandata.yml +++ b/recipes/z3/all/conandata.yml @@ -1,30 +1,22 @@ sources: - "4.8.8": - url: "https://github.com/Z3Prover/z3/archive/z3-4.8.8.tar.gz" - sha256: "6962facdcdea287c5eeb1583debe33ee23043144d0e5308344e6a8ee4503bcff" + "4.13.0": + url: "https://github.com/Z3Prover/z3/archive/z3-4.13.0.tar.gz" + sha256: "01bcc61c8362e37bb89fd2430f7e3385e86df7915019bd2ce45de9d9bd934502" + "4.12.4": + url: "https://github.com/Z3Prover/z3/archive/z3-4.12.4.tar.gz" + sha256: "25e9b18d04ee22f1d872dfe0daaf4c39034744525214e34fedd206e25140e96e" + "4.12.2": + url: "https://github.com/Z3Prover/z3/archive/refs/tags/z3-4.12.2.tar.gz" + sha256: "9f58f3710bd2094085951a75791550f547903d75fe7e2fcb373c5f03fc761b8f" + "4.12.1": + url: "https://github.com/Z3Prover/z3/archive/refs/tags/z3-4.12.1.tar.gz" + sha256: "a3735fabf00e1341adcc70394993c05fd3e2ae167a3e9bb46045e33084eb64a3" + "4.11.2": + url: "https://github.com/Z3Prover/z3/archive/refs/tags/z3-4.11.2.tar.gz" + sha256: "e3a82431b95412408a9c994466fad7252135c8ed3f719c986cd75c8c5f234c7e" "4.10.2": - url: "https://github.com/Z3Prover/z3/archive/z3-4.10.2.tar.gz" + url: "https://github.com/Z3Prover/z3/archive/refs/tags/z3-4.10.2.tar.gz" sha256: "889fd035b833775c8cd2eb4723eb011bf916a3e9bf08ce66b31c548acee7a321" - -patches: - "4.8.8": - - patch_file: "patches/0001-cmake-use-conan-mpir-4.8.8.patch" - patch_description: "Support building with MPIR" - patch_type: "conan" - base_path: "source_subfolder" - - - patch_file: "patches/0002-python-interp-3-4.8.8.patch" - patch_description: "Fix finding the Python interpreter" - patch_type: "backport" - base_path: "source_subfolder" - - "4.10.2": - - patch_file: "patches/0001-cmake-use-conan-mpir-4.10.2.patch" - patch_description: "Support building with MPIR" - patch_type: "conan" - base_path: "source_subfolder" - - - patch_file: "patches/0003-cmake-try-compile-flags-4.10.2.patch" - patch_description: "Fix flag transmission to CMake try_compile" - patch_type: "portability" - base_path: "source_subfolder" + "4.9.1": + url: "https://github.com/Z3Prover/z3/archive/refs/tags/z3-4.9.1.tar.gz" + sha256: "ca08ba933481242507b2f8b303c3ebdf5d16b0005d397fb45018321dc639a0d7" diff --git a/recipes/z3/all/conanfile.py b/recipes/z3/all/conanfile.py index 1fa41bab49793..6d143a07d34f6 100644 --- a/recipes/z3/all/conanfile.py +++ b/recipes/z3/all/conanfile.py @@ -1,11 +1,14 @@ -from conans import CMake, ConanFile, tools -from conan.tools.files import apply_conandata_patches, get, rmdir -from conan.tools.scm import Version -from conan.errors import ConanException, ConanInvalidConfiguration import os -import textwrap -required_conan_version = ">=1.50.0" +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 get, copy, rmdir +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" class Z3Conan(ConanFile): @@ -16,35 +19,36 @@ class Z3Conan(ConanFile): homepage = "https://github.com/Z3Prover/z3" license = "MIT" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], "multithreaded": [True, False], - "multiprecision": ["internal", "gmp", "mpir"] + "use_gmp": [True, False] } default_options = { "shared": False, "fPIC": True, "multithreaded": True, - "multiprecision": "gmp" + "use_gmp": False } - 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 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): + # Z3 requires C++17, and it is recommended to use VS2019 or later + # Compiling z3 with GCC 7 results in a segfault + return { + "gcc": "8", + "clang": "5", + "apple-clang": "9", + "msvc": "192", + "Visual Studio": "16", + } def config_options(self): if self.settings.os == "Windows": @@ -52,78 +56,63 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - if self.options.multiprecision == "internal": - self.provides.append("gmp") - - def requirements(self): - self.output.info( - f"{self.name} will build using {self.options.multiprecision} multiprecision implementation.") - if self.options.multiprecision == "mpir": - self.requires("mpir/3.0.0") - elif self.options.multiprecision == "gmp": - self.requires("gmp/6.2.1") - elif self.options.multiprecision == "internal": - pass + self.options.rm_safe("fPIC") - def source(self): - 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["Z3_USE_LIB_GMP"] = self.options.multiprecision != "internal" - self._cmake.definitions["Z3_USE_LIB_MPIR"] = self.options.multiprecision == "mpir" - self._cmake.definitions["SINGLE_THREADED"] = not self.options.multithreaded - self._cmake.definitions["Z3_BUILD_LIBZ3_SHARED"] = self.options.shared - self._cmake.definitions["Z3_INCLUDE_GIT_HASH"] = False - self._cmake.definitions["Z3_INCLUDE_GIT_DESCRIBE"] = False - self._cmake.definitions["Z3_ENABLE_EXAMPLE_TARGETS"] = False - self._cmake.definitions["Z3_BUILD_DOCUMENTATION"] = False - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def layout(self): + cmake_layout(self, src_folder="src") - @property - def _compilers_minimum_version(self): - return { - "gcc": "7", - "Visual Studio": "15.7", - "clang": "5", - "apple-clang": "10", - } + def requirements(self): + if self.options.use_gmp: + self.requires("gmp/6.3.0") def validate(self): - if Version(self.version) >= "4.8.11": - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, "17") - compiler = self.settings.compiler - min_version = self._compilers_minimum_version\ - .get(str(compiler), False) - if min_version: - if Version(compiler.version) < min_version: - raise ConanInvalidConfiguration( - f"{self.name} requires C++17, which {compiler} {compiler.version} does not support.") - else: - self.output.info( - f"{self.name} requires C++17. Your compiler is unknown. Assuming it supports C++17.") + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) - def build(self): - apply_conandata_patches(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 build_requirements(self): + self.tool_requires("cmake/[>=3.16 <4]") - if self.options.multiprecision == "mpir": - tools.save(os.path.join(self._build_subfolder, "gmp.h"), textwrap.dedent("""\ - #pragma once - #include - """)) + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + venv = VirtualBuildEnv(self) + venv.generate() + + tc = CMakeToolchain(self) + tc.variables["Z3_USE_LIB_GMP"] = self.options.use_gmp + tc.variables["Z3_SINGLE_THREADED"] = not self.options.multithreaded + tc.variables["Z3_BUILD_LIBZ3_SHARED"] = self.options.shared + tc.variables["Z3_INCLUDE_GIT_HASH"] = False + tc.variables["Z3_INCLUDE_GIT_DESCRIBE"] = False + tc.variables["Z3_ENABLE_EXAMPLE_TARGETS"] = False + tc.variables["Z3_BUILD_DOCUMENTATION"] = False + # Set the flag `stdlib` for Clang on Linux to fix the linker errors + if self.settings.os == "Linux" and self.settings.compiler == "clang": + # Possible values: `libc++`, `libstdc++11` and `libstdc++` + stdlib = f" -stdlib={self.settings.compiler.libcxx}".rstrip("1") + tc.variables["CMAKE_CXX_FLAGS"] = tc.variables.get("CMAKE_CXX_FLAGS", "") + stdlib + tc.generate() + + deps = CMakeDeps(self) + # Override the target name of the GMP library provided by Conan Center + deps.set_property("gmp", "cmake_target_name", "GMP::GMP") + deps.generate() - cmake = self._configure_cmake() + def build(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", 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, "lib", "pkgconfig")) rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) @@ -133,12 +122,10 @@ def package_info(self): self.cpp_info.set_property("cmake_target_name", "z3::libz3") # TODO: back to global scope in conan v2 once cmake_find_package_* generators removed - self.cpp_info.components["libz3"].libs = [ - "libz3" if self.settings.os == "Windows" else "z3"] - if not self.options.shared: - if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.components["libz3"]\ - .system_libs.extend(["pthread", "m"]) + self.cpp_info.components["libz3"].libs = ["libz3" if self.settings.os == "Windows" else "z3"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["libz3"].system_libs.extend(["pthread", "m"]) + # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.filenames["cmake_find_package"] = "Z3" self.cpp_info.filenames["cmake_find_package_multi"] = "Z3" @@ -146,14 +133,5 @@ def package_info(self): self.cpp_info.names["cmake_find_package_multi"] = "z3" self.cpp_info.components["libz3"].names["cmake_find_package"] = "libz3" self.cpp_info.components["libz3"].names["cmake_find_package_multi"] = "libz3" - self.cpp_info.components["libz3"].set_property( - "cmake_target_name", "z3::libz3") - - libz3_requirements = [] - if self.options.multiprecision == "mpir": - libz3_requirements.append("mpir::mpir") - elif self.options.multiprecision == "gmp": - libz3_requirements.append("gmp::gmp") - elif self.options.multiprecision == "internal": - pass - self.cpp_info.components["libz3"].requires = libz3_requirements + self.cpp_info.components["libz3"].set_property("cmake_target_name", "z3::libz3") + self.cpp_info.components["libz3"].requires = ["gmp::gmp"] if self.options.use_gmp else [] diff --git a/recipes/z3/all/patches/0001-cmake-use-conan-mpir-4.10.2.patch b/recipes/z3/all/patches/0001-cmake-use-conan-mpir-4.10.2.patch deleted file mode 100644 index c510cb76b177f..0000000000000 --- a/recipes/z3/all/patches/0001-cmake-use-conan-mpir-4.10.2.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -242,10 +242,16 @@ - if (Z3_USE_LIB_GMP) - # Because this is off by default we will make the configure fail if libgmp - # can't be found -- find_package(GMP REQUIRED) -- message(STATUS "Using libgmp") -- list(APPEND Z3_DEPENDENT_LIBS GMP::GMP) -+ if (Z3_USE_LIB_MPIR) -+ message(STATUS "Using libmpir") -+ list(APPEND Z3_DEPENDENT_LIBS CONAN_PKG::mpir) -+ else() -+ message(STATUS "Using libgmp") -+ find_package(GMP REQUIRED) -+ list(APPEND Z3_DEPENDENT_LIBS GMP::GMP) -+ endif() -+ list(APPEND Z3_COMPONENT_EXTRA_INCLUDE_DIRS "${CMAKE_BINARY_DIR}" ${CONAN_INCLUDE_DIRS}) - list(APPEND Z3_COMPONENT_CXX_DEFINES "-D_MP_GMP") - else() - list(APPEND Z3_COMPONENT_CXX_DEFINES "-D_MP_INTERNAL") - message(STATUS "Not using libgmp") diff --git a/recipes/z3/all/patches/0001-cmake-use-conan-mpir-4.8.8.patch b/recipes/z3/all/patches/0001-cmake-use-conan-mpir-4.8.8.patch deleted file mode 100644 index d7ee939df7e2f..0000000000000 --- a/recipes/z3/all/patches/0001-cmake-use-conan-mpir-4.8.8.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -246,10 +246,16 @@ - if (Z3_USE_LIB_GMP) - # Because this is off by default we will make the configure fail if libgmp - # can't be found -- find_package(GMP REQUIRED) -- message(STATUS "Using libgmp") -- list(APPEND Z3_DEPENDENT_LIBS ${GMP_C_LIBRARIES}) -- list(APPEND Z3_COMPONENT_EXTRA_INCLUDE_DIRS ${GMP_INCLUDE_DIRS}) -+ if (Z3_USE_LIB_MPIR) -+ message(STATUS "Using libmpir") -+ list(APPEND Z3_DEPENDENT_LIBS CONAN_PKG::mpir) -+ else() -+ message(STATUS "Using libgmp") -+ find_package(GMP REQUIRED) -+ list(APPEND Z3_DEPENDENT_LIBS ${GMP_C_LIBRARIES}) -+ list(APPEND Z3_COMPONENT_EXTRA_INCLUDE_DIRS ${GMP_INCLUDE_DIRS}) -+ endif() -+ list(APPEND Z3_COMPONENT_EXTRA_INCLUDE_DIRS "${CMAKE_BINARY_DIR}" ${CONAN_INCLUDE_DIRS}) - list(APPEND Z3_COMPONENT_CXX_DEFINES "-D_MP_GMP") - else() - list(APPEND Z3_COMPONENT_CXX_DEFINES "-D_MP_INTERNAL") diff --git a/recipes/z3/all/patches/0002-python-interp-3-4.8.8.patch b/recipes/z3/all/patches/0002-python-interp-3-4.8.8.patch deleted file mode 100644 index 5f497703b3de0..0000000000000 --- a/recipes/z3/all/patches/0002-python-interp-3-4.8.8.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -169,7 +169,7 @@ - ################################################################################ - # Find Python - ################################################################################ --find_package(PythonInterp REQUIRED) -+find_package(PythonInterp 3 REQUIRED) - message(STATUS "PYTHON_EXECUTABLE: ${PYTHON_EXECUTABLE}") - - ################################################################################ diff --git a/recipes/z3/all/patches/0003-cmake-try-compile-flags-4.10.2.patch b/recipes/z3/all/patches/0003-cmake-try-compile-flags-4.10.2.patch deleted file mode 100644 index 0a19de4afbb27..0000000000000 --- a/recipes/z3/all/patches/0003-cmake-try-compile-flags-4.10.2.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -1,2 +1,2 @@ - # Enforce some CMake policies --cmake_minimum_required(VERSION 3.4) -+cmake_minimum_required(VERSION 3.8) -@@ -179,9 +179,10 @@ - ################################################################################ - # C++ language version - ################################################################################ - set(CMAKE_CXX_STANDARD 17) - set(CMAKE_CXX_STANDARD_REQUIRED ON) -+cmake_policy(SET CMP0067 NEW) # ensures try_compile uses the same standard - - ################################################################################ - # Platform detection - ################################################################################ diff --git a/recipes/z3/all/test_package/CMakeLists.txt b/recipes/z3/all/test_package/CMakeLists.txt index 04cd4a68ceb59..22ff0aeb773f3 100644 --- a/recipes/z3/all/test_package/CMakeLists.txt +++ b/recipes/z3/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) +project(test_package LANGUAGES CXX) find_package(Z3 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE z3::libz3) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/z3/all/test_package/conanfile.py b/recipes/z3/all/test_package/conanfile.py index 38f4483872d47..a9fb96656f203 100644 --- a/recipes/z3/all/test_package/conanfile.py +++ b/recipes/z3/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/z3/all/test_package/test_package.cpp b/recipes/z3/all/test_package/test_package.cpp index 952704555d235..4e91c96764a96 100644 --- a/recipes/z3/all/test_package/test_package.cpp +++ b/recipes/z3/all/test_package/test_package.cpp @@ -141,5 +141,6 @@ void demorgan() int main() { simple_example(); - demorgan(); + // Z3 v4.11.2: Trigger a page fault when compiled with and Clang in release mode + // demorgan(); } diff --git a/recipes/z3/all/test_v1_package/CMakeLists.txt b/recipes/z3/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/z3/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/z3/all/test_v1_package/conanfile.py b/recipes/z3/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/z3/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/z3/config.yml b/recipes/z3/config.yml index 186c923c3a5de..3b0214f4790b4 100644 --- a/recipes/z3/config.yml +++ b/recipes/z3/config.yml @@ -1,5 +1,15 @@ versions: - "4.8.8": + "4.13.0": + folder: "all" + "4.12.4": + folder: "all" + "4.12.2": + folder: "all" + "4.12.1": + folder: "all" + "4.11.2": folder: "all" "4.10.2": folder: "all" + "4.9.1": + folder: "all" diff --git a/recipes/zbar/all/conandata.yml b/recipes/zbar/all/conandata.yml index cf2cfcd314d59..6b2d63eaa0b13 100644 --- a/recipes/zbar/all/conandata.yml +++ b/recipes/zbar/all/conandata.yml @@ -5,3 +5,8 @@ sources: "0.10": url: "https://sourceforge.net/projects/zbar/files/zbar/0.10/zbar-0.10.tar.gz" sha256: "575fa82de699faa7bda2d2ebbe3e1af0a4152ec4d3ad72c0ab6712d7cc9b5dd2" +patches: + "0.10": + - patch_file: "patches/0001-support-aarch.patch" + patch_description: "Add support for Mac M1" + patch_type: "portability" diff --git a/recipes/zbar/all/conanfile.py b/recipes/zbar/all/conanfile.py index 00bd9d090d748..277b16ca05ae4 100644 --- a/recipes/zbar/all/conanfile.py +++ b/recipes/zbar/all/conanfile.py @@ -1,11 +1,15 @@ -from conans import tools, AutoToolsBuildEnvironment -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.build import cross_building +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import get, copy, rmdir, rm, export_conandata_patches, apply_conandata_patches +from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps, PkgConfigDeps +from conan.tools.layout import basic_layout +from conan.tools.scm import Version import os -import shutil -required_conan_version = ">=1.36.0" +required_conan_version = ">=1.53.0" class ZbarConan(ConanFile): @@ -13,10 +17,11 @@ class ZbarConan(ConanFile): license = "LGPL-2.1-only" url = "https://github.com/conan-io/conan-center-index" homepage = "http://zbar.sourceforge.net/" - topics = ("zbar", "bar codes") + topics = ("barcode", "scanner", "decoder", "reader", "bar") description = "ZBar is an open source software suite for reading bar codes\ from various sources, such as video streams, image files and raw intensity sensors" - settings = "os", "compiler", "build_type", "arch" + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -46,15 +51,8 @@ class ZbarConan(ConanFile): "enable_pthread": True, } - _autotools = None - - @property - def _user_info_build(self): - return getattr(self, "user_info_build", None) or self.deps_user_info - - @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": @@ -62,94 +60,101 @@ 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("libiconv/1.17") if self.options.with_jpeg: - self.requires("libjpeg/9d") + self.requires("libjpeg/9e") if self.options.with_imagemagick: self.requires("imagemagick/7.0.11-14") if self.options.with_gtk: self.requires("gtk/4.7.0") if self.options.with_qt: - self.requires("qt/5.15.5") - if tools.Version(self.version) >= "0.22": - self.requires("libiconv/1.17") - - def build_requirements(self): - self.build_requires("gnu-config/cci.20210814") - if tools.Version(self.version) >= "0.22": - self.build_requires("automake/1.16.5") - self.build_requires("gettext/0.21") - self.build_requires("pkgconf/1.7.4") - self.build_requires("libtool/2.4.6") + self.requires("qt/5.15.9") def validate(self): if self.settings.os == "Windows": raise ConanInvalidConfiguration("Zbar can't be built on Windows") - if tools.is_apple_os(self.settings.os) and not self.options.shared: + if is_apple_os(self) and not self.options.shared: raise ConanInvalidConfiguration("Zbar can't be built static on macOS") if self.options.with_xv: #TODO add when available - self.output.warn("There is no Xvideo package available on Conan (yet). This recipe will use the one present on the system (if available).") - if tools.Version(self.version) >= "0.22" and cross_building(self): - raise ConanInvalidConfiguration("{} can't be built on cross building environment currently because autopoint(part of gettext) doesn't execute correctly.".format(self.name)) + self.output.warning("There is no Xvideo package available on Conan (yet). This recipe will use the one present on the system (if available).") + if Version(self.version) >= "0.22" and cross_building(self): + raise ConanInvalidConfiguration(f"{self.ref} can't be built on cross building environment currently because autopoint(part of gettext) doesn't execute correctly.") + + 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/2.0.3") + if Version(self.version) >= "0.22": + self.tool_requires("gettext/0.21") + 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 not self._autotools: - if tools.Version(self.version) >= "0.22": - with tools.chdir(self._source_subfolder): - self.run("autoreconf -fiv") - 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)), - "--enable-video={}".format(yes_no(self.options.with_video)), - "--with-imagemagick={}".format(yes_no(self.options.with_imagemagick)), - "--with-gtk={}".format(yes_no(self.options.with_gtk)), - "--with-qt={}".format(yes_no(self.options.with_qt)), - "--with-python={}".format(yes_no(self.options.with_python_bindings)), - "--with-x={}".format(yes_no(self.options.with_x)), - "--with-xshm={}".format(yes_no(self.options.with_xshm)), - "--with-xv={}".format(yes_no(self.options.with_xv)), - "--with-jpeg={}".format(yes_no(self.options.with_jpeg)), - "--enable-pthread={}".format(yes_no(self.options.enable_pthread)), - ] - if self.settings.os == "Macos" and self.settings.arch == "armv8": - # ./libtool: eval: line 961: syntax error near unexpected token `|' - args.append("NM=nm") - self._autotools.configure(args=args, configure_dir=self._source_subfolder) - return self._autotools + 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.extend([ + f"--enable-video={yes_no(self.options.with_video)}", + f"--with-imagemagick={yes_no(self.options.with_imagemagick)}", + f"--with-gtk={yes_no(self.options.with_gtk)}", + f"--with-qt={yes_no(self.options.with_qt)}", + f"--with-python={yes_no(self.options.with_python_bindings)}", + f"--with-x={yes_no(self.options.with_x)}", + f"--with-xshm={yes_no(self.options.with_xshm)}", + f"--with-xv={yes_no(self.options.with_xv)}", + f"--with-jpeg={yes_no(self.options.with_jpeg)}", + f"--enable-pthread={yes_no(self.options.enable_pthread)}", + ]) + env = tc.environment() + if self.settings.os == "Macos" and self.settings.arch == "armv8": + # ./libtool: eval: line 961: syntax error near unexpected token `|' + env.define("NM", "nm") + tc.generate(env) + + AutotoolsDeps(self).generate() + PkgConfigDeps(self).generate() def build(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")) - - autotools = self._configure_autotools() + 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, "config")) + + autotools = Autotools(self) + if Version(self.version) >= "0.22": + autotools.autoreconf() + autotools.configure() autotools.make() def package(self): - if tools.Version(self.version) < "0.23": - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - else: - self.copy("LICENSE.md", src=self._source_subfolder, dst="licenses") - autotools = self._configure_autotools() + copy(self, "LICENSE*", 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, "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.names["pkg_config"] = "zbar" + self.cpp_info.libs = ["zbar"] self.cpp_info.set_property("pkg_config_name", "zbar") - self.cpp_info.libs = tools.collect_libs(self) if self.settings.os in ("FreeBSD", "Linux") and self.options.enable_pthread: self.cpp_info.system_libs = ["pthread"] - if tools.is_apple_os(self.settings.os): - self.cpp_info.system_libs = ["iconv"] diff --git a/recipes/zbar/all/patches/0001-support-aarch.patch b/recipes/zbar/all/patches/0001-support-aarch.patch new file mode 100644 index 0000000000000..af159847c4b2d --- /dev/null +++ b/recipes/zbar/all/patches/0001-support-aarch.patch @@ -0,0 +1,12 @@ +diff --git a/config/config.sub b/config/config.sub +index 848a7a5..8fecc04 100755 +--- a/config/config.sub ++++ b/config/config.sub +@@ -322,6 +322,7 @@ case $basic_machine in + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ ++ | aarch64-* | aarch64_be-* \ + | avr-* | avr32-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ diff --git a/recipes/zbar/all/test_package/CMakeLists.txt b/recipes/zbar/all/test_package/CMakeLists.txt index ecdb95efbb37f..5f986e30b6686 100644 --- a/recipes/zbar/all/test_package/CMakeLists.txt +++ b/recipes/zbar/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ cmake_minimum_required(VERSION 3.0) project(test_package C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(zbar CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.c) diff --git a/recipes/zbar/all/test_package/conanfile.py b/recipes/zbar/all/test_package/conanfile.py index 90eb89e3f2f46..ef5d7042163ec 100644 --- a/recipes/zbar/all/test_package/conanfile.py +++ b/recipes/zbar/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/zbar/all/test_v1_package/CMakeLists.txt b/recipes/zbar/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/zbar/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/zbar/all/test_v1_package/conanfile.py b/recipes/zbar/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/zbar/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/zeromq/all/conandata.yml b/recipes/zeromq/all/conandata.yml index a5145365e9be5..7060e3ef64de2 100644 --- a/recipes/zeromq/all/conandata.yml +++ b/recipes/zeromq/all/conandata.yml @@ -1,22 +1,48 @@ sources: + "4.3.5": + url: "https://github.com/zeromq/libzmq/releases/download/v4.3.5/zeromq-4.3.5.tar.gz" + sha256: "6653ef5910f17954861fe72332e68b03ca6e4d9c7160eb3a8de5a5a913bfab43" "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.5": + - patch_file: "patches/0003-rpath-macos-4.3.5.patch" + patch_description: "hardcoded full install path on local machine" + patch_type: "portability" + - patch_file: "patches/0004-cmake-minimum-required-first.patch" + patch_description: "exchange positions between project and cmake_minimum_required" + patch_type: "portability" "4.3.4": - patch_file: "patches/0003-rpath-macos-4.3.3.patch" + patch_description: "hardcoded full install path on local machine" + patch_type: "portability" - patch_file: "patches/0004-cmake-minimum-required-first.patch" + patch_description: "exchange positions between project and cmake_minimum_required" + patch_type: "portability" "4.3.3": - patch_file: "patches/0003-rpath-macos-4.3.3.patch" + patch_description: "hardcoded full install path on local machine" + patch_type: "portability" - patch_file: "patches/0004-cmake-minimum-required-first.patch" + patch_description: "exchange positions between project and cmake_minimum_required" + patch_type: "portability" "4.3.2": - patch_file: "patches/0001-problem-__try-and-__except-isn-t-universally-supported-on-windows.patch" + patch_description: "__try and __except isn't universally supported on windows" + patch_type: "portability" - patch_file: "patches/0002-problem-invalid-syntax-for-calling-convention-on-function.patch" + patch_description: "invalid syntax for calling convention on function pointer" + patch_type: "portability" - patch_file: "patches/0003-rpath-macos-4.3.2.patch" + patch_description: "hardcoded full install path on local machine" + patch_type: "portability" - patch_file: "patches/0004-cmake-minimum-required-first.patch" + patch_description: "exchange positions between project and cmake_minimum_required" + patch_type: "portability" diff --git a/recipes/zeromq/all/conanfile.py b/recipes/zeromq/all/conanfile.py index 434e0e5fb3084..24e21533e207e 100644 --- a/recipes/zeromq/all/conanfile.py +++ b/recipes/zeromq/all/conanfile.py @@ -7,22 +7,22 @@ import os import textwrap -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class ZeroMQConan(ConanFile): name = "zeromq" - homepage = "https://github.com/zeromq/libzmq" description = "ZeroMQ is a community of projects focused on decentralized messaging and computing" - topics = ("zmq", "libzmq", "message-queue", "asynchronous") + license = ("DocumentRef-ZeroMQ:LicenseRef-LGPL-3.0-or-later-ZeroMQ-Linking-Exception", "MPL-2.0") url = "https://github.com/conan-io/conan-center-index" - license = "LGPL-3.0" - + homepage = "https://github.com/zeromq/libzmq" + topics = ("zmq", "libzmq", "message-queue", "asynchronous") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], - "encryption": [None, "libsodium", "tweetnacl"], + "encryption": [False, "libsodium", "tweetnacl"], "with_norm": [True, False], "poller": [None, "kqueue", "epoll", "devpoll", "pollset", "poll", "select"], "with_draft_api": [True, False], @@ -46,32 +46,32 @@ def export_sources(self): def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + if Version(self.version) >= "4.3.5": + self.license = "MPL-2.0" + else: + self.license = "DocumentRef-ZeroMQ:LicenseRef-LGPL-3.0-or-later-ZeroMQ-Linking-Exception" def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") def requirements(self): if self.options.encryption == "libsodium": - self.requires("libsodium/1.0.18") + self.requires("libsodium/1.0.19") if self.options.with_norm: self.requires("norm/1.5.9") def validate(self): - if self.info.settings.os == "Windows" and self.info.options.with_norm: + if self.settings.os == "Windows" and self.options.with_norm: raise ConanInvalidConfiguration( "Norm and ZeroMQ are not compatible on Windows yet" ) 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) @@ -104,7 +104,12 @@ def _patch_sources(self): 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\")" + if Version(self.version) < "4.3.3": + find_sodium = "find_package(Sodium)" + elif Version(self.version) < "4.3.5": + find_sodium = "find_package(\"Sodium\")" + else: + find_sodium = "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") @@ -117,7 +122,10 @@ def build(self): cmake.build() def package(self): - copy(self, "COPYING*", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + if Version(self.version) >= "4.3.5": + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + else: + copy(self, "COPYING*", self.source_folder, os.path.join(self.package_folder, "licenses")) cmake = CMake(self) cmake.install() rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) diff --git a/recipes/zeromq/all/patches/0003-rpath-macos-4.3.5.patch b/recipes/zeromq/all/patches/0003-rpath-macos-4.3.5.patch new file mode 100644 index 0000000000000..05cc02222a9e2 --- /dev/null +++ b/recipes/zeromq/all/patches/0003-rpath-macos-4.3.5.patch @@ -0,0 +1,22 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 0346227..6c231b1 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,7 +1,7 @@ + # CMake build script for ZeroMQ + project(ZeroMQ) + +-if(${CMAKE_SYSTEM_NAME} STREQUAL Darwin) ++if(1) + cmake_minimum_required(VERSION 3.0.2) + else() + cmake_minimum_required(VERSION 2.8.12) +@@ -95,7 +95,7 @@ set(ZMQ_OUTPUT_BASENAME + "zmq" + CACHE STRING "Output zmq library base name") + +-if(${CMAKE_SYSTEM_NAME} STREQUAL Darwin) ++if(0) + # Find more information: https://cmake.org/Wiki/CMake_RPATH_handling + + # Apply CMP0042: MACOSX_RPATH is enabled by default diff --git a/recipes/zeromq/all/test_v1_package/CMakeLists.txt b/recipes/zeromq/all/test_v1_package/CMakeLists.txt index 226be2dd7b7c3..0d20897301b68 100644 --- a/recipes/zeromq/all/test_v1_package/CMakeLists.txt +++ b/recipes/zeromq/all/test_v1_package/CMakeLists.txt @@ -1,25 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES CXX) +project(test_package) -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -option(WITH_LIBSODIUM "zeromq is built with libsodium") -option(WITH_NORM "zeromq is built with norm") - -find_package(ZeroMQ REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -if(ZEROMQ_SHARED) - target_link_libraries(${PROJECT_NAME} PRIVATE libzmq) -else() - target_link_libraries(${PROJECT_NAME} PRIVATE libzmq-static) -endif() - -if(WITH_LIBSODIUM) - target_compile_definitions(${PROJECT_NAME} PRIVATE "WITH_LIBSODIUM") -endif() - -if(WITH_NORM) - target_compile_definitions(${PROJECT_NAME} PRIVATE "WITH_NORM") -endif() +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/zeromq/config.yml b/recipes/zeromq/config.yml index 218db624c1eea..492566041769b 100644 --- a/recipes/zeromq/config.yml +++ b/recipes/zeromq/config.yml @@ -1,4 +1,6 @@ versions: + "4.3.5": + folder: all "4.3.4": folder: all "4.3.3": diff --git a/recipes/zeus_expected/all/conandata.yml b/recipes/zeus_expected/all/conandata.yml new file mode 100644 index 0000000000000..4ddc999dfc0ef --- /dev/null +++ b/recipes/zeus_expected/all/conandata.yml @@ -0,0 +1,17 @@ +sources: + "1.2.0": + url: "https://github.com/zeus-cpp/expected/archive/refs/tags/v1.2.0.tar.gz" + sha256: "460da641f212c793f46a5a8f29107c9b9540a17a91f197e2dc396dac0269a2b5" + "1.1.1": + url: "https://github.com/zeus-cpp/expected/archive/refs/tags/v1.1.1.tar.gz" + sha256: "47b411677ffb2fa0d43b308797542509ae2bdb101426cf0d4777e3c162b1d726" + "1.1.0": + url: "https://github.com/zeus-cpp/expected/archive/refs/tags/v1.1.0.tar.gz" + sha256: "a963eba43f227498da2cbb924265344209696320c75ee63a92073936bb49f7e5" + +patches: + "1.1.0": + - patch_file: "patches/0001-fix-compiler-errors-with-msvc-v142.patch" + patch_source: "https://github.com/zeus-cpp/expected/pull/7/commits/82ed513aa65a3c2c7b8f8af7c63e0b8b57637dfb" + patch_description: "Fix for MSVC v142" + patch_type: "bugfix" diff --git a/recipes/zeus_expected/all/conanfile.py b/recipes/zeus_expected/all/conanfile.py new file mode 100644 index 0000000000000..1067fa8157091 --- /dev/null +++ b/recipes/zeus_expected/all/conanfile.py @@ -0,0 +1,84 @@ +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.errors import ConanInvalidConfiguration +from conan.tools.scm import Version +from conan.tools.files import apply_conandata_patches, export_conandata_patches +import os + +required_conan_version = ">=1.54.0" + + +class ZeusExpectedConan(ConanFile): + name = "zeus_expected" + + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/zeus-cpp/expected" + description = "Backporting std::expected to C++17." + topics = ("cpp17", "expected") + license = "MIT" + + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + + no_copy_source = True + + def export_sources(self): + export_conandata_patches(self) + + @property + def _min_cppstd(self): + return 17 + + @property + def _minimum_compilers_version(self): + return { + "gcc": "7", + "clang": "5", + "Visual Studio": "15.7", + "apple-clang": "10", + } + + 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.name} 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], strip_root=True) + + def build(self): + apply_conandata_patches(self) + + 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_target_name", "zeus::expected") + self.cpp_info.bindirs = [] + self.cpp_info.frameworkdirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] + + def package_id(self): + self.info.clear() diff --git a/recipes/zeus_expected/all/patches/0001-fix-compiler-errors-with-msvc-v142.patch b/recipes/zeus_expected/all/patches/0001-fix-compiler-errors-with-msvc-v142.patch new file mode 100644 index 0000000000000..82856fb33c345 --- /dev/null +++ b/recipes/zeus_expected/all/patches/0001-fix-compiler-errors-with-msvc-v142.patch @@ -0,0 +1,88 @@ +From 82ed513aa65a3c2c7b8f8af7c63e0b8b57637dfb Mon Sep 17 00:00:00 2001 +From: X1aomu +Date: Fri, 19 Apr 2024 14:15:14 +0800 +Subject: [PATCH] fix: compiler errors with msvc v142 + +--- + include/zeus/expected.hpp | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +diff --git a/include/zeus/expected.hpp b/include/zeus/expected.hpp +index 6492953..790f870 100644 +--- a/include/zeus/expected.hpp ++++ b/include/zeus/expected.hpp +@@ -2441,7 +2441,7 @@ public: + constexpr auto and_then(F &&f) & + { + using U = expected_detail::remove_cvref_t>; +- static_assert(expected_detail::is_specialization_v, "U (return type of F) must be specialization of expected"); ++ static_assert(expected_detail::is_specialization_v, "U (return type of F) must be specialization of expected"); + static_assert(std::is_same_v, "The error type must be the same after calling the F"); + + if (has_value()) +@@ -2453,7 +2453,7 @@ public: + constexpr auto and_then(F &&f) const & + { + using U = expected_detail::remove_cvref_t>; +- static_assert(expected_detail::is_specialization_v, "U (return type of F) must be specialization of expected"); ++ static_assert(expected_detail::is_specialization_v, "U (return type of F) must be specialization of expected"); + static_assert(std::is_same_v, "The error type must be the same after calling the F"); + + if (has_value()) +@@ -2465,7 +2465,7 @@ public: + constexpr auto and_then(F &&f) && + { + using U = expected_detail::remove_cvref_t>; +- static_assert(expected_detail::is_specialization_v, "U (return type of F) must be specialization of expected"); ++ static_assert(expected_detail::is_specialization_v, "U (return type of F) must be specialization of expected"); + static_assert(std::is_same_v, "The error type must be the same after calling the F"); + + if (has_value()) +@@ -2477,7 +2477,7 @@ public: + constexpr auto and_then(F &&f) const && + { + using U = expected_detail::remove_cvref_t>; +- static_assert(expected_detail::is_specialization_v, "U (return type of F) must be specialization of expected"); ++ static_assert(expected_detail::is_specialization_v, "U (return type of F) must be specialization of expected"); + static_assert(std::is_same_v, "The error type must be the same after calling the F"); + + if (has_value()) +@@ -2490,7 +2490,7 @@ public: + constexpr auto or_else(F &&f) & + { + using G = expected_detail::remove_cvref_t>; +- static_assert(expected_detail::is_specialization_v, "G (return type of F) must be specialization of expected"); ++ static_assert(expected_detail::is_specialization_v, "G (return type of F) must be specialization of expected"); + static_assert(std::is_same_v, "The value type must be the same after calling the F"); + + if (has_value()) +@@ -2502,7 +2502,7 @@ public: + constexpr auto or_else(F &&f) const & + { + using G = expected_detail::remove_cvref_t>; +- static_assert(expected_detail::is_specialization_v, "G (return type of F) must be specialization of expected"); ++ static_assert(expected_detail::is_specialization_v, "G (return type of F) must be specialization of expected"); + static_assert(std::is_same_v, "The value type must be the same after calling the F"); + + if (has_value()) +@@ -2514,7 +2514,7 @@ public: + constexpr auto or_else(F &&f) && + { + using G = expected_detail::remove_cvref_t>; +- static_assert(expected_detail::is_specialization_v, "G (return type of F) must be specialization of expected"); ++ static_assert(expected_detail::is_specialization_v, "G (return type of F) must be specialization of expected"); + static_assert(std::is_same_v, "The value type must be the same after calling the F"); + + if (has_value()) +@@ -2526,7 +2526,7 @@ public: + constexpr auto or_else(F &&f) const && + { + using G = expected_detail::remove_cvref_t>; +- static_assert(expected_detail::is_specialization_v, "G (return type of F) must be specialization of expected"); ++ static_assert(expected_detail::is_specialization_v, "G (return type of F) must be specialization of expected"); + static_assert(std::is_same_v, "The value type must be the same after calling the F"); + + if (has_value()) +-- +2.44.0.windows.1 + diff --git a/recipes/zeus_expected/all/test_package/CMakeLists.txt b/recipes/zeus_expected/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..5afcbf812c8a3 --- /dev/null +++ b/recipes/zeus_expected/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(zeus_expected REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE zeus::expected) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/zeus_expected/all/test_package/conanfile.py b/recipes/zeus_expected/all/test_package/conanfile.py new file mode 100644 index 0000000000000..d120a992c06a6 --- /dev/null +++ b/recipes/zeus_expected/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/zeus_expected/all/test_package/test_package.cpp b/recipes/zeus_expected/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..1577435ab0a55 --- /dev/null +++ b/recipes/zeus_expected/all/test_package/test_package.cpp @@ -0,0 +1,21 @@ +#include + +zeus::expected func(int argc) +{ + if (argc > 1) + { + return {}; + } + else + { + return zeus::unexpected(1); + } +} + +int main(int argc, char** argv) +{ + return func(argc) + .and_then([] { return zeus::expected {}; }) + .transform_error([](int) { return 0; }) + .error_or(1); +} diff --git a/recipes/zeus_expected/config.yml b/recipes/zeus_expected/config.yml new file mode 100644 index 0000000000000..3e22acea70d08 --- /dev/null +++ b/recipes/zeus_expected/config.yml @@ -0,0 +1,7 @@ +versions: + "1.2.0": + folder: all + "1.1.1": + folder: all + "1.1.0": + folder: all diff --git a/recipes/zfp/all/conandata.yml b/recipes/zfp/all/conandata.yml index 15264b6aa165c..626b44e46becd 100644 --- a/recipes/zfp/all/conandata.yml +++ b/recipes/zfp/all/conandata.yml @@ -1,7 +1,10 @@ sources: + "1.0.1": + url: "https://github.com/LLNL/zfp/archive/1.0.1.tar.gz" + sha256: "4984db6a55bc919831966dd17ba5e47ca7ac58668f4fd278ebd98cd2200da66f" "1.0.0": - url: "https://github.com/LLNL/zfp/archive/1.0.0.tar.gz" - sha256: "fe13b03141ee9b571692aed42ff76cf37c9dcda40f9a43a808870dca3558a57c" + 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 3221dda0f1571..451da2a028864 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 - - def validate(self): - if self.info.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: - 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.options.with_cuda: + self.output.warning("Conan package for CUDA is not available, this package will be used from system.") + if self.options.with_openmp: + self.output.warning("Conan package for OpenMP is not available, this package will be used from system.") + 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): 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_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 3e7309cad846c..ca1f6c2b3ad6d 100644 --- a/recipes/zfp/config.yml +++ b/recipes/zfp/config.yml @@ -1,4 +1,6 @@ versions: + "1.0.1": + folder: all "1.0.0": folder: all "0.5.5": diff --git a/recipes/zimg/all/conandata.yml b/recipes/zimg/all/conandata.yml index 401a58d84be23..808d05daf7b4d 100644 --- a/recipes/zimg/all/conandata.yml +++ b/recipes/zimg/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.0.5": + url: "https://github.com/sekrit-twc/zimg/archive/refs/tags/release-3.0.5.tar.gz" + sha256: "a9a0226bf85e0d83c41a8ebe4e3e690e1348682f6a2a7838f1b8cbff1b799bcf" "3.0.4": url: "https://github.com/sekrit-twc/zimg/archive/refs/tags/release-3.0.4.tar.gz" sha256: "219d1bc6b7fde1355d72c9b406ebd730a4aed9c21da779660f0a4c851243e32f" @@ -9,46 +12,28 @@ 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.5": + - patch_file: "patches/0001-msvc-remove-windows-target-platform.patch" + - patch_file: "patches/0002-msvc-solution.patch" "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..48a20f5432af3 100644 --- a/recipes/zimg/all/conanfile.py +++ b/recipes/zimg/all/conanfile.py @@ -1,21 +1,25 @@ -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 +from conan.tools.scm import Version 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") - homepage = "https://github.com/sekrit-twc/zimg" - url = "https://github.com/conan-io/conan-center-index" license = "WTFPL" - + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/sekrit-twc/zimg" + topics = ("image", "manipulation") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -26,17 +30,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 +47,110 @@ 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() + VirtualBuildEnv(self).generate() + tc = AutotoolsToolchain(self) + tc.generate() - 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") - - 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: + if Version(self.version) >= "3.0.5": + replace_in_file( + self, vcxproj_file, + "v143", + f"{platform_toolset}", + ) + else: + 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/zimg/config.yml b/recipes/zimg/config.yml index b142332a0fe4c..4841523950979 100644 --- a/recipes/zimg/config.yml +++ b/recipes/zimg/config.yml @@ -1,4 +1,6 @@ versions: + "3.0.5": + folder: "all" "3.0.4": folder: "all" "3.0.3": diff --git a/recipes/zint/all/conanfile.py b/recipes/zint/all/conanfile.py index 61596c6c982a7..c582bdfe4e8e1 100644 --- a/recipes/zint/all/conanfile.py +++ b/recipes/zint/all/conanfile.py @@ -5,7 +5,7 @@ from conan.tools.scm import Version import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class ZintConan(ConanFile): @@ -15,7 +15,7 @@ class ZintConan(ConanFile): homepage = "https://sourceforge.net/p/zint/code" license = "GPL-3.0" topics = ("barcode", "qt") - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -39,37 +39,27 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") if not self.options.with_qt: - 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 requirements(self): if self.options.with_libpng: - self.requires("libpng/1.6.38") - self.requires("zlib/1.2.13") + self.requires("libpng/[>=1.6 <2]") + self.requires("zlib/[>=1.2.11 <2]") if self.options.with_qt: - self.requires("qt/5.15.6") + self.requires("qt/5.15.10") def validate(self): - if self.info.options.with_qt and not self.dependencies["qt"].options.gui: + if self.options.with_qt and not self.dependencies["qt"].options.gui: raise ConanInvalidConfiguration(f"{self.ref} needs qt:gui=True") 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/zint/all/test_package/CMakeLists.txt b/recipes/zint/all/test_package/CMakeLists.txt index 14bd143a5e4a6..d4ac6daa22c07 100644 --- a/recipes/zint/all/test_package/CMakeLists.txt +++ b/recipes/zint/all/test_package/CMakeLists.txt @@ -1,6 +1,8 @@ cmake_minimum_required(VERSION 3.1) project(test_package LANGUAGES C) +enable_testing() + option(ZINT_WITH_QT "Zint has been built with Qt support") if(ZINT_WITH_QT) enable_language(CXX) @@ -8,10 +10,12 @@ endif() find_package(Zint REQUIRED CONFIG) -add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE Zint::Zint) +add_executable(test_package test_package.c) +target_link_libraries(test_package PRIVATE Zint::Zint) +add_test(NAME test_package COMMAND test_package) if(ZINT_WITH_QT) - add_executable(${PROJECT_NAME}_cpp test_package.cpp) - target_link_libraries(${PROJECT_NAME}_cpp PRIVATE Zint::QZint) + add_executable(test_package_cpp test_package.cpp) + target_link_libraries(test_package_cpp PRIVATE Zint::QZint) + add_test(NAME test_package_cpp COMMAND test_package_cpp) endif() diff --git a/recipes/zint/all/test_package/conanfile.py b/recipes/zint/all/test_package/conanfile.py index 1617e37109bc2..9523fb1ef2b63 100644 --- a/recipes/zint/all/test_package/conanfile.py +++ b/recipes/zint/all/test_package/conanfile.py @@ -1,7 +1,7 @@ from conan import ConanFile from conan.tools.build import can_run from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -import os +from conan.tools.files import chdir class TestPackageConan(ConanFile): @@ -27,8 +27,5 @@ def build(self): 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") - if self.options["zint"].with_qt: - bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package_cpp") - self.run(bin_path, env="conanrun") + with chdir(self, self.build_folder): + self.run(f"ctest --output-on-failure -C {self.settings.build_type}", env="conanrun") diff --git a/recipes/zint/all/test_v1_package/CMakeLists.txt b/recipes/zint/all/test_v1_package/CMakeLists.txt index d155f1e77d4aa..c23ed5cfe6d98 100644 --- a/recipes/zint/all/test_v1_package/CMakeLists.txt +++ b/recipes/zint/all/test_v1_package/CMakeLists.txt @@ -1,20 +1,10 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_v1_package) -option(ZINT_WITH_QT "Zint has been built with Qt support") -if(ZINT_WITH_QT) - enable_language(CXX) -endif() +enable_testing() 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() +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/zint/all/test_v1_package/conanfile.py b/recipes/zint/all/test_v1_package/conanfile.py index 1ce37b6a52e77..723b5e4a6fa80 100644 --- a/recipes/zint/all/test_v1_package/conanfile.py +++ b/recipes/zint/all/test_v1_package/conanfile.py @@ -1,5 +1,4 @@ from conans import ConanFile, CMake, tools -import os class TestPackageConan(ConanFile): @@ -14,8 +13,4 @@ def build(self): 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) + self.run(f"ctest --output-on-failure -C {self.settings.build_type}", run_environment=True) diff --git a/recipes/zlib-ng/all/conandata.yml b/recipes/zlib-ng/all/conandata.yml index 9824b847d63a5..ec5f329c3876a 100644 --- a/recipes/zlib-ng/all/conandata.yml +++ b/recipes/zlib-ng/all/conandata.yml @@ -1,10 +1,37 @@ sources: + "2.2.2": + url: "https://github.com/zlib-ng/zlib-ng/archive/refs/tags/2.2.2.tar.gz" + sha256: "fcb41dd59a3f17002aeb1bb21f04696c9b721404890bb945c5ab39d2cb69654c" + "2.2.1": + url: "https://github.com/zlib-ng/zlib-ng/archive/refs/tags/2.2.1.tar.gz" + sha256: "ec6a76169d4214e2e8b737e0850ba4acb806c69eeace6240ed4481b9f5c57cdf" + "2.1.7": + url: "https://github.com/zlib-ng/zlib-ng/archive/refs/tags/2.1.7.tar.gz" + sha256: "59e68f67cbb16999842daeb517cdd86fc25b177b4affd335cd72b76ddc2a46d8" + "2.1.6": + url: "https://github.com/zlib-ng/zlib-ng/archive/refs/tags/2.1.6.tar.gz" + sha256: "a5d504c0d52e2e2721e7e7d86988dec2e290d723ced2307145dedd06aeb6fef2" + "2.1.5": + url: "https://github.com/zlib-ng/zlib-ng/archive/refs/tags/2.1.5.tar.gz" + sha256: "3f6576971397b379d4205ae5451ff5a68edf6c103b2f03c4188ed7075fbb5f04" + "2.1.4": + url: "https://github.com/zlib-ng/zlib-ng/archive/refs/tags/2.1.4.tar.gz" + sha256: "a0293475e6a44a3f6c045229fe50f69dc0eebc62a42405a51f19d46a5541e77a" + "2.1.3": + url: "https://github.com/zlib-ng/zlib-ng/archive/refs/tags/2.1.3.tar.gz" + sha256: "d20e55f89d71991c59f1c5ad1ef944815e5850526c0d9cd8e504eaed5b24491a" + "2.1.2": + url: "https://github.com/zlib-ng/zlib-ng/archive/refs/tags/2.1.2.tar.gz" + sha256: "383560d6b00697c04e8878e26c0187b480971a8bce90ffd26a5a7b0f7ecf1a33" + "2.0.7": + url: "https://github.com/zlib-ng/zlib-ng/archive/refs/tags/2.0.7.tar.gz" + sha256: "6c0853bb27738b811f2b4d4af095323c3d5ce36ceed6b50e5f773204fb8f7200" "2.0.6": - url: "https://github.com/zlib-ng/zlib-ng/archive/2.0.6.tar.gz" + url: "https://github.com/zlib-ng/zlib-ng/archive/refs/tags/2.0.6.tar.gz" sha256: "8258b75a72303b661a238047cb348203d88d9dddf85d480ed885f375916fcab6" "2.0.5": - sha256: "eca3fe72aea7036c31d00ca120493923c4d5b99fe02e6d3322f7c88dbdcd0085" url: "https://github.com/zlib-ng/zlib-ng/archive/refs/tags/2.0.5.tar.gz" + sha256: "eca3fe72aea7036c31d00ca120493923c4d5b99fe02e6d3322f7c88dbdcd0085" "2.0.2": - sha256: "dd37886f22ca6890e403ea6c1d60f36eab1d08d2f232a35f5b02126621149d28" url: "https://github.com/zlib-ng/zlib-ng/archive/refs/tags/2.0.2.tar.gz" + sha256: "dd37886f22ca6890e403ea6c1d60f36eab1d08d2f232a35f5b02126621149d28" diff --git a/recipes/zlib-ng/all/conanfile.py b/recipes/zlib-ng/all/conanfile.py index 6f5453c4384df..3e9b57a60b9de 100644 --- a/recipes/zlib-ng/all/conanfile.py +++ b/recipes/zlib-ng/all/conanfile.py @@ -13,10 +13,11 @@ class ZlibNgConan(ConanFile): name = "zlib-ng" description = "zlib data compression library for the next generation systems" - topics = ("zlib", "compression") license ="Zlib" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/zlib-ng/zlib-ng/" + topics = ("zlib", "compression") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -26,26 +27,36 @@ class ZlibNgConan(ConanFile): "with_optim": [True, False], "with_new_strategies": [True, False], "with_native_instructions": [True, False], + "with_reduced_mem": [True, False], + "with_runtime_cpu_detection": [True, False], } default_options = { "shared": False, "fPIC": True, "zlib_compat": False, "with_gzfileop": True, - "with_optim": False, + "with_optim": True, "with_new_strategies": True, "with_native_instructions": False, + "with_reduced_mem": False, + "with_runtime_cpu_detection": True, } def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + if Version(self.version) < "2.1.0": + del self.options.with_reduced_mem + if Version(self.version) < "2.2.1": + del self.options.with_runtime_cpu_detection def configure(self): if self.options.shared: self.options.rm_safe("fPIC") self.settings.rm_safe("compiler.cppstd") self.settings.rm_safe("compiler.libcxx") + if self.options.zlib_compat: + self.provides = ["zlib"] def layout(self): cmake_layout(self, src_folder="src") @@ -55,17 +66,22 @@ def validate(self): raise ConanInvalidConfiguration("The option 'with_gzfileop' must be True when 'zlib_compat' is True.") 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["ZLIB_ENABLE_TESTS"] = False + tc.variables["ZLIBNG_ENABLE_TESTS"] = False + tc.variables["ZLIB_COMPAT"] = self.options.zlib_compat tc.variables["WITH_GZFILEOP"] = self.options.with_gzfileop tc.variables["WITH_OPTIM"] = self.options.with_optim tc.variables["WITH_NEW_STRATEGIES"] = self.options.with_new_strategies tc.variables["WITH_NATIVE_INSTRUCTIONS"] = self.options.with_native_instructions + if Version(self.version) >= "2.1.0": + tc.variables["WITH_REDUCED_MEM"] = self.options.with_reduced_mem + if Version(self.version) >= "2.2.1": + tc.variables["WITH_RUNTIME_CPU_DETECTION"] = self.options.with_runtime_cpu_detection tc.generate() def build(self): @@ -79,6 +95,7 @@ def package(self): 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")) # upstream CMakeLists intentionally hardcodes install_name with full # install path (to match autootools behavior), instead of @rpath fix_apple_shared_install_name(self) @@ -98,6 +115,12 @@ def package_info(self): self.cpp_info.libs = [f"z{suffix}"] if self.options.zlib_compat: self.cpp_info.defines.append("ZLIB_COMPAT") + #copied from zlib + self.cpp_info.set_property("cmake_find_mode", "both") + self.cpp_info.set_property("cmake_file_name", "ZLIB") + self.cpp_info.set_property("cmake_target_name", "ZLIB::ZLIB") + self.cpp_info.names["cmake_find_package"] = "ZLIB" + self.cpp_info.names["cmake_find_package_multi"] = "ZLIB" if self.options.with_gzfileop: self.cpp_info.defines.append("WITH_GZFILEOP") if not self.options.with_new_strategies: diff --git a/recipes/zlib-ng/all/test_package/CMakeLists.txt b/recipes/zlib-ng/all/test_package/CMakeLists.txt index 1afe7de5d08fc..f10e632412804 100644 --- a/recipes/zlib-ng/all/test_package/CMakeLists.txt +++ b/recipes/zlib-ng/all/test_package/CMakeLists.txt @@ -1,8 +1,14 @@ cmake_minimum_required(VERSION 3.8) project(test_package LANGUAGES C) -find_package(zlib-ng REQUIRED CONFIG) +if (ZLIB_COMPAT) + set(zlib_name ZLIB) +else() + set(zlib_name zlib-ng) +endif() + +find_package(${zlib_name} REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE zlib-ng::zlib-ng) +target_link_libraries(${PROJECT_NAME} PRIVATE ${zlib_name}::${zlib_name}) 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 0f34761d1525c..eabf8e03bfd74 100644 --- a/recipes/zlib-ng/all/test_package/conanfile.py +++ b/recipes/zlib-ng/all/test_package/conanfile.py @@ -1,12 +1,12 @@ from conan import ConanFile from conan.tools.build import can_run -from conan.tools.cmake import CMake, cmake_layout +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + generators = "CMakeDeps", "VirtualRunEnv" test_type = "explicit" def layout(self): @@ -15,6 +15,11 @@ def layout(self): def requirements(self): self.requires(self.tested_reference_str) + def generate(self): + tc = CMakeToolchain(self) + tc.variables["ZLIB_COMPAT"] = bool(self.dependencies["zlib-ng"].options.zlib_compat) + tc.generate() + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/zlib-ng/all/test_v1_package/conanfile.py b/recipes/zlib-ng/all/test_v1_package/conanfile.py index 38f4483872d47..d374156671cbb 100644 --- a/recipes/zlib-ng/all/test_v1_package/conanfile.py +++ b/recipes/zlib-ng/all/test_v1_package/conanfile.py @@ -8,6 +8,7 @@ class TestPackageConan(ConanFile): def build(self): cmake = CMake(self) + cmake.definitions["ZLIB_COMPAT"] = self.options["zlib-ng"].zlib_compat cmake.configure() cmake.build() diff --git a/recipes/zlib-ng/config.yml b/recipes/zlib-ng/config.yml index 7fb941786fa2d..d3e8e7960ca7d 100644 --- a/recipes/zlib-ng/config.yml +++ b/recipes/zlib-ng/config.yml @@ -1,4 +1,22 @@ versions: + "2.2.2": + folder: all + "2.2.1": + folder: all + "2.1.7": + folder: all + "2.1.6": + folder: all + "2.1.5": + folder: all + "2.1.4": + folder: all + "2.1.3": + folder: all + "2.1.2": + folder: all + "2.0.7": + folder: all "2.0.6": folder: all "2.0.5": diff --git a/recipes/zlib/all/conandata.yml b/recipes/zlib/all/conandata.yml index e2abd8cd4f339..e069fd42a135c 100644 --- a/recipes/zlib/all/conandata.yml +++ b/recipes/zlib/all/conandata.yml @@ -1,6 +1,18 @@ sources: + "1.3.1": + url: + - "https://zlib.net/fossils/zlib-1.3.1.tar.gz" + - "https://github.com/madler/zlib/releases/download/v1.3.1/zlib-1.3.1.tar.gz" + sha256: "9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23" + "1.3": + url: + - "https://zlib.net/fossils/zlib-1.3.tar.gz" + - "https://github.com/madler/zlib/releases/download/v1.3/zlib-1.3.tar.gz" + sha256: "ff0ba4c292013dbc27530b3a81e1f9a813cd39de01ca5e0f8bf355702efa593e" "1.2.13": - url: "https://zlib.net/fossils/zlib-1.2.13.tar.gz" + url: + - "https://zlib.net/fossils/zlib-1.2.13.tar.gz" + - "https://github.com/madler/zlib/releases/download/v1.2.13/zlib-1.2.13.tar.gz" sha256: "b3a24de97a8fdbc835b9833169501030b8977031bcb54b3b3ac13740f846ab30" "1.2.12": url: "https://zlib.net/fossils/zlib-1.2.12.tar.gz" @@ -9,12 +21,22 @@ sources: url: "https://zlib.net/fossils/zlib-1.2.11.tar.gz" sha256: "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1" patches: + "1.3.1": + - patch_file: "patches/1.3.1/0001-fix-cmake.patch" + patch_description: "separate static/shared builds, disable debug suffix" + patch_type: "conan" + "1.3": + - patch_file: "patches/1.3/0001-fix-cmake.patch" + patch_description: "separate static/shared builds, disable debug suffix, disable building examples" + patch_type: "conan" "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" + patch_description: "separate static/shared builds, disable debug suffix, disable building examples" + patch_type: "conan" "1.2.12": - patch_file: "patches/1.2.x/0001-fix-cmake.patch" - - patch_file: "patches/1.2.x/0002-gzguts-xcode12-compile-fix.patch" + patch_description: "separate static/shared builds, disable debug suffix, disable building examples" + patch_type: "conan" - 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" @@ -27,6 +49,9 @@ patches: sha256: "cdd69eb3251728b1875c8ecae6427b50aa750b4045ef984ab79b6c07b7e6dd3a" "1.2.11": - 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_description: "separate static/shared builds, disable debug suffix, disable building examples" + patch_type: "conan" - patch_file: "patches/1.2.x/0003-gzguts-fix-widechar-condition.patch" + patch_description: "fix condition for WIDECHAR usage" + patch_type: "portability" + patch_source: "https://github.com/madler/zlib/issues/268" diff --git a/recipes/zlib/all/conanfile.py b/recipes/zlib/all/conanfile.py index 716ee2007ab06..834fcf918bf94 100644 --- a/recipes/zlib/all/conanfile.py +++ b/recipes/zlib/all/conanfile.py @@ -60,6 +60,7 @@ def generate(self): # Correct for misuse of "${CMAKE_INSTALL_PREFIX}/" in CMakeLists.txt tc.variables["INSTALL_LIB_DIR"] = "lib" tc.variables["INSTALL_INC_DIR"] = "include" + tc.variables["ZLIB_BUILD_EXAMPLES"] = False tc.generate() def _patch_sources(self): diff --git a/recipes/zlib/all/patches/1.2.x/0002-gzguts-xcode12-compile-fix.patch b/recipes/zlib/all/patches/1.2.x/0002-gzguts-xcode12-compile-fix.patch deleted file mode 100644 index 3f81a6f53a248..0000000000000 --- a/recipes/zlib/all/patches/1.2.x/0002-gzguts-xcode12-compile-fix.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 4ff188d490445fe7bad629a94d5bf4b641d4ab8d Mon Sep 17 00:00:00 2001 -From: Tim Blechmann -Date: Thu, 2 Jul 2020 12:04:38 +0800 -Subject: [PATCH] xcode12 compile fix - ---- - gzguts.h | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/gzguts.h b/gzguts.h -index 990a4d2..c78cb40 100644 ---- a/gzguts.h -+++ b/gzguts.h -@@ -26,6 +26,10 @@ - # include - #endif - -+#ifdef __APPLE__ -+#include -+#endif -+ - #ifndef _POSIX_SOURCE - # define _POSIX_SOURCE - #endif --- -2.27.0 - diff --git a/recipes/zlib/all/patches/1.2.x/0003-gzguts-fix-widechar-condition.patch b/recipes/zlib/all/patches/1.2.x/0003-gzguts-fix-widechar-condition.patch index 56b3fbe76ce8e..3de4978c30661 100644 --- a/recipes/zlib/all/patches/1.2.x/0003-gzguts-fix-widechar-condition.patch +++ b/recipes/zlib/all/patches/1.2.x/0003-gzguts-fix-widechar-condition.patch @@ -1,8 +1,8 @@ diff --git a/gzguts.h b/gzguts.h -index c78cb40..4e9ec4f 100644 +index 990a4d2..6378d46 100644 --- a/gzguts.h +++ b/gzguts.h -@@ -43,7 +43,7 @@ +@@ -39,7 +39,7 @@ # include #endif diff --git a/recipes/zlib/all/patches/1.3.1/0001-fix-cmake.patch b/recipes/zlib/all/patches/1.3.1/0001-fix-cmake.patch new file mode 100644 index 0000000000000..036af67bc9b38 --- /dev/null +++ b/recipes/zlib/all/patches/1.3.1/0001-fix-cmake.patch @@ -0,0 +1,81 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 15ceebe..2f08574 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -59,7 +59,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}) +@@ -122,7 +121,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. + ) +@@ -133,7 +132,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) +@@ -147,14 +146,16 @@ 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}) + target_include_directories(zlib PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) +-add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) +-target_include_directories(zlibstatic PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) + 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 +@@ -167,19 +168,25 @@ 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 AND NOT(CMAKE_SYSTEM_NAME STREQUAL AIX)) + 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}" ) diff --git a/recipes/zlib/all/patches/1.3/0001-fix-cmake.patch b/recipes/zlib/all/patches/1.3/0001-fix-cmake.patch new file mode 100644 index 0000000000000..b2aa69d0684cf --- /dev/null +++ b/recipes/zlib/all/patches/1.3/0001-fix-cmake.patch @@ -0,0 +1,92 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 7f1b69f..618ea02 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -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}) +@@ -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,16 @@ 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 +166,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}" ) +@@ -193,7 +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() diff --git a/recipes/zlib/config.yml b/recipes/zlib/config.yml index 351c06f68201f..79c9c7d4f7785 100644 --- a/recipes/zlib/config.yml +++ b/recipes/zlib/config.yml @@ -1,4 +1,8 @@ versions: + "1.3.1": + folder: all + "1.3": + folder: all "1.2.13": folder: all "1.2.12": diff --git a/recipes/zmarok-semver/all/conanfile.py b/recipes/zmarok-semver/all/conanfile.py index 7a6a7d9fb2b10..f6c7fed3955f2 100644 --- a/recipes/zmarok-semver/all/conanfile.py +++ b/recipes/zmarok-semver/all/conanfile.py @@ -1,12 +1,13 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.files import apply_conandata_patches, copy, get +from conan.tools.apple import fix_apple_shared_install_name 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.50.0" +required_conan_version = ">=1.53.0" class ZmarokSemverConan(ConanFile): @@ -16,6 +17,7 @@ class ZmarokSemverConan(ConanFile): homepage = "https://github.com/zmarko/semver" description = "Semantic versioning for cpp14" topics = ("versioning", "semver", "semantic") + package_type = "library" settings = "os", "compiler", "arch", "build_type" options = { "shared": [True, False], @@ -26,29 +28,28 @@ class ZmarokSemverConan(ConanFile): "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: - del self.options.fPIC + self.options.rm_safe("fPIC") - 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): + cmake_layout(self, src_folder="src") def validate(self): - if self.info.settings.os == "Windows" and self.info.options.shared: + if self.settings.os == "Windows" and self.options.shared: raise ConanInvalidConfiguration("Shared library on Windows is not supported.") - if self.info.settings.compiler.cppstd: + if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, 14) def source(self): - get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=self.source_folder) - - def layout(self): - cmake_layout(self, src_folder="src") + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): gt = CMakeToolchain(self) @@ -74,8 +75,9 @@ def package(self): copy(self, "*.so", self.build_folder, lib_dir, keep_path=False) copy(self, "*.dylib", self.build_folder, lib_dir, keep_path=False) copy(self, "*.dll*", self.build_folder, os.path.join(self.package_folder, "bin"), keep_path=False) + fix_apple_shared_install_name(self) def package_info(self): self.cpp_info.libs = ["semver"] - if not self.settings.os in ["Windows"]: + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["m"] diff --git a/recipes/zmarok-semver/all/test_v1_package/CMakeLists.txt b/recipes/zmarok-semver/all/test_v1_package/CMakeLists.txt index d1576302a7460..0d20897301b68 100644 --- a/recipes/zmarok-semver/all/test_v1_package/CMakeLists.txt +++ b/recipes/zmarok-semver/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.11) -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(zmarok-semver CONFIG REQUIRED) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE zmarok-semver::zmarok-semver) - set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 14) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/zmqpp/all/conandata.yml b/recipes/zmqpp/all/conandata.yml index b8b843edf38c8..4bc0fe616e574 100644 --- a/recipes/zmqpp/all/conandata.yml +++ b/recipes/zmqpp/all/conandata.yml @@ -5,5 +5,11 @@ sources: patches: "4.2.0": - patch_file: "patches/0001-fix-cmake.patch" + patch_description: "use cci's zeromq, separate shared and static build" + patch_type: "conan" - patch_file: "patches/0002-missing-includes.patch" + patch_description: "include missing includes" + patch_type: "portability" - patch_file: "patches/0003-Allow-building-with-Werror-undef.patch" + patch_description: "fix WIN32 detection" + patch_type: "portability" diff --git a/recipes/zmqpp/all/conanfile.py b/recipes/zmqpp/all/conanfile.py index 8d4bf7d455227..a4ed7a7549f25 100644 --- a/recipes/zmqpp/all/conanfile.py +++ b/recipes/zmqpp/all/conanfile.py @@ -4,20 +4,20 @@ from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class ZmqppConan(ConanFile): name = "zmqpp" - 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." ) + license = "MPL-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/zeromq/zmqpp" topics = ("zmq", "0mq", "zeromq", "message-queue", "asynchronous") - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -28,6 +28,10 @@ class ZmqppConan(ConanFile): "fPIC": True, } + @property + def _min_cppstd(self): + return 11 + def export_sources(self): export_conandata_patches(self) @@ -37,24 +41,20 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") def layout(self): cmake_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 validate(self): if self.info.settings.compiler.get_safe("cppstd"): - check_min_cppstd(self, 11) + 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/zoe/all/conandata.yml b/recipes/zoe/all/conandata.yml new file mode 100644 index 0000000000000..a315e5dbd038a --- /dev/null +++ b/recipes/zoe/all/conandata.yml @@ -0,0 +1,33 @@ +sources: + "3.6": + url: "https://github.com/winsoft666/zoe/archive/refs/tags/v3.6.tar.gz" + sha256: "5cae2a51bbac0bfa54aab78a4d2b534a66bea7bc2d72764cfb5bc8e02a751927" + "3.3": + url: "https://github.com/winsoft666/zoe/archive/refs/tags/v3.3.tar.gz" + sha256: "e75d24690d16feff8bf1fc57d1943d545a5203ba769ff94034dc1f35f89927a5" + "3.1": + url: "https://github.com/winsoft666/zoe/archive/refs/tags/v3.1.tar.gz" + sha256: "4b5a0c0cac5fb61846875699cb7e013c84bc33d852041824bde7af80d793f15d" + "3.0": + url: "https://github.com/winsoft666/zoe/archive/refs/tags/v3.0.tar.gz" + sha256: "718c6de993bea2a4b1866070a8685e77cfa7929bbd9e22abb29e54c67a687a5e" +patches: + "3.3": + - patch_file: "patches/3.1-0002-support-macosx.patch" + patch_description: "support macosx" + patch_type: "portability" + "3.1": + - patch_file: "patches/3.1-0002-support-macosx.patch" + patch_description: "support macosx" + patch_type: "portability" + "3.0": + - patch_file: "patches/3.0-0001-follow-cxx-standards.patch" + patch_description: "include threads header" + patch_type: "portability" + - patch_file: "patches/3.0-0002-support-macosx.patch" + patch_description: "support macosx" + patch_type: "portability" + - patch_file: "patches/3.0-0003-fix-install-target.patch" + patch_description: "fix wrong install target" + patch_type: "bugfix" + patch_source: "https://github.com/winsoft666/zoe/pull/25" diff --git a/recipes/zoe/all/conanfile.py b/recipes/zoe/all/conanfile.py new file mode 100644 index 0000000000000..598bbd6c08ccd --- /dev/null +++ b/recipes/zoe/all/conanfile.py @@ -0,0 +1,98 @@ +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, apply_conandata_patches, export_conandata_patches, rmdir, replace_in_file +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 = ">=2.1" + +class ZoeConan(ConanFile): + name = "zoe" + description = "A multi-protocol, multi-threaded, resumable, cross-platform, open source, C++ file download library." + license = "GPL-3.0-only" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/winsoft666/zoe" + topics = ("curl", "download", "file", "ftp", "multithreading", "http", "libcurl", "rate-limit") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + implements = ["auto_shared_fpic"] + + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires("libcurl/[>=7.78.0 <9]") + self.requires("openssl/[>=1.1 <4]", transitive_headers=True) + + def validate(self): + check_min_cppstd(self, "11") + 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 build_requirements(self): + self.tool_requires("cmake/[>=3.16 <4]") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["ZOE_BUILD_SHARED_LIBS"] = self.options.shared + tc.variables["ZOE_USE_STATIC_CRT"] = is_msvc_static_runtime(self) + tc.variables["ZOE_BUILD_TESTS"] = False + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() + deps = CMakeDeps(self) + deps.generate() + + def _apply_patches(self): + apply_conandata_patches(self) + # Remove hardcoded CMAKE_CXX_STANDANRD in newer versions + if Version(self.version) >= "3.2": + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "set (CMAKE_CXX_STANDARD 11)", + "") + + def build(self): + self._apply_patches() + 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, "share")) + + def package_info(self): + libname = "zoe" if self.options.shared else "zoe-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("ZOE_EXPORTS") + else: + self.cpp_info.defines.append("ZOE_STATIC") + + # https://github.com/winsoft666/zoe/blob/master/src/CMakeLists.txt#L88 + if self.settings.os == "Windows": + self.cpp_info.system_libs = ["ws2_32", "crypt32"] + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") diff --git a/recipes/zoe/all/patches/3.0-0001-follow-cxx-standards.patch b/recipes/zoe/all/patches/3.0-0001-follow-cxx-standards.patch new file mode 100644 index 0000000000000..ced0610043cd8 --- /dev/null +++ b/recipes/zoe/all/patches/3.0-0001-follow-cxx-standards.patch @@ -0,0 +1,25 @@ +diff --git a/src/entry_handler.cpp b/src/entry_handler.cpp +index 5844a03..0dc25a5 100644 +--- a/src/entry_handler.cpp ++++ 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/src/md5.cpp b/src/md5.cpp +index 93dd21f..78a4b57 100644 +--- a/src/md5.cpp ++++ 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/zoe/all/patches/3.0-0002-support-macosx.patch b/recipes/zoe/all/patches/3.0-0002-support-macosx.patch new file mode 100644 index 0000000000000..64f500a421a85 --- /dev/null +++ b/recipes/zoe/all/patches/3.0-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/zoe/all/patches/3.0-0003-fix-install-target.patch b/recipes/zoe/all/patches/3.0-0003-fix-install-target.patch new file mode 100644 index 0000000000000..8dc598ccf7ec9 --- /dev/null +++ b/recipes/zoe/all/patches/3.0-0003-fix-install-target.patch @@ -0,0 +1,13 @@ +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 34f38b4..85c3a14 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -116,7 +116,7 @@ endif() + + install(DIRECTORY ../include/zoe DESTINATION include) + +-install(TARGETS ${ASHE_LIB_NAME} ++install(TARGETS ${ZOE_LIB_NAME} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} diff --git a/recipes/zoe/all/patches/3.1-0002-support-macosx.patch b/recipes/zoe/all/patches/3.1-0002-support-macosx.patch new file mode 100644 index 0000000000000..deb4b7f1cb9e7 --- /dev/null +++ b/recipes/zoe/all/patches/3.1-0002-support-macosx.patch @@ -0,0 +1,40 @@ +diff --git a/src/file_util.cpp b/src/file_util.cpp +index 386bfc8..70086be 100644 +--- a/src/file_util.cpp ++++ b/src/file_util.cpp +@@ -47,6 +47,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); +@@ -182,6 +185,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 +@@ -266,6 +271,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/zoe/all/test_package/CMakeLists.txt b/recipes/zoe/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..573c0d90172aa --- /dev/null +++ b/recipes/zoe/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.15) + +project(test_package LANGUAGES CXX) + +find_package(zoe REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE zoe::zoe) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/zoe/all/test_package/conanfile.py b/recipes/zoe/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fb96656f203 --- /dev/null +++ b/recipes/zoe/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/zoe/all/test_package/test_package.cpp b/recipes/zoe/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..3e7bf50d85e8c --- /dev/null +++ b/recipes/zoe/all/test_package/test_package.cpp @@ -0,0 +1,13 @@ +#include "zoe/zoe.h" + +int main(int argc, char** argv) { + using namespace zoe; + + Zoe::GlobalInit(); + + Zoe efd; + + Zoe::GlobalUnInit(); + + return 0; +} diff --git a/recipes/zoe/config.yml b/recipes/zoe/config.yml new file mode 100644 index 0000000000000..ac84b262b6517 --- /dev/null +++ b/recipes/zoe/config.yml @@ -0,0 +1,9 @@ +versions: + "3.6": + folder: all + "3.3": + folder: all + "3.1": + folder: all + "3.0": + folder: all diff --git a/recipes/zookeeper-client-c/all/conandata.yml b/recipes/zookeeper-client-c/all/conandata.yml new file mode 100644 index 0000000000000..30c4962751575 --- /dev/null +++ b/recipes/zookeeper-client-c/all/conandata.yml @@ -0,0 +1,23 @@ +sources: + "3.9.1": + url: "https://archive.apache.org/dist/zookeeper/zookeeper-3.9.1/apache-zookeeper-3.9.1.tar.gz" + sha256: "918f0fcf4ca8c53c2cccb97237ea72d2ccba978233ca85eff08f8ba077a8dadf" + "3.9.0": + url: "https://archive.apache.org/dist/zookeeper/zookeeper-3.9.0/apache-zookeeper-3.9.0.tar.gz" + sha256: "c7af07e7411c798398bb8cd50f47780d8e014831666c41df6ec6540c143c0da2" + "3.8.1": + url: "https://archive.apache.org/dist/zookeeper/zookeeper-3.8.1/apache-zookeeper-3.8.1.tar.gz" + sha256: "ccc16850c8ab2553583583234d11c813061b5ea5f3b8ff1d740cde6c1fd1e219" +patches: + "3.9.1": + - patch_file: "patches/3.8.1-0001-add-install.patch" + patch_description: "add installer, disable cli program" + patch_type: "conan" + "3.9.0": + - patch_file: "patches/3.8.1-0001-add-install.patch" + patch_description: "add installer, disable cli program" + patch_type: "conan" + "3.8.1": + - patch_file: "patches/3.8.1-0001-add-install.patch" + patch_description: "add installer, disable cli program" + patch_type: "conan" diff --git a/recipes/zookeeper-client-c/all/conanfile.py b/recipes/zookeeper-client-c/all/conanfile.py new file mode 100644 index 0000000000000..020e3c8246146 --- /dev/null +++ b/recipes/zookeeper-client-c/all/conanfile.py @@ -0,0 +1,96 @@ +from conan import ConanFile +from conan.tools.env import VirtualBuildEnv +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 ZookeeperClientCConan(ConanFile): + name = "zookeeper-client-c" + description = "ZooKeeper is a centralized service for maintaining configuration information, naming, providing distributed synchronization, and providing group services." + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://zookeeper.apache.org/" + topics = ("zookeeper", "client") + settings = "os", "arch", "compiler", "build_type" + package_type = "static-library" + options = { + "fPIC": [True, False], + "with_cyrus_sasl": [True, False], + "with_openssl": [True, False], + } + default_options = { + "fPIC": True, + "with_cyrus_sasl": False, + "with_openssl": False, + } + short_paths = 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): + 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_cyrus_sasl: + self.requires("cyrus-sasl/2.1.28") + if self.options.with_openssl: + self.requires("openssl/[>=1.1 <4]") + + def build_requirements(self): + self.tool_requires("maven/3.9.4") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["WANT_CPPUNIT"] = False + tc.variables["WITH_CYRUS_SASL"] = "ON" if self.options.with_cyrus_sasl else "OFF" + tc.variables["WITH_OPENSSL"] = "ON" if self.options.with_openssl else "OFF" + tc.generate() + deps = CMakeDeps(self) + deps.generate() + bvenv = VirtualBuildEnv(self) + bvenv.generate() + + def build(self): + apply_conandata_patches(self) + + # We have to install maven to generate jute files which are required by zookeeper-client + # Override maven.repo.local to avoid writing to ~/.m2 + m2_repository = os.path.join(self.build_folder, "m2", "repository") + self.run(f'mvn compile -Dmaven.repo.local="{m2_repository}"', cwd=os.path.join(self.source_folder, "zookeeper-jute")) + + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, "zookeeper-client", "zookeeper-client-c")) + cmake.build() + + def package(self): + copy(self, pattern="LICENSE", + dst=os.path.join(self.package_folder, "licenses"), + src=os.path.join(self.source_folder, "zookeeper-client", "zookeeper-client-c") + ) + cmake = CMake(self) + cmake.install() + + def package_info(self): + self.cpp_info.libs = ["zookeeper", "hashtable"] + self.cpp_info.defines.append("USE_STATIC_LIB") + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["rt", "pthread", "m"]) + + if self.settings.os == "Windows": + self.cpp_info.system_libs.extend(["wsock32", "ws2_32", ]) diff --git a/recipes/zookeeper-client-c/all/patches/3.8.1-0001-add-install.patch b/recipes/zookeeper-client-c/all/patches/3.8.1-0001-add-install.patch new file mode 100644 index 0000000000000..fe59dd04ecacb --- /dev/null +++ b/recipes/zookeeper-client-c/all/patches/3.8.1-0001-add-install.patch @@ -0,0 +1,54 @@ +diff --git a/zookeeper-client/zookeeper-client-c/CMakeLists.txt b/zookeeper-client/zookeeper-client-c/CMakeLists.txt +index 5d0175e..9349bc0 100644 +--- a/zookeeper-client/zookeeper-client-c/CMakeLists.txt ++++ b/zookeeper-client/zookeeper-client-c/CMakeLists.txt +@@ -228,16 +228,6 @@ if(CYRUS_SASL_FOUND) + target_link_libraries(zookeeper PUBLIC CyrusSASL) + endif() + +-# cli executable +-add_executable(cli src/cli.c) +-target_link_libraries(cli zookeeper) +- +-# load_gen executable +-if(WANT_SYNCAPI AND NOT WIN32) +- add_executable(load_gen src/load_gen.c) +- target_link_libraries(load_gen zookeeper) +-endif() +- + # tests + set(test_sources + tests/TestDriver.cc +@@ -290,3 +280,32 @@ if(WANT_CPPUNIT) + "ZKROOT=${CMAKE_CURRENT_SOURCE_DIR}/../.." + "CLASSPATH=$CLASSPATH:$CLOVER_HOME/lib/clover*.jar") + endif() ++ ++include(GNUInstallDirs) ++ ++install( ++ TARGETS zookeeper ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ++) ++ ++install( ++ TARGETS hashtable ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ++) ++ ++install(FILES ++ ${CMAKE_CURRENT_SOURCE_DIR}/include/proto.h ++ ${CMAKE_CURRENT_SOURCE_DIR}/include/recordio.h ++ ${CMAKE_CURRENT_SOURCE_DIR}/include/win_getopt.h ++ ${CMAKE_CURRENT_SOURCE_DIR}/include/winconfig.h ++ ${CMAKE_CURRENT_SOURCE_DIR}/include/zookeeper.h ++ ${CMAKE_CURRENT_SOURCE_DIR}/include/zookeeper_log.h ++ ${CMAKE_CURRENT_SOURCE_DIR}/include/zookeeper_version.h ++ ${CMAKE_CURRENT_SOURCE_DIR}/generated/zookeeper.jute.h ++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) diff --git a/recipes/zookeeper-client-c/all/test_package/CMakeLists.txt b/recipes/zookeeper-client-c/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..614f9306973ce --- /dev/null +++ b/recipes/zookeeper-client-c/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package C) + +find_package(zookeeper-client-c REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE zookeeper-client-c::zookeeper-client-c) diff --git a/recipes/zookeeper-client-c/all/test_package/conanfile.py b/recipes/zookeeper-client-c/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fb96656f203 --- /dev/null +++ b/recipes/zookeeper-client-c/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/zookeeper-client-c/all/test_package/test_package.c b/recipes/zookeeper-client-c/all/test_package/test_package.c new file mode 100644 index 0000000000000..d3ce6ffa2d6b7 --- /dev/null +++ b/recipes/zookeeper-client-c/all/test_package/test_package.c @@ -0,0 +1,8 @@ +#include +#include "zookeeper_log.h" + +int main(void) { + zookeeper_close(0); + + return 0; +} diff --git a/recipes/zookeeper-client-c/config.yml b/recipes/zookeeper-client-c/config.yml new file mode 100644 index 0000000000000..2bc00633d1dbc --- /dev/null +++ b/recipes/zookeeper-client-c/config.yml @@ -0,0 +1,7 @@ +versions: + "3.9.1": + folder: all + "3.9.0": + folder: all + "3.8.1": + folder: all diff --git a/recipes/zopfli/all/conanfile.py b/recipes/zopfli/all/conanfile.py index 1f0b88e512435..35dd2870f9a77 100644 --- a/recipes/zopfli/all/conanfile.py +++ b/recipes/zopfli/all/conanfile.py @@ -4,7 +4,7 @@ from conan.tools.scm import Version import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class ZopfliConan(ConanFile): @@ -16,8 +16,8 @@ class ZopfliConan(ConanFile): "Zopfli Compression Algorithm is a compression library programmed in C " "to perform very good, but slow, deflate or zlib compression." ) - topics = ("zopfli", "compression", "deflate", "gzip", "zlib") - + topics = ("compression", "deflate", "gzip", "zlib") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -34,25 +34,15 @@ def config_options(self): 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 + 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/zopfli/all/test_v1_package/CMakeLists.txt b/recipes/zopfli/all/test_v1_package/CMakeLists.txt index 0d2662cb23a48..0d20897301b68 100644 --- a/recipes/zopfli/all/test_v1_package/CMakeLists.txt +++ b/recipes/zopfli/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(Zopfli REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE Zopfli::libzopfli) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/zpp_bits/all/conandata.yml b/recipes/zpp_bits/all/conandata.yml index 171e8ff0c9789..8ce4aa57f1915 100644 --- a/recipes/zpp_bits/all/conandata.yml +++ b/recipes/zpp_bits/all/conandata.yml @@ -1,7 +1,25 @@ sources: + "4.4.25": + url: "https://github.com/eyalz800/zpp_bits/archive/v4.4.25.tar.gz" + sha256: "d4afb8cf73aec19686928445e912dbbe8d39bffdac43ea69b4781f145195a09e" + "4.4.24": + url: "https://github.com/eyalz800/zpp_bits/archive/v4.4.24.tar.gz" + sha256: "eff8bf4507f26e670ddf760374c9b691abf501426c468b5fd938cc8d53985153" + "4.4.20": + url: "https://github.com/eyalz800/zpp_bits/archive/v4.4.20.tar.gz" + sha256: "13023d3752392d64f89113bf8099a2a50b2602a7e26a2fdf78a27e327104819c" + "4.4.19": + url: "https://github.com/eyalz800/zpp_bits/archive/v4.4.19.tar.gz" + sha256: "1d8f92e616d61cd54cb2582280cc5a28e4457d8d9cfc331137859f8ef29ff637" + "4.4.18": + url: "https://github.com/eyalz800/zpp_bits/archive/v4.4.18.tar.gz" + sha256: "c81a221a3d857218d990aa39f420f4cb5cdbe906672d22286b871355068bc14b" + "4.4.17": + url: "https://github.com/eyalz800/zpp_bits/archive/v4.4.17.tar.gz" + sha256: "e6aacf3fbea7ee16a9b55a8622665d37b157efad321750876aa5c15ed8ac65e6" + "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" - "4.1.2": - url: "https://github.com/eyalz800/zpp_bits/archive/refs/tags/v4.4.12.tar.gz" - sha256: "0060c36d394ab1fb340120a7d14e45657a72419fd1745426e75d820980fa095a" diff --git a/recipes/zpp_bits/all/conanfile.py b/recipes/zpp_bits/all/conanfile.py index 56f8124709c3c..6b48c8af049c7 100644 --- a/recipes/zpp_bits/all/conanfile.py +++ b/recipes/zpp_bits/all/conanfile.py @@ -3,7 +3,6 @@ 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, check_min_vs import os @@ -17,6 +16,7 @@ class ZppBitsConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/eyalz800/zpp_bits" topics = ("serialization", "rpc", "header-only") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -30,6 +30,8 @@ def _compilers_minimum_version(self): "gcc": "11", "clang": "12", "apple-clang": "13.1", + "Visual Studio": "17", + "msvc": "193", } def layout(self): @@ -41,19 +43,17 @@ def package_id(self): def validate(self): if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, self._min_cppstd) - check_min_vs(self, 193) - if not is_msvc(self): - 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] + 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.", - ) + 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) diff --git a/recipes/zpp_bits/config.yml b/recipes/zpp_bits/config.yml index ba6154274881b..e5c2dd1bf22b4 100644 --- a/recipes/zpp_bits/config.yml +++ b/recipes/zpp_bits/config.yml @@ -1,5 +1,17 @@ versions: - "4.4.12": + "4.4.25": + folder: all + "4.4.24": + folder: all + "4.4.20": + folder: all + "4.4.19": folder: all - "4.1.2": + "4.4.18": + folder: all + "4.4.17": + folder: all + "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..118abd17e3a22 --- /dev/null +++ b/recipes/zpp_throwing/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "1.0.1": + url: "https://github.com/eyalz800/zpp_throwing/archive/v1.0.1.tar.gz" + sha256: "c15651ad36f9ddcb51e6244b0a78dbdebf7be8748b3e7ffe1c7339f0e41fd411" + "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..7fb36897fcbae --- /dev/null +++ b/recipes/zpp_throwing/all/conanfile.py @@ -0,0 +1,89 @@ +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 +import os + +required_conan_version = ">=1.50.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") + package_type = "header-library" + 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], 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..7b06dd8bf61ea --- /dev/null +++ b/recipes/zpp_throwing/config.yml @@ -0,0 +1,5 @@ +versions: + "1.0.1": + folder: all + "1.0": + folder: all diff --git a/recipes/zserio/all/conandata.yml b/recipes/zserio/all/conandata.yml new file mode 100644 index 0000000000000..7a037e6e14e17 --- /dev/null +++ b/recipes/zserio/all/conandata.yml @@ -0,0 +1,41 @@ +sources: + "2.15.0": + runtime: + url: "https://github.com/ndsev/zserio/releases/download/v2.15.0/zserio-2.15.0-runtime-libs.zip" + sha256: "6bfc82723715dccc4022f1aaf590513f4105f402cf33e3cf7bd15b04e203b218" + compiler: + url: "https://github.com/ndsev/zserio/releases/download/v2.15.0/zserio-2.15.0-bin.zip" + sha256: "17398de9856cc48e05e37eab34783f5d421a758f65efad6a20672f2547fc60b8" + license: + url: "https://raw.githubusercontent.com/ndsev/zserio/v2.15.0/LICENSE" + sha256: "8fd7b040fc223bb07551dfed490df0d55d6af25e331e58bc7c7599163ed1bb5a" + "2.14.1": + runtime: + url: "https://github.com/ndsev/zserio/releases/download/v2.14.1/zserio-2.14.1-runtime-libs.zip" + sha256: "ae3d7660ed3dd02fc77f535d7c7c721d9f03179c441efd0f4d09dc889da929fc" + compiler: + url: "https://github.com/ndsev/zserio/releases/download/v2.14.1/zserio-2.14.1-bin.zip" + sha256: "3280d620b2c23e01cc2e73bae9b60c93f94b23859c68edb1f105ba499b377049" + license: + url: "https://raw.githubusercontent.com/ndsev/zserio/v2.14.1/LICENSE" + sha256: "8fd7b040fc223bb07551dfed490df0d55d6af25e331e58bc7c7599163ed1bb5a" + "2.14.0": + runtime: + url: "https://github.com/ndsev/zserio/releases/download/v2.14.0/zserio-2.14.0-runtime-libs.zip" + sha256: "6002bfe179333435c84d3be2cfb612c008bd52837512aecea8a888e4a3139564" + compiler: + url: "https://github.com/ndsev/zserio/releases/download/v2.14.0/zserio-2.14.0-bin.zip" + sha256: "c1d4668371ad3543cb24f86b218640da7f720f31afe3f8af2d427114d7c7ae5c" + license: + url: "https://raw.githubusercontent.com/ndsev/zserio/v2.14.0/LICENSE" + sha256: "8fd7b040fc223bb07551dfed490df0d55d6af25e331e58bc7c7599163ed1bb5a" + "2.13.0": + runtime: + url: "https://github.com/ndsev/zserio/releases/download/v2.13.0/zserio-2.13.0-runtime-libs.zip" + sha256: "a720bd3208190f44b232296c11f1a3880154431f2f005e7db8f07ab01c9d235d" + compiler: + url: "https://github.com/ndsev/zserio/releases/download/v2.13.0/zserio-2.13.0-bin.zip" + sha256: "be5cf2a08aa91adac034f12609ea0a697d9f3ef7a00c1c38e6b997f9455dacd4" + license: + url: "https://raw.githubusercontent.com/ndsev/zserio/v2.13.0/LICENSE" + sha256: "7049b75154737fd45754917ba3d1027ad0b00beac15cb8931edaee4de40978ac" diff --git a/recipes/zserio/all/conanfile.py b/recipes/zserio/all/conanfile.py new file mode 100644 index 0000000000000..6a69b2c814401 --- /dev/null +++ b/recipes/zserio/all/conanfile.py @@ -0,0 +1,128 @@ +import os + +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import copy, download, get +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.scm import Version + +required_conan_version = ">=1.54.0" + +class ZserioConanFile(ConanFile): + name = "zserio" + description = "Zserio C++ Runtime Library" + license = "BSD-3-Clause" + url = "https://github.com/conan-io/conan-center-index/" + homepage = "https://zserio.org" + topics = ("zserio", "cpp", "c++", "serialization") + package_type = "static-library" + settings = "os", "arch", "compiler", "build_type" + short_paths = True # TODO: remove in conan v2 + options = { + "fPIC": [True, False] + } + default_options = { + "fPIC": True + } + + @property + def _compilers_minimum_version(self): + # https://github.com/ndsev/zserio/tree/master/compiler/extensions/cpp#supported-compilers + return { + "apple-clang": "11", + "clang": "11", + "gcc": "5", + "msvc": "191", + "Visual Studio": "15", + } + + @property + def _min_cppstd(self): + return 11 + + def export_sources(self): + if Version(self.version) < "2.14.0": + copy(self, "zserio_compiler.cmake", self.recipe_folder, 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 validate(self): + if self.settings.os not in ["Linux", "Windows", "Macos"]: + raise ConanInvalidConfiguration(f"{self.ref} doesn't support '{self.settings.os}'.") + + # experimental Macos support + if self.settings.os == "Macos": + self.output.warning("Macos is support is experimental! It's not (yet) supported by the upstream!") + + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + + minimum_compiler_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_compiler_version and Version(self.settings.compiler.version) < minimum_compiler_version: + raise ConanInvalidConfiguration( + f"Compiler version '{self.settings.compiler.version}' not supported, " + f"minumum is '{minimum_compiler_version}'!" + ) + + def source(self): + sources = self.conan_data["sources"][self.version] + get(self, **sources["runtime"], strip_root=True) + download(self, filename="LICENSE", **sources["license"]) + + def generate(self): + tc = CMakeToolchain(self) + if not self.settings.get_safe("compiler.cppstd"): + tc.variables["CMAKE_CXX_STANDARD"] = str(self._min_cppstd) + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure(build_script_folder="cpp") + cmake.build() + sources = self.conan_data["sources"][self.version] + get(self, **sources["compiler"], pattern="zserio.jar") + if Version(self.version) >= "2.14.0": + get(self, **sources["compiler"], pattern="cmake/zserio_compiler.cmake") + + @property + def _cmake_module_path(self): + return os.path.join("lib", "cmake", "zserio") + + def package(self): + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + + include_dir = os.path.join(self.package_folder, "include") + lib_dir = os.path.join(self.package_folder, "lib") + copy(self, "*.h", os.path.join(self.source_folder, "cpp"), include_dir) + copy(self, "*.lib", self.build_folder, lib_dir, keep_path=False) + copy(self, "*.a", self.build_folder, lib_dir, keep_path=False) + + copy(self, "zserio.jar", self.build_folder, os.path.join(self.package_folder, "bin")) + if Version(self.version) >= "2.14.0": + # from 2.14.0 the cmake script is available directly in zserio repository + copy(self, "zserio_compiler.cmake", os.path.join(self.build_folder, "cmake"), + os.path.join(self.package_folder, self._cmake_module_path)) + else: + copy(self, "zserio_compiler.cmake", self.export_sources_folder, + os.path.join(self.package_folder, self._cmake_module_path)) + + def package_info(self): + self.cpp_info.libs = ["ZserioCppRuntime"] + self.cpp_info.set_property("cmake_target_name", "zserio::ZserioCppRuntime") + + zserio_jar_file = os.path.join(self.package_folder, "bin", "zserio.jar") + self.buildenv_info.define("ZSERIO_JAR_FILE", zserio_jar_file) + + self.cpp_info.builddirs.append(self._cmake_module_path) + zserio_compiler_module = os.path.join(self.package_folder, self._cmake_module_path, + "zserio_compiler.cmake") + self.cpp_info.set_property("cmake_build_modules", [zserio_compiler_module]) + + # TODO: remove in conan v2 + self.env_info.ZSERIO_JAR_FILE = zserio_jar_file diff --git a/recipes/zserio/all/test_package/CMakeLists.txt b/recipes/zserio/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..e3ab3ca5ca033 --- /dev/null +++ b/recipes/zserio/all/test_package/CMakeLists.txt @@ -0,0 +1,21 @@ +cmake_minimum_required(VERSION 3.15) + +project(test_package LANGUAGES CXX) + +find_package(zserio REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE zserio::ZserioCppRuntime) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) + +# check that ZSERIO_JAR_FILE exists +if (NOT DEFINED ENV{ZSERIO_JAR_FILE}) + message(FATAL_ERROR "ZSERIO_JAR_FILE in not defined!") +endif () +if (NOT EXISTS $ENV{ZSERIO_JAR_FILE}) + message(FATAL_ERROR "ZSERIO_JAR_FILE '$ENV{ZSERIO_JAR_FILE}' does not exist!") +endif () +# check that zserio_generate_cpp function is available +if (NOT COMMAND zserio_generate_cpp) + message(FATAL_ERROR("Function 'zserio_generate_cpp' is not available!")) +endif () diff --git a/recipes/zserio/all/test_package/conanfile.py b/recipes/zserio/all/test_package/conanfile.py new file mode 100644 index 0000000000000..174d5cb36b6e7 --- /dev/null +++ b/recipes/zserio/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_layout, CMake + +class ZserioTestPackageConanFile(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualBuildEnv", "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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/zserio/all/test_package/test_package.cpp b/recipes/zserio/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..b1416a5ae2ec0 --- /dev/null +++ b/recipes/zserio/all/test_package/test_package.cpp @@ -0,0 +1,15 @@ +#include +#include + +int main(int argc, char* argv[]) +{ + zserio::BitBuffer bitBuffer(64); + zserio::BitStreamWriter writer(bitBuffer); + const uint64_t value = UINT64_MAX; + writer.writeBits64(value, 64); + + zserio::BitStreamReader reader(writer.getWriteBuffer(), writer.getBitPosition(), zserio::BitsTag()); + const uint64_t readValue = reader.readBits64(64); + + return value == readValue ? 0 : 1; +} diff --git a/recipes/zserio/all/zserio_compiler.cmake b/recipes/zserio/all/zserio_compiler.cmake new file mode 100644 index 0000000000000..7d82a869042ee --- /dev/null +++ b/recipes/zserio/all/zserio_compiler.cmake @@ -0,0 +1,69 @@ +function(zserio_generate_cpp) + find_program(JAVA java) + if (NOT JAVA) + message(FATAL_ERROR "Could not find java!") + endif() + if (NOT DEFINED ENV{ZSERIO_JAR_FILE} OR NOT EXISTS $ENV{ZSERIO_JAR_FILE}) + message(FATAL_ERROR "Could not fine zserio.jar!") + endif() + + cmake_parse_arguments(ZSERIO_GENERATE + "" + "TARGET;SRC_DIR;MAIN_ZS;GEN_DIR" + "EXTRA_ARGS" + ${ARGN}) + + # check required arguments + foreach (ARG TARGET GEN_DIR) + if (NOT DEFINED ZSERIO_GENERATE_${ARG}) + message(FATAL_ERROR "No value defined for required argument ${ARG}!") + endif () + endforeach () + + # default values + if (NOT DEFINED ZSERIO_GENERATE_SRC_DIR) + set(ZSERIO_GENERATE_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}") + endif () + if (NOT DEFINED ZSERIO_GENERATE_MAIN_ZS) + # try to get a single main zs + get_target_property(ZS_SOURCES ${ZSERIO_GENERATE_TARGET} SOURCES) + list(FILTER ZS_SOURCES INCLUDE REGEX "\\.zs$") + list(LENGTH ZS_SOURCES ZS_SOURCES_LENGTH) + if (${ZS_SOURCES_LENGTH} EQUAL 1) + list(GET ZS_SOURCES 0 ZSERIO_GENERATE_MAIN_ZS) + message(STATUS "Found main '*.zs' file: '${ZSERIO_GENERATE_MAIN_ZS}'") + else () + message(FATAL_ERROR "Main '*.zs* file not specifid and cannot be detected!") + endif () + endif () + + set(ZSERIO_COMMAND + ${JAVA} -jar $ENV{ZSERIO_JAR_FILE} + -src ${ZSERIO_GENERATE_SRC_DIR} ${ZSERIO_GENERATE_MAIN_ZS} + -cpp ${ZSERIO_GENERATE_GEN_DIR} + ${ZSERIO_GENERATE_EXTRA_ARGS} + ) + + # run the generator during configure phase, zserio has built in support to prevent sources re-generation + # and thus it should't make problems when cmake reconfigure is triggered from another reason + execute_process( + COMMAND ${ZSERIO_COMMAND} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + RESULT_VARIABLE ZSERIO_GENERATE_RESULT) + + if (NOT ${ZSERIO_GENERATE_RESULT} EQUAL 0) + message(FATAL_ERROR "Zserio generator failed!") + endif () + + # ensure cmake reconfigure when zserio sources are changed + file(GLOB_RECURSE ZSERIO_SOURCES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" + "${ZSERIO_GENERATE_SRC_DIR}/*.zs") + set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${ZSERIO_SOURCES} $ENV{ZSERIO_JAR_FILE}) + + file(GLOB_RECURSE GENERATED_SOURCES RELATIVE "${CMAKE_CURRENT_BINARY_DIR}" + "${ZSERIO_GENERATE_GEN_DIR}/*.h" + "${ZSERIO_GENERATE_GEN_DIR}/*.cpp") + + set_source_files_properties(${GENERATED_SOURCES} PROPERTIES GENERATED TRUE) + target_sources(${ZSERIO_GENERATE_TARGET} PRIVATE ${GENERATED_SOURCES}) +endfunction() diff --git a/recipes/zserio/config.yml b/recipes/zserio/config.yml new file mode 100644 index 0000000000000..723c11ae74ab0 --- /dev/null +++ b/recipes/zserio/config.yml @@ -0,0 +1,9 @@ +versions: + "2.15.0": + folder: all + "2.14.1": + folder: all + "2.14.0": + folder: all + "2.13.0": + folder: all diff --git a/recipes/zstd/all/conandata.yml b/recipes/zstd/all/conandata.yml index 465b4c1908947..03a332ccef7aa 100644 --- a/recipes/zstd/all/conandata.yml +++ b/recipes/zstd/all/conandata.yml @@ -1,56 +1,40 @@ sources: + "1.5.6": + url: "https://github.com/facebook/zstd/releases/download/v1.5.6/zstd-1.5.6.tar.gz" + sha256: "8c29e06cf42aacc1eafc4077ae2ec6c6fcb96a626157e0593d5e82a34fd403c1" + "1.5.5": + url: "https://github.com/facebook/zstd/releases/download/v1.5.5/zstd-1.5.5.tar.gz" + sha256: "9c4396cc829cfae319a6e2615202e82aad41372073482fce286fac78646d3ee4" "1.5.2": - url: "https://github.com/facebook/zstd/archive/v1.5.2.tar.gz" - sha256: "f7de13462f7a82c29ab865820149e778cbfe01087b3a55b5332707abf9db4a6e" - "1.5.1": - url: "https://github.com/facebook/zstd/archive/v1.5.1.tar.gz" - sha256: "dc05773342b28f11658604381afd22cb0a13e8ba17ff2bd7516df377060c18dd" + url: "https://github.com/facebook/zstd/releases/download/v1.5.2/zstd-1.5.2.tar.gz" + sha256: "7c42d56fac126929a6a85dbc73ff1db2411d04f104fae9bdea51305663a83fd0" "1.5.0": - url: "https://github.com/facebook/zstd/archive/v1.5.0.tar.gz" - sha256: "0d9ade222c64e912d6957b11c923e214e2e010a18f39bec102f572e693ba2867" - "1.4.9": - url: "https://github.com/facebook/zstd/archive/v1.4.9.tar.gz" - sha256: "acf714d98e3db7b876e5b540cbf6dee298f60eb3c0723104f6d3f065cd60d6a8" - "1.4.8": - url: "https://github.com/facebook/zstd/archive/v1.4.8.tar.gz" - sha256: "f176f0626cb797022fbf257c3c644d71c1c747bb74c32201f9203654da35e9fa" - "1.4.7": - url: "https://github.com/facebook/zstd/archive/v1.4.7.tar.gz" - sha256: "085500c8d0b9c83afbc1dc0d8b4889336ad019eba930c5d6a9c6c86c20c769c8" - "1.4.5": - url: "https://github.com/facebook/zstd/archive/v1.4.5.tar.gz" - sha256: "734d1f565c42f691f8420c8d06783ad818060fc390dee43ae0a89f86d0a4f8c2" - "1.4.4": - url: "https://github.com/facebook/zstd/archive/v1.4.4.tar.gz" - sha256: "a364f5162c7d1a455cc915e8e3cf5f4bd8b75d09bc0f53965b0c9ca1383c52c8" - "1.4.3": - url: "https://github.com/facebook/zstd/archive/v1.4.3.tar.gz" - sha256: "5eda3502ecc285c3c92ee0cc8cd002234dee39d539b3f692997a0e80de1d33de" - "1.3.8": - url: "https://github.com/facebook/zstd/archive/v1.3.8.tar.gz" - sha256: "90d902a1282cc4e197a8023b6d6e8d331c1fd1dfe60f7f8e4ee9da40da886dc3" - "1.3.5": - url: "https://github.com/facebook/zstd/archive/v1.3.5.tar.gz" - sha256: "d6e1559e4cdb7c4226767d4ddc990bff5f9aab77085ff0d0490c828b025e2eea" + url: "https://github.com/facebook/zstd/releases/download/v1.5.0/zstd-1.5.0.tar.gz" + sha256: "5194fbfa781fcf45b98c5e849651aa7b3b0a008c6b72d4a0db760f3002291e94" patches: + "1.5.6": + - patch_file: "patches/1.5.6-public-scope-windows-shared.patch" + patch_description: "Include zstd.h folder when building shared library on Windows" + patch_type: "bugfix" + patch_source: "https://github.com/facebook/zstd/pull/4009" + "1.5.5": + - 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.5-qnx_support.patch" + patch_description: "Add qnx to platform" + patch_type: "portability" + patch_source: "https://github.com/facebook/zstd/pull/3745" "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: "backport" - 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_file: "patches/1.5.0-remove-explicit-standard-setting.patch" - patch_description: "fix strange performance and scalability issues" - patch_type: "backport" + 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: "backport" + 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" - "1.3.5": - - patch_file: "patches/1.3.5-cmake-project.patch" diff --git a/recipes/zstd/all/conanfile.py b/recipes/zstd/all/conanfile.py index f981ffce2b67d..397fedfdf0451 100644 --- a/recipes/zstd/all/conanfile.py +++ b/recipes/zstd/all/conanfile.py @@ -1,12 +1,11 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -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 +from conan.tools.files import apply_conandata_patches, collect_libs, copy, export_conandata_patches, get, replace_in_file, rmdir, rm +import glob import os required_conan_version = ">=1.53.0" - class ZstdConan(ConanFile): name = "zstd" url = "https://github.com/conan-io/conan-center-index" @@ -15,16 +14,19 @@ class ZstdConan(ConanFile): topics = ("zstandard", "compression", "algorithm", "decoder") license = "BSD-3-Clause" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], "threading": [True, False], + "build_programs": [True, False], } default_options = { "shared": False, "fPIC": True, "threading": True, + "build_programs": True, } def export_sources(self): @@ -44,26 +46,21 @@ 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["ZSTD_BUILD_PROGRAMS"] = False - tc.variables["ZSTD_BUILD_STATIC"] = not self.options.shared + tc.variables["ZSTD_BUILD_PROGRAMS"] = self.options.build_programs + tc.variables["ZSTD_BUILD_STATIC"] = not self.options.shared or self.options.build_programs tc.variables["ZSTD_BUILD_SHARED"] = self.options.shared tc.variables["ZSTD_MULTITHREAD_SUPPORT"] = self.options.threading - if Version(self.version) < "1.4.3": - # 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) # Don't force PIC - if Version(self.version) >= "1.4.5": - replace_in_file(self, os.path.join(self.source_folder, "build", "cmake", "lib", "CMakeLists.txt"), - "POSITION_INDEPENDENT_CODE On", "") + replace_in_file(self, os.path.join(self.source_folder, "build", "cmake", "lib", "CMakeLists.txt"), + "POSITION_INDEPENDENT_CODE On", "") def build(self): self._patch_sources() @@ -77,16 +74,30 @@ def package(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")) + + if self.options.shared and self.options.build_programs: + # If we build programs we have to build static libs (see logic in generate()), + # but if shared is True, we only want shared lib in package folder. + rm(self, "*_static.*", os.path.join(self.package_folder, "lib")) + for lib in glob.glob(os.path.join(self.package_folder, "lib", "*.a")): + if not lib.endswith(".dll.a"): + os.remove(lib) def package_info(self): zstd_cmake = "libzstd_shared" if self.options.shared else "libzstd_static" self.cpp_info.set_property("cmake_file_name", "zstd") self.cpp_info.set_property("cmake_target_name", f"zstd::{zstd_cmake}") self.cpp_info.set_property("pkg_config_name", "libzstd") - self.cpp_info.components["zstdlib"].set_property("pkg_config_name", "libzstd") - self.cpp_info.components["zstdlib"].names["cmake_find_package"] = zstd_cmake - self.cpp_info.components["zstdlib"].names["cmake_find_package_multi"] = zstd_cmake - self.cpp_info.components["zstdlib"].set_property("cmake_target_name", f"zstd::{zstd_cmake}") self.cpp_info.components["zstdlib"].libs = collect_libs(self) if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["zstdlib"].system_libs.append("pthread") + + # TODO: Remove after dropping Conan 1.x from ConanCenterIndex + self.cpp_info.components["zstdlib"].names["cmake_find_package"] = zstd_cmake + self.cpp_info.components["zstdlib"].names["cmake_find_package_multi"] = zstd_cmake + self.cpp_info.components["zstdlib"].set_property("cmake_target_name", f"zstd::{zstd_cmake}") + self.cpp_info.components["zstdlib"].set_property("pkg_config_name", "libzstd") + if self.options.build_programs: + bindir = os.path.join(self.package_folder, "bin") + self.env_info.PATH.append(bindir) diff --git a/recipes/zstd/all/patches/1.3.5-cmake-project.patch b/recipes/zstd/all/patches/1.3.5-cmake-project.patch deleted file mode 100644 index c8c9479c8ede1..0000000000000 --- a/recipes/zstd/all/patches/1.3.5-cmake-project.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/build/cmake/CMakeLists.txt -+++ b/build/cmake/CMakeLists.txt -@@ -7,8 +7,8 @@ - # in the COPYING file in the root directory of this source tree). - # ################################################################ - --PROJECT(zstd) - CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9) -+PROJECT(zstd) - SET(ZSTD_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../..") - LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules") - INCLUDE(GNUInstallDirs) diff --git a/recipes/zstd/all/patches/1.4.5-cmake-install-dll.patch b/recipes/zstd/all/patches/1.4.5-cmake-install-dll.patch deleted file mode 100644 index 9433dfdbea9cb..0000000000000 --- a/recipes/zstd/all/patches/1.4.5-cmake-install-dll.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- build/cmake/lib/CMakeLists.txt 2020-05-22 05:04:00.000000000 +0000 -+++ build/cmake/lib/CMakeLists.txt 2020-05-22 19:14:38.249960211 +0000 -@@ -161,6 +161,7 @@ - install(TARGETS ${library_targets} - EXPORT zstdExports - INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" -+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" - ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" - LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" - ) diff --git a/recipes/zstd/all/patches/1.5.1-cmake-remove-asm-except-x86_64.patch b/recipes/zstd/all/patches/1.5.1-cmake-remove-asm-except-x86_64.patch deleted file mode 100644 index 34bb693b4e039..0000000000000 --- a/recipes/zstd/all/patches/1.5.1-cmake-remove-asm-except-x86_64.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/build/cmake/lib/CMakeLists.txt b/build/cmake/lib/CMakeLists.txt -index 7ba4693..d6e1046 100644 ---- a/build/cmake/lib/CMakeLists.txt -+++ b/build/cmake/lib/CMakeLists.txt -@@ -22,7 +22,11 @@ include_directories(${LIBRARY_DIR} ${LIBRARY_DIR}/common) - - file(GLOB CommonSources ${LIBRARY_DIR}/common/*.c) - file(GLOB CompressSources ${LIBRARY_DIR}/compress/*.c) --file(GLOB DecompressSources ${LIBRARY_DIR}/decompress/*.c ${LIBRARY_DIR}/decompress/*.S) -+if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64") -+ file(GLOB DecompressSources ${LIBRARY_DIR}/decompress/*.c ${LIBRARY_DIR}/decompress/*.S) -+else() -+ file(GLOB DecompressSources ${LIBRARY_DIR}/decompress/*.c) -+endif() - file(GLOB DictBuilderSources ${LIBRARY_DIR}/dictBuilder/*.c) - - set(Sources diff --git a/recipes/zstd/all/patches/1.5.5-qnx_support.patch b/recipes/zstd/all/patches/1.5.5-qnx_support.patch new file mode 100644 index 0000000000000..ba58a24cceb49 --- /dev/null +++ b/recipes/zstd/all/patches/1.5.5-qnx_support.patch @@ -0,0 +1,11 @@ +--- programs/platform.h 2023-04-04 22:13:52.000000000 +0200 ++++ programs/platform.h 2023-09-03 10:01:58.930595800 +0200 +@@ -89,7 +89,7 @@ + */ + # elif !defined(_WIN32) \ + && ( defined(__unix__) || defined(__unix) \ +- || defined(__midipix__) || defined(__VMS) || defined(__HAIKU__) ) ++ || defined(_QNX_SOURCE) || defined(__midipix__) || defined(__VMS) || defined(__HAIKU__) ) + + # if defined(__linux__) || defined(__linux) || defined(__CYGWIN__) + # ifndef _POSIX_C_SOURCE diff --git a/recipes/zstd/all/patches/1.5.6-public-scope-windows-shared.patch b/recipes/zstd/all/patches/1.5.6-public-scope-windows-shared.patch new file mode 100644 index 0000000000000..9862de8aaa890 --- /dev/null +++ b/recipes/zstd/all/patches/1.5.6-public-scope-windows-shared.patch @@ -0,0 +1,13 @@ +diff --git a/build/cmake/lib/CMakeLists.txt b/build/cmake/lib/CMakeLists.txt +index 5d514cc..1791897 100644 +--- a/build/cmake/lib/CMakeLists.txt ++++ b/build/cmake/lib/CMakeLists.txt +@@ -123,7 +123,7 @@ set(PUBLIC_INCLUDE_DIRS ${LIBRARY_DIR}) + set(library_targets) + if (ZSTD_BUILD_SHARED) + add_library(libzstd_shared SHARED ${Sources} ${Headers} ${PlatformDependResources}) +- target_include_directories(libzstd_shared INTERFACE $) ++ target_include_directories(libzstd_shared PUBLIC $) + list(APPEND library_targets libzstd_shared) + if (ZSTD_MULTITHREAD_SUPPORT) + set_property(TARGET libzstd_shared APPEND PROPERTY COMPILE_DEFINITIONS "ZSTD_MULTITHREAD") diff --git a/recipes/zstd/all/test_package/conanfile.py b/recipes/zstd/all/test_package/conanfile.py index 6f307ff1c207f..541303d07640d 100644 --- a/recipes/zstd/all/test_package/conanfile.py +++ b/recipes/zstd/all/test_package/conanfile.py @@ -13,7 +13,7 @@ def layout(self): cmake_layout(self) def requirements(self): - self.requires(self.tested_reference_str) + self.requires(self.tested_reference_str, run=True) def build(self): cmake = CMake(self) @@ -21,7 +21,8 @@ def build(self): cmake.build() def test(self): - if can_run(self): - bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") - png_file = os.path.join(self.source_folder, "logo.png") - self.run(f"{bin_path} {png_file}", env="conanrun") + if not can_run(self): + return + + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/zstd/all/test_package/logo.png b/recipes/zstd/all/test_package/logo.png deleted file mode 100644 index ef3d175cdec07..0000000000000 Binary files a/recipes/zstd/all/test_package/logo.png and /dev/null differ diff --git a/recipes/zstd/all/test_package/test_package.c b/recipes/zstd/all/test_package/test_package.c index 6ef7323d43a0d..29bca24047b95 100644 --- a/recipes/zstd/all/test_package/test_package.c +++ b/recipes/zstd/all/test_package/test_package.c @@ -1,126 +1,12 @@ -/* - * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. - */ - - -#include // malloc, free, exit -#include // fprintf, perror, feof, fopen, etc. -#include // strlen, memset, strcat -#include // presumes zstd library is installed - - -static void* malloc_orDie(size_t size) -{ - void* const buff = malloc(size); - if (buff) return buff; - /* error */ - perror("malloc:"); - exit(1); -} - -static FILE* fopen_orDie(const char *filename, const char *instruction) -{ - FILE* const inFile = fopen(filename, instruction); - if (inFile) return inFile; - /* error */ - perror(filename); - exit(3); -} - -static size_t fread_orDie(void* buffer, size_t sizeToRead, FILE* file) -{ - size_t const readSize = fread(buffer, 1, sizeToRead, file); - if (readSize == sizeToRead) return readSize; /* good */ - if (feof(file)) return readSize; /* good, reached end of file */ - /* error */ - perror("fread"); - exit(4); -} - -static size_t fwrite_orDie(const void* buffer, size_t sizeToWrite, FILE* file) -{ - size_t const writtenSize = fwrite(buffer, 1, sizeToWrite, file); - if (writtenSize == sizeToWrite) return sizeToWrite; /* good */ - /* error */ - perror("fwrite"); - exit(5); -} - -static size_t fclose_orDie(FILE* file) -{ - if (!fclose(file)) return 0; - /* error */ - perror("fclose"); - exit(6); -} - - -static void compressFile_orDie(const char* fname, const char* outName, int cLevel) -{ - FILE* const fin = fopen_orDie(fname, "rb"); - FILE* const fout = fopen_orDie(outName, "wb"); - size_t const buffInSize = ZSTD_CStreamInSize(); /* can always read one full block */ - void* const buffIn = malloc_orDie(buffInSize); - size_t const buffOutSize = ZSTD_CStreamOutSize(); /* can always flush a full block */ - void* const buffOut = malloc_orDie(buffOutSize); - - ZSTD_CStream* const cstream = ZSTD_createCStream(); - if (cstream==NULL) { fprintf(stderr, "ZSTD_createCStream() error \n"); exit(10); } - size_t const initResult = ZSTD_initCStream(cstream, cLevel); - if (ZSTD_isError(initResult)) { fprintf(stderr, "ZSTD_initCStream() error : %s \n", ZSTD_getErrorName(initResult)); exit(11); } - - size_t read, toRead = buffInSize; - while( (read = fread_orDie(buffIn, toRead, fin)) ) { - ZSTD_inBuffer input = { buffIn, read, 0 }; - while (input.pos < input.size) { - ZSTD_outBuffer output = { buffOut, buffOutSize, 0 }; - toRead = ZSTD_compressStream(cstream, &output , &input); /* toRead is guaranteed to be <= ZSTD_CStreamInSize() */ - if (ZSTD_isError(toRead)) { fprintf(stderr, "ZSTD_compressStream() error : %s \n", ZSTD_getErrorName(toRead)); exit(12); } - if (toRead > buffInSize) toRead = buffInSize; /* Safely handle case when `buffInSize` is manually changed to a value < ZSTD_CStreamInSize()*/ - fwrite_orDie(buffOut, output.pos, fout); - } - } - - ZSTD_outBuffer output = { buffOut, buffOutSize, 0 }; - size_t const remainingToFlush = ZSTD_endStream(cstream, &output); /* close frame */ - if (remainingToFlush) { fprintf(stderr, "not fully flushed"); exit(13); } - fwrite_orDie(buffOut, output.pos, fout); - - ZSTD_freeCStream(cstream); - fclose_orDie(fout); - fclose_orDie(fin); - free(buffIn); - free(buffOut); -} - - -static const char* createOutFilename_orDie(const char* filename) -{ - size_t const inL = strlen(filename); - size_t const outL = inL + 5; - void* outSpace = malloc_orDie(outL); - memset(outSpace, 0, outL); - strcat(outSpace, filename); - strcat(outSpace, ".zst"); - return (const char*)outSpace; -} - -int main(int argc, const char** argv) -{ - if (argc < 2) { - fprintf(stderr, "Need at least one argument\n"); - return 1; - } - const char* const inFilename = argv[1]; - - const char* const outFilename = createOutFilename_orDie("logo.png"); - compressFile_orDie(inFilename, outFilename, 1); +#include +#include +#include +#include + +int main() { + const char* originalData = "Sample text"; + size_t compressedSize = ZSTD_compressBound(strlen(originalData) + 1); + printf("%zu\n", compressedSize); return 0; } diff --git a/recipes/zstd/all/test_v1_package/conanfile.py b/recipes/zstd/all/test_v1_package/conanfile.py index c6bf65d610aa1..38f4483872d47 100644 --- a/recipes/zstd/all/test_v1_package/conanfile.py +++ b/recipes/zstd/all/test_v1_package/conanfile.py @@ -14,5 +14,4 @@ def build(self): def test(self): if not tools.cross_building(self): bin_path = os.path.join("bin", "test_package") - png_file = os.path.join(self.source_folder, os.pardir, "test_package", "logo.png") - self.run(f"{bin_path} {png_file}", run_environment=True) + self.run(bin_path, run_environment=True) diff --git a/recipes/zstd/config.yml b/recipes/zstd/config.yml index 3481a6e65080c..3b1802f0177ee 100644 --- a/recipes/zstd/config.yml +++ b/recipes/zstd/config.yml @@ -1,23 +1,9 @@ versions: - "1.5.2": - folder: all - "1.5.1": - folder: all - "1.5.0": - folder: all - "1.4.9": - folder: all - "1.4.8": + "1.5.6": folder: all - "1.4.7": + "1.5.5": folder: all - "1.4.5": - folder: all - "1.4.4": - folder: all - "1.4.3": - folder: all - "1.3.8": + "1.5.2": folder: all - "1.3.5": + "1.5.0": 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 512be7c200256..97a53cde0de88 100644 --- a/recipes/zstr/all/conanfile.py +++ b/recipes/zstr/all/conanfile.py @@ -14,6 +14,7 @@ class ZstrConan(ConanFile): topics = ("zlib", "wrapper", "compression") homepage = "https://github.com/mateidavid/zstr" url = "https://github.com/conan-io/conan-center-index" + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -21,7 +22,7 @@ def layout(self): basic_layout(self, src_folder="src") def requirements(self): - self.requires("zlib/1.2.13") + self.requires("zlib/[>=1.2.11 <2]") def package_id(self): self.info.clear() @@ -31,8 +32,7 @@ def validate(self): 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 build(self): pass diff --git a/recipes/zstr/all/test_v1_package/CMakeLists.txt b/recipes/zstr/all/test_v1_package/CMakeLists.txt index 629a41f38d6f8..9d54a092e0a67 100644 --- a/recipes/zstr/all/test_v1_package/CMakeLists.txt +++ b/recipes/zstr/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(zstr REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE zstr::zstr) -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/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/zug/all/conandata.yml b/recipes/zug/all/conandata.yml index ebe78dab88a5e..eec3bc50f0058 100644 --- a/recipes/zug/all/conandata.yml +++ b/recipes/zug/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "0.1.1": + url: "https://github.com/arximboldi/zug/archive/refs/tags/v0.1.1.tar.gz" + sha256: "1b9c8f962e40baa6f0c6af35f957444850063d550078a3ebd0227727b8ef193c" "cci.20220125": url: "https://github.com/arximboldi/zug/archive/deb266f4c7c35d325de7eb3d033f06e0809495f2.tar.gz" sha256: "4b36442059899b8570336ff9e2901f62fd58b839c9e3ff5d35497454e2324625" + "0.1.0": + url: "https://github.com/arximboldi/zug/archive/refs/tags/v0.1.0.tar.gz" + sha256: "7d9d57a55399784392ba8fa67fcf246b9f5aec8f002c69e1fe4b5f66657214b8" diff --git a/recipes/zug/all/conanfile.py b/recipes/zug/all/conanfile.py index 6b0b0f5b3f121..c6c9a25ac397e 100644 --- a/recipes/zug/all/conanfile.py +++ b/recipes/zug/all/conanfile.py @@ -1,26 +1,31 @@ import os -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 copy, get +from conan.tools.layout import basic_layout from conan.tools.microsoft import is_msvc -from conans.errors import ConanInvalidConfiguration +from conan.tools.scm import Version + +required_conan_version = ">=1.52.0" class ZugConan(ConanFile): name = "zug" + description = "Transducers for C++ — Clojure style higher order push/pull sequence transformations" license = "BSL-1.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://sinusoid.es/zug/" - description = "Transducers for C++ — Clojure style higher order push/pull \ - sequence transformations" - topics = ("transducer", "algorithm", "signals") - settings = ("compiler", "arch", "os", "build_type") + topics = ("transducer", "algorithm", "signals", "header-only") + + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - def source(self): - tools.get( - **self.conan_data["sources"][self.version], - strip_root=True, - destination=self.source_folder - ) + @property + def _min_cppstd(self): + return 14 @property def _compilers_minimum_version(self): @@ -28,30 +33,42 @@ def _compilers_minimum_version(self): "Visual Studio": "15", "gcc": "5", "clang": "3.5", - "apple-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.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, "14") + check_min_cppstd(self, self._min_cppstd) 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") + self.output.warning("Unknown compiler, assuming it supports at least C++14") return - version = tools.Version(self.settings.compiler.version) + version = Version(self.settings.compiler.version) if version < self._compilers_minimum_version[compiler]: raise ConanInvalidConfiguration(f"{self.name} requires a compiler that supports at least C++14") - def package_id(self): - self.info.header_only() + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self.source_folder) - self.copy(pattern="*.hpp", dst=os.path.join("include", "zug"), src=os.path.join(self.source_folder, "zug")) + copy(self, "LICENSE", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder) + copy(self, "*.hpp", + dst=os.path.join(self.package_folder, "include", "zug"), + src=os.path.join(self.source_folder, "zug")) def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + if is_msvc(self): self.cpp_info.cxxflags = ["/Zc:externConstexpr"] - diff --git a/recipes/zug/all/test_package/CMakeLists.txt b/recipes/zug/all/test_package/CMakeLists.txt index 415cd1f23e3ba..d3e67e2768597 100644 --- a/recipes/zug/all/test_package/CMakeLists.txt +++ b/recipes/zug/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(PackageTest CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(zug CONFIG REQUIRED) +find_package(zug REQUIRED CONFIG) add_executable(test_package example.cpp) target_link_libraries(test_package zug::zug) diff --git a/recipes/zug/all/test_package/conanfile.py b/recipes/zug/all/test_package/conanfile.py index 34e439b02360c..fae501d0afb9e 100644 --- a/recipes/zug/all/test_package/conanfile.py +++ b/recipes/zug/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 ZugTestConan(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" + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/zug/all/test_package/example.cpp b/recipes/zug/all/test_package/example.cpp index a9657ec7c452c..eee3087fd4982 100644 --- a/recipes/zug/all/test_package/example.cpp +++ b/recipes/zug/all/test_package/example.cpp @@ -1,8 +1,8 @@ -#include - #include #include +#include + using namespace zug; int main() diff --git a/recipes/zug/all/test_v1_package/CMakeLists.txt b/recipes/zug/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/zug/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/zug/all/test_v1_package/conanfile.py b/recipes/zug/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..34e439b02360c --- /dev/null +++ b/recipes/zug/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +import os +from conans import ConanFile, CMake, tools + + +class ZugTestConan(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/zug/config.yml b/recipes/zug/config.yml index 9fd2ace3e66a6..f6a5245cc2d90 100644 --- a/recipes/zug/config.yml +++ b/recipes/zug/config.yml @@ -1,3 +1,7 @@ versions: + "0.1.1": + folder: all "cci.20220125": folder: all + "0.1.0": + folder: all diff --git a/recipes/zulu-openjdk/all/conandata.yml b/recipes/zulu-openjdk/all/conandata.yml index 5243fbdebc8c0..79b65fbdb247a 100644 --- a/recipes/zulu-openjdk/all/conandata.yml +++ b/recipes/zulu-openjdk/all/conandata.yml @@ -1,64 +1,150 @@ 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": + "21.0.4": "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/zulu21.36.17-ca-jdk21.0.4-win_x64.zip" + sha256: "d771dad10d3f0b440c3686d1f3d2b68b320802ac97b212d87671af3f2eef8848" + "armv8": + url: "https://cdn.azul.com/zulu/bin/zulu21.36.17-ca-jdk21.0.4-win_aarch64.zip" + sha256: "9f873eccf030b1d3dc879ec1eb0ff5e11bf76002dc81c5c644c3462bf6c5146b" + "Linux": + "x86_64": + url: "https://cdn.azul.com/zulu/bin/zulu21.36.17-ca-jdk21.0.4-linux_x64.tar.gz" + sha256: "318d0c2ed3c876fb7ea2c952945cdcf7decfb5264ca51aece159e635ac53d544" + "armv8": + url: "https://cdn.azul.com/zulu/bin/zulu21.36.17-ca-jdk21.0.4-linux_aarch64.tar.gz" + sha256: "da3c2d7db33670bcf66532441aeb7f33dcf0d227c8dafe7ce35cee67f6829c4c" + "Macos": + "x86_64": + url: "https://cdn.azul.com/zulu/bin/zulu21.36.17-ca-jdk21.0.4-macosx_x64.tar.gz" + sha256: "5ce75a6a247c7029b74c4ca7cf6f60fd2b2d68ce1e8956fb448d2984316b5fea" + "armv8": + url: "https://cdn.azul.com/zulu/bin/zulu21.36.17-ca-jdk21.0.4-macosx_aarch64.tar.gz" + sha256: "bc2750f81a166cc6e9c30ae8aaba54f253a8c8ec9d8cfc04a555fe20712c7bff" + "21.0.1": + "Windows": + "x86_64": + url: "https://cdn.azul.com/zulu/bin/zulu21.30.15-ca-jdk21.0.1-win_x64.zip" + sha256: "f6541ceed2eb0b793fd27f22d9f8192ad1c9c4c53e528dd0a1e6ec8d7c3a33d3" + "Linux": + "x86_64": + url: "https://cdn.azul.com/zulu/bin/zulu21.30.15-ca-jdk21.0.1-linux_x64.tar.gz" + sha256: "bf4842dd3a17cfe85523be5848b5ec3bc3d811afc74feab791befa4c895c4449" + "armv8": + url: "https://cdn.azul.com/zulu/bin/zulu21.30.15-ca-jdk21.0.1-linux_aarch64.tar.gz" + sha256: "00863e2b9910a5ed4f55183b89459d2162147e871d96ab532479ab06d9fae03b" + "Macos": + "x86_64": + url: "https://cdn.azul.com/zulu/bin/zulu21.30.15-ca-jdk21.0.1-macosx_x64.tar.gz" + sha256: "667e3945ffd394317b5faf1f5bd4847d1f1d091f76543df27d9b3a2ee7bf7a7e" + "armv8": + url: "https://cdn.azul.com/zulu/bin/zulu21.30.15-ca-jdk21.0.1-macosx_aarch64.tar.gz" + sha256: "6e89b6ed60c0efcc1b5bb7c6b36710ce746751b316a16cc3f9915470c4eb2a00" + "17.0.9": + "Windows": + "x86_64": + url: "https://cdn.azul.com/zulu/bin/zulu17.46.19-ca-jdk17.0.9-win_x64.zip" + sha256: "32e110628ea0bd750b84e0f937e7c98874505e76a0590d759565dfa803f89ccf" + "Linux": + "x86_64": + url: "https://cdn.azul.com/zulu/bin/zulu17.46.19-ca-jdk17.0.9-linux_x64.tar.gz" + sha256: "5317630424ee4e4d2c1024240d2e6f94a7c06d17b01dd36859df4a4d679fc287" + "armv8": + url: "https://cdn.azul.com/zulu/bin/zulu17.46.19-ca-jdk17.0.9-linux_aarch64.tar.gz" + sha256: "90062201e7911696a449431a61dc0a55cd10cda516a9f2db54c410633a79302a" + "Macos": + "x86_64": + url: "https://cdn.azul.com/zulu/bin/zulu17.46.19-ca-jdk17.0.9-macosx_x64.tar.gz" + sha256: "19271b74c3f3b21f4978eda8f09908c063c456cea57265d71475ceefef5aa0ac" + "armv8": + url: "https://cdn.azul.com/zulu/bin/zulu17.46.19-ca-jdk17.0.9-macosx_aarch64.tar.gz" + sha256: "d6837676e55b97772b6512e253fdaf8ab282bb216c0f8366b6c5905cd02b5056" + "11.0.24": "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.74.15-ca-jdk11.0.24-linux_x64.tar.gz" + sha256: "a7aac0e69a99bf64a1a3ec96f08149ac069a5bbdaaefae922ee3a7465fd918b3" + "armv8": + url: "https://cdn.azul.com/zulu/bin/zulu11.74.15-ca-jdk11.0.24-linux_aarch64.tar.gz" + sha256: "4f473e6307c465c037889981ae2cb3c4133648409c7331b6e57540a4896033e1" + "x86": + url: "https://cdn.azul.com/zulu/bin/zulu11.74.15-ca-jdk11.0.24-linux_i686.tar.gz" + sha256: "d6e9f14562b6a6b89e37bc740e0700de8f831e81a64ce701ab0c5d6ba4fc1b71" "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", - } - + "armv8": + url: "https://cdn.azul.com/zulu/bin/zulu11.74.15-ca-jdk11.0.24-macosx_aarch64.tar.gz" + sha256: "f8ac458076c10f13753b7342033aaa073b715ef798023acf155ba814bff67514" + "x86_64": + url: "https://cdn.azul.com/zulu/bin/zulu11.74.15-ca-jdk11.0.24-macosx_x64.tar.gz" + sha256: "087ea956e8b43c89c732df8024e1344f686b02611c2c5449be6478299b9a9dac" + "SunOS": + "sparcv9": + url: "https://cdn.azul.com/zulu/bin/zulu11.74.15-ca-jdk11.0.24-solaris_sparcv9.zip" + sha256: "82e8eb5887592f290cec095c6c8466a576c8d8049c1c5eb8987822fba3bfdbb7" + "x86_64": + url: "https://cdn.azul.com/zulu/bin/zulu11.74.15-ca-jdk11.0.24-solaris_x64.zip" + sha256: "60b67de2325b7041e2495c5ae10574c960542fd7ad7eee1fef0d9bcaf63ce514" + "Windows": + "x86": + url: "https://cdn.azul.com/zulu/bin/zulu11.74.15-ca-jdk11.0.24-win_i686.zip" + sha256: "bae034bc5075e31123f76980f3f3234150f68cbe96e48d288291b8ea6c5124f4" + "x86_64": + url: "https://cdn.azul.com/zulu/bin/zulu11.74.15-ca-jdk11.0.24-win_x64.zip" + sha256: "1b1870eb161076dcadf2c6f85855969484d907f44f11c1483d86e964dc946323" + "11.0.19": + "Windows": + "x86_64": + url: "https://cdn.azul.com/zulu/bin/zulu11.64.19-ca-jdk11.0.19-win_x64.zip" + sha256: "19ef5239adddd63b47dd574119eeaacd116376e1a7a2449d013c2d23987c78a0" + "Linux": + "x86_64": + url: "https://cdn.azul.com/zulu/bin/zulu11.64.19-ca-jdk11.0.19-linux_x64.tar.gz" + sha256: "8b963105ad195c8f622b34dbac663ce11e5f73f4c84edd6dd1d364a26798b540" + "armv8": + url: "https://cdn.azul.com/zulu-embedded/bin/zulu11.64.19-ca-jdk11.0.19-linux_aarch64.tar.gz" + sha256: "edfea52958b765732e4ee97b821e78d6ebf66a69fc21bdf6035c38b0e2939820" + "Macos": + "x86_64": + url: "https://cdn.azul.com/zulu/bin/zulu11.64.19-ca-jdk11.0.19-macosx_x64.tar.gz" + sha256: "222630bd333f901f53cd0d2341975ec9a31fd6846166d4ce86e8a57a3d734ac5" + "armv8": + url: "https://cdn.azul.com/zulu/bin/zulu11.64.19-ca-jdk11.0.19-macosx_aarch64.tar.gz" + sha256: "f0d84d5f1ae9d67bbb28d4e97fe365692fcdf8f5ad49c57b525281ebb5807577" "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" + "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" + "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" "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.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.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.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" diff --git a/recipes/zulu-openjdk/all/conanfile.py b/recipes/zulu-openjdk/all/conanfile.py index df269044c419f..648597913dd65 100644 --- a/recipes/zulu-openjdk/all/conanfile.py +++ b/recipes/zulu-openjdk/all/conanfile.py @@ -1,21 +1,19 @@ -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration -from conans.tools import Version -import os, glob +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import get, copy +import os +required_conan_version = ">=1.53.0" class ZuluOpenJDK(ConanFile): name = "zulu-openjdk" - url = "https://github.com/conan-io/conan-center-index/" description = "A OpenJDK distribution" - homepage = "https://www.azul.com" license = "https://www.azul.com/products/zulu-and-zulu-enterprise/zulu-terms-of-use/" + url = "https://github.com/conan-io/conan-center-index/" + homepage = "https://www.azul.com" topics = ("java", "jdk", "openjdk") - settings = "os", "arch", "build_type", "compiler" - - @property - def _source_subfolder(self): - return "source_subfolder" + package_type = "application" + settings = "os", "arch", "compiler", "build_type" @property def _settings_build(self): @@ -27,41 +25,41 @@ def _jni_folder(self): return os.path.join("include", folder) def package_id(self): - del self.info.settings.build_type del self.info.settings.compiler + del self.info.settings.build_type 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}). " + f"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}). " + f"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", "vcruntime140_1.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) @@ -70,8 +68,10 @@ def package_info(self): java_home = self.package_folder bin_path = os.path.join(java_home, "bin") - self.output.info("Creating JAVA_HOME environment variable with : {0}".format(java_home)) + self.output.info(f"Creating JAVA_HOME environment variable with : {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.output.info(f"Appending PATH environment variable with : {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..0ef2c791e311c 100644 --- a/recipes/zulu-openjdk/config.yml +++ b/recipes/zulu-openjdk/config.yml @@ -1,7 +1,15 @@ versions: - "11.0.8": + "21.0.4": folder: all - "11.0.12": + "21.0.1": + folder: all + "17.0.9": + folder: all + "11.0.24": + folder: all + "11.0.19": folder: all "11.0.15": folder: all + "11.0.12": + folder: all 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..de7e69d1a2cb4 100644 --- a/recipes/zxing-cpp/all/conandata.yml +++ b/recipes/zxing-cpp/all/conandata.yml @@ -1,25 +1,39 @@ sources: + "2.2.1": + url: "https://github.com/zxing-cpp/zxing-cpp/archive/v2.2.1.tar.gz" + sha256: "02078ae15f19f9d423a441f205b1d1bee32349ddda7467e2c84e8f08876f8635" + "2.1.0": + url: "https://github.com/zxing-cpp/zxing-cpp/archive/v2.1.0.tar.gz" + sha256: "6d54e403592ec7a143791c6526c1baafddf4c0897bb49b1af72b70a0f0c4a3fe" + "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..51a640fb637ef 100644 --- a/recipes/zxing-cpp/all/conanfile.py +++ b/recipes/zxing-cpp/all/conanfile.py @@ -1,20 +1,22 @@ -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") - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -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..335926844a15f 100644 --- a/recipes/zxing-cpp/config.yml +++ b/recipes/zxing-cpp/config.yml @@ -1,4 +1,10 @@ versions: + "2.2.1": + folder: all + "2.1.0": + folder: all + "2.0.0": + folder: all "1.4.0": folder: all "1.3.0": diff --git a/recipes/zyre/all/CMakeLists.txt b/recipes/zyre/all/CMakeLists.txt deleted file mode 100644 index d04be130b6aa2..0000000000000 --- a/recipes/zyre/all/CMakeLists.txt +++ /dev/null @@ -1,13 +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) - -if(NOT BUILD_SHARED_LIBS) - add_definitions(-DZYRE_STATIC) -endif() - -add_subdirectory(source_subfolder) diff --git a/recipes/zyre/all/conandata.yml b/recipes/zyre/all/conandata.yml index cce2036293068..9f0637b08d296 100644 --- a/recipes/zyre/all/conandata.yml +++ b/recipes/zyre/all/conandata.yml @@ -2,19 +2,7 @@ sources: "2.0.1": url: "https://github.com/zeromq/zyre/archive/v2.0.1.tar.gz" sha256: "624d379dc880025144f58d3a7dc35ea1be4a57ba4e2a58c98ec15a60891be12d" - "2.0.0": - url: "https://github.com/zeromq/zyre/archive/v2.0.0.tar.gz" - sha256: "b978a999947ddb6722d956db2427869b313225e50518c4fbbf960a68109e3e91" patches: "2.0.1": - patch_file: "patches/2.0.1-0001-cmake-use-conan-disable-executables.patch" - base_path: "source_subfolder" - patch_file: "patches/2.0.1-0002-zyre-disable-git-escape-CMAKE_BUILD_TYPE.patch" - base_path: "source_subfolder" - "2.0.0": - - patch_file: "patches/2.0.0-0001-cmake-use-conan-disable-executables.patch" - base_path: "source_subfolder" - - patch_file: "patches/2.0.0-0002-zyre-disable-git-escape-CMAKE_BUILD_TYPE.patch" - base_path: "source_subfolder" - - patch_file: "patches/2.0.0-0003-fix-zyre-self-test-on-windows.patch" - base_path: "source_subfolder" diff --git a/recipes/zyre/all/conanfile.py b/recipes/zyre/all/conanfile.py index 2720136bcd4ee..be3408d481659 100644 --- a/recipes/zyre/all/conanfile.py +++ b/recipes/zyre/all/conanfile.py @@ -1,20 +1,23 @@ -from conans import ConanFile, CMake, tools -from conan.tools.microsoft import is_msvc import os -import functools -required_conan_version = ">=1.33.0" +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.microsoft import is_msvc + +required_conan_version = ">=1.53.0" + class ZyreConan(ConanFile): name = "zyre" + description = "Local Area Clustering for Peer-to-Peer Applications." license = "MPL-2.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/zeromq/zyre" - description = "Local Area Clustering for Peer-to-Peer Applications." - topics = ("zyre", "czmq", "zmq", "zeromq", - "message-queue", "asynchronous") + topics = ("czmq", "zmq", "zeromq", "message-queue", "asynchronous") + + package_type = "library" settings = "os", "arch", "compiler", "build_type" - generators = ["cmake", "cmake_find_package"] options = { "shared": [True, False], "fPIC": [True, False], @@ -26,18 +29,8 @@ class ZyreConan(ConanFile): "drafts": False, } - @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,47 +38,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("czmq/4.2.0") - self.requires("zeromq/4.3.4") + self.requires("czmq/4.2.1", transitive_headers=True) + self.requires("zeromq/4.3.5") if self.settings.os in ["Linux", "FreeBSD"]: - self.requires("libsystemd/249.7") + self.requires("libsystemd/255") 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["ENABLE_DRAFTS"] = self.options.drafts - if tools.Version(self.version) >= "2.0.1": - cmake.definitions["ZYRE_BUILD_SHARED"] = self.options.shared - cmake.definitions["ZYRE_BUILD_STATIC"] = not self.options.shared - cmake.configure(build_dir=self._build_subfolder) - return cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["ENABLE_DRAFTS"] = self.options.drafts + tc.variables["ZYRE_BUILD_SHARED"] = self.options.shared + tc.variables["ZYRE_BUILD_STATIC"] = not self.options.shared + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = self.options.shared + if not self.options.shared: + tc.preprocessor_definitions["ZYRE_STATIC"] = "" + # Relocatable shared lib on Macos + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" + tc.generate() + deps = CMakeDeps(self) + deps.set_property("zeromq", "cmake_file_name", "LIBZMQ") + deps.set_property("czmq", "cmake_file_name", "CZMQ") + deps.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "find_package(libzmq REQUIRED)", "find_package(LIBZMQ REQUIRED CONFIG)") + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "find_package(czmq REQUIRED)", "find_package(CZMQ REQUIRED CONFIG)") def build(self): - for patch in self.conan_data["patches"][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", src=self._source_subfolder, - dst="licenses") - 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", "pkgconfig",)) - 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, "lib", "pkgconfig")) + 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.names["pkg_config"] = "libzyre" - - libname = "libzyre" if tools.Version(self.version) >= "2.0.1" and is_msvc(self) and not self.options.shared else "zyre" + self.cpp_info.set_property("cmake_file_name", "zyre") + self.cpp_info.set_property("cmake_target_name", "zyre" if self.options.shared else "zyre-static") + self.cpp_info.set_property("pkg_config_name", "libzyre") + + libname = "zyre" + if is_msvc(self) and not self.options.shared: + libname = "libzyre" self.cpp_info.libs = [libname] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["pthread", "dl", "rt", "m"] diff --git a/recipes/zyre/all/patches/2.0.0-0001-cmake-use-conan-disable-executables.patch b/recipes/zyre/all/patches/2.0.0-0001-cmake-use-conan-disable-executables.patch deleted file mode 100644 index 1c404d27e174c..0000000000000 --- a/recipes/zyre/all/patches/2.0.0-0001-cmake-use-conan-disable-executables.patch +++ /dev/null @@ -1,66 +0,0 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -107,10 +107,10 @@ set(OPTIONAL_LIBRARIES) - ######################################################################## - # LIBZMQ dependency - ######################################################################## --find_package(libzmq REQUIRED) -+find_package(ZeroMQ REQUIRED) --IF (LIBZMQ_FOUND) -+IF (ZEROMQ_FOUND) -- include_directories(${LIBZMQ_INCLUDE_DIRS}) -- list(APPEND MORE_LIBRARIES ${LIBZMQ_LIBRARIES}) -+ include_directories(${CONAN_INCLUDE_DIRS_LIBZMQ}) -+ list(APPEND MORE_LIBRARIES ZeroMQ::ZeroMQ) - set(pkg_config_libs_private "${pkg_config_libs_private} -lzmq") - ELSE (LIBZMQ_FOUND) - message( FATAL_ERROR "libzmq not found." ) -@@ -121,8 +121,8 @@ ENDIF (LIBZMQ_FOUND) - ######################################################################## - find_package(czmq REQUIRED) - IF (CZMQ_FOUND) -- include_directories(${CZMQ_INCLUDE_DIRS}) -- list(APPEND MORE_LIBRARIES ${CZMQ_LIBRARIES}) -+ include_directories(${CONAN_INCLUDE_DIRS_CZMQ}) -+ list(APPEND MORE_LIBRARIES czmq::czmq) - set(pkg_config_libs_private "${pkg_config_libs_private} -lczmq") - ELSE (CZMQ_FOUND) - message( FATAL_ERROR "czmq not found." ) -@@ -168,7 +168,7 @@ - endif() - add_library(zyre ${zyre_sources}) - set_target_properties(zyre -- PROPERTIES DEFINE_SYMBOL "ZYRE_EXPORTS" -+ PROPERTIES DEFINE_SYMBOL "ZYRE_EXPORTS" LINKER_LANGUAGE CXX - ) - set_target_properties (zyre - PROPERTIES SOVERSION "2.0.0" -@@ -182,9 +182,9 @@ install(TARGETS zyre - ARCHIVE DESTINATION "lib${LIB_SUFFIX}" # .lib file - RUNTIME DESTINATION bin # .dll file - ) -- -+if(BUILD_EXECUTABLES) - include(${CMAKE_CURRENT_SOURCE_DIR}/src/CMakeLists-local.txt) # Optional project-local hook -- -+endif() - ######################################################################## - # pkgconfig - ######################################################################## -@@ -211,6 +211,7 @@ install( - ######################################################################## - # executables - ######################################################################## -+if(BUILD_EXECUTABLES) - add_executable( - perf_local - "${SOURCE_DIR}/src/perf_local.c" -@@ -304,7 +305,7 @@ set_target_properties( - zyre_selftest - PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${SOURCE_DIR}/src" - ) -- -+endif() - ######################################################################## - # tests - ######################################################################## diff --git a/recipes/zyre/all/patches/2.0.0-0002-zyre-disable-git-escape-CMAKE_BUILD_TYPE.patch b/recipes/zyre/all/patches/2.0.0-0002-zyre-disable-git-escape-CMAKE_BUILD_TYPE.patch deleted file mode 100644 index 055ebeaf29096..0000000000000 --- a/recipes/zyre/all/patches/2.0.0-0002-zyre-disable-git-escape-CMAKE_BUILD_TYPE.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -22,7 +22,7 @@ - ######################################################################## - # options - ######################################################################## --if (NOT CMAKE_BUILD_TYPE) -+if (0) - if (EXISTS "${SOURCE_DIR}/.git") - set (CMAKE_BUILD_TYPE Debug) - else () -@@ -43,7 +43,7 @@ - endif () - endif () - endif () --if (${CMAKE_BUILD_TYPE} STREQUAL "Debug") -+if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") - OPTION (ENABLE_DRAFTS "Build and install draft classes and methods" ON) - else () - OPTION (ENABLE_DRAFTS "Build and install draft classes and methods" OFF) diff --git a/recipes/zyre/all/patches/2.0.0-0003-fix-zyre-self-test-on-windows.patch b/recipes/zyre/all/patches/2.0.0-0003-fix-zyre-self-test-on-windows.patch deleted file mode 100644 index 961bb8d6f2a19..0000000000000 --- a/recipes/zyre/all/patches/2.0.0-0003-fix-zyre-self-test-on-windows.patch +++ /dev/null @@ -1,55 +0,0 @@ -https://github.com/zeromq/czmq/commit/8f8aa86ec1ecf903a614a26aa9e4dd63ace4ffd1 - ---- src/zre_msg.c -+++ src/zre_msg.c -@@ -1766,4 +1766,7 @@ - // @end - -+#ifdef __WINDOWS__ -+ zsys_shutdown(); -+#endif - printf ("OK\n"); - } ---- src/zyre.c -+++ src/zyre.c -@@ -738,6 +738,9 @@ - zyre_destroy (&node2); - // @end -+#ifdef __WINDOWS__ -+ zsys_shutdown(); -+#endif - printf ("OK\n"); - - // zre_msg, zyre_group, zyre_node and zyre_peer are private classes and - // symbols are not exported so the tests can't be run from zyre_selftest, ---- src/zyre_group.c -+++ src/zyre_group.c -@@ -171,5 +171,8 @@ - zhash_destroy (&groups); - zsock_destroy (&mailbox); -+#ifdef __WINDOWS__ -+ zsys_shutdown(); -+#endif - printf ("OK\n"); - } - ---- src/zyre_node.c -+++ src/zyre_node.c -@@ -1022,4 +1022,7 @@ - zsock_destroy (&pipe); - // Node takes ownership of outbox and destroys it -+#ifdef __WINDOWS__ -+ zsys_shutdown(); -+#endif - printf ("OK\n"); - } ---- src/zyre_peer.c -+++ src/zyre_peer.c -@@ -475,4 +475,7 @@ - zsock_destroy (&mailbox); - -+#ifdef __WINDOWS__ -+ zsys_shutdown(); -+#endif - printf ("OK\n"); - } diff --git a/recipes/zyre/all/patches/2.0.1-0001-cmake-use-conan-disable-executables.patch b/recipes/zyre/all/patches/2.0.1-0001-cmake-use-conan-disable-executables.patch index b13f4721e04bf..156d0f5972669 100644 --- a/recipes/zyre/all/patches/2.0.1-0001-cmake-use-conan-disable-executables.patch +++ b/recipes/zyre/all/patches/2.0.1-0001-cmake-use-conan-disable-executables.patch @@ -2,51 +2,7 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt index e285ba0..69f3c19 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -126,33 +126,23 @@ 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 (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) -+find_package(ZeroMQ REQUIRED) -+IF (ZEROMQ_FOUND) -+ include_directories(${CONAN_INCLUDE_DIRS_LIBZMQ}) -+ list(APPEND MORE_LIBRARIES ZeroMQ::ZeroMQ) -+ set(pkg_config_libs_private "${pkg_config_libs_private} -lzmq") -+ELSE (ZEROMQ_FOUND) - message( FATAL_ERROR "libzmq not found." ) --ENDIF (LIBZMQ_FOUND) -+ENDIF (ZEROMQ_FOUND) - - ######################################################################## - # CZMQ dependency - ######################################################################## - find_package(czmq REQUIRED) - IF (CZMQ_FOUND) -- include_directories(${CZMQ_INCLUDE_DIRS}) -- list(APPEND MORE_LIBRARIES ${CZMQ_LIBRARIES}) -- IF (PC_CZMQ_FOUND) -- set(pkg_config_names_private "${pkg_config_names_private} libczmq") -- list(APPEND OPTIONAL_LIBRARIES_STATIC ${PC_CZMQ_STATIC_LDFLAGS}) -- ELSE (PC_CZMQ_FOUND) -- set(pkg_config_libs_private "${pkg_config_libs_private} -lczmq") -- ENDIF (PC_CZMQ_FOUND) -+ include_directories(${CONAN_INCLUDE_DIRS_CZMQ}) -+ list(APPEND MORE_LIBRARIES czmq::czmq) -+ set(pkg_config_libs_private "${pkg_config_libs_private} -lczmq") - ELSE (CZMQ_FOUND) - message( FATAL_ERROR "czmq not found." ) - ENDIF (CZMQ_FOUND) -@@ -237,6 +227,7 @@ if (ZYRE_BUILD_SHARED) +@@ -237,6 +237,7 @@ if (ZYRE_BUILD_SHARED) set_target_properties (zyre PROPERTIES PUBLIC_HEADER "${public_headers}" DEFINE_SYMBOL "ZYRE_EXPORTS" @@ -65,7 +21,7 @@ index e285ba0..69f3c19 100644 ######################################################################## # pkgconfig -@@ -360,6 +352,7 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/zyreConfig.cmake +@@ -360,6 +362,7 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/zyreConfig.cmake ######################################################################## # executables ######################################################################## @@ -73,7 +29,7 @@ index e285ba0..69f3c19 100644 add_executable( perf_local "${SOURCE_DIR}/src/perf_local.c" -@@ -491,6 +484,7 @@ target_link_libraries( +@@ -491,6 +494,7 @@ target_link_libraries( ${OPTIONAL_LIBRARIES} ) endif() @@ -81,7 +37,7 @@ index e285ba0..69f3c19 100644 if (NOT TARGET zyre AND TARGET zyre-static) target_link_libraries( zyre_selftest -@@ -501,6 +495,7 @@ target_link_libraries( +@@ -501,6 +515,7 @@ target_link_libraries( ${OPTIONAL_LIBRARIES_STATIC} ) endif() diff --git a/recipes/zyre/all/test_package/CMakeLists.txt b/recipes/zyre/all/test_package/CMakeLists.txt index cb1a41293b4f6..fb8dcf9d49558 100644 --- a/recipes/zyre/all/test_package/CMakeLists.txt +++ b/recipes/zyre/all/test_package/CMakeLists.txt @@ -1,10 +1,12 @@ -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() - -find_package(zyre CONFIG REQUIRED) +find_package(zyre REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} zyre::zyre) +if(TARGET zyre-static) + target_link_libraries(${PROJECT_NAME} PRIVATE zyre-static) +else() + target_link_libraries(${PROJECT_NAME} PRIVATE zyre) +endif() +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/zyre/all/test_package/conanfile.py b/recipes/zyre/all/test_package/conanfile.py index 38f4483872d47..ef5d7042163ec 100644 --- a/recipes/zyre/all/test_package/conanfile.py +++ b/recipes/zyre/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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/zyre/all/test_package/test_package.cpp b/recipes/zyre/all/test_package/test_package.cpp index 7e0b34256ef83..1ec72703b4d64 100644 --- a/recipes/zyre/all/test_package/test_package.cpp +++ b/recipes/zyre/all/test_package/test_package.cpp @@ -5,7 +5,7 @@ int main(void) { uint64_t version = zyre_version(); - std::cout << "zyre version : " << version << std::endl; + std::cout << "zyre version : " << version << std::endl; return 0; } diff --git a/recipes/zyre/config.yml b/recipes/zyre/config.yml index 184166496d26e..bb7eb85dfac49 100644 --- a/recipes/zyre/config.yml +++ b/recipes/zyre/config.yml @@ -1,5 +1,3 @@ versions: "2.0.1": folder: all - "2.0.0": - folder: all 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 861c8075ce77d..bb584cb53822b 100644 --- a/recipes/zziplib/all/conanfile.py +++ b/recipes/zziplib/all/conanfile.py @@ -49,7 +49,7 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("zlib/1.2.13") + self.requires("zlib/[>=1.2.11 <2]") def source(self): get(self, **self.conan_data["sources"][self.version], @@ -101,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/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